diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..d0439206 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,47 @@ +{ + "name": "Python Translation Devcontainer", + "image": "python:3.12-slim", + "customizations": { + "vscode": { + "extensions": [ + "eamodio.gitlens", + "github.vscode-pull-request-github", + "github.vscode-github-actions", + "redhat.vscode-yaml", + "gettext.gettext", + "restructuredtext.restructuredtext" + ], + "settings": { + "[python]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + } + }, + "python.defaultInterpreterPath": "/usr/local/bin/python3", + "terminal.integrated.defaultProfile.linux": "zsh", + "terminal.integrated.profiles.linux": { + "zsh": { + "path": "/bin/zsh" + } + }, + "terminal.integrated.env.linux": { + "ZSH": "/bin/zsh" + } + } + } + }, + "features": { + "ghcr.io/devcontainers/features/git:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/common-utils:2": {} + }, + "workspaceFolder": "/python-docs-el", + "workspaceMount": "source=${localWorkspaceFolder},target=/python-docs-el,type=bind,consistency=cached", + "postCreateCommand": "sudo apt-get update && sudo apt-get install -y hunspell hunspell-el && pip install -r ./requirements.txt", + "mounts": [ + "source=pip-cache,target=/home/translator/.cache/pip,type=volume" + ], + "remoteUser": "translator" +} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 61d7b6e9..00ebce5a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ # Global Owners -* @thepetk @lysnikolaou @gzisopoulos @skpanagiotis +* @pygreece/translation diff --git a/.github/workflows/precommit.yaml b/.github/workflows/precommit.yaml index 18c35af6..0376d6c6 100644 --- a/.github/workflows/precommit.yaml +++ b/.github/workflows/precommit.yaml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: - submodules: "true" + submodules: true fetch-depth: 2 - name: Setup python uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1 @@ -25,5 +25,5 @@ jobs: sudo apt-get update sudo apt-get install -y hunspell hunspell-el gettext language-pack-el locales-all - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 - - uses: pre-commit-ci/lite-action@9d882e7a565f7008d4faf128f27d1cb6503d4ebf # v1.0.2 + - uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0 if: always() diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 959a57ea..ccdfe361 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # v4.6.0 + rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # v5.0.0 hooks: - id: file-contents-sorter files: "dictionaries/main.txt" @@ -10,7 +10,7 @@ repos: - id: end-of-file-fixer - repo: https://git.afpy.org/AFPy/powrap - rev: df2a0a54804a6146cc9fbffb77464d4b5fe24f41 # v1.0.1 + rev: 416de333cc58dce4453d1257769d7c9abdde95f7 # v1.0.2 hooks: - id: powrap @@ -23,6 +23,6 @@ repos: - "--personal-dict=dictionaries/main.txt" - repo: https://github.com/sphinx-contrib/sphinx-lint - rev: ce6d7aeab24d60b6119dbad180540bf3c9ff31da # v0.9.1 + rev: ff671d6a030a3141634793e6d1e8909ab6091830 # v1.0.0 hooks: - id: sphinx-lint diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cf714472..bf08a0a0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,44 +1,83 @@ -# Οδηγός συνεισφοράς στο πρότζεκτ Python-Docs-Gr της κοινότητας PyGreece +# Οδηγός συνεισφοράς στο πρότζεκτ Python-Docs-El της κοινότητας PyGreece -Eυχαριστούμε πολύ για το ενδιαφέρον σας να συμμετέχετε στη μετάφραση των επίσημων εγγράφων της Python στα Ελληνικά! +Ευχαριστούμε πολύ για το ενδιαφέρον σας να συμμετέχετε στη μετάφραση των επίσημων εγγράφων της Python στα Ελληνικά! Το συγκεκριμένο πρότζεκτ έχει ξεκινήσει από το PyGreece, μια online κοινότητα εθελοντών της Python. Στο συγκεκριμένο repository θα βρείτε την ομάδα εργασίας που είναι υπεύθυνη για το πρότζεκτ. Όλο το περιεχόμενο της μετάφρασης συντηρείται από εθελοντές που συνεισφέρουν το χρόνο και την εργασία τους στην κοινότητα της Python. Σε περίπτωση που έχετε οποιαδήποτε απορία για το πρότζεκτ, μπορείτε να μας βρείτε με τους εξής τρόπους: -- Μπορείτε να μπείτε στον discord server του PyGreece (πρόσκληση εδώ: https://discord.gg/evcNPRVCMB) +- [Discord server](https://discord.gg/evcNPRVCMB) -- Μπορείτε να μας βρείτε στο linkedin [εδώ](https://www.linkedin.com/company/pygreece) +- [LinkedIn](https://www.linkedin.com/company/pygreece) Πριν ξεκινήσετε με την πρώτη σας μετάφραση θα θέλαμε να μοιραστούμε [κάποιες γενικές οδηγίες](#γενικές-οδηγίες). -## Βήμα 1: Github Setup +## Περιεχόμενα -Πρέπει να κάνετε αυτό το βήμα μόνο μία φορά. Με το συγκεκριμένο fork μπορείτε να κάνετε όσα PR θέλετε. +- [Προετοιμασία](#προετοιμασία) + - [Δημιουργία Fork και Ρύθμιση του Repository](#δημιουργία-fork-και-ρύθμιση-του-repository) + - [Χρήση DevContainers με VSCode](#χρήση-devcontainers-με-vscode-προτεινόμενη) + - [Εναλλακτικές Ρυθμίσεις](#εναλλακτικές-ρυθμίσεις) +- [Συνεισφορά](#συνεισφορά) + - [Μετάφραση Αρχείου](#μετάφραση-αρχείου) + - [Αξιολόγηση Μετάφρασης](#αξιολόγηση-μετάφρασης) + - [Λερώστε τα χέρια σας! Μεταφράστε!](#λερώστε-τα-χέρια-σας-μεταφράστε) +- [Εργαλεία Ελέγχου & Προεπισκόπηση Αλλαγών](#εργαλεία-ελέγχου--προεπισκόπηση-αλλαγών-προαιρετικό) +- [Γενικές Οδηγίες](#γενικές-οδηγίες) -1. Για να υποβάλετε μια μετάφραση, πρέπει να έχετε ένα fork του repository , κάνοντας κλικ στο κουμπί με την κόκκινη γραμμή από κάτω (για περισσότερες πληροφορίες δείτε [εδώ](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo)): +## Προετοιμασία -![fork](https://github.com/pygreece/python-docs-gr/blob/main/public/assets/fork_image.jpg?raw=true) +### Δημιουργία Fork και Ρύθμιση του Repository + +Ακολουθήστε τα παρακάτω βήματα για να ρυθμίσετε το περιβάλλον σας. Αυτό είναι απαραίτητο πριν ξεκινήσετε οποιαδήποτε μετάφραση και γίνεται μόνο μία φορά. Σκοπός είναι η δημιουργία ενός προσωπικού αντιγράφου του έργου. Με το συγκεκριμένο fork μπορείτε να κάνετε όσα PR θέλετε. + +1. Για να υποβάλετε μια μετάφραση, πρέπει να έχετε ένα fork του repository, κάνοντας click στο κουμπί fork όπως φαίνεται παρακάτω (για περισσότερες πληροφορίες δείτε [εδώ](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo)). Αυτό σας επιτρέπει να δημιουργήσετε ένα προσωπικό αντίγραφο του repository για να δουλέψετε και να κάνετε αλλαγές πάνω σε αυτό: + +![fork](/public/assets/fork-image.png) 2. Κάντε clone το repository που μόλις δημιουργήσατε: ```bash -git clone git@github.com:<το username σας>/python-docs-gr.git +git clone --recursive git@github.com:<το username σας>/python-docs-el.git ``` 3. Μεταβείτε στον φάκελο που δημιουργήθηκε: ```bash -cd python-docs-gr/ +cd python-docs-el/ ``` 4. Προσθέστε το επίσημο repository ως upstream: ```bash -git remote add upstream git@github.com:pygreece/python-docs-gr.git +git remote add upstream git@github.com:python/python-docs-el.git ``` -5. [Προαιρετικό βήμα] Δημιουργείστε ένα virtual environment και κάντε activate: +5. Προσθέστε το κατάλληλο URL για το upstream repository σας: + +```bash +git remote set-url --push upstream git@github.com:/cpython.git +``` + +### Χρήση DevContainers με VSCode [Προτεινόμενη] + +**Προαπαιτούμενα** + +- Εγκαταστήστε το Docker Desktop ([Οδηγίες Εγκατάστασης](https://www.docker.com/products/docker-desktop/)). +- Εγκαταστήστε το Visual Studio Code ([Κατεβάστε το εδώ](https://code.visualstudio.com)). +- Εγκαταστήστε την επέκταση Dev Containers στο VSCode ([Κατεβάστε την εδώ](vscode:extension/ms-vscode-remote.remote-containers)). + +Ανοίξτε το repository στο VSCode: + +```bash +code python-docs-el +``` + +Όταν σας ζητηθεί, ανοίξτε το DevContainer κάνοντας click στην επιλογή: "Reopen in Container". + +### Εναλλακτικές Ρυθμίσεις + +1. Δημιουργήστε ένα virtual environment και κάντε activate: ```bash python -m venv env @@ -46,66 +85,95 @@ source env/bin/activate # macOS or Linux env\Scripts\activate.bat # Windows ``` -6. [Προαιρετικό βήμα] Εγκαταστείστε τα requirements: +2. Εγκαταστήστε τα requirements: ```bash pip install -r requirements.txt ``` -## Βήμα 2: Ποια αρχεία πρέπει να μεταφραστούν; +### Συνεισφορά + +Έχουμε [μια λίστα με issues στο GitHub](https://github.com/python/python-docs-el/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation) όπου συντονίζουμε τη δουλειά που γίνεται ή που πρέπει να γίνει ώστε να γίνεται διαχωρισμός αρμοδιοτήτων και διαχείριση της δουλειάς και των απαιτούμενων ενεργειών. + +Οι τρόποι συνεισφοράς στο έργο είναι δύο: + +### Μετάφραση Αρχείου -Έχουμε [μια λίστα με issues στο GitHub](https://github.com/pygreece/python-docs-gr/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation) όπου συντονίζουμε τη δουλειά που γίνεται ώστε να μην μεταφραστεί το ίδιο έγγραφο δύο φορές. Η διαδικασία μετάφρασης ενός αρχείου είναι η εξής: +Μπορείτε να συνεισφέρετε στη μετάφραση ενός αρχείου από αυτά που θα βρείτε στα [issues](https://github.com/python/python-docs-el/issues?q=is%3Aissue+is%3Aopen+label%3Atranslation). -- Επιλέξτε οποιοδήποτε από τα issues που δεν έχουν ανατεθεί σε κάποιο άλλο άτομο. +Η διαδικασία μετάφρασης ενός αρχείου είναι η εξής: -- Αφήστε ένα σχόλιο για στο issue λέγοντας ότι θέλετε να το δουλέψετε. +- Επιλέξτε οποιοδήποτε από τα **Issues** που δεν έχουν ανατεθεί σε κάποιο άλλο άτομο. -- Περιμένετε έναν διαχειριστή να σας αναθέσει το issue. +- Αφήστε ένα σχόλιο στο **Issue** λέγοντας ότι θέλετε να συνεισφέρετε, αναλαμβάνοντας το συγκεκριμένο **Issue**. + +- Περιμένετε έναν διαχειριστή να σας αναθέσει το **Issue**. - Ξεκινήστε τη μετάφραση! -Σημειώστε πως όλα τα translation issues είναι χωρισμένα σε δύο milestones: +Τα **Issues** είναι χωρισμένα σε milestones: + +To milestone που μπορείτε να συνεισφέρετε είναι το [translate_3.12_additional](https://github.com/python/python-docs-el/milestone/3). Άν είναι η πρώτη σας φορά σε αυτό το έργο ή γενικότερα σε έργο ανοιχτού κώδικα είναι προτιμότερο να αναλάβετε ένα **Issue** με **label** [_good first issue_](https://github.com/python/python-docs-el/labels/good%20first%20issue). + +Επίσης, για διευκόλυνση, έχουμε κάνει μια κατηγοριοποίηση των **Issues** με βάση το μέγεθος (γραμμές κώδικα προς μετάφραση). Πιο αναλυτικά: + +- [small](https://github.com/python/python-docs-el/labels/small) για αρχεία με λιγότερες από _200_ γραμμές +- [medium](https://github.com/python/python-docs-el/labels/medium) για αρχεία με λιγότερες από _500_ γραμμές +- [large](https://github.com/python/python-docs-el/labels/large) για αρχεία με λιγότερες από _1000_ γραμμές +- [xlarge](https://github.com/python/python-docs-el/labels/xlarge) για αρχεία με λιγότερες από _2500_ γραμμές +- [god](https://github.com/python/python-docs-el/labels/small) (για τους τολμηρούς) για αρχεία με περισσότερες από _2500_ γραμμές + +### Αξιολόγηση Μετάφρασης + +Μπορείτε να συνεισφέρετε κάνοντας μια αξιολόγηση των ήδη μεταφρασμένων αρχείων, για τυχόν παρατηρήσεις, βελτιώσεις, ελλείψεις ή διορθώσεις στη μετάφραση. + +Η διαδικασία είναι: + +- Ανοίξτε ένα **Issue** + + ![new_issue](/public/assets/new-issue.png) + +- Γράψτε στην περιγραφή τις παρατηρήσεις σας. +- Μέσα από τα σχόλια του **Issue** θα συζητηθεί η παρατήρηση και το σχόλιο σας. +- Αν από τη συζήτηση προκύψει ότι απαιτείται κάποια αλλαγή, είναι αρεστό να την αναλάβετε εσείς. Κατ' αυτόν τον τρόπο θα κλείσετε το **Issue** σας με ένα δικό σας PR. -- Το πρώτο milestone ονομάζεται `translate_3.12_mvp` και όλα τα issues μέσα σε αυτό είναι τα απαραίτητα ώστε να δημοσιευτεί η μετάφραση. -- Το δεύτερο milestone ονομαζεται `translate_3.12_additional` και όλα τα issues μέσα σε αυτό είναι προεαιρετικά. +### Λερώστε τα χέρια σας! Μεταφράστε! -Ιδανικά θα θέλαμε πρώτα να ολοκληρώσουμε το `translate_3.12_mvp` milestone και εν συνεχεία να μεταφράσουμε όλα τα issues του `translate_3.12_additional`. +Εφόσον σας έχει ανατεθεί ένα αρχείο προς μετάφραση, ήρθε η ώρα να λερώσετε τα χέρια σας και να ξεκινήσετε! -## Βήμα 3: Ξεκινήστε τη μετάφραση! +Τα αρχεία που πρέπει να μεταφραστούν είναι αυτά με την κατάληξη `.po`. -1. Διαλέξτε το αρχείο που θέλετε να μεταφράσετε. Το αρχείο θα υπάρχει στον τίτλο του issue που έχετε αναλάβει. +Τα εργαλεία που προτείνουμε να χρησιμοποιήσετε είναι το [VSCode](https://code.visualstudio.com/) ή το [Poedit](https://poedit.net/). Για το [VSCode](https://code.visualstudio.com/) μια χρήσιμη επέκταση είναι το [`gettext` extension](https://marketplace.visualstudio.com/items?itemName=mrorz.language-gettext). Αντίθετα, το [Poedit](https://poedit.net/) χρησιμοποιεί ένα καλύτερο περιβάλλον διεπαφής και δεν απαιτείται να ασχοληθεί ο χρήστης με τη δομή του αρχείου. -2. Επιβεβαιώστε ότι είστε στο 3.12 branch (πολύ σημαντικό βήμα για να αποφύγετε να ξεκινήσετε ένα branch απο παλαιότερη έκδοση): +1. Επιβεβαιώστε ότι είστε στο 3.14 branch (πολύ σημαντικό βήμα για να αποφύγετε να ξεκινήσετε ένα branch από παλαιότερη έκδοση): ```bash -git checkout 3.12 +git checkout 3.14 ``` -3. Δημιουργείστε ένα branch βασισμένο στο αρχείο που θα δουλέψετε. Για παράδειγμα, εάν δουλέυετε στο αρχείο library/ast.po το όνομα του branch θα μπορούσε να είναι: +2. Δημιουργήστε ένα branch βασισμένο στο αρχείο που θα δουλέψετε. Για παράδειγμα, εάν δουλέυετε στο αρχείο library/ast.po το όνομα του branch θα μπορούσε να είναι: ```bash git checkout -b translate-library-ast -``` -4. Αφού έχετε διαλέξει το αρχείο σας, ξεκινήστε την μετάφραση στο IDE σας. Προτείνουμε το [poedit](https://poedit.net/) ή το [vscode](https://code.visualstudio.com/). + ή -5. Εάν χρησιμοποιείτε το `poedit` είναι πιθανό πως το αρχείο σας θα έχει σωστό structure, αλλά για παν ενδεχόμενο μπορείτε να το επιβεβαιώσετε με το `powrap`. Για να το εγκαταστείσετε: +git checkout -b library-set -```bash -powrap <φακελος>/<ονομα_του_αρχειου>.po + ή + +git checkout -b ft/library-set ``` -Εάν είστε χρήστης των windows μπορείτε να δείτε περισσότερες πληροφορίες [εδώ](https://python-docs-es.readthedocs.io/es/3.12/faq.html#powrap-windows). +3. Αφού έχετε διαλέξει το αρχείο σας, ξεκινήστε τη μετάφραση στο IDE της επιλογής σας. Επίσης, μπορείτε να χρησιμοποιήσετε εργαλεία για τη σωστή μετάφραση προτάσεων, φράσεων ή λέξεων. -6. **Έλεγχος ορθογραφίας**: Για να ελέγξετε την ορθοργραφία της μετάφρασης σας μπορείτε να χρησιμοποιείσετε το [pospell](https://github.com/AFPy/pospell) για να επιβεβαιώσετε ότι όλες οι λέξεις είναι γνωστές ή ανήκουν σε κάποιο από τα dictionaries. Μπορείτε επίσης να χρησιμοποιήσετε το παρακάτω script: +4. Μετά από την ολοκλήρωση της μετάφρασης μην ξεχάσετε να βάλετε τα στοιχεία σας στο: -```bash -python scripts/check_spelling.py /.po -``` +![metadata](/public/assets/metadata-po.png) -Εάν κάποια από τις λέξεις δεν είναι αναγνωρισμένη από το script προσθέστε την στο dictionary και επαναλάβετε. Για παράδειγμα, εάν το αρχείο που δουλεύετε είναι το `library/ast.po` το αντίστοιχο dictionary είναι το `dictionaries/library_ast.txt`. Εάν το αρχείο που ψάχνετε δεν υπάρχει στο φάκελο dictionaries δημιουργείστε το. +Στο **Language-Team** metadata γράφετε: `"Language-Team: PyGreece \n"` -7. Όταν ολοκληρώσετε την μετάφραση σας, πρέπει να αποθηκεύσετε τις αλλαγές σας και να κάνετε push στο GitHub (Μην ξεχάσετε να προσθέσετε το όνομά σας στο αρχείο `TRANSLATORS`). Για παράδειγμα εάν εργαζόσασταν στη στο αρχείο `library/ast.po` τα βήματα θα ήταν: +5. Όταν ολοκληρώσετε τη μετάφραση σας, πρέπει να αποθηκεύσετε τις αλλαγές σας και να κάνετε push στο GitHub (Μην ξεχάσετε να προσθέσετε το όνομά σας στο αρχείο `TRANSLATORS`). Για παράδειγμα, εάν εργαζόσασταν στο αρχείο `library/ast.po` τα βήματα θα ήταν: ```bash git add library/ast.po @@ -113,29 +181,67 @@ git commit -m 'Translate file library/ast.po' git push origin translate-library-ast ``` -8. Στην περιγραφή του Pull Request μπορείτε να γράψετε: +6. Έπειτα μπορείτε να ανοίξετε ένα Pull Request προκειμένου να εξεταστεί/ελεγχθεί η συνεισφορά σας, να γίνουν κάποια σχόλια και εν τέλει να προσαρτηθεί στο βασικό repository. Εφόσον έχετε κάνει push το branch σας θα δείτε κάτι όπως παρακάτω: + +![pr](/public/assets/pr.png) + +Πατώντας το κουμπί θα μεταβείτε στην οθόνη για να βάλετε τις πληροφορίες του συγκεκριμένου _Pull Request_, και κάνοντας click στο κουμπί `Create pull request` θα δημιουργηθεί το PR. + +![pr_descrtiption](/public/assets/pr-description.png) + +Μπράβο! Ανεβάσατε το πρώτο σας PR. Τώρα απλώς περιμένετε να το αξιολογήσουν οι διαχειριστές, και έχετε στο νου σας ότι μπορεί να σας ζητήσουν κάποιες αλλαγές. + +Περιμένετε να σας κάνουν αποδοχή το PR σας. + +### 🎉🎉ΤΕΛΟΣ🎉🎉 + +Συγχαρητήρια, συνεισφέρατε στο έργο και πλέον είστε μέλος του μεγάλου εγχειρήματος της μετάφρασης. + +## Εργαλεία Ελέγχου & Προεπισκόπηση Αλλαγών [Προαιρετικό] + +Εφόσον έχετε ολοκληρώσει τη μετάφρασή σας ενδείκνυται να χρησιμοποιήσετε την παρακάτω εντολή προκειμένου να γίνει μορφοποίηση του αρχείου για να έχει μια σωστή δομή καθώς και να γίνει ορθογραφικός έλεγχος. + +Για να λειτουργήσει ο ορθογραφικός έλεγχος, θα πρέπει να έχετε εγκατεστημένο το `hunspell` για τα Ελληνικά. Σε συστήματα που βασίζονται σε Debian/Ubuntu, μπορείτε να το εγκαταστήσετε με την παρακάτω εντολή: + +```bash +sudo apt install hunspell hunspell-el +``` + +Μετά την εγκατάσταση, μπορείτε να εκτελέσετε: +```bash +make lint ``` -Closes #<αριθμός issue> + +Εάν κάποια από τις λέξεις δεν είναι αναγνωρισμένη από το script προσθέστε τη στο [dictionary](/dictionaries/main.txt) και επαναλάβετε. + +Εάν είστε χρήστης των windows μπορείτε να δείτε περισσότερες πληροφορίες [εδώ](https://python-docs-es.readthedocs.io/es/3.12/faq.html#powrap-windows). + +--- + +Αν θέλετε να κάνετε προεπισκόπηση των αλλαγών που κάνατε μπορείτε να χρησιμοποιήσετε την παρακάτω εντολή: + +```bash +make preview ``` -Έτσι θα κλείσει και το issue μόλις γίνει merge το PR. +Mε την ολοκλήρωση της εντολής, επισκεφτείτε τη διεύθυνση http://localhost:8000/ στον browser σας. ## Γενικές Οδηγίες -- Σε πολλές περιπτώσεις το καλύτερο κριτήριο είναι να σκεφτούμε το λεξιλόγιο που χρησιμοποιούμε όταν εξηγούμε σε άλλο άτομο ή στη δουλειά. Σε πολλές περιπτώσεις, η αγγλική είναι πολύ καλύτερη αν θελετε πχ. να πείτε "git join". +- Σε πολλές περιπτώσεις το καλύτερο κριτήριο είναι να σκεφτούμε το λεξιλόγιο που χρησιμοποιούμε όταν εξηγούμε σε άλλο άτομο ή στη δουλειά. Σε πολλές περιπτώσεις, η αγγλική είναι πολύ καλύτερη αν θέλετε πχ. να πείτε "git join". -- Θα έχετε πάντα διαθέσιμο ενα preview αυτού που προτείνετε, καθώς και reviewers να σας βοηθήσουν. +- Θα έχετε πάντα διαθέσιμο ένα preview αυτού που προτείνετε, καθώς και reviewers να σας βοηθήσουν. -- Η διαδικασιά του review ειναι επίσης πολύ σημαντική. Αν έχετε ελεύθερο χρόνο θα ήταν το ίδιο σημαντικό να συνεισφέρετε κάνοντας review σε ήδη ανοιχτά Pull Requests ([περισσότερες πληροφορίες εδώ](./public/docs/review.md)). +- Η διαδικασία του review είναι επίσης πολύ σημαντική. Αν έχετε ελεύθερο χρόνο θα ήταν το ίδιο σημαντικό να συνεισφέρετε κάνοντας review σε ήδη ανοιχτά Pull Requests ([περισσότερες πληροφορίες εδώ](./public/docs/review.md)). -- Τα επίσημα έγγραφα της Python είναι άπειρα! Όποια εμπόδια βρείτε μπορείτε πάντα να επισημάνετε το κείμενο ως "ασαφές" ή να το αναθεωρήσετε στο μέλλον. Μην σπαταλάτε ώρες αναζητώντας την τέλεια λέξη. +- Τα επίσημα έγγραφα της Python είναι άπειρα! Αν αντιμετωπίσετε εμπόδια, μπορείτε πάντα να επισημάνετε το κείμενο ως "ασαφές" ή να το αναθεωρήσετε στο μέλλον. Μη σπαταλάτε ώρες αναζητώντας την τέλεια λέξη. -- Δεν πρέπει να μεταφράσετε το περιεχόμενο των :ref:..., :term:..., :dfn:..., κ.λπ. +- Δεν πρέπει να μεταφράσετε το περιεχόμενο των :ref:..., :term:..., :dfn:..., κλπ. - Εάν πρέπει να χρησιμοποιήσετε αγγλικές λέξεις, θα πρέπει να τις βάλετε με πλάγιους χαρακτήρες (περιτριγυρισμένοι με αστερίσκους). -- Μπορείτε να διαβάσετε τις Συχνές Ερωτήσεις για να διαβάσετε για γνωστά ζητήματα. +- Μπορείτε να συμβουλευτείτε τις Συχνές Ερωτήσεις για να διαβάσετε για γνωστά ζητήματα. - Εάν μεταφράσετε έναν τίτλο που είναι σύνδεσμος, μεταφράστε και τον σύνδεσμο (για παράδειγμα ένα άρθρο στη Wikipedia). Σε περίπτωση που δεν υπάρχει μετάφραση του άρθρου στη Wikipedia, αφήστε τον τίτλο αμετάφραστο. @@ -143,6 +249,6 @@ Closes #<αριθμός issue> - Συνιστούμε να ανοίξετε ένα Pull Request ακόμα κι αν είναι σε μορφή draft (επισημασμένο ως πρόχειρο) από τις πρώτες προσπάθειες της μετάφρασης του αρχείου σας. Με αυτόν τον τρόπο, μπορείτε να λάβετε σχόλια από την αρχή που μπορείτε να εφαρμόσετε στην υπόλοιπη μετάφραση. -- Τελευταίο αλλά όχι λιγότερο σημαντικό, διασκεδάστε και βασιστείτε στη βοήθεια όλων. Περιμένουμε τα μηνύματα σας στο discord, εδώ ή στο linkedin. Ευχαριστούμε! +- Τελευταίο αλλά όχι λιγότερο σημαντικό, διασκεδάστε και βασιστείτε στη βοήθεια όλων. Περιμένουμε τα μηνύματα σας στο Discord, εδώ ή στο LinkedIn. Ευχαριστούμε! -- Για τους contributors που χρησιμοποιούν το vscode ως IDE ένα πολύ χρήσιμο add-on για τα `.po` αρχεία είναι το [`gettext` extension](https://marketplace.visualstudio.com/items?itemName=mrorz.language-gettext). +- Για τους contributors που χρησιμοποιούν το VSCode ως IDE ένα πολύ χρήσιμο add-on για τα `.po` αρχεία είναι το [`gettext` extension](https://marketplace.visualstudio.com/items?itemName=mrorz.language-gettext). diff --git a/Makefile b/Makefile index a11d757e..c5c01898 100644 --- a/Makefile +++ b/Makefile @@ -21,13 +21,12 @@ # from which we generated our po files. We use it here so when we # test build, we're building with the .rst files that generated our # .po files. -CPYTHON_CURRENT_COMMIT := 9cbde7c6ce6f7b93301a37f03dfa0c0d45e00a39 +CPYTHON_CURRENT_COMMIT := afaa3b02f79b16d175129e9c5cbf6660f7521a69 CPYTHON_PATH := ./cpython LANGUAGE := el -TRANSLATION_BRANCH := main -BRANCH := 3.12 +BRANCH := 3.14 EXCLUDED := whatsnew/ c-api/ @@ -70,8 +69,10 @@ all: ensure_prerequisites -D latex_elements.inputenc= \ -D latex_elements.fontenc=' \ $(MODE) - @echo "Build success, open file://$(abspath $(CPYTHON_PATH))/Doc/build/html/index.html or run 'make serve' to see them." - + @echo "Build successful! 🎉" + @echo "You can now open the documentation in your browser:" + @echo " file://$(abspath $(CPYTHON_PATH))/Doc/build/html/index.html" + @echo "Or, run 'make serve' to start a local web server for the docs." .PHONY: ensure_prerequisites ensure_prerequisites: @@ -100,8 +101,12 @@ ensure_prerequisites: .PHONY: serve serve: - $(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('cpython/Doc/build/html/index.html'))" + @echo "Starting local server at http://localhost:8000..." + $(PYTHON) -m http.server -d cpython/Doc/build/html/ +.PHONY: preview +preview: + make all && make serve .PHONY: progress progress: @@ -109,6 +114,14 @@ progress: $(shell msgcat *.po */*.po | msgattrib --translated | grep -c '^msgid') \ $(shell msgcat *.po */*.po | grep -c '^msgid') +.PHONY: spellcheck +spellcheck: + $(PYTHON) scripts/check_spelling.py $(filter-out $@, $(MAKECMDGOALS)) + +.PHONY: lint +lint: + powrap *.po **/*.po && \ + make spellcheck .PHONY: todo todo: ensure_prerequisites @@ -119,7 +132,7 @@ wrap: ensure_prerequisites @echo "Verify wrapping" powrap --check --quiet *.po **/*.po -SRCS = $(shell git diff --name-only $(TRANSLATION_BRANCH) | grep '.po$$') +SRCS = $(shell git diff --name-only $(BRANCH) | grep '.po$$') # foo/bar.po => $(POSPELL_TMP_DIR)/foo/bar.po.out DESTS = $(addprefix $(POSPELL_TMP_DIR)/,$(addsuffix .out,$(SRCS))) diff --git a/README.md b/README.md index 86d8d1a5..7547bf8b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -[![Documentation Status](https://readthedocs.org/projects/python-docs-gr/badge/?version=latest)](https://python-docs-gr.readthedocs.io/el/latest/?badge=latest) +[![Documentation Status](https://readthedocs.org/projects/python-docs-el/badge/?version=latest)](https://python-docs-el.readthedocs.io/el/latest/?badge=latest) -# python-docs-gr +# python-docs-el Η ελληνική μετάφραση των επίσημων εγγράφων της Python. -## Συμφωνητικό Συνεισφοράς στην Μετάφραση των Εγγράφων +## Συμφωνητικό Συνεισφοράς στη Μετάφραση των Εγγράφων ΣΗΜΕΙΩΣΗ ΓΙΑ ΤΗΝ ΑΔΕΙΑ ΧΡΗΣΗΣ ΤΩΝ ΜΕΤΑΦΡΑΣΕΩΝ @@ -11,23 +11,23 @@ εθελοντών. Αυτό το έργο πρότζεκτ αποτελεί μια συνεργασία ανάμεσα σε εθελοντές μεταφραστές και -της ομάδας python-docs-gr. Το παρόν έγγραφο καθορίζει τα δικαιώματα και τις ευθύνες +της ομάδας python-docs-el. Το παρόν έγγραφο καθορίζει τα δικαιώματα και τις ευθύνες όλων των συμμετεχόντων στη διαδικασία της μετάφρασης. Με τη δημοσίευση του πρότζεκτ στο GitHub και σε άλλους δημόσιους χώρους, και με τη συνεισφορά ή τις βελτιώσεις στις μεταφράσεις, παρέχετε τις συνεισφορές σας στο [Python Software Foundation](https://www.python.org/psf-landing/) (PSF) με την άδεια χρήσης [CC0](https://creativecommons.org/public-domain/cc0/). Σε αντάλλαγμα, μπορείτε να λάβετε δημόσια αναγνώριση για τη μετάφρασή σας. Αν η μετάφρασή σας γίνει αποδεκτή από το PSF, μπορείτε (αν το επιθυμείτε) να υποβάλετε ένα patch προσθέτοντας -το όνομά σας στο αρχείο [TRANSLATORS](https://github.com/pygreece/python-docs-gr/blob/main/TRANSLATORS). +το όνομά σας στο αρχείο [TRANSLATORS](https://github.com/pygreece/python-docs-el/blob/main/TRANSLATORS). Ακόμα και αν η συνεισφορά σας δεν αφορά την παρούσα μετάφραση, καλωσορίζουμε τη συμμετοχή σας στην κοινότητα Python / PyGreece και καλούμε όλους να συνεισφέρουν. Υποβάλλοντας την εργασία σας στο PSF για να συμπεριληφθεί στον οδηγό χρήσης της Python, συμφωνείτε με αυτό το έγγραφο. -Το πρωτότυπο κείμενο του παραπάνου συμφωνητικού στα Αγγλικά βρίσκεται στο +Το πρωτότυπο κείμενο του παραπάνω συμφωνητικού στα Αγγλικά βρίσκεται στο [PEP545](https://peps.python.org/pep-0545/#setup-the-documentation-contribution-agreement). -## Πως μπορώ να βοηθήσω στην μετάφραση; +## Πως μπορώ να βοηθήσω στη μετάφραση; -Το έργο της μετάφρασης είναι εθελοντικό και στηρίζεται στους φίλους και στα μέλη της κοινότητας της Python! Κάθε συνεισφορά στην μετάφραση είναι σημαντική! Για περισότερες πληροφορίες για το πως μπορείτε να συνεισφέρετε δείτε [εδώ](./CONTRIBUTING.md). +Το έργο της μετάφρασης είναι εθελοντικό και στηρίζεται στους φίλους και στα μέλη της κοινότητας της Python! Κάθε συνεισφορά στη μετάφραση είναι σημαντική! Για περισσότερες πληροφορίες για το πως μπορείτε να συνεισφέρετε δείτε [εδώ](./CONTRIBUTING.md). diff --git a/TRANSLATORS b/TRANSLATORS index c5d64d8e..923683aa 100644 --- a/TRANSLATORS +++ b/TRANSLATORS @@ -3,3 +3,9 @@ Lysandros Nikolaou Theofanis Petkos Panagiotis Skias Dimitrios Papadopoulos +Marios Giannopoulos +Artemis Leonardou +Stelios Rotas +Loukas Sakellaridis +Αlexandros Tzioras +Kleopatra Karapanagiotou diff --git a/about.po b/about.po index 1d3d5584..d3040dff 100644 --- a/about.po +++ b/about.po @@ -8,28 +8,30 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-03-31 19:50+0000\n" "Last-Translator: Theofanis Petkos \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: about.rst:3 -msgid "About these documents" -msgstr "Σχετικά με τα έγγραφα" +msgid "About this documentation" +msgstr "Σχετικά με την τεκμηρίωση" #: about.rst:6 msgid "" -"These documents are generated from `reStructuredText`_ sources by `Sphinx`_, " -"a document processor specifically written for the Python documentation." +"Python's documentation is generated from `reStructuredText`_ sources using " +"`Sphinx`_, a documentation generator originally created for Python and now " +"maintained as an independent project." msgstr "" -"Αυτά τα έγραφα έχουν δημιουργηθεί από τα `reStructuredText`_ sources του " -"`Sphinx`_, έναν επεξεργαστή εγγράφων που έχει δημιουργηθεί ειδικά για τα " +"Η τεκμηρίωση της Python έχει δημιουργηθεί από τα `reStructuredText`_ sources " +"του `Sphinx`_, έναν επεξεργαστή εγγράφων που έχει δημιουργηθεί ειδικά για τα " "έγγραφα της Python." -#: about.rst:15 +#: about.rst:16 msgid "" "Development of the documentation and its toolchain is an entirely volunteer " "effort, just like Python itself. If you want to contribute, please take a " @@ -41,27 +43,27 @@ msgstr "" "ρίξτε μια ματιά στη σελίδα :ref:`reporting-bugs` για πληροφορίες σχετικές με " "το πως να το κάνετε. Καινούριοι εθελοντές είναι πάντα ευπρόσδεκτοι!" -#: about.rst:20 +#: about.rst:21 msgid "Many thanks go to:" msgstr "Πολλές ευχαριστίες πηγαίνουν στους:" -#: about.rst:22 +#: about.rst:23 msgid "" "Fred L. Drake, Jr., the creator of the original Python documentation toolset " -"and writer of much of the content;" +"and author of much of the content;" msgstr "" -"Fred L. Drake, Jr., τον δημιουργό των αρχικών εργαλείων των εγγράφων της " -"Python και συντάκτη αρκετού περιεχομένου'" +"Fred L. Drake, Jr., τον δημιουργό των αρχικών εργαλείων της τεκμηρίωσης της " +"Python και συντάκτη αρκετού περιεχομένου·" -#: about.rst:24 +#: about.rst:25 msgid "" "the `Docutils `_ project for creating " "reStructuredText and the Docutils suite;" msgstr "" "το `Docutils `_ πρότζεκτ για την " -"δημιουργία των εφαρμογών reStructuredText και Docutils'" +"δημιουργία των εφαρμογών reStructuredText και Docutils·" -#: about.rst:26 +#: about.rst:27 msgid "" "Fredrik Lundh for his Alternative Python Reference project from which Sphinx " "got many good ideas." @@ -69,11 +71,11 @@ msgstr "" "Fredrik Lundh για το δικό του Alternative Python Reference πρότζεκτ από το " "οποίο το Sphinx πήρε πολύ καλές ιδέες." -#: about.rst:31 -msgid "Contributors to the Python Documentation" -msgstr "Συντελεστές στα έγγραφα της Python" +#: about.rst:32 +msgid "Contributors to the Python documentation" +msgstr "Συντελεστές στη τεκμηρίωση της Python" -#: about.rst:33 +#: about.rst:34 msgid "" "Many people have contributed to the Python language, the Python standard " "library, and the Python documentation. See :source:`Misc/ACKS` in the " @@ -83,7 +85,7 @@ msgstr "" "Python, και τα έγγραφα της Python. Δείτε :source:`Misc/ACKS` στις πηγές " "διανομής της Python για μια λίστα των συντελεστών." -#: about.rst:37 +#: about.rst:38 msgid "" "It is only with the input and contributions of the Python community that " "Python has such wonderful documentation -- Thank You!" diff --git a/bugs.po b/bugs.po index 11b442fb..ea405df2 100644 --- a/bugs.po +++ b/bugs.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-05-06 12:51+0000\n" "Last-Translator: Theofanis Petkos \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -48,15 +49,26 @@ msgstr "Σφάλματα Τεκμηρίωσης" #: bugs.rst:18 msgid "" "If you find a bug in this documentation or would like to propose an " -"improvement, please submit a bug report on the :ref:`tracker `. If you have a suggestion on how to fix it, include that as well." +"improvement, please submit a bug report on the :ref:`issue tracker `. If you have a suggestion on how to fix it, include that as " +"well." msgstr "" "Εάν βρείτε ένα σφάλμα σε αυτήν την τεκμηρίωση ή θέλετε να προτείνετε μια " -"βελτίωση, υποβάλετε μια αναφορά σφάλματος στο :ref:`tracker `. Εάν έχετε μια πρόταση για το πώς να το διορθώσετε, συμπεριλάβετε " "και αυτήν." -#: bugs.rst:22 +#: bugs.rst:24 +msgid "" +"If the bug or suggested improvement concerns the translation of this " +"documentation, submit the report to the `translation’s repository " +"`_ instead." +msgstr "" +"Αν το σφάλμα ή η προτεινόμενη βελτίωση αφορά τη μετάφραση αυτή της " +"τεκμηρίωσης, υποβάλετε την αναφορά στο `translation’s repository " +"`_ αντί γι' αυτό." + +#: bugs.rst:28 msgid "" "You can also open a discussion item on our `Documentation Discourse forum " "`_." @@ -64,24 +76,22 @@ msgstr "" "Μπορείτε επίσης να ανοίξετε ένα θέμα συζήτησης στο `Φόρουμ της συζήτησης για " "την τεκμηρίωση `_." -#: bugs.rst:25 +#: bugs.rst:31 msgid "" -"If you're short on time, you can also email documentation bug reports to " -"docs@python.org (behavioral bugs can be sent to python-list@python.org). " -"'docs@' is a mailing list run by volunteers; your request will be noticed, " -"though it may take a while to be processed." +"If you find a bug in the theme (HTML / CSS / JavaScript) of the " +"documentation, please submit a bug report on the `python-doc-theme issue " +"tracker `_." msgstr "" -"Εάν δεν έχετε χρόνο, μπορείτε επίσης να στείλετε με email αναφορές σφαλμάτων " -"τεκμηρίωσης στο docs@python.org (τα σφάλματα συμπεριφοράς - behavioral bugs " -"μπορούν να σταλούν στη διεύθυνση python-list@python.org). Το 'docs@' είναι " -"ένα mailing list που διευθύνεται από εθελοντές. Το αίτημά σας θα γίνει " -"αντιληπτό, αν και μπορεί να χρειαστεί λίγος χρόνος για την επεξεργασία του." +"Εάν εντοπίσετε ένα σφάλμα στο θέμα (HTML / CSS / JavaScript) της " +"τεκμηρίωσης , υποβάλετε μια αναφορά σφαλμάτων σχετικά με το πρόγραμμα " +"παρακολούθησης σφαλμάτων `python-doc-theme bug tracker `_." -#: bugs.rst:33 +#: bugs.rst:37 msgid "`Documentation bugs`_" -msgstr "`Σφάλματα τεκμηρίωσης`_" +msgstr "`Documentation bugs`_" -#: bugs.rst:33 +#: bugs.rst:38 msgid "" "A list of documentation bugs that have been submitted to the Python issue " "tracker." @@ -89,18 +99,18 @@ msgstr "" "Μια λίστα σφαλμάτων τεκμηρίωσης που έχουν υποβληθεί στον Python issue " "tracker." -#: bugs.rst:36 +#: bugs.rst:40 msgid "`Issue Tracking `_" msgstr "`Παρακολούθηση Issue `_" -#: bugs.rst:36 +#: bugs.rst:41 msgid "" "Overview of the process involved in reporting an improvement on the tracker." msgstr "" "Επισκόπηση της διαδικασίας που περιλαμβάνει η αναφορά μιας βελτίωσης στον " "tracker." -#: bugs.rst:39 +#: bugs.rst:43 msgid "" "`Helping with Documentation `_" @@ -108,7 +118,7 @@ msgstr "" "`Βοηθώντας με την Τεκμηρίωση `_" -#: bugs.rst:39 +#: bugs.rst:44 msgid "" "Comprehensive guide for individuals that are interested in contributing to " "Python documentation." @@ -116,7 +126,7 @@ msgstr "" "Ολοκληρωμένος οδηγός για άτομα που ενδιαφέρονται να συνεισφέρουν στην " "Τεκμηρίωση της Python." -#: bugs.rst:41 +#: bugs.rst:46 msgid "" "`Documentation Translations `_" @@ -124,7 +134,7 @@ msgstr "" "`Μεταφράσεις Τεκμηρίωσης `_" -#: bugs.rst:42 +#: bugs.rst:47 msgid "" "A list of GitHub pages for documentation translation and their primary " "contacts." @@ -132,11 +142,11 @@ msgstr "" "Μια λίστα από Github pages για την μετάφραση της τεκμηρίωσης και τις " "κυριότερες επαφές." -#: bugs.rst:48 +#: bugs.rst:53 msgid "Using the Python issue tracker" msgstr "Χρησιμοποιώντας τον Python issue tracker" -#: bugs.rst:50 +#: bugs.rst:55 msgid "" "Issue reports for Python itself should be submitted via the GitHub issues " "tracker (https://github.com/python/cpython/issues). The GitHub issues " @@ -148,7 +158,7 @@ msgstr "" "GitHub issues tracker προσφέρει μια web φόρμα που επιτρέπει την εισαγωγή και " "υποβολή σχετικών πληροφοριών στους προγραμματιστές." -#: bugs.rst:55 +#: bugs.rst:60 msgid "" "The first step in filing a report is to determine whether the problem has " "already been reported. The advantage in doing so, aside from saving the " @@ -167,7 +177,7 @@ msgstr "" "αναζητήστε στον tracker χρησιμοποιώντας το πλαίσιο αναζήτησης στο επάνω " "μέρος της σελίδας." -#: bugs.rst:62 +#: bugs.rst:67 msgid "" "If the problem you're reporting is not already in the list, log in to " "GitHub. If you don't already have a GitHub account, create a new account " @@ -179,7 +189,7 @@ msgstr "" "λογαριασμό χρησιμοποιώντας τον σύνδεσμο \"Sign up\". Δεν είναι δυνατή η " "υποβολή αναφοράς σφαλμάτων ανώνυμα." -#: bugs.rst:67 +#: bugs.rst:72 msgid "" "Being now logged in, you can submit an issue. Click on the \"New issue\" " "button in the top bar to report a new issue." @@ -187,11 +197,11 @@ msgstr "" "Όταν πλέον είστε συνδεδεμένοι, μπορείτε να υποβάλετε ένα issue. Κάντε κλικ " "στο κουμπί \"New issue\" στην επάνω γραμμή για να αναφέρετε ένα νέο issue." -#: bugs.rst:70 +#: bugs.rst:75 msgid "The submission form has two fields, \"Title\" and \"Comment\"." msgstr "Η φόρμα υποβολής έχει δύο πεδία, \"Title\" και \"Comment\"." -#: bugs.rst:72 +#: bugs.rst:77 msgid "" "For the \"Title\" field, enter a *very* short description of the problem; " "fewer than ten words is good." @@ -199,7 +209,7 @@ msgstr "" "Για το πεδίο \"Title\", εισαγάγετε μια *πολύ* σύντομη περιγραφή του " "προβλήματος' λιγότερες από δέκα λέξεις είναι καλές." -#: bugs.rst:75 +#: bugs.rst:80 msgid "" "In the \"Comment\" field, describe the problem in detail, including what you " "expected to happen and what did happen. Be sure to include whether any " @@ -212,7 +222,7 @@ msgstr "" "ποια πλατφόρμα υλικού και λογισμικού (συμπεριλαμβανομένων των πληροφοριών " "έκδοσης ανάλογα με την περίπτωση)." -#: bugs.rst:80 +#: bugs.rst:85 msgid "" "Each issue report will be reviewed by a developer who will determine what " "needs to be done to correct the problem. You will receive an update each " @@ -222,7 +232,7 @@ msgstr "" "καθορίσει τι πρέπει να γίνει για να διορθωθεί το πρόβλημα. Θα λαμβάνετε μια " "ενημέρωση κάθε φορά που γίνεται κάποια ενέργεια για το πρόβλημα." -#: bugs.rst:89 +#: bugs.rst:92 msgid "" "`How to Report Bugs Effectively `_" @@ -230,7 +240,7 @@ msgstr "" "`Πως να Αναφέρεται Σφάλματα Αποτελεσματικά `_" -#: bugs.rst:88 +#: bugs.rst:93 msgid "" "Article which goes into some detail about how to create a useful bug report. " "This describes what kind of information is useful and why it is useful." @@ -239,15 +249,15 @@ msgstr "" "μιας χρήσιμης αναφοράς σφάλματος. Περιγράφει τι είδους πληροφορίες είναι " "χρήσιμες και γιατί είναι χρήσιμες." -#: bugs.rst:92 +#: bugs.rst:96 msgid "" "`Bug Writing Guidelines `_" msgstr "" -"Οδηγίες Συγγραφής Αναφορών Σφαλμάτων `_" -#: bugs.rst:92 +#: bugs.rst:97 msgid "" "Information about writing a good bug report. Some of this is specific to " "the Mozilla project, but describes general good practices." @@ -256,11 +266,11 @@ msgstr "" "αυτά αφορούν ειδικά το πρότζεκτ Mozilla, αλλά περιγράφουν και γενικές καλές " "πρακτικές." -#: bugs.rst:98 +#: bugs.rst:103 msgid "Getting started contributing to Python yourself" msgstr "Ξεκινήστε να συνεισφέρετε και εσείς στην Python" -#: bugs.rst:100 +#: bugs.rst:105 msgid "" "Beyond just reporting bugs that you find, you are also welcome to submit " "patches to fix them. You can find more information on how to get started " @@ -270,8 +280,21 @@ msgid "" msgstr "" "Πέρα από την απλή αναφορά σφαλμάτων που βρίσκετε, μπορείτε επίσης να " "υποβάλετε ενημερώσεις για να τα διορθώσετε. Μπορείτε να βρείτε περισσότερες " -"πληροφορίες για το πώς να ξεκινήσετε μια ενημέρωση της Python στον `Οδηγό " -"προγραμματιστών Python`_. Εάν έχετε ερωτήσεις, το `core-mentorship mailing " -"list`_ είναι ένα φιλικό μέρος για να λάβετε απαντήσεις για οποιασδήποτε ή " -"και όλες τις ερωτήσεις που σχετίζονται με τη διαδικασία επίλυσης προβλημάτων " -"στην Python." +"πληροφορίες για το πώς να ξεκινήσετε μια ενημέρωση της Python στον `Python " +"Developer's Guide`_. Εάν έχετε ερωτήσεις, το `core-mentorship mailing list`_ " +"είναι ένα φιλικό μέρος για να λάβετε απαντήσεις για οποιασδήποτε ή και όλες " +"τις ερωτήσεις που σχετίζονται με τη διαδικασία επίλυσης προβλημάτων στην " +"Python." + +#~ msgid "" +#~ "If you're short on time, you can also email documentation bug reports to " +#~ "docs@python.org (behavioral bugs can be sent to python-list@python.org). " +#~ "'docs@' is a mailing list run by volunteers; your request will be " +#~ "noticed, though it may take a while to be processed." +#~ msgstr "" +#~ "Εάν δεν έχετε χρόνο, μπορείτε επίσης να στείλετε με email αναφορές " +#~ "σφαλμάτων τεκμηρίωσης στο docs@python.org (τα σφάλματα συμπεριφοράς - " +#~ "behavioral bugs μπορούν να σταλούν στη διεύθυνση python-list@python.org). " +#~ "Το 'docs@' είναι ένα mailing list που διευθύνεται από εθελοντές. Το " +#~ "αίτημά σας θα γίνει αντιληπτό, αν και μπορεί να χρειαστεί λίγος χρόνος " +#~ "για την επεξεργασία του." diff --git a/c-api/abstract.po b/c-api/abstract.po index 159c29f9..37247a7d 100644 --- a/c-api/abstract.po +++ b/c-api/abstract.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/c-api/allocation.po b/c-api/allocation.po index 155abbed..78742110 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -8,76 +8,291 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-06-04 11:27+0300\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: c-api/allocation.rst:6 msgid "Allocating Objects on the Heap" -msgstr "" +msgstr "Δέσμευση Αντικειμένων στο Σωρό" #: c-api/allocation.rst:17 msgid "" "Initialize a newly allocated object *op* with its type and initial " -"reference. Returns the initialized object. If *type* indicates that the " -"object participates in the cyclic garbage detector, it is added to the " -"detector's set of observed objects. Other fields of the object are not " -"affected." +"reference. Returns the initialized object. Other fields of the object are " +"not initialized. Despite its name, this function is unrelated to the " +"object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init` " +"slot). Specifically, this function does **not** call the object's :meth:`!" +"__init__` method." +msgstr "" + +#: c-api/allocation.rst:24 +msgid "" +"In general, consider this function to be a low-level routine. Use :c:member:" +"`~PyTypeObject.tp_alloc` where possible. For implementing :c:member:`!" +"tp_alloc` for your type, prefer :c:func:`PyType_GenericAlloc` or :c:func:" +"`PyObject_New`." msgstr "" -#: c-api/allocation.rst:26 +#: c-api/allocation.rst:31 +msgid "" +"This function only initializes the object's memory corresponding to the " +"initial :c:type:`PyObject` structure. It does not zero the rest." +msgstr "" + +#: c-api/allocation.rst:37 msgid "" "This does everything :c:func:`PyObject_Init` does, and also initializes the " "length information for a variable-size object." msgstr "" +"Αυτό κάνει τα πάντα που κάνει η :c:func:`PyObject_Init`, και επίσης " +"αρχικοποιεί τις πληροφορίες μήκους για ένα αντικείμενο μεταβλητού μεγέθους." + +#: c-api/allocation.rst:42 +msgid "" +"This function only initializes some of the object's memory. It does not " +"zero the rest." +msgstr "" + +#: c-api/allocation.rst:48 +#, fuzzy +msgid "" +"Allocates a new Python object using the C structure type *TYPE* and the " +"Python type object *typeobj* (``PyTypeObject*``) by calling :c:func:" +"`PyObject_Malloc` to allocate memory and initializing it like :c:func:" +"`PyObject_Init`. The caller will own the only reference to the object (i.e. " +"its reference count will be one)." +msgstr "" +"Δεσμεύει ένα νέο αντικείμενο Python χρησιμοποιώντας τον τύπο δομής C *TYPE* " +"και το αντικείμενο τύπου Python *typeobj* (``PyTypeObject*``). Τα πεδία που " +"δεν ορίζονται από την κεφαλίδα αντικειμένου Python δεν αρχικοποιούνται. Ο " +"καλών θα έχει την μοναδική αναφορά στο αντικείμενο (δηλαδή, η μέτρηση " +"αναφορών του θα είναι ένα). Το μέγεθος της δέσμευσης μνήμης καθορίζεται από " +"το πεδίο :c:member:`~PyTypeObject.tp_basicsize` του αντικειμένου τύπου." + +#: c-api/allocation.rst:107 +msgid "" +"Avoid calling this directly to allocate memory for an object; call the " +"type's :c:member:`~PyTypeObject.tp_alloc` slot instead." +msgstr "" + +#: c-api/allocation.rst:110 +msgid "" +"When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:" +"`PyType_GenericAlloc` is preferred over a custom function that simply calls " +"this macro." +msgstr "" + +#: c-api/allocation.rst:61 +msgid "" +"This macro does not call :c:member:`~PyTypeObject.tp_alloc`, :c:member:" +"`~PyTypeObject.tp_new` (:meth:`~object.__new__`), or :c:member:" +"`~PyTypeObject.tp_init` (:meth:`~object.__init__`)." +msgstr "" -#: c-api/allocation.rst:32 +#: c-api/allocation.rst:65 +#, fuzzy msgid "" -"Allocate a new Python object using the C structure type *TYPE* and the " -"Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " -"Python object header are not initialized. The caller will own the only " -"reference to the object (i.e. its reference count will be one). The size of " -"the memory allocation is determined from the :c:member:`~PyTypeObject." -"tp_basicsize` field of the type object." +"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in :c:" +"member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` instead." msgstr "" +"Σημειώστε ότι αυτή η συνάρτηση δεν είναι κατάλληλη αν το *typeobj* έχει :c:" +"macro:`Py_TPFLAGS_HAVE_GC` ορισμένο. Για τέτοια αντικείμενα, χρησιμοποιήστε :" +"c:func:`PyObject_GC_New` αντ' αυτού." -#: c-api/allocation.rst:43 +#: c-api/allocation.rst:68 msgid "" -"Allocate a new Python object using the C structure type *TYPE* and the " -"Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " -"Python object header are not initialized. The allocated memory allows for " -"the *TYPE* structure plus *size* (``Py_ssize_t``) fields of the size given " -"by the :c:member:`~PyTypeObject.tp_itemsize` field of *typeobj*. This is " -"useful for implementing objects like tuples, which are able to determine " -"their size at construction time. Embedding the array of fields into the " -"same allocation decreases the number of allocations, improving the memory " -"management efficiency." +"Memory allocated by this macro must be freed with :c:func:`PyObject_Free` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." msgstr "" -#: c-api/allocation.rst:57 +#: c-api/allocation.rst:123 msgid "" -"Releases memory allocated to an object using :c:macro:`PyObject_New` or :c:" -"macro:`PyObject_NewVar`. This is normally called from the :c:member:" -"`~PyTypeObject.tp_dealloc` handler specified in the object's type. The " -"fields of the object should not be accessed after this call as the memory is " -"no longer a valid Python object." +"The returned memory is not guaranteed to have been completely zeroed before " +"it was initialized." msgstr "" -#: c-api/allocation.rst:66 +#: c-api/allocation.rst:128 +msgid "" +"This macro does not construct a fully initialized object of the given type; " +"it merely allocates memory and prepares it for further initialization by :c:" +"member:`~PyTypeObject.tp_init`. To construct a fully initialized object, " +"call *typeobj* instead. For example::" +msgstr "" + +#: c-api/allocation.rst:83 +msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" +msgstr "" + +#: c-api/allocation.rst:137 c-api/allocation.rst:184 c-api/allocation.rst:186 +#, fuzzy +msgid ":c:func:`PyObject_Free`" +msgstr "Ίδιο με την :c:func:`PyObject_Free`." + +#: c-api/allocation.rst:88 +msgid ":c:macro:`PyObject_GC_New`" +msgstr "" + +#: c-api/allocation.rst:139 +msgid ":c:func:`PyType_GenericAlloc`" +msgstr "" + +#: c-api/allocation.rst:140 +msgid ":c:member:`~PyTypeObject.tp_alloc`" +msgstr "" + +#: c-api/allocation.rst:95 +msgid "Like :c:macro:`PyObject_New` except:" +msgstr "" + +#: c-api/allocation.rst:97 +msgid "" +"It allocates enough memory for the *TYPE* structure plus *size* " +"(``Py_ssize_t``) fields of the size given by the :c:member:`~PyTypeObject." +"tp_itemsize` field of *typeobj*." +msgstr "" + +#: c-api/allocation.rst:100 +msgid "The memory is initialized like :c:func:`PyObject_InitVar`." +msgstr "" + +#: c-api/allocation.rst:102 +msgid "" +"This is useful for implementing objects like tuples, which are able to " +"determine their size at construction time. Embedding the array of fields " +"into the same allocation decreases the number of allocations, improving the " +"memory management efficiency." +msgstr "" + +#: c-api/allocation.rst:114 +#, fuzzy +msgid "" +"This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in :c:" +"member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` instead." +msgstr "" +"Σημειώστε ότι αυτή η συνάρτηση δεν είναι κατάλληλη αν το *typeobj* έχει :c:" +"macro:`Py_TPFLAGS_HAVE_GC` ορισμένο. Για τέτοια αντικείμενα, χρησιμοποιήστε :" +"c:func:`PyObject_GC_NewVar` αντ' αυτού." + +#: c-api/allocation.rst:118 +msgid "" +"Memory allocated by this function must be freed with :c:func:`PyObject_Free` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +msgstr "" + +#: c-api/allocation.rst:133 +msgid "" +"PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" +msgstr "" + +#: c-api/allocation.rst:138 +msgid ":c:macro:`PyObject_GC_NewVar`" +msgstr "" + +#: c-api/allocation.rst:145 msgid "" "Object which is visible in Python as ``None``. This should only be accessed " "using the :c:macro:`Py_None` macro, which evaluates to a pointer to this " "object." msgstr "" +"Αντικείμενο που είναι ορατό στην Python ως ``None``. Αυτό θα πρέπει να " +"προσπελαύνεται μόνο χρησιμοποιώντας τη μακροεντολή :c:macro:`Py_None`, η " +"οποία αξιολογείται σε έναν δείκτη σε αυτό το αντικείμενο." -#: c-api/allocation.rst:73 -msgid ":c:func:`PyModule_Create`" +#: c-api/allocation.rst:152 +msgid ":ref:`moduleobjects`" msgstr "" -#: c-api/allocation.rst:74 +#: c-api/allocation.rst:153 msgid "To allocate and create extension modules." +msgstr "Για να δεσμεύσετε και να δημιουργήσετε επεκτάσεις modules." + +#: c-api/allocation.rst:157 +msgid "Deprecated aliases" +msgstr "" + +#: c-api/allocation.rst:159 +msgid "" +"These are :term:`soft deprecated` aliases to existing functions and macros. " +"They exist solely for backwards compatibility." msgstr "" + +#: c-api/allocation.rst:167 +msgid "Deprecated alias" +msgstr "" + +#: c-api/allocation.rst:168 +msgid "Function" +msgstr "" + +#: c-api/allocation.rst:170 +#, fuzzy +msgid ":c:macro:`PyObject_New`" +msgstr "Ίδιο με την :c:func:`PyObject_Free`." + +#: c-api/allocation.rst:172 +#, fuzzy +msgid ":c:macro:`PyObject_NewVar`" +msgstr "Ίδιο με την :c:func:`PyObject_Free`." + +#: c-api/allocation.rst:174 +#, fuzzy +msgid ":c:func:`PyObject_Init`" +msgstr "Ίδιο με την :c:func:`PyObject_Free`." + +#: c-api/allocation.rst:176 +#, fuzzy +msgid ":c:func:`PyObject_InitVar`" +msgstr "Ίδιο με την :c:func:`PyObject_Free`." + +#: c-api/allocation.rst:178 +#, fuzzy +msgid ":c:func:`PyObject_Malloc`" +msgstr "Ίδιο με την :c:func:`PyObject_Free`." + +#: c-api/allocation.rst:180 +#, fuzzy +msgid ":c:func:`PyObject_Realloc`" +msgstr "Ίδιο με την :c:func:`PyObject_Free`." + +#~ msgid "Same as :c:func:`PyObject_Free`." +#~ msgstr "Ίδιο με την :c:func:`PyObject_Free`." + +#~ msgid "" +#~ "Initialize a newly allocated object *op* with its type and initial " +#~ "reference. Returns the initialized object. Other fields of the object " +#~ "are not affected." +#~ msgstr "" +#~ "Αρχικοποιεί ένα νεοδεσμευμένο αντικείμενο *op* με τον τύπο και την αρχική " +#~ "αναφορά του. Επιστρέφει το αρχικοποιημένο αντικείμενο. Άλλα πεδία του " +#~ "αντικειμένου δεν επηρεάζονται." + +#~ msgid "" +#~ "Allocate a new Python object using the C structure type *TYPE* and the " +#~ "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by " +#~ "the Python object header are not initialized. The allocated memory " +#~ "allows for the *TYPE* structure plus *size* (``Py_ssize_t``) fields of " +#~ "the size given by the :c:member:`~PyTypeObject.tp_itemsize` field of " +#~ "*typeobj*. This is useful for implementing objects like tuples, which " +#~ "are able to determine their size at construction time. Embedding the " +#~ "array of fields into the same allocation decreases the number of " +#~ "allocations, improving the memory management efficiency." +#~ msgstr "" +#~ "Δεσμεύει ένα νέο αντικείμενο Python χρησιμοποιώντας τον τύπο δομής C " +#~ "*TYPE* και το αντικείμενο τύπου Python *typeobj* (``PyTypeObject*``). Τα " +#~ "πεδία που δεν ορίζονται από την κεφαλίδα αντικειμένου Python δεν " +#~ "αρχικοποιούνται. Η δεσμευμένη μνήμη επιτρέπει τη δομή *TYPE* συν *size* " +#~ "(``Py_ssize_t``) πεδία του μεγέθους που δίνεται από το πεδίο :c:member:" +#~ "`~PyTypeObject.tp_itemsize` του *typeobj*. Αυτό είναι χρήσιμο για την " +#~ "υλοποίηση αντικειμένων όπως τις πλειάδες (tuples), τα οποία είναι σε θέση " +#~ "να προσδιορίσουν το μέγεθός τους κατά τη διάρκεια της κατασκευής. Η " +#~ "ενσωμάτωση του πίνακα πεδίων στην ίδια δέσμευση μειώνει τον αριθμό των " +#~ "δεσμεύσεων, βελτιώνοντας την αποδοτικότητα της διαχείρισης μνήμης." + +#~ msgid ":c:func:`PyModule_Create`" +#~ msgstr ":c:func:`PyModule_Create`" diff --git a/c-api/apiabiversion.po b/c-api/apiabiversion.po index 10beeabc..bdba2ec3 100644 --- a/c-api/apiabiversion.po +++ b/c-api/apiabiversion.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -20,163 +21,264 @@ msgstr "" msgid "API and ABI Versioning" msgstr "" -#: c-api/apiabiversion.rst:9 +#: c-api/apiabiversion.rst:11 +msgid "Build-time version constants" +msgstr "" + +#: c-api/apiabiversion.rst:13 msgid "" "CPython exposes its version number in the following macros. Note that these " -"correspond to the version code is **built** with, not necessarily the " -"version used at **run time**." +"correspond to the version code is **built** with. See :c:var:`Py_Version` " +"for the version used at **run time**." msgstr "" -#: c-api/apiabiversion.rst:13 +#: c-api/apiabiversion.rst:17 msgid "" "See :ref:`stable` for a discussion of API and ABI stability across versions." msgstr "" -#: c-api/apiabiversion.rst:17 +#: c-api/apiabiversion.rst:21 msgid "The ``3`` in ``3.4.1a2``." msgstr "" -#: c-api/apiabiversion.rst:21 +#: c-api/apiabiversion.rst:25 msgid "The ``4`` in ``3.4.1a2``." msgstr "" -#: c-api/apiabiversion.rst:25 +#: c-api/apiabiversion.rst:29 msgid "The ``1`` in ``3.4.1a2``." msgstr "" -#: c-api/apiabiversion.rst:29 +#: c-api/apiabiversion.rst:33 msgid "" "The ``a`` in ``3.4.1a2``. This can be ``0xA`` for alpha, ``0xB`` for beta, " "``0xC`` for release candidate or ``0xF`` for final." msgstr "" -#: c-api/apiabiversion.rst:35 +#: c-api/apiabiversion.rst:39 msgid "The ``2`` in ``3.4.1a2``. Zero for final releases." msgstr "" -#: c-api/apiabiversion.rst:39 -msgid "The Python version number encoded in a single integer." +#: c-api/apiabiversion.rst:43 +msgid "" +"The Python version number encoded in a single integer. See :c:func:" +"`Py_PACK_FULL_VERSION` for the encoding details." msgstr "" -#: c-api/apiabiversion.rst:41 +#: c-api/apiabiversion.rst:46 msgid "" -"The underlying version information can be found by treating it as a 32 bit " -"number in the following manner:" +"Use this for numeric comparisons, for example, ``#if PY_VERSION_HEX >= ...``." +msgstr "" + +#: c-api/apiabiversion.rst:51 +msgid "Run-time version" +msgstr "" + +#: c-api/apiabiversion.rst:55 +msgid "" +"The Python runtime version number encoded in a single constant integer. See :" +"c:func:`Py_PACK_FULL_VERSION` for the encoding details. This contains the " +"Python version used at run time." +msgstr "" + +#: c-api/apiabiversion.rst:59 +msgid "" +"Use this for numeric comparisons, for example, ``if (Py_Version >= ...)``." +msgstr "" + +#: c-api/apiabiversion.rst:65 +msgid "Bit-packing macros" +msgstr "" + +#: c-api/apiabiversion.rst:69 +msgid "" +"Return the given version, encoded as a single 32-bit integer with the " +"following structure:" +msgstr "" + +#: c-api/apiabiversion.rst:75 +msgid "Argument" +msgstr "" + +#: c-api/apiabiversion.rst:73 +msgid "No. of bits" +msgstr "" + +#: c-api/apiabiversion.rst:75 +msgid "Bit mask" +msgstr "" + +#: c-api/apiabiversion.rst:75 +msgid "Bit shift" msgstr "" -#: c-api/apiabiversion.rst:45 -msgid "Bytes" +#: c-api/apiabiversion.rst:73 +msgid "Example values" msgstr "" -#: c-api/apiabiversion.rst:45 -msgid "Bits (big endian order)" +#: c-api/apiabiversion.rst:93 +msgid "``3.4.1a2``" msgstr "" -#: c-api/apiabiversion.rst:45 -msgid "Meaning" +#: c-api/apiabiversion.rst:95 +msgid "``3.10.0``" msgstr "" -#: c-api/apiabiversion.rst:45 -msgid "Value for ``3.4.1a2``" +#: c-api/apiabiversion.rst:77 +msgid "*major*" msgstr "" -#: c-api/apiabiversion.rst:47 -msgid "1" +#: c-api/apiabiversion.rst:79 c-api/apiabiversion.rst:81 +msgid "8" msgstr "" -#: c-api/apiabiversion.rst:47 -msgid "1-8" +#: c-api/apiabiversion.rst:77 +msgid "``0xFF000000``" msgstr "" -#: c-api/apiabiversion.rst:47 -msgid "``PY_MAJOR_VERSION``" +#: c-api/apiabiversion.rst:77 +msgid "24" msgstr "" -#: c-api/apiabiversion.rst:47 +#: c-api/apiabiversion.rst:77 msgid "``0x03``" msgstr "" -#: c-api/apiabiversion.rst:49 -msgid "2" +#: c-api/apiabiversion.rst:79 +msgid "*minor*" msgstr "" -#: c-api/apiabiversion.rst:49 -msgid "9-16" +#: c-api/apiabiversion.rst:79 +msgid "``0x00FF0000``" msgstr "" -#: c-api/apiabiversion.rst:49 -msgid "``PY_MINOR_VERSION``" +#: c-api/apiabiversion.rst:79 +msgid "16" msgstr "" -#: c-api/apiabiversion.rst:49 +#: c-api/apiabiversion.rst:79 msgid "``0x04``" msgstr "" -#: c-api/apiabiversion.rst:51 -msgid "3" +#: c-api/apiabiversion.rst:79 +msgid "``0x0A``" msgstr "" -#: c-api/apiabiversion.rst:51 -msgid "17-24" +#: c-api/apiabiversion.rst:81 +msgid "*micro*" msgstr "" -#: c-api/apiabiversion.rst:51 -msgid "``PY_MICRO_VERSION``" +#: c-api/apiabiversion.rst:81 +msgid "``0x0000FF00``" msgstr "" -#: c-api/apiabiversion.rst:51 +#: c-api/apiabiversion.rst:81 msgid "``0x01``" msgstr "" -#: c-api/apiabiversion.rst:53 -msgid "4" +#: c-api/apiabiversion.rst:81 +msgid "``0x00``" msgstr "" -#: c-api/apiabiversion.rst:53 -msgid "25-28" +#: c-api/apiabiversion.rst:83 +msgid "*release_level*" +msgstr "" + +#: c-api/apiabiversion.rst:85 +msgid "4" msgstr "" -#: c-api/apiabiversion.rst:53 -msgid "``PY_RELEASE_LEVEL``" +#: c-api/apiabiversion.rst:83 +msgid "``0x000000F0``" msgstr "" -#: c-api/apiabiversion.rst:53 +#: c-api/apiabiversion.rst:83 msgid "``0xA``" msgstr "" -#: c-api/apiabiversion.rst:55 -msgid "29-32" +#: c-api/apiabiversion.rst:83 +msgid "``0xF``" msgstr "" -#: c-api/apiabiversion.rst:55 -msgid "``PY_RELEASE_SERIAL``" +#: c-api/apiabiversion.rst:85 +msgid "*release_serial*" msgstr "" -#: c-api/apiabiversion.rst:55 +#: c-api/apiabiversion.rst:85 +msgid "``0x0000000F``" +msgstr "" + +#: c-api/apiabiversion.rst:85 +msgid "0" +msgstr "" + +#: c-api/apiabiversion.rst:85 msgid "``0x2``" msgstr "" -#: c-api/apiabiversion.rst:58 -msgid "" -"Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is hexversion " -"``0x030a00f0``." +#: c-api/apiabiversion.rst:85 +msgid "``0x0``" +msgstr "" + +#: c-api/apiabiversion.rst:88 +msgid "For example:" msgstr "" -#: c-api/apiabiversion.rst:61 -msgid "Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``." +#: c-api/apiabiversion.rst:91 +msgid "Version" msgstr "" -#: c-api/apiabiversion.rst:63 -msgid "This version is also available via the symbol :c:var:`Py_Version`." +#: c-api/apiabiversion.rst:91 +msgid "``Py_PACK_FULL_VERSION`` arguments" msgstr "" -#: c-api/apiabiversion.rst:67 +#: c-api/apiabiversion.rst:91 +msgid "Encoded version" +msgstr "" + +#: c-api/apiabiversion.rst:93 +msgid "``(3, 4, 1, 0xA, 2)``" +msgstr "" + +#: c-api/apiabiversion.rst:93 +msgid "``0x030401a2``" +msgstr "" + +#: c-api/apiabiversion.rst:95 +msgid "``(3, 10, 0, 0xF, 0)``" +msgstr "" + +#: c-api/apiabiversion.rst:95 +msgid "``0x030a00f0``" +msgstr "" + +#: c-api/apiabiversion.rst:98 msgid "" -"The Python runtime version number encoded in a single constant integer, with " -"the same format as the :c:macro:`PY_VERSION_HEX` macro. This contains the " -"Python version used at run time." +"Out-of range bits in the arguments are ignored. That is, the macro can be " +"defined as:" msgstr "" -#: c-api/apiabiversion.rst:73 -msgid "All the given macros are defined in :source:`Include/patchlevel.h`." +#: c-api/apiabiversion.rst:101 +msgid "" +"#ifndef Py_PACK_FULL_VERSION\n" +"#define Py_PACK_FULL_VERSION(X, Y, Z, LEVEL, SERIAL) ( \\\n" +" (((X) & 0xff) << 24) | \\\n" +" (((Y) & 0xff) << 16) | \\\n" +" (((Z) & 0xff) << 8) | \\\n" +" (((LEVEL) & 0xf) << 4) | \\\n" +" (((SERIAL) & 0xf) << 0))\n" +"#endif" +msgstr "" + +#: c-api/apiabiversion.rst:112 +msgid "" +"``Py_PACK_FULL_VERSION`` is primarily a macro, intended for use in ``#if`` " +"directives, but it is also available as an exported function." +msgstr "" + +#: c-api/apiabiversion.rst:119 +msgid "" +"Equivalent to ``Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)``. The result " +"does not correspond to any Python release, but is useful in numeric " +"comparisons." msgstr "" diff --git a/c-api/arg.po b/c-api/arg.po index e3abe7c1..73aed8b7 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -22,7 +23,7 @@ msgstr "" #: c-api/arg.rst:8 msgid "" -"These functions are useful when creating your own extensions functions and " +"These functions are useful when creating your own extension functions and " "methods. Additional information and examples are available in :ref:" "`extending-index`." msgstr "" @@ -52,25 +53,33 @@ msgid "" "brackets is the type of the C variable(s) whose address should be passed." msgstr "" -#: c-api/arg.rst:31 +#: c-api/arg.rst:33 msgid "Strings and buffers" msgstr "" -#: c-api/arg.rst:33 +#: c-api/arg.rst:37 +msgid "" +"On Python 3.12 and older, the macro :c:macro:`!PY_SSIZE_T_CLEAN` must be " +"defined before including :file:`Python.h` to use all ``#`` variants of " +"formats (``s#``, ``y#``, etc.) explained below. This is not necessary on " +"Python 3.13 and later." +msgstr "" + +#: c-api/arg.rst:42 msgid "" "These formats allow accessing an object as a contiguous chunk of memory. You " "don't have to provide raw storage for the returned unicode or bytes area." msgstr "" -#: c-api/arg.rst:37 +#: c-api/arg.rst:46 msgid "Unless otherwise stated, buffers are not NUL-terminated." msgstr "" -#: c-api/arg.rst:39 +#: c-api/arg.rst:48 msgid "There are three ways strings and buffers can be converted to C:" msgstr "" -#: c-api/arg.rst:41 +#: c-api/arg.rst:50 msgid "" "Formats such as ``y*`` and ``s*`` fill a :c:type:`Py_buffer` structure. This " "locks the underlying buffer so that the caller can subsequently use the " @@ -80,14 +89,14 @@ msgid "" "data (or in any early abort case)." msgstr "" -#: c-api/arg.rst:48 +#: c-api/arg.rst:57 msgid "" "The ``es``, ``es#``, ``et`` and ``et#`` formats allocate the result buffer. " "**You have to call** :c:func:`PyMem_Free` after you have finished processing " "the data (or in any early abort case)." msgstr "" -#: c-api/arg.rst:54 +#: c-api/arg.rst:63 msgid "" "Other formats take a :class:`str` or a read-only :term:`bytes-like object`, " "such as :class:`bytes`, and provide a ``const char *`` pointer to its " @@ -96,7 +105,7 @@ msgid "" "won't have to release any memory yourself." msgstr "" -#: c-api/arg.rst:61 +#: c-api/arg.rst:70 msgid "" "To ensure that the underlying buffer may be safely borrowed, the object's :c:" "member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " @@ -104,23 +113,14 @@ msgid "" "read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" -#: c-api/arg.rst:67 +#: c-api/arg.rst:76 msgid "" "Besides this ``bf_releasebuffer`` requirement, there is no check to verify " "whether the input object is immutable (e.g. whether it would honor a request " "for a writable buffer, or whether another thread can mutate the data)." msgstr "" -#: c-api/arg.rst:73 -msgid "" -"For all ``#`` variants of formats (``s#``, ``y#``, etc.), the macro :c:macro:" -"`PY_SSIZE_T_CLEAN` must be defined before including :file:`Python.h`. On " -"Python 3.9 and older, the type of the length argument is :c:type:" -"`Py_ssize_t` if the :c:macro:`PY_SSIZE_T_CLEAN` macro is defined, or int " -"otherwise." -msgstr "" - -#: c-api/arg.rst:98 +#: c-api/arg.rst:80 msgid "``s`` (:class:`str`) [const char \\*]" msgstr "" @@ -148,7 +148,7 @@ msgid "" "encountered in the Python string." msgstr "" -#: c-api/arg.rst:104 +#: c-api/arg.rst:100 msgid "``s*`` (:class:`str` or :term:`bytes-like object`) [Py_buffer]" msgstr "" @@ -160,7 +160,7 @@ msgid "" "converted to C strings using ``'utf-8'`` encoding." msgstr "" -#: c-api/arg.rst:111 +#: c-api/arg.rst:106 msgid "" "``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" "c:type:`Py_ssize_t`]" @@ -175,7 +175,7 @@ msgid "" "encoding." msgstr "" -#: c-api/arg.rst:547 +#: c-api/arg.rst:614 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" msgstr "" @@ -185,7 +185,7 @@ msgid "" "pointer is set to ``NULL``." msgstr "" -#: c-api/arg.rst:119 +#: c-api/arg.rst:117 msgid "" "``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]" msgstr "" @@ -196,7 +196,7 @@ msgid "" "``buf`` member of the :c:type:`Py_buffer` structure is set to ``NULL``." msgstr "" -#: c-api/arg.rst:123 +#: c-api/arg.rst:121 msgid "" "``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) " "[const char \\*, :c:type:`Py_ssize_t`]" @@ -208,7 +208,7 @@ msgid "" "pointer is set to ``NULL``." msgstr "" -#: c-api/arg.rst:134 +#: c-api/arg.rst:125 msgid "``y`` (read-only :term:`bytes-like object`) [const char \\*]" msgstr "" @@ -226,7 +226,7 @@ msgid "" "encountered in the bytes buffer." msgstr "" -#: c-api/arg.rst:139 +#: c-api/arg.rst:136 msgid "``y*`` (:term:`bytes-like object`) [Py_buffer]" msgstr "" @@ -236,7 +236,7 @@ msgid "" "objects. **This is the recommended way to accept binary data.**" msgstr "" -#: c-api/arg.rst:143 +#: c-api/arg.rst:141 msgid "" "``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" "`Py_ssize_t`]" @@ -248,7 +248,7 @@ msgid "" "objects." msgstr "" -#: c-api/arg.rst:148 +#: c-api/arg.rst:145 msgid "``S`` (:class:`bytes`) [PyBytesObject \\*]" msgstr "" @@ -259,7 +259,7 @@ msgid "" "bytes object. The C variable may also be declared as :c:expr:`PyObject*`." msgstr "" -#: c-api/arg.rst:153 +#: c-api/arg.rst:150 msgid "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" msgstr "" @@ -271,7 +271,7 @@ msgid "" "`PyObject*`." msgstr "" -#: c-api/arg.rst:158 +#: c-api/arg.rst:155 msgid "``U`` (:class:`str`) [PyObject \\*]" msgstr "" @@ -282,7 +282,7 @@ msgid "" "The C variable may also be declared as :c:expr:`PyObject*`." msgstr "" -#: c-api/arg.rst:164 +#: c-api/arg.rst:160 msgid "``w*`` (read-write :term:`bytes-like object`) [Py_buffer]" msgstr "" @@ -290,11 +290,11 @@ msgstr "" msgid "" "This format accepts any object which implements the read-write buffer " "interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " -"The buffer may contain embedded null bytes. The caller have to call :c:func:" +"The buffer may contain embedded null bytes. The caller has to call :c:func:" "`PyBuffer_Release` when it is done with the buffer." msgstr "" -#: c-api/arg.rst:181 +#: c-api/arg.rst:166 msgid "``es`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer]" msgstr "" @@ -323,7 +323,7 @@ msgid "" "`PyMem_Free` to free the allocated buffer after use." msgstr "" -#: c-api/arg.rst:186 +#: c-api/arg.rst:183 msgid "" "``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char " "\\*encoding, char \\*\\*buffer]" @@ -336,7 +336,7 @@ msgid "" "object uses the encoding passed in as parameter." msgstr "" -#: c-api/arg.rst:217 +#: c-api/arg.rst:188 msgid "" "``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" "`Py_ssize_t` \\*buffer_length]" @@ -390,7 +390,7 @@ msgid "" "without the trailing NUL byte." msgstr "" -#: c-api/arg.rst:222 +#: c-api/arg.rst:219 msgid "" "``et#`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char " "\\*encoding, char \\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" @@ -413,163 +413,184 @@ msgstr "" msgid "Numbers" msgstr "" -#: c-api/arg.rst:234 +#: c-api/arg.rst:232 +msgid "" +"These formats allow representing Python numbers or single characters as C " +"numbers. Formats that require :class:`int`, :class:`float` or :class:" +"`complex` can also use the corresponding special methods :meth:`~object." +"__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to " +"convert the Python object to the required type." +msgstr "" + +#: c-api/arg.rst:238 +msgid "" +"For signed integer formats, :exc:`OverflowError` is raised if the value is " +"out of range for the C type. For unsigned integer formats, no range checking " +"is done --- the most significant bits are silently truncated when the " +"receiving field is too small to receive the value." +msgstr "" + +#: c-api/arg.rst:244 msgid "``b`` (:class:`int`) [unsigned char]" msgstr "" -#: c-api/arg.rst:233 +#: c-api/arg.rst:245 msgid "" -"Convert a nonnegative Python integer to an unsigned tiny int, stored in a C :" -"c:expr:`unsigned char`." +"Convert a nonnegative Python integer to an unsigned tiny integer, stored in " +"a C :c:expr:`unsigned char`." msgstr "" -#: c-api/arg.rst:581 +#: c-api/arg.rst:648 msgid "``B`` (:class:`int`) [unsigned char]" msgstr "" -#: c-api/arg.rst:237 +#: c-api/arg.rst:249 msgid "" -"Convert a Python integer to a tiny int without overflow checking, stored in " -"a C :c:expr:`unsigned char`." +"Convert a Python integer to a tiny integer without overflow checking, stored " +"in a C :c:expr:`unsigned char`." msgstr "" -#: c-api/arg.rst:575 +#: c-api/arg.rst:642 msgid "``h`` (:class:`int`) [short int]" msgstr "" -#: c-api/arg.rst:241 +#: c-api/arg.rst:253 msgid "Convert a Python integer to a C :c:expr:`short int`." msgstr "" -#: c-api/arg.rst:584 +#: c-api/arg.rst:651 msgid "``H`` (:class:`int`) [unsigned short int]" msgstr "" -#: c-api/arg.rst:244 +#: c-api/arg.rst:256 msgid "" "Convert a Python integer to a C :c:expr:`unsigned short int`, without " "overflow checking." msgstr "" -#: c-api/arg.rst:569 +#: c-api/arg.rst:636 msgid "``i`` (:class:`int`) [int]" msgstr "" -#: c-api/arg.rst:248 +#: c-api/arg.rst:260 msgid "Convert a Python integer to a plain C :c:expr:`int`." msgstr "" -#: c-api/arg.rst:587 +#: c-api/arg.rst:654 msgid "``I`` (:class:`int`) [unsigned int]" msgstr "" -#: c-api/arg.rst:251 +#: c-api/arg.rst:263 msgid "" "Convert a Python integer to a C :c:expr:`unsigned int`, without overflow " "checking." msgstr "" -#: c-api/arg.rst:578 +#: c-api/arg.rst:645 msgid "``l`` (:class:`int`) [long int]" msgstr "" -#: c-api/arg.rst:255 +#: c-api/arg.rst:267 msgid "Convert a Python integer to a C :c:expr:`long int`." msgstr "" -#: c-api/arg.rst:590 +#: c-api/arg.rst:657 msgid "``k`` (:class:`int`) [unsigned long]" msgstr "" -#: c-api/arg.rst:258 +#: c-api/arg.rst:270 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long` without overflow " "checking." msgstr "" -#: c-api/arg.rst:593 +#: c-api/arg.rst:283 +msgid "Use :meth:`~object.__index__` if available." +msgstr "" + +#: c-api/arg.rst:660 msgid "``L`` (:class:`int`) [long long]" msgstr "" -#: c-api/arg.rst:262 +#: c-api/arg.rst:277 msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "" -#: c-api/arg.rst:596 +#: c-api/arg.rst:665 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "" -#: c-api/arg.rst:265 +#: c-api/arg.rst:280 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long long` without " "overflow checking." msgstr "" -#: c-api/arg.rst:599 +#: c-api/arg.rst:668 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "" -#: c-api/arg.rst:269 +#: c-api/arg.rst:287 msgid "Convert a Python integer to a C :c:type:`Py_ssize_t`." msgstr "" -#: c-api/arg.rst:276 +#: c-api/arg.rst:289 msgid "``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]" msgstr "" -#: c-api/arg.rst:272 +#: c-api/arg.rst:290 msgid "" "Convert a Python byte, represented as a :class:`bytes` or :class:`bytearray` " "object of length 1, to a C :c:expr:`char`." msgstr "" -#: c-api/arg.rst:275 +#: c-api/arg.rst:293 msgid "Allow :class:`bytearray` objects." msgstr "" -#: c-api/arg.rst:607 +#: c-api/arg.rst:686 msgid "``C`` (:class:`str` of length 1) [int]" msgstr "" -#: c-api/arg.rst:279 +#: c-api/arg.rst:297 msgid "" "Convert a Python character, represented as a :class:`str` object of length " "1, to a C :c:expr:`int`." msgstr "" -#: c-api/arg.rst:613 +#: c-api/arg.rst:693 msgid "``f`` (:class:`float`) [float]" msgstr "" -#: c-api/arg.rst:283 -msgid "Convert a Python floating point number to a C :c:expr:`float`." +#: c-api/arg.rst:301 +msgid "Convert a Python floating-point number to a C :c:expr:`float`." msgstr "" -#: c-api/arg.rst:610 +#: c-api/arg.rst:690 msgid "``d`` (:class:`float`) [double]" msgstr "" -#: c-api/arg.rst:286 -msgid "Convert a Python floating point number to a C :c:expr:`double`." +#: c-api/arg.rst:304 +msgid "Convert a Python floating-point number to a C :c:expr:`double`." msgstr "" -#: c-api/arg.rst:289 +#: c-api/arg.rst:306 msgid "``D`` (:class:`complex`) [Py_complex]" msgstr "" -#: c-api/arg.rst:289 +#: c-api/arg.rst:307 msgid "Convert a Python complex number to a C :c:type:`Py_complex` structure." msgstr "" -#: c-api/arg.rst:292 +#: c-api/arg.rst:310 msgid "Other objects" msgstr "" -#: c-api/arg.rst:626 +#: c-api/arg.rst:699 msgid "``O`` (object) [PyObject \\*]" msgstr "" -#: c-api/arg.rst:295 +#: c-api/arg.rst:313 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " "program thus receives the actual object that was passed. A new :term:" @@ -577,11 +598,11 @@ msgid "" "not increased). The pointer stored is not ``NULL``." msgstr "" -#: c-api/arg.rst:306 +#: c-api/arg.rst:319 msgid "``O!`` (object) [*typeobject*, PyObject \\*]" msgstr "" -#: c-api/arg.rst:302 +#: c-api/arg.rst:320 msgid "" "Store a Python object in a C object pointer. This is similar to ``O``, but " "takes two C arguments: the first is the address of a Python type object, the " @@ -590,11 +611,11 @@ msgid "" "required type, :exc:`TypeError` is raised." msgstr "" -#: c-api/arg.rst:640 -msgid "``O&`` (object) [*converter*, *anything*]" +#: c-api/arg.rst:328 +msgid "``O&`` (object) [*converter*, *address*]" msgstr "" -#: c-api/arg.rst:311 +#: c-api/arg.rst:329 msgid "" "Convert a Python object to a C variable through a *converter* function. " "This takes two arguments: the first is a function, the second is the address " @@ -602,7 +623,11 @@ msgid "" "*converter* function in turn is called as follows::" msgstr "" -#: c-api/arg.rst:318 +#: c-api/arg.rst:334 +msgid "status = converter(object, address);" +msgstr "" + +#: c-api/arg.rst:336 msgid "" "where *object* is the Python object to be converted and *address* is the :c:" "expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " @@ -612,24 +637,30 @@ msgid "" "unmodified." msgstr "" -#: c-api/arg.rst:324 +#: c-api/arg.rst:345 +msgid "" +"If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get " +"called a second time if the argument parsing eventually fails, giving the " +"converter a chance to release any memory that it had already allocated. In " +"this second call, the *object* parameter will be ``NULL``; *address* will " +"have the same value as in the original call." +msgstr "" + +#: c-api/arg.rst:351 msgid "" -"If the *converter* returns ``Py_CLEANUP_SUPPORTED``, it may get called a " -"second time if the argument parsing eventually fails, giving the converter a " -"chance to release any memory that it had already allocated. In this second " -"call, the *object* parameter will be ``NULL``; *address* will have the same " -"value as in the original call." +"Examples of converters: :c:func:`PyUnicode_FSConverter` and :c:func:" +"`PyUnicode_FSDecoder`." msgstr "" -#: c-api/arg.rst:330 -msgid "``Py_CLEANUP_SUPPORTED`` was added." +#: c-api/arg.rst:354 +msgid ":c:macro:`!Py_CLEANUP_SUPPORTED` was added." msgstr "" -#: c-api/arg.rst:340 +#: c-api/arg.rst:671 msgid "``p`` (:class:`bool`) [int]" msgstr "" -#: c-api/arg.rst:334 +#: c-api/arg.rst:358 msgid "" "Tests the value passed in for truth (a boolean **p**\\ redicate) and " "converts the result to its equivalent C true/false integer value. Sets the " @@ -638,37 +669,49 @@ msgid "" "how Python tests values for truth." msgstr "" -#: c-api/arg.rst:643 -msgid "``(items)`` (:class:`tuple`) [*matching-items*]" +#: c-api/arg.rst:366 +msgid "``(items)`` (sequence) [*matching-items*]" msgstr "" -#: c-api/arg.rst:343 +#: c-api/arg.rst:367 msgid "" -"The object must be a Python sequence whose length is the number of format " -"units in *items*. The C arguments must correspond to the individual format " -"units in *items*. Format units for sequences may be nested." +"The object must be a Python sequence (except :class:`str`, :class:`bytes` " +"or :class:`bytearray`) whose length is the number of format units in " +"*items*. The C arguments must correspond to the individual format units in " +"*items*. Format units for sequences may be nested." msgstr "" -#: c-api/arg.rst:347 +#: c-api/arg.rst:372 msgid "" -"It is possible to pass \"long\" integers (integers whose value exceeds the " -"platform's :c:macro:`LONG_MAX`) however no proper range checking is done --- " -"the most significant bits are silently truncated when the receiving field is " -"too small to receive the value (actually, the semantics are inherited from " -"downcasts in C --- your mileage may vary)." +"If *items* contains format units which store a :ref:`borrowed buffer ` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or a :" +"term:`borrowed reference` (``S``, ``Y``, ``U``, ``O``, or ``O!``), the " +"object must be a Python tuple. The *converter* for the ``O&`` format unit in " +"*items* must not store a borrowed buffer or a borrowed reference." msgstr "" -#: c-api/arg.rst:353 +#: c-api/arg.rst:379 +msgid "" +":class:`str` and :class:`bytearray` objects no longer accepted as a sequence." +msgstr "" + +#: c-api/arg.rst:382 +msgid "" +"Non-tuple sequences are deprecated if *items* contains format units which " +"store a borrowed buffer or a borrowed reference." +msgstr "" + +#: c-api/arg.rst:386 msgid "" "A few other characters have a meaning in a format string. These may not " "occur inside nested parentheses. They are:" msgstr "" -#: c-api/arg.rst:361 +#: c-api/arg.rst:389 msgid "``|``" msgstr "" -#: c-api/arg.rst:357 +#: c-api/arg.rst:390 msgid "" "Indicates that the remaining arguments in the Python argument list are " "optional. The C variables corresponding to optional arguments should be " @@ -677,11 +720,11 @@ msgid "" "corresponding C variable(s)." msgstr "" -#: c-api/arg.rst:370 +#: c-api/arg.rst:396 msgid "``$``" msgstr "" -#: c-api/arg.rst:364 +#: c-api/arg.rst:397 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` only: Indicates that the remaining " "arguments in the Python argument list are keyword-only. Currently, all " @@ -689,36 +732,36 @@ msgid "" "be specified before ``$`` in the format string." msgstr "" -#: c-api/arg.rst:375 +#: c-api/arg.rst:405 msgid "``:``" msgstr "" -#: c-api/arg.rst:373 +#: c-api/arg.rst:406 msgid "" "The list of format units ends here; the string after the colon is used as " "the function name in error messages (the \"associated value\" of the " "exception that :c:func:`PyArg_ParseTuple` raises)." msgstr "" -#: c-api/arg.rst:380 +#: c-api/arg.rst:410 msgid "``;``" msgstr "" -#: c-api/arg.rst:378 +#: c-api/arg.rst:411 msgid "" "The list of format units ends here; the string after the semicolon is used " "as the error message *instead* of the default error message. ``:`` and ``;" "`` mutually exclude each other." msgstr "" -#: c-api/arg.rst:382 +#: c-api/arg.rst:415 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not release them (i.e. do not decrement their " "reference count)!" msgstr "" -#: c-api/arg.rst:386 +#: c-api/arg.rst:419 msgid "" "Additional arguments passed to these functions must be addresses of " "variables whose type is determined by the format string; these are used to " @@ -728,7 +771,7 @@ msgid "" "unit in that case." msgstr "" -#: c-api/arg.rst:392 +#: c-api/arg.rst:425 msgid "" "For the conversion to succeed, the *arg* object must match the format and " "the format must be exhausted. On success, the ``PyArg_Parse*`` functions " @@ -738,63 +781,92 @@ msgid "" "the following format units are left untouched." msgstr "" -#: c-api/arg.rst:401 +#: c-api/arg.rst:434 msgid "API Functions" msgstr "" -#: c-api/arg.rst:405 +#: c-api/arg.rst:438 msgid "" "Parse the parameters of a function that takes only positional parameters " "into local variables. Returns true on success; on failure, it returns false " "and raises the appropriate exception." msgstr "" -#: c-api/arg.rst:412 +#: c-api/arg.rst:445 msgid "" "Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list " "rather than a variable number of arguments." msgstr "" -#: c-api/arg.rst:418 +#: c-api/arg.rst:451 msgid "" "Parse the parameters of a function that takes both positional and keyword " -"parameters into local variables. The *keywords* argument is a ``NULL``-" -"terminated array of keyword parameter names. Empty names denote :ref:" -"`positional-only parameters `. Returns true on " -"success; on failure, it returns false and raises the appropriate exception." +"parameters into local variables. The *keywords* argument is a ``NULL``-" +"terminated array of keyword parameter names specified as null-terminated " +"ASCII or UTF-8 encoded C strings. Empty names denote :ref:`positional-only " +"parameters `. Returns true on success; on " +"failure, it returns false and raises the appropriate exception." msgstr "" -#: c-api/arg.rst:425 +#: c-api/arg.rst:462 +msgid "" +"The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++. This can be overridden with the :c:macro:" +"`PY_CXX_CONST` macro." +msgstr "" + +#: c-api/arg.rst:466 msgid "" "Added support for :ref:`positional-only parameters `." msgstr "" -#: c-api/arg.rst:432 +#: c-api/arg.rst:470 +msgid "" +"The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " +"support for non-ASCII keyword parameter names." +msgstr "" + +#: c-api/arg.rst:479 msgid "" "Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a " "va_list rather than a variable number of arguments." msgstr "" -#: c-api/arg.rst:438 +#: c-api/arg.rst:485 msgid "" "Ensure that the keys in the keywords argument dictionary are strings. This " "is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since " "the latter already does this check." msgstr "" -#: c-api/arg.rst:448 +#: c-api/arg.rst:494 +msgid "" +"Parse the parameter of a function that takes a single positional parameter " +"into a local variable. Returns true on success; on failure, it returns " +"false and raises the appropriate exception." +msgstr "" + +#: c-api/arg.rst:498 +msgid "Example::" +msgstr "" + +#: c-api/arg.rst:500 msgid "" -"Function used to deconstruct the argument lists of \"old-style\" functions " -"--- these are functions which use the :const:`METH_OLDARGS` parameter " -"parsing method, which has been removed in Python 3. This is not recommended " -"for use in parameter parsing in new code, and most code in the standard " -"interpreter has been modified to no longer use this for that purpose. It " -"does remain a convenient way to decompose other tuples, however, and may " -"continue to be used for that purpose." +"// Function using METH_O calling convention\n" +"static PyObject*\n" +"my_function(PyObject *module, PyObject *arg)\n" +"{\n" +" int value;\n" +" if (!PyArg_Parse(arg, \"i:my_function\", &value)) {\n" +" return NULL;\n" +" }\n" +" // ... use value ...\n" +"}" msgstr "" -#: c-api/arg.rst:459 +#: c-api/arg.rst:514 msgid "" "A simpler form of parameter retrieval which does not use a format string to " "specify the types of the arguments. Functions which use this method to " @@ -812,23 +884,52 @@ msgid "" "if there was a failure." msgstr "" -#: c-api/arg.rst:474 +#: c-api/arg.rst:529 msgid "" "This is an example of the use of this function, taken from the sources for " "the :mod:`!_weakref` helper module for weak references::" msgstr "" -#: c-api/arg.rst:490 +#: c-api/arg.rst:532 +msgid "" +"static PyObject *\n" +"weakref_ref(PyObject *self, PyObject *args)\n" +"{\n" +" PyObject *object;\n" +" PyObject *callback = NULL;\n" +" PyObject *result = NULL;\n" +"\n" +" if (PyArg_UnpackTuple(args, \"ref\", 1, 2, &object, &callback)) {\n" +" result = PyWeakref_NewRef(object, callback);\n" +" }\n" +" return result;\n" +"}" +msgstr "" + +#: c-api/arg.rst:545 msgid "" "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " "equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" -#: c-api/arg.rst:498 +#: c-api/arg.rst:548 +msgid "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" +msgstr "" + +#: c-api/arg.rst:552 +msgid "" +"The value to be inserted, if any, before :c:expr:`char * const *` in the " +"*keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` " +"and :c:func:`PyArg_VaParseTupleAndKeywords`. Default empty for C and " +"``const`` for C++ (:c:expr:`const char * const *`). To override, define it " +"to the desired value before including :file:`Python.h`." +msgstr "" + +#: c-api/arg.rst:566 msgid "Building values" msgstr "" -#: c-api/arg.rst:502 +#: c-api/arg.rst:570 msgid "" "Create a new value based on a format string similar to those accepted by the " "``PyArg_Parse*`` family of functions and a sequence of values. Returns the " @@ -836,7 +937,7 @@ msgid "" "``NULL`` is returned." msgstr "" -#: c-api/arg.rst:507 +#: c-api/arg.rst:575 msgid "" ":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple " "only if its format string contains two or more format units. If the format " @@ -845,7 +946,7 @@ msgid "" "it to return a tuple of size 0 or one, parenthesize the format string." msgstr "" -#: c-api/arg.rst:513 +#: c-api/arg.rst:581 msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " @@ -856,7 +957,7 @@ msgid "" "`Py_BuildValue` returns." msgstr "" -#: c-api/arg.rst:521 +#: c-api/arg.rst:589 msgid "" "In the following description, the quoted form is the format unit; the entry " "in (round) parentheses is the Python object type that the format unit will " @@ -864,180 +965,192 @@ msgid "" "be passed." msgstr "" -#: c-api/arg.rst:525 +#: c-api/arg.rst:593 msgid "" "The characters space, tab, colon and comma are ignored in format strings " "(but not within format units such as ``s#``). This can be used to make long " "format strings a tad more readable." msgstr "" -#: c-api/arg.rst:531 +#: c-api/arg.rst:597 msgid "``s`` (:class:`str` or ``None``) [const char \\*]" msgstr "" -#: c-api/arg.rst:530 +#: c-api/arg.rst:598 msgid "" "Convert a null-terminated C string to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -#: c-api/arg.rst:536 +#: c-api/arg.rst:601 msgid "" "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -#: c-api/arg.rst:534 +#: c-api/arg.rst:602 msgid "" "Convert a C string and its length to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: c-api/arg.rst:540 +#: c-api/arg.rst:606 msgid "``y`` (:class:`bytes`) [const char \\*]" msgstr "" -#: c-api/arg.rst:539 +#: c-api/arg.rst:607 msgid "" "This converts a C string to a Python :class:`bytes` object. If the C string " "pointer is ``NULL``, ``None`` is returned." msgstr "" -#: c-api/arg.rst:544 +#: c-api/arg.rst:610 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -#: c-api/arg.rst:543 +#: c-api/arg.rst:611 msgid "" "This converts a C string and its lengths to a Python object. If the C " "string pointer is ``NULL``, ``None`` is returned." msgstr "" -#: c-api/arg.rst:563 +#: c-api/arg.rst:631 msgid "Same as ``s``." msgstr "" -#: c-api/arg.rst:550 +#: c-api/arg.rst:617 msgid "" "``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -#: c-api/arg.rst:566 +#: c-api/arg.rst:634 msgid "Same as ``s#``." msgstr "" -#: c-api/arg.rst:555 +#: c-api/arg.rst:620 msgid "``u`` (:class:`str`) [const wchar_t \\*]" msgstr "" -#: c-api/arg.rst:553 +#: c-api/arg.rst:621 msgid "" "Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or " "UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is " "``NULL``, ``None`` is returned." msgstr "" -#: c-api/arg.rst:560 +#: c-api/arg.rst:625 msgid "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" msgstr "" -#: c-api/arg.rst:558 +#: c-api/arg.rst:626 msgid "" "Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python " "Unicode object. If the Unicode buffer pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: c-api/arg.rst:563 +#: c-api/arg.rst:630 msgid "``U`` (:class:`str` or ``None``) [const char \\*]" msgstr "" -#: c-api/arg.rst:566 +#: c-api/arg.rst:633 msgid "" "``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -#: c-api/arg.rst:569 +#: c-api/arg.rst:637 msgid "Convert a plain C :c:expr:`int` to a Python integer object." msgstr "" -#: c-api/arg.rst:572 +#: c-api/arg.rst:639 msgid "``b`` (:class:`int`) [char]" msgstr "" -#: c-api/arg.rst:572 +#: c-api/arg.rst:640 msgid "Convert a plain C :c:expr:`char` to a Python integer object." msgstr "" -#: c-api/arg.rst:575 +#: c-api/arg.rst:643 msgid "Convert a plain C :c:expr:`short int` to a Python integer object." msgstr "" -#: c-api/arg.rst:578 +#: c-api/arg.rst:646 msgid "Convert a C :c:expr:`long int` to a Python integer object." msgstr "" -#: c-api/arg.rst:581 +#: c-api/arg.rst:649 msgid "Convert a C :c:expr:`unsigned char` to a Python integer object." msgstr "" -#: c-api/arg.rst:584 +#: c-api/arg.rst:652 msgid "Convert a C :c:expr:`unsigned short int` to a Python integer object." msgstr "" -#: c-api/arg.rst:587 +#: c-api/arg.rst:655 msgid "Convert a C :c:expr:`unsigned int` to a Python integer object." msgstr "" -#: c-api/arg.rst:590 +#: c-api/arg.rst:658 msgid "Convert a C :c:expr:`unsigned long` to a Python integer object." msgstr "" -#: c-api/arg.rst:593 +#: c-api/arg.rst:661 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "" -#: c-api/arg.rst:596 +#: c-api/arg.rst:666 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "" -#: c-api/arg.rst:599 +#: c-api/arg.rst:669 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "" -#: c-api/arg.rst:603 +#: c-api/arg.rst:672 +msgid "Convert a C :c:expr:`int` to a Python :class:`bool` object." +msgstr "" + +#: c-api/arg.rst:674 +msgid "" +"Be aware that this format requires an ``int`` argument. Unlike most other " +"contexts in C, variadic arguments are not coerced to a suitable type " +"automatically. You can convert another type (for example, a pointer or a " +"float) to a suitable ``int`` value using ``(x) ? 1 : 0`` or ``!!x``." +msgstr "" + +#: c-api/arg.rst:682 msgid "``c`` (:class:`bytes` of length 1) [char]" msgstr "" -#: c-api/arg.rst:602 +#: c-api/arg.rst:683 msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." msgstr "" -#: c-api/arg.rst:606 +#: c-api/arg.rst:687 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." msgstr "" -#: c-api/arg.rst:610 -msgid "Convert a C :c:expr:`double` to a Python floating point number." +#: c-api/arg.rst:691 +msgid "Convert a C :c:expr:`double` to a Python floating-point number." msgstr "" -#: c-api/arg.rst:613 -msgid "Convert a C :c:expr:`float` to a Python floating point number." +#: c-api/arg.rst:694 +msgid "Convert a C :c:expr:`float` to a Python floating-point number." msgstr "" -#: c-api/arg.rst:616 +#: c-api/arg.rst:696 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "" -#: c-api/arg.rst:616 +#: c-api/arg.rst:697 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "" -#: c-api/arg.rst:619 +#: c-api/arg.rst:700 msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " @@ -1047,26 +1160,30 @@ msgid "" "no exception has been raised yet, :exc:`SystemError` is set." msgstr "" -#: c-api/arg.rst:629 +#: c-api/arg.rst:709 msgid "``S`` (object) [PyObject \\*]" msgstr "" -#: c-api/arg.rst:629 +#: c-api/arg.rst:710 msgid "Same as ``O``." msgstr "" -#: c-api/arg.rst:634 +#: c-api/arg.rst:712 msgid "``N`` (object) [PyObject \\*]" msgstr "" -#: c-api/arg.rst:632 +#: c-api/arg.rst:713 msgid "" "Same as ``O``, except it doesn't create a new :term:`strong reference`. " "Useful when the object is created by a call to an object constructor in the " "argument list." msgstr "" -#: c-api/arg.rst:637 +#: c-api/arg.rst:717 +msgid "``O&`` (object) [*converter*, *anything*]" +msgstr "" + +#: c-api/arg.rst:718 msgid "" "Convert *anything* to a Python object through a *converter* function. The " "function is called with *anything* (which should be compatible with :c:expr:" @@ -1074,40 +1191,44 @@ msgid "" "``NULL`` if an error occurred." msgstr "" -#: c-api/arg.rst:643 +#: c-api/arg.rst:723 +msgid "``(items)`` (:class:`tuple`) [*matching-items*]" +msgstr "" + +#: c-api/arg.rst:724 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." msgstr "" -#: c-api/arg.rst:646 +#: c-api/arg.rst:726 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "" -#: c-api/arg.rst:646 +#: c-api/arg.rst:727 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." msgstr "" -#: c-api/arg.rst:651 +#: c-api/arg.rst:729 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "" -#: c-api/arg.rst:649 +#: c-api/arg.rst:730 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -#: c-api/arg.rst:653 +#: c-api/arg.rst:734 msgid "" "If there is an error in the format string, the :exc:`SystemError` exception " "is set and ``NULL`` returned." msgstr "" -#: c-api/arg.rst:658 +#: c-api/arg.rst:739 msgid "" "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " "rather than a variable number of arguments." diff --git a/c-api/bool.po b/c-api/bool.po index 9d32a9b6..a5635f72 100644 --- a/c-api/bool.po +++ b/c-api/bool.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -42,22 +43,22 @@ msgstr "" #: c-api/bool.rst:28 msgid "" -"The Python ``False`` object. This object has no methods and is `immortal " -"`_." +"The Python ``False`` object. This object has no methods and is :term:" +"`immortal`." msgstr "" #: c-api/bool.rst:31 -msgid ":c:data:`Py_False` is immortal." +msgid ":c:data:`Py_False` is :term:`immortal`." msgstr "" #: c-api/bool.rst:37 msgid "" -"The Python ``True`` object. This object has no methods and is `immortal " -"`_." +"The Python ``True`` object. This object has no methods and is :term:" +"`immortal`." msgstr "" #: c-api/bool.rst:40 -msgid ":c:data:`Py_True` is immortal." +msgid ":c:data:`Py_True` is :term:`immortal`." msgstr "" #: c-api/bool.rst:46 diff --git a/c-api/buffer.po b/c-api/buffer.po index 3f0fdc38..e32236c7 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -39,24 +40,26 @@ msgstr "" #: c-api/buffer.rst:29 msgid "" -"Python provides such a facility at the C level in the form of the :ref:" -"`buffer protocol `. This protocol has two sides:" +"Python provides such a facility at the C and Python level in the form of " +"the :ref:`buffer protocol `. This protocol has two sides:" msgstr "" #: c-api/buffer.rst:34 msgid "" "on the producer side, a type can export a \"buffer interface\" which allows " "objects of that type to expose information about their underlying buffer. " -"This interface is described in the section :ref:`buffer-structs`;" +"This interface is described in the section :ref:`buffer-structs`; for Python " +"see :ref:`python-buffer-protocol`." msgstr "" -#: c-api/buffer.rst:38 +#: c-api/buffer.rst:39 msgid "" "on the consumer side, several means are available to obtain a pointer to the " -"raw underlying data of an object (for example a method parameter)." +"raw underlying data of an object (for example a method parameter). For " +"Python see :class:`memoryview`." msgstr "" -#: c-api/buffer.rst:41 +#: c-api/buffer.rst:43 msgid "" "Simple objects such as :class:`bytes` and :class:`bytearray` expose their " "underlying buffer in byte-oriented form. Other forms are possible; for " @@ -64,7 +67,7 @@ msgid "" "values." msgstr "" -#: c-api/buffer.rst:45 +#: c-api/buffer.rst:47 msgid "" "An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase." "write` method of file objects: any object that can export a series of bytes " @@ -76,23 +79,23 @@ msgid "" "buffers." msgstr "" -#: c-api/buffer.rst:53 +#: c-api/buffer.rst:55 msgid "" "There are two ways for a consumer of the buffer interface to acquire a " "buffer over a target object:" msgstr "" -#: c-api/buffer.rst:56 +#: c-api/buffer.rst:58 msgid "call :c:func:`PyObject_GetBuffer` with the right parameters;" msgstr "" -#: c-api/buffer.rst:58 +#: c-api/buffer.rst:60 msgid "" "call :c:func:`PyArg_ParseTuple` (or one of its siblings) with one of the " "``y*``, ``w*`` or ``s*`` :ref:`format codes `." msgstr "" -#: c-api/buffer.rst:61 +#: c-api/buffer.rst:63 msgid "" "In both cases, :c:func:`PyBuffer_Release` must be called when the buffer " "isn't needed anymore. Failure to do so could lead to various issues such as " @@ -100,10 +103,16 @@ msgid "" msgstr "" #: c-api/buffer.rst:69 +msgid "" +"The buffer protocol is now accessible in Python, see :ref:`python-buffer-" +"protocol` and :class:`memoryview`." +msgstr "" + +#: c-api/buffer.rst:75 msgid "Buffer structure" msgstr "" -#: c-api/buffer.rst:71 +#: c-api/buffer.rst:77 msgid "" "Buffer structures (or simply \"buffers\") are useful as a way to expose the " "binary data from another object to the Python programmer. They can also be " @@ -115,7 +124,7 @@ msgid "" "in its native, in-memory format." msgstr "" -#: c-api/buffer.rst:80 +#: c-api/buffer.rst:86 msgid "" "Contrary to most data types exposed by the Python interpreter, buffers are " "not :c:type:`PyObject` pointers but rather simple C structures. This allows " @@ -124,14 +133,14 @@ msgid "" "created." msgstr "" -#: c-api/buffer.rst:86 +#: c-api/buffer.rst:92 msgid "" "For short instructions how to write an exporting object, see :ref:`Buffer " "Object Structures `. For obtaining a buffer, see :c:func:" "`PyObject_GetBuffer`." msgstr "" -#: c-api/buffer.rst:94 +#: c-api/buffer.rst:100 msgid "" "A pointer to the start of the logical structure described by the buffer " "fields. This can be any location within the underlying physical memory block " @@ -139,13 +148,13 @@ msgid "" "the value may point to the end of the memory block." msgstr "" -#: c-api/buffer.rst:99 +#: c-api/buffer.rst:105 msgid "" "For :term:`contiguous` arrays, the value points to the beginning of the " "memory block." msgstr "" -#: c-api/buffer.rst:104 +#: c-api/buffer.rst:110 msgid "" "A new reference to the exporting object. The reference is owned by the " "consumer and automatically released (i.e. reference count decremented) and " @@ -153,14 +162,14 @@ msgid "" "of the return value of any standard C-API function." msgstr "" -#: c-api/buffer.rst:111 +#: c-api/buffer.rst:117 msgid "" "As a special case, for *temporary* buffers that are wrapped by :c:func:" "`PyMemoryView_FromBuffer` or :c:func:`PyBuffer_FillInfo` this field is " "``NULL``. In general, exporting objects MUST NOT use this scheme." msgstr "" -#: c-api/buffer.rst:118 +#: c-api/buffer.rst:124 msgid "" "``product(shape) * itemsize``. For contiguous arrays, this is the length of " "the underlying memory block. For non-contiguous arrays, it is the length " @@ -168,7 +177,7 @@ msgid "" "representation." msgstr "" -#: c-api/buffer.rst:123 +#: c-api/buffer.rst:129 msgid "" "Accessing ``((char *)buf)[0] up to ((char *)buf)[len-1]`` is only valid if " "the buffer has been obtained by a request that guarantees contiguity. In " @@ -176,19 +185,19 @@ msgid "" "`PyBUF_WRITABLE`." msgstr "" -#: c-api/buffer.rst:129 +#: c-api/buffer.rst:135 msgid "" "An indicator of whether the buffer is read-only. This field is controlled by " "the :c:macro:`PyBUF_WRITABLE` flag." msgstr "" -#: c-api/buffer.rst:134 +#: c-api/buffer.rst:140 msgid "" "Item size in bytes of a single element. Same as the value of :func:`struct." "calcsize` called on non-``NULL`` :c:member:`~Py_buffer.format` values." msgstr "" -#: c-api/buffer.rst:137 +#: c-api/buffer.rst:143 msgid "" "Important exception: If a consumer requests a buffer without the :c:macro:" "`PyBUF_FORMAT` flag, :c:member:`~Py_buffer.format` will be set to " @@ -196,32 +205,32 @@ msgid "" "original format." msgstr "" -#: c-api/buffer.rst:142 +#: c-api/buffer.rst:148 msgid "" "If :c:member:`~Py_buffer.shape` is present, the equality ``product(shape) * " "itemsize == len`` still holds and the consumer can use :c:member:`~Py_buffer." "itemsize` to navigate the buffer." msgstr "" -#: c-api/buffer.rst:146 +#: c-api/buffer.rst:152 msgid "" "If :c:member:`~Py_buffer.shape` is ``NULL`` as a result of a :c:macro:" "`PyBUF_SIMPLE` or a :c:macro:`PyBUF_WRITABLE` request, the consumer must " "disregard :c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``." msgstr "" -#: c-api/buffer.rst:152 +#: c-api/buffer.rst:158 msgid "" -"A *NUL* terminated string in :mod:`struct` module style syntax describing " +"A *NULL* terminated string in :mod:`struct` module style syntax describing " "the contents of a single item. If this is ``NULL``, ``\"B\"`` (unsigned " "bytes) is assumed." msgstr "" -#: c-api/buffer.rst:156 +#: c-api/buffer.rst:162 msgid "This field is controlled by the :c:macro:`PyBUF_FORMAT` flag." msgstr "" -#: c-api/buffer.rst:160 +#: c-api/buffer.rst:166 msgid "" "The number of dimensions the memory represents as an n-dimensional array. If " "it is ``0``, :c:member:`~Py_buffer.buf` points to a single item representing " @@ -230,7 +239,7 @@ msgid "" "number of dimensions is given by :c:macro:`PyBUF_MAX_NDIM`." msgstr "" -#: c-api/buffer.rst:168 +#: c-api/buffer.rst:174 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " "indicating the shape of the memory as an n-dimensional array. Note that " @@ -238,34 +247,34 @@ msgid "" "`~Py_buffer.len`." msgstr "" -#: c-api/buffer.rst:173 +#: c-api/buffer.rst:179 msgid "" "Shape values are restricted to ``shape[n] >= 0``. The case ``shape[n] == 0`` " "requires special attention. See `complex arrays`_ for further information." msgstr "" -#: c-api/buffer.rst:177 +#: c-api/buffer.rst:183 msgid "The shape array is read-only for the consumer." msgstr "" -#: c-api/buffer.rst:181 +#: c-api/buffer.rst:187 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " "giving the number of bytes to skip to get to a new element in each dimension." msgstr "" -#: c-api/buffer.rst:185 +#: c-api/buffer.rst:191 msgid "" "Stride values can be any integer. For regular arrays, strides are usually " "positive, but a consumer MUST be able to handle the case ``strides[n] <= " "0``. See `complex arrays`_ for further information." msgstr "" -#: c-api/buffer.rst:189 +#: c-api/buffer.rst:195 msgid "The strides array is read-only for the consumer." msgstr "" -#: c-api/buffer.rst:193 +#: c-api/buffer.rst:199 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim`. If " "``suboffsets[n] >= 0``, the values stored along the nth dimension are " @@ -274,24 +283,24 @@ msgid "" "that no de-referencing should occur (striding in a contiguous memory block)." msgstr "" -#: c-api/buffer.rst:200 +#: c-api/buffer.rst:206 msgid "" "If all suboffsets are negative (i.e. no de-referencing is needed), then this " "field must be ``NULL`` (the default value)." msgstr "" -#: c-api/buffer.rst:203 +#: c-api/buffer.rst:209 msgid "" "This type of array representation is used by the Python Imaging Library " "(PIL). See `complex arrays`_ for further information how to access elements " "of such an array." msgstr "" -#: c-api/buffer.rst:207 +#: c-api/buffer.rst:213 msgid "The suboffsets array is read-only for the consumer." msgstr "" -#: c-api/buffer.rst:211 +#: c-api/buffer.rst:217 msgid "" "This is for use internally by the exporting object. For example, this might " "be re-cast as an integer by the exporter and used to store flags about " @@ -299,22 +308,22 @@ msgid "" "the buffer is released. The consumer MUST NOT alter this value." msgstr "" -#: c-api/buffer.rst:218 +#: c-api/buffer.rst:224 msgid "Constants:" msgstr "" -#: c-api/buffer.rst:222 +#: c-api/buffer.rst:228 msgid "" "The maximum number of dimensions the memory represents. Exporters MUST " "respect this limit, consumers of multi-dimensional buffers SHOULD be able to " "handle up to :c:macro:`!PyBUF_MAX_NDIM` dimensions. Currently set to 64." msgstr "" -#: c-api/buffer.rst:231 +#: c-api/buffer.rst:237 msgid "Buffer request types" msgstr "" -#: c-api/buffer.rst:233 +#: c-api/buffer.rst:239 msgid "" "Buffers are usually obtained by sending a buffer request to an exporting " "object via :c:func:`PyObject_GetBuffer`. Since the complexity of the logical " @@ -322,16 +331,16 @@ msgid "" "argument to specify the exact buffer type it can handle." msgstr "" -#: c-api/buffer.rst:238 +#: c-api/buffer.rst:244 msgid "" "All :c:type:`Py_buffer` fields are unambiguously defined by the request type." msgstr "" -#: c-api/buffer.rst:242 +#: c-api/buffer.rst:248 msgid "request-independent fields" msgstr "" -#: c-api/buffer.rst:243 +#: c-api/buffer.rst:249 msgid "" "The following fields are not influenced by *flags* and must always be filled " "in with the correct values: :c:member:`~Py_buffer.obj`, :c:member:" @@ -339,25 +348,30 @@ msgid "" "itemsize`, :c:member:`~Py_buffer.ndim`." msgstr "" -#: c-api/buffer.rst:249 +#: c-api/buffer.rst:254 msgid "readonly, format" msgstr "" -#: c-api/buffer.rst:253 +#: c-api/buffer.rst:258 msgid "" "Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter " "MUST provide a writable buffer or else report failure. Otherwise, the " "exporter MAY provide either a read-only or writable buffer, but the choice " -"MUST be consistent for all consumers." +"MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | " +"PyBUF_WRITABLE` can be used to request a simple writable buffer." msgstr "" -#: c-api/buffer.rst:260 +#: c-api/buffer.rst:266 +msgid "This is a :term:`soft deprecated` alias to :c:macro:`PyBUF_WRITABLE`." +msgstr "" + +#: c-api/buffer.rst:270 msgid "" "Controls the :c:member:`~Py_buffer.format` field. If set, this field MUST be " "filled in correctly. Otherwise, this field MUST be ``NULL``." msgstr "" -#: c-api/buffer.rst:264 +#: c-api/buffer.rst:274 msgid "" ":c:macro:`PyBUF_WRITABLE` can be \\|'d to any of the flags in the next " "section. Since :c:macro:`PyBUF_SIMPLE` is defined as 0, :c:macro:" @@ -365,139 +379,140 @@ msgid "" "writable buffer." msgstr "" -#: c-api/buffer.rst:268 +#: c-api/buffer.rst:278 msgid "" -":c:macro:`PyBUF_FORMAT` can be \\|'d to any of the flags except :c:macro:" -"`PyBUF_SIMPLE`. The latter already implies format ``B`` (unsigned bytes)." +":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:" +"`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned " +"bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" -#: c-api/buffer.rst:273 +#: c-api/buffer.rst:284 msgid "shape, strides, suboffsets" msgstr "" -#: c-api/buffer.rst:275 +#: c-api/buffer.rst:286 msgid "" "The flags that control the logical structure of the memory are listed in " "decreasing order of complexity. Note that each flag contains all bits of the " "flags below it." msgstr "" -#: c-api/buffer.rst:306 c-api/buffer.rst:331 +#: c-api/buffer.rst:317 c-api/buffer.rst:342 msgid "Request" msgstr "" -#: c-api/buffer.rst:306 c-api/buffer.rst:331 +#: c-api/buffer.rst:317 c-api/buffer.rst:342 msgid "shape" msgstr "" -#: c-api/buffer.rst:306 c-api/buffer.rst:331 +#: c-api/buffer.rst:317 c-api/buffer.rst:342 msgid "strides" msgstr "" -#: c-api/buffer.rst:306 c-api/buffer.rst:331 +#: c-api/buffer.rst:317 c-api/buffer.rst:342 msgid "suboffsets" msgstr "" -#: c-api/buffer.rst:286 c-api/buffer.rst:308 c-api/buffer.rst:312 -#: c-api/buffer.rst:333 c-api/buffer.rst:337 c-api/buffer.rst:341 -#: c-api/buffer.rst:345 c-api/buffer.rst:347 +#: c-api/buffer.rst:297 c-api/buffer.rst:319 c-api/buffer.rst:323 +#: c-api/buffer.rst:344 c-api/buffer.rst:348 c-api/buffer.rst:352 +#: c-api/buffer.rst:356 c-api/buffer.rst:358 msgid "yes" msgstr "" -#: c-api/buffer.rst:333 c-api/buffer.rst:335 +#: c-api/buffer.rst:344 c-api/buffer.rst:346 msgid "if needed" msgstr "" -#: c-api/buffer.rst:288 c-api/buffer.rst:308 c-api/buffer.rst:312 -#: c-api/buffer.rst:337 c-api/buffer.rst:341 c-api/buffer.rst:345 -#: c-api/buffer.rst:347 +#: c-api/buffer.rst:299 c-api/buffer.rst:319 c-api/buffer.rst:323 +#: c-api/buffer.rst:348 c-api/buffer.rst:352 c-api/buffer.rst:356 +#: c-api/buffer.rst:358 msgid "NULL" msgstr "" -#: c-api/buffer.rst:297 +#: c-api/buffer.rst:308 msgid "contiguity requests" msgstr "" -#: c-api/buffer.rst:299 +#: c-api/buffer.rst:310 msgid "" "C or Fortran :term:`contiguity ` can be explicitly requested, " "with and without stride information. Without stride information, the buffer " "must be C-contiguous." msgstr "" -#: c-api/buffer.rst:331 +#: c-api/buffer.rst:342 msgid "contig" msgstr "" -#: c-api/buffer.rst:314 c-api/buffer.rst:347 +#: c-api/buffer.rst:325 c-api/buffer.rst:358 msgid "C" msgstr "" -#: c-api/buffer.rst:310 +#: c-api/buffer.rst:321 msgid "F" msgstr "" -#: c-api/buffer.rst:312 +#: c-api/buffer.rst:323 msgid "C or F" msgstr "" -#: c-api/buffer.rst:314 +#: c-api/buffer.rst:325 msgid ":c:macro:`PyBUF_ND`" msgstr "" -#: c-api/buffer.rst:319 +#: c-api/buffer.rst:330 msgid "compound requests" msgstr "" -#: c-api/buffer.rst:321 +#: c-api/buffer.rst:332 msgid "" "All possible requests are fully defined by some combination of the flags in " "the previous section. For convenience, the buffer protocol provides " "frequently used combinations as single flags." msgstr "" -#: c-api/buffer.rst:325 +#: c-api/buffer.rst:336 msgid "" "In the following table *U* stands for undefined contiguity. The consumer " "would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "" -#: c-api/buffer.rst:331 +#: c-api/buffer.rst:342 msgid "readonly" msgstr "" -#: c-api/buffer.rst:331 +#: c-api/buffer.rst:342 msgid "format" msgstr "" -#: c-api/buffer.rst:335 c-api/buffer.rst:339 c-api/buffer.rst:343 +#: c-api/buffer.rst:346 c-api/buffer.rst:350 c-api/buffer.rst:354 msgid "U" msgstr "" -#: c-api/buffer.rst:337 c-api/buffer.rst:345 +#: c-api/buffer.rst:348 c-api/buffer.rst:356 msgid "0" msgstr "" -#: c-api/buffer.rst:339 c-api/buffer.rst:347 +#: c-api/buffer.rst:350 c-api/buffer.rst:358 msgid "1 or 0" msgstr "" -#: c-api/buffer.rst:352 +#: c-api/buffer.rst:363 msgid "Complex arrays" msgstr "" -#: c-api/buffer.rst:355 +#: c-api/buffer.rst:366 msgid "NumPy-style: shape and strides" msgstr "" -#: c-api/buffer.rst:357 +#: c-api/buffer.rst:368 msgid "" "The logical structure of NumPy-style arrays is defined by :c:member:" "`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer." "shape` and :c:member:`~Py_buffer.strides`." msgstr "" -#: c-api/buffer.rst:360 +#: c-api/buffer.rst:371 msgid "" "If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer." "buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In " @@ -505,25 +520,61 @@ msgid "" "strides` are ``NULL``." msgstr "" -#: c-api/buffer.rst:364 +#: c-api/buffer.rst:375 msgid "" "If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a " "standard n-dimensional C-array. Otherwise, the consumer must access an n-" "dimensional array as follows:" msgstr "" -#: c-api/buffer.rst:374 +#: c-api/buffer.rst:379 +msgid "" +"ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " +"strides[n-1];\n" +"item = *((typeof(item) *)ptr);" +msgstr "" + +#: c-api/buffer.rst:385 msgid "" "As noted above, :c:member:`~Py_buffer.buf` can point to any location within " "the actual memory block. An exporter can check the validity of a buffer with " "this function:" msgstr "" -#: c-api/buffer.rst:408 +#: c-api/buffer.rst:389 +msgid "" +"def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" +" \"\"\"Verify that the parameters represent a valid array within\n" +" the bounds of the allocated memory:\n" +" char *mem: start of the physical memory block\n" +" memlen: length of the physical memory block\n" +" offset: (char *)buf - mem\n" +" \"\"\"\n" +" if offset % itemsize:\n" +" return False\n" +" if offset < 0 or offset+itemsize > memlen:\n" +" return False\n" +" if any(v % itemsize for v in strides):\n" +" return False\n" +"\n" +" if ndim <= 0:\n" +" return ndim == 0 and not shape and not strides\n" +" if 0 in shape:\n" +" return True\n" +"\n" +" imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" +" if strides[j] <= 0)\n" +" imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" +" if strides[j] > 0)\n" +"\n" +" return 0 <= offset+imin and offset+imax+itemsize <= memlen" +msgstr "" + +#: c-api/buffer.rst:419 msgid "PIL-style: shape, strides and suboffsets" msgstr "" -#: c-api/buffer.rst:410 +#: c-api/buffer.rst:421 msgid "" "In addition to the regular items, PIL-style arrays can contain pointers that " "must be followed in order to get to the next element in a dimension. For " @@ -534,32 +585,48 @@ msgid "" "x[2][3]`` arrays that can be located anywhere in memory." msgstr "" -#: c-api/buffer.rst:419 +#: c-api/buffer.rst:430 msgid "" "Here is a function that returns a pointer to the element in an N-D array " "pointed to by an N-dimensional index when there are both non-``NULL`` " "strides and suboffsets::" msgstr "" -#: c-api/buffer.rst:438 +#: c-api/buffer.rst:434 +msgid "" +"void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" +" Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" +" char *pointer = (char*)buf;\n" +" int i;\n" +" for (i = 0; i < ndim; i++) {\n" +" pointer += strides[i] * indices[i];\n" +" if (suboffsets[i] >=0 ) {\n" +" pointer = *((char**)pointer) + suboffsets[i];\n" +" }\n" +" }\n" +" return (void*)pointer;\n" +"}" +msgstr "" + +#: c-api/buffer.rst:449 msgid "Buffer-related functions" msgstr "" -#: c-api/buffer.rst:442 +#: c-api/buffer.rst:453 msgid "" "Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When " "``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` " "will succeed. This function always succeeds." msgstr "" -#: c-api/buffer.rst:449 +#: c-api/buffer.rst:460 msgid "" "Send a request to *exporter* to fill in *view* as specified by *flags*. If " "the exporter cannot provide a buffer of the exact type, it MUST raise :exc:" "`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" -#: c-api/buffer.rst:454 +#: c-api/buffer.rst:465 msgid "" "On success, fill in *view*, set ``view->obj`` to a new reference to " "*exporter* and return 0. In the case of chained buffer providers that " @@ -567,7 +634,7 @@ msgid "" "instead of *exporter* (See :ref:`Buffer Object Structures `)." msgstr "" -#: c-api/buffer.rst:459 +#: c-api/buffer.rst:470 msgid "" "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " "to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:" @@ -575,7 +642,7 @@ msgid "" "`PyBuffer_Release` must be called exactly once." msgstr "" -#: c-api/buffer.rst:467 +#: c-api/buffer.rst:478 msgid "" "Release the buffer *view* and release the :term:`strong reference` (i.e. " "decrement the reference count) to the view's supporting object, ``view-" @@ -583,19 +650,19 @@ msgid "" "used, otherwise reference leaks may occur." msgstr "" -#: c-api/buffer.rst:472 +#: c-api/buffer.rst:483 msgid "" "It is an error to call this function on a buffer that was not obtained via :" "c:func:`PyObject_GetBuffer`." msgstr "" -#: c-api/buffer.rst:478 +#: c-api/buffer.rst:489 msgid "" "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:" "`~Py_buffer.format`. On error, raise an exception and return -1." msgstr "" -#: c-api/buffer.rst:486 +#: c-api/buffer.rst:497 msgid "" "Return ``1`` if the memory defined by the *view* is C-style (*order* is " "``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either " @@ -603,69 +670,69 @@ msgid "" "succeeds." msgstr "" -#: c-api/buffer.rst:493 +#: c-api/buffer.rst:504 msgid "" "Get the memory area pointed to by the *indices* inside the given *view*. " "*indices* must point to an array of ``view->ndim`` indices." msgstr "" -#: c-api/buffer.rst:499 +#: c-api/buffer.rst:510 msgid "" "Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or " "``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on " "success, ``-1`` on error." msgstr "" -#: c-api/buffer.rst:506 +#: c-api/buffer.rst:517 msgid "" "Copy *len* bytes from *src* to its contiguous representation in *buf*. " "*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " "ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" -#: c-api/buffer.rst:510 +#: c-api/buffer.rst:521 msgid "This function fails if *len* != *src->len*." msgstr "" -#: c-api/buffer.rst:515 +#: c-api/buffer.rst:526 msgid "" "Copy data from *src* to *dest* buffer. Can convert between C-style and or " "Fortran-style buffers." msgstr "" -#: c-api/buffer.rst:518 +#: c-api/buffer.rst:529 msgid "``0`` is returned on success, ``-1`` on error." msgstr "" -#: c-api/buffer.rst:522 +#: c-api/buffer.rst:533 msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -#: c-api/buffer.rst:529 +#: c-api/buffer.rst:540 msgid "" "Handle buffer requests for an exporter that wants to expose *buf* of size " "*len* with writability set according to *readonly*. *buf* is interpreted as " "a sequence of unsigned bytes." msgstr "" -#: c-api/buffer.rst:533 +#: c-api/buffer.rst:544 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -#: c-api/buffer.rst:537 +#: c-api/buffer.rst:548 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " "return ``-1``;" msgstr "" -#: c-api/buffer.rst:541 +#: c-api/buffer.rst:552 msgid "" "If this function is used as part of a :ref:`getbufferproc `, " "*exporter* MUST be set to the exporting object and *flags* must be passed " @@ -692,14 +759,14 @@ msgstr "" msgid "PyBufferProcs (C type)" msgstr "" -#: c-api/buffer.rst:294 +#: c-api/buffer.rst:305 msgid "contiguous" msgstr "" -#: c-api/buffer.rst:294 +#: c-api/buffer.rst:305 msgid "C-contiguous" msgstr "" -#: c-api/buffer.rst:294 +#: c-api/buffer.rst:305 msgid "Fortran contiguous" msgstr "" diff --git a/c-api/bytearray.po b/c-api/bytearray.po index fc57d389..fcdf4204 100644 --- a/c-api/bytearray.po +++ b/c-api/bytearray.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -57,44 +58,53 @@ msgid "" "`buffer protocol `." msgstr "" -#: c-api/bytearray.rst:48 -msgid "" -"Create a new bytearray object from *string* and its length, *len*. On " -"failure, ``NULL`` is returned." +#: c-api/bytearray.rst:52 c-api/bytearray.rst:59 +msgid "On failure, return ``NULL`` with an exception set." +msgstr "" + +#: c-api/bytearray.rst:50 +msgid "Create a new bytearray object from *string* and its length, *len*." msgstr "" -#: c-api/bytearray.rst:54 +#: c-api/bytearray.rst:57 msgid "" "Concat bytearrays *a* and *b* and return a new bytearray with the result." msgstr "" -#: c-api/bytearray.rst:59 +#: c-api/bytearray.rst:64 msgid "Return the size of *bytearray* after checking for a ``NULL`` pointer." msgstr "" -#: c-api/bytearray.rst:64 +#: c-api/bytearray.rst:69 msgid "" "Return the contents of *bytearray* as a char array after checking for a " "``NULL`` pointer. The returned array always has an extra null byte appended." msgstr "" -#: c-api/bytearray.rst:71 -msgid "Resize the internal buffer of *bytearray* to *len*." +#: c-api/bytearray.rst:76 +msgid "" +"Resize the internal buffer of *bytearray* to *len*. Failure is a ``-1`` " +"return with an exception set." msgstr "" -#: c-api/bytearray.rst:74 +#: c-api/bytearray.rst:79 +msgid "" +"A negative *len* will now result in an exception being set and -1 returned." +msgstr "" + +#: c-api/bytearray.rst:84 msgid "Macros" msgstr "" -#: c-api/bytearray.rst:76 +#: c-api/bytearray.rst:86 msgid "These macros trade safety for speed and they don't check pointers." msgstr "" -#: c-api/bytearray.rst:80 +#: c-api/bytearray.rst:90 msgid "Similar to :c:func:`PyByteArray_AsString`, but without error checking." msgstr "" -#: c-api/bytearray.rst:85 +#: c-api/bytearray.rst:95 msgid "Similar to :c:func:`PyByteArray_Size`, but without error checking." msgstr "" diff --git a/c-api/bytes.po b/c-api/bytes.po index 80a3d0a2..42873ef1 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -312,17 +313,89 @@ msgid "" msgstr "" #: c-api/bytes.rst:194 +msgid "Similar to ``sep.join(iterable)`` in Python." +msgstr "" + +#: c-api/bytes.rst:196 +msgid "" +"*sep* must be Python :class:`bytes` object. (Note that :c:func:" +"`PyUnicode_Join` accepts ``NULL`` separator and treats it as a space, " +"whereas :c:func:`PyBytes_Join` doesn't accept ``NULL`` separator.)" +msgstr "" + +#: c-api/bytes.rst:201 +msgid "" +"*iterable* must be an iterable object yielding objects that implement the :" +"ref:`buffer protocol `." +msgstr "" + +#: c-api/bytes.rst:204 +msgid "" +"On success, return a new :class:`bytes` object. On error, set an exception " +"and return ``NULL``." +msgstr "" + +#: c-api/bytes.rst:212 +msgid "" +"Resize a bytes object. *newsize* will be the new length of the bytes object. " +"You can think of it as creating a new bytes object and destroying the old " +"one, only more efficiently. Pass the address of an existing bytes object as " +"an lvalue (it may be written into), and the new size desired. On success, " +"*\\*bytes* holds the resized bytes object and ``0`` is returned; the address " +"in *\\*bytes* may differ from its input value. If the reallocation fails, " +"the original bytes object at *\\*bytes* is deallocated, *\\*bytes* is set to " +"``NULL``, :exc:`MemoryError` is set, and ``-1`` is returned." +msgstr "" + +#: c-api/bytes.rst:226 +msgid "" +"Get the string representation of *bytes*. This function is currently used to " +"implement :meth:`!bytes.__repr__` in Python." +msgstr "" + +#: c-api/bytes.rst:229 msgid "" -"A way to resize a bytes object even though it is \"immutable\". Only use " -"this to build up a brand new bytes object; don't use this if the bytes may " -"already be known in other parts of the code. It is an error to call this " -"function if the refcount on the input bytes object is not one. Pass the " -"address of an existing bytes object as an lvalue (it may be written into), " -"and the new size desired. On success, *\\*bytes* holds the resized bytes " -"object and ``0`` is returned; the address in *\\*bytes* may differ from its " -"input value. If the reallocation fails, the original bytes object at " -"*\\*bytes* is deallocated, *\\*bytes* is set to ``NULL``, :exc:`MemoryError` " -"is set, and ``-1`` is returned." +"This function does not do type checking; it is undefined behavior to pass " +"*bytes* as a non-bytes object or ``NULL``." +msgstr "" + +#: c-api/bytes.rst:232 +msgid "" +"If *smartquotes* is true, the representation will use a double-quoted string " +"instead of single-quoted string when single-quotes are present in *bytes*. " +"For example, the byte string ``'Python'`` would be represented as " +"``b\"'Python'\"`` when *smartquotes* is true, or ``b'\\'Python\\''`` when it " +"is false." +msgstr "" + +#: c-api/bytes.rst:238 +msgid "" +"On success, this function returns a :term:`strong reference` to a :class:" +"`str` object containing the representation. On failure, this returns " +"``NULL`` with an exception set." +msgstr "" + +#: c-api/bytes.rst:245 +msgid "" +"Unescape a backslash-escaped string *s*. *s* must not be ``NULL``. *len* " +"must be the size of *s*." +msgstr "" + +#: c-api/bytes.rst:248 +msgid "" +"*errors* must be one of ``\"strict\"``, ``\"replace\"``, or ``\"ignore\"``. " +"If *errors* is ``NULL``, then ``\"strict\"`` is used by default." +msgstr "" + +#: c-api/bytes.rst:251 +msgid "" +"On success, this function returns a :term:`strong reference` to a Python :" +"class:`bytes` object containing the unescaped string. On failure, this " +"function returns ``NULL`` with an exception set." +msgstr "" + +#: c-api/bytes.rst:255 +msgid "*unicode* and *recode_encoding* are now unused." msgstr "" #: c-api/bytes.rst:11 diff --git a/c-api/call.po b/c-api/call.po index 7574569d..3ecb0560 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -35,6 +36,11 @@ msgid "" "callable. The signature of the slot is::" msgstr "" +#: c-api/call.rst:17 +msgid "" +"PyObject *tp_call(PyObject *callable, PyObject *args, PyObject *kwargs);" +msgstr "" + #: c-api/call.rst:19 msgid "" "A call is made using a tuple for the positional arguments and a dict for the " @@ -114,7 +120,7 @@ msgstr "" msgid "*callable* is the object being called." msgstr "" -#: c-api/call.rst:84 +#: c-api/call.rst:83 msgid "" "*args* is a C array consisting of the positional arguments followed by the" msgstr "" @@ -125,7 +131,7 @@ msgid "" "arguments." msgstr "" -#: c-api/call.rst:88 +#: c-api/call.rst:86 msgid "*nargsf* is the number of positional arguments plus possibly the" msgstr "" @@ -135,7 +141,7 @@ msgid "" "positional arguments from *nargsf*, use :c:func:`PyVectorcall_NARGS`." msgstr "" -#: c-api/call.rst:94 +#: c-api/call.rst:90 msgid "*kwnames* is a tuple containing the names of the keyword arguments;" msgstr "" @@ -175,53 +181,45 @@ msgid "" "will usually be most efficient." msgstr "" -#: c-api/call.rst:120 -msgid "" -"In CPython 3.8, the vectorcall API and related functions were available " -"provisionally under names with a leading underscore: " -"``_PyObject_Vectorcall``, ``_Py_TPFLAGS_HAVE_VECTORCALL``, " -"``_PyObject_VectorcallMethod``, ``_PyVectorcall_Function``, " -"``_PyObject_CallOneArg``, ``_PyObject_CallMethodNoArgs``, " -"``_PyObject_CallMethodOneArg``. Additionally, ``PyObject_VectorcallDict`` " -"was available as ``_PyObject_FastCallDict``. The old names are still defined " -"as aliases of the new, non-underscored names." -msgstr "" - -#: c-api/call.rst:132 +#: c-api/call.rst:119 msgid "Recursion Control" msgstr "" -#: c-api/call.rst:134 +#: c-api/call.rst:121 msgid "" "When using *tp_call*, callees do not need to worry about :ref:`recursion " "`: CPython uses :c:func:`Py_EnterRecursiveCall` and :c:func:" "`Py_LeaveRecursiveCall` for calls made using *tp_call*." msgstr "" -#: c-api/call.rst:139 +#: c-api/call.rst:126 msgid "" "For efficiency, this is not the case for calls done using vectorcall: the " "callee should use *Py_EnterRecursiveCall* and *Py_LeaveRecursiveCall* if " "needed." msgstr "" -#: c-api/call.rst:145 +#: c-api/call.rst:132 msgid "Vectorcall Support API" msgstr "" -#: c-api/call.rst:149 +#: c-api/call.rst:136 msgid "" "Given a vectorcall *nargsf* argument, return the actual number of arguments. " "Currently equivalent to::" msgstr "" -#: c-api/call.rst:155 +#: c-api/call.rst:140 +msgid "(Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)" +msgstr "" + +#: c-api/call.rst:142 msgid "" "However, the function ``PyVectorcall_NARGS`` should be used to allow for " "future extensions." msgstr "" -#: c-api/call.rst:162 +#: c-api/call.rst:149 msgid "" "If *op* does not support the vectorcall protocol (either because the type " "does not or because the specific instance does not), return *NULL*. " @@ -229,19 +227,19 @@ msgid "" "function never raises an exception." msgstr "" -#: c-api/call.rst:167 +#: c-api/call.rst:154 msgid "" "This is mostly useful to check whether or not *op* supports vectorcall, " "which can be done by checking ``PyVectorcall_Function(op) != NULL``." msgstr "" -#: c-api/call.rst:174 +#: c-api/call.rst:161 msgid "" "Call *callable*'s :c:type:`vectorcallfunc` with positional and keyword " "arguments given in a tuple and dict, respectively." msgstr "" -#: c-api/call.rst:177 +#: c-api/call.rst:164 msgid "" "This is a specialized function, intended to be put in the :c:member:" "`~PyTypeObject.tp_call` slot or be used in an implementation of ``tp_call``. " @@ -249,11 +247,11 @@ msgid "" "not fall back to ``tp_call``." msgstr "" -#: c-api/call.rst:188 +#: c-api/call.rst:175 msgid "Object Calling API" msgstr "" -#: c-api/call.rst:190 +#: c-api/call.rst:177 msgid "" "Various functions are available for calling a Python object. Each converts " "its arguments to a convention supported by the called object – either " @@ -261,177 +259,177 @@ msgid "" "pick one that best fits the format of data you have available." msgstr "" -#: c-api/call.rst:196 +#: c-api/call.rst:183 msgid "" "The following table summarizes the available functions; please see " "individual documentation for details." msgstr "" -#: c-api/call.rst:200 +#: c-api/call.rst:187 msgid "Function" msgstr "" -#: c-api/call.rst:200 +#: c-api/call.rst:187 msgid "callable" msgstr "" -#: c-api/call.rst:200 +#: c-api/call.rst:187 msgid "args" msgstr "" -#: c-api/call.rst:200 +#: c-api/call.rst:187 msgid "kwargs" msgstr "" -#: c-api/call.rst:202 +#: c-api/call.rst:189 msgid ":c:func:`PyObject_Call`" msgstr "" -#: c-api/call.rst:204 c-api/call.rst:208 c-api/call.rst:214 c-api/call.rst:224 +#: c-api/call.rst:191 c-api/call.rst:195 c-api/call.rst:201 c-api/call.rst:211 msgid "``PyObject *``" msgstr "" -#: c-api/call.rst:202 +#: c-api/call.rst:189 msgid "tuple" msgstr "" -#: c-api/call.rst:224 +#: c-api/call.rst:211 msgid "dict/``NULL``" msgstr "" -#: c-api/call.rst:204 +#: c-api/call.rst:191 msgid ":c:func:`PyObject_CallNoArgs`" msgstr "" -#: c-api/call.rst:206 c-api/call.rst:210 c-api/call.rst:214 c-api/call.rst:218 -#: c-api/call.rst:220 +#: c-api/call.rst:193 c-api/call.rst:197 c-api/call.rst:201 c-api/call.rst:205 +#: c-api/call.rst:207 msgid "---" msgstr "" -#: c-api/call.rst:206 +#: c-api/call.rst:193 msgid ":c:func:`PyObject_CallOneArg`" msgstr "" -#: c-api/call.rst:220 +#: c-api/call.rst:207 msgid "1 object" msgstr "" -#: c-api/call.rst:208 +#: c-api/call.rst:195 msgid ":c:func:`PyObject_CallObject`" msgstr "" -#: c-api/call.rst:208 +#: c-api/call.rst:195 msgid "tuple/``NULL``" msgstr "" -#: c-api/call.rst:210 +#: c-api/call.rst:197 msgid ":c:func:`PyObject_CallFunction`" msgstr "" -#: c-api/call.rst:212 +#: c-api/call.rst:199 msgid "format" msgstr "" -#: c-api/call.rst:212 +#: c-api/call.rst:199 msgid ":c:func:`PyObject_CallMethod`" msgstr "" -#: c-api/call.rst:212 +#: c-api/call.rst:199 msgid "obj + ``char*``" msgstr "" -#: c-api/call.rst:214 +#: c-api/call.rst:201 msgid ":c:func:`PyObject_CallFunctionObjArgs`" msgstr "" -#: c-api/call.rst:216 +#: c-api/call.rst:203 msgid "variadic" msgstr "" -#: c-api/call.rst:216 +#: c-api/call.rst:203 msgid ":c:func:`PyObject_CallMethodObjArgs`" msgstr "" -#: c-api/call.rst:218 c-api/call.rst:220 +#: c-api/call.rst:205 c-api/call.rst:207 msgid "obj + name" msgstr "" -#: c-api/call.rst:218 +#: c-api/call.rst:205 msgid ":c:func:`PyObject_CallMethodNoArgs`" msgstr "" -#: c-api/call.rst:220 +#: c-api/call.rst:207 msgid ":c:func:`PyObject_CallMethodOneArg`" msgstr "" -#: c-api/call.rst:222 +#: c-api/call.rst:209 msgid ":c:func:`PyObject_Vectorcall`" msgstr "" -#: c-api/call.rst:224 c-api/call.rst:226 +#: c-api/call.rst:211 c-api/call.rst:213 msgid "vectorcall" msgstr "" -#: c-api/call.rst:224 +#: c-api/call.rst:211 msgid ":c:func:`PyObject_VectorcallDict`" msgstr "" -#: c-api/call.rst:226 +#: c-api/call.rst:213 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr "" -#: c-api/call.rst:226 +#: c-api/call.rst:213 msgid "arg + name" msgstr "" -#: c-api/call.rst:232 +#: c-api/call.rst:219 msgid "" "Call a callable Python object *callable*, with arguments given by the tuple " "*args*, and named arguments given by the dictionary *kwargs*." msgstr "" -#: c-api/call.rst:235 +#: c-api/call.rst:222 msgid "" "*args* must not be *NULL*; use an empty tuple if no arguments are needed. If " "no named arguments are needed, *kwargs* can be *NULL*." msgstr "" -#: c-api/call.rst:250 c-api/call.rst:272 c-api/call.rst:304 c-api/call.rst:337 -#: c-api/call.rst:358 c-api/call.rst:405 +#: c-api/call.rst:237 c-api/call.rst:259 c-api/call.rst:291 c-api/call.rst:324 +#: c-api/call.rst:345 c-api/call.rst:392 msgid "" "Return the result of the call on success, or raise an exception and return " "*NULL* on failure." msgstr "" -#: c-api/call.rst:241 +#: c-api/call.rst:228 msgid "" "This is the equivalent of the Python expression: ``callable(*args, " "**kwargs)``." msgstr "" -#: c-api/call.rst:247 +#: c-api/call.rst:234 msgid "" "Call a callable Python object *callable* without any arguments. It is the " "most efficient way to call a callable Python object without any argument." msgstr "" -#: c-api/call.rst:258 +#: c-api/call.rst:245 msgid "" "Call a callable Python object *callable* with exactly 1 positional argument " "*arg* and no keyword arguments." msgstr "" -#: c-api/call.rst:269 +#: c-api/call.rst:256 msgid "" "Call a callable Python object *callable*, with arguments given by the tuple " "*args*. If no arguments are needed, then *args* can be *NULL*." msgstr "" -#: c-api/call.rst:287 +#: c-api/call.rst:274 msgid "This is the equivalent of the Python expression: ``callable(*args)``." msgstr "" -#: c-api/call.rst:280 +#: c-api/call.rst:267 msgid "" "Call a callable Python object *callable*, with a variable number of C " "arguments. The C arguments are described using a :c:func:`Py_BuildValue` " @@ -439,57 +437,57 @@ msgid "" "are provided." msgstr "" -#: c-api/call.rst:289 +#: c-api/call.rst:276 msgid "" "Note that if you only pass :c:expr:`PyObject *` args, :c:func:" "`PyObject_CallFunctionObjArgs` is a faster alternative." msgstr "" -#: c-api/call.rst:292 +#: c-api/call.rst:279 msgid "The type of *format* was changed from ``char *``." msgstr "" -#: c-api/call.rst:298 +#: c-api/call.rst:285 msgid "" "Call the method named *name* of object *obj* with a variable number of C " "arguments. The C arguments are described by a :c:func:`Py_BuildValue` " "format string that should produce a tuple." msgstr "" -#: c-api/call.rst:302 +#: c-api/call.rst:289 msgid "The format can be *NULL*, indicating that no arguments are provided." msgstr "" -#: c-api/call.rst:307 +#: c-api/call.rst:294 msgid "" "This is the equivalent of the Python expression: ``obj.name(arg1, " "arg2, ...)``." msgstr "" -#: c-api/call.rst:310 +#: c-api/call.rst:297 msgid "" "Note that if you only pass :c:expr:`PyObject *` args, :c:func:" "`PyObject_CallMethodObjArgs` is a faster alternative." msgstr "" -#: c-api/call.rst:313 +#: c-api/call.rst:300 msgid "The types of *name* and *format* were changed from ``char *``." msgstr "" -#: c-api/call.rst:319 +#: c-api/call.rst:306 msgid "" "Call a callable Python object *callable*, with a variable number of :c:expr:" "`PyObject *` arguments. The arguments are provided as a variable number of " "parameters followed by *NULL*." msgstr "" -#: c-api/call.rst:326 +#: c-api/call.rst:313 msgid "" "This is the equivalent of the Python expression: ``callable(arg1, " "arg2, ...)``." msgstr "" -#: c-api/call.rst:332 +#: c-api/call.rst:319 msgid "" "Call a method of the Python object *obj*, where the name of the method is " "given as a Python string object in *name*. It is called with a variable " @@ -497,34 +495,34 @@ msgid "" "variable number of parameters followed by *NULL*." msgstr "" -#: c-api/call.rst:343 +#: c-api/call.rst:330 msgid "" "Call a method of the Python object *obj* without arguments, where the name " "of the method is given as a Python string object in *name*." msgstr "" -#: c-api/call.rst:354 +#: c-api/call.rst:341 msgid "" "Call a method of the Python object *obj* with a single positional argument " "*arg*, where the name of the method is given as a Python string object in " "*name*." msgstr "" -#: c-api/call.rst:366 +#: c-api/call.rst:353 msgid "" "Call a callable Python object *callable*. The arguments are the same as for :" "c:type:`vectorcallfunc`. If *callable* supports vectorcall_, this directly " "calls the vectorcall function stored in *callable*." msgstr "" -#: c-api/call.rst:378 +#: c-api/call.rst:365 msgid "" "Call *callable* with positional arguments passed exactly as in the " "vectorcall_ protocol, but with keyword arguments passed as a dictionary " "*kwdict*. The *args* array contains only the positional arguments." msgstr "" -#: c-api/call.rst:382 +#: c-api/call.rst:369 msgid "" "Regardless of which protocol is used internally, a conversion of arguments " "needs to be done. Therefore, this function should only be used if the caller " @@ -532,7 +530,7 @@ msgid "" "tuple for the positional arguments." msgstr "" -#: c-api/call.rst:392 +#: c-api/call.rst:379 msgid "" "Call a method using the vectorcall calling convention. The name of the " "method is given as a Python string *name*. The object whose method is called " @@ -544,17 +542,17 @@ msgid "" "`PyObject_Vectorcall`." msgstr "" -#: c-api/call.rst:401 +#: c-api/call.rst:388 msgid "" "If the object has the :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` feature, this " "will call the unbound method object with the full *args* vector as arguments." msgstr "" -#: c-api/call.rst:412 +#: c-api/call.rst:399 msgid "Call Support API" msgstr "" -#: c-api/call.rst:416 +#: c-api/call.rst:403 msgid "" "Determine if the object *o* is callable. Return ``1`` if the object is " "callable and ``0`` otherwise. This function always succeeds." diff --git a/c-api/capsule.po b/c-api/capsule.po index 3e2f66df..5080e8a4 100644 --- a/c-api/capsule.po +++ b/c-api/capsule.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -28,7 +29,7 @@ msgstr "" #: c-api/capsule.rst:17 msgid "" "This subtype of :c:type:`PyObject` represents an opaque value, useful for C " -"extension modules who need to pass an opaque value (as a :c:expr:`void*` " +"extension modules which need to pass an opaque value (as a :c:expr:`void*` " "pointer) through Python code to other C code. It is often used to make a C " "function pointer defined in one module available to other modules, so the " "regular import mechanism can be used to access C APIs defined in dynamically " @@ -36,58 +37,68 @@ msgid "" msgstr "" #: c-api/capsule.rst:27 +msgid "" +"The type object corresponding to capsule objects. This is the same object " +"as :class:`types.CapsuleType` in the Python layer." +msgstr "" + +#: c-api/capsule.rst:33 msgid "The type of a destructor callback for a capsule. Defined as::" msgstr "" -#: c-api/capsule.rst:31 +#: c-api/capsule.rst:35 +msgid "typedef void (*PyCapsule_Destructor)(PyObject *);" +msgstr "" + +#: c-api/capsule.rst:37 msgid "" "See :c:func:`PyCapsule_New` for the semantics of PyCapsule_Destructor " "callbacks." msgstr "" -#: c-api/capsule.rst:37 +#: c-api/capsule.rst:43 msgid "" "Return true if its argument is a :c:type:`PyCapsule`. This function always " "succeeds." msgstr "" -#: c-api/capsule.rst:43 +#: c-api/capsule.rst:49 msgid "" "Create a :c:type:`PyCapsule` encapsulating the *pointer*. The *pointer* " "argument may not be ``NULL``." msgstr "" -#: c-api/capsule.rst:46 +#: c-api/capsule.rst:52 msgid "On failure, set an exception and return ``NULL``." msgstr "" -#: c-api/capsule.rst:48 +#: c-api/capsule.rst:54 msgid "" "The *name* string may either be ``NULL`` or a pointer to a valid C string. " "If non-``NULL``, this string must outlive the capsule. (Though it is " "permitted to free it inside the *destructor*.)" msgstr "" -#: c-api/capsule.rst:52 +#: c-api/capsule.rst:58 msgid "" "If the *destructor* argument is not ``NULL``, it will be called with the " "capsule as its argument when it is destroyed." msgstr "" -#: c-api/capsule.rst:55 +#: c-api/capsule.rst:61 msgid "" "If this capsule will be stored as an attribute of a module, the *name* " "should be specified as ``modulename.attributename``. This will enable other " "modules to import the capsule using :c:func:`PyCapsule_Import`." msgstr "" -#: c-api/capsule.rst:62 +#: c-api/capsule.rst:68 msgid "" "Retrieve the *pointer* stored in the capsule. On failure, set an exception " "and return ``NULL``." msgstr "" -#: c-api/capsule.rst:65 +#: c-api/capsule.rst:71 msgid "" "The *name* parameter must compare exactly to the name stored in the capsule. " "If the name stored in the capsule is ``NULL``, the *name* passed in must " @@ -95,46 +106,46 @@ msgid "" "capsule names." msgstr "" -#: c-api/capsule.rst:73 +#: c-api/capsule.rst:79 msgid "" "Return the current destructor stored in the capsule. On failure, set an " "exception and return ``NULL``." msgstr "" -#: c-api/capsule.rst:76 +#: c-api/capsule.rst:82 msgid "" "It is legal for a capsule to have a ``NULL`` destructor. This makes a " "``NULL`` return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :" "c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: c-api/capsule.rst:83 +#: c-api/capsule.rst:89 msgid "" "Return the current context stored in the capsule. On failure, set an " "exception and return ``NULL``." msgstr "" -#: c-api/capsule.rst:86 +#: c-api/capsule.rst:92 msgid "" "It is legal for a capsule to have a ``NULL`` context. This makes a ``NULL`` " "return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:" "`PyErr_Occurred` to disambiguate." msgstr "" -#: c-api/capsule.rst:93 +#: c-api/capsule.rst:99 msgid "" "Return the current name stored in the capsule. On failure, set an exception " "and return ``NULL``." msgstr "" -#: c-api/capsule.rst:96 +#: c-api/capsule.rst:102 msgid "" "It is legal for a capsule to have a ``NULL`` name. This makes a ``NULL`` " "return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or :c:func:" "`PyErr_Occurred` to disambiguate." msgstr "" -#: c-api/capsule.rst:103 +#: c-api/capsule.rst:109 msgid "" "Import a pointer to a C object from a capsule attribute in a module. The " "*name* parameter should specify the full name to the attribute, as in " @@ -142,17 +153,31 @@ msgid "" "string exactly." msgstr "" -#: c-api/capsule.rst:108 +#: c-api/capsule.rst:114 +msgid "" +"This function splits *name* on the ``.`` character, and imports the first " +"element. It then processes further elements using attribute lookups." +msgstr "" + +#: c-api/capsule.rst:117 msgid "" "Return the capsule's internal *pointer* on success. On failure, set an " "exception and return ``NULL``." msgstr "" -#: c-api/capsule.rst:111 +#: c-api/capsule.rst:122 +msgid "" +"If *name* points to an attribute of some submodule or subpackage, this " +"submodule or subpackage must be previously imported using other means (for " +"example, by using :c:func:`PyImport_ImportModule`) for the attribute lookups " +"to succeed." +msgstr "" + +#: c-api/capsule.rst:127 msgid "*no_block* has no effect anymore." msgstr "" -#: c-api/capsule.rst:117 +#: c-api/capsule.rst:133 msgid "" "Determines whether or not *capsule* is a valid capsule. A valid capsule is " "non-``NULL``, passes :c:func:`PyCapsule_CheckExact`, has a non-``NULL`` " @@ -161,40 +186,40 @@ msgid "" "compared.)" msgstr "" -#: c-api/capsule.rst:123 +#: c-api/capsule.rst:139 msgid "" "In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls " "to any of the accessors (any function starting with ``PyCapsule_Get``) are " "guaranteed to succeed." msgstr "" -#: c-api/capsule.rst:127 +#: c-api/capsule.rst:143 msgid "" "Return a nonzero value if the object is valid and matches the name passed " "in. Return ``0`` otherwise. This function will not fail." msgstr "" -#: c-api/capsule.rst:133 +#: c-api/capsule.rst:149 msgid "Set the context pointer inside *capsule* to *context*." msgstr "" -#: c-api/capsule.rst:142 c-api/capsule.rst:159 +#: c-api/capsule.rst:158 c-api/capsule.rst:175 msgid "" "Return ``0`` on success. Return nonzero and set an exception on failure." msgstr "" -#: c-api/capsule.rst:140 +#: c-api/capsule.rst:156 msgid "Set the destructor inside *capsule* to *destructor*." msgstr "" -#: c-api/capsule.rst:147 +#: c-api/capsule.rst:163 msgid "" "Set the name inside *capsule* to *name*. If non-``NULL``, the name must " "outlive the capsule. If the previous *name* stored in the capsule was not " "``NULL``, no attempt is made to free it." msgstr "" -#: c-api/capsule.rst:156 +#: c-api/capsule.rst:172 msgid "" "Set the void pointer inside *capsule* to *pointer*. The pointer may not be " "``NULL``." diff --git a/c-api/cell.po b/c-api/cell.po index b32d87fc..e8041986 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -24,7 +25,7 @@ msgstr "" msgid "" "\"Cell\" objects are used to implement variables referenced by multiple " "scopes. For each such variable, a cell object is created to store the value; " -"the local variables of each stack frame that references the value contains a " +"the local variables of each stack frame that references the value contain a " "reference to the cells from outer scopes which also use that variable. When " "the value is accessed, the value contained in the cell is used instead of " "the cell object itself. This de-referencing of the cell object requires " @@ -53,24 +54,31 @@ msgid "" msgstr "" #: c-api/cell.rst:42 -msgid "Return the contents of the cell *cell*." +msgid "" +"Return the contents of the cell *cell*, which can be ``NULL``. If *cell* is " +"not a cell object, returns ``NULL`` with an exception set." msgstr "" -#: c-api/cell.rst:47 +#: c-api/cell.rst:48 msgid "" "Return the contents of the cell *cell*, but without checking that *cell* is " "non-``NULL`` and a cell object." msgstr "" -#: c-api/cell.rst:53 +#: c-api/cell.rst:54 msgid "" "Set the contents of the cell object *cell* to *value*. This releases the " "reference to any current content of the cell. *value* may be ``NULL``. " -"*cell* must be non-``NULL``; if it is not a cell object, ``-1`` will be " -"returned. On success, ``0`` will be returned." +"*cell* must be non-``NULL``." +msgstr "" + +#: c-api/cell.rst:58 +msgid "" +"On success, return ``0``. If *cell* is not a cell object, set an exception " +"and return ``-1``." msgstr "" -#: c-api/cell.rst:61 +#: c-api/cell.rst:64 msgid "" "Sets the value of the cell object *cell* to *value*. No reference counts " "are adjusted, and no checks are made for safety; *cell* must be non-``NULL`` " diff --git a/c-api/code.po b/c-api/code.po index c06cf0fe..ffec6724 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -46,117 +47,127 @@ msgid "" msgstr "" #: c-api/code.rst:35 -msgid "Return the number of free variables in a code object." +msgid "" +"Return the number of :term:`free (closure) variables ` in " +"a code object." +msgstr "" + +#: c-api/code.rst:40 +msgid "" +"Return the position of the first :term:`free (closure) variable ` in a code object." msgstr "" -#: c-api/code.rst:39 -msgid "Return the position of the first free variable in a code object." +#: c-api/code.rst:45 +msgid "" +"Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`. The " +"old name is deprecated, but will remain available until the signature " +"changes again." msgstr "" -#: c-api/code.rst:43 +#: c-api/code.rst:51 msgid "" "Return a new code object. If you need a dummy code object to create a " "frame, use :c:func:`PyCode_NewEmpty` instead." msgstr "" -#: c-api/code.rst:46 +#: c-api/code.rst:54 msgid "" "Since the definition of the bytecode changes often, calling :c:func:" "`PyUnstable_Code_New` directly can bind you to a precise Python version." msgstr "" -#: c-api/code.rst:49 +#: c-api/code.rst:57 msgid "" "The many arguments of this function are inter-dependent in complex ways, " "meaning that subtle changes to values are likely to result in incorrect " "execution or VM crashes. Use this function only with extreme care." msgstr "" -#: c-api/code.rst:53 +#: c-api/code.rst:61 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "" -#: c-api/code.rst:60 +#: c-api/code.rst:68 msgid "" "Renamed from ``PyCode_New`` as part of :ref:`unstable-c-api`. The old name " "is deprecated, but will remain available until the signature changes again." msgstr "" -#: c-api/code.rst:66 +#: c-api/code.rst:74 msgid "" "Similar to :c:func:`PyUnstable_Code_New`, but with an extra " "\"posonlyargcount\" for positional-only arguments. The same caveats that " "apply to ``PyUnstable_Code_New`` also apply to this function." msgstr "" -#: c-api/code.rst:71 +#: c-api/code.rst:79 msgid "as ``PyCode_NewWithPosOnlyArgs``" msgstr "" -#: c-api/code.rst:73 +#: c-api/code.rst:81 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "" -#: c-api/code.rst:78 +#: c-api/code.rst:86 msgid "" "Renamed to ``PyUnstable_Code_NewWithPosOnlyArgs``. The old name is " "deprecated, but will remain available until the signature changes again." msgstr "" -#: c-api/code.rst:84 +#: c-api/code.rst:92 msgid "" "Return a new empty code object with the specified filename, function name, " "and first line number. The resulting code object will raise an ``Exception`` " "if executed." msgstr "" -#: c-api/code.rst:90 +#: c-api/code.rst:98 msgid "" "Return the line number of the instruction that occurs on or before " "``byte_offset`` and ends after it. If you just need the line number of a " "frame, use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" -#: c-api/code.rst:93 +#: c-api/code.rst:101 msgid "" -"For efficiently iterating over the line numbers in a code object, use `the " -"API described in PEP 626 `_." +"For efficiently iterating over the line numbers in a code object, use :pep:" +"`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." msgstr "" -#: c-api/code.rst:98 +#: c-api/code.rst:106 msgid "" "Sets the passed ``int`` pointers to the source code line and column numbers " "for the instruction at ``byte_offset``. Sets the value to ``0`` when " "information is not available for any particular element." msgstr "" -#: c-api/code.rst:102 +#: c-api/code.rst:110 msgid "Returns ``1`` if the function succeeds and 0 otherwise." msgstr "" -#: c-api/code.rst:108 +#: c-api/code.rst:116 msgid "" "Equivalent to the Python code ``getattr(co, 'co_code')``. Returns a strong " "reference to a :c:type:`PyBytesObject` representing the bytecode in a code " "object. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: c-api/code.rst:113 +#: c-api/code.rst:121 msgid "" "This ``PyBytesObject`` may be created on-demand by the interpreter and does " "not necessarily represent the bytecode actually executed by CPython. The " "primary use case for this function is debuggers and profilers." msgstr "" -#: c-api/code.rst:121 +#: c-api/code.rst:129 msgid "" "Equivalent to the Python code ``getattr(co, 'co_varnames')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " "variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: c-api/code.rst:130 +#: c-api/code.rst:138 msgid "" "Equivalent to the Python code ``getattr(co, 'co_cellvars')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " @@ -164,14 +175,15 @@ msgid "" "returned and an exception is raised." msgstr "" -#: c-api/code.rst:139 +#: c-api/code.rst:147 msgid "" "Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new " -"reference to a :c:type:`PyTupleObject` containing the names of the free " -"variables. On error, ``NULL`` is returned and an exception is raised." +"reference to a :c:type:`PyTupleObject` containing the names of the :term:" +"`free (closure) variables `. On error, ``NULL`` is " +"returned and an exception is raised." msgstr "" -#: c-api/code.rst:147 +#: c-api/code.rst:156 msgid "" "Register *callback* as a code object watcher for the current interpreter. " "Return an ID which may be passed to :c:func:`PyCode_ClearWatcher`. In case " @@ -179,7 +191,7 @@ msgid "" "exception." msgstr "" -#: c-api/code.rst:156 +#: c-api/code.rst:165 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyCode_AddWatcher` for the current interpreter. Return ``0`` on success, or " @@ -187,25 +199,25 @@ msgid "" "never registered.)" msgstr "" -#: c-api/code.rst:165 +#: c-api/code.rst:174 msgid "" "Enumeration of possible code object watcher events: - " "``PY_CODE_EVENT_CREATE`` - ``PY_CODE_EVENT_DESTROY``" msgstr "" -#: c-api/code.rst:173 +#: c-api/code.rst:182 msgid "Type of a code object watcher callback function." msgstr "" -#: c-api/code.rst:175 +#: c-api/code.rst:184 msgid "" "If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked after " -"`co` has been fully initialized. Otherwise, the callback is invoked before " +"*co* has been fully initialized. Otherwise, the callback is invoked before " "the destruction of *co* takes place, so the prior state of *co* can be " "inspected." msgstr "" -#: c-api/code.rst:180 +#: c-api/code.rst:189 msgid "" "If *event* is ``PY_CODE_EVENT_DESTROY``, taking a reference in the callback " "to the about-to-be-destroyed code object will resurrect it and prevent it " @@ -213,7 +225,7 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: c-api/code.rst:185 +#: c-api/code.rst:194 msgid "" "Users of this API should not rely on internal runtime implementation " "details. Such details may include, but are not limited to, the exact order " @@ -223,14 +235,14 @@ msgid "" "the Python code being executed." msgstr "" -#: c-api/code.rst:192 +#: c-api/code.rst:201 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: c-api/code.rst:196 +#: c-api/code.rst:205 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -239,85 +251,205 @@ msgid "" "it before returning." msgstr "" -#: c-api/code.rst:206 +#: c-api/code.rst:216 +msgid "This is a :term:`soft deprecated` function that does nothing." +msgstr "" + +#: c-api/code.rst:218 +msgid "" +"Prior to Python 3.10, this function would perform basic optimizations to a " +"code object." +msgstr "" + +#: c-api/code.rst:221 +msgid "This function now does nothing." +msgstr "" + +#: c-api/code.rst:228 +msgid "Code Object Flags" +msgstr "" + +#: c-api/code.rst:230 +msgid "" +"Code objects contain a bit-field of flags, which can be retrieved as the :" +"attr:`~codeobject.co_flags` Python attribute (for example using :c:func:" +"`PyObject_GetAttrString`), and set using a *flags* argument to :c:func:" +"`PyUnstable_Code_New` and similar functions." +msgstr "" + +#: c-api/code.rst:235 +msgid "" +"Flags whose names start with ``CO_FUTURE_`` correspond to features normally " +"selectable by :ref:`future statements `. These flags can be used in :" +"c:member:`PyCompilerFlags.cf_flags`. Note that many ``CO_FUTURE_`` flags are " +"mandatory in current versions of Python, and setting them has no effect." +msgstr "" + +#: c-api/code.rst:241 +msgid "" +"The following flags are available. For their meaning, see the linked " +"documentation of their Python equivalents." +msgstr "" + +#: c-api/code.rst:249 +msgid "Flag" +msgstr "" + +#: c-api/code.rst:250 +msgid "Meaning" +msgstr "" + +#: c-api/code.rst:252 +msgid ":py:data:`inspect.CO_OPTIMIZED`" +msgstr "" + +#: c-api/code.rst:254 +msgid ":py:data:`inspect.CO_NEWLOCALS`" +msgstr "" + +#: c-api/code.rst:256 +msgid ":py:data:`inspect.CO_VARARGS`" +msgstr "" + +#: c-api/code.rst:258 +msgid ":py:data:`inspect.CO_VARKEYWORDS`" +msgstr "" + +#: c-api/code.rst:260 +msgid ":py:data:`inspect.CO_NESTED`" +msgstr "" + +#: c-api/code.rst:262 +msgid ":py:data:`inspect.CO_GENERATOR`" +msgstr "" + +#: c-api/code.rst:264 +msgid ":py:data:`inspect.CO_COROUTINE`" +msgstr "" + +#: c-api/code.rst:266 +msgid ":py:data:`inspect.CO_ITERABLE_COROUTINE`" +msgstr "" + +#: c-api/code.rst:268 +msgid ":py:data:`inspect.CO_ASYNC_GENERATOR`" +msgstr "" + +#: c-api/code.rst:270 +msgid ":py:data:`inspect.CO_HAS_DOCSTRING`" +msgstr "" + +#: c-api/code.rst:272 +msgid ":py:data:`inspect.CO_METHOD`" +msgstr "" + +#: c-api/code.rst:275 +msgid "no effect (:py:data:`__future__.division`)" +msgstr "" + +#: c-api/code.rst:277 +msgid "no effect (:py:data:`__future__.absolute_import`)" +msgstr "" + +#: c-api/code.rst:279 +msgid "no effect (:py:data:`__future__.with_statement`)" +msgstr "" + +#: c-api/code.rst:281 +msgid "no effect (:py:data:`__future__.print_function`)" +msgstr "" + +#: c-api/code.rst:283 +msgid "no effect (:py:data:`__future__.unicode_literals`)" +msgstr "" + +#: c-api/code.rst:285 +msgid "no effect (:py:data:`__future__.generator_stop`)" +msgstr "" + +#: c-api/code.rst:287 +msgid ":py:data:`__future__.annotations`" +msgstr "" + +#: c-api/code.rst:291 msgid "Extra information" msgstr "" -#: c-api/code.rst:208 +#: c-api/code.rst:293 msgid "" "To support low-level extensions to frame evaluation, such as external just-" "in-time compilers, it is possible to attach arbitrary extra data to code " "objects." msgstr "" -#: c-api/code.rst:212 +#: c-api/code.rst:297 msgid "" "These functions are part of the unstable C API tier: this functionality is a " "CPython implementation detail, and the API may change without deprecation " "warnings." msgstr "" -#: c-api/code.rst:218 -msgid "Return a new an opaque index value used to adding data to code objects." +#: c-api/code.rst:303 +msgid "Return a new opaque index value used to adding data to code objects." msgstr "" -#: c-api/code.rst:220 +#: c-api/code.rst:305 msgid "" "You generally call this function once (per interpreter) and use the result " "with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate data on " "individual code objects." msgstr "" -#: c-api/code.rst:224 +#: c-api/code.rst:309 msgid "" "If *free* is not ``NULL``: when a code object is deallocated, *free* will be " "called on non-``NULL`` data stored under the new index. Use :c:func:" "`Py_DecRef` when storing :c:type:`PyObject`." msgstr "" -#: c-api/code.rst:230 +#: c-api/code.rst:315 msgid "as ``_PyEval_RequestCodeExtraIndex``" msgstr "" -#: c-api/code.rst:234 +#: c-api/code.rst:319 msgid "" "Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name " "is deprecated, but will be available until the API changes." msgstr "" -#: c-api/code.rst:240 +#: c-api/code.rst:325 msgid "" "Set *extra* to the extra data stored under the given index. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: c-api/code.rst:243 +#: c-api/code.rst:328 msgid "" "If no data was set under the index, set *extra* to ``NULL`` and return 0 " "without setting an exception." msgstr "" -#: c-api/code.rst:248 +#: c-api/code.rst:333 msgid "as ``_PyCode_GetExtra``" msgstr "" -#: c-api/code.rst:252 +#: c-api/code.rst:337 msgid "" "Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, " "but will be available until the API changes." msgstr "" -#: c-api/code.rst:258 +#: c-api/code.rst:343 msgid "" "Set the extra data stored under the given index to *extra*. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: c-api/code.rst:263 +#: c-api/code.rst:348 msgid "as ``_PyCode_SetExtra``" msgstr "" -#: c-api/code.rst:267 +#: c-api/code.rst:352 msgid "" "Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, " "but will be available until the API changes." @@ -335,22 +467,22 @@ msgstr "" msgid "code object" msgstr "" -#: c-api/code.rst:56 +#: c-api/code.rst:64 msgid "PyCode_New (C function)" msgstr "" -#: c-api/code.rst:69 +#: c-api/code.rst:77 msgid "PyCode_NewWithPosOnlyArgs (C function)" msgstr "" -#: c-api/code.rst:228 +#: c-api/code.rst:313 msgid "_PyEval_RequestCodeExtraIndex (C function)" msgstr "" -#: c-api/code.rst:246 +#: c-api/code.rst:331 msgid "_PyCode_GetExtra (C function)" msgstr "" -#: c-api/code.rst:261 +#: c-api/code.rst:346 msgid "_PyCode_SetExtra (C function)" msgstr "" diff --git a/c-api/codec.po b/c-api/codec.po index c914c599..aa20f1c8 100644 --- a/c-api/codec.po +++ b/c-api/codec.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -26,8 +27,9 @@ msgstr "" #: c-api/codec.rst:10 msgid "" -"As side effect, this tries to load the :mod:`!encodings` package, if not yet " -"done, to make sure that it is always first in the list of search functions." +"As a side effect, this tries to load the :mod:`!encodings` package, if not " +"yet done, to make sure that it is always first in the list of search " +"functions." msgstr "" #: c-api/codec.rst:15 @@ -64,7 +66,7 @@ msgid "" "*object* is passed through the decoder function found for the given " "*encoding* using the error handling method defined by *errors*. *errors* " "may be ``NULL`` to use the default method defined for the codec. Raises a :" -"exc:`LookupError` if no encoder can be found." +"exc:`LookupError` if no decoder can be found." msgstr "" #: c-api/codec.rst:46 @@ -170,3 +172,13 @@ msgstr "" #: c-api/codec.rst:129 msgid "Replace the unicode encode error with ``\\N{...}`` escapes." msgstr "" + +#: c-api/codec.rst:135 +msgid "Codec utility variables" +msgstr "" + +#: c-api/codec.rst:139 +msgid "" +"A string constant containing the lowercase hexadecimal digits: " +"``\"0123456789abcdef\"``." +msgstr "" diff --git a/c-api/complex.po b/c-api/complex.po index 4497cf24..4190bd28 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -44,117 +45,168 @@ msgid "" "The C structure which corresponds to the value portion of a Python complex " "number object. Most of the functions for dealing with complex number " "objects use structures of this type as input or output values, as " -"appropriate. It is defined as::" +"appropriate." msgstr "" -#: c-api/complex.rst:39 +#: c-api/complex.rst:33 +msgid "The structure is defined as::" +msgstr "" + +#: c-api/complex.rst:35 +msgid "" +"typedef struct {\n" +" double real;\n" +" double imag;\n" +"} Py_complex;" +msgstr "" + +#: c-api/complex.rst:43 msgid "" "Return the sum of two complex numbers, using the C :c:type:`Py_complex` " "representation." msgstr "" -#: c-api/complex.rst:45 +#: c-api/complex.rst:49 msgid "" "Return the difference between two complex numbers, using the C :c:type:" "`Py_complex` representation." msgstr "" -#: c-api/complex.rst:51 +#: c-api/complex.rst:55 msgid "" "Return the negation of the complex number *num*, using the C :c:type:" "`Py_complex` representation." msgstr "" -#: c-api/complex.rst:57 +#: c-api/complex.rst:61 msgid "" "Return the product of two complex numbers, using the C :c:type:`Py_complex` " "representation." msgstr "" -#: c-api/complex.rst:63 +#: c-api/complex.rst:67 msgid "" "Return the quotient of two complex numbers, using the C :c:type:`Py_complex` " "representation." msgstr "" -#: c-api/complex.rst:66 +#: c-api/complex.rst:70 msgid "" "If *divisor* is null, this method returns zero and sets :c:data:`errno` to :" "c:macro:`!EDOM`." msgstr "" -#: c-api/complex.rst:72 +#: c-api/complex.rst:76 msgid "" "Return the exponentiation of *num* by *exp*, using the C :c:type:" "`Py_complex` representation." msgstr "" -#: c-api/complex.rst:75 +#: c-api/complex.rst:79 msgid "" "If *num* is null and *exp* is not a positive real number, this method " "returns zero and sets :c:data:`errno` to :c:macro:`!EDOM`." msgstr "" -#: c-api/complex.rst:80 +#: c-api/complex.rst:82 +msgid "Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows." +msgstr "" + +#: c-api/complex.rst:86 msgid "Complex Numbers as Python Objects" msgstr "" -#: c-api/complex.rst:85 +#: c-api/complex.rst:91 msgid "" "This subtype of :c:type:`PyObject` represents a Python complex number object." msgstr "" -#: c-api/complex.rst:90 +#: c-api/complex.rst:96 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python complex number " "type. It is the same object as :class:`complex` in the Python layer." msgstr "" -#: c-api/complex.rst:96 +#: c-api/complex.rst:102 msgid "" "Return true if its argument is a :c:type:`PyComplexObject` or a subtype of :" "c:type:`PyComplexObject`. This function always succeeds." msgstr "" -#: c-api/complex.rst:102 +#: c-api/complex.rst:108 msgid "" "Return true if its argument is a :c:type:`PyComplexObject`, but not a " "subtype of :c:type:`PyComplexObject`. This function always succeeds." msgstr "" -#: c-api/complex.rst:108 +#: c-api/complex.rst:114 msgid "" "Create a new Python complex number object from a C :c:type:`Py_complex` " -"value." +"value. Return ``NULL`` with an exception set on error." msgstr "" -#: c-api/complex.rst:113 -msgid "Return a new :c:type:`PyComplexObject` object from *real* and *imag*." +#: c-api/complex.rst:120 +msgid "" +"Return a new :c:type:`PyComplexObject` object from *real* and *imag*. Return " +"``NULL`` with an exception set on error." msgstr "" -#: c-api/complex.rst:118 +#: c-api/complex.rst:126 msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "" -#: c-api/complex.rst:123 +#: c-api/complex.rst:128 +msgid "" +"If *op* is not a Python complex number object but has a :meth:`~object." +"__complex__` method, this method will first be called to convert *op* to a " +"Python complex number object. If :meth:`!__complex__` is not defined then " +"it falls back to call :c:func:`PyFloat_AsDouble` and returns its result." +msgstr "" + +#: c-api/complex.rst:150 +msgid "" +"Upon failure, this method returns ``-1.0`` with an exception set, so one " +"should call :c:func:`PyErr_Occurred` to check for errors." +msgstr "" + +#: c-api/complex.rst:153 +msgid "Use :meth:`~object.__complex__` if available." +msgstr "" + +#: c-api/complex.rst:142 msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "" -#: c-api/complex.rst:128 +#: c-api/complex.rst:144 +msgid "" +"If *op* is not a Python complex number object but has a :meth:`~object." +"__complex__` method, this method will first be called to convert *op* to a " +"Python complex number object. If :meth:`!__complex__` is not defined then " +"it falls back to call :c:func:`PyFloat_AsDouble` and returns ``0.0`` on " +"success." +msgstr "" + +#: c-api/complex.rst:158 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." msgstr "" -#: c-api/complex.rst:130 +#: c-api/complex.rst:160 msgid "" "If *op* is not a Python complex number object but has a :meth:`~object." "__complex__` method, this method will first be called to convert *op* to a " "Python complex number object. If :meth:`!__complex__` is not defined then " "it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " -"defined then it falls back to :meth:`~object.__index__`. Upon failure, this " -"method returns ``-1.0`` as a real value." +"defined then it falls back to :meth:`~object.__index__`." +msgstr "" + +#: c-api/complex.rst:166 +msgid "" +"Upon failure, this method returns :c:type:`Py_complex` with :c:member:" +"`~Py_complex.real` set to ``-1.0`` and with an exception set, so one should " +"call :c:func:`PyErr_Occurred` to check for errors." msgstr "" -#: c-api/complex.rst:137 +#: c-api/complex.rst:170 msgid "Use :meth:`~object.__index__` if available." msgstr "" diff --git a/c-api/concrete.po b/c-api/concrete.po index 982c836e..77f7faee 100644 --- a/c-api/concrete.po +++ b/c-api/concrete.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -75,6 +76,10 @@ msgstr "" msgid "Other Objects" msgstr "" +#: c-api/concrete.rst:123 +msgid "C API for extension modules" +msgstr "" + #: c-api/concrete.rst:58 c-api/concrete.rst:80 msgid "object" msgstr "" diff --git a/c-api/contextvars.po b/c-api/contextvars.po index b03b40c0..d88d3a11 100644 --- a/c-api/contextvars.po +++ b/c-api/contextvars.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -27,6 +28,15 @@ msgid "" "`PyContext`, :c:type:`PyContextVar`, and :c:type:`PyContextToken`, e.g.::" msgstr "" +#: c-api/contextvars.rst:20 +msgid "" +"// in 3.7.0:\n" +"PyContext *PyContext_New(void);\n" +"\n" +"// in 3.7.1+:\n" +"PyObject *PyContext_New(void);" +msgstr "" + #: c-api/contextvars.rst:26 msgid "See :issue:`34762` for more details." msgstr "" @@ -119,11 +129,61 @@ msgid "" "error." msgstr "" -#: c-api/contextvars.rst:105 +#: c-api/contextvars.rst:106 +msgid "" +"Register *callback* as a context object watcher for the current interpreter. " +"Return an ID which may be passed to :c:func:`PyContext_ClearWatcher`. In " +"case of error (e.g. no more watcher IDs available), return ``-1`` and set an " +"exception." +msgstr "" + +#: c-api/contextvars.rst:115 +msgid "" +"Clear watcher identified by *watcher_id* previously returned from :c:func:" +"`PyContext_AddWatcher` for the current interpreter. Return ``0`` on success, " +"or ``-1`` and set an exception on error (e.g. if the given *watcher_id* was " +"never registered.)" +msgstr "" + +#: c-api/contextvars.rst:124 +msgid "Enumeration of possible context object watcher events:" +msgstr "" + +#: c-api/contextvars.rst:126 +msgid "" +"``Py_CONTEXT_SWITCHED``: The :term:`current context` has switched to a " +"different context. The object passed to the watch callback is the now-" +"current :class:`contextvars.Context` object, or None if no context is " +"current." +msgstr "" + +#: c-api/contextvars.rst:135 +msgid "" +"Context object watcher callback function. The object passed to the callback " +"is event-specific; see :c:type:`PyContextEvent` for details." +msgstr "" + +#: c-api/contextvars.rst:138 +msgid "" +"If the callback returns with an exception set, it must return ``-1``; this " +"exception will be printed as an unraisable exception using :c:func:" +"`PyErr_FormatUnraisable`. Otherwise it should return ``0``." +msgstr "" + +#: c-api/contextvars.rst:142 +msgid "" +"There may already be a pending exception set on entry to the callback. In " +"this case, the callback should return ``0`` with the same exception still " +"set. This means the callback may not call any other API that can set an " +"exception unless it saves and clears the exception state first, and restores " +"it before returning." +msgstr "" + +#: c-api/contextvars.rst:151 msgid "Context variable functions:" msgstr "" -#: c-api/contextvars.rst:109 +#: c-api/contextvars.rst:155 msgid "" "Create a new ``ContextVar`` object. The *name* parameter is used for " "introspection and debug purposes. The *def* parameter specifies a default " @@ -131,42 +191,42 @@ msgid "" "occurred, this function returns ``NULL``." msgstr "" -#: c-api/contextvars.rst:116 +#: c-api/contextvars.rst:162 msgid "" "Get the value of a context variable. Returns ``-1`` if an error has " "occurred during lookup, and ``0`` if no error occurred, whether or not a " "value was found." msgstr "" -#: c-api/contextvars.rst:120 +#: c-api/contextvars.rst:166 msgid "" "If the context variable was found, *value* will be a pointer to it. If the " "context variable was *not* found, *value* will point to:" msgstr "" -#: c-api/contextvars.rst:123 +#: c-api/contextvars.rst:169 msgid "*default_value*, if not ``NULL``;" msgstr "" -#: c-api/contextvars.rst:124 +#: c-api/contextvars.rst:170 msgid "the default value of *var*, if not ``NULL``;" msgstr "" -#: c-api/contextvars.rst:125 +#: c-api/contextvars.rst:171 msgid "``NULL``" msgstr "" -#: c-api/contextvars.rst:127 +#: c-api/contextvars.rst:173 msgid "Except for ``NULL``, the function returns a new reference." msgstr "" -#: c-api/contextvars.rst:131 +#: c-api/contextvars.rst:177 msgid "" "Set the value of *var* to *value* in the current context. Returns a new " "token object for this change, or ``NULL`` if an error has occurred." msgstr "" -#: c-api/contextvars.rst:136 +#: c-api/contextvars.rst:182 msgid "" "Reset the state of the *var* context variable to that it was in before :c:" "func:`PyContextVar_Set` that returned the *token* was called. This function " diff --git a/c-api/conversion.po b/c-api/conversion.po index 4adfc374..53f03847 100644 --- a/c-api/conversion.po +++ b/c-api/conversion.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -77,9 +78,9 @@ msgstr "" #: c-api/conversion.rst:44 msgid "" -"When ``rv < 0``, \"something bad happened.\" ``str[size-1]`` is ``'\\0'`` in " -"this case too, but the rest of *str* is undefined. The exact cause of the " -"error depends on the underlying platform." +"When ``rv < 0``, the output conversion failed and ``str[size-1]`` is " +"``'\\0'`` in this case too, but the rest of *str* is undefined. The exact " +"cause of the error depends on the underlying platform." msgstr "" #: c-api/conversion.rst:49 @@ -162,7 +163,7 @@ msgstr "" msgid "" "If ``s`` represents a value that is too large to store in a float (for " "example, ``\"1e500\"`` is such a string on many platforms) then if " -"``overflow_exception`` is ``NULL`` return ``Py_HUGE_VAL`` (with an " +"``overflow_exception`` is ``NULL`` return ``Py_INFINITY`` (with an " "appropriate sign) and don't set any exception. Otherwise, " "``overflow_exception`` must point to a Python exception object; raise that " "exception and return ``-1.0``. In both cases, set ``*endptr`` to point to " @@ -189,30 +190,30 @@ msgid "" msgstr "" #: c-api/conversion.rst:131 -msgid "" -"*flags* can be zero or more of the values ``Py_DTSF_SIGN``, " -"``Py_DTSF_ADD_DOT_0``, or ``Py_DTSF_ALT``, or-ed together:" +msgid "*flags* can be zero or more of the following values or-ed together:" msgstr "" -#: c-api/conversion.rst:134 +#: c-api/conversion.rst:135 msgid "" -"``Py_DTSF_SIGN`` means to always precede the returned string with a sign " -"character, even if *val* is non-negative." +"Always precede the returned string with a sign character, even if *val* is " +"non-negative." msgstr "" -#: c-api/conversion.rst:137 -msgid "" -"``Py_DTSF_ADD_DOT_0`` means to ensure that the returned string will not look " -"like an integer." +#: c-api/conversion.rst:140 +msgid "Ensure that the returned string will not look like an integer." msgstr "" -#: c-api/conversion.rst:140 +#: c-api/conversion.rst:144 msgid "" -"``Py_DTSF_ALT`` means to apply \"alternate\" formatting rules. See the " -"documentation for the :c:func:`PyOS_snprintf` ``'#'`` specifier for details." +"Apply \"alternate\" formatting rules. See the documentation for the :c:func:" +"`PyOS_snprintf` ``'#'`` specifier for details." msgstr "" -#: c-api/conversion.rst:144 +#: c-api/conversion.rst:150 +msgid "Negative zero is converted to positive zero." +msgstr "" + +#: c-api/conversion.rst:154 msgid "" "If *ptype* is non-``NULL``, then the value it points to will be set to one " "of ``Py_DTST_FINITE``, ``Py_DTST_INFINITE``, or ``Py_DTST_NAN``, signifying " @@ -220,21 +221,103 @@ msgid "" "respectively." msgstr "" -#: c-api/conversion.rst:148 +#: c-api/conversion.rst:158 msgid "" "The return value is a pointer to *buffer* with the converted string or " "``NULL`` if the conversion failed. The caller is responsible for freeing the " "returned string by calling :c:func:`PyMem_Free`." msgstr "" -#: c-api/conversion.rst:157 +#: c-api/conversion.rst:168 +msgid "" +"Case insensitive comparison of strings. These functions work almost " +"identically to :c:func:`!strcmp` and :c:func:`!strncmp` (respectively), " +"except that they ignore the case of ASCII characters." +msgstr "" + +#: c-api/conversion.rst:172 msgid "" -"Case insensitive comparison of strings. The function works almost " -"identically to :c:func:`!strcmp` except that it ignores the case." +"Return ``0`` if the strings are equal, a negative value if *str1* sorts " +"lexicographically before *str2*, or a positive value if it sorts after." msgstr "" -#: c-api/conversion.rst:163 +#: c-api/conversion.rst:175 msgid "" -"Case insensitive comparison of strings. The function works almost " -"identically to :c:func:`!strncmp` except that it ignores the case." +"In the *str1* or *str2* arguments, a NUL byte marks the end of the string. " +"For :c:func:`!PyOS_mystrnicmp`, the *size* argument gives the maximum size " +"of the string, as if NUL was present at the index given by *size*." +msgstr "" + +#: c-api/conversion.rst:179 +msgid "These functions do not use the locale." +msgstr "" + +#: c-api/conversion.rst:185 +msgid "Case insensitive comparison of strings." +msgstr "" + +#: c-api/conversion.rst:187 +msgid "" +"On Windows, these are aliases of :c:func:`!stricmp` and :c:func:`!strnicmp`, " +"respectively." +msgstr "" + +#: c-api/conversion.rst:190 +msgid "" +"On other platforms, they are aliases of :c:func:`PyOS_mystricmp` and :c:func:" +"`PyOS_mystrnicmp`, respectively." +msgstr "" + +#: c-api/conversion.rst:195 +msgid "Character classification and conversion" +msgstr "" + +#: c-api/conversion.rst:197 +msgid "" +"The following macros provide locale-independent (unlike the C standard " +"library ``ctype.h``) character classification and conversion. The argument " +"must be a signed or unsigned :c:expr:`char`." +msgstr "" + +#: c-api/conversion.rst:204 +msgid "Return true if the character *c* is an alphanumeric character." +msgstr "" + +#: c-api/conversion.rst:209 +msgid "" +"Return true if the character *c* is an alphabetic character (``a-z`` and ``A-" +"Z``)." +msgstr "" + +#: c-api/conversion.rst:214 +msgid "Return true if the character *c* is a decimal digit (``0-9``)." +msgstr "" + +#: c-api/conversion.rst:219 +msgid "Return true if the character *c* is a lowercase ASCII letter (``a-z``)." +msgstr "" + +#: c-api/conversion.rst:224 +msgid "" +"Return true if the character *c* is an uppercase ASCII letter (``A-Z``)." +msgstr "" + +#: c-api/conversion.rst:229 +msgid "" +"Return true if the character *c* is a whitespace character (space, tab, " +"carriage return, newline, vertical tab, or form feed)." +msgstr "" + +#: c-api/conversion.rst:235 +msgid "" +"Return true if the character *c* is a hexadecimal digit (``0-9``, ``a-f``, " +"and ``A-F``)." +msgstr "" + +#: c-api/conversion.rst:241 +msgid "Return the lowercase equivalent of the character *c*." +msgstr "" + +#: c-api/conversion.rst:246 +msgid "Return the uppercase equivalent of the character *c*." msgstr "" diff --git a/c-api/coro.po b/c-api/coro.po index 02ca0e92..2ef8ff1f 100644 --- a/c-api/coro.po +++ b/c-api/coro.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/c-api/curses.po b/c-api/curses.po new file mode 100644 index 00000000..b472b827 --- /dev/null +++ b/c-api/curses.po @@ -0,0 +1,184 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: c-api/curses.rst:4 +msgid "Curses C API" +msgstr "" + +#: c-api/curses.rst:6 +msgid "" +":mod:`curses` exposes a small C interface for extension modules. Consumers " +"must include the header file :file:`py_curses.h` (which is not included by " +"default by :file:`Python.h`) and :c:func:`import_curses` must be invoked, " +"usually as part of the module initialisation function, to populate :c:var:" +"`PyCurses_API`." +msgstr "" + +#: c-api/curses.rst:14 +msgid "" +"Neither the C API nor the pure Python :mod:`curses` module are compatible " +"with subinterpreters." +msgstr "" + +#: c-api/curses.rst:19 +msgid "" +"Import the curses C API. The macro does not need a semi-colon to be called." +msgstr "" + +#: c-api/curses.rst:21 +msgid "On success, populate the :c:var:`PyCurses_API` pointer." +msgstr "" + +#: c-api/curses.rst:23 +msgid "" +"On failure, set :c:var:`PyCurses_API` to NULL and set an exception. The " +"caller must check if an error occurred via :c:func:`PyErr_Occurred`:" +msgstr "" + +#: c-api/curses.rst:26 +msgid "" +"import_curses(); // semi-colon is optional but recommended\n" +"if (PyErr_Occurred()) { /* cleanup */ }" +msgstr "" + +#: c-api/curses.rst:34 +msgid "" +"Dynamically allocated object containing the curses C API. This variable is " +"only available once :c:macro:`import_curses` succeeds." +msgstr "" + +#: c-api/curses.rst:37 +msgid "``PyCurses_API[0]`` corresponds to :c:data:`PyCursesWindow_Type`." +msgstr "" + +#: c-api/curses.rst:39 +msgid "" +"``PyCurses_API[1]``, ``PyCurses_API[2]``, and ``PyCurses_API[3]`` are " +"pointers to predicate functions of type ``int (*)(void)``." +msgstr "" + +#: c-api/curses.rst:42 +msgid "" +"When called, these predicates return whether :func:`curses.setupterm`, :func:" +"`curses.initscr`, and :func:`curses.start_color` have been called " +"respectively." +msgstr "" + +#: c-api/curses.rst:46 +msgid "" +"See also the convenience macros :c:macro:`PyCursesSetupTermCalled`, :c:macro:" +"`PyCursesInitialised`, and :c:macro:`PyCursesInitialisedColor`." +msgstr "" + +#: c-api/curses.rst:51 +msgid "" +"The number of entries in this structure is subject to changes. Consider " +"using :c:macro:`PyCurses_API_pointers` to check if new fields are available " +"or not." +msgstr "" + +#: c-api/curses.rst:58 +msgid "" +"The number of accessible fields (``4``) in :c:var:`PyCurses_API`. This " +"number is incremented whenever new fields are added." +msgstr "" + +#: c-api/curses.rst:64 +msgid "" +"The :ref:`heap type ` corresponding to :class:`curses.window`." +msgstr "" + +#: c-api/curses.rst:69 +msgid "" +"Return true if *op* is a :class:`curses.window` instance, false otherwise." +msgstr "" + +#: c-api/curses.rst:72 +msgid "" +"The following macros are convenience macros expanding into C statements. In " +"particular, they can only be used as ``macro;`` or ``macro``, but not " +"``macro()`` or ``macro();``." +msgstr "" + +#: c-api/curses.rst:78 +msgid "Macro checking if :func:`curses.setupterm` has been called." +msgstr "" + +#: c-api/curses.rst:97 c-api/curses.rst:114 +msgid "The macro expansion is roughly equivalent to:" +msgstr "" + +#: c-api/curses.rst:82 +msgid "" +"{\n" +" typedef int (*predicate_t)(void);\n" +" predicate_t was_setupterm_called = (predicate_t)PyCurses_API[1];\n" +" if (!was_setupterm_called()) {\n" +" return NULL;\n" +" }\n" +"}" +msgstr "" + +#: c-api/curses.rst:95 +msgid "Macro checking if :func:`curses.initscr` has been called." +msgstr "" + +#: c-api/curses.rst:99 +msgid "" +"{\n" +" typedef int (*predicate_t)(void);\n" +" predicate_t was_initscr_called = (predicate_t)PyCurses_API[2];\n" +" if (!was_initscr_called()) {\n" +" return NULL;\n" +" }\n" +"}" +msgstr "" + +#: c-api/curses.rst:112 +msgid "Macro checking if :func:`curses.start_color` has been called." +msgstr "" + +#: c-api/curses.rst:116 +msgid "" +"{\n" +" typedef int (*predicate_t)(void);\n" +" predicate_t was_start_color_called = (predicate_t)PyCurses_API[3];\n" +" if (!was_start_color_called()) {\n" +" return NULL;\n" +" }\n" +"}" +msgstr "" + +#: c-api/curses.rst:128 +msgid "Internal data" +msgstr "" + +#: c-api/curses.rst:130 +msgid "" +"The following objects are exposed by the C API but should be considered " +"internal-only." +msgstr "" + +#: c-api/curses.rst:135 +msgid "Name of the curses capsule to pass to :c:func:`PyCapsule_Import`." +msgstr "" + +#: c-api/curses.rst:137 +msgid "Internal usage only. Use :c:macro:`import_curses` instead." +msgstr "" diff --git a/c-api/datetime.po b/c-api/datetime.po index beab3acc..02f90e98 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -25,175 +26,217 @@ msgid "" "Various date and time objects are supplied by the :mod:`datetime` module. " "Before using any of these functions, the header file :file:`datetime.h` must " "be included in your source (note that this is not included by :file:`Python." -"h`), and the macro :c:macro:`!PyDateTime_IMPORT` must be invoked, usually as " +"h`), and the macro :c:macro:`PyDateTime_IMPORT` must be invoked, usually as " "part of the module initialisation function. The macro puts a pointer to a C " -"structure into a static variable, :c:data:`!PyDateTimeAPI`, that is used by " +"structure into a static variable, :c:data:`PyDateTimeAPI`, that is used by " "the following macros." msgstr "" #: c-api/datetime.rst:18 +msgid "Import the datetime C API." +msgstr "" + +#: c-api/datetime.rst:20 +msgid "" +"On success, populate the :c:var:`PyDateTimeAPI` pointer. On failure, set :c:" +"var:`PyDateTimeAPI` to ``NULL`` and set an exception. The caller must check " +"if an error occurred via :c:func:`PyErr_Occurred`:" +msgstr "" + +#: c-api/datetime.rst:24 +msgid "" +"PyDateTime_IMPORT;\n" +"if (PyErr_Occurred()) { /* cleanup */ }" +msgstr "" + +#: c-api/datetime.rst:31 +msgid "This is not compatible with subinterpreters." +msgstr "" + +#: c-api/datetime.rst:35 +msgid "Structure containing the fields for the datetime C API." +msgstr "" + +#: c-api/datetime.rst:37 +msgid "The fields of this structure are private and subject to change." +msgstr "" + +#: c-api/datetime.rst:39 +msgid "Do not use this directly; prefer ``PyDateTime_*`` APIs instead." +msgstr "" + +#: c-api/datetime.rst:43 +msgid "Dynamically allocated object containing the datetime C API." +msgstr "" + +#: c-api/datetime.rst:45 +msgid "" +"This variable is only available once :c:macro:`PyDateTime_IMPORT` succeeds." +msgstr "" + +#: c-api/datetime.rst:49 msgid "This subtype of :c:type:`PyObject` represents a Python date object." msgstr "" -#: c-api/datetime.rst:22 +#: c-api/datetime.rst:53 msgid "This subtype of :c:type:`PyObject` represents a Python datetime object." msgstr "" -#: c-api/datetime.rst:26 +#: c-api/datetime.rst:57 msgid "This subtype of :c:type:`PyObject` represents a Python time object." msgstr "" -#: c-api/datetime.rst:30 +#: c-api/datetime.rst:61 msgid "" "This subtype of :c:type:`PyObject` represents the difference between two " "datetime values." msgstr "" -#: c-api/datetime.rst:34 +#: c-api/datetime.rst:65 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python date type; it " "is the same object as :class:`datetime.date` in the Python layer." msgstr "" -#: c-api/datetime.rst:39 +#: c-api/datetime.rst:70 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python datetime type; " "it is the same object as :class:`datetime.datetime` in the Python layer." msgstr "" -#: c-api/datetime.rst:44 +#: c-api/datetime.rst:75 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python time type; it " "is the same object as :class:`datetime.time` in the Python layer." msgstr "" -#: c-api/datetime.rst:49 +#: c-api/datetime.rst:80 msgid "" -"This instance of :c:type:`PyTypeObject` represents Python type for the " +"This instance of :c:type:`PyTypeObject` represents the Python type for the " "difference between two datetime values; it is the same object as :class:" "`datetime.timedelta` in the Python layer." msgstr "" -#: c-api/datetime.rst:55 +#: c-api/datetime.rst:86 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python time zone info " "type; it is the same object as :class:`datetime.tzinfo` in the Python layer." msgstr "" -#: c-api/datetime.rst:59 +#: c-api/datetime.rst:90 msgid "Macro for access to the UTC singleton:" msgstr "" -#: c-api/datetime.rst:63 +#: c-api/datetime.rst:94 msgid "" "Returns the time zone singleton representing UTC, the same object as :attr:" "`datetime.timezone.utc`." msgstr "" -#: c-api/datetime.rst:69 +#: c-api/datetime.rst:100 msgid "Type-check macros:" msgstr "" -#: c-api/datetime.rst:73 +#: c-api/datetime.rst:104 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_DateType` or a subtype " "of :c:data:`!PyDateTime_DateType`. *ob* must not be ``NULL``. This " "function always succeeds." msgstr "" -#: c-api/datetime.rst:80 +#: c-api/datetime.rst:111 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_DateType`. *ob* must not " "be ``NULL``. This function always succeeds." msgstr "" -#: c-api/datetime.rst:86 +#: c-api/datetime.rst:117 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType` or a " "subtype of :c:data:`!PyDateTime_DateTimeType`. *ob* must not be ``NULL``. " "This function always succeeds." msgstr "" -#: c-api/datetime.rst:93 +#: c-api/datetime.rst:124 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType`. *ob* must " "not be ``NULL``. This function always succeeds." msgstr "" -#: c-api/datetime.rst:99 +#: c-api/datetime.rst:130 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_TimeType` or a subtype " "of :c:data:`!PyDateTime_TimeType`. *ob* must not be ``NULL``. This " "function always succeeds." msgstr "" -#: c-api/datetime.rst:106 +#: c-api/datetime.rst:137 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_TimeType`. *ob* must not " "be ``NULL``. This function always succeeds." msgstr "" -#: c-api/datetime.rst:112 +#: c-api/datetime.rst:143 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_DeltaType` or a subtype " "of :c:data:`!PyDateTime_DeltaType`. *ob* must not be ``NULL``. This " "function always succeeds." msgstr "" -#: c-api/datetime.rst:119 +#: c-api/datetime.rst:150 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_DeltaType`. *ob* must not " "be ``NULL``. This function always succeeds." msgstr "" -#: c-api/datetime.rst:125 +#: c-api/datetime.rst:156 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType` or a subtype " "of :c:data:`!PyDateTime_TZInfoType`. *ob* must not be ``NULL``. This " "function always succeeds." msgstr "" -#: c-api/datetime.rst:132 +#: c-api/datetime.rst:163 msgid "" "Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType`. *ob* must " "not be ``NULL``. This function always succeeds." msgstr "" -#: c-api/datetime.rst:136 +#: c-api/datetime.rst:167 msgid "Macros to create objects:" msgstr "" -#: c-api/datetime.rst:140 +#: c-api/datetime.rst:171 msgid "" "Return a :class:`datetime.date` object with the specified year, month and " "day." msgstr "" -#: c-api/datetime.rst:145 +#: c-api/datetime.rst:176 msgid "" "Return a :class:`datetime.datetime` object with the specified year, month, " "day, hour, minute, second and microsecond." msgstr "" -#: c-api/datetime.rst:151 +#: c-api/datetime.rst:182 msgid "" "Return a :class:`datetime.datetime` object with the specified year, month, " "day, hour, minute, second, microsecond and fold." msgstr "" -#: c-api/datetime.rst:159 +#: c-api/datetime.rst:190 msgid "" "Return a :class:`datetime.time` object with the specified hour, minute, " "second and microsecond." msgstr "" -#: c-api/datetime.rst:165 +#: c-api/datetime.rst:196 msgid "" "Return a :class:`datetime.time` object with the specified hour, minute, " "second, microsecond and fold." msgstr "" -#: c-api/datetime.rst:173 +#: c-api/datetime.rst:204 msgid "" "Return a :class:`datetime.timedelta` object representing the given number of " "days, seconds and microseconds. Normalization is performed so that the " @@ -201,19 +244,19 @@ msgid "" "for :class:`datetime.timedelta` objects." msgstr "" -#: c-api/datetime.rst:181 +#: c-api/datetime.rst:212 msgid "" "Return a :class:`datetime.timezone` object with an unnamed fixed offset " "represented by the *offset* argument." msgstr "" -#: c-api/datetime.rst:189 +#: c-api/datetime.rst:220 msgid "" "Return a :class:`datetime.timezone` object with a fixed offset represented " "by the *offset* argument and with tzname *name*." msgstr "" -#: c-api/datetime.rst:195 +#: c-api/datetime.rst:226 msgid "" "Macros to extract fields from date objects. The argument must be an " "instance of :c:type:`PyDateTime_Date`, including subclasses (such as :c:type:" @@ -221,87 +264,105 @@ msgid "" "not checked:" msgstr "" -#: c-api/datetime.rst:202 +#: c-api/datetime.rst:233 msgid "Return the year, as a positive int." msgstr "" -#: c-api/datetime.rst:207 +#: c-api/datetime.rst:238 msgid "Return the month, as an int from 1 through 12." msgstr "" -#: c-api/datetime.rst:212 +#: c-api/datetime.rst:243 msgid "Return the day, as an int from 1 through 31." msgstr "" -#: c-api/datetime.rst:215 +#: c-api/datetime.rst:246 msgid "" "Macros to extract fields from datetime objects. The argument must be an " "instance of :c:type:`PyDateTime_DateTime`, including subclasses. The " "argument must not be ``NULL``, and the type is not checked:" msgstr "" -#: c-api/datetime.rst:259 +#: c-api/datetime.rst:290 msgid "Return the hour, as an int from 0 through 23." msgstr "" -#: c-api/datetime.rst:264 +#: c-api/datetime.rst:295 msgid "Return the minute, as an int from 0 through 59." msgstr "" -#: c-api/datetime.rst:269 +#: c-api/datetime.rst:300 msgid "Return the second, as an int from 0 through 59." msgstr "" -#: c-api/datetime.rst:274 +#: c-api/datetime.rst:305 msgid "Return the microsecond, as an int from 0 through 999999." msgstr "" -#: c-api/datetime.rst:279 +#: c-api/datetime.rst:310 msgid "Return the fold, as an int from 0 through 1." msgstr "" -#: c-api/datetime.rst:286 +#: c-api/datetime.rst:317 msgid "Return the tzinfo (which may be ``None``)." msgstr "" -#: c-api/datetime.rst:253 +#: c-api/datetime.rst:284 msgid "" "Macros to extract fields from time objects. The argument must be an " "instance of :c:type:`PyDateTime_Time`, including subclasses. The argument " "must not be ``NULL``, and the type is not checked:" msgstr "" -#: c-api/datetime.rst:291 +#: c-api/datetime.rst:322 msgid "" "Macros to extract fields from time delta objects. The argument must be an " "instance of :c:type:`PyDateTime_Delta`, including subclasses. The argument " "must not be ``NULL``, and the type is not checked:" msgstr "" -#: c-api/datetime.rst:297 +#: c-api/datetime.rst:328 msgid "Return the number of days, as an int from -999999999 to 999999999." msgstr "" -#: c-api/datetime.rst:304 +#: c-api/datetime.rst:335 msgid "Return the number of seconds, as an int from 0 through 86399." msgstr "" -#: c-api/datetime.rst:311 +#: c-api/datetime.rst:342 msgid "Return the number of microseconds, as an int from 0 through 999999." msgstr "" -#: c-api/datetime.rst:316 +#: c-api/datetime.rst:347 msgid "Macros for the convenience of modules implementing the DB API:" msgstr "" -#: c-api/datetime.rst:320 +#: c-api/datetime.rst:351 msgid "" "Create and return a new :class:`datetime.datetime` object given an argument " -"tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp()`." +"tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp`." msgstr "" -#: c-api/datetime.rst:326 +#: c-api/datetime.rst:357 msgid "" "Create and return a new :class:`datetime.date` object given an argument " -"tuple suitable for passing to :meth:`datetime.date.fromtimestamp()`." +"tuple suitable for passing to :meth:`datetime.date.fromtimestamp`." +msgstr "" + +#: c-api/datetime.rst:362 +msgid "Internal data" +msgstr "" + +#: c-api/datetime.rst:364 +msgid "" +"The following symbols are exposed by the C API but should be considered " +"internal-only." +msgstr "" + +#: c-api/datetime.rst:369 +msgid "Name of the datetime capsule to pass to :c:func:`PyCapsule_Import`." +msgstr "" + +#: c-api/datetime.rst:371 +msgid "Internal usage only. Use :c:macro:`PyDateTime_IMPORT` instead." msgstr "" diff --git a/c-api/descriptor.po b/c-api/descriptor.po index 6fd6003f..28ec8036 100644 --- a/c-api/descriptor.po +++ b/c-api/descriptor.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -30,9 +31,97 @@ msgstr "" msgid "The type object for the built-in descriptor types." msgstr "" +#: c-api/descriptor.rst:26 +msgid "" +"The type object for member descriptor objects created from :c:type:" +"`PyMemberDef` structures. These descriptors expose fields of a C struct as " +"attributes on a type, and correspond to :class:`types.MemberDescriptorType` " +"objects in Python." +msgstr "" + #: c-api/descriptor.rst:35 msgid "" -"Return non-zero if the descriptor objects *descr* describes a data " -"attribute, or ``0`` if it describes a method. *descr* must be a descriptor " -"object; there is no error checking." +"The type object for get/set descriptor objects created from :c:type:" +"`PyGetSetDef` structures. These descriptors implement attributes whose value " +"is computed by C getter and setter functions, and are used for many built-in " +"type attributes." +msgstr "" + +#: c-api/descriptor.rst:46 +msgid "" +"The type object for method descriptor objects created from :c:type:" +"`PyMethodDef` structures. These descriptors expose C functions as methods on " +"a type, and correspond to :class:`types.MemberDescriptorType` objects in " +"Python." +msgstr "" + +#: c-api/descriptor.rst:57 +msgid "" +"The type object for wrapper descriptor objects created by :c:func:" +"`PyDescr_NewWrapper` and :c:func:`PyWrapper_New`. Wrapper descriptors are " +"used internally to expose special methods implemented via wrapper " +"structures, and appear in Python as :class:`types.WrapperDescriptorType` " +"objects." +msgstr "" + +#: c-api/descriptor.rst:69 +msgid "" +"Return non-zero if the descriptor object *descr* describes a data attribute, " +"or ``0`` if it describes a method. *descr* must be a descriptor object; " +"there is no error checking." +msgstr "" + +#: c-api/descriptor.rst:78 +msgid "Built-in descriptors" +msgstr "" + +#: c-api/descriptor.rst:82 +msgid "" +"The type object for super objects. This is the same object as :class:`super` " +"in the Python layer." +msgstr "" + +#: c-api/descriptor.rst:88 +msgid "" +"The type of class method objects. This is the same object as :class:" +"`classmethod` in the Python layer." +msgstr "" + +#: c-api/descriptor.rst:94 +msgid "" +"The type object for C-level class method descriptor objects. This is the " +"type of the descriptors created for :func:`classmethod` defined in C " +"extension types, and is the same object as :class:`classmethod` in Python." +msgstr "" + +#: c-api/descriptor.rst:102 +msgid "" +"Create a new :class:`classmethod` object wrapping *callable*. *callable* " +"must be a callable object and must not be ``NULL``." +msgstr "" + +#: c-api/descriptor.rst:105 +msgid "" +"On success, this function returns a :term:`strong reference` to a new class " +"method descriptor. On failure, this function returns ``NULL`` with an " +"exception set." +msgstr "" + +#: c-api/descriptor.rst:112 +msgid "" +"The type of static method objects. This is the same object as :class:" +"`staticmethod` in the Python layer." +msgstr "" + +#: c-api/descriptor.rst:118 +msgid "" +"Create a new :class:`staticmethod` object wrapping *callable*. *callable* " +"must be a callable object and must not be ``NULL``." +msgstr "" + +#: c-api/descriptor.rst:121 +msgid "" +"On success, this function returns a :term:`strong reference` to a new static " +"method descriptor. On failure, this function returns ``NULL`` with an " +"exception set." msgstr "" diff --git a/c-api/dict.po b/c-api/dict.po index d8f15d56..9760222e 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -55,21 +56,38 @@ msgid "" msgstr "" #: c-api/dict.rst:48 +msgid "" +"The type object for mapping proxy objects created by :c:func:" +"`PyDictProxy_New` and for the read-only ``__dict__`` attribute of many built-" +"in types. A :c:type:`PyDictProxy_Type` instance provides a dynamic, read-" +"only view of an underlying dictionary: changes to the underlying dictionary " +"are reflected in the proxy, but the proxy itself does not support mutation " +"operations. This corresponds to :class:`types.MappingProxyType` in Python." +msgstr "" + +#: c-api/dict.rst:59 msgid "Empty an existing dictionary of all key-value pairs." msgstr "" -#: c-api/dict.rst:53 +#: c-api/dict.rst:64 msgid "" -"Determine if dictionary *p* contains *key*. If an item in *p* is matches " +"Determine if dictionary *p* contains *key*. If an item in *p* matches " "*key*, return ``1``, otherwise return ``0``. On error, return ``-1``. This " "is equivalent to the Python expression ``key in p``." msgstr "" -#: c-api/dict.rst:60 +#: c-api/dict.rst:71 +msgid "" +"This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a :" +"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." +msgstr "" + +#: c-api/dict.rst:80 msgid "Return a new dictionary that contains the same key-value pairs as *p*." msgstr "" -#: c-api/dict.rst:65 +#: c-api/dict.rst:85 msgid "" "Insert *val* into the dictionary *p* with a key of *key*. *key* must be :" "term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` " @@ -77,14 +95,14 @@ msgid "" "to *val*." msgstr "" -#: c-api/dict.rst:73 +#: c-api/dict.rst:93 msgid "" "This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/dict.rst:80 +#: c-api/dict.rst:100 msgid "" "Remove the entry in dictionary *p* with key *key*. *key* must be :term:" "`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the " @@ -92,47 +110,72 @@ msgid "" "failure." msgstr "" -#: c-api/dict.rst:88 +#: c-api/dict.rst:108 msgid "" "This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/dict.rst:95 +#: c-api/dict.rst:115 msgid "" -"Return the object from dictionary *p* which has a key *key*. Return " -"``NULL`` if the key *key* is not present, but *without* setting an exception." +"Return a new :term:`strong reference` to the object from dictionary *p* " +"which has a key *key*:" msgstr "" -#: c-api/dict.rst:100 +#: c-api/dict.rst:118 +msgid "" +"If the key is present, set *\\*result* to a new :term:`strong reference` to " +"the value and return ``1``." +msgstr "" + +#: c-api/dict.rst:120 +msgid "If the key is missing, set *\\*result* to ``NULL`` and return ``0``." +msgstr "" + +#: c-api/dict.rst:218 +msgid "On error, raise an exception and return ``-1``." +msgstr "" + +#: c-api/dict.rst:125 +msgid "See also the :c:func:`PyObject_GetItem` function." +msgstr "" + +#: c-api/dict.rst:130 +msgid "" +"Return a :term:`borrowed reference` to the object from dictionary *p* which " +"has a key *key*. Return ``NULL`` if the key *key* is missing *without* " +"setting an exception." +msgstr "" + +#: c-api/dict.rst:136 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods are silently ignored. Prefer the :c:func:" "`PyDict_GetItemWithError` function instead." msgstr "" -#: c-api/dict.rst:104 +#: c-api/dict.rst:140 msgid "" -"Calling this API without :term:`GIL` held had been allowed for historical " -"reason. It is no longer allowed." +"Calling this API without an :term:`attached thread state` had been allowed " +"for historical reason. It is no longer allowed." msgstr "" -#: c-api/dict.rst:111 +#: c-api/dict.rst:147 msgid "" "Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. " "Return ``NULL`` **with** an exception set if an exception occurred. Return " "``NULL`` **without** an exception set if the key wasn't present." msgstr "" -#: c-api/dict.rst:119 +#: c-api/dict.rst:155 msgid "" "This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/dict.rst:125 +#: c-api/dict.rst:161 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods or while creating the temporary :class:`str` object " @@ -140,7 +183,13 @@ msgid "" "function with your own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" -#: c-api/dict.rst:134 +#: c-api/dict.rst:170 +msgid "" +"Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as a :c:expr:" +"`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +msgstr "" + +#: c-api/dict.rst:179 msgid "" "This is the same as the Python-level :meth:`dict.setdefault`. If present, " "it returns the value corresponding to *key* from the dictionary *p*. If the " @@ -150,29 +199,83 @@ msgid "" "the insertion." msgstr "" -#: c-api/dict.rst:144 +#: c-api/dict.rst:190 +msgid "" +"Inserts *default_value* into the dictionary *p* with a key of *key* if the " +"key is not already present in the dictionary. If *result* is not ``NULL``, " +"then *\\*result* is set to a :term:`strong reference` to either " +"*default_value*, if the key was not present, or the existing value, if *key* " +"was already present in the dictionary. Returns ``1`` if the key was present " +"and *default_value* was not inserted, or ``0`` if the key was not present " +"and *default_value* was inserted. On failure, returns ``-1``, sets an " +"exception, and sets ``*result`` to ``NULL``." +msgstr "" + +#: c-api/dict.rst:200 +msgid "" +"For clarity: if you have a strong reference to *default_value* before " +"calling this function, then after it returns, you hold a strong reference to " +"both *default_value* and *\\*result* (if it's not ``NULL``). These may refer " +"to the same object: in that case you hold two separate references to it." +msgstr "" + +#: c-api/dict.rst:211 +msgid "" +"Remove *key* from dictionary *p* and optionally return the removed value. Do " +"not raise :exc:`KeyError` if the key is missing." +msgstr "" + +#: c-api/dict.rst:214 +msgid "" +"If the key is present, set *\\*result* to a new reference to the removed " +"value if *result* is not ``NULL``, and return ``1``." +msgstr "" + +#: c-api/dict.rst:216 +msgid "" +"If the key is missing, set *\\*result* to ``NULL`` if *result* is not " +"``NULL``, and return ``0``." +msgstr "" + +#: c-api/dict.rst:220 +msgid "" +"Similar to :meth:`dict.pop`, but without the default value and not raising :" +"exc:`KeyError` if the key is missing." +msgstr "" + +#: c-api/dict.rst:228 +msgid "" +"Similar to :c:func:`PyDict_Pop`, but *key* is specified as a :c:expr:`const " +"char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +msgstr "" + +#: c-api/dict.rst:237 msgid "" "Return a :c:type:`PyListObject` containing all the items from the dictionary." msgstr "" -#: c-api/dict.rst:149 +#: c-api/dict.rst:242 msgid "" "Return a :c:type:`PyListObject` containing all the keys from the dictionary." msgstr "" -#: c-api/dict.rst:154 +#: c-api/dict.rst:247 msgid "" "Return a :c:type:`PyListObject` containing all the values from the " "dictionary *p*." msgstr "" -#: c-api/dict.rst:162 +#: c-api/dict.rst:255 msgid "" "Return the number of items in the dictionary. This is equivalent to " "``len(p)`` on a dictionary." msgstr "" -#: c-api/dict.rst:168 +#: c-api/dict.rst:261 +msgid "Similar to :c:func:`PyDict_Size`, but without error checking." +msgstr "" + +#: c-api/dict.rst:266 msgid "" "Iterate over all key-value pairs in the dictionary *p*. The :c:type:" "`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the " @@ -186,18 +289,77 @@ msgid "" "structure is sparse, the offsets are not consecutive." msgstr "" -#: c-api/dict.rst:179 +#: c-api/dict.rst:277 msgid "For example::" msgstr "" -#: c-api/dict.rst:189 +#: c-api/dict.rst:279 +msgid "" +"PyObject *key, *value;\n" +"Py_ssize_t pos = 0;\n" +"\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" /* do something interesting with the values... */\n" +" ...\n" +"}" +msgstr "" + +#: c-api/dict.rst:287 msgid "" "The dictionary *p* should not be mutated during iteration. It is safe to " "modify the values of the keys as you iterate over the dictionary, but only " "so long as the set of keys does not change. For example::" msgstr "" -#: c-api/dict.rst:214 +#: c-api/dict.rst:291 +msgid "" +"PyObject *key, *value;\n" +"Py_ssize_t pos = 0;\n" +"\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" long i = PyLong_AsLong(value);\n" +" if (i == -1 && PyErr_Occurred()) {\n" +" return -1;\n" +" }\n" +" PyObject *o = PyLong_FromLong(i + 1);\n" +" if (o == NULL)\n" +" return -1;\n" +" if (PyDict_SetItem(self->dict, key, o) < 0) {\n" +" Py_DECREF(o);\n" +" return -1;\n" +" }\n" +" Py_DECREF(o);\n" +"}" +msgstr "" + +#: c-api/dict.rst:309 +msgid "" +"The function is not thread-safe in the :term:`free-threaded ` build without external synchronization. You can use :c:macro:" +"`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" +msgstr "" + +#: c-api/dict.rst:314 +msgid "" +"Py_BEGIN_CRITICAL_SECTION(self->dict);\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" +msgstr "" + +#: c-api/dict.rst:322 +msgid "" +"On the free-threaded build, this function can be used safely inside a " +"critical section. However, the references returned for *pkey* and *pvalue* " +"are :term:`borrowed ` and are only valid while the " +"critical section is held. If you need to use these objects outside the " +"critical section or when the critical section can be suspended, create a :" +"term:`strong reference ` (for example, using :c:func:" +"`Py_NewRef`)." +msgstr "" + +#: c-api/dict.rst:332 msgid "" "Iterate over mapping object *b* adding key-value pairs to dictionary *a*. " "*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` " @@ -207,7 +369,7 @@ msgid "" "or ``-1`` if an exception was raised." msgstr "" -#: c-api/dict.rst:224 +#: c-api/dict.rst:342 msgid "" "This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a." "update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back " @@ -216,7 +378,7 @@ msgid "" "exception was raised." msgstr "" -#: c-api/dict.rst:233 +#: c-api/dict.rst:351 msgid "" "Update or merge into dictionary *a*, from the key-value pairs in *seq2*. " "*seq2* must be an iterable object producing iterable objects of length 2, " @@ -225,7 +387,15 @@ msgid "" "if an exception was raised. Equivalent Python (except for the return value)::" msgstr "" -#: c-api/dict.rst:247 +#: c-api/dict.rst:358 +msgid "" +"def PyDict_MergeFromSeq2(a, seq2, override):\n" +" for key, value in seq2:\n" +" if override or key not in a:\n" +" a[key] = value" +msgstr "" + +#: c-api/dict.rst:365 msgid "" "Register *callback* as a dictionary watcher. Return a non-negative integer " "id which must be passed to future calls to :c:func:`PyDict_Watch`. In case " @@ -233,21 +403,21 @@ msgid "" "exception." msgstr "" -#: c-api/dict.rst:256 +#: c-api/dict.rst:374 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the " "given *watcher_id* was never registered.)" msgstr "" -#: c-api/dict.rst:264 +#: c-api/dict.rst:382 msgid "" "Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:" "func:`PyDict_AddWatcher` will be called when *dict* is modified or " "deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" -#: c-api/dict.rst:272 +#: c-api/dict.rst:390 msgid "" "Mark dictionary *dict* as no longer watched. The callback granted " "*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when " @@ -255,7 +425,7 @@ msgid "" "watched by this watcher. Return ``0`` on success or ``-1`` on error." msgstr "" -#: c-api/dict.rst:281 +#: c-api/dict.rst:399 msgid "" "Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, " "``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, " @@ -263,11 +433,11 @@ msgid "" "``PyDict_EVENT_DEALLOCATED``." msgstr "" -#: c-api/dict.rst:289 +#: c-api/dict.rst:407 msgid "Type of a dict watcher callback function." msgstr "" -#: c-api/dict.rst:291 +#: c-api/dict.rst:409 msgid "" "If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both " "*key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` " @@ -276,7 +446,7 @@ msgid "" "dictionary and *new_value* will be ``NULL``." msgstr "" -#: c-api/dict.rst:297 +#: c-api/dict.rst:415 msgid "" "``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another " "dict is merged into it. To maintain efficiency of this operation, per-key " @@ -284,14 +454,14 @@ msgid "" "``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary." msgstr "" -#: c-api/dict.rst:303 +#: c-api/dict.rst:421 msgid "" "The callback may inspect but must not modify *dict*; doing so could have " "unpredictable effects, including infinite recursion. Do not trigger Python " "code execution in the callback, as it could modify the dict as a side effect." msgstr "" -#: c-api/dict.rst:307 +#: c-api/dict.rst:425 msgid "" "If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the " "callback to the about-to-be-destroyed dictionary will resurrect it and " @@ -300,20 +470,20 @@ msgid "" "again." msgstr "" -#: c-api/dict.rst:313 +#: c-api/dict.rst:431 msgid "" "Callbacks occur before the notified modification to *dict* takes place, so " "the prior state of *dict* can be inspected." msgstr "" -#: c-api/dict.rst:316 +#: c-api/dict.rst:434 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: c-api/dict.rst:320 +#: c-api/dict.rst:438 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -322,6 +492,160 @@ msgid "" "it before returning." msgstr "" +#: c-api/dict.rst:448 +msgid "Dictionary View Objects" +msgstr "" + +#: c-api/dict.rst:452 +msgid "" +"Return true if *op* is a view of a set inside a dictionary. This is " +"currently equivalent to :c:expr:`PyDictKeys_Check(op) || " +"PyDictItems_Check(op)`. This function always succeeds." +msgstr "" + +#: c-api/dict.rst:459 +msgid "" +"Type object for a view of dictionary keys. In Python, this is the type of " +"the object returned by :meth:`dict.keys`." +msgstr "" + +#: c-api/dict.rst:465 +msgid "" +"Return true if *op* is an instance of a dictionary keys view. This function " +"always succeeds." +msgstr "" + +#: c-api/dict.rst:471 +msgid "" +"Type object for a view of dictionary values. In Python, this is the type of " +"the object returned by :meth:`dict.values`." +msgstr "" + +#: c-api/dict.rst:477 +msgid "" +"Return true if *op* is an instance of a dictionary values view. This " +"function always succeeds." +msgstr "" + +#: c-api/dict.rst:483 +msgid "" +"Type object for a view of dictionary items. In Python, this is the type of " +"the object returned by :meth:`dict.items`." +msgstr "" + +#: c-api/dict.rst:489 +msgid "" +"Return true if *op* is an instance of a dictionary items view. This function " +"always succeeds." +msgstr "" + +#: c-api/dict.rst:494 +msgid "Ordered Dictionaries" +msgstr "" + +#: c-api/dict.rst:496 +msgid "" +"Python's C API provides interface for :class:`collections.OrderedDict` from " +"C. Since Python 3.7, dictionaries are ordered by default, so there is " +"usually little need for these functions; prefer ``PyDict*`` where possible." +msgstr "" + +#: c-api/dict.rst:503 +msgid "" +"Type object for ordered dictionaries. This is the same object as :class:" +"`collections.OrderedDict` in the Python layer." +msgstr "" + +#: c-api/dict.rst:509 +msgid "" +"Return true if *od* is an ordered dictionary object or an instance of a " +"subtype of the :class:`~collections.OrderedDict` type. This function always " +"succeeds." +msgstr "" + +#: c-api/dict.rst:516 +msgid "" +"Return true if *od* is an ordered dictionary object, but not an instance of " +"a subtype of the :class:`~collections.OrderedDict` type. This function " +"always succeeds." +msgstr "" + +#: c-api/dict.rst:523 +msgid "Analogous to :c:type:`PyDictKeys_Type` for ordered dictionaries." +msgstr "" + +#: c-api/dict.rst:528 +msgid "Analogous to :c:type:`PyDictValues_Type` for ordered dictionaries." +msgstr "" + +#: c-api/dict.rst:533 +msgid "Analogous to :c:type:`PyDictItems_Type` for ordered dictionaries." +msgstr "" + +#: c-api/dict.rst:538 +msgid "Return a new empty ordered dictionary, or ``NULL`` on failure." +msgstr "" + +#: c-api/dict.rst:540 +msgid "This is analogous to :c:func:`PyDict_New`." +msgstr "" + +#: c-api/dict.rst:545 +msgid "" +"Insert *value* into the ordered dictionary *od* with a key of *key*. Return " +"``0`` on success or ``-1`` with an exception set on failure." +msgstr "" + +#: c-api/dict.rst:548 +msgid "This is analogous to :c:func:`PyDict_SetItem`." +msgstr "" + +#: c-api/dict.rst:553 +msgid "" +"Remove the entry in the ordered dictionary *od* with key *key*. Return ``0`` " +"on success or ``-1`` with an exception set on failure." +msgstr "" + +#: c-api/dict.rst:556 +msgid "This is analogous to :c:func:`PyDict_DelItem`." +msgstr "" + +#: c-api/dict.rst:559 +msgid "These are :term:`soft deprecated` aliases to ``PyDict`` APIs:" +msgstr "" + +#: c-api/dict.rst:566 +msgid "``PyODict``" +msgstr "" + +#: c-api/dict.rst:567 +msgid "``PyDict``" +msgstr "" + +#: c-api/dict.rst:569 +msgid ":c:func:`PyDict_GetItem`" +msgstr "" + +#: c-api/dict.rst:571 +msgid ":c:func:`PyDict_GetItemWithError`" +msgstr "" + +#: c-api/dict.rst:573 +msgid ":c:func:`PyDict_GetItemString`" +msgstr "" + +#: c-api/dict.rst:575 +msgid ":c:func:`PyDict_Contains`" +msgstr "" + +#: c-api/dict.rst:577 +msgid ":c:func:`PyDict_Size`" +msgstr "" + +#: c-api/dict.rst:579 +msgid ":c:func:`PyDict_GET_SIZE`" +msgstr "" + #: c-api/dict.rst:8 msgid "object" msgstr "" @@ -330,10 +654,10 @@ msgstr "" msgid "dictionary" msgstr "" -#: c-api/dict.rst:160 +#: c-api/dict.rst:253 msgid "built-in function" msgstr "" -#: c-api/dict.rst:160 +#: c-api/dict.rst:253 msgid "len" msgstr "" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index e4804e04..dc0ad30d 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -57,7 +58,7 @@ msgstr "" #: c-api/exceptions.rst:37 msgid "" -"The error indicator is **not** the result of :func:`sys.exc_info()`. The " +"The error indicator is **not** the result of :func:`sys.exc_info`. The " "former corresponds to an exception that is not yet caught (and is therefore " "still propagating), while the latter returns an exception after it is caught " "(and has therefore stopped propagating)." @@ -140,22 +141,31 @@ msgstr "" #: c-api/exceptions.rst:104 msgid "" +"Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent " +"parameters help format the warning message; they have the same meaning and " +"values as in :c:func:`PyUnicode_FromFormat`. ``PyErr_WriteUnraisable(obj)`` " +"is roughly equivalent to ``PyErr_FormatUnraisable(\"Exception ignored in: " +"%R\", obj)``. If *format* is ``NULL``, only the traceback is printed." +msgstr "" + +#: c-api/exceptions.rst:116 +msgid "" "Print the standard traceback display of ``exc`` to ``sys.stderr``, including " "chained exceptions and notes." msgstr "" -#: c-api/exceptions.rst:110 +#: c-api/exceptions.rst:123 msgid "Raising exceptions" msgstr "" -#: c-api/exceptions.rst:112 +#: c-api/exceptions.rst:125 msgid "" "These functions help you set the current thread's error indicator. For " "convenience, some of these functions will always return a ``NULL`` pointer " "for use in a ``return`` statement." msgstr "" -#: c-api/exceptions.rst:119 +#: c-api/exceptions.rst:132 msgid "" "This is the most common way to set the error indicator. The first argument " "specifies the exception type; it is normally one of the standard exceptions, " @@ -164,13 +174,13 @@ msgid "" "error message; it is decoded from ``'utf-8'``." msgstr "" -#: c-api/exceptions.rst:128 +#: c-api/exceptions.rst:141 msgid "" "This function is similar to :c:func:`PyErr_SetString` but lets you specify " "an arbitrary Python object for the \"value\" of the exception." msgstr "" -#: c-api/exceptions.rst:134 +#: c-api/exceptions.rst:147 msgid "" "This function sets the error indicator and returns ``NULL``. *exception* " "should be a Python exception class. The *format* and subsequent parameters " @@ -178,31 +188,31 @@ msgid "" "c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." msgstr "" -#: c-api/exceptions.rst:143 +#: c-api/exceptions.rst:156 msgid "" "Same as :c:func:`PyErr_Format`, but taking a :c:type:`va_list` argument " "rather than a variable number of arguments." msgstr "" -#: c-api/exceptions.rst:151 +#: c-api/exceptions.rst:164 msgid "This is a shorthand for ``PyErr_SetObject(type, Py_None)``." msgstr "" -#: c-api/exceptions.rst:156 +#: c-api/exceptions.rst:169 msgid "" "This is a shorthand for ``PyErr_SetString(PyExc_TypeError, message)``, where " "*message* indicates that a built-in operation was invoked with an illegal " "argument. It is mostly for internal use." msgstr "" -#: c-api/exceptions.rst:163 +#: c-api/exceptions.rst:176 msgid "" "This is a shorthand for ``PyErr_SetNone(PyExc_MemoryError)``; it returns " "``NULL`` so an object allocation function can write ``return " "PyErr_NoMemory();`` when it runs out of memory." msgstr "" -#: c-api/exceptions.rst:172 +#: c-api/exceptions.rst:185 msgid "" "This is a convenience function to raise an exception when a C library " "function has returned an error and set the C variable :c:data:`errno`. It " @@ -216,7 +226,7 @@ msgid "" "``return PyErr_SetFromErrno(type);`` when the system call returns an error." msgstr "" -#: c-api/exceptions.rst:186 +#: c-api/exceptions.rst:199 msgid "" "Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that " "if *filenameObject* is not ``NULL``, it is passed to the constructor of " @@ -224,44 +234,45 @@ msgid "" "is used to define the :attr:`!filename` attribute of the exception instance." msgstr "" -#: c-api/exceptions.rst:195 +#: c-api/exceptions.rst:208 msgid "" "Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but takes a " "second filename object, for raising errors when a function that takes two " "filenames fails." msgstr "" -#: c-api/exceptions.rst:204 +#: c-api/exceptions.rst:217 msgid "" "Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but the filename " "is given as a C string. *filename* is decoded from the :term:`filesystem " "encoding and error handler`." msgstr "" -#: c-api/exceptions.rst:211 +#: c-api/exceptions.rst:224 msgid "" -"This is a convenience function to raise :exc:`WindowsError`. If called with " +"This is a convenience function to raise :exc:`OSError`. If called with " "*ierr* of ``0``, the error code returned by a call to :c:func:`!" "GetLastError` is used instead. It calls the Win32 function :c:func:`!" "FormatMessage` to retrieve the Windows description of error code given by " -"*ierr* or :c:func:`!GetLastError`, then it constructs a tuple object whose " -"first item is the *ierr* value and whose second item is the corresponding " -"error message (gotten from :c:func:`!FormatMessage`), and then calls " -"``PyErr_SetObject(PyExc_WindowsError, object)``. This function always " -"returns ``NULL``." +"*ierr* or :c:func:`!GetLastError`, then it constructs a :exc:`OSError` " +"object with the :attr:`~OSError.winerror` attribute set to the error code, " +"the :attr:`~OSError.strerror` attribute set to the corresponding error " +"message (gotten from :c:func:`!FormatMessage`), and then calls " +"``PyErr_SetObject(PyExc_OSError, object)``. This function always returns " +"``NULL``." msgstr "" -#: c-api/exceptions.rst:228 c-api/exceptions.rst:249 c-api/exceptions.rst:267 -msgid ":ref:`Availability `: Windows." +#: c-api/exceptions.rst:242 c-api/exceptions.rst:263 c-api/exceptions.rst:281 +msgid "Availability" msgstr "" -#: c-api/exceptions.rst:225 +#: c-api/exceptions.rst:239 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErr`, with an additional parameter " "specifying the exception type to be raised." msgstr "" -#: c-api/exceptions.rst:233 +#: c-api/exceptions.rst:247 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior " "that if *filename* is not ``NULL``, it is decoded from the filesystem " @@ -270,7 +281,7 @@ msgid "" "attribute of the exception instance." msgstr "" -#: c-api/exceptions.rst:244 +#: c-api/exceptions.rst:258 msgid "" "Similar to :c:func:`PyErr_SetExcFromWindowsErr`, with the additional " "behavior that if *filename* is not ``NULL``, it is passed to the constructor " @@ -278,19 +289,19 @@ msgid "" "filename` attribute of the exception instance." msgstr "" -#: c-api/exceptions.rst:254 +#: c-api/exceptions.rst:268 msgid "" "Similar to :c:func:`PyErr_SetExcFromWindowsErrWithFilenameObject`, but " "accepts a second filename object." msgstr "" -#: c-api/exceptions.rst:264 +#: c-api/exceptions.rst:278 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional " "parameter specifying the exception type to be raised." msgstr "" -#: c-api/exceptions.rst:272 +#: c-api/exceptions.rst:286 msgid "" "This is a convenience function to raise :exc:`ImportError`. *msg* will be " "set as the exception's message string. *name* and *path*, both of which can " @@ -298,13 +309,13 @@ msgid "" "``path`` attributes." msgstr "" -#: c-api/exceptions.rst:282 +#: c-api/exceptions.rst:296 msgid "" "Much like :c:func:`PyErr_SetImportError` but this function allows for " "specifying a subclass of :exc:`ImportError` to raise." msgstr "" -#: c-api/exceptions.rst:290 +#: c-api/exceptions.rst:304 msgid "" "Set file, line, and offset information for the current exception. If the " "current exception is not a :exc:`SyntaxError`, then it sets additional " @@ -312,19 +323,25 @@ msgid "" "is a :exc:`SyntaxError`." msgstr "" -#: c-api/exceptions.rst:300 +#: c-api/exceptions.rst:314 +msgid "" +"Similar to :c:func:`PyErr_SyntaxLocationObject`, but also sets the " +"*end_lineno* and *end_col_offset* information for the current exception." +msgstr "" + +#: c-api/exceptions.rst:322 msgid "" "Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string " "decoded from the :term:`filesystem encoding and error handler`." msgstr "" -#: c-api/exceptions.rst:308 +#: c-api/exceptions.rst:330 msgid "" "Like :c:func:`PyErr_SyntaxLocationEx`, but the *col_offset* parameter is " "omitted." msgstr "" -#: c-api/exceptions.rst:314 +#: c-api/exceptions.rst:336 msgid "" "This is a shorthand for ``PyErr_SetString(PyExc_SystemError, message)``, " "where *message* indicates that an internal operation (e.g. a Python/C API " @@ -332,11 +349,30 @@ msgid "" "use." msgstr "" -#: c-api/exceptions.rst:321 +#: c-api/exceptions.rst:344 +msgid "" +"Get the source line in *filename* at line *lineno*. *filename* should be a " +"Python :class:`str` object." +msgstr "" + +#: c-api/exceptions.rst:347 +msgid "" +"On success, this function returns a Python string object with the found " +"line. On failure, this function returns ``NULL`` without an exception set." +msgstr "" + +#: c-api/exceptions.rst:353 +msgid "" +"Similar to :c:func:`PyErr_ProgramTextObject`, but *filename* is a :c:expr:" +"`const char *`, which is decoded with the :term:`filesystem encoding and " +"error handler`, instead of a Python object reference." +msgstr "" + +#: c-api/exceptions.rst:360 msgid "Issuing warnings" msgstr "" -#: c-api/exceptions.rst:323 +#: c-api/exceptions.rst:362 msgid "" "Use these functions to issue warnings from C code. They mirror similar " "functions exported by the Python :mod:`warnings` module. They normally " @@ -352,7 +388,7 @@ msgid "" "return an error value)." msgstr "" -#: c-api/exceptions.rst:338 +#: c-api/exceptions.rst:377 msgid "" "Issue a warning message. The *category* argument is a warning category (see " "below) or ``NULL``; the *message* argument is a UTF-8 encoded string. " @@ -362,7 +398,7 @@ msgid "" "`PyErr_WarnEx`, 2 is the function above that, and so forth." msgstr "" -#: c-api/exceptions.rst:345 +#: c-api/exceptions.rst:384 msgid "" "Warning categories must be subclasses of :c:data:`PyExc_Warning`; :c:data:" "`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; the default " @@ -371,14 +407,14 @@ msgid "" "enumerated at :ref:`standardwarningcategories`." msgstr "" -#: c-api/exceptions.rst:351 +#: c-api/exceptions.rst:390 msgid "" "For information about warning control, see the documentation for the :mod:" "`warnings` module and the :option:`-W` option in the command line " "documentation. There is no C API for warning control." msgstr "" -#: c-api/exceptions.rst:358 +#: c-api/exceptions.rst:397 msgid "" "Issue a warning message with explicit control over all warning attributes. " "This is a straightforward wrapper around the Python function :func:`warnings." @@ -386,32 +422,39 @@ msgid "" "arguments may be set to ``NULL`` to get the default effect described there." msgstr "" -#: c-api/exceptions.rst:369 +#: c-api/exceptions.rst:408 msgid "" "Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and " "*module* are UTF-8 encoded strings, and *filename* is decoded from the :term:" "`filesystem encoding and error handler`." msgstr "" -#: c-api/exceptions.rst:376 +#: c-api/exceptions.rst:415 msgid "" "Function similar to :c:func:`PyErr_WarnEx`, but use :c:func:" "`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" "encoded string." msgstr "" -#: c-api/exceptions.rst:385 +#: c-api/exceptions.rst:424 +msgid "" +"Similar to :c:func:`PyErr_WarnExplicit`, but uses :c:func:" +"`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" +"encoded string." +msgstr "" + +#: c-api/exceptions.rst:433 msgid "" "Function similar to :c:func:`PyErr_WarnFormat`, but *category* is :exc:" "`ResourceWarning` and it passes *source* to :class:`!warnings." "WarningMessage`." msgstr "" -#: c-api/exceptions.rst:392 +#: c-api/exceptions.rst:440 msgid "Querying the error indicator" msgstr "" -#: c-api/exceptions.rst:396 +#: c-api/exceptions.rst:444 msgid "" "Test whether the error indicator is set. If set, return the exception " "*type* (the first argument to the last call to one of the ``PyErr_Set*`` " @@ -420,11 +463,11 @@ msgid "" "`Py_DECREF` it." msgstr "" -#: c-api/exceptions.rst:402 -msgid "The caller must hold the GIL." +#: c-api/exceptions.rst:450 +msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: c-api/exceptions.rst:406 +#: c-api/exceptions.rst:454 msgid "" "Do not compare the return value to a specific exception; use :c:func:" "`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily " @@ -432,14 +475,14 @@ msgid "" "of a class exception, or it may be a subclass of the expected exception.)" msgstr "" -#: c-api/exceptions.rst:414 +#: c-api/exceptions.rst:462 msgid "" "Equivalent to ``PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)``. This " "should only be called when an exception is actually set; a memory access " "violation will occur if no exception has been raised." msgstr "" -#: c-api/exceptions.rst:421 +#: c-api/exceptions.rst:469 msgid "" "Return true if the *given* exception matches the exception type in *exc*. " "If *exc* is a class object, this also returns true when *given* is an " @@ -447,43 +490,54 @@ msgid "" "tuple (and recursively in subtuples) are searched for a match." msgstr "" -#: c-api/exceptions.rst:429 +#: c-api/exceptions.rst:477 msgid "" "Return the exception currently being raised, clearing the error indicator at " "the same time. Return ``NULL`` if the error indicator is not set." msgstr "" -#: c-api/exceptions.rst:432 +#: c-api/exceptions.rst:480 msgid "" "This function is used by code that needs to catch exceptions, or code that " "needs to save and restore the error indicator temporarily." msgstr "" -#: c-api/exceptions.rst:479 +#: c-api/exceptions.rst:527 msgid "For example::" msgstr "" -#: c-api/exceptions.rst:445 +#: c-api/exceptions.rst:485 +msgid "" +"{\n" +" PyObject *exc = PyErr_GetRaisedException();\n" +"\n" +" /* ... code that might produce other errors ... */\n" +"\n" +" PyErr_SetRaisedException(exc);\n" +"}" +msgstr "" + +#: c-api/exceptions.rst:493 msgid "" ":c:func:`PyErr_GetHandledException`, to save the exception currently being " "handled." msgstr "" -#: c-api/exceptions.rst:453 +#: c-api/exceptions.rst:501 msgid "" "Set *exc* as the exception currently being raised, clearing the existing " "exception if one is set." msgstr "" -#: c-api/exceptions.rst:458 +#: c-api/exceptions.rst:506 msgid "This call steals a reference to *exc*, which must be a valid exception." msgstr "" -#: c-api/exceptions.rst:467 +#: c-api/exceptions.rst:515 msgid "Use :c:func:`PyErr_GetRaisedException` instead." msgstr "" -#: c-api/exceptions.rst:469 +#: c-api/exceptions.rst:517 msgid "" "Retrieve the error indicator into three variables whose addresses are " "passed. If the error indicator is not set, set all three variables to " @@ -492,17 +546,29 @@ msgid "" "the type object is not." msgstr "" -#: c-api/exceptions.rst:476 +#: c-api/exceptions.rst:524 msgid "" "This function is normally only used by legacy code that needs to catch " "exceptions or save and restore the error indicator temporarily." msgstr "" -#: c-api/exceptions.rst:495 +#: c-api/exceptions.rst:529 +msgid "" +"{\n" +" PyObject *type, *value, *traceback;\n" +" PyErr_Fetch(&type, &value, &traceback);\n" +"\n" +" /* ... code that might produce other errors ... */\n" +"\n" +" PyErr_Restore(type, value, traceback);\n" +"}" +msgstr "" + +#: c-api/exceptions.rst:543 msgid "Use :c:func:`PyErr_SetRaisedException` instead." msgstr "" -#: c-api/exceptions.rst:497 +#: c-api/exceptions.rst:545 msgid "" "Set the error indicator from the three objects, *type*, *value*, and " "*traceback*, clearing the existing exception if one is set. If the objects " @@ -515,20 +581,20 @@ msgid "" "don't use this function. I warned you.)" msgstr "" -#: c-api/exceptions.rst:511 +#: c-api/exceptions.rst:559 msgid "" "This function is normally only used by legacy code that needs to save and " "restore the error indicator temporarily. Use :c:func:`PyErr_Fetch` to save " "the current error indicator." msgstr "" -#: c-api/exceptions.rst:520 +#: c-api/exceptions.rst:568 msgid "" "Use :c:func:`PyErr_GetRaisedException` instead, to avoid any possible de-" "normalization." msgstr "" -#: c-api/exceptions.rst:523 +#: c-api/exceptions.rst:571 msgid "" "Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` " "below can be \"unnormalized\", meaning that ``*exc`` is a class object but " @@ -538,14 +604,21 @@ msgid "" "improve performance." msgstr "" -#: c-api/exceptions.rst:531 +#: c-api/exceptions.rst:579 msgid "" "This function *does not* implicitly set the :attr:`~BaseException." "__traceback__` attribute on the exception value. If setting the traceback " "appropriately is desired, the following additional snippet is needed::" msgstr "" -#: c-api/exceptions.rst:543 +#: c-api/exceptions.rst:584 +msgid "" +"if (tb != NULL) {\n" +" PyException_SetTraceback(val, tb);\n" +"}" +msgstr "" + +#: c-api/exceptions.rst:591 msgid "" "Retrieve the active exception instance, as would be returned by :func:`sys." "exception`. This refers to an exception that was *already caught*, not to an " @@ -553,7 +626,7 @@ msgid "" "or ``NULL``. Does not modify the interpreter's exception state." msgstr "" -#: c-api/exceptions.rst:550 +#: c-api/exceptions.rst:598 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -561,14 +634,14 @@ msgid "" "clear the exception state." msgstr "" -#: c-api/exceptions.rst:559 +#: c-api/exceptions.rst:607 msgid "" "Set the active exception, as known from ``sys.exception()``. This refers to " "an exception that was *already caught*, not to an exception that was freshly " "raised. To clear the exception state, pass ``NULL``." msgstr "" -#: c-api/exceptions.rst:566 +#: c-api/exceptions.rst:614 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -576,7 +649,7 @@ msgid "" "exception state." msgstr "" -#: c-api/exceptions.rst:575 +#: c-api/exceptions.rst:623 msgid "" "Retrieve the old-style representation of the exception info, as known from :" "func:`sys.exc_info`. This refers to an exception that was *already caught*, " @@ -586,7 +659,7 @@ msgid "" "using :c:func:`PyErr_GetHandledException`." msgstr "" -#: c-api/exceptions.rst:584 +#: c-api/exceptions.rst:632 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -594,7 +667,7 @@ msgid "" "exception state." msgstr "" -#: c-api/exceptions.rst:594 +#: c-api/exceptions.rst:642 msgid "" "Set the exception info, as known from ``sys.exc_info()``. This refers to an " "exception that was *already caught*, not to an exception that was freshly " @@ -604,7 +677,7 @@ msgid "" "`PyErr_SetHandledException`." msgstr "" -#: c-api/exceptions.rst:603 +#: c-api/exceptions.rst:651 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -612,22 +685,22 @@ msgid "" "state." msgstr "" -#: c-api/exceptions.rst:610 +#: c-api/exceptions.rst:658 msgid "" "The ``type`` and ``traceback`` arguments are no longer used and can be NULL. " "The interpreter now derives them from the exception instance (the ``value`` " "argument). The function still steals references of all three arguments." msgstr "" -#: c-api/exceptions.rst:618 +#: c-api/exceptions.rst:666 msgid "Signal Handling" msgstr "" -#: c-api/exceptions.rst:628 +#: c-api/exceptions.rst:676 msgid "This function interacts with Python's signal handling." msgstr "" -#: c-api/exceptions.rst:630 +#: c-api/exceptions.rst:678 msgid "" "If the function is called from the main thread and under the main Python " "interpreter, it checks whether a signal has been sent to the processes and " @@ -635,7 +708,7 @@ msgid "" "module is supported, this can invoke a signal handler written in Python." msgstr "" -#: c-api/exceptions.rst:635 +#: c-api/exceptions.rst:683 msgid "" "The function attempts to handle all pending signals, and then returns ``0``. " "However, if a Python signal handler raises an exception, the error indicator " @@ -644,44 +717,44 @@ msgid "" "`PyErr_CheckSignals()` invocation)." msgstr "" -#: c-api/exceptions.rst:641 +#: c-api/exceptions.rst:689 msgid "" "If the function is called from a non-main thread, or under a non-main Python " "interpreter, it does nothing and returns ``0``." msgstr "" -#: c-api/exceptions.rst:644 +#: c-api/exceptions.rst:692 msgid "" "This function can be called by long-running C code that wants to be " "interruptible by user requests (such as by pressing Ctrl-C)." msgstr "" -#: c-api/exceptions.rst:648 +#: c-api/exceptions.rst:696 msgid "" "The default Python signal handler for :c:macro:`!SIGINT` raises the :exc:" "`KeyboardInterrupt` exception." msgstr "" -#: c-api/exceptions.rst:659 +#: c-api/exceptions.rst:707 msgid "" "Simulate the effect of a :c:macro:`!SIGINT` signal arriving. This is " "equivalent to ``PyErr_SetInterruptEx(SIGINT)``." msgstr "" -#: c-api/exceptions.rst:690 +#: c-api/exceptions.rst:738 msgid "" -"This function is async-signal-safe. It can be called without the :term:" -"`GIL` and from a C signal handler." +"This function is async-signal-safe. It can be called without an :term:" +"`attached thread state` and from a C signal handler." msgstr "" -#: c-api/exceptions.rst:673 +#: c-api/exceptions.rst:721 msgid "" "Simulate the effect of a signal arriving. The next time :c:func:" "`PyErr_CheckSignals` is called, the Python signal handler for the given " "signal number will be called." msgstr "" -#: c-api/exceptions.rst:677 +#: c-api/exceptions.rst:725 msgid "" "This function can be called by C code that sets up its own signal handling " "and wants Python signal handlers to be invoked as expected when an " @@ -689,27 +762,27 @@ msgid "" "interrupt an operation)." msgstr "" -#: c-api/exceptions.rst:682 +#: c-api/exceptions.rst:730 msgid "" "If the given signal isn't handled by Python (it was set to :py:const:`signal." "SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be ignored." msgstr "" -#: c-api/exceptions.rst:685 +#: c-api/exceptions.rst:733 msgid "" "If *signum* is outside of the allowed range of signal numbers, ``-1`` is " "returned. Otherwise, ``0`` is returned. The error indicator is never " "changed by this function." msgstr "" -#: c-api/exceptions.rst:698 +#: c-api/exceptions.rst:746 msgid "" "This utility function specifies a file descriptor to which the signal number " "is written as a single byte whenever a signal is received. *fd* must be non-" "blocking. It returns the previous such file descriptor." msgstr "" -#: c-api/exceptions.rst:702 +#: c-api/exceptions.rst:750 msgid "" "The value ``-1`` disables the feature; this is the initial state. This is " "equivalent to :func:`signal.set_wakeup_fd` in Python, but without any error " @@ -717,15 +790,15 @@ msgid "" "be called from the main thread." msgstr "" -#: c-api/exceptions.rst:707 +#: c-api/exceptions.rst:755 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: c-api/exceptions.rst:712 +#: c-api/exceptions.rst:760 msgid "Exception Classes" msgstr "" -#: c-api/exceptions.rst:716 +#: c-api/exceptions.rst:764 msgid "" "This utility function creates and returns a new exception class. The *name* " "argument must be the name of the new exception, a C string of the form " @@ -734,41 +807,61 @@ msgid "" "(accessible in C as :c:data:`PyExc_Exception`)." msgstr "" -#: c-api/exceptions.rst:722 +#: c-api/exceptions.rst:770 msgid "" -"The :attr:`!__module__` attribute of the new class is set to the first part " -"(up to the last dot) of the *name* argument, and the class name is set to " -"the last part (after the last dot). The *base* argument can be used to " +"The :attr:`~type.__module__` attribute of the new class is set to the first " +"part (up to the last dot) of the *name* argument, and the class name is set " +"to the last part (after the last dot). The *base* argument can be used to " "specify alternate base classes; it can either be only one class or a tuple " "of classes. The *dict* argument can be used to specify a dictionary of class " "variables and methods." msgstr "" -#: c-api/exceptions.rst:731 +#: c-api/exceptions.rst:779 msgid "" "Same as :c:func:`PyErr_NewException`, except that the new exception class " "can easily be given a docstring: If *doc* is non-``NULL``, it will be used " "as the docstring for the exception class." msgstr "" -#: c-api/exceptions.rst:739 +#: c-api/exceptions.rst:788 +msgid "" +"Return non-zero if *ob* is an exception class, zero otherwise. This function " +"always succeeds." +msgstr "" + +#: c-api/exceptions.rst:793 +msgid "Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*." +msgstr "" + +#: c-api/exceptions.rst:797 msgid "Exception Objects" msgstr "" -#: c-api/exceptions.rst:743 +#: c-api/exceptions.rst:801 +msgid "" +"Return true if *op* is an instance of :class:`BaseException`, false " +"otherwise. This function always succeeds." +msgstr "" + +#: c-api/exceptions.rst:807 +msgid "Equivalent to :c:func:`Py_TYPE(op) `." +msgstr "" + +#: c-api/exceptions.rst:812 msgid "" "Return the traceback associated with the exception as a new reference, as " "accessible from Python through the :attr:`~BaseException.__traceback__` " "attribute. If there is no traceback associated, this returns ``NULL``." msgstr "" -#: c-api/exceptions.rst:751 +#: c-api/exceptions.rst:820 msgid "" "Set the traceback associated with the exception to *tb*. Use ``Py_None`` to " "clear it." msgstr "" -#: c-api/exceptions.rst:757 +#: c-api/exceptions.rst:826 msgid "" "Return the context (another exception instance during whose handling *ex* " "was raised) associated with the exception as a new reference, as accessible " @@ -776,14 +869,14 @@ msgid "" "there is no context associated, this returns ``NULL``." msgstr "" -#: c-api/exceptions.rst:765 +#: c-api/exceptions.rst:834 msgid "" "Set the context associated with the exception to *ctx*. Use ``NULL`` to " "clear it. There is no type check to make sure that *ctx* is an exception " "instance. This steals a reference to *ctx*." msgstr "" -#: c-api/exceptions.rst:772 +#: c-api/exceptions.rst:841 msgid "" "Return the cause (either an exception instance, or ``None``, set by " "``raise ... from ...``) associated with the exception as a new reference, as " @@ -791,28 +884,28 @@ msgid "" "attribute." msgstr "" -#: c-api/exceptions.rst:780 +#: c-api/exceptions.rst:849 msgid "" "Set the cause associated with the exception to *cause*. Use ``NULL`` to " "clear it. There is no type check to make sure that *cause* is either an " "exception instance or ``None``. This steals a reference to *cause*." msgstr "" -#: c-api/exceptions.rst:784 +#: c-api/exceptions.rst:853 msgid "" "The :attr:`~BaseException.__suppress_context__` attribute is implicitly set " "to ``True`` by this function." msgstr "" -#: c-api/exceptions.rst:790 +#: c-api/exceptions.rst:859 msgid "Return :attr:`~BaseException.args` of exception *ex*." msgstr "" -#: c-api/exceptions.rst:795 +#: c-api/exceptions.rst:864 msgid "Set :attr:`~BaseException.args` of exception *ex* to *args*." msgstr "" -#: c-api/exceptions.rst:799 +#: c-api/exceptions.rst:868 msgid "" "Implement part of the interpreter's implementation of :keyword:`!except*`. " "*orig* is the original exception that was caught, and *excs* is the list of " @@ -824,72 +917,98 @@ msgid "" "if there is nothing to reraise." msgstr "" -#: c-api/exceptions.rst:813 +#: c-api/exceptions.rst:882 msgid "Unicode Exception Objects" msgstr "" -#: c-api/exceptions.rst:815 +#: c-api/exceptions.rst:884 msgid "" "The following functions are used to create and modify Unicode exceptions " "from C." msgstr "" -#: c-api/exceptions.rst:819 +#: c-api/exceptions.rst:888 msgid "" "Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, " "*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " "UTF-8 encoded strings." msgstr "" -#: c-api/exceptions.rst:826 +#: c-api/exceptions.rst:895 msgid "Return the *encoding* attribute of the given exception object." msgstr "" -#: c-api/exceptions.rst:832 +#: c-api/exceptions.rst:901 msgid "Return the *object* attribute of the given exception object." msgstr "" -#: c-api/exceptions.rst:838 +#: c-api/exceptions.rst:907 msgid "" "Get the *start* attribute of the given exception object and place it into " "*\\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` " "on failure." msgstr "" -#: c-api/exceptions.rst:846 +#: c-api/exceptions.rst:911 msgid "" -"Set the *start* attribute of the given exception object to *start*. Return " +"If the :attr:`UnicodeError.object` is an empty sequence, the resulting " +"*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``." +msgstr "" + +#: c-api/exceptions.rst:914 +msgid ":attr:`UnicodeError.start`" +msgstr "" + +#: c-api/exceptions.rst:920 +msgid "" +"Set the *start* attribute of the given exception object to *start*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: c-api/exceptions.rst:853 +#: c-api/exceptions.rst:925 +msgid "" +"While passing a negative *start* does not raise an exception, the " +"corresponding getters will not consider it as a relative offset." +msgstr "" + +#: c-api/exceptions.rst:933 msgid "" "Get the *end* attribute of the given exception object and place it into " "*\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on " "failure." msgstr "" -#: c-api/exceptions.rst:861 +#: c-api/exceptions.rst:937 +msgid "" +"If the :attr:`UnicodeError.object` is an empty sequence, the resulting *end* " +"is ``0``. Otherwise, it is clipped to ``[1, len(object)]``." +msgstr "" + +#: c-api/exceptions.rst:944 msgid "" "Set the *end* attribute of the given exception object to *end*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: c-api/exceptions.rst:868 +#: c-api/exceptions.rst:947 +msgid ":attr:`UnicodeError.end`" +msgstr "" + +#: c-api/exceptions.rst:953 msgid "Return the *reason* attribute of the given exception object." msgstr "" -#: c-api/exceptions.rst:874 +#: c-api/exceptions.rst:959 msgid "" "Set the *reason* attribute of the given exception object to *reason*. " "Return ``0`` on success, ``-1`` on failure." msgstr "" -#: c-api/exceptions.rst:881 +#: c-api/exceptions.rst:966 msgid "Recursion Control" msgstr "" -#: c-api/exceptions.rst:883 +#: c-api/exceptions.rst:968 msgid "" "These two functions provide a way to perform safe recursive calls at the C " "level, both in the core and in extension modules. They are needed if the " @@ -899,44 +1018,41 @@ msgid "" "recursion handling." msgstr "" -#: c-api/exceptions.rst:892 +#: c-api/exceptions.rst:977 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "" -#: c-api/exceptions.rst:894 +#: c-api/exceptions.rst:979 msgid "" -"If :c:macro:`!USE_STACKCHECK` is defined, this function checks if the OS " -"stack overflowed using :c:func:`PyOS_CheckStack`. If this is the case, it " -"sets a :exc:`MemoryError` and returns a nonzero value." -msgstr "" - -#: c-api/exceptions.rst:898 -msgid "" -"The function then checks if the recursion limit is reached. If this is the " +"The function then checks if the stack limit is reached. If this is the " "case, a :exc:`RecursionError` is set and a nonzero value is returned. " "Otherwise, zero is returned." msgstr "" -#: c-api/exceptions.rst:902 +#: c-api/exceptions.rst:983 msgid "" "*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` " "to be concatenated to the :exc:`RecursionError` message caused by the " "recursion depth limit." msgstr "" -#: c-api/exceptions.rst:914 +#: c-api/exceptions.rst:988 +msgid "The :c:func:`PyUnstable_ThreadState_SetStackProtection` function." +msgstr "" + +#: c-api/exceptions.rst:998 msgid "" "This function is now also available in the :ref:`limited API `." msgstr "" -#: c-api/exceptions.rst:911 +#: c-api/exceptions.rst:995 msgid "" "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " "*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -#: c-api/exceptions.rst:917 +#: c-api/exceptions.rst:1001 msgid "" "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " "requires special recursion handling. In addition to protecting the stack, :" @@ -945,13 +1061,13 @@ msgid "" "Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." msgstr "" -#: c-api/exceptions.rst:925 +#: c-api/exceptions.rst:1009 msgid "" "Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` " "implementation to detect cycles." msgstr "" -#: c-api/exceptions.rst:928 +#: c-api/exceptions.rst:1012 msgid "" "If the object has already been processed, the function returns a positive " "integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " @@ -959,479 +1075,298 @@ msgid "" "`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." msgstr "" -#: c-api/exceptions.rst:934 +#: c-api/exceptions.rst:1018 msgid "" "The function will return a negative integer if the recursion limit is " "reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " "should typically return ``NULL``." msgstr "" -#: c-api/exceptions.rst:938 +#: c-api/exceptions.rst:1022 msgid "" "Otherwise, the function returns zero and the :c:member:`~PyTypeObject." "tp_repr` implementation can continue normally." msgstr "" -#: c-api/exceptions.rst:943 +#: c-api/exceptions.rst:1027 msgid "" "Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :" "c:func:`Py_ReprEnter` that returns zero." msgstr "" -#: c-api/exceptions.rst:950 -msgid "Standard Exceptions" +#: c-api/exceptions.rst:1032 +msgid "" +"Get the recursion limit for the current interpreter. It can be set with :c:" +"func:`Py_SetRecursionLimit`. The recursion limit prevents the Python " +"interpreter stack from growing infinitely." msgstr "" -#: c-api/exceptions.rst:952 +#: c-api/exceptions.rst:1046 msgid "" -"All standard Python exceptions are available as global variables whose names " -"are ``PyExc_`` followed by the Python exception name. These have the type :" -"c:expr:`PyObject*`; they are all class objects. For completeness, here are " -"all the variables:" +"This function cannot fail, and the caller must hold an :term:`attached " +"thread state`." msgstr "" -#: c-api/exceptions.rst:1146 c-api/exceptions.rst:1191 -msgid "C Name" +#: c-api/exceptions.rst:1040 +msgid ":py:func:`sys.getrecursionlimit`" msgstr "" -#: c-api/exceptions.rst:1191 -msgid "Python Name" +#: c-api/exceptions.rst:1044 +msgid "Set the recursion limit for the current interpreter." msgstr "" -#: c-api/exceptions.rst:1146 c-api/exceptions.rst:1191 -msgid "Notes" +#: c-api/exceptions.rst:1050 +msgid ":py:func:`sys.setrecursionlimit`" msgstr "" -#: c-api/exceptions.rst:1015 -msgid ":c:data:`PyExc_BaseException`" +#: c-api/exceptions.rst:1055 +msgid "Exception and warning types" msgstr "" -#: c-api/exceptions.rst:1015 -msgid ":exc:`BaseException`" +#: c-api/exceptions.rst:1057 +msgid "" +"All standard Python exceptions and warning categories are available as " +"global variables whose names are ``PyExc_`` followed by the Python exception " +"name. These have the type :c:expr:`PyObject*`; they are all class objects." msgstr "" -#: c-api/exceptions.rst:1017 c-api/exceptions.rst:1065 -#: c-api/exceptions.rst:1077 -msgid "[1]_" +#: c-api/exceptions.rst:1061 +msgid "For completeness, here are all the variables:" msgstr "" -#: c-api/exceptions.rst:1017 -msgid ":c:data:`PyExc_Exception`" +#: c-api/exceptions.rst:1064 +msgid "Exception types" msgstr "" -#: c-api/exceptions.rst:1017 -msgid ":exc:`Exception`" +#: c-api/exceptions.rst:1217 c-api/exceptions.rst:1247 +msgid "C name" msgstr "" -#: c-api/exceptions.rst:1019 -msgid ":c:data:`PyExc_ArithmeticError`" +#: c-api/exceptions.rst:1218 c-api/exceptions.rst:1248 +msgid "Python name" msgstr "" -#: c-api/exceptions.rst:1019 -msgid ":exc:`ArithmeticError`" +#: c-api/exceptions.rst:1074 +msgid ":exc:`BaseException`" msgstr "" -#: c-api/exceptions.rst:1021 -msgid ":c:data:`PyExc_AssertionError`" +#: c-api/exceptions.rst:1076 +msgid ":exc:`BaseExceptionGroup`" msgstr "" -#: c-api/exceptions.rst:1021 -msgid ":exc:`AssertionError`" +#: c-api/exceptions.rst:1078 +msgid ":exc:`Exception`" msgstr "" -#: c-api/exceptions.rst:1023 -msgid ":c:data:`PyExc_AttributeError`" +#: c-api/exceptions.rst:1080 +msgid ":exc:`ArithmeticError`" msgstr "" -#: c-api/exceptions.rst:1023 -msgid ":exc:`AttributeError`" +#: c-api/exceptions.rst:1082 +msgid ":exc:`AssertionError`" msgstr "" -#: c-api/exceptions.rst:1025 -msgid ":c:data:`PyExc_BlockingIOError`" +#: c-api/exceptions.rst:1084 +msgid ":exc:`AttributeError`" msgstr "" -#: c-api/exceptions.rst:1025 +#: c-api/exceptions.rst:1086 msgid ":exc:`BlockingIOError`" msgstr "" -#: c-api/exceptions.rst:1027 -msgid ":c:data:`PyExc_BrokenPipeError`" -msgstr "" - -#: c-api/exceptions.rst:1027 +#: c-api/exceptions.rst:1088 msgid ":exc:`BrokenPipeError`" msgstr "" -#: c-api/exceptions.rst:1029 -msgid ":c:data:`PyExc_BufferError`" -msgstr "" - -#: c-api/exceptions.rst:1029 +#: c-api/exceptions.rst:1090 msgid ":exc:`BufferError`" msgstr "" -#: c-api/exceptions.rst:1031 -msgid ":c:data:`PyExc_ChildProcessError`" -msgstr "" - -#: c-api/exceptions.rst:1031 +#: c-api/exceptions.rst:1092 msgid ":exc:`ChildProcessError`" msgstr "" -#: c-api/exceptions.rst:1033 -msgid ":c:data:`PyExc_ConnectionAbortedError`" -msgstr "" - -#: c-api/exceptions.rst:1033 +#: c-api/exceptions.rst:1094 msgid ":exc:`ConnectionAbortedError`" msgstr "" -#: c-api/exceptions.rst:1035 -msgid ":c:data:`PyExc_ConnectionError`" -msgstr "" - -#: c-api/exceptions.rst:1035 +#: c-api/exceptions.rst:1096 msgid ":exc:`ConnectionError`" msgstr "" -#: c-api/exceptions.rst:1037 -msgid ":c:data:`PyExc_ConnectionRefusedError`" -msgstr "" - -#: c-api/exceptions.rst:1037 +#: c-api/exceptions.rst:1098 msgid ":exc:`ConnectionRefusedError`" msgstr "" -#: c-api/exceptions.rst:1039 -msgid ":c:data:`PyExc_ConnectionResetError`" -msgstr "" - -#: c-api/exceptions.rst:1039 +#: c-api/exceptions.rst:1100 msgid ":exc:`ConnectionResetError`" msgstr "" -#: c-api/exceptions.rst:1041 -msgid ":c:data:`PyExc_EOFError`" -msgstr "" - -#: c-api/exceptions.rst:1041 +#: c-api/exceptions.rst:1102 msgid ":exc:`EOFError`" msgstr "" -#: c-api/exceptions.rst:1043 -msgid ":c:data:`PyExc_FileExistsError`" -msgstr "" - -#: c-api/exceptions.rst:1043 +#: c-api/exceptions.rst:1104 msgid ":exc:`FileExistsError`" msgstr "" -#: c-api/exceptions.rst:1045 -msgid ":c:data:`PyExc_FileNotFoundError`" -msgstr "" - -#: c-api/exceptions.rst:1045 +#: c-api/exceptions.rst:1106 msgid ":exc:`FileNotFoundError`" msgstr "" -#: c-api/exceptions.rst:1047 -msgid ":c:data:`PyExc_FloatingPointError`" -msgstr "" - -#: c-api/exceptions.rst:1047 +#: c-api/exceptions.rst:1108 msgid ":exc:`FloatingPointError`" msgstr "" -#: c-api/exceptions.rst:1049 -msgid ":c:data:`PyExc_GeneratorExit`" -msgstr "" - -#: c-api/exceptions.rst:1049 +#: c-api/exceptions.rst:1110 msgid ":exc:`GeneratorExit`" msgstr "" -#: c-api/exceptions.rst:1051 -msgid ":c:data:`PyExc_ImportError`" -msgstr "" - -#: c-api/exceptions.rst:1051 +#: c-api/exceptions.rst:1112 msgid ":exc:`ImportError`" msgstr "" -#: c-api/exceptions.rst:1053 -msgid ":c:data:`PyExc_IndentationError`" -msgstr "" - -#: c-api/exceptions.rst:1053 +#: c-api/exceptions.rst:1114 msgid ":exc:`IndentationError`" msgstr "" -#: c-api/exceptions.rst:1055 -msgid ":c:data:`PyExc_IndexError`" -msgstr "" - -#: c-api/exceptions.rst:1055 +#: c-api/exceptions.rst:1116 msgid ":exc:`IndexError`" msgstr "" -#: c-api/exceptions.rst:1057 -msgid ":c:data:`PyExc_InterruptedError`" -msgstr "" - -#: c-api/exceptions.rst:1057 +#: c-api/exceptions.rst:1118 msgid ":exc:`InterruptedError`" msgstr "" -#: c-api/exceptions.rst:1059 -msgid ":c:data:`PyExc_IsADirectoryError`" -msgstr "" - -#: c-api/exceptions.rst:1059 +#: c-api/exceptions.rst:1120 msgid ":exc:`IsADirectoryError`" msgstr "" -#: c-api/exceptions.rst:1061 -msgid ":c:data:`PyExc_KeyError`" -msgstr "" - -#: c-api/exceptions.rst:1061 +#: c-api/exceptions.rst:1122 msgid ":exc:`KeyError`" msgstr "" -#: c-api/exceptions.rst:1063 -msgid ":c:data:`PyExc_KeyboardInterrupt`" -msgstr "" - -#: c-api/exceptions.rst:1063 +#: c-api/exceptions.rst:1124 msgid ":exc:`KeyboardInterrupt`" msgstr "" -#: c-api/exceptions.rst:1065 -msgid ":c:data:`PyExc_LookupError`" -msgstr "" - -#: c-api/exceptions.rst:1065 +#: c-api/exceptions.rst:1126 msgid ":exc:`LookupError`" msgstr "" -#: c-api/exceptions.rst:1067 -msgid ":c:data:`PyExc_MemoryError`" -msgstr "" - -#: c-api/exceptions.rst:1067 +#: c-api/exceptions.rst:1128 msgid ":exc:`MemoryError`" msgstr "" -#: c-api/exceptions.rst:1069 -msgid ":c:data:`PyExc_ModuleNotFoundError`" -msgstr "" - -#: c-api/exceptions.rst:1069 +#: c-api/exceptions.rst:1130 msgid ":exc:`ModuleNotFoundError`" msgstr "" -#: c-api/exceptions.rst:1071 -msgid ":c:data:`PyExc_NameError`" -msgstr "" - -#: c-api/exceptions.rst:1071 +#: c-api/exceptions.rst:1132 msgid ":exc:`NameError`" msgstr "" -#: c-api/exceptions.rst:1073 -msgid ":c:data:`PyExc_NotADirectoryError`" -msgstr "" - -#: c-api/exceptions.rst:1073 +#: c-api/exceptions.rst:1134 msgid ":exc:`NotADirectoryError`" msgstr "" -#: c-api/exceptions.rst:1075 -msgid ":c:data:`PyExc_NotImplementedError`" -msgstr "" - -#: c-api/exceptions.rst:1075 +#: c-api/exceptions.rst:1136 msgid ":exc:`NotImplementedError`" msgstr "" -#: c-api/exceptions.rst:1077 -msgid ":c:data:`PyExc_OSError`" -msgstr "" - -#: c-api/exceptions.rst:1077 +#: c-api/exceptions.rst:1221 c-api/exceptions.rst:1227 msgid ":exc:`OSError`" msgstr "" -#: c-api/exceptions.rst:1079 -msgid ":c:data:`PyExc_OverflowError`" -msgstr "" - -#: c-api/exceptions.rst:1079 +#: c-api/exceptions.rst:1140 msgid ":exc:`OverflowError`" msgstr "" -#: c-api/exceptions.rst:1081 -msgid ":c:data:`PyExc_PermissionError`" -msgstr "" - -#: c-api/exceptions.rst:1081 +#: c-api/exceptions.rst:1142 msgid ":exc:`PermissionError`" msgstr "" -#: c-api/exceptions.rst:1083 -msgid ":c:data:`PyExc_ProcessLookupError`" -msgstr "" - -#: c-api/exceptions.rst:1083 +#: c-api/exceptions.rst:1144 msgid ":exc:`ProcessLookupError`" msgstr "" -#: c-api/exceptions.rst:1085 -msgid ":c:data:`PyExc_RecursionError`" +#: c-api/exceptions.rst:1146 +msgid ":exc:`PythonFinalizationError`" msgstr "" -#: c-api/exceptions.rst:1085 +#: c-api/exceptions.rst:1148 msgid ":exc:`RecursionError`" msgstr "" -#: c-api/exceptions.rst:1087 -msgid ":c:data:`PyExc_ReferenceError`" -msgstr "" - -#: c-api/exceptions.rst:1087 +#: c-api/exceptions.rst:1150 msgid ":exc:`ReferenceError`" msgstr "" -#: c-api/exceptions.rst:1089 -msgid ":c:data:`PyExc_RuntimeError`" -msgstr "" - -#: c-api/exceptions.rst:1089 +#: c-api/exceptions.rst:1152 msgid ":exc:`RuntimeError`" msgstr "" -#: c-api/exceptions.rst:1091 -msgid ":c:data:`PyExc_StopAsyncIteration`" -msgstr "" - -#: c-api/exceptions.rst:1091 +#: c-api/exceptions.rst:1154 msgid ":exc:`StopAsyncIteration`" msgstr "" -#: c-api/exceptions.rst:1093 -msgid ":c:data:`PyExc_StopIteration`" -msgstr "" - -#: c-api/exceptions.rst:1093 +#: c-api/exceptions.rst:1156 msgid ":exc:`StopIteration`" msgstr "" -#: c-api/exceptions.rst:1095 -msgid ":c:data:`PyExc_SyntaxError`" -msgstr "" - -#: c-api/exceptions.rst:1095 +#: c-api/exceptions.rst:1158 msgid ":exc:`SyntaxError`" msgstr "" -#: c-api/exceptions.rst:1097 -msgid ":c:data:`PyExc_SystemError`" -msgstr "" - -#: c-api/exceptions.rst:1097 +#: c-api/exceptions.rst:1160 msgid ":exc:`SystemError`" msgstr "" -#: c-api/exceptions.rst:1099 -msgid ":c:data:`PyExc_SystemExit`" -msgstr "" - -#: c-api/exceptions.rst:1099 +#: c-api/exceptions.rst:1162 msgid ":exc:`SystemExit`" msgstr "" -#: c-api/exceptions.rst:1101 -msgid ":c:data:`PyExc_TabError`" -msgstr "" - -#: c-api/exceptions.rst:1101 +#: c-api/exceptions.rst:1164 msgid ":exc:`TabError`" msgstr "" -#: c-api/exceptions.rst:1103 -msgid ":c:data:`PyExc_TimeoutError`" -msgstr "" - -#: c-api/exceptions.rst:1103 +#: c-api/exceptions.rst:1166 msgid ":exc:`TimeoutError`" msgstr "" -#: c-api/exceptions.rst:1105 -msgid ":c:data:`PyExc_TypeError`" -msgstr "" - -#: c-api/exceptions.rst:1105 +#: c-api/exceptions.rst:1168 msgid ":exc:`TypeError`" msgstr "" -#: c-api/exceptions.rst:1107 -msgid ":c:data:`PyExc_UnboundLocalError`" -msgstr "" - -#: c-api/exceptions.rst:1107 +#: c-api/exceptions.rst:1170 msgid ":exc:`UnboundLocalError`" msgstr "" -#: c-api/exceptions.rst:1109 -msgid ":c:data:`PyExc_UnicodeDecodeError`" -msgstr "" - -#: c-api/exceptions.rst:1109 +#: c-api/exceptions.rst:1172 msgid ":exc:`UnicodeDecodeError`" msgstr "" -#: c-api/exceptions.rst:1111 -msgid ":c:data:`PyExc_UnicodeEncodeError`" -msgstr "" - -#: c-api/exceptions.rst:1111 +#: c-api/exceptions.rst:1174 msgid ":exc:`UnicodeEncodeError`" msgstr "" -#: c-api/exceptions.rst:1113 -msgid ":c:data:`PyExc_UnicodeError`" -msgstr "" - -#: c-api/exceptions.rst:1113 +#: c-api/exceptions.rst:1176 msgid ":exc:`UnicodeError`" msgstr "" -#: c-api/exceptions.rst:1115 -msgid ":c:data:`PyExc_UnicodeTranslateError`" -msgstr "" - -#: c-api/exceptions.rst:1115 +#: c-api/exceptions.rst:1178 msgid ":exc:`UnicodeTranslateError`" msgstr "" -#: c-api/exceptions.rst:1117 -msgid ":c:data:`PyExc_ValueError`" -msgstr "" - -#: c-api/exceptions.rst:1117 +#: c-api/exceptions.rst:1180 msgid ":exc:`ValueError`" msgstr "" -#: c-api/exceptions.rst:1119 -msgid ":c:data:`PyExc_ZeroDivisionError`" -msgstr "" - -#: c-api/exceptions.rst:1119 +#: c-api/exceptions.rst:1182 msgid ":exc:`ZeroDivisionError`" msgstr "" -#: c-api/exceptions.rst:1122 +#: c-api/exceptions.rst:1184 msgid "" ":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" "`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" @@ -1443,448 +1378,160 @@ msgid "" "`PyExc_TimeoutError` were introduced following :pep:`3151`." msgstr "" -#: c-api/exceptions.rst:1132 +#: c-api/exceptions.rst:1194 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr "" -#: c-api/exceptions.rst:1135 +#: c-api/exceptions.rst:1197 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr "" -#: c-api/exceptions.rst:1138 -msgid "These are compatibility aliases to :c:data:`PyExc_OSError`:" +#: c-api/exceptions.rst:1200 +msgid ":c:data:`PyExc_BaseExceptionGroup`." msgstr "" -#: c-api/exceptions.rst:1148 -msgid ":c:data:`!PyExc_EnvironmentError`" -msgstr "" - -#: c-api/exceptions.rst:1150 -msgid ":c:data:`!PyExc_IOError`" -msgstr "" - -#: c-api/exceptions.rst:1152 -msgid ":c:data:`!PyExc_WindowsError`" +#: c-api/exceptions.rst:1205 +msgid "OSError aliases" msgstr "" -#: c-api/exceptions.rst:1152 -msgid "[2]_" +#: c-api/exceptions.rst:1207 +msgid "The following are a compatibility aliases to :c:data:`PyExc_OSError`." msgstr "" -#: c-api/exceptions.rst:1155 +#: c-api/exceptions.rst:1209 msgid "These aliases used to be separate exception types." msgstr "" #: c-api/exceptions.rst:1219 -msgid "Notes:" +msgid "Notes" msgstr "" -#: c-api/exceptions.rst:1161 -msgid "This is a base class for other standard exceptions." +#: c-api/exceptions.rst:1228 +msgid "[win]_" msgstr "" -#: c-api/exceptions.rst:1164 -msgid "" -"Only defined on Windows; protect code that uses this by testing that the " -"preprocessor macro ``MS_WINDOWS`` is defined." -msgstr "" - -#: c-api/exceptions.rst:1170 -msgid "Standard Warning Categories" +#: c-api/exceptions.rst:1230 +msgid "Notes:" msgstr "" -#: c-api/exceptions.rst:1172 +#: c-api/exceptions.rst:1233 msgid "" -"All standard Python warning categories are available as global variables " -"whose names are ``PyExc_`` followed by the Python exception name. These have " -"the type :c:expr:`PyObject*`; they are all class objects. For completeness, " -"here are all the variables:" +":c:var:`!PyExc_WindowsError` is only defined on Windows; protect code that " +"uses this by testing that the preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" -#: c-api/exceptions.rst:1193 -msgid ":c:data:`PyExc_Warning`" +#: c-api/exceptions.rst:1240 +msgid "Warning types" msgstr "" -#: c-api/exceptions.rst:1193 +#: c-api/exceptions.rst:1250 msgid ":exc:`Warning`" msgstr "" -#: c-api/exceptions.rst:1193 -msgid "[3]_" -msgstr "" - -#: c-api/exceptions.rst:1195 -msgid ":c:data:`PyExc_BytesWarning`" -msgstr "" - -#: c-api/exceptions.rst:1195 +#: c-api/exceptions.rst:1252 msgid ":exc:`BytesWarning`" msgstr "" -#: c-api/exceptions.rst:1197 -msgid ":c:data:`PyExc_DeprecationWarning`" -msgstr "" - -#: c-api/exceptions.rst:1197 +#: c-api/exceptions.rst:1254 msgid ":exc:`DeprecationWarning`" msgstr "" -#: c-api/exceptions.rst:1199 -msgid ":c:data:`PyExc_FutureWarning`" +#: c-api/exceptions.rst:1256 +msgid ":exc:`EncodingWarning`" msgstr "" -#: c-api/exceptions.rst:1199 +#: c-api/exceptions.rst:1258 msgid ":exc:`FutureWarning`" msgstr "" -#: c-api/exceptions.rst:1201 -msgid ":c:data:`PyExc_ImportWarning`" -msgstr "" - -#: c-api/exceptions.rst:1201 +#: c-api/exceptions.rst:1260 msgid ":exc:`ImportWarning`" msgstr "" -#: c-api/exceptions.rst:1203 -msgid ":c:data:`PyExc_PendingDeprecationWarning`" -msgstr "" - -#: c-api/exceptions.rst:1203 +#: c-api/exceptions.rst:1262 msgid ":exc:`PendingDeprecationWarning`" msgstr "" -#: c-api/exceptions.rst:1205 -msgid ":c:data:`PyExc_ResourceWarning`" -msgstr "" - -#: c-api/exceptions.rst:1205 +#: c-api/exceptions.rst:1264 msgid ":exc:`ResourceWarning`" msgstr "" -#: c-api/exceptions.rst:1207 -msgid ":c:data:`PyExc_RuntimeWarning`" -msgstr "" - -#: c-api/exceptions.rst:1207 +#: c-api/exceptions.rst:1266 msgid ":exc:`RuntimeWarning`" msgstr "" -#: c-api/exceptions.rst:1209 -msgid ":c:data:`PyExc_SyntaxWarning`" -msgstr "" - -#: c-api/exceptions.rst:1209 +#: c-api/exceptions.rst:1268 msgid ":exc:`SyntaxWarning`" msgstr "" -#: c-api/exceptions.rst:1211 -msgid ":c:data:`PyExc_UnicodeWarning`" -msgstr "" - -#: c-api/exceptions.rst:1211 +#: c-api/exceptions.rst:1270 msgid ":exc:`UnicodeWarning`" msgstr "" -#: c-api/exceptions.rst:1213 -msgid ":c:data:`PyExc_UserWarning`" -msgstr "" - -#: c-api/exceptions.rst:1213 +#: c-api/exceptions.rst:1272 msgid ":exc:`UserWarning`" msgstr "" -#: c-api/exceptions.rst:1216 +#: c-api/exceptions.rst:1274 msgid ":c:data:`PyExc_ResourceWarning`." msgstr "" -#: c-api/exceptions.rst:1222 -msgid "This is a base class for other standard warning categories." -msgstr "" - -#: c-api/exceptions.rst:170 -msgid "strerror (C function)" -msgstr "" - -#: c-api/exceptions.rst:654 c-api/exceptions.rst:669 -msgid "module" -msgstr "" - -#: c-api/exceptions.rst:654 c-api/exceptions.rst:669 -msgid "signal" -msgstr "" - -#: c-api/exceptions.rst:654 -msgid "SIGINT (C macro)" -msgstr "" - -#: c-api/exceptions.rst:654 c-api/exceptions.rst:669 -msgid "KeyboardInterrupt (built-in exception)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_BaseException (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_Exception (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ArithmeticError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_AssertionError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_AttributeError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_BlockingIOError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_BrokenPipeError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_BufferError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ChildProcessError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ConnectionAbortedError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ConnectionError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ConnectionRefusedError (C var)" +#: c-api/exceptions.rst:1277 +msgid ":c:data:`PyExc_EncodingWarning`." msgstr "" -#: c-api/exceptions.rst:957 -msgid "PyExc_ConnectionResetError (C var)" +#: c-api/exceptions.rst:1282 +msgid "Tracebacks" msgstr "" -#: c-api/exceptions.rst:957 -msgid "PyExc_EOFError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_FileExistsError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_FileNotFoundError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_FloatingPointError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_GeneratorExit (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ImportError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_IndentationError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_IndexError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_InterruptedError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_IsADirectoryError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_KeyError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_KeyboardInterrupt (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_LookupError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_MemoryError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ModuleNotFoundError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_NameError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_NotADirectoryError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_NotImplementedError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_OSError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_OverflowError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_PermissionError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ProcessLookupError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_RecursionError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ReferenceError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_RuntimeError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_StopAsyncIteration (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_StopIteration (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_SyntaxError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_SystemError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_SystemExit (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_TabError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_TimeoutError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_TypeError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_UnboundLocalError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_UnicodeDecodeError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_UnicodeEncodeError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_UnicodeError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_UnicodeTranslateError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ValueError (C var)" -msgstr "" - -#: c-api/exceptions.rst:957 -msgid "PyExc_ZeroDivisionError (C var)" -msgstr "" - -#: c-api/exceptions.rst:1140 -msgid "PyExc_EnvironmentError (C var)" -msgstr "" - -#: c-api/exceptions.rst:1140 -msgid "PyExc_IOError (C var)" -msgstr "" - -#: c-api/exceptions.rst:1140 -msgid "PyExc_WindowsError (C var)" -msgstr "" - -#: c-api/exceptions.rst:1177 -msgid "PyExc_Warning (C var)" +#: c-api/exceptions.rst:1286 +msgid "" +"Type object for traceback objects. This is available as :class:`types." +"TracebackType` in the Python layer." msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_BytesWarning (C var)" +#: c-api/exceptions.rst:1292 +msgid "" +"Return true if *op* is a traceback object, false otherwise. This function " +"does not account for subtypes." msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_DeprecationWarning (C var)" +#: c-api/exceptions.rst:1298 +msgid "" +"Replace the :attr:`~BaseException.__traceback__` attribute on the current " +"exception with a new traceback prepending *f* to the existing chain." msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_FutureWarning (C var)" +#: c-api/exceptions.rst:1301 +msgid "Calling this function without an exception set is undefined behavior." msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_ImportWarning (C var)" +#: c-api/exceptions.rst:1311 +msgid "" +"This function returns ``0`` on success, and returns ``-1`` with an exception " +"set on failure." msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_PendingDeprecationWarning (C var)" +#: c-api/exceptions.rst:1309 +msgid "Write the traceback *tb* into the file *f*." msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_ResourceWarning (C var)" +#: c-api/exceptions.rst:183 +msgid "strerror (C function)" msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_RuntimeWarning (C var)" +#: c-api/exceptions.rst:702 c-api/exceptions.rst:717 +msgid "module" msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_SyntaxWarning (C var)" +#: c-api/exceptions.rst:702 c-api/exceptions.rst:717 +msgid "signal" msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_UnicodeWarning (C var)" +#: c-api/exceptions.rst:702 +msgid "SIGINT (C macro)" msgstr "" -#: c-api/exceptions.rst:1177 -msgid "PyExc_UserWarning (C var)" +#: c-api/exceptions.rst:702 c-api/exceptions.rst:717 +msgid "KeyboardInterrupt (built-in exception)" msgstr "" diff --git a/c-api/extension-modules.po b/c-api/extension-modules.po new file mode 100644 index 00000000..2265fbce --- /dev/null +++ b/c-api/extension-modules.po @@ -0,0 +1,355 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: c-api/extension-modules.rst:6 +msgid "Defining extension modules" +msgstr "" + +#: c-api/extension-modules.rst:8 +msgid "" +"A C extension for CPython is a shared library (for example, a ``.so`` file " +"on Linux, ``.pyd`` DLL on Windows), which is loadable into the Python " +"process (for example, it is compiled with compatible compiler settings), and " +"which exports an :ref:`initialization function `." +msgstr "" + +#: c-api/extension-modules.rst:13 +msgid "" +"To be importable by default (that is, by :py:class:`importlib.machinery." +"ExtensionFileLoader`), the shared library must be available on :py:attr:`sys." +"path`, and must be named after the module name plus an extension listed in :" +"py:attr:`importlib.machinery.EXTENSION_SUFFIXES`." +msgstr "" + +#: c-api/extension-modules.rst:21 +msgid "" +"Building, packaging and distributing extension modules is best done with " +"third-party tools, and is out of scope of this document. One suitable tool " +"is Setuptools, whose documentation can be found at https://setuptools.pypa." +"io/en/latest/setuptools.html." +msgstr "" + +#: c-api/extension-modules.rst:26 +msgid "" +"Normally, the initialization function returns a module definition " +"initialized using :c:func:`PyModuleDef_Init`. This allows splitting the " +"creation process into several phases:" +msgstr "" + +#: c-api/extension-modules.rst:30 +msgid "" +"Before any substantial code is executed, Python can determine which " +"capabilities the module supports, and it can adjust the environment or " +"refuse loading an incompatible extension." +msgstr "" + +#: c-api/extension-modules.rst:33 +msgid "" +"By default, Python itself creates the module object -- that is, it does the " +"equivalent of :py:meth:`object.__new__` for classes. It also sets initial " +"attributes like :attr:`~module.__package__` and :attr:`~module.__loader__`." +msgstr "" + +#: c-api/extension-modules.rst:37 +msgid "" +"Afterwards, the module object is initialized using extension-specific code " +"-- the equivalent of :py:meth:`~object.__init__` on classes." +msgstr "" + +#: c-api/extension-modules.rst:40 +msgid "" +"This is called *multi-phase initialization* to distinguish it from the " +"legacy (but still supported) *single-phase initialization* scheme, where the " +"initialization function returns a fully constructed module. See the :ref:" +"`single-phase-initialization section below ` " +"for details." +msgstr "" + +#: c-api/extension-modules.rst:48 +msgid "Added support for multi-phase initialization (:pep:`489`)." +msgstr "" + +#: c-api/extension-modules.rst:52 +msgid "Multiple module instances" +msgstr "" + +#: c-api/extension-modules.rst:54 +msgid "" +"By default, extension modules are not singletons. For example, if the :py:" +"attr:`sys.modules` entry is removed and the module is re-imported, a new " +"module object is created, and typically populated with fresh method and type " +"objects. The old module is subject to normal garbage collection. This " +"mirrors the behavior of pure-Python modules." +msgstr "" + +#: c-api/extension-modules.rst:61 +msgid "" +"Additional module instances may be created in :ref:`sub-interpreters ` or after Python runtime reinitialization (:c:func:" +"`Py_Finalize` and :c:func:`Py_Initialize`). In these cases, sharing Python " +"objects between module instances would likely cause crashes or undefined " +"behavior." +msgstr "" + +#: c-api/extension-modules.rst:68 +msgid "" +"To avoid such issues, each instance of an extension module should be " +"*isolated*: changes to one instance should not implicitly affect the others, " +"and all state owned by the module, including references to Python objects, " +"should be specific to a particular module instance. See :ref:`isolating-" +"extensions-howto` for more details and a practical guide." +msgstr "" + +#: c-api/extension-modules.rst:74 +msgid "" +"A simpler way to avoid these issues is :ref:`raising an error on repeated " +"initialization `." +msgstr "" + +#: c-api/extension-modules.rst:77 +msgid "" +"All modules are expected to support :ref:`sub-interpreters `, or otherwise explicitly signal a lack of support. This is usually " +"achieved by isolation or blocking repeated initialization, as above. A " +"module may also be limited to the main interpreter using the :c:data:" +"`Py_mod_multiple_interpreters` slot." +msgstr "" + +#: c-api/extension-modules.rst:89 +msgid "Initialization function" +msgstr "" + +#: c-api/extension-modules.rst:91 +msgid "" +"The initialization function defined by an extension module has the following " +"signature:" +msgstr "" + +#: c-api/extension-modules.rst:96 +msgid "" +"Its name should be :samp:`PyInit_{}`, with ```` replaced by the " +"name of the module." +msgstr "" + +#: c-api/extension-modules.rst:99 +msgid "" +"For modules with ASCII-only names, the function must instead be named :samp:" +"`PyInit_{}`, with ```` replaced by the name of the module. When " +"using :ref:`multi-phase-initialization`, non-ASCII module names are allowed. " +"In this case, the initialization function name is :samp:`PyInitU_{}`, " +"with ```` encoded using Python's *punycode* encoding with hyphens " +"replaced by underscores. In Python:" +msgstr "" + +#: c-api/extension-modules.rst:106 +msgid "" +"def initfunc_name(name):\n" +" try:\n" +" suffix = b'_' + name.encode('ascii')\n" +" except UnicodeEncodeError:\n" +" suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" +" return b'PyInit' + suffix" +msgstr "" + +#: c-api/extension-modules.rst:115 +msgid "" +"It is recommended to define the initialization function using a helper macro:" +msgstr "" + +#: c-api/extension-modules.rst:119 +msgid "Declare an extension module initialization function. This macro:" +msgstr "" + +#: c-api/extension-modules.rst:122 +msgid "specifies the :c:expr:`PyObject*` return type," +msgstr "" + +#: c-api/extension-modules.rst:123 +msgid "adds any special linkage declarations required by the platform, and" +msgstr "" + +#: c-api/extension-modules.rst:124 +msgid "for C++, declares the function as ``extern \"C\"``." +msgstr "" + +#: c-api/extension-modules.rst:126 +msgid "For example, a module called ``spam`` would be defined like this::" +msgstr "" + +#: c-api/extension-modules.rst:128 +msgid "" +"static struct PyModuleDef spam_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"spam\",\n" +" ...\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_spam(void)\n" +"{\n" +" return PyModuleDef_Init(&spam_module);\n" +"}" +msgstr "" + +#: c-api/extension-modules.rst:140 +msgid "" +"It is possible to export multiple modules from a single shared library by " +"defining multiple initialization functions. However, importing them requires " +"using symbolic links or a custom importer, because by default only the " +"function corresponding to the filename is found. See the `Multiple modules " +"in one library `__ section in :pep:`489` for details." +msgstr "" + +#: c-api/extension-modules.rst:147 +msgid "" +"The initialization function is typically the only non-\\ ``static`` item " +"defined in the module's C source." +msgstr "" + +#: c-api/extension-modules.rst:154 +msgid "Multi-phase initialization" +msgstr "" + +#: c-api/extension-modules.rst:156 +msgid "" +"Normally, the :ref:`initialization function ` " +"(``PyInit_modulename``) returns a :c:type:`PyModuleDef` instance with non-" +"``NULL`` :c:member:`~PyModuleDef.m_slots`. Before it is returned, the " +"``PyModuleDef`` instance must be initialized using the following function:" +msgstr "" + +#: c-api/extension-modules.rst:165 +msgid "" +"Ensure a module definition is a properly initialized Python object that " +"correctly reports its type and a reference count." +msgstr "" + +#: c-api/extension-modules.rst:168 +msgid "Return *def* cast to ``PyObject*``, or ``NULL`` if an error occurred." +msgstr "" + +#: c-api/extension-modules.rst:170 +msgid "" +"Calling this function is required for :ref:`multi-phase-initialization`. It " +"should not be used in other contexts." +msgstr "" + +#: c-api/extension-modules.rst:173 +msgid "" +"Note that Python assumes that ``PyModuleDef`` structures are statically " +"allocated. This function may return either a new reference or a borrowed " +"one; this reference must not be released." +msgstr "" + +#: c-api/extension-modules.rst:184 +msgid "Legacy single-phase initialization" +msgstr "" + +#: c-api/extension-modules.rst:187 +msgid "" +"Single-phase initialization is a legacy mechanism to initialize extension " +"modules, with known drawbacks and design flaws. Extension module authors are " +"encouraged to use multi-phase initialization instead." +msgstr "" + +#: c-api/extension-modules.rst:191 +msgid "" +"In single-phase initialization, the :ref:`initialization function ` (``PyInit_modulename``) should create, populate and return a " +"module object. This is typically done using :c:func:`PyModule_Create` and " +"functions like :c:func:`PyModule_AddObjectRef`." +msgstr "" + +#: c-api/extension-modules.rst:197 +msgid "" +"Single-phase initialization differs from the :ref:`default ` in the following ways:" +msgstr "" + +#: c-api/extension-modules.rst:200 +msgid "Single-phase modules are, or rather *contain*, “singletons”." +msgstr "" + +#: c-api/extension-modules.rst:202 +msgid "" +"When the module is first initialized, Python saves the contents of the " +"module's ``__dict__`` (that is, typically, the module's functions and types)." +msgstr "" + +#: c-api/extension-modules.rst:206 +msgid "" +"For subsequent imports, Python does not call the initialization function " +"again. Instead, it creates a new module object with a new ``__dict__``, and " +"copies the saved contents to it. For example, given a single-phase module " +"``_testsinglephase`` [#testsinglephase]_ that defines a function ``sum`` and " +"an exception class ``error``:" +msgstr "" + +#: c-api/extension-modules.rst:214 +msgid "" +">>> import sys\n" +">>> import _testsinglephase as one\n" +">>> del sys.modules['_testsinglephase']\n" +">>> import _testsinglephase as two\n" +">>> one is two\n" +"False\n" +">>> one.__dict__ is two.__dict__\n" +"False\n" +">>> one.sum is two.sum\n" +"True\n" +">>> one.error is two.error\n" +"True" +msgstr "" + +#: c-api/extension-modules.rst:229 +msgid "" +"The exact behavior should be considered a CPython implementation detail." +msgstr "" + +#: c-api/extension-modules.rst:231 +msgid "" +"To work around the fact that ``PyInit_modulename`` does not take a *spec* " +"argument, some state of the import machinery is saved and applied to the " +"first suitable module created during the ``PyInit_modulename`` call. " +"Specifically, when a sub-module is imported, this mechanism prepends the " +"parent package name to the name of the module." +msgstr "" + +#: c-api/extension-modules.rst:237 +msgid "" +"A single-phase ``PyInit_modulename`` function should create “its” module " +"object as soon as possible, before any other module objects can be created." +msgstr "" + +#: c-api/extension-modules.rst:240 +msgid "Non-ASCII module names (``PyInitU_modulename``) are not supported." +msgstr "" + +#: c-api/extension-modules.rst:242 +msgid "" +"Single-phase modules support module lookup functions like :c:func:" +"`PyState_FindModule`." +msgstr "" + +#: c-api/extension-modules.rst:245 +msgid "" +"``_testsinglephase`` is an internal module used in CPython's self-test " +"suite; your installation may or may not include it." +msgstr "" diff --git a/c-api/file.po b/c-api/file.po index 03602e15..919b7498 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -82,47 +83,71 @@ msgid "" msgstr "" #: c-api/file.rst:68 -msgid "The handler is a function of type:" +msgid "The *handler* is a function of type:" msgstr "" -#: c-api/file.rst:72 +#: c-api/file.rst:73 msgid "" "Equivalent of :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)`, " "where *path* is guaranteed to be :c:type:`PyUnicodeObject`." msgstr "" -#: c-api/file.rst:76 +#: c-api/file.rst:77 msgid "" "The *userData* pointer is passed into the hook function. Since hook " "functions may be called from different runtimes, this pointer should not " "refer directly to Python state." msgstr "" -#: c-api/file.rst:80 +#: c-api/file.rst:81 msgid "" "As this hook is intentionally used during import, avoid importing new " "modules during its execution unless they are known to be frozen or available " "in ``sys.modules``." msgstr "" -#: c-api/file.rst:84 +#: c-api/file.rst:85 msgid "" "Once a hook has been set, it cannot be removed or replaced, and later calls " "to :c:func:`PyFile_SetOpenCodeHook` will fail. On failure, the function " "returns -1 and sets an exception if the interpreter has been initialized." msgstr "" -#: c-api/file.rst:88 +#: c-api/file.rst:89 msgid "This function is safe to call before :c:func:`Py_Initialize`." msgstr "" -#: c-api/file.rst:90 +#: c-api/file.rst:91 msgid "" "Raises an :ref:`auditing event ` ``setopencodehook`` with no " "arguments." msgstr "" -#: c-api/file.rst:100 +#: c-api/file.rst:98 +msgid "" +"Open *path* with the mode ``'rb'``. *path* must be a Python :class:`str` " +"object. The behavior of this function may be overridden by :c:func:" +"`PyFile_SetOpenCodeHook` to allow for some preprocessing of the text." +msgstr "" + +#: c-api/file.rst:103 +msgid "This is analogous to :func:`io.open_code` in Python." +msgstr "" + +#: c-api/file.rst:105 +msgid "" +"On success, this function returns a :term:`strong reference` to a Python " +"file object. On failure, this function returns ``NULL`` with an exception " +"set." +msgstr "" + +#: c-api/file.rst:114 +msgid "" +"Similar to :c:func:`PyFile_OpenCodeObject`, but *path* is a UTF-8 encoded :c:" +"expr:`const char*`." +msgstr "" + +#: c-api/file.rst:124 msgid "" "Write object *obj* to file object *p*. The only supported flag for *flags* " "is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is " @@ -130,7 +155,7 @@ msgid "" "failure; the appropriate exception will be set." msgstr "" -#: c-api/file.rst:108 +#: c-api/file.rst:132 msgid "" "Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on " "failure; the appropriate exception will be set." @@ -148,6 +173,6 @@ msgstr "" msgid "EOFError (built-in exception)" msgstr "" -#: c-api/file.rst:98 +#: c-api/file.rst:122 msgid "Py_PRINT_RAW (C macro)" msgstr "" diff --git a/c-api/float.po b/c-api/float.po index bb9367de..3a12e81c 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -8,26 +8,27 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: c-api/float.rst:6 -msgid "Floating Point Objects" +msgid "Floating-Point Objects" msgstr "" #: c-api/float.rst:13 msgid "" -"This subtype of :c:type:`PyObject` represents a Python floating point object." +"This subtype of :c:type:`PyObject` represents a Python floating-point object." msgstr "" #: c-api/float.rst:18 msgid "" -"This instance of :c:type:`PyTypeObject` represents the Python floating point " +"This instance of :c:type:`PyTypeObject` represents the Python floating-point " "type. This is the same object as :class:`float` in the Python layer." msgstr "" @@ -57,7 +58,7 @@ msgstr "" #: c-api/float.rst:47 msgid "" "Return a C :c:expr:`double` representation of the contents of *pyfloat*. If " -"*pyfloat* is not a Python floating point object but has a :meth:`~object." +"*pyfloat* is not a Python floating-point object but has a :meth:`~object." "__float__` method, this method will first be called to convert *pyfloat* " "into a float. If :meth:`!__float__` is not defined then it falls back to :" "meth:`~object.__index__`. This method returns ``-1.0`` upon failure, so one " @@ -92,11 +93,124 @@ msgid "" "Return the minimum normalized positive float *DBL_MIN* as C :c:expr:`double`." msgstr "" -#: c-api/float.rst:82 +#: c-api/float.rst:83 +msgid "" +"This macro expands a to constant expression of type :c:expr:`double`, that " +"represents the positive infinity." +msgstr "" + +#: c-api/float.rst:86 +msgid "" +"On most platforms, this is equivalent to the :c:macro:`!INFINITY` macro from " +"the C11 standard ```` header." +msgstr "" + +#: c-api/float.rst:92 +msgid "" +"This macro expands a to constant expression of type :c:expr:`double`, that " +"represents a quiet not-a-number (qNaN) value." +msgstr "" + +#: c-api/float.rst:95 +msgid "" +"On most platforms, this is equivalent to the :c:macro:`!NAN` macro from the " +"C11 standard ```` header." +msgstr "" + +#: c-api/float.rst:101 +msgid "Equivalent to :c:macro:`!INFINITY`." +msgstr "" + +#: c-api/float.rst:103 +msgid "The macro is :term:`soft deprecated`." +msgstr "" + +#: c-api/float.rst:109 +msgid "" +"The definition (accurate for a :c:expr:`double` type) of the :data:`math.e` " +"constant." +msgstr "" + +#: c-api/float.rst:114 +msgid "High precision (long double) definition of :data:`~math.e` constant." +msgstr "" + +#: c-api/float.rst:119 +msgid "" +"The definition (accurate for a :c:expr:`double` type) of the :data:`math.pi` " +"constant." +msgstr "" + +#: c-api/float.rst:124 +msgid "High precision (long double) definition of :data:`~math.pi` constant." +msgstr "" + +#: c-api/float.rst:129 +msgid "" +"The definition (accurate for a :c:expr:`double` type) of the :data:`math." +"tau` constant." +msgstr "" + +#: c-api/float.rst:136 +msgid "Return :data:`math.nan` from a function." +msgstr "" + +#: c-api/float.rst:138 +msgid "" +"On most platforms, this is equivalent to ``return PyFloat_FromDouble(NAN)``." +msgstr "" + +#: c-api/float.rst:143 +msgid "" +"Return :data:`math.inf` or :data:`-math.inf ` from a function, " +"depending on the sign of *sign*." +msgstr "" + +#: c-api/float.rst:146 +msgid "On most platforms, this is equivalent to the following::" +msgstr "" + +#: c-api/float.rst:148 +msgid "return PyFloat_FromDouble(copysign(INFINITY, sign));" +msgstr "" + +#: c-api/float.rst:153 +msgid "" +"Return ``1`` if the given floating-point number *X* is finite, that is, it " +"is normal, subnormal or zero, but not infinite or NaN. Return ``0`` " +"otherwise." +msgstr "" + +#: c-api/float.rst:157 +msgid "" +"The macro is :term:`soft deprecated`. Use :c:macro:`!isfinite` instead." +msgstr "" + +#: c-api/float.rst:163 +msgid "" +"Return ``1`` if the given floating-point number *X* is positive or negative " +"infinity. Return ``0`` otherwise." +msgstr "" + +#: c-api/float.rst:166 +msgid "The macro is :term:`soft deprecated`. Use :c:macro:`!isinf` instead." +msgstr "" + +#: c-api/float.rst:172 +msgid "" +"Return ``1`` if the given floating-point number *X* is a not-a-number (NaN) " +"value. Return ``0`` otherwise." +msgstr "" + +#: c-api/float.rst:175 +msgid "The macro is :term:`soft deprecated`. Use :c:macro:`!isnan` instead." +msgstr "" + +#: c-api/float.rst:180 msgid "Pack and Unpack functions" msgstr "" -#: c-api/float.rst:84 +#: c-api/float.rst:182 msgid "" "The pack and unpack functions provide an efficient platform-independent way " "to store floating-point values as byte strings. The Pack routines produce a " @@ -105,7 +219,7 @@ msgid "" "the number of bytes in the bytes string." msgstr "" -#: c-api/float.rst:90 +#: c-api/float.rst:188 msgid "" "On platforms that appear to use IEEE 754 formats these functions work by " "copying bits. On other platforms, the 2-byte format is identical to the IEEE " @@ -117,7 +231,13 @@ msgid "" "an exception." msgstr "" -#: c-api/float.rst:99 +#: c-api/float.rst:197 +msgid "" +"Note that NaNs type may not be preserved on IEEE platforms (signaling NaN " +"become quiet NaN), for example on x86 systems in 32-bit mode." +msgstr "" + +#: c-api/float.rst:200 msgid "" "On non-IEEE platforms with more precision, or larger dynamic range, than " "IEEE 754 supports, not all values can be packed; on non-IEEE platforms with " @@ -125,11 +245,11 @@ msgid "" "What happens in such cases is partly accidental (alas)." msgstr "" -#: c-api/float.rst:107 +#: c-api/float.rst:208 msgid "Pack functions" msgstr "" -#: c-api/float.rst:109 +#: c-api/float.rst:210 msgid "" "The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an :c:expr:" "`int` argument, non-zero if you want the bytes string in little-endian " @@ -139,41 +259,41 @@ msgid "" "to ``1`` on big endian processor, or ``0`` on little endian processor." msgstr "" -#: c-api/float.rst:116 +#: c-api/float.rst:217 msgid "" "Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set, " "most likely :exc:`OverflowError`)." msgstr "" -#: c-api/float.rst:119 +#: c-api/float.rst:220 msgid "There are two problems on non-IEEE platforms:" msgstr "" -#: c-api/float.rst:121 +#: c-api/float.rst:222 msgid "What this does is undefined if *x* is a NaN or infinity." msgstr "" -#: c-api/float.rst:122 +#: c-api/float.rst:223 msgid "``-0.0`` and ``+0.0`` produce the same bytes string." msgstr "" -#: c-api/float.rst:126 +#: c-api/float.rst:227 msgid "Pack a C double as the IEEE 754 binary16 half-precision format." msgstr "" -#: c-api/float.rst:130 +#: c-api/float.rst:231 msgid "Pack a C double as the IEEE 754 binary32 single precision format." msgstr "" -#: c-api/float.rst:134 +#: c-api/float.rst:235 msgid "Pack a C double as the IEEE 754 binary64 double precision format." msgstr "" -#: c-api/float.rst:138 +#: c-api/float.rst:239 msgid "Unpack functions" msgstr "" -#: c-api/float.rst:140 +#: c-api/float.rst:241 msgid "" "The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an :c:" "expr:`int` argument, non-zero if the bytes string is in little-endian format " @@ -183,28 +303,28 @@ msgid "" "processor, or ``0`` on little endian processor." msgstr "" -#: c-api/float.rst:147 +#: c-api/float.rst:248 msgid "" "Return value: The unpacked double. On error, this is ``-1.0`` and :c:func:" "`PyErr_Occurred` is true (and an exception is set, most likely :exc:" "`OverflowError`)." msgstr "" -#: c-api/float.rst:151 +#: c-api/float.rst:252 msgid "" "Note that on a non-IEEE platform this will refuse to unpack a bytes string " "that represents a NaN or infinity." msgstr "" -#: c-api/float.rst:156 +#: c-api/float.rst:257 msgid "Unpack the IEEE 754 binary16 half-precision format as a C double." msgstr "" -#: c-api/float.rst:160 +#: c-api/float.rst:261 msgid "Unpack the IEEE 754 binary32 single precision format as a C double." msgstr "" -#: c-api/float.rst:164 +#: c-api/float.rst:265 msgid "Unpack the IEEE 754 binary64 double precision format as a C double." msgstr "" @@ -213,5 +333,5 @@ msgid "object" msgstr "" #: c-api/float.rst:8 -msgid "floating point" +msgid "floating-point" msgstr "" diff --git a/c-api/frame.po b/c-api/frame.po index 229a339b..da37a3e7 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -56,123 +57,212 @@ msgid "" msgstr "" #: c-api/frame.rst:34 +msgid "" +"Create a new frame object. This function returns a :term:`strong reference` " +"to the new frame object on success, and returns ``NULL`` with an exception " +"set on failure." +msgstr "" + +#: c-api/frame.rst:40 msgid "Return non-zero if *obj* is a frame object." msgstr "" -#: c-api/frame.rst:38 +#: c-api/frame.rst:44 msgid "" "Previously, this function was only available after including ````." msgstr "" -#: c-api/frame.rst:43 +#: c-api/frame.rst:49 msgid "Get the *frame* next outer frame." msgstr "" -#: c-api/frame.rst:45 +#: c-api/frame.rst:51 msgid "" "Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer frame." msgstr "" -#: c-api/frame.rst:53 +#: c-api/frame.rst:59 msgid "Get the *frame*'s :attr:`~frame.f_builtins` attribute." msgstr "" -#: c-api/frame.rst:86 +#: c-api/frame.rst:92 msgid "Return a :term:`strong reference`. The result cannot be ``NULL``." msgstr "" -#: c-api/frame.rst:62 +#: c-api/frame.rst:68 msgid "Get the *frame* code." msgstr "" -#: c-api/frame.rst:125 +#: c-api/frame.rst:136 msgid "Return a :term:`strong reference`." msgstr "" -#: c-api/frame.rst:66 +#: c-api/frame.rst:72 msgid "The result (frame code) cannot be ``NULL``." msgstr "" -#: c-api/frame.rst:73 +#: c-api/frame.rst:79 msgid "" "Get the generator, coroutine, or async generator that owns this frame, or " "``NULL`` if this frame is not owned by a generator. Does not raise an " "exception, even if the return value is ``NULL``." msgstr "" -#: c-api/frame.rst:77 +#: c-api/frame.rst:83 msgid "Return a :term:`strong reference`, or ``NULL``." msgstr "" -#: c-api/frame.rst:84 +#: c-api/frame.rst:90 msgid "Get the *frame*'s :attr:`~frame.f_globals` attribute." msgstr "" -#: c-api/frame.rst:93 +#: c-api/frame.rst:99 msgid "Get the *frame*'s :attr:`~frame.f_lasti` attribute." msgstr "" -#: c-api/frame.rst:95 +#: c-api/frame.rst:101 msgid "Returns -1 if ``frame.f_lasti`` is ``None``." msgstr "" -#: c-api/frame.rst:102 +#: c-api/frame.rst:108 msgid "Get the variable *name* of *frame*." msgstr "" -#: c-api/frame.rst:104 +#: c-api/frame.rst:110 msgid "Return a :term:`strong reference` to the variable value on success." msgstr "" -#: c-api/frame.rst:105 +#: c-api/frame.rst:111 msgid "" "Raise :exc:`NameError` and return ``NULL`` if the variable does not exist." msgstr "" -#: c-api/frame.rst:106 +#: c-api/frame.rst:112 msgid "Raise an exception and return ``NULL`` on error." msgstr "" -#: c-api/frame.rst:108 +#: c-api/frame.rst:114 msgid "*name* type must be a :class:`str`." msgstr "" -#: c-api/frame.rst:115 +#: c-api/frame.rst:121 msgid "" "Similar to :c:func:`PyFrame_GetVar`, but the variable name is a C string " "encoded in UTF-8." msgstr "" -#: c-api/frame.rst:123 -msgid "Get the *frame*'s :attr:`~frame.f_locals` attribute (:class:`dict`)." +#: c-api/frame.rst:129 +msgid "" +"Get the *frame*'s :attr:`~frame.f_locals` attribute. If the frame refers to " +"an :term:`optimized scope`, this returns a write-through proxy object that " +"allows modifying the locals. In all other cases (classes, modules, :func:" +"`exec`, :func:`eval`) it returns the mapping representing the frame locals " +"directly (as described for :func:`locals`)." msgstr "" -#: c-api/frame.rst:132 +#: c-api/frame.rst:140 +msgid "" +"As part of :pep:`667`, return an instance of :c:var:" +"`PyFrameLocalsProxy_Type`." +msgstr "" + +#: c-api/frame.rst:146 msgid "Return the line number that *frame* is currently executing." msgstr "" -#: c-api/frame.rst:137 +#: c-api/frame.rst:150 +msgid "Frame Locals Proxies" +msgstr "" + +#: c-api/frame.rst:154 +msgid "" +"The :attr:`~frame.f_locals` attribute on a :ref:`frame object ` is an instance of a \"frame-locals proxy\". The proxy object " +"exposes a write-through view of the underlying locals dictionary for the " +"frame. This ensures that the variables exposed by ``f_locals`` are always up " +"to date with the live local variables in the frame itself." +msgstr "" + +#: c-api/frame.rst:160 +msgid "See :pep:`667` for more information." +msgstr "" + +#: c-api/frame.rst:164 +msgid "The type of frame :func:`locals` proxy objects." +msgstr "" + +#: c-api/frame.rst:168 +msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." +msgstr "" + +#: c-api/frame.rst:172 +msgid "Legacy Local Variable APIs" +msgstr "" + +#: c-api/frame.rst:174 +msgid "" +"These APIs are :term:`soft deprecated`. As of Python 3.13, they do nothing. " +"They exist solely for backwards compatibility." +msgstr "" + +#: c-api/frame.rst:194 c-api/frame.rst:207 +msgid "This function is :term:`soft deprecated` and does nothing." +msgstr "" + +#: c-api/frame.rst:182 +msgid "" +"Prior to Python 3.13, this function would copy the :attr:`~frame.f_locals` " +"attribute of *f* to the internal \"fast\" array of local variables, allowing " +"changes in frame objects to be visible to the interpreter. If *clear* was " +"true, this function would process variables that were unset in the locals " +"dictionary." +msgstr "" + +#: c-api/frame.rst:201 c-api/frame.rst:213 +msgid "This function now does nothing." +msgstr "" + +#: c-api/frame.rst:196 +msgid "" +"Prior to Python 3.13, this function would copy the internal \"fast\" array " +"of local variables (which is used by the interpreter) to the :attr:`~frame." +"f_locals` attribute of *f*, allowing changes in local variables to be " +"visible to frame objects." +msgstr "" + +#: c-api/frame.rst:209 +msgid "" +"Prior to Python 3.13, this function was similar to :c:func:" +"`PyFrame_FastToLocals`, but would return ``0`` on success, and ``-1`` with " +"an exception set on failure." +msgstr "" + +#: c-api/frame.rst:218 +msgid ":pep:`667`" +msgstr "" + +#: c-api/frame.rst:222 msgid "Internal Frames" msgstr "" -#: c-api/frame.rst:139 +#: c-api/frame.rst:224 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: c-api/frame.rst:143 +#: c-api/frame.rst:228 msgid "The interpreter's internal frame representation." msgstr "" -#: c-api/frame.rst:149 +#: c-api/frame.rst:234 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: c-api/frame.rst:156 +#: c-api/frame.rst:241 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: c-api/frame.rst:163 +#: c-api/frame.rst:248 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/function.po b/c-api/function.po index b05a610f..efb57ad7 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -99,7 +100,7 @@ msgid "" "must be ``Py_None`` or a tuple." msgstr "" -#: c-api/function.rst:109 c-api/function.rst:123 +#: c-api/function.rst:125 c-api/function.rst:139 msgid "Raises :exc:`SystemError` and returns ``-1`` on failure." msgstr "" @@ -113,31 +114,56 @@ msgid "" "unaltered (default) vectorcall function!" msgstr "" -#: c-api/function.rst:100 +#: c-api/function.rst:101 +msgid "" +"Return the keyword-only argument default values of the function object *op*. " +"This can be a dictionary of arguments or ``NULL``." +msgstr "" + +#: c-api/function.rst:107 +msgid "" +"Set the keyword-only argument default values of the function object *op*. " +"*defaults* must be a dictionary of keyword-only arguments or ``Py_None``." +msgstr "" + +#: c-api/function.rst:110 +msgid "" +"This function returns ``0`` on success, and returns ``-1`` with an exception " +"set on failure." +msgstr "" + +#: c-api/function.rst:116 msgid "" "Return the closure associated with the function object *op*. This can be " "``NULL`` or a tuple of cell objects." msgstr "" -#: c-api/function.rst:106 +#: c-api/function.rst:122 msgid "" "Set the closure associated with the function object *op*. *closure* must be " "``Py_None`` or a tuple of cell objects." msgstr "" -#: c-api/function.rst:114 +#: c-api/function.rst:130 msgid "" "Return the annotations of the function object *op*. This can be a mutable " "dictionary or ``NULL``." msgstr "" -#: c-api/function.rst:120 +#: c-api/function.rst:136 msgid "" "Set the annotations for the function object *op*. *annotations* must be a " "dictionary or ``Py_None``." msgstr "" -#: c-api/function.rst:128 +#: c-api/function.rst:150 +msgid "" +"These functions are similar to their ``PyFunction_Get*`` counterparts, but " +"do not do type checking. Passing anything other than an instance of :c:data:" +"`PyFunction_Type` is undefined behavior." +msgstr "" + +#: c-api/function.rst:157 msgid "" "Register *callback* as a function watcher for the current interpreter. " "Return an ID which may be passed to :c:func:`PyFunction_ClearWatcher`. In " @@ -145,7 +171,7 @@ msgid "" "exception." msgstr "" -#: c-api/function.rst:138 +#: c-api/function.rst:167 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyFunction_AddWatcher` for the current interpreter. Return ``0`` on " @@ -153,19 +179,35 @@ msgid "" "*watcher_id* was never registered.)" msgstr "" -#: c-api/function.rst:148 -msgid "" -"Enumeration of possible function watcher events: - " -"``PyFunction_EVENT_CREATE`` - ``PyFunction_EVENT_DESTROY`` - " -"``PyFunction_EVENT_MODIFY_CODE`` - ``PyFunction_EVENT_MODIFY_DEFAULTS`` - " -"``PyFunction_EVENT_MODIFY_KWDEFAULTS``" +#: c-api/function.rst:177 +msgid "Enumeration of possible function watcher events:" msgstr "" -#: c-api/function.rst:160 +#: c-api/function.rst:179 +msgid "``PyFunction_EVENT_CREATE``" +msgstr "" + +#: c-api/function.rst:180 +msgid "``PyFunction_EVENT_DESTROY``" +msgstr "" + +#: c-api/function.rst:181 +msgid "``PyFunction_EVENT_MODIFY_CODE``" +msgstr "" + +#: c-api/function.rst:182 +msgid "``PyFunction_EVENT_MODIFY_DEFAULTS``" +msgstr "" + +#: c-api/function.rst:183 +msgid "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" +msgstr "" + +#: c-api/function.rst:190 msgid "Type of a function watcher callback function." msgstr "" -#: c-api/function.rst:162 +#: c-api/function.rst:192 msgid "" "If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY`` " "then *new_value* will be ``NULL``. Otherwise, *new_value* will hold a :term:" @@ -173,16 +215,16 @@ msgid "" "for the attribute that is being modified." msgstr "" -#: c-api/function.rst:167 +#: c-api/function.rst:197 msgid "" "The callback may inspect but must not modify *func*; doing so could have " "unpredictable effects, including infinite recursion." msgstr "" -#: c-api/function.rst:170 +#: c-api/function.rst:200 msgid "" "If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked " -"after `func` has been fully initialized. Otherwise, the callback is invoked " +"after *func* has been fully initialized. Otherwise, the callback is invoked " "before the modification to *func* takes place, so the prior state of *func* " "can be inspected. The runtime is permitted to optimize away the creation of " "function objects when possible. In such cases no event will be emitted. " @@ -191,7 +233,7 @@ msgid "" "semantics of the Python code being executed." msgstr "" -#: c-api/function.rst:179 +#: c-api/function.rst:209 msgid "" "If *event* is ``PyFunction_EVENT_DESTROY``, Taking a reference in the " "callback to the about-to-be-destroyed function will resurrect it, preventing " @@ -199,14 +241,14 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: c-api/function.rst:184 +#: c-api/function.rst:214 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: c-api/function.rst:188 +#: c-api/function.rst:218 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 07d472e4..66f91be9 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -39,7 +40,7 @@ msgid "" "implementation must also be provided." msgstr "" -#: c-api/gcsupport.rst:24 +#: c-api/gcsupport.rst:21 msgid ":c:macro:`Py_TPFLAGS_HAVE_GC`" msgstr "" @@ -107,13 +108,52 @@ msgid "" "macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" -#: c-api/gcsupport.rst:62 +#: c-api/gcsupport.rst:84 +msgid "" +"Do not call this directly to allocate memory for an object; call the type's :" +"c:member:`~PyTypeObject.tp_alloc` slot instead." +msgstr "" + +#: c-api/gcsupport.rst:87 +msgid "" +"When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:" +"`PyType_GenericAlloc` is preferred over a custom function that simply calls " +"this macro." +msgstr "" + +#: c-api/gcsupport.rst:91 +msgid "" +"Memory allocated by this macro must be freed with :c:func:`PyObject_GC_Del` " +"(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." +msgstr "" + +#: c-api/gcsupport.rst:97 +msgid ":c:func:`PyObject_GC_Del`" +msgstr "" + +#: c-api/gcsupport.rst:74 +msgid ":c:macro:`PyObject_New`" +msgstr "" + +#: c-api/gcsupport.rst:99 c-api/gcsupport.rst:193 +msgid ":c:func:`PyType_GenericAlloc`" +msgstr "" + +#: c-api/gcsupport.rst:100 +msgid ":c:member:`~PyTypeObject.tp_alloc`" +msgstr "" + +#: c-api/gcsupport.rst:81 msgid "" "Analogous to :c:macro:`PyObject_NewVar` but for container objects with the :" "c:macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" -#: c-api/gcsupport.rst:67 +#: c-api/gcsupport.rst:98 +msgid ":c:macro:`PyObject_NewVar`" +msgstr "" + +#: c-api/gcsupport.rst:105 msgid "" "Analogous to :c:macro:`PyObject_GC_New` but allocates *extra_size* bytes at " "the end of the object (at offset :c:member:`~PyTypeObject.tp_basicsize`). " @@ -121,13 +161,20 @@ msgid "" "object header `." msgstr "" -#: c-api/gcsupport.rst:73 +#: c-api/gcsupport.rst:111 msgid "" "The extra data will be deallocated with the object, but otherwise it is not " "managed by Python." msgstr "" -#: c-api/gcsupport.rst:77 +#: c-api/gcsupport.rst:114 +msgid "" +"Memory allocated by this function must be freed with :c:func:" +"`PyObject_GC_Del` (usually called via the object's :c:member:`~PyTypeObject." +"tp_free` slot)." +msgstr "" + +#: c-api/gcsupport.rst:119 msgid "" "The function is marked as unstable because the final mechanism for reserving " "extra data after an instance is not yet decided. For allocating a variable " @@ -135,20 +182,20 @@ msgid "" "`~PyTypeObject.tp_itemsize` instead." msgstr "" -#: c-api/gcsupport.rst:88 +#: c-api/gcsupport.rst:130 msgid "" "Resize an object allocated by :c:macro:`PyObject_NewVar`. Returns the " "resized object of type ``TYPE*`` (refers to any C type) or ``NULL`` on " "failure." msgstr "" -#: c-api/gcsupport.rst:92 +#: c-api/gcsupport.rst:134 msgid "" "*op* must be of type :c:expr:`PyVarObject *` and must not be tracked by the " "collector yet. *newsize* must be of type :c:type:`Py_ssize_t`." msgstr "" -#: c-api/gcsupport.rst:99 +#: c-api/gcsupport.rst:141 msgid "" "Adds the object *op* to the set of container objects tracked by the " "collector. The collector can run at unexpected times so objects must be " @@ -157,45 +204,74 @@ msgid "" "usually near the end of the constructor." msgstr "" -#: c-api/gcsupport.rst:108 +#: c-api/gcsupport.rst:150 msgid "" "Returns non-zero if the object implements the garbage collector protocol, " "otherwise returns 0." msgstr "" -#: c-api/gcsupport.rst:111 +#: c-api/gcsupport.rst:153 msgid "" "The object cannot be tracked by the garbage collector if this function " "returns 0." msgstr "" -#: c-api/gcsupport.rst:116 +#: c-api/gcsupport.rst:158 msgid "" "Returns 1 if the object type of *op* implements the GC protocol and *op* is " "being currently tracked by the garbage collector and 0 otherwise." msgstr "" -#: c-api/gcsupport.rst:119 +#: c-api/gcsupport.rst:161 msgid "This is analogous to the Python function :func:`gc.is_tracked`." msgstr "" -#: c-api/gcsupport.rst:126 +#: c-api/gcsupport.rst:168 msgid "" "Returns 1 if the object type of *op* implements the GC protocol and *op* has " "been already finalized by the garbage collector and 0 otherwise." msgstr "" -#: c-api/gcsupport.rst:129 +#: c-api/gcsupport.rst:171 msgid "This is analogous to the Python function :func:`gc.is_finalized`." msgstr "" -#: c-api/gcsupport.rst:136 +#: c-api/gcsupport.rst:178 msgid "" "Releases memory allocated to an object using :c:macro:`PyObject_GC_New` or :" "c:macro:`PyObject_GC_NewVar`." msgstr "" -#: c-api/gcsupport.rst:142 +#: c-api/gcsupport.rst:181 +msgid "" +"Do not call this directly to free an object's memory; call the type's :c:" +"member:`~PyTypeObject.tp_free` slot instead." +msgstr "" + +#: c-api/gcsupport.rst:184 +msgid "" +"Do not use this for memory allocated by :c:macro:`PyObject_New`, :c:macro:" +"`PyObject_NewVar`, or related allocation functions; use :c:func:" +"`PyObject_Free` instead." +msgstr "" + +#: c-api/gcsupport.rst:190 +msgid ":c:func:`PyObject_Free` is the non-GC equivalent of this function." +msgstr "" + +#: c-api/gcsupport.rst:191 +msgid ":c:macro:`PyObject_GC_New`" +msgstr "" + +#: c-api/gcsupport.rst:192 +msgid ":c:macro:`PyObject_GC_NewVar`" +msgstr "" + +#: c-api/gcsupport.rst:194 +msgid ":c:member:`~PyTypeObject.tp_free`" +msgstr "" + +#: c-api/gcsupport.rst:199 msgid "" "Remove the object *op* from the set of container objects tracked by the " "collector. Note that :c:func:`PyObject_GC_Track` can be called again on " @@ -205,19 +281,19 @@ msgid "" "handler become invalid." msgstr "" -#: c-api/gcsupport.rst:151 +#: c-api/gcsupport.rst:208 msgid "" "The :c:func:`!_PyObject_GC_TRACK` and :c:func:`!_PyObject_GC_UNTRACK` macros " "have been removed from the public C API." msgstr "" -#: c-api/gcsupport.rst:154 +#: c-api/gcsupport.rst:211 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` handler accepts a function " "parameter of this type:" msgstr "" -#: c-api/gcsupport.rst:159 +#: c-api/gcsupport.rst:216 msgid "" "Type of the visitor function passed to the :c:member:`~PyTypeObject." "tp_traverse` handler. The function should be called with an object to " @@ -227,13 +303,13 @@ msgid "" "users will need to write their own visitor functions." msgstr "" -#: c-api/gcsupport.rst:166 +#: c-api/gcsupport.rst:223 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` handler must have the following " "type:" msgstr "" -#: c-api/gcsupport.rst:171 +#: c-api/gcsupport.rst:228 msgid "" "Traversal function for a container object. Implementations must call the " "*visit* function for each object directly contained by *self*, with the " @@ -243,7 +319,7 @@ msgid "" "returned immediately." msgstr "" -#: c-api/gcsupport.rst:178 +#: c-api/gcsupport.rst:235 msgid "" "To simplify writing :c:member:`~PyTypeObject.tp_traverse` handlers, a :c:" "func:`Py_VISIT` macro is provided. In order to use this macro, the :c:" @@ -251,20 +327,32 @@ msgid "" "exactly *visit* and *arg*:" msgstr "" -#: c-api/gcsupport.rst:185 +#: c-api/gcsupport.rst:242 msgid "" -"If *o* is not ``NULL``, call the *visit* callback, with arguments *o* and " -"*arg*. If *visit* returns a non-zero value, then return it. Using this " -"macro, :c:member:`~PyTypeObject.tp_traverse` handlers look like::" +"If the :c:expr:`PyObject *` *o* is not ``NULL``, call the *visit* callback, " +"with arguments *o* and *arg*. If *visit* returns a non-zero value, then " +"return it. Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers " +"look like::" msgstr "" -#: c-api/gcsupport.rst:198 +#: c-api/gcsupport.rst:247 +msgid "" +"static int\n" +"my_traverse(Noddy *self, visitproc visit, void *arg)\n" +"{\n" +" Py_VISIT(self->foo);\n" +" Py_VISIT(self->bar);\n" +" return 0;\n" +"}" +msgstr "" + +#: c-api/gcsupport.rst:255 msgid "" "The :c:member:`~PyTypeObject.tp_clear` handler must be of the :c:type:" "`inquiry` type, or ``NULL`` if the object is immutable." msgstr "" -#: c-api/gcsupport.rst:204 +#: c-api/gcsupport.rst:261 msgid "" "Drop references that may have created reference cycles. Immutable objects " "do not have to define this method since they can never directly create " @@ -274,23 +362,23 @@ msgid "" "in a reference cycle." msgstr "" -#: c-api/gcsupport.rst:213 +#: c-api/gcsupport.rst:270 msgid "Controlling the Garbage Collector State" msgstr "" -#: c-api/gcsupport.rst:215 +#: c-api/gcsupport.rst:272 msgid "" "The C-API provides the following functions for controlling garbage " "collection runs." msgstr "" -#: c-api/gcsupport.rst:220 +#: c-api/gcsupport.rst:277 msgid "" "Perform a full garbage collection, if the garbage collector is enabled. " "(Note that :func:`gc.collect` runs it unconditionally.)" msgstr "" -#: c-api/gcsupport.rst:223 +#: c-api/gcsupport.rst:280 msgid "" "Returns the number of collected + unreachable objects which cannot be " "collected. If the garbage collector is disabled or already collecting, " @@ -298,58 +386,58 @@ msgid "" "data:`sys.unraisablehook`. This function does not raise exceptions." msgstr "" -#: c-api/gcsupport.rst:233 +#: c-api/gcsupport.rst:290 msgid "" "Enable the garbage collector: similar to :func:`gc.enable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" -#: c-api/gcsupport.rst:241 +#: c-api/gcsupport.rst:298 msgid "" "Disable the garbage collector: similar to :func:`gc.disable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" -#: c-api/gcsupport.rst:249 +#: c-api/gcsupport.rst:306 msgid "" "Query the state of the garbage collector: similar to :func:`gc.isenabled`. " "Returns the current state, 0 for disabled and 1 for enabled." msgstr "" -#: c-api/gcsupport.rst:256 +#: c-api/gcsupport.rst:313 msgid "Querying Garbage Collector State" msgstr "" -#: c-api/gcsupport.rst:258 +#: c-api/gcsupport.rst:315 msgid "" "The C-API provides the following interface for querying information about " "the garbage collector." msgstr "" -#: c-api/gcsupport.rst:263 +#: c-api/gcsupport.rst:320 msgid "" "Run supplied *callback* on all live GC-capable objects. *arg* is passed " "through to all invocations of *callback*." msgstr "" -#: c-api/gcsupport.rst:267 +#: c-api/gcsupport.rst:324 msgid "" "If new objects are (de)allocated by the callback it is undefined if they " "will be visited." msgstr "" -#: c-api/gcsupport.rst:270 +#: c-api/gcsupport.rst:327 msgid "" "Garbage collection is disabled during operation. Explicitly running a " "collection in the callback may lead to undefined behaviour e.g. visiting the " "same objects multiple times or not at all." msgstr "" -#: c-api/gcsupport.rst:278 +#: c-api/gcsupport.rst:335 msgid "" "Type of the visitor function to be passed to :c:func:" "`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " -"``PyUnstable_GC_VisitObjects``. Return ``0`` to continue iteration, return " -"``1`` to stop iteration. Other return values are reserved for now so " +"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " +"``0`` to stop iteration. Other return values are reserved for now so " "behavior on returning anything else is undefined." msgstr "" diff --git a/c-api/gen.po b/c-api/gen.po index e59b546d..cea74b2f 100644 --- a/c-api/gen.po +++ b/c-api/gen.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -62,3 +63,43 @@ msgid "" "to *frame* is stolen by this function. The *frame* argument must not be " "``NULL``." msgstr "" + +#: c-api/gen.rst:50 +msgid "" +"Return a new :term:`strong reference` to the code object wrapped by *gen*. " +"This function always succeeds." +msgstr "" + +#: c-api/gen.rst:55 +msgid "Asynchronous Generator Objects" +msgstr "" + +#: c-api/gen.rst:58 +msgid ":pep:`525`" +msgstr "" + +#: c-api/gen.rst:62 +msgid "" +"The type object corresponding to asynchronous generator objects. This is " +"available as :class:`types.AsyncGeneratorType` in the Python layer." +msgstr "" + +#: c-api/gen.rst:69 +msgid "" +"Create a new asynchronous generator wrapping *frame*, with ``__name__`` and " +"``__qualname__`` set to *name* and *qualname*. *frame* is stolen by this " +"function and must not be ``NULL``." +msgstr "" + +#: c-api/gen.rst:73 +msgid "" +"On success, this function returns a :term:`strong reference` to the new " +"asynchronous generator. On failure, this function returns ``NULL`` with an " +"exception set." +msgstr "" + +#: c-api/gen.rst:81 +msgid "" +"Return true if *op* is an asynchronous generator object, false otherwise. " +"This function always succeeds." +msgstr "" diff --git a/c-api/hash.po b/c-api/hash.po index e6afcfad..9586054c 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -21,37 +22,181 @@ msgid "PyHash API" msgstr "" #: c-api/hash.rst:6 -msgid "See also the :c:member:`PyTypeObject.tp_hash` member." +msgid "" +"See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`." msgstr "" #: c-api/hash.rst:10 msgid "Hash value type: signed integer." msgstr "" -#: c-api/hash.rst:16 +#: c-api/hash.rst:17 msgid "Hash value type: unsigned integer." msgstr "" -#: c-api/hash.rst:23 +#: c-api/hash.rst:24 +msgid "" +"A numerical value indicating the algorithm for hashing of :class:`str`, :" +"class:`bytes`, and :class:`memoryview`." +msgstr "" + +#: c-api/hash.rst:27 +msgid "The algorithm name is exposed by :data:`sys.hash_info.algorithm`." +msgstr "" + +#: c-api/hash.rst:36 +msgid "" +"Numerical values to compare to :c:macro:`Py_HASH_ALGORITHM` to determine " +"which algorithm is used for hashing. The hash algorithm can be configured " +"via the configure :option:`--with-hash-algorithm` option." +msgstr "" + +#: c-api/hash.rst:40 +msgid "Add :c:macro:`!Py_HASH_FNV` and :c:macro:`!Py_HASH_SIPHASH24`." +msgstr "" + +#: c-api/hash.rst:43 +msgid "Add :c:macro:`!Py_HASH_SIPHASH13`." +msgstr "" + +#: c-api/hash.rst:49 +msgid "" +"Buffers of length in range ``[1, Py_HASH_CUTOFF)`` are hashed using DJBX33A " +"instead of the algorithm described by :c:macro:`Py_HASH_ALGORITHM`." +msgstr "" + +#: c-api/hash.rst:52 +msgid "A :c:macro:`!Py_HASH_CUTOFF` of 0 disables the optimization." +msgstr "" + +#: c-api/hash.rst:53 +msgid "" +":c:macro:`!Py_HASH_CUTOFF` must be non-negative and less or equal than 7." +msgstr "" + +#: c-api/hash.rst:55 +msgid "" +"32-bit platforms should use a cutoff smaller than 64-bit platforms because " +"it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms " +"and 5 on 32-bit platforms should provide a decent safety margin." +msgstr "" + +#: c-api/hash.rst:59 +msgid "This corresponds to the :data:`sys.hash_info.cutoff` constant." +msgstr "" + +#: c-api/hash.rst:66 +msgid "" +"The `Mersenne prime `_ ``P = " +"2**n -1``, used for numeric hash scheme." +msgstr "" + +#: c-api/hash.rst:69 +msgid "This corresponds to the :data:`sys.hash_info.modulus` constant." +msgstr "" + +#: c-api/hash.rst:76 +msgid "The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`." +msgstr "" + +#: c-api/hash.rst:83 +msgid "Prime multiplier used in string and various other hashes." +msgstr "" + +#: c-api/hash.rst:90 +msgid "The hash value returned for a positive infinity." +msgstr "" + +#: c-api/hash.rst:92 +msgid "This corresponds to the :data:`sys.hash_info.inf` constant." +msgstr "" + +#: c-api/hash.rst:99 +msgid "The multiplier used for the imaginary part of a complex number." +msgstr "" + +#: c-api/hash.rst:101 +msgid "This corresponds to the :data:`sys.hash_info.imag` constant." +msgstr "" + +#: c-api/hash.rst:108 msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." msgstr "" -#: c-api/hash.rst:31 +#: c-api/hash.rst:112 +msgid "Hash function." +msgstr "" + +#: c-api/hash.rst:116 msgid "Hash function name (UTF-8 encoded string)." msgstr "" -#: c-api/hash.rst:35 +#: c-api/hash.rst:118 +msgid "This corresponds to the :data:`sys.hash_info.algorithm` constant." +msgstr "" + +#: c-api/hash.rst:122 msgid "Internal size of the hash value in bits." msgstr "" -#: c-api/hash.rst:39 +#: c-api/hash.rst:124 +msgid "This corresponds to the :data:`sys.hash_info.hash_bits` constant." +msgstr "" + +#: c-api/hash.rst:128 msgid "Size of seed input in bits." msgstr "" -#: c-api/hash.rst:46 +#: c-api/hash.rst:130 +msgid "This corresponds to the :data:`sys.hash_info.seed_bits` constant." +msgstr "" + +#: c-api/hash.rst:137 msgid "Get the hash function definition." msgstr "" -#: c-api/hash.rst:49 +#: c-api/hash.rst:140 msgid ":pep:`456` \"Secure and interchangeable hash algorithm\"." msgstr "" + +#: c-api/hash.rst:147 +msgid "" +"Hash a pointer value: process the pointer value as an integer (cast it to " +"``uintptr_t`` internally). The pointer is not dereferenced." +msgstr "" + +#: c-api/hash.rst:150 +msgid "The function cannot fail: it cannot return ``-1``." +msgstr "" + +#: c-api/hash.rst:157 +msgid "" +"Compute and return the hash value of a buffer of *len* bytes starting at " +"address *ptr*. The hash is guaranteed to match that of :class:`bytes`, :" +"class:`memoryview`, and other built-in objects that implement the :ref:" +"`buffer protocol `." +msgstr "" + +#: c-api/hash.rst:162 +msgid "" +"Use this function to implement hashing for immutable objects whose :c:member:" +"`~PyTypeObject.tp_richcompare` function compares to another object's buffer." +msgstr "" + +#: c-api/hash.rst:166 +msgid "*len* must be greater than or equal to ``0``." +msgstr "" + +#: c-api/hash.rst:168 +msgid "This function always succeeds." +msgstr "" + +#: c-api/hash.rst:175 +msgid "" +"Generic hashing function that is meant to be put into a type object's " +"``tp_hash`` slot. Its result only depends on the object's identity." +msgstr "" + +#: c-api/hash.rst:180 +msgid "In CPython, it is equivalent to :c:func:`Py_HashPointer`." +msgstr "" diff --git a/c-api/import.po b/c-api/import.po index d77ab7f3..1d2adb61 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -38,13 +39,17 @@ msgid "" "needed anymore." msgstr "" -#: c-api/import.rst:34 +#: c-api/import.rst:29 +msgid "Use :c:func:`PyImport_ImportModule` instead." +msgstr "" + +#: c-api/import.rst:37 msgid "" "Import a module. This is best described by referring to the built-in Python " "function :func:`__import__`." msgstr "" -#: c-api/import.rst:53 +#: c-api/import.rst:56 msgid "" "The return value is a new reference to the imported module or top-level " "package, or ``NULL`` with an exception set on failure. Like for :func:" @@ -52,30 +57,30 @@ msgid "" "is normally the top-level package, unless a non-empty *fromlist* was given." msgstr "" -#: c-api/import.rst:43 +#: c-api/import.rst:46 msgid "" "Failing imports remove incomplete module objects, like with :c:func:" "`PyImport_ImportModule`." msgstr "" -#: c-api/import.rst:49 +#: c-api/import.rst:52 msgid "" "Import a module. This is best described by referring to the built-in Python " "function :func:`__import__`, as the standard :func:`__import__` function " "calls this function directly." msgstr "" -#: c-api/import.rst:63 +#: c-api/import.rst:66 msgid "" "Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is a " "UTF-8 encoded string instead of a Unicode object." msgstr "" -#: c-api/import.rst:66 +#: c-api/import.rst:69 msgid "Negative values for *level* are no longer accepted." msgstr "" -#: c-api/import.rst:71 +#: c-api/import.rst:74 msgid "" "This is a higher-level interface that calls the current \"import hook " "function\" (with an explicit *level* of 0, meaning absolute import). It " @@ -84,40 +89,59 @@ msgid "" "hooks are installed in the current environment." msgstr "" -#: c-api/import.rst:77 +#: c-api/import.rst:80 msgid "This function always uses absolute imports." msgstr "" -#: c-api/import.rst:82 +#: c-api/import.rst:85 msgid "" "Reload a module. Return a new reference to the reloaded module, or ``NULL`` " "with an exception set on failure (the module still exists in this case)." msgstr "" -#: c-api/import.rst:88 +#: c-api/import.rst:91 +msgid "Return the module object corresponding to a module name." +msgstr "" + +#: c-api/import.rst:93 msgid "" -"Return the module object corresponding to a module name. The *name* " -"argument may be of the form ``package.module``. First check the modules " -"dictionary if there's one there, and if not, create a new one and insert it " -"in the modules dictionary. Return ``NULL`` with an exception set on failure." +"The *name* argument may be of the form ``package.module``. First check the " +"modules dictionary if there's one there, and if not, create a new one and " +"insert it in the modules dictionary." +msgstr "" + +#: c-api/import.rst:97 +msgid "" +"Return a :term:`strong reference` to the module on success. Return ``NULL`` " +"with an exception set on failure." +msgstr "" + +#: c-api/import.rst:100 +msgid "The module name *name* is decoded from UTF-8." msgstr "" -#: c-api/import.rst:95 +#: c-api/import.rst:102 msgid "" "This function does not load or import the module; if the module wasn't " "already loaded, you will get an empty module object. Use :c:func:" -"`PyImport_ImportModule` or one of its variants to import a module. Package " +"`PyImport_ImportModule` or one of its variants to import a module. Package " "structures implied by a dotted name for *name* are not created if not " "already present." msgstr "" -#: c-api/import.rst:105 +#: c-api/import.rst:113 msgid "" -"Similar to :c:func:`PyImport_AddModuleObject`, but the name is a UTF-8 " -"encoded string instead of a Unicode object." +"Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " +"reference` and *name* is a Python :class:`str` object." msgstr "" -#: c-api/import.rst:113 +#: c-api/import.rst:121 +msgid "" +"Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " +"reference`." +msgstr "" + +#: c-api/import.rst:129 msgid "" "Given a module name (possibly of the form ``package.module``) and a code " "object read from a Python bytecode file or obtained from the built-in " @@ -131,69 +155,69 @@ msgid "" "to the module author's intents) state." msgstr "" -#: c-api/import.rst:123 +#: c-api/import.rst:139 msgid "" -"The module's :attr:`__spec__` and :attr:`__loader__` will be set, if not set " -"already, with the appropriate values. The spec's loader will be set to the " -"module's ``__loader__`` (if set) and to an instance of :class:`~importlib." -"machinery.SourceFileLoader` otherwise." +"The module's :attr:`~module.__spec__` and :attr:`~module.__loader__` will be " +"set, if not set already, with the appropriate values. The spec's loader " +"will be set to the module's :attr:`!__loader__` (if set) and to an instance " +"of :class:`~importlib.machinery.SourceFileLoader` otherwise." msgstr "" -#: c-api/import.rst:128 +#: c-api/import.rst:144 msgid "" -"The module's :attr:`__file__` attribute will be set to the code object's :" -"attr:`~codeobject.co_filename`. If applicable, :attr:`__cached__` will also " -"be set." +"The module's :attr:`~module.__file__` attribute will be set to the code " +"object's :attr:`~codeobject.co_filename`. If applicable, :attr:`~module." +"__cached__` will also be set." msgstr "" -#: c-api/import.rst:132 +#: c-api/import.rst:148 msgid "" "This function will reload the module if it was already imported. See :c:" "func:`PyImport_ReloadModule` for the intended way to reload a module." msgstr "" -#: c-api/import.rst:135 +#: c-api/import.rst:151 msgid "" "If *name* points to a dotted name of the form ``package.module``, any " "package structures not already created will still not be created." msgstr "" -#: c-api/import.rst:138 +#: c-api/import.rst:154 msgid "" "See also :c:func:`PyImport_ExecCodeModuleEx` and :c:func:" "`PyImport_ExecCodeModuleWithPathnames`." msgstr "" -#: c-api/import.rst:141 +#: c-api/import.rst:157 msgid "" -"The setting of :attr:`__cached__` and :attr:`__loader__` is deprecated. See :" -"class:`~importlib.machinery.ModuleSpec` for alternatives." +"The setting of :attr:`~module.__cached__` and :attr:`~module.__loader__` is " +"deprecated. See :class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" -#: c-api/import.rst:149 +#: c-api/import.rst:165 msgid "" -"Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute " -"of the module object is set to *pathname* if it is non-``NULL``." +"Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`~module.__file__` " +"attribute of the module object is set to *pathname* if it is non-``NULL``." msgstr "" -#: c-api/import.rst:152 +#: c-api/import.rst:168 msgid "See also :c:func:`PyImport_ExecCodeModuleWithPathnames`." msgstr "" -#: c-api/import.rst:157 +#: c-api/import.rst:173 msgid "" -"Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`__cached__` " +"Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`~module.__cached__` " "attribute of the module object is set to *cpathname* if it is non-``NULL``. " "Of the three functions, this is the preferred one to use." msgstr "" -#: c-api/import.rst:163 +#: c-api/import.rst:179 msgid "" -"Setting :attr:`__cached__` is deprecated. See :class:`~importlib.machinery." -"ModuleSpec` for alternatives." +"Setting :attr:`~module.__cached__` is deprecated. See :class:`~importlib." +"machinery.ModuleSpec` for alternatives." msgstr "" -#: c-api/import.rst:170 +#: c-api/import.rst:186 msgid "" "Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and " "*cpathname* are UTF-8 encoded strings. Attempts are also made to figure out " @@ -201,48 +225,48 @@ msgid "" "set to ``NULL``." msgstr "" -#: c-api/import.rst:176 +#: c-api/import.rst:192 msgid "" -"Uses :func:`!imp.source_from_cache()` in calculating the source path if only " +"Uses :func:`!imp.source_from_cache` in calculating the source path if only " "the bytecode path is provided." msgstr "" -#: c-api/import.rst:179 +#: c-api/import.rst:195 msgid "No longer uses the removed :mod:`!imp` module." msgstr "" -#: c-api/import.rst:185 +#: c-api/import.rst:201 msgid "" "Return the magic number for Python bytecode files (a.k.a. :file:`.pyc` " "file). The magic number should be present in the first four bytes of the " "bytecode file, in little-endian byte order. Returns ``-1`` on error." msgstr "" -#: c-api/import.rst:189 +#: c-api/import.rst:205 msgid "Return value of ``-1`` upon failure." msgstr "" -#: c-api/import.rst:195 +#: c-api/import.rst:211 msgid "" "Return the magic tag string for :pep:`3147` format Python bytecode file " "names. Keep in mind that the value at ``sys.implementation.cache_tag`` is " "authoritative and should be used instead of this function." msgstr "" -#: c-api/import.rst:203 +#: c-api/import.rst:219 msgid "" "Return the dictionary used for the module administration (a.k.a. ``sys." "modules``). Note that this is a per-interpreter variable." msgstr "" -#: c-api/import.rst:208 +#: c-api/import.rst:224 msgid "" "Return the already imported module with the given name. If the module has " "not been imported yet then returns ``NULL`` but does not set an error. " "Returns ``NULL`` and sets an error if the lookup failed." msgstr "" -#: c-api/import.rst:216 +#: c-api/import.rst:232 msgid "" "Return a finder object for a :data:`sys.path`/:attr:`!pkg.__path__` item " "*path*, possibly by fetching it from the :data:`sys.path_importer_cache` " @@ -253,7 +277,7 @@ msgid "" "path_importer_cache`. Return a new reference to the finder object." msgstr "" -#: c-api/import.rst:227 +#: c-api/import.rst:243 msgid "" "Load a frozen module named *name*. Return ``1`` for success, ``0`` if the " "module is not found, and ``-1`` with an exception set if the initialization " @@ -262,17 +286,17 @@ msgid "" "the module if it was already imported.)" msgstr "" -#: c-api/import.rst:235 +#: c-api/import.rst:251 msgid "The ``__file__`` attribute is no longer set on the module." msgstr "" -#: c-api/import.rst:241 +#: c-api/import.rst:257 msgid "" "Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a " "UTF-8 encoded string instead of a Unicode object." msgstr "" -#: c-api/import.rst:249 +#: c-api/import.rst:265 msgid "" "This is the structure type definition for frozen module descriptors, as " "generated by the :program:`freeze` utility (see :file:`Tools/freeze/` in the " @@ -280,13 +304,23 @@ msgid "" "h`, is::" msgstr "" -#: c-api/import.rst:261 +#: c-api/import.rst:270 +msgid "" +"struct _frozen {\n" +" const char *name;\n" +" const unsigned char *code;\n" +" int size;\n" +" bool is_package;\n" +"};" +msgstr "" + +#: c-api/import.rst:277 msgid "" "The new ``is_package`` field indicates whether the module is a package or " "not. This replaces setting the ``size`` field to a negative value." msgstr "" -#: c-api/import.rst:267 +#: c-api/import.rst:283 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -295,7 +329,7 @@ msgid "" "frozen modules." msgstr "" -#: c-api/import.rst:275 +#: c-api/import.rst:291 msgid "" "Add a single module to the existing table of built-in modules. This is a " "convenience wrapper around :c:func:`PyImport_ExtendInittab`, returning " @@ -305,7 +339,7 @@ msgid "" "before :c:func:`Py_Initialize`." msgstr "" -#: c-api/import.rst:285 +#: c-api/import.rst:301 msgid "" "Structure describing a single entry in the list of built-in modules. " "Programs which embed Python may use an array of these structures in " @@ -313,15 +347,15 @@ msgid "" "built-in modules. The structure consists of two members:" msgstr "" -#: c-api/import.rst:293 +#: c-api/import.rst:309 msgid "The module name, as an ASCII encoded string." msgstr "" -#: c-api/import.rst:297 +#: c-api/import.rst:313 msgid "Initialization function for a module built into the interpreter." msgstr "" -#: c-api/import.rst:302 +#: c-api/import.rst:318 msgid "" "Add a collection of modules to the table of built-in modules. The *newtab* " "array must end with a sentinel entry which contains ``NULL`` for the :c:" @@ -332,13 +366,42 @@ msgid "" "before :c:func:`Py_Initialize`." msgstr "" -#: c-api/import.rst:309 +#: c-api/import.rst:325 msgid "" "If Python is initialized multiple times, :c:func:`PyImport_AppendInittab` " "or :c:func:`PyImport_ExtendInittab` must be called before each Python " "initialization." msgstr "" +#: c-api/import.rst:332 +msgid "" +"The table of built-in modules used by Python initialization. Do not use this " +"directly; use :c:func:`PyImport_AppendInittab` and :c:func:" +"`PyImport_ExtendInittab` instead." +msgstr "" + +#: c-api/import.rst:339 +msgid "Import the module *mod_name* and get its attribute *attr_name*." +msgstr "" + +#: c-api/import.rst:341 +msgid "Names must be Python :class:`str` objects." +msgstr "" + +#: c-api/import.rst:343 +msgid "" +"Helper function combining :c:func:`PyImport_Import` and :c:func:" +"`PyObject_GetAttr`. For example, it can raise :exc:`ImportError` if the " +"module is not found, and :exc:`AttributeError` if the attribute doesn't " +"exist." +msgstr "" + +#: c-api/import.rst:352 +msgid "" +"Similar to :c:func:`PyImport_ImportModuleAttr`, but names are UTF-8 encoded " +"strings instead of Python :class:`str` objects." +msgstr "" + #: c-api/import.rst:11 msgid "package variable" msgstr "" @@ -355,18 +418,18 @@ msgstr "" msgid "modules (in module sys)" msgstr "" -#: c-api/import.rst:111 +#: c-api/import.rst:127 msgid "built-in function" msgstr "" -#: c-api/import.rst:32 +#: c-api/import.rst:35 msgid "__import__" msgstr "" -#: c-api/import.rst:111 +#: c-api/import.rst:127 msgid "compile" msgstr "" -#: c-api/import.rst:247 +#: c-api/import.rst:263 msgid "freeze utility" msgstr "" diff --git a/c-api/index.po b/c-api/index.po index c7c6be32..04be2edc 100644 --- a/c-api/index.po +++ b/c-api/index.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/c-api/init.po b/c-api/init.po index 9fcd351f..2f656ffb 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -21,14 +22,16 @@ msgid "Initialization, Finalization, and Threads" msgstr "" #: c-api/init.rst:10 -msgid "See also :ref:`Python Initialization Configuration `." +msgid "" +"See :ref:`Python Initialization Configuration ` for details on " +"how to configure the interpreter prior to initialization." msgstr "" -#: c-api/init.rst:15 +#: c-api/init.rst:16 msgid "Before Python Initialization" msgstr "" -#: c-api/init.rst:17 +#: c-api/init.rst:18 msgid "" "In an application embedding Python, the :c:func:`Py_Initialize` function " "must be called before using any other Python/C API functions; with the " @@ -36,152 +39,186 @@ msgid "" "`." msgstr "" -#: c-api/init.rst:22 +#: c-api/init.rst:23 msgid "" "The following functions can be safely called before Python is initialized:" msgstr "" -#: c-api/init.rst:24 -msgid "Configuration functions:" -msgstr "" - -#: c-api/init.rst:26 -msgid ":c:func:`PyImport_AppendInittab`" +#: c-api/init.rst:25 +msgid "Functions that initialize the interpreter:" msgstr "" #: c-api/init.rst:27 -msgid ":c:func:`PyImport_ExtendInittab`" +msgid ":c:func:`Py_Initialize`" msgstr "" #: c-api/init.rst:28 -msgid ":c:func:`!PyInitFrozenExtensions`" +msgid ":c:func:`Py_InitializeEx`" msgstr "" #: c-api/init.rst:29 -msgid ":c:func:`PyMem_SetAllocator`" +msgid ":c:func:`Py_InitializeFromConfig`" msgstr "" #: c-api/init.rst:30 -msgid ":c:func:`PyMem_SetupDebugHooks`" +msgid ":c:func:`Py_BytesMain`" msgstr "" #: c-api/init.rst:31 -msgid ":c:func:`PyObject_SetArenaAllocator`" +msgid ":c:func:`Py_Main`" msgstr "" #: c-api/init.rst:32 -msgid ":c:func:`Py_SetPath`" -msgstr "" - -#: c-api/init.rst:33 -msgid ":c:func:`Py_SetProgramName`" +msgid "the runtime pre-initialization functions covered in :ref:`init-config`" msgstr "" #: c-api/init.rst:34 -msgid ":c:func:`Py_SetPythonHome`" -msgstr "" - -#: c-api/init.rst:35 -msgid ":c:func:`Py_SetStandardStreamEncoding`" +msgid "Configuration functions:" msgstr "" #: c-api/init.rst:36 -msgid ":c:func:`PySys_AddWarnOption`" +msgid ":c:func:`PyImport_AppendInittab`" msgstr "" #: c-api/init.rst:37 -msgid ":c:func:`PySys_AddXOption`" +msgid ":c:func:`PyImport_ExtendInittab`" msgstr "" #: c-api/init.rst:38 -msgid ":c:func:`PySys_ResetWarnOptions`" +msgid ":c:func:`!PyInitFrozenExtensions`" +msgstr "" + +#: c-api/init.rst:39 +msgid ":c:func:`PyMem_SetAllocator`" msgstr "" #: c-api/init.rst:40 -msgid "Informative functions:" +msgid ":c:func:`PyMem_SetupDebugHooks`" +msgstr "" + +#: c-api/init.rst:41 +msgid ":c:func:`PyObject_SetArenaAllocator`" msgstr "" #: c-api/init.rst:42 -msgid ":c:func:`Py_IsInitialized`" +msgid ":c:func:`Py_SetProgramName`" msgstr "" #: c-api/init.rst:43 -msgid ":c:func:`PyMem_GetAllocator`" +msgid ":c:func:`Py_SetPythonHome`" msgstr "" #: c-api/init.rst:44 -msgid ":c:func:`PyObject_GetArenaAllocator`" +msgid ":c:func:`PySys_ResetWarnOptions`" msgstr "" #: c-api/init.rst:45 +msgid "the configuration functions covered in :ref:`init-config`" +msgstr "" + +#: c-api/init.rst:47 +msgid "Informative functions:" +msgstr "" + +#: c-api/init.rst:57 +msgid ":c:func:`Py_IsInitialized`" +msgstr "" + +#: c-api/init.rst:50 +msgid ":c:func:`PyMem_GetAllocator`" +msgstr "" + +#: c-api/init.rst:51 +msgid ":c:func:`PyObject_GetArenaAllocator`" +msgstr "" + +#: c-api/init.rst:52 msgid ":c:func:`Py_GetBuildInfo`" msgstr "" -#: c-api/init.rst:46 +#: c-api/init.rst:53 msgid ":c:func:`Py_GetCompiler`" msgstr "" -#: c-api/init.rst:47 +#: c-api/init.rst:54 msgid ":c:func:`Py_GetCopyright`" msgstr "" -#: c-api/init.rst:48 +#: c-api/init.rst:55 msgid ":c:func:`Py_GetPlatform`" msgstr "" -#: c-api/init.rst:49 +#: c-api/init.rst:56 msgid ":c:func:`Py_GetVersion`" msgstr "" -#: c-api/init.rst:51 +#: c-api/init.rst:59 msgid "Utilities:" msgstr "" -#: c-api/init.rst:53 +#: c-api/init.rst:61 msgid ":c:func:`Py_DecodeLocale`" msgstr "" -#: c-api/init.rst:55 +#: c-api/init.rst:62 +msgid "" +"the status reporting and utility functions covered in :ref:`init-config`" +msgstr "" + +#: c-api/init.rst:64 msgid "Memory allocators:" msgstr "" -#: c-api/init.rst:57 +#: c-api/init.rst:66 msgid ":c:func:`PyMem_RawMalloc`" msgstr "" -#: c-api/init.rst:58 +#: c-api/init.rst:67 msgid ":c:func:`PyMem_RawRealloc`" msgstr "" -#: c-api/init.rst:59 +#: c-api/init.rst:68 msgid ":c:func:`PyMem_RawCalloc`" msgstr "" -#: c-api/init.rst:60 +#: c-api/init.rst:69 msgid ":c:func:`PyMem_RawFree`" msgstr "" -#: c-api/init.rst:64 +#: c-api/init.rst:71 +msgid "Synchronization:" +msgstr "" + +#: c-api/init.rst:73 +msgid ":c:func:`PyMutex_Lock`" +msgstr "" + +#: c-api/init.rst:74 +msgid ":c:func:`PyMutex_Unlock`" +msgstr "" + +#: c-api/init.rst:78 msgid "" -"The following functions **should not be called** before :c:func:" -"`Py_Initialize`: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" +"Despite their apparent similarity to some of the functions listed above, the " +"following functions **should not be called** before the interpreter has been " +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" "`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:" "`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:" -"`Py_GetProgramName` and :c:func:`PyEval_InitThreads`." +"`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." msgstr "" -#: c-api/init.rst:74 +#: c-api/init.rst:90 msgid "Global configuration variables" msgstr "" -#: c-api/init.rst:76 +#: c-api/init.rst:92 msgid "" "Python has variables for the global configuration to control different " "features and options. By default, these flags are controlled by :ref:" "`command line options `." msgstr "" -#: c-api/init.rst:80 +#: c-api/init.rst:96 msgid "" "When a flag is set by an option, the value of the flag is the number of " "times that the option was set. For example, ``-b`` sets :c:data:" @@ -189,222 +226,222 @@ msgid "" "2." msgstr "" -#: c-api/init.rst:86 +#: c-api/init.rst:102 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "bytes_warning` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:90 +#: c-api/init.rst:106 msgid "" "Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" "class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " "or equal to ``2``." msgstr "" -#: c-api/init.rst:94 +#: c-api/init.rst:110 msgid "Set by the :option:`-b` option." msgstr "" -#: c-api/init.rst:100 +#: c-api/init.rst:116 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "parser_debug` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:104 +#: c-api/init.rst:120 msgid "" "Turn on parser debugging output (for expert only, depending on compilation " "options)." msgstr "" -#: c-api/init.rst:107 +#: c-api/init.rst:123 msgid "" "Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment " "variable." msgstr "" -#: c-api/init.rst:114 +#: c-api/init.rst:130 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "write_bytecode` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:118 +#: c-api/init.rst:134 msgid "" "If set to non-zero, Python won't try to write ``.pyc`` files on the import " "of source modules." msgstr "" -#: c-api/init.rst:121 +#: c-api/init.rst:137 msgid "" "Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE` " "environment variable." msgstr "" -#: c-api/init.rst:128 +#: c-api/init.rst:144 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "pathconfig_warnings` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:132 +#: c-api/init.rst:148 msgid "" "Suppress error messages when calculating the module search path in :c:func:" "`Py_GetPath`." msgstr "" -#: c-api/init.rst:135 +#: c-api/init.rst:151 msgid "Private flag used by ``_freeze_module`` and ``frozenmain`` programs." msgstr "" -#: c-api/init.rst:141 +#: c-api/init.rst:157 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" -#: c-api/init.rst:146 +#: c-api/init.rst:162 msgid "" "Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to " "a non-empty string." msgstr "" -#: c-api/init.rst:149 +#: c-api/init.rst:165 msgid "" "If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment " "variable to initialize the secret hash seed." msgstr "" -#: c-api/init.rst:156 +#: c-api/init.rst:172 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "use_environment` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:160 +#: c-api/init.rst:176 msgid "" "Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" "`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" -#: c-api/init.rst:163 +#: c-api/init.rst:179 msgid "Set by the :option:`-E` and :option:`-I` options." msgstr "" -#: c-api/init.rst:169 +#: c-api/init.rst:185 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "inspect` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:173 +#: c-api/init.rst:189 msgid "" "When a script is passed as first argument or the :option:`-c` option is " "used, enter interactive mode after executing the script or the command, even " "when :data:`sys.stdin` does not appear to be a terminal." msgstr "" -#: c-api/init.rst:177 +#: c-api/init.rst:193 msgid "" "Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment " "variable." msgstr "" -#: c-api/init.rst:184 +#: c-api/init.rst:200 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "interactive` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:188 +#: c-api/init.rst:204 msgid "Set by the :option:`-i` option." msgstr "" -#: c-api/init.rst:194 +#: c-api/init.rst:210 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "isolated` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:198 +#: c-api/init.rst:214 msgid "" "Run Python in isolated mode. In isolated mode :data:`sys.path` contains " "neither the script's directory nor the user's site-packages directory." msgstr "" -#: c-api/init.rst:201 +#: c-api/init.rst:217 msgid "Set by the :option:`-I` option." msgstr "" -#: c-api/init.rst:209 +#: c-api/init.rst:225 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyPreConfig." "legacy_windows_fs_encoding` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" -#: c-api/init.rst:213 +#: c-api/init.rst:229 msgid "" "If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error " "handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler, " "for the :term:`filesystem encoding and error handler`." msgstr "" -#: c-api/init.rst:217 +#: c-api/init.rst:233 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable is set to a non-empty string." msgstr "" -#: c-api/init.rst:220 +#: c-api/init.rst:236 msgid "See :pep:`529` for more details." msgstr "" -#: c-api/init.rst:240 -msgid ":ref:`Availability `: Windows." +#: c-api/init.rst:256 +msgid "Availability" msgstr "" -#: c-api/init.rst:228 +#: c-api/init.rst:244 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "legacy_windows_stdio` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" -#: c-api/init.rst:232 +#: c-api/init.rst:248 msgid "" "If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" -#: c-api/init.rst:235 +#: c-api/init.rst:251 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: c-api/init.rst:238 +#: c-api/init.rst:254 msgid "See :pep:`528` for more details." msgstr "" -#: c-api/init.rst:246 +#: c-api/init.rst:262 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "site_import` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:250 +#: c-api/init.rst:266 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -412,83 +449,83 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: c-api/init.rst:255 +#: c-api/init.rst:271 msgid "Set by the :option:`-S` option." msgstr "" -#: c-api/init.rst:261 +#: c-api/init.rst:277 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "user_site_directory` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:265 +#: c-api/init.rst:281 msgid "" "Don't add the :data:`user site-packages directory ` to :data:" "`sys.path`." msgstr "" -#: c-api/init.rst:268 +#: c-api/init.rst:284 msgid "" "Set by the :option:`-s` and :option:`-I` options, and the :envvar:" "`PYTHONNOUSERSITE` environment variable." msgstr "" -#: c-api/init.rst:275 +#: c-api/init.rst:291 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "optimization_level` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:279 +#: c-api/init.rst:295 msgid "" "Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment " "variable." msgstr "" -#: c-api/init.rst:286 +#: c-api/init.rst:302 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "quiet` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: c-api/init.rst:290 +#: c-api/init.rst:306 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: c-api/init.rst:292 +#: c-api/init.rst:308 msgid "Set by the :option:`-q` option." msgstr "" -#: c-api/init.rst:300 +#: c-api/init.rst:316 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "buffered_stdio` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:304 +#: c-api/init.rst:320 msgid "Force the stdout and stderr streams to be unbuffered." msgstr "" -#: c-api/init.rst:306 +#: c-api/init.rst:322 msgid "" "Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED` " "environment variable." msgstr "" -#: c-api/init.rst:313 +#: c-api/init.rst:329 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "verbose` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:317 +#: c-api/init.rst:333 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. If greater or equal " @@ -496,72 +533,113 @@ msgid "" "for a module. Also provides information on module cleanup at exit." msgstr "" -#: c-api/init.rst:322 +#: c-api/init.rst:338 msgid "" "Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment " "variable." msgstr "" -#: c-api/init.rst:329 +#: c-api/init.rst:345 msgid "Initializing and finalizing the interpreter" msgstr "" -#: c-api/init.rst:347 +#: c-api/init.rst:360 msgid "" "Initialize the Python interpreter. In an application embedding Python, " "this should be called before using any other Python/C API functions; see :" "ref:`Before Python Initialization ` for the few exceptions." msgstr "" -#: c-api/init.rst:351 +#: c-api/init.rst:364 msgid "" "This initializes the table of loaded modules (``sys.modules``), and creates " -"the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It " +"the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It " "also initializes the module search path (``sys.path``). It does not set " -"``sys.argv``; use :c:func:`PySys_SetArgvEx` for that. This is a no-op when " -"called for a second time (without calling :c:func:`Py_FinalizeEx` first). " -"There is no return value; it is a fatal error if the initialization fails." +"``sys.argv``; use the :ref:`Python Initialization Configuration ` API for that. This is a no-op when called for a second time " +"(without calling :c:func:`Py_FinalizeEx` first). There is no return value; " +"it is a fatal error if the initialization fails." msgstr "" -#: c-api/init.rst:373 +#: c-api/init.rst:386 msgid "" -"Use the :c:func:`Py_InitializeFromConfig` function to customize the :ref:" -"`Python Initialization Configuration `." +"Use :c:func:`Py_InitializeFromConfig` to customize the :ref:`Python " +"Initialization Configuration `." msgstr "" -#: c-api/init.rst:363 +#: c-api/init.rst:376 msgid "" "On Windows, changes the console mode from ``O_TEXT`` to ``O_BINARY``, which " "will also affect non-Python uses of the console using the C Runtime." msgstr "" -#: c-api/init.rst:369 +#: c-api/init.rst:382 msgid "" "This function works like :c:func:`Py_Initialize` if *initsigs* is ``1``. If " "*initsigs* is ``0``, it skips initialization registration of signal " -"handlers, which might be useful when Python is embedded." +"handlers, which may be useful when CPython is embedded as part of a larger " +"application." +msgstr "" + +#: c-api/init.rst:392 +msgid "" +"Initialize Python from *config* configuration, as described in :ref:`init-" +"from-config`." +msgstr "" + +#: c-api/init.rst:395 +msgid "" +"See the :ref:`init-config` section for details on pre-initializing the " +"interpreter, populating the runtime configuration structure, and querying " +"the returned status structure." msgstr "" -#: c-api/init.rst:379 +#: c-api/init.rst:402 msgid "" "Return true (nonzero) when the Python interpreter has been initialized, " "false (zero) if not. After :c:func:`Py_FinalizeEx` is called, this returns " "false until :c:func:`Py_Initialize` is called again." msgstr "" -#: c-api/init.rst:386 +#: c-api/init.rst:409 +msgid "" +"Return true (non-zero) if the main Python interpreter is :term:`shutting " +"down `. Return false (zero) otherwise." +msgstr "" + +#: c-api/init.rst:417 msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " "of Python/C API functions, and destroy all sub-interpreters (see :c:func:" "`Py_NewInterpreter` below) that were created and not yet destroyed since the " -"last call to :c:func:`Py_Initialize`. Ideally, this frees all memory " -"allocated by the Python interpreter. This is a no-op when called for a " -"second time (without calling :c:func:`Py_Initialize` again first). Normally " -"the return value is ``0``. If there were errors during finalization " +"last call to :c:func:`Py_Initialize`. This is a no-op when called for a " +"second time (without calling :c:func:`Py_Initialize` again first)." +msgstr "" + +#: c-api/init.rst:423 +msgid "" +"Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " +"the same thread with the same interpreter active. That means the main " +"thread and the main interpreter. This should never be called while :c:func:" +"`Py_RunMain` is running." +msgstr "" + +#: c-api/init.rst:428 +msgid "" +"Normally the return value is ``0``. If there were errors during finalization " "(flushing buffered data), ``-1`` is returned." msgstr "" -#: c-api/init.rst:395 +#: c-api/init.rst:432 +msgid "" +"Note that Python will do a best effort at freeing all memory allocated by " +"the Python interpreter. Therefore, any C-Extension should make sure to " +"correctly clean up all of the preveiously allocated PyObjects before using " +"them in subsequent calls to :c:func:`Py_Initialize`. Otherwise it could " +"introduce vulnerabilities and incorrect behavior." +msgstr "" + +#: c-api/init.rst:438 msgid "" "This function is provided for a number of reasons. An embedding application " "might want to restart Python without having to restart the application " @@ -572,7 +650,7 @@ msgid "" "Python before exiting from the application." msgstr "" -#: c-api/init.rst:403 +#: c-api/init.rst:446 msgid "" "**Bugs and caveats:** The destruction of modules and objects in modules is " "done in random order; this may cause destructors (:meth:`~object.__del__` " @@ -580,81 +658,167 @@ msgid "" "modules. Dynamically loaded extension modules loaded by Python are not " "unloaded. Small amounts of memory allocated by the Python interpreter may " "not be freed (if you find a leak, please report it). Memory tied up in " -"circular references between objects is not freed. Some memory allocated by " +"circular references between objects is not freed. Interned strings will all " +"be deallocated regardless of their reference count. Some memory allocated by " "extension modules may not be freed. Some extensions may not work properly " "if their initialization routine is called more than once; this can happen if " "an application calls :c:func:`Py_Initialize` and :c:func:`Py_FinalizeEx` " -"more than once." +"more than once. :c:func:`Py_FinalizeEx` must not be called recursively from " +"within itself. Therefore, it must not be called by any code that may be run " +"as part of the interpreter shutdown process, such as :py:mod:`atexit` " +"handlers, object finalizers, or any code that may be run while flushing the " +"stdout and stderr files." msgstr "" -#: c-api/init.rst:414 +#: c-api/init.rst:462 msgid "" "Raises an :ref:`auditing event ` ``cpython." "_PySys_ClearAuditHooks`` with no arguments." msgstr "" -#: c-api/init.rst:420 +#: c-api/init.rst:469 msgid "" "This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that " "disregards the return value." msgstr "" -#: c-api/init.rst:425 -msgid "Process-wide parameters" +#: c-api/init.rst:475 +msgid "" +"Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings, " +"allowing the calling application to delegate the text decoding step to the " +"CPython runtime." msgstr "" -#: c-api/init.rst:435 +#: c-api/init.rst:484 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"stdio_encoding` and :c:member:`PyConfig.stdio_errors` should be used " -"instead, see :ref:`Python Initialization Configuration `." +"The main program for the standard interpreter, encapsulating a full " +"initialization/finalization cycle, as well as additional behaviour to " +"implement reading configurations settings from the environment and command " +"line, and then executing ``__main__`` in accordance with :ref:`using-on-" +"cmdline`." +msgstr "" + +#: c-api/init.rst:490 +msgid "" +"This is made available for programs which wish to support the full CPython " +"command line interface, rather than just embedding a Python runtime in a " +"larger application." +msgstr "" + +#: c-api/init.rst:494 +msgid "" +"The *argc* and *argv* parameters are similar to those which are passed to a " +"C program's :c:func:`main` function, except that the *argv* entries are " +"first converted to ``wchar_t`` using :c:func:`Py_DecodeLocale`. It is also " +"important to note that the argument list entries may be modified to point to " +"strings other than those passed in (however, the contents of the strings " +"pointed to by the argument list are not modified)." +msgstr "" + +#: c-api/init.rst:501 +msgid "" +"The return value is ``2`` if the argument list does not represent a valid " +"Python command line, and otherwise the same as :c:func:`Py_RunMain`." +msgstr "" + +#: c-api/init.rst:504 +msgid "" +"In terms of the CPython runtime configuration APIs documented in the :ref:" +"`runtime configuration ` section (and without accounting for " +"error handling), ``Py_Main`` is approximately equivalent to::" +msgstr "" + +#: c-api/init.rst:508 +msgid "" +"PyConfig config;\n" +"PyConfig_InitPythonConfig(&config);\n" +"PyConfig_SetArgv(&config, argc, argv);\n" +"Py_InitializeFromConfig(&config);\n" +"PyConfig_Clear(&config);\n" +"\n" +"Py_RunMain();" +msgstr "" + +#: c-api/init.rst:516 +msgid "" +"In normal usage, an embedding application will call this function *instead* " +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:" +"`Py_InitializeFromConfig` directly, and all settings will be applied as " +"described elsewhere in this documentation. If this function is instead " +"called *after* a preceding runtime initialization API call, then exactly " +"which environmental and command line configuration settings will be updated " +"is version dependent (as it depends on which settings correctly support " +"being modified after they have already been set once when the runtime was " +"first initialized)." +msgstr "" + +#: c-api/init.rst:529 +msgid "Executes the main module in a fully configured CPython runtime." msgstr "" -#: c-api/init.rst:440 +#: c-api/init.rst:531 msgid "" -"This function should be called before :c:func:`Py_Initialize`, if it is " -"called at all. It specifies which encoding and error handling to use with " -"standard IO, with the same meanings as in :func:`str.encode`." +"Executes the command (:c:member:`PyConfig.run_command`), the script (:c:" +"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." +"run_module`) specified on the command line or in the configuration. If none " +"of these values are set, runs the interactive Python prompt (REPL) using the " +"``__main__`` module's global namespace." msgstr "" -#: c-api/init.rst:444 +#: c-api/init.rst:537 msgid "" -"It overrides :envvar:`PYTHONIOENCODING` values, and allows embedding code to " -"control IO encoding when the environment variable does not work." +"If :c:member:`PyConfig.inspect` is not set (the default), the return value " +"will be ``0`` if the interpreter exits normally (that is, without raising an " +"exception), the exit status of an unhandled :exc:`SystemExit`, or ``1`` for " +"any other unhandled exception." msgstr "" -#: c-api/init.rst:447 +#: c-api/init.rst:542 msgid "" -"*encoding* and/or *errors* may be ``NULL`` to use :envvar:`PYTHONIOENCODING` " -"and/or default values (depending on other settings)." +"If :c:member:`PyConfig.inspect` is set (such as when the :option:`-i` option " +"is used), rather than returning when the interpreter exits, execution will " +"instead resume in an interactive Python prompt (REPL) using the ``__main__`` " +"module's global namespace. If the interpreter exited with an exception, it " +"is immediately raised in the REPL session. The function return value is then " +"determined by the way the *REPL session* terminates: ``0``, ``1``, or the " +"status of a :exc:`SystemExit`, as specified above." msgstr "" -#: c-api/init.rst:451 +#: c-api/init.rst:550 msgid "" -"Note that :data:`sys.stderr` always uses the \"backslashreplace\" error " -"handler, regardless of this (or any other) setting." +"This function always finalizes the Python interpreter before it returns." msgstr "" -#: c-api/init.rst:454 +#: c-api/init.rst:552 msgid "" -"If :c:func:`Py_FinalizeEx` is called, this function will need to be called " -"again in order to affect subsequent calls to :c:func:`Py_Initialize`." +"See :ref:`Python Configuration ` for an example of a " +"customized Python that always runs in isolated mode using :c:func:" +"`Py_RunMain`." msgstr "" -#: c-api/init.rst:457 +#: c-api/init.rst:558 msgid "" -"Returns ``0`` if successful, a nonzero value on error (e.g. calling after " -"the interpreter has already been initialized)." +"Register an :mod:`atexit` callback for the target interpreter *interp*. This " +"is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and " +"data pointer for the callback." +msgstr "" + +#: c-api/init.rst:562 +msgid "There must be an :term:`attached thread state` for *interp*." +msgstr "" + +#: c-api/init.rst:567 +msgid "Process-wide parameters" msgstr "" -#: c-api/init.rst:472 +#: c-api/init.rst:577 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "program_name` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: c-api/init.rst:476 +#: c-api/init.rst:581 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -668,58 +832,72 @@ msgid "" "this storage." msgstr "" -#: c-api/init.rst:487 +#: c-api/init.rst:840 c-api/init.rst:902 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_t *` string." +"`wchar_t*` string." msgstr "" -#: c-api/init.rst:497 +#: c-api/init.rst:600 msgid "" -"Return the program name set with :c:func:`Py_SetProgramName`, or the " +"Return the program name set with :c:member:`PyConfig.program_name`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: c-api/init.rst:520 c-api/init.rst:580 c-api/init.rst:827 +#: c-api/init.rst:627 c-api/init.rst:699 c-api/init.rst:914 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "" -#: c-api/init.rst:523 c-api/init.rst:583 c-api/init.rst:830 +#: c-api/init.rst:630 c-api/init.rst:702 c-api/init.rst:917 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "" -#: c-api/init.rst:510 +#: c-api/init.rst:705 +msgid "" +"Use :c:func:`PyConfig_Get(\"executable\") ` (:data:`sys." +"executable`) instead." +msgstr "" + +#: c-api/init.rst:617 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " -"with :c:func:`Py_SetProgramName` and some environment variables; for " +"with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the prefix is " "``'/usr/local'``. The returned string points into static storage; the caller " "should not modify its value. This corresponds to the :makevar:`prefix` " "variable in the top-level :file:`Makefile` and the :option:`--prefix` " "argument to the :program:`configure` script at build time. The value is " -"available to Python code as ``sys.prefix``. It is only useful on Unix. See " -"also the next function." +"available to Python code as ``sys.base_prefix``. It is only useful on Unix. " +"See also the next function." msgstr "" -#: c-api/init.rst:529 +#: c-api/init.rst:633 +msgid "" +"Use :c:func:`PyConfig_Get(\"base_prefix\") ` (:data:`sys." +"base_prefix`) instead. Use :c:func:`PyConfig_Get(\"prefix\") ` " +"(:data:`sys.prefix`) if :ref:`virtual environments ` need to be " +"handled." +msgstr "" + +#: c-api/init.rst:642 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " -"with :c:func:`Py_SetProgramName` and some environment variables; for " +"with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " "caller should not modify its value. This corresponds to the :makevar:" "`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" "prefix`` argument to the :program:`configure` script at build time. The " -"value is available to Python code as ``sys.exec_prefix``. It is only useful " -"on Unix." +"value is available to Python code as ``sys.base_exec_prefix``. It is only " +"useful on Unix." msgstr "" -#: c-api/init.rst:539 +#: c-api/init.rst:653 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -728,7 +906,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: c-api/init.rst:545 +#: c-api/init.rst:659 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -742,7 +920,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: c-api/init.rst:556 +#: c-api/init.rst:670 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -750,19 +928,27 @@ msgid "" "platform." msgstr "" -#: c-api/init.rst:574 +#: c-api/init.rst:681 +msgid "" +"Use :c:func:`PyConfig_Get(\"base_exec_prefix\") ` (:data:`sys." +"base_exec_prefix`) instead. Use :c:func:`PyConfig_Get(\"exec_prefix\") " +"` (:data:`sys.exec_prefix`) if :ref:`virtual environments " +"` need to be handled." +msgstr "" + +#: c-api/init.rst:693 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " -"name (set by :c:func:`Py_SetProgramName` above). The returned string points " +"name (set by :c:member:`PyConfig.program_name`). The returned string points " "into static storage; the caller should not modify its value. The value is " "available to Python code as ``sys.executable``." msgstr "" -#: c-api/init.rst:594 +#: c-api/init.rst:716 msgid "" "Return the default module search path; this is computed from the program " -"name (set by :c:func:`Py_SetProgramName` above) and some environment " +"name (set by :c:member:`PyConfig.program_name`) and some environment " "variables. The returned string consists of a series of directory names " "separated by a platform dependent delimiter character. The delimiter " "character is ``':'`` on Unix and macOS, ``';'`` on Windows. The returned " @@ -772,58 +958,23 @@ msgid "" "for loading modules." msgstr "" -#: c-api/init.rst:620 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " -"be used instead, see :ref:`Python Initialization Configuration `." -msgstr "" - -#: c-api/init.rst:625 -msgid "" -"Set the default module search path. If this function is called before :c:" -"func:`Py_Initialize`, then :c:func:`Py_GetPath` won't attempt to compute a " -"default search path but uses the one provided instead. This is useful if " -"Python is embedded by an application that has full knowledge of the location " -"of all modules. The path components should be separated by the platform " -"dependent delimiter character, which is ``':'`` on Unix and macOS, ``';'`` " -"on Windows." -msgstr "" - -#: c-api/init.rst:633 -msgid "" -"This also causes :data:`sys.executable` to be set to the program full path " -"(see :c:func:`Py_GetProgramFullPath`) and for :data:`sys.prefix` and :data:" -"`sys.exec_prefix` to be empty. It is up to the caller to modify these if " -"required after calling :c:func:`Py_Initialize`." -msgstr "" - -#: c-api/init.rst:753 c-api/init.rst:815 -msgid "" -"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_*` string." -msgstr "" - -#: c-api/init.rst:641 -msgid "" -"The path argument is copied internally, so the caller may free it after the " -"call completes." -msgstr "" - -#: c-api/init.rst:644 +#: c-api/init.rst:734 msgid "" -"The program full path is now used for :data:`sys.executable`, instead of the " -"program name." +"Use :c:func:`PyConfig_Get(\"module_search_paths\") ` (:data:" +"`sys.path`) instead." msgstr "" -#: c-api/init.rst:653 +#: c-api/init.rst:740 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: c-api/init.rst:660 +#: c-api/init.rst:743 +msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" +msgstr "" + +#: c-api/init.rst:747 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " @@ -832,11 +983,11 @@ msgid "" "version`." msgstr "" -#: c-api/init.rst:665 +#: c-api/init.rst:752 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: c-api/init.rst:672 +#: c-api/init.rst:759 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -847,42 +998,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: c-api/init.rst:683 +#: c-api/init.rst:770 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: c-api/init.rst:685 +#: c-api/init.rst:772 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "" -#: c-api/init.rst:689 +#: c-api/init.rst:776 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: c-api/init.rst:695 +#: c-api/init.rst:782 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: c-api/init.rst:716 +#: c-api/init.rst:785 +msgid "\"[GCC 2.7.2.2]\"" +msgstr "" + +#: c-api/init.rst:803 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: c-api/init.rst:709 +#: c-api/init.rst:796 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: c-api/init.rst:728 +#: c-api/init.rst:799 +msgid "\"#67, Aug 1 1997, 22:34:28\"" +msgstr "" + +#: c-api/init.rst:815 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -890,7 +1049,7 @@ msgid "" "config>`." msgstr "" -#: c-api/init.rst:733 +#: c-api/init.rst:820 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -901,81 +1060,84 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: c-api/init.rst:741 +#: c-api/init.rst:828 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: c-api/init.rst:745 +#: c-api/init.rst:832 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " "path of the directory where the script is located is prepended to :data:`sys." "path`." msgstr "" -#: c-api/init.rst:748 +#: c-api/init.rst:835 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: c-api/init.rst:792 +#: c-api/init.rst:879 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: c-api/init.rst:760 +#: c-api/init.rst:847 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " -"and update :data:`sys.path` themselves if desired. See `CVE-2008-5983 " -"`_." +"and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: c-api/init.rst:765 +#: c-api/init.rst:852 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " "popping the first :data:`sys.path` element after having called :c:func:" "`PySys_SetArgv`, for example using::" msgstr "" -#: c-api/init.rst:781 +#: c-api/init.rst:856 +msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" +msgstr "" + +#: c-api/init.rst:868 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" "`Python Initialization Configuration `." msgstr "" -#: c-api/init.rst:785 +#: c-api/init.rst:872 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " "``1`` unless the :program:`python` interpreter was started with the :option:" "`-I`." msgstr "" -#: c-api/init.rst:795 +#: c-api/init.rst:882 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: c-api/init.rst:802 +#: c-api/init.rst:889 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "home` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: c-api/init.rst:806 +#: c-api/init.rst:893 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: c-api/init.rst:810 +#: c-api/init.rst:897 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -983,20 +1145,27 @@ msgid "" "this storage." msgstr "" -#: c-api/init.rst:823 +#: c-api/init.rst:910 +msgid "" +"Return the default \"home\", that is, the value set by :c:member:`PyConfig." +"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " +"is set." +msgstr "" + +#: c-api/init.rst:920 msgid "" -"Return the default \"home\", that is, the value set by a previous call to :c:" -"func:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME` " -"environment variable if it is set." +"Use :c:func:`PyConfig_Get(\"home\") ` or the :envvar:" +"`PYTHONHOME` environment variable instead." msgstr "" -#: c-api/init.rst:837 +#: c-api/init.rst:928 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: c-api/init.rst:844 +#: c-api/init.rst:935 msgid "" -"The Python interpreter is not fully thread-safe. In order to support multi-" +"Unless on a :term:`free-threaded ` build of :term:`CPython`, " +"the Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " "interpreter lock` or :term:`GIL`, that must be held by the current thread " "before it can safely access Python objects. Without the lock, even the " @@ -1006,7 +1175,7 @@ msgid "" "once instead of twice." msgstr "" -#: c-api/init.rst:854 +#: c-api/init.rst:946 msgid "" "Therefore, the rule exists that only the thread that has acquired the :term:" "`GIL` may operate on Python objects or call Python/C API functions. In order " @@ -1016,106 +1185,221 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: c-api/init.rst:864 +#: c-api/init.rst:956 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " -"inside a data structure called :c:type:`PyThreadState`. There's also one " -"global variable pointing to the current :c:type:`PyThreadState`: it can be " -"retrieved using :c:func:`PyThreadState_Get`." +"inside a data structure called :c:type:`PyThreadState`, known as a :term:" +"`thread state`. Each OS thread has a thread-local pointer to a :c:type:" +"`PyThreadState`; a thread state referenced by this pointer is considered to " +"be :term:`attached `." msgstr "" -#: c-api/init.rst:870 -msgid "Releasing the GIL from extension code" +#: c-api/init.rst:961 +msgid "" +"A thread can only have one :term:`attached thread state` at a time. An " +"attached thread state is typically analogous with holding the :term:`GIL`, " +"except on :term:`free-threaded ` builds. On builds with " +"the :term:`GIL` enabled, :term:`attaching ` a thread " +"state will block until the :term:`GIL` can be acquired. However, even on " +"builds with the :term:`GIL` disabled, it is still required to have an " +"attached thread state to call most of the C API." msgstr "" -#: c-api/init.rst:872 +#: c-api/init.rst:968 +msgid "" +"In general, there will always be an :term:`attached thread state` when using " +"Python's C API. Only in some specific cases (such as in a :c:macro:" +"`Py_BEGIN_ALLOW_THREADS` block) will the thread not have an attached thread " +"state. If uncertain, check if :c:func:`PyThreadState_GetUnchecked` returns " +"``NULL``." +msgstr "" + +#: c-api/init.rst:974 +msgid "Detaching the thread state from extension code" +msgstr "" + +#: c-api/init.rst:976 +msgid "" +"Most extension code manipulating the :term:`thread state` has the following " +"simple structure::" +msgstr "" + +#: c-api/init.rst:979 msgid "" -"Most extension code manipulating the :term:`GIL` has the following simple " -"structure::" +"Save the thread state in a local variable.\n" +"... Do some blocking I/O operation ...\n" +"Restore the thread state from the local variable." msgstr "" -#: c-api/init.rst:881 +#: c-api/init.rst:983 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: c-api/init.rst:891 +#: c-api/init.rst:985 +msgid "" +"Py_BEGIN_ALLOW_THREADS\n" +"... Do some blocking I/O operation ...\n" +"Py_END_ALLOW_THREADS" +msgstr "" + +#: c-api/init.rst:993 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: c-api/init.rst:895 +#: c-api/init.rst:997 msgid "The block above expands to the following code::" msgstr "" -#: c-api/init.rst:907 +#: c-api/init.rst:999 msgid "" -"Here is how these functions work: the global interpreter lock is used to " -"protect the pointer to the current thread state. When releasing the lock " -"and saving the thread state, the current thread state pointer must be " -"retrieved before the lock is released (since another thread could " -"immediately acquire the lock and store its own thread state in the global " -"variable). Conversely, when acquiring the lock and restoring the thread " -"state, the lock must be acquired before storing the thread state pointer." +"PyThreadState *_save;\n" +"\n" +"_save = PyEval_SaveThread();\n" +"... Do some blocking I/O operation ...\n" +"PyEval_RestoreThread(_save);" +msgstr "" + +#: c-api/init.rst:1009 +msgid "Here is how these functions work:" msgstr "" -#: c-api/init.rst:916 +#: c-api/init.rst:1011 msgid "" -"Calling system I/O functions is the most common use case for releasing the " -"GIL, but it can also be useful before calling long-running computations " -"which don't need access to Python objects, such as compression or " -"cryptographic functions operating over memory buffers. For example, the " -"standard :mod:`zlib` and :mod:`hashlib` modules release the GIL when " +"The :term:`attached thread state` holds the :term:`GIL` for the entire " +"interpreter. When detaching the :term:`attached thread state`, the :term:" +"`GIL` is released, allowing other threads to attach a thread state to their " +"own thread, thus getting the :term:`GIL` and can start executing. The " +"pointer to the prior :term:`attached thread state` is stored as a local " +"variable. Upon reaching :c:macro:`Py_END_ALLOW_THREADS`, the thread state " +"that was previously :term:`attached ` is passed to :c:" +"func:`PyEval_RestoreThread`. This function will block until another releases " +"its :term:`thread state `, thus allowing the old :" +"term:`thread state ` to get re-attached and the C API " +"can be called again." +msgstr "" + +#: c-api/init.rst:1021 +msgid "" +"For :term:`free-threaded ` builds, the :term:`GIL` is " +"normally out of the question, but detaching the :term:`thread state " +"` is still required for blocking I/O and long " +"operations. The difference is that threads don't have to wait for the :term:" +"`GIL` to be released to attach their thread state, allowing true multi-core " +"parallelism." +msgstr "" + +#: c-api/init.rst:1027 +msgid "" +"Calling system I/O functions is the most common use case for detaching the :" +"term:`thread state `, but it can also be useful " +"before calling long-running computations which don't need access to Python " +"objects, such as compression or cryptographic functions operating over " +"memory buffers. For example, the standard :mod:`zlib` and :mod:`hashlib` " +"modules detach the :term:`thread state ` when " "compressing or hashing data." msgstr "" -#: c-api/init.rst:927 +#: c-api/init.rst:1038 msgid "Non-Python created threads" msgstr "" -#: c-api/init.rst:929 +#: c-api/init.rst:1040 msgid "" "When threads are created using the dedicated Python APIs (such as the :mod:" "`threading` module), a thread state is automatically associated to them and " "the code showed above is therefore correct. However, when threads are " "created from C (for example by a third-party library with its own thread " -"management), they don't hold the GIL, nor is there a thread state structure " -"for them." +"management), they don't hold the :term:`GIL`, because they don't have an :" +"term:`attached thread state`." msgstr "" -#: c-api/init.rst:936 +#: c-api/init.rst:1047 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " -"must first register these threads with the interpreter by creating a thread " -"state data structure, then acquiring the GIL, and finally storing their " -"thread state pointer, before you can start using the Python/C API. When you " -"are done, you should reset the thread state pointer, release the GIL, and " -"finally free the thread state data structure." +"must first register these threads with the interpreter by creating an :term:" +"`attached thread state` before you can start using the Python/C API. When " +"you are done, you should detach the :term:`thread state `, and finally free it." msgstr "" -#: c-api/init.rst:944 +#: c-api/init.rst:1054 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: c-api/init.rst:958 +#: c-api/init.rst:1058 +msgid "" +"PyGILState_STATE gstate;\n" +"gstate = PyGILState_Ensure();\n" +"\n" +"/* Perform Python actions here. */\n" +"result = CallSomeFunction();\n" +"/* evaluate result or handle exception */\n" +"\n" +"/* Release the thread. No Python API allowed beyond this point. */\n" +"PyGILState_Release(gstate);" +msgstr "" + +#: c-api/init.rst:1068 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " "supports the creation of additional interpreters (using :c:func:" "`Py_NewInterpreter`), but mixing multiple interpreters and the " -"``PyGILState_*`` API is unsupported." +"``PyGILState_*`` API is unsupported. This is because :c:func:" +"`PyGILState_Ensure` and similar functions default to :term:`attaching " +"` a :term:`thread state` for the main interpreter, " +"meaning that the thread can't safely interact with the calling " +"subinterpreter." msgstr "" -#: c-api/init.rst:968 +#: c-api/init.rst:1078 +msgid "Supporting subinterpreters in non-Python threads" +msgstr "" + +#: c-api/init.rst:1080 +msgid "" +"If you would like to support subinterpreters with non-Python created " +"threads, you must use the ``PyThreadState_*`` API instead of the traditional " +"``PyGILState_*`` API." +msgstr "" + +#: c-api/init.rst:1084 +msgid "" +"In particular, you must store the interpreter state from the calling " +"function and pass it to :c:func:`PyThreadState_New`, which will ensure that " +"the :term:`thread state` is targeting the correct interpreter::" +msgstr "" + +#: c-api/init.rst:1088 +msgid "" +"/* The return value of PyInterpreterState_Get() from the\n" +" function that created this thread. */\n" +"PyInterpreterState *interp = ThreadData->interp;\n" +"PyThreadState *tstate = PyThreadState_New(interp);\n" +"PyThreadState_Swap(tstate);\n" +"\n" +"/* GIL of the subinterpreter is now held.\n" +" Perform Python actions here. */\n" +"result = CallSomeFunction();\n" +"/* evaluate result or handle exception */\n" +"\n" +"/* Destroy the thread state. No Python API allowed beyond this point. */\n" +"PyThreadState_Clear(tstate);\n" +"PyThreadState_DeleteCurrent();" +msgstr "" + +#: c-api/init.rst:1106 msgid "Cautions about fork()" msgstr "" -#: c-api/init.rst:970 +#: c-api/init.rst:1108 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1124,7 +1408,7 @@ msgid "" "CPython's runtime." msgstr "" -#: c-api/init.rst:976 +#: c-api/init.rst:1114 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1141,7 +1425,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: c-api/init.rst:991 +#: c-api/init.rst:1129 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1154,17 +1438,54 @@ msgid "" "called immediately after." msgstr "" -#: c-api/init.rst:1004 +#: c-api/init.rst:1143 +msgid "Cautions regarding runtime finalization" +msgstr "" + +#: c-api/init.rst:1145 +msgid "" +"In the late stage of :term:`interpreter shutdown`, after attempting to wait " +"for non-daemon threads to exit (though this can be interrupted by :class:" +"`KeyboardInterrupt`) and running the :mod:`atexit` functions, the runtime is " +"marked as *finalizing*: :c:func:`Py_IsFinalizing` and :func:`sys." +"is_finalizing` return true. At this point, only the *finalization thread* " +"that initiated finalization (typically the main thread) is allowed to " +"acquire the :term:`GIL`." +msgstr "" + +#: c-api/init.rst:1153 +msgid "" +"If any thread, other than the finalization thread, attempts to attach a :" +"term:`thread state` during finalization, either explicitly or implicitly, " +"the thread enters **a permanently blocked state** where it remains until the " +"program exits. In most cases this is harmless, but this can result in " +"deadlock if a later stage of finalization attempts to acquire a lock owned " +"by the blocked thread, or otherwise waits on the blocked thread." +msgstr "" + +#: c-api/init.rst:1160 +msgid "" +"Gross? Yes. This prevents random crashes and/or unexpectedly skipped C++ " +"finalizations further up the call stack when such threads were forcibly " +"exited here in CPython 3.13 and earlier. The CPython runtime :term:`thread " +"state` C APIs have never had any error reporting or handling expectations " +"at :term:`thread state` attachment time that would've allowed for graceful " +"exit from this situation. Changing that would require new stable C APIs and " +"rewriting the majority of C code in the CPython ecosystem to use those with " +"error handling." +msgstr "" + +#: c-api/init.rst:1170 msgid "High-level API" msgstr "" -#: c-api/init.rst:1006 +#: c-api/init.rst:1172 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: c-api/init.rst:1011 +#: c-api/init.rst:1177 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1172,7 +1493,7 @@ msgid "" "in this structure." msgstr "" -#: c-api/init.rst:1016 +#: c-api/init.rst:1182 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1180,126 +1501,179 @@ msgid "" "which interpreter they belong." msgstr "" -#: c-api/init.rst:1024 +#: c-api/init.rst:1189 +msgid "" +":pep:`684` introduced the possibility of a :ref:`per-interpreter GIL `. See :c:func:`Py_NewInterpreterFromConfig`." +msgstr "" + +#: c-api/init.rst:1196 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: c-api/init.rst:1029 +#: c-api/init.rst:1201 msgid "This thread's interpreter state." msgstr "" -#: c-api/init.rst:1040 +#: c-api/init.rst:1212 msgid "Deprecated function which does nothing." msgstr "" -#: c-api/init.rst:1042 +#: c-api/init.rst:1214 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: c-api/init.rst:1044 +#: c-api/init.rst:1216 msgid "The function now does nothing." msgstr "" -#: c-api/init.rst:1047 +#: c-api/init.rst:1219 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: c-api/init.rst:1051 +#: c-api/init.rst:1223 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: c-api/init.rst:1061 +#: c-api/init.rst:1233 msgid "" -"Returns a non-zero value if :c:func:`PyEval_InitThreads` has been called. " -"This function can be called without holding the GIL, and therefore can be " -"used to avoid calls to the locking API when running single-threaded." +"Detach the :term:`attached thread state` and return it. The thread will have " +"no :term:`thread state` upon returning." msgstr "" -#: c-api/init.rst:1065 -msgid "The :term:`GIL` is now initialized by :c:func:`Py_Initialize()`." +#: c-api/init.rst:1239 +msgid "" +"Set the :term:`attached thread state` to *tstate*. The passed :term:`thread " +"state` **should not** be :term:`attached `, otherwise " +"deadlock ensues. *tstate* will be attached upon returning." msgstr "" -#: c-api/init.rst:1073 +#: c-api/init.rst:1688 msgid "" -"Release the global interpreter lock (if it has been created) and reset the " -"thread state to ``NULL``, returning the previous thread state (which is not " -"``NULL``). If the lock has been created, the current thread must have " -"acquired it." +"Calling this function from a thread when the runtime is finalizing will hang " +"the thread until the program exits, even if the thread was not created by " +"Python. Refer to :ref:`cautions-regarding-runtime-finalization` for more " +"details." msgstr "" -#: c-api/init.rst:1081 +#: c-api/init.rst:1333 c-api/init.rst:1698 msgid "" -"Acquire the global interpreter lock (if it has been created) and set the " -"thread state to *tstate*, which must not be ``NULL``. If the lock has been " -"created, the current thread must not have acquired it, otherwise deadlock " -"ensues." +"Hangs the current thread, rather than terminating it, if called while the " +"interpreter is finalizing." msgstr "" -#: c-api/init.rst:1133 c-api/init.rst:1415 +#: c-api/init.rst:1255 msgid "" -"Calling this function from a thread when the runtime is finalizing will " -"terminate the thread, even if the thread was not created by Python. You can " -"use :c:func:`!_Py_IsFinalizing` or :func:`sys.is_finalizing` to check if the " -"interpreter is in process of being finalized before calling this function to " -"avoid unwanted termination." +"Return the :term:`attached thread state`. If the thread has no attached " +"thread state, (such as when inside of :c:macro:`Py_BEGIN_ALLOW_THREADS` " +"block), then this issues a fatal error (so that the caller needn't check for " +"``NULL``)." msgstr "" -#: c-api/init.rst:1095 +#: c-api/init.rst:1260 +msgid "See also :c:func:`PyThreadState_GetUnchecked`." +msgstr "" + +#: c-api/init.rst:1264 msgid "" -"Return the current thread state. The global interpreter lock must be held. " -"When the current thread state is ``NULL``, this issues a fatal error (so " -"that the caller needn't check for ``NULL``)." +"Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " +"fatal error if it is NULL. The caller is responsible to check if the result " +"is NULL." msgstr "" -#: c-api/init.rst:1102 +#: c-api/init.rst:1268 msgid "" -"Swap the current thread state with the thread state given by the argument " -"*tstate*, which may be ``NULL``. The global interpreter lock must be held " -"and is not released." +"In Python 3.5 to 3.12, the function was private and known as " +"``_PyThreadState_UncheckedGet()``." msgstr "" -#: c-api/init.rst:1107 +#: c-api/init.rst:1275 msgid "" -"The following functions use thread-local storage, and are not compatible " -"with sub-interpreters:" +"Set the :term:`attached thread state` to *tstate*, and return the :term:" +"`thread state` that was attached prior to calling." msgstr "" -#: c-api/init.rst:1112 +#: c-api/init.rst:1278 msgid "" -"Ensure that the current thread is ready to call the Python C API regardless " -"of the current state of Python, or of the global interpreter lock. This may " -"be called as many times as desired by a thread as long as each call is " -"matched with a call to :c:func:`PyGILState_Release`. In general, other " -"thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls as long as the thread state is restored to " +"This function is safe to call without an :term:`attached thread state`; it " +"will simply return ``NULL`` indicating that there was no prior thread state." +msgstr "" + +#: c-api/init.rst:1282 +msgid ":c:func:`PyEval_ReleaseThread`" +msgstr "" + +#: c-api/init.rst:1285 +msgid "" +"Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread " +"if the runtime is finalizing." +msgstr "" + +#: c-api/init.rst:1289 +msgid "" +"The following functions use thread-local storage, and are not compatible " +"with sub-interpreters:" +msgstr "" + +#: c-api/init.rst:1294 +msgid "" +"The type of the value returned by :c:func:`PyGILState_Ensure` and passed to :" +"c:func:`PyGILState_Release`." +msgstr "" + +#: c-api/init.rst:1299 +msgid "The GIL was already held when :c:func:`PyGILState_Ensure` was called." +msgstr "" + +#: c-api/init.rst:1303 +msgid "The GIL was not held when :c:func:`PyGILState_Ensure` was called." +msgstr "" + +#: c-api/init.rst:1307 +msgid "" +"Ensure that the current thread is ready to call the Python C API regardless " +"of the current state of Python, or of the :term:`attached thread state`. " +"This may be called as many times as desired by a thread as long as each call " +"is matched with a call to :c:func:`PyGILState_Release`. In general, other " +"thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:" +"func:`PyGILState_Release` calls as long as the thread state is restored to " "its previous state before the Release(). For example, normal usage of the :" "c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros " "is acceptable." msgstr "" -#: c-api/init.rst:1122 +#: c-api/init.rst:1317 msgid "" -"The return value is an opaque \"handle\" to the thread state when :c:func:" -"`PyGILState_Ensure` was called, and must be passed to :c:func:" -"`PyGILState_Release` to ensure Python is left in the same state. Even though " -"recursive calls are allowed, these handles *cannot* be shared - each unique " -"call to :c:func:`PyGILState_Ensure` must save the handle for its call to :c:" -"func:`PyGILState_Release`." +"The return value is an opaque \"handle\" to the :term:`attached thread " +"state` when :c:func:`PyGILState_Ensure` was called, and must be passed to :c:" +"func:`PyGILState_Release` to ensure Python is left in the same state. Even " +"though recursive calls are allowed, these handles *cannot* be shared - each " +"unique call to :c:func:`PyGILState_Ensure` must save the handle for its call " +"to :c:func:`PyGILState_Release`." msgstr "" -#: c-api/init.rst:1129 +#: c-api/init.rst:1324 msgid "" -"When the function returns, the current thread will hold the GIL and be able " -"to call arbitrary Python code. Failure is a fatal error." +"When the function returns, there will be an :term:`attached thread state` " +"and the thread will be able to call arbitrary Python code. Failure is a " +"fatal error." msgstr "" -#: c-api/init.rst:1141 +#: c-api/init.rst:1328 +msgid "" +"Calling this function when the runtime is finalizing is unsafe. Doing so " +"will either hang the thread until the program ends, or fully crash the " +"interpreter in rare cases. Refer to :ref:`cautions-regarding-runtime-" +"finalization` for more details." +msgstr "" + +#: c-api/init.rst:1339 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1307,38 +1681,57 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: c-api/init.rst:1146 +#: c-api/init.rst:1344 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: c-api/init.rst:1152 +#: c-api/init.rst:1349 msgid "" -"Get the current thread state for this thread. May return ``NULL`` if no " -"GILState API has been used on the current thread. Note that the main thread " -"always has such a thread-state, even if no auto-thread-state call has been " -"made on the main thread. This is mainly a helper/diagnostic function." +"Get the :term:`attached thread state` for this thread. May return ``NULL`` " +"if no GILState API has been used on the current thread. Note that the main " +"thread always has such a thread-state, even if no auto-thread-state call has " +"been made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: c-api/init.rst:1160 +#: c-api/init.rst:1355 msgid "" -"Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " -"This function can be called from any thread at any time. Only if it has had " -"its Python thread state initialized and currently is holding the GIL will it " -"return ``1``. This is mainly a helper/diagnostic function. It can be useful " -"for example in callback contexts or memory allocation functions when knowing " -"that the GIL is locked can allow the caller to perform sensitive actions or " -"otherwise behave differently." +"This function may return non-``NULL`` even when the :term:`thread state` is " +"detached. Prefer :c:func:`PyThreadState_Get` or :c:func:" +"`PyThreadState_GetUnchecked` for most cases." msgstr "" -#: c-api/init.rst:1172 +#: c-api/init.rst:1360 +msgid ":c:func:`PyThreadState_Get`" +msgstr "" + +#: c-api/init.rst:1364 +msgid "" +"Return ``1`` if the current thread is holding the :term:`GIL` and ``0`` " +"otherwise. This function can be called from any thread at any time. Only if " +"it has had its :term:`thread state ` initialized via :" +"c:func:`PyGILState_Ensure` will it return ``1``. This is mainly a helper/" +"diagnostic function. It can be useful for example in callback contexts or " +"memory allocation functions when knowing that the :term:`GIL` is locked can " +"allow the caller to perform sensitive actions or otherwise behave " +"differently." +msgstr "" + +#: c-api/init.rst:1374 +msgid "" +"If the current Python process has ever created a subinterpreter, this " +"function will *always* return ``1``. Prefer :c:func:" +"`PyThreadState_GetUnchecked` for most cases." +msgstr "" + +#: c-api/init.rst:1381 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: c-api/init.rst:1178 +#: c-api/init.rst:1387 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1346,7 +1739,7 @@ msgid "" "discussion of this macro." msgstr "" -#: c-api/init.rst:1186 +#: c-api/init.rst:1395 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1354,309 +1747,357 @@ msgid "" "macro." msgstr "" -#: c-api/init.rst:1194 +#: c-api/init.rst:1403 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: c-api/init.rst:1200 +#: c-api/init.rst:1409 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: c-api/init.rst:1206 +#: c-api/init.rst:1415 msgid "Low-level API" msgstr "" -#: c-api/init.rst:1208 +#: c-api/init.rst:1417 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: c-api/init.rst:1210 -msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." +#: c-api/init.rst:1419 +msgid "" +":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets an :term:" +"`attached thread state`." msgstr "" -#: c-api/init.rst:1216 +#: c-api/init.rst:1426 msgid "" -"Create a new interpreter state object. The global interpreter lock need not " -"be held, but may be held if it is necessary to serialize calls to this " -"function." +"Create a new interpreter state object. An :term:`attached thread state` is " +"not needed, but may optionally exist if it is necessary to serialize calls " +"to this function." msgstr "" -#: c-api/init.rst:1220 +#: c-api/init.rst:1430 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." msgstr "" -#: c-api/init.rst:1225 +#: c-api/init.rst:1435 msgid "" -"Reset all information in an interpreter state object. The global " -"interpreter lock must be held." +"Reset all information in an interpreter state object. There must be an :" +"term:`attached thread state` for the interpreter." msgstr "" -#: c-api/init.rst:1228 +#: c-api/init.rst:1438 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." msgstr "" -#: c-api/init.rst:1233 +#: c-api/init.rst:1443 msgid "" -"Destroy an interpreter state object. The global interpreter lock need not " -"be held. The interpreter state must have been reset with a previous call " -"to :c:func:`PyInterpreterState_Clear`." +"Destroy an interpreter state object. There **should not** be an :term:" +"`attached thread state` for the target interpreter. The interpreter state " +"must have been reset with a previous call to :c:func:" +"`PyInterpreterState_Clear`." msgstr "" -#: c-api/init.rst:1240 +#: c-api/init.rst:1450 msgid "" "Create a new thread state object belonging to the given interpreter object. " -"The global interpreter lock need not be held, but may be held if it is " -"necessary to serialize calls to this function." +"An :term:`attached thread state` is not needed." msgstr "" -#: c-api/init.rst:1247 +#: c-api/init.rst:1455 msgid "" -"Reset all information in a thread state object. The global interpreter lock " -"must be held." +"Reset all information in a :term:`thread state` object. *tstate* must be :" +"term:`attached `" msgstr "" -#: c-api/init.rst:1250 +#: c-api/init.rst:1458 msgid "" -"This function now calls the :c:member:`PyThreadState.on_delete` callback. " +"This function now calls the :c:member:`!PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: c-api/init.rst:1257 +#: c-api/init.rst:1462 +msgid "The :c:member:`!PyThreadState.on_delete` callback was removed." +msgstr "" + +#: c-api/init.rst:1468 msgid "" -"Destroy a thread state object. The global interpreter lock need not be " -"held. The thread state must have been reset with a previous call to :c:func:" -"`PyThreadState_Clear`." +"Destroy a :term:`thread state` object. *tstate* should not be :term:" +"`attached ` to any thread. *tstate* must have been " +"reset with a previous call to :c:func:`PyThreadState_Clear`." msgstr "" -#: c-api/init.rst:1264 +#: c-api/init.rst:1476 +msgid "" +"Detach the :term:`attached thread state` (which must have been reset with a " +"previous call to :c:func:`PyThreadState_Clear`) and then destroy it." +msgstr "" + +#: c-api/init.rst:1479 msgid "" -"Destroy the current thread state and release the global interpreter lock. " -"Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not be " -"held. The thread state must have been reset with a previous call to :c:func:" -"`PyThreadState_Clear`." +"No :term:`thread state` will be :term:`attached ` " +"upon returning." msgstr "" -#: c-api/init.rst:1272 +#: c-api/init.rst:1484 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: c-api/init.rst:1274 +#: c-api/init.rst:1486 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: c-api/init.rst:1277 +#: c-api/init.rst:1489 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "" -#: c-api/init.rst:1288 c-api/init.rst:1297 -msgid "*tstate* must not be ``NULL``." +#: c-api/init.rst:1500 c-api/init.rst:1509 +msgid "" +"*tstate* must not be ``NULL``, and must be :term:`attached `." msgstr "" -#: c-api/init.rst:1286 +#: c-api/init.rst:1498 msgid "" -"Get the unique thread state identifier of the Python thread state *tstate*." +"Get the unique :term:`thread state` identifier of the Python thread state " +"*tstate*." msgstr "" -#: c-api/init.rst:1295 +#: c-api/init.rst:1507 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: c-api/init.rst:1304 +#: c-api/init.rst:1516 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: c-api/init.rst:1306 +#: c-api/init.rst:1518 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: c-api/init.rst:1313 +#: c-api/init.rst:1525 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: c-api/init.rst:1316 +#: c-api/init.rst:1528 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: c-api/init.rst:1324 -msgid "Get the current interpreter." +#: c-api/init.rst:1536 +msgid "" +"Set the stack protection start address and stack protection size of a Python " +"thread state." msgstr "" -#: c-api/init.rst:1326 +#: c-api/init.rst:1539 msgid "" -"Issue a fatal error if there no current Python thread state or no current " -"interpreter. It cannot return NULL." +"On success, return ``0``. On failure, set an exception and return ``-1``." msgstr "" -#: c-api/init.rst:1339 -msgid "The caller must hold the GIL." +#: c-api/init.rst:1542 +msgid "" +"CPython implements :ref:`recursion control ` for C code by " +"raising :py:exc:`RecursionError` when it notices that the machine execution " +"stack is close to overflow. See for example the :c:func:" +"`Py_EnterRecursiveCall` function. For this, it needs to know the location of " +"the current thread's stack, which it normally gets from the operating " +"system. When the stack is changed, for example using context switching " +"techniques like the Boost library's ``boost::context``, you must call :c:" +"func:`~PyUnstable_ThreadState_SetStackProtection` to inform CPython of the " +"change." +msgstr "" + +#: c-api/init.rst:1551 +msgid "" +"Call :c:func:`~PyUnstable_ThreadState_SetStackProtection` either before or " +"after changing the stack. Do not call any other Python C API between the " +"call and the stack change." +msgstr "" + +#: c-api/init.rst:1556 +msgid "" +"See :c:func:`PyUnstable_ThreadState_ResetStackProtection` for undoing this " +"operation." +msgstr "" + +#: c-api/init.rst:1582 +msgid "" +"This function was added in a bugfix release, and extensions that use it will " +"be incompatible with Python 3.14.0. Most packaging tools for Python are not " +"able to handle this incompatibility automatically, and will need explicit " +"configuration. When using PyPA standards (wheels and source distributions), " +"specify ``Requires-Python: != 3.14.0.*`` in `core metadata `_." +msgstr "" + +#: c-api/init.rst:1573 +msgid "" +"Reset the stack protection start address and stack protection size of a " +"Python thread state to the operating system defaults." +msgstr "" + +#: c-api/init.rst:1576 +msgid "" +"See :c:func:`PyUnstable_ThreadState_SetStackProtection` for an explanation." +msgstr "" + +#: c-api/init.rst:1593 +msgid "Get the current interpreter." +msgstr "" + +#: c-api/init.rst:1595 +msgid "" +"Issue a fatal error if there no :term:`attached thread state`. It cannot " +"return NULL." msgstr "" -#: c-api/init.rst:1336 +#: c-api/init.rst:1603 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: c-api/init.rst:1346 +#: c-api/init.rst:2221 c-api/init.rst:2247 c-api/init.rst:2254 +msgid "The caller must have an :term:`attached thread state`." +msgstr "" + +#: c-api/init.rst:1613 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: c-api/init.rst:1350 +#: c-api/init.rst:1617 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: c-api/init.rst:1357 +#: c-api/init.rst:1620 +msgid "" +"The returned dictionary is borrowed from the interpreter and is valid until " +"interpreter shutdown." +msgstr "" + +#: c-api/init.rst:1628 msgid "Type of a frame evaluation function." msgstr "" -#: c-api/init.rst:1359 +#: c-api/init.rst:1630 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: c-api/init.rst:1362 +#: c-api/init.rst:1633 msgid "The function now takes a *tstate* parameter." msgstr "" -#: c-api/init.rst:1365 +#: c-api/init.rst:1636 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: c-api/init.rst:1370 +#: c-api/init.rst:1641 msgid "Get the frame evaluation function." msgstr "" -#: c-api/init.rst:1380 +#: c-api/init.rst:1651 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: c-api/init.rst:1378 +#: c-api/init.rst:1649 msgid "Set the frame evaluation function." msgstr "" -#: c-api/init.rst:1387 +#: c-api/init.rst:1658 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " -"in the dictionary. It is okay to call this function when no current thread " -"state is available. If this function returns ``NULL``, no exception has been " -"raised and the caller should assume no current thread state is available." +"in the dictionary. It is okay to call this function when no :term:`thread " +"state` is :term:`attached `. If this function returns " +"``NULL``, no exception has been raised and the caller should assume no " +"thread state is attached." msgstr "" -#: c-api/init.rst:1396 +#: c-api/init.rst:1668 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " "This function does not steal any references to *exc*. To prevent naive " "misuse, you must write your own C extension to call this. Must be called " -"with the GIL held. Returns the number of thread states modified; this is " -"normally one, but will be zero if the thread id isn't found. If *exc* is " -"``NULL``, the pending exception (if any) for the thread is cleared. This " -"raises no exceptions." +"with an :term:`attached thread state`. Returns the number of thread states " +"modified; this is normally one, but will be zero if the thread id isn't " +"found. If *exc* is ``NULL``, the pending exception (if any) for the thread " +"is cleared. This raises no exceptions." msgstr "" -#: c-api/init.rst:1404 +#: c-api/init.rst:1676 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: c-api/init.rst:1410 +#: c-api/init.rst:1682 +msgid "" +":term:`Attach ` *tstate* to the current thread, which " +"must not be ``NULL`` or already :term:`attached `." +msgstr "" + +#: c-api/init.rst:1685 msgid "" -"Acquire the global interpreter lock and set the current thread state to " -"*tstate*, which must not be ``NULL``. The lock must have been created " -"earlier. If this thread already has the lock, deadlock ensues." +"The calling thread must not already have an :term:`attached thread state`." msgstr "" -#: c-api/init.rst:1459 +#: c-api/init.rst:1693 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: c-api/init.rst:1426 +#: c-api/init.rst:1702 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: c-api/init.rst:1432 +#: c-api/init.rst:1708 msgid "" -"Reset the current thread state to ``NULL`` and release the global " -"interpreter lock. The lock must have been created earlier and must be held " -"by the current thread. The *tstate* argument, which must not be ``NULL``, " -"is only used to check that it represents the current thread state --- if it " -"isn't, a fatal error is reported." +"Detach the :term:`attached thread state`. The *tstate* argument, which must " +"not be ``NULL``, is only used to check that it represents the :term:" +"`attached thread state` --- if it isn't, a fatal error is reported." msgstr "" -#: c-api/init.rst:1438 +#: c-api/init.rst:1713 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: c-api/init.rst:1444 -msgid "" -"Acquire the global interpreter lock. The lock must have been created " -"earlier. If this thread already has the lock, a deadlock ensues." -msgstr "" - -#: c-api/init.rst:1447 -msgid "" -"This function does not update the current thread state. Please use :c:func:" -"`PyEval_RestoreThread` or :c:func:`PyEval_AcquireThread` instead." -msgstr "" - -#: c-api/init.rst:1453 -msgid "" -"Calling this function from a thread when the runtime is finalizing will " -"terminate the thread, even if the thread was not created by Python. You can " -"use :c:func:`_Py_IsFinalizing` or :func:`sys.is_finalizing` to check if the " -"interpreter is in process of being finalized before calling this function to " -"avoid unwanted termination." -msgstr "" - -#: c-api/init.rst:1467 -msgid "" -"Release the global interpreter lock. The lock must have been created " -"earlier." -msgstr "" - -#: c-api/init.rst:1469 -msgid "" -"This function does not update the current thread state. Please use :c:func:" -"`PyEval_SaveThread` or :c:func:`PyEval_ReleaseThread` instead." -msgstr "" - -#: c-api/init.rst:1478 +#: c-api/init.rst:1720 msgid "Sub-interpreter support" msgstr "" -#: c-api/init.rst:1480 +#: c-api/init.rst:1722 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1664,7 +2105,7 @@ msgid "" "to do that." msgstr "" -#: c-api/init.rst:1485 +#: c-api/init.rst:1727 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1675,31 +2116,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: c-api/init.rst:1492 +#: c-api/init.rst:1734 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: c-api/init.rst:1498 +#: c-api/init.rst:1740 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: c-api/init.rst:1504 +#: c-api/init.rst:1746 msgid "Structure fields:" msgstr "" -#: c-api/init.rst:1508 +#: c-api/init.rst:1750 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: c-api/init.rst:1512 +#: c-api/init.rst:1754 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1707,44 +2148,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: c-api/init.rst:1520 +#: c-api/init.rst:1762 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: c-api/init.rst:1524 +#: c-api/init.rst:1766 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: c-api/init.rst:1529 +#: c-api/init.rst:1771 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: c-api/init.rst:1534 +#: c-api/init.rst:1776 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: c-api/init.rst:1539 +#: c-api/init.rst:1781 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: c-api/init.rst:1545 +#: c-api/init.rst:1787 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: c-api/init.rst:1552 +#: c-api/init.rst:1794 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -1753,37 +2194,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: c-api/init.rst:1559 +#: c-api/init.rst:1801 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: c-api/init.rst:1564 +#: c-api/init.rst:1806 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: c-api/init.rst:1571 +#: c-api/init.rst:1813 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: c-api/init.rst:1575 +#: c-api/init.rst:1817 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: c-api/init.rst:1579 +#: c-api/init.rst:1821 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: c-api/init.rst:1581 +#: c-api/init.rst:1823 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: c-api/init.rst:1595 +#: c-api/init.rst:1837 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1796,42 +2237,61 @@ msgid "" "underlying file descriptors)." msgstr "" -#: c-api/init.rst:1605 +#: c-api/init.rst:1847 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: c-api/init.rst:1608 +#: c-api/init.rst:1850 msgid "" -"Upon success, *tstate_p* will be set to the first thread state created in " -"the new sub-interpreter. This thread state is made in the current thread " -"state. Note that no actual thread is created; see the discussion of thread " -"states below. If creation of the new interpreter is unsuccessful, " -"*tstate_p* is set to ``NULL``; no exception is set since the exception state " -"is stored in the current thread state and there may not be a current thread " -"state." +"Upon success, *tstate_p* will be set to the first :term:`thread state` " +"created in the new sub-interpreter. This thread state is :term:`attached " +"`. Note that no actual thread is created; see the " +"discussion of thread states below. If creation of the new interpreter is " +"unsuccessful, *tstate_p* is set to ``NULL``; no exception is set since the " +"exception state is stored in the :term:`attached thread state`, which might " +"not exist." msgstr "" -#: c-api/init.rst:1617 +#: c-api/init.rst:1859 msgid "" -"Like all other Python/C API functions, the global interpreter lock must be " -"held before calling this function and is still held when it returns. " -"Likewise a current thread state must be set on entry. On success, the " -"returned thread state will be set as current. If the sub-interpreter is " -"created with its own GIL then the GIL of the calling interpreter will be " -"released. When the function returns, the new interpreter's GIL will be held " -"by the current thread and the previously interpreter's GIL will remain " -"released here." +"Like all other Python/C API functions, an :term:`attached thread state` must " +"be present before calling this function, but it might be detached upon " +"returning. On success, the returned thread state will be :term:`attached " +"`. If the sub-interpreter is created with its own :" +"term:`GIL` then the :term:`attached thread state` of the calling interpreter " +"will be detached. When the function returns, the new interpreter's :term:" +"`thread state` will be :term:`attached ` to the " +"current thread and the previous interpreter's :term:`attached thread state` " +"will remain detached." msgstr "" -#: c-api/init.rst:1628 +#: c-api/init.rst:1870 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: c-api/init.rst:1642 +#: c-api/init.rst:1873 +msgid "" +"PyInterpreterConfig config = {\n" +" .use_main_obmalloc = 0,\n" +" .allow_fork = 0,\n" +" .allow_exec = 0,\n" +" .allow_threads = 1,\n" +" .allow_daemon_threads = 0,\n" +" .check_multi_interp_extensions = 1,\n" +" .gil = PyInterpreterConfig_OWN_GIL,\n" +"};\n" +"PyThreadState *tstate = NULL;\n" +"PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);\n" +"if (PyStatus_Exception(status)) {\n" +" Py_ExitStatusException(status);\n" +"}" +msgstr "" + +#: c-api/init.rst:1888 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -1839,11 +2299,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: c-api/init.rst:1651 +#: c-api/init.rst:1897 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: c-api/init.rst:1653 +#: c-api/init.rst:1899 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -1851,7 +2311,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: c-api/init.rst:1659 +#: c-api/init.rst:1905 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -1863,7 +2323,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: c-api/init.rst:1670 +#: c-api/init.rst:1916 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -1873,7 +2333,7 @@ msgid "" "shared between these modules." msgstr "" -#: c-api/init.rst:1690 +#: c-api/init.rst:1936 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -1882,27 +2342,25 @@ msgid "" "single-phase init modules." msgstr "" -#: c-api/init.rst:1702 +#: c-api/init.rst:1948 msgid "" -"Destroy the (sub-)interpreter represented by the given thread state. The " -"given thread state must be the current thread state. See the discussion of " -"thread states below. When the call returns, the current thread state is " -"``NULL``. All thread states associated with this interpreter are " -"destroyed. The global interpreter lock used by the target interpreter must " -"be held before calling this function. No GIL is held when it returns." +"Destroy the (sub-)interpreter represented by the given :term:`thread state`. " +"The given thread state must be :term:`attached `. " +"When the call returns, there will be no :term:`attached thread state`. All " +"thread states associated with this interpreter are destroyed." msgstr "" -#: c-api/init.rst:1710 +#: c-api/init.rst:1953 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: c-api/init.rst:1715 +#: c-api/init.rst:1960 msgid "A Per-Interpreter GIL" msgstr "" -#: c-api/init.rst:1717 +#: c-api/init.rst:1962 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -1911,10 +2369,10 @@ msgid "" "interpreters or blocking any others. Thus a single Python process can truly " "take advantage of multiple CPU cores when running Python code. The " "isolation also encourages a different approach to concurrency than that of " -"just using threads. (See :pep:`554`.)" +"just using threads. (See :pep:`554` and :pep:`684`.)" msgstr "" -#: c-api/init.rst:1727 +#: c-api/init.rst:1972 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -1923,12 +2381,12 @@ msgid "" "the refcount. One simple but less-efficient approach around this is to use " "a global lock around all use of some state (or object). Alternately, " "effectively immutable objects (like integers or strings) can be made safe in " -"spite of their refcounts by making them \"immortal\". In fact, this has been " -"done for the builtin singletons, small integers, and a number of other " +"spite of their refcounts by making them :term:`immortal`. In fact, this has " +"been done for the builtin singletons, small integers, and a number of other " "builtin objects." msgstr "" -#: c-api/init.rst:1738 +#: c-api/init.rst:1983 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -1936,7 +2394,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: c-api/init.rst:1743 +#: c-api/init.rst:1988 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -1946,11 +2404,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: c-api/init.rst:1754 +#: c-api/init.rst:1999 msgid "Bugs and caveats" msgstr "" -#: c-api/init.rst:1756 +#: c-api/init.rst:2001 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -1963,7 +2421,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: c-api/init.rst:1766 +#: c-api/init.rst:2011 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -1972,7 +2430,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: c-api/init.rst:1772 +#: c-api/init.rst:2017 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -1984,25 +2442,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: c-api/init.rst:1783 +#: c-api/init.rst:2028 msgid "Asynchronous Notifications" msgstr "" -#: c-api/init.rst:1785 +#: c-api/init.rst:2030 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: c-api/init.rst:1792 +#: c-api/init.rst:2037 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: c-api/init.rst:1796 +#: c-api/init.rst:2041 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2010,38 +2468,33 @@ msgid "" "these conditions met:" msgstr "" -#: c-api/init.rst:1801 +#: c-api/init.rst:2046 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: c-api/init.rst:1802 +#: c-api/init.rst:2047 msgid "" -"with the main thread holding the :term:`global interpreter lock` (*func* can " +"with the main thread holding an :term:`attached thread state` (*func* can " "therefore use the full C API)." msgstr "" -#: c-api/init.rst:1805 +#: c-api/init.rst:2050 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " "notification recursively, but it can still be interrupted to switch threads " -"if the global interpreter lock is released." +"if the :term:`thread state ` is detached." msgstr "" -#: c-api/init.rst:1810 +#: c-api/init.rst:2055 msgid "" -"This function doesn't need a current thread state to run, and it doesn't " -"need the global interpreter lock." +"This function doesn't need an :term:`attached thread state`. However, to " +"call this function in a subinterpreter, the caller must have an :term:" +"`attached thread state`. Otherwise, the function *func* can be scheduled to " +"be called from the wrong interpreter." msgstr "" -#: c-api/init.rst:1813 -msgid "" -"To call this function in a subinterpreter, the caller must hold the GIL. " -"Otherwise, the function *func* can be scheduled to be called from the wrong " -"interpreter." -msgstr "" - -#: c-api/init.rst:1818 +#: c-api/init.rst:2060 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2051,7 +2504,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: c-api/init.rst:1827 +#: c-api/init.rst:2069 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2059,18 +2512,46 @@ msgid "" "scheduled calls." msgstr "" -#: c-api/init.rst:1836 +#: c-api/init.rst:2075 +msgid "" +"This function now always schedules *func* to be run in the main interpreter." +msgstr "" + +#: c-api/init.rst:2082 +msgid "" +"Execute all pending calls. This is usually executed automatically by the " +"interpreter." +msgstr "" + +#: c-api/init.rst:2085 +msgid "" +"This function returns ``0`` on success, and returns ``-1`` with an exception " +"set on failure." +msgstr "" + +#: c-api/init.rst:2088 +msgid "" +"If this is not called in the main thread of the main interpreter, this " +"function does nothing and returns ``0``. The caller must hold an :term:" +"`attached thread state`." +msgstr "" + +#: c-api/init.rst:2094 +msgid "This function only runs pending calls in the main interpreter." +msgstr "" + +#: c-api/init.rst:2101 msgid "Profiling and Tracing" msgstr "" -#: c-api/init.rst:1841 +#: c-api/init.rst:2106 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: c-api/init.rst:1845 +#: c-api/init.rst:2110 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2080,7 +2561,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: c-api/init.rst:1855 +#: c-api/init.rst:2120 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2092,64 +2573,64 @@ msgid "" "value of *what*:" msgstr "" -#: c-api/init.rst:1864 +#: c-api/init.rst:2129 msgid "Value of *what*" msgstr "" -#: c-api/init.rst:1864 +#: c-api/init.rst:2129 msgid "Meaning of *arg*" msgstr "" -#: c-api/init.rst:1866 +#: c-api/init.rst:2131 msgid ":c:data:`PyTrace_CALL`" msgstr "" -#: c-api/init.rst:1871 c-api/init.rst:1882 +#: c-api/init.rst:2136 c-api/init.rst:2147 msgid "Always :c:data:`Py_None`." msgstr "" -#: c-api/init.rst:1868 +#: c-api/init.rst:2133 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr "" -#: c-api/init.rst:1868 +#: c-api/init.rst:2133 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: c-api/init.rst:1871 +#: c-api/init.rst:2136 msgid ":c:data:`PyTrace_LINE`" msgstr "" -#: c-api/init.rst:1873 +#: c-api/init.rst:2138 msgid ":c:data:`PyTrace_RETURN`" msgstr "" -#: c-api/init.rst:1873 +#: c-api/init.rst:2138 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: c-api/init.rst:1876 +#: c-api/init.rst:2141 msgid ":c:data:`PyTrace_C_CALL`" msgstr "" -#: c-api/init.rst:1878 c-api/init.rst:1880 +#: c-api/init.rst:2143 c-api/init.rst:2145 msgid "Function object being called." msgstr "" -#: c-api/init.rst:1878 +#: c-api/init.rst:2143 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr "" -#: c-api/init.rst:1880 +#: c-api/init.rst:2145 msgid ":c:data:`PyTrace_C_RETURN`" msgstr "" -#: c-api/init.rst:1882 +#: c-api/init.rst:2147 msgid ":c:data:`PyTrace_OPCODE`" msgstr "" -#: c-api/init.rst:1887 +#: c-api/init.rst:2152 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2158,7 +2639,7 @@ msgid "" "the corresponding frame." msgstr "" -#: c-api/init.rst:1896 +#: c-api/init.rst:2161 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2170,7 +2651,7 @@ msgid "" "profiler." msgstr "" -#: c-api/init.rst:1907 +#: c-api/init.rst:2172 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2178,31 +2659,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: c-api/init.rst:1915 +#: c-api/init.rst:2180 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: c-api/init.rst:1921 +#: c-api/init.rst:2186 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: c-api/init.rst:1927 +#: c-api/init.rst:2192 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: c-api/init.rst:1933 +#: c-api/init.rst:2198 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: c-api/init.rst:1939 +#: c-api/init.rst:2204 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2210,7 +2691,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: c-api/init.rst:1947 +#: c-api/init.rst:2212 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2220,28 +2701,24 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: c-api/init.rst:1954 +#: c-api/init.rst:2219 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: c-api/init.rst:1963 c-api/init.rst:1989 -msgid "The caller must hold the :term:`GIL`." -msgstr "" - -#: c-api/init.rst:1960 +#: c-api/init.rst:2225 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: c-api/init.rst:1965 +#: c-api/init.rst:2230 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: c-api/init.rst:1973 +#: c-api/init.rst:2238 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2252,65 +2729,121 @@ msgid "" "*what* parameter." msgstr "" -#: c-api/init.rst:1980 +#: c-api/init.rst:2245 msgid "See also the :func:`sys.settrace` function." msgstr "" -#: c-api/init.rst:1986 +#: c-api/init.rst:2251 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: c-api/init.rst:1991 +#: c-api/init.rst:2256 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: c-api/init.rst:2000 +#: c-api/init.rst:2262 +msgid "Reference tracing" +msgstr "" + +#: c-api/init.rst:2268 +msgid "" +"The type of the trace function registered using :c:func:" +"`PyRefTracer_SetTracer`. The first parameter is a Python object that has " +"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " +"about to be destroyed (when **event** is set to :c:data:" +"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " +"provided when :c:func:`PyRefTracer_SetTracer` was called." +msgstr "" + +#: c-api/init.rst:2278 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"a Python object has been created." +msgstr "" + +#: c-api/init.rst:2283 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"a Python object has been destroyed." +msgstr "" + +#: c-api/init.rst:2288 +msgid "" +"Register a reference tracer function. The function will be called when a new " +"Python has been created or when an object is going to be destroyed. If " +"**data** is provided it must be an opaque pointer that will be provided when " +"the tracer function is called. Return ``0`` on success. Set an exception and " +"return ``-1`` on error." +msgstr "" + +#: c-api/init.rst:2294 +msgid "" +"Not that tracer functions **must not** create Python objects inside or " +"otherwise the call will be re-entrant. The tracer also **must not** clear " +"any existing exception or set an exception. A :term:`thread state` will be " +"active every time the tracer function is called." +msgstr "" + +#: c-api/init.rst:2310 +msgid "" +"There must be an :term:`attached thread state` when calling this function." +msgstr "" + +#: c-api/init.rst:2305 +msgid "" +"Get the registered reference tracer function and the value of the opaque " +"data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " +"called. If no tracer was registered this function will return NULL and will " +"set the **data** pointer to NULL." +msgstr "" + +#: c-api/init.rst:2317 msgid "Advanced Debugger Support" msgstr "" -#: c-api/init.rst:2005 +#: c-api/init.rst:2322 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: c-api/init.rst:2010 +#: c-api/init.rst:2327 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: c-api/init.rst:2015 +#: c-api/init.rst:2332 msgid "Return the main interpreter state object." msgstr "" -#: c-api/init.rst:2020 +#: c-api/init.rst:2337 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: c-api/init.rst:2026 +#: c-api/init.rst:2343 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: c-api/init.rst:2032 +#: c-api/init.rst:2349 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: c-api/init.rst:2039 +#: c-api/init.rst:2356 msgid "Thread Local Storage Support" msgstr "" -#: c-api/init.rst:2043 +#: c-api/init.rst:2360 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2320,19 +2853,19 @@ msgid "" "thread." msgstr "" -#: c-api/init.rst:2050 +#: c-api/init.rst:2367 msgid "" -"The GIL does *not* need to be held when calling these functions; they supply " -"their own locking." +"A :term:`thread state` does *not* need to be :term:`attached ` when calling these functions; they suppl their own locking." msgstr "" -#: c-api/init.rst:2053 +#: c-api/init.rst:2370 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: c-api/init.rst:2057 +#: c-api/init.rst:2374 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2340,22 +2873,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: c-api/init.rst:2065 +#: c-api/init.rst:2382 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: c-api/init.rst:2067 +#: c-api/init.rst:2384 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: c-api/init.rst:2073 +#: c-api/init.rst:2390 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: c-api/init.rst:2078 +#: c-api/init.rst:2395 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2363,52 +2896,52 @@ msgid "" "public members in this structure." msgstr "" -#: c-api/init.rst:2083 +#: c-api/init.rst:2400 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: c-api/init.rst:2089 +#: c-api/init.rst:2406 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: c-api/init.rst:2094 +#: c-api/init.rst:2411 msgid "Dynamic Allocation" msgstr "" -#: c-api/init.rst:2096 +#: c-api/init.rst:2413 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: c-api/init.rst:2103 +#: c-api/init.rst:2420 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: c-api/init.rst:2110 +#: c-api/init.rst:2427 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: c-api/init.rst:2116 +#: c-api/init.rst:2433 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: c-api/init.rst:2121 +#: c-api/init.rst:2438 msgid "Methods" msgstr "" -#: c-api/init.rst:2123 +#: c-api/init.rst:2440 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2416,13 +2949,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: c-api/init.rst:2131 +#: c-api/init.rst:2448 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: c-api/init.rst:2137 +#: c-api/init.rst:2454 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2431,7 +2964,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: c-api/init.rst:2146 +#: c-api/init.rst:2463 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2440,31 +2973,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: c-api/init.rst:2155 +#: c-api/init.rst:2472 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: c-api/init.rst:2162 +#: c-api/init.rst:2479 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: c-api/init.rst:2170 +#: c-api/init.rst:2487 msgid "Thread Local Storage (TLS) API" msgstr "" -#: c-api/init.rst:2172 +#: c-api/init.rst:2489 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: c-api/init.rst:2177 +#: c-api/init.rst:2494 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2473,188 +3006,647 @@ msgid "" "platforms." msgstr "" -#: c-api/init.rst:2182 +#: c-api/init.rst:2499 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: c-api/init.rst:495 c-api/init.rst:570 -msgid "Py_SetProgramName()" +#: c-api/init.rst:2510 +msgid "Synchronization Primitives" +msgstr "" + +#: c-api/init.rst:2512 +msgid "The C-API provides a basic mutual exclusion lock." +msgstr "" + +#: c-api/init.rst:2516 +msgid "" +"A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " +"zero to represent the unlocked state. For example::" +msgstr "" + +#: c-api/init.rst:2519 +msgid "PyMutex mutex = {0};" +msgstr "" + +#: c-api/init.rst:2521 +msgid "" +"Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " +"contents and address of a :c:type:`!PyMutex` are meaningful, and it must " +"remain at a fixed, writable location in memory." +msgstr "" + +#: c-api/init.rst:2527 +msgid "" +"A :c:type:`!PyMutex` currently occupies one byte, but the size should be " +"considered unstable. The size may change in future Python releases without " +"a deprecation period." +msgstr "" + +#: c-api/init.rst:2535 +msgid "" +"Lock mutex *m*. If another thread has already locked it, the calling thread " +"will block until the mutex is unlocked. While blocked, the thread will " +"temporarily detach the :term:`thread state ` if one " +"exists." +msgstr "" + +#: c-api/init.rst:2543 +msgid "" +"Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " +"issue a fatal error." +msgstr "" + +#: c-api/init.rst:2550 +msgid "Returns non-zero if the mutex *m* is currently locked, zero otherwise." +msgstr "" + +#: c-api/init.rst:2554 +msgid "" +"This function is intended for use in assertions and debugging only and " +"should not be used to make concurrency control decisions, as the lock state " +"may change immediately after the check." +msgstr "" + +#: c-api/init.rst:2563 +msgid "Python Critical Section API" +msgstr "" + +#: c-api/init.rst:2565 +msgid "" +"The critical section API provides a deadlock avoidance layer on top of per-" +"object locks for :term:`free-threaded ` CPython. They are " +"intended to replace reliance on the :term:`global interpreter lock`, and are " +"no-ops in versions of Python with the global interpreter lock." +msgstr "" + +#: c-api/init.rst:2570 +msgid "" +"Critical sections are intended to be used for custom types implemented in C-" +"API extensions. They should generally not be used with built-in types like :" +"class:`list` and :class:`dict` because their public C-APIs already use " +"critical sections internally, with the notable exception of :c:func:" +"`PyDict_Next`, which requires critical section to be acquired externally." +msgstr "" + +#: c-api/init.rst:2577 +msgid "" +"Critical sections avoid deadlocks by implicitly suspending active critical " +"sections, hence, they do not provide exclusive access such as provided by " +"traditional locks like :c:type:`PyMutex`. When a critical section is " +"started, the per-object lock for the object is acquired. If the code " +"executed inside the critical section calls C-API functions then it can " +"suspend the critical section thereby releasing the per-object lock, so other " +"threads can acquire the per-object lock for the same object." +msgstr "" + +#: c-api/init.rst:2585 +msgid "" +"Variants that accept :c:type:`PyMutex` pointers rather than Python objects " +"are also available. Use these variants to start a critical section in a " +"situation where there is no :c:type:`PyObject` -- for example, when working " +"with a C type that does not extend or wrap :c:type:`PyObject` but still " +"needs to call into the C API in a manner that might lead to deadlocks." +msgstr "" + +#: c-api/init.rst:2591 +msgid "" +"The functions and structs used by the macros are exposed for cases where C " +"macros are not available. They should only be used as in the given macro " +"expansions. Note that the sizes and contents of the structures may change in " +"future Python versions." +msgstr "" + +#: c-api/init.rst:2598 +msgid "" +"Operations that need to lock two objects at once must use :c:macro:" +"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " +"lock more than one object at once, because the inner critical section may " +"suspend the outer critical sections. This API does not provide a way to " +"lock more than two objects at once." +msgstr "" + +#: c-api/init.rst:2604 +msgid "Example usage::" +msgstr "" + +#: c-api/init.rst:2606 +msgid "" +"static PyObject *\n" +"set_field(MyObject *self, PyObject *value)\n" +"{\n" +" Py_BEGIN_CRITICAL_SECTION(self);\n" +" Py_SETREF(self->field, Py_XNewRef(value));\n" +" Py_END_CRITICAL_SECTION();\n" +" Py_RETURN_NONE;\n" +"}" +msgstr "" + +#: c-api/init.rst:2615 +msgid "" +"In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " +"can call arbitrary code through an object's deallocation function. The " +"critical section API avoids potential deadlocks due to reentrancy and lock " +"ordering by allowing the runtime to temporarily suspend the critical section " +"if the code triggered by the finalizer blocks and calls :c:func:" +"`PyEval_SaveThread`." +msgstr "" + +#: c-api/init.rst:2623 +msgid "" +"Acquires the per-object lock for the object *op* and begins a critical " +"section." +msgstr "" + +#: c-api/init.rst:2640 c-api/init.rst:2672 c-api/init.rst:2703 +msgid "In the free-threaded build, this macro expands to::" +msgstr "" + +#: c-api/init.rst:2628 +msgid "" +"{\n" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" +msgstr "" + +#: c-api/init.rst:2678 +msgid "In the default build, this macro expands to ``{``." +msgstr "" + +#: c-api/init.rst:2638 +msgid "Locks the mutex *m* and begins a critical section." +msgstr "" + +#: c-api/init.rst:2642 +msgid "" +"{\n" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_BeginMutex(&_py_cs, m)" +msgstr "" + +#: c-api/init.rst:2646 +msgid "" +"Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION`, there is no cast for " +"the argument of the macro - it must be a :c:type:`PyMutex` pointer." +msgstr "" + +#: c-api/init.rst:2695 +msgid "On the default build, this macro expands to ``{``." +msgstr "" + +#: c-api/init.rst:2655 +msgid "Ends the critical section and releases the per-object lock." +msgstr "" + +#: c-api/init.rst:2659 +msgid "" +" PyCriticalSection_End(&_py_cs);\n" +"}" +msgstr "" + +#: c-api/init.rst:2708 +msgid "In the default build, this macro expands to ``}``." +msgstr "" + +#: c-api/init.rst:2668 +msgid "" +"Acquires the per-objects locks for the objects *a* and *b* and begins a " +"critical section. The locks are acquired in a consistent order (lowest " +"address first) to avoid lock ordering deadlocks." +msgstr "" + +#: c-api/init.rst:2674 +msgid "" +"{\n" +" PyCriticalSection2 _py_cs2;\n" +" PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" +msgstr "" + +#: c-api/init.rst:2684 +msgid "Locks the mutexes *m1* and *m2* and begins a critical section." +msgstr "" + +#: c-api/init.rst:2688 +msgid "" +"{\n" +" PyCriticalSection2 _py_cs2;\n" +" PyCriticalSection2_BeginMutex(&_py_cs2, m1, m2)" +msgstr "" + +#: c-api/init.rst:2692 +msgid "" +"Note that unlike :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, there is no cast for " +"the arguments of the macro - they must be :c:type:`PyMutex` pointers." +msgstr "" + +#: c-api/init.rst:2701 +msgid "Ends the critical section and releases the per-object locks." +msgstr "" + +#: c-api/init.rst:2705 +msgid "" +" PyCriticalSection2_End(&_py_cs2);\n" +"}" +msgstr "" + +#: c-api/init.rst:2714 +msgid "Legacy Locking APIs" +msgstr "" + +#: c-api/init.rst:2716 +msgid "" +"These APIs are obsolete since Python 3.13 with the introduction of :c:type:" +"`PyMutex`." +msgstr "" + +#: c-api/init.rst:2719 +msgid "These APIs are now a simple wrapper around ``PyMutex``." +msgstr "" + +#: c-api/init.rst:2725 +msgid "A pointer to a mutual exclusion lock." +msgstr "" + +#: c-api/init.rst:2730 +msgid "The result of acquiring a lock with a timeout." +msgstr "" + +#: c-api/init.rst:2736 +msgid "Failed to acquire the lock." +msgstr "" + +#: c-api/init.rst:2740 +msgid "The lock was successfully acquired." +msgstr "" + +#: c-api/init.rst:2744 +msgid "The lock was interrupted by a signal." +msgstr "" + +#: c-api/init.rst:2749 +msgid "Allocate a new lock." +msgstr "" + +#: c-api/init.rst:2751 +msgid "" +"On success, this function returns a lock; on failure, this function returns " +"``0`` without an exception set." +msgstr "" + +#: c-api/init.rst:2766 c-api/init.rst:2804 c-api/init.rst:2835 +#: c-api/init.rst:2927 +msgid "The caller does not need to hold an :term:`attached thread state`." +msgstr "" + +#: c-api/init.rst:2756 +msgid "" +"This function now always uses :c:type:`PyMutex`. In prior versions, this " +"would use a lock provided by the operating system." +msgstr "" + +#: c-api/init.rst:2763 +msgid "" +"Destroy *lock*. The lock should not be held by any thread when calling this." +msgstr "" + +#: c-api/init.rst:2771 +msgid "Acquire *lock* with a timeout." +msgstr "" + +#: c-api/init.rst:2773 +msgid "" +"This will wait for *microseconds* microseconds to acquire the lock. If the " +"timeout expires, this function returns :c:enumerator:`PY_LOCK_FAILURE`. If " +"*microseconds* is ``-1``, this will wait indefinitely until the lock has " +"been released." +msgstr "" + +#: c-api/init.rst:2778 +msgid "" +"If *intr_flag* is ``1``, acquiring the lock may be interrupted by a signal, " +"in which case this function returns :c:enumerator:`PY_LOCK_INTR`. Upon " +"interruption, it's generally expected that the caller makes a call to :c:" +"func:`Py_MakePendingCalls` to propagate an exception to Python code." +msgstr "" + +#: c-api/init.rst:2783 +msgid "" +"If the lock is successfully acquired, this function returns :c:enumerator:" +"`PY_LOCK_ACQUIRED`." +msgstr "" + +#: c-api/init.rst:2791 +msgid "Acquire *lock*." +msgstr "" + +#: c-api/init.rst:2793 +msgid "" +"If *waitflag* is ``1`` and another thread currently holds the lock, this " +"function will wait until the lock can be acquired and will always return " +"``1``." +msgstr "" + +#: c-api/init.rst:2797 +msgid "" +"If *waitflag* is ``0`` and another thread holds the lock, this function will " +"not wait and instead return ``0``. If the lock is not held by any other " +"thread, then this function will acquire it and return ``1``." +msgstr "" + +#: c-api/init.rst:2801 +msgid "" +"Unlike :c:func:`PyThread_acquire_lock_timed`, acquiring the lock cannot be " +"interrupted by a signal." +msgstr "" + +#: c-api/init.rst:2809 +msgid "" +"Release *lock*. If *lock* is not held, then this function issues a fatal " +"error." +msgstr "" + +#: c-api/init.rst:2816 +msgid "Operating System Thread APIs" +msgstr "" + +#: c-api/init.rst:2820 +msgid "Sentinel value for an invalid thread ID." +msgstr "" + +#: c-api/init.rst:2822 +msgid "This is currently equivalent to ``(unsigned long)-1``." +msgstr "" + +#: c-api/init.rst:2827 +msgid "" +"Start function *func* in a new thread with argument *arg*. The resulting " +"thread is not intended to be joined." msgstr "" -#: c-api/init.rst:334 +#: c-api/init.rst:2830 +msgid "*func* must not be ``NULL``, but *arg* may be ``NULL``." +msgstr "" + +#: c-api/init.rst:2832 +msgid "" +"On success, this function returns the identifier of the new thread; on " +"failure, this returns :c:macro:`PYTHREAD_INVALID_THREAD_ID`." +msgstr "" + +#: c-api/init.rst:2840 +msgid "Return the identifier of the current thread, which will never be zero." +msgstr "" + +#: c-api/init.rst:2874 +msgid "" +"This function cannot fail, and the caller does not need to hold an :term:" +"`attached thread state`." +msgstr "" + +#: c-api/init.rst:2846 +msgid ":py:func:`threading.get_ident`" +msgstr "" + +#: c-api/init.rst:2851 +msgid "" +"Get general information about the current thread in the form of a :ref:" +"`struct sequence ` object. This information is " +"accessible as :py:attr:`sys.thread_info` in Python." +msgstr "" + +#: c-api/init.rst:2855 +msgid "" +"On success, this returns a new :term:`strong reference` to the thread " +"information; on failure, this returns ``NULL`` with an exception set." +msgstr "" + +#: c-api/init.rst:2858 +msgid "The caller must hold an :term:`attached thread state`." +msgstr "" + +#: c-api/init.rst:2863 +msgid "This macro is defined when the system supports native thread IDs." +msgstr "" + +#: c-api/init.rst:2868 +msgid "" +"Get the native identifier of the current thread as it was assigned by the " +"operating system's kernel, which will never be less than zero." +msgstr "" + +#: c-api/init.rst:2871 +msgid "" +"This function is only available when :c:macro:`PY_HAVE_THREAD_NATIVE_ID` is " +"defined." +msgstr "" + +#: c-api/init.rst:2878 +msgid ":py:func:`threading.get_native_id`" +msgstr "" + +#: c-api/init.rst:2883 +msgid "" +"Terminate the current thread. This function is generally considered unsafe " +"and should be avoided. It is kept solely for backwards compatibility." +msgstr "" + +#: c-api/init.rst:2886 +msgid "" +"This function is only safe to call if all functions in the full call stack " +"are written to safely allow it." +msgstr "" + +#: c-api/init.rst:2891 +msgid "" +"If the current system uses POSIX threads (also known as \"pthreads\"), this " +"calls :manpage:`pthread_exit(3)`, which attempts to unwind the stack and " +"call C++ destructors on some libc implementations. However, if a " +"``noexcept`` function is reached, it may terminate the process. Other " +"systems, such as macOS, do unwinding." +msgstr "" + +#: c-api/init.rst:2897 +msgid "" +"On Windows, this function calls ``_endthreadex()``, which kills the thread " +"without calling C++ destructors." +msgstr "" + +#: c-api/init.rst:2900 +msgid "In any case, there is a risk of corruption on the thread's stack." +msgstr "" + +#: c-api/init.rst:2907 +msgid "" +"Initialize ``PyThread*`` APIs. Python executes this function automatically, " +"so there's little need to call it from an extension module." +msgstr "" + +#: c-api/init.rst:2913 +msgid "Set the stack size of the current thread to *size* bytes." +msgstr "" + +#: c-api/init.rst:2915 +msgid "" +"This function returns ``0`` on success, ``-1`` if *size* is invalid, or " +"``-2`` if the system does not support changing the stack size. This function " +"does not set exceptions." +msgstr "" + +#: c-api/init.rst:2924 +msgid "" +"Return the stack size of the current thread in bytes, or ``0`` if the " +"system's default stack size is in use." +msgstr "" + +#: c-api/init.rst:350 msgid "PyEval_InitThreads()" msgstr "" -#: c-api/init.rst:334 +#: c-api/init.rst:350 msgid "modules (in module sys)" msgstr "" -#: c-api/init.rst:589 c-api/init.rst:615 +#: c-api/init.rst:712 msgid "path (in module sys)" msgstr "" -#: c-api/init.rst:589 c-api/init.rst:1056 c-api/init.rst:1682 +#: c-api/init.rst:712 c-api/init.rst:1829 c-api/init.rst:1928 msgid "module" msgstr "" -#: c-api/init.rst:1587 c-api/init.rst:1682 +#: c-api/init.rst:1829 c-api/init.rst:1928 msgid "builtins" msgstr "" -#: c-api/init.rst:1587 c-api/init.rst:1682 +#: c-api/init.rst:1829 c-api/init.rst:1928 msgid "__main__" msgstr "" -#: c-api/init.rst:1587 c-api/init.rst:1682 +#: c-api/init.rst:1829 c-api/init.rst:1928 msgid "sys" msgstr "" -#: c-api/init.rst:589 c-api/init.rst:615 +#: c-api/init.rst:712 msgid "search" msgstr "" -#: c-api/init.rst:589 c-api/init.rst:615 +#: c-api/init.rst:712 msgid "path" msgstr "" -#: c-api/init.rst:334 -msgid "PySys_SetArgv (C function)" -msgstr "" - -#: c-api/init.rst:334 -msgid "PySys_SetArgvEx (C function)" -msgstr "" - -#: c-api/init.rst:1647 c-api/init.rst:1700 +#: c-api/init.rst:1893 c-api/init.rst:1946 msgid "Py_FinalizeEx (C function)" msgstr "" -#: c-api/init.rst:467 +#: c-api/init.rst:572 msgid "Py_Initialize()" msgstr "" -#: c-api/init.rst:467 c-api/init.rst:723 +#: c-api/init.rst:810 msgid "main()" msgstr "" -#: c-api/init.rst:430 -msgid "stdin" -msgstr "" - -#: c-api/init.rst:430 -msgid "stdout" -msgstr "" - -#: c-api/init.rst:430 -msgid "sdterr" -msgstr "" - -#: c-api/init.rst:615 +#: c-api/init.rst:572 msgid "Py_GetPath()" msgstr "" -#: c-api/init.rst:570 +#: c-api/init.rst:690 msgid "executable (in module sys)" msgstr "" -#: c-api/init.rst:589 -msgid "Py_SetPath()" -msgstr "" - -#: c-api/init.rst:700 c-api/init.rst:714 +#: c-api/init.rst:787 c-api/init.rst:801 msgid "version (in module sys)" msgstr "" -#: c-api/init.rst:670 +#: c-api/init.rst:757 msgid "platform (in module sys)" msgstr "" -#: c-api/init.rst:687 +#: c-api/init.rst:774 msgid "copyright (in module sys)" msgstr "" -#: c-api/init.rst:723 +#: c-api/init.rst:810 msgid "Py_FatalError()" msgstr "" -#: c-api/init.rst:723 +#: c-api/init.rst:810 msgid "argv (in module sys)" msgstr "" -#: c-api/init.rst:839 +#: c-api/init.rst:930 msgid "global interpreter lock" msgstr "" -#: c-api/init.rst:839 +#: c-api/init.rst:930 msgid "interpreter lock" msgstr "" -#: c-api/init.rst:839 +#: c-api/init.rst:930 msgid "lock, interpreter" msgstr "" -#: c-api/init.rst:852 +#: c-api/init.rst:944 msgid "setswitchinterval (in module sys)" msgstr "" -#: c-api/init.rst:861 +#: c-api/init.rst:953 msgid "PyThreadState (C type)" msgstr "" -#: c-api/init.rst:887 +#: c-api/init.rst:989 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "" -#: c-api/init.rst:887 +#: c-api/init.rst:989 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "" -#: c-api/init.rst:903 +#: c-api/init.rst:1005 msgid "PyEval_RestoreThread (C function)" msgstr "" -#: c-api/init.rst:903 +#: c-api/init.rst:1005 msgid "PyEval_SaveThread (C function)" msgstr "" -#: c-api/init.rst:1034 +#: c-api/init.rst:1206 msgid "PyEval_AcquireThread()" msgstr "" -#: c-api/init.rst:1034 +#: c-api/init.rst:1206 msgid "PyEval_ReleaseThread()" msgstr "" -#: c-api/init.rst:1034 +#: c-api/init.rst:1206 msgid "PyEval_SaveThread()" msgstr "" -#: c-api/init.rst:1034 +#: c-api/init.rst:1206 msgid "PyEval_RestoreThread()" msgstr "" -#: c-api/init.rst:1056 +#: c-api/init.rst:1228 msgid "_thread" msgstr "" -#: c-api/init.rst:1682 +#: c-api/init.rst:1928 msgid "stdout (in module sys)" msgstr "" -#: c-api/init.rst:1682 +#: c-api/init.rst:1928 msgid "stderr (in module sys)" msgstr "" -#: c-api/init.rst:1682 +#: c-api/init.rst:1928 msgid "stdin (in module sys)" msgstr "" -#: c-api/init.rst:1647 +#: c-api/init.rst:1893 msgid "Py_Initialize (C function)" msgstr "" -#: c-api/init.rst:1677 +#: c-api/init.rst:1923 msgid "close (in module os)" msgstr "" diff --git a/c-api/init_config.po b/c-api/init_config.po index 5fc09f62..008de713 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -20,18 +21,1046 @@ msgstr "" msgid "Python Initialization Configuration" msgstr "" -#: c-api/init_config.rst:11 +#: c-api/init_config.rst:13 +msgid "PyInitConfig C API" +msgstr "" + +#: c-api/init_config.rst:17 +msgid "Python can be initialized with :c:func:`Py_InitializeFromInitConfig`." +msgstr "" + +#: c-api/init_config.rst:650 +msgid "" +"The :c:func:`Py_RunMain` function can be used to write a customized Python " +"program." +msgstr "" + +#: c-api/init_config.rst:653 +msgid "" +"See also :ref:`Initialization, Finalization, and Threads `." +msgstr "" + +#: c-api/init_config.rst:25 +msgid ":pep:`741` \"Python Configuration C API\"." +msgstr "" + +#: c-api/init_config.rst:660 +msgid "Example" +msgstr "" + +#: c-api/init_config.rst:31 +msgid "" +"Example of customized Python always running with the :ref:`Python " +"Development Mode ` enabled; return ``-1`` on error:" +msgstr "" + +#: c-api/init_config.rst:34 +msgid "" +"int init_python(void)\n" +"{\n" +" PyInitConfig *config = PyInitConfig_Create();\n" +" if (config == NULL) {\n" +" printf(\"PYTHON INIT ERROR: memory allocation failed\\n\");\n" +" return -1;\n" +" }\n" +"\n" +" // Enable the Python Development Mode\n" +" if (PyInitConfig_SetInt(config, \"dev_mode\", 1) < 0) {\n" +" goto error;\n" +" }\n" +"\n" +" // Initialize Python with the configuration\n" +" if (Py_InitializeFromInitConfig(config) < 0) {\n" +" goto error;\n" +" }\n" +" PyInitConfig_Free(config);\n" +" return 0;\n" +"\n" +"error:\n" +" {\n" +" // Display the error message.\n" +" //\n" +" // This uncommon braces style is used, because you cannot make\n" +" // goto targets point to variable declarations.\n" +" const char *err_msg;\n" +" (void)PyInitConfig_GetError(config, &err_msg);\n" +" printf(\"PYTHON INIT ERROR: %s\\n\", err_msg);\n" +" PyInitConfig_Free(config);\n" +" return -1;\n" +" }\n" +"}" +msgstr "" + +#: c-api/init_config.rst:71 +msgid "Create Config" +msgstr "" + +#: c-api/init_config.rst:75 +msgid "Opaque structure to configure the Python initialization." +msgstr "" + +#: c-api/init_config.rst:80 +msgid "" +"Create a new initialization configuration using :ref:`Isolated Configuration " +"` default values." +msgstr "" + +#: c-api/init_config.rst:83 +msgid "It must be freed by :c:func:`PyInitConfig_Free`." +msgstr "" + +#: c-api/init_config.rst:85 +msgid "Return ``NULL`` on memory allocation failure." +msgstr "" + +#: c-api/init_config.rst:90 +msgid "Free memory of the initialization configuration *config*." +msgstr "" + +#: c-api/init_config.rst:92 +msgid "If *config* is ``NULL``, no operation is performed." +msgstr "" + +#: c-api/init_config.rst:96 +msgid "Error Handling" +msgstr "" + +#: c-api/init_config.rst:100 +msgid "Get the *config* error message." +msgstr "" + +#: c-api/init_config.rst:102 +msgid "Set *\\*err_msg* and return ``1`` if an error is set." +msgstr "" + +#: c-api/init_config.rst:103 +msgid "Set *\\*err_msg* to ``NULL`` and return ``0`` otherwise." +msgstr "" + +#: c-api/init_config.rst:105 +msgid "An error message is a UTF-8 encoded string." +msgstr "" + +#: c-api/init_config.rst:107 +msgid "If *config* has an exit code, format the exit code as an error message." +msgstr "" + +#: c-api/init_config.rst:110 +msgid "" +"The error message remains valid until another ``PyInitConfig`` function is " +"called with *config*. The caller doesn't have to free the error message." +msgstr "" + +#: c-api/init_config.rst:117 +msgid "Get the *config* exit code." +msgstr "" + +#: c-api/init_config.rst:119 +msgid "Set *\\*exitcode* and return ``1`` if *config* has an exit code set." +msgstr "" + +#: c-api/init_config.rst:120 +msgid "Return ``0`` if *config* has no exit code set." +msgstr "" + +#: c-api/init_config.rst:122 +msgid "" +"Only the ``Py_InitializeFromInitConfig()`` function can set an exit code if " +"the ``parse_argv`` option is non-zero." +msgstr "" + +#: c-api/init_config.rst:125 +msgid "" +"An exit code can be set when parsing the command line failed (exit code " +"``2``) or when a command line option asks to display the command line help " +"(exit code ``0``)." +msgstr "" + +#: c-api/init_config.rst:131 +msgid "Get Options" +msgstr "" + +#: c-api/init_config.rst:187 c-api/init_config.rst:559 +msgid "" +"The configuration option *name* parameter must be a non-NULL null-terminated " +"UTF-8 encoded string. See :ref:`Configuration Options `." +msgstr "" + +#: c-api/init_config.rst:138 +msgid "Test if the configuration has an option called *name*." +msgstr "" + +#: c-api/init_config.rst:140 +msgid "Return ``1`` if the option exists, or return ``0`` otherwise." +msgstr "" + +#: c-api/init_config.rst:145 +msgid "Get an integer configuration option." +msgstr "" + +#: c-api/init_config.rst:156 +msgid "Set *\\*value*, and return ``0`` on success." +msgstr "" + +#: c-api/init_config.rst:157 c-api/init_config.rst:200 +#: c-api/init_config.rst:218 c-api/init_config.rst:249 +msgid "Set an error in *config* and return ``-1`` on error." +msgstr "" + +#: c-api/init_config.rst:153 +msgid "" +"Get a string configuration option as a null-terminated UTF-8 encoded string." +msgstr "" + +#: c-api/init_config.rst:159 +msgid "" +"*\\*value* can be set to ``NULL`` if the option is an optional string and " +"the option is unset." +msgstr "" + +#: c-api/init_config.rst:162 +msgid "" +"On success, the string must be released with ``free(value)`` if it's not " +"``NULL``." +msgstr "" + +#: c-api/init_config.rst:168 +msgid "" +"Get a string list configuration option as an array of null-terminated UTF-8 " +"encoded strings." +msgstr "" + +#: c-api/init_config.rst:171 +msgid "Set *\\*length* and *\\*value*, and return ``0`` on success." +msgstr "" + +#: c-api/init_config.rst:174 +msgid "" +"On success, the string list must be released with " +"``PyInitConfig_FreeStrList(length, items)``." +msgstr "" + +#: c-api/init_config.rst:180 +msgid "Free memory of a string list created by ``PyInitConfig_GetStrList()``." +msgstr "" + +#: c-api/init_config.rst:185 +msgid "Set Options" +msgstr "" + +#: c-api/init_config.rst:190 +msgid "" +"Some configuration options have side effects on other options. This logic is " +"only implemented when ``Py_InitializeFromInitConfig()`` is called, not by " +"the \"Set\" functions below. For example, setting ``dev_mode`` to ``1`` does " +"not set ``faulthandler`` to ``1``." +msgstr "" + +#: c-api/init_config.rst:197 +msgid "Set an integer configuration option." +msgstr "" + +#: c-api/init_config.rst:208 c-api/init_config.rst:232 +#: c-api/init_config.rst:591 +msgid "Return ``0`` on success." +msgstr "" + +#: c-api/init_config.rst:205 +msgid "" +"Set a string configuration option from a null-terminated UTF-8 encoded " +"string. The string is copied." +msgstr "" + +#: c-api/init_config.rst:214 +msgid "" +"Set a string list configuration option from an array of null-terminated " +"UTF-8 encoded strings. The string list is copied." +msgstr "" + +#: c-api/init_config.rst:222 +msgid "Module" +msgstr "" + +#: c-api/init_config.rst:226 +msgid "Add a built-in extension module to the table of built-in modules." +msgstr "" + +#: c-api/init_config.rst:228 +msgid "" +"The new module can be imported by the name *name*, and uses the function " +"*initfunc* as the initialization function called on the first attempted " +"import." +msgstr "" + +#: c-api/init_config.rst:235 +msgid "" +"If Python is initialized multiple times, ``PyInitConfig_AddModule()`` must " +"be called at each Python initialization." +msgstr "" + +#: c-api/init_config.rst:238 +msgid "Similar to the :c:func:`PyImport_AppendInittab` function." +msgstr "" + +#: c-api/init_config.rst:242 +msgid "Initialize Python" +msgstr "" + +#: c-api/init_config.rst:246 +msgid "Initialize Python from the initialization configuration." +msgstr "" + +#: c-api/init_config.rst:250 +msgid "Set an exit code in *config* and return ``-1`` if Python wants to exit." +msgstr "" + +#: c-api/init_config.rst:253 +msgid "See ``PyInitConfig_GetExitcode()`` for the exit code case." +msgstr "" + +#: c-api/init_config.rst:259 +msgid "Configuration Options" +msgstr "" + +#: c-api/init_config.rst:264 +msgid "Option" +msgstr "" + +#: c-api/init_config.rst:265 +msgid "PyConfig/PyPreConfig member" +msgstr "" + +#: c-api/init_config.rst:266 +msgid "Type" +msgstr "" + +#: c-api/init_config.rst:267 +msgid "Visibility" +msgstr "" + +#: c-api/init_config.rst:268 +msgid "``\"allocator\"``" +msgstr "" + +#: c-api/init_config.rst:269 +msgid ":c:member:`allocator `" +msgstr "" + +#: c-api/init_config.rst:294 c-api/init_config.rst:358 +#: c-api/init_config.rst:378 c-api/init_config.rst:494 +#: c-api/init_config.rst:576 +msgid "``int``" +msgstr "" + +#: c-api/init_config.rst:291 c-api/init_config.rst:303 +#: c-api/init_config.rst:311 c-api/init_config.rst:319 +#: c-api/init_config.rst:331 c-api/init_config.rst:347 +#: c-api/init_config.rst:355 c-api/init_config.rst:363 +#: c-api/init_config.rst:375 c-api/init_config.rst:391 +#: c-api/init_config.rst:399 c-api/init_config.rst:415 +#: c-api/init_config.rst:427 c-api/init_config.rst:451 +#: c-api/init_config.rst:459 c-api/init_config.rst:467 +#: c-api/init_config.rst:475 c-api/init_config.rst:483 +#: c-api/init_config.rst:495 c-api/init_config.rst:507 +#: c-api/init_config.rst:515 c-api/init_config.rst:527 +#: c-api/init_config.rst:543 +msgid "Read-only" +msgstr "" + +#: c-api/init_config.rst:272 +msgid "``\"argv\"``" +msgstr "" + +#: c-api/init_config.rst:273 +msgid ":c:member:`argv `" +msgstr "" + +#: c-api/init_config.rst:402 c-api/init_config.rst:530 +#: c-api/init_config.rst:578 +msgid "``list[str]``" +msgstr "" + +#: c-api/init_config.rst:279 c-api/init_config.rst:287 +#: c-api/init_config.rst:323 c-api/init_config.rst:343 +#: c-api/init_config.rst:379 c-api/init_config.rst:403 +#: c-api/init_config.rst:419 c-api/init_config.rst:435 +#: c-api/init_config.rst:447 c-api/init_config.rst:499 +#: c-api/init_config.rst:531 c-api/init_config.rst:539 +msgid "Public" +msgstr "" + +#: c-api/init_config.rst:276 +msgid "``\"base_exec_prefix\"``" +msgstr "" + +#: c-api/init_config.rst:277 +msgid ":c:member:`base_exec_prefix `" +msgstr "" + +#: c-api/init_config.rst:282 c-api/init_config.rst:298 +#: c-api/init_config.rst:338 c-api/init_config.rst:350 +#: c-api/init_config.rst:362 c-api/init_config.rst:434 +#: c-api/init_config.rst:442 c-api/init_config.rst:454 +#: c-api/init_config.rst:462 c-api/init_config.rst:486 +#: c-api/init_config.rst:577 +msgid "``str``" +msgstr "" + +#: c-api/init_config.rst:280 +msgid "``\"base_executable\"``" +msgstr "" + +#: c-api/init_config.rst:281 +msgid ":c:member:`base_executable `" +msgstr "" + +#: c-api/init_config.rst:284 +msgid "``\"base_prefix\"``" +msgstr "" + +#: c-api/init_config.rst:285 +msgid ":c:member:`base_prefix `" +msgstr "" + +#: c-api/init_config.rst:288 +msgid "``\"buffered_stdio\"``" +msgstr "" + +#: c-api/init_config.rst:289 +msgid ":c:member:`buffered_stdio `" +msgstr "" + +#: c-api/init_config.rst:302 c-api/init_config.rst:310 +#: c-api/init_config.rst:318 c-api/init_config.rst:330 +#: c-api/init_config.rst:370 c-api/init_config.rst:382 +#: c-api/init_config.rst:390 c-api/init_config.rst:398 +#: c-api/init_config.rst:418 c-api/init_config.rst:426 +#: c-api/init_config.rst:466 c-api/init_config.rst:474 +#: c-api/init_config.rst:498 c-api/init_config.rst:506 +#: c-api/init_config.rst:514 c-api/init_config.rst:526 +#: c-api/init_config.rst:542 c-api/init_config.rst:575 +msgid "``bool``" +msgstr "" + +#: c-api/init_config.rst:292 +msgid "``\"bytes_warning\"``" +msgstr "" + +#: c-api/init_config.rst:293 +msgid ":c:member:`bytes_warning `" +msgstr "" + +#: c-api/init_config.rst:296 +msgid "``\"check_hash_pycs_mode\"``" +msgstr "" + +#: c-api/init_config.rst:297 +msgid ":c:member:`check_hash_pycs_mode `" +msgstr "" + +#: c-api/init_config.rst:300 +msgid "``\"code_debug_ranges\"``" +msgstr "" + +#: c-api/init_config.rst:301 +msgid ":c:member:`code_debug_ranges `" +msgstr "" + +#: c-api/init_config.rst:304 +msgid "``\"coerce_c_locale\"``" +msgstr "" + +#: c-api/init_config.rst:305 +msgid ":c:member:`coerce_c_locale `" +msgstr "" + +#: c-api/init_config.rst:308 +msgid "``\"coerce_c_locale_warn\"``" +msgstr "" + +#: c-api/init_config.rst:309 +msgid ":c:member:`coerce_c_locale_warn `" +msgstr "" + +#: c-api/init_config.rst:312 +msgid "``\"configure_c_stdio\"``" +msgstr "" + +#: c-api/init_config.rst:313 +msgid ":c:member:`configure_c_stdio `" +msgstr "" + +#: c-api/init_config.rst:316 +msgid "``\"configure_locale\"``" +msgstr "" + +#: c-api/init_config.rst:317 +msgid ":c:member:`configure_locale `" +msgstr "" + +#: c-api/init_config.rst:320 +msgid "``\"cpu_count\"``" +msgstr "" + +#: c-api/init_config.rst:321 +msgid ":c:member:`cpu_count `" +msgstr "" + +#: c-api/init_config.rst:324 +msgid "``\"dev_mode\"``" +msgstr "" + +#: c-api/init_config.rst:325 +msgid ":c:member:`dev_mode `" +msgstr "" + +#: c-api/init_config.rst:328 +msgid "``\"dump_refs\"``" +msgstr "" + +#: c-api/init_config.rst:329 +msgid ":c:member:`dump_refs `" +msgstr "" + +#: c-api/init_config.rst:332 +msgid "``\"dump_refs_file\"``" +msgstr "" + +#: c-api/init_config.rst:333 +msgid ":c:member:`dump_refs_file `" +msgstr "" + +#: c-api/init_config.rst:336 +msgid "``\"exec_prefix\"``" +msgstr "" + +#: c-api/init_config.rst:337 +msgid ":c:member:`exec_prefix `" +msgstr "" + +#: c-api/init_config.rst:340 +msgid "``\"executable\"``" +msgstr "" + +#: c-api/init_config.rst:341 +msgid ":c:member:`executable `" +msgstr "" + +#: c-api/init_config.rst:344 +msgid "``\"faulthandler\"``" +msgstr "" + +#: c-api/init_config.rst:345 +msgid ":c:member:`faulthandler `" +msgstr "" + +#: c-api/init_config.rst:348 +msgid "``\"filesystem_encoding\"``" +msgstr "" + +#: c-api/init_config.rst:349 +msgid ":c:member:`filesystem_encoding `" +msgstr "" + +#: c-api/init_config.rst:352 +msgid "``\"filesystem_errors\"``" +msgstr "" + +#: c-api/init_config.rst:353 +msgid ":c:member:`filesystem_errors `" +msgstr "" + +#: c-api/init_config.rst:356 +msgid "``\"hash_seed\"``" +msgstr "" + +#: c-api/init_config.rst:357 +msgid ":c:member:`hash_seed `" +msgstr "" + +#: c-api/init_config.rst:360 +msgid "``\"home\"``" +msgstr "" + +#: c-api/init_config.rst:361 +msgid ":c:member:`home `" +msgstr "" + +#: c-api/init_config.rst:364 +msgid "``\"import_time\"``" +msgstr "" + +#: c-api/init_config.rst:365 +msgid ":c:member:`import_time `" +msgstr "" + +#: c-api/init_config.rst:368 +msgid "``\"inspect\"``" +msgstr "" + +#: c-api/init_config.rst:369 +msgid ":c:member:`inspect `" +msgstr "" + +#: c-api/init_config.rst:372 +msgid "``\"install_signal_handlers\"``" +msgstr "" + +#: c-api/init_config.rst:373 +msgid ":c:member:`install_signal_handlers `" +msgstr "" + +#: c-api/init_config.rst:376 +msgid "``\"int_max_str_digits\"``" +msgstr "" + +#: c-api/init_config.rst:377 +msgid ":c:member:`int_max_str_digits `" +msgstr "" + +#: c-api/init_config.rst:380 +msgid "``\"interactive\"``" +msgstr "" + +#: c-api/init_config.rst:381 +msgid ":c:member:`interactive `" +msgstr "" + +#: c-api/init_config.rst:384 +msgid "``\"isolated\"``" +msgstr "" + +#: c-api/init_config.rst:385 +msgid ":c:member:`isolated `" +msgstr "" + +#: c-api/init_config.rst:388 +msgid "``\"legacy_windows_fs_encoding\"``" +msgstr "" + +#: c-api/init_config.rst:389 +msgid "" +":c:member:`legacy_windows_fs_encoding `" +msgstr "" + +#: c-api/init_config.rst:392 +msgid "``\"legacy_windows_stdio\"``" +msgstr "" + +#: c-api/init_config.rst:393 +msgid ":c:member:`legacy_windows_stdio `" +msgstr "" + +#: c-api/init_config.rst:396 +msgid "``\"malloc_stats\"``" +msgstr "" + +#: c-api/init_config.rst:397 +msgid ":c:member:`malloc_stats `" +msgstr "" + +#: c-api/init_config.rst:400 +msgid "``\"module_search_paths\"``" +msgstr "" + +#: c-api/init_config.rst:401 +msgid ":c:member:`module_search_paths `" +msgstr "" + +#: c-api/init_config.rst:404 +msgid "``\"optimization_level\"``" +msgstr "" + +#: c-api/init_config.rst:405 +msgid ":c:member:`optimization_level `" +msgstr "" + +#: c-api/init_config.rst:408 +msgid "``\"orig_argv\"``" +msgstr "" + +#: c-api/init_config.rst:409 +msgid ":c:member:`orig_argv `" +msgstr "" + +#: c-api/init_config.rst:412 +msgid "``\"parse_argv\"``" +msgstr "" + +#: c-api/init_config.rst:413 +msgid ":c:member:`parse_argv `" +msgstr "" + +#: c-api/init_config.rst:416 +msgid "``\"parser_debug\"``" +msgstr "" + +#: c-api/init_config.rst:417 +msgid ":c:member:`parser_debug `" +msgstr "" + +#: c-api/init_config.rst:420 +msgid "``\"pathconfig_warnings\"``" +msgstr "" + +#: c-api/init_config.rst:421 +msgid ":c:member:`pathconfig_warnings `" +msgstr "" + +#: c-api/init_config.rst:424 +msgid "``\"perf_profiling\"``" +msgstr "" + +#: c-api/init_config.rst:425 +msgid ":c:member:`perf_profiling `" +msgstr "" + +#: c-api/init_config.rst:428 +msgid "``\"platlibdir\"``" +msgstr "" + +#: c-api/init_config.rst:429 +msgid ":c:member:`platlibdir `" +msgstr "" + +#: c-api/init_config.rst:432 +msgid "``\"prefix\"``" +msgstr "" + +#: c-api/init_config.rst:433 +msgid ":c:member:`prefix `" +msgstr "" + +#: c-api/init_config.rst:436 +msgid "``\"program_name\"``" +msgstr "" + +#: c-api/init_config.rst:437 +msgid ":c:member:`program_name `" +msgstr "" + +#: c-api/init_config.rst:440 +msgid "``\"pycache_prefix\"``" +msgstr "" + +#: c-api/init_config.rst:441 +msgid ":c:member:`pycache_prefix `" +msgstr "" + +#: c-api/init_config.rst:444 +msgid "``\"quiet\"``" +msgstr "" + +#: c-api/init_config.rst:445 +msgid ":c:member:`quiet `" +msgstr "" + +#: c-api/init_config.rst:448 +msgid "``\"run_command\"``" +msgstr "" + +#: c-api/init_config.rst:449 +msgid ":c:member:`run_command `" +msgstr "" + +#: c-api/init_config.rst:452 +msgid "``\"run_filename\"``" +msgstr "" + +#: c-api/init_config.rst:453 +msgid ":c:member:`run_filename `" +msgstr "" + +#: c-api/init_config.rst:456 +msgid "``\"run_module\"``" +msgstr "" + +#: c-api/init_config.rst:457 +msgid ":c:member:`run_module `" +msgstr "" + +#: c-api/init_config.rst:460 +msgid "``\"run_presite\"``" +msgstr "" + +#: c-api/init_config.rst:461 +msgid ":c:member:`run_presite `" +msgstr "" + +#: c-api/init_config.rst:464 +msgid "``\"safe_path\"``" +msgstr "" + +#: c-api/init_config.rst:465 +msgid ":c:member:`safe_path `" +msgstr "" + +#: c-api/init_config.rst:468 +msgid "``\"show_ref_count\"``" +msgstr "" + +#: c-api/init_config.rst:469 +msgid ":c:member:`show_ref_count `" +msgstr "" + +#: c-api/init_config.rst:472 +msgid "``\"site_import\"``" +msgstr "" + +#: c-api/init_config.rst:473 +msgid ":c:member:`site_import `" +msgstr "" + +#: c-api/init_config.rst:476 +msgid "``\"skip_source_first_line\"``" +msgstr "" + +#: c-api/init_config.rst:477 +msgid ":c:member:`skip_source_first_line `" +msgstr "" + +#: c-api/init_config.rst:480 +msgid "``\"stdio_encoding\"``" +msgstr "" + +#: c-api/init_config.rst:481 +msgid ":c:member:`stdio_encoding `" +msgstr "" + +#: c-api/init_config.rst:484 +msgid "``\"stdio_errors\"``" +msgstr "" + +#: c-api/init_config.rst:485 +msgid ":c:member:`stdio_errors `" +msgstr "" + +#: c-api/init_config.rst:488 +msgid "``\"stdlib_dir\"``" +msgstr "" + +#: c-api/init_config.rst:489 +msgid ":c:member:`stdlib_dir `" +msgstr "" + +#: c-api/init_config.rst:492 +msgid "``\"tracemalloc\"``" +msgstr "" + +#: c-api/init_config.rst:493 +msgid ":c:member:`tracemalloc `" +msgstr "" + +#: c-api/init_config.rst:496 +msgid "``\"use_environment\"``" +msgstr "" + +#: c-api/init_config.rst:497 +msgid ":c:member:`use_environment `" +msgstr "" + +#: c-api/init_config.rst:500 +msgid "``\"use_frozen_modules\"``" +msgstr "" + +#: c-api/init_config.rst:501 +msgid ":c:member:`use_frozen_modules `" +msgstr "" + +#: c-api/init_config.rst:504 +msgid "``\"use_hash_seed\"``" +msgstr "" + +#: c-api/init_config.rst:505 +msgid ":c:member:`use_hash_seed `" +msgstr "" + +#: c-api/init_config.rst:508 +msgid "``\"use_system_logger\"``" +msgstr "" + +#: c-api/init_config.rst:509 +msgid ":c:member:`use_system_logger `" +msgstr "" + +#: c-api/init_config.rst:512 +msgid "``\"user_site_directory\"``" +msgstr "" + +#: c-api/init_config.rst:513 +msgid ":c:member:`user_site_directory `" +msgstr "" + +#: c-api/init_config.rst:516 +msgid "``\"utf8_mode\"``" +msgstr "" + +#: c-api/init_config.rst:517 +msgid ":c:member:`utf8_mode `" +msgstr "" + +#: c-api/init_config.rst:520 +msgid "``\"verbose\"``" +msgstr "" + +#: c-api/init_config.rst:521 +msgid ":c:member:`verbose `" +msgstr "" + +#: c-api/init_config.rst:524 +msgid "``\"warn_default_encoding\"``" +msgstr "" + +#: c-api/init_config.rst:525 +msgid ":c:member:`warn_default_encoding `" +msgstr "" + +#: c-api/init_config.rst:528 +msgid "``\"warnoptions\"``" +msgstr "" + +#: c-api/init_config.rst:529 +msgid ":c:member:`warnoptions `" +msgstr "" + +#: c-api/init_config.rst:532 +msgid "``\"write_bytecode\"``" +msgstr "" + +#: c-api/init_config.rst:533 +msgid ":c:member:`write_bytecode `" +msgstr "" + +#: c-api/init_config.rst:536 +msgid "``\"xoptions\"``" +msgstr "" + +#: c-api/init_config.rst:537 +msgid ":c:member:`xoptions `" +msgstr "" + +#: c-api/init_config.rst:579 +msgid "``dict[str, str]``" +msgstr "" + +#: c-api/init_config.rst:540 +msgid "``\"_pystats\"``" +msgstr "" + +#: c-api/init_config.rst:541 +msgid ":c:member:`_pystats `" +msgstr "" + +#: c-api/init_config.rst:545 +msgid "Visibility:" +msgstr "" + +#: c-api/init_config.rst:547 +msgid "" +"Public: Can by get by :c:func:`PyConfig_Get` and set by :c:func:" +"`PyConfig_Set`." +msgstr "" + +#: c-api/init_config.rst:549 +msgid "" +"Read-only: Can by get by :c:func:`PyConfig_Get`, but cannot be set by :c:" +"func:`PyConfig_Set`." +msgstr "" + +#: c-api/init_config.rst:554 +msgid "Runtime Python configuration API" +msgstr "" + +#: c-api/init_config.rst:556 +msgid "" +"At runtime, it's possible to get and set configuration options using :c:func:" +"`PyConfig_Get` and :c:func:`PyConfig_Set` functions." +msgstr "" + +#: c-api/init_config.rst:562 +msgid "" +"Some options are read from the :mod:`sys` attributes. For example, the " +"option ``\"argv\"`` is read from :data:`sys.argv`." +msgstr "" + +#: c-api/init_config.rst:568 +msgid "" +"Get the current runtime value of a configuration option as a Python object." +msgstr "" + +#: c-api/init_config.rst:601 +msgid "Return a new reference on success." +msgstr "" + +#: c-api/init_config.rst:602 +msgid "Set an exception and return ``NULL`` on error." +msgstr "" + +#: c-api/init_config.rst:573 +msgid "The object type depends on the configuration option. It can be:" +msgstr "" + +#: c-api/init_config.rst:604 c-api/init_config.rst:619 +msgid "" +"The caller must have an :term:`attached thread state`. The function cannot " +"be called before Python initialization nor after Python finalization." +msgstr "" + +#: c-api/init_config.rst:589 +msgid "Similar to :c:func:`PyConfig_Get`, but get the value as a C int." +msgstr "" + +#: c-api/init_config.rst:592 +msgid "Set an exception and return ``-1`` on error." +msgstr "" + +#: c-api/init_config.rst:599 +msgid "Get all configuration option names as a ``frozenset``." +msgstr "" + +#: c-api/init_config.rst:612 +msgid "Set the current runtime value of a configuration option." +msgstr "" + +#: c-api/init_config.rst:614 +msgid "Raise a :exc:`ValueError` if there is no option *name*." +msgstr "" + +#: c-api/init_config.rst:615 +msgid "Raise a :exc:`ValueError` if *value* is an invalid value." +msgstr "" + +#: c-api/init_config.rst:616 +msgid "Raise a :exc:`ValueError` if the option is read-only (cannot be set)." +msgstr "" + +#: c-api/init_config.rst:617 +msgid "Raise a :exc:`TypeError` if *value* has not the proper type." +msgstr "" + +#: c-api/init_config.rst:622 +msgid "" +"Raises an :ref:`auditing event ` ``cpython.PyConfig_Set`` with " +"arguments ``name``, ``value``." +msgstr "" + +#: c-api/init_config.rst:630 +msgid "PyConfig C API" +msgstr "" + +#: c-api/init_config.rst:634 msgid "" "Python can be initialized with :c:func:`Py_InitializeFromConfig` and the :c:" "type:`PyConfig` structure. It can be preinitialized with :c:func:" "`Py_PreInitialize` and the :c:type:`PyPreConfig` structure." msgstr "" -#: c-api/init_config.rst:15 +#: c-api/init_config.rst:638 msgid "There are two kinds of configuration:" msgstr "" -#: c-api/init_config.rst:17 +#: c-api/init_config.rst:640 msgid "" "The :ref:`Python Configuration ` can be used to build a " "customized Python which behaves as the regular Python. For example, " @@ -39,7 +1068,7 @@ msgid "" "Python." msgstr "" -#: c-api/init_config.rst:22 +#: c-api/init_config.rst:645 msgid "" "The :ref:`Isolated Configuration ` can be used to embed " "Python into an application. It isolates Python from the system. For example, " @@ -47,337 +1076,400 @@ msgid "" "no signal handler is registered." msgstr "" -#: c-api/init_config.rst:27 -msgid "" -"The :c:func:`Py_RunMain` function can be used to write a customized Python " -"program." -msgstr "" - -#: c-api/init_config.rst:30 -msgid "" -"See also :ref:`Initialization, Finalization, and Threads `." -msgstr "" - -#: c-api/init_config.rst:33 +#: c-api/init_config.rst:656 msgid ":pep:`587` \"Python Initialization Configuration\"." msgstr "" -#: c-api/init_config.rst:37 -msgid "Example" +#: c-api/init_config.rst:662 +msgid "Example of customized Python always running in isolated mode::" msgstr "" -#: c-api/init_config.rst:39 -msgid "Example of customized Python always running in isolated mode::" +#: c-api/init_config.rst:664 +msgid "" +"int main(int argc, char **argv)\n" +"{\n" +" PyStatus status;\n" +"\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +" config.isolated = 1;\n" +"\n" +" /* Decode command line arguments.\n" +" Implicitly preinitialize Python (in isolated mode). */\n" +" status = PyConfig_SetBytesArgv(&config, argc, argv);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" +" return Py_RunMain();\n" +"\n" +"exception:\n" +" PyConfig_Clear(&config);\n" +" if (PyStatus_IsExit(status)) {\n" +" return status.exitcode;\n" +" }\n" +" /* Display the error message and exit the process with\n" +" non-zero exit code */\n" +" Py_ExitStatusException(status);\n" +"}" msgstr "" -#: c-api/init_config.rst:76 +#: c-api/init_config.rst:699 msgid "PyWideStringList" msgstr "" -#: c-api/init_config.rst:80 +#: c-api/init_config.rst:703 msgid "List of ``wchar_t*`` strings." msgstr "" -#: c-api/init_config.rst:82 +#: c-api/init_config.rst:705 msgid "" "If *length* is non-zero, *items* must be non-``NULL`` and all strings must " "be non-``NULL``." msgstr "" -#: c-api/init_config.rst:87 +#: c-api/init_config.rst:710 msgid "Methods:" msgstr "" -#: c-api/init_config.rst:91 +#: c-api/init_config.rst:714 msgid "Append *item* to *list*." msgstr "" -#: c-api/init_config.rst:104 +#: c-api/init_config.rst:727 msgid "Python must be preinitialized to call this function." msgstr "" -#: c-api/init_config.rst:97 +#: c-api/init_config.rst:720 msgid "Insert *item* into *list* at *index*." msgstr "" -#: c-api/init_config.rst:99 +#: c-api/init_config.rst:722 msgid "" "If *index* is greater than or equal to *list* length, append *item* to " "*list*." msgstr "" -#: c-api/init_config.rst:102 +#: c-api/init_config.rst:725 msgid "*index* must be greater than or equal to ``0``." msgstr "" -#: c-api/init_config.rst:128 c-api/init_config.rst:544 +#: c-api/init_config.rst:751 c-api/init_config.rst:1177 msgid "Structure fields:" msgstr "" -#: c-api/init_config.rst:112 +#: c-api/init_config.rst:735 msgid "List length." msgstr "" -#: c-api/init_config.rst:116 +#: c-api/init_config.rst:739 msgid "List items." msgstr "" -#: c-api/init_config.rst:119 +#: c-api/init_config.rst:742 msgid "PyStatus" msgstr "" -#: c-api/init_config.rst:123 +#: c-api/init_config.rst:746 msgid "" "Structure to store an initialization function status: success, error or exit." msgstr "" -#: c-api/init_config.rst:126 +#: c-api/init_config.rst:749 msgid "For an error, it can store the C function name which created the error." msgstr "" -#: c-api/init_config.rst:132 +#: c-api/init_config.rst:755 msgid "Exit code. Argument passed to ``exit()``." msgstr "" -#: c-api/init_config.rst:136 +#: c-api/init_config.rst:759 msgid "Error message." msgstr "" -#: c-api/init_config.rst:140 +#: c-api/init_config.rst:763 msgid "Name of the function which created an error, can be ``NULL``." msgstr "" -#: c-api/init_config.rst:144 +#: c-api/init_config.rst:767 msgid "Functions to create a status:" msgstr "" -#: c-api/init_config.rst:148 +#: c-api/init_config.rst:771 msgid "Success." msgstr "" -#: c-api/init_config.rst:152 +#: c-api/init_config.rst:775 msgid "Initialization error with a message." msgstr "" -#: c-api/init_config.rst:154 +#: c-api/init_config.rst:777 msgid "*err_msg* must not be ``NULL``." msgstr "" -#: c-api/init_config.rst:158 +#: c-api/init_config.rst:781 msgid "Memory allocation failure (out of memory)." msgstr "" -#: c-api/init_config.rst:162 +#: c-api/init_config.rst:785 msgid "Exit Python with the specified exit code." msgstr "" -#: c-api/init_config.rst:164 +#: c-api/init_config.rst:787 msgid "Functions to handle a status:" msgstr "" -#: c-api/init_config.rst:168 +#: c-api/init_config.rst:791 msgid "" "Is the status an error or an exit? If true, the exception must be handled; " "by calling :c:func:`Py_ExitStatusException` for example." msgstr "" -#: c-api/init_config.rst:173 +#: c-api/init_config.rst:796 msgid "Is the result an error?" msgstr "" -#: c-api/init_config.rst:177 +#: c-api/init_config.rst:800 msgid "Is the result an exit?" msgstr "" -#: c-api/init_config.rst:181 +#: c-api/init_config.rst:804 msgid "" "Call ``exit(exitcode)`` if *status* is an exit. Print the error message and " "exit with a non-zero exit code if *status* is an error. Must only be called " "if ``PyStatus_Exception(status)`` is non-zero." msgstr "" -#: c-api/init_config.rst:186 +#: c-api/init_config.rst:809 msgid "" "Internally, Python uses macros which set ``PyStatus.func``, whereas " "functions to create a status set ``func`` to ``NULL``." msgstr "" -#: c-api/init_config.rst:189 +#: c-api/init_config.rst:812 msgid "Example::" msgstr "" -#: c-api/init_config.rst:213 +#: c-api/init_config.rst:814 +msgid "" +"PyStatus alloc(void **ptr, size_t size)\n" +"{\n" +" *ptr = PyMem_RawMalloc(size);\n" +" if (*ptr == NULL) {\n" +" return PyStatus_NoMemory();\n" +" }\n" +" return PyStatus_Ok();\n" +"}\n" +"\n" +"int main(int argc, char **argv)\n" +"{\n" +" void *ptr;\n" +" PyStatus status = alloc(&ptr, 16);\n" +" if (PyStatus_Exception(status)) {\n" +" Py_ExitStatusException(status);\n" +" }\n" +" PyMem_Free(ptr);\n" +" return 0;\n" +"}" +msgstr "" + +#: c-api/init_config.rst:836 msgid "PyPreConfig" msgstr "" -#: c-api/init_config.rst:217 +#: c-api/init_config.rst:840 msgid "Structure used to preinitialize Python." msgstr "" -#: c-api/init_config.rst:221 +#: c-api/init_config.rst:844 msgid "Function to initialize a preconfiguration:" msgstr "" -#: c-api/init_config.rst:225 +#: c-api/init_config.rst:848 msgid "" "Initialize the preconfiguration with :ref:`Python Configuration `." msgstr "" -#: c-api/init_config.rst:230 +#: c-api/init_config.rst:853 msgid "" "Initialize the preconfiguration with :ref:`Isolated Configuration `." msgstr "" -#: c-api/init_config.rst:239 +#: c-api/init_config.rst:862 msgid "Name of the Python memory allocators:" msgstr "" -#: c-api/init_config.rst:241 +#: c-api/init_config.rst:864 msgid "" "``PYMEM_ALLOCATOR_NOT_SET`` (``0``): don't change memory allocators (use " "defaults)." msgstr "" -#: c-api/init_config.rst:243 +#: c-api/init_config.rst:866 msgid "" "``PYMEM_ALLOCATOR_DEFAULT`` (``1``): :ref:`default memory allocators " "`." msgstr "" -#: c-api/init_config.rst:245 +#: c-api/init_config.rst:868 msgid "" "``PYMEM_ALLOCATOR_DEBUG`` (``2``): :ref:`default memory allocators ` with :ref:`debug hooks `." msgstr "" -#: c-api/init_config.rst:248 +#: c-api/init_config.rst:871 msgid "``PYMEM_ALLOCATOR_MALLOC`` (``3``): use ``malloc()`` of the C library." msgstr "" -#: c-api/init_config.rst:249 +#: c-api/init_config.rst:872 msgid "" "``PYMEM_ALLOCATOR_MALLOC_DEBUG`` (``4``): force usage of ``malloc()`` with :" "ref:`debug hooks `." msgstr "" -#: c-api/init_config.rst:251 +#: c-api/init_config.rst:874 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC`` (``5``): :ref:`Python pymalloc memory allocator " "`." msgstr "" -#: c-api/init_config.rst:253 +#: c-api/init_config.rst:876 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` (``6``): :ref:`Python pymalloc memory " "allocator ` with :ref:`debug hooks `." msgstr "" -#: c-api/init_config.rst:257 +#: c-api/init_config.rst:879 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC`` (``6``): use ``mimalloc``, a fast malloc " +"replacement." +msgstr "" + +#: c-api/init_config.rst:881 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` (``7``): use ``mimalloc``, a fast malloc " +"replacement with :ref:`debug hooks `." +msgstr "" + +#: c-api/init_config.rst:885 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` are not " "supported if Python is :option:`configured using --without-pymalloc <--" "without-pymalloc>`." msgstr "" -#: c-api/init_config.rst:261 +#: c-api/init_config.rst:889 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC`` and ``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` are not " +"supported if Python is :option:`configured using --without-mimalloc <--" +"without-mimalloc>` or if the underlying atomic support isn't available." +msgstr "" + +#: c-api/init_config.rst:894 msgid "See :ref:`Memory Management `." msgstr "" -#: c-api/init_config.rst:263 +#: c-api/init_config.rst:896 msgid "Default: ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" -#: c-api/init_config.rst:267 +#: c-api/init_config.rst:900 msgid "Set the LC_CTYPE locale to the user preferred locale." msgstr "" -#: c-api/init_config.rst:269 +#: c-api/init_config.rst:902 msgid "" "If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and :c:" "member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." msgstr "" -#: c-api/init_config.rst:283 +#: c-api/init_config.rst:916 msgid "See the :term:`locale encoding`." msgstr "" -#: c-api/init_config.rst:329 c-api/init_config.rst:684 +#: c-api/init_config.rst:962 c-api/init_config.rst:1333 msgid "Default: ``1`` in Python config, ``0`` in isolated config." msgstr "" -#: c-api/init_config.rst:278 +#: c-api/init_config.rst:911 msgid "If equals to ``2``, coerce the C locale." msgstr "" -#: c-api/init_config.rst:280 +#: c-api/init_config.rst:913 msgid "" "If equals to ``1``, read the LC_CTYPE locale to decide if it should be " "coerced." msgstr "" -#: c-api/init_config.rst:291 +#: c-api/init_config.rst:924 msgid "Default: ``-1`` in Python config, ``0`` in isolated config." msgstr "" -#: c-api/init_config.rst:289 +#: c-api/init_config.rst:922 msgid "If non-zero, emit a warning if the C locale is coerced." msgstr "" -#: c-api/init_config.rst:295 +#: c-api/init_config.rst:928 msgid "" ":ref:`Python Development Mode `: see :c:member:`PyConfig.dev_mode`." msgstr "" -#: c-api/init_config.rst:693 c-api/init_config.rst:1188 +#: c-api/init_config.rst:1342 c-api/init_config.rst:1892 msgid "Default: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: c-api/init_config.rst:302 +#: c-api/init_config.rst:935 msgid "Isolated mode: see :c:member:`PyConfig.isolated`." msgstr "" -#: c-api/init_config.rst:880 +#: c-api/init_config.rst:1569 msgid "Default: ``0`` in Python mode, ``1`` in isolated mode." msgstr "" -#: c-api/init_config.rst:308 +#: c-api/init_config.rst:941 msgid "If non-zero:" msgstr "" -#: c-api/init_config.rst:310 +#: c-api/init_config.rst:943 msgid "Set :c:member:`PyPreConfig.utf8_mode` to ``0``," msgstr "" -#: c-api/init_config.rst:311 +#: c-api/init_config.rst:944 msgid "Set :c:member:`PyConfig.filesystem_encoding` to ``\"mbcs\"``," msgstr "" -#: c-api/init_config.rst:312 +#: c-api/init_config.rst:945 msgid "Set :c:member:`PyConfig.filesystem_errors` to ``\"replace\"``." msgstr "" -#: c-api/init_config.rst:314 +#: c-api/init_config.rst:947 msgid "" -"Initialized the from :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " +"Initialized from the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable value." msgstr "" -#: c-api/init_config.rst:894 +#: c-api/init_config.rst:1583 msgid "" "Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for " "Windows specific code." msgstr "" -#: c-api/init_config.rst:632 c-api/init_config.rst:706 -#: c-api/init_config.rst:829 c-api/init_config.rst:897 -#: c-api/init_config.rst:971 c-api/init_config.rst:1083 -#: c-api/init_config.rst:1152 c-api/init_config.rst:1239 +#: c-api/init_config.rst:1281 c-api/init_config.rst:1355 +#: c-api/init_config.rst:1505 c-api/init_config.rst:1586 +#: c-api/init_config.rst:1660 c-api/init_config.rst:1774 +#: c-api/init_config.rst:1857 c-api/init_config.rst:2018 msgid "Default: ``0``." msgstr "" -#: c-api/init_config.rst:324 +#: c-api/init_config.rst:957 msgid "" "If non-zero, :c:func:`Py_PreInitializeFromArgs` and :c:func:" "`Py_PreInitializeFromBytesArgs` parse their ``argv`` argument the same way " @@ -385,93 +1477,93 @@ msgid "" "Arguments `." msgstr "" -#: c-api/init_config.rst:333 +#: c-api/init_config.rst:966 msgid "" "Use :ref:`environment variables `? See :c:member:`PyConfig." "use_environment`." msgstr "" -#: c-api/init_config.rst:1213 +#: c-api/init_config.rst:1933 msgid "Default: ``1`` in Python config and ``0`` in isolated config." msgstr "" -#: c-api/init_config.rst:340 +#: c-api/init_config.rst:973 msgid "If non-zero, enable the :ref:`Python UTF-8 Mode `." msgstr "" -#: c-api/init_config.rst:342 +#: c-api/init_config.rst:975 msgid "" "Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option and " "the :envvar:`PYTHONUTF8` environment variable." msgstr "" -#: c-api/init_config.rst:345 +#: c-api/init_config.rst:978 msgid "Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``." msgstr "" -#: c-api/init_config.rst:347 +#: c-api/init_config.rst:980 msgid "Default: ``-1`` in Python config and ``0`` in isolated config." msgstr "" -#: c-api/init_config.rst:353 +#: c-api/init_config.rst:986 msgid "Preinitialize Python with PyPreConfig" msgstr "" -#: c-api/init_config.rst:355 +#: c-api/init_config.rst:988 msgid "The preinitialization of Python:" msgstr "" -#: c-api/init_config.rst:357 +#: c-api/init_config.rst:990 msgid "Set the Python memory allocators (:c:member:`PyPreConfig.allocator`)" msgstr "" -#: c-api/init_config.rst:358 +#: c-api/init_config.rst:991 msgid "Configure the LC_CTYPE locale (:term:`locale encoding`)" msgstr "" -#: c-api/init_config.rst:359 +#: c-api/init_config.rst:992 msgid "" "Set the :ref:`Python UTF-8 Mode ` (:c:member:`PyPreConfig." "utf8_mode`)" msgstr "" -#: c-api/init_config.rst:362 +#: c-api/init_config.rst:995 msgid "" "The current preconfiguration (``PyPreConfig`` type) is stored in " "``_PyRuntime.preconfig``." msgstr "" -#: c-api/init_config.rst:365 +#: c-api/init_config.rst:998 msgid "Functions to preinitialize Python:" msgstr "" -#: c-api/init_config.rst:375 c-api/init_config.rst:384 +#: c-api/init_config.rst:1008 c-api/init_config.rst:1017 msgid "Preinitialize Python from *preconfig* preconfiguration." msgstr "" -#: c-api/init_config.rst:380 c-api/init_config.rst:389 +#: c-api/init_config.rst:1013 c-api/init_config.rst:1022 msgid "*preconfig* must not be ``NULL``." msgstr "" -#: c-api/init_config.rst:377 +#: c-api/init_config.rst:1010 msgid "" "Parse *argv* command line arguments (bytes strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: c-api/init_config.rst:386 +#: c-api/init_config.rst:1019 msgid "" "Parse *argv* command line arguments (wide strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: c-api/init_config.rst:1301 +#: c-api/init_config.rst:2041 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." msgstr "" -#: c-api/init_config.rst:394 +#: c-api/init_config.rst:1027 msgid "" "For :ref:`Python Configuration ` (:c:func:" "`PyPreConfig_InitPythonConfig`), if Python is initialized with command line " @@ -481,7 +1573,7 @@ msgid "" "`Python UTF-8 Mode `." msgstr "" -#: c-api/init_config.rst:401 +#: c-api/init_config.rst:1034 msgid "" "``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and " "before :c:func:`Py_InitializeFromConfig` to install a custom memory " @@ -489,7 +1581,7 @@ msgid "" "`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" -#: c-api/init_config.rst:406 +#: c-api/init_config.rst:1039 msgid "" "Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not " "be used before the Python preinitialization, whereas calling directly " @@ -497,116 +1589,136 @@ msgid "" "not be called before the Python preinitialization." msgstr "" -#: c-api/init_config.rst:411 +#: c-api/init_config.rst:1044 msgid "" "Example using the preinitialization to enable the :ref:`Python UTF-8 Mode " "`::" msgstr "" -#: c-api/init_config.rst:433 +#: c-api/init_config.rst:1047 +msgid "" +"PyStatus status;\n" +"PyPreConfig preconfig;\n" +"PyPreConfig_InitPythonConfig(&preconfig);\n" +"\n" +"preconfig.utf8_mode = 1;\n" +"\n" +"status = Py_PreInitialize(&preconfig);\n" +"if (PyStatus_Exception(status)) {\n" +" Py_ExitStatusException(status);\n" +"}\n" +"\n" +"/* at this point, Python speaks UTF-8 */\n" +"\n" +"Py_Initialize();\n" +"/* ... use Python API here ... */\n" +"Py_Finalize();" +msgstr "" + +#: c-api/init_config.rst:1066 msgid "PyConfig" msgstr "" -#: c-api/init_config.rst:437 +#: c-api/init_config.rst:1070 msgid "Structure containing most parameters to configure Python." msgstr "" -#: c-api/init_config.rst:439 +#: c-api/init_config.rst:1072 msgid "" "When done, the :c:func:`PyConfig_Clear` function must be used to release the " "configuration memory." msgstr "" -#: c-api/init_config.rst:444 +#: c-api/init_config.rst:1077 msgid "Structure methods:" msgstr "" -#: c-api/init_config.rst:448 +#: c-api/init_config.rst:1081 msgid "" "Initialize configuration with the :ref:`Python Configuration `." msgstr "" -#: c-api/init_config.rst:453 +#: c-api/init_config.rst:1086 msgid "" "Initialize configuration with the :ref:`Isolated Configuration `." msgstr "" -#: c-api/init_config.rst:458 +#: c-api/init_config.rst:1091 msgid "Copy the wide character string *str* into ``*config_str``." msgstr "" -#: c-api/init_config.rst:467 c-api/init_config.rst:482 -#: c-api/init_config.rst:505 +#: c-api/init_config.rst:1100 c-api/init_config.rst:1115 +#: c-api/init_config.rst:1138 msgid ":ref:`Preinitialize Python ` if needed." msgstr "" -#: c-api/init_config.rst:464 +#: c-api/init_config.rst:1097 msgid "" "Decode *str* using :c:func:`Py_DecodeLocale` and set the result into " "``*config_str``." msgstr "" -#: c-api/init_config.rst:471 +#: c-api/init_config.rst:1104 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of wide character strings." msgstr "" -#: c-api/init_config.rst:478 +#: c-api/init_config.rst:1111 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of bytes strings. Decode bytes using :c:func:" "`Py_DecodeLocale`." msgstr "" -#: c-api/init_config.rst:486 +#: c-api/init_config.rst:1119 msgid "Set the list of wide strings *list* to *length* and *items*." msgstr "" -#: c-api/init_config.rst:492 +#: c-api/init_config.rst:1125 msgid "Read all Python configuration." msgstr "" -#: c-api/init_config.rst:494 +#: c-api/init_config.rst:1127 msgid "Fields which are already initialized are left unchanged." msgstr "" -#: c-api/init_config.rst:496 +#: c-api/init_config.rst:1129 msgid "" "Fields for :ref:`path configuration ` are no longer " "calculated or modified when calling this function, as of Python 3.11." msgstr "" -#: c-api/init_config.rst:1000 +#: c-api/init_config.rst:1689 msgid "" "The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` " "arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after " -"arguments are parsed. Since Python arguments are strippped from :c:member:" +"arguments are parsed. Since Python arguments are stripped from :c:member:" "`PyConfig.argv`, parsing arguments twice would parse the application options " "as Python options." msgstr "" -#: c-api/init_config.rst:507 +#: c-api/init_config.rst:1140 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed once, :c:member:" "`PyConfig.parse_argv` is set to ``2`` after arguments are parsed, and " "arguments are only parsed if :c:member:`PyConfig.parse_argv` equals ``1``." msgstr "" -#: c-api/init_config.rst:513 +#: c-api/init_config.rst:1146 msgid "" ":c:func:`PyConfig_Read` no longer calculates all paths, and so fields listed " "under :ref:`Python Path Configuration ` may no longer be " "updated until :c:func:`Py_InitializeFromConfig` is called." msgstr "" -#: c-api/init_config.rst:521 +#: c-api/init_config.rst:1154 msgid "Release configuration memory." msgstr "" -#: c-api/init_config.rst:523 +#: c-api/init_config.rst:1156 msgid "" "Most ``PyConfig`` methods :ref:`preinitialize Python ` if needed. " "In that case, the Python preinitialization configuration (:c:type:" @@ -615,23 +1727,23 @@ msgid "" "before calling a :c:type:`PyConfig` method:" msgstr "" -#: c-api/init_config.rst:529 +#: c-api/init_config.rst:1162 msgid ":c:member:`PyConfig.dev_mode`" msgstr "" -#: c-api/init_config.rst:530 +#: c-api/init_config.rst:1163 msgid ":c:member:`PyConfig.isolated`" msgstr "" -#: c-api/init_config.rst:531 +#: c-api/init_config.rst:1164 msgid ":c:member:`PyConfig.parse_argv`" msgstr "" -#: c-api/init_config.rst:532 +#: c-api/init_config.rst:1165 msgid ":c:member:`PyConfig.use_environment`" msgstr "" -#: c-api/init_config.rst:534 +#: c-api/init_config.rst:1167 msgid "" "Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv` " "is used, this method must be called before other methods, since the " @@ -639,405 +1751,456 @@ msgid "" "member:`~PyConfig.parse_argv` is non-zero)." msgstr "" -#: c-api/init_config.rst:539 +#: c-api/init_config.rst:1172 msgid "" "The caller of these methods is responsible to handle exceptions (error or " "exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``." msgstr "" -#: c-api/init_config.rst:548 -msgid "Command line arguments: :data:`sys.argv`." +#: c-api/init_config.rst:1185 +msgid "" +"Set :data:`sys.argv` command line arguments based on :c:member:`~PyConfig." +"argv`. These parameters are similar to those passed to the program's :c:" +"func:`main` function with the difference that the first entry should refer " +"to the script file to be executed rather than the executable hosting the " +"Python interpreter. If there isn't a script that will be run, the first " +"entry in :c:member:`~PyConfig.argv` can be an empty string." msgstr "" -#: c-api/init_config.rst:550 +#: c-api/init_config.rst:1193 msgid "" "Set :c:member:`~PyConfig.parse_argv` to ``1`` to parse :c:member:`~PyConfig." "argv` the same way the regular Python parses Python command line arguments " "and then to strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: c-api/init_config.rst:555 +#: c-api/init_config.rst:1198 msgid "" "If :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure " "that :data:`sys.argv` always exists and is never empty." msgstr "" -#: c-api/init_config.rst:585 c-api/init_config.rst:605 -#: c-api/init_config.rst:722 c-api/init_config.rst:941 -#: c-api/init_config.rst:1060 c-api/init_config.rst:1091 -#: c-api/init_config.rst:1112 +#: c-api/init_config.rst:1228 c-api/init_config.rst:1252 +#: c-api/init_config.rst:1372 c-api/init_config.rst:1474 +#: c-api/init_config.rst:1731 c-api/init_config.rst:1765 +#: c-api/init_config.rst:1795 c-api/init_config.rst:1817 +#: c-api/init_config.rst:1920 msgid "Default: ``NULL``." msgstr "" -#: c-api/init_config.rst:560 +#: c-api/init_config.rst:1203 msgid "See also the :c:member:`~PyConfig.orig_argv` member." msgstr "" -#: c-api/init_config.rst:564 +#: c-api/init_config.rst:1207 msgid "" "If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to :" "data:`sys.path` at startup:" msgstr "" -#: c-api/init_config.rst:567 +#: c-api/init_config.rst:1210 msgid "" "If :c:member:`argv[0] ` is equal to ``L\"-m\"`` (``python -m " "module``), prepend the current working directory." msgstr "" -#: c-api/init_config.rst:569 +#: c-api/init_config.rst:1212 msgid "" "If running a script (``python script.py``), prepend the script's directory. " "If it's a symbolic link, resolve symbolic links." msgstr "" -#: c-api/init_config.rst:571 +#: c-api/init_config.rst:1214 msgid "" "Otherwise (``python -c code`` and ``python``), prepend an empty string, " "which means the current working directory." msgstr "" -#: c-api/init_config.rst:574 +#: c-api/init_config.rst:1217 msgid "" "Set to ``1`` by the :option:`-P` command line option and the :envvar:" "`PYTHONSAFEPATH` environment variable." msgstr "" -#: c-api/init_config.rst:577 +#: c-api/init_config.rst:1220 msgid "Default: ``0`` in Python config, ``1`` in isolated config." msgstr "" -#: c-api/init_config.rst:583 +#: c-api/init_config.rst:1226 msgid ":data:`sys.base_exec_prefix`." msgstr "" -#: c-api/init_config.rst:599 c-api/init_config.rst:715 -#: c-api/init_config.rst:958 c-api/init_config.rst:1044 +#: c-api/init_config.rst:1244 c-api/init_config.rst:1374 +#: c-api/init_config.rst:1647 c-api/init_config.rst:1733 msgid "Part of the :ref:`Python Path Configuration ` output." msgstr "" -#: c-api/init_config.rst:591 +#: c-api/init_config.rst:1232 +msgid "See also :c:member:`PyConfig.exec_prefix`." +msgstr "" + +#: c-api/init_config.rst:1236 msgid "Python base executable: :data:`sys._base_executable`." msgstr "" -#: c-api/init_config.rst:593 +#: c-api/init_config.rst:1238 msgid "Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable." msgstr "" -#: c-api/init_config.rst:595 +#: c-api/init_config.rst:1240 msgid "Set from :c:member:`PyConfig.executable` if ``NULL``." msgstr "" -#: c-api/init_config.rst:603 +#: c-api/init_config.rst:1246 +msgid "See also :c:member:`PyConfig.executable`." +msgstr "" + +#: c-api/init_config.rst:1250 msgid ":data:`sys.base_prefix`." msgstr "" -#: c-api/init_config.rst:611 +#: c-api/init_config.rst:1256 +msgid "See also :c:member:`PyConfig.prefix`." +msgstr "" + +#: c-api/init_config.rst:1260 msgid "" "If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero, " "disable buffering on the C streams stdout and stderr." msgstr "" -#: c-api/init_config.rst:614 +#: c-api/init_config.rst:1263 msgid "" "Set to ``0`` by the :option:`-u` command line option and the :envvar:" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: c-api/init_config.rst:617 +#: c-api/init_config.rst:1266 msgid "stdin is always opened in buffered mode." msgstr "" -#: c-api/init_config.rst:652 c-api/init_config.rst:1271 +#: c-api/init_config.rst:1301 c-api/init_config.rst:2003 msgid "Default: ``1``." msgstr "" -#: c-api/init_config.rst:623 +#: c-api/init_config.rst:1272 msgid "" "If equals to ``1``, issue a warning when comparing :class:`bytes` or :class:" "`bytearray` with :class:`str`, or comparing :class:`bytes` with :class:`int`." msgstr "" -#: c-api/init_config.rst:627 +#: c-api/init_config.rst:1276 msgid "" "If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these " "cases." msgstr "" -#: c-api/init_config.rst:630 +#: c-api/init_config.rst:1279 msgid "Incremented by the :option:`-b` command line option." msgstr "" -#: c-api/init_config.rst:636 +#: c-api/init_config.rst:1285 msgid "" "If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io." "TextIOWrapper` uses its default encoding. See :ref:`io-encoding-warning` for " "details." msgstr "" -#: c-api/init_config.rst:645 +#: c-api/init_config.rst:1294 msgid "" "If equals to ``0``, disables the inclusion of the end line and column " "mappings in code objects. Also disables traceback printing carets to " "specific error locations." msgstr "" -#: c-api/init_config.rst:649 +#: c-api/init_config.rst:1298 msgid "" "Set to ``0`` by the :envvar:`PYTHONNODEBUGRANGES` environment variable and " "by the :option:`-X no_debug_ranges <-X>` command line option." msgstr "" -#: c-api/init_config.rst:658 +#: c-api/init_config.rst:1307 msgid "" "Control the validation behavior of hash-based ``.pyc`` files: value of the :" "option:`--check-hash-based-pycs` command line option." msgstr "" -#: c-api/init_config.rst:661 +#: c-api/init_config.rst:1310 msgid "Valid values:" msgstr "" -#: c-api/init_config.rst:663 +#: c-api/init_config.rst:1312 msgid "" "``L\"always\"``: Hash the source file for invalidation regardless of value " "of the 'check_source' flag." msgstr "" -#: c-api/init_config.rst:665 +#: c-api/init_config.rst:1314 msgid "``L\"never\"``: Assume that hash-based pycs always are valid." msgstr "" -#: c-api/init_config.rst:666 +#: c-api/init_config.rst:1315 msgid "" "``L\"default\"``: The 'check_source' flag in hash-based pycs determines " "invalidation." msgstr "" -#: c-api/init_config.rst:669 +#: c-api/init_config.rst:1318 msgid "Default: ``L\"default\"``." msgstr "" -#: c-api/init_config.rst:671 +#: c-api/init_config.rst:1320 msgid "See also :pep:`552` \"Deterministic pycs\"." msgstr "" -#: c-api/init_config.rst:675 +#: c-api/init_config.rst:1324 msgid "If non-zero, configure C standard streams:" msgstr "" -#: c-api/init_config.rst:677 +#: c-api/init_config.rst:1326 msgid "" "On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and stderr." msgstr "" -#: c-api/init_config.rst:679 +#: c-api/init_config.rst:1328 msgid "" "If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering of " "stdin, stdout and stderr streams." msgstr "" -#: c-api/init_config.rst:681 +#: c-api/init_config.rst:1330 msgid "" "If :c:member:`~PyConfig.interactive` is non-zero, enable stream buffering on " "stdin and stdout (only stdout on Windows)." msgstr "" -#: c-api/init_config.rst:688 +#: c-api/init_config.rst:1337 msgid "If non-zero, enable the :ref:`Python Development Mode `." msgstr "" -#: c-api/init_config.rst:690 +#: c-api/init_config.rst:1339 msgid "" "Set to ``1`` by the :option:`-X dev <-X>` option and the :envvar:" "`PYTHONDEVMODE` environment variable." msgstr "" -#: c-api/init_config.rst:697 +#: c-api/init_config.rst:1346 msgid "Dump Python references?" msgstr "" -#: c-api/init_config.rst:699 +#: c-api/init_config.rst:1348 msgid "If non-zero, dump all objects which are still alive at exit." msgstr "" -#: c-api/init_config.rst:701 +#: c-api/init_config.rst:1350 msgid "Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable." msgstr "" -#: c-api/init_config.rst:703 +#: c-api/init_config.rst:1352 msgid "" -"Need a special build of Python with the ``Py_TRACE_REFS`` macro defined: see " -"the :option:`configure --with-trace-refs option <--with-trace-refs>`." +"Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined: " +"see the :option:`configure --with-trace-refs option <--with-trace-refs>`." msgstr "" -#: c-api/init_config.rst:710 +#: c-api/init_config.rst:1359 +msgid "Filename where to dump Python references." +msgstr "" + +#: c-api/init_config.rst:1361 +msgid "Set by the :envvar:`PYTHONDUMPREFSFILE` environment variable." +msgstr "" + +#: c-api/init_config.rst:1369 msgid "" "The site-specific directory prefix where the platform-dependent Python files " "are installed: :data:`sys.exec_prefix`." msgstr "" -#: c-api/init_config.rst:719 +#: c-api/init_config.rst:1376 +msgid "See also :c:member:`PyConfig.base_exec_prefix`." +msgstr "" + +#: c-api/init_config.rst:1380 msgid "" "The absolute path of the executable binary for the Python interpreter: :data:" "`sys.executable`." msgstr "" -#: c-api/init_config.rst:728 +#: c-api/init_config.rst:1387 +msgid "See also :c:member:`PyConfig.base_executable`." +msgstr "" + +#: c-api/init_config.rst:1391 msgid "Enable faulthandler?" msgstr "" -#: c-api/init_config.rst:730 +#: c-api/init_config.rst:1393 msgid "If non-zero, call :func:`faulthandler.enable` at startup." msgstr "" -#: c-api/init_config.rst:732 +#: c-api/init_config.rst:1395 msgid "" "Set to ``1`` by :option:`-X faulthandler <-X>` and the :envvar:" "`PYTHONFAULTHANDLER` environment variable." msgstr "" -#: c-api/init_config.rst:739 +#: c-api/init_config.rst:1402 msgid "" ":term:`Filesystem encoding `: :func:" "`sys.getfilesystemencoding`." msgstr "" -#: c-api/init_config.rst:742 +#: c-api/init_config.rst:1405 msgid "On macOS, Android and VxWorks: use ``\"utf-8\"`` by default." msgstr "" -#: c-api/init_config.rst:744 +#: c-api/init_config.rst:1407 msgid "" "On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` if :c:member:" "`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is non-" "zero." msgstr "" -#: c-api/init_config.rst:748 +#: c-api/init_config.rst:1411 msgid "Default encoding on other platforms:" msgstr "" -#: c-api/init_config.rst:750 +#: c-api/init_config.rst:1413 msgid "``\"utf-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: c-api/init_config.rst:751 +#: c-api/init_config.rst:1414 msgid "" "``\"ascii\"`` if Python detects that ``nl_langinfo(CODESET)`` announces the " "ASCII encoding, whereas the ``mbstowcs()`` function decodes from a different " "encoding (usually Latin1)." msgstr "" -#: c-api/init_config.rst:754 +#: c-api/init_config.rst:1417 msgid "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string." msgstr "" -#: c-api/init_config.rst:755 +#: c-api/init_config.rst:1418 msgid "" "Otherwise, use the :term:`locale encoding`: ``nl_langinfo(CODESET)`` result." msgstr "" -#: c-api/init_config.rst:758 +#: c-api/init_config.rst:1421 msgid "" "At Python startup, the encoding name is normalized to the Python codec name. " "For example, ``\"ANSI_X3.4-1968\"`` is replaced with ``\"ascii\"``." msgstr "" -#: c-api/init_config.rst:761 +#: c-api/init_config.rst:1424 msgid "See also the :c:member:`~PyConfig.filesystem_errors` member." msgstr "" -#: c-api/init_config.rst:765 +#: c-api/init_config.rst:1428 msgid "" ":term:`Filesystem error handler `: :" "func:`sys.getfilesystemencodeerrors`." msgstr "" -#: c-api/init_config.rst:768 +#: c-api/init_config.rst:1431 msgid "" "On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` if :c:" "member:`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is " "non-zero." msgstr "" -#: c-api/init_config.rst:772 +#: c-api/init_config.rst:1435 msgid "On other platforms: use ``\"surrogateescape\"`` by default." msgstr "" -#: c-api/init_config.rst:774 +#: c-api/init_config.rst:1437 msgid "Supported error handlers:" msgstr "" -#: c-api/init_config.rst:776 +#: c-api/init_config.rst:1439 msgid "``\"strict\"``" msgstr "" -#: c-api/init_config.rst:777 +#: c-api/init_config.rst:1440 msgid "``\"surrogateescape\"``" msgstr "" -#: c-api/init_config.rst:778 +#: c-api/init_config.rst:1441 msgid "``\"surrogatepass\"`` (only supported with the UTF-8 encoding)" msgstr "" -#: c-api/init_config.rst:780 +#: c-api/init_config.rst:1443 msgid "See also the :c:member:`~PyConfig.filesystem_encoding` member." msgstr "" -#: c-api/init_config.rst:785 +#: c-api/init_config.rst:1447 +msgid "If non-zero, use frozen modules." +msgstr "" + +#: c-api/init_config.rst:1449 +msgid "Set by the :envvar:`PYTHON_FROZEN_MODULES` environment variable." +msgstr "" + +#: c-api/init_config.rst:1451 +msgid "" +"Default: ``1`` in a release build, or ``0`` in a :ref:`debug build `." +msgstr "" + +#: c-api/init_config.rst:1457 msgid "Randomized hash function seed." msgstr "" -#: c-api/init_config.rst:787 +#: c-api/init_config.rst:1459 msgid "" "If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly at " "Python startup, and :c:member:`~PyConfig.hash_seed` is ignored." msgstr "" -#: c-api/init_config.rst:790 +#: c-api/init_config.rst:1462 msgid "Set by the :envvar:`PYTHONHASHSEED` environment variable." msgstr "" -#: c-api/init_config.rst:792 +#: c-api/init_config.rst:1464 msgid "" "Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: c-api/init_config.rst:797 -msgid "Python home directory." -msgstr "" - -#: c-api/init_config.rst:799 +#: c-api/init_config.rst:1469 msgid "" -"If :c:func:`Py_SetPythonHome` has been called, use its argument if it is not " -"``NULL``." +"Set the default Python \"home\" directory, that is, the location of the " +"standard Python libraries (see :envvar:`PYTHONHOME`)." msgstr "" -#: c-api/init_config.rst:802 +#: c-api/init_config.rst:1472 msgid "Set by the :envvar:`PYTHONHOME` environment variable." msgstr "" -#: c-api/init_config.rst:923 c-api/init_config.rst:1032 -#: c-api/init_config.rst:1062 +#: c-api/init_config.rst:1612 c-api/init_config.rst:1721 +#: c-api/init_config.rst:1752 msgid "Part of the :ref:`Python Path Configuration ` input." msgstr "" -#: c-api/init_config.rst:810 -msgid "If non-zero, profile import time." +#: c-api/init_config.rst:1480 +msgid "" +"If ``1``, profile import time. If ``2``, include additional output that " +"indicates when an imported module has already been loaded." msgstr "" -#: c-api/init_config.rst:812 +#: c-api/init_config.rst:1484 msgid "" -"Set the ``1`` by the :option:`-X importtime <-X>` option and the :envvar:" +"Set by the :option:`-X importtime <-X>` option and the :envvar:" "`PYTHONPROFILEIMPORTTIME` environment variable." msgstr "" -#: c-api/init_config.rst:819 +#: c-api/init_config.rst:1491 +msgid "Added support for ``import_time = 2``" +msgstr "" + +#: c-api/init_config.rst:1495 msgid "Enter interactive mode after executing a script or a command." msgstr "" -#: c-api/init_config.rst:821 +#: c-api/init_config.rst:1497 msgid "" "If greater than ``0``, enable inspect: when a script is passed as first " "argument or the -c option is used, enter interactive mode after executing " @@ -1045,29 +2208,29 @@ msgid "" "a terminal." msgstr "" -#: c-api/init_config.rst:826 +#: c-api/init_config.rst:1502 msgid "" "Incremented by the :option:`-i` command line option. Set to ``1`` if the :" "envvar:`PYTHONINSPECT` environment variable is non-empty." msgstr "" -#: c-api/init_config.rst:833 +#: c-api/init_config.rst:1509 msgid "Install Python signal handlers?" msgstr "" -#: c-api/init_config.rst:1006 c-api/init_config.rst:1223 +#: c-api/init_config.rst:1695 c-api/init_config.rst:1955 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: c-api/init_config.rst:839 +#: c-api/init_config.rst:1515 msgid "If greater than ``0``, enable the interactive mode (REPL)." msgstr "" -#: c-api/init_config.rst:841 +#: c-api/init_config.rst:1517 msgid "Incremented by the :option:`-i` command line option." msgstr "" -#: c-api/init_config.rst:847 +#: c-api/init_config.rst:1523 msgid "" "Configures the :ref:`integer string conversion length limitation " "`. An initial value of ``-1`` means the value will be " @@ -1077,106 +2240,123 @@ msgid "" "str_digits_check_threshold`) are unsupported and will produce an error." msgstr "" -#: c-api/init_config.rst:855 +#: c-api/init_config.rst:1531 msgid "" "Configured by the :option:`-X int_max_str_digits <-X>` command line flag or " "the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable." msgstr "" -#: c-api/init_config.rst:858 +#: c-api/init_config.rst:1534 msgid "" "Default: ``-1`` in Python mode. 4300 (:data:`sys.int_info." "default_max_str_digits`) in isolated mode." msgstr "" -#: c-api/init_config.rst:865 +#: c-api/init_config.rst:1541 +msgid "" +"If the value of :c:member:`~PyConfig.cpu_count` is not ``-1`` then it will " +"override the return values of :func:`os.cpu_count`, :func:`os." +"process_cpu_count`, and :func:`multiprocessing.cpu_count`." +msgstr "" + +#: c-api/init_config.rst:1545 +msgid "" +"Configured by the :samp:`-X cpu_count={n|default}` command line flag or the :" +"envvar:`PYTHON_CPU_COUNT` environment variable." +msgstr "" + +#: c-api/init_config.rst:1909 +msgid "Default: ``-1``." +msgstr "" + +#: c-api/init_config.rst:1554 msgid "If greater than ``0``, enable isolated mode:" msgstr "" -#: c-api/init_config.rst:867 +#: c-api/init_config.rst:1556 msgid "" "Set :c:member:`~PyConfig.safe_path` to ``1``: don't prepend a potentially " "unsafe path to :data:`sys.path` at Python startup, such as the current " "directory, the script's directory or an empty string." msgstr "" -#: c-api/init_config.rst:871 +#: c-api/init_config.rst:1560 msgid "" "Set :c:member:`~PyConfig.use_environment` to ``0``: ignore ``PYTHON`` " "environment variables." msgstr "" -#: c-api/init_config.rst:873 +#: c-api/init_config.rst:1562 msgid "" "Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user " "site directory to :data:`sys.path`." msgstr "" -#: c-api/init_config.rst:875 +#: c-api/init_config.rst:1564 msgid "" "Python REPL doesn't import :mod:`readline` nor enable default readline " "configuration on interactive prompts." msgstr "" -#: c-api/init_config.rst:878 +#: c-api/init_config.rst:1567 msgid "Set to ``1`` by the :option:`-I` command line option." msgstr "" -#: c-api/init_config.rst:882 +#: c-api/init_config.rst:1571 msgid "" "See also the :ref:`Isolated Configuration ` and :c:" "member:`PyPreConfig.isolated`." msgstr "" -#: c-api/init_config.rst:887 +#: c-api/init_config.rst:1576 msgid "" "If non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." "stderr`." msgstr "" -#: c-api/init_config.rst:891 +#: c-api/init_config.rst:1580 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: c-api/init_config.rst:899 +#: c-api/init_config.rst:1588 msgid "See also the :pep:`528` (Change Windows console encoding to UTF-8)." msgstr "" -#: c-api/init_config.rst:903 +#: c-api/init_config.rst:1592 msgid "" "If non-zero, dump statistics on :ref:`Python pymalloc memory allocator " "` at exit." msgstr "" -#: c-api/init_config.rst:906 +#: c-api/init_config.rst:1595 msgid "Set to ``1`` by the :envvar:`PYTHONMALLOCSTATS` environment variable." msgstr "" -#: c-api/init_config.rst:908 +#: c-api/init_config.rst:1597 msgid "" "The option is ignored if Python is :option:`configured using the --without-" "pymalloc option <--without-pymalloc>`." msgstr "" -#: c-api/init_config.rst:915 +#: c-api/init_config.rst:1604 msgid "Platform library directory name: :data:`sys.platlibdir`." msgstr "" -#: c-api/init_config.rst:917 +#: c-api/init_config.rst:1606 msgid "Set by the :envvar:`PYTHONPLATLIBDIR` environment variable." msgstr "" -#: c-api/init_config.rst:919 +#: c-api/init_config.rst:1608 msgid "" "Default: value of the ``PLATLIBDIR`` macro which is set by the :option:" "`configure --with-platlibdir option <--with-platlibdir>` (default: " "``\"lib\"``, or ``\"DLLs\"`` on Windows)." msgstr "" -#: c-api/init_config.rst:927 +#: c-api/init_config.rst:1616 msgid "" "This macro is now used on Windows to locate the standard library extension " "modules, typically under ``DLLs``. However, for compatibility, note that " @@ -1184,21 +2364,21 @@ msgid "" "and virtual environments." msgstr "" -#: c-api/init_config.rst:936 +#: c-api/init_config.rst:1625 msgid "" "Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` (:" "data:`os.pathsep`)." msgstr "" -#: c-api/init_config.rst:939 +#: c-api/init_config.rst:1628 msgid "Set by the :envvar:`PYTHONPATH` environment variable." msgstr "" -#: c-api/init_config.rst:948 +#: c-api/init_config.rst:1637 msgid "Module search paths: :data:`sys.path`." msgstr "" -#: c-api/init_config.rst:950 +#: c-api/init_config.rst:1639 msgid "" "If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``, :c:func:" "`Py_InitializeFromConfig` will replace :c:member:`~PyConfig." @@ -1206,41 +2386,41 @@ msgid "" "to ``1``." msgstr "" -#: c-api/init_config.rst:955 +#: c-api/init_config.rst:1644 msgid "" "Default: empty list (``module_search_paths``) and ``0`` " "(``module_search_paths_set``)." msgstr "" -#: c-api/init_config.rst:962 +#: c-api/init_config.rst:1651 msgid "Compilation optimization level:" msgstr "" -#: c-api/init_config.rst:964 +#: c-api/init_config.rst:1653 msgid "``0``: Peephole optimizer, set ``__debug__`` to ``True``." msgstr "" -#: c-api/init_config.rst:965 +#: c-api/init_config.rst:1654 msgid "``1``: Level 0, remove assertions, set ``__debug__`` to ``False``." msgstr "" -#: c-api/init_config.rst:966 +#: c-api/init_config.rst:1655 msgid "``2``: Level 1, strip docstrings." msgstr "" -#: c-api/init_config.rst:968 +#: c-api/init_config.rst:1657 msgid "" "Incremented by the :option:`-O` command line option. Set to the :envvar:" "`PYTHONOPTIMIZE` environment variable value." msgstr "" -#: c-api/init_config.rst:975 +#: c-api/init_config.rst:1664 msgid "" "The list of the original command line arguments passed to the Python " "executable: :data:`sys.orig_argv`." msgstr "" -#: c-api/init_config.rst:978 +#: c-api/init_config.rst:1667 msgid "" "If :c:member:`~PyConfig.orig_argv` list is empty and :c:member:`~PyConfig." "argv` is not a list only containing an empty string, :c:func:`PyConfig_Read` " @@ -1249,387 +2429,439 @@ msgid "" "parse_argv` is non-zero)." msgstr "" -#: c-api/init_config.rst:985 +#: c-api/init_config.rst:1674 msgid "" "See also the :c:member:`~PyConfig.argv` member and the :c:func:" "`Py_GetArgcArgv` function." msgstr "" -#: c-api/init_config.rst:1258 c-api/init_config.rst:1277 +#: c-api/init_config.rst:1990 c-api/init_config.rst:2009 msgid "Default: empty list." msgstr "" -#: c-api/init_config.rst:994 +#: c-api/init_config.rst:1683 msgid "Parse command line arguments?" msgstr "" -#: c-api/init_config.rst:996 +#: c-api/init_config.rst:1685 msgid "" "If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the " "regular Python parses :ref:`command line arguments `, and " "strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: c-api/init_config.rst:1008 +#: c-api/init_config.rst:1697 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed if :c:member:" "`PyConfig.parse_argv` equals to ``1``." msgstr "" -#: c-api/init_config.rst:1014 +#: c-api/init_config.rst:1703 msgid "" "Parser debug mode. If greater than ``0``, turn on parser debugging output " "(for expert only, depending on compilation options)." msgstr "" -#: c-api/init_config.rst:1017 +#: c-api/init_config.rst:1706 msgid "" "Incremented by the :option:`-d` command line option. Set to the :envvar:" "`PYTHONDEBUG` environment variable value." msgstr "" -#: c-api/init_config.rst:1020 +#: c-api/init_config.rst:1814 msgid "" -"Need a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " +"Needs a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " "must be defined)." msgstr "" -#: c-api/init_config.rst:1027 +#: c-api/init_config.rst:1716 msgid "" "If non-zero, calculation of path configuration is allowed to log warnings " "into ``stderr``. If equals to ``0``, suppress these warnings." msgstr "" -#: c-api/init_config.rst:1034 +#: c-api/init_config.rst:1723 msgid "Now also applies on Windows." msgstr "" -#: c-api/init_config.rst:1039 +#: c-api/init_config.rst:1728 msgid "" "The site-specific directory prefix where the platform independent Python " "files are installed: :data:`sys.prefix`." msgstr "" -#: c-api/init_config.rst:1048 +#: c-api/init_config.rst:1735 +msgid "See also :c:member:`PyConfig.base_prefix`." +msgstr "" + +#: c-api/init_config.rst:1739 msgid "" "Program name used to initialize :c:member:`~PyConfig.executable` and in " "early error messages during Python initialization." msgstr "" -#: c-api/init_config.rst:1051 -msgid "If :func:`Py_SetProgramName` has been called, use its argument." -msgstr "" - -#: c-api/init_config.rst:1052 +#: c-api/init_config.rst:1742 msgid "On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set." msgstr "" -#: c-api/init_config.rst:1053 +#: c-api/init_config.rst:1743 msgid "" "If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use :envvar:" "`__PYVENV_LAUNCHER__` environment variable if set." msgstr "" -#: c-api/init_config.rst:1055 +#: c-api/init_config.rst:1745 msgid "" "Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and non-empty." msgstr "" -#: c-api/init_config.rst:1057 +#: c-api/init_config.rst:1747 msgid "" "Otherwise, use ``L\"python\"`` on Windows, or ``L\"python3\"`` on other " "platforms." msgstr "" -#: c-api/init_config.rst:1066 +#: c-api/init_config.rst:1756 msgid "" "Directory where cached ``.pyc`` files are written: :data:`sys." "pycache_prefix`." msgstr "" -#: c-api/init_config.rst:1069 +#: c-api/init_config.rst:1759 msgid "" "Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and " -"the :envvar:`PYTHONPYCACHEPREFIX` environment variable." +"the :envvar:`PYTHONPYCACHEPREFIX` environment variable. The command-line " +"option takes precedence." msgstr "" -#: c-api/init_config.rst:1072 +#: c-api/init_config.rst:1763 msgid "If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``." msgstr "" -#: c-api/init_config.rst:1078 +#: c-api/init_config.rst:1769 msgid "" "Quiet mode. If greater than ``0``, don't display the copyright and version " "at Python startup in interactive mode." msgstr "" -#: c-api/init_config.rst:1081 +#: c-api/init_config.rst:1772 msgid "Incremented by the :option:`-q` command line option." msgstr "" -#: c-api/init_config.rst:1087 +#: c-api/init_config.rst:1778 msgid "Value of the :option:`-c` command line option." msgstr "" -#: c-api/init_config.rst:1110 +#: c-api/init_config.rst:1801 msgid "Used by :c:func:`Py_RunMain`." msgstr "" -#: c-api/init_config.rst:1095 +#: c-api/init_config.rst:1786 msgid "" "Filename passed on the command line: trailing command line argument without :" "option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` function." msgstr "" -#: c-api/init_config.rst:1099 +#: c-api/init_config.rst:1790 msgid "" "For example, it is set to ``script.py`` by the ``python3 script.py arg`` " "command line." msgstr "" -#: c-api/init_config.rst:1102 +#: c-api/init_config.rst:1793 msgid "See also the :c:member:`PyConfig.skip_source_first_line` option." msgstr "" -#: c-api/init_config.rst:1108 +#: c-api/init_config.rst:1799 msgid "Value of the :option:`-m` command line option." msgstr "" -#: c-api/init_config.rst:1116 -msgid "Show total reference count at exit (excluding immortal objects)?" +#: c-api/init_config.rst:1807 +msgid "" +"``package.module`` path to module that should be imported before ``site.py`` " +"is run." +msgstr "" + +#: c-api/init_config.rst:1810 +msgid "" +"Set by the :option:`-X presite=package.module <-X>` command-line option and " +"the :envvar:`PYTHON_PRESITE` environment variable. The command-line option " +"takes precedence." +msgstr "" + +#: c-api/init_config.rst:1821 +msgid "" +"Show total reference count at exit (excluding :term:`immortal` objects)?" msgstr "" -#: c-api/init_config.rst:1118 +#: c-api/init_config.rst:1823 msgid "Set to ``1`` by :option:`-X showrefcount <-X>` command line option." msgstr "" -#: c-api/init_config.rst:1120 +#: c-api/init_config.rst:1825 msgid "" -"Need a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " +"Needs a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " "macro must be defined)." msgstr "" -#: c-api/init_config.rst:1127 +#: c-api/init_config.rst:1832 msgid "Import the :mod:`site` module at startup?" msgstr "" -#: c-api/init_config.rst:1129 +#: c-api/init_config.rst:1834 msgid "" "If equal to zero, disable the import of the module site and the site-" "dependent manipulations of :data:`sys.path` that it entails." msgstr "" -#: c-api/init_config.rst:1132 +#: c-api/init_config.rst:1837 msgid "" "Also disable these manipulations if the :mod:`site` module is explicitly " "imported later (call :func:`site.main` if you want them to be triggered)." msgstr "" -#: c-api/init_config.rst:1135 +#: c-api/init_config.rst:1840 msgid "Set to ``0`` by the :option:`-S` command line option." msgstr "" -#: c-api/init_config.rst:1137 +#: c-api/init_config.rst:1842 msgid "" ":data:`sys.flags.no_site ` is set to the inverted value of :c:" "member:`~PyConfig.site_import`." msgstr "" -#: c-api/init_config.rst:1144 +#: c-api/init_config.rst:1849 msgid "" "If non-zero, skip the first line of the :c:member:`PyConfig.run_filename` " "source." msgstr "" -#: c-api/init_config.rst:1147 +#: c-api/init_config.rst:1852 msgid "" "It allows the usage of non-Unix forms of ``#!cmd``. This is intended for a " "DOS specific hack only." msgstr "" -#: c-api/init_config.rst:1150 +#: c-api/init_config.rst:1855 msgid "Set to ``1`` by the :option:`-x` command line option." msgstr "" -#: c-api/init_config.rst:1157 +#: c-api/init_config.rst:1862 msgid "" "Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and :" "data:`sys.stderr` (but :data:`sys.stderr` always uses " "``\"backslashreplace\"`` error handler)." msgstr "" -#: c-api/init_config.rst:1161 -msgid "" -"If :c:func:`Py_SetStandardStreamEncoding` has been called, use its *error* " -"and *errors* arguments if they are not ``NULL``." -msgstr "" - -#: c-api/init_config.rst:1164 +#: c-api/init_config.rst:1866 msgid "" "Use the :envvar:`PYTHONIOENCODING` environment variable if it is non-empty." msgstr "" -#: c-api/init_config.rst:1167 +#: c-api/init_config.rst:1869 msgid "Default encoding:" msgstr "" -#: c-api/init_config.rst:1169 +#: c-api/init_config.rst:1871 msgid "``\"UTF-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: c-api/init_config.rst:1170 +#: c-api/init_config.rst:1872 msgid "Otherwise, use the :term:`locale encoding`." msgstr "" -#: c-api/init_config.rst:1172 +#: c-api/init_config.rst:1874 msgid "Default error handler:" msgstr "" -#: c-api/init_config.rst:1174 +#: c-api/init_config.rst:1876 msgid "On Windows: use ``\"surrogateescape\"``." msgstr "" -#: c-api/init_config.rst:1175 +#: c-api/init_config.rst:1877 msgid "" "``\"surrogateescape\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero, or " "if the LC_CTYPE locale is \"C\" or \"POSIX\"." msgstr "" -#: c-api/init_config.rst:1177 +#: c-api/init_config.rst:1879 msgid "``\"strict\"`` otherwise." msgstr "" -#: c-api/init_config.rst:1181 +#: c-api/init_config.rst:1881 +msgid "See also :c:member:`PyConfig.legacy_windows_stdio`." +msgstr "" + +#: c-api/init_config.rst:1885 msgid "Enable tracemalloc?" msgstr "" -#: c-api/init_config.rst:1183 +#: c-api/init_config.rst:1887 msgid "If non-zero, call :func:`tracemalloc.start` at startup." msgstr "" -#: c-api/init_config.rst:1185 +#: c-api/init_config.rst:1889 msgid "" "Set by :option:`-X tracemalloc=N <-X>` command line option and by the :" "envvar:`PYTHONTRACEMALLOC` environment variable." msgstr "" -#: c-api/init_config.rst:1192 -msgid "Enable compatibility mode with the perf profiler?" +#: c-api/init_config.rst:1896 +msgid "Enable the Linux ``perf`` profiler support?" +msgstr "" + +#: c-api/init_config.rst:1898 +msgid "If equals to ``1``, enable support for the Linux ``perf`` profiler." msgstr "" -#: c-api/init_config.rst:1194 +#: c-api/init_config.rst:1900 msgid "" -"If non-zero, initialize the perf trampoline. See :ref:`perf_profiling` for " -"more information." +"If equals to ``2``, enable support for the Linux ``perf`` profiler with " +"DWARF JIT support." msgstr "" -#: c-api/init_config.rst:1197 +#: c-api/init_config.rst:1903 msgid "" -"Set by :option:`-X perf <-X>` command line option and by the :envvar:" +"Set to ``1`` by :option:`-X perf <-X>` command-line option and the :envvar:" "`PYTHONPERFSUPPORT` environment variable." msgstr "" -#: c-api/init_config.rst:1200 -msgid "Default: ``-1``." +#: c-api/init_config.rst:1906 +msgid "" +"Set to ``2`` by the :option:`-X perf_jit <-X>` command-line option and the :" +"envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable." +msgstr "" + +#: c-api/init_config.rst:1912 +msgid "See :ref:`perf_profiling` for more information." +msgstr "" + +#: c-api/init_config.rst:1918 +msgid "Directory of the Python standard library." msgstr "" -#: c-api/init_config.rst:1206 +#: c-api/init_config.rst:1926 msgid "Use :ref:`environment variables `?" msgstr "" -#: c-api/init_config.rst:1208 +#: c-api/init_config.rst:1928 msgid "" "If equals to zero, ignore the :ref:`environment variables `." msgstr "" -#: c-api/init_config.rst:1211 +#: c-api/init_config.rst:1931 msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" -#: c-api/init_config.rst:1217 +#: c-api/init_config.rst:1937 +msgid "" +"If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." +msgstr "" + +#: c-api/init_config.rst:1940 +msgid "Only available on macOS 10.12 and later, and on iOS." +msgstr "" + +#: c-api/init_config.rst:1942 +msgid "" +"Default: ``0`` (don't use the system log) on macOS; ``1`` on iOS (use the " +"system log)." +msgstr "" + +#: c-api/init_config.rst:1949 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: c-api/init_config.rst:1219 +#: c-api/init_config.rst:1951 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: c-api/init_config.rst:1221 +#: c-api/init_config.rst:1953 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: c-api/init_config.rst:1227 +#: c-api/init_config.rst:1959 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: c-api/init_config.rst:1231 +#: c-api/init_config.rst:1963 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" -#: c-api/init_config.rst:1235 +#: c-api/init_config.rst:1967 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: c-api/init_config.rst:1237 +#: c-api/init_config.rst:1969 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: c-api/init_config.rst:1243 +#: c-api/init_config.rst:1975 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: c-api/init_config.rst:1246 +#: c-api/init_config.rst:1978 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: c-api/init_config.rst:1251 +#: c-api/init_config.rst:1983 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" -#: c-api/init_config.rst:1254 +#: c-api/init_config.rst:1986 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" -#: c-api/init_config.rst:1262 +#: c-api/init_config.rst:1994 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: c-api/init_config.rst:1265 +#: c-api/init_config.rst:1997 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: c-api/init_config.rst:1268 +#: c-api/init_config.rst:2000 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" -#: c-api/init_config.rst:1275 +#: c-api/init_config.rst:2007 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: c-api/init_config.rst:1279 +#: c-api/init_config.rst:2013 +msgid "If non-zero, write performance statistics at Python exit." +msgstr "" + +#: c-api/init_config.rst:2015 +msgid "" +"Need a special build with the ``Py_STATS`` macro: see :option:`--enable-" +"pystats`." +msgstr "" + +#: c-api/init_config.rst:2020 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " @@ -1637,29 +2869,27 @@ msgid "" "c:member:`~PyConfig.argv`." msgstr "" -#: c-api/init_config.rst:1284 +#: c-api/init_config.rst:2025 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: c-api/init_config.rst:1289 +#: c-api/init_config.rst:2030 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: c-api/init_config.rst:1293 +#: c-api/init_config.rst:2036 msgid "Initialization with PyConfig" msgstr "" -#: c-api/init_config.rst:1295 -msgid "Function to initialize Python:" -msgstr "" - -#: c-api/init_config.rst:1299 -msgid "Initialize Python from *config* configuration." +#: c-api/init_config.rst:2038 +msgid "" +"Initializing the interpreter from a populated configuration struct is " +"handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" -#: c-api/init_config.rst:1304 +#: c-api/init_config.rst:2044 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1668,17 +2898,46 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: c-api/init_config.rst:1311 +#: c-api/init_config.rst:2051 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: c-api/init_config.rst:1314 +#: c-api/init_config.rst:2054 msgid "Example setting the program name::" msgstr "" -#: c-api/init_config.rst:1342 +#: c-api/init_config.rst:2056 +msgid "" +"void init_python(void)\n" +"{\n" +" PyStatus status;\n" +"\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* Set the program name. Implicitly preinitialize Python. */\n" +" status = PyConfig_SetString(&config, &config.program_name,\n" +" L\"/path/to/my_program\");\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +" return;\n" +"\n" +"exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" +"}" +msgstr "" + +#: c-api/init_config.rst:2082 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1687,18 +2946,73 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: c-api/init_config.rst:1405 +#: c-api/init_config.rst:2089 +msgid "" +"PyStatus init_python(const char *program_name)\n" +"{\n" +" PyStatus status;\n" +"\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* Set the program name before reading the configuration\n" +" (decode byte string from the locale encoding).\n" +"\n" +" Implicitly preinitialize Python. */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name,\n" +" program_name);\n" +" if (PyStatus_Exception(status)) {\n" +" goto done;\n" +" }\n" +"\n" +" /* Read all configuration at once */\n" +" status = PyConfig_Read(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto done;\n" +" }\n" +"\n" +" /* Specify sys.path explicitly */\n" +" /* If you want to modify the default set of paths, finish\n" +" initialization first and then use PySys_GetObject(\"path\") */\n" +" config.module_search_paths_set = 1;\n" +" status = PyWideStringList_Append(&config.module_search_paths,\n" +" L\"/path/to/stdlib\");\n" +" if (PyStatus_Exception(status)) {\n" +" goto done;\n" +" }\n" +" status = PyWideStringList_Append(&config.module_search_paths,\n" +" L\"/path/to/more/modules\");\n" +" if (PyStatus_Exception(status)) {\n" +" goto done;\n" +" }\n" +"\n" +" /* Override executable computed by PyConfig_Read() */\n" +" status = PyConfig_SetString(&config, &config.executable,\n" +" L\"/path/to/my_executable\");\n" +" if (PyStatus_Exception(status)) {\n" +" goto done;\n" +" }\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +"\n" +"done:\n" +" PyConfig_Clear(&config);\n" +" return status;\n" +"}" +msgstr "" + +#: c-api/init_config.rst:2145 msgid "Isolated Configuration" msgstr "" -#: c-api/init_config.rst:1407 +#: c-api/init_config.rst:2147 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: c-api/init_config.rst:1412 +#: c-api/init_config.rst:2152 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -1706,125 +3020,125 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: c-api/init_config.rst:1417 +#: c-api/init_config.rst:2157 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: c-api/init_config.rst:1425 +#: c-api/init_config.rst:2165 msgid "Python Configuration" msgstr "" -#: c-api/init_config.rst:1427 +#: c-api/init_config.rst:2167 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: c-api/init_config.rst:1431 +#: c-api/init_config.rst:2171 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: c-api/init_config.rst:1434 +#: c-api/init_config.rst:2174 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: c-api/init_config.rst:1443 +#: c-api/init_config.rst:2183 msgid "Python Path Configuration" msgstr "" -#: c-api/init_config.rst:1445 +#: c-api/init_config.rst:2185 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: c-api/init_config.rst:1447 +#: c-api/init_config.rst:2187 msgid "Path configuration inputs:" msgstr "" -#: c-api/init_config.rst:1449 +#: c-api/init_config.rst:2189 msgid ":c:member:`PyConfig.home`" msgstr "" -#: c-api/init_config.rst:1450 +#: c-api/init_config.rst:2190 msgid ":c:member:`PyConfig.platlibdir`" msgstr "" -#: c-api/init_config.rst:1451 +#: c-api/init_config.rst:2191 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr "" -#: c-api/init_config.rst:1452 +#: c-api/init_config.rst:2192 msgid ":c:member:`PyConfig.program_name`" msgstr "" -#: c-api/init_config.rst:1453 +#: c-api/init_config.rst:2193 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr "" -#: c-api/init_config.rst:1454 +#: c-api/init_config.rst:2194 msgid "current working directory: to get absolute paths" msgstr "" -#: c-api/init_config.rst:1455 +#: c-api/init_config.rst:2195 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: c-api/init_config.rst:1457 +#: c-api/init_config.rst:2197 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "" -#: c-api/init_config.rst:1458 +#: c-api/init_config.rst:2198 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: c-api/init_config.rst:1462 +#: c-api/init_config.rst:2202 msgid "Path configuration output fields:" msgstr "" -#: c-api/init_config.rst:1464 +#: c-api/init_config.rst:2204 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr "" -#: c-api/init_config.rst:1465 +#: c-api/init_config.rst:2205 msgid ":c:member:`PyConfig.base_executable`" msgstr "" -#: c-api/init_config.rst:1466 +#: c-api/init_config.rst:2206 msgid ":c:member:`PyConfig.base_prefix`" msgstr "" -#: c-api/init_config.rst:1467 +#: c-api/init_config.rst:2207 msgid ":c:member:`PyConfig.exec_prefix`" msgstr "" -#: c-api/init_config.rst:1468 +#: c-api/init_config.rst:2208 msgid ":c:member:`PyConfig.executable`" msgstr "" -#: c-api/init_config.rst:1469 +#: c-api/init_config.rst:2209 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" msgstr "" -#: c-api/init_config.rst:1471 +#: c-api/init_config.rst:2211 msgid ":c:member:`PyConfig.prefix`" msgstr "" -#: c-api/init_config.rst:1473 +#: c-api/init_config.rst:2213 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -1833,7 +3147,7 @@ msgid "" "module_search_paths_set` is set to ``1``." msgstr "" -#: c-api/init_config.rst:1479 +#: c-api/init_config.rst:2219 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -1843,52 +3157,52 @@ msgid "" "modification." msgstr "" -#: c-api/init_config.rst:1486 +#: c-api/init_config.rst:2226 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: c-api/init_config.rst:1489 +#: c-api/init_config.rst:2229 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: c-api/init_config.rst:1493 +#: c-api/init_config.rst:2233 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: c-api/init_config.rst:1495 +#: c-api/init_config.rst:2235 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: c-api/init_config.rst:1498 +#: c-api/init_config.rst:2238 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "" -#: c-api/init_config.rst:1500 +#: c-api/init_config.rst:2240 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: c-api/init_config.rst:1502 +#: c-api/init_config.rst:2242 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: c-api/init_config.rst:1504 +#: c-api/init_config.rst:2244 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: c-api/init_config.rst:1506 +#: c-api/init_config.rst:2246 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -1897,195 +3211,100 @@ msgid "" "data:`sys.path`." msgstr "" -#: c-api/init_config.rst:1512 +#: c-api/init_config.rst:2252 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: c-api/init_config.rst:1514 +#: c-api/init_config.rst:2254 msgid "``pyvenv.cfg``" msgstr "" -#: c-api/init_config.rst:1515 +#: c-api/init_config.rst:2255 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: c-api/init_config.rst:1516 +#: c-api/init_config.rst:2256 msgid "``pybuilddir.txt`` (Unix only)" msgstr "" -#: c-api/init_config.rst:1518 +#: c-api/init_config.rst:2258 msgid "If a ``._pth`` file is present:" msgstr "" -#: c-api/init_config.rst:1520 +#: c-api/init_config.rst:2260 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "" -#: c-api/init_config.rst:1521 +#: c-api/init_config.rst:2261 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "" -#: c-api/init_config.rst:1522 +#: c-api/init_config.rst:2262 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "" -#: c-api/init_config.rst:1523 +#: c-api/init_config.rst:2263 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "" -#: c-api/init_config.rst:1525 -msgid "" -"The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" -"`PyConfig.base_executable`" -msgstr "" - -#: c-api/init_config.rst:1530 -msgid "Py_RunMain()" -msgstr "" - -#: c-api/init_config.rst:1534 +#: c-api/init_config.rst:2265 msgid "" -"Execute the command (:c:member:`PyConfig.run_command`), the script (:c:" -"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." -"run_module`) specified on the command line or in the configuration." -msgstr "" - -#: c-api/init_config.rst:1539 -msgid "By default and when if :option:`-i` option is used, run the REPL." +"If :c:member:`~PyConfig.home` is not set and a ``pyvenv.cfg`` file is " +"present in the same directory as :c:member:`~PyConfig.executable`, or its " +"parent, :c:member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` " +"are set that location. When this happens, :c:member:`~PyConfig.base_prefix` " +"and :c:member:`~PyConfig.base_exec_prefix` still keep their value, pointing " +"to the base installation. See :ref:`sys-path-init-virtual-environments` for " +"more information." msgstr "" -#: c-api/init_config.rst:1541 +#: c-api/init_config.rst:2273 msgid "" -"Finally, finalizes Python and returns an exit status that can be passed to " -"the ``exit()`` function." +"The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" +"`PyConfig.base_executable`." msgstr "" -#: c-api/init_config.rst:1544 +#: c-api/init_config.rst:2278 msgid "" -"See :ref:`Python Configuration ` for an example of " -"customized Python always running in isolated mode using :c:func:`Py_RunMain`." +":c:member:`~PyConfig.prefix`, and :c:member:`~PyConfig.exec_prefix`, are now " +"set to the ``pyvenv.cfg`` directory. This was previously done by :mod:" +"`site`, therefore affected by :option:`-S`." msgstr "" -#: c-api/init_config.rst:1550 +#: c-api/init_config.rst:2284 msgid "Py_GetArgcArgv()" msgstr "" -#: c-api/init_config.rst:1554 +#: c-api/init_config.rst:2288 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: c-api/init_config.rst:1556 +#: c-api/init_config.rst:2290 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "" -#: c-api/init_config.rst:1560 -msgid "Multi-Phase Initialization Private Provisional API" -msgstr "" - -#: c-api/init_config.rst:1562 -msgid "" -"This section is a private provisional API introducing multi-phase " -"initialization, the core feature of :pep:`432`:" -msgstr "" - -#: c-api/init_config.rst:1565 -msgid "\"Core\" initialization phase, \"bare minimum Python\":" -msgstr "" - -#: c-api/init_config.rst:1567 -msgid "Builtin types;" -msgstr "" - -#: c-api/init_config.rst:1568 -msgid "Builtin exceptions;" -msgstr "" - -#: c-api/init_config.rst:1569 -msgid "Builtin and frozen modules;" -msgstr "" - -#: c-api/init_config.rst:1570 -msgid "" -"The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " -"doesn't exist yet)." -msgstr "" - -#: c-api/init_config.rst:1573 -msgid "\"Main\" initialization phase, Python is fully initialized:" -msgstr "" - -#: c-api/init_config.rst:1575 -msgid "Install and configure :mod:`importlib`;" -msgstr "" - -#: c-api/init_config.rst:1576 -msgid "Apply the :ref:`Path Configuration `;" -msgstr "" - -#: c-api/init_config.rst:1577 -msgid "Install signal handlers;" -msgstr "" - -#: c-api/init_config.rst:1578 -msgid "" -"Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" -"data:`sys.path`);" -msgstr "" - -#: c-api/init_config.rst:1580 -msgid "" -"Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" -msgstr "" - -#: c-api/init_config.rst:1581 -msgid "Import the :mod:`site` module;" -msgstr "" - -#: c-api/init_config.rst:1582 -msgid "etc." -msgstr "" - -#: c-api/init_config.rst:1584 -msgid "Private provisional API:" -msgstr "" - -#: c-api/init_config.rst:1586 -msgid "" -":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" -"`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." -msgstr "" - -#: c-api/init_config.rst:1591 -msgid "" -"Move to the \"Main\" initialization phase, finish the Python initialization." +#: c-api/init_config.rst:2293 +msgid "Delaying main module execution" msgstr "" -#: c-api/init_config.rst:1593 +#: c-api/init_config.rst:2295 msgid "" -"No module is imported during the \"Core\" phase and the ``importlib`` module " -"is not configured: the :ref:`Path Configuration ` is only " -"applied during the \"Main\" phase. It may allow to customize Python in " -"Python to override or tune the :ref:`Path Configuration `, " -"maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." +"In some embedding use cases, it may be desirable to separate interpreter " +"initialization from the execution of the main module." msgstr "" -#: c-api/init_config.rst:1599 +#: c-api/init_config.rst:2298 msgid "" -"It may become possible to calculate the :ref:`Path Configuration ` in Python, after the Core phase and before the Main phase, which is " -"one of the :pep:`432` motivation." +"This separation can be achieved by setting ``PyConfig.run_command`` to the " +"empty string during initialization (to prevent the interpreter from dropping " +"into the interactive prompt), and then subsequently executing the desired " +"main module code using ``__main__.__dict__`` as the global namespace." msgstr "" -#: c-api/init_config.rst:1603 -msgid "" -"The \"Core\" phase is not properly defined: what should be and what should " -"not be available at this phase is not specified yet. The API is marked as " -"private and provisional: the API can be modified or even be removed anytime " -"until a proper public API is designed." +#: c-api/init_config.rst:1181 +msgid "main()" msgstr "" -#: c-api/init_config.rst:1608 -msgid "" -"Example running Python code between \"Core\" and \"Main\" initialization " -"phases::" +#: c-api/init_config.rst:1181 +msgid "argv (in module sys)" msgstr "" diff --git a/c-api/intro.po b/c-api/intro.po index 30b7485d..0c665caf 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -52,10 +53,24 @@ msgid "" msgstr "" #: c-api/intro.rst:34 -msgid "Coding standards" +msgid "Language version compatibility" msgstr "" #: c-api/intro.rst:36 +msgid "Python's C API is compatible with C11 and C++11 versions of C and C++." +msgstr "" + +#: c-api/intro.rst:38 +msgid "" +"This is a lower limit: the C API does not require features from later C/C++ " +"versions. You do *not* need to enable your compiler's \"c11 mode\"." +msgstr "" + +#: c-api/intro.rst:44 +msgid "Coding standards" +msgstr "" + +#: c-api/intro.rst:46 msgid "" "If you're writing C code for inclusion in CPython, you **must** follow the " "guidelines and standards defined in :PEP:`7`. These guidelines apply " @@ -64,37 +79,43 @@ msgid "" "modules, unless you eventually expect to contribute them to Python." msgstr "" -#: c-api/intro.rst:46 +#: c-api/intro.rst:56 msgid "Include Files" msgstr "" -#: c-api/intro.rst:48 +#: c-api/intro.rst:58 msgid "" "All function, type and macro definitions needed to use the Python/C API are " "included in your code by the following line::" msgstr "" -#: c-api/intro.rst:54 +#: c-api/intro.rst:61 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include " +msgstr "" + +#: c-api/intro.rst:64 msgid "" "This implies inclusion of the following standard headers: ````, " "````, ````, ````, ```` and ```` (if available)." msgstr "" -#: c-api/intro.rst:60 +#: c-api/intro.rst:70 msgid "" "Since Python may define some pre-processor definitions which affect the " "standard headers on some systems, you *must* include :file:`Python.h` before " "any standard headers are included." msgstr "" -#: c-api/intro.rst:64 +#: c-api/intro.rst:74 msgid "" "It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including " "``Python.h``. See :ref:`arg-parsing` for a description of this macro." msgstr "" -#: c-api/intro.rst:67 +#: c-api/intro.rst:77 msgid "" "All user visible names defined by Python.h (except those defined by the " "included standard headers) have one of the prefixes ``Py`` or ``_Py``. " @@ -103,7 +124,7 @@ msgid "" "names do not have a reserved prefix." msgstr "" -#: c-api/intro.rst:74 +#: c-api/intro.rst:84 msgid "" "User code should never define names that begin with ``Py`` or ``_Py``. This " "confuses the reader, and jeopardizes the portability of the user code to " @@ -111,7 +132,7 @@ msgid "" "of these prefixes." msgstr "" -#: c-api/intro.rst:79 +#: c-api/intro.rst:89 msgid "" "The header files are typically installed with Python. On Unix, these are " "located in the directories :file:`{prefix}/include/pythonversion/` and :file:" @@ -123,7 +144,7 @@ msgid "" "specified to the installer." msgstr "" -#: c-api/intro.rst:88 +#: c-api/intro.rst:98 msgid "" "To include the headers, place both directories (if different) on your " "compiler's search path for includes. Do *not* place the parent directories " @@ -133,130 +154,156 @@ msgid "" "option:`exec_prefix <--exec-prefix>`." msgstr "" -#: c-api/intro.rst:95 +#: c-api/intro.rst:105 msgid "" "C++ users should note that although the API is defined entirely using C, the " "header files properly declare the entry points to be ``extern \"C\"``. As a " "result, there is no need to do anything special to use the API from C++." msgstr "" -#: c-api/intro.rst:101 +#: c-api/intro.rst:111 msgid "Useful macros" msgstr "" -#: c-api/intro.rst:103 +#: c-api/intro.rst:113 msgid "" "Several useful macros are defined in the Python header files. Many are " -"defined closer to where they are useful (e.g. :c:macro:`Py_RETURN_NONE`). " -"Others of a more general utility are defined here. This is not necessarily " -"a complete listing." +"defined closer to where they are useful (for example, :c:macro:" +"`Py_RETURN_NONE`, :c:macro:`PyMODINIT_FUNC`). Others of a more general " +"utility are defined here. This is not necessarily a complete listing." msgstr "" -#: c-api/intro.rst:110 -msgid "" -"Declare an extension module ``PyInit`` initialization function. The function " -"return type is :c:expr:`PyObject*`. The macro declares any special linkage " -"declarations required by the platform, and for C++ declares the function as " -"``extern \"C\"``." +#: c-api/intro.rst:122 +msgid "Return the absolute value of ``x``." msgstr "" -#: c-api/intro.rst:115 +#: c-api/intro.rst:124 msgid "" -"The initialization function must be named :samp:`PyInit_{name}`, where " -"*name* is the name of the module, and should be the only non-\\ ``static`` " -"item defined in the module file. Example::" +"If the result cannot be represented (for example, if ``x`` has :c:macro:`!" +"INT_MIN` value for :c:expr:`int` type), the behavior is undefined." msgstr "" -#: c-api/intro.rst:134 -msgid "Return the absolute value of ``x``." -msgstr "" - -#: c-api/intro.rst:140 +#: c-api/intro.rst:132 msgid "" "Ask the compiler to always inline a static inline function. The compiler can " -"ignore it and decides to not inline the function." +"ignore it and decide to not inline the function." msgstr "" -#: c-api/intro.rst:143 +#: c-api/intro.rst:135 msgid "" "It can be used to inline performance critical static inline functions when " "building Python in debug mode with function inlining disabled. For example, " "MSC disables function inlining when building in debug mode." msgstr "" -#: c-api/intro.rst:147 +#: c-api/intro.rst:139 msgid "" "Marking blindly a static inline function with Py_ALWAYS_INLINE can result in " "worse performances (due to increased code size for example). The compiler is " "usually smarter than the developer for the cost/benefit analysis." msgstr "" -#: c-api/intro.rst:151 +#: c-api/intro.rst:143 msgid "" "If Python is :ref:`built in debug mode ` (if the :c:macro:" "`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does " "nothing." msgstr "" -#: c-api/intro.rst:154 +#: c-api/intro.rst:146 msgid "It must be specified before the function return type. Usage::" msgstr "" -#: c-api/intro.rst:162 +#: c-api/intro.rst:148 +msgid "static inline Py_ALWAYS_INLINE int random(void) { return 4; }" +msgstr "" + +#: c-api/intro.rst:154 msgid "" "Argument must be a character or an integer in the range [-128, 127] or [0, " "255]. This macro returns ``c`` cast to an ``unsigned char``." msgstr "" -#: c-api/intro.rst:167 +#: c-api/intro.rst:159 msgid "" "Use this for deprecated declarations. The macro must be placed before the " "symbol name." msgstr "" -#: c-api/intro.rst:256 c-api/intro.rst:274 +#: c-api/intro.rst:290 c-api/intro.rst:308 msgid "Example::" msgstr "" -#: c-api/intro.rst:174 +#: c-api/intro.rst:164 +msgid "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" +msgstr "" + +#: c-api/intro.rst:166 msgid "MSVC support was added." msgstr "" -#: c-api/intro.rst:179 +#: c-api/intro.rst:171 msgid "" "Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the " "command line (see :c:member:`PyConfig.use_environment`)." msgstr "" -#: c-api/intro.rst:184 +#: c-api/intro.rst:176 +msgid "" +"Declare a function returning the specified *type* using a fast-calling " +"qualifier for functions that are local to the current file. Semantically, " +"this is equivalent to ``static type``." +msgstr "" + +#: c-api/intro.rst:182 +msgid "" +"Equivalent to :c:macro:`Py_LOCAL` but additionally requests the function be " +"inlined." +msgstr "" + +#: c-api/intro.rst:187 msgid "Return the maximum value between ``x`` and ``y``." msgstr "" -#: c-api/intro.rst:190 +#: c-api/intro.rst:193 msgid "Return the size of a structure (``type``) ``member`` in bytes." msgstr "" -#: c-api/intro.rst:196 -msgid "Return the minimum value between ``x`` and ``y``." +#: c-api/intro.rst:199 +msgid "" +"This is a :term:`soft deprecated` alias to :c:func:`!memcpy`. Use :c:func:`!" +"memcpy` directly instead." msgstr "" #: c-api/intro.rst:202 +msgid "The macro is :term:`soft deprecated`." +msgstr "" + +#: c-api/intro.rst:207 +msgid "Return the minimum value between ``x`` and ``y``." +msgstr "" + +#: c-api/intro.rst:213 msgid "" "Disable inlining on a function. For example, it reduces the C stack " "consumption: useful on LTO+PGO builds which heavily inline code (see :issue:" "`33720`)." msgstr "" -#: c-api/intro.rst:206 +#: c-api/intro.rst:217 msgid "Usage::" msgstr "" -#: c-api/intro.rst:214 +#: c-api/intro.rst:219 +msgid "Py_NO_INLINE static int random(void) { return 4; }" +msgstr "" + +#: c-api/intro.rst:225 msgid "" "Convert ``x`` to a C string. E.g. ``Py_STRINGIFY(123)`` returns ``\"123\"``." msgstr "" -#: c-api/intro.rst:221 +#: c-api/intro.rst:232 msgid "" "Use this when you have a code path that cannot be reached by design. For " "example, in the ``default:`` clause in a ``switch`` statement for which all " @@ -264,20 +311,20 @@ msgid "" "where you might be tempted to put an ``assert(0)`` or ``abort()`` call." msgstr "" -#: c-api/intro.rst:226 +#: c-api/intro.rst:237 msgid "" "In release mode, the macro helps the compiler to optimize the code, and " "avoids a warning about unreachable code. For example, the macro is " "implemented with ``__builtin_unreachable()`` on GCC in release mode." msgstr "" -#: c-api/intro.rst:230 +#: c-api/intro.rst:241 msgid "" "A use for ``Py_UNREACHABLE()`` is following a call a function that never " "returns but that is not declared :c:macro:`_Py_NO_RETURN`." msgstr "" -#: c-api/intro.rst:233 +#: c-api/intro.rst:244 msgid "" "If a code path is very unlikely code but can be reached under exceptional " "case, this macro must not be used. For example, under low memory condition " @@ -286,41 +333,120 @@ msgid "" "reported to caller, :c:func:`Py_FatalError` can be used." msgstr "" -#: c-api/intro.rst:243 +#: c-api/intro.rst:254 msgid "" "Use this for unused arguments in a function definition to silence compiler " "warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``." msgstr "" -#: c-api/intro.rst:250 +#: c-api/intro.rst:261 +msgid "" +"Asserts a compile-time condition *cond*, as a statement. The build will fail " +"if the condition is false or cannot be evaluated at compile time." +msgstr "" + +#: c-api/intro.rst:275 c-api/intro.rst:320 +msgid "For example::" +msgstr "" + +#: c-api/intro.rst:266 +msgid "Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));" +msgstr "" + +#: c-api/intro.rst:272 +msgid "" +"Asserts a compile-time condition *cond*, as an expression that evaluates to " +"``0``. The build will fail if the condition is false or cannot be evaluated " +"at compile time." +msgstr "" + +#: c-api/intro.rst:277 msgid "" -"Creates a variable with name ``name`` that can be used in docstrings. If " +"#define foo_to_char(foo) \\\n" +" ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))" +msgstr "" + +#: c-api/intro.rst:284 +msgid "" +"Creates a variable with name *name* that can be used in docstrings. If " "Python is built without docstrings, the value will be empty." msgstr "" -#: c-api/intro.rst:253 +#: c-api/intro.rst:287 msgid "" "Use :c:macro:`PyDoc_STRVAR` for docstrings to support building Python " "without docstrings, as specified in :pep:`7`." msgstr "" -#: c-api/intro.rst:268 +#: c-api/intro.rst:292 +msgid "" +"PyDoc_STRVAR(pop_doc, \"Remove and return the rightmost element.\");\n" +"\n" +"static PyMethodDef deque_methods[] = {\n" +" // ...\n" +" {\"pop\", (PyCFunction)deque_pop, METH_NOARGS, pop_doc},\n" +" // ...\n" +"}" +msgstr "" + +#: c-api/intro.rst:302 msgid "" "Creates a docstring for the given input string or an empty string if " "docstrings are disabled." msgstr "" -#: c-api/intro.rst:271 +#: c-api/intro.rst:305 msgid "" "Use :c:macro:`PyDoc_STR` in specifying docstrings to support building Python " "without docstrings, as specified in :pep:`7`." msgstr "" -#: c-api/intro.rst:286 +#: c-api/intro.rst:310 +msgid "" +"static PyMethodDef pysqlite_row_methods[] = {\n" +" {\"keys\", (PyCFunction)pysqlite_row_keys, METH_NOARGS,\n" +" PyDoc_STR(\"Returns the keys of the row.\")},\n" +" {NULL, NULL}\n" +"};" +msgstr "" + +#: c-api/intro.rst:318 +msgid "Declares a static character array variable with the given name *name*." +msgstr "" + +#: c-api/intro.rst:322 +msgid "" +"PyDoc_VAR(python_doc) = PyDoc_STR(\"A genus of constricting snakes in the " +"Pythonidae family native \"\n" +" \"to the tropics and subtropics of the " +"Eastern Hemisphere.\");" +msgstr "" + +#: c-api/intro.rst:327 +msgid "Compute the length of a statically allocated C array at compile time." +msgstr "" + +#: c-api/intro.rst:329 +msgid "" +"The *array* argument must be a C array with a size known at compile time. " +"Passing an array with an unknown size, such as a heap-allocated array, will " +"result in a compilation error on some compilers, or otherwise produce " +"incorrect results." +msgstr "" + +#: c-api/intro.rst:334 +msgid "This is roughly equivalent to::" +msgstr "" + +#: c-api/intro.rst:336 +msgid "sizeof(array) / sizeof((array)[0])" +msgstr "" + +#: c-api/intro.rst:342 msgid "Objects, Types and Reference Counts" msgstr "" -#: c-api/intro.rst:290 +#: c-api/intro.rst:346 msgid "" "Most Python/C API functions have one or more arguments as well as a return " "value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data " @@ -335,7 +461,7 @@ msgid "" "objects." msgstr "" -#: c-api/intro.rst:301 +#: c-api/intro.rst:357 msgid "" "All Python objects (even Python integers) have a :dfn:`type` and a :dfn:" "`reference count`. An object's type determines what kind of object it is (e." @@ -346,11 +472,11 @@ msgid "" "a Python list." msgstr "" -#: c-api/intro.rst:312 +#: c-api/intro.rst:368 msgid "Reference Counts" msgstr "" -#: c-api/intro.rst:314 +#: c-api/intro.rst:370 msgid "" "The reference count is important because today's computers have a finite " "(and often severely limited) memory size; it counts how many different " @@ -365,7 +491,7 @@ msgid "" "that.\")" msgstr "" -#: c-api/intro.rst:331 +#: c-api/intro.rst:387 msgid "" "Reference counts are always manipulated explicitly. The normal way is to " "use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. " @@ -384,7 +510,7 @@ msgid "" "increment is a simple operation." msgstr "" -#: c-api/intro.rst:347 +#: c-api/intro.rst:403 msgid "" "It is not necessary to hold a :term:`strong reference` (i.e. increment the " "reference count) for every local variable that contains a pointer to an " @@ -402,7 +528,7 @@ msgid "" "reference to every argument for the duration of the call." msgstr "" -#: c-api/intro.rst:363 +#: c-api/intro.rst:419 msgid "" "However, a common pitfall is to extract an object from a list and hold on to " "it for a while without taking a new reference. Some other operation might " @@ -413,7 +539,7 @@ msgid "" "`Py_DECREF`, so almost any operation is potentially dangerous." msgstr "" -#: c-api/intro.rst:371 +#: c-api/intro.rst:427 msgid "" "A safe approach is to always use the generic operations (functions whose " "name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or " @@ -423,11 +549,11 @@ msgid "" "when they are done with the result; this soon becomes second nature." msgstr "" -#: c-api/intro.rst:382 +#: c-api/intro.rst:438 msgid "Reference Count Details" msgstr "" -#: c-api/intro.rst:384 +#: c-api/intro.rst:440 msgid "" "The reference count behavior of functions in the Python/C API is best " "explained in terms of *ownership of references*. Ownership pertains to " @@ -444,7 +570,7 @@ msgid "" "`borrowed reference`." msgstr "" -#: c-api/intro.rst:397 +#: c-api/intro.rst:453 msgid "" "Conversely, when a calling function passes in a reference to an object, " "there are two possibilities: the function *steals* a reference to the " @@ -453,7 +579,7 @@ msgid "" "reference, and you are not responsible for it any longer." msgstr "" -#: c-api/intro.rst:407 +#: c-api/intro.rst:463 msgid "" "Few functions steal references; the two notable exceptions are :c:func:" "`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to " @@ -465,7 +591,17 @@ msgid "" "below)::" msgstr "" -#: c-api/intro.rst:422 +#: c-api/intro.rst:471 +msgid "" +"PyObject *t;\n" +"\n" +"t = PyTuple_New(3);\n" +"PyTuple_SetItem(t, 0, PyLong_FromLong(1L));\n" +"PyTuple_SetItem(t, 1, PyLong_FromLong(2L));\n" +"PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));" +msgstr "" + +#: c-api/intro.rst:478 msgid "" "Here, :c:func:`PyLong_FromLong` returns a new reference which is immediately " "stolen by :c:func:`PyTuple_SetItem`. When you want to keep using an object " @@ -473,7 +609,7 @@ msgid "" "another reference before calling the reference-stealing function." msgstr "" -#: c-api/intro.rst:427 +#: c-api/intro.rst:483 msgid "" "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " "items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " @@ -481,13 +617,13 @@ msgid "" "func:`PyTuple_SetItem` for tuples that you are creating yourself." msgstr "" -#: c-api/intro.rst:432 +#: c-api/intro.rst:488 msgid "" "Equivalent code for populating a list can be written using :c:func:" "`PyList_New` and :c:func:`PyList_SetItem`." msgstr "" -#: c-api/intro.rst:435 +#: c-api/intro.rst:491 msgid "" "However, in practice, you will rarely use these ways of creating and " "populating a tuple or list. There's a generic function, :c:func:" @@ -496,7 +632,15 @@ msgid "" "be replaced by the following (which also takes care of the error checking)::" msgstr "" -#: c-api/intro.rst:446 +#: c-api/intro.rst:497 +msgid "" +"PyObject *tuple, *list;\n" +"\n" +"tuple = Py_BuildValue(\"(iis)\", 1, 2, \"three\");\n" +"list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");" +msgstr "" + +#: c-api/intro.rst:502 msgid "" "It is much more common to use :c:func:`PyObject_SetItem` and friends with " "items whose references you are only borrowing, like arguments that were " @@ -507,7 +651,31 @@ msgid "" "sequence) to a given item::" msgstr "" -#: c-api/intro.rst:476 +#: c-api/intro.rst:509 +msgid "" +"int\n" +"set_all(PyObject *target, PyObject *item)\n" +"{\n" +" Py_ssize_t i, n;\n" +"\n" +" n = PyObject_Length(target);\n" +" if (n < 0)\n" +" return -1;\n" +" for (i = 0; i < n; i++) {\n" +" PyObject *index = PyLong_FromSsize_t(i);\n" +" if (!index)\n" +" return -1;\n" +" if (PyObject_SetItem(target, index, item) < 0) {\n" +" Py_DECREF(index);\n" +" return -1;\n" +" }\n" +" Py_DECREF(index);\n" +" }\n" +" return 0;\n" +"}" +msgstr "" + +#: c-api/intro.rst:532 msgid "" "The situation is slightly different for function return values. While " "passing a reference to most functions does not change your ownership " @@ -520,7 +688,7 @@ msgid "" "becomes the owner of the reference)." msgstr "" -#: c-api/intro.rst:485 +#: c-api/intro.rst:541 msgid "" "It is important to realize that whether you own a reference returned by a " "function depends on which function you call only --- *the plumage* (the type " @@ -531,18 +699,74 @@ msgid "" "the same arguments), you do own a reference to the returned object." msgstr "" -#: c-api/intro.rst:497 +#: c-api/intro.rst:553 msgid "" "Here is an example of how you could write a function that computes the sum " "of the items in a list of integers; once using :c:func:`PyList_GetItem`, " "and once using :c:func:`PySequence_GetItem`. ::" msgstr "" -#: c-api/intro.rst:561 +#: c-api/intro.rst:557 +msgid "" +"long\n" +"sum_list(PyObject *list)\n" +"{\n" +" Py_ssize_t i, n;\n" +" long total = 0, value;\n" +" PyObject *item;\n" +"\n" +" n = PyList_Size(list);\n" +" if (n < 0)\n" +" return -1; /* Not a list */\n" +" for (i = 0; i < n; i++) {\n" +" item = PyList_GetItem(list, i); /* Can't fail */\n" +" if (!PyLong_Check(item)) continue; /* Skip non-integers */\n" +" value = PyLong_AsLong(item);\n" +" if (value == -1 && PyErr_Occurred())\n" +" /* Integer too big to fit in a C long, bail out */\n" +" return -1;\n" +" total += value;\n" +" }\n" +" return total;\n" +"}" +msgstr "" + +#: c-api/intro.rst:583 +msgid "" +"long\n" +"sum_sequence(PyObject *sequence)\n" +"{\n" +" Py_ssize_t i, n;\n" +" long total = 0, value;\n" +" PyObject *item;\n" +" n = PySequence_Length(sequence);\n" +" if (n < 0)\n" +" return -1; /* Has no length */\n" +" for (i = 0; i < n; i++) {\n" +" item = PySequence_GetItem(sequence, i);\n" +" if (item == NULL)\n" +" return -1; /* Not a sequence, or other failure */\n" +" if (PyLong_Check(item)) {\n" +" value = PyLong_AsLong(item);\n" +" Py_DECREF(item);\n" +" if (value == -1 && PyErr_Occurred())\n" +" /* Integer too big to fit in a C long, bail out */\n" +" return -1;\n" +" total += value;\n" +" }\n" +" else {\n" +" Py_DECREF(item); /* Discard reference ownership */\n" +" }\n" +" }\n" +" return total;\n" +"}" +msgstr "" + +#: c-api/intro.rst:617 msgid "Types" msgstr "" -#: c-api/intro.rst:563 +#: c-api/intro.rst:619 msgid "" "There are few other data types that play a significant role in the Python/C " "API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:" @@ -553,7 +777,7 @@ msgid "" "that use them." msgstr "" -#: c-api/intro.rst:573 +#: c-api/intro.rst:629 msgid "" "A signed integral type such that ``sizeof(Py_ssize_t) == sizeof(size_t)``. " "C99 doesn't define such a thing directly (size_t is an unsigned integral " @@ -561,11 +785,11 @@ msgid "" "positive value of type :c:type:`Py_ssize_t`." msgstr "" -#: c-api/intro.rst:582 +#: c-api/intro.rst:638 msgid "Exceptions" msgstr "" -#: c-api/intro.rst:584 +#: c-api/intro.rst:640 msgid "" "The Python programmer only needs to deal with exceptions if specific error " "handling is required; unhandled exceptions are automatically propagated to " @@ -574,7 +798,7 @@ msgid "" "stack traceback." msgstr "" -#: c-api/intro.rst:592 +#: c-api/intro.rst:648 msgid "" "For C programmers, however, error checking always has to be explicit. All " "functions in the Python/C API can raise exceptions, unless an explicit claim " @@ -589,7 +813,7 @@ msgid "" "explicitly documented." msgstr "" -#: c-api/intro.rst:607 +#: c-api/intro.rst:663 msgid "" "Exception state is maintained in per-thread storage (this is equivalent to " "using global storage in an unthreaded application). A thread can be in one " @@ -602,7 +826,7 @@ msgid "" "clears the exception state." msgstr "" -#: c-api/intro.rst:617 +#: c-api/intro.rst:673 msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " @@ -615,7 +839,7 @@ msgid "" "``sys.exc_info()`` and friends." msgstr "" -#: c-api/intro.rst:629 +#: c-api/intro.rst:685 msgid "" "Note that starting with Python 1.5, the preferred, thread-safe way to access " "the exception state from Python code is to call the function :func:`sys." @@ -629,7 +853,7 @@ msgid "" "referenced by the stack frames in the traceback." msgstr "" -#: c-api/intro.rst:640 +#: c-api/intro.rst:696 msgid "" "As a general principle, a function that calls another function to perform " "some task should check whether the called function raised an exception, and " @@ -640,7 +864,7 @@ msgid "" "of the error." msgstr "" -#: c-api/intro.rst:649 +#: c-api/intro.rst:705 msgid "" "A simple example of detecting exceptions and passing them on is shown in " "the :c:func:`!sum_sequence` example above. It so happens that this example " @@ -649,11 +873,67 @@ msgid "" "why you like Python, we show the equivalent Python code::" msgstr "" -#: c-api/intro.rst:664 +#: c-api/intro.rst:711 +msgid "" +"def incr_item(dict, key):\n" +" try:\n" +" item = dict[key]\n" +" except KeyError:\n" +" item = 0\n" +" dict[key] = item + 1" +msgstr "" + +#: c-api/intro.rst:720 msgid "Here is the corresponding C code, in all its glory::" msgstr "" -#: c-api/intro.rst:716 +#: c-api/intro.rst:722 +msgid "" +"int\n" +"incr_item(PyObject *dict, PyObject *key)\n" +"{\n" +" /* Objects all initialized to NULL for Py_XDECREF */\n" +" PyObject *item = NULL, *const_one = NULL, *incremented_item = NULL;\n" +" int rv = -1; /* Return value initialized to -1 (failure) */\n" +"\n" +" item = PyObject_GetItem(dict, key);\n" +" if (item == NULL) {\n" +" /* Handle KeyError only: */\n" +" if (!PyErr_ExceptionMatches(PyExc_KeyError))\n" +" goto error;\n" +"\n" +" /* Clear the error and use zero: */\n" +" PyErr_Clear();\n" +" item = PyLong_FromLong(0L);\n" +" if (item == NULL)\n" +" goto error;\n" +" }\n" +" const_one = PyLong_FromLong(1L);\n" +" if (const_one == NULL)\n" +" goto error;\n" +"\n" +" incremented_item = PyNumber_Add(item, const_one);\n" +" if (incremented_item == NULL)\n" +" goto error;\n" +"\n" +" if (PyObject_SetItem(dict, key, incremented_item) < 0)\n" +" goto error;\n" +" rv = 0; /* Success */\n" +" /* Continue with cleanup code */\n" +"\n" +" error:\n" +" /* Cleanup code, shared by success and failure path */\n" +"\n" +" /* Use Py_XDECREF() to ignore NULL references */\n" +" Py_XDECREF(item);\n" +" Py_XDECREF(const_one);\n" +" Py_XDECREF(incremented_item);\n" +"\n" +" return rv; /* -1 for error, 0 for success */\n" +"}" +msgstr "" + +#: c-api/intro.rst:772 msgid "" "This example represents an endorsed use of the ``goto`` statement in C! It " "illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:" @@ -666,11 +946,11 @@ msgid "" "success after the final call made is successful." msgstr "" -#: c-api/intro.rst:730 +#: c-api/intro.rst:786 msgid "Embedding Python" msgstr "" -#: c-api/intro.rst:732 +#: c-api/intro.rst:788 msgid "" "The one important task that only embedders (as opposed to extension writers) " "of the Python interpreter have to worry about is the initialization, and " @@ -678,7 +958,7 @@ msgid "" "the interpreter can only be used after the interpreter has been initialized." msgstr "" -#: c-api/intro.rst:745 +#: c-api/intro.rst:801 msgid "" "The basic initialization function is :c:func:`Py_Initialize`. This " "initializes the table of loaded modules, and creates the fundamental " @@ -686,7 +966,7 @@ msgid "" "initializes the module search path (``sys.path``)." msgstr "" -#: c-api/intro.rst:750 +#: c-api/intro.rst:806 msgid "" ":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys." "argv``). If this variable is needed by Python code that will be executed " @@ -694,7 +974,7 @@ msgid "" "must be set: see :ref:`Python Initialization Configuration `." msgstr "" -#: c-api/intro.rst:755 +#: c-api/intro.rst:811 msgid "" "On most systems (in particular, on Unix and Windows, although the details " "are slightly different), :c:func:`Py_Initialize` calculates the module " @@ -706,7 +986,7 @@ msgid "" "on the shell command search path (the environment variable :envvar:`PATH`)." msgstr "" -#: c-api/intro.rst:764 +#: c-api/intro.rst:820 msgid "" "For instance, if the Python executable is found in :file:`/usr/local/bin/" "python`, it will assume that the libraries are in :file:`/usr/local/lib/" @@ -717,18 +997,18 @@ msgid "" "in front of the standard path by setting :envvar:`PYTHONPATH`." msgstr "" -#: c-api/intro.rst:779 +#: c-api/intro.rst:834 msgid "" -"The embedding application can steer the search by calling " -"``Py_SetProgramName(file)`` *before* calling :c:func:`Py_Initialize`. Note " -"that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` is " -"still inserted in front of the standard path. An application that requires " -"total control has to provide its own implementation of :c:func:" +"The embedding application can steer the search by setting :c:member:" +"`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " +"Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` " +"is still inserted in front of the standard path. An application that " +"requires total control has to provide its own implementation of :c:func:" "`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:" "func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." msgstr "" -#: c-api/intro.rst:789 +#: c-api/intro.rst:845 msgid "" "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " "application may want to start over (make another call to :c:func:" @@ -742,18 +1022,18 @@ msgid "" "released." msgstr "" -#: c-api/intro.rst:803 +#: c-api/intro.rst:859 msgid "Debugging Builds" msgstr "" -#: c-api/intro.rst:805 +#: c-api/intro.rst:861 msgid "" "Python can be built with several macros to enable extra checks of the " "interpreter and extension modules. These checks tend to add a large amount " "of overhead to the runtime so they are not enabled by default." msgstr "" -#: c-api/intro.rst:809 +#: c-api/intro.rst:865 msgid "" "A full list of the various types of debugging builds is in the file :file:" "`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are " @@ -763,7 +1043,7 @@ msgid "" "section." msgstr "" -#: c-api/intro.rst:817 +#: c-api/intro.rst:873 msgid "" "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined " "produces what is generally meant by :ref:`a debug build of Python `." msgstr "" -#: c-api/intro.rst:828 +#: c-api/intro.rst:884 msgid "" "Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:" "`configure --with-trace-refs option <--with-trace-refs>`). When defined, a " @@ -790,136 +1070,206 @@ msgid "" "this happens after every statement run by the interpreter.)" msgstr "" -#: c-api/intro.rst:835 +#: c-api/intro.rst:891 msgid "" "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution for more detailed information." msgstr "" -#: c-api/intro.rst:288 +#: c-api/intro.rst:898 +msgid "Recommended third party tools" +msgstr "" + +#: c-api/intro.rst:900 +msgid "" +"The following third party tools offer both simpler and more sophisticated " +"approaches to creating C, C++ and Rust extensions for Python:" +msgstr "" + +#: c-api/intro.rst:903 +msgid "`Cython `_" +msgstr "" + +#: c-api/intro.rst:904 +msgid "`cffi `_" +msgstr "" + +#: c-api/intro.rst:905 +msgid "`HPy `_" +msgstr "" + +#: c-api/intro.rst:906 +msgid "`nanobind `_ (C++)" +msgstr "" + +#: c-api/intro.rst:907 +msgid "`Numba `_" +msgstr "" + +#: c-api/intro.rst:908 +msgid "`pybind11 `_ (C++)" +msgstr "" + +#: c-api/intro.rst:909 +msgid "`PyO3 `_ (Rust)" +msgstr "" + +#: c-api/intro.rst:910 +msgid "`SWIG `_" +msgstr "" + +#: c-api/intro.rst:912 +msgid "" +"Using tools such as these can help avoid writing code that is tightly bound " +"to a particular version of CPython, avoid reference counting errors, and " +"focus more on your own code than on using the CPython API. In general, new " +"versions of Python can be supported by updating the tool, and your code will " +"often use newer and more efficient APIs automatically. Some tools also " +"support compiling for other implementations of Python from a single set of " +"sources." +msgstr "" + +#: c-api/intro.rst:919 +msgid "" +"These projects are not supported by the same people who maintain Python, and " +"issues need to be raised with the projects directly. Remember to check that " +"the project is still maintained and supported, as the list above may become " +"outdated." +msgstr "" + +#: c-api/intro.rst:926 +msgid "" +"`Python Packaging User Guide: Binary Extensions `_" +msgstr "" + +#: c-api/intro.rst:927 +msgid "" +"The Python Packaging User Guide not only covers several available tools that " +"simplify the creation of binary extensions, but also discusses the various " +"reasons why creating an extension module may be desirable in the first place." +msgstr "" + +#: c-api/intro.rst:344 msgid "object" msgstr "" -#: c-api/intro.rst:288 +#: c-api/intro.rst:344 msgid "type" msgstr "" -#: c-api/intro.rst:327 +#: c-api/intro.rst:383 msgid "Py_INCREF (C function)" msgstr "" -#: c-api/intro.rst:327 +#: c-api/intro.rst:383 msgid "Py_DECREF (C function)" msgstr "" -#: c-api/intro.rst:403 +#: c-api/intro.rst:459 msgid "PyList_SetItem (C function)" msgstr "" -#: c-api/intro.rst:403 +#: c-api/intro.rst:459 msgid "PyTuple_SetItem (C function)" msgstr "" -#: c-api/intro.rst:474 +#: c-api/intro.rst:530 msgid "set_all()" msgstr "" -#: c-api/intro.rst:493 +#: c-api/intro.rst:549 msgid "PyList_GetItem (C function)" msgstr "" -#: c-api/intro.rst:493 +#: c-api/intro.rst:549 msgid "PySequence_GetItem (C function)" msgstr "" -#: c-api/intro.rst:523 +#: c-api/intro.rst:579 msgid "sum_list()" msgstr "" -#: c-api/intro.rst:647 +#: c-api/intro.rst:703 msgid "sum_sequence()" msgstr "" -#: c-api/intro.rst:590 +#: c-api/intro.rst:646 msgid "PyErr_Occurred (C function)" msgstr "" -#: c-api/intro.rst:603 +#: c-api/intro.rst:659 msgid "PyErr_SetString (C function)" msgstr "" -#: c-api/intro.rst:711 +#: c-api/intro.rst:767 msgid "PyErr_Clear (C function)" msgstr "" -#: c-api/intro.rst:627 +#: c-api/intro.rst:683 msgid "exc_info (in module sys)" msgstr "" -#: c-api/intro.rst:709 +#: c-api/intro.rst:765 msgid "incr_item()" msgstr "" -#: c-api/intro.rst:711 +#: c-api/intro.rst:767 msgid "PyErr_ExceptionMatches (C function)" msgstr "" -#: c-api/intro.rst:711 +#: c-api/intro.rst:767 msgid "Py_XDECREF (C function)" msgstr "" -#: c-api/intro.rst:737 +#: c-api/intro.rst:793 msgid "Py_Initialize (C function)" msgstr "" -#: c-api/intro.rst:737 +#: c-api/intro.rst:793 msgid "module" msgstr "" -#: c-api/intro.rst:737 +#: c-api/intro.rst:793 msgid "builtins" msgstr "" -#: c-api/intro.rst:737 +#: c-api/intro.rst:793 msgid "__main__" msgstr "" -#: c-api/intro.rst:737 +#: c-api/intro.rst:793 msgid "sys" msgstr "" -#: c-api/intro.rst:737 +#: c-api/intro.rst:793 msgid "search" msgstr "" -#: c-api/intro.rst:737 +#: c-api/intro.rst:793 msgid "path" msgstr "" -#: c-api/intro.rst:737 +#: c-api/intro.rst:793 msgid "path (in module sys)" msgstr "" -#: c-api/intro.rst:772 -msgid "Py_SetProgramName (C function)" -msgstr "" - -#: c-api/intro.rst:772 +#: c-api/intro.rst:828 msgid "Py_GetPath (C function)" msgstr "" -#: c-api/intro.rst:772 +#: c-api/intro.rst:828 msgid "Py_GetPrefix (C function)" msgstr "" -#: c-api/intro.rst:772 +#: c-api/intro.rst:828 msgid "Py_GetExecPrefix (C function)" msgstr "" -#: c-api/intro.rst:772 +#: c-api/intro.rst:828 msgid "Py_GetProgramFullPath (C function)" msgstr "" -#: c-api/intro.rst:787 +#: c-api/intro.rst:843 msgid "Py_IsInitialized (C function)" msgstr "" diff --git a/c-api/iter.po b/c-api/iter.po index 479bf149..4de2c91b 100644 --- a/c-api/iter.po +++ b/c-api/iter.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -27,16 +28,30 @@ msgstr "" #: c-api/iter.rst:12 msgid "" "Return non-zero if the object *o* can be safely passed to :c:func:" -"`PyIter_Next`, and ``0`` otherwise. This function always succeeds." +"`PyIter_NextItem` and ``0`` otherwise. This function always succeeds." msgstr "" -#: c-api/iter.rst:17 +#: c-api/iter.rst:18 msgid "" "Return non-zero if the object *o* provides the :class:`AsyncIterator` " "protocol, and ``0`` otherwise. This function always succeeds." msgstr "" -#: c-api/iter.rst:24 +#: c-api/iter.rst:25 +msgid "" +"Return ``1`` and set *item* to a :term:`strong reference` of the next value " +"of the iterator *iter* on success. Return ``0`` and set *item* to ``NULL`` " +"if there are no remaining values. Return ``-1``, set *item* to ``NULL`` and " +"set an exception on error." +msgstr "" + +#: c-api/iter.rst:34 +msgid "" +"This is an older version of :c:func:`!PyIter_NextItem`, which is retained " +"for backwards compatibility. Prefer :c:func:`PyIter_NextItem`." +msgstr "" + +#: c-api/iter.rst:38 msgid "" "Return the next value from the iterator *o*. The object must be an iterator " "according to :c:func:`PyIter_Check` (it is up to the caller to check this). " @@ -45,32 +60,26 @@ msgid "" "the exception." msgstr "" -#: c-api/iter.rst:30 -msgid "" -"To write a loop which iterates over an iterator, the C code should look " -"something like this::" -msgstr "" - -#: c-api/iter.rst:59 +#: c-api/iter.rst:46 msgid "" "The enum value used to represent different results of :c:func:`PyIter_Send`." msgstr "" -#: c-api/iter.rst:66 +#: c-api/iter.rst:53 msgid "Sends the *arg* value into the iterator *iter*. Returns:" msgstr "" -#: c-api/iter.rst:68 +#: c-api/iter.rst:55 msgid "" "``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*." msgstr "" -#: c-api/iter.rst:69 +#: c-api/iter.rst:56 msgid "" "``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*." msgstr "" -#: c-api/iter.rst:70 +#: c-api/iter.rst:57 msgid "" "``PYGEN_ERROR`` if iterator has raised and exception. *presult* is set to " "``NULL``." diff --git a/c-api/iterator.po b/c-api/iterator.po index a91c2f15..d7ed6910 100644 --- a/c-api/iterator.po +++ b/c-api/iterator.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -68,3 +69,77 @@ msgid "" "should return the next item in the iteration. When *callable* returns a " "value equal to *sentinel*, the iteration will be terminated." msgstr "" + +#: c-api/iterator.rst:56 +msgid "Range Objects" +msgstr "" + +#: c-api/iterator.rst:60 +msgid "The type object for :class:`range` objects." +msgstr "" + +#: c-api/iterator.rst:65 +msgid "" +"Return true if the object *o* is an instance of a :class:`range` object. " +"This function always succeeds." +msgstr "" + +#: c-api/iterator.rst:70 +msgid "Builtin Iterator Types" +msgstr "" + +#: c-api/iterator.rst:72 +msgid "" +"These are built-in iteration types that are included in Python's C API, but " +"provide no additional functions. They are here for completeness." +msgstr "" + +#: c-api/iterator.rst:80 +msgid "C type" +msgstr "" + +#: c-api/iterator.rst:81 +msgid "Python type" +msgstr "" + +#: c-api/iterator.rst:83 +msgid ":py:class:`enumerate`" +msgstr "" + +#: c-api/iterator.rst:85 +msgid ":py:class:`filter`" +msgstr "" + +#: c-api/iterator.rst:87 +msgid ":py:class:`map`" +msgstr "" + +#: c-api/iterator.rst:89 +msgid ":py:class:`reversed`" +msgstr "" + +#: c-api/iterator.rst:91 +msgid ":py:class:`zip`" +msgstr "" + +#: c-api/iterator.rst:95 +msgid "Other Iterator Objects" +msgstr "" + +#: c-api/iterator.rst:113 +msgid "Type objects for iterators of various built-in objects." +msgstr "" + +#: c-api/iterator.rst:115 +msgid "" +"Do not create instances of these directly; prefer calling :c:func:" +"`PyObject_GetIter` instead." +msgstr "" + +#: c-api/iterator.rst:118 +msgid "" +"Note that there is no guarantee that a given built-in type uses a given " +"iterator type. For example, iterating over :class:`range` will use one of " +"two iterator types depending on the size of the range. Other types may start " +"using a similar scheme in the future, without warning." +msgstr "" diff --git a/c-api/lifecycle.po b/c-api/lifecycle.po new file mode 100644 index 00000000..113132cf --- /dev/null +++ b/c-api/lifecycle.po @@ -0,0 +1,359 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: c-api/lifecycle.rst:6 +msgid "Object Life Cycle" +msgstr "" + +#: c-api/lifecycle.rst:8 +msgid "" +"This section explains how a type's slots relate to each other throughout the " +"life of an object. It is not intended to be a complete canonical reference " +"for the slots; instead, refer to the slot-specific documentation in :ref:" +"`type-structs` for details about a particular slot." +msgstr "" + +#: c-api/lifecycle.rst:15 +msgid "Life Events" +msgstr "" + +#: c-api/lifecycle.rst:17 +msgid "" +"The figure below illustrates the order of events that can occur throughout " +"an object's life. An arrow from *A* to *B* indicates that event *B* can " +"occur after event *A* has occurred, with the arrow's label indicating the " +"condition that must be true for *B* to occur after *A*." +msgstr "" + +#: c-api/lifecycle.rst:62 +msgid "Diagram showing events in an object's life. Explained in detail below." +msgstr "" + +#: c-api/lifecycle.rst:70 +msgid "Explanation:" +msgstr "" + +#: c-api/lifecycle.rst:72 +msgid "When a new object is constructed by calling its type:" +msgstr "" + +#: c-api/lifecycle.rst:74 +msgid ":c:member:`~PyTypeObject.tp_new` is called to create a new object." +msgstr "" + +#: c-api/lifecycle.rst:75 +msgid "" +":c:member:`~PyTypeObject.tp_alloc` is directly called by :c:member:" +"`~PyTypeObject.tp_new` to allocate the memory for the new object." +msgstr "" + +#: c-api/lifecycle.rst:78 +msgid "" +":c:member:`~PyTypeObject.tp_init` initializes the newly created object. :c:" +"member:`!tp_init` can be called again to re-initialize an object, if " +"desired. The :c:member:`!tp_init` call can also be skipped entirely, for " +"example by Python code calling :py:meth:`~object.__new__`." +msgstr "" + +#: c-api/lifecycle.rst:83 +msgid "After :c:member:`!tp_init` completes, the object is ready to use." +msgstr "" + +#: c-api/lifecycle.rst:84 +msgid "Some time after the last reference to an object is removed:" +msgstr "" + +#: c-api/lifecycle.rst:86 +msgid "" +"If an object is not marked as *finalized*, it might be finalized by marking " +"it as *finalized* and calling its :c:member:`~PyTypeObject.tp_finalize` " +"function. Python does *not* finalize an object when the last reference to " +"it is deleted; use :c:func:`PyObject_CallFinalizerFromDealloc` to ensure " +"that :c:member:`~PyTypeObject.tp_finalize` is always called." +msgstr "" + +#: c-api/lifecycle.rst:92 +msgid "" +"If the object is marked as finalized, :c:member:`~PyTypeObject.tp_clear` " +"might be called by the garbage collector to clear references held by the " +"object. It is *not* called when the object's reference count reaches zero." +msgstr "" + +#: c-api/lifecycle.rst:96 +msgid "" +":c:member:`~PyTypeObject.tp_dealloc` is called to destroy the object. To " +"avoid code duplication, :c:member:`~PyTypeObject.tp_dealloc` typically calls " +"into :c:member:`~PyTypeObject.tp_clear` to free up the object's references." +msgstr "" + +#: c-api/lifecycle.rst:100 +msgid "" +"When :c:member:`~PyTypeObject.tp_dealloc` finishes object destruction, it " +"directly calls :c:member:`~PyTypeObject.tp_free` (usually set to :c:func:" +"`PyObject_Free` or :c:func:`PyObject_GC_Del` automatically as appropriate " +"for the type) to deallocate the memory." +msgstr "" + +#: c-api/lifecycle.rst:105 +msgid "" +"The :c:member:`~PyTypeObject.tp_finalize` function is permitted to add a " +"reference to the object if desired. If it does, the object is " +"*resurrected*, preventing its pending destruction. (Only :c:member:`!" +"tp_finalize` is allowed to resurrect an object; :c:member:`~PyTypeObject." +"tp_clear` and :c:member:`~PyTypeObject.tp_dealloc` cannot without calling " +"into :c:member:`!tp_finalize`.) Resurrecting an object may or may not cause " +"the object's *finalized* mark to be removed. Currently, Python does not " +"remove the *finalized* mark from a resurrected object if it supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set) but does " +"remove the mark if the object does not support garbage collection; either or " +"both of these behaviors may change in the future." +msgstr "" + +#: c-api/lifecycle.rst:118 +msgid "" +":c:member:`~PyTypeObject.tp_dealloc` can optionally call :c:member:" +"`~PyTypeObject.tp_finalize` via :c:func:`PyObject_CallFinalizerFromDealloc` " +"if it wishes to reuse that code to help with object destruction. This is " +"recommended because it guarantees that :c:member:`!tp_finalize` is always " +"called before destruction. See the :c:member:`~PyTypeObject.tp_dealloc` " +"documentation for example code." +msgstr "" + +#: c-api/lifecycle.rst:125 +msgid "" +"If the object is a member of a :term:`cyclic isolate` and either :c:member:" +"`~PyTypeObject.tp_clear` fails to break the reference cycle or the cyclic " +"isolate is not detected (perhaps :func:`gc.disable` was called, or the :c:" +"macro:`Py_TPFLAGS_HAVE_GC` flag was erroneously omitted in one of the " +"involved types), the objects remain indefinitely uncollectable (they " +"\"leak\"). See :data:`gc.garbage`." +msgstr "" + +#: c-api/lifecycle.rst:132 +msgid "" +"If the object is marked as supporting garbage collection (the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`), the " +"following events are also possible:" +msgstr "" + +#: c-api/lifecycle.rst:136 +msgid "" +"The garbage collector occasionally calls :c:member:`~PyTypeObject." +"tp_traverse` to identify :term:`cyclic isolates `." +msgstr "" + +#: c-api/lifecycle.rst:139 +msgid "" +"When the garbage collector discovers a :term:`cyclic isolate`, it finalizes " +"one of the objects in the group by marking it as *finalized* and calling " +"its :c:member:`~PyTypeObject.tp_finalize` function, if it has one. This " +"repeats until the cyclic isolate doesn't exist or all of the objects have " +"been finalized." +msgstr "" + +#: c-api/lifecycle.rst:144 +msgid "" +":c:member:`~PyTypeObject.tp_finalize` is permitted to resurrect the object " +"by adding a reference from outside the :term:`cyclic isolate`. The new " +"reference causes the group of objects to no longer form a cyclic isolate " +"(the reference cycle may still exist, but if it does the objects are no " +"longer isolated)." +msgstr "" + +#: c-api/lifecycle.rst:149 +msgid "" +"When the garbage collector discovers a :term:`cyclic isolate` and all of the " +"objects in the group have already been marked as *finalized*, the garbage " +"collector clears one or more of the uncleared objects in the group (possibly " +"concurrently) by calling each's :c:member:`~PyTypeObject.tp_clear` " +"function. This repeats as long as the cyclic isolate still exists and not " +"all of the objects have been cleared." +msgstr "" + +#: c-api/lifecycle.rst:158 +msgid "Cyclic Isolate Destruction" +msgstr "" + +#: c-api/lifecycle.rst:160 +msgid "" +"Listed below are the stages of life of a hypothetical :term:`cyclic isolate` " +"that continues to exist after each member object is finalized or cleared. " +"It is a memory leak if a cyclic isolate progresses through all of these " +"stages; it should vanish once all objects are cleared, if not sooner. A " +"cyclic isolate can vanish either because the reference cycle is broken or " +"because the objects are no longer isolated due to finalizer resurrection " +"(see :c:member:`~PyTypeObject.tp_finalize`)." +msgstr "" + +#: c-api/lifecycle.rst:168 +msgid "" +"**Reachable** (not yet a cyclic isolate): All objects are in their normal, " +"reachable state. A reference cycle could exist, but an external reference " +"means the objects are not yet isolated." +msgstr "" + +#: c-api/lifecycle.rst:171 +msgid "" +"**Unreachable but consistent:** The final reference from outside the cyclic " +"group of objects has been removed, causing the objects to become isolated " +"(thus a cyclic isolate is born). None of the group's objects have been " +"finalized or cleared yet. The cyclic isolate remains at this stage until " +"some future run of the garbage collector (not necessarily the next run " +"because the next run might not scan every object)." +msgstr "" + +#: c-api/lifecycle.rst:177 +msgid "" +"**Mix of finalized and not finalized:** Objects in a cyclic isolate are " +"finalized one at a time, which means that there is a period of time when the " +"cyclic isolate is composed of a mix of finalized and non-finalized objects. " +"Finalization order is unspecified, so it can appear random. A finalized " +"object must behave in a sane manner when non-finalized objects interact with " +"it, and a non-finalized object must be able to tolerate the finalization of " +"an arbitrary subset of its referents." +msgstr "" + +#: c-api/lifecycle.rst:184 +msgid "" +"**All finalized:** All objects in a cyclic isolate are finalized before any " +"of them are cleared." +msgstr "" + +#: c-api/lifecycle.rst:186 +msgid "" +"**Mix of finalized and cleared:** The objects can be cleared serially or " +"concurrently (but with the :term:`GIL` held); either way, some will finish " +"before others. A finalized object must be able to tolerate the clearing of " +"a subset of its referents. :pep:`442` calls this stage \"cyclic trash\"." +msgstr "" + +#: c-api/lifecycle.rst:190 +msgid "" +"**Leaked:** If a cyclic isolate still exists after all objects in the group " +"have been finalized and cleared, then the objects remain indefinitely " +"uncollectable (see :data:`gc.garbage`). It is a bug if a cyclic isolate " +"reaches this stage---it means the :c:member:`~PyTypeObject.tp_clear` methods " +"of the participating objects have failed to break the reference cycle as " +"required." +msgstr "" + +#: c-api/lifecycle.rst:197 +msgid "" +"If :c:member:`~PyTypeObject.tp_clear` did not exist, then Python would have " +"no way to safely break a reference cycle. Simply destroying an object in a " +"cyclic isolate would result in a dangling pointer, triggering undefined " +"behavior when an object referencing the destroyed object is itself " +"destroyed. The clearing step makes object destruction a two-phase process: " +"first :c:member:`~PyTypeObject.tp_clear` is called to partially destroy the " +"objects enough to detangle them from each other, then :c:member:" +"`~PyTypeObject.tp_dealloc` is called to complete the destruction." +msgstr "" + +#: c-api/lifecycle.rst:206 +msgid "" +"Unlike clearing, finalization is not a phase of destruction. A finalized " +"object must still behave properly by continuing to fulfill its design " +"contracts. An object's finalizer is allowed to execute arbitrary Python " +"code, and is even allowed to prevent the impending destruction by adding a " +"reference. The finalizer is only related to destruction by call order---if " +"it runs, it runs before destruction, which starts with :c:member:" +"`~PyTypeObject.tp_clear` (if called) and concludes with :c:member:" +"`~PyTypeObject.tp_dealloc`." +msgstr "" + +#: c-api/lifecycle.rst:214 +msgid "" +"The finalization step is not necessary to safely reclaim the objects in a " +"cyclic isolate, but its existence makes it easier to design types that " +"behave in a sane manner when objects are cleared. Clearing an object might " +"necessarily leave it in a broken, partially destroyed state---it might be " +"unsafe to call any of the cleared object's methods or access any of its " +"attributes. With finalization, only finalized objects can possibly interact " +"with cleared objects; non-finalized objects are guaranteed to interact with " +"only non-cleared (but potentially finalized) objects." +msgstr "" + +#: c-api/lifecycle.rst:223 +msgid "To summarize the possible interactions:" +msgstr "" + +#: c-api/lifecycle.rst:225 +msgid "" +"A non-finalized object might have references to or from non-finalized and " +"finalized objects, but not to or from cleared objects." +msgstr "" + +#: c-api/lifecycle.rst:227 +msgid "" +"A finalized object might have references to or from non-finalized, " +"finalized, and cleared objects." +msgstr "" + +#: c-api/lifecycle.rst:229 +msgid "" +"A cleared object might have references to or from finalized and cleared " +"objects, but not to or from non-finalized objects." +msgstr "" + +#: c-api/lifecycle.rst:232 +msgid "" +"Without any reference cycles, an object can be simply destroyed once its " +"last reference is deleted; the finalization and clearing steps are not " +"necessary to safely reclaim unused objects. However, it can be useful to " +"automatically call :c:member:`~PyTypeObject.tp_finalize` and :c:member:" +"`~PyTypeObject.tp_clear` before destruction anyway because type design is " +"simplified when all objects always experience the same series of events " +"regardless of whether they participated in a cyclic isolate. Python " +"currently only calls :c:member:`~PyTypeObject.tp_finalize` and :c:member:" +"`~PyTypeObject.tp_clear` as needed to destroy a cyclic isolate; this may " +"change in a future version." +msgstr "" + +#: c-api/lifecycle.rst:244 +msgid "Functions" +msgstr "" + +#: c-api/lifecycle.rst:246 +msgid "To allocate and free memory, see :ref:`allocating-objects`." +msgstr "" + +#: c-api/lifecycle.rst:251 +msgid "" +"Finalizes the object as described in :c:member:`~PyTypeObject.tp_finalize`. " +"Call this function (or :c:func:`PyObject_CallFinalizerFromDealloc`) instead " +"of calling :c:member:`~PyTypeObject.tp_finalize` directly because this " +"function may deduplicate multiple calls to :c:member:`!tp_finalize`. " +"Currently, calls are only deduplicated if the type supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set); this may " +"change in the future." +msgstr "" + +#: c-api/lifecycle.rst:262 +msgid "" +"Same as :c:func:`PyObject_CallFinalizer` but meant to be called at the " +"beginning of the object's destructor (:c:member:`~PyTypeObject.tp_dealloc`). " +"There must not be any references to the object. If the object's finalizer " +"resurrects the object, this function returns -1; no further destruction " +"should happen. Otherwise, this function returns 0 and destruction can " +"continue normally." +msgstr "" + +#: c-api/lifecycle.rst:271 +msgid ":c:member:`~PyTypeObject.tp_dealloc` for example code." +msgstr "" diff --git a/c-api/list.po b/c-api/list.po index 5df947f6..cad8b4fc 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -49,74 +50,89 @@ msgstr "" #: c-api/list.rst:40 msgid "" "If *len* is greater than zero, the returned list object's items are set to " -"``NULL``. Thus you cannot use abstract API functions such as :c:func:" -"`PySequence_SetItem` or expose the object to Python code before setting all " -"items to a real object with :c:func:`PyList_SetItem`." +"``NULL``. Thus you cannot use abstract API functions such as :c:func:" +"`PySequence_SetItem` or expose the object to Python code before setting all " +"items to a real object with :c:func:`PyList_SetItem` or :c:func:" +"`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is " +"fully initialized: :c:func:`PyList_SetItem()` and :c:func:" +"`PyList_SET_ITEM()`." msgstr "" -#: c-api/list.rst:50 +#: c-api/list.rst:53 msgid "" "Return the length of the list object in *list*; this is equivalent to " "``len(list)`` on a list object." msgstr "" -#: c-api/list.rst:56 +#: c-api/list.rst:59 msgid "Similar to :c:func:`PyList_Size`, but without error checking." msgstr "" -#: c-api/list.rst:61 +#: c-api/list.rst:64 msgid "" "Return the object at position *index* in the list pointed to by *list*. The " "position must be non-negative; indexing from the end of the list is not " -"supported. If *index* is out of bounds (<0 or >=len(list)), return ``NULL`` " -"and set an :exc:`IndexError` exception." +"supported. If *index* is out of bounds (:code:`<0 or >=len(list)`), return " +"``NULL`` and set an :exc:`IndexError` exception." msgstr "" -#: c-api/list.rst:69 +#: c-api/list.rst:74 +msgid "" +"Like :c:func:`PyList_GetItemRef`, but returns a :term:`borrowed reference` " +"instead of a :term:`strong reference`." +msgstr "" + +#: c-api/list.rst:80 msgid "Similar to :c:func:`PyList_GetItem`, but without error checking." msgstr "" -#: c-api/list.rst:74 +#: c-api/list.rst:85 msgid "" "Set the item at index *index* in list to *item*. Return ``0`` on success. " "If *index* is out of bounds, return ``-1`` and set an :exc:`IndexError` " "exception." msgstr "" -#: c-api/list.rst:80 +#: c-api/list.rst:91 msgid "" "This function \"steals\" a reference to *item* and discards a reference to " "an item already in the list at the affected position." msgstr "" -#: c-api/list.rst:86 +#: c-api/list.rst:97 msgid "" "Macro form of :c:func:`PyList_SetItem` without error checking. This is " "normally only used to fill in new lists where there is no previous content." msgstr "" -#: c-api/list.rst:91 +#: c-api/list.rst:100 +msgid "" +"Bounds checking is performed as an assertion if Python is built in :ref:" +"`debug mode ` or :option:`with assertions <--with-assertions>`." +msgstr "" + +#: c-api/list.rst:106 msgid "" "This macro \"steals\" a reference to *item*, and, unlike :c:func:" "`PyList_SetItem`, does *not* discard a reference to any item that is being " "replaced; any reference in *list* at position *i* will be leaked." msgstr "" -#: c-api/list.rst:99 +#: c-api/list.rst:114 msgid "" "Insert the item *item* into list *list* in front of index *index*. Return " "``0`` if successful; return ``-1`` and set an exception if unsuccessful. " "Analogous to ``list.insert(index, item)``." msgstr "" -#: c-api/list.rst:106 +#: c-api/list.rst:121 msgid "" "Append the object *item* at the end of list *list*. Return ``0`` if " "successful; return ``-1`` and set an exception if unsuccessful. Analogous " "to ``list.append(item)``." msgstr "" -#: c-api/list.rst:113 +#: c-api/list.rst:128 msgid "" "Return a list of the objects in *list* containing the objects *between* " "*low* and *high*. Return ``NULL`` and set an exception if unsuccessful. " @@ -124,7 +140,7 @@ msgid "" "supported." msgstr "" -#: c-api/list.rst:120 +#: c-api/list.rst:135 msgid "" "Set the slice of *list* between *low* and *high* to the contents of " "*itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may " @@ -133,19 +149,45 @@ msgid "" "list is not supported." msgstr "" -#: c-api/list.rst:129 +#: c-api/list.rst:144 +msgid "" +"Extend *list* with the contents of *iterable*. This is the same as " +"``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` and " +"analogous to ``list.extend(iterable)`` or ``list += iterable``." +msgstr "" + +#: c-api/list.rst:148 +msgid "" +"Raise an exception and return ``-1`` if *list* is not a :class:`list` " +"object. Return 0 on success." +msgstr "" + +#: c-api/list.rst:156 +msgid "" +"Remove all items from *list*. This is the same as ``PyList_SetSlice(list, " +"0, PY_SSIZE_T_MAX, NULL)`` and analogous to ``list.clear()`` or ``del " +"list[:]``." +msgstr "" + +#: c-api/list.rst:160 +msgid "" +"Raise an exception and return ``-1`` if *list* is not a :class:`list` " +"object. Return 0 on success." +msgstr "" + +#: c-api/list.rst:168 msgid "" "Sort the items of *list* in place. Return ``0`` on success, ``-1`` on " "failure. This is equivalent to ``list.sort()``." msgstr "" -#: c-api/list.rst:135 +#: c-api/list.rst:174 msgid "" "Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on " "failure. This is the equivalent of ``list.reverse()``." msgstr "" -#: c-api/list.rst:143 +#: c-api/list.rst:182 msgid "" "Return a new tuple object containing the contents of *list*; equivalent to " "``tuple(list)``." @@ -159,14 +201,14 @@ msgstr "" msgid "list" msgstr "" -#: c-api/list.rst:141 +#: c-api/list.rst:180 msgid "built-in function" msgstr "" -#: c-api/list.rst:48 +#: c-api/list.rst:51 msgid "len" msgstr "" -#: c-api/list.rst:141 +#: c-api/list.rst:180 msgid "tuple" msgstr "" diff --git a/c-api/long.po b/c-api/long.po index 371927e5..c8f68b4c 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -59,50 +60,63 @@ msgid "" "Return a new :c:type:`PyLongObject` object from *v*, or ``NULL`` on failure." msgstr "" -#: c-api/long.rst:43 +#: c-api/long.rst:45 msgid "" -"The current implementation keeps an array of integer objects for all " -"integers between ``-5`` and ``256``. When you create an int in that range " -"you actually just get back a reference to the existing object." +"CPython keeps an array of integer objects for all integers between ``-5`` " +"and ``256``. When you create an int in that range you actually just get " +"back a reference to the existing object." msgstr "" -#: c-api/long.rst:50 +#: c-api/long.rst:52 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long`, " "or ``NULL`` on failure." msgstr "" -#: c-api/long.rst:56 +#: c-api/long.rst:58 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:type:`Py_ssize_t`, or " "``NULL`` on failure." msgstr "" -#: c-api/long.rst:62 +#: c-api/long.rst:64 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:type:`size_t`, or " "``NULL`` on failure." msgstr "" -#: c-api/long.rst:68 +#: c-api/long.rst:70 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:expr:`long long`, or " "``NULL`` on failure." msgstr "" -#: c-api/long.rst:74 +#: c-api/long.rst:77 +msgid "" +"Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` " +"or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure." +msgstr "" + +#: c-api/long.rst:86 msgid "" "Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long " "long`, or ``NULL`` on failure." msgstr "" -#: c-api/long.rst:80 +#: c-api/long.rst:93 +msgid "" +"Return a new :c:type:`PyLongObject` object from an unsigned C :c:expr:" +"`uint32_t` or :c:expr:`uint64_t`, or ``NULL`` with an exception set on " +"failure." +msgstr "" + +#: c-api/long.rst:102 msgid "" "Return a new :c:type:`PyLongObject` object from the integer part of *v*, or " "``NULL`` on failure." msgstr "" -#: c-api/long.rst:86 +#: c-api/long.rst:108 msgid "" "Return a new :c:type:`PyLongObject` based on the string value in *str*, " "which is interpreted according to the radix in *base*, or ``NULL`` on " @@ -117,51 +131,106 @@ msgid "" "whitespace, :exc:`ValueError` will be raised." msgstr "" -#: c-api/long.rst:97 +#: c-api/long.rst:119 msgid "" -"Python methods :meth:`int.to_bytes` and :meth:`int.from_bytes` to convert a :" -"c:type:`PyLongObject` to/from an array of bytes in base ``256``. You can " -"call those from C using :c:func:`PyObject_CallMethod`." +":c:func:`PyLong_AsNativeBytes()` and :c:func:`PyLong_FromNativeBytes()` " +"functions can be used to convert a :c:type:`PyLongObject` to/from an array " +"of bytes in base ``256``." msgstr "" -#: c-api/long.rst:104 +#: c-api/long.rst:126 msgid "" "Convert a sequence of Unicode digits in the string *u* to a Python integer " "value." msgstr "" -#: c-api/long.rst:112 +#: c-api/long.rst:134 msgid "" "Create a Python integer from the pointer *p*. The pointer value can be " "retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`." msgstr "" -#: c-api/long.rst:141 +#: c-api/long.rst:140 +msgid "" +"Create a Python integer from the value contained in the first *n_bytes* of " +"*buffer*, interpreted as a two's-complement signed number." +msgstr "" + +#: c-api/long.rst:143 +msgid "" +"*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " +"select the native endian that CPython was compiled with and assume that the " +"most-significant bit is a sign bit. Passing " +"``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` will produce the same result as " +"calling :c:func:`PyLong_FromUnsignedNativeBytes`. Other flags are ignored." +msgstr "" + +#: c-api/long.rst:154 +msgid "" +"Create a Python integer from the value contained in the first *n_bytes* of " +"*buffer*, interpreted as an unsigned number." +msgstr "" + +#: c-api/long.rst:157 +msgid "" +"*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " +"select the native endian that CPython was compiled with and assume that the " +"most-significant bit is not a sign bit. Flags other than endian are ignored." +msgstr "" + +#: c-api/long.rst:166 +msgid "Macro for creating a Python integer from a process identifier." +msgstr "" + +#: c-api/long.rst:168 +msgid "" +"This can be defined as an alias to :c:func:`PyLong_FromLong` or :c:func:" +"`PyLong_FromLongLong`, depending on the size of the system's PID type." +msgstr "" + +#: c-api/long.rst:217 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:127 +#: c-api/long.rst:185 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long`." msgstr "" -#: c-api/long.rst:150 c-api/long.rst:191 c-api/long.rst:214 +#: c-api/long.rst:226 c-api/long.rst:267 c-api/long.rst:290 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: c-api/long.rst:152 c-api/long.rst:195 c-api/long.rst:299 +#: c-api/long.rst:228 c-api/long.rst:271 c-api/long.rst:375 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: c-api/long.rst:155 c-api/long.rst:198 c-api/long.rst:302 +#: c-api/long.rst:231 c-api/long.rst:274 c-api/long.rst:378 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" -#: c-api/long.rst:145 +#: c-api/long.rst:200 +msgid "" +"A :term:`soft deprecated` alias. Exactly equivalent to the preferred " +"``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or " +"another exception." +msgstr "" + +#: c-api/long.rst:204 +msgid "The function is soft deprecated." +msgstr "" + +#: c-api/long.rst:209 +msgid "" +"Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:" +"`int` instead of a C :c:expr:`long`." +msgstr "" + +#: c-api/long.rst:221 msgid "" "If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:" "macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -169,20 +238,20 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: c-api/long.rst:182 +#: c-api/long.rst:258 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:168 +#: c-api/long.rst:244 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long long`." msgstr "" -#: c-api/long.rst:186 +#: c-api/long.rst:262 msgid "" "If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:" "macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -190,133 +259,170 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: c-api/long.rst:208 +#: c-api/long.rst:284 msgid "" "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " "be an instance of :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:211 +#: c-api/long.rst:287 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`Py_ssize_t`." msgstr "" -#: c-api/long.rst:223 +#: c-api/long.rst:299 msgid "" "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " "must be an instance of :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:226 +#: c-api/long.rst:302 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`unsigned long`." msgstr "" -#: c-api/long.rst:229 +#: c-api/long.rst:305 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: c-api/long.rst:239 +#: c-api/long.rst:315 msgid "" "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:242 +#: c-api/long.rst:318 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`size_t`." msgstr "" -#: c-api/long.rst:245 +#: c-api/long.rst:321 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: c-api/long.rst:254 +#: c-api/long.rst:330 msgid "" "Return a C :c:expr:`unsigned long long` representation of *pylong*. " "*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:257 +#: c-api/long.rst:333 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :" "c:expr:`unsigned long long`." msgstr "" -#: c-api/long.rst:260 +#: c-api/long.rst:336 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: c-api/long.rst:263 +#: c-api/long.rst:339 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: c-api/long.rst:269 +#: c-api/long.rst:345 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " "an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:273 +#: c-api/long.rst:349 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long`, return " "the reduction of that value modulo ``ULONG_MAX + 1``." msgstr "" -#: c-api/long.rst:276 +#: c-api/long.rst:352 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: c-api/long.rst:288 +#: c-api/long.rst:364 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " "is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:293 +#: c-api/long.rst:369 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long long`, " "return the reduction of that value modulo ``ULLONG_MAX + 1``." msgstr "" -#: c-api/long.rst:296 +#: c-api/long.rst:372 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: c-api/long.rst:308 +#: c-api/long.rst:385 +msgid "" +"Set *\\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t` " +"representation of *obj*." +msgstr "" + +#: c-api/long.rst:408 +msgid "" +"If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:" +"`~object.__index__` method (if present) to convert it to a :c:type:" +"`PyLongObject`." +msgstr "" + +#: c-api/long.rst:413 +msgid "If the *obj* value is out of range, raise an :exc:`OverflowError`." +msgstr "" + +#: c-api/long.rst:415 +msgid "" +"Set *\\*value* and return ``0`` on success. Set an exception and return " +"``-1`` on error." +msgstr "" + +#: c-api/long.rst:418 +msgid "*value* must not be ``NULL``." +msgstr "" + +#: c-api/long.rst:405 +msgid "" +"Set *\\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` " +"representation of *obj*." +msgstr "" + +#: c-api/long.rst:412 +msgid "If *obj* is negative, raise a :exc:`ValueError`." +msgstr "" + +#: c-api/long.rst:425 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: c-api/long.rst:311 +#: c-api/long.rst:428 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`double`." msgstr "" -#: c-api/long.rst:314 +#: c-api/long.rst:431 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: c-api/long.rst:319 +#: c-api/long.rst:436 msgid "" "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " "cannot be converted, an :exc:`OverflowError` will be raised. This is only " @@ -324,44 +430,572 @@ msgid "" "c:func:`PyLong_FromVoidPtr`." msgstr "" -#: c-api/long.rst:324 +#: c-api/long.rst:441 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: c-api/long.rst:329 +#: c-api/long.rst:446 +msgid "" +"Copy the Python integer value *pylong* to a native *buffer* of size " +"*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " +"or to values documented below to control the behavior." +msgstr "" + +#: c-api/long.rst:450 +msgid "" +"Returns ``-1`` with an exception raised on error. This may happen if " +"*pylong* cannot be interpreted as an integer, or if *pylong* was negative " +"and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." +msgstr "" + +#: c-api/long.rst:454 +msgid "" +"Otherwise, returns the number of bytes required to store the value. If this " +"is equal to or less than *n_bytes*, the entire value was copied. All " +"*n_bytes* of the buffer are written: large buffers are padded with zeroes." +msgstr "" + +#: c-api/long.rst:459 +msgid "" +"If the returned value is greater than *n_bytes*, the value was truncated: as " +"many of the lowest bits of the value as could fit are written, and the " +"higher bits are ignored. This matches the typical behavior of a C-style " +"downcast." +msgstr "" + +#: c-api/long.rst:466 +msgid "" +"Overflow is not considered an error. If the returned value is larger than " +"*n_bytes*, most significant bits were discarded." +msgstr "" + +#: c-api/long.rst:469 +msgid "``0`` will never be returned." +msgstr "" + +#: c-api/long.rst:471 +msgid "Values are always copied as two's-complement." +msgstr "" + +#: c-api/long.rst:473 +msgid "Usage example::" +msgstr "" + +#: c-api/long.rst:475 +msgid "" +"int32_t value;\n" +"Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" +"if (bytes < 0) {\n" +" // Failed. A Python exception was set with the reason.\n" +" return NULL;\n" +"}\n" +"else if (bytes <= (Py_ssize_t)sizeof(value)) {\n" +" // Success!\n" +"}\n" +"else {\n" +" // Overflow occurred, but 'value' contains the truncated\n" +" // lowest bits of pylong.\n" +"}" +msgstr "" + +#: c-api/long.rst:489 +msgid "" +"Passing zero to *n_bytes* will return the size of a buffer that would be " +"large enough to hold the value. This may be larger than technically " +"necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." +msgstr "" + +#: c-api/long.rst:496 +msgid "" +"Passing *n_bytes=0* to this function is not an accurate way to determine the " +"bit length of the value." +msgstr "" + +#: c-api/long.rst:499 +msgid "" +"To get at the entire Python value of an unknown size, the function can be " +"called twice: first to determine the buffer size, then to fill it::" +msgstr "" + +#: c-api/long.rst:502 +msgid "" +"// Ask how much space we need.\n" +"Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" +"if (expected < 0) {\n" +" // Failed. A Python exception was set with the reason.\n" +" return NULL;\n" +"}\n" +"assert(expected != 0); // Impossible per the API definition.\n" +"uint8_t *bignum = malloc(expected);\n" +"if (!bignum) {\n" +" PyErr_SetString(PyExc_MemoryError, \"bignum malloc failed.\");\n" +" return NULL;\n" +"}\n" +"// Safely get the entire value.\n" +"Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, bignum, expected, -1);\n" +"if (bytes < 0) { // Exception has been set.\n" +" free(bignum);\n" +" return NULL;\n" +"}\n" +"else if (bytes > expected) { // This should not be possible.\n" +" PyErr_SetString(PyExc_RuntimeError,\n" +" \"Unexpected bignum truncation after a size check.\");\n" +" free(bignum);\n" +" return NULL;\n" +"}\n" +"// The expected success given the above pre-check.\n" +"// ... use bignum ...\n" +"free(bignum);" +msgstr "" + +#: c-api/long.rst:530 +msgid "" +"*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " +"that behave most like a C cast, or a combination of the other flags in the " +"table below. Note that ``-1`` cannot be combined with other flags." +msgstr "" + +#: c-api/long.rst:535 +msgid "" +"Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " +"Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." +msgstr "" + +#: c-api/long.rst:541 +msgid "Flag" +msgstr "" + +#: c-api/long.rst:541 +msgid "Value" +msgstr "" + +#: c-api/long.rst:543 +msgid "``-1``" +msgstr "" + +#: c-api/long.rst:544 +msgid "``0``" +msgstr "" + +#: c-api/long.rst:545 +msgid "``1``" +msgstr "" + +#: c-api/long.rst:546 +msgid "``3``" +msgstr "" + +#: c-api/long.rst:547 +msgid "``4``" +msgstr "" + +#: c-api/long.rst:548 +msgid "``8``" +msgstr "" + +#: c-api/long.rst:549 +msgid "``16``" +msgstr "" + +#: c-api/long.rst:552 +msgid "" +"Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " +"flags. Passing ``2`` is reserved." +msgstr "" + +#: c-api/long.rst:555 +msgid "" +"By default, sufficient buffer will be requested to include a sign bit. For " +"example, when converting 128 with *n_bytes=1*, the function will return 2 " +"(or more) in order to store a zero sign bit." +msgstr "" + +#: c-api/long.rst:559 +msgid "" +"If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " +"be omitted from size calculations. This allows, for example, 128 to fit in a " +"single-byte buffer. If the destination buffer is later treated as signed, a " +"positive input value may become negative. Note that the flag does not affect " +"handling of negative values: for those, space for a sign bit is always " +"requested." +msgstr "" + +#: c-api/long.rst:566 +msgid "" +"Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " +"set if *pylong* is negative. Without this flag, negative values will be " +"copied provided there is enough space for at least one sign bit, regardless " +"of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." +msgstr "" + +#: c-api/long.rst:571 +msgid "" +"If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " +"passed, its :meth:`~object.__index__` method will be called first. This may " +"result in Python code executing and other threads being allowed to run, " +"which could cause changes to other objects or values in use. When *flags* is " +"``-1``, this option is not set, and non-integer values will raise :exc:" +"`TypeError`." +msgstr "" + +#: c-api/long.rst:580 +msgid "" +"With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " +"*REJECT_NEGATIVE*), multiple Python integers can map to a single value " +"without overflow. For example, both ``255`` and ``-1`` fit a single-byte " +"buffer and set all its bits. This matches typical C cast behavior." +msgstr "" + +#: c-api/long.rst:591 +msgid "Macro for converting a Python integer into a process identifier." +msgstr "" + +#: c-api/long.rst:593 +msgid "" +"This can be defined as an alias to :c:func:`PyLong_AsLong`, :c:func:" +"`PyLong_FromLongLong`, or :c:func:`PyLong_AsInt`, depending on the size of " +"the system's PID type." +msgstr "" + +#: c-api/long.rst:602 +msgid "Get the sign of the integer object *obj*." +msgstr "" + +#: c-api/long.rst:604 +msgid "" +"On success, set *\\*sign* to the integer sign (0, -1 or +1 for zero, " +"negative or positive integer, respectively) and return 0." +msgstr "" + +#: c-api/long.rst:607 +msgid "" +"On failure, return -1 with an exception set. This function always succeeds " +"if *obj* is a :c:type:`PyLongObject` or its subtype." +msgstr "" + +#: c-api/long.rst:615 +msgid "Check if the integer object *obj* is positive (``obj > 0``)." +msgstr "" + +#: c-api/long.rst:617 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's positive and ``0`` otherwise. Else set an exception and " +"return ``-1``." +msgstr "" + +#: c-api/long.rst:626 +msgid "Check if the integer object *obj* is negative (``obj < 0``)." +msgstr "" + +#: c-api/long.rst:628 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's negative and ``0`` otherwise. Else set an exception and " +"return ``-1``." +msgstr "" + +#: c-api/long.rst:637 +msgid "Check if the integer object *obj* is zero." +msgstr "" + +#: c-api/long.rst:639 +msgid "" +"If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " +"``1`` when it's zero and ``0`` otherwise. Else set an exception and return " +"``-1``." +msgstr "" + +#: c-api/long.rst:648 +msgid "" +"On success, return a read only :term:`named tuple`, that holds information " +"about Python's internal representation of integers. See :data:`sys.int_info` " +"for description of individual fields." +msgstr "" + +#: c-api/long.rst:652 +msgid "On failure, return ``NULL`` with an exception set." +msgstr "" + +#: c-api/long.rst:659 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: c-api/long.rst:331 +#: c-api/long.rst:661 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" "`PyUnstable_Long_CompactValue`; for others fall back to a :c:func:" -"`PyLong_As* ` function or :c:func:`calling " -"` :meth:`int.to_bytes`." +"`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: c-api/long.rst:337 +#: c-api/long.rst:667 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: c-api/long.rst:339 +#: c-api/long.rst:669 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: c-api/long.rst:344 +#: c-api/long.rst:677 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: c-api/long.rst:347 +#: c-api/long.rst:680 msgid "Otherwise, the return value is undefined." msgstr "" +#: c-api/long.rst:686 +msgid "Export API" +msgstr "" + +#: c-api/long.rst:692 +msgid "" +"Layout of an array of \"digits\" (\"limbs\" in the GMP terminology), used to " +"represent absolute value for arbitrary precision integers." +msgstr "" + +#: c-api/long.rst:695 +msgid "" +"Use :c:func:`PyLong_GetNativeLayout` to get the native layout of Python :" +"class:`int` objects, used internally for integers with \"big enough\" " +"absolute value." +msgstr "" + +#: c-api/long.rst:699 +msgid "" +"See also :data:`sys.int_info` which exposes similar information in Python." +msgstr "" + +#: c-api/long.rst:703 +msgid "" +"Bits per digit. For example, a 15 bit digit means that bits 0-14 contain " +"meaningful information." +msgstr "" + +#: c-api/long.rst:708 +msgid "" +"Digit size in bytes. For example, a 15 bit digit will require at least 2 " +"bytes." +msgstr "" + +#: c-api/long.rst:713 +msgid "Digits order:" +msgstr "" + +#: c-api/long.rst:715 +msgid "``1`` for most significant digit first" +msgstr "" + +#: c-api/long.rst:716 +msgid "``-1`` for least significant digit first" +msgstr "" + +#: c-api/long.rst:720 +msgid "Digit endianness:" +msgstr "" + +#: c-api/long.rst:722 +msgid "``1`` for most significant byte first (big endian)" +msgstr "" + +#: c-api/long.rst:723 +msgid "``-1`` for least significant byte first (little endian)" +msgstr "" + +#: c-api/long.rst:728 +msgid "Get the native layout of Python :class:`int` objects." +msgstr "" + +#: c-api/long.rst:730 +msgid "See the :c:struct:`PyLongLayout` structure." +msgstr "" + +#: c-api/long.rst:732 +msgid "" +"The function must not be called before Python initialization nor after " +"Python finalization. The returned layout is valid until Python is finalized. " +"The layout is the same for all Python sub-interpreters in a process, and so " +"it can be cached." +msgstr "" + +#: c-api/long.rst:740 +msgid "Export of a Python :class:`int` object." +msgstr "" + +#: c-api/long.rst:742 +msgid "There are two cases:" +msgstr "" + +#: c-api/long.rst:744 +msgid "" +"If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member." +msgstr "" + +#: c-api/long.rst:745 +msgid "" +"If :c:member:`digits` is not ``NULL``, use :c:member:`negative`, :c:member:" +"`ndigits` and :c:member:`digits` members." +msgstr "" + +#: c-api/long.rst:750 +msgid "" +"The native integer value of the exported :class:`int` object. Only valid if :" +"c:member:`digits` is ``NULL``." +msgstr "" + +#: c-api/long.rst:755 +msgid "" +"``1`` if the number is negative, ``0`` otherwise. Only valid if :c:member:" +"`digits` is not ``NULL``." +msgstr "" + +#: c-api/long.rst:760 +msgid "" +"Number of digits in :c:member:`digits` array. Only valid if :c:member:" +"`digits` is not ``NULL``." +msgstr "" + +#: c-api/long.rst:765 +msgid "Read-only array of unsigned digits. Can be ``NULL``." +msgstr "" + +#: c-api/long.rst:770 +msgid "Export a Python :class:`int` object." +msgstr "" + +#: c-api/long.rst:772 +msgid "" +"*export_long* must point to a :c:struct:`PyLongExport` structure allocated " +"by the caller. It must not be ``NULL``." +msgstr "" + +#: c-api/long.rst:775 +msgid "" +"On success, fill in *\\*export_long* and return ``0``. On error, set an " +"exception and return ``-1``." +msgstr "" + +#: c-api/long.rst:778 +msgid "" +":c:func:`PyLong_FreeExport` must be called when the export is no longer " +"needed." +msgstr "" + +#: c-api/long.rst:782 +msgid "" +"This function always succeeds if *obj* is a Python :class:`int` object or a " +"subclass." +msgstr "" + +#: c-api/long.rst:788 +msgid "Release the export *export_long* created by :c:func:`PyLong_Export`." +msgstr "" + +#: c-api/long.rst:791 +msgid "" +"Calling :c:func:`PyLong_FreeExport` is optional if *export_long->digits* is " +"``NULL``." +msgstr "" + +#: c-api/long.rst:796 +msgid "PyLongWriter API" +msgstr "" + +#: c-api/long.rst:798 +msgid "The :c:type:`PyLongWriter` API can be used to import an integer." +msgstr "" + +#: c-api/long.rst:804 +msgid "A Python :class:`int` writer instance." +msgstr "" + +#: c-api/long.rst:806 +msgid "" +"The instance must be destroyed by :c:func:`PyLongWriter_Finish` or :c:func:" +"`PyLongWriter_Discard`." +msgstr "" + +#: c-api/long.rst:812 +msgid "Create a :c:type:`PyLongWriter`." +msgstr "" + +#: c-api/long.rst:814 +msgid "" +"On success, allocate *\\*digits* and return a writer. On error, set an " +"exception and return ``NULL``." +msgstr "" + +#: c-api/long.rst:817 +msgid "*negative* is ``1`` if the number is negative, or ``0`` otherwise." +msgstr "" + +#: c-api/long.rst:819 +msgid "" +"*ndigits* is the number of digits in the *digits* array. It must be greater " +"than 0." +msgstr "" + +#: c-api/long.rst:822 +msgid "*digits* must not be NULL." +msgstr "" + +#: c-api/long.rst:824 +msgid "" +"After a successful call to this function, the caller should fill in the " +"array of digits *digits* and then call :c:func:`PyLongWriter_Finish` to get " +"a Python :class:`int`. The layout of *digits* is described by :c:func:" +"`PyLong_GetNativeLayout`." +msgstr "" + +#: c-api/long.rst:829 +msgid "" +"Digits must be in the range [``0``; ``(1 << bits_per_digit) - 1``] (where " +"the :c:struct:`~PyLongLayout.bits_per_digit` is the number of bits per " +"digit). Any unused most significant digits must be set to ``0``." +msgstr "" + +#: c-api/long.rst:834 +msgid "" +"Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer " +"instance without creating an :class:`~int` object." +msgstr "" + +#: c-api/long.rst:840 +msgid "" +"Finish a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." +msgstr "" + +#: c-api/long.rst:842 +msgid "" +"On success, return a Python :class:`int` object. On error, set an exception " +"and return ``NULL``." +msgstr "" + +#: c-api/long.rst:845 +msgid "" +"The function takes care of normalizing the digits and converts the object to " +"a compact integer if needed." +msgstr "" + +#: c-api/long.rst:857 +msgid "The writer instance and the *digits* array are invalid after the call." +msgstr "" + +#: c-api/long.rst:853 +msgid "" +"Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." +msgstr "" + +#: c-api/long.rst:855 +msgid "If *writer* is ``NULL``, no operation is performed." +msgstr "" + #: c-api/long.rst:8 msgid "object" msgstr "" @@ -374,22 +1008,22 @@ msgstr "" msgid "integer" msgstr "" -#: c-api/long.rst:119 +#: c-api/long.rst:177 msgid "LONG_MAX (C macro)" msgstr "" -#: c-api/long.rst:161 c-api/long.rst:219 c-api/long.rst:251 +#: c-api/long.rst:237 c-api/long.rst:295 c-api/long.rst:327 msgid "OverflowError (built-in exception)" msgstr "" -#: c-api/long.rst:204 +#: c-api/long.rst:280 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "" -#: c-api/long.rst:219 +#: c-api/long.rst:295 msgid "ULONG_MAX (C macro)" msgstr "" -#: c-api/long.rst:235 +#: c-api/long.rst:311 msgid "SIZE_MAX (C macro)" msgstr "" diff --git a/c-api/mapping.po b/c-api/mapping.po index 2d9ecd31..ee5e46af 100644 --- a/c-api/mapping.po +++ b/c-api/mapping.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -50,67 +51,106 @@ msgstr "" #: c-api/mapping.rst:38 msgid "" +"Variant of :c:func:`PyObject_GetItem` which doesn't raise :exc:`KeyError` if " +"the key is not found." +msgstr "" + +#: c-api/mapping.rst:41 +msgid "" +"If the key is found, return ``1`` and set *\\*result* to a new :term:`strong " +"reference` to the corresponding value. If the key is not found, return ``0`` " +"and set *\\*result* to ``NULL``; the :exc:`KeyError` is silenced. If an " +"error other than :exc:`KeyError` is raised, return ``-1`` and set " +"*\\*result* to ``NULL``." +msgstr "" + +#: c-api/mapping.rst:53 +msgid "" +"This is the same as :c:func:`PyMapping_GetOptionalItem`, but *key* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" + +#: c-api/mapping.rst:62 +msgid "" "This is the same as :c:func:`PyObject_SetItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/mapping.rst:45 +#: c-api/mapping.rst:69 msgid "This is an alias of :c:func:`PyObject_DelItem`." msgstr "" -#: c-api/mapping.rst:50 +#: c-api/mapping.rst:74 msgid "" "This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/mapping.rst:57 +#: c-api/mapping.rst:81 +msgid "" +"Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " +"This is equivalent to the Python expression ``key in o``. On failure, return " +"``-1``." +msgstr "" + +#: c-api/mapping.rst:90 +msgid "" +"This is the same as :c:func:`PyMapping_HasKeyWithError`, but *key* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" + +#: c-api/mapping.rst:99 msgid "" "Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " "This is equivalent to the Python expression ``key in o``. This function " "always succeeds." msgstr "" -#: c-api/mapping.rst:63 +#: c-api/mapping.rst:105 msgid "" -"Exceptions which occur when this calls :meth:`~object.__getitem__` method " -"are silently ignored. For proper error handling, use :c:func:" +"Exceptions which occur when this calls the :meth:`~object.__getitem__` " +"method are silently ignored. For proper error handling, use :c:func:" +"`PyMapping_HasKeyWithError`, :c:func:`PyMapping_GetOptionalItem` or :c:func:" "`PyObject_GetItem()` instead." msgstr "" -#: c-api/mapping.rst:70 +#: c-api/mapping.rst:113 msgid "" "This is the same as :c:func:`PyMapping_HasKey`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/mapping.rst:76 +#: c-api/mapping.rst:119 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getitem__` method or " -"while creating the temporary :class:`str` object are silently ignored. For " -"proper error handling, use :c:func:`PyMapping_GetItemString` instead." +"Exceptions that occur when this calls the :meth:`~object.__getitem__` method " +"or while creating the temporary :class:`str` object are silently ignored. " +"For proper error handling, use :c:func:`PyMapping_HasKeyStringWithError`, :c:" +"func:`PyMapping_GetOptionalItemString` or :c:func:`PyMapping_GetItemString` " +"instead." msgstr "" -#: c-api/mapping.rst:84 +#: c-api/mapping.rst:129 msgid "" "On success, return a list of the keys in object *o*. On failure, return " "``NULL``." msgstr "" -#: c-api/mapping.rst:96 c-api/mapping.rst:105 +#: c-api/mapping.rst:141 c-api/mapping.rst:150 msgid "Previously, the function returned a list or a tuple." msgstr "" -#: c-api/mapping.rst:93 +#: c-api/mapping.rst:138 msgid "" "On success, return a list of the values in object *o*. On failure, return " "``NULL``." msgstr "" -#: c-api/mapping.rst:102 +#: c-api/mapping.rst:147 msgid "" "On success, return a list of the items in object *o*, where each item is a " "tuple containing a key-value pair. On failure, return ``NULL``." diff --git a/c-api/marshal.po b/c-api/marshal.po index 108d1bc0..f5a76639 100644 --- a/c-api/marshal.po +++ b/c-api/marshal.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -35,85 +36,87 @@ msgstr "" #: c-api/marshal.rst:16 msgid "" -"The module supports two versions of the data format: version 0 is the " -"historical version, version 1 shares interned strings in the file, and upon " -"unmarshalling. Version 2 uses a binary format for floating point numbers. " -"``Py_MARSHAL_VERSION`` indicates the current file format (currently 2)." +"The module supports several versions of the data format; see the :py:mod:" +"`Python module documentation ` for details." msgstr "" -#: c-api/marshal.rst:24 +#: c-api/marshal.rst:21 +msgid "The current format version. See :py:data:`marshal.version`." +msgstr "" + +#: c-api/marshal.rst:25 msgid "" "Marshal a :c:expr:`long` integer, *value*, to *file*. This will only write " "the least-significant 32 bits of *value*; regardless of the size of the " "native :c:expr:`long` type. *version* indicates the file format." msgstr "" -#: c-api/marshal.rst:36 +#: c-api/marshal.rst:37 msgid "" "This function can fail, in which case it sets the error indicator. Use :c:" "func:`PyErr_Occurred` to check for that." msgstr "" -#: c-api/marshal.rst:33 +#: c-api/marshal.rst:34 msgid "" "Marshal a Python object, *value*, to *file*. *version* indicates the file " "format." msgstr "" -#: c-api/marshal.rst:41 +#: c-api/marshal.rst:42 msgid "" "Return a bytes object containing the marshalled representation of *value*. " "*version* indicates the file format." msgstr "" -#: c-api/marshal.rst:45 +#: c-api/marshal.rst:46 msgid "The following functions allow marshalled values to be read back in." msgstr "" -#: c-api/marshal.rst:50 +#: c-api/marshal.rst:51 msgid "" "Return a C :c:expr:`long` from the data stream in a :c:expr:`FILE*` opened " "for reading. Only a 32-bit value can be read in using this function, " "regardless of the native size of :c:expr:`long`." msgstr "" -#: c-api/marshal.rst:64 +#: c-api/marshal.rst:65 msgid "" "On error, sets the appropriate exception (:exc:`EOFError`) and returns " "``-1``." msgstr "" -#: c-api/marshal.rst:60 +#: c-api/marshal.rst:61 msgid "" "Return a C :c:expr:`short` from the data stream in a :c:expr:`FILE*` opened " "for reading. Only a 16-bit value can be read in using this function, " "regardless of the native size of :c:expr:`short`." msgstr "" -#: c-api/marshal.rst:70 +#: c-api/marshal.rst:71 msgid "" "Return a Python object from the data stream in a :c:expr:`FILE*` opened for " "reading." msgstr "" -#: c-api/marshal.rst:87 c-api/marshal.rst:96 +#: c-api/marshal.rst:88 c-api/marshal.rst:97 msgid "" "On error, sets the appropriate exception (:exc:`EOFError`, :exc:`ValueError` " "or :exc:`TypeError`) and returns ``NULL``." msgstr "" -#: c-api/marshal.rst:79 +#: c-api/marshal.rst:80 msgid "" "Return a Python object from the data stream in a :c:expr:`FILE*` opened for " "reading. Unlike :c:func:`PyMarshal_ReadObjectFromFile`, this function " "assumes that no further objects will be read from the file, allowing it to " "aggressively load file data into memory so that the de-serialization can " "operate from data in memory rather than reading a byte at a time from the " -"file. Only use these variant if you are certain that you won't be reading " +"file. Only use this variant if you are certain that you won't be reading " "anything else from the file." msgstr "" -#: c-api/marshal.rst:93 +#: c-api/marshal.rst:94 msgid "" "Return a Python object from the data stream in a byte buffer containing " "*len* bytes pointed to by *data*." diff --git a/c-api/memory.po b/c-api/memory.po index 7b2acb72..d74bc729 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -69,6 +70,19 @@ msgid "" "in the following example::" msgstr "" +#: c-api/memory.rst:58 +msgid "" +"PyObject *res;\n" +"char *buf = (char *) malloc(BUFSIZ); /* for I/O */\n" +"\n" +"if (buf == NULL)\n" +" return PyErr_NoMemory();\n" +"...Do some I/O operation involving buf...\n" +"res = PyBytes_FromString(buf);\n" +"free(buf); /* malloc'ed */\n" +"return res;" +msgstr "" + #: c-api/memory.rst:68 msgid "" "In this example, the memory request for the I/O buffer is handled by the C " @@ -118,60 +132,71 @@ msgid "" "allocation strategies and are optimized for different purposes. The specific " "details on how every domain allocates memory or what internal functions each " "domain calls is considered an implementation detail, but for debugging " -"purposes a simplified table can be found at :ref:`here `. There is no hard requirement to use the memory returned by the " -"allocation functions belonging to a given domain for only the purposes " -"hinted by that domain (although this is the recommended practice). For " -"example, one could use the memory returned by :c:func:`PyMem_RawMalloc` for " -"allocating Python objects or the memory returned by :c:func:" -"`PyObject_Malloc` for allocating memory for buffers." +"purposes a simplified table can be found at :ref:`default-memory-" +"allocators`. The APIs used to allocate and free a block of memory must be " +"from the same domain. For example, :c:func:`PyMem_Free` must be used to free " +"memory allocated using :c:func:`PyMem_Malloc`." msgstr "" -#: c-api/memory.rst:112 +#: c-api/memory.rst:109 msgid "The three allocation domains are:" msgstr "" -#: c-api/memory.rst:114 +#: c-api/memory.rst:111 msgid "" "Raw domain: intended for allocating memory for general-purpose memory " "buffers where the allocation *must* go to the system allocator or where the " -"allocator can operate without the :term:`GIL`. The memory is requested " -"directly to the system." +"allocator can operate without an :term:`attached thread state`. The memory " +"is requested directly from the system. See :ref:`Raw Memory Interface `." msgstr "" -#: c-api/memory.rst:119 +#: c-api/memory.rst:116 msgid "" "\"Mem\" domain: intended for allocating memory for Python buffers and " "general-purpose memory buffers where the allocation must be performed with " -"the :term:`GIL` held. The memory is taken from the Python private heap." +"an :term:`attached thread state`. The memory is taken from the Python " +"private heap. See :ref:`Memory Interface `." msgstr "" -#: c-api/memory.rst:123 +#: c-api/memory.rst:121 msgid "" -"Object domain: intended for allocating memory belonging to Python objects. " -"The memory is taken from the Python private heap." +"Object domain: intended for allocating memory for Python objects. The memory " +"is taken from the Python private heap. See :ref:`Object allocators " +"`." msgstr "" #: c-api/memory.rst:126 msgid "" -"When freeing memory previously allocated by the allocating functions " -"belonging to a given domain,the matching specific deallocating functions " -"must be used. For example, :c:func:`PyMem_Free` must be used to free memory " -"allocated using :c:func:`PyMem_Malloc`." +"The :term:`free-threaded ` build requires that only Python " +"objects are allocated using the \"object\" domain and that all Python " +"objects are allocated using that domain. This differs from the prior Python " +"versions, where this was only a best practice and not a hard requirement." msgstr "" -#: c-api/memory.rst:131 -msgid "Raw Memory Interface" +#: c-api/memory.rst:130 +msgid "" +"For example, buffers (non-Python objects) should be allocated using :c:func:" +"`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, or :c:func:`malloc`, but not :c:" +"func:`PyObject_Malloc`." msgstr "" #: c-api/memory.rst:133 +msgid "See :ref:`Memory Allocation APIs `." +msgstr "" + +#: c-api/memory.rst:139 +msgid "Raw Memory Interface" +msgstr "" + +#: c-api/memory.rst:141 msgid "" "The following function sets are wrappers to the system allocator. These " -"functions are thread-safe, the :term:`GIL ` does " -"not need to be held." +"functions are thread-safe, so a :term:`thread state` does not need to be :" +"term:`attached `." msgstr "" -#: c-api/memory.rst:137 +#: c-api/memory.rst:145 msgid "" "The :ref:`default raw memory allocator ` uses the " "following functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " @@ -179,60 +204,60 @@ msgid "" "requesting zero bytes." msgstr "" -#: c-api/memory.rst:217 c-api/memory.rst:325 +#: c-api/memory.rst:224 c-api/memory.rst:333 msgid "" "Allocates *n* bytes and returns a pointer of type :c:expr:`void*` to the " "allocated memory, or ``NULL`` if the request fails." msgstr "" -#: c-api/memory.rst:149 +#: c-api/memory.rst:157 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyMem_RawMalloc(1)`` had been called instead. The memory will not " "have been initialized in any way." msgstr "" -#: c-api/memory.rst:227 c-api/memory.rst:335 +#: c-api/memory.rst:234 c-api/memory.rst:343 msgid "" "Allocates *nelem* elements each whose size in bytes is *elsize* and returns " "a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if " "the request fails. The memory is initialized to zeros." msgstr "" -#: c-api/memory.rst:160 +#: c-api/memory.rst:168 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyMem_RawCalloc(1, 1)`` had been " "called instead." msgstr "" -#: c-api/memory.rst:240 c-api/memory.rst:348 +#: c-api/memory.rst:247 c-api/memory.rst:356 msgid "" "Resizes the memory block pointed to by *p* to *n* bytes. The contents will " "be unchanged to the minimum of the old and the new sizes." msgstr "" -#: c-api/memory.rst:172 +#: c-api/memory.rst:180 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyMem_RawMalloc(n)``; else " "if *n* is equal to zero, the memory block is resized but is not freed, and " "the returned pointer is non-``NULL``." msgstr "" -#: c-api/memory.rst:176 +#: c-api/memory.rst:184 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:" "`PyMem_RawCalloc`." msgstr "" -#: c-api/memory.rst:180 +#: c-api/memory.rst:188 msgid "" "If the request fails, :c:func:`PyMem_RawRealloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: c-api/memory.rst:186 +#: c-api/memory.rst:194 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:" @@ -240,72 +265,71 @@ msgid "" "called before, undefined behavior occurs." msgstr "" -#: c-api/memory.rst:261 c-api/memory.rst:369 +#: c-api/memory.rst:268 c-api/memory.rst:377 msgid "If *p* is ``NULL``, no operation is performed." msgstr "" -#: c-api/memory.rst:197 +#: c-api/memory.rst:205 msgid "Memory Interface" msgstr "" -#: c-api/memory.rst:305 +#: c-api/memory.rst:314 msgid "" "The following function sets, modeled after the ANSI C standard, but " "specifying behavior when requesting zero bytes, are available for allocating " "and releasing memory from the Python heap." msgstr "" -#: c-api/memory.rst:203 +#: c-api/memory.rst:211 msgid "" "The :ref:`default memory allocator ` uses the :" "ref:`pymalloc memory allocator `." msgstr "" -#: c-api/memory.rst:320 +#: c-api/memory.rst:329 msgid "" -"The :term:`GIL ` must be held when using these " -"functions." +"There must be an :term:`attached thread state` when using these functions." msgstr "" -#: c-api/memory.rst:213 +#: c-api/memory.rst:220 msgid "" "The default allocator is now pymalloc instead of system :c:func:`malloc`." msgstr "" -#: c-api/memory.rst:220 +#: c-api/memory.rst:227 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyMem_Malloc(1)`` had been called instead. The memory will not have " "been initialized in any way." msgstr "" -#: c-api/memory.rst:231 +#: c-api/memory.rst:238 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyMem_Calloc(1, 1)`` had been " "called instead." msgstr "" -#: c-api/memory.rst:243 +#: c-api/memory.rst:250 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyMem_Malloc(n)``; else if " "*n* is equal to zero, the memory block is resized but is not freed, and the " "returned pointer is non-``NULL``." msgstr "" -#: c-api/memory.rst:247 +#: c-api/memory.rst:254 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." msgstr "" -#: c-api/memory.rst:250 +#: c-api/memory.rst:257 msgid "" "If the request fails, :c:func:`PyMem_Realloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: c-api/memory.rst:256 +#: c-api/memory.rst:263 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:" @@ -313,20 +337,20 @@ msgid "" "undefined behavior occurs." msgstr "" -#: c-api/memory.rst:263 +#: c-api/memory.rst:270 msgid "" "The following type-oriented macros are provided for convenience. Note that " "*TYPE* refers to any C type." msgstr "" -#: c-api/memory.rst:269 +#: c-api/memory.rst:276 msgid "" "Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes " "of memory. Returns a pointer cast to ``TYPE*``. The memory will not have " "been initialized in any way." msgstr "" -#: c-api/memory.rst:276 +#: c-api/memory.rst:283 msgid "" "Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * " "sizeof(TYPE))`` bytes. Returns a pointer cast to ``TYPE*``. On return, *p* " @@ -334,17 +358,17 @@ msgid "" "failure." msgstr "" -#: c-api/memory.rst:281 +#: c-api/memory.rst:288 msgid "" "This is a C preprocessor macro; *p* is always reassigned. Save the original " "value of *p* to avoid losing memory when handling errors." msgstr "" -#: c-api/memory.rst:287 +#: c-api/memory.rst:294 msgid "Same as :c:func:`PyMem_Free`." msgstr "" -#: c-api/memory.rst:289 +#: c-api/memory.rst:296 msgid "" "In addition, the following macro sets are provided for calling the Python " "memory allocator directly, without involving the C API functions listed " @@ -352,35 +376,35 @@ msgid "" "across Python versions and is therefore deprecated in extension modules." msgstr "" -#: c-api/memory.rst:294 +#: c-api/memory.rst:301 msgid "``PyMem_MALLOC(size)``" msgstr "" -#: c-api/memory.rst:295 +#: c-api/memory.rst:302 msgid "``PyMem_NEW(type, size)``" msgstr "" -#: c-api/memory.rst:296 +#: c-api/memory.rst:303 msgid "``PyMem_REALLOC(ptr, size)``" msgstr "" -#: c-api/memory.rst:297 +#: c-api/memory.rst:304 msgid "``PyMem_RESIZE(ptr, type, size)``" msgstr "" -#: c-api/memory.rst:298 +#: c-api/memory.rst:305 msgid "``PyMem_FREE(ptr)``" msgstr "" -#: c-api/memory.rst:299 +#: c-api/memory.rst:306 msgid "``PyMem_DEL(ptr)``" msgstr "" -#: c-api/memory.rst:303 +#: c-api/memory.rst:312 msgid "Object allocators" msgstr "" -#: c-api/memory.rst:310 +#: c-api/memory.rst:319 msgid "" "There is no guarantee that the memory returned by these allocators can be " "successfully cast to a Python object when intercepting the allocating " @@ -388,47 +412,47 @@ msgid "" "Memory Allocators ` section." msgstr "" -#: c-api/memory.rst:315 +#: c-api/memory.rst:324 msgid "" "The :ref:`default object allocator ` uses the :" "ref:`pymalloc memory allocator `." msgstr "" -#: c-api/memory.rst:328 +#: c-api/memory.rst:336 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyObject_Malloc(1)`` had been called instead. The memory will not " "have been initialized in any way." msgstr "" -#: c-api/memory.rst:339 +#: c-api/memory.rst:347 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyObject_Calloc(1, 1)`` had been " "called instead." msgstr "" -#: c-api/memory.rst:351 +#: c-api/memory.rst:359 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyObject_Malloc(n)``; else " "if *n* is equal to zero, the memory block is resized but is not freed, and " "the returned pointer is non-``NULL``." msgstr "" -#: c-api/memory.rst:355 +#: c-api/memory.rst:363 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:" "`PyObject_Calloc`." msgstr "" -#: c-api/memory.rst:358 +#: c-api/memory.rst:366 msgid "" "If the request fails, :c:func:`PyObject_Realloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: c-api/memory.rst:364 +#: c-api/memory.rst:372 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:" @@ -436,286 +460,326 @@ msgid "" "called before, undefined behavior occurs." msgstr "" -#: c-api/memory.rst:375 +#: c-api/memory.rst:379 +msgid "" +"Do not call this directly to free an object's memory; call the type's :c:" +"member:`~PyTypeObject.tp_free` slot instead." +msgstr "" + +#: c-api/memory.rst:382 +msgid "" +"Do not use this for memory allocated by :c:macro:`PyObject_GC_New` or :c:" +"macro:`PyObject_GC_NewVar`; use :c:func:`PyObject_GC_Del` instead." +msgstr "" + +#: c-api/memory.rst:387 +msgid "" +":c:func:`PyObject_GC_Del` is the equivalent of this function for memory " +"allocated by types that support garbage collection." +msgstr "" + +#: c-api/memory.rst:486 +msgid ":c:func:`PyObject_Malloc`" +msgstr "" + +#: c-api/memory.rst:487 +msgid ":c:func:`PyObject_Realloc`" +msgstr "" + +#: c-api/memory.rst:488 +msgid ":c:func:`PyObject_Calloc`" +msgstr "" + +#: c-api/memory.rst:392 +msgid ":c:macro:`PyObject_New`" +msgstr "" + +#: c-api/memory.rst:393 +msgid ":c:macro:`PyObject_NewVar`" +msgstr "" + +#: c-api/memory.rst:394 +msgid ":c:func:`PyType_GenericAlloc`" +msgstr "" + +#: c-api/memory.rst:395 +msgid ":c:member:`~PyTypeObject.tp_free`" +msgstr "" + +#: c-api/memory.rst:401 msgid "Default Memory Allocators" msgstr "" -#: c-api/memory.rst:377 +#: c-api/memory.rst:403 msgid "Default memory allocators:" msgstr "" -#: c-api/memory.rst:380 +#: c-api/memory.rst:406 msgid "Configuration" msgstr "" -#: c-api/memory.rst:380 +#: c-api/memory.rst:406 msgid "Name" msgstr "" -#: c-api/memory.rst:380 +#: c-api/memory.rst:406 msgid "PyMem_RawMalloc" msgstr "" -#: c-api/memory.rst:380 +#: c-api/memory.rst:406 msgid "PyMem_Malloc" msgstr "" -#: c-api/memory.rst:380 +#: c-api/memory.rst:406 msgid "PyObject_Malloc" msgstr "" -#: c-api/memory.rst:382 +#: c-api/memory.rst:408 msgid "Release build" msgstr "" -#: c-api/memory.rst:382 +#: c-api/memory.rst:408 msgid "``\"pymalloc\"``" msgstr "" -#: c-api/memory.rst:384 +#: c-api/memory.rst:410 msgid "``malloc``" msgstr "" -#: c-api/memory.rst:382 +#: c-api/memory.rst:408 msgid "``pymalloc``" msgstr "" -#: c-api/memory.rst:383 +#: c-api/memory.rst:409 msgid "Debug build" msgstr "" -#: c-api/memory.rst:383 +#: c-api/memory.rst:409 msgid "``\"pymalloc_debug\"``" msgstr "" -#: c-api/memory.rst:385 +#: c-api/memory.rst:411 msgid "``malloc`` + debug" msgstr "" -#: c-api/memory.rst:383 +#: c-api/memory.rst:409 msgid "``pymalloc`` + debug" msgstr "" -#: c-api/memory.rst:384 +#: c-api/memory.rst:410 msgid "Release build, without pymalloc" msgstr "" -#: c-api/memory.rst:384 +#: c-api/memory.rst:410 msgid "``\"malloc\"``" msgstr "" -#: c-api/memory.rst:385 +#: c-api/memory.rst:411 msgid "Debug build, without pymalloc" msgstr "" -#: c-api/memory.rst:385 +#: c-api/memory.rst:411 msgid "``\"malloc_debug\"``" msgstr "" -#: c-api/memory.rst:388 +#: c-api/memory.rst:414 msgid "Legend:" msgstr "" -#: c-api/memory.rst:390 +#: c-api/memory.rst:416 msgid "Name: value for :envvar:`PYTHONMALLOC` environment variable." msgstr "" -#: c-api/memory.rst:391 +#: c-api/memory.rst:417 msgid "" "``malloc``: system allocators from the standard C library, C functions: :c:" "func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`." msgstr "" -#: c-api/memory.rst:393 +#: c-api/memory.rst:419 msgid "``pymalloc``: :ref:`pymalloc memory allocator `." msgstr "" -#: c-api/memory.rst:394 +#: c-api/memory.rst:420 +msgid "" +"``mimalloc``: :ref:`mimalloc memory allocator `. The pymalloc " +"allocator will be used if mimalloc support isn't available." +msgstr "" + +#: c-api/memory.rst:422 msgid "" "\"+ debug\": with :ref:`debug hooks on the Python memory allocators `." msgstr "" -#: c-api/memory.rst:396 +#: c-api/memory.rst:424 msgid "\"Debug build\": :ref:`Python build in debug mode `." msgstr "" -#: c-api/memory.rst:401 +#: c-api/memory.rst:429 msgid "Customize Memory Allocators" msgstr "" -#: c-api/memory.rst:407 +#: c-api/memory.rst:435 msgid "" "Structure used to describe a memory block allocator. The structure has the " "following fields:" msgstr "" -#: c-api/memory.rst:658 +#: c-api/memory.rst:690 msgid "Field" msgstr "" -#: c-api/memory.rst:658 +#: c-api/memory.rst:690 msgid "Meaning" msgstr "" -#: c-api/memory.rst:660 +#: c-api/memory.rst:692 msgid "``void *ctx``" msgstr "" -#: c-api/memory.rst:660 +#: c-api/memory.rst:692 msgid "user context passed as first argument" msgstr "" -#: c-api/memory.rst:415 +#: c-api/memory.rst:443 msgid "``void* malloc(void *ctx, size_t size)``" msgstr "" -#: c-api/memory.rst:415 +#: c-api/memory.rst:443 msgid "allocate a memory block" msgstr "" -#: c-api/memory.rst:417 +#: c-api/memory.rst:445 msgid "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" msgstr "" -#: c-api/memory.rst:417 +#: c-api/memory.rst:445 msgid "allocate a memory block initialized with zeros" msgstr "" -#: c-api/memory.rst:420 +#: c-api/memory.rst:448 msgid "``void* realloc(void *ctx, void *ptr, size_t new_size)``" msgstr "" -#: c-api/memory.rst:420 +#: c-api/memory.rst:448 msgid "allocate or resize a memory block" msgstr "" -#: c-api/memory.rst:422 +#: c-api/memory.rst:450 msgid "``void free(void *ctx, void *ptr)``" msgstr "" -#: c-api/memory.rst:422 +#: c-api/memory.rst:450 msgid "free a memory block" msgstr "" -#: c-api/memory.rst:425 +#: c-api/memory.rst:453 msgid "" "The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" "`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" -#: c-api/memory.rst:432 +#: c-api/memory.rst:460 msgid "Enum used to identify an allocator domain. Domains:" msgstr "" -#: c-api/memory.rst:447 c-api/memory.rst:456 +#: c-api/memory.rst:475 c-api/memory.rst:484 msgid "Functions:" msgstr "" -#: c-api/memory.rst:440 +#: c-api/memory.rst:468 msgid ":c:func:`PyMem_RawMalloc`" msgstr "" -#: c-api/memory.rst:441 +#: c-api/memory.rst:469 msgid ":c:func:`PyMem_RawRealloc`" msgstr "" -#: c-api/memory.rst:442 +#: c-api/memory.rst:470 msgid ":c:func:`PyMem_RawCalloc`" msgstr "" -#: c-api/memory.rst:443 +#: c-api/memory.rst:471 msgid ":c:func:`PyMem_RawFree`" msgstr "" -#: c-api/memory.rst:449 +#: c-api/memory.rst:477 msgid ":c:func:`PyMem_Malloc`," msgstr "" -#: c-api/memory.rst:450 +#: c-api/memory.rst:478 msgid ":c:func:`PyMem_Realloc`" msgstr "" -#: c-api/memory.rst:451 +#: c-api/memory.rst:479 msgid ":c:func:`PyMem_Calloc`" msgstr "" -#: c-api/memory.rst:452 +#: c-api/memory.rst:480 msgid ":c:func:`PyMem_Free`" msgstr "" -#: c-api/memory.rst:458 -msgid ":c:func:`PyObject_Malloc`" -msgstr "" - -#: c-api/memory.rst:459 -msgid ":c:func:`PyObject_Realloc`" -msgstr "" - -#: c-api/memory.rst:460 -msgid ":c:func:`PyObject_Calloc`" -msgstr "" - -#: c-api/memory.rst:461 +#: c-api/memory.rst:489 msgid ":c:func:`PyObject_Free`" msgstr "" -#: c-api/memory.rst:465 +#: c-api/memory.rst:493 msgid "Get the memory block allocator of the specified domain." msgstr "" -#: c-api/memory.rst:470 +#: c-api/memory.rst:498 msgid "Set the memory block allocator of the specified domain." msgstr "" -#: c-api/memory.rst:472 +#: c-api/memory.rst:500 msgid "" "The new allocator must return a distinct non-``NULL`` pointer when " "requesting zero bytes." msgstr "" -#: c-api/memory.rst:475 +#: c-api/memory.rst:503 msgid "" "For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-" -"safe: the :term:`GIL ` is not held when the " -"allocator is called." +"safe: a :term:`thread state` is not :term:`attached ` " +"when the allocator is called." msgstr "" -#: c-api/memory.rst:479 +#: c-api/memory.rst:507 msgid "" "For the remaining domains, the allocator must also be thread-safe: the " -"allocator may be called in different interpreters that do not share a " -"``GIL``." +"allocator may be called in different interpreters that do not share a :term:" +"`GIL`." msgstr "" -#: c-api/memory.rst:483 +#: c-api/memory.rst:511 msgid "" "If the new allocator is not a hook (does not call the previous allocator), " "the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the " "debug hooks on top on the new allocator." msgstr "" -#: c-api/memory.rst:487 +#: c-api/memory.rst:515 msgid "" "See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python " "with PyPreConfig `." msgstr "" -#: c-api/memory.rst:492 +#: c-api/memory.rst:520 msgid ":c:func:`PyMem_SetAllocator` does have the following contract:" msgstr "" -#: c-api/memory.rst:494 +#: c-api/memory.rst:522 msgid "" "It can be called after :c:func:`Py_PreInitialize` and before :c:func:" "`Py_InitializeFromConfig` to install a custom memory allocator. There are no " "restrictions over the installed allocator other than the ones imposed by the " "domain (for instance, the Raw Domain allows the allocator to be called " -"without the GIL held). See :ref:`the section on allocator domains ` for more information." +"without an :term:`attached thread state`). See :ref:`the section on " +"allocator domains ` for more information." msgstr "" -#: c-api/memory.rst:502 +#: c-api/memory.rst:530 msgid "" "If called after Python has finish initializing (after :c:func:" "`Py_InitializeFromConfig` has been called) the allocator **must** wrap the " @@ -723,21 +787,21 @@ msgid "" "arbitrary one is **not supported**." msgstr "" -#: c-api/memory.rst:507 +#: c-api/memory.rst:535 msgid "All allocators must be thread-safe." msgstr "" -#: c-api/memory.rst:513 +#: c-api/memory.rst:541 msgid "" "Setup :ref:`debug hooks in the Python memory allocators ` " "to detect memory errors." msgstr "" -#: c-api/memory.rst:520 +#: c-api/memory.rst:548 msgid "Debug hooks on the Python memory allocators" msgstr "" -#: c-api/memory.rst:522 +#: c-api/memory.rst:550 msgid "" "When :ref:`Python is built in debug mode `, the :c:func:" "`PyMem_SetupDebugHooks` function is called at the :ref:`Python " @@ -745,19 +809,19 @@ msgid "" "allocators to detect memory errors." msgstr "" -#: c-api/memory.rst:527 +#: c-api/memory.rst:555 msgid "" "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug " "hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "" -#: c-api/memory.rst:530 +#: c-api/memory.rst:558 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks " "after calling :c:func:`PyMem_SetAllocator`." msgstr "" -#: c-api/memory.rst:533 +#: c-api/memory.rst:561 msgid "" "These debug hooks fill dynamically allocated memory blocks with special, " "recognizable bit patterns. Newly allocated memory is filled with the byte " @@ -767,33 +831,33 @@ msgid "" "these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "" -#: c-api/memory.rst:540 +#: c-api/memory.rst:568 msgid "Runtime checks:" msgstr "" -#: c-api/memory.rst:542 +#: c-api/memory.rst:570 msgid "" "Detect API violations. For example, detect if :c:func:`PyObject_Free` is " "called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "" -#: c-api/memory.rst:544 +#: c-api/memory.rst:572 msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "" -#: c-api/memory.rst:545 +#: c-api/memory.rst:573 msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "" -#: c-api/memory.rst:546 +#: c-api/memory.rst:574 msgid "" -"Check that the :term:`GIL ` is held when allocator " +"Check that there is an :term:`attached thread state` when allocator " "functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) " "and :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are " "called." msgstr "" -#: c-api/memory.rst:551 +#: c-api/memory.rst:579 msgid "" "On error, the debug hooks use the :mod:`tracemalloc` module to get the " "traceback where a memory block was allocated. The traceback is only " @@ -801,7 +865,7 @@ msgid "" "memory block was traced." msgstr "" -#: c-api/memory.rst:556 +#: c-api/memory.rst:584 msgid "" "Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each " "block of *N* bytes requested. The memory layout is like so, where p " @@ -811,49 +875,49 @@ msgid "" "from a Python slice):" msgstr "" -#: c-api/memory.rst:563 +#: c-api/memory.rst:590 msgid "``p[-2*S:-S]``" msgstr "" -#: c-api/memory.rst:563 +#: c-api/memory.rst:591 msgid "" "Number of bytes originally asked for. This is a size_t, big-endian (easier " "to read in a memory dump)." msgstr "" -#: c-api/memory.rst:570 +#: c-api/memory.rst:593 msgid "``p[-S]``" msgstr "" -#: c-api/memory.rst:566 +#: c-api/memory.rst:594 msgid "API identifier (ASCII character):" msgstr "" -#: c-api/memory.rst:568 +#: c-api/memory.rst:596 msgid "``'r'`` for :c:macro:`PYMEM_DOMAIN_RAW`." msgstr "" -#: c-api/memory.rst:569 +#: c-api/memory.rst:597 msgid "``'m'`` for :c:macro:`PYMEM_DOMAIN_MEM`." msgstr "" -#: c-api/memory.rst:570 +#: c-api/memory.rst:598 msgid "``'o'`` for :c:macro:`PYMEM_DOMAIN_OBJ`." msgstr "" -#: c-api/memory.rst:573 +#: c-api/memory.rst:600 msgid "``p[-S+1:0]``" msgstr "" -#: c-api/memory.rst:573 +#: c-api/memory.rst:601 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "" -#: c-api/memory.rst:582 +#: c-api/memory.rst:603 msgid "``p[0:N]``" msgstr "" -#: c-api/memory.rst:576 +#: c-api/memory.rst:604 msgid "" "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch " "reference to uninitialized memory. When a realloc-like function is called " @@ -864,25 +928,25 @@ msgid "" "bytes are also filled with PYMEM_DEADBYTE." msgstr "" -#: c-api/memory.rst:585 +#: c-api/memory.rst:612 msgid "``p[N:N+S]``" msgstr "" -#: c-api/memory.rst:585 +#: c-api/memory.rst:613 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "" -#: c-api/memory.rst:596 +#: c-api/memory.rst:615 msgid "``p[N+S:N+2*S]``" msgstr "" -#: c-api/memory.rst:588 +#: c-api/memory.rst:616 msgid "" "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by " "default)." msgstr "" -#: c-api/memory.rst:591 +#: c-api/memory.rst:619 msgid "" "A serial number, incremented by 1 on each call to a malloc-like or realloc-" "like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected " @@ -892,7 +956,7 @@ msgid "" "number is incremented, and exists so you can set such a breakpoint easily." msgstr "" -#: c-api/memory.rst:598 +#: c-api/memory.rst:626 msgid "" "A realloc-like or free-like function first checks that the " "PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, " @@ -905,16 +969,17 @@ msgid "" "getting used)." msgstr "" -#: c-api/memory.rst:607 +#: c-api/memory.rst:635 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python " "compiled in release mode. On error, the debug hooks now use :mod:" "`tracemalloc` to get the traceback where a memory block was allocated. The " -"debug hooks now also check if the GIL is held when functions of :c:macro:" -"`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." +"debug hooks now also check if there is an :term:`attached thread state` when " +"functions of :c:macro:`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` " +"domains are called." msgstr "" -#: c-api/memory.rst:615 +#: c-api/memory.rst:643 msgid "" "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) " "and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, " @@ -922,11 +987,11 @@ msgid "" "``malloc()`` and ``free()``." msgstr "" -#: c-api/memory.rst:625 +#: c-api/memory.rst:653 msgid "The pymalloc allocator" msgstr "" -#: c-api/memory.rst:627 +#: c-api/memory.rst:655 msgid "" "Python has a *pymalloc* allocator optimized for small objects (smaller or " "equal to 512 bytes) with a short lifetime. It uses memory mappings called " @@ -935,114 +1000,159 @@ msgid "" "`PyMem_RawRealloc` for allocations larger than 512 bytes." msgstr "" -#: c-api/memory.rst:633 +#: c-api/memory.rst:661 msgid "" "*pymalloc* is the :ref:`default allocator ` of " "the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:macro:" "`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "" -#: c-api/memory.rst:637 +#: c-api/memory.rst:665 msgid "The arena allocator uses the following functions:" msgstr "" -#: c-api/memory.rst:639 +#: c-api/memory.rst:667 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," msgstr "" -#: c-api/memory.rst:640 +#: c-api/memory.rst:668 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," msgstr "" -#: c-api/memory.rst:641 +#: c-api/memory.rst:669 msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr "" -#: c-api/memory.rst:643 +#: c-api/memory.rst:671 msgid "" "This allocator is disabled if Python is configured with the :option:`--" "without-pymalloc` option. It can also be disabled at runtime using the :" "envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." msgstr "" -#: c-api/memory.rst:648 +#: c-api/memory.rst:675 +msgid "" +"Typically, it makes sense to disable the pymalloc allocator when building " +"Python with AddressSanitizer (:option:`--with-address-sanitizer`) which " +"helps uncover low level bugs within the C code." +msgstr "" + +#: c-api/memory.rst:680 msgid "Customize pymalloc Arena Allocator" msgstr "" -#: c-api/memory.rst:654 +#: c-api/memory.rst:686 msgid "" "Structure used to describe an arena allocator. The structure has three " "fields:" msgstr "" -#: c-api/memory.rst:662 +#: c-api/memory.rst:694 msgid "``void* alloc(void *ctx, size_t size)``" msgstr "" -#: c-api/memory.rst:662 +#: c-api/memory.rst:694 msgid "allocate an arena of size bytes" msgstr "" -#: c-api/memory.rst:664 +#: c-api/memory.rst:696 msgid "``void free(void *ctx, void *ptr, size_t size)``" msgstr "" -#: c-api/memory.rst:664 +#: c-api/memory.rst:696 msgid "free an arena" msgstr "" -#: c-api/memory.rst:669 +#: c-api/memory.rst:701 msgid "Get the arena allocator." msgstr "" -#: c-api/memory.rst:673 +#: c-api/memory.rst:705 msgid "Set the arena allocator." msgstr "" -#: c-api/memory.rst:677 +#: c-api/memory.rst:710 +msgid "The mimalloc allocator" +msgstr "" + +#: c-api/memory.rst:714 +msgid "" +"Python supports the mimalloc allocator when the underlying platform support " +"is available. mimalloc \"is a general purpose allocator with excellent " +"performance characteristics. Initially developed by Daan Leijen for the " +"runtime systems of the Koka and Lean languages.\"" +msgstr "" + +#: c-api/memory.rst:719 msgid "tracemalloc C API" msgstr "" -#: c-api/memory.rst:683 +#: c-api/memory.rst:725 msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "" -#: c-api/memory.rst:685 +#: c-api/memory.rst:727 msgid "" "Return ``0`` on success, return ``-1`` on error (failed to allocate memory " "to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "" -#: c-api/memory.rst:688 +#: c-api/memory.rst:730 msgid "If memory block is already tracked, update the existing trace." msgstr "" -#: c-api/memory.rst:692 +#: c-api/memory.rst:734 msgid "" "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do " "nothing if the block was not tracked." msgstr "" -#: c-api/memory.rst:695 +#: c-api/memory.rst:737 msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." msgstr "" -#: c-api/memory.rst:701 +#: c-api/memory.rst:743 msgid "Examples" msgstr "" -#: c-api/memory.rst:703 +#: c-api/memory.rst:745 msgid "" "Here is the example from section :ref:`memoryoverview`, rewritten so that " "the I/O buffer is allocated from the Python heap by using the first function " "set::" msgstr "" -#: c-api/memory.rst:716 +#: c-api/memory.rst:748 +msgid "" +"PyObject *res;\n" +"char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" +"\n" +"if (buf == NULL)\n" +" return PyErr_NoMemory();\n" +"/* ...Do some I/O operation involving buf... */\n" +"res = PyBytes_FromString(buf);\n" +"PyMem_Free(buf); /* allocated with PyMem_Malloc */\n" +"return res;" +msgstr "" + +#: c-api/memory.rst:758 msgid "The same code using the type-oriented function set::" msgstr "" -#: c-api/memory.rst:728 +#: c-api/memory.rst:760 +msgid "" +"PyObject *res;\n" +"char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" +"\n" +"if (buf == NULL)\n" +" return PyErr_NoMemory();\n" +"/* ...Do some I/O operation involving buf... */\n" +"res = PyBytes_FromString(buf);\n" +"PyMem_Free(buf); /* allocated with PyMem_New */\n" +"return res;" +msgstr "" + +#: c-api/memory.rst:770 msgid "" "Note that in the two examples above, the buffer is always manipulated via " "functions belonging to the same set. Indeed, it is required to use the same " @@ -1052,14 +1162,25 @@ msgid "" "different allocators operating on different heaps. ::" msgstr "" -#: c-api/memory.rst:743 +#: c-api/memory.rst:777 +msgid "" +"char *buf1 = PyMem_New(char, BUFSIZ);\n" +"char *buf2 = (char *) malloc(BUFSIZ);\n" +"char *buf3 = (char *) PyMem_Malloc(BUFSIZ);\n" +"...\n" +"PyMem_Del(buf3); /* Wrong -- should be PyMem_Free() */\n" +"free(buf2); /* Right -- allocated via malloc() */\n" +"free(buf1); /* Fatal -- should be PyMem_Free() */" +msgstr "" + +#: c-api/memory.rst:785 msgid "" "In addition to the functions aimed at handling raw memory blocks from the " "Python heap, objects in Python are allocated and released with :c:macro:" -"`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Del`." +"`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Free`." msgstr "" -#: c-api/memory.rst:747 +#: c-api/memory.rst:789 msgid "" "These will be explained in the next chapter on defining and implementing new " "object types in C." diff --git a/c-api/memoryview.po b/c-api/memoryview.po index 843e71a4..cbb5480b 100644 --- a/c-api/memoryview.po +++ b/c-api/memoryview.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -29,34 +30,40 @@ msgstr "" #: c-api/memoryview.rst:18 msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python memoryview " +"type. This is the same object as :class:`memoryview` in the Python layer." +msgstr "" + +#: c-api/memoryview.rst:24 +msgid "" "Create a memoryview object from an object that provides the buffer " "interface. If *obj* supports writable buffer exports, the memoryview object " "will be read/write, otherwise it may be either read-only or read/write at " "the discretion of the exporter." msgstr "" -#: c-api/memoryview.rst:26 +#: c-api/memoryview.rst:32 msgid "Flag to request a readonly buffer." msgstr "" -#: c-api/memoryview.rst:31 +#: c-api/memoryview.rst:37 msgid "Flag to request a writable buffer." msgstr "" -#: c-api/memoryview.rst:36 +#: c-api/memoryview.rst:42 msgid "" "Create a memoryview object using *mem* as the underlying buffer. *flags* can " "be one of :c:macro:`PyBUF_READ` or :c:macro:`PyBUF_WRITE`." msgstr "" -#: c-api/memoryview.rst:43 +#: c-api/memoryview.rst:49 msgid "" "Create a memoryview object wrapping the given buffer structure *view*. For " "simple byte buffers, :c:func:`PyMemoryView_FromMemory` is the preferred " "function." msgstr "" -#: c-api/memoryview.rst:49 +#: c-api/memoryview.rst:55 msgid "" "Create a memoryview object to a :term:`contiguous` chunk of memory (in " "either 'C' or 'F'ortran *order*) from an object that defines the buffer " @@ -65,26 +72,26 @@ msgid "" "new bytes object." msgstr "" -#: c-api/memoryview.rst:55 +#: c-api/memoryview.rst:61 msgid "" "*buffertype* can be one of :c:macro:`PyBUF_READ` or :c:macro:`PyBUF_WRITE`." msgstr "" -#: c-api/memoryview.rst:60 +#: c-api/memoryview.rst:66 msgid "" "Return true if the object *obj* is a memoryview object. It is not currently " "allowed to create subclasses of :class:`memoryview`. This function always " "succeeds." msgstr "" -#: c-api/memoryview.rst:67 +#: c-api/memoryview.rst:73 msgid "" "Return a pointer to the memoryview's private copy of the exporter's buffer. " "*mview* **must** be a memoryview instance; this macro doesn't check its " "type, you must do it yourself or you will risk crashes." msgstr "" -#: c-api/memoryview.rst:73 +#: c-api/memoryview.rst:79 msgid "" "Return either a pointer to the exporting object that the memoryview is based " "on or ``NULL`` if the memoryview has been created by one of the functions :c:" diff --git a/c-api/method.po b/c-api/method.po index 49e45c02..52aa1137 100644 --- a/c-api/method.po +++ b/c-api/method.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/c-api/module.po b/c-api/module.po index 1649e47e..99701a1f 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -23,7 +24,7 @@ msgstr "" #: c-api/module.rst:15 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python module type. " -"This is exposed to Python programs as ``types.ModuleType``." +"This is exposed to Python programs as :py:class:`types.ModuleType`." msgstr "" #: c-api/module.rst:21 @@ -40,24 +41,30 @@ msgstr "" #: c-api/module.rst:40 msgid "" -"Return a new module object with the :attr:`__name__` attribute set to " -"*name*. The module's :attr:`__name__`, :attr:`__doc__`, :attr:`__package__`, " -"and :attr:`__loader__` attributes are filled in (all but :attr:`__name__` " -"are set to ``None``); the caller is responsible for providing a :attr:" -"`__file__` attribute." +"Return a new module object with :attr:`module.__name__` set to *name*. The " +"module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module." +"__package__` and :attr:`~module.__loader__` attributes are filled in (all " +"but :attr:`!__name__` are set to ``None``). The caller is responsible for " +"setting a :attr:`~module.__file__` attribute." msgstr "" -#: c-api/module.rst:48 -msgid ":attr:`__package__` and :attr:`__loader__` are set to ``None``." +#: c-api/module.rst:434 c-api/module.rst:461 +msgid "Return ``NULL`` with an exception set on error." msgstr "" -#: c-api/module.rst:54 +#: c-api/module.rst:50 +msgid "" +":attr:`~module.__package__` and :attr:`~module.__loader__` are now set to " +"``None``." +msgstr "" + +#: c-api/module.rst:57 msgid "" "Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded " "string instead of a Unicode object." msgstr "" -#: c-api/module.rst:62 +#: c-api/module.rst:65 msgid "" "Return the dictionary object that implements *module*'s namespace; this " "object is the same as the :attr:`~object.__dict__` attribute of the module " @@ -65,157 +72,199 @@ msgid "" "object), :exc:`SystemError` is raised and ``NULL`` is returned." msgstr "" -#: c-api/module.rst:67 +#: c-api/module.rst:70 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " "functions rather than directly manipulate a module's :attr:`~object." "__dict__`." msgstr "" -#: c-api/module.rst:78 +#: c-api/module.rst:74 +msgid "" +"The returned reference is borrowed from the module; it is valid until the " +"module is destroyed." +msgstr "" + +#: c-api/module.rst:84 msgid "" -"Return *module*'s :attr:`__name__` value. If the module does not provide " -"one, or if it is not a string, :exc:`SystemError` is raised and ``NULL`` is " -"returned." +"Return *module*'s :attr:`~module.__name__` value. If the module does not " +"provide one, or if it is not a string, :exc:`SystemError` is raised and " +"``NULL`` is returned." msgstr "" -#: c-api/module.rst:86 +#: c-api/module.rst:93 msgid "" "Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to " "``'utf-8'``." msgstr "" -#: c-api/module.rst:91 +#: c-api/module.rst:96 +msgid "" +"The returned buffer is only valid until the module is renamed or destroyed. " +"Note that Python code may rename a module by setting its :py:attr:`~module." +"__name__` attribute." +msgstr "" + +#: c-api/module.rst:102 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " "memory allocated at module creation time, or ``NULL``. See :c:member:" "`PyModuleDef.m_size`." msgstr "" -#: c-api/module.rst:98 +#: c-api/module.rst:109 msgid "" "Return a pointer to the :c:type:`PyModuleDef` struct from which the module " "was created, or ``NULL`` if the module wasn't created from a definition." msgstr "" -#: c-api/module.rst:108 +#: c-api/module.rst:112 +msgid "" +"On error, return ``NULL`` with an exception set. Use :c:func:" +"`PyErr_Occurred` to tell this case apart from a missing :c:type:`!" +"PyModuleDef`." +msgstr "" + +#: c-api/module.rst:123 msgid "" "Return the name of the file from which *module* was loaded using *module*'s :" -"attr:`__file__` attribute. If this is not defined, or if it is not a " -"unicode string, raise :exc:`SystemError` and return ``NULL``; otherwise " -"return a reference to a Unicode object." +"attr:`~module.__file__` attribute. If this is not defined, or if it is not " +"a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a " +"reference to a Unicode object." msgstr "" -#: c-api/module.rst:118 +#: c-api/module.rst:133 msgid "" "Similar to :c:func:`PyModule_GetFilenameObject` but return the filename " "encoded to 'utf-8'." msgstr "" -#: c-api/module.rst:121 +#: c-api/module.rst:136 +msgid "" +"The returned buffer is only valid until the module's :py:attr:`~module." +"__file__` attribute is reassigned or the module is destroyed." +msgstr "" + +#: c-api/module.rst:139 msgid "" ":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on " "unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." msgstr "" -#: c-api/module.rst:129 -msgid "Initializing C modules" +#: c-api/module.rst:147 +msgid "Module definitions" msgstr "" -#: c-api/module.rst:131 +#: c-api/module.rst:149 msgid "" -"Modules objects are usually created from extension modules (shared libraries " -"which export an initialization function), or compiled-in modules (where the " -"initialization function is added using :c:func:`PyImport_AppendInittab`). " -"See :ref:`building` or :ref:`extending-with-embedding` for details." +"The functions in the previous section work on any module object, including " +"modules imported from Python code." msgstr "" -#: c-api/module.rst:136 +#: c-api/module.rst:152 msgid "" -"The initialization function can either pass a module definition instance to :" -"c:func:`PyModule_Create`, and return the resulting module object, or request " -"\"multi-phase initialization\" by returning the definition struct itself." +"Modules defined using the C API typically use a *module definition*, :c:type:" +"`PyModuleDef` -- a statically allocated, constant “description\" of how a " +"module should be created." msgstr "" -#: c-api/module.rst:142 +#: c-api/module.rst:156 +msgid "" +"The definition is usually used to define an extension's “main” module object " +"(see :ref:`extension-modules` for details). It is also used to :ref:`create " +"extension modules dynamically `." +msgstr "" + +#: c-api/module.rst:161 +msgid "" +"Unlike :c:func:`PyModule_New`, the definition allows management of *module " +"state* -- a piece of memory that is allocated and cleared together with the " +"module object. Unlike the module's Python attributes, Python code cannot " +"replace or delete data stored in module state." +msgstr "" + +#: c-api/module.rst:169 msgid "" "The module definition struct, which holds all information needed to create a " -"module object. There is usually only one statically initialized variable of " -"this type for each module." +"module object. This structure must be statically allocated (or be otherwise " +"guaranteed to be valid while any modules created from it exist). Usually, " +"there is only one variable of this type for each extension module." msgstr "" -#: c-api/module.rst:148 +#: c-api/module.rst:177 msgid "Always initialize this member to :c:macro:`PyModuleDef_HEAD_INIT`." msgstr "" -#: c-api/module.rst:152 +#: c-api/module.rst:181 msgid "Name for the new module." msgstr "" -#: c-api/module.rst:156 +#: c-api/module.rst:185 msgid "" "Docstring for the module; usually a docstring variable created with :c:macro:" "`PyDoc_STRVAR` is used." msgstr "" -#: c-api/module.rst:161 +#: c-api/module.rst:190 msgid "" "Module state may be kept in a per-module memory area that can be retrieved " "with :c:func:`PyModule_GetState`, rather than in static globals. This makes " "modules safe for use in multiple sub-interpreters." msgstr "" -#: c-api/module.rst:165 +#: c-api/module.rst:194 msgid "" "This memory area is allocated based on *m_size* on module creation, and " "freed when the module object is deallocated, after the :c:member:" "`~PyModuleDef.m_free` function has been called, if present." msgstr "" -#: c-api/module.rst:169 +#: c-api/module.rst:198 msgid "" -"Setting ``m_size`` to ``-1`` means that the module does not support sub-" -"interpreters, because it has global state." +"Setting it to a non-negative value means that the module can be re-" +"initialized and specifies the additional amount of memory it requires for " +"its state." msgstr "" -#: c-api/module.rst:172 +#: c-api/module.rst:202 msgid "" -"Setting it to a non-negative value means that the module can be re-" -"initialized and specifies the additional amount of memory it requires for " -"its state. Non-negative ``m_size`` is required for multi-phase " -"initialization." +"Setting ``m_size`` to ``-1`` means that the module does not support sub-" +"interpreters, because it has global state. Negative ``m_size`` is only " +"allowed when using :ref:`legacy single-phase initialization ` or when :ref:`creating modules dynamically `." msgstr "" -#: c-api/module.rst:177 +#: c-api/module.rst:208 msgid "See :PEP:`3121` for more details." msgstr "" -#: c-api/module.rst:181 +#: c-api/module.rst:212 msgid "" "A pointer to a table of module-level functions, described by :c:type:" "`PyMethodDef` values. Can be ``NULL`` if no functions are present." msgstr "" -#: c-api/module.rst:186 +#: c-api/module.rst:217 msgid "" "An array of slot definitions for multi-phase initialization, terminated by a " -"``{0, NULL}`` entry. When using single-phase initialization, *m_slots* must " -"be ``NULL``." +"``{0, NULL}`` entry. When using legacy single-phase initialization, " +"*m_slots* must be ``NULL``." msgstr "" -#: c-api/module.rst:192 +#: c-api/module.rst:223 msgid "" "Prior to version 3.5, this member was always set to ``NULL``, and was " "defined as:" msgstr "" -#: c-api/module.rst:199 +#: c-api/module.rst:230 msgid "" "A traversal function to call during GC traversal of the module object, or " "``NULL`` if not needed." msgstr "" -#: c-api/module.rst:217 c-api/module.rst:238 +#: c-api/module.rst:248 c-api/module.rst:269 msgid "" "This function is not called if the module state was requested but is not " "allocated yet. This is the case immediately after the module is created and " @@ -225,17 +274,17 @@ msgid "" "`PyModule_GetState`) is ``NULL``." msgstr "" -#: c-api/module.rst:230 c-api/module.rst:245 +#: c-api/module.rst:261 c-api/module.rst:276 msgid "No longer called before the module state is allocated." msgstr "" -#: c-api/module.rst:214 +#: c-api/module.rst:245 msgid "" "A clear function to call during GC clearing of the module object, or " "``NULL`` if not needed." msgstr "" -#: c-api/module.rst:224 +#: c-api/module.rst:255 msgid "" "Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called " "before a module is deallocated. For example, when reference counting is " @@ -244,151 +293,55 @@ msgid "" "directly." msgstr "" -#: c-api/module.rst:235 +#: c-api/module.rst:266 msgid "" "A function to call during deallocation of the module object, or ``NULL`` if " "not needed." msgstr "" -#: c-api/module.rst:249 -msgid "Single-phase initialization" -msgstr "" - -#: c-api/module.rst:251 -msgid "" -"The module initialization function may create and return the module object " -"directly. This is referred to as \"single-phase initialization\", and uses " -"one of the following two module creation functions:" -msgstr "" - -#: c-api/module.rst:257 -msgid "" -"Create a new module object, given the definition in *def*. This behaves " -"like :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:" -"`PYTHON_API_VERSION`." -msgstr "" - -#: c-api/module.rst:264 -msgid "" -"Create a new module object, given the definition in *def*, assuming the API " -"version *module_api_version*. If that version does not match the version of " -"the running interpreter, a :exc:`RuntimeWarning` is emitted." -msgstr "" - -#: c-api/module.rst:270 -msgid "" -"Most uses of this function should be using :c:func:`PyModule_Create` " -"instead; only use this if you are sure you need it." -msgstr "" - -#: c-api/module.rst:273 -msgid "" -"Before it is returned from in the initialization function, the resulting " -"module object is typically populated using functions like :c:func:" -"`PyModule_AddObjectRef`." -msgstr "" - -#: c-api/module.rst:279 -msgid "Multi-phase initialization" -msgstr "" - #: c-api/module.rst:281 -msgid "" -"An alternate way to specify extensions is to request \"multi-phase " -"initialization\". Extension modules created this way behave more like Python " -"modules: the initialization is split between the *creation phase*, when the " -"module object is created, and the *execution phase*, when it is populated. " -"The distinction is similar to the :py:meth:`!__new__` and :py:meth:`!" -"__init__` methods of classes." -msgstr "" - -#: c-api/module.rst:288 -msgid "" -"Unlike modules created using single-phase initialization, these modules are " -"not singletons: if the *sys.modules* entry is removed and the module is re-" -"imported, a new module object is created, and the old module is subject to " -"normal garbage collection -- as with Python modules. By default, multiple " -"modules created from the same definition should be independent: changes to " -"one should not affect the others. This means that all state should be " -"specific to the module object (using e.g. using :c:func:" -"`PyModule_GetState`), or its contents (such as the module's :attr:`~object." -"__dict__` or individual classes created with :c:func:`PyType_FromSpec`)." -msgstr "" - -#: c-api/module.rst:298 -msgid "" -"All modules created using multi-phase initialization are expected to " -"support :ref:`sub-interpreters `. Making sure " -"multiple modules are independent is typically enough to achieve this." +msgid "Module slots" msgstr "" -#: c-api/module.rst:302 -msgid "" -"To request multi-phase initialization, the initialization function " -"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty :" -"c:member:`~PyModuleDef.m_slots`. Before it is returned, the ``PyModuleDef`` " -"instance must be initialized with the following function:" -msgstr "" - -#: c-api/module.rst:309 -msgid "" -"Ensures a module definition is a properly initialized Python object that " -"correctly reports its type and reference count." -msgstr "" - -#: c-api/module.rst:312 -msgid "Returns *def* cast to ``PyObject*``, or ``NULL`` if an error occurred." -msgstr "" - -#: c-api/module.rst:316 -msgid "" -"The *m_slots* member of the module definition must point to an array of " -"``PyModuleDef_Slot`` structures:" -msgstr "" - -#: c-api/module.rst:323 +#: c-api/module.rst:287 msgid "A slot ID, chosen from the available values explained below." msgstr "" -#: c-api/module.rst:327 +#: c-api/module.rst:291 msgid "Value of the slot, whose meaning depends on the slot ID." msgstr "" -#: c-api/module.rst:331 -msgid "The *m_slots* array must be terminated by a slot with id 0." -msgstr "" - -#: c-api/module.rst:333 +#: c-api/module.rst:295 msgid "The available slot types are:" msgstr "" -#: c-api/module.rst:337 +#: c-api/module.rst:299 msgid "" "Specifies a function that is called to create the module object itself. The " "*value* pointer of this slot must point to a function of the signature:" msgstr "" -#: c-api/module.rst:343 +#: c-api/module.rst:306 msgid "" "The function receives a :py:class:`~importlib.machinery.ModuleSpec` " "instance, as defined in :PEP:`451`, and the module definition. It should " "return a new module object, or set an error and return ``NULL``." msgstr "" -#: c-api/module.rst:348 +#: c-api/module.rst:311 msgid "" "This function should be kept minimal. In particular, it should not call " "arbitrary Python code, as trying to import the same module again may result " "in an infinite loop." msgstr "" -#: c-api/module.rst:352 +#: c-api/module.rst:315 msgid "" "Multiple ``Py_mod_create`` slots may not be specified in one module " "definition." msgstr "" -#: c-api/module.rst:355 +#: c-api/module.rst:318 msgid "" "If ``Py_mod_create`` is not specified, the import machinery will create a " "normal module object using :c:func:`PyModule_New`. The name is taken from " @@ -397,7 +350,7 @@ msgid "" "through symlinks, all while sharing a single module definition." msgstr "" -#: c-api/module.rst:361 +#: c-api/module.rst:324 msgid "" "There is no requirement for the returned object to be an instance of :c:type:" "`PyModule_Type`. Any type can be used, as long as it supports setting and " @@ -407,7 +360,7 @@ msgid "" "``Py_mod_create``." msgstr "" -#: c-api/module.rst:370 +#: c-api/module.rst:335 msgid "" "Specifies a function that is called to *execute* the module. This is " "equivalent to executing the code of a Python module: typically, this " @@ -415,74 +368,126 @@ msgid "" "function is:" msgstr "" -#: c-api/module.rst:378 +#: c-api/module.rst:344 msgid "" "If multiple ``Py_mod_exec`` slots are specified, they are processed in the " "order they appear in the *m_slots* array." msgstr "" -#: c-api/module.rst:383 +#: c-api/module.rst:384 msgid "Specifies one of the following values:" msgstr "" -#: c-api/module.rst:389 +#: c-api/module.rst:357 msgid "The module does not support being imported in subinterpreters." msgstr "" -#: c-api/module.rst:393 +#: c-api/module.rst:361 msgid "" "The module supports being imported in subinterpreters, but only when they " "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: c-api/module.rst:399 +#: c-api/module.rst:367 msgid "" "The module supports being imported in subinterpreters, even when they have " "their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: c-api/module.rst:403 +#: c-api/module.rst:371 msgid "" "This slot determines whether or not importing this module in a " "subinterpreter will fail." msgstr "" -#: c-api/module.rst:406 +#: c-api/module.rst:374 msgid "" "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one " "module definition." msgstr "" -#: c-api/module.rst:409 +#: c-api/module.rst:377 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " -"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." +"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" -#: c-api/module.rst:414 -msgid "See :PEP:`489` for more details on multi-phase initialization." +#: c-api/module.rst:390 +msgid "" +"The module depends on the presence of the global interpreter lock (GIL), and " +"may access global state without synchronization." msgstr "" -#: c-api/module.rst:417 -msgid "Low-level module creation functions" +#: c-api/module.rst:395 +msgid "The module is safe to run without an active GIL." msgstr "" -#: c-api/module.rst:419 +#: c-api/module.rst:397 msgid "" -"The following functions are called under the hood when using multi-phase " -"initialization. They can be used directly, for example when creating module " -"objects dynamically. Note that both ``PyModule_FromDefAndSpec`` and " -"``PyModule_ExecDef`` must be called to fully initialize a module." +"This slot is ignored by Python builds not configured with :option:`--disable-" +"gil`. Otherwise, it determines whether or not importing this module will " +"cause the GIL to be automatically enabled. See :ref:`whatsnew313-free-" +"threaded-cpython` for more detail." msgstr "" -#: c-api/module.rst:426 +#: c-api/module.rst:402 msgid "" -"Create a new module object, given the definition in *def* and the ModuleSpec " -"*spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2` with " -"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`." +"Multiple ``Py_mod_gil`` slots may not be specified in one module definition." +msgstr "" + +#: c-api/module.rst:404 +msgid "" +"If ``Py_mod_gil`` is not specified, the import machinery defaults to " +"``Py_MOD_GIL_USED``." +msgstr "" + +#: c-api/module.rst:413 +msgid "Creating extension modules dynamically" +msgstr "" + +#: c-api/module.rst:415 +msgid "" +"The following functions may be used to create a module outside of an " +"extension's :ref:`initialization function `. They are " +"also used in :ref:`single-phase initialization `." msgstr "" -#: c-api/module.rst:434 +#: c-api/module.rst:422 +msgid "" +"Create a new module object, given the definition in *def*. This is a macro " +"that calls :c:func:`PyModule_Create2` with *module_api_version* set to :c:" +"macro:`PYTHON_API_VERSION`, or to :c:macro:`PYTHON_ABI_VERSION` if using " +"the :ref:`limited API `." +msgstr "" + +#: c-api/module.rst:430 +msgid "" +"Create a new module object, given the definition in *def*, assuming the API " +"version *module_api_version*. If that version does not match the version of " +"the running interpreter, a :exc:`RuntimeWarning` is emitted." +msgstr "" + +#: c-api/module.rst:436 +msgid "" +"This function does not support slots. The :c:member:`~PyModuleDef.m_slots` " +"member of *def* must be ``NULL``." +msgstr "" + +#: c-api/module.rst:442 +msgid "" +"Most uses of this function should be using :c:func:`PyModule_Create` " +"instead; only use this if you are sure you need it." +msgstr "" + +#: c-api/module.rst:447 +msgid "" +"This macro calls :c:func:`PyModule_FromDefAndSpec2` with " +"*module_api_version* set to :c:macro:`PYTHON_API_VERSION`, or to :c:macro:" +"`PYTHON_ABI_VERSION` if using the :ref:`limited API `." +msgstr "" + +#: c-api/module.rst:456 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -490,158 +495,290 @@ msgid "" "emitted." msgstr "" -#: c-api/module.rst:441 +#: c-api/module.rst:463 +msgid "" +"Note that this does not process execution slots (:c:data:`Py_mod_exec`). " +"Both ``PyModule_FromDefAndSpec`` and ``PyModule_ExecDef`` must be called to " +"fully initialize a module." +msgstr "" + +#: c-api/module.rst:469 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: c-api/module.rst:448 +#: c-api/module.rst:476 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: c-api/module.rst:454 -msgid "" -"Set the docstring for *module* to *docstring*. This function is called " -"automatically when creating a module from ``PyModuleDef``, using either " -"``PyModule_Create`` or ``PyModule_FromDefAndSpec``." +#: c-api/module.rst:482 +msgid "The C API version. Defined for backwards compatibility." msgstr "" -#: c-api/module.rst:463 +#: c-api/module.rst:491 msgid "" -"Add the functions from the ``NULL`` terminated *functions* array to " -"*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " -"individual entries (due to the lack of a shared module namespace, module " -"level \"functions\" implemented in C typically receive the module as their " -"first parameter, making them similar to instance methods on Python classes). " -"This function is called automatically when creating a module from " -"``PyModuleDef``, using either ``PyModule_Create`` or " -"``PyModule_FromDefAndSpec``." +"Currently, this constant is not updated in new Python versions, and is not " +"useful for versioning. This may change in the future." +msgstr "" + +#: c-api/module.rst:489 +msgid "Defined as ``3`` for backwards compatibility." msgstr "" -#: c-api/module.rst:475 +#: c-api/module.rst:496 msgid "Support functions" msgstr "" -#: c-api/module.rst:477 +#: c-api/module.rst:498 msgid "" -"The module initialization function (if using single phase initialization) or " -"a function called from a module execution slot (if using multi-phase " -"initialization), can use the following functions to help initialize the " -"module state:" +"The following functions are provided to help initialize a module state. They " +"are intended for a module's execution slots (:c:data:`Py_mod_exec`), the " +"initialization function for legacy :ref:`single-phase initialization `, or code that creates modules dynamically." msgstr "" -#: c-api/module.rst:484 +#: c-api/module.rst:506 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: c-api/module.rst:487 +#: c-api/module.rst:509 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: c-api/module.rst:489 +#: c-api/module.rst:562 c-api/module.rst:589 +msgid "Example usage::" +msgstr "" + +#: c-api/module.rst:513 msgid "" -"Return ``NULL`` if *value* is ``NULL``. It must be called with an exception " -"raised in this case." +"static int\n" +"add_spam(PyObject *module, int value)\n" +"{\n" +" PyObject *obj = PyLong_FromLong(value);\n" +" if (obj == NULL) {\n" +" return -1;\n" +" }\n" +" int res = PyModule_AddObjectRef(module, \"spam\", obj);\n" +" Py_DECREF(obj);\n" +" return res;\n" +" }" msgstr "" -#: c-api/module.rst:541 -msgid "Example usage::" +#: c-api/module.rst:525 +msgid "" +"To be convenient, the function accepts ``NULL`` *value* with an exception " +"set. In this case, return ``-1`` and just leave the raised exception " +"unchanged." msgstr "" -#: c-api/module.rst:559 +#: c-api/module.rst:529 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: c-api/module.rst:575 +#: c-api/module.rst:532 +msgid "" +"static int\n" +"add_spam(PyObject *module, int value)\n" +"{\n" +" PyObject *obj = PyLong_FromLong(value);\n" +" int res = PyModule_AddObjectRef(module, \"spam\", obj);\n" +" Py_XDECREF(obj);\n" +" return res;\n" +" }" +msgstr "" + +#: c-api/module.rst:541 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: c-api/module.rst:526 +#: c-api/module.rst:544 +msgid "" +"The number of different *name* strings passed to this function should be " +"kept small, usually by only using statically allocated strings as *name*. " +"For names that aren't known at compile time, prefer calling :c:func:" +"`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more " +"details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object." +msgstr "" + +#: c-api/module.rst:557 +msgid "" +"Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " +"*value*. It can be called with a result of function that returns a new " +"reference without bothering to check its result or even saving it to a " +"variable." +msgstr "" + +#: c-api/module.rst:564 +msgid "" +"if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" +" goto error;\n" +"}" +msgstr "" + +#: c-api/module.rst:573 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: c-api/module.rst:529 +#: c-api/module.rst:576 msgid "" -"The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is " -"easy to introduce reference leaks by misusing the :c:func:" -"`PyModule_AddObject` function." +"The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " +"are recommended, since it is easy to introduce reference leaks by misusing " +"the :c:func:`PyModule_AddObject` function." msgstr "" -#: c-api/module.rst:535 +#: c-api/module.rst:583 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: c-api/module.rst:538 +#: c-api/module.rst:586 msgid "" "This means that its return value must be checked, and calling code must :c:" -"func:`Py_DECREF` *value* manually on error." +"func:`Py_XDECREF` *value* manually on error." +msgstr "" + +#: c-api/module.rst:591 +msgid "" +"PyObject *obj = PyBytes_FromString(value);\n" +"if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" +" // If 'obj' is not NULL and PyModule_AddObject() failed,\n" +" // 'obj' strong reference must be deleted with Py_XDECREF().\n" +" // If 'obj' is NULL, Py_XDECREF() does nothing.\n" +" Py_XDECREF(obj);\n" +" goto error;\n" +"}\n" +"// PyModule_AddObject() stole a reference to obj:\n" +"// Py_XDECREF(obj) is not needed here." +msgstr "" + +#: c-api/module.rst:604 +msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: c-api/module.rst:581 +#: c-api/module.rst:609 msgid "" "Add an integer constant to *module* as *name*. This convenience function " -"can be used from the module's initialization function. Return ``-1`` on " -"error, ``0`` on success." +"can be used from the module's initialization function. Return ``-1`` with an " +"exception set on error, ``0`` on success." +msgstr "" + +#: c-api/module.rst:613 +msgid "" +"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" +"func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -#: c-api/module.rst:588 +#: c-api/module.rst:619 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " -"be ``NULL``-terminated. Return ``-1`` on error, ``0`` on success." +"be ``NULL``-terminated. Return ``-1`` with an exception set on error, ``0`` " +"on success." +msgstr "" + +#: c-api/module.rst:624 +msgid "" +"This is a convenience function that calls :c:func:" +"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " +"documentation for details." msgstr "" -#: c-api/module.rst:595 +#: c-api/module.rst:631 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " -"constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` on " -"error, ``0`` on success." +"constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` " +"with an exception set on error, ``0`` on success." msgstr "" -#: c-api/module.rst:603 +#: c-api/module.rst:639 msgid "Add a string constant to *module*." msgstr "" -#: c-api/module.rst:607 +#: c-api/module.rst:643 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " "the last component of :c:member:`~PyTypeObject.tp_name` after dot. Return " -"``-1`` on error, ``0`` on success." +"``-1`` with an exception set on error, ``0`` on success." +msgstr "" + +#: c-api/module.rst:653 +msgid "" +"Add the functions from the ``NULL`` terminated *functions* array to " +"*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " +"individual entries (due to the lack of a shared module namespace, module " +"level \"functions\" implemented in C typically receive the module as their " +"first parameter, making them similar to instance methods on Python classes)." +msgstr "" + +#: c-api/module.rst:659 +msgid "" +"This function is called automatically when creating a module from " +"``PyModuleDef`` (such as when using :ref:`multi-phase-initialization`, " +"``PyModule_Create``, or ``PyModule_FromDefAndSpec``). Some module authors " +"may prefer defining functions in multiple :c:type:`PyMethodDef` arrays; in " +"that case they should call this function directly." msgstr "" -#: c-api/module.rst:617 -msgid "Module lookup" +#: c-api/module.rst:666 +msgid "" +"The *functions* array must be statically allocated (or otherwise guaranteed " +"to outlive the module object)." msgstr "" -#: c-api/module.rst:619 +#: c-api/module.rst:673 +msgid "" +"Set the docstring for *module* to *docstring*. This function is called " +"automatically when creating a module from ``PyModuleDef`` (such as when " +"using :ref:`multi-phase-initialization`, ``PyModule_Create``, or " +"``PyModule_FromDefAndSpec``)." +msgstr "" + +#: c-api/module.rst:682 +msgid "" +"Indicate that *module* does or does not support running without the global " +"interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " +"It must be called during *module*'s initialization function when using :ref:" +"`single-phase-initialization`. If this function is not called during module " +"initialization, the import machinery assumes the module does not support " +"running without the GIL. This function is only available in Python builds " +"configured with :option:`--disable-gil`. Return ``-1`` with an exception set " +"on error, ``0`` on success." +msgstr "" + +#: c-api/module.rst:696 +msgid "Module lookup (single-phase initialization)" +msgstr "" + +#: c-api/module.rst:698 msgid "" -"Single-phase initialization creates singleton modules that can be looked up " -"in the context of the current interpreter. This allows the module object to " -"be retrieved later with only a reference to the module definition." +"The legacy :ref:`single-phase initialization ` " +"initialization scheme creates singleton modules that can be looked up in the " +"context of the current interpreter. This allows the module object to be " +"retrieved later with only a reference to the module definition." msgstr "" -#: c-api/module.rst:623 +#: c-api/module.rst:703 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: c-api/module.rst:628 +#: c-api/module.rst:708 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -650,20 +787,21 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: c-api/module.rst:635 +#: c-api/module.rst:715 msgid "" "Attaches the module object passed to the function to the interpreter state. " "This allows the module object to be accessible via :c:func:" "`PyState_FindModule`." msgstr "" -#: c-api/module.rst:638 +#: c-api/module.rst:718 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: c-api/module.rst:640 +#: c-api/module.rst:720 msgid "" -"Python calls ``PyState_AddModule`` automatically after importing a module, " +"Python calls ``PyState_AddModule`` automatically after importing a module " +"that uses :ref:`single-phase initialization `, " "so it is unnecessary (but harmless) to call it from module initialization " "code. An explicit call is needed only if the module's own init code " "subsequently calls ``PyState_FindModule``. The function is mainly intended " @@ -672,18 +810,24 @@ msgid "" "state updates)." msgstr "" -#: c-api/module.rst:659 -msgid "The caller must hold the GIL." +#: c-api/module.rst:729 +msgid "" +"If a module was attached previously using the same *def*, it is replaced by " +"the new *module*." msgstr "" -#: c-api/module.rst:650 -msgid "Return 0 on success or -1 on failure." +#: c-api/module.rst:743 +msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: c-api/module.rst:656 +#: c-api/module.rst:734 +msgid "Return ``-1`` with an exception set on error, ``0`` on success." +msgstr "" + +#: c-api/module.rst:740 msgid "" "Removes the module object created from *def* from the interpreter state. " -"Return 0 on success or -1 on failure." +"Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" #: c-api/module.rst:8 @@ -698,7 +842,7 @@ msgstr "" msgid "ModuleType (in module types)" msgstr "" -#: c-api/module.rst:74 +#: c-api/module.rst:80 msgid "__name__ (module attribute)" msgstr "" @@ -706,7 +850,7 @@ msgstr "" msgid "__doc__ (module attribute)" msgstr "" -#: c-api/module.rst:104 +#: c-api/module.rst:119 msgid "__file__ (module attribute)" msgstr "" @@ -718,10 +862,10 @@ msgstr "" msgid "__loader__ (module attribute)" msgstr "" -#: c-api/module.rst:60 +#: c-api/module.rst:63 msgid "__dict__ (module attribute)" msgstr "" -#: c-api/module.rst:104 +#: c-api/module.rst:119 msgid "SystemError (built-in exception)" msgstr "" diff --git a/c-api/monitoring.po b/c-api/monitoring.po new file mode 100644 index 00000000..e4ae056e --- /dev/null +++ b/c-api/monitoring.po @@ -0,0 +1,303 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: c-api/monitoring.rst:6 +msgid "Monitoring C API" +msgstr "" + +#: c-api/monitoring.rst:8 +msgid "Added in version 3.13." +msgstr "" + +#: c-api/monitoring.rst:10 +msgid "" +"An extension may need to interact with the event monitoring system. " +"Subscribing to events and registering callbacks can be done via the Python " +"API exposed in :mod:`sys.monitoring`." +msgstr "" + +#: c-api/monitoring.rst:15 +msgid "Generating Execution Events" +msgstr "" + +#: c-api/monitoring.rst:17 +msgid "" +"The functions below make it possible for an extension to fire monitoring " +"events as it emulates the execution of Python code. Each of these functions " +"accepts a ``PyMonitoringState`` struct which contains concise information " +"about the activation state of events, as well as the event arguments, which " +"include a ``PyObject*`` representing the code object, the instruction offset " +"and sometimes additional, event-specific arguments (see :mod:`sys." +"monitoring` for details about the signatures of the different event " +"callbacks). The ``codelike`` argument should be an instance of :class:`types." +"CodeType` or of a type that emulates it." +msgstr "" + +#: c-api/monitoring.rst:27 +msgid "" +"The VM disables tracing when firing an event, so there is no need for user " +"code to do that." +msgstr "" + +#: c-api/monitoring.rst:30 +msgid "" +"Monitoring functions should not be called with an exception set, except " +"those listed below as working with the current exception." +msgstr "" + +#: c-api/monitoring.rst:35 +msgid "" +"Representation of the state of an event type. It is allocated by the user " +"while its contents are maintained by the monitoring API functions described " +"below." +msgstr "" + +#: c-api/monitoring.rst:39 +msgid "" +"All of the functions below return 0 on success and -1 (with an exception " +"set) on error." +msgstr "" + +#: c-api/monitoring.rst:41 +msgid "See :mod:`sys.monitoring` for descriptions of the events." +msgstr "" + +#: c-api/monitoring.rst:45 +msgid "Fire a ``PY_START`` event." +msgstr "" + +#: c-api/monitoring.rst:50 +msgid "Fire a ``PY_RESUME`` event." +msgstr "" + +#: c-api/monitoring.rst:55 +msgid "Fire a ``PY_RETURN`` event." +msgstr "" + +#: c-api/monitoring.rst:60 +msgid "Fire a ``PY_YIELD`` event." +msgstr "" + +#: c-api/monitoring.rst:65 +msgid "Fire a ``CALL`` event." +msgstr "" + +#: c-api/monitoring.rst:70 +msgid "Fire a ``LINE`` event." +msgstr "" + +#: c-api/monitoring.rst:75 +msgid "Fire a ``JUMP`` event." +msgstr "" + +#: c-api/monitoring.rst:80 +msgid "Fire a ``BRANCH_LEFT`` event." +msgstr "" + +#: c-api/monitoring.rst:85 +msgid "Fire a ``BRANCH_RIGHT`` event." +msgstr "" + +#: c-api/monitoring.rst:90 +msgid "Fire a ``C_RETURN`` event." +msgstr "" + +#: c-api/monitoring.rst:95 +msgid "" +"Fire a ``PY_THROW`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: c-api/monitoring.rst:101 +msgid "" +"Fire a ``RAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: c-api/monitoring.rst:107 +msgid "" +"Fire a ``C_RAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: c-api/monitoring.rst:113 +msgid "" +"Fire a ``RERAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: c-api/monitoring.rst:119 +msgid "" +"Fire an ``EXCEPTION_HANDLED`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." +msgstr "" + +#: c-api/monitoring.rst:125 +msgid "" +"Fire a ``PY_UNWIND`` event with the current exception (as returned by :c:" +"func:`PyErr_GetRaisedException`)." +msgstr "" + +#: c-api/monitoring.rst:131 +msgid "" +"Fire a ``STOP_ITERATION`` event. If ``value`` is an instance of :exc:" +"`StopIteration`, it is used. Otherwise, a new :exc:`StopIteration` instance " +"is created with ``value`` as its argument." +msgstr "" + +#: c-api/monitoring.rst:136 +msgid "Managing the Monitoring State" +msgstr "" + +#: c-api/monitoring.rst:138 +msgid "" +"Monitoring states can be managed with the help of monitoring scopes. A scope " +"would typically correspond to a Python function." +msgstr "" + +#: c-api/monitoring.rst:143 +msgid "" +"Enter a monitored scope. ``event_types`` is an array of the event IDs for " +"events that may be fired from the scope. For example, the ID of a " +"``PY_START`` event is the value ``PY_MONITORING_EVENT_PY_START``, which is " +"numerically equal to the base-2 logarithm of ``sys.monitoring.events." +"PY_START``. ``state_array`` is an array with a monitoring state entry for " +"each event in ``event_types``, it is allocated by the user but populated by :" +"c:func:`!PyMonitoring_EnterScope` with information about the activation " +"state of the event. The size of ``event_types`` (and hence also of " +"``state_array``) is given in ``length``." +msgstr "" + +#: c-api/monitoring.rst:153 +msgid "" +"The ``version`` argument is a pointer to a value which should be allocated " +"by the user together with ``state_array`` and initialized to 0, and then set " +"only by :c:func:`!PyMonitoring_EnterScope` itself. It allows this function " +"to determine whether event states have changed since the previous call, and " +"to return quickly if they have not." +msgstr "" + +#: c-api/monitoring.rst:159 +msgid "" +"The scopes referred to here are lexical scopes: a function, class or " +"method. :c:func:`!PyMonitoring_EnterScope` should be called whenever the " +"lexical scope is entered. Scopes can be reentered, reusing the same " +"*state_array* and *version*, in situations like when emulating a recursive " +"Python function. When a code-like's execution is paused, such as when " +"emulating a generator, the scope needs to be exited and re-entered." +msgstr "" + +#: c-api/monitoring.rst:166 +msgid "The macros for *event_types* are:" +msgstr "" + +#: c-api/monitoring.rst:174 +msgid "Macro" +msgstr "" + +#: c-api/monitoring.rst:174 +msgid "Event" +msgstr "" + +#: c-api/monitoring.rst:176 +msgid ":monitoring-event:`BRANCH_LEFT`" +msgstr "" + +#: c-api/monitoring.rst:177 +msgid ":monitoring-event:`BRANCH_RIGHT`" +msgstr "" + +#: c-api/monitoring.rst:178 +msgid ":monitoring-event:`CALL`" +msgstr "" + +#: c-api/monitoring.rst:179 +msgid ":monitoring-event:`C_RAISE`" +msgstr "" + +#: c-api/monitoring.rst:180 +msgid ":monitoring-event:`C_RETURN`" +msgstr "" + +#: c-api/monitoring.rst:181 +msgid ":monitoring-event:`EXCEPTION_HANDLED`" +msgstr "" + +#: c-api/monitoring.rst:182 +msgid ":monitoring-event:`INSTRUCTION`" +msgstr "" + +#: c-api/monitoring.rst:183 +msgid ":monitoring-event:`JUMP`" +msgstr "" + +#: c-api/monitoring.rst:184 +msgid ":monitoring-event:`LINE`" +msgstr "" + +#: c-api/monitoring.rst:185 +msgid ":monitoring-event:`PY_RESUME`" +msgstr "" + +#: c-api/monitoring.rst:186 +msgid ":monitoring-event:`PY_RETURN`" +msgstr "" + +#: c-api/monitoring.rst:187 +msgid ":monitoring-event:`PY_START`" +msgstr "" + +#: c-api/monitoring.rst:188 +msgid ":monitoring-event:`PY_THROW`" +msgstr "" + +#: c-api/monitoring.rst:189 +msgid ":monitoring-event:`PY_UNWIND`" +msgstr "" + +#: c-api/monitoring.rst:190 +msgid ":monitoring-event:`PY_YIELD`" +msgstr "" + +#: c-api/monitoring.rst:191 +msgid ":monitoring-event:`RAISE`" +msgstr "" + +#: c-api/monitoring.rst:192 +msgid ":monitoring-event:`RERAISE`" +msgstr "" + +#: c-api/monitoring.rst:193 +msgid ":monitoring-event:`STOP_ITERATION`" +msgstr "" + +#: c-api/monitoring.rst:198 +msgid "" +"Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." +msgstr "" + +#: c-api/monitoring.rst:203 +msgid "" +"Return true if the event corresponding to the event ID *ev* is a :ref:`local " +"event `." +msgstr "" + +#: c-api/monitoring.rst:210 +msgid "This function is :term:`soft deprecated`." +msgstr "" diff --git a/c-api/none.po b/c-api/none.po index bbd7ea16..5eec1ba8 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,11 +32,11 @@ msgstr "" #: c-api/none.rst:18 msgid "" "The Python ``None`` object, denoting lack of value. This object has no " -"methods and is `immortal `_." +"methods and is :term:`immortal`." msgstr "" #: c-api/none.rst:21 -msgid ":c:data:`Py_None` is immortal." +msgid ":c:data:`Py_None` is :term:`immortal`." msgstr "" #: c-api/none.rst:26 diff --git a/c-api/number.po b/c-api/number.po index d59b2015..4ebcfa3f 100644 --- a/c-api/number.po +++ b/c-api/number.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -64,8 +65,8 @@ msgstr "" msgid "" "Return a reasonable approximation for the mathematical value of *o1* divided " "by *o2*, or ``NULL`` on failure. The return value is \"approximate\" " -"because binary floating point numbers are approximate; it is not possible to " -"represent all real numbers in base two. This function can return a floating " +"because binary floating-point numbers are approximate; it is not possible to " +"represent all real numbers in base two. This function can return a floating-" "point value when passed two integers. This is the equivalent of the Python " "expression ``o1 / o2``." msgstr "" @@ -183,8 +184,8 @@ msgstr "" msgid "" "Return a reasonable approximation for the mathematical value of *o1* divided " "by *o2*, or ``NULL`` on failure. The return value is \"approximate\" " -"because binary floating point numbers are approximate; it is not possible to " -"represent all real numbers in base two. This function can return a floating " +"because binary floating-point numbers are approximate; it is not possible to " +"represent all real numbers in base two. This function can return a floating-" "point value when passed two integers. The operation is done *in-place* when " "*o1* supports it. This is the equivalent of the Python statement ``o1 /= " "o2``." diff --git a/c-api/objbuffer.po b/c-api/objbuffer.po index 38193523..2e22f5ef 100644 --- a/c-api/objbuffer.po +++ b/c-api/objbuffer.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-05-02 23:29+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/c-api/object.po b/c-api/object.po index ee23c81c..afb419c2 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -21,26 +22,149 @@ msgid "Object Protocol" msgstr "" #: c-api/object.rst:11 +msgid "Get a :term:`strong reference` to a constant." +msgstr "" + +#: c-api/object.rst:13 +msgid "Set an exception and return ``NULL`` if *constant_id* is invalid." +msgstr "" + +#: c-api/object.rst:15 +msgid "*constant_id* must be one of these constant identifiers:" +msgstr "" + +#: c-api/object.rst:20 +msgid "Constant Identifier" +msgstr "" + +#: c-api/object.rst:20 +msgid "Value" +msgstr "" + +#: c-api/object.rst:20 +msgid "Returned object" +msgstr "" + +#: c-api/object.rst:27 +msgid "``0``" +msgstr "" + +#: c-api/object.rst:22 +msgid ":py:data:`None`" +msgstr "" + +#: c-api/object.rst:28 +msgid "``1``" +msgstr "" + +#: c-api/object.rst:23 +msgid ":py:data:`False`" +msgstr "" + +#: c-api/object.rst:24 +msgid "``2``" +msgstr "" + +#: c-api/object.rst:24 +msgid ":py:data:`True`" +msgstr "" + +#: c-api/object.rst:25 +msgid "``3``" +msgstr "" + +#: c-api/object.rst:25 +msgid ":py:data:`Ellipsis`" +msgstr "" + +#: c-api/object.rst:26 +msgid "``4``" +msgstr "" + +#: c-api/object.rst:26 +msgid ":py:data:`NotImplemented`" +msgstr "" + +#: c-api/object.rst:27 +msgid "``5``" +msgstr "" + +#: c-api/object.rst:28 +msgid "``6``" +msgstr "" + +#: c-api/object.rst:29 +msgid "``7``" +msgstr "" + +#: c-api/object.rst:29 +msgid "``''``" +msgstr "" + +#: c-api/object.rst:30 +msgid "``8``" +msgstr "" + +#: c-api/object.rst:30 +msgid "``b''``" +msgstr "" + +#: c-api/object.rst:31 +msgid "``9``" +msgstr "" + +#: c-api/object.rst:31 +msgid "``()``" +msgstr "" + +#: c-api/object.rst:34 +msgid "" +"Numeric values are only given for projects which cannot use the constant " +"identifiers." +msgstr "" + +#: c-api/object.rst:42 +msgid "In CPython, all of these constants are :term:`immortal`." +msgstr "" + +#: c-api/object.rst:47 +msgid "" +"Similar to :c:func:`Py_GetConstant`, but return a :term:`borrowed reference`." +msgstr "" + +#: c-api/object.rst:50 +msgid "" +"This function is primarily intended for backwards compatibility: using :c:" +"func:`Py_GetConstant` is recommended for new code." +msgstr "" + +#: c-api/object.rst:53 +msgid "" +"The reference is borrowed from the interpreter, and is valid until the " +"interpreter finalization." +msgstr "" + +#: c-api/object.rst:61 msgid "" "The ``NotImplemented`` singleton, used to signal that an operation is not " "implemented for the given type combination." msgstr "" -#: c-api/object.rst:17 +#: c-api/object.rst:67 msgid "" "Properly handle returning :c:data:`Py_NotImplemented` from within a C " -"function (that is, create a new :term:`strong reference` to NotImplemented " -"and return it)." +"function (that is, create a new :term:`strong reference` to :const:" +"`NotImplemented` and return it)." msgstr "" -#: c-api/object.rst:24 +#: c-api/object.rst:74 msgid "" "Flag to be used with multiple functions that print the object (like :c:func:" "`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these " -"function would use the :func:`str` of the object instead of the :func:`repr`." +"functions use the :func:`str` of the object instead of the :func:`repr`." msgstr "" -#: c-api/object.rst:32 +#: c-api/object.rst:82 msgid "" "Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags " "argument is used to enable certain printing options. The only option " @@ -48,50 +172,100 @@ msgid "" "the object is written instead of the :func:`repr`." msgstr "" -#: c-api/object.rst:40 +#: c-api/object.rst:90 msgid "" -"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " -"This is equivalent to the Python expression ``hasattr(o, attr_name)``. This " -"function always succeeds." +"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " +"This is equivalent to the Python expression ``hasattr(o, attr_name)``. On " +"failure, return ``-1``." msgstr "" -#: c-api/object.rst:46 +#: c-api/object.rst:99 +msgid "" +"This is the same as :c:func:`PyObject_HasAttrWithError`, but *attr_name* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" + +#: c-api/object.rst:108 +msgid "" +"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " +"This function always succeeds." +msgstr "" + +#: c-api/object.rst:113 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods are silently ignored. For proper error " -"handling, use :c:func:`PyObject_GetAttr` instead." +"`~object.__getattribute__` methods aren't propagated, but instead given to :" +"func:`sys.unraisablehook`. For proper error handling, use :c:func:" +"`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:" +"`PyObject_GetAttr` instead." msgstr "" -#: c-api/object.rst:53 +#: c-api/object.rst:122 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/object.rst:59 +#: c-api/object.rst:128 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" "`~object.__getattribute__` methods or while creating the temporary :class:" "`str` object are silently ignored. For proper error handling, use :c:func:" -"`PyObject_GetAttrString` instead." +"`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"or :c:func:`PyObject_GetAttrString` instead." msgstr "" -#: c-api/object.rst:67 +#: c-api/object.rst:138 msgid "" "Retrieve an attribute named *attr_name* from object *o*. Returns the " "attribute value on success, or ``NULL`` on failure. This is the equivalent " "of the Python expression ``o.attr_name``." msgstr "" -#: c-api/object.rst:74 +#: c-api/object.rst:142 +msgid "" +"If the missing attribute should not be treated as a failure, you can use :c:" +"func:`PyObject_GetOptionalAttr` instead." +msgstr "" + +#: c-api/object.rst:148 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/object.rst:81 +#: c-api/object.rst:152 +msgid "" +"If the missing attribute should not be treated as a failure, you can use :c:" +"func:`PyObject_GetOptionalAttrString` instead." +msgstr "" + +#: c-api/object.rst:158 +msgid "" +"Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" +"`AttributeError` if the attribute is not found." +msgstr "" + +#: c-api/object.rst:161 +msgid "" +"If the attribute is found, return ``1`` and set *\\*result* to a new :term:" +"`strong reference` to the attribute. If the attribute is not found, return " +"``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is " +"silenced. If an error other than :exc:`AttributeError` is raised, return " +"``-1`` and set *\\*result* to ``NULL``." +msgstr "" + +#: c-api/object.rst:173 +msgid "" +"This is the same as :c:func:`PyObject_GetOptionalAttr`, but *attr_name* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" + +#: c-api/object.rst:181 msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " @@ -101,34 +275,44 @@ msgid "" "descriptors don't. Otherwise, an :exc:`AttributeError` is raised." msgstr "" -#: c-api/object.rst:91 +#: c-api/object.rst:191 msgid "" "Set the value of the attribute named *attr_name*, for object *o*, to the " "value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on " "success. This is the equivalent of the Python statement ``o.attr_name = v``." msgstr "" -#: c-api/object.rst:96 +#: c-api/object.rst:196 msgid "" "If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated " "in favour of using :c:func:`PyObject_DelAttr`, but there are currently no " "plans to remove it." msgstr "" -#: c-api/object.rst:103 +#: c-api/object.rst:203 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/object.rst:107 +#: c-api/object.rst:207 msgid "" "If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated " "in favour of using :c:func:`PyObject_DelAttrString`." msgstr "" -#: c-api/object.rst:113 +#: c-api/object.rst:210 +msgid "" +"The number of different attribute names passed to this function should be " +"kept small, usually by using a statically allocated string as *attr_name*. " +"For attribute names that aren't known at compile time, prefer calling :c:" +"func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For " +"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object." +msgstr "" + +#: c-api/object.rst:220 msgid "" "Generic attribute setter and deleter function that is meant to be put into a " "type object's :c:member:`~PyTypeObject.tp_setattro` slot. It looks for a " @@ -140,26 +324,36 @@ msgid "" "returned." msgstr "" -#: c-api/object.rst:125 +#: c-api/object.rst:232 msgid "" "Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on " "failure. This is the equivalent of the Python statement ``del o.attr_name``." msgstr "" -#: c-api/object.rst:131 +#: c-api/object.rst:238 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: c-api/object.rst:138 +#: c-api/object.rst:242 +msgid "" +"The number of different attribute names passed to this function should be " +"kept small, usually by using a statically allocated string as *attr_name*. " +"For attribute names that aren't known at compile time, prefer calling :c:" +"func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For " +"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object for lookup." +msgstr "" + +#: c-api/object.rst:253 msgid "" "A generic implementation for the getter of a ``__dict__`` descriptor. It " "creates the dictionary if necessary." msgstr "" -#: c-api/object.rst:141 +#: c-api/object.rst:256 msgid "" "This function may also be called to get the :py:attr:`~object.__dict__` of " "the object *o*. Pass ``NULL`` for *context* when calling it. Since this " @@ -168,30 +362,30 @@ msgid "" "the object." msgstr "" -#: c-api/object.rst:147 +#: c-api/object.rst:262 msgid "On failure, returns ``NULL`` with an exception set." msgstr "" -#: c-api/object.rst:154 +#: c-api/object.rst:269 msgid "" "A generic implementation for the setter of a ``__dict__`` descriptor. This " "implementation does not allow the dictionary to be deleted." msgstr "" -#: c-api/object.rst:162 +#: c-api/object.rst:277 msgid "" "Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " "there is no ``__dict__``, return ``NULL`` without setting an exception." msgstr "" -#: c-api/object.rst:165 +#: c-api/object.rst:280 msgid "" "This function may need to allocate memory for the dictionary, so it may be " "more efficient to call :c:func:`PyObject_GetAttr` when accessing an " "attribute on the object." msgstr "" -#: c-api/object.rst:172 +#: c-api/object.rst:287 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" @@ -202,33 +396,33 @@ msgid "" "success, or ``NULL`` on failure." msgstr "" -#: c-api/object.rst:182 +#: c-api/object.rst:297 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "like :c:func:`PyObject_RichCompare`, but returns ``-1`` on error, ``0`` if " "the result is false, ``1`` otherwise." msgstr "" -#: c-api/object.rst:187 +#: c-api/object.rst:302 msgid "" "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " "will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`." msgstr "" -#: c-api/object.rst:192 +#: c-api/object.rst:307 msgid "" "Format *obj* using *format_spec*. This is equivalent to the Python " "expression ``format(obj, format_spec)``." msgstr "" -#: c-api/object.rst:195 +#: c-api/object.rst:310 msgid "" "*format_spec* may be ``NULL``. In this case the call is equivalent to " "``format(obj)``. Returns the formatted string on success, ``NULL`` on " "failure." msgstr "" -#: c-api/object.rst:203 +#: c-api/object.rst:318 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -236,13 +430,13 @@ msgid "" "function." msgstr "" -#: c-api/object.rst:231 +#: c-api/object.rst:346 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: c-api/object.rst:215 +#: c-api/object.rst:330 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " "but escape the non-ASCII characters in the string returned by :c:func:" @@ -251,7 +445,7 @@ msgid "" "Called by the :func:`ascii` built-in function." msgstr "" -#: c-api/object.rst:226 +#: c-api/object.rst:341 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -259,7 +453,7 @@ msgid "" "function and, therefore, by the :func:`print` function." msgstr "" -#: c-api/object.rst:240 +#: c-api/object.rst:355 msgid "" "Compute a bytes representation of object *o*. ``NULL`` is returned on " "failure and a bytes object on success. This is equivalent to the Python " @@ -268,73 +462,73 @@ msgid "" "bytes object." msgstr "" -#: c-api/object.rst:249 +#: c-api/object.rst:364 msgid "" "Return ``1`` if the class *derived* is identical to or derived from the " "class *cls*, otherwise return ``0``. In case of an error, return ``-1``." msgstr "" -#: c-api/object.rst:271 +#: c-api/object.rst:386 msgid "" "If *cls* is a tuple, the check will be done against every entry in *cls*. " "The result will be ``1`` when at least one of the checks returns ``1``, " "otherwise it will be ``0``." msgstr "" -#: c-api/object.rst:256 +#: c-api/object.rst:371 msgid "" -"If *cls* has a :meth:`~class.__subclasscheck__` method, it will be called to " +"If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." -"e. contained in ``cls.__mro__``." +"e. contained in :attr:`cls.__mro__ `." msgstr "" -#: c-api/object.rst:261 +#: c-api/object.rst:376 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " -"a :attr:`~class.__bases__` attribute (which must be a tuple of base classes)." +"a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." msgstr "" -#: c-api/object.rst:268 +#: c-api/object.rst:383 msgid "" "Return ``1`` if *inst* is an instance of the class *cls* or a subclass of " "*cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." msgstr "" -#: c-api/object.rst:275 +#: c-api/object.rst:390 msgid "" -"If *cls* has a :meth:`~class.__instancecheck__` method, it will be called to " +"If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" -#: c-api/object.rst:279 +#: c-api/object.rst:394 msgid "" "An instance *inst* can override what is considered its class by having a :" -"attr:`~instance.__class__` attribute." +"attr:`~object.__class__` attribute." msgstr "" -#: c-api/object.rst:282 +#: c-api/object.rst:397 msgid "" "An object *cls* can override if it is considered a class, and what its base " -"classes are, by having a :attr:`~class.__bases__` attribute (which must be a " +"classes are, by having a :attr:`~type.__bases__` attribute (which must be a " "tuple of base classes)." msgstr "" -#: c-api/object.rst:291 +#: c-api/object.rst:406 msgid "" "Compute and return the hash value of an object *o*. On failure, return " "``-1``. This is the equivalent of the Python expression ``hash(o)``." msgstr "" -#: c-api/object.rst:294 +#: c-api/object.rst:409 msgid "" "The return type is now Py_hash_t. This is a signed integer the same size " "as :c:type:`Py_ssize_t`." msgstr "" -#: c-api/object.rst:301 +#: c-api/object.rst:416 msgid "" "Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` " "and return ``-1``. This function receives special treatment when stored in a " @@ -342,21 +536,21 @@ msgid "" "that it is not hashable." msgstr "" -#: c-api/object.rst:309 +#: c-api/object.rst:424 msgid "" "Returns ``1`` if the object *o* is considered to be true, and ``0`` " "otherwise. This is equivalent to the Python expression ``not not o``. On " "failure, return ``-1``." msgstr "" -#: c-api/object.rst:316 +#: c-api/object.rst:431 msgid "" "Returns ``0`` if the object *o* is considered to be true, and ``1`` " "otherwise. This is equivalent to the Python expression ``not o``. On " "failure, return ``-1``." msgstr "" -#: c-api/object.rst:325 +#: c-api/object.rst:440 msgid "" "When *o* is non-``NULL``, returns a type object corresponding to the object " "type of object *o*. On failure, raises :exc:`SystemError` and returns " @@ -367,13 +561,13 @@ msgid "" "when a new :term:`strong reference` is needed." msgstr "" -#: c-api/object.rst:337 +#: c-api/object.rst:452 msgid "" "Return non-zero if the object *o* is of type *type* or a subtype of *type*, " "and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" -#: c-api/object.rst:346 +#: c-api/object.rst:461 msgid "" "Return the length of object *o*. If the object *o* provides either the " "sequence and mapping protocols, the sequence length is returned. On error, " @@ -381,7 +575,7 @@ msgid "" "``len(o)``." msgstr "" -#: c-api/object.rst:353 +#: c-api/object.rst:468 msgid "" "Return an estimated length for the object *o*. First try to return its " "actual length, then an estimate using :meth:`~object.__length_hint__`, and " @@ -390,26 +584,33 @@ msgid "" "defaultvalue)``." msgstr "" -#: c-api/object.rst:363 +#: c-api/object.rst:478 msgid "" "Return element of *o* corresponding to the object *key* or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o[key]``." msgstr "" -#: c-api/object.rst:369 +#: c-api/object.rst:484 msgid "" "Map the object *key* to the value *v*. Raise an exception and return ``-1`` " "on failure; return ``0`` on success. This is the equivalent of the Python " "statement ``o[key] = v``. This function *does not* steal a reference to *v*." msgstr "" -#: c-api/object.rst:377 +#: c-api/object.rst:492 msgid "" "Remove the mapping for the object *key* from the object *o*. Return ``-1`` " "on failure. This is equivalent to the Python statement ``del o[key]``." msgstr "" -#: c-api/object.rst:383 +#: c-api/object.rst:498 +msgid "" +"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" +"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." +msgstr "" + +#: c-api/object.rst:505 msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " @@ -419,7 +620,7 @@ msgid "" "`PyErr_Occurred` will return false." msgstr "" -#: c-api/object.rst:392 +#: c-api/object.rst:514 msgid "" "This is equivalent to the Python expression ``iter(o)``. It returns a new " "iterator for the object argument, or the object itself if the object is " @@ -427,7 +628,14 @@ msgid "" "object cannot be iterated." msgstr "" -#: c-api/object.rst:400 +#: c-api/object.rst:522 +msgid "" +"This is equivalent to the Python ``__iter__(self): return self`` method. It " +"is intended for :term:`iterator` types, to be used in the :c:member:" +"`PyTypeObject.tp_iter` slot." +msgstr "" + +#: c-api/object.rst:528 msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " @@ -436,88 +644,320 @@ msgid "" "``NULL`` if the object cannot be iterated." msgstr "" -#: c-api/object.rst:410 +#: c-api/object.rst:538 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -#: c-api/object.rst:412 +#: c-api/object.rst:540 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" -#: c-api/object.rst:416 +#: c-api/object.rst:544 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: c-api/object.rst:422 +#: c-api/object.rst:550 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -#: c-api/object.rst:425 +#: c-api/object.rst:553 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " "`; it is safe to use this larger size (e.g. with :c:" "func:`!memset`)." msgstr "" -#: c-api/object.rst:428 +#: c-api/object.rst:556 msgid "" "The type *cls* **must** have been created using negative :c:member:" "`PyType_Spec.basicsize`. Python does not check this." msgstr "" -#: c-api/object.rst:432 +#: c-api/object.rst:560 msgid "On error, set an exception and return a negative value." msgstr "" -#: c-api/object.rst:438 +#: c-api/object.rst:566 msgid "" "Get a pointer to per-item data for a class with :c:macro:" "`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -#: c-api/object.rst:441 +#: c-api/object.rst:569 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" -#: c-api/object.rst:213 c-api/object.rst:289 c-api/object.rst:344 +#: c-api/object.rst:577 +msgid "Visit the managed dictionary of *obj*." +msgstr "" + +#: c-api/object.rst:579 +msgid "" +"This function must only be called in a traverse function of the type which " +"has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." +msgstr "" + +#: c-api/object.rst:586 +msgid "Clear the managed dictionary of *obj*." +msgstr "" + +#: c-api/object.rst:588 +msgid "" +"This function must only be called in a clear function of the type which has " +"the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." +msgstr "" + +#: c-api/object.rst:595 +msgid "" +"Enable `deferred reference counting `_ on *obj*, if supported by the runtime. In " +"the :term:`free-threaded ` build, this allows the " +"interpreter to avoid reference count adjustments to *obj*, which may improve " +"multi-threaded performance. The tradeoff is that *obj* will only be " +"deallocated by the tracing garbage collector, and not when the interpreter " +"no longer has any references to it." +msgstr "" + +#: c-api/object.rst:602 +msgid "" +"This function returns ``1`` if deferred reference counting is enabled on " +"*obj*, and ``0`` if deferred reference counting is not supported or if the " +"hint was ignored by the interpreter, such as when deferred reference " +"counting is already enabled on *obj*. This function is thread-safe, and " +"cannot fail." +msgstr "" + +#: c-api/object.rst:607 +msgid "" +"This function does nothing on builds with the :term:`GIL` enabled, which do " +"not support deferred reference counting. This also does nothing if *obj* is " +"not an object tracked by the garbage collector (see :func:`gc.is_tracked` " +"and :c:func:`PyObject_GC_IsTracked`)." +msgstr "" + +#: c-api/object.rst:612 +msgid "" +"This function is intended to be used soon after *obj* is created, by the " +"code that creates it, such as in the object's :c:member:`~PyTypeObject." +"tp_new` slot." +msgstr "" + +#: c-api/object.rst:620 +msgid "" +"Check if *obj* is a unique temporary object. Returns ``1`` if *obj* is known " +"to be a unique temporary object, and ``0`` otherwise. This function cannot " +"fail, but the check is conservative, and may return ``0`` in some cases even " +"if *obj* is a unique temporary object." +msgstr "" + +#: c-api/object.rst:626 +msgid "" +"If an object is a unique temporary, it is guaranteed that the current code " +"has the only reference to the object. For arguments to C functions, this " +"should be used instead of checking if the reference count is ``1``. Starting " +"with Python 3.14, the interpreter internally avoids some reference count " +"modifications when loading objects onto the operands stack by :term:" +"`borrowing ` references when possible, which means that " +"a reference count of ``1`` by itself does not guarantee that a function " +"argument uniquely referenced." +msgstr "" + +#: c-api/object.rst:635 +msgid "" +"In the example below, ``my_func`` is called with a unique temporary object " +"as its argument::" +msgstr "" + +#: c-api/object.rst:638 +msgid "my_func([1, 2, 3])" +msgstr "" + +#: c-api/object.rst:640 +msgid "" +"In the example below, ``my_func`` is **not** called with a unique temporary " +"object as its argument, even if its refcount is ``1``::" +msgstr "" + +#: c-api/object.rst:643 +msgid "" +"my_list = [1, 2, 3]\n" +"my_func(my_list)" +msgstr "" + +#: c-api/object.rst:646 +msgid "See also the function :c:func:`Py_REFCNT`." +msgstr "" + +#: c-api/object.rst:652 +msgid "" +"This function returns non-zero if *obj* is :term:`immortal`, and zero " +"otherwise. This function cannot fail." +msgstr "" + +#: c-api/object.rst:657 +msgid "" +"Objects that are immortal in one CPython version are not guaranteed to be " +"immortal in another." +msgstr "" + +#: c-api/object.rst:664 +msgid "" +"Increments the reference count of *obj* if it is not zero. Returns ``1`` if " +"the object's reference count was successfully incremented. Otherwise, this " +"function returns ``0``." +msgstr "" + +#: c-api/object.rst:668 +msgid "" +":c:func:`PyUnstable_EnableTryIncRef` must have been called earlier on *obj* " +"or this function may spuriously return ``0`` in the :term:`free threading` " +"build." +msgstr "" + +#: c-api/object.rst:672 +msgid "" +"This function is logically equivalent to the following C code, except that " +"it behaves atomically in the :term:`free threading` build::" +msgstr "" + +#: c-api/object.rst:675 +msgid "" +"if (Py_REFCNT(op) > 0) {\n" +" Py_INCREF(op);\n" +" return 1;\n" +"}\n" +"return 0;" +msgstr "" + +#: c-api/object.rst:681 +msgid "" +"This is intended as a building block for managing weak references without " +"the overhead of a Python :ref:`weak reference object `." +msgstr "" + +#: c-api/object.rst:684 +msgid "" +"Typically, correct use of this function requires support from *obj*'s " +"deallocator (:c:member:`~PyTypeObject.tp_dealloc`). For example, the " +"following sketch could be adapted to implement a \"weakmap\" that works like " +"a :py:class:`~weakref.WeakValueDictionary` for a specific type:" +msgstr "" + +#: c-api/object.rst:690 +msgid "" +"PyMutex mutex;\n" +"\n" +"PyObject *\n" +"add_entry(weakmap_key_type *key, PyObject *value)\n" +"{\n" +" PyUnstable_EnableTryIncRef(value);\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" weakmap_add_entry(weakmap, key, value);\n" +" PyMutex_Unlock(&mutex);\n" +" Py_RETURN_NONE;\n" +"}\n" +"\n" +"PyObject *\n" +"get_value(weakmap_key_type *key)\n" +"{\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" PyObject *result = weakmap_find(weakmap, key);\n" +" if (PyUnstable_TryIncRef(result)) {\n" +" // `result` is safe to use\n" +" PyMutex_Unlock(&mutex);\n" +" return result;\n" +" }\n" +" // if we get here, `result` is starting to be garbage-collected,\n" +" // but has not been removed from the weakmap yet\n" +" PyMutex_Unlock(&mutex);\n" +" return NULL;\n" +"}\n" +"\n" +"// tp_dealloc function for weakmap values\n" +"void\n" +"value_dealloc(PyObject *value)\n" +"{\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" weakmap_remove_value(weakmap, value);\n" +"\n" +" ...\n" +" PyMutex_Unlock(&mutex);\n" +"}" +msgstr "" + +#: c-api/object.rst:738 +msgid "" +"Enables subsequent uses of :c:func:`PyUnstable_TryIncRef` on *obj*. The " +"caller must hold a :term:`strong reference` to *obj* when calling this." +msgstr "" + +#: c-api/object.rst:745 +msgid "Determine if *op* only has one reference." +msgstr "" + +#: c-api/object.rst:747 +msgid "" +"On GIL-enabled builds, this function is equivalent to :c:expr:`Py_REFCNT(op) " +"== 1`." +msgstr "" + +#: c-api/object.rst:750 +msgid "" +"On a :term:`free threaded ` build, this checks if *op*'s :" +"term:`reference count` is equal to one and additionally checks if *op* is " +"only used by this thread. :c:expr:`Py_REFCNT(op) == 1` is **not** thread-" +"safe on free threaded builds; prefer this function." +msgstr "" + +#: c-api/object.rst:755 +msgid "" +"The caller must hold an :term:`attached thread state`, despite the fact that " +"this function doesn't call into the Python interpreter. This function cannot " +"fail." +msgstr "" + +#: c-api/object.rst:328 c-api/object.rst:404 c-api/object.rst:459 msgid "built-in function" msgstr "" -#: c-api/object.rst:201 +#: c-api/object.rst:316 msgid "repr" msgstr "" -#: c-api/object.rst:213 +#: c-api/object.rst:328 msgid "ascii" msgstr "" -#: c-api/object.rst:221 +#: c-api/object.rst:336 msgid "string" msgstr "" -#: c-api/object.rst:221 +#: c-api/object.rst:336 msgid "PyObject_Str (C function)" msgstr "" -#: c-api/object.rst:238 +#: c-api/object.rst:353 msgid "bytes" msgstr "" -#: c-api/object.rst:289 +#: c-api/object.rst:404 msgid "hash" msgstr "" -#: c-api/object.rst:323 +#: c-api/object.rst:438 msgid "type" msgstr "" -#: c-api/object.rst:344 +#: c-api/object.rst:459 msgid "len" msgstr "" diff --git a/c-api/objimpl.po b/c-api/objimpl.po index fa8027a0..a768ba7d 100644 --- a/c-api/objimpl.po +++ b/c-api/objimpl.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index 3df71920..14848de8 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -40,8 +41,8 @@ msgstr "" #: c-api/perfmaps.rst:19 msgid "" -"Note that holding the Global Interpreter Lock (GIL) is not required for " -"these APIs." +"Note that holding an :term:`attached thread state` is not required for these " +"APIs." msgstr "" #: c-api/perfmaps.rst:23 @@ -67,6 +68,12 @@ msgid "" "thread safe. Here is what an example entry looks like::" msgstr "" +#: c-api/perfmaps.rst:38 +msgid "" +"# address size name\n" +"7f3529fcf759 b py::bar:/run/t.py" +msgstr "" + #: c-api/perfmaps.rst:41 msgid "" "Will call :c:func:`PyUnstable_PerfMapState_Init` before writing the entry, " diff --git a/c-api/picklebuffer.po b/c-api/picklebuffer.po new file mode 100644 index 00000000..8a332b54 --- /dev/null +++ b/c-api/picklebuffer.po @@ -0,0 +1,101 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: c-api/picklebuffer.rst:9 +msgid "Pickle buffer objects" +msgstr "" + +#: c-api/picklebuffer.rst:13 +msgid "" +"A :class:`pickle.PickleBuffer` object wraps a :ref:`buffer-providing object " +"` for out-of-band data transfer with the :mod:`pickle` module." +msgstr "" + +#: c-api/picklebuffer.rst:19 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python pickle buffer " +"type. This is the same object as :class:`pickle.PickleBuffer` in the Python " +"layer." +msgstr "" + +#: c-api/picklebuffer.rst:25 +msgid "" +"Return true if *op* is a pickle buffer instance. This function always " +"succeeds." +msgstr "" + +#: c-api/picklebuffer.rst:31 +msgid "Create a pickle buffer from the object *obj*." +msgstr "" + +#: c-api/picklebuffer.rst:33 +msgid "" +"This function will fail if *obj* doesn't support the :ref:`buffer protocol " +"`." +msgstr "" + +#: c-api/picklebuffer.rst:35 +msgid "" +"On success, return a new pickle buffer instance. On failure, set an " +"exception and return ``NULL``." +msgstr "" + +#: c-api/picklebuffer.rst:38 +msgid "Analogous to calling :class:`pickle.PickleBuffer` with *obj* in Python." +msgstr "" + +#: c-api/picklebuffer.rst:43 +msgid "" +"Get a pointer to the underlying :c:type:`Py_buffer` that the pickle buffer " +"wraps." +msgstr "" + +#: c-api/picklebuffer.rst:45 +msgid "" +"The returned pointer is valid as long as *picklebuf* is alive and has not " +"been released. The caller must not modify or free the returned :c:type:" +"`Py_buffer`. If the pickle buffer has been released, raise :exc:`ValueError`." +msgstr "" + +#: c-api/picklebuffer.rst:49 +msgid "" +"On success, return a pointer to the buffer view. On failure, set an " +"exception and return ``NULL``." +msgstr "" + +#: c-api/picklebuffer.rst:55 +msgid "Release the underlying buffer held by the pickle buffer." +msgstr "" + +#: c-api/picklebuffer.rst:57 +msgid "" +"Return ``0`` on success. On failure, set an exception and return ``-1``." +msgstr "" + +#: c-api/picklebuffer.rst:59 +msgid "Analogous to calling :meth:`pickle.PickleBuffer.release` in Python." +msgstr "" + +#: c-api/picklebuffer.rst:5 +msgid "object" +msgstr "" + +#: c-api/picklebuffer.rst:5 +msgid "PickleBuffer" +msgstr "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index eca8df93..dfecb1d5 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -33,10 +34,10 @@ msgstr "" #: c-api/refcounting.rst:18 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are \"immortal\" " -"and have a very high refcount that does not reflect the actual number of " -"references. Consequently, do not rely on the returned value to be accurate, " -"other than a value of 0 or 1." +"the object are actually held. For example, some objects are :term:" +"`immortal` and have a very high refcount that does not reflect the actual " +"number of references. Consequently, do not rely on the returned value to be " +"accurate, other than a value of 0 or 1." msgstr "" #: c-api/refcounting.rst:24 @@ -44,132 +45,165 @@ msgid "" "Use the :c:func:`Py_SET_REFCNT()` function to set an object reference count." msgstr "" -#: c-api/refcounting.rst:26 +#: c-api/refcounting.rst:28 +msgid "" +"On :term:`free threaded ` builds of Python, returning 1 " +"isn't sufficient to determine if it's safe to treat *o* as having no access " +"by other threads. Use :c:func:`PyUnstable_Object_IsUniquelyReferenced` for " +"that instead." +msgstr "" + +#: c-api/refcounting.rst:33 +msgid "" +"See also the function :c:func:" +"`PyUnstable_Object_IsUniqueReferencedTemporary()`." +msgstr "" + +#: c-api/refcounting.rst:35 msgid ":c:func:`Py_REFCNT()` is changed to the inline static function." msgstr "" -#: c-api/refcounting.rst:29 +#: c-api/refcounting.rst:38 msgid "The parameter type is no longer :c:expr:`const PyObject*`." msgstr "" -#: c-api/refcounting.rst:35 +#: c-api/refcounting.rst:44 msgid "Set the object *o* reference counter to *refcnt*." msgstr "" -#: c-api/refcounting.rst:37 +#: c-api/refcounting.rst:46 msgid "" -"Note that this function has no effect on `immortal `_ objects." +"On :ref:`Python build with Free Threading `, if " +"*refcnt* is larger than ``UINT32_MAX``, the object is made :term:`immortal`." msgstr "" -#: c-api/refcounting.rst:65 c-api/refcounting.rst:142 +#: c-api/refcounting.rst:62 c-api/refcounting.rst:128 +msgid "This function has no effect on :term:`immortal` objects." +msgstr "" + +#: c-api/refcounting.rst:77 c-api/refcounting.rst:156 msgid "Immortal objects are not modified." msgstr "" -#: c-api/refcounting.rst:49 +#: c-api/refcounting.rst:59 msgid "" "Indicate taking a new :term:`strong reference` to object *o*, indicating it " "is in use and should not be destroyed." msgstr "" -#: c-api/refcounting.rst:52 +#: c-api/refcounting.rst:64 msgid "" "This function is usually used to convert a :term:`borrowed reference` to a :" "term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " "used to create a new :term:`strong reference`." msgstr "" -#: c-api/refcounting.rst:56 -msgid "When done using the object, release it by calling :c:func:`Py_DECREF`." +#: c-api/refcounting.rst:68 +msgid "When done using the object, release is by calling :c:func:`Py_DECREF`." msgstr "" -#: c-api/refcounting.rst:58 +#: c-api/refcounting.rst:70 msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XINCREF`." msgstr "" -#: c-api/refcounting.rst:127 +#: c-api/refcounting.rst:73 msgid "" -"Do not expect this function to actually modify *o* in any way. For at least " -"`some objects `_, this function has no " -"effect." +"Do not expect this function to actually modify *o* in any way. For at least :" +"pep:`some objects <0683>`, this function has no effect." msgstr "" -#: c-api/refcounting.rst:71 +#: c-api/refcounting.rst:83 msgid "" "Similar to :c:func:`Py_INCREF`, but the object *o* can be ``NULL``, in which " "case this has no effect." msgstr "" -#: c-api/refcounting.rst:74 +#: c-api/refcounting.rst:86 msgid "See also :c:func:`Py_XNewRef`." msgstr "" -#: c-api/refcounting.rst:79 +#: c-api/refcounting.rst:91 msgid "" "Create a new :term:`strong reference` to an object: call :c:func:`Py_INCREF` " "on *o* and return the object *o*." msgstr "" -#: c-api/refcounting.rst:82 +#: c-api/refcounting.rst:94 msgid "" "When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` " "should be called on it to release the reference." msgstr "" -#: c-api/refcounting.rst:85 +#: c-api/refcounting.rst:97 msgid "" "The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be " "``NULL``." msgstr "" -#: c-api/refcounting.rst:88 +#: c-api/refcounting.rst:100 msgid "For example::" msgstr "" -#: c-api/refcounting.rst:93 +#: c-api/refcounting.rst:102 +msgid "" +"Py_INCREF(obj);\n" +"self->attr = obj;" +msgstr "" + +#: c-api/refcounting.rst:105 msgid "can be written as::" msgstr "" -#: c-api/refcounting.rst:97 +#: c-api/refcounting.rst:107 +msgid "self->attr = Py_NewRef(obj);" +msgstr "" + +#: c-api/refcounting.rst:109 msgid "See also :c:func:`Py_INCREF`." msgstr "" -#: c-api/refcounting.rst:104 +#: c-api/refcounting.rst:116 msgid "Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL." msgstr "" -#: c-api/refcounting.rst:106 +#: c-api/refcounting.rst:118 msgid "If the object *o* is ``NULL``, the function just returns ``NULL``." msgstr "" -#: c-api/refcounting.rst:113 +#: c-api/refcounting.rst:125 msgid "" "Release a :term:`strong reference` to object *o*, indicating the reference " "is no longer used." msgstr "" -#: c-api/refcounting.rst:116 +#: c-api/refcounting.rst:130 msgid "" "Once the last :term:`strong reference` is released (i.e. the object's " "reference count reaches 0), the object's type's deallocation function (which " "must not be ``NULL``) is invoked." msgstr "" -#: c-api/refcounting.rst:121 +#: c-api/refcounting.rst:135 msgid "" "This function is usually used to delete a :term:`strong reference` before " "exiting its scope." msgstr "" -#: c-api/refcounting.rst:124 +#: c-api/refcounting.rst:138 msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XDECREF`." msgstr "" -#: c-api/refcounting.rst:133 +#: c-api/refcounting.rst:141 +msgid "" +"Do not expect this function to actually modify *o* in any way. For at least :" +"pep:`some objects <683>`, this function has no effect." +msgstr "" + +#: c-api/refcounting.rst:147 msgid "" "The deallocation function can cause arbitrary Python code to be invoked (e." "g. when a class instance with a :meth:`~object.__del__` method is " @@ -182,14 +216,14 @@ msgid "" "call :c:func:`Py_DECREF` for the temporary variable." msgstr "" -#: c-api/refcounting.rst:148 +#: c-api/refcounting.rst:162 msgid "" "Similar to :c:func:`Py_DECREF`, but the object *o* can be ``NULL``, in which " "case this has no effect. The same warning from :c:func:`Py_DECREF` applies " "here as well." msgstr "" -#: c-api/refcounting.rst:155 +#: c-api/refcounting.rst:169 msgid "" "Release a :term:`strong reference` for object *o*. The object may be " "``NULL``, in which case the macro has no effect; otherwise the effect is the " @@ -199,59 +233,69 @@ msgid "" "and sets the argument to ``NULL`` before releasing the reference." msgstr "" -#: c-api/refcounting.rst:163 +#: c-api/refcounting.rst:177 msgid "" "It is a good idea to use this macro whenever releasing a reference to an " "object that might be traversed during garbage collection." msgstr "" -#: c-api/refcounting.rst:166 +#: c-api/refcounting.rst:180 msgid "" "The macro argument is now only evaluated once. If the argument has side " "effects, these are no longer duplicated." msgstr "" -#: c-api/refcounting.rst:173 +#: c-api/refcounting.rst:187 msgid "" "Indicate taking a new :term:`strong reference` to object *o*. A function " "version of :c:func:`Py_XINCREF`. It can be used for runtime dynamic " "embedding of Python." msgstr "" -#: c-api/refcounting.rst:180 +#: c-api/refcounting.rst:194 msgid "" "Release a :term:`strong reference` to object *o*. A function version of :c:" "func:`Py_XDECREF`. It can be used for runtime dynamic embedding of Python." msgstr "" -#: c-api/refcounting.rst:187 +#: c-api/refcounting.rst:201 msgid "" "Macro safely releasing a :term:`strong reference` to object *dst* and " "setting *dst* to *src*." msgstr "" -#: c-api/refcounting.rst:190 +#: c-api/refcounting.rst:204 msgid "As in case of :c:func:`Py_CLEAR`, \"the obvious\" code can be deadly::" msgstr "" -#: c-api/refcounting.rst:195 +#: c-api/refcounting.rst:206 +msgid "" +"Py_DECREF(dst);\n" +"dst = src;" +msgstr "" + +#: c-api/refcounting.rst:209 msgid "The safe way is::" msgstr "" -#: c-api/refcounting.rst:199 +#: c-api/refcounting.rst:211 +msgid "Py_SETREF(dst, src);" +msgstr "" + +#: c-api/refcounting.rst:213 msgid "" -"That arranges to set *dst* to *src* _before_ releasing the reference to the " +"That arranges to set *dst* to *src* *before* releasing the reference to the " "old value of *dst*, so that any code triggered as a side-effect of *dst* " "getting torn down no longer believes *dst* points to a valid object." msgstr "" -#: c-api/refcounting.rst:218 +#: c-api/refcounting.rst:232 msgid "" "The macro arguments are now only evaluated once. If an argument has side " "effects, these are no longer duplicated." msgstr "" -#: c-api/refcounting.rst:213 +#: c-api/refcounting.rst:227 msgid "" "Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead " "of :c:func:`Py_DECREF`." diff --git a/c-api/reflection.po b/c-api/reflection.po index 74b5de9f..0679000f 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -20,41 +21,103 @@ msgstr "" msgid "Reflection" msgstr "" -#: c-api/reflection.rst:10 +#: c-api/reflection.rst:12 +msgid "Use :c:func:`PyEval_GetFrameBuiltins` instead." +msgstr "" + +#: c-api/reflection.rst:66 msgid "" "Return a dictionary of the builtins in the current execution frame, or the " "interpreter of the thread state if no frame is currently executing." msgstr "" -#: c-api/reflection.rst:16 +#: c-api/reflection.rst:22 msgid "" -"Return a dictionary of the local variables in the current execution frame, " -"or ``NULL`` if no frame is currently executing." +"Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as " +"calling :func:`locals` in Python code, or else call :c:func:" +"`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame` to access " +"the :attr:`~frame.f_locals` attribute of the currently executing frame." msgstr "" -#: c-api/reflection.rst:22 +#: c-api/reflection.rst:27 +msgid "" +"Return a mapping providing access to the local variables in the current " +"execution frame, or ``NULL`` if no frame is currently executing." +msgstr "" + +#: c-api/reflection.rst:30 +msgid "" +"Refer to :func:`locals` for details of the mapping returned at different " +"scopes." +msgstr "" + +#: c-api/reflection.rst:32 +msgid "" +"As this function returns a :term:`borrowed reference`, the dictionary " +"returned for :term:`optimized scopes ` is cached on the " +"frame object and will remain alive as long as the frame object does. Unlike :" +"c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls to this " +"function in the same frame will update the contents of the cached dictionary " +"to reflect changes in the state of the local variables rather than returning " +"a new snapshot." +msgstr "" + +#: c-api/reflection.rst:39 +msgid "" +"As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and :" +"attr:`FrameType.f_locals ` no longer make use of the shared " +"cache dictionary. Refer to the :ref:`What's New entry ` for additional details." +msgstr "" + +#: c-api/reflection.rst:50 +msgid "Use :c:func:`PyEval_GetFrameGlobals` instead." +msgstr "" + +#: c-api/reflection.rst:52 msgid "" "Return a dictionary of the global variables in the current execution frame, " "or ``NULL`` if no frame is currently executing." msgstr "" -#: c-api/reflection.rst:28 +#: c-api/reflection.rst:58 msgid "" -"Return the current thread state's frame, which is ``NULL`` if no frame is " -"currently executing." +"Return the :term:`attached thread state`'s frame, which is ``NULL`` if no " +"frame is currently executing." msgstr "" -#: c-api/reflection.rst:31 +#: c-api/reflection.rst:61 msgid "See also :c:func:`PyThreadState_GetFrame`." msgstr "" -#: c-api/reflection.rst:36 +#: c-api/reflection.rst:74 +msgid "" +"Return a dictionary of the local variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" +"`locals` in Python code." +msgstr "" + +#: c-api/reflection.rst:78 +msgid "" +"To access :attr:`~frame.f_locals` on the current frame without making an " +"independent snapshot in :term:`optimized scopes `, call :c:" +"func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame`." +msgstr "" + +#: c-api/reflection.rst:87 +msgid "" +"Return a dictionary of the global variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" +"`globals` in Python code." +msgstr "" + +#: c-api/reflection.rst:96 msgid "" "Return the name of *func* if it is a function, class or instance object, " "else the name of *func*\\s type." msgstr "" -#: c-api/reflection.rst:42 +#: c-api/reflection.rst:102 msgid "" "Return a description string, depending on the type of *func*. Return values " "include \"()\" for functions and methods, \" constructor\", \" instance\", " diff --git a/c-api/sequence.po b/c-api/sequence.po index 4edd2214..0e52782e 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -121,19 +122,29 @@ msgid "" msgstr "" #: c-api/sequence.rst:110 +msgid "Alias for :c:func:`PySequence_Contains`." +msgstr "" + +#: c-api/sequence.rst:112 +msgid "" +"The function is :term:`soft deprecated` and should no longer be used to " +"write new code." +msgstr "" + +#: c-api/sequence.rst:119 msgid "" "Return the first index *i* for which ``o[i] == value``. On error, return " "``-1``. This is equivalent to the Python expression ``o.index(value)``." msgstr "" -#: c-api/sequence.rst:116 +#: c-api/sequence.rst:125 msgid "" "Return a list object with the same contents as the sequence or iterable *o*, " "or ``NULL`` on failure. The returned list is guaranteed to be new. This is " "equivalent to the Python expression ``list(o)``." msgstr "" -#: c-api/sequence.rst:125 +#: c-api/sequence.rst:134 msgid "" "Return a tuple object with the same contents as the sequence or iterable " "*o*, or ``NULL`` on failure. If *o* is a tuple, a new reference will be " @@ -141,7 +152,7 @@ msgid "" "contents. This is equivalent to the Python expression ``tuple(o)``." msgstr "" -#: c-api/sequence.rst:133 +#: c-api/sequence.rst:142 msgid "" "Return the sequence or iterable *o* as an object usable by the other " "``PySequence_Fast*`` family of functions. If the object is not a sequence or " @@ -149,20 +160,20 @@ msgid "" "``NULL`` on failure." msgstr "" -#: c-api/sequence.rst:138 +#: c-api/sequence.rst:147 msgid "" "The ``PySequence_Fast*`` functions are thus named because they assume *o* is " "a :c:type:`PyTupleObject` or a :c:type:`PyListObject` and access the data " "fields of *o* directly." msgstr "" -#: c-api/sequence.rst:142 +#: c-api/sequence.rst:151 msgid "" "As a CPython implementation detail, if *o* is already a sequence or list, it " "will be returned." msgstr "" -#: c-api/sequence.rst:148 +#: c-api/sequence.rst:157 msgid "" "Returns the length of *o*, assuming that *o* was returned by :c:func:" "`PySequence_Fast` and that *o* is not ``NULL``. The size can also be " @@ -171,26 +182,26 @@ msgid "" "tuple." msgstr "" -#: c-api/sequence.rst:157 +#: c-api/sequence.rst:166 msgid "" "Return the *i*\\ th element of *o*, assuming that *o* was returned by :c:" "func:`PySequence_Fast`, *o* is not ``NULL``, and that *i* is within bounds." msgstr "" -#: c-api/sequence.rst:163 +#: c-api/sequence.rst:172 msgid "" "Return the underlying array of PyObject pointers. Assumes that *o* was " "returned by :c:func:`PySequence_Fast` and *o* is not ``NULL``." msgstr "" -#: c-api/sequence.rst:166 +#: c-api/sequence.rst:175 msgid "" "Note, if a list gets resized, the reallocation may relocate the items array. " "So, only use the underlying array pointer in contexts where the sequence " "cannot change." msgstr "" -#: c-api/sequence.rst:173 +#: c-api/sequence.rst:182 msgid "" "Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form of :c:" "func:`PySequence_GetItem` but without checking that :c:func:" @@ -198,7 +209,7 @@ msgid "" "indices." msgstr "" -#: c-api/sequence.rst:123 +#: c-api/sequence.rst:132 msgid "built-in function" msgstr "" @@ -206,6 +217,6 @@ msgstr "" msgid "len" msgstr "" -#: c-api/sequence.rst:123 +#: c-api/sequence.rst:132 msgid "tuple" msgstr "" diff --git a/c-api/set.po b/c-api/set.po index 6cecb74c..f385d83c 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/c-api/slice.po b/c-api/slice.po index 5f2374f9..42cb7ba6 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -37,34 +38,39 @@ msgid "" "Return a new slice object with the given values. The *start*, *stop*, and " "*step* parameters are used as the values of the slice object attributes of " "the same names. Any of the values may be ``NULL``, in which case the " -"``None`` will be used for the corresponding attribute. Return ``NULL`` if " -"the new object could not be allocated." +"``None`` will be used for the corresponding attribute." msgstr "" -#: c-api/slice.rst:32 +#: c-api/slice.rst:28 +msgid "" +"Return ``NULL`` with an exception set if the new object could not be " +"allocated." +msgstr "" + +#: c-api/slice.rst:34 msgid "" "Retrieve the start, stop and step indices from the slice object *slice*, " "assuming a sequence of length *length*. Treats indices greater than *length* " "as errors." msgstr "" -#: c-api/slice.rst:36 +#: c-api/slice.rst:38 msgid "" "Returns ``0`` on success and ``-1`` on error with no exception set (unless " "one of the indices was not ``None`` and failed to be converted to an " "integer, in which case ``-1`` is returned with an exception set)." msgstr "" -#: c-api/slice.rst:40 +#: c-api/slice.rst:42 msgid "You probably do not want to use this function." msgstr "" -#: c-api/slice.rst:73 +#: c-api/slice.rst:75 msgid "" "The parameter type for the *slice* parameter was ``PySliceObject*`` before." msgstr "" -#: c-api/slice.rst:49 +#: c-api/slice.rst:51 msgid "" "Usable replacement for :c:func:`PySlice_GetIndices`. Retrieve the start, " "stop, and step indices from the slice object *slice* assuming a sequence of " @@ -73,22 +79,38 @@ msgid "" "normal slices." msgstr "" -#: c-api/slice.rst:55 -msgid "Returns ``0`` on success and ``-1`` on error with exception set." +#: c-api/slice.rst:57 +msgid "Return ``0`` on success and ``-1`` on error with an exception set." msgstr "" -#: c-api/slice.rst:58 +#: c-api/slice.rst:60 msgid "" "This function is considered not safe for resizable sequences. Its invocation " "should be replaced by a combination of :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` where ::" msgstr "" -#: c-api/slice.rst:66 +#: c-api/slice.rst:64 +msgid "" +"if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) " +"< 0) {\n" +" // return error\n" +"}" +msgstr "" + +#: c-api/slice.rst:68 msgid "is replaced by ::" msgstr "" -#: c-api/slice.rst:77 +#: c-api/slice.rst:70 +msgid "" +"if (PySlice_Unpack(slice, &start, &stop, &step) < 0) {\n" +" // return error\n" +"}\n" +"slicelength = PySlice_AdjustIndices(length, &start, &stop, step);" +msgstr "" + +#: c-api/slice.rst:79 msgid "" "If ``Py_LIMITED_API`` is not set or set to the value between ``0x03050400`` " "and ``0x03060000`` (not including) or ``0x03060100`` or higher :c:func:`!" @@ -97,14 +119,14 @@ msgid "" "*stop* and *step* are evaluated more than once." msgstr "" -#: c-api/slice.rst:84 +#: c-api/slice.rst:86 msgid "" "If ``Py_LIMITED_API`` is set to the value less than ``0x03050400`` or " "between ``0x03060000`` and ``0x03060100`` (not including) :c:func:`!" "PySlice_GetIndicesEx` is a deprecated function." msgstr "" -#: c-api/slice.rst:92 +#: c-api/slice.rst:94 msgid "" "Extract the start, stop and step data members from a slice object as C " "integers. Silently reduce values larger than ``PY_SSIZE_T_MAX`` to " @@ -113,34 +135,39 @@ msgid "" "less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``." msgstr "" -#: c-api/slice.rst:98 -msgid "Return ``-1`` on error, ``0`` on success." +#: c-api/slice.rst:100 +msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: c-api/slice.rst:105 +#: c-api/slice.rst:107 msgid "" "Adjust start/end slice indices assuming a sequence of the specified length. " "Out of bounds indices are clipped in a manner consistent with the handling " "of normal slices." msgstr "" -#: c-api/slice.rst:109 +#: c-api/slice.rst:111 msgid "" "Return the length of the slice. Always successful. Doesn't call Python " "code." msgstr "" -#: c-api/slice.rst:116 +#: c-api/slice.rst:118 msgid "Ellipsis Object" msgstr "" -#: c-api/slice.rst:121 +#: c-api/slice.rst:123 +msgid "" +"The type of Python :const:`Ellipsis` object. Same as :class:`types." +"EllipsisType` in the Python layer." +msgstr "" + +#: c-api/slice.rst:129 msgid "" "The Python ``Ellipsis`` object. This object has no methods. Like :c:data:" -"`Py_None`, it is an `immortal `_. " -"singleton object." +"`Py_None`, it is an :term:`immortal` singleton object." msgstr "" -#: c-api/slice.rst:125 +#: c-api/slice.rst:132 msgid ":c:data:`Py_Ellipsis` is immortal." msgstr "" diff --git a/c-api/stable.po b/c-api/stable.po index 67c1af39..c0ffebfc 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -90,82 +91,90 @@ msgid "" "spend extra effort adjusting to changes." msgstr "" -#: c-api/stable.rst:56 +#: c-api/stable.rst:57 msgid "Stable Application Binary Interface" msgstr "" -#: c-api/stable.rst:58 +#: c-api/stable.rst:59 msgid "" "For simplicity, this document talks about *extensions*, but the Limited API " "and Stable ABI work the same way for all uses of the API – for example, " "embedding Python." msgstr "" -#: c-api/stable.rst:65 +#: c-api/stable.rst:66 msgid "Limited C API" msgstr "" -#: c-api/stable.rst:67 +#: c-api/stable.rst:68 msgid "" "Python 3.2 introduced the *Limited API*, a subset of Python's C API. " -"Extensions that only use the Limited API can be compiled once and work with " -"multiple versions of Python. Contents of the Limited API are :ref:`listed " +"Extensions that only use the Limited API can be compiled once and be loaded " +"on multiple versions of Python. Contents of the Limited API are :ref:`listed " "below `." msgstr "" -#: c-api/stable.rst:74 +#: c-api/stable.rst:75 msgid "" "Define this macro before including ``Python.h`` to opt in to only use the " "Limited API, and to select the Limited API version." msgstr "" -#: c-api/stable.rst:77 +#: c-api/stable.rst:78 msgid "" "Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` " "corresponding to the lowest Python version your extension supports. The " -"extension will work without recompilation with all Python 3 releases from " -"the specified one onward, and can use Limited API introduced up to that " -"version." +"extension will be ABI-compatible with all Python 3 releases from the " +"specified one onward, and can use Limited API introduced up to that version." msgstr "" -#: c-api/stable.rst:83 +#: c-api/stable.rst:84 msgid "" "Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum " "minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when " "compiling with future Python versions." msgstr "" -#: c-api/stable.rst:87 +#: c-api/stable.rst:88 msgid "" "You can also define ``Py_LIMITED_API`` to ``3``. This works the same as " "``0x03020000`` (Python 3.2, the version that introduced Limited API)." msgstr "" -#: c-api/stable.rst:94 +#: c-api/stable.rst:95 msgid "Stable ABI" msgstr "" -#: c-api/stable.rst:96 +#: c-api/stable.rst:97 msgid "" "To enable this, Python provides a *Stable ABI*: a set of symbols that will " -"remain compatible across Python 3.x versions." +"remain ABI-compatible across Python 3.x versions." msgstr "" -#: c-api/stable.rst:99 +#: c-api/stable.rst:102 +msgid "" +"The Stable ABI prevents ABI issues, like linker errors due to missing " +"symbols or data corruption due to changes in structure layouts or function " +"signatures. However, other changes in Python can change the *behavior* of " +"extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for " +"details." +msgstr "" + +#: c-api/stable.rst:108 msgid "" "The Stable ABI contains symbols exposed in the :ref:`Limited API `, but also other ones – for example, functions necessary to support " "older versions of the Limited API." msgstr "" -#: c-api/stable.rst:103 +#: c-api/stable.rst:112 msgid "" "On Windows, extensions that use the Stable ABI should be linked against " "``python3.dll`` rather than a version-specific library such as ``python39." "dll``." msgstr "" -#: c-api/stable.rst:107 +#: c-api/stable.rst:116 msgid "" "On some platforms, Python will look for and load shared library files named " "with the ``abi3`` tag (e.g. ``mymodule.abi3.so``). It does not check if such " @@ -174,31 +183,31 @@ msgid "" "not installed for lower versions of Python." msgstr "" -#: c-api/stable.rst:114 +#: c-api/stable.rst:123 msgid "" "All functions in the Stable ABI are present as functions in Python's shared " "library, not solely as macros. This makes them usable from languages that " "don't use the C preprocessor." msgstr "" -#: c-api/stable.rst:120 +#: c-api/stable.rst:129 msgid "Limited API Scope and Performance" msgstr "" -#: c-api/stable.rst:122 +#: c-api/stable.rst:131 msgid "" "The goal for the Limited API is to allow everything that is possible with " "the full C API, but possibly with a performance penalty." msgstr "" -#: c-api/stable.rst:125 +#: c-api/stable.rst:134 msgid "" "For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro " "variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it " "can rely on version-specific implementation details of the list object." msgstr "" -#: c-api/stable.rst:130 +#: c-api/stable.rst:139 msgid "" "Without ``Py_LIMITED_API`` defined, some C API functions are inlined or " "replaced by macros. Defining ``Py_LIMITED_API`` disables this inlining, " @@ -206,7 +215,7 @@ msgid "" "reducing performance." msgstr "" -#: c-api/stable.rst:135 +#: c-api/stable.rst:144 msgid "" "By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile " "a Limited API extension with a version-specific ABI. This can improve " @@ -216,11 +225,11 @@ msgid "" "of an upcoming Python version." msgstr "" -#: c-api/stable.rst:144 +#: c-api/stable.rst:153 msgid "Limited API Caveats" msgstr "" -#: c-api/stable.rst:146 +#: c-api/stable.rst:155 msgid "" "Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee " "that code conforms to the :ref:`Limited API ` or the :ref:" @@ -228,7 +237,7 @@ msgid "" "an API also includes other issues, such as expected semantics." msgstr "" -#: c-api/stable.rst:151 +#: c-api/stable.rst:160 msgid "" "One issue that ``Py_LIMITED_API`` does not guard against is calling a " "function with arguments that are invalid in a lower Python version. For " @@ -238,19 +247,19 @@ msgid "" "crash. A similar argument works for fields of structs." msgstr "" -#: c-api/stable.rst:158 +#: c-api/stable.rst:167 msgid "" "Another issue is that some struct fields are currently not hidden when " "``Py_LIMITED_API`` is defined, even though they're part of the Limited API." msgstr "" -#: c-api/stable.rst:161 +#: c-api/stable.rst:170 msgid "" "For these reasons, we recommend testing an extension with *all* minor Python " "versions it supports, and preferably to build with the *lowest* such version." msgstr "" -#: c-api/stable.rst:164 +#: c-api/stable.rst:173 msgid "" "We also recommend reviewing documentation of all used API to check if it is " "explicitly part of the Limited API. Even with ``Py_LIMITED_API`` defined, a " @@ -258,7 +267,7 @@ msgid "" "unintentionally, as bugs)." msgstr "" -#: c-api/stable.rst:169 +#: c-api/stable.rst:178 msgid "" "Also note that the Limited API is not necessarily stable: compiling with " "``Py_LIMITED_API`` with Python 3.8 means that the extension will run with " @@ -267,11 +276,11 @@ msgid "" "that the Stable ABI stays stable." msgstr "" -#: c-api/stable.rst:179 +#: c-api/stable.rst:188 msgid "Platform Considerations" msgstr "" -#: c-api/stable.rst:181 +#: c-api/stable.rst:190 msgid "" "ABI stability depends not only on Python, but also on the compiler used, " "lower-level libraries and compiler options. For the purposes of the :ref:" @@ -279,7 +288,7 @@ msgid "" "depend on the OS type and processor architecture" msgstr "" -#: c-api/stable.rst:186 +#: c-api/stable.rst:195 msgid "" "It is the responsibility of each particular distributor of Python to ensure " "that all Python versions on a particular platform are built in a way that " @@ -287,11 +296,11 @@ msgid "" "releases from ``python.org`` and many third-party distributors." msgstr "" -#: c-api/stable.rst:196 +#: c-api/stable.rst:205 msgid "Contents of Limited API" msgstr "" -#: c-api/stable.rst:199 +#: c-api/stable.rst:208 msgid "" "Currently, the :ref:`Limited API ` includes the following " "items:" diff --git a/c-api/structures.po b/c-api/structures.po index 12265cd6..ac0a8d47 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -49,127 +50,220 @@ msgid "" "In a normal \"release\" build, it contains only the object's reference count " "and a pointer to the corresponding type object. Nothing is actually declared " "to be a :c:type:`PyObject`, but every pointer to a Python object can be cast " -"to a :c:expr:`PyObject*`. Access to the members must be done by using the " -"macros :c:macro:`Py_REFCNT` and :c:macro:`Py_TYPE`." +"to a :c:expr:`PyObject*`." +msgstr "" + +#: c-api/structures.rst:33 +msgid "" +"The members must not be accessed directly; instead use macros such as :c:" +"macro:`Py_REFCNT` and :c:macro:`Py_TYPE`." msgstr "" #: c-api/structures.rst:38 msgid "" -"This is an extension of :c:type:`PyObject` that adds the :c:member:" -"`~PyVarObject.ob_size` field. This is only used for objects that have some " -"notion of *length*. This type does not often appear in the Python/C API. " -"Access to the members must be done by using the macros :c:macro:" -"`Py_REFCNT`, :c:macro:`Py_TYPE`, and :c:macro:`Py_SIZE`." +"The object's reference count, as returned by :c:macro:`Py_REFCNT`. Do not " +"use this field directly; instead use functions and macros such as :c:macro:`!" +"Py_REFCNT`, :c:func:`Py_INCREF` and :c:func:`Py_DecRef`." +msgstr "" + +#: c-api/structures.rst:42 +msgid "" +"The field type may be different from ``Py_ssize_t``, depending on build " +"configuration and platform." msgstr "" #: c-api/structures.rst:47 msgid "" +"The object's type. Do not use this field directly; use :c:macro:`Py_TYPE` " +"and :c:func:`Py_SET_TYPE` instead." +msgstr "" + +#: c-api/structures.rst:54 +msgid "" +"An extension of :c:type:`PyObject` that adds the :c:member:`~PyVarObject." +"ob_size` field. This is intended for objects that have some notion of " +"*length*." +msgstr "" + +#: c-api/structures.rst:58 +msgid "" +"As with :c:type:`!PyObject`, the members must not be accessed directly; " +"instead use macros such as :c:macro:`Py_SIZE`, :c:macro:`Py_REFCNT` and :c:" +"macro:`Py_TYPE`." +msgstr "" + +#: c-api/structures.rst:64 +msgid "" +"A size field, whose contents should be considered an object's internal " +"implementation detail." +msgstr "" + +#: c-api/structures.rst:67 +msgid "Do not use this field directly; use :c:macro:`Py_SIZE` instead." +msgstr "" + +#: c-api/structures.rst:69 +msgid "" +"Object creation functions such as :c:func:`PyObject_NewVar` will generally " +"set this field to the requested size (number of items). After creation, " +"arbitrary values can be stored in :c:member:`!ob_size` using :c:macro:" +"`Py_SET_SIZE`." +msgstr "" + +#: c-api/structures.rst:74 +msgid "" +"To get an object's publicly exposed length, as returned by the Python " +"function :py:func:`len`, use :c:func:`PyObject_Length` instead." +msgstr "" + +#: c-api/structures.rst:81 +msgid "" "This is a macro used when declaring new types which represent objects " "without a varying length. The PyObject_HEAD macro expands to::" msgstr "" -#: c-api/structures.rst:52 +#: c-api/structures.rst:84 +msgid "PyObject ob_base;" +msgstr "" + +#: c-api/structures.rst:86 msgid "See documentation of :c:type:`PyObject` above." msgstr "" -#: c-api/structures.rst:57 +#: c-api/structures.rst:91 msgid "" "This is a macro used when declaring new types which represent objects with a " "length that varies from instance to instance. The PyObject_VAR_HEAD macro " "expands to::" msgstr "" -#: c-api/structures.rst:63 +#: c-api/structures.rst:95 +msgid "PyVarObject ob_base;" +msgstr "" + +#: c-api/structures.rst:97 msgid "See documentation of :c:type:`PyVarObject` above." msgstr "" -#: c-api/structures.rst:68 +#: c-api/structures.rst:102 +msgid "" +"The base class of all other objects, the same as :class:`object` in Python." +msgstr "" + +#: c-api/structures.rst:107 msgid "" "Test if the *x* object is the *y* object, the same as ``x is y`` in Python." msgstr "" -#: c-api/structures.rst:75 +#: c-api/structures.rst:114 msgid "" "Test if an object is the ``None`` singleton, the same as ``x is None`` in " "Python." msgstr "" -#: c-api/structures.rst:83 +#: c-api/structures.rst:122 msgid "" "Test if an object is the ``True`` singleton, the same as ``x is True`` in " "Python." msgstr "" -#: c-api/structures.rst:91 +#: c-api/structures.rst:130 msgid "" "Test if an object is the ``False`` singleton, the same as ``x is False`` in " "Python." msgstr "" -#: c-api/structures.rst:99 +#: c-api/structures.rst:138 msgid "Get the type of the Python object *o*." msgstr "" -#: c-api/structures.rst:101 -msgid "Return a :term:`borrowed reference`." -msgstr "" - -#: c-api/structures.rst:103 -msgid "Use the :c:func:`Py_SET_TYPE` function to set an object type." +#: c-api/structures.rst:140 +msgid "" +"The returned reference is :term:`borrowed ` from *o*. Do " +"not release it with :c:func:`Py_DECREF` or similar." msgstr "" -#: c-api/structures.rst:105 +#: c-api/structures.rst:143 msgid "" ":c:func:`Py_TYPE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyObject*`." msgstr "" -#: c-api/structures.rst:112 +#: c-api/structures.rst:150 msgid "" "Return non-zero if the object *o* type is *type*. Return zero otherwise. " "Equivalent to: ``Py_TYPE(o) == type``." msgstr "" -#: c-api/structures.rst:120 -msgid "Set the object *o* type to *type*." +#: c-api/structures.rst:158 +msgid "" +"Set the type of object *o* to *type*, without any checking or reference " +"counting." msgstr "" -#: c-api/structures.rst:127 -msgid "Get the size of the Python object *o*." +#: c-api/structures.rst:161 +msgid "" +"This is a very low-level operation. Consider instead setting the Python " +"attribute :attr:`~object.__class__` using :c:func:`PyObject_SetAttrString` " +"or similar." +msgstr "" + +#: c-api/structures.rst:165 +msgid "" +"Note that assigning an incompatible type can lead to undefined behavior." +msgstr "" + +#: c-api/structures.rst:167 +msgid "" +"If *type* is a :ref:`heap type `, the caller must create a new " +"reference to it. Similarly, if the old type of *o* is a heap type, the " +"caller must release a reference to that type." msgstr "" -#: c-api/structures.rst:129 -msgid "Use the :c:func:`Py_SET_SIZE` function to set an object size." +#: c-api/structures.rst:177 +msgid "Get the :c:member:`~PyVarObject.ob_size` field of *o*." msgstr "" -#: c-api/structures.rst:131 +#: c-api/structures.rst:179 msgid "" ":c:func:`Py_SIZE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyVarObject*`." msgstr "" -#: c-api/structures.rst:138 -msgid "Set the object *o* size to *size*." +#: c-api/structures.rst:186 +msgid "Set the :c:member:`~PyVarObject.ob_size` field of *o* to *size*." msgstr "" -#: c-api/structures.rst:145 +#: c-api/structures.rst:193 msgid "" "This is a macro which expands to initialization values for a new :c:type:" "`PyObject` type. This macro expands to::" msgstr "" -#: c-api/structures.rst:154 +#: c-api/structures.rst:196 +msgid "" +"_PyObject_EXTRA_INIT\n" +"1, type," +msgstr "" + +#: c-api/structures.rst:202 msgid "" "This is a macro which expands to initialization values for a new :c:type:" "`PyVarObject` type, including the :c:member:`~PyVarObject.ob_size` field. " "This macro expands to::" msgstr "" -#: c-api/structures.rst:163 +#: c-api/structures.rst:206 +msgid "" +"_PyObject_EXTRA_INIT\n" +"1, type, size," +msgstr "" + +#: c-api/structures.rst:211 msgid "Implementing functions and methods" msgstr "" -#: c-api/structures.rst:167 +#: c-api/structures.rst:215 msgid "" "Type of the functions used to implement most Python callables in C. " "Functions of this type take two :c:expr:`PyObject*` parameters and return " @@ -179,60 +273,97 @@ msgid "" "reference." msgstr "" -#: c-api/structures.rst:174 +#: c-api/structures.rst:222 msgid "The function signature is::" msgstr "" -#: c-api/structures.rst:181 +#: c-api/structures.rst:224 +msgid "" +"PyObject *PyCFunction(PyObject *self,\n" +" PyObject *args);" +msgstr "" + +#: c-api/structures.rst:229 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_VARARGS | METH_KEYWORDS `. " "The function signature is::" msgstr "" -#: c-api/structures.rst:192 +#: c-api/structures.rst:233 +msgid "" +"PyObject *PyCFunctionWithKeywords(PyObject *self,\n" +" PyObject *args,\n" +" PyObject *kwargs);" +msgstr "" + +#: c-api/structures.rst:240 msgid "" "Type of the functions used to implement Python callables in C with " "signature :c:macro:`METH_FASTCALL`. The function signature is::" msgstr "" -#: c-api/structures.rst:202 +#: c-api/structures.rst:244 +msgid "" +"PyObject *PyCFunctionFast(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs);" +msgstr "" + +#: c-api/structures.rst:250 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" -#: c-api/structures.rst:213 +#: c-api/structures.rst:254 +msgid "" +"PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs,\n" +" PyObject *kwnames);" +msgstr "" + +#: c-api/structures.rst:261 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" -#: c-api/structures.rst:228 +#: c-api/structures.rst:265 +msgid "" +"PyObject *PyCMethod(PyObject *self,\n" +" PyTypeObject *defining_class,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs,\n" +" PyObject *kwnames)" +msgstr "" + +#: c-api/structures.rst:276 msgid "" "Structure used to describe a method of an extension type. This structure " "has four fields:" msgstr "" -#: c-api/structures.rst:233 +#: c-api/structures.rst:281 msgid "Name of the method." msgstr "" -#: c-api/structures.rst:237 +#: c-api/structures.rst:285 msgid "Pointer to the C implementation." msgstr "" -#: c-api/structures.rst:241 +#: c-api/structures.rst:289 msgid "Flags bits indicating how the call should be constructed." msgstr "" -#: c-api/structures.rst:245 +#: c-api/structures.rst:293 msgid "Points to the contents of the docstring." msgstr "" -#: c-api/structures.rst:247 +#: c-api/structures.rst:295 msgid "" "The :c:member:`~PyMethodDef.ml_meth` is a C function pointer. The functions " "may be of different types, but they always return :c:expr:`PyObject*`. If " @@ -242,18 +373,18 @@ msgid "" "implementation uses the specific C type of the *self* object." msgstr "" -#: c-api/structures.rst:255 +#: c-api/structures.rst:303 msgid "" "The :c:member:`~PyMethodDef.ml_flags` field is a bitfield which can include " "the following flags. The individual flags indicate either a calling " "convention or a binding convention." msgstr "" -#: c-api/structures.rst:260 +#: c-api/structures.rst:308 msgid "There are these calling conventions:" msgstr "" -#: c-api/structures.rst:264 +#: c-api/structures.rst:312 msgid "" "This is the typical calling convention, where the methods have the type :c:" "type:`PyCFunction`. The function expects two :c:expr:`PyObject*` values. The " @@ -263,7 +394,7 @@ msgid "" "func:`PyArg_ParseTuple` or :c:func:`PyArg_UnpackTuple`." msgstr "" -#: c-api/structures.rst:274 +#: c-api/structures.rst:322 msgid "" "Can only be used in certain combinations with other flags: :ref:" "`METH_VARARGS | METH_KEYWORDS `, :ref:" @@ -272,11 +403,11 @@ msgid "" "METH_KEYWORDS>`." msgstr "" -#: c-api/structures.rst:288 +#: c-api/structures.rst:330 msgid ":c:expr:`METH_VARARGS | METH_KEYWORDS`" msgstr "" -#: c-api/structures.rst:283 +#: c-api/structures.rst:331 msgid "" "Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. " "The function expects three parameters: *self*, *args*, *kwargs* where " @@ -285,27 +416,27 @@ msgid "" "using :c:func:`PyArg_ParseTupleAndKeywords`." msgstr "" -#: c-api/structures.rst:292 +#: c-api/structures.rst:340 msgid "" "Fast calling convention supporting only positional arguments. The methods " -"have the type :c:type:`_PyCFunctionFast`. The first parameter is *self*, the " +"have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " "second parameter is a C array of :c:expr:`PyObject*` values indicating the " "arguments and the third parameter is the number of arguments (the length of " "the array)." msgstr "" -#: c-api/structures.rst:302 +#: c-api/structures.rst:350 msgid "``METH_FASTCALL`` is now part of the :ref:`stable ABI `." msgstr "" -#: c-api/structures.rst:319 +#: c-api/structures.rst:355 msgid ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" msgstr "" -#: c-api/structures.rst:308 +#: c-api/structures.rst:356 msgid "" "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " -"with methods of type :c:type:`_PyCFunctionFastWithKeywords`. Keyword " +"with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " "arguments are passed the same way as in the :ref:`vectorcall protocol " "`: there is an additional fourth :c:expr:`PyObject*` parameter " "which is a tuple representing the names of the keyword arguments (which are " @@ -314,17 +445,17 @@ msgid "" "the positional arguments." msgstr "" -#: c-api/structures.rst:323 +#: c-api/structures.rst:371 msgid "" "Can only be used in the combination with other flags: :ref:`METH_METHOD | " "METH_FASTCALL | METH_KEYWORDS `." msgstr "" -#: c-api/structures.rst:340 +#: c-api/structures.rst:377 msgid ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" msgstr "" -#: c-api/structures.rst:330 +#: c-api/structures.rst:378 msgid "" "Extension of :ref:`METH_FASTCALL | METH_KEYWORDS ` supporting the *defining class*, that is, the class that " @@ -332,14 +463,14 @@ msgid "" "``Py_TYPE(self)``." msgstr "" -#: c-api/structures.rst:335 +#: c-api/structures.rst:383 msgid "" "The method needs to be of type :c:type:`PyCMethod`, the same as for " "``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added " "after ``self``." msgstr "" -#: c-api/structures.rst:344 +#: c-api/structures.rst:392 msgid "" "Methods without parameters don't need to check whether arguments are given " "if they are listed with the :c:macro:`METH_NOARGS` flag. They need to be of " @@ -348,13 +479,13 @@ msgid "" "the second parameter will be ``NULL``." msgstr "" -#: c-api/structures.rst:350 +#: c-api/structures.rst:398 msgid "" "The function must have 2 parameters. Since the second parameter is unused, :" "c:macro:`Py_UNUSED` can be used to prevent a compiler warning." msgstr "" -#: c-api/structures.rst:356 +#: c-api/structures.rst:404 msgid "" "Methods with a single object argument can be listed with the :c:macro:" "`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` with a " @@ -363,7 +494,7 @@ msgid "" "single argument." msgstr "" -#: c-api/structures.rst:362 +#: c-api/structures.rst:410 msgid "" "These two constants are not used to indicate the calling convention but the " "binding when use with methods of classes. These may not be used for " @@ -371,27 +502,27 @@ msgid "" "any given method." msgstr "" -#: c-api/structures.rst:372 +#: c-api/structures.rst:420 msgid "" "The method will be passed the type object as the first parameter rather than " "an instance of the type. This is used to create *class methods*, similar to " "what is created when using the :func:`classmethod` built-in function." msgstr "" -#: c-api/structures.rst:382 +#: c-api/structures.rst:430 msgid "" "The method will be passed ``NULL`` as the first parameter rather than an " "instance of the type. This is used to create *static methods*, similar to " "what is created when using the :func:`staticmethod` built-in function." msgstr "" -#: c-api/structures.rst:386 +#: c-api/structures.rst:434 msgid "" "One other constant controls whether a method is loaded in place of another " "definition with the same method name." msgstr "" -#: c-api/structures.rst:392 +#: c-api/structures.rst:440 msgid "" "The method will be loaded in place of existing definitions. Without " "*METH_COEXIST*, the default is to skip repeated definitions. Since slot " @@ -404,20 +535,38 @@ msgid "" "wrapper object calls." msgstr "" -#: c-api/structures.rst:404 +#: c-api/structures.rst:453 +msgid "" +"The type object corresponding to Python C method objects. This is available " +"as :class:`types.BuiltinMethodType` in the Python layer." +msgstr "" + +#: c-api/structures.rst:459 +msgid "" +"Return true if *op* is an instance of the :c:type:`PyCMethod_Type` type or a " +"subtype of it. This function always succeeds." +msgstr "" + +#: c-api/structures.rst:465 +msgid "" +"This is the same as :c:func:`PyCMethod_Check`, but does not account for " +"subtypes." +msgstr "" + +#: c-api/structures.rst:471 msgid "" "Turn *ml* into a Python :term:`callable` object. The caller must ensure that " "*ml* outlives the :term:`callable`. Typically, *ml* is defined as a static " "variable." msgstr "" -#: c-api/structures.rst:408 +#: c-api/structures.rst:475 msgid "" "The *self* parameter will be passed as the *self* argument to the C function " "in ``ml->ml_meth`` when invoked. *self* can be ``NULL``." msgstr "" -#: c-api/structures.rst:412 +#: c-api/structures.rst:479 msgid "" "The :term:`callable` object's ``__module__`` attribute can be set from the " "given *module* argument. *module* should be a Python string, which will be " @@ -425,71 +574,151 @@ msgid "" "can be set to :const:`None` or ``NULL``." msgstr "" -#: c-api/structures.rst:418 +#: c-api/structures.rst:485 msgid ":attr:`function.__module__`" msgstr "" -#: c-api/structures.rst:420 +#: c-api/structures.rst:487 msgid "" "The *cls* parameter will be passed as the *defining_class* argument to the C " "function. Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``." msgstr "" -#: c-api/structures.rst:429 +#: c-api/structures.rst:496 +msgid "" +"The type object corresponding to Python C function objects. This is " +"available as :class:`types.BuiltinFunctionType` in the Python layer." +msgstr "" + +#: c-api/structures.rst:502 +msgid "" +"Return true if *op* is an instance of the :c:type:`PyCFunction_Type` type or " +"a subtype of it. This function always succeeds." +msgstr "" + +#: c-api/structures.rst:508 +msgid "" +"This is the same as :c:func:`PyCFunction_Check`, but does not account for " +"subtypes." +msgstr "" + +#: c-api/structures.rst:514 msgid "Equivalent to ``PyCMethod_New(ml, self, module, NULL)``." msgstr "" -#: c-api/structures.rst:434 +#: c-api/structures.rst:519 msgid "Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``." msgstr "" -#: c-api/structures.rst:438 +#: c-api/structures.rst:524 +msgid "" +"Get the function's flags on *func* as they were passed to :c:member:" +"`~PyMethodDef.ml_flags`." +msgstr "" + +#: c-api/structures.rst:545 c-api/structures.rst:565 +msgid "" +"If *func* is not a C function object, this fails with an exception. *func* " +"must not be ``NULL``." +msgstr "" + +#: c-api/structures.rst:530 +msgid "" +"This function returns the function's flags on success, and ``-1`` with an " +"exception set on failure." +msgstr "" + +#: c-api/structures.rst:536 +msgid "" +"This is the same as :c:func:`PyCFunction_GetFlags`, but without error or " +"type checking." +msgstr "" + +#: c-api/structures.rst:542 +msgid "" +"Get the function pointer on *func* as it was passed to :c:member:" +"`~PyMethodDef.ml_meth`." +msgstr "" + +#: c-api/structures.rst:548 +msgid "" +"This function returns the function pointer on success, and ``NULL`` with an " +"exception set on failure." +msgstr "" + +#: c-api/structures.rst:554 +msgid "" +"This is the same as :c:func:`PyCFunction_GetFunction`, but without error or " +"type checking." +msgstr "" + +#: c-api/structures.rst:560 +msgid "" +"Get the \"self\" object on *func*. This is the object that would be passed " +"to the first argument of a :c:type:`PyCFunction`. For C function objects " +"created through a :c:type:`PyMethodDef` on a :c:type:`PyModuleDef`, this is " +"the resulting module object." +msgstr "" + +#: c-api/structures.rst:568 +msgid "" +"This function returns a :term:`borrowed reference` to the \"self\" object on " +"success, and ``NULL`` with an exception set on failure." +msgstr "" + +#: c-api/structures.rst:574 +msgid "" +"This is the same as :c:func:`PyCFunction_GetSelf`, but without error or type " +"checking." +msgstr "" + +#: c-api/structures.rst:579 msgid "Accessing attributes of extension types" msgstr "" -#: c-api/structures.rst:442 +#: c-api/structures.rst:583 msgid "" "Structure which describes an attribute of a type which corresponds to a C " "struct member. When defining a class, put a NULL-terminated array of these " "structures in the :c:member:`~PyTypeObject.tp_members` slot." msgstr "" -#: c-api/structures.rst:447 +#: c-api/structures.rst:588 msgid "Its fields are, in order:" msgstr "" -#: c-api/structures.rst:451 +#: c-api/structures.rst:592 msgid "" "Name of the member. A NULL value marks the end of a ``PyMemberDef[]`` array." msgstr "" -#: c-api/structures.rst:454 +#: c-api/structures.rst:595 msgid "The string should be static, no copy is made of it." msgstr "" -#: c-api/structures.rst:458 +#: c-api/structures.rst:599 msgid "" "The type of the member in the C struct. See :ref:`PyMemberDef-types` for the " "possible values." msgstr "" -#: c-api/structures.rst:463 +#: c-api/structures.rst:604 msgid "" "The offset in bytes that the member is located on the type’s object struct." msgstr "" -#: c-api/structures.rst:467 +#: c-api/structures.rst:608 msgid "" "Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR." msgstr "" -#: c-api/structures.rst:471 +#: c-api/structures.rst:612 msgid "" "The docstring, or NULL. The string should be static, no copy is made of it. " "Typically, it is defined using :c:macro:`PyDoc_STR`." msgstr "" -#: c-api/structures.rst:475 +#: c-api/structures.rst:616 msgid "" "By default (when :c:member:`~PyMemberDef.flags` is ``0``), members allow " "both read and write access. Use the :c:macro:`Py_READONLY` flag for read-" @@ -498,20 +727,30 @@ msgid "" "`T_OBJECT`) members can be deleted." msgstr "" -#: c-api/structures.rst:484 +#: c-api/structures.rst:625 msgid "" "For heap-allocated types (created using :c:func:`PyType_FromSpec` or " "similar), ``PyMemberDef`` may contain a definition for the special member " "``\"__vectorcalloffset__\"``, corresponding to :c:member:`~PyTypeObject." -"tp_vectorcall_offset` in type objects. These must be defined with " -"``Py_T_PYSSIZET`` and ``Py_READONLY``, for example::" +"tp_vectorcall_offset` in type objects. This member must be defined with " +"``Py_T_PYSSIZET``, and either ``Py_READONLY`` or ``Py_READONLY | " +"Py_RELATIVE_OFFSET``. For example::" msgstr "" -#: c-api/structures.rst:496 +#: c-api/structures.rst:632 +msgid "" +"static PyMemberDef spam_type_members[] = {\n" +" {\"__vectorcalloffset__\", Py_T_PYSSIZET,\n" +" offsetof(Spam_object, vectorcall), Py_READONLY},\n" +" {NULL} /* Sentinel */\n" +"};" +msgstr "" + +#: c-api/structures.rst:638 msgid "(You may need to ``#include `` for :c:func:`!offsetof`.)" msgstr "" -#: c-api/structures.rst:498 +#: c-api/structures.rst:640 msgid "" "The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` and :c:member:" "`~PyTypeObject.tp_weaklistoffset` can be defined similarly using " @@ -520,77 +759,80 @@ msgid "" "and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead." msgstr "" -#: c-api/structures.rst:506 +#: c-api/structures.rst:648 msgid "" "``PyMemberDef`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: c-api/structures.rst:511 +#: c-api/structures.rst:653 +msgid "" +":c:macro:`Py_RELATIVE_OFFSET` is now allowed for " +"``\"__vectorcalloffset__\"``, ``\"__dictoffset__\"`` and " +"``\"__weaklistoffset__\"``." +msgstr "" + +#: c-api/structures.rst:659 msgid "" "Get an attribute belonging to the object at address *obj_addr*. The " "attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." msgstr "" -#: c-api/structures.rst:517 +#: c-api/structures.rst:665 msgid "" "``PyMember_GetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: c-api/structures.rst:522 +#: c-api/structures.rst:670 msgid "" "Set an attribute belonging to the object at address *obj_addr* to object " "*o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns " "``0`` if successful and a negative value on failure." msgstr "" -#: c-api/structures.rst:528 +#: c-api/structures.rst:676 msgid "" "``PyMember_SetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: c-api/structures.rst:534 +#: c-api/structures.rst:682 msgid "Member flags" msgstr "" -#: c-api/structures.rst:536 +#: c-api/structures.rst:684 msgid "The following flags can be used with :c:member:`PyMemberDef.flags`:" msgstr "" -#: c-api/structures.rst:540 +#: c-api/structures.rst:688 msgid "Not writable." msgstr "" -#: c-api/structures.rst:544 +#: c-api/structures.rst:692 msgid "" "Emit an ``object.__getattr__`` :ref:`audit event ` before " "reading." msgstr "" -#: c-api/structures.rst:549 +#: c-api/structures.rst:697 msgid "" "Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef`` " "entry indicates an offset from the subclass-specific data, rather than from " "``PyObject``." msgstr "" -#: c-api/structures.rst:553 -msgid "" -"Can only be used as part of :c:member:`Py_tp_members ` :c:type:`slot ` when creating a class using " -"negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in that case." -msgstr "" - -#: c-api/structures.rst:558 +#: c-api/structures.rst:701 msgid "" -"This flag is only used in :c:type:`PyType_Slot`. When setting :c:member:" -"`~PyTypeObject.tp_members` during class creation, Python clears it and sets :" -"c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct." +"Can only be used as part of the :c:data:`Py_tp_members` :c:type:`slot " +"` when creating a class using negative :c:member:`~PyType_Spec." +"basicsize`. It is mandatory in that case. When setting :c:member:" +"`~PyTypeObject.tp_members` from the slot during class creation, Python " +"clears the flag and sets :c:member:`PyMemberDef.offset` to the offset from " +"the ``PyObject`` struct." msgstr "" -#: c-api/structures.rst:570 +#: c-api/structures.rst:716 msgid "" "The :c:macro:`!RESTRICTED`, :c:macro:`!READ_RESTRICTED` and :c:macro:`!" "WRITE_RESTRICTED` macros available with ``#include \"structmember.h\"`` are " @@ -599,7 +841,7 @@ msgid "" "nothing." msgstr "" -#: c-api/structures.rst:581 +#: c-api/structures.rst:727 msgid "" "The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. The :c:" "macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The new " @@ -608,11 +850,11 @@ msgid "" "names." msgstr "" -#: c-api/structures.rst:590 +#: c-api/structures.rst:736 msgid "Member types" msgstr "" -#: c-api/structures.rst:592 +#: c-api/structures.rst:738 msgid "" ":c:member:`PyMemberDef.type` can be one of the following macros " "corresponding to various C types. When the member is accessed in Python, it " @@ -621,143 +863,143 @@ msgid "" "exception such as :exc:`TypeError` or :exc:`ValueError` is raised." msgstr "" -#: c-api/structures.rst:600 +#: c-api/structures.rst:746 msgid "" "Unless marked (D), attributes defined this way cannot be deleted using e.g. :" "keyword:`del` or :py:func:`delattr`." msgstr "" -#: c-api/structures.rst:604 +#: c-api/structures.rst:750 msgid "Macro name" msgstr "" -#: c-api/structures.rst:604 +#: c-api/structures.rst:750 msgid "C type" msgstr "" -#: c-api/structures.rst:604 +#: c-api/structures.rst:750 msgid "Python type" msgstr "" -#: c-api/structures.rst:606 +#: c-api/structures.rst:752 msgid ":c:expr:`char`" msgstr "" -#: c-api/structures.rst:607 c-api/structures.rst:609 c-api/structures.rst:611 -#: c-api/structures.rst:613 c-api/structures.rst:615 c-api/structures.rst:616 +#: c-api/structures.rst:753 c-api/structures.rst:755 c-api/structures.rst:757 +#: c-api/structures.rst:759 c-api/structures.rst:761 c-api/structures.rst:762 msgid ":py:class:`int`" msgstr "" -#: c-api/structures.rst:607 +#: c-api/structures.rst:753 msgid ":c:expr:`short`" msgstr "" -#: c-api/structures.rst:608 +#: c-api/structures.rst:754 msgid ":c:expr:`int`" msgstr "" -#: c-api/structures.rst:609 +#: c-api/structures.rst:755 msgid ":c:expr:`long`" msgstr "" -#: c-api/structures.rst:610 +#: c-api/structures.rst:756 msgid ":c:expr:`long long`" msgstr "" -#: c-api/structures.rst:611 +#: c-api/structures.rst:757 msgid ":c:expr:`unsigned char`" msgstr "" -#: c-api/structures.rst:612 +#: c-api/structures.rst:758 msgid ":c:expr:`unsigned int`" msgstr "" -#: c-api/structures.rst:613 +#: c-api/structures.rst:759 msgid ":c:expr:`unsigned short`" msgstr "" -#: c-api/structures.rst:614 +#: c-api/structures.rst:760 msgid ":c:expr:`unsigned long`" msgstr "" -#: c-api/structures.rst:615 +#: c-api/structures.rst:761 msgid ":c:expr:`unsigned long long`" msgstr "" -#: c-api/structures.rst:616 +#: c-api/structures.rst:762 msgid ":c:expr:`Py_ssize_t`" msgstr "" -#: c-api/structures.rst:617 +#: c-api/structures.rst:763 msgid ":c:expr:`float`" msgstr "" -#: c-api/structures.rst:618 +#: c-api/structures.rst:764 msgid ":py:class:`float`" msgstr "" -#: c-api/structures.rst:618 +#: c-api/structures.rst:764 msgid ":c:expr:`double`" msgstr "" -#: c-api/structures.rst:619 +#: c-api/structures.rst:765 msgid ":c:expr:`char` (written as 0 or 1)" msgstr "" -#: c-api/structures.rst:619 +#: c-api/structures.rst:765 msgid ":py:class:`bool`" msgstr "" -#: c-api/structures.rst:621 +#: c-api/structures.rst:767 msgid ":c:expr:`const char *` (*)" msgstr "" -#: c-api/structures.rst:622 +#: c-api/structures.rst:768 msgid ":py:class:`str` (RO)" msgstr "" -#: c-api/structures.rst:622 +#: c-api/structures.rst:768 msgid ":c:expr:`const char[]` (*)" msgstr "" -#: c-api/structures.rst:623 +#: c-api/structures.rst:769 msgid ":c:expr:`char` (0-127)" msgstr "" -#: c-api/structures.rst:623 +#: c-api/structures.rst:769 msgid ":py:class:`str` (**)" msgstr "" -#: c-api/structures.rst:624 +#: c-api/structures.rst:770 msgid ":c:expr:`PyObject *`" msgstr "" -#: c-api/structures.rst:624 +#: c-api/structures.rst:770 msgid ":py:class:`object` (D)" msgstr "" -#: c-api/structures.rst:627 +#: c-api/structures.rst:773 msgid "" "(*): Zero-terminated, UTF8-encoded C string. With :c:macro:`!Py_T_STRING` " "the C representation is a pointer; with :c:macro:`!Py_T_STRING_INPLACE` the " "string is stored directly in the structure." msgstr "" -#: c-api/structures.rst:632 +#: c-api/structures.rst:778 msgid "(**): String of length 1. Only ASCII is accepted." msgstr "" -#: c-api/structures.rst:634 +#: c-api/structures.rst:780 msgid "(RO): Implies :c:macro:`Py_READONLY`." msgstr "" -#: c-api/structures.rst:636 +#: c-api/structures.rst:782 msgid "" "(D): Can be deleted, in which case the pointer is set to ``NULL``. Reading a " "``NULL`` pointer raises :py:exc:`AttributeError`." msgstr "" -#: c-api/structures.rst:662 +#: c-api/structures.rst:808 msgid "" "In previous versions, the macros were only available with ``#include " "\"structmember.h\"`` and were named without the ``Py_`` prefix (e.g. as " @@ -765,174 +1007,174 @@ msgid "" "with the following deprecated types:" msgstr "" -#: c-api/structures.rst:670 +#: c-api/structures.rst:816 msgid "" "Like ``Py_T_OBJECT_EX``, but ``NULL`` is converted to ``None``. This results " "in surprising behavior in Python: deleting the attribute effectively sets it " "to ``None``." msgstr "" -#: c-api/structures.rst:676 +#: c-api/structures.rst:822 msgid "Always ``None``. Must be used with :c:macro:`Py_READONLY`." msgstr "" -#: c-api/structures.rst:679 +#: c-api/structures.rst:825 msgid "Defining Getters and Setters" msgstr "" -#: c-api/structures.rst:683 +#: c-api/structures.rst:829 msgid "" "Structure to define property-like access for a type. See also description of " "the :c:member:`PyTypeObject.tp_getset` slot." msgstr "" -#: c-api/structures.rst:688 +#: c-api/structures.rst:834 msgid "attribute name" msgstr "" -#: c-api/structures.rst:692 +#: c-api/structures.rst:838 msgid "C function to get the attribute." msgstr "" -#: c-api/structures.rst:696 +#: c-api/structures.rst:842 msgid "" "Optional C function to set or delete the attribute. If ``NULL``, the " "attribute is read-only." msgstr "" -#: c-api/structures.rst:701 +#: c-api/structures.rst:847 msgid "optional docstring" msgstr "" -#: c-api/structures.rst:705 +#: c-api/structures.rst:851 msgid "" "Optional user data pointer, providing additional data for getter and setter." msgstr "" -#: c-api/structures.rst:709 +#: c-api/structures.rst:855 msgid "" "The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) " "and a user data pointer (the associated ``closure``):" msgstr "" -#: c-api/structures.rst:712 +#: c-api/structures.rst:858 msgid "" "It should return a new reference on success or ``NULL`` with a set exception " "on failure." msgstr "" -#: c-api/structures.rst:717 +#: c-api/structures.rst:863 msgid "" "``set`` functions take two :c:expr:`PyObject*` parameters (the instance and " "the value to be set) and a user data pointer (the associated ``closure``):" msgstr "" -#: c-api/structures.rst:720 +#: c-api/structures.rst:866 msgid "" "In case the attribute should be deleted the second parameter is ``NULL``. " "Should return ``0`` on success or ``-1`` with a set exception on failure." msgstr "" -#: c-api/structures.rst:380 +#: c-api/structures.rst:428 msgid "built-in function" msgstr "" -#: c-api/structures.rst:370 +#: c-api/structures.rst:418 msgid "classmethod" msgstr "" -#: c-api/structures.rst:380 +#: c-api/structures.rst:428 msgid "staticmethod" msgstr "" -#: c-api/structures.rst:563 +#: c-api/structures.rst:709 msgid "READ_RESTRICTED (C macro)" msgstr "" -#: c-api/structures.rst:563 +#: c-api/structures.rst:709 msgid "WRITE_RESTRICTED (C macro)" msgstr "" -#: c-api/structures.rst:563 +#: c-api/structures.rst:709 msgid "RESTRICTED (C macro)" msgstr "" -#: c-api/structures.rst:576 +#: c-api/structures.rst:722 msgid "READONLY (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_BYTE (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_SHORT (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_INT (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_LONG (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_LONGLONG (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_UBYTE (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_USHORT (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_UINT (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_ULONG (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_ULONGULONG (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_PYSSIZET (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_FLOAT (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_DOUBLE (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_BOOL (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_CHAR (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_STRING (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_STRING_INPLACE (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "T_OBJECT_EX (C macro)" msgstr "" -#: c-api/structures.rst:639 +#: c-api/structures.rst:785 msgid "structmember.h" msgstr "" diff --git a/c-api/sys.po b/c-api/sys.po index 73624df9..5e5d8cad 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -134,20 +135,45 @@ msgid "" msgstr "" #: c-api/sys.rst:129 +msgid "Check if a :c:macro:`!SIGINT` signal has been received." +msgstr "" + +#: c-api/sys.rst:131 +msgid "" +"Returns ``1`` if a :c:macro:`!SIGINT` has occurred and clears the signal " +"flag, or ``0`` otherwise." +msgstr "" + +#: c-api/sys.rst:134 +msgid "" +"In most cases, you should prefer :c:func:`PyErr_CheckSignals` over this " +"function. :c:func:`!PyErr_CheckSignals` invokes the appropriate signal " +"handlers for all pending signals, allowing Python code to handle the signal " +"properly. This function only detects :c:macro:`!SIGINT` and does not invoke " +"any Python signal handlers." +msgstr "" + +#: c-api/sys.rst:140 +msgid "" +"This function is async-signal-safe and this function cannot fail. The caller " +"must hold an :term:`attached thread state`." +msgstr "" + +#: c-api/sys.rst:147 msgid "" "This function should not be called directly: use the :c:type:`PyConfig` API " "with the :c:func:`PyConfig_SetBytesString` function which ensures that :ref:" "`Python is preinitialized `." msgstr "" -#: c-api/sys.rst:200 +#: c-api/sys.rst:218 msgid "" "This function must not be called before :ref:`Python is preinitialized ` and so that the LC_CTYPE locale is properly configured: see the :c:" "func:`Py_PreInitialize` function." msgstr "" -#: c-api/sys.rst:137 +#: c-api/sys.rst:155 msgid "" "Decode a byte string from the :term:`filesystem encoding and error handler`. " "If the error handler is :ref:`surrogateescape error handler " @@ -157,57 +183,57 @@ msgid "" "instead of decoding them." msgstr "" -#: c-api/sys.rst:144 +#: c-api/sys.rst:162 msgid "" "Return a pointer to a newly allocated wide character string, use :c:func:" "`PyMem_RawFree` to free the memory. If size is not ``NULL``, write the " "number of wide characters excluding the null character into ``*size``" msgstr "" -#: c-api/sys.rst:148 +#: c-api/sys.rst:166 msgid "" "Return ``NULL`` on decoding error or memory allocation error. If *size* is " "not ``NULL``, ``*size`` is set to ``(size_t)-1`` on memory error or set to " "``(size_t)-2`` on decoding error." msgstr "" -#: c-api/sys.rst:192 +#: c-api/sys.rst:210 msgid "" "The :term:`filesystem encoding and error handler` are selected by :c:func:" "`PyConfig_Read`: see :c:member:`~PyConfig.filesystem_encoding` and :c:member:" "`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" -#: c-api/sys.rst:156 +#: c-api/sys.rst:174 msgid "" "Decoding errors should never happen, unless there is a bug in the C library." msgstr "" -#: c-api/sys.rst:159 +#: c-api/sys.rst:177 msgid "" "Use the :c:func:`Py_EncodeLocale` function to encode the character string " "back to a byte string." msgstr "" -#: c-api/sys.rst:164 +#: c-api/sys.rst:182 msgid "" "The :c:func:`PyUnicode_DecodeFSDefaultAndSize` and :c:func:" "`PyUnicode_DecodeLocaleAndSize` functions." msgstr "" -#: c-api/sys.rst:211 +#: c-api/sys.rst:229 msgid "" "The function now uses the UTF-8 encoding in the :ref:`Python UTF-8 Mode " "`." msgstr "" -#: c-api/sys.rst:173 +#: c-api/sys.rst:191 msgid "" "The function now uses the UTF-8 encoding on Windows if :c:member:" "`PyPreConfig.legacy_windows_fs_encoding` is zero;" msgstr "" -#: c-api/sys.rst:180 +#: c-api/sys.rst:198 msgid "" "Encode a wide character string to the :term:`filesystem encoding and error " "handler`. If the error handler is :ref:`surrogateescape error handler " @@ -215,116 +241,122 @@ msgid "" "converted to bytes 0x80..0xFF." msgstr "" -#: c-api/sys.rst:185 +#: c-api/sys.rst:203 msgid "" "Return a pointer to a newly allocated byte string, use :c:func:`PyMem_Free` " "to free the memory. Return ``NULL`` on encoding error or memory allocation " "error." msgstr "" -#: c-api/sys.rst:189 +#: c-api/sys.rst:207 msgid "" "If error_pos is not ``NULL``, ``*error_pos`` is set to ``(size_t)-1`` on " "success, or set to the index of the invalid character on encoding error." msgstr "" -#: c-api/sys.rst:196 +#: c-api/sys.rst:214 msgid "" "Use the :c:func:`Py_DecodeLocale` function to decode the bytes string back " "to a wide character string." msgstr "" -#: c-api/sys.rst:206 +#: c-api/sys.rst:224 msgid "" "The :c:func:`PyUnicode_EncodeFSDefault` and :c:func:`PyUnicode_EncodeLocale` " "functions." msgstr "" -#: c-api/sys.rst:215 +#: c-api/sys.rst:233 msgid "" "The function now uses the UTF-8 encoding on Windows if :c:member:" "`PyPreConfig.legacy_windows_fs_encoding` is zero." msgstr "" -#: c-api/sys.rst:223 -msgid "System Functions" +#: c-api/sys.rst:239 +msgid "" +"Similar to :c:func:`!fopen`, but *path* is a Python object and an exception " +"is set on error." msgstr "" -#: c-api/sys.rst:225 +#: c-api/sys.rst:242 msgid "" -"These are utility functions that make functionality from the :mod:`sys` " -"module accessible to C code. They all work with the current interpreter " -"thread's :mod:`sys` module's dict, which is contained in the internal thread " -"state structure." +"*path* must be a :class:`str` object, a :class:`bytes` object, or a :term:" +"`path-like object`." msgstr "" -#: c-api/sys.rst:231 +#: c-api/sys.rst:245 msgid "" -"Return the object *name* from the :mod:`sys` module or ``NULL`` if it does " -"not exist, without setting an exception." +"On success, return the new file pointer. On error, set an exception and " +"return ``NULL``." msgstr "" -#: c-api/sys.rst:236 +#: c-api/sys.rst:248 msgid "" -"Set *name* in the :mod:`sys` module to *v* unless *v* is ``NULL``, in which " -"case *name* is deleted from the sys module. Returns ``0`` on success, ``-1`` " -"on error." +"The file must be closed by :c:func:`Py_fclose` rather than calling directly :" +"c:func:`!fclose`." msgstr "" -#: c-api/sys.rst:242 -msgid "" -"Reset :data:`sys.warnoptions` to an empty list. This function may be called " -"prior to :c:func:`Py_Initialize`." +#: c-api/sys.rst:251 +msgid "The file descriptor is created non-inheritable (:pep:`446`)." msgstr "" -#: c-api/sys.rst:258 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"warnoptions` should be used instead, see :ref:`Python Initialization " -"Configuration `." +#: c-api/sys.rst:253 +msgid "The caller must have an :term:`attached thread state`." msgstr "" -#: c-api/sys.rst:251 -msgid "" -"Append *s* to :data:`sys.warnoptions`. This function must be called prior " -"to :c:func:`Py_Initialize` in order to affect the warnings filter list." +#: c-api/sys.rst:260 +msgid "Close a file that was opened by :c:func:`Py_fopen`." msgstr "" #: c-api/sys.rst:262 -msgid "Append *unicode* to :data:`sys.warnoptions`." +msgid "" +"On success, return ``0``. On error, return ``EOF`` and ``errno`` is set to " +"indicate the error. In either case, any further access (including another " +"call to :c:func:`Py_fclose`) to the stream results in undefined behavior." +msgstr "" + +#: c-api/sys.rst:273 +msgid "System Functions" +msgstr "" + +#: c-api/sys.rst:275 +msgid "" +"These are utility functions that make functionality from the :mod:`sys` " +"module accessible to C code. They all work with the current interpreter " +"thread's :mod:`sys` module's dict, which is contained in the internal thread " +"state structure." msgstr "" -#: c-api/sys.rst:264 +#: c-api/sys.rst:281 msgid "" -"Note: this function is not currently usable from outside the CPython " -"implementation, as it must be called prior to the implicit import of :mod:" -"`warnings` in :c:func:`Py_Initialize` to be effective, but can't be called " -"until enough of the runtime has been initialized to permit the creation of " -"Unicode objects." +"Return the object *name* from the :mod:`sys` module or ``NULL`` if it does " +"not exist, without setting an exception." msgstr "" -#: c-api/sys.rst:274 +#: c-api/sys.rst:286 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " -"be used instead, see :ref:`Python Initialization Configuration `." +"Set *name* in the :mod:`sys` module to *v* unless *v* is ``NULL``, in which " +"case *name* is deleted from the sys module. Returns ``0`` on success, ``-1`` " +"on error." msgstr "" -#: c-api/sys.rst:279 +#: c-api/sys.rst:292 msgid "" -"Set :data:`sys.path` to a list object of paths found in *path* which should " -"be a list of paths separated with the platform's search path delimiter (``:" -"`` on Unix, ``;`` on Windows)." +"Reset :data:`sys.warnoptions` to an empty list. This function may be called " +"prior to :c:func:`Py_Initialize`." +msgstr "" + +#: c-api/sys.rst:295 +msgid "Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead." msgstr "" -#: c-api/sys.rst:287 +#: c-api/sys.rst:300 msgid "" "Write the output string described by *format* to :data:`sys.stdout`. No " "exceptions are raised, even if truncation occurs (see below)." msgstr "" -#: c-api/sys.rst:290 +#: c-api/sys.rst:303 msgid "" "*format* should limit the total size of the formatted output string to 1000 " "bytes or less -- after 1000 bytes, the output string is truncated. In " @@ -335,85 +367,89 @@ msgid "" "of digits for very large numbers." msgstr "" -#: c-api/sys.rst:298 +#: c-api/sys.rst:311 msgid "" "If a problem occurs, or :data:`sys.stdout` is unset, the formatted message " "is written to the real (C level) *stdout*." msgstr "" -#: c-api/sys.rst:303 +#: c-api/sys.rst:316 msgid "" "As :c:func:`PySys_WriteStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: c-api/sys.rst:308 +#: c-api/sys.rst:321 msgid "" "Function similar to PySys_WriteStdout() but format the message using :c:func:" "`PyUnicode_FromFormatV` and don't truncate the message to an arbitrary " "length." msgstr "" -#: c-api/sys.rst:316 +#: c-api/sys.rst:329 msgid "" "As :c:func:`PySys_FormatStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: c-api/sys.rst:323 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"xoptions` should be used instead, see :ref:`Python Initialization " -"Configuration `." -msgstr "" - -#: c-api/sys.rst:327 -msgid "" -"Parse *s* as a set of :option:`-X` options and add them to the current " -"options mapping as returned by :c:func:`PySys_GetXOptions`. This function " -"may be called prior to :c:func:`Py_Initialize`." -msgstr "" - -#: c-api/sys.rst:337 +#: c-api/sys.rst:336 msgid "" "Return the current dictionary of :option:`-X` options, similarly to :data:" "`sys._xoptions`. On error, ``NULL`` is returned and an exception is set." msgstr "" -#: c-api/sys.rst:346 +#: c-api/sys.rst:345 msgid "" "Raise an auditing event with any active hooks. Return zero for success and " "non-zero with an exception set on failure." msgstr "" -#: c-api/sys.rst:349 +#: c-api/sys.rst:348 +msgid "The *event* string argument must not be *NULL*." +msgstr "" + +#: c-api/sys.rst:350 msgid "" "If any hooks have been added, *format* and other arguments will be used to " "construct a tuple to pass. Apart from ``N``, the same format characters as " "used in :c:func:`Py_BuildValue` are available. If the built value is not a " -"tuple, it will be added into a single-element tuple. (The ``N`` format " -"option consumes a reference, but since there is no way to know whether " -"arguments to this function will be consumed, using it may cause reference " -"leaks.)" +"tuple, it will be added into a single-element tuple." +msgstr "" + +#: c-api/sys.rst:355 +msgid "" +"The ``N`` format option must not be used. It consumes a reference, but since " +"there is no way to know whether arguments to this function will be consumed, " +"using it may cause reference leaks." msgstr "" -#: c-api/sys.rst:357 +#: c-api/sys.rst:359 msgid "" "Note that ``#`` format characters should always be treated as :c:type:" "`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined." msgstr "" -#: c-api/sys.rst:360 +#: c-api/sys.rst:362 msgid ":func:`sys.audit` performs the same function from Python code." msgstr "" -#: c-api/sys.rst:366 +#: c-api/sys.rst:364 +msgid "See also :c:func:`PySys_AuditTuple`." +msgstr "" + +#: c-api/sys.rst:370 msgid "" "Require :c:type:`Py_ssize_t` for ``#`` format characters. Previously, an " "unavoidable deprecation warning was raised." msgstr "" -#: c-api/sys.rst:372 +#: c-api/sys.rst:376 +msgid "" +"Similar to :c:func:`PySys_Audit`, but pass arguments as a Python object. " +"*args* must be a :class:`tuple`. To pass no arguments, *args* can be *NULL*." +msgstr "" + +#: c-api/sys.rst:384 msgid "" "Append the callable *hook* to the list of active auditing hooks. Return zero " "on success and non-zero on failure. If the runtime has been initialized, " @@ -421,14 +457,14 @@ msgid "" "all interpreters created by the runtime." msgstr "" -#: c-api/sys.rst:378 +#: c-api/sys.rst:390 msgid "" "The *userData* pointer is passed into the hook function. Since hook " "functions may be called from different runtimes, this pointer should not " "refer directly to Python state." msgstr "" -#: c-api/sys.rst:382 +#: c-api/sys.rst:394 msgid "" "This function is safe to call before :c:func:`Py_Initialize`. When called " "after runtime initialization, existing audit hooks are notified and may " @@ -436,26 +472,20 @@ msgid "" "`Exception` (other errors will not be silenced)." msgstr "" -#: c-api/sys.rst:387 +#: c-api/sys.rst:399 msgid "" -"The hook function is always called with the GIL held by the Python " -"interpreter that raised the event." +"The hook function is always called with an :term:`attached thread state` by " +"the Python interpreter that raised the event." msgstr "" -#: c-api/sys.rst:390 +#: c-api/sys.rst:402 msgid "" "See :pep:`578` for a detailed description of auditing. Functions in the " "runtime and standard library that raise events are listed in the :ref:`audit " "events table `. Details are in each function's documentation." msgstr "" -#: c-api/sys.rst:395 -msgid "" -"Raises an :ref:`auditing event ` ``sys.addaudithook`` with no " -"arguments." -msgstr "" - -#: c-api/sys.rst:397 +#: c-api/sys.rst:409 msgid "" "If the interpreter is initialized, this function raises an auditing event " "``sys.addaudithook`` with no arguments. If any existing hooks raise an " @@ -464,18 +494,19 @@ msgid "" "hook has been added unless they control all existing hooks." msgstr "" -#: c-api/sys.rst:406 +#: c-api/sys.rst:418 msgid "" "The type of the hook function. *event* is the C string event argument passed " -"to :c:func:`PySys_Audit`. *args* is guaranteed to be a :c:type:" -"`PyTupleObject`. *userData* is the argument passed to PySys_AddAuditHook()." +"to :c:func:`PySys_Audit` or :c:func:`PySys_AuditTuple`. *args* is guaranteed " +"to be a :c:type:`PyTupleObject`. *userData* is the argument passed to " +"PySys_AddAuditHook()." msgstr "" -#: c-api/sys.rst:417 +#: c-api/sys.rst:430 msgid "Process Control" msgstr "" -#: c-api/sys.rst:424 +#: c-api/sys.rst:437 msgid "" "Print a fatal error message and kill the process. No cleanup is performed. " "This function should only be invoked when a condition is detected that would " @@ -485,29 +516,29 @@ msgid "" "file:`core` file." msgstr "" -#: c-api/sys.rst:431 +#: c-api/sys.rst:444 msgid "" "The ``Py_FatalError()`` function is replaced with a macro which logs " "automatically the name of the current function, unless the " "``Py_LIMITED_API`` macro is defined." msgstr "" -#: c-api/sys.rst:435 +#: c-api/sys.rst:448 msgid "Log the function name automatically." msgstr "" -#: c-api/sys.rst:445 +#: c-api/sys.rst:458 msgid "" "Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls " "the standard C library function ``exit(status)``. If :c:func:" "`Py_FinalizeEx` indicates an error, the exit status is set to 120." msgstr "" -#: c-api/sys.rst:449 +#: c-api/sys.rst:462 msgid "Errors from finalization no longer ignored." msgstr "" -#: c-api/sys.rst:459 +#: c-api/sys.rst:472 msgid "" "Register a cleanup function to be called by :c:func:`Py_FinalizeEx`. The " "cleanup function will be called with no arguments and should return no " @@ -519,22 +550,26 @@ msgid "" "should be called by *func*." msgstr "" +#: c-api/sys.rst:482 +msgid ":c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument." +msgstr "" + #: c-api/sys.rst:101 msgid "USE_STACKCHECK (C macro)" msgstr "" -#: c-api/sys.rst:422 +#: c-api/sys.rst:435 msgid "abort (C function)" msgstr "" -#: c-api/sys.rst:455 +#: c-api/sys.rst:468 msgid "Py_FinalizeEx (C function)" msgstr "" -#: c-api/sys.rst:441 +#: c-api/sys.rst:454 msgid "exit (C function)" msgstr "" -#: c-api/sys.rst:455 +#: c-api/sys.rst:468 msgid "cleanup functions" msgstr "" diff --git a/c-api/time.po b/c-api/time.po new file mode 100644 index 00000000..f82e029e --- /dev/null +++ b/c-api/time.po @@ -0,0 +1,168 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: c-api/time.rst:6 +msgid "PyTime C API" +msgstr "" + +#: c-api/time.rst:10 +msgid "" +"The clock C API provides access to system clocks. It is similar to the " +"Python :mod:`time` module." +msgstr "" + +#: c-api/time.rst:13 +msgid "" +"For C API related to the :mod:`datetime` module, see :ref:`datetimeobjects`." +msgstr "" + +#: c-api/time.rst:17 +msgid "Types" +msgstr "" + +#: c-api/time.rst:21 +msgid "" +"A timestamp or duration in nanoseconds, represented as a signed 64-bit " +"integer." +msgstr "" + +#: c-api/time.rst:24 +msgid "" +"The reference point for timestamps depends on the clock used. For example, :" +"c:func:`PyTime_Time` returns timestamps relative to the UNIX epoch." +msgstr "" + +#: c-api/time.rst:27 +msgid "" +"The supported range is around [-292.3 years; +292.3 years]. Using the Unix " +"epoch (January 1st, 1970) as reference, the supported date range is around " +"[1677-09-21; 2262-04-11]. The exact limits are exposed as constants:" +msgstr "" + +#: c-api/time.rst:34 +msgid "Minimum value of :c:type:`PyTime_t`." +msgstr "" + +#: c-api/time.rst:38 +msgid "Maximum value of :c:type:`PyTime_t`." +msgstr "" + +#: c-api/time.rst:42 +msgid "Clock Functions" +msgstr "" + +#: c-api/time.rst:44 +msgid "" +"The following functions take a pointer to a :c:expr:`PyTime_t` that they set " +"to the value of a particular clock. Details of each clock are given in the " +"documentation of the corresponding Python function." +msgstr "" + +#: c-api/time.rst:49 +msgid "" +"The functions return ``0`` on success, or ``-1`` (with an exception set) on " +"failure." +msgstr "" + +#: c-api/time.rst:52 +msgid "" +"On integer overflow, they set the :c:data:`PyExc_OverflowError` exception " +"and set ``*result`` to the value clamped to the ``[PyTime_MIN; PyTime_MAX]`` " +"range. (On current systems, integer overflows are likely caused by " +"misconfigured system time.)" +msgstr "" + +#: c-api/time.rst:58 +msgid "" +"As any other C API (unless otherwise specified), the functions must be " +"called with an :term:`attached thread state`." +msgstr "" + +#: c-api/time.rst:63 +msgid "" +"Read the monotonic clock. See :func:`time.monotonic` for important details " +"on this clock." +msgstr "" + +#: c-api/time.rst:68 +msgid "" +"Read the performance counter. See :func:`time.perf_counter` for important " +"details on this clock." +msgstr "" + +#: c-api/time.rst:73 +msgid "" +"Read the “wall clock” time. See :func:`time.time` for details important on " +"this clock." +msgstr "" + +#: c-api/time.rst:78 +msgid "Raw Clock Functions" +msgstr "" + +#: c-api/time.rst:80 +msgid "" +"Similar to clock functions, but don't set an exception on error and don't " +"require the caller to have an :term:`attached thread state`." +msgstr "" + +#: c-api/time.rst:83 +msgid "On success, the functions return ``0``." +msgstr "" + +#: c-api/time.rst:85 +msgid "" +"On failure, they set ``*result`` to ``0`` and return ``-1``, *without* " +"setting an exception. To get the cause of the error, :term:`attach ` a :term:`thread state`, and call the regular (non-``Raw``) " +"function. Note that the regular function may succeed after the ``Raw`` one " +"failed." +msgstr "" + +#: c-api/time.rst:92 +msgid "" +"Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error " +"and don't require an :term:`attached thread state`." +msgstr "" + +#: c-api/time.rst:97 +msgid "" +"Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error " +"and don't require an :term:`attached thread state`." +msgstr "" + +#: c-api/time.rst:102 +msgid "" +"Similar to :c:func:`PyTime_Time`, but don't set an exception on error and " +"don't require an :term:`attached thread state`." +msgstr "" + +#: c-api/time.rst:107 +msgid "Conversion functions" +msgstr "" + +#: c-api/time.rst:111 +msgid "Convert a timestamp to a number of seconds as a C :c:expr:`double`." +msgstr "" + +#: c-api/time.rst:113 +msgid "" +"The function cannot fail, but note that :c:expr:`double` has limited " +"accuracy for large values." +msgstr "" diff --git a/c-api/tuple.po b/c-api/tuple.po index 89b071fd..6bbe695a 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -43,72 +44,100 @@ msgid "" msgstr "" #: c-api/tuple.rst:36 -msgid "Return a new tuple object of size *len*, or ``NULL`` on failure." +msgid "" +"Return a new tuple object of size *len*, or ``NULL`` with an exception set " +"on failure." msgstr "" -#: c-api/tuple.rst:41 +#: c-api/tuple.rst:42 msgid "" -"Return a new tuple object of size *n*, or ``NULL`` on failure. The tuple " -"values are initialized to the subsequent *n* C arguments pointing to Python " -"objects. ``PyTuple_Pack(2, a, b)`` is equivalent to " +"Return a new tuple object of size *n*, or ``NULL`` with an exception set on " +"failure. The tuple values are initialized to the subsequent *n* C arguments " +"pointing to Python objects. ``PyTuple_Pack(2, a, b)`` is equivalent to " "``Py_BuildValue(\"(OO)\", a, b)``." msgstr "" -#: c-api/tuple.rst:48 -msgid "Take a pointer to a tuple object, and return the size of that tuple." +#: c-api/tuple.rst:50 +msgid "" +"Take a pointer to a tuple object, and return the size of that tuple. On " +"error, return ``-1`` with an exception set." msgstr "" -#: c-api/tuple.rst:53 -msgid "" -"Return the size of the tuple *p*, which must be non-``NULL`` and point to a " -"tuple; no error checking is performed." +#: c-api/tuple.rst:56 +msgid "Like :c:func:`PyTuple_Size`, but without error checking." msgstr "" -#: c-api/tuple.rst:59 +#: c-api/tuple.rst:61 msgid "" "Return the object at position *pos* in the tuple pointed to by *p*. If " "*pos* is negative or out of bounds, return ``NULL`` and set an :exc:" "`IndexError` exception." msgstr "" -#: c-api/tuple.rst:65 +#: c-api/tuple.rst:64 +msgid "" +"The returned reference is borrowed from the tuple *p* (that is: it is only " +"valid as long as you hold a reference to *p*). To get a :term:`strong " +"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) ` or :c:" +"func:`PySequence_GetItem`." +msgstr "" + +#: c-api/tuple.rst:73 msgid "Like :c:func:`PyTuple_GetItem`, but does no checking of its arguments." msgstr "" -#: c-api/tuple.rst:70 +#: c-api/tuple.rst:78 msgid "" "Return the slice of the tuple pointed to by *p* between *low* and *high*, or " -"``NULL`` on failure. This is the equivalent of the Python expression " -"``p[low:high]``. Indexing from the end of the tuple is not supported." +"``NULL`` with an exception set on failure." +msgstr "" + +#: c-api/tuple.rst:81 +msgid "" +"This is the equivalent of the Python expression ``p[low:high]``. Indexing " +"from the end of the tuple is not supported." msgstr "" -#: c-api/tuple.rst:77 +#: c-api/tuple.rst:87 msgid "" "Insert a reference to object *o* at position *pos* of the tuple pointed to " "by *p*. Return ``0`` on success. If *pos* is out of bounds, return ``-1`` " "and set an :exc:`IndexError` exception." msgstr "" -#: c-api/tuple.rst:83 +#: c-api/tuple.rst:93 msgid "" "This function \"steals\" a reference to *o* and discards a reference to an " "item already in the tuple at the affected position." msgstr "" -#: c-api/tuple.rst:89 +#: c-api/tuple.rst:99 msgid "" "Like :c:func:`PyTuple_SetItem`, but does no error checking, and should " "*only* be used to fill in brand new tuples." msgstr "" -#: c-api/tuple.rst:94 +#: c-api/tuple.rst:224 c-api/tuple.rst:242 +msgid "" +"Bounds checking is performed as an assertion if Python is built in :ref:" +"`debug mode ` or :option:`with assertions <--with-assertions>`." +msgstr "" + +#: c-api/tuple.rst:107 msgid "" "This function \"steals\" a reference to *o*, and, unlike :c:func:" "`PyTuple_SetItem`, does *not* discard a reference to any item that is being " "replaced; any reference in the tuple at position *pos* will be leaked." msgstr "" -#: c-api/tuple.rst:102 +#: c-api/tuple.rst:114 +msgid "" +"This macro should *only* be used on tuples that are newly created. Using " +"this macro on a tuple that is already in use (or in other words, has a " +"refcount > 1) could lead to undefined behavior." +msgstr "" + +#: c-api/tuple.rst:121 msgid "" "Can be used to resize a tuple. *newsize* will be the new length of the " "tuple. Because tuples are *supposed* to be immutable, this should only be " @@ -123,11 +152,11 @@ msgid "" "`SystemError`." msgstr "" -#: c-api/tuple.rst:117 +#: c-api/tuple.rst:136 msgid "Struct Sequence Objects" msgstr "" -#: c-api/tuple.rst:119 +#: c-api/tuple.rst:138 msgid "" "Struct sequence objects are the C equivalent of :func:`~collections." "namedtuple` objects, i.e. a sequence whose items can also be accessed " @@ -135,44 +164,50 @@ msgid "" "specific struct sequence type." msgstr "" -#: c-api/tuple.rst:126 +#: c-api/tuple.rst:145 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " "Instances of the resulting type can be created with :c:func:" "`PyStructSequence_New`." msgstr "" -#: c-api/tuple.rst:132 +#: c-api/tuple.rst:217 +msgid "Return ``NULL`` with an exception set on failure." +msgstr "" + +#: c-api/tuple.rst:153 msgid "Initializes a struct sequence type *type* from *desc* in place." msgstr "" -#: c-api/tuple.rst:137 +#: c-api/tuple.rst:158 msgid "" -"The same as ``PyStructSequence_InitType``, but returns ``0`` on success and " -"``-1`` on failure." +"Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and " +"``-1`` with an exception set on failure." msgstr "" -#: c-api/tuple.rst:145 +#: c-api/tuple.rst:166 msgid "Contains the meta information of a struct sequence type to create." msgstr "" -#: c-api/tuple.rst:149 -msgid "Name of the struct sequence type." +#: c-api/tuple.rst:170 +msgid "" +"Fully qualified name of the type; null-terminated UTF-8 encoded. The name " +"must contain the module name." msgstr "" -#: c-api/tuple.rst:153 +#: c-api/tuple.rst:175 msgid "Pointer to docstring for the type or ``NULL`` to omit." msgstr "" -#: c-api/tuple.rst:157 +#: c-api/tuple.rst:179 msgid "Pointer to ``NULL``-terminated array with field names of the new type." msgstr "" -#: c-api/tuple.rst:161 +#: c-api/tuple.rst:183 msgid "Number of fields visible to the Python side (if used as tuple)." msgstr "" -#: c-api/tuple.rst:166 +#: c-api/tuple.rst:188 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " "tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:" @@ -181,55 +216,60 @@ msgid "" "described." msgstr "" -#: c-api/tuple.rst:174 +#: c-api/tuple.rst:196 msgid "" "Name for the field or ``NULL`` to end the list of named fields, set to :c:" "data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" -#: c-api/tuple.rst:179 +#: c-api/tuple.rst:201 msgid "Field docstring or ``NULL`` to omit." msgstr "" -#: c-api/tuple.rst:184 +#: c-api/tuple.rst:206 msgid "Special value for a field name to leave it unnamed." msgstr "" -#: c-api/tuple.rst:186 +#: c-api/tuple.rst:208 msgid "The type was changed from ``char *``." msgstr "" -#: c-api/tuple.rst:192 +#: c-api/tuple.rst:214 msgid "" "Creates an instance of *type*, which must have been created with :c:func:" "`PyStructSequence_NewType`." msgstr "" -#: c-api/tuple.rst:198 +#: c-api/tuple.rst:222 msgid "" -"Return the object at position *pos* in the struct sequence pointed to by " -"*p*. No bounds checking is performed." +"Return the object at position *pos* in the struct sequence pointed to by *p*." +msgstr "" + +#: c-api/tuple.rst:230 +msgid "Alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -#: c-api/tuple.rst:204 -msgid "Macro equivalent of :c:func:`PyStructSequence_GetItem`." +#: c-api/tuple.rst:232 +msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -#: c-api/tuple.rst:209 +#: c-api/tuple.rst:238 msgid "" "Sets the field at index *pos* of the struct sequence *p* to value *o*. " "Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand " "new instances." msgstr "" -#: c-api/tuple.rst:225 +#: c-api/tuple.rst:247 msgid "This function \"steals\" a reference to *o*." msgstr "" -#: c-api/tuple.rst:220 -msgid "" -"Similar to :c:func:`PyStructSequence_SetItem`, but implemented as a static " -"inlined function." +#: c-api/tuple.rst:252 +msgid "Alias to :c:func:`PyStructSequence_SetItem`." +msgstr "" + +#: c-api/tuple.rst:254 +msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`." msgstr "" #: c-api/tuple.rst:8 diff --git a/c-api/type.po b/c-api/type.po index e1d9569f..f4dec249 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -64,32 +65,32 @@ msgstr "" #: c-api/type.rst:55 msgid "" "Return the type object's internal namespace, which is otherwise only exposed " -"via a read-only proxy (``cls.__dict__``). This is a replacement for " -"accessing :c:member:`~PyTypeObject.tp_dict` directly. The returned " -"dictionary must be treated as read-only." +"via a read-only proxy (:attr:`cls.__dict__ `). This is a " +"replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. The " +"returned dictionary must be treated as read-only." msgstr "" -#: c-api/type.rst:60 +#: c-api/type.rst:61 msgid "" "This function is meant for specific embedding and language-binding cases, " "where direct access to the dict is necessary and indirect access (e.g. via " "the proxy or :c:func:`PyObject_GetAttr`) isn't adequate." msgstr "" -#: c-api/type.rst:64 +#: c-api/type.rst:65 msgid "" "Extension modules should continue to use ``tp_dict``, directly or " "indirectly, when setting up their own types." msgstr "" -#: c-api/type.rst:72 +#: c-api/type.rst:73 msgid "" "Invalidate the internal lookup cache for the type and all of its subtypes. " "This function must be called after any manual modification of the attributes " "or base classes of the type." msgstr "" -#: c-api/type.rst:79 +#: c-api/type.rst:80 msgid "" "Register *callback* as a type watcher. Return a non-negative integer ID " "which must be passed to future calls to :c:func:`PyType_Watch`. In case of " @@ -97,21 +98,27 @@ msgid "" "exception." msgstr "" -#: c-api/type.rst:89 +#: c-api/type.rst:85 +msgid "" +"In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, so " +"it must be called at start up (before spawning the first thread)." +msgstr "" + +#: c-api/type.rst:93 msgid "" "Clear watcher identified by *watcher_id* (previously returned from :c:func:" "`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " "*watcher_id* was never registered.)" msgstr "" -#: c-api/type.rst:93 +#: c-api/type.rst:97 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " "that was not returned to it by a previous call to :c:func:" "`PyType_AddWatcher`." msgstr "" -#: c-api/type.rst:102 +#: c-api/type.rst:106 msgid "" "Mark *type* as watched. The callback granted *watcher_id* by :c:func:" "`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " @@ -121,61 +128,112 @@ msgid "" "detail and subject to change.)" msgstr "" -#: c-api/type.rst:109 +#: c-api/type.rst:113 msgid "" "An extension should never call ``PyType_Watch`` with a *watcher_id* that was " "not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -#: c-api/type.rst:117 +#: c-api/type.rst:121 +msgid "" +"Mark *type* as not watched. This undoes a previous call to :c:func:" +"`PyType_Watch`. *type* must not be ``NULL``." +msgstr "" + +#: c-api/type.rst:124 +msgid "" +"An extension should never call this function with a *watcher_id* that was " +"not returned to it by a previous call to :c:func:`PyType_AddWatcher`." +msgstr "" + +#: c-api/type.rst:127 +msgid "" +"On success, this function returns ``0``. On failure, this function returns " +"``-1`` with an exception set." +msgstr "" + +#: c-api/type.rst:135 msgid "Type of a type-watcher callback function." msgstr "" -#: c-api/type.rst:119 +#: c-api/type.rst:137 msgid "" "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " "called on *type* or any type in its MRO; violating this rule could cause " "infinite recursion." msgstr "" -#: c-api/type.rst:128 +#: c-api/type.rst:146 msgid "" "Return non-zero if the type object *o* sets the feature *feature*. Type " "features are denoted by single bit flags." msgstr "" -#: c-api/type.rst:134 +#: c-api/type.rst:152 +msgid "" +"Return non-zero if the type object *type* sets the subclass flag *flag*. " +"Subclass flags are denoted by :c:macro:`Py_TPFLAGS_*_SUBCLASS " +"`. This function is used by many ``_Check`` " +"functions for common types." +msgstr "" + +#: c-api/type.rst:158 +msgid "" +":c:func:`PyObject_TypeCheck`, which is used as a slower alternative in " +"``_Check`` functions for types that don't come with subclass flags." +msgstr "" + +#: c-api/type.rst:164 msgid "" "Return true if the type object includes support for the cycle detector; this " "tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" -#: c-api/type.rst:140 +#: c-api/type.rst:170 msgid "Return true if *a* is a subtype of *b*." msgstr "" -#: c-api/type.rst:142 +#: c-api/type.rst:172 msgid "" -"This function only checks for actual subtypes, which means that :meth:" -"`~class.__subclasscheck__` is not called on *b*. Call :c:func:" -"`PyObject_IsSubclass` to do the same check that :func:`issubclass` would do." +"This function only checks for actual subtypes, which means that :meth:`~type." +"__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " +"to do the same check that :func:`issubclass` would do." msgstr "" -#: c-api/type.rst:150 +#: c-api/type.rst:180 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " -"object. Use Python's default memory allocation mechanism to allocate a new " -"instance and initialize all its contents to ``NULL``." +"object. Uses Python's default memory allocation mechanism to allocate " +"memory for a new instance, zeros the memory, then initializes the memory as " +"if by calling :c:func:`PyObject_Init` or :c:func:`PyObject_InitVar`." +msgstr "" + +#: c-api/type.rst:185 +msgid "" +"Do not call this directly to allocate memory for an object; call the type's :" +"c:member:`~PyTypeObject.tp_alloc` slot instead." +msgstr "" + +#: c-api/type.rst:188 +msgid "" +"For types that support garbage collection (i.e., the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag is set), this function behaves like :c:macro:" +"`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar` (except the memory is " +"guaranteed to be zeroed before initialization), and should be paired with :c:" +"func:`PyObject_GC_Del` in :c:member:`~PyTypeObject.tp_free`. Otherwise, it " +"behaves like :c:macro:`PyObject_New` or :c:macro:`PyObject_NewVar` (except " +"the memory is guaranteed to be zeroed before initialization) and should be " +"paired with :c:func:`PyObject_Free` in :c:member:`~PyTypeObject.tp_free`." msgstr "" -#: c-api/type.rst:156 +#: c-api/type.rst:201 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " -"object. Create a new instance using the type's :c:member:`~PyTypeObject." -"tp_alloc` slot." +"object. Creates a new instance using the type's :c:member:`~PyTypeObject." +"tp_alloc` slot and returns the resulting object." msgstr "" -#: c-api/type.rst:161 +#: c-api/type.rst:208 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " @@ -183,7 +241,7 @@ msgid "" "and sets an exception on error." msgstr "" -#: c-api/type.rst:167 +#: c-api/type.rst:214 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " @@ -194,19 +252,32 @@ msgid "" "handle." msgstr "" -#: c-api/type.rst:177 +#: c-api/type.rst:225 +msgid "" +"Return the type's name. Equivalent to getting the type's :attr:`~type." +"__name__` attribute." +msgstr "" + +#: c-api/type.rst:233 +msgid "" +"Return the type's qualified name. Equivalent to getting the type's :attr:" +"`~type.__qualname__` attribute." +msgstr "" + +#: c-api/type.rst:240 msgid "" -"Return the type's name. Equivalent to getting the type's ``__name__`` " -"attribute." +"Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." +"{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." +"__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" -#: c-api/type.rst:183 +#: c-api/type.rst:249 msgid "" -"Return the type's qualified name. Equivalent to getting the type's " -"``__qualname__`` attribute." +"Return the type's module name. Equivalent to getting the :attr:`type." +"__module__` attribute." msgstr "" -#: c-api/type.rst:190 +#: c-api/type.rst:257 msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " @@ -214,30 +285,30 @@ msgid "" "result pointer into the appropriate function type." msgstr "" -#: c-api/type.rst:196 +#: c-api/type.rst:263 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: c-api/type.rst:200 +#: c-api/type.rst:267 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: c-api/type.rst:206 +#: c-api/type.rst:274 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: c-api/type.rst:229 +#: c-api/type.rst:298 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: c-api/type.rst:212 +#: c-api/type.rst:280 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " @@ -248,31 +319,31 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: c-api/type.rst:225 +#: c-api/type.rst:294 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: c-api/type.rst:232 +#: c-api/type.rst:301 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: c-api/type.rst:239 +#: c-api/type.rst:309 msgid "" "Find the first superclass whose module was created from the given :c:type:" "`PyModuleDef` *def*, and return that module." msgstr "" -#: c-api/type.rst:242 +#: c-api/type.rst:312 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: c-api/type.rst:244 +#: c-api/type.rst:314 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -281,58 +352,108 @@ msgid "" "type:`PyCMethod` calling convention." msgstr "" -#: c-api/type.rst:254 +#: c-api/type.rst:320 +msgid "" +"The returned reference is :term:`borrowed ` from *type*, " +"and will be valid as long as you hold a reference to *type*. Do not release " +"it with :c:func:`Py_DECREF` or similar." +msgstr "" + +#: c-api/type.rst:329 +msgid "" +"Find the first superclass in *type*'s :term:`method resolution order` whose :" +"c:macro:`Py_tp_token` token is equal to the given one." +msgstr "" + +#: c-api/type.rst:332 +msgid "" +"If found, set *\\*result* to a new :term:`strong reference` to it and return " +"``1``." +msgstr "" + +#: c-api/type.rst:334 +msgid "If not found, set *\\*result* to ``NULL`` and return ``0``." +msgstr "" + +#: c-api/type.rst:335 +msgid "" +"On error, set *\\*result* to ``NULL`` and return ``-1`` with an exception " +"set." +msgstr "" + +#: c-api/type.rst:338 +msgid "" +"The *result* argument may be ``NULL``, in which case *\\*result* is not set. " +"Use this if you need only the return value." +msgstr "" + +#: c-api/type.rst:341 +msgid "The *token* argument may not be ``NULL``." +msgstr "" + +#: c-api/type.rst:348 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: c-api/type.rst:256 +#: c-api/type.rst:350 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: c-api/type.rst:263 +#: c-api/type.rst:358 +msgid "" +"Return true if instances of *type* support creating weak references, false " +"otherwise. This function always succeeds. *type* must not be ``NULL``." +msgstr "" + +#: c-api/type.rst:362 +msgid ":ref:`weakrefobjects`" +msgstr "" + +#: c-api/type.rst:363 +msgid ":py:mod:`weakref`" +msgstr "" + +#: c-api/type.rst:367 msgid "Creating Heap-Allocated Types" msgstr "" -#: c-api/type.rst:265 +#: c-api/type.rst:369 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: c-api/type.rst:270 +#: c-api/type.rst:374 msgid "" "Create and return a :ref:`heap type ` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: c-api/type.rst:273 +#: c-api/type.rst:377 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: c-api/type.rst:277 +#: c-api/type.rst:381 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " -"supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " -"other ``PyType_From*`` functions allow such metaclasses. They ignore " -"``tp_new``, which may result in incomplete initialization. This is " -"deprecated and in Python 3.14+ such metaclasses will not be supported.)" +"supported, except if ``tp_new`` is ``NULL``." msgstr "" -#: c-api/type.rst:284 +#: c-api/type.rst:384 msgid "" "The *bases* argument can be used to specify base classes; it can either be " -"only one class or a tuple of classes. If *bases* is ``NULL``, the " -"*Py_tp_bases* slot is used instead. If that also is ``NULL``, the " -"*Py_tp_base* slot is used instead. If that also is ``NULL``, the new type " +"only one class or a tuple of classes. If *bases* is ``NULL``, the :c:data:" +"`Py_tp_bases` slot is used instead. If that also is ``NULL``, the :c:data:" +"`Py_tp_base` slot is used instead. If that also is ``NULL``, the new type " "derives from :class:`object`." msgstr "" -#: c-api/type.rst:290 +#: c-api/type.rst:390 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -341,11 +462,11 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: c-api/type.rst:297 +#: c-api/type.rst:397 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: c-api/type.rst:299 +#: c-api/type.rst:399 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() ` or using the :keyword:`class` statement. With user-" @@ -354,102 +475,128 @@ msgid "" "Specifically:" msgstr "" -#: c-api/type.rst:306 +#: c-api/type.rst:406 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: c-api/type.rst:308 +#: c-api/type.rst:408 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: c-api/type.rst:309 +#: c-api/type.rst:409 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: c-api/type.rst:310 +#: c-api/type.rst:410 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: c-api/type.rst:316 +#: c-api/type.rst:417 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "" -#: c-api/type.rst:322 +#: c-api/type.rst:423 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: c-api/type.rst:344 +#: c-api/type.rst:450 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: c-api/type.rst:347 c-api/type.rst:363 +#: c-api/type.rst:453 c-api/type.rst:474 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " -"overrides :c:member:`~PyTypeObject.tp_new` is deprecated and in Python 3.14+ " -"it will be no longer allowed." +"overrides :c:member:`~PyTypeObject.tp_new` is deprecated." msgstr "" -#: c-api/type.rst:338 +#: c-api/type.rst:460 c-api/type.rst:481 +msgid "" +"Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " +"is no longer allowed." +msgstr "" + +#: c-api/type.rst:444 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "" -#: c-api/type.rst:355 +#: c-api/type.rst:466 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "" -#: c-api/type.rst:359 +#: c-api/type.rst:470 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: c-api/type.rst:380 +#: c-api/type.rst:487 +msgid "" +"Make a type immutable: set the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag." +msgstr "" + +#: c-api/type.rst:489 +msgid "All base classes of *type* must be immutable." +msgstr "" + +#: c-api/type.rst:491 +msgid "On success, return ``0``. On error, set an exception and return ``-1``." +msgstr "" + +#: c-api/type.rst:494 +msgid "" +"The type must not be used before it's made immutable. For example, type " +"instances must not be created before the type is made immutable." +msgstr "" + +#: c-api/type.rst:510 msgid "Structure defining a type's behavior." msgstr "" -#: c-api/type.rst:384 +#: c-api/type.rst:514 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: c-api/type.rst:388 +#: c-api/type.rst:518 msgid "" "If positive, specifies the size of the instance in bytes. It is used to set :" "c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: c-api/type.rst:391 +#: c-api/type.rst:521 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: c-api/type.rst:394 +#: c-api/type.rst:524 msgid "" "If negative, the absolute value specifies how much space instances of the " "class need *in addition* to the superclass. Use :c:func:" "`PyObject_GetTypeData` to get a pointer to subclass-specific memory reserved " -"this way." +"this way. For negative :c:member:`!basicsize`, Python will insert padding " +"when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s alignment " +"requirements." msgstr "" -#: c-api/type.rst:401 +#: c-api/type.rst:534 msgid "Previously, this field could not be negative." msgstr "" -#: c-api/type.rst:405 +#: c-api/type.rst:538 msgid "" "Size of one element of a variable-size type, in bytes. Used to set :c:member:" "`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." msgstr "" -#: c-api/type.rst:409 +#: c-api/type.rst:542 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -458,58 +605,58 @@ msgid "" "only possible in the following situations:" msgstr "" -#: c-api/type.rst:416 +#: c-api/type.rst:549 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: c-api/type.rst:418 +#: c-api/type.rst:551 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: c-api/type.rst:420 +#: c-api/type.rst:553 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: c-api/type.rst:423 +#: c-api/type.rst:556 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: c-api/type.rst:427 +#: c-api/type.rst:560 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: c-api/type.rst:429 +#: c-api/type.rst:562 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: c-api/type.rst:434 +#: c-api/type.rst:567 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: c-api/type.rst:437 +#: c-api/type.rst:570 msgid "Each slot ID should be specified at most once." msgstr "" -#: c-api/type.rst:447 +#: c-api/type.rst:580 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: c-api/type.rst:452 +#: c-api/type.rst:585 msgid "A slot ID." msgstr "" -#: c-api/type.rst:454 +#: c-api/type.rst:587 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -517,92 +664,165 @@ msgid "" "prefix. For example, use:" msgstr "" -#: c-api/type.rst:460 -msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" +#: c-api/type.rst:593 +msgid ":c:data:`Py_tp_dealloc` to set :c:member:`PyTypeObject.tp_dealloc`" +msgstr "" + +#: c-api/type.rst:594 +msgid ":c:data:`Py_nb_add` to set :c:member:`PyNumberMethods.nb_add`" +msgstr "" + +#: c-api/type.rst:595 +msgid ":c:data:`Py_sq_length` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: c-api/type.rst:461 -msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" +#: c-api/type.rst:597 +msgid "" +"An additional slot is supported that does not correspond to a :c:type:`!" +"PyTypeObject` struct field:" msgstr "" -#: c-api/type.rst:462 -msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" +#: c-api/type.rst:600 +msgid ":c:data:`Py_tp_token`" msgstr "" -#: c-api/type.rst:464 +#: c-api/type.rst:602 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: c-api/type.rst:466 +#: c-api/type.rst:604 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: c-api/type.rst:468 +#: c-api/type.rst:606 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" msgstr "" -#: c-api/type.rst:470 +#: c-api/type.rst:608 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" msgstr "" -#: c-api/type.rst:474 +#: c-api/type.rst:612 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " "vectorcall or to support Python older than 3.12), specify the offset in :c:" -"member:`Py_tp_members `. See :ref:`PyMemberDef " -"documentation ` for details." +"data:`Py_tp_members`. See :ref:`PyMemberDef documentation ` for details." msgstr "" -#: c-api/type.rst:480 -msgid "The following fields cannot be set at all when creating a heap type:" -msgstr "" - -#: c-api/type.rst:482 +#: c-api/type.rst:618 msgid "" -":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." -"tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" +"The following internal fields cannot be set at all when creating a heap type:" msgstr "" -#: c-api/type.rst:486 +#: c-api/type.rst:621 msgid "" -"Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." -"tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." -"tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." +":c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject.tp_mro`, :c:" +"member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject.tp_subclasses`, " +"and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: c-api/type.rst:493 +#: c-api/type.rst:627 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :c:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: c-api/type.rst:500 +#: c-api/type.rst:632 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: c-api/type.rst:502 +#: c-api/type.rst:635 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" -#: c-api/type.rst:509 +#: c-api/type.rst:640 +msgid "" +"The field :c:member:`~PyTypeObject.tp_vectorcall` can now be set using :c:" +"data:`Py_tp_vectorcall`. See the field's documentation for details." +msgstr "" + +#: c-api/type.rst:647 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: c-api/type.rst:512 -msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." +#: c-api/type.rst:650 +msgid "*pfunc* values may not be ``NULL``, except for the following slots:" +msgstr "" + +#: c-api/type.rst:652 +msgid ":c:data:`Py_tp_doc`" +msgstr "" + +#: c-api/type.rst:653 +msgid "" +":c:data:`Py_tp_token` (for clarity, prefer :c:data:`Py_TP_USE_SPEC` rather " +"than ``NULL``)" +msgstr "" + +#: c-api/type.rst:659 +msgid "" +"A :c:member:`~PyType_Slot.slot` that records a static memory layout ID for a " +"class." +msgstr "" + +#: c-api/type.rst:662 +msgid "" +"If the :c:type:`PyType_Spec` of the class is statically allocated, the token " +"can be set to the spec using the special value :c:data:`Py_TP_USE_SPEC`:" +msgstr "" + +#: c-api/type.rst:666 +msgid "" +"static PyType_Slot foo_slots[] = {\n" +" {Py_tp_token, Py_TP_USE_SPEC}," +msgstr "" + +#: c-api/type.rst:671 +msgid "It can also be set to an arbitrary pointer, but you must ensure that:" +msgstr "" + +#: c-api/type.rst:673 +msgid "" +"The pointer outlives the class, so it's not reused for something else while " +"the class exists." +msgstr "" + +#: c-api/type.rst:675 +msgid "" +"It \"belongs\" to the extension module where the class lives, so it will not " +"clash with other extensions." +msgstr "" + +#: c-api/type.rst:678 +msgid "" +"Use :c:func:`PyType_GetBaseByToken` to check if a class's superclass has a " +"given token -- that is, check whether the memory layout is compatible." +msgstr "" + +#: c-api/type.rst:681 +msgid "" +"To get the token for a given class (without considering superclasses), use :" +"c:func:`PyType_GetSlot` with ``Py_tp_token``." +msgstr "" + +#: c-api/type.rst:690 +msgid "" +"Used as a value with :c:data:`Py_tp_token` to set the token to the class's :" +"c:type:`PyType_Spec`. Expands to ``NULL``." msgstr "" #: c-api/type.rst:8 diff --git a/c-api/typehints.po b/c-api/typehints.po index 70c91e6f..03903475 100644 --- a/c-api/typehints.po +++ b/c-api/typehints.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -46,6 +47,18 @@ msgstr "" msgid "Here's an example of how to make an extension type generic::" msgstr "" +#: c-api/typehints.rst:30 +msgid "" +"...\n" +"static PyMethodDef my_obj_methods[] = {\n" +" // Other methods.\n" +" ...\n" +" {\"__class_getitem__\", Py_GenericAlias, METH_O|METH_CLASS, \"See PEP " +"585\"}\n" +" ...\n" +"}" +msgstr "" + #: c-api/typehints.rst:38 msgid "The data model method :meth:`~object.__class_getitem__`." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 6ede1e51..24e23110 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: c-api/typeobj.rst:6 -msgid "Type Objects" +msgid "Type Object Structures" msgstr "" #: c-api/typeobj.rst:8 @@ -114,7 +115,7 @@ msgid ":c:member:`~PyTypeObject.tp_basicsize`" msgstr "" #: c-api/typeobj.rst:46 c-api/typeobj.rst:52 c-api/typeobj.rst:120 -#: c-api/typeobj.rst:416 +#: c-api/typeobj.rst:417 msgid ":c:type:`Py_ssize_t`" msgstr "" @@ -126,7 +127,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_dealloc`" msgstr "" -#: c-api/typeobj.rst:142 c-api/typeobj.rst:346 +#: c-api/typeobj.rst:142 c-api/typeobj.rst:347 msgid ":c:type:`destructor`" msgstr "" @@ -138,7 +139,7 @@ msgstr "" msgid "(:c:member:`~PyTypeObject.tp_getattr`)" msgstr "" -#: c-api/typeobj.rst:370 +#: c-api/typeobj.rst:371 msgid ":c:type:`getattrfunc`" msgstr "" @@ -155,7 +156,7 @@ msgstr "" msgid "(:c:member:`~PyTypeObject.tp_setattr`)" msgstr "" -#: c-api/typeobj.rst:375 +#: c-api/typeobj.rst:376 msgid ":c:type:`setattrfunc`" msgstr "" @@ -171,7 +172,7 @@ msgstr "" msgid ":c:type:`PyAsyncMethods` *" msgstr "" -#: c-api/typeobj.rst:64 c-api/typeobj.rst:68 +#: c-api/typeobj.rst:64 c-api/typeobj.rst:68 c-api/typeobj.rst:82 msgid ":ref:`sub-slots`" msgstr "" @@ -183,7 +184,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_repr`" msgstr "" -#: c-api/typeobj.rst:74 c-api/typeobj.rst:368 +#: c-api/typeobj.rst:74 c-api/typeobj.rst:369 msgid ":c:type:`reprfunc`" msgstr "" @@ -219,7 +220,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_hash`" msgstr "" -#: c-api/typeobj.rst:404 +#: c-api/typeobj.rst:405 msgid ":c:type:`hashfunc`" msgstr "" @@ -231,7 +232,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_call`" msgstr "" -#: c-api/typeobj.rst:237 c-api/typeobj.rst:440 +#: c-api/typeobj.rst:237 c-api/typeobj.rst:441 msgid ":c:type:`ternaryfunc`" msgstr "" @@ -251,7 +252,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_getattro`" msgstr "" -#: c-api/typeobj.rst:381 +#: c-api/typeobj.rst:382 msgid ":c:type:`getattrofunc`" msgstr "" @@ -259,7 +260,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_setattro`" msgstr "" -#: c-api/typeobj.rst:386 +#: c-api/typeobj.rst:387 msgid ":c:type:`setattrofunc`" msgstr "" @@ -296,7 +297,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_traverse`" msgstr "" -#: c-api/typeobj.rst:350 +#: c-api/typeobj.rst:351 msgid ":c:type:`traverseproc`" msgstr "" @@ -304,7 +305,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: c-api/typeobj.rst:130 c-api/typeobj.rst:429 +#: c-api/typeobj.rst:130 c-api/typeobj.rst:430 msgid ":c:type:`inquiry`" msgstr "" @@ -312,7 +313,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_richcompare`" msgstr "" -#: c-api/typeobj.rst:406 +#: c-api/typeobj.rst:407 msgid ":c:type:`richcmpfunc`" msgstr "" @@ -328,7 +329,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_iter`" msgstr "" -#: c-api/typeobj.rst:412 +#: c-api/typeobj.rst:413 msgid ":c:type:`getiterfunc`" msgstr "" @@ -340,7 +341,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_iternext`" msgstr "" -#: c-api/typeobj.rst:414 +#: c-api/typeobj.rst:415 msgid ":c:type:`iternextfunc`" msgstr "" @@ -389,9 +390,9 @@ msgid ":c:member:`~PyTypeObject.tp_dict`" msgstr "" #: c-api/typeobj.rst:113 c-api/typeobj.rst:134 c-api/typeobj.rst:140 -#: c-api/typeobj.rst:346 c-api/typeobj.rst:368 c-api/typeobj.rst:381 -#: c-api/typeobj.rst:404 c-api/typeobj.rst:412 c-api/typeobj.rst:416 -#: c-api/typeobj.rst:431 c-api/typeobj.rst:440 c-api/typeobj.rst:446 +#: c-api/typeobj.rst:347 c-api/typeobj.rst:369 c-api/typeobj.rst:382 +#: c-api/typeobj.rst:405 c-api/typeobj.rst:413 c-api/typeobj.rst:417 +#: c-api/typeobj.rst:432 c-api/typeobj.rst:441 c-api/typeobj.rst:447 msgid ":c:type:`PyObject` *" msgstr "" @@ -403,7 +404,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_descr_get`" msgstr "" -#: c-api/typeobj.rst:392 +#: c-api/typeobj.rst:393 msgid ":c:type:`descrgetfunc`" msgstr "" @@ -415,7 +416,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_descr_set`" msgstr "" -#: c-api/typeobj.rst:398 +#: c-api/typeobj.rst:399 msgid ":c:type:`descrsetfunc`" msgstr "" @@ -431,7 +432,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_init`" msgstr "" -#: c-api/typeobj.rst:362 +#: c-api/typeobj.rst:363 msgid ":c:type:`initproc`" msgstr "" @@ -443,7 +444,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_alloc`" msgstr "" -#: c-api/typeobj.rst:341 +#: c-api/typeobj.rst:342 msgid ":c:type:`allocfunc`" msgstr "" @@ -451,7 +452,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_new`" msgstr "" -#: c-api/typeobj.rst:356 +#: c-api/typeobj.rst:357 msgid ":c:type:`newfunc`" msgstr "" @@ -463,7 +464,7 @@ msgstr "" msgid ":c:member:`~PyTypeObject.tp_free`" msgstr "" -#: c-api/typeobj.rst:348 +#: c-api/typeobj.rst:349 msgid ":c:type:`freefunc`" msgstr "" @@ -499,7 +500,7 @@ msgstr "" msgid "[:c:member:`~PyTypeObject.tp_subclasses`]" msgstr "" -#: c-api/typeobj.rst:138 c-api/typeobj.rst:348 +#: c-api/typeobj.rst:138 c-api/typeobj.rst:349 msgid "void *" msgstr "" @@ -583,10 +584,29 @@ msgstr "" msgid "**\"D\"**: default (if slot is set to ``NULL``)" msgstr "" +#: c-api/typeobj.rst:172 +msgid "" +"X - PyType_Ready sets this value if it is NULL\n" +"~ - PyType_Ready always sets this value (it should be NULL)\n" +"? - PyType_Ready may set this value depending on other slots\n" +"\n" +"Also see the inheritance column (\"I\")." +msgstr "" + #: c-api/typeobj.rst:180 msgid "**\"I\"**: inheritance" msgstr "" +#: c-api/typeobj.rst:182 +msgid "" +"X - type slot is inherited via *PyType_Ready* if defined with a *NULL* " +"value\n" +"% - the slots of the sub-struct are inherited individually\n" +"G - inherited, but only in combination with other slots; see the slot's " +"description\n" +"? - it's complicated; see the slot's description" +msgstr "" + #: c-api/typeobj.rst:189 msgid "" "Note that some slots are effectively inherited through the normal attribute " @@ -610,7 +630,7 @@ msgid ":c:member:`~PyAsyncMethods.am_await`" msgstr "" #: c-api/typeobj.rst:206 c-api/typeobj.rst:242 c-api/typeobj.rst:246 -#: c-api/typeobj.rst:277 c-api/typeobj.rst:291 c-api/typeobj.rst:431 +#: c-api/typeobj.rst:277 c-api/typeobj.rst:291 c-api/typeobj.rst:432 msgid ":c:type:`unaryfunc`" msgstr "" @@ -650,7 +670,7 @@ msgstr "" #: c-api/typeobj.rst:232 c-api/typeobj.rst:252 c-api/typeobj.rst:257 #: c-api/typeobj.rst:262 c-api/typeobj.rst:267 c-api/typeobj.rst:272 #: c-api/typeobj.rst:283 c-api/typeobj.rst:287 c-api/typeobj.rst:293 -#: c-api/typeobj.rst:302 c-api/typeobj.rst:322 c-api/typeobj.rst:435 +#: c-api/typeobj.rst:302 c-api/typeobj.rst:322 c-api/typeobj.rst:436 msgid ":c:type:`binaryfunc`" msgstr "" @@ -938,7 +958,7 @@ msgstr "" msgid ":c:member:`~PyMappingMethods.mp_length`" msgstr "" -#: c-api/typeobj.rst:309 c-api/typeobj.rst:416 +#: c-api/typeobj.rst:309 c-api/typeobj.rst:417 msgid ":c:type:`lenfunc`" msgstr "" @@ -958,7 +978,7 @@ msgstr "" msgid ":c:member:`~PyMappingMethods.mp_ass_subscript`" msgstr "" -#: c-api/typeobj.rst:462 +#: c-api/typeobj.rst:463 msgid ":c:type:`objobjargproc`" msgstr "" @@ -982,7 +1002,7 @@ msgstr "" msgid ":c:member:`~PySequenceMethods.sq_repeat`" msgstr "" -#: c-api/typeobj.rst:315 c-api/typeobj.rst:446 +#: c-api/typeobj.rst:315 c-api/typeobj.rst:447 msgid ":c:type:`ssizeargfunc`" msgstr "" @@ -998,7 +1018,7 @@ msgstr "" msgid ":c:member:`~PySequenceMethods.sq_ass_item`" msgstr "" -#: c-api/typeobj.rst:451 +#: c-api/typeobj.rst:452 msgid ":c:type:`ssizeobjargproc`" msgstr "" @@ -1010,7 +1030,7 @@ msgstr "" msgid ":c:member:`~PySequenceMethods.sq_contains`" msgstr "" -#: c-api/typeobj.rst:457 +#: c-api/typeobj.rst:458 msgid ":c:type:`objobjproc`" msgstr "" @@ -1034,6 +1054,10 @@ msgstr "" msgid ":c:func:`getbufferproc`" msgstr "" +#: c-api/typeobj.rst:328 +msgid "__buffer__" +msgstr "" + #: c-api/typeobj.rst:330 msgid ":c:member:`~PyBufferProcs.bf_releasebuffer`" msgstr "" @@ -1042,23 +1066,27 @@ msgstr "" msgid ":c:func:`releasebufferproc`" msgstr "" -#: c-api/typeobj.rst:336 +#: c-api/typeobj.rst:330 +msgid "__release_\\ buffer\\__" +msgstr "" + +#: c-api/typeobj.rst:337 msgid "slot typedefs" msgstr "" -#: c-api/typeobj.rst:339 +#: c-api/typeobj.rst:340 msgid "typedef" msgstr "" -#: c-api/typeobj.rst:339 +#: c-api/typeobj.rst:340 msgid "Parameter Types" msgstr "" -#: c-api/typeobj.rst:339 +#: c-api/typeobj.rst:340 msgid "Return Type" msgstr "" -#: c-api/typeobj.rst:348 c-api/typeobj.rst:424 +#: c-api/typeobj.rst:349 c-api/typeobj.rst:425 msgid "void" msgstr "" @@ -1066,16 +1094,16 @@ msgstr "" msgid ":c:type:`visitproc`" msgstr "" -#: c-api/typeobj.rst:350 c-api/typeobj.rst:375 c-api/typeobj.rst:398 -#: c-api/typeobj.rst:429 c-api/typeobj.rst:457 c-api/typeobj.rst:462 +#: c-api/typeobj.rst:351 c-api/typeobj.rst:376 c-api/typeobj.rst:399 +#: c-api/typeobj.rst:430 c-api/typeobj.rst:458 c-api/typeobj.rst:463 msgid "int" msgstr "" -#: c-api/typeobj.rst:404 +#: c-api/typeobj.rst:405 msgid "Py_hash_t" msgstr "" -#: c-api/typeobj.rst:418 +#: c-api/typeobj.rst:419 msgid ":c:type:`getbufferproc`" msgstr "" @@ -1083,30 +1111,129 @@ msgstr "" msgid ":c:type:`Py_buffer` *" msgstr "" -#: c-api/typeobj.rst:424 +#: c-api/typeobj.rst:425 msgid ":c:type:`releasebufferproc`" msgstr "" -#: c-api/typeobj.rst:469 +#: c-api/typeobj.rst:470 msgid "See :ref:`slot-typedefs` below for more detail." msgstr "" -#: c-api/typeobj.rst:473 +#: c-api/typeobj.rst:474 msgid "PyTypeObject Definition" msgstr "" -#: c-api/typeobj.rst:475 +#: c-api/typeobj.rst:476 msgid "" "The structure definition for :c:type:`PyTypeObject` can be found in :file:" -"`Include/object.h`. For convenience of reference, this repeats the " +"`Include/cpython/object.h`. For convenience of reference, this repeats the " "definition found there:" msgstr "" -#: c-api/typeobj.rst:485 +#: c-api/typeobj.rst:482 +msgid "" +"typedef struct _typeobject {\n" +" PyObject_VAR_HEAD\n" +" const char *tp_name; /* For printing, in format \".\" */\n" +" Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */\n" +"\n" +" /* Methods to implement standard operations */\n" +"\n" +" destructor tp_dealloc;\n" +" Py_ssize_t tp_vectorcall_offset;\n" +" getattrfunc tp_getattr;\n" +" setattrfunc tp_setattr;\n" +" PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)\n" +" or tp_reserved (Python 3) */\n" +" reprfunc tp_repr;\n" +"\n" +" /* Method suites for standard classes */\n" +"\n" +" PyNumberMethods *tp_as_number;\n" +" PySequenceMethods *tp_as_sequence;\n" +" PyMappingMethods *tp_as_mapping;\n" +"\n" +" /* More standard operations (here for binary compatibility) */\n" +"\n" +" hashfunc tp_hash;\n" +" ternaryfunc tp_call;\n" +" reprfunc tp_str;\n" +" getattrofunc tp_getattro;\n" +" setattrofunc tp_setattro;\n" +"\n" +" /* Functions to access object as input/output buffer */\n" +" PyBufferProcs *tp_as_buffer;\n" +"\n" +" /* Flags to define presence of optional/expanded features */\n" +" unsigned long tp_flags;\n" +"\n" +" const char *tp_doc; /* Documentation string */\n" +"\n" +" /* Assigned meaning in release 2.0 */\n" +" /* call function for all accessible objects */\n" +" traverseproc tp_traverse;\n" +"\n" +" /* delete references to contained objects */\n" +" inquiry tp_clear;\n" +"\n" +" /* Assigned meaning in release 2.1 */\n" +" /* rich comparisons */\n" +" richcmpfunc tp_richcompare;\n" +"\n" +" /* weak reference enabler */\n" +" Py_ssize_t tp_weaklistoffset;\n" +"\n" +" /* Iterators */\n" +" getiterfunc tp_iter;\n" +" iternextfunc tp_iternext;\n" +"\n" +" /* Attribute descriptor and subclassing stuff */\n" +" PyMethodDef *tp_methods;\n" +" PyMemberDef *tp_members;\n" +" PyGetSetDef *tp_getset;\n" +" // Strong reference on a heap type, borrowed reference on a static type\n" +" PyTypeObject *tp_base;\n" +" PyObject *tp_dict;\n" +" descrgetfunc tp_descr_get;\n" +" descrsetfunc tp_descr_set;\n" +" Py_ssize_t tp_dictoffset;\n" +" initproc tp_init;\n" +" allocfunc tp_alloc;\n" +" newfunc tp_new;\n" +" freefunc tp_free; /* Low-level free-memory routine */\n" +" inquiry tp_is_gc; /* For PyObject_IS_GC */\n" +" PyObject *tp_bases;\n" +" PyObject *tp_mro; /* method resolution order */\n" +" PyObject *tp_cache; /* no longer used */\n" +" void *tp_subclasses; /* for static builtin types this is an index */\n" +" PyObject *tp_weaklist; /* not used for static builtin types */\n" +" destructor tp_del;\n" +"\n" +" /* Type attribute cache version tag. Added in version 2.6.\n" +" * If zero, the cache is invalid and must be initialized.\n" +" */\n" +" unsigned int tp_version_tag;\n" +"\n" +" destructor tp_finalize;\n" +" vectorcallfunc tp_vectorcall;\n" +"\n" +" /* bitset of which type-watchers care about this type */\n" +" unsigned char tp_watched;\n" +"\n" +" /* Number of tp_version_tag values used.\n" +" * Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is\n" +" * disabled for this type (e.g. due to custom MRO entries).\n" +" * Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).\n" +" */\n" +" uint16_t tp_versions_used;\n" +"} PyTypeObject;\n" +msgstr "" + +#: c-api/typeobj.rst:486 msgid "PyObject Slots" msgstr "" -#: c-api/typeobj.rst:487 +#: c-api/typeobj.rst:488 msgid "" "The type object structure extends the :c:type:`PyVarObject` structure. The :" "c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :" @@ -1116,9 +1243,13 @@ msgid "" "the :c:member:`~PyVarObject.ob_size` field." msgstr "" -#: c-api/typeobj.rst:496 +#: c-api/typeobj.rst:495 +msgid ":c:member:`PyObject.ob_refcnt`" +msgstr "" + +#: c-api/typeobj.rst:497 msgid "" -"This is the type object's reference count, initialized to ``1`` by the " +"The type object's reference count is initialized to ``1`` by the " "``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " "objects `, the type's instances (objects whose :c:member:" "`~PyObject.ob_type` points back to the type) do *not* count as references. " @@ -1126,25 +1257,29 @@ msgid "" "instances *do* count as references." msgstr "" -#: c-api/typeobj.rst:526 c-api/typeobj.rst:562 c-api/typeobj.rst:649 -#: c-api/typeobj.rst:749 c-api/typeobj.rst:783 c-api/typeobj.rst:825 -#: c-api/typeobj.rst:854 c-api/typeobj.rst:899 c-api/typeobj.rst:937 -#: c-api/typeobj.rst:984 c-api/typeobj.rst:1019 c-api/typeobj.rst:1068 -#: c-api/typeobj.rst:1088 c-api/typeobj.rst:1120 c-api/typeobj.rst:1158 -#: c-api/typeobj.rst:1193 c-api/typeobj.rst:1258 c-api/typeobj.rst:1307 -#: c-api/typeobj.rst:1355 c-api/typeobj.rst:1491 c-api/typeobj.rst:1588 -#: c-api/typeobj.rst:1636 c-api/typeobj.rst:1664 c-api/typeobj.rst:1708 -#: c-api/typeobj.rst:1766 c-api/typeobj.rst:1813 c-api/typeobj.rst:1874 -#: c-api/typeobj.rst:1937 c-api/typeobj.rst:1997 c-api/typeobj.rst:2020 -#: c-api/typeobj.rst:2054 c-api/typeobj.rst:2114 c-api/typeobj.rst:2137 +#: c-api/typeobj.rst:527 c-api/typeobj.rst:587 c-api/typeobj.rst:809 +#: c-api/typeobj.rst:873 c-api/typeobj.rst:910 c-api/typeobj.rst:953 +#: c-api/typeobj.rst:977 c-api/typeobj.rst:1036 c-api/typeobj.rst:1081 +#: c-api/typeobj.rst:1128 c-api/typeobj.rst:1184 c-api/typeobj.rst:1205 +#: c-api/typeobj.rst:1229 c-api/typeobj.rst:1270 c-api/typeobj.rst:1301 +#: c-api/typeobj.rst:1367 c-api/typeobj.rst:1407 c-api/typeobj.rst:1459 +#: c-api/typeobj.rst:1580 c-api/typeobj.rst:1793 c-api/typeobj.rst:1856 +#: c-api/typeobj.rst:1896 c-api/typeobj.rst:1929 c-api/typeobj.rst:1993 +#: c-api/typeobj.rst:2041 c-api/typeobj.rst:2116 c-api/typeobj.rst:2177 +#: c-api/typeobj.rst:2242 c-api/typeobj.rst:2285 c-api/typeobj.rst:2312 +#: c-api/typeobj.rst:2345 c-api/typeobj.rst:2549 msgid "**Inheritance:**" msgstr "" -#: c-api/typeobj.rst:564 c-api/typeobj.rst:608 +#: c-api/typeobj.rst:545 c-api/typeobj.rst:589 msgid "This field is not inherited by subtypes." msgstr "" -#: c-api/typeobj.rst:510 +#: c-api/typeobj.rst:509 +msgid ":c:member:`PyObject.ob_type`" +msgstr "" + +#: c-api/typeobj.rst:511 msgid "" "This is the type's type, in other words its metatype. It is initialized by " "the argument to the ``PyObject_HEAD_INIT`` macro, and its value should " @@ -1156,7 +1291,11 @@ msgid "" "doing anything else. This is typically done like this::" msgstr "" -#: c-api/typeobj.rst:521 +#: c-api/typeobj.rst:520 +msgid "Foo_Type.ob_type = &PyType_Type;" +msgstr "" + +#: c-api/typeobj.rst:522 msgid "" "This should be done before any instances of the type are created. :c:func:" "`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if " @@ -1164,54 +1303,35 @@ msgid "" "class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" -#: c-api/typeobj.rst:710 c-api/typeobj.rst:919 c-api/typeobj.rst:1615 -#: c-api/typeobj.rst:1768 c-api/typeobj.rst:1859 c-api/typeobj.rst:2116 +#: c-api/typeobj.rst:811 c-api/typeobj.rst:1038 c-api/typeobj.rst:1858 +#: c-api/typeobj.rst:2023 c-api/typeobj.rst:2118 c-api/typeobj.rst:2491 msgid "This field is inherited by subtypes." msgstr "" -#: c-api/typeobj.rst:534 -msgid "" -"These fields are only present when the macro ``Py_TRACE_REFS`` is defined " -"(see the :option:`configure --with-trace-refs option <--with-trace-refs>`)." -msgstr "" - -#: c-api/typeobj.rst:537 -msgid "" -"Their initialization to ``NULL`` is taken care of by the " -"``PyObject_HEAD_INIT`` macro. For :ref:`statically allocated objects " -"`, these fields always remain ``NULL``. For :ref:`dynamically " -"allocated objects `, these two fields are used to link the " -"object into a doubly linked list of *all* live objects on the heap." -msgstr "" - -#: c-api/typeobj.rst:543 -msgid "" -"This could be used for various debugging purposes; currently the only uses " -"are the :func:`sys.getobjects` function and to print the objects that are " -"still alive at the end of a run when the environment variable :envvar:" -"`PYTHONDUMPREFS` is set." -msgstr "" - -#: c-api/typeobj.rst:550 -msgid "These fields are not inherited by subtypes." +#: c-api/typeobj.rst:533 +msgid "PyVarObject Slots" msgstr "" -#: c-api/typeobj.rst:554 -msgid "PyVarObject Slots" +#: c-api/typeobj.rst:535 +msgid ":c:member:`PyVarObject.ob_size`" msgstr "" -#: c-api/typeobj.rst:558 +#: c-api/typeobj.rst:537 msgid "" "For :ref:`statically allocated type objects `, this should be " "initialized to zero. For :ref:`dynamically allocated type objects `, this field has a special internal meaning." msgstr "" -#: c-api/typeobj.rst:568 +#: c-api/typeobj.rst:541 +msgid "This field should be accessed using the :c:func:`Py_SIZE()` macro." +msgstr "" + +#: c-api/typeobj.rst:549 msgid "PyTypeObject Slots" msgstr "" -#: c-api/typeobj.rst:570 +#: c-api/typeobj.rst:551 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " @@ -1219,7 +1339,7 @@ msgid "" "`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" msgstr "" -#: c-api/typeobj.rst:577 +#: c-api/typeobj.rst:558 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " @@ -1231,167 +1351,365 @@ msgid "" "tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -#: c-api/typeobj.rst:585 +#: c-api/typeobj.rst:566 msgid "" "For :ref:`dynamically allocated type objects `, this should just " "be the type name, and the module name explicitly stored in the type dict as " "the value for key ``'__module__'``." msgstr "" -#: c-api/typeobj.rst:590 +#: c-api/typeobj.rst:571 msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " -"accessible as the :attr:`__module__` attribute, and everything after the " -"last dot is made accessible as the :attr:`~definition.__name__` attribute." +"accessible as the :attr:`~type.__module__` attribute, and everything after " +"the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" -#: c-api/typeobj.rst:596 +#: c-api/typeobj.rst:577 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~definition.__name__` attribute, and the :attr:" -"`__module__` attribute is undefined (unless explicitly set in the " +"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" +"`~type.__module__` attribute is undefined (unless explicitly set in the " "dictionary, as explained above). This means your type will be impossible to " "pickle. Additionally, it will not be listed in module documentations " "created with pydoc." msgstr "" -#: c-api/typeobj.rst:602 +#: c-api/typeobj.rst:583 msgid "" "This field must not be ``NULL``. It is the only required field in :c:func:" "`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." "tp_itemsize`)." msgstr "" -#: c-api/typeobj.rst:614 +#: c-api/typeobj.rst:595 msgid "" "These fields allow calculating the size in bytes of instances of the type." msgstr "" -#: c-api/typeobj.rst:616 +#: c-api/typeobj.rst:597 msgid "" "There are two kinds of types: types with fixed-length instances have a zero :" -"c:member:`~PyTypeObject.tp_itemsize` field, types with variable-length " -"instances have a non-zero :c:member:`~PyTypeObject.tp_itemsize` field. For " -"a type with fixed-length instances, all instances have the same size, given " -"in :c:member:`~PyTypeObject.tp_basicsize`." +"c:member:`!tp_itemsize` field, types with variable-length instances have a " +"non-zero :c:member:`!tp_itemsize` field. For a type with fixed-length " +"instances, all instances have the same size, given in :c:member:`!" +"tp_basicsize`. (Exceptions to this rule can be made using :c:func:" +"`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" -#: c-api/typeobj.rst:621 +#: c-api/typeobj.rst:604 msgid "" "For a type with variable-length instances, the instances must have an :c:" -"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:" -"`~PyTypeObject.tp_basicsize` plus N times :c:member:`~PyTypeObject." -"tp_itemsize`, where N is the \"length\" of the object. The value of N is " -"typically stored in the instance's :c:member:`~PyVarObject.ob_size` field. " -"There are exceptions: for example, ints use a negative :c:member:" -"`~PyVarObject.ob_size` to indicate a negative number, and N is " -"``abs(ob_size)`` there. Also, the presence of an :c:member:`~PyVarObject." -"ob_size` field in the instance layout doesn't mean that the instance " -"structure is variable-length (for example, the structure for the list type " -"has fixed-length instances, yet those instances have a meaningful :c:member:" -"`~PyVarObject.ob_size` field)." +"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:`!" +"tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N is the " +"\"length\" of the object." +msgstr "" + +#: c-api/typeobj.rst:609 +msgid "" +"Functions like :c:func:`PyObject_NewVar` will take the value of N as an " +"argument, and store in the instance's :c:member:`~PyVarObject.ob_size` " +"field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " +"used for other purposes. For example, :py:type:`int` instances use the bits " +"of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " +"underlying storage and its size should be accessed using :c:func:" +"`PyLong_Export`." +msgstr "" + +#: c-api/typeobj.rst:619 +msgid "" +"The :c:member:`~PyVarObject.ob_size` field should be accessed using the :c:" +"func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." +msgstr "" + +#: c-api/typeobj.rst:622 +msgid "" +"Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " +"instance layout doesn't mean that the instance structure is variable-length. " +"For example, the :py:type:`list` type has fixed-length instances, yet those " +"instances have a :c:member:`~PyVarObject.ob_size` field. (As with :py:type:" +"`int`, avoid reading lists' :c:member:`!ob_size` directly. Call :c:func:" +"`PyList_Size` instead.)" +msgstr "" + +#: c-api/typeobj.rst:629 +msgid "" +"The :c:member:`!tp_basicsize` includes size needed for data of the type's :c:" +"member:`~PyTypeObject.tp_base`, plus any extra data needed by each instance." +msgstr "" + +#: c-api/typeobj.rst:633 +msgid "" +"The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " +"operator on the struct used to declare the instance layout. This struct must " +"include the struct used to declare the base type. In other words, :c:member:" +"`!tp_basicsize` must be greater than or equal to the base's :c:member:`!" +"tp_basicsize`." msgstr "" -#: c-api/typeobj.rst:632 +#: c-api/typeobj.rst:639 msgid "" -"The basic size includes the fields in the instance declared by the macro :c:" -"macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD` (whichever is used to " -"declare the instance struct) and this in turn includes the :c:member:" -"`~PyObject._ob_prev` and :c:member:`~PyObject._ob_next` fields if they are " -"present. This means that the only correct way to get an initializer for " -"the :c:member:`~PyTypeObject.tp_basicsize` is to use the ``sizeof`` operator " -"on the struct used to declare the instance layout. The basic size does not " -"include the GC header size." +"Since every type is a subtype of :py:type:`object`, this struct must " +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on whether :c:" +"member:`~PyVarObject.ob_size` should be included). These are usually defined " +"by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD`, " +"respectively." msgstr "" -#: c-api/typeobj.rst:640 +#: c-api/typeobj.rst:645 msgid "" -"A note about alignment: if the variable items require a particular " -"alignment, this should be taken care of by the value of :c:member:" -"`~PyTypeObject.tp_basicsize`. Example: suppose a type implements an array " -"of ``double``. :c:member:`~PyTypeObject.tp_itemsize` is ``sizeof(double)``. " -"It is the programmer's responsibility that :c:member:`~PyTypeObject." -"tp_basicsize` is a multiple of ``sizeof(double)`` (assuming this is the " -"alignment requirement for ``double``)." +"The basic size does not include the GC header size, as that header is not " +"part of :c:macro:`PyObject_HEAD`." msgstr "" -#: c-api/typeobj.rst:647 +#: c-api/typeobj.rst:648 msgid "" -"For any type with variable-length instances, this field must not be ``NULL``." +"For cases where struct used to declare the base type is unknown, see :c:" +"member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." msgstr "" #: c-api/typeobj.rst:651 +msgid "Notes about alignment:" +msgstr "" + +#: c-api/typeobj.rst:653 +msgid "" +":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When " +"using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as " +"recommended, the compiler ensures this. When not using a C ``struct``, or " +"when using compiler extensions like ``__attribute__((packed))``, it is up to " +"you." +msgstr "" + +#: c-api/typeobj.rst:658 +msgid "" +"If the variable items require a particular alignment, :c:member:`!" +"tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that " +"alignment. For example, if a type's variable part stores a ``double``, it is " +"your responsibility that both fields are a multiple of ``_Alignof(double)``." +msgstr "" + +#: c-api/typeobj.rst:667 +msgid "" +"These fields are inherited separately by subtypes. (That is, if the field is " +"set to zero, :c:func:`PyType_Ready` will copy the value from the base type, " +"indicating that the instances do not need additional storage.)" +msgstr "" + +#: c-api/typeobj.rst:672 +msgid "" +"If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is " +"generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a " +"different non-zero value in a subtype (though this depends on the " +"implementation of the base type)." +msgstr "" + +#: c-api/typeobj.rst:681 +msgid "" +"A pointer to the instance destructor function. The function signature is::" +msgstr "" + +#: c-api/typeobj.rst:683 +msgid "void tp_dealloc(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:685 +msgid "" +"The destructor function should remove all references which the instance owns " +"(e.g., call :c:func:`Py_CLEAR`), free all memory buffers owned by the " +"instance, and call the type's :c:member:`~PyTypeObject.tp_free` function to " +"free the object itself." +msgstr "" + +#: c-api/typeobj.rst:690 +msgid "" +"If you may call functions that may set the error indicator, you must use :c:" +"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` to " +"ensure you don't clobber a preexisting error indicator (the deallocation " +"could have occurred while processing a different error):" +msgstr "" + +#: c-api/typeobj.rst:695 +msgid "" +"static void\n" +"foo_dealloc(foo_object *self)\n" +"{\n" +" PyObject *et, *ev, *etb;\n" +" PyObject *exc = PyErr_GetRaisedException();\n" +" ...\n" +" PyErr_SetRaisedException(exc);\n" +"}" +msgstr "" + +#: c-api/typeobj.rst:706 +msgid "" +"The dealloc handler itself must not raise an exception; if it hits an error " +"case it should call :c:func:`PyErr_FormatUnraisable` to log (and clear) an " +"unraisable exception." +msgstr "" + +#: c-api/typeobj.rst:710 +msgid "No guarantees are made about when an object is destroyed, except:" +msgstr "" + +#: c-api/typeobj.rst:712 +msgid "" +"Python will destroy an object immediately or some time after the final " +"reference to the object is deleted, unless its finalizer (:c:member:" +"`~PyTypeObject.tp_finalize`) subsequently resurrects the object." +msgstr "" + +#: c-api/typeobj.rst:716 +msgid "" +"An object will not be destroyed while it is being automatically finalized (:" +"c:member:`~PyTypeObject.tp_finalize`) or automatically cleared (:c:member:" +"`~PyTypeObject.tp_clear`)." +msgstr "" + +#: c-api/typeobj.rst:720 msgid "" -"These fields are inherited separately by subtypes. If the base type has a " -"non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is generally not safe to " -"set :c:member:`~PyTypeObject.tp_itemsize` to a different non-zero value in a " -"subtype (though this depends on the implementation of the base type)." +"CPython currently destroys an object immediately from :c:func:`Py_DECREF` " +"when the new reference count is zero, but this may change in a future " +"version." msgstr "" -#: c-api/typeobj.rst:659 +#: c-api/typeobj.rst:724 msgid "" -"A pointer to the instance destructor function. This function must be " -"defined unless the type guarantees that its instances will never be " -"deallocated (as is the case for the singletons ``None`` and ``Ellipsis``). " -"The function signature is::" +"It is recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the " +"beginning of :c:member:`!tp_dealloc` to guarantee that the object is always " +"finalized before destruction." msgstr "" -#: c-api/typeobj.rst:665 +#: c-api/typeobj.rst:728 msgid "" -"The destructor function is called by the :c:func:`Py_DECREF` and :c:func:" -"`Py_XDECREF` macros when the new reference count is zero. At this point, " -"the instance is still in existence, but there are no references to it. The " -"destructor function should free all references which the instance owns, free " -"all memory buffers owned by the instance (using the freeing function " -"corresponding to the allocation function used to allocate the buffer), and " -"call the type's :c:member:`~PyTypeObject.tp_free` function. If the type is " -"not subtypable (doesn't have the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit " -"set), it is permissible to call the object deallocator directly instead of " -"via :c:member:`~PyTypeObject.tp_free`. The object deallocator should be the " -"one used to allocate the instance; this is normally :c:func:`PyObject_Del` " -"if the instance was allocated using :c:macro:`PyObject_New` or :c:macro:" -"`PyObject_NewVar`, or :c:func:`PyObject_GC_Del` if the instance was " -"allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." +"If the type supports garbage collection (the :c:macro:`Py_TPFLAGS_HAVE_GC` " +"flag is set), the destructor should call :c:func:`PyObject_GC_UnTrack` " +"before clearing any member fields." msgstr "" -#: c-api/typeobj.rst:680 +#: c-api/typeobj.rst:732 msgid "" -"If the type supports garbage collection (has the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should call :c:func:" -"`PyObject_GC_UnTrack` before clearing any member fields." +"It is permissible to call :c:member:`~PyTypeObject.tp_clear` from :c:member:" +"`!tp_dealloc` to reduce code duplication and to guarantee that the object is " +"always cleared before destruction. Beware that :c:member:`!tp_clear` might " +"have already been called." msgstr "" -#: c-api/typeobj.rst:692 +#: c-api/typeobj.rst:737 msgid "" -"Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " +"If the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " "deallocator should release the owned reference to its type object (via :c:" -"func:`Py_DECREF`) after calling the type deallocator. In order to avoid " -"dangling pointers, the recommended way to achieve this is:" +"func:`Py_DECREF`) after calling the type deallocator. See the example code " +"below.::" +msgstr "" + +#: c-api/typeobj.rst:742 +msgid "" +"static void\n" +"foo_dealloc(PyObject *op)\n" +"{\n" +" foo_object *self = (foo_object *) op;\n" +" PyObject_GC_UnTrack(self);\n" +" Py_CLEAR(self->ref);\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" msgstr "" -#: c-api/typeobj.rst:715 +#: c-api/typeobj.rst:751 +msgid "" +":c:member:`!tp_dealloc` must leave the exception status unchanged. If it " +"needs to call something that might raise an exception, the exception state " +"must be backed up first and restored later (after logging any exceptions " +"with :c:func:`PyErr_WriteUnraisable`)." +msgstr "" + +#: c-api/typeobj.rst:756 +msgid "Example::" +msgstr "" + +#: c-api/typeobj.rst:758 +msgid "" +"static void\n" +"foo_dealloc(PyObject *self)\n" +"{\n" +" PyObject *exc = PyErr_GetRaisedException();\n" +"\n" +" if (PyObject_CallFinalizerFromDealloc(self) < 0) {\n" +" // self was resurrected.\n" +" goto done;\n" +" }\n" +"\n" +" PyTypeObject *tp = Py_TYPE(self);\n" +"\n" +" if (tp->tp_flags & Py_TPFLAGS_HAVE_GC) {\n" +" PyObject_GC_UnTrack(self);\n" +" }\n" +"\n" +" // Optional, but convenient to avoid code duplication.\n" +" if (tp->tp_clear && tp->tp_clear(self) < 0) {\n" +" PyErr_WriteUnraisable(self);\n" +" }\n" +"\n" +" // Any additional destruction goes here.\n" +"\n" +" tp->tp_free(self);\n" +" self = NULL; // In case PyErr_WriteUnraisable() is called below.\n" +"\n" +" if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" +" Py_CLEAR(tp);\n" +" }\n" +"\n" +"done:\n" +" // Optional, if something was called that might have raised an\n" +" // exception.\n" +" if (PyErr_Occurred()) {\n" +" PyErr_WriteUnraisable(self);\n" +" }\n" +" PyErr_SetRaisedException(exc);\n" +"}" +msgstr "" + +#: c-api/typeobj.rst:797 +msgid "" +":c:member:`!tp_dealloc` may be called from any Python thread, not just the " +"thread which created the object (if the object becomes part of a refcount " +"cycle, that cycle might be collected by a garbage collection on any " +"thread). This is not a problem for Python API calls, since the thread on " +"which :c:member:`!tp_dealloc` is called with an :term:`attached thread " +"state`. However, if the object being destroyed in turn destroys objects " +"from some other C library, care should be taken to ensure that destroying " +"those objects on the thread which called :c:member:`!tp_dealloc` will not " +"violate any assumptions of the library." +msgstr "" + +#: c-api/typeobj.rst:1737 c-api/typeobj.rst:2504 +msgid "" +":ref:`life-cycle` for details about how this slot relates to other slots." +msgstr "" + +#: c-api/typeobj.rst:820 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: c-api/typeobj.rst:720 +#: c-api/typeobj.rst:825 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: c-api/typeobj.rst:724 +#: c-api/typeobj.rst:829 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: c-api/typeobj.rst:728 +#: c-api/typeobj.rst:833 msgid "" "Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" "`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " @@ -1399,13 +1717,13 @@ msgid "" "`PyVectorcall_Call`." msgstr "" -#: c-api/typeobj.rst:735 +#: c-api/typeobj.rst:840 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: c-api/typeobj.rst:741 +#: c-api/typeobj.rst:846 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " "` to implement the vectorcall protocol. When a user sets :attr:" @@ -1415,7 +1733,7 @@ msgid "" "`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: c-api/typeobj.rst:751 +#: c-api/typeobj.rst:856 msgid "" "This field is always inherited. However, the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " @@ -1423,11 +1741,11 @@ msgid "" "func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: c-api/typeobj.rst:760 +#: c-api/typeobj.rst:867 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: c-api/typeobj.rst:762 +#: c-api/typeobj.rst:869 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1435,13 +1753,13 @@ msgid "" "attribute name." msgstr "" -#: c-api/typeobj.rst:960 +#: c-api/typeobj.rst:1083 msgid "" "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." "tp_getattro`" msgstr "" -#: c-api/typeobj.rst:770 +#: c-api/typeobj.rst:877 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1450,12 +1768,12 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: c-api/typeobj.rst:973 +#: c-api/typeobj.rst:1098 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: c-api/typeobj.rst:779 +#: c-api/typeobj.rst:888 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1463,13 +1781,13 @@ msgid "" "attribute name." msgstr "" -#: c-api/typeobj.rst:986 +#: c-api/typeobj.rst:1111 msgid "" "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." "tp_setattro`" msgstr "" -#: c-api/typeobj.rst:787 +#: c-api/typeobj.rst:896 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1478,34 +1796,38 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: c-api/typeobj.rst:794 +#: c-api/typeobj.rst:903 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: c-api/typeobj.rst:798 +#: c-api/typeobj.rst:907 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: c-api/typeobj.rst:803 +#: c-api/typeobj.rst:912 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: c-api/typeobj.rst:811 +#: c-api/typeobj.rst:922 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`repr`." msgstr "" -#: c-api/typeobj.rst:814 +#: c-api/typeobj.rst:925 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: c-api/typeobj.rst:818 +#: c-api/typeobj.rst:927 +msgid "PyObject *tp_repr(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:929 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1514,76 +1836,80 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: c-api/typeobj.rst:941 c-api/typeobj.rst:992 c-api/typeobj.rst:1561 -#: c-api/typeobj.rst:1712 c-api/typeobj.rst:1820 c-api/typeobj.rst:1879 -#: c-api/typeobj.rst:1942 c-api/typeobj.rst:1973 +#: c-api/typeobj.rst:1021 c-api/typeobj.rst:1089 c-api/typeobj.rst:1159 +#: c-api/typeobj.rst:1836 c-api/typeobj.rst:1998 c-api/typeobj.rst:2120 +#: c-api/typeobj.rst:2183 c-api/typeobj.rst:2246 msgid "**Default:**" msgstr "" -#: c-api/typeobj.rst:831 +#: c-api/typeobj.rst:942 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: c-api/typeobj.rst:838 +#: c-api/typeobj.rst:949 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: c-api/typeobj.rst:844 +#: c-api/typeobj.rst:955 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: c-api/typeobj.rst:850 +#: c-api/typeobj.rst:961 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: c-api/typeobj.rst:856 +#: c-api/typeobj.rst:967 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: c-api/typeobj.rst:862 +#: c-api/typeobj.rst:973 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: c-api/typeobj.rst:868 +#: c-api/typeobj.rst:979 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: c-api/typeobj.rst:876 +#: c-api/typeobj.rst:989 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`hash`." msgstr "" -#: c-api/typeobj.rst:879 +#: c-api/typeobj.rst:992 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: c-api/typeobj.rst:883 +#: c-api/typeobj.rst:994 +msgid "Py_hash_t tp_hash(PyObject *);" +msgstr "" + +#: c-api/typeobj.rst:996 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: c-api/typeobj.rst:887 +#: c-api/typeobj.rst:1000 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " "is not set), an attempt to take the hash of the object raises :exc:" @@ -1591,7 +1917,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: c-api/typeobj.rst:891 +#: c-api/typeobj.rst:1004 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " @@ -1602,13 +1928,13 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: c-api/typeobj.rst:1554 +#: c-api/typeobj.rst:1795 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" msgstr "" -#: c-api/typeobj.rst:903 +#: c-api/typeobj.rst:1016 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." @@ -1617,14 +1943,22 @@ msgid "" "are both ``NULL``." msgstr "" -#: c-api/typeobj.rst:911 +#: c-api/typeobj.rst:1023 +msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." +msgstr "" + +#: c-api/typeobj.rst:1030 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: c-api/typeobj.rst:924 +#: c-api/typeobj.rst:1034 +msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" +msgstr "" + +#: c-api/typeobj.rst:1045 msgid "" "An optional pointer to a function that implements the built-in operation :" "func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " @@ -1633,11 +1967,15 @@ msgid "" "this handler.)" msgstr "" -#: c-api/typeobj.rst:929 +#: c-api/typeobj.rst:1050 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: c-api/typeobj.rst:933 +#: c-api/typeobj.rst:1052 +msgid "PyObject *tp_str(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:1054 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1645,28 +1983,32 @@ msgid "" "function." msgstr "" -#: c-api/typeobj.rst:943 +#: c-api/typeobj.rst:1064 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: c-api/typeobj.rst:949 +#: c-api/typeobj.rst:1072 msgid "An optional pointer to the get-attribute function." msgstr "" -#: c-api/typeobj.rst:951 +#: c-api/typeobj.rst:1074 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: c-api/typeobj.rst:955 +#: c-api/typeobj.rst:1076 +msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" +msgstr "" + +#: c-api/typeobj.rst:1078 msgid "" "It is usually convenient to set this field to :c:func:" "`PyObject_GenericGetAttr`, which implements the normal way of looking for " "object attributes." msgstr "" -#: c-api/typeobj.rst:962 +#: c-api/typeobj.rst:1085 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1675,15 +2017,19 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: c-api/typeobj.rst:968 +#: c-api/typeobj.rst:1091 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: c-api/typeobj.rst:975 +#: c-api/typeobj.rst:1100 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: c-api/typeobj.rst:979 +#: c-api/typeobj.rst:1102 +msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" +msgstr "" + +#: c-api/typeobj.rst:1104 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " "supported. It is usually convenient to set this field to :c:func:" @@ -1691,7 +2037,7 @@ msgid "" "attributes." msgstr "" -#: c-api/typeobj.rst:988 +#: c-api/typeobj.rst:1113 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1700,24 +2046,24 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: c-api/typeobj.rst:994 +#: c-api/typeobj.rst:1119 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: c-api/typeobj.rst:999 +#: c-api/typeobj.rst:1124 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: c-api/typeobj.rst:1005 +#: c-api/typeobj.rst:1130 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: c-api/typeobj.rst:1011 +#: c-api/typeobj.rst:1136 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " @@ -1729,7 +2075,7 @@ msgid "" "accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" -#: c-api/typeobj.rst:1021 +#: c-api/typeobj.rst:1146 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -1741,21 +2087,20 @@ msgid "" "and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:" "`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " -"the subtype exist and have ``NULL`` values. .. XXX are most flag bits " -"*really* inherited individually?" +"the subtype exist and have ``NULL`` values." msgstr "" -#: c-api/typeobj.rst:1035 +#: c-api/typeobj.rst:1161 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." msgstr "" -#: c-api/typeobj.rst:1038 +#: c-api/typeobj.rst:1164 msgid "**Bit Masks:**" msgstr "" -#: c-api/typeobj.rst:1042 +#: c-api/typeobj.rst:1168 msgid "" "The following bit masks are currently defined; these can be ORed together " "using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." @@ -1764,7 +2109,7 @@ msgid "" "zero." msgstr "" -#: c-api/typeobj.rst:1049 +#: c-api/typeobj.rst:1175 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -1772,49 +2117,51 @@ msgid "" "a reference to the type, and the type object is INCREF'ed when a new " "instance is created, and DECREF'ed when an instance is destroyed (this does " "not apply to instances of subtypes; only the type referenced by the " -"instance's ob_type gets INCREF'ed or DECREF'ed)." +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:" +"`support garbage collection ` as they can form a " +"reference cycle with their own module object." msgstr "" -#: c-api/typeobj.rst:1070 c-api/typeobj.rst:1090 c-api/typeobj.rst:1122 +#: c-api/typeobj.rst:1197 c-api/typeobj.rst:1217 c-api/typeobj.rst:1249 msgid "???" msgstr "" -#: c-api/typeobj.rst:1064 +#: c-api/typeobj.rst:1191 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: c-api/typeobj.rst:1075 +#: c-api/typeobj.rst:1202 msgid "" "This bit is set when the type object has been fully initialized by :c:func:" "`PyType_Ready`." msgstr "" -#: c-api/typeobj.rst:1085 +#: c-api/typeobj.rst:1212 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: c-api/typeobj.rst:1095 +#: c-api/typeobj.rst:1222 msgid "" "This bit is set when the object supports garbage collection. If this bit is " -"set, instances must be created using :c:macro:`PyObject_GC_New` and " -"destroyed using :c:func:`PyObject_GC_Del`. More information in section :ref:" -"`supporting-cycle-detection`. This bit also implies that the GC-related " -"fields :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject." -"tp_clear` are present in the type object." +"set, memory for new instances (see :c:member:`~PyTypeObject.tp_alloc`) must " +"be allocated using :c:macro:`PyObject_GC_New` or :c:func:" +"`PyType_GenericAlloc` and deallocated (see :c:member:`~PyTypeObject." +"tp_free`) using :c:func:`PyObject_GC_Del`. More information in section :ref:" +"`supporting-cycle-detection`." msgstr "" -#: c-api/typeobj.rst:1425 c-api/typeobj.rst:1493 +#: c-api/typeobj.rst:1582 c-api/typeobj.rst:1728 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: c-api/typeobj.rst:1106 +#: c-api/typeobj.rst:1233 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" "member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " @@ -1824,192 +2171,200 @@ msgid "" "values." msgstr "" -#: c-api/typeobj.rst:1116 +#: c-api/typeobj.rst:1243 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: c-api/typeobj.rst:1127 +#: c-api/typeobj.rst:1254 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: c-api/typeobj.rst:1129 +#: c-api/typeobj.rst:1256 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: c-api/typeobj.rst:1131 +#: c-api/typeobj.rst:1258 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: c-api/typeobj.rst:1134 +#: c-api/typeobj.rst:1261 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: c-api/typeobj.rst:1137 +#: c-api/typeobj.rst:1264 msgid "" "This flag enables an optimization for typical method calls like ``obj." "meth()``: it avoids creating a temporary \"bound method\" object for ``obj." "meth``." msgstr "" -#: c-api/typeobj.rst:1145 +#: c-api/typeobj.rst:1272 msgid "" "This flag is never inherited by types without the :c:macro:" "`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " "whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: c-api/typeobj.rst:1151 +#: c-api/typeobj.rst:1278 msgid "" -"This bit indicates that instances of the class have a ``__dict__`` " -"attribute, and that the space for the dictionary is managed by the VM." +"This bit indicates that instances of the class have a :attr:`~object." +"__dict__` attribute, and that the space for the dictionary is managed by the " +"VM." msgstr "" -#: c-api/typeobj.rst:1154 +#: c-api/typeobj.rst:1281 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: c-api/typeobj.rst:1160 +#: c-api/typeobj.rst:1283 +msgid "" +"The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " +"its clear function must call :c:func:`PyObject_ClearManagedDict`." +msgstr "" + +#: c-api/typeobj.rst:1290 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: c-api/typeobj.rst:1166 +#: c-api/typeobj.rst:1296 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: c-api/typeobj.rst:1173 +#: c-api/typeobj.rst:1303 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject." "tp_weaklistoffset` field is set in a superclass." msgstr "" -#: c-api/typeobj.rst:1179 +#: c-api/typeobj.rst:1309 msgid "" "Only usable with variable-size types, i.e. ones with non-zero :c:member:" "`~PyTypeObject.tp_itemsize`." msgstr "" -#: c-api/typeobj.rst:1182 +#: c-api/typeobj.rst:1312 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: c-api/typeobj.rst:1187 +#: c-api/typeobj.rst:1317 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: c-api/typeobj.rst:1195 +#: c-api/typeobj.rst:1325 msgid "This flag is inherited." msgstr "" -#: c-api/typeobj.rst:1209 +#: c-api/typeobj.rst:1339 msgid "" -"These flags are used by functions such as :c:func:`PyLong_Check` to quickly " -"determine if a type is a subclass of a built-in type; such specific checks " -"are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " -"types that inherit from built-ins should have their :c:member:`~PyTypeObject." -"tp_flags` set appropriately, or the code that interacts with such types will " -"behave differently depending on what kind of check is used." +"Functions such as :c:func:`PyLong_Check` will call :c:func:" +"`PyType_FastSubclass` with one of these flags to quickly determine if a type " +"is a subclass of a built-in type; such specific checks are faster than a " +"generic check, like :c:func:`PyObject_IsInstance`. Custom types that inherit " +"from built-ins should have their :c:member:`~PyTypeObject.tp_flags` set " +"appropriately, or the code that interacts with such types will behave " +"differently depending on what kind of check is used." msgstr "" -#: c-api/typeobj.rst:1220 +#: c-api/typeobj.rst:1350 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: c-api/typeobj.rst:1225 +#: c-api/typeobj.rst:1355 msgid "" "This flag isn't necessary anymore, as the interpreter assumes the :c:member:" "`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" -#: c-api/typeobj.rst:1233 +#: c-api/typeobj.rst:1363 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: c-api/typeobj.rst:1239 +#: c-api/typeobj.rst:1369 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: c-api/typeobj.rst:1246 +#: c-api/typeobj.rst:1376 msgid "" "This flag is now removed from a class when the class's :py:meth:`~object." "__call__` method is reassigned." msgstr "" -#: c-api/typeobj.rst:1249 +#: c-api/typeobj.rst:1379 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: c-api/typeobj.rst:1253 +#: c-api/typeobj.rst:1383 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: c-api/typeobj.rst:1255 +#: c-api/typeobj.rst:1385 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: c-api/typeobj.rst:1260 +#: c-api/typeobj.rst:1390 msgid "This flag is not inherited." msgstr "" -#: c-api/typeobj.rst:1266 +#: c-api/typeobj.rst:1396 msgid "" "Disallow creating instances of the type: set :c:member:`~PyTypeObject." "tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" -#: c-api/typeobj.rst:1270 +#: c-api/typeobj.rst:1400 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: c-api/typeobj.rst:1273 +#: c-api/typeobj.rst:1403 msgid "" "The flag is set automatically on :ref:`static types ` if :c:" "member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" "member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: c-api/typeobj.rst:1279 +#: c-api/typeobj.rst:1409 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: c-api/typeobj.rst:1286 +#: c-api/typeobj.rst:1416 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: c-api/typeobj.rst:1297 +#: c-api/typeobj.rst:1427 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2017,23 +2372,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: c-api/typeobj.rst:1326 +#: c-api/typeobj.rst:1456 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: c-api/typeobj.rst:1309 +#: c-api/typeobj.rst:1439 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: c-api/typeobj.rst:1334 +#: c-api/typeobj.rst:1464 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: c-api/typeobj.rst:1319 +#: c-api/typeobj.rst:1449 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2041,49 +2396,53 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: c-api/typeobj.rst:1331 +#: c-api/typeobj.rst:1461 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_MAPPING`." msgstr "" -#: c-api/typeobj.rst:1341 +#: c-api/typeobj.rst:1471 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: c-api/typeobj.rst:1345 +#: c-api/typeobj.rst:1475 msgid "" -"This flag is present in header files, but is an internal feature and should " -"not be used. It will be removed in a future version of CPython" +"This flag is present in header files, but is not be used. It will be removed " +"in a future version of CPython" msgstr "" -#: c-api/typeobj.rst:1351 +#: c-api/typeobj.rst:1483 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " -"this type object. This is exposed as the :attr:`__doc__` attribute on the " -"type and instances of the type." +"this type object. This is exposed as the :attr:`~type.__doc__` attribute on " +"the type and instances of the type." msgstr "" -#: c-api/typeobj.rst:1357 +#: c-api/typeobj.rst:1489 msgid "This field is *not* inherited by subtypes." msgstr "" -#: c-api/typeobj.rst:1362 +#: c-api/typeobj.rst:1496 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: c-api/typeobj.rst:1488 +#: c-api/typeobj.rst:1499 +msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" +msgstr "" + +#: c-api/typeobj.rst:1723 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: c-api/typeobj.rst:1370 +#: c-api/typeobj.rst:1504 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " "collector to detect reference cycles. A typical implementation of a :c:" @@ -2093,7 +2452,20 @@ msgid "" "`!_thread` extension module::" msgstr "" -#: c-api/typeobj.rst:1385 +#: c-api/typeobj.rst:1510 +msgid "" +"static int\n" +"local_traverse(PyObject *op, visitproc visit, void *arg)\n" +"{\n" +" localobject *self = (localobject *) op;\n" +" Py_VISIT(self->args);\n" +" Py_VISIT(self->kw);\n" +" Py_VISIT(self->dict);\n" +" return 0;\n" +"}" +msgstr "" + +#: c-api/typeobj.rst:1520 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2101,14 +2473,47 @@ msgid "" "part of a reference cycle." msgstr "" -#: c-api/typeobj.rst:1389 +#: c-api/typeobj.rst:1524 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: c-api/typeobj.rst:1394 +#: c-api/typeobj.rst:1528 +msgid "" +"Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" +msgstr "" + +#: c-api/typeobj.rst:1530 +msgid "Py_VISIT(Py_TYPE(self));" +msgstr "" + +#: c-api/typeobj.rst:1532 +msgid "" +"It is only needed since Python 3.9. To support Python 3.8 and older, this " +"line must be conditional::" +msgstr "" + +#: c-api/typeobj.rst:1535 +msgid "" +"#if PY_VERSION_HEX >= 0x03090000\n" +" Py_VISIT(Py_TYPE(self));\n" +"#endif" +msgstr "" + +#: c-api/typeobj.rst:1539 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" +"`PyObject_VisitManagedDict` like this::" +msgstr "" + +#: c-api/typeobj.rst:1543 +msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" +msgstr "" + +#: c-api/typeobj.rst:1546 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2137,14 +2542,20 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: c-api/typeobj.rst:1418 +#: c-api/typeobj.rst:1570 +msgid "" +"The :c:member:`~PyTypeObject.tp_traverse` function can be called from any " +"thread." +msgstr "" + +#: c-api/typeobj.rst:1575 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: c-api/typeobj.rst:1427 +#: c-api/typeobj.rst:1584 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2152,29 +2563,161 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: c-api/typeobj.rst:1435 +#: c-api/typeobj.rst:1594 +msgid "An optional pointer to a clear function. The signature is::" +msgstr "" + +#: c-api/typeobj.rst:1596 +msgid "int tp_clear(PyObject *);" +msgstr "" + +#: c-api/typeobj.rst:1598 msgid "" -"An optional pointer to a clear function for the garbage collector. This is " -"only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " -"signature is::" +"The purpose of this function is to break reference cycles that are causing " +"a :term:`cyclic isolate` so that the objects can be safely destroyed. A " +"cleared object is a partially destroyed object; the object is not obligated " +"to satisfy design invariants held during normal use." +msgstr "" + +#: c-api/typeobj.rst:1603 +msgid "" +":c:member:`!tp_clear` does not need to delete references to objects that " +"can't participate in reference cycles, such as Python strings or Python " +"integers. However, it may be convenient to clear all references, and write " +"the type's :c:member:`~PyTypeObject.tp_dealloc` function to invoke :c:member:" +"`!tp_clear` to avoid code duplication. (Beware that :c:member:`!tp_clear` " +"might have already been called. Prefer calling idempotent functions like :c:" +"func:`Py_CLEAR`.)" +msgstr "" + +#: c-api/typeobj.rst:1611 +msgid "" +"Any non-trivial cleanup should be performed in :c:member:`~PyTypeObject." +"tp_finalize` instead of :c:member:`!tp_clear`." +msgstr "" + +#: c-api/typeobj.rst:1616 +msgid "" +"If :c:member:`!tp_clear` fails to break a reference cycle then the objects " +"in the :term:`cyclic isolate` may remain indefinitely uncollectable " +"(\"leak\"). See :data:`gc.garbage`." +msgstr "" + +#: c-api/typeobj.rst:1622 +msgid "" +"Referents (direct and indirect) might have already been cleared; they are " +"not guaranteed to be in a consistent state." +msgstr "" + +#: c-api/typeobj.rst:1627 +msgid "" +"The :c:member:`~PyTypeObject.tp_clear` function can be called from any " +"thread." +msgstr "" + +#: c-api/typeobj.rst:1632 +msgid "" +"An object is not guaranteed to be automatically cleared before its " +"destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called." +msgstr "" + +#: c-api/typeobj.rst:1635 +msgid "" +"This function differs from the destructor (:c:member:`~PyTypeObject." +"tp_dealloc`) in the following ways:" +msgstr "" + +#: c-api/typeobj.rst:1638 +msgid "" +"The purpose of clearing an object is to remove references to other objects " +"that might participate in a reference cycle. The purpose of the destructor, " +"on the other hand, is a superset: it must release *all* resources it owns, " +"including references to objects that cannot participate in a reference cycle " +"(e.g., integers) as well as the object's own memory (by calling :c:member:" +"`~PyTypeObject.tp_free`)." +msgstr "" + +#: c-api/typeobj.rst:1644 +msgid "" +"When :c:member:`!tp_clear` is called, other objects might still hold " +"references to the object being cleared. Because of this, :c:member:`!" +"tp_clear` must not deallocate the object's own memory (:c:member:" +"`~PyTypeObject.tp_free`). The destructor, on the other hand, is only called " +"when no (strong) references exist, and as such, must safely destroy the " +"object itself by deallocating it." +msgstr "" + +#: c-api/typeobj.rst:1650 +msgid "" +":c:member:`!tp_clear` might never be automatically called. An object's " +"destructor, on the other hand, will be automatically called some time after " +"the object becomes unreachable (i.e., either there are no references to the " +"object or the object is a member of a :term:`cyclic isolate`)." +msgstr "" + +#: c-api/typeobj.rst:1655 +msgid "" +"No guarantees are made about when, if, or how often Python automatically " +"clears an object, except:" +msgstr "" + +#: c-api/typeobj.rst:1658 +msgid "" +"Python will not automatically clear an object if it is reachable, i.e., " +"there is a reference to it and it is not a member of a :term:`cyclic " +"isolate`." +msgstr "" + +#: c-api/typeobj.rst:1661 +msgid "" +"Python will not automatically clear an object if it has not been " +"automatically finalized (see :c:member:`~PyTypeObject.tp_finalize`). (If " +"the finalizer resurrected the object, the object may or may not be " +"automatically finalized again before it is cleared.)" +msgstr "" + +#: c-api/typeobj.rst:1665 +msgid "" +"If an object is a member of a :term:`cyclic isolate`, Python will not " +"automatically clear it if any member of the cyclic isolate has not yet been " +"automatically finalized (:c:member:`~PyTypeObject.tp_finalize`)." +msgstr "" + +#: c-api/typeobj.rst:1668 +msgid "" +"Python will not destroy an object until after any automatic calls to its :c:" +"member:`!tp_clear` function have returned. This ensures that the act of " +"breaking a reference cycle does not invalidate the ``self`` pointer while :c:" +"member:`!tp_clear` is still executing." +msgstr "" + +#: c-api/typeobj.rst:1672 +msgid "" +"Python will not automatically call :c:member:`!tp_clear` multiple times " +"concurrently." +msgstr "" + +#: c-api/typeobj.rst:1675 +msgid "" +"CPython currently only automatically clears objects as needed to break " +"reference cycles in a :term:`cyclic isolate`, but future versions might " +"clear objects regularly before their destruction." msgstr "" -#: c-api/typeobj.rst:1440 +#: c-api/typeobj.rst:1679 msgid "" -"The :c:member:`~PyTypeObject.tp_clear` member function is used to break " -"reference cycles in cyclic garbage detected by the garbage collector. Taken " -"together, all :c:member:`~PyTypeObject.tp_clear` functions in the system " -"must combine to break all reference cycles. This is subtle, and if in any " -"doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For example, " -"the tuple type does not implement a :c:member:`~PyTypeObject.tp_clear` " -"function, because it's possible to prove that no reference cycle can be " -"composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." -"tp_clear` functions of other types must be sufficient to break any cycle " +"Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " +"system must combine to break all reference cycles. This is subtle, and if " +"in any doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For " +"example, the tuple type does not implement a :c:member:`~PyTypeObject." +"tp_clear` function, because it's possible to prove that no reference cycle " +"can be composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." +"tp_clear` functions of other types are responsible for breaking any cycle " "containing a tuple. This isn't immediately obvious, and there's rarely a " "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: c-api/typeobj.rst:1450 +#: c-api/typeobj.rst:1690 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2182,7 +2725,21 @@ msgid "" "example::" msgstr "" -#: c-api/typeobj.rst:1464 +#: c-api/typeobj.rst:1694 +msgid "" +"static int\n" +"local_clear(PyObject *op)\n" +"{\n" +" localobject *self = (localobject *) op;\n" +" Py_CLEAR(self->key);\n" +" Py_CLEAR(self->args);\n" +" Py_CLEAR(self->kw);\n" +" Py_CLEAR(self->dict);\n" +" return 0;\n" +"}" +msgstr "" + +#: c-api/typeobj.rst:1705 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2197,25 +2754,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: c-api/typeobj.rst:1476 +#: c-api/typeobj.rst:1717 msgid "" -"Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " -"an instance is deallocated. For example, when reference counting is enough " -"to determine that an object is no longer used, the cyclic garbage collector " -"is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the clear function must call :c:func:" +"`PyObject_ClearManagedDict` like this::" msgstr "" -#: c-api/typeobj.rst:1482 -msgid "" -"Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " -"reference cycles, it's not necessary to clear contained objects like Python " -"strings or Python integers, which can't participate in reference cycles. On " -"the other hand, it may be convenient to clear all contained Python objects, " -"and write the type's :c:member:`~PyTypeObject.tp_dealloc` function to " -"invoke :c:member:`~PyTypeObject.tp_clear`." +#: c-api/typeobj.rst:1721 +msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "" -#: c-api/typeobj.rst:1495 +#: c-api/typeobj.rst:1730 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" @@ -2223,18 +2773,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: c-api/typeobj.rst:1503 +#: c-api/typeobj.rst:1744 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: c-api/typeobj.rst:1507 +#: c-api/typeobj.rst:1746 +msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" +msgstr "" + +#: c-api/typeobj.rst:1748 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: c-api/typeobj.rst:1510 +#: c-api/typeobj.rst:1751 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2242,50 +2796,50 @@ msgid "" "set an exception condition." msgstr "" -#: c-api/typeobj.rst:1515 +#: c-api/typeobj.rst:1756 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: c-api/typeobj.rst:1521 +#: c-api/typeobj.rst:1762 msgid "Constant" msgstr "" -#: c-api/typeobj.rst:1521 +#: c-api/typeobj.rst:1762 msgid "Comparison" msgstr "" -#: c-api/typeobj.rst:1523 +#: c-api/typeobj.rst:1764 msgid "``<``" msgstr "" -#: c-api/typeobj.rst:1525 +#: c-api/typeobj.rst:1766 msgid "``<=``" msgstr "" -#: c-api/typeobj.rst:1527 +#: c-api/typeobj.rst:1768 msgid "``==``" msgstr "" -#: c-api/typeobj.rst:1529 +#: c-api/typeobj.rst:1770 msgid "``!=``" msgstr "" -#: c-api/typeobj.rst:1531 +#: c-api/typeobj.rst:1772 msgid "``>``" msgstr "" -#: c-api/typeobj.rst:1533 +#: c-api/typeobj.rst:1774 msgid "``>=``" msgstr "" -#: c-api/typeobj.rst:1536 +#: c-api/typeobj.rst:1777 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: c-api/typeobj.rst:1540 +#: c-api/typeobj.rst:1781 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2293,15 +2847,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: c-api/typeobj.rst:1546 +#: c-api/typeobj.rst:1787 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: c-api/typeobj.rst:1548 +#: c-api/typeobj.rst:1789 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: c-api/typeobj.rst:1556 +#: c-api/typeobj.rst:1797 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -2309,7 +2863,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: c-api/typeobj.rst:1563 +#: c-api/typeobj.rst:1804 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -2318,13 +2872,13 @@ msgid "" "comparisons." msgstr "" -#: c-api/typeobj.rst:1572 +#: c-api/typeobj.rst:1813 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: c-api/typeobj.rst:1575 +#: c-api/typeobj.rst:1816 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -2334,19 +2888,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: c-api/typeobj.rst:1582 +#: c-api/typeobj.rst:1823 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: c-api/typeobj.rst:1585 +#: c-api/typeobj.rst:1826 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " -"and :c:member:`~PyTypeObject.tp_weaklist`." +"and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: c-api/typeobj.rst:1590 +#: c-api/typeobj.rst:1831 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2355,32 +2909,40 @@ msgid "" "not be a problem." msgstr "" -#: c-api/typeobj.rst:1597 +#: c-api/typeobj.rst:1838 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" -"`~PyTypeObject.tp_dict` field, then :c:member:`~PyTypeObject." +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." "tp_weaklistoffset` will be set to a negative value, to indicate that it is " "unsafe to use this field." msgstr "" -#: c-api/typeobj.rst:1605 +#: c-api/typeobj.rst:1848 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: c-api/typeobj.rst:1609 +#: c-api/typeobj.rst:1852 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: c-api/typeobj.rst:1620 +#: c-api/typeobj.rst:1854 +msgid "PyObject *tp_iter(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:1865 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: c-api/typeobj.rst:1625 +#: c-api/typeobj.rst:1868 +msgid "PyObject *tp_iternext(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:1870 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -2388,74 +2950,74 @@ msgid "" "this type are iterators." msgstr "" -#: c-api/typeobj.rst:1630 +#: c-api/typeobj.rst:1875 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: c-api/typeobj.rst:1634 +#: c-api/typeobj.rst:1879 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: c-api/typeobj.rst:1643 +#: c-api/typeobj.rst:1890 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: c-api/typeobj.rst:1646 +#: c-api/typeobj.rst:1893 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: c-api/typeobj.rst:1651 +#: c-api/typeobj.rst:1898 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: c-api/typeobj.rst:1657 +#: c-api/typeobj.rst:1906 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: c-api/typeobj.rst:1661 +#: c-api/typeobj.rst:1910 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: c-api/typeobj.rst:1666 +#: c-api/typeobj.rst:1915 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: c-api/typeobj.rst:1672 +#: c-api/typeobj.rst:1923 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: c-api/typeobj.rst:1675 +#: c-api/typeobj.rst:1926 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: c-api/typeobj.rst:1680 +#: c-api/typeobj.rst:1931 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: c-api/typeobj.rst:1686 +#: c-api/typeobj.rst:1939 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2463,7 +3025,7 @@ msgid "" "metatype." msgstr "" -#: c-api/typeobj.rst:1694 +#: c-api/typeobj.rst:1947 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2471,7 +3033,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: c-api/typeobj.rst:1699 +#: c-api/typeobj.rst:1952 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -2479,27 +3041,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: c-api/typeobj.rst:1705 +#: c-api/typeobj.rst:1958 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: c-api/typeobj.rst:1710 +#: c-api/typeobj.rst:1963 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: c-api/typeobj.rst:1714 +#: c-api/typeobj.rst:1967 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: c-api/typeobj.rst:1720 +#: c-api/typeobj.rst:1973 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: c-api/typeobj.rst:1722 +#: c-api/typeobj.rst:1975 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -2510,62 +3072,70 @@ msgid "" "be treated as read-only." msgstr "" -#: c-api/typeobj.rst:1730 +#: c-api/typeobj.rst:1983 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: c-api/typeobj.rst:1736 +#: c-api/typeobj.rst:1989 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: c-api/typeobj.rst:1742 +#: c-api/typeobj.rst:1995 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: c-api/typeobj.rst:1747 +#: c-api/typeobj.rst:2000 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: c-api/typeobj.rst:1752 +#: c-api/typeobj.rst:2005 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: c-api/typeobj.rst:1758 +#: c-api/typeobj.rst:2013 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: c-api/typeobj.rst:1776 c-api/typeobj.rst:1870 c-api/typeobj.rst:1894 +#: c-api/typeobj.rst:2033 c-api/typeobj.rst:2131 c-api/typeobj.rst:2156 msgid "The function signature is::" msgstr "" -#: c-api/typeobj.rst:1773 +#: c-api/typeobj.rst:2017 +msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" +msgstr "" + +#: c-api/typeobj.rst:2030 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: c-api/typeobj.rst:1780 +#: c-api/typeobj.rst:2035 +msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" +msgstr "" + +#: c-api/typeobj.rst:2037 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: c-api/typeobj.rst:1791 +#: c-api/typeobj.rst:2048 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: c-api/typeobj.rst:1794 +#: c-api/typeobj.rst:2051 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -2573,19 +3143,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: c-api/typeobj.rst:1799 +#: c-api/typeobj.rst:2056 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: c-api/typeobj.rst:1802 +#: c-api/typeobj.rst:2059 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: c-api/typeobj.rst:1804 +#: c-api/typeobj.rst:2061 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -2594,13 +3164,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: c-api/typeobj.rst:1810 +#: c-api/typeobj.rst:2067 msgid "" -"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " -"and :c:member:`~PyTypeObject.tp_dictoffset`." +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" +"member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: c-api/typeobj.rst:1815 +#: c-api/typeobj.rst:2072 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " @@ -2608,25 +3178,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: c-api/typeobj.rst:1822 +#: c-api/typeobj.rst:2079 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: c-api/typeobj.rst:1825 +#: c-api/typeobj.rst:2082 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_dict` field, then :c:member:`~PyTypeObject.tp_dictoffset` " +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: c-api/typeobj.rst:1833 +#: c-api/typeobj.rst:2092 msgid "An optional pointer to an instance initialization function." msgstr "" -#: c-api/typeobj.rst:1835 +#: c-api/typeobj.rst:2094 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -2634,14 +3204,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: c-api/typeobj.rst:1844 +#: c-api/typeobj.rst:2101 +msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" +msgstr "" + +#: c-api/typeobj.rst:2103 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" -#: c-api/typeobj.rst:1848 +#: c-api/typeobj.rst:2107 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -2653,43 +3227,52 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: c-api/typeobj.rst:1855 +#: c-api/typeobj.rst:2114 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: c-api/typeobj.rst:1863 +#: c-api/typeobj.rst:2122 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: c-api/typeobj.rst:1868 +#: c-api/typeobj.rst:2129 msgid "An optional pointer to an instance allocation function." msgstr "" -#: c-api/typeobj.rst:1876 -msgid "" -"This field is inherited by static subtypes, but not by dynamic subtypes " -"(subtypes created by a class statement)." +#: c-api/typeobj.rst:2133 +msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "" -#: c-api/typeobj.rst:1881 +#: c-api/typeobj.rst:2137 msgid "" -"For dynamic subtypes, this field is always set to :c:func:" -"`PyType_GenericAlloc`, to force a standard heap allocation strategy." +"Static subtypes inherit this slot, which will be :c:func:" +"`PyType_GenericAlloc` if inherited from :class:`object`." +msgstr "" + +#: c-api/typeobj.rst:2211 +msgid ":ref:`Heap subtypes ` do not inherit this slot." msgstr "" -#: c-api/typeobj.rst:1885 +#: c-api/typeobj.rst:2144 msgid "" -"For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" -"`PyType_GenericAlloc`. That is the recommended value for all statically " -"defined types." +"For heap subtypes, this field is always set to :c:func:`PyType_GenericAlloc`." +msgstr "" + +#: c-api/typeobj.rst:2219 +msgid "For static subtypes, this slot is inherited (see above)." msgstr "" -#: c-api/typeobj.rst:1892 +#: c-api/typeobj.rst:2154 msgid "An optional pointer to an instance creation function." msgstr "" -#: c-api/typeobj.rst:1898 +#: c-api/typeobj.rst:2158 +msgid "" +"PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" +msgstr "" + +#: c-api/typeobj.rst:2160 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -2698,7 +3281,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: c-api/typeobj.rst:1904 +#: c-api/typeobj.rst:2166 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -2710,20 +3293,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: c-api/typeobj.rst:1912 +#: c-api/typeobj.rst:2174 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: c-api/typeobj.rst:1917 +#: c-api/typeobj.rst:2179 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: c-api/typeobj.rst:1923 +#: c-api/typeobj.rst:2185 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -2731,40 +3314,42 @@ msgid "" "factory function." msgstr "" -#: c-api/typeobj.rst:1931 +#: c-api/typeobj.rst:2195 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: c-api/typeobj.rst:1935 -msgid "" -"An initializer that is compatible with this signature is :c:func:" -"`PyObject_Free`." +#: c-api/typeobj.rst:2197 +msgid "void tp_free(void *self);" msgstr "" -#: c-api/typeobj.rst:1939 +#: c-api/typeobj.rst:2199 msgid "" -"This field is inherited by static subtypes, but not by dynamic subtypes " -"(subtypes created by a class statement)" +"This function must free the memory allocated by :c:member:`~PyTypeObject." +"tp_alloc`." msgstr "" -#: c-api/typeobj.rst:1944 +#: c-api/typeobj.rst:2204 msgid "" -"In dynamic subtypes, this field is set to a deallocator suitable to match :c:" -"func:`PyType_GenericAlloc` and the value of the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit." +"Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " +"inherited from :class:`object`. Exception: If the type supports garbage " +"collection (i.e., the :c:macro:`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:" +"`~PyTypeObject.tp_flags`) and it would inherit :c:func:`PyObject_Free`, then " +"this slot is not inherited but instead defaults to :c:func:`PyObject_GC_Del`." msgstr "" -#: c-api/typeobj.rst:1948 +#: c-api/typeobj.rst:2215 msgid "" -"For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." +"For :ref:`heap subtypes `, this slot defaults to a deallocator " +"suitable to match :c:func:`PyType_GenericAlloc` and the value of the :c:" +"macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -#: c-api/typeobj.rst:1953 +#: c-api/typeobj.rst:2226 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: c-api/typeobj.rst:1955 +#: c-api/typeobj.rst:2228 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -2776,87 +3361,91 @@ msgid "" "instance. The signature is::" msgstr "" -#: c-api/typeobj.rst:1965 +#: c-api/typeobj.rst:2236 +msgid "int tp_is_gc(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:2238 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: c-api/typeobj.rst:1975 +#: c-api/typeobj.rst:2248 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: c-api/typeobj.rst:1981 +#: c-api/typeobj.rst:2256 msgid "Tuple of base types." msgstr "" -#: c-api/typeobj.rst:2007 +#: c-api/typeobj.rst:2282 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: c-api/typeobj.rst:1986 +#: c-api/typeobj.rst:2261 msgid "" -"For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " +"For dynamically created classes, the :c:data:`Py_tp_bases` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: c-api/typeobj.rst:1993 +#: c-api/typeobj.rst:2268 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: c-api/typeobj.rst:2022 c-api/typeobj.rst:2056 c-api/typeobj.rst:2070 +#: c-api/typeobj.rst:2297 c-api/typeobj.rst:2331 c-api/typeobj.rst:2347 msgid "This field is not inherited." msgstr "" -#: c-api/typeobj.rst:2004 +#: c-api/typeobj.rst:2279 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: c-api/typeobj.rst:2012 +#: c-api/typeobj.rst:2287 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: c-api/typeobj.rst:2018 +#: c-api/typeobj.rst:2293 msgid "Unused. Internal use only." msgstr "" -#: c-api/typeobj.rst:2027 +#: c-api/typeobj.rst:2302 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: c-api/typeobj.rst:2029 +#: c-api/typeobj.rst:2304 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~class." +"To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" -#: c-api/typeobj.rst:2034 +#: c-api/typeobj.rst:2309 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: c-api/typeobj.rst:2044 +#: c-api/typeobj.rst:2319 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: c-api/typeobj.rst:2049 +#: c-api/typeobj.rst:2324 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -2864,128 +3453,351 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: c-api/typeobj.rst:2061 +#: c-api/typeobj.rst:2338 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: c-api/typeobj.rst:2066 +#: c-api/typeobj.rst:2343 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: c-api/typeobj.rst:2075 +#: c-api/typeobj.rst:2354 msgid "" -"An optional pointer to an instance finalization function. Its signature is::" +"An optional pointer to an instance finalization function. This is the C " +"implementation of the :meth:`~object.__del__` special method. Its signature " +"is::" msgstr "" -#: c-api/typeobj.rst:2079 +#: c-api/typeobj.rst:2358 +msgid "void tp_finalize(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:2360 msgid "" -"If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " -"once when finalizing an instance. It is called either from the garbage " -"collector (if the instance is part of an isolated reference cycle) or just " -"before the object is deallocated. Either way, it is guaranteed to be called " -"before attempting to break reference cycles, ensuring that it finds the " -"object in a sane state." +"The primary purpose of finalization is to perform any non-trivial cleanup " +"that must be performed before the object is destroyed, while the object and " +"any other objects it directly or indirectly references are still in a " +"consistent state. The finalizer is allowed to execute arbitrary Python code." msgstr "" -#: c-api/typeobj.rst:2086 +#: c-api/typeobj.rst:2366 msgid "" -":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " -"exception status; therefore, a recommended way to write a non-trivial " -"finalizer is::" +"Before Python automatically finalizes an object, some of the object's direct " +"or indirect referents might have themselves been automatically finalized. " +"However, none of the referents will have been automatically cleared (:c:" +"member:`~PyTypeObject.tp_clear`) yet." msgstr "" -#: c-api/typeobj.rst:2103 +#: c-api/typeobj.rst:2371 msgid "" -"Also, note that, in a garbage collected Python, :c:member:`~PyTypeObject." -"tp_dealloc` may be called from any Python thread, not just the thread which " -"created the object (if the object becomes part of a refcount cycle, that " -"cycle might be collected by a garbage collection on any thread). This is " -"not a problem for Python API calls, since the thread on which tp_dealloc is " -"called will own the Global Interpreter Lock (GIL). However, if the object " -"being destroyed in turn destroys objects from some other C or C++ library, " -"care should be taken to ensure that destroying those objects on the thread " -"which called tp_dealloc will not violate any assumptions of the library." +"Other non-finalized objects might still be using a finalized object, so the " +"finalizer must leave the object in a sane state (e.g., invariants are still " +"met)." msgstr "" -#: c-api/typeobj.rst:2122 +#: c-api/typeobj.rst:2377 +msgid "" +"After Python automatically finalizes an object, Python might start " +"automatically clearing (:c:member:`~PyTypeObject.tp_clear`) the object and " +"its referents (direct and indirect). Cleared objects are not guaranteed to " +"be in a consistent state; a finalized object must be able to tolerate " +"cleared referents." +msgstr "" + +#: c-api/typeobj.rst:2385 +msgid "" +"An object is not guaranteed to be automatically finalized before its " +"destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called. It is " +"recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the " +"beginning of :c:member:`!tp_dealloc` to guarantee that the object is always " +"finalized before destruction." +msgstr "" + +#: c-api/typeobj.rst:2393 +msgid "" +"The :c:member:`~PyTypeObject.tp_finalize` function can be called from any " +"thread, although the :term:`GIL` will be held." +msgstr "" + +#: c-api/typeobj.rst:2398 +msgid "" +"The :c:member:`!tp_finalize` function can be called during shutdown, after " +"some global variables have been deleted. See the documentation of the :meth:" +"`~object.__del__` method for details." +msgstr "" + +#: c-api/typeobj.rst:2402 +msgid "" +"When Python finalizes an object, it behaves like the following algorithm:" +msgstr "" + +#: c-api/typeobj.rst:2404 +msgid "" +"Python might mark the object as *finalized*. Currently, Python always marks " +"objects whose type supports garbage collection (i.e., the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag is set in :c:member:`~PyTypeObject.tp_flags`) and " +"never marks other types of objects; this might change in a future version." +msgstr "" + +#: c-api/typeobj.rst:2409 +msgid "" +"If the object is not marked as *finalized* and its :c:member:`!tp_finalize` " +"finalizer function is non-``NULL``, the finalizer function is called." +msgstr "" + +#: c-api/typeobj.rst:2412 +msgid "" +"If the finalizer function was called and the finalizer made the object " +"reachable (i.e., there is a reference to the object and it is not a member " +"of a :term:`cyclic isolate`), then the finalizer is said to have " +"*resurrected* the object. It is unspecified whether the finalizer can also " +"resurrect the object by adding a new reference to the object that does not " +"make it reachable, i.e., the object is (still) a member of a cyclic isolate." +msgstr "" + +#: c-api/typeobj.rst:2419 +msgid "" +"If the finalizer resurrected the object, the object's pending destruction is " +"canceled and the object's *finalized* mark might be removed if present. " +"Currently, Python never removes the *finalized* mark; this might change in a " +"future version." +msgstr "" + +#: c-api/typeobj.rst:2424 +msgid "" +"*Automatic finalization* refers to any finalization performed by Python " +"except via calls to :c:func:`PyObject_CallFinalizer` or :c:func:" +"`PyObject_CallFinalizerFromDealloc`. No guarantees are made about when, if, " +"or how often an object is automatically finalized, except:" +msgstr "" + +#: c-api/typeobj.rst:2429 +msgid "" +"Python will not automatically finalize an object if it is reachable, i.e., " +"there is a reference to it and it is not a member of a :term:`cyclic " +"isolate`." +msgstr "" + +#: c-api/typeobj.rst:2432 +msgid "" +"Python will not automatically finalize an object if finalizing it would not " +"mark the object as *finalized*. Currently, this applies to objects whose " +"type does not support garbage collection, i.e., the :c:macro:" +"`Py_TPFLAGS_HAVE_GC` flag is not set. Such objects can still be manually " +"finalized by calling :c:func:`PyObject_CallFinalizer` or :c:func:" +"`PyObject_CallFinalizerFromDealloc`." +msgstr "" + +#: c-api/typeobj.rst:2438 +msgid "" +"Python will not automatically finalize any two members of a :term:`cyclic " +"isolate` concurrently." +msgstr "" + +#: c-api/typeobj.rst:2440 +msgid "" +"Python will not automatically finalize an object after it has automatically " +"cleared (:c:member:`~PyTypeObject.tp_clear`) the object." +msgstr "" + +#: c-api/typeobj.rst:2442 +msgid "" +"If an object is a member of a :term:`cyclic isolate`, Python will not " +"automatically finalize it after automatically clearing (see :c:member:" +"`~PyTypeObject.tp_clear`) any other member." +msgstr "" + +#: c-api/typeobj.rst:2445 +msgid "" +"Python will automatically finalize every member of a :term:`cyclic isolate` " +"before it automatically clears (see :c:member:`~PyTypeObject.tp_clear`) any " +"of them." +msgstr "" + +#: c-api/typeobj.rst:2448 +msgid "" +"If Python is going to automatically clear an object (:c:member:" +"`~PyTypeObject.tp_clear`), it will automatically finalize the object first." +msgstr "" + +#: c-api/typeobj.rst:2452 +msgid "" +"Python currently only automatically finalizes objects that are members of a :" +"term:`cyclic isolate`, but future versions might finalize objects regularly " +"before their destruction." +msgstr "" + +#: c-api/typeobj.rst:2456 +msgid "" +"To manually finalize an object, do not call this function directly; call :c:" +"func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc` " +"instead." +msgstr "" + +#: c-api/typeobj.rst:2460 +msgid "" +":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " +"status unchanged. The recommended way to write a non-trivial finalizer is " +"to back up the exception at the beginning by calling :c:func:" +"`PyErr_GetRaisedException` and restore the exception at the end by calling :" +"c:func:`PyErr_SetRaisedException`. If an exception is encountered in the " +"middle of the finalizer, log and clear it with :c:func:" +"`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" +msgstr "" + +#: c-api/typeobj.rst:2469 +msgid "" +"static void\n" +"foo_finalize(PyObject *self)\n" +"{\n" +" // Save the current exception, if any.\n" +" PyObject *exc = PyErr_GetRaisedException();\n" +"\n" +" // ...\n" +"\n" +" if (do_something_that_might_raise() != success_indicator) {\n" +" PyErr_WriteUnraisable(self);\n" +" goto done;\n" +" }\n" +"\n" +"done:\n" +" // Restore the saved exception. This silently discards any exception\n" +" // raised above, so be sure to call PyErr_WriteUnraisable first if\n" +" // necessary.\n" +" PyErr_SetRaisedException(exc);\n" +"}" +msgstr "" + +#: c-api/typeobj.rst:2497 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: c-api/typeobj.rst:2126 -msgid "\"Safe object finalization\" (:pep:`442`)" +#: c-api/typeobj.rst:2503 +msgid ":pep:`442`: \"Safe object finalization\"" +msgstr "" + +#: c-api/typeobj.rst:2506 +msgid ":c:func:`PyObject_CallFinalizer`" +msgstr "" + +#: c-api/typeobj.rst:2507 +msgid ":c:func:`PyObject_CallFinalizerFromDealloc`" +msgstr "" + +#: c-api/typeobj.rst:2514 +msgid "" +"A :ref:`vectorcall function ` to use for calls of this type " +"object (rather than instances). In other words, ``tp_vectorcall`` can be " +"used to optimize ``type.__call__``, which typically returns a new instance " +"of *type*." +msgstr "" + +#: c-api/typeobj.rst:2519 +msgid "" +"As with any vectorcall function, if ``tp_vectorcall`` is ``NULL``, the " +"*tp_call* protocol (``Py_TYPE(type)->tp_call``) is used instead." +msgstr "" + +#: c-api/typeobj.rst:2524 +msgid "" +"The :ref:`vectorcall protocol ` requires that the vectorcall " +"function has the same behavior as the corresponding ``tp_call``. This means " +"that ``type->tp_vectorcall`` must match the behavior of ``Py_TYPE(type)-" +">tp_call``." +msgstr "" + +#: c-api/typeobj.rst:2529 +msgid "" +"Specifically, if *type* uses the default metaclass, ``type->tp_vectorcall`` " +"must behave the same as :c:expr:`PyType_Type->tp_call`, which:" +msgstr "" + +#: c-api/typeobj.rst:2533 +msgid "calls ``type->tp_new``," +msgstr "" + +#: c-api/typeobj.rst:2535 +msgid "" +"if the result is a subclass of *type*, calls ``type->tp_init`` on the result " +"of ``tp_new``, and" +msgstr "" + +#: c-api/typeobj.rst:2538 +msgid "returns the result of ``tp_new``." msgstr "" -#: c-api/typeobj.rst:2131 +#: c-api/typeobj.rst:2540 msgid "" -"Vectorcall function to use for calls of this type object. In other words, it " -"is used to implement :ref:`vectorcall ` for ``type.__call__``. " -"If ``tp_vectorcall`` is ``NULL``, the default call implementation using :" -"meth:`~object.__new__` and :meth:`~object.__init__` is used." +"Typically, ``tp_vectorcall`` is overridden to optimize this process for " +"specific :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject." +"tp_init`. When doing this for user-subclassable types, note that both can be " +"overridden (using :py:func:`~object.__new__` and :py:func:`~object." +"__init__`, respectively)." msgstr "" -#: c-api/typeobj.rst:2139 +#: c-api/typeobj.rst:2551 msgid "This field is never inherited." msgstr "" -#: c-api/typeobj.rst:2141 +#: c-api/typeobj.rst:2553 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: c-api/typeobj.rst:2146 +#: c-api/typeobj.rst:2558 msgid "Internal. Do not use." msgstr "" -#: c-api/typeobj.rst:2154 +#: c-api/typeobj.rst:2566 msgid "Static Types" msgstr "" -#: c-api/typeobj.rst:2156 +#: c-api/typeobj.rst:2568 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: c-api/typeobj.rst:2160 +#: c-api/typeobj.rst:2572 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: c-api/typeobj.rst:2162 +#: c-api/typeobj.rst:2574 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: c-api/typeobj.rst:2164 +#: c-api/typeobj.rst:2576 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: c-api/typeobj.rst:2166 +#: c-api/typeobj.rst:2578 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: c-api/typeobj.rst:2170 +#: c-api/typeobj.rst:2582 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: c-api/typeobj.rst:2178 +#: c-api/typeobj.rst:2590 msgid "Heap Types" msgstr "" -#: c-api/typeobj.rst:2180 +#: c-api/typeobj.rst:2592 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -2993,29 +3805,75 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: c-api/typeobj.rst:2185 +#: c-api/typeobj.rst:2597 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: c-api/typeobj.rst:2193 +#: c-api/typeobj.rst:2605 msgid "Number Object Structures" msgstr "" -#: c-api/typeobj.rst:2200 +#: c-api/typeobj.rst:2612 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: c-api/typeobj.rst:2530 +#: c-api/typeobj.rst:3074 msgid "Here is the structure definition::" msgstr "" -#: c-api/typeobj.rst:2253 +#: c-api/typeobj.rst:2620 +msgid "" +"typedef struct {\n" +" binaryfunc nb_add;\n" +" binaryfunc nb_subtract;\n" +" binaryfunc nb_multiply;\n" +" binaryfunc nb_remainder;\n" +" binaryfunc nb_divmod;\n" +" ternaryfunc nb_power;\n" +" unaryfunc nb_negative;\n" +" unaryfunc nb_positive;\n" +" unaryfunc nb_absolute;\n" +" inquiry nb_bool;\n" +" unaryfunc nb_invert;\n" +" binaryfunc nb_lshift;\n" +" binaryfunc nb_rshift;\n" +" binaryfunc nb_and;\n" +" binaryfunc nb_xor;\n" +" binaryfunc nb_or;\n" +" unaryfunc nb_int;\n" +" void *nb_reserved;\n" +" unaryfunc nb_float;\n" +"\n" +" binaryfunc nb_inplace_add;\n" +" binaryfunc nb_inplace_subtract;\n" +" binaryfunc nb_inplace_multiply;\n" +" binaryfunc nb_inplace_remainder;\n" +" ternaryfunc nb_inplace_power;\n" +" binaryfunc nb_inplace_lshift;\n" +" binaryfunc nb_inplace_rshift;\n" +" binaryfunc nb_inplace_and;\n" +" binaryfunc nb_inplace_xor;\n" +" binaryfunc nb_inplace_or;\n" +"\n" +" binaryfunc nb_floor_divide;\n" +" binaryfunc nb_true_divide;\n" +" binaryfunc nb_inplace_floor_divide;\n" +" binaryfunc nb_inplace_true_divide;\n" +"\n" +" unaryfunc nb_index;\n" +"\n" +" binaryfunc nb_matrix_multiply;\n" +" binaryfunc nb_inplace_matrix_multiply;\n" +"} PyNumberMethods;" +msgstr "" + +#: c-api/typeobj.rst:2665 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3025,31 +3883,31 @@ msgid "" "and set an exception." msgstr "" -#: c-api/typeobj.rst:2262 +#: c-api/typeobj.rst:2674 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: c-api/typeobj.rst:2307 +#: c-api/typeobj.rst:2825 msgid "Mapping Object Structures" msgstr "" -#: c-api/typeobj.rst:2314 +#: c-api/typeobj.rst:2832 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: c-api/typeobj.rst:2319 +#: c-api/typeobj.rst:2839 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: c-api/typeobj.rst:2325 +#: c-api/typeobj.rst:2847 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -3057,7 +3915,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: c-api/typeobj.rst:2333 +#: c-api/typeobj.rst:2857 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -3067,17 +3925,17 @@ msgid "" "deletion." msgstr "" -#: c-api/typeobj.rst:2344 +#: c-api/typeobj.rst:2868 msgid "Sequence Object Structures" msgstr "" -#: c-api/typeobj.rst:2351 +#: c-api/typeobj.rst:2875 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: c-api/typeobj.rst:2356 +#: c-api/typeobj.rst:2882 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -3085,21 +3943,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: c-api/typeobj.rst:2363 +#: c-api/typeobj.rst:2891 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: c-api/typeobj.rst:2369 +#: c-api/typeobj.rst:2899 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: c-api/typeobj.rst:2375 +#: c-api/typeobj.rst:2907 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3108,7 +3966,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: c-api/typeobj.rst:2381 +#: c-api/typeobj.rst:2913 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -3117,7 +3975,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: c-api/typeobj.rst:2388 +#: c-api/typeobj.rst:2922 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -3126,14 +3984,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: c-api/typeobj.rst:2397 +#: c-api/typeobj.rst:2933 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: c-api/typeobj.rst:2404 +#: c-api/typeobj.rst:2942 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3143,7 +4001,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: c-api/typeobj.rst:2413 +#: c-api/typeobj.rst:2953 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3153,70 +4011,74 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: c-api/typeobj.rst:2424 +#: c-api/typeobj.rst:2964 msgid "Buffer Object Structures" msgstr "" -#: c-api/typeobj.rst:2432 +#: c-api/typeobj.rst:2972 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: c-api/typeobj.rst:2487 c-api/typeobj.rst:2552 c-api/typeobj.rst:2574 +#: c-api/typeobj.rst:3031 c-api/typeobj.rst:3100 c-api/typeobj.rst:3126 msgid "The signature of this function is::" msgstr "" -#: c-api/typeobj.rst:2442 +#: c-api/typeobj.rst:2982 +msgid "int (PyObject *exporter, Py_buffer *view, int flags);" +msgstr "" + +#: c-api/typeobj.rst:2984 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: c-api/typeobj.rst:2446 +#: c-api/typeobj.rst:2988 msgid "" "Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" "expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: c-api/typeobj.rst:2449 +#: c-api/typeobj.rst:2991 msgid "Fill in the requested fields." msgstr "" -#: c-api/typeobj.rst:2451 +#: c-api/typeobj.rst:2993 msgid "Increment an internal counter for the number of exports." msgstr "" -#: c-api/typeobj.rst:2453 +#: c-api/typeobj.rst:2995 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: c-api/typeobj.rst:2455 +#: c-api/typeobj.rst:2997 msgid "Return ``0``." msgstr "" -#: c-api/typeobj.rst:2457 +#: c-api/typeobj.rst:2999 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: c-api/typeobj.rst:2460 +#: c-api/typeobj.rst:3002 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: c-api/typeobj.rst:2463 +#: c-api/typeobj.rst:3005 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: c-api/typeobj.rst:2467 +#: c-api/typeobj.rst:3009 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3224,7 +4086,7 @@ msgid "" "types>`." msgstr "" -#: c-api/typeobj.rst:2472 +#: c-api/typeobj.rst:3014 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -3233,19 +4095,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: c-api/typeobj.rst:2479 +#: c-api/typeobj.rst:3021 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: c-api/typeobj.rst:2482 +#: c-api/typeobj.rst:3024 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: c-api/typeobj.rst:2491 +#: c-api/typeobj.rst:3033 +msgid "void (PyObject *exporter, Py_buffer *view);" +msgstr "" + +#: c-api/typeobj.rst:3035 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3253,15 +4119,15 @@ msgid "" "these optional steps:" msgstr "" -#: c-api/typeobj.rst:2496 +#: c-api/typeobj.rst:3040 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: c-api/typeobj.rst:2498 +#: c-api/typeobj.rst:3042 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: c-api/typeobj.rst:2500 +#: c-api/typeobj.rst:3044 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3269,68 +4135,94 @@ msgid "" "*view* argument." msgstr "" -#: c-api/typeobj.rst:2506 +#: c-api/typeobj.rst:3050 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: c-api/typeobj.rst:2511 +#: c-api/typeobj.rst:3055 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: c-api/typeobj.rst:2519 +#: c-api/typeobj.rst:3063 msgid "Async Object Structures" msgstr "" -#: c-api/typeobj.rst:2527 +#: c-api/typeobj.rst:3071 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: c-api/typeobj.rst:2545 +#: c-api/typeobj.rst:3076 +msgid "" +"typedef struct {\n" +" unaryfunc am_await;\n" +" unaryfunc am_aiter;\n" +" unaryfunc am_anext;\n" +" sendfunc am_send;\n" +"} PyAsyncMethods;" +msgstr "" + +#: c-api/typeobj.rst:3089 +msgid "PyObject *am_await(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:3091 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: c-api/typeobj.rst:2548 +#: c-api/typeobj.rst:3094 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: c-api/typeobj.rst:2556 +#: c-api/typeobj.rst:3102 +msgid "PyObject *am_aiter(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:3104 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: c-api/typeobj.rst:2559 +#: c-api/typeobj.rst:3107 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: c-api/typeobj.rst:2568 +#: c-api/typeobj.rst:3116 +msgid "PyObject *am_anext(PyObject *self);" +msgstr "" + +#: c-api/typeobj.rst:3118 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: c-api/typeobj.rst:2578 +#: c-api/typeobj.rst:3128 +msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" +msgstr "" + +#: c-api/typeobj.rst:3130 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: c-api/typeobj.rst:2587 +#: c-api/typeobj.rst:3139 msgid "Slot Type typedefs" msgstr "" -#: c-api/typeobj.rst:2591 +#: c-api/typeobj.rst:3143 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -3344,80 +4236,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: c-api/typeobj.rst:2601 +#: c-api/typeobj.rst:3153 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: c-api/typeobj.rst:2608 +#: c-api/typeobj.rst:3160 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "" -#: c-api/typeobj.rst:2612 +#: c-api/typeobj.rst:3164 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "" -#: c-api/typeobj.rst:2616 +#: c-api/typeobj.rst:3168 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: c-api/typeobj.rst:2620 +#: c-api/typeobj.rst:3172 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "" -#: c-api/typeobj.rst:2633 +#: c-api/typeobj.rst:3185 msgid "Return the value of the named attribute for the object." msgstr "" -#: c-api/typeobj.rst:2639 +#: c-api/typeobj.rst:3191 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: c-api/typeobj.rst:2635 +#: c-api/typeobj.rst:3187 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "" -#: c-api/typeobj.rst:2642 +#: c-api/typeobj.rst:3194 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "" -#: c-api/typeobj.rst:2646 +#: c-api/typeobj.rst:3198 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "" -#: c-api/typeobj.rst:2650 +#: c-api/typeobj.rst:3202 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "" -#: c-api/typeobj.rst:2654 +#: c-api/typeobj.rst:3206 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "" -#: c-api/typeobj.rst:2658 +#: c-api/typeobj.rst:3210 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "" -#: c-api/typeobj.rst:2662 +#: c-api/typeobj.rst:3214 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "" -#: c-api/typeobj.rst:2666 +#: c-api/typeobj.rst:3218 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "" -#: c-api/typeobj.rst:2680 +#: c-api/typeobj.rst:3232 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "" -#: c-api/typeobj.rst:2696 +#: c-api/typeobj.rst:3248 msgid "Examples" msgstr "" -#: c-api/typeobj.rst:2698 +#: c-api/typeobj.rst:3250 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3425,46 +4317,179 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: c-api/typeobj.rst:2703 +#: c-api/typeobj.rst:3255 msgid "A basic :ref:`static type `::" msgstr "" -#: c-api/typeobj.rst:2720 +#: c-api/typeobj.rst:3257 +msgid "" +"typedef struct {\n" +" PyObject_HEAD\n" +" const char *data;\n" +"} MyObject;\n" +"\n" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyObject\",\n" +" .tp_basicsize = sizeof(MyObject),\n" +" .tp_doc = PyDoc_STR(\"My objects\"),\n" +" .tp_new = myobj_new,\n" +" .tp_dealloc = (destructor)myobj_dealloc,\n" +" .tp_repr = (reprfunc)myobj_repr,\n" +"};" +msgstr "" + +#: c-api/typeobj.rst:3272 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: c-api/typeobj.rst:2764 +#: c-api/typeobj.rst:3275 +msgid "" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" \"mymod.MyObject\", /* tp_name */\n" +" sizeof(MyObject), /* tp_basicsize */\n" +" 0, /* tp_itemsize */\n" +" (destructor)myobj_dealloc, /* tp_dealloc */\n" +" 0, /* tp_vectorcall_offset */\n" +" 0, /* tp_getattr */\n" +" 0, /* tp_setattr */\n" +" 0, /* tp_as_async */\n" +" (reprfunc)myobj_repr, /* tp_repr */\n" +" 0, /* tp_as_number */\n" +" 0, /* tp_as_sequence */\n" +" 0, /* tp_as_mapping */\n" +" 0, /* tp_hash */\n" +" 0, /* tp_call */\n" +" 0, /* tp_str */\n" +" 0, /* tp_getattro */\n" +" 0, /* tp_setattro */\n" +" 0, /* tp_as_buffer */\n" +" 0, /* tp_flags */\n" +" PyDoc_STR(\"My objects\"), /* tp_doc */\n" +" 0, /* tp_traverse */\n" +" 0, /* tp_clear */\n" +" 0, /* tp_richcompare */\n" +" 0, /* tp_weaklistoffset */\n" +" 0, /* tp_iter */\n" +" 0, /* tp_iternext */\n" +" 0, /* tp_methods */\n" +" 0, /* tp_members */\n" +" 0, /* tp_getset */\n" +" 0, /* tp_base */\n" +" 0, /* tp_dict */\n" +" 0, /* tp_descr_get */\n" +" 0, /* tp_descr_set */\n" +" 0, /* tp_dictoffset */\n" +" 0, /* tp_init */\n" +" 0, /* tp_alloc */\n" +" myobj_new, /* tp_new */\n" +"};" +msgstr "" + +#: c-api/typeobj.rst:3316 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: c-api/typeobj.rst:2789 +#: c-api/typeobj.rst:3318 +msgid "" +"typedef struct {\n" +" PyObject_HEAD\n" +" const char *data;\n" +"} MyObject;\n" +"\n" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyObject\",\n" +" .tp_basicsize = sizeof(MyObject),\n" +" .tp_doc = PyDoc_STR(\"My objects\"),\n" +" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |\n" +" Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_MANAGED_DICT |\n" +" Py_TPFLAGS_MANAGED_WEAKREF,\n" +" .tp_new = myobj_new,\n" +" .tp_traverse = (traverseproc)myobj_traverse,\n" +" .tp_clear = (inquiry)myobj_clear,\n" +" .tp_alloc = PyType_GenericNew,\n" +" .tp_dealloc = (destructor)myobj_dealloc,\n" +" .tp_repr = (reprfunc)myobj_repr,\n" +" .tp_hash = (hashfunc)myobj_hash,\n" +" .tp_richcompare = PyBaseObject_Type.tp_richcompare,\n" +"};" +msgstr "" + +#: c-api/typeobj.rst:3341 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: c-api/typeobj.rst:2808 +#: c-api/typeobj.rst:3345 +msgid "" +"typedef struct {\n" +" PyUnicodeObject raw;\n" +" char *extra;\n" +"} MyStr;\n" +"\n" +"static PyTypeObject MyStr_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyStr\",\n" +" .tp_basicsize = sizeof(MyStr),\n" +" .tp_base = NULL, // set to &PyUnicode_Type in module init\n" +" .tp_doc = PyDoc_STR(\"my custom str\"),\n" +" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,\n" +" .tp_repr = (reprfunc)myobj_repr,\n" +"};" +msgstr "" + +#: c-api/typeobj.rst:3360 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: c-api/typeobj.rst:2819 +#: c-api/typeobj.rst:3362 +msgid "" +"typedef struct {\n" +" PyObject_HEAD\n" +"} MyObject;\n" +"\n" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyObject\",\n" +"};" +msgstr "" + +#: c-api/typeobj.rst:3371 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: c-api/typeobj.rst:874 +#: c-api/typeobj.rst:3373 +msgid "" +"typedef struct {\n" +" PyObject_VAR_HEAD\n" +" const char *data[1];\n" +"} MyObject;\n" +"\n" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyObject\",\n" +" .tp_basicsize = sizeof(MyObject) - sizeof(char *),\n" +" .tp_itemsize = sizeof(char *),\n" +"};" +msgstr "" + +#: c-api/typeobj.rst:987 msgid "built-in function" msgstr "" -#: c-api/typeobj.rst:809 +#: c-api/typeobj.rst:920 msgid "repr" msgstr "" -#: c-api/typeobj.rst:874 +#: c-api/typeobj.rst:987 msgid "hash" msgstr "" diff --git a/c-api/unicode.po b/c-api/unicode.po index a8fedc46..fc5e005f 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -55,72 +56,57 @@ msgid "" "in Python:" msgstr "" -#: c-api/unicode.rst:38 +#: c-api/unicode.rst:36 msgid "" -"These types are typedefs for unsigned integer types wide enough to contain " -"characters of 32 bits, 16 bits and 8 bits, respectively. When dealing with " -"single Unicode characters, use :c:type:`Py_UCS4`." +"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " +"It is exposed to Python code as :py:class:`str`." msgstr "" -#: c-api/unicode.rst:47 +#: c-api/unicode.rst:42 msgid "" -"This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit " -"type depending on the platform." +"This instance of :c:type:`PyTypeObject` represents the Python Unicode " +"iterator type. It is used to iterate over Unicode string objects." msgstr "" #: c-api/unicode.rst:50 msgid "" -"In previous versions, this was a 16-bit type or a 32-bit type depending on " -"whether you selected a \"narrow\" or \"wide\" Unicode version of Python at " -"build time." +"These types are typedefs for unsigned integer types wide enough to contain " +"characters of 32 bits, 16 bits and 8 bits, respectively. When dealing with " +"single Unicode characters, use :c:type:`Py_UCS4`." msgstr "" -#: c-api/unicode.rst:60 +#: c-api/unicode.rst:61 msgid "" "These subtypes of :c:type:`PyObject` represent a Python Unicode object. In " "almost all cases, they shouldn't be used directly, since all API functions " "that deal with Unicode objects take and return :c:type:`PyObject` pointers." msgstr "" -#: c-api/unicode.rst:69 -msgid "" -"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " -"It is exposed to Python code as ``str``." -msgstr "" - -#: c-api/unicode.rst:73 +#: c-api/unicode.rst:68 msgid "" "The following APIs are C macros and static inlined functions for fast checks " "and access to internal read-only data of Unicode objects:" msgstr "" -#: c-api/unicode.rst:78 +#: c-api/unicode.rst:73 msgid "" "Return true if the object *obj* is a Unicode object or an instance of a " "Unicode subtype. This function always succeeds." msgstr "" -#: c-api/unicode.rst:84 +#: c-api/unicode.rst:79 msgid "" "Return true if the object *obj* is a Unicode object, but not an instance of " "a subtype. This function always succeeds." msgstr "" -#: c-api/unicode.rst:90 -msgid "Returns ``0``. This API is kept only for backward compatibility." -msgstr "" - -#: c-api/unicode.rst:94 -msgid "This API does nothing since Python 3.12." -msgstr "" - -#: c-api/unicode.rst:100 +#: c-api/unicode.rst:85 msgid "" "Return the length of the Unicode string, in code points. *unicode* has to " "be a Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: c-api/unicode.rst:110 +#: c-api/unicode.rst:95 msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " @@ -128,15 +114,15 @@ msgid "" "`PyUnicode_KIND` to select the right function." msgstr "" -#: c-api/unicode.rst:122 +#: c-api/unicode.rst:107 msgid "Return values of the :c:func:`PyUnicode_KIND` macro." msgstr "" -#: c-api/unicode.rst:126 +#: c-api/unicode.rst:111 msgid "``PyUnicode_WCHAR_KIND`` has been removed." msgstr "" -#: c-api/unicode.rst:132 +#: c-api/unicode.rst:117 msgid "" "Return one of the PyUnicode kind constants (see above) that indicate how " "many bytes per character this Unicode object uses to store its data. " @@ -144,209 +130,266 @@ msgid "" "(not checked)." msgstr "" -#: c-api/unicode.rst:141 +#: c-api/unicode.rst:126 msgid "" "Return a void pointer to the raw Unicode buffer. *unicode* has to be a " "Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: c-api/unicode.rst:150 +#: c-api/unicode.rst:135 msgid "" -"Write into a canonical representation *data* (as obtained with :c:func:" -"`PyUnicode_DATA`). This function performs no sanity checks, and is intended " -"for usage in loops. The caller should cache the *kind* value and *data* " -"pointer as obtained from other calls. *index* is the index in the string " -"(starts at 0) and *value* is the new code point value which should be " -"written to that location." +"Write the code point *value* to the given zero-based *index* in a string." msgstr "" -#: c-api/unicode.rst:163 +#: c-api/unicode.rst:137 +msgid "" +"The *kind* value and *data* pointer must have been obtained from a string " +"using :c:func:`PyUnicode_KIND` and :c:func:`PyUnicode_DATA` respectively. " +"You must hold a reference to that string while calling :c:func:`!" +"PyUnicode_WRITE`. All requirements of :c:func:`PyUnicode_WriteChar` also " +"apply." +msgstr "" + +#: c-api/unicode.rst:143 +msgid "" +"The function performs no checks for any of its requirements, and is intended " +"for usage in loops." +msgstr "" + +#: c-api/unicode.rst:152 msgid "" "Read a code point from a canonical representation *data* (as obtained with :" "c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" -#: c-api/unicode.rst:171 +#: c-api/unicode.rst:160 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " "\"canonical\" representation. This is less efficient than :c:func:" "`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" -#: c-api/unicode.rst:180 +#: c-api/unicode.rst:169 msgid "" "Return the maximum code point that is suitable for creating another string " "based on *unicode*, which must be in the \"canonical\" representation. This " "is always an approximation but more efficient than iterating over the string." msgstr "" -#: c-api/unicode.rst:189 +#: c-api/unicode.rst:178 msgid "" "Return ``1`` if the string is a valid identifier according to the language " "definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" -#: c-api/unicode.rst:192 +#: c-api/unicode.rst:181 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" -#: c-api/unicode.rst:198 +#: c-api/unicode.rst:188 +msgid "" +"Return true if the string only contains ASCII characters. Equivalent to :py:" +"meth:`str.isascii`." +msgstr "" + +#: c-api/unicode.rst:195 msgid "Unicode Character Properties" msgstr "" -#: c-api/unicode.rst:200 +#: c-api/unicode.rst:197 msgid "" "Unicode provides many different character properties. The most often needed " "ones are available through these macros which are mapped to C functions " "depending on the Python configuration." msgstr "" -#: c-api/unicode.rst:207 +#: c-api/unicode.rst:204 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." msgstr "" -#: c-api/unicode.rst:212 +#: c-api/unicode.rst:209 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." msgstr "" -#: c-api/unicode.rst:217 +#: c-api/unicode.rst:214 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." msgstr "" -#: c-api/unicode.rst:222 +#: c-api/unicode.rst:219 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." msgstr "" -#: c-api/unicode.rst:227 +#: c-api/unicode.rst:224 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." msgstr "" -#: c-api/unicode.rst:232 +#: c-api/unicode.rst:229 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." msgstr "" -#: c-api/unicode.rst:237 +#: c-api/unicode.rst:234 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." msgstr "" -#: c-api/unicode.rst:242 +#: c-api/unicode.rst:239 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." msgstr "" -#: c-api/unicode.rst:247 +#: c-api/unicode.rst:244 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." msgstr "" -#: c-api/unicode.rst:252 +#: c-api/unicode.rst:249 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "" -#: c-api/unicode.rst:257 +#: c-api/unicode.rst:254 msgid "" -"Return ``1`` or ``0`` depending on whether *ch* is a printable character. " -"Nonprintable characters are those characters defined in the Unicode " -"character database as \"Other\" or \"Separator\", excepting the ASCII space " -"(0x20) which is considered printable. (Note that printable characters in " -"this context are those which should not be escaped when :func:`repr` is " -"invoked on a string. It has no bearing on the handling of strings written " -"to :data:`sys.stdout` or :data:`sys.stderr`.)" +"Return ``1`` or ``0`` depending on whether *ch* is a printable character, in " +"the sense of :meth:`str.isprintable`." msgstr "" -#: c-api/unicode.rst:266 +#: c-api/unicode.rst:258 msgid "These APIs can be used for fast direct character conversions:" msgstr "" -#: c-api/unicode.rst:271 +#: c-api/unicode.rst:263 msgid "Return the character *ch* converted to lower case." msgstr "" -#: c-api/unicode.rst:281 c-api/unicode.rst:289 -msgid "This function uses simple case mappings." -msgstr "" - -#: c-api/unicode.rst:279 +#: c-api/unicode.rst:268 msgid "Return the character *ch* converted to upper case." msgstr "" -#: c-api/unicode.rst:287 +#: c-api/unicode.rst:273 msgid "Return the character *ch* converted to title case." msgstr "" -#: c-api/unicode.rst:295 +#: c-api/unicode.rst:278 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." msgstr "" -#: c-api/unicode.rst:301 +#: c-api/unicode.rst:284 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." msgstr "" -#: c-api/unicode.rst:307 +#: c-api/unicode.rst:290 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." msgstr "" -#: c-api/unicode.rst:311 +#: c-api/unicode.rst:294 msgid "These APIs can be used to work with surrogates:" msgstr "" -#: c-api/unicode.rst:315 +#: c-api/unicode.rst:298 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "" -#: c-api/unicode.rst:319 +#: c-api/unicode.rst:302 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" -#: c-api/unicode.rst:323 +#: c-api/unicode.rst:306 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" -#: c-api/unicode.rst:327 +#: c-api/unicode.rst:310 +msgid "" +"Return the high UTF-16 surrogate (``0xD800`` to ``0xDBFF``) for a Unicode " +"code point in the range ``[0x10000; 0x10FFFF]``." +msgstr "" + +#: c-api/unicode.rst:315 msgid "" -"Join two surrogate characters and return a single :c:type:`Py_UCS4` value. " +"Return the low UTF-16 surrogate (``0xDC00`` to ``0xDFFF``) for a Unicode " +"code point in the range ``[0x10000; 0x10FFFF]``." +msgstr "" + +#: c-api/unicode.rst:320 +msgid "" +"Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " -"surrogate pair. *high* must be in the range [0xD800; 0xDBFF] and *low* must " -"be in the range [0xDC00; 0xDFFF]." +"surrogate pair. *high* must be in the range ``[0xD800; 0xDBFF]`` and *low* " +"must be in the range ``[0xDC00; 0xDFFF]``." msgstr "" -#: c-api/unicode.rst:334 +#: c-api/unicode.rst:327 msgid "Creating and accessing Unicode strings" msgstr "" -#: c-api/unicode.rst:336 +#: c-api/unicode.rst:329 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" -#: c-api/unicode.rst:341 +#: c-api/unicode.rst:334 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" -#: c-api/unicode.rst:345 +#: c-api/unicode.rst:338 +msgid "On error, set an exception and return ``NULL``." +msgstr "" + +#: c-api/unicode.rst:340 msgid "" -"This is the recommended way to allocate a new Unicode object. Objects " -"created using this function are not resizable." +"After creation, the string can be filled by :c:func:`PyUnicode_WriteChar`, :" +"c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:" +"`PyUnicode_WRITE` or similar. Since strings are supposed to be immutable, " +"take care to not “use” the result while it is being modified. In particular, " +"before it's filled with its final contents, a string:" +msgstr "" + +#: c-api/unicode.rst:347 +msgid "must not be hashed," +msgstr "" + +#: c-api/unicode.rst:348 +msgid "" +"must not be :c:func:`converted to UTF-8 `, or " +"another non-\"canonical\" representation," +msgstr "" + +#: c-api/unicode.rst:350 +msgid "must not have its reference count changed," +msgstr "" + +#: c-api/unicode.rst:351 +msgid "must not be shared with code that might do one of the above." msgstr "" -#: c-api/unicode.rst:354 +#: c-api/unicode.rst:353 +msgid "" +"This list is not exhaustive. Avoiding these uses is your responsibility; " +"Python does not always check these requirements." +msgstr "" + +#: c-api/unicode.rst:356 +msgid "" +"To avoid accidentally exposing a partially-written string object, prefer " +"using the :c:type:`PyUnicodeWriter` API, or one of the ``PyUnicode_From*`` " +"functions below." +msgstr "" + +#: c-api/unicode.rst:367 msgid "" "Create a new Unicode object with the given *kind* (possible values are :c:" "macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" @@ -354,7 +397,7 @@ msgid "" "1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: c-api/unicode.rst:359 +#: c-api/unicode.rst:372 msgid "" "If necessary, the input *buffer* is copied and transformed into the " "canonical representation. For example, if the *buffer* is a UCS4 string (:c:" @@ -362,7 +405,7 @@ msgid "" "range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: c-api/unicode.rst:370 +#: c-api/unicode.rst:383 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -370,29 +413,29 @@ msgid "" "data is not allowed." msgstr "" -#: c-api/unicode.rst:376 +#: c-api/unicode.rst:389 msgid "This function raises :exc:`SystemError` when:" msgstr "" -#: c-api/unicode.rst:378 +#: c-api/unicode.rst:391 msgid "*size* < 0," msgstr "" -#: c-api/unicode.rst:379 +#: c-api/unicode.rst:392 msgid "*str* is ``NULL`` and *size* > 0" msgstr "" -#: c-api/unicode.rst:381 +#: c-api/unicode.rst:394 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." msgstr "" -#: c-api/unicode.rst:387 +#: c-api/unicode.rst:400 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: c-api/unicode.rst:393 +#: c-api/unicode.rst:406 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -401,23 +444,23 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: c-api/unicode.rst:399 +#: c-api/unicode.rst:412 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: c-api/unicode.rst:402 +#: c-api/unicode.rst:415 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: c-api/unicode.rst:404 +#: c-api/unicode.rst:417 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: c-api/unicode.rst:407 +#: c-api/unicode.rst:420 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is given in the next argument, which must be of type :c:expr:" @@ -425,7 +468,7 @@ msgid "" "optional precision." msgstr "" -#: c-api/unicode.rst:412 +#: c-api/unicode.rst:425 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -433,268 +476,312 @@ msgid "" "comes after the precision." msgstr "" -#: c-api/unicode.rst:417 +#: c-api/unicode.rst:430 msgid "Length modifier (optional)." msgstr "" -#: c-api/unicode.rst:419 +#: c-api/unicode.rst:432 msgid "Conversion type." msgstr "" -#: c-api/unicode.rst:421 +#: c-api/unicode.rst:434 msgid "The conversion flag characters are:" msgstr "" -#: c-api/unicode.rst:426 +#: c-api/unicode.rst:439 msgid "Flag" msgstr "" -#: c-api/unicode.rst:426 +#: c-api/unicode.rst:439 msgid "Meaning" msgstr "" -#: c-api/unicode.rst:428 +#: c-api/unicode.rst:441 msgid "``0``" msgstr "" -#: c-api/unicode.rst:428 +#: c-api/unicode.rst:441 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: c-api/unicode.rst:430 +#: c-api/unicode.rst:443 msgid "``-``" msgstr "" -#: c-api/unicode.rst:430 +#: c-api/unicode.rst:443 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: c-api/unicode.rst:434 +#: c-api/unicode.rst:447 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: c-api/unicode.rst:441 +#: c-api/unicode.rst:454 msgid "Modifier" msgstr "" -#: c-api/unicode.rst:441 +#: c-api/unicode.rst:454 msgid "Types" msgstr "" -#: c-api/unicode.rst:443 +#: c-api/unicode.rst:456 msgid "``l``" msgstr "" -#: c-api/unicode.rst:443 +#: c-api/unicode.rst:456 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr "" -#: c-api/unicode.rst:445 +#: c-api/unicode.rst:458 msgid "``ll``" msgstr "" -#: c-api/unicode.rst:445 +#: c-api/unicode.rst:458 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr "" -#: c-api/unicode.rst:447 +#: c-api/unicode.rst:460 msgid "``j``" msgstr "" -#: c-api/unicode.rst:447 +#: c-api/unicode.rst:460 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr "" -#: c-api/unicode.rst:449 +#: c-api/unicode.rst:462 msgid "``z``" msgstr "" -#: c-api/unicode.rst:449 +#: c-api/unicode.rst:462 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr "" -#: c-api/unicode.rst:451 +#: c-api/unicode.rst:464 msgid "``t``" msgstr "" -#: c-api/unicode.rst:451 +#: c-api/unicode.rst:464 msgid ":c:type:`ptrdiff_t`" msgstr "" -#: c-api/unicode.rst:454 +#: c-api/unicode.rst:467 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: c-api/unicode.rst:457 +#: c-api/unicode.rst:470 msgid "The conversion specifiers are:" msgstr "" -#: c-api/unicode.rst:463 +#: c-api/unicode.rst:476 msgid "Conversion Specifier" msgstr "" -#: c-api/unicode.rst:464 +#: c-api/unicode.rst:477 msgid "Type" msgstr "" -#: c-api/unicode.rst:465 +#: c-api/unicode.rst:478 msgid "Comment" msgstr "" -#: c-api/unicode.rst:467 +#: c-api/unicode.rst:480 msgid "``%``" msgstr "" -#: c-api/unicode.rst:468 +#: c-api/unicode.rst:481 msgid "*n/a*" msgstr "" -#: c-api/unicode.rst:469 +#: c-api/unicode.rst:482 msgid "The literal ``%`` character." msgstr "" -#: c-api/unicode.rst:471 +#: c-api/unicode.rst:484 msgid "``d``, ``i``" msgstr "" -#: c-api/unicode.rst:476 c-api/unicode.rst:484 c-api/unicode.rst:488 +#: c-api/unicode.rst:489 c-api/unicode.rst:497 c-api/unicode.rst:501 msgid "Specified by the length modifier" msgstr "" -#: c-api/unicode.rst:473 +#: c-api/unicode.rst:486 msgid "The decimal representation of a signed C integer." msgstr "" -#: c-api/unicode.rst:475 +#: c-api/unicode.rst:488 msgid "``u``" msgstr "" -#: c-api/unicode.rst:477 +#: c-api/unicode.rst:490 msgid "The decimal representation of an unsigned C integer." msgstr "" -#: c-api/unicode.rst:479 +#: c-api/unicode.rst:492 msgid "``o``" msgstr "" -#: c-api/unicode.rst:481 +#: c-api/unicode.rst:494 msgid "The octal representation of an unsigned C integer." msgstr "" -#: c-api/unicode.rst:483 +#: c-api/unicode.rst:496 msgid "``x``" msgstr "" -#: c-api/unicode.rst:485 +#: c-api/unicode.rst:498 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "" -#: c-api/unicode.rst:487 +#: c-api/unicode.rst:500 msgid "``X``" msgstr "" -#: c-api/unicode.rst:489 +#: c-api/unicode.rst:502 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "" -#: c-api/unicode.rst:491 +#: c-api/unicode.rst:504 msgid "``c``" msgstr "" -#: c-api/unicode.rst:492 +#: c-api/unicode.rst:505 msgid ":c:expr:`int`" msgstr "" -#: c-api/unicode.rst:493 +#: c-api/unicode.rst:506 msgid "A single character." msgstr "" -#: c-api/unicode.rst:495 +#: c-api/unicode.rst:508 msgid "``s``" msgstr "" -#: c-api/unicode.rst:496 +#: c-api/unicode.rst:509 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr "" -#: c-api/unicode.rst:497 +#: c-api/unicode.rst:510 msgid "A null-terminated C character array." msgstr "" -#: c-api/unicode.rst:499 +#: c-api/unicode.rst:512 msgid "``p``" msgstr "" -#: c-api/unicode.rst:500 +#: c-api/unicode.rst:513 msgid ":c:expr:`const void*`" msgstr "" -#: c-api/unicode.rst:501 +#: c-api/unicode.rst:514 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: c-api/unicode.rst:506 +#: c-api/unicode.rst:519 msgid "``A``" msgstr "" -#: c-api/unicode.rst:511 c-api/unicode.rst:525 +#: c-api/unicode.rst:524 c-api/unicode.rst:538 c-api/unicode.rst:547 msgid ":c:expr:`PyObject*`" msgstr "" -#: c-api/unicode.rst:508 +#: c-api/unicode.rst:521 msgid "The result of calling :func:`ascii`." msgstr "" -#: c-api/unicode.rst:510 +#: c-api/unicode.rst:523 msgid "``U``" msgstr "" -#: c-api/unicode.rst:512 +#: c-api/unicode.rst:525 msgid "A Unicode object." msgstr "" -#: c-api/unicode.rst:514 +#: c-api/unicode.rst:527 msgid "``V``" msgstr "" -#: c-api/unicode.rst:515 +#: c-api/unicode.rst:528 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr "" -#: c-api/unicode.rst:516 +#: c-api/unicode.rst:529 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: c-api/unicode.rst:520 +#: c-api/unicode.rst:533 msgid "``S``" msgstr "" -#: c-api/unicode.rst:522 +#: c-api/unicode.rst:535 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "" -#: c-api/unicode.rst:524 +#: c-api/unicode.rst:537 msgid "``R``" msgstr "" -#: c-api/unicode.rst:526 +#: c-api/unicode.rst:539 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "" -#: c-api/unicode.rst:529 +#: c-api/unicode.rst:541 +msgid "``T``" +msgstr "" + +#: c-api/unicode.rst:543 +msgid "" +"Get the fully qualified name of an object type; call :c:func:" +"`PyType_GetFullyQualifiedName`." +msgstr "" + +#: c-api/unicode.rst:546 +msgid "``#T``" +msgstr "" + +#: c-api/unicode.rst:548 +msgid "" +"Similar to ``T`` format, but use a colon (``:``) as separator between the " +"module name and the qualified name." +msgstr "" + +#: c-api/unicode.rst:551 +msgid "``N``" +msgstr "" + +#: c-api/unicode.rst:557 +msgid ":c:expr:`PyTypeObject*`" +msgstr "" + +#: c-api/unicode.rst:553 +msgid "" +"Get the fully qualified name of a type; call :c:func:" +"`PyType_GetFullyQualifiedName`." +msgstr "" + +#: c-api/unicode.rst:556 +msgid "``#N``" +msgstr "" + +#: c-api/unicode.rst:558 +msgid "" +"Similar to ``N`` format, but use a colon (``:``) as separator between the " +"module name and the qualified name." +msgstr "" + +#: c-api/unicode.rst:562 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -704,28 +791,28 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: c-api/unicode.rst:537 +#: c-api/unicode.rst:570 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: c-api/unicode.rst:541 +#: c-api/unicode.rst:574 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "" -#: c-api/unicode.rst:544 +#: c-api/unicode.rst:577 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "" -#: c-api/unicode.rst:547 +#: c-api/unicode.rst:580 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" -#: c-api/unicode.rst:551 +#: c-api/unicode.rst:584 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -734,36 +821,50 @@ msgid "" "flag ``-``." msgstr "" -#: c-api/unicode.rst:559 +#: c-api/unicode.rst:592 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: c-api/unicode.rst:566 +#: c-api/unicode.rst:596 +msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." +msgstr "" + +#: c-api/unicode.rst:602 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: c-api/unicode.rst:572 +#: c-api/unicode.rst:608 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: c-api/unicode.rst:576 +#: c-api/unicode.rst:612 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" -#: c-api/unicode.rst:582 +#: c-api/unicode.rst:617 +msgid "Create a Unicode Object from the given Unicode code point *ordinal*." +msgstr "" + +#: c-api/unicode.rst:619 +msgid "" +"The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in " +"the case it is not." +msgstr "" + +#: c-api/unicode.rst:626 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -#: c-api/unicode.rst:584 +#: c-api/unicode.rst:628 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " @@ -771,23 +872,69 @@ msgid "" "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: c-api/unicode.rst:590 +#: c-api/unicode.rst:634 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: c-api/unicode.rst:593 +#: c-api/unicode.rst:637 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: c-api/unicode.rst:599 +#: c-api/unicode.rst:643 +msgid "" +"Append the string *right* to the end of *p_left*. *p_left* must point to a :" +"term:`strong reference` to a Unicode object; :c:func:`!PyUnicode_Append` " +"releases (\"steals\") this reference." +msgstr "" + +#: c-api/unicode.rst:647 +msgid "On error, set *\\*p_left* to ``NULL`` and set an exception." +msgstr "" + +#: c-api/unicode.rst:649 +msgid "On success, set *\\*p_left* to a new strong reference to the result." +msgstr "" + +#: c-api/unicode.rst:654 +msgid "" +"The function is similar to :c:func:`PyUnicode_Append`, with the only " +"difference being that it decrements the reference count of *right* by one." +msgstr "" + +#: c-api/unicode.rst:660 +msgid "" +"Return a mapping suitable for decoding a custom single-byte encoding. Given " +"a Unicode string *string* of up to 256 characters representing an encoding " +"table, returns either a compact internal mapping object or a dictionary " +"mapping character ordinals to byte values. Raises a :exc:`TypeError` and " +"return ``NULL`` on invalid input." +msgstr "" + +#: c-api/unicode.rst:671 +msgid "" +"Return the name of the default string encoding, ``\"utf-8\"``. See :func:" +"`sys.getdefaultencoding`." +msgstr "" + +#: c-api/unicode.rst:674 +msgid "" +"The returned string does not need to be freed, and is valid until " +"interpreter shutdown." +msgstr "" + +#: c-api/unicode.rst:680 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: c-api/unicode.rst:610 +#: c-api/unicode.rst:682 +msgid "On error, set an exception and return ``-1``." +msgstr "" + +#: c-api/unicode.rst:693 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -795,52 +942,87 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: c-api/unicode.rst:621 +#: c-api/unicode.rst:728 c-api/unicode.rst:748 +msgid "" +"The string must not have been “used” yet. See :c:func:`PyUnicode_New` for " +"details." +msgstr "" + +#: c-api/unicode.rst:706 +msgid "" +"Resize a Unicode object *\\*unicode* to the new *length* in code points." +msgstr "" + +#: c-api/unicode.rst:708 +msgid "" +"Try to resize the string in place (which is usually faster than allocating a " +"new string and copying characters), or create a new string." +msgstr "" + +#: c-api/unicode.rst:711 +msgid "" +"*\\*unicode* is modified to point to the new (resized) object and ``0`` is " +"returned on success. Otherwise, ``-1`` is returned and an exception is set, " +"and *\\*unicode* is left untouched." +msgstr "" + +#: c-api/unicode.rst:715 +msgid "" +"The function doesn't check string content, the result may not be a string in " +"canonical representation." +msgstr "" + +#: c-api/unicode.rst:722 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" -#: c-api/unicode.rst:624 +#: c-api/unicode.rst:725 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: c-api/unicode.rst:627 +#: c-api/unicode.rst:731 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: c-api/unicode.rst:636 +#: c-api/unicode.rst:740 msgid "" -"Write a character to a string. The string must have been created through :c:" -"func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " -"the string must not be shared, or have been hashed yet." +"Write a *character* to the string *unicode* at the zero-based *index*. " +"Return ``0`` on success, ``-1`` on error with an exception set." msgstr "" -#: c-api/unicode.rst:640 +#: c-api/unicode.rst:743 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " -"not out of bounds, and that the object can be modified safely (i.e. that it " -"its reference count is one)." +"not out of bounds, and that the object's reference count is one. See :c:func:" +"`PyUnicode_WRITE` for a version that skips these checks, making them your " +"responsibility." msgstr "" -#: c-api/unicode.rst:649 +#: c-api/unicode.rst:756 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" "`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: c-api/unicode.rst:659 +#: c-api/unicode.rst:760 +msgid "Return character on success, ``-1`` on error with an exception set." +msgstr "" + +#: c-api/unicode.rst:768 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " -"character index *end* (excluded). Negative indices are not supported." +"character index *end* (excluded). Negative indices are not supported. On " +"error, set an exception and return ``NULL``." msgstr "" -#: c-api/unicode.rst:668 +#: c-api/unicode.rst:778 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -848,7 +1030,7 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: c-api/unicode.rst:678 +#: c-api/unicode.rst:788 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -856,17 +1038,17 @@ msgid "" "appended." msgstr "" -#: c-api/unicode.rst:687 +#: c-api/unicode.rst:797 msgid "Locale Encoding" msgstr "" -#: c-api/unicode.rst:689 +#: c-api/unicode.rst:799 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: c-api/unicode.rst:696 +#: c-api/unicode.rst:806 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -875,21 +1057,21 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: c-api/unicode.rst:703 +#: c-api/unicode.rst:813 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" -#: c-api/unicode.rst:741 +#: c-api/unicode.rst:851 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "" -#: c-api/unicode.rst:807 +#: c-api/unicode.rst:936 msgid "The :c:func:`Py_DecodeLocale` function." msgstr "" -#: c-api/unicode.rst:714 +#: c-api/unicode.rst:824 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -897,13 +1079,13 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: c-api/unicode.rst:723 +#: c-api/unicode.rst:833 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" -#: c-api/unicode.rst:731 +#: c-api/unicode.rst:841 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -912,17 +1094,17 @@ msgid "" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: c-api/unicode.rst:738 +#: c-api/unicode.rst:848 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" -#: c-api/unicode.rst:838 +#: c-api/unicode.rst:967 msgid "The :c:func:`Py_EncodeLocale` function." msgstr "" -#: c-api/unicode.rst:749 +#: c-api/unicode.rst:859 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -930,102 +1112,123 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: c-api/unicode.rst:758 +#: c-api/unicode.rst:868 msgid "File System Encoding" msgstr "" -#: c-api/unicode.rst:760 +#: c-api/unicode.rst:870 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: c-api/unicode.rst:763 +#: c-api/unicode.rst:873 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " -"``\"O&\"`` converter should be used, passing :c:func:`PyUnicode_FSConverter` " -"as the conversion function:" +"``\"O&\"`` converter should be used, passing :c:func:`!" +"PyUnicode_FSConverter` as the conversion function:" msgstr "" -#: c-api/unicode.rst:769 +#: c-api/unicode.rst:879 msgid "" -"ParseTuple converter: encode :class:`str` objects -- obtained directly or " -"through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:" -"func:`PyUnicode_EncodeFSDefault`; :class:`bytes` objects are output as-is. " -"*result* must be a :c:expr:`PyBytesObject*` which must be released when it " -"is no longer used." +":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " +"-- obtained directly or through the :class:`os.PathLike` interface -- to :" +"class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"objects are output as-is. *result* must be an address of a C variable of " +"type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " +"variable to a new :term:`strong reference` to a :ref:`bytes object " +"` which must be released when it is no longer used and return " +"a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null bytes are " +"not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" -#: c-api/unicode.rst:794 +#: c-api/unicode.rst:891 +msgid "" +"If *obj* is ``NULL``, the function releases a strong reference stored in the " +"variable referred by *result* and returns ``1``." +msgstr "" + +#: c-api/unicode.rst:923 msgid "Accepts a :term:`path-like object`." msgstr "" -#: c-api/unicode.rst:780 +#: c-api/unicode.rst:899 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " -"converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the " +"converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: c-api/unicode.rst:786 +#: c-api/unicode.rst:905 +msgid "" +":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " +"-- obtained either directly or indirectly through the :class:`os.PathLike` " +"interface -- to :class:`str` using :c:func:" +"`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. " +"*result* must be an address of a C variable of type :c:expr:`PyObject*` (or :" +"c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:" +"`strong reference` to a :ref:`Unicode object ` which must be " +"released when it is no longer used and return a non-zero value (:c:macro:" +"`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " +"result. On failure, return ``0`` with an exception set." +msgstr "" + +#: c-api/unicode.rst:918 msgid "" -"ParseTuple converter: decode :class:`bytes` objects -- obtained either " -"directly or indirectly through the :class:`os.PathLike` interface -- to :" -"class:`str` using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` " -"objects are output as-is. *result* must be a :c:expr:`PyUnicodeObject*` " -"which must be released when it is no longer used." +"If *obj* is ``NULL``, release the strong reference to the object referred to " +"by *result* and return ``1``." msgstr "" -#: c-api/unicode.rst:800 +#: c-api/unicode.rst:929 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: c-api/unicode.rst:802 +#: c-api/unicode.rst:931 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: c-api/unicode.rst:822 c-api/unicode.rst:842 +#: c-api/unicode.rst:951 c-api/unicode.rst:971 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: c-api/unicode.rst:816 +#: c-api/unicode.rst:945 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: c-api/unicode.rst:819 +#: c-api/unicode.rst:948 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "" -#: c-api/unicode.rst:829 +#: c-api/unicode.rst:958 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: c-api/unicode.rst:833 +#: c-api/unicode.rst:962 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" -#: c-api/unicode.rst:847 +#: c-api/unicode.rst:976 msgid "wchar_t Support" msgstr "" -#: c-api/unicode.rst:849 +#: c-api/unicode.rst:978 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "" -#: c-api/unicode.rst:853 +#: c-api/unicode.rst:982 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1033,7 +1236,7 @@ msgid "" "failure." msgstr "" -#: c-api/unicode.rst:861 +#: c-api/unicode.rst:990 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " @@ -1041,13 +1244,13 @@ msgid "" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: c-api/unicode.rst:866 +#: c-api/unicode.rst:995 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: c-api/unicode.rst:869 +#: c-api/unicode.rst:998 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1057,7 +1260,7 @@ msgid "" "most C functions." msgstr "" -#: c-api/unicode.rst:879 +#: c-api/unicode.rst:1008 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1068,37 +1271,37 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: c-api/unicode.rst:887 +#: c-api/unicode.rst:1016 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: c-api/unicode.rst:894 +#: c-api/unicode.rst:1023 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: c-api/unicode.rst:902 +#: c-api/unicode.rst:1031 msgid "Built-in Codecs" msgstr "" -#: c-api/unicode.rst:904 +#: c-api/unicode.rst:1033 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: c-api/unicode.rst:907 +#: c-api/unicode.rst:1036 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: c-api/unicode.rst:911 +#: c-api/unicode.rst:1040 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1106,28 +1309,42 @@ msgid "" "handler` internally." msgstr "" -#: c-api/unicode.rst:916 +#: c-api/unicode.rst:1045 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: c-api/unicode.rst:920 +#: c-api/unicode.rst:1049 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: c-api/unicode.rst:925 +#: c-api/unicode.rst:1054 msgid "Generic Codecs" msgstr "" -#: c-api/unicode.rst:927 +#: c-api/unicode.rst:1056 +msgid "The following macro is provided:" +msgstr "" + +#: c-api/unicode.rst:1061 +msgid "The Unicode code point ``U+FFFD`` (replacement character)." +msgstr "" + +#: c-api/unicode.rst:1063 +msgid "" +"This Unicode character is used as the replacement character during decoding " +"if the *errors* argument is set to \"replace\"." +msgstr "" + +#: c-api/unicode.rst:1067 msgid "These are the generic codec APIs:" msgstr "" -#: c-api/unicode.rst:933 +#: c-api/unicode.rst:1073 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1136,7 +1353,7 @@ msgid "" "was raised by the codec." msgstr "" -#: c-api/unicode.rst:943 +#: c-api/unicode.rst:1083 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1145,21 +1362,21 @@ msgid "" "was raised by the codec." msgstr "" -#: c-api/unicode.rst:951 +#: c-api/unicode.rst:1091 msgid "UTF-8 Codecs" msgstr "" -#: c-api/unicode.rst:953 +#: c-api/unicode.rst:1093 msgid "These are the UTF-8 codec APIs:" msgstr "" -#: c-api/unicode.rst:958 +#: c-api/unicode.rst:1098 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:965 +#: c-api/unicode.rst:1105 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1167,14 +1384,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: c-api/unicode.rst:973 +#: c-api/unicode.rst:1113 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: c-api/unicode.rst:980 +#: c-api/unicode.rst:1132 +msgid "" +"The function fails if the string contains surrogate code points (``U+D800`` " +"- ``U+DFFF``)." +msgstr "" + +#: c-api/unicode.rst:1123 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1183,13 +1406,13 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: c-api/unicode.rst:986 +#: c-api/unicode.rst:1129 msgid "" -"In the case of an error, ``NULL`` is returned with an exception set and no " -"*size* is stored." +"On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " +"return ``NULL``." msgstr "" -#: c-api/unicode.rst:989 +#: c-api/unicode.rst:1135 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1198,40 +1421,57 @@ msgid "" "collected." msgstr "" -#: c-api/unicode.rst:1009 +#: c-api/unicode.rst:1164 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "" -#: c-api/unicode.rst:999 +#: c-api/unicode.rst:1145 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: c-api/unicode.rst:1005 +#: c-api/unicode.rst:1151 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" -#: c-api/unicode.rst:1014 +#: c-api/unicode.rst:1155 +msgid "" +"This function does not have any special behavior for `null characters " +"`_ embedded within *unicode*. " +"As a result, strings containing null characters will remain in the returned " +"string, which some C functions might interpret as the end of the string, " +"leading to truncation. If truncation is an issue, it is recommended to use :" +"c:func:`PyUnicode_AsUTF8AndSize` instead." +msgstr "" + +#: c-api/unicode.rst:1169 msgid "UTF-32 Codecs" msgstr "" -#: c-api/unicode.rst:1016 +#: c-api/unicode.rst:1171 msgid "These are the UTF-32 codec APIs:" msgstr "" -#: c-api/unicode.rst:1022 +#: c-api/unicode.rst:1177 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: c-api/unicode.rst:1076 +#: c-api/unicode.rst:1231 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: c-api/unicode.rst:1033 +#: c-api/unicode.rst:1234 +msgid "" +"*byteorder == -1: little endian\n" +"*byteorder == 0: native order\n" +"*byteorder == 1: big endian" +msgstr "" + +#: c-api/unicode.rst:1188 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1239,21 +1479,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: c-api/unicode.rst:1038 +#: c-api/unicode.rst:1193 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: c-api/unicode.rst:1092 +#: c-api/unicode.rst:1247 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: c-api/unicode.rst:1094 +#: c-api/unicode.rst:1249 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1049 +#: c-api/unicode.rst:1204 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1262,29 +1502,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: c-api/unicode.rst:1058 +#: c-api/unicode.rst:1213 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1064 +#: c-api/unicode.rst:1219 msgid "UTF-16 Codecs" msgstr "" -#: c-api/unicode.rst:1066 +#: c-api/unicode.rst:1221 msgid "These are the UTF-16 codec APIs:" msgstr "" -#: c-api/unicode.rst:1072 +#: c-api/unicode.rst:1227 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: c-api/unicode.rst:1083 +#: c-api/unicode.rst:1238 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1293,13 +1533,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: c-api/unicode.rst:1089 +#: c-api/unicode.rst:1244 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: c-api/unicode.rst:1100 +#: c-api/unicode.rst:1255 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1309,28 +1549,28 @@ msgid "" "*consumed*." msgstr "" -#: c-api/unicode.rst:1109 +#: c-api/unicode.rst:1264 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1115 +#: c-api/unicode.rst:1270 msgid "UTF-7 Codecs" msgstr "" -#: c-api/unicode.rst:1117 +#: c-api/unicode.rst:1272 msgid "These are the UTF-7 codec APIs:" msgstr "" -#: c-api/unicode.rst:1122 +#: c-api/unicode.rst:1277 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1129 +#: c-api/unicode.rst:1284 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1338,101 +1578,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: c-api/unicode.rst:1136 +#: c-api/unicode.rst:1291 msgid "Unicode-Escape Codecs" msgstr "" -#: c-api/unicode.rst:1138 +#: c-api/unicode.rst:1293 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: c-api/unicode.rst:1144 +#: c-api/unicode.rst:1299 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: c-api/unicode.rst:1150 +#: c-api/unicode.rst:1305 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1156 +#: c-api/unicode.rst:1311 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: c-api/unicode.rst:1158 +#: c-api/unicode.rst:1313 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: c-api/unicode.rst:1164 +#: c-api/unicode.rst:1319 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: c-api/unicode.rst:1170 +#: c-api/unicode.rst:1325 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1176 +#: c-api/unicode.rst:1331 msgid "Latin-1 Codecs" msgstr "" -#: c-api/unicode.rst:1178 +#: c-api/unicode.rst:1333 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: c-api/unicode.rst:1184 +#: c-api/unicode.rst:1339 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1190 +#: c-api/unicode.rst:1345 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: c-api/unicode.rst:1196 +#: c-api/unicode.rst:1351 msgid "ASCII Codecs" msgstr "" -#: c-api/unicode.rst:1198 +#: c-api/unicode.rst:1353 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: c-api/unicode.rst:1204 +#: c-api/unicode.rst:1359 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1210 +#: c-api/unicode.rst:1365 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: c-api/unicode.rst:1216 +#: c-api/unicode.rst:1371 msgid "Character Map Codecs" msgstr "" -#: c-api/unicode.rst:1218 +#: c-api/unicode.rst:1373 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1442,18 +1682,18 @@ msgid "" "sequences work well." msgstr "" -#: c-api/unicode.rst:1224 +#: c-api/unicode.rst:1379 msgid "These are the mapping codec APIs:" msgstr "" -#: c-api/unicode.rst:1229 +#: c-api/unicode.rst:1384 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: c-api/unicode.rst:1233 +#: c-api/unicode.rst:1388 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1463,14 +1703,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: c-api/unicode.rst:1244 +#: c-api/unicode.rst:1399 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1248 +#: c-api/unicode.rst:1403 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1478,41 +1718,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: c-api/unicode.rst:1254 +#: c-api/unicode.rst:1409 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: c-api/unicode.rst:1258 +#: c-api/unicode.rst:1413 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: c-api/unicode.rst:1262 +#: c-api/unicode.rst:1417 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: c-api/unicode.rst:1265 +#: c-api/unicode.rst:1420 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: c-api/unicode.rst:1269 +#: c-api/unicode.rst:1424 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: c-api/unicode.rst:1274 +#: c-api/unicode.rst:1429 msgid "MBCS codecs for Windows" msgstr "" -#: c-api/unicode.rst:1276 +#: c-api/unicode.rst:1431 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1520,13 +1760,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: c-api/unicode.rst:1283 +#: c-api/unicode.rst:1438 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: c-api/unicode.rst:1290 +#: c-api/unicode.rst:1445 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1534,44 +1774,46 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: c-api/unicode.rst:1298 +#: c-api/unicode.rst:1454 +msgid "" +"Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " +"specified by *code_page*." +msgstr "" + +#: c-api/unicode.rst:1460 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: c-api/unicode.rst:1305 +#: c-api/unicode.rst:1467 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: c-api/unicode.rst:1313 -msgid "Methods & Slots" -msgstr "" - -#: c-api/unicode.rst:1319 +#: c-api/unicode.rst:1477 msgid "Methods and Slot Functions" msgstr "" -#: c-api/unicode.rst:1321 +#: c-api/unicode.rst:1479 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: c-api/unicode.rst:1325 +#: c-api/unicode.rst:1483 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" -#: c-api/unicode.rst:1330 +#: c-api/unicode.rst:1488 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: c-api/unicode.rst:1335 +#: c-api/unicode.rst:1493 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1580,27 +1822,72 @@ msgid "" "list." msgstr "" -#: c-api/unicode.rst:1343 +#: c-api/unicode.rst:1508 c-api/unicode.rst:1542 +msgid "On error, return ``NULL`` with an exception set." +msgstr "" + +#: c-api/unicode.rst:1500 +msgid "Equivalent to :py:meth:`str.split`." +msgstr "" + +#: c-api/unicode.rst:1505 +msgid "" +"Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " +"at the end of the string." +msgstr "" + +#: c-api/unicode.rst:1510 +msgid "Equivalent to :py:meth:`str.rsplit`." +msgstr "" + +#: c-api/unicode.rst:1515 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: c-api/unicode.rst:1350 +#: c-api/unicode.rst:1522 +msgid "" +"Split a Unicode string at the first occurrence of *sep*, and return a 3-" +"tuple containing the part before the separator, the separator itself, and " +"the part after the separator. If the separator is not found, return a 3-" +"tuple containing the string itself, followed by two empty strings." +msgstr "" + +#: c-api/unicode.rst:1540 +msgid "*sep* must not be empty." +msgstr "" + +#: c-api/unicode.rst:1531 +msgid "Equivalent to :py:meth:`str.partition`." +msgstr "" + +#: c-api/unicode.rst:1536 +msgid "" +"Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " +"last occurrence of *sep*. If the separator is not found, return a 3-tuple " +"containing two empty strings, followed by the string itself." +msgstr "" + +#: c-api/unicode.rst:1544 +msgid "Equivalent to :py:meth:`str.rpartition`." +msgstr "" + +#: c-api/unicode.rst:1549 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: c-api/unicode.rst:1357 +#: c-api/unicode.rst:1556 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: c-api/unicode.rst:1365 +#: c-api/unicode.rst:1564 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1609,7 +1896,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: c-api/unicode.rst:1375 +#: c-api/unicode.rst:1574 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1619,37 +1906,93 @@ msgid "" "set." msgstr "" -#: c-api/unicode.rst:1383 +#: c-api/unicode.rst:1582 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: c-api/unicode.rst:1390 +#: c-api/unicode.rst:1589 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: c-api/unicode.rst:1397 +#: c-api/unicode.rst:1596 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: c-api/unicode.rst:1404 +#: c-api/unicode.rst:1603 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: c-api/unicode.rst:1407 +#: c-api/unicode.rst:1606 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: c-api/unicode.rst:1413 +#: c-api/unicode.rst:1611 +msgid "The :c:func:`PyUnicode_Equal` function." +msgstr "" + +#: c-api/unicode.rst:1616 +msgid "Test if two strings are equal:" +msgstr "" + +#: c-api/unicode.rst:1618 +msgid "Return ``1`` if *a* is equal to *b*." +msgstr "" + +#: c-api/unicode.rst:1619 +msgid "Return ``0`` if *a* is not equal to *b*." +msgstr "" + +#: c-api/unicode.rst:1620 +msgid "" +"Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not a :" +"class:`str` object." +msgstr "" + +#: c-api/unicode.rst:1623 +msgid "The function always succeeds if *a* and *b* are :class:`str` objects." +msgstr "" + +#: c-api/unicode.rst:1625 +msgid "" +"The function works for :class:`str` subclasses, but does not honor custom " +"``__eq__()`` method." +msgstr "" + +#: c-api/unicode.rst:1630 +msgid "The :c:func:`PyUnicode_Compare` function." +msgstr "" + +#: c-api/unicode.rst:1637 +msgid "" +"Compare a Unicode object with a char buffer which is interpreted as being " +"UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " +"(``0``) otherwise. If the Unicode object contains surrogate code points " +"(``U+D800`` - ``U+DFFF``) or the C string is not valid UTF-8, false (``0``) " +"is returned." +msgstr "" + +#: c-api/unicode.rst:1665 +msgid "This function does not raise exceptions." +msgstr "" + +#: c-api/unicode.rst:1651 +msgid "" +"Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " +"length using :c:func:`!strlen`. If the Unicode object contains null " +"characters, false (``0``) is returned." +msgstr "" + +#: c-api/unicode.rst:1660 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1657,51 +2000,47 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: c-api/unicode.rst:1418 -msgid "This function does not raise exceptions." -msgstr "" - -#: c-api/unicode.rst:1423 +#: c-api/unicode.rst:1670 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: c-api/unicode.rst:1425 +#: c-api/unicode.rst:1672 msgid "``NULL`` in case an exception was raised" msgstr "" -#: c-api/unicode.rst:1426 +#: c-api/unicode.rst:1673 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: c-api/unicode.rst:1427 +#: c-api/unicode.rst:1674 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: c-api/unicode.rst:1429 +#: c-api/unicode.rst:1676 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: c-api/unicode.rst:1435 +#: c-api/unicode.rst:1682 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: c-api/unicode.rst:1441 +#: c-api/unicode.rst:1688 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: c-api/unicode.rst:1444 +#: c-api/unicode.rst:1691 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: c-api/unicode.rst:1450 +#: c-api/unicode.rst:1697 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -1709,16 +2048,276 @@ msgid "" "`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " "the old string object and creating a new :term:`strong reference` to the " "interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " -"interns it (creating a new :term:`strong reference`). (Clarification: even " -"though there is a lot of talk about references, think of this function as " -"reference-neutral; you own the object after the call if and only if you " -"owned it before the call.)" +"interns it." +msgstr "" + +#: c-api/unicode.rst:1704 +msgid "" +"(Clarification: even though there is a lot of talk about references, think " +"of this function as reference-neutral. You must own the object you pass in; " +"after the call you no longer own the passed-in reference, but you newly own " +"the result.)" msgstr "" -#: c-api/unicode.rst:1463 +#: c-api/unicode.rst:1709 +msgid "" +"This function never raises an exception. On error, it leaves its argument " +"unchanged without interning it." +msgstr "" + +#: c-api/unicode.rst:1712 +msgid "" +"Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" +"expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " +"as with any other error -- the argument is left unchanged." +msgstr "" + +#: c-api/unicode.rst:1716 +msgid "" +"Note that interned strings are not “immortal”. You must keep a reference to " +"the result to benefit from interning." +msgstr "" + +#: c-api/unicode.rst:1722 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" -"`PyUnicode_InternInPlace`, returning either a new Unicode string object that " -"has been interned, or a new (\"owned\") reference to an earlier interned " -"string object with the same value." +"`PyUnicode_InternInPlace`, meant for statically allocated strings." +msgstr "" + +#: c-api/unicode.rst:1725 +msgid "" +"Return a new (\"owned\") reference to either a new Unicode string object " +"that has been interned, or an earlier interned string object with the same " +"value." +msgstr "" + +#: c-api/unicode.rst:1729 +msgid "" +"Python may keep a reference to the result, or make it :term:`immortal`, " +"preventing it from being garbage-collected promptly. For interning an " +"unbounded number of different strings, such as ones coming from user input, " +"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace` directly." +msgstr "" + +#: c-api/unicode.rst:1738 +msgid "" +"Return a non-zero value if *str* is interned, zero if not. The *str* " +"argument must be a string; this is not checked. This function always " +"succeeds." +msgstr "" + +#: c-api/unicode.rst:1744 +msgid "" +"A non-zero return value may carry additional information about *how* the " +"string is interned. The meaning of such non-zero values, as well as each " +"specific string's intern-related details, may change between CPython " +"versions." +msgstr "" + +#: c-api/unicode.rst:1751 +msgid "PyUnicodeWriter" +msgstr "" + +#: c-api/unicode.rst:1753 +msgid "" +"The :c:type:`PyUnicodeWriter` API can be used to create a Python :class:" +"`str` object." +msgstr "" + +#: c-api/unicode.rst:1760 +msgid "A Unicode writer instance." +msgstr "" + +#: c-api/unicode.rst:1762 +msgid "" +"The instance must be destroyed by :c:func:`PyUnicodeWriter_Finish` on " +"success, or :c:func:`PyUnicodeWriter_Discard` on error." +msgstr "" + +#: c-api/unicode.rst:1767 +msgid "Create a Unicode writer instance." +msgstr "" + +#: c-api/unicode.rst:1769 +msgid "*length* must be greater than or equal to ``0``." +msgstr "" + +#: c-api/unicode.rst:1771 +msgid "" +"If *length* is greater than ``0``, preallocate an internal buffer of " +"*length* characters." +msgstr "" + +#: c-api/unicode.rst:1780 +msgid "Set an exception and return ``NULL`` on error." +msgstr "" + +#: c-api/unicode.rst:1778 +msgid "" +"Return the final Python :class:`str` object and destroy the writer instance." +msgstr "" + +#: c-api/unicode.rst:1790 +msgid "The writer instance is invalid after this call." +msgstr "" + +#: c-api/unicode.rst:1786 +msgid "Discard the internal Unicode buffer and destroy the writer instance." +msgstr "" + +#: c-api/unicode.rst:1788 +msgid "If *writer* is ``NULL``, no operation is performed." +msgstr "" + +#: c-api/unicode.rst:1794 +msgid "Write the single Unicode character *ch* into *writer*." +msgstr "" + +#: c-api/unicode.rst:1806 c-api/unicode.rst:1833 c-api/unicode.rst:1849 +#: c-api/unicode.rst:1867 c-api/unicode.rst:1893 +msgid "" +"On success, return ``0``. On error, set an exception, leave the writer " +"unchanged, and return ``-1``." +msgstr "" + +#: c-api/unicode.rst:1801 +msgid "" +"Decode the string *str* from UTF-8 in strict mode and write the output into " +"*writer*." +msgstr "" + +#: c-api/unicode.rst:1815 c-api/unicode.rst:1882 +msgid "" +"*size* is the string length in bytes. If *size* is equal to ``-1``, call " +"``strlen(str)`` to get the string length." +msgstr "" + +#: c-api/unicode.rst:1809 +msgid "See also :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`." +msgstr "" + +#: c-api/unicode.rst:1813 +msgid "Write the ASCII string *str* into *writer*." +msgstr "" + +#: c-api/unicode.rst:1818 +msgid "" +"*str* must only contain ASCII characters. The behavior is undefined if *str* " +"contains non-ASCII characters." +msgstr "" + +#: c-api/unicode.rst:1828 +msgid "Write the wide string *str* into *writer*." +msgstr "" + +#: c-api/unicode.rst:1830 +msgid "" +"*size* is a number of wide characters. If *size* is equal to ``-1``, call " +"``wcslen(str)`` to get the string length." +msgstr "" + +#: c-api/unicode.rst:1838 +msgid "Writer the UCS4 string *str* into *writer*." +msgstr "" + +#: c-api/unicode.rst:1840 +msgid "*size* is a number of UCS4 characters." +msgstr "" + +#: c-api/unicode.rst:1847 +msgid "" +"Call :c:func:`PyObject_Str` on *obj* and write the output into *writer*." +msgstr "" + +#: c-api/unicode.rst:1854 +msgid "" +"Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*." +msgstr "" + +#: c-api/unicode.rst:1861 +msgid "Write the substring ``str[start:end]`` into *writer*." +msgstr "" + +#: c-api/unicode.rst:1863 +msgid "" +"*str* must be Python :class:`str` object. *start* must be greater than or " +"equal to 0, and less than or equal to *end*. *end* must be less than or " +"equal to *str* length." +msgstr "" + +#: c-api/unicode.rst:1872 +msgid "" +"Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly " +"into *writer*." +msgstr "" + +#: c-api/unicode.rst:1879 +msgid "" +"Decode the string *str* from UTF-8 with *errors* error handler and write the " +"output into *writer*." +msgstr "" + +#: c-api/unicode.rst:1885 +msgid "" +"*errors* is an :ref:`error handler ` name, such as " +"``\"replace\"``. If *errors* is ``NULL``, use the strict error handler." +msgstr "" + +#: c-api/unicode.rst:1888 +msgid "" +"If *consumed* is not ``NULL``, set *\\*consumed* to the number of decoded " +"bytes on success. If *consumed* is ``NULL``, treat trailing incomplete UTF-8 " +"byte sequences as an error." +msgstr "" + +#: c-api/unicode.rst:1896 +msgid "See also :c:func:`PyUnicodeWriter_WriteUTF8`." +msgstr "" + +#: c-api/unicode.rst:1899 +msgid "Deprecated API" +msgstr "" + +#: c-api/unicode.rst:1901 +msgid "The following API is deprecated." +msgstr "" + +#: c-api/unicode.rst:1905 +msgid "" +"This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit " +"type depending on the platform. Please use :c:type:`wchar_t` directly " +"instead." +msgstr "" + +#: c-api/unicode.rst:1909 +msgid "" +"In previous versions, this was a 16-bit type or a 32-bit type depending on " +"whether you selected a \"narrow\" or \"wide\" Unicode version of Python at " +"build time." +msgstr "" + +#: c-api/unicode.rst:1919 +msgid "" +"Do nothing and return ``0``. This API is kept only for backward " +"compatibility, but there are no plans to remove it." +msgstr "" + +#: c-api/unicode.rst:1925 +msgid "" +"This API does nothing since Python 3.12. Previously, this needed to be " +"called for each string created using the old API (:c:func:`!" +"PyUnicode_FromUnicode` or similar)." +msgstr "" + +#: c-api/unicode.rst:1933 +msgid "" +"Do nothing and return ``1``. This API is kept only for backward " +"compatibility, but there are no plans to remove it." +msgstr "" + +#: c-api/unicode.rst:1939 +msgid "" +"This API does nothing since Python 3.12. Previously, this could be called to " +"check if :c:func:`PyUnicode_READY` is necessary." msgstr "" diff --git a/c-api/utilities.po b/c-api/utilities.po index 55c390ee..ebf21c37 100644 --- a/c-api/utilities.po +++ b/c-api/utilities.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index f14b5372..443256b3 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,11 +32,12 @@ msgstr "" msgid "" "Several of these functions accept a start symbol from the grammar as a " "parameter. The available start symbols are :c:data:`Py_eval_input`, :c:data:" -"`Py_file_input`, and :c:data:`Py_single_input`. These are described " -"following the functions which accept them as parameters." +"`Py_file_input`, :c:data:`Py_single_input`, and :c:data:" +"`Py_func_type_input`. These are described following the functions which " +"accept them as parameters." msgstr "" -#: c-api/veryhigh.rst:19 +#: c-api/veryhigh.rst:20 msgid "" "Note also that several of these functions take :c:expr:`FILE*` parameters. " "One particular issue which needs to be handled carefully is that the :c:type:" @@ -47,49 +49,25 @@ msgid "" "runtime is using." msgstr "" -#: c-api/veryhigh.rst:30 -msgid "" -"The main program for the standard interpreter. This is made available for " -"programs which embed Python. The *argc* and *argv* parameters should be " -"prepared exactly as those which are passed to a C program's :c:func:`main` " -"function (converted to wchar_t according to the user's locale). It is " -"important to note that the argument list may be modified (but the contents " -"of the strings pointed to by the argument list are not). The return value " -"will be ``0`` if the interpreter exits normally (i.e., without an " -"exception), ``1`` if the interpreter exits due to an exception, or ``2`` if " -"the parameter list does not represent a valid Python command line." -msgstr "" - -#: c-api/veryhigh.rst:40 -msgid "" -"Note that if an otherwise unhandled :exc:`SystemExit` is raised, this " -"function will not return ``1``, but exit the process, as long as :c:member:" -"`PyConfig.inspect` is zero." -msgstr "" - -#: c-api/veryhigh.rst:47 -msgid "Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings." -msgstr "" - -#: c-api/veryhigh.rst:54 +#: c-api/veryhigh.rst:31 msgid "" "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " "leaving *closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:60 +#: c-api/veryhigh.rst:37 msgid "" "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " "leaving the *closeit* argument set to ``0``." msgstr "" -#: c-api/veryhigh.rst:66 +#: c-api/veryhigh.rst:43 msgid "" "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " "leaving the *flags* argument set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:72 +#: c-api/veryhigh.rst:49 msgid "" "If *fp* refers to a file associated with an interactive device (console or " "terminal input or Unix pseudo-terminal), return the value of :c:func:" @@ -100,13 +78,13 @@ msgid "" "before ``PyRun_SimpleFileExFlags()`` returns." msgstr "" -#: c-api/veryhigh.rst:84 +#: c-api/veryhigh.rst:61 msgid "" "This is a simplified interface to :c:func:`PyRun_SimpleStringFlags` below, " "leaving the :c:struct:`PyCompilerFlags`\\* argument set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:90 +#: c-api/veryhigh.rst:67 msgid "" "Executes the Python source code from *command* in the :mod:`__main__` module " "according to the *flags* argument. If :mod:`__main__` does not already " @@ -115,26 +93,26 @@ msgid "" "information. For the meaning of *flags*, see below." msgstr "" -#: c-api/veryhigh.rst:96 +#: c-api/veryhigh.rst:73 msgid "" "Note that if an otherwise unhandled :exc:`SystemExit` is raised, this " "function will not return ``-1``, but exit the process, as long as :c:member:" "`PyConfig.inspect` is zero." msgstr "" -#: c-api/veryhigh.rst:103 +#: c-api/veryhigh.rst:80 msgid "" "This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, " "leaving *closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:109 +#: c-api/veryhigh.rst:86 msgid "" "This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, " "leaving *flags* set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:115 +#: c-api/veryhigh.rst:92 msgid "" "Similar to :c:func:`PyRun_SimpleStringFlags`, but the Python source code is " "read from *fp* instead of an in-memory string. *filename* should be the name " @@ -143,28 +121,22 @@ msgid "" "``PyRun_SimpleFileExFlags()`` returns." msgstr "" -#: c-api/veryhigh.rst:122 +#: c-api/veryhigh.rst:99 msgid "" "On Windows, *fp* should be opened as binary mode (e.g. ``fopen(filename, " "\"rb\")``). Otherwise, Python may not handle script file with LF line ending " "correctly." msgstr "" -#: c-api/veryhigh.rst:128 -msgid "" -"This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below, " -"leaving *flags* set to ``NULL``." -msgstr "" - -#: c-api/veryhigh.rst:134 +#: c-api/veryhigh.rst:105 msgid "" "Read and execute a single statement from a file associated with an " "interactive device according to the *flags* argument. The user will be " -"prompted using ``sys.ps1`` and ``sys.ps2``. *filename* is decoded from the :" -"term:`filesystem encoding and error handler`." +"prompted using ``sys.ps1`` and ``sys.ps2``. *filename* must be a Python :" +"class:`str` object." msgstr "" -#: c-api/veryhigh.rst:139 +#: c-api/veryhigh.rst:110 msgid "" "Returns ``0`` when the input was executed successfully, ``-1`` if there was " "an exception, or an error code from the :file:`errcode.h` include file " @@ -173,13 +145,26 @@ msgid "" "specifically if needed.)" msgstr "" -#: c-api/veryhigh.rst:148 +#: c-api/veryhigh.rst:119 +msgid "" +"This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below, " +"leaving *flags* set to ``NULL``." +msgstr "" + +#: c-api/veryhigh.rst:125 +msgid "" +"Similar to :c:func:`PyRun_InteractiveOneObject`, but *filename* is a :c:expr:" +"`const char*`, which is decoded from the :term:`filesystem encoding and " +"error handler`." +msgstr "" + +#: c-api/veryhigh.rst:132 msgid "" "This is a simplified interface to :c:func:`PyRun_InteractiveLoopFlags` " "below, leaving *flags* set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:154 +#: c-api/veryhigh.rst:138 msgid "" "Read and execute statements from a file associated with an interactive " "device until EOF is reached. The user will be prompted using ``sys.ps1`` " @@ -187,23 +172,23 @@ msgid "" "and error handler`. Returns ``0`` at EOF or a negative number upon failure." msgstr "" -#: c-api/veryhigh.rst:162 +#: c-api/veryhigh.rst:146 msgid "" "Can be set to point to a function with the prototype ``int func(void)``. " "The function will be called when Python's interpreter prompt is about to " "become idle and wait for user input from the terminal. The return value is " "ignored. Overriding this hook can be used to integrate the interpreter's " -"prompt with other event loops, as done in the :file:`Modules/_tkinter.c` in " -"the Python source code." +"prompt with other event loops, as done in :file:`Modules/_tkinter.c` in the " +"Python source code." msgstr "" -#: c-api/veryhigh.rst:194 +#: c-api/veryhigh.rst:178 msgid "" "This function is only called from the :ref:`main interpreter `." msgstr "" -#: c-api/veryhigh.rst:177 +#: c-api/veryhigh.rst:161 msgid "" "Can be set to point to a function with the prototype ``char *func(FILE " "*stdin, FILE *stdout, char *prompt)``, overriding the default function used " @@ -214,59 +199,59 @@ msgid "" "line-editing and tab-completion features." msgstr "" -#: c-api/veryhigh.rst:186 +#: c-api/veryhigh.rst:170 msgid "" "The result must be a string allocated by :c:func:`PyMem_RawMalloc` or :c:" "func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred." msgstr "" -#: c-api/veryhigh.rst:189 +#: c-api/veryhigh.rst:173 msgid "" "The result must be allocated by :c:func:`PyMem_RawMalloc` or :c:func:" "`PyMem_RawRealloc`, instead of being allocated by :c:func:`PyMem_Malloc` or :" "c:func:`PyMem_Realloc`." msgstr "" -#: c-api/veryhigh.rst:200 +#: c-api/veryhigh.rst:184 msgid "" "This is a simplified interface to :c:func:`PyRun_StringFlags` below, leaving " "*flags* set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:206 +#: c-api/veryhigh.rst:190 msgid "" "Execute Python source code from *str* in the context specified by the " "objects *globals* and *locals* with the compiler flags specified by " "*flags*. *globals* must be a dictionary; *locals* can be any object that " "implements the mapping protocol. The parameter *start* specifies the start " -"token that should be used to parse the source code." +"symbol and must one of the :ref:`available start symbols `." msgstr "" -#: c-api/veryhigh.rst:212 +#: c-api/veryhigh.rst:196 msgid "" "Returns the result of executing the code as a Python object, or ``NULL`` if " "an exception was raised." msgstr "" -#: c-api/veryhigh.rst:218 +#: c-api/veryhigh.rst:202 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:224 +#: c-api/veryhigh.rst:208 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*flags* set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:230 +#: c-api/veryhigh.rst:214 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*closeit* set to ``0``." msgstr "" -#: c-api/veryhigh.rst:236 +#: c-api/veryhigh.rst:220 msgid "" "Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read " "from *fp* instead of an in-memory string. *filename* should be the name of " @@ -275,30 +260,30 @@ msgid "" "`PyRun_FileExFlags` returns." msgstr "" -#: c-api/veryhigh.rst:245 +#: c-api/veryhigh.rst:229 msgid "" "This is a simplified interface to :c:func:`Py_CompileStringFlags` below, " "leaving *flags* set to ``NULL``." msgstr "" -#: c-api/veryhigh.rst:251 +#: c-api/veryhigh.rst:235 msgid "" "This is a simplified interface to :c:func:`Py_CompileStringExFlags` below, " "with *optimize* set to ``-1``." msgstr "" -#: c-api/veryhigh.rst:257 +#: c-api/veryhigh.rst:241 msgid "" "Parse and compile the Python source code in *str*, returning the resulting " -"code object. The start token is given by *start*; this can be used to " -"constrain the code which can be compiled and should be :c:data:" -"`Py_eval_input`, :c:data:`Py_file_input`, or :c:data:`Py_single_input`. The " -"filename specified by *filename* is used to construct the code object and " -"may appear in tracebacks or :exc:`SyntaxError` exception messages. This " -"returns ``NULL`` if the code cannot be parsed or compiled." +"code object. The start symbol is given by *start*; this can be used to " +"constrain the code which can be compiled and should be :ref:`available start " +"symbols `. The filename specified by *filename* is used to " +"construct the code object and may appear in tracebacks or :exc:`SyntaxError` " +"exception messages. This returns ``NULL`` if the code cannot be parsed or " +"compiled." msgstr "" -#: c-api/veryhigh.rst:265 +#: c-api/veryhigh.rst:249 msgid "" "The integer *optimize* specifies the optimization level of the compiler; a " "value of ``-1`` selects the optimization level of the interpreter as given " @@ -307,20 +292,20 @@ msgid "" "or ``2`` (docstrings are removed too)." msgstr "" -#: c-api/veryhigh.rst:276 +#: c-api/veryhigh.rst:260 msgid "" "Like :c:func:`Py_CompileStringObject`, but *filename* is a byte string " "decoded from the :term:`filesystem encoding and error handler`." msgstr "" -#: c-api/veryhigh.rst:283 +#: c-api/veryhigh.rst:267 msgid "" "This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just the " "code object, and global and local variables. The other arguments are set to " "``NULL``." msgstr "" -#: c-api/veryhigh.rst:290 +#: c-api/veryhigh.rst:274 msgid "" "Evaluate a precompiled code object, given a particular environment for its " "evaluation. This environment consists of a dictionary of global variables, " @@ -329,13 +314,13 @@ msgid "" "only_parameter>` arguments and a closure tuple of cells." msgstr "" -#: c-api/veryhigh.rst:299 +#: c-api/veryhigh.rst:283 msgid "" "Evaluate an execution frame. This is a simplified interface to :c:func:" "`PyEval_EvalFrameEx`, for backward compatibility." msgstr "" -#: c-api/veryhigh.rst:305 +#: c-api/veryhigh.rst:289 msgid "" "This is the main, unvarnished function of Python interpretation. The code " "object associated with the execution frame *f* is executed, interpreting " @@ -345,79 +330,152 @@ msgid "" "of generator objects." msgstr "" -#: c-api/veryhigh.rst:312 +#: c-api/veryhigh.rst:296 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: c-api/veryhigh.rst:319 +#: c-api/veryhigh.rst:303 msgid "" "This function changes the flags of the current evaluation frame, and returns " "true on success, false on failure." msgstr "" +#: c-api/veryhigh.rst:309 +msgid "" +"This is the structure used to hold compiler flags. In cases where code is " +"only being compiled, it is passed as ``int flags``, and in cases where code " +"is being executed, it is passed as ``PyCompilerFlags *flags``. In this " +"case, ``from __future__ import`` can modify *flags*." +msgstr "" + +#: c-api/veryhigh.rst:314 +msgid "" +"Whenever ``PyCompilerFlags *flags`` is ``NULL``, :c:member:`~PyCompilerFlags." +"cf_flags` is treated as equal to ``0``, and any modification due to ``from " +"__future__ import`` is discarded." +msgstr "" + +#: c-api/veryhigh.rst:320 +msgid "Compiler flags." +msgstr "" + +#: c-api/veryhigh.rst:324 +msgid "" +"*cf_feature_version* is the minor Python version. It should be initialized " +"to ``PY_MINOR_VERSION``." +msgstr "" + #: c-api/veryhigh.rst:327 msgid "" +"The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` " +"flag is set in :c:member:`~PyCompilerFlags.cf_flags`." +msgstr "" + +#: c-api/veryhigh.rst:330 +msgid "Added *cf_feature_version* field." +msgstr "" + +#: c-api/veryhigh.rst:333 +msgid "The available compiler flags are accessible as macros:" +msgstr "" + +#: c-api/veryhigh.rst:342 +msgid "" +"See :ref:`compiler flags ` in documentation of the :py:" +"mod:`!ast` Python module, which exports these constants under the same names." +msgstr "" + +#: c-api/veryhigh.rst:346 +msgid "" +"The \"``PyCF``\" flags above can be combined with \"``CO_FUTURE``\" flags " +"such as :c:macro:`CO_FUTURE_ANNOTATIONS` to enable features normally " +"selectable using :ref:`future statements `. See :ref:" +"`c_codeobject_flags` for a complete list." +msgstr "" + +#: c-api/veryhigh.rst:355 +msgid "Available start symbols" +msgstr "" + +#: c-api/veryhigh.rst:362 +msgid "" "The start symbol from the Python grammar for isolated expressions; for use " "with :c:func:`Py_CompileString`." msgstr "" -#: c-api/veryhigh.rst:335 +#: c-api/veryhigh.rst:370 msgid "" "The start symbol from the Python grammar for sequences of statements as read " "from a file or other source; for use with :c:func:`Py_CompileString`. This " "is the symbol to use when compiling arbitrarily long Python source code." msgstr "" -#: c-api/veryhigh.rst:344 +#: c-api/veryhigh.rst:379 msgid "" "The start symbol from the Python grammar for a single statement; for use " "with :c:func:`Py_CompileString`. This is the symbol used for the interactive " "interpreter loop." msgstr "" -#: c-api/veryhigh.rst:351 +#: c-api/veryhigh.rst:388 msgid "" -"This is the structure used to hold compiler flags. In cases where code is " -"only being compiled, it is passed as ``int flags``, and in cases where code " -"is being executed, it is passed as ``PyCompilerFlags *flags``. In this " -"case, ``from __future__ import`` can modify *flags*." +"The start symbol from the Python grammar for a function type; for use with :" +"c:func:`Py_CompileString`. This is used to parse \"signature type comments\" " +"from :pep:`484`." msgstr "" -#: c-api/veryhigh.rst:356 -msgid "" -"Whenever ``PyCompilerFlags *flags`` is ``NULL``, :c:member:`~PyCompilerFlags." -"cf_flags` is treated as equal to ``0``, and any modification due to ``from " -"__future__ import`` is discarded." +#: c-api/veryhigh.rst:392 +msgid "This requires the :c:macro:`PyCF_ONLY_AST` flag to be set." msgstr "" -#: c-api/veryhigh.rst:362 -msgid "Compiler flags." +#: c-api/veryhigh.rst:395 +msgid ":py:class:`ast.FunctionType`" msgstr "" -#: c-api/veryhigh.rst:366 -msgid "" -"*cf_feature_version* is the minor Python version. It should be initialized " -"to ``PY_MINOR_VERSION``." +#: c-api/veryhigh.rst:396 +msgid ":pep:`484`" msgstr "" -#: c-api/veryhigh.rst:369 +#: c-api/veryhigh.rst:402 +msgid "Stack Effects" +msgstr "" + +#: c-api/veryhigh.rst:405 +msgid ":py:func:`dis.stack_effect`" +msgstr "" + +#: c-api/veryhigh.rst:410 +msgid "Sentinel value representing an invalid stack effect." +msgstr "" + +#: c-api/veryhigh.rst:412 +msgid "This is currently equivalent to ``INT_MAX``." +msgstr "" + +#: c-api/veryhigh.rst:419 +msgid "Compute the stack effect of *opcode* with argument *oparg*." +msgstr "" + +#: c-api/veryhigh.rst:435 msgid "" -"The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` " -"flag is set in :c:member:`~PyCompilerFlags.cf_flags`." +"On success, this function returns the stack effect; on failure, this " +"returns :c:macro:`PY_INVALID_STACK_EFFECT`." msgstr "" -#: c-api/veryhigh.rst:372 -msgid "Added *cf_feature_version* field." +#: c-api/veryhigh.rst:429 +msgid "" +"Similar to :c:func:`PyCompile_OpcodeStackEffect`, but don't include the " +"stack effect of jumping if *jump* is zero." msgstr "" -#: c-api/veryhigh.rst:378 +#: c-api/veryhigh.rst:432 msgid "" -"This bit can be set in *flags* to cause division operator ``/`` to be " -"interpreted as \"true division\" according to :pep:`238`." +"If *jump* is ``0``, this will not include the stack effect of jumping, but " +"if *jump* is ``1`` or ``-1``, this will include it." msgstr "" -#: c-api/veryhigh.rst:333 c-api/veryhigh.rst:342 +#: c-api/veryhigh.rst:368 c-api/veryhigh.rst:386 msgid "Py_CompileString (C function)" msgstr "" diff --git a/c-api/weakref.po b/c-api/weakref.po index 8abdd378..a5d58b3e 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -30,20 +31,28 @@ msgstr "" #: c-api/weakref.rst:16 msgid "" -"Return true if *ob* is either a reference or proxy object. This function " -"always succeeds." +"Return non-zero if *ob* is either a reference or proxy object. This " +"function always succeeds." msgstr "" #: c-api/weakref.rst:22 msgid "" -"Return true if *ob* is a reference object. This function always succeeds." +"Return non-zero if *ob* is a reference object or a subclass of the reference " +"type. This function always succeeds." msgstr "" -#: c-api/weakref.rst:27 -msgid "Return true if *ob* is a proxy object. This function always succeeds." +#: c-api/weakref.rst:28 +msgid "" +"Return non-zero if *ob* is a reference object, but not a subclass of the " +"reference type. This function always succeeds." msgstr "" -#: c-api/weakref.rst:32 +#: c-api/weakref.rst:34 +msgid "" +"Return non-zero if *ob* is a proxy object. This function always succeeds." +msgstr "" + +#: c-api/weakref.rst:39 msgid "" "Return a weak reference object for the object *ob*. This will always return " "a new reference, but is not guaranteed to create a new object; an existing " @@ -51,11 +60,17 @@ msgid "" "a callable object that receives notification when *ob* is garbage collected; " "it should accept a single parameter, which will be the weak reference object " "itself. *callback* may also be ``None`` or ``NULL``. If *ob* is not a " -"weakly referencable object, or if *callback* is not callable, ``None``, or " +"weakly referenceable object, or if *callback* is not callable, ``None``, or " "``NULL``, this will return ``NULL`` and raise :exc:`TypeError`." msgstr "" -#: c-api/weakref.rst:44 +#: c-api/weakref.rst:65 +msgid "" +":c:func:`PyType_SUPPORTS_WEAKREFS` for checking if *ob* is weakly " +"referenceable." +msgstr "" + +#: c-api/weakref.rst:55 msgid "" "Return a weak reference proxy object for the object *ob*. This will always " "return a new reference, but is not guaranteed to create a new object; an " @@ -63,17 +78,37 @@ msgid "" "can be a callable object that receives notification when *ob* is garbage " "collected; it should accept a single parameter, which will be the weak " "reference object itself. *callback* may also be ``None`` or ``NULL``. If " -"*ob* is not a weakly referencable object, or if *callback* is not callable, " +"*ob* is not a weakly referenceable object, or if *callback* is not callable, " "``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`." msgstr "" -#: c-api/weakref.rst:56 +#: c-api/weakref.rst:71 +msgid "" +"Get a :term:`strong reference` to the referenced object from a weak " +"reference, *ref*, into *\\*pobj*." +msgstr "" + +#: c-api/weakref.rst:74 msgid "" -"Return the referenced object from a weak reference, *ref*. If the referent " -"is no longer live, returns ``Py_None``." +"On success, set *\\*pobj* to a new :term:`strong reference` to the " +"referenced object and return 1." msgstr "" -#: c-api/weakref.rst:61 +#: c-api/weakref.rst:76 +msgid "If the reference is dead, set *\\*pobj* to ``NULL`` and return 0." +msgstr "" + +#: c-api/weakref.rst:77 +msgid "On error, raise an exception and return -1." +msgstr "" + +#: c-api/weakref.rst:84 +msgid "" +"Return a :term:`borrowed reference` to the referenced object from a weak " +"reference, *ref*. If the referent is no longer live, returns ``Py_None``." +msgstr "" + +#: c-api/weakref.rst:89 msgid "" "This function returns a :term:`borrowed reference` to the referenced object. " "This means that you should always call :c:func:`Py_INCREF` on the object " @@ -81,19 +116,49 @@ msgid "" "reference." msgstr "" -#: c-api/weakref.rst:69 +#: c-api/weakref.rst:102 +msgid "Use :c:func:`PyWeakref_GetRef` instead." +msgstr "" + +#: c-api/weakref.rst:100 msgid "Similar to :c:func:`PyWeakref_GetObject`, but does no error checking." msgstr "" -#: c-api/weakref.rst:74 +#: c-api/weakref.rst:108 +msgid "" +"Test if the weak reference *ref* is dead. Returns 1 if the reference is " +"dead, 0 if it is alive, and -1 with an error set if *ref* is not a weak " +"reference object." +msgstr "" + +#: c-api/weakref.rst:117 msgid "" "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " "to clear weak references." msgstr "" -#: c-api/weakref.rst:77 +#: c-api/weakref.rst:120 msgid "" "This iterates through the weak references for *object* and calls callbacks " "for those references which have one. It returns when all callbacks have been " "attempted." msgstr "" + +#: c-api/weakref.rst:127 +msgid "Clears the weakrefs for *object* without calling the callbacks." +msgstr "" + +#: c-api/weakref.rst:129 +msgid "" +"This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " +"for types with finalizers (i.e., :meth:`~object.__del__`). The handler for " +"those objects first calls :c:func:`PyObject_ClearWeakRefs` to clear weakrefs " +"and call their callbacks, then the finalizer, and finally this function to " +"clear any weakrefs that may have been created by the finalizer." +msgstr "" + +#: c-api/weakref.rst:135 +msgid "" +"In most circumstances, it's more appropriate to use :c:func:" +"`PyObject_ClearWeakRefs` to clear weakrefs instead of this function." +msgstr "" diff --git a/contents.po b/contents.po index 17db577e..58a53766 100644 --- a/contents.po +++ b/contents.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-04-24 22:37+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/copyright.po b/copyright.po index 423285ff..0251a2aa 100644 --- a/copyright.po +++ b/copyright.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-04-24 22:33+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -27,10 +27,8 @@ msgid "Python and this documentation is:" msgstr "Η Python και αυτή η τεκμηρίωση είναι:" #: copyright.rst:7 -msgid "Copyright © 2001-2023 Python Software Foundation. All rights reserved." -msgstr "" -"Copyright © 2001-2023 Python Software Foundation. Όλα τα δικαιώματα " -"διατηρούνται." +msgid "Copyright © 2001 Python Software Foundation. All rights reserved." +msgstr "Copyright © 2001 Python Software Foundation. All rights reserved." #: copyright.rst:9 msgid "Copyright © 2000 BeOpen.com. All rights reserved." diff --git a/cpython b/cpython index 9cbde7c6..afaa3b02 160000 --- a/cpython +++ b/cpython @@ -1 +1 @@ -Subproject commit 9cbde7c6ce6f7b93301a37f03dfa0c0d45e00a39 +Subproject commit afaa3b02f79b16d175129e9c5cbf6660f7521a69 diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po new file mode 100644 index 00000000..dd21338c --- /dev/null +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -0,0 +1,34 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/c-api-pending-removal-in-3.14.rst:2 +msgid "Pending removal in Python 3.14" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.14.rst:4 +msgid "" +"The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " +"(:pep:`699`; :gh:`101193`)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.14.rst:7 +msgid "" +"Creating :c:data:`immutable types ` with mutable " +"bases (:gh:`95388`)." +msgstr "" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po new file mode 100644 index 00000000..5ec480f5 --- /dev/null +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -0,0 +1,290 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/c-api-pending-removal-in-3.15.rst:2 +msgid "Pending removal in Python 3.15" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:6 +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:10 +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:22 +msgid "Python initialization functions, deprecated in Python 3.13:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:24 +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:27 +msgid "" +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:38 +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:41 +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:44 +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:52 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:54 +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:56 +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:58 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:60 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:62 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:65 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:68 +msgid "Global configuration variables:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:70 +msgid "" +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:73 +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:76 +msgid "" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:79 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:82 +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:85 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:88 +msgid "" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:91 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:94 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:97 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:100 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:103 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:106 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:109 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:113 +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:116 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:119 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:122 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:125 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:128 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:133 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." +msgstr "" diff --git a/deprecations/c-api-pending-removal-in-3.16.po b/deprecations/c-api-pending-removal-in-3.16.po new file mode 100644 index 00000000..832bdfaa --- /dev/null +++ b/deprecations/c-api-pending-removal-in-3.16.po @@ -0,0 +1,26 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/c-api-pending-removal-in-3.16.rst:2 +msgid "Pending removal in Python 3.16" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.16.rst:4 +msgid "The bundled copy of ``libmpdec``." +msgstr "" diff --git a/deprecations/c-api-pending-removal-in-3.18.po b/deprecations/c-api-pending-removal-in-3.18.po new file mode 100644 index 00000000..6fff77f1 --- /dev/null +++ b/deprecations/c-api-pending-removal-in-3.18.po @@ -0,0 +1,141 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/c-api-pending-removal-in-3.18.rst:2 +msgid "Pending removal in Python 3.18" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:4 +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:7 +msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:8 +msgid "" +":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" +"`PyDict_GetItemStringRef`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:10 +msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:11 +msgid "" +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" +"`PyLongWriter_Create`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:13 +msgid "" +":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" +"`PyThreadState_GetUnchecked`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:14 +msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:15 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:18 +msgid "" +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" +"`PyUnicodeWriter_Finish(writer) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:21 +msgid "" +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" +"`PyUnicodeWriter_Discard(writer) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:24 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:27 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:30 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:33 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:36 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:39 +msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:40 +msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:41 +msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:42 +msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:44 +msgid "" +"The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" +msgstr "" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po new file mode 100644 index 00000000..3a9d23ad --- /dev/null +++ b/deprecations/c-api-pending-removal-in-future.po @@ -0,0 +1,116 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/c-api-pending-removal-in-future.rst:2 +msgid "Pending removal in future versions" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:7 +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:19 +msgid "" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:21 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:23 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:25 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:29 +msgid "Thread Local Storage (TLS) API:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:31 +msgid "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:33 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:37 +msgid "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:39 +msgid "" +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:41 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." +msgstr "" diff --git a/deprecations/index.po b/deprecations/index.po new file mode 100644 index 00000000..24fe1201 --- /dev/null +++ b/deprecations/index.po @@ -0,0 +1,1306 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/index.rst:2 +msgid "Deprecations" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:2 +#: deprecations/pending-removal-in-3.15.rst:2 +msgid "Pending removal in Python 3.15" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:4 +#: deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:16 +#: deprecations/pending-removal-in-3.19.rst:4 +msgid ":mod:`ctypes`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:18 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:21 +msgid ":mod:`http.server`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:23 +msgid "" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:29 +msgid "" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:32 +#: deprecations/pending-removal-in-future.rst:63 +msgid ":mod:`importlib`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:36 +msgid ":class:`locale`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:38 +msgid "" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:46 +msgid ":mod:`pathlib`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:48 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:52 +msgid ":mod:`platform`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:54 +msgid "" +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:58 +#: deprecations/pending-removal-in-3.16.rst:96 +msgid ":mod:`sysconfig`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`threading`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:65 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:71 +msgid ":mod:`types`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:73 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:80 +#: deprecations/pending-removal-in-3.17.rst:26 +msgid ":mod:`typing`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:82 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:88 +msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:95 +msgid "" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:100 +msgid ":mod:`wave`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:102 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:107 +msgid ":mod:`zipimport`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:109 +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:2 +msgid "Pending removal in Python 3.16" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:11 +msgid ":mod:`array`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:13 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:19 +msgid ":mod:`asyncio`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:26 +msgid "" +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:29 +msgid ":class:`asyncio.AbstractEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:30 +msgid ":class:`asyncio.DefaultEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:31 +msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:32 +msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:33 +msgid ":func:`asyncio.get_event_loop_policy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:34 +msgid ":func:`asyncio.set_event_loop_policy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:36 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:39 +msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:48 +msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:50 +#: deprecations/pending-removal-in-future.rst:16 +msgid ":mod:`builtins`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:52 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:59 +msgid ":mod:`functools`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:61 +msgid "" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:64 +msgid ":mod:`logging`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:66 +msgid "" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:70 +msgid ":mod:`mimetypes`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:72 +msgid "" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:78 +msgid ":mod:`shutil`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:80 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:85 +msgid ":mod:`symtable`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:87 +msgid "" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:90 +msgid ":mod:`sys`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:92 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:98 +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:102 +msgid ":mod:`tarfile`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:104 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:2 +msgid "Pending removal in Python 3.17" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:8 +#: deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:14 +#: deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:22 +#: deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:28 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:33 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17." +msgstr "" + +#: deprecations/pending-removal-in-3.19.rst:2 +msgid "Pending removal in Python 3.19" +msgstr "" + +#: deprecations/pending-removal-in-3.19.rst:6 +msgid "" +"Implicitly switching to the MSVC-compatible struct layout by setting :attr:" +"`~ctypes.Structure._pack_` but not :attr:`~ctypes.Structure._layout_` on non-" +"Windows platforms." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:2 +#: deprecations/pending-removal-in-future.rst:2 +msgid "Pending removal in future versions" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:4 +msgid "" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:7 +msgid ":mod:`argparse`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:9 +msgid "" +"Nesting argument groups and nesting mutually exclusive groups are deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:14 +msgid "The :class:`argparse.FileType` type converter is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:18 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:21 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:35 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:38 +msgid "Delegation of ``int()`` to ``__trunc__()`` method." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:39 +msgid "" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:44 +msgid "" +":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:49 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:51 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:54 +msgid ":mod:`datetime`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:56 +msgid "" +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:58 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:61 +msgid ":mod:`gettext`: Plural value must be an integer." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:65 +msgid "" +":func:`~importlib.util.cache_from_source` *debug_override* parameter is " +"deprecated: use the *optimization* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:68 +msgid ":mod:`importlib.metadata`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:70 +msgid "``EntryPoints`` tuple interface." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:71 +msgid "Implicit ``None`` on return values." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:73 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:76 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:79 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:81 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:84 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:91 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:93 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:96 +msgid ":mod:`ssl` options and protocols:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:98 +msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:99 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:102 +msgid "``ssl.OP_NO_SSL*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:103 +msgid "``ssl.OP_NO_TLS*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:104 +msgid "``ssl.PROTOCOL_SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:105 +msgid "``ssl.PROTOCOL_TLS``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:106 +msgid "``ssl.PROTOCOL_TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:107 +msgid "``ssl.PROTOCOL_TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:108 +msgid "``ssl.PROTOCOL_TLSv1_2``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:109 +msgid "``ssl.TLSVersion.SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:110 +msgid "``ssl.TLSVersion.TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:111 +msgid "``ssl.TLSVersion.TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:113 +msgid ":mod:`threading` methods:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:115 +msgid "" +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:116 +msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:117 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:119 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:121 +msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:122 +msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:124 +msgid ":class:`typing.Text` (:gh:`92332`)." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:126 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:131 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:134 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:136 +msgid "``splitattr()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:137 +msgid "``splithost()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:138 +msgid "``splitnport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:139 +msgid "``splitpasswd()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:140 +msgid "``splitport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:141 +msgid "``splitquery()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:142 +msgid "``splittag()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:143 +msgid "``splittype()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:144 +msgid "``splituser()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:145 +msgid "``splitvalue()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:146 +msgid "``to_bytes()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:148 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:151 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:156 +msgid "" +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." +msgstr "" + +#: deprecations/index.rst:15 +msgid "C API deprecations" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:6 +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:10 +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:22 +msgid "Python initialization functions, deprecated in Python 3.13:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:24 +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:27 +msgid "" +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:38 +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:41 +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:44 +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:52 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:54 +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:56 +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:58 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:60 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:62 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:65 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:68 +msgid "Global configuration variables:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:70 +msgid "" +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:73 +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:76 +msgid "" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:79 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:82 +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:85 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:88 +msgid "" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:91 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:94 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:97 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:100 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:103 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:106 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:109 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:113 +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:116 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:119 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:122 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:125 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:128 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:133 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:2 +msgid "Pending removal in Python 3.18" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:4 +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:7 +msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:8 +msgid "" +":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" +"`PyDict_GetItemStringRef`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:10 +msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:11 +msgid "" +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" +"`PyLongWriter_Create`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:13 +msgid "" +":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" +"`PyThreadState_GetUnchecked`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:14 +msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:15 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:18 +msgid "" +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" +"`PyUnicodeWriter_Finish(writer) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:21 +msgid "" +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" +"`PyUnicodeWriter_Discard(writer) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:24 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:27 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:30 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:33 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:36 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:39 +msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:40 +msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:41 +msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:42 +msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:44 +msgid "" +"The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:7 +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:19 +msgid "" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:21 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:23 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:25 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:29 +msgid "Thread Local Storage (TLS) API:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:31 +msgid "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:33 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:37 +msgid "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:39 +msgid "" +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:41 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." +msgstr "" diff --git a/deprecations/pending-removal-in-3.13.po b/deprecations/pending-removal-in-3.13.po new file mode 100644 index 00000000..39fb0f20 --- /dev/null +++ b/deprecations/pending-removal-in-3.13.po @@ -0,0 +1,150 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/pending-removal-in-3.13.rst:2 +msgid "Pending removal in Python 3.13" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:4 +msgid "Modules (see :pep:`594`):" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:6 +msgid ":mod:`!aifc`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:7 +msgid ":mod:`!audioop`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:8 +msgid ":mod:`!cgi`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:9 +msgid ":mod:`!cgitb`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:10 +msgid ":mod:`!chunk`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:11 +msgid ":mod:`!crypt`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:12 +msgid ":mod:`!imghdr`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:13 +msgid ":mod:`!mailcap`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:14 +msgid ":mod:`!msilib`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:15 +msgid ":mod:`!nis`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:16 +msgid ":mod:`!nntplib`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:17 +msgid ":mod:`!ossaudiodev`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:18 +msgid ":mod:`!pipes`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:19 +msgid ":mod:`!sndhdr`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:20 +msgid ":mod:`!spwd`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:21 +msgid ":mod:`!sunau`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:22 +msgid ":mod:`!telnetlib`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:23 +msgid ":mod:`!uu`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:24 +msgid ":mod:`!xdrlib`" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:26 +msgid "Other modules:" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:28 +msgid ":mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:30 +msgid "APIs:" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:32 +msgid ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:33 +msgid "``locale.resetlocale()`` (:gh:`90817`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:34 +msgid ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:35 +msgid ":func:`!unittest.findTestCases` (:gh:`50096`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:36 +msgid ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:37 +msgid ":func:`!unittest.makeSuite` (:gh:`50096`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:38 +msgid ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:39 +msgid ":class:`!webbrowser.MacOSX` (:gh:`86421`)" +msgstr "" + +#: deprecations/pending-removal-in-3.13.rst:40 +msgid ":class:`classmethod` descriptor chaining (:gh:`89519`)" +msgstr "" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po new file mode 100644 index 00000000..52e222b9 --- /dev/null +++ b/deprecations/pending-removal-in-3.14.po @@ -0,0 +1,194 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/pending-removal-in-3.14.rst:2 +msgid "Pending removal in Python 3.14" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:4 +msgid "" +":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" +"argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " +"(Contributed by Nikita Sobolev in :gh:`92248`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:9 +msgid "" +":mod:`ast`: The following features have been deprecated in documentation " +"since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " +"runtime when they are accessed or used, and will be removed in Python 3.14:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:13 +msgid ":class:`!ast.Num`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:14 +msgid ":class:`!ast.Str`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:15 +msgid ":class:`!ast.Bytes`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:16 +msgid ":class:`!ast.NameConstant`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:17 +msgid ":class:`!ast.Ellipsis`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:19 +msgid "" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:22 +msgid ":mod:`asyncio`:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:24 +msgid "" +"The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" +"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` and :class:" +"`!asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:30 +msgid "" +":func:`!asyncio.set_child_watcher`, :func:`!asyncio.get_child_watcher`, :" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" +"asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " +"be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:36 +msgid "" +"The :meth:`~asyncio.get_event_loop` method of the default event loop policy " +"now emits a :exc:`DeprecationWarning` if there is no current event loop set " +"and it decides to create one. (Contributed by Serhiy Storchaka and Guido van " +"Rossum in :gh:`100160`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:41 +msgid "" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:44 +msgid ":mod:`importlib.abc` deprecated classes:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:46 +msgid ":class:`!importlib.abc.ResourceReader`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:47 +msgid ":class:`!importlib.abc.Traversable`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:48 +msgid ":class:`!importlib.abc.TraversableResources`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:50 +msgid "Use :mod:`importlib.resources.abc` classes instead:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:52 +msgid ":class:`importlib.resources.abc.Traversable`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:53 +msgid ":class:`importlib.resources.abc.TraversableResources`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:55 +msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:57 +msgid "" +":mod:`itertools` had undocumented, inefficient, historically buggy, and " +"inconsistent support for copy, deepcopy, and pickle operations. This will be " +"removed in 3.14 for a significant reduction in code volume and maintenance " +"burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:63 +msgid "" +":mod:`multiprocessing`: The default start method will change to a safer one " +"on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " +"currently the default (:gh:`84559`). Adding a runtime warning about this was " +"deemed too disruptive as the majority of code is not expected to care. Use " +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:71 +msgid "" +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:75 +msgid "" +":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " +"now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " +"instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:80 +msgid ":mod:`pty`:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:82 +msgid "``master_open()``: use :func:`pty.openpty`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:83 +msgid "``slave_open()``: use :func:`pty.openpty`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:85 +msgid ":mod:`sqlite3`:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:87 +msgid ":data:`!version` and :data:`!version_info`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:89 +msgid "" +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders ` are used and *parameters* is " +"a sequence instead of a :class:`dict`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:93 +msgid "" +":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" +msgstr "" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po new file mode 100644 index 00000000..ab2cbf6a --- /dev/null +++ b/deprecations/pending-removal-in-3.15.po @@ -0,0 +1,195 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/pending-removal-in-3.15.rst:2 +msgid "Pending removal in Python 3.15" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:4 +msgid "The import system:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:16 +msgid ":mod:`ctypes`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:18 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:21 +msgid ":mod:`http.server`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:23 +msgid "" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:29 +msgid "" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:32 +msgid ":mod:`importlib`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:36 +msgid ":class:`locale`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:38 +msgid "" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:46 +msgid ":mod:`pathlib`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:48 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:52 +msgid ":mod:`platform`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:54 +msgid "" +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`threading`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:65 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:71 +msgid ":mod:`types`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:73 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:80 +msgid ":mod:`typing`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:82 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:88 +msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:95 +msgid "" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:100 +msgid ":mod:`wave`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:102 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:107 +msgid ":mod:`zipimport`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:109 +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" +msgstr "" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po new file mode 100644 index 00000000..965c761f --- /dev/null +++ b/deprecations/pending-removal-in-3.16.po @@ -0,0 +1,210 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/pending-removal-in-3.16.rst:2 +msgid "Pending removal in Python 3.16" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:11 +msgid ":mod:`array`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:13 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:19 +msgid ":mod:`asyncio`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:26 +msgid "" +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:29 +msgid ":class:`asyncio.AbstractEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:30 +msgid ":class:`asyncio.DefaultEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:31 +msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:32 +msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:33 +msgid ":func:`asyncio.get_event_loop_policy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:34 +msgid ":func:`asyncio.set_event_loop_policy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:36 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:39 +msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:48 +msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:50 +msgid ":mod:`builtins`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:52 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:59 +msgid ":mod:`functools`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:61 +msgid "" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:64 +msgid ":mod:`logging`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:66 +msgid "" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:70 +msgid ":mod:`mimetypes`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:72 +msgid "" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:78 +msgid ":mod:`shutil`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:80 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:85 +msgid ":mod:`symtable`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:87 +msgid "" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:90 +msgid ":mod:`sys`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:92 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:96 +msgid ":mod:`sysconfig`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:98 +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:102 +msgid ":mod:`tarfile`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:104 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" diff --git a/deprecations/pending-removal-in-3.17.po b/deprecations/pending-removal-in-3.17.po new file mode 100644 index 00000000..47463732 --- /dev/null +++ b/deprecations/pending-removal-in-3.17.po @@ -0,0 +1,80 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/pending-removal-in-3.17.rst:2 +msgid "Pending removal in Python 3.17" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:8 +#: deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:14 +#: deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:22 +#: deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:26 +msgid ":mod:`typing`:" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:28 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:33 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17." +msgstr "" diff --git a/deprecations/pending-removal-in-3.19.po b/deprecations/pending-removal-in-3.19.po new file mode 100644 index 00000000..37bc4b59 --- /dev/null +++ b/deprecations/pending-removal-in-3.19.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/pending-removal-in-3.19.rst:2 +msgid "Pending removal in Python 3.19" +msgstr "" + +#: deprecations/pending-removal-in-3.19.rst:4 +msgid ":mod:`ctypes`:" +msgstr "" + +#: deprecations/pending-removal-in-3.19.rst:6 +msgid "" +"Implicitly switching to the MSVC-compatible struct layout by setting :attr:" +"`~ctypes.Structure._pack_` but not :attr:`~ctypes.Structure._layout_` on non-" +"Windows platforms." +msgstr "" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po new file mode 100644 index 00000000..50f31f47 --- /dev/null +++ b/deprecations/pending-removal-in-future.po @@ -0,0 +1,383 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: deprecations/pending-removal-in-future.rst:2 +msgid "Pending removal in future versions" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:4 +msgid "" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:7 +msgid ":mod:`argparse`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:9 +msgid "" +"Nesting argument groups and nesting mutually exclusive groups are deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:14 +msgid "The :class:`argparse.FileType` type converter is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:16 +msgid ":mod:`builtins`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:18 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:21 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:35 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:38 +msgid "Delegation of ``int()`` to ``__trunc__()`` method." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:39 +msgid "" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:44 +msgid "" +":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:49 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:51 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:54 +msgid ":mod:`datetime`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:56 +msgid "" +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:58 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:61 +msgid ":mod:`gettext`: Plural value must be an integer." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:63 +msgid ":mod:`importlib`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:65 +msgid "" +":func:`~importlib.util.cache_from_source` *debug_override* parameter is " +"deprecated: use the *optimization* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:68 +msgid ":mod:`importlib.metadata`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:70 +msgid "``EntryPoints`` tuple interface." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:71 +msgid "Implicit ``None`` on return values." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:73 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:76 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:79 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:81 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:84 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:91 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:93 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:96 +msgid ":mod:`ssl` options and protocols:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:98 +msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:99 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:102 +msgid "``ssl.OP_NO_SSL*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:103 +msgid "``ssl.OP_NO_TLS*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:104 +msgid "``ssl.PROTOCOL_SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:105 +msgid "``ssl.PROTOCOL_TLS``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:106 +msgid "``ssl.PROTOCOL_TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:107 +msgid "``ssl.PROTOCOL_TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:108 +msgid "``ssl.PROTOCOL_TLSv1_2``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:109 +msgid "``ssl.TLSVersion.SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:110 +msgid "``ssl.TLSVersion.TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:111 +msgid "``ssl.TLSVersion.TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:113 +msgid ":mod:`threading` methods:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:115 +msgid "" +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:116 +msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:117 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:119 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:121 +msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:122 +msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:124 +msgid ":class:`typing.Text` (:gh:`92332`)." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:126 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:131 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:134 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:136 +msgid "``splitattr()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:137 +msgid "``splithost()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:138 +msgid "``splitnport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:139 +msgid "``splitpasswd()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:140 +msgid "``splitport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:141 +msgid "``splitquery()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:142 +msgid "``splittag()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:143 +msgid "``splittype()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:144 +msgid "``splituser()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:145 +msgid "``splitvalue()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:146 +msgid "``to_bytes()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:148 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:151 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:156 +msgid "" +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." +msgstr "" diff --git a/dictionaries/main.txt b/dictionaries/main.txt index 267e848b..d6cc64da 100644 --- a/dictionaries/main.txt +++ b/dictionaries/main.txt @@ -1,572 +1,2143 @@ A +ActiveState +Actual +Adam +Agreement +Alex +Alias +All +Allen +Alph +Alpine +Alternate Alternative +Android Apache +App +April +Arguments +Associates +Audio +Avenue +Awaitable Awk B +Bartelt +Bernstein +Beta +Bitwise +Blue +Boolean +Booleans +Boost +Borrowed +Brett +Buddy +Bug +Built +Bytearray C +Cannon +Canopy +Case +Category Centrum +Changelog +Chapman Cheese +Circus +Classes +Clause +Cleese +Cocoa +Comma Command Comment Compaq Compiled Comprehensions +Computer +Configurations +Content +Control Cookbook Cookie +Copyright Corporation Creations +Cross +Ctrl +Customize +Cython D Dan David +Daylight +Debian +Dec +December +Decimal +Default +Developer Dictionaries +Digit +Digital +DigitalOcean +Document Docutils +Dog +Downey +Dr Drake Emacs +Embed +Embedded +Enable +English +Enthought +Eric Error Errors +Exceeds +Excel +Exception Exceptions +Explorer +Fedora +Fido +Flying +Folding Fortran Foundation +Fourier +Fraction +Frameworks Fred Fredrik +Frozen +Garcia +Gaussian +Gay +General +Generics Get +Golden +Google +Gordon +Graham +Green +Greg +Gross +Group +Guide +Guido +Hans +Haskell +Hat +Hello +Hewlett +Hue +Hugunin I +Idel +Idle If Inc Indent Index +Individual Inf +Info Initiatives Input Insert +Intel Intermezzo Intra +Io +Isn +Iu +Jim +John Jr +Just +Jython +Kivy +Korn +Krah L +Laboratories +Letter +Libraries +Library +License +Licensee +Lightness +Lin Linux Lisp Literals +Ll +Lm +Lo Local +Lock Look Looking Looping Loops +Lt Ltd +Lu +Lundh M +Ma Mac +Macintosh +Mailbox +Majkowski +Makefile +Managers Marek +Mark +Matthias +Mersenne +Message +Michael +Microsoft +Mises +Mitch +Mixin +Mock +Modeling +Modula Modules Monty Mountain +Mozilla N National +Nd New +Node None +Not +Nothing +Null +Number +Numeric +Nα O +Objective +Olsen +Optimized +Organization +Origin +Other +P Packard +Pareto Pascal +Passed +Patching Path +Paul Perl +Permission +Phases +Pillow +Platform +Platforms +Powershell +Precision +Print +Private +Program Py +PyCon +Pyrex +Python +Pythonic +Q +Qt +Queues Raising Randal +Ranges Readline +Red +Redistribution +Redistributions +Reference Reilly Research +Resources Reston +Richard +Rights +Ro +Roskind +Rossum +Ru +Runtime Rust +Sam +Saturation +Saving +Scientific +Scintilla Search +Second +Separated +Separator +Sequence +Set Sets +Settings +Setup +Shebang Shop Sign +Silicon +Simulation +Skimming +Slackware +Smalltalk +Software +Solaris Sox +Specific +Sphinx Stacks +Stallman Start +States +Stefan +Stein Stichting Storage +Store String +Studio +Subject +Subsystem Sun +Swift +Sx +Sy Syntax Tab +Tcl +Terry +This Thread +Tim +Time Title Tk +Traceback +Transactions Transform +Traversable +Tuples +Tutorial +Twisted +Twister U Ulf +Unbounded +Unices +Union +United Unix +Usenet V Van +Vol W +Weather Windows +Xcode +Yes Zen Zope +Zstandard a +abc +abcdef +above +abs abstract +access +accessing accessor +action +active +actor +add adding +adds +age +agency +al +alias +aliases +all alone +always +ame amp +an +analysis +anchor and +annotate annotating annotation annotations any api +app +append +apple +archive +archives +are +arg +argcount +args +argument +argv +around +arr +array +as +assembly +assert +assignment +async +asyncio +at +attribute +attributes +audit +auditing +available +average +await +awaitable b +back +backend +backport backslash backslashes backspace backwards +bacon base +based +bases bash +basis +basket batch be +before +below +bereft +beta +betavariate +big +bignum +bin +binaries +binary +binding +bindings bit bits +bitwise +blob block blocks +bool +boolean +booleans +bound +branch +breach +breadth +break +breakpoints +brief +buffer +buffered +buffers +bug +bugger +bugs +build +builds +built +builtin +builtins +bundle +but +by byte +bytearray bytecode bytecodes bytes +bytestring +bz +bzip c cache cached +call callable callables +callback callbacks +calling +can +cancel +canine +cannot +capture +carriage case +cased +casefolded +casefolding +caseless +cat +catch +ceil +cellvars +center cfg +cfuhash +chain +changes +char +character +charge +chdir +choice chomp +chr class +classcell classname +clear +close +closed +clossure +closure +cls +cmath +co code +codec +codecs +collect collection +collections com command comp +comparison +compatibility compilation compile compiled compiler +complex component +components comprehension comprehensions +concatenation +concurrently +conditions config +configure conflict conflicts +cong +conjugate +connect +consistency constructor +constructors +consts container containers +containment +contains context contexts contiguous +control +conv +convenience +conversion +copies +copy +copying +copyright coroutine coroutines +cost count +cout +coverage +coverdir +crc +create crt +csv +csvfile +cubes +curl +currency +current +curses +cut +cx +d +daemon +data +date +datetime +day +days +dbm de +dead +deal +debug +debugger +debugging +decimal +decorated decorator decorators +deemed +def +default +defaults +defghi +defined +deflate +deghi del delegation +delete delimiters +demo +deploy +depth +deque +derivative +description descriptor descriptors +desktop +devel dict dictionaries +dictionary +did +dimensionally +dir +direct +directory +dishes dispatch +display +dist +distribute +distribution +distutils dll +do doc docstring docstrings doctest +documentation +does +doesn +dom +done +dot dots dotted +double doubles +drag +dropping +dst dtoa duck +dunder +e editor editors +elem +elements +elif else email +embedded +encoding +end +endian +endianness +endorse +enter +entities entry +enum +env +epoch +eq +equidistributed +errno error errors +escape +escaped +escaping +et +eval +event events +exc except +exceptions exe exec expat +expected +expensive +exponential +expression expressions +extend extension +external +extra f facto +factories factory false fatal +favoring +fd +fib +fields +file +filename +filenamesize +files +filter finder finders first +firstlineno +flag flags +flatten float +floating floats +floor +fn +following foo for +forget +fork +form format formatted +formatting +forms +found +frac +frame +frames +framework +frameworks +free +freevars +freeze +freshfruit from +frozen +frozenset +frozensets +frozesets +fruit +fruits +fsum +func function +functions +functools g +gamma +garbage +gatewayed +gather +gauss +gc gdb +ge +general generator +generators +generic +generics +get +getattr +getcount +getcwd +getitem getter +gid global globals +go +golf +gpa +grant +granted +grants +grape +grid +group +grouping +grungy +gt +guard +guru +gzip +h +hack +half +handler +has hash +hashability +hashable +hashtag heaps +hello +hellos +help +hereafter +hereby +herein +hertz +hex hints +historic holder home +hook +host hot +however i +iPad +iPhone +id +idiom if +ignore +ignoredirs +ignoreids +immutable +implement +implementation import importer importing +importlib imports in +inactive +include +included +including +incorporates +increase index indexed indexes indexing +indirect inf +info +informal +inheritance +ini init initialization initializations initializers initleo initleoc +initlog input ins +insert +inst +insta install +installation +installing instance instances int +integer +integers interactive +interchange interface interfaces +intern +internet +interpolation interpreted interpreter introspective ints +invalid +inversion +invoke +is ish +isinstance it item +items +iter iterable iterables iterate iterating iteration +iterations iterator iterators +its +ium j +join +joing +joint +juice +jump k key +keys +keyword +keywords +kilobytes +kind +kiwi +kqueue +kwd +kwdefaults l lang last +lasti +lazy +le leading leap leaping +left +legacy +len +length leo +letters lib +libc libffi +license +life like +limit +limitation +line +linear +lineno liners +lines linking +links linters +linux +lisp list +listcomp +listing +lists literal +literale literals +little +lnotab loader loaders local +locale +localeconv localhost locals +location locks +log logging +lognormal +long +longs looks loop looping +lowercasing +lru +lst +lstrip +lt +m +made mail +mailbox mailing main +make +makefile +making +manager mangled +mangling +mantissa +map +mapping +mappingproxy +mappings +marshal +masking +match +matching +material +materials +math +matrix +max +maxsize +mbcs +memoizing +memory +memoryview +memoryviews menu +merge messages +met meta meth +method +microsecond +min +missing +mixin +mixins +mkdir +mm +mobile +mock +mod mode +modification +modify module modules modulo +most +mro ms mult multi must +mutable +mutex +my +mydict +myfile +mymodule +mypy n +nSecond name named names namespace namespaces +nan +nanosecond native +ncurses +ndim +ne +negative +new +newline +next +nlocals no +non +normal not notation +notice +now +nowait +nuget +null +num +number +numbers +numeric +numpy o +obj +object objects +obtaining +of +old +on one +onexit only op +opcode +opcodes open +opener +operations operator +options or +orange +ordinal +ordinals +org +os +other +others +otherwise out +over +overallocation +overalpping +overlap +pack package packages packing +pad +padding +pads page pages +pairs +pandas +parallel +parameter +params +parrot parser parsing +part +partnership +party +pass +passion +patch +patches path +pathname +paths +pattern +payload pdb +pdf +pear +perform +permission +permit +permitted +persistent +person +persons pi +pickle pip +pipe pipes +pkg place placeholder placeholders +play +point +points +pop +popen +popleft +population +portions +pos positional +pow +pp +precision +prefix +prefixes +prepare +prepared +prepares pretty +primary +prime +print +printable printer +printf +private +products project +promote prompt prompts +property +provided +provides provisional +proxy +pty +publicly +publish +pull +pure +pushing +put py pyc +pycache pyd +python +pythonrun +pythonx +pyw quacks +qualname +queue +quoted +quotes +r +rainfall raise +raised +random +randrange range +ranges raw +rb +rbga +rd re read reader +recent +recompile +record +reduce +ref +reference +regex +register regressions +regular +relationship +release +reload +remove +report +repr +reproduce +request +requiring +reserved +resource +restriction +result +results +retain +retained +return +reverse +reversed +rgb +rgba +rich +rights +rjust +roll +root +round +routines +row +run +runtime +runtimes s +safe +said +salad +salted +sample +sausage +sax +scalar +scanf +scipy +scope script +scripting scripts +search +second +seconds see +seed +seeds +seek self +sell +sendmail +sense sep +sequence +sequences server +service +services set +setProperty +setUp +setattr +setlocale +sets +setter +setup +setuptools +shall +shallow +shebang +shebangs +shell +shells +shift +shifted +shifting short +show +side +sign +signature +signed +sigstore +simplefilter +singleton +singletons site size +sl +slash +sleep +slept +slice +slices +slicing +slot +slots +so +software +somedir +sort +sorted source sources +space spaces spam +spamspam +spawn +spec +speed +split +splitlines spot +sprintf +sscanf stack +stackless +stacklevel +stacksize stand standard +start +started +state +statement +statements +static +staticmethod +station +status +stderr +stdin +stdio +stdout +step +stop str +stream +strftime string strings +strip +stripped strtod +struct +stub +stubs +student +style +sub +subject +sublicense submodule submodules subroutine subroutines subscript +subsequence +substantial +substring +such +sugar suite +sum +summary +super +superscript +support +supported switch switches +symbol symlink symlinks +symmary syntactic syntax +sys +sysconfig +system +systems +t tab tabs tag +tags +tangerine +tar +target +task +tasks +tb +tearDown +temperature templating +termcap terminal +terminate terminator terminators +terms test +testbed testing +testmod tests +text +that the +then +thereof +they +third +this +tho +thon thread +threaded threading +threads +through +time +timeout +titlecase +titlecased +tk to +today +token +tokens +toolkits +total trace +traceback +tracebacks +tracer tracker +trade +trademark +trademarks +triangular +trick +tricks true trunc try tty +tuple +tuples +tut +tutorial +two +txt type +typescript typing +tzname +u +uid +um +un +uname +unary +uncased +uncomp +undecorated +underscore +underscores +unhandled +unhashable +unices unicode +uniform uninitialized uninstall +unique unit +units +unittest +unpack unpacking +unsigned up +update +upon +uppercase +uppercasing +use user +users +using +utf +utility v +val +validate value +values van +var variable +varnames +vars +vec +vendoring +venture +venv +version +void +von +w +wants +warnings +warnoptions +weakref +weapon web +wheel +wheels +while whitespace +whom +wide +width wiki +will win window +windowed +windows +with +without +word +words +work +worker +workers +workfile +workload +works +world wrap +wrapped wrapper wrappers write +writer +written +writtern +www x +xc +xor +xvec y +yc you +yvec z +zip +zipapp zlib +zoneinfo +Αν +Αναπαραγωγιμότητα +Απλή Αριθμητική +Αριμθητικοί +Αυτό Βλ +Γεννήτορων +Γκρίνουιτς +Διανεμημένες +Ειδαλλιώς +Επαναλήπτες +Επαναχρησιμοποιώντας +Επιστρεφόμενοι +Η Κινητής Μετα +Μετακλάσεις +Μια +Μικροδευτερόλεπτα +Μπορείτε +Οδηγοί Περιβάλλοντας +Περιγραφέων +Περιτυλίγει +Προεκδόσεις +Προθεμάτιζει +Προθεμάτισε +Προθεματίζει +Πρόσθεσα +Πώς +Σεμινάριο +Σημειώστε +Συμπτύξτε +Υπάρχουν +Υπερ Υποδιαστολής +ά +ένα +έφτασε +ή αίτημά αγγίξετε +αγνοήσιμα +αγνοήσιμου +αγνοούμενες +αγνόηση +αδειάστηκαν +αιωρούμενους +ακολουθούμενους +αλλαγές αλληλοαποκλείονται +αλληλογραφίας +αναγνωσμένη αναδιατάξετε +αναδιατάσσει +αναζητήσιμα +αναζητήσιμο αναθέτη αναθέτης ανακατευθυνθεί +ανακατευθύνονται +ανακλώμενους +ανακτήσιμο +ανακτήσιμου +αναπαράγετε αναπαράξετε +αναπαραγωγίσιμες +αναπαραγωγίσιμη +αναπαραγώγιμη +αναπαραστάσιμα αναπαραστάσιμο +αναπαραστάσιμοι +ανασταλμένου +αναστημένο +ανατεθειμένους +αναφορές αντ +αντί +ανταλλάσετε +αντι +αντιγραμμένοι +αντικαθιστούμενη +αντικατεστημένες αντικειμενοστρεφής αντικειμενοστρεφείς +αντιστοιχιστή +αντιστραμμένα +αντιστραμμένη αντιταχθείτε αξιολογούμενης +απαρχαιωθούν +απαρχαιώσεως +απεγκαταστήστε +απεγκατασταθεί αποσειριοποίηση αποσειριοποίησης +αποσυρμένη +αποσυσκευασία +αποσυσκευασμένα +αποσυσκευασμένο +αποσφαλματωτή +αποσφαλματωτής +από +απόδρασή +αρχές +αρχείο +αρχειοθετημένη +αρχικοποιήθηκε +αρχικοποιηθούν +αρχικοποιημένες +αρχικοποιημένο +αρχικοποιητή +αρχικός βλ +βρείτε +γίνονται +για γλωσσαρίου +γραμμικοποιεί +δείτε +δειγματοληπτούνται +δεικτοδοτηθούν +δεικτοδοτημένη δεκαεξαδικής +δεκαεξαδικοί +δεν +δεξαεξαδικές δηλ +διάφoρα διαγραφέα +διακόπηκε +διαλέκτου +διαλειτουργήσει +διαλειτουργικό διαλειτουργικότητα +διαρρεύσετε διαχειρίζοντας +διαχειριζόμενες +διαχειριζόμενη διαχειριζόμενου +διγράφοι +διεξοδώς διεπαφών +διορθώσεις εγειρθεί +εγκαταστάτες +εγκαταστάτη +εγκαταστάτης +εγκαταστατών +εισάγοντάς +εισάγοντας +εκδόσεων +εκκινητή +εκτελούμενης εκτυπώσιμη +εκτυπώσιμο +εκτυπώσιμοι +εκτυπώσιμος +εμφωλευμένα +εμφωλευμένες +εμφωλευμένη +εμφωλευμένης +εμφωλευμένων +εμφωλεύετε +εμφωλεύσετε εμφώλευσης +εναλλάξιμες +ενδοκλάσεων +ενσωματωτές +ενσωματώσιμες εντοπιστές +εντοπιστή +εξαδικού +επ +επέκτασης +επίσης +επανάκληση +επανακαθορίζονται +επανακαθορισμός +επανακινεί επαναλήπτη επαναλήψιμους +επαναληπτές +επαναληπτή +επαναληπτών +επαναχρησιμοποιήσετε επαναχρησιμοποιηθούν +επανεγκατασήστε +επανεγκαταστήσετε +επανεγκαταστήστε επανεισάγω επανεκκινήσετε +επανεκκινείται +επανυπολογισμένο επαυξημένοι +επιθυμείτε +επικαλεί επικαλυπτόμενες +επικαλυπτόμενων +επικαλώντας +επιστρεφόμενης επιστρεφόμενος +εσοχίζουν +εσωκλειόμενη +εσωκλειόμενων +εσωτερικοποίησης +ευπάθειες +ευρετηριασμένα +ευρετηριοποίηση ευρετηριοποίησης ευρετηριοποιηθούν ευρετική +ζωής +η +ημι ηχούς +θα ισοσταθμιστή ιστοτόπων ιστότοπο ιστότοπος +ιχνηλάτηση +ιχνηλάτησης +ιχνηλατήσεων +καθαρό +καθοριστή +καθοριστής +και +καλέσιμο +καμμία +κανονικοποίηση +κανονικοποιούνται +κατάσταση +κατέληγες +κατακερματιζόμενες +κατακερματιστέες +καταστέλετε +καταστέλλετε +κατασταλούν +καταστείλετε +καταστραμμένο +καταχωρητή +κατηργημένο κεφαλίδας +κεφαλίδες κεφαλίδων +κλωνοποιημένο +κρυπτικό +κωδικοποίηση +κωδικοποιητή +κωδικοποιητών +κώδικα +λίστα +ληγμένου λπ μακροεντολές μακροεντολή +μεμονομένων +μετά μετα +μεταβάλλετε +μεταβλητή +μεταβλητοποιηθούν +μεταβλητότητά +μεταβλητών +μεταδεδομένα μεταδεδομένων +μετακλάσεις μετακλάσεων +μετακλάση μετακλάσης +μετατρέψετε +μεταφέρετε +μεταφέροντάς +μεταφοράς +μιμηθείτε +μονοεπεξεργαστικό +μπορεί +μπορούν +να +νανοδευτερολέπτων +νανοδευτερόλεπτα +νεο +νεοδεσμευμένο +νεοδημιουργημένες +νηματοποποίησης +ξεπερνάται +ο +οδηγίες +οδηγό +οδηγός +οκταδικές οκταδική οκταδικής +οκταδικού οκταδικούς οκταδικό +ολισθημένο ομαδοποιήστε +ονοματοδοσίας οποιουσδήποτε +οριοθέτες οριοθέτη +οστή +πάροχο +πακετοποιημένα παλαιώσουν +παλιό παραβατική +παρακαλούμε +παρακαμφθείσες +παραλειφθέντα παραμετροποιηθεί +παραμετροποιηθούν +παραμετροποιημένα +παραμετροποιημένες +παραμετροποιημένη +παραμετροποιημένο +παραμετροποιούν +παρατεθειμένα +παρατεθειμένη +παρατεθειμένο +παρόχους +παύλων +πεζογράμμιση +περιέκτης +περιέχει περιβάλλοντων +περιβάλλουσας +περιβαλλόμενοι περιγραφέα περιγραφέας +περιγραφέων +περιγραφείς περιηγείστε περικλειόμενο περικόβει +περικόψετε +περικόψτε +περιπλέκουμε +περιτυλίγετε +περιτυλίγοντάς +περιτυλιγμένης +περιτυλιγμένων +περιτύλιγαν +πλέον +πληθικότητα +πολλοί +πολυεπεξεργαστές +πολυεπεξεργαστικό πολυμορφική +πολυνημάτωσης +πολυνηματικά προέκδοση +προέκδοσης +προεγκατεστημένη +προεπεξεργασία +προεπιλέγει προεπιλεγμένης προεπιλεγμένος +προεπιλεγμένου προεπισκόπηση +προσήμου προσδιοριστές +προσδιοριστή +προσδιοριστής προσεταιριστικός +προσημασμένος +προσομοίωσή +προσομοιώσεών +προσπελαύνεται +προσποιηθείτε +προτάσσοντάς ρήτρων σίγαση +σε σειριοποίηση σειριοποίησης σειριοποιεί σειριοποιηθεί +σημαίνει +στην στιγμιοτύπου +στιγμιότυπα +στις +στο +στοιχείων στρογγυλοποιήσετε στρογγυλοποιημένο +συγγραφέας συμβολοσειρά συμβολοσειράς συμβολοσειρές +συμβολοσειριακά συμβολοσειρών +συμπεριλαμβανομένων +συμφραζόμενο +συμφραζόμενων συντηρησιμότητα +συντομογραφημένο +συστημικών συσχετιστικές συσχετιστικοί +σφαλμάτων +σωρευθούν +τέλος +ταιριασμένες +ταυτοποιεί +τελεστέο +τελεστέοι +τελεστέος +τελεστέου +τελεστέους +τερματιστή +την +της +τμηματοποιηθούν +το +τον +του +τρίτων τροποποιητές +τροποποιητής τυλιχθούν +τυχαιοποίηση +τυχαιότητας +των υ +υπακούουν υπεραντικείμενο +υπερισχύουσα +υπερκαλύψεων υπερκλάσης +υπερτύπος +υπο υποακολουθία υποακολουθίας +υποακολουθίες υποαντικείμενα +υποδιαδικασίες +υποεντολές +υποεντολή υποεντολών υποενότητα υποενότητες υποκατάλογος +υποκαταλόγους +υποκατηγοριοποιώντας +υποκλάσει υποκλάσεις +υποκλάσετε +υποκλάσεων υποκλάση υποκλάσης +υποκλάσσεται +υποκλαστεί +υπομέρη υπομονάδων υποπακέτα υποπακέτο +υποστηρίζεται υποστηριζόμενους +υποσυμβολοσειρά +υποτετραγωνική +υποτμημάτων +υποτύποι +υποτύπος +υποφάκελο +υποφάκελος +υποφακέλους +φάκελους χειριζόμενες +χρήσιμες +χρήσιμοι +χρονιστής +χρονοσφραγίδα +ψήφια +ψευδο +ψευδοτερματικού +ψευδοτερματικό +ψευδοτερματικών +ψευδοτυχαία +ψευδοτυχαίες +ψευδοτυχαίων ό +ότι diff --git a/distributing/index.po b/distributing/index.po index 6ef43dc5..a9fa3bcb 100644 --- a/distributing/index.po +++ b/distributing/index.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2024-11-25 20:18+0000\n" +"Last-Translator: Artemis Leonardou \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: distributing/index.rst:10 msgid "Distributing Python Modules" -msgstr "" +msgstr "Διανομή Python Modules" #: distributing/index.rst:14 msgid "" @@ -26,3 +27,6 @@ msgid "" "been moved to the `Python Packaging User Guide`_, and the tutorial on " "`packaging Python projects`_." msgstr "" +"Οι πληροφορίες και οι οδηγίες για την διανομή των Python modules και των " +"πακέτων έχουν μεταφερθεί στο `Python Packaging User Guide`_ και στο " +"διδακτικό υλικό `packaging Python projects`_." diff --git a/extending/building.po b/extending/building.po index 23d8b062..c55bf7ff 100644 --- a/extending/building.po +++ b/extending/building.po @@ -8,69 +8,132 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-06-19 17:57+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: extending/building.rst:7 msgid "Building C and C++ Extensions" -msgstr "" +msgstr "Κατασκευή Επεκτάσεων C και C++" #: extending/building.rst:9 msgid "" -"A C extension for CPython is a shared library (e.g. a ``.so`` file on Linux, " -"``.pyd`` on Windows), which exports an *initialization function*." +"A C extension for CPython is a shared library (for example, a ``.so`` file " +"on Linux, ``.pyd`` on Windows), which exports an *initialization function*." msgstr "" +"Μια επέκταση C για τη CPython είναι μια κοινόχρηστη βιβλιοθήκη (π.χ. ένα " +"αρχείο ``.so`` στο Linux, ``.pyd`` στα Windows), η οποία εξάγει μια " +"*συνάρτηση αρχικοποίησης*." #: extending/building.rst:12 -msgid "" -"To be importable, the shared library must be available on :envvar:" -"`PYTHONPATH`, and must be named after the module name, with an appropriate " -"extension. When using setuptools, the correct filename is generated " -"automatically." -msgstr "" +msgid "See :ref:`extension-modules` for details." +msgstr "Δείτε το :ref:`extension-modules` για περισσότερες λεπτομέρειες." -#: extending/building.rst:16 -msgid "The initialization function has the signature:" -msgstr "" +#: extending/building.rst:21 +msgid "Building C and C++ Extensions with setuptools" +msgstr "Κατασκευή Επεκτάσεων C και C++ με το setuptools" -#: extending/building.rst:20 +#: extending/building.rst:24 msgid "" -"It returns either a fully initialized module, or a :c:type:`PyModuleDef` " -"instance. See :ref:`initializing-modules` for details." +"Building, packaging and distributing extension modules is best done with " +"third-party tools, and is out of scope of this document. One suitable tool " +"is Setuptools, whose documentation can be found at https://setuptools.pypa." +"io/en/latest/setuptools.html." msgstr "" +"Η κατασκευή, η συσκευασία και η διανομή modules επέκτασης γίνεται καλύτερα " +"με εργαλεία τρίτων και είναι εκτός πεδίου εφαρμογής αυτού του εγγράφου. Ένα " +"κατάλληλο εργαλείο είναι το Setuptools, η τεκμηρίωση του οποίου βρίσκεται " +"στη διεύθυνση https://setuptools.pypa.io/en/latest/setuptools.html." -#: extending/building.rst:25 +#: extending/building.rst:29 msgid "" -"For modules with ASCII-only names, the function must be named " -"``PyInit_``, with ```` replaced by the name of the " -"module. When using :ref:`multi-phase-initialization`, non-ASCII module names " -"are allowed. In this case, the initialization function name is " -"``PyInitU_``, with ```` encoded using Python's " -"*punycode* encoding with hyphens replaced by underscores. In Python::" +"The :mod:`distutils` module, which was included in the standard library " +"until Python 3.12, is now maintained as part of Setuptools." msgstr "" +"Το module :mod:`distutils`, η οποία περιλαμβανόταν στην τυπική βιβλιοθήκη " +"μέχρι την Python 3.12, διατηρείται πλέον ως μέρος του Setuptools." -#: extending/building.rst:39 -msgid "" -"It is possible to export multiple modules from a single shared library by " -"defining multiple initialization functions. However, importing them requires " -"using symbolic links or a custom importer, because by default only the " -"function corresponding to the filename is found. See the *\"Multiple modules " -"in one library\"* section in :pep:`489` for details." -msgstr "" +#~ msgid "" +#~ "To be importable, the shared library must be available on :envvar:" +#~ "`PYTHONPATH`, and must be named after the module name, with an " +#~ "appropriate extension. When using setuptools, the correct filename is " +#~ "generated automatically." +#~ msgstr "" +#~ "Για να μπορεί να γίνει η εισαγωγή της, η κοινόχρηστη βιβλιοθήκη πρέπει να " +#~ "είναι διαθέσιμη στο :envvar:`PYTHONPATH` και να έχει όνομα ίδιο με αυτό " +#~ "του module, με τη σωστή επέκταση αρχείου. Όταν χρησιμοποιείται το " +#~ "setuptools, το σωστό όνομα αρχείου δημιουργείται αυτόματα." -#: extending/building.rst:52 -msgid "Building C and C++ Extensions with setuptools" -msgstr "" +#~ msgid "The initialization function has the signature:" +#~ msgstr "Η συνάρτηση αρχικοποίησης έχει την εξής υπογραφή:" -#: extending/building.rst:54 -msgid "" -"Python 3.12 and newer no longer come with distutils. Please refer to the " -"``setuptools`` documentation at https://setuptools.readthedocs.io/en/latest/" -"setuptools.html to learn more about how build and distribute C/C++ " -"extensions with setuptools." -msgstr "" +#~ msgid "" +#~ "It returns either a fully initialized module, or a :c:type:`PyModuleDef` " +#~ "instance. See :ref:`initializing-modules` for details." +#~ msgstr "" +#~ "Επιστρέφει είτε ένα πλήρως αρχικοποιημένο module, είτε ένα στιγμιότυπο :c:" +#~ "type:`PyModuleDef`. Δείτε το :ref:`initializing-modules` για περισσότερες " +#~ "λεπτομέρειες." + +#~ msgid "" +#~ "For modules with ASCII-only names, the function must be named " +#~ "``PyInit_``, with ```` replaced by the name of " +#~ "the module. When using :ref:`multi-phase-initialization`, non-ASCII " +#~ "module names are allowed. In this case, the initialization function name " +#~ "is ``PyInitU_``, with ```` encoded using Python's " +#~ "*punycode* encoding with hyphens replaced by underscores. In Python::" +#~ msgstr "" +#~ "Για modules με ονόματα μόνο σε ASCII χαρακτήρες, η συνάρτηση πρέπει να " +#~ "ονομάζεται ``PyInit_``, όπου το ```` " +#~ "αντικαθίσταται με το όνομα του module. Όταν χρησιμοποιείται :ref:`multi-" +#~ "phase-initialization`, επιτρέπονται ονόματα module με μη ASCII " +#~ "χαρακτήρες. Σε αυτή την περίπτωση, η συνάρτηση αρχικοποίησης ονομάζεται " +#~ "``PyInitU_``, με το ```` να κωδικοποιείται με το " +#~ "*punycode* του Python, αντικαθιστώντας τις παύλες με κάτω παύλες. Στην " +#~ "Python::" + +#~ msgid "" +#~ "def initfunc_name(name):\n" +#~ " try:\n" +#~ " suffix = b'_' + name.encode('ascii')\n" +#~ " except UnicodeEncodeError:\n" +#~ " suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" +#~ " return b'PyInit' + suffix" +#~ msgstr "" +#~ "def initfunc_name(name):\n" +#~ " try:\n" +#~ " suffix = b'_' + name.encode('ascii')\n" +#~ " except UnicodeEncodeError:\n" +#~ " suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" +#~ " return b'PyInit' + suffix" + +#~ msgid "" +#~ "It is possible to export multiple modules from a single shared library by " +#~ "defining multiple initialization functions. However, importing them " +#~ "requires using symbolic links or a custom importer, because by default " +#~ "only the function corresponding to the filename is found. See the " +#~ "*\"Multiple modules in one library\"* section in :pep:`489` for details." +#~ msgstr "" +#~ "Είναι δυνατόν να εξαχθούν πολλά modules από μία κοινόχρηστη βιβλιοθήκη, " +#~ "ορίζοντας πολλαπλές συναρτήσεις αρχικοποίησης. Ωστόσο, για την εισαγωγή " +#~ "τους απαιτείται η χρήση συμβολικών συνδέσμων ή προσαρμοσμένου import " +#~ "μηχανισμού, καθώς από προεπιλογή βρίσκονται μόνο οι συναρτήσεις που " +#~ "αντιστοιχούν στο όνομα του αρχείου. Δείτε το *\"Multiple modules in one " +#~ "library\"* στο :pep:`489` για λεπτομέρειες." + +#~ msgid "" +#~ "Python 3.12 and newer no longer come with distutils. Please refer to the " +#~ "``setuptools`` documentation at https://setuptools.readthedocs.io/en/" +#~ "latest/setuptools.html to learn more about how build and distribute C/C++ " +#~ "extensions with setuptools." +#~ msgstr "" +#~ "Από την έκδοση Python 3.12 και μετά, το distutils δεν περιλαμβάνεται " +#~ "πλέον. Παρακαλούμε ανατρέξτε στην τεκμηρίωση του ``setuptools`` στη " +#~ "διεύθυνση https://setuptools.readthedocs.io/en/latest/setuptools.html για " +#~ "να μάθετε περισσότερα σχετικά με την κατασκευή και διανομή επεκτάσεων C/C+" +#~ "+ με το setuptools." diff --git a/extending/embedding.po b/extending/embedding.po index 0693c49a..70e9fca1 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -62,7 +63,7 @@ msgid "" "Python objects." msgstr "" -#: extending/embedding.rst:42 +#: extending/embedding.rst:41 msgid ":ref:`c-api-index`" msgstr "" @@ -84,26 +85,72 @@ msgid "" "used to perform some operation on a file. ::" msgstr "" -#: extending/embedding.rst:78 +#: extending/embedding.rst:56 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* optional but recommended */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" +" PyRun_SimpleString(\"from time import time,ctime\\n\"\n" +" \"print('Today is', ctime(time()))\\n\");\n" +" if (Py_FinalizeEx() < 0) {\n" +" exit(120);\n" +" }\n" +" return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" +"}" +msgstr "" + +#: extending/embedding.rst:92 msgid "" -"The :c:func:`Py_SetProgramName` function should be called before :c:func:" -"`Py_Initialize` to inform the interpreter about paths to Python run-time " -"libraries. Next, the Python interpreter is initialized with :c:func:" -"`Py_Initialize`, followed by the execution of a hard-coded Python script " -"that prints the date and time. Afterwards, the :c:func:`Py_FinalizeEx` call " -"shuts the interpreter down, followed by the end of the program. In a real " -"program, you may want to get the Python script from another source, perhaps " -"a text-editor routine, a file, or a database. Getting the Python code from " -"a file can better be done by using the :c:func:`PyRun_SimpleFile` function, " -"which saves you the trouble of allocating memory space and loading the file " -"contents." +"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should " +"be used in some APIs instead of ``int``. It is not necessary since Python " +"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" +"string-and-buffers` for a description of this macro." msgstr "" -#: extending/embedding.rst:93 +#: extending/embedding.rst:97 +msgid "" +"Setting :c:member:`PyConfig.program_name` should be called before :c:func:" +"`Py_InitializeFromConfig` to inform the interpreter about paths to Python " +"run-time libraries. Next, the Python interpreter is initialized with :c:" +"func:`Py_Initialize`, followed by the execution of a hard-coded Python " +"script that prints the date and time. Afterwards, the :c:func:" +"`Py_FinalizeEx` call shuts the interpreter down, followed by the end of the " +"program. In a real program, you may want to get the Python script from " +"another source, perhaps a text-editor routine, a file, or a database. " +"Getting the Python code from a file can better be done by using the :c:func:" +"`PyRun_SimpleFile` function, which saves you the trouble of allocating " +"memory space and loading the file contents." +msgstr "" + +#: extending/embedding.rst:112 msgid "Beyond Very High Level Embedding: An overview" msgstr "" -#: extending/embedding.rst:95 +#: extending/embedding.rst:114 msgid "" "The high level interface gives you the ability to execute arbitrary pieces " "of Python code from your application, but exchanging data values is quite " @@ -112,7 +159,7 @@ msgid "" "anything." msgstr "" -#: extending/embedding.rst:100 +#: extending/embedding.rst:119 msgid "" "It should be noted that extending Python and embedding Python is quite the " "same activity, despite the different intent. Most topics discussed in the " @@ -120,37 +167,37 @@ msgid "" "code from Python to C really does:" msgstr "" -#: extending/embedding.rst:105 +#: extending/embedding.rst:124 msgid "Convert data values from Python to C," msgstr "" -#: extending/embedding.rst:107 +#: extending/embedding.rst:126 msgid "Perform a function call to a C routine using the converted values, and" msgstr "" -#: extending/embedding.rst:109 +#: extending/embedding.rst:128 msgid "Convert the data values from the call from C to Python." msgstr "" -#: extending/embedding.rst:111 +#: extending/embedding.rst:130 msgid "When embedding Python, the interface code does:" msgstr "" -#: extending/embedding.rst:113 +#: extending/embedding.rst:132 msgid "Convert data values from C to Python," msgstr "" -#: extending/embedding.rst:115 +#: extending/embedding.rst:134 msgid "" "Perform a function call to a Python interface routine using the converted " "values, and" msgstr "" -#: extending/embedding.rst:118 +#: extending/embedding.rst:137 msgid "Convert the data values from the call from Python to C." msgstr "" -#: extending/embedding.rst:120 +#: extending/embedding.rst:139 msgid "" "As you can see, the data conversion steps are simply swapped to accommodate " "the different direction of the cross-language transfer. The only difference " @@ -158,7 +205,7 @@ msgid "" "you call a C routine, when embedding, you call a Python routine." msgstr "" -#: extending/embedding.rst:125 +#: extending/embedding.rst:144 msgid "" "This chapter will not discuss how to convert data from Python to C and vice " "versa. Also, proper use of references and dealing with errors is assumed to " @@ -166,11 +213,11 @@ msgid "" "interpreter, you can refer to earlier chapters for the required information." msgstr "" -#: extending/embedding.rst:134 +#: extending/embedding.rst:153 msgid "Pure Embedding" msgstr "" -#: extending/embedding.rst:136 +#: extending/embedding.rst:155 msgid "" "The first program aims to execute a function in a Python script. Like in the " "section about the very high level interface, the Python interpreter does not " @@ -178,11 +225,87 @@ msgid "" "section)." msgstr "" -#: extending/embedding.rst:141 +#: extending/embedding.rst:160 msgid "The code to run a function defined in a Python script is:" msgstr "" -#: extending/embedding.rst:146 +#: extending/embedding.rst:162 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyObject *pName, *pModule, *pFunc;\n" +" PyObject *pArgs, *pValue;\n" +" int i;\n" +"\n" +" if (argc < 3) {\n" +" fprintf(stderr,\"Usage: call pythonfile funcname [args]\\n\");\n" +" return 1;\n" +" }\n" +"\n" +" Py_Initialize();\n" +" pName = PyUnicode_DecodeFSDefault(argv[1]);\n" +" /* Error checking of pName left out */\n" +"\n" +" pModule = PyImport_Import(pName);\n" +" Py_DECREF(pName);\n" +"\n" +" if (pModule != NULL) {\n" +" pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" +" /* pFunc is a new reference */\n" +"\n" +" if (pFunc && PyCallable_Check(pFunc)) {\n" +" pArgs = PyTuple_New(argc - 3);\n" +" for (i = 0; i < argc - 3; ++i) {\n" +" pValue = PyLong_FromLong(atoi(argv[i + 3]));\n" +" if (!pValue) {\n" +" Py_DECREF(pArgs);\n" +" Py_DECREF(pModule);\n" +" fprintf(stderr, \"Cannot convert argument\\n\");\n" +" return 1;\n" +" }\n" +" /* pValue reference stolen here: */\n" +" PyTuple_SetItem(pArgs, i, pValue);\n" +" }\n" +" pValue = PyObject_CallObject(pFunc, pArgs);\n" +" Py_DECREF(pArgs);\n" +" if (pValue != NULL) {\n" +" printf(\"Result of call: %ld\\n\", PyLong_AsLong(pValue));\n" +" Py_DECREF(pValue);\n" +" }\n" +" else {\n" +" Py_DECREF(pFunc);\n" +" Py_DECREF(pModule);\n" +" PyErr_Print();\n" +" fprintf(stderr,\"Call failed\\n\");\n" +" return 1;\n" +" }\n" +" }\n" +" else {\n" +" if (PyErr_Occurred())\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", " +"argv[2]);\n" +" }\n" +" Py_XDECREF(pFunc);\n" +" Py_DECREF(pModule);\n" +" }\n" +" else {\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Failed to load \\\"%s\\\"\\n\", argv[1]);\n" +" return 1;\n" +" }\n" +" if (Py_FinalizeEx() < 0) {\n" +" return 120;\n" +" }\n" +" return 0;\n" +"}\n" +msgstr "" + +#: extending/embedding.rst:165 msgid "" "This code loads a Python script using ``argv[1]``, and calls the function " "named in ``argv[2]``. Its integer arguments are the other values of the " @@ -191,26 +314,62 @@ msgid "" "a Python script, such as:" msgstr "" -#: extending/embedding.rst:161 +#: extending/embedding.rst:171 +msgid "" +"def multiply(a,b):\n" +" print(\"Will compute\", a, \"times\", b)\n" +" c = 0\n" +" for i in range(0, a):\n" +" c = c + b\n" +" return c" +msgstr "" + +#: extending/embedding.rst:180 msgid "then the result should be:" msgstr "" -#: extending/embedding.rst:169 +#: extending/embedding.rst:182 +msgid "" +"$ call multiply multiply 3 2\n" +"Will compute 3 times 2\n" +"Result of call: 6" +msgstr "" + +#: extending/embedding.rst:188 msgid "" "Although the program is quite large for its functionality, most of the code " "is for data conversion between Python and C, and for error reporting. The " "interesting part with respect to embedding Python starts with ::" msgstr "" -#: extending/embedding.rst:178 +#: extending/embedding.rst:192 +msgid "" +"Py_Initialize();\n" +"pName = PyUnicode_DecodeFSDefault(argv[1]);\n" +"/* Error checking of pName left out */\n" +"pModule = PyImport_Import(pName);" +msgstr "" + +#: extending/embedding.rst:197 msgid "" "After initializing the interpreter, the script is loaded using :c:func:" "`PyImport_Import`. This routine needs a Python string as its argument, " -"which is constructed using the :c:func:`PyUnicode_FromString` data " +"which is constructed using the :c:func:`PyUnicode_DecodeFSDefault` data " "conversion routine. ::" msgstr "" -#: extending/embedding.rst:191 +#: extending/embedding.rst:202 +msgid "" +"pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" +"/* pFunc is a new reference */\n" +"\n" +"if (pFunc && PyCallable_Check(pFunc)) {\n" +" ...\n" +"}\n" +"Py_XDECREF(pFunc);" +msgstr "" + +#: extending/embedding.rst:210 msgid "" "Once the script is loaded, the name we're looking for is retrieved using :c:" "func:`PyObject_GetAttrString`. If the name exists, and the object returned " @@ -219,18 +378,22 @@ msgid "" "Python function is then made with::" msgstr "" -#: extending/embedding.rst:199 +#: extending/embedding.rst:216 +msgid "pValue = PyObject_CallObject(pFunc, pArgs);" +msgstr "" + +#: extending/embedding.rst:218 msgid "" "Upon return of the function, ``pValue`` is either ``NULL`` or it contains a " "reference to the return value of the function. Be sure to release the " "reference after examining the value." msgstr "" -#: extending/embedding.rst:207 +#: extending/embedding.rst:226 msgid "Extending Embedded Python" msgstr "" -#: extending/embedding.rst:209 +#: extending/embedding.rst:228 msgid "" "Until now, the embedded Python interpreter had no access to functionality " "from the application itself. The Python API allows this by extending the " @@ -242,30 +405,75 @@ msgid "" "like you would write a normal Python extension. For example::" msgstr "" -#: extending/embedding.rst:246 +#: extending/embedding.rst:237 +msgid "" +"static int numargs=0;\n" +"\n" +"/* Return the number of arguments of the application command line */\n" +"static PyObject*\n" +"emb_numargs(PyObject *self, PyObject *args)\n" +"{\n" +" if(!PyArg_ParseTuple(args, \":numargs\"))\n" +" return NULL;\n" +" return PyLong_FromLong(numargs);\n" +"}\n" +"\n" +"static PyMethodDef emb_module_methods[] = {\n" +" {\"numargs\", emb_numargs, METH_VARARGS,\n" +" \"Return the number of arguments received by the process.\"},\n" +" {NULL, NULL, 0, NULL}\n" +"};\n" +"\n" +"static struct PyModuleDef emb_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"emb\",\n" +" .m_size = 0,\n" +" .m_methods = emb_module_methods,\n" +"};\n" +"\n" +"static PyObject*\n" +"PyInit_emb(void)\n" +"{\n" +" return PyModuleDef_Init(&emb_module);\n" +"}" +msgstr "" + +#: extending/embedding.rst:267 msgid "" "Insert the above code just above the :c:func:`main` function. Also, insert " "the following two statements before the call to :c:func:`Py_Initialize`::" msgstr "" -#: extending/embedding.rst:252 +#: extending/embedding.rst:270 +msgid "" +"numargs = argc;\n" +"PyImport_AppendInittab(\"emb\", &PyInit_emb);" +msgstr "" + +#: extending/embedding.rst:273 msgid "" "These two lines initialize the ``numargs`` variable, and make the :func:`!" "emb.numargs` function accessible to the embedded Python interpreter. With " "these extensions, the Python script can do things like" msgstr "" -#: extending/embedding.rst:261 +#: extending/embedding.rst:277 +msgid "" +"import emb\n" +"print(\"Number of arguments\", emb.numargs())" +msgstr "" + +#: extending/embedding.rst:282 msgid "" "In a real application, the methods will expose an API of the application to " "Python." msgstr "" -#: extending/embedding.rst:271 +#: extending/embedding.rst:292 msgid "Embedding Python in C++" msgstr "" -#: extending/embedding.rst:273 +#: extending/embedding.rst:294 msgid "" "It is also possible to embed Python in a C++ program; precisely how this is " "done will depend on the details of the C++ system used; in general you will " @@ -274,11 +482,11 @@ msgid "" "+." msgstr "" -#: extending/embedding.rst:282 +#: extending/embedding.rst:303 msgid "Compiling and Linking under Unix-like systems" msgstr "" -#: extending/embedding.rst:284 +#: extending/embedding.rst:305 msgid "" "It is not necessarily trivial to find the right flags to pass to your " "compiler (and linker) in order to embed the Python interpreter into your " @@ -286,7 +494,7 @@ msgid "" "implemented as C dynamic extensions (:file:`.so` files) linked against it." msgstr "" -#: extending/embedding.rst:290 +#: extending/embedding.rst:311 msgid "" "To find out the required compiler and linker flags, you can execute the :" "file:`python{X.Y}-config` script which is generated as part of the " @@ -295,19 +503,33 @@ msgid "" "directly useful to you:" msgstr "" -#: extending/embedding.rst:296 +#: extending/embedding.rst:317 msgid "" "``pythonX.Y-config --cflags`` will give you the recommended flags when " "compiling:" msgstr "" -#: extending/embedding.rst:304 +#: extending/embedding.rst:320 +msgid "" +"$ /opt/bin/python3.11-config --cflags\n" +"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " +"-g -fwrapv -O3 -Wall" +msgstr "" + +#: extending/embedding.rst:325 msgid "" "``pythonX.Y-config --ldflags --embed`` will give you the recommended flags " "when linking:" msgstr "" -#: extending/embedding.rst:313 +#: extending/embedding.rst:328 +msgid "" +"$ /opt/bin/python3.11-config --ldflags --embed\n" +"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" +"lpthread -ldl -lutil -lm" +msgstr "" + +#: extending/embedding.rst:334 msgid "" "To avoid confusion between several Python installations (and especially " "between the system Python and your own compiled Python), it is recommended " @@ -315,7 +537,7 @@ msgid "" "above example." msgstr "" -#: extending/embedding.rst:318 +#: extending/embedding.rst:339 msgid "" "If this procedure doesn't work for you (it is not guaranteed to work for all " "Unix-like platforms; however, we welcome :ref:`bug reports >> import sysconfig\n" +">>> sysconfig.get_config_var('LIBS')\n" +"'-lpthread -ldl -lutil'\n" +">>> sysconfig.get_config_var('LINKFORSHARED')\n" +"'-Xlinker -export-dynamic'" +msgstr "" diff --git a/extending/extending.po b/extending/extending.po index d543cae9..b3a86c82 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -68,6 +69,12 @@ msgid "" "this function to be callable from Python as follows:" msgstr "" +#: extending/extending.rst:48 +msgid "" +">>> import spam\n" +">>> status = spam.system(\"ls -l\")" +msgstr "" + #: extending/extending.rst:53 msgid "" "Begin by creating a file :file:`spammodule.c`. (Historically, if a module " @@ -80,6 +87,12 @@ msgstr "" msgid "The first two lines of our file can be::" msgstr "" +#: extending/extending.rst:706 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include " +msgstr "" + #: extending/extending.rst:63 msgid "" "which pulls in the Python API (you can add a comment describing the purpose " @@ -95,29 +108,117 @@ msgstr "" #: extending/extending.rst:72 msgid "" -"It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including " -"``Python.h``. See :ref:`parsetuple` for a description of this macro." +"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should " +"be used in some APIs instead of ``int``. It is not necessary since Python " +"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" +"string-and-buffers` for a description of this macro." msgstr "" -#: extending/extending.rst:75 +#: extending/extending.rst:77 msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " -"or ``PY``, except those defined in standard header files. For convenience, " -"and since they are used extensively by the Python interpreter, ``\"Python." -"h\"`` includes a few standard header files: ````, ````, " -"````, and ````. If the latter header file does not exist " -"on your system, it declares the functions :c:func:`malloc`, :c:func:`free` " -"and :c:func:`realloc` directly." +"or ``PY``, except those defined in standard header files." +msgstr "" + +#: extending/extending.rst:82 +msgid "" +"For backward compatibility, :file:`Python.h` includes several standard " +"header files. C extensions should include the standard headers that they " +"use, and should not rely on these implicit includes. If using the limited C " +"API version 3.13 or newer, the implicit includes are:" +msgstr "" + +#: extending/extending.rst:87 +msgid "````" +msgstr "" + +#: extending/extending.rst:88 +msgid "```` (on Windows)" +msgstr "" + +#: extending/extending.rst:89 +msgid "````" +msgstr "" + +#: extending/extending.rst:90 +msgid "````" +msgstr "" + +#: extending/extending.rst:91 +msgid "````" +msgstr "" + +#: extending/extending.rst:92 +msgid "````" +msgstr "" + +#: extending/extending.rst:93 +msgid "````" +msgstr "" + +#: extending/extending.rst:94 +msgid "```` (if present)" msgstr "" -#: extending/extending.rst:83 +#: extending/extending.rst:96 +msgid "" +"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.12 or " +"older, the headers below are also included:" +msgstr "" + +#: extending/extending.rst:99 +msgid "````" +msgstr "" + +#: extending/extending.rst:100 +msgid "```` (on POSIX)" +msgstr "" + +#: extending/extending.rst:102 +msgid "" +"If :c:macro:`Py_LIMITED_API` is not defined, or is set to version 3.10 or " +"older, the headers below are also included:" +msgstr "" + +#: extending/extending.rst:105 +msgid "````" +msgstr "" + +#: extending/extending.rst:106 +msgid "````" +msgstr "" + +#: extending/extending.rst:107 +msgid "````" +msgstr "" + +#: extending/extending.rst:108 +msgid "````" +msgstr "" + +#: extending/extending.rst:110 msgid "" "The next thing we add to our module file is the C function that will be " "called when the Python expression ``spam.system(string)`` is evaluated " "(we'll see shortly how it ends up being called)::" msgstr "" -#: extending/extending.rst:99 +#: extending/extending.rst:114 +msgid "" +"static PyObject *\n" +"spam_system(PyObject *self, PyObject *args)\n" +"{\n" +" const char *command;\n" +" int sts;\n" +"\n" +" if (!PyArg_ParseTuple(args, \"s\", &command))\n" +" return NULL;\n" +" sts = system(command);\n" +" return PyLong_FromLong(sts);\n" +"}" +msgstr "" + +#: extending/extending.rst:126 msgid "" "There is a straightforward translation from the argument list in Python (for " "example, the single expression ``\"ls -l\"``) to the arguments passed to the " @@ -125,13 +226,13 @@ msgid "" "*self* and *args*." msgstr "" -#: extending/extending.rst:104 +#: extending/extending.rst:131 msgid "" "The *self* argument points to the module object for module-level functions; " "for a method it would point to the object instance." msgstr "" -#: extending/extending.rst:107 +#: extending/extending.rst:134 msgid "" "The *args* argument will be a pointer to a Python tuple object containing " "the arguments. Each item of the tuple corresponds to an argument in the " @@ -143,7 +244,7 @@ msgid "" "variables into which to store the converted values. More about this later." msgstr "" -#: extending/extending.rst:116 +#: extending/extending.rst:143 msgid "" ":c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the " "right type and its components have been stored in the variables whose " @@ -153,11 +254,11 @@ msgid "" "example)." msgstr "" -#: extending/extending.rst:126 +#: extending/extending.rst:153 msgid "Intermezzo: Errors and Exceptions" msgstr "" -#: extending/extending.rst:128 +#: extending/extending.rst:155 msgid "" "An important convention throughout the Python interpreter is the following: " "when a function fails, it should set an exception condition and return an " @@ -169,13 +270,13 @@ msgid "" "important to know about them to understand how errors are passed around." msgstr "" -#: extending/extending.rst:137 +#: extending/extending.rst:164 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." msgstr "" -#: extending/extending.rst:139 +#: extending/extending.rst:166 msgid "" "The most common one is :c:func:`PyErr_SetString`. Its arguments are an " "exception object and a C string. The exception object is usually a " @@ -184,7 +285,7 @@ msgid "" "and stored as the \"associated value\" of the exception." msgstr "" -#: extending/extending.rst:145 +#: extending/extending.rst:172 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " @@ -194,7 +295,7 @@ msgid "" "to any of these functions." msgstr "" -#: extending/extending.rst:152 +#: extending/extending.rst:179 msgid "" "You can test non-destructively whether an exception has been set with :c:" "func:`PyErr_Occurred`. This returns the current exception object, or " @@ -203,7 +304,7 @@ msgid "" "since you should be able to tell from the return value." msgstr "" -#: extending/extending.rst:158 +#: extending/extending.rst:185 msgid "" "When a function *f* that calls another function *g* detects that the latter " "fails, *f* should itself return an error value (usually ``NULL`` or " @@ -216,7 +317,7 @@ msgid "" "tries to find an exception handler specified by the Python programmer." msgstr "" -#: extending/extending.rst:168 +#: extending/extending.rst:195 msgid "" "(There are situations where a module can actually give a more detailed error " "message by calling another ``PyErr_*`` function, and in such cases it is " @@ -225,7 +326,7 @@ msgid "" "can fail for a variety of reasons.)" msgstr "" -#: extending/extending.rst:174 +#: extending/extending.rst:201 msgid "" "To ignore an exception set by a function call that failed, the exception " "condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The " @@ -234,7 +335,7 @@ msgid "" "itself (possibly by trying something else, or pretending nothing went wrong)." msgstr "" -#: extending/extending.rst:180 +#: extending/extending.rst:207 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " "direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" @@ -243,7 +344,7 @@ msgid "" "so this note is only relevant to those who call :c:func:`malloc` directly." msgstr "" -#: extending/extending.rst:186 +#: extending/extending.rst:213 msgid "" "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " "and friends, functions that return an integer status usually return a " @@ -251,14 +352,14 @@ msgid "" "calls." msgstr "" -#: extending/extending.rst:190 +#: extending/extending.rst:217 msgid "" "Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" "c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" -#: extending/extending.rst:194 +#: extending/extending.rst:221 msgid "" "The choice of which exception to raise is entirely yours. There are " "predeclared C objects corresponding to all built-in Python exceptions, such " @@ -271,19 +372,80 @@ msgid "" "satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" -#: extending/extending.rst:204 +#: extending/extending.rst:231 msgid "" -"You can also define a new exception that is unique to your module. For this, " -"you usually declare a static object variable at the beginning of your file::" +"You can also define a new exception that is unique to your module. The " +"simplest way to do this is to declare a static global object variable at the " +"beginning of the file::" +msgstr "" + +#: extending/extending.rst:235 +msgid "static PyObject *SpamError = NULL;" msgstr "" -#: extending/extending.rst:209 +#: extending/extending.rst:237 msgid "" -"and initialize it in your module's initialization function (:c:func:`!" -"PyInit_spam`) with an exception object::" +"and initialize it by calling :c:func:`PyErr_NewException` in the module's :c:" +"data:`Py_mod_exec` function (:c:func:`!spam_module_exec`)::" msgstr "" -#: extending/extending.rst:233 +#: extending/extending.rst:240 +msgid "SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);" +msgstr "" + +#: extending/extending.rst:242 +msgid "" +"Since :c:data:`!SpamError` is a global variable, it will be overwritten " +"every time the module is reinitialized, when the :c:data:`Py_mod_exec` " +"function is called." +msgstr "" + +#: extending/extending.rst:245 +msgid "" +"For now, let's avoid the issue: we will block repeated initialization by " +"raising an :py:exc:`ImportError`::" +msgstr "" + +#: extending/extending.rst:248 +msgid "" +"static PyObject *SpamError = NULL;\n" +"\n" +"static int\n" +"spam_module_exec(PyObject *m)\n" +"{\n" +" if (SpamError != NULL) {\n" +" PyErr_SetString(PyExc_ImportError,\n" +" \"cannot initialize spam module more than once\");\n" +" return -1;\n" +" }\n" +" SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);\n" +" if (PyModule_AddObjectRef(m, \"SpamError\", SpamError) < 0) {\n" +" return -1;\n" +" }\n" +"\n" +" return 0;\n" +"}\n" +"\n" +"static PyModuleDef_Slot spam_module_slots[] = {\n" +" {Py_mod_exec, spam_module_exec},\n" +" {0, NULL}\n" +"};\n" +"\n" +"static struct PyModuleDef spam_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"spam\",\n" +" .m_size = 0, // non-negative\n" +" .m_slots = spam_module_slots,\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_spam(void)\n" +"{\n" +" return PyModuleDef_Init(&spam_module);\n" +"}" +msgstr "" + +#: extending/extending.rst:284 msgid "" "Note that the Python name for the exception object is :exc:`!spam.error`. " "The :c:func:`PyErr_NewException` function may create a class with the base " @@ -291,7 +453,7 @@ msgid "" "``NULL``), described in :ref:`bltin-exceptions`." msgstr "" -#: extending/extending.rst:238 +#: extending/extending.rst:289 msgid "" "Note also that the :c:data:`!SpamError` variable retains a reference to the " "newly created exception class; this is intentional! Since the exception " @@ -302,29 +464,62 @@ msgid "" "unintended side effects." msgstr "" -#: extending/extending.rst:245 +#: extending/extending.rst:296 +msgid "" +"For now, the :c:func:`Py_DECREF` call to remove this reference is missing. " +"Even when the Python interpreter shuts down, the global :c:data:`!SpamError` " +"variable will not be garbage-collected. It will \"leak\". We did, however, " +"ensure that this will happen at most once per process." +msgstr "" + +#: extending/extending.rst:301 msgid "" "We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type " "later in this sample." msgstr "" -#: extending/extending.rst:248 +#: extending/extending.rst:304 msgid "" "The :exc:`!spam.error` exception can be raised in your extension module " "using a call to :c:func:`PyErr_SetString` as shown below::" msgstr "" -#: extending/extending.rst:271 +#: extending/extending.rst:307 +msgid "" +"static PyObject *\n" +"spam_system(PyObject *self, PyObject *args)\n" +"{\n" +" const char *command;\n" +" int sts;\n" +"\n" +" if (!PyArg_ParseTuple(args, \"s\", &command))\n" +" return NULL;\n" +" sts = system(command);\n" +" if (sts < 0) {\n" +" PyErr_SetString(SpamError, \"System command failed\");\n" +" return NULL;\n" +" }\n" +" return PyLong_FromLong(sts);\n" +"}" +msgstr "" + +#: extending/extending.rst:327 msgid "Back to the Example" msgstr "" -#: extending/extending.rst:273 +#: extending/extending.rst:329 msgid "" "Going back to our example function, you should now be able to understand " "this statement::" msgstr "" -#: extending/extending.rst:279 +#: extending/extending.rst:332 +msgid "" +"if (!PyArg_ParseTuple(args, \"s\", &command))\n" +" return NULL;" +msgstr "" + +#: extending/extending.rst:335 msgid "" "It returns ``NULL`` (the error indicator for functions returning object " "pointers) if an error is detected in the argument list, relying on the " @@ -335,26 +530,34 @@ msgid "" "properly be declared as ``const char *command``)." msgstr "" -#: extending/extending.rst:287 +#: extending/extending.rst:343 msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" msgstr "" -#: extending/extending.rst:292 +#: extending/extending.rst:346 +msgid "sts = system(command);" +msgstr "" + +#: extending/extending.rst:348 msgid "" "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " "a Python object. This is done using the function :c:func:" "`PyLong_FromLong`. ::" msgstr "" -#: extending/extending.rst:297 +#: extending/extending.rst:351 +msgid "return PyLong_FromLong(sts);" +msgstr "" + +#: extending/extending.rst:353 msgid "" "In this case, it will return an integer object. (Yes, even integers are " "objects on the heap in Python!)" msgstr "" -#: extending/extending.rst:300 +#: extending/extending.rst:356 msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:expr:`void`), the corresponding Python function must return " @@ -362,24 +565,41 @@ msgid "" "macro:`Py_RETURN_NONE` macro)::" msgstr "" -#: extending/extending.rst:308 +#: extending/extending.rst:361 +msgid "" +"Py_INCREF(Py_None);\n" +"return Py_None;" +msgstr "" + +#: extending/extending.rst:364 msgid "" ":c:data:`Py_None` is the C name for the special Python object ``None``. It " "is a genuine Python object rather than a ``NULL`` pointer, which means " "\"error\" in most contexts, as we have seen." msgstr "" -#: extending/extending.rst:316 +#: extending/extending.rst:372 msgid "The Module's Method Table and Initialization Function" msgstr "" -#: extending/extending.rst:318 +#: extending/extending.rst:374 msgid "" "I promised to show how :c:func:`!spam_system` is called from Python " "programs. First, we need to list its name and address in a \"method table\"::" msgstr "" -#: extending/extending.rst:329 +#: extending/extending.rst:377 +msgid "" +"static PyMethodDef spam_methods[] = {\n" +" ...\n" +" {\"system\", spam_system, METH_VARARGS,\n" +" \"Execute a shell command.\"},\n" +" ...\n" +" {NULL, NULL, 0, NULL} /* Sentinel */\n" +"};" +msgstr "" + +#: extending/extending.rst:385 msgid "" "Note the third entry (``METH_VARARGS``). This is a flag telling the " "interpreter the calling convention to be used for the C function. It should " @@ -388,14 +608,14 @@ msgid "" "is used." msgstr "" -#: extending/extending.rst:334 +#: extending/extending.rst:390 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" "level parameters to be passed in as a tuple acceptable for parsing via :c:" "func:`PyArg_ParseTuple`; more information on this function is provided below." msgstr "" -#: extending/extending.rst:338 +#: extending/extending.rst:394 msgid "" "The :c:macro:`METH_KEYWORDS` bit may be set in the third field if keyword " "arguments should be passed to the function. In this case, the C function " @@ -404,12 +624,21 @@ msgid "" "to such a function." msgstr "" -#: extending/extending.rst:344 +#: extending/extending.rst:400 msgid "" "The method table must be referenced in the module definition structure::" msgstr "" -#: extending/extending.rst:355 +#: extending/extending.rst:402 +msgid "" +"static struct PyModuleDef spam_module = {\n" +" ...\n" +" .m_methods = spam_methods,\n" +" ...\n" +"};" +msgstr "" + +#: extending/extending.rst:408 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " "initialization function. The initialization function must be named :c:func:" @@ -417,28 +646,32 @@ msgid "" "only non-\\ ``static`` item defined in the module file::" msgstr "" -#: extending/extending.rst:366 +#: extending/extending.rst:413 +msgid "" +"PyMODINIT_FUNC\n" +"PyInit_spam(void)\n" +"{\n" +" return PyModuleDef_Init(&spam_module);\n" +"}" +msgstr "" + +#: extending/extending.rst:419 msgid "" "Note that :c:macro:`PyMODINIT_FUNC` declares the function as ``PyObject *`` " "return type, declares any special linkage declarations required by the " "platform, and for C++ declares the function as ``extern \"C\"``." msgstr "" -#: extending/extending.rst:370 +#: extending/extending.rst:423 msgid "" -"When the Python program imports module :mod:`!spam` for the first time, :c:" -"func:`!PyInit_spam` is called. (See below for comments about embedding " -"Python.) It calls :c:func:`PyModule_Create`, which returns a module object, " -"and inserts built-in function objects into the newly created module based " -"upon the table (an array of :c:type:`PyMethodDef` structures) found in the " -"module definition. :c:func:`PyModule_Create` returns a pointer to the module " -"object that it creates. It may abort with a fatal error for certain errors, " -"or return ``NULL`` if the module could not be initialized satisfactorily. " -"The init function must return the module object to its caller, so that it " -"then gets inserted into ``sys.modules``." +":c:func:`!PyInit_spam` is called when each interpreter imports its module :" +"mod:`!spam` for the first time. (See below for comments about embedding " +"Python.) A pointer to the module definition must be returned via :c:func:" +"`PyModuleDef_Init`, so that the import machinery can create the module and " +"store it in ``sys.modules``." msgstr "" -#: extending/extending.rst:381 +#: extending/extending.rst:428 msgid "" "When embedding Python, the :c:func:`!PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`PyImport_Inittab` " @@ -446,35 +679,83 @@ msgid "" "`PyImport_AppendInittab`, optionally followed by an import of the module::" msgstr "" -#: extending/extending.rst:425 +#: extending/extending.rst:433 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* Add a built-in module, before Py_Initialize */\n" +" if (PyImport_AppendInittab(\"spam\", PyInit_spam) == -1) {\n" +" fprintf(stderr, \"Error: could not extend in-built modules " +"table\\n\");\n" +" exit(1);\n" +" }\n" +"\n" +" /* Pass argv[0] to the Python interpreter */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" /* Initialize the Python interpreter. Required.\n" +" If this step fails, it will be a fatal error. */\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" +" /* Optionally import the module; alternatively,\n" +" import can be deferred until the embedded script\n" +" imports it. */\n" +" PyObject *pmodule = PyImport_ImportModule(\"spam\");\n" +" if (!pmodule) {\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Error: could not import module 'spam'\\n\");\n" +" }\n" +"\n" +" // ... use Python C API here ...\n" +"\n" +" return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" +"}" +msgstr "" + +#: extending/extending.rst:483 msgid "" -"Removing entries from ``sys.modules`` or importing compiled modules into " +"If you declare a global variable or a local static one, the module may " +"experience unintended side-effects on re-initialisation, for example when " +"removing entries from ``sys.modules`` or importing compiled modules into " "multiple interpreters within a process (or following a :c:func:`fork` " -"without an intervening :c:func:`exec`) can create problems for some " -"extension modules. Extension module authors should exercise caution when " -"initializing internal data structures." +"without an intervening :c:func:`exec`). If module state is not yet fully :" +"ref:`isolated `, authors should consider marking " +"the module as having no support for subinterpreters (via :c:macro:" +"`Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED`)." msgstr "" -#: extending/extending.rst:431 +#: extending/extending.rst:492 msgid "" "A more substantial example module is included in the Python source " -"distribution as :file:`Modules/xxmodule.c`. This file may be used as a " +"distribution as :file:`Modules/xxlimited.c`. This file may be used as a " "template or simply read as an example." msgstr "" -#: extending/extending.rst:437 -msgid "" -"Unlike our ``spam`` example, ``xxmodule`` uses *multi-phase initialization* " -"(new in Python 3.5), where a PyModuleDef structure is returned from " -"``PyInit_spam``, and creation of the module is left to the import machinery. " -"For details on multi-phase initialization, see :PEP:`489`." -msgstr "" - -#: extending/extending.rst:446 +#: extending/extending.rst:500 msgid "Compilation and Linkage" msgstr "" -#: extending/extending.rst:448 +#: extending/extending.rst:502 msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " @@ -484,7 +765,7 @@ msgid "" "Windows (chapter :ref:`building-on-windows`) for more information about this." msgstr "" -#: extending/extending.rst:455 +#: extending/extending.rst:509 msgid "" "If you can't use dynamic loading, or if you want to make your module a " "permanent part of the Python interpreter, you will have to change the " @@ -494,7 +775,11 @@ msgid "" "line to the file :file:`Modules/Setup.local` describing your file:" msgstr "" -#: extending/extending.rst:466 +#: extending/extending.rst:516 +msgid "spam spammodule.o" +msgstr "" + +#: extending/extending.rst:520 msgid "" "and rebuild the interpreter by running :program:`make` in the toplevel " "directory. You can also run :program:`make` in the :file:`Modules/` " @@ -503,17 +788,21 @@ msgid "" "the :file:`Setup` file.)" msgstr "" -#: extending/extending.rst:472 +#: extending/extending.rst:526 msgid "" "If your module requires additional libraries to link with, these can be " "listed on the line in the configuration file as well, for instance:" msgstr "" -#: extending/extending.rst:483 +#: extending/extending.rst:529 +msgid "spam spammodule.o -lX11" +msgstr "" + +#: extending/extending.rst:537 msgid "Calling Python Functions from C" msgstr "" -#: extending/extending.rst:485 +#: extending/extending.rst:539 msgid "" "So far we have concentrated on making C functions callable from Python. The " "reverse is also useful: calling Python functions from C. This is especially " @@ -524,7 +813,7 @@ msgid "" "uses are also imaginable." msgstr "" -#: extending/extending.rst:493 +#: extending/extending.rst:547 msgid "" "Fortunately, the Python interpreter is easily called recursively, and there " "is a standard interface to call a Python function. (I won't dwell on how to " @@ -533,7 +822,7 @@ msgid "" "line option in :file:`Modules/main.c` from the Python source code.)" msgstr "" -#: extending/extending.rst:499 +#: extending/extending.rst:553 msgid "" "Calling a Python function is easy. First, the Python program must somehow " "pass you the Python function object. You should provide a function (or some " @@ -543,7 +832,34 @@ msgid "" "function might be part of a module definition::" msgstr "" -#: extending/extending.rst:529 +#: extending/extending.rst:560 +msgid "" +"static PyObject *my_callback = NULL;\n" +"\n" +"static PyObject *\n" +"my_set_callback(PyObject *dummy, PyObject *args)\n" +"{\n" +" PyObject *result = NULL;\n" +" PyObject *temp;\n" +"\n" +" if (PyArg_ParseTuple(args, \"O:set_callback\", &temp)) {\n" +" if (!PyCallable_Check(temp)) {\n" +" PyErr_SetString(PyExc_TypeError, \"parameter must be " +"callable\");\n" +" return NULL;\n" +" }\n" +" Py_XINCREF(temp); /* Add a reference to new callback */\n" +" Py_XDECREF(my_callback); /* Dispose of previous callback */\n" +" my_callback = temp; /* Remember new callback */\n" +" /* Boilerplate to return \"None\" */\n" +" Py_INCREF(Py_None);\n" +" result = Py_None;\n" +" }\n" +" return result;\n" +"}" +msgstr "" + +#: extending/extending.rst:583 msgid "" "This function must be registered with the interpreter using the :c:macro:" "`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" @@ -551,7 +867,7 @@ msgid "" "section :ref:`parsetuple`." msgstr "" -#: extending/extending.rst:534 +#: extending/extending.rst:588 msgid "" "The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement " "the reference count of an object and are safe in the presence of ``NULL`` " @@ -559,7 +875,7 @@ msgid "" "info on them in section :ref:`refcounts`." msgstr "" -#: extending/extending.rst:541 +#: extending/extending.rst:595 msgid "" "Later, when it is time to call the function, you call the C function :c:func:" "`PyObject_CallObject`. This function has two arguments, both pointers to " @@ -571,7 +887,21 @@ msgid "" "or more format codes between parentheses. For example::" msgstr "" -#: extending/extending.rst:561 +#: extending/extending.rst:604 +msgid "" +"int arg;\n" +"PyObject *arglist;\n" +"PyObject *result;\n" +"...\n" +"arg = 123;\n" +"...\n" +"/* Time to call the callback */\n" +"arglist = Py_BuildValue(\"(i)\", arg);\n" +"result = PyObject_CallObject(my_callback, arglist);\n" +"Py_DECREF(arglist);" +msgstr "" + +#: extending/extending.rst:615 msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " @@ -580,7 +910,7 @@ msgid "" "`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." msgstr "" -#: extending/extending.rst:568 +#: extending/extending.rst:622 msgid "" "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " "brand new object, or it is an existing object whose reference count has been " @@ -589,7 +919,7 @@ msgid "" "not interested in its value." msgstr "" -#: extending/extending.rst:574 +#: extending/extending.rst:628 msgid "" "Before you do this, however, it is important to check that the return value " "isn't ``NULL``. If it is, the Python function terminated by raising an " @@ -600,7 +930,15 @@ msgid "" "should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" -#: extending/extending.rst:587 +#: extending/extending.rst:636 +msgid "" +"if (result == NULL)\n" +" return NULL; /* Pass error back */\n" +"...use result...\n" +"Py_DECREF(result);" +msgstr "" + +#: extending/extending.rst:641 msgid "" "Depending on the desired interface to the Python callback function, you may " "also have to provide an argument list to :c:func:`PyObject_CallObject`. In " @@ -612,7 +950,20 @@ msgid "" "you want to pass an integral event code, you might use the following code::" msgstr "" -#: extending/extending.rst:606 +#: extending/extending.rst:650 +msgid "" +"PyObject *arglist;\n" +"...\n" +"arglist = Py_BuildValue(\"(l)\", eventcode);\n" +"result = PyObject_CallObject(my_callback, arglist);\n" +"Py_DECREF(arglist);\n" +"if (result == NULL)\n" +" return NULL; /* Pass error back */\n" +"/* Here maybe use the result */\n" +"Py_DECREF(result);" +msgstr "" + +#: extending/extending.rst:660 msgid "" "Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " "before the error check! Also note that strictly speaking this code is not " @@ -620,22 +971,39 @@ msgid "" "checked." msgstr "" -#: extending/extending.rst:610 +#: extending/extending.rst:664 msgid "" "You may also call a function with keyword arguments by using :c:func:" "`PyObject_Call`, which supports arguments and keyword arguments. As in the " "above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" msgstr "" -#: extending/extending.rst:628 +#: extending/extending.rst:668 +msgid "" +"PyObject *dict;\n" +"...\n" +"dict = Py_BuildValue(\"{s:i}\", \"name\", val);\n" +"result = PyObject_Call(my_callback, NULL, dict);\n" +"Py_DECREF(dict);\n" +"if (result == NULL)\n" +" return NULL; /* Pass error back */\n" +"/* Here maybe use the result */\n" +"Py_DECREF(result);" +msgstr "" + +#: extending/extending.rst:682 msgid "Extracting Parameters in Extension Functions" msgstr "" -#: extending/extending.rst:632 +#: extending/extending.rst:686 msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr "" -#: extending/extending.rst:636 +#: extending/extending.rst:688 +msgid "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" +msgstr "" + +#: extending/extending.rst:690 msgid "" "The *arg* argument must be a tuple object containing an argument list passed " "from Python to a C function. The *format* argument must be a format string, " @@ -644,7 +1012,7 @@ msgid "" "whose type is determined by the format string." msgstr "" -#: extending/extending.rst:642 +#: extending/extending.rst:696 msgid "" "Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " "have the required types, it cannot check the validity of the addresses of C " @@ -652,26 +1020,102 @@ msgid "" "probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" -#: extending/extending.rst:647 +#: extending/extending.rst:701 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not decrement their reference count!" msgstr "" -#: extending/extending.rst:650 +#: extending/extending.rst:704 msgid "Some example calls::" msgstr "" -#: extending/extending.rst:720 +#: extending/extending.rst:711 +msgid "" +"int ok;\n" +"int i, j;\n" +"long k, l;\n" +"const char *s;\n" +"Py_ssize_t size;\n" +"\n" +"ok = PyArg_ParseTuple(args, \"\"); /* No arguments */\n" +" /* Python call: f() */" +msgstr "" + +#: extending/extending.rst:722 +msgid "" +"ok = PyArg_ParseTuple(args, \"s\", &s); /* A string */\n" +" /* Possible Python call: f('whoops!') */" +msgstr "" + +#: extending/extending.rst:727 +msgid "" +"ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string " +"*/\n" +" /* Possible Python call: f(1, 2, 'three') */" +msgstr "" + +#: extending/extending.rst:732 +msgid "" +"ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" +" /* A pair of ints and a string, whose size is also returned */\n" +" /* Possible Python call: f((1, 2), 'three') */" +msgstr "" + +#: extending/extending.rst:738 +msgid "" +"{\n" +" const char *file;\n" +" const char *mode = \"r\";\n" +" int bufsize = 0;\n" +" ok = PyArg_ParseTuple(args, \"s|si\", &file, &mode, &bufsize);\n" +" /* A string, and optionally another string and an integer */\n" +" /* Possible Python calls:\n" +" f('spam')\n" +" f('spam', 'w')\n" +" f('spam', 'wb', 100000) */\n" +"}" +msgstr "" + +#: extending/extending.rst:752 +msgid "" +"{\n" +" int left, top, right, bottom, h, v;\n" +" ok = PyArg_ParseTuple(args, \"((ii)(ii))(ii)\",\n" +" &left, &top, &right, &bottom, &h, &v);\n" +" /* A rectangle and a point */\n" +" /* Possible Python call:\n" +" f(((0, 0), (400, 300)), (10, 10)) */\n" +"}" +msgstr "" + +#: extending/extending.rst:763 +msgid "" +"{\n" +" Py_complex c;\n" +" ok = PyArg_ParseTuple(args, \"D:myfunction\", &c);\n" +" /* a complex, also providing a function name for errors */\n" +" /* Possible Python call: myfunction(1+2j) */\n" +"}" +msgstr "" + +#: extending/extending.rst:774 msgid "Keyword Parameters for Extension Functions" msgstr "" -#: extending/extending.rst:724 +#: extending/extending.rst:778 msgid "" "The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" msgstr "" -#: extending/extending.rst:729 +#: extending/extending.rst:780 +msgid "" +"int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" +" const char *format, char * const " +"*kwlist, ...);" +msgstr "" + +#: extending/extending.rst:783 msgid "" "The *arg* and *format* parameters are identical to those of the :c:func:" "`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " @@ -683,30 +1127,87 @@ msgid "" "raises an appropriate exception." msgstr "" -#: extending/extending.rst:739 +#: extending/extending.rst:793 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " "parameters passed in which are not present in the *kwlist* will cause :exc:" "`TypeError` to be raised." msgstr "" -#: extending/extending.rst:745 +#: extending/extending.rst:799 msgid "" "Here is an example module which uses keywords, based on an example by Geoff " "Philbrick (philbrick@hks.com)::" msgstr "" -#: extending/extending.rst:800 +#: extending/extending.rst:802 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"static PyObject *\n" +"keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds)\n" +"{\n" +" int voltage;\n" +" const char *state = \"a stiff\";\n" +" const char *action = \"voom\";\n" +" const char *type = \"Norwegian Blue\";\n" +"\n" +" static char *kwlist[] = {\"voltage\", \"state\", \"action\", \"type\", " +"NULL};\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, keywds, \"i|sss\", kwlist,\n" +" &voltage, &state, &action, &type))\n" +" return NULL;\n" +"\n" +" printf(\"-- This parrot wouldn't %s if you put %i Volts through it." +"\\n\",\n" +" action, voltage);\n" +" printf(\"-- Lovely plumage, the %s -- It's %s!\\n\", type, state);\n" +"\n" +" Py_RETURN_NONE;\n" +"}\n" +"\n" +"static PyMethodDef keywdarg_methods[] = {\n" +" /* The cast of the function is necessary since PyCFunction values\n" +" * only take two PyObject* parameters, and keywdarg_parrot() takes\n" +" * three.\n" +" */\n" +" {\"parrot\", (PyCFunction)(void(*)(void))keywdarg_parrot, METH_VARARGS | " +"METH_KEYWORDS,\n" +" \"Print a lovely skit to standard output.\"},\n" +" {NULL, NULL, 0, NULL} /* sentinel */\n" +"};\n" +"\n" +"static struct PyModuleDef keywdarg_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"keywdarg\",\n" +" .m_size = 0,\n" +" .m_methods = keywdarg_methods,\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_keywdarg(void)\n" +"{\n" +" return PyModuleDef_Init(&keywdarg_module);\n" +"}" +msgstr "" + +#: extending/extending.rst:853 msgid "Building Arbitrary Values" msgstr "" -#: extending/extending.rst:802 +#: extending/extending.rst:855 msgid "" "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " "declared as follows::" msgstr "" -#: extending/extending.rst:807 +#: extending/extending.rst:858 +msgid "PyObject *Py_BuildValue(const char *format, ...);" +msgstr "" + +#: extending/extending.rst:860 msgid "" "It recognizes a set of format units similar to the ones recognized by :c:" "func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " @@ -714,7 +1215,7 @@ msgid "" "object, suitable for returning from a C function called from Python." msgstr "" -#: extending/extending.rst:812 +#: extending/extending.rst:865 msgid "" "One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " "its first argument to be a tuple (since Python argument lists are always " @@ -726,16 +1227,37 @@ msgid "" "parenthesize the format string." msgstr "" -#: extending/extending.rst:820 +#: extending/extending.rst:873 msgid "" "Examples (to the left the call, to the right the resulting Python value):" msgstr "" -#: extending/extending.rst:846 +#: extending/extending.rst:875 +msgid "" +"Py_BuildValue(\"\") None\n" +"Py_BuildValue(\"i\", 123) 123\n" +"Py_BuildValue(\"iii\", 123, 456, 789) (123, 456, 789)\n" +"Py_BuildValue(\"s\", \"hello\") 'hello'\n" +"Py_BuildValue(\"y\", \"hello\") b'hello'\n" +"Py_BuildValue(\"ss\", \"hello\", \"world\") ('hello', 'world')\n" +"Py_BuildValue(\"s#\", \"hello\", 4) 'hell'\n" +"Py_BuildValue(\"y#\", \"hello\", 4) b'hell'\n" +"Py_BuildValue(\"()\") ()\n" +"Py_BuildValue(\"(i)\", 123) (123,)\n" +"Py_BuildValue(\"(ii)\", 123, 456) (123, 456)\n" +"Py_BuildValue(\"(i,i)\", 123, 456) (123, 456)\n" +"Py_BuildValue(\"[i,i]\", 123, 456) [123, 456]\n" +"Py_BuildValue(\"{s:i,s:i}\",\n" +" \"abc\", 123, \"def\", 456) {'abc': 123, 'def': 456}\n" +"Py_BuildValue(\"((ii)(ii)) (ii)\",\n" +" 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" +msgstr "" + +#: extending/extending.rst:899 msgid "Reference Counts" msgstr "" -#: extending/extending.rst:848 +#: extending/extending.rst:901 msgid "" "In languages like C or C++, the programmer is responsible for dynamic " "allocation and deallocation of memory on the heap. In C, this is done using " @@ -744,7 +1266,7 @@ msgid "" "restrict the following discussion to the C case." msgstr "" -#: extending/extending.rst:854 +#: extending/extending.rst:907 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " "returned to the pool of available memory by exactly one call to :c:func:" @@ -753,13 +1275,13 @@ msgid "" "memory it occupies cannot be reused until the program terminates. This is " "called a :dfn:`memory leak`. On the other hand, if a program calls :c:func:" "`free` for a block and then continues to use the block, it creates a " -"conflict with re-use of the block through another :c:func:`malloc` call. " +"conflict with reuse of the block through another :c:func:`malloc` call. " "This is called :dfn:`using freed memory`. It has the same bad consequences " "as referencing uninitialized data --- core dumps, wrong results, mysterious " "crashes." msgstr "" -#: extending/extending.rst:865 +#: extending/extending.rst:918 msgid "" "Common causes of memory leaks are unusual paths through the code. For " "instance, a function may allocate a block of memory, do some calculation, " @@ -776,7 +1298,7 @@ msgid "" "of errors." msgstr "" -#: extending/extending.rst:878 +#: extending/extending.rst:931 msgid "" "Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " "needs a strategy to avoid memory leaks as well as the use of freed memory. " @@ -787,7 +1309,7 @@ msgid "" "reference to the object has been deleted and the object is freed." msgstr "" -#: extending/extending.rst:886 +#: extending/extending.rst:939 msgid "" "An alternative strategy is called :dfn:`automatic garbage collection`. " "(Sometimes, reference counting is also referred to as a garbage collection " @@ -803,7 +1325,7 @@ msgid "" "with reference counts." msgstr "" -#: extending/extending.rst:898 +#: extending/extending.rst:951 msgid "" "While Python uses the traditional reference counting implementation, it also " "offers a cycle detector that works to detect reference cycles. This allows " @@ -817,7 +1339,7 @@ msgid "" "though there are no further references to the cycle itself." msgstr "" -#: extending/extending.rst:909 +#: extending/extending.rst:962 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " "The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." @@ -825,11 +1347,11 @@ msgid "" "disable the detector at runtime." msgstr "" -#: extending/extending.rst:918 +#: extending/extending.rst:971 msgid "Reference Counting in Python" msgstr "" -#: extending/extending.rst:920 +#: extending/extending.rst:973 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " "the incrementing and decrementing of the reference count. :c:func:" @@ -840,7 +1362,7 @@ msgid "" "object." msgstr "" -#: extending/extending.rst:927 +#: extending/extending.rst:980 msgid "" "The big question now remains: when to use ``Py_INCREF(x)`` and " "``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " @@ -853,7 +1375,7 @@ msgid "" "reference creates a memory leak." msgstr "" -#: extending/extending.rst:936 +#: extending/extending.rst:989 msgid "" "It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " "borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " @@ -862,7 +1384,7 @@ msgid "" "risks using freed memory and should be avoided completely [#]_." msgstr "" -#: extending/extending.rst:942 +#: extending/extending.rst:995 msgid "" "The advantage of borrowing over owning a reference is that you don't need to " "take care of disposing of the reference on all possible paths through the " @@ -873,7 +1395,7 @@ msgid "" "borrowed has in fact disposed of it." msgstr "" -#: extending/extending.rst:950 +#: extending/extending.rst:1003 msgid "" "A borrowed reference can be changed into an owned reference by calling :c:" "func:`Py_INCREF`. This does not affect the status of the owner from which " @@ -882,18 +1404,18 @@ msgid "" "properly, as well as the previous owner)." msgstr "" -#: extending/extending.rst:960 +#: extending/extending.rst:1013 msgid "Ownership Rules" msgstr "" -#: extending/extending.rst:962 +#: extending/extending.rst:1015 msgid "" "Whenever an object reference is passed into or out of a function, it is part " "of the function's interface specification whether ownership is transferred " "with the reference or not." msgstr "" -#: extending/extending.rst:966 +#: extending/extending.rst:1019 msgid "" "Most functions that return a reference to an object pass on ownership with " "the reference. In particular, all functions whose function it is to create " @@ -904,7 +1426,7 @@ msgid "" "reference to a cached item." msgstr "" -#: extending/extending.rst:974 +#: extending/extending.rst:1027 msgid "" "Many functions that extract objects from other objects also transfer " "ownership with the reference, for instance :c:func:" @@ -915,14 +1437,14 @@ msgid "" "list or dictionary." msgstr "" -#: extending/extending.rst:981 +#: extending/extending.rst:1034 msgid "" "The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " "even though it may actually create the object it returns: this is possible " "because an owned reference to the object is stored in ``sys.modules``." msgstr "" -#: extending/extending.rst:985 +#: extending/extending.rst:1038 msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " @@ -933,7 +1455,7 @@ msgid "" "don't take over ownership --- they are \"normal.\")" msgstr "" -#: extending/extending.rst:993 +#: extending/extending.rst:1046 msgid "" "When a C function is called from Python, it borrows references to its " "arguments from the caller. The caller owns a reference to the object, so " @@ -942,18 +1464,18 @@ msgid "" "turned into an owned reference by calling :c:func:`Py_INCREF`." msgstr "" -#: extending/extending.rst:999 +#: extending/extending.rst:1052 msgid "" "The object reference returned from a C function that is called from Python " "must be an owned reference --- ownership is transferred from the function to " "its caller." msgstr "" -#: extending/extending.rst:1007 +#: extending/extending.rst:1060 msgid "Thin Ice" msgstr "" -#: extending/extending.rst:1009 +#: extending/extending.rst:1062 msgid "" "There are a few situations where seemingly harmless use of a borrowed " "reference can lead to problems. These all have to do with implicit " @@ -961,31 +1483,50 @@ msgid "" "dispose of it." msgstr "" -#: extending/extending.rst:1013 +#: extending/extending.rst:1066 msgid "" "The first and most important case to know about is using :c:func:`Py_DECREF` " "on an unrelated object while borrowing a reference to a list item. For " "instance::" msgstr "" -#: extending/extending.rst:1025 +#: extending/extending.rst:1069 +msgid "" +"void\n" +"bug(PyObject *list)\n" +"{\n" +" PyObject *item = PyList_GetItem(list, 0);\n" +"\n" +" PyList_SetItem(list, 1, PyLong_FromLong(0L));\n" +" PyObject_Print(item, stdout, 0); /* BUG! */\n" +"}" +msgstr "" + +#: extending/extending.rst:1078 msgid "" "This function first borrows a reference to ``list[0]``, then replaces " "``list[1]`` with the value ``0``, and finally prints the borrowed reference. " "Looks harmless, right? But it's not!" msgstr "" -#: extending/extending.rst:1029 +#: extending/extending.rst:1082 msgid "" "Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " "references to all its items, so when item 1 is replaced, it has to dispose " "of the original item 1. Now let's suppose the original item 1 was an " "instance of a user-defined class, and let's further suppose that the class " "defined a :meth:`!__del__` method. If this class instance has a reference " -"count of 1, disposing of it will call its :meth:`!__del__` method." +"count of 1, disposing of it will call its :meth:`!__del__` method. " +"Internally, :c:func:`PyList_SetItem` calls :c:func:`Py_DECREF` on the " +"replaced item, which invokes replaced item's corresponding :c:member:" +"`~PyTypeObject.tp_dealloc` function. During deallocation, :c:member:" +"`~PyTypeObject.tp_dealloc` calls :c:member:`~PyTypeObject.tp_finalize`, " +"which is mapped to the :meth:`!__del__` method for class instances (see :pep:" +"`442`). This entire sequence happens synchronously within the :c:func:" +"`PyList_SetItem` call." msgstr "" -#: extending/extending.rst:1036 +#: extending/extending.rst:1096 msgid "" "Since it is written in Python, the :meth:`!__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -996,37 +1537,64 @@ msgid "" "associated with it, thereby invalidating ``item``." msgstr "" -#: extending/extending.rst:1044 +#: extending/extending.rst:1104 msgid "" "The solution, once you know the source of the problem, is easy: temporarily " "increment the reference count. The correct version of the function reads::" msgstr "" -#: extending/extending.rst:1058 +#: extending/extending.rst:1107 +msgid "" +"void\n" +"no_bug(PyObject *list)\n" +"{\n" +" PyObject *item = PyList_GetItem(list, 0);\n" +"\n" +" Py_INCREF(item);\n" +" PyList_SetItem(list, 1, PyLong_FromLong(0L));\n" +" PyObject_Print(item, stdout, 0);\n" +" Py_DECREF(item);\n" +"}" +msgstr "" + +#: extending/extending.rst:1118 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`!__del__` methods would fail..." msgstr "" -#: extending/extending.rst:1062 +#: extending/extending.rst:1122 msgid "" "The second case of problems with a borrowed reference is a variant involving " "threads. Normally, multiple threads in the Python interpreter can't get in " -"each other's way, because there is a global lock protecting Python's entire " -"object space. However, it is possible to temporarily release this lock " -"using the macro :c:macro:`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it " -"using :c:macro:`Py_END_ALLOW_THREADS`. This is common around blocking I/O " -"calls, to let other threads use the processor while waiting for the I/O to " -"complete. Obviously, the following function has the same problem as the " -"previous one::" +"each other's way, because there is a :term:`global lock ` protecting Python's entire object space. However, it is possible to " +"temporarily release this lock using the macro :c:macro:" +"`Py_BEGIN_ALLOW_THREADS`, and to re-acquire it using :c:macro:" +"`Py_END_ALLOW_THREADS`. This is common around blocking I/O calls, to let " +"other threads use the processor while waiting for the I/O to complete. " +"Obviously, the following function has the same problem as the previous one::" msgstr "" -#: extending/extending.rst:1085 +#: extending/extending.rst:1132 +msgid "" +"void\n" +"bug(PyObject *list)\n" +"{\n" +" PyObject *item = PyList_GetItem(list, 0);\n" +" Py_BEGIN_ALLOW_THREADS\n" +" ...some blocking I/O call...\n" +" Py_END_ALLOW_THREADS\n" +" PyObject_Print(item, stdout, 0); /* BUG! */\n" +"}" +msgstr "" + +#: extending/extending.rst:1146 msgid "NULL Pointers" msgstr "" -#: extending/extending.rst:1087 +#: extending/extending.rst:1148 msgid "" "In general, functions that take object references as arguments do not expect " "you to pass them ``NULL`` pointers, and will dump core (or cause later core " @@ -1038,21 +1606,21 @@ msgid "" "more slowly." msgstr "" -#: extending/extending.rst:1095 +#: extending/extending.rst:1156 msgid "" "It is better to test for ``NULL`` only at the \"source:\" when a pointer " "that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " "a function that may raise an exception." msgstr "" -#: extending/extending.rst:1099 +#: extending/extending.rst:1160 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " "``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" "func:`Py_XDECREF` do." msgstr "" -#: extending/extending.rst:1103 +#: extending/extending.rst:1164 msgid "" "The macros for checking for a particular object type (``Pytype_Check()``) " "don't check for ``NULL`` pointers --- again, there is much code that calls " @@ -1061,24 +1629,24 @@ msgid "" "variants with ``NULL`` checking." msgstr "" -#: extending/extending.rst:1109 +#: extending/extending.rst:1170 msgid "" "The C function calling mechanism guarantees that the argument list passed to " "C functions (``args`` in the examples) is never ``NULL`` --- in fact it " "guarantees that it is always a tuple [#]_." msgstr "" -#: extending/extending.rst:1113 +#: extending/extending.rst:1174 msgid "" "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " "user." msgstr "" -#: extending/extending.rst:1124 +#: extending/extending.rst:1185 msgid "Writing Extensions in C++" msgstr "" -#: extending/extending.rst:1126 +#: extending/extending.rst:1187 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1091,11 +1659,11 @@ msgid "" "(all recent C++ compilers define this symbol)." msgstr "" -#: extending/extending.rst:1140 +#: extending/extending.rst:1201 msgid "Providing a C API for an Extension Module" msgstr "" -#: extending/extending.rst:1145 +#: extending/extending.rst:1206 msgid "" "Many extension modules just provide new functions and types to be used from " "Python, but sometimes the code in an extension module can be useful for " @@ -1106,7 +1674,7 @@ msgid "" "functions for direct manipulation from other extension modules." msgstr "" -#: extending/extending.rst:1153 +#: extending/extending.rst:1214 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -1122,7 +1690,7 @@ msgid "" "call might not have been loaded yet!" msgstr "" -#: extending/extending.rst:1165 +#: extending/extending.rst:1226 msgid "" "Portability therefore requires not to make any assumptions about symbol " "visibility. This means that all symbols in extension modules should be " @@ -1132,7 +1700,7 @@ msgid "" "accessible from other extension modules must be exported in a different way." msgstr "" -#: extending/extending.rst:1172 +#: extending/extending.rst:1233 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -1144,7 +1712,7 @@ msgid "" "the Capsule." msgstr "" -#: extending/extending.rst:1180 +#: extending/extending.rst:1241 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -1154,7 +1722,7 @@ msgid "" "client modules." msgstr "" -#: extending/extending.rst:1186 +#: extending/extending.rst:1247 msgid "" "Whichever method you choose, it's important to name your Capsules properly. " "The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const " @@ -1164,13 +1732,17 @@ msgid "" "from another." msgstr "" -#: extending/extending.rst:1193 +#: extending/extending.rst:1254 msgid "" "In particular, Capsules used to expose C APIs should be given a name " "following this convention::" msgstr "" -#: extending/extending.rst:1198 +#: extending/extending.rst:1257 +msgid "modulename.attributename" +msgstr "" + +#: extending/extending.rst:1259 msgid "" "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " "C API provided via a Capsule, but only if the Capsule's name matches this " @@ -1178,7 +1750,7 @@ msgid "" "the Capsule they load contains the correct C API." msgstr "" -#: extending/extending.rst:1203 +#: extending/extending.rst:1264 msgid "" "The following example demonstrates an approach that puts most of the burden " "on the writer of the exporting module, which is appropriate for commonly " @@ -1189,7 +1761,7 @@ msgid "" "modules only have to call this macro before accessing the C API." msgstr "" -#: extending/extending.rst:1211 +#: extending/extending.rst:1272 msgid "" "The exporting module is a modification of the :mod:`!spam` module from " "section :ref:`extending-simpleexample`. The function :func:`!spam.system` " @@ -1200,59 +1772,181 @@ msgid "" "modules." msgstr "" -#: extending/extending.rst:1218 +#: extending/extending.rst:1279 msgid "" "The function :c:func:`!PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" -#: extending/extending.rst:1227 +#: extending/extending.rst:1282 +msgid "" +"static int\n" +"PySpam_System(const char *command)\n" +"{\n" +" return system(command);\n" +"}" +msgstr "" + +#: extending/extending.rst:1288 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" msgstr "" -#: extending/extending.rst:1241 +#: extending/extending.rst:1290 +msgid "" +"static PyObject *\n" +"spam_system(PyObject *self, PyObject *args)\n" +"{\n" +" const char *command;\n" +" int sts;\n" +"\n" +" if (!PyArg_ParseTuple(args, \"s\", &command))\n" +" return NULL;\n" +" sts = PySpam_System(command);\n" +" return PyLong_FromLong(sts);\n" +"}" +msgstr "" + +#: extending/extending.rst:1302 msgid "In the beginning of the module, right after the line ::" msgstr "" -#: extending/extending.rst:1245 +#: extending/extending.rst:1304 +msgid "#include " +msgstr "" + +#: extending/extending.rst:1306 msgid "two more lines must be added::" msgstr "" -#: extending/extending.rst:1250 +#: extending/extending.rst:1308 +msgid "" +"#define SPAM_MODULE\n" +"#include \"spammodule.h\"" +msgstr "" + +#: extending/extending.rst:1311 msgid "" "The ``#define`` is used to tell the header file that it is being included in " -"the exporting module, not a client module. Finally, the module's " -"initialization function must take care of initializing the C API pointer " -"array::" +"the exporting module, not a client module. Finally, the module's :c:data:" +"`mod_exec ` function must take care of initializing the C API " +"pointer array::" +msgstr "" + +#: extending/extending.rst:1315 +msgid "" +"static int\n" +"spam_module_exec(PyObject *m)\n" +"{\n" +" static void *PySpam_API[PySpam_API_pointers];\n" +" PyObject *c_api_object;\n" +"\n" +" /* Initialize the C API pointer array */\n" +" PySpam_API[PySpam_System_NUM] = (void *)PySpam_System;\n" +"\n" +" /* Create a Capsule containing the API pointer array's address */\n" +" c_api_object = PyCapsule_New((void *)PySpam_API, \"spam._C_API\", " +"NULL);\n" +"\n" +" if (PyModule_Add(m, \"_C_API\", c_api_object) < 0) {\n" +" return -1;\n" +" }\n" +"\n" +" return 0;\n" +"}" msgstr "" -#: extending/extending.rst:1280 +#: extending/extending.rst:1334 msgid "" "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " "would disappear when :c:func:`!PyInit_spam` terminates!" msgstr "" -#: extending/extending.rst:1283 +#: extending/extending.rst:1337 msgid "" "The bulk of the work is in the header file :file:`spammodule.h`, which looks " "like this::" msgstr "" -#: extending/extending.rst:1334 +#: extending/extending.rst:1340 +msgid "" +"#ifndef Py_SPAMMODULE_H\n" +"#define Py_SPAMMODULE_H\n" +"#ifdef __cplusplus\n" +"extern \"C\" {\n" +"#endif\n" +"\n" +"/* Header file for spammodule */\n" +"\n" +"/* C API functions */\n" +"#define PySpam_System_NUM 0\n" +"#define PySpam_System_RETURN int\n" +"#define PySpam_System_PROTO (const char *command)\n" +"\n" +"/* Total number of C API pointers */\n" +"#define PySpam_API_pointers 1\n" +"\n" +"\n" +"#ifdef SPAM_MODULE\n" +"/* This section is used when compiling spammodule.c */\n" +"\n" +"static PySpam_System_RETURN PySpam_System PySpam_System_PROTO;\n" +"\n" +"#else\n" +"/* This section is used in modules that use spammodule's API */\n" +"\n" +"static void **PySpam_API;\n" +"\n" +"#define PySpam_System \\\n" +" (*(PySpam_System_RETURN (*)PySpam_System_PROTO) " +"PySpam_API[PySpam_System_NUM])\n" +"\n" +"/* Return -1 on error, 0 on success.\n" +" * PyCapsule_Import will set an exception if there's an error.\n" +" */\n" +"static int\n" +"import_spam(void)\n" +"{\n" +" PySpam_API = (void **)PyCapsule_Import(\"spam._C_API\", 0);\n" +" return (PySpam_API != NULL) ? 0 : -1;\n" +"}\n" +"\n" +"#endif\n" +"\n" +"#ifdef __cplusplus\n" +"}\n" +"#endif\n" +"\n" +"#endif /* !defined(Py_SPAMMODULE_H) */" +msgstr "" + +#: extending/extending.rst:1388 msgid "" "All that a client module must do in order to have access to the function :c:" "func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" -"import_spam` in its initialization function::" +"import_spam` in its :c:data:`mod_exec ` function::" +msgstr "" + +#: extending/extending.rst:1392 +msgid "" +"static int\n" +"client_module_exec(PyObject *m)\n" +"{\n" +" if (import_spam() < 0) {\n" +" return -1;\n" +" }\n" +" /* additional initialization can happen here */\n" +" return 0;\n" +"}" msgstr "" -#: extending/extending.rst:1352 +#: extending/extending.rst:1402 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -#: extending/extending.rst:1356 +#: extending/extending.rst:1406 msgid "" "Finally it should be mentioned that Capsules offer additional functionality, " "which is especially useful for memory allocation and deallocation of the " @@ -1262,47 +1956,47 @@ msgid "" "in the Python source code distribution)." msgstr "" -#: extending/extending.rst:1364 +#: extending/extending.rst:1414 msgid "Footnotes" msgstr "" -#: extending/extending.rst:1365 +#: extending/extending.rst:1415 msgid "" "An interface for this function already exists in the standard module :mod:" "`os` --- it was chosen as a simple and straightforward example." msgstr "" -#: extending/extending.rst:1368 +#: extending/extending.rst:1418 msgid "" "The metaphor of \"borrowing\" a reference is not completely correct: the " "owner still has a copy of the reference." msgstr "" -#: extending/extending.rst:1371 +#: extending/extending.rst:1421 msgid "" "Checking that the reference count is at least 1 **does not work** --- the " "reference count itself could be in freed memory and may thus be reused for " "another object!" msgstr "" -#: extending/extending.rst:1375 +#: extending/extending.rst:1425 msgid "" "These guarantees don't hold when you use the \"old\" style calling " "convention --- this is still found in much existing code." msgstr "" -#: extending/extending.rst:539 +#: extending/extending.rst:593 msgid "PyObject_CallObject (C function)" msgstr "" -#: extending/extending.rst:630 +#: extending/extending.rst:684 msgid "PyArg_ParseTuple (C function)" msgstr "" -#: extending/extending.rst:722 +#: extending/extending.rst:776 msgid "PyArg_ParseTupleAndKeywords (C function)" msgstr "" -#: extending/extending.rst:743 +#: extending/extending.rst:797 msgid "Philbrick, Geoff" msgstr "" diff --git a/extending/index.po b/extending/index.po index 0f854298..7490d0bc 100644 --- a/extending/index.po +++ b/extending/index.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-21 21:30+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: extending/index.rst:5 msgid "Extending and Embedding the Python Interpreter" -msgstr "" +msgstr "Επέκταση και Ενσωμάτωση του Διερμηνέα της Python" #: extending/index.rst:7 msgid "" @@ -30,6 +31,15 @@ msgid "" "extension modules so that they can be loaded dynamically (at run time) into " "the interpreter, if the underlying operating system supports this feature." msgstr "" +"Αυτό το έγγραφο περιγράφει πώς να γράφετε modules σε C ή C++ για να " +"επεκτείνετε τον διερμηνέα της Python με νέα modules. Αυτά τα modules δεν " +"μπορούν μόνο να ορίσουν νέες συναρτήσεις αλλά και νέους τύπους αντικειμένων " +"και τις μεθόδους τους. Το έγγραφο επίσης περιγράφει πώς να ενσωματώσετε τον " +"διερμηνέα της Python σε μια άλλη εφαρμογή, ώστε να χρησιμοποιείται ως γλώσσα " +"επέκτασης. Τέλος, δείχνει πώς να μεταγλωττίζετε και να συνδέετε τα modules " +"επέκτασης ώστε να μπορούν να φορτώνονται δυναμικά (κατά την εκτέλεση) στον " +"διερμηνέα, εφόσον το υποκείμενο λειτουργικό σύστημα υποστηρίζει αυτήν τη " +"λειτουργία." #: extending/index.rst:15 msgid "" @@ -39,59 +49,88 @@ msgid "" "documents the existing object types, functions and modules (both built-in " "and written in Python) that give the language its wide application range." msgstr "" +"Αυτό το έγγραφο προϋποθέτει βασικές γνώσεις Python. Για μια ανεπίσημη " +"εισαγωγή στη γλώσσα, δείτε το :ref:`tutorial-index`. Το :ref:`reference-" +"index` παρέχει έναν πιο επίσημο ορισμό της γλώσσας. Το :ref:`library-index` " +"τεκμηριώνει τους υπάρχοντες τύπους αντικειμένων, τις συναρτήσεις και τα " +"modules (ενσωματωμένα και γραμμένα σε Python και τα δύο) που προσφέρουν στη " +"γλώσσα το ευρύ πεδίο εφαρμογών της." #: extending/index.rst:21 msgid "" "For a detailed description of the whole Python/C API, see the separate :ref:" "`c-api-index`." msgstr "" +"Για μια λεπτομερή περιγραφή ολόκληρου του Python/C API, δείτε το ξεχωριστό :" +"ref:`c-api-index`." #: extending/index.rst:26 msgid "Recommended third party tools" -msgstr "" +msgstr "Προτεινόμενα εργαλεία τρίτων" #: extending/index.rst:28 msgid "" "This guide only covers the basic tools for creating extensions provided as " -"part of this version of CPython. Third party tools like `Cython `_, `cffi `_, `SWIG `_ and `Numba `_ offer both simpler and " -"more sophisticated approaches to creating C and C++ extensions for Python." +"part of this version of CPython. Some :ref:`third party tools ` " +"offer both simpler and more sophisticated approaches to creating C and C++ " +"extensions for Python." msgstr "" +"Αυτός ο οδηγός καλύπτει μόνο τα βασικά εργαλεία για τη δημιουργία επεκτάσεων " +"που παρέχονται ως μέρος αυτής της έκδοσης της CPython. Ορισμένα :ref:`third " +"party tools ` προσφέρουν απλούστερες και πιο εξελιγμένες " +"προσεγγίσεις για τη δημιουργία επεκτάσεων C και C++ για Python." -#: extending/index.rst:40 -msgid "" -"`Python Packaging User Guide: Binary Extensions `_" -msgstr "" - -#: extending/index.rst:38 -msgid "" -"The Python Packaging User Guide not only covers several available tools that " -"simplify the creation of binary extensions, but also discusses the various " -"reasons why creating an extension module may be desirable in the first place." -msgstr "" - -#: extending/index.rst:45 +#: extending/index.rst:35 msgid "Creating extensions without third party tools" -msgstr "" +msgstr "Δημιουργία επεκτάσεων χωρίς εργαλεία τρίτων" -#: extending/index.rst:47 +#: extending/index.rst:37 msgid "" "This section of the guide covers creating C and C++ extensions without " "assistance from third party tools. It is intended primarily for creators of " "those tools, rather than being a recommended way to create your own C " "extensions." msgstr "" +"Αυτό το μέρος του οδηγού καλύπτει τη δημιουργία επεκτάσεων σε C και C++ " +"χωρίς τη βοήθεια εργαλείων τρίτων. Απευθύνεται κυρίως σε δημιουργούς αυτών " +"των εργαλείων, παρά ως προτεινόμενη μέθοδος για τη δημιουργία δικών σας " +"επεκτάσεων σε C." + +#: extending/index.rst:44 +msgid ":pep:`489` -- Multi-phase extension module initialization" +msgstr ":pep:`489` -- Αρχικοποίηση πολυφασικής μονάδας επέκταση" -#: extending/index.rst:63 +#: extending/index.rst:57 msgid "Embedding the CPython runtime in a larger application" -msgstr "" +msgstr "Ενσωμάτωση του χρόνου εκτέλεσης της CPython σε μεγαλύτερη εφαρμογή" -#: extending/index.rst:65 +#: extending/index.rst:59 msgid "" "Sometimes, rather than creating an extension that runs inside the Python " "interpreter as the main application, it is desirable to instead embed the " "CPython runtime inside a larger application. This section covers some of the " "details involved in doing that successfully." msgstr "" +"Μερικές φορές, αντί να δημιουργήσουμε μια επέκταση που εκτελείται μέσα στον " +"διερμηνέα της Python ως κύρια εφαρμογή, είναι προτιμότερο να ενσωματώσουμε " +"τον χρόνο εκτέλεσης της CPython σε μια μεγαλύτερη εφαρμογή. Αυτή η ενότητα " +"καλύπτει μερικές λεπτομέρειες για το πώς να το κάνετε αυτό με επιτυχία." + +#~ msgid "" +#~ "`Python Packaging User Guide: Binary Extensions `_" +#~ msgstr "" +#~ "`Οδηγός Χρήστη για Δημιουργία πακέτων Python: Δυαδικές Επεκτάσεις " +#~ "`_" + +#~ msgid "" +#~ "The Python Packaging User Guide not only covers several available tools " +#~ "that simplify the creation of binary extensions, but also discusses the " +#~ "various reasons why creating an extension module may be desirable in the " +#~ "first place." +#~ msgstr "" +#~ "Ο Οδηγός Χρήστη για Δημιουργία πακέτων της Python δεν καλύπτει μόνο " +#~ "διάφορα διαθέσιμα εργαλεία που απλοποιούν τη δημιουργία δυαδικών " +#~ "επεκτάσεων, αλλά επίσης συζητά και τους διάφορους λόγους για τους οποίους " +#~ "μπορεί να είναι επιθυμητή η δημιουργία ενός module επέκτασης σε πρώτη " +#~ "φάση." diff --git a/extending/newtypes.po b/extending/newtypes.po index 4c117ccd..eab0a5bf 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -32,6 +33,105 @@ msgid "" "in :ref:`debug builds ` omitted:" msgstr "" +#: extending/newtypes.rst:17 +msgid "" +"typedef struct _typeobject {\n" +" PyObject_VAR_HEAD\n" +" const char *tp_name; /* For printing, in format \".\" */\n" +" Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */\n" +"\n" +" /* Methods to implement standard operations */\n" +"\n" +" destructor tp_dealloc;\n" +" Py_ssize_t tp_vectorcall_offset;\n" +" getattrfunc tp_getattr;\n" +" setattrfunc tp_setattr;\n" +" PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)\n" +" or tp_reserved (Python 3) */\n" +" reprfunc tp_repr;\n" +"\n" +" /* Method suites for standard classes */\n" +"\n" +" PyNumberMethods *tp_as_number;\n" +" PySequenceMethods *tp_as_sequence;\n" +" PyMappingMethods *tp_as_mapping;\n" +"\n" +" /* More standard operations (here for binary compatibility) */\n" +"\n" +" hashfunc tp_hash;\n" +" ternaryfunc tp_call;\n" +" reprfunc tp_str;\n" +" getattrofunc tp_getattro;\n" +" setattrofunc tp_setattro;\n" +"\n" +" /* Functions to access object as input/output buffer */\n" +" PyBufferProcs *tp_as_buffer;\n" +"\n" +" /* Flags to define presence of optional/expanded features */\n" +" unsigned long tp_flags;\n" +"\n" +" const char *tp_doc; /* Documentation string */\n" +"\n" +" /* Assigned meaning in release 2.0 */\n" +" /* call function for all accessible objects */\n" +" traverseproc tp_traverse;\n" +"\n" +" /* delete references to contained objects */\n" +" inquiry tp_clear;\n" +"\n" +" /* Assigned meaning in release 2.1 */\n" +" /* rich comparisons */\n" +" richcmpfunc tp_richcompare;\n" +"\n" +" /* weak reference enabler */\n" +" Py_ssize_t tp_weaklistoffset;\n" +"\n" +" /* Iterators */\n" +" getiterfunc tp_iter;\n" +" iternextfunc tp_iternext;\n" +"\n" +" /* Attribute descriptor and subclassing stuff */\n" +" PyMethodDef *tp_methods;\n" +" PyMemberDef *tp_members;\n" +" PyGetSetDef *tp_getset;\n" +" // Strong reference on a heap type, borrowed reference on a static type\n" +" PyTypeObject *tp_base;\n" +" PyObject *tp_dict;\n" +" descrgetfunc tp_descr_get;\n" +" descrsetfunc tp_descr_set;\n" +" Py_ssize_t tp_dictoffset;\n" +" initproc tp_init;\n" +" allocfunc tp_alloc;\n" +" newfunc tp_new;\n" +" freefunc tp_free; /* Low-level free-memory routine */\n" +" inquiry tp_is_gc; /* For PyObject_IS_GC */\n" +" PyObject *tp_bases;\n" +" PyObject *tp_mro; /* method resolution order */\n" +" PyObject *tp_cache; /* no longer used */\n" +" void *tp_subclasses; /* for static builtin types this is an index */\n" +" PyObject *tp_weaklist; /* not used for static builtin types */\n" +" destructor tp_del;\n" +"\n" +" /* Type attribute cache version tag. Added in version 2.6.\n" +" * If zero, the cache is invalid and must be initialized.\n" +" */\n" +" unsigned int tp_version_tag;\n" +"\n" +" destructor tp_finalize;\n" +" vectorcallfunc tp_vectorcall;\n" +"\n" +" /* bitset of which type-watchers care about this type */\n" +" unsigned char tp_watched;\n" +"\n" +" /* Number of tp_version_tag values used.\n" +" * Set to _Py_ATTR_CACHE_UNUSED if the attribute cache is\n" +" * disabled for this type (e.g. due to custom MRO entries).\n" +" * Otherwise, limited to MAX_VERSIONS_PER_CLASS (defined elsewhere).\n" +" */\n" +" uint16_t tp_versions_used;\n" +"} PyTypeObject;\n" +msgstr "" + #: extending/newtypes.rst:20 msgid "" "Now that's a *lot* of methods. Don't worry too much though -- if you have a " @@ -49,6 +149,10 @@ msgid "" "new type. ::" msgstr "" +#: extending/newtypes.rst:31 +msgid "const char *tp_name; /* For printing */" +msgstr "" + #: extending/newtypes.rst:33 msgid "" "The name of the type -- as mentioned in the previous chapter, this will " @@ -56,6 +160,10 @@ msgid "" "choose something that will be helpful in such a situation! ::" msgstr "" +#: extending/newtypes.rst:37 +msgid "Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */" +msgstr "" + #: extending/newtypes.rst:39 msgid "" "These fields tell the runtime how much memory to allocate when new objects " @@ -65,6 +173,10 @@ msgid "" "later. ::" msgstr "" +#: extending/newtypes.rst:44 +msgid "const char *tp_doc;" +msgstr "" + #: extending/newtypes.rst:46 msgid "" "Here you can put a string (or its address) that you want returned when the " @@ -81,6 +193,10 @@ msgstr "" msgid "Finalization and De-allocation" msgstr "" +#: extending/newtypes.rst:64 +msgid "destructor tp_dealloc;" +msgstr "" + #: extending/newtypes.rst:66 msgid "" "This function is called when the reference count of the instance of your " @@ -90,13 +206,37 @@ msgid "" "of this function::" msgstr "" -#: extending/newtypes.rst:79 +#: extending/newtypes.rst:72 +msgid "" +"static void\n" +"newdatatype_dealloc(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" free(self->obj_UnderlyingDatatypePtr);\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" +msgstr "" + +#: extending/newtypes.rst:80 msgid "" "If your type supports garbage collection, the destructor should call :c:func:" "`PyObject_GC_UnTrack` before clearing any member fields::" msgstr "" -#: extending/newtypes.rst:95 +#: extending/newtypes.rst:83 +msgid "" +"static void\n" +"newdatatype_dealloc(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" PyObject_GC_UnTrack(op);\n" +" Py_CLEAR(self->other_obj);\n" +" ...\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" +msgstr "" + +#: extending/newtypes.rst:97 msgid "" "One important requirement of the deallocator function is that it leaves any " "pending exceptions alone. This is important since deallocators are " @@ -111,7 +251,38 @@ msgid "" "c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` functions::" msgstr "" -#: extending/newtypes.rst:134 +#: extending/newtypes.rst:109 +msgid "" +"static void\n" +"my_dealloc(PyObject *obj)\n" +"{\n" +" MyObject *self = (MyObject *) obj;\n" +" PyObject *cbresult;\n" +"\n" +" if (self->my_callback != NULL) {\n" +" PyObject *err_type, *err_value, *err_traceback;\n" +"\n" +" /* This saves the current exception state */\n" +" PyErr_Fetch(&err_type, &err_value, &err_traceback);\n" +"\n" +" cbresult = PyObject_CallNoArgs(self->my_callback);\n" +" if (cbresult == NULL) {\n" +" PyErr_WriteUnraisable(self->my_callback);\n" +" }\n" +" else {\n" +" Py_DECREF(cbresult);\n" +" }\n" +"\n" +" /* This restores the saved exception state */\n" +" PyErr_Restore(err_type, err_value, err_traceback);\n" +"\n" +" Py_DECREF(self->my_callback);\n" +" }\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" +msgstr "" + +#: extending/newtypes.rst:138 msgid "" "There are limitations to what you can safely do in a deallocator function. " "First, if your type supports garbage collection (using :c:member:" @@ -124,43 +295,60 @@ msgid "" "tp_dealloc` again, causing a double free and a crash." msgstr "" -#: extending/newtypes.rst:143 +#: extending/newtypes.rst:147 msgid "" "Starting with Python 3.4, it is recommended not to put any complex " "finalization code in :c:member:`~PyTypeObject.tp_dealloc`, and instead use " "the new :c:member:`~PyTypeObject.tp_finalize` type method." msgstr "" -#: extending/newtypes.rst:148 +#: extending/newtypes.rst:152 msgid ":pep:`442` explains the new finalization scheme." msgstr "" -#: extending/newtypes.rst:155 +#: extending/newtypes.rst:159 msgid "Object Presentation" msgstr "" -#: extending/newtypes.rst:157 +#: extending/newtypes.rst:161 msgid "" "In Python, there are two ways to generate a textual representation of an " "object: the :func:`repr` function, and the :func:`str` function. (The :func:" "`print` function just calls :func:`str`.) These handlers are both optional." msgstr "" -#: extending/newtypes.rst:166 +#: extending/newtypes.rst:167 +msgid "" +"reprfunc tp_repr;\n" +"reprfunc tp_str;" +msgstr "" + +#: extending/newtypes.rst:170 msgid "" "The :c:member:`~PyTypeObject.tp_repr` handler should return a string object " "containing a representation of the instance for which it is called. Here is " "a simple example::" msgstr "" -#: extending/newtypes.rst:177 +#: extending/newtypes.rst:174 +msgid "" +"static PyObject *\n" +"newdatatype_repr(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" return PyUnicode_FromFormat(\"Repr-ified_newdatatype{{size:%d}}\",\n" +" self->obj_UnderlyingDatatypePtr->size);\n" +"}" +msgstr "" + +#: extending/newtypes.rst:182 msgid "" "If no :c:member:`~PyTypeObject.tp_repr` handler is specified, the " "interpreter will supply a representation that uses the type's :c:member:" "`~PyTypeObject.tp_name` and a uniquely identifying value for the object." msgstr "" -#: extending/newtypes.rst:181 +#: extending/newtypes.rst:186 msgid "" "The :c:member:`~PyTypeObject.tp_str` handler is to :func:`str` what the :c:" "member:`~PyTypeObject.tp_repr` handler described above is to :func:`repr`; " @@ -171,15 +359,26 @@ msgid "" "the :c:member:`~PyTypeObject.tp_repr` handler is used instead." msgstr "" -#: extending/newtypes.rst:188 +#: extending/newtypes.rst:193 msgid "Here is a simple example::" msgstr "" -#: extending/newtypes.rst:200 +#: extending/newtypes.rst:195 +msgid "" +"static PyObject *\n" +"newdatatype_str(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" return PyUnicode_FromFormat(\"Stringified_newdatatype{{size:%d}}\",\n" +" self->obj_UnderlyingDatatypePtr->size);\n" +"}" +msgstr "" + +#: extending/newtypes.rst:206 msgid "Attribute Management" msgstr "" -#: extending/newtypes.rst:202 +#: extending/newtypes.rst:208 msgid "" "For every object which can support attributes, the corresponding type must " "provide the functions that control how the attributes are resolved. There " @@ -189,7 +388,7 @@ msgid "" "handler is ``NULL``." msgstr "" -#: extending/newtypes.rst:208 +#: extending/newtypes.rst:214 msgid "" "Python supports two pairs of attribute handlers; a type that supports " "attributes only needs to implement the functions for one pair. The " @@ -200,6 +399,15 @@ msgstr "" #: extending/newtypes.rst:220 msgid "" +"getattrfunc tp_getattr; /* char * version */\n" +"setattrfunc tp_setattr;\n" +"/* ... */\n" +"getattrofunc tp_getattro; /* PyObject * version */\n" +"setattrofunc tp_setattro;" +msgstr "" + +#: extending/newtypes.rst:226 +msgid "" "If accessing attributes of an object is always a simple operation (this will " "be explained shortly), there are generic implementations which can be used " "to provide the :c:expr:`PyObject*` version of the attribute management " @@ -209,35 +417,35 @@ msgid "" "mechanism that is available." msgstr "" -#: extending/newtypes.rst:231 +#: extending/newtypes.rst:237 msgid "Generic Attribute Management" msgstr "" -#: extending/newtypes.rst:233 +#: extending/newtypes.rst:239 msgid "" "Most extension types only use *simple* attributes. So, what makes the " "attributes simple? There are only a couple of conditions that must be met:" msgstr "" -#: extending/newtypes.rst:236 +#: extending/newtypes.rst:242 msgid "" "The name of the attributes must be known when :c:func:`PyType_Ready` is " "called." msgstr "" -#: extending/newtypes.rst:239 +#: extending/newtypes.rst:245 msgid "" "No special processing is needed to record that an attribute was looked up or " "set, nor do actions need to be taken based on the value." msgstr "" -#: extending/newtypes.rst:242 +#: extending/newtypes.rst:248 msgid "" "Note that this list does not place any restrictions on the values of the " "attributes, when the values are computed, or how relevant data is stored." msgstr "" -#: extending/newtypes.rst:245 +#: extending/newtypes.rst:251 msgid "" "When :c:func:`PyType_Ready` is called, it uses three tables referenced by " "the type object to create :term:`descriptor`\\s which are placed in the " @@ -249,18 +457,35 @@ msgid "" "``NULL`` as well, allowing the base type to handle attributes." msgstr "" -#: extending/newtypes.rst:253 +#: extending/newtypes.rst:259 msgid "The tables are declared as three fields of the type object::" msgstr "" -#: extending/newtypes.rst:259 +#: extending/newtypes.rst:261 +msgid "" +"struct PyMethodDef *tp_methods;\n" +"struct PyMemberDef *tp_members;\n" +"struct PyGetSetDef *tp_getset;" +msgstr "" + +#: extending/newtypes.rst:265 msgid "" "If :c:member:`~PyTypeObject.tp_methods` is not ``NULL``, it must refer to an " "array of :c:type:`PyMethodDef` structures. Each entry in the table is an " "instance of this structure::" msgstr "" -#: extending/newtypes.rst:270 +#: extending/newtypes.rst:269 +msgid "" +"typedef struct PyMethodDef {\n" +" const char *ml_name; /* method name */\n" +" PyCFunction ml_meth; /* implementation function */\n" +" int ml_flags; /* flags */\n" +" const char *ml_doc; /* docstring */\n" +"} PyMethodDef;" +msgstr "" + +#: extending/newtypes.rst:276 msgid "" "One entry should be defined for each method provided by the type; no entries " "are needed for methods inherited from a base type. One additional entry is " @@ -268,7 +493,7 @@ msgid "" "member:`~PyMethodDef.ml_name` field of the sentinel must be ``NULL``." msgstr "" -#: extending/newtypes.rst:275 +#: extending/newtypes.rst:281 msgid "" "The second table is used to define attributes which map directly to data " "stored in the instance. A variety of primitive C types are supported, and " @@ -276,7 +501,18 @@ msgid "" "defined as::" msgstr "" -#: extending/newtypes.rst:287 +#: extending/newtypes.rst:285 +msgid "" +"typedef struct PyMemberDef {\n" +" const char *name;\n" +" int type;\n" +" int offset;\n" +" int flags;\n" +" const char *doc;\n" +"} PyMemberDef;" +msgstr "" + +#: extending/newtypes.rst:293 msgid "" "For each entry in the table, a :term:`descriptor` will be constructed and " "added to the type which will be able to extract a value from the instance " @@ -288,27 +524,27 @@ msgid "" "prevent Python code from setting it." msgstr "" -#: extending/newtypes.rst:295 +#: extending/newtypes.rst:301 msgid "" "An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` " "table to build descriptors that are used at runtime is that any attribute " "defined this way can have an associated doc string simply by providing the " "text in the table. An application can use the introspection API to retrieve " "the descriptor from the class object, and get the doc string using its :attr:" -"`!__doc__` attribute." +"`~type.__doc__` attribute." msgstr "" -#: extending/newtypes.rst:301 +#: extending/newtypes.rst:307 msgid "" "As with the :c:member:`~PyTypeObject.tp_methods` table, a sentinel entry " "with a :c:member:`~PyMethodDef.ml_name` value of ``NULL`` is required." msgstr "" -#: extending/newtypes.rst:315 +#: extending/newtypes.rst:321 msgid "Type-specific Attribute Management" msgstr "" -#: extending/newtypes.rst:317 +#: extending/newtypes.rst:323 msgid "" "For simplicity, only the :c:expr:`char\\*` version will be demonstrated " "here; the type of the name parameter is the only difference between the :c:" @@ -319,18 +555,35 @@ msgid "" "functionality, you'll understand what needs to be done." msgstr "" -#: extending/newtypes.rst:325 +#: extending/newtypes.rst:331 msgid "" "The :c:member:`~PyTypeObject.tp_getattr` handler is called when the object " "requires an attribute look-up. It is called in the same situations where " "the :meth:`~object.__getattr__` method of a class would be called." msgstr "" -#: extending/newtypes.rst:329 +#: extending/newtypes.rst:335 msgid "Here is an example::" msgstr "" -#: extending/newtypes.rst:345 +#: extending/newtypes.rst:337 +msgid "" +"static PyObject *\n" +"newdatatype_getattr(PyObject *op, char *name)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" if (strcmp(name, \"data\") == 0) {\n" +" return PyLong_FromLong(self->data);\n" +" }\n" +"\n" +" PyErr_Format(PyExc_AttributeError,\n" +" \"'%.100s' object has no attribute '%.400s'\",\n" +" Py_TYPE(self)->tp_name, name);\n" +" return NULL;\n" +"}" +msgstr "" + +#: extending/newtypes.rst:351 msgid "" "The :c:member:`~PyTypeObject.tp_setattr` handler is called when the :meth:" "`~object.__setattr__` or :meth:`~object.__delattr__` method of a class " @@ -340,11 +593,25 @@ msgid "" "tp_setattr` handler should be set to ``NULL``. ::" msgstr "" -#: extending/newtypes.rst:359 -msgid "Object Comparison" +#: extending/newtypes.rst:357 +msgid "" +"static int\n" +"newdatatype_setattr(PyObject *op, char *name, PyObject *v)\n" +"{\n" +" PyErr_Format(PyExc_RuntimeError, \"Read-only attribute: %s\", name);\n" +" return -1;\n" +"}" msgstr "" #: extending/newtypes.rst:365 +msgid "Object Comparison" +msgstr "" + +#: extending/newtypes.rst:369 +msgid "richcmpfunc tp_richcompare;" +msgstr "" + +#: extending/newtypes.rst:371 msgid "" "The :c:member:`~PyTypeObject.tp_richcompare` handler is called when " "comparisons are needed. It is analogous to the :ref:`rich comparison " @@ -352,7 +619,7 @@ msgid "" "`PyObject_RichCompare` and :c:func:`PyObject_RichCompareBool`." msgstr "" -#: extending/newtypes.rst:370 +#: extending/newtypes.rst:376 msgid "" "This function is called with two Python objects and the operator as " "arguments, where the operator is one of ``Py_EQ``, ``Py_NE``, ``Py_LE``, " @@ -363,23 +630,52 @@ msgid "" "should be tried, or ``NULL`` if an exception was set." msgstr "" -#: extending/newtypes.rst:378 +#: extending/newtypes.rst:384 msgid "" "Here is a sample implementation, for a datatype that is considered equal if " "the size of an internal pointer is equal::" msgstr "" -#: extending/newtypes.rst:408 +#: extending/newtypes.rst:387 +msgid "" +"static PyObject *\n" +"newdatatype_richcmp(PyObject *lhs, PyObject *rhs, int op)\n" +"{\n" +" newdatatypeobject *obj1 = (newdatatypeobject *) lhs;\n" +" newdatatypeobject *obj2 = (newdatatypeobject *) rhs;\n" +" PyObject *result;\n" +" int c, size1, size2;\n" +"\n" +" /* code to make sure that both arguments are of type\n" +" newdatatype omitted */\n" +"\n" +" size1 = obj1->obj_UnderlyingDatatypePtr->size;\n" +" size2 = obj2->obj_UnderlyingDatatypePtr->size;\n" +"\n" +" switch (op) {\n" +" case Py_LT: c = size1 < size2; break;\n" +" case Py_LE: c = size1 <= size2; break;\n" +" case Py_EQ: c = size1 == size2; break;\n" +" case Py_NE: c = size1 != size2; break;\n" +" case Py_GT: c = size1 > size2; break;\n" +" case Py_GE: c = size1 >= size2; break;\n" +" }\n" +" result = c ? Py_True : Py_False;\n" +" return Py_NewRef(result);\n" +" }" +msgstr "" + +#: extending/newtypes.rst:415 msgid "Abstract Protocol Support" msgstr "" -#: extending/newtypes.rst:410 +#: extending/newtypes.rst:417 msgid "" "Python supports a variety of *abstract* 'protocols;' the specific interfaces " "provided to use these interfaces are documented in :ref:`abstract`." msgstr "" -#: extending/newtypes.rst:414 +#: extending/newtypes.rst:421 msgid "" "A number of these abstract interfaces were defined early in the development " "of the Python implementation. In particular, the number, mapping, and " @@ -394,7 +690,14 @@ msgid "" "slot, but a slot may still be unfilled.) ::" msgstr "" -#: extending/newtypes.rst:429 +#: extending/newtypes.rst:432 +msgid "" +"PyNumberMethods *tp_as_number;\n" +"PySequenceMethods *tp_as_sequence;\n" +"PyMappingMethods *tp_as_mapping;" +msgstr "" + +#: extending/newtypes.rst:436 msgid "" "If you wish your object to be able to act like a number, a sequence, or a " "mapping object, then you place the address of a structure that implements " @@ -405,21 +708,44 @@ msgid "" "distribution. ::" msgstr "" -#: extending/newtypes.rst:438 +#: extending/newtypes.rst:443 +msgid "hashfunc tp_hash;" +msgstr "" + +#: extending/newtypes.rst:445 msgid "" "This function, if you choose to provide it, should return a hash number for " "an instance of your data type. Here is a simple example::" msgstr "" -#: extending/newtypes.rst:451 +#: extending/newtypes.rst:448 msgid "" -":c:type:`!Py_hash_t` is a signed integer type with a platform-varying width. " +"static Py_hash_t\n" +"newdatatype_hash(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" Py_hash_t result;\n" +" result = self->some_size + 32767 * self->some_number;\n" +" if (result == -1) {\n" +" result = -2;\n" +" }\n" +" return result;\n" +"}" +msgstr "" + +#: extending/newtypes.rst:460 +msgid "" +":c:type:`Py_hash_t` is a signed integer type with a platform-varying width. " "Returning ``-1`` from :c:member:`~PyTypeObject.tp_hash` indicates an error, " "which is why you should be careful to avoid returning it when hash " "computation is successful, as seen above." msgstr "" -#: extending/newtypes.rst:460 +#: extending/newtypes.rst:467 +msgid "ternaryfunc tp_call;" +msgstr "" + +#: extending/newtypes.rst:469 msgid "" "This function is called when an instance of your data type is \"called\", " "for example, if ``obj1`` is an instance of your data type and the Python " @@ -427,23 +753,23 @@ msgid "" "handler is invoked." msgstr "" -#: extending/newtypes.rst:464 +#: extending/newtypes.rst:473 msgid "This function takes three arguments:" msgstr "" -#: extending/newtypes.rst:466 +#: extending/newtypes.rst:475 msgid "" "*self* is the instance of the data type which is the subject of the call. If " "the call is ``obj1('hello')``, then *self* is ``obj1``." msgstr "" -#: extending/newtypes.rst:469 +#: extending/newtypes.rst:478 msgid "" "*args* is a tuple containing the arguments to the call. You can use :c:func:" "`PyArg_ParseTuple` to extract the arguments." msgstr "" -#: extending/newtypes.rst:472 +#: extending/newtypes.rst:481 msgid "" "*kwds* is a dictionary of keyword arguments that were passed. If this is non-" "``NULL`` and you support keyword arguments, use :c:func:" @@ -452,11 +778,40 @@ msgid "" "`TypeError` with a message saying that keyword arguments are not supported." msgstr "" -#: extending/newtypes.rst:478 +#: extending/newtypes.rst:487 msgid "Here is a toy ``tp_call`` implementation::" msgstr "" -#: extending/newtypes.rst:504 +#: extending/newtypes.rst:489 +msgid "" +"static PyObject *\n" +"newdatatype_call(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" PyObject *result;\n" +" const char *arg1;\n" +" const char *arg2;\n" +" const char *arg3;\n" +"\n" +" if (!PyArg_ParseTuple(args, \"sss:call\", &arg1, &arg2, &arg3)) {\n" +" return NULL;\n" +" }\n" +" result = PyUnicode_FromFormat(\n" +" \"Returning -- value: [%d] arg1: [%s] arg2: [%s] arg3: [%s]\\n\",\n" +" self->obj_UnderlyingDatatypePtr->size,\n" +" arg1, arg2, arg3);\n" +" return result;\n" +"}" +msgstr "" + +#: extending/newtypes.rst:510 +msgid "" +"/* Iterators */\n" +"getiterfunc tp_iter;\n" +"iternextfunc tp_iternext;" +msgstr "" + +#: extending/newtypes.rst:514 msgid "" "These functions provide support for the iterator protocol. Both handlers " "take exactly one parameter, the instance for which they are being called, " @@ -467,21 +822,21 @@ msgid "" "__next__` method." msgstr "" -#: extending/newtypes.rst:511 +#: extending/newtypes.rst:521 msgid "" "Any :term:`iterable` object must implement the :c:member:`~PyTypeObject." "tp_iter` handler, which must return an :term:`iterator` object. Here the " "same guidelines apply as for Python classes:" msgstr "" -#: extending/newtypes.rst:515 +#: extending/newtypes.rst:525 msgid "" "For collections (such as lists and tuples) which can support multiple " "independent iterators, a new iterator should be created and returned by each " "call to :c:member:`~PyTypeObject.tp_iter`." msgstr "" -#: extending/newtypes.rst:518 +#: extending/newtypes.rst:528 msgid "" "Objects which can only be iterated over once (usually due to side effects of " "iteration, such as file objects) can implement :c:member:`~PyTypeObject." @@ -489,7 +844,7 @@ msgid "" "therefore implement the :c:member:`~PyTypeObject.tp_iternext` handler." msgstr "" -#: extending/newtypes.rst:523 +#: extending/newtypes.rst:533 msgid "" "Any :term:`iterator` object should implement both :c:member:`~PyTypeObject." "tp_iter` and :c:member:`~PyTypeObject.tp_iternext`. An iterator's :c:member:" @@ -504,45 +859,66 @@ msgid "" "``NULL``." msgstr "" -#: extending/newtypes.rst:539 +#: extending/newtypes.rst:549 msgid "Weak Reference Support" msgstr "" -#: extending/newtypes.rst:541 +#: extending/newtypes.rst:551 msgid "" "One of the goals of Python's weak reference implementation is to allow any " "type to participate in the weak reference mechanism without incurring the " "overhead on performance-critical objects (such as numbers)." msgstr "" -#: extending/newtypes.rst:546 +#: extending/newtypes.rst:556 msgid "Documentation for the :mod:`weakref` module." msgstr "" -#: extending/newtypes.rst:548 +#: extending/newtypes.rst:558 msgid "" -"For an object to be weakly referencable, the extension type must set the " +"For an object to be weakly referenceable, the extension type must set the " "``Py_TPFLAGS_MANAGED_WEAKREF`` bit of the :c:member:`~PyTypeObject.tp_flags` " "field. The legacy :c:member:`~PyTypeObject.tp_weaklistoffset` field should " "be left as zero." msgstr "" -#: extending/newtypes.rst:553 +#: extending/newtypes.rst:563 msgid "" "Concretely, here is how the statically declared type object would look::" msgstr "" -#: extending/newtypes.rst:562 +#: extending/newtypes.rst:565 +msgid "" +"static PyTypeObject TrivialType = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" /* ... other members omitted for brevity ... */\n" +" .tp_flags = Py_TPFLAGS_MANAGED_WEAKREF | ...,\n" +"};" +msgstr "" + +#: extending/newtypes.rst:572 msgid "" "The only further addition is that ``tp_dealloc`` needs to clear any weak " "references (by calling :c:func:`PyObject_ClearWeakRefs`)::" msgstr "" -#: extending/newtypes.rst:576 +#: extending/newtypes.rst:575 +msgid "" +"static void\n" +"Trivial_dealloc(PyObject *op)\n" +"{\n" +" /* Clear weakrefs first before calling any destructors */\n" +" PyObject_ClearWeakRefs(op);\n" +" /* ... remainder of destruction code omitted for brevity ... */\n" +" Py_TYPE(op)->tp_free(op);\n" +"}" +msgstr "" + +#: extending/newtypes.rst:586 msgid "More Suggestions" msgstr "" -#: extending/newtypes.rst:578 +#: extending/newtypes.rst:588 msgid "" "In order to learn how to implement any specific method for your new data " "type, get the :term:`CPython` source code. Go to the :file:`Objects` " @@ -551,27 +927,35 @@ msgid "" "function you want to implement." msgstr "" -#: extending/newtypes.rst:584 +#: extending/newtypes.rst:594 msgid "" "When you need to verify that an object is a concrete instance of the type " "you are implementing, use the :c:func:`PyObject_TypeCheck` function. A " "sample of its use might be something like the following::" msgstr "" -#: extending/newtypes.rst:595 +#: extending/newtypes.rst:598 +msgid "" +"if (!PyObject_TypeCheck(some_object, &MyType)) {\n" +" PyErr_SetString(PyExc_TypeError, \"arg #1 not a mything\");\n" +" return NULL;\n" +"}" +msgstr "" + +#: extending/newtypes.rst:604 msgid "Download CPython source releases." msgstr "" -#: extending/newtypes.rst:595 +#: extending/newtypes.rst:605 msgid "https://www.python.org/downloads/source/" msgstr "" -#: extending/newtypes.rst:597 +#: extending/newtypes.rst:607 msgid "" "The CPython project on GitHub, where the CPython source code is developed." msgstr "" -#: extending/newtypes.rst:598 +#: extending/newtypes.rst:608 msgid "https://github.com/python/cpython" msgstr "" @@ -595,26 +979,26 @@ msgstr "" msgid "finalization, of objects" msgstr "" -#: extending/newtypes.rst:91 +#: extending/newtypes.rst:93 msgid "PyErr_Fetch (C function)" msgstr "" -#: extending/newtypes.rst:91 +#: extending/newtypes.rst:93 msgid "PyErr_Restore (C function)" msgstr "" -#: extending/newtypes.rst:150 +#: extending/newtypes.rst:154 msgid "string" msgstr "" -#: extending/newtypes.rst:150 +#: extending/newtypes.rst:154 msgid "object representation" msgstr "" -#: extending/newtypes.rst:150 +#: extending/newtypes.rst:154 msgid "built-in function" msgstr "" -#: extending/newtypes.rst:150 +#: extending/newtypes.rst:154 msgid "repr" msgstr "" diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 9e7bb7b3..77ea4202 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -66,6 +67,64 @@ msgid "" "`PyType_FromSpec` function, which isn't covered in this tutorial." msgstr "" +#: extending/newtypes_tutorial.rst:48 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"typedef struct {\n" +" PyObject_HEAD\n" +" /* Type-specific fields go here. */\n" +"} CustomObject;\n" +"\n" +"static PyTypeObject CustomType = {\n" +" .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"custom.Custom\",\n" +" .tp_doc = PyDoc_STR(\"Custom objects\"),\n" +" .tp_basicsize = sizeof(CustomObject),\n" +" .tp_itemsize = 0,\n" +" .tp_flags = Py_TPFLAGS_DEFAULT,\n" +" .tp_new = PyType_GenericNew,\n" +"};\n" +"\n" +"static int\n" +"custom_module_exec(PyObject *m)\n" +"{\n" +" if (PyType_Ready(&CustomType) < 0) {\n" +" return -1;\n" +" }\n" +"\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" +" return -1;\n" +" }\n" +"\n" +" return 0;\n" +"}\n" +"\n" +"static PyModuleDef_Slot custom_module_slots[] = {\n" +" {Py_mod_exec, custom_module_exec},\n" +" // Just use this while using static types\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {0, NULL}\n" +"};\n" +"\n" +"static PyModuleDef custom_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"custom\",\n" +" .m_doc = \"Example module that creates an extension type.\",\n" +" .m_size = 0,\n" +" .m_slots = custom_module_slots,\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_custom(void)\n" +"{\n" +" return PyModuleDef_Init(&custom_module);\n" +"}\n" +msgstr "" + #: extending/newtypes_tutorial.rst:50 msgid "" "Now that's quite a bit to take in at once, but hopefully bits will seem " @@ -87,15 +146,24 @@ msgstr "" #: extending/newtypes_tutorial.rst:58 msgid "" -"How to initialize the :mod:`!custom` module: this is the ``PyInit_custom`` " -"function and the associated ``custommodule`` struct." +"How to define and execute the :mod:`!custom` module: this is the " +"``PyInit_custom`` function and the associated ``custom_module`` struct for " +"defining the module, and the ``custom_module_exec`` function to set up a " +"fresh module object." msgstr "" -#: extending/newtypes_tutorial.rst:61 +#: extending/newtypes_tutorial.rst:63 msgid "The first bit is::" msgstr "" -#: extending/newtypes_tutorial.rst:67 +#: extending/newtypes_tutorial.rst:65 +msgid "" +"typedef struct {\n" +" PyObject_HEAD\n" +"} CustomObject;" +msgstr "" + +#: extending/newtypes_tutorial.rst:69 msgid "" "This is what a Custom object will contain. ``PyObject_HEAD`` is mandatory " "at the start of each object struct and defines a field called ``ob_base`` of " @@ -106,31 +174,52 @@ msgid "" "builds `." msgstr "" -#: extending/newtypes_tutorial.rst:76 +#: extending/newtypes_tutorial.rst:78 msgid "" "There is no semicolon above after the :c:macro:`PyObject_HEAD` macro. Be " "wary of adding one by accident: some compilers will complain." msgstr "" -#: extending/newtypes_tutorial.rst:79 +#: extending/newtypes_tutorial.rst:81 msgid "" "Of course, objects generally store additional data besides the standard " "``PyObject_HEAD`` boilerplate; for example, here is the definition for " "standard Python floats::" msgstr "" -#: extending/newtypes_tutorial.rst:88 +#: extending/newtypes_tutorial.rst:85 +msgid "" +"typedef struct {\n" +" PyObject_HEAD\n" +" double ob_fval;\n" +"} PyFloatObject;" +msgstr "" + +#: extending/newtypes_tutorial.rst:90 msgid "The second bit is the definition of the type object. ::" msgstr "" -#: extending/newtypes_tutorial.rst:101 +#: extending/newtypes_tutorial.rst:92 +msgid "" +"static PyTypeObject CustomType = {\n" +" .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"custom.Custom\",\n" +" .tp_doc = PyDoc_STR(\"Custom objects\"),\n" +" .tp_basicsize = sizeof(CustomObject),\n" +" .tp_itemsize = 0,\n" +" .tp_flags = Py_TPFLAGS_DEFAULT,\n" +" .tp_new = PyType_GenericNew,\n" +"};" +msgstr "" + +#: extending/newtypes_tutorial.rst:103 msgid "" "We recommend using C99-style designated initializers as above, to avoid " "listing all the :c:type:`PyTypeObject` fields that you don't care about and " "also to avoid caring about the fields' declaration order." msgstr "" -#: extending/newtypes_tutorial.rst:105 +#: extending/newtypes_tutorial.rst:107 msgid "" "The actual definition of :c:type:`PyTypeObject` in :file:`object.h` has many " "more :ref:`fields ` than the definition above. The remaining " @@ -138,23 +227,39 @@ msgid "" "to not specify them explicitly unless you need them." msgstr "" -#: extending/newtypes_tutorial.rst:110 +#: extending/newtypes_tutorial.rst:112 msgid "We're going to pick it apart, one field at a time::" msgstr "" #: extending/newtypes_tutorial.rst:114 +msgid ".ob_base = PyVarObject_HEAD_INIT(NULL, 0)" +msgstr "" + +#: extending/newtypes_tutorial.rst:116 msgid "" "This line is mandatory boilerplate to initialize the ``ob_base`` field " "mentioned above. ::" msgstr "" #: extending/newtypes_tutorial.rst:119 +msgid ".tp_name = \"custom.Custom\"," +msgstr "" + +#: extending/newtypes_tutorial.rst:121 msgid "" "The name of our type. This will appear in the default textual " "representation of our objects and in some error messages, for example:" msgstr "" -#: extending/newtypes_tutorial.rst:129 +#: extending/newtypes_tutorial.rst:124 +msgid "" +">>> \"\" + custom.Custom()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: can only concatenate str (not \"custom.Custom\") to str" +msgstr "" + +#: extending/newtypes_tutorial.rst:131 msgid "" "Note that the name is a dotted name that includes both the module name and " "the name of the type within the module. The module in this case is :mod:`!" @@ -163,20 +268,26 @@ msgid "" "your type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::" msgstr "" -#: extending/newtypes_tutorial.rst:138 +#: extending/newtypes_tutorial.rst:137 +msgid "" +".tp_basicsize = sizeof(CustomObject),\n" +".tp_itemsize = 0," +msgstr "" + +#: extending/newtypes_tutorial.rst:140 msgid "" "This is so that Python knows how much memory to allocate when creating new :" "class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only " "used for variable-sized objects and should otherwise be zero." msgstr "" -#: extending/newtypes_tutorial.rst:144 +#: extending/newtypes_tutorial.rst:146 msgid "" "If you want your type to be subclassable from Python, and your type has the " "same :c:member:`~PyTypeObject.tp_basicsize` as its base type, you may have " "problems with multiple inheritance. A Python subclass of your type will " -"have to list your type first in its :attr:`~class.__bases__`, or else it " -"will not be able to call your type's :meth:`~object.__new__` method without " +"have to list your type first in its :attr:`~type.__bases__`, or else it will " +"not be able to call your type's :meth:`~object.__new__` method without " "getting an error. You can avoid this problem by ensuring that your type has " "a larger value for :c:member:`~PyTypeObject.tp_basicsize` than its base type " "does. Most of the time, this will be true anyway, because either your base " @@ -184,23 +295,31 @@ msgid "" "your base type, and therefore increasing its size." msgstr "" -#: extending/newtypes_tutorial.rst:154 +#: extending/newtypes_tutorial.rst:156 msgid "We set the class flags to :c:macro:`Py_TPFLAGS_DEFAULT`. ::" msgstr "" #: extending/newtypes_tutorial.rst:158 +msgid ".tp_flags = Py_TPFLAGS_DEFAULT," +msgstr "" + +#: extending/newtypes_tutorial.rst:160 msgid "" "All types should include this constant in their flags. It enables all of " "the members defined until at least Python 3.3. If you need further members, " "you will need to OR the corresponding flags." msgstr "" -#: extending/newtypes_tutorial.rst:162 +#: extending/newtypes_tutorial.rst:164 msgid "" "We provide a doc string for the type in :c:member:`~PyTypeObject.tp_doc`. ::" msgstr "" #: extending/newtypes_tutorial.rst:166 +msgid ".tp_doc = PyDoc_STR(\"Custom objects\")," +msgstr "" + +#: extending/newtypes_tutorial.rst:168 msgid "" "To enable object creation, we have to provide a :c:member:`~PyTypeObject." "tp_new` handler. This is the equivalent of the Python method :meth:`~object." @@ -210,38 +329,83 @@ msgid "" msgstr "" #: extending/newtypes_tutorial.rst:173 +msgid ".tp_new = PyType_GenericNew," +msgstr "" + +#: extending/newtypes_tutorial.rst:175 msgid "" "Everything else in the file should be familiar, except for some code in :c:" -"func:`!PyInit_custom`::" +"func:`!custom_module_exec`::" msgstr "" -#: extending/newtypes_tutorial.rst:179 +#: extending/newtypes_tutorial.rst:178 +msgid "" +"if (PyType_Ready(&CustomType) < 0) {\n" +" return -1;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:182 msgid "" "This initializes the :class:`!Custom` type, filling in a number of members " "to the appropriate default values, including :c:member:`~PyObject.ob_type` " "that we initially set to ``NULL``. ::" msgstr "" +#: extending/newtypes_tutorial.rst:186 +msgid "" +"if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" +" return -1;\n" +"}" +msgstr "" + #: extending/newtypes_tutorial.rst:190 msgid "" "This adds the type to the module dictionary. This allows us to create :" "class:`!Custom` instances by calling the :class:`!Custom` class:" msgstr "" +#: extending/newtypes_tutorial.rst:193 +msgid "" +">>> import custom\n" +">>> mycustom = custom.Custom()" +msgstr "" + #: extending/newtypes_tutorial.rst:198 msgid "" "That's it! All that remains is to build it; put the above code in a file " "called :file:`custom.c`," msgstr "" +#: extending/newtypes_tutorial.rst:201 +msgid "" +"[build-system]\n" +"requires = [\"setuptools\"]\n" +"build-backend = \"setuptools.build_meta\"\n" +"\n" +"[project]\n" +"name = \"custom\"\n" +"version = \"1\"\n" +msgstr "" + #: extending/newtypes_tutorial.rst:203 msgid "in a file called :file:`pyproject.toml`, and" msgstr "" +#: extending/newtypes_tutorial.rst:205 +msgid "" +"from setuptools import Extension, setup\n" +"setup(ext_modules=[Extension(\"custom\", [\"custom.c\"])])" +msgstr "" + #: extending/newtypes_tutorial.rst:210 msgid "in a file called :file:`setup.py`; then typing" msgstr "" +#: extending/newtypes_tutorial.rst:212 extending/newtypes_tutorial.rst:550 +msgid "$ python -m pip install ." +msgstr "" + #: extending/newtypes_tutorial.rst:216 msgid "" "in a shell should produce a file :file:`custom.so` in a subdirectory and " @@ -270,6 +434,153 @@ msgid "" "custom2` that adds these capabilities:" msgstr "" +#: extending/newtypes_tutorial.rst:233 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"#include /* for offsetof() */\n" +"\n" +"typedef struct {\n" +" PyObject_HEAD\n" +" PyObject *first; /* first name */\n" +" PyObject *last; /* last name */\n" +" int number;\n" +"} CustomObject;\n" +"\n" +"static void\n" +"Custom_dealloc(PyObject *op)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_XDECREF(self->first);\n" +" Py_XDECREF(self->last);\n" +" Py_TYPE(self)->tp_free(self);\n" +"}\n" +"\n" +"static PyObject *\n" +"Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self;\n" +" self = (CustomObject *) type->tp_alloc(type, 0);\n" +" if (self != NULL) {\n" +" self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" +" if (self->first == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" +" if (self->last == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->number = 0;\n" +" }\n" +" return (PyObject *) self;\n" +"}\n" +"\n" +"static int\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" +" PyObject *first = NULL, *last = NULL;\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|OOi\", kwlist,\n" +" &first, &last,\n" +" &self->number))\n" +" return -1;\n" +"\n" +" if (first) {\n" +" Py_XSETREF(self->first, Py_NewRef(first));\n" +" }\n" +" if (last) {\n" +" Py_XSETREF(self->last, Py_NewRef(last));\n" +" }\n" +" return 0;\n" +"}\n" +"\n" +"static PyMemberDef Custom_members[] = {\n" +" {\"first\", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,\n" +" \"first name\"},\n" +" {\"last\", Py_T_OBJECT_EX, offsetof(CustomObject, last), 0,\n" +" \"last name\"},\n" +" {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" +" \"custom number\"},\n" +" {NULL} /* Sentinel */\n" +"};\n" +"\n" +"static PyObject *\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" if (self->first == NULL) {\n" +" PyErr_SetString(PyExc_AttributeError, \"first\");\n" +" return NULL;\n" +" }\n" +" if (self->last == NULL) {\n" +" PyErr_SetString(PyExc_AttributeError, \"last\");\n" +" return NULL;\n" +" }\n" +" return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" +"}\n" +"\n" +"static PyMethodDef Custom_methods[] = {\n" +" {\"name\", Custom_name, METH_NOARGS,\n" +" \"Return the name, combining the first and last name\"\n" +" },\n" +" {NULL} /* Sentinel */\n" +"};\n" +"\n" +"static PyTypeObject CustomType = {\n" +" .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"custom2.Custom\",\n" +" .tp_doc = PyDoc_STR(\"Custom objects\"),\n" +" .tp_basicsize = sizeof(CustomObject),\n" +" .tp_itemsize = 0,\n" +" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,\n" +" .tp_new = Custom_new,\n" +" .tp_init = Custom_init,\n" +" .tp_dealloc = Custom_dealloc,\n" +" .tp_members = Custom_members,\n" +" .tp_methods = Custom_methods,\n" +"};\n" +"\n" +"static int\n" +"custom_module_exec(PyObject *m)\n" +"{\n" +" if (PyType_Ready(&CustomType) < 0) {\n" +" return -1;\n" +" }\n" +"\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" +" return -1;\n" +" }\n" +"\n" +" return 0;\n" +"}\n" +"\n" +"static PyModuleDef_Slot custom_module_slots[] = {\n" +" {Py_mod_exec, custom_module_exec},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {0, NULL}\n" +"};\n" +"\n" +"static PyModuleDef custom_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"custom2\",\n" +" .m_doc = \"Example module that creates an extension type.\",\n" +" .m_size = 0,\n" +" .m_slots = custom_module_slots,\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_custom2(void)\n" +"{\n" +" return PyModuleDef_Init(&custom_module);\n" +"}\n" +msgstr "" + #: extending/newtypes_tutorial.rst:236 msgid "This version of the module has a number of changes." msgstr "" @@ -286,17 +597,43 @@ msgstr "" msgid "The object structure is updated accordingly::" msgstr "" +#: extending/newtypes_tutorial.rst:244 +msgid "" +"typedef struct {\n" +" PyObject_HEAD\n" +" PyObject *first; /* first name */\n" +" PyObject *last; /* last name */\n" +" int number;\n" +"} CustomObject;" +msgstr "" + #: extending/newtypes_tutorial.rst:251 msgid "" "Because we now have data to manage, we have to be more careful about object " "allocation and deallocation. At a minimum, we need a deallocation method::" msgstr "" -#: extending/newtypes_tutorial.rst:262 +#: extending/newtypes_tutorial.rst:254 +msgid "" +"static void\n" +"Custom_dealloc(PyObject *op)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_XDECREF(self->first);\n" +" Py_XDECREF(self->last);\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:263 msgid "which is assigned to the :c:member:`~PyTypeObject.tp_dealloc` member::" msgstr "" -#: extending/newtypes_tutorial.rst:266 +#: extending/newtypes_tutorial.rst:265 +msgid ".tp_dealloc = Custom_dealloc," +msgstr "" + +#: extending/newtypes_tutorial.rst:267 msgid "" "This method first clears the reference counts of the two Python attributes. :" "c:func:`Py_XDECREF` correctly handles the case where its argument is " @@ -307,26 +644,80 @@ msgid "" "an instance of a subclass." msgstr "" -#: extending/newtypes_tutorial.rst:275 +#: extending/newtypes_tutorial.rst:277 +msgid "" +"The explicit cast to ``CustomObject *`` above is needed because we defined " +"``Custom_dealloc`` to take a ``PyObject *`` argument, as the ``tp_dealloc`` " +"function pointer expects to receive a ``PyObject *`` argument. By assigning " +"to the ``tp_dealloc`` slot of a type, we declare that it can only be called " +"with instances of our ``CustomObject`` class, so the cast to ``(CustomObject " +"*)`` is safe. This is object-oriented polymorphism, in C!" +msgstr "" + +#: extending/newtypes_tutorial.rst:285 msgid "" -"The explicit cast to ``destructor`` above is needed because we defined " -"``Custom_dealloc`` to take a ``CustomObject *`` argument, but the " -"``tp_dealloc`` function pointer expects to receive a ``PyObject *`` " -"argument. Otherwise, the compiler will emit a warning. This is object-" -"oriented polymorphism, in C!" +"In existing code, or in previous versions of this tutorial, you might see " +"similar functions take a pointer to the subtype object structure " +"(``CustomObject*``) directly, like this::" msgstr "" -#: extending/newtypes_tutorial.rst:281 +#: extending/newtypes_tutorial.rst:289 +msgid "" +"Custom_dealloc(CustomObject *self)\n" +"{\n" +" Py_XDECREF(self->first);\n" +" Py_XDECREF(self->last);\n" +" Py_TYPE(self)->tp_free((PyObject *) self);\n" +"}\n" +"...\n" +".tp_dealloc = (destructor) Custom_dealloc," +msgstr "" + +#: extending/newtypes_tutorial.rst:298 +msgid "" +"This does the same thing on all architectures that CPython supports, but " +"according to the C standard, it invokes undefined behavior." +msgstr "" + +#: extending/newtypes_tutorial.rst:302 msgid "" "We want to make sure that the first and last names are initialized to empty " "strings, so we provide a ``tp_new`` implementation::" msgstr "" #: extending/newtypes_tutorial.rst:305 +msgid "" +"static PyObject *\n" +"Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self;\n" +" self = (CustomObject *) type->tp_alloc(type, 0);\n" +" if (self != NULL) {\n" +" self->first = PyUnicode_FromString(\"\");\n" +" if (self->first == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->last = PyUnicode_FromString(\"\");\n" +" if (self->last == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->number = 0;\n" +" }\n" +" return (PyObject *) self;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:326 msgid "and install it in the :c:member:`~PyTypeObject.tp_new` member::" msgstr "" -#: extending/newtypes_tutorial.rst:309 +#: extending/newtypes_tutorial.rst:328 +msgid ".tp_new = Custom_new," +msgstr "" + +#: extending/newtypes_tutorial.rst:330 msgid "" "The ``tp_new`` handler is responsible for creating (as opposed to " "initializing) objects of the type. It is exposed in Python as the :meth:" @@ -337,7 +728,7 @@ msgid "" "``first`` and ``last`` attributes to non-``NULL`` default values." msgstr "" -#: extending/newtypes_tutorial.rst:317 +#: extending/newtypes_tutorial.rst:338 msgid "" "``tp_new`` is passed the type being instantiated (not necessarily " "``CustomType``, if a subclass is instantiated) and any arguments passed when " @@ -347,25 +738,29 @@ msgid "" "k.a. ``tp_init`` in C or ``__init__`` in Python) methods." msgstr "" -#: extending/newtypes_tutorial.rst:325 +#: extending/newtypes_tutorial.rst:346 msgid "" "``tp_new`` shouldn't call ``tp_init`` explicitly, as the interpreter will do " "it itself." msgstr "" -#: extending/newtypes_tutorial.rst:328 +#: extending/newtypes_tutorial.rst:349 msgid "" "The ``tp_new`` implementation calls the :c:member:`~PyTypeObject.tp_alloc` " "slot to allocate memory::" msgstr "" -#: extending/newtypes_tutorial.rst:333 +#: extending/newtypes_tutorial.rst:352 +msgid "self = (CustomObject *) type->tp_alloc(type, 0);" +msgstr "" + +#: extending/newtypes_tutorial.rst:354 msgid "" "Since memory allocation may fail, we must check the :c:member:`~PyTypeObject." "tp_alloc` result against ``NULL`` before proceeding." msgstr "" -#: extending/newtypes_tutorial.rst:337 +#: extending/newtypes_tutorial.rst:358 msgid "" "We didn't fill the :c:member:`~PyTypeObject.tp_alloc` slot ourselves. " "Rather :c:func:`PyType_Ready` fills it for us by inheriting it from our base " @@ -373,7 +768,7 @@ msgid "" "allocation strategy." msgstr "" -#: extending/newtypes_tutorial.rst:343 +#: extending/newtypes_tutorial.rst:364 msgid "" "If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one " "that calls a base type's :c:member:`~PyTypeObject.tp_new` or :meth:`~object." @@ -386,17 +781,51 @@ msgid "" "subclasses without getting a :exc:`TypeError`.)" msgstr "" -#: extending/newtypes_tutorial.rst:353 +#: extending/newtypes_tutorial.rst:374 msgid "" "We also define an initialization function which accepts arguments to provide " "initial values for our instance::" msgstr "" -#: extending/newtypes_tutorial.rst:382 +#: extending/newtypes_tutorial.rst:377 +msgid "" +"static int\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" +" PyObject *first = NULL, *last = NULL, *tmp;\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|OOi\", kwlist,\n" +" &first, &last,\n" +" &self->number))\n" +" return -1;\n" +"\n" +" if (first) {\n" +" tmp = self->first;\n" +" Py_INCREF(first);\n" +" self->first = first;\n" +" Py_XDECREF(tmp);\n" +" }\n" +" if (last) {\n" +" tmp = self->last;\n" +" Py_INCREF(last);\n" +" self->last = last;\n" +" Py_XDECREF(tmp);\n" +" }\n" +" return 0;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:404 msgid "by filling the :c:member:`~PyTypeObject.tp_init` slot. ::" msgstr "" -#: extending/newtypes_tutorial.rst:386 +#: extending/newtypes_tutorial.rst:406 +msgid ".tp_init = Custom_init," +msgstr "" + +#: extending/newtypes_tutorial.rst:408 msgid "" "The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as the :meth:" "`~object.__init__` method. It is used to initialize an object after it's " @@ -404,7 +833,7 @@ msgid "" "they should return either ``0`` on success or ``-1`` on error." msgstr "" -#: extending/newtypes_tutorial.rst:391 +#: extending/newtypes_tutorial.rst:413 msgid "" "Unlike the ``tp_new`` handler, there is no guarantee that ``tp_init`` is " "called at all (for example, the :mod:`pickle` module by default doesn't " @@ -415,59 +844,86 @@ msgid "" "``first`` member like this::" msgstr "" -#: extending/newtypes_tutorial.rst:405 +#: extending/newtypes_tutorial.rst:421 +msgid "" +"if (first) {\n" +" Py_XDECREF(self->first);\n" +" Py_INCREF(first);\n" +" self->first = first;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:427 msgid "" "But this would be risky. Our type doesn't restrict the type of the " "``first`` member, so it could be any kind of object. It could have a " "destructor that causes code to be executed that tries to access the " -"``first`` member; or that destructor could release the :term:`Global " -"interpreter Lock ` and let arbitrary code run in other threads that " +"``first`` member; or that destructor could detach the :term:`thread state " +"` and let arbitrary code run in other threads that " "accesses and modifies our object." msgstr "" -#: extending/newtypes_tutorial.rst:412 +#: extending/newtypes_tutorial.rst:434 msgid "" "To be paranoid and protect ourselves against this possibility, we almost " "always reassign members before decrementing their reference counts. When " "don't we have to do this?" msgstr "" -#: extending/newtypes_tutorial.rst:416 +#: extending/newtypes_tutorial.rst:438 msgid "when we absolutely know that the reference count is greater than 1;" msgstr "" -#: extending/newtypes_tutorial.rst:418 +#: extending/newtypes_tutorial.rst:440 msgid "" -"when we know that deallocation of the object [#]_ will neither release the :" -"term:`GIL` nor cause any calls back into our type's code;" +"when we know that deallocation of the object [#]_ will neither detach the :" +"term:`thread state ` nor cause any calls back into " +"our type's code;" msgstr "" -#: extending/newtypes_tutorial.rst:421 +#: extending/newtypes_tutorial.rst:443 msgid "" "when decrementing a reference count in a :c:member:`~PyTypeObject." "tp_dealloc` handler on a type which doesn't support cyclic garbage " "collection [#]_." msgstr "" -#: extending/newtypes_tutorial.rst:424 +#: extending/newtypes_tutorial.rst:446 msgid "" "We want to expose our instance variables as attributes. There are a number " "of ways to do that. The simplest way is to define member definitions::" msgstr "" -#: extending/newtypes_tutorial.rst:437 +#: extending/newtypes_tutorial.rst:449 +msgid "" +"static PyMemberDef Custom_members[] = {\n" +" {\"first\", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,\n" +" \"first name\"},\n" +" {\"last\", Py_T_OBJECT_EX, offsetof(CustomObject, last), 0,\n" +" \"last name\"},\n" +" {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" +" \"custom number\"},\n" +" {NULL} /* Sentinel */\n" +"};" +msgstr "" + +#: extending/newtypes_tutorial.rst:459 msgid "" "and put the definitions in the :c:member:`~PyTypeObject.tp_members` slot::" msgstr "" -#: extending/newtypes_tutorial.rst:441 +#: extending/newtypes_tutorial.rst:461 +msgid ".tp_members = Custom_members," +msgstr "" + +#: extending/newtypes_tutorial.rst:463 msgid "" "Each member definition has a member name, type, offset, access flags and " "documentation string. See the :ref:`Generic-Attribute-Management` section " "below for details." msgstr "" -#: extending/newtypes_tutorial.rst:445 +#: extending/newtypes_tutorial.rst:467 msgid "" "A disadvantage of this approach is that it doesn't provide a way to restrict " "the types of objects that can be assigned to the Python attributes. We " @@ -478,13 +934,31 @@ msgid "" "deleted." msgstr "" -#: extending/newtypes_tutorial.rst:452 +#: extending/newtypes_tutorial.rst:474 msgid "" -"We define a single method, :meth:`!Custom.name()`, that outputs the objects " +"We define a single method, :meth:`!Custom.name`, that outputs the objects " "name as the concatenation of the first and last names. ::" msgstr "" -#: extending/newtypes_tutorial.rst:469 +#: extending/newtypes_tutorial.rst:477 +msgid "" +"static PyObject *\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" if (self->first == NULL) {\n" +" PyErr_SetString(PyExc_AttributeError, \"first\");\n" +" return NULL;\n" +" }\n" +" if (self->last == NULL) {\n" +" PyErr_SetString(PyExc_AttributeError, \"last\");\n" +" return NULL;\n" +" }\n" +" return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:492 msgid "" "The method is implemented as a C function that takes a :class:`!Custom` (or :" "class:`!Custom` subclass) instance as the first argument. Methods always " @@ -494,7 +968,13 @@ msgid "" "method is equivalent to the Python method:" msgstr "" -#: extending/newtypes_tutorial.rst:481 +#: extending/newtypes_tutorial.rst:499 +msgid "" +"def name(self):\n" +" return \"%s %s\" % (self.first, self.last)" +msgstr "" + +#: extending/newtypes_tutorial.rst:504 msgid "" "Note that we have to check for the possibility that our :attr:`!first` and :" "attr:`!last` members are ``NULL``. This is because they can be deleted, in " @@ -503,23 +983,37 @@ msgid "" "We'll see how to do that in the next section." msgstr "" -#: extending/newtypes_tutorial.rst:487 +#: extending/newtypes_tutorial.rst:510 msgid "" "Now that we've defined the method, we need to create an array of method " "definitions::" msgstr "" -#: extending/newtypes_tutorial.rst:497 +#: extending/newtypes_tutorial.rst:513 +msgid "" +"static PyMethodDef Custom_methods[] = {\n" +" {\"name\", Custom_name, METH_NOARGS,\n" +" \"Return the name, combining the first and last name\"\n" +" },\n" +" {NULL} /* Sentinel */\n" +"};" +msgstr "" + +#: extending/newtypes_tutorial.rst:520 msgid "" "(note that we used the :c:macro:`METH_NOARGS` flag to indicate that the " "method is expecting no arguments other than *self*)" msgstr "" -#: extending/newtypes_tutorial.rst:500 +#: extending/newtypes_tutorial.rst:523 msgid "and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::" msgstr "" -#: extending/newtypes_tutorial.rst:504 +#: extending/newtypes_tutorial.rst:525 +msgid ".tp_methods = Custom_methods," +msgstr "" + +#: extending/newtypes_tutorial.rst:527 msgid "" "Finally, we'll make our type usable as a base class for subclassing. We've " "written our methods carefully so far so that they don't make any assumptions " @@ -527,26 +1021,39 @@ msgid "" "to add the :c:macro:`Py_TPFLAGS_BASETYPE` to our class flag definition::" msgstr "" -#: extending/newtypes_tutorial.rst:511 +#: extending/newtypes_tutorial.rst:532 +msgid ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," +msgstr "" + +#: extending/newtypes_tutorial.rst:534 msgid "" "We rename :c:func:`!PyInit_custom` to :c:func:`!PyInit_custom2`, update the " "module name in the :c:type:`PyModuleDef` struct, and update the full class " "name in the :c:type:`PyTypeObject` struct." msgstr "" -#: extending/newtypes_tutorial.rst:515 +#: extending/newtypes_tutorial.rst:538 msgid "Finally, we update our :file:`setup.py` file to include the new module," msgstr "" -#: extending/newtypes_tutorial.rst:525 +#: extending/newtypes_tutorial.rst:540 +msgid "" +"from setuptools import Extension, setup\n" +"setup(ext_modules=[\n" +" Extension(\"custom\", [\"custom.c\"]),\n" +" Extension(\"custom2\", [\"custom2.c\"]),\n" +"])" +msgstr "" + +#: extending/newtypes_tutorial.rst:548 msgid "and then we re-install so that we can ``import custom2``:" msgstr "" -#: extending/newtypes_tutorial.rst:532 +#: extending/newtypes_tutorial.rst:555 msgid "Providing finer control over data attributes" msgstr "" -#: extending/newtypes_tutorial.rst:534 +#: extending/newtypes_tutorial.rst:557 msgid "" "In this section, we'll provide finer control over how the :attr:`!first` " "and :attr:`!last` attributes are set in the :class:`!Custom` example. In the " @@ -555,14 +1062,241 @@ msgid "" "make sure that these attributes always contain strings." msgstr "" -#: extending/newtypes_tutorial.rst:543 +#: extending/newtypes_tutorial.rst:563 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"#include /* for offsetof() */\n" +"\n" +"typedef struct {\n" +" PyObject_HEAD\n" +" PyObject *first; /* first name */\n" +" PyObject *last; /* last name */\n" +" int number;\n" +"} CustomObject;\n" +"\n" +"static void\n" +"Custom_dealloc(PyObject *op)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_XDECREF(self->first);\n" +" Py_XDECREF(self->last);\n" +" Py_TYPE(self)->tp_free(self);\n" +"}\n" +"\n" +"static PyObject *\n" +"Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self;\n" +" self = (CustomObject *) type->tp_alloc(type, 0);\n" +" if (self != NULL) {\n" +" self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" +" if (self->first == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" +" if (self->last == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->number = 0;\n" +" }\n" +" return (PyObject *) self;\n" +"}\n" +"\n" +"static int\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" +" PyObject *first = NULL, *last = NULL;\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|UUi\", kwlist,\n" +" &first, &last,\n" +" &self->number))\n" +" return -1;\n" +"\n" +" if (first) {\n" +" Py_SETREF(self->first, Py_NewRef(first));\n" +" }\n" +" if (last) {\n" +" Py_SETREF(self->last, Py_NewRef(last));\n" +" }\n" +" return 0;\n" +"}\n" +"\n" +"static PyMemberDef Custom_members[] = {\n" +" {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" +" \"custom number\"},\n" +" {NULL} /* Sentinel */\n" +"};\n" +"\n" +"static PyObject *\n" +"Custom_getfirst(PyObject *op, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" return Py_NewRef(self->first);\n" +"}\n" +"\n" +"static int\n" +"Custom_setfirst(PyObject *op, PyObject *value, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" if (value == NULL) {\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " +"attribute\");\n" +" return -1;\n" +" }\n" +" if (!PyUnicode_Check(value)) {\n" +" PyErr_SetString(PyExc_TypeError,\n" +" \"The first attribute value must be a string\");\n" +" return -1;\n" +" }\n" +" Py_SETREF(self->first, Py_NewRef(value));\n" +" return 0;\n" +"}\n" +"\n" +"static PyObject *\n" +"Custom_getlast(PyObject *op, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" return Py_NewRef(self->last);\n" +"}\n" +"\n" +"static int\n" +"Custom_setlast(PyObject *op, PyObject *value, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" if (value == NULL) {\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the last " +"attribute\");\n" +" return -1;\n" +" }\n" +" if (!PyUnicode_Check(value)) {\n" +" PyErr_SetString(PyExc_TypeError,\n" +" \"The last attribute value must be a string\");\n" +" return -1;\n" +" }\n" +" Py_SETREF(self->last, Py_NewRef(value));\n" +" return 0;\n" +"}\n" +"\n" +"static PyGetSetDef Custom_getsetters[] = {\n" +" {\"first\", Custom_getfirst, Custom_setfirst,\n" +" \"first name\", NULL},\n" +" {\"last\", Custom_getlast, Custom_setlast,\n" +" \"last name\", NULL},\n" +" {NULL} /* Sentinel */\n" +"};\n" +"\n" +"static PyObject *\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" +"}\n" +"\n" +"static PyMethodDef Custom_methods[] = {\n" +" {\"name\", Custom_name, METH_NOARGS,\n" +" \"Return the name, combining the first and last name\"\n" +" },\n" +" {NULL} /* Sentinel */\n" +"};\n" +"\n" +"static PyTypeObject CustomType = {\n" +" .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"custom3.Custom\",\n" +" .tp_doc = PyDoc_STR(\"Custom objects\"),\n" +" .tp_basicsize = sizeof(CustomObject),\n" +" .tp_itemsize = 0,\n" +" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,\n" +" .tp_new = Custom_new,\n" +" .tp_init = Custom_init,\n" +" .tp_dealloc = Custom_dealloc,\n" +" .tp_members = Custom_members,\n" +" .tp_methods = Custom_methods,\n" +" .tp_getset = Custom_getsetters,\n" +"};\n" +"\n" +"static int\n" +"custom_module_exec(PyObject *m)\n" +"{\n" +" if (PyType_Ready(&CustomType) < 0) {\n" +" return -1;\n" +" }\n" +"\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" +" return -1;\n" +" }\n" +"\n" +" return 0;\n" +"}\n" +"\n" +"static PyModuleDef_Slot custom_module_slots[] = {\n" +" {Py_mod_exec, custom_module_exec},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {0, NULL}\n" +"};\n" +"\n" +"static PyModuleDef custom_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"custom3\",\n" +" .m_doc = \"Example module that creates an extension type.\",\n" +" .m_size = 0,\n" +" .m_slots = custom_module_slots,\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_custom3(void)\n" +"{\n" +" return PyModuleDef_Init(&custom_module);\n" +"}\n" +msgstr "" + +#: extending/newtypes_tutorial.rst:566 msgid "" "To provide greater control, over the :attr:`!first` and :attr:`!last` " "attributes, we'll use custom getter and setter functions. Here are the " "functions for getting and setting the :attr:`!first` attribute::" msgstr "" -#: extending/newtypes_tutorial.rst:574 +#: extending/newtypes_tutorial.rst:570 +msgid "" +"static PyObject *\n" +"Custom_getfirst(PyObject *op, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_INCREF(self->first);\n" +" return self->first;\n" +"}\n" +"\n" +"static int\n" +"Custom_setfirst(PyObject *op, PyObject *value, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" PyObject *tmp;\n" +" if (value == NULL) {\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " +"attribute\");\n" +" return -1;\n" +" }\n" +" if (!PyUnicode_Check(value)) {\n" +" PyErr_SetString(PyExc_TypeError,\n" +" \"The first attribute value must be a string\");\n" +" return -1;\n" +" }\n" +" tmp = self->first;\n" +" Py_INCREF(value);\n" +" self->first = value;\n" +" Py_DECREF(tmp);\n" +" return 0;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:599 msgid "" "The getter function is passed a :class:`!Custom` object and a \"closure\", " "which is a void pointer. In this case, the closure is ignored. (The " @@ -572,7 +1306,7 @@ msgid "" "data in the closure.)" msgstr "" -#: extending/newtypes_tutorial.rst:580 +#: extending/newtypes_tutorial.rst:605 msgid "" "The setter function is passed the :class:`!Custom` object, the new value, " "and the closure. The new value may be ``NULL``, in which case the attribute " @@ -580,32 +1314,86 @@ msgid "" "deleted or if its new value is not a string." msgstr "" -#: extending/newtypes_tutorial.rst:585 +#: extending/newtypes_tutorial.rst:610 msgid "We create an array of :c:type:`PyGetSetDef` structures::" msgstr "" -#: extending/newtypes_tutorial.rst:595 +#: extending/newtypes_tutorial.rst:612 +msgid "" +"static PyGetSetDef Custom_getsetters[] = {\n" +" {\"first\", Custom_getfirst, Custom_setfirst,\n" +" \"first name\", NULL},\n" +" {\"last\", Custom_getlast, Custom_setlast,\n" +" \"last name\", NULL},\n" +" {NULL} /* Sentinel */\n" +"};" +msgstr "" + +#: extending/newtypes_tutorial.rst:620 msgid "and register it in the :c:member:`~PyTypeObject.tp_getset` slot::" msgstr "" -#: extending/newtypes_tutorial.rst:599 +#: extending/newtypes_tutorial.rst:622 +msgid ".tp_getset = Custom_getsetters," +msgstr "" + +#: extending/newtypes_tutorial.rst:624 msgid "" "The last item in a :c:type:`PyGetSetDef` structure is the \"closure\" " "mentioned above. In this case, we aren't using a closure, so we just pass " "``NULL``." msgstr "" -#: extending/newtypes_tutorial.rst:602 +#: extending/newtypes_tutorial.rst:627 msgid "We also remove the member definitions for these attributes::" msgstr "" -#: extending/newtypes_tutorial.rst:610 +#: extending/newtypes_tutorial.rst:629 +msgid "" +"static PyMemberDef Custom_members[] = {\n" +" {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" +" \"custom number\"},\n" +" {NULL} /* Sentinel */\n" +"};" +msgstr "" + +#: extending/newtypes_tutorial.rst:635 msgid "" "We also need to update the :c:member:`~PyTypeObject.tp_init` handler to only " "allow strings [#]_ to be passed::" msgstr "" -#: extending/newtypes_tutorial.rst:639 +#: extending/newtypes_tutorial.rst:638 +msgid "" +"static int\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" +" PyObject *first = NULL, *last = NULL, *tmp;\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|UUi\", kwlist,\n" +" &first, &last,\n" +" &self->number))\n" +" return -1;\n" +"\n" +" if (first) {\n" +" tmp = self->first;\n" +" Py_INCREF(first);\n" +" self->first = first;\n" +" Py_DECREF(tmp);\n" +" }\n" +" if (last) {\n" +" tmp = self->last;\n" +" Py_INCREF(last);\n" +" self->last = last;\n" +" Py_DECREF(tmp);\n" +" }\n" +" return 0;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:665 msgid "" "With these changes, we can assure that the ``first`` and ``last`` members " "are never ``NULL`` so we can remove checks for ``NULL`` values in almost all " @@ -615,25 +1403,32 @@ msgid "" "possibility that the initialization of these members failed in ``tp_new``." msgstr "" -#: extending/newtypes_tutorial.rst:646 +#: extending/newtypes_tutorial.rst:672 msgid "" "We also rename the module initialization function and module name in the " "initialization function, as we did before, and we add an extra definition to " "the :file:`setup.py` file." msgstr "" -#: extending/newtypes_tutorial.rst:652 +#: extending/newtypes_tutorial.rst:678 msgid "Supporting cyclic garbage collection" msgstr "" -#: extending/newtypes_tutorial.rst:654 +#: extending/newtypes_tutorial.rst:680 msgid "" "Python has a :term:`cyclic garbage collector (GC) ` that " "can identify unneeded objects even when their reference counts are not zero. " "This can happen when objects are involved in cycles. For example, consider:" msgstr "" -#: extending/newtypes_tutorial.rst:664 +#: extending/newtypes_tutorial.rst:684 +msgid "" +">>> l = []\n" +">>> l.append(l)\n" +">>> del l" +msgstr "" + +#: extending/newtypes_tutorial.rst:690 msgid "" "In this example, we create a list that contains itself. When we delete it, " "it still has a reference from itself. Its reference count doesn't drop to " @@ -641,7 +1436,7 @@ msgid "" "out that the list is garbage and free it." msgstr "" -#: extending/newtypes_tutorial.rst:669 +#: extending/newtypes_tutorial.rst:695 msgid "" "In the second version of the :class:`!Custom` example, we allowed any kind " "of object to be stored in the :attr:`!first` or :attr:`!last` attributes " @@ -650,7 +1445,16 @@ msgid "" "those two reasons, :class:`!Custom` objects can participate in cycles:" msgstr "" -#: extending/newtypes_tutorial.rst:683 +#: extending/newtypes_tutorial.rst:701 +msgid "" +">>> import custom3\n" +">>> class Derived(custom3.Custom): pass\n" +"...\n" +">>> n = Derived()\n" +">>> n.some_attribute = n" +msgstr "" + +#: extending/newtypes_tutorial.rst:709 msgid "" "To allow a :class:`!Custom` instance participating in a reference cycle to " "be properly detected and collected by the cyclic GC, our :class:`!Custom` " @@ -658,13 +1462,248 @@ msgid "" "these slots:" msgstr "" -#: extending/newtypes_tutorial.rst:690 +#: extending/newtypes_tutorial.rst:713 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"#include /* for offsetof() */\n" +"\n" +"typedef struct {\n" +" PyObject_HEAD\n" +" PyObject *first; /* first name */\n" +" PyObject *last; /* last name */\n" +" int number;\n" +"} CustomObject;\n" +"\n" +"static int\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_VISIT(self->first);\n" +" Py_VISIT(self->last);\n" +" return 0;\n" +"}\n" +"\n" +"static int\n" +"Custom_clear(PyObject *op)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_CLEAR(self->first);\n" +" Py_CLEAR(self->last);\n" +" return 0;\n" +"}\n" +"\n" +"static void\n" +"Custom_dealloc(PyObject *op)\n" +"{\n" +" PyObject_GC_UnTrack(op);\n" +" (void)Custom_clear(op);\n" +" Py_TYPE(op)->tp_free(op);\n" +"}\n" +"\n" +"static PyObject *\n" +"Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self;\n" +" self = (CustomObject *) type->tp_alloc(type, 0);\n" +" if (self != NULL) {\n" +" self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" +" if (self->first == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR);\n" +" if (self->last == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->number = 0;\n" +" }\n" +" return (PyObject *) self;\n" +"}\n" +"\n" +"static int\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" +" PyObject *first = NULL, *last = NULL;\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|UUi\", kwlist,\n" +" &first, &last,\n" +" &self->number))\n" +" return -1;\n" +"\n" +" if (first) {\n" +" Py_SETREF(self->first, Py_NewRef(first));\n" +" }\n" +" if (last) {\n" +" Py_SETREF(self->last, Py_NewRef(last));\n" +" }\n" +" return 0;\n" +"}\n" +"\n" +"static PyMemberDef Custom_members[] = {\n" +" {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" +" \"custom number\"},\n" +" {NULL} /* Sentinel */\n" +"};\n" +"\n" +"static PyObject *\n" +"Custom_getfirst(PyObject *op, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" return Py_NewRef(self->first);\n" +"}\n" +"\n" +"static int\n" +"Custom_setfirst(PyObject *op, PyObject *value, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" if (value == NULL) {\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " +"attribute\");\n" +" return -1;\n" +" }\n" +" if (!PyUnicode_Check(value)) {\n" +" PyErr_SetString(PyExc_TypeError,\n" +" \"The first attribute value must be a string\");\n" +" return -1;\n" +" }\n" +" Py_XSETREF(self->first, Py_NewRef(value));\n" +" return 0;\n" +"}\n" +"\n" +"static PyObject *\n" +"Custom_getlast(PyObject *op, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" return Py_NewRef(self->last);\n" +"}\n" +"\n" +"static int\n" +"Custom_setlast(PyObject *op, PyObject *value, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" if (value == NULL) {\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the last " +"attribute\");\n" +" return -1;\n" +" }\n" +" if (!PyUnicode_Check(value)) {\n" +" PyErr_SetString(PyExc_TypeError,\n" +" \"The last attribute value must be a string\");\n" +" return -1;\n" +" }\n" +" Py_XSETREF(self->last, Py_NewRef(value));\n" +" return 0;\n" +"}\n" +"\n" +"static PyGetSetDef Custom_getsetters[] = {\n" +" {\"first\", Custom_getfirst, Custom_setfirst,\n" +" \"first name\", NULL},\n" +" {\"last\", Custom_getlast, Custom_setlast,\n" +" \"last name\", NULL},\n" +" {NULL} /* Sentinel */\n" +"};\n" +"\n" +"static PyObject *\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" +"}\n" +"\n" +"static PyMethodDef Custom_methods[] = {\n" +" {\"name\", Custom_name, METH_NOARGS,\n" +" \"Return the name, combining the first and last name\"\n" +" },\n" +" {NULL} /* Sentinel */\n" +"};\n" +"\n" +"static PyTypeObject CustomType = {\n" +" .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"custom4.Custom\",\n" +" .tp_doc = PyDoc_STR(\"Custom objects\"),\n" +" .tp_basicsize = sizeof(CustomObject),\n" +" .tp_itemsize = 0,\n" +" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | " +"Py_TPFLAGS_HAVE_GC,\n" +" .tp_new = Custom_new,\n" +" .tp_init = Custom_init,\n" +" .tp_dealloc = Custom_dealloc,\n" +" .tp_traverse = Custom_traverse,\n" +" .tp_clear = Custom_clear,\n" +" .tp_members = Custom_members,\n" +" .tp_methods = Custom_methods,\n" +" .tp_getset = Custom_getsetters,\n" +"};\n" +"\n" +"static int\n" +"custom_module_exec(PyObject *m)\n" +"{\n" +" if (PyType_Ready(&CustomType) < 0) {\n" +" return -1;\n" +" }\n" +"\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" +" return -1;\n" +" }\n" +"\n" +" return 0;\n" +"}\n" +"\n" +"static PyModuleDef_Slot custom_module_slots[] = {\n" +" {Py_mod_exec, custom_module_exec},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {0, NULL}\n" +"};\n" +"\n" +"static PyModuleDef custom_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"custom4\",\n" +" .m_doc = \"Example module that creates an extension type.\",\n" +" .m_size = 0,\n" +" .m_slots = custom_module_slots,\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_custom4(void)\n" +"{\n" +" return PyModuleDef_Init(&custom_module);\n" +"}\n" +msgstr "" + +#: extending/newtypes_tutorial.rst:716 msgid "" "First, the traversal method lets the cyclic GC know about subobjects that " "could participate in cycles::" msgstr "" -#: extending/newtypes_tutorial.rst:710 +#: extending/newtypes_tutorial.rst:719 +msgid "" +"static int\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" int vret;\n" +" if (self->first) {\n" +" vret = visit(self->first, arg);\n" +" if (vret != 0)\n" +" return vret;\n" +" }\n" +" if (self->last) {\n" +" vret = visit(self->last, arg);\n" +" if (vret != 0)\n" +" return vret;\n" +" }\n" +" return 0;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:737 msgid "" "For each subobject that can participate in cycles, we need to call the :c:" "func:`!visit` function, which is passed to the traversal method. The :c:func:" @@ -673,26 +1712,50 @@ msgid "" "be returned if it is non-zero." msgstr "" -#: extending/newtypes_tutorial.rst:716 +#: extending/newtypes_tutorial.rst:743 msgid "" "Python provides a :c:func:`Py_VISIT` macro that automates calling visit " "functions. With :c:func:`Py_VISIT`, we can minimize the amount of " "boilerplate in ``Custom_traverse``::" msgstr "" -#: extending/newtypes_tutorial.rst:729 +#: extending/newtypes_tutorial.rst:747 +msgid "" +"static int\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_VISIT(self->first);\n" +" Py_VISIT(self->last);\n" +" return 0;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:757 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` implementation must name its " "arguments exactly *visit* and *arg* in order to use :c:func:`Py_VISIT`." msgstr "" -#: extending/newtypes_tutorial.rst:732 +#: extending/newtypes_tutorial.rst:760 msgid "" "Second, we need to provide a method for clearing any subobjects that can " "participate in cycles::" msgstr "" -#: extending/newtypes_tutorial.rst:743 +#: extending/newtypes_tutorial.rst:763 +msgid "" +"static int\n" +"Custom_clear(PyObject *op)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_CLEAR(self->first);\n" +" Py_CLEAR(self->last);\n" +" return 0;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:772 msgid "" "Notice the use of the :c:func:`Py_CLEAR` macro. It is the recommended and " "safe way to clear data attributes of arbitrary types while decrementing " @@ -702,18 +1765,26 @@ msgid "" "again (*especially* if there is a reference cycle)." msgstr "" -#: extending/newtypes_tutorial.rst:751 +#: extending/newtypes_tutorial.rst:780 msgid "You could emulate :c:func:`Py_CLEAR` by writing::" msgstr "" -#: extending/newtypes_tutorial.rst:758 +#: extending/newtypes_tutorial.rst:782 +msgid "" +"PyObject *tmp;\n" +"tmp = self->first;\n" +"self->first = NULL;\n" +"Py_XDECREF(tmp);" +msgstr "" + +#: extending/newtypes_tutorial.rst:787 msgid "" "Nevertheless, it is much easier and less error-prone to always use :c:func:" "`Py_CLEAR` when deleting an attribute. Don't try to micro-optimize at the " "expense of robustness!" msgstr "" -#: extending/newtypes_tutorial.rst:762 +#: extending/newtypes_tutorial.rst:791 msgid "" "The deallocator ``Custom_dealloc`` may call arbitrary code when clearing " "attributes. It means the circular GC can be triggered inside the function. " @@ -723,12 +1794,28 @@ msgid "" "`PyObject_GC_UnTrack` and ``Custom_clear``::" msgstr "" -#: extending/newtypes_tutorial.rst:777 +#: extending/newtypes_tutorial.rst:798 +msgid "" +"static void\n" +"Custom_dealloc(PyObject *op)\n" +"{\n" +" PyObject_GC_UnTrack(op);\n" +" (void)Custom_clear(op);\n" +" Py_TYPE(op)->tp_free(op);\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:806 msgid "" "Finally, we add the :c:macro:`Py_TPFLAGS_HAVE_GC` flag to the class flags::" msgstr "" -#: extending/newtypes_tutorial.rst:781 +#: extending/newtypes_tutorial.rst:808 +msgid "" +".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," +msgstr "" + +#: extending/newtypes_tutorial.rst:810 msgid "" "That's pretty much it. If we had written custom :c:member:`~PyTypeObject." "tp_alloc` or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify " @@ -736,11 +1823,11 @@ msgid "" "automatically provided." msgstr "" -#: extending/newtypes_tutorial.rst:787 +#: extending/newtypes_tutorial.rst:816 msgid "Subclassing other types" msgstr "" -#: extending/newtypes_tutorial.rst:789 +#: extending/newtypes_tutorial.rst:818 msgid "" "It is possible to create new extension types that are derived from existing " "types. It is easiest to inherit from the built in types, since an extension " @@ -748,7 +1835,7 @@ msgid "" "share these :c:type:`PyTypeObject` structures between extension modules." msgstr "" -#: extending/newtypes_tutorial.rst:794 +#: extending/newtypes_tutorial.rst:823 msgid "" "In this example we will create a :class:`!SubList` type that inherits from " "the built-in :class:`list` type. The new type will be completely compatible " @@ -756,34 +1843,151 @@ msgid "" "that increases an internal counter:" msgstr "" -#: extending/newtypes_tutorial.rst:814 +#: extending/newtypes_tutorial.rst:828 +msgid "" +">>> import sublist\n" +">>> s = sublist.SubList(range(3))\n" +">>> s.extend(s)\n" +">>> print(len(s))\n" +"6\n" +">>> print(s.increment())\n" +"1\n" +">>> print(s.increment())\n" +"2" +msgstr "" + +#: extending/newtypes_tutorial.rst:840 +msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"typedef struct {\n" +" PyListObject list;\n" +" int state;\n" +"} SubListObject;\n" +"\n" +"static PyObject *\n" +"SubList_increment(PyObject *op, PyObject *Py_UNUSED(dummy))\n" +"{\n" +" SubListObject *self = (SubListObject *) op;\n" +" self->state++;\n" +" return PyLong_FromLong(self->state);\n" +"}\n" +"\n" +"static PyMethodDef SubList_methods[] = {\n" +" {\"increment\", SubList_increment, METH_NOARGS,\n" +" PyDoc_STR(\"increment state counter\")},\n" +" {NULL},\n" +"};\n" +"\n" +"static int\n" +"SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" SubListObject *self = (SubListObject *) op;\n" +" if (PyList_Type.tp_init(op, args, kwds) < 0)\n" +" return -1;\n" +" self->state = 0;\n" +" return 0;\n" +"}\n" +"\n" +"static PyTypeObject SubListType = {\n" +" .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"sublist.SubList\",\n" +" .tp_doc = PyDoc_STR(\"SubList objects\"),\n" +" .tp_basicsize = sizeof(SubListObject),\n" +" .tp_itemsize = 0,\n" +" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,\n" +" .tp_init = SubList_init,\n" +" .tp_methods = SubList_methods,\n" +"};\n" +"\n" +"static int\n" +"sublist_module_exec(PyObject *m)\n" +"{\n" +" SubListType.tp_base = &PyList_Type;\n" +" if (PyType_Ready(&SubListType) < 0) {\n" +" return -1;\n" +" }\n" +"\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" +" return -1;\n" +" }\n" +"\n" +" return 0;\n" +"}\n" +"\n" +"static PyModuleDef_Slot sublist_module_slots[] = {\n" +" {Py_mod_exec, sublist_module_exec},\n" +" {Py_mod_multiple_interpreters, " +"Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},\n" +" {0, NULL}\n" +"};\n" +"\n" +"static PyModuleDef sublist_module = {\n" +" .m_base = PyModuleDef_HEAD_INIT,\n" +" .m_name = \"sublist\",\n" +" .m_doc = \"Example module that creates an extension type.\",\n" +" .m_size = 0,\n" +" .m_slots = sublist_module_slots,\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_sublist(void)\n" +"{\n" +" return PyModuleDef_Init(&sublist_module);\n" +"}\n" +msgstr "" + +#: extending/newtypes_tutorial.rst:843 msgid "" "As you can see, the source code closely resembles the :class:`!Custom` " "examples in previous sections. We will break down the main differences " "between them. ::" msgstr "" -#: extending/newtypes_tutorial.rst:822 +#: extending/newtypes_tutorial.rst:846 +msgid "" +"typedef struct {\n" +" PyListObject list;\n" +" int state;\n" +"} SubListObject;" +msgstr "" + +#: extending/newtypes_tutorial.rst:851 msgid "" "The primary difference for derived type objects is that the base type's " "object structure must be the first value. The base type will already " "include the :c:func:`PyObject_HEAD` at the beginning of its structure." msgstr "" -#: extending/newtypes_tutorial.rst:826 +#: extending/newtypes_tutorial.rst:855 msgid "" "When a Python object is a :class:`!SubList` instance, its ``PyObject *`` " "pointer can be safely cast to both ``PyListObject *`` and ``SubListObject " "*``::" msgstr "" -#: extending/newtypes_tutorial.rst:838 +#: extending/newtypes_tutorial.rst:858 +msgid "" +"static int\n" +"SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" SubListObject *self = (SubListObject *) op;\n" +" if (PyList_Type.tp_init(op, args, kwds) < 0)\n" +" return -1;\n" +" self->state = 0;\n" +" return 0;\n" +"}" +msgstr "" + +#: extending/newtypes_tutorial.rst:868 msgid "" "We see above how to call through to the :meth:`~object.__init__` method of " "the base type." msgstr "" -#: extending/newtypes_tutorial.rst:841 +#: extending/newtypes_tutorial.rst:871 msgid "" "This pattern is important when writing a type with custom :c:member:" "`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_dealloc` members. " @@ -792,16 +1996,34 @@ msgid "" "the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." msgstr "" -#: extending/newtypes_tutorial.rst:847 +#: extending/newtypes_tutorial.rst:877 msgid "" "The :c:type:`PyTypeObject` struct supports a :c:member:`~PyTypeObject." "tp_base` specifying the type's concrete base class. Due to cross-platform " "compiler issues, you can't fill that field directly with a reference to :c:" -"type:`PyList_Type`; it should be done later in the module initialization " -"function::" +"type:`PyList_Type`; it should be done in the :c:data:`Py_mod_exec` function::" +msgstr "" + +#: extending/newtypes_tutorial.rst:883 +msgid "" +"static int\n" +"sublist_module_exec(PyObject *m)\n" +"{\n" +" SubListType.tp_base = &PyList_Type;\n" +" if (PyType_Ready(&SubListType) < 0) {\n" +" return -1;\n" +" }\n" +"\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" +" return -1;\n" +" }\n" +"\n" +" return 0;\n" +"}" msgstr "" -#: extending/newtypes_tutorial.rst:875 +#: extending/newtypes_tutorial.rst:898 msgid "" "Before calling :c:func:`PyType_Ready`, the type structure must have the :c:" "member:`~PyTypeObject.tp_base` slot filled in. When we are deriving an " @@ -810,29 +2032,29 @@ msgid "" "from the base type will be inherited." msgstr "" -#: extending/newtypes_tutorial.rst:881 +#: extending/newtypes_tutorial.rst:904 msgid "" "After that, calling :c:func:`PyType_Ready` and adding the type object to the " "module is the same as with the basic :class:`!Custom` examples." msgstr "" -#: extending/newtypes_tutorial.rst:886 +#: extending/newtypes_tutorial.rst:909 msgid "Footnotes" msgstr "" -#: extending/newtypes_tutorial.rst:887 +#: extending/newtypes_tutorial.rst:910 msgid "" "This is true when we know that the object is a basic type, like a string or " "a float." msgstr "" -#: extending/newtypes_tutorial.rst:890 +#: extending/newtypes_tutorial.rst:913 msgid "" "We relied on this in the :c:member:`~PyTypeObject.tp_dealloc` handler in " "this example, because our type doesn't support garbage collection." msgstr "" -#: extending/newtypes_tutorial.rst:893 +#: extending/newtypes_tutorial.rst:916 msgid "" "We now know that the first and last members are strings, so perhaps we could " "be less careful about decrementing their reference counts, however, we " @@ -842,7 +2064,7 @@ msgid "" "objects." msgstr "" -#: extending/newtypes_tutorial.rst:899 +#: extending/newtypes_tutorial.rst:922 msgid "" "Also, even with our attributes restricted to strings instances, the user " "could pass arbitrary :class:`str` subclasses and therefore still create " diff --git a/extending/windows.po b/extending/windows.po index d3c73163..66c69cee 100644 --- a/extending/windows.po +++ b/extending/windows.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -138,39 +139,84 @@ msgid "" "create a separate copy." msgstr "" -#: extending/windows.rst:103 +#: extending/windows.rst:101 +msgid "" +"Turn off the implicit, ``#pragma``-based linkage with the Python library, " +"performed inside CPython header files." +msgstr "" + +#: extending/windows.rst:110 msgid "Using DLLs in Practice" msgstr "" -#: extending/windows.rst:108 +#: extending/windows.rst:115 msgid "" "Windows Python is built in Microsoft Visual C++; using other compilers may " "or may not work. The rest of this section is MSVC++ specific." msgstr "" -#: extending/windows.rst:111 +#: extending/windows.rst:118 +msgid "" +"When creating DLLs in Windows, you can use the CPython library in two ways:" +msgstr "" + +#: extending/windows.rst:120 msgid "" -"When creating DLLs in Windows, you must pass :file:`pythonXY.lib` to the " -"linker. To build two DLLs, spam and ni (which uses C functions found in " -"spam), you could use these commands::" +"By default, inclusion of :file:`PC/pyconfig.h` directly or via :file:`Python." +"h` triggers an implicit, configure-aware link with the library. The header " +"file chooses :file:`pythonXY_d.lib` for Debug, :file:`pythonXY.lib` for " +"Release, and :file:`pythonX.lib` for Release with the :ref:`Limited API " +"` enabled." msgstr "" -#: extending/windows.rst:118 +#: extending/windows.rst:144 +msgid "" +"To build two DLLs, spam and ni (which uses C functions found in spam), you " +"could use these commands::" +msgstr "" + +#: extending/windows.rst:129 +msgid "" +"cl /LD /I/python/include spam.c\n" +"cl /LD /I/python/include ni.c spam.lib" +msgstr "" + +#: extending/windows.rst:132 msgid "" "The first command created three files: :file:`spam.obj`, :file:`spam.dll` " "and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python " "functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find " -"the Python code thanks to :file:`pythonXY.lib`." +"the Python code thanks to the implicitly linked :file:`pythonXY.lib`." msgstr "" -#: extending/windows.rst:123 +#: extending/windows.rst:155 msgid "" "The second command created :file:`ni.dll` (and :file:`.obj` and :file:`." "lib`), which knows how to find the necessary functions from spam, and also " "from the Python executable." msgstr "" -#: extending/windows.rst:127 +#: extending/windows.rst:141 +msgid "" +"Manually by defining :c:macro:`Py_NO_LINK_LIB` macro before including :file:" +"`Python.h`. You must pass :file:`pythonXY.lib` to the linker." +msgstr "" + +#: extending/windows.rst:147 +msgid "" +"cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib\n" +"cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib" +msgstr "" + +#: extending/windows.rst:150 +msgid "" +"The first command created three files: :file:`spam.obj`, :file:`spam.dll` " +"and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python " +"functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find " +"the Python code thanks to :file:`pythonXY.lib`." +msgstr "" + +#: extending/windows.rst:159 msgid "" "Not every identifier is exported to the lookup table. If you want any other " "modules (including Python) to be able to see your identifiers, you have to " @@ -178,7 +224,7 @@ msgid "" "initspam(void)`` or ``PyObject _declspec(dllexport) *NiGetSpamData(void)``." msgstr "" -#: extending/windows.rst:132 +#: extending/windows.rst:164 msgid "" "Developer Studio will throw in a lot of import libraries that you do not " "really need, adding about 100K to your executable. To get rid of them, use " diff --git a/faq/design.po b/faq/design.po index c2fe6679..b8733e3a 100644 --- a/faq/design.po +++ b/faq/design.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -42,6 +43,14 @@ msgid "" "programmers will encounter a fragment of code like this::" msgstr "" +#: faq/design.rst:21 +msgid "" +"if (x <= y)\n" +" x++;\n" +" y--;\n" +"z++;" +msgstr "" + #: faq/design.rst:26 msgid "" "Only the ``x++`` statement is executed if the condition is true, but the " @@ -86,6 +95,12 @@ msgstr "" msgid "Users are often surprised by results like this::" msgstr "" +#: faq/design.rst:58 +msgid "" +">>> 1.2 - 1.0\n" +"0.19999999999999996" +msgstr "" + #: faq/design.rst:61 msgid "" "and think it is a bug in Python. It's not. This has little to do with " @@ -106,7 +121,11 @@ msgstr "" #: faq/design.rst:72 msgid "" "Many numbers that can be written easily in decimal notation cannot be " -"expressed exactly in binary floating-point. For example, after::" +"expressed exactly in binary floating point. For example, after::" +msgstr "" + +#: faq/design.rst:75 +msgid ">>> x = 1.2" msgstr "" #: faq/design.rst:77 @@ -116,10 +135,18 @@ msgid "" "actual stored value is::" msgstr "" +#: faq/design.rst:81 +msgid "1.0011001100110011001100110011001100110011001100110011 (binary)" +msgstr "" + #: faq/design.rst:83 msgid "which is exactly::" msgstr "" +#: faq/design.rst:85 +msgid "1.1999999999999999555910790149937383830547332763671875 (decimal)" +msgstr "" + #: faq/design.rst:87 msgid "" "The typical precision of 53 bits provides Python floats with 15--16 decimal " @@ -128,7 +155,7 @@ msgstr "" #: faq/design.rst:90 msgid "" -"For a fuller explanation, please see the :ref:`floating point arithmetic " +"For a fuller explanation, please see the :ref:`floating-point arithmetic " "` chapter in the Python tutorial." msgstr "" @@ -223,6 +250,12 @@ msgid "" "an expression::" msgstr "" +#: faq/design.rst:161 +msgid "" +"while chunk := fp.read(200):\n" +" print(chunk)" +msgstr "" + #: faq/design.rst:164 msgid "See :pep:`572` for more information." msgstr "" @@ -275,10 +308,18 @@ msgid "" "programmers feel uncomfortable is::" msgstr "" +#: faq/design.rst:201 +msgid "\", \".join(['1', '2', '4', '8', '16'])" +msgstr "" + #: faq/design.rst:203 msgid "which gives the result::" msgstr "" +#: faq/design.rst:205 +msgid "\"1, 2, 4, 8, 16\"" +msgstr "" + #: faq/design.rst:207 msgid "There are two common arguments against this usage." msgstr "" @@ -300,6 +341,10 @@ msgid "" "`~str.split` as a string method, since in that case it is easy to see that ::" msgstr "" +#: faq/design.rst:220 +msgid "\"1, 2, 4, 8, 16\".split(\", \")" +msgstr "" + #: faq/design.rst:222 msgid "" "is an instruction to a string literal to return the substrings delimited by " @@ -326,12 +371,29 @@ msgid "" "versions of Python prior to 2.0 it was common to use this idiom::" msgstr "" +#: faq/design.rst:240 +msgid "" +"try:\n" +" value = mydict[key]\n" +"except KeyError:\n" +" mydict[key] = getvalue(key)\n" +" value = mydict[key]" +msgstr "" + #: faq/design.rst:246 msgid "" "This only made sense when you expected the dict to have the key almost all " "the time. If that wasn't the case, you coded it like this::" msgstr "" +#: faq/design.rst:249 +msgid "" +"if key in mydict:\n" +" value = mydict[key]\n" +"else:\n" +" value = mydict[key] = getvalue(key)" +msgstr "" + #: faq/design.rst:254 msgid "" "For this specific case, you could also use ``value = dict.setdefault(key, " @@ -359,12 +421,34 @@ msgid "" "to call. For example::" msgstr "" +#: faq/design.rst:272 +msgid "" +"functions = {'a': function_1,\n" +" 'b': function_2,\n" +" 'c': self.method_1}\n" +"\n" +"func = functions[value]\n" +"func()" +msgstr "" + #: faq/design.rst:279 msgid "" "For calling methods on objects, you can simplify yet further by using the :" "func:`getattr` built-in to retrieve methods with a particular name::" msgstr "" +#: faq/design.rst:282 +msgid "" +"class MyVisitor:\n" +" def visit_a(self):\n" +" ...\n" +"\n" +" def dispatch(self, value):\n" +" method_name = 'visit_' + str(value)\n" +" method = getattr(self, method_name)\n" +" method()" +msgstr "" + #: faq/design.rst:291 msgid "" "It's suggested that you use a prefix for the method names, such as " @@ -430,8 +514,8 @@ msgstr "" #: faq/design.rst:330 msgid "" "`Cython `_ compiles a modified version of Python with " -"optional annotations into C extensions. `Nuitka `_ " -"is an up-and-coming compiler of Python into C++ code, aiming to support the " +"optional annotations into C extensions. `Nuitka `_ is " +"an up-and-coming compiler of Python into C++ code, aiming to support the " "full Python language." msgstr "" @@ -453,10 +537,10 @@ msgstr "" #: faq/design.rst:347 msgid "" "Other implementations (such as `Jython `_ or `PyPy " -"`_), however, can rely on a different mechanism such " -"as a full-blown garbage collector. This difference can cause some subtle " -"porting problems if your Python code depends on the behavior of the " -"reference counting implementation." +"`_), however, can rely on a different mechanism such as a " +"full-blown garbage collector. This difference can cause some subtle porting " +"problems if your Python code depends on the behavior of the reference " +"counting implementation." msgstr "" #: faq/design.rst:353 @@ -465,6 +549,13 @@ msgid "" "CPython) will probably run out of file descriptors::" msgstr "" +#: faq/design.rst:356 +msgid "" +"for file in very_long_list_of_files:\n" +" f = open(file)\n" +" c = f.read(1)" +msgstr "" + #: faq/design.rst:360 msgid "" "Indeed, using CPython's reference counting and destructor scheme, each new " @@ -480,6 +571,13 @@ msgid "" "will work regardless of memory management scheme::" msgstr "" +#: faq/design.rst:369 +msgid "" +"for file in very_long_list_of_files:\n" +" with open(file) as f:\n" +" c = f.read(1)" +msgstr "" + #: faq/design.rst:375 msgid "Why doesn't CPython use a more traditional garbage collection scheme?" msgstr "" @@ -643,6 +741,12 @@ msgid "" "construct a new list with the same value it won't be found; e.g.::" msgstr "" +#: faq/design.rst:483 +msgid "" +"mydict = {[1, 2]: '12'}\n" +"print(mydict[[1, 2]])" +msgstr "" + #: faq/design.rst:486 msgid "" "would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` " @@ -686,6 +790,26 @@ msgid "" "the object is in the dictionary (or other structure). ::" msgstr "" +#: faq/design.rst:513 +msgid "" +"class ListWrapper:\n" +" def __init__(self, the_list):\n" +" self.the_list = the_list\n" +"\n" +" def __eq__(self, other):\n" +" return self.the_list == other.the_list\n" +"\n" +" def __hash__(self):\n" +" l = self.the_list\n" +" result = 98767 - len(l)*555\n" +" for i, el in enumerate(l):\n" +" try:\n" +" result = result + (hash(el) % 9999999) * 1001 + i\n" +" except Exception:\n" +" result = (result % 7777777) + i * 333\n" +" return result" +msgstr "" + #: faq/design.rst:530 msgid "" "Note that the hash computation is complicated by the possibility that some " @@ -732,6 +856,12 @@ msgid "" "dictionary in sorted order::" msgstr "" +#: faq/design.rst:559 +msgid "" +"for key in sorted(mydict):\n" +" ... # do whatever with mydict[key]..." +msgstr "" + #: faq/design.rst:564 msgid "How do you specify and enforce an interface spec in Python?" msgstr "" @@ -777,9 +907,9 @@ msgid "" "An appropriate testing discipline can help build large complex applications " "in Python as well as having interface specifications would. In fact, it can " "be better because an interface specification cannot test certain properties " -"of a program. For example, the :meth:`!list.append` method is expected to " +"of a program. For example, the :meth:`list.append` method is expected to " "add new elements to the end of some internal list; an interface " -"specification cannot test that your :meth:`!list.append` implementation will " +"specification cannot test that your :meth:`list.append` implementation will " "actually do this correctly, but it's trivial to check this property in a " "test suite." msgstr "" @@ -816,6 +946,19 @@ msgid "" "other languages. For example::" msgstr "" +#: faq/design.rst:620 +msgid "" +"class label(Exception): pass # declare a label\n" +"\n" +"try:\n" +" ...\n" +" if condition: raise label() # goto label\n" +" ...\n" +"except label: # where to goto\n" +" pass\n" +"..." +msgstr "" + #: faq/design.rst:630 msgid "" "This doesn't allow you to jump into the middle of a loop, but that's usually " @@ -849,11 +992,22 @@ msgid "" "calls accept forward slashes too::" msgstr "" +#: faq/design.rst:651 +msgid "f = open(\"/mydir/file.txt\") # works fine!" +msgstr "" + #: faq/design.rst:653 msgid "" "If you're trying to build a pathname for a DOS command, try e.g. one of ::" msgstr "" +#: faq/design.rst:655 +msgid "" +"dir = r\"\\this\\is\\my\\dos\\dir\" \"\\\\\"\n" +"dir = r\"\\this\\is\\my\\dos\\dir\\ \"[:-1]\n" +"dir = \"\\\\this\\\\is\\\\my\\\\dos\\\\dir\\\\\"" +msgstr "" + #: faq/design.rst:661 msgid "Why doesn't Python have a \"with\" statement for attribute assignments?" msgstr "" @@ -865,6 +1019,13 @@ msgid "" "construct that looks like this::" msgstr "" +#: faq/design.rst:667 +msgid "" +"with obj:\n" +" a = 1 # equivalent to obj.a = 1\n" +" total = total + 1 # obj.total = obj.total + 1" +msgstr "" + #: faq/design.rst:671 msgid "In Python, such a construct would be ambiguous." msgstr "" @@ -890,6 +1051,13 @@ msgstr "" msgid "For instance, take the following incomplete snippet::" msgstr "" +#: faq/design.rst:686 +msgid "" +"def foo(a):\n" +" with a:\n" +" print(x)" +msgstr "" + #: faq/design.rst:690 msgid "" "The snippet assumes that ``a`` must have a member attribute called ``x``. " @@ -906,10 +1074,25 @@ msgid "" "assignment. Instead of::" msgstr "" +#: faq/design.rst:699 +msgid "" +"function(args).mydict[index][index].a = 21\n" +"function(args).mydict[index][index].b = 42\n" +"function(args).mydict[index][index].c = 63" +msgstr "" + #: faq/design.rst:703 msgid "write this::" msgstr "" +#: faq/design.rst:705 +msgid "" +"ref = function(args).mydict[index][index]\n" +"ref.a = 21\n" +"ref.b = 42\n" +"ref.c = 63" +msgstr "" + #: faq/design.rst:710 msgid "" "This also has the side-effect of increasing execution speed because name " @@ -947,10 +1130,22 @@ msgid "" "of the experimental ABC language). Consider this::" msgstr "" +#: faq/design.rst:735 +msgid "" +"if a == b\n" +" print(a)" +msgstr "" + #: faq/design.rst:738 msgid "versus ::" msgstr "" +#: faq/design.rst:740 +msgid "" +"if a == b:\n" +" print(a)" +msgstr "" + #: faq/design.rst:743 msgid "" "Notice how the second one is slightly easier to read. Notice further how a " @@ -976,6 +1171,16 @@ msgid "" "dictionaries::" msgstr "" +#: faq/design.rst:757 +msgid "" +"[1, 2, 3,]\n" +"('a', 'b', 'c',)\n" +"d = {\n" +" \"A\": [1, 5],\n" +" \"B\": [6, 7], # last trailing comma is optional but good style\n" +"}" +msgstr "" + #: faq/design.rst:765 msgid "There are several reasons to allow this." msgstr "" @@ -994,6 +1199,16 @@ msgid "" "diagnose. For example::" msgstr "" +#: faq/design.rst:775 +msgid "" +"x = [\n" +" \"fee\",\n" +" \"fie\"\n" +" \"foo\",\n" +" \"fum\"\n" +"]" +msgstr "" + #: faq/design.rst:782 msgid "" "This list looks like it has four elements, but it actually contains three: " diff --git a/faq/extending.po b/faq/extending.po index 2c5f2eca..a1271eec 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -8,25 +8,27 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2024-10-31 12:22+0200\n" +"Last-Translator: Panagiotis Skias \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.5\n" #: faq/extending.rst:3 msgid "Extending/Embedding FAQ" -msgstr "" +msgstr "Συχνές ερωτήσεις επέκτασης/ενσωμάτωσης" #: faq/extending.rst:6 msgid "Contents" -msgstr "" +msgstr "Περιεχόμενα" #: faq/extending.rst:16 msgid "Can I create my own functions in C?" -msgstr "" +msgstr "Μπορώ να δημιουργήσω τις δικές μου συναρτήσεις στη C;" #: faq/extending.rst:18 msgid "" @@ -34,14 +36,19 @@ msgid "" "exceptions and even new types in C. This is explained in the document :ref:" "`extending-index`." msgstr "" +"Ναι, μπορείτε να δημιουργήσετε ενσωματωμένα (built-in) modules που περιέχουν " +"συναρτήσεις, μεταβλητές, εξαιρέσεις και ακόμη και νέους τύπους στην C. Αυτό " +"εξηγείται στο έγγραφο :ref:`extending-index`." #: faq/extending.rst:22 msgid "Most intermediate or advanced Python books will also cover this topic." msgstr "" +"Τα περισσότερα βιβλία μεσαίας ή προηγμένης Python θα καλύπτουν επίσης αυτό " +"το θέμα." #: faq/extending.rst:26 msgid "Can I create my own functions in C++?" -msgstr "" +msgstr "Μπορώ να δημιουργήσω τις δικές μου συναρτήσεις στη C++;" #: faq/extending.rst:28 msgid "" @@ -50,42 +57,33 @@ msgid "" "before each function that is going to be called by the Python interpreter. " "Global or static C++ objects with constructors are probably not a good idea." msgstr "" +"Ναι, χρησιμοποιώντας τις δυνατότητες συμβατότητας C που βρίσκονται στη C++. " +"Τοποθετήστε το ``extern \"C\" { ... }`` γύρω από την Python να περιλαμβάνει " +"αρχεία και τοποθετήστε το ``extern \"C\"`` πριν από κάθε συνάρτηση που " +"πρόκειται να κληθεί από τον διερμηνέα της Python. Τα καθολικά ή τα στατικά " +"αντικείμενα C++ με constructors μάλλον δεν είναι καλή ιδέα." #: faq/extending.rst:37 msgid "Writing C is hard; are there any alternatives?" -msgstr "" +msgstr "Το να γράψει C κάποιος είναι δύσκολο· υπάρχουν άλλες εναλλακτικές;" #: faq/extending.rst:39 msgid "" "There are a number of alternatives to writing your own C extensions, " -"depending on what you're trying to do." -msgstr "" - -#: faq/extending.rst:44 -msgid "" -"`Cython `_ and its relative `Pyrex `_ are compilers that accept a " -"slightly modified form of Python and generate the corresponding C code. " -"Cython and Pyrex make it possible to write an extension without having to " -"learn Python's C API." -msgstr "" - -#: faq/extending.rst:50 -msgid "" -"If you need to interface to some C or C++ library for which no Python " -"extension currently exists, you can try wrapping the library's data types " -"and functions with a tool such as `SWIG `_. `SIP " -"`__, `CXX `_ `Boost `_, or `Weave " -"`_ are also alternatives for wrapping C++ " -"libraries." +"depending on what you're trying to do. :ref:`Recommended third party tools " +"` offer both simpler and more sophisticated approaches to " +"creating C and C++ extensions for Python." msgstr "" +"Υπάρχουν αρκετές εναλλακτικές λύσεις για τη σύνταξη των δικών σας επεκτάσεων " +"C, ανάλογα με το τι προσπαθείτε να κάνετε. Το :ref:`Recommended third party " +"tools ` προσφέρουν απλούστερες και πιο εξελιγμένες προσεγγίσεις " +"για τη δημιουργία επεκτάσεων C και C++ για Python." -#: faq/extending.rst:61 +#: faq/extending.rst:46 msgid "How can I execute arbitrary Python statements from C?" -msgstr "" +msgstr "Πως μπορώ να εκτελέσω αυθαίρετες δηλώσεις Python από το C;" -#: faq/extending.rst:63 +#: faq/extending.rst:48 msgid "" "The highest-level function to do this is :c:func:`PyRun_SimpleString` which " "takes a single string argument to be executed in the context of the module " @@ -94,46 +92,67 @@ msgid "" "func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in " "``Python/pythonrun.c``." msgstr "" +"Η συνάρτηση υψηλότερου επιπέδου για να γίνει αυτό είναι η :c:func:" +"`PyRun_SimpleString` η οποία εκτελεί ένα όρισμα συμβολοσειράς στο πλαίσιο " +"της ενότητας ``__main__`` και επιστρέφει ``0`` για επιτυχία και ``-1`` όταν " +"συμβαίνει μια εξαίρεση (συμπεριλαμβανομένου του :exc:`SyntaxError`). Εάν " +"θέλετε περισσότερο έλεγχο, χρησιμοποιήστε :c:func:`PyRun_String` · δείτε τον " +"πηγαίο κώδικα :c:func:`PyRun_SimpleString` στο ``Python/pythonrun.c``." -#: faq/extending.rst:72 +#: faq/extending.rst:57 msgid "How can I evaluate an arbitrary Python expression from C?" -msgstr "" +msgstr "Πώς μπορώ να αξιολογήσω μια αυθαίρετη έκφραση Python από τη C;" -#: faq/extending.rst:74 +#: faq/extending.rst:59 msgid "" "Call the function :c:func:`PyRun_String` from the previous question with the " "start symbol :c:data:`Py_eval_input`; it parses an expression, evaluates it " "and returns its value." msgstr "" +"Καλέστε τη συνάρτηση :c:func:`PyRun_String` από την προηγούμενη ερώτηση με " +"το σύμβολο έναρξης :c:data:`Py_eval_input`· αναλύει μια παράσταση, την " +"αξιολογεί και επιστρέφει την τιμή της." -#: faq/extending.rst:80 +#: faq/extending.rst:65 msgid "How do I extract C values from a Python object?" -msgstr "" +msgstr "Πως μπορώ να εξάγω τιμές C από ένα αντικείμενο Python;" -#: faq/extending.rst:82 +#: faq/extending.rst:67 msgid "" "That depends on the object's type. If it's a tuple, :c:func:`PyTuple_Size` " "returns its length and :c:func:`PyTuple_GetItem` returns the item at a " "specified index. Lists have similar functions, :c:func:`PyList_Size` and :c:" "func:`PyList_GetItem`." msgstr "" +"Αυτό εξαρτάται από τον τύπο του αντικειμένου. Εάν είναι μια πλειάδα " +"(tuple), :c:func:`PyTuple_Size` επιστρέφει το μήκος του και το :c:func:" +"`PyTuple_GetItem` επιστρέφει το στοιχείο σε ένα καθορισμένο index. Οι " +"λίστες έχουν παρόμοιες συναρτήσεις, :c:func:`PyList_Size` και :c:func:" +"`PyList_GetItem`." -#: faq/extending.rst:87 +#: faq/extending.rst:72 msgid "" "For bytes, :c:func:`PyBytes_Size` returns its length and :c:func:" "`PyBytes_AsStringAndSize` provides a pointer to its value and its length. " "Note that Python bytes objects may contain null bytes so C's :c:func:`!" "strlen` should not be used." msgstr "" +"Για bytes, :c:func:`PyBytes_Size` επιστρέφει το μήκος του και το :c:func:" +"`PyBytes_AsStringAndSize` παρέχει έναν δείκτη στην τιμή και το μήκος του. " +"Λάβετε υπόψη ότι τα αντικείμενα byte της Python μπορεί να περιέχουν null " +"byte, επομένως η :c:func:`!strlen` της C δεν πρέπει να χρησιμοποιείται." -#: faq/extending.rst:92 +#: faq/extending.rst:77 msgid "" "To test the type of an object, first make sure it isn't ``NULL``, and then " "use :c:func:`PyBytes_Check`, :c:func:`PyTuple_Check`, :c:func:" "`PyList_Check`, etc." msgstr "" +"Για να ελέγξετε τον τύπο ενός αντικειμένου, πρώτα βεβαιωθείτε ότι δεν είναι " +"``NULL``, και μετά χρησιμοποιήστε τα :c:func:`PyBytes_Check`, :c:func:" +"`PyTuple_Check`, :c:func:`PyList_Check`, κλπ." -#: faq/extending.rst:95 +#: faq/extending.rst:80 msgid "" "There is also a high-level API to Python objects which is provided by the so-" "called 'abstract' interface -- read ``Include/abstract.h`` for further " @@ -142,79 +161,195 @@ msgid "" "as many other useful protocols such as numbers (:c:func:`PyNumber_Index` et " "al.) and mappings in the PyMapping APIs." msgstr "" +"Υπάρχει επίσης ένα API υψηλού επιπέδου για αντικείμενα Python που παρέχεται " +"από τη λεγόμενη 'abstract' διεπαφή (interface) -- διαβάστε ``Include/" +"abstract.h`` για περισσότερες λεπτομέρειες. Επιτρέπει τη διασύνδεση με κάθε " +"είδους ακολουθίας Python χρησιμοποιώντας κλήσεις όπως :c:func:" +"`PySequence_Length`, :c:func:`PySequence_GetItem`, κλπ. καθώς και πολλά άλλα " +"χρήσιμα πρωτόκολλα όπως αριθμοί (:c:func:`PyNumber_Index` et al.) και " +"αντιστοιχίσεις στον PyMapping APIs." -#: faq/extending.rst:104 +#: faq/extending.rst:89 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" msgstr "" +"Πώς μπορώ να χρησιμοποιήσω την Py_BuildValue() για να δημιουργήσω μια " +"πλειάδα (tuple) αυθαίρετου μήκους;" -#: faq/extending.rst:106 +#: faq/extending.rst:91 msgid "You can't. Use :c:func:`PyTuple_Pack` instead." -msgstr "" +msgstr "Δεν μπορείς. Χρησιμοποιήστε το :c:func:`PyTuple_Pack`." -#: faq/extending.rst:110 +#: faq/extending.rst:95 msgid "How do I call an object's method from C?" -msgstr "" +msgstr "Πώς καλώ τη μέθοδο ενός αντικειμένου από τη C;" -#: faq/extending.rst:112 +#: faq/extending.rst:97 msgid "" "The :c:func:`PyObject_CallMethod` function can be used to call an arbitrary " "method of an object. The parameters are the object, the name of the method " "to call, a format string like that used with :c:func:`Py_BuildValue`, and " "the argument values::" msgstr "" +"Η συνάρτηση :c:func:`PyObject_CallMethod` μπορεί να χρησιμοποιηθεί για την " +"κλήση μιας αυθαίρετης μεθόδου ενός αντικειμένου. Οι παράμετροι είναι το " +"αντικείμενο, το όνομα της μεθόδου προς κλήση, μια συμβολοσειρά μορφής όπως " +"αυτή που χρησιμοποιείται με τη :c:func:`Py_BuildValue`, και τις τιμές " +"ορίσματος::" -#: faq/extending.rst:121 +#: faq/extending.rst:102 +msgid "" +"PyObject *\n" +"PyObject_CallMethod(PyObject *object, const char *method_name,\n" +" const char *arg_format, ...);" +msgstr "" +"PyObject *\n" +"PyObject_CallMethod(PyObject *object, const char *method_name,\n" +" const char *arg_format, ...);" + +#: faq/extending.rst:106 msgid "" "This works for any object that has methods -- whether built-in or user-" "defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the " "return value." msgstr "" +"Αυτό λειτουργεί για κάθε αντικείμενο που έχει μεθόδους -- είτε είναι " +"ενσωματωμένες είτε καθορίζονται από το χρήστη. Είστε υπεύθυνοι εάν τελικά " +"χρησιμοποιήσετε :c:func:`Py_DECREF` στην τιμή επιστροφής." -#: faq/extending.rst:124 +#: faq/extending.rst:109 msgid "" "To call, e.g., a file object's \"seek\" method with arguments 10, 0 " "(assuming the file object pointer is \"f\")::" msgstr "" +"Για να καλέσετε, π.χ., τη μέθοδο \"seek\" ενός αντικειμένου αρχείου με " +"ορίσματα 10, 0 (υποθέτοντας ότι ο δείκτης του αντικειμένου αρχείου είναι " +"\"f\")::" -#: faq/extending.rst:135 +#: faq/extending.rst:112 +msgid "" +"res = PyObject_CallMethod(f, \"seek\", \"(ii)\", 10, 0);\n" +"if (res == NULL) {\n" +" ... an exception occurred ...\n" +"}\n" +"else {\n" +" Py_DECREF(res);\n" +"}" +msgstr "" +"res = PyObject_CallMethod(f, \"seek\", \"(ii)\", 10, 0);\n" +"if (res == NULL) {\n" +" ... an exception occurred ...\n" +"}\n" +"else {\n" +" Py_DECREF(res);\n" +"}" + +#: faq/extending.rst:120 msgid "" "Note that since :c:func:`PyObject_CallObject` *always* wants a tuple for the " "argument list, to call a function without arguments, pass \"()\" for the " "format, and to call a function with one argument, surround the argument in " "parentheses, e.g. \"(i)\"." msgstr "" +"Σημειώστε ότι επειδή το :c:func:`PyObject_CallObject` *πάντα* θέλει μια " +"πλειάδα (tuple) για τη λίστα ορισμάτων, για να καλέσει μια συνάρτηση χωρίς " +"ορίσματα, να περάσει \"()\" για τη μορφή και να καλέσει μια συνάρτηση με ένα " +"όρισμα, περιβάλλουν το όρισμα σε παρένθεση, π.χ. \"(i)\"." -#: faq/extending.rst:142 +#: faq/extending.rst:127 msgid "" "How do I catch the output from PyErr_Print() (or anything that prints to " "stdout/stderr)?" msgstr "" +"Πώς μπορώ να κάνω catch την έξοδο από την PyErr_Print() (ή οτιδήποτε " +"εκτυπώνεται σε stdout/stderr);" -#: faq/extending.rst:144 +#: faq/extending.rst:129 msgid "" "In Python code, define an object that supports the ``write()`` method. " "Assign this object to :data:`sys.stdout` and :data:`sys.stderr`. Call " "print_error, or just allow the standard traceback mechanism to work. Then, " "the output will go wherever your ``write()`` method sends it." msgstr "" +"Στον κώδικα Python, ορίστε ένα αντικείμενο που υποστηρίζει τη μέθοδο " +"``write()``. Αντιστοιχίστε αυτό το αντικείμενο στα :data:`sys.stdout` και :" +"data:`sys.stderr`. Καλέστε το print_error, ή απλώς επιτρέψτε στον τυπικό " +"μηχανισμό ανίχνευσης να λειτουργήσει. Στη συνέχεια, η έξοδος θα πάει " +"οπουδήποτε την στείλει η μέθοδος ``write()``." -#: faq/extending.rst:149 +#: faq/extending.rst:134 msgid "The easiest way to do this is to use the :class:`io.StringIO` class:" msgstr "" +"Ο ευκολότερος τρόπος για να το κάνετε αυτό είναι να χρησιμοποιήσετε την " +"κλάση :class:`io.StringIO`:" -#: faq/extending.rst:161 -msgid "A custom object to do the same would look like this:" +#: faq/extending.rst:136 +msgid "" +">>> import io, sys\n" +">>> sys.stdout = io.StringIO()\n" +">>> print('foo')\n" +">>> print('hello world!')\n" +">>> sys.stderr.write(sys.stdout.getvalue())\n" +"foo\n" +"hello world!" msgstr "" +">>> import io, sys\n" +">>> sys.stdout = io.StringIO()\n" +">>> print('foo')\n" +">>> print('hello world!')\n" +">>> sys.stderr.write(sys.stdout.getvalue())\n" +"foo\n" +"hello world!" -#: faq/extending.rst:182 +#: faq/extending.rst:146 +msgid "A custom object to do the same would look like this:" +msgstr "Ένα προσαρμοσμένο αντικείμενο για να κάνει το ίδιο θα μοιάζει με αυτό:" + +#: faq/extending.rst:148 +msgid "" +">>> import io, sys\n" +">>> class StdoutCatcher(io.TextIOBase):\n" +"... def __init__(self):\n" +"... self.data = []\n" +"... def write(self, stuff):\n" +"... self.data.append(stuff)\n" +"...\n" +">>> import sys\n" +">>> sys.stdout = StdoutCatcher()\n" +">>> print('foo')\n" +">>> print('hello world!')\n" +">>> sys.stderr.write(''.join(sys.stdout.data))\n" +"foo\n" +"hello world!" +msgstr "" +">>> import io, sys\n" +">>> class StdoutCatcher(io.TextIOBase):\n" +"... def __init__(self):\n" +"... self.data = []\n" +"... def write(self, stuff):\n" +"... self.data.append(stuff)\n" +"...\n" +">>> import sys\n" +">>> sys.stdout = StdoutCatcher()\n" +">>> print('foo')\n" +">>> print('hello world!')\n" +">>> sys.stderr.write(''.join(sys.stdout.data))\n" +"foo\n" +"hello world!" + +#: faq/extending.rst:167 msgid "How do I access a module written in Python from C?" msgstr "" +"Πως μπορώ να αποκτήσω πρόσβαση σε ένα module γραμμένο σε Python από τη C;" -#: faq/extending.rst:184 +#: faq/extending.rst:169 msgid "You can get a pointer to the module object as follows::" -msgstr "" +msgstr "Μπορείτε να λάβετε έναν δείκτη στο αντικείμενο του module ως εξής::" + +#: faq/extending.rst:171 +msgid "module = PyImport_ImportModule(\"\");" +msgstr "module = PyImport_ImportModule(\"\");" -#: faq/extending.rst:188 +#: faq/extending.rst:173 msgid "" "If the module hasn't been imported yet (i.e. it is not yet present in :data:" "`sys.modules`), this initializes the module; otherwise it simply returns the " @@ -222,24 +357,37 @@ msgid "" "module into any namespace -- it only ensures it has been initialized and is " "stored in :data:`sys.modules`." msgstr "" +"Εάν το module δεν έχει εισαχθεί ακόμα (δηλαδή δεν υπάρχει ακόμα στο :data:" +"`sys.modules`), αυτό αρχικοποιεί το module· διαφορετικά απλώς επιστρέφει την " +"τιμή του ``sys.modules[\"\"]``. Σημειώστε ότι δεν εισάγει το " +"module σε κανένα namespace -- διασφαλίζει μόνο ότι έχει αρχικοποιηθεί και " +"ότι είναι αποθηκευμένη στο :data:`sys.modules`." -#: faq/extending.rst:194 +#: faq/extending.rst:179 msgid "" "You can then access the module's attributes (i.e. any name defined in the " "module) as follows::" msgstr "" +"Μπορείτε στη συνέχεια να αποκτήσετε πρόσβαση στα χαρακτηριστικά του module " +"(δηλαδή οποιοδήποτε όνομα ορίζεται στο module) ως εξής::" -#: faq/extending.rst:199 +#: faq/extending.rst:182 +msgid "attr = PyObject_GetAttrString(module, \"\");" +msgstr "attr = PyObject_GetAttrString(module, \"\");" + +#: faq/extending.rst:184 msgid "" "Calling :c:func:`PyObject_SetAttrString` to assign to variables in the " "module also works." msgstr "" +"Η κλήση :c:func:`PyObject_SetAttrString` για αντιστοίχιση σε μεταβλητές στο " +"module λειτουργεί επίσης." -#: faq/extending.rst:204 +#: faq/extending.rst:189 msgid "How do I interface to C++ objects from Python?" -msgstr "" +msgstr "Πως διασυνδέομαι με αντικείμενα C++ από την Python;" -#: faq/extending.rst:206 +#: faq/extending.rst:191 msgid "" "Depending on your requirements, there are many approaches. To do this " "manually, begin by reading :ref:`the \"Extending and Embedding\" document " @@ -248,66 +396,107 @@ msgid "" "building a new Python type around a C structure (pointer) type will also " "work for C++ objects." msgstr "" +"Ανάλογα με τις απαιτήσεις σας, υπάρχουν πολλές προσεγγίσεις. Για να το " +"κάνετε αυτό χειροκίνητα, ξεκινήστε διαβάζοντας το :ref:`the \"Extending and " +"Embedding\" document ` . Συνειδητοποιήστε ότι για το " +"σύστημα χρόνου εκτελεστή Python, δεν υπάρχει μεγάλη διαφορά μεταξύ C και C++ " +"-- επομένως η στρατηγική της δημιουργίας ενός νέου τύπου Python γύρω από " +"έναν τύπο δομής C (δείκτη) θα λειτουργήσει επίσης για αντικείμενα C++." -#: faq/extending.rst:212 +#: faq/extending.rst:197 msgid "For C++ libraries, see :ref:`c-wrapper-software`." -msgstr "" +msgstr "Για βιβλιοθήκες C++, δείτε :ref:`c-wrapper-software`." -#: faq/extending.rst:216 +#: faq/extending.rst:201 msgid "I added a module using the Setup file and the make fails; why?" msgstr "" +"Πρόσθεσα ένα module χρησιμοποιώντας το αρχείο Setup και το make αποτυγχάνει· " +"γιατί;" -#: faq/extending.rst:218 +#: faq/extending.rst:203 msgid "" "Setup must end in a newline, if there is no newline there, the build process " "fails. (Fixing this requires some ugly shell script hackery, and this bug " "is so minor that it doesn't seem worth the effort.)" msgstr "" +"Το setup πρέπει να τελειώνει σε μια νέα γραμμή, αν δεν υπάρχει νέα γραμμή, η " +"διαδικασία build αποτυγχάνει. (Για να διορθωθεί αυτό απαιτεί κάποιο " +"κακόβουλο script shell, και αυτό το σφάλμα είναι τόσο μικρό που δεν φαίνεται " +"να αξίζει τον κόπο.)" -#: faq/extending.rst:224 +#: faq/extending.rst:209 msgid "How do I debug an extension?" -msgstr "" +msgstr "Πως κάνω debug μια επέκταση;" -#: faq/extending.rst:226 +#: faq/extending.rst:211 msgid "" "When using GDB with dynamically loaded extensions, you can't set a " "breakpoint in your extension until your extension is loaded." msgstr "" +"Όταν χρησιμοποιείτε το GDB με δυναμικά φορτωμένες επεκτάσεις, δεν μπορείτε " +"να ορίσετε σημείο διακοπής στην επέκταση σας μέχρι να φορτωθεί η επέκτασής " +"σας." -#: faq/extending.rst:229 +#: faq/extending.rst:214 msgid "In your ``.gdbinit`` file (or interactively), add the command:" -msgstr "" +msgstr "Στο αρχείο σας ``.gdbinit`` (ή διαδραστικά), προσθέστε την εντολή:" + +#: faq/extending.rst:216 +msgid "br _PyImport_LoadDynamicModule" +msgstr "br _PyImport_LoadDynamicModule" -#: faq/extending.rst:235 +#: faq/extending.rst:220 msgid "Then, when you run GDB:" +msgstr "Στη συνέχεια, όταν εκτελείτε το GDB:" + +#: faq/extending.rst:222 +msgid "" +"$ gdb /local/bin/python\n" +"gdb) run myscript.py\n" +"gdb) continue # repeat until your extension is loaded\n" +"gdb) finish # so that your extension is loaded\n" +"gdb) br myfunction.c:50\n" +"gdb) continue" msgstr "" +"$ gdb /local/bin/python\n" +"gdb) run myscript.py\n" +"gdb) continue # repeat until your extension is loaded\n" +"gdb) finish # so that your extension is loaded\n" +"gdb) br myfunction.c:50\n" +"gdb) continue" -#: faq/extending.rst:247 +#: faq/extending.rst:232 msgid "" "I want to compile a Python module on my Linux system, but some files are " "missing. Why?" msgstr "" +"Θέλω να κάνω compile ένα Python module στο σύστημα Linux μου, αλλά λείπουν " +"ορισμένα αρχεία. Γιατί;" -#: faq/extending.rst:249 +#: faq/extending.rst:234 msgid "" -"Most packaged versions of Python don't include the :file:`/usr/lib/python2." -"{x}/config/` directory, which contains various files required for compiling " +"Most packaged versions of Python omit some files required for compiling " "Python extensions." msgstr "" +"Οι περισσότερες συσκευασμένες εκδόσεις της Python παραλείπουν ορισμένα " +"αρχεία που απαιτούνται για τη μεταγλώττιση των επεκτάσεων Python." -#: faq/extending.rst:253 -msgid "For Red Hat, install the python-devel RPM to get the necessary files." +#: faq/extending.rst:237 +msgid "For Red Hat, install the python3-devel RPM to get the necessary files." msgstr "" +"Για το Red Hat, εγκαταστήστε το RPM της python3-devel για να λάβετε τα " +"απαραίτητα αρχεία." -#: faq/extending.rst:255 -msgid "For Debian, run ``apt-get install python-dev``." -msgstr "" +#: faq/extending.rst:239 +msgid "For Debian, run ``apt-get install python3-dev``." +msgstr "Για το Debian, εκτελέστε το ``apt-get install python3-dev``." -#: faq/extending.rst:258 +#: faq/extending.rst:242 msgid "How do I tell \"incomplete input\" from \"invalid input\"?" msgstr "" +"Πώς μπορώ να ξεχωρίσω την \"ελλιπή εισαγωγή\" από την \"έγκυρη εισαγωγή\";" -#: faq/extending.rst:260 +#: faq/extending.rst:244 msgid "" "Sometimes you want to emulate the Python interactive interpreter's behavior, " "where it gives you a continuation prompt when the input is incomplete (e.g. " @@ -315,14 +504,22 @@ msgid "" "parentheses or triple string quotes), but it gives you a syntax error " "message immediately when the input is invalid." msgstr "" +"Μερικές φορές θέλετε να μιμηθείτε τη συμπεριφορά του διαδραστικού διερμηνέα " +"Python, όπου σας δίνει ένα συνεχόμενο prompt όταν η είσοδος είναι ελλιπής (π." +"χ. πληκτρολογήσατε την αρχή μιας δήλωσης \"if\" ή δεν κλείσατε τις " +"παρενθέσεις ή τα τριπλά εισαγωγικά συμβολοσειρών), αλλά σας δίνει ένα μήνυμα " +"συντακτικού σφάλματος αμέσως όταν η εισαγωγή δεν είναι έγκυρη." -#: faq/extending.rst:266 +#: faq/extending.rst:250 msgid "" "In Python you can use the :mod:`codeop` module, which approximates the " "parser's behavior sufficiently. IDLE uses this, for example." msgstr "" +"Στην Python μπορείτε να χρησιμοποιήσετε το module :mod:`codeop`, η οποία " +"προσεγγίζει επαρκώς τη συμπεριφορά του parser. Το IDLE χρησιμοποιεί αυτό, " +"για παράδειγμα." -#: faq/extending.rst:269 +#: faq/extending.rst:253 msgid "" "The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` " "(perhaps in a separate thread) and let the Python interpreter handle the " @@ -330,33 +527,90 @@ msgid "" "to point at your custom input function. See ``Modules/readline.c`` and " "``Parser/myreadline.c`` for more hints." msgstr "" +"Ο ευκολότερος τρόπος για να το κάνετε στη C είναι να καλέσετε τη :c:func:" +"`PyRun_InteractiveLoop` (ίσως σε ξεχωριστό νήμα (thread)) και να αφήσετε τον " +"διερμηνέα Python να χειριστεί την είσοδο για εσάς. Μπορείτε επίσης να " +"ορίσετε :c:func:`PyOS_ReadlineFunctionPointer` για να δείξετε την δικιάς " +"προσαρμοσμένη συνάρτηση εισαγωγής. Δείτε τα ``Modules/readline.c`` και " +"``Parser/myreadline.c`` για περισσότερες συμβουλές." -#: faq/extending.rst:276 +#: faq/extending.rst:260 msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?" msgstr "" +"Πώς μπορώ να βρω απροσδιόριστα σύμβολα g++ __builtin_new ή __pure_virtual;" -#: faq/extending.rst:278 +#: faq/extending.rst:262 msgid "" "To dynamically load g++ extension modules, you must recompile Python, relink " "it using g++ (change LINKCC in the Python Modules Makefile), and link your " "extension module using g++ (e.g., ``g++ -shared -o mymodule.so mymodule.o``)." msgstr "" +"Για δυναμική φόρτωση module επέκτασης g++, πρέπει να κάνετε recompile την " +"Python, να τη συνδέσετε ξανά χρησιμοποιώντας g++ (αλλάξτε το LINKCC στο " +"Python Modules Makefile), και να συνδέσετε το module επέκτασης σας " +"χρησιμοποιώντας g++ (π.χ. ``g++ -shared -o mymodule.so mymodule.o``)." -#: faq/extending.rst:284 +#: faq/extending.rst:268 msgid "" "Can I create an object class with some methods implemented in C and others " "in Python (e.g. through inheritance)?" msgstr "" +"Μπορώ να δημιουργήσω μια κλάση αντικειμένου με ορισμένες μεθόδους που " +"υλοποιούνται στη C και άλλες στη Python (π.χ. μέσω κληρονομικότητας);" -#: faq/extending.rst:286 +#: faq/extending.rst:270 msgid "" "Yes, you can inherit from built-in classes such as :class:`int`, :class:" "`list`, :class:`dict`, etc." msgstr "" +"Ναι, μπορείτε να κληρονομήσετε από ενσωματωμένες (built-in) κλάσεις όπως :" +"class:`int`, :class:`list`, :class:`dict`, κ.λπ." -#: faq/extending.rst:289 +#: faq/extending.rst:273 msgid "" "The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index." "html) provides a way of doing this from C++ (i.e. you can inherit from an " "extension class written in C++ using the BPL)." msgstr "" +"Η βιβλιοθήκη Boost Python Library (BPL, https://www.boost.org/libs/python/" +"doc/index.html) παρέχει ένα τρόπο για να γίνει αυτό από την C++ (δηλαδή " +"μπορείτε να κληρονομήσετε από μια κλάση επέκτασης γραμμένη σε C++ " +"χρησιμοποιώντας το BPL)." + +#~ msgid "" +#~ "There are a number of alternatives to writing your own C extensions, " +#~ "depending on what you're trying to do." +#~ msgstr "" +#~ "Υπάρχουν διάφορες εναλλακτικές λύσεις για να γράψετε τις δικές σας " +#~ "επεκτάσεις C, ανάλογα με το τι προσπαθείτε να κάνετε." + +#~ msgid "" +#~ "`Cython `_ and its relative `Pyrex `_ are compilers that accept a " +#~ "slightly modified form of Python and generate the corresponding C code. " +#~ "Cython and Pyrex make it possible to write an extension without having to " +#~ "learn Python's C API." +#~ msgstr "" +#~ "Το `Cython `_ και το σχετικό του `Pyrex `_ είναι μεταγλωττιστές " +#~ "που δέχονται ελαφρώς τροποποιημένη μορφή της Python και δημιουργούν τον " +#~ "αντίστοιχο C κώδικα. Το Cython και το Pyrex καθιστούν δυνατή τη σύνταξη " +#~ "μιας επέκτασης χωρίς να χρειάζεται να μάθετε το C API της Python." + +#~ msgid "" +#~ "If you need to interface to some C or C++ library for which no Python " +#~ "extension currently exists, you can try wrapping the library's data types " +#~ "and functions with a tool such as `SWIG `_. `SIP " +#~ "`__, `CXX `_ `Boost `_, or " +#~ "`Weave `_ are also alternatives for " +#~ "wrapping C++ libraries." +#~ msgstr "" +#~ "Εάν χρειάζεται να συνδεθείτε με κάποια βιβλιοθήκη C ή C++ για την οποία " +#~ "δεν υπάρχει αυτήν τη στιγμή επέκταση Python, μπορείτε να δοκιμάσετε να " +#~ "αναδιπλώσετε τους τύπους δεδομένων και τις συναρτήσεις της βιβλιοθήκης με " +#~ "ένα εργαλείο όπως `SWIG `_. `SIP `__, `CXX `_ `Boost " +#~ "`_, ή `Weave `_ είναι επίσης εναλλακτικές λύσεις για την " +#~ "αναδίπλωση βιβλιοθηκών C++." diff --git a/faq/general.po b/faq/general.po index dbc1f74a..a165556d 100644 --- a/faq/general.po +++ b/faq/general.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -187,32 +188,32 @@ msgid "" "packages of interest to you." msgstr "" -#: faq/general.rst:126 +#: faq/general.rst:128 msgid "How does the Python version numbering scheme work?" msgstr "" -#: faq/general.rst:128 +#: faq/general.rst:130 msgid "Python versions are numbered \"A.B.C\" or \"A.B\":" msgstr "" -#: faq/general.rst:130 +#: faq/general.rst:132 msgid "" "*A* is the major version number -- it is only incremented for really major " "changes in the language." msgstr "" -#: faq/general.rst:132 +#: faq/general.rst:134 msgid "" "*B* is the minor version number -- it is incremented for less earth-" "shattering changes." msgstr "" -#: faq/general.rst:134 +#: faq/general.rst:136 msgid "" "*C* is the micro version number -- it is incremented for each bugfix release." msgstr "" -#: faq/general.rst:136 +#: faq/general.rst:138 msgid "" "Not all releases are bugfix releases. In the run-up to a new feature " "release, a series of development releases are made, denoted as alpha, beta, " @@ -223,31 +224,31 @@ msgid "" "changes except as needed to fix critical bugs." msgstr "" -#: faq/general.rst:144 +#: faq/general.rst:146 msgid "Alpha, beta and release candidate versions have an additional suffix:" msgstr "" -#: faq/general.rst:146 +#: faq/general.rst:148 msgid "The suffix for an alpha version is \"aN\" for some small number *N*." msgstr "" -#: faq/general.rst:147 +#: faq/general.rst:149 msgid "The suffix for a beta version is \"bN\" for some small number *N*." msgstr "" -#: faq/general.rst:148 +#: faq/general.rst:150 msgid "" "The suffix for a release candidate version is \"rcN\" for some small number " "*N*." msgstr "" -#: faq/general.rst:150 +#: faq/general.rst:152 msgid "" "In other words, all versions labeled *2.0aN* precede the versions labeled " "*2.0bN*, which precede versions labeled *2.0rcN*, and *those* precede 2.0." msgstr "" -#: faq/general.rst:153 +#: faq/general.rst:155 msgid "" "You may also find version numbers with a \"+\" suffix, e.g. \"2.2+\". These " "are unreleased versions, built directly from the CPython development " @@ -256,7 +257,7 @@ msgid "" "e.g. \"2.4a0\"." msgstr "" -#: faq/general.rst:158 +#: faq/general.rst:160 msgid "" "See the `Developer's Guide `__ for more information about the development cycle, " @@ -265,18 +266,18 @@ msgid "" "and :data:`sys.version_info`." msgstr "" -#: faq/general.rst:167 +#: faq/general.rst:169 msgid "How do I obtain a copy of the Python source?" msgstr "" -#: faq/general.rst:169 +#: faq/general.rst:171 msgid "" "The latest Python source distribution is always available from python.org, " "at https://www.python.org/downloads/. The latest development sources can be " "obtained at https://github.com/python/cpython/." msgstr "" -#: faq/general.rst:173 +#: faq/general.rst:175 msgid "" "The source distribution is a gzipped tar file containing the complete C " "source, Sphinx-formatted documentation, Python library modules, example " @@ -284,21 +285,21 @@ msgid "" "source will compile and run out of the box on most UNIX platforms." msgstr "" -#: faq/general.rst:178 +#: faq/general.rst:180 msgid "" "Consult the `Getting Started section of the Python Developer's Guide " "`__ for more information on getting the " "source code and compiling it." msgstr "" -#: faq/general.rst:184 +#: faq/general.rst:186 msgid "How do I get documentation on Python?" msgstr "" #: faq/general.rst:188 msgid "" "The standard documentation for the current stable version of Python is " -"available at https://docs.python.org/3/. PDF, plain text, and downloadable " +"available at https://docs.python.org/3/. EPUB, plain text, and downloadable " "HTML versions are also available at https://docs.python.org/3/download.html." msgstr "" @@ -486,40 +487,39 @@ msgstr "" #: faq/general.rst:311 msgid "" "The latest stable releases can always be found on the `Python download page " -"`_. There are two production-ready " -"versions of Python: 2.x and 3.x. The recommended version is 3.x, which is " -"supported by most widely used libraries. Although 2.x is still widely used, " -"`it is not maintained anymore `_." +"`_. Python 3.x is the recommended version " +"and supported by most widely used libraries. Python 2.x :pep:`is not " +"maintained anymore <373>`." msgstr "" -#: faq/general.rst:318 +#: faq/general.rst:317 msgid "How many people are using Python?" msgstr "" -#: faq/general.rst:320 +#: faq/general.rst:319 msgid "" "There are probably millions of users, though it's difficult to obtain an " "exact count." msgstr "" -#: faq/general.rst:323 +#: faq/general.rst:322 msgid "" "Python is available for free download, so there are no sales figures, and " "it's available from many different sites and packaged with many Linux " "distributions, so download statistics don't tell the whole story either." msgstr "" -#: faq/general.rst:327 +#: faq/general.rst:326 msgid "" "The comp.lang.python newsgroup is very active, but not all Python users post " "to the group or even read it." msgstr "" -#: faq/general.rst:332 +#: faq/general.rst:331 msgid "Have any significant projects been done in Python?" msgstr "" -#: faq/general.rst:334 +#: faq/general.rst:333 msgid "" "See https://www.python.org/about/success for a list of projects that use " "Python. Consulting the proceedings for `past Python conferences `_ and `the Zope application server `_." msgstr "" -#: faq/general.rst:361 +#: faq/general.rst:360 msgid "Is it reasonable to propose incompatible changes to Python?" msgstr "" -#: faq/general.rst:363 +#: faq/general.rst:362 msgid "" "In general, no. There are already millions of lines of Python code around " "the world, so any change in the language that invalidates more than a very " @@ -570,22 +570,22 @@ msgid "" "to invalidate them all at a single stroke." msgstr "" -#: faq/general.rst:370 +#: faq/general.rst:369 msgid "" "Providing a gradual upgrade path is necessary if a feature has to be " "changed. :pep:`5` describes the procedure followed for introducing backward-" "incompatible changes while minimizing disruption for users." msgstr "" -#: faq/general.rst:376 +#: faq/general.rst:375 msgid "Is Python a good language for beginning programmers?" msgstr "" -#: faq/general.rst:378 +#: faq/general.rst:377 msgid "Yes." msgstr "" -#: faq/general.rst:380 +#: faq/general.rst:379 msgid "" "It is still common to start students with a procedural and statically typed " "language such as Pascal, C, or a subset of C++ or Java. Students may be " @@ -598,7 +598,7 @@ msgid "" "with user-defined objects in their very first course." msgstr "" -#: faq/general.rst:390 +#: faq/general.rst:389 msgid "" "For a student who has never programmed before, using a statically typed " "language seems unnatural. It presents additional complexity that the " @@ -610,7 +610,7 @@ msgid "" "course." msgstr "" -#: faq/general.rst:398 +#: faq/general.rst:397 msgid "" "Many other aspects of Python make it a good first language. Like Java, " "Python has a large standard library so that students can be assigned " @@ -623,7 +623,7 @@ msgid "" "helpful in extending the students' reach." msgstr "" -#: faq/general.rst:407 +#: faq/general.rst:406 msgid "" "Python's interactive interpreter enables students to test language features " "while they're programming. They can keep a window with the interpreter " @@ -631,13 +631,41 @@ msgid "" "can't remember the methods for a list, they can do something like this::" msgstr "" -#: faq/general.rst:436 +#: faq/general.rst:411 +msgid "" +">>> L = []\n" +">>> dir(L)\n" +"['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',\n" +"'__dir__', '__doc__', '__eq__', '__format__', '__ge__',\n" +"'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',\n" +"'__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__',\n" +"'__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',\n" +"'__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__',\n" +"'__sizeof__', '__str__', '__subclasshook__', 'append', 'clear',\n" +"'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove',\n" +"'reverse', 'sort']\n" +">>> [d for d in dir(L) if '__' not in d]\n" +"['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', " +"'remove', 'reverse', 'sort']\n" +"\n" +">>> help(L.append)\n" +"Help on built-in function append:\n" +"\n" +"append(...)\n" +" L.append(object) -> None -- append object to end\n" +"\n" +">>> L.append(1)\n" +">>> L\n" +"[1]" +msgstr "" + +#: faq/general.rst:435 msgid "" "With the interpreter, documentation is never far from the student as they " "are programming." msgstr "" -#: faq/general.rst:439 +#: faq/general.rst:438 msgid "" "There are also good IDEs for Python. IDLE is a cross-platform IDE for " "Python that is written in Python using Tkinter. Emacs users will be happy to " @@ -648,7 +676,7 @@ msgid "" "Python editing environments." msgstr "" -#: faq/general.rst:447 +#: faq/general.rst:446 msgid "" "If you want to discuss Python's use in education, you may be interested in " "joining `the edu-sig mailing list \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -75,24 +76,15 @@ msgstr "" #: faq/gui.rst:49 msgid "" -"To get truly stand-alone applications, the Tcl scripts that form the library " -"have to be integrated into the application as well. One tool supporting that " -"is SAM (stand-alone modules), which is part of the Tix distribution (https://" -"tix.sourceforge.net/)." +"Various third-party freeze libraries such as py2exe and cx_Freeze have " +"handling for Tkinter applications built-in." msgstr "" #: faq/gui.rst:54 -msgid "" -"Build Tix with SAM enabled, perform the appropriate call to :c:func:`!" -"Tclsam_init`, etc. inside Python's :file:`Modules/tkappinit.c`, and link " -"with libtclsam and libtksam (you might include the Tix libraries as well)." -msgstr "" - -#: faq/gui.rst:61 msgid "Can I have Tk events handled while waiting for I/O?" msgstr "" -#: faq/gui.rst:63 +#: faq/gui.rst:56 msgid "" "On platforms other than Windows, yes, and you don't even need threads! But " "you'll have to restructure your I/O code a bit. Tk has the equivalent of " @@ -101,18 +93,18 @@ msgid "" "file descriptor. See :ref:`tkinter-file-handlers`." msgstr "" -#: faq/gui.rst:71 +#: faq/gui.rst:64 msgid "I can't get key bindings to work in Tkinter: why?" msgstr "" -#: faq/gui.rst:73 +#: faq/gui.rst:66 msgid "" "An often-heard complaint is that event handlers :ref:`bound ` to events with the :meth:`!bind` method don't get handled even when " "the appropriate key is pressed." msgstr "" -#: faq/gui.rst:77 +#: faq/gui.rst:70 msgid "" "The most common cause is that the widget to which the binding applies " "doesn't have \"keyboard focus\". Check out the Tk documentation for the " diff --git a/faq/index.po b/faq/index.po index 47e901c1..2d30b089 100644 --- a/faq/index.po +++ b/faq/index.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-05-02 12:51+0000\n" "Last-Translator: Dimitrios Papadopoulos\n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/faq/installed.po b/faq/installed.po index 4bd6300b..dc79898c 100644 --- a/faq/installed.po +++ b/faq/installed.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-05-06 12:51+0000\n" "Last-Translator: Dimitrios Papadopoulos\n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -128,7 +129,7 @@ msgstr "" "Αν η Python εγκαταστάθηκε από μια εφαρμογή τρίτου μέρους, μπορείτε επίσης να " "την αφαιρέσετε, αλλά η εφαρμογή αυτή δεν θα λειτουργεί πλέον. Θα πρέπει να " "χρησιμοποιήσετε το πρόγραμμα απεγκατάστασης αυτής της εφαρμογής αντί να " -"αφαιρέσετε απευθείας την Python. " +"αφαιρέσετε απευθείας την Python." #: faq/installed.rst:49 msgid "" diff --git a/faq/library.po b/faq/library.po index dacd26ff..19610b14 100644 --- a/faq/library.po +++ b/faq/library.po @@ -8,29 +8,31 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Panagiotis Skias \n" +"Language-Team: PyGreece \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: faq/library.rst:5 msgid "Library and Extension FAQ" -msgstr "" +msgstr "Συχνές ερωτήσεις βιβλιοθήκης και επέκτασης" #: faq/library.rst:8 msgid "Contents" -msgstr "" +msgstr "Περιεχόμενα" #: faq/library.rst:12 msgid "General Library Questions" -msgstr "" +msgstr "Γενικές Ερωτήσεις Βιβλιοθήκης" #: faq/library.rst:15 msgid "How do I find a module or application to perform task X?" msgstr "" +"Πως μπορώ να βρω ένα module ή μια εφαρμογή για να εκτελέσω την εργασία Χ;" #: faq/library.rst:17 msgid "" @@ -38,6 +40,9 @@ msgid "" "relevant standard library module. (Eventually you'll learn what's in the " "standard library and will be able to skip this step.)" msgstr "" +"Ελέγξτε την :ref:`the Library Reference ` για να δείτε αν " +"υπάρχει ένα σχετικό τυπικό module. (Τελικά θα μάθετε τι υπάρχει στην τυπική " +"βιβλιοθήκη και θα μπορείτε να παραλείψετε αυτό το βήμα.)" #: faq/library.rst:21 msgid "" @@ -46,10 +51,15 @@ msgid "" "engine. Searching for \"Python\" plus a keyword or two for your topic of " "interest will usually find something helpful." msgstr "" +"Για πακέτα τρίτων, πραγματοποιήστε αναζήτηση στο `Python Package Index " +"`_ ή δοκιμάστε στο `Google `_ ή σε " +"κάποια άλλη μηχανή αναζήτησης ιστού. Η αναζήτηση με τον όρο \"Python\" μαζί " +"με μια ή δύο λέξεις κλειδιά για το θέμα που σας ενδιαφέρει συνήθως θα βγάλει " +"κάποιο χρήσιμο αποτέλεσμα." #: faq/library.rst:28 msgid "Where is the math.py (socket.py, regex.py, etc.) source file?" -msgstr "" +msgstr "Που βρίσκεται το πηγαίο αρχείο math.py (socket.py, regex.py, κ.λπ.);" #: faq/library.rst:30 msgid "" @@ -59,29 +69,46 @@ msgid "" "file:`mathmodule.c`, somewhere in a C source directory (not on the Python " "Path)." msgstr "" +"Εάν δεν μπορείτε να βρείτε ένα πηγαίο αρχείο για ένα module, μπορεί να είναι " +"ένα ενσωματωμένο (built-in) module ή ένα module που φορτώνεται δυναμικά " +"υλοποιημένο σε C, C++ ή άλλη μεταγλωττισμένη γλώσσα. Σε αυτή την περίπτωση " +"μπορεί να μην έχετε το αρχείο προέλευσης ή μπορεί να είναι κάτι σαν :file:" +"`mathmodule.c`, κάπου σε έναν κατάλογο προέλευσης C (όχι στην διαδρομή της " +"Python)." #: faq/library.rst:35 msgid "There are (at least) three kinds of modules in Python:" -msgstr "" +msgstr "Υπάρχουν (το λιγότερο) τριών ειδών modules στην Python:" #: faq/library.rst:37 msgid "modules written in Python (.py);" -msgstr "" +msgstr "modules γραμμένα σε Python (.py):" #: faq/library.rst:38 msgid "" "modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, etc);" msgstr "" +"modules γραμμένα σε C και φορτώνονται δυναμικά (.dll, .pyd, .so, .sl, κ.λπ.):" #: faq/library.rst:39 msgid "" "modules written in C and linked with the interpreter; to get a list of " "these, type::" msgstr "" +"modules γραμμένα σε C και συνδεδεμένα με τον διερμηνέα: για να λάβετε μια " +"λίστα από αυτά, πληκτρολογήστε::" + +#: faq/library.rst:42 +msgid "" +"import sys\n" +"print(sys.builtin_module_names)" +msgstr "" +"import sys\n" +"print(sys.builtin_module_names)" #: faq/library.rst:47 msgid "How do I make a Python script executable on Unix?" -msgstr "" +msgstr "Πως δημιουργώ ένα εκτελέσιμο Python script στο Unix;" #: faq/library.rst:49 msgid "" @@ -89,24 +116,37 @@ msgid "" "first line must begin with ``#!`` followed by the path of the Python " "interpreter." msgstr "" +"Θα πρέπει να κάνετε δύο πράγματα: η λειτουργία του script αρχείου πρέπει να " +"είναι εκτελέσιμη και η πρώτη γραμμή θα πρέπει αν ξεκινά με ``#!`` " +"ακολουθούμενη από τη διαδρομή του διερμηνέα της Python." #: faq/library.rst:53 msgid "" "The first is done by executing ``chmod +x scriptfile`` or perhaps ``chmod " "755 scriptfile``." msgstr "" +"Το πρώτο γίνεται με την εκτέλεση του ``chmod +x scriptfile`` ή ίσως ``chmod " +"755 scriptfile``." #: faq/library.rst:56 msgid "" "The second can be done in a number of ways. The most straightforward way is " "to write ::" msgstr "" +"Το δεύτερο μπορεί να γίνει με ποικίλους τρόπους. Ο πιο απλός τρόπος είναι " +"να γράψετε ::" + +#: faq/library.rst:59 +msgid "#!/usr/local/bin/python" +msgstr "#!/usr/local/bin/python" #: faq/library.rst:61 msgid "" "as the very first line of your file, using the pathname for where the Python " "interpreter is installed on your platform." msgstr "" +"ως η πρώτη γραμμή του αρχείου σας, χρησιμοποιώντας το pathname για το πού " +"είναι εγκατεστημένος ο διερμηνέας Python στην πλατφόρμα σας." #: faq/library.rst:64 msgid "" @@ -115,6 +155,14 @@ msgid "" "variants support the following, assuming the Python interpreter is in a " "directory on the user's :envvar:`PATH`::" msgstr "" +"Εάν θέλετε το script να είναι ανεξάρτητο, από το που ζει ο διερμηνέας της " +"Python, μπορείτε να χρησιμοποιήσετε το πρόγραμμα :program:`env`. Σχεδόν " +"όλες οι παραλλαγές Unix υποστηρίζουν τα ακόλουθα, υποθέτοντας ότι ο " +"διερμηνέας Python βρίσκεται σε έναν κατάλογο στο :envvar:`PATH` του χρήστη::" + +#: faq/library.rst:69 +msgid "#!/usr/bin/env python" +msgstr "#!/usr/bin/env python" #: faq/library.rst:71 msgid "" @@ -122,6 +170,9 @@ msgid "" "scripts is often very minimal, so you need to use the actual absolute " "pathname of the interpreter." msgstr "" +"*Μην* το κάνετε αυτό για CGI scripts. Η μεταβλητή :envvar:`PATH` για τα CGI " +"scripts είναι συχνά πολύ ελάχιστη, επομένως πρέπει να χρησιμοποιήσετε το " +"πραγματικό απόλυτο όνομα διαδρομής του διερμηνέα." #: faq/library.rst:75 msgid "" @@ -129,16 +180,38 @@ msgid "" "env` program fails; or there's no env program at all. In that case, you can " "try the following hack (due to Alex Rezinsky):" msgstr "" +"Περιστασιακά, το περιβάλλον ενός χρήστη είναι τόσο γεμάτο που το πρόγραμμα :" +"program:`/usr/bin/env` αποτυγχάνει ή δεν υπάρχει καθόλου πρόγραμμα env. Σε " +"αυτήν την περίπτωση, μπορείτε να δοκιμάσετε το ακόλουθο hack (λόγω του Alex " +"Rezinsky):" + +#: faq/library.rst:79 +msgid "" +"#! /bin/sh\n" +"\"\"\":\"\n" +"exec python $0 ${1+\"$@\"}\n" +"\"\"\"" +msgstr "" +"#! /bin/sh\n" +"\"\"\":\"\n" +"exec python $0 ${1+\"$@\"}\n" +"\"\"\"" #: faq/library.rst:86 msgid "" "The minor disadvantage is that this defines the script's __doc__ string. " "However, you can fix that by adding ::" msgstr "" +"Το, ελάχιστης σημασίας, μειονέκτημα είναι ότι αυτό καθορίζει τη συμβολοσειρά " +"__doc__ του script. Ωστόσο, μπορείτε να το διορθώσετε προσθέτοντας ::" + +#: faq/library.rst:89 +msgid "__doc__ = \"\"\"...Whatever...\"\"\"" +msgstr "__doc__ = \"\"\"...Οτιδήποτε...\"\"\"" #: faq/library.rst:94 msgid "Is there a curses/termcap package for Python?" -msgstr "" +msgstr "Υπάρχει ένα curses/termcap πακέτο για την Python;" #: faq/library.rst:98 msgid "" @@ -147,6 +220,10 @@ msgid "" "compiled by default. (Note that this is not available in the Windows " "distribution -- there is no curses module for Windows.)" msgstr "" +"Για παραλλαγές Unix: Η τυπική διανομή του πηγαίου της Python συνοδεύεται από " +"ένα curses module στον υποκατάλογο :source:`Modules`, αν και δεν έχει " +"μεταγλωττιστεί από προεπιλογή. (Λάβετε υπόψη ότι αυτό δεν είναι διαθέσιμο " +"στη διανομή των Windows -- δεν υπάρχει curses module για Windows.)" #: faq/library.rst:103 msgid "" @@ -157,38 +234,60 @@ msgid "" "but there don't seem to be any currently maintained OSes that fall into this " "category." msgstr "" +"Το module :mod:`curses` υποστηρίζει βασικές curses λειτουργίες καθώς και " +"πολλές πρόσθετες λειτουργίες από ncurses και SYSV curses, όπως χρώμα, " +"υποστήριξη εναλλακτικού συνόλου χαρακτήρων, pads και υποστήριξη ποντικιού. " +"Αυτό σημαίνει ότι το module δεν είναι συμβατό με λειτουργικά συστήματα που " +"έχουνε μόνο BSD curses, αλλά δεν φαίνεται να υπάρχουν επί του παρόντος " +"διατηρημένα λειτουργικά συστήματα που να εμπίπτουν σε αυτήν την κατηγορία." #: faq/library.rst:111 msgid "Is there an equivalent to C's onexit() in Python?" -msgstr "" +msgstr "Υπάρχει κάτι ισοδύναμο με την onexit() της C στην Python;" #: faq/library.rst:113 msgid "" "The :mod:`atexit` module provides a register function that is similar to " "C's :c:func:`!onexit`." msgstr "" +"Το module :mod:`atexit` παρέχει μια συνάρτηση καταχωρητή παρόμοια με τη " +"συνάρτηση :c:func:`!onexit` της C." #: faq/library.rst:118 msgid "Why don't my signal handlers work?" -msgstr "" +msgstr "Γιατί δεν λειτουργούν οι χειριστές σήματος μου;" #: faq/library.rst:120 msgid "" "The most common problem is that the signal handler is declared with the " "wrong argument list. It is called as ::" msgstr "" +"Το πιο συνηθισμένο πρόβλημα είναι ότι ο χειριστής σήματος δηλώνεται με λάθος " +"λίστα ορισμάτων. Ονομάζεται ως ::" + +#: faq/library.rst:123 +msgid "handler(signum, frame)" +msgstr "handler(signum, frame)" #: faq/library.rst:125 msgid "so it should be declared with two parameters::" +msgstr "οπότε θα πρέπει να δηλωθεί με δύο παραμέτρους::" + +#: faq/library.rst:127 +msgid "" +"def handler(signum, frame):\n" +" ..." msgstr "" +"def handler(signum, frame):\n" +" ..." #: faq/library.rst:132 msgid "Common tasks" -msgstr "" +msgstr "Κοινές εργασίες" #: faq/library.rst:135 msgid "How do I test a Python program or component?" -msgstr "" +msgstr "Πως μπορώ να τεστάρω ένα Python πρόγραμμα ή ένα Python component;" #: faq/library.rst:137 msgid "" @@ -196,12 +295,17 @@ msgid "" "examples in the docstrings for a module and runs them, comparing the output " "with the expected output given in the docstring." msgstr "" +"Η Python συνοδεύεται από δύο frameworks για τεστ. To module :mod:`doctest` " +"βρίσκει παραδείγματα στα docstrings για ένα module και τα εκτελεί, " +"συγκρίνοντας την έξοδο με την αναμενόμενη έξοδο που δίνεται στο docstring." #: faq/library.rst:141 msgid "" "The :mod:`unittest` module is a fancier testing framework modelled on Java " "and Smalltalk testing frameworks." msgstr "" +"Το module :mod:`unittest` είναι ένα πιο εντυπωσιακό framework που έχει " +"σχεδιαστεί με βάση τα frameworks για τεστ της Java και του Smalltalk." #: faq/library.rst:144 msgid "" @@ -213,14 +317,32 @@ msgid "" "avoid depending on mutating global variables, since this makes testing much " "more difficult to do." msgstr "" +"Για να κάνετε τα τεστ σας ευκολότερα θα πρέπει να χρησιμοποιείτε μια καλή " +"αρθρωτή σχεδίαση στο πρόγραμμα σας. Το πρόγραμμα σας θα πρέπει να έχει όλες " +"σχεδόν τις λειτουργίες ενσωματωμένες είτε σε συναρτήσεις είτε σε μεθόδους " +"κλάσης - και αυτό μερικές φορές έχει το εκπληκτικό και ευχάριστο αποτέλεσμα " +"να κάνει το πρόγραμμα να τρέχει πιο γρήγορα (γιατί οι τοπικές προσβάσεις " +"μεταβλητών είναι πιο γρήγορες από τις καθολικές προσβάσεις). Επιπλέον, το " +"πρόγραμμα θα πρέπει να αποφεύγει την εξάρτηση από μεταλλάξεις παγκόσμιων " +"μεταβλητών, καθώς αυτό κάνει τη δοκιμή πολύ πιο δύσκολη." #: faq/library.rst:152 msgid "The \"global main logic\" of your program may be as simple as ::" msgstr "" +"Η \"παγκόσμια κύρια λογική\" του προγράμματος σας μπορεί να είναι τόσο απλή " +"όσο ::" + +#: faq/library.rst:154 +msgid "" +"if __name__ == \"__main__\":\n" +" main_logic()" +msgstr "" +"if __name__ == \"__main__\":\n" +" main_logic()" #: faq/library.rst:157 msgid "at the bottom of the main module of your program." -msgstr "" +msgstr "στο κάτω μέρος του κύριου module του προγράμματος σας." #: faq/library.rst:159 msgid "" @@ -233,12 +355,32 @@ msgid "" "the \"production code\", since this makes it easy to find bugs and even " "design flaws earlier." msgstr "" +"Από τη στιγμή που το πρόγραμμα σας οργανωθεί ως μια συλλογή από συναρτήσεις " +"και κλάσεις που υλοποιούν μια διαδικασία, θα πρέπει να γράψετε τεστ " +"συναρτήσεις που εκτελούν τις αντίστοιχες διαδικασίες. Μια τεστ σουίτα που " +"αυτοματοποιεί μια ακολουθία από tests μπορεί να συσχετιστεί με κάθε module. " +"Αυτό ακούγεται σαν πολλή δουλειά, αλλά επειδή η Python είναι τόσο σύντομη " +"και ευέλικτη, αυτό είναι εκπληκτικά εύκολο. Μπορείτε να κάνετε την συγγραφή " +"κώδικα πολύ πιο ευχάριστη και διασκεδαστική γράφοντας τις δοκιμαστικές " +"συναρτήσεις σας παράλληλα με τον \"κώδικα παραγωγής\", καθώς αυτό " +"διευκολύνει την εύρεση σφαλμάτων και ακόμη και ελαττώματα σχεδιασμού " +"νωρίτερα." #: faq/library.rst:167 msgid "" "\"Support modules\" that are not intended to be the main module of a program " "may include a self-test of the module. ::" msgstr "" +"\"Modules υποστήριξης\" που δεν προορίζονται να είναι το κύριο module ενός " +"προγράμματος μπορεί να περιλαμβάνουν αυτοέλεγχο της ενότητας::" + +#: faq/library.rst:170 +msgid "" +"if __name__ == \"__main__\":\n" +" self_test()" +msgstr "" +"if __name__ == \"__main__\":\n" +" self_test()" #: faq/library.rst:173 msgid "" @@ -246,10 +388,13 @@ msgid "" "when the external interfaces are unavailable by using \"fake\" interfaces " "implemented in Python." msgstr "" +"Ακόμη και προγράμματα που αλληλεπιδρούν με πολύπλοκες εξωτερικές διεπαφές " +"μπορούν να δοκιμαστούν όταν οι εξωτερικές διεπαφές δεν είναι διαθέσιμες " +"χρησιμοποιώντας \"τεχνητές\" διεπαφές υλοποιημένες στην Python." #: faq/library.rst:179 msgid "How do I create documentation from doc strings?" -msgstr "" +msgstr "Πως δημιουργώ τεκμηρίωση από doc strings;" #: faq/library.rst:181 msgid "" @@ -258,24 +403,32 @@ msgid "" "docstrings is `epydoc `_. `Sphinx `_ can also include docstring content." msgstr "" +"Το module :mod:`pydoc` μπορεί να δημιουργήσει HTML από τα doc strings στον " +"πηγαίο κώδικα Python σας. Μια εναλλακτική λύση για τη δημιουργία μιας " +"τεκμηρίωσης API αποκλειστικά με docstrings είναι το `epydoc `_. `Sphinx `_ μπορεί επίσης " +"να περιλαμβάνει docstring περιεχόμενο." #: faq/library.rst:188 msgid "How do I get a single keypress at a time?" -msgstr "" +msgstr "Πως μπορώ να λάβω μόνο ένα πάτημα κουμπιού κάθε φορά;" #: faq/library.rst:190 msgid "" "For Unix variants there are several solutions. It's straightforward to do " "this using curses, but curses is a fairly large module to learn." msgstr "" +"Για τις παραλλαγές του Unix υπάρχουν πολλές λύσεις. Είναι απλό να κάνετε " +"αυτό χρησιμοποιώντας curses, αλλά τα curses είναι ένα αρκετά μεγάλο module " +"για εκμάθηση." #: faq/library.rst:234 msgid "Threads" -msgstr "" +msgstr "Νήματα (Threads)" #: faq/library.rst:237 msgid "How do I program using threads?" -msgstr "" +msgstr "Πώς μπορώ να προγραμματίσω χρησιμοποιώντας νήματα(threads);" #: faq/library.rst:239 msgid "" @@ -283,22 +436,57 @@ msgid "" "module. The :mod:`threading` module builds convenient abstractions on top of " "the low-level primitives provided by the :mod:`_thread` module." msgstr "" +"Βεβαιωθείτε ότι χρησιμοποιείτε το module :mod:`threading` και όχι το module :" +"mod:`_thread`. Το module :mod:`threading` παρέχει ένα πιο βολικό και υψηλού " +"επιπέδου τρόπο διαχείρισης νημάτων, χτίζοντας πάνω στις βασικές λειτουργίες " +"του module :mod:`_thread`." #: faq/library.rst:245 msgid "None of my threads seem to run: why?" -msgstr "" +msgstr "Κανένα από τα νήματα (threads) μου δεν φαίνεται να εκτελείται: γιατί;" #: faq/library.rst:247 msgid "" "As soon as the main thread exits, all threads are killed. Your main thread " "is running too quickly, giving the threads no time to do any work." msgstr "" +"Μόλις γίνει έξοδος από το κύριο νήμα, τερματίζονται όλα τα νήματα. Το κύριο " +"νήμα τρέχει πολύ γρήγορα, χωρίς να δίνεται χρόνος στα νήματα να κάνουν " +"οποιαδήποτε εργασία." #: faq/library.rst:250 msgid "" "A simple fix is to add a sleep to the end of the program that's long enough " "for all the threads to finish::" msgstr "" +"Μια απλή λύση είναι να προσθέσετε ένα sleep στο τέλος που προγράμματος που " +"είναι αρκετό για να τερματιστούν όλα τα νήματα::" + +#: faq/library.rst:253 +msgid "" +"import threading, time\n" +"\n" +"def thread_task(name, n):\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10) # <---------------------------!" +msgstr "" +"import threading, time\n" +"\n" +"def thread_task(name, n):\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10) # <---------------------------!" #: faq/library.rst:265 msgid "" @@ -306,10 +494,40 @@ msgid "" "run sequentially, one at a time! The reason is that the OS thread scheduler " "doesn't start a new thread until the previous thread is blocked." msgstr "" +"Αλλά τώρα (σε πολλές πλατφόρμες) τα νήματα δεν εκτελούνται παράλληλα, αλλά " +"φαίνεται να εκτελούνται διαδοχικά, ένα κάθε φορά! Ο λόγος είναι ότι ο " +"προγραμματιστής νημάτων του λειτουργικού συστήματος δεν ξεκινά ένα νέο νήμα " +"μέχρι να αποκλειστεί το προηγούμενο νήμα." #: faq/library.rst:269 msgid "A simple fix is to add a tiny sleep to the start of the run function::" msgstr "" +"Μια απλή λύση είναι να προσθέσετε ένα μικρό sleep στην αρχή της λειτουργίας " +"εκτέλεσης::" + +#: faq/library.rst:271 +msgid "" +"def thread_task(name, n):\n" +" time.sleep(0.001) # <--------------------!\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10)" +msgstr "" +"def thread_task(name, n):\n" +" time.sleep(0.001) # <--------------------!\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10)" #: faq/library.rst:282 msgid "" @@ -319,16 +537,26 @@ msgid "" "the queue when it finishes, and let the main thread read as many tokens from " "the queue as there are threads." msgstr "" +"Αντί να προσπαθείτε να μαντέψετε μια καλή τιμή καθυστέρησης για την :func:" +"`time.sleep`, είναι καλύτερα να χρησιμοποιείτε κάποιο είδος μηχανισμού " +"σηματοφόρου. Μια ιδέα είναι να χρησιμοποιήσετε το module :mod:`queue` για " +"να δημιουργήσετε ένα αντικείμενο ουράς, αφήνοντας το κάθε νήμα να προσθέτει " +"ένα token στην ουρά όταν ολοκληρωθεί, και να αφήνει στο κύριο νήμα να " +"διαβάσει τόσα tokens από την ουρά όσα είναι και τα νήματα." #: faq/library.rst:290 msgid "How do I parcel out work among a bunch of worker threads?" msgstr "" +"Πως μπορώ να μοιράσω την εργασία σε ένα σωρό από νήματα για αυτήν την " +"εργασία;" #: faq/library.rst:292 msgid "" "The easiest way is to use the :mod:`concurrent.futures` module, especially " "the :mod:`~concurrent.futures.ThreadPoolExecutor` class." msgstr "" +"Ο πιο εύκολος τρόπος είναι να χρησιμοποιήσετε το module :mod:`concurrent." +"futures`, ειδικά την κλάση :mod:`~concurrent.futures.ThreadPoolExecutor`." #: faq/library.rst:295 msgid "" @@ -339,24 +567,137 @@ msgid "" "``.get()`` method to return them. The class will take care of the locking " "necessary to ensure that each job is handed out exactly once." msgstr "" +"Ή, ένα θέλετε καλό έλεγχο στον αλγόριθμο αποστολής, μπορείτε να γράψετε τη " +"δική σας λογική με μη αυτόματο τρόπο. Χρησιμοποιήστε το module :mod:`queue` " +"για να δημιουργήσετε μια ουρά που περιέχει μια λίστα εργασιών. Η κλάση :" +"class:`~queue.Queue` διατηρεί μια λίστα αντικειμένων και έχει μια μέθοδο ``." +"put(obj)`` που προσθέτει στοιχεία στην ουρά και μια μέθοδο ``.get()`` για " +"επιστροφή. Η κλάση θα φροντίσει για το κλείδωμα που είναι απαραίτητο για να " +"διασφαλίσει ότι κάθε εργασία θα παραδοθεί ακριβώς μία φορά." #: faq/library.rst:302 msgid "Here's a trivial example::" -msgstr "" +msgstr "Ένα απλό παράδειγμα::" + +#: faq/library.rst:304 +msgid "" +"import threading, queue, time\n" +"\n" +"# The worker thread gets jobs off the queue. When the queue is empty, it\n" +"# assumes there will be no more work and exits.\n" +"# (Realistically workers will run until terminated.)\n" +"def worker():\n" +" print('Running worker')\n" +" time.sleep(0.1)\n" +" while True:\n" +" try:\n" +" arg = q.get(block=False)\n" +" except queue.Empty:\n" +" print('Worker', threading.current_thread(), end=' ')\n" +" print('queue empty')\n" +" break\n" +" else:\n" +" print('Worker', threading.current_thread(), end=' ')\n" +" print('running with argument', arg)\n" +" time.sleep(0.5)\n" +"\n" +"# Create queue\n" +"q = queue.Queue()\n" +"\n" +"# Start a pool of 5 workers\n" +"for i in range(5):\n" +" t = threading.Thread(target=worker, name='worker %i' % (i+1))\n" +" t.start()\n" +"\n" +"# Begin adding work to the queue\n" +"for i in range(50):\n" +" q.put(i)\n" +"\n" +"# Give threads time to run\n" +"print('Main thread sleeping')\n" +"time.sleep(5)" +msgstr "" +"import threading, queue, time\n" +"\n" +"# The worker thread gets jobs off the queue. When the queue is empty, it\n" +"# assumes there will be no more work and exits.\n" +"# (Realistically workers will run until terminated.)\n" +"def worker():\n" +" print('Running worker')\n" +" time.sleep(0.1)\n" +" while True:\n" +" try:\n" +" arg = q.get(block=False)\n" +" except queue.Empty:\n" +" print('Worker', threading.current_thread(), end=' ')\n" +" print('queue empty')\n" +" break\n" +" else:\n" +" print('Worker', threading.current_thread(), end=' ')\n" +" print('running with argument', arg)\n" +" time.sleep(0.5)\n" +"\n" +"# Create queue\n" +"q = queue.Queue()\n" +"\n" +"# Start a pool of 5 workers\n" +"for i in range(5):\n" +" t = threading.Thread(target=worker, name='worker %i' % (i+1))\n" +" t.start()\n" +"\n" +"# Begin adding work to the queue\n" +"for i in range(50):\n" +" q.put(i)\n" +"\n" +"# Give threads time to run\n" +"print('Main thread sleeping')\n" +"time.sleep(5)" #: faq/library.rst:340 msgid "When run, this will produce the following output:" -msgstr "" +msgstr "Κατά την εκτέλεση, αυτό θα παράγει την ακόλουθη έξοδο:" + +#: faq/library.rst:342 +msgid "" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Main thread sleeping\n" +"Worker running with argument 0\n" +"Worker running with argument 1\n" +"Worker running with argument 2\n" +"Worker running with argument 3\n" +"Worker running with argument 4\n" +"Worker running with argument 5\n" +"..." +msgstr "" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Main thread sleeping\n" +"Worker running with argument 0\n" +"Worker running with argument 1\n" +"Worker running with argument 2\n" +"Worker running with argument 3\n" +"Worker running with argument 4\n" +"Worker running with argument 5\n" +"..." #: faq/library.rst:358 msgid "" "Consult the module's documentation for more details; the :class:`~queue." "Queue` class provides a featureful interface." msgstr "" +"Συμβουλευτείτε την τεκμηρίωση του module για περισσότερες λεπτομέρειες· η " +"κλάση :class:`~queue.Queue` παρέχει μια χαρακτηριστική διεπαφή." #: faq/library.rst:363 msgid "What kinds of global value mutation are thread-safe?" -msgstr "" +msgstr "Ποια είδη global μετάλλαξης τιμής είναι ασφαλή για νήμα(thread);" #: faq/library.rst:365 msgid "" @@ -367,6 +708,13 @@ msgid "" "instruction and therefore all the C implementation code reached from each " "instruction is therefore atomic from the point of view of a Python program." msgstr "" +"Ένα :term:`global interpreter lock` (GIL) χρησιμοποιείται εσωτερικά για να " +"διασφαλιστεί ότι μόνο ένα νήμα εκτελείται στο Python VM κάθε φορά. Γενικά, " +"η Python προσφέρει εναλλαγή μεταξύ νημάτων μόνο μεταξύ εντολών bytecode· το " +"πόσο συχνά γίνεται αυτή η εναλλαγή καθορίζεται από την :func:`sys." +"setswitchinterval`. Κάθε εντολή bytecode και επομένως όλος ο κώδικας " +"υλοποίησης C που φτάνει από κάθε εντολή είναι επομένως ατομικός από την " +"άποψη ενός προγράμματος Python." #: faq/library.rst:372 msgid "" @@ -375,16 +723,61 @@ msgid "" "shared variables of built-in data types (ints, lists, dicts, etc) that " "\"look atomic\" really are." msgstr "" +"Θεωρητικά, αυτό σημαίνει ότι μια ακριβώς λογιστική απαιτεί ακριβή κατανόηση " +"της εφαρμογής bytecode PVM. Στην πράξη, σημαίνει ότι οι λειτουργίες σε " +"κοινόχρηστες μεταβλητές ενσωματωμένων δεδομένων (ακέραιοι, λίστες, λεξικά, κ." +"λπ.) που \"φαίνονται ατομικά\" πραγματικά είναι." #: faq/library.rst:377 msgid "" "For example, the following operations are all atomic (L, L1, L2 are lists, " "D, D1, D2 are dicts, x, y are objects, i, j are ints)::" msgstr "" +"Για παράδειγμα, οι ακόλουθες πράξεις είναι όλες ατομικές (L, L1, L2 είναι " +"λίστες, D, D1, D2 είναι λεξικά, x, y είναι αντικείμενα, i, j είναι " +"ακέραιοι)::" + +#: faq/library.rst:380 +msgid "" +"L.append(x)\n" +"L1.extend(L2)\n" +"x = L[i]\n" +"x = L.pop()\n" +"L1[i:j] = L2\n" +"L.sort()\n" +"x = y\n" +"x.field = y\n" +"D[x] = y\n" +"D1.update(D2)\n" +"D.keys()" +msgstr "" +"L.append(x)\n" +"L1.extend(L2)\n" +"x = L[i]\n" +"x = L.pop()\n" +"L1[i:j] = L2\n" +"L.sort()\n" +"x = y\n" +"x.field = y\n" +"D[x] = y\n" +"D1.update(D2)\n" +"D.keys()" #: faq/library.rst:392 msgid "These aren't::" +msgstr "Αυτά δεν είναι::" + +#: faq/library.rst:394 +msgid "" +"i = i+1\n" +"L.append(L[-1])\n" +"L[i] = L[j]\n" +"D[x] = D[x] + 1" msgstr "" +"i = i+1\n" +"L.append(L[-1])\n" +"L[i] = L[j]\n" +"D[x] = D[x] + 1" #: faq/library.rst:399 msgid "" @@ -393,43 +786,97 @@ msgid "" "can affect things. This is especially true for the mass updates to " "dictionaries and lists. When in doubt, use a mutex!" msgstr "" +"Οι λειτουργίες που αντικαθιστούν άλλα αντικείμενα ενδέχεται να καλέσουν αυτά " +"τα άλλα αντικείμενα της :meth:`~object.__del__` όταν ο αριθμός αναφοράς τους " +"φτάσει στο μηδέν και αυτό μπορεί να επηρεάσει πράγματα. Αυτό ισχύει " +"ιδιαίτερα για τις μαζικές ενημερώσεις σε λεξικά και λίστες. Σε περίπτωση " +"αμφιβολίας, χρησιμοποιήστε ένα mutex!" #: faq/library.rst:406 msgid "Can't we get rid of the Global Interpreter Lock?" -msgstr "" +msgstr "Μπορούμε να απαλλαγούμε από ένα Global Interpreter Lock;" -#: faq/library.rst:410 +#: faq/library.rst:408 msgid "" "The :term:`global interpreter lock` (GIL) is often seen as a hindrance to " "Python's deployment on high-end multiprocessor server machines, because a " "multi-threaded Python program effectively only uses one CPU, due to the " "insistence that (almost) all Python code can only run while the GIL is held." msgstr "" - -#: faq/library.rst:415 -msgid "" -"Back in the days of Python 1.5, Greg Stein actually implemented a " +"Το :term:`global interpreter lock` (GIL) θεωρείται συχνά ως εμπόδιο για την " +"ανάπτυξη της Python σε υψηλής τεχνολογίας μηχανήματα διακομιστών με " +"πολυεπεξεργαστές, επειδή ένα πρόγραμμα Python με πολλά νήματα χρησιμοποιεί " +"αποτελεσματικά μόνο μία CPU, λόγω της επιμονής ότι (σχεδόν) όλος ο κώδικας " +"της Python μπορεί να εκτελεστεί μόνο όσο διατηρείται το GIL." + +#: faq/library.rst:413 +msgid "" +"With the approval of :pep:`703` work is now underway to remove the GIL from " +"the CPython implementation of Python. Initially it will be implemented as " +"an optional compiler flag when building the interpreter, and so separate " +"builds will be available with and without the GIL. Long-term, the hope is " +"to settle on a single build, once the performance implications of removing " +"the GIL are fully understood. Python 3.13 is likely to be the first release " +"containing this work, although it may not be completely functional in this " +"release." +msgstr "" +"Με την έγκριση του :pep:`703` έχει ξεκινήσει η εργασία για την αφαίρεση του " +"GIL από την υλοποίηση CPython της Python. Αρχικά θα υλοποιηθεί ως μια " +"προαιρετική σημαία μεταγλωττιστή κατά την κατασκευή του διερμηνευτή, και " +"έτσι θα είναι διαθέσιμες ξεχωριστές κατασκευές με και χωρίς το GIL. " +"Μακροπρόθεσμα, η ελπίδα είναι να καταλήξουμε σε μια ενιαία κατασκευή, μόλις " +"οι επιπτώσεις στην απόδοση της αφαίρεσης του GIL να γίνουν πλήρως " +"κατανοητές. Η Python 3.13 είναι πιθανό να είναι η πρώτη έκδοση που θα " +"περιέχει αυτήν την εργασία, αν και μπορεί να μην είναι πλήρως λειτουργική σε " +"αυτήν την έκδοση." + +#: faq/library.rst:422 +msgid "" +"The current work to remove the GIL is based on a `fork of Python 3.9 with " +"the GIL removed `_ by Sam Gross. Prior " +"to that, in the days of Python 1.5, Greg Stein actually implemented a " "comprehensive patch set (the \"free threading\" patches) that removed the " -"GIL and replaced it with fine-grained locking. Adam Olsen recently did a " -"similar experiment in his `python-safethread `_ project. Unfortunately, both experiments " -"exhibited a sharp drop in single-thread performance (at least 30% slower), " -"due to the amount of fine-grained locking necessary to compensate for the " -"removal of the GIL." -msgstr "" +"GIL and replaced it with fine-grained locking. Adam Olsen did a similar " +"experiment in his `python-safethread `_ project. Unfortunately, both of these earlier " +"experiments exhibited a sharp drop in single-thread performance (at least " +"30% slower), due to the amount of fine-grained locking necessary to " +"compensate for the removal of the GIL. The Python 3.9 fork is the first " +"attempt at removing the GIL with an acceptable performance impact." +msgstr "" +"Η τρέχουσα εργασία για την αφαίρεση του GIL βασίζεται σε ένα `fork της " +"Python 3.9 με το GIL αφαιρεμένο `_ από " +"τον Sam Gross. Πριν από αυτό, στις ημέρες της Python 1.5, ο Greg Stein " +"υλοποίησε στην πραγματικότητα ένα ολοκληρωμένο σύνολο διορθώσεων (τα \"free " +"threading\" patches) που αφαίρεσαν το GIL και το αντικατέστησαν με λεπτομερή " +"κλείδωμα. Ο Adam Olsen έκανε ένα παρόμοιο πείραμα στο έργο του `python-" +"safethread `_. " +"Δυστυχώς, και τα δύο αυτά προηγούμενα πειράματα παρουσίασαν απότομη πτώση " +"στην απόδοση ενός νήματος (τουλάχιστον 30% πιο αργά), λόγω της ποσότητας " +"λεπτομερούς κλειδώματος που απαιτείται για να αντισταθμιστεί η αφαίρεση του " +"GIL. Το fork της Python 3.9 είναι η πρώτη προσπάθεια αφαίρεσης του GIL με " +"αποδεκτή επίδραση στην απόδοση." -#: faq/library.rst:423 +#: faq/library.rst:437 msgid "" -"This doesn't mean that you can't make good use of Python on multi-CPU " -"machines! You just have to be creative with dividing the work up between " -"multiple *processes* rather than multiple *threads*. The :class:" -"`~concurrent.futures.ProcessPoolExecutor` class in the new :mod:`concurrent." -"futures` module provides an easy way of doing so; the :mod:`multiprocessing` " -"module provides a lower-level API in case you want more control over " -"dispatching of tasks." -msgstr "" +"The presence of the GIL in current Python releases doesn't mean that you " +"can't make good use of Python on multi-CPU machines! You just have to be " +"creative with dividing the work up between multiple *processes* rather than " +"multiple *threads*. The :class:`~concurrent.futures.ProcessPoolExecutor` " +"class in the new :mod:`concurrent.futures` module provides an easy way of " +"doing so; the :mod:`multiprocessing` module provides a lower-level API in " +"case you want more control over dispatching of tasks." +msgstr "" +"Η παρουσία του GIL στις τρέχουσες εκδόσεις της Python δεν σημαίνει ότι δεν " +"μπορείτε να κάνετε καλή χρήση της Python σε μηχανές με πολλαπλές CPU! Απλώς " +"πρέπει να είστε δημιουργικοί με τον διαχωρισμό της εργασίας μεταξύ πολλαπλών " +"*processes* αντί για πολλαπλά *threads*. Η κλάση :class:`~concurrent." +"futures.ProcessPoolExecutor` στο νέο module :mod:`concurrent.futures` " +"παρέχει έναν εύκολο τρόπο για να το κάνετε αυτό· το module :mod:" +"`multiprocessing` παρέχει μια χαμηλότερου επιπέδου API σε περίπτωση που " +"θέλετε περισσότερο έλεγχο στην αποστολή εργασιών." -#: faq/library.rst:431 +#: faq/library.rst:446 msgid "" "Judicious use of C extensions will also help; if you use a C extension to " "perform a time-consuming task, the extension can release the GIL while the " @@ -437,49 +884,52 @@ msgid "" "work done. Some standard library modules such as :mod:`zlib` and :mod:" "`hashlib` already do this." msgstr "" - -#: faq/library.rst:437 -msgid "" -"It has been suggested that the GIL should be a per-interpreter-state lock " -"rather than truly global; interpreters then wouldn't be able to share " -"objects. Unfortunately, this isn't likely to happen either. It would be a " -"tremendous amount of work, because many object implementations currently " -"have global state. For example, small integers and short strings are cached; " -"these caches would have to be moved to the interpreter state. Other object " -"types have their own free list; these free lists would have to be moved to " -"the interpreter state. And so on." -msgstr "" - -#: faq/library.rst:446 -msgid "" -"And I doubt that it can even be done in finite time, because the same " -"problem exists for 3rd party extensions. It is likely that 3rd party " -"extensions are being written at a faster rate than you can convert them to " -"store all their global state in the interpreter state." -msgstr "" - -#: faq/library.rst:451 -msgid "" -"And finally, once you have multiple interpreters not sharing any state, what " -"have you gained over running each interpreter in a separate process?" -msgstr "" - -#: faq/library.rst:456 +"Η συνετή χρήση των επεκτάσεων C βοηθάει επίσης· εάν χρησιμοποιείτε μια " +"επέκταση C για να εκτελέσετε μια χρονοβόρα εργασία, η επέκταση μπορεί να " +"απελευθερώσει το GIL ενώ το νήμα εκτέλεσης βρίσκεται στον κώδικα C και να " +"επιτρέψει σε άλλα νήματα να ολοκληρώσουν κάποια εργασία. Ορισμένα τυπικά " +"module βιβλιοθήκης όπως :mod:`zlib` και :mod:`hashlib` το κάνουν ήδη αυτό." + +#: faq/library.rst:452 +msgid "" +"An alternative approach to reducing the impact of the GIL is to make the GIL " +"a per-interpreter-state lock rather than truly global. This was :ref:`first " +"implemented in Python 3.12 ` and is available in the C " +"API. A Python interface to it is expected in Python 3.13. The main " +"limitation to it at the moment is likely to be 3rd party extension modules, " +"since these must be written with multiple interpreters in mind in order to " +"be usable, so many older extension modules will not be usable." +msgstr "" +"Μια εναλλακτική προσέγγιση για τη μείωση της επίδρασης του GIL είναι να " +"γίνει το GIL ένα κλείδωμα ανά κατάσταση διερμηνευτή αντί για πραγματικά " +"παγκόσμιο. Αυτό :ref:`υλοποιήθηκε πρώτα στην Python 3.12 ` και είναι διαθέσιμο στο C API. Μια διεπαφή Python σε αυτό " +"αναμένεται στην Python 3.13. Ο κύριος περιορισμός προς το παρόν είναι πιθανό " +"να είναι τα 3rd party extension modules, καθώς αυτά πρέπει να γράφονται με " +"πολλαπλούς διερμηνευτές στο μυαλό για να είναι χρησιμοποιήσιμα, οπότε πολλά " +"παλαιότερα extension modules δεν θα είναι χρησιμοποιήσιμα." + +#: faq/library.rst:462 msgid "Input and Output" -msgstr "" +msgstr "Είσοδος και Έξοδος" -#: faq/library.rst:459 +#: faq/library.rst:465 msgid "How do I delete a file? (And other file questions...)" msgstr "" +"Πώς μπορώ να διαγράψω ένα αρχείο; (Και άλλες ερωτήσεις για το αρχείο...)" -#: faq/library.rst:461 +#: faq/library.rst:467 msgid "" "Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, " "see the :mod:`os` module. The two functions are identical; :func:`~os." "unlink` is simply the name of the Unix system call for this function." msgstr "" +"Χρησιμοποιήστε τα ``os.remove(filename)`` ή ``os.unlink(filename)`` ∙ για " +"τεκμηρίωση, ανατρέξτε στο module :mod:`os`. Οι δύο συναρτήσεις είναι ίδιες∙ " +"η :func:`~os.unlink` είναι απλώς το όνομα της κλήσης συστήματος Unix για " +"αυτήν τη λειτουργία." -#: faq/library.rst:465 +#: faq/library.rst:471 msgid "" "To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create " "one. ``os.makedirs(path)`` will create any intermediate directories in " @@ -487,31 +937,47 @@ msgid "" "directories as long as they're empty; if you want to delete an entire " "directory tree and its contents, use :func:`shutil.rmtree`." msgstr "" +"Για να καταργήσετε έναν κατάλογο, χρησιμοποιήστε τη :func:`os.rmdir` ∙ " +"χρησιμοποιήστε τη :func:`os.mkdir` για να δημιουργήσετε έναν. Το ``os." +"makedirs(path)`` θα δημιουργήσει τυχόν ενδιάμεσους καταλόγους στο ``path`` " +"που δεν υπάρχουν. Το ``os.removedirs(path)`` θα αφαιρέσει τους ενδιάμεσους " +"καταλόγους εφόσον είναι κενοί∙ εάν θέλετε να διαγράψετε ολόκληρο δέντρο " +"καταλόγου και τα περιεχόμενα του, χρησιμοποιήστε τη :func:`shutil.rmtree`." -#: faq/library.rst:471 +#: faq/library.rst:477 msgid "To rename a file, use ``os.rename(old_path, new_path)``." msgstr "" +"Για να μετονομάσετε ένα αρχείο, χρησιμοποιήστε το ``os.rename(old_path, " +"new_path)``." -#: faq/library.rst:473 +#: faq/library.rst:479 msgid "" "To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use " "``f.truncate(offset)``; offset defaults to the current seek position. " "There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os." "open`, where *fd* is the file descriptor (a small integer)." msgstr "" +"Για να περικόψετε ένα αρχείο, ανοίξτε το χρησιμοποιώντας ``f = " +"open(filename, \"rb+\")``, και χρησιμοποιήστε το ``f.truncate(offset)`` ∙ το " +"offset προεπιλέγεται στη τρέχουσα θέση αναζήτησης. Υπάρχει επίσης το ``os." +"ftruncate(fd, offset)`` για αρχεία που έχουν ανοιχτεί με :func:`os.open`, " +"όπου *fd* είναι ο περιγραφέας αρχείου (ένας μικρός ακέραιος)." -#: faq/library.rst:478 +#: faq/library.rst:484 msgid "" "The :mod:`shutil` module also contains a number of functions to work on " "files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, and :" "func:`~shutil.rmtree`." msgstr "" +"Το module :mod:`shutil` περιέχει επίσης έναν αριθμό λειτουργιών για εργασία " +"σε αρχεία, όπως :func:`~shutil.copyfile`, :func:`~shutil.copytree`, και :" +"func:`~shutil.rmtree`." -#: faq/library.rst:484 +#: faq/library.rst:490 msgid "How do I copy a file?" -msgstr "" +msgstr "Πως αντιγράφω ένα αρχείο;" -#: faq/library.rst:486 +#: faq/library.rst:492 msgid "" "The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note " "that on Windows NTFS volumes, it does not copy `alternate data streams " @@ -521,50 +987,90 @@ msgid "" "permissions and metadata, though using :func:`shutil.copy2` instead will " "preserve most (though not all) of it." msgstr "" +"Το module :mod:`shutil` περιέχει μια συνάρτηση :func:`~shutil.copyfile`. " +"Σημειώστε ότι στους τόμους NTFS των Windows, δεν αντιγράφει `alternate data " +"streams `_ " +"ούτε `resource forks `__ σε " +"τόμους macOS HFS+, αν και οι δύο χρησιμοποιούνται πλέον σπάνια. Επίσης δεν " +"αντιγράφει δικαιώματα αρχείων και μεταδεδομένα, αν και η χρήση :func:`shutil." +"copy2` θα διατηρήσει το μεγαλύτερο μέρος (αν και όχι όλο) από αυτό." -#: faq/library.rst:497 +#: faq/library.rst:503 msgid "How do I read (or write) binary data?" -msgstr "" +msgstr "Πώς διαβάζω (ή γράφω) δυαδικά δεδομένα;" -#: faq/library.rst:499 +#: faq/library.rst:505 msgid "" "To read or write complex binary data formats, it's best to use the :mod:" "`struct` module. It allows you to take a string containing binary data " "(usually numbers) and convert it to Python objects; and vice versa." msgstr "" +"Για να διαβάσετε ή να γράψετε σύνθετες μορφές δυαδικών δεδομένων, είναι " +"καλύτερο να χρησιμοποιήσετε το module :mod:`struct`. Σας επιτρέπει να " +"πάρετε μια συμβολοσειρά που περιέχει δυαδικά δεδομένα (συνήθως αριθμούς) και " +"να τη μετατρέψετε σε αντικείμενα Python και αντίστροφα." -#: faq/library.rst:503 +#: faq/library.rst:509 msgid "" "For example, the following code reads two 2-byte integers and one 4-byte " "integer in big-endian format from a file::" msgstr "" +"Για παράδειγμα, ο παρακάτω κώδικας διαβάζει δύο ακέραιους αριθμούς 2 byte " +"και έναν ακέραιο αριθμό 4 byte σε μορφή big-endian από ένα αρχείο::" #: faq/library.rst:512 msgid "" +"import struct\n" +"\n" +"with open(filename, \"rb\") as f:\n" +" s = f.read(8)\n" +" x, y, z = struct.unpack(\">hhl\", s)" +msgstr "" +"import struct\n" +"\n" +"with open(filename, \"rb\") as f:\n" +" s = f.read(8)\n" +" x, y, z = struct.unpack(\">hhl\", s)" + +#: faq/library.rst:518 +msgid "" "The '>' in the format string forces big-endian data; the letter 'h' reads " "one \"short integer\" (2 bytes), and 'l' reads one \"long integer\" (4 " "bytes) from the string." msgstr "" +"Το '>' στη συμβολοσειρά μορφής αναγκάζει δεδομένα big-endian∙ το γράμμα 'h' " +"διαβάζει έναν \"short integer\" (2 bytes), και το 'l' διαβάζει έναν \"long " +"integer\" (4 byte) από την συμβολοσειρά." -#: faq/library.rst:516 +#: faq/library.rst:522 msgid "" "For data that is more regular (e.g. a homogeneous list of ints or floats), " "you can also use the :mod:`array` module." msgstr "" +"Για δεδομένα που είναι πιο κανονικά (π.χ. μια ομοιογενής λίστα ακεραίων ή " +"αριθμούς με υποδιαστολή), μπορείτε επίσης να χρησιμοποιήσετε το module :mod:" +"`array`." -#: faq/library.rst:521 +#: faq/library.rst:527 msgid "" "To read and write binary data, it is mandatory to open the file in binary " "mode (here, passing ``\"rb\"`` to :func:`open`). If you use ``\"r\"`` " "instead (the default), the file will be open in text mode and ``f.read()`` " "will return :class:`str` objects rather than :class:`bytes` objects." msgstr "" +"Για να διαβάσετε και να γράψετε δυαδικά δεδομένα, είναι υποχρεωτικό να " +"ανοίξετε το αρχείο σε δυαδική λειτουργία (εδώ, περνώντας το ``\"rb\"`` στη :" +"func:`open`). Εάν χρησιμοποιήσετε το ``\"r\"`` αντί αυτού (προεπιλεγμένο) " +"το αρχείο θα είναι ανοιχτό σε λειτουργία κειμένου και το ``f.read()`` θα " +"επιστρέψει αντικείμενα :class:`str` αντί για αντικείμενα :class:`bytes`." -#: faq/library.rst:529 +#: faq/library.rst:535 msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?" msgstr "" +"Δεν μπορώ να χρησιμοποιήσω το os.read() σε ένα pipe που δημιουργήθηκε με το " +"os.popen()∙ γιατί;" -#: faq/library.rst:531 +#: faq/library.rst:537 msgid "" ":func:`os.read` is a low-level function which takes a file descriptor, a " "small integer representing the opened file. :func:`os.popen` creates a high-" @@ -572,38 +1078,48 @@ msgid "" "function. Thus, to read *n* bytes from a pipe *p* created with :func:`os." "popen`, you need to use ``p.read(n)``." msgstr "" +"Η :func:`os.read` είναι μια συνάρτηση χαμηλού επιπέδου που παίρνει έναν " +"περιγραφέα αρχείου, έναν μικρό ακέραιο που αντιπροσωπεύει το ανοιχτό " +"αρχείο. Η :func:`os.popen` δημιουργεί ένα αντικείμενο αρχείου υψηλού " +"επιπέδου, του ίδιου τύπου που επιστρέφεται από την ενσωματωμένη συνάρτηση :" +"func:`open`. Έτσι, για να διαβάσετε *n* byte από ένα pipe *p* που " +"δημιουργήθηκε με τη :func:`os.popen`, πρέπει να χρησιμοποιήσετε το ``p." +"read(n)``." -#: faq/library.rst:618 +#: faq/library.rst:545 msgid "How do I access the serial (RS232) port?" -msgstr "" +msgstr "Πώς μπορώ να αποκτήσω πρόσβαση στη σειριακή θύρα (RS232);" -#: faq/library.rst:620 +#: faq/library.rst:547 msgid "For Win32, OSX, Linux, BSD, Jython, IronPython:" -msgstr "" +msgstr "Για Win32, OSX, Linux, BSD, Jython, IronPython:" -#: faq/library.rst:622 -msgid "https://pypi.org/project/pyserial/" -msgstr "" +#: faq/library.rst:549 +msgid ":pypi:`pyserial`" +msgstr ":pypi:`pyserial`" -#: faq/library.rst:624 +#: faq/library.rst:551 msgid "For Unix, see a Usenet post by Mitch Chapman:" -msgstr "" +msgstr "Για το Unix, δείτε μια ανάρτηση στο Usenet από τον Mitch Chapman:" -#: faq/library.rst:626 +#: faq/library.rst:553 msgid "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" -msgstr "" +msgstr "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" -#: faq/library.rst:630 +#: faq/library.rst:557 msgid "Why doesn't closing sys.stdout (stdin, stderr) really close it?" msgstr "" +"Γιατί το κλείσιμο του sys.stdout (stdin, stderr) δεν το κλείνει πραγματικά;" -#: faq/library.rst:632 +#: faq/library.rst:559 msgid "" "Python :term:`file objects ` are a high-level layer of " "abstraction on low-level C file descriptors." msgstr "" +"Το Python :term:`file objects ` είναι ένα επίπεδο αφαίρεσης " +"υψηλού επιπέδου σε χαμηλού επιπέδου περιγραφείς αρχείων C." -#: faq/library.rst:635 +#: faq/library.rst:562 msgid "" "For most file objects you create in Python via the built-in :func:`open` " "function, ``f.close()`` marks the Python file object as being closed from " @@ -611,122 +1127,195 @@ msgid "" "descriptor. This also happens automatically in ``f``'s destructor, when " "``f`` becomes garbage." msgstr "" +"Για τα περισσότερα αντικείμενα αρχείων που δημιουργείτε στην Python μέσω της " +"ενσωματωμένης συνάρτησης :func:`open`, η ``f.close()`` επισημαίνει το " +"αντικείμενο αρχείου Python ως κλειστό από την άποψη της Python και επίσης " +"κανονίζει να κλείσει ο υποκείμενος περιγραφέας αρχείου C. Αυτό συμβαίνει " +"επίσης αυτόματα στον καταστροφέα του ``f``, όταν το ``f`` γίνεται σκουπίδια." -#: faq/library.rst:641 +#: faq/library.rst:568 msgid "" "But stdin, stdout and stderr are treated specially by Python, because of the " "special status also given to them by C. Running ``sys.stdout.close()`` " "marks the Python-level file object as being closed, but does *not* close the " "associated C file descriptor." msgstr "" +"Αλλά τα stdin, stdout και stderr αντιμετωπίζονται ειδικά από την Python, " +"λόγω της ειδικής κατάστασης που τους δίνεται επίσης από τη C. Εκτελώντας το " +"``sys.stdout.close()`` επισημαίνει το αντικείμενο αρχείου σε επίπεδο Python " +"ως κλειστό, αλλά *δεν* κλείνει το συσχετισμένο περιγραφικό αρχείου C." -#: faq/library.rst:646 +#: faq/library.rst:573 msgid "" "To close the underlying C file descriptor for one of these three, you should " "first be sure that's what you really want to do (e.g., you may confuse " "extension modules trying to do I/O). If it is, use :func:`os.close`::" msgstr "" +"Για να κλείσετε τον υποκείμενο περιγραφέα αρχείου C για ένα από αυτά τα " +"τρία, θα πρέπει πρώτα να βεβαιωθείτε ότι αυτό θέλετε πραγματικά να κάνετε (π." +"χ., μπορείτε να μπερδέψετε τα modules επέκτασης που προσπαθούν να κάνουν I/" +"O). Εάν είναι, χρησιμοποιήστε τη :func:`os.close`::" -#: faq/library.rst:654 +#: faq/library.rst:577 +msgid "" +"os.close(stdin.fileno())\n" +"os.close(stdout.fileno())\n" +"os.close(stderr.fileno())" +msgstr "" +"os.close(stdin.fileno())\n" +"os.close(stdout.fileno())\n" +"os.close(stderr.fileno())" + +#: faq/library.rst:581 msgid "Or you can use the numeric constants 0, 1 and 2, respectively." msgstr "" +"Ή μπορείτε να χρησιμοποιήσετε τις αριθμητικές σταθερές 0, 1 και 2, " +"αντίστοιχα." -#: faq/library.rst:658 +#: faq/library.rst:585 msgid "Network/Internet Programming" -msgstr "" +msgstr "Προγραμματισμός Δικτύου/Διαδικτύου" -#: faq/library.rst:661 +#: faq/library.rst:588 msgid "What WWW tools are there for Python?" -msgstr "" +msgstr "Ποια εργαλεία WWW υπάρχουν για την Python;" -#: faq/library.rst:663 +#: faq/library.rst:590 msgid "" "See the chapters titled :ref:`internet` and :ref:`netdata` in the Library " "Reference Manual. Python has many modules that will help you build server-" "side and client-side web systems." msgstr "" +"Δείτε τα κεφάλαια με τίτλο :ref:`internet` και :ref:`netdata` στο Εγχειρίδιο " +"Αναφοράς Βιβλιοθήκης. Η Python έχει πολλά modules που θα σας βοηθήσουν να " +"δημιουργήσετε συστήματα ιστού από την πλευρά του διακομιστή και του πελάτη." -#: faq/library.rst:669 +#: faq/library.rst:596 msgid "" "A summary of available frameworks is maintained by Paul Boddie at https://" "wiki.python.org/moin/WebProgramming\\ ." msgstr "" +"Μια σύνοψη των διαθέσιμων πλαισίων διατηρείται από τον Paul Boddie στη " +"διεύθυνση https://wiki.python.org/moin/WebProgramming\\ ." -#: faq/library.rst:672 -msgid "" -"Cameron Laird maintains a useful set of pages about Python web technologies " -"at https://web.archive.org/web/20210224183619/http://phaseit.net/claird/comp." -"lang.python/web_python." -msgstr "" - -#: faq/library.rst:677 -msgid "How can I mimic CGI form submission (METHOD=POST)?" -msgstr "" - -#: faq/library.rst:679 -msgid "" -"I would like to retrieve web pages that are the result of POSTing a form. Is " -"there existing code that would let me do this easily?" -msgstr "" - -#: faq/library.rst:682 -msgid "Yes. Here's a simple example that uses :mod:`urllib.request`::" -msgstr "" - -#: faq/library.rst:697 -msgid "" -"Note that in general for percent-encoded POST operations, query strings must " -"be quoted using :func:`urllib.parse.urlencode`. For example, to send " -"``name=Guy Steele, Jr.``::" -msgstr "" - -#: faq/library.rst:705 -msgid ":ref:`urllib-howto` for extensive examples." -msgstr "" - -#: faq/library.rst:709 +#: faq/library.rst:601 msgid "What module should I use to help with generating HTML?" -msgstr "" +msgstr "Τι module πρέπει να χρησιμοποιήσω για να βοηθήσω στην δημιουργία HTML;" -#: faq/library.rst:713 +#: faq/library.rst:605 msgid "" "You can find a collection of useful links on the `Web Programming wiki page " "`_." msgstr "" +"Μπορείτε να βρείτε μια συλλογή από χρήσιμους συνδέσμους στη σελίδα `Web " +"Programming wiki page `_." -#: faq/library.rst:718 +#: faq/library.rst:610 msgid "How do I send mail from a Python script?" -msgstr "" +msgstr "Πώς μπορώ να στείλω αλληλογραφία από ένα Python script;" -#: faq/library.rst:720 +#: faq/library.rst:612 msgid "Use the standard library module :mod:`smtplib`." -msgstr "" +msgstr "Χρησιμοποιήστε την τυπική module βιβλιοθήκη :mod:`smtplib`." -#: faq/library.rst:722 +#: faq/library.rst:614 msgid "" "Here's a very simple interactive mail sender that uses it. This method will " "work on any host that supports an SMTP listener. ::" msgstr "" - -#: faq/library.rst:742 +"Εδώ είναι ένας πολύ απλός διαδραστικός αποστολέας αλληλογραφίας που τον " +"χρησιμοποιεί. Αυτή η μέθοδος θα λειτουργήσει σε οποιονδήποτε κεντρικό " +"υπολογιστή υποστηρίζει το πρόγραμμα ακρόασης SMTP. ::" + +#: faq/library.rst:617 +msgid "" +"import sys, smtplib\n" +"\n" +"fromaddr = input(\"From: \")\n" +"toaddrs = input(\"To: \").split(',')\n" +"print(\"Enter message, end with ^D:\")\n" +"msg = ''\n" +"while True:\n" +" line = sys.stdin.readline()\n" +" if not line:\n" +" break\n" +" msg += line\n" +"\n" +"# The actual mail send\n" +"server = smtplib.SMTP('localhost')\n" +"server.sendmail(fromaddr, toaddrs, msg)\n" +"server.quit()" +msgstr "" +"import sys, smtplib\n" +"\n" +"fromaddr = input(\"From: \")\n" +"toaddrs = input(\"To: \").split(',')\n" +"print(\"Enter message, end with ^D:\")\n" +"msg = ''\n" +"while True:\n" +" line = sys.stdin.readline()\n" +" if not line:\n" +" break\n" +" msg += line\n" +"\n" +"# The actual mail send\n" +"server = smtplib.SMTP('localhost')\n" +"server.sendmail(fromaddr, toaddrs, msg)\n" +"server.quit()" + +#: faq/library.rst:634 msgid "" "A Unix-only alternative uses sendmail. The location of the sendmail program " "varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes ``/" "usr/sbin/sendmail``. The sendmail manual page will help you out. Here's " "some sample code::" msgstr "" +"Μια εναλλακτική λύση μόνο για Unix χρησιμοποιεί sendmail. Η τοποθεσία του " +"προγράμματος sendmail ποικίλλει μεταξύ των συστημάτων∙ μερικές φορές είναι " +"``/usr/lib/sendmail``, μερικές φορές ``/usr/sbin/sendmail``. Η σελίδα " +"εγχειριδίου sendmail θα σας βοηθήσει. Ορίστε ένα δείγμα κώδικα::" + +#: faq/library.rst:639 +msgid "" +"import os\n" +"\n" +"SENDMAIL = \"/usr/sbin/sendmail\" # sendmail location\n" +"p = os.popen(\"%s -t -i\" % SENDMAIL, \"w\")\n" +"p.write(\"To: receiver@example.com\\n\")\n" +"p.write(\"Subject: test\\n\")\n" +"p.write(\"\\n\") # blank line separating headers from body\n" +"p.write(\"Some text\\n\")\n" +"p.write(\"some more text\\n\")\n" +"sts = p.close()\n" +"if sts != 0:\n" +" print(\"Sendmail exit status\", sts)" +msgstr "" +"import os\n" +"\n" +"SENDMAIL = \"/usr/sbin/sendmail\" # sendmail location\n" +"p = os.popen(\"%s -t -i\" % SENDMAIL, \"w\")\n" +"p.write(\"To: receiver@example.com\\n\")\n" +"p.write(\"Subject: test\\n\")\n" +"p.write(\"\\n\") # blank line separating headers from body\n" +"p.write(\"Some text\\n\")\n" +"p.write(\"some more text\\n\")\n" +"sts = p.close()\n" +"if sts != 0:\n" +" print(\"Sendmail exit status\", sts)" -#: faq/library.rst:762 +#: faq/library.rst:654 msgid "How do I avoid blocking in the connect() method of a socket?" -msgstr "" +msgstr "Πώς μπορώ να αποφύγω τον αποκλεισμό στη μέθοδο connect() ενός socket;" -#: faq/library.rst:764 +#: faq/library.rst:656 msgid "" "The :mod:`select` module is commonly used to help with asynchronous I/O on " "sockets." msgstr "" +"Το module :mod:`select` χρησιμοποιείται συνήθως για να βοηθήσει με " +"ασύγχρονες I/O σε sockets." -#: faq/library.rst:767 +#: faq/library.rst:659 msgid "" "To prevent the TCP connect from blocking, you can set the socket to non-" "blocking mode. Then when you do the :meth:`~socket.socket.connect`, you " @@ -736,8 +1325,16 @@ msgid "" "return different values, so you're going to have to check what's returned on " "your system." msgstr "" +"Για να αποτρέψετε τον αποκλεισμό της σύνδεσης TCP, μπορείτε να ρυθμίσετε την " +"υποδοχή σε λειτουργία μη αποκλεισμού. Στην συνέχεια, όταν κάνετε τη :meth:" +"`~socket.socket.connect`, είτε θα συνδεθείτε αμέσως (απίθανο), είτε θα " +"λάβετε μια εξαίρεση που περιέχει τον αριθμό σφάλματος ως ``.errno``. Το " +"``errno.EINPROGRESS`` υποδηλώνει ότι η σύνδεση είναι σε εξέλιξη, αλλά δεν " +"έχει ολοκληρωθεί ακόμα. Διαφορετικά λειτουργικά συστήματα θα επιστρέψουν " +"διαφορετικές τιμές, επομένως θα πρέπει να ελέγξετε τι επιστρέφεται στο " +"σύστημα σας." -#: faq/library.rst:775 +#: faq/library.rst:667 msgid "" "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " "an exception. It will just return the errno value. To poll, you can call :" @@ -745,104 +1342,149 @@ msgid "" "indicate that you're connected -- or you can pass this socket to :meth:" "`select.select` to check if it's writable." msgstr "" +"Μπορείτε να χρησιμοποιήσετε τη μέθοδο :meth:`~socket.socket.connect_ex` για " +"να αποφύγετε τη δημιουργία εξαίρεσης. Απλώς θα επιστρέψει την τιμή errno. " +"Για δημοσκόπηση, μπορείτε να καλέσετε το :meth:`~socket.socket.connect_ex` " +"ξανά αργότερα -- ``0`` ή ``errno.EISCONN`` υποδηλώνει ότι είστε συνδεδεμένοι " +"-- ή μπορείτε να περάσετε αυτό το socket στη :meth:`select.select` για να " +"ελέγξτε αν είναι εγγράψιμο." -#: faq/library.rst:783 +#: faq/library.rst:675 msgid "" "The :mod:`asyncio` module provides a general purpose single-threaded and " "concurrent asynchronous library, which can be used for writing non-blocking " "network code. The third-party `Twisted `_ library is a " "popular and feature-rich alternative." msgstr "" +"Το module :mod:`asyncio` παρέχει μια γενικού σκοπού απλή και ταυτόχρονη " +"ασύγχρονη βιβλιοθήκη, η οποία μπορεί να χρησιμοποιηθεί για τη σύνταξη κώδικα " +"δικτύου χωρίς αποκλεισμό. Η βιβλιοθήκη `Twisted `_ " +"είναι μια δημοφιλής και με πολλές λειτουργίες εναλλακτική λύση." -#: faq/library.rst:791 +#: faq/library.rst:683 msgid "Databases" -msgstr "" +msgstr "Βάσεις Δεδομένων" -#: faq/library.rst:794 +#: faq/library.rst:686 msgid "Are there any interfaces to database packages in Python?" -msgstr "" +msgstr "Υπάρχουν διεπαφές σε πακέτα βάσεων δεδομένων στην Python;" -#: faq/library.rst:796 +#: faq/library.rst:688 msgid "Yes." -msgstr "" +msgstr "Ναι." -#: faq/library.rst:798 +#: faq/library.rst:690 msgid "" "Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM " "` are also included with standard Python. There is also the :mod:" "`sqlite3` module, which provides a lightweight disk-based relational " "database." msgstr "" +"Διεπαφές σε κατακερματισμούς που βασίζονται σε δίσκο, όπως :mod:`DBM ` και :mod:`GDBM ` περιλαμβάνονται επίσης στην τυπική Python. " +"Υπάρχει επίσης το module :mod:`sqlite3`, το οποίο παρέχει μια ελαφριά " +"σχεσιακή βάση δεδομένων που βασίζεται στο δίσκο." -#: faq/library.rst:803 +#: faq/library.rst:695 msgid "" "Support for most relational databases is available. See the " "`DatabaseProgramming wiki page `_ for details." msgstr "" +"Υποστήριξη για τις περισσότερες σχεσιακές βάσεις δεδομένων είναι διαθέσιμη. " +"Δείτε τη σελίδα `DatabaseProgramming wiki page `_ για λεπτομέρειες." -#: faq/library.rst:809 +#: faq/library.rst:701 msgid "How do you implement persistent objects in Python?" -msgstr "" +msgstr "Πως υλοποιείτε persistent αντικείμενα στην Python;" -#: faq/library.rst:811 +#: faq/library.rst:703 msgid "" "The :mod:`pickle` library module solves this in a very general way (though " "you still can't store things like open files, sockets or windows), and the :" "mod:`shelve` library module uses pickle and (g)dbm to create persistent " "mappings containing arbitrary Python objects." msgstr "" +"To module βιβλιοθήκης :mod:`pickle` το λύνει αυτό με πολύ γενικό τρόπο (αν " +"και δεν μπορείτε ακόμα να αποθηκεύσετε πράγματα όπως ανοιχτά αρχεία, sockets " +"ή παράθυρα), και το module βιβλιοθήκης :mod:`shelve` χρησιμοποιεί pickle και " +"(g)dbm για τη δημιουργία επίμονων αντιστοιχίσεων που περιέχουν αυθαίρετα " +"αντικείμενα Python." -#: faq/library.rst:818 +#: faq/library.rst:710 msgid "Mathematics and Numerics" -msgstr "" +msgstr "Μαθηματικά και Αριθμητικά" -#: faq/library.rst:821 +#: faq/library.rst:713 msgid "How do I generate random numbers in Python?" -msgstr "" +msgstr "Πως μπορώ να δημιουργήσω τυχαίους αριθμούς στην Python;" -#: faq/library.rst:823 +#: faq/library.rst:715 msgid "" "The standard module :mod:`random` implements a random number generator. " "Usage is simple::" msgstr "" +"Το τυπικό module :mod:`random` υλοποιεί μια γεννήτρια τυχαίων αριθμών. Η " +"χρήση είναι απλή::" -#: faq/library.rst:829 -msgid "This returns a random floating point number in the range [0, 1)." +#: faq/library.rst:718 +msgid "" +"import random\n" +"random.random()" msgstr "" +"import random\n" +"random.random()" -#: faq/library.rst:831 +#: faq/library.rst:721 +msgid "This returns a random floating-point number in the range [0, 1)." +msgstr "" +"Αυτό επιστρέφει έναν τυχαίο αριθμό κινητής υποδιαστολής στο εύρος [0, 1)." + +#: faq/library.rst:723 msgid "" "There are also many other specialized generators in this module, such as:" msgstr "" +"Υπάρχουν επίσης πολλές άλλες εξειδικευμένες γεννήτριες σε αυτό το module, " +"όπως:" -#: faq/library.rst:833 +#: faq/library.rst:725 msgid "``randrange(a, b)`` chooses an integer in the range [a, b)." -msgstr "" +msgstr "Το ``randrange(a, b)`` επιλέγει έναν ακέραιο στο εύρος [a, b)." -#: faq/library.rst:834 -msgid "``uniform(a, b)`` chooses a floating point number in the range [a, b)." +#: faq/library.rst:726 +msgid "``uniform(a, b)`` chooses a floating-point number in the range [a, b)." msgstr "" +"Το ``uniform(a, b)`` επιλέγει έναν αριθμό κινητής υποδιαστολής στο εύρος [a, " +"b)." -#: faq/library.rst:835 +#: faq/library.rst:727 msgid "" "``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution." msgstr "" +"Το ``normalvariate(mean, sdev)`` λαμβάνει δείγματα της κανονικής (Gaussian) " +"κατανομής." -#: faq/library.rst:837 +#: faq/library.rst:729 msgid "Some higher-level functions operate on sequences directly, such as:" msgstr "" +"Ορισμένες συναρτήσεις υψηλότερου επιπέδου λειτουργούν απευθείας σε " +"ακολουθίες, όπως:" -#: faq/library.rst:839 +#: faq/library.rst:731 msgid "``choice(S)`` chooses a random element from a given sequence." msgstr "" +"To ``choice(S)`` επιλέγει ένα τυχαίο στοιχείο από μια δεδομένη ακολουθία." -#: faq/library.rst:840 +#: faq/library.rst:732 msgid "``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly." msgstr "" +"Το ``shuffle(L)`` ανακατεύει μια λίστα επιτόπου, δηλαδή τη μεταθέτει τυχαία." -#: faq/library.rst:842 +#: faq/library.rst:734 msgid "" "There's also a ``Random`` class you can instantiate to create independent " "multiple random number generators." msgstr "" +"Υπάρχει επίσης μια κλάση ``Random`` που μπορείτε να επιβεβαιώσετε για να " +"δημιουργήσετε ανεξάρτητες γεννήτριες πολλαπλών τυχαίων αριθμών." diff --git a/faq/programming.po b/faq/programming.po index a52edd96..516155cd 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-06-12 23:09+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-05 22:13+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -394,6 +394,16 @@ msgstr "" "Ας υποθέσουμε ότι χρησιμοποιείτε έναν βρόχο for για να ορίσετε μερικά " "διαφορετικά lambdas (ή ακόμα και απλές συναρτήσεις), π.χ.::" +#: faq/programming.rst:213 +msgid "" +">>> squares = []\n" +">>> for x in range(5):\n" +"... squares.append(lambda: x**2)" +msgstr "" +">>> squares = []\n" +">>> for x in range(5):\n" +"... squares.append(lambda: x**2)" + #: faq/programming.rst:217 msgid "" "This gives you a list that contains 5 lambdas that calculate ``x**2``. You " @@ -406,6 +416,18 @@ msgstr "" "αντίστοιχα, ``0``, ``1``, ``4``, ``9`` και ``16``. Ωστόσο, όταν δοκιμάσετε " "πραγματικά θα δείτε ότι όλα επιστρέφουν ``16``::" +#: faq/programming.rst:222 +msgid "" +">>> squares[2]()\n" +"16\n" +">>> squares[4]()\n" +"16" +msgstr "" +">>> squares[2]()\n" +"16\n" +">>> squares[4]()\n" +"16" + #: faq/programming.rst:227 msgid "" "This happens because ``x`` is not local to the lambdas, but is defined in " @@ -421,6 +443,16 @@ msgstr "" "Μπορείτε επίσης να το επαληθεύσετε αλλάζοντας την τιμή του ``x`` και δείτε " "πως αλλάζουν τα αποτελέσματα του lambda::" +#: faq/programming.rst:233 +msgid "" +">>> x = 8\n" +">>> squares[2]()\n" +"64" +msgstr "" +">>> x = 8\n" +">>> squares[2]()\n" +"64" + #: faq/programming.rst:237 msgid "" "In order to avoid this, you need to save the values in variables local to " @@ -430,6 +462,16 @@ msgstr "" "τοπικές στο lambda, έτσι ώστε να μην βασίζονται στην τιμή του καθολικού " "``x``::" +#: faq/programming.rst:240 +msgid "" +">>> squares = []\n" +">>> for x in range(5):\n" +"... squares.append(lambda n=x: n**2)" +msgstr "" +">>> squares = []\n" +">>> for x in range(5):\n" +"... squares.append(lambda n=x: n**2)" + #: faq/programming.rst:244 msgid "" "Here, ``n=x`` creates a new variable ``n`` local to the lambda and computed " @@ -444,6 +486,18 @@ msgstr "" "θα είναι ``0`` στο πρώτο lambda, ``1`` στο δεύτερο , ``2`` στο τρίτο και " "ούτω καθεξής. Επομένως κάθε lambda θα επιστρέψει τώρα το σωστό αποτέλεσμα::" +#: faq/programming.rst:250 +msgid "" +">>> squares[2]()\n" +"4\n" +">>> squares[4]()\n" +"16" +msgstr "" +">>> squares[2]()\n" +"4\n" +">>> squares[4]()\n" +"16" + #: faq/programming.rst:255 msgid "" "Note that this behaviour is not peculiar to lambdas, but applies to regular " @@ -477,21 +531,43 @@ msgstr "" msgid "config.py::" msgstr "config.py::" +#: faq/programming.rst:270 +msgid "x = 0 # Default value of the 'x' configuration setting" +msgstr "x = 0 # Default value of the 'x' configuration setting" + #: faq/programming.rst:272 msgid "mod.py::" msgstr "mod.py::" +#: faq/programming.rst:274 +msgid "" +"import config\n" +"config.x = 1" +msgstr "" +"import config\n" +"config.x = 1" + #: faq/programming.rst:277 msgid "main.py::" msgstr "main.py::" +#: faq/programming.rst:279 +msgid "" +"import config\n" +"import mod\n" +"print(config.x)" +msgstr "" +"import config\n" +"import mod\n" +"print(config.x)" + #: faq/programming.rst:283 msgid "" "Note that using a module is also the basis for implementing the singleton " "design pattern, for the same reason." msgstr "" "Λάβετε υπόψη ότι η χρήση ενός module είναι επίσης η βάση για την εφαρμογή " -"του μοτίβου σχεδιασμού signleton, για τον ίδιο λόγο." +"του μοτίβου σχεδιασμού singleton, για τον ίδιο λόγο." #: faq/programming.rst:288 msgid "What are the \"best practices\" for using import in a module?" @@ -637,6 +713,18 @@ msgstr "" "Αυτός ο τύπος σφάλματος συνήθως δαγκώνει νεοφυείς προγραμματιστές. Σκεφτείτε " "αυτήν τη συνάρτηση::" +#: faq/programming.rst:342 +msgid "" +"def foo(mydict={}): # Danger: shared reference to one dict for all calls\n" +" ... compute something ...\n" +" mydict[key] = value\n" +" return mydict" +msgstr "" +"def foo(mydict={}): # Danger: shared reference to one dict for all calls\n" +" ... compute something ...\n" +" mydict[key] = value\n" +" return mydict" + #: faq/programming.rst:347 msgid "" "The first time you call this function, ``mydict`` contains a single item. " @@ -685,10 +773,28 @@ msgstr "" "ελέγξτε εάν η παράμετρος είναι ``None`` και δημιουργήστε μια νέα λίστα/" "λεξικά/ό,τι και αν είναι. Για παράδειγμα μην γράψετε::" +#: faq/programming.rst:365 +msgid "" +"def foo(mydict={}):\n" +" ..." +msgstr "" +"def foo(mydict={}):\n" +" ..." + #: faq/programming.rst:368 msgid "but::" msgstr "αλλά::" +#: faq/programming.rst:370 +msgid "" +"def foo(mydict=None):\n" +" if mydict is None:\n" +" mydict = {} # create a new dict for local namespace" +msgstr "" +"def foo(mydict=None):\n" +" if mydict is None:\n" +" mydict = {} # create a new dict for local namespace" + #: faq/programming.rst:374 msgid "" "This feature can be useful. When you have a function that's time-consuming " @@ -704,6 +810,30 @@ msgstr "" "ξανά η ίδια τιμή. Αυτό ονομάζεται \"memoizing\", και μπορεί να εφαρμοστεί ως " "εξής:" +#: faq/programming.rst:379 +msgid "" +"# Callers can only provide two parameters and optionally pass _cache by " +"keyword\n" +"def expensive(arg1, arg2, *, _cache={}):\n" +" if (arg1, arg2) in _cache:\n" +" return _cache[(arg1, arg2)]\n" +"\n" +" # Calculate the value\n" +" result = ... expensive computation ...\n" +" _cache[(arg1, arg2)] = result # Store result in the cache\n" +" return result" +msgstr "" +"# Callers can only provide two parameters and optionally pass _cache by " +"keyword\n" +"def expensive(arg1, arg2, *, _cache={}):\n" +" if (arg1, arg2) in _cache:\n" +" return _cache[(arg1, arg2)]\n" +"\n" +" # Calculate the value\n" +" result = ... expensive computation ...\n" +" _cache[(arg1, arg2)] = result # Store result in the cache\n" +" return result" + #: faq/programming.rst:389 msgid "" "You could use a global variable containing a dictionary instead of the " @@ -732,6 +862,20 @@ msgstr "" "μεταβιβάσετε αυτά τα ορίσματα κατά την κλήση άλλης συνάρτησης με τη χρήση " "των ``*`` και ``**``::" +#: faq/programming.rst:401 +msgid "" +"def f(x, *args, **kwargs):\n" +" ...\n" +" kwargs['width'] = '14.3c'\n" +" ...\n" +" g(x, *args, **kwargs)" +msgstr "" +"def f(x, *args, **kwargs):\n" +" ...\n" +" kwargs['width'] = '14.3c'\n" +" ...\n" +" g(x, *args, **kwargs)" + #: faq/programming.rst:415 msgid "What is the difference between arguments and parameters?" msgstr "Ποια είναι η διαφορά μεταξύ ορισμάτων και παραμέτρων;" @@ -750,6 +894,14 @@ msgstr "" "παράμετροι ορίζουν τι :term:`kind of arguments ` μπορεί να δεχτεί " "μια συνάρτηση. Για παράδειγμα δεδομένου του ορισμού της συνάρτησης::" +#: faq/programming.rst:423 +msgid "" +"def func(foo, bar=None, **kwargs):\n" +" pass" +msgstr "" +"def func(foo, bar=None, **kwargs):\n" +" pass" + #: faq/programming.rst:426 msgid "" "*foo*, *bar* and *kwargs* are parameters of ``func``. However, when calling " @@ -758,6 +910,10 @@ msgstr "" "*foo*, *bar* και *kwargs* είναι παράμετροι της ``func``. Ωστόσο, όταν " "καλείται η ``func``, για παράδειγμα::" +#: faq/programming.rst:429 +msgid "func(42, bar=314, extra=somevar)" +msgstr "func(42, bar=314, extra=somevar)" + #: faq/programming.rst:431 msgid "the values ``42``, ``314``, and ``somevar`` are arguments." msgstr "οι τιμές ``42``, ``314``, και ``somevar`` είναι ορίσματα." @@ -770,6 +926,24 @@ msgstr "Γιατί η αλλαγή της λίστας 'y' αλλάζει επί msgid "If you wrote code like::" msgstr "Αν γράψατε κώδικα όπως::" +#: faq/programming.rst:439 +msgid "" +">>> x = []\n" +">>> y = x\n" +">>> y.append(10)\n" +">>> y\n" +"[10]\n" +">>> x\n" +"[10]" +msgstr "" +">>> x = []\n" +">>> y = x\n" +">>> y.append(10)\n" +">>> y\n" +"[10]\n" +">>> x\n" +"[10]" + #: faq/programming.rst:447 msgid "" "you might be wondering why appending an element to ``y`` changed ``x`` too." @@ -803,11 +977,11 @@ msgstr "" #: faq/programming.rst:457 msgid "" -"After the call to :meth:`!append`, the content of the mutable object has " -"changed from ``[]`` to ``[10]``. Since both the variables refer to the same " -"object, using either name accesses the modified value ``[10]``." +"After the call to :meth:`~sequence.append`, the content of the mutable " +"object has changed from ``[]`` to ``[10]``. Since both the variables refer " +"to the same object, using either name accesses the modified value ``[10]``." msgstr "" -"Μετά την κλήση στο :meth:`!append`, το περιεχόμενο του μεταβλητού " +"Μετά την κλήση στο :meth:`~sequence.append`, το περιεχόμενο του μεταβλητού " "αντικειμένου έχει αλλάξει από ``[]`` σε ``[10]``. Επειδή και οι δύο " "μεταβλητές αναφέρονται στο ίδιο αντικείμενο, χρησιμοποιώντας οποιοδήποτε " "όνομα αποκτά πρόσβαση στην τροποποιημένη τιμή ``[10]``." @@ -816,6 +990,24 @@ msgstr "" msgid "If we instead assign an immutable object to ``x``::" msgstr "Αν αντιστοιχίσουμε ένα αμετάβλητο αντικείμενο σε ``x``::" +#: faq/programming.rst:463 +msgid "" +">>> x = 5 # ints are immutable\n" +">>> y = x\n" +">>> x = x + 1 # 5 can't be mutated, we are creating a new object here\n" +">>> x\n" +"6\n" +">>> y\n" +"5" +msgstr "" +">>> x = 5 # ints are immutable\n" +">>> y = x\n" +">>> x = x + 1 # 5 can't be mutated, we are creating a new object here\n" +">>> x\n" +"6\n" +">>> y\n" +"5" + #: faq/programming.rst:471 msgid "" "we can see that in this case ``x`` and ``y`` are not equal anymore. This is " @@ -931,6 +1123,26 @@ msgstr "" msgid "By returning a tuple of the results::" msgstr "Επιστρέφοντας μια πλειάδα των αποτελεσμάτων::" +#: faq/programming.rst:519 +msgid "" +">>> def func1(a, b):\n" +"... a = 'new-value' # a and b are local names\n" +"... b = b + 1 # assigned to new objects\n" +"... return a, b # return new values\n" +"...\n" +">>> x, y = 'old-value', 99\n" +">>> func1(x, y)\n" +"('new-value', 100)" +msgstr "" +">>> def func1(a, b):\n" +"... a = 'new-value' # a and b are local names\n" +"... b = b + 1 # assigned to new objects\n" +"... return a, b # return new values\n" +"...\n" +">>> x, y = 'old-value', 99\n" +">>> func1(x, y)\n" +"('new-value', 100)" + #: faq/programming.rst:528 msgid "This is almost always the clearest solution." msgstr "Αυτή είναι σχεδόν πάντα η πιο ξεκάθαρη λύση." @@ -947,14 +1159,84 @@ msgid "By passing a mutable (changeable in-place) object::" msgstr "" "Περνώντας ένα μεταβλητό (με δυνατότητα αλλαγής επί τόπου) αντικείμενο::" +#: faq/programming.rst:534 +msgid "" +">>> def func2(a):\n" +"... a[0] = 'new-value' # 'a' references a mutable list\n" +"... a[1] = a[1] + 1 # changes a shared object\n" +"...\n" +">>> args = ['old-value', 99]\n" +">>> func2(args)\n" +">>> args\n" +"['new-value', 100]" +msgstr "" +">>> def func2(a):\n" +"... a[0] = 'new-value' # 'a' references a mutable list\n" +"... a[1] = a[1] + 1 # changes a shared object\n" +"...\n" +">>> args = ['old-value', 99]\n" +">>> func2(args)\n" +">>> args\n" +"['new-value', 100]" + #: faq/programming.rst:543 msgid "By passing in a dictionary that gets mutated::" msgstr "Περνώντας σε ένα λεξικό που μεταλλάσσεται::" +#: faq/programming.rst:545 +msgid "" +">>> def func3(args):\n" +"... args['a'] = 'new-value' # args is a mutable dictionary\n" +"... args['b'] = args['b'] + 1 # change it in-place\n" +"...\n" +">>> args = {'a': 'old-value', 'b': 99}\n" +">>> func3(args)\n" +">>> args\n" +"{'a': 'new-value', 'b': 100}" +msgstr "" +">>> def func3(args):\n" +"... args['a'] = 'new-value' # args is a mutable dictionary\n" +"... args['b'] = args['b'] + 1 # change it in-place\n" +"...\n" +">>> args = {'a': 'old-value', 'b': 99}\n" +">>> func3(args)\n" +">>> args\n" +"{'a': 'new-value', 'b': 100}" + #: faq/programming.rst:554 msgid "Or bundle up values in a class instance::" msgstr "Ή ομαδοποιήστε τιμές σε μια παρουσία κλάσης::" +#: faq/programming.rst:556 +msgid "" +">>> class Namespace:\n" +"... def __init__(self, /, **args):\n" +"... for key, value in args.items():\n" +"... setattr(self, key, value)\n" +"...\n" +">>> def func4(args):\n" +"... args.a = 'new-value' # args is a mutable Namespace\n" +"... args.b = args.b + 1 # change object in-place\n" +"...\n" +">>> args = Namespace(a='old-value', b=99)\n" +">>> func4(args)\n" +">>> vars(args)\n" +"{'a': 'new-value', 'b': 100}" +msgstr "" +">>> class Namespace:\n" +"... def __init__(self, /, **args):\n" +"... for key, value in args.items():\n" +"... setattr(self, key, value)\n" +"...\n" +">>> def func4(args):\n" +"... args.a = 'new-value' # args is a mutable Namespace\n" +"... args.b = args.b + 1 # change object in-place\n" +"...\n" +">>> args = Namespace(a='old-value', b=99)\n" +">>> func4(args)\n" +">>> vars(args)\n" +"{'a': 'new-value', 'b': 100}" + #: faq/programming.rst:571 msgid "There's almost never a good reason to get this complicated." msgstr "Δεν υπάρχει σχεδόν ποτέ καλός λόγος να γίνει αυτό περίπλοκο." @@ -981,14 +1263,48 @@ msgstr "" "θέλετε να ορίσετε το ``linear(a,b)`` που επιστρέφει μια συνάρτηση ``f(x)`` " "που υπολογίζει την τιμή ``a*x+b``. Χρησιμοποιώντας ένθετα πεδία::" +#: faq/programming.rst:583 +msgid "" +"def linear(a, b):\n" +" def result(x):\n" +" return a * x + b\n" +" return result" +msgstr "" +"def linear(a, b):\n" +" def result(x):\n" +" return a * x + b\n" +" return result" + #: faq/programming.rst:588 msgid "Or using a callable object::" msgstr "Ή χρησιμοποιώντας ένα callable αντικείμενο::" +#: faq/programming.rst:590 +msgid "" +"class linear:\n" +"\n" +" def __init__(self, a, b):\n" +" self.a, self.b = a, b\n" +"\n" +" def __call__(self, x):\n" +" return self.a * x + self.b" +msgstr "" +"class linear:\n" +"\n" +" def __init__(self, a, b):\n" +" self.a, self.b = a, b\n" +"\n" +" def __call__(self, x):\n" +" return self.a * x + self.b" + #: faq/programming.rst:598 msgid "In both cases, ::" msgstr "Και στις δύο περιπτώσεις::" +#: faq/programming.rst:600 +msgid "taxes = linear(0.3, 2)" +msgstr "taxes = linear(0.3, 2)" + #: faq/programming.rst:602 msgid "gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``." msgstr "δίνει ένα callable αντικείμενο όπου ``taxes(10e6) == 0.3 * 10e6 + 2``." @@ -1004,11 +1320,57 @@ msgstr "" "συλλογή από callables μπορεί να μοιραστεί την υπογραφή τους μέσω " "κληρονομικότητας::" +#: faq/programming.rst:608 +msgid "" +"class exponential(linear):\n" +" # __init__ inherited\n" +" def __call__(self, x):\n" +" return self.a * (x ** self.b)" +msgstr "" +"class exponential(linear):\n" +" # __init__ inherited\n" +" def __call__(self, x):\n" +" return self.a * (x ** self.b)" + #: faq/programming.rst:613 msgid "Object can encapsulate state for several methods::" msgstr "" "Το αντικείμενο μπορεί να ενθυλακώσει την κατάσταση για πολλές μεθόδους::" +#: faq/programming.rst:615 +msgid "" +"class counter:\n" +"\n" +" value = 0\n" +"\n" +" def set(self, x):\n" +" self.value = x\n" +"\n" +" def up(self):\n" +" self.value = self.value + 1\n" +"\n" +" def down(self):\n" +" self.value = self.value - 1\n" +"\n" +"count = counter()\n" +"inc, dec, reset = count.up, count.down, count.set" +msgstr "" +"class counter:\n" +"\n" +" value = 0\n" +"\n" +" def set(self, x):\n" +" self.value = x\n" +"\n" +" def up(self):\n" +" self.value = self.value + 1\n" +"\n" +" def down(self):\n" +" self.value = self.value - 1\n" +"\n" +"count = counter()\n" +"inc, dec, reset = count.up, count.down, count.set" + #: faq/programming.rst:631 msgid "" "Here ``inc()``, ``dec()`` and ``reset()`` act like functions which share the " @@ -1038,10 +1400,18 @@ msgstr "" "Ορισμένα αντικείμενα μπορούν να αντιγραφούν πιο εύκολα. Τα λεξικά έχουν μία " "μέθοδο :meth:`~dict.copy`::" +#: faq/programming.rst:644 +msgid "newdict = olddict.copy()" +msgstr "newdict = olddict.copy()" + #: faq/programming.rst:646 msgid "Sequences can be copied by slicing::" msgstr "Οι ακολουθίες μπορούν να αντιγραφούν με τεμαχισμό::" +#: faq/programming.rst:648 +msgid "new_l = l[:]" +msgstr "new_l = l[:]" + #: faq/programming.rst:652 msgid "How can I find the methods or attributes of an object?" msgstr "Πως μπορώ να βρω τις μεθόδους ή τα χαρακτηριστικά ενός αντικειμένου;" @@ -1073,6 +1443,30 @@ msgstr "" "ίδιο ισχύει για τις δηλώσεις ``def`` και ``class``, αλλά σε αυτή την " "περίπτωση η τιμή είναι callable. Λάβετε υπόψη τον ακόλουθο κώδικα::" +#: faq/programming.rst:667 +msgid "" +">>> class A:\n" +"... pass\n" +"...\n" +">>> B = A\n" +">>> a = B()\n" +">>> b = a\n" +">>> print(b)\n" +"<__main__.A object at 0x16D07CC>\n" +">>> print(a)\n" +"<__main__.A object at 0x16D07CC>" +msgstr "" +">>> class A:\n" +"... pass\n" +"...\n" +">>> B = A\n" +">>> a = B()\n" +">>> b = a\n" +">>> print(b)\n" +"<__main__.A object at 0x16D07CC>\n" +">>> print(a)\n" +"<__main__.A object at 0x16D07CC>" + #: faq/programming.rst:678 msgid "" "Arguably the class has a name: even though it is bound to two names and " @@ -1137,6 +1531,14 @@ msgid "Comma is not an operator in Python. Consider this session::" msgstr "" "Το κόμμα δεν είναι τελεστής στην Python. Σκεφτείτε αυτήν την συνεδρία::" +#: faq/programming.rst:705 +msgid "" +">>> \"a\" in \"b\", \"a\"\n" +"(False, 'a')" +msgstr "" +">>> \"a\" in \"b\", \"a\"\n" +"(False, 'a')" + #: faq/programming.rst:708 msgid "" "Since the comma is not an operator, but a separator between expressions the " @@ -1145,10 +1547,18 @@ msgstr "" "Δεδομένου ότι το κόμμα δεν είναι τελεστής, αλλά διαχωριστικό μεταξύ των " "εκφράσεων, τα παραπάνω αξιολογούνται σαν να είχατε εισαγάγει::" +#: faq/programming.rst:711 +msgid "(\"a\" in \"b\"), \"a\"" +msgstr "(\"a\" in \"b\"), \"a\"" + #: faq/programming.rst:713 msgid "not::" msgstr "δεν::" +#: faq/programming.rst:715 +msgid "\"a\" in (\"b\", \"a\")" +msgstr "\"a\" in (\"b\", \"a\")" + #: faq/programming.rst:717 msgid "" "The same is true of the various assignment operators (``=``, ``+=`` etc). " @@ -1167,6 +1577,18 @@ msgstr "Υπάρχει ισοδύναμο του τριαδικού τελεστ msgid "Yes, there is. The syntax is as follows::" msgstr "Ναι υπάρχει, Η σύνταξη έχει ως εξής::" +#: faq/programming.rst:726 +msgid "" +"[on_true] if [expression] else [on_false]\n" +"\n" +"x, y = 50, 25\n" +"small = x if x < y else y" +msgstr "" +"[on_true] if [expression] else [on_false]\n" +"\n" +"x, y = 50, 25\n" +"small = x if x < y else y" + #: faq/programming.rst:731 msgid "" "Before this syntax was introduced in Python 2.5, a common idiom was to use " @@ -1175,6 +1597,10 @@ msgstr "" "Πριν εισαχθεί αυτή η σύνταξη στην Python 2.5, ένα κοινό ιδίωμα ήταν η χρήση " "λογικών τελεστών::" +#: faq/programming.rst:734 +msgid "[expression] and [on_true] or [on_false]" +msgstr "[έκφραση] and [αληθές] or [ψευδές]" + #: faq/programming.rst:736 msgid "" "However, this idiom is unsafe, as it can give wrong results when *on_true* " @@ -1199,6 +1625,58 @@ msgstr "" "keyword:`!lambda`. Δείτε τα ακόλουθα τρία παραδείγματα, ελαφρώς " "προσαρμοσμένα από τον Ulf Bartelt::" +#: faq/programming.rst:747 +msgid "" +"from functools import reduce\n" +"\n" +"# Primes < 1000\n" +"print(list(filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,\n" +"map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))))\n" +"\n" +"# First 10 Fibonacci numbers\n" +"print(list(map(lambda x,f=lambda x,f:(f(x-1,f)+f(x-2,f)) if x>1 else 1:\n" +"f(x,f), range(10))))\n" +"\n" +"# Mandelbrot set\n" +"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\\n'+y,map(lambda " +"y,\n" +"Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,\n" +"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,\n" +"i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y\n" +">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(\n" +"64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy\n" +"))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24))\n" +"# \\___ ___/ \\___ ___/ | | |__ lines on screen\n" +"# V V | |______ columns on screen\n" +"# | | |__________ maximum of \"iterations\"\n" +"# | |_________________ range on y axis\n" +"# |____________________________ range on x axis" +msgstr "" +"from functools import reduce\n" +"\n" +"# Primes < 1000\n" +"print(list(filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,\n" +"map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))))\n" +"\n" +"# First 10 Fibonacci numbers\n" +"print(list(map(lambda x,f=lambda x,f:(f(x-1,f)+f(x-2,f)) if x>1 else 1:\n" +"f(x,f), range(10))))\n" +"\n" +"# Mandelbrot set\n" +"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\\n'+y,map(lambda " +"y,\n" +"Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,\n" +"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,\n" +"i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y\n" +">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(\n" +"64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy\n" +"))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24))\n" +"# \\___ ___/ \\___ ___/ | | |__ lines on screen\n" +"# V V | |______ columns on screen\n" +"# | | |__________ maximum of \"iterations\"\n" +"# | |_________________ range on y axis\n" +"# |____________________________ range on x axis" + #: faq/programming.rst:771 msgid "Don't try this at home, kids!" msgstr "Μην το δοκιμάσετε στο σπίτι, παιδιά!" @@ -1224,6 +1702,20 @@ msgstr "" "είναι μια συνάρτηση που δέχεται μόνο παραμέτρους θέσης. Η τεκμηρίωσή τους " "μοιάζει με αυτό::" +#: faq/programming.rst:786 +msgid "" +">>> help(divmod)\n" +"Help on built-in function divmod in module builtins:\n" +"\n" +"divmod(x, y, /)\n" +" Return the tuple (x//y, x%y). Invariant: div*y + mod == x." +msgstr "" +">>> help(divmod)\n" +"Help on built-in function divmod in module builtins:\n" +"\n" +"divmod(x, y, /)\n" +" Return the tuple (x//y, x%y). Invariant: div*y + mod == x." + #: faq/programming.rst:792 msgid "" "The slash at the end of the parameter list means that both parameters are " @@ -1234,6 +1726,18 @@ msgstr "" "είναι μόνο θέσης. Επομένως, η κλήση της :func:`divmod` με ορίσματα λέξεων " "κλειδιών θα οδηγούσε σε σφάλμα::" +#: faq/programming.rst:796 +msgid "" +">>> divmod(x=3, y=4)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: divmod() takes no keyword arguments" +msgstr "" +">>> divmod(x=3, y=4)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: divmod() takes no keyword arguments" + #: faq/programming.rst:803 msgid "Numbers and strings" msgstr "Αριθμοί και συμβολοσειρές" @@ -1253,6 +1757,16 @@ msgstr "" "τη μεταβλητή \"a\" στην οκταδική τιμή \"10\" (8 σε δεκαδικό), " "πληκτρολογήστε::" +#: faq/programming.rst:812 +msgid "" +">>> a = 0o10\n" +">>> a\n" +"8" +msgstr "" +">>> a = 0o10\n" +">>> a\n" +"8" + #: faq/programming.rst:816 msgid "" "Hexadecimal is just as easy. Simply precede the hexadecimal number with a " @@ -1264,6 +1778,22 @@ msgstr "" "ψηφία μπορούν να καθοριστούν με πεζά ή κεφαλαία. Για παράδειγμα, στον " "διερμηνέα Python::" +#: faq/programming.rst:820 +msgid "" +">>> a = 0xa5\n" +">>> a\n" +"165\n" +">>> b = 0XB2\n" +">>> b\n" +"178" +msgstr "" +">>> a = 0xa5\n" +">>> a\n" +"165\n" +">>> b = 0XB2\n" +">>> b\n" +"178" + #: faq/programming.rst:829 msgid "Why does -22 // 10 return -3?" msgstr "Γιατί το -22 // 10 επιστρέφει -3;" @@ -1276,6 +1806,10 @@ msgstr "" "Οφείλεται κυρίως στην επιθυμία που το ``i % j`` να έχει το ίδιο πρόσημο με " "το ``j``. Εάν το θέλετε αυτό, και θέλετε επίσης::" +#: faq/programming.rst:834 +msgid "i == (i // j) * j + (i % j)" +msgstr "i == (i // j) * j + (i % j)" + #: faq/programming.rst:836 msgid "" "then integer division has to return the floor. C also requires that " @@ -1315,6 +1849,20 @@ msgstr "" "τρόπο δίνει ένα :exc:`SyntaxError` επειδή η περίοδος θεωρείται ως " "υποδιαστολή::" +#: faq/programming.rst:853 +msgid "" +">>> 1.__class__\n" +" File \"\", line 1\n" +" 1.__class__\n" +" ^\n" +"SyntaxError: invalid decimal literal" +msgstr "" +">>> 1.__class__\n" +" File \"\", line 1\n" +" 1.__class__\n" +" ^\n" +"SyntaxError: invalid decimal literal" + #: faq/programming.rst:859 msgid "" "The solution is to separate the literal from the period with either a space " @@ -1330,12 +1878,13 @@ msgstr "Πως μετατρέπω μια συμβολοσειρά σε έναν #: faq/programming.rst:871 msgid "" "For integers, use the built-in :func:`int` type constructor, e.g. " -"``int('144') == 144``. Similarly, :func:`float` converts to floating-point, " -"e.g. ``float('144') == 144.0``." +"``int('144') == 144``. Similarly, :func:`float` converts to a floating-" +"point number, e.g. ``float('144') == 144.0``." msgstr "" "Για ακέραιους αριθμούς, χρησιμοποιήστε τον ενσωματωμένο κατασκευαστή τύπου :" "func:`int` , π.χ. ``int('144') == 144``. Ομοίως, το :func:`float` " -"μετατρέπει σε κινητή υποδιαστολή π.χ. ``float('144') == 144.0``." +"μετατρέπει σε έναν αριθμός κινητής υποδιαστολής π.χ. ``float('144') == " +"144.0``." #: faq/programming.rst:875 msgid "" @@ -1422,6 +1971,52 @@ msgstr "" "δοκιμάστε να χρησιμοποιήσετε ένα αντικείμενο :class:`io.StringIO` ή το " "module :mod:`array`::" +#: faq/programming.rst:914 +msgid "" +">>> import io\n" +">>> s = \"Hello, world\"\n" +">>> sio = io.StringIO(s)\n" +">>> sio.getvalue()\n" +"'Hello, world'\n" +">>> sio.seek(7)\n" +"7\n" +">>> sio.write(\"there!\")\n" +"6\n" +">>> sio.getvalue()\n" +"'Hello, there!'\n" +"\n" +">>> import array\n" +">>> a = array.array('w', s)\n" +">>> print(a)\n" +"array('w', 'Hello, world')\n" +">>> a[0] = 'y'\n" +">>> print(a)\n" +"array('w', 'yello, world')\n" +">>> a.tounicode()\n" +"'yello, world'" +msgstr "" +">>> import io\n" +">>> s = \"Hello, world\"\n" +">>> sio = io.StringIO(s)\n" +">>> sio.getvalue()\n" +"'Hello, world'\n" +">>> sio.seek(7)\n" +"7\n" +">>> sio.write(\"there!\")\n" +"6\n" +">>> sio.getvalue()\n" +"'Hello, there!'\n" +"\n" +">>> import array\n" +">>> a = array.array('w', s)\n" +">>> print(a)\n" +"array('w', 'Hello, world')\n" +">>> a[0] = 'y'\n" +">>> print(a)\n" +"array('w', 'yello, world')\n" +">>> a.tounicode()\n" +"'yello, world'" + #: faq/programming.rst:938 msgid "How do I use strings to call functions/methods?" msgstr "" @@ -1444,10 +2039,40 @@ msgstr "" "συναρτήσεων. Αυτή είναι επίσης η κύρια τεχνική που χρησιμοποιείται για την " "εξομοίωση μιας κατασκευής πεζών-κεφαλαίων::" +#: faq/programming.rst:947 +msgid "" +"def a():\n" +" pass\n" +"\n" +"def b():\n" +" pass\n" +"\n" +"dispatch = {'go': a, 'stop': b} # Note lack of parens for funcs\n" +"\n" +"dispatch[get_input()]() # Note trailing parens to call function" +msgstr "" +"def a():\n" +" pass\n" +"\n" +"def b():\n" +" pass\n" +"\n" +"dispatch = {'go': a, 'stop': b} # Note lack of parens for funcs\n" +"\n" +"dispatch[get_input()]() # Note trailing parens to call function" + #: faq/programming.rst:957 msgid "Use the built-in function :func:`getattr`::" msgstr "Χρησιμοποιείστε την ενσωματωμένη συνάρτηση :func:`getattr`::" +#: faq/programming.rst:959 +msgid "" +"import foo\n" +"getattr(foo, 'bar')()" +msgstr "" +"import foo\n" +"getattr(foo, 'bar')()" + #: faq/programming.rst:962 msgid "" "Note that :func:`getattr` works on any object, including classes, class " @@ -1461,18 +2086,58 @@ msgid "This is used in several places in the standard library, like this::" msgstr "" "Αυτό χρησιμοποιείται σε πολλά σημεία της τυπικής βιβλιοθήκης, όπως αυτό::" +#: faq/programming.rst:967 +msgid "" +"class Foo:\n" +" def do_foo(self):\n" +" ...\n" +"\n" +" def do_bar(self):\n" +" ...\n" +"\n" +"f = getattr(foo_instance, 'do_' + opname)\n" +"f()" +msgstr "" +"class Foo:\n" +" def do_foo(self):\n" +" ...\n" +"\n" +" def do_bar(self):\n" +" ...\n" +"\n" +"f = getattr(foo_instance, 'do_' + opname)\n" +"f()" + #: faq/programming.rst:978 msgid "Use :func:`locals` to resolve the function name::" msgstr "" "Χρησιμοποιήστε το :func:`locals` για να επιλύσετε το όνομα της συνάρτησης::" +#: faq/programming.rst:980 +msgid "" +"def myFunc():\n" +" print(\"hello\")\n" +"\n" +"fname = \"myFunc\"\n" +"\n" +"f = locals()[fname]\n" +"f()" +msgstr "" +"def myFunc():\n" +" print(\"hello\")\n" +"\n" +"fname = \"myFunc\"\n" +"\n" +"f = locals()[fname]\n" +"f()" + #: faq/programming.rst:990 msgid "" -"Is there an equivalent to Perl's chomp() for removing trailing newlines from " -"strings?" +"Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines " +"from strings?" msgstr "" -"Υπάρχει ισοδύναμο με το Perl's chomp() για την αφαίρεση των νέων γραμμών από " -"τις συμβολοσειρές;" +"Υπάρχει ισοδύναμο με το Perl's ``chomp()`` για την αφαίρεση των νέων γραμμών " +"από τις συμβολοσειρές;" #: faq/programming.rst:992 msgid "" @@ -1488,6 +2153,20 @@ msgstr "" "αντιπροσωπεύει περισσότερες από μία γραμμές στο τέλος, οι terminators " "γραμμής για όλες τις κενές γραμμές θα αφαιρεθούν::" +#: faq/programming.rst:998 +msgid "" +">>> lines = (\"line 1 \\r\\n\"\n" +"... \"\\r\\n\"\n" +"... \"\\r\\n\")\n" +">>> lines.rstrip(\"\\n\\r\")\n" +"'line 1 '" +msgstr "" +">>> lines = (\"line 1 \\r\\n\"\n" +"... \"\\r\\n\"\n" +"... \"\\r\\n\")\n" +">>> lines.rstrip(\"\\n\\r\")\n" +"'line 1 '" + #: faq/programming.rst:1004 msgid "" "Since this is typically only desired when reading text one line at a time, " @@ -1497,8 +2176,8 @@ msgstr "" "μία γραμμή τη φορά, η χρήση του ``S.rstrip()`` λειτουργεί καλά." #: faq/programming.rst:1009 -msgid "Is there a scanf() or sscanf() equivalent?" -msgstr "Υπάρχει αντίστοιχο scanf() ή sscanf();" +msgid "Is there a ``scanf()`` or ``sscanf()`` equivalent?" +msgstr "Υπάρχει αντίστοιχο ``scanf()`` ή ``sscanf()``;" #: faq/programming.rst:1011 msgid "Not as such." @@ -1509,7 +2188,7 @@ msgid "" "For simple input parsing, the easiest approach is usually to split the line " "into whitespace-delimited words using the :meth:`~str.split` method of " "string objects and then convert decimal strings to numeric values using :" -"func:`int` or :func:`float`. :meth:`!split()` supports an optional \"sep\" " +"func:`int` or :func:`float`. :meth:`!split` supports an optional \"sep\" " "parameter which is useful if the line uses something other than whitespace " "as a separator." msgstr "" @@ -1517,9 +2196,9 @@ msgstr "" "διαχωρισμός της γραμμής σε λέξεις οριοθετημένες με κενά διαστήματα " "χρησιμοποιώντας τη μέθοδο :meth:`~str.split` αντικειμένων συμβολοσειρών και " "στη συνέχεια μετατροπή δεκαδικών συμβολοσειρών σε αριθμητικές τιμές " -"χρησιμοποιώντας :func:`int` ή :func:`float`. :meth:`!split()` υποστηρίζει " -"μια προαιρετική παράμετρο \"sep\" που είναι χρήσιμη εάν η γραμμή " -"χρησιμοποιεί κάτι διαφορετικό από κενό διάστημα ως διαχωριστικό." +"χρησιμοποιώντας :func:`int` ή :func:`float`. :meth:`!split` υποστηρίζει μια " +"προαιρετική παράμετρο \"sep\" που είναι χρήσιμη εάν η γραμμή χρησιμοποιεί " +"κάτι διαφορετικό από κενό διάστημα ως διαχωριστικό." #: faq/programming.rst:1019 msgid "" @@ -1530,8 +2209,8 @@ msgstr "" "από τις ``sscanf`` της C και είναι πιο κατάλληλες για την εργασία." #: faq/programming.rst:1024 -msgid "What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?" -msgstr "Τι σημαίνει το σφάλμα 'UnicodeDecodeError' ή 'UnicodeEncodeError';" +msgid "What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean?" +msgstr "Τι σημαίνει το σφάλμα ``UnicodeDecodeError`` ή ``UnicodeEncodeError``;" #: faq/programming.rst:1026 msgid "See the :ref:`unicode-howto`." @@ -1551,6 +2230,20 @@ msgstr "" "Μια ακατέργαστη συμβολοσειρά που τελειώνει με περιττό αριθμό backslashes θα " "ξεφύγει από το απόσπασμα της συμβολοσειράς::" +#: faq/programming.rst:1036 +msgid "" +">>> r'C:\\this\\will\\not\\work\\'\n" +" File \"\", line 1\n" +" r'C:\\this\\will\\not\\work\\'\n" +" ^\n" +"SyntaxError: unterminated string literal (detected at line 1)" +msgstr "" +">>> r'C:\\this\\will\\not\\work\\'\n" +" File \"\", line 1\n" +" r'C:\\this\\will\\not\\work\\'\n" +" ^\n" +"SyntaxError: unterminated string literal (detected at line 1)" + #: faq/programming.rst:1042 msgid "" "There are several workarounds for this. One is to use regular strings and " @@ -1559,6 +2252,14 @@ msgstr "" "Υπάρχουν αρκετές λύσεις για αυτό. Ο ένας είναι να χρησιμοποιήσετε κανονικές " "συμβολοσειρές και να διπλασιάσετε τα backslashes::" +#: faq/programming.rst:1045 +msgid "" +">>> 'C:\\\\this\\\\will\\\\work\\\\'\n" +"'C:\\\\this\\\\will\\\\work\\\\'" +msgstr "" +">>> 'C:\\\\this\\\\will\\\\work\\\\'\n" +"'C:\\\\this\\\\will\\\\work\\\\'" + #: faq/programming.rst:1048 msgid "" "Another is to concatenate a regular string containing an escaped backslash " @@ -1567,6 +2268,14 @@ msgstr "" "Ένα άλλο είναι να συνδέσετε μια κανονική συμβολοσειρά που περιέχει ένα " "escaped backslash στην ακατέργαστη συμβολοσειρά::" +#: faq/programming.rst:1051 +msgid "" +">>> r'C:\\this\\will\\work' '\\\\'\n" +"'C:\\\\this\\\\will\\\\work\\\\'" +msgstr "" +">>> r'C:\\this\\will\\work' '\\\\'\n" +"'C:\\\\this\\\\will\\\\work\\\\'" + #: faq/programming.rst:1054 msgid "" "It is also possible to use :func:`os.path.join` to append a backslash on " @@ -1575,6 +2284,14 @@ msgstr "" "Είναι επίσης δυνατό να χρησιμοποιήσετε το :func:`os.path.join` για να " "προσθέσετε ένα backslash στα Windows::" +#: faq/programming.rst:1056 +msgid "" +">>> os.path.join(r'C:\\this\\will\\work', '')\n" +"'C:\\\\this\\\\will\\\\work\\\\'" +msgstr "" +">>> os.path.join(r'C:\\this\\will\\work', '')\n" +"'C:\\\\this\\\\will\\\\work\\\\'" + #: faq/programming.rst:1059 msgid "" "Note that while a backslash will \"escape\" a quote for the purposes of " @@ -1588,6 +2305,14 @@ msgstr "" "Δηλαδή, το backslash παραμένει παρόν στην τιμή της ακατέργαστης " "συμβολοσειράς::" +#: faq/programming.rst:1064 +msgid "" +">>> r'backslash\\'preserved'\n" +"\"backslash\\\\'preserved\"" +msgstr "" +">>> r'backslash\\'preserved'\n" +"\"backslash\\\\'preserved\"" + #: faq/programming.rst:1067 msgid "Also see the specification in the :ref:`language reference `." msgstr "Δείτε επίσης την προδιαγραφή στην :ref:`language reference `." @@ -1728,7 +2453,7 @@ msgstr "" "υπάρχουν εργαλεία που θα σας απομακρύνουν. Για παράδειγμα, το `Cython " "`_ μπορεί να μεταγλωττίσει μια ελαφρώς τροποποιημένη " "έκδοση του κώδικα Python σε μια επέκταση C, και μπορεί να χρησιμοποιηθεί σε " -"πολλές διαφορετικές πλατφόρμες. Η Cypthon μπορεί να εκμεταλλευτεί την " +"πολλές διαφορετικές πλατφόρμες. Η Cython μπορεί να εκμεταλλευτεί την " "μεταγλώττιση (και τους προαιρετικούς σχολιασμούς) για να κάνει τον κώδικα " "σας πολύ πιο γρήγορο από όταν ερμηνεύεται. Εάν είστε σίγουροι για τις " "δεξιότητές σας στον προγραμματισμό C, μπορείτε επίσης να :ref:`write a C " @@ -1769,6 +2494,18 @@ msgstr "" "είναι να τα τοποθετήσετε σε μια λίστα και να καλέσετε το στο :meth:`str." "join` τέλος::" +#: faq/programming.rst:1141 +msgid "" +"chunks = []\n" +"for s in my_strings:\n" +" chunks.append(s)\n" +"result = ''.join(chunks)" +msgstr "" +"chunks = []\n" +"for s in my_strings:\n" +" chunks.append(s)\n" +"result = ''.join(chunks)" + #: faq/programming.rst:1146 msgid "(another reasonably efficient idiom is to use :class:`io.StringIO`)" msgstr "" @@ -1785,6 +2522,16 @@ msgstr "" "είναι η επέκταση ενός αντικειμένου :class:`bytearray` χρησιμοποιώντας " "επιτόπια συνένωση (ο τελεστής ``+=``)::" +#: faq/programming.rst:1151 +msgid "" +"result = bytearray()\n" +"for b in my_bytes_objects:\n" +" result += b" +msgstr "" +"result = bytearray()\n" +"for b in my_bytes_objects:\n" +" result += b" + #: faq/programming.rst:1157 msgid "Sequences (Tuples/Lists)" msgstr "Ακολουθίες (Πλειάδες/Λίστες)" @@ -1865,6 +2612,14 @@ msgstr "Πώς μπορώ να επαναλάβω μια ακολουθία με msgid "Use the :func:`reversed` built-in function::" msgstr "Χρησιμοποιείστε την ενσωματωμένη συνάρτηση :func:`reversed`::" +#: faq/programming.rst:1194 +msgid "" +"for x in reversed(sequence):\n" +" ... # do something with x ..." +msgstr "" +"for x in reversed(sequence):\n" +" ... # do something with x ..." + #: faq/programming.rst:1197 msgid "" "This won't touch your original sequence, but build a new copy with reversed " @@ -1895,6 +2650,26 @@ msgstr "" "Εάν δεν σας πειράζει να αναδιατάξετε τη λίστα, ταξινομήστε την και μετά " "σαρώστε από το τέλος της λίστας, διαγράφοντας τα διπλότυπα καθώς προχωράτε::" +#: faq/programming.rst:1211 +msgid "" +"if mylist:\n" +" mylist.sort()\n" +" last = mylist[-1]\n" +" for i in range(len(mylist)-2, -1, -1):\n" +" if last == mylist[i]:\n" +" del mylist[i]\n" +" else:\n" +" last = mylist[i]" +msgstr "" +"if mylist:\n" +" mylist.sort()\n" +" last = mylist[-1]\n" +" for i in range(len(mylist)-2, -1, -1):\n" +" if last == mylist[i]:\n" +" del mylist[i]\n" +" else:\n" +" last = mylist[i]" + #: faq/programming.rst:1220 msgid "" "If all elements of the list may be used as set keys (i.e. they are all :term:" @@ -1903,6 +2678,10 @@ msgstr "" "Εάν όλα τα στοιχεία της λίστας μπορούν να χρησιμοποιηθούν ως κλειδιά συνόλου " "(δηλαδή είναι όλα τα :term:`hashable`) αυτό είναι συχνά πιο γρήγορο::" +#: faq/programming.rst:1223 +msgid "mylist = list(set(mylist))" +msgstr "mylist = list(set(mylist))" + #: faq/programming.rst:1225 msgid "" "This converts the list into a set, thereby removing duplicates, and then " @@ -1927,6 +2706,16 @@ msgstr "" "πιο γρήγορο να χρησιμοποιήσετε την αντικατάσταση τμημάτων με ένα έμμεσο ή " "ρητώς προς τα εμπρός iteration. Ακολουθούν τρεις παραλλαγές::" +#: faq/programming.rst:1237 +msgid "" +"mylist[:] = filter(keep_function, mylist)\n" +"mylist[:] = (x for x in mylist if keep_condition)\n" +"mylist[:] = [x for x in mylist if keep_condition]" +msgstr "" +"mylist[:] = filter(keep_function, mylist)\n" +"mylist[:] = (x for x in mylist if keep_condition)\n" +"mylist[:] = [x for x in mylist if keep_condition]" + #: faq/programming.rst:1241 msgid "The list comprehension may be fastest." msgstr "Το comprehension της λίστας μπορεί να είναι ταχύτερο." @@ -1939,6 +2728,10 @@ msgstr "Πως μπορείτε να φτιάξετε έναν πίνακα στ msgid "Use a list::" msgstr "Χρησιμοποιήστε μια λίστα::" +#: faq/programming.rst:1249 +msgid "[\"this\", 1, \"is\", \"an\", \"array\"]" +msgstr "[\"αυτή\", 1, \"είναι\", \"μια\", \"λίστα\"]" + #: faq/programming.rst:1251 msgid "" "Lists are equivalent to C or Pascal arrays in their time complexity; the " @@ -1969,6 +2762,10 @@ msgstr "" "Για να λάβετε συνδεδεμένες λίστες τύπου Lisp, μπορείτε να εξομοιώσετε *cons " "κελιά* χρησιμοποιώντας πλειάδες::" +#: faq/programming.rst:1262 +msgid "lisp_list = (\"like\", (\"this\", (\"example\", None) ) )" +msgstr "lisp_list = (\"όπως\", (\"αυτό\", (\"το παράδειγμα\", None) ) )" + #: faq/programming.rst:1264 msgid "" "If mutability is desired, you could use lists instead of tuples. Here the " @@ -1990,14 +2787,36 @@ msgstr "Πως φτιάχνω μια πολυδιάστατη λίστα;" msgid "You probably tried to make a multidimensional array like this::" msgstr "Μάλλον προσπαθήσατε να φτιάξετε έναν πολυδιάστατο πίνακα σαν αυτόν::" +#: faq/programming.rst:1277 +msgid ">>> A = [[None] * 2] * 3" +msgstr ">>> A = [[None] * 2] * 3" + #: faq/programming.rst:1279 msgid "This looks correct if you print it:" msgstr "Αυτό φαίνεται σωστό αν το εκτυπώσετε:" +#: faq/programming.rst:1285 +msgid "" +">>> A\n" +"[[None, None], [None, None], [None, None]]" +msgstr "" +">>> A\n" +"[[None, None], [None, None], [None, None]]" + #: faq/programming.rst:1290 msgid "But when you assign a value, it shows up in multiple places:" msgstr "Αλλά όταν εκχωρείτε μια τιμή, εμφανίζεται σε πολλά σημεία:" +#: faq/programming.rst:1296 +msgid "" +">>> A[0][0] = 5\n" +">>> A\n" +"[[5, None], [5, None], [5, None]]" +msgstr "" +">>> A[0][0] = 5\n" +">>> A\n" +"[[5, None], [5, None], [5, None]]" + #: faq/programming.rst:1302 msgid "" "The reason is that replicating a list with ``*`` doesn't create copies, it " @@ -2020,6 +2839,16 @@ msgstr "" "επιθυμητό μήκος και στη συνέχεια να συμπληρώσετε κάθε στοιχείο με μια νέα " "λίστα::" +#: faq/programming.rst:1310 +msgid "" +"A = [None] * 3\n" +"for i in range(3):\n" +" A[i] = [None] * 2" +msgstr "" +"A = [None] * 3\n" +"for i in range(3):\n" +" A[i] = [None] * 2" + #: faq/programming.rst:1314 msgid "" "This generates a list containing 3 different lists of length two. You can " @@ -2028,6 +2857,14 @@ msgstr "" "Αυτό δημιουργεί μια λίστα που περιέχει 3 διαφορετικές λίστες με μήκος δύο. " "Μπορείτε επίσης να χρησιμοποιήσετε ένα comprehension λίστας::" +#: faq/programming.rst:1317 +msgid "" +"w, h = 2, 3\n" +"A = [[None] * w for i in range(h)]" +msgstr "" +"w, h = 2, 3\n" +"A = [[None] * w for i in range(h)]" + #: faq/programming.rst:1320 msgid "" "Or, you can use an extension that provides a matrix datatype; `NumPy " @@ -2052,6 +2889,16 @@ msgstr "" "επιστρεφόμενες τιμές είναι μια λίστα, ένα :term:`list comprehension` είναι " "μια κομψή λύση::" +#: faq/programming.rst:1330 +msgid "" +"result = [obj.method() for obj in mylist]\n" +"\n" +"result = [function(obj) for obj in mylist]" +msgstr "" +"result = [obj.method() for obj in mylist]\n" +"\n" +"result = [function(obj) for obj in mylist]" + #: faq/programming.rst:1334 msgid "" "To just run the method or function without saving the return values, a " @@ -2060,6 +2907,20 @@ msgstr "" "Για να εκτελέσετε απλώς τη μέθοδο ή τη συνάρτηση χωρίς να αποθηκεύσετε τις " "επιστρεφόμενες τιμές, αρκεί ένας απλός βρόχος :keyword:`for`::" +#: faq/programming.rst:1337 +msgid "" +"for obj in mylist:\n" +" obj.method()\n" +"\n" +"for obj in mylist:\n" +" function(obj)" +msgstr "" +"for obj in mylist:\n" +" obj.method()\n" +"\n" +"for obj in mylist:\n" +" function(obj)" + #: faq/programming.rst:1346 msgid "" "Why does a_tuple[i] += ['item'] raise an exception when the addition works?" @@ -2091,6 +2952,20 @@ msgstr "" msgid "If you wrote::" msgstr "Εάν γράψετε::" +#: faq/programming.rst:1358 +msgid "" +">>> a_tuple = (1, 2)\n" +">>> a_tuple[0] += 1\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" +msgstr "" +">>> a_tuple = (1, 2)\n" +">>> a_tuple[0] += 1\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" + #: faq/programming.rst:1364 msgid "" "The reason for the exception should be immediately clear: ``1`` is added to " @@ -2114,6 +2989,20 @@ msgstr "" "Κάτω από τα καλύμματα, αυτό που κάνει αυτή η επαυξημένη δήλωση ανάθεσης " "είναι περίπου το εξής::" +#: faq/programming.rst:1373 +msgid "" +">>> result = a_tuple[0] + 1\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" +msgstr "" +">>> result = a_tuple[0] + 1\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" + #: faq/programming.rst:1379 msgid "" "It is the assignment part of the operation that produces the error, since a " @@ -2126,6 +3015,20 @@ msgstr "" msgid "When you write something like::" msgstr "Όταν γράφετε κάτι σαν::" +#: faq/programming.rst:1384 +msgid "" +">>> a_tuple = (['foo'], 'bar')\n" +">>> a_tuple[0] += ['item']\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" +msgstr "" +">>> a_tuple = (['foo'], 'bar')\n" +">>> a_tuple[0] += ['item']\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" + #: faq/programming.rst:1390 msgid "" "The exception is a bit more surprising, and even more surprising is the fact " @@ -2134,27 +3037,56 @@ msgstr "" "Η εξαίρεση είναι λίγο πιο εκπληκτική, και ακόμη πιο εκπληκτικό είναι το " "γεγονός ότι παρόλο που υπήρχε ένα σφάλμα, το παράρτημα λειτούργησε::" +#: faq/programming.rst:1393 +msgid "" +">>> a_tuple[0]\n" +"['foo', 'item']" +msgstr "" +">>> a_tuple[0]\n" +"['foo', 'item']" + #: faq/programming.rst:1396 msgid "" "To see why this happens, you need to know that (a) if an object implements " "an :meth:`~object.__iadd__` magic method, it gets called when the ``+=`` " "augmented assignment is executed, and its return value is what gets used in " "the assignment statement; and (b) for lists, :meth:`!__iadd__` is equivalent " -"to calling :meth:`!extend` on the list and returning the list. That's why " -"we say that for lists, ``+=`` is a \"shorthand\" for :meth:`!list.extend`::" +"to calling :meth:`~sequence.extend` on the list and returning the list. " +"That's why we say that for lists, ``+=`` is a \"shorthand\" for :meth:`list." +"extend`::" msgstr "" "Για να δείτε γιατί συμβαίνει αυτό, πρέπει να γνωρίζετε ότι (α) εάν ένα " "αντικείμενο υλοποιεί μια μαγική μέθοδο :meth:`~object.__iadd__`, που " "καλείται όταν εκτελείται η επαυξημένη ανάθεση ``+=`` και η τιμή επιστροφής " "είναι αυτή που χρησιμοποιείται στη δήλωση εκχώρησης∙ και (β) για λίστες, :" -"meth:`!__iadd__` ισοδυναμεί με την κλήση του :meth:`!extend` στη λίστα και " -"επιστρέφει τη λίστα. Για αυτό λέμε ότι για λίστες ``+=`` είναι μια " -"\"συντομογραφία\" για :meth:`!list.extend`::" +"meth:`!__iadd__` ισοδυναμεί με την κλήση του :meth:`~sequence.extend` στη " +"λίστα και επιστρέφει τη λίστα. Για αυτό λέμε ότι για λίστες ``+=`` είναι " +"μια \"συντομογραφία\" για :meth:`list.extend`::" + +#: faq/programming.rst:1404 +msgid "" +">>> a_list = []\n" +">>> a_list += [1]\n" +">>> a_list\n" +"[1]" +msgstr "" +">>> a_list = []\n" +">>> a_list += [1]\n" +">>> a_list\n" +"[1]" #: faq/programming.rst:1409 msgid "This is equivalent to::" msgstr "Αυτό ισοδυναμεί με::" +#: faq/programming.rst:1411 +msgid "" +">>> result = a_list.__iadd__([1])\n" +">>> a_list = result" +msgstr "" +">>> result = a_list.__iadd__([1])\n" +">>> a_list = result" + #: faq/programming.rst:1414 msgid "" "The object pointed to by a_list has been mutated, and the pointer to the " @@ -2172,6 +3104,20 @@ msgstr "" msgid "Thus, in our tuple example what is happening is equivalent to::" msgstr "Έτσι, στο παράδειγμά μας, αυτό που συμβαίνει είναι ισοδύναμο με::" +#: faq/programming.rst:1421 +msgid "" +">>> result = a_tuple[0].__iadd__(['item'])\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" +msgstr "" +">>> result = a_tuple[0].__iadd__(['item'])\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" + #: faq/programming.rst:1427 msgid "" "The :meth:`!__iadd__` succeeds, and thus the list is extended, but even " @@ -2204,6 +3150,14 @@ msgstr "" "στοιχείο στην \" τιμή ταξινόμησης\" του. Στην Python, χρησιμοποιήστε το " "όρισμα ``key`` για τη μέθοδο :meth:`list.sort`::" +#: faq/programming.rst:1439 +msgid "" +"Isorted = L[:]\n" +"Isorted.sort(key=lambda s: int(s[10:15]))" +msgstr "" +"Isorted = L[:]\n" +"Isorted.sort(key=lambda s: int(s[10:15]))" + #: faq/programming.rst:1444 msgid "How can I sort one list by values from another list?" msgstr "" @@ -2217,6 +3171,30 @@ msgstr "" "Συγχωνεύστε τα σε έναν iterator πλειάδων, ταξινομήστε τη λίστα που προκύπτει " "και, στην συνέχεια επιλέξτε το στοιχείο που θέλετε. ::" +#: faq/programming.rst:1449 +msgid "" +">>> list1 = [\"what\", \"I'm\", \"sorting\", \"by\"]\n" +">>> list2 = [\"something\", \"else\", \"to\", \"sort\"]\n" +">>> pairs = zip(list1, list2)\n" +">>> pairs = sorted(pairs)\n" +">>> pairs\n" +"[(\"I'm\", 'else'), ('by', 'sort'), ('sorting', 'to'), ('what', " +"'something')]\n" +">>> result = [x[1] for x in pairs]\n" +">>> result\n" +"['else', 'sort', 'to', 'something']" +msgstr "" +">>> list1 = [\"τι\", \"κάνω\", \"ταξινόμηση\", \"με\"]\n" +">>> list2 = [\"κάτι\", \"διαφορετικό\", \"του\", \"ταξινομώ\"]\n" +">>> pairs = zip(list1, list2)\n" +">>> pairs = sorted(pairs)\n" +">>> pairs\n" +"[(\"Εγώ\", 'διαφορετικά'), ('από', 'ταξινομώ'), ('ταξινόμηση', 'σε'), ('τι', " +"'κάτι')]\n" +">>> result = [x[1] for x in pairs]\n" +">>> result\n" +"['διαφορετικά', 'ταξινομώ', 'με', 'κάτι']" + #: faq/programming.rst:1461 msgid "Objects" msgstr "Αντικείμενα" @@ -2270,6 +3248,16 @@ msgstr "" "καλείτε ως ``x.name(ορίσματα...)``. Οι μέθοδοι ορίζονται ως συναρτήσεις " "εντός του ορισμού κλάσης::" +#: faq/programming.rst:1485 +msgid "" +"class C:\n" +" def meth(self, arg):\n" +" return arg * 2 + self.attribute" +msgstr "" +"class C:\n" +" def meth(self, arg):\n" +" return arg * 2 + self.attribute" + #: faq/programming.rst:1491 msgid "What is self?" msgstr "Τι είναι το self;" @@ -2329,6 +3317,61 @@ msgstr "" "κληρονομήσει άμεσα ή έμμεσα από αυτό. Για να ελέγξετε μια \"αληθινή " "κληρονομικότητα\", σαρώστε το :term:`MRO` της κλάσης::" +#: faq/programming.rst:1516 +msgid "" +"from collections.abc import Mapping\n" +"\n" +"class P:\n" +" pass\n" +"\n" +"class C(P):\n" +" pass\n" +"\n" +"Mapping.register(P)" +msgstr "" +"from collections.abc import Mapping\n" +"\n" +"class P:\n" +" pass\n" +"\n" +"class C(P):\n" +" pass\n" +"\n" +"Mapping.register(P)" + +#: faq/programming.rst:1528 +msgid "" +">>> c = C()\n" +">>> isinstance(c, C) # direct\n" +"True\n" +">>> isinstance(c, P) # indirect\n" +"True\n" +">>> isinstance(c, Mapping) # virtual\n" +"True\n" +"\n" +"# Actual inheritance chain\n" +">>> type(c).__mro__\n" +"(, , )\n" +"\n" +"# Test for \"true inheritance\"\n" +">>> Mapping in type(c).__mro__\n" +"False" +msgstr "" +">>> c = C()\n" +">>> isinstance(c, C) # direct\n" +"True\n" +">>> isinstance(c, P) # indirect\n" +"True\n" +">>> isinstance(c, Mapping) # virtual\n" +"True\n" +"\n" +"# Actual inheritance chain\n" +">>> type(c).__mro__\n" +"(, , )\n" +"\n" +"# Test for \"true inheritance\"\n" +">>> Mapping in type(c).__mro__\n" + #: faq/programming.rst:1546 msgid "" "Note that most programs do not use :func:`isinstance` on user-defined " @@ -2346,6 +3389,22 @@ msgstr "" "διαφορετικό με βάση την κλάση που είναι, για παράδειγμα, εάν έχετε μια " "συνάρτηση που κάνει κάτι::" +#: faq/programming.rst:1553 +msgid "" +"def search(obj):\n" +" if isinstance(obj, Mailbox):\n" +" ... # code to search a mailbox\n" +" elif isinstance(obj, Document):\n" +" ... # code to search a document\n" +" elif ..." +msgstr "" +"def search(obj):\n" +" if isinstance(obj, Mailbox):\n" +" ... # code to search a mailbox\n" +" elif isinstance(obj, Document):\n" +" ... # code to search a document\n" +" elif ..." + #: faq/programming.rst:1560 msgid "" "A better approach is to define a ``search()`` method on all the classes and " @@ -2354,6 +3413,28 @@ msgstr "" "Μια καλύτερη προσέγγιση είναι να ορίσετε μια μέθοδο ``search()`` σε όλες τις " "κλάσεις και απλώς να την καλέσετε::" +#: faq/programming.rst:1563 +msgid "" +"class Mailbox:\n" +" def search(self):\n" +" ... # code to search a mailbox\n" +"\n" +"class Document:\n" +" def search(self):\n" +" ... # code to search a document\n" +"\n" +"obj.search()" +msgstr "" +"class Mailbox:\n" +" def search(self):\n" +" ... # code to search a mailbox\n" +"\n" +"class Document:\n" +" def search(self):\n" +" ... # code to search a document\n" +"\n" +"obj.search()" + #: faq/programming.rst:1575 msgid "What is delegation?" msgstr "Τι είναι το delegation;" @@ -2383,6 +3464,30 @@ msgstr "" "παράδειγμα, η ακόλουθη κλάση υλοποιεί μια κλάση που συμπεριφέρεται σαν " "αρχείο αλλά μετατρέπει όλα τα γραπτά δεδομένα σε κεφαλαία::" +#: faq/programming.rst:1587 +msgid "" +"class UpperOut:\n" +"\n" +" def __init__(self, outfile):\n" +" self._outfile = outfile\n" +"\n" +" def write(self, s):\n" +" self._outfile.write(s.upper())\n" +"\n" +" def __getattr__(self, name):\n" +" return getattr(self._outfile, name)" +msgstr "" +"class UpperOut:\n" +"\n" +" def __init__(self, outfile):\n" +" self._outfile = outfile\n" +"\n" +" def write(self, s):\n" +" self._outfile.write(s.upper())\n" +"\n" +" def __getattr__(self, name):\n" +" return getattr(self._outfile, name)" + #: faq/programming.rst:1598 msgid "" "Here the ``UpperOut`` class redefines the ``write()`` method to convert the " @@ -2414,17 +3519,50 @@ msgstr "" "πρέπει να το κάνει προσεκτικά. Η βασική υλοποίηση του :meth:`!__setattr__` " "είναι περίπου ισοδύναμο με το εξής::" +#: faq/programming.rst:1610 +msgid "" +"class X:\n" +" ...\n" +" def __setattr__(self, name, value):\n" +" self.__dict__[name] = value\n" +" ..." +msgstr "" +"class X:\n" +" ...\n" +" def __setattr__(self, name, value):\n" +" self.__dict__[name] = value\n" +" ..." + #: faq/programming.rst:1616 msgid "" -"Most :meth:`!__setattr__` implementations must modify :meth:`self.__dict__ " -"` to store local state for self without causing an infinite " -"recursion." +"Many :meth:`~object.__setattr__` implementations call :meth:`!object." +"__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" -"Οι περισσότερες υλοποιήσεις :meth:`!__setattr__` πρέπει να τροποποιήσουν το :" -"meth:`self.__dict__ ` για να αποθηκεύουν την τοπική " -"κατάσταση για τον εαυτό τους χωρίς να προκαλούν άπειρη αναδρομή." +"Πολλές υλοποιήσεις :meth:`~object.__setattr__` καλούν την ::meth:`!object." +"__setattr__` για να θέσουν μια μεταβλητή στον εαυτό τους χωρίς να προκαλούν " +"άπειρη αναδρομή." -#: faq/programming.rst:1622 +#: faq/programming.rst:1619 +msgid "" +"class X:\n" +" def __setattr__(self, name, value):\n" +" # Custom logic here...\n" +" object.__setattr__(self, name, value)" +msgstr "" +"class X:\n" +" def __setattr__(self, name, value):\n" +" # Custom logic here...\n" +" object.__setattr__(self, name, value)" + +#: faq/programming.rst:1624 +msgid "" +"Alternatively, it is possible to set attributes by inserting entries into :" +"attr:`self.__dict__ ` directly." +msgstr "" +"Εναλλακτικά, είναι δυνατό να ορίσετε χαρακτηριστικά εισάγοντας καταχωρήσεις " +"στο :attr:`self.__dict__ ` απευθείας." + +#: faq/programming.rst:1629 msgid "" "How do I call a method defined in a base class from a derived class that " "extends it?" @@ -2432,11 +3570,21 @@ msgstr "" "Πώς μπορώ να καλέσω μια μέθοδο που ορίζεται σε μια βασική κλάση από μια " "παράγωγη κλάση που την επεκτείνει;" -#: faq/programming.rst:1624 +#: faq/programming.rst:1631 msgid "Use the built-in :func:`super` function::" msgstr "Χρησιμοποιήστε την ενσωματωμένη συνάρτηση :func:`super`::" -#: faq/programming.rst:1630 +#: faq/programming.rst:1633 +msgid "" +"class Derived(Base):\n" +" def meth(self):\n" +" super().meth() # calls Base.meth" +msgstr "" +"class Derived(Base):\n" +" def meth(self):\n" +" super().meth() # calls Base.meth" + +#: faq/programming.rst:1637 msgid "" "In the example, :func:`super` will automatically determine the instance from " "which it was called (the ``self`` value), look up the :term:`method " @@ -2448,13 +3596,13 @@ msgstr "" "order` (MRO) με ``type(self).__mro__``, και επιστρέψτε το επόμενο στη σειρά " "μετά το ``Derived`` στο MRO: ``Base``." -#: faq/programming.rst:1637 +#: faq/programming.rst:1644 msgid "How can I organize my code to make it easier to change the base class?" msgstr "" "Πως μπορώ να οργανώσω τον κώδικα μου προκειμένου να διευκολύνω την αλλαγή " "της βασικής κλάσης;" -#: faq/programming.rst:1639 +#: faq/programming.rst:1646 msgid "" "You could assign the base class to an alias and derive from the alias. Then " "all you have to change is the value assigned to the alias. Incidentally, " @@ -2467,11 +3615,29 @@ msgstr "" "επίσης χρήσιμο εάν θέλετε να αποφασίσετε δυναμικά (π.χ. ανάλογα με την " "διαθεσιμότητα των πόρων) ποια βασική κλάση να χρησιμοποιήσετε Παράδειγμα::" -#: faq/programming.rst:1654 +#: faq/programming.rst:1651 +msgid "" +"class Base:\n" +" ...\n" +"\n" +"BaseAlias = Base\n" +"\n" +"class Derived(BaseAlias):\n" +" ..." +msgstr "" +"class Base:\n" +" ...\n" +"\n" +"BaseAlias = Base\n" +"\n" +"class Derived(BaseAlias):\n" +" ..." + +#: faq/programming.rst:1661 msgid "How do I create static class data and static class methods?" msgstr "Πως δημιουργώ δεδομένα στατικής κλάσης και μεθόδους στατικής κλάσης;" -#: faq/programming.rst:1656 +#: faq/programming.rst:1663 msgid "" "Both static data and static methods (in the sense of C++ or Java) are " "supported in Python." @@ -2479,7 +3645,7 @@ msgstr "" "Τόσο τα στατιστικά δεδομένα όσο και οι στατικές μέθοδοι (με την έννοια της C+" "+ ή της Java) υποστηρίζονται στην Python." -#: faq/programming.rst:1659 +#: faq/programming.rst:1666 msgid "" "For static data, simply define a class attribute. To assign a new value to " "the attribute, you have to explicitly use the class name in the assignment::" @@ -2488,7 +3654,27 @@ msgstr "" "εκχωρήσετε μια νέα τιμή στο χαρακτηριστικό, πρέπει να χρησιμοποιήσετε ρητά " "το όνομα κλάσης στην εκχώρηση::" -#: faq/programming.rst:1671 +#: faq/programming.rst:1669 +msgid "" +"class C:\n" +" count = 0 # number of times C.__init__ called\n" +"\n" +" def __init__(self):\n" +" C.count = C.count + 1\n" +"\n" +" def getcount(self):\n" +" return C.count # or return self.count" +msgstr "" +"class C:\n" +" count = 0 # number of times C.__init__ called\n" +"\n" +" def __init__(self):\n" +" C.count = C.count + 1\n" +"\n" +" def getcount(self):\n" +" return C.count # or return self.count" + +#: faq/programming.rst:1678 msgid "" "``c.count`` also refers to ``C.count`` for any ``c`` such that " "``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some " @@ -2499,7 +3685,7 @@ msgstr "" "``c`` ή από κάποια κλάση στη διαδρομή αναζήτησης της βασικής κλάσης από το " "``c.__class__`` πίσω στο ``C``." -#: faq/programming.rst:1675 +#: faq/programming.rst:1682 msgid "" "Caution: within a method of C, an assignment like ``self.count = 42`` " "creates a new and unrelated instance named \"count\" in ``self``'s own " @@ -2511,11 +3697,29 @@ msgstr "" "dict του ``self``. Επανασύνδεση μιας κλάσης-στατικής όνομα δεδομένων πρέπει " "πάντα να προσδιορίζει την κλάση είτε βρίσκεται μέσα σε μια μέθοδο είτε όχι::" -#: faq/programming.rst:1682 +#: faq/programming.rst:1687 +msgid "C.count = 314" +msgstr "C.count = 314" + +#: faq/programming.rst:1689 msgid "Static methods are possible::" msgstr "Οι στατικές μέθοδοι είναι δυνατές::" -#: faq/programming.rst:1690 +#: faq/programming.rst:1691 +msgid "" +"class C:\n" +" @staticmethod\n" +" def static(arg1, arg2, arg3):\n" +" # No 'self' parameter!\n" +" ..." +msgstr "" +"class C:\n" +" @staticmethod\n" +" def static(arg1, arg2, arg3):\n" +" # No 'self' parameter!\n" +" ..." + +#: faq/programming.rst:1697 msgid "" "However, a far more straightforward way to get the effect of a static method " "is via a simple module-level function::" @@ -2523,7 +3727,15 @@ msgstr "" "Ωστόσο, ένας πολύ πιο απλός τρόπος για να λάβετε το αποτέλεσμα μιας στατικής " "μεθόδου είναι μέσω μιας απλής συνάρτησης σε επίπεδο μονάδας::" -#: faq/programming.rst:1696 +#: faq/programming.rst:1700 +msgid "" +"def getcount():\n" +" return C.count" +msgstr "" +"def getcount():\n" +" return C.count" + +#: faq/programming.rst:1703 msgid "" "If your code is structured so as to define one class (or tightly related " "class hierarchy) per module, this supplies the desired encapsulation." @@ -2532,11 +3744,11 @@ msgstr "" "συνδεδεμένη ιεραρχίας κλάσεων) ανά module, αυτό παρέχει την επιθυμητή " "ενθυλάκωση." -#: faq/programming.rst:1701 +#: faq/programming.rst:1708 msgid "How can I overload constructors (or methods) in Python?" msgstr "Πως μπορώ να υπερφορτώσω κατασκευαστές (ή μεθόδους) στην Python;" -#: faq/programming.rst:1703 +#: faq/programming.rst:1710 msgid "" "This answer actually applies to all methods, but the question usually comes " "up first in the context of constructors." @@ -2544,12 +3756,24 @@ msgstr "" "Αυτή η απάντηση ισχύει στην πραγματικότητα για όλες τις μεθόδους, αλλά η " "ερώτηση συνήθως εμφανίζεται πρώτη στο πλαίσιο των κατασκευαστών." -#: faq/programming.rst:1706 +#: faq/programming.rst:1713 msgid "In C++ you'd write" msgstr "Στην C++ θα γράφατε" #: faq/programming.rst:1715 msgid "" +"class C {\n" +" C() { cout << \"No arguments\\n\"; }\n" +" C(int i) { cout << \"Argument is \" << i << \"\\n\"; }\n" +"}" +msgstr "" +"class C {\n" +" C() { cout << \"No arguments\\n\"; }\n" +" C(int i) { cout << \"Argument is \" << i << \"\\n\"; }\n" +"}" + +#: faq/programming.rst:1722 +msgid "" "In Python you have to write a single constructor that catches all cases " "using default arguments. For example::" msgstr "" @@ -2557,26 +3781,50 @@ msgstr "" "τις περιπτώσεις χρησιμοποιώντας προεπιλεγμένα ορίσματα. Για παράδειγμα::" #: faq/programming.rst:1725 +msgid "" +"class C:\n" +" def __init__(self, i=None):\n" +" if i is None:\n" +" print(\"No arguments\")\n" +" else:\n" +" print(\"Argument is\", i)" +msgstr "" +"class C:\n" +" def __init__(self, i=None):\n" +" if i is None:\n" +" print(\"No arguments\")\n" +" else:\n" +" print(\"Argument is\", i)" + +#: faq/programming.rst:1732 msgid "This is not entirely equivalent, but close enough in practice." msgstr "Αυτό δεν είναι εντελώς ισοδύναμο, αλλά αρκετά κοντά στην πράξη." -#: faq/programming.rst:1727 +#: faq/programming.rst:1734 msgid "You could also try a variable-length argument list, e.g. ::" msgstr "" "Θα μπορούσατε επίσης να δοκιμάσετε μια λίστα ορισμάτων μεταβλητού μήκους, π." "χ. ::" -#: faq/programming.rst:1732 +#: faq/programming.rst:1736 +msgid "" +"def __init__(self, *args):\n" +" ..." +msgstr "" +"def __init__(self, *args):\n" +" ..." + +#: faq/programming.rst:1739 msgid "The same approach works for all method definitions." msgstr "Η ίδια προσέγγιση λειτουργεί για όλους τους ορισμούς μεθόδων." -#: faq/programming.rst:1736 +#: faq/programming.rst:1743 msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "" "Προσπαθώ να χρησιμοποιήσω __spam και λαμβάνω ένα σφάλμα σχετικά με το " "_SomeClassName__spam." -#: faq/programming.rst:1738 +#: faq/programming.rst:1745 msgid "" "Variable names with double leading underscores are \"mangled\" to provide a " "simple but effective way to define class private variables. Any identifier " @@ -2592,28 +3840,70 @@ msgstr "" "αντικαθίσταται μέσω κειμένου το ``_classname__spam``, όπου το ``classname`` " "είναι το τρέχον όνομα κλάσης με απογυμνωμένες τυχόν προηγούμενες παύλες." -#: faq/programming.rst:1744 -msgid "" -"This doesn't guarantee privacy: an outside user can still deliberately " -"access the \"_classname__spam\" attribute, and private values are visible in " -"the object's ``__dict__``. Many Python programmers never bother to use " -"private variable names at all." -msgstr "" -"Αυτό δεν εγγυάται το απόρρητο: ένα εξωτερικός χρήστης μπορεί ακόμα να έχει " -"σκόπιμα πρόσβαση στο χαρακτηριστικό \"_classname__spam\" και οι ιδιωτικές " -"τιμές είναι ορατές στο ``__dict__``. Πολλοί προγραμματιστές Python δεν " -"μπαίνουν ποτέ στον κόπο να χρησιμοποιήσουν προσωπικά ονόματα μεταβλητών." - #: faq/programming.rst:1751 +msgid "" +"The identifier can be used unchanged within the class, but to access it " +"outside the class, the mangled name must be used:" +msgstr "" +"Το αναγνωριστικό μπορεί να χρησιμοποιηθεί αμετάβλητο εντός της κλάσης, αλλά " +"για πρόσβαση σε αυτό εκτός της κλάσης, πρέπει να χρησιμοποιηθεί το " +"παραμορφωμένο όνομα:" + +#: faq/programming.rst:1754 +msgid "" +"class A:\n" +" def __one(self):\n" +" return 1\n" +" def two(self):\n" +" return 2 * self.__one()\n" +"\n" +"class B(A):\n" +" def three(self):\n" +" return 3 * self._A__one()\n" +"\n" +"four = 4 * A()._A__one()" +msgstr "" +"class A:\n" +" def __one(self):\n" +" return 1\n" +" def two(self):\n" +" return 2 * self.__one()\n" +"\n" +"class B(A):\n" +" def three(self):\n" +" return 3 * self._A__one()\n" +"\n" +"four = 4 * A()._A__one()" + +#: faq/programming.rst:1768 +msgid "" +"In particular, this does not guarantee privacy since an outside user can " +"still deliberately access the private attribute; many Python programmers " +"never bother to use private variable names at all." +msgstr "" +"Συγκεκριμένα, αυτό δεν εγγυάται το απόρρητο καθώς ένας εξωτερικός χρήστης " +"μπορεί ακόμα να έχει σκόπιμα πρόσβαση στο ιδιωτικό χαρακτηριστικό∙ πολλοί " +"προγραμματιστές Python δεν μπαίνουν ποτέ στον κόπο να χρησιμοποιήσουν " +"ονόματα μεταβλητών." + +#: faq/programming.rst:1774 +msgid "" +"The :ref:`private name mangling specifications ` for " +"details and special cases." +msgstr "" +"Οι :ref:`προδιαφραφές παραποίησης ιδιωτικού ονόματος ` για λεπτομέρειες και ειδικές περιπτώσεις.'" + +#: faq/programming.rst:1778 msgid "My class defines __del__ but it is not called when I delete the object." msgstr "" "Η κλάση μου ορίζει __del__ αλλά δεν καλείται όταν διαγράφω το αντικείμενο." -#: faq/programming.rst:1753 +#: faq/programming.rst:1780 msgid "There are several possible reasons for this." msgstr "Υπάρχουν διάφοροι πιθανοί λόγοι για αυτό." -#: faq/programming.rst:1755 +#: faq/programming.rst:1782 msgid "" "The :keyword:`del` statement does not necessarily call :meth:`~object." "__del__` -- it simply decrements the object's reference count, and if this " @@ -2623,7 +3913,7 @@ msgstr "" "απλώς μειώνει τον αριθμό αναφοράς του αντικειμένου, και αν αυτό φτάσει στο " "μηδέν καλείται το :meth:`!__del__`." -#: faq/programming.rst:1759 +#: faq/programming.rst:1786 msgid "" "If your data structures contain circular links (e.g. a tree where each child " "has a parent reference and each parent has a list of children) the reference " @@ -2649,7 +3939,7 @@ msgstr "" "μια συλλογή, αλλά *υπάρχουν* παθολογικές περιπτώσεις όπου τα αντικείμενα δεν " "θα συλλεχθούν ποτέ." -#: faq/programming.rst:1770 +#: faq/programming.rst:1797 msgid "" "Despite the cycle collector, it's still a good idea to define an explicit " "``close()`` method on objects to be called whenever you're done with them. " @@ -2666,7 +3956,7 @@ msgstr "" "και το ``close()`` θα πρέπει να βεβαιωθεί ότι μπορεί να κληθεί περισσότερες " "από μία φορές για το ίδιο αντικείμενο." -#: faq/programming.rst:1777 +#: faq/programming.rst:1804 msgid "" "Another way to avoid cyclical references is to use the :mod:`weakref` " "module, which allows you to point to objects without incrementing their " @@ -2679,7 +3969,7 @@ msgstr "" "θα πρέπει να χρησιμοποιούν αδύναμες αναφορές για τις αναφορές γονέων και " "αδελφών ( αν τα χρειαστούν!)." -#: faq/programming.rst:1790 +#: faq/programming.rst:1817 msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." @@ -2687,12 +3977,12 @@ msgstr "" "Τέλος, εάν η μέθοδος :meth:`!__del__` εγείρει μια εξαίρεση, εκτυπώνεται ένα " "προειδοποιητικό μήνυμα στη διεύθυνση :data:`sys.stderr`." -#: faq/programming.rst:1795 +#: faq/programming.rst:1822 msgid "How do I get a list of all instances of a given class?" msgstr "" "Πως μπορώ να λάβω μια λίστα με όλες τις οντότητες μιας δεδομένης κλάσης;" -#: faq/programming.rst:1797 +#: faq/programming.rst:1824 msgid "" "Python does not keep track of all instances of a class (or of a built-in " "type). You can program the class's constructor to keep track of all " @@ -2703,11 +3993,11 @@ msgstr "" "κλάσης να παρακολουθεί όλες τις οντότητες διατηρώντας μια λίστα αδύναμων " "αναφορών σε κάθε παρουσία." -#: faq/programming.rst:1803 +#: faq/programming.rst:1830 msgid "Why does the result of ``id()`` appear to be not unique?" msgstr "Γιατί το αποτέλεσμα του ``id()`` φαίνεται να μην είναι μοναδικό;" -#: faq/programming.rst:1805 +#: faq/programming.rst:1832 msgid "" "The :func:`id` builtin returns an integer that is guaranteed to be unique " "during the lifetime of the object. Since in CPython, this is the object's " @@ -2722,7 +4012,7 @@ msgstr "" "αντικείμενο εκχωρείται στην ίδια θέση στη μνήμη. Αυτό φαίνεται από αυτό το " "παράδειγμα:" -#: faq/programming.rst:1816 +#: faq/programming.rst:1843 msgid "" "The two ids belong to different integer objects that are created before, and " "deleted immediately after execution of the ``id()`` call. To be sure that " @@ -2735,11 +4025,11 @@ msgstr "" "θέλετε να εξετάσετε είναι ακόμα ζωντανά, δημιουργήστε μια άλλη αναφορά στο " "αντικείμενο:" -#: faq/programming.rst:1829 +#: faq/programming.rst:1856 msgid "When can I rely on identity tests with the *is* operator?" msgstr "Πότε μπορώ να βασιστώ σε δοκιμές ταυτότητας με τον τελεστή *is*;" -#: faq/programming.rst:1831 +#: faq/programming.rst:1858 msgid "" "The ``is`` operator tests for object identity. The test ``a is b`` is " "equivalent to ``id(a) == id(b)``." @@ -2747,7 +4037,7 @@ msgstr "" "Ο τελεστής ``is`` ελέγχει την ταυτότητα του αντικειμένου. Η δοκιμή ``a is " "b`` ισοδυναμεί με ``id(a) == id(b)``." -#: faq/programming.rst:1834 +#: faq/programming.rst:1861 msgid "" "The most important property of an identity test is that an object is always " "identical to itself, ``a is a`` always returns ``True``. Identity tests are " @@ -2760,7 +4050,7 @@ msgstr "" "Και σε αντίθεση με τα τεστ ισότητας, τα τεστ ταυτότητας είναι εγγυημένα ότι " "θα επιστρέψουν ένα boolean ``True`` ή ``False``." -#: faq/programming.rst:1839 +#: faq/programming.rst:1866 msgid "" "However, identity tests can *only* be substituted for equality tests when " "object identity is assured. Generally, there are three circumstances where " @@ -2770,37 +4060,37 @@ msgstr "" "όταν είναι εξασφαλισμένη η ταυτότητα αντικειμένου. Γενικά, υπάρχουν τρεις " "περιπτώσεις όπου η ταυτότητα είναι εγγυημένη:" -#: faq/programming.rst:1843 +#: faq/programming.rst:1870 msgid "" -"1) Assignments create new names but do not change object identity. After " -"the assignment ``new = old``, it is guaranteed that ``new is old``." +"Assignments create new names but do not change object identity. After the " +"assignment ``new = old``, it is guaranteed that ``new is old``." msgstr "" -"1) Οι εκχωρήσεις δημιουργούν νέα ονόματα αλλά δεν αλλάζουν την ταυτότητα " +"Οι εκχωρήσεις δημιουργούν νέα ονόματα αλλά δεν αλλάζουν την ταυτότητα " "αντικειμένου. Μετά την ανάθεση ``new = old``, είναι εγγυημένο ότι το ``new " "is old``." -#: faq/programming.rst:1846 +#: faq/programming.rst:1873 msgid "" -"2) Putting an object in a container that stores object references does not " +"Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " "guaranteed that ``s[0] is x``." msgstr "" -"2) Η τοποθέτηση ενός αντικειμένου σε ένα κοντέινερ που αποθηκεύει αναφορές " +"Η τοποθέτηση ενός αντικειμένου σε ένα κοντέινερ που αποθηκεύει αναφορές " "αντικειμένων δεν αλλάζει την ταυτότητα αντικειμένου. Μετά την ανάθεση " "λίστας ``s[0] = x``, είναι εγγυημένο ότι το ``s[0] is x``." -#: faq/programming.rst:1850 +#: faq/programming.rst:1877 msgid "" -"3) If an object is a singleton, it means that only one instance of that " -"object can exist. After the assignments ``a = None`` and ``b = None``, it " -"is guaranteed that ``a is b`` because ``None`` is a singleton." +"If an object is a singleton, it means that only one instance of that object " +"can exist. After the assignments ``a = None`` and ``b = None``, it is " +"guaranteed that ``a is b`` because ``None`` is a singleton." msgstr "" -"3) Εάν ένα αντικείμενο είναι singleton, σημαίνει ότι μόνο μία παρουσία αυτού " +"Εάν ένα αντικείμενο είναι singleton, σημαίνει ότι μόνο ένα στιγμιότυπο αυτού " "του αντικειμένου μπορεί να υπάρχει. Μετά τις εκχωρήσεις ``a = None`` και " "``b = None``, είναι εγγυημένο ότι το ``a is b`` επειδή το ``None`` είναι " "singleton." -#: faq/programming.rst:1854 +#: faq/programming.rst:1881 msgid "" "In most other circumstances, identity tests are inadvisable and equality " "tests are preferred. In particular, identity tests should not be used to " @@ -2812,12 +4102,50 @@ msgstr "" "να χρησιμοποιούνται για τον έλεγχο σταθερών όπως :class:`int` και :class:" "`str` που δεν είναι εγγυημένα singletons::" -#: faq/programming.rst:1871 +#: faq/programming.rst:1886 +msgid "" +">>> a = 1000\n" +">>> b = 500\n" +">>> c = b + 500\n" +">>> a is c\n" +"False\n" +"\n" +">>> a = 'Python'\n" +">>> b = 'Py'\n" +">>> c = b + 'thon'\n" +">>> a is c\n" +"False" +msgstr "" +">>> a = 1000\n" +">>> b = 500\n" +">>> c = b + 500\n" +">>> a is c\n" +"False\n" +"\n" +">>> a = 'Python'\n" +">>> b = 'Py'\n" +">>> c = b + 'thon'\n" +">>> a is c\n" +"False" + +#: faq/programming.rst:1898 msgid "Likewise, new instances of mutable containers are never identical::" msgstr "" "Ομοίως, τα νέα στιγμιότυπα μεταβλητών κοντέινερ δεν είναι ποτέ πανομοιότυπα::" -#: faq/programming.rst:1878 +#: faq/programming.rst:1900 +msgid "" +">>> a = []\n" +">>> b = []\n" +">>> a is b\n" +"False" +msgstr "" +">>> a = []\n" +">>> b = []\n" +">>> a is b\n" +"False" + +#: faq/programming.rst:1905 msgid "" "In the standard library code, you will see several common patterns for " "correctly using identity tests:" @@ -2825,42 +4153,65 @@ msgstr "" "Στον τυπικό κώδικα βιβλιοθήκης, θα δείτε πολλά κοινά μοτίβα για τη σωστή " "χρήση των δοκιμών ταυτότητας:" -#: faq/programming.rst:1881 +#: faq/programming.rst:1908 msgid "" -"1) As recommended by :pep:`8`, an identity test is the preferred way to " -"check for ``None``. This reads like plain English in code and avoids " -"confusion with other objects that may have boolean values that evaluate to " -"false." +"As recommended by :pep:`8`, an identity test is the preferred way to check " +"for ``None``. This reads like plain English in code and avoids confusion " +"with other objects that may have boolean values that evaluate to false." msgstr "" -"1) Όπως προτείνεται από το :pep:`8`, ένας έλεγχος ταυτότητας είναι ο " +"Όπως προτείνεται από το :pep:`8`, ένας έλεγχος ταυτότητας είναι ο " "προτιμώμενος τρόπος για να ελέγξετε το ``None``. Αυτό είναι σαν απλά " "αγγλικά στον κώδικα και αποφεύγεται η σύγχυση με άλλα αντικείμενα που μπορεί " -"να έχουν τιμές boolean που αξιολογούνται σε ψευδής." +"να έχουν τιμές boolean που αξιολογούνται ως ψευδείς." -#: faq/programming.rst:1885 +#: faq/programming.rst:1912 msgid "" -"2) Detecting optional arguments can be tricky when ``None`` is a valid input " +"Detecting optional arguments can be tricky when ``None`` is a valid input " "value. In those situations, you can create a singleton sentinel object " "guaranteed to be distinct from other objects. For example, here is how to " "implement a method that behaves like :meth:`dict.pop`:" msgstr "" -"2) Ο εντοπισμός προαιρετικών ορισμάτων μπορεί να είναι δύσκολος όταν το " +"Ο εντοπισμός προαιρετικών ορισμάτων μπορεί να είναι δύσκολος όταν το " "``None`` είναι μια έγκυρη τιμή εισόδου. Σε αυτές τις περιπτώσεις, μπορείτε " "να δημιουργήσετε ένα αντικείμενο μεμονωμένου φρουρού που είναι εγγυημένο ότι " "θα διαφέρει από άλλα αντικείμενα. Για παράδειγμα, δείτε πως μπορείτε να " -"εφαρμόσετε μια μέθοδο που συμπεριφέρεται σαν :meth:`dict.pop`::" - -#: faq/programming.rst:1901 -msgid "" -"3) Container implementations sometimes need to augment equality tests with " +"εφαρμόσετε μια μέθοδο που συμπεριφέρεται σαν :meth:`dict.pop`:" + +#: faq/programming.rst:1917 +msgid "" +"_sentinel = object()\n" +"\n" +"def pop(self, key, default=_sentinel):\n" +" if key in self:\n" +" value = self[key]\n" +" del self[key]\n" +" return value\n" +" if default is _sentinel:\n" +" raise KeyError(key)\n" +" return default" +msgstr "" +"_sentinel = object()\n" +"\n" +"def pop(self, key, default=_sentinel):\n" +" if key in self:\n" +" value = self[key]\n" +" del self[key]\n" +" return value\n" +" if default is _sentinel:\n" +" raise KeyError(key)\n" +" return default" + +#: faq/programming.rst:1930 +msgid "" +"Container implementations sometimes need to augment equality tests with " "identity tests. This prevents the code from being confused by objects such " "as ``float('NaN')`` that are not equal to themselves." msgstr "" -"3) Οι υλοποιήσεις κοντέινερ μερικές φορές χρειάζεται να αυξήσουν τα τεστ " +"Οι υλοποιήσεις κοντέινερ μερικές φορές χρειάζεται να αυξήσουν τα τεστ " "ισότητας με δοκιμές ταυτότητας. Αυτό αποτρέπει τη σύγχυση του κώδικα από " -"αντικείμενα όπως το ``float('NaN')`` που δεν είναι ίσα με τα ίδια." +"αντικείμενα όπως το ``float('NaN')`` που είναι ίσα με τα ίδια." -#: faq/programming.rst:1905 +#: faq/programming.rst:1934 msgid "" "For example, here is the implementation of :meth:`!collections.abc.Sequence." "__contains__`::" @@ -2868,14 +4219,28 @@ msgstr "" "Για παράδειγμα, εδώ είναι η υλοποίηση του :meth:`!collections.abc.Sequence." "__contains__`::" -#: faq/programming.rst:1916 +#: faq/programming.rst:1937 +msgid "" +"def __contains__(self, value):\n" +" for v in self:\n" +" if v is value or v == value:\n" +" return True\n" +" return False" +msgstr "" +"def __contains__(self, value):\n" +" for v in self:\n" +" if v is value or v == value:\n" +" return True\n" +" return False" + +#: faq/programming.rst:1945 msgid "" "How can a subclass control what data is stored in an immutable instance?" msgstr "" "Πώς μπορεί μια υποκλάση να ελέγξει ποια δεδομένα αποθηκεύονται σε μια " "αμετάβλητη παρουσία;" -#: faq/programming.rst:1918 +#: faq/programming.rst:1947 msgid "" "When subclassing an immutable type, override the :meth:`~object.__new__` " "method instead of the :meth:`~object.__init__` method. The latter only runs " @@ -2887,7 +4252,7 @@ msgstr "" "εκτελείται μόνο αφού δημιουργηθεί μια παρουσία, η οποία είναι πολύ αργά για " "να αλλάζει δεδομένα σε μια αμετάβλητη περίπτωση." -#: faq/programming.rst:1923 +#: faq/programming.rst:1952 msgid "" "All of these immutable classes have a different signature than their parent " "class:" @@ -2895,15 +4260,79 @@ msgstr "" "Όλες αυτές οι αμετάβλητες κλάσεις έχουν διαφορετική υπογραφή από τη μητρική " "τους κλάση:" -#: faq/programming.rst:1949 +#: faq/programming.rst:1955 +msgid "" +"from datetime import date\n" +"\n" +"class FirstOfMonthDate(date):\n" +" \"Always choose the first day of the month\"\n" +" def __new__(cls, year, month, day):\n" +" return super().__new__(cls, year, month, 1)\n" +"\n" +"class NamedInt(int):\n" +" \"Allow text names for some numbers\"\n" +" xlat = {'zero': 0, 'one': 1, 'ten': 10}\n" +" def __new__(cls, value):\n" +" value = cls.xlat.get(value, value)\n" +" return super().__new__(cls, value)\n" +"\n" +"class TitleStr(str):\n" +" \"Convert str to name suitable for a URL path\"\n" +" def __new__(cls, s):\n" +" s = s.lower().replace(' ', '-')\n" +" s = ''.join([c for c in s if c.isalnum() or c == '-'])\n" +" return super().__new__(cls, s)" +msgstr "" +"from datetime import date\n" +"\n" +"class FirstOfMonthDate(date):\n" +" \"Always choose the first day of the month\"\n" +" def __new__(cls, year, month, day):\n" +" return super().__new__(cls, year, month, 1)\n" +"\n" +"class NamedInt(int):\n" +" \"Allow text names for some numbers\"\n" +" xlat = {'zero': 0, 'one': 1, 'ten': 10}\n" +" def __new__(cls, value):\n" +" value = cls.xlat.get(value, value)\n" +" return super().__new__(cls, value)\n" +"\n" +"class TitleStr(str):\n" +" \"Convert str to name suitable for a URL path\"\n" +" def __new__(cls, s):\n" +" s = s.lower().replace(' ', '-')\n" +" s = ''.join([c for c in s if c.isalnum() or c == '-'])\n" +" return super().__new__(cls, s)" + +#: faq/programming.rst:1978 msgid "The classes can be used like this:" msgstr "Οι κλάσεις μπορούν να χρησιμοποιηθούν έτσι:" -#: faq/programming.rst:1966 +#: faq/programming.rst:1980 +msgid "" +">>> FirstOfMonthDate(2012, 2, 14)\n" +"FirstOfMonthDate(2012, 2, 1)\n" +">>> NamedInt('ten')\n" +"10\n" +">>> NamedInt(20)\n" +"20\n" +">>> TitleStr('Blog: Why Python Rocks')\n" +"'blog-why-python-rocks'" +msgstr "" +">>> FirstOfMonthDate(2012, 2, 14)\n" +"FirstOfMonthDate(2012, 2, 1)\n" +">>> NamedInt('ten')\n" +"10\n" +">>> NamedInt(20)\n" +"20\n" +">>> TitleStr('Blog: Why Python Rocks')\n" +"'blog-why-python-rocks'" + +#: faq/programming.rst:1995 msgid "How do I cache method calls?" msgstr "Πώς μπορώ να αποθηκεύσω τις κλήσεις μεθόδου στην κρυφή μνήμη;" -#: faq/programming.rst:1968 +#: faq/programming.rst:1997 msgid "" "The two principal tools for caching methods are :func:`functools." "cached_property` and :func:`functools.lru_cache`. The former stores results " @@ -2914,7 +4343,7 @@ msgstr "" "Το πρώτο αποθηκεύει τα αποτελέσματα σε επίπεδο παρουσίας και το δεύτερο σε " "επίπεδο κλάσης." -#: faq/programming.rst:1973 +#: faq/programming.rst:2002 msgid "" "The *cached_property* approach only works with methods that do not take any " "arguments. It does not create a reference to the instance. The cached " @@ -2924,7 +4353,7 @@ msgstr "" "ορίσματα. Δεν δημιουργεί αναφορά στο στιγμιότυπο. Το αποτέλεσμα της cached " "μεθόδους θα διατηρηθεί μόνο όσο το στιγμιότυπο είναι ζωντανό." -#: faq/programming.rst:1977 +#: faq/programming.rst:2006 msgid "" "The advantage is that when an instance is no longer used, the cached method " "result will be released right away. The disadvantage is that if instances " @@ -2937,7 +4366,7 @@ msgstr "" "αποτελέσματα της συσσωρευμένης μεθόδου. Μπορούν να αναπτυχθούν χωρίς " "περιορισμούς." -#: faq/programming.rst:1982 +#: faq/programming.rst:2011 msgid "" "The *lru_cache* approach works with methods that have :term:`hashable` " "arguments. It creates a reference to the instance unless special efforts " @@ -2947,7 +4376,7 @@ msgstr "" "`hashable`. Δημιουργεί μια αναφορά στο στιγμιότυπο, εκτός εάν καταβληθούν " "ειδικές προσπάθειες για να περάσει σε αδύναμες αναφορές." -#: faq/programming.rst:1986 +#: faq/programming.rst:2015 msgid "" "The advantage of the least recently used algorithm is that the cache is " "bounded by the specified *maxsize*. The disadvantage is that instances are " @@ -2958,11 +4387,57 @@ msgstr "" "είναι ότι τα στιγμιότυπα διατηρούνται ζωντανά έως ότου παλαιώσουν από την " "κρυφή μνήμη ή μέχρι να διαγραφεί η κρυφή μνήμη." -#: faq/programming.rst:1991 +#: faq/programming.rst:2020 msgid "This example shows the various techniques::" msgstr "Αυτό το παράδειγμα δείχνει τις διάφορες τεχνικές::" -#: faq/programming.rst:2015 +#: faq/programming.rst:2022 +msgid "" +"class Weather:\n" +" \"Lookup weather information on a government website\"\n" +"\n" +" def __init__(self, station_id):\n" +" self._station_id = station_id\n" +" # The _station_id is private and immutable\n" +"\n" +" def current_temperature(self):\n" +" \"Latest hourly observation\"\n" +" # Do not cache this because old results\n" +" # can be out of date.\n" +"\n" +" @cached_property\n" +" def location(self):\n" +" \"Return the longitude/latitude coordinates of the station\"\n" +" # Result only depends on the station_id\n" +"\n" +" @lru_cache(maxsize=20)\n" +" def historic_rainfall(self, date, units='mm'):\n" +" \"Rainfall on a given date\"\n" +" # Depends on the station_id, date, and units." +msgstr "" +"class Weather:\n" +" \"Lookup weather information on a government website\"\n" +"\n" +" def __init__(self, station_id):\n" +" self._station_id = station_id\n" +" # The _station_id is private and immutable\n" +"\n" +" def current_temperature(self):\n" +" \"Latest hourly observation\"\n" +" # Do not cache this because old results\n" +" # can be out of date.\n" +"\n" +" @cached_property\n" +" def location(self):\n" +" \"Return the longitude/latitude coordinates of the station\"\n" +" # Result only depends on the station_id\n" +"\n" +" @lru_cache(maxsize=20)\n" +" def historic_rainfall(self, date, units='mm'):\n" +" \"Rainfall on a given date\"\n" +" # Depends on the station_id, date, and units." + +#: faq/programming.rst:2044 msgid "" "The above example assumes that the *station_id* never changes. If the " "relevant instance attributes are mutable, the *cached_property* approach " @@ -2973,7 +4448,7 @@ msgstr "" "*cached_property* δεν μπορεί να λειτουργήσει επειδή δεν μπορεί να εντοπίσει " "αλλαγές στα χαρακτηριστικά." -#: faq/programming.rst:2020 +#: faq/programming.rst:2049 msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " "class needs to define the :meth:`~object.__eq__` and :meth:`~object." @@ -2984,15 +4459,57 @@ msgstr "" "meth:`~object.__hash__` ώστε η κρυφή μνήμη να μπορεί να εντοπίσει σχετικές " "ενημερώσεις χαρακτηριστικών::" -#: faq/programming.rst:2046 +#: faq/programming.rst:2053 +msgid "" +"class Weather:\n" +" \"Example with a mutable station identifier\"\n" +"\n" +" def __init__(self, station_id):\n" +" self.station_id = station_id\n" +"\n" +" def change_station(self, station_id):\n" +" self.station_id = station_id\n" +"\n" +" def __eq__(self, other):\n" +" return self.station_id == other.station_id\n" +"\n" +" def __hash__(self):\n" +" return hash(self.station_id)\n" +"\n" +" @lru_cache(maxsize=20)\n" +" def historic_rainfall(self, date, units='cm'):\n" +" 'Rainfall on a given date'\n" +" # Depends on the station_id, date, and units." +msgstr "" +"class Weather:\n" +" \"Example with a mutable station identifier\"\n" +"\n" +" def __init__(self, station_id):\n" +" self.station_id = station_id\n" +"\n" +" def change_station(self, station_id):\n" +" self.station_id = station_id\n" +"\n" +" def __eq__(self, other):\n" +" return self.station_id == other.station_id\n" +"\n" +" def __hash__(self):\n" +" return hash(self.station_id)\n" +"\n" +" @lru_cache(maxsize=20)\n" +" def historic_rainfall(self, date, units='cm'):\n" +" 'Rainfall on a given date'\n" +" # Depends on the station_id, date, and units." + +#: faq/programming.rst:2075 msgid "Modules" msgstr "Modules" -#: faq/programming.rst:2049 +#: faq/programming.rst:2078 msgid "How do I create a .pyc file?" msgstr "Πως δημιουργώ ένα .pyc αρχείο;" -#: faq/programming.rst:2051 +#: faq/programming.rst:2080 msgid "" "When a module is imported for the first time (or when the source file has " "changed since the current compiled file was created) a ``.pyc`` file " @@ -3011,7 +4528,7 @@ msgstr "" "που εξαρτάται από το συγκεκριμένο δυαδικό αρχείο ``python`` που το " "δημιούργησε. (Βλ. :pep:`3147` για λεπτομέρειες.)" -#: faq/programming.rst:2059 +#: faq/programming.rst:2088 msgid "" "One reason that a ``.pyc`` file may not be created is a permissions problem " "with the directory containing the source file, meaning that the " @@ -3026,7 +4543,7 @@ msgstr "" "ένας χρήστης αλλά εκτελείται ως άλλος, όπως εάν δοκιμάζετε με έναν " "διακομιστή ιστού." -#: faq/programming.rst:2064 +#: faq/programming.rst:2093 msgid "" "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " "creation of a .pyc file is automatic if you're importing a module and Python " @@ -3040,7 +4557,7 @@ msgstr "" "χώρος, κ.λπ...) να δημιουργήσει ένα ``__pycache__`` υποκατάλογο και γράψτε " "το μεταγλωττισμένο module σε αυτόν τον υποκατάλογο." -#: faq/programming.rst:2069 +#: faq/programming.rst:2098 msgid "" "Running Python on a top level script is not considered an import and no ``." "pyc`` will be created. For example, if you have a top-level module ``foo." @@ -3057,7 +4574,7 @@ msgstr "" "έχει εισαχθεί, αλλά δεν θα δημιουργηθεί αρχείο ``.pyc`` για το ``foo`` καθώς " "το ``foo.py`` δεν εισάγεται." -#: faq/programming.rst:2076 +#: faq/programming.rst:2105 msgid "" "If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." "pyc`` file for a module that is not imported -- you can, using the :mod:" @@ -3068,7 +4585,7 @@ msgstr "" "εισαχθεί -- μπορείτε, χρησιμοποιώντας τα modules :mod:`py_compile` και :mod:" "`compileall`." -#: faq/programming.rst:2080 +#: faq/programming.rst:2109 msgid "" "The :mod:`py_compile` module can manually compile any module. One way is to " "use the ``compile()`` function in that module interactively::" @@ -3077,7 +4594,15 @@ msgstr "" "module. Ένας τρόπος είναι να χρησιμοποιήσετε τη συνάρτηση ``compile()`` σε " "αυτήν την ενότητα διαδραστικά::" -#: faq/programming.rst:2086 +#: faq/programming.rst:2112 +msgid "" +">>> import py_compile\n" +">>> py_compile.compile('foo.py')" +msgstr "" +">>> import py_compile\n" +">>> py_compile.compile('foo.py')" + +#: faq/programming.rst:2115 msgid "" "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " "location as ``foo.py`` (or you can override that with the optional parameter " @@ -3087,7 +4612,7 @@ msgstr "" "θέση με το ``foo.py`` (ή μπορείτε να το παρακάμψετε με την προαιρετική " "παράμετρο ``cfile``)." -#: faq/programming.rst:2090 +#: faq/programming.rst:2119 msgid "" "You can also automatically compile all files in a directory or directories " "using the :mod:`compileall` module. You can do it from the shell prompt by " @@ -3099,11 +4624,15 @@ msgstr "" "από το shell prompt εκτελώντας το ``compileall.py`` και παρέχοντας τη " "διαδρομή ενός καταλόγου που περιέχει αρχεία Python για μεταγλώττιση::" -#: faq/programming.rst:2099 +#: faq/programming.rst:2124 +msgid "python -m compileall ." +msgstr "python -m compileall ." + +#: faq/programming.rst:2128 msgid "How do I find the current module name?" msgstr "Πως μπορώ να βρω το όνομα του τρέχοντος module;" -#: faq/programming.rst:2101 +#: faq/programming.rst:2130 msgid "" "A module can find out its own module name by looking at the predefined " "global variable ``__name__``. If this has the value ``'__main__'``, the " @@ -3118,51 +4647,83 @@ msgstr "" "γραμμής εντολών ή έναν αυτοέλεγχο και εκτελέστε αυτόν τον κώδικα μόνο αφού " "ελέγξετε το ``__name__``::" -#: faq/programming.rst:2116 +#: faq/programming.rst:2136 +msgid "" +"def main():\n" +" print('Running test...')\n" +" ...\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" +"def main():\n" +" print('Running test...')\n" +" ...\n" +"\n" +"if __name__ == '__main__':\n" +" main()" + +#: faq/programming.rst:2145 msgid "How can I have modules that mutually import each other?" msgstr "Πως μπορώ να έχω modules που εισάγουν αμοιβαία το ένα το άλλο;" -#: faq/programming.rst:2118 +#: faq/programming.rst:2147 msgid "Suppose you have the following modules:" msgstr "Υποθέστε ότι έχετε τα ακόλουθα modules::" -#: faq/programming.rst:2120 +#: faq/programming.rst:2149 msgid ":file:`foo.py`::" msgstr ":file:`foo.py`::" -#: faq/programming.rst:2125 +#: faq/programming.rst:2151 +msgid "" +"from bar import bar_var\n" +"foo_var = 1" +msgstr "" +"from bar import bar_var\n" +"foo_var = 1" + +#: faq/programming.rst:2154 msgid ":file:`bar.py`::" msgstr ":file:`bar.py`::" -#: faq/programming.rst:2130 +#: faq/programming.rst:2156 +msgid "" +"from foo import foo_var\n" +"bar_var = 2" +msgstr "" +"from foo import foo_var\n" +"bar_var = 2" + +#: faq/programming.rst:2159 msgid "The problem is that the interpreter will perform the following steps:" msgstr "Το πρόβλημα είναι ότι ο διερμηνέας θα εκτελέσει τα ακόλουθα βήματα:" -#: faq/programming.rst:2132 +#: faq/programming.rst:2161 msgid "main imports ``foo``" msgstr "main εισάγει ``foo``" -#: faq/programming.rst:2133 +#: faq/programming.rst:2162 msgid "Empty globals for ``foo`` are created" msgstr "Δημιουργούνται κενά καθολικά για το ``foo``" -#: faq/programming.rst:2134 +#: faq/programming.rst:2163 msgid "``foo`` is compiled and starts executing" msgstr "Το ``foo`` μεταγλωττίζεται και ξεκινά η εκτέλεση" -#: faq/programming.rst:2135 +#: faq/programming.rst:2164 msgid "``foo`` imports ``bar``" msgstr "``foo`` εισάγει ``bar``" -#: faq/programming.rst:2136 +#: faq/programming.rst:2165 msgid "Empty globals for ``bar`` are created" msgstr "Δημιουργούνται κενά καθολικά για ``bar``" -#: faq/programming.rst:2137 +#: faq/programming.rst:2166 msgid "``bar`` is compiled and starts executing" msgstr "Το ``bar`` μεταγλωττίζεται και αρχίζει να εκτελείται" -#: faq/programming.rst:2138 +#: faq/programming.rst:2167 msgid "" "``bar`` imports ``foo`` (which is a no-op since there already is a module " "named ``foo``)" @@ -3170,7 +4731,7 @@ msgstr "" "Το ``bar`` εισάγει το ``foo`` (το οποίο είναι απαγορευτικό, καθώς υπάρχει " "ήδη ένα module με το όνομα ``foo``)" -#: faq/programming.rst:2139 +#: faq/programming.rst:2168 msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "``bar.foo_var = foo.foo_var``" @@ -3178,7 +4739,7 @@ msgstr "" "Ο μηχανισμός εισαγωγής προσπαθεί να διαβάσει το ``foo_var`` από τα παγκόσμια " "``foo``, για να ορίσει το ``bar.foo_var = foo.foo_var``" -#: faq/programming.rst:2141 +#: faq/programming.rst:2170 msgid "" "The last step fails, because Python isn't done with interpreting ``foo`` yet " "and the global symbol dictionary for ``foo`` is still empty." @@ -3187,7 +4748,7 @@ msgstr "" "την ερμηνεία του ``foo`` και το global λεξικό συμβόλων για το ``foo`` είναι " "ακόμα κενό." -#: faq/programming.rst:2144 +#: faq/programming.rst:2173 msgid "" "The same thing happens when you use ``import foo``, and then try to access " "``foo.foo_var`` in global code." @@ -3195,13 +4756,13 @@ msgstr "" "Το ίδιο συμβαίνει όταν χρησιμοποιείτε το ``import foo`` και, στη συνέχεια, " "προσπαθείτε να αποκτήσετε πρόσβαση στο ``foo.foo_var`` σε καθολικό κώδικα." -#: faq/programming.rst:2147 +#: faq/programming.rst:2176 msgid "There are (at least) three possible workarounds for this problem." msgstr "" "Υπάρχουν (τουλάχιστον) τρεις πιθανοί τρόποι αντιμετώπισης αυτού του " "προβλήματος." -#: faq/programming.rst:2149 +#: faq/programming.rst:2178 msgid "" "Guido van Rossum recommends avoiding all uses of ``from import ..." "``, and placing all code inside functions. Initializations of global " @@ -3215,14 +4776,14 @@ msgstr "" "χρησιμοποιηθούν μόνο σταθερές ή ενσωματωμένες συναρτήσεις. Αυτό σημαίνει " "ότι ένα εισαγόμενο module αναφέρεται ως ``.``." -#: faq/programming.rst:2154 +#: faq/programming.rst:2183 msgid "" "Jim Roskind suggests performing steps in the following order in each module:" msgstr "" "Ο Jim Roskind προτείνει να εκτελέσετε τα βήματα με την ακόλουθη σειρά σε " "κάθε module:" -#: faq/programming.rst:2156 +#: faq/programming.rst:2185 msgid "" "exports (globals, functions, and classes that don't need imported base " "classes)" @@ -3230,18 +4791,18 @@ msgstr "" "εξαγωγές (globals, συναρτήσεις, και κλάσεις που δεν χρειάζονται εισαγόμενες " "βασικές κλάσεις)" -#: faq/programming.rst:2158 +#: faq/programming.rst:2187 msgid "``import`` statements" msgstr "δηλώσεις ``import``" -#: faq/programming.rst:2159 +#: faq/programming.rst:2188 msgid "" "active code (including globals that are initialized from imported values)." msgstr "" "ενεργός κώδικας (συμπεριλαμβανομένων των καθολικών που αρχικοποιούνται από " "εισαγόμενες τιμές)." -#: faq/programming.rst:2161 +#: faq/programming.rst:2190 msgid "" "Van Rossum doesn't like this approach much because the imports appear in a " "strange place, but it does work." @@ -3249,7 +4810,7 @@ msgstr "" "Ο Van Rossum δεν αρέσει πολύ αυτή η προσέγγιση επειδή οι εισαγωγές " "εμφανίζονται σε ένα περίεργο μέρος, αλλά λειτουργεί." -#: faq/programming.rst:2164 +#: faq/programming.rst:2193 msgid "" "Matthias Urlichs recommends restructuring your code so that the recursive " "import is not necessary in the first place." @@ -3257,15 +4818,15 @@ msgstr "" "Ο Matthias Urlichs συνιστά την αναδιάρθρωση του κώδικά σας έτσι ώστε η " "αναδρομική εισαγωγή να μην είναι απαραίτητη εξαρχής." -#: faq/programming.rst:2167 +#: faq/programming.rst:2196 msgid "These solutions are not mutually exclusive." msgstr "Αυτές οι λύσεις δεν αλληλοαποκλείονται." -#: faq/programming.rst:2171 +#: faq/programming.rst:2200 msgid "__import__('x.y.z') returns ; how do I get z?" msgstr "__import__('x.y.z') επιστρέφει ∙ πως μπορώ να πάρω το z?" -#: faq/programming.rst:2173 +#: faq/programming.rst:2202 msgid "" "Consider using the convenience function :func:`~importlib.import_module` " "from :mod:`importlib` instead::" @@ -3273,7 +4834,11 @@ msgstr "" "Σκεφτείτε να χρησιμοποιήσετε τη συνάρτηση ευκολίας :func:`~importlib." "import_module` από το :mod:`importlib` αντί::" -#: faq/programming.rst:2180 +#: faq/programming.rst:2205 +msgid "z = importlib.import_module('x.y.z')" +msgstr "z = importlib.import_module('x.y.z')" + +#: faq/programming.rst:2209 msgid "" "When I edit an imported module and reimport it, the changes don't show up. " "Why does this happen?" @@ -3281,7 +4846,7 @@ msgstr "" "Όταν επεξεργάζομαι ένα module που έχει εισαχθεί και την επανεισάγω, οι " "αλλαγές δεν εμφανίζονται. Γιατί συμβαίνει αυτό;" -#: faq/programming.rst:2182 +#: faq/programming.rst:2211 msgid "" "For reasons of efficiency as well as consistency, Python only reads the " "module file on the first time a module is imported. If it didn't, in a " @@ -3296,7 +4861,17 @@ msgstr "" "αναλυθεί και θα αναλυθεί ξανά πολλές φορές. Για να αναγκάσετε τη εκ νέου " "ανάγνωση μιας αλλαγμένης ενότητας , κάντε το εξής::" -#: faq/programming.rst:2192 +#: faq/programming.rst:2217 +msgid "" +"import importlib\n" +"import modname\n" +"importlib.reload(modname)" +msgstr "" +"import importlib\n" +"import modname\n" +"importlib.reload(modname)" + +#: faq/programming.rst:2221 msgid "" "Warning: this technique is not 100% fool-proof. In particular, modules " "containing statements like ::" @@ -3304,7 +4879,11 @@ msgstr "" "Προειδοποίηση: αυτή η τεχνική δεν είναι 100% ασφαλής. Ειδικότερα, modules " "που περιέχουν δηλώσεις όπως ::" -#: faq/programming.rst:2197 +#: faq/programming.rst:2224 +msgid "from modname import some_objects" +msgstr "from modname import some_objects" + +#: faq/programming.rst:2226 msgid "" "will continue to work with the old version of the imported objects. If the " "module contains class definitions, existing class instances will *not* be " @@ -3317,7 +4896,25 @@ msgstr "" "ορισμό της νέας κλάσης. Αυτό μπορεί να οδηγήσει στην ακόλουθη παράδοξη " "συμπεριφορά::" -#: faq/programming.rst:2210 +#: faq/programming.rst:2231 +msgid "" +">>> import importlib\n" +">>> import cls\n" +">>> c = cls.C() # Create an instance of C\n" +">>> importlib.reload(cls)\n" +"\n" +">>> isinstance(c, cls.C) # isinstance is false?!?\n" +"False" +msgstr "" +">>> import importlib\n" +">>> import cls\n" +">>> c = cls.C() # Create an instance of C\n" +">>> importlib.reload(cls)\n" +"\n" +">>> isinstance(c, cls.C) # isinstance is false?!?\n" +"False" + +#: faq/programming.rst:2239 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" @@ -3325,6 +4922,18 @@ msgstr "" "Η φύση του προβλήματος καθίσταται σαφής εάν εκτυπώσετε την \"ταυτότητα\" των " "αντικειμένων κλάσης::" +#: faq/programming.rst:2242 +msgid "" +">>> hex(id(c.__class__))\n" +"'0x7352a0'\n" +">>> hex(id(cls.C))\n" +"'0x4198d0'" +msgstr "" +">>> hex(id(c.__class__))\n" +"'0x7352a0'\n" +">>> hex(id(cls.C))\n" +"'0x4198d0'" + #: faq/programming.rst:408 msgid "argument" msgstr "όρισμα" diff --git a/faq/windows.po b/faq/windows.po index 87572e59..7575d66a 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-05-31 22:08+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -58,6 +58,10 @@ msgstr "" "τέτοιο παράθυρο επειδή θα δείτε ένα \"command prompt\" των Windows, η οποία " "συνήθως μοιάζει με αυτό:" +#: faq/windows.rst:35 +msgid "C:\\>" +msgstr "C:\\>" + #: faq/windows.rst:39 msgid "" "The letter may be different, and there might be other things after it, so " @@ -66,6 +70,10 @@ msgstr "" "Το γράμμα μπορεί να είναι διαφορετικό, και μπορεί να υπάρχουνε άλλα πράγματα " "μετά από αυτό, έτσι μπορείτε να δείτε εξίσου εύκολα κάτι σαν:" +#: faq/windows.rst:42 +msgid "D:\\YourName\\Projects\\Python>" +msgstr "D:\\YourName\\Projects\\Python>" + #: faq/windows.rst:46 msgid "" "depending on how your computer has been set up and what else you have " @@ -101,10 +109,28 @@ msgstr "" "έχετε ανοίξει ένα παράθυρο εντολών, θα πρέπει να δοκιμάσετε να εισαγάγετε " "την εντολή ``py`` και να πατήσετε return:" +#: faq/windows.rst:60 +msgid "C:\\Users\\YourName> py" +msgstr "C:\\Users\\YourName> py" + #: faq/windows.rst:64 msgid "You should then see something like:" msgstr "Στη συνέχεια, θα πρέπει να δείτε κάτι σαν:" +#: faq/windows.rst:66 +msgid "" +"Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit " +"(Intel)] on win32\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>>" +msgstr "" +"Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit " +"(Intel)] on win32\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>>" + #: faq/windows.rst:72 msgid "" "You have started the interpreter in \"interactive mode\". That means you can " @@ -118,6 +144,18 @@ msgstr "" "ισχυρότερα χαρακτηριστικά της Python. Ελέγξτε το εισάγοντας μερικές " "εκφράσεις της επιλογή σας και βλέποντας τα αποτελέσματα:" +#: faq/windows.rst:77 +msgid "" +">>> print(\"Hello\")\n" +"Hello\n" +">>> \"Hello\" * 3\n" +"'HelloHelloHello'" +msgstr "" +">>> print(\"Hello\")\n" +"Hello\n" +">>> \"Hello\" * 3\n" +"'HelloHelloHello'" + #: faq/windows.rst:84 msgid "" "Many people use the interactive mode as a convenient yet highly programmable " @@ -164,6 +202,10 @@ msgstr "" "py``, και η γραμμή εντολών σας ανοίγει όμορφα στον αρχικό σας κατάλογο, ώστε " "να βλέπετε κάτι παρόμοιο με::" +#: faq/windows.rst:104 +msgid "C:\\Users\\YourName>" +msgstr "C:\\Users\\YourName>" + #: faq/windows.rst:106 msgid "" "So now you'll ask the ``py`` command to give your script to Python by typing " @@ -173,6 +215,14 @@ msgstr "" "Python πληκτρολογώντας ``py`` ακολουθούμενη από τη διαδρομή του σεναρίου " "σας::" +#: faq/windows.rst:110 +msgid "" +"C:\\Users\\YourName> py Desktop\\hello.py\n" +"hello" +msgstr "" +"C:\\Users\\YourName> py Desktop\\hello.py\n" +"hello" + #: faq/windows.rst:114 msgid "How do I make Python scripts executable?" msgstr "Πως κάνω τα Python scripts εκτελέσιμα;" @@ -394,6 +444,20 @@ msgstr "" "Με λίγα λόγια, μπορείτε να χρησιμοποιήσετε τον ακόλουθο κώδικα για να " "αρχικοποιήσετε τον Python interpreter με το module επέκτασης." +#: faq/windows.rst:210 +msgid "" +"#include \n" +"...\n" +"Py_Initialize(); // Initialize Python.\n" +"initmyAppc(); // Initialize (import) the helper class.\n" +"PyRun_SimpleString(\"import myApp\"); // Import the shadow class." +msgstr "" +"#include \n" +"...\n" +"Py_Initialize(); // Initialize Python.\n" +"initmyAppc(); // Initialize (import) the helper class.\n" +"PyRun_SimpleString(\"import myApp\"); // Import the shadow class." + #: faq/windows.rst:218 msgid "" "There are two problems with Python's C API which will become apparent if you " @@ -423,6 +487,16 @@ msgstr "" "Πρόβλημα 2: Το SWIG δημιουργεί τον ακόλουθο κώδικα όταν δημιουργεί wrappers " "σε void συναρτήσεις:" +#: faq/windows.rst:229 +msgid "" +"Py_INCREF(Py_None);\n" +"_resultobj = Py_None;\n" +"return _resultobj;" +msgstr "" +"Py_INCREF(Py_None);\n" +"_resultobj = Py_None;\n" +"return _resultobj;" + #: faq/windows.rst:235 msgid "" "Alas, Py_None is a macro that expands to a reference to a complex data " @@ -434,6 +508,10 @@ msgstr "" "pythonNN.dll. Και πάλι, αυτός ο κώδικας θα αποτύχει σε ένα mult-compiler " "περιβάλλον. Αντικαταστήστε αυτόν τον κώδικα με:" +#: faq/windows.rst:239 +msgid "return Py_BuildValue(\"\");" +msgstr "return Py_BuildValue(\"\");" + #: faq/windows.rst:243 msgid "" "It may be possible to use SWIG's ``%typemap`` command to make the change " diff --git a/glossary.po b/glossary.po index cd5846f1..09ae3c23 100644 --- a/glossary.po +++ b/glossary.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-05-28 22:27+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -28,64 +28,45 @@ msgstr "``>>>``" #: glossary.rst:12 msgid "" -"The default Python prompt of the interactive shell. Often seen for code " -"examples which can be executed interactively in the interpreter." +"The default Python prompt of the :term:`interactive` shell. Often seen for " +"code examples which can be executed interactively in the interpreter." msgstr "" -"Το προεπιλεγμένο Python prompt του διαδραστικού shell. Συχνά εμφανίζεται για " -"παραδείγματα κώδικα που μπορούν να εκτελεστούν διαδραστικά στον interpreter." +"Η προεπιλεγμένη Python εντολή του :term:`interactive` shell. Συχνά " +"εμφανίζεται για παραδείγματα κώδικα που μπορούν να εκτελεστούν διαδραστικά " +"στον interpreter." -#: glossary.rst:14 +#: glossary.rst:15 msgid "``...``" msgstr "``...``" -#: glossary.rst:16 +#: glossary.rst:17 msgid "Can refer to:" msgstr "Μπορεί να αναφέρεται σε:" -#: glossary.rst:18 +#: glossary.rst:19 msgid "" -"The default Python prompt of the interactive shell when entering the code " -"for an indented code block, when within a pair of matching left and right " -"delimiters (parentheses, square brackets, curly braces or triple quotes), or " -"after specifying a decorator." +"The default Python prompt of the :term:`interactive` shell when entering the " +"code for an indented code block, when within a pair of matching left and " +"right delimiters (parentheses, square brackets, curly braces or triple " +"quotes), or after specifying a decorator." msgstr "" -"Το προεπιλεγμένο Python prompt του διαδραστικού shell κατά την εισαγωγή του " -"κώδικα για ένα μπλοκ κώδικα με εσοχή, όταν βρίσκεται μέσα σε ένα ζεύγος " -"ταιριασμένων αριστερών και δεξιών delimiters (παρενθέσεις, αγκύλες, άγκιστρα " -"ή τριπλά εισαγωγικά), ή μετά τον καθορισμό ενός decorator." - -#: glossary.rst:23 -msgid "The :const:`Ellipsis` built-in constant." -msgstr "Η ενσωματωμένη σταθερά :const:`Ellipsis`." - -#: glossary.rst:24 -msgid "2to3" -msgstr "2to3" +"Η προεπιλεγμένη Python εντολή του :term:`interactive` shell κατά την " +"εισαγωγή του κώδικα για ένα μπλοκ κώδικα με εσοχή, όταν βρίσκεται μέσα σε " +"ένα ζεύγος ταιριασμένων αριστερών και δεξιών delimiters (παρενθέσεις, " +"αγκύλες, άγκιστρα ή τριπλά εισαγωγικά), ή μετά τον καθορισμό ενός decorator." #: glossary.rst:26 msgid "" -"A tool that tries to convert Python 2.x code to Python 3.x code by handling " -"most of the incompatibilities which can be detected by parsing the source " -"and traversing the parse tree." -msgstr "" -"Ένα εργαλείο που προσπαθεί να μετατρέψει τον κώδικα Python 2.x σε κώδικα " -"Python 3.x διαχειρίζοντας τις περισσότερες ασυμβατότητες που μπορούν να " -"εντοπιστούν αναλύοντας την πηγή και διασχίζοντας το δέντρο ανάλυσης." - -#: glossary.rst:30 -msgid "" -"2to3 is available in the standard library as :mod:`lib2to3`; a standalone " -"entry point is provided as :file:`Tools/scripts/2to3`. See :ref:`2to3-" -"reference`." +"The three dots form of the :ref:`Ellipsis ` object." msgstr "" -"2to3 είναι διαθέσιμο στην στάνταρ βιβλιοθήκη ως :mod:`lib2to3`, παρέχεται " -"ένα σημείο εισόδου ως :file:`Tools/scripts/2to3`. Βλ. :ref:`2to3-reference`." +"Η μορφή με τις τρεις τελείες του αντικειμένου :ref:`Ellipsis `." -#: glossary.rst:33 +#: glossary.rst:27 msgid "abstract base class" msgstr "αφηρημένη βασική κλάση" -#: glossary.rst:35 +#: glossary.rst:29 msgid "" "Abstract base classes complement :term:`duck-typing` by providing a way to " "define interfaces when other techniques like :func:`hasattr` would be clumsy " @@ -110,6 +91,24 @@ msgstr "" "μονάδα :mod:`io`), εισαγωγή finders και loaders (στο module :mod:`importlib." "abc`). Μπορείτε να δημιουργήσετε τα δικά σας ABC με το module :mod:`abc`." +#: glossary.rst:40 +msgid "annotate function" +msgstr "συνάρτηση annotate" + +#: glossary.rst:42 +msgid "" +"A function that can be called to retrieve the :term:`annotations " +"` of an object. This function is accessible as the :attr:" +"`~object.__annotate__` attribute of functions, classes, and modules. " +"Annotate functions are a subset of :term:`evaluate functions `." +msgstr "" +"Μια συνάρτηση που μπορεί να κληθεί για να ανακτήσει το :term:`annotations " +"` ενός αντικειμένου. Αυτή η συνάρτηση είναι προσβάσιμη ως το " +"χαρακτηριστικό :attr:`~object.__annotate__` των συναρτήσεων, των κλάσεων και " +"των modules. Οι συναρτήσεις annotate είναι ένα υποσύνολο του :term:`evaluate " +"functions `." + #: glossary.rst:46 msgid "annotation" msgstr "annotation" @@ -126,31 +125,32 @@ msgstr "" #: glossary.rst:52 msgid "" "Annotations of local variables cannot be accessed at runtime, but " -"annotations of global variables, class attributes, and functions are stored " -"in the :attr:`__annotations__` special attribute of modules, classes, and " -"functions, respectively." +"annotations of global variables, class attributes, and functions can be " +"retrieved by calling :func:`annotationlib.get_annotations` on modules, " +"classes, and functions, respectively." msgstr "" "Δεν είναι δυνατή η πρόσβαση στα annotations των τοπικών μεταβλητών κατά το " "χρόνο εκτέλεσης, αλλά τα annotations των global μεταβλητών, των " -"χαρακτηριστικών κλάσης και των συναρτήσεων αποθηκεύονται στο ειδικό " -"χαρακτηριστικό :attr:`__annotations__` των modules, των κλάσεων και των " -"συναρτήσεων, αντίστοιχα." +"χαρακτηριστικών κλάσης και των συναρτήσεων μπορούν να ανακτηθούν καλώντας " +"την εντολή :func:`annotationlib.get_annotations` σε modules, κλάσεις και " +"συναρτήσεις, αντίστοιχα." -#: glossary.rst:58 +#: glossary.rst:57 msgid "" -"See :term:`variable annotation`, :term:`function annotation`, :pep:`484` " -"and :pep:`526`, which describe this functionality. Also see :ref:" +"See :term:`variable annotation`, :term:`function annotation`, :pep:`484`, :" +"pep:`526`, and :pep:`649`, which describe this functionality. Also see :ref:" "`annotations-howto` for best practices on working with annotations." msgstr "" -"Βλ. :term:`variable annotation`, :term:`function annotation`, :pep:`484` " -"και :pep:`526`, τα οποία περιγράφουν την λειτουργικότητα. Επίσης βλ. :ref:" -"`annotations-howto` για τις βέλτιστες πρακτικές δουλεύοντας με annotations." +"Βλ. τα :term:`variable annotation`, :term:`function annotation`, :pep:" +"`484`, :pep:`526` και :pep:`649`, τα οποία περιγράφουν την λειτουργικότητα. " +"Δείτε επίσης τα :ref:`annotations-howto` για τις βέλτιστες πρακτικές " +"δουλεύοντας με annotations." -#: glossary.rst:62 +#: glossary.rst:61 msgid "argument" msgstr "όρισμα" -#: glossary.rst:64 +#: glossary.rst:63 msgid "" "A value passed to a :term:`function` (or :term:`method`) when calling the " "function. There are two kinds of argument:" @@ -158,7 +158,7 @@ msgstr "" "Μια τιμή μεταβιβάζεται σε μία :term:`function` (ή :term:`method`) κατά την " "κλήση της συνάρτησης. Υπάρχουν δύο είδη ορισμάτων:" -#: glossary.rst:67 +#: glossary.rst:66 msgid "" ":dfn:`keyword argument`: an argument preceded by an identifier (e.g. " "``name=``) in a function call or passed as a value in a dictionary preceded " @@ -170,7 +170,15 @@ msgstr "" "από ``**``. Για παράδειγμα, το ``3`` και το ``5`` αποτελούν ορίσματα λέξεων-" "κλειδιών στις ακόλουθες κλήσεις προς :func:`complex`::" -#: glossary.rst:75 +#: glossary.rst:71 +msgid "" +"complex(real=3, imag=5)\n" +"complex(**{'real': 3, 'imag': 5})" +msgstr "" +"complex(real=3, imag=5)\n" +"complex(**{'real': 3, 'imag': 5})" + +#: glossary.rst:74 msgid "" ":dfn:`positional argument`: an argument that is not a keyword argument. " "Positional arguments can appear at the beginning of an argument list and/or " @@ -183,7 +191,15 @@ msgstr "" "παράδειγμα, το ``3`` και το ``5`` αποτελούν ορίσματα θέσης στις παρακάτω " "κλήσεις::" -#: glossary.rst:84 +#: glossary.rst:80 +msgid "" +"complex(3, 5)\n" +"complex(*(3, 5))" +msgstr "" +"complex(3, 5)\n" +"complex(*(3, 5))" + +#: glossary.rst:83 msgid "" "Arguments are assigned to the named local variables in a function body. See " "the :ref:`calls` section for the rules governing this assignment. " @@ -196,7 +212,7 @@ msgstr "" "να αναπαραστήσει ένα όρισμα' η αξιολογούμενη τιμή εκχωρείται σε μια τοπική " "μεταβλητή." -#: glossary.rst:89 +#: glossary.rst:88 msgid "" "See also the :term:`parameter` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -206,11 +222,11 @@ msgstr "" "ερώτηση στο :ref:`η διαφορά μεταξύ ορισμάτων και παραμέτρων `, και :pep:`362`." -#: glossary.rst:92 +#: glossary.rst:91 msgid "asynchronous context manager" msgstr "ασύγχρονος διαχειριστής context" -#: glossary.rst:94 +#: glossary.rst:93 msgid "" "An object which controls the environment seen in an :keyword:`async with` " "statement by defining :meth:`~object.__aenter__` and :meth:`~object." @@ -220,11 +236,11 @@ msgstr "" "`async with` ορίζοντας τις μεθόδους :meth:`~object.__aenter__` και :meth:" "`~object.__aexit__`. Που εισήχθη από :pep:`492`." -#: glossary.rst:97 +#: glossary.rst:96 msgid "asynchronous generator" msgstr "ασύγχρονος generator" -#: glossary.rst:99 +#: glossary.rst:98 msgid "" "A function which returns an :term:`asynchronous generator iterator`. It " "looks like a coroutine function defined with :keyword:`async def` except " @@ -237,7 +253,7 @@ msgstr "" "σειράς τιμών που μπορούν να χρησιμοποιηθούν σε έναν :keyword:`async for` " "βρόχο." -#: glossary.rst:104 +#: glossary.rst:103 msgid "" "Usually refers to an asynchronous generator function, but may refer to an " "*asynchronous generator iterator* in some contexts. In cases where the " @@ -248,7 +264,7 @@ msgstr "" "περιπτώσεις όπου το επιδιωκόμενο νόημα δεν είναι σαφές, με την χρήση των " "πλήρων όρων αποφεύγεται η ασάφεια." -#: glossary.rst:108 +#: glossary.rst:107 msgid "" "An asynchronous generator function may contain :keyword:`await` expressions " "as well as :keyword:`async for`, and :keyword:`async with` statements." @@ -256,17 +272,17 @@ msgstr "" "Μια συνάρτηση ασύγχρονου generator μπορεί να περιέχει εκφράσεις :keyword:" "`await` , καθώς και δηλώσεις :keyword:`async for`, και :keyword:`async with`." -#: glossary.rst:111 +#: glossary.rst:110 msgid "asynchronous generator iterator" msgstr "ασύγχρονος generator iterator" -#: glossary.rst:113 -msgid "An object created by a :term:`asynchronous generator` function." +#: glossary.rst:112 +msgid "An object created by an :term:`asynchronous generator` function." msgstr "" "Ένα αντικείμενο που δημιουργήθηκε από μια συνάρτηση :term:`asynchronous " "generator`." -#: glossary.rst:115 +#: glossary.rst:114 msgid "" "This is an :term:`asynchronous iterator` which when called using the :meth:" "`~object.__anext__` method returns an awaitable object which will execute " @@ -278,26 +294,26 @@ msgstr "" "αναμενόμενο αντικείμενο που θα εκτελέσει στο σώμα της συνάρτησης του " "ασύγχρονου generator μέχρι την επόμενη :keyword:`yield` έκφραση." -#: glossary.rst:120 +#: glossary.rst:119 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " -"location execution state (including local variables and pending try-" -"statements). When the *asynchronous generator iterator* effectively resumes " -"with another awaitable returned by :meth:`~object.__anext__`, it picks up " -"where it left off. See :pep:`492` and :pep:`525`." +"execution state (including local variables and pending try-statements). " +"When the *asynchronous generator iterator* effectively resumes with another " +"awaitable returned by :meth:`~object.__anext__`, it picks up where it left " +"off. See :pep:`492` and :pep:`525`." msgstr "" "Κάθε :keyword:`yield` αναστέλλει προσωρινά την επεξεργασία, θυμάται την " -"τοποθεσία της κατάστασης εκτέλεσης (συμπεριλαμβανομένων των τοπικών " -"μεταβλητών και των δηλώσεων `try` σε εκκρεμότητα). Όταν ο *ασύγχρονος " -"generator iterator* συνεχίσει αποτελεσματικά με άλλο αναμενόμενο που " -"επιστρέφεται από :meth:`~object.__anext__ `, συνεχίζει από εκεί που " -"σταμάτησε. Βλ. :pep:`492` και :pep:`525`." +"κατάσταση εκτέλεσης (συμπεριλαμβανομένων των τοπικών μεταβλητών και των " +"δηλώσεων `try` σε εκκρεμότητα). Όταν ο *ασύγχρονος generator iterator* " +"συνεχίσει αποτελεσματικά με άλλο αναμενόμενο που επιστρέφεται από :meth:" +"`~object.__anext__`, συνεχίζει από εκεί που σταμάτησε. Βλ. :pep:`492` και :" +"pep:`525`." -#: glossary.rst:125 +#: glossary.rst:124 msgid "asynchronous iterable" msgstr "ασύγχρονος iterable" -#: glossary.rst:127 +#: glossary.rst:126 msgid "" "An object, that can be used in an :keyword:`async for` statement. Must " "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " @@ -307,11 +323,11 @@ msgstr "" "for`. Πρέπει να επιστρέφει ένα :term:`asynchronous iterator` από την μέθοδο :" "meth:`~object.__aiter__`. Που εισήχθη από :pep:`492`." -#: glossary.rst:130 +#: glossary.rst:129 msgid "asynchronous iterator" msgstr "ασύγχρονος iterator" -#: glossary.rst:132 +#: glossary.rst:131 msgid "" "An object that implements the :meth:`~object.__aiter__` and :meth:`~object." "__anext__` methods. :meth:`~object.__anext__` must return an :term:" @@ -326,11 +342,62 @@ msgstr "" "__anext__` ενός ασύγχρονου iterator έως ότου εγείρει μια εξαίρεση :exc:" "`StopAsyncIteration`. Εισήχθη από :pep:`492`." -#: glossary.rst:137 +#: glossary.rst:136 +msgid "attached thread state" +msgstr "κατάσταση συνδεδεμένου νήματος" + +#: glossary.rst:139 +msgid "A :term:`thread state` that is active for the current OS thread." +msgstr "" +"Ένα :term:`thread state` που είναι ενεργή για το τρέχον νήμα του " +"λειτουργικού συστήματος." + +#: glossary.rst:141 +msgid "" +"When a :term:`thread state` is attached, the OS thread has access to the " +"full Python C API and can safely invoke the bytecode interpreter." +msgstr "" +"Όταν επισυνάπτεται ένας :term:`thread state`, το νήμα του λειτουργικού " +"συστήματος έχει πρόσβαση στο πλήρες Python C API και μπορεί να καλέσει με " +"ασφάλεια τον διερμηνέα bytecode." + +#: glossary.rst:145 +msgid "" +"Unless a function explicitly notes otherwise, attempting to call the C API " +"without an attached thread state will result in a fatal error or undefined " +"behavior. A thread state can be attached and detached explicitly by the " +"user through the C API, or implicitly by the runtime, including during " +"blocking C calls and by the bytecode interpreter in between calls." +msgstr "" +"Εκτός εάν μια συνάρτηση αναφέρει ρητά το αντίθετο, η προσπάθεια κλήσης του C " +"API χωρίς μια συνημμένη κατάσταση νήματος θα οδηγήσει ένα μοιραίο σφάλμα ή " +"σε απροσδιόριστη συμπεριφορά. Μια κατάσταση νήματος μπορεί να συνδεθεί και " +"να αποσυνδεθεί ρητά από τον χρήση μέσω του C API ή έμμεσα από τον χρόνο " +"εκτέλεσης, συμπεριλαμβανομένων των κλήσεων αποκλεισμού C και από τον " +"διερμηνέα bytecode μεταξύ των κλήσεων." + +#: glossary.rst:152 +msgid "" +"On most builds of Python, having an attached thread state implies that the " +"caller holds the :term:`GIL` for the current interpreter, so only one OS " +"thread can have an attached thread state at a given moment. In :term:`free-" +"threaded ` builds of Python, threads can concurrently hold " +"an attached thread state, allowing for true parallelism of the bytecode " +"interpreter." +msgstr "" +"Στις περισσότερες εκδόσεις της Python, η ύπαρξη μιας κατάσταση συνδεδεμένου " +"νήματος υπονοεί ότι ο καλών διατηρεί την :term:`GIL` για τον τρέχοντα " +"διερμηνέα, επομένως μόνο ένα νήμα λειτουργικού συστήματος μπορεί να έχει μια " +"κατάσταση συνδεδεμένου νήματος σε μια δεδομένη στιγμή. Στις εκδόσεις :term:" +"`free-threaded ` της Python, τα νήματα μπορούν να διατηρούν " +"ταυτόχρονα μια κατάσταση συνδεδεμένου νήματος, επιτρέποντας την πραγματική " +"παραλληλία του διερμηνέα bytecode." + +#: glossary.rst:158 msgid "attribute" msgstr "χαρακτηριστικό" -#: glossary.rst:139 +#: glossary.rst:160 msgid "" "A value associated with an object which is usually referenced by name using " "dotted expressions. For example, if an object *o* has an attribute *a* it " @@ -340,7 +407,7 @@ msgstr "" "χρησιμοποιώντας εκφράσεις με κουκκίδες. Για παράδειγμα, εάν ένα αντικείμενο " "*o* έχει ένα χαρακτηριστικό *a* θα αναφέρεται ως *o.a*." -#: glossary.rst:144 +#: glossary.rst:165 msgid "" "It is possible to give an object an attribute whose name is not an " "identifier as defined by :ref:`identifiers`, for example using :func:" @@ -355,11 +422,11 @@ msgstr "" "χρησιμοποιώντας τις τελείες, και αντί αυτού θα πρέπει να ανακτηθεί " "χρησιμοποιώντας :func:`getattr`." -#: glossary.rst:149 +#: glossary.rst:170 msgid "awaitable" msgstr "awaitable" -#: glossary.rst:151 +#: glossary.rst:172 msgid "" "An object that can be used in an :keyword:`await` expression. Can be a :" "term:`coroutine` or an object with an :meth:`~object.__await__` method. See " @@ -369,11 +436,11 @@ msgstr "" "Μπορεί να είναι :term:`coroutine` ή ένα αντικείμενο με μια :meth:`~object." "__await__` μέθοδο. Βλ. επίσης :pep:`492`." -#: glossary.rst:154 +#: glossary.rst:175 msgid "BDFL" msgstr "BDFL" -#: glossary.rst:156 +#: glossary.rst:177 msgid "" "Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." @@ -382,11 +449,11 @@ msgstr "" "ζωής, δηλαδή `Guido van Rossum `_, ο " "δημιουργός της Python." -#: glossary.rst:158 +#: glossary.rst:179 msgid "binary file" msgstr "δυαδικό αρχείο" -#: glossary.rst:160 +#: glossary.rst:181 msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "`. Examples of binary files are files opened in binary " @@ -400,7 +467,7 @@ msgstr "" "data:`sys.stdin.buffer `, :data:`sys.stdout.buffer `, " "και στιγμιοτύπων των :class:`io.BytesIO` και :class:`gzip.GzipFile`." -#: glossary.rst:167 +#: glossary.rst:188 msgid "" "See also :term:`text file` for a file object able to read and write :class:" "`str` objects." @@ -408,11 +475,11 @@ msgstr "" "Βλ. επίσης :term:`text file` για ένα αντικείμενο τύπου αρχείο ικανό να " "διαβάσει και να γράψει :class:`str` αντικείμενα." -#: glossary.rst:169 +#: glossary.rst:190 msgid "borrowed reference" msgstr "δανεική αναφορά" -#: glossary.rst:171 +#: glossary.rst:192 msgid "" "In Python's C API, a borrowed reference is a reference to an object, where " "the code using the object does not own the reference. It becomes a dangling " @@ -426,7 +493,7 @@ msgstr "" "αφαιρέσει το τελευταίο :term:`strong reference` από το αντικείμενο και έτσι " "να το καταστρέψει." -#: glossary.rst:177 +#: glossary.rst:198 msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " @@ -441,11 +508,11 @@ msgstr "" "c:func:`Py_NewRef` μπορεί να χρησιμοποιηθεί ώστε να δημιουργηθεί ένα :term:" "`ισχυρή αναφορά `." -#: glossary.rst:182 +#: glossary.rst:203 msgid "bytes-like object" msgstr "bytes-like αντικείμενα" -#: glossary.rst:184 +#: glossary.rst:205 msgid "" "An object that supports the :ref:`bufferobjects` and can export a C-:term:" "`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " @@ -462,7 +529,7 @@ msgstr "" "διαχειρίζονται δυαδικά δεδομένα' αυτά περιλαμβάνουν συμπίεση αποθήκευση σε " "δυαδικό αρχείο και αποστολή μέσω socket." -#: glossary.rst:191 +#: glossary.rst:212 msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " @@ -481,11 +548,11 @@ msgstr "" "αυτών περιέχουν :class:`bytes` και ένα :class:`memoryview` ενός :class:" "`bytes` αντικειμένου." -#: glossary.rst:199 +#: glossary.rst:220 msgid "bytecode" msgstr "bytecode" -#: glossary.rst:201 +#: glossary.rst:222 msgid "" "Python source code is compiled into bytecode, the internal representation of " "a Python program in the CPython interpreter. The bytecode is also cached in " @@ -507,7 +574,7 @@ msgstr "" "εικονικών μηχανών Python, ούτε να είναι σταθερά μεταξύ των εκδόσεων της " "Python." -#: glossary.rst:211 +#: glossary.rst:232 msgid "" "A list of bytecode instructions can be found in the documentation for :ref:" "`the dis module `." @@ -515,11 +582,11 @@ msgstr "" "Μια λίστα από οδηγίες σχετικά με τα bytecode μπορεί να βρεθεί στην " "τεκμηρίωση για :ref:`το module dis `." -#: glossary.rst:213 +#: glossary.rst:234 msgid "callable" msgstr "callable" -#: glossary.rst:215 +#: glossary.rst:236 msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" @@ -527,7 +594,11 @@ msgstr "" "Ένα callable είναι ένα αντικείμενο που μπορεί να καλεστεί, πιθανά με ένα " "σύνολο ορισμάτων (βλ. :term:`argument`), με την παρακάτω σύνταξη::" -#: glossary.rst:220 +#: glossary.rst:239 +msgid "callable(argument1, argument2, argumentN)" +msgstr "callable(argument1, argument2, argumentN)" + +#: glossary.rst:241 msgid "" "A :term:`function`, and by extension a :term:`method`, is a callable. An " "instance of a class that implements the :meth:`~object.__call__` method is " @@ -537,11 +608,11 @@ msgstr "" "Ένα στιγμιότυπο μια κλάσης που υλοποιεί τη μέθοδο :meth:`~object.__call__` " "είναι επίσης callable." -#: glossary.rst:223 +#: glossary.rst:244 msgid "callback" msgstr "callback" -#: glossary.rst:225 +#: glossary.rst:246 msgid "" "A subroutine function which is passed as an argument to be executed at some " "point in the future." @@ -549,11 +620,11 @@ msgstr "" "Μια subroutine συνάρτηση η οποία μεταβιβάζεται ως όρισμα που θα εκτελεστεί " "κάποια στιγμή στο μέλλον." -#: glossary.rst:227 +#: glossary.rst:248 msgid "class" msgstr "κλάση" -#: glossary.rst:229 +#: glossary.rst:250 msgid "" "A template for creating user-defined objects. Class definitions normally " "contain method definitions which operate on instances of the class." @@ -562,11 +633,11 @@ msgstr "" "ορισμοί κλάσεων συνήθως περιέχουν ορισμούς μεθόδων που λειτουργούν σε " "στιγμιότυπα της κλάσης." -#: glossary.rst:232 +#: glossary.rst:253 msgid "class variable" msgstr "μεταβλητή κλάσης" -#: glossary.rst:234 +#: glossary.rst:255 msgid "" "A variable defined in a class and intended to be modified only at class " "level (i.e., not in an instance of the class)." @@ -574,11 +645,72 @@ msgstr "" "Μια μεταβλητή που ορίζεται σε μια κλάση και προορίζεται να τροποποιηθεί μόνο " "σε επίπεδο κλάσης (δηλ. όχι σε ένα στιγμιότυπο μιας κλάσης)." -#: glossary.rst:236 +#: glossary.rst:257 +msgid "closure variable" +msgstr "μεταβλητή κλεισίματος" + +#: glossary.rst:259 +msgid "" +"A :term:`free variable` referenced from a :term:`nested scope` that is " +"defined in an outer scope rather than being resolved at runtime from the " +"globals or builtin namespaces. May be explicitly defined with the :keyword:" +"`nonlocal` keyword to allow write access, or implicitly defined if the " +"variable is only being read." +msgstr "" +"Ένας :term:`free variable` που αναφέρεται από ένα :term:`nested scope` και " +"ορίζεται σε μια εξωτερική περιοχή, αντί να επιλύεται δυναμικά κατά την " +"εκτέλεση από τα καθολικά ή ενσωματωμένα namespaces. Μπορεί να δηλωθεί ρητά " +"με τη δεσμευμένη λέξη-κλειδί :keyword:`nonlocal` ώστε να επιτραπεί η " +"εγγραφή, ή να θεωρηθεί ότι ορίζεται έμμεσα όταν η μεταβλητή χρησιμοποιείται " +"μόνο για ανάγνωση." + +#: glossary.rst:264 +msgid "" +"For example, in the ``inner`` function in the following code, both ``x`` and " +"``print`` are :term:`free variables `, but only ``x`` is a " +"*closure variable*::" +msgstr "" +"Για παράδειγμα, η συνάρτηση ``inner`` του παρακάτω κώδικα, τόσο η ``x`` όσο " +"και η ``print`` είναι :term:`free variables `, αλλά μόνο η " +"``x`` είναι μια *μεταβλητή κλεισίματος*::" + +#: glossary.rst:267 +msgid "" +"def outer():\n" +" x = 0\n" +" def inner():\n" +" nonlocal x\n" +" x += 1\n" +" print(x)\n" +" return inner" +msgstr "" +"def outer():\n" +" x = 0\n" +" def inner():\n" +" nonlocal x\n" +" x += 1\n" +" print(x)\n" +" return inner" + +#: glossary.rst:275 +msgid "" +"Due to the :attr:`codeobject.co_freevars` attribute (which, despite its " +"name, only includes the names of closure variables rather than listing all " +"referenced free variables), the more general :term:`free variable` term is " +"sometimes used even when the intended meaning is to refer specifically to " +"closure variables." +msgstr "" +"Λόγο του χαρακτηριστικού :attr:`codeobject.co_freevars` (το οποίο, παρά την " +"ονομασία του, περιλαμβάνει μόνο τα ονόματα των μεταβλητών κλεισίματος και " +"όχι όλες τις αναφερόμενες ελεύθερες μεταβλητές), χρησιμοποιείται μερικές " +"φορές ο πιο γενικός όρος :term:`free variable` ακόμη και όταν γίνεται ειδική " +"αναφορά σε μεταβλητές κλεισίματος." + +#: glossary.rst:279 msgid "complex number" msgstr "μιγαδικός αριθμός" -#: glossary.rst:238 +#: glossary.rst:281 msgid "" "An extension of the familiar real number system in which all numbers are " "expressed as a sum of a real part and an imaginary part. Imaginary numbers " @@ -602,45 +734,92 @@ msgstr "" "προηγμένο μαθηματικό χαρακτηριστικό. εάν δεν γνωρίζετε την ανάγκη τους, " "είναι σχεδόν σίγουρο ότι μπορείτε να τα αγνοήσετε με ασφάλεια." -#: glossary.rst:248 +#: glossary.rst:291 +msgid "context" +msgstr "context" + +#: glossary.rst:293 +msgid "" +"This term has different meanings depending on where and how it is used. Some " +"common meanings:" +msgstr "" +"Αυτό ο όρος έχει διαφορετικές σημασίες ανάλογα με το πού και πώς " +"χρησιμοποιείται. Μερικές κοινές έννοιες:" + +#: glossary.rst:296 +msgid "" +"The temporary state or environment established by a :term:`context manager` " +"via a :keyword:`with` statement." +msgstr "" +"Η προσωρινή κατάσταση ή το περιβάλλον που δημιουργείται από έναν :term:" +"`context manager` μέσω μιας δήλωσης :keyword:`with`." + +#: glossary.rst:298 +msgid "" +"The collection of key­value bindings associated with a particular :class:" +"`contextvars.Context` object and accessed via :class:`~contextvars." +"ContextVar` objects. Also see :term:`context variable`." +msgstr "" +"Το σύνολο των δεσμευμένων κλειδιού-τιμής που σχετίζονται με ένα συγκεκριμένο " +"αντικείμενο :class:`contextvars.Context` και προσπελάζονται μέσω " +"αντικειμένων :class:`~contextvars.ContextVar`. Βλ. επίσης :term:`context " +"variable`." + +#: glossary.rst:302 +msgid "" +"A :class:`contextvars.Context` object. Also see :term:`current context`." +msgstr "" +"Ένα αντικείμενο :class:`contextvars.Context`. Βλ. επίσης :term:`current " +"context`." + +#: glossary.rst:304 +msgid "context management protocol" +msgstr "πρωτόκολλο διαχείρισης περιβάλλοντος" + +#: glossary.rst:306 +msgid "" +"The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " +"the :keyword:`with` statement. See :pep:`343`." +msgstr "" +"Οι μέθοδοι :meth:`~object.__enter__` και :meth:`~object.__exit__` καλούνται " +"από τη δήλωση :keyword:`with`. Βλ. :pep:`343`." + +#: glossary.rst:308 msgid "context manager" msgstr "διαχειριστής context" -#: glossary.rst:250 +#: glossary.rst:310 msgid "" -"An object which controls the environment seen in a :keyword:`with` statement " -"by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods. " -"See :pep:`343`." +"An object which implements the :term:`context management protocol` and " +"controls the environment seen in a :keyword:`with` statement. See :pep:" +"`343`." msgstr "" -"Ένα αντικείμενο που ελέγχει το περιβάλλον που εμφανίζεται σε μια δήλωση :" -"keyword:`with` ορίζοντας τις μεθόδους :meth:`~object.__enter__` και :meth:" -"`~object.__exit__`. Βλ. :pep:`343`." +"Ένα αντικείμενο που υλοποιεί το :term:`context management protocol` και " +"ελέγχει το περιβάλλον που είσαι ορατό μέσα σε μια δήλωση :keyword:`with`. " +"Βλ. :pep:`343`." -#: glossary.rst:253 +#: glossary.rst:313 msgid "context variable" msgstr "context μεταβλητή" -#: glossary.rst:255 +#: glossary.rst:315 msgid "" -"A variable which can have different values depending on its context. This is " -"similar to Thread-Local Storage in which each execution thread may have a " -"different value for a variable. However, with context variables, there may " -"be several contexts in one execution thread and the main usage for context " -"variables is to keep track of variables in concurrent asynchronous tasks. " -"See :mod:`contextvars`." -msgstr "" -"Μια μεταβλητή που μπορεί να έχει πολλές διαφορετικές τιμές ανάλογα με το " -"context. Αυτό είναι κοινό στο Thread-Local Storage όπου κάθε εκτέλεση του " -"νήματος μπορεί να έχει διαφορετική τιμή για μια μεταβλητή. Παρόλα αυτά, με " -"τις context μεταβλητές, μπορεί να υπάρχουν πολλά περιβάλλοντα σε ένα νήμα " -"εκτέλεσης και η κύρια χρήση για τις context μεταβλητές είναι η παρακολούθηση " -"των μεταβλητών σε ταυτόχρονες διεργασίες. Βλ. :mod:`contextvars`." - -#: glossary.rst:262 +"A variable whose value depends on which context is the :term:`current " +"context`. Values are accessed via :class:`contextvars.ContextVar` objects. " +"Context variables are primarily used to isolate state between concurrent " +"asynchronous tasks." +msgstr "" +"Μια μεταβλητή της οποίας η τιμή εξαρτάται από το ποιο είναι το :term:" +"`current context`. Οι τιμές προσπελάζονται μέσω των αντικειμένων :class:" +"`contextvars.ContextVar`. Οι μεταβλητές συμφραζόμενων χρησιμοποιούνται " +"κυρίως για να απομονώσουν την κατάσταση μεταξύ ταυτόχρονων ασύγχρονων " +"εργασιών." + +#: glossary.rst:319 msgid "contiguous" msgstr "contiguous" -#: glossary.rst:266 +#: glossary.rst:323 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -659,11 +838,11 @@ msgstr "" "μνήμης. Ωστόσο, σε Fortran contiguous πίνακες, ο πρώτος δείκτης μεταβάλλεται " "πιο γρήγορα." -#: glossary.rst:274 +#: glossary.rst:331 msgid "coroutine" msgstr "coroutine" -#: glossary.rst:276 +#: glossary.rst:333 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -676,11 +855,11 @@ msgstr "" "Μπορούν να υλοποιήσουν με την δήλωση :keyword:`async def`. Βλ. επίσης :pep:" "`492`." -#: glossary.rst:281 +#: glossary.rst:338 msgid "coroutine function" msgstr "coroutine συνάρτηση" -#: glossary.rst:283 +#: glossary.rst:340 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " "may be defined with the :keyword:`async def` statement, and may contain :" @@ -692,11 +871,11 @@ msgstr "" "και μπορεί να περιέχει :keyword:`await`, :keyword:`async for`, και :keyword:" "`async with` λέξεις κλειδιά. Αυτές εισήχθησαν από το :pep:`492`." -#: glossary.rst:288 +#: glossary.rst:345 msgid "CPython" msgstr "CPython" -#: glossary.rst:290 +#: glossary.rst:347 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -708,11 +887,50 @@ msgstr "" "όταν είναι απαραίτητο για την διάκριση αυτής της υλοποίησης από άλλες όπως η " "*Jython* ή η *IronPython*." -#: glossary.rst:294 +#: glossary.rst:351 +msgid "current context" +msgstr "τρέχον πλαίσιο" + +#: glossary.rst:353 +msgid "" +"The :term:`context` (:class:`contextvars.Context` object) that is currently " +"used by :class:`~contextvars.ContextVar` objects to access (get or set) the " +"values of :term:`context variables `. Each thread has its " +"own current context. Frameworks for executing asynchronous tasks (see :mod:" +"`asyncio`) associate each task with a context which becomes the current " +"context whenever the task starts or resumes execution." +msgstr "" +"Το :term:`context` (:class:`contextvars.Context` αντικείμενο) που " +"χρησιμοποιείται αυτή τη στιγμή από τα αντικείμενα :class:`~contextvars." +"ContextVar` για να προσπελάσει (να πάρει ή να ορίσει) τις τιμές των :term:" +"`context variables `. Κάθε νήμα έχει το δικό του τρέχον " +"συμφραζόμενο Τα πλαίσια για την εκτέλεση ασύγχρονων εργασιών (βλ. :mod:" +"`asyncio`) συνδέουν κάθε εργασία με ένα συμφραζόμενο, το οποίο γίνεται το " +"τρέχον συμφραζόμενο όποτε η εργασία ξεκινά ή συνεχίζει την εκτέλεση." + +#: glossary.rst:359 +msgid "cyclic isolate" +msgstr "κυκλική απομόνωση" + +#: glossary.rst:361 +msgid "" +"A subgroup of one or more objects that reference each other in a reference " +"cycle, but are not referenced by objects outside the group. The goal of " +"the :term:`cyclic garbage collector ` is to identify " +"these groups and break the reference cycles so that the memory can be " +"reclaimed." +msgstr "" +"Μια υποομάδα ενός ή περισσότερων αντικειμένων που αναφέρονται μεταξύ τους " +"σχηματίζοντας έναν κύκλο αναφορών, αλλά δεν αναφέρονται από άλλα " +"αντικείμενα εκτός της ομάδας. Ο σκοπός του :term:`cyclic garbage collector " +"` είναι να εντοπίζει αυτές τις ομάδες και να σπάει του " +"κύκλος αναφορών ώστε να μπορεί να αποδεσμευτεί η μνήμη." + +#: glossary.rst:365 msgid "decorator" msgstr "decorator" -#: glossary.rst:296 +#: glossary.rst:367 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -723,7 +941,7 @@ msgstr "" "Συνηθισμένα παραδείγματα για τους decorators είναι :func:`classmethod` και :" "func:`staticmethod`." -#: glossary.rst:300 +#: glossary.rst:371 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" @@ -731,7 +949,25 @@ msgstr "" "Η σύνταξη του decorator είναι απλώς καλλωπιστική, οι ακόλουθοι δύο ορισμοί " "συναρτήσεων είναι σημασιολογικά ισοδύναμοι::" -#: glossary.rst:311 +#: glossary.rst:374 +msgid "" +"def f(arg):\n" +" ...\n" +"f = staticmethod(f)\n" +"\n" +"@staticmethod\n" +"def f(arg):\n" +" ..." +msgstr "" +"def f(arg):\n" +" ...\n" +"f = staticmethod(f)\n" +"\n" +"@staticmethod\n" +"def f(arg):\n" +" ..." + +#: glossary.rst:382 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " @@ -741,11 +977,11 @@ msgstr "" "εκεί. Βλ. την τεκμηρίωση για :ref:`function definitions ` και :ref:" "`class definitions ` για περισσότερα σχετικά με τους decorators." -#: glossary.rst:314 +#: glossary.rst:385 msgid "descriptor" msgstr "descriptor" -#: glossary.rst:316 +#: glossary.rst:387 msgid "" "Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." "__set__`, or :meth:`~object.__delete__`. When a class attribute is a " @@ -768,7 +1004,7 @@ msgstr "" "αποτελεί την βάση για πολλά χαρακτηριστικά όπως συναρτήσεις, μεθόδους, " "ιδιότητες, μέθοδοι κλάσης στατικές μέθοδοι, και αναφορά σε σούπερ κλάσεις." -#: glossary.rst:327 +#: glossary.rst:398 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -777,11 +1013,11 @@ msgstr "" "see :ref:`descriptors` ή το :ref:`Πρακτικός οδηγός για τη χρήση του " "Descriptor `." -#: glossary.rst:329 +#: glossary.rst:400 msgid "dictionary" msgstr "λεξικό" -#: glossary.rst:331 +#: glossary.rst:402 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " @@ -791,11 +1027,11 @@ msgstr "" "τιμές. Τα κλειδιά μπορεί να είναι οποιοδήποτε αντικείμενο με μεθόδους :meth:" "`~object.__hash__` και :meth:`~object.__eq__`. Ονομάζεται ως hash στο Perl." -#: glossary.rst:335 +#: glossary.rst:406 msgid "dictionary comprehension" msgstr "κατανόηση λεξικού" -#: glossary.rst:337 +#: glossary.rst:408 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -808,11 +1044,11 @@ msgstr "" "κλειδί ``n`` που αντιστοιχίζεται με την τιμή ``n ** 2``. Βλ. :ref:" "`comprehensions`." -#: glossary.rst:341 +#: glossary.rst:412 msgid "dictionary view" msgstr "όψη λεξικού" -#: glossary.rst:343 +#: glossary.rst:414 msgid "" "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" "`dict.items` are called dictionary views. They provide a dynamic view on the " @@ -827,30 +1063,30 @@ msgstr "" "όψη λεξικού να γίνει μια πλήρης λίστα χρησιμοποιήστε το ``list(dictview)``. " "Βλ. :ref:`dict-views`." -#: glossary.rst:349 +#: glossary.rst:420 msgid "docstring" msgstr "docstring" -#: glossary.rst:351 +#: glossary.rst:422 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " -"the compiler and put into the :attr:`!__doc__` attribute of the enclosing " -"class, function or module. Since it is available via introspection, it is " -"the canonical place for documentation of the object." +"the compiler and put into the :attr:`~definition.__doc__` attribute of the " +"enclosing class, function or module. Since it is available via " +"introspection, it is the canonical place for documentation of the object." msgstr "" "Μια literal συμβολοσειρά που εμφανίζεται ως η πρώτη έκφραση σε μια κλάση, " "συνάρτηση ή module. Ενώ αγνοείται κατά την εκτέλεση της σουίτας, " "αναγνωρίζεται από τον μεταγλωττιστή και τοποθετείται στο χαρακτηριστικό :" -"attr:`!__doc__` της κλάσης, της συνάρτησης ή του module που περικλείει. " -"Δεδομένου ότι είναι διαθέσιμο μέσω ενδοσκόπησης, το κανονικό μέρος για την " -"τεκμηρίωση του αντικειμένου." +"attr:`~definition.__doc__` της κλάσης, της συνάρτησης ή του module που " +"περικλείει. Δεδομένου ότι είναι διαθέσιμο μέσω ενδοσκόπησης, το κανονικό " +"μέρος για την τεκμηρίωση του αντικειμένου." -#: glossary.rst:357 +#: glossary.rst:428 msgid "duck-typing" msgstr "duck-typing" -#: glossary.rst:359 +#: glossary.rst:430 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " @@ -873,11 +1109,25 @@ msgstr "" "με :term:`abstract base classes `.) Αντί αυτού, συνήθως " "χρησιμοποιεί δοκιμές :func:`hasattr` ή προγραμματισμό :term:`EAFP`." -#: glossary.rst:368 +#: glossary.rst:439 +msgid "dunder" +msgstr "dunder" + +#: glossary.rst:441 +msgid "" +"An informal short-hand for \"double underscore\", used when talking about a :" +"term:`special method`. For example, ``__init__`` is often pronounced " +"\"dunder init\"." +msgstr "" +"Ένας ανεπίσημος συντομογραφικός όρος για το \"double underscore\", που " +"χρησιμοποιείται όταν μιλάμε για μια :term:`special method`. Για παράδειγμα, " +"``__init__`` προφέρεται συχνά ως \"dunder init\"." + +#: glossary.rst:444 msgid "EAFP" msgstr "EAFP" -#: glossary.rst:370 +#: glossary.rst:446 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -894,11 +1144,25 @@ msgstr "" "αντίθεση με το στυλ που είναι :term:`LBYL` κοινό σε πολλές άλλες γλώσσες, " "όπως η C." -#: glossary.rst:376 +#: glossary.rst:452 +msgid "evaluate function" +msgstr "αξιολόγηση συνάρτησης" + +#: glossary.rst:454 +msgid "" +"A function that can be called to evaluate a lazily evaluated attribute of an " +"object, such as the value of type aliases created with the :keyword:`type` " +"statement." +msgstr "" +"Μια συνάρτηση που μπορεί να κληθεί για να αξιολογήσει ένα αδρανές " +"χαρακτηριστικό ενός αντικειμένου, όπως η τιμή των ψευδωνύμων τύπου που " +"δημιουργούνται με την πρόταση :keyword:`type`." + +#: glossary.rst:457 msgid "expression" msgstr "έκφραση" -#: glossary.rst:378 +#: glossary.rst:459 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -916,11 +1180,11 @@ msgstr "" "μπορούν να χρησιμοποιηθούν ως εκφράσεις, όπως το :keyword:`while`. Οι " "αναθέσεις τιμών είναι επίσης δηλώσεις όχι εκφράσεις." -#: glossary.rst:385 +#: glossary.rst:466 msgid "extension module" msgstr "module επέκτασης" -#: glossary.rst:387 +#: glossary.rst:468 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -928,25 +1192,29 @@ msgstr "" "Ένα module γραμμένο σε C ή C++, που χρησιμοποιείται από το C API της Python " "για να αλληλεπιδράσουν με τον πυρήνα και με τον κώδικα του χρήστη." -#: glossary.rst:389 +#: glossary.rst:470 msgid "f-string" msgstr "f-string" -#: glossary.rst:391 +#: glossary.rst:471 +msgid "f-strings" +msgstr "f-strings" + +#: glossary.rst:473 msgid "" -"String literals prefixed with ``'f'`` or ``'F'`` are commonly called \"f-" +"String literals prefixed with ``f`` or ``F`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " "See also :pep:`498`." msgstr "" -"Οι κυριολεκτικές συμβολοσειρές χρησιμοποιούν με πρόθεμα ``'f'`` ή ``'F'`` " +"Οι κυριολεκτικές συμβολοσειρές χρησιμοποιούνται με πρόθεμα ``'f'`` ή ``'F'`` " "ονομάζονται συνήθως \"f-strings\" που είναι συντομογραφία του :ref:" "`formatted string literals `. Βλ. επίσης :pep:`498`." -#: glossary.rst:394 +#: glossary.rst:476 msgid "file object" msgstr "αντικείμενο αρχείου" -#: glossary.rst:396 +#: glossary.rst:478 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -963,7 +1231,7 @@ msgstr "" "buffers, sockets, pipes, κλπ.). Αντικείμενο αρχείου ονομάζονται επίσης :dfn:" "`file-like objects` ή :dfn:`streams`." -#: glossary.rst:404 +#: glossary.rst:486 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -977,19 +1245,19 @@ msgstr "" "στην ενότητα :mod:`io`. Ο κανονικός τρόπος για να δημιουργήσετε ένα " "αντικείμενο αρχείου είναι χρησιμοποιώντας την συνάρτηση :func:`open`." -#: glossary.rst:409 +#: glossary.rst:491 msgid "file-like object" msgstr "αντικείμενο που μοιάζει με αρχείο" -#: glossary.rst:411 +#: glossary.rst:493 msgid "A synonym for :term:`file object`." msgstr "Ένα συνώνυμο με το :term:`file object`." -#: glossary.rst:412 +#: glossary.rst:494 msgid "filesystem encoding and error handler" msgstr "κωδικοποίηση συστήματος αρχείων και χειριστής σφαλμάτων" -#: glossary.rst:414 +#: glossary.rst:496 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -998,7 +1266,7 @@ msgstr "" "την αποκωδικοποίηση των bytes από το λειτουργικό σύστημα και την " "κωδικοποίηση σε Unicode για το λειτουργικό σύστημα." -#: glossary.rst:417 +#: glossary.rst:499 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -1009,7 +1277,7 @@ msgstr "" "αρχείων δεν παρέχει αυτήν την εγγύηση, οι συναρτήσεις API μπορούν να " "εγείρουν ένα :exc:`UnicodeError`." -#: glossary.rst:421 +#: glossary.rst:503 msgid "" "The :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors` functions can be used to get the filesystem " @@ -1019,7 +1287,7 @@ msgstr "" "getfilesystemencodeerrors` μπορούν να χρησιμοποιηθούν για να λάβετε την " "κωδικοποίηση του συστήματος αρχείων και του χειριστή σφαλμάτων." -#: glossary.rst:425 +#: glossary.rst:507 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " "startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." @@ -1031,15 +1299,15 @@ msgstr "" "`~PyConfig.filesystem_encoding` και :c:member:`~PyConfig.filesystem_errors` " "μέλη του :c:type:`PyConfig`." -#: glossary.rst:430 +#: glossary.rst:512 msgid "See also the :term:`locale encoding`." msgstr "Βλ. επίσης το :term:`locale encoding`." -#: glossary.rst:431 +#: glossary.rst:513 msgid "finder" msgstr "finder" -#: glossary.rst:433 +#: glossary.rst:515 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." @@ -1047,26 +1315,28 @@ msgstr "" "Ένα αντικείμενο που προσπαθεί να βρει το :term:`loader` για ένα module που " "εισήχθη." -#: glossary.rst:436 +#: glossary.rst:518 msgid "" -"Since Python 3.3, there are two types of finder: :term:`meta path finders " -"` for use with :data:`sys.meta_path`, and :term:`path " -"entry finders ` for use with :data:`sys.path_hooks`." +"There are two types of finder: :term:`meta path finders ` " +"for use with :data:`sys.meta_path`, and :term:`path entry finders ` for use with :data:`sys.path_hooks`." msgstr "" -"Από την Python 3.3, υπάρχουν δύο τύποι finder: :term:`finders μετα διαδρομής " -"` για χρήση με :data:`sys.meta_path`, και :term:`finders " -"εισόδου διαδρομής ` για χρήση με :data:`sys.path_hooks`." +"Υπάρχουν δύο τύποι finder: :term:`finders μετα διαδρομής ` " +"για χρήση με :data:`sys.meta_path`, και :term:`finders εισόδου διαδρομής " +"` για χρήση με :data:`sys.path_hooks`." -#: glossary.rst:440 -msgid "See :pep:`302`, :pep:`420` and :pep:`451` for much more detail." +#: glossary.rst:522 +msgid "" +"See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail." msgstr "" -"Βλ. :pep:`302`, :pep:`420` και :pep:`451` για περισσότερες λεπτομέρειες." +"Βλ. :ref:`finders-and-loaders` και :mod:`importlib` για περισσότερες " +"λεπτομέρειες." -#: glossary.rst:441 +#: glossary.rst:523 msgid "floor division" msgstr "ακέραια διαίρεση" -#: glossary.rst:443 +#: glossary.rst:525 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1081,11 +1351,47 @@ msgstr "" "4`` κάνει ``-3`` επειδή αυτή είναι η στρογγυλοποίηση *προς τα κάτω* του " "``-2.75``. Βλ. :pep:`238`." -#: glossary.rst:448 +#: glossary.rst:530 +msgid "free threading" +msgstr "δωρεάν νήμα" + +#: glossary.rst:532 +msgid "" +"A threading model where multiple threads can run Python bytecode " +"simultaneously within the same interpreter. This is in contrast to the :" +"term:`global interpreter lock` which allows only one thread to execute " +"Python bytecode at a time. See :pep:`703`." +msgstr "" +"Ένα μοντέλο νημάτων όπου πολλά νήματα μπορούν να εκτελούν Python bytecode " +"ταυτόχρονα μέσα στον ίδιο διερμηνέα. Αυτό έρχεται σε αντίθεση με το :term:" +"`global interpreter lock`, το οποίο επιτρέπει σε ένα μόνο νήμα να εκτελεί " +"Python bytecode κάθε φορά. Δείτε το :pep:`703`." + +#: glossary.rst:536 +msgid "free variable" +msgstr "δωρεάν μεταβλητή" + +#: glossary.rst:538 +msgid "" +"Formally, as defined in the :ref:`language execution model `, a " +"free variable is any variable used in a namespace which is not a local " +"variable in that namespace. See :term:`closure variable` for an example. " +"Pragmatically, due to the name of the :attr:`codeobject.co_freevars` " +"attribute, the term is also sometimes used as a synonym for :term:`closure " +"variable`." +msgstr "" +"Τυπικά, όπως ορίζεται στο :ref:`language execution model `, μια " +"ελεύθερη μεταβλητή είναι οποιαδήποτε μεταβλητή χρησιμοποιείται σε ένα " +"namespace που δεν είναι τοπική μεταβλητή σε εκείνο το namespace. Δείτε το :" +"term:`closure variable` για παράδειγμα. Πρακτικά, λόγω του ονόματος του " +"χαρακτηριστικού :attr:`codeobject.co_freevars`, ο όρος χρησιμοποιείται " +"επίσης μερικές φορές ως συνώνυμο της :term:`closure variable`." + +#: glossary.rst:543 msgid "function" msgstr "συνάρτηση" -#: glossary.rst:450 +#: glossary.rst:545 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " @@ -1097,16 +1403,16 @@ msgstr "" "` που μπορεί να χρησιμοποιηθεί για την εκτέλεση. Βλ. επίσης τις " "ενότητες :term:`parameter`, :term:`method`, και the :ref:`function`." -#: glossary.rst:454 +#: glossary.rst:549 msgid "function annotation" msgstr "συνάρτηση annotation" -#: glossary.rst:456 +#: glossary.rst:551 msgid "An :term:`annotation` of a function parameter or return value." msgstr "" "Ένας :term:`annotation` μιας παραμέτρου συνάρτησης ή μιας τιμής επιστροφής." -#: glossary.rst:458 +#: glossary.rst:553 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1117,12 +1423,20 @@ msgstr "" "ορίσματα :class:`int` και επίσης αναμένεται να έχει μία επιστρεφόμενη τιμή :" "class:`int`::" -#: glossary.rst:466 +#: glossary.rst:558 +msgid "" +"def sum_two_numbers(a: int, b: int) -> int:\n" +" return a + b" +msgstr "" +"def sum_two_numbers(a: int, b: int) -> int:\n" +" return a + b" + +#: glossary.rst:561 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "" "Η σύνταξη συνάρτησης annotation αναλύεται στην ενότητα :ref:`function`." -#: glossary.rst:468 +#: glossary.rst:563 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1132,11 +1446,11 @@ msgstr "" "λειτουργικότητα. Επίσης βλ. :ref:`annotations-howto` για τις καλύτερες " "πρακτικές δουλεύοντας με annotations." -#: glossary.rst:472 +#: glossary.rst:567 msgid "__future__" msgstr "__future__" -#: glossary.rst:474 +#: glossary.rst:569 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " @@ -1155,11 +1469,21 @@ msgstr "" "προστέθηκε για πρώτη φορά στην γλώσσα και πότε θα γίνει (ή έγινε) η " "προεπιλογή::" -#: glossary.rst:485 +#: glossary.rst:577 +msgid "" +">>> import __future__\n" +">>> __future__.division\n" +"_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" +msgstr "" +">>> import __future__\n" +">>> __future__.division\n" +"_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" + +#: glossary.rst:580 msgid "garbage collection" msgstr "συλλογή απορριμάτων" -#: glossary.rst:487 +#: glossary.rst:582 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1172,11 +1496,11 @@ msgstr "" "τους κύκλους αναφοράς. Ο συλλέκτης απορριμάτων μπορεί να ελεγχθεί " "χρησιμοποιώντας το module :mod:`gc`." -#: glossary.rst:493 +#: glossary.rst:588 msgid "generator" msgstr "generator" -#: glossary.rst:495 +#: glossary.rst:590 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1189,7 +1513,7 @@ msgstr "" "*for* ή που μπορούν να ανακτηθούν μία τη φορά με την συνάρτηση :func:`next` " "function." -#: glossary.rst:500 +#: glossary.rst:595 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1200,48 +1524,56 @@ msgstr "" "επιδιωκόμενο νόημα δεν είναι σαφές, η χρήση των πλήρων όρων αποφεύγει την " "ασάφεια." -#: glossary.rst:503 +#: glossary.rst:598 msgid "generator iterator" msgstr "generator iterator" -#: glossary.rst:505 +#: glossary.rst:600 msgid "An object created by a :term:`generator` function." msgstr "Ένα αντικείμενο που δημιουργείται από μια συνάρτηση :term:`generator`." -#: glossary.rst:507 +#: glossary.rst:602 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " -"location execution state (including local variables and pending try-" -"statements). When the *generator iterator* resumes, it picks up where it " -"left off (in contrast to functions which start fresh on every invocation)." +"execution state (including local variables and pending try-statements). " +"When the *generator iterator* resumes, it picks up where it left off (in " +"contrast to functions which start fresh on every invocation)." msgstr "" "Κάθε :keyword:`yield` αναστέλλει προσωρινά την επεξεργασία, θυμάται την " -"τοποθεσία κατάστασης εκτέλεσης (συμπεριλαμβανομένων των τοπικών μεταβλητών " -"και των δηλώσεων δοκιμής σε εκκρεμότητα). Όταν ο *generator iterator* " -"συνεχίσει, συνεχίζει από εκεί που σταμάτησε (σε αντίθεση με τις συναρτήσεις " -"που ξεκινούν από την αρχή σε κάθε επίκληση)." +"κατάσταση εκτέλεσης (συμπεριλαμβανομένων των τοπικών μεταβλητών και των " +"δηλώσεων δοκιμής σε εκκρεμότητα). Όταν ο *generator iterator* συνεχίσει, " +"συνεχίζει από εκεί που σταμάτησε (σε αντίθεση με τις συναρτήσεις που " +"ξεκινούν από την αρχή σε κάθε επίκληση)." -#: glossary.rst:514 +#: glossary.rst:609 msgid "generator expression" msgstr "generator έκφραση" -#: glossary.rst:516 +#: glossary.rst:611 msgid "" -"An expression that returns an iterator. It looks like a normal expression " -"followed by a :keyword:`!for` clause defining a loop variable, range, and an " -"optional :keyword:`!if` clause. The combined expression generates values " -"for an enclosing function::" +"An :term:`expression` that returns an :term:`iterator`. It looks like a " +"normal expression followed by a :keyword:`!for` clause defining a loop " +"variable, range, and an optional :keyword:`!if` clause. The combined " +"expression generates values for an enclosing function::" msgstr "" -"Μια έκφραση που επιστρέφει έναν iterator. Μοιάζει με κανονική έκφραση που " -"ακολουθείται από μια πρόταση :keyword:`!for` που ορίζει μια μεταβλητή " -"βρόχου, ένα εύρος και μια προαιρετική πρόταση :keyword:`!if`. Η συνδυασμένη " -"έκφραση δημιουργεί τιμές για μια συνάρτηση εγκλεισμού::" +"Μια :term:`expression` που επιστρέφει έναν :term:`iterator`. Μοιάζει με " +"κανονική έκφραση που ακολουθείται από μια πρόταση :keyword:`!for` που ορίζει " +"μια μεταβλητή βρόχου, ένα εύρος και μια προαιρετική πρόταση :keyword:`!if`. " +"Η συνδυασμένη έκφραση δημιουργεί τιμές για μια συνάρτηση εγκλεισμού::" -#: glossary.rst:523 +#: glossary.rst:616 +msgid "" +">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" +"285" +msgstr "" +">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" +"285" + +#: glossary.rst:618 msgid "generic function" msgstr "γενική συνάρτηση" -#: glossary.rst:525 +#: glossary.rst:620 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1252,7 +1584,7 @@ msgstr "" "χρησιμοποιηθεί κατά τη διάρκεια μια κλήσης καθορίζεται από τον αλγόριθμο " "αποστολής." -#: glossary.rst:529 +#: glossary.rst:624 msgid "" "See also the :term:`single dispatch` glossary entry, the :func:`functools." "singledispatch` decorator, and :pep:`443`." @@ -1260,11 +1592,11 @@ msgstr "" "Βλ. επίσης την καταχώρηση του :term:`single dispatch`, τον decorator :func:" "`functools.singledispatch` και :pep:`443`." -#: glossary.rst:531 +#: glossary.rst:626 msgid "generic type" msgstr "γενικός τύπος" -#: glossary.rst:533 +#: glossary.rst:628 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" @@ -1275,7 +1607,7 @@ msgstr "" "Χρησιμοποιείται για :term:`type hints ` και :term:`annotations " "`." -#: glossary.rst:538 +#: glossary.rst:633 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." @@ -1284,19 +1616,19 @@ msgstr "" "genericalias>` :pep:`483`, :pep:`484`, :pep:`585`, και το module :mod:" "`typing`." -#: glossary.rst:540 +#: glossary.rst:635 msgid "GIL" msgstr "GIL" -#: glossary.rst:542 +#: glossary.rst:637 msgid "See :term:`global interpreter lock`." msgstr "Βλ. :term:`global interpreter lock`." -#: glossary.rst:543 +#: glossary.rst:638 msgid "global interpreter lock" msgstr "global interpreter lock" -#: glossary.rst:545 +#: glossary.rst:640 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1315,7 +1647,7 @@ msgstr "" "του μεγάλου μέρους του παραλληλισμού που παρέχουν οι μηχανές πολλαπλών " "επεξεργαστών." -#: glossary.rst:554 +#: glossary.rst:649 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1327,26 +1659,39 @@ msgstr "" "εντατικών υπολογισμών όπως συμπίεση ή κατακερματισμός. Επίσης, το GIL " "απελευθερώνεται πάντα όταν εκτελείτε I/O." -#: glossary.rst:559 +#: glossary.rst:654 +msgid "" +"As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " +"build configuration. After building Python with this option, code must be " +"run with :option:`-X gil=0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 " +"` environment variable. This feature enables improved " +"performance for multi-threaded applications and makes it easier to use multi-" +"core CPUs efficiently. For more details, see :pep:`703`." +msgstr "" +"Από την έκδοση Python 3.13, ο GIL μπορεί να απενεργοποιηθεί χρησιμοποιώντας " +"τη ρύθμιση :option:`--disable-gil` κατά τη διαμόρφωση της κατασκευής. Μετά " +"την κατασκευή της Python με αυτήν με αυτήν την επιλογή, ο κώδικας πρέπει να " +"εκτελείται με την επιλογή :option:`-X gil=0 <-X>` ή αφού ρυθμιστεί η " +"μεταβλητή περιβάλλοντος :envvar:`PYTHON_GIL=0 `. Αυτή η " +"δυνατότητα επιτρέπει βελτιωμένη απόδοση για εφαρμογές πολλαπλών νημάτων και " +"διευκολύνει τη χρήση των επεξεργαστών πολλαπλών πυρήνων με αποδοτικό τρόπο. " +"Για περισσότερες λεπτομέρειες, δείτε το :pep:`703`." + +#: glossary.rst:661 msgid "" -"Past efforts to create a \"free-threaded\" interpreter (one which locks " -"shared data at a much finer granularity) have not been successful because " -"performance suffered in the common single-processor case. It is believed " -"that overcoming this performance issue would make the implementation much " -"more complicated and therefore costlier to maintain." +"In prior versions of Python's C API, a function might declare that it " +"requires the GIL to be held in order to use it. This refers to having an :" +"term:`attached thread state`." msgstr "" -"Προηγούμενες προσπάθειες να δημιουργηθεί ένας διερμηνέας \"ελεύθερων-" -"νημάτων\" (αυτός που κλειδώνει τα κοινόχρηστα δεδομένα με πολύ πιο λεπτομερή " -"ευαισθησία) δεν ήταν επιτυχείς επειδή η απόδοση υποχώρησε στην κοινή " -"περίπτωση ενός επεξεργαστή. Πιστεύεται ότι η υπέρβαση αυτού του προβλήματος " -"απόδοσης θα κάνουν πολύ πιο περίπλοκη και επομένως πιο δαπανηρή στην " -"συντήρηση." +"Σε προηγούμενες εκδόσεις του C API της Python, μια συνάρτηση μπορεί να " +"δηλώνει ότι απαιτεί την τήρηση του GIL για να χρησιμοποιηθεί. Αυτό " +"αναφέρεται στην ύπαρξη μιας κατάστασης :term:`attached thread state`." -#: glossary.rst:565 +#: glossary.rst:664 msgid "hash-based pyc" msgstr "hash-based pyc" -#: glossary.rst:567 +#: glossary.rst:666 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1356,11 +1701,11 @@ msgstr "" "όχι τον χρόνο τροποποίησης του αντίστοιχου αρχείου προέλευσης για να " "προσδιορίσει την εγκυρότητα του. Βλ. :ref:`pyc-invalidation`." -#: glossary.rst:570 +#: glossary.rst:669 msgid "hashable" msgstr "hashable" -#: glossary.rst:572 +#: glossary.rst:671 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " @@ -1374,7 +1719,7 @@ msgstr "" "που συγκρίνονται ως προς την ισότητα τους πρέπει να έχουν την ίδια τιμή " "κατακερματισμού." -#: glossary.rst:578 +#: glossary.rst:677 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1383,7 +1728,7 @@ msgstr "" "κλειδί λεξικού και ως μέλος ενός συνόλου, επειδή αυτές οι δομές δεδομένων " "χρησιμοποιούν τιμές κατακερματισμού." -#: glossary.rst:581 +#: glossary.rst:680 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1400,11 +1745,11 @@ msgstr "" "μπορούν να κατακερματιστούν από προεπιλογή. Όλα συγκρίνονται άνισα εκτός από " "τον εαυτό τους) και η τιμή κατακερματισμού τους προέρχεται από το :func:`id`." -#: glossary.rst:588 +#: glossary.rst:687 msgid "IDLE" msgstr "IDLE" -#: glossary.rst:590 +#: glossary.rst:689 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1414,11 +1759,41 @@ msgstr "" "`idle` είναι ένα βασικό περιβάλλον επεξεργασίας και διερμηνέα που " "συνοδεύεται από την τυπική διανομή της Python." -#: glossary.rst:593 +#: glossary.rst:692 +msgid "immortal" +msgstr "Αθάνατο" + +#: glossary.rst:694 +msgid "" +"*Immortal objects* are a CPython implementation detail introduced in :pep:" +"`683`." +msgstr "" +"*Αθάνατα αντικείμενα* είναι μια λεπτομέρεια υλοποίησης της CPython που " +"εισήχθη στην :pep:`683`." + +#: glossary.rst:697 +msgid "" +"If an object is immortal, its :term:`reference count` is never modified, and " +"therefore it is never deallocated while the interpreter is running. For " +"example, :const:`True` and :const:`None` are immortal in CPython." +msgstr "" +"Εάν ένα αντικείμενο είναι αθάνατο, ο :term:`reference count` του δεν " +"τροποποιείται, και επομένως δεν εκχωρείται ποτέ ενώ εκτελείται ο διερμηνέας. " +"Για παράδειγμα, :const:`True` και :const:`None` είναι αθάνατα στην CPython." + +#: glossary.rst:701 +msgid "" +"Immortal objects can be identified via :func:`sys._is_immortal`, or via :c:" +"func:`PyUnstable_IsImmortal` in the C API." +msgstr "" +"Τα αθάνατα αντικείμενα μπορούν να αναγνωριστούν μέσω της :func:`sys." +"_is_immortal`, ή μέσω της :c:func:`PyUnstable_IsImmortal` στο C API." + +#: glossary.rst:703 msgid "immutable" msgstr "immutable" -#: glossary.rst:595 +#: glossary.rst:705 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1432,11 +1807,11 @@ msgstr "" "αποθηκευτεί μια διαφορετική τιμή. Παίζουν σημαντικό ρόλο σε μέρη όπου μια " "σταθερά απαιτείται, για παράδειγμα ως κλειδί σε ένα λεξικό." -#: glossary.rst:600 +#: glossary.rst:710 msgid "import path" msgstr "εισαγόμενο path" -#: glossary.rst:602 +#: glossary.rst:712 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1449,11 +1824,11 @@ msgstr "" "από :data:`sys.path`, αλλά για τα υποπακέτα μπορεί επίσης να έρθει από το " "χαρακτηριστικό του πακέτου γονέα ``__path__``." -#: glossary.rst:607 +#: glossary.rst:717 msgid "importing" msgstr "εισαγωγή" -#: glossary.rst:609 +#: glossary.rst:719 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1461,11 +1836,11 @@ msgstr "" "Η διαδικασία κατά την οποία ο κώδικας της Python σε ένα module είναι " "διαθέσιμη στον κώδικα Python ενός άλλου module." -#: glossary.rst:611 +#: glossary.rst:721 msgid "importer" msgstr "εισαγωγέας" -#: glossary.rst:613 +#: glossary.rst:723 msgid "" "An object that both finds and loads a module; both a :term:`finder` and :" "term:`loader` object." @@ -1473,30 +1848,32 @@ msgstr "" "Ένα αντικείμενο μπορεί και να αναζητεί και να φορτώνει ένα module' και ένα :" "term:`finder` και :term:`loader` αντικείμενο." -#: glossary.rst:615 +#: glossary.rst:725 msgid "interactive" msgstr "διαδραστικός" -#: glossary.rst:617 +#: glossary.rst:727 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " "their results. Just launch ``python`` with no arguments (possibly by " "selecting it from your computer's main menu). It is a very powerful way to " -"test out new ideas or inspect modules and packages (remember ``help(x)``)." +"test out new ideas or inspect modules and packages (remember ``help(x)``). " +"For more on interactive mode, see :ref:`tut-interac`." msgstr "" "Η Python έχει έναν διαδραστικό διερμηνέα όπου σημαίνει ότι μπορείς να " "εισάγεις δηλώσεις και εκφράσεις στην εισαγωγή εντολών του διερμηνέα, " -"εκτελώντας τες άμεσα και εμφανίζοντας τα αντικείμενα. Απλώς εκκινήστε την " +"εκτελώντας τες άμεσα και εμφανίζοντας τα αποτελέσματα. Απλώς εκκινήστε την " "``python`` χωρίς ορίσματα (πιθανώς επιλέγοντας το από το κύριο μενού του " "υπολογιστή σας). Αποτελεί έναν αποδοτικό τρόπο για να δοκιμάστε νέες ιδέες ή " -"να εξετάστε λειτουργικές μονάδες και πακέτα (θυμηθείτε ``help(x)``)." +"να εξετάστε modules και πακέτα (θυμηθείτε ``help(x)``). Για περισσότερα " +"σχετικά με τη διαδραστική λειτουργία, δείτε :ref:`tut-interac`." -#: glossary.rst:623 +#: glossary.rst:734 msgid "interpreted" msgstr "interpreted" -#: glossary.rst:625 +#: glossary.rst:736 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1513,11 +1890,11 @@ msgstr "" "εντοπισμού σφαλμάτων από τις μεταγλωττισμένες, αν και τα προγράμματά τους " "γενικά εκτελούνται πιο αργά. Βλ. επίσης :term:`interactive`." -#: glossary.rst:632 +#: glossary.rst:743 msgid "interpreter shutdown" msgstr "τερματισμός λειτουργίας διερμηνέα" -#: glossary.rst:634 +#: glossary.rst:745 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1539,7 +1916,7 @@ msgstr "" "βασίζεται ενδέχεται να μην λειτουργούν πλέον (συνήθη παραδείγματα είναι οι " "λειτουργικές μονάδες βιβλιοθήκης ή ο μηχανισμός ειδοποιήσεων)." -#: glossary.rst:643 +#: glossary.rst:754 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." @@ -1547,28 +1924,28 @@ msgstr "" "Ο βασικός λόγος τερματισμού λειτουργίας του διερμηνέα είναι ότι το " "``__main__`` module ή ολοκληρώθηκε η εκτέλεση του κώδικα που έτρεχε." -#: glossary.rst:645 +#: glossary.rst:756 msgid "iterable" msgstr "iterable" -#: glossary.rst:647 +#: glossary.rst:758 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " "and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:" "`file objects `, and objects of any classes you define with an :" -"meth:`~iterator.__iter__` method or with a :meth:`~object.__getitem__` " -"method that implements :term:`sequence` semantics." +"meth:`~object.__iter__` method or with a :meth:`~object.__getitem__` method " +"that implements :term:`sequence` semantics." msgstr "" "Ένα αντικείμενο ικανό να επιστρέψει τα μέλη του ένα κάθε φορά. Παραδείγματα " "iterables περιλαμβάνουν όλους του τύπους ακολουθιών (όπως :class:`list`, :" "class:`str`, και :class:`tuple`) και μερικούς τύπους μη ακολουθίας όπως :" "class:`dict`, :term:`αντικείμενο αρχείου `, και αντικείμενα " -"οποιονδήποτε κλάσεων που μπορούν να οριστούν με μια μέθοδο :meth:`~iterator." +"οποιονδήποτε κλάσεων που μπορούν να οριστούν με μια μέθοδο :meth:`~object." "__iter__` ή με μία μέθοδο :meth:`~object.__getitem__` που υλοποιεί τη " "σημασιολογία :term:`sequence`." -#: glossary.rst:655 +#: glossary.rst:766 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1592,11 +1969,11 @@ msgstr "" "του βρόχου. Βλ. επίσης :term:`iterator`, :term:`sequence`, και :term:" "`generator`." -#: glossary.rst:665 +#: glossary.rst:776 msgid "iterator" msgstr "iterator" -#: glossary.rst:667 +#: glossary.rst:778 msgid "" "An object representing a stream of data. Repeated calls to the iterator's :" "meth:`~iterator.__next__` method (or passing it to the built-in function :" @@ -1631,23 +2008,26 @@ msgstr "" "εξαντλημένο αντικείμενο iterator που χρησιμοποιήθηκε στο προηγούμενο πέρασμα " "iteration , κάνοντας το να φαίνεται σαν ένα άδειο κοντέινερ." -#: glossary.rst:682 +#: glossary.rst:793 msgid "More information can be found in :ref:`typeiter`." msgstr "Περισσότερες πληροφορίες μπορούν να βρεθούν στο :ref:`typeiter`." -#: glossary.rst:686 +#: glossary.rst:797 msgid "" "CPython does not consistently apply the requirement that an iterator define :" -"meth:`~iterator.__iter__`." +"meth:`~iterator.__iter__`. And also please note that the free-threading " +"CPython does not guarantee the thread-safety of iterator operations." msgstr "" "Το CPython δεν εφαρμόζει με συνέπεια την απαίτηση να ορίζει ένας iterator :" -"meth:`~iterator.__iter__`." +"meth:`~iterator.__iter__`. Επίσης σημειώστε ότι η έκδοση CPython με ελεύθερη " +"υποστήριξη νημάτων δεν εγγυάται την ασφάλεια νημάτων για διαδικασίες με " +"iterators." -#: glossary.rst:688 +#: glossary.rst:802 msgid "key function" msgstr "συνάρτηση key" -#: glossary.rst:690 +#: glossary.rst:804 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1659,7 +2039,7 @@ msgstr "" "κλειδιού ταξινόμησης που γνωρίζει τις συμβάσεις ταξινόμησης για " "συγκεκριμένες τοπικές ρυθμίσεις." -#: glossary.rst:695 +#: glossary.rst:809 msgid "" "A number of tools in Python accept key functions to control how elements are " "ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" @@ -1669,10 +2049,10 @@ msgstr "" "Ένα αριθμός εργαλείων στην Python δέχεται βασικές συναρτήσεις για τον έλεγχο " "του τρόπου με τον οποίο τα στοιχεία ταξινομούνται ή ομαδοποιούνται. Αυτά " "περιέχουν :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:" -"`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq. nlargest`, και :func:" +"`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, και :func:" "`itertools.groupby`." -#: glossary.rst:701 +#: glossary.rst:815 msgid "" "There are several ways to create a key function. For example. the :meth:" "`str.lower` method can serve as a key function for case insensitive sorts. " @@ -1692,19 +2072,19 @@ msgstr "" "TO` για παραδείγματα δημιουργίας και χρήσης βασικών " "συναρτήσεων." -#: glossary.rst:708 +#: glossary.rst:822 msgid "keyword argument" msgstr "όρισμα keyword" -#: glossary.rst:1001 +#: glossary.rst:1148 msgid "See :term:`argument`." msgstr "Βλ. :term:`argument`." -#: glossary.rst:711 +#: glossary.rst:825 msgid "lambda" msgstr "lambda" -#: glossary.rst:713 +#: glossary.rst:827 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1715,11 +2095,11 @@ msgstr "" "τη δημιουργία μιας συνάρτησης lambda είναι ``lambda [parameters]: " "expression``" -#: glossary.rst:716 +#: glossary.rst:830 msgid "LBYL" msgstr "LBYL" -#: glossary.rst:718 +#: glossary.rst:832 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1731,7 +2111,7 @@ msgstr "" "έρχεται σε αντίθεση με την προσέγγιση :term:`EAFP` και χαρακτηρίζεται από " "την παρουσία πολλών δηλώσεων :keyword:`if`." -#: glossary.rst:723 +#: glossary.rst:837 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1746,59 +2126,33 @@ msgstr "" "το *mapping* μετά τη δοκιμή, αλλά πριν από την αναζήτηση. Αυτό το πρόβλημα " "μπορεί να λυθεί με κλειδώματα ή χρησιμοποιώντας την προσέγγιση EAFP." -#: glossary.rst:728 -msgid "locale encoding" -msgstr "τοπική κωδικοποίηση" - -#: glossary.rst:730 -msgid "" -"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" -"`locale.setlocale(locale.LC_CTYPE, new_locale) `." -msgstr "" -"Στο Unix, είναι η κωδικοποίηση της τοπική ρύθμισης LC_CTYPE. Μπορεί να " -"ρυθμιστεί με :func:`locale.setlocale(locale.LC_CTYPE, new_locale) `." +#: glossary.rst:842 +msgid "lexical analyzer" +msgstr "λεξικός αναλυτής" -#: glossary.rst:733 -msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." -msgstr "Στα Windows, είναι η code page ANSI (π.χ. ``\"cp1252\"``)." - -#: glossary.rst:735 -msgid "" -"On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." -msgstr "" -"Στο Android και το VxWorks, η Python χρησιμοποιεί το ``\"utf-8\"`` ως τοπική " -"κωδικοποίηση." - -#: glossary.rst:737 -msgid "``locale.getencoding()`` can be used to get the locale encoding." -msgstr "" -"``locale.getencoding()`` μπορεί να χρησιμοποιηθεί για την ανάκτηση της " -"τοπικής κωδικοποίησης." - -#: glossary.rst:739 -msgid "See also the :term:`filesystem encoding and error handler`." -msgstr "Βλ. επίσης το :term:`filesystem encoding and error handler`." +#: glossary.rst:845 +msgid "Formal name for the *tokenizer*; see :term:`token`." +msgstr "Επίσημη ονομασία για τον *tokenizer* · βλ. :term:`token`." -#: glossary.rst:740 +#: glossary.rst:846 msgid "list" msgstr "λίστα" -#: glossary.rst:742 +#: glossary.rst:848 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " "*O*\\ (1)." msgstr "" -"Ένα ενσωματωμένο Pytohn :term:`sequence`. Παρά το όνομα του, μοιάζει " +"Ένα ενσωματωμένο Python :term:`sequence`. Παρά το όνομα του, μοιάζει " "περισσότερο με έναν πίνακα σε άλλες γλώσσες παρά με μια συνδεδεμένη λίστα, " "καθώς η πρόσβαση στα στοιχεί είναι *O*\\ (1)." -#: glossary.rst:745 +#: glossary.rst:851 msgid "list comprehension" msgstr "list comprehension" -#: glossary.rst:747 +#: glossary.rst:853 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1813,35 +2167,81 @@ msgstr "" "από 0 έως 255. Η πρόταση :keyword:`if` είναι προαιρετική. Εάν παραλειφθεί, " "όλα τα στοιχεία στο ``range(256)`` υποβάλλονται σε επεξεργασία." -#: glossary.rst:753 +#: glossary.rst:859 msgid "loader" msgstr "loader" -#: glossary.rst:755 +#: glossary.rst:861 +msgid "" +"An object that loads a module. It must define the :meth:`!exec_module` and :" +"meth:`!create_module` methods to implement the :class:`~importlib.abc." +"Loader` interface. A loader is typically returned by a :term:`finder`. See " +"also:" +msgstr "" +"Ένα αντικείμενο που φορτώνει ένα module. Πρέπει να ορίζει τις μεθόδους :meth:" +"`!exec_module` και :meth:`!create_module` για την υλοποίηση της διεπαφής :" +"class:`~importlib.abc.Loader`. Ένας loader συνήθως επιστρέφεται με ένα :term:" +"`finder`. Δείτε επίσης:" + +#: glossary.rst:867 +msgid ":ref:`finders-and-loaders`" +msgstr ":ref:`finders-and-loaders`" + +#: glossary.rst:868 +msgid ":class:`importlib.abc.Loader`" +msgstr ":class:`importlib.abc.Loader`" + +#: glossary.rst:869 +msgid ":pep:`302`" +msgstr ":pep:`302`" + +#: glossary.rst:870 +msgid "locale encoding" +msgstr "τοπική κωδικοποίηση" + +#: glossary.rst:872 msgid "" -"An object that loads a module. It must define a method named :meth:" -"`load_module`. A loader is typically returned by a :term:`finder`. See :pep:" -"`302` for details and :class:`importlib.abc.Loader` for an :term:`abstract " -"base class`." +"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" +"`locale.setlocale(locale.LC_CTYPE, new_locale) `." msgstr "" -"Ένα αντικείμενο που φορτώνει ένα module. Πρέπει να ορίσει μια μέθοδο με το " -"όνομα :meth:`load_module`. Ένας loader συνήθως επιστρέφεται από έναν :term:" -"`finder`. Βλ. :pep:`302` για λεπτομέρειες και :class:`importlib.abc.Loader` " -"για μια :term:`abstract base class`." +"Στο Unix, είναι η κωδικοποίηση της τοπική ρύθμισης LC_CTYPE. Μπορεί να " +"ρυθμιστεί με :func:`locale.setlocale(locale.LC_CTYPE, new_locale) `." + +#: glossary.rst:875 +msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." +msgstr "Στα Windows, είναι η code page ANSI (π.χ. ``\"cp1252\"``)." -#: glossary.rst:759 +#: glossary.rst:877 +msgid "" +"On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." +msgstr "" +"Στο Android και το VxWorks, η Python χρησιμοποιεί το ``\"utf-8\"`` ως τοπική " +"κωδικοποίηση." + +#: glossary.rst:879 +msgid ":func:`locale.getencoding` can be used to get the locale encoding." +msgstr "" +":func:`locale.getencoding` μπορεί να χρησιμοποιηθεί για την ανάκτηση της " +"τοπικής κωδικοποίησης." + +#: glossary.rst:881 +msgid "See also the :term:`filesystem encoding and error handler`." +msgstr "Βλ. επίσης το :term:`filesystem encoding and error handler`." + +#: glossary.rst:882 msgid "magic method" msgstr "μαγική μέθοδος" -#: glossary.rst:763 +#: glossary.rst:886 msgid "An informal synonym for :term:`special method`." msgstr "Ένα άτυπο συνώνυμο για :term:`special method`." -#: glossary.rst:764 +#: glossary.rst:887 msgid "mapping" msgstr "mapping" -#: glossary.rst:766 +#: glossary.rst:889 msgid "" "A container object that supports arbitrary key lookups and implements the " "methods specified in the :class:`collections.abc.Mapping` or :class:" @@ -1857,11 +2257,11 @@ msgstr "" "class:`dict`, :class:`collections.defaultdict`, :class:`collections." "OrderedDict` και :class:`collections.Counter`." -#: glossary.rst:772 +#: glossary.rst:895 msgid "meta path finder" msgstr "meta path finder" -#: glossary.rst:774 +#: glossary.rst:897 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders `." -#: glossary.rst:778 +#: glossary.rst:901 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." @@ -1879,11 +2279,11 @@ msgstr "" "Βλ. :class:`importlib.abc.MetaPathFinder` για τις μεθόδους που υλοποιούν οι " "meta path finders." -#: glossary.rst:780 +#: glossary.rst:903 msgid "metaclass" msgstr "μετα-κλάση" -#: glossary.rst:782 +#: glossary.rst:905 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1907,15 +2307,15 @@ msgstr "" "ασφάλειας νημάτων, την παρακολούθηση δημιουργίας αντικειμένων, την υλοποίηση " "*singletons*, και πολλές άλλες εργασίες." -#: glossary.rst:792 +#: glossary.rst:915 msgid "More information can be found in :ref:`metaclasses`." msgstr "Περισσότερες πληροφορίες μπορούν να βρεθούν στο :ref:`metaclasses`." -#: glossary.rst:1131 +#: glossary.rst:1299 msgid "method" msgstr "μέθοδος" -#: glossary.rst:795 +#: glossary.rst:918 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -1927,28 +2327,26 @@ msgstr "" "αντικείμενο περίπτωσης ως πρώτο της :term:`argument` (το οποίο συνήθως " "ονομάζεται ``self``). Βλ. :term:`function` και :term:`nested scope`." -#: glossary.rst:799 +#: glossary.rst:922 msgid "method resolution order" msgstr "σειρά ανάλυσης μεθόδων" -#: glossary.rst:801 +#: glossary.rst:924 msgid "" "Method Resolution Order is the order in which base classes are searched for " -"a member during lookup. See `The Python 2.3 Method Resolution Order `_ for details of the algorithm " -"used by the Python interpreter since the 2.3 release." +"a member during lookup. See :ref:`python_2.3_mro` for details of the " +"algorithm used by the Python interpreter since the 2.3 release." msgstr "" -"Η σειρά ανάλυσης μεθόδων είναι η σειρά με την οποία οι βασικές κλάσεις " -"αναζητούνται για ένα μέλος κατά την αναζήτησης. Βλ. `The Python 2.3 Method " -"Resolution Order `_ για " -"λεπτομέρειες του αλγορίθμου που χρησιμοποιείται από τον διερμηνέα της Python " -"από την έκδοση 2.3." +"Η Σειρά Ανάλυσης Μεθόδων είναι η σειρά με την οποία οι βασικές κλάσεις " +"αναζητούνται για ένα μέλος κατά την αναζήτησης. Βλ. :ref:`python_2.3_mro` " +"για λεπτομέρειες του αλγορίθμου που χρησιμοποιείται από τον διερμηνέα της " +"Python από την έκδοση 2.3." -#: glossary.rst:805 +#: glossary.rst:927 msgid "module" msgstr "module" -#: glossary.rst:807 +#: glossary.rst:929 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -1959,15 +2357,15 @@ msgstr "" "Python. Τα modules φορτώνονται στην Python με την διαδικασία :term:" "`importing`." -#: glossary.rst:811 +#: glossary.rst:933 msgid "See also :term:`package`." msgstr "Βλ. επίσης :term:`package`." -#: glossary.rst:812 +#: glossary.rst:934 msgid "module spec" msgstr "τεχνικές προδιαγραφές module" -#: glossary.rst:814 +#: glossary.rst:936 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -1976,19 +2374,23 @@ msgstr "" "που χρησιμοποιούνται για την φόρτωση ενός module. Μια περίπτωση του :class:" "`importlib.machinery.ModuleSpec`." -#: glossary.rst:816 +#: glossary.rst:939 +msgid "See also :ref:`module-specs`." +msgstr "Βλ. επίσης :ref:`module-specs`." + +#: glossary.rst:940 msgid "MRO" msgstr "MRO" -#: glossary.rst:818 +#: glossary.rst:942 msgid "See :term:`method resolution order`." msgstr "Βλ. :term:`method resolution order`." -#: glossary.rst:819 +#: glossary.rst:943 msgid "mutable" msgstr "mutable" -#: glossary.rst:821 +#: glossary.rst:945 msgid "" "Mutable objects can change their value but keep their :func:`id`. See also :" "term:`immutable`." @@ -1996,11 +2398,11 @@ msgstr "" "Τα ευμετάβλητα αντικείμενα μπορούν να αλλάξουν τις τιμές αλλά να κρατήσουν " "τα :func:`id`. Βλ. επίσης :term:`immutable`." -#: glossary.rst:823 +#: glossary.rst:947 msgid "named tuple" msgstr "named tuple" -#: glossary.rst:825 +#: glossary.rst:949 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2011,7 +2413,7 @@ msgstr "" "ευρετηριοποιηθούν είναι προσβάσιμα χρησιμοποιώντας επώνυμα χαρακτηριστικά. " "Ο τύπος ή η κλάση μπορεί να έχει και άλλα χαρακτηριστικά." -#: glossary.rst:829 +#: glossary.rst:953 msgid "" "Several built-in types are named tuples, including the values returned by :" "func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." @@ -2021,7 +2423,23 @@ msgstr "" "που επιστρέφονται από :func:`time.localtime` και :func:`os.stat`. Ένα άλλο " "παράδειγμα είναι το :data:`sys.float_info`::" -#: glossary.rst:840 +#: glossary.rst:957 +msgid "" +">>> sys.float_info[1] # indexed access\n" +"1024\n" +">>> sys.float_info.max_exp # named field access\n" +"1024\n" +">>> isinstance(sys.float_info, tuple) # kind of tuple\n" +"True" +msgstr "" +">>> sys.float_info[1] # indexed access\n" +"1024\n" +">>> sys.float_info.max_exp # named field access\n" +"1024\n" +">>> isinstance(sys.float_info, tuple) # kind of tuple\n" +"True" + +#: glossary.rst:964 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -2040,11 +2458,11 @@ msgstr "" "τελευταίες τεχνικές προσθέτουν επίσης μερικές επιπλέον μεθόδους που μπορεί " "να μην βρεθούν σε χειρόγραφες ή ενσωματωμένες πλειάδες με όνομα." -#: glossary.rst:848 +#: glossary.rst:972 msgid "namespace" msgstr "namespace" -#: glossary.rst:850 +#: glossary.rst:974 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -2066,31 +2484,47 @@ msgstr "" "seed` ή :func:`itertools.islice` καθιστά σαφές ότι αυτές οι συναρτήσεις " "υλοποιούνται από τα module :mod:`random` και :mod:`itertools`, αντίστοιχα." -#: glossary.rst:860 +#: glossary.rst:984 msgid "namespace package" msgstr "πακέτο namespace" -#: glossary.rst:862 +#: glossary.rst:986 msgid "" -"A :pep:`420` :term:`package` which serves only as a container for " -"subpackages. Namespace packages may have no physical representation, and " -"specifically are not like a :term:`regular package` because they have no " -"``__init__.py`` file." +"A :term:`package` which serves only as a container for subpackages. " +"Namespace packages may have no physical representation, and specifically are " +"not like a :term:`regular package` because they have no ``__init__.py`` file." msgstr "" -"Ένα :pep:`420` :term:`package` που χρησιμεύει μόνο ως κοντέινερ για " -"υποπακέτα. Τα πακέτα χώρου ονομάτων μπορεί να μην έχουν φυσική αναπαράσταση " -"και συγκεκριμένα να μην είναι σαν ένα :term:`regular package` επειδή δεν " -"έχουν το ``__init__.py`` αρχείο." +"Ένα :term:`package` που χρησιμεύει μόνο ως κοντέινερ για υποπακέτα. Τα " +"πακέτα χώρου ονομάτων μπορεί να μην έχουν φυσική αναπαράσταση και " +"συγκεκριμένα να μην είναι σαν ένα :term:`regular package` επειδή δεν έχουν " +"το ``__init__.py`` αρχείο." -#: glossary.rst:867 +#: glossary.rst:991 +msgid "" +"Namespace packages allow several individually installable packages to have a " +"common parent package. Otherwise, it is recommended to use a :term:`regular " +"package`." +msgstr "" +"Τα πακέτα χώρου ονομάτων επιτρέπουν σε πολλά πακέτα με δυνατότητα " +"εγκατάστασης μεμονωμένα να έχουν ένα κοινό γονικό πακέτο. Διαφορετικά, " +"συνίσταται η χρήση ενός :term:`regular package`." + +#: glossary.rst:994 +msgid "" +"For more information, see :pep:`420` and :ref:`reference-namespace-package`." +msgstr "" +"Για περισσότερες πληροφορίες, δείτε το :pep:`420` και το :ref:`reference-" +"namespace-package`." + +#: glossary.rst:996 msgid "See also :term:`module`." msgstr "Βλ. επίσης :term:`module`." -#: glossary.rst:868 +#: glossary.rst:997 msgid "nested scope" msgstr "nested scope" -#: glossary.rst:870 +#: glossary.rst:999 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2107,11 +2541,11 @@ msgstr "" "Ομοίως, οι καθολικές μεταβλητές διαβάζουν και γράφουν στον καθολικό χώρο " "ονομάτων. Το :keyword:`nonlocal` επιτρέπει την εγγραφή σε εξωτερικά πεδία." -#: glossary.rst:877 +#: glossary.rst:1006 msgid "new-style class" msgstr "κλάση νέου στυλ" -#: glossary.rst:879 +#: glossary.rst:1008 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -2124,11 +2558,11 @@ msgstr "" "όπως :attr:`~object.__slots__`, descriptors, ιδιότητες :meth:`~object." "__getattribute__`, μέθοδοι κλάσης, και στατικές μέθοδοι." -#: glossary.rst:884 +#: glossary.rst:1013 msgid "object" msgstr "αντικείμενο" -#: glossary.rst:886 +#: glossary.rst:1015 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2137,11 +2571,59 @@ msgstr "" "συμπεριφορά (μέθοδοι). Επίσης, η τελική βασική κλάση οποιασδήποτε :term:`new-" "style class`." -#: glossary.rst:889 +#: glossary.rst:1018 +msgid "optimized scope" +msgstr "βελτιστοποιημένο πεδίο ορατότητας (scope)" + +#: glossary.rst:1020 +msgid "" +"A scope where target local variable names are reliably known to the compiler " +"when the code is compiled, allowing optimization of read and write access to " +"these names. The local namespaces for functions, generators, coroutines, " +"comprehensions, and generator expressions are optimized in this fashion. " +"Note: most interpreter optimizations are applied to all scopes, only those " +"relying on a known set of local and nonlocal variable names are restricted " +"to optimized scopes." +msgstr "" +"Ένα πεδίο ορατότητας (scope) όπου τα ονόματα των τοπικών μεταβλητών είναι " +"γνωστό με βεβαιότητα στον μεταγλωττιστή κατά τη μεταγλώττιση του κώδικα, " +"επιτρέποντας τη βελτιστοποίηση της πρόσβασης για ανάγνωση και εγγραφή σε " +"αυτά τα ονόματα. Οι τοπικοί χώροι ονομάτων για συναρτήσεις, γεννήτριες, " +"συναρτήσεις coroutine, συμπτύξεις (comprehensions) και εκφράσεις γεννητριών " +"βελτιστοποιούνται με αυτόν τον τρόπο. Σημείωση: οι περισσότερες " +"βελτιστοποιήσεις του διερμηνέα εφαρμόζονται σε όλα τα πεδία ορατότητας· μόνο " +"εκείνες που βασίζονται σε γνωστό σύνολο τοπικών και μη τοπικών μεταβλητών " +"περιορίζονται σε βελτιστοποιημένα πεδία ορατότητας." + +#: glossary.rst:1027 +msgid "optional module" +msgstr "προαιρετικό module" + +#: glossary.rst:1029 +msgid "" +"An :term:`extension module` that is part of the :term:`standard library`, " +"but may be absent in some builds of :term:`CPython`, usually due to missing " +"third-party libraries or because the module is not available for a given " +"platform." +msgstr "" +"Ένα :term:`extension module` που αποτελεί μέρος της :term:`standard " +"library`, αλλά μπορεί να απουσιάζει σε ορισμένες εκδόσεις του :term:" +"`CPython`, συνήθως λόγω απουσίας βιβλιοθηκών τρίτων ή επειδή το module δεν " +"είναι διαθέσιμο για μια δεδομένη πλατφόρμα." + +#: glossary.rst:1034 +msgid "" +"See :ref:`optional-module-requirements` for a list of optional modules that " +"require third-party libraries." +msgstr "" +"Δείτε το :ref:`optional-module-requirements` για μια λίστα με προαιρετικά " +"modules που απαιτούν βιβλιοθήκες τρίτων." + +#: glossary.rst:1036 msgid "package" msgstr "πακέτο" -#: glossary.rst:891 +#: glossary.rst:1038 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2151,15 +2633,15 @@ msgstr "" "υποπακέτα. Τεχνικά, ένα πακέτο είναι μια λειτουργική μονάδα Python με ένα " "``__path__`` χαρακτηριστικό." -#: glossary.rst:895 +#: glossary.rst:1042 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "Βλ. επίσης :term:`regular package` και :term:`namespace package`." -#: glossary.rst:896 +#: glossary.rst:1043 msgid "parameter" msgstr "παράμετρος" -#: glossary.rst:898 +#: glossary.rst:1045 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2169,7 +2651,7 @@ msgstr "" "καθορίζει ένα :term:`argument` (ή σε ορισμένες περιπτώσεις, ορίσματα) που " "μπορεί να δεχθεί η συνάρτηση. Υπάρχουν πέντε είδη παραμέτρων:" -#: glossary.rst:902 +#: glossary.rst:1049 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2181,7 +2663,11 @@ msgstr "" "`. Αυτό είναι το προεπιλεγμένο είδος παραμέτρου, για παράδειγμα " "*foo* και *bar* στα ακόλουθα::" -#: glossary.rst:911 +#: glossary.rst:1054 +msgid "def func(foo, bar=None): ..." +msgstr "def func(foo, bar=None): ..." + +#: glossary.rst:1058 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2193,7 +2679,11 @@ msgstr "" "χαρακτήρα ``/`` στη λίστα παραμέτρων του ορισμού συνάρτησης μετά από αυτές, " "για παράδειγμα *posonly1* και *posonly2* στα εξής::" -#: glossary.rst:920 +#: glossary.rst:1063 +msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." +msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." + +#: glossary.rst:1067 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2207,7 +2697,11 @@ msgstr "" "του ορισμού συνάρτησης πριν από αυτές, για παράδειγμα *kw_only1* και " "*kw_only2* στα ακόλουθα::" -#: glossary.rst:928 +#: glossary.rst:1073 +msgid "def func(arg, *, kw_only1, kw_only2): ..." +msgstr "def func(arg, *, kw_only1, kw_only2): ..." + +#: glossary.rst:1075 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2221,7 +2715,11 @@ msgstr "" "προσαρτώντας το όνομα της παραμέτρου με ``*``, για παράδειγμα *args* στα " "ακόλουθα::" -#: glossary.rst:936 +#: glossary.rst:1081 +msgid "def func(*args, **kwargs): ..." +msgstr "def func(*args, **kwargs): ..." + +#: glossary.rst:1083 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2234,7 +2732,7 @@ msgstr "" "οριστεί προσαρτώντας το όνομα της παραμέτρου με ``**``, για παράδειγμα " "*kwargs* όπως παραπάνω." -#: glossary.rst:942 +#: glossary.rst:1089 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." @@ -2243,7 +2741,7 @@ msgstr "" "απαιτούμενα ορίσματα , καθώς και προεπιλεγμένες τιμές για ορισμένα " "προαιρετικά ορίσματα." -#: glossary.rst:945 +#: glossary.rst:1092 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -2255,11 +2753,11 @@ msgstr "" "parameter>`, την κλάση :class:`inspect.Parameter`, την ενότητα :ref:" "`function` και :pep:`362`." -#: glossary.rst:949 +#: glossary.rst:1096 msgid "path entry" msgstr "path entry" -#: glossary.rst:951 +#: glossary.rst:1098 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2267,11 +2765,11 @@ msgstr "" "Μια μεμονωμένη τοποθεσία στο :term:`import path` την οποία συμβουλεύεται ο :" "term:`path based finder` για να βρει modules για εισαγωγή." -#: glossary.rst:953 +#: glossary.rst:1100 msgid "path entry finder" msgstr "path entry finder" -#: glossary.rst:955 +#: glossary.rst:1102 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" "term:`path entry hook`) which knows how to locate modules given a :term:" @@ -2281,7 +2779,7 @@ msgstr "" "path_hooks` (δηλαδή ένα :term:`path entry hook`) που ξέρει πως να εντοπίζει " "modules με :term:`path entry`." -#: glossary.rst:959 +#: glossary.rst:1106 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2289,11 +2787,11 @@ msgstr "" "Βλ. :class:`importlib.abc.PathEntryFinder` για τις μεθόδους που ο entry " "finder διαδρομής υλοποιεί." -#: glossary.rst:961 +#: glossary.rst:1108 msgid "path entry hook" msgstr "path entry hook" -#: glossary.rst:963 +#: glossary.rst:1110 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2303,11 +2801,11 @@ msgstr "" "term:`path entry finder` εάν ξέρει πως να βρίσκει module σε μια " "συγκεκριμένη :term:`path entry`." -#: glossary.rst:966 +#: glossary.rst:1113 msgid "path based finder" msgstr "path based finder" -#: glossary.rst:968 +#: glossary.rst:1115 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2315,11 +2813,11 @@ msgstr "" "Ένα από τα προεπιλεγμένα :term:`meta path finders ` που " "αναζητά ένα :term:`import path` για modules." -#: glossary.rst:970 +#: glossary.rst:1117 msgid "path-like object" msgstr "path-like αντικείμενο" -#: glossary.rst:972 +#: glossary.rst:1119 msgid "" "An object representing a file system path. A path-like object is either a :" "class:`str` or :class:`bytes` object representing a path, or an object " @@ -2340,11 +2838,11 @@ msgstr "" "ενός αποτελέσματος :class:`str` ή :class:`bytes`, αντίστοιχα. Εισήχθη από " "τον :pep:`519`." -#: glossary.rst:980 +#: glossary.rst:1127 msgid "PEP" msgstr "PEP" -#: glossary.rst:982 +#: glossary.rst:1129 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2357,7 +2855,7 @@ msgstr "" "μια συνοπτική τεχνική προδιαγραφή και μια λογική για τα προτεινόμενα " "χαρακτηριστικά." -#: glossary.rst:988 +#: glossary.rst:1135 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2371,15 +2869,15 @@ msgstr "" "στην Python. Ο συγγραφέας του PEP είναι υπεύθυνος για την οικοδόμηση " "συναίνεσης εντός της κοινότητας και την τεκμηρίωση αντίθετων απόψεων." -#: glossary.rst:994 +#: glossary.rst:1141 msgid "See :pep:`1`." msgstr "Βλ. :pep:`1`." -#: glossary.rst:995 +#: glossary.rst:1142 msgid "portion" msgstr "τμήμα" -#: glossary.rst:997 +#: glossary.rst:1144 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2388,15 +2886,15 @@ msgstr "" "αρχείο *zip*) που συμβάλλουν σε ένα namespace πακέτο, όπως ορίζεται στο :pep:" "`420`." -#: glossary.rst:999 +#: glossary.rst:1146 msgid "positional argument" msgstr "όρισμα θέσης" -#: glossary.rst:1002 +#: glossary.rst:1149 msgid "provisional API" msgstr "provisional API" -#: glossary.rst:1004 +#: glossary.rst:1151 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2415,7 +2913,7 @@ msgstr "" "αποκαλυφθούν σοβαρά θεμελιώδη ελαττώματα που παραλείφθηκαν πριν από τη " "συμπερίληψη του API." -#: glossary.rst:1013 +#: glossary.rst:1160 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2425,7 +2923,7 @@ msgstr "" "\"λύση έσχατης ανάγκης\"- θα εξακολουθεί να γίνεται κάθε προσπάθεια για να " "βρεθεί μια λύση backwards συμβατή σε τυχόν εντοπισμένα προβλήματα." -#: glossary.rst:1017 +#: glossary.rst:1164 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2436,19 +2934,19 @@ msgstr "" "σφάλματα σχεδιασμού για εκτεταμένες χρονικές περιόδους. Βλ. :pep:`411` για " "περισσότερες λεπτομέρειες." -#: glossary.rst:1020 +#: glossary.rst:1167 msgid "provisional package" msgstr "provisional πακέτο" -#: glossary.rst:1022 +#: glossary.rst:1169 msgid "See :term:`provisional API`." msgstr "Βλ. :term:`provisional API`." -#: glossary.rst:1023 +#: glossary.rst:1170 msgid "Python 3000" msgstr "Python 3000" -#: glossary.rst:1025 +#: glossary.rst:1172 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2458,11 +2956,11 @@ msgstr "" "όταν η κυκλοφορία της έκδοσης 3 ήταν κάτι στο μακρινό μέλλον.) Αυτό " "ονομάζεται επίσης ως συντομογραφία \"Py3k\"." -#: glossary.rst:1028 +#: glossary.rst:1175 msgid "Pythonic" msgstr "Pythonic" -#: glossary.rst:1030 +#: glossary.rst:1177 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2479,15 +2977,31 @@ msgstr "" "κατασκευής, έτσι οι άνθρωποι που δεν είναι εξοικειωμένοι με την Python " "χρησιμοποιούν μερικές φορές έναν αριθμητικό μετρητή::" -#: glossary.rst:1040 +#: glossary.rst:1184 +msgid "" +"for i in range(len(food)):\n" +" print(food[i])" +msgstr "" +"for i in range(len(food)):\n" +" print(food[i])" + +#: glossary.rst:1187 msgid "As opposed to the cleaner, Pythonic method::" msgstr "Αντίθετα, μια πιο καθαρή μέθοδος Pythonic::" -#: glossary.rst:1044 +#: glossary.rst:1189 +msgid "" +"for piece in food:\n" +" print(piece)" +msgstr "" +"for piece in food:\n" +" print(piece)" + +#: glossary.rst:1191 msgid "qualified name" msgstr "αναγνωρισμένο όνομα" -#: glossary.rst:1046 +#: glossary.rst:1193 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2499,7 +3013,33 @@ msgstr "" "ενότητα, όπως ορίζεται στο :pep:`3155`. Για συναρτήσεις και κλάσεις ανώτατου " "επιπέδου, το αναγνωρισμένο όνομα είναι ίδιο με το όνομα του αντικειμένου::" -#: glossary.rst:1063 +#: glossary.rst:1198 +msgid "" +">>> class C:\n" +"... class D:\n" +"... def meth(self):\n" +"... pass\n" +"...\n" +">>> C.__qualname__\n" +"'C'\n" +">>> C.D.__qualname__\n" +"'C.D'\n" +">>> C.D.meth.__qualname__\n" +"'C.D.meth'" +msgstr "" +">>> class C:\n" +"... class D:\n" +"... def meth(self):\n" +"... pass\n" +"...\n" +">>> C.__qualname__\n" +"'C'\n" +">>> C.D.__qualname__\n" +"'C.D'\n" +">>> C.D.meth.__qualname__\n" +"'C.D.meth'" + +#: glossary.rst:1210 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. ``email.mime." @@ -2509,34 +3049,55 @@ msgstr "" "όνομα* σημαίνει ολόκληρο το διακεκομμένο path προς το module, " "συμπεριλαμβανομένων τυχόν γονικών πακέτων π.χ. ``email.mime.text``::" -#: glossary.rst:1070 +#: glossary.rst:1214 +msgid "" +">>> import email.mime.text\n" +">>> email.mime.text.__name__\n" +"'email.mime.text'" +msgstr "" +">>> import email.mime.text\n" +">>> email.mime.text.__name__\n" +"'email.mime.text'" + +#: glossary.rst:1217 msgid "reference count" msgstr "πλήθος αναφοράς" -#: glossary.rst:1072 +#: glossary.rst:1219 msgid "" "The number of references to an object. When the reference count of an " -"object drops to zero, it is deallocated. Some objects are \"immortal\" and " -"have reference counts that are never modified, and therefore the objects are " -"never deallocated. Reference counting is generally not visible to Python " -"code, but it is a key element of the :term:`CPython` implementation. " +"object drops to zero, it is deallocated. Some objects are :term:`immortal` " +"and have reference counts that are never modified, and therefore the objects " +"are never deallocated. Reference counting is generally not visible to " +"Python code, but it is a key element of the :term:`CPython` implementation. " "Programmers can call the :func:`sys.getrefcount` function to return the " "reference count for a particular object." msgstr "" "Ο αριθμός των αναφορών σε ένα αντικείμενο. Όταν το πλήθος αναφορών ενός " -"αντικειμένου πέσει στο μηδέν, κατανέμεται. Μερικά αντικείμενα είναι " -"\"αθάνατα\" και έχουν πλήθος αναφορών που δεν τροποποιούνται ποτέ και " +"αντικειμένου πέσει στο μηδέν, κατανέμεται. Μερικά αντικείμενα είναι :term:" +"`immortal` και έχουν πλήθος αναφορών που δεν τροποποιούνται ποτέ και " "επομένως τα αντικείμενα δεν κατανέμονται ποτέ. Η καταμέτρηση αναφορών γενικά " -"δεν είναι ορατή στον κώδικα της Python. αλλά είναι βασικοί στοιχείο της " +"δεν είναι ορατή στον κώδικα της Python, αλλά είναι βασικό στοιχείο της " "υλοποίησης :term:`CPython`. Οι προγραμματιστές μπορούν να καλέσουν τη " "συνάρτηση :func:`sys.getrefcount` για να επιστρέψουν το πλήθος αναφοράς για " "ένα συγκεκριμένο αντικείμενο." -#: glossary.rst:1080 +#: glossary.rst:1228 +msgid "" +"In :term:`CPython`, reference counts are not considered to be stable or well-" +"defined values; the number of references to an object, and how that number " +"is affected by Python code, may be different between versions." +msgstr "" +"Στο :term:`CPython`, τα πλήθη αναφοράς δεν θεωρούνται σταθερές ή καλά " +"ορισμένες τιμές· ο αριθμός των αναφορών σε ένα αντικείμενο και το πώς αυτός " +"ο αριθμός επηρεάζεται από τον κώδικα Python, μπορεί να διαφέρει μεταξύ " +"εκδόσεων." + +#: glossary.rst:1232 msgid "regular package" msgstr "κανονικό πακέτο" -#: glossary.rst:1082 +#: glossary.rst:1234 msgid "" "A traditional :term:`package`, such as a directory containing an ``__init__." "py`` file." @@ -2544,15 +3105,27 @@ msgstr "" "Ένα παραδοσιακό :term:`package`, όπως ένας κατάλογος που περιέχει ένα " "``__init__.py`` αρχείο." -#: glossary.rst:1085 +#: glossary.rst:1237 msgid "See also :term:`namespace package`." msgstr "Βλ. επίσης :term:`namespace package`." -#: glossary.rst:1086 +#: glossary.rst:1238 +msgid "REPL" +msgstr "REPL" + +#: glossary.rst:1240 +msgid "" +"An acronym for the \"read–eval–print loop\", another name for the :term:" +"`interactive` interpreter shell." +msgstr "" +"Ακρωνύμιο του \"read–eval–print loop\", άλλη ονομασία για το :term:" +"`interactive` περιβάλλον του διερμηνέα." + +#: glossary.rst:1242 msgid "__slots__" msgstr "__slots__" -#: glossary.rst:1088 +#: glossary.rst:1244 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2566,11 +3139,11 @@ msgstr "" "σωστή και προορίζεται καλύτερα για σπάνιες περιπτώσεις όπου υπάρχει μεγάλος " "αριθμός στιγμιοτύπων σε μια εφαρμογή κρίσιμης-μνήμης." -#: glossary.rst:1093 +#: glossary.rst:1249 msgid "sequence" msgstr "ακολουθία" -#: glossary.rst:1095 +#: glossary.rst:1251 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines a :" @@ -2578,8 +3151,8 @@ msgid "" "built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " "and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." "__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " -"sequence because the lookups use arbitrary :term:`immutable` keys rather " -"than integers." +"sequence because the lookups use arbitrary :term:`hashable` keys rather than " +"integers." msgstr "" "Ένας :term:`iterable` που υποστηρίζει την αποτελεσματική πρόσβαση στο " "στοιχείο χρησιμοποιώντας ακέραιους δείκτες μέσω της ειδική μεθόδου :meth:" @@ -2588,33 +3161,33 @@ msgstr "" "είναι :class:`list`, :class:`str`, :class:`tuple`, και :class:`bytes`. " "Σημειώστε ότι το :class:`dict` υποστηρίζει επίσης :meth:`~object." "__getitem__` και :meth:`!__len__`, αλλά θεωρείται αντιστοίχιση και όχι " -"ακολουθία επειδή οι αναζητήσεις χρησιμοποιούν αυθαίρετα :term:`immutable` " +"ακολουθία επειδή οι αναζητήσεις χρησιμοποιούν αυθαίρετα :term:`hashable` " "κλειδιά παρά ακέραιοι." -#: glossary.rst:1104 +#: glossary.rst:1260 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" -"`~object.__len__`, adding :meth:`!count`, :meth:`!index`, :meth:`~object." -"__contains__`, and :meth:`~object.__reversed__`. Types that implement this " -"expanded interface can be registered explicitly using :func:`~abc.ABCMeta." -"register`. For more documentation on sequence methods generally, see :ref:" -"`Common Sequence Operations `." +"`~object.__len__`, adding :meth:`~sequence.count`, :meth:`~sequence.index`, :" +"meth:`~object.__contains__`, and :meth:`~object.__reversed__`. Types that " +"implement this expanded interface can be registered explicitly using :func:" +"`~abc.ABCMeta.register`. For more documentation on sequence methods " +"generally, see :ref:`Common Sequence Operations `." msgstr "" "Η αφηρημένη βασική κλάση :class:`collections.abc.Sequence` ορίζει μια πολύ " -"πιο πλούσια διεπαφή που ξεπερνά τα απλά `~object.__getitem__` and :meth:" -"`~object.__len__`, adding :meth:`!count`, :meth:`!index`, :meth:`~object." -"__contains__`, και :meth:`~object.__reversed__`. Οι τύποι που υλοποιούν " -"αυτήν την διευρυμένη διεπαφή μπορούν να καταχωρηθούν ρητά χρησιμοποιώντας :" -"func:`~abc.ABCMeta.register`. Για περισσότερη τεκμηρίωση σχετικά με τις " -"μεθόδους ακολουθίας γενικά, ανατρέξτε στο :ref:`Common Sequence Operations " -"`." +"πιο πλούσια διεπαφή που ξεπερνά τα απλά :meth:`~object.__getitem__` και :" +"meth:`~object.__len__`, adding :meth:`~sequence.count`, :meth:`~sequence." +"index`, :meth:`~object.__contains__`, και :meth:`~object.__reversed__`. Οι " +"τύποι που υλοποιούν αυτήν την διευρυμένη διεπαφή μπορούν να καταχωρηθούν " +"ρητά χρησιμοποιώντας :func:`~abc.ABCMeta.register`. Για περισσότερη " +"τεκμηρίωση σχετικά με τις μεθόδους ακολουθίας γενικά, ανατρέξτε στο :ref:" +"`Common Sequence Operations `." -#: glossary.rst:1113 +#: glossary.rst:1270 msgid "set comprehension" msgstr "set comprehension" -#: glossary.rst:1115 +#: glossary.rst:1272 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -2626,11 +3199,11 @@ msgstr "" "c in 'abracadabra' if c not in 'abc'}`` δημιουργεί το σύνολο συμβολοσειρών " "``{'r', 'd'}``. Βλ. :ref:`comprehensions`." -#: glossary.rst:1119 +#: glossary.rst:1276 msgid "single dispatch" msgstr "μοναδικό dispatch" -#: glossary.rst:1121 +#: glossary.rst:1278 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2638,11 +3211,11 @@ msgstr "" "Μια μορφή dispatch :term:`generic function` όπου η υλοποίηση επιλέγεται με " "βάση τον τύπο ενός μεμονωμένου ορίσματος." -#: glossary.rst:1123 +#: glossary.rst:1280 msgid "slice" msgstr "slice" -#: glossary.rst:1125 +#: glossary.rst:1282 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2655,11 +3228,41 @@ msgstr "" "``variable_name[1:3:5]``. Η σημείωση αγκύλης (subscript) χρησιμοποιεί " "εσωτερικά αντικείμενα :class:`slice`." -#: glossary.rst:1129 +#: glossary.rst:1286 +msgid "soft deprecated" +msgstr "απαρχαιωμένη με ήπιο τρόπο" + +#: glossary.rst:1288 +msgid "" +"A soft deprecated API should not be used in new code, but it is safe for " +"already existing code to use it. The API remains documented and tested, but " +"will not be enhanced further." +msgstr "" +"Ένα απαρχαιωμένο με ήπιο τρόπο API δεν θα πρέπει να χρησιμοποιείται σε νέο " +"κώδικα, αλλά είναι ασφαλές σε ήδη υπάρχοντα κώδικα να το χρησιμοποιεί. Το " +"API παραμένει τεκμηριωμένο και δοκιμασμένο, αλλά δεν θα ενισχυθεί περαιτέρω." + +#: glossary.rst:1292 +msgid "" +"Soft deprecation, unlike normal deprecation, does not plan on removing the " +"API and will not emit warnings." +msgstr "" +"Η κατάργηση με ήπιο τρόπο, σε αντίθεση με την κανονική κατάργηση, δεν " +"σχεδιάζει την κατάργηση του API και δεν θα εκπέμπει ειδοποιήσεις" + +#: glossary.rst:1295 +msgid "" +"See `PEP 387: Soft Deprecation `_." +msgstr "" +"Δείτε `PEP 387: Soft Deprecation `_." + +#: glossary.rst:1297 msgid "special method" msgstr "ειδική μέθοδος" -#: glossary.rst:1133 +#: glossary.rst:1301 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -2671,11 +3274,37 @@ msgstr "" "έχουνε ονόματα που ξεκινούν και τελειώνουν με διπλές κάτω παύλες. Οι ειδικές " "μέθοδοι τεκμηριώνονται στο :ref:`specialnames`." -#: glossary.rst:1137 +#: glossary.rst:1305 +msgid "standard library" +msgstr "τυπική βιβλιοθήκη" + +#: glossary.rst:1307 +msgid "" +"The collection of :term:`packages `, :term:`modules ` and :" +"term:`extension modules ` distributed as a part of the " +"official Python interpreter package. The exact membership of the collection " +"may vary based on platform, available system libraries, or other criteria. " +"Documentation can be found at :ref:`library-index`." +msgstr "" +"Η συλλογή από :term:`packages `, :term:`modules ` και :term:" +"`extension modules ` που διανέμεται ως μέρος του επίσημου " +"πακέτου διερμηνέα Python. Η ακριβής συμμετοχή της συλλογής μπορεί να " +"διαφέρει ανάλογα με την πλατφόρμα, τις διαθέσιμες βιβλιοθήκες συστήματος ή " +"άλλα κριτήρια. Η τεκμηρίωση μπορεί να βρεθεί στο :ref:`library-index`." + +#: glossary.rst:1313 +msgid "" +"See also :data:`sys.stdlib_module_names` for a list of all possible standard " +"library module names." +msgstr "" +"Βλ. επίσης :data:`sys.stdlib_module_names` για μια λίστα με όλα τα πιθανά " +"ονόματα module της τυπικής βιβλιοθήκης." + +#: glossary.rst:1315 msgid "statement" msgstr "δήλωση" -#: glossary.rst:1139 +#: glossary.rst:1317 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such as :" @@ -2685,11 +3314,11 @@ msgstr "" "είναι είτε ένας :term:`expression` είτε μια από πολλές δομές με μια λέξη-" "κλειδί όπως :keyword:`if`, :keyword:`while` ή :keyword:`for`." -#: glossary.rst:1142 +#: glossary.rst:1320 msgid "static type checker" msgstr "ελεγκτής στατικού τύπου" -#: glossary.rst:1144 +#: glossary.rst:1322 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints ` and the :" @@ -2699,11 +3328,19 @@ msgstr "" "αναζητώντας προβλήματα όπως λανθασμένοι τύποι. Βλ. επίσης :term:`type hints " "` και το module :mod:`typing`." -#: glossary.rst:1147 +#: glossary.rst:1325 +msgid "stdlib" +msgstr "stdlib" + +#: glossary.rst:1327 +msgid "An abbreviation of :term:`standard library`." +msgstr "Μια συντομογραφία του :term:`standard library`." + +#: glossary.rst:1328 msgid "strong reference" msgstr "strong reference" -#: glossary.rst:1149 +#: glossary.rst:1330 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " @@ -2716,7 +3353,7 @@ msgstr "" "δημιουργείται και απελευθερώνεται με :c:func:`Py_DECREF` όταν διαγραφεί η " "αναφορά." -#: glossary.rst:1155 +#: glossary.rst:1336 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2728,15 +3365,32 @@ msgstr "" "`Py_DECREF` πρέπει να καλείται στην ισχυρή αναφορά πριν βγει από το εύρος " "της ισχυρής αναφοράς, για να αποφευχθεί η διαρροή μιας αναφοράς." -#: glossary.rst:1160 +#: glossary.rst:1341 msgid "See also :term:`borrowed reference`." msgstr "Βλ. επίσης :term:`borrowed reference`." -#: glossary.rst:1161 +#: glossary.rst:1342 +msgid "t-string" +msgstr "t-string" + +#: glossary.rst:1343 +msgid "t-strings" +msgstr "t-strings" + +#: glossary.rst:1345 +msgid "" +"String literals prefixed with ``t`` or ``T`` are commonly called \"t-" +"strings\" which is short for :ref:`template string literals `." +msgstr "" +"Οι κυριολεκτικές συμβολοσειρές που χρησιμοποιούνται με πρόθεμα ``t`` or " +"``T`` ονομάζονται συνήθως \"t-strings\" που είναι συντομογραφία του :ref:" +"`template string literals `." + +#: glossary.rst:1348 msgid "text encoding" msgstr "κωδικοποίηση κειμένου" -#: glossary.rst:1163 +#: glossary.rst:1350 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2746,7 +3400,7 @@ msgstr "" "εύρος ``U+0000``--``U+10FFFF``). Για να αποθηκεύσετε ή να μεταφέρετε μια " "συμβολοσειρά, πρέπει να σειριοποιηθεί ως δυαδική ακολουθία." -#: glossary.rst:1167 +#: glossary.rst:1354 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2755,7 +3409,7 @@ msgstr "" "\"κωδικοποίηση\" , και η αναδημιουργία της συμβολοσειράς από την δυαδική " "ακολουθία είναι γνωστή ως \"αποκωδικοποίηση\"." -#: glossary.rst:1170 +#: glossary.rst:1357 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2764,11 +3418,11 @@ msgstr "" "`, οι οποίοι συλλογικά αναφέρονται ως \"κωδικοποιήσεις " "κειμένου\"." -#: glossary.rst:1173 +#: glossary.rst:1360 msgid "text file" msgstr "αρχείο κειμένου" -#: glossary.rst:1175 +#: glossary.rst:1362 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -2783,7 +3437,7 @@ msgstr "" "κειμένου (``'r'`` ή ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, και " "στιγμιότυπα του :class:`io.StringIO`." -#: glossary.rst:1182 +#: glossary.rst:1369 msgid "" "See also :term:`binary file` for a file object able to read and write :term:" "`bytes-like objects `." @@ -2791,11 +3445,95 @@ msgstr "" "Βλ. επίσης :term:`binary file` για ένα αντικείμενο αρχείου με δυνατότητα " "ανάγνωσης και εγγραφής :term:`δυαδικά αντικείμενα `." -#: glossary.rst:1184 +#: glossary.rst:1371 +msgid "thread state" +msgstr "κατάσταση νήματος" + +#: glossary.rst:1374 +msgid "" +"The information used by the :term:`CPython` runtime to run in an OS thread. " +"For example, this includes the current exception, if any, and the state of " +"the bytecode interpreter." +msgstr "" +"Οι πληροφορίες που χρησιμοποιούνται από τη ροή εκτέλεσης της :term:`CPython` " +"για την εκτέλεση σε ένα νήμα λειτουργικού συστήματος. Για παράδειγμα, αυτό " +"περιλαμβάνει την τρέχουσα εξαίρεση, εάν υπάρχει, και την κατάσταση του " +"διερμηνέα bytecode." + +#: glossary.rst:1378 +msgid "" +"Each thread state is bound to a single OS thread, but threads may have many " +"thread states available. At most, one of them may be :term:`attached " +"` at once." +msgstr "" +"Κάθε κατάσταση νήματος είναι συνδεδεμένη με ένα μόνο νήμα λειτουργικού " +"συστήματος, αλλά τα νήματα μπορεί να έχουν πολλές διαθέσιμες καταστάσεις " +"νήματος. Το πολύ, μία από αυτές μπορεί να είναι :term:`attached ` ταυτόχρονα." + +#: glossary.rst:1382 +msgid "" +"An :term:`attached thread state` is required to call most of Python's C API, " +"unless a function explicitly documents otherwise. The bytecode interpreter " +"only runs under an attached thread state." +msgstr "" +"Απαιτείται ένα :term:`attached thread state` για την κλήση του μεγαλύτερου " +"μέρους του C API της Python, εκτός εάν μια συνάρτηση τεκμηριώνεται ρητά από " +"το αντίθετο. Ο διερμηνέας bytecode εκτελείται μόνο υπό κατάσταση συνημμένου " +"νήματος." + +#: glossary.rst:1386 +msgid "" +"Each thread state belongs to a single interpreter, but each interpreter may " +"have many thread states, including multiple for the same OS thread. Thread " +"states from multiple interpreters may be bound to the same thread, but only " +"one can be :term:`attached ` in that thread at any " +"given moment." +msgstr "" +"Κάθε κατάσταση νήματος ανήκει σε έναν μόνο διερμηνέα, αλλά κάθε διερμηνέα " +"μπορεί να έχει πολλές καταστάσεις νήματος, συμπεριλαμβανομένων πολλαπλών για " +"το ίδιο νήμα λειτουργικού συστήματος. Οι καταστάσεις νήματος από πολλαπλούς " +"διερμηνείς μπορεί να είναι συνδεδεμένος με το ίδιο νήμα, αλλά μόνο μία " +"μπορεί να είναι :term:`attached ` σε αυτό το νήμα σε " +"οποιαδήποτε δεδομένη στιγμή." + +#: glossary.rst:1392 +msgid "" +"See :ref:`Thread State and the Global Interpreter Lock ` for more " +"information." +msgstr "" +"Δείτε το :ref:`Thread State and the Global Interpreter Lock ` για " +"περισσότερες πληροφορίες." + +#: glossary.rst:1394 +msgid "token" +msgstr "λεκτικό σύμβολο (token)" + +#: glossary.rst:1397 +msgid "" +"A small unit of source code, generated by the :ref:`lexical analyzer " +"` (also called the *tokenizer*). Names, numbers, strings, " +"operators, newlines and similar are represented by tokens." +msgstr "" +"Μια μικρή μονάδα πηγαίου κώδικα, που παράγεται από τον :ref:`lexical " +"analyzer ` (γνωστό και ως *αναλυτή (tokenizer)*). Ονόματα, αριθμοί, " +"συμβολοσειρές, τελεστές αλλαγές γραμμής και παρόμοια στοιχεία αναπαρίστανται " +"ως λεκτικά σύμβολα (tokens)." + +#: glossary.rst:1402 +msgid "" +"The :mod:`tokenize` module exposes Python's lexical analyzer. The :mod:" +"`token` module contains information on the various types of tokens." +msgstr "" +"Το module :mod:`tokenize` εκθέτει τον λεξικό αναλυτή της Python. Το module :" +"mod:`token` περιέχει πληροφορίες για τους διάφορους τύπους λεκτικών συμβόλων " +"(tokens)." + +#: glossary.rst:1405 msgid "triple-quoted string" msgstr "συμβολοσειρά τριπλών εισαγωγικών" -#: glossary.rst:1186 +#: glossary.rst:1407 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2813,32 +3551,32 @@ msgstr "" "γραμμές χωρίς τη χρήση του χαρακτήρα συνέχεια, καθιστώντας τα ιδιαίτερα " "χρήσιμα κατά τη σύνταξη εγγράφων με συμβολοσειρές." -#: glossary.rst:1193 +#: glossary.rst:1414 msgid "type" msgstr "τύπος" -#: glossary.rst:1195 +#: glossary.rst:1416 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as its :attr:`~instance." +"object has a type. An object's type is accessible as its :attr:`~object." "__class__` attribute or can be retrieved with ``type(obj)``." msgstr "" -"Ο τύπος ενός Python αντικειμένου καθορίζει τι είδους αντικείμενο είναι' κάθε " +"Ο τύπος ενός Python αντικειμένου καθορίζει τι είδους αντικείμενο είναι∙ κάθε " "αντικείμενο έχει έναν τύπο. Ο τύπος ενός αντικειμένου είναι προσβάσιμος ως " -"το χαρακτηριστικό :attr:`~instance.__class__` ή μπορεί να ανακτηθεί με " +"το χαρακτηριστικό :attr:`~object.__class__` ή μπορεί να ανακτηθεί με " "``type(obj)``." -#: glossary.rst:1199 +#: glossary.rst:1420 msgid "type alias" msgstr "type alias" -#: glossary.rst:1201 +#: glossary.rst:1422 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "" "Ένα συνώνυμο για έναν τύπο, που δημιουργείται με την ανάθεση τύπου σε ένα " "αναγνωριστικό." -#: glossary.rst:1203 +#: glossary.rst:1424 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" @@ -2846,20 +3584,42 @@ msgstr "" "Τα type aliases είναι χρήσιμα για την απλοποίηση :term:`type alias `. Για παράδειγμα::" -#: glossary.rst:1210 +#: glossary.rst:1427 +msgid "" +"def remove_gray_shades(\n" +" colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" +" pass" +msgstr "" +"def remove_gray_shades(\n" +" colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" +" pass" + +#: glossary.rst:1431 msgid "could be made more readable like this::" msgstr "μπορεί να γίνει πιο ευανάγνωστο όπως::" -#: glossary.rst:1231 +#: glossary.rst:1433 +msgid "" +"Color = tuple[int, int, int]\n" +"\n" +"def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" +" pass" +msgstr "" +"Color = tuple[int, int, int]\n" +"\n" +"def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" +" pass" + +#: glossary.rst:1452 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "" "Βλ. :mod:`typing` και :pep:`484`, που περιγράφει αυτήν την λειτουργικότητα." -#: glossary.rst:1218 +#: glossary.rst:1439 msgid "type hint" msgstr "type hint" -#: glossary.rst:1220 +#: glossary.rst:1441 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -2868,7 +3628,7 @@ msgstr "" "μεταβλητή, ένα χαρακτηριστικό κλάσης ή μια παράμετρο συνάρτησης ή τιμή " "επιστροφής." -#: glossary.rst:1223 +#: glossary.rst:1444 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -2879,7 +3639,7 @@ msgstr "" "checker>`. Μπορούν επίσης να βοηθήσουν τους IDEs με τη συμπλήρωση και την " "αναδιαμόρφωση κώδικα." -#: glossary.rst:1227 +#: glossary.rst:1448 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -2888,11 +3648,11 @@ msgstr "" "κλάσης και συναρτήσεις , αλλά όχι τοπικές μεταβλητές, μπορούν να " "προσπελαστούν χρησιμοποιώντας το :func:`typing.get_type_hints`." -#: glossary.rst:1232 +#: glossary.rst:1453 msgid "universal newlines" msgstr "καθολικές νέες γραμμές" -#: glossary.rst:1234 +#: glossary.rst:1455 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -2906,22 +3666,30 @@ msgstr "" "Βλ. :pep:`278` και :pep:`3116`, καθώς και :func:`bytes.splitlines` για " "πρόσθετη χρήση." -#: glossary.rst:1239 +#: glossary.rst:1460 msgid "variable annotation" msgstr "annotation μεταβλητής" -#: glossary.rst:1241 +#: glossary.rst:1462 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "Ένας :term:`annotation` μια μεταβλητής ή ενός χαρακτηριστικού κλάσης." -#: glossary.rst:1243 +#: glossary.rst:1464 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "" "Όταν annotating μια μεταβλητή ή ένα χαρακτηριστικό κλάσης, η ανάθεση είναι " "προαιρετική::" -#: glossary.rst:1248 +#: glossary.rst:1466 +msgid "" +"class C:\n" +" field: 'annotation'" +msgstr "" +"class C:\n" +" field: 'annotation'" + +#: glossary.rst:1469 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -2930,12 +3698,16 @@ msgstr "" "`: για παράδειγμα αυτή η μεταβλητή αναμένεται να λάβει τιμές :" "class:`int`::" -#: glossary.rst:1254 +#: glossary.rst:1473 +msgid "count: int = 0" +msgstr "count: int = 0" + +#: glossary.rst:1475 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "" "Η σύνταξη annotation μεταβλητής περιγράφεται στην ενότητα :ref:`annassign`." -#: glossary.rst:1256 +#: glossary.rst:1477 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -2945,11 +3717,11 @@ msgstr "" "αυτή τη λειτουργία. Δείτε επίσης :ref:`annotations-howto` για βέλτιστες " "πρακτικές σχετικά με την εργασία με σχολιασμούς." -#: glossary.rst:1260 +#: glossary.rst:1481 msgid "virtual environment" msgstr "virtual environment" -#: glossary.rst:1262 +#: glossary.rst:1483 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -2961,15 +3733,15 @@ msgstr "" "πακέτα διανομής Python χωρίς να παρεμβαίνουν στη συμπεριφορά άλλων εφαρμογών " "Python που εκτελούνται στο ίδιο σύστημα." -#: glossary.rst:1267 +#: glossary.rst:1488 msgid "See also :mod:`venv`." msgstr "Βλ. επίσης :mod:`venv`." -#: glossary.rst: +#: glossary.rst:1489 msgid "virtual machine" msgstr "virtual machine" -#: glossary.rst:1270 +#: glossary.rst:1491 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -2978,11 +3750,25 @@ msgstr "" "της Python εκτελεί το :term:`bytecode` που εκπέμπεται από τον μεταγλωττιστή " "bytecode." -#: glossary.rst:1272 +#: glossary.rst:1493 +msgid "walrus operator" +msgstr "τελεστής walrus" + +#: glossary.rst:1495 +msgid "" +"A light-hearted way to refer to the :ref:`assignment expression ` operator ``:=`` because it looks a bit like a walrus if you " +"turn your head." +msgstr "" +"Μια ελαφρώς χιουμοριστική αναφορά στον :ref:`τελεστή εκχώρησης ` ``:=`` επειδή μοιάζει λίγο με έναν θαλάσσιο ίππο αν γυρίσετε " +"το κεφάλι σας." + +#: glossary.rst:1498 msgid "Zen of Python" msgstr "Zen της Python" -#: glossary.rst:1274 +#: glossary.rst:1500 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -2992,18 +3778,89 @@ msgstr "" "κατανόηση και τη χρήση της γλώσσας. Ο κατάλογος μπορεί να βρεθεί " "πληκτρολογώντας \"``import this``\" στην διαδραστική κονσόλα." -#: glossary.rst:264 +#: glossary.rst:24 +msgid "..." +msgstr "..." + +#: glossary.rst:24 +msgid "ellipsis literal" +msgstr "ellipsis literal" + +#: glossary.rst:321 msgid "C-contiguous" msgstr "C-contiguous" -#: glossary.rst:264 +#: glossary.rst:321 msgid "Fortran contiguous" msgstr "Fortran contiguous" -#: glossary.rst:761 +#: glossary.rst:884 msgid "magic" msgstr "magic" -#: glossary.rst:1131 +#: glossary.rst:1299 msgid "special" msgstr "special" + +#~ msgid "The :const:`Ellipsis` built-in constant." +#~ msgstr "Η ενσωματωμένη σταθερά :const:`Ellipsis`." + +#~ msgid "2to3" +#~ msgstr "2to3" + +#~ msgid "" +#~ "A tool that tries to convert Python 2.x code to Python 3.x code by " +#~ "handling most of the incompatibilities which can be detected by parsing " +#~ "the source and traversing the parse tree." +#~ msgstr "" +#~ "Ένα εργαλείο που προσπαθεί να μετατρέψει τον κώδικα Python 2.x σε κώδικα " +#~ "Python 3.x διαχειρίζοντας τις περισσότερες ασυμβατότητες που μπορούν να " +#~ "εντοπιστούν αναλύοντας την πηγή και διασχίζοντας το δέντρο ανάλυσης." + +#~ msgid "" +#~ "2to3 is available in the standard library as :mod:`lib2to3`; a standalone " +#~ "entry point is provided as :file:`Tools/scripts/2to3`. See :ref:`2to3-" +#~ "reference`." +#~ msgstr "" +#~ "2to3 είναι διαθέσιμο στην στάνταρ βιβλιοθήκη ως :mod:`lib2to3`, παρέχεται " +#~ "ένα σημείο εισόδου ως :file:`Tools/scripts/2to3`. Βλ. :ref:`2to3-" +#~ "reference`." + +#~ msgid "" +#~ "An object which controls the environment seen in a :keyword:`with` " +#~ "statement by defining :meth:`~object.__enter__` and :meth:`~object." +#~ "__exit__` methods. See :pep:`343`." +#~ msgstr "" +#~ "Ένα αντικείμενο που ελέγχει το περιβάλλον που εμφανίζεται σε μια δήλωση :" +#~ "keyword:`with` ορίζοντας τις μεθόδους :meth:`~object.__enter__` και :meth:" +#~ "`~object.__exit__`. Βλ. :pep:`343`." + +#~ msgid "" +#~ "A variable which can have different values depending on its context. This " +#~ "is similar to Thread-Local Storage in which each execution thread may " +#~ "have a different value for a variable. However, with context variables, " +#~ "there may be several contexts in one execution thread and the main usage " +#~ "for context variables is to keep track of variables in concurrent " +#~ "asynchronous tasks. See :mod:`contextvars`." +#~ msgstr "" +#~ "Μια μεταβλητή που μπορεί να έχει πολλές διαφορετικές τιμές ανάλογα με το " +#~ "context. Αυτό είναι κοινό στο Thread-Local Storage όπου κάθε εκτέλεση του " +#~ "νήματος μπορεί να έχει διαφορετική τιμή για μια μεταβλητή. Παρόλα αυτά, " +#~ "με τις context μεταβλητές, μπορεί να υπάρχουν πολλά περιβάλλοντα σε ένα " +#~ "νήμα εκτέλεσης και η κύρια χρήση για τις context μεταβλητές είναι η " +#~ "παρακολούθηση των μεταβλητών σε ταυτόχρονες διεργασίες. Βλ. :mod:" +#~ "`contextvars`." + +#~ msgid "" +#~ "Past efforts to create a \"free-threaded\" interpreter (one which locks " +#~ "shared data at a much finer granularity) have not been successful because " +#~ "performance suffered in the common single-processor case. It is believed " +#~ "that overcoming this performance issue would make the implementation much " +#~ "more complicated and therefore costlier to maintain." +#~ msgstr "" +#~ "Προηγούμενες προσπάθειες να δημιουργηθεί ένας διερμηνέας \"ελεύθερων-" +#~ "νημάτων\" (αυτός που κλειδώνει τα κοινόχρηστα δεδομένα με πολύ πιο " +#~ "λεπτομερή ευαισθησία) δεν ήταν επιτυχείς επειδή η απόδοση υποχώρησε στην " +#~ "κοινή περίπτωση ενός επεξεργαστή. Πιστεύεται ότι η υπέρβαση αυτού του " +#~ "προβλήματος απόδοσης θα κάνουν πολύ πιο περίπλοκη και επομένως πιο " +#~ "δαπανηρή στην συντήρηση." diff --git a/howto/a-conceptual-overview-of-asyncio.po b/howto/a-conceptual-overview-of-asyncio.po new file mode 100644 index 00000000..df8772f4 --- /dev/null +++ b/howto/a-conceptual-overview-of-asyncio.po @@ -0,0 +1,813 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: howto/a-conceptual-overview-of-asyncio.rst:5 +msgid "A Conceptual Overview of :mod:`!asyncio`" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:7 +msgid "" +"This :ref:`HOWTO ` article seeks to help you build a sturdy mental " +"model of how :mod:`asyncio` fundamentally works, helping you understand the " +"how and why behind the recommended patterns." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:11 +msgid "" +"You might be curious about some key :mod:`!asyncio` concepts. By the end of " +"this article, you'll be able to comfortably answer these questions:" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:14 +msgid "What's happening behind the scenes when an object is awaited?" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:15 +msgid "" +"How does :mod:`!asyncio` differentiate between a task which doesn't need CPU " +"time (such as a network request or file read) as opposed to a task that does " +"(such as computing n-factorial)?" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:18 +msgid "" +"How to write an asynchronous variant of an operation, such as an async sleep " +"or database request." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:23 +msgid "" +"The `guide `_ that inspired this HOWTO article, by Alexander Nordin." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:25 +msgid "" +"This in-depth `YouTube tutorial series `_ on ``asyncio`` " +"created by Python core team member, Łukasz Langa." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:28 +msgid "" +"`500 Lines or Less: A Web Crawler With asyncio Coroutines `_ by A. Jesse Jiryu " +"Davis and Guido van Rossum." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:34 +msgid "A conceptual overview part 1: the high-level" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:36 +msgid "" +"In part 1, we'll cover the main, high-level building blocks of :mod:`!" +"asyncio`: the event loop, coroutine functions, coroutine objects, tasks, and " +"``await``." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:41 +msgid "Event Loop" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:43 +msgid "" +"Everything in :mod:`!asyncio` happens relative to the event loop. It's the " +"star of the show. It's like an orchestra conductor. It's behind the scenes " +"managing resources. Some power is explicitly granted to it, but a lot of its " +"ability to get things done comes from the respect and cooperation of its " +"worker bees." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:50 +msgid "" +"In more technical terms, the event loop contains a collection of jobs to be " +"run. Some jobs are added directly by you, and some indirectly by :mod:`!" +"asyncio`. The event loop takes a job from its backlog of work and invokes it " +"(or \"gives it control\"), similar to calling a function, and then that job " +"runs. Once it pauses or completes, it returns control to the event loop. The " +"event loop will then select another job from its pool and invoke it. You can " +"*roughly* think of the collection of jobs as a queue: jobs are added and " +"then processed one at a time, generally (but not always) in order. This " +"process repeats indefinitely, with the event loop cycling endlessly onwards. " +"If there are no more jobs pending execution, the event loop is smart enough " +"to rest and avoid needlessly wasting CPU cycles, and will come back when " +"there's more work to be done." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:64 +msgid "" +"Effective execution relies on jobs sharing well and cooperating; a greedy " +"job could hog control and leave the other jobs to starve, rendering the " +"overall event loop approach rather useless." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:70 +msgid "" +"import asyncio\n" +"\n" +"# This creates an event loop and indefinitely cycles through\n" +"# its collection of jobs.\n" +"event_loop = asyncio.new_event_loop()\n" +"event_loop.run_forever()" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:79 +msgid "Asynchronous functions and coroutines" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:81 +msgid "This is a basic, boring Python function::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:83 +msgid "" +"def hello_printer():\n" +" print(\n" +" \"Hi, I am a lowly, simple printer, though I have all I \"\n" +" \"need in life -- \\nfresh paper and my dearly beloved octopus \"\n" +" \"partner in crime.\"\n" +" )" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:90 +msgid "Calling a regular function invokes its logic or body::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:92 +msgid "" +">>> hello_printer()\n" +"Hi, I am a lowly, simple printer, though I have all I need in life --\n" +"fresh paper and my dearly beloved octopus partner in crime." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:96 +msgid "" +"The :ref:`async def `, as opposed to just a plain ``def``, makes " +"this an asynchronous function (or \"coroutine function\"). Calling it " +"creates and returns a :ref:`coroutine ` object." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:102 +msgid "" +"async def loudmouth_penguin(magic_number: int):\n" +" print(\n" +" \"I am a super special talking penguin. Far cooler than that printer. " +"\"\n" +" f\"By the way, my lucky number is: {magic_number}.\"\n" +" )" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:108 +msgid "" +"Calling the async function, ``loudmouth_penguin``, does not execute the " +"print statement; instead, it creates a coroutine object::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:111 +msgid "" +">>> loudmouth_penguin(magic_number=3)\n" +"" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:114 +msgid "" +"The terms \"coroutine function\" and \"coroutine object\" are often " +"conflated as coroutine. That can be confusing! In this article, coroutine " +"specifically refers to a coroutine object, or more precisely, an instance " +"of :data:`types.CoroutineType` (native coroutine). Note that coroutines can " +"also exist as instances of :class:`collections.abc.Coroutine` -- a " +"distinction that matters for type checking." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:123 +msgid "" +"A coroutine represents the function's body or logic. A coroutine has to be " +"explicitly started; again, merely creating the coroutine does not start it. " +"Notably, the coroutine can be paused and resumed at various points within " +"the function's body. That pausing and resuming ability is what allows for " +"asynchronous behavior!" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:130 +msgid "" +"Coroutines and coroutine functions were built by leveraging the " +"functionality of :term:`generators ` and :term:" +"`generator functions `. Recall, a generator function is a " +"function that :keyword:`yield`\\s, like this one::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:136 +msgid "" +"def get_random_number():\n" +" # This would be a bad random number generator!\n" +" print(\"Hi\")\n" +" yield 1\n" +" print(\"Hello\")\n" +" yield 7\n" +" print(\"Howdy\")\n" +" yield 4\n" +" ..." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:146 +msgid "" +"Similar to a coroutine function, calling a generator function does not run " +"it. Instead, it creates a generator object::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:149 +msgid "" +">>> get_random_number()\n" +"" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:152 +msgid "" +"You can proceed to the next ``yield`` of a generator by using the built-in " +"function :func:`next`. In other words, the generator runs, then pauses. For " +"example::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:157 +msgid "" +">>> generator = get_random_number()\n" +">>> next(generator)\n" +"Hi\n" +"1\n" +">>> next(generator)\n" +"Hello\n" +"7" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:167 +msgid "Tasks" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:169 +msgid "" +"Roughly speaking, :ref:`tasks ` are coroutines (not " +"coroutine functions) tied to an event loop. A task also maintains a list of " +"callback functions whose importance will become clear in a moment when we " +"discuss :keyword:`await`. The recommended way to create tasks is via :func:" +"`asyncio.create_task`." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:175 +msgid "" +"Creating a task automatically schedules it for execution (by adding a " +"callback to run it in the event loop's to-do list, that is, collection of " +"jobs)." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:178 +msgid "" +":mod:`!asyncio` automatically associates tasks with the event loop for you. " +"This automatic association was purposely designed into :mod:`!asyncio` for " +"the sake of simplicity. Without it, you'd have to keep track of the event " +"loop object and pass it to any coroutine function that wants to create " +"tasks, adding redundant clutter to your code." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:187 +msgid "" +"coroutine = loudmouth_penguin(magic_number=5)\n" +"# This creates a Task object and schedules its execution via the event " +"loop.\n" +"task = asyncio.create_task(coroutine)" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:191 +msgid "" +"Earlier, we manually created the event loop and set it to run forever. In " +"practice, it's recommended to use (and common to see) :func:`asyncio.run`, " +"which takes care of managing the event loop and ensuring the provided " +"coroutine finishes before advancing. For example, many async programs follow " +"this setup::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:197 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" # Perform all sorts of wacky, wild asynchronous things...\n" +" ...\n" +"\n" +"if __name__ == \"__main__\":\n" +" asyncio.run(main())\n" +" # The program will not reach the following print statement until the\n" +" # coroutine main() finishes.\n" +" print(\"coroutine main() is done!\")" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:209 +msgid "" +"It's important to be aware that the task itself is not added to the event " +"loop, only a callback to the task is. This matters if the task object you " +"created is garbage collected before it's called by the event loop. For " +"example, consider this program:" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:215 +msgid "" +"async def hello():\n" +" print(\"hello!\")\n" +"\n" +"async def main():\n" +" asyncio.create_task(hello())\n" +" # Other asynchronous instructions which run for a while\n" +" # and cede control to the event loop...\n" +" ...\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:229 +msgid "" +"Because there's no reference to the task object created on line 5, it " +"*might* be garbage collected before the event loop invokes it. Later " +"instructions in the coroutine ``main()`` hand control back to the event loop " +"so it can invoke other jobs. When the event loop eventually tries to run the " +"task, it might fail and discover the task object does not exist! This can " +"also happen even if a coroutine keeps a reference to a task but completes " +"before that task finishes. When the coroutine exits, local variables go out " +"of scope and may be subject to garbage collection. In practice, ``asyncio`` " +"and Python's garbage collector work pretty hard to ensure this sort of thing " +"doesn't happen. But that's no reason to be reckless!" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:245 +msgid "await" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:247 +msgid "" +":keyword:`await` is a Python keyword that's commonly used in one of two " +"different ways::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:250 +msgid "" +"await task\n" +"await coroutine" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:253 +msgid "" +"In a crucial way, the behavior of ``await`` depends on the type of object " +"being awaited." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:256 +msgid "" +"Awaiting a task will cede control from the current task or coroutine to the " +"event loop. In the process of relinquishing control, a few important things " +"happen. We'll use the following code example to illustrate::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:261 +msgid "" +"async def plant_a_tree():\n" +" dig_the_hole_task = asyncio.create_task(dig_the_hole())\n" +" await dig_the_hole_task\n" +"\n" +" # Other instructions associated with planting a tree.\n" +" ..." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:268 +msgid "" +"In this example, imagine the event loop has passed control to the start of " +"the coroutine ``plant_a_tree()``. As seen above, the coroutine creates a " +"task and then awaits it. The ``await dig_the_hole_task`` instruction adds a " +"callback (which will resume ``plant_a_tree()``) to the ``dig_the_hole_task`` " +"object's list of callbacks. And then, the instruction cedes control to the " +"event loop. Some time later, the event loop will pass control to " +"``dig_the_hole_task`` and the task will finish whatever it needs to do. Once " +"the task finishes, it will add its various callbacks to the event loop, in " +"this case, a call to resume ``plant_a_tree()``." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:279 +msgid "" +"Generally speaking, when the awaited task finishes (``dig_the_hole_task``), " +"the original task or coroutine (``plant_a_tree()``) is added back to the " +"event loop's to-do list to be resumed." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:283 +msgid "" +"This is a basic, yet reliable mental model. In practice, the control " +"handoffs are slightly more complex, but not by much. In part 2, we'll walk " +"through the details that make this possible." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:287 +msgid "" +"**Unlike tasks, awaiting a coroutine does not hand control back to the event " +"loop!** Wrapping a coroutine in a task first, then awaiting that would cede " +"control. The behavior of ``await coroutine`` is effectively the same as " +"invoking a regular, synchronous Python function. Consider this program::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:295 +msgid "" +"import asyncio\n" +"\n" +"async def coro_a():\n" +" print(\"I am coro_a(). Hi!\")\n" +"\n" +"async def coro_b():\n" +" print(\"I am coro_b(). I sure hope no one hogs the event loop...\")\n" +"\n" +"async def main():\n" +" task_b = asyncio.create_task(coro_b())\n" +" num_repeats = 3\n" +" for _ in range(num_repeats):\n" +" await coro_a()\n" +" await task_b\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:312 +msgid "" +"The first statement in the coroutine ``main()`` creates ``task_b`` and " +"schedules it for execution via the event loop. Then, ``coro_a()`` is " +"repeatedly awaited. Control never cedes to the event loop, which is why we " +"see the output of all three ``coro_a()`` invocations before ``coro_b()``'s " +"output:" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:318 +msgid "" +"I am coro_a(). Hi!\n" +"I am coro_a(). Hi!\n" +"I am coro_a(). Hi!\n" +"I am coro_b(). I sure hope no one hogs the event loop..." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:325 +msgid "" +"If we change ``await coro_a()`` to ``await asyncio.create_task(coro_a())``, " +"the behavior changes. The coroutine ``main()`` cedes control to the event " +"loop with that statement. The event loop then proceeds through its backlog " +"of work, calling ``task_b`` and then the task which wraps ``coro_a()`` " +"before resuming the coroutine ``main()``." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:332 +msgid "" +"I am coro_b(). I sure hope no one hogs the event loop...\n" +"I am coro_a(). Hi!\n" +"I am coro_a(). Hi!\n" +"I am coro_a(). Hi!" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:339 +msgid "" +"This behavior of ``await coroutine`` can trip a lot of people up! That " +"example highlights how using only ``await coroutine`` could unintentionally " +"hog control from other tasks and effectively stall the event loop. :func:" +"`asyncio.run` can help you detect such occurrences via the ``debug=True`` " +"flag, which enables :ref:`debug mode `. Among other " +"things, it will log any coroutines that monopolize execution for 100ms or " +"longer." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:349 +msgid "" +"The design intentionally trades off some conceptual clarity around usage of " +"``await`` for improved performance. Each time a task is awaited, control " +"needs to be passed all the way up the call stack to the event loop. That " +"might sound minor, but in a large program with many ``await`` statements and " +"a deep call stack, that overhead can add up to a meaningful performance drag." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:358 +msgid "A conceptual overview part 2: the nuts and bolts" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:360 +msgid "" +"Part 2 goes into detail on the mechanisms :mod:`!asyncio` uses to manage " +"control flow. This is where the magic happens. You'll come away from this " +"section knowing what ``await`` does behind the scenes and how to make your " +"own asynchronous operators." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:368 +msgid "The inner workings of coroutines" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:370 +msgid ":mod:`!asyncio` leverages four components to pass around control." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:372 +msgid "" +":meth:`coroutine.send(arg) ` is the method used to start or " +"resume a coroutine. If the coroutine was paused and is now being resumed, " +"the argument ``arg`` will be sent in as the return value of the ``yield`` " +"statement which originally paused it. If the coroutine is being used for the " +"first time (as opposed to being resumed), ``arg`` must be ``None``." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:380 +msgid "" +"class Rock:\n" +" def __await__(self):\n" +" value_sent_in = yield 7\n" +" print(f\"Rock.__await__ resuming with value: {value_sent_in}.\")\n" +" return value_sent_in\n" +"\n" +"async def main():\n" +" print(\"Beginning coroutine main().\")\n" +" rock = Rock()\n" +" print(\"Awaiting rock...\")\n" +" value_from_rock = await rock\n" +" print(f\"Coroutine received value: {value_from_rock} from rock.\")\n" +" return 23\n" +"\n" +"coroutine = main()\n" +"intermediate_result = coroutine.send(None)\n" +"print(f\"Coroutine paused and returned intermediate value: " +"{intermediate_result}.\")\n" +"\n" +"print(f\"Resuming coroutine and sending in value: 42.\")\n" +"try:\n" +" coroutine.send(42)\n" +"except StopIteration as e:\n" +" returned_value = e.value\n" +"print(f\"Coroutine main() finished and provided value: {returned_value}.\")" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:408 +msgid "" +":ref:`yield `, as usual, pauses execution and returns control to " +"the caller. In the example above, the ``yield``, on line 3, is called by " +"``... = await rock`` on line 11. More broadly speaking, ``await`` calls the :" +"meth:`~object.__await__` method of the given object. ``await`` also does one " +"more very special thing: it propagates (or \"passes along\") any ``yield``\\ " +"s it receives up the call chain. In this case, that's back to ``... = " +"coroutine.send(None)`` on line 16." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:418 +msgid "" +"The coroutine is resumed via the ``coroutine.send(42)`` call on line 21. The " +"coroutine picks back up from where it ``yield``\\ ed (or paused) on line 3 " +"and executes the remaining statements in its body. When a coroutine " +"finishes, it raises a :exc:`StopIteration` exception with the return value " +"attached in the :attr:`~StopIteration.value` attribute." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:424 +msgid "That snippet produces this output:" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:426 +msgid "" +"Beginning coroutine main().\n" +"Awaiting rock...\n" +"Coroutine paused and returned intermediate value: 7.\n" +"Resuming coroutine and sending in value: 42.\n" +"Rock.__await__ resuming with value: 42.\n" +"Coroutine received value: 42 from rock.\n" +"Coroutine main() finished and provided value: 23." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:436 +msgid "" +"It's worth pausing for a moment here and making sure you followed the " +"various ways that control flow and values were passed. A lot of important " +"ideas were covered and it's worth ensuring your understanding is firm." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:440 +msgid "" +"The only way to yield (or effectively cede control) from a coroutine is to " +"``await`` an object that ``yield``\\ s in its ``__await__`` method. That " +"might sound odd to you. You might be thinking:" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:444 +msgid "" +"1. What about a ``yield`` directly within the coroutine function? The " +"coroutine function becomes an :ref:`async generator function `, a different beast entirely." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:449 +msgid "" +"2. What about a :ref:`yield from ` within the coroutine function " +"to a (plain) generator? That causes the error: ``SyntaxError: yield from not " +"allowed in a coroutine.`` This was intentionally designed for the sake of " +"simplicity -- mandating only one way of using coroutines. Initially " +"``yield`` was barred as well, but was re-accepted to allow for async " +"generators. Despite that, ``yield from`` and ``await`` effectively do the " +"same thing." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:460 +msgid "Futures" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:462 +msgid "" +"A :ref:`future ` is an object meant to represent a " +"computation's status and result. The term is a nod to the idea of something " +"still to come or not yet happened, and the object is a way to keep an eye on " +"that something." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:467 +msgid "" +"A future has a few important attributes. One is its state, which can be " +"either \"pending\", \"cancelled\", or \"done\". Another is its result, which " +"is set when the state transitions to done. Unlike a coroutine, a future does " +"not represent the actual computation to be done; instead, it represents the " +"status and result of that computation, kind of like a status light (red, " +"yellow, or green) or indicator." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:474 +msgid "" +":class:`asyncio.Task` subclasses :class:`asyncio.Future` in order to gain " +"these various capabilities. The prior section said tasks store a list of " +"callbacks, which wasn't entirely accurate. It's actually the ``Future`` " +"class that implements this logic, which ``Task`` inherits." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:481 +msgid "" +"Futures may also be used directly (not via tasks). Tasks mark themselves as " +"done when their coroutine is complete. Futures are much more versatile and " +"will be marked as done when you say so. In this way, they're the flexible " +"interface for you to make your own conditions for waiting and resuming." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:489 +msgid "A homemade asyncio.sleep" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:491 +msgid "" +"We'll go through an example of how you could leverage a future to create " +"your own variant of asynchronous sleep (``async_sleep``) which mimics :func:" +"`asyncio.sleep`." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:495 +msgid "" +"This snippet registers a few tasks with the event loop and then awaits the " +"task created by ``asyncio.create_task``, which wraps the ``async_sleep(3)`` " +"coroutine. We want that task to finish only after three seconds have " +"elapsed, but without preventing other tasks from running." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:502 +msgid "" +"async def other_work():\n" +" print(\"I like work. Work work.\")\n" +"\n" +"async def main():\n" +" # Add a few other tasks to the event loop, so there's something\n" +" # to do while asynchronously sleeping.\n" +" work_tasks = [\n" +" asyncio.create_task(other_work()),\n" +" asyncio.create_task(other_work()),\n" +" asyncio.create_task(other_work())\n" +" ]\n" +" print(\n" +" \"Beginning asynchronous sleep at time: \"\n" +" f\"{datetime.datetime.now().strftime(\"%H:%M:%S\")}.\"\n" +" )\n" +" await asyncio.create_task(async_sleep(3))\n" +" print(\n" +" \"Done asynchronous sleep at time: \"\n" +" f\"{datetime.datetime.now().strftime(\"%H:%M:%S\")}.\"\n" +" )\n" +" # asyncio.gather effectively awaits each task in the collection.\n" +" await asyncio.gather(*work_tasks)" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:526 +msgid "" +"Below, we use a future to enable custom control over when that task will be " +"marked as done. If :meth:`future.set_result() ` " +"(the method responsible for marking that future as done) is never called, " +"then this task will never finish. We've also enlisted the help of another " +"task, which we'll see in a moment, that will monitor how much time has " +"elapsed and, accordingly, call ``future.set_result()``." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:537 +msgid "" +"async def async_sleep(seconds: float):\n" +" future = asyncio.Future()\n" +" time_to_wake = time.time() + seconds\n" +" # Add the watcher-task to the event loop.\n" +" watcher_task = asyncio.create_task(_sleep_watcher(future, " +"time_to_wake))\n" +" # Block until the future is marked as done.\n" +" await future" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:545 +msgid "" +"Below, we use a rather bare ``YieldToEventLoop()`` object to ``yield`` from " +"its ``__await__`` method, ceding control to the event loop. This is " +"effectively the same as calling ``asyncio.sleep(0)``, but this approach " +"offers more clarity, not to mention it's somewhat cheating to use ``asyncio." +"sleep`` when showcasing how to implement it!" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:551 +msgid "" +"As usual, the event loop cycles through its tasks, giving them control and " +"receiving control back when they pause or finish. The ``watcher_task``, " +"which runs the coroutine ``_sleep_watcher(...)``, will be invoked once per " +"full cycle of the event loop. On each resumption, it'll check the time and " +"if not enough has elapsed, then it'll pause once again and hand control back " +"to the event loop. Once enough time has elapsed, ``_sleep_watcher(...)`` " +"marks the future as done and completes by exiting its infinite ``while`` " +"loop. Given this helper task is only invoked once per cycle of the event " +"loop, you'd be correct to note that this asynchronous sleep will sleep *at " +"least* three seconds, rather than exactly three seconds. Note this is also " +"true of ``asyncio.sleep``." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:567 +msgid "" +"class YieldToEventLoop:\n" +" def __await__(self):\n" +" yield\n" +"\n" +"async def _sleep_watcher(future, time_to_wake):\n" +" while True:\n" +" if time.time() >= time_to_wake:\n" +" # This marks the future as done.\n" +" future.set_result(None)\n" +" break\n" +" else:\n" +" await YieldToEventLoop()" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:580 +msgid "Here is the full program's output:" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:582 +msgid "" +"$ python custom-async-sleep.py\n" +"Beginning asynchronous sleep at time: 14:52:22.\n" +"I like work. Work work.\n" +"I like work. Work work.\n" +"I like work. Work work.\n" +"Done asynchronous sleep at time: 14:52:25." +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:591 +msgid "" +"You might feel this implementation of asynchronous sleep was unnecessarily " +"convoluted. And, well, it was. The example was meant to showcase the " +"versatility of futures with a simple example that could be mimicked for more " +"complex needs. For reference, you could implement it without futures, like " +"so::" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:598 +msgid "" +"async def simpler_async_sleep(seconds):\n" +" time_to_wake = time.time() + seconds\n" +" while True:\n" +" if time.time() >= time_to_wake:\n" +" return\n" +" else:\n" +" await YieldToEventLoop()" +msgstr "" + +#: howto/a-conceptual-overview-of-asyncio.rst:606 +msgid "" +"But that's all for now. Hopefully you're ready to more confidently dive into " +"some async programming or check out advanced topics in the :mod:`rest of the " +"documentation `." +msgstr "" diff --git a/howto/annotations.po b/howto/annotations.po index f0a481d1..ce1bf2cb 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -64,14 +65,22 @@ msgstr "" #: howto/annotations.rst:35 msgid "" "Python 3.10 adds a new function to the standard library: :func:`inspect." -"get_annotations`. In Python versions 3.10 and newer, calling this function " -"is the best practice for accessing the annotations dict of any object that " -"supports annotations. This function can also \"un-stringize\" stringized " -"annotations for you." +"get_annotations`. In Python versions 3.10 through 3.13, calling this " +"function is the best practice for accessing the annotations dict of any " +"object that supports annotations. This function can also \"un-stringize\" " +"stringized annotations for you." msgstr "" #: howto/annotations.rst:42 msgid "" +"In Python 3.14, there is a new :mod:`annotationlib` module with " +"functionality for working with annotations. This includes a :func:" +"`annotationlib.get_annotations` function, which supersedes :func:`inspect." +"get_annotations`." +msgstr "" + +#: howto/annotations.rst:47 +msgid "" "If for some reason :func:`inspect.get_annotations` isn't viable for your use " "case, you may access the ``__annotations__`` data member manually. Best " "practice for this changed in Python 3.10 as well: as of Python 3.10, ``o." @@ -81,7 +90,7 @@ msgid "" "to get at the object's annotations dict." msgstr "" -#: howto/annotations.rst:52 +#: howto/annotations.rst:57 msgid "" "However, other types of callables--for example, callables created by :func:" "`functools.partial`--may not have an ``__annotations__`` attribute defined. " @@ -90,7 +99,7 @@ msgid "" "three arguments, for example ``getattr(o, '__annotations__', None)``." msgstr "" -#: howto/annotations.rst:60 +#: howto/annotations.rst:65 msgid "" "Before Python 3.10, accessing ``__annotations__`` on a class that defines no " "annotations but that has a parent class with annotations would return the " @@ -98,18 +107,18 @@ msgid "" "annotations will be an empty dict instead." msgstr "" -#: howto/annotations.rst:68 +#: howto/annotations.rst:73 msgid "Accessing The Annotations Dict Of An Object In Python 3.9 And Older" msgstr "" -#: howto/annotations.rst:70 +#: howto/annotations.rst:75 msgid "" "In Python 3.9 and older, accessing the annotations dict of an object is much " "more complicated than in newer versions. The problem is a design flaw in " "these older versions of Python, specifically to do with class annotations." msgstr "" -#: howto/annotations.rst:75 +#: howto/annotations.rst:80 msgid "" "Best practice for accessing the annotations dict of other objects--" "functions, other callables, and modules--is the same as best practice for " @@ -118,7 +127,7 @@ msgid "" "``__annotations__`` attribute." msgstr "" -#: howto/annotations.rst:82 +#: howto/annotations.rst:87 msgid "" "Unfortunately, this isn't best practice for classes. The problem is that, " "since ``__annotations__`` is optional on classes, and because classes can " @@ -127,21 +136,33 @@ msgid "" "annotations dict of a *base class.* As an example::" msgstr "" -#: howto/annotations.rst:98 +#: howto/annotations.rst:94 +msgid "" +"class Base:\n" +" a: int = 3\n" +" b: str = 'abc'\n" +"\n" +"class Derived(Base):\n" +" pass\n" +"\n" +"print(Derived.__annotations__)" +msgstr "" + +#: howto/annotations.rst:103 msgid "This will print the annotations dict from ``Base``, not ``Derived``." msgstr "" -#: howto/annotations.rst:101 +#: howto/annotations.rst:106 msgid "" "Your code will have to have a separate code path if the object you're " "examining is a class (``isinstance(o, type)``). In that case, best practice " "relies on an implementation detail of Python 3.9 and before: if a class has " -"annotations defined, they are stored in the class's ``__dict__`` " +"annotations defined, they are stored in the class's :attr:`~type.__dict__` " "dictionary. Since the class may or may not have annotations defined, best " -"practice is to call the ``get`` method on the class dict." +"practice is to call the :meth:`~dict.get` method on the class dict." msgstr "" -#: howto/annotations.rst:109 +#: howto/annotations.rst:114 msgid "" "To put it all together, here is some sample code that safely accesses the " "``__annotations__`` attribute on an arbitrary object in Python 3.9 and " @@ -150,23 +171,31 @@ msgstr "" #: howto/annotations.rst:118 msgid "" +"if isinstance(o, type):\n" +" ann = o.__dict__.get('__annotations__', None)\n" +"else:\n" +" ann = getattr(o, '__annotations__', None)" +msgstr "" + +#: howto/annotations.rst:123 +msgid "" "After running this code, ``ann`` should be either a dictionary or ``None``. " "You're encouraged to double-check the type of ``ann`` using :func:" "`isinstance` before further examination." msgstr "" -#: howto/annotations.rst:123 +#: howto/annotations.rst:128 msgid "" -"Note that some exotic or malformed type objects may not have a ``__dict__`` " -"attribute, so for extra safety you may also wish to use :func:`getattr` to " -"access ``__dict__``." +"Note that some exotic or malformed type objects may not have a :attr:`~type." +"__dict__` attribute, so for extra safety you may also wish to use :func:" +"`getattr` to access :attr:`!__dict__`." msgstr "" -#: howto/annotations.rst:129 +#: howto/annotations.rst:134 msgid "Manually Un-Stringizing Stringized Annotations" msgstr "" -#: howto/annotations.rst:131 +#: howto/annotations.rst:136 msgid "" "In situations where some annotations may be \"stringized\", and you wish to " "evaluate those strings to produce the Python values they represent, it " @@ -174,7 +203,7 @@ msgid "" "you." msgstr "" -#: howto/annotations.rst:137 +#: howto/annotations.rst:142 msgid "" "If you're using Python 3.9 or older, or if for some reason you can't use :" "func:`inspect.get_annotations`, you'll need to duplicate its logic. You're " @@ -182,26 +211,26 @@ msgid "" "in the current Python version and follow a similar approach." msgstr "" -#: howto/annotations.rst:143 +#: howto/annotations.rst:148 msgid "" "In a nutshell, if you wish to evaluate a stringized annotation on an " "arbitrary object ``o``:" msgstr "" -#: howto/annotations.rst:146 +#: howto/annotations.rst:151 msgid "" "If ``o`` is a module, use ``o.__dict__`` as the ``globals`` when calling :" "func:`eval`." msgstr "" -#: howto/annotations.rst:148 +#: howto/annotations.rst:153 msgid "" "If ``o`` is a class, use ``sys.modules[o.__module__].__dict__`` as the " "``globals``, and ``dict(vars(o))`` as the ``locals``, when calling :func:" "`eval`." msgstr "" -#: howto/annotations.rst:151 +#: howto/annotations.rst:156 msgid "" "If ``o`` is a wrapped callable using :func:`functools.update_wrapper`, :func:" "`functools.wraps`, or :func:`functools.partial`, iteratively unwrap it by " @@ -209,13 +238,13 @@ msgid "" "have found the root unwrapped function." msgstr "" -#: howto/annotations.rst:155 +#: howto/annotations.rst:160 msgid "" "If ``o`` is a callable (but not a class), use :attr:`o.__globals__ ` as the globals when calling :func:`eval`." msgstr "" -#: howto/annotations.rst:159 +#: howto/annotations.rst:164 msgid "" "However, not all string values used as annotations can be successfully " "turned into Python values by :func:`eval`. String values could theoretically " @@ -224,19 +253,19 @@ msgid "" "be evaluated. For example:" msgstr "" -#: howto/annotations.rst:166 +#: howto/annotations.rst:171 msgid "" ":pep:`604` union types using ``|``, before support for this was added to " "Python 3.10." msgstr "" -#: howto/annotations.rst:168 +#: howto/annotations.rst:173 msgid "" "Definitions that aren't needed at runtime, only imported when :const:`typing." "TYPE_CHECKING` is true." msgstr "" -#: howto/annotations.rst:171 +#: howto/annotations.rst:176 msgid "" "If :func:`eval` attempts to evaluate such values, it will fail and raise an " "exception. So, when designing a library API that works with annotations, " @@ -244,43 +273,50 @@ msgid "" "requested to by the caller." msgstr "" -#: howto/annotations.rst:179 +#: howto/annotations.rst:184 msgid "Best Practices For ``__annotations__`` In Any Python Version" msgstr "" -#: howto/annotations.rst:181 +#: howto/annotations.rst:186 msgid "" "You should avoid assigning to the ``__annotations__`` member of objects " "directly. Let Python manage setting ``__annotations__``." msgstr "" -#: howto/annotations.rst:184 +#: howto/annotations.rst:189 msgid "" "If you do assign directly to the ``__annotations__`` member of an object, " "you should always set it to a ``dict`` object." msgstr "" -#: howto/annotations.rst:187 +#: howto/annotations.rst:192 msgid "" -"If you directly access the ``__annotations__`` member of an object, you " +"You should avoid accessing ``__annotations__`` directly on any object. " +"Instead, use :func:`annotationlib.get_annotations` (Python 3.14+) or :func:" +"`inspect.get_annotations` (Python 3.10+)." +msgstr "" + +#: howto/annotations.rst:196 +msgid "" +"If you do directly access the ``__annotations__`` member of an object, you " "should ensure that it's a dictionary before attempting to examine its " "contents." msgstr "" -#: howto/annotations.rst:191 +#: howto/annotations.rst:200 msgid "You should avoid modifying ``__annotations__`` dicts." msgstr "" -#: howto/annotations.rst:193 +#: howto/annotations.rst:202 msgid "" "You should avoid deleting the ``__annotations__`` attribute of an object." msgstr "" -#: howto/annotations.rst:198 +#: howto/annotations.rst:207 msgid "``__annotations__`` Quirks" msgstr "" -#: howto/annotations.rst:200 +#: howto/annotations.rst:209 msgid "" "In all versions of Python 3, function objects lazy-create an annotations " "dict if no annotations are defined on that object. You can delete the " @@ -292,13 +328,13 @@ msgid "" "guaranteed to always throw an ``AttributeError``." msgstr "" -#: howto/annotations.rst:210 +#: howto/annotations.rst:219 msgid "" "Everything in the above paragraph also applies to class and module objects " "in Python 3.10 and newer." msgstr "" -#: howto/annotations.rst:213 +#: howto/annotations.rst:222 msgid "" "In all versions of Python 3, you can set ``__annotations__`` on a function " "object to ``None``. However, subsequently accessing the annotations on that " @@ -309,7 +345,7 @@ msgid "" "set." msgstr "" -#: howto/annotations.rst:221 +#: howto/annotations.rst:230 msgid "" "If Python stringizes your annotations for you (using ``from __future__ " "import annotations``), and you specify a string as an annotation, the string " @@ -317,8 +353,36 @@ msgid "" "example::" msgstr "" -#: howto/annotations.rst:232 +#: howto/annotations.rst:236 +msgid "" +"from __future__ import annotations\n" +"def foo(a: \"str\"): pass\n" +"\n" +"print(foo.__annotations__)" +msgstr "" + +#: howto/annotations.rst:241 msgid "" "This prints ``{'a': \"'str'\"}``. This shouldn't really be considered a " "\"quirk\"; it's mentioned here simply because it might be surprising." msgstr "" + +#: howto/annotations.rst:244 +msgid "" +"If you use a class with a custom metaclass and access ``__annotations__`` on " +"the class, you may observe unexpected behavior; see :pep:`749 <749#pep749-" +"metaclasses>` for some examples. You can avoid these quirks by using :func:" +"`annotationlib.get_annotations` on Python 3.14+ or :func:`inspect." +"get_annotations` on Python 3.10+. On earlier versions of Python, you can " +"avoid these bugs by accessing the annotations from the class's :attr:`~type." +"__dict__` (for example, ``cls.__dict__.get('__annotations__', None)``)." +msgstr "" + +#: howto/annotations.rst:253 +msgid "" +"In some versions of Python, instances of classes may have an " +"``__annotations__`` attribute. However, this is not supported functionality. " +"If you need the annotations of an instance, you can use :func:`type` to " +"access its class (for example, ``annotationlib." +"get_annotations(type(myinstance))`` on Python 3.14+)." +msgstr "" diff --git a/howto/argparse-optparse.po b/howto/argparse-optparse.po new file mode 100644 index 00000000..49453378 --- /dev/null +++ b/howto/argparse-optparse.po @@ -0,0 +1,135 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: howto/argparse-optparse.rst:8 +msgid "Migrating ``optparse`` code to ``argparse``" +msgstr "" + +#: howto/argparse-optparse.rst:10 +msgid "" +"The :mod:`argparse` module offers several higher level features not natively " +"provided by the :mod:`optparse` module, including:" +msgstr "" + +#: howto/argparse-optparse.rst:13 +msgid "Handling positional arguments." +msgstr "" + +#: howto/argparse-optparse.rst:14 +msgid "Supporting subcommands." +msgstr "" + +#: howto/argparse-optparse.rst:15 +msgid "Allowing alternative option prefixes like ``+`` and ``/``." +msgstr "" + +#: howto/argparse-optparse.rst:16 +msgid "Handling zero-or-more and one-or-more style arguments." +msgstr "" + +#: howto/argparse-optparse.rst:17 +msgid "Producing more informative usage messages." +msgstr "" + +#: howto/argparse-optparse.rst:18 +msgid "Providing a much simpler interface for custom ``type`` and ``action``." +msgstr "" + +#: howto/argparse-optparse.rst:20 +msgid "" +"Originally, the :mod:`argparse` module attempted to maintain compatibility " +"with :mod:`optparse`. However, the fundamental design differences between " +"supporting declarative command line option processing (while leaving " +"positional argument processing to application code), and supporting both " +"named options and positional arguments in the declarative interface mean " +"that the API has diverged from that of ``optparse`` over time." +msgstr "" + +#: howto/argparse-optparse.rst:27 +msgid "" +"As described in :ref:`choosing-an-argument-parser`, applications that are " +"currently using :mod:`optparse` and are happy with the way it works can just " +"continue to use ``optparse``." +msgstr "" + +#: howto/argparse-optparse.rst:31 +msgid "" +"Application developers that are considering migrating should also review the " +"list of intrinsic behavioural differences described in that section before " +"deciding whether or not migration is desirable." +msgstr "" + +#: howto/argparse-optparse.rst:35 +msgid "" +"For applications that do choose to migrate from :mod:`optparse` to :mod:" +"`argparse`, the following suggestions should be helpful:" +msgstr "" + +#: howto/argparse-optparse.rst:38 +msgid "" +"Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" +"`ArgumentParser.add_argument` calls." +msgstr "" + +#: howto/argparse-optparse.rst:41 +msgid "" +"Replace ``(options, args) = parser.parse_args()`` with ``args = parser." +"parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " +"for the positional arguments. Keep in mind that what was previously called " +"``options``, now in the :mod:`argparse` context is called ``args``." +msgstr "" + +#: howto/argparse-optparse.rst:46 +msgid "" +"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" +"meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" +"`~ArgumentParser.parse_args`." +msgstr "" + +#: howto/argparse-optparse.rst:50 +msgid "" +"Replace callback actions and the ``callback_*`` keyword arguments with " +"``type`` or ``action`` arguments." +msgstr "" + +#: howto/argparse-optparse.rst:53 +msgid "" +"Replace string names for ``type`` keyword arguments with the corresponding " +"type objects (e.g. int, float, complex, etc)." +msgstr "" + +#: howto/argparse-optparse.rst:56 +msgid "" +"Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." +"OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." +msgstr "" + +#: howto/argparse-optparse.rst:60 +msgid "" +"Replace strings with implicit arguments such as ``%default`` or ``%prog`` " +"with the standard Python syntax to use dictionaries to format strings, that " +"is, ``%(default)s`` and ``%(prog)s``." +msgstr "" + +#: howto/argparse-optparse.rst:64 +msgid "" +"Replace the OptionParser constructor ``version`` argument with a call to " +"``parser.add_argument('--version', action='version', version='')``." +msgstr "" diff --git a/howto/argparse.po b/howto/argparse.po index 96f13dfb..dd15f843 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -36,33 +37,59 @@ msgstr "" #: howto/argparse.rst:16 msgid "" -"There are two other modules that fulfill the same task, namely :mod:`getopt` " -"(an equivalent for ``getopt()`` from the C language) and the deprecated :mod:" -"`optparse`. Note also that :mod:`argparse` is based on :mod:`optparse`, and " -"therefore very similar in terms of usage." -msgstr "" - -#: howto/argparse.rst:24 +"The standard library includes two other libraries directly related to " +"command-line parameter processing: the lower level :mod:`optparse` module " +"(which may require more code to configure for a given application, but also " +"allows an application to request behaviors that ``argparse`` doesn't " +"support), and the very low level :mod:`getopt` (which specifically serves as " +"an equivalent to the :c:func:`!getopt` family of functions available to C " +"programmers). While neither of those modules is covered directly in this " +"guide, many of the core concepts in ``argparse`` first originated in " +"``optparse``, so some aspects of this tutorial will also be relevant to " +"``optparse`` users." +msgstr "" + +#: howto/argparse.rst:29 msgid "Concepts" msgstr "" -#: howto/argparse.rst:26 +#: howto/argparse.rst:31 msgid "" "Let's show the sort of functionality that we are going to explore in this " "introductory tutorial by making use of the :command:`ls` command:" msgstr "" -#: howto/argparse.rst:48 +#: howto/argparse.rst:34 +msgid "" +"$ ls\n" +"cpython devguide prog.py pypy rm-unused-function.patch\n" +"$ ls pypy\n" +"ctypes_configure demo dotviewer include lib_pypy lib-python ...\n" +"$ ls -l\n" +"total 20\n" +"drwxr-xr-x 19 wena wena 4096 Feb 18 18:51 cpython\n" +"drwxr-xr-x 4 wena wena 4096 Feb 8 12:04 devguide\n" +"-rwxr-xr-x 1 wena wena 535 Feb 19 00:05 prog.py\n" +"drwxr-xr-x 14 wena wena 4096 Feb 7 00:59 pypy\n" +"-rw-r--r-- 1 wena wena 741 Feb 18 01:01 rm-unused-function.patch\n" +"$ ls --help\n" +"Usage: ls [OPTION]... [FILE]...\n" +"List information about the FILEs (the current directory by default).\n" +"Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n" +"..." +msgstr "" + +#: howto/argparse.rst:53 msgid "A few concepts we can learn from the four commands:" msgstr "" -#: howto/argparse.rst:50 +#: howto/argparse.rst:55 msgid "" "The :command:`ls` command is useful when run without any options at all. It " "defaults to displaying the contents of the current directory." msgstr "" -#: howto/argparse.rst:53 +#: howto/argparse.rst:58 msgid "" "If we want beyond what it provides by default, we tell it a bit more. In " "this case, we want it to display a different directory, ``pypy``. What we " @@ -74,49 +101,72 @@ msgid "" "want it copied to*." msgstr "" -#: howto/argparse.rst:62 +#: howto/argparse.rst:67 msgid "" "Now, say we want to change behaviour of the program. In our example, we " "display more info for each file instead of just showing the file names. The " "``-l`` in that case is known as an optional argument." msgstr "" -#: howto/argparse.rst:66 +#: howto/argparse.rst:71 msgid "" "That's a snippet of the help text. It's very useful in that you can come " "across a program you have never used before, and can figure out how it works " "simply by reading its help text." msgstr "" -#: howto/argparse.rst:72 +#: howto/argparse.rst:77 msgid "The basics" msgstr "" -#: howto/argparse.rst:74 +#: howto/argparse.rst:79 msgid "Let us start with a very simple example which does (almost) nothing::" msgstr "" -#: howto/argparse.rst:188 howto/argparse.rst:209 +#: howto/argparse.rst:81 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.parse_args()" +msgstr "" + +#: howto/argparse.rst:193 howto/argparse.rst:214 msgid "Following is a result of running the code:" msgstr "" -#: howto/argparse.rst:254 howto/argparse.rst:298 +#: howto/argparse.rst:87 +msgid "" +"$ python prog.py\n" +"$ python prog.py --help\n" +"usage: prog.py [-h]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"$ python prog.py --verbose\n" +"usage: prog.py [-h]\n" +"prog.py: error: unrecognized arguments: --verbose\n" +"$ python prog.py foo\n" +"usage: prog.py [-h]\n" +"prog.py: error: unrecognized arguments: foo" +msgstr "" + +#: howto/argparse.rst:259 howto/argparse.rst:303 msgid "Here is what is happening:" msgstr "" -#: howto/argparse.rst:99 +#: howto/argparse.rst:104 msgid "" "Running the script without any options results in nothing displayed to " "stdout. Not so useful." msgstr "" -#: howto/argparse.rst:102 +#: howto/argparse.rst:107 msgid "" "The second one starts to display the usefulness of the :mod:`argparse` " "module. We have done almost nothing, but already we get a nice help message." msgstr "" -#: howto/argparse.rst:105 +#: howto/argparse.rst:110 msgid "" "The ``--help`` option, which can also be shortened to ``-h``, is the only " "option we get for free (i.e. no need to specify it). Specifying anything " @@ -124,23 +174,49 @@ msgid "" "also for free." msgstr "" -#: howto/argparse.rst:112 +#: howto/argparse.rst:117 msgid "Introducing Positional arguments" msgstr "" -#: howto/argparse.rst:114 +#: howto/argparse.rst:119 msgid "An example::" msgstr "" -#: howto/argparse.rst:122 +#: howto/argparse.rst:121 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"echo\")\n" +"args = parser.parse_args()\n" +"print(args.echo)" +msgstr "" + +#: howto/argparse.rst:127 msgid "And running the code:" msgstr "" -#: howto/argparse.rst:140 +#: howto/argparse.rst:129 +msgid "" +"$ python prog.py\n" +"usage: prog.py [-h] echo\n" +"prog.py: error: the following arguments are required: echo\n" +"$ python prog.py --help\n" +"usage: prog.py [-h] echo\n" +"\n" +"positional arguments:\n" +" echo\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"$ python prog.py foo\n" +"foo" +msgstr "" + +#: howto/argparse.rst:145 msgid "Here is what's happening:" msgstr "" -#: howto/argparse.rst:142 +#: howto/argparse.rst:147 msgid "" "We've added the :meth:`~ArgumentParser.add_argument` method, which is what " "we use to specify which command-line options the program is willing to " @@ -148,17 +224,17 @@ msgid "" "function." msgstr "" -#: howto/argparse.rst:146 +#: howto/argparse.rst:151 msgid "Calling our program now requires us to specify an option." msgstr "" -#: howto/argparse.rst:148 +#: howto/argparse.rst:153 msgid "" "The :meth:`~ArgumentParser.parse_args` method actually returns some data " "from the options specified, in this case, ``echo``." msgstr "" -#: howto/argparse.rst:151 +#: howto/argparse.rst:156 msgid "" "The variable is some form of 'magic' that :mod:`argparse` performs for free " "(i.e. no need to specify which variable that value is stored in). You will " @@ -166,7 +242,7 @@ msgid "" "``echo``." msgstr "" -#: howto/argparse.rst:156 +#: howto/argparse.rst:161 msgid "" "Note however that, although the help display looks nice and all, it " "currently is not as helpful as it can be. For example we see that we got " @@ -175,48 +251,135 @@ msgid "" "useful::" msgstr "" -#: howto/argparse.rst:167 +#: howto/argparse.rst:166 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"echo\", help=\"echo the string you use here\")\n" +"args = parser.parse_args()\n" +"print(args.echo)" +msgstr "" + +#: howto/argparse.rst:172 msgid "And we get:" msgstr "" -#: howto/argparse.rst:180 +#: howto/argparse.rst:174 +msgid "" +"$ python prog.py -h\n" +"usage: prog.py [-h] echo\n" +"\n" +"positional arguments:\n" +" echo echo the string you use here\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" +msgstr "" + +#: howto/argparse.rst:185 msgid "Now, how about doing something even more useful::" msgstr "" -#: howto/argparse.rst:198 +#: howto/argparse.rst:187 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", help=\"display a square of a given " +"number\")\n" +"args = parser.parse_args()\n" +"print(args.square**2)" +msgstr "" + +#: howto/argparse.rst:195 +msgid "" +"$ python prog.py 4\n" +"Traceback (most recent call last):\n" +" File \"prog.py\", line 5, in \n" +" print(args.square**2)\n" +"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'" +msgstr "" + +#: howto/argparse.rst:203 msgid "" "That didn't go so well. That's because :mod:`argparse` treats the options we " "give it as strings, unless we tell it otherwise. So, let's tell :mod:" "`argparse` to treat that input as an integer::" msgstr "" -#: howto/argparse.rst:219 +#: howto/argparse.rst:207 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", help=\"display a square of a given " +"number\",\n" +" type=int)\n" +"args = parser.parse_args()\n" +"print(args.square**2)" +msgstr "" + +#: howto/argparse.rst:216 +msgid "" +"$ python prog.py 4\n" +"16\n" +"$ python prog.py four\n" +"usage: prog.py [-h] square\n" +"prog.py: error: argument square: invalid int value: 'four'" +msgstr "" + +#: howto/argparse.rst:224 msgid "" "That went well. The program now even helpfully quits on bad illegal input " "before proceeding." msgstr "" -#: howto/argparse.rst:224 +#: howto/argparse.rst:229 msgid "Introducing Optional arguments" msgstr "" -#: howto/argparse.rst:226 +#: howto/argparse.rst:231 msgid "" "So far we have been playing with positional arguments. Let us have a look on " "how to add optional ones::" msgstr "" -#: howto/argparse.rst:282 howto/argparse.rst:432 +#: howto/argparse.rst:234 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"--verbosity\", help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"if args.verbosity:\n" +" print(\"verbosity turned on\")" +msgstr "" + +#: howto/argparse.rst:287 howto/argparse.rst:437 msgid "And the output:" msgstr "" -#: howto/argparse.rst:256 +#: howto/argparse.rst:243 +msgid "" +"$ python prog.py --verbosity 1\n" +"verbosity turned on\n" +"$ python prog.py\n" +"$ python prog.py --help\n" +"usage: prog.py [-h] [--verbosity VERBOSITY]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --verbosity VERBOSITY\n" +" increase output verbosity\n" +"$ python prog.py --verbosity\n" +"usage: prog.py [-h] [--verbosity VERBOSITY]\n" +"prog.py: error: argument --verbosity: expected one argument" +msgstr "" + +#: howto/argparse.rst:261 msgid "" "The program is written so as to display something when ``--verbosity`` is " "specified and display nothing when not." msgstr "" -#: howto/argparse.rst:259 +#: howto/argparse.rst:264 msgid "" "To show that the option is actually optional, there is no error when running " "the program without it. Note that by default, if an optional argument isn't " @@ -225,24 +388,50 @@ msgid "" "keyword:`if` statement." msgstr "" -#: howto/argparse.rst:265 +#: howto/argparse.rst:270 msgid "The help message is a bit different." msgstr "" -#: howto/argparse.rst:267 +#: howto/argparse.rst:272 msgid "" "When using the ``--verbosity`` option, one must also specify some value, any " "value." msgstr "" -#: howto/argparse.rst:270 +#: howto/argparse.rst:275 msgid "" "The above example accepts arbitrary integer values for ``--verbosity``, but " "for our simple program, only two values are actually useful, ``True`` or " "``False``. Let's modify the code accordingly::" msgstr "" -#: howto/argparse.rst:300 +#: howto/argparse.rst:279 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"--verbose\", help=\"increase output verbosity\",\n" +" action=\"store_true\")\n" +"args = parser.parse_args()\n" +"if args.verbose:\n" +" print(\"verbosity turned on\")" +msgstr "" + +#: howto/argparse.rst:289 +msgid "" +"$ python prog.py --verbose\n" +"verbosity turned on\n" +"$ python prog.py --verbose 1\n" +"usage: prog.py [-h] [--verbose]\n" +"prog.py: error: unrecognized arguments: 1\n" +"$ python prog.py --help\n" +"usage: prog.py [-h] [--verbose]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --verbose increase output verbosity" +msgstr "" + +#: howto/argparse.rst:305 msgid "" "The option is now more of a flag than something that requires a value. We " "even changed the name of the option to match that idea. Note that we now " @@ -251,149 +440,366 @@ msgid "" "``args.verbose``. Not specifying it implies ``False``." msgstr "" -#: howto/argparse.rst:307 +#: howto/argparse.rst:312 msgid "" "It complains when you specify a value, in true spirit of what flags actually " "are." msgstr "" -#: howto/argparse.rst:310 +#: howto/argparse.rst:315 msgid "Notice the different help text." msgstr "" -#: howto/argparse.rst:314 +#: howto/argparse.rst:319 msgid "Short options" msgstr "" -#: howto/argparse.rst:316 +#: howto/argparse.rst:321 msgid "" "If you are familiar with command line usage, you will notice that I haven't " "yet touched on the topic of short versions of the options. It's quite " "simple::" msgstr "" -#: howto/argparse.rst:328 +#: howto/argparse.rst:325 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"-v\", \"--verbose\", help=\"increase output " +"verbosity\",\n" +" action=\"store_true\")\n" +"args = parser.parse_args()\n" +"if args.verbose:\n" +" print(\"verbosity turned on\")" +msgstr "" + +#: howto/argparse.rst:333 msgid "And here goes:" msgstr "" -#: howto/argparse.rst:341 +#: howto/argparse.rst:335 +msgid "" +"$ python prog.py -v\n" +"verbosity turned on\n" +"$ python prog.py --help\n" +"usage: prog.py [-h] [-v]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose increase output verbosity" +msgstr "" + +#: howto/argparse.rst:346 msgid "Note that the new ability is also reflected in the help text." msgstr "" -#: howto/argparse.rst:345 +#: howto/argparse.rst:350 msgid "Combining Positional and Optional arguments" msgstr "" -#: howto/argparse.rst:347 +#: howto/argparse.rst:352 msgid "Our program keeps growing in complexity::" msgstr "" -#: howto/argparse.rst:362 +#: howto/argparse.rst:354 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbose\", action=\"store_true\",\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbose:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"else:\n" +" print(answer)" +msgstr "" + +#: howto/argparse.rst:367 msgid "And now the output:" msgstr "" -#: howto/argparse.rst:376 +#: howto/argparse.rst:369 +msgid "" +"$ python prog.py\n" +"usage: prog.py [-h] [-v] square\n" +"prog.py: error: the following arguments are required: square\n" +"$ python prog.py 4\n" +"16\n" +"$ python prog.py 4 --verbose\n" +"the square of 4 equals 16\n" +"$ python prog.py --verbose 4\n" +"the square of 4 equals 16" +msgstr "" + +#: howto/argparse.rst:381 msgid "We've brought back a positional argument, hence the complaint." msgstr "" -#: howto/argparse.rst:378 +#: howto/argparse.rst:383 msgid "Note that the order does not matter." msgstr "" -#: howto/argparse.rst:380 +#: howto/argparse.rst:385 msgid "" "How about we give this program of ours back the ability to have multiple " "verbosity values, and actually get to use them::" msgstr "" -#: howto/argparse.rst:414 +#: howto/argparse.rst:388 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", type=int,\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbosity == 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity == 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" +msgstr "" + +#: howto/argparse.rst:405 +msgid "" +"$ python prog.py 4\n" +"16\n" +"$ python prog.py 4 -v\n" +"usage: prog.py [-h] [-v VERBOSITY] square\n" +"prog.py: error: argument -v/--verbosity: expected one argument\n" +"$ python prog.py 4 -v 1\n" +"4^2 == 16\n" +"$ python prog.py 4 -v 2\n" +"the square of 4 equals 16\n" +"$ python prog.py 4 -v 3\n" +"16" +msgstr "" + +#: howto/argparse.rst:419 msgid "" "These all look good except the last one, which exposes a bug in our program. " "Let's fix it by restricting the values the ``--verbosity`` option can " "accept::" msgstr "" -#: howto/argparse.rst:450 +#: howto/argparse.rst:422 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", type=int, choices=[0, 1, 2],\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbosity == 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity == 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" +msgstr "" + +#: howto/argparse.rst:439 +msgid "" +"$ python prog.py 4 -v 3\n" +"usage: prog.py [-h] [-v {0,1,2}] square\n" +"prog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, " +"1, 2)\n" +"$ python prog.py 4 -h\n" +"usage: prog.py [-h] [-v {0,1,2}] square\n" +"\n" +"positional arguments:\n" +" square display a square of a given number\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbosity {0,1,2}\n" +" increase output verbosity" +msgstr "" + +#: howto/argparse.rst:455 msgid "" "Note that the change also reflects both in the error message as well as the " "help string." msgstr "" -#: howto/argparse.rst:453 +#: howto/argparse.rst:458 msgid "" "Now, let's use a different approach of playing with verbosity, which is " "pretty common. It also matches the way the CPython executable handles its " "own verbosity argument (check the output of ``python --help``)::" msgstr "" -#: howto/argparse.rst:472 +#: howto/argparse.rst:462 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display the square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\",\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbosity == 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity == 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" +msgstr "" + +#: howto/argparse.rst:477 msgid "" "We have introduced another action, \"count\", to count the number of " "occurrences of specific options." msgstr "" -#: howto/argparse.rst:501 +#: howto/argparse.rst:481 +msgid "" +"$ python prog.py 4\n" +"16\n" +"$ python prog.py 4 -v\n" +"4^2 == 16\n" +"$ python prog.py 4 -vv\n" +"the square of 4 equals 16\n" +"$ python prog.py 4 --verbosity --verbosity\n" +"the square of 4 equals 16\n" +"$ python prog.py 4 -v 1\n" +"usage: prog.py [-h] [-v] square\n" +"prog.py: error: unrecognized arguments: 1\n" +"$ python prog.py 4 -h\n" +"usage: prog.py [-h] [-v] square\n" +"\n" +"positional arguments:\n" +" square display a square of a given number\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbosity increase output verbosity\n" +"$ python prog.py 4 -vvv\n" +"16" +msgstr "" + +#: howto/argparse.rst:506 msgid "" "Yes, it's now more of a flag (similar to ``action=\"store_true\"``) in the " "previous version of our script. That should explain the complaint." msgstr "" -#: howto/argparse.rst:504 +#: howto/argparse.rst:509 msgid "It also behaves similar to \"store_true\" action." msgstr "" -#: howto/argparse.rst:506 +#: howto/argparse.rst:511 msgid "" "Now here's a demonstration of what the \"count\" action gives. You've " "probably seen this sort of usage before." msgstr "" -#: howto/argparse.rst:509 +#: howto/argparse.rst:514 msgid "" "And if you don't specify the ``-v`` flag, that flag is considered to have " "``None`` value." msgstr "" -#: howto/argparse.rst:512 +#: howto/argparse.rst:517 msgid "" "As should be expected, specifying the long form of the flag, we should get " "the same output." msgstr "" -#: howto/argparse.rst:515 +#: howto/argparse.rst:520 msgid "" "Sadly, our help output isn't very informative on the new ability our script " "has acquired, but that can always be fixed by improving the documentation " "for our script (e.g. via the ``help`` keyword argument)." msgstr "" -#: howto/argparse.rst:519 +#: howto/argparse.rst:524 msgid "That last output exposes a bug in our program." msgstr "" -#: howto/argparse.rst:522 +#: howto/argparse.rst:527 msgid "Let's fix::" msgstr "" -#: howto/argparse.rst:541 +#: howto/argparse.rst:529 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\",\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"\n" +"# bugfix: replace == with >=\n" +"if args.verbosity >= 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity >= 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" +msgstr "" + +#: howto/argparse.rst:546 msgid "And this is what it gives:" msgstr "" -#: howto/argparse.rst:556 +#: howto/argparse.rst:548 +msgid "" +"$ python prog.py 4 -vvv\n" +"the square of 4 equals 16\n" +"$ python prog.py 4 -vvvv\n" +"the square of 4 equals 16\n" +"$ python prog.py 4\n" +"Traceback (most recent call last):\n" +" File \"prog.py\", line 11, in \n" +" if args.verbosity >= 2:\n" +"TypeError: '>=' not supported between instances of 'NoneType' and 'int'" +msgstr "" + +#: howto/argparse.rst:561 msgid "" "First output went well, and fixes the bug we had before. That is, we want " "any value >= 2 to be as verbose as possible." msgstr "" -#: howto/argparse.rst:559 +#: howto/argparse.rst:564 msgid "Third output not so good." msgstr "" -#: howto/argparse.rst:561 +#: howto/argparse.rst:566 msgid "Let's fix that bug::" msgstr "" -#: howto/argparse.rst:578 +#: howto/argparse.rst:568 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\", default=0,\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbosity >= 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity >= 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" +msgstr "" + +#: howto/argparse.rst:583 msgid "" "We've just introduced yet another keyword, ``default``. We've set it to " "``0`` in order to make it comparable to the other int values. Remember that " @@ -402,54 +808,145 @@ msgid "" "`TypeError` exception)." msgstr "" -#: howto/argparse.rst:585 +#: howto/argparse.rst:590 msgid "And:" msgstr "" #: howto/argparse.rst:592 msgid "" +"$ python prog.py 4\n" +"16" +msgstr "" + +#: howto/argparse.rst:597 +msgid "" "You can go quite far just with what we've learned so far, and we have only " "scratched the surface. The :mod:`argparse` module is very powerful, and " "we'll explore a bit more of it before we end this tutorial." msgstr "" -#: howto/argparse.rst:599 +#: howto/argparse.rst:604 msgid "Getting a little more advanced" msgstr "" -#: howto/argparse.rst:601 +#: howto/argparse.rst:606 msgid "" "What if we wanted to expand our tiny program to perform other powers, not " "just squares::" msgstr "" -#: howto/argparse.rst:656 +#: howto/argparse.rst:609 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"x\", type=int, help=\"the base\")\n" +"parser.add_argument(\"y\", type=int, help=\"the exponent\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\", default=0)\n" +"args = parser.parse_args()\n" +"answer = args.x**args.y\n" +"if args.verbosity >= 2:\n" +" print(f\"{args.x} to the power {args.y} equals {answer}\")\n" +"elif args.verbosity >= 1:\n" +" print(f\"{args.x}^{args.y} == {answer}\")\n" +"else:\n" +" print(answer)" +msgstr "" + +#: howto/argparse.rst:661 howto/argparse.rst:877 msgid "Output:" msgstr "" -#: howto/argparse.rst:639 +#: howto/argparse.rst:625 +msgid "" +"$ python prog.py\n" +"usage: prog.py [-h] [-v] x y\n" +"prog.py: error: the following arguments are required: x, y\n" +"$ python prog.py -h\n" +"usage: prog.py [-h] [-v] x y\n" +"\n" +"positional arguments:\n" +" x the base\n" +" y the exponent\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbosity\n" +"$ python prog.py 4 2 -v\n" +"4^2 == 16" +msgstr "" + +#: howto/argparse.rst:644 msgid "" "Notice that so far we've been using verbosity level to *change* the text " "that gets displayed. The following example instead uses verbosity level to " "display *more* text instead::" msgstr "" -#: howto/argparse.rst:672 +#: howto/argparse.rst:648 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"x\", type=int, help=\"the base\")\n" +"parser.add_argument(\"y\", type=int, help=\"the exponent\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\", default=0)\n" +"args = parser.parse_args()\n" +"answer = args.x**args.y\n" +"if args.verbosity >= 2:\n" +" print(f\"Running '{__file__}'\")\n" +"if args.verbosity >= 1:\n" +" print(f\"{args.x}^{args.y} == \", end=\"\")\n" +"print(answer)" +msgstr "" + +#: howto/argparse.rst:663 +msgid "" +"$ python prog.py 4 2\n" +"16\n" +"$ python prog.py 4 2 -v\n" +"4^2 == 16\n" +"$ python prog.py 4 2 -vv\n" +"Running 'prog.py'\n" +"4^2 == 16" +msgstr "" + +#: howto/argparse.rst:677 msgid "Specifying ambiguous arguments" msgstr "" -#: howto/argparse.rst:674 +#: howto/argparse.rst:679 msgid "" "When there is ambiguity in deciding whether an argument is positional or for " "an argument, ``--`` can be used to tell :meth:`~ArgumentParser.parse_args` " "that everything after that is a positional argument::" msgstr "" -#: howto/argparse.rst:699 +#: howto/argparse.rst:683 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-n', nargs='+')\n" +">>> parser.add_argument('args', nargs='*')\n" +"\n" +">>> # ambiguous, so parse_args assumes it's an option\n" +">>> parser.parse_args(['-f'])\n" +"usage: PROG [-h] [-n N [N ...]] [args ...]\n" +"PROG: error: unrecognized arguments: -f\n" +"\n" +">>> parser.parse_args(['--', '-f'])\n" +"Namespace(args=['-f'], n=None)\n" +"\n" +">>> # ambiguous, so the -n option greedily accepts arguments\n" +">>> parser.parse_args(['-n', '1', '2', '3'])\n" +"Namespace(args=[], n=['1', '2', '3'])\n" +"\n" +">>> parser.parse_args(['-n', '1', '--', '2', '3'])\n" +"Namespace(args=['2', '3'], n=['1'])" +msgstr "" + +#: howto/argparse.rst:704 msgid "Conflicting options" msgstr "" -#: howto/argparse.rst:701 +#: howto/argparse.rst:706 msgid "" "So far, we have been working with two methods of an :class:`argparse." "ArgumentParser` instance. Let's introduce a third one, :meth:" @@ -459,37 +956,113 @@ msgid "" "``--quiet`` option, which will be the opposite of the ``--verbose`` one::" msgstr "" -#: howto/argparse.rst:727 +#: howto/argparse.rst:714 +msgid "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser()\n" +"group = parser.add_mutually_exclusive_group()\n" +"group.add_argument(\"-v\", \"--verbose\", action=\"store_true\")\n" +"group.add_argument(\"-q\", \"--quiet\", action=\"store_true\")\n" +"parser.add_argument(\"x\", type=int, help=\"the base\")\n" +"parser.add_argument(\"y\", type=int, help=\"the exponent\")\n" +"args = parser.parse_args()\n" +"answer = args.x**args.y\n" +"\n" +"if args.quiet:\n" +" print(answer)\n" +"elif args.verbose:\n" +" print(f\"{args.x} to the power {args.y} equals {answer}\")\n" +"else:\n" +" print(f\"{args.x}^{args.y} == {answer}\")" +msgstr "" + +#: howto/argparse.rst:732 msgid "" "Our program is now simpler, and we've lost some functionality for the sake " "of demonstration. Anyways, here's the output:" msgstr "" -#: howto/argparse.rst:745 +#: howto/argparse.rst:735 +msgid "" +"$ python prog.py 4 2\n" +"4^2 == 16\n" +"$ python prog.py 4 2 -q\n" +"16\n" +"$ python prog.py 4 2 -v\n" +"4 to the power 2 equals 16\n" +"$ python prog.py 4 2 -vq\n" +"usage: prog.py [-h] [-v | -q] x y\n" +"prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose\n" +"$ python prog.py 4 2 -v --quiet\n" +"usage: prog.py [-h] [-v | -q] x y\n" +"prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose" +msgstr "" + +#: howto/argparse.rst:750 msgid "" "That should be easy to follow. I've added that last output so you can see " "the sort of flexibility you get, i.e. mixing long form options with short " "form ones." msgstr "" -#: howto/argparse.rst:749 +#: howto/argparse.rst:754 msgid "" "Before we conclude, you probably want to tell your users the main purpose of " "your program, just in case they don't know::" msgstr "" -#: howto/argparse.rst:770 +#: howto/argparse.rst:757 +msgid "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(description=\"calculate X to the power of " +"Y\")\n" +"group = parser.add_mutually_exclusive_group()\n" +"group.add_argument(\"-v\", \"--verbose\", action=\"store_true\")\n" +"group.add_argument(\"-q\", \"--quiet\", action=\"store_true\")\n" +"parser.add_argument(\"x\", type=int, help=\"the base\")\n" +"parser.add_argument(\"y\", type=int, help=\"the exponent\")\n" +"args = parser.parse_args()\n" +"answer = args.x**args.y\n" +"\n" +"if args.quiet:\n" +" print(answer)\n" +"elif args.verbose:\n" +" print(f\"{args.x} to the power {args.y} equals {answer}\")\n" +"else:\n" +" print(f\"{args.x}^{args.y} == {answer}\")" +msgstr "" + +#: howto/argparse.rst:775 msgid "" "Note that slight difference in the usage text. Note the ``[-v | -q]``, which " "tells us that we can either use ``-v`` or ``-q``, but not both at the same " "time:" msgstr "" -#: howto/argparse.rst:792 +#: howto/argparse.rst:806 +msgid "" +"$ python prog.py --help\n" +"usage: prog.py [-h] [-v | -q] x y\n" +"\n" +"calculate X to the power of Y\n" +"\n" +"positional arguments:\n" +" x the base\n" +" y the exponent\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose\n" +" -q, --quiet" +msgstr "" + +#: howto/argparse.rst:797 msgid "How to translate the argparse output" msgstr "" -#: howto/argparse.rst:794 +#: howto/argparse.rst:799 msgid "" "The output of the :mod:`argparse` module such as its help text and error " "messages are all made translatable using the :mod:`gettext` module. This " @@ -497,54 +1070,136 @@ msgid "" "See also :ref:`i18n-howto`." msgstr "" -#: howto/argparse.rst:799 +#: howto/argparse.rst:804 msgid "For instance, in this :mod:`argparse` output:" msgstr "" -#: howto/argparse.rst:817 +#: howto/argparse.rst:822 msgid "" "The strings ``usage:``, ``positional arguments:``, ``options:`` and ``show " "this help message and exit`` are all translatable." msgstr "" -#: howto/argparse.rst:820 +#: howto/argparse.rst:825 msgid "" "In order to translate these strings, they must first be extracted into a ``." "po`` file. For example, using `Babel `__, run this " "command:" msgstr "" -#: howto/argparse.rst:828 +#: howto/argparse.rst:829 +msgid "$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py" +msgstr "" + +#: howto/argparse.rst:833 msgid "" "This command will extract all translatable strings from the :mod:`argparse` " "module and output them into a file named ``messages.po``. This command " "assumes that your Python installation is in ``/usr/lib``." msgstr "" -#: howto/argparse.rst:832 +#: howto/argparse.rst:837 msgid "" "You can find out the location of the :mod:`argparse` module on your system " "using this script::" msgstr "" -#: howto/argparse.rst:838 +#: howto/argparse.rst:840 +msgid "" +"import argparse\n" +"print(argparse.__file__)" +msgstr "" + +#: howto/argparse.rst:843 msgid "" "Once the messages in the ``.po`` file are translated and the translations " "are installed using :mod:`gettext`, :mod:`argparse` will be able to display " "the translated messages." msgstr "" -#: howto/argparse.rst:842 +#: howto/argparse.rst:847 msgid "" "To translate your own strings in the :mod:`argparse` output, use :mod:" "`gettext`." msgstr "" -#: howto/argparse.rst:845 +#: howto/argparse.rst:850 +msgid "Custom type converters" +msgstr "" + +#: howto/argparse.rst:852 +msgid "" +"The :mod:`argparse` module allows you to specify custom type converters for " +"your command-line arguments. This allows you to modify user input before " +"it's stored in the :class:`argparse.Namespace`. This can be useful when you " +"need to pre-process the input before it is used in your program." +msgstr "" + +#: howto/argparse.rst:857 +msgid "" +"When using a custom type converter, you can use any callable that takes a " +"single string argument (the argument value) and returns the converted value. " +"However, if you need to handle more complex scenarios, you can use a custom " +"action class with the **action** parameter instead." +msgstr "" + +#: howto/argparse.rst:862 +msgid "" +"For example, let's say you want to handle arguments with different prefixes " +"and process them accordingly::" +msgstr "" + +#: howto/argparse.rst:865 +msgid "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(prefix_chars='-+')\n" +"\n" +"parser.add_argument('-a', metavar='', action='append',\n" +" type=lambda x: ('-', x))\n" +"parser.add_argument('+a', metavar='', action='append',\n" +" type=lambda x: ('+', x))\n" +"\n" +"args = parser.parse_args()\n" +"print(args)" +msgstr "" + +#: howto/argparse.rst:879 +msgid "" +"$ python prog.py -a value1 +a value2\n" +"Namespace(a=[('-', 'value1'), ('+', 'value2')])" +msgstr "" + +#: howto/argparse.rst:884 +msgid "In this example, we:" +msgstr "" + +#: howto/argparse.rst:886 +msgid "" +"Created a parser with custom prefix characters using the ``prefix_chars`` " +"parameter." +msgstr "" + +#: howto/argparse.rst:889 +msgid "" +"Defined two arguments, ``-a`` and ``+a``, which used the ``type`` parameter " +"to create custom type converters to store the value in a tuple with the " +"prefix." +msgstr "" + +#: howto/argparse.rst:892 +msgid "" +"Without the custom type converters, the arguments would have treated the ``-" +"a`` and ``+a`` as the same argument, which would have been undesirable. By " +"using custom type converters, we were able to differentiate between the two " +"arguments." +msgstr "" + +#: howto/argparse.rst:897 msgid "Conclusion" msgstr "" -#: howto/argparse.rst:847 +#: howto/argparse.rst:899 msgid "" "The :mod:`argparse` module offers a lot more than shown here. Its docs are " "quite detailed and thorough, and full of examples. Having gone through this " diff --git a/howto/clinic.po b/howto/clinic.po index 1fd5b5f0..3984da93 100644 --- a/howto/clinic.po +++ b/howto/clinic.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/howto/cporting.po b/howto/cporting.po index 015541bd..0f49d0e6 100644 --- a/howto/cporting.po +++ b/howto/cporting.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -41,8 +42,8 @@ msgstr "" #: howto/cporting.rst:17 msgid "" -"The `Cython`_ and `CFFI`_ libraries offer abstractions over Python's C API. " -"Extensions generally need to be re-written to use one of them, but the " -"library then handles differences between various Python versions and " -"implementations." +":ref:`Recommended third party tools ` offer abstractions over " +"the Python's C API. Extensions generally need to be re-written to use one of " +"them, but the library then handles differences between various Python " +"versions and implementations." msgstr "" diff --git a/howto/curses.po b/howto/curses.po index f244db17..f2167b4f 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -80,8 +81,7 @@ msgid "" "curses library will figure out what control codes need to be sent to the " "terminal to produce the right output. curses doesn't provide many user-" "interface concepts such as buttons, checkboxes, or dialogs; if you need such " -"features, consider a user interface library such as `Urwid `_." +"features, consider a user interface library such as :pypi:`Urwid`." msgstr "" #: howto/curses.rst:48 @@ -100,15 +100,14 @@ msgstr "" #: howto/curses.rst:58 msgid "" "The Windows version of Python doesn't include the :mod:`curses` module. A " -"ported version called `UniCurses `_ is " -"available." +"ported version called :pypi:`UniCurses` is available." msgstr "" -#: howto/curses.rst:64 +#: howto/curses.rst:63 msgid "The Python curses module" msgstr "" -#: howto/curses.rst:66 +#: howto/curses.rst:65 msgid "" "The Python module is a fairly simple wrapper over the C functions provided " "by curses; if you're already familiar with curses programming in C, it's " @@ -119,7 +118,7 @@ msgid "" "this covered in more detail later." msgstr "" -#: howto/curses.rst:74 +#: howto/curses.rst:73 msgid "" "This HOWTO is an introduction to writing text-mode programs with curses and " "Python. It doesn't attempt to be a complete guide to the curses API; for " @@ -127,11 +126,11 @@ msgid "" "pages for ncurses. It will, however, give you the basic ideas." msgstr "" -#: howto/curses.rst:81 +#: howto/curses.rst:80 msgid "Starting and ending a curses application" msgstr "" -#: howto/curses.rst:83 +#: howto/curses.rst:82 msgid "" "Before doing anything, curses must be initialized. This is done by calling " "the :func:`~curses.initscr` function, which will determine the terminal " @@ -141,21 +140,35 @@ msgid "" "after the name of the corresponding C variable. ::" msgstr "" -#: howto/curses.rst:94 +#: howto/curses.rst:90 +msgid "" +"import curses\n" +"stdscr = curses.initscr()" +msgstr "" + +#: howto/curses.rst:93 msgid "" "Usually curses applications turn off automatic echoing of keys to the " "screen, in order to be able to read keys and only display them under certain " "circumstances. This requires calling the :func:`~curses.noecho` function. ::" msgstr "" -#: howto/curses.rst:101 +#: howto/curses.rst:98 +msgid "curses.noecho()" +msgstr "" + +#: howto/curses.rst:100 msgid "" "Applications will also commonly need to react to keys instantly, without " "requiring the Enter key to be pressed; this is called cbreak mode, as " "opposed to the usual buffered input mode. ::" msgstr "" -#: howto/curses.rst:107 +#: howto/curses.rst:104 +msgid "curses.cbreak()" +msgstr "" + +#: howto/curses.rst:106 msgid "" "Terminals usually return special keys, such as the cursor keys or navigation " "keys such as Page Up and Home, as a multibyte escape sequence. While you " @@ -165,20 +178,35 @@ msgid "" "keypad mode. ::" msgstr "" -#: howto/curses.rst:116 +#: howto/curses.rst:113 +msgid "stdscr.keypad(True)" +msgstr "" + +#: howto/curses.rst:115 msgid "" "Terminating a curses application is much easier than starting one. You'll " "need to call::" msgstr "" -#: howto/curses.rst:123 +#: howto/curses.rst:118 +msgid "" +"curses.nocbreak()\n" +"stdscr.keypad(False)\n" +"curses.echo()" +msgstr "" + +#: howto/curses.rst:122 msgid "" "to reverse the curses-friendly terminal settings. Then call the :func:" "`~curses.endwin` function to restore the terminal to its original operating " "mode. ::" msgstr "" -#: howto/curses.rst:129 +#: howto/curses.rst:126 +msgid "curses.endwin()" +msgstr "" + +#: howto/curses.rst:128 msgid "" "A common problem when debugging a curses application is to get your terminal " "messed up when the application dies without restoring the terminal to its " @@ -187,13 +215,32 @@ msgid "" "you type them, for example, which makes using the shell difficult." msgstr "" -#: howto/curses.rst:135 +#: howto/curses.rst:134 msgid "" "In Python you can avoid these complications and make debugging much easier " "by importing the :func:`curses.wrapper` function and using it like this::" msgstr "" -#: howto/curses.rst:154 +#: howto/curses.rst:137 +msgid "" +"from curses import wrapper\n" +"\n" +"def main(stdscr):\n" +" # Clear screen\n" +" stdscr.clear()\n" +"\n" +" # This raises ZeroDivisionError when i == 10.\n" +" for i in range(0, 11):\n" +" v = i-10\n" +" stdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))\n" +"\n" +" stdscr.refresh()\n" +" stdscr.getkey()\n" +"\n" +"wrapper(main)" +msgstr "" + +#: howto/curses.rst:153 msgid "" "The :func:`~curses.wrapper` function takes a callable object and does the " "initializations described above, also initializing colors if color support " @@ -206,18 +253,18 @@ msgid "" "and traceback." msgstr "" -#: howto/curses.rst:166 +#: howto/curses.rst:165 msgid "Windows and Pads" msgstr "" -#: howto/curses.rst:168 +#: howto/curses.rst:167 msgid "" "Windows are the basic abstraction in curses. A window object represents a " "rectangular area of the screen, and supports methods to display text, erase " "it, allow the user to input strings, and so forth." msgstr "" -#: howto/curses.rst:172 +#: howto/curses.rst:171 msgid "" "The ``stdscr`` object returned by the :func:`~curses.initscr` function is a " "window object that covers the entire screen. Many programs may need only " @@ -227,7 +274,14 @@ msgid "" "window object. ::" msgstr "" -#: howto/curses.rst:183 +#: howto/curses.rst:178 +msgid "" +"begin_x = 20; begin_y = 7\n" +"height = 5; width = 40\n" +"win = curses.newwin(height, width, begin_y, begin_x)" +msgstr "" + +#: howto/curses.rst:182 msgid "" "Note that the coordinate system used in curses is unusual. Coordinates are " "always passed in the order *y,x*, and the top-left corner of a window is " @@ -237,7 +291,7 @@ msgid "" "curses since it was first written, and it's too late to change things now." msgstr "" -#: howto/curses.rst:191 +#: howto/curses.rst:190 msgid "" "Your application can determine the size of the screen by using the :data:" "`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and *x* " @@ -245,14 +299,14 @@ msgid "" "- 1, curses.COLS - 1)``." msgstr "" -#: howto/curses.rst:196 +#: howto/curses.rst:195 msgid "" "When you call a method to display or erase text, the effect doesn't " "immediately show up on the display. Instead you must call the :meth:" "`~curses.window.refresh` method of window objects to update the screen." msgstr "" -#: howto/curses.rst:201 +#: howto/curses.rst:200 msgid "" "This is because curses was originally written with slow 300-baud terminal " "connections in mind; with these terminals, minimizing the time required to " @@ -263,7 +317,7 @@ msgid "" "because they're never visible." msgstr "" -#: howto/curses.rst:210 +#: howto/curses.rst:209 msgid "" "In practice, explicitly telling curses to redraw a window doesn't really " "complicate programming with curses much. Most programs go into a flurry of " @@ -273,7 +327,7 @@ msgid "" "stdscr.refresh` or the :meth:`!refresh` method of some other relevant window." msgstr "" -#: howto/curses.rst:218 +#: howto/curses.rst:217 msgid "" "A pad is a special case of a window; it can be larger than the actual " "display screen, and only a portion of the pad displayed at a time. Creating " @@ -282,7 +336,25 @@ msgid "" "will be displayed. ::" msgstr "" -#: howto/curses.rst:239 +#: howto/curses.rst:223 +msgid "" +"pad = curses.newpad(100, 100)\n" +"# These loops fill the pad with letters; addch() is\n" +"# explained in the next section\n" +"for y in range(0, 99):\n" +" for x in range(0, 99):\n" +" pad.addch(y,x, ord('a') + (x*x+y*y) % 26)\n" +"\n" +"# Displays a section of the pad in the middle of the screen.\n" +"# (0,0) : coordinate of upper-left corner of pad area to display.\n" +"# (5,5) : coordinate of upper-left corner of window area to be filled\n" +"# with pad content.\n" +"# (20, 75) : coordinate of lower-right corner of window area to be\n" +"# : filled with pad content.\n" +"pad.refresh( 0,0, 5,5, 20,75)" +msgstr "" + +#: howto/curses.rst:238 msgid "" "The :meth:`!refresh` call displays a section of the pad in the rectangle " "extending from coordinate (5,5) to coordinate (20,75) on the screen; the " @@ -291,36 +363,36 @@ msgid "" "the same methods." msgstr "" -#: howto/curses.rst:245 +#: howto/curses.rst:244 msgid "" "If you have multiple windows and pads on screen there is a more efficient " "way to update the screen and prevent annoying screen flicker as each part of " "the screen gets updated. :meth:`!refresh` actually does two things:" msgstr "" -#: howto/curses.rst:250 +#: howto/curses.rst:249 msgid "" "Calls the :meth:`~curses.window.noutrefresh` method of each window to update " "an underlying data structure representing the desired state of the screen." msgstr "" -#: howto/curses.rst:253 +#: howto/curses.rst:252 msgid "" "Calls the function :func:`~curses.doupdate` function to change the physical " "screen to match the desired state recorded in the data structure." msgstr "" -#: howto/curses.rst:256 +#: howto/curses.rst:255 msgid "" "Instead you can call :meth:`!noutrefresh` on a number of windows to update " "the data structure, and then call :func:`!doupdate` to update the screen." msgstr "" -#: howto/curses.rst:262 +#: howto/curses.rst:261 msgid "Displaying Text" msgstr "" -#: howto/curses.rst:264 +#: howto/curses.rst:263 msgid "" "From a C programmer's point of view, curses may sometimes look like a twisty " "maze of functions, all subtly different. For example, :c:func:`!addstr` " @@ -332,7 +404,7 @@ msgid "" "coordinate." msgstr "" -#: howto/curses.rst:273 +#: howto/curses.rst:272 msgid "" "Fortunately the Python interface hides all these details. ``stdscr`` is a " "window object like any other, and methods such as :meth:`~curses.window." @@ -340,58 +412,58 @@ msgid "" "forms." msgstr "" -#: howto/curses.rst:279 +#: howto/curses.rst:278 msgid "Form" msgstr "" -#: howto/curses.rst:347 +#: howto/curses.rst:346 msgid "Description" msgstr "" -#: howto/curses.rst:281 +#: howto/curses.rst:280 msgid "*str* or *ch*" msgstr "" -#: howto/curses.rst:281 +#: howto/curses.rst:280 msgid "Display the string *str* or character *ch* at the current position" msgstr "" -#: howto/curses.rst:284 +#: howto/curses.rst:283 msgid "*str* or *ch*, *attr*" msgstr "" -#: howto/curses.rst:284 +#: howto/curses.rst:283 msgid "" "Display the string *str* or character *ch*, using attribute *attr* at the " "current position" msgstr "" -#: howto/curses.rst:288 +#: howto/curses.rst:287 msgid "*y*, *x*, *str* or *ch*" msgstr "" -#: howto/curses.rst:288 +#: howto/curses.rst:287 msgid "Move to position *y,x* within the window, and display *str* or *ch*" msgstr "" -#: howto/curses.rst:291 +#: howto/curses.rst:290 msgid "*y*, *x*, *str* or *ch*, *attr*" msgstr "" -#: howto/curses.rst:291 +#: howto/curses.rst:290 msgid "" "Move to position *y,x* within the window, and display *str* or *ch*, using " "attribute *attr*" msgstr "" -#: howto/curses.rst:295 +#: howto/curses.rst:294 msgid "" "Attributes allow displaying text in highlighted forms such as boldface, " "underline, reverse code, or in color. They'll be explained in more detail " "in the next subsection." msgstr "" -#: howto/curses.rst:300 +#: howto/curses.rst:299 msgid "" "The :meth:`~curses.window.addstr` method takes a Python string or bytestring " "as the value to be displayed. The contents of bytestrings are sent to the " @@ -400,13 +472,13 @@ msgid "" "system encoding as returned by :func:`locale.getencoding`." msgstr "" -#: howto/curses.rst:306 +#: howto/curses.rst:305 msgid "" "The :meth:`~curses.window.addch` methods take a character, which can be " "either a string of length 1, a bytestring of length 1, or an integer." msgstr "" -#: howto/curses.rst:309 +#: howto/curses.rst:308 msgid "" "Constants are provided for extension characters; these constants are " "integers greater than 255. For example, :const:`ACS_PLMINUS` is a +/- " @@ -414,7 +486,7 @@ msgid "" "for drawing borders). You can also use the appropriate Unicode character." msgstr "" -#: howto/curses.rst:315 +#: howto/curses.rst:314 msgid "" "Windows remember where the cursor was left after the last operation, so if " "you leave out the *y,x* coordinates, the string or character will be " @@ -425,7 +497,7 @@ msgid "" "cursor blinking at some apparently random location." msgstr "" -#: howto/curses.rst:323 +#: howto/curses.rst:322 msgid "" "If your application doesn't need a blinking cursor at all, you can call " "``curs_set(False)`` to make it invisible. For compatibility with older " @@ -435,11 +507,11 @@ msgid "" "leaving it in odd locations." msgstr "" -#: howto/curses.rst:332 +#: howto/curses.rst:331 msgid "Attributes and Color" msgstr "" -#: howto/curses.rst:334 +#: howto/curses.rst:333 msgid "" "Characters can be displayed in different ways. Status lines in a text-based " "application are commonly shown in reverse video, or a text viewer may need " @@ -447,7 +519,7 @@ msgid "" "an attribute for each cell on the screen." msgstr "" -#: howto/curses.rst:339 +#: howto/curses.rst:338 msgid "" "An attribute is an integer, each bit representing a different attribute. " "You can try to display text with multiple attribute bits set, but curses " @@ -457,72 +529,79 @@ msgid "" "attributes, listed here." msgstr "" -#: howto/curses.rst:347 +#: howto/curses.rst:346 msgid "Attribute" msgstr "" -#: howto/curses.rst:349 +#: howto/curses.rst:348 msgid ":const:`A_BLINK`" msgstr "" -#: howto/curses.rst:349 +#: howto/curses.rst:348 msgid "Blinking text" msgstr "" -#: howto/curses.rst:351 +#: howto/curses.rst:350 msgid ":const:`A_BOLD`" msgstr "" -#: howto/curses.rst:351 +#: howto/curses.rst:350 msgid "Extra bright or bold text" msgstr "" -#: howto/curses.rst:353 +#: howto/curses.rst:352 msgid ":const:`A_DIM`" msgstr "" -#: howto/curses.rst:353 +#: howto/curses.rst:352 msgid "Half bright text" msgstr "" -#: howto/curses.rst:355 +#: howto/curses.rst:354 msgid ":const:`A_REVERSE`" msgstr "" -#: howto/curses.rst:355 +#: howto/curses.rst:354 msgid "Reverse-video text" msgstr "" -#: howto/curses.rst:357 +#: howto/curses.rst:356 msgid ":const:`A_STANDOUT`" msgstr "" -#: howto/curses.rst:357 +#: howto/curses.rst:356 msgid "The best highlighting mode available" msgstr "" -#: howto/curses.rst:359 +#: howto/curses.rst:358 msgid ":const:`A_UNDERLINE`" msgstr "" -#: howto/curses.rst:359 +#: howto/curses.rst:358 msgid "Underlined text" msgstr "" -#: howto/curses.rst:362 +#: howto/curses.rst:361 msgid "" "So, to display a reverse-video status line on the top line of the screen, " "you could code::" msgstr "" -#: howto/curses.rst:369 +#: howto/curses.rst:364 +msgid "" +"stdscr.addstr(0, 0, \"Current mode: Typing mode\",\n" +" curses.A_REVERSE)\n" +"stdscr.refresh()" +msgstr "" + +#: howto/curses.rst:368 msgid "" "The curses library also supports color on those terminals that provide it. " "The most common such terminal is probably the Linux console, followed by " "color xterms." msgstr "" -#: howto/curses.rst:373 +#: howto/curses.rst:372 msgid "" "To use color, you must call the :func:`~curses.start_color` function soon " "after calling :func:`~curses.initscr`, to initialize the default color set " @@ -534,7 +613,7 @@ msgid "" "for the sake of these functions.)" msgstr "" -#: howto/curses.rst:383 +#: howto/curses.rst:382 msgid "" "The curses library maintains a finite number of color pairs, containing a " "foreground (or text) color and a background color. You can get the " @@ -544,11 +623,17 @@ msgid "" "work on all terminals." msgstr "" -#: howto/curses.rst:390 +#: howto/curses.rst:389 msgid "An example, which displays a line of text using color pair 1::" msgstr "" -#: howto/curses.rst:395 +#: howto/curses.rst:391 +msgid "" +"stdscr.addstr(\"Pretty text\", curses.color_pair(1))\n" +"stdscr.refresh()" +msgstr "" + +#: howto/curses.rst:394 msgid "" "As I said before, a color pair consists of a foreground and background " "color. The ``init_pair(n, f, b)`` function changes the definition of color " @@ -556,7 +641,7 @@ msgid "" "hard-wired to white on black, and cannot be changed." msgstr "" -#: howto/curses.rst:400 +#: howto/curses.rst:399 msgid "" "Colors are numbered, and :func:`start_color` initializes 8 basic colors when " "it activates color mode. They are: 0:black, 1:red, 2:green, 3:yellow, 4:" @@ -565,20 +650,28 @@ msgid "" "const:`curses.COLOR_RED`, and so forth." msgstr "" -#: howto/curses.rst:406 +#: howto/curses.rst:405 msgid "" "Let's put all this together. To change color 1 to red text on a white " "background, you would call::" msgstr "" -#: howto/curses.rst:411 +#: howto/curses.rst:408 +msgid "curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)" +msgstr "" + +#: howto/curses.rst:410 msgid "" "When you change a color pair, any text already displayed using that color " "pair will change to the new colors. You can also display new text in this " "color with::" msgstr "" -#: howto/curses.rst:417 +#: howto/curses.rst:414 +msgid "stdscr.addstr(0,0, \"RED ALERT!\", curses.color_pair(1))" +msgstr "" + +#: howto/curses.rst:416 msgid "" "Very fancy terminals can change the definitions of the actual colors to a " "given RGB value. This lets you change color 1, which is usually red, to " @@ -590,23 +683,22 @@ msgid "" "your system's man pages for more information." msgstr "" -#: howto/curses.rst:428 +#: howto/curses.rst:427 msgid "User Input" msgstr "" -#: howto/curses.rst:430 +#: howto/curses.rst:429 msgid "" "The C curses library offers only very simple input mechanisms. Python's :mod:" -"`curses` module adds a basic text-input widget. (Other libraries such as " -"`Urwid `_ have more extensive collections " -"of widgets.)" +"`curses` module adds a basic text-input widget. (Other libraries such as :" +"pypi:`Urwid` have more extensive collections of widgets.)" msgstr "" -#: howto/curses.rst:435 +#: howto/curses.rst:433 msgid "There are two methods for getting input from a window:" msgstr "" -#: howto/curses.rst:437 +#: howto/curses.rst:435 msgid "" ":meth:`~curses.window.getch` refreshes the screen and then waits for the " "user to hit a key, displaying the key if :func:`~curses.echo` has been " @@ -614,7 +706,7 @@ msgid "" "should be moved before pausing." msgstr "" -#: howto/curses.rst:442 +#: howto/curses.rst:440 msgid "" ":meth:`~curses.window.getkey` does the same thing but converts the integer " "to a string. Individual characters are returned as 1-character strings, and " @@ -622,7 +714,7 @@ msgid "" "name such as ``KEY_UP`` or ``^G``." msgstr "" -#: howto/curses.rst:447 +#: howto/curses.rst:445 msgid "" "It's possible to not wait for the user using the :meth:`~curses.window." "nodelay` window method. After ``nodelay(True)``, :meth:`!getch` and :meth:`!" @@ -634,7 +726,7 @@ msgid "" "tenths of a second), curses raises an exception." msgstr "" -#: howto/curses.rst:457 +#: howto/curses.rst:455 msgid "" "The :meth:`!getch` method returns an integer; if it's between 0 and 255, it " "represents the ASCII code of the key pressed. Values greater than 255 are " @@ -644,7 +736,19 @@ msgid "" "program may look something like this::" msgstr "" -#: howto/curses.rst:473 +#: howto/curses.rst:462 +msgid "" +"while True:\n" +" c = stdscr.getch()\n" +" if c == ord('p'):\n" +" PrintDocument()\n" +" elif c == ord('q'):\n" +" break # Exit the while loop\n" +" elif c == curses.KEY_HOME:\n" +" x = y = 0" +msgstr "" + +#: howto/curses.rst:471 msgid "" "The :mod:`curses.ascii` module supplies ASCII class membership functions " "that take either integer or 1-character string arguments; these may be " @@ -654,7 +758,7 @@ msgid "" "returns the control character corresponding to its argument." msgstr "" -#: howto/curses.rst:480 +#: howto/curses.rst:478 msgid "" "There's also a method to retrieve an entire string, :meth:`~curses.window." "getstr`. It isn't used very often, because its functionality is quite " @@ -663,7 +767,15 @@ msgid "" "number of characters. ::" msgstr "" -#: howto/curses.rst:491 +#: howto/curses.rst:484 +msgid "" +"curses.echo() # Enable echoing of characters\n" +"\n" +"# Get a 15-character string, with the cursor on the top line\n" +"s = stdscr.getstr(0,0, 15)" +msgstr "" + +#: howto/curses.rst:489 msgid "" "The :mod:`curses.textpad` module supplies a text box that supports an Emacs-" "like set of keybindings. Various methods of the :class:`~curses.textpad." @@ -671,16 +783,37 @@ msgid "" "results either with or without trailing spaces. Here's an example::" msgstr "" -#: howto/curses.rst:515 +#: howto/curses.rst:495 +msgid "" +"import curses\n" +"from curses.textpad import Textbox, rectangle\n" +"\n" +"def main(stdscr):\n" +" stdscr.addstr(0, 0, \"Enter IM message: (hit Ctrl-G to send)\")\n" +"\n" +" editwin = curses.newwin(5,30, 2,1)\n" +" rectangle(stdscr, 1,0, 1+5+1, 1+30+1)\n" +" stdscr.refresh()\n" +"\n" +" box = Textbox(editwin)\n" +"\n" +" # Let the user edit until Ctrl-G is struck.\n" +" box.edit()\n" +"\n" +" # Get resulting contents\n" +" message = box.gather()" +msgstr "" + +#: howto/curses.rst:513 msgid "" "See the library documentation on :mod:`curses.textpad` for more details." msgstr "" -#: howto/curses.rst:519 +#: howto/curses.rst:517 msgid "For More Information" msgstr "" -#: howto/curses.rst:521 +#: howto/curses.rst:519 msgid "" "This HOWTO doesn't cover some advanced topics, such as reading the contents " "of the screen or capturing mouse events from an xterm instance, but the " @@ -688,7 +821,7 @@ msgid "" "complete. You should browse it next." msgstr "" -#: howto/curses.rst:526 +#: howto/curses.rst:524 msgid "" "If you're in doubt about the detailed behavior of the curses functions, " "consult the manual pages for your curses implementation, whether it's " @@ -697,7 +830,7 @@ msgid "" "ref:`ACS_\\* ` characters available to you." msgstr "" -#: howto/curses.rst:533 +#: howto/curses.rst:531 msgid "" "Because the curses API is so large, some functions aren't supported in the " "Python interface. Often this isn't because they're difficult to implement, " @@ -707,29 +840,29 @@ msgid "" "org/>`_ to learn more about submitting patches to Python." msgstr "" -#: howto/curses.rst:541 +#: howto/curses.rst:539 msgid "" "`Writing Programs with NCURSES `_: a lengthy tutorial for C programmers." msgstr "" -#: howto/curses.rst:543 +#: howto/curses.rst:541 msgid "`The ncurses man page `_" msgstr "" -#: howto/curses.rst:544 +#: howto/curses.rst:542 msgid "" "`The ncurses FAQ `_" msgstr "" -#: howto/curses.rst:545 +#: howto/curses.rst:543 msgid "" "`\"Use curses... don't swear\" `_: video of a PyCon 2013 talk on controlling terminals using " "curses or Urwid." msgstr "" -#: howto/curses.rst:547 +#: howto/curses.rst:545 msgid "" "`\"Console Applications with Urwid\" `_: video of a PyCon CA 2012 talk demonstrating some " diff --git a/howto/descriptor.po b/howto/descriptor.po index e9ebf34f..7b32d6f3 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -93,8 +94,15 @@ msgstr "" #: howto/descriptor.rst:45 msgid "" -"The :class:`Ten` class is a descriptor whose :meth:`__get__` method always " -"returns the constant ``10``:" +"The :class:`!Ten` class is a descriptor whose :meth:`~object.__get__` method " +"always returns the constant ``10``:" +msgstr "" + +#: howto/descriptor.rst:48 +msgid "" +"class Ten:\n" +" def __get__(self, obj, objtype=None):\n" +" return 10" msgstr "" #: howto/descriptor.rst:54 @@ -103,12 +111,28 @@ msgid "" "class:" msgstr "" +#: howto/descriptor.rst:56 +msgid "" +"class A:\n" +" x = 5 # Regular class attribute\n" +" y = Ten() # Descriptor instance" +msgstr "" + #: howto/descriptor.rst:62 msgid "" "An interactive session shows the difference between normal attribute lookup " "and descriptor lookup:" msgstr "" +#: howto/descriptor.rst:65 +msgid "" +">>> a = A() # Make an instance of class A\n" +">>> a.x # Normal attribute lookup\n" +"5\n" +">>> a.y # Descriptor lookup\n" +"10" +msgstr "" + #: howto/descriptor.rst:73 msgid "" "In the ``a.x`` attribute lookup, the dot operator finds ``'x': 5`` in the " @@ -144,20 +168,53 @@ msgid "" "constants:" msgstr "" +#: howto/descriptor.rst:93 +msgid "" +"import os\n" +"\n" +"class DirectorySize:\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" return len(os.listdir(obj.dirname))\n" +"\n" +"class Directory:\n" +"\n" +" size = DirectorySize() # Descriptor instance\n" +"\n" +" def __init__(self, dirname):\n" +" self.dirname = dirname # Regular instance attribute" +msgstr "" + #: howto/descriptor.rst:109 msgid "" "An interactive session shows that the lookup is dynamic — it computes " "different, updated answers each time::" msgstr "" +#: howto/descriptor.rst:112 +msgid "" +">>> s = Directory('songs')\n" +">>> g = Directory('games')\n" +">>> s.size # The songs directory has twenty " +"files\n" +"20\n" +">>> g.size # The games directory has three " +"files\n" +"3\n" +">>> os.remove('games/chess') # Delete a game\n" +">>> g.size # File count is automatically " +"updated\n" +"2" +msgstr "" + #: howto/descriptor.rst:122 msgid "" "Besides showing how descriptors can run computations, this example also " -"reveals the purpose of the parameters to :meth:`__get__`. The *self* " -"parameter is *size*, an instance of *DirectorySize*. The *obj* parameter is " -"either *g* or *s*, an instance of *Directory*. It is the *obj* parameter " -"that lets the :meth:`__get__` method learn the target directory. The " -"*objtype* parameter is the class *Directory*." +"reveals the purpose of the parameters to :meth:`~object.__get__`. The " +"*self* parameter is *size*, an instance of *DirectorySize*. The *obj* " +"parameter is either *g* or *s*, an instance of *Directory*. It is the *obj* " +"parameter that lets the :meth:`~object.__get__` method learn the target " +"directory. The *objtype* parameter is the class *Directory*." msgstr "" #: howto/descriptor.rst:131 @@ -169,8 +226,8 @@ msgid "" "A popular use for descriptors is managing access to instance data. The " "descriptor is assigned to a public attribute in the class dictionary while " "the actual data is stored as a private attribute in the instance " -"dictionary. The descriptor's :meth:`__get__` and :meth:`__set__` methods " -"are triggered when the public attribute is accessed." +"dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." +"__set__` methods are triggered when the public attribute is accessed." msgstr "" #: howto/descriptor.rst:139 @@ -180,12 +237,71 @@ msgid "" "logs the lookup or update:" msgstr "" +#: howto/descriptor.rst:143 +msgid "" +"import logging\n" +"\n" +"logging.basicConfig(level=logging.INFO)\n" +"\n" +"class LoggedAgeAccess:\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" value = obj._age\n" +" logging.info('Accessing %r giving %r', 'age', value)\n" +" return value\n" +"\n" +" def __set__(self, obj, value):\n" +" logging.info('Updating %r to %r', 'age', value)\n" +" obj._age = value\n" +"\n" +"class Person:\n" +"\n" +" age = LoggedAgeAccess() # Descriptor instance\n" +"\n" +" def __init__(self, name, age):\n" +" self.name = name # Regular instance attribute\n" +" self.age = age # Calls __set__()\n" +"\n" +" def birthday(self):\n" +" self.age += 1 # Calls both __get__() and __set__()" +msgstr "" + #: howto/descriptor.rst:172 msgid "" "An interactive session shows that all access to the managed attribute *age* " "is logged, but that the regular attribute *name* is not logged:" msgstr "" +#: howto/descriptor.rst:181 +msgid "" +">>> mary = Person('Mary M', 30) # The initial age update is logged\n" +"INFO:root:Updating 'age' to 30\n" +">>> dave = Person('David D', 40)\n" +"INFO:root:Updating 'age' to 40\n" +"\n" +">>> vars(mary) # The actual data is in a private " +"attribute\n" +"{'name': 'Mary M', '_age': 30}\n" +">>> vars(dave)\n" +"{'name': 'David D', '_age': 40}\n" +"\n" +">>> mary.age # Access the data and log the " +"lookup\n" +"INFO:root:Accessing 'age' giving 30\n" +"30\n" +">>> mary.birthday() # Updates are logged as well\n" +"INFO:root:Accessing 'age' giving 30\n" +"INFO:root:Updating 'age' to 31\n" +"\n" +">>> dave.name # Regular attribute lookup isn't " +"logged\n" +"'David D'\n" +">>> dave.age # Only the managed attribute is " +"logged\n" +"INFO:root:Accessing 'age' giving 40\n" +"40" +msgstr "" + #: howto/descriptor.rst:206 msgid "" "One major issue with this example is that the private name *_age* is " @@ -206,44 +322,104 @@ msgstr "" #: howto/descriptor.rst:218 msgid "" -"In this example, the :class:`Person` class has two descriptor instances, " -"*name* and *age*. When the :class:`Person` class is defined, it makes a " -"callback to :meth:`__set_name__` in *LoggedAccess* so that the field names " -"can be recorded, giving each descriptor its own *public_name* and " +"In this example, the :class:`!Person` class has two descriptor instances, " +"*name* and *age*. When the :class:`!Person` class is defined, it makes a " +"callback to :meth:`~object.__set_name__` in *LoggedAccess* so that the field " +"names can be recorded, giving each descriptor its own *public_name* and " "*private_name*:" msgstr "" +#: howto/descriptor.rst:223 +msgid "" +"import logging\n" +"\n" +"logging.basicConfig(level=logging.INFO)\n" +"\n" +"class LoggedAccess:\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self.public_name = name\n" +" self.private_name = '_' + name\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" value = getattr(obj, self.private_name)\n" +" logging.info('Accessing %r giving %r', self.public_name, value)\n" +" return value\n" +"\n" +" def __set__(self, obj, value):\n" +" logging.info('Updating %r to %r', self.public_name, value)\n" +" setattr(obj, self.private_name, value)\n" +"\n" +"class Person:\n" +"\n" +" name = LoggedAccess() # First descriptor instance\n" +" age = LoggedAccess() # Second descriptor instance\n" +"\n" +" def __init__(self, name, age):\n" +" self.name = name # Calls the first descriptor\n" +" self.age = age # Calls the second descriptor\n" +"\n" +" def birthday(self):\n" +" self.age += 1" +msgstr "" + #: howto/descriptor.rst:256 msgid "" -"An interactive session shows that the :class:`Person` class has called :meth:" -"`__set_name__` so that the field names would be recorded. Here we call :" -"func:`vars` to look up the descriptor without triggering it:" +"An interactive session shows that the :class:`!Person` class has called :" +"meth:`~object.__set_name__` so that the field names would be recorded. Here " +"we call :func:`vars` to look up the descriptor without triggering it:" +msgstr "" + +#: howto/descriptor.rst:260 +msgid "" +">>> vars(vars(Person)['name'])\n" +"{'public_name': 'name', 'private_name': '_name'}\n" +">>> vars(vars(Person)['age'])\n" +"{'public_name': 'age', 'private_name': '_age'}" msgstr "" #: howto/descriptor.rst:267 msgid "The new class now logs access to both *name* and *age*:" msgstr "" +#: howto/descriptor.rst:275 +msgid "" +">>> pete = Person('Peter P', 10)\n" +"INFO:root:Updating 'name' to 'Peter P'\n" +"INFO:root:Updating 'age' to 10\n" +">>> kate = Person('Catherine C', 20)\n" +"INFO:root:Updating 'name' to 'Catherine C'\n" +"INFO:root:Updating 'age' to 20" +msgstr "" + #: howto/descriptor.rst:284 msgid "The two *Person* instances contain only the private names:" msgstr "" +#: howto/descriptor.rst:286 +msgid "" +">>> vars(pete)\n" +"{'_name': 'Peter P', '_age': 10}\n" +">>> vars(kate)\n" +"{'_name': 'Catherine C', '_age': 20}" +msgstr "" + #: howto/descriptor.rst:295 msgid "Closing thoughts" msgstr "" #: howto/descriptor.rst:297 msgid "" -"A :term:`descriptor` is what we call any object that defines :meth:" -"`__get__`, :meth:`__set__`, or :meth:`__delete__`." +"A :term:`descriptor` is what we call any object that defines :meth:`~object." +"__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." msgstr "" #: howto/descriptor.rst:300 msgid "" -"Optionally, descriptors can have a :meth:`__set_name__` method. This is " -"only used in cases where a descriptor needs to know either the class where " -"it was created or the name of class variable it was assigned to. (This " -"method, if present, is called even if the class is not a descriptor.)" +"Optionally, descriptors can have a :meth:`~object.__set_name__` method. " +"This is only used in cases where a descriptor needs to know either the class " +"where it was created or the name of class variable it was assigned to. " +"(This method, if present, is called even if the class is not a descriptor.)" msgstr "" #: howto/descriptor.rst:305 @@ -304,14 +480,35 @@ msgstr "" #: howto/descriptor.rst:340 msgid "" -"This :class:`Validator` class is both an :term:`abstract base class` and a " +"This :class:`!Validator` class is both an :term:`abstract base class` and a " "managed attribute descriptor:" msgstr "" +#: howto/descriptor.rst:343 +msgid "" +"from abc import ABC, abstractmethod\n" +"\n" +"class Validator(ABC):\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self.private_name = '_' + name\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" return getattr(obj, self.private_name)\n" +"\n" +" def __set__(self, obj, value):\n" +" self.validate(value)\n" +" setattr(obj, self.private_name, value)\n" +"\n" +" @abstractmethod\n" +" def validate(self, value):\n" +" pass" +msgstr "" + #: howto/descriptor.rst:363 msgid "" -"Custom validators need to inherit from :class:`Validator` and must supply a :" -"meth:`validate` method to test various restrictions as needed." +"Custom validators need to inherit from :class:`!Validator` and must supply " +"a :meth:`!validate` method to test various restrictions as needed." msgstr "" #: howto/descriptor.rst:368 @@ -324,75 +521,172 @@ msgstr "" #: howto/descriptor.rst:372 msgid "" -":class:`OneOf` verifies that a value is one of a restricted set of options." +":class:`!OneOf` verifies that a value is one of a restricted set of options." msgstr "" #: howto/descriptor.rst:374 msgid "" -":class:`Number` verifies that a value is either an :class:`int` or :class:" +":class:`!Number` verifies that a value is either an :class:`int` or :class:" "`float`. Optionally, it verifies that a value is between a given minimum or " "maximum." msgstr "" #: howto/descriptor.rst:378 msgid "" -":class:`String` verifies that a value is a :class:`str`. Optionally, it " +":class:`!String` verifies that a value is a :class:`str`. Optionally, it " "validates a given minimum or maximum length. It can validate a user-defined " "`predicate `_ " "as well." msgstr "" -#: howto/descriptor.rst:437 -msgid "Practical application" +#: howto/descriptor.rst:383 +msgid "" +"class OneOf(Validator):\n" +"\n" +" def __init__(self, *options):\n" +" self.options = set(options)\n" +"\n" +" def validate(self, value):\n" +" if value not in self.options:\n" +" raise ValueError(\n" +" f'Expected {value!r} to be one of {self.options!r}'\n" +" )\n" +"\n" +"class Number(Validator):\n" +"\n" +" def __init__(self, minvalue=None, maxvalue=None):\n" +" self.minvalue = minvalue\n" +" self.maxvalue = maxvalue\n" +"\n" +" def validate(self, value):\n" +" if not isinstance(value, (int, float)):\n" +" raise TypeError(f'Expected {value!r} to be an int or float')\n" +" if self.minvalue is not None and value < self.minvalue:\n" +" raise ValueError(\n" +" f'Expected {value!r} to be at least {self.minvalue!r}'\n" +" )\n" +" if self.maxvalue is not None and value > self.maxvalue:\n" +" raise ValueError(\n" +" f'Expected {value!r} to be no more than {self.maxvalue!r}'\n" +" )\n" +"\n" +"class String(Validator):\n" +"\n" +" def __init__(self, minsize=None, maxsize=None, predicate=None):\n" +" self.minsize = minsize\n" +" self.maxsize = maxsize\n" +" self.predicate = predicate\n" +"\n" +" def validate(self, value):\n" +" if not isinstance(value, str):\n" +" raise TypeError(f'Expected {value!r} to be a str')\n" +" if self.minsize is not None and len(value) < self.minsize:\n" +" raise ValueError(\n" +" f'Expected {value!r} to be no smaller than {self.minsize!" +"r}'\n" +" )\n" +" if self.maxsize is not None and len(value) > self.maxsize:\n" +" raise ValueError(\n" +" f'Expected {value!r} to be no bigger than {self.maxsize!r}'\n" +" )\n" +" if self.predicate is not None and not self.predicate(value):\n" +" raise ValueError(\n" +" f'Expected {self.predicate} to be true for {value!r}'\n" +" )" msgstr "" #: howto/descriptor.rst:439 +msgid "Practical application" +msgstr "" + +#: howto/descriptor.rst:441 msgid "Here's how the data validators can be used in a real class:" msgstr "" -#: howto/descriptor.rst:454 +#: howto/descriptor.rst:443 +msgid "" +"class Component:\n" +"\n" +" name = String(minsize=3, maxsize=10, predicate=str.isupper)\n" +" kind = OneOf('wood', 'metal', 'plastic')\n" +" quantity = Number(minvalue=0)\n" +"\n" +" def __init__(self, name, kind, quantity):\n" +" self.name = name\n" +" self.kind = kind\n" +" self.quantity = quantity" +msgstr "" + +#: howto/descriptor.rst:456 msgid "The descriptors prevent invalid instances from being created:" msgstr "" -#: howto/descriptor.rst:481 +#: howto/descriptor.rst:458 +msgid "" +">>> Component('Widget', 'metal', 5) # Blocked: 'Widget' is not all " +"uppercase\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: Expected to be true for " +"'Widget'\n" +"\n" +">>> Component('WIDGET', 'metle', 5) # Blocked: 'metle' is misspelled\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: Expected 'metle' to be one of {'metal', 'plastic', 'wood'}\n" +"\n" +">>> Component('WIDGET', 'metal', -5) # Blocked: -5 is negative\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: Expected -5 to be at least 0\n" +"\n" +">>> Component('WIDGET', 'metal', 'V') # Blocked: 'V' isn't a number\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: Expected 'V' to be an int or float\n" +"\n" +">>> c = Component('WIDGET', 'metal', 5) # Allowed: The inputs are valid" +msgstr "" + +#: howto/descriptor.rst:484 msgid "Technical Tutorial" msgstr "" -#: howto/descriptor.rst:483 +#: howto/descriptor.rst:486 msgid "" "What follows is a more technical tutorial for the mechanics and details of " "how descriptors work." msgstr "" -#: howto/descriptor.rst:488 +#: howto/descriptor.rst:491 msgid "Abstract" msgstr "" -#: howto/descriptor.rst:490 +#: howto/descriptor.rst:493 msgid "" "Defines descriptors, summarizes the protocol, and shows how descriptors are " "called. Provides an example showing how object relational mappings work." msgstr "" -#: howto/descriptor.rst:493 +#: howto/descriptor.rst:496 msgid "" "Learning about descriptors not only provides access to a larger toolset, it " "creates a deeper understanding of how Python works." msgstr "" -#: howto/descriptor.rst:498 +#: howto/descriptor.rst:501 msgid "Definition and introduction" msgstr "" -#: howto/descriptor.rst:500 +#: howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " -"in the descriptor protocol. Those methods are :meth:`__get__`, :meth:" -"`__set__`, and :meth:`__delete__`. If any of those methods are defined for " -"an attribute, it is said to be a :term:`descriptor`." +"in the descriptor protocol. Those methods are :meth:`~object.__get__`, :" +"meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those " +"methods are defined for an attribute, it is said to be a :term:`descriptor`." msgstr "" -#: howto/descriptor.rst:505 +#: howto/descriptor.rst:508 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -404,47 +698,47 @@ msgid "" "methods were defined." msgstr "" -#: howto/descriptor.rst:514 +#: howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " "mechanism behind properties, methods, static methods, class methods, and :" -"func:`super()`. They are used throughout Python itself. Descriptors " -"simplify the underlying C code and offer a flexible set of new tools for " -"everyday Python programs." +"func:`super`. They are used throughout Python itself. Descriptors simplify " +"the underlying C code and offer a flexible set of new tools for everyday " +"Python programs." msgstr "" -#: howto/descriptor.rst:522 +#: howto/descriptor.rst:525 msgid "Descriptor protocol" msgstr "" -#: howto/descriptor.rst:524 +#: howto/descriptor.rst:527 msgid "``descr.__get__(self, obj, type=None)``" msgstr "" -#: howto/descriptor.rst:526 +#: howto/descriptor.rst:529 msgid "``descr.__set__(self, obj, value)``" msgstr "" -#: howto/descriptor.rst:528 +#: howto/descriptor.rst:531 msgid "``descr.__delete__(self, obj)``" msgstr "" -#: howto/descriptor.rst:530 +#: howto/descriptor.rst:533 msgid "" "That is all there is to it. Define any of these methods and an object is " "considered a descriptor and can override default behavior upon being looked " "up as an attribute." msgstr "" -#: howto/descriptor.rst:534 +#: howto/descriptor.rst:537 msgid "" -"If an object defines :meth:`__set__` or :meth:`__delete__`, it is considered " -"a data descriptor. Descriptors that only define :meth:`__get__` are called " -"non-data descriptors (they are often used for methods but other uses are " -"possible)." +"If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " +"it is considered a data descriptor. Descriptors that only define :meth:" +"`~object.__get__` are called non-data descriptors (they are often used for " +"methods but other uses are possible)." msgstr "" -#: howto/descriptor.rst:539 +#: howto/descriptor.rst:542 msgid "" "Data and non-data descriptors differ in how overrides are calculated with " "respect to entries in an instance's dictionary. If an instance's dictionary " @@ -453,116 +747,158 @@ msgid "" "name as a non-data descriptor, the dictionary entry takes precedence." msgstr "" -#: howto/descriptor.rst:545 +#: howto/descriptor.rst:548 msgid "" -"To make a read-only data descriptor, define both :meth:`__get__` and :meth:" -"`__set__` with the :meth:`__set__` raising an :exc:`AttributeError` when " -"called. Defining the :meth:`__set__` method with an exception raising " -"placeholder is enough to make it a data descriptor." +"To make a read-only data descriptor, define both :meth:`~object.__get__` " +"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:" +"`AttributeError` when called. Defining the :meth:`~object.__set__` method " +"with an exception raising placeholder is enough to make it a data descriptor." msgstr "" -#: howto/descriptor.rst:552 +#: howto/descriptor.rst:555 msgid "Overview of descriptor invocation" msgstr "" -#: howto/descriptor.rst:554 +#: howto/descriptor.rst:557 msgid "" "A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." "__get__(None, cls)``." msgstr "" -#: howto/descriptor.rst:557 +#: howto/descriptor.rst:560 msgid "" "But it is more common for a descriptor to be invoked automatically from " "attribute access." msgstr "" -#: howto/descriptor.rst:560 +#: howto/descriptor.rst:563 msgid "" "The expression ``obj.x`` looks up the attribute ``x`` in the chain of " "namespaces for ``obj``. If the search finds a descriptor outside of the " -"instance ``__dict__``, its :meth:`__get__` method is invoked according to " -"the precedence rules listed below." +"instance :attr:`~object.__dict__`, its :meth:`~object.__get__` method is " +"invoked according to the precedence rules listed below." msgstr "" -#: howto/descriptor.rst:565 +#: howto/descriptor.rst:568 msgid "" "The details of invocation depend on whether ``obj`` is an object, class, or " "instance of super." msgstr "" -#: howto/descriptor.rst:570 +#: howto/descriptor.rst:573 msgid "Invocation from an instance" msgstr "" -#: howto/descriptor.rst:572 +#: howto/descriptor.rst:575 msgid "" "Instance lookup scans through a chain of namespaces giving data descriptors " "the highest priority, followed by instance variables, then non-data " -"descriptors, then class variables, and lastly :meth:`__getattr__` if it is " -"provided." +"descriptors, then class variables, and lastly :meth:`~object.__getattr__` if " +"it is provided." msgstr "" -#: howto/descriptor.rst:577 +#: howto/descriptor.rst:580 msgid "" "If a descriptor is found for ``a.x``, then it is invoked with: ``desc." "__get__(a, type(a))``." msgstr "" -#: howto/descriptor.rst:580 +#: howto/descriptor.rst:583 msgid "" "The logic for a dotted lookup is in :meth:`object.__getattribute__`. Here " "is a pure Python equivalent:" msgstr "" -#: howto/descriptor.rst:719 +#: howto/descriptor.rst:586 +msgid "" +"def find_name_in_mro(cls, name, default):\n" +" \"Emulate _PyType_Lookup() in Objects/typeobject.c\"\n" +" for base in cls.__mro__:\n" +" if name in vars(base):\n" +" return vars(base)[name]\n" +" return default\n" +"\n" +"def object_getattribute(obj, name):\n" +" \"Emulate PyObject_GenericGetAttr() in Objects/object.c\"\n" +" null = object()\n" +" objtype = type(obj)\n" +" cls_var = find_name_in_mro(objtype, name, null)\n" +" descr_get = getattr(type(cls_var), '__get__', null)\n" +" if descr_get is not null:\n" +" if (hasattr(type(cls_var), '__set__')\n" +" or hasattr(type(cls_var), '__delete__')):\n" +" return descr_get(cls_var, obj, objtype) # data descriptor\n" +" if hasattr(obj, '__dict__') and name in vars(obj):\n" +" return vars(obj)[name] # instance variable\n" +" if descr_get is not null:\n" +" return descr_get(cls_var, obj, objtype) # non-data " +"descriptor\n" +" if cls_var is not null:\n" +" return cls_var # class variable\n" +" raise AttributeError(name)" +msgstr "" + +#: howto/descriptor.rst:722 +msgid "" +"Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object." +"__getattribute__` code. That is why calling :meth:`~object." +"__getattribute__` directly or with ``super().__getattribute__`` will bypass :" +"meth:`~object.__getattr__` entirely." +msgstr "" + +#: howto/descriptor.rst:726 msgid "" -"Note, there is no :meth:`__getattr__` hook in the :meth:`__getattribute__` " -"code. That is why calling :meth:`__getattribute__` directly or with " -"``super().__getattribute__`` will bypass :meth:`__getattr__` entirely." +"Instead, it is the dot operator and the :func:`getattr` function that are " +"responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object." +"__getattribute__` raises an :exc:`AttributeError`. Their logic is " +"encapsulated in a helper function:" msgstr "" -#: howto/descriptor.rst:723 +#: howto/descriptor.rst:731 msgid "" -"Instead, it is the dot operator and the :func:`getattr` function that are " -"responsible for invoking :meth:`__getattr__` whenever :meth:" -"`__getattribute__` raises an :exc:`AttributeError`. Their logic is " -"encapsulated in a helper function:" +"def getattr_hook(obj, name):\n" +" \"Emulate slot_tp_getattr_hook() in Objects/typeobject.c\"\n" +" try:\n" +" return obj.__getattribute__(name)\n" +" except AttributeError:\n" +" if not hasattr(type(obj), '__getattr__'):\n" +" raise\n" +" return type(obj).__getattr__(obj, name) # __getattr__" msgstr "" -#: howto/descriptor.rst:773 +#: howto/descriptor.rst:776 msgid "Invocation from a class" msgstr "" -#: howto/descriptor.rst:775 +#: howto/descriptor.rst:778 msgid "" -"The logic for a dotted lookup such as ``A.x`` is in :meth:`type." -"__getattribute__`. The steps are similar to those for :meth:`object." +"The logic for a dotted lookup such as ``A.x`` is in :meth:`!type." +"__getattribute__`. The steps are similar to those for :meth:`!object." "__getattribute__` but the instance dictionary lookup is replaced by a search " "through the class's :term:`method resolution order`." msgstr "" -#: howto/descriptor.rst:780 +#: howto/descriptor.rst:783 msgid "If a descriptor is found, it is invoked with ``desc.__get__(None, A)``." msgstr "" -#: howto/descriptor.rst:782 +#: howto/descriptor.rst:785 msgid "" "The full C implementation can be found in :c:func:`!type_getattro` and :c:" "func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" -#: howto/descriptor.rst:787 +#: howto/descriptor.rst:790 msgid "Invocation from super" msgstr "" -#: howto/descriptor.rst:789 +#: howto/descriptor.rst:792 msgid "" -"The logic for super's dotted lookup is in the :meth:`__getattribute__` " -"method for object returned by :class:`super()`." +"The logic for super's dotted lookup is in the :meth:`~object." +"__getattribute__` method for object returned by :func:`super`." msgstr "" -#: howto/descriptor.rst:792 +#: howto/descriptor.rst:795 msgid "" "A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." "__mro__`` for the base class ``B`` immediately following ``A`` and then " @@ -570,7 +906,7 @@ msgid "" "returned unchanged." msgstr "" -#: howto/descriptor.rst:797 +#: howto/descriptor.rst:800 msgid "" "The full C implementation can be found in :c:func:`!super_getattro` in :" "source:`Objects/typeobject.c`. A pure Python equivalent can be found in " @@ -578,119 +914,182 @@ msgid "" "#cooperation>`_." msgstr "" -#: howto/descriptor.rst:804 +#: howto/descriptor.rst:807 msgid "Summary of invocation logic" msgstr "" -#: howto/descriptor.rst:806 +#: howto/descriptor.rst:809 msgid "" -"The mechanism for descriptors is embedded in the :meth:`__getattribute__()` " -"methods for :class:`object`, :class:`type`, and :func:`super`." +"The mechanism for descriptors is embedded in the :meth:`~object." +"__getattribute__` methods for :class:`object`, :class:`type`, and :func:" +"`super`." msgstr "" -#: howto/descriptor.rst:809 +#: howto/descriptor.rst:812 msgid "The important points to remember are:" msgstr "" -#: howto/descriptor.rst:811 -msgid "Descriptors are invoked by the :meth:`__getattribute__` method." +#: howto/descriptor.rst:814 +msgid "Descriptors are invoked by the :meth:`~object.__getattribute__` method." msgstr "" -#: howto/descriptor.rst:813 +#: howto/descriptor.rst:816 msgid "" "Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" "`super`." msgstr "" -#: howto/descriptor.rst:816 +#: howto/descriptor.rst:819 msgid "" -"Overriding :meth:`__getattribute__` prevents automatic descriptor calls " -"because all the descriptor logic is in that method." +"Overriding :meth:`~object.__getattribute__` prevents automatic descriptor " +"calls because all the descriptor logic is in that method." msgstr "" -#: howto/descriptor.rst:819 +#: howto/descriptor.rst:822 msgid "" -":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make " -"different calls to :meth:`__get__`. The first includes the instance and may " -"include the class. The second puts in ``None`` for the instance and always " -"includes the class." +":meth:`!object.__getattribute__` and :meth:`!type.__getattribute__` make " +"different calls to :meth:`~object.__get__`. The first includes the instance " +"and may include the class. The second puts in ``None`` for the instance and " +"always includes the class." msgstr "" -#: howto/descriptor.rst:824 +#: howto/descriptor.rst:827 msgid "Data descriptors always override instance dictionaries." msgstr "" -#: howto/descriptor.rst:826 +#: howto/descriptor.rst:829 msgid "Non-data descriptors may be overridden by instance dictionaries." msgstr "" -#: howto/descriptor.rst:830 +#: howto/descriptor.rst:833 msgid "Automatic name notification" msgstr "" -#: howto/descriptor.rst:832 +#: howto/descriptor.rst:835 msgid "" "Sometimes it is desirable for a descriptor to know what class variable name " "it was assigned to. When a new class is created, the :class:`type` " "metaclass scans the dictionary of the new class. If any of the entries are " -"descriptors and if they define :meth:`__set_name__`, that method is called " -"with two arguments. The *owner* is the class where the descriptor is used, " -"and the *name* is the class variable the descriptor was assigned to." +"descriptors and if they define :meth:`~object.__set_name__`, that method is " +"called with two arguments. The *owner* is the class where the descriptor is " +"used, and the *name* is the class variable the descriptor was assigned to." msgstr "" -#: howto/descriptor.rst:839 +#: howto/descriptor.rst:842 msgid "" "The implementation details are in :c:func:`!type_new` and :c:func:`!" "set_names` in :source:`Objects/typeobject.c`." msgstr "" -#: howto/descriptor.rst:842 +#: howto/descriptor.rst:845 msgid "" -"Since the update logic is in :meth:`type.__new__`, notifications only take " +"Since the update logic is in :meth:`!type.__new__`, notifications only take " "place at the time of class creation. If descriptors are added to the class " -"afterwards, :meth:`__set_name__` will need to be called manually." +"afterwards, :meth:`~object.__set_name__` will need to be called manually." msgstr "" -#: howto/descriptor.rst:848 +#: howto/descriptor.rst:851 msgid "ORM example" msgstr "" -#: howto/descriptor.rst:850 +#: howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " "could be used to implement an `object relational mapping `_." msgstr "" -#: howto/descriptor.rst:854 +#: howto/descriptor.rst:857 msgid "" "The essential idea is that the data is stored in an external database. The " "Python instances only hold keys to the database's tables. Descriptors take " "care of lookups or updates:" msgstr "" -#: howto/descriptor.rst:873 +#: howto/descriptor.rst:861 msgid "" -"We can use the :class:`Field` class to define `models `_ that describe the schema for each table in a " "database:" msgstr "" -#: howto/descriptor.rst:898 +#: howto/descriptor.rst:880 +msgid "" +"class Movie:\n" +" table = 'Movies' # Table name\n" +" key = 'title' # Primary key\n" +" director = Field()\n" +" year = Field()\n" +"\n" +" def __init__(self, key):\n" +" self.key = key\n" +"\n" +"class Song:\n" +" table = 'Music'\n" +" key = 'title'\n" +" artist = Field()\n" +" year = Field()\n" +" genre = Field()\n" +"\n" +" def __init__(self, key):\n" +" self.key = key" +msgstr "" + +#: howto/descriptor.rst:901 msgid "To use the models, first connect to the database::" msgstr "" #: howto/descriptor.rst:903 msgid "" +">>> import sqlite3\n" +">>> conn = sqlite3.connect('entertainment.db')" +msgstr "" + +#: howto/descriptor.rst:906 +msgid "" "An interactive session shows how data is retrieved from the database and how " "it can be updated:" msgstr "" -#: howto/descriptor.rst:952 +#: howto/descriptor.rst:934 +msgid "" +">>> Movie('Star Wars').director\n" +"'George Lucas'\n" +">>> jaws = Movie('Jaws')\n" +">>> f'Released in {jaws.year} by {jaws.director}'\n" +"'Released in 1975 by Steven Spielberg'\n" +"\n" +">>> Song('Country Roads').artist\n" +"'John Denver'\n" +"\n" +">>> Movie('Star Wars').director = 'J.J. Abrams'\n" +">>> Movie('Star Wars').director\n" +"'J.J. Abrams'" +msgstr "" + +#: howto/descriptor.rst:955 msgid "Pure Python Equivalents" msgstr "" -#: howto/descriptor.rst:954 +#: howto/descriptor.rst:957 msgid "" "The descriptor protocol is simple and offers exciting possibilities. " "Several use cases are so common that they have been prepackaged into built-" @@ -698,36 +1097,93 @@ msgid "" "\\_\\_slots\\_\\_ are all based on the descriptor protocol." msgstr "" -#: howto/descriptor.rst:961 +#: howto/descriptor.rst:964 msgid "Properties" msgstr "" -#: howto/descriptor.rst:963 +#: howto/descriptor.rst:966 msgid "" "Calling :func:`property` is a succinct way of building a data descriptor " "that triggers a function call upon access to an attribute. Its signature " "is::" msgstr "" -#: howto/descriptor.rst:968 +#: howto/descriptor.rst:969 +msgid "property(fget=None, fset=None, fdel=None, doc=None) -> property" +msgstr "" + +#: howto/descriptor.rst:971 msgid "" "The documentation shows a typical use to define a managed attribute ``x``:" msgstr "" -#: howto/descriptor.rst:992 +#: howto/descriptor.rst:973 msgid "" -"To see how :func:`property` is implemented in terms of the descriptor " -"protocol, here is a pure Python equivalent:" +"class C:\n" +" def getx(self): return self.__x\n" +" def setx(self, value): self.__x = value\n" +" def delx(self): del self.__x\n" +" x = property(getx, setx, delx, \"I'm the 'x' property.\")" msgstr "" -#: howto/descriptor.rst:1132 +#: howto/descriptor.rst:995 +msgid "" +"To see how :func:`property` is implemented in terms of the descriptor " +"protocol, here is a pure Python equivalent that implements most of the core " +"functionality:" +msgstr "" + +#: howto/descriptor.rst:998 +msgid "" +"class Property:\n" +" \"Emulate PyProperty_Type() in Objects/descrobject.c\"\n" +"\n" +" def __init__(self, fget=None, fset=None, fdel=None, doc=None):\n" +" self.fget = fget\n" +" self.fset = fset\n" +" self.fdel = fdel\n" +" if doc is None and fget is not None:\n" +" doc = fget.__doc__\n" +" self.__doc__ = doc\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self.__name__ = name\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" if obj is None:\n" +" return self\n" +" if self.fget is None:\n" +" raise AttributeError\n" +" return self.fget(obj)\n" +"\n" +" def __set__(self, obj, value):\n" +" if self.fset is None:\n" +" raise AttributeError\n" +" self.fset(obj, value)\n" +"\n" +" def __delete__(self, obj):\n" +" if self.fdel is None:\n" +" raise AttributeError\n" +" self.fdel(obj)\n" +"\n" +" def getter(self, fget):\n" +" return type(self)(fget, self.fset, self.fdel, self.__doc__)\n" +"\n" +" def setter(self, fset):\n" +" return type(self)(self.fget, fset, self.fdel, self.__doc__)\n" +"\n" +" def deleter(self, fdel):\n" +" return type(self)(self.fget, self.fset, fdel, self.__doc__)" +msgstr "" + +#: howto/descriptor.rst:1122 msgid "" "The :func:`property` builtin helps whenever a user interface has granted " "attribute access and then subsequent changes require the intervention of a " "method." msgstr "" -#: howto/descriptor.rst:1136 +#: howto/descriptor.rst:1126 msgid "" "For instance, a spreadsheet class may grant access to a cell value through " "``Cell('b10').value``. Subsequent improvements to the program require the " @@ -737,23 +1193,35 @@ msgid "" "descriptor:" msgstr "" -#: howto/descriptor.rst:1153 +#: howto/descriptor.rst:1132 msgid "" -"Either the built-in :func:`property` or our :func:`Property` equivalent " +"class Cell:\n" +" ...\n" +"\n" +" @property\n" +" def value(self):\n" +" \"Recalculate the cell before returning value\"\n" +" self.recalc()\n" +" return self._value" +msgstr "" + +#: howto/descriptor.rst:1143 +msgid "" +"Either the built-in :func:`property` or our :func:`!Property` equivalent " "would work in this example." msgstr "" -#: howto/descriptor.rst:1158 +#: howto/descriptor.rst:1148 msgid "Functions and methods" msgstr "" -#: howto/descriptor.rst:1160 +#: howto/descriptor.rst:1150 msgid "" "Python's object oriented features are built upon a function based " "environment. Using non-data descriptors, the two are merged seamlessly." msgstr "" -#: howto/descriptor.rst:1163 +#: howto/descriptor.rst:1153 msgid "" "Functions stored in class dictionaries get turned into methods when invoked. " "Methods only differ from regular functions in that the object instance is " @@ -761,128 +1229,214 @@ msgid "" "*self* but could be called *this* or any other variable name." msgstr "" -#: howto/descriptor.rst:1168 +#: howto/descriptor.rst:1158 msgid "" "Methods can be created manually with :class:`types.MethodType` which is " "roughly equivalent to:" msgstr "" -#: howto/descriptor.rst:1185 +#: howto/descriptor.rst:1161 +msgid "" +"class MethodType:\n" +" \"Emulate PyMethod_Type in Objects/classobject.c\"\n" +"\n" +" def __init__(self, func, obj):\n" +" self.__func__ = func\n" +" self.__self__ = obj\n" +"\n" +" def __call__(self, *args, **kwargs):\n" +" func = self.__func__\n" +" obj = self.__self__\n" +" return func(obj, *args, **kwargs)\n" +"\n" +" def __getattribute__(self, name):\n" +" \"Emulate method_getset() in Objects/classobject.c\"\n" +" if name == '__doc__':\n" +" return self.__func__.__doc__\n" +" return object.__getattribute__(self, name)\n" +"\n" +" def __getattr__(self, name):\n" +" \"Emulate method_getattro() in Objects/classobject.c\"\n" +" return getattr(self.__func__, name)\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" \"Emulate method_descr_get() in Objects/classobject.c\"\n" +" return self" +msgstr "" + +#: howto/descriptor.rst:1189 msgid "" "To support automatic creation of methods, functions include the :meth:" -"`__get__` method for binding methods during attribute access. This means " -"that functions are non-data descriptors that return bound methods during " -"dotted lookup from an instance. Here's how it works:" +"`~object.__get__` method for binding methods during attribute access. This " +"means that functions are non-data descriptors that return bound methods " +"during dotted lookup from an instance. Here's how it works:" msgstr "" -#: howto/descriptor.rst:1201 +#: howto/descriptor.rst:1194 +msgid "" +"class Function:\n" +" ...\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" \"Simulate func_descr_get() in Objects/funcobject.c\"\n" +" if obj is None:\n" +" return self\n" +" return MethodType(self, obj)" +msgstr "" + +#: howto/descriptor.rst:1205 msgid "" "Running the following class in the interpreter shows how the function " "descriptor works in practice:" msgstr "" -#: howto/descriptor.rst:1210 +#: howto/descriptor.rst:1208 +msgid "" +"class D:\n" +" def f(self):\n" +" return self\n" +"\n" +"class D2:\n" +" pass" +msgstr "" + +#: howto/descriptor.rst:1226 msgid "" "The function has a :term:`qualified name` attribute to support introspection:" msgstr "" -#: howto/descriptor.rst:1217 +#: howto/descriptor.rst:1228 +msgid "" +">>> D.f.__qualname__\n" +"'D.f'" +msgstr "" + +#: howto/descriptor.rst:1233 msgid "" "Accessing the function through the class dictionary does not invoke :meth:" -"`__get__`. Instead, it just returns the underlying function object::" +"`~object.__get__`. Instead, it just returns the underlying function object::" +msgstr "" + +#: howto/descriptor.rst:1236 +msgid "" +">>> D.__dict__['f']\n" +"" +msgstr "" + +#: howto/descriptor.rst:1239 +msgid "" +"Dotted access from a class calls :meth:`~object.__get__` which just returns " +"the underlying function unchanged::" msgstr "" -#: howto/descriptor.rst:1223 +#: howto/descriptor.rst:1242 msgid "" -"Dotted access from a class calls :meth:`__get__` which just returns the " -"underlying function unchanged::" +">>> D.f\n" +"" msgstr "" -#: howto/descriptor.rst:1229 +#: howto/descriptor.rst:1245 msgid "" "The interesting behavior occurs during dotted access from an instance. The " -"dotted lookup calls :meth:`__get__` which returns a bound method object::" +"dotted lookup calls :meth:`~object.__get__` which returns a bound method " +"object::" msgstr "" -#: howto/descriptor.rst:1236 +#: howto/descriptor.rst:1248 +msgid "" +">>> d = D()\n" +">>> d.f\n" +">" +msgstr "" + +#: howto/descriptor.rst:1252 msgid "" "Internally, the bound method stores the underlying function and the bound " "instance::" msgstr "" -#: howto/descriptor.rst:1245 +#: howto/descriptor.rst:1255 +msgid "" +">>> d.f.__func__\n" +"\n" +"\n" +">>> d.f.__self__\n" +"<__main__.D object at 0x00B18C90>" +msgstr "" + +#: howto/descriptor.rst:1261 msgid "" "If you have ever wondered where *self* comes from in regular methods or " "where *cls* comes from in class methods, this is it!" msgstr "" -#: howto/descriptor.rst:1250 +#: howto/descriptor.rst:1266 msgid "Kinds of methods" msgstr "" -#: howto/descriptor.rst:1252 +#: howto/descriptor.rst:1268 msgid "" "Non-data descriptors provide a simple mechanism for variations on the usual " "patterns of binding functions into methods." msgstr "" -#: howto/descriptor.rst:1255 +#: howto/descriptor.rst:1271 msgid "" -"To recap, functions have a :meth:`__get__` method so that they can be " -"converted to a method when accessed as attributes. The non-data descriptor " -"transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. Calling ``cls." -"f(*args)`` becomes ``f(*args)``." +"To recap, functions have a :meth:`~object.__get__` method so that they can " +"be converted to a method when accessed as attributes. The non-data " +"descriptor transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. " +"Calling ``cls.f(*args)`` becomes ``f(*args)``." msgstr "" -#: howto/descriptor.rst:1260 +#: howto/descriptor.rst:1276 msgid "This chart summarizes the binding and its two most useful variants:" msgstr "" -#: howto/descriptor.rst:1263 +#: howto/descriptor.rst:1279 msgid "Transformation" msgstr "" -#: howto/descriptor.rst:1263 +#: howto/descriptor.rst:1279 msgid "Called from an object" msgstr "" -#: howto/descriptor.rst:1263 +#: howto/descriptor.rst:1279 msgid "Called from a class" msgstr "" -#: howto/descriptor.rst:1266 +#: howto/descriptor.rst:1282 msgid "function" msgstr "" -#: howto/descriptor.rst:1266 +#: howto/descriptor.rst:1282 msgid "f(obj, \\*args)" msgstr "" -#: howto/descriptor.rst:1268 +#: howto/descriptor.rst:1284 msgid "f(\\*args)" msgstr "" -#: howto/descriptor.rst:1268 +#: howto/descriptor.rst:1284 msgid "staticmethod" msgstr "" -#: howto/descriptor.rst:1270 +#: howto/descriptor.rst:1286 msgid "classmethod" msgstr "" -#: howto/descriptor.rst:1270 +#: howto/descriptor.rst:1286 msgid "f(type(obj), \\*args)" msgstr "" -#: howto/descriptor.rst:1270 +#: howto/descriptor.rst:1286 msgid "f(cls, \\*args)" msgstr "" -#: howto/descriptor.rst:1275 +#: howto/descriptor.rst:1291 msgid "Static methods" msgstr "" -#: howto/descriptor.rst:1277 +#: howto/descriptor.rst:1293 msgid "" "Static methods return the underlying function without changes. Calling " "either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." @@ -891,13 +1445,13 @@ msgid "" "a class." msgstr "" -#: howto/descriptor.rst:1283 +#: howto/descriptor.rst:1299 msgid "" "Good candidates for static methods are methods that do not reference the " "``self`` variable." msgstr "" -#: howto/descriptor.rst:1286 +#: howto/descriptor.rst:1302 msgid "" "For instance, a statistics package may include a container class for " "experimental data. The class provides normal methods for computing the " @@ -906,42 +1460,96 @@ msgid "" "but do not depend on the data. For instance, ``erf(x)`` is handy conversion " "routine that comes up in statistical work but does not directly depend on a " "particular dataset. It can be called either from an object or the class: " -"``s.erf(1.5) --> .9332`` or ``Sample.erf(1.5) --> .9332``." +"``s.erf(1.5) --> 0.9332`` or ``Sample.erf(1.5) --> 0.9332``." msgstr "" -#: howto/descriptor.rst:1295 +#: howto/descriptor.rst:1311 msgid "" "Since static methods return the underlying function with no changes, the " "example calls are unexciting:" msgstr "" -#: howto/descriptor.rst:1312 +#: howto/descriptor.rst:1314 +msgid "" +"class E:\n" +" @staticmethod\n" +" def f(x):\n" +" return x * 10" +msgstr "" + +#: howto/descriptor.rst:1321 +msgid "" +">>> E.f(3)\n" +"30\n" +">>> E().f(3)\n" +"30" +msgstr "" + +#: howto/descriptor.rst:1328 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`staticmethod` would look like this:" msgstr "" -#: howto/descriptor.rst:1332 +#: howto/descriptor.rst:1331 +msgid "" +"import functools\n" +"\n" +"class StaticMethod:\n" +" \"Emulate PyStaticMethod_Type() in Objects/funcobject.c\"\n" +"\n" +" def __init__(self, f):\n" +" self.f = f\n" +" functools.update_wrapper(self, f)\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" return self.f\n" +"\n" +" def __call__(self, *args, **kwds):\n" +" return self.f(*args, **kwds)\n" +"\n" +" @property\n" +" def __annotations__(self):\n" +" return self.f.__annotations__" +msgstr "" + +#: howto/descriptor.rst:1352 msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " -"attributes necessary to make the wrapper look like the wrapped function: :" -"attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." -"__doc__`, and :attr:`~function.__annotations__`." +"attributes necessary to make the wrapper look like the wrapped function, " +"including :attr:`~function.__name__`, :attr:`~function.__qualname__`, and :" +"attr:`~function.__doc__`." msgstr "" -#: howto/descriptor.rst:1401 +#: howto/descriptor.rst:1421 msgid "Class methods" msgstr "" -#: howto/descriptor.rst:1403 +#: howto/descriptor.rst:1423 msgid "" "Unlike static methods, class methods prepend the class reference to the " "argument list before calling the function. This format is the same for " "whether the caller is an object or a class:" msgstr "" -#: howto/descriptor.rst:1421 +#: howto/descriptor.rst:1427 +msgid "" +"class F:\n" +" @classmethod\n" +" def f(cls, x):\n" +" return cls.__name__, x" +msgstr "" + +#: howto/descriptor.rst:1434 +msgid "" +">>> F.f(3)\n" +"('F', 3)\n" +">>> F().f(3)\n" +"('F', 3)" +msgstr "" + +#: howto/descriptor.rst:1441 msgid "" "This behavior is useful whenever the method only needs to have a class " "reference and does not rely on data stored in a specific instance. One use " @@ -950,25 +1558,55 @@ msgid "" "of keys. The pure Python equivalent is:" msgstr "" -#: howto/descriptor.rst:1438 +#: howto/descriptor.rst:1447 +msgid "" +"class Dict(dict):\n" +" @classmethod\n" +" def fromkeys(cls, iterable, value=None):\n" +" \"Emulate dict_fromkeys() in Objects/dictobject.c\"\n" +" d = cls()\n" +" for key in iterable:\n" +" d[key] = value\n" +" return d" +msgstr "" + +#: howto/descriptor.rst:1458 msgid "Now a new dictionary of unique keys can be constructed like this:" msgstr "" -#: howto/descriptor.rst:1448 +#: howto/descriptor.rst:1460 +msgid "" +">>> d = Dict.fromkeys('abracadabra')\n" +">>> type(d) is Dict\n" +"True\n" +">>> d\n" +"{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}" +msgstr "" + +#: howto/descriptor.rst:1468 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`classmethod` would look like this:" msgstr "" -#: howto/descriptor.rst:1526 +#: howto/descriptor.rst:1471 msgid "" -"The code path for ``hasattr(type(self.f), '__get__')`` was added in Python " -"3.9 and makes it possible for :func:`classmethod` to support chained " -"decorators. For example, a classmethod and property could be chained " -"together. In Python 3.11, this functionality was deprecated." +"import functools\n" +"\n" +"class ClassMethod:\n" +" \"Emulate PyClassMethod_Type() in Objects/funcobject.c\"\n" +"\n" +" def __init__(self, f):\n" +" self.f = f\n" +" functools.update_wrapper(self, f)\n" +"\n" +" def __get__(self, obj, cls=None):\n" +" if cls is None:\n" +" cls = type(obj)\n" +" return MethodType(self.f, cls)" msgstr "" -#: howto/descriptor.rst:1544 +#: howto/descriptor.rst:1533 msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " @@ -978,30 +1616,80 @@ msgid "" "__annotations__`." msgstr "" -#: howto/descriptor.rst:1553 +#: howto/descriptor.rst:1542 msgid "Member objects and __slots__" msgstr "" -#: howto/descriptor.rst:1555 +#: howto/descriptor.rst:1544 msgid "" "When a class defines ``__slots__``, it replaces instance dictionaries with a " "fixed-length array of slot values. From a user point of view that has " "several effects:" msgstr "" -#: howto/descriptor.rst:1559 +#: howto/descriptor.rst:1548 msgid "" "1. Provides immediate detection of bugs due to misspelled attribute " "assignments. Only attribute names specified in ``__slots__`` are allowed:" msgstr "" -#: howto/descriptor.rst:1575 +#: howto/descriptor.rst:1551 +msgid "" +"class Vehicle:\n" +" __slots__ = ('id_number', 'make', 'model')" +msgstr "" + +#: howto/descriptor.rst:1556 +msgid "" +">>> auto = Vehicle()\n" +">>> auto.id_nubmer = 'VYE483814LQEX'\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: 'Vehicle' object has no attribute 'id_nubmer'" +msgstr "" + +#: howto/descriptor.rst:1564 msgid "" "2. Helps create immutable objects where descriptors manage access to private " "attributes stored in ``__slots__``:" msgstr "" -#: howto/descriptor.rst:1610 +#: howto/descriptor.rst:1567 +msgid "" +"class Immutable:\n" +"\n" +" __slots__ = ('_dept', '_name') # Replace the instance " +"dictionary\n" +"\n" +" def __init__(self, dept, name):\n" +" self._dept = dept # Store to private attribute\n" +" self._name = name # Store to private attribute\n" +"\n" +" @property # Read-only descriptor\n" +" def dept(self):\n" +" return self._dept\n" +"\n" +" @property\n" +" def name(self): # Read-only descriptor\n" +" return self._name" +msgstr "" + +#: howto/descriptor.rst:1585 +msgid "" +">>> mark = Immutable('Botany', 'Mark Watney')\n" +">>> mark.dept\n" +"'Botany'\n" +">>> mark.dept = 'Space Pirate'\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: property 'dept' of 'Immutable' object has no setter\n" +">>> mark.location = 'Mars'\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: 'Immutable' object has no attribute 'location'" +msgstr "" + +#: howto/descriptor.rst:1599 msgid "" "3. Saves memory. On a 64-bit Linux build, an instance with two attributes " "takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight " @@ -1009,19 +1697,40 @@ msgid "" "only matters when a large number of instances are going to be created." msgstr "" -#: howto/descriptor.rst:1615 +#: howto/descriptor.rst:1604 msgid "" "4. Improves speed. Reading instance variables is 35% faster with " "``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)." msgstr "" -#: howto/descriptor.rst:1618 +#: howto/descriptor.rst:1607 msgid "" "5. Blocks tools like :func:`functools.cached_property` which require an " "instance dictionary to function correctly:" msgstr "" -#: howto/descriptor.rst:1640 +#: howto/descriptor.rst:1610 +msgid "" +"from functools import cached_property\n" +"\n" +"class CP:\n" +" __slots__ = () # Eliminates the instance dict\n" +"\n" +" @cached_property # Requires an instance dict\n" +" def pi(self):\n" +" return 4 * sum((-1.0)**n / (2.0*n + 1.0)\n" +" for n in reversed(range(100_000)))" +msgstr "" + +#: howto/descriptor.rst:1622 +msgid "" +">>> CP().pi\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property." +msgstr "" + +#: howto/descriptor.rst:1629 msgid "" "It is not possible to create an exact drop-in pure Python version of " "``__slots__`` because it requires direct access to C structures and control " @@ -1031,36 +1740,163 @@ msgid "" "managed by member descriptors:" msgstr "" -#: howto/descriptor.rst:1685 -msgid "" -"The :meth:`type.__new__` method takes care of adding member objects to class " -"variables:" -msgstr "" - -#: howto/descriptor.rst:1701 +#: howto/descriptor.rst:1636 +msgid "" +"null = object()\n" +"\n" +"class Member:\n" +"\n" +" def __init__(self, name, clsname, offset):\n" +" 'Emulate PyMemberDef in Include/structmember.h'\n" +" # Also see descr_new() in Objects/descrobject.c\n" +" self.name = name\n" +" self.clsname = clsname\n" +" self.offset = offset\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" 'Emulate member_get() in Objects/descrobject.c'\n" +" # Also see PyMember_GetOne() in Python/structmember.c\n" +" if obj is None:\n" +" return self\n" +" value = obj._slotvalues[self.offset]\n" +" if value is null:\n" +" raise AttributeError(self.name)\n" +" return value\n" +"\n" +" def __set__(self, obj, value):\n" +" 'Emulate member_set() in Objects/descrobject.c'\n" +" obj._slotvalues[self.offset] = value\n" +"\n" +" def __delete__(self, obj):\n" +" 'Emulate member_delete() in Objects/descrobject.c'\n" +" value = obj._slotvalues[self.offset]\n" +" if value is null:\n" +" raise AttributeError(self.name)\n" +" obj._slotvalues[self.offset] = null\n" +"\n" +" def __repr__(self):\n" +" 'Emulate member_repr() in Objects/descrobject.c'\n" +" return f''" +msgstr "" + +#: howto/descriptor.rst:1674 +msgid "" +"The :meth:`!type.__new__` method takes care of adding member objects to " +"class variables:" +msgstr "" + +#: howto/descriptor.rst:1677 +msgid "" +"class Type(type):\n" +" 'Simulate how the type metaclass adds member objects for slots'\n" +"\n" +" def __new__(mcls, clsname, bases, mapping, **kwargs):\n" +" 'Emulate type_new() in Objects/typeobject.c'\n" +" # type_new() calls PyTypeReady() which calls add_methods()\n" +" slot_names = mapping.get('slot_names', [])\n" +" for offset, name in enumerate(slot_names):\n" +" mapping[name] = Member(name, clsname, offset)\n" +" return type.__new__(mcls, clsname, bases, mapping, **kwargs)" +msgstr "" + +#: howto/descriptor.rst:1690 msgid "" "The :meth:`object.__new__` method takes care of creating instances that have " "slots instead of an instance dictionary. Here is a rough simulation in pure " "Python:" msgstr "" -#: howto/descriptor.rst:1736 +#: howto/descriptor.rst:1694 +msgid "" +"class Object:\n" +" 'Simulate how object.__new__() allocates memory for __slots__'\n" +"\n" +" def __new__(cls, *args, **kwargs):\n" +" 'Emulate object_new() in Objects/typeobject.c'\n" +" inst = super().__new__(cls)\n" +" if hasattr(cls, 'slot_names'):\n" +" empty_slots = [null] * len(cls.slot_names)\n" +" object.__setattr__(inst, '_slotvalues', empty_slots)\n" +" return inst\n" +"\n" +" def __setattr__(self, name, value):\n" +" 'Emulate _PyObject_GenericSetAttrWithDict() Objects/object.c'\n" +" cls = type(self)\n" +" if hasattr(cls, 'slot_names') and name not in cls.slot_names:\n" +" raise AttributeError(\n" +" f'{cls.__name__!r} object has no attribute {name!r}'\n" +" )\n" +" super().__setattr__(name, value)\n" +"\n" +" def __delattr__(self, name):\n" +" 'Emulate _PyObject_GenericSetAttrWithDict() Objects/object.c'\n" +" cls = type(self)\n" +" if hasattr(cls, 'slot_names') and name not in cls.slot_names:\n" +" raise AttributeError(\n" +" f'{cls.__name__!r} object has no attribute {name!r}'\n" +" )\n" +" super().__delattr__(name)" +msgstr "" + +#: howto/descriptor.rst:1725 +msgid "" +"To use the simulation in a real class, just inherit from :class:`!Object` " +"and set the :term:`metaclass` to :class:`Type`:" +msgstr "" + +#: howto/descriptor.rst:1728 +msgid "" +"class H(Object, metaclass=Type):\n" +" 'Instance variables stored in slots'\n" +"\n" +" slot_names = ['x', 'y']\n" +"\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y" +msgstr "" + +#: howto/descriptor.rst:1739 msgid "" -"To use the simulation in a real class, just inherit from :class:`Object` and " -"set the :term:`metaclass` to :class:`Type`:" +"At this point, the metaclass has loaded member objects for *x* and *y*::" msgstr "" -#: howto/descriptor.rst:1750 +#: howto/descriptor.rst:1741 msgid "" -"At this point, the metaclass has loaded member objects for *x* and *y*::" +">>> from pprint import pp\n" +">>> pp(dict(vars(H)))\n" +"{'__module__': '__main__',\n" +" '__doc__': 'Instance variables stored in slots',\n" +" 'slot_names': ['x', 'y'],\n" +" '__init__': ,\n" +" 'x': ,\n" +" 'y': }" msgstr "" -#: howto/descriptor.rst:1771 +#: howto/descriptor.rst:1760 msgid "" "When instances are created, they have a ``slot_values`` list where the " "attributes are stored:" msgstr "" -#: howto/descriptor.rst:1783 +#: howto/descriptor.rst:1763 +msgid "" +">>> h = H(10, 20)\n" +">>> vars(h)\n" +"{'_slotvalues': [10, 20]}\n" +">>> h.x = 55\n" +">>> vars(h)\n" +"{'_slotvalues': [55, 20]}" +msgstr "" + +#: howto/descriptor.rst:1772 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr "" + +#: howto/descriptor.rst:1774 +msgid "" +">>> h.xz\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: 'H' object has no attribute 'xz'" +msgstr "" diff --git a/howto/enum.po b/howto/enum.po index 5fc6240d..3d58daff 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -8,46 +8,69 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: howto/enum.rst:3 +#: howto/enum.rst:5 msgid "Enum HOWTO" msgstr "" -#: howto/enum.rst:9 +#: howto/enum.rst:11 msgid "" "An :class:`Enum` is a set of symbolic names bound to unique values. They " -"are similar to global variables, but they offer a more useful :func:" -"`repr()`, grouping, type-safety, and a few other features." +"are similar to global variables, but they offer a more useful :func:`repr`, " +"grouping, type-safety, and a few other features." msgstr "" -#: howto/enum.rst:13 +#: howto/enum.rst:15 msgid "" "They are most useful when you have a variable that can take one of a limited " "selection of values. For example, the days of the week::" msgstr "" -#: howto/enum.rst:26 +#: howto/enum.rst:18 +msgid "" +">>> from enum import Enum\n" +">>> class Weekday(Enum):\n" +"... MONDAY = 1\n" +"... TUESDAY = 2\n" +"... WEDNESDAY = 3\n" +"... THURSDAY = 4\n" +"... FRIDAY = 5\n" +"... SATURDAY = 6\n" +"... SUNDAY = 7" +msgstr "" + +#: howto/enum.rst:28 msgid "Or perhaps the RGB primary colors::" msgstr "" -#: howto/enum.rst:34 +#: howto/enum.rst:30 +msgid "" +">>> from enum import Enum\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3" +msgstr "" + +#: howto/enum.rst:36 msgid "" "As you can see, creating an :class:`Enum` is as simple as writing a class " "that inherits from :class:`Enum` itself." msgstr "" -#: howto/enum.rst:37 +#: howto/enum.rst:39 msgid "Case of Enum Members" msgstr "" -#: howto/enum.rst:39 +#: howto/enum.rst:41 msgid "" "Because Enums are used to represent constants, and to help avoid issues with " "name clashes between mixin-class methods/attributes and enum names, we " @@ -55,129 +78,299 @@ msgid "" "that style in our examples." msgstr "" -#: howto/enum.rst:44 +#: howto/enum.rst:46 msgid "" "Depending on the nature of the enum a member's value may or may not be " "important, but either way that value can be used to get the corresponding " "member::" msgstr "" -#: howto/enum.rst:51 +#: howto/enum.rst:50 +msgid "" +">>> Weekday(3)\n" +"" +msgstr "" + +#: howto/enum.rst:53 msgid "" "As you can see, the ``repr()`` of a member shows the enum name, the member " "name, and the value. The ``str()`` of a member shows only the enum name and " "member name::" msgstr "" -#: howto/enum.rst:58 +#: howto/enum.rst:57 +msgid "" +">>> print(Weekday.THURSDAY)\n" +"Weekday.THURSDAY" +msgstr "" + +#: howto/enum.rst:60 msgid "The *type* of an enumeration member is the enum it belongs to::" msgstr "" -#: howto/enum.rst:65 -msgid "Enum members have an attribute that contains just their :attr:`name`::" +#: howto/enum.rst:62 +msgid "" +">>> type(Weekday.MONDAY)\n" +"\n" +">>> isinstance(Weekday.FRIDAY, Weekday)\n" +"True" +msgstr "" + +#: howto/enum.rst:67 +msgid "Enum members have an attribute that contains just their :attr:`!name`::" +msgstr "" + +#: howto/enum.rst:69 +msgid "" +">>> print(Weekday.TUESDAY.name)\n" +"TUESDAY" +msgstr "" + +#: howto/enum.rst:72 +msgid "Likewise, they have an attribute for their :attr:`!value`::" msgstr "" -#: howto/enum.rst:70 -msgid "Likewise, they have an attribute for their :attr:`value`::" +#: howto/enum.rst:75 +msgid "" +">>> Weekday.WEDNESDAY.value\n" +"3" msgstr "" -#: howto/enum.rst:76 +#: howto/enum.rst:78 msgid "" "Unlike many languages that treat enumerations solely as name/value pairs, " "Python Enums can have behavior added. For example, :class:`datetime.date` " -"has two methods for returning the weekday: :meth:`weekday` and :meth:" -"`isoweekday`. The difference is that one of them counts from 0-6 and the " -"other from 1-7. Rather than keep track of that ourselves we can add a method " -"to the :class:`Weekday` enum to extract the day from the :class:`date` " -"instance and return the matching enum member::" +"has two methods for returning the weekday: :meth:`~datetime.date.weekday` " +"and :meth:`~datetime.date.isoweekday`. The difference is that one of them " +"counts from 0-6 and the other from 1-7. Rather than keep track of that " +"ourselves we can add a method to the :class:`!Weekday` enum to extract the " +"day from the :class:`~datetime.date` instance and return the matching enum " +"member::" +msgstr "" + +#: howto/enum.rst:87 +msgid "" +"@classmethod\n" +"def from_date(cls, date):\n" +" return cls(date.isoweekday())" msgstr "" -#: howto/enum.rst:88 -msgid "The complete :class:`Weekday` enum now looks like this::" +#: howto/enum.rst:91 +msgid "The complete :class:`!Weekday` enum now looks like this::" msgstr "" -#: howto/enum.rst:103 +#: howto/enum.rst:93 +msgid "" +">>> class Weekday(Enum):\n" +"... MONDAY = 1\n" +"... TUESDAY = 2\n" +"... WEDNESDAY = 3\n" +"... THURSDAY = 4\n" +"... FRIDAY = 5\n" +"... SATURDAY = 6\n" +"... SUNDAY = 7\n" +"... #\n" +"... @classmethod\n" +"... def from_date(cls, date):\n" +"... return cls(date.isoweekday())" +msgstr "" + +#: howto/enum.rst:106 msgid "Now we can find out what today is! Observe::" msgstr "" -#: howto/enum.rst:109 +#: howto/enum.rst:108 +msgid "" +">>> from datetime import date\n" +">>> Weekday.from_date(date.today())\n" +"" +msgstr "" + +#: howto/enum.rst:112 msgid "" "Of course, if you're reading this on some other day, you'll see that day " "instead." msgstr "" -#: howto/enum.rst:111 +#: howto/enum.rst:114 msgid "" -"This :class:`Weekday` enum is great if our variable only needs one day, but " +"This :class:`!Weekday` enum is great if our variable only needs one day, but " "what if we need several? Maybe we're writing a function to plot chores " "during a week, and don't want to use a :class:`list` -- we could use a " "different type of :class:`Enum`::" msgstr "" -#: howto/enum.rst:126 +#: howto/enum.rst:119 +msgid "" +">>> from enum import Flag\n" +">>> class Weekday(Flag):\n" +"... MONDAY = 1\n" +"... TUESDAY = 2\n" +"... WEDNESDAY = 4\n" +"... THURSDAY = 8\n" +"... FRIDAY = 16\n" +"... SATURDAY = 32\n" +"... SUNDAY = 64" +msgstr "" + +#: howto/enum.rst:129 msgid "" "We've changed two things: we're inherited from :class:`Flag`, and the values " "are all powers of 2." msgstr "" -#: howto/enum.rst:129 +#: howto/enum.rst:132 msgid "" -"Just like the original :class:`Weekday` enum above, we can have a single " +"Just like the original :class:`!Weekday` enum above, we can have a single " "selection::" msgstr "" -#: howto/enum.rst:135 +#: howto/enum.rst:134 +msgid "" +">>> first_week_day = Weekday.MONDAY\n" +">>> first_week_day\n" +"" +msgstr "" + +#: howto/enum.rst:138 msgid "" "But :class:`Flag` also allows us to combine several members into a single " "variable::" msgstr "" -#: howto/enum.rst:142 +#: howto/enum.rst:141 +msgid "" +">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n" +">>> weekend\n" +"" +msgstr "" + +#: howto/enum.rst:145 msgid "You can even iterate over a :class:`Flag` variable::" msgstr "" -#: howto/enum.rst:149 +#: howto/enum.rst:147 +msgid "" +">>> for day in weekend:\n" +"... print(day)\n" +"Weekday.SATURDAY\n" +"Weekday.SUNDAY" +msgstr "" + +#: howto/enum.rst:152 msgid "Okay, let's get some chores set up::" msgstr "" -#: howto/enum.rst:157 +#: howto/enum.rst:154 +msgid "" +">>> chores_for_ethan = {\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." +"FRIDAY,\n" +"... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" +"... 'answer SO questions': Weekday.SATURDAY,\n" +"... }" +msgstr "" + +#: howto/enum.rst:160 msgid "And a function to display the chores for a given day::" msgstr "" -#: howto/enum.rst:167 +#: howto/enum.rst:162 +msgid "" +">>> def show_chores(chores, day):\n" +"... for chore, days in chores.items():\n" +"... if day in days:\n" +"... print(chore)\n" +"...\n" +">>> show_chores(chores_for_ethan, Weekday.SATURDAY)\n" +"answer SO questions" +msgstr "" + +#: howto/enum.rst:170 msgid "" "In cases where the actual values of the members do not matter, you can save " -"yourself some work and use :func:`auto()` for the values::" +"yourself some work and use :func:`auto` for the values::" +msgstr "" + +#: howto/enum.rst:173 +msgid "" +">>> from enum import auto\n" +">>> class Weekday(Flag):\n" +"... MONDAY = auto()\n" +"... TUESDAY = auto()\n" +"... WEDNESDAY = auto()\n" +"... THURSDAY = auto()\n" +"... FRIDAY = auto()\n" +"... SATURDAY = auto()\n" +"... SUNDAY = auto()\n" +"... WEEKEND = SATURDAY | SUNDAY" msgstr "" -#: howto/enum.rst:186 +#: howto/enum.rst:189 msgid "Programmatic access to enumeration members and their attributes" msgstr "" -#: howto/enum.rst:188 +#: howto/enum.rst:191 msgid "" "Sometimes it's useful to access members in enumerations programmatically (i." "e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" -#: howto/enum.rst:197 +#: howto/enum.rst:195 +msgid "" +">>> Color(1)\n" +"\n" +">>> Color(3)\n" +"" +msgstr "" + +#: howto/enum.rst:200 msgid "If you want to access enum members by *name*, use item access::" msgstr "" -#: howto/enum.rst:204 -msgid "If you have an enum member and need its :attr:`name` or :attr:`value`::" +#: howto/enum.rst:202 +msgid "" +">>> Color['RED']\n" +"\n" +">>> Color['GREEN']\n" +"" +msgstr "" + +#: howto/enum.rst:207 +msgid "" +"If you have an enum member and need its :attr:`!name` or :attr:`!value`::" +msgstr "" + +#: howto/enum.rst:209 +msgid "" +">>> member = Color.RED\n" +">>> member.name\n" +"'RED'\n" +">>> member.value\n" +"1" msgstr "" -#: howto/enum.rst:214 +#: howto/enum.rst:217 msgid "Duplicating enum members and values" msgstr "" -#: howto/enum.rst:216 +#: howto/enum.rst:219 msgid "Having two enum members with the same name is invalid::" msgstr "" -#: howto/enum.rst:226 +#: howto/enum.rst:221 +msgid "" +">>> class Shape(Enum):\n" +"... SQUARE = 2\n" +"... SQUARE = 3\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"TypeError: 'SQUARE' already defined as 2" +msgstr "" + +#: howto/enum.rst:229 msgid "" "However, an enum member can have other names associated with it. Given two " "entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` " @@ -186,112 +379,235 @@ msgid "" "member ``A``. By-name lookup of ``B`` will also return the member ``A``::" msgstr "" -#: howto/enum.rst:247 +#: howto/enum.rst:235 +msgid "" +">>> class Shape(Enum):\n" +"... SQUARE = 2\n" +"... DIAMOND = 1\n" +"... CIRCLE = 3\n" +"... ALIAS_FOR_SQUARE = 2\n" +"...\n" +">>> Shape.SQUARE\n" +"\n" +">>> Shape.ALIAS_FOR_SQUARE\n" +"\n" +">>> Shape(2)\n" +"" +msgstr "" + +#: howto/enum.rst:250 msgid "" "Attempting to create a member with the same name as an already defined " "attribute (another member, a method, etc.) or attempting to create an " "attribute with the same name as a member is not allowed." msgstr "" -#: howto/enum.rst:253 +#: howto/enum.rst:256 msgid "Ensuring unique enumeration values" msgstr "" -#: howto/enum.rst:255 +#: howto/enum.rst:258 msgid "" "By default, enumerations allow multiple names as aliases for the same value. " "When this behavior isn't desired, you can use the :func:`unique` decorator::" msgstr "" -#: howto/enum.rst:272 +#: howto/enum.rst:261 +msgid "" +">>> from enum import Enum, unique\n" +">>> @unique\n" +"... class Mistake(Enum):\n" +"... ONE = 1\n" +"... TWO = 2\n" +"... THREE = 3\n" +"... FOUR = 3\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: duplicate values found in : FOUR -> THREE" +msgstr "" + +#: howto/enum.rst:275 msgid "Using automatic values" msgstr "" -#: howto/enum.rst:274 +#: howto/enum.rst:277 msgid "If the exact value is unimportant you can use :class:`auto`::" msgstr "" -#: howto/enum.rst:285 +#: howto/enum.rst:279 +msgid "" +">>> from enum import Enum, auto\n" +">>> class Color(Enum):\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"...\n" +">>> [member.value for member in Color]\n" +"[1, 2, 3]" +msgstr "" + +#: howto/enum.rst:288 msgid "" -"The values are chosen by :func:`_generate_next_value_`, which can be " +"The values are chosen by :func:`~Enum._generate_next_value_`, which can be " "overridden::" msgstr "" -#: howto/enum.rst:304 +#: howto/enum.rst:291 msgid "" -"The :meth:`_generate_next_value_` method must be defined before any members." +">>> class AutoName(Enum):\n" +"... @staticmethod\n" +"... def _generate_next_value_(name, start, count, last_values):\n" +"... return name\n" +"...\n" +">>> class Ordinal(AutoName):\n" +"... NORTH = auto()\n" +"... SOUTH = auto()\n" +"... EAST = auto()\n" +"... WEST = auto()\n" +"...\n" +">>> [member.value for member in Ordinal]\n" +"['NORTH', 'SOUTH', 'EAST', 'WEST']" msgstr "" #: howto/enum.rst:307 +msgid "" +"The :meth:`~Enum._generate_next_value_` method must be defined before any " +"members." +msgstr "" + +#: howto/enum.rst:310 msgid "Iteration" msgstr "" -#: howto/enum.rst:309 +#: howto/enum.rst:312 msgid "Iterating over the members of an enum does not provide the aliases::" msgstr "" -#: howto/enum.rst:316 +#: howto/enum.rst:314 +msgid "" +">>> list(Shape)\n" +"[, , ]\n" +">>> list(Weekday)\n" +"[, , , , , , ]" +msgstr "" + +#: howto/enum.rst:319 msgid "" "Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` " "aren't shown." msgstr "" -#: howto/enum.rst:318 +#: howto/enum.rst:321 msgid "" "The special attribute ``__members__`` is a read-only ordered mapping of " "names to members. It includes all names defined in the enumeration, " "including the aliases::" msgstr "" -#: howto/enum.rst:330 +#: howto/enum.rst:325 +msgid "" +">>> for name, member in Shape.__members__.items():\n" +"... name, member\n" +"...\n" +"('SQUARE', )\n" +"('DIAMOND', )\n" +"('CIRCLE', )\n" +"('ALIAS_FOR_SQUARE', )" +msgstr "" + +#: howto/enum.rst:333 msgid "" "The ``__members__`` attribute can be used for detailed programmatic access " "to the enumeration members. For example, finding all the aliases::" msgstr "" -#: howto/enum.rst:338 +#: howto/enum.rst:336 +msgid "" +">>> [name for name, member in Shape.__members__.items() if member.name != " +"name]\n" +"['ALIAS_FOR_SQUARE']" +msgstr "" + +#: howto/enum.rst:341 msgid "" "Aliases for flags include values with multiple flags set, such as ``3``, and " "no flags set, i.e. ``0``." msgstr "" -#: howto/enum.rst:343 +#: howto/enum.rst:346 msgid "Comparisons" msgstr "" -#: howto/enum.rst:345 +#: howto/enum.rst:348 msgid "Enumeration members are compared by identity::" msgstr "" -#: howto/enum.rst:354 +#: howto/enum.rst:350 +msgid "" +">>> Color.RED is Color.RED\n" +"True\n" +">>> Color.RED is Color.BLUE\n" +"False\n" +">>> Color.RED is not Color.BLUE\n" +"True" +msgstr "" + +#: howto/enum.rst:357 msgid "" "Ordered comparisons between enumeration values are *not* supported. Enum " "members are not integers (but see `IntEnum`_ below)::" msgstr "" -#: howto/enum.rst:362 +#: howto/enum.rst:360 +msgid "" +">>> Color.RED < Color.BLUE\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: '<' not supported between instances of 'Color' and 'Color'" +msgstr "" + +#: howto/enum.rst:365 msgid "Equality comparisons are defined though::" msgstr "" -#: howto/enum.rst:371 +#: howto/enum.rst:367 +msgid "" +">>> Color.BLUE == Color.RED\n" +"False\n" +">>> Color.BLUE != Color.RED\n" +"True\n" +">>> Color.BLUE == Color.BLUE\n" +"True" +msgstr "" + +#: howto/enum.rst:374 msgid "" "Comparisons against non-enumeration values will always compare not equal " "(again, :class:`IntEnum` was explicitly designed to behave differently, see " "below)::" msgstr "" -#: howto/enum.rst:380 +#: howto/enum.rst:378 +msgid "" +">>> Color.BLUE == 2\n" +"False" +msgstr "" + +#: howto/enum.rst:383 msgid "" "It is possible to reload modules -- if a reloaded module contains enums, " "they will be recreated, and the new members may not compare identical/equal " "to the original members." msgstr "" -#: howto/enum.rst:385 +#: howto/enum.rst:388 msgid "Allowed members and attributes of enumerations" msgstr "" -#: howto/enum.rst:387 +#: howto/enum.rst:390 msgid "" "Most of the examples above use integers for enumeration values. Using " "integers is short and handy (and provided by default by the `Functional " @@ -300,46 +616,76 @@ msgid "" "*is* important, enumerations can have arbitrary values." msgstr "" -#: howto/enum.rst:393 +#: howto/enum.rst:396 msgid "" "Enumerations are Python classes, and can have methods and special methods as " "usual. If we have this enumeration::" msgstr "" -#: howto/enum.rst:413 +#: howto/enum.rst:399 +msgid "" +">>> class Mood(Enum):\n" +"... FUNKY = 1\n" +"... HAPPY = 3\n" +"...\n" +"... def describe(self):\n" +"... # self is the member here\n" +"... return self.name, self.value\n" +"...\n" +"... def __str__(self):\n" +"... return 'my custom str! {0}'.format(self.value)\n" +"...\n" +"... @classmethod\n" +"... def favorite_mood(cls):\n" +"... # cls here is the enumeration\n" +"... return cls.HAPPY\n" +"..." +msgstr "" + +#: howto/enum.rst:416 msgid "Then::" msgstr "" -#: howto/enum.rst:422 +#: howto/enum.rst:418 +msgid "" +">>> Mood.favorite_mood()\n" +"\n" +">>> Mood.HAPPY.describe()\n" +"('HAPPY', 3)\n" +">>> str(Mood.FUNKY)\n" +"'my custom str! 1'" +msgstr "" + +#: howto/enum.rst:425 msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " "attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods (:meth:`__str__`, :meth:" -"`__add__`, etc.), descriptors (methods are also descriptors), and variable " -"names listed in :attr:`_ignore_`." +"enumeration, with the exception of special methods (:meth:`~object." +"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " +"descriptors), and variable names listed in :attr:`~Enum._ignore_`." msgstr "" -#: howto/enum.rst:429 +#: howto/enum.rst:432 msgid "" -"Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__`, " -"any value(s) given to the enum member will be passed into those methods. See " -"`Planet`_ for an example." +"Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:" +"`~object.__init__`, any value(s) given to the enum member will be passed " +"into those methods. See `Planet`_ for an example." msgstr "" -#: howto/enum.rst:435 +#: howto/enum.rst:438 msgid "" -"The :meth:`__new__` method, if defined, is used during creation of the Enum " -"members; it is then replaced by Enum's :meth:`__new__` which is used after " -"class creation for lookup of existing members. See :ref:`new-vs-init` for " -"more details." +"The :meth:`~object.__new__` method, if defined, is used during creation of " +"the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " +"which is used after class creation for lookup of existing members. See :ref:" +"`new-vs-init` for more details." msgstr "" -#: howto/enum.rst:442 +#: howto/enum.rst:445 msgid "Restricted Enum subclassing" msgstr "" -#: howto/enum.rst:444 +#: howto/enum.rst:447 msgid "" "A new :class:`Enum` class must have one base enum class, up to one concrete " "data type, and as many :class:`object`-based mixin classes as needed. The " @@ -348,15 +694,43 @@ msgstr "" #: howto/enum.rst:451 msgid "" +"class EnumName([mix-in, ...,] [data-type,] base-enum):\n" +" pass" +msgstr "" + +#: howto/enum.rst:454 +msgid "" "Also, subclassing an enumeration is allowed only if the enumeration does not " "define any members. So this is forbidden::" msgstr "" -#: howto/enum.rst:461 +#: howto/enum.rst:457 +msgid "" +">>> class MoreColor(Color):\n" +"... PINK = 17\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"TypeError: cannot extend " +msgstr "" + +#: howto/enum.rst:464 msgid "But this is allowed::" msgstr "" -#: howto/enum.rst:472 +#: howto/enum.rst:466 +msgid "" +">>> class Foo(Enum):\n" +"... def some_behavior(self):\n" +"... pass\n" +"...\n" +">>> class Bar(Foo):\n" +"... HAPPY = 1\n" +"... SAD = 2\n" +"..." +msgstr "" + +#: howto/enum.rst:475 msgid "" "Allowing subclassing of enums that define members would lead to a violation " "of some important invariants of types and instances. On the other hand, it " @@ -364,78 +738,142 @@ msgid "" "enumerations. (See `OrderedEnum`_ for an example.)" msgstr "" -#: howto/enum.rst:481 +#: howto/enum.rst:484 msgid "Dataclass support" msgstr "" -#: howto/enum.rst:483 +#: howto/enum.rst:486 msgid "" "When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." "__repr__` omits the inherited class' name. For example::" msgstr "" -#: howto/enum.rst:500 +#: howto/enum.rst:489 msgid "" -"Use the :func:`!dataclass` argument ``repr=False`` to use the standard :func:" -"`repr`." +">>> from dataclasses import dataclass, field\n" +">>> @dataclass\n" +"... class CreatureDataMixin:\n" +"... size: str\n" +"... legs: int\n" +"... tail: bool = field(repr=False, default=True)\n" +"...\n" +">>> class Creature(CreatureDataMixin, Enum):\n" +"... BEETLE = 'small', 6\n" +"... DOG = 'medium', 4\n" +"...\n" +">>> Creature.DOG\n" +"" msgstr "" #: howto/enum.rst:503 msgid "" +"Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the " +"standard :func:`repr`." +msgstr "" + +#: howto/enum.rst:506 +msgid "" "Only the dataclass fields are shown in the value area, not the dataclass' " "name." msgstr "" -#: howto/enum.rst:509 +#: howto/enum.rst:512 +msgid "" +"Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum` and its " +"subclasses is not supported. It will not raise any errors, but it will " +"produce very strange results at runtime, such as members being equal to each " +"other::" +msgstr "" + +#: howto/enum.rst:517 +msgid "" +">>> @dataclass # don't do this: it does not make any sense\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... BLUE = 2\n" +"...\n" +">>> Color.RED is Color.BLUE\n" +"False\n" +">>> Color.RED == Color.BLUE # problem is here: they should not be equal\n" +"True" +msgstr "" + +#: howto/enum.rst:529 msgid "Pickling" msgstr "" -#: howto/enum.rst:511 +#: howto/enum.rst:531 msgid "Enumerations can be pickled and unpickled::" msgstr "" -#: howto/enum.rst:518 +#: howto/enum.rst:533 +msgid "" +">>> from test.test_enum import Fruit\n" +">>> from pickle import dumps, loads\n" +">>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\n" +"True" +msgstr "" + +#: howto/enum.rst:538 msgid "" "The usual restrictions for pickling apply: picklable enums must be defined " "in the top level of a module, since unpickling requires them to be " "importable from that module." msgstr "" -#: howto/enum.rst:524 +#: howto/enum.rst:544 msgid "" "With pickle protocol version 4 it is possible to easily pickle enums nested " "in other classes." msgstr "" -#: howto/enum.rst:527 +#: howto/enum.rst:547 msgid "" "It is possible to modify how enum members are pickled/unpickled by defining :" -"meth:`__reduce_ex__` in the enumeration class. The default method is by-" -"value, but enums with complicated values may want to use by-name::" +"meth:`~object.__reduce_ex__` in the enumeration class. The default method " +"is by-value, but enums with complicated values may want to use by-name::" msgstr "" -#: howto/enum.rst:537 +#: howto/enum.rst:551 +msgid "" +">>> import enum\n" +">>> class MyEnum(enum.Enum):\n" +"... __reduce_ex__ = enum.pickle_by_enum_name" +msgstr "" + +#: howto/enum.rst:557 msgid "" "Using by-name for flags is not recommended, as unnamed aliases will not " "unpickle." msgstr "" -#: howto/enum.rst:542 +#: howto/enum.rst:562 msgid "Functional API" msgstr "" -#: howto/enum.rst:544 +#: howto/enum.rst:564 msgid "" "The :class:`Enum` class is callable, providing the following functional API::" msgstr "" -#: howto/enum.rst:554 +#: howto/enum.rst:566 +msgid "" +">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n" +">>> Animal\n" +"\n" +">>> Animal.ANT\n" +"\n" +">>> list(Animal)\n" +"[, , , ]" +msgstr "" + +#: howto/enum.rst:574 msgid "" "The semantics of this API resemble :class:`~collections.namedtuple`. The " "first argument of the call to :class:`Enum` is the name of the enumeration." msgstr "" -#: howto/enum.rst:557 +#: howto/enum.rst:577 msgid "" "The second argument is the *source* of enumeration member names. It can be " "a whitespace-separated string of names, a sequence of names, a sequence of 2-" @@ -444,17 +882,27 @@ msgid "" "enumerations; the others auto-assign increasing integers starting with 1 " "(use the ``start`` parameter to specify a different starting value). A new " "class derived from :class:`Enum` is returned. In other words, the above " -"assignment to :class:`Animal` is equivalent to::" +"assignment to :class:`!Animal` is equivalent to::" +msgstr "" + +#: howto/enum.rst:586 +msgid "" +">>> class Animal(Enum):\n" +"... ANT = 1\n" +"... BEE = 2\n" +"... CAT = 3\n" +"... DOG = 4\n" +"..." msgstr "" -#: howto/enum.rst:573 +#: howto/enum.rst:593 msgid "" "The reason for defaulting to ``1`` as the starting number and not ``0`` is " "that ``0`` is ``False`` in a boolean sense, but by default enum members all " "evaluate to ``True``." msgstr "" -#: howto/enum.rst:577 +#: howto/enum.rst:597 msgid "" "Pickling enums created with the functional API can be tricky as frame stack " "implementation details are used to try and figure out which module the " @@ -463,76 +911,114 @@ msgid "" "Jython). The solution is to specify the module name explicitly as follows::" msgstr "" -#: howto/enum.rst:587 +#: howto/enum.rst:603 +msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" +msgstr "" + +#: howto/enum.rst:607 msgid "" "If ``module`` is not supplied, and Enum cannot determine what it is, the new " "Enum members will not be unpicklable; to keep errors closer to the source, " "pickling will be disabled." msgstr "" -#: howto/enum.rst:591 +#: howto/enum.rst:611 msgid "" "The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~definition.__qualname__` being set to the location where pickle will be " -"able to find the class. For example, if the class was made available in " -"class SomeData in the global scope::" +"`~type.__qualname__` being set to the location where pickle will be able to " +"find the class. For example, if the class was made available in class " +"SomeData in the global scope::" +msgstr "" + +#: howto/enum.rst:616 +msgid "" +">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" msgstr "" -#: howto/enum.rst:598 +#: howto/enum.rst:618 msgid "The complete signature is::" msgstr "" -#: howto/enum.rst:610 +#: howto/enum.rst:620 +msgid "" +"Enum(\n" +" value='NewEnumName',\n" +" names=<...>,\n" +" *,\n" +" module='...',\n" +" qualname='...',\n" +" type=,\n" +" start=1,\n" +" )" +msgstr "" + +#: howto/enum.rst:630 msgid "*value*: What the new enum class will record as its name." msgstr "" -#: howto/enum.rst:612 +#: howto/enum.rst:632 msgid "" "*names*: The enum members. This can be a whitespace- or comma-separated " "string (values will start at 1 unless otherwise specified)::" msgstr "" -#: howto/enum.rst:617 +#: howto/enum.rst:635 +msgid "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" +msgstr "" + +#: howto/enum.rst:637 msgid "or an iterator of names::" msgstr "" -#: howto/enum.rst:621 +#: howto/enum.rst:639 +msgid "['RED', 'GREEN', 'BLUE']" +msgstr "" + +#: howto/enum.rst:641 msgid "or an iterator of (name, value) pairs::" msgstr "" -#: howto/enum.rst:625 +#: howto/enum.rst:643 +msgid "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" +msgstr "" + +#: howto/enum.rst:645 msgid "or a mapping::" msgstr "" -#: howto/enum.rst:629 +#: howto/enum.rst:647 +msgid "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" +msgstr "" + +#: howto/enum.rst:649 msgid "*module*: name of module where new enum class can be found." msgstr "" -#: howto/enum.rst:631 +#: howto/enum.rst:651 msgid "*qualname*: where in module new enum class can be found." msgstr "" -#: howto/enum.rst:633 +#: howto/enum.rst:653 msgid "*type*: type to mix in to new enum class." msgstr "" -#: howto/enum.rst:635 +#: howto/enum.rst:655 msgid "*start*: number to start counting at if only names are passed in." msgstr "" -#: howto/enum.rst:637 +#: howto/enum.rst:657 msgid "The *start* parameter was added." msgstr "" -#: howto/enum.rst:642 +#: howto/enum.rst:662 msgid "Derived Enumerations" msgstr "" -#: howto/enum.rst:645 +#: howto/enum.rst:665 msgid "IntEnum" msgstr "" -#: howto/enum.rst:647 +#: howto/enum.rst:667 msgid "" "The first variation of :class:`Enum` that is provided is also a subclass of :" "class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " @@ -540,22 +1026,65 @@ msgid "" "each other::" msgstr "" -#: howto/enum.rst:668 +#: howto/enum.rst:672 +msgid "" +">>> from enum import IntEnum\n" +">>> class Shape(IntEnum):\n" +"... CIRCLE = 1\n" +"... SQUARE = 2\n" +"...\n" +">>> class Request(IntEnum):\n" +"... POST = 1\n" +"... GET = 2\n" +"...\n" +">>> Shape == 1\n" +"False\n" +">>> Shape.CIRCLE == 1\n" +"True\n" +">>> Shape.CIRCLE == Request.POST\n" +"True" +msgstr "" + +#: howto/enum.rst:688 msgid "" "However, they still can't be compared to standard :class:`Enum` " "enumerations::" msgstr "" -#: howto/enum.rst:681 +#: howto/enum.rst:690 +msgid "" +">>> class Shape(IntEnum):\n" +"... CIRCLE = 1\n" +"... SQUARE = 2\n" +"...\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"...\n" +">>> Shape.CIRCLE == Color.RED\n" +"False" +msgstr "" + +#: howto/enum.rst:701 msgid "" ":class:`IntEnum` values behave like integers in other ways you'd expect::" msgstr "" -#: howto/enum.rst:692 +#: howto/enum.rst:703 +msgid "" +">>> int(Shape.CIRCLE)\n" +"1\n" +">>> ['a', 'b', 'c'][Shape.CIRCLE]\n" +"'b'\n" +">>> [i for i in range(Shape.SQUARE)]\n" +"[0, 1]" +msgstr "" + +#: howto/enum.rst:712 msgid "StrEnum" msgstr "" -#: howto/enum.rst:694 +#: howto/enum.rst:714 msgid "" "The second variation of :class:`Enum` that is provided is also a subclass " "of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; " @@ -563,11 +1092,11 @@ msgid "" "each other." msgstr "" -#: howto/enum.rst:703 +#: howto/enum.rst:723 msgid "IntFlag" msgstr "" -#: howto/enum.rst:705 +#: howto/enum.rst:725 msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " @@ -577,60 +1106,122 @@ msgid "" "is used." msgstr "" -#: howto/enum.rst:713 +#: howto/enum.rst:733 msgid "" "Any operation on an :class:`IntFlag` member besides the bit-wise operations " "will lose the :class:`IntFlag` membership." msgstr "" -#: howto/enum.rst:716 +#: howto/enum.rst:736 msgid "" "Bit-wise operations that result in invalid :class:`IntFlag` values will lose " "the :class:`IntFlag` membership. See :class:`FlagBoundary` for details." msgstr "" -#: howto/enum.rst:723 +#: howto/enum.rst:743 msgid "Sample :class:`IntFlag` class::" msgstr "" -#: howto/enum.rst:739 +#: howto/enum.rst:745 +msgid "" +">>> from enum import IntFlag\n" +">>> class Perm(IntFlag):\n" +"... R = 4\n" +"... W = 2\n" +"... X = 1\n" +"...\n" +">>> Perm.R | Perm.W\n" +"\n" +">>> Perm.R + Perm.W\n" +"6\n" +">>> RW = Perm.R | Perm.W\n" +">>> Perm.R in RW\n" +"True" +msgstr "" + +#: howto/enum.rst:759 msgid "It is also possible to name the combinations::" msgstr "" -#: howto/enum.rst:756 +#: howto/enum.rst:761 +msgid "" +">>> class Perm(IntFlag):\n" +"... R = 4\n" +"... W = 2\n" +"... X = 1\n" +"... RWX = 7\n" +"...\n" +">>> Perm.RWX\n" +"\n" +">>> ~Perm.RWX\n" +"\n" +">>> Perm(7)\n" +"" +msgstr "" + +#: howto/enum.rst:776 msgid "" "Named combinations are considered aliases. Aliases do not show up during " "iteration, but can be returned from by-value lookups." msgstr "" -#: howto/enum.rst:761 +#: howto/enum.rst:781 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " "that if no flags are set (the value is 0), its boolean evaluation is :data:" "`False`::" msgstr "" -#: howto/enum.rst:769 +#: howto/enum.rst:784 +msgid "" +">>> Perm.R & Perm.X\n" +"\n" +">>> bool(Perm.R & Perm.X)\n" +"False" +msgstr "" + +#: howto/enum.rst:789 msgid "" "Because :class:`IntFlag` members are also subclasses of :class:`int` they " "can be combined with them (but may lose :class:`IntFlag` membership::" msgstr "" -#: howto/enum.rst:780 +#: howto/enum.rst:792 +msgid "" +">>> Perm.X | 4\n" +"\n" +"\n" +">>> Perm.X + 8\n" +"9" +msgstr "" + +#: howto/enum.rst:800 msgid "" "The negation operator, ``~``, always returns an :class:`IntFlag` member with " "a positive value::" msgstr "" -#: howto/enum.rst:786 +#: howto/enum.rst:803 +msgid "" +">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" +"True" +msgstr "" + +#: howto/enum.rst:806 msgid ":class:`IntFlag` members can also be iterated over::" msgstr "" -#: howto/enum.rst:795 +#: howto/enum.rst:808 +msgid "" +">>> list(RW)\n" +"[, ]" +msgstr "" + +#: howto/enum.rst:815 msgid "Flag" msgstr "" -#: howto/enum.rst:797 +#: howto/enum.rst:817 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " "members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" @@ -640,29 +1231,76 @@ msgid "" "value and let :class:`Flag` select an appropriate value." msgstr "" -#: howto/enum.rst:806 +#: howto/enum.rst:826 msgid "" "Like :class:`IntFlag`, if a combination of :class:`Flag` members results in " "no flags being set, the boolean evaluation is :data:`False`::" msgstr "" -#: howto/enum.rst:820 +#: howto/enum.rst:829 +msgid "" +">>> from enum import Flag, auto\n" +">>> class Color(Flag):\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"...\n" +">>> Color.RED & Color.GREEN\n" +"\n" +">>> bool(Color.RED & Color.GREEN)\n" +"False" +msgstr "" + +#: howto/enum.rst:840 msgid "" "Individual flags should have values that are powers of two (1, 2, 4, " "8, ...), while combinations of flags will not::" msgstr "" -#: howto/enum.rst:832 +#: howto/enum.rst:843 +msgid "" +">>> class Color(Flag):\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"... WHITE = RED | BLUE | GREEN\n" +"...\n" +">>> Color.WHITE\n" +"" +msgstr "" + +#: howto/enum.rst:852 msgid "" "Giving a name to the \"no flags set\" condition does not change its boolean " "value::" msgstr "" -#: howto/enum.rst:846 +#: howto/enum.rst:855 +msgid "" +">>> class Color(Flag):\n" +"... BLACK = 0\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"...\n" +">>> Color.BLACK\n" +"\n" +">>> bool(Color.BLACK)\n" +"False" +msgstr "" + +#: howto/enum.rst:866 msgid ":class:`Flag` members can also be iterated over::" msgstr "" -#: howto/enum.rst:856 +#: howto/enum.rst:868 +msgid "" +">>> purple = Color.RED | Color.BLUE\n" +">>> list(purple)\n" +"[, ]" +msgstr "" + +#: howto/enum.rst:876 msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " @@ -673,42 +1311,48 @@ msgid "" "enumerations, or for interoperability with other systems." msgstr "" -#: howto/enum.rst:866 +#: howto/enum.rst:886 msgid "Others" msgstr "" -#: howto/enum.rst:868 +#: howto/enum.rst:888 msgid "" "While :class:`IntEnum` is part of the :mod:`enum` module, it would be very " "simple to implement independently::" msgstr "" -#: howto/enum.rst:874 +#: howto/enum.rst:891 +msgid "" +"class IntEnum(int, ReprEnum): # or Enum instead of ReprEnum\n" +" pass" +msgstr "" + +#: howto/enum.rst:894 msgid "" "This demonstrates how similar derived enumerations can be defined; for " -"example a :class:`FloatEnum` that mixes in :class:`float` instead of :class:" +"example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:" "`int`." msgstr "" -#: howto/enum.rst:877 +#: howto/enum.rst:897 msgid "Some rules:" msgstr "" -#: howto/enum.rst:879 +#: howto/enum.rst:899 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before :class:" -"`Enum` itself in the sequence of bases, as in the :class:`IntEnum` example " -"above." +"When subclassing :class:`Enum`, mix-in types must appear before the :class:" +"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " +"example above." msgstr "" -#: howto/enum.rst:882 +#: howto/enum.rst:902 msgid "" "Mix-in types must be subclassable. For example, :class:`bool` and :class:" "`range` are not subclassable and will throw an error during Enum creation if " "used as the mix-in type." msgstr "" -#: howto/enum.rst:885 +#: howto/enum.rst:905 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " "additional type, all the members must have values of that type, e.g. :class:" @@ -716,169 +1360,227 @@ msgid "" "methods and don't specify another type." msgstr "" -#: howto/enum.rst:889 +#: howto/enum.rst:909 msgid "" -"When another data type is mixed in, the :attr:`value` attribute is *not the " -"same* as the enum member itself, although it is equivalent and will compare " -"equal." +"When another data type is mixed in, the :attr:`~Enum.value` attribute is " +"*not the same* as the enum member itself, although it is equivalent and will " +"compare equal." msgstr "" -#: howto/enum.rst:892 +#: howto/enum.rst:912 msgid "" -"A ``data type`` is a mixin that defines :meth:`__new__`, or a :class:" +"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:" "`~dataclasses.dataclass`" msgstr "" -#: howto/enum.rst:894 +#: howto/enum.rst:914 msgid "" "%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" -"`__str__` and :meth:`__repr__` respectively; other codes (such as ``%i`` or " -"``%h`` for IntEnum) treat the enum member as its mixed-in type." +"`~object.__str__` and :meth:`~object.__repr__` respectively; other codes " +"(such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in " +"type." msgstr "" -#: howto/enum.rst:897 +#: howto/enum.rst:917 msgid "" ":ref:`Formatted string literals `, :meth:`str.format`, and :func:" -"`format` will use the enum's :meth:`__str__` method." +"`format` will use the enum's :meth:`~object.__str__` method." msgstr "" -#: howto/enum.rst:902 +#: howto/enum.rst:922 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " "designed to be drop-in replacements for existing constants, their :meth:" -"`__str__` method has been reset to their data types' :meth:`__str__` method." +"`~object.__str__` method has been reset to their data types' :meth:`~object." +"__str__` method." msgstr "" -#: howto/enum.rst:910 -msgid "When to use :meth:`__new__` vs. :meth:`__init__`" +#: howto/enum.rst:930 +msgid "When to use :meth:`~object.__new__` vs. :meth:`~object.__init__`" msgstr "" -#: howto/enum.rst:912 +#: howto/enum.rst:932 msgid "" -":meth:`__new__` must be used whenever you want to customize the actual value " -"of the :class:`Enum` member. Any other modifications may go in either :meth:" -"`__new__` or :meth:`__init__`, with :meth:`__init__` being preferred." +":meth:`~object.__new__` must be used whenever you want to customize the " +"actual value of the :class:`Enum` member. Any other modifications may go in " +"either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:" +"`~object.__init__` being preferred." msgstr "" -#: howto/enum.rst:916 +#: howto/enum.rst:936 msgid "" "For example, if you want to pass several items to the constructor, but only " "want one of them to be the value::" msgstr "" -#: howto/enum.rst:943 +#: howto/enum.rst:939 +msgid "" +">>> class Coordinate(bytes, Enum):\n" +"... \"\"\"\n" +"... Coordinate with binary codes that can be indexed by the int code.\n" +"... \"\"\"\n" +"... def __new__(cls, value, label, unit):\n" +"... obj = bytes.__new__(cls, [value])\n" +"... obj._value_ = value\n" +"... obj.label = label\n" +"... obj.unit = unit\n" +"... return obj\n" +"... PX = (0, 'P.X', 'km')\n" +"... PY = (1, 'P.Y', 'km')\n" +"... VX = (2, 'V.X', 'km/s')\n" +"... VY = (3, 'V.Y', 'km/s')\n" +"...\n" +"\n" +">>> print(Coordinate['PY'])\n" +"Coordinate.PY\n" +"\n" +">>> print(Coordinate(3))\n" +"Coordinate.VY" +msgstr "" + +#: howto/enum.rst:963 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly." msgstr "" -#: howto/enum.rst:948 +#: howto/enum.rst:968 msgid "Finer Points" msgstr "" -#: howto/enum.rst:951 +#: howto/enum.rst:971 msgid "Supported ``__dunder__`` names" msgstr "" -#: howto/enum.rst:953 +#: howto/enum.rst:973 msgid "" -":attr:`__members__` is a read-only ordered mapping of ``member_name``:" -"``member`` items. It is only available on the class." +":attr:`~enum.EnumType.__members__` is a read-only ordered mapping of " +"``member_name``:``member`` items. It is only available on the class." msgstr "" -#: howto/enum.rst:956 +#: howto/enum.rst:976 msgid "" -":meth:`__new__`, if specified, must create and return the enum members; it " -"is also a very good idea to set the member's :attr:`_value_` appropriately. " -"Once all the members are created it is no longer used." +":meth:`~object.__new__`, if specified, must create and return the enum " +"members; it is also a very good idea to set the member's :attr:`~Enum." +"_value_` appropriately. Once all the members are created it is no longer " +"used." msgstr "" -#: howto/enum.rst:962 +#: howto/enum.rst:982 msgid "Supported ``_sunder_`` names" msgstr "" -#: howto/enum.rst:964 -msgid "``_name_`` -- name of the member" +#: howto/enum.rst:984 +msgid ":attr:`~Enum._name_` -- name of the member" msgstr "" -#: howto/enum.rst:965 +#: howto/enum.rst:985 +msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" +msgstr "" + +#: howto/enum.rst:986 msgid "" -"``_value_`` -- value of the member; can be set / modified in ``__new__``" +":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " +"may be overridden" msgstr "" -#: howto/enum.rst:967 +#: howto/enum.rst:988 msgid "" -"``_missing_`` -- a lookup function used when a value is not found; may be " -"overridden" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" +"class:`str`, that will not be transformed into members, and will be removed " +"from the final class" msgstr "" -#: howto/enum.rst:969 +#: howto/enum.rst:991 msgid "" -"``_ignore_`` -- a list of names, either as a :class:`list` or a :class:" -"`str`, that will not be transformed into members, and will be removed from " -"the final class" +":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " +"an enum member; may be overridden" msgstr "" -#: howto/enum.rst:972 +#: howto/enum.rst:993 msgid "" -"``_order_`` -- used in Python 2/3 code to ensure member order is consistent " -"(class attribute, removed during class creation)" +":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " +"member." msgstr "" -#: howto/enum.rst:974 +#: howto/enum.rst:995 msgid "" -"``_generate_next_value_`` -- used by the `Functional API`_ and by :class:" -"`auto` to get an appropriate value for an enum member; may be overridden" +":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " +"existing member. See `MultiValueEnum`_ for an example." msgstr "" -#: howto/enum.rst:980 +#: howto/enum.rst:1000 msgid "" -"For standard :class:`Enum` classes the next value chosen is the last value " -"seen incremented by one." +"For standard :class:`Enum` classes the next value chosen is the highest " +"value seen incremented by one." msgstr "" -#: howto/enum.rst:983 +#: howto/enum.rst:1003 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " -"power-of-two, regardless of the last value seen." +"power-of-two." msgstr "" -#: howto/enum.rst:986 +#: howto/enum.rst:1006 +msgid "" +"Prior versions would use the last seen value instead of the highest value." +msgstr "" + +#: howto/enum.rst:1009 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "" -#: howto/enum.rst:987 +#: howto/enum.rst:1010 msgid "``_ignore_``" msgstr "" -#: howto/enum.rst:989 +#: howto/enum.rst:1011 +msgid "``_add_alias_``, ``_add_value_alias_``" +msgstr "" + +#: howto/enum.rst:1013 msgid "" -"To help keep Python 2 / Python 3 code in sync an :attr:`_order_` attribute " -"can be provided. It will be checked against the actual order of the " -"enumeration and raise an error if the two do not match::" +"To help keep Python 2 / Python 3 code in sync an :attr:`~Enum._order_` " +"attribute can be provided. It will be checked against the actual order of " +"the enumeration and raise an error if the two do not match::" msgstr "" -#: howto/enum.rst:1007 +#: howto/enum.rst:1017 msgid "" -"In Python 2 code the :attr:`_order_` attribute is necessary as definition " -"order is lost before it can be recorded." +">>> class Color(Enum):\n" +"... _order_ = 'RED GREEN BLUE'\n" +"... RED = 1\n" +"... BLUE = 3\n" +"... GREEN = 2\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"TypeError: member order does not match _order_:\n" +" ['RED', 'BLUE', 'GREEN']\n" +" ['RED', 'GREEN', 'BLUE']" msgstr "" -#: howto/enum.rst:1012 +#: howto/enum.rst:1031 +msgid "" +"In Python 2 code the :attr:`~Enum._order_` attribute is necessary as " +"definition order is lost before it can be recorded." +msgstr "" + +#: howto/enum.rst:1036 msgid "_Private__names" msgstr "" -#: howto/enum.rst:1014 +#: howto/enum.rst:1038 msgid "" ":ref:`Private names ` are not converted to enum " "members, but remain normal attributes." msgstr "" -#: howto/enum.rst:1021 +#: howto/enum.rst:1045 msgid "``Enum`` member type" msgstr "" -#: howto/enum.rst:1023 +#: howto/enum.rst:1047 msgid "" "Enum members are instances of their enum class, and are normally accessed as " "``EnumClass.member``. In certain situations, such as writing custom enum " @@ -888,22 +1590,31 @@ msgid "" "strongly recommended." msgstr "" -#: howto/enum.rst:1034 +#: howto/enum.rst:1058 msgid "Creating members that are mixed with other data types" msgstr "" -#: howto/enum.rst:1036 +#: howto/enum.rst:1060 msgid "" "When subclassing other data types, such as :class:`int` or :class:`str`, " "with an :class:`Enum`, all values after the ``=`` are passed to that data " "type's constructor. For example::" msgstr "" -#: howto/enum.rst:1048 +#: howto/enum.rst:1064 +msgid "" +">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" +"... example = '11', 16 # so x='11' and base=16\n" +"...\n" +">>> MyEnum.example.value # and hex(11) is...\n" +"17" +msgstr "" + +#: howto/enum.rst:1072 msgid "Boolean value of ``Enum`` classes and members" msgstr "" -#: howto/enum.rst:1050 +#: howto/enum.rst:1074 msgid "" "Enum classes that are mixed with non-:class:`Enum` types (such as :class:" "`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " @@ -912,152 +1623,253 @@ msgid "" "your class::" msgstr "" -#: howto/enum.rst:1059 +#: howto/enum.rst:1080 +msgid "" +"def __bool__(self):\n" +" return bool(self.value)" +msgstr "" + +#: howto/enum.rst:1083 msgid "Plain :class:`Enum` classes always evaluate as :data:`True`." msgstr "" -#: howto/enum.rst:1063 +#: howto/enum.rst:1087 msgid "``Enum`` classes with methods" msgstr "" -#: howto/enum.rst:1065 +#: howto/enum.rst:1089 msgid "" "If you give your enum subclass extra methods, like the `Planet`_ class " "below, those methods will show up in a :func:`dir` of the member, but not of " "the class::" msgstr "" -#: howto/enum.rst:1076 +#: howto/enum.rst:1093 +msgid "" +">>> dir(Planet)\n" +"['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " +"'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" +">>> dir(Planet.EARTH)\n" +"['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " +"'surface_gravity', 'value']" +msgstr "" + +#: howto/enum.rst:1100 msgid "Combining members of ``Flag``" msgstr "" -#: howto/enum.rst:1078 +#: howto/enum.rst:1102 msgid "" "Iterating over a combination of :class:`Flag` members will only return the " "members that are comprised of a single bit::" msgstr "" -#: howto/enum.rst:1096 +#: howto/enum.rst:1105 +msgid "" +">>> class Color(Flag):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"... MAGENTA = RED | BLUE\n" +"... YELLOW = RED | GREEN\n" +"... CYAN = GREEN | BLUE\n" +"...\n" +">>> Color(3) # named combination\n" +"\n" +">>> Color(7) # not named combination\n" +"" +msgstr "" + +#: howto/enum.rst:1120 msgid "``Flag`` and ``IntFlag`` minutia" msgstr "" -#: howto/enum.rst:1098 +#: howto/enum.rst:1122 msgid "Using the following snippet for our examples::" msgstr "" -#: howto/enum.rst:1109 +#: howto/enum.rst:1124 +msgid "" +">>> class Color(IntFlag):\n" +"... BLACK = 0\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 4\n" +"... PURPLE = RED | BLUE\n" +"... WHITE = RED | GREEN | BLUE\n" +"..." +msgstr "" + +#: howto/enum.rst:1133 msgid "the following are true:" msgstr "" -#: howto/enum.rst:1111 +#: howto/enum.rst:1135 msgid "single-bit flags are canonical" msgstr "" -#: howto/enum.rst:1112 +#: howto/enum.rst:1136 msgid "multi-bit and zero-bit flags are aliases" msgstr "" -#: howto/enum.rst:1113 +#: howto/enum.rst:1137 msgid "only canonical flags are returned during iteration::" msgstr "" -#: howto/enum.rst:1118 +#: howto/enum.rst:1139 +msgid "" +">>> list(Color.WHITE)\n" +"[, , ]" +msgstr "" + +#: howto/enum.rst:1142 msgid "" "negating a flag or flag set returns a new flag/flag set with the " "corresponding positive integer value::" msgstr "" -#: howto/enum.rst:1127 +#: howto/enum.rst:1145 +msgid "" +">>> Color.BLUE\n" +"\n" +"\n" +">>> ~Color.BLUE\n" +"" +msgstr "" + +#: howto/enum.rst:1151 msgid "names of pseudo-flags are constructed from their members' names::" msgstr "" -#: howto/enum.rst:1132 +#: howto/enum.rst:1153 +msgid "" +">>> (Color.RED | Color.GREEN).name\n" +"'RED|GREEN'\n" +"\n" +">>> class Perm(IntFlag):\n" +"... R = 4\n" +"... W = 2\n" +"... X = 1\n" +"...\n" +">>> (Perm.R & Perm.W).name is None # effectively Perm(0)\n" +"True" +msgstr "" + +#: howto/enum.rst:1164 msgid "multi-bit flags, aka aliases, can be returned from operations::" msgstr "" -#: howto/enum.rst:1143 +#: howto/enum.rst:1166 +msgid "" +">>> Color.RED | Color.BLUE\n" +"\n" +"\n" +">>> Color(7) # or Color(-1)\n" +"\n" +"\n" +">>> Color(0)\n" +"" +msgstr "" + +#: howto/enum.rst:1175 msgid "" "membership / containment checking: zero-valued flags are always considered " "to be contained::" msgstr "" -#: howto/enum.rst:1149 +#: howto/enum.rst:1178 +msgid "" +">>> Color.BLACK in Color.WHITE\n" +"True" +msgstr "" + +#: howto/enum.rst:1181 msgid "" "otherwise, only if all bits of one flag are in the other flag will True be " "returned::" msgstr "" -#: howto/enum.rst:1158 +#: howto/enum.rst:1184 +msgid "" +">>> Color.PURPLE in Color.WHITE\n" +"True\n" +"\n" +">>> Color.GREEN in Color.PURPLE\n" +"False" +msgstr "" + +#: howto/enum.rst:1190 msgid "" "There is a new boundary mechanism that controls how out-of-range / invalid " "bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" msgstr "" -#: howto/enum.rst:1161 +#: howto/enum.rst:1193 msgid "STRICT --> raises an exception when presented with invalid values" msgstr "" -#: howto/enum.rst:1162 +#: howto/enum.rst:1194 msgid "CONFORM --> discards any invalid bits" msgstr "" -#: howto/enum.rst:1163 +#: howto/enum.rst:1195 msgid "EJECT --> lose Flag status and become a normal int with the given value" msgstr "" -#: howto/enum.rst:1164 +#: howto/enum.rst:1196 msgid "KEEP --> keep the extra bits" msgstr "" -#: howto/enum.rst:1166 +#: howto/enum.rst:1198 msgid "keeps Flag status and extra bits" msgstr "" -#: howto/enum.rst:1167 +#: howto/enum.rst:1199 msgid "extra bits do not show up in iteration" msgstr "" -#: howto/enum.rst:1168 +#: howto/enum.rst:1200 msgid "extra bits do show up in repr() and str()" msgstr "" -#: howto/enum.rst:1170 +#: howto/enum.rst:1202 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " "``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." "Options`` for an example of when ``KEEP`` is needed)." msgstr "" -#: howto/enum.rst:1178 +#: howto/enum.rst:1210 msgid "How are Enums and Flags different?" msgstr "" -#: howto/enum.rst:1180 +#: howto/enum.rst:1212 msgid "" "Enums have a custom metaclass that affects many aspects of both derived :" "class:`Enum` classes and their instances (members)." msgstr "" -#: howto/enum.rst:1185 +#: howto/enum.rst:1217 msgid "Enum Classes" msgstr "" -#: howto/enum.rst:1187 +#: howto/enum.rst:1219 msgid "" "The :class:`EnumType` metaclass is responsible for providing the :meth:" -"`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that " -"allow one to do things with an :class:`Enum` class that fail on a typical " -"class, such as ``list(Color)`` or ``some_enum_var in Color``. :class:" -"`EnumType` is responsible for ensuring that various other methods on the " -"final :class:`Enum` class are correct (such as :meth:`__new__`, :meth:" -"`__getnewargs__`, :meth:`__str__` and :meth:`__repr__`)." +"`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " +"and other methods that allow one to do things with an :class:`Enum` class " +"that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " +"Color``. :class:`EnumType` is responsible for ensuring that various other " +"methods on the final :class:`Enum` class are correct (such as :meth:`~object." +"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" +"`~object.__repr__`)." msgstr "" -#: howto/enum.rst:1196 +#: howto/enum.rst:1228 msgid "Flag Classes" msgstr "" -#: howto/enum.rst:1198 +#: howto/enum.rst:1230 msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " @@ -1066,50 +1878,68 @@ msgid "" "considered an alias." msgstr "" -#: howto/enum.rst:1204 +#: howto/enum.rst:1236 msgid "Enum Members (aka instances)" msgstr "" -#: howto/enum.rst:1206 +#: howto/enum.rst:1238 msgid "" "The most interesting thing about enum members is that they are singletons. :" "class:`EnumType` creates them all while it is creating the enum class " -"itself, and then puts a custom :meth:`__new__` in place to ensure that no " -"new ones are ever instantiated by returning only the existing member " +"itself, and then puts a custom :meth:`~object.__new__` in place to ensure " +"that no new ones are ever instantiated by returning only the existing member " "instances." msgstr "" -#: howto/enum.rst:1212 +#: howto/enum.rst:1244 msgid "Flag Members" msgstr "" -#: howto/enum.rst:1214 +#: howto/enum.rst:1246 msgid "" "Flag members can be iterated over just like the :class:`Flag` class, and " "only the canonical members will be returned. For example::" msgstr "" -#: howto/enum.rst:1220 +#: howto/enum.rst:1249 +msgid "" +">>> list(Color)\n" +"[, , ]" +msgstr "" + +#: howto/enum.rst:1252 msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)" msgstr "" -#: howto/enum.rst:1222 +#: howto/enum.rst:1254 msgid "" "Inverting a flag member returns the corresponding positive value, rather " "than a negative value --- for example::" msgstr "" -#: howto/enum.rst:1228 +#: howto/enum.rst:1257 +msgid "" +">>> ~Color.RED\n" +"" +msgstr "" + +#: howto/enum.rst:1260 msgid "" "Flag members have a length corresponding to the number of power-of-two " "values they contain. For example::" msgstr "" -#: howto/enum.rst:1238 +#: howto/enum.rst:1263 +msgid "" +">>> len(Color.PURPLE)\n" +"2" +msgstr "" + +#: howto/enum.rst:1270 msgid "Enum Cookbook" msgstr "" -#: howto/enum.rst:1241 +#: howto/enum.rst:1273 msgid "" "While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" "class:`IntFlag` are expected to cover the majority of use-cases, they cannot " @@ -1117,155 +1947,378 @@ msgid "" "that can be used directly, or as examples for creating one's own." msgstr "" -#: howto/enum.rst:1248 +#: howto/enum.rst:1280 msgid "Omitting values" msgstr "" -#: howto/enum.rst:1250 +#: howto/enum.rst:1282 msgid "" "In many use-cases, one doesn't care what the actual value of an enumeration " "is. There are several ways to define this type of simple enumeration:" msgstr "" -#: howto/enum.rst:1253 +#: howto/enum.rst:1285 msgid "use instances of :class:`auto` for the value" msgstr "" -#: howto/enum.rst:1254 +#: howto/enum.rst:1286 msgid "use instances of :class:`object` as the value" msgstr "" -#: howto/enum.rst:1255 +#: howto/enum.rst:1287 msgid "use a descriptive string as the value" msgstr "" -#: howto/enum.rst:1256 +#: howto/enum.rst:1288 msgid "" -"use a tuple as the value and a custom :meth:`__new__` to replace the tuple " -"with an :class:`int` value" +"use a tuple as the value and a custom :meth:`~object.__new__` to replace the " +"tuple with an :class:`int` value" msgstr "" -#: howto/enum.rst:1259 +#: howto/enum.rst:1291 msgid "" "Using any of these methods signifies to the user that these values are not " "important, and also enables one to add, remove, or reorder members without " "having to renumber the remaining members." msgstr "" -#: howto/enum.rst:1265 +#: howto/enum.rst:1297 msgid "Using :class:`auto`" msgstr "" -#: howto/enum.rst:1267 +#: howto/enum.rst:1299 msgid "Using :class:`auto` would look like::" msgstr "" -#: howto/enum.rst:1279 +#: howto/enum.rst:1301 +msgid "" +">>> class Color(Enum):\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"...\n" +">>> Color.GREEN\n" +"" +msgstr "" + +#: howto/enum.rst:1311 msgid "Using :class:`object`" msgstr "" -#: howto/enum.rst:1281 +#: howto/enum.rst:1313 msgid "Using :class:`object` would look like::" msgstr "" -#: howto/enum.rst:1291 +#: howto/enum.rst:1315 +msgid "" +">>> class Color(Enum):\n" +"... RED = object()\n" +"... GREEN = object()\n" +"... BLUE = object()\n" +"...\n" +">>> Color.GREEN\n" +">" +msgstr "" + +#: howto/enum.rst:1323 msgid "" "This is also a good example of why you might want to write your own :meth:" -"`__repr__`::" +"`~object.__repr__`::" msgstr "" -#: howto/enum.rst:1307 +#: howto/enum.rst:1326 +msgid "" +">>> class Color(Enum):\n" +"... RED = object()\n" +"... GREEN = object()\n" +"... BLUE = object()\n" +"... def __repr__(self):\n" +"... return \"<%s.%s>\" % (self.__class__.__name__, self._name_)\n" +"...\n" +">>> Color.GREEN\n" +"" +msgstr "" + +#: howto/enum.rst:1339 msgid "Using a descriptive string" msgstr "" -#: howto/enum.rst:1309 +#: howto/enum.rst:1341 msgid "Using a string as the value would look like::" msgstr "" -#: howto/enum.rst:1321 -msgid "Using a custom :meth:`__new__`" +#: howto/enum.rst:1343 +msgid "" +">>> class Color(Enum):\n" +"... RED = 'stop'\n" +"... GREEN = 'go'\n" +"... BLUE = 'too fast!'\n" +"...\n" +">>> Color.GREEN\n" +"" +msgstr "" + +#: howto/enum.rst:1353 +msgid "Using a custom :meth:`~object.__new__`" msgstr "" -#: howto/enum.rst:1323 -msgid "Using an auto-numbering :meth:`__new__` would look like::" +#: howto/enum.rst:1355 +msgid "Using an auto-numbering :meth:`~object.__new__` would look like::" +msgstr "" + +#: howto/enum.rst:1357 +msgid "" +">>> class AutoNumber(Enum):\n" +"... def __new__(cls):\n" +"... value = len(cls.__members__) + 1\n" +"... obj = object.__new__(cls)\n" +"... obj._value_ = value\n" +"... return obj\n" +"...\n" +">>> class Color(AutoNumber):\n" +"... RED = ()\n" +"... GREEN = ()\n" +"... BLUE = ()\n" +"...\n" +">>> Color.GREEN\n" +"" msgstr "" -#: howto/enum.rst:1340 +#: howto/enum.rst:1372 msgid "" "To make a more general purpose ``AutoNumber``, add ``*args`` to the " "signature::" msgstr "" -#: howto/enum.rst:1350 +#: howto/enum.rst:1374 +msgid "" +">>> class AutoNumber(Enum):\n" +"... def __new__(cls, *args): # this is the only change from above\n" +"... value = len(cls.__members__) + 1\n" +"... obj = object.__new__(cls)\n" +"... obj._value_ = value\n" +"... return obj\n" +"..." +msgstr "" + +#: howto/enum.rst:1382 msgid "" "Then when you inherit from ``AutoNumber`` you can write your own " "``__init__`` to handle any extra arguments::" msgstr "" -#: howto/enum.rst:1369 +#: howto/enum.rst:1385 msgid "" -"The :meth:`__new__` method, if defined, is used during creation of the Enum " -"members; it is then replaced by Enum's :meth:`__new__` which is used after " -"class creation for lookup of existing members." +">>> class Swatch(AutoNumber):\n" +"... def __init__(self, pantone='unknown'):\n" +"... self.pantone = pantone\n" +"... AUBURN = '3497'\n" +"... SEA_GREEN = '1246'\n" +"... BLEACHED_CORAL = () # New color, no Pantone code yet!\n" +"...\n" +">>> Swatch.SEA_GREEN\n" +"\n" +">>> Swatch.SEA_GREEN.pantone\n" +"'1246'\n" +">>> Swatch.BLEACHED_CORAL.pantone\n" +"'unknown'" msgstr "" -#: howto/enum.rst:1375 +#: howto/enum.rst:1401 +msgid "" +"The :meth:`~object.__new__` method, if defined, is used during creation of " +"the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " +"which is used after class creation for lookup of existing members." +msgstr "" + +#: howto/enum.rst:1407 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly -- e.g.::" msgstr "" -#: howto/enum.rst:1382 +#: howto/enum.rst:1410 +msgid "obj = int.__new__(cls, value)" +msgstr "" + +#: howto/enum.rst:1414 msgid "OrderedEnum" msgstr "" -#: howto/enum.rst:1384 +#: howto/enum.rst:1416 msgid "" "An ordered enumeration that is not based on :class:`IntEnum` and so " "maintains the normal :class:`Enum` invariants (such as not being comparable " "to other enumerations)::" msgstr "" -#: howto/enum.rst:1418 +#: howto/enum.rst:1420 +msgid "" +">>> class OrderedEnum(Enum):\n" +"... def __ge__(self, other):\n" +"... if self.__class__ is other.__class__:\n" +"... return self.value >= other.value\n" +"... return NotImplemented\n" +"... def __gt__(self, other):\n" +"... if self.__class__ is other.__class__:\n" +"... return self.value > other.value\n" +"... return NotImplemented\n" +"... def __le__(self, other):\n" +"... if self.__class__ is other.__class__:\n" +"... return self.value <= other.value\n" +"... return NotImplemented\n" +"... def __lt__(self, other):\n" +"... if self.__class__ is other.__class__:\n" +"... return self.value < other.value\n" +"... return NotImplemented\n" +"...\n" +">>> class Grade(OrderedEnum):\n" +"... A = 5\n" +"... B = 4\n" +"... C = 3\n" +"... D = 2\n" +"... F = 1\n" +"...\n" +">>> Grade.C < Grade.A\n" +"True" +msgstr "" + +#: howto/enum.rst:1450 msgid "DuplicateFreeEnum" msgstr "" -#: howto/enum.rst:1420 +#: howto/enum.rst:1452 msgid "" "Raises an error if a duplicate member value is found instead of creating an " "alias::" msgstr "" -#: howto/enum.rst:1445 +#: howto/enum.rst:1455 +msgid "" +">>> class DuplicateFreeEnum(Enum):\n" +"... def __init__(self, *args):\n" +"... cls = self.__class__\n" +"... if any(self.value == e.value for e in cls):\n" +"... a = self.name\n" +"... e = cls(self.value).name\n" +"... raise ValueError(\n" +"... \"aliases not allowed in DuplicateFreeEnum: %r --> " +"%r\"\n" +"... % (a, e))\n" +"...\n" +">>> class Color(DuplicateFreeEnum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"... GRENE = 2\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" +msgstr "" + +#: howto/enum.rst:1477 msgid "" "This is a useful example for subclassing Enum to add or change other " "behaviors as well as disallowing aliases. If the only desired change is " "disallowing aliases, the :func:`unique` decorator can be used instead." msgstr "" -#: howto/enum.rst:1451 +#: howto/enum.rst:1483 +msgid "MultiValueEnum" +msgstr "" + +#: howto/enum.rst:1485 +msgid "Supports having more than one value per member::" +msgstr "" + +#: howto/enum.rst:1487 +msgid "" +">>> class MultiValueEnum(Enum):\n" +"... def __new__(cls, value, *values):\n" +"... self = object.__new__(cls)\n" +"... self._value_ = value\n" +"... for v in values:\n" +"... self._add_value_alias_(v)\n" +"... return self\n" +"...\n" +">>> class DType(MultiValueEnum):\n" +"... float32 = 'f', 8\n" +"... double64 = 'd', 9\n" +"...\n" +">>> DType('f')\n" +"\n" +">>> DType(9)\n" +"" +msgstr "" + +#: howto/enum.rst:1506 msgid "Planet" msgstr "" -#: howto/enum.rst:1453 +#: howto/enum.rst:1508 +msgid "" +"If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value " +"of the enum member will be passed to those methods::" +msgstr "" + +#: howto/enum.rst:1511 msgid "" -"If :meth:`__new__` or :meth:`__init__` is defined, the value of the enum " -"member will be passed to those methods::" +">>> class Planet(Enum):\n" +"... MERCURY = (3.303e+23, 2.4397e6)\n" +"... VENUS = (4.869e+24, 6.0518e6)\n" +"... EARTH = (5.976e+24, 6.37814e6)\n" +"... MARS = (6.421e+23, 3.3972e6)\n" +"... JUPITER = (1.9e+27, 7.1492e7)\n" +"... SATURN = (5.688e+26, 6.0268e7)\n" +"... URANUS = (8.686e+25, 2.5559e7)\n" +"... NEPTUNE = (1.024e+26, 2.4746e7)\n" +"... def __init__(self, mass, radius):\n" +"... self.mass = mass # in kilograms\n" +"... self.radius = radius # in meters\n" +"... @property\n" +"... def surface_gravity(self):\n" +"... # universal gravitational constant (m3 kg-1 s-2)\n" +"... G = 6.67300E-11\n" +"... return G * self.mass / (self.radius * self.radius)\n" +"...\n" +">>> Planet.EARTH.value\n" +"(5.976e+24, 6378140.0)\n" +">>> Planet.EARTH.surface_gravity\n" +"9.802652743337129" msgstr "" -#: howto/enum.rst:1482 +#: howto/enum.rst:1537 msgid "TimePeriod" msgstr "" -#: howto/enum.rst:1484 -msgid "An example to show the :attr:`_ignore_` attribute in use::" +#: howto/enum.rst:1539 +msgid "An example to show the :attr:`~Enum._ignore_` attribute in use::" +msgstr "" + +#: howto/enum.rst:1541 +msgid "" +">>> from datetime import timedelta\n" +">>> class Period(timedelta, Enum):\n" +"... \"different lengths of time\"\n" +"... _ignore_ = 'Period i'\n" +"... Period = vars()\n" +"... for i in range(367):\n" +"... Period['day_%d' % i] = i\n" +"...\n" +">>> list(Period)[:2]\n" +"[, ]\n" +">>> list(Period)[-2:]\n" +"[, ]" msgstr "" -#: howto/enum.rst:1503 +#: howto/enum.rst:1558 msgid "Subclassing EnumType" msgstr "" -#: howto/enum.rst:1505 +#: howto/enum.rst:1560 msgid "" "While most enum needs can be met by customizing :class:`Enum` subclasses, " "either with class decorators or custom functions, :class:`EnumType` can be " diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po new file mode 100644 index 00000000..6dd6933c --- /dev/null +++ b/howto/free-threading-extensions.po @@ -0,0 +1,687 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: howto/free-threading-extensions.rst:7 +msgid "C API Extension Support for Free Threading" +msgstr "" + +#: howto/free-threading-extensions.rst:9 +msgid "" +"Starting with the 3.13 release, CPython has support for running with the :" +"term:`global interpreter lock` (GIL) disabled in a configuration called :" +"term:`free threading`. This document describes how to adapt C API " +"extensions to support free threading." +msgstr "" + +#: howto/free-threading-extensions.rst:16 +msgid "Identifying the Free-Threaded Build in C" +msgstr "" + +#: howto/free-threading-extensions.rst:18 +msgid "" +"The CPython C API exposes the ``Py_GIL_DISABLED`` macro: in the free-" +"threaded build it's defined to ``1``, and in the regular build it's not " +"defined. You can use it to enable code that only runs under the free-" +"threaded build::" +msgstr "" + +#: howto/free-threading-extensions.rst:22 +msgid "" +"#ifdef Py_GIL_DISABLED\n" +"/* code that only runs in the free-threaded build */\n" +"#endif" +msgstr "" + +#: howto/free-threading-extensions.rst:28 +msgid "" +"On Windows, this macro is not defined automatically, but must be specified " +"to the compiler when building. The :func:`sysconfig.get_config_var` function " +"can be used to determine whether the current running interpreter had the " +"macro defined." +msgstr "" + +#: howto/free-threading-extensions.rst:35 +msgid "Module Initialization" +msgstr "" + +#: howto/free-threading-extensions.rst:37 +msgid "" +"Extension modules need to explicitly indicate that they support running with " +"the GIL disabled; otherwise importing the extension will raise a warning and " +"enable the GIL at runtime." +msgstr "" + +#: howto/free-threading-extensions.rst:41 +msgid "" +"There are two ways to indicate that an extension module supports running " +"with the GIL disabled depending on whether the extension uses multi-phase or " +"single-phase initialization." +msgstr "" + +#: howto/free-threading-extensions.rst:46 +msgid "Multi-Phase Initialization" +msgstr "" + +#: howto/free-threading-extensions.rst:48 +msgid "" +"Extensions that use multi-phase initialization (i.e., :c:func:" +"`PyModuleDef_Init`) should add a :c:data:`Py_mod_gil` slot in the module " +"definition. If your extension supports older versions of CPython, you " +"should guard the slot with a :c:data:`PY_VERSION_HEX` check." +msgstr "" + +#: howto/free-threading-extensions.rst:55 +msgid "" +"static struct PyModuleDef_Slot module_slots[] = {\n" +" ...\n" +"#if PY_VERSION_HEX >= 0x030D0000\n" +" {Py_mod_gil, Py_MOD_GIL_NOT_USED},\n" +"#endif\n" +" {0, NULL}\n" +"};\n" +"\n" +"static struct PyModuleDef moduledef = {\n" +" PyModuleDef_HEAD_INIT,\n" +" .m_slots = module_slots,\n" +" ...\n" +"};" +msgstr "" + +#: howto/free-threading-extensions.rst:71 +msgid "Single-Phase Initialization" +msgstr "" + +#: howto/free-threading-extensions.rst:73 +msgid "" +"Extensions that use single-phase initialization (i.e., :c:func:" +"`PyModule_Create`) should call :c:func:`PyUnstable_Module_SetGIL` to " +"indicate that they support running with the GIL disabled. The function is " +"only defined in the free-threaded build, so you should guard the call with " +"``#ifdef Py_GIL_DISABLED`` to avoid compilation errors in the regular build." +msgstr "" + +#: howto/free-threading-extensions.rst:81 +msgid "" +"static struct PyModuleDef moduledef = {\n" +" PyModuleDef_HEAD_INIT,\n" +" ...\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_mymodule(void)\n" +"{\n" +" PyObject *m = PyModule_Create(&moduledef);\n" +" if (m == NULL) {\n" +" return NULL;\n" +" }\n" +"#ifdef Py_GIL_DISABLED\n" +" PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);\n" +"#endif\n" +" return m;\n" +"}" +msgstr "" + +#: howto/free-threading-extensions.rst:101 +msgid "General API Guidelines" +msgstr "" + +#: howto/free-threading-extensions.rst:103 +msgid "Most of the C API is thread-safe, but there are some exceptions." +msgstr "" + +#: howto/free-threading-extensions.rst:105 +msgid "" +"**Struct Fields**: Accessing fields in Python C API objects or structs " +"directly is not thread-safe if the field may be concurrently modified." +msgstr "" + +#: howto/free-threading-extensions.rst:107 +msgid "" +"**Macros**: Accessor macros like :c:macro:`PyList_GET_ITEM`, :c:macro:" +"`PyList_SET_ITEM`, and macros like :c:macro:`PySequence_Fast_GET_SIZE` that " +"use the object returned by :c:func:`PySequence_Fast` do not perform any " +"error checking or locking. These macros are not thread-safe if the container " +"object may be modified concurrently." +msgstr "" + +#: howto/free-threading-extensions.rst:113 +msgid "" +"**Borrowed References**: C API functions that return :term:`borrowed " +"references ` may not be thread-safe if the containing " +"object is modified concurrently. See the section on :ref:`borrowed " +"references ` for more information." +msgstr "" + +#: howto/free-threading-extensions.rst:120 +msgid "Container Thread Safety" +msgstr "" + +#: howto/free-threading-extensions.rst:122 +msgid "" +"Containers like :c:struct:`PyListObject`, :c:struct:`PyDictObject`, and :c:" +"struct:`PySetObject` perform internal locking in the free-threaded build. " +"For example, the :c:func:`PyList_Append` will lock the list before appending " +"an item." +msgstr "" + +#: howto/free-threading-extensions.rst:130 +msgid "``PyDict_Next``" +msgstr "" + +#: howto/free-threading-extensions.rst:132 +msgid "" +"A notable exception is :c:func:`PyDict_Next`, which does not lock the " +"dictionary. You should use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to protect " +"the dictionary while iterating over it if the dictionary may be concurrently " +"modified::" +msgstr "" + +#: howto/free-threading-extensions.rst:137 +msgid "" +"Py_BEGIN_CRITICAL_SECTION(dict);\n" +"PyObject *key, *value;\n" +"Py_ssize_t pos = 0;\n" +"while (PyDict_Next(dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" +msgstr "" + +#: howto/free-threading-extensions.rst:147 +msgid "Borrowed References" +msgstr "" + +#: howto/free-threading-extensions.rst:151 +msgid "" +"Some C API functions return :term:`borrowed references `. These APIs are not thread-safe if the containing object is " +"modified concurrently. For example, it's not safe to use :c:func:" +"`PyList_GetItem` if the list may be modified concurrently." +msgstr "" + +#: howto/free-threading-extensions.rst:156 +msgid "" +"The following table lists some borrowed reference APIs and their " +"replacements that return :term:`strong references `." +msgstr "" + +#: howto/free-threading-extensions.rst:160 +msgid "Borrowed reference API" +msgstr "" + +#: howto/free-threading-extensions.rst:160 +msgid "Strong reference API" +msgstr "" + +#: howto/free-threading-extensions.rst:162 +msgid ":c:func:`PyList_GetItem`" +msgstr "" + +#: howto/free-threading-extensions.rst:162 +#: howto/free-threading-extensions.rst:164 +msgid ":c:func:`PyList_GetItemRef`" +msgstr "" + +#: howto/free-threading-extensions.rst:164 +msgid ":c:func:`PyList_GET_ITEM`" +msgstr "" + +#: howto/free-threading-extensions.rst:166 +msgid ":c:func:`PyDict_GetItem`" +msgstr "" + +#: howto/free-threading-extensions.rst:166 +#: howto/free-threading-extensions.rst:168 +msgid ":c:func:`PyDict_GetItemRef`" +msgstr "" + +#: howto/free-threading-extensions.rst:168 +msgid ":c:func:`PyDict_GetItemWithError`" +msgstr "" + +#: howto/free-threading-extensions.rst:170 +msgid ":c:func:`PyDict_GetItemString`" +msgstr "" + +#: howto/free-threading-extensions.rst:170 +msgid ":c:func:`PyDict_GetItemStringRef`" +msgstr "" + +#: howto/free-threading-extensions.rst:172 +msgid ":c:func:`PyDict_SetDefault`" +msgstr "" + +#: howto/free-threading-extensions.rst:172 +msgid ":c:func:`PyDict_SetDefaultRef`" +msgstr "" + +#: howto/free-threading-extensions.rst:174 +msgid ":c:func:`PyDict_Next`" +msgstr "" + +#: howto/free-threading-extensions.rst:174 +msgid "none (see :ref:`PyDict_Next`)" +msgstr "" + +#: howto/free-threading-extensions.rst:176 +msgid ":c:func:`PyWeakref_GetObject`" +msgstr "" + +#: howto/free-threading-extensions.rst:176 +#: howto/free-threading-extensions.rst:178 +msgid ":c:func:`PyWeakref_GetRef`" +msgstr "" + +#: howto/free-threading-extensions.rst:178 +msgid ":c:func:`PyWeakref_GET_OBJECT`" +msgstr "" + +#: howto/free-threading-extensions.rst:180 +msgid ":c:func:`PyImport_AddModule`" +msgstr "" + +#: howto/free-threading-extensions.rst:180 +msgid ":c:func:`PyImport_AddModuleRef`" +msgstr "" + +#: howto/free-threading-extensions.rst:182 +msgid ":c:func:`PyCell_GET`" +msgstr "" + +#: howto/free-threading-extensions.rst:182 +msgid ":c:func:`PyCell_Get`" +msgstr "" + +#: howto/free-threading-extensions.rst:185 +msgid "" +"Not all APIs that return borrowed references are problematic. For example, :" +"c:func:`PyTuple_GetItem` is safe because tuples are immutable. Similarly, " +"not all uses of the above APIs are problematic. For example, :c:func:" +"`PyDict_GetItem` is often used for parsing keyword argument dictionaries in " +"function calls; those keyword argument dictionaries are effectively private " +"(not accessible by other threads), so using borrowed references in that " +"context is safe." +msgstr "" + +#: howto/free-threading-extensions.rst:193 +msgid "" +"Some of these functions were added in Python 3.13. You can use the " +"`pythoncapi-compat `_ package " +"to provide implementations of these functions for older Python versions." +msgstr "" + +#: howto/free-threading-extensions.rst:201 +msgid "Memory Allocation APIs" +msgstr "" + +#: howto/free-threading-extensions.rst:203 +msgid "" +"Python's memory management C API provides functions in three different :ref:" +"`allocation domains `: \"raw\", \"mem\", and \"object\". " +"For thread-safety, the free-threaded build requires that only Python objects " +"are allocated using the object domain, and that all Python objects are " +"allocated using that domain. This differs from the prior Python versions, " +"where this was only a best practice and not a hard requirement." +msgstr "" + +#: howto/free-threading-extensions.rst:212 +msgid "" +"Search for uses of :c:func:`PyObject_Malloc` in your extension and check " +"that the allocated memory is used for Python objects. Use :c:func:" +"`PyMem_Malloc` to allocate buffers instead of :c:func:`PyObject_Malloc`." +msgstr "" + +#: howto/free-threading-extensions.rst:219 +msgid "Thread State and GIL APIs" +msgstr "" + +#: howto/free-threading-extensions.rst:221 +msgid "" +"Python provides a set of functions and macros to manage thread state and the " +"GIL, such as:" +msgstr "" + +#: howto/free-threading-extensions.rst:224 +msgid ":c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`" +msgstr "" + +#: howto/free-threading-extensions.rst:225 +msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`" +msgstr "" + +#: howto/free-threading-extensions.rst:226 +msgid ":c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS`" +msgstr "" + +#: howto/free-threading-extensions.rst:228 +msgid "" +"These functions should still be used in the free-threaded build to manage " +"thread state even when the :term:`GIL` is disabled. For example, if you " +"create a thread outside of Python, you must call :c:func:`PyGILState_Ensure` " +"before calling into the Python API to ensure that the thread has a valid " +"Python thread state." +msgstr "" + +#: howto/free-threading-extensions.rst:234 +msgid "" +"You should continue to call :c:func:`PyEval_SaveThread` or :c:macro:" +"`Py_BEGIN_ALLOW_THREADS` around blocking operations, such as I/O or lock " +"acquisitions, to allow other threads to run the :term:`cyclic garbage " +"collector `." +msgstr "" + +#: howto/free-threading-extensions.rst:241 +msgid "Protecting Internal Extension State" +msgstr "" + +#: howto/free-threading-extensions.rst:243 +msgid "" +"Your extension may have internal state that was previously protected by the " +"GIL. You may need to add locking to protect this state. The approach will " +"depend on your extension, but some common patterns include:" +msgstr "" + +#: howto/free-threading-extensions.rst:247 +msgid "" +"**Caches**: global caches are a common source of shared state. Consider " +"using a lock to protect the cache or disabling it in the free-threaded build " +"if the cache is not critical for performance." +msgstr "" + +#: howto/free-threading-extensions.rst:250 +msgid "" +"**Global State**: global state may need to be protected by a lock or moved " +"to thread local storage. C11 and C++11 provide the ``thread_local`` or " +"``_Thread_local`` for `thread-local storage `_." +msgstr "" + +#: howto/free-threading-extensions.rst:257 +msgid "Critical Sections" +msgstr "" + +#: howto/free-threading-extensions.rst:261 +msgid "" +"In the free-threaded build, CPython provides a mechanism called \"critical " +"sections\" to protect data that would otherwise be protected by the GIL. " +"While extension authors may not interact with the internal critical section " +"implementation directly, understanding their behavior is crucial when using " +"certain C API functions or managing shared state in the free-threaded build." +msgstr "" + +#: howto/free-threading-extensions.rst:268 +msgid "What Are Critical Sections?" +msgstr "" + +#: howto/free-threading-extensions.rst:270 +msgid "" +"Conceptually, critical sections act as a deadlock avoidance layer built on " +"top of simple mutexes. Each thread maintains a stack of active critical " +"sections. When a thread needs to acquire a lock associated with a critical " +"section (e.g., implicitly when calling a thread-safe C API function like :c:" +"func:`PyDict_SetItem`, or explicitly using macros), it attempts to acquire " +"the underlying mutex." +msgstr "" + +#: howto/free-threading-extensions.rst:278 +msgid "Using Critical Sections" +msgstr "" + +#: howto/free-threading-extensions.rst:280 +msgid "The primary APIs for using critical sections are:" +msgstr "" + +#: howto/free-threading-extensions.rst:282 +msgid "" +":c:macro:`Py_BEGIN_CRITICAL_SECTION` and :c:macro:`Py_END_CRITICAL_SECTION` " +"- For locking a single object" +msgstr "" + +#: howto/free-threading-extensions.rst:285 +msgid "" +":c:macro:`Py_BEGIN_CRITICAL_SECTION2` and :c:macro:" +"`Py_END_CRITICAL_SECTION2` - For locking two objects simultaneously" +msgstr "" + +#: howto/free-threading-extensions.rst:288 +msgid "" +"These macros must be used in matching pairs and must appear in the same C " +"scope, since they establish a new local scope. These macros are no-ops in " +"non-free-threaded builds, so they can be safely added to code that needs to " +"support both build types." +msgstr "" + +#: howto/free-threading-extensions.rst:293 +msgid "" +"A common use of a critical section would be to lock an object while " +"accessing an internal attribute of it. For example, if an extension type " +"has an internal count field, you could use a critical section while reading " +"or writing that field::" +msgstr "" + +#: howto/free-threading-extensions.rst:298 +msgid "" +"// read the count, returns new reference to internal count value\n" +"PyObject *result;\n" +"Py_BEGIN_CRITICAL_SECTION(obj);\n" +"result = Py_NewRef(obj->count);\n" +"Py_END_CRITICAL_SECTION();\n" +"return result;\n" +"\n" +"// write the count, consumes reference from new_count\n" +"Py_BEGIN_CRITICAL_SECTION(obj);\n" +"obj->count = new_count;\n" +"Py_END_CRITICAL_SECTION();" +msgstr "" + +#: howto/free-threading-extensions.rst:312 +msgid "How Critical Sections Work" +msgstr "" + +#: howto/free-threading-extensions.rst:314 +msgid "" +"Unlike traditional locks, critical sections do not guarantee exclusive " +"access throughout their entire duration. If a thread would block while " +"holding a critical section (e.g., by acquiring another lock or performing I/" +"O), the critical section is temporarily suspended—all locks are released—and " +"then resumed when the blocking operation completes." +msgstr "" + +#: howto/free-threading-extensions.rst:320 +msgid "" +"This behavior is similar to what happens with the GIL when a thread makes a " +"blocking call. The key differences are:" +msgstr "" + +#: howto/free-threading-extensions.rst:323 +msgid "Critical sections operate on a per-object basis rather than globally" +msgstr "" + +#: howto/free-threading-extensions.rst:325 +msgid "" +"Critical sections follow a stack discipline within each thread (the " +"\"begin\" and \"end\" macros enforce this since they must be paired and " +"within the same scope)" +msgstr "" + +#: howto/free-threading-extensions.rst:328 +msgid "" +"Critical sections automatically release and reacquire locks around potential " +"blocking operations" +msgstr "" + +#: howto/free-threading-extensions.rst:332 +msgid "Deadlock Avoidance" +msgstr "" + +#: howto/free-threading-extensions.rst:334 +msgid "Critical sections help avoid deadlocks in two ways:" +msgstr "" + +#: howto/free-threading-extensions.rst:336 +msgid "" +"If a thread tries to acquire a lock that's already held by another thread, " +"it first suspends all of its active critical sections, temporarily releasing " +"their locks" +msgstr "" + +#: howto/free-threading-extensions.rst:340 +msgid "" +"When the blocking operation completes, only the top-most critical section is " +"reacquired first" +msgstr "" + +#: howto/free-threading-extensions.rst:343 +msgid "" +"This means you cannot rely on nested critical sections to lock multiple " +"objects at once, as the inner critical section may suspend the outer ones. " +"Instead, use :c:macro:`Py_BEGIN_CRITICAL_SECTION2` to lock two objects " +"simultaneously." +msgstr "" + +#: howto/free-threading-extensions.rst:347 +msgid "" +"Note that the locks described above are only :c:type:`PyMutex` based locks. " +"The critical section implementation does not know about or affect other " +"locking mechanisms that might be in use, like POSIX mutexes. Also note that " +"while blocking on any :c:type:`PyMutex` causes the critical sections to be " +"suspended, only the mutexes that are part of the critical sections are " +"released. If :c:type:`PyMutex` is used without a critical section, it will " +"not be released and therefore does not get the same deadlock avoidance." +msgstr "" + +#: howto/free-threading-extensions.rst:356 +msgid "Important Considerations" +msgstr "" + +#: howto/free-threading-extensions.rst:358 +msgid "" +"Critical sections may temporarily release their locks, allowing other " +"threads to modify the protected data. Be careful about making assumptions " +"about the state of the data after operations that might block." +msgstr "" + +#: howto/free-threading-extensions.rst:362 +msgid "" +"Because locks can be temporarily released (suspended), entering a critical " +"section does not guarantee exclusive access to the protected resource " +"throughout the section's duration. If code within a critical section calls " +"another function that blocks (e.g., acquires another lock, performs blocking " +"I/O), all locks held by the thread via critical sections will be released. " +"This is similar to how the GIL can be released during blocking calls." +msgstr "" + +#: howto/free-threading-extensions.rst:369 +msgid "" +"Only the lock(s) associated with the most recently entered (top-most) " +"critical section are guaranteed to be held at any given time. Locks for " +"outer, nested critical sections might have been suspended." +msgstr "" + +#: howto/free-threading-extensions.rst:373 +msgid "" +"You can lock at most two objects simultaneously with these APIs. If you need " +"to lock more objects, you'll need to restructure your code." +msgstr "" + +#: howto/free-threading-extensions.rst:376 +msgid "" +"While critical sections will not deadlock if you attempt to lock the same " +"object twice, they are less efficient than purpose-built reentrant locks for " +"this use case." +msgstr "" + +#: howto/free-threading-extensions.rst:380 +msgid "" +"When using :c:macro:`Py_BEGIN_CRITICAL_SECTION2`, the order of the objects " +"doesn't affect correctness (the implementation handles deadlock avoidance), " +"but it's good practice to always lock objects in a consistent order." +msgstr "" + +#: howto/free-threading-extensions.rst:384 +msgid "" +"Remember that the critical section macros are primarily for protecting " +"access to *Python objects* that might be involved in internal CPython " +"operations susceptible to the deadlock scenarios described above. For " +"protecting purely internal extension state, standard mutexes or other " +"synchronization primitives might be more appropriate." +msgstr "" + +#: howto/free-threading-extensions.rst:392 +msgid "Building Extensions for the Free-Threaded Build" +msgstr "" + +#: howto/free-threading-extensions.rst:394 +msgid "" +"C API extensions need to be built specifically for the free-threaded build. " +"The wheels, shared libraries, and binaries are indicated by a ``t`` suffix." +msgstr "" + +#: howto/free-threading-extensions.rst:397 +msgid "" +"`pypa/manylinux `_ supports the free-" +"threaded build, with the ``t`` suffix, such as ``python3.13t``." +msgstr "" + +#: howto/free-threading-extensions.rst:399 +msgid "" +"`pypa/cibuildwheel `_ supports the " +"free-threaded build on Python 3.13 and 3.14. On Python 3.14, free-threaded " +"wheels will be built by default. On Python 3.13, you will need to set " +"`CIBW_ENABLE to cpython-freethreading `_." +msgstr "" + +#: howto/free-threading-extensions.rst:405 +msgid "Limited C API and Stable ABI" +msgstr "" + +#: howto/free-threading-extensions.rst:407 +msgid "" +"The free-threaded build does not currently support the :ref:`Limited C API " +"` or the stable ABI. If you use `setuptools `_ to build your extension and " +"currently set ``py_limited_api=True`` you can use ``py_limited_api=not " +"sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` to opt out of the limited " +"API when building with the free-threaded build." +msgstr "" + +#: howto/free-threading-extensions.rst:415 +msgid "" +"You will need to build separate wheels specifically for the free-threaded " +"build. If you currently use the stable ABI, you can continue to build a " +"single wheel for multiple non-free-threaded Python versions." +msgstr "" + +#: howto/free-threading-extensions.rst:421 +msgid "Windows" +msgstr "" + +#: howto/free-threading-extensions.rst:423 +msgid "" +"Due to a limitation of the official Windows installer, you will need to " +"manually define ``Py_GIL_DISABLED=1`` when building extensions from source." +msgstr "" + +#: howto/free-threading-extensions.rst:428 +msgid "" +"`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for " +"extension authors." +msgstr "" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po new file mode 100644 index 00000000..c4e4b9e5 --- /dev/null +++ b/howto/free-threading-python.po @@ -0,0 +1,261 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: howto/free-threading-python.rst:5 +msgid "Python support for free threading" +msgstr "" + +#: howto/free-threading-python.rst:7 +msgid "" +"Starting with the 3.13 release, CPython has support for a build of Python " +"called :term:`free threading` where the :term:`global interpreter lock` " +"(GIL) is disabled. Free-threaded execution allows for full utilization of " +"the available processing power by running threads in parallel on available " +"CPU cores. While not all software will benefit from this automatically, " +"programs designed with threading in mind will run faster on multi-core " +"hardware." +msgstr "" + +#: howto/free-threading-python.rst:14 +msgid "" +"Some third-party packages, in particular ones with an :term:`extension " +"module`, may not be ready for use in a free-threaded build, and will re-" +"enable the :term:`GIL`." +msgstr "" + +#: howto/free-threading-python.rst:18 +msgid "" +"This document describes the implications of free threading for Python code. " +"See :ref:`freethreading-extensions-howto` for information on how to write C " +"extensions that support the free-threaded build." +msgstr "" + +#: howto/free-threading-python.rst:24 +msgid "" +":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an " +"overall description of free-threaded Python." +msgstr "" + +#: howto/free-threading-python.rst:29 +msgid "Installation" +msgstr "" + +#: howto/free-threading-python.rst:31 +msgid "" +"Starting with Python 3.13, the official macOS and Windows installers " +"optionally support installing free-threaded Python binaries. The installers " +"are available at https://www.python.org/downloads/." +msgstr "" + +#: howto/free-threading-python.rst:35 +msgid "" +"For information on other platforms, see the `Installing a Free-Threaded " +"Python `_, a " +"community-maintained installation guide for installing free-threaded Python." +msgstr "" + +#: howto/free-threading-python.rst:39 +msgid "" +"When building CPython from source, the :option:`--disable-gil` configure " +"option should be used to build a free-threaded Python interpreter." +msgstr "" + +#: howto/free-threading-python.rst:44 +msgid "Identifying free-threaded Python" +msgstr "" + +#: howto/free-threading-python.rst:46 +msgid "" +"To check if the current interpreter supports free-threading, :option:`python " +"-VV <-V>` and :data:`sys.version` contain \"free-threading build\". The new :" +"func:`sys._is_gil_enabled` function can be used to check whether the GIL is " +"actually disabled in the running process." +msgstr "" + +#: howto/free-threading-python.rst:51 +msgid "" +"The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable " +"can be used to determine whether the build supports free threading. If the " +"variable is set to ``1``, then the build supports free threading. This is " +"the recommended mechanism for decisions related to the build configuration." +msgstr "" + +#: howto/free-threading-python.rst:58 +msgid "The global interpreter lock in free-threaded Python" +msgstr "" + +#: howto/free-threading-python.rst:60 +msgid "" +"Free-threaded builds of CPython support optionally running with the GIL " +"enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or " +"the command-line option :option:`-X gil`." +msgstr "" + +#: howto/free-threading-python.rst:64 +msgid "" +"The GIL may also automatically be enabled when importing a C-API extension " +"module that is not explicitly marked as supporting free threading. A " +"warning will be printed in this case." +msgstr "" + +#: howto/free-threading-python.rst:68 +msgid "" +"In addition to individual package documentation, the following websites " +"track the status of popular packages support for free threading:" +msgstr "" + +#: howto/free-threading-python.rst:71 +msgid "https://py-free-threading.github.io/tracking/" +msgstr "" + +#: howto/free-threading-python.rst:72 +msgid "https://hugovk.github.io/free-threaded-wheels/" +msgstr "" + +#: howto/free-threading-python.rst:76 +msgid "Thread safety" +msgstr "" + +#: howto/free-threading-python.rst:78 +msgid "" +"The free-threaded build of CPython aims to provide similar thread-safety " +"behavior at the Python level to the default GIL-enabled build. Built-in " +"types like :class:`dict`, :class:`list`, and :class:`set` use internal locks " +"to protect against concurrent modifications in ways that behave similarly to " +"the GIL. However, Python has not historically guaranteed specific behavior " +"for concurrent modifications to these built-in types, so this should be " +"treated as a description of the current implementation, not a guarantee of " +"current or future behavior." +msgstr "" + +#: howto/free-threading-python.rst:89 +msgid "" +"It's recommended to use the :class:`threading.Lock` or other synchronization " +"primitives instead of relying on the internal locks of built-in types, when " +"possible." +msgstr "" + +#: howto/free-threading-python.rst:95 +msgid "Known limitations" +msgstr "" + +#: howto/free-threading-python.rst:97 +msgid "" +"This section describes known limitations of the free-threaded CPython build." +msgstr "" + +#: howto/free-threading-python.rst:100 +msgid "Immortalization" +msgstr "" + +#: howto/free-threading-python.rst:102 +msgid "" +"In the free-threaded build, some objects are :term:`immortal`. Immortal " +"objects are not deallocated and have reference counts that are never " +"modified. This is done to avoid reference count contention that would " +"prevent efficient multi-threaded scaling." +msgstr "" + +#: howto/free-threading-python.rst:107 +msgid "As of the 3.14 release, immortalization is limited to:" +msgstr "" + +#: howto/free-threading-python.rst:109 +msgid "" +"Code constants: numeric literals, string literals, and tuple literals " +"composed of other constants." +msgstr "" + +#: howto/free-threading-python.rst:111 +msgid "Strings interned by :func:`sys.intern`." +msgstr "" + +#: howto/free-threading-python.rst:115 +msgid "Frame objects" +msgstr "" + +#: howto/free-threading-python.rst:117 +msgid "" +"It is not safe to access :attr:`frame.f_locals` from a :ref:`frame ` object if that frame is currently executing in another thread, and " +"doing so may crash the interpreter." +msgstr "" + +#: howto/free-threading-python.rst:123 +msgid "Iterators" +msgstr "" + +#: howto/free-threading-python.rst:125 +msgid "" +"It is generally not thread-safe to access the same iterator object from " +"multiple threads concurrently, and threads may see duplicate or missing " +"elements." +msgstr "" + +#: howto/free-threading-python.rst:131 +msgid "Single-threaded performance" +msgstr "" + +#: howto/free-threading-python.rst:133 +msgid "" +"The free-threaded build has additional overhead when executing Python code " +"compared to the default GIL-enabled build. The amount of overhead depends " +"on the workload and hardware. On the pyperformance benchmark suite, the " +"average overhead ranges from about 1% on macOS aarch64 to 8% on x86-64 Linux " +"systems." +msgstr "" + +#: howto/free-threading-python.rst:141 +msgid "Behavioral changes" +msgstr "" + +#: howto/free-threading-python.rst:143 +msgid "" +"This section describes CPython behavioural changes with the free-threaded " +"build." +msgstr "" + +#: howto/free-threading-python.rst:148 +msgid "Context variables" +msgstr "" + +#: howto/free-threading-python.rst:150 +msgid "" +"In the free-threaded build, the flag :data:`~sys.flags." +"thread_inherit_context` is set to true by default which causes threads " +"created with :class:`threading.Thread` to start with a copy of the :class:" +"`~contextvars.Context()` of the caller of :meth:`~threading.Thread.start`. " +"In the default GIL-enabled build, the flag defaults to false so threads " +"start with an empty :class:`~contextvars.Context()`." +msgstr "" + +#: howto/free-threading-python.rst:160 +msgid "Warning filters" +msgstr "" + +#: howto/free-threading-python.rst:162 +msgid "" +"In the free-threaded build, the flag :data:`~sys.flags." +"context_aware_warnings` is set to true by default. In the default GIL-" +"enabled build, the flag defaults to false. If the flag is true then the :" +"class:`warnings.catch_warnings` context manager uses a context variable for " +"warning filters. If the flag is false then :class:`~warnings." +"catch_warnings` modifies the global filters list, which is not thread-safe. " +"See the :mod:`warnings` module for more details." +msgstr "" diff --git a/howto/functional.po b/howto/functional.po index a71d4ca1..299815ba 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -8,15 +8,16 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: howto/functional.rst:3 +#: howto/functional.rst:5 msgid "Functional Programming HOWTO" msgstr "" @@ -24,19 +25,19 @@ msgstr "" msgid "Author" msgstr "" -#: howto/functional.rst:5 -msgid "A. M. Kuchling" +#: howto/functional.rst:7 +msgid "\\A. M. Kuchling" msgstr "" #: howto/functional.rst:0 msgid "Release" msgstr "" -#: howto/functional.rst:6 +#: howto/functional.rst:8 msgid "0.32" msgstr "" -#: howto/functional.rst:8 +#: howto/functional.rst:10 msgid "" "In this document, we'll take a tour of Python's features suitable for " "implementing programs in a functional style. After an introduction to the " @@ -45,30 +46,30 @@ msgid "" "such as :mod:`itertools` and :mod:`functools`." msgstr "" -#: howto/functional.rst:16 +#: howto/functional.rst:18 msgid "Introduction" msgstr "" -#: howto/functional.rst:18 +#: howto/functional.rst:20 msgid "" "This section explains the basic concept of functional programming; if you're " "just interested in learning about Python language features, skip to the next " "section on :ref:`functional-howto-iterators`." msgstr "" -#: howto/functional.rst:22 +#: howto/functional.rst:24 msgid "" "Programming languages support decomposing problems in several different ways:" msgstr "" -#: howto/functional.rst:24 +#: howto/functional.rst:26 msgid "" "Most programming languages are **procedural**: programs are lists of " "instructions that tell the computer what to do with the program's input. C, " "Pascal, and even Unix shells are procedural languages." msgstr "" -#: howto/functional.rst:28 +#: howto/functional.rst:30 msgid "" "In **declarative** languages, you write a specification that describes the " "problem to be solved, and the language implementation figures out how to " @@ -78,7 +79,7 @@ msgid "" "indexes, which subclauses should be performed first, etc." msgstr "" -#: howto/functional.rst:35 +#: howto/functional.rst:37 msgid "" "**Object-oriented** programs manipulate collections of objects. Objects " "have internal state and support methods that query or modify this internal " @@ -87,7 +88,7 @@ msgid "" "force the use of object-oriented features." msgstr "" -#: howto/functional.rst:41 +#: howto/functional.rst:43 msgid "" "**Functional** programming decomposes a problem into a set of functions. " "Ideally, functions only take inputs and produce outputs, and don't have any " @@ -96,7 +97,7 @@ msgid "" "other variants) and Haskell." msgstr "" -#: howto/functional.rst:47 +#: howto/functional.rst:49 msgid "" "The designers of some computer languages choose to emphasize one particular " "approach to programming. This often makes it difficult to write programs " @@ -109,7 +110,7 @@ msgid "" "functional, for example." msgstr "" -#: howto/functional.rst:58 +#: howto/functional.rst:60 msgid "" "In a functional program, input flows through a set of functions. Each " "function operates on its input and produces some output. Functional style " @@ -120,7 +121,7 @@ msgid "" "runs; every function's output must only depend on its input." msgstr "" -#: howto/functional.rst:66 +#: howto/functional.rst:68 msgid "" "Some languages are very strict about purity and don't even have assignment " "statements such as ``a=3`` or ``c = a + b``, but it's difficult to avoid all " @@ -131,7 +132,7 @@ msgid "" "for a second." msgstr "" -#: howto/functional.rst:73 +#: howto/functional.rst:75 msgid "" "Python programs written in functional style usually won't go to the extreme " "of avoiding all I/O or all assignments; instead, they'll provide a " @@ -141,7 +142,7 @@ msgid "" "other side effects." msgstr "" -#: howto/functional.rst:79 +#: howto/functional.rst:81 msgid "" "Functional programming can be considered the opposite of object-oriented " "programming. Objects are little capsules containing some internal state " @@ -153,40 +154,40 @@ msgid "" "objects in your application (e-mail messages, transactions, etc.)." msgstr "" -#: howto/functional.rst:88 +#: howto/functional.rst:90 msgid "" "Functional design may seem like an odd constraint to work under. Why should " "you avoid objects and side effects? There are theoretical and practical " "advantages to the functional style:" msgstr "" -#: howto/functional.rst:92 +#: howto/functional.rst:94 msgid "Formal provability." msgstr "" -#: howto/functional.rst:93 +#: howto/functional.rst:95 msgid "Modularity." msgstr "" -#: howto/functional.rst:94 +#: howto/functional.rst:96 msgid "Composability." msgstr "" -#: howto/functional.rst:95 +#: howto/functional.rst:97 msgid "Ease of debugging and testing." msgstr "" -#: howto/functional.rst:99 +#: howto/functional.rst:101 msgid "Formal provability" msgstr "" -#: howto/functional.rst:101 +#: howto/functional.rst:103 msgid "" "A theoretical benefit is that it's easier to construct a mathematical proof " "that a functional program is correct." msgstr "" -#: howto/functional.rst:104 +#: howto/functional.rst:106 msgid "" "For a long time researchers have been interested in finding ways to " "mathematically prove programs correct. This is different from testing a " @@ -196,7 +197,7 @@ msgid "" "the right result for all possible inputs." msgstr "" -#: howto/functional.rst:111 +#: howto/functional.rst:113 msgid "" "The technique used to prove programs correct is to write down " "**invariants**, properties of the input data and of the program's variables " @@ -207,7 +208,7 @@ msgid "" "invariants should match the desired conditions on the program's output." msgstr "" -#: howto/functional.rst:119 +#: howto/functional.rst:121 msgid "" "Functional programming's avoidance of assignments arose because assignments " "are difficult to handle with this technique; assignments can break " @@ -215,7 +216,7 @@ msgid "" "invariants that can be propagated onward." msgstr "" -#: howto/functional.rst:124 +#: howto/functional.rst:126 msgid "" "Unfortunately, proving programs correct is largely impractical and not " "relevant to Python software. Even trivial programs require proofs that are " @@ -227,11 +228,11 @@ msgid "" "wrongly believe you've proved the program correct." msgstr "" -#: howto/functional.rst:135 +#: howto/functional.rst:137 msgid "Modularity" msgstr "" -#: howto/functional.rst:137 +#: howto/functional.rst:139 msgid "" "A more practical benefit of functional programming is that it forces you to " "break apart your problem into small pieces. Programs are more modular as a " @@ -240,15 +241,15 @@ msgid "" "Small functions are also easier to read and to check for errors." msgstr "" -#: howto/functional.rst:145 +#: howto/functional.rst:147 msgid "Ease of debugging and testing" msgstr "" -#: howto/functional.rst:147 +#: howto/functional.rst:149 msgid "Testing and debugging a functional-style program is easier." msgstr "" -#: howto/functional.rst:149 +#: howto/functional.rst:151 msgid "" "Debugging is simplified because functions are generally small and clearly " "specified. When a program doesn't work, each function is an interface point " @@ -257,7 +258,7 @@ msgid "" "responsible for a bug." msgstr "" -#: howto/functional.rst:154 +#: howto/functional.rst:156 msgid "" "Testing is easier because each function is a potential subject for a unit " "test. Functions don't depend on system state that needs to be replicated " @@ -265,11 +266,11 @@ msgid "" "and then check that the output matches expectations." msgstr "" -#: howto/functional.rst:161 +#: howto/functional.rst:163 msgid "Composability" msgstr "" -#: howto/functional.rst:163 +#: howto/functional.rst:165 msgid "" "As you work on a functional-style program, you'll write a number of " "functions with varying inputs and outputs. Some of these functions will be " @@ -280,24 +281,24 @@ msgid "" "different situations." msgstr "" -#: howto/functional.rst:170 +#: howto/functional.rst:172 msgid "" "Over time you'll form a personal library of utilities. Often you'll " "assemble new programs by arranging existing functions in a new configuration " "and writing a few functions specialized for the current task." msgstr "" -#: howto/functional.rst:178 +#: howto/functional.rst:180 msgid "Iterators" msgstr "" -#: howto/functional.rst:180 +#: howto/functional.rst:182 msgid "" "I'll start by looking at a Python language feature that's an important " "foundation for writing functional-style programs: iterators." msgstr "" -#: howto/functional.rst:183 +#: howto/functional.rst:185 msgid "" "An iterator is an object representing a stream of data; this object returns " "the data one element at a time. A Python iterator must support a method " @@ -308,7 +309,7 @@ msgid "" "reasonable to write an iterator that produces an infinite stream of data." msgstr "" -#: howto/functional.rst:191 +#: howto/functional.rst:193 msgid "" "The built-in :func:`iter` function takes an arbitrary object and tries to " "return an iterator that will return the object's contents or elements, " @@ -318,11 +319,11 @@ msgid "" "an iterator for it." msgstr "" -#: howto/functional.rst:198 +#: howto/functional.rst:200 msgid "You can experiment with the iteration interface manually:" msgstr "" -#: howto/functional.rst:216 +#: howto/functional.rst:218 msgid "" "Python expects iterable objects in several different contexts, the most " "important being the :keyword:`for` statement. In the statement ``for X in " @@ -330,19 +331,28 @@ msgid "" "an iterator. These two statements are equivalent::" msgstr "" -#: howto/functional.rst:228 +#: howto/functional.rst:224 +msgid "" +"for i in iter(obj):\n" +" print(i)\n" +"\n" +"for i in obj:\n" +" print(i)" +msgstr "" + +#: howto/functional.rst:230 msgid "" "Iterators can be materialized as lists or tuples by using the :func:`list` " "or :func:`tuple` constructor functions:" msgstr "" -#: howto/functional.rst:237 +#: howto/functional.rst:239 msgid "" "Sequence unpacking also supports iterators: if you know an iterator will " "return N elements, you can unpack them into an N-tuple:" msgstr "" -#: howto/functional.rst:246 +#: howto/functional.rst:248 msgid "" "Built-in functions such as :func:`max` and :func:`min` can take a single " "iterator argument and will return the largest or smallest element. The " @@ -353,7 +363,7 @@ msgid "" "stream, the ``\"in\"`` and ``\"not in\"`` operators won't return either." msgstr "" -#: howto/functional.rst:254 +#: howto/functional.rst:256 msgid "" "Note that you can only go forward in an iterator; there's no way to get the " "previous element, reset the iterator, or make a copy of it. Iterator " @@ -364,31 +374,51 @@ msgid "" "new iterator." msgstr "" -#: howto/functional.rst:264 +#: howto/functional.rst:266 msgid "Data Types That Support Iterators" msgstr "" -#: howto/functional.rst:266 +#: howto/functional.rst:268 msgid "" "We've already seen how lists and tuples support iterators. In fact, any " "Python sequence type, such as strings, will automatically support creation " "of an iterator." msgstr "" -#: howto/functional.rst:270 +#: howto/functional.rst:272 msgid "" "Calling :func:`iter` on a dictionary returns an iterator that will loop over " "the dictionary's keys::" msgstr "" -#: howto/functional.rst:290 +#: howto/functional.rst:275 +msgid "" +">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" +"... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" +">>> for key in m:\n" +"... print(key, m[key])\n" +"Jan 1\n" +"Feb 2\n" +"Mar 3\n" +"Apr 4\n" +"May 5\n" +"Jun 6\n" +"Jul 7\n" +"Aug 8\n" +"Sep 9\n" +"Oct 10\n" +"Nov 11\n" +"Dec 12" +msgstr "" + +#: howto/functional.rst:292 msgid "" "Note that starting with Python 3.7, dictionary iteration order is guaranteed " "to be the same as the insertion order. In earlier versions, the behaviour " "was unspecified and could vary between implementations." msgstr "" -#: howto/functional.rst:294 +#: howto/functional.rst:296 msgid "" "Applying :func:`iter` to a dictionary always loops over the keys, but " "dictionaries have methods that return other iterators. If you want to " @@ -396,30 +426,50 @@ msgid "" "`~dict.values` or :meth:`~dict.items` methods to get an appropriate iterator." msgstr "" -#: howto/functional.rst:300 +#: howto/functional.rst:302 msgid "" "The :func:`dict` constructor can accept an iterator that returns a finite " "stream of ``(key, value)`` tuples:" msgstr "" -#: howto/functional.rst:307 +#: howto/functional.rst:309 msgid "" "Files also support iteration by calling the :meth:`~io.TextIOBase.readline` " "method until there are no more lines in the file. This means you can read " "each line of a file like this::" msgstr "" -#: howto/functional.rst:315 +#: howto/functional.rst:313 +msgid "" +"for line in file:\n" +" # do something for each line\n" +" ..." +msgstr "" + +#: howto/functional.rst:317 msgid "" "Sets can take their contents from an iterable and let you iterate over the " "set's elements::" msgstr "" -#: howto/functional.rst:331 -msgid "Generator expressions and list comprehensions" +#: howto/functional.rst:320 +msgid "" +">>> S = {2, 3, 5, 7, 11, 13}\n" +">>> for i in S:\n" +"... print(i)\n" +"2\n" +"3\n" +"5\n" +"7\n" +"11\n" +"13" msgstr "" #: howto/functional.rst:333 +msgid "Generator expressions and list comprehensions" +msgstr "" + +#: howto/functional.rst:335 msgid "" "Two common operations on an iterator's output are 1) performing some " "operation for every element, 2) selecting a subset of elements that meet " @@ -428,7 +478,7 @@ msgid "" "containing a given substring." msgstr "" -#: howto/functional.rst:339 +#: howto/functional.rst:341 msgid "" "List comprehensions and generator expressions (short form: \"listcomps\" and " "\"genexps\") are a concise notation for such operations, borrowed from the " @@ -436,12 +486,29 @@ msgid "" "strip all the whitespace from a stream of strings with the following code::" msgstr "" -#: howto/functional.rst:352 +#: howto/functional.rst:346 +msgid "" +">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" +"\n" +">>> # Generator expression -- returns iterator\n" +">>> stripped_iter = (line.strip() for line in line_list)\n" +"\n" +">>> # List comprehension -- returns list\n" +">>> stripped_list = [line.strip() for line in line_list]" +msgstr "" + +#: howto/functional.rst:354 msgid "" "You can select only certain elements by adding an ``\"if\"`` condition::" msgstr "" -#: howto/functional.rst:357 +#: howto/functional.rst:356 +msgid "" +">>> stripped_list = [line.strip() for line in line_list\n" +"... if line != \"\"]" +msgstr "" + +#: howto/functional.rst:359 msgid "" "With a list comprehension, you get back a Python list; ``stripped_list`` is " "a list containing the resulting lines, not an iterator. Generator " @@ -452,20 +519,33 @@ msgid "" "preferable in these situations." msgstr "" -#: howto/functional.rst:364 +#: howto/functional.rst:366 msgid "" "Generator expressions are surrounded by parentheses (\"()\") and list " "comprehensions are surrounded by square brackets (\"[]\"). Generator " "expressions have the form::" msgstr "" -#: howto/functional.rst:378 +#: howto/functional.rst:370 +msgid "" +"( expression for expr in sequence1\n" +" if condition1\n" +" for expr2 in sequence2\n" +" if condition2\n" +" for expr3 in sequence3\n" +" ...\n" +" if condition3\n" +" for exprN in sequenceN\n" +" if conditionN )" +msgstr "" + +#: howto/functional.rst:380 msgid "" "Again, for a list comprehension only the outside brackets are different " "(square brackets instead of parentheses)." msgstr "" -#: howto/functional.rst:381 +#: howto/functional.rst:383 msgid "" "The elements of the generated output will be the successive values of " "``expression``. The ``if`` clauses are all optional; if present, " @@ -473,7 +553,7 @@ msgid "" "is true." msgstr "" -#: howto/functional.rst:385 +#: howto/functional.rst:387 msgid "" "Generator expressions always have to be written inside parentheses, but the " "parentheses signalling a function call also count. If you want to create an " @@ -481,6 +561,10 @@ msgid "" msgstr "" #: howto/functional.rst:391 +msgid "obj_total = sum(obj.count for obj in list_all_objects())" +msgstr "" + +#: howto/functional.rst:393 msgid "" "The ``for...in`` clauses contain the sequences to be iterated over. The " "sequences do not have to be the same length, because they are iterated over " @@ -490,13 +574,30 @@ msgid "" "``sequence2``." msgstr "" -#: howto/functional.rst:397 +#: howto/functional.rst:399 msgid "" "To put it another way, a list comprehension or generator expression is " "equivalent to the following Python code::" msgstr "" -#: howto/functional.rst:414 +#: howto/functional.rst:402 +msgid "" +"for expr1 in sequence1:\n" +" if not (condition1):\n" +" continue # Skip this element\n" +" for expr2 in sequence2:\n" +" if not (condition2):\n" +" continue # Skip this element\n" +" ...\n" +" for exprN in sequenceN:\n" +" if not (conditionN):\n" +" continue # Skip this element\n" +"\n" +" # Output the value of\n" +" # the expression." +msgstr "" + +#: howto/functional.rst:416 msgid "" "This means that when there are multiple ``for...in`` clauses but no ``if`` " "clauses, the length of the resulting output will be equal to the product of " @@ -504,25 +605,33 @@ msgid "" "output list is 9 elements long:" msgstr "" -#: howto/functional.rst:426 +#: howto/functional.rst:428 msgid "" "To avoid introducing an ambiguity into Python's grammar, if ``expression`` " "is creating a tuple, it must be surrounded with parentheses. The first list " "comprehension below is a syntax error, while the second one is correct::" msgstr "" -#: howto/functional.rst:437 -msgid "Generators" +#: howto/functional.rst:432 +msgid "" +"# Syntax error\n" +"[x, y for x in seq1 for y in seq2]\n" +"# Correct\n" +"[(x, y) for x in seq1 for y in seq2]" msgstr "" #: howto/functional.rst:439 +msgid "Generators" +msgstr "" + +#: howto/functional.rst:441 msgid "" "Generators are a special class of functions that simplify the task of " "writing iterators. Regular functions compute a value and return it, but " "generators return an iterator that returns a stream of values." msgstr "" -#: howto/functional.rst:443 +#: howto/functional.rst:445 msgid "" "You're doubtless familiar with how regular function calls work in Python or " "C. When you call a function, it gets a private namespace where its local " @@ -535,18 +644,18 @@ msgid "" "thought of as resumable functions." msgstr "" -#: howto/functional.rst:452 +#: howto/functional.rst:454 msgid "Here's the simplest example of a generator function:" msgstr "" -#: howto/functional.rst:458 +#: howto/functional.rst:460 msgid "" "Any function containing a :keyword:`yield` keyword is a generator function; " "this is detected by Python's :term:`bytecode` compiler which compiles the " "function specially as a result." msgstr "" -#: howto/functional.rst:462 +#: howto/functional.rst:464 msgid "" "When you call a generator function, it doesn't return a single value; " "instead it returns a generator object that supports the iterator protocol. " @@ -558,17 +667,17 @@ msgid "" "method, the function will resume executing." msgstr "" -#: howto/functional.rst:471 +#: howto/functional.rst:473 msgid "Here's a sample usage of the ``generate_ints()`` generator:" msgstr "" -#: howto/functional.rst:488 +#: howto/functional.rst:490 msgid "" "You could equally write ``for i in generate_ints(5)``, or ``a, b, c = " "generate_ints(3)``." msgstr "" -#: howto/functional.rst:491 +#: howto/functional.rst:493 msgid "" "Inside a generator function, ``return value`` causes " "``StopIteration(value)`` to be raised from the :meth:`~generator.__next__` " @@ -576,7 +685,7 @@ msgid "" "procession of values ends and the generator cannot yield any further values." msgstr "" -#: howto/functional.rst:496 +#: howto/functional.rst:498 msgid "" "You could achieve the effect of generators manually by writing your own " "class and storing all the local variables of the generator as instance " @@ -586,7 +695,7 @@ msgid "" "complicated generator, writing a corresponding class can be much messier." msgstr "" -#: howto/functional.rst:504 +#: howto/functional.rst:506 msgid "" "The test suite included with Python's library, :source:`Lib/test/" "test_generators.py`, contains a number of more interesting examples. Here's " @@ -594,7 +703,21 @@ msgid "" "generators recursively. ::" msgstr "" -#: howto/functional.rst:520 +#: howto/functional.rst:511 +msgid "" +"# A recursive generator that generates Tree leaves in in-order.\n" +"def inorder(t):\n" +" if t:\n" +" for x in inorder(t.left):\n" +" yield x\n" +"\n" +" yield t.label\n" +"\n" +" for x in inorder(t.right):\n" +" yield x" +msgstr "" + +#: howto/functional.rst:522 msgid "" "Two other examples in ``test_generators.py`` produce solutions for the N-" "Queens problem (placing N queens on an NxN chess board so that no queen " @@ -603,11 +726,11 @@ msgid "" "twice)." msgstr "" -#: howto/functional.rst:528 +#: howto/functional.rst:530 msgid "Passing values into a generator" msgstr "" -#: howto/functional.rst:530 +#: howto/functional.rst:532 msgid "" "In Python 2.4 and earlier, generators only produced output. Once a " "generator's code was invoked to create an iterator, there was no way to pass " @@ -617,7 +740,7 @@ msgid "" "these approaches are messy." msgstr "" -#: howto/functional.rst:537 +#: howto/functional.rst:539 msgid "" "In Python 2.5 there's a simple way to pass values into a generator. :keyword:" "`yield` became an expression, returning a value that can be assigned to a " @@ -625,6 +748,10 @@ msgid "" msgstr "" #: howto/functional.rst:543 +msgid "val = (yield i)" +msgstr "" + +#: howto/functional.rst:545 msgid "" "I recommend that you **always** put parentheses around a ``yield`` " "expression when you're doing something with the returned value, as in the " @@ -632,7 +759,7 @@ msgid "" "always add them instead of having to remember when they're needed." msgstr "" -#: howto/functional.rst:548 +#: howto/functional.rst:550 msgid "" "(:pep:`342` explains the exact rules, which are that a ``yield``-expression " "must always be parenthesized except when it occurs at the top-level " @@ -641,7 +768,7 @@ msgid "" "operation, as in ``val = (yield i) + 12``.)" msgstr "" -#: howto/functional.rst:554 +#: howto/functional.rst:556 msgid "" "Values are sent into a generator by calling its :meth:`send(value) " "` method. This method resumes the generator's code and the " @@ -649,17 +776,30 @@ msgid "" "`~generator.__next__` method is called, the ``yield`` returns ``None``." msgstr "" -#: howto/functional.rst:559 +#: howto/functional.rst:561 msgid "" "Here's a simple counter that increments by 1 and allows changing the value " "of the internal counter." msgstr "" -#: howto/functional.rst:574 +#: howto/functional.rst:564 +msgid "" +"def counter(maximum):\n" +" i = 0\n" +" while i < maximum:\n" +" val = (yield i)\n" +" # If value provided, change counter\n" +" if val is not None:\n" +" i = val\n" +" else:\n" +" i += 1" +msgstr "" + +#: howto/functional.rst:576 msgid "And here's an example of changing the counter:" msgstr "" -#: howto/functional.rst:591 +#: howto/functional.rst:593 msgid "" "Because ``yield`` will often be returning ``None``, you should always check " "for this case. Don't just use its value in expressions unless you're sure " @@ -667,22 +807,22 @@ msgid "" "resume your generator function." msgstr "" -#: howto/functional.rst:596 +#: howto/functional.rst:598 msgid "" "In addition to :meth:`~generator.send`, there are two other methods on " "generators:" msgstr "" -#: howto/functional.rst:599 +#: howto/functional.rst:601 msgid "" ":meth:`throw(value) ` is used to raise an exception inside " "the generator; the exception is raised by the ``yield`` expression where the " "generator's execution is paused." msgstr "" -#: howto/functional.rst:603 +#: howto/functional.rst:605 msgid "" -":meth:`~generator.close` raises a :exc:`GeneratorExit` exception inside the " +":meth:`~generator.close` sends a :exc:`GeneratorExit` exception to the " "generator to terminate the iteration. On receiving this exception, the " "generator's code must either raise :exc:`GeneratorExit` or :exc:" "`StopIteration`; catching the exception and doing anything else is illegal " @@ -691,20 +831,20 @@ msgid "" "collected." msgstr "" -#: howto/functional.rst:611 +#: howto/functional.rst:613 msgid "" "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I " "suggest using a ``try: ... finally:`` suite instead of catching :exc:" "`GeneratorExit`." msgstr "" -#: howto/functional.rst:614 +#: howto/functional.rst:616 msgid "" "The cumulative effect of these changes is to turn generators from one-way " "producers of information into both producers and consumers." msgstr "" -#: howto/functional.rst:617 +#: howto/functional.rst:619 msgid "" "Generators also become **coroutines**, a more generalized form of " "subroutines. Subroutines are entered at one point and exited at another " @@ -713,36 +853,36 @@ msgid "" "statements)." msgstr "" -#: howto/functional.rst:624 +#: howto/functional.rst:626 msgid "Built-in functions" msgstr "" -#: howto/functional.rst:626 +#: howto/functional.rst:628 msgid "" "Let's look in more detail at built-in functions often used with iterators." msgstr "" -#: howto/functional.rst:628 +#: howto/functional.rst:630 msgid "" "Two of Python's built-in functions, :func:`map` and :func:`filter` duplicate " "the features of generator expressions:" msgstr "" -#: howto/functional.rst:640 +#: howto/functional.rst:633 msgid "" ":func:`map(f, iterA, iterB, ...) ` returns an iterator over the sequence" msgstr "" -#: howto/functional.rst:632 +#: howto/functional.rst:634 msgid "" "``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``." msgstr "" -#: howto/functional.rst:642 +#: howto/functional.rst:644 msgid "You can of course achieve the same effect with a list comprehension." msgstr "" -#: howto/functional.rst:644 +#: howto/functional.rst:646 msgid "" ":func:`filter(predicate, iter) ` returns an iterator over all the " "sequence elements that meet a certain condition, and is similarly duplicated " @@ -751,24 +891,41 @@ msgid "" "must take a single value." msgstr "" -#: howto/functional.rst:657 +#: howto/functional.rst:659 msgid "This can also be written as a list comprehension:" msgstr "" -#: howto/functional.rst:663 +#: howto/functional.rst:665 msgid "" ":func:`enumerate(iter, start=0) ` counts off the elements in the " "iterable returning 2-tuples containing the count (from *start*) and each " "element. ::" msgstr "" -#: howto/functional.rst:673 +#: howto/functional.rst:669 +msgid "" +">>> for item in enumerate(['subject', 'verb', 'object']):\n" +"... print(item)\n" +"(0, 'subject')\n" +"(1, 'verb')\n" +"(2, 'object')" +msgstr "" + +#: howto/functional.rst:675 msgid "" ":func:`enumerate` is often used when looping through a list and recording " "the indexes at which certain conditions are met::" msgstr "" -#: howto/functional.rst:681 +#: howto/functional.rst:678 +msgid "" +"f = open('data.txt', 'r')\n" +"for i, line in enumerate(f):\n" +" if line.strip() == '':\n" +" print('Blank line at line #%i' % i)" +msgstr "" + +#: howto/functional.rst:683 msgid "" ":func:`sorted(iterable, key=None, reverse=False) ` collects all the " "elements of the iterable into a list, sorts the list, and returns the sorted " @@ -776,12 +933,25 @@ msgid "" "constructed list's :meth:`~list.sort` method. ::" msgstr "" -#: howto/functional.rst:696 +#: howto/functional.rst:688 +msgid "" +">>> import random\n" +">>> # Generate 8 random numbers between [0, 10000)\n" +">>> rand_list = random.sample(range(10000), 8)\n" +">>> rand_list\n" +"[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n" +">>> sorted(rand_list)\n" +"[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n" +">>> sorted(rand_list, reverse=True)\n" +"[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" +msgstr "" + +#: howto/functional.rst:698 msgid "" "(For a more detailed discussion of sorting, see the :ref:`sortinghowto`.)" msgstr "" -#: howto/functional.rst:699 +#: howto/functional.rst:701 msgid "" "The :func:`any(iter) ` and :func:`all(iter) ` built-ins look at " "the truth values of an iterable's contents. :func:`any` returns ``True`` if " @@ -789,13 +959,19 @@ msgid "" "``True`` if all of the elements are true values:" msgstr "" -#: howto/functional.rst:718 +#: howto/functional.rst:720 msgid "" ":func:`zip(iterA, iterB, ...) ` takes one element from each iterable " "and returns them in a tuple::" msgstr "" -#: howto/functional.rst:724 +#: howto/functional.rst:723 +msgid "" +"zip(['a', 'b', 'c'], (1, 2, 3)) =>\n" +" ('a', 1), ('b', 2), ('c', 3)" +msgstr "" + +#: howto/functional.rst:726 msgid "" "It doesn't construct an in-memory list and exhaust all the input iterators " "before returning; instead tuples are constructed and returned only if " @@ -803,56 +979,62 @@ msgid "" "evaluation `__.)" msgstr "" -#: howto/functional.rst:729 +#: howto/functional.rst:731 msgid "" "This iterator is intended to be used with iterables that are all of the same " "length. If the iterables are of different lengths, the resulting stream " "will be the same length as the shortest iterable. ::" msgstr "" -#: howto/functional.rst:736 +#: howto/functional.rst:735 +msgid "" +"zip(['a', 'b'], (1, 2, 3)) =>\n" +" ('a', 1), ('b', 2)" +msgstr "" + +#: howto/functional.rst:738 msgid "" "You should avoid doing this, though, because an element may be taken from " "the longer iterators and discarded. This means you can't go on to use the " "iterators further because you risk skipping a discarded element." msgstr "" -#: howto/functional.rst:742 +#: howto/functional.rst:744 msgid "The itertools module" msgstr "" -#: howto/functional.rst:744 +#: howto/functional.rst:746 msgid "" "The :mod:`itertools` module contains a number of commonly used iterators as " "well as functions for combining several iterators. This section will " "introduce the module's contents by showing small examples." msgstr "" -#: howto/functional.rst:748 +#: howto/functional.rst:750 msgid "The module's functions fall into a few broad classes:" msgstr "" -#: howto/functional.rst:750 +#: howto/functional.rst:752 msgid "Functions that create a new iterator based on an existing iterator." msgstr "" -#: howto/functional.rst:751 +#: howto/functional.rst:753 msgid "Functions for treating an iterator's elements as function arguments." msgstr "" -#: howto/functional.rst:752 +#: howto/functional.rst:754 msgid "Functions for selecting portions of an iterator's output." msgstr "" -#: howto/functional.rst:753 +#: howto/functional.rst:755 msgid "A function for grouping an iterator's output." msgstr "" -#: howto/functional.rst:756 +#: howto/functional.rst:758 msgid "Creating new iterators" msgstr "" -#: howto/functional.rst:758 +#: howto/functional.rst:760 msgid "" ":func:`itertools.count(start, step) ` returns an infinite " "stream of evenly spaced values. You can optionally supply the starting " @@ -860,7 +1042,17 @@ msgid "" "defaults to 1::" msgstr "" -#: howto/functional.rst:769 +#: howto/functional.rst:764 +msgid "" +"itertools.count() =>\n" +" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n" +"itertools.count(10) =>\n" +" 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n" +"itertools.count(10, 5) =>\n" +" 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ..." +msgstr "" + +#: howto/functional.rst:771 msgid "" ":func:`itertools.cycle(iter) ` saves a copy of the contents " "of a provided iterable and returns a new iterator that returns its elements " @@ -868,14 +1060,28 @@ msgid "" "infinitely. ::" msgstr "" -#: howto/functional.rst:776 +#: howto/functional.rst:775 +msgid "" +"itertools.cycle([1, 2, 3, 4, 5]) =>\n" +" 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ..." +msgstr "" + +#: howto/functional.rst:778 msgid "" ":func:`itertools.repeat(elem, [n]) ` returns the provided " "element *n* times, or returns the element endlessly if *n* is not " "provided. ::" msgstr "" -#: howto/functional.rst:784 +#: howto/functional.rst:781 +msgid "" +"itertools.repeat('abc') =>\n" +" abc, abc, abc, abc, abc, abc, abc, abc, abc, abc, ...\n" +"itertools.repeat('abc', 5) =>\n" +" abc, abc, abc, abc, abc" +msgstr "" + +#: howto/functional.rst:786 msgid "" ":func:`itertools.chain(iterA, iterB, ...) ` takes an " "arbitrary number of iterables as input, and returns all the elements of the " @@ -883,7 +1089,13 @@ msgid "" "the iterables have been exhausted. ::" msgstr "" -#: howto/functional.rst:792 +#: howto/functional.rst:791 +msgid "" +"itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\n" +" a, b, c, 1, 2, 3" +msgstr "" + +#: howto/functional.rst:794 msgid "" ":func:`itertools.islice(iter, [start], stop, [step]) ` " "returns a stream that's a slice of the iterator. With a single *stop* " @@ -894,7 +1106,17 @@ msgid "" "*step*. ::" msgstr "" -#: howto/functional.rst:806 +#: howto/functional.rst:801 +msgid "" +"itertools.islice(range(10), 8) =>\n" +" 0, 1, 2, 3, 4, 5, 6, 7\n" +"itertools.islice(range(10), 2, 8) =>\n" +" 2, 3, 4, 5, 6, 7\n" +"itertools.islice(range(10), 2, 8, 2) =>\n" +" 2, 4, 6" +msgstr "" + +#: howto/functional.rst:808 msgid "" ":func:`itertools.tee(iter, [n]) ` replicates an iterator; it " "returns *n* independent iterators that will all return the contents of the " @@ -904,11 +1126,23 @@ msgid "" "and one of the new iterators is consumed more than the others. ::" msgstr "" -#: howto/functional.rst:825 -msgid "Calling functions on elements" +#: howto/functional.rst:816 +msgid "" +"itertools.tee( itertools.count() ) =>\n" +" iterA, iterB\n" +"\n" +"where iterA ->\n" +" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n" +"\n" +"and iterB ->\n" +" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ..." msgstr "" #: howto/functional.rst:827 +msgid "Calling functions on elements" +msgstr "" + +#: howto/functional.rst:829 msgid "" "The :mod:`operator` module contains a set of functions corresponding to " "Python's operators. Some examples are :func:`operator.add(a, b) ` assumes that the " "iterable will return a stream of tuples, and calls *func* using these tuples " "as the arguments::" msgstr "" -#: howto/functional.rst:845 -msgid "Selecting elements" +#: howto/functional.rst:839 +msgid "" +"itertools.starmap(os.path.join,\n" +" [('/bin', 'python'), ('/usr', 'bin', 'java'),\n" +" ('/usr', 'bin', 'perl'), ('/usr', 'bin', 'ruby')])\n" +"=>\n" +" /bin/python, /usr/bin/java, /usr/bin/perl, /usr/bin/ruby" msgstr "" #: howto/functional.rst:847 +msgid "Selecting elements" +msgstr "" + +#: howto/functional.rst:849 msgid "" "Another group of functions chooses a subset of an iterator's elements based " "on a predicate." msgstr "" -#: howto/functional.rst:850 +#: howto/functional.rst:852 msgid "" ":func:`itertools.filterfalse(predicate, iter) ` is " "the opposite of :func:`filter`, returning all elements for which the " "predicate returns false::" msgstr "" -#: howto/functional.rst:857 +#: howto/functional.rst:856 +msgid "" +"itertools.filterfalse(is_even, itertools.count()) =>\n" +" 1, 3, 5, 7, 9, 11, 13, 15, ..." +msgstr "" + +#: howto/functional.rst:859 msgid "" ":func:`itertools.takewhile(predicate, iter) ` returns " "elements for as long as the predicate returns true. Once the predicate " "returns false, the iterator will signal the end of its results. ::" msgstr "" -#: howto/functional.rst:870 +#: howto/functional.rst:863 +msgid "" +"def less_than_10(x):\n" +" return x < 10\n" +"\n" +"itertools.takewhile(less_than_10, itertools.count()) =>\n" +" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n" +"\n" +"itertools.takewhile(is_even, itertools.count()) =>\n" +" 0" +msgstr "" + +#: howto/functional.rst:872 msgid "" ":func:`itertools.dropwhile(predicate, iter) ` discards " "elements while the predicate returns true, and then returns the rest of the " "iterable's results. ::" msgstr "" -#: howto/functional.rst:880 +#: howto/functional.rst:876 +msgid "" +"itertools.dropwhile(less_than_10, itertools.count()) =>\n" +" 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n" +"\n" +"itertools.dropwhile(is_even, itertools.count()) =>\n" +" 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..." +msgstr "" + +#: howto/functional.rst:882 msgid "" ":func:`itertools.compress(data, selectors) ` takes two " "iterators and returns only those elements of *data* for which the " @@ -963,18 +1233,38 @@ msgid "" "is exhausted::" msgstr "" -#: howto/functional.rst:889 -msgid "Combinatoric functions" +#: howto/functional.rst:886 +msgid "" +"itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n" +" 1, 2, 5" msgstr "" #: howto/functional.rst:891 +msgid "Combinatoric functions" +msgstr "" + +#: howto/functional.rst:893 msgid "" "The :func:`itertools.combinations(iterable, r) ` " "returns an iterator giving all possible *r*-tuple combinations of the " "elements contained in *iterable*. ::" msgstr "" -#: howto/functional.rst:906 +#: howto/functional.rst:897 +msgid "" +"itertools.combinations([1, 2, 3, 4, 5], 2) =>\n" +" (1, 2), (1, 3), (1, 4), (1, 5),\n" +" (2, 3), (2, 4), (2, 5),\n" +" (3, 4), (3, 5),\n" +" (4, 5)\n" +"\n" +"itertools.combinations([1, 2, 3, 4, 5], 3) =>\n" +" (1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5),\n" +" (2, 3, 4), (2, 3, 5), (2, 4, 5),\n" +" (3, 4, 5)" +msgstr "" + +#: howto/functional.rst:908 msgid "" "The elements within each tuple remain in the same order as *iterable* " "returned them. For example, the number 1 is always before 2, 3, 4, or 5 in " @@ -983,25 +1273,47 @@ msgid "" "constraint on the order, returning all possible arrangements of length *r*::" msgstr "" -#: howto/functional.rst:925 +#: howto/functional.rst:915 +msgid "" +"itertools.permutations([1, 2, 3, 4, 5], 2) =>\n" +" (1, 2), (1, 3), (1, 4), (1, 5),\n" +" (2, 1), (2, 3), (2, 4), (2, 5),\n" +" (3, 1), (3, 2), (3, 4), (3, 5),\n" +" (4, 1), (4, 2), (4, 3), (4, 5),\n" +" (5, 1), (5, 2), (5, 3), (5, 4)\n" +"\n" +"itertools.permutations([1, 2, 3, 4, 5]) =>\n" +" (1, 2, 3, 4, 5), (1, 2, 3, 5, 4), (1, 2, 4, 3, 5),\n" +" ...\n" +" (5, 4, 3, 2, 1)" +msgstr "" + +#: howto/functional.rst:927 msgid "" "If you don't supply a value for *r* the length of the iterable is used, " "meaning that all the elements are permuted." msgstr "" -#: howto/functional.rst:928 +#: howto/functional.rst:930 msgid "" "Note that these functions produce all of the possible combinations by " "position and don't require that the contents of *iterable* are unique::" msgstr "" -#: howto/functional.rst:935 +#: howto/functional.rst:933 +msgid "" +"itertools.permutations('aba', 3) =>\n" +" ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n" +" ('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a')" +msgstr "" + +#: howto/functional.rst:937 msgid "" "The identical tuple ``('a', 'a', 'b')`` occurs twice, but the two 'a' " "strings came from different positions." msgstr "" -#: howto/functional.rst:938 +#: howto/functional.rst:940 msgid "" "The :func:`itertools.combinations_with_replacement(iterable, r) ` function relaxes a different constraint: " @@ -1010,11 +1322,21 @@ msgid "" "the second element is selected. ::" msgstr "" -#: howto/functional.rst:953 -msgid "Grouping elements" +#: howto/functional.rst:946 +msgid "" +"itertools.combinations_with_replacement([1, 2, 3, 4, 5], 2) =>\n" +" (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),\n" +" (2, 2), (2, 3), (2, 4), (2, 5),\n" +" (3, 3), (3, 4), (3, 5),\n" +" (4, 4), (4, 5),\n" +" (5, 5)" msgstr "" #: howto/functional.rst:955 +msgid "Grouping elements" +msgstr "" + +#: howto/functional.rst:957 msgid "" "The last function I'll discuss, :func:`itertools.groupby(iter, " "key_func=None) `, is the most complicated. " @@ -1023,14 +1345,39 @@ msgid "" "key is simply each element itself." msgstr "" -#: howto/functional.rst:960 +#: howto/functional.rst:962 msgid "" ":func:`~itertools.groupby` collects all the consecutive elements from the " "underlying iterable that have the same key value, and returns a stream of 2-" "tuples containing a key value and an iterator for the elements with that key." msgstr "" -#: howto/functional.rst:988 +#: howto/functional.rst:968 +msgid "" +"city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),\n" +" ('Anchorage', 'AK'), ('Nome', 'AK'),\n" +" ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ'),\n" +" ...\n" +" ]\n" +"\n" +"def get_state(city_state):\n" +" return city_state[1]\n" +"\n" +"itertools.groupby(city_list, get_state) =>\n" +" ('AL', iterator-1),\n" +" ('AK', iterator-2),\n" +" ('AZ', iterator-3), ...\n" +"\n" +"where\n" +"iterator-1 =>\n" +" ('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL')\n" +"iterator-2 =>\n" +" ('Anchorage', 'AK'), ('Nome', 'AK')\n" +"iterator-3 =>\n" +" ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')" +msgstr "" + +#: howto/functional.rst:990 msgid "" ":func:`~itertools.groupby` assumes that the underlying iterable's contents " "will already be sorted based on the key. Note that the returned iterators " @@ -1038,11 +1385,11 @@ msgid "" "iterator-1 before requesting iterator-2 and its corresponding key." msgstr "" -#: howto/functional.rst:995 +#: howto/functional.rst:997 msgid "The functools module" msgstr "" -#: howto/functional.rst:997 +#: howto/functional.rst:999 msgid "" "The :mod:`functools` module contains some higher-order functions. A **higher-" "order function** takes one or more functions as input and returns a new " @@ -1050,7 +1397,7 @@ msgid "" "partial` function." msgstr "" -#: howto/functional.rst:1002 +#: howto/functional.rst:1004 msgid "" "For programs written in a functional style, you'll sometimes want to " "construct variants of existing functions that have some of the parameters " @@ -1060,7 +1407,7 @@ msgid "" "\"partial function application\"." msgstr "" -#: howto/functional.rst:1008 +#: howto/functional.rst:1010 msgid "" "The constructor for :func:`~functools.partial` takes the arguments " "``(function, arg1, arg2, ..., kwarg1=value1, kwarg2=value2)``. The " @@ -1068,11 +1415,24 @@ msgid "" "with the filled-in arguments." msgstr "" -#: howto/functional.rst:1013 +#: howto/functional.rst:1015 msgid "Here's a small but realistic example::" msgstr "" -#: howto/functional.rst:1025 +#: howto/functional.rst:1017 +msgid "" +"import functools\n" +"\n" +"def log(message, subsystem):\n" +" \"\"\"Write the contents of 'message' to the specified subsystem.\"\"\"\n" +" print('%s: %s' % (subsystem, message))\n" +" ...\n" +"\n" +"server_log = functools.partial(log, subsystem='server')\n" +"server_log('Unable to open socket')" +msgstr "" + +#: howto/functional.rst:1027 msgid "" ":func:`functools.reduce(func, iter, [initial_value]) ` " "cumulatively performs an operation on all the iterable's elements and, " @@ -1087,20 +1447,47 @@ msgid "" "``func(initial_value, A)`` is the first calculation. ::" msgstr "" -#: howto/functional.rst:1049 +#: howto/functional.rst:1039 +msgid "" +">>> import operator, functools\n" +">>> functools.reduce(operator.concat, ['A', 'BB', 'C'])\n" +"'ABBC'\n" +">>> functools.reduce(operator.concat, [])\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: reduce() of empty sequence with no initial value\n" +">>> functools.reduce(operator.mul, [1, 2, 3], 1)\n" +"6\n" +">>> functools.reduce(operator.mul, [], 1)\n" +"1" +msgstr "" + +#: howto/functional.rst:1051 msgid "" "If you use :func:`operator.add` with :func:`functools.reduce`, you'll add up " "all the elements of the iterable. This case is so common that there's a " "special built-in called :func:`sum` to compute it:" msgstr "" -#: howto/functional.rst:1061 +#: howto/functional.rst:1063 msgid "" "For many uses of :func:`functools.reduce`, though, it can be clearer to just " "write the obvious :keyword:`for` loop::" msgstr "" -#: howto/functional.rst:1073 +#: howto/functional.rst:1066 +msgid "" +"import functools\n" +"# Instead of:\n" +"product = functools.reduce(operator.mul, [1, 2, 3], 1)\n" +"\n" +"# You can write:\n" +"product = 1\n" +"for i in [1, 2, 3]:\n" +" product *= i" +msgstr "" + +#: howto/functional.rst:1075 msgid "" "A related function is :func:`itertools.accumulate(iterable, func=operator." "add) `. It performs the same calculation, but instead " @@ -1108,11 +1495,20 @@ msgid "" "iterator that also yields each partial result::" msgstr "" -#: howto/functional.rst:1086 -msgid "The operator module" +#: howto/functional.rst:1080 +msgid "" +"itertools.accumulate([1, 2, 3, 4, 5]) =>\n" +" 1, 3, 6, 10, 15\n" +"\n" +"itertools.accumulate([1, 2, 3, 4, 5], operator.mul) =>\n" +" 1, 2, 6, 24, 120" msgstr "" #: howto/functional.rst:1088 +msgid "The operator module" +msgstr "" + +#: howto/functional.rst:1090 msgid "" "The :mod:`operator` module was mentioned earlier. It contains a set of " "functions corresponding to Python's operators. These functions are often " @@ -1120,54 +1516,60 @@ msgid "" "functions that perform a single operation." msgstr "" -#: howto/functional.rst:1093 +#: howto/functional.rst:1095 msgid "Some of the functions in this module are:" msgstr "" -#: howto/functional.rst:1095 +#: howto/functional.rst:1097 msgid "" "Math operations: ``add()``, ``sub()``, ``mul()``, ``floordiv()``, " "``abs()``, ..." msgstr "" -#: howto/functional.rst:1096 +#: howto/functional.rst:1098 msgid "Logical operations: ``not_()``, ``truth()``." msgstr "" -#: howto/functional.rst:1097 +#: howto/functional.rst:1099 msgid "Bitwise operations: ``and_()``, ``or_()``, ``invert()``." msgstr "" -#: howto/functional.rst:1098 +#: howto/functional.rst:1100 msgid "" "Comparisons: ``eq()``, ``ne()``, ``lt()``, ``le()``, ``gt()``, and ``ge()``." msgstr "" -#: howto/functional.rst:1099 +#: howto/functional.rst:1101 msgid "Object identity: ``is_()``, ``is_not()``." msgstr "" -#: howto/functional.rst:1101 +#: howto/functional.rst:1103 msgid "Consult the operator module's documentation for a complete list." msgstr "" -#: howto/functional.rst:1105 +#: howto/functional.rst:1107 msgid "Small functions and the lambda expression" msgstr "" -#: howto/functional.rst:1107 +#: howto/functional.rst:1109 msgid "" "When writing functional-style programs, you'll often need little functions " "that act as predicates or that combine elements in some way." msgstr "" -#: howto/functional.rst:1110 +#: howto/functional.rst:1112 msgid "" "If there's a Python built-in or a module function that's suitable, you don't " "need to define a new function at all::" msgstr "" -#: howto/functional.rst:1116 +#: howto/functional.rst:1115 +msgid "" +"stripped_lines = [line.strip() for line in lines]\n" +"existing_files = filter(os.path.exists, file_list)" +msgstr "" + +#: howto/functional.rst:1118 msgid "" "If the function you need doesn't exist, you need to write it. One way to " "write small functions is to use the :keyword:`lambda` expression. " @@ -1176,19 +1578,35 @@ msgid "" "expression::" msgstr "" -#: howto/functional.rst:1125 +#: howto/functional.rst:1123 +msgid "" +"adder = lambda x, y: x+y\n" +"\n" +"print_assign = lambda name, value: name + '=' + str(value)" +msgstr "" + +#: howto/functional.rst:1127 msgid "" "An alternative is to just use the ``def`` statement and define a function in " "the usual way::" msgstr "" -#: howto/functional.rst:1134 +#: howto/functional.rst:1130 +msgid "" +"def adder(x, y):\n" +" return x + y\n" +"\n" +"def print_assign(name, value):\n" +" return name + '=' + str(value)" +msgstr "" + +#: howto/functional.rst:1136 msgid "" "Which alternative is preferable? That's a style question; my usual course " "is to avoid using ``lambda``." msgstr "" -#: howto/functional.rst:1137 +#: howto/functional.rst:1139 msgid "" "One reason for my preference is that ``lambda`` is quite limited in the " "functions it can define. The result has to be computable as a single " @@ -1198,66 +1616,92 @@ msgid "" "that's hard to read. Quick, what's the following code doing? ::" msgstr "" -#: howto/functional.rst:1147 +#: howto/functional.rst:1146 +msgid "" +"import functools\n" +"total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]" +msgstr "" + +#: howto/functional.rst:1149 msgid "" "You can figure it out, but it takes time to disentangle the expression to " "figure out what's going on. Using a short nested ``def`` statements makes " "things a little bit better::" msgstr "" -#: howto/functional.rst:1157 +#: howto/functional.rst:1153 +msgid "" +"import functools\n" +"def combine(a, b):\n" +" return 0, a[1] + b[1]\n" +"\n" +"total = functools.reduce(combine, items)[1]" +msgstr "" + +#: howto/functional.rst:1159 msgid "But it would be best of all if I had simply used a ``for`` loop::" msgstr "" -#: howto/functional.rst:1163 +#: howto/functional.rst:1161 +msgid "" +"total = 0\n" +"for a, b in items:\n" +" total += b" +msgstr "" + +#: howto/functional.rst:1165 msgid "Or the :func:`sum` built-in and a generator expression::" msgstr "" #: howto/functional.rst:1167 +msgid "total = sum(b for a, b in items)" +msgstr "" + +#: howto/functional.rst:1169 msgid "" "Many uses of :func:`functools.reduce` are clearer when written as ``for`` " "loops." msgstr "" -#: howto/functional.rst:1169 +#: howto/functional.rst:1171 msgid "" "Fredrik Lundh once suggested the following set of rules for refactoring uses " "of ``lambda``:" msgstr "" -#: howto/functional.rst:1172 +#: howto/functional.rst:1174 msgid "Write a lambda function." msgstr "" -#: howto/functional.rst:1173 +#: howto/functional.rst:1175 msgid "Write a comment explaining what the heck that lambda does." msgstr "" -#: howto/functional.rst:1174 +#: howto/functional.rst:1176 msgid "" "Study the comment for a while, and think of a name that captures the essence " "of the comment." msgstr "" -#: howto/functional.rst:1176 +#: howto/functional.rst:1178 msgid "Convert the lambda to a def statement, using that name." msgstr "" -#: howto/functional.rst:1177 +#: howto/functional.rst:1179 msgid "Remove the comment." msgstr "" -#: howto/functional.rst:1179 +#: howto/functional.rst:1181 msgid "" "I really like these rules, but you're free to disagree about whether this " "lambda-free style is better." msgstr "" -#: howto/functional.rst:1184 +#: howto/functional.rst:1186 msgid "Revision History and Acknowledgements" msgstr "" -#: howto/functional.rst:1186 +#: howto/functional.rst:1188 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " @@ -1265,40 +1709,40 @@ msgid "" "Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake Winton." msgstr "" -#: howto/functional.rst:1191 +#: howto/functional.rst:1193 msgid "Version 0.1: posted June 30 2006." msgstr "" -#: howto/functional.rst:1193 +#: howto/functional.rst:1195 msgid "Version 0.11: posted July 1 2006. Typo fixes." msgstr "" -#: howto/functional.rst:1195 +#: howto/functional.rst:1197 msgid "" "Version 0.2: posted July 10 2006. Merged genexp and listcomp sections into " "one. Typo fixes." msgstr "" -#: howto/functional.rst:1198 +#: howto/functional.rst:1200 msgid "" "Version 0.21: Added more references suggested on the tutor mailing list." msgstr "" -#: howto/functional.rst:1200 +#: howto/functional.rst:1202 msgid "" "Version 0.30: Adds a section on the ``functional`` module written by Collin " "Winter; adds short section on the operator module; a few other edits." msgstr "" -#: howto/functional.rst:1205 +#: howto/functional.rst:1207 msgid "References" msgstr "" -#: howto/functional.rst:1208 +#: howto/functional.rst:1210 msgid "General" msgstr "" -#: howto/functional.rst:1210 +#: howto/functional.rst:1212 msgid "" "**Structure and Interpretation of Computer Programs**, by Harold Abelson and " "Gerald Jay Sussman with Julie Sussman. The book can be found at https://" @@ -1309,39 +1753,39 @@ msgid "" "functional-style Python code." msgstr "" -#: howto/functional.rst:1218 +#: howto/functional.rst:1220 msgid "" -"https://www.defmacro.org/ramblings/fp.html: A general introduction to " +"https://defmacro.org/2006/06/19/fp.html: A general introduction to " "functional programming that uses Java examples and has a lengthy historical " "introduction." msgstr "" -#: howto/functional.rst:1221 +#: howto/functional.rst:1223 msgid "" "https://en.wikipedia.org/wiki/Functional_programming: General Wikipedia " "entry describing functional programming." msgstr "" -#: howto/functional.rst:1224 +#: howto/functional.rst:1226 msgid "https://en.wikipedia.org/wiki/Coroutine: Entry for coroutines." msgstr "" -#: howto/functional.rst:1226 +#: howto/functional.rst:1228 msgid "" "https://en.wikipedia.org/wiki/Partial_application: Entry for the concept of " "partial function application." msgstr "" -#: howto/functional.rst:1228 +#: howto/functional.rst:1230 msgid "" "https://en.wikipedia.org/wiki/Currying: Entry for the concept of currying." msgstr "" -#: howto/functional.rst:1231 +#: howto/functional.rst:1233 msgid "Python-specific" msgstr "" -#: howto/functional.rst:1233 +#: howto/functional.rst:1235 msgid "" "https://gnosis.cx/TPiP/: The first chapter of David Mertz's book :title-" "reference:`Text Processing in Python` discusses functional programming for " @@ -1349,7 +1793,7 @@ msgid "" "Text Processing\"." msgstr "" -#: howto/functional.rst:1238 +#: howto/functional.rst:1240 msgid "" "Mertz also wrote a 3-part series of articles on functional programming for " "IBM's DeveloperWorks site; see `part 1 `__," msgstr "" -#: howto/functional.rst:1246 +#: howto/functional.rst:1248 msgid "Python documentation" msgstr "" -#: howto/functional.rst:1248 +#: howto/functional.rst:1250 msgid "Documentation for the :mod:`itertools` module." msgstr "" -#: howto/functional.rst:1250 +#: howto/functional.rst:1252 msgid "Documentation for the :mod:`functools` module." msgstr "" -#: howto/functional.rst:1252 +#: howto/functional.rst:1254 msgid "Documentation for the :mod:`operator` module." msgstr "" -#: howto/functional.rst:1254 +#: howto/functional.rst:1256 msgid ":pep:`289`: \"Generator Expressions\"" msgstr "" -#: howto/functional.rst:1256 +#: howto/functional.rst:1258 msgid "" ":pep:`342`: \"Coroutines via Enhanced Generators\" describes the new " "generator features in Python 2.5." diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index 221f61d2..a0e2718f 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -113,6 +114,10 @@ msgid "" "configuration file (``~/.gdbinit`` or ``~/.config/gdb/gdbinit``)::" msgstr "" +#: howto/gdb_helpers.rst:68 +msgid "add-auto-load-safe-path /path/to/cpython" +msgstr "" + #: howto/gdb_helpers.rst:70 msgid "You can also add multiple paths, separated by ``:``." msgstr "" @@ -131,10 +136,20 @@ msgstr "" msgid "Fedora:" msgstr "" +#: howto/gdb_helpers.rst:82 +msgid "" +"sudo dnf install gdb\n" +"sudo dnf debuginfo-install python3" +msgstr "" + #: howto/gdb_helpers.rst:87 msgid "Ubuntu:" msgstr "" +#: howto/gdb_helpers.rst:89 +msgid "sudo apt install gdb python3-dbg" +msgstr "" + #: howto/gdb_helpers.rst:93 msgid "" "On several recent Linux systems, GDB can download debugging symbols " @@ -189,6 +204,37 @@ msgid "" "enabled::" msgstr "" +#: howto/gdb_helpers.rst:126 +msgid "" +"#0 0x000000000041a6b1 in PyObject_Malloc (nbytes=Cannot access memory at " +"address 0x7fffff7fefe8\n" +") at Objects/obmalloc.c:748\n" +"#1 0x000000000041b7c0 in _PyObject_DebugMallocApi (id=111 'o', nbytes=24) " +"at Objects/obmalloc.c:1445\n" +"#2 0x000000000041b717 in _PyObject_DebugMalloc (nbytes=24) at Objects/" +"obmalloc.c:1412\n" +"#3 0x000000000044060a in _PyUnicode_New (length=11) at Objects/" +"unicodeobject.c:346\n" +"#4 0x00000000004466aa in PyUnicodeUCS2_DecodeUTF8Stateful (s=0x5c2b8d " +"\"__lltrace__\", size=11, errors=0x0, consumed=\n" +" 0x0) at Objects/unicodeobject.c:2531\n" +"#5 0x0000000000446647 in PyUnicodeUCS2_DecodeUTF8 (s=0x5c2b8d " +"\"__lltrace__\", size=11, errors=0x0)\n" +" at Objects/unicodeobject.c:2495\n" +"#6 0x0000000000440d1b in PyUnicodeUCS2_FromStringAndSize (u=0x5c2b8d " +"\"__lltrace__\", size=11)\n" +" at Objects/unicodeobject.c:551\n" +"#7 0x0000000000440d94 in PyUnicodeUCS2_FromString (u=0x5c2b8d " +"\"__lltrace__\") at Objects/unicodeobject.c:569\n" +"#8 0x0000000000584abd in PyDict_GetItemString (v=\n" +" {'Yuck': , '__builtins__': , '__file__': 'Lib/test/crashers/nasty_eq_vs_dict.py', " +"'__package__': None, 'y': , 'dict': {0: 0, 1: " +"1, 2: 2, 3: 3}, '__cached__': None, '__name__': '__main__', 'z': , '__doc__': None}, key=\n" +" 0x5c2b8d \"__lltrace__\") at Objects/dictobject.c:2171" +msgstr "" + #: howto/gdb_helpers.rst:142 msgid "" "Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed " @@ -203,6 +249,28 @@ msgid "" "example::" msgstr "" +#: howto/gdb_helpers.rst:149 +msgid "" +"(gdb) p globals\n" +"$1 = {'__builtins__': , '__name__':\n" +"'__main__', 'ctypes': , '__doc__': None,\n" +"'__package__': None}\n" +"\n" +"(gdb) p *(PyDictObject*)globals\n" +"$2 = {ob_refcnt = 3, ob_type = 0x3dbdf85820, ma_fill = 5, ma_used = 5,\n" +"ma_mask = 7, ma_table = 0x63d0f8, ma_lookup = 0x3dbdc7ea70\n" +", ma_smalltable = {{me_hash = 7065186196740147912,\n" +"me_key = '__builtins__', me_value = },\n" +"{me_hash = -368181376027291943, me_key = '__name__',\n" +"me_value ='__main__'}, {me_hash = 0, me_key = 0x0, me_value = 0x0},\n" +"{me_hash = 0, me_key = 0x0, me_value = 0x0},\n" +"{me_hash = -9177857982131165996, me_key = 'ctypes',\n" +"me_value = },\n" +"{me_hash = -8518757509529533123, me_key = '__doc__', me_value = None},\n" +"{me_hash = 0, me_key = 0x0, me_value = 0x0}, {\n" +" me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}" +msgstr "" + #: howto/gdb_helpers.rst:168 msgid "" "Note that the pretty-printers do not actually call ``repr()``. For basic " @@ -218,16 +286,27 @@ msgid "" "level integer::" msgstr "" +#: howto/gdb_helpers.rst:177 +msgid "" +"(gdb) p some_machine_integer\n" +"$3 = 42\n" +"\n" +"(gdb) p some_python_integer\n" +"$4 = 42" +msgstr "" + #: howto/gdb_helpers.rst:183 msgid "" "The internal structure can be revealed with a cast to :c:expr:`PyLongObject " -"*`:" +"*`::" msgstr "" #: howto/gdb_helpers.rst:185 msgid "" -"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = " -"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}" +"(gdb) p *(PyLongObject*)some_python_integer\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" +"ob_digit = {42}}" msgstr "" #: howto/gdb_helpers.rst:189 @@ -236,6 +315,12 @@ msgid "" "a lot like gdb's built-in printer for ``char *``::" msgstr "" +#: howto/gdb_helpers.rst:192 +msgid "" +"(gdb) p ptr_to_python_str\n" +"$6 = '__builtins__'" +msgstr "" + #: howto/gdb_helpers.rst:195 msgid "" "The pretty-printer for ``str`` instances defaults to using single-quotes (as " @@ -243,12 +328,25 @@ msgid "" "*`` values uses double-quotes and contains a hexadecimal address::" msgstr "" +#: howto/gdb_helpers.rst:199 +msgid "" +"(gdb) p ptr_to_char_star\n" +"$7 = 0x6d72c0 \"hello world\"" +msgstr "" + #: howto/gdb_helpers.rst:202 msgid "" "Again, the implementation details can be revealed with a cast to :c:expr:" "`PyUnicodeObject *`::" msgstr "" +#: howto/gdb_helpers.rst:205 +msgid "" +"(gdb) p *(PyUnicodeObject*)$6\n" +"$8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,\n" +"str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0}" +msgstr "" + #: howto/gdb_helpers.rst:210 msgid "``py-list``" msgstr "" @@ -260,6 +358,22 @@ msgid "" "marked with a \">\"::" msgstr "" +#: howto/gdb_helpers.rst:216 +msgid "" +"(gdb) py-list\n" +" 901 if options.profile:\n" +" 902 options.profile = False\n" +" 903 profile_me()\n" +" 904 return\n" +" 905\n" +">906 u = UI()\n" +" 907 if not u.quit:\n" +" 908 try:\n" +" 909 gtk.main()\n" +" 910 except KeyboardInterrupt:\n" +" 911 # properly quit on a keyboard interrupt..." +msgstr "" + #: howto/gdb_helpers.rst:229 msgid "" "Use ``py-list START`` to list at a different line number within the Python " @@ -295,6 +409,21 @@ msgstr "" msgid "For example::" msgstr "" +#: howto/gdb_helpers.rst:250 +msgid "" +"(gdb) py-up\n" +"#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/\n" +"gnome_sudoku/main.py, line 906, in start_game ()\n" +" u = UI()\n" +"(gdb) py-up\n" +"#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/\n" +"gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=)\n" +" main.start_game()\n" +"(gdb) py-up\n" +"Unable to find an older python frame" +msgstr "" + #: howto/gdb_helpers.rst:261 msgid "so we're at the top of the Python stack." msgstr "" @@ -310,6 +439,47 @@ msgstr "" msgid "Going back down::" msgstr "" +#: howto/gdb_helpers.rst:269 +msgid "" +"(gdb) py-down\n" +"#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"main.py, line 906, in start_game ()\n" +" u = UI()\n" +"(gdb) py-down\n" +"#34 (unable to read python frame information)\n" +"(gdb) py-down\n" +"#23 (unable to read python frame information)\n" +"(gdb) py-down\n" +"#19 (unable to read python frame information)\n" +"(gdb) py-down\n" +"#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"game_selector.py, line 201, in run_swallowed_dialog " +"(self=, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, " +"'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 " +"5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 " +"3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\\n7 " +"8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 " +"9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 " +"0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': , 'gsd.hints': 0, 'timer.active_time': , 'timer.total_time': }], dialog=, saved_game_model=, sudoku_maker=, main_page=0) " +"at remote 0x98fa6e4>, d=)\n" +" gtk.main()\n" +"(gdb) py-down\n" +"#8 (unable to read python frame information)\n" +"(gdb) py-down\n" +"Unable to find a newer python frame" +msgstr "" + #: howto/gdb_helpers.rst:289 msgid "and we're at the bottom of the Python stack." msgstr "" @@ -321,6 +491,33 @@ msgid "" "move multiple Python frames at once. For example::" msgstr "" +#: howto/gdb_helpers.rst:295 +msgid "" +"(gdb) py-up\n" +"#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function " +"(n=0)\n" +" time.sleep(5)\n" +"#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7, in recursive_function " +"(n=1)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb61d0, for file /tmp/rec.py, line 7, in recursive_function " +"(n=2)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb6160, for file /tmp/rec.py, line 7, in recursive_function " +"(n=3)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb60f0, for file /tmp/rec.py, line 7, in recursive_function " +"(n=4)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb6080, for file /tmp/rec.py, line 7, in recursive_function " +"(n=5)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb6020, for file /tmp/rec.py, line 9, in ()\n" +" recursive_function(5)\n" +"(gdb) py-up\n" +"Unable to find an older python frame" +msgstr "" + #: howto/gdb_helpers.rst:315 msgid "``py-bt``" msgstr "" @@ -331,6 +528,43 @@ msgid "" "current thread." msgstr "" +#: howto/gdb_helpers.rst:322 +msgid "" +"(gdb) py-bt\n" +"#8 (unable to read python frame information)\n" +"#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"dialog_swallower.py, line 48, in run_dialog " +"(self=, main_page=0) " +"at remote 0x98fa6e4>, d=)\n" +" gtk.main()\n" +"#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"game_selector.py, line 201, in run_swallowed_dialog " +"(self=, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, " +"'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 " +"5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 " +"3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\\n7 " +"8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 " +"9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 " +"0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': , 'gsd.hints': 0, 'timer.active_time': , 'timer.total_time': }], dialog=, saved_game_model=, sudoku_maker=)\n" +" main.start_game()" +msgstr "" + #: howto/gdb_helpers.rst:336 msgid "" "The frame numbers correspond to those displayed by GDB's standard " @@ -348,6 +582,19 @@ msgid "" "builtins::" msgstr "" +#: howto/gdb_helpers.rst:346 +msgid "" +"(gdb) py-print self\n" +"local 'self' = ,\n" +"main_page=0) at remote 0x98fa6e4>\n" +"(gdb) py-print __name__\n" +"global '__name__' = 'gnome_sudoku.dialog_swallower'\n" +"(gdb) py-print len\n" +"builtin 'len' = \n" +"(gdb) py-print scarlet_pimpernel\n" +"'scarlet_pimpernel' not found" +msgstr "" + #: howto/gdb_helpers.rst:356 msgid "" "If the current C frame corresponds to multiple Python frames, ``py-print`` " @@ -364,12 +611,38 @@ msgid "" "Python frame in the selected thread, and prints their representations::" msgstr "" +#: howto/gdb_helpers.rst:365 +msgid "" +"(gdb) py-locals\n" +"self = ,\n" +"main_page=0) at remote 0x98fa6e4>\n" +"d = " +msgstr "" + #: howto/gdb_helpers.rst:370 msgid "" "If the current C frame corresponds to multiple Python frames, locals from " "all of them will be shown::" msgstr "" +#: howto/gdb_helpers.rst:373 +msgid "" +"(gdb) py-locals\n" +"Locals for recursive_function\n" +"n = 0\n" +"Locals for recursive_function\n" +"n = 1\n" +"Locals for recursive_function\n" +"n = 2\n" +"Locals for recursive_function\n" +"n = 3\n" +"Locals for recursive_function\n" +"n = 4\n" +"Locals for recursive_function\n" +"n = 5\n" +"Locals for " +msgstr "" + #: howto/gdb_helpers.rst:390 msgid "Use with GDB commands" msgstr "" @@ -381,15 +654,131 @@ msgid "" "a specific frame within the selected thread, like this::" msgstr "" +#: howto/gdb_helpers.rst:396 +msgid "" +"(gdb) py-bt\n" +"(output snipped)\n" +"#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in " +"()\n" +" main()\n" +"(gdb) frame 68\n" +"#68 0x00000000004cd1e6 in PyEval_EvalFrameEx (f=Frame 0xaa4560, for file Lib/" +"test/regrtest.py, line 1548, in (), throwflag=0) at Python/ceval." +"c:2665\n" +"2665 x = call_function(&sp, oparg);\n" +"(gdb) py-list\n" +"1543 # Run the tests in a context manager that temporary changes the " +"CWD to a\n" +"1544 # temporary and writable directory. If it's not possible to " +"create or\n" +"1545 # change the CWD, the original CWD will be used. The original " +"CWD is\n" +"1546 # available from test_support.SAVEDCWD.\n" +"1547 with test_support.temp_cwd(TESTCWD, quiet=True):\n" +">1548 main()" +msgstr "" + #: howto/gdb_helpers.rst:411 msgid "" "The ``info threads`` command will give you a list of the threads within the " "process, and you can use the ``thread`` command to select a different one::" msgstr "" +#: howto/gdb_helpers.rst:414 +msgid "" +"(gdb) info threads\n" +" 105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/" +"sysv/linux/x86_64/sem_wait.S:86\n" +" 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/" +"sysv/linux/x86_64/sem_wait.S:86\n" +"* 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../" +"sysdeps/unix/syscall-template.S:82" +msgstr "" + #: howto/gdb_helpers.rst:419 msgid "" "You can use ``thread apply all COMMAND`` or (``t a a COMMAND`` for short) to " "run a command on all threads. With ``py-bt``, this lets you see what every " "thread is doing at the Python level::" msgstr "" + +#: howto/gdb_helpers.rst:423 +msgid "" +"(gdb) t a a py-bt\n" +"\n" +"Thread 105 (Thread 0x7fffefa18710 (LWP 10260)):\n" +"#5 Frame 0x7fffd00019d0, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 155, in _acquire_restore " +"(self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, " +"_RLock__block=, _RLock__count=1) at remote " +"0xd7ff40>, count_owner=(1, 140737213728528), count=1, " +"owner=140737213728528)\n" +" self.__block.acquire()\n" +"#8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 269, in wait " +"(self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, " +"_RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, " +"_release_save=, release=, _acquire_restore=, " +"_Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, " +"timeout=None, waiter=, saved_state=(1, " +"140737213728528))\n" +" self._acquire_restore(saved_state)\n" +"#12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 348, in f ()\n" +" cond.wait()\n" +"#16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 37, in task (tid=140737213728528)\n" +" f()\n" +"\n" +"Thread 104 (Thread 0x7fffdf5fe710 (LWP 10259)):\n" +"#5 Frame 0x7fffe4001580, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 155, in _acquire_restore " +"(self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, " +"_RLock__block=, _RLock__count=1) at remote " +"0xd7ff40>, count_owner=(1, 140736940992272), count=1, " +"owner=140736940992272)\n" +" self.__block.acquire()\n" +"#8 Frame 0x7fffc8002090, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 269, in wait " +"(self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, " +"_RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, " +"_release_save=, release=, _acquire_restore=, " +"_Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, " +"timeout=None, waiter=, saved_state=(1, " +"140736940992272))\n" +" self._acquire_restore(saved_state)\n" +"#12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 348, in f ()\n" +" cond.wait()\n" +"#16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 37, in task (tid=140736940992272)\n" +" f()\n" +"\n" +"Thread 1 (Thread 0x7ffff7fe2700 (LWP 10145)):\n" +"#5 Frame 0xcb5380, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 16, in _wait ()\n" +" time.sleep(0.01)\n" +"#8 Frame 0x7fffd00024a0, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 378, in _check_notify " +"(self=, skipped=[], _mirrorOutput=False, testsRun=39, " +"buffer=False, _original_stderr=, " +"_stdout_buffer=, " +"_stderr_buffer=, " +"_moduleSetUpFailed=False, expectedFailures=[], errors=[], " +"_previousTestClass=, unexpectedSuccesses=[], " +"failures=[], shouldStop=False, failfast=False) at remote 0xc185a0>, " +"_threads=(0,), _cleanups=[], _type_equality_funcs={: , : " +", : " +", : " +", \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-10 22:23+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: howto/index.rst:3 +#: howto/index.rst:5 msgid "Python HOWTOs" -msgstr "" +msgstr "Python HOWTOs" -#: howto/index.rst:5 +#: howto/index.rst:7 msgid "" -"Python HOWTOs are documents that cover a single, specific topic, and attempt " -"to cover it fairly completely. Modelled on the Linux Documentation Project's " -"HOWTO collection, this collection is an effort to foster documentation " -"that's more detailed than the Python Library Reference." +"Python HOWTOs are documents that cover a specific topic in-depth. Modeled on " +"the Linux Documentation Project's HOWTO collection, this collection is an " +"effort to foster documentation that's more detailed than the Python Library " +"Reference." msgstr "" +"Τα HOWTOs της Python είναι έγγραφα που καλύπτουν ένα συγκεκριμένο θέμα σε " +"βάθος. Με πρότυπο τη συλλογή HOWTO του Linux Documentation Project, αυτή η " +"συλλογή είναι μια προσπάθεια να προωθηθεί η τεκμηρίωση που είναι πιο " +"λεπτομερής από την Αναφορά της Βιβλιοθήκης Python." -#: howto/index.rst:11 -msgid "Currently, the HOWTOs are:" -msgstr "" +#: howto/index.rst:42 +msgid "General:" +msgstr "Γενικά:" + +#: howto/index.rst:44 +msgid ":ref:`a-conceptual-overview-of-asyncio`" +msgstr ":ref:`a-conceptual-overview-of-asyncio`" + +#: howto/index.rst:45 +msgid ":ref:`annotations-howto`" +msgstr ":ref:`annotations-howto`" + +#: howto/index.rst:46 +msgid ":ref:`argparse-tutorial`" +msgstr ":ref:`argparse-tutorial`" + +#: howto/index.rst:47 +msgid ":ref:`descriptorhowto`" +msgstr ":ref:`descriptorhowto`" + +#: howto/index.rst:48 +msgid ":ref:`enum-howto`" +msgstr ":ref:`enum-howto`" + +#: howto/index.rst:49 +msgid ":ref:`functional-howto`" +msgstr ":ref:`functional-howto`" + +#: howto/index.rst:50 +msgid ":ref:`ipaddress-howto`" +msgstr ":ref:`ipaddress-howto`" + +#: howto/index.rst:51 +msgid ":ref:`logging-howto`" +msgstr ":ref:`logging-howto`" + +#: howto/index.rst:52 +msgid ":ref:`logging-cookbook`" +msgstr ":ref:`logging-cookbook`" + +#: howto/index.rst:53 +msgid ":ref:`regex-howto`" +msgstr ":ref:`regex-howto`" + +#: howto/index.rst:54 +msgid ":ref:`sortinghowto`" +msgstr ":ref:`sortinghowto`" + +#: howto/index.rst:55 +msgid ":ref:`unicode-howto`" +msgstr ":ref:`unicode-howto`" + +#: howto/index.rst:56 +msgid ":ref:`urllib-howto`" +msgstr ":ref:`urllib-howto`" + +#: howto/index.rst:58 +msgid "Advanced development:" +msgstr "Προχωρημένη ανάπτυξη:" + +#: howto/index.rst:60 +msgid ":ref:`curses-howto`" +msgstr ":ref:`curses-howto`" + +#: howto/index.rst:61 +msgid ":ref:`freethreading-python-howto`" +msgstr ":ref:`freethreading-python-howto`" + +#: howto/index.rst:62 +msgid ":ref:`freethreading-extensions-howto`" +msgstr ":ref:`freethreading-extensions-howto`" + +#: howto/index.rst:63 +msgid ":ref:`isolating-extensions-howto`" +msgstr ":ref:`isolating-extensions-howto`" + +#: howto/index.rst:64 +msgid ":ref:`python_2.3_mro`" +msgstr ":ref:`python_2.3_mro`" + +#: howto/index.rst:65 +msgid ":ref:`socket-howto`" +msgstr ":ref:`socket-howto`" + +#: howto/index.rst:66 +msgid ":ref:`timerfd-howto`" +msgstr ":ref:`timerfd-howto`" + +#: howto/index.rst:67 +msgid ":ref:`cporting-howto`" +msgstr ":ref:`cporting-howto`" + +#: howto/index.rst:69 +msgid "Debugging and profiling:" +msgstr "Αποσφαλμάτωση και σκιαγράφηση:" + +#: howto/index.rst:71 +msgid ":ref:`gdb`" +msgstr ":ref:`gdb`" + +#: howto/index.rst:72 +msgid ":ref:`instrumentation`" +msgstr ":ref:`instrumentation`" + +#: howto/index.rst:73 +msgid ":ref:`perf_profiling`" +msgstr ":ref:`perf_profiling`" + +#: howto/index.rst:74 +msgid ":ref:`remote-debugging`" +msgstr ":ref:`remote-debugging`" diff --git a/howto/instrumentation.po b/howto/instrumentation.po index e5f14078..c3c2e51c 100644 --- a/howto/instrumentation.po +++ b/howto/instrumentation.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -81,16 +82,28 @@ msgstr "" msgid "On a Linux machine, this can be done via::" msgstr "" +#: howto/instrumentation.rst:42 +msgid "$ yum install systemtap-sdt-devel" +msgstr "" + #: howto/instrumentation.rst:44 msgid "or::" msgstr "" +#: howto/instrumentation.rst:46 +msgid "$ sudo apt-get install systemtap-sdt-dev" +msgstr "" + #: howto/instrumentation.rst:49 msgid "" "CPython must then be :option:`configured with the --with-dtrace option <--" "with-dtrace>`:" msgstr "" +#: howto/instrumentation.rst:52 +msgid "checking for --with-dtrace... yes" +msgstr "" + #: howto/instrumentation.rst:56 msgid "" "On macOS, you can list available DTrace probes by running a Python process " @@ -98,12 +111,40 @@ msgid "" "provider::" msgstr "" +#: howto/instrumentation.rst:60 +msgid "" +"$ python3.6 -q &\n" +"$ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6\n" +"\n" +" ID PROVIDER MODULE FUNCTION NAME\n" +"29564 python18035 python3.6 _PyEval_EvalFrameDefault " +"function-entry\n" +"29565 python18035 python3.6 dtrace_function_entry " +"function-entry\n" +"29566 python18035 python3.6 _PyEval_EvalFrameDefault " +"function-return\n" +"29567 python18035 python3.6 dtrace_function_return " +"function-return\n" +"29568 python18035 python3.6 collect gc-" +"done\n" +"29569 python18035 python3.6 collect gc-" +"start\n" +"29570 python18035 python3.6 _PyEval_EvalFrameDefault line\n" +"29571 python18035 python3.6 maybe_dtrace_line line" +msgstr "" + #: howto/instrumentation.rst:73 msgid "" "On Linux, you can verify if the SystemTap static markers are present in the " "built binary by seeing if it contains a \".note.stapsdt\" section." msgstr "" +#: howto/instrumentation.rst:78 +msgid "" +"$ readelf -S ./python | grep .note.stapsdt\n" +"[30] .note.stapsdt NOTE 0000000000000000 00308d78" +msgstr "" + #: howto/instrumentation.rst:81 msgid "" "If you've built Python as a shared library (with the :option:`--enable-" @@ -111,10 +152,64 @@ msgid "" "library. For example::" msgstr "" +#: howto/instrumentation.rst:85 +msgid "" +"$ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt\n" +"[29] .note.stapsdt NOTE 0000000000000000 00365b68" +msgstr "" + #: howto/instrumentation.rst:88 msgid "Sufficiently modern readelf can print the metadata::" msgstr "" +#: howto/instrumentation.rst:90 +msgid "" +"$ readelf -n ./python\n" +"\n" +"Displaying notes found at file offset 0x00000254 with length 0x00000020:\n" +" Owner Data size Description\n" +" GNU 0x00000010 NT_GNU_ABI_TAG (ABI version " +"tag)\n" +" OS: Linux, ABI: 2.6.32\n" +"\n" +"Displaying notes found at file offset 0x00000274 with length 0x00000024:\n" +" Owner Data size Description\n" +" GNU 0x00000014 NT_GNU_BUILD_ID (unique build " +"ID bitstring)\n" +" Build ID: df924a2b08a7e89f6e11251d4602022977af2670\n" +"\n" +"Displaying notes found at file offset 0x002d6c30 with length 0x00000144:\n" +" Owner Data size Description\n" +" stapsdt 0x00000031 NT_STAPSDT (SystemTap probe " +"descriptors)\n" +" Provider: python\n" +" Name: gc__start\n" +" Location: 0x00000000004371c3, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bf6\n" +" Arguments: -4@%ebx\n" +" stapsdt 0x00000030 NT_STAPSDT (SystemTap probe " +"descriptors)\n" +" Provider: python\n" +" Name: gc__done\n" +" Location: 0x00000000004374e1, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bf8\n" +" Arguments: -8@%rax\n" +" stapsdt 0x00000045 NT_STAPSDT (SystemTap probe " +"descriptors)\n" +" Provider: python\n" +" Name: function__entry\n" +" Location: 0x000000000053db6c, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6be8\n" +" Arguments: 8@%rbp 8@%r12 -4@%eax\n" +" stapsdt 0x00000046 NT_STAPSDT (SystemTap probe " +"descriptors)\n" +" Provider: python\n" +" Name: function__return\n" +" Location: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bea\n" +" Arguments: 8@%rbp 8@%r12 -4@%eax" +msgstr "" + #: howto/instrumentation.rst:125 msgid "" "The above metadata contains information for SystemTap describing how it can " @@ -134,14 +229,77 @@ msgid "" "are not going to be listed:" msgstr "" +#: howto/instrumentation.rst:138 +msgid "" +"self int indent;\n" +"\n" +"python$target:::function-entry\n" +"/copyinstr(arg1) == \"start\"/\n" +"{\n" +" self->trace = 1;\n" +"}\n" +"\n" +"python$target:::function-entry\n" +"/self->trace/\n" +"{\n" +" printf(\"%d\\t%*s:\", timestamp, 15, probename);\n" +" printf(\"%*s\", self->indent, \"\");\n" +" printf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), " +"arg2);\n" +" self->indent++;\n" +"}\n" +"\n" +"python$target:::function-return\n" +"/self->trace/\n" +"{\n" +" self->indent--;\n" +" printf(\"%d\\t%*s:\", timestamp, 15, probename);\n" +" printf(\"%*s\", self->indent, \"\");\n" +" printf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), " +"arg2);\n" +"}\n" +"\n" +"python$target:::function-return\n" +"/copyinstr(arg1) == \"start\"/\n" +"{\n" +" self->trace = 0;\n" +"}" +msgstr "" + #: howto/instrumentation.rst:230 msgid "It can be invoked like this::" msgstr "" +#: howto/instrumentation.rst:174 +msgid "$ sudo dtrace -q -s call_stack.d -c \"python3.6 script.py\"" +msgstr "" + #: howto/instrumentation.rst:236 msgid "The output looks like this:" msgstr "" +#: howto/instrumentation.rst:178 +msgid "" +"156641360502280 function-entry:call_stack.py:start:23\n" +"156641360518804 function-entry: call_stack.py:function_1:1\n" +"156641360532797 function-entry: call_stack.py:function_3:9\n" +"156641360546807 function-return: call_stack.py:function_3:10\n" +"156641360563367 function-return: call_stack.py:function_1:2\n" +"156641360578365 function-entry: call_stack.py:function_2:5\n" +"156641360591757 function-entry: call_stack.py:function_1:1\n" +"156641360605556 function-entry: call_stack.py:function_3:9\n" +"156641360617482 function-return: call_stack.py:function_3:10\n" +"156641360629814 function-return: call_stack.py:function_1:2\n" +"156641360642285 function-return: call_stack.py:function_2:6\n" +"156641360656770 function-entry: call_stack.py:function_3:9\n" +"156641360669707 function-return: call_stack.py:function_3:10\n" +"156641360687853 function-entry: call_stack.py:function_4:13\n" +"156641360700719 function-return: call_stack.py:function_4:14\n" +"156641360719640 function-entry: call_stack.py:function_5:18\n" +"156641360732567 function-return: call_stack.py:function_5:21\n" +"156641360747370 function-return:call_stack.py:start:28" +msgstr "" + #: howto/instrumentation.rst:201 msgid "Static SystemTap markers" msgstr "" @@ -159,6 +317,44 @@ msgid "" "hierarchy of a Python script:" msgstr "" +#: howto/instrumentation.rst:210 +msgid "" +"probe process(\"python\").mark(\"function__entry\") {\n" +" filename = user_string($arg1);\n" +" funcname = user_string($arg2);\n" +" lineno = $arg3;\n" +"\n" +" printf(\"%s => %s in %s:%d\\\\n\",\n" +" thread_indent(1), funcname, filename, lineno);\n" +"}\n" +"\n" +"probe process(\"python\").mark(\"function__return\") {\n" +" filename = user_string($arg1);\n" +" funcname = user_string($arg2);\n" +" lineno = $arg3;\n" +"\n" +" printf(\"%s <= %s in %s:%d\\\\n\",\n" +" thread_indent(-1), funcname, filename, lineno);\n" +"}" +msgstr "" + +#: howto/instrumentation.rst:232 +msgid "" +"$ stap \\\n" +" show-call-hierarchy.stp \\\n" +" -c \"./python test.py\"" +msgstr "" + +#: howto/instrumentation.rst:238 +msgid "" +"11408 python(8274): => __contains__ in Lib/_abcoll.py:362\n" +"11414 python(8274): => __getitem__ in Lib/os.py:425\n" +"11418 python(8274): => encode in Lib/os.py:490\n" +"11424 python(8274): <= encode in Lib/os.py:493\n" +"11428 python(8274): <= __getitem__ in Lib/os.py:426\n" +"11433 python(8274): <= __contains__ in Lib/_abcoll.py:366" +msgstr "" + #: howto/instrumentation.rst:247 msgid "where the columns are:" msgstr "" @@ -187,128 +383,161 @@ msgid "" "reflect this. For example, this line from the above example:" msgstr "" +#: howto/instrumentation.rst:259 +msgid "probe process(\"python\").mark(\"function__entry\") {" +msgstr "" + #: howto/instrumentation.rst:263 msgid "should instead read:" msgstr "" +#: howto/instrumentation.rst:265 +msgid "" +"probe process(\"python\").library(\"libpython3.6dm.so.1.0\")." +"mark(\"function__entry\") {" +msgstr "" + #: howto/instrumentation.rst:269 msgid "(assuming a :ref:`debug build ` of CPython 3.6)" msgstr "" -#: howto/instrumentation.rst:273 +#: howto/instrumentation.rst:275 msgid "Available static markers" msgstr "" -#: howto/instrumentation.rst:277 +#: howto/instrumentation.rst:279 msgid "" "This marker indicates that execution of a Python function has begun. It is " "only triggered for pure-Python (bytecode) functions." msgstr "" -#: howto/instrumentation.rst:280 +#: howto/instrumentation.rst:282 msgid "" "The filename, function name, and line number are provided back to the " "tracing script as positional arguments, which must be accessed using " "``$arg1``, ``$arg2``, ``$arg3``:" msgstr "" -#: howto/instrumentation.rst:284 +#: howto/instrumentation.rst:286 msgid "" "``$arg1`` : ``(const char *)`` filename, accessible using " "``user_string($arg1)``" msgstr "" -#: howto/instrumentation.rst:286 +#: howto/instrumentation.rst:288 msgid "" "``$arg2`` : ``(const char *)`` function name, accessible using " "``user_string($arg2)``" msgstr "" -#: howto/instrumentation.rst:289 +#: howto/instrumentation.rst:291 msgid "``$arg3`` : ``int`` line number" msgstr "" -#: howto/instrumentation.rst:293 +#: howto/instrumentation.rst:295 msgid "" "This marker is the converse of :c:func:`!function__entry`, and indicates " "that execution of a Python function has ended (either via ``return``, or via " "an exception). It is only triggered for pure-Python (bytecode) functions." msgstr "" -#: howto/instrumentation.rst:297 +#: howto/instrumentation.rst:299 msgid "The arguments are the same as for :c:func:`!function__entry`" msgstr "" -#: howto/instrumentation.rst:301 +#: howto/instrumentation.rst:303 msgid "" "This marker indicates a Python line is about to be executed. It is the " "equivalent of line-by-line tracing with a Python profiler. It is not " "triggered within C functions." msgstr "" -#: howto/instrumentation.rst:305 +#: howto/instrumentation.rst:307 msgid "The arguments are the same as for :c:func:`!function__entry`." msgstr "" -#: howto/instrumentation.rst:309 +#: howto/instrumentation.rst:311 msgid "" "Fires when the Python interpreter starts a garbage collection cycle. " -"``arg0`` is the generation to scan, like :func:`gc.collect()`." +"``arg0`` is the generation to scan, like :func:`gc.collect`." msgstr "" -#: howto/instrumentation.rst:314 +#: howto/instrumentation.rst:316 msgid "" "Fires when the Python interpreter finishes a garbage collection cycle. " "``arg0`` is the number of collected objects." msgstr "" -#: howto/instrumentation.rst:319 +#: howto/instrumentation.rst:321 msgid "" "Fires before :mod:`importlib` attempts to find and load the module. ``arg0`` " "is the module name." msgstr "" -#: howto/instrumentation.rst:326 +#: howto/instrumentation.rst:328 msgid "" "Fires after :mod:`importlib`'s find_and_load function is called. ``arg0`` is " "the module name, ``arg1`` indicates if module was successfully loaded." msgstr "" -#: howto/instrumentation.rst:335 +#: howto/instrumentation.rst:337 msgid "" "Fires when :func:`sys.audit` or :c:func:`PySys_Audit` is called. ``arg0`` is " "the event name as C string, ``arg1`` is a :c:type:`PyObject` pointer to a " "tuple object." msgstr "" -#: howto/instrumentation.rst:343 +#: howto/instrumentation.rst:345 msgid "SystemTap Tapsets" msgstr "" -#: howto/instrumentation.rst:345 +#: howto/instrumentation.rst:347 msgid "" "The higher-level way to use the SystemTap integration is to use a " "\"tapset\": SystemTap's equivalent of a library, which hides some of the " "lower-level details of the static markers." msgstr "" -#: howto/instrumentation.rst:349 +#: howto/instrumentation.rst:351 msgid "Here is a tapset file, based on a non-shared build of CPython:" msgstr "" -#: howto/instrumentation.rst:372 +#: howto/instrumentation.rst:353 +msgid "" +"/*\n" +" Provide a higher-level wrapping around the function__entry and\n" +" function__return markers:\n" +" \\*/\n" +"probe python.function.entry = process(\"python\").mark(\"function__entry\")\n" +"{\n" +" filename = user_string($arg1);\n" +" funcname = user_string($arg2);\n" +" lineno = $arg3;\n" +" frameptr = $arg4\n" +"}\n" +"probe python.function.return = process(\"python\")." +"mark(\"function__return\")\n" +"{\n" +" filename = user_string($arg1);\n" +" funcname = user_string($arg2);\n" +" lineno = $arg3;\n" +" frameptr = $arg4\n" +"}" +msgstr "" + +#: howto/instrumentation.rst:374 msgid "" "If this file is installed in SystemTap's tapset directory (e.g. ``/usr/share/" "systemtap/tapset``), then these additional probepoints become available:" msgstr "" -#: howto/instrumentation.rst:378 +#: howto/instrumentation.rst:380 msgid "" "This probe point indicates that execution of a Python function has begun. It " "is only triggered for pure-Python (bytecode) functions." msgstr "" -#: howto/instrumentation.rst:383 +#: howto/instrumentation.rst:385 msgid "" "This probe point is the converse of ``python.function.return``, and " "indicates that execution of a Python function has ended (either via " @@ -316,20 +545,57 @@ msgid "" "(bytecode) functions." msgstr "" -#: howto/instrumentation.rst:390 +#: howto/instrumentation.rst:392 msgid "Examples" msgstr "" -#: howto/instrumentation.rst:391 +#: howto/instrumentation.rst:393 msgid "" "This SystemTap script uses the tapset above to more cleanly implement the " "example given above of tracing the Python function-call hierarchy, without " "needing to directly name the static markers:" msgstr "" -#: howto/instrumentation.rst:410 +#: howto/instrumentation.rst:397 +msgid "" +"probe python.function.entry\n" +"{\n" +" printf(\"%s => %s in %s:%d\\n\",\n" +" thread_indent(1), funcname, filename, lineno);\n" +"}\n" +"\n" +"probe python.function.return\n" +"{\n" +" printf(\"%s <= %s in %s:%d\\n\",\n" +" thread_indent(-1), funcname, filename, lineno);\n" +"}" +msgstr "" + +#: howto/instrumentation.rst:412 msgid "" "The following script uses the tapset above to provide a top-like view of all " "running CPython code, showing the top 20 most frequently entered bytecode " "frames, each second, across the whole system:" msgstr "" + +#: howto/instrumentation.rst:416 +msgid "" +"global fn_calls;\n" +"\n" +"probe python.function.entry\n" +"{\n" +" fn_calls[pid(), filename, funcname, lineno] += 1;\n" +"}\n" +"\n" +"probe timer.ms(1000) {\n" +" printf(\"\\033[2J\\033[1;1H\") /* clear screen \\*/\n" +" printf(\"%6s %80s %6s %30s %6s\\n\",\n" +" \"PID\", \"FILENAME\", \"LINE\", \"FUNCTION\", \"CALLS\")\n" +" foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) {\n" +" printf(\"%6d %80s %6d %30s %6d\\n\",\n" +" pid, filename, lineno, funcname,\n" +" fn_calls[pid, filename, funcname, lineno]);\n" +" }\n" +" delete fn_calls;\n" +"}" +msgstr "" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index f8f36b9a..8b824bd5 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -98,6 +99,14 @@ msgid "" "within 32 bits are assumed to be IPv4 addresses::" msgstr "" +#: howto/ipaddress.rst:64 +msgid "" +">>> ipaddress.ip_address(3221225985)\n" +"IPv4Address('192.0.2.1')\n" +">>> ipaddress.ip_address(42540766411282592856903984951653826561)\n" +"IPv6Address('2001:db8::1')" +msgstr "" + #: howto/ipaddress.rst:69 msgid "" "To force the use of IPv4 or IPv6 addresses, the relevant classes can be " @@ -105,6 +114,16 @@ msgid "" "addresses for small integers::" msgstr "" +#: howto/ipaddress.rst:73 +msgid "" +">>> ipaddress.ip_address(1)\n" +"IPv4Address('0.0.0.1')\n" +">>> ipaddress.IPv4Address(1)\n" +"IPv4Address('0.0.0.1')\n" +">>> ipaddress.IPv6Address(1)\n" +"IPv6Address('::1')" +msgstr "" + #: howto/ipaddress.rst:82 msgid "Defining Networks" msgstr "" @@ -127,6 +146,14 @@ msgid "" "IP version automatically::" msgstr "" +#: howto/ipaddress.rst:96 +msgid "" +">>> ipaddress.ip_network('192.0.2.0/24')\n" +"IPv4Network('192.0.2.0/24')\n" +">>> ipaddress.ip_network('2001:db8::0/96')\n" +"IPv6Network('2001:db8::/96')" +msgstr "" + #: howto/ipaddress.rst:101 msgid "" "Network objects cannot have any host bits set. The practical effect of this " @@ -144,6 +171,16 @@ msgid "" "the constructor::" msgstr "" +#: howto/ipaddress.rst:112 +msgid "" +">>> ipaddress.ip_network('192.0.2.1/24')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: 192.0.2.1/24 has host bits set\n" +">>> ipaddress.ip_network('192.0.2.1/24', strict=False)\n" +"IPv4Network('192.0.2.0/24')" +msgstr "" + #: howto/ipaddress.rst:119 msgid "" "While the string form offers significantly more flexibility, networks can " @@ -152,6 +189,14 @@ msgid "" "integer, so the network prefix includes the entire network address::" msgstr "" +#: howto/ipaddress.rst:124 +msgid "" +">>> ipaddress.ip_network(3221225984)\n" +"IPv4Network('192.0.2.0/32')\n" +">>> ipaddress.ip_network(42540766411282592856903984951653826560)\n" +"IPv6Network('2001:db8::/128')" +msgstr "" + #: howto/ipaddress.rst:129 msgid "" "As with addresses, creation of a particular kind of network can be forced by " @@ -196,18 +241,63 @@ msgstr "" msgid "Extracting the IP version::" msgstr "" +#: howto/ipaddress.rst:165 +msgid "" +">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" +">>> addr6 = ipaddress.ip_address('2001:db8::1')\n" +">>> addr6.version\n" +"6\n" +">>> addr4.version\n" +"4" +msgstr "" + #: howto/ipaddress.rst:172 msgid "Obtaining the network from an interface::" msgstr "" +#: howto/ipaddress.rst:174 +msgid "" +">>> host4 = ipaddress.ip_interface('192.0.2.1/24')\n" +">>> host4.network\n" +"IPv4Network('192.0.2.0/24')\n" +">>> host6 = ipaddress.ip_interface('2001:db8::1/96')\n" +">>> host6.network\n" +"IPv6Network('2001:db8::/96')" +msgstr "" + #: howto/ipaddress.rst:181 msgid "Finding out how many individual addresses are in a network::" msgstr "" +#: howto/ipaddress.rst:183 +msgid "" +">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" +">>> net4.num_addresses\n" +"256\n" +">>> net6 = ipaddress.ip_network('2001:db8::0/96')\n" +">>> net6.num_addresses\n" +"4294967296" +msgstr "" + #: howto/ipaddress.rst:190 msgid "Iterating through the \"usable\" addresses on a network::" msgstr "" +#: howto/ipaddress.rst:192 +msgid "" +">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" +">>> for x in net4.hosts():\n" +"... print(x)\n" +"192.0.2.1\n" +"192.0.2.2\n" +"192.0.2.3\n" +"192.0.2.4\n" +"...\n" +"192.0.2.252\n" +"192.0.2.253\n" +"192.0.2.254" +msgstr "" + #: howto/ipaddress.rst:205 msgid "" "Obtaining the netmask (i.e. set bits corresponding to the network prefix) or " @@ -218,6 +308,18 @@ msgstr "" msgid "Exploding or compressing the address::" msgstr "" +#: howto/ipaddress.rst:222 +msgid "" +">>> addr6.exploded\n" +"'2001:0db8:0000:0000:0000:0000:0000:0001'\n" +">>> addr6.compressed\n" +"'2001:db8::1'\n" +">>> net6.exploded\n" +"'2001:0db8:0000:0000:0000:0000:0000:0000/96'\n" +">>> net6.compressed\n" +"'2001:db8::/96'" +msgstr "" + #: howto/ipaddress.rst:231 msgid "" "While IPv4 doesn't support explosion or compression, the associated objects " @@ -236,16 +338,43 @@ msgid "" "to index them like this::" msgstr "" +#: howto/ipaddress.rst:243 +msgid "" +">>> net4[1]\n" +"IPv4Address('192.0.2.1')\n" +">>> net4[-1]\n" +"IPv4Address('192.0.2.255')\n" +">>> net6[1]\n" +"IPv6Address('2001:db8::1')\n" +">>> net6[-1]\n" +"IPv6Address('2001:db8::ffff:ffff')" +msgstr "" + #: howto/ipaddress.rst:253 msgid "" "It also means that network objects lend themselves to using the list " "membership test syntax like this::" msgstr "" +#: howto/ipaddress.rst:256 +msgid "" +"if address in network:\n" +" # do something" +msgstr "" + #: howto/ipaddress.rst:259 msgid "Containment testing is done efficiently based on the network prefix::" msgstr "" +#: howto/ipaddress.rst:261 +msgid "" +">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" +">>> addr4 in ipaddress.ip_network('192.0.2.0/24')\n" +"True\n" +">>> addr4 in ipaddress.ip_network('192.0.3.0/24')\n" +"False" +msgstr "" + #: howto/ipaddress.rst:269 msgid "Comparisons" msgstr "" @@ -256,6 +385,12 @@ msgid "" "objects, where it makes sense::" msgstr "" +#: howto/ipaddress.rst:274 +msgid "" +">>> ipaddress.ip_address('192.0.2.1') < ipaddress.ip_address('192.0.2.2')\n" +"True" +msgstr "" + #: howto/ipaddress.rst:277 msgid "" "A :exc:`TypeError` exception is raised if you try to compare objects of " @@ -273,6 +408,15 @@ msgid "" "an integer or string that the other module will accept::" msgstr "" +#: howto/ipaddress.rst:288 +msgid "" +">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" +">>> str(addr4)\n" +"'192.0.2.1'\n" +">>> int(addr4)\n" +"3221225985" +msgstr "" + #: howto/ipaddress.rst:296 msgid "Getting more detail when instance creation fails" msgstr "" @@ -302,9 +446,39 @@ msgid "" "constructors directly. For example::" msgstr "" +#: howto/ipaddress.rst:314 +msgid "" +">>> ipaddress.ip_address(\"192.168.0.256\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: '192.168.0.256' does not appear to be an IPv4 or IPv6 address\n" +">>> ipaddress.IPv4Address(\"192.168.0.256\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"ipaddress.AddressValueError: Octet 256 (> 255) not permitted in " +"'192.168.0.256'\n" +"\n" +">>> ipaddress.ip_network(\"192.168.0.1/64\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: '192.168.0.1/64' does not appear to be an IPv4 or IPv6 network\n" +">>> ipaddress.IPv4Network(\"192.168.0.1/64\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"ipaddress.NetmaskValueError: '64' is not a valid netmask" +msgstr "" + #: howto/ipaddress.rst:332 msgid "" "However, both of the module specific exceptions have :exc:`ValueError` as " "their parent class, so if you're not concerned with the particular type of " "error, you can still write code like the following::" msgstr "" + +#: howto/ipaddress.rst:336 +msgid "" +"try:\n" +" network = ipaddress.IPv4Network(address)\n" +"except ValueError:\n" +" print('address/netmask is invalid for IPv4:', address)" +msgstr "" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 1e28247e..180018a4 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -148,6 +149,17 @@ msgid "" "example:" msgstr "" +#: howto/isolating-extensions.rst:93 +msgid "" +">>> import sys\n" +">>> import binascii\n" +">>> old_binascii = binascii\n" +">>> del sys.modules['binascii']\n" +">>> import binascii # create a new module object\n" +">>> old_binascii == binascii\n" +"False" +msgstr "" + #: howto/isolating-extensions.rst:103 msgid "" "As a rule of thumb, the two modules should be completely independent. All " @@ -179,6 +191,20 @@ msgid "" "exception is *not* caught:" msgstr "" +#: howto/isolating-extensions.rst:126 +msgid "" +">>> old_binascii.Error == binascii.Error\n" +"False\n" +">>> try:\n" +"... old_binascii.unhexlify(b'qwertyuiop')\n" +"... except binascii.Error:\n" +"... print('boo')\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +"binascii.Error: Non-hexadecimal digit found" +msgstr "" + #: howto/isolating-extensions.rst:139 msgid "" "This is expected. Notice that pure-Python modules behave the same way: it is " @@ -228,8 +254,8 @@ msgstr "" msgid "" "If it is necessary to use process-global state, the simplest way to avoid " "issues with multiple interpreters is to explicitly prevent a module from " -"being loaded more than once per process—see `Opt-Out: Limiting to One Module " -"Object per Process`_." +"being loaded more than once per process—see :ref:`isolating-extensions-" +"optout`." msgstr "" #: howto/isolating-extensions.rst:175 @@ -285,11 +311,11 @@ msgid "" "c>`__; example module initialization shown at the bottom of the file." msgstr "" -#: howto/isolating-extensions.rst:211 +#: howto/isolating-extensions.rst:213 msgid "Opt-Out: Limiting to One Module Object per Process" msgstr "" -#: howto/isolating-extensions.rst:213 +#: howto/isolating-extensions.rst:215 msgid "" "A non-negative ``PyModuleDef.m_size`` signals that a module supports " "multiple interpreters correctly. If this is not yet the case for your " @@ -297,36 +323,82 @@ msgid "" "For example::" msgstr "" -#: howto/isolating-extensions.rst:234 +#: howto/isolating-extensions.rst:220 +msgid "" +"// A process-wide flag\n" +"static int loaded = 0;\n" +"\n" +"// Mutex to provide thread safety (only needed for free-threaded Python)\n" +"static PyMutex modinit_mutex = {0};\n" +"\n" +"static int\n" +"exec_module(PyObject* module)\n" +"{\n" +" PyMutex_Lock(&modinit_mutex);\n" +" if (loaded) {\n" +" PyMutex_Unlock(&modinit_mutex);\n" +" PyErr_SetString(PyExc_ImportError,\n" +" \"cannot load module more than once per process\");\n" +" return -1;\n" +" }\n" +" loaded = 1;\n" +" PyMutex_Unlock(&modinit_mutex);\n" +" // ... rest of initialization\n" +"}" +msgstr "" + +#: howto/isolating-extensions.rst:242 +msgid "" +"If your module's :c:member:`PyModuleDef.m_clear` function is able to prepare " +"for future re-initialization, it should clear the ``loaded`` flag. In this " +"case, your module won't support multiple instances existing *concurrently*, " +"but it will, for example, support being loaded after Python runtime shutdown " +"(:c:func:`Py_FinalizeEx`) and re-initialization (:c:func:`Py_Initialize`)." +msgstr "" + +#: howto/isolating-extensions.rst:251 msgid "Module State Access from Functions" msgstr "" -#: howto/isolating-extensions.rst:236 +#: howto/isolating-extensions.rst:253 msgid "" "Accessing the state from module-level functions is straightforward. " "Functions get the module object as their first argument; for extracting the " "state, you can use ``PyModule_GetState``::" msgstr "" -#: howto/isolating-extensions.rst:251 +#: howto/isolating-extensions.rst:257 +msgid "" +"static PyObject *\n" +"func(PyObject *module, PyObject *args)\n" +"{\n" +" my_struct *state = (my_struct*)PyModule_GetState(module);\n" +" if (state == NULL) {\n" +" return NULL;\n" +" }\n" +" // ... rest of logic\n" +"}" +msgstr "" + +#: howto/isolating-extensions.rst:268 msgid "" "``PyModule_GetState`` may return ``NULL`` without setting an exception if " "there is no module state, i.e. ``PyModuleDef.m_size`` was zero. In your own " "module, you're in control of ``m_size``, so this is easy to prevent." msgstr "" -#: howto/isolating-extensions.rst:258 +#: howto/isolating-extensions.rst:275 msgid "Heap Types" msgstr "" -#: howto/isolating-extensions.rst:260 +#: howto/isolating-extensions.rst:277 msgid "" "Traditionally, types defined in C code are *static*; that is, ``static " "PyTypeObject`` structures defined directly in code and initialized using " "``PyType_Ready()``." msgstr "" -#: howto/isolating-extensions.rst:264 +#: howto/isolating-extensions.rst:281 msgid "" "Such types are necessarily shared across the process. Sharing them between " "module objects requires paying attention to any state they own or access. To " @@ -334,7 +406,7 @@ msgid "" "for example, you can't set ``str.myattribute = 123``." msgstr "" -#: howto/isolating-extensions.rst:270 +#: howto/isolating-extensions.rst:287 msgid "" "Sharing truly immutable objects between interpreters is fine, as long as " "they don't provide access to mutable objects. However, in CPython, every " @@ -344,7 +416,7 @@ msgid "" "process-wide GIL." msgstr "" -#: howto/isolating-extensions.rst:277 +#: howto/isolating-extensions.rst:294 msgid "" "Because they are immutable and process-global, static types cannot access " "\"their\" module state. If any method of such a type requires access to " @@ -353,15 +425,15 @@ msgid "" "Python's ``class`` statement." msgstr "" -#: howto/isolating-extensions.rst:284 +#: howto/isolating-extensions.rst:301 msgid "For new modules, using heap types by default is a good rule of thumb." msgstr "" -#: howto/isolating-extensions.rst:288 +#: howto/isolating-extensions.rst:305 msgid "Changing Static Types to Heap Types" msgstr "" -#: howto/isolating-extensions.rst:290 +#: howto/isolating-extensions.rst:307 msgid "" "Static types can be converted to heap types, but note that the heap type API " "was not designed for \"lossless\" conversion from static types—that is, " @@ -371,121 +443,132 @@ msgid "" "slots). Always test the details that are important to you." msgstr "" -#: howto/isolating-extensions.rst:299 +#: howto/isolating-extensions.rst:316 msgid "" "Watch out for the following two points in particular (but note that this is " "not a comprehensive list):" msgstr "" -#: howto/isolating-extensions.rst:302 +#: howto/isolating-extensions.rst:319 msgid "" "Unlike static types, heap type objects are mutable by default. Use the :c:" "macro:`Py_TPFLAGS_IMMUTABLETYPE` flag to prevent mutability." msgstr "" -#: howto/isolating-extensions.rst:304 +#: howto/isolating-extensions.rst:321 msgid "" "Heap types inherit :c:member:`~PyTypeObject.tp_new` by default, so it may " "become possible to instantiate them from Python code. You can prevent this " "with the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag." msgstr "" -#: howto/isolating-extensions.rst:310 +#: howto/isolating-extensions.rst:327 msgid "Defining Heap Types" msgstr "" -#: howto/isolating-extensions.rst:312 +#: howto/isolating-extensions.rst:329 msgid "" "Heap types can be created by filling a :c:struct:`PyType_Spec` structure, a " "description or \"blueprint\" of a class, and calling :c:func:" "`PyType_FromModuleAndSpec` to construct a new class object." msgstr "" -#: howto/isolating-extensions.rst:317 +#: howto/isolating-extensions.rst:334 msgid "" "Other functions, like :c:func:`PyType_FromSpec`, can also create heap types, " "but :c:func:`PyType_FromModuleAndSpec` associates the module with the class, " "allowing access to the module state from methods." msgstr "" -#: howto/isolating-extensions.rst:321 +#: howto/isolating-extensions.rst:338 msgid "" "The class should generally be stored in *both* the module state (for safe " "access from C) and the module's ``__dict__`` (for access from Python code)." msgstr "" -#: howto/isolating-extensions.rst:327 +#: howto/isolating-extensions.rst:344 msgid "Garbage-Collection Protocol" msgstr "" -#: howto/isolating-extensions.rst:329 +#: howto/isolating-extensions.rst:346 msgid "" "Instances of heap types hold a reference to their type. This ensures that " "the type isn't destroyed before all its instances are, but may result in " "reference cycles that need to be broken by the garbage collector." msgstr "" -#: howto/isolating-extensions.rst:334 +#: howto/isolating-extensions.rst:351 msgid "" "To avoid memory leaks, instances of heap types must implement the garbage " "collection protocol. That is, heap types should:" msgstr "" -#: howto/isolating-extensions.rst:338 +#: howto/isolating-extensions.rst:355 msgid "Have the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" -#: howto/isolating-extensions.rst:339 +#: howto/isolating-extensions.rst:356 msgid "" -"Define a traverse function using ``Py_tp_traverse``, which visits the type " -"(e.g. using ``Py_VISIT(Py_TYPE(self))``)." +"Define a traverse function using :c:data:`Py_tp_traverse`, which visits the " +"type (e.g. using ``Py_VISIT(Py_TYPE(self))``)." msgstr "" -#: howto/isolating-extensions.rst:342 +#: howto/isolating-extensions.rst:359 msgid "" -"Please refer to the the documentation of :c:macro:`Py_TPFLAGS_HAVE_GC` and :" -"c:member:`~PyTypeObject.tp_traverse` for additional considerations." +"Please refer to the documentation of :c:macro:`Py_TPFLAGS_HAVE_GC` and :c:" +"member:`~PyTypeObject.tp_traverse` for additional considerations." msgstr "" -#: howto/isolating-extensions.rst:346 +#: howto/isolating-extensions.rst:363 msgid "" "The API for defining heap types grew organically, leaving it somewhat " "awkward to use in its current state. The following sections will guide you " "through common issues." msgstr "" -#: howto/isolating-extensions.rst:352 +#: howto/isolating-extensions.rst:369 msgid "``tp_traverse`` in Python 3.8 and lower" msgstr "" -#: howto/isolating-extensions.rst:354 +#: howto/isolating-extensions.rst:371 msgid "" "The requirement to visit the type from ``tp_traverse`` was added in Python " "3.9. If you support Python 3.8 and lower, the traverse function must *not* " "visit the type, so it must be more complicated::" msgstr "" -#: howto/isolating-extensions.rst:366 +#: howto/isolating-extensions.rst:375 +msgid "" +"static int my_traverse(PyObject *self, visitproc visit, void *arg)\n" +"{\n" +" if (Py_Version >= 0x03090000) {\n" +" Py_VISIT(Py_TYPE(self));\n" +" }\n" +" return 0;\n" +"}" +msgstr "" + +#: howto/isolating-extensions.rst:383 msgid "" "Unfortunately, :c:data:`Py_Version` was only added in Python 3.11. As a " "replacement, use:" msgstr "" -#: howto/isolating-extensions.rst:369 +#: howto/isolating-extensions.rst:386 msgid ":c:macro:`PY_VERSION_HEX`, if not using the stable ABI, or" msgstr "" -#: howto/isolating-extensions.rst:370 +#: howto/isolating-extensions.rst:387 msgid "" ":py:data:`sys.version_info` (via :c:func:`PySys_GetObject` and :c:func:" "`PyArg_ParseTuple`)." msgstr "" -#: howto/isolating-extensions.rst:375 +#: howto/isolating-extensions.rst:392 msgid "Delegating ``tp_traverse``" msgstr "" -#: howto/isolating-extensions.rst:377 +#: howto/isolating-extensions.rst:394 msgid "" "If your traverse function delegates to the :c:member:`~PyTypeObject." "tp_traverse` of its base class (or another type), ensure that " @@ -493,113 +576,159 @@ msgid "" "expected to visit the type in ``tp_traverse``." msgstr "" -#: howto/isolating-extensions.rst:382 +#: howto/isolating-extensions.rst:399 msgid "For example, if your traverse function includes::" msgstr "" -#: howto/isolating-extensions.rst:386 +#: howto/isolating-extensions.rst:401 +msgid "base->tp_traverse(self, visit, arg)" +msgstr "" + +#: howto/isolating-extensions.rst:403 msgid "...and ``base`` may be a static type, then it should also include::" msgstr "" -#: howto/isolating-extensions.rst:396 +#: howto/isolating-extensions.rst:405 +msgid "" +"if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" +" // a heap type's tp_traverse already visited Py_TYPE(self)\n" +"} else {\n" +" if (Py_Version >= 0x03090000) {\n" +" Py_VISIT(Py_TYPE(self));\n" +" }\n" +"}" +msgstr "" + +#: howto/isolating-extensions.rst:413 msgid "" "It is not necessary to handle the type's reference count in :c:member:" "`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: howto/isolating-extensions.rst:401 +#: howto/isolating-extensions.rst:418 msgid "Defining ``tp_dealloc``" msgstr "" -#: howto/isolating-extensions.rst:403 +#: howto/isolating-extensions.rst:420 msgid "" "If your type has a custom :c:member:`~PyTypeObject.tp_dealloc` function, it " "needs to:" msgstr "" -#: howto/isolating-extensions.rst:406 +#: howto/isolating-extensions.rst:423 msgid "" "call :c:func:`PyObject_GC_UnTrack` before any fields are invalidated, and" msgstr "" -#: howto/isolating-extensions.rst:407 +#: howto/isolating-extensions.rst:424 msgid "decrement the reference count of the type." msgstr "" -#: howto/isolating-extensions.rst:409 +#: howto/isolating-extensions.rst:426 msgid "" "To keep the type valid while ``tp_free`` is called, the type's refcount " "needs to be decremented *after* the instance is deallocated. For example::" msgstr "" -#: howto/isolating-extensions.rst:421 +#: howto/isolating-extensions.rst:429 +msgid "" +"static void my_dealloc(PyObject *self)\n" +"{\n" +" PyObject_GC_UnTrack(self);\n" +" ...\n" +" PyTypeObject *type = Py_TYPE(self);\n" +" type->tp_free(self);\n" +" Py_DECREF(type);\n" +"}" +msgstr "" + +#: howto/isolating-extensions.rst:438 msgid "" "The default ``tp_dealloc`` function does this, so if your type does *not* " "override ``tp_dealloc`` you don't need to add it." msgstr "" -#: howto/isolating-extensions.rst:427 +#: howto/isolating-extensions.rst:444 msgid "Not overriding ``tp_free``" msgstr "" -#: howto/isolating-extensions.rst:429 +#: howto/isolating-extensions.rst:446 msgid "" "The :c:member:`~PyTypeObject.tp_free` slot of a heap type must be set to :c:" "func:`PyObject_GC_Del`. This is the default; do not override it." msgstr "" -#: howto/isolating-extensions.rst:435 +#: howto/isolating-extensions.rst:452 msgid "Avoiding ``PyObject_New``" msgstr "" -#: howto/isolating-extensions.rst:437 +#: howto/isolating-extensions.rst:454 msgid "GC-tracked objects need to be allocated using GC-aware functions." msgstr "" -#: howto/isolating-extensions.rst:439 -msgid "If you use use :c:func:`PyObject_New` or :c:func:`PyObject_NewVar`:" +#: howto/isolating-extensions.rst:456 +msgid "If you use :c:func:`PyObject_New` or :c:func:`PyObject_NewVar`:" msgstr "" -#: howto/isolating-extensions.rst:441 +#: howto/isolating-extensions.rst:458 msgid "" "Get and call type's :c:member:`~PyTypeObject.tp_alloc` slot, if possible. " "That is, replace ``TYPE *o = PyObject_New(TYPE, typeobj)`` with::" msgstr "" -#: howto/isolating-extensions.rst:446 +#: howto/isolating-extensions.rst:461 +msgid "TYPE *o = typeobj->tp_alloc(typeobj, 0);" +msgstr "" + +#: howto/isolating-extensions.rst:463 msgid "" "Replace ``o = PyObject_NewVar(TYPE, typeobj, size)`` with the same, but use " "size instead of the 0." msgstr "" -#: howto/isolating-extensions.rst:449 +#: howto/isolating-extensions.rst:466 msgid "" "If the above is not possible (e.g. inside a custom ``tp_alloc``), call :c:" "func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`::" msgstr "" -#: howto/isolating-extensions.rst:458 +#: howto/isolating-extensions.rst:469 +msgid "" +"TYPE *o = PyObject_GC_New(TYPE, typeobj);\n" +"\n" +"TYPE *o = PyObject_GC_NewVar(TYPE, typeobj, size);" +msgstr "" + +#: howto/isolating-extensions.rst:475 msgid "Module State Access from Classes" msgstr "" -#: howto/isolating-extensions.rst:460 +#: howto/isolating-extensions.rst:477 msgid "" "If you have a type object defined with :c:func:`PyType_FromModuleAndSpec`, " "you can call :c:func:`PyType_GetModule` to get the associated module, and " "then :c:func:`PyModule_GetState` to get the module's state." msgstr "" -#: howto/isolating-extensions.rst:464 +#: howto/isolating-extensions.rst:481 msgid "" "To save a some tedious error-handling boilerplate code, you can combine " "these two steps with :c:func:`PyType_GetModuleState`, resulting in::" msgstr "" -#: howto/isolating-extensions.rst:474 +#: howto/isolating-extensions.rst:484 +msgid "" +"my_struct *state = (my_struct*)PyType_GetModuleState(type);\n" +"if (state == NULL) {\n" +" return NULL;\n" +"}" +msgstr "" + +#: howto/isolating-extensions.rst:491 msgid "Module State Access from Regular Methods" msgstr "" -#: howto/isolating-extensions.rst:476 +#: howto/isolating-extensions.rst:493 msgid "" "Accessing the module-level state from methods of a class is somewhat more " "complicated, but is possible thanks to API introduced in Python 3.9. To get " @@ -607,27 +736,40 @@ msgid "" "module state from it." msgstr "" -#: howto/isolating-extensions.rst:481 +#: howto/isolating-extensions.rst:498 msgid "" "The largest roadblock is getting *the class a method was defined in*, or " "that method's \"defining class\" for short. The defining class can have a " "reference to the module it is part of." msgstr "" -#: howto/isolating-extensions.rst:485 +#: howto/isolating-extensions.rst:502 msgid "" "Do not confuse the defining class with ``Py_TYPE(self)``. If the method is " "called on a *subclass* of your type, ``Py_TYPE(self)`` will refer to that " "subclass, which may be defined in different module than yours." msgstr "" -#: howto/isolating-extensions.rst:490 +#: howto/isolating-extensions.rst:507 msgid "" "The following Python code can illustrate the concept. ``Base." "get_defining_class`` returns ``Base`` even if ``type(self) == Sub``:" msgstr "" -#: howto/isolating-extensions.rst:506 +#: howto/isolating-extensions.rst:511 +msgid "" +"class Base:\n" +" def get_type_of_self(self):\n" +" return type(self)\n" +"\n" +" def get_defining_class(self):\n" +" return __class__\n" +"\n" +"class Sub(Base):\n" +" pass" +msgstr "" + +#: howto/isolating-extensions.rst:523 msgid "" "For a method to get its \"defining class\", it must use the :ref:" "`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `__." +"Discussions about improving the situation are best held on the `discuss " +"forum under c-api tag `__." msgstr "" -#: howto/isolating-extensions.rst:617 +#: howto/isolating-extensions.rst:633 msgid "Per-Class Scope" msgstr "" -#: howto/isolating-extensions.rst:619 +#: howto/isolating-extensions.rst:635 msgid "" "It is currently (as of Python 3.11) not possible to attach state to " "individual *types* without relying on CPython implementation details (which " @@ -732,11 +919,11 @@ msgid "" "per-class scope)." msgstr "" -#: howto/isolating-extensions.rst:626 +#: howto/isolating-extensions.rst:642 msgid "Lossless Conversion to Heap Types" msgstr "" -#: howto/isolating-extensions.rst:628 +#: howto/isolating-extensions.rst:644 msgid "" "The heap type API was not designed for \"lossless\" conversion from static " "types; that is, creating a type that works exactly like a given static type." diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index d9040d83..09a28540 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -51,14 +52,94 @@ msgid "" "module::" msgstr "" +#: howto/logging-cookbook.rst:26 +msgid "" +"import logging\n" +"import auxiliary_module\n" +"\n" +"# create logger with 'spam_application'\n" +"logger = logging.getLogger('spam_application')\n" +"logger.setLevel(logging.DEBUG)\n" +"# create file handler which logs even debug messages\n" +"fh = logging.FileHandler('spam.log')\n" +"fh.setLevel(logging.DEBUG)\n" +"# create console handler with a higher log level\n" +"ch = logging.StreamHandler()\n" +"ch.setLevel(logging.ERROR)\n" +"# create formatter and add it to the handlers\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" +"fh.setFormatter(formatter)\n" +"ch.setFormatter(formatter)\n" +"# add the handlers to the logger\n" +"logger.addHandler(fh)\n" +"logger.addHandler(ch)\n" +"\n" +"logger.info('creating an instance of auxiliary_module.Auxiliary')\n" +"a = auxiliary_module.Auxiliary()\n" +"logger.info('created an instance of auxiliary_module.Auxiliary')\n" +"logger.info('calling auxiliary_module.Auxiliary.do_something')\n" +"a.do_something()\n" +"logger.info('finished auxiliary_module.Auxiliary.do_something')\n" +"logger.info('calling auxiliary_module.some_function()')\n" +"auxiliary_module.some_function()\n" +"logger.info('done with auxiliary_module.some_function()')" +msgstr "" + #: howto/logging-cookbook.rst:56 msgid "Here is the auxiliary module::" msgstr "" +#: howto/logging-cookbook.rst:58 +msgid "" +"import logging\n" +"\n" +"# create logger\n" +"module_logger = logging.getLogger('spam_application.auxiliary')\n" +"\n" +"class Auxiliary:\n" +" def __init__(self):\n" +" self.logger = logging.getLogger('spam_application.auxiliary." +"Auxiliary')\n" +" self.logger.info('creating an instance of Auxiliary')\n" +"\n" +" def do_something(self):\n" +" self.logger.info('doing something')\n" +" a = 1 + 1\n" +" self.logger.info('done doing something')\n" +"\n" +"def some_function():\n" +" module_logger.info('received a call to \"some_function\"')" +msgstr "" + #: howto/logging-cookbook.rst:76 msgid "The output looks like this:" msgstr "" +#: howto/logging-cookbook.rst:78 +msgid "" +"2005-03-23 23:47:11,663 - spam_application - INFO -\n" +" creating an instance of auxiliary_module.Auxiliary\n" +"2005-03-23 23:47:11,665 - spam_application.auxiliary.Auxiliary - INFO -\n" +" creating an instance of Auxiliary\n" +"2005-03-23 23:47:11,665 - spam_application - INFO -\n" +" created an instance of auxiliary_module.Auxiliary\n" +"2005-03-23 23:47:11,668 - spam_application - INFO -\n" +" calling auxiliary_module.Auxiliary.do_something\n" +"2005-03-23 23:47:11,668 - spam_application.auxiliary.Auxiliary - INFO -\n" +" doing something\n" +"2005-03-23 23:47:11,669 - spam_application.auxiliary.Auxiliary - INFO -\n" +" done doing something\n" +"2005-03-23 23:47:11,670 - spam_application - INFO -\n" +" finished auxiliary_module.Auxiliary.do_something\n" +"2005-03-23 23:47:11,671 - spam_application - INFO -\n" +" calling auxiliary_module.some_function()\n" +"2005-03-23 23:47:11,672 - spam_application.auxiliary - INFO -\n" +" received a call to 'some_function'\n" +"2005-03-23 23:47:11,673 - spam_application - INFO -\n" +" done with auxiliary_module.some_function()" +msgstr "" + #: howto/logging-cookbook.rst:102 msgid "Logging from multiple threads" msgstr "" @@ -69,10 +150,61 @@ msgid "" "example shows logging from the main (initial) thread and another thread::" msgstr "" +#: howto/logging-cookbook.rst:107 +msgid "" +"import logging\n" +"import threading\n" +"import time\n" +"\n" +"def worker(arg):\n" +" while not arg['stop']:\n" +" logging.debug('Hi from myfunc')\n" +" time.sleep(0.5)\n" +"\n" +"def main():\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " +"%(threadName)s %(message)s')\n" +" info = {'stop': False}\n" +" thread = threading.Thread(target=worker, args=(info,))\n" +" thread.start()\n" +" while True:\n" +" try:\n" +" logging.debug('Hello from main')\n" +" time.sleep(0.75)\n" +" except KeyboardInterrupt:\n" +" info['stop'] = True\n" +" break\n" +" thread.join()\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + #: howto/logging-cookbook.rst:133 msgid "When run, the script should print something like the following:" msgstr "" +#: howto/logging-cookbook.rst:135 +msgid "" +" 0 Thread-1 Hi from myfunc\n" +" 3 MainThread Hello from main\n" +" 505 Thread-1 Hi from myfunc\n" +" 755 MainThread Hello from main\n" +"1007 Thread-1 Hi from myfunc\n" +"1507 MainThread Hello from main\n" +"1508 Thread-1 Hi from myfunc\n" +"2010 Thread-1 Hi from myfunc\n" +"2258 MainThread Hello from main\n" +"2512 Thread-1 Hi from myfunc\n" +"3009 MainThread Hello from main\n" +"3013 Thread-1 Hi from myfunc\n" +"3515 Thread-1 Hi from myfunc\n" +"3761 MainThread Hello from main\n" +"4017 Thread-1 Hi from myfunc\n" +"4513 MainThread Hello from main\n" +"4518 Thread-1 Hi from myfunc" +msgstr "" + #: howto/logging-cookbook.rst:155 msgid "" "This shows the logging output interspersed as one might expect. This " @@ -95,6 +227,35 @@ msgid "" "example::" msgstr "" +#: howto/logging-cookbook.rst:169 +msgid "" +"import logging\n" +"\n" +"logger = logging.getLogger('simple_example')\n" +"logger.setLevel(logging.DEBUG)\n" +"# create file handler which logs even debug messages\n" +"fh = logging.FileHandler('spam.log')\n" +"fh.setLevel(logging.DEBUG)\n" +"# create console handler with a higher log level\n" +"ch = logging.StreamHandler()\n" +"ch.setLevel(logging.ERROR)\n" +"# create formatter and add it to the handlers\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" +"ch.setFormatter(formatter)\n" +"fh.setFormatter(formatter)\n" +"# add the handlers to logger\n" +"logger.addHandler(ch)\n" +"logger.addHandler(fh)\n" +"\n" +"# 'application' code\n" +"logger.debug('debug message')\n" +"logger.info('info message')\n" +"logger.warning('warn message')\n" +"logger.error('error message')\n" +"logger.critical('critical message')" +msgstr "" + #: howto/logging-cookbook.rst:194 msgid "" "Notice that the 'application' code does not care about multiple handlers. " @@ -127,14 +288,69 @@ msgid "" "console messages should not. Here's how you can achieve this::" msgstr "" +#: howto/logging-cookbook.rst:216 +msgid "" +"import logging\n" +"\n" +"# set up logging to file - see previous section for more details\n" +"logging.basicConfig(level=logging.DEBUG,\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s " +"%(message)s',\n" +" datefmt='%m-%d %H:%M',\n" +" filename='/tmp/myapp.log',\n" +" filemode='w')\n" +"# define a Handler which writes INFO messages or higher to the sys.stderr\n" +"console = logging.StreamHandler()\n" +"console.setLevel(logging.INFO)\n" +"# set a format which is simpler for console use\n" +"formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')\n" +"# tell the handler to use this format\n" +"console.setFormatter(formatter)\n" +"# add the handler to the root logger\n" +"logging.getLogger('').addHandler(console)\n" +"\n" +"# Now, we can log to the root logger, or any other logger. First the " +"root...\n" +"logging.info('Jackdaws love my big sphinx of quartz.')\n" +"\n" +"# Now, define a couple of other loggers which might represent areas in your\n" +"# application:\n" +"\n" +"logger1 = logging.getLogger('myapp.area1')\n" +"logger2 = logging.getLogger('myapp.area2')\n" +"\n" +"logger1.debug('Quick zephyrs blow, vexing daft Jim.')\n" +"logger1.info('How quickly daft jumping zebras vex.')\n" +"logger2.warning('Jail zesty vixen who grabbed pay from quack.')\n" +"logger2.error('The five boxing wizards jump quickly.')" +msgstr "" + #: howto/logging-cookbook.rst:248 msgid "When you run this, on the console you will see" msgstr "" +#: howto/logging-cookbook.rst:250 +msgid "" +"root : INFO Jackdaws love my big sphinx of quartz.\n" +"myapp.area1 : INFO How quickly daft jumping zebras vex.\n" +"myapp.area2 : WARNING Jail zesty vixen who grabbed pay from quack.\n" +"myapp.area2 : ERROR The five boxing wizards jump quickly." +msgstr "" + #: howto/logging-cookbook.rst:257 msgid "and in the file you will see something like" msgstr "" +#: howto/logging-cookbook.rst:259 +msgid "" +"10-22 22:19 root INFO Jackdaws love my big sphinx of quartz.\n" +"10-22 22:19 myapp.area1 DEBUG Quick zephyrs blow, vexing daft Jim.\n" +"10-22 22:19 myapp.area1 INFO How quickly daft jumping zebras vex.\n" +"10-22 22:19 myapp.area2 WARNING Jail zesty vixen who grabbed pay from " +"quack.\n" +"10-22 22:19 myapp.area2 ERROR The five boxing wizards jump quickly." +msgstr "" + #: howto/logging-cookbook.rst:267 msgid "" "As you can see, the DEBUG message only shows up in the file. The other " @@ -184,25 +400,103 @@ msgstr "" msgid "Suppose you configure logging with the following JSON:" msgstr "" +#: howto/logging-cookbook.rst:295 +msgid "" +"{\n" +" \"version\": 1,\n" +" \"disable_existing_loggers\": false,\n" +" \"formatters\": {\n" +" \"simple\": {\n" +" \"format\": \"%(levelname)-8s - %(message)s\"\n" +" }\n" +" },\n" +" \"handlers\": {\n" +" \"stdout\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"INFO\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stdout\"\n" +" },\n" +" \"stderr\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"ERROR\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stderr\"\n" +" },\n" +" \"file\": {\n" +" \"class\": \"logging.FileHandler\",\n" +" \"formatter\": \"simple\",\n" +" \"filename\": \"app.log\",\n" +" \"mode\": \"w\"\n" +" }\n" +" },\n" +" \"root\": {\n" +" \"level\": \"DEBUG\",\n" +" \"handlers\": [\n" +" \"stderr\",\n" +" \"stdout\",\n" +" \"file\"\n" +" ]\n" +" }\n" +"}" +msgstr "" + #: howto/logging-cookbook.rst:335 msgid "" "This configuration does *almost* what we want, except that ``sys.stdout`` " -"would show messages of severity ``ERROR`` and above as well as ``INFO`` and " -"``WARNING`` messages. To prevent this, we can set up a filter which excludes " -"those messages and add it to the relevant handler. This can be configured by " -"adding a ``filters`` section parallel to ``formatters`` and ``handlers``:" +"would show messages of severity ``ERROR`` and only events of this severity " +"and higher will be tracked as well as ``INFO`` and ``WARNING`` messages. To " +"prevent this, we can set up a filter which excludes those messages and add " +"it to the relevant handler. This can be configured by adding a ``filters`` " +"section parallel to ``formatters`` and ``handlers``:" +msgstr "" + +#: howto/logging-cookbook.rst:341 +msgid "" +"{\n" +" \"filters\": {\n" +" \"warnings_and_below\": {\n" +" \"()\" : \"__main__.filter_maker\",\n" +" \"level\": \"WARNING\"\n" +" }\n" +" }\n" +"}" msgstr "" #: howto/logging-cookbook.rst:352 msgid "and changing the section on the ``stdout`` handler to add it:" msgstr "" +#: howto/logging-cookbook.rst:354 +msgid "" +"{\n" +" \"stdout\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"INFO\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stdout\",\n" +" \"filters\": [\"warnings_and_below\"]\n" +" }\n" +"}" +msgstr "" + #: howto/logging-cookbook.rst:366 msgid "" "A filter is just a function, so we can define the ``filter_maker`` (a " "factory function) as follows:" msgstr "" +#: howto/logging-cookbook.rst:369 +msgid "" +"def filter_maker(level):\n" +" level = getattr(logging, level)\n" +"\n" +" def filter(record):\n" +" return record.levelno <= level\n" +"\n" +" return filter" +msgstr "" + #: howto/logging-cookbook.rst:379 msgid "" "This converts the string argument passed in to a numeric level, and returns " @@ -218,14 +512,110 @@ msgstr "" msgid "With the filter added, we can run ``main.py``, which in full is:" msgstr "" +#: howto/logging-cookbook.rst:389 +msgid "" +"import json\n" +"import logging\n" +"import logging.config\n" +"\n" +"CONFIG = '''\n" +"{\n" +" \"version\": 1,\n" +" \"disable_existing_loggers\": false,\n" +" \"formatters\": {\n" +" \"simple\": {\n" +" \"format\": \"%(levelname)-8s - %(message)s\"\n" +" }\n" +" },\n" +" \"filters\": {\n" +" \"warnings_and_below\": {\n" +" \"()\" : \"__main__.filter_maker\",\n" +" \"level\": \"WARNING\"\n" +" }\n" +" },\n" +" \"handlers\": {\n" +" \"stdout\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"INFO\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stdout\",\n" +" \"filters\": [\"warnings_and_below\"]\n" +" },\n" +" \"stderr\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"ERROR\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stderr\"\n" +" },\n" +" \"file\": {\n" +" \"class\": \"logging.FileHandler\",\n" +" \"formatter\": \"simple\",\n" +" \"filename\": \"app.log\",\n" +" \"mode\": \"w\"\n" +" }\n" +" },\n" +" \"root\": {\n" +" \"level\": \"DEBUG\",\n" +" \"handlers\": [\n" +" \"stderr\",\n" +" \"stdout\",\n" +" \"file\"\n" +" ]\n" +" }\n" +"}\n" +"'''\n" +"\n" +"def filter_maker(level):\n" +" level = getattr(logging, level)\n" +"\n" +" def filter(record):\n" +" return record.levelno <= level\n" +"\n" +" return filter\n" +"\n" +"logging.config.dictConfig(json.loads(CONFIG))\n" +"logging.debug('A DEBUG message')\n" +"logging.info('An INFO message')\n" +"logging.warning('A WARNING message')\n" +"logging.error('An ERROR message')\n" +"logging.critical('A CRITICAL message')" +msgstr "" + #: howto/logging-cookbook.rst:457 msgid "And after running it like this:" msgstr "" +#: howto/logging-cookbook.rst:459 +msgid "python main.py 2>stderr.log >stdout.log" +msgstr "" + #: howto/logging-cookbook.rst:463 msgid "We can see the results are as expected:" msgstr "" +#: howto/logging-cookbook.rst:465 +msgid "" +"$ more *.log\n" +"::::::::::::::\n" +"app.log\n" +"::::::::::::::\n" +"DEBUG - A DEBUG message\n" +"INFO - An INFO message\n" +"WARNING - A WARNING message\n" +"ERROR - An ERROR message\n" +"CRITICAL - A CRITICAL message\n" +"::::::::::::::\n" +"stderr.log\n" +"::::::::::::::\n" +"ERROR - An ERROR message\n" +"CRITICAL - A CRITICAL message\n" +"::::::::::::::\n" +"stdout.log\n" +"::::::::::::::\n" +"INFO - An INFO message\n" +"WARNING - A WARNING message" +msgstr "" + #: howto/logging-cookbook.rst:489 msgid "Configuration server example" msgstr "" @@ -234,6 +624,38 @@ msgstr "" msgid "Here is an example of a module using the logging configuration server::" msgstr "" +#: howto/logging-cookbook.rst:493 +msgid "" +"import logging\n" +"import logging.config\n" +"import time\n" +"import os\n" +"\n" +"# read initial config file\n" +"logging.config.fileConfig('logging.conf')\n" +"\n" +"# create and start listener on port 9999\n" +"t = logging.config.listen(9999)\n" +"t.start()\n" +"\n" +"logger = logging.getLogger('simpleExample')\n" +"\n" +"try:\n" +" # loop through logging calls to see the difference\n" +" # new configurations make, until Ctrl+C is pressed\n" +" while True:\n" +" logger.debug('debug message')\n" +" logger.info('info message')\n" +" logger.warning('warn message')\n" +" logger.error('error message')\n" +" logger.critical('critical message')\n" +" time.sleep(5)\n" +"except KeyboardInterrupt:\n" +" # cleanup\n" +" logging.config.stopListening()\n" +" t.join()" +msgstr "" + #: howto/logging-cookbook.rst:522 msgid "" "And here is a script that takes a filename and sends that file to the " @@ -241,6 +663,26 @@ msgid "" "configuration::" msgstr "" +#: howto/logging-cookbook.rst:526 +msgid "" +"#!/usr/bin/env python\n" +"import socket, sys, struct\n" +"\n" +"with open(sys.argv[1], 'rb') as f:\n" +" data_to_send = f.read()\n" +"\n" +"HOST = 'localhost'\n" +"PORT = 9999\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"print('connecting...')\n" +"s.connect((HOST, PORT))\n" +"print('sending config...')\n" +"s.send(struct.pack('>L', len(data_to_send)))\n" +"s.send(data_to_send)\n" +"s.close()\n" +"print('complete')" +msgstr "" + #: howto/logging-cookbook.rst:547 msgid "Dealing with handlers that block" msgstr "" @@ -301,10 +743,33 @@ msgstr "" msgid "An example of using these two classes follows (imports omitted)::" msgstr "" +#: howto/logging-cookbook.rst:589 +msgid "" +"que = queue.Queue(-1) # no limit on size\n" +"queue_handler = QueueHandler(que)\n" +"handler = logging.StreamHandler()\n" +"listener = QueueListener(que, handler)\n" +"root = logging.getLogger()\n" +"root.addHandler(queue_handler)\n" +"formatter = logging.Formatter('%(threadName)s: %(message)s')\n" +"handler.setFormatter(formatter)\n" +"listener.start()\n" +"# The log output will display the thread which generated\n" +"# the event (the main thread) rather than the internal\n" +"# thread which monitors the internal queue. This is what\n" +"# you want to happen.\n" +"root.warning('Look out!')\n" +"listener.stop()" +msgstr "" + #: howto/logging-cookbook.rst:605 msgid "which, when run, will produce:" msgstr "" +#: howto/logging-cookbook.rst:607 +msgid "MainThread: Look out!" +msgstr "" + #: howto/logging-cookbook.rst:611 msgid "" "Although the earlier discussion wasn't specifically talking about async " @@ -328,30 +793,175 @@ msgid "" "handler if it's appropriate to do so." msgstr "" -#: howto/logging-cookbook.rst:632 +#: howto/logging-cookbook.rst:629 +msgid "" +"The :class:`QueueListener` can be started (and stopped) via the :keyword:" +"`with` statement. For example:" +msgstr "" + +#: howto/logging-cookbook.rst:633 +msgid "" +"with QueueListener(que, handler) as listener:\n" +" # The queue listener automatically starts\n" +" # when the 'with' block is entered.\n" +" pass\n" +"# The queue listener automatically stops once\n" +"# the 'with' block is exited." +msgstr "" + +#: howto/logging-cookbook.rst:645 msgid "Sending and receiving logging events across a network" msgstr "" -#: howto/logging-cookbook.rst:634 +#: howto/logging-cookbook.rst:647 msgid "" "Let's say you want to send logging events across a network, and handle them " "at the receiving end. A simple way of doing this is attaching a :class:" "`SocketHandler` instance to the root logger at the sending end::" msgstr "" -#: howto/logging-cookbook.rst:662 +#: howto/logging-cookbook.rst:651 +msgid "" +"import logging, logging.handlers\n" +"\n" +"rootLogger = logging.getLogger('')\n" +"rootLogger.setLevel(logging.DEBUG)\n" +"socketHandler = logging.handlers.SocketHandler('localhost',\n" +" logging.handlers.DEFAULT_TCP_LOGGING_PORT)\n" +"# don't bother with a formatter, since a socket handler sends the event as\n" +"# an unformatted pickle\n" +"rootLogger.addHandler(socketHandler)\n" +"\n" +"# Now, we can log to the root logger, or any other logger. First the " +"root...\n" +"logging.info('Jackdaws love my big sphinx of quartz.')\n" +"\n" +"# Now, define a couple of other loggers which might represent areas in your\n" +"# application:\n" +"\n" +"logger1 = logging.getLogger('myapp.area1')\n" +"logger2 = logging.getLogger('myapp.area2')\n" +"\n" +"logger1.debug('Quick zephyrs blow, vexing daft Jim.')\n" +"logger1.info('How quickly daft jumping zebras vex.')\n" +"logger2.warning('Jail zesty vixen who grabbed pay from quack.')\n" +"logger2.error('The five boxing wizards jump quickly.')" +msgstr "" + +#: howto/logging-cookbook.rst:675 msgid "" "At the receiving end, you can set up a receiver using the :mod:" "`socketserver` module. Here is a basic working example::" msgstr "" -#: howto/logging-cookbook.rst:750 +#: howto/logging-cookbook.rst:678 +msgid "" +"import pickle\n" +"import logging\n" +"import logging.handlers\n" +"import socketserver\n" +"import struct\n" +"\n" +"\n" +"class LogRecordStreamHandler(socketserver.StreamRequestHandler):\n" +" \"\"\"Handler for a streaming logging request.\n" +"\n" +" This basically logs the record using whatever logging policy is\n" +" configured locally.\n" +" \"\"\"\n" +"\n" +" def handle(self):\n" +" \"\"\"\n" +" Handle multiple requests - each expected to be a 4-byte length,\n" +" followed by the LogRecord in pickle format. Logs the record\n" +" according to whatever policy is configured locally.\n" +" \"\"\"\n" +" while True:\n" +" chunk = self.connection.recv(4)\n" +" if len(chunk) < 4:\n" +" break\n" +" slen = struct.unpack('>L', chunk)[0]\n" +" chunk = self.connection.recv(slen)\n" +" while len(chunk) < slen:\n" +" chunk = chunk + self.connection.recv(slen - len(chunk))\n" +" obj = self.unPickle(chunk)\n" +" record = logging.makeLogRecord(obj)\n" +" self.handleLogRecord(record)\n" +"\n" +" def unPickle(self, data):\n" +" return pickle.loads(data)\n" +"\n" +" def handleLogRecord(self, record):\n" +" # if a name is specified, we use the named logger rather than the " +"one\n" +" # implied by the record.\n" +" if self.server.logname is not None:\n" +" name = self.server.logname\n" +" else:\n" +" name = record.name\n" +" logger = logging.getLogger(name)\n" +" # N.B. EVERY record gets logged. This is because Logger.handle\n" +" # is normally called AFTER logger-level filtering. If you want\n" +" # to do filtering, do it at the client end to save wasting\n" +" # cycles and network bandwidth!\n" +" logger.handle(record)\n" +"\n" +"class LogRecordSocketReceiver(socketserver.ThreadingTCPServer):\n" +" \"\"\"\n" +" Simple TCP socket-based logging receiver suitable for testing.\n" +" \"\"\"\n" +"\n" +" allow_reuse_address = True\n" +"\n" +" def __init__(self, host='localhost',\n" +" port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,\n" +" handler=LogRecordStreamHandler):\n" +" socketserver.ThreadingTCPServer.__init__(self, (host, port), " +"handler)\n" +" self.abort = 0\n" +" self.timeout = 1\n" +" self.logname = None\n" +"\n" +" def serve_until_stopped(self):\n" +" import select\n" +" abort = 0\n" +" while not abort:\n" +" rd, wr, ex = select.select([self.socket.fileno()],\n" +" [], [],\n" +" self.timeout)\n" +" if rd:\n" +" self.handle_request()\n" +" abort = self.abort\n" +"\n" +"def main():\n" +" logging.basicConfig(\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " +"%(message)s')\n" +" tcpserver = LogRecordSocketReceiver()\n" +" print('About to start TCP server...')\n" +" tcpserver.serve_until_stopped()\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:763 msgid "" "First run the server, and then the client. On the client side, nothing is " "printed on the console; on the server side, you should see something like:" msgstr "" -#: howto/logging-cookbook.rst:762 +#: howto/logging-cookbook.rst:766 +msgid "" +"About to start TCP server...\n" +" 59 root INFO Jackdaws love my big sphinx of quartz.\n" +" 59 myapp.area1 DEBUG Quick zephyrs blow, vexing daft Jim.\n" +" 69 myapp.area1 INFO How quickly daft jumping zebras vex.\n" +" 69 myapp.area2 WARNING Jail zesty vixen who grabbed pay from quack.\n" +" 69 myapp.area2 ERROR The five boxing wizards jump quickly." +msgstr "" + +#: howto/logging-cookbook.rst:775 msgid "" "Note that there are some security issues with pickle in some scenarios. If " "these affect you, you can use an alternative serialization scheme by " @@ -360,11 +970,11 @@ msgid "" "alternative serialization." msgstr "" -#: howto/logging-cookbook.rst:770 +#: howto/logging-cookbook.rst:783 msgid "Running a logging socket listener in production" msgstr "" -#: howto/logging-cookbook.rst:774 +#: howto/logging-cookbook.rst:787 msgid "" "To run a logging listener in production, you may need to use a process-" "management tool such as `Supervisor `_. `Here is a " @@ -372,79 +982,79 @@ msgid "" "the above functionality using Supervisor. It consists of the following files:" msgstr "" -#: howto/logging-cookbook.rst:781 +#: howto/logging-cookbook.rst:794 msgid "File" msgstr "" -#: howto/logging-cookbook.rst:781 +#: howto/logging-cookbook.rst:794 msgid "Purpose" msgstr "" -#: howto/logging-cookbook.rst:783 +#: howto/logging-cookbook.rst:796 msgid ":file:`prepare.sh`" msgstr "" -#: howto/logging-cookbook.rst:783 +#: howto/logging-cookbook.rst:796 msgid "A Bash script to prepare the environment for testing" msgstr "" -#: howto/logging-cookbook.rst:786 +#: howto/logging-cookbook.rst:799 msgid ":file:`supervisor.conf`" msgstr "" -#: howto/logging-cookbook.rst:786 +#: howto/logging-cookbook.rst:799 msgid "" "The Supervisor configuration file, which has entries for the listener and a " "multi-process web application" msgstr "" -#: howto/logging-cookbook.rst:790 +#: howto/logging-cookbook.rst:803 msgid ":file:`ensure_app.sh`" msgstr "" -#: howto/logging-cookbook.rst:790 +#: howto/logging-cookbook.rst:803 msgid "" "A Bash script to ensure that Supervisor is running with the above " "configuration" msgstr "" -#: howto/logging-cookbook.rst:793 +#: howto/logging-cookbook.rst:806 msgid ":file:`log_listener.py`" msgstr "" -#: howto/logging-cookbook.rst:793 +#: howto/logging-cookbook.rst:806 msgid "" "The socket listener program which receives log events and records them to a " "file" msgstr "" -#: howto/logging-cookbook.rst:796 +#: howto/logging-cookbook.rst:809 msgid ":file:`main.py`" msgstr "" -#: howto/logging-cookbook.rst:796 +#: howto/logging-cookbook.rst:809 msgid "" "A simple web application which performs logging via a socket connected to " "the listener" msgstr "" -#: howto/logging-cookbook.rst:799 +#: howto/logging-cookbook.rst:812 msgid ":file:`webapp.json`" msgstr "" -#: howto/logging-cookbook.rst:799 +#: howto/logging-cookbook.rst:812 msgid "A JSON configuration file for the web application" msgstr "" -#: howto/logging-cookbook.rst:801 +#: howto/logging-cookbook.rst:814 msgid ":file:`client.py`" msgstr "" -#: howto/logging-cookbook.rst:801 +#: howto/logging-cookbook.rst:814 msgid "A Python script to exercise the web application" msgstr "" -#: howto/logging-cookbook.rst:804 +#: howto/logging-cookbook.rst:817 msgid "" "The web application uses `Gunicorn `_, which is a " "popular web application server that starts multiple worker processes to " @@ -453,21 +1063,21 @@ msgid "" "the socket listener." msgstr "" -#: howto/logging-cookbook.rst:809 +#: howto/logging-cookbook.rst:822 msgid "To test these files, do the following in a POSIX environment:" msgstr "" -#: howto/logging-cookbook.rst:811 +#: howto/logging-cookbook.rst:824 msgid "" "Download `the Gist `__ as a ZIP archive using the :" "guilabel:`Download ZIP` button." msgstr "" -#: howto/logging-cookbook.rst:814 +#: howto/logging-cookbook.rst:827 msgid "Unzip the above files from the archive into a scratch directory." msgstr "" -#: howto/logging-cookbook.rst:816 +#: howto/logging-cookbook.rst:829 msgid "" "In the scratch directory, run ``bash prepare.sh`` to get things ready. This " "creates a :file:`run` subdirectory to contain Supervisor-related and log " @@ -475,19 +1085,19 @@ msgid "" "which ``bottle``, ``gunicorn`` and ``supervisor`` are installed." msgstr "" -#: howto/logging-cookbook.rst:821 +#: howto/logging-cookbook.rst:834 msgid "" "Run ``bash ensure_app.sh`` to ensure that Supervisor is running with the " "above configuration." msgstr "" -#: howto/logging-cookbook.rst:824 +#: howto/logging-cookbook.rst:837 msgid "" "Run ``venv/bin/python client.py`` to exercise the web application, which " "will lead to records being written to the log." msgstr "" -#: howto/logging-cookbook.rst:827 +#: howto/logging-cookbook.rst:840 msgid "" "Inspect the log files in the :file:`run` subdirectory. You should see the " "most recent log lines in files matching the pattern :file:`app.log*`. They " @@ -495,23 +1105,44 @@ msgid "" "by different worker processes in a non-deterministic way." msgstr "" -#: howto/logging-cookbook.rst:832 +#: howto/logging-cookbook.rst:845 msgid "" "You can shut down the listener and the web application by running ``venv/bin/" "supervisorctl -c supervisor.conf shutdown``." msgstr "" -#: howto/logging-cookbook.rst:835 +#: howto/logging-cookbook.rst:848 msgid "" "You may need to tweak the configuration files in the unlikely event that the " "configured ports clash with something else in your test environment." msgstr "" -#: howto/logging-cookbook.rst:843 +#: howto/logging-cookbook.rst:851 +msgid "" +"The default configuration uses a TCP socket on port 9020. You can use a Unix " +"Domain socket instead of a TCP socket by doing the following:" +msgstr "" + +#: howto/logging-cookbook.rst:854 +msgid "" +"In :file:`listener.json`, add a ``socket`` key with the path to the domain " +"socket you want to use. If this key is present, the listener listens on the " +"corresponding domain socket and not on a TCP socket (the ``port`` key is " +"ignored)." +msgstr "" + +#: howto/logging-cookbook.rst:859 +msgid "" +"In :file:`webapp.json`, change the socket handler configuration dictionary " +"so that the ``host`` value is the path to the domain socket, and set the " +"``port`` value to ``null``." +msgstr "" + +#: howto/logging-cookbook.rst:869 msgid "Adding contextual information to your logging output" msgstr "" -#: howto/logging-cookbook.rst:845 +#: howto/logging-cookbook.rst:871 msgid "" "Sometimes you want logging output to contain contextual information in " "addition to the parameters passed to the logging call. For example, in a " @@ -527,11 +1158,11 @@ msgid "" "`Logger` instances becomes effectively unbounded." msgstr "" -#: howto/logging-cookbook.rst:860 +#: howto/logging-cookbook.rst:886 msgid "Using LoggerAdapters to impart contextual information" msgstr "" -#: howto/logging-cookbook.rst:862 +#: howto/logging-cookbook.rst:888 msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " @@ -542,7 +1173,7 @@ msgid "" "types of instances interchangeably." msgstr "" -#: howto/logging-cookbook.rst:870 +#: howto/logging-cookbook.rst:896 msgid "" "When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" "`Logger` instance and a dict-like object which contains your contextual " @@ -553,7 +1184,18 @@ msgid "" "of :class:`LoggerAdapter`::" msgstr "" -#: howto/logging-cookbook.rst:886 +#: howto/logging-cookbook.rst:904 +msgid "" +"def debug(self, msg, /, *args, **kwargs):\n" +" \"\"\"\n" +" Delegate a debug call to the underlying logger, after adding\n" +" contextual information from this adapter instance.\n" +" \"\"\"\n" +" msg, kwargs = self.process(msg, kwargs)\n" +" self.logger.debug(msg, *args, **kwargs)" +msgstr "" + +#: howto/logging-cookbook.rst:912 msgid "" "The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where " "the contextual information is added to the logging output. It's passed the " @@ -566,7 +1208,7 @@ msgid "" "be silently overwritten." msgstr "" -#: howto/logging-cookbook.rst:895 +#: howto/logging-cookbook.rst:921 msgid "" "The advantage of using 'extra' is that the values in the dict-like object " "are merged into the :class:`LogRecord` instance's __dict__, allowing you to " @@ -577,21 +1219,38 @@ msgid "" "`~LoggerAdapter.process` to do what you need. Here is a simple example::" msgstr "" -#: howto/logging-cookbook.rst:911 +#: howto/logging-cookbook.rst:929 +msgid "" +"class CustomAdapter(logging.LoggerAdapter):\n" +" \"\"\"\n" +" This example adapter expects the passed in dict-like object to have a\n" +" 'connid' key, whose value in brackets is prepended to the log message.\n" +" \"\"\"\n" +" def process(self, msg, kwargs):\n" +" return '[%s] %s' % (self.extra['connid'], msg), kwargs" +msgstr "" + +#: howto/logging-cookbook.rst:937 msgid "which you can use like this::" msgstr "" -#: howto/logging-cookbook.rst:916 +#: howto/logging-cookbook.rst:939 +msgid "" +"logger = logging.getLogger(__name__)\n" +"adapter = CustomAdapter(logger, {'connid': some_conn_id})" +msgstr "" + +#: howto/logging-cookbook.rst:942 msgid "" "Then any events that you log to the adapter will have the value of " "``some_conn_id`` prepended to the log messages." msgstr "" -#: howto/logging-cookbook.rst:920 +#: howto/logging-cookbook.rst:946 msgid "Using objects other than dicts to pass contextual information" msgstr "" -#: howto/logging-cookbook.rst:922 +#: howto/logging-cookbook.rst:948 msgid "" "You don't need to pass an actual dict to a :class:`LoggerAdapter` - you " "could pass an instance of a class which implements ``__getitem__`` and " @@ -600,11 +1259,11 @@ msgid "" "would be constant)." msgstr "" -#: howto/logging-cookbook.rst:931 +#: howto/logging-cookbook.rst:957 msgid "Using Filters to impart contextual information" msgstr "" -#: howto/logging-cookbook.rst:933 +#: howto/logging-cookbook.rst:959 msgid "" "You can also add contextual information to log output using a user-defined :" "class:`Filter`. ``Filter`` instances are allowed to modify the " @@ -613,7 +1272,7 @@ msgid "" "class:`Formatter`." msgstr "" -#: howto/logging-cookbook.rst:938 +#: howto/logging-cookbook.rst:964 msgid "" "For example in a web application, the request being processed (or at least, " "the interesting parts of it) can be stored in a threadlocal (:class:" @@ -625,15 +1284,86 @@ msgid "" "an example script::" msgstr "" -#: howto/logging-cookbook.rst:984 +#: howto/logging-cookbook.rst:973 +msgid "" +"import logging\n" +"from random import choice\n" +"\n" +"class ContextFilter(logging.Filter):\n" +" \"\"\"\n" +" This is a filter which injects contextual information into the log.\n" +"\n" +" Rather than use actual contextual information, we just use random\n" +" data in this demo.\n" +" \"\"\"\n" +"\n" +" USERS = ['jim', 'fred', 'sheila']\n" +" IPS = ['123.231.231.123', '127.0.0.1', '192.168.0.1']\n" +"\n" +" def filter(self, record):\n" +"\n" +" record.ip = choice(ContextFilter.IPS)\n" +" record.user = choice(ContextFilter.USERS)\n" +" return True\n" +"\n" +"if __name__ == '__main__':\n" +" levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, " +"logging.CRITICAL)\n" +" logging.basicConfig(level=logging.DEBUG,\n" +" format='%(asctime)-15s %(name)-5s %(levelname)-8s " +"IP: %(ip)-15s User: %(user)-8s %(message)s')\n" +" a1 = logging.getLogger('a.b.c')\n" +" a2 = logging.getLogger('d.e.f')\n" +"\n" +" f = ContextFilter()\n" +" a1.addFilter(f)\n" +" a2.addFilter(f)\n" +" a1.debug('A debug message')\n" +" a1.info('An info message with %s', 'some parameters')\n" +" for x in range(10):\n" +" lvl = choice(levels)\n" +" lvlname = logging.getLevelName(lvl)\n" +" a2.log(lvl, 'A message at %s level with %d %s', lvlname, 2, " +"'parameters')" +msgstr "" + +#: howto/logging-cookbook.rst:1010 msgid "which, when run, produces something like:" msgstr "" -#: howto/logging-cookbook.rst:1002 +#: howto/logging-cookbook.rst:1012 +msgid "" +"2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A " +"debug message\n" +"2010-09-06 22:38:15,300 a.b.c INFO IP: 192.168.0.1 User: sheila An " +"info message with some parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1 User: sheila A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f ERROR IP: 127.0.0.1 User: jim A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f DEBUG IP: 127.0.0.1 User: sheila A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f ERROR IP: 123.231.231.123 User: fred A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 192.168.0.1 User: jim A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1 User: sheila A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f DEBUG IP: 192.168.0.1 User: jim A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f ERROR IP: 127.0.0.1 User: sheila A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f DEBUG IP: 123.231.231.123 User: fred A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f INFO IP: 123.231.231.123 User: fred A " +"message at INFO level with 2 parameters" +msgstr "" + +#: howto/logging-cookbook.rst:1028 msgid "Use of ``contextvars``" msgstr "" -#: howto/logging-cookbook.rst:1004 +#: howto/logging-cookbook.rst:1030 msgid "" "Since Python 3.7, the :mod:`contextvars` module has provided context-local " "storage which works for both :mod:`threading` and :mod:`asyncio` processing " @@ -643,7 +1373,7 @@ msgid "" "attributes handled by web applications." msgstr "" -#: howto/logging-cookbook.rst:1010 +#: howto/logging-cookbook.rst:1036 msgid "" "For the purposes of illustration, say that you have different web " "applications, each independent of the other but running in the same Python " @@ -654,18 +1384,188 @@ msgid "" "information such as client IP, HTTP request method and client username?" msgstr "" -#: howto/logging-cookbook.rst:1017 +#: howto/logging-cookbook.rst:1043 msgid "Let's assume that the library can be simulated by the following code:" msgstr "" -#: howto/logging-cookbook.rst:1033 +#: howto/logging-cookbook.rst:1045 +msgid "" +"# webapplib.py\n" +"import logging\n" +"import time\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def useful():\n" +" # Just a representative event logged from the library\n" +" logger.debug('Hello from webapplib!')\n" +" # Just sleep for a bit so other threads get to run\n" +" time.sleep(0.01)" +msgstr "" + +#: howto/logging-cookbook.rst:1059 msgid "" "We can simulate the multiple web applications by means of two simple " "classes, ``Request`` and ``WebApp``. These simulate how real threaded web " "applications work - each request is handled by a thread:" msgstr "" -#: howto/logging-cookbook.rst:1177 +#: howto/logging-cookbook.rst:1063 +msgid "" +"# main.py\n" +"import argparse\n" +"from contextvars import ContextVar\n" +"import logging\n" +"import os\n" +"from random import choice\n" +"import threading\n" +"import webapplib\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"root = logging.getLogger()\n" +"root.setLevel(logging.DEBUG)\n" +"\n" +"class Request:\n" +" \"\"\"\n" +" A simple dummy request class which just holds dummy HTTP request " +"method,\n" +" client IP address and client username\n" +" \"\"\"\n" +" def __init__(self, method, ip, user):\n" +" self.method = method\n" +" self.ip = ip\n" +" self.user = user\n" +"\n" +"# A dummy set of requests which will be used in the simulation - we'll just " +"pick\n" +"# from this list randomly. Note that all GET requests are from 192.168.2." +"XXX\n" +"# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " +"users\n" +"# are represented in the sample requests.\n" +"\n" +"REQUESTS = [\n" +" Request('GET', '192.168.2.20', 'jim'),\n" +" Request('POST', '192.168.3.20', 'fred'),\n" +" Request('GET', '192.168.2.21', 'sheila'),\n" +" Request('POST', '192.168.3.21', 'jim'),\n" +" Request('GET', '192.168.2.22', 'fred'),\n" +" Request('POST', '192.168.3.22', 'sheila'),\n" +"]\n" +"\n" +"# Note that the format string includes references to request context " +"information\n" +"# such as HTTP method, client IP and username\n" +"\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s " +"%(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"\n" +"# Create our context variables. These will be filled at the start of " +"request\n" +"# processing, and used in the logging that happens during that processing\n" +"\n" +"ctx_request = ContextVar('request')\n" +"ctx_appname = ContextVar('appname')\n" +"\n" +"class InjectingFilter(logging.Filter):\n" +" \"\"\"\n" +" A filter which injects context-specific information into logs and " +"ensures\n" +" that only information for a specific webapp is included in its log\n" +" \"\"\"\n" +" def __init__(self, app):\n" +" self.app = app\n" +"\n" +" def filter(self, record):\n" +" request = ctx_request.get()\n" +" record.method = request.method\n" +" record.ip = request.ip\n" +" record.user = request.user\n" +" record.appName = appName = ctx_appname.get()\n" +" return appName == self.app.name\n" +"\n" +"class WebApp:\n" +" \"\"\"\n" +" A dummy web application class which has its own handler and filter for " +"a\n" +" webapp-specific log.\n" +" \"\"\"\n" +" def __init__(self, name):\n" +" self.name = name\n" +" handler = logging.FileHandler(name + '.log', 'w')\n" +" f = InjectingFilter(self)\n" +" handler.setFormatter(formatter)\n" +" handler.addFilter(f)\n" +" root.addHandler(handler)\n" +" self.num_requests = 0\n" +"\n" +" def process_request(self, request):\n" +" \"\"\"\n" +" This is the dummy method for processing a request. It's called on a\n" +" different thread for every request. We store the context information " +"into\n" +" the context vars before doing anything else.\n" +" \"\"\"\n" +" ctx_request.set(request)\n" +" ctx_appname.set(self.name)\n" +" self.num_requests += 1\n" +" logger.debug('Request processing started')\n" +" webapplib.useful()\n" +" logger.debug('Request processing finished')\n" +"\n" +"def main():\n" +" fn = os.path.splitext(os.path.basename(__file__))[0]\n" +" adhf = argparse.ArgumentDefaultsHelpFormatter\n" +" ap = argparse.ArgumentParser(formatter_class=adhf, prog=fn,\n" +" description='Simulate a couple of web '\n" +" 'applications handling some '\n" +" 'requests, showing how request " +"'\n" +" 'context can be used to '\n" +" 'populate logs')\n" +" aa = ap.add_argument\n" +" aa('--count', '-c', type=int, default=100, help='How many requests to " +"simulate')\n" +" options = ap.parse_args()\n" +"\n" +" # Create the dummy webapps and put them in a list which we can use to " +"select\n" +" # from randomly\n" +" app1 = WebApp('app1')\n" +" app2 = WebApp('app2')\n" +" apps = [app1, app2]\n" +" threads = []\n" +" # Add a common handler which will capture all events\n" +" handler = logging.FileHandler('app.log', 'w')\n" +" handler.setFormatter(formatter)\n" +" root.addHandler(handler)\n" +"\n" +" # Generate calls to process requests\n" +" for i in range(options.count):\n" +" try:\n" +" # Pick an app at random and a request for it to process\n" +" app = choice(apps)\n" +" request = choice(REQUESTS)\n" +" # Process the request in its own thread\n" +" t = threading.Thread(target=app.process_request, " +"args=(request,))\n" +" threads.append(t)\n" +" t.start()\n" +" except KeyboardInterrupt:\n" +" break\n" +"\n" +" # Wait for the threads to terminate\n" +" for t in threads:\n" +" t.join()\n" +"\n" +" for app in apps:\n" +" print('%s processed %s requests' % (app.name, app.num_requests))\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:1203 msgid "" "If you run the above, you should find that roughly half the requests go " "into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " @@ -676,11 +1576,66 @@ msgid "" "illustrated by the following shell output:" msgstr "" -#: howto/logging-cookbook.rst:1224 +#: howto/logging-cookbook.rst:1210 +msgid "" +"~/logging-contextual-webapp$ python main.py\n" +"app1 processed 51 requests\n" +"app2 processed 49 requests\n" +"~/logging-contextual-webapp$ wc -l *.log\n" +" 153 app1.log\n" +" 147 app2.log\n" +" 300 app.log\n" +" 600 total\n" +"~/logging-contextual-webapp$ head -3 app1.log\n" +"Thread-3 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello " +"from webapplib!\n" +"Thread-5 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"~/logging-contextual-webapp$ head -3 app2.log\n" +"Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request " +"processing started\n" +"Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello " +"from webapplib!\n" +"Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request " +"processing started\n" +"~/logging-contextual-webapp$ head app.log\n" +"Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request " +"processing started\n" +"Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello " +"from webapplib!\n" +"Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request " +"processing started\n" +"Thread-3 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-2 (process_request) app2 webapplib jim 192.168.2.20 GET Hello " +"from webapplib!\n" +"Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello " +"from webapplib!\n" +"Thread-4 (process_request) app2 __main__ fred 192.168.2.22 GET Request " +"processing started\n" +"Thread-5 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-4 (process_request) app2 webapplib fred 192.168.2.22 GET Hello " +"from webapplib!\n" +"Thread-6 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"~/logging-contextual-webapp$ grep app1 app1.log | wc -l\n" +"153\n" +"~/logging-contextual-webapp$ grep app2 app2.log | wc -l\n" +"147\n" +"~/logging-contextual-webapp$ grep app1 app.log | wc -l\n" +"153\n" +"~/logging-contextual-webapp$ grep app2 app.log | wc -l\n" +"147" +msgstr "" + +#: howto/logging-cookbook.rst:1250 msgid "Imparting contextual information in handlers" msgstr "" -#: howto/logging-cookbook.rst:1226 +#: howto/logging-cookbook.rst:1252 msgid "" "Each :class:`~Handler` has its own chain of filters. If you want to add " "contextual information to a :class:`LogRecord` without leaking it to other " @@ -688,11 +1643,33 @@ msgid "" "instead of modifying it in-place, as shown in the following script::" msgstr "" -#: howto/logging-cookbook.rst:1253 +#: howto/logging-cookbook.rst:1257 +msgid "" +"import copy\n" +"import logging\n" +"\n" +"def filter(record: logging.LogRecord):\n" +" record = copy.copy(record)\n" +" record.user = 'jim'\n" +" return record\n" +"\n" +"if __name__ == '__main__':\n" +" logger = logging.getLogger()\n" +" logger.setLevel(logging.INFO)\n" +" handler = logging.StreamHandler()\n" +" formatter = logging.Formatter('%(message)s from %(user)-8s')\n" +" handler.setFormatter(formatter)\n" +" handler.addFilter(filter)\n" +" logger.addHandler(handler)\n" +"\n" +" logger.info('A log message')" +msgstr "" + +#: howto/logging-cookbook.rst:1279 msgid "Logging to a single file from multiple processes" msgstr "" -#: howto/logging-cookbook.rst:1255 +#: howto/logging-cookbook.rst:1281 msgid "" "Although logging is thread-safe, and logging to a single file from multiple " "threads in a single process *is* supported, logging to a single file from " @@ -708,18 +1685,15 @@ msgid "" "you to adapt in your own applications." msgstr "" -#: howto/logging-cookbook.rst:1268 +#: howto/logging-cookbook.rst:1294 msgid "" "You could also write your own handler which uses the :class:" "`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " -"serialize access to the file from your processes. The existing :class:" -"`FileHandler` and subclasses do not make use of :mod:`multiprocessing` at " -"present, though they may do so in the future. Note that at present, the :mod:" -"`multiprocessing` module does not provide working lock functionality on all " -"platforms (see https://bugs.python.org/issue3770)." +"serialize access to the file from your processes. The stdlib :class:" +"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." msgstr "" -#: howto/logging-cookbook.rst:1278 +#: howto/logging-cookbook.rst:1301 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -734,13 +1708,230 @@ msgid "" "requirements::" msgstr "" -#: howto/logging-cookbook.rst:1394 +#: howto/logging-cookbook.rst:1312 +msgid "" +"# You'll need these imports in your own code\n" +"import logging\n" +"import logging.handlers\n" +"import multiprocessing\n" +"\n" +"# Next two import lines for this demo only\n" +"from random import choice, random\n" +"import time\n" +"\n" +"#\n" +"# Because you'll want to define the logging configurations for listener and " +"workers, the\n" +"# listener and worker process functions take a configurer parameter which is " +"a callable\n" +"# for configuring logging for that process. These functions are also passed " +"the queue,\n" +"# which they use for communication.\n" +"#\n" +"# In practice, you can configure the listener however you want, but note " +"that in this\n" +"# simple example, the listener does not apply level or filter logic to " +"received records.\n" +"# In practice, you would probably want to do this logic in the worker " +"processes, to avoid\n" +"# sending events which would be filtered out between processes.\n" +"#\n" +"# The size of the rotated files is made small so you can see the results " +"easily.\n" +"def listener_configurer():\n" +" root = logging.getLogger()\n" +" h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s " +"%(levelname)-8s %(message)s')\n" +" h.setFormatter(f)\n" +" root.addHandler(h)\n" +"\n" +"# This is the listener process top-level loop: wait for logging events\n" +"# (LogRecords)on the queue and handle them, quit when you get a None for a\n" +"# LogRecord.\n" +"def listener_process(queue, configurer):\n" +" configurer()\n" +" while True:\n" +" try:\n" +" record = queue.get()\n" +" if record is None: # We send this as a sentinel to tell the " +"listener to quit.\n" +" break\n" +" logger = logging.getLogger(record.name)\n" +" logger.handle(record) # No level or filter logic applied - just " +"do it!\n" +" except Exception:\n" +" import sys, traceback\n" +" print('Whoops! Problem:', file=sys.stderr)\n" +" traceback.print_exc(file=sys.stderr)\n" +"\n" +"# Arrays used for random selections in this demo\n" +"\n" +"LEVELS = [logging.DEBUG, logging.INFO, logging.WARNING,\n" +" logging.ERROR, logging.CRITICAL]\n" +"\n" +"LOGGERS = ['a.b.c', 'd.e.f']\n" +"\n" +"MESSAGES = [\n" +" 'Random message #1',\n" +" 'Random message #2',\n" +" 'Random message #3',\n" +"]\n" +"\n" +"# The worker configuration is done at the start of the worker process run.\n" +"# Note that on Windows you can't rely on fork semantics, so each process\n" +"# will run the logging configuration code when it starts.\n" +"def worker_configurer(queue):\n" +" h = logging.handlers.QueueHandler(queue) # Just the one handler needed\n" +" root = logging.getLogger()\n" +" root.addHandler(h)\n" +" # send all messages, for demo; no other level or filter logic applied.\n" +" root.setLevel(logging.DEBUG)\n" +"\n" +"# This is the worker process top-level loop, which just logs ten events " +"with\n" +"# random intervening delays before terminating.\n" +"# The print messages are just so you know it's doing something!\n" +"def worker_process(queue, configurer):\n" +" configurer(queue)\n" +" name = multiprocessing.current_process().name\n" +" print('Worker started: %s' % name)\n" +" for i in range(10):\n" +" time.sleep(random())\n" +" logger = logging.getLogger(choice(LOGGERS))\n" +" level = choice(LEVELS)\n" +" message = choice(MESSAGES)\n" +" logger.log(level, message)\n" +" print('Worker finished: %s' % name)\n" +"\n" +"# Here's where the demo gets orchestrated. Create the queue, create and " +"start\n" +"# the listener, create ten workers and start them, wait for them to finish,\n" +"# then send a None to the queue to tell the listener to finish.\n" +"def main():\n" +" queue = multiprocessing.Queue(-1)\n" +" listener = multiprocessing.Process(target=listener_process,\n" +" args=(queue, listener_configurer))\n" +" listener.start()\n" +" workers = []\n" +" for i in range(10):\n" +" worker = multiprocessing.Process(target=worker_process,\n" +" args=(queue, worker_configurer))\n" +" workers.append(worker)\n" +" worker.start()\n" +" for w in workers:\n" +" w.join()\n" +" queue.put_nowait(None)\n" +" listener.join()\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:1417 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: howto/logging-cookbook.rst:1489 +#: howto/logging-cookbook.rst:1420 +msgid "" +"import logging\n" +"import logging.config\n" +"import logging.handlers\n" +"from multiprocessing import Process, Queue\n" +"import random\n" +"import threading\n" +"import time\n" +"\n" +"def logger_thread(q):\n" +" while True:\n" +" record = q.get()\n" +" if record is None:\n" +" break\n" +" logger = logging.getLogger(record.name)\n" +" logger.handle(record)\n" +"\n" +"\n" +"def worker_process(q):\n" +" qh = logging.handlers.QueueHandler(q)\n" +" root = logging.getLogger()\n" +" root.setLevel(logging.DEBUG)\n" +" root.addHandler(qh)\n" +" levels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" +" logging.CRITICAL]\n" +" loggers = ['foo', 'foo.bar', 'foo.bar.baz',\n" +" 'spam', 'spam.ham', 'spam.ham.eggs']\n" +" for i in range(100):\n" +" lvl = random.choice(levels)\n" +" logger = logging.getLogger(random.choice(loggers))\n" +" logger.log(lvl, 'Message no. %d', i)\n" +"\n" +"if __name__ == '__main__':\n" +" q = Queue()\n" +" d = {\n" +" 'version': 1,\n" +" 'formatters': {\n" +" 'detailed': {\n" +" 'class': 'logging.Formatter',\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " +"%(processName)-10s %(message)s'\n" +" }\n" +" },\n" +" 'handlers': {\n" +" 'console': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'level': 'INFO',\n" +" },\n" +" 'file': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog.log',\n" +" 'mode': 'w',\n" +" 'formatter': 'detailed',\n" +" },\n" +" 'foofile': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog-foo.log',\n" +" 'mode': 'w',\n" +" 'formatter': 'detailed',\n" +" },\n" +" 'errors': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog-errors.log',\n" +" 'mode': 'w',\n" +" 'level': 'ERROR',\n" +" 'formatter': 'detailed',\n" +" },\n" +" },\n" +" 'loggers': {\n" +" 'foo': {\n" +" 'handlers': ['foofile']\n" +" }\n" +" },\n" +" 'root': {\n" +" 'level': 'DEBUG',\n" +" 'handlers': ['console', 'file', 'errors']\n" +" },\n" +" }\n" +" workers = []\n" +" for i in range(5):\n" +" wp = Process(target=worker_process, name='worker %d' % (i + 1), " +"args=(q,))\n" +" workers.append(wp)\n" +" wp.start()\n" +" logging.config.dictConfig(d)\n" +" lp = threading.Thread(target=logger_thread, args=(q,))\n" +" lp.start()\n" +" # At this point, the main process could do some useful work of its own\n" +" # Once it's done that, it can wait for the workers to terminate...\n" +" for wp in workers:\n" +" wp.join()\n" +" # And now tell the logging thread to finish up, too\n" +" q.put(None)\n" +" lp.join()" +msgstr "" + +#: howto/logging-cookbook.rst:1512 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -750,34 +1941,63 @@ msgid "" "appropriate destinations." msgstr "" -#: howto/logging-cookbook.rst:1496 +#: howto/logging-cookbook.rst:1519 msgid "Using concurrent.futures.ProcessPoolExecutor" msgstr "" -#: howto/logging-cookbook.rst:1498 +#: howto/logging-cookbook.rst:1521 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: howto/logging-cookbook.rst:1506 +#: howto/logging-cookbook.rst:1525 +msgid "queue = multiprocessing.Queue(-1)" +msgstr "" + +#: howto/logging-cookbook.rst:1529 msgid "you should use" msgstr "" -#: howto/logging-cookbook.rst:1512 +#: howto/logging-cookbook.rst:1531 +msgid "" +"queue = multiprocessing.Manager().Queue(-1) # also works with the examples " +"above" +msgstr "" + +#: howto/logging-cookbook.rst:1535 msgid "and you can then replace the worker creation from this::" msgstr "" -#: howto/logging-cookbook.rst:1523 +#: howto/logging-cookbook.rst:1537 +msgid "" +"workers = []\n" +"for i in range(10):\n" +" worker = multiprocessing.Process(target=worker_process,\n" +" args=(queue, worker_configurer))\n" +" workers.append(worker)\n" +" worker.start()\n" +"for w in workers:\n" +" w.join()" +msgstr "" + +#: howto/logging-cookbook.rst:1546 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: howto/logging-cookbook.rst:1530 +#: howto/logging-cookbook.rst:1548 +msgid "" +"with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" +" for i in range(10):\n" +" executor.submit(worker_process, queue, worker_configurer)" +msgstr "" + +#: howto/logging-cookbook.rst:1553 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: howto/logging-cookbook.rst:1532 +#: howto/logging-cookbook.rst:1555 msgid "" "When deploying Web applications using `Gunicorn `_ or " "`uWSGI `_ (or similar), " @@ -789,11 +2009,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: howto/logging-cookbook.rst:1542 +#: howto/logging-cookbook.rst:1565 msgid "Using file rotation" msgstr "" -#: howto/logging-cookbook.rst:1547 +#: howto/logging-cookbook.rst:1570 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -802,13 +2022,52 @@ msgid "" "usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" -#: howto/logging-cookbook.rst:1579 +#: howto/logging-cookbook.rst:1576 +msgid "" +"import glob\n" +"import logging\n" +"import logging.handlers\n" +"\n" +"LOG_FILENAME = 'logging_rotatingfile_example.out'\n" +"\n" +"# Set up a specific logger with our desired output level\n" +"my_logger = logging.getLogger('MyLogger')\n" +"my_logger.setLevel(logging.DEBUG)\n" +"\n" +"# Add the log message handler to the logger\n" +"handler = logging.handlers.RotatingFileHandler(\n" +" LOG_FILENAME, maxBytes=20, backupCount=5)\n" +"\n" +"my_logger.addHandler(handler)\n" +"\n" +"# Log some messages\n" +"for i in range(20):\n" +" my_logger.debug('i = %d' % i)\n" +"\n" +"# See what files are created\n" +"logfiles = glob.glob('%s*' % LOG_FILENAME)\n" +"\n" +"for filename in logfiles:\n" +" print(filename)" +msgstr "" + +#: howto/logging-cookbook.rst:1602 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: howto/logging-cookbook.rst:1591 +#: howto/logging-cookbook.rst:1605 +msgid "" +"logging_rotatingfile_example.out\n" +"logging_rotatingfile_example.out.1\n" +"logging_rotatingfile_example.out.2\n" +"logging_rotatingfile_example.out.3\n" +"logging_rotatingfile_example.out.4\n" +"logging_rotatingfile_example.out.5" +msgstr "" + +#: howto/logging-cookbook.rst:1614 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -816,17 +2075,17 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: howto/logging-cookbook.rst:1596 +#: howto/logging-cookbook.rst:1619 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: howto/logging-cookbook.rst:1604 +#: howto/logging-cookbook.rst:1627 msgid "Use of alternative formatting styles" msgstr "" -#: howto/logging-cookbook.rst:1606 +#: howto/logging-cookbook.rst:1629 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " @@ -835,7 +2094,7 @@ msgid "" "Python 2.6)." msgstr "" -#: howto/logging-cookbook.rst:1612 +#: howto/logging-cookbook.rst:1635 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -848,14 +2107,46 @@ msgid "" "session to show the possibilities:" msgstr "" -#: howto/logging-cookbook.rst:1646 +#: howto/logging-cookbook.rst:1645 +msgid "" +">>> import logging\n" +">>> root = logging.getLogger()\n" +">>> root.setLevel(logging.DEBUG)\n" +">>> handler = logging.StreamHandler()\n" +">>> bf = logging.Formatter('{asctime} {name} {levelname:8s} {message}',\n" +"... style='{')\n" +">>> handler.setFormatter(bf)\n" +">>> root.addHandler(handler)\n" +">>> logger = logging.getLogger('foo.bar')\n" +">>> logger.debug('This is a DEBUG message')\n" +"2010-10-28 15:11:55,341 foo.bar DEBUG This is a DEBUG message\n" +">>> logger.critical('This is a CRITICAL message')\n" +"2010-10-28 15:12:11,526 foo.bar CRITICAL This is a CRITICAL message\n" +">>> df = logging.Formatter('$asctime $name ${levelname} $message',\n" +"... style='$')\n" +">>> handler.setFormatter(df)\n" +">>> logger.debug('This is a DEBUG message')\n" +"2010-10-28 15:13:06,924 foo.bar DEBUG This is a DEBUG message\n" +">>> logger.critical('This is a CRITICAL message')\n" +"2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message\n" +">>>" +msgstr "" + +#: howto/logging-cookbook.rst:1669 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: howto/logging-cookbook.rst:1654 +#: howto/logging-cookbook.rst:1673 +msgid "" +">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" +"2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" +">>>" +msgstr "" + +#: howto/logging-cookbook.rst:1677 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -871,7 +2162,7 @@ msgid "" "strings." msgstr "" -#: howto/logging-cookbook.rst:1667 +#: howto/logging-cookbook.rst:1690 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -880,7 +2171,28 @@ msgid "" "the following two classes::" msgstr "" -#: howto/logging-cookbook.rst:1691 +#: howto/logging-cookbook.rst:1696 howto/logging-cookbook.rst:2784 +msgid "" +"class BraceMessage:\n" +" def __init__(self, fmt, /, *args, **kwargs):\n" +" self.fmt = fmt\n" +" self.args = args\n" +" self.kwargs = kwargs\n" +"\n" +" def __str__(self):\n" +" return self.fmt.format(*self.args, **self.kwargs)\n" +"\n" +"class DollarMessage:\n" +" def __init__(self, fmt, /, **kwargs):\n" +" self.fmt = fmt\n" +" self.kwargs = kwargs\n" +"\n" +" def __str__(self):\n" +" from string import Template\n" +" return Template(self.fmt).substitute(**self.kwargs)" +msgstr "" + +#: howto/logging-cookbook.rst:1714 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -891,21 +2203,40 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: howto/logging-cookbook.rst:1699 +#: howto/logging-cookbook.rst:1722 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: howto/logging-cookbook.rst:1721 +#: howto/logging-cookbook.rst:1726 +msgid "" +">>> from wherever import BraceMessage as __\n" +">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" +"Message with 2 placeholders\n" +">>> class Point: pass\n" +"...\n" +">>> p = Point()\n" +">>> p.x = 0.5\n" +">>> p.y = 0.5\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})',\n" +"... point=p))\n" +"Message with coordinates: (0.50, 0.50)\n" +">>> from wherever import DollarMessage as __\n" +">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" +"Message with 2 placeholders\n" +">>>" +msgstr "" + +#: howto/logging-cookbook.rst:1744 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: howto/logging-cookbook.rst:1725 +#: howto/logging-cookbook.rst:1748 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -916,23 +2247,52 @@ msgid "" "sugar for a constructor call to one of the :samp:`{XXX}Message` classes." msgstr "" -#: howto/logging-cookbook.rst:1733 +#: howto/logging-cookbook.rst:1756 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: howto/logging-cookbook.rst:1762 +#: howto/logging-cookbook.rst:1759 +msgid "" +"import logging\n" +"\n" +"class Message:\n" +" def __init__(self, fmt, args):\n" +" self.fmt = fmt\n" +" self.args = args\n" +"\n" +" def __str__(self):\n" +" return self.fmt.format(*self.args)\n" +"\n" +"class StyleAdapter(logging.LoggerAdapter):\n" +" def log(self, level, msg, /, *args, stacklevel=1, **kwargs):\n" +" if self.isEnabledFor(level):\n" +" msg, kwargs = self.process(msg, kwargs)\n" +" self.logger.log(level, Message(msg, args), **kwargs,\n" +" stacklevel=stacklevel+1)\n" +"\n" +"logger = StyleAdapter(logging.getLogger(__name__))\n" +"\n" +"def main():\n" +" logger.debug('Hello, {}', 'world!')\n" +"\n" +"if __name__ == '__main__':\n" +" logging.basicConfig(level=logging.DEBUG)\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:1785 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.8 or later." msgstr "" -#: howto/logging-cookbook.rst:1771 +#: howto/logging-cookbook.rst:1794 msgid "Customizing ``LogRecord``" msgstr "" -#: howto/logging-cookbook.rst:1773 +#: howto/logging-cookbook.rst:1796 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " "event is logged and not filtered out by a logger's level, a :class:" @@ -943,13 +2303,13 @@ msgid "" "was done:" msgstr "" -#: howto/logging-cookbook.rst:1780 +#: howto/logging-cookbook.rst:1803 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: howto/logging-cookbook.rst:1783 +#: howto/logging-cookbook.rst:1806 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " @@ -958,27 +2318,27 @@ msgid "" "`~handlers.HTTPHandler`)." msgstr "" -#: howto/logging-cookbook.rst:1789 +#: howto/logging-cookbook.rst:1812 msgid "" "This has usually meant that if you need to do anything special with a :class:" "`LogRecord`, you've had to do one of the following." msgstr "" -#: howto/logging-cookbook.rst:1792 +#: howto/logging-cookbook.rst:1815 msgid "" "Create your own :class:`Logger` subclass, which overrides :meth:`Logger." "makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " "loggers that you care about are instantiated." msgstr "" -#: howto/logging-cookbook.rst:1795 +#: howto/logging-cookbook.rst:1818 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: howto/logging-cookbook.rst:1799 +#: howto/logging-cookbook.rst:1822 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -986,7 +2346,7 @@ msgid "" "last would win." msgstr "" -#: howto/logging-cookbook.rst:1804 +#: howto/logging-cookbook.rst:1827 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -995,7 +2355,11 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: howto/logging-cookbook.rst:1812 +#: howto/logging-cookbook.rst:1833 +msgid "logger = logging.getLogger(__name__)" +msgstr "" + +#: howto/logging-cookbook.rst:1835 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -1005,7 +2369,7 @@ msgid "" "developer." msgstr "" -#: howto/logging-cookbook.rst:1818 +#: howto/logging-cookbook.rst:1841 msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " @@ -1015,7 +2379,7 @@ msgid "" "`LogRecord` is the default setting for the factory." msgstr "" -#: howto/logging-cookbook.rst:1825 +#: howto/logging-cookbook.rst:1848 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -1023,7 +2387,19 @@ msgid "" "this::" msgstr "" -#: howto/logging-cookbook.rst:1838 +#: howto/logging-cookbook.rst:1852 +msgid "" +"old_factory = logging.getLogRecordFactory()\n" +"\n" +"def record_factory(*args, **kwargs):\n" +" record = old_factory(*args, **kwargs)\n" +" record.custom_attribute = 0xdecafbad\n" +" return record\n" +"\n" +"logging.setLogRecordFactory(record_factory)" +msgstr "" + +#: howto/logging-cookbook.rst:1861 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -1033,70 +2409,287 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: howto/logging-cookbook.rst:1850 -msgid "Subclassing QueueHandler - a ZeroMQ example" +#: howto/logging-cookbook.rst:1873 +msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" msgstr "" -#: howto/logging-cookbook.rst:1852 +#: howto/logging-cookbook.rst:1876 howto/logging-cookbook.rst:2009 +msgid "Subclass ``QueueHandler``" +msgstr "" + +#: howto/logging-cookbook.rst:1878 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: howto/logging-cookbook.rst:1871 +#: howto/logging-cookbook.rst:1882 msgid "" -"Of course there are other ways of organizing this, for example passing in " -"the data needed by the handler to create the socket::" -msgstr "" - -#: howto/logging-cookbook.rst:1889 -msgid "Subclassing QueueListener - a ZeroMQ example" +"import zmq # using pyzmq, the Python binding for ZeroMQ\n" +"import json # for serializing records portably\n" +"\n" +"ctx = zmq.Context()\n" +"sock = zmq.Socket(ctx, zmq.PUB) # or zmq.PUSH, or other suitable value\n" +"sock.bind('tcp://*:5556') # or wherever\n" +"\n" +"class ZeroMQSocketHandler(QueueHandler):\n" +" def enqueue(self, record):\n" +" self.queue.send_json(record.__dict__)\n" +"\n" +"\n" +"handler = ZeroMQSocketHandler(sock)" msgstr "" -#: howto/logging-cookbook.rst:1891 +#: howto/logging-cookbook.rst:1897 msgid "" -"You can also subclass :class:`QueueListener` to get messages from other " -"kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" -msgstr "" - -#: howto/logging-cookbook.rst:1910 howto/logging-cookbook.rst:3973 -msgid "Module :mod:`logging`" -msgstr "" - -#: howto/logging-cookbook.rst:1910 howto/logging-cookbook.rst:3973 -msgid "API reference for the logging module." -msgstr "" - -#: howto/logging-cookbook.rst:1913 howto/logging-cookbook.rst:3976 -msgid "Module :mod:`logging.config`" -msgstr "" - -#: howto/logging-cookbook.rst:1913 howto/logging-cookbook.rst:3976 -msgid "Configuration API for the logging module." +"Of course there are other ways of organizing this, for example passing in " +"the data needed by the handler to create the socket::" msgstr "" -#: howto/logging-cookbook.rst:1916 howto/logging-cookbook.rst:3979 -msgid "Module :mod:`logging.handlers`" +#: howto/logging-cookbook.rst:1900 +msgid "" +"class ZeroMQSocketHandler(QueueHandler):\n" +" def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" +" self.ctx = ctx or zmq.Context()\n" +" socket = zmq.Socket(self.ctx, socktype)\n" +" socket.bind(uri)\n" +" super().__init__(socket)\n" +"\n" +" def enqueue(self, record):\n" +" self.queue.send_json(record.__dict__)\n" +"\n" +" def close(self):\n" +" self.queue.close()" msgstr "" -#: howto/logging-cookbook.rst:1916 howto/logging-cookbook.rst:3979 -msgid "Useful handlers included with the logging module." +#: howto/logging-cookbook.rst:1915 howto/logging-cookbook.rst:1945 +msgid "Subclass ``QueueListener``" msgstr "" -#: howto/logging-cookbook.rst:1918 -msgid ":ref:`A basic logging tutorial `" +#: howto/logging-cookbook.rst:1917 +msgid "" +"You can also subclass :class:`QueueListener` to get messages from other " +"kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" #: howto/logging-cookbook.rst:1920 -msgid ":ref:`A more advanced logging tutorial `" -msgstr "" - -#: howto/logging-cookbook.rst:1926 +msgid "" +"class ZeroMQSocketListener(QueueListener):\n" +" def __init__(self, uri, /, *handlers, **kwargs):\n" +" self.ctx = kwargs.get('ctx') or zmq.Context()\n" +" socket = zmq.Socket(self.ctx, zmq.SUB)\n" +" socket.setsockopt_string(zmq.SUBSCRIBE, '') # subscribe to " +"everything\n" +" socket.connect(uri)\n" +" super().__init__(socket, *handlers, **kwargs)\n" +"\n" +" def dequeue(self):\n" +" msg = self.queue.recv_json()\n" +" return logging.makeLogRecord(msg)" +msgstr "" + +#: howto/logging-cookbook.rst:1935 +msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" +msgstr "" + +#: howto/logging-cookbook.rst:1937 +msgid "" +"In a similar way to the above section, we can implement a listener and " +"handler using :pypi:`pynng`, which is a Python binding to `NNG `_, billed as a spiritual successor to ZeroMQ. The following " +"snippets illustrate -- you can test them in an environment which has " +"``pynng`` installed. Just for variety, we present the listener first." +msgstr "" + +#: howto/logging-cookbook.rst:1947 +msgid "" +"# listener.py\n" +"import json\n" +"import logging\n" +"import logging.handlers\n" +"\n" +"import pynng\n" +"\n" +"DEFAULT_ADDR = \"tcp://localhost:13232\"\n" +"\n" +"interrupted = False\n" +"\n" +"class NNGSocketListener(logging.handlers.QueueListener):\n" +"\n" +" def __init__(self, uri, /, *handlers, **kwargs):\n" +" # Have a timeout for interruptability, and open a\n" +" # subscriber socket\n" +" socket = pynng.Sub0(listen=uri, recv_timeout=500)\n" +" # The b'' subscription matches all topics\n" +" topics = kwargs.pop('topics', None) or b''\n" +" socket.subscribe(topics)\n" +" # We treat the socket as a queue\n" +" super().__init__(socket, *handlers, **kwargs)\n" +"\n" +" def dequeue(self, block):\n" +" data = None\n" +" # Keep looping while not interrupted and no data received over the\n" +" # socket\n" +" while not interrupted:\n" +" try:\n" +" data = self.queue.recv(block=block)\n" +" break\n" +" except pynng.Timeout:\n" +" pass\n" +" except pynng.Closed: # sometimes happens when you hit Ctrl-C\n" +" break\n" +" if data is None:\n" +" return None\n" +" # Get the logging event sent from a publisher\n" +" event = json.loads(data.decode('utf-8'))\n" +" return logging.makeLogRecord(event)\n" +"\n" +" def enqueue_sentinel(self):\n" +" # Not used in this implementation, as the socket isn't really a\n" +" # queue\n" +" pass\n" +"\n" +"logging.getLogger('pynng').propagate = False\n" +"listener = NNGSocketListener(DEFAULT_ADDR, logging.StreamHandler(), " +"topics=b'')\n" +"listener.start()\n" +"print('Press Ctrl-C to stop.')\n" +"try:\n" +" while True:\n" +" pass\n" +"except KeyboardInterrupt:\n" +" interrupted = True\n" +"finally:\n" +" listener.stop()" +msgstr "" + +#: howto/logging-cookbook.rst:2013 +msgid "" +"# sender.py\n" +"import json\n" +"import logging\n" +"import logging.handlers\n" +"import time\n" +"import random\n" +"\n" +"import pynng\n" +"\n" +"DEFAULT_ADDR = \"tcp://localhost:13232\"\n" +"\n" +"class NNGSocketHandler(logging.handlers.QueueHandler):\n" +"\n" +" def __init__(self, uri):\n" +" socket = pynng.Pub0(dial=uri, send_timeout=500)\n" +" super().__init__(socket)\n" +"\n" +" def enqueue(self, record):\n" +" # Send the record as UTF-8 encoded JSON\n" +" d = dict(record.__dict__)\n" +" data = json.dumps(d)\n" +" self.queue.send(data.encode('utf-8'))\n" +"\n" +" def close(self):\n" +" self.queue.close()\n" +"\n" +"logging.getLogger('pynng').propagate = False\n" +"handler = NNGSocketHandler(DEFAULT_ADDR)\n" +"# Make sure the process ID is in the output\n" +"logging.basicConfig(level=logging.DEBUG,\n" +" handlers=[logging.StreamHandler(), handler],\n" +" format='%(levelname)-8s %(name)10s %(process)6s " +"%(message)s')\n" +"levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" +" logging.CRITICAL)\n" +"logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" +"msgno = 1\n" +"while True:\n" +" # Just randomly select some loggers and levels and log away\n" +" level = random.choice(levels)\n" +" logger = logging.getLogger(random.choice(logger_names))\n" +" logger.log(level, 'Message no. %5d' % msgno)\n" +" msgno += 1\n" +" delay = random.random() * 2 + 0.5\n" +" time.sleep(delay)" +msgstr "" + +#: howto/logging-cookbook.rst:2060 +msgid "" +"You can run the above two snippets in separate command shells. If we run the " +"listener in one shell and run the sender in two separate shells, we should " +"see something like the following. In the first sender shell:" +msgstr "" + +#: howto/logging-cookbook.rst:2064 +msgid "" +"$ python sender.py\n" +"DEBUG myapp 613 Message no. 1\n" +"WARNING myapp.lib2 613 Message no. 2\n" +"CRITICAL myapp.lib2 613 Message no. 3\n" +"WARNING myapp.lib2 613 Message no. 4\n" +"CRITICAL myapp.lib1 613 Message no. 5\n" +"DEBUG myapp 613 Message no. 6\n" +"CRITICAL myapp.lib1 613 Message no. 7\n" +"INFO myapp.lib1 613 Message no. 8\n" +"(and so on)" +msgstr "" + +#: howto/logging-cookbook.rst:2077 +msgid "In the second sender shell:" +msgstr "" + +#: howto/logging-cookbook.rst:2079 +msgid "" +"$ python sender.py\n" +"INFO myapp.lib2 657 Message no. 1\n" +"CRITICAL myapp.lib2 657 Message no. 2\n" +"CRITICAL myapp 657 Message no. 3\n" +"CRITICAL myapp.lib1 657 Message no. 4\n" +"INFO myapp.lib1 657 Message no. 5\n" +"WARNING myapp.lib2 657 Message no. 6\n" +"CRITICAL myapp 657 Message no. 7\n" +"DEBUG myapp.lib1 657 Message no. 8\n" +"(and so on)" +msgstr "" + +#: howto/logging-cookbook.rst:2092 +msgid "In the listener shell:" +msgstr "" + +#: howto/logging-cookbook.rst:2094 +msgid "" +"$ python listener.py\n" +"Press Ctrl-C to stop.\n" +"DEBUG myapp 613 Message no. 1\n" +"WARNING myapp.lib2 613 Message no. 2\n" +"INFO myapp.lib2 657 Message no. 1\n" +"CRITICAL myapp.lib2 613 Message no. 3\n" +"CRITICAL myapp.lib2 657 Message no. 2\n" +"CRITICAL myapp 657 Message no. 3\n" +"WARNING myapp.lib2 613 Message no. 4\n" +"CRITICAL myapp.lib1 613 Message no. 5\n" +"CRITICAL myapp.lib1 657 Message no. 4\n" +"INFO myapp.lib1 657 Message no. 5\n" +"DEBUG myapp 613 Message no. 6\n" +"WARNING myapp.lib2 657 Message no. 6\n" +"CRITICAL myapp 657 Message no. 7\n" +"CRITICAL myapp.lib1 613 Message no. 7\n" +"INFO myapp.lib1 613 Message no. 8\n" +"DEBUG myapp.lib1 657 Message no. 8\n" +"(and so on)" +msgstr "" + +#: howto/logging-cookbook.rst:2116 +msgid "" +"As you can see, the logging from the two sender processes is interleaved in " +"the listener's output." +msgstr "" + +#: howto/logging-cookbook.rst:2121 msgid "An example dictionary-based configuration" msgstr "" -#: howto/logging-cookbook.rst:1928 +#: howto/logging-cookbook.rst:2123 msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project `_ of the Django documentation." msgstr "" -#: howto/logging-cookbook.rst:1988 +#: howto/logging-cookbook.rst:2183 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: howto/logging-cookbook.rst:1990 +#: howto/logging-cookbook.rst:2185 msgid "" "An example of how you can define a namer and rotator is given in the " "following runnable script, which shows gzip compression of the log file::" msgstr "" -#: howto/logging-cookbook.rst:2021 +#: howto/logging-cookbook.rst:2188 +msgid "" +"import gzip\n" +"import logging\n" +"import logging.handlers\n" +"import os\n" +"import shutil\n" +"\n" +"def namer(name):\n" +" return name + \".gz\"\n" +"\n" +"def rotator(source, dest):\n" +" with open(source, 'rb') as f_in:\n" +" with gzip.open(dest, 'wb') as f_out:\n" +" shutil.copyfileobj(f_in, f_out)\n" +" os.remove(source)\n" +"\n" +"\n" +"rh = logging.handlers.RotatingFileHandler('rotated.log', maxBytes=128, " +"backupCount=5)\n" +"rh.rotator = rotator\n" +"rh.namer = namer\n" +"\n" +"root = logging.getLogger()\n" +"root.setLevel(logging.INFO)\n" +"root.addHandler(rh)\n" +"f = logging.Formatter('%(asctime)s %(message)s')\n" +"rh.setFormatter(f)\n" +"for i in range(1000):\n" +" root.info(f'Message no. {i + 1}')" +msgstr "" + +#: howto/logging-cookbook.rst:2216 msgid "" "After running this, you will see six new files, five of which are compressed:" msgstr "" -#: howto/logging-cookbook.rst:2034 +#: howto/logging-cookbook.rst:2218 +msgid "" +"$ ls rotated.log*\n" +"rotated.log rotated.log.2.gz rotated.log.4.gz\n" +"rotated.log.1.gz rotated.log.3.gz rotated.log.5.gz\n" +"$ zcat rotated.log.1.gz\n" +"2023-01-20 02:28:17,767 Message no. 996\n" +"2023-01-20 02:28:17,767 Message no. 997\n" +"2023-01-20 02:28:17,767 Message no. 998" +msgstr "" + +#: howto/logging-cookbook.rst:2229 msgid "A more elaborate multiprocessing example" msgstr "" -#: howto/logging-cookbook.rst:2036 +#: howto/logging-cookbook.rst:2231 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -1138,7 +2827,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: howto/logging-cookbook.rst:2041 +#: howto/logging-cookbook.rst:2236 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -1151,17 +2840,240 @@ msgid "" "own scenario." msgstr "" -#: howto/logging-cookbook.rst:2051 +#: howto/logging-cookbook.rst:2246 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: howto/logging-cookbook.rst:2263 +#: howto/logging-cookbook.rst:2249 +msgid "" +"import logging\n" +"import logging.config\n" +"import logging.handlers\n" +"from multiprocessing import Process, Queue, Event, current_process\n" +"import os\n" +"import random\n" +"import time\n" +"\n" +"class MyHandler:\n" +" \"\"\"\n" +" A simple handler for logging events. It runs in the listener process " +"and\n" +" dispatches events to loggers based on the name in the received record,\n" +" which then get dispatched, by the logging system, to the handlers\n" +" configured for those loggers.\n" +" \"\"\"\n" +"\n" +" def handle(self, record):\n" +" if record.name == \"root\":\n" +" logger = logging.getLogger()\n" +" else:\n" +" logger = logging.getLogger(record.name)\n" +"\n" +" if logger.isEnabledFor(record.levelno):\n" +" # The process name is transformed just to show that it's the " +"listener\n" +" # doing the logging to files and console\n" +" record.processName = '%s (for %s)' % (current_process().name, " +"record.processName)\n" +" logger.handle(record)\n" +"\n" +"def listener_process(q, stop_event, config):\n" +" \"\"\"\n" +" This could be done in the main process, but is just done in a separate\n" +" process for illustrative purposes.\n" +"\n" +" This initialises logging according to the specified configuration,\n" +" starts the listener and waits for the main process to signal completion\n" +" via the event. The listener is then stopped, and the process exits.\n" +" \"\"\"\n" +" logging.config.dictConfig(config)\n" +" listener = logging.handlers.QueueListener(q, MyHandler())\n" +" listener.start()\n" +" if os.name == 'posix':\n" +" # On POSIX, the setup logger will have been configured in the\n" +" # parent process, but should have been disabled following the\n" +" # dictConfig call.\n" +" # On Windows, since fork isn't used, the setup logger won't\n" +" # exist in the child, so it would be created and the message\n" +" # would appear - hence the \"if posix\" clause.\n" +" logger = logging.getLogger('setup')\n" +" logger.critical('Should not appear, because of disabled " +"logger ...')\n" +" stop_event.wait()\n" +" listener.stop()\n" +"\n" +"def worker_process(config):\n" +" \"\"\"\n" +" A number of these are spawned for the purpose of illustration. In\n" +" practice, they could be a heterogeneous bunch of processes rather than\n" +" ones which are identical to each other.\n" +"\n" +" This initialises logging according to the specified configuration,\n" +" and logs a hundred messages with random levels to randomly selected\n" +" loggers.\n" +"\n" +" A small sleep is added to allow other processes a chance to run. This\n" +" is not strictly needed, but it mixes the output from the different\n" +" processes a bit more than if it's left out.\n" +" \"\"\"\n" +" logging.config.dictConfig(config)\n" +" levels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" +" logging.CRITICAL]\n" +" loggers = ['foo', 'foo.bar', 'foo.bar.baz',\n" +" 'spam', 'spam.ham', 'spam.ham.eggs']\n" +" if os.name == 'posix':\n" +" # On POSIX, the setup logger will have been configured in the\n" +" # parent process, but should have been disabled following the\n" +" # dictConfig call.\n" +" # On Windows, since fork isn't used, the setup logger won't\n" +" # exist in the child, so it would be created and the message\n" +" # would appear - hence the \"if posix\" clause.\n" +" logger = logging.getLogger('setup')\n" +" logger.critical('Should not appear, because of disabled " +"logger ...')\n" +" for i in range(100):\n" +" lvl = random.choice(levels)\n" +" logger = logging.getLogger(random.choice(loggers))\n" +" logger.log(lvl, 'Message no. %d', i)\n" +" time.sleep(0.01)\n" +"\n" +"def main():\n" +" q = Queue()\n" +" # The main process gets a simple configuration which prints to the " +"console.\n" +" config_initial = {\n" +" 'version': 1,\n" +" 'handlers': {\n" +" 'console': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'level': 'INFO'\n" +" }\n" +" },\n" +" 'root': {\n" +" 'handlers': ['console'],\n" +" 'level': 'DEBUG'\n" +" }\n" +" }\n" +" # The worker process configuration is just a QueueHandler attached to " +"the\n" +" # root logger, which allows all messages to be sent to the queue.\n" +" # We disable existing loggers to disable the \"setup\" logger used in " +"the\n" +" # parent process. This is needed on POSIX because the logger will\n" +" # be there in the child following a fork().\n" +" config_worker = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': True,\n" +" 'handlers': {\n" +" 'queue': {\n" +" 'class': 'logging.handlers.QueueHandler',\n" +" 'queue': q\n" +" }\n" +" },\n" +" 'root': {\n" +" 'handlers': ['queue'],\n" +" 'level': 'DEBUG'\n" +" }\n" +" }\n" +" # The listener process configuration shows that the full flexibility of\n" +" # logging configuration is available to dispatch events to handlers " +"however\n" +" # you want.\n" +" # We disable existing loggers to disable the \"setup\" logger used in " +"the\n" +" # parent process. This is needed on POSIX because the logger will\n" +" # be there in the child following a fork().\n" +" config_listener = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': True,\n" +" 'formatters': {\n" +" 'detailed': {\n" +" 'class': 'logging.Formatter',\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " +"%(processName)-10s %(message)s'\n" +" },\n" +" 'simple': {\n" +" 'class': 'logging.Formatter',\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s " +"%(message)s'\n" +" }\n" +" },\n" +" 'handlers': {\n" +" 'console': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'formatter': 'simple',\n" +" 'level': 'INFO'\n" +" },\n" +" 'file': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog.log',\n" +" 'mode': 'w',\n" +" 'formatter': 'detailed'\n" +" },\n" +" 'foofile': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog-foo.log',\n" +" 'mode': 'w',\n" +" 'formatter': 'detailed'\n" +" },\n" +" 'errors': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog-errors.log',\n" +" 'mode': 'w',\n" +" 'formatter': 'detailed',\n" +" 'level': 'ERROR'\n" +" }\n" +" },\n" +" 'loggers': {\n" +" 'foo': {\n" +" 'handlers': ['foofile']\n" +" }\n" +" },\n" +" 'root': {\n" +" 'handlers': ['console', 'file', 'errors'],\n" +" 'level': 'DEBUG'\n" +" }\n" +" }\n" +" # Log some initial events, just to show that logging in the parent " +"works\n" +" # normally.\n" +" logging.config.dictConfig(config_initial)\n" +" logger = logging.getLogger('setup')\n" +" logger.info('About to create workers ...')\n" +" workers = []\n" +" for i in range(5):\n" +" wp = Process(target=worker_process, name='worker %d' % (i + 1),\n" +" args=(config_worker,))\n" +" workers.append(wp)\n" +" wp.start()\n" +" logger.info('Started worker: %s', wp.name)\n" +" logger.info('About to create listener ...')\n" +" stop_event = Event()\n" +" lp = Process(target=listener_process, name='listener',\n" +" args=(q, stop_event, config_listener))\n" +" lp.start()\n" +" logger.info('Started listener')\n" +" # We now hang around for the workers to finish their work.\n" +" for wp in workers:\n" +" wp.join()\n" +" # Workers all done, listening can now stop.\n" +" # Logging in the parent still works normally.\n" +" logger.info('Telling listener to stop ...')\n" +" stop_event.set()\n" +" lp.join()\n" +" logger.info('All done.')\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:2458 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: howto/logging-cookbook.rst:2265 +#: howto/logging-cookbook.rst:2460 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -1170,7 +3082,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: howto/logging-cookbook.rst:2271 +#: howto/logging-cookbook.rst:2466 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -1178,7 +3090,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: howto/logging-cookbook.rst:2277 +#: howto/logging-cookbook.rst:2472 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -1187,33 +3099,37 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: howto/logging-cookbook.rst:2283 +#: howto/logging-cookbook.rst:2478 msgid "" "Attach a :class:`~logging.Formatter` instance to your :class:`~logging." "handlers.SysLogHandler` instance, with a format string such as::" msgstr "" -#: howto/logging-cookbook.rst:2289 +#: howto/logging-cookbook.rst:2482 +msgid "'ASCII section\\ufeffUnicode section'" +msgstr "" + +#: howto/logging-cookbook.rst:2484 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: howto/logging-cookbook.rst:2292 +#: howto/logging-cookbook.rst:2487 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: howto/logging-cookbook.rst:2296 +#: howto/logging-cookbook.rst:2491 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: howto/logging-cookbook.rst:2300 +#: howto/logging-cookbook.rst:2495 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -1222,11 +3138,11 @@ msgid "" "daemon may complain." msgstr "" -#: howto/logging-cookbook.rst:2307 +#: howto/logging-cookbook.rst:2502 msgid "Implementing structured logging" msgstr "" -#: howto/logging-cookbook.rst:2309 +#: howto/logging-cookbook.rst:2504 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -1238,31 +3154,93 @@ msgid "" "machine-parseable manner::" msgstr "" -#: howto/logging-cookbook.rst:2333 +#: howto/logging-cookbook.rst:2512 +msgid "" +"import json\n" +"import logging\n" +"\n" +"class StructuredMessage:\n" +" def __init__(self, message, /, **kwargs):\n" +" self.message = message\n" +" self.kwargs = kwargs\n" +"\n" +" def __str__(self):\n" +" return '%s >>> %s' % (self.message, json.dumps(self.kwargs))\n" +"\n" +"_ = StructuredMessage # optional, to improve readability\n" +"\n" +"logging.basicConfig(level=logging.INFO, format='%(message)s')\n" +"logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" +msgstr "" + +#: howto/logging-cookbook.rst:2528 msgid "If the above script is run, it prints:" msgstr "" -#: howto/logging-cookbook.rst:2339 howto/logging-cookbook.rst:2381 +#: howto/logging-cookbook.rst:2530 +msgid "" +"message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " +"\"bar\"}" +msgstr "" + +#: howto/logging-cookbook.rst:2534 howto/logging-cookbook.rst:2576 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: howto/logging-cookbook.rst:2342 +#: howto/logging-cookbook.rst:2537 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: howto/logging-cookbook.rst:2375 +#: howto/logging-cookbook.rst:2540 +msgid "" +"import json\n" +"import logging\n" +"\n" +"\n" +"class Encoder(json.JSONEncoder):\n" +" def default(self, o):\n" +" if isinstance(o, set):\n" +" return tuple(o)\n" +" elif isinstance(o, str):\n" +" return o.encode('unicode_escape').decode('ascii')\n" +" return super().default(o)\n" +"\n" +"class StructuredMessage:\n" +" def __init__(self, message, /, **kwargs):\n" +" self.message = message\n" +" self.kwargs = kwargs\n" +"\n" +" def __str__(self):\n" +" s = Encoder().encode(self.kwargs)\n" +" return '%s >>> %s' % (self.message, s)\n" +"\n" +"_ = StructuredMessage # optional, to improve readability\n" +"\n" +"def main():\n" +" logging.basicConfig(level=logging.INFO, format='%(message)s')\n" +" logging.info(_('message 1', set_value={1, 2, 3}, snowman='\\u2603'))\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:2570 msgid "When the above script is run, it prints:" msgstr "" -#: howto/logging-cookbook.rst:2390 +#: howto/logging-cookbook.rst:2572 +msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" +msgstr "" + +#: howto/logging-cookbook.rst:2585 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: howto/logging-cookbook.rst:2392 +#: howto/logging-cookbook.rst:2587 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -1272,24 +3250,122 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: howto/logging-cookbook.rst:2406 +#: howto/logging-cookbook.rst:2594 +msgid "" +"def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" +" if owner:\n" +" if not os.path.exists(filename):\n" +" open(filename, 'a').close()\n" +" shutil.chown(filename, *owner)\n" +" return logging.FileHandler(filename, mode, encoding)" +msgstr "" + +#: howto/logging-cookbook.rst:2601 msgid "" "You can then specify, in a logging configuration passed to :func:" "`dictConfig`, that a logging handler be created by calling this function::" msgstr "" -#: howto/logging-cookbook.rst:2439 +#: howto/logging-cookbook.rst:2604 +msgid "" +"LOGGING = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': False,\n" +" 'formatters': {\n" +" 'default': {\n" +" 'format': '%(asctime)s %(levelname)s %(name)s %(message)s'\n" +" },\n" +" },\n" +" 'handlers': {\n" +" 'file':{\n" +" # The values below are popped from this dictionary and\n" +" # used to create the handler, set the handler's level and\n" +" # its formatter.\n" +" '()': owned_file_handler,\n" +" 'level':'DEBUG',\n" +" 'formatter': 'default',\n" +" # The values below are passed to the handler creator callable\n" +" # as keyword arguments.\n" +" 'owner': ['pulse', 'pulse'],\n" +" 'filename': 'chowntest.log',\n" +" 'mode': 'w',\n" +" 'encoding': 'utf-8',\n" +" },\n" +" },\n" +" 'root': {\n" +" 'handlers': ['file'],\n" +" 'level': 'DEBUG',\n" +" },\n" +"}" +msgstr "" + +#: howto/logging-cookbook.rst:2634 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: howto/logging-cookbook.rst:2486 +#: howto/logging-cookbook.rst:2638 +msgid "" +"import logging, logging.config, os, shutil\n" +"\n" +"def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" +" if owner:\n" +" if not os.path.exists(filename):\n" +" open(filename, 'a').close()\n" +" shutil.chown(filename, *owner)\n" +" return logging.FileHandler(filename, mode, encoding)\n" +"\n" +"LOGGING = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': False,\n" +" 'formatters': {\n" +" 'default': {\n" +" 'format': '%(asctime)s %(levelname)s %(name)s %(message)s'\n" +" },\n" +" },\n" +" 'handlers': {\n" +" 'file':{\n" +" # The values below are popped from this dictionary and\n" +" # used to create the handler, set the handler's level and\n" +" # its formatter.\n" +" '()': owned_file_handler,\n" +" 'level':'DEBUG',\n" +" 'formatter': 'default',\n" +" # The values below are passed to the handler creator callable\n" +" # as keyword arguments.\n" +" 'owner': ['pulse', 'pulse'],\n" +" 'filename': 'chowntest.log',\n" +" 'mode': 'w',\n" +" 'encoding': 'utf-8',\n" +" },\n" +" },\n" +" 'root': {\n" +" 'handlers': ['file'],\n" +" 'level': 'DEBUG',\n" +" },\n" +"}\n" +"\n" +"logging.config.dictConfig(LOGGING)\n" +"logger = logging.getLogger('mylogger')\n" +"logger.debug('A debug message')" +msgstr "" + +#: howto/logging-cookbook.rst:2681 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: howto/logging-cookbook.rst:2496 +#: howto/logging-cookbook.rst:2683 +msgid "" +"$ sudo python3.3 chowntest.py\n" +"$ cat chowntest.log\n" +"2013-11-05 09:34:51,128 DEBUG mylogger A debug message\n" +"$ ls -l chowntest.log\n" +"-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" +msgstr "" + +#: howto/logging-cookbook.rst:2691 msgid "" "Note that this example uses Python 3.3 because that's where :func:`shutil." "chown` makes an appearance. This approach should work with any Python " @@ -1298,17 +3374,25 @@ msgid "" "change using e.g. :func:`os.chown`." msgstr "" -#: howto/logging-cookbook.rst:2502 +#: howto/logging-cookbook.rst:2697 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: howto/logging-cookbook.rst:2507 +#: howto/logging-cookbook.rst:2700 +msgid "'()': owned_file_handler," +msgstr "" + +#: howto/logging-cookbook.rst:2702 msgid "you could use e.g.::" msgstr "" -#: howto/logging-cookbook.rst:2511 +#: howto/logging-cookbook.rst:2704 +msgid "'()': 'ext://project.util.owned_file_handler'," +msgstr "" + +#: howto/logging-cookbook.rst:2706 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -1316,25 +3400,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: howto/logging-cookbook.rst:2516 +#: howto/logging-cookbook.rst:2711 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: howto/logging-cookbook.rst:2520 +#: howto/logging-cookbook.rst:2715 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: howto/logging-cookbook.rst:2530 +#: howto/logging-cookbook.rst:2725 msgid "Using particular formatting styles throughout your application" msgstr "" -#: howto/logging-cookbook.rst:2532 +#: howto/logging-cookbook.rst:2727 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -1345,7 +3429,7 @@ msgid "" "is constructed." msgstr "" -#: howto/logging-cookbook.rst:2539 +#: howto/logging-cookbook.rst:2734 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -1360,7 +3444,7 @@ msgid "" "calls which are out there in existing code will be using %-format strings." msgstr "" -#: howto/logging-cookbook.rst:2551 +#: howto/logging-cookbook.rst:2746 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -1368,7 +3452,7 @@ msgid "" "formatting." msgstr "" -#: howto/logging-cookbook.rst:2555 +#: howto/logging-cookbook.rst:2750 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -1376,11 +3460,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: howto/logging-cookbook.rst:2562 +#: howto/logging-cookbook.rst:2757 msgid "Using LogRecord factories" msgstr "" -#: howto/logging-cookbook.rst:2564 +#: howto/logging-cookbook.rst:2759 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -1395,17 +3479,17 @@ msgid "" "implementation does." msgstr "" -#: howto/logging-cookbook.rst:2575 +#: howto/logging-cookbook.rst:2770 msgid "" "Refer to the reference documentation on :func:`setLogRecordFactory` and :" "class:`LogRecord` for more information." msgstr "" -#: howto/logging-cookbook.rst:2580 +#: howto/logging-cookbook.rst:2775 msgid "Using custom message objects" msgstr "" -#: howto/logging-cookbook.rst:2582 +#: howto/logging-cookbook.rst:2777 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " "to construct your individual log messages. You may recall (from :ref:" @@ -1415,7 +3499,7 @@ msgid "" "following two classes::" msgstr "" -#: howto/logging-cookbook.rst:2607 +#: howto/logging-cookbook.rst:2802 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -1426,17 +3510,40 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: howto/logging-cookbook.rst:2615 +#: howto/logging-cookbook.rst:2810 msgid "" "Examples of this approach are given below. Firstly, formatting with :meth:" "`str.format`::" msgstr "" -#: howto/logging-cookbook.rst:2629 +#: howto/logging-cookbook.rst:2813 +msgid "" +">>> __ = BraceMessage\n" +">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" +"Message with 2 placeholders\n" +">>> class Point: pass\n" +"...\n" +">>> p = Point()\n" +">>> p.x = 0.5\n" +">>> p.y = 0.5\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})', " +"point=p))\n" +"Message with coordinates: (0.50, 0.50)" +msgstr "" + +#: howto/logging-cookbook.rst:2824 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: howto/logging-cookbook.rst:2636 +#: howto/logging-cookbook.rst:2826 +msgid "" +">>> __ = DollarMessage\n" +">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" +"Message with 2 placeholders\n" +">>>" +msgstr "" + +#: howto/logging-cookbook.rst:2831 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -1448,11 +3555,11 @@ msgid "" "shown above." msgstr "" -#: howto/logging-cookbook.rst:2650 +#: howto/logging-cookbook.rst:2845 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: howto/logging-cookbook.rst:2652 +#: howto/logging-cookbook.rst:2847 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " @@ -1467,22 +3574,71 @@ msgid "" "complete example::" msgstr "" -#: howto/logging-cookbook.rst:2705 +#: howto/logging-cookbook.rst:2858 +msgid "" +"import logging\n" +"import logging.config\n" +"import sys\n" +"\n" +"class MyFilter(logging.Filter):\n" +" def __init__(self, param=None):\n" +" self.param = param\n" +"\n" +" def filter(self, record):\n" +" if self.param is None:\n" +" allow = True\n" +" else:\n" +" allow = self.param not in record.msg\n" +" if allow:\n" +" record.msg = 'changed: ' + record.msg\n" +" return allow\n" +"\n" +"LOGGING = {\n" +" 'version': 1,\n" +" 'filters': {\n" +" 'myfilter': {\n" +" '()': MyFilter,\n" +" 'param': 'noshow',\n" +" }\n" +" },\n" +" 'handlers': {\n" +" 'console': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'filters': ['myfilter']\n" +" }\n" +" },\n" +" 'root': {\n" +" 'level': 'DEBUG',\n" +" 'handlers': ['console']\n" +" },\n" +"}\n" +"\n" +"if __name__ == '__main__':\n" +" logging.config.dictConfig(LOGGING)\n" +" logging.debug('hello')\n" +" logging.debug('hello - noshow')" +msgstr "" + +#: howto/logging-cookbook.rst:2900 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: howto/logging-cookbook.rst:2713 +#: howto/logging-cookbook.rst:2904 +msgid "changed: hello" +msgstr "" + +#: howto/logging-cookbook.rst:2908 msgid "which shows that the filter is working as configured." msgstr "" -#: howto/logging-cookbook.rst:2715 +#: howto/logging-cookbook.rst:2910 msgid "A couple of extra points to note:" msgstr "" -#: howto/logging-cookbook.rst:2717 +#: howto/logging-cookbook.rst:2912 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -1492,7 +3648,7 @@ msgid "" "the above example." msgstr "" -#: howto/logging-cookbook.rst:2724 +#: howto/logging-cookbook.rst:2919 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -1501,11 +3657,11 @@ msgid "" "above." msgstr "" -#: howto/logging-cookbook.rst:2733 +#: howto/logging-cookbook.rst:2928 msgid "Customized exception formatting" msgstr "" -#: howto/logging-cookbook.rst:2735 +#: howto/logging-cookbook.rst:2930 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -1513,22 +3669,69 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: howto/logging-cookbook.rst:2776 +#: howto/logging-cookbook.rst:2935 +msgid "" +"import logging\n" +"\n" +"class OneLineExceptionFormatter(logging.Formatter):\n" +" def formatException(self, exc_info):\n" +" \"\"\"\n" +" Format an exception so that it prints on a single line.\n" +" \"\"\"\n" +" result = super().formatException(exc_info)\n" +" return repr(result) # or format into one line however you want to\n" +"\n" +" def format(self, record):\n" +" s = super().format(record)\n" +" if record.exc_text:\n" +" s = s.replace('\\n', '') + '|'\n" +" return s\n" +"\n" +"def configure_logging():\n" +" fh = logging.FileHandler('output.txt', 'w')\n" +" f = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|',\n" +" '%d/%m/%Y %H:%M:%S')\n" +" fh.setFormatter(f)\n" +" root = logging.getLogger()\n" +" root.setLevel(logging.DEBUG)\n" +" root.addHandler(fh)\n" +"\n" +"def main():\n" +" configure_logging()\n" +" logging.info('Sample message')\n" +" try:\n" +" x = 1 / 0\n" +" except ZeroDivisionError as e:\n" +" logging.exception('ZeroDivisionError: %s', e)\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:2971 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: howto/logging-cookbook.rst:2783 +#: howto/logging-cookbook.rst:2973 +msgid "" +"28/01/2015 07:21:23|INFO|Sample message|\n" +"28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback " +"(most recent call last):\\n File \"logtest7.py\", line 30, in main\\n x " +"= 1 / 0\\nZeroDivisionError: division by zero'|" +msgstr "" + +#: howto/logging-cookbook.rst:2978 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: howto/logging-cookbook.rst:2790 +#: howto/logging-cookbook.rst:2985 msgid "Speaking logging messages" msgstr "" -#: howto/logging-cookbook.rst:2792 +#: howto/logging-cookbook.rst:2987 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " @@ -1545,24 +3748,56 @@ msgid "" "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: howto/logging-cookbook.rst:2834 +#: howto/logging-cookbook.rst:3000 +msgid "" +"import logging\n" +"import subprocess\n" +"import sys\n" +"\n" +"class TTSHandler(logging.Handler):\n" +" def emit(self, record):\n" +" msg = self.format(record)\n" +" # Speak slowly in a female English voice\n" +" cmd = ['espeak', '-s150', '-ven+f3', msg]\n" +" p = subprocess.Popen(cmd, stdout=subprocess.PIPE,\n" +" stderr=subprocess.STDOUT)\n" +" # wait for the program to finish\n" +" p.communicate()\n" +"\n" +"def configure_logging():\n" +" h = TTSHandler()\n" +" root = logging.getLogger()\n" +" root.addHandler(h)\n" +" # the default formatter just returns the message\n" +" root.setLevel(logging.DEBUG)\n" +"\n" +"def main():\n" +" logging.info('Hello')\n" +" logging.debug('Goodbye')\n" +"\n" +"if __name__ == '__main__':\n" +" configure_logging()\n" +" sys.exit(main())" +msgstr "" + +#: howto/logging-cookbook.rst:3029 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: howto/logging-cookbook.rst:2836 +#: howto/logging-cookbook.rst:3031 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: howto/logging-cookbook.rst:2844 +#: howto/logging-cookbook.rst:3039 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: howto/logging-cookbook.rst:2846 +#: howto/logging-cookbook.rst:3041 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -1572,7 +3807,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: howto/logging-cookbook.rst:2853 +#: howto/logging-cookbook.rst:3048 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -1585,7 +3820,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: howto/logging-cookbook.rst:2863 +#: howto/logging-cookbook.rst:3058 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -1594,7 +3829,7 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: howto/logging-cookbook.rst:2869 +#: howto/logging-cookbook.rst:3064 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " @@ -1606,30 +3841,132 @@ msgid "" "respectively." msgstr "" -#: howto/logging-cookbook.rst:2877 +#: howto/logging-cookbook.rst:3072 msgid "Here's the script::" msgstr "" -#: howto/logging-cookbook.rst:2940 +#: howto/logging-cookbook.rst:3074 +msgid "" +"import logging\n" +"from logging.handlers import MemoryHandler\n" +"import sys\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"logger.addHandler(logging.NullHandler())\n" +"\n" +"def log_if_errors(logger, target_handler=None, flush_level=None, " +"capacity=None):\n" +" if target_handler is None:\n" +" target_handler = logging.StreamHandler()\n" +" if flush_level is None:\n" +" flush_level = logging.ERROR\n" +" if capacity is None:\n" +" capacity = 100\n" +" handler = MemoryHandler(capacity, flushLevel=flush_level, " +"target=target_handler)\n" +"\n" +" def decorator(fn):\n" +" def wrapper(*args, **kwargs):\n" +" logger.addHandler(handler)\n" +" try:\n" +" return fn(*args, **kwargs)\n" +" except Exception:\n" +" logger.exception('call failed')\n" +" raise\n" +" finally:\n" +" super(MemoryHandler, handler).flush()\n" +" logger.removeHandler(handler)\n" +" return wrapper\n" +"\n" +" return decorator\n" +"\n" +"def write_line(s):\n" +" sys.stderr.write('%s\\n' % s)\n" +"\n" +"def foo(fail=False):\n" +" write_line('about to log at DEBUG ...')\n" +" logger.debug('Actually logged at DEBUG')\n" +" write_line('about to log at INFO ...')\n" +" logger.info('Actually logged at INFO')\n" +" write_line('about to log at WARNING ...')\n" +" logger.warning('Actually logged at WARNING')\n" +" if fail:\n" +" write_line('about to log at ERROR ...')\n" +" logger.error('Actually logged at ERROR')\n" +" write_line('about to log at CRITICAL ...')\n" +" logger.critical('Actually logged at CRITICAL')\n" +" return fail\n" +"\n" +"decorated_foo = log_if_errors(logger)(foo)\n" +"\n" +"if __name__ == '__main__':\n" +" logger.setLevel(logging.DEBUG)\n" +" write_line('Calling undecorated foo with False')\n" +" assert not foo(False)\n" +" write_line('Calling undecorated foo with True')\n" +" assert foo(True)\n" +" write_line('Calling decorated foo with False')\n" +" assert not decorated_foo(False)\n" +" write_line('Calling decorated foo with True')\n" +" assert decorated_foo(True)" +msgstr "" + +#: howto/logging-cookbook.rst:3135 msgid "When this script is run, the following output should be observed:" msgstr "" -#: howto/logging-cookbook.rst:2970 +#: howto/logging-cookbook.rst:3137 +msgid "" +"Calling undecorated foo with False\n" +"about to log at DEBUG ...\n" +"about to log at INFO ...\n" +"about to log at WARNING ...\n" +"Calling undecorated foo with True\n" +"about to log at DEBUG ...\n" +"about to log at INFO ...\n" +"about to log at WARNING ...\n" +"about to log at ERROR ...\n" +"about to log at CRITICAL ...\n" +"Calling decorated foo with False\n" +"about to log at DEBUG ...\n" +"about to log at INFO ...\n" +"about to log at WARNING ...\n" +"Calling decorated foo with True\n" +"about to log at DEBUG ...\n" +"about to log at INFO ...\n" +"about to log at WARNING ...\n" +"about to log at ERROR ...\n" +"Actually logged at DEBUG\n" +"Actually logged at INFO\n" +"Actually logged at WARNING\n" +"Actually logged at ERROR\n" +"about to log at CRITICAL ...\n" +"Actually logged at CRITICAL" +msgstr "" + +#: howto/logging-cookbook.rst:3165 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: howto/logging-cookbook.rst:2974 +#: howto/logging-cookbook.rst:3169 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: howto/logging-cookbook.rst:2984 +#: howto/logging-cookbook.rst:3171 +msgid "" +"@log_if_errors(logger)\n" +"def foo(fail=False):\n" +" ..." +msgstr "" + +#: howto/logging-cookbook.rst:3179 msgid "Sending logging messages to email, with buffering" msgstr "" -#: howto/logging-cookbook.rst:2986 +#: howto/logging-cookbook.rst:3181 msgid "" "To illustrate how you can send log messages via email, so that a set number " "of messages are sent per email, you can subclass :class:`~logging.handlers." @@ -1640,7 +3977,75 @@ msgid "" "argument to see the required and optional arguments.)" msgstr "" -#: howto/logging-cookbook.rst:3058 +#: howto/logging-cookbook.rst:3189 +msgid "" +"import logging\n" +"import logging.handlers\n" +"import smtplib\n" +"\n" +"class BufferingSMTPHandler(logging.handlers.BufferingHandler):\n" +" def __init__(self, mailhost, port, username, password, fromaddr, " +"toaddrs,\n" +" subject, capacity):\n" +" logging.handlers.BufferingHandler.__init__(self, capacity)\n" +" self.mailhost = mailhost\n" +" self.mailport = port\n" +" self.username = username\n" +" self.password = password\n" +" self.fromaddr = fromaddr\n" +" if isinstance(toaddrs, str):\n" +" toaddrs = [toaddrs]\n" +" self.toaddrs = toaddrs\n" +" self.subject = subject\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " +"%(message)s\"))\n" +"\n" +" def flush(self):\n" +" if len(self.buffer) > 0:\n" +" try:\n" +" smtp = smtplib.SMTP(self.mailhost, self.mailport)\n" +" smtp.starttls()\n" +" smtp.login(self.username, self.password)\n" +" msg = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\n\\r\\n\" " +"% (self.fromaddr, ','.join(self.toaddrs), self.subject)\n" +" for record in self.buffer:\n" +" s = self.format(record)\n" +" msg = msg + s + \"\\r\\n\"\n" +" smtp.sendmail(self.fromaddr, self.toaddrs, msg)\n" +" smtp.quit()\n" +" except Exception:\n" +" if logging.raiseExceptions:\n" +" raise\n" +" self.buffer = []\n" +"\n" +"if __name__ == '__main__':\n" +" import argparse\n" +"\n" +" ap = argparse.ArgumentParser()\n" +" aa = ap.add_argument\n" +" aa('host', metavar='HOST', help='SMTP server')\n" +" aa('--port', '-p', type=int, default=587, help='SMTP port')\n" +" aa('user', metavar='USER', help='SMTP username')\n" +" aa('password', metavar='PASSWORD', help='SMTP password')\n" +" aa('to', metavar='TO', help='Addressee for emails')\n" +" aa('sender', metavar='SENDER', help='Sender email address')\n" +" aa('--subject', '-s',\n" +" default='Test Logging email from Python logging module (buffering)',\n" +" help='Subject of email')\n" +" options = ap.parse_args()\n" +" logger = logging.getLogger()\n" +" logger.setLevel(logging.DEBUG)\n" +" h = BufferingSMTPHandler(options.host, options.port, options.user,\n" +" options.password, options.sender,\n" +" options.to, options.subject, 10)\n" +" logger.addHandler(h)\n" +" for i in range(102):\n" +" logger.info(\"Info index = %d\", i)\n" +" h.flush()\n" +" h.close()" +msgstr "" + +#: howto/logging-cookbook.rst:3253 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -1648,17 +4053,26 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: howto/logging-cookbook.rst:3066 +#: howto/logging-cookbook.rst:3261 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: howto/logging-cookbook.rst:3068 +#: howto/logging-cookbook.rst:3263 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as ``UTCFormatter``, shown below::" msgstr "" -#: howto/logging-cookbook.rst:3077 +#: howto/logging-cookbook.rst:3266 +msgid "" +"import logging\n" +"import time\n" +"\n" +"class UTCFormatter(logging.Formatter):\n" +" converter = time.gmtime" +msgstr "" + +#: howto/logging-cookbook.rst:3272 msgid "" "and you can then use the ``UTCFormatter`` in your code instead of :class:" "`~logging.Formatter`. If you want to do that via configuration, you can use " @@ -1666,21 +4080,68 @@ msgid "" "the following complete example::" msgstr "" -#: howto/logging-cookbook.rst:3120 +#: howto/logging-cookbook.rst:3277 +msgid "" +"import logging\n" +"import logging.config\n" +"import time\n" +"\n" +"class UTCFormatter(logging.Formatter):\n" +" converter = time.gmtime\n" +"\n" +"LOGGING = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': False,\n" +" 'formatters': {\n" +" 'utc': {\n" +" '()': UTCFormatter,\n" +" 'format': '%(asctime)s %(message)s',\n" +" },\n" +" 'local': {\n" +" 'format': '%(asctime)s %(message)s',\n" +" }\n" +" },\n" +" 'handlers': {\n" +" 'console1': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'formatter': 'utc',\n" +" },\n" +" 'console2': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'formatter': 'local',\n" +" },\n" +" },\n" +" 'root': {\n" +" 'handlers': ['console1', 'console2'],\n" +" }\n" +"}\n" +"\n" +"if __name__ == '__main__':\n" +" logging.config.dictConfig(LOGGING)\n" +" logging.warning('The local time is %s', time.asctime())" +msgstr "" + +#: howto/logging-cookbook.rst:3315 msgid "When this script is run, it should print something like:" msgstr "" -#: howto/logging-cookbook.rst:3127 +#: howto/logging-cookbook.rst:3317 +msgid "" +"2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" +"2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" +msgstr "" + +#: howto/logging-cookbook.rst:3322 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: howto/logging-cookbook.rst:3134 +#: howto/logging-cookbook.rst:3329 msgid "Using a context manager for selective logging" msgstr "" -#: howto/logging-cookbook.rst:3136 +#: howto/logging-cookbook.rst:3331 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -1690,7 +4151,36 @@ msgid "" "scope of the context manager::" msgstr "" -#: howto/logging-cookbook.rst:3169 +#: howto/logging-cookbook.rst:3338 +msgid "" +"import logging\n" +"import sys\n" +"\n" +"class LoggingContext:\n" +" def __init__(self, logger, level=None, handler=None, close=True):\n" +" self.logger = logger\n" +" self.level = level\n" +" self.handler = handler\n" +" self.close = close\n" +"\n" +" def __enter__(self):\n" +" if self.level is not None:\n" +" self.old_level = self.logger.level\n" +" self.logger.setLevel(self.level)\n" +" if self.handler:\n" +" self.logger.addHandler(self.handler)\n" +"\n" +" def __exit__(self, et, ev, tb):\n" +" if self.level is not None:\n" +" self.logger.setLevel(self.old_level)\n" +" if self.handler:\n" +" self.logger.removeHandler(self.handler)\n" +" if self.handler and self.close:\n" +" self.handler.close()\n" +" # implicit return of None => don't swallow exceptions" +msgstr "" + +#: howto/logging-cookbook.rst:3364 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -1699,13 +4189,33 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: howto/logging-cookbook.rst:3175 +#: howto/logging-cookbook.rst:3370 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: howto/logging-cookbook.rst:3193 +#: howto/logging-cookbook.rst:3373 +msgid "" +"if __name__ == '__main__':\n" +" logger = logging.getLogger('foo')\n" +" logger.addHandler(logging.StreamHandler())\n" +" logger.setLevel(logging.INFO)\n" +" logger.info('1. This should appear just once on stderr.')\n" +" logger.debug('2. This should not appear.')\n" +" with LoggingContext(logger, level=logging.DEBUG):\n" +" logger.debug('3. This should appear once on stderr.')\n" +" logger.debug('4. This should not appear.')\n" +" h = logging.StreamHandler(sys.stdout)\n" +" with LoggingContext(logger, level=logging.DEBUG, handler=h, " +"close=True):\n" +" logger.debug('5. This should appear twice - once on stderr and once " +"on stdout.')\n" +" logger.info('6. This should appear just once on stderr.')\n" +" logger.debug('7. This should not appear.')" +msgstr "" + +#: howto/logging-cookbook.rst:3388 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -1718,56 +4228,81 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: howto/logging-cookbook.rst:3203 +#: howto/logging-cookbook.rst:3398 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: howto/logging-cookbook.rst:3214 +#: howto/logging-cookbook.rst:3400 +msgid "" +"$ python logctx.py\n" +"1. This should appear just once on stderr.\n" +"3. This should appear once on stderr.\n" +"5. This should appear twice - once on stderr and once on stdout.\n" +"5. This should appear twice - once on stderr and once on stdout.\n" +"6. This should appear just once on stderr." +msgstr "" + +#: howto/logging-cookbook.rst:3409 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: howto/logging-cookbook.rst:3222 +#: howto/logging-cookbook.rst:3412 +msgid "" +"$ python logctx.py 2>/dev/null\n" +"5. This should appear twice - once on stderr and once on stdout." +msgstr "" + +#: howto/logging-cookbook.rst:3417 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: howto/logging-cookbook.rst:3232 +#: howto/logging-cookbook.rst:3419 +msgid "" +"$ python logctx.py >/dev/null\n" +"1. This should appear just once on stderr.\n" +"3. This should appear once on stderr.\n" +"5. This should appear twice - once on stderr and once on stdout.\n" +"6. This should appear just once on stderr." +msgstr "" + +#: howto/logging-cookbook.rst:3427 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: howto/logging-cookbook.rst:3234 +#: howto/logging-cookbook.rst:3429 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: howto/logging-cookbook.rst:3242 +#: howto/logging-cookbook.rst:3437 msgid "A CLI application starter template" msgstr "" -#: howto/logging-cookbook.rst:3244 +#: howto/logging-cookbook.rst:3439 msgid "Here's an example which shows how you can:" msgstr "" -#: howto/logging-cookbook.rst:3246 +#: howto/logging-cookbook.rst:3441 msgid "Use a logging level based on command-line arguments" msgstr "" -#: howto/logging-cookbook.rst:3247 +#: howto/logging-cookbook.rst:3442 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: howto/logging-cookbook.rst:3249 +#: howto/logging-cookbook.rst:3444 msgid "Make use of simple, minimal configuration" msgstr "" -#: howto/logging-cookbook.rst:3251 +#: howto/logging-cookbook.rst:3446 msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " @@ -1778,61 +4313,199 @@ msgid "" "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: howto/logging-cookbook.rst:3300 +#: howto/logging-cookbook.rst:3454 +msgid "" +"import argparse\n" +"import importlib\n" +"import logging\n" +"import os\n" +"import sys\n" +"\n" +"def main(args=None):\n" +" scriptname = os.path.basename(__file__)\n" +" parser = argparse.ArgumentParser(scriptname)\n" +" levels = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL')\n" +" parser.add_argument('--log-level', default='INFO', choices=levels)\n" +" subparsers = parser.add_subparsers(dest='command',\n" +" help='Available commands:')\n" +" start_cmd = subparsers.add_parser('start', help='Start a service')\n" +" start_cmd.add_argument('name', metavar='NAME',\n" +" help='Name of service to start')\n" +" stop_cmd = subparsers.add_parser('stop',\n" +" help='Stop one or more services')\n" +" stop_cmd.add_argument('names', metavar='NAME', nargs='+',\n" +" help='Name of service to stop')\n" +" restart_cmd = subparsers.add_parser('restart',\n" +" help='Restart one or more " +"services')\n" +" restart_cmd.add_argument('names', metavar='NAME', nargs='+',\n" +" help='Name of service to restart')\n" +" options = parser.parse_args()\n" +" # the code to dispatch commands could all be in this file. For the " +"purposes\n" +" # of illustration only, we implement each command in a separate module.\n" +" try:\n" +" mod = importlib.import_module(options.command)\n" +" cmd = getattr(mod, 'command')\n" +" except (ImportError, AttributeError):\n" +" print('Unable to find the code for command \\'%s\\'' % options." +"command)\n" +" return 1\n" +" # Could get fancy here and load configuration from file or dictionary\n" +" logging.basicConfig(level=options.log_level,\n" +" format='%(levelname)s %(name)s %(message)s')\n" +" cmd(options)\n" +"\n" +"if __name__ == '__main__':\n" +" sys.exit(main())" +msgstr "" + +#: howto/logging-cookbook.rst:3495 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: howto/logging-cookbook.rst:3313 +#: howto/logging-cookbook.rst:3498 +msgid "" +"# start.py\n" +"import logging\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def command(options):\n" +" logger.debug('About to start %s', options.name)\n" +" # actually do the command processing here ...\n" +" logger.info('Started the \\'%s\\' service.', options.name)" +msgstr "" + +#: howto/logging-cookbook.rst:3508 msgid "and thus for stopping::" msgstr "" -#: howto/logging-cookbook.rst:3334 +#: howto/logging-cookbook.rst:3510 +msgid "" +"# stop.py\n" +"import logging\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def command(options):\n" +" n = len(options.names)\n" +" if n == 1:\n" +" plural = ''\n" +" services = '\\'%s\\'' % options.names[0]\n" +" else:\n" +" plural = 's'\n" +" services = ', '.join('\\'%s\\'' % name for name in options.names)\n" +" i = services.rfind(', ')\n" +" services = services[:i] + ' and ' + services[i + 2:]\n" +" logger.debug('About to stop %s', services)\n" +" # actually do the command processing here ...\n" +" logger.info('Stopped the %s service%s.', services, plural)" +msgstr "" + +#: howto/logging-cookbook.rst:3529 msgid "and similarly for restarting::" msgstr "" -#: howto/logging-cookbook.rst:3355 +#: howto/logging-cookbook.rst:3531 +msgid "" +"# restart.py\n" +"import logging\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def command(options):\n" +" n = len(options.names)\n" +" if n == 1:\n" +" plural = ''\n" +" services = '\\'%s\\'' % options.names[0]\n" +" else:\n" +" plural = 's'\n" +" services = ', '.join('\\'%s\\'' % name for name in options.names)\n" +" i = services.rfind(', ')\n" +" services = services[:i] + ' and ' + services[i + 2:]\n" +" logger.debug('About to restart %s', services)\n" +" # actually do the command processing here ...\n" +" logger.info('Restarted the %s service%s.', services, plural)" +msgstr "" + +#: howto/logging-cookbook.rst:3550 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: howto/logging-cookbook.rst:3368 +#: howto/logging-cookbook.rst:3552 +msgid "" +"$ python app.py start foo\n" +"INFO start Started the 'foo' service.\n" +"\n" +"$ python app.py stop foo bar\n" +"INFO stop Stopped the 'foo' and 'bar' services.\n" +"\n" +"$ python app.py restart foo bar baz\n" +"INFO restart Restarted the 'foo', 'bar' and 'baz' services." +msgstr "" + +#: howto/logging-cookbook.rst:3563 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: howto/logging-cookbook.rst:3371 +#: howto/logging-cookbook.rst:3566 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: howto/logging-cookbook.rst:3388 +#: howto/logging-cookbook.rst:3569 +msgid "" +"$ python app.py --log-level DEBUG start foo\n" +"DEBUG start About to start foo\n" +"INFO start Started the 'foo' service.\n" +"\n" +"$ python app.py --log-level DEBUG stop foo bar\n" +"DEBUG stop About to stop 'foo' and 'bar'\n" +"INFO stop Stopped the 'foo' and 'bar' services.\n" +"\n" +"$ python app.py --log-level DEBUG restart foo bar baz\n" +"DEBUG restart About to restart 'foo', 'bar' and 'baz'\n" +"INFO restart Restarted the 'foo', 'bar' and 'baz' services." +msgstr "" + +#: howto/logging-cookbook.rst:3583 msgid "And if we want less:" msgstr "" -#: howto/logging-cookbook.rst:3396 +#: howto/logging-cookbook.rst:3585 +msgid "" +"$ python app.py --log-level WARNING start foo\n" +"$ python app.py --log-level WARNING stop foo bar\n" +"$ python app.py --log-level WARNING restart foo bar baz" +msgstr "" + +#: howto/logging-cookbook.rst:3591 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: howto/logging-cookbook.rst:3402 +#: howto/logging-cookbook.rst:3597 msgid "A Qt GUI for logging" msgstr "" -#: howto/logging-cookbook.rst:3404 +#: howto/logging-cookbook.rst:3599 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" -"platform UI framework with Python bindings using `PySide2 `_ or `PyQt5 `_ libraries." +"platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:" +"`PyQt5` libraries." msgstr "" -#: howto/logging-cookbook.rst:3410 +#: howto/logging-cookbook.rst:3604 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -1842,26 +4515,277 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: howto/logging-cookbook.rst:3417 +#: howto/logging-cookbook.rst:3611 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: howto/logging-cookbook.rst:3421 +#: howto/logging-cookbook.rst:3615 msgid "" -"The code should work with recent releases of either ``PySide6``, ``PyQt6``, " +"The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " "``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " "earlier versions of Qt. Please refer to the comments in the code snippet for " "more detailed information." msgstr "" -#: howto/logging-cookbook.rst:3658 +#: howto/logging-cookbook.rst:3620 +msgid "" +"import datetime\n" +"import logging\n" +"import random\n" +"import sys\n" +"import time\n" +"\n" +"# Deal with minor differences between different Qt packages\n" +"try:\n" +" from PySide6 import QtCore, QtGui, QtWidgets\n" +" Signal = QtCore.Signal\n" +" Slot = QtCore.Slot\n" +"except ImportError:\n" +" try:\n" +" from PyQt6 import QtCore, QtGui, QtWidgets\n" +" Signal = QtCore.pyqtSignal\n" +" Slot = QtCore.pyqtSlot\n" +" except ImportError:\n" +" try:\n" +" from PySide2 import QtCore, QtGui, QtWidgets\n" +" Signal = QtCore.Signal\n" +" Slot = QtCore.Slot\n" +" except ImportError:\n" +" from PyQt5 import QtCore, QtGui, QtWidgets\n" +" Signal = QtCore.pyqtSignal\n" +" Slot = QtCore.pyqtSlot\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"\n" +"#\n" +"# Signals need to be contained in a QObject or subclass in order to be " +"correctly\n" +"# initialized.\n" +"#\n" +"class Signaller(QtCore.QObject):\n" +" signal = Signal(str, logging.LogRecord)\n" +"\n" +"#\n" +"# Output to a Qt GUI is only supposed to happen on the main thread. So, " +"this\n" +"# handler is designed to take a slot function which is set up to run in the " +"main\n" +"# thread. In this example, the function takes a string argument which is a\n" +"# formatted log message, and the log record which generated it. The " +"formatted\n" +"# string is just a convenience - you could format a string for output any " +"way\n" +"# you like in the slot function itself.\n" +"#\n" +"# You specify the slot function to do whatever GUI updates you want. The " +"handler\n" +"# doesn't know or care about specific UI elements.\n" +"#\n" +"class QtHandler(logging.Handler):\n" +" def __init__(self, slotfunc, *args, **kwargs):\n" +" super().__init__(*args, **kwargs)\n" +" self.signaller = Signaller()\n" +" self.signaller.signal.connect(slotfunc)\n" +"\n" +" def emit(self, record):\n" +" s = self.format(record)\n" +" self.signaller.signal.emit(s, record)\n" +"\n" +"#\n" +"# This example uses QThreads, which means that the threads at the Python " +"level\n" +"# are named something like \"Dummy-1\". The function below gets the Qt name " +"of the\n" +"# current thread.\n" +"#\n" +"def ctname():\n" +" return QtCore.QThread.currentThread().objectName()\n" +"\n" +"\n" +"#\n" +"# Used to generate random levels for logging.\n" +"#\n" +"LEVELS = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" +" logging.CRITICAL)\n" +"\n" +"#\n" +"# This worker class represents work that is done in a thread separate to " +"the\n" +"# main thread. The way the thread is kicked off to do work is via a button " +"press\n" +"# that connects to a slot in the worker.\n" +"#\n" +"# Because the default threadName value in the LogRecord isn't much use, we " +"add\n" +"# a qThreadName which contains the QThread name as computed above, and pass " +"that\n" +"# value in an \"extra\" dictionary which is used to update the LogRecord " +"with the\n" +"# QThread name.\n" +"#\n" +"# This example worker just outputs messages sequentially, interspersed with\n" +"# random delays of the order of a few seconds.\n" +"#\n" +"class Worker(QtCore.QObject):\n" +" @Slot()\n" +" def start(self):\n" +" extra = {'qThreadName': ctname() }\n" +" logger.debug('Started work', extra=extra)\n" +" i = 1\n" +" # Let the thread run until interrupted. This allows reasonably " +"clean\n" +" # thread termination.\n" +" while not QtCore.QThread.currentThread().isInterruptionRequested():\n" +" delay = 0.5 + random.random() * 2\n" +" time.sleep(delay)\n" +" try:\n" +" if random.random() < 0.1:\n" +" raise ValueError('Exception raised: %d' % i)\n" +" else:\n" +" level = random.choice(LEVELS)\n" +" logger.log(level, 'Message after delay of %3.1f: %d', " +"delay, i, extra=extra)\n" +" except ValueError as e:\n" +" logger.exception('Failed: %s', e, extra=extra)\n" +" i += 1\n" +"\n" +"#\n" +"# Implement a simple UI for this cookbook example. This contains:\n" +"#\n" +"# * A read-only text edit window which holds formatted log messages\n" +"# * A button to start work and log stuff in a separate thread\n" +"# * A button to log something from the main thread\n" +"# * A button to clear the log window\n" +"#\n" +"class Window(QtWidgets.QWidget):\n" +"\n" +" COLORS = {\n" +" logging.DEBUG: 'black',\n" +" logging.INFO: 'blue',\n" +" logging.WARNING: 'orange',\n" +" logging.ERROR: 'red',\n" +" logging.CRITICAL: 'purple',\n" +" }\n" +"\n" +" def __init__(self, app):\n" +" super().__init__()\n" +" self.app = app\n" +" self.textedit = te = QtWidgets.QPlainTextEdit(self)\n" +" # Set whatever the default monospace font is for the platform\n" +" f = QtGui.QFont('nosuchfont')\n" +" if hasattr(f, 'Monospace'):\n" +" f.setStyleHint(f.Monospace)\n" +" else:\n" +" f.setStyleHint(f.StyleHint.Monospace) # for Qt6\n" +" te.setFont(f)\n" +" te.setReadOnly(True)\n" +" PB = QtWidgets.QPushButton\n" +" self.work_button = PB('Start background work', self)\n" +" self.log_button = PB('Log a message at a random level', self)\n" +" self.clear_button = PB('Clear log window', self)\n" +" self.handler = h = QtHandler(self.update_status)\n" +" # Remember to use qThreadName rather than threadName in the format " +"string.\n" +" fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s'\n" +" formatter = logging.Formatter(fs)\n" +" h.setFormatter(formatter)\n" +" logger.addHandler(h)\n" +" # Set up to terminate the QThread when we exit\n" +" app.aboutToQuit.connect(self.force_quit)\n" +"\n" +" # Lay out all the widgets\n" +" layout = QtWidgets.QVBoxLayout(self)\n" +" layout.addWidget(te)\n" +" layout.addWidget(self.work_button)\n" +" layout.addWidget(self.log_button)\n" +" layout.addWidget(self.clear_button)\n" +" self.setFixedSize(900, 400)\n" +"\n" +" # Connect the non-worker slots and signals\n" +" self.log_button.clicked.connect(self.manual_update)\n" +" self.clear_button.clicked.connect(self.clear_display)\n" +"\n" +" # Start a new worker thread and connect the slots for the worker\n" +" self.start_thread()\n" +" self.work_button.clicked.connect(self.worker.start)\n" +" # Once started, the button should be disabled\n" +" self.work_button.clicked.connect(lambda : self.work_button." +"setEnabled(False))\n" +"\n" +" def start_thread(self):\n" +" self.worker = Worker()\n" +" self.worker_thread = QtCore.QThread()\n" +" self.worker.setObjectName('Worker')\n" +" self.worker_thread.setObjectName('WorkerThread') # for qThreadName\n" +" self.worker.moveToThread(self.worker_thread)\n" +" # This will start an event loop in the worker thread\n" +" self.worker_thread.start()\n" +"\n" +" def kill_thread(self):\n" +" # Just tell the worker to stop, then tell it to quit and wait for " +"that\n" +" # to happen\n" +" self.worker_thread.requestInterruption()\n" +" if self.worker_thread.isRunning():\n" +" self.worker_thread.quit()\n" +" self.worker_thread.wait()\n" +" else:\n" +" print('worker has already exited.')\n" +"\n" +" def force_quit(self):\n" +" # For use when the window is closed\n" +" if self.worker_thread.isRunning():\n" +" self.kill_thread()\n" +"\n" +" # The functions below update the UI and run in the main thread because\n" +" # that's where the slots are set up\n" +"\n" +" @Slot(str, logging.LogRecord)\n" +" def update_status(self, status, record):\n" +" color = self.COLORS.get(record.levelno, 'black')\n" +" s = '
%s
' % (color, status)\n" +" self.textedit.appendHtml(s)\n" +"\n" +" @Slot()\n" +" def manual_update(self):\n" +" # This function uses the formatted message passed in, but also uses\n" +" # information from the record to format the message in an " +"appropriate\n" +" # color according to its severity (level).\n" +" level = random.choice(LEVELS)\n" +" extra = {'qThreadName': ctname() }\n" +" logger.log(level, 'Manually logged!', extra=extra)\n" +"\n" +" @Slot()\n" +" def clear_display(self):\n" +" self.textedit.clear()\n" +"\n" +"\n" +"def main():\n" +" QtCore.QThread.currentThread().setObjectName('MainThread')\n" +" logging.getLogger().setLevel(logging.DEBUG)\n" +" app = QtWidgets.QApplication(sys.argv)\n" +" example = Window(app)\n" +" example.show()\n" +" if hasattr(app, 'exec'):\n" +" rc = app.exec()\n" +" else:\n" +" rc = app.exec_()\n" +" sys.exit(rc)\n" +"\n" +"if __name__=='__main__':\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:3852 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: howto/logging-cookbook.rst:3660 +#: howto/logging-cookbook.rst:3854 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "default to use the older :rfc:`3164`, which hails from 2001. When " @@ -1871,14 +4795,84 @@ msgid "" "handlers.SysLogHandler` functionality has not been updated." msgstr "" -#: howto/logging-cookbook.rst:3667 +#: howto/logging-cookbook.rst:3861 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: howto/logging-cookbook.rst:3733 +#: howto/logging-cookbook.rst:3865 +msgid "" +"import datetime\n" +"import logging.handlers\n" +"import re\n" +"import socket\n" +"import time\n" +"\n" +"class SysLogHandler5424(logging.handlers.SysLogHandler):\n" +"\n" +" tz_offset = re.compile(r'([+-]\\d{2})(\\d{2})$')\n" +" escaped = re.compile(r'([\\]\"\\\\])')\n" +"\n" +" def __init__(self, *args, **kwargs):\n" +" self.msgid = kwargs.pop('msgid', None)\n" +" self.appname = kwargs.pop('appname', None)\n" +" super().__init__(*args, **kwargs)\n" +"\n" +" def format(self, record):\n" +" version = 1\n" +" asctime = datetime.datetime.fromtimestamp(record.created)." +"isoformat()\n" +" m = self.tz_offset.match(time.strftime('%z'))\n" +" has_offset = False\n" +" if m and time.timezone:\n" +" hrs, mins = m.groups()\n" +" if int(hrs) or int(mins):\n" +" has_offset = True\n" +" if not has_offset:\n" +" asctime += 'Z'\n" +" else:\n" +" asctime += f'{hrs}:{mins}'\n" +" try:\n" +" hostname = socket.gethostname()\n" +" except Exception:\n" +" hostname = '-'\n" +" appname = self.appname or '-'\n" +" procid = record.process\n" +" msgid = '-'\n" +" msg = super().format(record)\n" +" sdata = '-'\n" +" if hasattr(record, 'structured_data'):\n" +" sd = record.structured_data\n" +" # This should be a dict where the keys are SD-ID and the value " +"is a\n" +" # dict mapping PARAM-NAME to PARAM-VALUE (refer to the RFC for " +"what these\n" +" # mean)\n" +" # There's no error checking here - it's purely for illustration, " +"and you\n" +" # can adapt this code for use in production environments\n" +" parts = []\n" +"\n" +" def replacer(m):\n" +" g = m.groups()\n" +" return '\\\\' + g[0]\n" +"\n" +" for sdid, dv in sd.items():\n" +" part = f'[{sdid}'\n" +" for k, v in dv.items():\n" +" s = str(v)\n" +" s = self.escaped.sub(replacer, s)\n" +" part += f' {k}=\"{s}\"'\n" +" part += ']'\n" +" parts.append(part)\n" +" sdata = ''.join(parts)\n" +" return f'{version} {asctime} {hostname} {appname} {procid} {msgid} " +"{sdata} {msg}'" +msgstr "" + +#: howto/logging-cookbook.rst:3927 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -1887,11 +4881,22 @@ msgid "" "using something like this::" msgstr "" -#: howto/logging-cookbook.rst:3747 +#: howto/logging-cookbook.rst:3932 +msgid "" +"sd = {\n" +" 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" +" 'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'}\n" +"}\n" +"extra = {'structured_data': sd}\n" +"i = 1\n" +"logger.debug('Message %d', i, extra=extra)" +msgstr "" + +#: howto/logging-cookbook.rst:3941 msgid "How to treat a logger like an output stream" msgstr "" -#: howto/logging-cookbook.rst:3749 +#: howto/logging-cookbook.rst:3943 msgid "" "Sometimes, you need to interface to a third-party API which expects a file-" "like object to write to, but you want to direct the API's output to a " @@ -1899,17 +4904,69 @@ msgid "" "API. Here's a short script illustrating such a class:" msgstr "" -#: howto/logging-cookbook.rst:3789 +#: howto/logging-cookbook.rst:3948 +msgid "" +"import logging\n" +"\n" +"class LoggerWriter:\n" +" def __init__(self, logger, level):\n" +" self.logger = logger\n" +" self.level = level\n" +"\n" +" def write(self, message):\n" +" if message != '\\n': # avoid printing bare newlines, if you like\n" +" self.logger.log(self.level, message)\n" +"\n" +" def flush(self):\n" +" # doesn't actually do anything, but might be expected of a file-" +"like\n" +" # object - so optional depending on your situation\n" +" pass\n" +"\n" +" def close(self):\n" +" # doesn't actually do anything, but might be expected of a file-" +"like\n" +" # object - so optional depending on your situation. You might want\n" +" # to set a flag so that later calls to write raise an exception\n" +" pass\n" +"\n" +"def main():\n" +" logging.basicConfig(level=logging.DEBUG)\n" +" logger = logging.getLogger('demo')\n" +" info_fp = LoggerWriter(logger, logging.INFO)\n" +" debug_fp = LoggerWriter(logger, logging.DEBUG)\n" +" print('An INFO message', file=info_fp)\n" +" print('A DEBUG message', file=debug_fp)\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" +msgstr "" + +#: howto/logging-cookbook.rst:3983 msgid "When this script is run, it prints" msgstr "" -#: howto/logging-cookbook.rst:3796 +#: howto/logging-cookbook.rst:3985 +msgid "" +"INFO:demo:An INFO message\n" +"DEBUG:demo:A DEBUG message" +msgstr "" + +#: howto/logging-cookbook.rst:3990 msgid "" "You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." "stderr`` by doing something like this:" msgstr "" -#: howto/logging-cookbook.rst:3806 +#: howto/logging-cookbook.rst:3993 +msgid "" +"import sys\n" +"\n" +"sys.stdout = LoggerWriter(logger, logging.INFO)\n" +"sys.stderr = LoggerWriter(logger, logging.WARNING)" +msgstr "" + +#: howto/logging-cookbook.rst:4000 msgid "" "You should do this *after* configuring logging for your needs. In the above " "example, the :func:`~logging.basicConfig` call does this (using the ``sys." @@ -1917,45 +4974,237 @@ msgid "" "Then, you'd get this kind of result:" msgstr "" -#: howto/logging-cookbook.rst:3819 +#: howto/logging-cookbook.rst:4005 +msgid "" +">>> print('Foo')\n" +"INFO:demo:Foo\n" +">>> print('Bar', file=sys.stderr)\n" +"WARNING:demo:Bar\n" +">>>" +msgstr "" + +#: howto/logging-cookbook.rst:4013 msgid "" "Of course, the examples above show output according to the format used by :" "func:`~logging.basicConfig`, but you can use a different formatter when you " "configure logging." msgstr "" -#: howto/logging-cookbook.rst:3823 +#: howto/logging-cookbook.rst:4017 msgid "" "Note that with the above scheme, you are somewhat at the mercy of buffering " "and the sequence of write calls which you are intercepting. For example, " "with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" -#: howto/logging-cookbook.rst:3832 +#: howto/logging-cookbook.rst:4021 +msgid "" +"sys.stderr = LoggerWriter(logger, logging.WARNING)\n" +"1 / 0" +msgstr "" + +#: howto/logging-cookbook.rst:4026 msgid "then running the script results in" msgstr "" -#: howto/logging-cookbook.rst:3850 +#: howto/logging-cookbook.rst:4028 +msgid "" +"WARNING:demo:Traceback (most recent call last):\n" +"\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/test.py\", line 53, " +"in \n" +"\n" +"WARNING:demo:\n" +"WARNING:demo:main()\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/test.py\", line 49, " +"in main\n" +"\n" +"WARNING:demo:\n" +"WARNING:demo:1 / 0\n" +"WARNING:demo:ZeroDivisionError\n" +"WARNING:demo::\n" +"WARNING:demo:division by zero" +msgstr "" + +#: howto/logging-cookbook.rst:4044 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes multiple writes, each of which results " "in a separate logged line (for example, the last three lines above). To get " "around this problem, you need to buffer things and only output log lines " -"when newlines are seen. Let's use a slghtly better implementation of " +"when newlines are seen. Let's use a slightly better implementation of " "``LoggerWriter``:" msgstr "" -#: howto/logging-cookbook.rst:3875 +#: howto/logging-cookbook.rst:4050 +msgid "" +"class BufferingLoggerWriter(LoggerWriter):\n" +" def __init__(self, logger, level):\n" +" super().__init__(logger, level)\n" +" self.buffer = ''\n" +"\n" +" def write(self, message):\n" +" if '\\n' not in message:\n" +" self.buffer += message\n" +" else:\n" +" parts = message.split('\\n')\n" +" if self.buffer:\n" +" s = self.buffer + parts.pop(0)\n" +" self.logger.log(self.level, s)\n" +" self.buffer = parts.pop()\n" +" for part in parts:\n" +" self.logger.log(self.level, part)" +msgstr "" + +#: howto/logging-cookbook.rst:4069 msgid "" "This just buffers up stuff until a newline is seen, and then logs complete " "lines. With this approach, you get better output:" msgstr "" -#: howto/logging-cookbook.rst:3891 +#: howto/logging-cookbook.rst:4072 +msgid "" +"WARNING:demo:Traceback (most recent call last):\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " +"in \n" +"WARNING:demo: main()\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 52, " +"in main\n" +"WARNING:demo: 1/0\n" +"WARNING:demo:ZeroDivisionError: division by zero" +msgstr "" + +#: howto/logging-cookbook.rst:4082 +msgid "How to uniformly handle newlines in logging output" +msgstr "" + +#: howto/logging-cookbook.rst:4084 +msgid "" +"Usually, messages that are logged (say to console or file) consist of a " +"single line of text. However, sometimes there is a need to handle messages " +"with multiple lines - whether because a logging format string contains " +"newlines, or logged data contains newlines. If you want to handle such " +"messages uniformly, so that each line in the logged message appears " +"uniformly formatted as if it was logged separately, you can do this using a " +"handler mixin, as in the following snippet:" +msgstr "" + +#: howto/logging-cookbook.rst:4092 +msgid "" +"# Assume this is in a module mymixins.py\n" +"import copy\n" +"\n" +"class MultilineMixin:\n" +" def emit(self, record):\n" +" s = record.getMessage()\n" +" if '\\n' not in s:\n" +" super().emit(record)\n" +" else:\n" +" lines = s.splitlines()\n" +" rec = copy.copy(record)\n" +" rec.args = None\n" +" for line in lines:\n" +" rec.msg = line\n" +" super().emit(rec)" +msgstr "" + +#: howto/logging-cookbook.rst:4110 +msgid "You can use the mixin as in the following script:" +msgstr "" + +#: howto/logging-cookbook.rst:4112 +msgid "" +"import logging\n" +"\n" +"from mymixins import MultilineMixin\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"class StreamHandler(MultilineMixin, logging.StreamHandler):\n" +" pass\n" +"\n" +"if __name__ == '__main__':\n" +" logging.basicConfig(level=logging.DEBUG, format='%(asctime)s " +"%(levelname)-9s %(message)s',\n" +" handlers = [StreamHandler()])\n" +" logger.debug('Single line')\n" +" logger.debug('Multiple lines:\\nfool me once ...')\n" +" logger.debug('Another single line')\n" +" logger.debug('Multiple lines:\\n%s', 'fool me ...\\ncan\\'t get fooled " +"again')" +msgstr "" + +#: howto/logging-cookbook.rst:4131 +msgid "The script, when run, prints something like:" +msgstr "" + +#: howto/logging-cookbook.rst:4133 +msgid "" +"2025-07-02 13:54:47,234 DEBUG Single line\n" +"2025-07-02 13:54:47,234 DEBUG Multiple lines:\n" +"2025-07-02 13:54:47,234 DEBUG fool me once ...\n" +"2025-07-02 13:54:47,234 DEBUG Another single line\n" +"2025-07-02 13:54:47,234 DEBUG Multiple lines:\n" +"2025-07-02 13:54:47,234 DEBUG fool me ...\n" +"2025-07-02 13:54:47,234 DEBUG can't get fooled again" +msgstr "" + +#: howto/logging-cookbook.rst:4143 +msgid "" +"If, on the other hand, you are concerned about `log injection `_, you can use a formatter which " +"escapes newlines, as per the following example:" +msgstr "" + +#: howto/logging-cookbook.rst:4147 +msgid "" +"import logging\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"class EscapingFormatter(logging.Formatter):\n" +" def format(self, record):\n" +" s = super().format(record)\n" +" return s.replace('\\n', r'\\n')\n" +"\n" +"if __name__ == '__main__':\n" +" h = logging.StreamHandler()\n" +" h.setFormatter(EscapingFormatter('%(asctime)s %(levelname)-9s " +"%(message)s'))\n" +" logging.basicConfig(level=logging.DEBUG, handlers = [h])\n" +" logger.debug('Single line')\n" +" logger.debug('Multiple lines:\\nfool me once ...')\n" +" logger.debug('Another single line')\n" +" logger.debug('Multiple lines:\\n%s', 'fool me ...\\ncan\\'t get fooled " +"again')" +msgstr "" + +#: howto/logging-cookbook.rst:4167 +msgid "" +"You can, of course, use whatever escaping scheme makes the most sense for " +"you. The script, when run, should produce output like this:" +msgstr "" + +#: howto/logging-cookbook.rst:4170 +msgid "" +"2025-07-09 06:47:33,783 DEBUG Single line\n" +"2025-07-09 06:47:33,783 DEBUG Multiple lines:\\nfool me once ...\n" +"2025-07-09 06:47:33,783 DEBUG Another single line\n" +"2025-07-09 06:47:33,783 DEBUG Multiple lines:\\nfool me ...\\ncan't get " +"fooled again" +msgstr "" + +#: howto/logging-cookbook.rst:4177 +msgid "" +"Escaping behaviour can't be the stdlib default , as it would break backwards " +"compatibility." +msgstr "" + +#: howto/logging-cookbook.rst:4183 msgid "Patterns to avoid" msgstr "" -#: howto/logging-cookbook.rst:3893 +#: howto/logging-cookbook.rst:4185 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -1963,11 +5212,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: howto/logging-cookbook.rst:3899 +#: howto/logging-cookbook.rst:4191 msgid "Opening the same log file multiple times" msgstr "" -#: howto/logging-cookbook.rst:3901 +#: howto/logging-cookbook.rst:4193 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -1975,32 +5224,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: howto/logging-cookbook.rst:3906 +#: howto/logging-cookbook.rst:4198 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: howto/logging-cookbook.rst:3909 +#: howto/logging-cookbook.rst:4201 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: howto/logging-cookbook.rst:3912 +#: howto/logging-cookbook.rst:4204 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: howto/logging-cookbook.rst:3916 +#: howto/logging-cookbook.rst:4208 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: howto/logging-cookbook.rst:3919 +#: howto/logging-cookbook.rst:4211 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -2009,7 +5258,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: howto/logging-cookbook.rst:3925 +#: howto/logging-cookbook.rst:4217 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -2019,17 +5268,17 @@ msgid "" "being supposedly in place." msgstr "" -#: howto/logging-cookbook.rst:3932 +#: howto/logging-cookbook.rst:4224 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: howto/logging-cookbook.rst:3936 +#: howto/logging-cookbook.rst:4228 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: howto/logging-cookbook.rst:3938 +#: howto/logging-cookbook.rst:4230 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -2040,13 +5289,13 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: howto/logging-cookbook.rst:3947 +#: howto/logging-cookbook.rst:4239 msgid "" "Adding handlers other than :class:`~logging.NullHandler` to a logger in a " "library" msgstr "" -#: howto/logging-cookbook.rst:3949 +#: howto/logging-cookbook.rst:4241 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -2054,11 +5303,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: howto/logging-cookbook.rst:3955 +#: howto/logging-cookbook.rst:4247 msgid "Creating a lot of loggers" msgstr "" -#: howto/logging-cookbook.rst:3957 +#: howto/logging-cookbook.rst:4249 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -2069,14 +5318,38 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: howto/logging-cookbook.rst:3968 +#: howto/logging-cookbook.rst:4260 msgid "Other resources" msgstr "" -#: howto/logging-cookbook.rst:3981 +#: howto/logging-cookbook.rst:4264 +msgid "Module :mod:`logging`" +msgstr "" + +#: howto/logging-cookbook.rst:4265 +msgid "API reference for the logging module." +msgstr "" + +#: howto/logging-cookbook.rst:4267 +msgid "Module :mod:`logging.config`" +msgstr "" + +#: howto/logging-cookbook.rst:4268 +msgid "Configuration API for the logging module." +msgstr "" + +#: howto/logging-cookbook.rst:4270 +msgid "Module :mod:`logging.handlers`" +msgstr "" + +#: howto/logging-cookbook.rst:4271 +msgid "Useful handlers included with the logging module." +msgstr "" + +#: howto/logging-cookbook.rst:4273 msgid ":ref:`Basic Tutorial `" msgstr "" -#: howto/logging-cookbook.rst:3983 +#: howto/logging-cookbook.rst:4275 msgid ":ref:`Advanced Tutorial `" msgstr "" diff --git a/howto/logging.po b/howto/logging.po index d31ef58a..76c5e97b 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -8,15 +8,16 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: howto/logging.rst:3 +#: howto/logging.rst:5 msgid "Logging HOWTO" msgstr "" @@ -24,21 +25,21 @@ msgstr "" msgid "Author" msgstr "" -#: howto/logging.rst:5 +#: howto/logging.rst:7 msgid "Vinay Sajip " msgstr "" -#: howto/logging.rst:11 +#: howto/logging.rst:13 msgid "" "This page contains tutorial information. For links to reference information " "and a logging cookbook, please see :ref:`tutorial-ref-links`." msgstr "" -#: howto/logging.rst:15 +#: howto/logging.rst:17 msgid "Basic Logging Tutorial" msgstr "" -#: howto/logging.rst:17 +#: howto/logging.rst:19 msgid "" "Logging is a means of tracking events that happen when some software runs. " "The software's developer adds logging calls to their code to indicate that " @@ -49,11 +50,11 @@ msgid "" "the *level* or *severity*." msgstr "" -#: howto/logging.rst:26 +#: howto/logging.rst:28 msgid "When to use logging" msgstr "" -#: howto/logging.rst:28 +#: howto/logging.rst:30 msgid "" "You can access logging functionality by creating a logger via ``logger = " "getLogger(__name__)``, and then calling the logger's :meth:`~Logger.debug`, :" @@ -63,162 +64,173 @@ msgid "" "each of a set of common tasks, the best tool to use for that task." msgstr "" -#: howto/logging.rst:36 +#: howto/logging.rst:38 msgid "Task you want to perform" msgstr "" -#: howto/logging.rst:36 +#: howto/logging.rst:38 msgid "The best tool for the task" msgstr "" -#: howto/logging.rst:38 +#: howto/logging.rst:40 msgid "" "Display console output for ordinary usage of a command line script or program" msgstr "" -#: howto/logging.rst:38 +#: howto/logging.rst:40 msgid ":func:`print`" msgstr "" -#: howto/logging.rst:42 +#: howto/logging.rst:44 msgid "" "Report events that occur during normal operation of a program (e.g. for " "status monitoring or fault investigation)" msgstr "" -#: howto/logging.rst:42 +#: howto/logging.rst:44 msgid "" "A logger's :meth:`~Logger.info` (or :meth:`~Logger.debug` method for very " "detailed output for diagnostic purposes)" msgstr "" -#: howto/logging.rst:47 +#: howto/logging.rst:49 msgid "Issue a warning regarding a particular runtime event" msgstr "" -#: howto/logging.rst:47 +#: howto/logging.rst:49 msgid "" ":func:`warnings.warn` in library code if the issue is avoidable and the " "client application should be modified to eliminate the warning" msgstr "" -#: howto/logging.rst:52 +#: howto/logging.rst:54 msgid "" "A logger's :meth:`~Logger.warning` method if there is nothing the client " "application can do about the situation, but the event should still be noted" msgstr "" -#: howto/logging.rst:58 +#: howto/logging.rst:60 msgid "Report an error regarding a particular runtime event" msgstr "" -#: howto/logging.rst:58 +#: howto/logging.rst:60 msgid "Raise an exception" msgstr "" -#: howto/logging.rst:61 +#: howto/logging.rst:63 msgid "" "Report suppression of an error without raising an exception (e.g. error " "handler in a long-running server process)" msgstr "" -#: howto/logging.rst:61 +#: howto/logging.rst:63 msgid "" "A logger's :meth:`~Logger.error`, :meth:`~Logger.exception` or :meth:" "`~Logger.critical` method as appropriate for the specific error and " "application domain" msgstr "" -#: howto/logging.rst:68 +#: howto/logging.rst:70 msgid "" "The logger methods are named after the level or severity of the events they " "are used to track. The standard levels and their applicability are described " "below (in increasing order of severity):" msgstr "" -#: howto/logging.rst:830 +#: howto/logging.rst:875 msgid "Level" msgstr "" -#: howto/logging.rst:75 +#: howto/logging.rst:77 msgid "When it's used" msgstr "" -#: howto/logging.rst:840 +#: howto/logging.rst:885 msgid "``DEBUG``" msgstr "" -#: howto/logging.rst:77 +#: howto/logging.rst:79 msgid "" "Detailed information, typically of interest only when diagnosing problems." msgstr "" -#: howto/logging.rst:838 +#: howto/logging.rst:883 msgid "``INFO``" msgstr "" -#: howto/logging.rst:80 +#: howto/logging.rst:82 msgid "Confirmation that things are working as expected." msgstr "" -#: howto/logging.rst:836 +#: howto/logging.rst:881 msgid "``WARNING``" msgstr "" -#: howto/logging.rst:83 +#: howto/logging.rst:85 msgid "" "An indication that something unexpected happened, or indicative of some " "problem in the near future (e.g. 'disk space low'). The software is still " "working as expected." msgstr "" -#: howto/logging.rst:834 +#: howto/logging.rst:879 msgid "``ERROR``" msgstr "" -#: howto/logging.rst:88 +#: howto/logging.rst:90 msgid "" "Due to a more serious problem, the software has not been able to perform " "some function." msgstr "" -#: howto/logging.rst:832 +#: howto/logging.rst:877 msgid "``CRITICAL``" msgstr "" -#: howto/logging.rst:91 +#: howto/logging.rst:93 msgid "" "A serious error, indicating that the program itself may be unable to " "continue running." msgstr "" -#: howto/logging.rst:95 +#: howto/logging.rst:97 msgid "" -"The default level is ``WARNING``, which means that only events of this level " -"and above will be tracked, unless the logging package is configured to do " -"otherwise." +"The default level is ``WARNING``, which means that only events of this " +"severity and higher will be tracked, unless the logging package is " +"configured to do otherwise." msgstr "" -#: howto/logging.rst:99 +#: howto/logging.rst:100 msgid "" "Events that are tracked can be handled in different ways. The simplest way " "of handling tracked events is to print them to the console. Another common " "way is to write them to a disk file." msgstr "" -#: howto/logging.rst:107 +#: howto/logging.rst:108 msgid "A simple example" msgstr "" -#: howto/logging.rst:109 +#: howto/logging.rst:110 msgid "A very simple example is::" msgstr "" -#: howto/logging.rst:115 +#: howto/logging.rst:112 +msgid "" +"import logging\n" +"logging.warning('Watch out!') # will print a message to the console\n" +"logging.info('I told you so') # will not print anything" +msgstr "" + +#: howto/logging.rst:116 msgid "If you type these lines into a script and run it, you'll see:" msgstr "" -#: howto/logging.rst:121 +#: howto/logging.rst:118 +msgid "WARNING:root:Watch out!" +msgstr "" + +#: howto/logging.rst:122 msgid "" "printed out on the console. The ``INFO`` message doesn't appear because the " "default level is ``WARNING``. The printed message includes the indication of " @@ -227,11 +239,11 @@ msgid "" "need that; formatting options will also be explained later." msgstr "" -#: howto/logging.rst:127 +#: howto/logging.rst:128 msgid "" "Notice that in this example, we use functions directly on the ``logging`` " "module, like ``logging.debug``, rather than creating a logger and calling " -"functions on it. These functions operation on the root logger, but can be " +"functions on it. These functions operate on the root logger, but can be " "useful as they will call :func:`~logging.basicConfig` for you if it has not " "been called yet, like in this example. In larger programs you'll usually " "want to control the logging configuration explicitly however - so for that " @@ -239,11 +251,11 @@ msgid "" "methods." msgstr "" -#: howto/logging.rst:136 +#: howto/logging.rst:137 msgid "Logging to a file" msgstr "" -#: howto/logging.rst:138 +#: howto/logging.rst:139 msgid "" "A very common situation is that of recording logging events in a file, so " "let's look at that next. Be sure to try the following in a newly started " @@ -251,7 +263,19 @@ msgid "" "above::" msgstr "" -#: howto/logging.rst:150 +#: howto/logging.rst:143 +msgid "" +"import logging\n" +"logger = logging.getLogger(__name__)\n" +"logging.basicConfig(filename='example.log', encoding='utf-8', level=logging." +"DEBUG)\n" +"logger.debug('This message should go to the log file')\n" +"logger.info('So should this')\n" +"logger.warning('And this, too')\n" +"logger.error('And non-ASCII stuff, too, like Øresund and Malmö')" +msgstr "" + +#: howto/logging.rst:151 msgid "" "The *encoding* argument was added. In earlier Python versions, or if not " "specified, the encoding used is the default value used by :func:`open`. " @@ -260,45 +284,72 @@ msgid "" "values and the default, see the documentation for :func:`open`." msgstr "" -#: howto/logging.rst:157 +#: howto/logging.rst:158 msgid "" "And now if we open the file and look at what we have, we should find the log " "messages:" msgstr "" -#: howto/logging.rst:167 +#: howto/logging.rst:161 +msgid "" +"DEBUG:__main__:This message should go to the log file\n" +"INFO:__main__:So should this\n" +"WARNING:__main__:And this, too\n" +"ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö" +msgstr "" + +#: howto/logging.rst:168 msgid "" "This example also shows how you can set the logging level which acts as the " "threshold for tracking. In this case, because we set the threshold to " "``DEBUG``, all of the messages were printed." msgstr "" -#: howto/logging.rst:171 +#: howto/logging.rst:172 msgid "" "If you want to set the logging level from a command-line option such as:" msgstr "" -#: howto/logging.rst:177 +#: howto/logging.rst:174 +msgid "--log=INFO" +msgstr "" + +#: howto/logging.rst:178 msgid "" "and you have the value of the parameter passed for ``--log`` in some " "variable *loglevel*, you can use::" msgstr "" -#: howto/logging.rst:182 +#: howto/logging.rst:181 +msgid "getattr(logging, loglevel.upper())" +msgstr "" + +#: howto/logging.rst:183 msgid "" "to get the value which you'll pass to :func:`basicConfig` via the *level* " "argument. You may want to error check any user input value, perhaps as in " "the following example::" msgstr "" -#: howto/logging.rst:194 +#: howto/logging.rst:187 +msgid "" +"# assuming loglevel is bound to the string value obtained from the\n" +"# command line argument. Convert to upper case to allow the user to\n" +"# specify --log=DEBUG or --log=debug\n" +"numeric_level = getattr(logging, loglevel.upper(), None)\n" +"if not isinstance(numeric_level, int):\n" +" raise ValueError('Invalid log level: %s' % loglevel)\n" +"logging.basicConfig(level=numeric_level, ...)" +msgstr "" + +#: howto/logging.rst:195 msgid "" "The call to :func:`basicConfig` should come *before* any calls to a logger's " "methods such as :meth:`~Logger.debug`, :meth:`~Logger.info`, etc. Otherwise, " "that logging event may not be handled in the desired manner." msgstr "" -#: howto/logging.rst:198 +#: howto/logging.rst:199 msgid "" "If you run the above script several times, the messages from successive runs " "are appended to the file *example.log*. If you want each run to start " @@ -306,27 +357,43 @@ msgid "" "*filemode* argument, by changing the call in the above example to::" msgstr "" -#: howto/logging.rst:205 +#: howto/logging.rst:204 +msgid "" +"logging.basicConfig(filename='example.log', filemode='w', level=logging." +"DEBUG)" +msgstr "" + +#: howto/logging.rst:206 msgid "" "The output will be the same as before, but the log file is no longer " "appended to, so the messages from earlier runs are lost." msgstr "" -#: howto/logging.rst:210 +#: howto/logging.rst:211 msgid "Logging variable data" msgstr "" -#: howto/logging.rst:212 +#: howto/logging.rst:213 msgid "" "To log variable data, use a format string for the event description message " "and append the variable data as arguments. For example::" msgstr "" -#: howto/logging.rst:218 +#: howto/logging.rst:216 +msgid "" +"import logging\n" +"logging.warning('%s before you %s', 'Look', 'leap!')" +msgstr "" + +#: howto/logging.rst:219 msgid "will display:" msgstr "" -#: howto/logging.rst:224 +#: howto/logging.rst:221 +msgid "WARNING:root:Look before you leap!" +msgstr "" + +#: howto/logging.rst:225 msgid "" "As you can see, merging of variable data into the event description message " "uses the old, %-style of string formatting. This is for backwards " @@ -336,21 +403,38 @@ msgid "" "tutorial: see :ref:`formatting-styles` for more information." msgstr "" -#: howto/logging.rst:233 +#: howto/logging.rst:234 msgid "Changing the format of displayed messages" msgstr "" -#: howto/logging.rst:235 +#: howto/logging.rst:236 msgid "" "To change the format which is used to display messages, you need to specify " "the format you want to use::" msgstr "" -#: howto/logging.rst:244 +#: howto/logging.rst:239 +msgid "" +"import logging\n" +"logging.basicConfig(format='%(levelname)s:%(message)s', level=logging." +"DEBUG)\n" +"logging.debug('This message should appear on the console')\n" +"logging.info('So should this')\n" +"logging.warning('And this, too')" +msgstr "" + +#: howto/logging.rst:245 msgid "which would print:" msgstr "" -#: howto/logging.rst:252 +#: howto/logging.rst:247 +msgid "" +"DEBUG:This message should appear on the console\n" +"INFO:So should this\n" +"WARNING:And this, too" +msgstr "" + +#: howto/logging.rst:253 msgid "" "Notice that the 'root' which appeared in earlier examples has disappeared. " "For a full set of things that can appear in format strings, you can refer to " @@ -360,42 +444,65 @@ msgid "" "This is described in the next section." msgstr "" -#: howto/logging.rst:261 +#: howto/logging.rst:262 msgid "Displaying the date/time in messages" msgstr "" -#: howto/logging.rst:263 +#: howto/logging.rst:264 msgid "" "To display the date and time of an event, you would place '%(asctime)s' in " "your format string::" msgstr "" -#: howto/logging.rst:270 +#: howto/logging.rst:267 +msgid "" +"import logging\n" +"logging.basicConfig(format='%(asctime)s %(message)s')\n" +"logging.warning('is when this event was logged.')" +msgstr "" + +#: howto/logging.rst:271 msgid "which should print something like this:" msgstr "" -#: howto/logging.rst:276 +#: howto/logging.rst:273 +msgid "2010-12-12 11:41:42,612 is when this event was logged." +msgstr "" + +#: howto/logging.rst:277 msgid "" "The default format for date/time display (shown above) is like ISO8601 or :" "rfc:`3339`. If you need more control over the formatting of the date/time, " "provide a *datefmt* argument to ``basicConfig``, as in this example::" msgstr "" -#: howto/logging.rst:284 +#: howto/logging.rst:281 +msgid "" +"import logging\n" +"logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:" +"%M:%S %p')\n" +"logging.warning('is when this event was logged.')" +msgstr "" + +#: howto/logging.rst:285 msgid "which would display something like this:" msgstr "" -#: howto/logging.rst:290 +#: howto/logging.rst:287 +msgid "12/12/2010 11:46:36 AM is when this event was logged." +msgstr "" + +#: howto/logging.rst:291 msgid "" "The format of the *datefmt* argument is the same as supported by :func:`time." "strftime`." msgstr "" -#: howto/logging.rst:295 +#: howto/logging.rst:296 msgid "Next Steps" msgstr "" -#: howto/logging.rst:297 +#: howto/logging.rst:298 msgid "" "That concludes the basic tutorial. It should be enough to get you up and " "running with logging. There's a lot more that the logging package offers, " @@ -404,59 +511,59 @@ msgid "" "of your favourite beverage and carry on." msgstr "" -#: howto/logging.rst:303 +#: howto/logging.rst:304 msgid "" "If your logging needs are simple, then use the above examples to incorporate " "logging into your own scripts, and if you run into problems or don't " -"understand something, please post a question on the comp.lang.python Usenet " -"group (available at https://groups.google.com/g/comp.lang.python) and you " +"understand something, please post a question in the Help category of the " +"`Python discussion forum `_ and you " "should receive help before too long." msgstr "" -#: howto/logging.rst:309 +#: howto/logging.rst:310 msgid "" "Still here? You can carry on reading the next few sections, which provide a " "slightly more advanced/in-depth tutorial than the basic one above. After " "that, you can take a look at the :ref:`logging-cookbook`." msgstr "" -#: howto/logging.rst:317 +#: howto/logging.rst:318 msgid "Advanced Logging Tutorial" msgstr "" -#: howto/logging.rst:319 +#: howto/logging.rst:320 msgid "" "The logging library takes a modular approach and offers several categories " "of components: loggers, handlers, filters, and formatters." msgstr "" -#: howto/logging.rst:322 +#: howto/logging.rst:323 msgid "Loggers expose the interface that application code directly uses." msgstr "" -#: howto/logging.rst:323 +#: howto/logging.rst:324 msgid "" "Handlers send the log records (created by loggers) to the appropriate " "destination." msgstr "" -#: howto/logging.rst:325 +#: howto/logging.rst:326 msgid "" "Filters provide a finer grained facility for determining which log records " "to output." msgstr "" -#: howto/logging.rst:327 +#: howto/logging.rst:328 msgid "Formatters specify the layout of log records in the final output." msgstr "" -#: howto/logging.rst:329 +#: howto/logging.rst:330 msgid "" "Log event information is passed between loggers, handlers, filters and " "formatters in a :class:`LogRecord` instance." msgstr "" -#: howto/logging.rst:332 +#: howto/logging.rst:333 msgid "" "Logging is performed by calling methods on instances of the :class:`Logger` " "class (hereafter called :dfn:`loggers`). Each instance has a name, and they " @@ -467,19 +574,23 @@ msgid "" "originates." msgstr "" -#: howto/logging.rst:339 +#: howto/logging.rst:340 msgid "" "A good convention to use when naming loggers is to use a module-level " "logger, in each module which uses logging, named as follows::" msgstr "" -#: howto/logging.rst:344 +#: howto/logging.rst:343 +msgid "logger = logging.getLogger(__name__)" +msgstr "" + +#: howto/logging.rst:345 msgid "" "This means that logger names track the package/module hierarchy, and it's " "intuitively obvious where events are logged just from the logger name." msgstr "" -#: howto/logging.rst:347 +#: howto/logging.rst:348 msgid "" "The root of the hierarchy of loggers is called the root logger. That's the " "logger used by the functions :func:`debug`, :func:`info`, :func:`warning`, :" @@ -488,7 +599,7 @@ msgid "" "root logger's name is printed as 'root' in the logged output." msgstr "" -#: howto/logging.rst:353 +#: howto/logging.rst:354 msgid "" "It is, of course, possible to log messages to different destinations. " "Support is included in the package for writing log messages to files, HTTP " @@ -499,7 +610,7 @@ msgid "" "built-in handler classes." msgstr "" -#: howto/logging.rst:360 +#: howto/logging.rst:361 msgid "" "By default, no destination is set for any logging messages. You can specify " "a destination (such as console or file) by using :func:`basicConfig` as in " @@ -511,32 +622,36 @@ msgid "" "message output." msgstr "" -#: howto/logging.rst:368 +#: howto/logging.rst:369 msgid "The default format set by :func:`basicConfig` for messages is:" msgstr "" -#: howto/logging.rst:374 +#: howto/logging.rst:371 +msgid "severity:logger name:message" +msgstr "" + +#: howto/logging.rst:375 msgid "" "You can change this by passing a format string to :func:`basicConfig` with " "the *format* keyword argument. For all options regarding how a format string " "is constructed, see :ref:`formatter-objects`." msgstr "" -#: howto/logging.rst:379 +#: howto/logging.rst:380 msgid "Logging Flow" msgstr "" -#: howto/logging.rst:381 +#: howto/logging.rst:382 msgid "" "The flow of log event information in loggers and handlers is illustrated in " "the following diagram." msgstr "" -#: howto/logging.rst:388 +#: howto/logging.rst:433 msgid "Loggers" msgstr "" -#: howto/logging.rst:390 +#: howto/logging.rst:435 msgid "" ":class:`Logger` objects have a threefold job. First, they expose several " "methods to application code so that applications can log messages at " @@ -546,17 +661,17 @@ msgid "" "handlers." msgstr "" -#: howto/logging.rst:396 +#: howto/logging.rst:441 msgid "" "The most widely used methods on logger objects fall into two categories: " "configuration and message sending." msgstr "" -#: howto/logging.rst:399 +#: howto/logging.rst:444 msgid "These are the most common configuration methods:" msgstr "" -#: howto/logging.rst:401 +#: howto/logging.rst:446 msgid "" ":meth:`Logger.setLevel` specifies the lowest-severity log message a logger " "will handle, where debug is the lowest built-in severity level and critical " @@ -565,32 +680,32 @@ msgid "" "messages and will ignore DEBUG messages." msgstr "" -#: howto/logging.rst:407 +#: howto/logging.rst:452 msgid "" ":meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove " "handler objects from the logger object. Handlers are covered in more detail " "in :ref:`handler-basic`." msgstr "" -#: howto/logging.rst:411 +#: howto/logging.rst:456 msgid "" ":meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove " "filter objects from the logger object. Filters are covered in more detail " "in :ref:`filter`." msgstr "" -#: howto/logging.rst:415 +#: howto/logging.rst:460 msgid "" "You don't need to always call these methods on every logger you create. See " "the last two paragraphs in this section." msgstr "" -#: howto/logging.rst:418 +#: howto/logging.rst:463 msgid "" "With the logger object configured, the following methods create log messages:" msgstr "" -#: howto/logging.rst:420 +#: howto/logging.rst:465 msgid "" ":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:" "`Logger.error`, and :meth:`Logger.critical` all create log records with a " @@ -603,14 +718,14 @@ msgid "" "exception information." msgstr "" -#: howto/logging.rst:430 +#: howto/logging.rst:475 msgid "" ":meth:`Logger.exception` creates a log message similar to :meth:`Logger." "error`. The difference is that :meth:`Logger.exception` dumps a stack trace " "along with it. Call this method only from an exception handler." msgstr "" -#: howto/logging.rst:434 +#: howto/logging.rst:479 msgid "" ":meth:`Logger.log` takes a log level as an explicit argument. This is a " "little more verbose for logging messages than using the log level " @@ -618,7 +733,7 @@ msgid "" "levels." msgstr "" -#: howto/logging.rst:438 +#: howto/logging.rst:483 msgid "" ":func:`getLogger` returns a reference to a logger instance with the " "specified name if it is provided, or ``root`` if not. The names are period-" @@ -630,7 +745,7 @@ msgid "" "descendants of ``foo``." msgstr "" -#: howto/logging.rst:446 +#: howto/logging.rst:491 msgid "" "Loggers have a concept of *effective level*. If a level is not explicitly " "set on a logger, the level of its parent is used instead as its effective " @@ -642,7 +757,7 @@ msgid "" "handlers." msgstr "" -#: howto/logging.rst:454 +#: howto/logging.rst:499 msgid "" "Child loggers propagate messages up to the handlers associated with their " "ancestor loggers. Because of this, it is unnecessary to define and configure " @@ -652,11 +767,11 @@ msgid "" "attribute of a logger to ``False``.)" msgstr "" -#: howto/logging.rst:465 +#: howto/logging.rst:510 msgid "Handlers" msgstr "" -#: howto/logging.rst:467 +#: howto/logging.rst:512 msgid "" ":class:`~logging.Handler` objects are responsible for dispatching the " "appropriate log messages (based on the log messages' severity) to the " @@ -669,14 +784,14 @@ msgid "" "of a specific severity to a specific location." msgstr "" -#: howto/logging.rst:477 +#: howto/logging.rst:522 msgid "" "The standard library includes quite a few handler types (see :ref:`useful-" "handlers`); the tutorials use mainly :class:`StreamHandler` and :class:" "`FileHandler` in its examples." msgstr "" -#: howto/logging.rst:481 +#: howto/logging.rst:526 msgid "" "There are very few methods in a handler for application developers to " "concern themselves with. The only handler methods that seem relevant for " @@ -684,7 +799,7 @@ msgid "" "not creating custom handlers) are the following configuration methods:" msgstr "" -#: howto/logging.rst:486 +#: howto/logging.rst:531 msgid "" "The :meth:`~Handler.setLevel` method, just as in logger objects, specifies " "the lowest severity that will be dispatched to the appropriate destination. " @@ -694,19 +809,19 @@ msgid "" "send on." msgstr "" -#: howto/logging.rst:492 +#: howto/logging.rst:537 msgid "" ":meth:`~Handler.setFormatter` selects a Formatter object for this handler to " "use." msgstr "" -#: howto/logging.rst:495 +#: howto/logging.rst:540 msgid "" ":meth:`~Handler.addFilter` and :meth:`~Handler.removeFilter` respectively " "configure and deconfigure filter objects on handlers." msgstr "" -#: howto/logging.rst:498 +#: howto/logging.rst:543 msgid "" "Application code should not directly instantiate and use instances of :class:" "`Handler`. Instead, the :class:`Handler` class is a base class that defines " @@ -714,11 +829,11 @@ msgid "" "behavior that child classes can use (or override)." msgstr "" -#: howto/logging.rst:505 +#: howto/logging.rst:550 msgid "Formatters" msgstr "" -#: howto/logging.rst:507 +#: howto/logging.rst:552 msgid "" "Formatter objects configure the final order, structure, and contents of the " "log message. Unlike the base :class:`logging.Handler` class, application " @@ -728,20 +843,24 @@ msgid "" "string and a style indicator." msgstr "" -#: howto/logging.rst:516 +#: howto/logging.rst:561 msgid "" "If there is no message format string, the default is to use the raw " "message. If there is no date format string, the default date format is:" msgstr "" -#: howto/logging.rst:523 +#: howto/logging.rst:564 +msgid "%Y-%m-%d %H:%M:%S" +msgstr "" + +#: howto/logging.rst:568 msgid "" "with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``, " "``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be " "used." msgstr "" -#: howto/logging.rst:526 +#: howto/logging.rst:571 msgid "" "If the ``style`` is ``'%'``, the message format string uses ``%()s`` styled string substitution; the possible keys are documented in :" @@ -751,18 +870,22 @@ msgid "" "should conform to what is expected by :meth:`string.Template.substitute`." msgstr "" -#: howto/logging.rst:533 +#: howto/logging.rst:578 msgid "Added the ``style`` parameter." msgstr "" -#: howto/logging.rst:536 +#: howto/logging.rst:581 msgid "" "The following message format string will log the time in a human-readable " "format, the severity of the message, and the contents of the message, in " "that order::" msgstr "" -#: howto/logging.rst:542 +#: howto/logging.rst:585 +msgid "'%(asctime)s - %(levelname)s - %(message)s'" +msgstr "" + +#: howto/logging.rst:587 msgid "" "Formatters use a user-configurable function to convert the creation time of " "a record to a tuple. By default, :func:`time.localtime` is used; to change " @@ -773,68 +896,167 @@ msgid "" "in the Formatter class (to ``time.gmtime`` for GMT display)." msgstr "" -#: howto/logging.rst:552 +#: howto/logging.rst:597 msgid "Configuring Logging" msgstr "" -#: howto/logging.rst:556 +#: howto/logging.rst:601 msgid "Programmers can configure logging in three ways:" msgstr "" -#: howto/logging.rst:558 +#: howto/logging.rst:603 msgid "" "Creating loggers, handlers, and formatters explicitly using Python code that " "calls the configuration methods listed above." msgstr "" -#: howto/logging.rst:560 +#: howto/logging.rst:605 msgid "" "Creating a logging config file and reading it using the :func:`fileConfig` " "function." msgstr "" -#: howto/logging.rst:562 +#: howto/logging.rst:607 msgid "" "Creating a dictionary of configuration information and passing it to the :" "func:`dictConfig` function." msgstr "" -#: howto/logging.rst:565 +#: howto/logging.rst:610 msgid "" "For the reference documentation on the last two options, see :ref:`logging-" "config-api`. The following example configures a very simple logger, a " "console handler, and a simple formatter using Python code::" msgstr "" -#: howto/logging.rst:595 +#: howto/logging.rst:614 +msgid "" +"import logging\n" +"\n" +"# create logger\n" +"logger = logging.getLogger('simple_example')\n" +"logger.setLevel(logging.DEBUG)\n" +"\n" +"# create console handler and set level to debug\n" +"ch = logging.StreamHandler()\n" +"ch.setLevel(logging.DEBUG)\n" +"\n" +"# create formatter\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" +"\n" +"# add formatter to ch\n" +"ch.setFormatter(formatter)\n" +"\n" +"# add ch to logger\n" +"logger.addHandler(ch)\n" +"\n" +"# 'application' code\n" +"logger.debug('debug message')\n" +"logger.info('info message')\n" +"logger.warning('warn message')\n" +"logger.error('error message')\n" +"logger.critical('critical message')" +msgstr "" + +#: howto/logging.rst:640 msgid "" "Running this module from the command line produces the following output:" msgstr "" -#: howto/logging.rst:606 +#: howto/logging.rst:642 +msgid "" +"$ python simple_logging_module.py\n" +"2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message\n" +"2005-03-19 15:10:26,620 - simple_example - INFO - info message\n" +"2005-03-19 15:10:26,695 - simple_example - WARNING - warn message\n" +"2005-03-19 15:10:26,697 - simple_example - ERROR - error message\n" +"2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message" +msgstr "" + +#: howto/logging.rst:651 msgid "" "The following Python module creates a logger, handler, and formatter nearly " "identical to those in the example listed above, with the only difference " "being the names of the objects::" msgstr "" -#: howto/logging.rst:625 +#: howto/logging.rst:655 +msgid "" +"import logging\n" +"import logging.config\n" +"\n" +"logging.config.fileConfig('logging.conf')\n" +"\n" +"# create logger\n" +"logger = logging.getLogger('simpleExample')\n" +"\n" +"# 'application' code\n" +"logger.debug('debug message')\n" +"logger.info('info message')\n" +"logger.warning('warn message')\n" +"logger.error('error message')\n" +"logger.critical('critical message')" +msgstr "" + +#: howto/logging.rst:670 msgid "Here is the logging.conf file:" msgstr "" -#: howto/logging.rst:657 +#: howto/logging.rst:672 +msgid "" +"[loggers]\n" +"keys=root,simpleExample\n" +"\n" +"[handlers]\n" +"keys=consoleHandler\n" +"\n" +"[formatters]\n" +"keys=simpleFormatter\n" +"\n" +"[logger_root]\n" +"level=DEBUG\n" +"handlers=consoleHandler\n" +"\n" +"[logger_simpleExample]\n" +"level=DEBUG\n" +"handlers=consoleHandler\n" +"qualname=simpleExample\n" +"propagate=0\n" +"\n" +"[handler_consoleHandler]\n" +"class=StreamHandler\n" +"level=DEBUG\n" +"formatter=simpleFormatter\n" +"args=(sys.stdout,)\n" +"\n" +"[formatter_simpleFormatter]\n" +"format=%(asctime)s - %(name)s - %(levelname)s - %(message)s" +msgstr "" + +#: howto/logging.rst:702 msgid "" "The output is nearly identical to that of the non-config-file-based example:" msgstr "" -#: howto/logging.rst:668 +#: howto/logging.rst:704 +msgid "" +"$ python simple_logging_config.py\n" +"2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message\n" +"2005-03-19 15:38:55,979 - simpleExample - INFO - info message\n" +"2005-03-19 15:38:56,054 - simpleExample - WARNING - warn message\n" +"2005-03-19 15:38:56,055 - simpleExample - ERROR - error message\n" +"2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message" +msgstr "" + +#: howto/logging.rst:713 msgid "" "You can see that the config file approach has a few advantages over the " "Python code approach, mainly separation of configuration and code and the " "ability of noncoders to easily modify the logging properties." msgstr "" -#: howto/logging.rst:672 +#: howto/logging.rst:717 msgid "" "The :func:`fileConfig` function takes a default parameter, " "``disable_existing_loggers``, which defaults to ``True`` for reasons of " @@ -845,7 +1067,7 @@ msgid "" "information, and specify ``False`` for this parameter if you wish." msgstr "" -#: howto/logging.rst:680 +#: howto/logging.rst:725 msgid "" "The dictionary passed to :func:`dictConfig` can also specify a Boolean value " "with key ``disable_existing_loggers``, which if not specified explicitly in " @@ -854,7 +1076,7 @@ msgid "" "want - in which case, provide the key explicitly with a value of ``False``." msgstr "" -#: howto/logging.rst:690 +#: howto/logging.rst:735 msgid "" "Note that the class names referenced in config files need to be either " "relative to the logging module, or absolute values which can be resolved " @@ -865,7 +1087,7 @@ msgid "" "path)." msgstr "" -#: howto/logging.rst:698 +#: howto/logging.rst:743 msgid "" "In Python 3.2, a new means of configuring logging has been introduced, using " "dictionaries to hold configuration information. This provides a superset of " @@ -880,30 +1102,52 @@ msgid "" "a socket, or use whatever approach makes sense for your application." msgstr "" -#: howto/logging.rst:710 +#: howto/logging.rst:755 msgid "" "Here's an example of the same configuration as above, in YAML format for the " "new dictionary-based approach:" msgstr "" -#: howto/logging.rst:734 +#: howto/logging.rst:758 +msgid "" +"version: 1\n" +"formatters:\n" +" simple:\n" +" format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'\n" +"handlers:\n" +" console:\n" +" class: logging.StreamHandler\n" +" level: DEBUG\n" +" formatter: simple\n" +" stream: ext://sys.stdout\n" +"loggers:\n" +" simpleExample:\n" +" level: DEBUG\n" +" handlers: [console]\n" +" propagate: no\n" +"root:\n" +" level: DEBUG\n" +" handlers: [console]" +msgstr "" + +#: howto/logging.rst:779 msgid "" "For more information about logging using a dictionary, see :ref:`logging-" "config-api`." msgstr "" -#: howto/logging.rst:738 +#: howto/logging.rst:783 msgid "What happens if no configuration is provided" msgstr "" -#: howto/logging.rst:740 +#: howto/logging.rst:785 msgid "" "If no logging configuration is provided, it is possible to have a situation " "where a logging event needs to be output, but no handlers can be found to " "output the event." msgstr "" -#: howto/logging.rst:744 +#: howto/logging.rst:789 msgid "" "The event is output using a 'handler of last resort', stored in :data:" "`lastResort`. This internal handler is not associated with any logger, and " @@ -915,32 +1159,32 @@ msgid "" "severities will be output." msgstr "" -#: howto/logging.rst:755 +#: howto/logging.rst:800 msgid "For versions of Python prior to 3.2, the behaviour is as follows:" msgstr "" -#: howto/logging.rst:757 +#: howto/logging.rst:802 msgid "" "If :data:`raiseExceptions` is ``False`` (production mode), the event is " "silently dropped." msgstr "" -#: howto/logging.rst:760 +#: howto/logging.rst:805 msgid "" "If :data:`raiseExceptions` is ``True`` (development mode), a message 'No " "handlers could be found for logger X.Y.Z' is printed once." msgstr "" -#: howto/logging.rst:763 +#: howto/logging.rst:808 msgid "" "To obtain the pre-3.2 behaviour, :data:`lastResort` can be set to ``None``." msgstr "" -#: howto/logging.rst:769 +#: howto/logging.rst:814 msgid "Configuring Logging for a Library" msgstr "" -#: howto/logging.rst:771 +#: howto/logging.rst:816 msgid "" "When developing a library which uses logging, you should take care to " "document how the library uses logging - for example, the names of loggers " @@ -951,7 +1195,7 @@ msgid "" "is regarded as the best default behaviour." msgstr "" -#: howto/logging.rst:779 +#: howto/logging.rst:824 msgid "" "If for some reason you *don't* want these messages printed in the absence of " "any logging configuration, you can attach a do-nothing handler to the top-" @@ -963,7 +1207,7 @@ msgid "" "to those handlers, as normal." msgstr "" -#: howto/logging.rst:788 +#: howto/logging.rst:833 msgid "" "A do-nothing handler is included in the logging package: :class:`~logging." "NullHandler` (since Python 3.1). An instance of this handler could be added " @@ -974,14 +1218,20 @@ msgid "" "etc. then the code::" msgstr "" -#: howto/logging.rst:799 +#: howto/logging.rst:841 +msgid "" +"import logging\n" +"logging.getLogger('foo').addHandler(logging.NullHandler())" +msgstr "" + +#: howto/logging.rst:844 msgid "" "should have the desired effect. If an organisation produces a number of " "libraries, then the logger name specified can be 'orgname.foo' rather than " "just 'foo'." msgstr "" -#: howto/logging.rst:803 +#: howto/logging.rst:848 msgid "" "It is strongly advised that you *do not log to the root logger* in your " "library. Instead, use a logger with a unique and easily identifiable name, " @@ -991,7 +1241,7 @@ msgid "" "library as they wish." msgstr "" -#: howto/logging.rst:810 +#: howto/logging.rst:855 msgid "" "It is strongly advised that you *do not add any handlers other than* :class:" "`~logging.NullHandler` *to your library's loggers*. This is because the " @@ -1002,11 +1252,11 @@ msgid "" "carry out unit tests and deliver logs which suit their requirements." msgstr "" -#: howto/logging.rst:821 +#: howto/logging.rst:866 msgid "Logging Levels" msgstr "" -#: howto/logging.rst:823 +#: howto/logging.rst:868 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -1015,39 +1265,39 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: howto/logging.rst:830 +#: howto/logging.rst:875 msgid "Numeric value" msgstr "" -#: howto/logging.rst:832 +#: howto/logging.rst:877 msgid "50" msgstr "" -#: howto/logging.rst:834 +#: howto/logging.rst:879 msgid "40" msgstr "" -#: howto/logging.rst:836 +#: howto/logging.rst:881 msgid "30" msgstr "" -#: howto/logging.rst:838 +#: howto/logging.rst:883 msgid "20" msgstr "" -#: howto/logging.rst:840 +#: howto/logging.rst:885 msgid "10" msgstr "" -#: howto/logging.rst:842 +#: howto/logging.rst:887 msgid "``NOTSET``" msgstr "" -#: howto/logging.rst:842 +#: howto/logging.rst:887 msgid "0" msgstr "" -#: howto/logging.rst:845 +#: howto/logging.rst:890 msgid "" "Levels can also be associated with loggers, being set either by the " "developer or through loading a saved logging configuration. When a logging " @@ -1057,14 +1307,14 @@ msgid "" "basic mechanism controlling the verbosity of logging output." msgstr "" -#: howto/logging.rst:852 +#: howto/logging.rst:897 msgid "" "Logging messages are encoded as instances of the :class:`~logging.LogRecord` " "class. When a logger decides to actually log an event, a :class:`~logging." "LogRecord` instance is created from the logging message." msgstr "" -#: howto/logging.rst:856 +#: howto/logging.rst:901 msgid "" "Logging messages are subjected to a dispatch mechanism through the use of :" "dfn:`handlers`, which are instances of subclasses of the :class:`Handler` " @@ -1081,7 +1331,7 @@ msgid "" "at which point the passing to ancestor handlers stops)." msgstr "" -#: howto/logging.rst:870 +#: howto/logging.rst:915 msgid "" "Just as for loggers, handlers can have levels associated with them. A " "handler's level acts as a filter in the same way as a logger's level does. " @@ -1091,11 +1341,11 @@ msgid "" "`~Handler.emit`." msgstr "" -#: howto/logging.rst:879 +#: howto/logging.rst:924 msgid "Custom Levels" msgstr "" -#: howto/logging.rst:881 +#: howto/logging.rst:926 msgid "" "Defining your own levels is possible, but should not be necessary, as the " "existing levels have been chosen on the basis of practical experience. " @@ -1108,27 +1358,27 @@ msgid "" "given numeric value might mean different things for different libraries." msgstr "" -#: howto/logging.rst:894 +#: howto/logging.rst:939 msgid "Useful Handlers" msgstr "" -#: howto/logging.rst:896 +#: howto/logging.rst:941 msgid "" "In addition to the base :class:`Handler` class, many useful subclasses are " "provided:" msgstr "" -#: howto/logging.rst:899 +#: howto/logging.rst:944 msgid "" ":class:`StreamHandler` instances send messages to streams (file-like " "objects)." msgstr "" -#: howto/logging.rst:902 +#: howto/logging.rst:947 msgid ":class:`FileHandler` instances send messages to disk files." msgstr "" -#: howto/logging.rst:904 +#: howto/logging.rst:949 msgid "" ":class:`~handlers.BaseRotatingHandler` is the base class for handlers that " "rotate log files at a certain point. It is not meant to be instantiated " @@ -1136,61 +1386,61 @@ msgid "" "`~handlers.TimedRotatingFileHandler`." msgstr "" -#: howto/logging.rst:909 +#: howto/logging.rst:954 msgid "" ":class:`~handlers.RotatingFileHandler` instances send messages to disk " "files, with support for maximum log file sizes and log file rotation." msgstr "" -#: howto/logging.rst:912 +#: howto/logging.rst:957 msgid "" ":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk " "files, rotating the log file at certain timed intervals." msgstr "" -#: howto/logging.rst:915 +#: howto/logging.rst:960 msgid "" ":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: howto/logging.rst:918 +#: howto/logging.rst:963 msgid "" ":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: howto/logging.rst:921 +#: howto/logging.rst:966 msgid "" ":class:`~handlers.SMTPHandler` instances send messages to a designated email " "address." msgstr "" -#: howto/logging.rst:924 +#: howto/logging.rst:969 msgid "" ":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog " "daemon, possibly on a remote machine." msgstr "" -#: howto/logging.rst:927 +#: howto/logging.rst:972 msgid "" ":class:`~handlers.NTEventLogHandler` instances send messages to a Windows " "NT/2000/XP event log." msgstr "" -#: howto/logging.rst:930 +#: howto/logging.rst:975 msgid "" ":class:`~handlers.MemoryHandler` instances send messages to a buffer in " "memory, which is flushed whenever specific criteria are met." msgstr "" -#: howto/logging.rst:933 +#: howto/logging.rst:978 msgid "" ":class:`~handlers.HTTPHandler` instances send messages to an HTTP server " "using either ``GET`` or ``POST`` semantics." msgstr "" -#: howto/logging.rst:936 +#: howto/logging.rst:981 msgid "" ":class:`~handlers.WatchedFileHandler` instances watch the file they are " "logging to. If the file changes, it is closed and reopened using the file " @@ -1198,13 +1448,13 @@ msgid "" "support the underlying mechanism used." msgstr "" -#: howto/logging.rst:941 +#: howto/logging.rst:986 msgid "" ":class:`~handlers.QueueHandler` instances send messages to a queue, such as " "those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -#: howto/logging.rst:944 +#: howto/logging.rst:989 msgid "" ":class:`NullHandler` instances do nothing with error messages. They are used " "by library developers who want to use logging, but want to avoid the 'No " @@ -1213,15 +1463,15 @@ msgid "" "more information." msgstr "" -#: howto/logging.rst:950 +#: howto/logging.rst:995 msgid "The :class:`NullHandler` class." msgstr "" -#: howto/logging.rst:953 +#: howto/logging.rst:998 msgid "The :class:`~handlers.QueueHandler` class." msgstr "" -#: howto/logging.rst:956 +#: howto/logging.rst:1001 msgid "" "The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler` " "classes are defined in the core logging package. The other handlers are " @@ -1229,14 +1479,14 @@ msgid "" "module, :mod:`logging.config`, for configuration functionality.)" msgstr "" -#: howto/logging.rst:961 +#: howto/logging.rst:1006 msgid "" "Logged messages are formatted for presentation through instances of the :" "class:`Formatter` class. They are initialized with a format string suitable " "for use with the % operator and a dictionary." msgstr "" -#: howto/logging.rst:965 +#: howto/logging.rst:1010 msgid "" "For formatting multiple messages in a batch, instances of :class:" "`BufferingFormatter` can be used. In addition to the format string (which is " @@ -1244,7 +1494,7 @@ msgid "" "trailer format strings." msgstr "" -#: howto/logging.rst:970 +#: howto/logging.rst:1015 msgid "" "When filtering based on logger level and/or handler level is not enough, " "instances of :class:`Filter` can be added to both :class:`Logger` and :class:" @@ -1254,18 +1504,18 @@ msgid "" "value, the message is not processed further." msgstr "" -#: howto/logging.rst:977 +#: howto/logging.rst:1022 msgid "" "The basic :class:`Filter` functionality allows filtering by specific logger " "name. If this feature is used, messages sent to the named logger and its " "children are allowed through the filter, and all others dropped." msgstr "" -#: howto/logging.rst:985 +#: howto/logging.rst:1030 msgid "Exceptions raised during logging" msgstr "" -#: howto/logging.rst:987 +#: howto/logging.rst:1032 msgid "" "The logging package is designed to swallow exceptions which occur while " "logging in production. This is so that errors which occur while handling " @@ -1273,7 +1523,7 @@ msgid "" "errors - do not cause the application using logging to terminate prematurely." msgstr "" -#: howto/logging.rst:992 +#: howto/logging.rst:1037 msgid "" ":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never " "swallowed. Other exceptions which occur during the :meth:`~Handler.emit` " @@ -1281,7 +1531,7 @@ msgid "" "handleError` method." msgstr "" -#: howto/logging.rst:997 +#: howto/logging.rst:1042 msgid "" "The default implementation of :meth:`~Handler.handleError` in :class:" "`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, " @@ -1289,7 +1539,7 @@ msgid "" "the exception is swallowed." msgstr "" -#: howto/logging.rst:1003 +#: howto/logging.rst:1048 msgid "" "The default value of :data:`raiseExceptions` is ``True``. This is because " "during development, you typically want to be notified of any exceptions that " @@ -1297,11 +1547,11 @@ msgid "" "production usage." msgstr "" -#: howto/logging.rst:1013 +#: howto/logging.rst:1058 msgid "Using arbitrary objects as messages" msgstr "" -#: howto/logging.rst:1015 +#: howto/logging.rst:1060 msgid "" "In the preceding sections and examples, it has been assumed that the message " "passed when logging the event is a string. However, this is not the only " @@ -1313,11 +1563,11 @@ msgid "" "the wire." msgstr "" -#: howto/logging.rst:1026 +#: howto/logging.rst:1071 msgid "Optimization" msgstr "" -#: howto/logging.rst:1028 +#: howto/logging.rst:1073 msgid "" "Formatting of message arguments is deferred until it cannot be avoided. " "However, computing the arguments passed to the logging method can also be " @@ -1328,13 +1578,20 @@ msgid "" "code like this::" msgstr "" -#: howto/logging.rst:1040 +#: howto/logging.rst:1081 +msgid "" +"if logger.isEnabledFor(logging.DEBUG):\n" +" logger.debug('Message with %s, %s', expensive_func1(),\n" +" expensive_func2())" +msgstr "" + +#: howto/logging.rst:1085 msgid "" "so that if the logger's threshold is set above ``DEBUG``, the calls to " "``expensive_func1`` and ``expensive_func2`` are never made." msgstr "" -#: howto/logging.rst:1043 +#: howto/logging.rst:1088 msgid "" "In some cases, :meth:`~Logger.isEnabledFor` can itself be more expensive " "than you'd like (e.g. for deeply nested loggers where an explicit level is " @@ -1346,7 +1603,7 @@ msgid "" "while the application is running (which is not all that common)." msgstr "" -#: howto/logging.rst:1052 +#: howto/logging.rst:1097 msgid "" "There are other optimizations which can be made for specific applications " "which need more precise control over what logging information is collected. " @@ -1354,94 +1611,94 @@ msgid "" "you don't need:" msgstr "" -#: howto/logging.rst:1058 +#: howto/logging.rst:1103 msgid "What you don't want to collect" msgstr "" -#: howto/logging.rst:1058 +#: howto/logging.rst:1103 msgid "How to avoid collecting it" msgstr "" -#: howto/logging.rst:1060 +#: howto/logging.rst:1105 msgid "Information about where calls were made from." msgstr "" -#: howto/logging.rst:1060 +#: howto/logging.rst:1105 msgid "" "Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys." "_getframe`, which may help to speed up your code in environments like PyPy " "(which can't speed up code that uses :func:`sys._getframe`)." msgstr "" -#: howto/logging.rst:1066 +#: howto/logging.rst:1111 msgid "Threading information." msgstr "" -#: howto/logging.rst:1066 +#: howto/logging.rst:1111 msgid "Set ``logging.logThreads`` to ``False``." msgstr "" -#: howto/logging.rst:1068 +#: howto/logging.rst:1113 msgid "Current process ID (:func:`os.getpid`)" msgstr "" -#: howto/logging.rst:1068 +#: howto/logging.rst:1113 msgid "Set ``logging.logProcesses`` to ``False``." msgstr "" -#: howto/logging.rst:1070 +#: howto/logging.rst:1115 msgid "" "Current process name when using ``multiprocessing`` to manage multiple " "processes." msgstr "" -#: howto/logging.rst:1070 +#: howto/logging.rst:1115 msgid "Set ``logging.logMultiprocessing`` to ``False``." msgstr "" -#: howto/logging.rst:1073 +#: howto/logging.rst:1118 msgid "Current :class:`asyncio.Task` name when using ``asyncio``." msgstr "" -#: howto/logging.rst:1073 +#: howto/logging.rst:1118 msgid "Set ``logging.logAsyncioTasks`` to ``False``." msgstr "" -#: howto/logging.rst:1077 +#: howto/logging.rst:1122 msgid "" "Also note that the core logging module only includes the basic handlers. If " "you don't import :mod:`logging.handlers` and :mod:`logging.config`, they " "won't take up any memory." msgstr "" -#: howto/logging.rst:1084 +#: howto/logging.rst:1129 msgid "Other resources" msgstr "" -#: howto/logging.rst:1089 +#: howto/logging.rst:1133 msgid "Module :mod:`logging`" msgstr "" -#: howto/logging.rst:1089 +#: howto/logging.rst:1134 msgid "API reference for the logging module." msgstr "" -#: howto/logging.rst:1092 +#: howto/logging.rst:1136 msgid "Module :mod:`logging.config`" msgstr "" -#: howto/logging.rst:1092 +#: howto/logging.rst:1137 msgid "Configuration API for the logging module." msgstr "" -#: howto/logging.rst:1095 +#: howto/logging.rst:1139 msgid "Module :mod:`logging.handlers`" msgstr "" -#: howto/logging.rst:1095 +#: howto/logging.rst:1140 msgid "Useful handlers included with the logging module." msgstr "" -#: howto/logging.rst:1097 +#: howto/logging.rst:1142 msgid ":ref:`A logging cookbook `" msgstr "" diff --git a/howto/mro.po b/howto/mro.po new file mode 100644 index 00000000..1105e208 --- /dev/null +++ b/howto/mro.po @@ -0,0 +1,905 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: howto/mro.rst:4 +msgid "The Python 2.3 Method Resolution Order" +msgstr "" + +#: howto/mro.rst:8 +msgid "" +"This is a historical document, provided as an appendix to the official " +"documentation. The Method Resolution Order discussed here was *introduced* " +"in Python 2.3, but it is still used in later versions -- including Python 3." +msgstr "" + +#: howto/mro.rst:13 +msgid "By `Michele Simionato `__." +msgstr "" + +#: howto/mro.rst:0 +msgid "Abstract" +msgstr "" + +#: howto/mro.rst:17 +msgid "" +"*This document is intended for Python programmers who want to understand the " +"C3 Method Resolution Order used in Python 2.3. Although it is not intended " +"for newbies, it is quite pedagogical with many worked out examples. I am " +"not aware of other publicly available documents with the same scope, " +"therefore it should be useful.*" +msgstr "" + +#: howto/mro.rst:23 +msgid "Disclaimer:" +msgstr "" + +#: howto/mro.rst:25 +msgid "" +"*I donate this document to the Python Software Foundation, under the Python " +"2.3 license. As usual in these circumstances, I warn the reader that what " +"follows* should *be correct, but I don't give any warranty. Use it at your " +"own risk and peril!*" +msgstr "" + +#: howto/mro.rst:30 +msgid "Acknowledgments:" +msgstr "" + +#: howto/mro.rst:32 +msgid "" +"*All the people of the Python mailing list who sent me their support. Paul " +"Foley who pointed out various imprecisions and made me to add the part on " +"local precedence ordering. David Goodger for help with the formatting in " +"reStructuredText. David Mertz for help with the editing. Finally, Guido van " +"Rossum who enthusiastically added this document to the official Python 2.3 " +"home-page.*" +msgstr "" + +#: howto/mro.rst:40 +msgid "The beginning" +msgstr "" + +#: howto/mro.rst:42 +msgid "*Felix qui potuit rerum cognoscere causas* -- Virgilius" +msgstr "" + +#: howto/mro.rst:44 +msgid "" +"Everything started with a post by Samuele Pedroni to the Python development " +"mailing list [#]_. In his post, Samuele showed that the Python 2.2 method " +"resolution order is not monotonic and he proposed to replace it with the C3 " +"method resolution order. Guido agreed with his arguments and therefore now " +"Python 2.3 uses C3. The C3 method itself has nothing to do with Python, " +"since it was invented by people working on Dylan and it is described in a " +"paper intended for lispers [#]_. The present paper gives a (hopefully) " +"readable discussion of the C3 algorithm for Pythonistas who want to " +"understand the reasons for the change." +msgstr "" + +#: howto/mro.rst:55 +msgid "" +"First of all, let me point out that what I am going to say only applies to " +"the *new style classes* introduced in Python 2.2: *classic classes* " +"maintain their old method resolution order, depth first and then left to " +"right. Therefore, there is no breaking of old code for classic classes; and " +"even if in principle there could be breaking of code for Python 2.2 new " +"style classes, in practice the cases in which the C3 resolution order " +"differs from the Python 2.2 method resolution order are so rare that no real " +"breaking of code is expected. Therefore:" +msgstr "" + +#: howto/mro.rst:64 +msgid "*Don't be scared!*" +msgstr "" + +#: howto/mro.rst:66 +msgid "" +"Moreover, unless you make strong use of multiple inheritance and you have " +"non-trivial hierarchies, you don't need to understand the C3 algorithm, and " +"you can easily skip this paper. On the other hand, if you really want to " +"know how multiple inheritance works, then this paper is for you. The good " +"news is that things are not as complicated as you might expect." +msgstr "" + +#: howto/mro.rst:73 +msgid "Let me begin with some basic definitions." +msgstr "" + +#: howto/mro.rst:75 +msgid "" +"Given a class C in a complicated multiple inheritance hierarchy, it is a non-" +"trivial task to specify the order in which methods are overridden, i.e. to " +"specify the order of the ancestors of C." +msgstr "" + +#: howto/mro.rst:79 +msgid "" +"The list of the ancestors of a class C, including the class itself, ordered " +"from the nearest ancestor to the furthest, is called the class precedence " +"list or the *linearization* of C." +msgstr "" + +#: howto/mro.rst:83 +msgid "" +"The *Method Resolution Order* (MRO) is the set of rules that construct the " +"linearization. In the Python literature, the idiom \"the MRO of C\" is also " +"used as a synonymous for the linearization of the class C." +msgstr "" + +#: howto/mro.rst:88 +msgid "" +"For instance, in the case of single inheritance hierarchy, if C is a " +"subclass of C1, and C1 is a subclass of C2, then the linearization of C is " +"simply the list [C, C1 , C2]. However, with multiple inheritance " +"hierarchies, the construction of the linearization is more cumbersome, since " +"it is more difficult to construct a linearization that respects *local " +"precedence ordering* and *monotonicity*." +msgstr "" + +#: howto/mro.rst:96 +msgid "" +"I will discuss the local precedence ordering later, but I can give the " +"definition of monotonicity here. A MRO is monotonic when the following is " +"true: *if C1 precedes C2 in the linearization of C, then C1 precedes C2 in " +"the linearization of any subclass of C*. Otherwise, the innocuous operation " +"of deriving a new class could change the resolution order of methods, " +"potentially introducing very subtle bugs. Examples where this happens will " +"be shown later." +msgstr "" + +#: howto/mro.rst:104 +msgid "" +"Not all classes admit a linearization. There are cases, in complicated " +"hierarchies, where it is not possible to derive a class such that its " +"linearization respects all the desired properties." +msgstr "" + +#: howto/mro.rst:108 +msgid "Here I give an example of this situation. Consider the hierarchy" +msgstr "" + +#: howto/mro.rst:116 +msgid "" +"which can be represented with the following inheritance graph, where I have " +"denoted with O the ``object`` class, which is the beginning of any hierarchy " +"for new style classes:" +msgstr "" + +#: howto/mro.rst:120 +msgid "" +" -----------\n" +"| |\n" +"| O |\n" +"| / \\ |\n" +" - X Y /\n" +" | / | /\n" +" | / |/\n" +" A B\n" +" \\ /\n" +" ?" +msgstr "" + +#: howto/mro.rst:133 +msgid "" +"In this case, it is not possible to derive a new class C from A and B, since " +"X precedes Y in A, but Y precedes X in B, therefore the method resolution " +"order would be ambiguous in C." +msgstr "" + +#: howto/mro.rst:137 +msgid "" +"Python 2.3 raises an exception in this situation (TypeError: MRO conflict " +"among bases Y, X) forbidding the naive programmer from creating ambiguous " +"hierarchies. Python 2.2 instead does not raise an exception, but chooses an " +"*ad hoc* ordering (CABXYO in this case)." +msgstr "" + +#: howto/mro.rst:143 +msgid "The C3 Method Resolution Order" +msgstr "" + +#: howto/mro.rst:145 +msgid "" +"Let me introduce a few simple notations which will be useful for the " +"following discussion. I will use the shortcut notation::" +msgstr "" + +#: howto/mro.rst:148 +msgid "C1 C2 ... CN" +msgstr "" + +#: howto/mro.rst:150 +msgid "to indicate the list of classes [C1, C2, ... , CN]." +msgstr "" + +#: howto/mro.rst:152 +msgid "The *head* of the list is its first element::" +msgstr "" + +#: howto/mro.rst:154 +msgid "head = C1" +msgstr "" + +#: howto/mro.rst:156 +msgid "whereas the *tail* is the rest of the list::" +msgstr "" + +#: howto/mro.rst:158 +msgid "tail = C2 ... CN." +msgstr "" + +#: howto/mro.rst:160 +msgid "I shall also use the notation::" +msgstr "" + +#: howto/mro.rst:162 +msgid "C + (C1 C2 ... CN) = C C1 C2 ... CN" +msgstr "" + +#: howto/mro.rst:164 +msgid "to denote the sum of the lists [C] + [C1, C2, ... ,CN]." +msgstr "" + +#: howto/mro.rst:166 +msgid "Now I can explain how the MRO works in Python 2.3." +msgstr "" + +#: howto/mro.rst:168 +msgid "" +"Consider a class C in a multiple inheritance hierarchy, with C inheriting " +"from the base classes B1, B2, ... , BN. We want to compute the " +"linearization L[C] of the class C. The rule is the following:" +msgstr "" + +#: howto/mro.rst:173 +msgid "" +"*the linearization of C is the sum of C plus the merge of the linearizations " +"of the parents and the list of the parents.*" +msgstr "" + +#: howto/mro.rst:176 +msgid "In symbolic notation::" +msgstr "" + +#: howto/mro.rst:178 +msgid "L[C(B1 ... BN)] = C + merge(L[B1] ... L[BN], B1 ... BN)" +msgstr "" + +#: howto/mro.rst:180 +msgid "" +"In particular, if C is the ``object`` class, which has no parents, the " +"linearization is trivial::" +msgstr "" + +#: howto/mro.rst:183 +msgid "L[object] = object." +msgstr "" + +#: howto/mro.rst:185 +msgid "" +"However, in general one has to compute the merge according to the following " +"prescription:" +msgstr "" + +#: howto/mro.rst:188 +msgid "" +"*take the head of the first list, i.e L[B1][0]; if this head is not in the " +"tail of any of the other lists, then add it to the linearization of C and " +"remove it from the lists in the merge, otherwise look at the head of the " +"next list and take it, if it is a good head. Then repeat the operation " +"until all the class are removed or it is impossible to find good heads. In " +"this case, it is impossible to construct the merge, Python 2.3 will refuse " +"to create the class C and will raise an exception.*" +msgstr "" + +#: howto/mro.rst:197 +msgid "" +"This prescription ensures that the merge operation *preserves* the ordering, " +"if the ordering can be preserved. On the other hand, if the order cannot be " +"preserved (as in the example of serious order disagreement discussed above) " +"then the merge cannot be computed." +msgstr "" + +#: howto/mro.rst:202 +msgid "" +"The computation of the merge is trivial if C has only one parent (single " +"inheritance); in this case::" +msgstr "" + +#: howto/mro.rst:205 +msgid "L[C(B)] = C + merge(L[B],B) = C + L[B]" +msgstr "" + +#: howto/mro.rst:207 +msgid "" +"However, in the case of multiple inheritance things are more cumbersome and " +"I don't expect you can understand the rule without a couple of examples ;-)" +msgstr "" + +#: howto/mro.rst:212 +msgid "Examples" +msgstr "" + +#: howto/mro.rst:214 +msgid "First example. Consider the following hierarchy:" +msgstr "" + +#: howto/mro.rst:224 +msgid "In this case the inheritance graph can be drawn as:" +msgstr "" + +#: howto/mro.rst:226 +msgid "" +" 6\n" +" ---\n" +"Level 3 | O | (more general)\n" +" / --- \\\n" +" / | \\ |\n" +" / | \\ |\n" +" / | \\ |\n" +" --- --- --- |\n" +"Level 2 3 | D | 4| E | | F | 5 |\n" +" --- --- --- |\n" +" \\ \\ _ / | |\n" +" \\ / \\ _ | |\n" +" \\ / \\ | |\n" +" --- --- |\n" +"Level 1 1 | B | | C | 2 |\n" +" --- --- |\n" +" \\ / |\n" +" \\ / \\ /\n" +" ---\n" +"Level 0 0 | A | (more specialized)\n" +" ---" +msgstr "" + +#: howto/mro.rst:251 +msgid "The linearizations of O,D,E and F are trivial::" +msgstr "" + +#: howto/mro.rst:253 +msgid "" +"L[O] = O\n" +"L[D] = D O\n" +"L[E] = E O\n" +"L[F] = F O" +msgstr "" + +#: howto/mro.rst:258 +msgid "The linearization of B can be computed as::" +msgstr "" + +#: howto/mro.rst:260 +msgid "L[B] = B + merge(DO, EO, DE)" +msgstr "" + +#: howto/mro.rst:262 +msgid "" +"We see that D is a good head, therefore we take it and we are reduced to " +"compute ``merge(O,EO,E)``. Now O is not a good head, since it is in the " +"tail of the sequence EO. In this case the rule says that we have to skip to " +"the next sequence. Then we see that E is a good head; we take it and we are " +"reduced to compute ``merge(O,O)`` which gives O. Therefore::" +msgstr "" + +#: howto/mro.rst:268 +msgid "L[B] = B D E O" +msgstr "" + +#: howto/mro.rst:270 +msgid "Using the same procedure one finds::" +msgstr "" + +#: howto/mro.rst:272 +msgid "" +"L[C] = C + merge(DO,FO,DF)\n" +" = C + D + merge(O,FO,F)\n" +" = C + D + F + merge(O,O)\n" +" = C D F O" +msgstr "" + +#: howto/mro.rst:277 +msgid "Now we can compute::" +msgstr "" + +#: howto/mro.rst:279 +msgid "" +"L[A] = A + merge(BDEO,CDFO,BC)\n" +" = A + B + merge(DEO,CDFO,C)\n" +" = A + B + C + merge(DEO,DFO)\n" +" = A + B + C + D + merge(EO,FO)\n" +" = A + B + C + D + E + merge(O,FO)\n" +" = A + B + C + D + E + F + merge(O,O)\n" +" = A B C D E F O" +msgstr "" + +#: howto/mro.rst:287 +msgid "" +"In this example, the linearization is ordered in a pretty nice way according " +"to the inheritance level, in the sense that lower levels (i.e. more " +"specialized classes) have higher precedence (see the inheritance graph). " +"However, this is not the general case." +msgstr "" + +#: howto/mro.rst:292 +msgid "" +"I leave as an exercise for the reader to compute the linearization for my " +"second example:" +msgstr "" + +#: howto/mro.rst:303 +msgid "" +"The only difference with the previous example is the change B(D,E) --> B(E," +"D); however even such a little modification completely changes the ordering " +"of the hierarchy:" +msgstr "" + +#: howto/mro.rst:307 +msgid "" +" 6\n" +" ---\n" +"Level 3 | O |\n" +" / --- \\\n" +" / | \\\n" +" / | \\\n" +" / | \\\n" +" --- --- ---\n" +"Level 2 2 | E | 4 | D | | F | 5\n" +" --- --- ---\n" +" \\ / \\ /\n" +" \\ / \\ /\n" +" \\ / \\ /\n" +" --- ---\n" +"Level 1 1 | B | | C | 3\n" +" --- ---\n" +" \\ /\n" +" \\ /\n" +" ---\n" +"Level 0 0 | A |\n" +" ---" +msgstr "" + +#: howto/mro.rst:332 +msgid "" +"Notice that the class E, which is in the second level of the hierarchy, " +"precedes the class C, which is in the first level of the hierarchy, i.e. E " +"is more specialized than C, even if it is in a higher level." +msgstr "" + +#: howto/mro.rst:336 +msgid "" +"A lazy programmer can obtain the MRO directly from Python 2.2, since in this " +"case it coincides with the Python 2.3 linearization. It is enough to invoke " +"the :meth:`~type.mro` method of class A:" +msgstr "" + +#: howto/mro.rst:345 +msgid "" +"Finally, let me consider the example discussed in the first section, " +"involving a serious order disagreement. In this case, it is straightforward " +"to compute the linearizations of O, X, Y, A and B:" +msgstr "" + +#: howto/mro.rst:349 +msgid "" +"L[O] = 0\n" +"L[X] = X O\n" +"L[Y] = Y O\n" +"L[A] = A X Y O\n" +"L[B] = B Y X O" +msgstr "" + +#: howto/mro.rst:357 +msgid "" +"However, it is impossible to compute the linearization for a class C that " +"inherits from A and B::" +msgstr "" + +#: howto/mro.rst:360 +msgid "" +"L[C] = C + merge(AXYO, BYXO, AB)\n" +" = C + A + merge(XYO, BYXO, B)\n" +" = C + A + B + merge(XYO, YXO)" +msgstr "" + +#: howto/mro.rst:364 +msgid "" +"At this point we cannot merge the lists XYO and YXO, since X is in the tail " +"of YXO whereas Y is in the tail of XYO: therefore there are no good heads " +"and the C3 algorithm stops. Python 2.3 raises an error and refuses to " +"create the class C." +msgstr "" + +#: howto/mro.rst:370 +msgid "Bad Method Resolution Orders" +msgstr "" + +#: howto/mro.rst:372 +msgid "" +"A MRO is *bad* when it breaks such fundamental properties as local " +"precedence ordering and monotonicity. In this section, I will show that " +"both the MRO for classic classes and the MRO for new style classes in Python " +"2.2 are bad." +msgstr "" + +#: howto/mro.rst:377 +msgid "" +"It is easier to start with the local precedence ordering. Consider the " +"following example:" +msgstr "" + +#: howto/mro.rst:384 +msgid "with inheritance diagram" +msgstr "" + +#: howto/mro.rst:386 +msgid "" +" O\n" +" |\n" +"(buy spam) F\n" +" | \\\n" +" | E (buy eggs)\n" +" | /\n" +" G\n" +"\n" +" (buy eggs or spam ?)" +msgstr "" + +#: howto/mro.rst:399 +msgid "" +"We see that class G inherits from F and E, with F *before* E: therefore we " +"would expect the attribute *G.remember2buy* to be inherited by *F." +"remember2buy* and not by *E.remember2buy*: nevertheless Python 2.2 gives" +msgstr "" + +#: howto/mro.rst:407 +msgid "" +"This is a breaking of local precedence ordering since the order in the local " +"precedence list, i.e. the list of the parents of G, is not preserved in the " +"Python 2.2 linearization of G::" +msgstr "" + +#: howto/mro.rst:411 +msgid "L[G,P22]= G E F object # F *follows* E" +msgstr "" + +#: howto/mro.rst:413 +msgid "" +"One could argue that the reason why F follows E in the Python 2.2 " +"linearization is that F is less specialized than E, since F is the " +"superclass of E; nevertheless the breaking of local precedence ordering is " +"quite non-intuitive and error prone. This is particularly true since it is " +"a different from old style classes:" +msgstr "" + +#: howto/mro.rst:425 +msgid "" +"In this case the MRO is GFEF and the local precedence ordering is preserved." +msgstr "" + +#: howto/mro.rst:428 +msgid "" +"As a general rule, hierarchies such as the previous one should be avoided, " +"since it is unclear if F should override E or vice-versa. Python 2.3 solves " +"the ambiguity by raising an exception in the creation of class G, " +"effectively stopping the programmer from generating ambiguous hierarchies. " +"The reason for that is that the C3 algorithm fails when the merge::" +msgstr "" + +#: howto/mro.rst:435 +msgid "merge(FO,EFO,FE)" +msgstr "" + +#: howto/mro.rst:437 +msgid "" +"cannot be computed, because F is in the tail of EFO and E is in the tail of " +"FE." +msgstr "" + +#: howto/mro.rst:440 +msgid "" +"The real solution is to design a non-ambiguous hierarchy, i.e. to derive G " +"from E and F (the more specific first) and not from F and E; in this case " +"the MRO is GEF without any doubt." +msgstr "" + +#: howto/mro.rst:444 +msgid "" +" O\n" +" |\n" +" F (spam)\n" +" / |\n" +"(eggs) E |\n" +" \\ |\n" +" G\n" +" (eggs, no doubt)" +msgstr "" + +#: howto/mro.rst:456 +msgid "" +"Python 2.3 forces the programmer to write good hierarchies (or, at least, " +"less error-prone ones)." +msgstr "" + +#: howto/mro.rst:459 +msgid "" +"On a related note, let me point out that the Python 2.3 algorithm is smart " +"enough to recognize obvious mistakes, as the duplication of classes in the " +"list of parents:" +msgstr "" + +#: howto/mro.rst:469 +msgid "" +"Python 2.2 (both for classic classes and new style classes) in this " +"situation, would not raise any exception." +msgstr "" + +#: howto/mro.rst:472 +msgid "" +"Finally, I would like to point out two lessons we have learned from this " +"example:" +msgstr "" + +#: howto/mro.rst:475 +msgid "" +"despite the name, the MRO determines the resolution order of attributes, not " +"only of methods;" +msgstr "" + +#: howto/mro.rst:478 +msgid "" +"the default food for Pythonistas is spam ! (but you already knew that ;-)" +msgstr "" + +#: howto/mro.rst:481 +msgid "" +"Having discussed the issue of local precedence ordering, let me now consider " +"the issue of monotonicity. My goal is to show that neither the MRO for " +"classic classes nor that for Python 2.2 new style classes is monotonic." +msgstr "" + +#: howto/mro.rst:486 +msgid "" +"To prove that the MRO for classic classes is non-monotonic is rather " +"trivial, it is enough to look at the diamond diagram:" +msgstr "" + +#: howto/mro.rst:489 +msgid "" +" C\n" +" / \\\n" +" / \\\n" +"A B\n" +" \\ /\n" +" \\ /\n" +" D" +msgstr "" + +#: howto/mro.rst:500 +msgid "One easily discerns the inconsistency::" +msgstr "" + +#: howto/mro.rst:502 +msgid "" +"L[B,P21] = B C # B precedes C : B's methods win\n" +"L[D,P21] = D A C B C # B follows C : C's methods win!" +msgstr "" + +#: howto/mro.rst:505 +msgid "" +"On the other hand, there are no problems with the Python 2.2 and 2.3 MROs, " +"they give both::" +msgstr "" + +#: howto/mro.rst:508 +msgid "L[D] = D A B C" +msgstr "" + +#: howto/mro.rst:510 +msgid "" +"Guido points out in his essay [#]_ that the classic MRO is not so bad in " +"practice, since one can typically avoids diamonds for classic classes. But " +"all new style classes inherit from ``object``, therefore diamonds are " +"unavoidable and inconsistencies shows up in every multiple inheritance graph." +msgstr "" + +#: howto/mro.rst:516 +msgid "" +"The MRO of Python 2.2 makes breaking monotonicity difficult, but not " +"impossible. The following example, originally provided by Samuele Pedroni, " +"shows that the MRO of Python 2.2 is non-monotonic:" +msgstr "" + +#: howto/mro.rst:530 +msgid "" +"Here are the linearizations according to the C3 MRO (the reader should " +"verify these linearizations as an exercise and draw the inheritance " +"diagram ;-) ::" +msgstr "" + +#: howto/mro.rst:534 +msgid "" +"L[A] = A O\n" +"L[B] = B O\n" +"L[C] = C O\n" +"L[D] = D O\n" +"L[E] = E O\n" +"L[K1]= K1 A B C O\n" +"L[K2]= K2 D B E O\n" +"L[K3]= K3 D A O\n" +"L[Z] = Z K1 K2 K3 D A B C E O" +msgstr "" + +#: howto/mro.rst:544 +msgid "" +"Python 2.2 gives exactly the same linearizations for A, B, C, D, E, K1, K2 " +"and K3, but a different linearization for Z::" +msgstr "" + +#: howto/mro.rst:547 +msgid "L[Z,P22] = Z K1 K3 A K2 D B C E O" +msgstr "" + +#: howto/mro.rst:549 +msgid "" +"It is clear that this linearization is *wrong*, since A comes before D " +"whereas in the linearization of K3 A comes *after* D. In other words, in K3 " +"methods derived by D override methods derived by A, but in Z, which still is " +"a subclass of K3, methods derived by A override methods derived by D! This " +"is a violation of monotonicity. Moreover, the Python 2.2 linearization of Z " +"is also inconsistent with local precedence ordering, since the local " +"precedence list of the class Z is [K1, K2, K3] (K2 precedes K3), whereas in " +"the linearization of Z K2 *follows* K3. These problems explain why the 2.2 " +"rule has been dismissed in favor of the C3 rule." +msgstr "" + +#: howto/mro.rst:561 +msgid "The end" +msgstr "" + +#: howto/mro.rst:563 +msgid "" +"This section is for the impatient reader, who skipped all the previous " +"sections and jumped immediately to the end. This section is for the lazy " +"programmer too, who didn't want to exercise her/his brain. Finally, it is " +"for the programmer with some hubris, otherwise s/he would not be reading a " +"paper on the C3 method resolution order in multiple inheritance " +"hierarchies ;-) These three virtues taken all together (and *not* " +"separately) deserve a prize: the prize is a short Python 2.2 script that " +"allows you to compute the 2.3 MRO without risk to your brain. Simply change " +"the last line to play with the various examples I have discussed in this " +"paper.::" +msgstr "" + +#: howto/mro.rst:574 +msgid "" +"#\n" +"\n" +"\"\"\"C3 algorithm by Samuele Pedroni (with readability enhanced by me)." +"\"\"\"\n" +"\n" +"class __metaclass__(type):\n" +" \"All classes are metamagically modified to be nicely printed\"\n" +" __repr__ = lambda cls: cls.__name__\n" +"\n" +"class ex_2:\n" +" \"Serious order disagreement\" #From Guido\n" +" class O: pass\n" +" class X(O): pass\n" +" class Y(O): pass\n" +" class A(X,Y): pass\n" +" class B(Y,X): pass\n" +" try:\n" +" class Z(A,B): pass #creates Z(A,B) in Python 2.2\n" +" except TypeError:\n" +" pass # Z(A,B) cannot be created in Python 2.3\n" +"\n" +"class ex_5:\n" +" \"My first example\"\n" +" class O: pass\n" +" class F(O): pass\n" +" class E(O): pass\n" +" class D(O): pass\n" +" class C(D,F): pass\n" +" class B(D,E): pass\n" +" class A(B,C): pass\n" +"\n" +"class ex_6:\n" +" \"My second example\"\n" +" class O: pass\n" +" class F(O): pass\n" +" class E(O): pass\n" +" class D(O): pass\n" +" class C(D,F): pass\n" +" class B(E,D): pass\n" +" class A(B,C): pass\n" +"\n" +"class ex_9:\n" +" \"Difference between Python 2.2 MRO and C3\" #From Samuele\n" +" class O: pass\n" +" class A(O): pass\n" +" class B(O): pass\n" +" class C(O): pass\n" +" class D(O): pass\n" +" class E(O): pass\n" +" class K1(A,B,C): pass\n" +" class K2(D,B,E): pass\n" +" class K3(D,A): pass\n" +" class Z(K1,K2,K3): pass\n" +"\n" +"def merge(seqs):\n" +" print '\\n\\nCPL[%s]=%s' % (seqs[0][0],seqs),\n" +" res = []; i=0\n" +" while 1:\n" +" nonemptyseqs=[seq for seq in seqs if seq]\n" +" if not nonemptyseqs: return res\n" +" i+=1; print '\\n',i,'round: candidates...',\n" +" for seq in nonemptyseqs: # find merge candidates among seq heads\n" +" cand = seq[0]; print ' ',cand,\n" +" nothead=[s for s in nonemptyseqs if cand in s[1:]]\n" +" if nothead: cand=None #reject candidate\n" +" else: break\n" +" if not cand: raise \"Inconsistent hierarchy\"\n" +" res.append(cand)\n" +" for seq in nonemptyseqs: # remove cand\n" +" if seq[0] == cand: del seq[0]\n" +"\n" +"def mro(C):\n" +" \"Compute the class precedence list (mro) according to C3\"\n" +" return merge([[C]]+map(mro,C.__bases__)+[list(C.__bases__)])\n" +"\n" +"def print_mro(C):\n" +" print '\\nMRO[%s]=%s' % (C,mro(C))\n" +" print '\\nP22 MRO[%s]=%s' % (C,C.mro())\n" +"\n" +"print_mro(ex_9.Z)\n" +"\n" +"#" +msgstr "" + +#: howto/mro.rst:656 +msgid "That's all folks," +msgstr "" + +#: howto/mro.rst:658 +msgid "enjoy !" +msgstr "" + +#: howto/mro.rst:662 +msgid "Resources" +msgstr "" + +#: howto/mro.rst:664 +msgid "" +"The thread on python-dev started by Samuele Pedroni: https://mail.python.org/" +"pipermail/python-dev/2002-October/029035.html" +msgstr "" + +#: howto/mro.rst:667 +msgid "" +"The paper *A Monotonic Superclass Linearization for Dylan*: https://doi." +"org/10.1145/236337.236343" +msgstr "" + +#: howto/mro.rst:670 +msgid "" +"Guido van Rossum's essay, *Unifying types and classes in Python 2.2*: " +"https://web.archive.org/web/20140210194412/http://www.python.org/download/" +"releases/2.2.2/descrintro" +msgstr "" diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 278d4227..ae48b50b 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -67,14 +68,92 @@ msgstr "" msgid "For example, consider the following script:" msgstr "" +#: howto/perf_profiling.rst:38 +msgid "" +"def foo(n):\n" +" result = 0\n" +" for _ in range(n):\n" +" result += 1\n" +" return result\n" +"\n" +"def bar(n):\n" +" foo(n)\n" +"\n" +"def baz(n):\n" +" bar(n)\n" +"\n" +"if __name__ == \"__main__\":\n" +" baz(1000000)" +msgstr "" + #: howto/perf_profiling.rst:55 msgid "We can run ``perf`` to sample CPU stack traces at 9999 hertz::" msgstr "" +#: howto/perf_profiling.rst:57 +msgid "$ perf record -F 9999 -g -o perf.data python my_script.py" +msgstr "" + #: howto/perf_profiling.rst:59 msgid "Then we can use ``perf report`` to analyze the data:" msgstr "" +#: howto/perf_profiling.rst:61 +msgid "" +"$ perf report --stdio -n -g\n" +"\n" +"# Children Self Samples Command Shared Object Symbol\n" +"# ........ ........ ............ .......... .................. ..........................................\n" +"#\n" +" 91.08% 0.00% 0 python.exe python.exe [.] " +"_start\n" +" |\n" +" ---_start\n" +" |\n" +" --90.71%--__libc_start_main\n" +" Py_BytesMain\n" +" |\n" +" |--56.88%--pymain_run_python.constprop.0\n" +" | |\n" +" | |--56.13%--_PyRun_AnyFileObject\n" +" | | _PyRun_SimpleFileObject\n" +" | | |\n" +" | | |--55.02%--run_mod\n" +" | | | |\n" +" | | | --54.65%--" +"PyEval_EvalCode\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | |\n" +" | | | " +"|--51.67%--_PyEval_EvalFrameDefault\n" +" | | | " +"| |\n" +" | | | " +"| |--11.52%--_PyLong_Add\n" +" | | | " +"| | |\n" +" | | | " +"| | |--2.97%--_PyObject_Malloc\n" +"..." +msgstr "" + #: howto/perf_profiling.rst:100 msgid "" "As you can see, the Python functions are not shown in the output, only " @@ -89,6 +168,69 @@ msgid "" "Instead, if we run the same experiment with ``perf`` support enabled we get:" msgstr "" +#: howto/perf_profiling.rst:107 +msgid "" +"$ perf report --stdio -n -g\n" +"\n" +"# Children Self Samples Command Shared Object Symbol\n" +"# ........ ........ ............ .......... .................. .....................................................................\n" +"#\n" +" 90.58% 0.36% 1 python.exe python.exe [.] " +"_start\n" +" |\n" +" ---_start\n" +" |\n" +" --89.86%--__libc_start_main\n" +" Py_BytesMain\n" +" |\n" +" |--55.43%--pymain_run_python.constprop.0\n" +" | |\n" +" | |--54.71%--_PyRun_AnyFileObject\n" +" | | _PyRun_SimpleFileObject\n" +" | | |\n" +" | | |--53.62%--run_mod\n" +" | | | |\n" +" | | | --53.26%--" +"PyEval_EvalCode\n" +" | | | py::" +":/src/script.py\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | py::baz:/" +"src/script.py\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | py::bar:/" +"src/script.py\n" +" | | | " +"_PyEval_EvalFrameDefault\n" +" | | | " +"PyObject_Vectorcall\n" +" | | | " +"_PyEval_Vector\n" +" | | | py::foo:/" +"src/script.py\n" +" | | | |\n" +" | | | " +"|--51.81%--_PyEval_EvalFrameDefault\n" +" | | | " +"| |\n" +" | | | " +"| |--13.77%--_PyLong_Add\n" +" | | | " +"| | |\n" +" | | | " +"| | |--3.26%--_PyObject_Malloc" +msgstr "" + #: howto/perf_profiling.rst:152 msgid "How to enable ``perf`` profiling support" msgstr "" @@ -111,18 +253,48 @@ msgstr "" msgid "Example, using the environment variable::" msgstr "" +#: howto/perf_profiling.rst:165 +msgid "" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python my_script." +"py\n" +"$ perf report -g -i perf.data" +msgstr "" + #: howto/perf_profiling.rst:168 msgid "Example, using the :option:`!-X` option::" msgstr "" +#: howto/perf_profiling.rst:170 +msgid "" +"$ perf record -F 9999 -g -o perf.data python -X perf my_script.py\n" +"$ perf report -g -i perf.data" +msgstr "" + #: howto/perf_profiling.rst:173 msgid "Example, using the :mod:`sys` APIs in file :file:`example.py`:" msgstr "" +#: howto/perf_profiling.rst:175 +msgid "" +"import sys\n" +"\n" +"sys.activate_stack_trampoline(\"perf\")\n" +"do_profiled_stuff()\n" +"sys.deactivate_stack_trampoline()\n" +"\n" +"non_profiled_stuff()" +msgstr "" + #: howto/perf_profiling.rst:185 msgid "...then::" msgstr "" +#: howto/perf_profiling.rst:187 +msgid "" +"$ perf record -F 9999 -g -o perf.data python ./example.py\n" +"$ perf report -g -i perf.data" +msgstr "" + #: howto/perf_profiling.rst:192 msgid "How to obtain the best results" msgstr "" @@ -142,9 +314,140 @@ msgid "" "You can check if your system has been compiled with this flag by running::" msgstr "" +#: howto/perf_profiling.rst:203 +msgid "$ python -m sysconfig | grep 'no-omit-frame-pointer'" +msgstr "" + #: howto/perf_profiling.rst:205 msgid "" "If you don't see any output it means that your interpreter has not been " "compiled with frame pointers and therefore it may not be able to show Python " "functions in the output of ``perf``." msgstr "" + +#: howto/perf_profiling.rst:211 +msgid "How to work without frame pointers" +msgstr "" + +#: howto/perf_profiling.rst:213 +msgid "" +"If you are working with a Python interpreter that has been compiled without " +"frame pointers, you can still use the ``perf`` profiler, but the overhead " +"will be a bit higher because Python needs to generate unwinding information " +"for every Python function call on the fly. Additionally, ``perf`` will take " +"more time to process the data because it will need to use the DWARF " +"debugging information to unwind the stack and this is a slow process." +msgstr "" + +#: howto/perf_profiling.rst:220 +msgid "" +"To enable this mode, you can use the environment variable :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which " +"will enable the JIT mode for the ``perf`` profiler." +msgstr "" + +#: howto/perf_profiling.rst:226 +msgid "" +"Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8 " +"will work with the JIT mode. The fix was also backported to the v6.7.2 " +"version of the tool." +msgstr "" + +#: howto/perf_profiling.rst:230 +msgid "" +"Note that when checking the version of the ``perf`` tool (which can be done " +"by running ``perf version``) you must take into account that some distros " +"add some custom version numbers including a ``-`` character. This means " +"that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``." +msgstr "" + +#: howto/perf_profiling.rst:235 +msgid "" +"When using the perf JIT mode, you need an extra step before you can run " +"``perf report``. You need to call the ``perf inject`` command to inject the " +"JIT information into the ``perf.data`` file.::" +msgstr "" + +#: howto/perf_profiling.rst:239 +msgid "" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python -" +"Xperf_jit my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" +msgstr "" + +#: howto/perf_profiling.rst:243 +msgid "or using the environment variable::" +msgstr "" + +#: howto/perf_profiling.rst:245 +msgid "" +"$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o " +"perf.data python my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" +msgstr "" + +#: howto/perf_profiling.rst:249 +msgid "" +"``perf inject --jit`` command will read ``perf.data``, automatically pick up " +"the perf dump file that Python creates (in ``/tmp/perf-$PID.dump``), and " +"then create ``perf.jit.data`` which merges all the JIT information together. " +"It should also create a lot of ``jitted-XXXX-N.so`` files in the current " +"directory which are ELF images for all the JIT trampolines that were created " +"by Python." +msgstr "" + +#: howto/perf_profiling.rst:257 +msgid "" +"When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of " +"the stack of the process being profiled and save the information in the " +"``perf.data`` file. By default, the size of the stack dump is 8192 bytes, " +"but you can change the size by passing it after a comma like ``--call-graph " +"dwarf,16384``." +msgstr "" + +#: howto/perf_profiling.rst:263 +msgid "" +"The size of the stack dump is important because if the size is too small " +"``perf`` will not be able to unwind the stack and the output will be " +"incomplete. On the other hand, if the size is too big, then ``perf`` won't " +"be able to sample the process as frequently as it would like as the overhead " +"will be higher." +msgstr "" + +#: howto/perf_profiling.rst:269 +msgid "" +"The stack size is particularly important when profiling Python code compiled " +"with low optimization levels (like ``-O0``), as these builds tend to have " +"larger stack frames. If you are compiling Python with ``-O0`` and not seeing " +"Python functions in your profiling output, try increasing the stack dump " +"size to 65528 bytes (the maximum)::" +msgstr "" + +#: howto/perf_profiling.rst:275 +msgid "" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -" +"Xperf_jit my_script.py" +msgstr "" + +#: howto/perf_profiling.rst:277 +msgid "Different compilation flags can significantly impact stack sizes:" +msgstr "" + +#: howto/perf_profiling.rst:279 +msgid "" +"Builds with ``-O0`` typically have much larger stack frames than those with " +"``-O1`` or higher" +msgstr "" + +#: howto/perf_profiling.rst:280 +msgid "" +"Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size" +msgstr "" + +#: howto/perf_profiling.rst:281 +msgid "" +"Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable " +"stack unwinding" +msgstr "" diff --git a/howto/pyporting.po b/howto/pyporting.po index fb639560..c00bb92c 100644 --- a/howto/pyporting.po +++ b/howto/pyporting.po @@ -8,25 +8,26 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2024-12-06 13:40+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: howto/pyporting.rst:7 msgid "How to port Python 2 Code to Python 3" -msgstr "" +msgstr "Πώς να μετατρέψετε τον κώδικα από Python 2 σε Python 3" #: howto/pyporting.rst:0 msgid "author" -msgstr "" +msgstr "συγγραφέας" #: howto/pyporting.rst:9 msgid "Brett Cannon" -msgstr "" +msgstr "Brett Cannon" #: howto/pyporting.rst:11 msgid "" @@ -35,49 +36,64 @@ msgid "" "no longer supported: see :pep:`373` and `status of Python versions `_." msgstr "" +"Η Python 2 έφτασε στο επίσημο τέλος ζωής της στις αρχές του 2020. Αυτό " +"σημαίνει ότι δεν θα γίνονται πλέον αναφορές σφαλμάτων, διορθώσεις ή αλλαγές " +"στην Python 2 - δεν υποστηρίζεται πλέον: δείτε :pep:`373` και την `κατάσταση " +"των εκδόσεων της Python `_." #: howto/pyporting.rst:16 msgid "" "If you are looking to port an extension module instead of pure Python code, " "please see :ref:`cporting-howto`." msgstr "" +"Αν επιθυμείτε να μεταφέρετε ένα module επέκτασης αντί για καθαρό κώδικα " +"Python, παρακαλούμε δείτε :ref:`cporting-howto`." #: howto/pyporting.rst:19 msgid "" "The archived python-porting_ mailing list may contain some useful guidance." msgstr "" +"Η αρχειοθετημένη λίστα αλληλογραφίας python-porting_ μπορεί να περιέχει " +"χρήσιμες οδηγίες." #: howto/pyporting.rst:21 msgid "" -"Since Python 3.13 the original porting guide was discontinued. You can find " -"the old guide in the `archive `_." msgstr "" +"Από την Python 3.13 και μετά, ο αρχικός οδηγός μεταφοράς διακόπηκε. Μπορείτε " +"να βρείτε τον παλιό οδηγό στο `αρχείο `_." #: howto/pyporting.rst:27 msgid "Third-party guides" -msgstr "" +msgstr "Οδηγοί τρίτων" #: howto/pyporting.rst:29 msgid "There are also multiple third-party guides that might be useful:" -msgstr "" +msgstr "Υπάρχουν επίσης πολλοί οδηγοί τρίτων που μπορεί να είναι χρήσιμοι:" #: howto/pyporting.rst:31 msgid "`Guide by Fedora `_" -msgstr "" +msgstr "`Οδηγός από το Fedora `_" #: howto/pyporting.rst:32 msgid "`PyCon 2020 tutorial `_" -msgstr "" +msgstr "`Σεμινάριο PyCon 2020 `_" #: howto/pyporting.rst:33 msgid "" "`Guide by DigitalOcean `_" msgstr "" +"`Οδηγός από το DigitalOcean `_" #: howto/pyporting.rst:34 msgid "" "`Guide by ActiveState `_" msgstr "" +"`Οδηγός από το ActiveState `_" diff --git a/howto/regex.po b/howto/regex.po index a96b79b0..c85ee855 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -124,6 +125,10 @@ msgid "" "discussed in the rest of this HOWTO." msgstr "" +#: howto/regex.rst:79 +msgid ". ^ $ * + ? { } [ ] \\ | ( )" +msgstr "" + #: howto/regex.rst:83 msgid "" "The first metacharacters we'll look at are ``[`` and ``]``. They're used for " @@ -191,7 +196,7 @@ msgid "" "character that's in the appropriate category in the Unicode database." msgstr "" -#: howto/regex.rst:131 +#: howto/regex.rst:130 msgid "``\\d``" msgstr "" @@ -199,7 +204,7 @@ msgstr "" msgid "Matches any decimal digit; this is equivalent to the class ``[0-9]``." msgstr "" -#: howto/regex.rst:134 +#: howto/regex.rst:133 msgid "``\\D``" msgstr "" @@ -208,7 +213,7 @@ msgid "" "Matches any non-digit character; this is equivalent to the class ``[^0-9]``." msgstr "" -#: howto/regex.rst:138 +#: howto/regex.rst:136 msgid "``\\s``" msgstr "" @@ -218,7 +223,7 @@ msgid "" "``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: howto/regex.rst:142 +#: howto/regex.rst:140 msgid "``\\S``" msgstr "" @@ -228,7 +233,7 @@ msgid "" "\\t\\n\\r\\f\\v]``." msgstr "" -#: howto/regex.rst:146 +#: howto/regex.rst:144 msgid "``\\w``" msgstr "" @@ -238,7 +243,7 @@ msgid "" "Z0-9_]``." msgstr "" -#: howto/regex.rst:150 +#: howto/regex.rst:148 msgid "``\\W``" msgstr "" @@ -480,6 +485,14 @@ msgid "" "string substitutions. ::" msgstr "" +#: howto/regex.rst:274 +msgid "" +">>> import re\n" +">>> p = re.compile('ab*')\n" +">>> p\n" +"re.compile('ab*')" +msgstr "" + #: howto/regex.rst:279 msgid "" ":func:`re.compile` also accepts an optional *flags* argument, used to enable " @@ -487,6 +500,10 @@ msgid "" "settings later, but for now a single example will do::" msgstr "" +#: howto/regex.rst:283 +msgid ">>> p = re.compile('ab*', re.IGNORECASE)" +msgstr "" + #: howto/regex.rst:285 msgid "" "The RE is passed to :func:`re.compile` as a string. REs are handled as " @@ -628,11 +645,11 @@ msgid "" "for a complete listing." msgstr "" -#: howto/regex.rst:417 howto/regex.rst:1065 +#: howto/regex.rst:417 howto/regex.rst:1072 msgid "Method/Attribute" msgstr "" -#: howto/regex.rst:417 howto/regex.rst:1065 +#: howto/regex.rst:417 howto/regex.rst:1072 msgid "Purpose" msgstr "" @@ -690,6 +707,14 @@ msgid "" "the Python interpreter, import the :mod:`re` module, and compile a RE::" msgstr "" +#: howto/regex.rst:389 +msgid "" +">>> import re\n" +">>> p = re.compile('[a-z]+')\n" +">>> p\n" +"re.compile('[a-z]+')" +msgstr "" + #: howto/regex.rst:394 msgid "" "Now, you can try matching various strings against the RE ``[a-z]+``. An " @@ -699,6 +724,13 @@ msgid "" "print the result of :meth:`!match` to make this clear. ::" msgstr "" +#: howto/regex.rst:400 +msgid "" +">>> p.match(\"\")\n" +">>> print(p.match(\"\"))\n" +"None" +msgstr "" + #: howto/regex.rst:404 msgid "" "Now, let's try it on a string that it should match, such as ``tempo``. In " @@ -706,6 +738,13 @@ msgid "" "objects>`, so you should store the result in a variable for later use. ::" msgstr "" +#: howto/regex.rst:408 +msgid "" +">>> m = p.match('tempo')\n" +">>> m\n" +"" +msgstr "" + #: howto/regex.rst:412 msgid "" "Now you can query the :ref:`match object ` for information " @@ -749,6 +788,16 @@ msgstr "" msgid "Trying these methods will soon clarify their meaning::" msgstr "" +#: howto/regex.rst:431 +msgid "" +">>> m.group()\n" +"'tempo'\n" +">>> m.start(), m.end()\n" +"(0, 5)\n" +">>> m.span()\n" +"(0, 5)" +msgstr "" + #: howto/regex.rst:438 msgid "" ":meth:`~re.Match.group` returns the substring that was matched by the RE. :" @@ -761,6 +810,18 @@ msgid "" "case. ::" msgstr "" +#: howto/regex.rst:446 +msgid "" +">>> print(p.match('::: message'))\n" +"None\n" +">>> m = p.search('::: message'); print(m)\n" +"\n" +">>> m.group()\n" +"'message'\n" +">>> m.span()\n" +"(4, 11)" +msgstr "" + #: howto/regex.rst:455 msgid "" "In actual programs, the most common style is to store the :ref:`match object " @@ -768,12 +829,29 @@ msgid "" "usually looks like::" msgstr "" +#: howto/regex.rst:459 +msgid "" +"p = re.compile( ... )\n" +"m = p.match( 'string goes here' )\n" +"if m:\n" +" print('Match found: ', m.group())\n" +"else:\n" +" print('No match')" +msgstr "" + #: howto/regex.rst:466 msgid "" "Two pattern methods return all of the matches for a pattern. :meth:`~re." "Pattern.findall` returns a list of matching strings::" msgstr "" +#: howto/regex.rst:469 +msgid "" +">>> p = re.compile(r'\\d+')\n" +">>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')\n" +"['12', '11', '10']" +msgstr "" + #: howto/regex.rst:473 msgid "" "The ``r`` prefix, making the literal a raw string literal, is needed in this " @@ -791,6 +869,19 @@ msgid "" "`iterator`::" msgstr "" +#: howto/regex.rst:483 +msgid "" +">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" +">>> iterator\n" +"\n" +">>> for match in iterator:\n" +"... print(match.span())\n" +"...\n" +"(0, 2)\n" +"(22, 24)\n" +"(29, 31)" +msgstr "" + #: howto/regex.rst:495 msgid "Module-Level Functions" msgstr "" @@ -805,6 +896,14 @@ msgid "" "``None`` or a :ref:`match object ` instance. ::" msgstr "" +#: howto/regex.rst:504 +msgid "" +">>> print(re.match(r'From\\s+', 'Fromage amk'))\n" +"None\n" +">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998')\n" +"" +msgstr "" + #: howto/regex.rst:509 msgid "" "Under the hood, these functions simply create a pattern object for you and " @@ -991,10 +1090,30 @@ msgid "" "it is to read? ::" msgstr "" +#: howto/regex.rst:651 +msgid "" +"charref = re.compile(r\"\"\"\n" +" &[#] # Start of a numeric entity reference\n" +" (\n" +" 0[0-7]+ # Octal form\n" +" | [0-9]+ # Decimal form\n" +" | x[0-9a-fA-F]+ # Hexadecimal form\n" +" )\n" +" ; # Trailing semicolon\n" +"\"\"\", re.VERBOSE)" +msgstr "" + #: howto/regex.rst:661 msgid "Without the verbose setting, the RE would look like this::" msgstr "" +#: howto/regex.rst:663 +msgid "" +"charref = re.compile(\"&#(0[0-7]+\"\n" +" \"|[0-9]+\"\n" +" \"|x[0-9a-fA-F]+);\")" +msgstr "" + #: howto/regex.rst:667 msgid "" "In the above example, Python's automatic concatenation of string literals " @@ -1035,7 +1154,7 @@ msgid "" "of times." msgstr "" -#: howto/regex.rst:704 +#: howto/regex.rst:696 msgid "``|``" msgstr "" @@ -1055,7 +1174,7 @@ msgid "" "class, as in ``[|]``." msgstr "" -#: howto/regex.rst:719 +#: howto/regex.rst:706 msgid "``^``" msgstr "" @@ -1073,11 +1192,19 @@ msgid "" "a line, the RE to use is ``^From``. ::" msgstr "" +#: howto/regex.rst:714 +msgid "" +">>> print(re.search('^From', 'From Here to Eternity'))\n" +"\n" +">>> print(re.search('^From', 'Reciting From Memory'))\n" +"None" +msgstr "" + #: howto/regex.rst:719 msgid "To match a literal ``'^'``, use ``\\^``." msgstr "" -#: howto/regex.rst:733 +#: howto/regex.rst:721 msgid "``$``" msgstr "" @@ -1087,13 +1214,23 @@ msgid "" "string, or any location followed by a newline character. ::" msgstr "" +#: howto/regex.rst:725 +msgid "" +">>> print(re.search('}$', '{block}'))\n" +"\n" +">>> print(re.search('}$', '{block} '))\n" +"None\n" +">>> print(re.search('}$', '{block}\\n'))\n" +"" +msgstr "" + #: howto/regex.rst:732 msgid "" "To match a literal ``'$'``, use ``\\$`` or enclose it inside a character " "class, as in ``[$]``." msgstr "" -#: howto/regex.rst:739 +#: howto/regex.rst:735 msgid "``\\A``" msgstr "" @@ -1106,19 +1243,27 @@ msgid "" "newline character." msgstr "" -#: howto/regex.rst:742 -msgid "``\\Z``" +#: howto/regex.rst:741 +msgid "``\\z``" msgstr "" #: howto/regex.rst:742 msgid "Matches only at the end of the string." msgstr "" -#: howto/regex.rst:777 -msgid "``\\b``" +#: howto/regex.rst:744 +msgid "``\\Z``" msgstr "" #: howto/regex.rst:745 +msgid "The same as ``\\z``. For compatibility with old Python versions." +msgstr "" + +#: howto/regex.rst:747 +msgid "``\\b``" +msgstr "" + +#: howto/regex.rst:748 msgid "" "Word boundary. This is a zero-width assertion that matches only at the " "beginning or end of a word. A word is defined as a sequence of alphanumeric " @@ -1126,13 +1271,24 @@ msgid "" "alphanumeric character." msgstr "" -#: howto/regex.rst:750 +#: howto/regex.rst:753 msgid "" "The following example matches ``class`` only when it's a complete word; it " "won't match when it's contained inside another word. ::" msgstr "" -#: howto/regex.rst:761 +#: howto/regex.rst:756 +msgid "" +">>> p = re.compile(r'\\bclass\\b')\n" +">>> print(p.search('no class at all'))\n" +"\n" +">>> print(p.search('the declassified algorithm'))\n" +"None\n" +">>> print(p.search('one subclass is'))\n" +"None" +msgstr "" + +#: howto/regex.rst:764 msgid "" "There are two subtleties you should remember when using this special " "sequence. First, this is the worst collision between Python's string " @@ -1143,7 +1299,16 @@ msgid "" "previous RE, but omits the ``'r'`` in front of the RE string. ::" msgstr "" -#: howto/regex.rst:775 +#: howto/regex.rst:772 +msgid "" +">>> p = re.compile('\\bclass\\b')\n" +">>> print(p.search('no class at all'))\n" +"None\n" +">>> print(p.search('\\b' + 'class' + '\\b'))\n" +"" +msgstr "" + +#: howto/regex.rst:778 msgid "" "Second, inside a character class, where there's no use for this assertion, " "``\\b`` represents the backspace character, for compatibility with Python's " @@ -1154,17 +1319,17 @@ msgstr "" msgid "``\\B``" msgstr "" -#: howto/regex.rst:780 +#: howto/regex.rst:783 msgid "" "Another zero-width assertion, this is the opposite of ``\\b``, only matching " "when the current position is not at a word boundary." msgstr "" -#: howto/regex.rst:785 +#: howto/regex.rst:788 msgid "Grouping" msgstr "" -#: howto/regex.rst:787 +#: howto/regex.rst:790 msgid "" "Frequently you need to obtain more information than just whether the RE " "matched or not. Regular expressions are often used to dissect strings by " @@ -1173,14 +1338,22 @@ msgid "" "name and a value, separated by a ``':'``, like this:" msgstr "" -#: howto/regex.rst:800 +#: howto/regex.rst:796 +msgid "" +"From: author@example.com\n" +"User-Agent: Thunderbird 1.5.0.9 (X11/20061227)\n" +"MIME-Version: 1.0\n" +"To: editor@example.com" +msgstr "" + +#: howto/regex.rst:803 msgid "" "This can be handled by writing a regular expression which matches an entire " "header line, and has one group which matches the header name, and another " "group which matches the header's value." msgstr "" -#: howto/regex.rst:804 +#: howto/regex.rst:807 msgid "" "Groups are marked by the ``'('``, ``')'`` metacharacters. ``'('`` and " "``')'`` have much the same meaning as they do in mathematical expressions; " @@ -1190,7 +1363,14 @@ msgid "" "repetitions of ``ab``. ::" msgstr "" -#: howto/regex.rst:815 +#: howto/regex.rst:814 +msgid "" +">>> p = re.compile('(ab)*')\n" +">>> print(p.match('ababababab').span())\n" +"(0, 10)" +msgstr "" + +#: howto/regex.rst:818 msgid "" "Groups indicated with ``'('``, ``')'`` also capture the starting and ending " "index of the text that they match; this can be retrieved by passing an " @@ -1202,14 +1382,36 @@ msgid "" "they match. ::" msgstr "" -#: howto/regex.rst:831 +#: howto/regex.rst:827 +msgid "" +">>> p = re.compile('(a)b')\n" +">>> m = p.match('ab')\n" +">>> m.group()\n" +"'ab'\n" +">>> m.group(0)\n" +"'ab'" +msgstr "" + +#: howto/regex.rst:834 msgid "" "Subgroups are numbered from left to right, from 1 upward. Groups can be " "nested; to determine the number, just count the opening parenthesis " "characters, going from left to right. ::" msgstr "" -#: howto/regex.rst:844 +#: howto/regex.rst:838 +msgid "" +">>> p = re.compile('(a(b)c)d')\n" +">>> m = p.match('abcd')\n" +">>> m.group(0)\n" +"'abcd'\n" +">>> m.group(1)\n" +"'abc'\n" +">>> m.group(2)\n" +"'b'" +msgstr "" + +#: howto/regex.rst:847 msgid "" ":meth:`~re.Match.group` can be passed multiple group numbers at a time, in " "which case it will return a tuple containing the corresponding values for " @@ -1218,12 +1420,24 @@ msgstr "" #: howto/regex.rst:850 msgid "" +">>> m.group(2,1,2)\n" +"('b', 'abc', 'b')" +msgstr "" + +#: howto/regex.rst:853 +msgid "" "The :meth:`~re.Match.groups` method returns a tuple containing the strings " "for all the subgroups, from 1 up to however many there are. ::" msgstr "" #: howto/regex.rst:856 msgid "" +">>> m.groups()\n" +"('abc', 'b')" +msgstr "" + +#: howto/regex.rst:859 +msgid "" "Backreferences in a pattern allow you to specify that the contents of an " "earlier capturing group must also be found at the current location in the " "string. For example, ``\\1`` will succeed if the exact contents of group 1 " @@ -1233,11 +1447,18 @@ msgid "" "when incorporating backreferences in a RE." msgstr "" -#: howto/regex.rst:864 +#: howto/regex.rst:867 msgid "For example, the following RE detects doubled words in a string. ::" msgstr "" -#: howto/regex.rst:870 +#: howto/regex.rst:869 +msgid "" +">>> p = re.compile(r'\\b(\\w+)\\s+\\1\\b')\n" +">>> p.search('Paris in the the spring').group()\n" +"'the the'" +msgstr "" + +#: howto/regex.rst:873 msgid "" "Backreferences like this aren't often useful for just searching through a " "string --- there are few text formats which repeat data in this way --- but " @@ -1245,11 +1466,11 @@ msgid "" "substitutions." msgstr "" -#: howto/regex.rst:876 +#: howto/regex.rst:879 msgid "Non-capturing and Named Groups" msgstr "" -#: howto/regex.rst:878 +#: howto/regex.rst:881 msgid "" "Elaborate REs may use many groups, both to capture substrings of interest, " "and to group and structure the RE itself. In complex REs, it becomes " @@ -1258,7 +1479,7 @@ msgid "" "expression extensions, so we'll look at that first." msgstr "" -#: howto/regex.rst:884 +#: howto/regex.rst:887 msgid "" "Perl 5 is well known for its powerful additions to standard regular " "expressions. For these new features the Perl developers couldn't choose new " @@ -1269,7 +1490,7 @@ msgid "" "wouldn't have escaped it by writing ``\\&`` or ``[&]``." msgstr "" -#: howto/regex.rst:891 +#: howto/regex.rst:894 msgid "" "The solution chosen by the Perl developers was to use ``(?...)`` as the " "extension syntax. ``?`` immediately after a parenthesis was a syntax error " @@ -1280,20 +1501,20 @@ msgid "" "capturing group containing the subexpression ``foo``)." msgstr "" -#: howto/regex.rst:899 +#: howto/regex.rst:902 msgid "" "Python supports several of Perl's extensions and adds an extension syntax to " "Perl's extension syntax. If the first character after the question mark is " "a ``P``, you know that it's an extension that's specific to Python." msgstr "" -#: howto/regex.rst:904 +#: howto/regex.rst:907 msgid "" "Now that we've looked at the general extension syntax, we can return to the " "features that simplify working with groups in complex REs." msgstr "" -#: howto/regex.rst:907 +#: howto/regex.rst:910 msgid "" "Sometimes you'll want to use a group to denote a part of a regular " "expression, but aren't interested in retrieving the group's contents. You " @@ -1301,7 +1522,17 @@ msgid "" "where you can replace the ``...`` with any other regular expression. ::" msgstr "" -#: howto/regex.rst:919 +#: howto/regex.rst:915 +msgid "" +">>> m = re.match(\"([abc])+\", \"abc\")\n" +">>> m.groups()\n" +"('c',)\n" +">>> m = re.match(\"(?:[abc])+\", \"abc\")\n" +">>> m.groups()\n" +"()" +msgstr "" + +#: howto/regex.rst:922 msgid "" "Except for the fact that you can't retrieve the contents of what the group " "matched, a non-capturing group behaves exactly the same as a capturing " @@ -1314,13 +1545,13 @@ msgid "" "groups; neither form is any faster than the other." msgstr "" -#: howto/regex.rst:928 +#: howto/regex.rst:931 msgid "" "A more significant feature is named groups: instead of referring to them by " "numbers, groups can be referenced by a name." msgstr "" -#: howto/regex.rst:931 +#: howto/regex.rst:934 msgid "" "The syntax for a named group is one of the Python-specific extensions: ``(?" "P...)``. *name* is, obviously, the name of the group. Named groups " @@ -1332,26 +1563,53 @@ msgid "" "ways::" msgstr "" -#: howto/regex.rst:946 +#: howto/regex.rst:942 +msgid "" +">>> p = re.compile(r'(?P\\b\\w+\\b)')\n" +">>> m = p.search( '(((( Lots of punctuation )))' )\n" +">>> m.group('word')\n" +"'Lots'\n" +">>> m.group(1)\n" +"'Lots'" +msgstr "" + +#: howto/regex.rst:949 msgid "" "Additionally, you can retrieve named groups as a dictionary with :meth:`~re." "Match.groupdict`::" msgstr "" -#: howto/regex.rst:953 +#: howto/regex.rst:952 +msgid "" +">>> m = re.match(r'(?P\\w+) (?P\\w+)', 'Jane Doe')\n" +">>> m.groupdict()\n" +"{'first': 'Jane', 'last': 'Doe'}" +msgstr "" + +#: howto/regex.rst:956 msgid "" "Named groups are handy because they let you use easily remembered names, " "instead of having to remember numbers. Here's an example RE from the :mod:" "`imaplib` module::" msgstr "" -#: howto/regex.rst:964 +#: howto/regex.rst:960 +msgid "" +"InternalDate = re.compile(r'INTERNALDATE \"'\n" +" r'(?P[ 123][0-9])-(?P[A-Z][a-z][a-z])-'\n" +" r'(?P[0-9][0-9][0-9][0-9])'\n" +" r' (?P[0-9][0-9]):(?P[0-9][0-9]):(?P[0-9][0-9])'\n" +" r' (?P[-+])(?P[0-9][0-9])(?P[0-9][0-9])'\n" +" r'\"')" +msgstr "" + +#: howto/regex.rst:967 msgid "" "It's obviously much easier to retrieve ``m.group('zonem')``, instead of " "having to remember to retrieve group 9." msgstr "" -#: howto/regex.rst:967 +#: howto/regex.rst:970 msgid "" "The syntax for backreferences in an expression such as ``(...)\\1`` refers " "to the number of the group. There's naturally a variant that uses the group " @@ -1362,22 +1620,29 @@ msgid "" "P\\w+)\\s+(?P=word)\\b``::" msgstr "" -#: howto/regex.rst:980 +#: howto/regex.rst:977 +msgid "" +">>> p = re.compile(r'\\b(?P\\w+)\\s+(?P=word)\\b')\n" +">>> p.search('Paris in the the spring').group()\n" +"'the the'" +msgstr "" + +#: howto/regex.rst:983 msgid "Lookahead Assertions" msgstr "" -#: howto/regex.rst:982 +#: howto/regex.rst:985 msgid "" "Another zero-width assertion is the lookahead assertion. Lookahead " "assertions are available in both positive and negative form, and look like " "this:" msgstr "" -#: howto/regex.rst:990 +#: howto/regex.rst:988 msgid "``(?=...)``" msgstr "" -#: howto/regex.rst:986 +#: howto/regex.rst:989 msgid "" "Positive lookahead assertion. This succeeds if the contained regular " "expression, represented here by ``...``, successfully matches at the current " @@ -1390,14 +1655,14 @@ msgstr "" msgid "``(?!...)``" msgstr "" -#: howto/regex.rst:993 +#: howto/regex.rst:996 msgid "" "Negative lookahead assertion. This is the opposite of the positive " "assertion; it succeeds if the contained expression *doesn't* match at the " "current position in the string." msgstr "" -#: howto/regex.rst:997 +#: howto/regex.rst:1000 msgid "" "To make this concrete, let's look at a case where a lookahead is useful. " "Consider a simple pattern to match a filename and split it apart into a base " @@ -1405,15 +1670,15 @@ msgid "" "``news`` is the base name, and ``rc`` is the filename's extension." msgstr "" -#: howto/regex.rst:1002 +#: howto/regex.rst:1005 msgid "The pattern to match this is quite simple:" msgstr "" -#: howto/regex.rst:1004 +#: howto/regex.rst:1007 msgid "``.*[.].*$``" msgstr "" -#: howto/regex.rst:1006 +#: howto/regex.rst:1009 msgid "" "Notice that the ``.`` needs to be treated specially because it's a " "metacharacter, so it's inside a character class to only match that specific " @@ -1423,24 +1688,28 @@ msgid "" "``printers.conf``." msgstr "" -#: howto/regex.rst:1013 +#: howto/regex.rst:1016 msgid "" "Now, consider complicating the problem a bit; what if you want to match " "filenames where the extension is not ``bat``? Some incorrect attempts:" msgstr "" -#: howto/regex.rst:1016 +#: howto/regex.rst:1019 +msgid "``.*[.][^b].*$``" +msgstr "" + +#: howto/regex.rst:1021 msgid "" -"``.*[.][^b].*$`` The first attempt above tries to exclude ``bat`` by " -"requiring that the first character of the extension is not a ``b``. This is " -"wrong, because the pattern also doesn't match ``foo.bar``." +"The first attempt above tries to exclude ``bat`` by requiring that the first " +"character of the extension is not a ``b``. This is wrong, because the " +"pattern also doesn't match ``foo.bar``." msgstr "" -#: howto/regex.rst:1020 +#: howto/regex.rst:1025 msgid "``.*[.]([^b]..|.[^a].|..[^t])$``" msgstr "" -#: howto/regex.rst:1022 +#: howto/regex.rst:1027 msgid "" "The expression gets messier when you try to patch up the first solution by " "requiring one of the following cases to match: the first character of the " @@ -1451,18 +1720,18 @@ msgid "" "pattern again in an effort to fix it." msgstr "" -#: howto/regex.rst:1030 +#: howto/regex.rst:1035 msgid "``.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$``" msgstr "" -#: howto/regex.rst:1032 +#: howto/regex.rst:1037 msgid "" "In the third attempt, the second and third letters are all made optional in " "order to allow matching extensions shorter than three characters, such as " "``sendmail.cf``." msgstr "" -#: howto/regex.rst:1036 +#: howto/regex.rst:1041 msgid "" "The pattern's getting really complicated now, which makes it hard to read " "and understand. Worse, if the problem changes and you want to exclude both " @@ -1470,75 +1739,79 @@ msgid "" "complicated and confusing." msgstr "" -#: howto/regex.rst:1041 +#: howto/regex.rst:1046 msgid "A negative lookahead cuts through all this confusion:" msgstr "" -#: howto/regex.rst:1043 -msgid "" -"``.*[.](?!bat$)[^.]*$`` The negative lookahead means: if the expression " -"``bat`` doesn't match at this point, try the rest of the pattern; if " -"``bat$`` does match, the whole pattern will fail. The trailing ``$`` is " -"required to ensure that something like ``sample.batch``, where the extension " -"only starts with ``bat``, will be allowed. The ``[^.]*`` makes sure that " -"the pattern works when there are multiple dots in the filename." +#: howto/regex.rst:1048 +msgid "``.*[.](?!bat$)[^.]*$``" msgstr "" #: howto/regex.rst:1050 msgid "" +"The negative lookahead means: if the expression ``bat`` doesn't match at " +"this point, try the rest of the pattern; if ``bat$`` does match, the whole " +"pattern will fail. The trailing ``$`` is required to ensure that something " +"like ``sample.batch``, where the extension only starts with ``bat``, will be " +"allowed. The ``[^.]*`` makes sure that the pattern works when there are " +"multiple dots in the filename." +msgstr "" + +#: howto/regex.rst:1057 +msgid "" "Excluding another filename extension is now easy; simply add it as an " "alternative inside the assertion. The following pattern excludes filenames " "that end in either ``bat`` or ``exe``:" msgstr "" -#: howto/regex.rst:1054 +#: howto/regex.rst:1061 msgid "``.*[.](?!bat$|exe$)[^.]*$``" msgstr "" -#: howto/regex.rst:1058 +#: howto/regex.rst:1065 msgid "Modifying Strings" msgstr "" -#: howto/regex.rst:1060 +#: howto/regex.rst:1067 msgid "" "Up to this point, we've simply performed searches against a static string. " "Regular expressions are also commonly used to modify strings in various " "ways, using the following pattern methods:" msgstr "" -#: howto/regex.rst:1067 +#: howto/regex.rst:1074 msgid "``split()``" msgstr "" -#: howto/regex.rst:1067 +#: howto/regex.rst:1074 msgid "Split the string into a list, splitting it wherever the RE matches" msgstr "" -#: howto/regex.rst:1070 +#: howto/regex.rst:1077 msgid "``sub()``" msgstr "" -#: howto/regex.rst:1070 +#: howto/regex.rst:1077 msgid "" "Find all substrings where the RE matches, and replace them with a different " "string" msgstr "" -#: howto/regex.rst:1073 +#: howto/regex.rst:1080 msgid "``subn()``" msgstr "" -#: howto/regex.rst:1073 +#: howto/regex.rst:1080 msgid "" "Does the same thing as :meth:`!sub`, but returns the new string and the " "number of replacements" msgstr "" -#: howto/regex.rst:1080 +#: howto/regex.rst:1087 msgid "Splitting Strings" msgstr "" -#: howto/regex.rst:1082 +#: howto/regex.rst:1089 msgid "" "The :meth:`~re.Pattern.split` method of a pattern splits a string apart " "wherever the RE matches, returning a list of the pieces. It's similar to " @@ -1548,7 +1821,7 @@ msgid "" "module-level :func:`re.split` function, too." msgstr "" -#: howto/regex.rst:1093 +#: howto/regex.rst:1100 msgid "" "Split *string* by the matches of the regular expression. If capturing " "parentheses are used in the RE, then their contents will also be returned as " @@ -1556,7 +1829,7 @@ msgid "" "splits are performed." msgstr "" -#: howto/regex.rst:1098 +#: howto/regex.rst:1105 msgid "" "You can limit the number of splits made, by passing a value for *maxsplit*. " "When *maxsplit* is nonzero, at most *maxsplit* splits will be made, and the " @@ -1565,7 +1838,16 @@ msgid "" "characters. ::" msgstr "" -#: howto/regex.rst:1110 +#: howto/regex.rst:1111 +msgid "" +">>> p = re.compile(r'\\W+')\n" +">>> p.split('This is a test, short and sweet, of split().')\n" +"['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', '']\n" +">>> p.split('This is a test, short and sweet, of split().', 3)\n" +"['This', 'is', 'a', 'test, short and sweet, of split().']" +msgstr "" + +#: howto/regex.rst:1117 msgid "" "Sometimes you're not only interested in what the text between delimiters is, " "but also need to know what the delimiter was. If capturing parentheses are " @@ -1575,15 +1857,35 @@ msgstr "" #: howto/regex.rst:1122 msgid "" +">>> p = re.compile(r'\\W+')\n" +">>> p2 = re.compile(r'(\\W+)')\n" +">>> p.split('This... is a test.')\n" +"['This', 'is', 'a', 'test', '']\n" +">>> p2.split('This... is a test.')\n" +"['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', '']" +msgstr "" + +#: howto/regex.rst:1129 +msgid "" "The module-level function :func:`re.split` adds the RE to be used as the " "first argument, but is otherwise the same. ::" msgstr "" -#: howto/regex.rst:1134 +#: howto/regex.rst:1132 +msgid "" +">>> re.split(r'[\\W]+', 'Words, words, words.')\n" +"['Words', 'words', 'words', '']\n" +">>> re.split(r'([\\W]+)', 'Words, words, words.')\n" +"['Words', ', ', 'words', ', ', 'words', '.', '']\n" +">>> re.split(r'[\\W]+', 'Words, words, words.', 1)\n" +"['Words', 'words, words.']" +msgstr "" + +#: howto/regex.rst:1141 msgid "Search and Replace" msgstr "" -#: howto/regex.rst:1136 +#: howto/regex.rst:1143 msgid "" "Another common task is to find all the matches for a pattern, and replace " "them with a different string. The :meth:`~re.Pattern.sub` method takes a " @@ -1591,40 +1893,65 @@ msgid "" "string to be processed." msgstr "" -#: howto/regex.rst:1143 +#: howto/regex.rst:1150 msgid "" "Returns the string obtained by replacing the leftmost non-overlapping " "occurrences of the RE in *string* by the replacement *replacement*. If the " "pattern isn't found, *string* is returned unchanged." msgstr "" -#: howto/regex.rst:1147 +#: howto/regex.rst:1154 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. The default value " "of 0 means to replace all occurrences." msgstr "" -#: howto/regex.rst:1151 +#: howto/regex.rst:1158 msgid "" "Here's a simple example of using the :meth:`~re.Pattern.sub` method. It " "replaces colour names with the word ``colour``::" msgstr "" -#: howto/regex.rst:1160 +#: howto/regex.rst:1161 +msgid "" +">>> p = re.compile('(blue|white|red)')\n" +">>> p.sub('colour', 'blue socks and red shoes')\n" +"'colour socks and colour shoes'\n" +">>> p.sub('colour', 'blue socks and red shoes', count=1)\n" +"'colour socks and red shoes'" +msgstr "" + +#: howto/regex.rst:1167 msgid "" "The :meth:`~re.Pattern.subn` method does the same work, but returns a 2-" "tuple containing the new string value and the number of replacements that " "were performed::" msgstr "" -#: howto/regex.rst:1169 +#: howto/regex.rst:1170 +msgid "" +">>> p = re.compile('(blue|white|red)')\n" +">>> p.subn('colour', 'blue socks and red shoes')\n" +"('colour socks and colour shoes', 2)\n" +">>> p.subn('colour', 'no colours at all')\n" +"('no colours at all', 0)" +msgstr "" + +#: howto/regex.rst:1176 msgid "" "Empty matches are replaced only when they're not adjacent to a previous " "empty match. ::" msgstr "" -#: howto/regex.rst:1176 +#: howto/regex.rst:1179 +msgid "" +">>> p = re.compile('x*')\n" +">>> p.sub('-', 'abxd')\n" +"'-a-b--d-'" +msgstr "" + +#: howto/regex.rst:1183 msgid "" "If *replacement* is a string, any backslash escapes in it are processed. " "That is, ``\\n`` is converted to a single newline character, ``\\r`` is " @@ -1635,13 +1962,20 @@ msgid "" "string." msgstr "" -#: howto/regex.rst:1183 +#: howto/regex.rst:1190 msgid "" "This example matches the word ``section`` followed by a string enclosed in " "``{``, ``}``, and changes ``section`` to ``subsection``::" msgstr "" -#: howto/regex.rst:1190 +#: howto/regex.rst:1193 +msgid "" +">>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n" +">>> p.sub(r'subsection{\\1}','section{First} section{second}')\n" +"'subsection{First} subsection{second}'" +msgstr "" + +#: howto/regex.rst:1197 msgid "" "There's also a syntax for referring to named groups as defined by the ``(?" "P...)`` syntax. ``\\g`` will use the substring matched by the " @@ -1653,7 +1987,18 @@ msgid "" "but use all three variations of the replacement string. ::" msgstr "" -#: howto/regex.rst:1207 +#: howto/regex.rst:1206 +msgid "" +">>> p = re.compile('section{ (?P [^}]* ) }', re.VERBOSE)\n" +">>> p.sub(r'subsection{\\1}','section{First}')\n" +"'subsection{First}'\n" +">>> p.sub(r'subsection{\\g<1>}','section{First}')\n" +"'subsection{First}'\n" +">>> p.sub(r'subsection{\\g}','section{First}')\n" +"'subsection{First}'" +msgstr "" + +#: howto/regex.rst:1214 msgid "" "*replacement* can also be a function, which gives you even more control. If " "*replacement* is a function, the function is called for every non-" @@ -1662,13 +2007,25 @@ msgid "" "this information to compute the desired replacement string and return it." msgstr "" -#: howto/regex.rst:1213 +#: howto/regex.rst:1220 msgid "" "In the following example, the replacement function translates decimals into " "hexadecimal::" msgstr "" -#: howto/regex.rst:1225 +#: howto/regex.rst:1223 +msgid "" +">>> def hexrepl(match):\n" +"... \"Return the hex string for a decimal number\"\n" +"... value = int(match.group())\n" +"... return hex(value)\n" +"...\n" +">>> p = re.compile(r'\\d+')\n" +">>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')\n" +"'Call 0xffd2 for printing, 0xc000 for user code.'" +msgstr "" + +#: howto/regex.rst:1232 msgid "" "When using the module-level :func:`re.sub` function, the pattern is passed " "as the first argument. The pattern may be provided as an object or as a " @@ -1678,11 +2035,11 @@ msgid "" "x'``." msgstr "" -#: howto/regex.rst:1233 +#: howto/regex.rst:1240 msgid "Common Problems" msgstr "" -#: howto/regex.rst:1235 +#: howto/regex.rst:1242 msgid "" "Regular expressions are a powerful tool for some applications, but in some " "ways their behaviour isn't intuitive and at times they don't behave the way " @@ -1690,11 +2047,11 @@ msgid "" "pitfalls." msgstr "" -#: howto/regex.rst:1241 +#: howto/regex.rst:1248 msgid "Use String Methods" msgstr "" -#: howto/regex.rst:1243 +#: howto/regex.rst:1250 msgid "" "Sometimes using the :mod:`re` module is a mistake. If you're matching a " "fixed string, or a single character class, and you're not using any :mod:" @@ -1706,7 +2063,7 @@ msgid "" "engine." msgstr "" -#: howto/regex.rst:1251 +#: howto/regex.rst:1258 msgid "" "One example might be replacing a single fixed string with another one; for " "example, you might replace ``word`` with ``deed``. :func:`re.sub` seems " @@ -1719,7 +2076,7 @@ msgid "" "meth:`!replace`'s abilities.)" msgstr "" -#: howto/regex.rst:1260 +#: howto/regex.rst:1267 msgid "" "Another common task is deleting every occurrence of a single character from " "a string or replacing it with another single character. You might do this " @@ -1728,17 +2085,17 @@ msgid "" "operation can be." msgstr "" -#: howto/regex.rst:1266 +#: howto/regex.rst:1273 msgid "" "In short, before turning to the :mod:`re` module, consider whether your " "problem can be solved with a faster and simpler string method." msgstr "" -#: howto/regex.rst:1271 +#: howto/regex.rst:1278 msgid "match() versus search()" msgstr "" -#: howto/regex.rst:1273 +#: howto/regex.rst:1280 msgid "" "The :func:`~re.match` function only checks if the RE matches at the " "beginning of the string while :func:`~re.search` will scan forward through " @@ -1748,13 +2105,29 @@ msgid "" "report it. ::" msgstr "" -#: howto/regex.rst:1284 +#: howto/regex.rst:1286 +msgid "" +">>> print(re.match('super', 'superstition').span())\n" +"(0, 5)\n" +">>> print(re.match('super', 'insuperable'))\n" +"None" +msgstr "" + +#: howto/regex.rst:1291 msgid "" "On the other hand, :func:`~re.search` will scan forward through the string, " "reporting the first match it finds. ::" msgstr "" -#: howto/regex.rst:1292 +#: howto/regex.rst:1294 +msgid "" +">>> print(re.search('super', 'superstition').span())\n" +"(0, 5)\n" +">>> print(re.search('super', 'insuperable').span())\n" +"(2, 7)" +msgstr "" + +#: howto/regex.rst:1299 msgid "" "Sometimes you'll be tempted to keep using :func:`re.match`, and just add ``." "*`` to the front of your RE. Resist this temptation and use :func:`re." @@ -1766,18 +2139,18 @@ msgid "" "starting character, only trying the full match if a ``'C'`` is found." msgstr "" -#: howto/regex.rst:1301 +#: howto/regex.rst:1308 msgid "" "Adding ``.*`` defeats this optimization, requiring scanning to the end of " "the string and then backtracking to find a match for the rest of the RE. " "Use :func:`re.search` instead." msgstr "" -#: howto/regex.rst:1307 +#: howto/regex.rst:1314 msgid "Greedy versus Non-Greedy" msgstr "" -#: howto/regex.rst:1309 +#: howto/regex.rst:1316 msgid "" "When repeating a regular expression, as in ``a*``, the resulting action is " "to consume as much of the pattern as possible. This fact often bites you " @@ -1786,7 +2159,18 @@ msgid "" "HTML tag doesn't work because of the greedy nature of ``.*``. ::" msgstr "" -#: howto/regex.rst:1323 +#: howto/regex.rst:1322 +msgid "" +">>> s = 'Title'\n" +">>> len(s)\n" +"32\n" +">>> print(re.match('<.*>', s).span())\n" +"(0, 32)\n" +">>> print(re.match('<.*>', s).group())\n" +"Title" +msgstr "" + +#: howto/regex.rst:1330 msgid "" "The RE matches the ``'<'`` in ``''``, and the ``.*`` consumes the rest " "of the string. There's still more left in the RE, though, and the ``>`` " @@ -1796,7 +2180,7 @@ msgid "" "``''``, which isn't what you want." msgstr "" -#: howto/regex.rst:1330 +#: howto/regex.rst:1337 msgid "" "In this case, the solution is to use the non-greedy quantifiers ``*?``, ``+?" "``, ``??``, or ``{m,n}?``, which match as *little* text as possible. In the " @@ -1805,7 +2189,13 @@ msgid "" "retrying the ``'>'`` at every step. This produces just the right result::" msgstr "" -#: howto/regex.rst:1339 +#: howto/regex.rst:1343 +msgid "" +">>> print(re.match('<.*?>', s).group())\n" +"" +msgstr "" + +#: howto/regex.rst:1346 msgid "" "(Note that parsing HTML or XML with regular expressions is painful. Quick-" "and-dirty patterns will handle common cases, but HTML and XML have special " @@ -1815,11 +2205,11 @@ msgid "" "such tasks.)" msgstr "" -#: howto/regex.rst:1347 +#: howto/regex.rst:1354 msgid "Using re.VERBOSE" msgstr "" -#: howto/regex.rst:1349 +#: howto/regex.rst:1356 msgid "" "By now you've probably noticed that regular expressions are a very compact " "notation, but they're not terribly readable. REs of moderate complexity can " @@ -1827,14 +2217,14 @@ msgid "" "making them difficult to read and understand." msgstr "" -#: howto/regex.rst:1354 +#: howto/regex.rst:1361 msgid "" "For such REs, specifying the :const:`re.VERBOSE` flag when compiling the " "regular expression can be helpful, because it allows you to format the " "regular expression more clearly." msgstr "" -#: howto/regex.rst:1358 +#: howto/regex.rst:1365 msgid "" "The ``re.VERBOSE`` flag has several effects. Whitespace in the regular " "expression that *isn't* inside a character class is ignored. This means " @@ -1845,15 +2235,31 @@ msgid "" "quoted strings, this enables REs to be formatted more neatly::" msgstr "" -#: howto/regex.rst:1375 +#: howto/regex.rst:1373 +msgid "" +"pat = re.compile(r\"\"\"\n" +" \\s* # Skip leading whitespace\n" +" (?P
[^:]+) # Header name\n" +" \\s* : # Whitespace, and a colon\n" +" (?P.*?) # The header's value -- *? used to\n" +" # lose the following trailing whitespace\n" +" \\s*$ # Trailing whitespace to end-of-line\n" +"\"\"\", re.VERBOSE)" +msgstr "" + +#: howto/regex.rst:1382 msgid "This is far more readable than::" msgstr "" -#: howto/regex.rst:1381 +#: howto/regex.rst:1384 +msgid "pat = re.compile(r\"\\s*(?P
[^:]+)\\s*:(?P.*?)\\s*$\")" +msgstr "" + +#: howto/regex.rst:1388 msgid "Feedback" msgstr "" -#: howto/regex.rst:1383 +#: howto/regex.rst:1390 msgid "" "Regular expressions are a complicated topic. Did this document help you " "understand them? Were there parts that were unclear, or Problems you " @@ -1861,7 +2267,7 @@ msgid "" "improvements to the author." msgstr "" -#: howto/regex.rst:1388 +#: howto/regex.rst:1395 msgid "" "The most complete book on regular expressions is almost certainly Jeffrey " "Friedl's Mastering Regular Expressions, published by O'Reilly. " diff --git a/howto/remote_debugging.po b/howto/remote_debugging.po new file mode 100644 index 00000000..ad89838e --- /dev/null +++ b/howto/remote_debugging.po @@ -0,0 +1,971 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: howto/remote_debugging.rst:4 +msgid "Remote debugging attachment protocol" +msgstr "" + +#: howto/remote_debugging.rst:6 +msgid "" +"This protocol enables external tools to attach to a running CPython process " +"and execute Python code remotely." +msgstr "" + +#: howto/remote_debugging.rst:9 +msgid "" +"Most platforms require elevated privileges to attach to another Python " +"process." +msgstr "" + +#: howto/remote_debugging.rst:14 +msgid "Permission requirements" +msgstr "" + +#: howto/remote_debugging.rst:16 +msgid "" +"Attaching to a running Python process for remote debugging requires elevated " +"privileges on most platforms. The specific requirements and troubleshooting " +"steps depend on your operating system:" +msgstr "" + +#: howto/remote_debugging.rst:21 +msgid "Linux" +msgstr "" + +#: howto/remote_debugging.rst:22 +msgid "" +"The tracer process must have the ``CAP_SYS_PTRACE`` capability or equivalent " +"privileges. You can only trace processes you own and can signal. Tracing may " +"fail if the process is already being traced, or if it is running with set-" +"user-ID or set-group-ID. Security modules like Yama may further restrict " +"tracing." +msgstr "" + +#: howto/remote_debugging.rst:28 +msgid "To temporarily relax ptrace restrictions (until reboot), run:" +msgstr "" + +#: howto/remote_debugging.rst:30 +msgid "``echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope``" +msgstr "" + +#: howto/remote_debugging.rst:34 +msgid "" +"Disabling ``ptrace_scope`` reduces system hardening and should only be done " +"in trusted environments." +msgstr "" + +#: howto/remote_debugging.rst:37 +msgid "" +"If running inside a container, use ``--cap-add=SYS_PTRACE`` or ``--" +"privileged``, and run as root if needed." +msgstr "" + +#: howto/remote_debugging.rst:40 +msgid "Try re-running the command with elevated privileges:" +msgstr "" + +#: howto/remote_debugging.rst:42 +msgid "``sudo -E !!``" +msgstr "" + +#: howto/remote_debugging.rst:46 +msgid "macOS" +msgstr "" + +#: howto/remote_debugging.rst:47 +msgid "" +"To attach to another process, you typically need to run your debugging tool " +"with elevated privileges. This can be done by using ``sudo`` or running as " +"root." +msgstr "" + +#: howto/remote_debugging.rst:51 +msgid "" +"Even when attaching to processes you own, macOS may block debugging unless " +"the debugger is run with root privileges due to system security restrictions." +msgstr "" + +#: howto/remote_debugging.rst:56 +msgid "Windows" +msgstr "" + +#: howto/remote_debugging.rst:57 +msgid "" +"To attach to another process, you usually need to run your debugging tool " +"with administrative privileges. Start the command prompt or terminal as " +"Administrator." +msgstr "" + +#: howto/remote_debugging.rst:61 +msgid "" +"Some processes may still be inaccessible even with Administrator rights, " +"unless you have the ``SeDebugPrivilege`` privilege enabled." +msgstr "" + +#: howto/remote_debugging.rst:64 +msgid "" +"To resolve file or folder access issues, adjust the security permissions:" +msgstr "" + +#: howto/remote_debugging.rst:66 +msgid "Right-click the file or folder and select **Properties**." +msgstr "" + +#: howto/remote_debugging.rst:67 +msgid "Go to the **Security** tab to view users and groups with access." +msgstr "" + +#: howto/remote_debugging.rst:68 +msgid "Click **Edit** to modify permissions." +msgstr "" + +#: howto/remote_debugging.rst:69 +msgid "Select your user account." +msgstr "" + +#: howto/remote_debugging.rst:70 +msgid "In **Permissions**, check **Read** or **Full control** as needed." +msgstr "" + +#: howto/remote_debugging.rst:71 +msgid "Click **Apply**, then **OK** to confirm." +msgstr "" + +#: howto/remote_debugging.rst:76 +msgid "" +"Ensure you've satisfied all :ref:`permission-requirements` before proceeding." +msgstr "" + +#: howto/remote_debugging.rst:78 +msgid "" +"This section describes the low-level protocol that enables external tools to " +"inject and execute a Python script within a running CPython process." +msgstr "" + +#: howto/remote_debugging.rst:81 +msgid "" +"This mechanism forms the basis of the :func:`sys.remote_exec` function, " +"which instructs a remote Python process to execute a ``.py`` file. However, " +"this section does not document the usage of that function. Instead, it " +"provides a detailed explanation of the underlying protocol, which takes as " +"input the ``pid`` of a target Python process and the path to a Python source " +"file to be executed. This information supports independent reimplementation " +"of the protocol, regardless of programming language." +msgstr "" + +#: howto/remote_debugging.rst:91 +msgid "" +"The execution of the injected script depends on the interpreter reaching a " +"safe evaluation point. As a result, execution may be delayed depending on " +"the runtime state of the target process." +msgstr "" + +#: howto/remote_debugging.rst:95 +msgid "" +"Once injected, the script is executed by the interpreter within the target " +"process the next time a safe evaluation point is reached. This approach " +"enables remote execution capabilities without modifying the behavior or " +"structure of the running Python application." +msgstr "" + +#: howto/remote_debugging.rst:100 +msgid "" +"Subsequent sections provide a step-by-step description of the protocol, " +"including techniques for locating interpreter structures in memory, safely " +"accessing internal fields, and triggering code execution. Platform-specific " +"variations are noted where applicable, and example implementations are " +"included to clarify each operation." +msgstr "" + +#: howto/remote_debugging.rst:107 +msgid "Locating the PyRuntime structure" +msgstr "" + +#: howto/remote_debugging.rst:109 +msgid "" +"CPython places the ``PyRuntime`` structure in a dedicated binary section to " +"help external tools find it at runtime. The name and format of this section " +"vary by platform. For example, ``.PyRuntime`` is used on ELF systems, and " +"``__DATA,__PyRuntime`` is used on macOS. Tools can find the offset of this " +"structure by examining the binary on disk." +msgstr "" + +#: howto/remote_debugging.rst:115 +msgid "" +"The ``PyRuntime`` structure contains CPython’s global interpreter state and " +"provides access to other internal data, including the list of interpreters, " +"thread states, and debugger support fields." +msgstr "" + +#: howto/remote_debugging.rst:119 +msgid "" +"To work with a remote Python process, a debugger must first find the memory " +"address of the ``PyRuntime`` structure in the target process. This address " +"can’t be hardcoded or calculated from a symbol name, because it depends on " +"where the operating system loaded the binary." +msgstr "" + +#: howto/remote_debugging.rst:124 +msgid "" +"The method for finding ``PyRuntime`` depends on the platform, but the steps " +"are the same in general:" +msgstr "" + +#: howto/remote_debugging.rst:127 +msgid "" +"Find the base address where the Python binary or shared library was loaded " +"in the target process." +msgstr "" + +#: howto/remote_debugging.rst:129 +msgid "" +"Use the on-disk binary to locate the offset of the ``.PyRuntime`` section." +msgstr "" + +#: howto/remote_debugging.rst:130 +msgid "" +"Add the section offset to the base address to compute the address in memory." +msgstr "" + +#: howto/remote_debugging.rst:132 +msgid "" +"The sections below explain how to do this on each supported platform and " +"include example code." +msgstr "" + +#: howto/remote_debugging.rst:136 +msgid "Linux (ELF)" +msgstr "" + +#: howto/remote_debugging.rst:137 +msgid "To find the ``PyRuntime`` structure on Linux:" +msgstr "" + +#: howto/remote_debugging.rst:139 +msgid "" +"Read the process’s memory map (for example, ``/proc//maps``) to find " +"the address where the Python executable or ``libpython`` was loaded." +msgstr "" + +#: howto/remote_debugging.rst:141 +msgid "" +"Parse the ELF section headers in the binary to get the offset of the ``." +"PyRuntime`` section." +msgstr "" + +#: howto/remote_debugging.rst:143 +msgid "" +"Add that offset to the base address from step 1 to get the memory address of " +"``PyRuntime``." +msgstr "" + +#: howto/remote_debugging.rst:208 howto/remote_debugging.rst:547 +msgid "The following is an example implementation::" +msgstr "" + +#: howto/remote_debugging.rst:148 +msgid "" +"def find_py_runtime_linux(pid: int) -> int:\n" +" # Step 1: Try to find the Python executable in memory\n" +" binary_path, base_address = find_mapped_binary(\n" +" pid, name_contains=\"python\"\n" +" )\n" +"\n" +" # Step 2: Fallback to shared library if executable is not found\n" +" if binary_path is None:\n" +" binary_path, base_address = find_mapped_binary(\n" +" pid, name_contains=\"libpython\"\n" +" )\n" +"\n" +" # Step 3: Parse ELF headers to get .PyRuntime section offset\n" +" section_offset = parse_elf_section_offset(\n" +" binary_path, \".PyRuntime\"\n" +" )\n" +"\n" +" # Step 4: Compute PyRuntime address in memory\n" +" return base_address + section_offset" +msgstr "" + +#: howto/remote_debugging.rst:169 +msgid "" +"On Linux systems, there are two main approaches to read memory from another " +"process. The first is through the ``/proc`` filesystem, specifically by " +"reading from ``/proc/[pid]/mem`` which provides direct access to the " +"process's memory. This requires appropriate permissions - either being the " +"same user as the target process or having root access. The second approach " +"is using the ``process_vm_readv()`` system call which provides a more " +"efficient way to copy memory between processes. While ptrace's " +"``PTRACE_PEEKTEXT`` operation can also be used to read memory, it is " +"significantly slower as it only reads one word at a time and requires " +"multiple context switches between the tracer and tracee processes." +msgstr "" + +#: howto/remote_debugging.rst:180 +msgid "" +"For parsing ELF sections, the process involves reading and interpreting the " +"ELF file format structures from the binary file on disk. The ELF header " +"contains a pointer to the section header table. Each section header contains " +"metadata about a section including its name (stored in a separate string " +"table), offset, and size. To find a specific section like .PyRuntime, you " +"need to walk through these headers and match the section name. The section " +"header then provides the offset where that section exists in the file, which " +"can be used to calculate its runtime address when the binary is loaded into " +"memory." +msgstr "" + +#: howto/remote_debugging.rst:189 +msgid "" +"You can read more about the ELF file format in the `ELF specification " +"`_." +msgstr "" + +#: howto/remote_debugging.rst:194 +msgid "macOS (Mach-O)" +msgstr "" + +#: howto/remote_debugging.rst:195 +msgid "To find the ``PyRuntime`` structure on macOS:" +msgstr "" + +#: howto/remote_debugging.rst:197 +msgid "" +"Call ``task_for_pid()`` to get the ``mach_port_t`` task port for the target " +"process. This handle is needed to read memory using APIs like " +"``mach_vm_read_overwrite`` and ``mach_vm_region``." +msgstr "" + +#: howto/remote_debugging.rst:200 +msgid "" +"Scan the memory regions to find the one containing the Python executable or " +"``libpython``." +msgstr "" + +#: howto/remote_debugging.rst:202 +msgid "" +"Load the binary file from disk and parse the Mach-O headers to find the " +"section named ``PyRuntime`` in the ``__DATA`` segment. On macOS, symbol " +"names are automatically prefixed with an underscore, so the ``PyRuntime`` " +"symbol appears as ``_PyRuntime`` in the symbol table, but the section name " +"is not affected." +msgstr "" + +#: howto/remote_debugging.rst:210 +msgid "" +"def find_py_runtime_macos(pid: int) -> int:\n" +" # Step 1: Get access to the process's memory\n" +" handle = get_memory_access_handle(pid)\n" +"\n" +" # Step 2: Try to find the Python executable in memory\n" +" binary_path, base_address = find_mapped_binary(\n" +" handle, name_contains=\"python\"\n" +" )\n" +"\n" +" # Step 3: Fallback to libpython if the executable is not found\n" +" if binary_path is None:\n" +" binary_path, base_address = find_mapped_binary(\n" +" handle, name_contains=\"libpython\"\n" +" )\n" +"\n" +" # Step 4: Parse Mach-O headers to get __DATA,__PyRuntime section offset\n" +" section_offset = parse_macho_section_offset(\n" +" binary_path, \"__DATA\", \"__PyRuntime\"\n" +" )\n" +"\n" +" # Step 5: Compute the PyRuntime address in memory\n" +" return base_address + section_offset" +msgstr "" + +#: howto/remote_debugging.rst:233 +msgid "" +"On macOS, accessing another process's memory requires using Mach-O specific " +"APIs and file formats. The first step is obtaining a ``task_port`` handle " +"via ``task_for_pid()``, which provides access to the target process's memory " +"space. This handle enables memory operations through APIs like " +"``mach_vm_read_overwrite()``." +msgstr "" + +#: howto/remote_debugging.rst:239 +msgid "" +"The process memory can be examined using ``mach_vm_region()`` to scan " +"through the virtual memory space, while ``proc_regionfilename()`` helps " +"identify which binary files are loaded at each memory region. When the " +"Python binary or library is found, its Mach-O headers need to be parsed to " +"locate the ``PyRuntime`` structure." +msgstr "" + +#: howto/remote_debugging.rst:244 +msgid "" +"The Mach-O format organizes code and data into segments and sections. The " +"``PyRuntime`` structure lives in a section named ``__PyRuntime`` within the " +"``__DATA`` segment. The actual runtime address calculation involves finding " +"the ``__TEXT`` segment which serves as the binary's base address, then " +"locating the ``__DATA`` segment containing our target section. The final " +"address is computed by combining the base address with the appropriate " +"section offsets from the Mach-O headers." +msgstr "" + +#: howto/remote_debugging.rst:252 +msgid "" +"Note that accessing another process's memory on macOS typically requires " +"elevated privileges - either root access or special security entitlements " +"granted to the debugging process." +msgstr "" + +#: howto/remote_debugging.rst:258 +msgid "Windows (PE)" +msgstr "" + +#: howto/remote_debugging.rst:259 +msgid "To find the ``PyRuntime`` structure on Windows:" +msgstr "" + +#: howto/remote_debugging.rst:261 +msgid "" +"Use the ToolHelp API to enumerate all modules loaded in the target process. " +"This is done using functions such as `CreateToolhelp32Snapshot `_, `Module32First `_, and " +"`Module32Next `_." +msgstr "" + +#: howto/remote_debugging.rst:268 +msgid "" +"Identify the module corresponding to :file:`python.exe` or :file:`python{XY}." +"dll`, where ``X`` and ``Y`` are the major and minor version numbers of the " +"Python version, and record its base address." +msgstr "" + +#: howto/remote_debugging.rst:271 +msgid "" +"Locate the ``PyRuntim`` section. Due to the PE format's 8-character limit on " +"section names (defined as ``IMAGE_SIZEOF_SHORT_NAME``), the original name " +"``PyRuntime`` is truncated. This section contains the ``PyRuntime`` " +"structure." +msgstr "" + +#: howto/remote_debugging.rst:275 +msgid "" +"Retrieve the section’s relative virtual address (RVA) and add it to the base " +"address of the module." +msgstr "" + +#: howto/remote_debugging.rst:280 +msgid "" +"def find_py_runtime_windows(pid: int) -> int:\n" +" # Step 1: Try to find the Python executable in memory\n" +" binary_path, base_address = find_loaded_module(\n" +" pid, name_contains=\"python\"\n" +" )\n" +"\n" +" # Step 2: Fallback to shared pythonXY.dll if the executable is not\n" +" # found\n" +" if binary_path is None:\n" +" binary_path, base_address = find_loaded_module(\n" +" pid, name_contains=\"python3\"\n" +" )\n" +"\n" +" # Step 3: Parse PE section headers to get the RVA of the PyRuntime\n" +" # section. The section name appears as \"PyRuntim\" due to the\n" +" # 8-character limit defined by the PE format (IMAGE_SIZEOF_SHORT_NAME).\n" +" section_rva = parse_pe_section_offset(binary_path, \"PyRuntim\")\n" +"\n" +" # Step 4: Compute PyRuntime address in memory\n" +" return base_address + section_rva" +msgstr "" + +#: howto/remote_debugging.rst:302 +msgid "" +"On Windows, accessing another process's memory requires using the Windows " +"API functions like ``CreateToolhelp32Snapshot()`` and ``Module32First()/" +"Module32Next()`` to enumerate loaded modules. The ``OpenProcess()`` function " +"provides a handle to access the target process's memory space, enabling " +"memory operations through ``ReadProcessMemory()``." +msgstr "" + +#: howto/remote_debugging.rst:308 +msgid "" +"The process memory can be examined by enumerating loaded modules to find the " +"Python binary or DLL. When found, its PE headers need to be parsed to locate " +"the ``PyRuntime`` structure." +msgstr "" + +#: howto/remote_debugging.rst:312 +msgid "" +"The PE format organizes code and data into sections. The ``PyRuntime`` " +"structure lives in a section named \"PyRuntim\" (truncated from " +"\"PyRuntime\" due to PE's 8-character name limit). The actual runtime " +"address calculation involves finding the module's base address from the " +"module entry, then locating our target section in the PE headers. The final " +"address is computed by combining the base address with the section's virtual " +"address from the PE section headers." +msgstr "" + +#: howto/remote_debugging.rst:319 +msgid "" +"Note that accessing another process's memory on Windows typically requires " +"appropriate privileges - either administrative access or the " +"``SeDebugPrivilege`` privilege granted to the debugging process." +msgstr "" + +#: howto/remote_debugging.rst:325 +msgid "Reading _Py_DebugOffsets" +msgstr "" + +#: howto/remote_debugging.rst:327 +msgid "" +"Once the address of the ``PyRuntime`` structure has been determined, the " +"next step is to read the ``_Py_DebugOffsets`` structure located at the " +"beginning of the ``PyRuntime`` block." +msgstr "" + +#: howto/remote_debugging.rst:331 +msgid "" +"This structure provides version-specific field offsets that are needed to " +"safely read interpreter and thread state memory. These offsets vary between " +"CPython versions and must be checked before use to ensure they are " +"compatible." +msgstr "" + +#: howto/remote_debugging.rst:335 +msgid "To read and check the debug offsets, follow these steps:" +msgstr "" + +#: howto/remote_debugging.rst:337 +msgid "" +"Read memory from the target process starting at the ``PyRuntime`` address, " +"covering the same number of bytes as the ``_Py_DebugOffsets`` structure. " +"This structure is located at the very start of the ``PyRuntime`` memory " +"block. Its layout is defined in CPython’s internal headers and stays the " +"same within a given minor version, but may change in major versions." +msgstr "" + +#: howto/remote_debugging.rst:343 +msgid "Check that the structure contains valid data:" +msgstr "" + +#: howto/remote_debugging.rst:345 +msgid "The ``cookie`` field must match the expected debug marker." +msgstr "" + +#: howto/remote_debugging.rst:346 +msgid "" +"The ``version`` field must match the version of the Python interpreter used " +"by the debugger." +msgstr "" + +#: howto/remote_debugging.rst:348 +msgid "" +"If either the debugger or the target process is using a pre-release version " +"(for example, an alpha, beta, or release candidate), the versions must match " +"exactly." +msgstr "" + +#: howto/remote_debugging.rst:351 +msgid "" +"The ``free_threaded`` field must have the same value in both the debugger " +"and the target process." +msgstr "" + +#: howto/remote_debugging.rst:354 +msgid "" +"If the structure is valid, the offsets it contains can be used to locate " +"fields in memory. If any check fails, the debugger should stop the operation " +"to avoid reading memory in the wrong format." +msgstr "" + +#: howto/remote_debugging.rst:358 +msgid "" +"The following is an example implementation that reads and checks " +"``_Py_DebugOffsets``::" +msgstr "" + +#: howto/remote_debugging.rst:361 +msgid "" +"def read_debug_offsets(pid: int, py_runtime_addr: int) -> DebugOffsets:\n" +" # Step 1: Read memory from the target process at the PyRuntime address\n" +" data = read_process_memory(\n" +" pid, address=py_runtime_addr, size=DEBUG_OFFSETS_SIZE\n" +" )\n" +"\n" +" # Step 2: Deserialize the raw bytes into a _Py_DebugOffsets structure\n" +" debug_offsets = parse_debug_offsets(data)\n" +"\n" +" # Step 3: Validate the contents of the structure\n" +" if debug_offsets.cookie != EXPECTED_COOKIE:\n" +" raise RuntimeError(\"Invalid or missing debug cookie\")\n" +" if debug_offsets.version != LOCAL_PYTHON_VERSION:\n" +" raise RuntimeError(\n" +" \"Mismatch between caller and target Python versions\"\n" +" )\n" +" if debug_offsets.free_threaded != LOCAL_FREE_THREADED:\n" +" raise RuntimeError(\"Mismatch in free-threaded configuration\")\n" +"\n" +" return debug_offsets" +msgstr "" + +#: howto/remote_debugging.rst:386 +msgid "**Process suspension recommended**" +msgstr "" + +#: howto/remote_debugging.rst:388 +msgid "" +"To avoid race conditions and ensure memory consistency, it is strongly " +"recommended that the target process be suspended before performing any " +"operations that read or write internal interpreter state. The Python runtime " +"may concurrently mutate interpreter data structures—such as creating or " +"destroying threads—during normal execution. This can result in invalid " +"memory reads or writes." +msgstr "" + +#: howto/remote_debugging.rst:395 +msgid "" +"A debugger may suspend execution by attaching to the process with ``ptrace`` " +"or by sending a ``SIGSTOP`` signal. Execution should only be resumed after " +"debugger-side memory operations are complete." +msgstr "" + +#: howto/remote_debugging.rst:401 +msgid "" +"Some tools, such as profilers or sampling-based debuggers, may operate on a " +"running process without suspension. In such cases, tools must be explicitly " +"designed to handle partially updated or inconsistent memory. For most " +"debugger implementations, suspending the process remains the safest and most " +"robust approach." +msgstr "" + +#: howto/remote_debugging.rst:409 +msgid "Locating the interpreter and thread state" +msgstr "" + +#: howto/remote_debugging.rst:411 +msgid "" +"Before code can be injected and executed in a remote Python process, the " +"debugger must choose a thread in which to schedule execution. This is " +"necessary because the control fields used to perform remote code injection " +"are located in the ``_PyRemoteDebuggerSupport`` structure, which is embedded " +"in a ``PyThreadState`` object. These fields are modified by the debugger to " +"request execution of injected scripts." +msgstr "" + +#: howto/remote_debugging.rst:418 +msgid "" +"The ``PyThreadState`` structure represents a thread running inside a Python " +"interpreter. It maintains the thread’s evaluation context and contains the " +"fields required for debugger coordination. Locating a valid " +"``PyThreadState`` is therefore a key prerequisite for triggering execution " +"remotely." +msgstr "" + +#: howto/remote_debugging.rst:423 +msgid "" +"A thread is typically selected based on its role or ID. In most cases, the " +"main thread is used, but some tools may target a specific thread by its " +"native thread ID. Once the target thread is chosen, the debugger must locate " +"both the interpreter and the associated thread state structures in memory." +msgstr "" + +#: howto/remote_debugging.rst:428 +msgid "The relevant internal structures are defined as follows:" +msgstr "" + +#: howto/remote_debugging.rst:430 +msgid "" +"``PyInterpreterState`` represents an isolated Python interpreter instance. " +"Each interpreter maintains its own set of imported modules, built-in state, " +"and thread state list. Although most Python applications use a single " +"interpreter, CPython supports multiple interpreters in the same process." +msgstr "" + +#: howto/remote_debugging.rst:435 +msgid "" +"``PyThreadState`` represents a thread running within an interpreter. It " +"contains execution state and the control fields used by the debugger." +msgstr "" + +#: howto/remote_debugging.rst:438 +msgid "To locate a thread:" +msgstr "" + +#: howto/remote_debugging.rst:440 +msgid "" +"Use the offset ``runtime_state.interpreters_head`` to obtain the address of " +"the first interpreter in the ``PyRuntime`` structure. This is the entry " +"point to the linked list of active interpreters." +msgstr "" + +#: howto/remote_debugging.rst:444 +msgid "" +"Use the offset ``interpreter_state.threads_main`` to access the main thread " +"state associated with the selected interpreter. This is typically the most " +"reliable thread to target." +msgstr "" + +#: howto/remote_debugging.rst:448 +msgid "" +"Optionally, use the offset ``interpreter_state.threads_head`` to iterate " +"through the linked list of all thread states. Each ``PyThreadState`` " +"structure contains a ``native_thread_id`` field, which may be compared to a " +"target thread ID to find a specific thread." +msgstr "" + +#: howto/remote_debugging.rst:453 +msgid "" +"Once a valid ``PyThreadState`` has been found, its address can be used in " +"later steps of the protocol, such as writing debugger control fields and " +"scheduling execution." +msgstr "" + +#: howto/remote_debugging.rst:457 +msgid "" +"The following is an example implementation that locates the main thread " +"state::" +msgstr "" + +#: howto/remote_debugging.rst:459 +msgid "" +"def find_main_thread_state(\n" +" pid: int, py_runtime_addr: int, debug_offsets: DebugOffsets,\n" +") -> int:\n" +" # Step 1: Read interpreters_head from PyRuntime\n" +" interp_head_ptr = (\n" +" py_runtime_addr + debug_offsets.runtime_state.interpreters_head\n" +" )\n" +" interp_addr = read_pointer(pid, interp_head_ptr)\n" +" if interp_addr == 0:\n" +" raise RuntimeError(\"No interpreter found in the target process\")\n" +"\n" +" # Step 2: Read the threads_main pointer from the interpreter\n" +" threads_main_ptr = (\n" +" interp_addr + debug_offsets.interpreter_state.threads_main\n" +" )\n" +" thread_state_addr = read_pointer(pid, threads_main_ptr)\n" +" if thread_state_addr == 0:\n" +" raise RuntimeError(\"Main thread state is not available\")\n" +"\n" +" return thread_state_addr" +msgstr "" + +#: howto/remote_debugging.rst:480 +msgid "" +"The following example demonstrates how to locate a thread by its native " +"thread ID::" +msgstr "" + +#: howto/remote_debugging.rst:483 +msgid "" +"def find_thread_by_id(\n" +" pid: int,\n" +" interp_addr: int,\n" +" debug_offsets: DebugOffsets,\n" +" target_tid: int,\n" +") -> int:\n" +" # Start at threads_head and walk the linked list\n" +" thread_ptr = read_pointer(\n" +" pid,\n" +" interp_addr + debug_offsets.interpreter_state.threads_head\n" +" )\n" +"\n" +" while thread_ptr:\n" +" native_tid_ptr = (\n" +" thread_ptr + debug_offsets.thread_state.native_thread_id\n" +" )\n" +" native_tid = read_int(pid, native_tid_ptr)\n" +" if native_tid == target_tid:\n" +" return thread_ptr\n" +" thread_ptr = read_pointer(\n" +" pid,\n" +" thread_ptr + debug_offsets.thread_state.next\n" +" )\n" +"\n" +" raise RuntimeError(\"Thread with the given ID was not found\")" +msgstr "" + +#: howto/remote_debugging.rst:510 +msgid "" +"Once a valid thread state has been located, the debugger can proceed with " +"modifying its control fields and scheduling execution, as described in the " +"next section." +msgstr "" + +#: howto/remote_debugging.rst:515 +msgid "Writing control information" +msgstr "" + +#: howto/remote_debugging.rst:517 +msgid "" +"Once a valid ``PyThreadState`` structure has been identified, the debugger " +"may modify control fields within it to schedule the execution of a specified " +"Python script. These control fields are checked periodically by the " +"interpreter, and when set correctly, they trigger the execution of remote " +"code at a safe point in the evaluation loop." +msgstr "" + +#: howto/remote_debugging.rst:523 +msgid "" +"Each ``PyThreadState`` contains a ``_PyRemoteDebuggerSupport`` structure " +"used for communication between the debugger and the interpreter. The " +"locations of its fields are defined by the ``_Py_DebugOffsets`` structure " +"and include the following:" +msgstr "" + +#: howto/remote_debugging.rst:528 +msgid "" +"``debugger_script_path``: A fixed-size buffer that holds the full path to a " +"Python source file (``.py``). This file must be accessible and readable by " +"the target process when execution is triggered." +msgstr "" + +#: howto/remote_debugging.rst:532 +msgid "" +"``debugger_pending_call``: An integer flag. Setting this to ``1`` tells the " +"interpreter that a script is ready to be executed." +msgstr "" + +#: howto/remote_debugging.rst:535 +msgid "" +"``eval_breaker``: A field checked by the interpreter during execution. " +"Setting bit 5 (``_PY_EVAL_PLEASE_STOP_BIT``, value ``1U << 5``) in this " +"field causes the interpreter to pause and check for debugger activity." +msgstr "" + +#: howto/remote_debugging.rst:539 +msgid "" +"To complete the injection, the debugger must perform the following steps:" +msgstr "" + +#: howto/remote_debugging.rst:541 +msgid "Write the full script path into the ``debugger_script_path`` buffer." +msgstr "" + +#: howto/remote_debugging.rst:542 +msgid "Set ``debugger_pending_call`` to ``1``." +msgstr "" + +#: howto/remote_debugging.rst:543 +msgid "" +"Read the current value of ``eval_breaker``, set bit 5 " +"(``_PY_EVAL_PLEASE_STOP_BIT``), and write the updated value back. This " +"signals the interpreter to check for debugger activity." +msgstr "" + +#: howto/remote_debugging.rst:549 +msgid "" +"def inject_script(\n" +" pid: int,\n" +" thread_state_addr: int,\n" +" debug_offsets: DebugOffsets,\n" +" script_path: str\n" +") -> None:\n" +" # Compute the base offset of _PyRemoteDebuggerSupport\n" +" support_base = (\n" +" thread_state_addr +\n" +" debug_offsets.debugger_support.remote_debugger_support\n" +" )\n" +"\n" +" # Step 1: Write the script path into debugger_script_path\n" +" script_path_ptr = (\n" +" support_base +\n" +" debug_offsets.debugger_support.debugger_script_path\n" +" )\n" +" write_string(pid, script_path_ptr, script_path)\n" +"\n" +" # Step 2: Set debugger_pending_call to 1\n" +" pending_ptr = (\n" +" support_base +\n" +" debug_offsets.debugger_support.debugger_pending_call\n" +" )\n" +" write_int(pid, pending_ptr, 1)\n" +"\n" +" # Step 3: Set _PY_EVAL_PLEASE_STOP_BIT (bit 5, value 1 << 5) in\n" +" # eval_breaker\n" +" eval_breaker_ptr = (\n" +" thread_state_addr +\n" +" debug_offsets.debugger_support.eval_breaker\n" +" )\n" +" breaker = read_int(pid, eval_breaker_ptr)\n" +" breaker |= (1 << 5)\n" +" write_int(pid, eval_breaker_ptr, breaker)" +msgstr "" + +#: howto/remote_debugging.rst:586 +msgid "" +"Once these fields are set, the debugger may resume the process (if it was " +"suspended). The interpreter will process the request at the next safe " +"evaluation point, load the script from disk, and execute it." +msgstr "" + +#: howto/remote_debugging.rst:590 +msgid "" +"It is the responsibility of the debugger to ensure that the script file " +"remains present and accessible to the target process during execution." +msgstr "" + +#: howto/remote_debugging.rst:595 +msgid "" +"Script execution is asynchronous. The script file cannot be deleted " +"immediately after injection. The debugger should wait until the injected " +"script has produced an observable effect before removing the file. This " +"effect depends on what the script is designed to do. For example, a debugger " +"might wait until the remote process connects back to a socket before " +"removing the script. Once such an effect is observed, it is safe to assume " +"the file is no longer needed." +msgstr "" + +#: howto/remote_debugging.rst:604 +msgid "Summary" +msgstr "" + +#: howto/remote_debugging.rst:606 +msgid "To inject and execute a Python script in a remote process:" +msgstr "" + +#: howto/remote_debugging.rst:608 +msgid "Locate the ``PyRuntime`` structure in the target process’s memory." +msgstr "" + +#: howto/remote_debugging.rst:609 +msgid "" +"Read and validate the ``_Py_DebugOffsets`` structure at the beginning of " +"``PyRuntime``." +msgstr "" + +#: howto/remote_debugging.rst:611 +msgid "Use the offsets to locate a valid ``PyThreadState``." +msgstr "" + +#: howto/remote_debugging.rst:612 +msgid "Write the path to a Python script into ``debugger_script_path``." +msgstr "" + +#: howto/remote_debugging.rst:613 +msgid "Set the ``debugger_pending_call`` flag to ``1``." +msgstr "" + +#: howto/remote_debugging.rst:614 +msgid "Set ``_PY_EVAL_PLEASE_STOP_BIT`` in the ``eval_breaker`` field." +msgstr "" + +#: howto/remote_debugging.rst:615 +msgid "" +"Resume the process (if suspended). The script will execute at the next safe " +"evaluation point." +msgstr "" diff --git a/howto/sockets.po b/howto/sockets.po index 953c106c..e32aebc0 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -99,6 +100,14 @@ msgid "" "page, your browser did something like the following::" msgstr "" +#: howto/sockets.rst:59 +msgid "" +"# create an INET, STREAMing socket\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"# now connect to the web server on port 80 - the normal http port\n" +"s.connect((\"www.python.org\", 80))" +msgstr "" + #: howto/sockets.rst:64 msgid "" "When the ``connect`` completes, the socket ``s`` can be used to send in a " @@ -113,6 +122,16 @@ msgid "" "creates a \"server socket\"::" msgstr "" +#: howto/sockets.rst:73 +msgid "" +"# create an INET, STREAMing socket\n" +"serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"# bind the socket to a public host, and a well-known port\n" +"serversocket.bind((socket.gethostname(), 80))\n" +"# become a server socket\n" +"serversocket.listen(5)" +msgstr "" + #: howto/sockets.rst:80 msgid "" "A couple things to notice: we used ``socket.gethostname()`` so that the " @@ -144,6 +163,17 @@ msgid "" "mainloop of the web server::" msgstr "" +#: howto/sockets.rst:98 +msgid "" +"while True:\n" +" # accept connections from outside\n" +" (clientsocket, address) = serversocket.accept()\n" +" # now do something with the clientsocket\n" +" # in this case, we'll pretend this is a threaded server\n" +" ct = make_client_thread(clientsocket)\n" +" ct.start()" +msgstr "" + #: howto/sockets.rst:106 msgid "" "There's actually 3 general ways in which this loop could work - dispatching " @@ -252,6 +282,43 @@ msgid "" "fixed length message::" msgstr "" +#: howto/sockets.rst:183 +msgid "" +"class MySocket:\n" +" \"\"\"demonstration class only\n" +" - coded for clarity, not efficiency\n" +" \"\"\"\n" +"\n" +" def __init__(self, sock=None):\n" +" if sock is None:\n" +" self.sock = socket.socket(\n" +" socket.AF_INET, socket.SOCK_STREAM)\n" +" else:\n" +" self.sock = sock\n" +"\n" +" def connect(self, host, port):\n" +" self.sock.connect((host, port))\n" +"\n" +" def mysend(self, msg):\n" +" totalsent = 0\n" +" while totalsent < MSGLEN:\n" +" sent = self.sock.send(msg[totalsent:])\n" +" if sent == 0:\n" +" raise RuntimeError(\"socket connection broken\")\n" +" totalsent = totalsent + sent\n" +"\n" +" def myreceive(self):\n" +" chunks = []\n" +" bytes_recd = 0\n" +" while bytes_recd < MSGLEN:\n" +" chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048))\n" +" if chunk == b'':\n" +" raise RuntimeError(\"socket connection broken\")\n" +" chunks.append(chunk)\n" +" bytes_recd = bytes_recd + len(chunk)\n" +" return b''.join(chunks)" +msgstr "" + #: howto/sockets.rst:217 msgid "" "The sending code here is usable for almost any messaging scheme - in Python " @@ -433,6 +500,16 @@ msgid "" "Python, you'll have little trouble with it in C::" msgstr "" +#: howto/sockets.rst:345 +msgid "" +"ready_to_read, ready_to_write, in_error = \\\n" +" select.select(\n" +" potential_readers,\n" +" potential_writers,\n" +" potential_errs,\n" +" timeout)" +msgstr "" + #: howto/sockets.rst:352 msgid "" "You pass ``select`` three lists: the first contains all sockets that you " diff --git a/howto/sorting.po b/howto/sorting.po index 1c7ca146..56cabefb 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -51,6 +52,12 @@ msgid "" "It returns a new sorted list:" msgstr "" +#: howto/sorting.rst:22 +msgid "" +">>> sorted([5, 2, 3, 1, 4])\n" +"[1, 2, 3, 4, 5]" +msgstr "" + #: howto/sorting.rst:27 msgid "" "You can also use the :meth:`list.sort` method. It modifies the list in-place " @@ -59,28 +66,51 @@ msgid "" "more efficient." msgstr "" +#: howto/sorting.rst:32 +msgid "" +">>> a = [5, 2, 3, 1, 4]\n" +">>> a.sort()\n" +">>> a\n" +"[1, 2, 3, 4, 5]" +msgstr "" + #: howto/sorting.rst:39 msgid "" "Another difference is that the :meth:`list.sort` method is only defined for " "lists. In contrast, the :func:`sorted` function accepts any iterable." msgstr "" +#: howto/sorting.rst:42 +msgid "" +">>> sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})\n" +"[1, 2, 3, 4, 5]" +msgstr "" + #: howto/sorting.rst:48 msgid "Key Functions" msgstr "" #: howto/sorting.rst:50 msgid "" -"Both :meth:`list.sort` and :func:`sorted` have a *key* parameter to specify " -"a function (or other callable) to be called on each list element prior to " -"making comparisons." +"The :meth:`list.sort` method and the functions :func:`sorted`, :func:`min`, :" +"func:`max`, :func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* " +"parameter to specify a function (or other callable) to be called on each " +"list element prior to making comparisons." msgstr "" -#: howto/sorting.rst:54 -msgid "For example, here's a case-insensitive string comparison:" +#: howto/sorting.rst:56 +msgid "" +"For example, here's a case-insensitive string comparison using :meth:`str." +"casefold`:" msgstr "" -#: howto/sorting.rst:61 +#: howto/sorting.rst:59 +msgid "" +">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" +"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" +msgstr "" + +#: howto/sorting.rst:64 msgid "" "The value of the *key* parameter should be a function (or other callable) " "that takes a single argument and returns a key to use for sorting purposes. " @@ -88,29 +118,60 @@ msgid "" "each input record." msgstr "" -#: howto/sorting.rst:66 +#: howto/sorting.rst:69 msgid "" "A common pattern is to sort complex objects using some of the object's " "indices as keys. For example:" msgstr "" -#: howto/sorting.rst:79 +#: howto/sorting.rst:72 +msgid "" +">>> student_tuples = [\n" +"... ('john', 'A', 15),\n" +"... ('jane', 'B', 12),\n" +"... ('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_tuples, key=lambda student: student[2]) # sort by age\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" +msgstr "" + +#: howto/sorting.rst:82 msgid "" "The same technique works for objects with named attributes. For example:" msgstr "" -#: howto/sorting.rst:99 +#: howto/sorting.rst:84 +msgid "" +">>> class Student:\n" +"... def __init__(self, name, grade, age):\n" +"... self.name = name\n" +"... self.grade = grade\n" +"... self.age = age\n" +"... def __repr__(self):\n" +"... return repr((self.name, self.grade, self.age))\n" +"\n" +">>> student_objects = [\n" +"... Student('john', 'A', 15),\n" +"... Student('jane', 'B', 12),\n" +"... Student('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_objects, key=lambda student: student.age) # sort by " +"age\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" +msgstr "" + +#: howto/sorting.rst:102 msgid "" "Objects with named attributes can be made by a regular class as shown above, " "or they can be instances of :class:`~dataclasses.dataclass` or a :term:" "`named tuple`." msgstr "" -#: howto/sorting.rst:104 +#: howto/sorting.rst:107 msgid "Operator Module Functions and Partial Function Evaluation" msgstr "" -#: howto/sorting.rst:106 +#: howto/sorting.rst:109 msgid "" "The :term:`key function` patterns shown above are very common, so Python " "provides convenience functions to make accessor functions easier and faster. " @@ -118,17 +179,37 @@ msgid "" "`~operator.attrgetter`, and a :func:`~operator.methodcaller` function." msgstr "" -#: howto/sorting.rst:111 +#: howto/sorting.rst:114 msgid "Using those functions, the above examples become simpler and faster:" msgstr "" -#: howto/sorting.rst:123 +#: howto/sorting.rst:116 +msgid "" +">>> from operator import itemgetter, attrgetter\n" +"\n" +">>> sorted(student_tuples, key=itemgetter(2))\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n" +"\n" +">>> sorted(student_objects, key=attrgetter('age'))\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" +msgstr "" + +#: howto/sorting.rst:126 msgid "" "The operator module functions allow multiple levels of sorting. For example, " "to sort by *grade* then by *age*:" msgstr "" -#: howto/sorting.rst:134 +#: howto/sorting.rst:129 +msgid "" +">>> sorted(student_tuples, key=itemgetter(1,2))\n" +"[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]\n" +"\n" +">>> sorted(student_objects, key=attrgetter('grade', 'age'))\n" +"[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]" +msgstr "" + +#: howto/sorting.rst:137 msgid "" "The :mod:`functools` module provides another helpful tool for making key-" "functions. The :func:`~functools.partial` function can reduce the `arity " @@ -136,103 +217,162 @@ msgid "" "it suitable for use as a key-function." msgstr "" -#: howto/sorting.rst:153 +#: howto/sorting.rst:142 +msgid "" +">>> from functools import partial\n" +">>> from unicodedata import normalize\n" +"\n" +">>> names = 'Zoë Åbjørn Núñez Élana Zeke Abe Nubia Eloise'.split()\n" +"\n" +">>> sorted(names, key=partial(normalize, 'NFD'))\n" +"['Abe', 'Åbjørn', 'Eloise', 'Élana', 'Nubia', 'Núñez', 'Zeke', 'Zoë']\n" +"\n" +">>> sorted(names, key=partial(normalize, 'NFC'))\n" +"['Abe', 'Eloise', 'Nubia', 'Núñez', 'Zeke', 'Zoë', 'Åbjørn', 'Élana']" +msgstr "" + +#: howto/sorting.rst:156 msgid "Ascending and Descending" msgstr "" -#: howto/sorting.rst:155 +#: howto/sorting.rst:158 msgid "" "Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with " "a boolean value. This is used to flag descending sorts. For example, to get " "the student data in reverse *age* order:" msgstr "" -#: howto/sorting.rst:168 +#: howto/sorting.rst:162 +msgid "" +">>> sorted(student_tuples, key=itemgetter(2), reverse=True)\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]\n" +"\n" +">>> sorted(student_objects, key=attrgetter('age'), reverse=True)\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" +msgstr "" + +#: howto/sorting.rst:171 msgid "Sort Stability and Complex Sorts" msgstr "" -#: howto/sorting.rst:170 +#: howto/sorting.rst:173 msgid "" "Sorts are guaranteed to be `stable `_\\. That means that when multiple records have " "the same key, their original order is preserved." msgstr "" -#: howto/sorting.rst:180 +#: howto/sorting.rst:177 +msgid "" +">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" +">>> sorted(data, key=itemgetter(0))\n" +"[('blue', 1), ('blue', 2), ('red', 1), ('red', 2)]" +msgstr "" + +#: howto/sorting.rst:183 msgid "" "Notice how the two records for *blue* retain their original order so that " "``('blue', 1)`` is guaranteed to precede ``('blue', 2)``." msgstr "" -#: howto/sorting.rst:183 +#: howto/sorting.rst:186 msgid "" "This wonderful property lets you build complex sorts in a series of sorting " "steps. For example, to sort the student data by descending *grade* and then " "ascending *age*, do the *age* sort first and then sort again using *grade*:" msgstr "" -#: howto/sorting.rst:193 +#: howto/sorting.rst:190 +msgid "" +">>> s = sorted(student_objects, key=attrgetter('age')) # sort on " +"secondary key\n" +">>> sorted(s, key=attrgetter('grade'), reverse=True) # now sort on " +"primary key, descending\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" +msgstr "" + +#: howto/sorting.rst:196 msgid "" "This can be abstracted out into a wrapper function that can take a list and " "tuples of field and order to sort them on multiple passes." msgstr "" -#: howto/sorting.rst:206 +#: howto/sorting.rst:199 +msgid "" +">>> def multisort(xs, specs):\n" +"... for key, reverse in reversed(specs):\n" +"... xs.sort(key=attrgetter(key), reverse=reverse)\n" +"... return xs\n" +"\n" +">>> multisort(list(student_objects), (('grade', True), ('age', False)))\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" +msgstr "" + +#: howto/sorting.rst:209 msgid "" "The `Timsort `_ algorithm used in " "Python does multiple sorts efficiently because it can take advantage of any " "ordering already present in a dataset." msgstr "" -#: howto/sorting.rst:211 +#: howto/sorting.rst:214 msgid "Decorate-Sort-Undecorate" msgstr "" -#: howto/sorting.rst:213 +#: howto/sorting.rst:216 msgid "This idiom is called Decorate-Sort-Undecorate after its three steps:" msgstr "" -#: howto/sorting.rst:215 +#: howto/sorting.rst:218 msgid "" "First, the initial list is decorated with new values that control the sort " "order." msgstr "" -#: howto/sorting.rst:217 +#: howto/sorting.rst:220 msgid "Second, the decorated list is sorted." msgstr "" -#: howto/sorting.rst:219 +#: howto/sorting.rst:222 msgid "" "Finally, the decorations are removed, creating a list that contains only the " "initial values in the new order." msgstr "" -#: howto/sorting.rst:222 +#: howto/sorting.rst:225 msgid "" "For example, to sort the student data by *grade* using the DSU approach:" msgstr "" -#: howto/sorting.rst:231 +#: howto/sorting.rst:227 +msgid "" +">>> decorated = [(student.grade, i, student) for i, student in " +"enumerate(student_objects)]\n" +">>> decorated.sort()\n" +">>> [student for grade, i, student in decorated] # undecorate\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" +msgstr "" + +#: howto/sorting.rst:234 msgid "" "This idiom works because tuples are compared lexicographically; the first " "items are compared; if they are the same then the second items are compared, " "and so on." msgstr "" -#: howto/sorting.rst:235 +#: howto/sorting.rst:238 msgid "" "It is not strictly necessary in all cases to include the index *i* in the " "decorated list, but including it gives two benefits:" msgstr "" -#: howto/sorting.rst:238 +#: howto/sorting.rst:241 msgid "" "The sort is stable -- if two items have the same key, their order will be " "preserved in the sorted list." msgstr "" -#: howto/sorting.rst:241 +#: howto/sorting.rst:244 msgid "" "The original items do not have to be comparable because the ordering of the " "decorated tuples will be determined by at most the first two items. So for " @@ -240,30 +380,30 @@ msgid "" "sorted directly." msgstr "" -#: howto/sorting.rst:246 +#: howto/sorting.rst:249 msgid "" "Another name for this idiom is `Schwartzian transform `_\\, after Randal L. Schwartz, who " "popularized it among Perl programmers." msgstr "" -#: howto/sorting.rst:250 +#: howto/sorting.rst:253 msgid "" "Now that Python sorting provides key-functions, this technique is not often " "needed." msgstr "" -#: howto/sorting.rst:253 +#: howto/sorting.rst:256 msgid "Comparison Functions" msgstr "" -#: howto/sorting.rst:255 +#: howto/sorting.rst:258 msgid "" "Unlike key functions that return an absolute value for sorting, a comparison " "function computes the relative ordering for two inputs." msgstr "" -#: howto/sorting.rst:258 +#: howto/sorting.rst:261 msgid "" "For example, a `balance scale `_ compares two samples giving a " @@ -272,7 +412,7 @@ msgid "" "zero if the inputs are equal, or a positive value for greater-than." msgstr "" -#: howto/sorting.rst:265 +#: howto/sorting.rst:268 msgid "" "It is common to encounter comparison functions when translating algorithms " "from other languages. Also, some libraries provide comparison functions as " @@ -280,7 +420,7 @@ msgid "" "function." msgstr "" -#: howto/sorting.rst:269 +#: howto/sorting.rst:272 msgid "" "To accommodate those situations, Python provides :class:`functools." "cmp_to_key` to wrap the comparison function to make it usable as a key " @@ -288,10 +428,109 @@ msgid "" msgstr "" #: howto/sorting.rst:276 +msgid "sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order" +msgstr "" + +#: howto/sorting.rst:279 +msgid "Strategies For Unorderable Types and Values" +msgstr "" + +#: howto/sorting.rst:281 +msgid "" +"A number of type and value issues can arise when sorting. Here are some " +"strategies that can help:" +msgstr "" + +#: howto/sorting.rst:284 +msgid "Convert non-comparable input types to strings prior to sorting:" +msgstr "" + +#: howto/sorting.rst:286 +msgid "" +">>> data = ['twelve', '11', 10]\n" +">>> sorted(map(str, data))\n" +"['10', '11', 'twelve']" +msgstr "" + +#: howto/sorting.rst:292 +msgid "" +"This is needed because most cross-type comparisons raise a :exc:`TypeError`." +msgstr "" + +#: howto/sorting.rst:295 +msgid "Remove special values prior to sorting:" +msgstr "" + +#: howto/sorting.rst:297 +msgid "" +">>> from math import isnan\n" +">>> from itertools import filterfalse\n" +">>> data = [3.3, float('nan'), 1.1, 2.2]\n" +">>> sorted(filterfalse(isnan, data))\n" +"[1.1, 2.2, 3.3]" +msgstr "" + +#: howto/sorting.rst:305 +msgid "" +"This is needed because the `IEEE-754 standard `_ specifies that, \"Every NaN shall compare unordered with " +"everything, including itself.\"" +msgstr "" + +#: howto/sorting.rst:309 +msgid "Likewise, ``None`` can be stripped from datasets as well:" +msgstr "" + +#: howto/sorting.rst:311 +msgid "" +">>> data = [3.3, None, 1.1, 2.2]\n" +">>> sorted(x for x in data if x is not None)\n" +"[1.1, 2.2, 3.3]" +msgstr "" + +#: howto/sorting.rst:317 +msgid "This is needed because ``None`` is not comparable to other types." +msgstr "" + +#: howto/sorting.rst:319 +msgid "Convert mapping types into sorted item lists before sorting:" +msgstr "" + +#: howto/sorting.rst:321 +msgid "" +">>> data = [{'a': 1}, {'b': 2}]\n" +">>> sorted(data, key=lambda d: sorted(d.items()))\n" +"[{'a': 1}, {'b': 2}]" +msgstr "" + +#: howto/sorting.rst:327 +msgid "" +"This is needed because dict-to-dict comparisons raise a :exc:`TypeError`." +msgstr "" + +#: howto/sorting.rst:330 +msgid "Convert set types into sorted lists before sorting:" +msgstr "" + +#: howto/sorting.rst:332 +msgid "" +">>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}]\n" +">>> sorted(map(sorted, data))\n" +"[['a', 'b', 'c'], ['b', 'c', 'd']]" +msgstr "" + +#: howto/sorting.rst:338 +msgid "" +"This is needed because the elements contained in set types do not have a " +"deterministic order. For example, ``list({'a', 'b'})`` may produce either " +"``['a', 'b']`` or ``['b', 'a']``." +msgstr "" + +#: howto/sorting.rst:343 msgid "Odds and Ends" msgstr "" -#: howto/sorting.rst:278 +#: howto/sorting.rst:345 msgid "" "For locale aware sorting, use :func:`locale.strxfrm` for a key function or :" "func:`locale.strcoll` for a comparison function. This is necessary because " @@ -299,7 +538,7 @@ msgid "" "underlying alphabet is the same." msgstr "" -#: howto/sorting.rst:283 +#: howto/sorting.rst:350 msgid "" "The *reverse* parameter still maintains sort stability (so that records with " "equal keys retain the original order). Interestingly, that effect can be " @@ -307,14 +546,32 @@ msgid "" "function twice:" msgstr "" -#: howto/sorting.rst:297 +#: howto/sorting.rst:355 +msgid "" +">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" +">>> standard_way = sorted(data, key=itemgetter(0), reverse=True)\n" +">>> double_reversed = list(reversed(sorted(reversed(data), " +"key=itemgetter(0))))\n" +">>> assert standard_way == double_reversed\n" +">>> standard_way\n" +"[('red', 1), ('red', 2), ('blue', 1), ('blue', 2)]" +msgstr "" + +#: howto/sorting.rst:364 msgid "" "The sort routines use ``<`` when making comparisons between two objects. So, " "it is easy to add a standard sort order to a class by defining an :meth:" "`~object.__lt__` method:" msgstr "" -#: howto/sorting.rst:307 +#: howto/sorting.rst:368 +msgid "" +">>> Student.__lt__ = lambda self, other: self.age < other.age\n" +">>> sorted(student_objects)\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" +msgstr "" + +#: howto/sorting.rst:374 msgid "" "However, note that ``<`` can fall back to using :meth:`~object.__gt__` if :" "meth:`~object.__lt__` is not implemented (see :func:`object.__lt__` for " @@ -323,7 +580,7 @@ msgid "" "decorator is provided to make that task easier." msgstr "" -#: howto/sorting.rst:314 +#: howto/sorting.rst:381 msgid "" "Key functions need not depend directly on the objects being sorted. A key " "function can also access external resources. For instance, if the student " @@ -331,24 +588,32 @@ msgid "" "of student names:" msgstr "" -#: howto/sorting.rst:327 +#: howto/sorting.rst:386 +msgid "" +">>> students = ['dave', 'john', 'jane']\n" +">>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'}\n" +">>> sorted(students, key=newgrades.__getitem__)\n" +"['jane', 'dave', 'john']" +msgstr "" + +#: howto/sorting.rst:394 msgid "Partial Sorts" msgstr "" -#: howto/sorting.rst:329 +#: howto/sorting.rst:396 msgid "" "Some applications require only some of the data to be ordered. The standard " "library provides several tools that do less work than a full sort:" msgstr "" -#: howto/sorting.rst:332 +#: howto/sorting.rst:399 msgid "" ":func:`min` and :func:`max` return the smallest and largest values, " "respectively. These functions make a single pass over the input data and " "require almost no auxiliary memory." msgstr "" -#: howto/sorting.rst:336 +#: howto/sorting.rst:403 msgid "" ":func:`heapq.nsmallest` and :func:`heapq.nlargest` return the *n* smallest " "and largest values, respectively. These functions make a single pass over " @@ -357,7 +622,7 @@ msgid "" "fewer comparisons than a full sort." msgstr "" -#: howto/sorting.rst:342 +#: howto/sorting.rst:409 msgid "" ":func:`heapq.heappush` and :func:`heapq.heappop` create and maintain a " "partially sorted arrangement of data that keeps the smallest element at " diff --git a/howto/timerfd.po b/howto/timerfd.po new file mode 100644 index 00000000..d0eacf2b --- /dev/null +++ b/howto/timerfd.po @@ -0,0 +1,285 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: howto/timerfd.rst:5 +msgid "timer file descriptor HOWTO" +msgstr "" + +#: howto/timerfd.rst:0 +msgid "Release" +msgstr "" + +#: howto/timerfd.rst:7 +msgid "1.13" +msgstr "" + +#: howto/timerfd.rst:9 +msgid "" +"This HOWTO discusses Python's support for the linux timer file descriptor." +msgstr "" + +#: howto/timerfd.rst:13 +msgid "Examples" +msgstr "" + +#: howto/timerfd.rst:15 +msgid "" +"The following example shows how to use a timer file descriptor to execute a " +"function twice a second:" +msgstr "" + +#: howto/timerfd.rst:18 +msgid "" +"# Practical scripts should use really use a non-blocking timer,\n" +"# we use a blocking timer here for simplicity.\n" +"import os, time\n" +"\n" +"# Create the timer file descriptor\n" +"fd = os.timerfd_create(time.CLOCK_REALTIME)\n" +"\n" +"# Start the timer in 1 second, with an interval of half a second\n" +"os.timerfd_settime(fd, initial=1, interval=0.5)\n" +"\n" +"try:\n" +" # Process timer events four times.\n" +" for _ in range(4):\n" +" # read() will block until the timer expires\n" +" _ = os.read(fd, 8)\n" +" print(\"Timer expired\")\n" +"finally:\n" +" # Remember to close the timer file descriptor!\n" +" os.close(fd)" +msgstr "" + +#: howto/timerfd.rst:40 +msgid "" +"To avoid the precision loss caused by the :class:`float` type, timer file " +"descriptors allow specifying initial expiration and interval in integer " +"nanoseconds with ``_ns`` variants of the functions." +msgstr "" + +#: howto/timerfd.rst:44 +msgid "" +"This example shows how :func:`~select.epoll` can be used with timer file " +"descriptors to wait until the file descriptor is ready for reading:" +msgstr "" + +#: howto/timerfd.rst:47 +msgid "" +"import os, time, select, socket, sys\n" +"\n" +"# Create an epoll object\n" +"ep = select.epoll()\n" +"\n" +"# In this example, use loopback address to send \"stop\" command to the " +"server.\n" +"#\n" +"# $ telnet 127.0.0.1 1234\n" +"# Trying 127.0.0.1...\n" +"# Connected to 127.0.0.1.\n" +"# Escape character is '^]'.\n" +"# stop\n" +"# Connection closed by foreign host.\n" +"#\n" +"sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"sock.bind((\"127.0.0.1\", 1234))\n" +"sock.setblocking(False)\n" +"sock.listen(1)\n" +"ep.register(sock, select.EPOLLIN)\n" +"\n" +"# Create timer file descriptors in non-blocking mode.\n" +"num = 3\n" +"fds = []\n" +"for _ in range(num):\n" +" fd = os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)\n" +" fds.append(fd)\n" +" # Register the timer file descriptor for read events\n" +" ep.register(fd, select.EPOLLIN)\n" +"\n" +"# Start the timer with os.timerfd_settime_ns() in nanoseconds.\n" +"# Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc\n" +"for i, fd in enumerate(fds, start=1):\n" +" one_sec_in_nsec = 10**9\n" +" i = i * one_sec_in_nsec\n" +" os.timerfd_settime_ns(fd, initial=i//4, interval=i//4)\n" +"\n" +"timeout = 3\n" +"try:\n" +" conn = None\n" +" is_active = True\n" +" while is_active:\n" +" # Wait for the timer to expire for 3 seconds.\n" +" # epoll.poll() returns a list of (fd, event) pairs.\n" +" # fd is a file descriptor.\n" +" # sock and conn[=returned value of socket.accept()] are socket " +"objects, not file descriptors.\n" +" # So use sock.fileno() and conn.fileno() to get the file " +"descriptors.\n" +" events = ep.poll(timeout)\n" +"\n" +" # If more than one timer file descriptors are ready for reading at " +"once,\n" +" # epoll.poll() returns a list of (fd, event) pairs.\n" +" #\n" +" # In this example settings,\n" +" # 1st timer fires every 0.25 seconds in 0.25 seconds. (0.25, 0.5, " +"0.75, 1.0, ...)\n" +" # 2nd timer every 0.5 seconds in 0.5 seconds. (0.5, 1.0, 1.5, " +"2.0, ...)\n" +" # 3rd timer every 0.75 seconds in 0.75 seconds. (0.75, 1.5, 2.25, " +"3.0, ...)\n" +" #\n" +" # In 0.25 seconds, only 1st timer fires.\n" +" # In 0.5 seconds, 1st timer and 2nd timer fires at once.\n" +" # In 0.75 seconds, 1st timer and 3rd timer fires at once.\n" +" # In 1.5 seconds, 1st timer, 2nd timer and 3rd timer fires at " +"once.\n" +" #\n" +" # If a timer file descriptor is signaled more than once since\n" +" # the last os.read() call, os.read() returns the number of signaled\n" +" # as host order of class bytes.\n" +" print(f\"Signaled events={events}\")\n" +" for fd, event in events:\n" +" if event & select.EPOLLIN:\n" +" if fd == sock.fileno():\n" +" # Check if there is a connection request.\n" +" print(f\"Accepting connection {fd}\")\n" +" conn, addr = sock.accept()\n" +" conn.setblocking(False)\n" +" print(f\"Accepted connection {conn} from {addr}\")\n" +" ep.register(conn, select.EPOLLIN)\n" +" elif conn and fd == conn.fileno():\n" +" # Check if there is data to read.\n" +" print(f\"Reading data {fd}\")\n" +" data = conn.recv(1024)\n" +" if data:\n" +" # You should catch UnicodeDecodeError exception for " +"safety.\n" +" cmd = data.decode()\n" +" if cmd.startswith(\"stop\"):\n" +" print(f\"Stopping server\")\n" +" is_active = False\n" +" else:\n" +" print(f\"Unknown command: {cmd}\")\n" +" else:\n" +" # No more data, close connection\n" +" print(f\"Closing connection {fd}\")\n" +" ep.unregister(conn)\n" +" conn.close()\n" +" conn = None\n" +" elif fd in fds:\n" +" print(f\"Reading timer {fd}\")\n" +" count = int.from_bytes(os.read(fd, 8), byteorder=sys." +"byteorder)\n" +" print(f\"Timer {fds.index(fd) + 1} expired {count} " +"times\")\n" +" else:\n" +" print(f\"Unknown file descriptor {fd}\")\n" +"finally:\n" +" for fd in fds:\n" +" ep.unregister(fd)\n" +" os.close(fd)\n" +" ep.close()" +msgstr "" + +#: howto/timerfd.rst:153 +msgid "" +"This example shows how :func:`~select.select` can be used with timer file " +"descriptors to wait until the file descriptor is ready for reading:" +msgstr "" + +#: howto/timerfd.rst:156 +msgid "" +"import os, time, select, socket, sys\n" +"\n" +"# In this example, use loopback address to send \"stop\" command to the " +"server.\n" +"#\n" +"# $ telnet 127.0.0.1 1234\n" +"# Trying 127.0.0.1...\n" +"# Connected to 127.0.0.1.\n" +"# Escape character is '^]'.\n" +"# stop\n" +"# Connection closed by foreign host.\n" +"#\n" +"sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"sock.bind((\"127.0.0.1\", 1234))\n" +"sock.setblocking(False)\n" +"sock.listen(1)\n" +"\n" +"# Create timer file descriptors in non-blocking mode.\n" +"num = 3\n" +"fds = [os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)\n" +" for _ in range(num)]\n" +"select_fds = fds + [sock]\n" +"\n" +"# Start the timers with os.timerfd_settime() in seconds.\n" +"# Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc\n" +"for i, fd in enumerate(fds, start=1):\n" +" os.timerfd_settime(fd, initial=i/4, interval=i/4)\n" +"\n" +"timeout = 3\n" +"try:\n" +" conn = None\n" +" is_active = True\n" +" while is_active:\n" +" # Wait for the timer to expire for 3 seconds.\n" +" # select.select() returns a list of file descriptors or objects.\n" +" rfd, wfd, xfd = select.select(select_fds, select_fds, select_fds, " +"timeout)\n" +" for fd in rfd:\n" +" if fd == sock:\n" +" # Check if there is a connection request.\n" +" print(f\"Accepting connection {fd}\")\n" +" conn, addr = sock.accept()\n" +" conn.setblocking(False)\n" +" print(f\"Accepted connection {conn} from {addr}\")\n" +" select_fds.append(conn)\n" +" elif conn and fd == conn:\n" +" # Check if there is data to read.\n" +" print(f\"Reading data {fd}\")\n" +" data = conn.recv(1024)\n" +" if data:\n" +" # You should catch UnicodeDecodeError exception for " +"safety.\n" +" cmd = data.decode()\n" +" if cmd.startswith(\"stop\"):\n" +" print(f\"Stopping server\")\n" +" is_active = False\n" +" else:\n" +" print(f\"Unknown command: {cmd}\")\n" +" else:\n" +" # No more data, close connection\n" +" print(f\"Closing connection {fd}\")\n" +" select_fds.remove(conn)\n" +" conn.close()\n" +" conn = None\n" +" elif fd in fds:\n" +" print(f\"Reading timer {fd}\")\n" +" count = int.from_bytes(os.read(fd, 8), byteorder=sys." +"byteorder)\n" +" print(f\"Timer {fds.index(fd) + 1} expired {count} times\")\n" +" else:\n" +" print(f\"Unknown file descriptor {fd}\")\n" +"finally:\n" +" for fd in fds:\n" +" os.close(fd)\n" +" sock.close()\n" +" sock = None" +msgstr "" diff --git a/howto/unicode.po b/howto/unicode.po index 721f19d0..334ece98 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -89,6 +90,25 @@ msgid "" "corresponding code points:" msgstr "" +#: howto/unicode.rst:53 +msgid "" +"0061 'a'; LATIN SMALL LETTER A\n" +"0062 'b'; LATIN SMALL LETTER B\n" +"0063 'c'; LATIN SMALL LETTER C\n" +"...\n" +"007B '{'; LEFT CURLY BRACKET\n" +"...\n" +"2167 'Ⅷ'; ROMAN NUMERAL EIGHT\n" +"2168 'Ⅸ'; ROMAN NUMERAL NINE\n" +"...\n" +"265E '♞'; BLACK CHESS KNIGHT\n" +"265F '♟'; BLACK CHESS PAWN\n" +"...\n" +"1F600 '😀'; GRINNING FACE\n" +"1F609 '😉'; WINKING FACE\n" +"..." +msgstr "" + #: howto/unicode.rst:71 msgid "" "Strictly, these definitions imply that it's meaningless to say 'this is " @@ -129,6 +149,13 @@ msgid "" "representation, the string \"Python\" might look like this:" msgstr "" +#: howto/unicode.rst:101 +msgid "" +" P y t h o n\n" +"0x50 00 00 00 79 00 00 00 74 00 00 00 68 00 00 00 6f 00 00 00 6e 00 00 00\n" +" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23" +msgstr "" + #: howto/unicode.rst:107 msgid "" "This representation is straightforward but using it presents a number of " @@ -225,7 +252,7 @@ msgid "" "varies depending on the hardware on which the string was encoded." msgstr "" -#: howto/unicode.rst:514 howto/unicode.rst:735 +#: howto/unicode.rst:516 howto/unicode.rst:737 msgid "References" msgstr "" @@ -296,11 +323,28 @@ msgid "" "include a Unicode character in a string literal::" msgstr "" +#: howto/unicode.rst:199 +msgid "" +"try:\n" +" with open('/tmp/input.txt', 'r') as f:\n" +" ...\n" +"except OSError:\n" +" # 'File not found' error message.\n" +" print(\"Fichier non trouvé\")" +msgstr "" + #: howto/unicode.rst:206 msgid "" "Side note: Python 3 also supports using Unicode characters in identifiers::" msgstr "" +#: howto/unicode.rst:208 +msgid "" +"répertoire = \"/tmp/records.log\"\n" +"with open(répertoire, \"w\") as f:\n" +" f.write(\"test\\n\")" +msgstr "" + #: howto/unicode.rst:212 msgid "" "If you can't enter a particular character in your editor or want to keep the " @@ -309,6 +353,16 @@ msgid "" "delta glyph instead of a \\u escape.) ::" msgstr "" +#: howto/unicode.rst:217 +msgid "" +">>> \"\\N{GREEK CAPITAL LETTER DELTA}\" # Using the character name\n" +"'\\u0394'\n" +">>> \"\\u0394\" # Using a 16-bit hex value\n" +"'\\u0394'\n" +">>> \"\\U00000394\" # Using a 32-bit hex value\n" +"'\\u0394'" +msgstr "" + #: howto/unicode.rst:224 msgid "" "In addition, one can create a string using the :func:`~bytes.decode` method " @@ -327,6 +381,21 @@ msgid "" "examples show the differences::" msgstr "" +#: howto/unicode.rst:236 +msgid "" +">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\n" +" invalid start byte\n" +">>> b'\\x80abc'.decode(\"utf-8\", \"replace\")\n" +"'\\ufffdabc'\n" +">>> b'\\x80abc'.decode(\"utf-8\", \"backslashreplace\")\n" +"'\\\\x80abc'\n" +">>> b'\\x80abc'.decode(\"utf-8\", \"ignore\")\n" +"'abc'" +msgstr "" + #: howto/unicode.rst:248 msgid "" "Encodings are specified as strings containing the encoding's name. Python " @@ -345,6 +414,14 @@ msgid "" "returns the code point value::" msgstr "" +#: howto/unicode.rst:260 +msgid "" +">>> chr(57344)\n" +"'\\ue000'\n" +">>> ord('\\ue000')\n" +"57344" +msgstr "" + #: howto/unicode.rst:266 msgid "Converting to Bytes" msgstr "" @@ -371,6 +448,28 @@ msgstr "" msgid "The following example shows the different results::" msgstr "" +#: howto/unicode.rst:282 +msgid "" +">>> u = chr(40960) + 'abcd' + chr(1972)\n" +">>> u.encode('utf-8')\n" +"b'\\xea\\x80\\x80abcd\\xde\\xb4'\n" +">>> u.encode('ascii')\n" +"Traceback (most recent call last):\n" +" ...\n" +"UnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\n" +" position 0: ordinal not in range(128)\n" +">>> u.encode('ascii', 'ignore')\n" +"b'abcd'\n" +">>> u.encode('ascii', 'replace')\n" +"b'?abcd?'\n" +">>> u.encode('ascii', 'xmlcharrefreplace')\n" +"b'ꀀabcd޴'\n" +">>> u.encode('ascii', 'backslashreplace')\n" +"b'\\\\ua000abcd\\\\u07b4'\n" +">>> u.encode('ascii', 'namereplace')\n" +"b'\\\\N{YI SYLLABLE IT}abcd\\\\u07b4'" +msgstr "" + #: howto/unicode.rst:301 msgid "" "The low-level routines for registering and accessing the available encodings " @@ -393,6 +492,16 @@ msgid "" "digits, not four::" msgstr "" +#: howto/unicode.rst:317 +msgid "" +">>> s = \"a\\xac\\u1234\\u20ac\\U00008000\"\n" +"... # ^^^^ two-digit hex escape\n" +"... # ^^^^^^ four-digit Unicode escape\n" +"... # ^^^^^^^^^^ eight-digit Unicode escape\n" +">>> [ord(c) for c in s]\n" +"[97, 172, 4660, 8364, 32768]" +msgstr "" + #: howto/unicode.rst:324 msgid "" "Using escape sequences for code points greater than 127 is fine in small " @@ -418,6 +527,15 @@ msgid "" "file::" msgstr "" +#: howto/unicode.rst:339 +msgid "" +"#!/usr/bin/env python\n" +"# -*- coding: latin-1 -*-\n" +"\n" +"u = 'abcdé'\n" +"print(ord(u[-1]))" +msgstr "" + #: howto/unicode.rst:345 msgid "" "The syntax is inspired by Emacs's notation for specifying variables local to " @@ -433,11 +551,11 @@ msgid "" "as already mentioned. See also :pep:`263` for more information." msgstr "" -#: howto/unicode.rst:356 +#: howto/unicode.rst:358 msgid "Unicode Properties" msgstr "" -#: howto/unicode.rst:358 +#: howto/unicode.rst:360 msgid "" "The Unicode specification includes a database of information about code " "points. For each defined code point, the information includes the " @@ -447,17 +565,41 @@ msgid "" "related properties, such as how to use the code point in bidirectional text." msgstr "" -#: howto/unicode.rst:366 +#: howto/unicode.rst:368 msgid "" "The following program displays some information about several characters, " "and prints the numeric value of one particular character::" msgstr "" -#: howto/unicode.rst:380 +#: howto/unicode.rst:371 +msgid "" +"import unicodedata\n" +"\n" +"u = chr(233) + chr(0x0bf2) + chr(3972) + chr(6000) + chr(13231)\n" +"\n" +"for i, c in enumerate(u):\n" +" print(i, '%04x' % ord(c), unicodedata.category(c), end=\" \")\n" +" print(unicodedata.name(c))\n" +"\n" +"# Get numeric value of second character\n" +"print(unicodedata.numeric(u[1]))" +msgstr "" + +#: howto/unicode.rst:382 msgid "When run, this prints:" msgstr "" -#: howto/unicode.rst:391 +#: howto/unicode.rst:384 +msgid "" +"0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE\n" +"1 0bf2 No TAMIL NUMBER ONE THOUSAND\n" +"2 0f84 Mn TIBETAN MARK HALANTA\n" +"3 1770 Lo TAGBANWA LETTER SA\n" +"4 33af So SQUARE RAD OVER S SQUARED\n" +"1000.0" +msgstr "" + +#: howto/unicode.rst:393 msgid "" "The category codes are abbreviations describing the nature of the character. " "These are grouped into categories such as \"Letter\", \"Number\", " @@ -470,11 +612,11 @@ msgid "" "codes." msgstr "" -#: howto/unicode.rst:402 +#: howto/unicode.rst:404 msgid "Comparing Strings" msgstr "" -#: howto/unicode.rst:404 +#: howto/unicode.rst:406 msgid "" "Unicode adds some complication to comparing strings, because the same set of " "characters can be represented by different sequences of code points. For " @@ -484,7 +626,7 @@ msgid "" "when printed, but one is a string of length 1 and the other is of length 2." msgstr "" -#: howto/unicode.rst:412 +#: howto/unicode.rst:414 msgid "" "One tool for a case-insensitive comparison is the :meth:`~str.casefold` " "string method that converts a string to a case-insensitive form following an " @@ -493,7 +635,14 @@ msgid "" "which becomes the pair of lowercase letters 'ss'." msgstr "" -#: howto/unicode.rst:425 +#: howto/unicode.rst:423 +msgid "" +">>> street = 'Gürzenichstraße'\n" +">>> street.casefold()\n" +"'gürzenichstrasse'" +msgstr "" + +#: howto/unicode.rst:427 msgid "" "A second tool is the :mod:`unicodedata` module's :func:`~unicodedata." "normalize` function that converts strings to one of several normal forms, " @@ -503,22 +652,66 @@ msgid "" "combining characters differently:" msgstr "" -#: howto/unicode.rst:448 +#: howto/unicode.rst:436 +msgid "" +"import unicodedata\n" +"\n" +"def compare_strs(s1, s2):\n" +" def NFD(s):\n" +" return unicodedata.normalize('NFD', s)\n" +"\n" +" return NFD(s1) == NFD(s2)\n" +"\n" +"single_char = 'ê'\n" +"multiple_chars = '\\N{LATIN SMALL LETTER E}\\N{COMBINING CIRCUMFLEX " +"ACCENT}'\n" +"print('length of first string=', len(single_char))\n" +"print('length of second string=', len(multiple_chars))\n" +"print(compare_strs(single_char, multiple_chars))" +msgstr "" + +#: howto/unicode.rst:450 msgid "When run, this outputs:" msgstr "" -#: howto/unicode.rst:457 +#: howto/unicode.rst:452 +msgid "" +"$ python compare-strs.py\n" +"length of first string= 1\n" +"length of second string= 2\n" +"True" +msgstr "" + +#: howto/unicode.rst:459 msgid "" "The first argument to the :func:`~unicodedata.normalize` function is a " "string giving the desired normalization form, which can be one of 'NFC', " "'NFKC', 'NFD', and 'NFKD'." msgstr "" -#: howto/unicode.rst:461 +#: howto/unicode.rst:463 msgid "The Unicode Standard also specifies how to do caseless comparisons::" msgstr "" -#: howto/unicode.rst:477 +#: howto/unicode.rst:465 +msgid "" +"import unicodedata\n" +"\n" +"def compare_caseless(s1, s2):\n" +" def NFD(s):\n" +" return unicodedata.normalize('NFD', s)\n" +"\n" +" return NFD(NFD(s1).casefold()) == NFD(NFD(s2).casefold())\n" +"\n" +"# Example usage\n" +"single_char = 'ê'\n" +"multiple_chars = '\\N{LATIN CAPITAL LETTER E}\\N{COMBINING CIRCUMFLEX " +"ACCENT}'\n" +"\n" +"print(compare_caseless(single_char, multiple_chars))" +msgstr "" + +#: howto/unicode.rst:479 msgid "" "This will print ``True``. (Why is :func:`!NFD` invoked twice? Because " "there are a few characters that make :meth:`~str.casefold` return a non-" @@ -526,11 +719,11 @@ msgid "" "3.13 of the Unicode Standard for a discussion and an example.)" msgstr "" -#: howto/unicode.rst:484 +#: howto/unicode.rst:486 msgid "Unicode Regular Expressions" msgstr "" -#: howto/unicode.rst:486 +#: howto/unicode.rst:488 msgid "" "The regular expressions supported by the :mod:`re` module can be provided " "either as bytes or strings. Some of the special character sequences such as " @@ -540,57 +733,67 @@ msgid "" "in the ``'Nd'`` category." msgstr "" -#: howto/unicode.rst:493 +#: howto/unicode.rst:495 msgid "" "The string in this example has the number 57 written in both Thai and Arabic " "numerals::" msgstr "" -#: howto/unicode.rst:503 +#: howto/unicode.rst:498 +msgid "" +"import re\n" +"p = re.compile(r'\\d+')\n" +"\n" +"s = \"Over \\u0e55\\u0e57 57 flavours\"\n" +"m = p.search(s)\n" +"print(repr(m.group()))" +msgstr "" + +#: howto/unicode.rst:505 msgid "" "When executed, ``\\d+`` will match the Thai numerals and print them out. If " "you supply the :const:`re.ASCII` flag to :func:`~re.compile`, ``\\d+`` will " "match the substring \"57\" instead." msgstr "" -#: howto/unicode.rst:507 +#: howto/unicode.rst:509 msgid "" "Similarly, ``\\w`` matches a wide variety of Unicode characters but only " "``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied, and ``\\s`` " "will match either Unicode whitespace characters or ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: howto/unicode.rst:518 +#: howto/unicode.rst:520 msgid "Some good alternative discussions of Python's Unicode support are:" msgstr "" -#: howto/unicode.rst:520 +#: howto/unicode.rst:522 msgid "" "`Processing Text Files in Python 3 `_, by Nick Coghlan." msgstr "" -#: howto/unicode.rst:521 +#: howto/unicode.rst:523 msgid "" "`Pragmatic Unicode `_, a PyCon " "2012 presentation by Ned Batchelder." msgstr "" -#: howto/unicode.rst:523 +#: howto/unicode.rst:525 msgid "" "The :class:`str` type is described in the Python library reference at :ref:" "`textseq`." msgstr "" -#: howto/unicode.rst:526 +#: howto/unicode.rst:528 msgid "The documentation for the :mod:`unicodedata` module." msgstr "" -#: howto/unicode.rst:528 +#: howto/unicode.rst:530 msgid "The documentation for the :mod:`codecs` module." msgstr "" -#: howto/unicode.rst:530 +#: howto/unicode.rst:532 msgid "" "Marc-André Lemburg gave `a presentation titled \"Python and Unicode\" (PDF " "slides) `_ at " @@ -599,18 +802,18 @@ msgid "" "``unicode`` and literals start with ``u``)." msgstr "" -#: howto/unicode.rst:538 +#: howto/unicode.rst:540 msgid "Reading and Writing Unicode Data" msgstr "" -#: howto/unicode.rst:540 +#: howto/unicode.rst:542 msgid "" "Once you've written some code that works with Unicode data, the next problem " "is input/output. How do you get Unicode strings into your program, and how " "do you convert Unicode into a form suitable for storage or transmission?" msgstr "" -#: howto/unicode.rst:544 +#: howto/unicode.rst:546 msgid "" "It's possible that you may not need to do anything depending on your input " "sources and output destinations; you should check whether the libraries used " @@ -619,7 +822,7 @@ msgid "" "valued columns and can return Unicode values from an SQL query." msgstr "" -#: howto/unicode.rst:550 +#: howto/unicode.rst:552 msgid "" "Unicode data is usually converted to a particular encoding before it gets " "written to disk or sent over a socket. It's possible to do all the work " @@ -628,7 +831,7 @@ msgid "" "recommended." msgstr "" -#: howto/unicode.rst:555 +#: howto/unicode.rst:557 msgid "" "One problem is the multi-byte nature of encodings; one Unicode character can " "be represented by several bytes. If you want to read the file in arbitrary-" @@ -642,7 +845,7 @@ msgid "" "version in memory.)" msgstr "" -#: howto/unicode.rst:565 +#: howto/unicode.rst:567 msgid "" "The solution would be to use the low-level decoding interface to catch the " "case of partial coding sequences. The work of implementing this has already " @@ -654,17 +857,32 @@ msgid "" "meth:`str.encode` and :meth:`bytes.decode`." msgstr "" -#: howto/unicode.rst:574 +#: howto/unicode.rst:576 msgid "Reading Unicode from a file is therefore simple::" msgstr "" -#: howto/unicode.rst:580 +#: howto/unicode.rst:578 +msgid "" +"with open('unicode.txt', encoding='utf-8') as f:\n" +" for line in f:\n" +" print(repr(line))" +msgstr "" + +#: howto/unicode.rst:582 msgid "" "It's also possible to open files in update mode, allowing both reading and " "writing::" msgstr "" -#: howto/unicode.rst:588 +#: howto/unicode.rst:585 +msgid "" +"with open('test', encoding='utf-8', mode='w+') as f:\n" +" f.write('\\u4500 blah blah blah\\n')\n" +" f.seek(0)\n" +" print(repr(f.readline()[:1]))" +msgstr "" + +#: howto/unicode.rst:590 msgid "" "The Unicode character ``U+FEFF`` is used as a byte-order mark (BOM), and is " "often written as the first character of a file in order to assist with " @@ -677,7 +895,7 @@ msgid "" "the BOM." msgstr "" -#: howto/unicode.rst:597 +#: howto/unicode.rst:599 msgid "" "In some areas, it is also convention to use a \"BOM\" at the start of UTF-8 " "encoded files; the name is misleading since UTF-8 is not byte-order " @@ -686,11 +904,11 @@ msgid "" "if present." msgstr "" -#: howto/unicode.rst:604 +#: howto/unicode.rst:606 msgid "Unicode filenames" msgstr "" -#: howto/unicode.rst:606 +#: howto/unicode.rst:608 msgid "" "Most of the operating systems in common use today support filenames that " "contain arbitrary Unicode characters. Usually this is implemented by " @@ -703,7 +921,7 @@ msgid "" "encoding is again UTF-8." msgstr "" -#: howto/unicode.rst:616 +#: howto/unicode.rst:618 msgid "" "The :func:`sys.getfilesystemencoding` function returns the encoding to use " "on your current system, in case you want to do the encoding manually, but " @@ -712,13 +930,20 @@ msgid "" "and it will be automatically converted to the right encoding for you::" msgstr "" -#: howto/unicode.rst:626 +#: howto/unicode.rst:624 +msgid "" +"filename = 'filename\\u4500abc'\n" +"with open(filename, 'w') as f:\n" +" f.write('blah\\n')" +msgstr "" + +#: howto/unicode.rst:628 msgid "" "Functions in the :mod:`os` module such as :func:`os.stat` will also accept " "Unicode filenames." msgstr "" -#: howto/unicode.rst:629 +#: howto/unicode.rst:631 msgid "" "The :func:`os.listdir` function returns filenames, which raises an issue: " "should it return the Unicode version of filenames, or should it return bytes " @@ -731,17 +956,35 @@ msgid "" "error handler>` is UTF-8, running the following program::" msgstr "" -#: howto/unicode.rst:647 +#: howto/unicode.rst:641 +msgid "" +"fn = 'filename\\u4500abc'\n" +"f = open(fn, 'w')\n" +"f.close()\n" +"\n" +"import os\n" +"print(os.listdir(b'.'))\n" +"print(os.listdir('.'))" +msgstr "" + +#: howto/unicode.rst:649 msgid "will produce the following output:" msgstr "" -#: howto/unicode.rst:655 +#: howto/unicode.rst:651 +msgid "" +"$ python listdir-test.py\n" +"[b'filename\\xe4\\x94\\x80abc', ...]\n" +"['filename\\u4500abc', ...]" +msgstr "" + +#: howto/unicode.rst:657 msgid "" "The first list contains UTF-8-encoded filenames, and the second list " "contains the Unicode versions." msgstr "" -#: howto/unicode.rst:658 +#: howto/unicode.rst:660 msgid "" "Note that on most occasions, you should can just stick with using Unicode " "with these APIs. The bytes APIs should only be used on systems where " @@ -749,27 +992,27 @@ msgid "" "now." msgstr "" -#: howto/unicode.rst:665 +#: howto/unicode.rst:667 msgid "Tips for Writing Unicode-aware Programs" msgstr "" -#: howto/unicode.rst:667 +#: howto/unicode.rst:669 msgid "" "This section provides some suggestions on writing software that deals with " "Unicode." msgstr "" -#: howto/unicode.rst:670 +#: howto/unicode.rst:672 msgid "The most important tip is:" msgstr "" -#: howto/unicode.rst:672 +#: howto/unicode.rst:674 msgid "" "Software should only work with Unicode strings internally, decoding the " "input data as soon as possible and encoding the output only at the end." msgstr "" -#: howto/unicode.rst:675 +#: howto/unicode.rst:677 msgid "" "If you attempt to write processing functions that accept both Unicode and " "byte strings, you will find your program vulnerable to bugs wherever you " @@ -778,7 +1021,7 @@ msgid "" "raised." msgstr "" -#: howto/unicode.rst:680 +#: howto/unicode.rst:682 msgid "" "When using data coming from a web browser or some other untrusted source, a " "common technique is to check for illegal characters in a string before using " @@ -790,28 +1033,39 @@ msgid "" "then choose a clever way to hide malicious text in the encoded bytestream." msgstr "" -#: howto/unicode.rst:691 +#: howto/unicode.rst:693 msgid "Converting Between File Encodings" msgstr "" -#: howto/unicode.rst:693 +#: howto/unicode.rst:695 msgid "" "The :class:`~codecs.StreamRecoder` class can transparently convert between " "encodings, taking a stream that returns data in encoding #1 and behaving " "like a stream returning data in encoding #2." msgstr "" -#: howto/unicode.rst:697 +#: howto/unicode.rst:699 msgid "" "For example, if you have an input file *f* that's in Latin-1, you can wrap " "it with a :class:`~codecs.StreamRecoder` to return bytes encoded in UTF-8::" msgstr "" -#: howto/unicode.rst:711 -msgid "Files in an Unknown Encoding" +#: howto/unicode.rst:703 +msgid "" +"new_f = codecs.StreamRecoder(f,\n" +" # en/decoder: used by read() to encode its results and\n" +" # by write() to decode its input.\n" +" codecs.getencoder('utf-8'), codecs.getdecoder('utf-8'),\n" +"\n" +" # reader/writer: used to read and write to the stream.\n" +" codecs.getreader('latin-1'), codecs.getwriter('latin-1') )" msgstr "" #: howto/unicode.rst:713 +msgid "Files in an Unknown Encoding" +msgstr "" + +#: howto/unicode.rst:715 msgid "" "What can you do if you need to make a change to a file, but don't know the " "file's encoding? If you know the encoding is ASCII-compatible and only want " @@ -819,7 +1073,19 @@ msgid "" "``surrogateescape`` error handler::" msgstr "" -#: howto/unicode.rst:727 +#: howto/unicode.rst:720 +msgid "" +"with open(fname, 'r', encoding=\"ascii\", errors=\"surrogateescape\") as f:\n" +" data = f.read()\n" +"\n" +"# make changes to the string 'data'\n" +"\n" +"with open(fname + '.new', 'w',\n" +" encoding=\"ascii\", errors=\"surrogateescape\") as f:\n" +" f.write(data)" +msgstr "" + +#: howto/unicode.rst:729 msgid "" "The ``surrogateescape`` error handler will decode any non-ASCII bytes as " "code points in a special range running from U+DC80 to U+DCFF. These code " @@ -827,14 +1093,14 @@ msgid "" "error handler is used to encode the data and write it back out." msgstr "" -#: howto/unicode.rst:737 +#: howto/unicode.rst:739 msgid "" "One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David " "Beazley, discusses text processing and binary data handling." msgstr "" -#: howto/unicode.rst:741 +#: howto/unicode.rst:743 msgid "" "The `PDF slides for Marc-André Lemburg's presentation \"Writing Unicode-" "aware Applications in Python\" `_ is a PyCon 2013 talk by Benjamin Peterson that " "discusses the internal Unicode representation in Python 3.3." msgstr "" -#: howto/unicode.rst:754 +#: howto/unicode.rst:756 msgid "Acknowledgements" msgstr "" -#: howto/unicode.rst:756 +#: howto/unicode.rst:758 msgid "" "The initial draft of this document was written by Andrew Kuchling. It has " "since been revised further by Alexander Belopolsky, Georg Brandl, Andrew " "Kuchling, and Ezio Melotti." msgstr "" -#: howto/unicode.rst:760 +#: howto/unicode.rst:762 msgid "" "Thanks to the following people who have noted errors or offered suggestions " "on this article: Éric Araujo, Nicholas Bastin, Nick Coghlan, Marius " diff --git a/howto/urllib2.po b/howto/urllib2.po index 924e07b6..e4629faa 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -41,7 +42,7 @@ msgstr "" #: howto/urllib2.rst:18 msgid "" "`Basic Authentication `_" +"voidspace.org.uk/python/articles/authentication.shtml>`__" msgstr "" #: howto/urllib2.rst:20 @@ -87,6 +88,13 @@ msgstr "" msgid "The simplest way to use urllib.request is as follows::" msgstr "" +#: howto/urllib2.rst:48 +msgid "" +"import urllib.request\n" +"with urllib.request.urlopen('http://python.org/') as response:\n" +" html = response.read()" +msgstr "" + #: howto/urllib2.rst:52 msgid "" "If you wish to retrieve a resource via URL and store it in a temporary " @@ -94,6 +102,20 @@ msgid "" "`tempfile.NamedTemporaryFile` functions::" msgstr "" +#: howto/urllib2.rst:56 +msgid "" +"import shutil\n" +"import tempfile\n" +"import urllib.request\n" +"\n" +"with urllib.request.urlopen('http://python.org/') as response:\n" +" with tempfile.NamedTemporaryFile(delete=False) as tmp_file:\n" +" shutil.copyfileobj(response, tmp_file)\n" +"\n" +"with open(tmp_file.name) as html:\n" +" pass" +msgstr "" + #: howto/urllib2.rst:67 msgid "" "Many uses of urllib will be that simple (note that instead of an 'http:' URL " @@ -113,12 +135,25 @@ msgid "" "for example call ``.read()`` on the response::" msgstr "" +#: howto/urllib2.rst:80 +msgid "" +"import urllib.request\n" +"\n" +"req = urllib.request.Request('http://python.org/')\n" +"with urllib.request.urlopen(req) as response:\n" +" the_page = response.read()" +msgstr "" + #: howto/urllib2.rst:86 msgid "" "Note that urllib.request makes use of the same Request interface to handle " "all URL schemes. For example, you can make an FTP request like so::" msgstr "" +#: howto/urllib2.rst:89 +msgid "req = urllib.request.Request('ftp://example.com/')" +msgstr "" + #: howto/urllib2.rst:91 msgid "" "In the case of HTTP, there are two extra things that Request objects allow " @@ -145,6 +180,23 @@ msgid "" "function from the :mod:`urllib.parse` library. ::" msgstr "" +#: howto/urllib2.rst:110 +msgid "" +"import urllib.parse\n" +"import urllib.request\n" +"\n" +"url = 'http://www.someserver.com/cgi-bin/register.cgi'\n" +"values = {'name' : 'Michael Foord',\n" +" 'location' : 'Northampton',\n" +" 'language' : 'Python' }\n" +"\n" +"data = urllib.parse.urlencode(values)\n" +"data = data.encode('ascii') # data should be bytes\n" +"req = urllib.request.Request(url, data)\n" +"with urllib.request.urlopen(req) as response:\n" +" the_page = response.read()" +msgstr "" + #: howto/urllib2.rst:124 msgid "" "Note that other encodings are sometimes required (e.g. for file upload from " @@ -169,6 +221,22 @@ msgstr "" msgid "This is done as follows::" msgstr "" +#: howto/urllib2.rst:141 +msgid "" +">>> import urllib.request\n" +">>> import urllib.parse\n" +">>> data = {}\n" +">>> data['name'] = 'Somebody Here'\n" +">>> data['location'] = 'Northampton'\n" +">>> data['language'] = 'Python'\n" +">>> url_values = urllib.parse.urlencode(data)\n" +">>> print(url_values) # The order may differ from below.\n" +"name=Somebody+Here&language=Python&location=Northampton\n" +">>> url = 'http://www.example.com/example.cgi'\n" +">>> full_url = url + '?' + url_values\n" +">>> data = urllib.request.urlopen(full_url)" +msgstr "" + #: howto/urllib2.rst:154 msgid "" "Notice that the full URL is created by adding a ``?`` to the URL, followed " @@ -198,6 +266,25 @@ msgid "" "Explorer [#]_. ::" msgstr "" +#: howto/urllib2.rst:174 +msgid "" +"import urllib.parse\n" +"import urllib.request\n" +"\n" +"url = 'http://www.someserver.com/cgi-bin/register.cgi'\n" +"user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'\n" +"values = {'name': 'Michael Foord',\n" +" 'location': 'Northampton',\n" +" 'language': 'Python' }\n" +"headers = {'User-Agent': user_agent}\n" +"\n" +"data = urllib.parse.urlencode(values)\n" +"data = data.encode('ascii')\n" +"req = urllib.request.Request(url, data, headers)\n" +"with urllib.request.urlopen(req) as response:\n" +" the_page = response.read()" +msgstr "" + #: howto/urllib2.rst:190 msgid "" "The response also has two useful methods. See the section on `info and " @@ -242,6 +329,16 @@ msgstr "" msgid "e.g. ::" msgstr "" +#: howto/urllib2.rst:216 +msgid "" +">>> req = urllib.request.Request('http://www.pretend_server.org')\n" +">>> try: urllib.request.urlopen(req)\n" +"... except urllib.error.URLError as e:\n" +"... print(e.reason)\n" +"...\n" +"(4, 'getaddrinfo failed')" +msgstr "" + #: howto/urllib2.rst:225 msgid "HTTPError" msgstr "" @@ -283,11 +380,37 @@ msgstr "" #: howto/urllib2.rst:247 msgid "" ":attr:`http.server.BaseHTTPRequestHandler.responses` is a useful dictionary " -"of response codes in that shows all the response codes used by :rfc:`2616`. " -"The dictionary is reproduced here for convenience ::" -msgstr "" - -#: howto/urllib2.rst:319 +"of response codes that shows all the response codes used by :rfc:`2616`. An " +"excerpt from the dictionary is shown below ::" +msgstr "" + +#: howto/urllib2.rst:251 +msgid "" +"responses = {\n" +" ...\n" +" : ('OK', 'Request fulfilled, document follows'),\n" +" ...\n" +" : ('Forbidden',\n" +" 'Request forbidden -- authorization will " +"'\n" +" 'not help'),\n" +" : ('Not Found',\n" +" 'Nothing matches the given URI'),\n" +" ...\n" +" : (\"I'm a Teapot\",\n" +" 'Server refuses to brew coffee because " +"'\n" +" 'it is a teapot'),\n" +" ...\n" +" : ('Service Unavailable',\n" +" 'The server cannot process the " +"'\n" +" 'request due to a high load'),\n" +" ...\n" +" }" +msgstr "" + +#: howto/urllib2.rst:271 msgid "" "When an error is raised the server responds by returning an HTTP error code " "*and* an error page. You can use the :exc:`~urllib.error.HTTPError` instance " @@ -296,43 +419,96 @@ msgid "" "``urllib.response`` module::" msgstr "" -#: howto/urllib2.rst:339 +#: howto/urllib2.rst:276 +msgid "" +">>> req = urllib.request.Request('http://www.python.org/fish.html')\n" +">>> try:\n" +"... urllib.request.urlopen(req)\n" +"... except urllib.error.HTTPError as e:\n" +"... print(e.code)\n" +"... print(e.read())\n" +"...\n" +"404\n" +"b'\\n\\n\\nPage Not Found\\n\n" +" ..." +msgstr "" + +#: howto/urllib2.rst:291 msgid "Wrapping it Up" msgstr "" -#: howto/urllib2.rst:341 +#: howto/urllib2.rst:293 msgid "" "So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* :exc:" "`~urllib.error.URLError` there are two basic approaches. I prefer the second " "approach." msgstr "" -#: howto/urllib2.rst:345 +#: howto/urllib2.rst:297 msgid "Number 1" msgstr "" -#: howto/urllib2.rst:367 +#: howto/urllib2.rst:302 +msgid "" +"from urllib.request import Request, urlopen\n" +"from urllib.error import URLError, HTTPError\n" +"req = Request(someurl)\n" +"try:\n" +" response = urlopen(req)\n" +"except HTTPError as e:\n" +" print('The server couldn\\'t fulfill the request.')\n" +" print('Error code: ', e.code)\n" +"except URLError as e:\n" +" print('We failed to reach a server.')\n" +" print('Reason: ', e.reason)\n" +"else:\n" +" # everything is fine" +msgstr "" + +#: howto/urllib2.rst:319 msgid "" "The ``except HTTPError`` *must* come first, otherwise ``except URLError`` " "will *also* catch an :exc:`~urllib.error.HTTPError`." msgstr "" -#: howto/urllib2.rst:371 +#: howto/urllib2.rst:323 msgid "Number 2" msgstr "" -#: howto/urllib2.rst:392 +#: howto/urllib2.rst:327 +msgid "" +"from urllib.request import Request, urlopen\n" +"from urllib.error import URLError\n" +"req = Request(someurl)\n" +"try:\n" +" response = urlopen(req)\n" +"except URLError as e:\n" +" if hasattr(e, 'reason'):\n" +" print('We failed to reach a server.')\n" +" print('Reason: ', e.reason)\n" +" elif hasattr(e, 'code'):\n" +" print('The server couldn\\'t fulfill the request.')\n" +" print('Error code: ', e.code)\n" +"else:\n" +" # everything is fine" +msgstr "" + +#: howto/urllib2.rst:344 msgid "info and geturl" msgstr "" -#: howto/urllib2.rst:394 +#: howto/urllib2.rst:346 msgid "" "The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` " "instance) has two useful methods :meth:`!info` and :meth:`!geturl` and is " "defined in the module :mod:`urllib.response`." msgstr "" -#: howto/urllib2.rst:398 +#: howto/urllib2.rst:350 msgid "" "**geturl** - this returns the real URL of the page fetched. This is useful " "because ``urlopen`` (or the opener object used) may have followed a " @@ -340,14 +516,14 @@ msgid "" "requested." msgstr "" -#: howto/urllib2.rst:402 +#: howto/urllib2.rst:354 msgid "" "**info** - this returns a dictionary-like object that describes the page " "fetched, particularly the headers sent by the server. It is currently an :" "class:`http.client.HTTPMessage` instance." msgstr "" -#: howto/urllib2.rst:406 +#: howto/urllib2.rst:358 msgid "" "Typical headers include 'Content-length', 'Content-type', and so on. See the " "`Quick Reference to HTTP Headers `_ for a " @@ -355,11 +531,11 @@ msgid "" "use." msgstr "" -#: howto/urllib2.rst:413 +#: howto/urllib2.rst:365 msgid "Openers and Handlers" msgstr "" -#: howto/urllib2.rst:415 +#: howto/urllib2.rst:367 msgid "" "When you fetch a URL you use an opener (an instance of the perhaps " "confusingly named :class:`urllib.request.OpenerDirector`). Normally we have " @@ -370,20 +546,20 @@ msgid "" "HTTP redirections or HTTP cookies." msgstr "" -#: howto/urllib2.rst:423 +#: howto/urllib2.rst:375 msgid "" "You will want to create openers if you want to fetch URLs with specific " "handlers installed, for example to get an opener that handles cookies, or to " "get an opener that does not handle redirections." msgstr "" -#: howto/urllib2.rst:427 +#: howto/urllib2.rst:379 msgid "" "To create an opener, instantiate an ``OpenerDirector``, and then call ``." "add_handler(some_handler_instance)`` repeatedly." msgstr "" -#: howto/urllib2.rst:430 +#: howto/urllib2.rst:382 msgid "" "Alternatively, you can use ``build_opener``, which is a convenience function " "for creating opener objects with a single function call. ``build_opener`` " @@ -391,31 +567,31 @@ msgid "" "or override the default handlers." msgstr "" -#: howto/urllib2.rst:435 +#: howto/urllib2.rst:387 msgid "" "Other sorts of handlers you might want to can handle proxies, " "authentication, and other common but slightly specialised situations." msgstr "" -#: howto/urllib2.rst:438 +#: howto/urllib2.rst:390 msgid "" "``install_opener`` can be used to make an ``opener`` object the (global) " "default opener. This means that calls to ``urlopen`` will use the opener you " "have installed." msgstr "" -#: howto/urllib2.rst:442 +#: howto/urllib2.rst:394 msgid "" "Opener objects have an ``open`` method, which can be called directly to " "fetch urls in the same way as the ``urlopen`` function: there's no need to " "call ``install_opener``, except as a convenience." msgstr "" -#: howto/urllib2.rst:448 +#: howto/urllib2.rst:400 msgid "Basic Authentication" msgstr "" -#: howto/urllib2.rst:450 +#: howto/urllib2.rst:402 msgid "" "To illustrate creating and installing a handler we will use the " "``HTTPBasicAuthHandler``. For a more detailed discussion of this subject -- " @@ -424,7 +600,7 @@ msgid "" "www.voidspace.org.uk/python/articles/authentication.shtml>`__." msgstr "" -#: howto/urllib2.rst:456 +#: howto/urllib2.rst:408 msgid "" "When authentication is required, the server sends a header (as well as the " "401 error code) requesting authentication. This specifies the " @@ -432,11 +608,15 @@ msgid "" "Authenticate: SCHEME realm=\"REALM\"``." msgstr "" -#: howto/urllib2.rst:461 +#: howto/urllib2.rst:413 msgid "e.g." msgstr "" -#: howto/urllib2.rst:468 +#: howto/urllib2.rst:415 +msgid "WWW-Authenticate: Basic realm=\"cPanel Users\"" +msgstr "" + +#: howto/urllib2.rst:420 msgid "" "The client should then retry the request with the appropriate name and " "password for the realm included as a header in the request. This is 'basic " @@ -444,7 +624,7 @@ msgid "" "of ``HTTPBasicAuthHandler`` and an opener to use this handler." msgstr "" -#: howto/urllib2.rst:473 +#: howto/urllib2.rst:425 msgid "" "The ``HTTPBasicAuthHandler`` uses an object called a password manager to " "handle the mapping of URLs and realms to passwords and usernames. If you " @@ -457,13 +637,36 @@ msgid "" "by providing ``None`` as the realm argument to the ``add_password`` method." msgstr "" -#: howto/urllib2.rst:483 +#: howto/urllib2.rst:435 msgid "" "The top-level URL is the first URL that requires authentication. URLs " "\"deeper\" than the URL you pass to .add_password() will also match. ::" msgstr "" -#: howto/urllib2.rst:508 +#: howto/urllib2.rst:438 +msgid "" +"# create a password manager\n" +"password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()\n" +"\n" +"# Add the username and password.\n" +"# If we knew the realm, we could use it instead of None.\n" +"top_level_url = \"http://example.com/foo/\"\n" +"password_mgr.add_password(None, top_level_url, username, password)\n" +"\n" +"handler = urllib.request.HTTPBasicAuthHandler(password_mgr)\n" +"\n" +"# create \"opener\" (OpenerDirector instance)\n" +"opener = urllib.request.build_opener(handler)\n" +"\n" +"# use the opener to fetch a URL\n" +"opener.open(a_url)\n" +"\n" +"# Install the opener.\n" +"# Now all calls to urllib.request.urlopen use our opener.\n" +"urllib.request.install_opener(opener)" +msgstr "" + +#: howto/urllib2.rst:460 msgid "" "In the above example we only supplied our ``HTTPBasicAuthHandler`` to " "``build_opener``. By default openers have the handlers for normal situations " @@ -473,7 +676,7 @@ msgid "" "``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``." msgstr "" -#: howto/urllib2.rst:515 +#: howto/urllib2.rst:467 msgid "" "``top_level_url`` is in fact *either* a full URL (including the 'http:' " "scheme component and the hostname and optionally the port number) e.g. " @@ -484,11 +687,11 @@ msgid "" "example ``\"joe:password@example.com\"`` is not correct." msgstr "" -#: howto/urllib2.rst:525 +#: howto/urllib2.rst:477 msgid "Proxies" msgstr "" -#: howto/urllib2.rst:527 +#: howto/urllib2.rst:479 msgid "" "**urllib** will auto-detect your proxy settings and use those. This is " "through the ``ProxyHandler``, which is part of the normal handler chain when " @@ -498,30 +701,37 @@ msgid "" "similar steps to setting up a `Basic Authentication`_ handler: ::" msgstr "" -#: howto/urllib2.rst:540 +#: howto/urllib2.rst:486 +msgid "" +">>> proxy_support = urllib.request.ProxyHandler({})\n" +">>> opener = urllib.request.build_opener(proxy_support)\n" +">>> urllib.request.install_opener(opener)" +msgstr "" + +#: howto/urllib2.rst:492 msgid "" "Currently ``urllib.request`` *does not* support fetching of ``https`` " "locations through a proxy. However, this can be enabled by extending urllib." "request as shown in the recipe [#]_." msgstr "" -#: howto/urllib2.rst:546 +#: howto/urllib2.rst:498 msgid "" "``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see " "the documentation on :func:`~urllib.request.getproxies`." msgstr "" -#: howto/urllib2.rst:551 +#: howto/urllib2.rst:503 msgid "Sockets and Layers" msgstr "" -#: howto/urllib2.rst:553 +#: howto/urllib2.rst:505 msgid "" "The Python support for fetching resources from the web is layered. urllib " "uses the :mod:`http.client` library, which in turn uses the socket library." msgstr "" -#: howto/urllib2.rst:556 +#: howto/urllib2.rst:508 msgid "" "As of Python 2.3 you can specify how long a socket should wait for a " "response before timing out. This can be useful in applications which have to " @@ -531,38 +741,53 @@ msgid "" "sockets using ::" msgstr "" -#: howto/urllib2.rst:579 +#: howto/urllib2.rst:514 +msgid "" +"import socket\n" +"import urllib.request\n" +"\n" +"# timeout in seconds\n" +"timeout = 10\n" +"socket.setdefaulttimeout(timeout)\n" +"\n" +"# this call to urllib.request.urlopen now uses the default timeout\n" +"# we have set in the socket module\n" +"req = urllib.request.Request('http://www.voidspace.org.uk')\n" +"response = urllib.request.urlopen(req)" +msgstr "" + +#: howto/urllib2.rst:531 msgid "Footnotes" msgstr "" -#: howto/urllib2.rst:581 +#: howto/urllib2.rst:533 msgid "This document was reviewed and revised by John Lee." msgstr "" -#: howto/urllib2.rst:583 +#: howto/urllib2.rst:535 msgid "Google for example." msgstr "" -#: howto/urllib2.rst:584 +#: howto/urllib2.rst:536 msgid "" "Browser sniffing is a very bad practice for website design - building sites " "using web standards is much more sensible. Unfortunately a lot of sites " "still send different versions to different browsers." msgstr "" -#: howto/urllib2.rst:587 +#: howto/urllib2.rst:539 msgid "" "The user agent for MSIE 6 is *'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT " "5.1; SV1; .NET CLR 1.1.4322)'*" msgstr "" -#: howto/urllib2.rst:589 +#: howto/urllib2.rst:541 msgid "" "For details of more HTTP request headers, see `Quick Reference to HTTP " "Headers`_." msgstr "" -#: howto/urllib2.rst:591 +#: howto/urllib2.rst:543 msgid "" "In my case I have to use a proxy to access the internet at work. If you " "attempt to fetch *localhost* URLs through this proxy it blocks them. IE is " @@ -570,8 +795,9 @@ msgid "" "with a localhost server, I have to prevent urllib from using the proxy." msgstr "" -#: howto/urllib2.rst:596 +#: howto/urllib2.rst:548 msgid "" "urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe `_." +"code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-" +"method/>`_." msgstr "" diff --git a/installing/index.po b/installing/index.po index 86992cd2..b8d91cf3 100644 --- a/installing/index.po +++ b/installing/index.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -142,6 +143,10 @@ msgid "" "dependencies from the Python Package Index::" msgstr "" +#: installing/index.rst:84 +msgid "python -m pip install SomePackage" +msgstr "" + #: installing/index.rst:88 msgid "" "For POSIX users (including macOS and Linux users), the examples in this " @@ -163,6 +168,12 @@ msgid "" "the version should be enclosed within double quotes::" msgstr "" +#: installing/index.rst:100 +msgid "" +"python -m pip install SomePackage==1.0.4 # specific version\n" +"python -m pip install \"SomePackage>=1.0.4\" # minimum version" +msgstr "" + #: installing/index.rst:103 msgid "" "Normally, if a suitable module is already installed, attempting to install " @@ -170,6 +181,10 @@ msgid "" "explicitly::" msgstr "" +#: installing/index.rst:107 +msgid "python -m pip install --upgrade SomePackage" +msgstr "" + #: installing/index.rst:109 msgid "" "More information and resources regarding ``pip`` and its capabilities can be " @@ -254,6 +269,14 @@ msgid "" "``pip``::" msgstr "" +#: installing/index.rst:171 +msgid "" +"python2 -m pip install SomePackage # default Python 2\n" +"python2.7 -m pip install SomePackage # specifically Python 2.7\n" +"python3 -m pip install SomePackage # default Python 3\n" +"python3.4 -m pip install SomePackage # specifically Python 3.4" +msgstr "" + #: installing/index.rst:176 msgid "Appropriately versioned ``pip`` commands may also be available." msgstr "" @@ -264,6 +287,14 @@ msgid "" "switch::" msgstr "" +#: installing/index.rst:181 +msgid "" +"py -2 -m pip install SomePackage # default Python 2\n" +"py -2.7 -m pip install SomePackage # specifically Python 2.7\n" +"py -3 -m pip install SomePackage # default Python 3\n" +"py -3.4 -m pip install SomePackage # specifically Python 3.4" +msgstr "" + #: installing/index.rst:195 msgid "Common installation issues" msgstr "" @@ -297,6 +328,10 @@ msgid "" "fix is::" msgstr "" +#: installing/index.rst:215 +msgid "python -m ensurepip --default-pip" +msgstr "" + #: installing/index.rst:217 msgid "" "There are also additional resources for `installing pip. \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -29,7 +30,7 @@ msgid "" "library, so it is possible to write your own fixers for 2to3." msgstr "" -#: library/2to3.rst:19 +#: library/2to3.rst:14 msgid "" "The ``lib2to3`` module was marked pending for deprecation in Python 3.9 " "(raising :exc:`PendingDeprecationWarning` on import) and fully deprecated in " @@ -57,10 +58,23 @@ msgstr "" msgid "Here is a sample Python 2.x source file, :file:`example.py`::" msgstr "" +#: library/2to3.rst:33 +msgid "" +"def greet(name):\n" +" print \"Hello, {0}!\".format(name)\n" +"print \"What's your name?\"\n" +"name = raw_input()\n" +"greet(name)" +msgstr "" + #: library/2to3.rst:39 msgid "It can be converted to Python 3.x code via 2to3 on the command line:" msgstr "" +#: library/2to3.rst:41 +msgid "$ 2to3 example.py" +msgstr "" + #: library/2to3.rst:45 msgid "" "A diff against the original source file is printed. 2to3 can also write the " @@ -69,10 +83,23 @@ msgid "" "changes back is enabled with the :option:`!-w` flag:" msgstr "" +#: library/2to3.rst:50 +msgid "$ 2to3 -w example.py" +msgstr "" + #: library/2to3.rst:54 msgid "After transformation, :file:`example.py` looks like this::" msgstr "" +#: library/2to3.rst:56 +msgid "" +"def greet(name):\n" +" print(\"Hello, {0}!\".format(name))\n" +"print(\"What's your name?\")\n" +"name = input()\n" +"greet(name)" +msgstr "" + #: library/2to3.rst:62 msgid "" "Comments and exact indentation are preserved throughout the translation " @@ -88,10 +115,18 @@ msgid "" "``has_key`` fixers:" msgstr "" +#: library/2to3.rst:69 +msgid "$ 2to3 -f imports -f has_key example.py" +msgstr "" + #: library/2to3.rst:73 msgid "This command runs every fixer except the ``apply`` fixer:" msgstr "" +#: library/2to3.rst:75 +msgid "$ 2to3 -x apply example.py" +msgstr "" + #: library/2to3.rst:79 msgid "" "Some fixers are *explicit*, meaning they aren't run by default and must be " @@ -99,6 +134,10 @@ msgid "" "fixers, the ``idioms`` fixer is run:" msgstr "" +#: library/2to3.rst:83 +msgid "$ 2to3 -f all -f idioms example.py" +msgstr "" + #: library/2to3.rst:87 msgid "Notice how passing ``all`` enables all default fixers." msgstr "" @@ -169,6 +208,10 @@ msgid "" "as backups are not necessary when writing to different filenames. Example:" msgstr "" +#: library/2to3.rst:131 +msgid "$ 2to3 -n -W --add-suffix=3 example.py" +msgstr "" + #: library/2to3.rst:135 msgid "Will cause a converted file named ``example.py3`` to be written." msgstr "" @@ -181,6 +224,10 @@ msgstr "" msgid "To translate an entire project from one directory tree to another use:" msgstr "" +#: library/2to3.rst:142 +msgid "$ 2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode" +msgstr "" + #: library/2to3.rst:150 msgid "Fixers" msgstr "" @@ -360,10 +407,20 @@ msgid "" "func:`sorted` in appropriate places. For example, this block ::" msgstr "" +#: library/2to3.rst:262 +msgid "" +"L = list(some_iterable)\n" +"L.sort()" +msgstr "" + #: library/2to3.rst:265 msgid "is changed to ::" msgstr "" +#: library/2to3.rst:267 +msgid "L = sorted(some_iterable)" +msgstr "" + #: library/2to3.rst:271 msgid "Detects sibling imports and converts them to relative imports." msgstr "" @@ -625,7 +682,7 @@ msgstr "" msgid "**Source code:** :source:`Lib/lib2to3/`" msgstr "" -#: library/2to3.rst:482 +#: library/2to3.rst:473 msgid "" "Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is using " "a less flexible LL(1) parser. Python 3.10 includes new language syntax that " diff --git a/library/__future__.po b/library/__future__.po index f483ba8f..63950f3f 100644 --- a/library/__future__.po +++ b/library/__future__.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/__future__.rst:2 -msgid ":mod:`__future__` --- Future statement definitions" +msgid ":mod:`!__future__` --- Future statement definitions" msgstr "" #: library/__future__.rst:7 @@ -73,170 +74,153 @@ msgid "" "into the language using this mechanism:" msgstr "" -#: library/__future__.rst:41 +#: library/__future__.rst:45 msgid "feature" msgstr "" -#: library/__future__.rst:41 +#: library/__future__.rst:46 msgid "optional in" msgstr "" -#: library/__future__.rst:41 +#: library/__future__.rst:47 msgid "mandatory in" msgstr "" -#: library/__future__.rst:41 +#: library/__future__.rst:48 msgid "effect" msgstr "" -#: library/__future__.rst:43 -msgid "nested_scopes" -msgstr "" - -#: library/__future__.rst:43 +#: library/__future__.rst:50 msgid "2.1.0b1" msgstr "" -#: library/__future__.rst:43 +#: library/__future__.rst:51 msgid "2.2" msgstr "" -#: library/__future__.rst:43 +#: library/__future__.rst:52 msgid ":pep:`227`: *Statically Nested Scopes*" msgstr "" -#: library/__future__.rst:46 -msgid "generators" -msgstr "" - -#: library/__future__.rst:46 +#: library/__future__.rst:54 msgid "2.2.0a1" msgstr "" -#: library/__future__.rst:46 +#: library/__future__.rst:55 msgid "2.3" msgstr "" -#: library/__future__.rst:46 +#: library/__future__.rst:56 msgid ":pep:`255`: *Simple Generators*" msgstr "" -#: library/__future__.rst:49 -msgid "division" -msgstr "" - -#: library/__future__.rst:49 +#: library/__future__.rst:58 msgid "2.2.0a2" msgstr "" -#: library/__future__.rst:52 library/__future__.rst:61 +#: library/__future__.rst:63 library/__future__.rst:75 msgid "3.0" msgstr "" -#: library/__future__.rst:49 +#: library/__future__.rst:60 msgid ":pep:`238`: *Changing the Division Operator*" msgstr "" -#: library/__future__.rst:52 -msgid "absolute_import" -msgstr "" - -#: library/__future__.rst:55 +#: library/__future__.rst:66 msgid "2.5.0a1" msgstr "" -#: library/__future__.rst:52 +#: library/__future__.rst:64 msgid ":pep:`328`: *Imports: Multi-Line and Absolute/Relative*" msgstr "" -#: library/__future__.rst:55 -msgid "with_statement" -msgstr "" - -#: library/__future__.rst:55 +#: library/__future__.rst:67 msgid "2.6" msgstr "" -#: library/__future__.rst:55 -msgid ":pep:`343`: *The \"with\" Statement*" +#: library/__future__.rst:68 +msgid ":pep:`343`: *The “with” Statement*" msgstr "" -#: library/__future__.rst:58 -msgid "print_function" -msgstr "" - -#: library/__future__.rst:61 +#: library/__future__.rst:74 msgid "2.6.0a2" msgstr "" -#: library/__future__.rst:58 +#: library/__future__.rst:72 msgid ":pep:`3105`: *Make print a function*" msgstr "" -#: library/__future__.rst:61 -msgid "unicode_literals" -msgstr "" - -#: library/__future__.rst:61 +#: library/__future__.rst:76 msgid ":pep:`3112`: *Bytes literals in Python 3000*" msgstr "" -#: library/__future__.rst:64 -msgid "generator_stop" -msgstr "" - -#: library/__future__.rst:64 +#: library/__future__.rst:78 msgid "3.5.0b1" msgstr "" -#: library/__future__.rst:64 +#: library/__future__.rst:79 msgid "3.7" msgstr "" -#: library/__future__.rst:64 +#: library/__future__.rst:80 msgid ":pep:`479`: *StopIteration handling inside generators*" msgstr "" -#: library/__future__.rst:67 -msgid "annotations" -msgstr "" - -#: library/__future__.rst:67 +#: library/__future__.rst:82 msgid "3.7.0b1" msgstr "" -#: library/__future__.rst:67 -msgid "TBD [1]_" +#: library/__future__.rst:83 +msgid "Never [1]_" msgstr "" -#: library/__future__.rst:67 -msgid ":pep:`563`: *Postponed evaluation of annotations*" +#: library/__future__.rst:84 +msgid "" +":pep:`563`: *Postponed evaluation of annotations*, :pep:`649`: *Deferred " +"evaluation of annotations using descriptors*" msgstr "" -#: library/__future__.rst:77 +#: library/__future__.rst:93 msgid "Each statement in :file:`__future__.py` is of the form::" msgstr "" -#: library/__future__.rst:82 +#: library/__future__.rst:95 +msgid "" +"FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" +" CompilerFlag)" +msgstr "" + +#: library/__future__.rst:98 msgid "" "where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both " "are 5-tuples of the same form as :data:`sys.version_info`::" msgstr "" -#: library/__future__.rst:94 +#: library/__future__.rst:101 +msgid "" +"(PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int\n" +" PY_MINOR_VERSION, # the 1; an int\n" +" PY_MICRO_VERSION, # the 0; an int\n" +" PY_RELEASE_LEVEL, # \"alpha\", \"beta\", \"candidate\" or \"final\"; " +"string\n" +" PY_RELEASE_SERIAL # the 3; an int\n" +")" +msgstr "" + +#: library/__future__.rst:110 msgid "" "*OptionalRelease* records the first release in which the feature was " "accepted." msgstr "" -#: library/__future__.rst:98 +#: library/__future__.rst:114 msgid "" "In the case of a *MandatoryRelease* that has not yet occurred, " "*MandatoryRelease* predicts the release in which the feature will become " "part of the language." msgstr "" -#: library/__future__.rst:102 +#: library/__future__.rst:118 msgid "" "Else *MandatoryRelease* records when the feature became part of the " "language; in releases at or after that, modules no longer need a future " @@ -244,13 +228,13 @@ msgid "" "imports." msgstr "" -#: library/__future__.rst:106 +#: library/__future__.rst:122 msgid "" "*MandatoryRelease* may also be ``None``, meaning that a planned feature got " "dropped or that it is not yet decided." msgstr "" -#: library/__future__.rst:111 +#: library/__future__.rst:127 msgid "" "*CompilerFlag* is the (bitfield) flag that should be passed in the fourth " "argument to the built-in function :func:`compile` to enable the feature in " @@ -258,29 +242,26 @@ msgid "" "compiler_flag` attribute on :class:`_Feature` instances." msgstr "" -#: library/__future__.rst:117 +#: library/__future__.rst:133 msgid "" "``from __future__ import annotations`` was previously scheduled to become " -"mandatory in Python 3.10, but the Python Steering Council twice decided to " -"delay the change (`announcement for Python 3.10 `__; `announcement for Python 3.11 `__). No " -"final decision has been made yet. See also :pep:`563` and :pep:`649`." +"mandatory in Python 3.10, but the change was delayed and ultimately " +"canceled. This feature will eventually be deprecated and removed. See :pep:" +"`649` and :pep:`749`." msgstr "" -#: library/__future__.rst:128 +#: library/__future__.rst:141 msgid ":ref:`future`" msgstr "" -#: library/__future__.rst:128 +#: library/__future__.rst:142 msgid "How the compiler treats future imports." msgstr "" -#: library/__future__.rst:130 +#: library/__future__.rst:144 msgid ":pep:`236` - Back to the __future__" msgstr "" -#: library/__future__.rst:131 +#: library/__future__.rst:145 msgid "The original proposal for the __future__ mechanism." msgstr "" diff --git a/library/__main__.po b/library/__main__.po index c067f68e..2c454345 100644 --- a/library/__main__.po +++ b/library/__main__.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/__main__.rst:2 -msgid ":mod:`__main__` --- Top-level code environment" +msgid ":mod:`!__main__` --- Top-level code environment" msgstr "" #: library/__main__.rst:10 @@ -55,12 +56,26 @@ msgid "" "the ``.py`` extension::" msgstr "" +#: library/__main__.rst:31 +msgid "" +">>> import configparser\n" +">>> configparser.__name__\n" +"'configparser'" +msgstr "" + #: library/__main__.rst:35 msgid "" "If the file is part of a package, ``__name__`` will also include the parent " "package's path::" msgstr "" +#: library/__main__.rst:38 +msgid "" +">>> from concurrent.futures import process\n" +">>> process.__name__\n" +"'concurrent.futures.process'" +msgstr "" + #: library/__main__.rst:42 msgid "" "However, if the module is executed in the top-level code environment, its " @@ -88,25 +103,63 @@ msgstr "" msgid "the scope of an interactive prompt::" msgstr "" +#: library/__main__.rst:57 +msgid "" +">>> __name__\n" +"'__main__'" +msgstr "" + #: library/__main__.rst:60 msgid "the Python module passed to the Python interpreter as a file argument:" msgstr "" +#: library/__main__.rst:62 +msgid "" +"$ python helloworld.py\n" +"Hello, world!" +msgstr "" + #: library/__main__.rst:67 msgid "" "the Python module or package passed to the Python interpreter with the :" "option:`-m` argument:" msgstr "" +#: library/__main__.rst:70 +msgid "" +"$ python -m tarfile\n" +"usage: tarfile.py [-h] [-v] (...)" +msgstr "" + #: library/__main__.rst:75 msgid "Python code read by the Python interpreter from standard input:" msgstr "" +#: library/__main__.rst:77 +msgid "" +"$ echo \"import this\" | python\n" +"The Zen of Python, by Tim Peters\n" +"\n" +"Beautiful is better than ugly.\n" +"Explicit is better than implicit.\n" +"..." +msgstr "" + #: library/__main__.rst:86 msgid "" "Python code passed to the Python interpreter with the :option:`-c` argument:" msgstr "" +#: library/__main__.rst:88 +msgid "" +"$ python -c \"import this\"\n" +"The Zen of Python, by Tim Peters\n" +"\n" +"Beautiful is better than ugly.\n" +"Explicit is better than implicit.\n" +"..." +msgstr "" + #: library/__main__.rst:97 msgid "" "In each of these situations, the top-level module's ``__name__`` is set to " @@ -121,6 +174,13 @@ msgid "" "from an import statement::" msgstr "" +#: library/__main__.rst:105 +msgid "" +"if __name__ == '__main__':\n" +" # Execute when the module is not initialized from an import statement.\n" +" ..." +msgstr "" + #: library/__main__.rst:111 msgid "" "For a more detailed look at how ``__name__`` is set in all situations, see " @@ -153,6 +213,29 @@ msgid "" "function named ``main`` encapsulates the program's primary behavior::" msgstr "" +#: library/__main__.rst:131 +msgid "" +"# echo.py\n" +"\n" +"import shlex\n" +"import sys\n" +"\n" +"def echo(phrase: str) -> None:\n" +" \"\"\"A dummy wrapper around print.\"\"\"\n" +" # for demonstration purposes, you can imagine that there is some\n" +" # valuable and reusable logic inside this function\n" +" print(phrase)\n" +"\n" +"def main() -> int:\n" +" \"\"\"Echo the input arguments to standard output\"\"\"\n" +" phrase = shlex.join(sys.argv)\n" +" echo(phrase)\n" +" return 0\n" +"\n" +"if __name__ == '__main__':\n" +" sys.exit(main()) # next section explains the use of sys.exit" +msgstr "" + #: library/__main__.rst:151 msgid "" "Note that if the module didn't encapsulate code inside the ``main`` function " @@ -183,6 +266,10 @@ msgid "" "return value of ``main`` is passed into :func:`sys.exit`. For example::" msgstr "" +#: library/__main__.rst:173 +msgid "sys.exit(main())" +msgstr "" + #: library/__main__.rst:175 msgid "" "Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation " @@ -228,12 +315,24 @@ msgid "" "hypothetical package, \"bandclass\":" msgstr "" +#: library/__main__.rst:206 +msgid "" +"bandclass\n" +" ├── __init__.py\n" +" ├── __main__.py\n" +" └── student.py" +msgstr "" + #: library/__main__.rst:213 msgid "" "``__main__.py`` will be executed when the package itself is invoked directly " "from the command line using the :option:`-m` flag. For example:" msgstr "" +#: library/__main__.rst:216 +msgid "$ python -m bandclass" +msgstr "" + #: library/__main__.rst:220 msgid "" "This command will cause ``__main__.py`` to run. How you utilize this " @@ -242,6 +341,17 @@ msgid "" "for students::" msgstr "" +#: library/__main__.rst:225 +msgid "" +"# bandclass/__main__.py\n" +"\n" +"import sys\n" +"from .student import search_students\n" +"\n" +"student_name = sys.argv[1] if len(sys.argv) >= 2 else ''\n" +"print(f'Found student: {search_students(student_name)}')" +msgstr "" + #: library/__main__.rst:233 msgid "" "Note that ``from .student import search_students`` is an example of a " @@ -265,11 +375,18 @@ msgid "" "attribute will include the package's path if imported::" msgstr "" +#: library/__main__.rst:250 +msgid "" +">>> import asyncio.__main__\n" +">>> asyncio.__main__.__name__\n" +"'asyncio.__main__'" +msgstr "" + #: library/__main__.rst:254 msgid "" -"This won't work for ``__main__.py`` files in the root directory of a .zip " -"file though. Hence, for consistency, minimal ``__main__.py`` like the :mod:" -"`venv` one mentioned below are preferred." +"This won't work for ``__main__.py`` files in the root directory of a ``." +"zip`` file though. Hence, for consistency, a minimal ``__main__.py`` " +"without a ``__name__`` check is preferred." msgstr "" #: library/__main__.rst:260 @@ -309,22 +426,70 @@ msgstr "" msgid "Here is an example module that consumes the ``__main__`` namespace::" msgstr "" -#: library/__main__.rst:300 +#: library/__main__.rst:284 +msgid "" +"# namely.py\n" +"\n" +"import __main__\n" +"\n" +"def did_user_define_their_name():\n" +" return 'my_name' in dir(__main__)\n" +"\n" +"def print_user_name():\n" +" if not did_user_define_their_name():\n" +" raise ValueError('Define the variable `my_name`!')\n" +"\n" +" print(__main__.my_name)" +msgstr "" + +#: library/__main__.rst:297 msgid "Example usage of this module could be as follows::" msgstr "" -#: library/__main__.rst:319 +#: library/__main__.rst:299 +msgid "" +"# start.py\n" +"\n" +"import sys\n" +"\n" +"from namely import print_user_name\n" +"\n" +"# my_name = \"Dinsdale\"\n" +"\n" +"def main():\n" +" try:\n" +" print_user_name()\n" +" except ValueError as ve:\n" +" return str(ve)\n" +"\n" +"if __name__ == \"__main__\":\n" +" sys.exit(main())" +msgstr "" + +#: library/__main__.rst:316 msgid "Now, if we started our program, the result would look like this:" msgstr "" -#: library/__main__.rst:326 +#: library/__main__.rst:318 +msgid "" +"$ python start.py\n" +"Define the variable `my_name`!" +msgstr "" + +#: library/__main__.rst:323 msgid "" "The exit code of the program would be 1, indicating an error. Uncommenting " "the line with ``my_name = \"Dinsdale\"`` fixes the program and now it exits " "with status code 0, indicating success:" msgstr "" -#: library/__main__.rst:335 +#: library/__main__.rst:327 +msgid "" +"$ python start.py\n" +"Dinsdale" +msgstr "" + +#: library/__main__.rst:332 msgid "" "Note that importing ``__main__`` doesn't cause any issues with " "unintentionally running top-level code meant for script use which is put in " @@ -332,7 +497,7 @@ msgid "" "this work?" msgstr "" -#: library/__main__.rst:339 +#: library/__main__.rst:336 msgid "" "Python inserts an empty ``__main__`` module in :data:`sys.modules` at " "interpreter startup, and populates it by running top-level code. In our " @@ -345,19 +510,29 @@ msgid "" "this works." msgstr "" -#: library/__main__.rst:348 +#: library/__main__.rst:345 msgid "" "The Python REPL is another example of a \"top-level environment\", so " "anything defined in the REPL becomes part of the ``__main__`` scope::" msgstr "" -#: library/__main__.rst:364 +#: library/__main__.rst:348 msgid "" -"Note that in this case the ``__main__`` scope doesn't contain a ``__file__`` " -"attribute as it's interactive." -msgstr "" - -#: library/__main__.rst:367 +">>> import namely\n" +">>> namely.did_user_define_their_name()\n" +"False\n" +">>> namely.print_user_name()\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Define the variable `my_name`!\n" +">>> my_name = 'Jabberwocky'\n" +">>> namely.did_user_define_their_name()\n" +"True\n" +">>> namely.print_user_name()\n" +"Jabberwocky" +msgstr "" + +#: library/__main__.rst:361 msgid "" "The ``__main__`` scope is used in the implementation of :mod:`pdb` and :mod:" "`rlcompleter`." diff --git a/library/_thread.po b/library/_thread.po index 8b7f30f7..f5782717 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/_thread.rst:2 -msgid ":mod:`_thread` --- Low-level threading API" +msgid ":mod:`!_thread` --- Low-level threading API" msgstr "" #: library/_thread.rst:15 @@ -144,13 +145,15 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: library/_thread.rst:123 -msgid "" -":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD." +#: library/_thread.rst:148 +msgid "Availability" +msgstr "" + +#: library/_thread.rst:127 +msgid "Added support for GNU/kFreeBSD." msgstr "" -#: library/_thread.rst:130 +#: library/_thread.rst:133 msgid "" "Return the thread stack size used when creating new threads. The optional " "*size* argument specifies the stack size to be used for subsequently created " @@ -169,26 +172,22 @@ msgid "" "information)." msgstr "" -#: library/_thread.rst:145 -msgid ":ref:`Availability `: Windows, pthreads." -msgstr "" - -#: library/_thread.rst:147 +#: library/_thread.rst:150 msgid "Unix platforms with POSIX threads support." msgstr "" -#: library/_thread.rst:152 +#: library/_thread.rst:155 msgid "" "The maximum value allowed for the *timeout* parameter of :meth:`Lock.acquire " "`. Specifying a timeout greater than this value will " "raise an :exc:`OverflowError`." msgstr "" -#: library/_thread.rst:159 +#: library/_thread.rst:162 msgid "Lock objects have the following methods:" msgstr "" -#: library/_thread.rst:164 +#: library/_thread.rst:167 msgid "" "Without any optional argument, this method acquires the lock " "unconditionally, if necessary waiting until it is released by another thread " @@ -196,92 +195,91 @@ msgid "" "existence)." msgstr "" -#: library/_thread.rst:168 +#: library/_thread.rst:171 msgid "" "If the *blocking* argument is present, the action depends on its value: if " -"it is False, the lock is only acquired if it can be acquired immediately " -"without waiting, while if it is True, the lock is acquired unconditionally " +"it is false, the lock is only acquired if it can be acquired immediately " +"without waiting, while if it is true, the lock is acquired unconditionally " "as above." msgstr "" -#: library/_thread.rst:173 +#: library/_thread.rst:176 msgid "" "If the floating-point *timeout* argument is present and positive, it " "specifies the maximum wait time in seconds before returning. A negative " "*timeout* argument specifies an unbounded wait. You cannot specify a " -"*timeout* if *blocking* is False." +"*timeout* if *blocking* is false." msgstr "" -#: library/_thread.rst:178 +#: library/_thread.rst:181 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not." msgstr "" -#: library/_thread.rst:181 +#: library/_thread.rst:184 msgid "The *timeout* parameter is new." msgstr "" -#: library/_thread.rst:184 +#: library/_thread.rst:187 msgid "Lock acquires can now be interrupted by signals on POSIX." msgstr "" #: library/_thread.rst:190 +msgid "Lock acquires can now be interrupted by signals on Windows." +msgstr "" + +#: library/_thread.rst:196 msgid "" "Releases the lock. The lock must have been acquired earlier, but not " "necessarily by the same thread." msgstr "" -#: library/_thread.rst:196 +#: library/_thread.rst:202 msgid "" "Return the status of the lock: ``True`` if it has been acquired by some " "thread, ``False`` if not." msgstr "" -#: library/_thread.rst:199 +#: library/_thread.rst:205 msgid "" "In addition to these methods, lock objects can also be used via the :keyword:" "`with` statement, e.g.::" msgstr "" -#: library/_thread.rst:209 +#: library/_thread.rst:208 +msgid "" +"import _thread\n" +"\n" +"a_lock = _thread.allocate_lock()\n" +"\n" +"with a_lock:\n" +" print(\"a_lock is locked while this executes\")" +msgstr "" + +#: library/_thread.rst:215 msgid "**Caveats:**" msgstr "" -#: library/_thread.rst:213 +#: library/_thread.rst:219 msgid "" -"Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt` " -"exception will be received by an arbitrary thread. (When the :mod:`signal` " -"module is available, interrupts always go to the main thread.)" +"Interrupts always go to the main thread (the :exc:`KeyboardInterrupt` " +"exception will be received by that thread.)" msgstr "" -#: library/_thread.rst:217 +#: library/_thread.rst:222 msgid "" "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " "equivalent to calling :func:`_thread.exit`." msgstr "" -#: library/_thread.rst:220 -msgid "" -"It is not possible to interrupt the :meth:`~threading.Lock.acquire` method " -"on a lock --- the :exc:`KeyboardInterrupt` exception will happen after the " -"lock has been acquired." -msgstr "" - -#: library/_thread.rst:224 +#: library/_thread.rst:225 msgid "" "When the main thread exits, it is system defined whether the other threads " "survive. On most systems, they are killed without executing :keyword:" "`try` ... :keyword:`finally` clauses or executing object destructors." msgstr "" -#: library/_thread.rst:229 -msgid "" -"When the main thread exits, it does not do any of its usual cleanup (except " -"that :keyword:`try` ... :keyword:`finally` clauses are honored), and the " -"standard I/O files are not flushed." -msgstr "" - #: library/_thread.rst:7 msgid "light-weight processes" msgstr "" @@ -310,10 +308,10 @@ msgstr "" msgid "POSIX" msgstr "" -#: library/_thread.rst:211 +#: library/_thread.rst:217 msgid "module" msgstr "" -#: library/_thread.rst:211 +#: library/_thread.rst:217 msgid "signal" msgstr "" diff --git a/library/abc.po b/library/abc.po index 476d681c..d7ecb40f 100644 --- a/library/abc.po +++ b/library/abc.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/abc.rst:2 -msgid ":mod:`abc` --- Abstract Base Classes" +msgid ":mod:`!abc` --- Abstract Base Classes" msgstr "" #: library/abc.rst:11 @@ -54,6 +55,14 @@ msgid "" "avoiding sometimes confusing metaclass usage, for example::" msgstr "" +#: library/abc.rst:36 +msgid "" +"from abc import ABC\n" +"\n" +"class MyABC(ABC):\n" +" pass" +msgstr "" + #: library/abc.rst:41 msgid "" "Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore " @@ -63,6 +72,14 @@ msgid "" "and using :class:`!ABCMeta` directly, for example::" msgstr "" +#: library/abc.rst:47 +msgid "" +"from abc import ABCMeta\n" +"\n" +"class MyABC(metaclass=ABCMeta):\n" +" pass" +msgstr "" + #: library/abc.rst:57 msgid "Metaclass for defining Abstract Base Classes (ABCs)." msgstr "" @@ -90,6 +107,19 @@ msgid "" "Register *subclass* as a \"virtual subclass\" of this ABC. For example::" msgstr "" +#: library/abc.rst:75 +msgid "" +"from abc import ABC\n" +"\n" +"class MyABC(ABC):\n" +" pass\n" +"\n" +"MyABC.register(tuple)\n" +"\n" +"assert issubclass(tuple, MyABC)\n" +"assert isinstance((), MyABC)" +msgstr "" + #: library/abc.rst:85 msgid "Returns the registered subclass, to allow usage as a class decorator." msgstr "" @@ -113,7 +143,7 @@ msgid "" "Check whether *subclass* is considered a subclass of this ABC. This means " "that you can customize the behavior of :func:`issubclass` further without " "the need to call :meth:`register` on every class you want to consider a " -"subclass of the ABC. (This class method is called from the :meth:`~class." +"subclass of the ABC. (This class method is called from the :meth:`~type." "__subclasscheck__` method of the ABC.)" msgstr "" @@ -131,27 +161,57 @@ msgid "" "For a demonstration of these concepts, look at this example ABC definition::" msgstr "" +#: library/abc.rst:116 +msgid "" +"class Foo:\n" +" def __getitem__(self, index):\n" +" ...\n" +" def __len__(self):\n" +" ...\n" +" def get_iterator(self):\n" +" return iter(self)\n" +"\n" +"class MyIterable(ABC):\n" +"\n" +" @abstractmethod\n" +" def __iter__(self):\n" +" while False:\n" +" yield None\n" +"\n" +" def get_iterator(self):\n" +" return self.__iter__()\n" +"\n" +" @classmethod\n" +" def __subclasshook__(cls, C):\n" +" if cls is MyIterable:\n" +" if any(\"__iter__\" in B.__dict__ for B in C.__mro__):\n" +" return True\n" +" return NotImplemented\n" +"\n" +"MyIterable.register(Foo)" +msgstr "" + #: library/abc.rst:143 msgid "" -"The ABC ``MyIterable`` defines the standard iterable method, :meth:" -"`~iterator.__iter__`, as an abstract method. The implementation given here " -"can still be called from subclasses. The :meth:`!get_iterator` method is " -"also part of the ``MyIterable`` abstract base class, but it does not have to " -"be overridden in non-abstract derived classes." +"The ABC ``MyIterable`` defines the standard iterable method, :meth:`~object." +"__iter__`, as an abstract method. The implementation given here can still " +"be called from subclasses. The :meth:`!get_iterator` method is also part of " +"the ``MyIterable`` abstract base class, but it does not have to be " +"overridden in non-abstract derived classes." msgstr "" #: library/abc.rst:149 msgid "" "The :meth:`__subclasshook__` class method defined here says that any class " -"that has an :meth:`~iterator.__iter__` method in its :attr:`~object." -"__dict__` (or in that of one of its base classes, accessed via the :attr:" -"`~class.__mro__` list) is considered a ``MyIterable`` too." +"that has an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` " +"(or in that of one of its base classes, accessed via the :attr:`~type." +"__mro__` list) is considered a ``MyIterable`` too." msgstr "" #: library/abc.rst:154 msgid "" "Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, " -"even though it does not define an :meth:`~iterator.__iter__` method (it uses " +"even though it does not define an :meth:`~object.__iter__` method (it uses " "the old-style iterable protocol, defined in terms of :meth:`~object.__len__` " "and :meth:`~object.__getitem__`). Note that this will not make " "``get_iterator`` available as a method of ``Foo``, so it is provided " @@ -193,6 +253,39 @@ msgid "" "the following usage examples::" msgstr "" +#: library/abc.rst:187 +msgid "" +"class C(ABC):\n" +" @abstractmethod\n" +" def my_abstract_method(self, arg1):\n" +" ...\n" +" @classmethod\n" +" @abstractmethod\n" +" def my_abstract_classmethod(cls, arg2):\n" +" ...\n" +" @staticmethod\n" +" @abstractmethod\n" +" def my_abstract_staticmethod(arg3):\n" +" ...\n" +"\n" +" @property\n" +" @abstractmethod\n" +" def my_abstract_property(self):\n" +" ...\n" +" @my_abstract_property.setter\n" +" @abstractmethod\n" +" def my_abstract_property(self, val):\n" +" ...\n" +"\n" +" @abstractmethod\n" +" def _get_x(self):\n" +" ...\n" +" @abstractmethod\n" +" def _set_x(self, val):\n" +" ...\n" +" x = property(_get_x, _set_x)" +msgstr "" + #: library/abc.rst:217 msgid "" "In order to correctly interoperate with the abstract base class machinery, " @@ -202,6 +295,16 @@ msgid "" "Python's built-in :class:`property` does the equivalent of::" msgstr "" +#: library/abc.rst:223 +msgid "" +"class Descriptor:\n" +" ...\n" +" @property\n" +" def __isabstractmethod__(self):\n" +" return any(getattr(f, '__isabstractmethod__', False) for\n" +" f in (self._fget, self._fset, self._fdel))" +msgstr "" + #: library/abc.rst:232 msgid "" "Unlike Java abstract methods, these abstract methods may have an " @@ -233,6 +336,15 @@ msgid "" "correctly identified as abstract when applied to an abstract method::" msgstr "" +#: library/abc.rst:255 +msgid "" +"class C(ABC):\n" +" @classmethod\n" +" @abstractmethod\n" +" def my_abstract_classmethod(cls, arg):\n" +" ..." +msgstr "" + #: library/abc.rst:265 msgid "" "It is now possible to use :class:`staticmethod` with :func:`abstractmethod`, " @@ -251,6 +363,15 @@ msgid "" "now correctly identified as abstract when applied to an abstract method::" msgstr "" +#: library/abc.rst:276 +msgid "" +"class C(ABC):\n" +" @staticmethod\n" +" @abstractmethod\n" +" def my_abstract_staticmethod(arg):\n" +" ..." +msgstr "" + #: library/abc.rst:285 msgid "" "It is now possible to use :class:`property`, :meth:`property.getter`, :meth:" @@ -269,6 +390,15 @@ msgid "" "correctly identified as abstract when applied to an abstract method::" msgstr "" +#: library/abc.rst:297 +msgid "" +"class C(ABC):\n" +" @property\n" +" @abstractmethod\n" +" def my_abstract_property(self):\n" +" ..." +msgstr "" + #: library/abc.rst:303 msgid "" "The above example defines a read-only property; you can also define a read-" @@ -276,12 +406,33 @@ msgid "" "underlying methods as abstract::" msgstr "" +#: library/abc.rst:307 +msgid "" +"class C(ABC):\n" +" @property\n" +" def x(self):\n" +" ...\n" +"\n" +" @x.setter\n" +" @abstractmethod\n" +" def x(self, val):\n" +" ..." +msgstr "" + #: library/abc.rst:317 msgid "" "If only some components are abstract, only those components need to be " "updated to create a concrete property in a subclass::" msgstr "" +#: library/abc.rst:320 +msgid "" +"class D(C):\n" +" @C.x.setter\n" +" def x(self, val):\n" +" ..." +msgstr "" + #: library/abc.rst:326 msgid "The :mod:`!abc` module also provides the following functions:" msgstr "" diff --git a/library/aifc.po b/library/aifc.po index 7aa329e4..3c81ccaa 100644 --- a/library/aifc.po +++ b/library/aifc.po @@ -8,275 +8,347 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2024-12-23 14:33+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/aifc.rst:2 -msgid ":mod:`aifc` --- Read and write AIFF and AIFC files" -msgstr "" - -#: library/aifc.rst:8 -msgid "**Source code:** :source:`Lib/aifc.py`" -msgstr "" - -#: library/aifc.rst:19 -msgid "" -"The :mod:`aifc` module is deprecated (see :pep:`PEP 594 <594#aifc>` for " -"details)." -msgstr "" - -#: library/aifc.rst:22 -msgid "" -"This module provides support for reading and writing AIFF and AIFF-C files. " -"AIFF is Audio Interchange File Format, a format for storing digital audio " -"samples in a file. AIFF-C is a newer version of the format that includes " -"the ability to compress the audio data." -msgstr "" - -#: library/aifc.rst:27 -msgid "" -"Audio files have a number of parameters that describe the audio data. The " -"sampling rate or frame rate is the number of times per second the sound is " -"sampled. The number of channels indicate if the audio is mono, stereo, or " -"quadro. Each frame consists of one sample per channel. The sample size is " -"the size in bytes of each sample. Thus a frame consists of ``nchannels * " -"samplesize`` bytes, and a second's worth of audio consists of ``nchannels * " -"samplesize * framerate`` bytes." -msgstr "" - -#: library/aifc.rst:35 -msgid "" -"For example, CD quality audio has a sample size of two bytes (16 bits), uses " -"two channels (stereo) and has a frame rate of 44,100 frames/second. This " -"gives a frame size of 4 bytes (2\\*2), and a second's worth occupies " -"2\\*2\\*44100 bytes (176,400 bytes)." -msgstr "" - -#: library/aifc.rst:40 -msgid "Module :mod:`aifc` defines the following function:" -msgstr "" - -#: library/aifc.rst:45 -msgid "" -"Open an AIFF or AIFF-C file and return an object instance with methods that " -"are described below. The argument *file* is either a string naming a file " -"or a :term:`file object`. *mode* must be ``'r'`` or ``'rb'`` when the file " -"must be opened for reading, or ``'w'`` or ``'wb'`` when the file must be " -"opened for writing. If omitted, ``file.mode`` is used if it exists, " -"otherwise ``'rb'`` is used. When used for writing, the file object should " -"be seekable, unless you know ahead of time how many samples you are going to " -"write in total and use :meth:`writeframesraw` and :meth:`setnframes`. The :" -"func:`.open` function may be used in a :keyword:`with` statement. When the :" -"keyword:`!with` block completes, the :meth:`~aifc.close` method is called." -msgstr "" - -#: library/aifc.rst:56 -msgid "Support for the :keyword:`with` statement was added." -msgstr "" - -#: library/aifc.rst:59 -msgid "" -"Objects returned by :func:`.open` when a file is opened for reading have the " -"following methods:" -msgstr "" - -#: library/aifc.rst:65 -msgid "Return the number of audio channels (1 for mono, 2 for stereo)." -msgstr "" - -#: library/aifc.rst:70 -msgid "Return the size in bytes of individual samples." -msgstr "" - -#: library/aifc.rst:75 -msgid "Return the sampling rate (number of audio frames per second)." -msgstr "" - -#: library/aifc.rst:80 -msgid "Return the number of audio frames in the file." -msgstr "" - -#: library/aifc.rst:85 -msgid "" -"Return a bytes array of length 4 describing the type of compression used in " -"the audio file. For AIFF files, the returned value is ``b'NONE'``." -msgstr "" - -#: library/aifc.rst:92 -msgid "" -"Return a bytes array convertible to a human-readable description of the type " -"of compression used in the audio file. For AIFF files, the returned value " -"is ``b'not compressed'``." -msgstr "" - -#: library/aifc.rst:99 -msgid "" -"Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " -"framerate, nframes, comptype, compname)``, equivalent to output of the :meth:" -"`get\\*` methods." -msgstr "" - -#: library/aifc.rst:106 -msgid "" -"Return a list of markers in the audio file. A marker consists of a tuple of " -"three elements. The first is the mark ID (an integer), the second is the " -"mark position in frames from the beginning of the data (an integer), the " -"third is the name of the mark (a string)." -msgstr "" - -#: library/aifc.rst:114 -msgid "" -"Return the tuple as described in :meth:`getmarkers` for the mark with the " -"given *id*." -msgstr "" - -#: library/aifc.rst:120 -msgid "" -"Read and return the next *nframes* frames from the audio file. The returned " -"data is a string containing for each frame the uncompressed samples of all " -"channels." -msgstr "" - -#: library/aifc.rst:127 -msgid "" -"Rewind the read pointer. The next :meth:`readframes` will start from the " -"beginning." -msgstr "" - -#: library/aifc.rst:133 -msgid "Seek to the specified frame number." -msgstr "" - -#: library/aifc.rst:138 -msgid "Return the current frame number." -msgstr "" - -#: library/aifc.rst:143 -msgid "" -"Close the AIFF file. After calling this method, the object can no longer be " -"used." -msgstr "" - -#: library/aifc.rst:146 -msgid "" -"Objects returned by :func:`.open` when a file is opened for writing have all " -"the above methods, except for :meth:`readframes` and :meth:`setpos`. In " -"addition the following methods exist. The :meth:`get\\*` methods can only " -"be called after the corresponding :meth:`set\\*` methods have been called. " -"Before the first :meth:`writeframes` or :meth:`writeframesraw`, all " -"parameters except for the number of frames must be filled in." -msgstr "" - -#: library/aifc.rst:156 -msgid "" -"Create an AIFF file. The default is that an AIFF-C file is created, unless " -"the name of the file ends in ``'.aiff'`` in which case the default is an " -"AIFF file." -msgstr "" - -#: library/aifc.rst:162 -msgid "" -"Create an AIFF-C file. The default is that an AIFF-C file is created, " -"unless the name of the file ends in ``'.aiff'`` in which case the default is " -"an AIFF file." -msgstr "" - -#: library/aifc.rst:169 -msgid "Specify the number of channels in the audio file." -msgstr "" - -#: library/aifc.rst:174 -msgid "Specify the size in bytes of audio samples." -msgstr "" - -#: library/aifc.rst:179 -msgid "Specify the sampling frequency in frames per second." -msgstr "" - -#: library/aifc.rst:184 -msgid "" -"Specify the number of frames that are to be written to the audio file. If " -"this parameter is not set, or not set correctly, the file needs to support " -"seeking." -msgstr "" - -#: library/aifc.rst:195 -msgid "" -"Specify the compression type. If not specified, the audio data will not be " -"compressed. In AIFF files, compression is not possible. The name parameter " -"should be a human-readable description of the compression type as a bytes " -"array, the type parameter should be a bytes array of length 4. Currently " -"the following compression types are supported: ``b'NONE'``, ``b'ULAW'``, " -"``b'ALAW'``, ``b'G722'``." -msgstr "" - -#: library/aifc.rst:205 -msgid "" -"Set all the above parameters at once. The argument is a tuple consisting of " -"the various parameters. This means that it is possible to use the result of " -"a :meth:`getparams` call as argument to :meth:`setparams`." -msgstr "" - -#: library/aifc.rst:212 -msgid "" -"Add a mark with the given id (larger than 0), and the given name at the " -"given position. This method can be called at any time before :meth:`close`." -msgstr "" - -#: library/aifc.rst:219 -msgid "" -"Return the current write position in the output file. Useful in combination " -"with :meth:`setmark`." -msgstr "" - -#: library/aifc.rst:225 -msgid "" -"Write data to the output file. This method can only be called after the " -"audio file parameters have been set." -msgstr "" - -#: library/aifc.rst:237 -msgid "Any :term:`bytes-like object` is now accepted." -msgstr "" +#, fuzzy +msgid ":mod:`!aifc` --- Read and write AIFF and AIFC files" +msgstr ":mod:`aifc` --- Ανάγνωση και εγγραφή AIFF και AIFC αρχείων" -#: library/aifc.rst:234 +#: library/aifc.rst:10 msgid "" -"Like :meth:`writeframes`, except that the header of the audio file is not " -"updated." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/aifc.rst:244 +#: library/aifc.rst:14 msgid "" -"Close the AIFF file. The header of the file is updated to reflect the " -"actual size of the audio data. After calling this method, the object can no " -"longer be used." -msgstr "" - -#: library/aifc.rst:10 -msgid "Audio Interchange File Format" -msgstr "" - -#: library/aifc.rst:10 -msgid "AIFF" -msgstr "" - -#: library/aifc.rst:10 -msgid "AIFF-C" -msgstr "" - -#: library/aifc.rst:190 -msgid "u-LAW" -msgstr "" - -#: library/aifc.rst:190 -msgid "A-LAW" -msgstr "" - -#: library/aifc.rst:190 -msgid "G.722" -msgstr "" +"The last version of Python that provided the :mod:`!aifc` module was `Python " +"3.12 `_." +msgstr "" + +#~ msgid "**Source code:** :source:`Lib/aifc.py`" +#~ msgstr "**Πηγαίος κώδικας:** :source:`Lib/aifc.py`" + +#~ msgid "" +#~ "The :mod:`aifc` module is deprecated (see :pep:`PEP 594 <594#aifc>` for " +#~ "details)." +#~ msgstr "" +#~ "Το module :mod:`aifc` είναι κατηργημένο (δείτε το :pep:`PEP 594 " +#~ "<594#aifc>` για λεπτομέρειες)." + +#~ msgid "" +#~ "This module provides support for reading and writing AIFF and AIFF-C " +#~ "files. AIFF is Audio Interchange File Format, a format for storing " +#~ "digital audio samples in a file. AIFF-C is a newer version of the format " +#~ "that includes the ability to compress the audio data." +#~ msgstr "" +#~ "Το module παρέχει υποστήριξη για την ανάγνωση και την εγγραφή AIFF και " +#~ "AIFF-C αρχείων. Το AIFF είναι η μορφή ήχου Audio Interchange File Format, " +#~ "μια μορφή για την αποθήκευση ψηφιακών δειγμάτων ήχου σε ένα αρχείο. Το " +#~ "AIFF-C είναι μια νεότερη έκδοση της μορφής που περιλαμβάνει την " +#~ "δυνατότητα συμπίεσης των δεδομένων ήχου." + +#~ msgid "" +#~ "Audio files have a number of parameters that describe the audio data. The " +#~ "sampling rate or frame rate is the number of times per second the sound " +#~ "is sampled. The number of channels indicate if the audio is mono, " +#~ "stereo, or quadro. Each frame consists of one sample per channel. The " +#~ "sample size is the size in bytes of each sample. Thus a frame consists " +#~ "of ``nchannels * samplesize`` bytes, and a second's worth of audio " +#~ "consists of ``nchannels * samplesize * framerate`` bytes." +#~ msgstr "" +#~ "Τα αρχεία ήχου έχουν έναν αριθμό παραμέτρων που περιγράφουν τα δεδομένα " +#~ "ήχου. Η συχνότητα δειγματοληψίας ή ο ρυθμός καρέ είναι ο αριθμός των " +#~ "φορών ανά δευτερόλεπτο που δειγματοληπτείται ο ήχος. Ο αριθμός των " +#~ "καναλιών δείχνει αν ο ήχος είναι μονοφωνικός, στερεοφωνικός ή " +#~ "τετραφωνικός. Κάθε καρέ αποτελείται από ένα δείγμα ανά κανάλι. Το μέγεθος " +#~ "δείγματος είναι το μέγεθος σε bytes του κάθε δείγματος. Έτσι ένα καρέ " +#~ "αποτελείται από ``nchannels * samplesize`` bytes, και ένα δευτερόλεπτο " +#~ "ήχου από ``nchannels * samplesize * framerate`` bytes." + +#~ msgid "" +#~ "For example, CD quality audio has a sample size of two bytes (16 bits), " +#~ "uses two channels (stereo) and has a frame rate of 44,100 frames/second. " +#~ "This gives a frame size of 4 bytes (2\\*2), and a second's worth occupies " +#~ "2\\*2\\*44100 bytes (176,400 bytes)." +#~ msgstr "" +#~ "Για παράδειγμα, ο ήχος ποιότητας CD έχει μέγεθος δείγματος δύο bytes (16 " +#~ "bits), χρησιμοποιεί δύο κανάλια (στερεοφωνικός ήχος) και έχει ρυθμό καρέ " +#~ "44.100 καρέ/δευτερόλεπτο. Αυτό δίνει μέγεθος καρέ 4 bytes (2\\*2), και " +#~ "ένα δευτερόλεπτο καταλαμβάνει 2\\*2\\*44100 bytes (176.400 bytes). " + +#~ msgid "Module :mod:`aifc` defines the following function:" +#~ msgstr "Το module :mod:`aifc` ορίζει την ακόλουθη συνάρτηση:" + +#~ msgid "" +#~ "Open an AIFF or AIFF-C file and return an object instance with methods " +#~ "that are described below. The argument *file* is either a string naming " +#~ "a file or a :term:`file object`. *mode* must be ``'r'`` or ``'rb'`` when " +#~ "the file must be opened for reading, or ``'w'`` or ``'wb'`` when the " +#~ "file must be opened for writing. If omitted, ``file.mode`` is used if it " +#~ "exists, otherwise ``'rb'`` is used. When used for writing, the file " +#~ "object should be seekable, unless you know ahead of time how many samples " +#~ "you are going to write in total and use :meth:`writeframesraw` and :meth:" +#~ "`setnframes`. The :func:`.open` function may be used in a :keyword:`with` " +#~ "statement. When the :keyword:`!with` block completes, the :meth:`~aifc." +#~ "close` method is called." +#~ msgstr "" +#~ "Ανοίγει ένα αρχείο AIFF ή AIFF-C και επιστρέφει ένα στιγμιότυπο " +#~ "αντικειμένου με μεθόδους που περιγράφονται παρακάτω. Η παράμετρος *file* " +#~ "είναι είτε μια συμβολοσειρά που καθορίζει το όνομα του αρχείου είτε ένα :" +#~ "term:`file object`. Η παράμετρος *mode* πρέπει να είναι ``'r'`` ή " +#~ "``'rb'`` όταν το αρχείο πρέπει να ανοίξει για ανάγνωση, ή ``'w'`` ή " +#~ "``'wb'`` όταν το αρχείο πρέπει να ανοίξει για εγγραφή. Αν παραληφθεί, " +#~ "χρησιμοποιείται το ``file.mode`` αν υπάρχει, διαφορετικά χρησιμοποιείται " +#~ "το ``'rb'``. Όταν χρησιμοποιείται για εγγραφή, το αντικείμενο αρχείου θα " +#~ "πρέπει να είναι αναζητήσιμο, εκτός αν γνωρίζετε εκ των προτέρων πόσα " +#~ "δείγματα θα γράψετε συνολικά και χρησιμοποιήσετε τις μεθόδους :meth:" +#~ "`writeframesraw` και :meth:`setnframes`. Η συνάρτηση :func:`.open` μπορεί " +#~ "να χρησιμοποιηθεί σε μια δήλωση :keyword:`with`. Όταν ολοκληρωθεί το " +#~ "μπλοκ :keyword:`!with`, καλείται η μέθοδος :meth:`~aifc.close`." + +#~ msgid "Support for the :keyword:`with` statement was added." +#~ msgstr "Προστέθηκε υποστήριξη για τη δήλωση :keyword:`with`." + +#~ msgid "" +#~ "Objects returned by :func:`.open` when a file is opened for reading have " +#~ "the following methods:" +#~ msgstr "" +#~ "Τα αντικείμενα που επιστρέφονται από τη συνάρτηση :func:`.open` όταν ένα " +#~ "αρχείο είναι ανοιχτό για ανάγνωση διαθέτουν τις παρακάτω μεθόδους: " + +#~ msgid "Return the number of audio channels (1 for mono, 2 for stereo)." +#~ msgstr "" +#~ "Επιστρέφει τον αριθμό των καναλιών ήχου (1 για μονοφωνικό ήχο, 2 για " +#~ "στερεοφωνικό ήχο)." + +#~ msgid "Return the size in bytes of individual samples." +#~ msgstr "Επιστρέφει το μέγεθος σε bytes των μεμονωμένων δειγμάτων." + +#~ msgid "Return the sampling rate (number of audio frames per second)." +#~ msgstr "" +#~ "Επιστρέφει το ρυθμό δειγματοληψίας (αριθμός καρέ ήχου ανά δευτερόλεπτο)." + +#~ msgid "Return the number of audio frames in the file." +#~ msgstr "Επιστρέφει τον αριθμό των καρέ ήχου στο αρχείο." + +#~ msgid "" +#~ "Return a bytes array of length 4 describing the type of compression used " +#~ "in the audio file. For AIFF files, the returned value is ``b'NONE'``." +#~ msgstr "" +#~ "Επιστρέφει έναν πίνακα από bytes μήκους 4 που περιγράφει τον τύπο " +#~ "συμπίεσης που χρησιμοποιείται στο αρχείο ήχου. Για τα αρχεία AIFF, η " +#~ "επιστρεφόμενη τιμή είναι ``b'NONE'``." + +#~ msgid "" +#~ "Return a bytes array convertible to a human-readable description of the " +#~ "type of compression used in the audio file. For AIFF files, the returned " +#~ "value is ``b'not compressed'``." +#~ msgstr "" +#~ "Επιστρέφει έναν πίνακα από bytes που μπορεί να μετατραπεί σε αναγνώσιμη " +#~ "περιγραφή του τύπου συμπίεσης που χρησιμοποιείται στο αρχείο ήχου. Για τα " +#~ "αρχεία AIFF, η επιστρεφόμενη τιμή είναι ``b'not compressed'``." + +#~ msgid "" +#~ "Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " +#~ "framerate, nframes, comptype, compname)``, equivalent to output of the :" +#~ "meth:`get\\*` methods." +#~ msgstr "" +#~ "Επιστρέφει μια πλειάδα :func:`~collections.namedtuple` ``(nchannels, " +#~ "sampwidth, framerate, nframes, comptype, compname)``, η οποία είναι " +#~ "ισοδύναμη με την έξοδο των μεθόδων :meth:`get\\*`." + +#~ msgid "" +#~ "Return a list of markers in the audio file. A marker consists of a tuple " +#~ "of three elements. The first is the mark ID (an integer), the second is " +#~ "the mark position in frames from the beginning of the data (an integer), " +#~ "the third is the name of the mark (a string)." +#~ msgstr "" +#~ "Επιστρέφει μια λίστα με δείκτες στο αρχείο ήχου. Ένας δείκτης αποτελείται " +#~ "από μια πλειάδα με τρία στοιχεία. Το πρώτο είναι το αναγνωριστικό του " +#~ "δείκτη (ένας ακέραιος), το δεύτερο είναι η θέση του δείκτη σε καρέ από " +#~ "την αρχή των δεδομένων (ένας ακέραιος), το τρίτο είναι το όνομα του " +#~ "δείκτη (μια συμβολοσειρά)." + +#~ msgid "" +#~ "Return the tuple as described in :meth:`getmarkers` for the mark with the " +#~ "given *id*." +#~ msgstr "" +#~ "Επιστρέφει την πλειάδα όπως περιγράφεται στη μέθοδο :meth:`getmarkers` " +#~ "για το δείκτη με το δοσμένο *id*. " + +#~ msgid "" +#~ "Read and return the next *nframes* frames from the audio file. The " +#~ "returned data is a string containing for each frame the uncompressed " +#~ "samples of all channels." +#~ msgstr "" +#~ "Διαβάζει και επιστρέφει τα επόμενα *nframes* καρέ από το αρχείο ήχου. Τα " +#~ "δεδομένα που επιστρέφονται είναι μια αλυσίδα που περιέχει για κάθε καρέ " +#~ "τα αποσυμπιεσμένα δείγματα όλων των καναλιών." + +#~ msgid "" +#~ "Rewind the read pointer. The next :meth:`readframes` will start from the " +#~ "beginning." +#~ msgstr "" +#~ "Επαναφέρει τον δείκτη ανάγνωσης. Η επόμενη μέθοδος :meth:`readframes` θα " +#~ "ξεκινήσει από την αρχή." + +#~ msgid "Seek to the specified frame number." +#~ msgstr "Μετακινεί το δείκτη στο καθορισμένο αριθμό καρέ." + +#~ msgid "Return the current frame number." +#~ msgstr "Επιστρέφει τον τρέχοντα αριθμό καρέ." + +#~ msgid "" +#~ "Close the AIFF file. After calling this method, the object can no longer " +#~ "be used." +#~ msgstr "" +#~ "Κλείνει το αρχείο AIFF. Μετά την κλήση αυτής της μεθόδου, το αντικείμενο " +#~ "δεν μπορεί πλέον να χρησιμοποιηθεί." + +#~ msgid "" +#~ "Objects returned by :func:`.open` when a file is opened for writing have " +#~ "all the above methods, except for :meth:`readframes` and :meth:`setpos`. " +#~ "In addition the following methods exist. The :meth:`get\\*` methods can " +#~ "only be called after the corresponding :meth:`set\\*` methods have been " +#~ "called. Before the first :meth:`writeframes` or :meth:`writeframesraw`, " +#~ "all parameters except for the number of frames must be filled in." +#~ msgstr "" +#~ "Τα αντικείμενα που επιστρέφονται από τη συνάρτηση :func:`.open` όταν ένα " +#~ "αρχείο ανοίγεται για εγγραφή έχουν όλες τις παραπάνω μεθόδους, εκτός από " +#~ "τις μεθόδους :meth:`readframes` και :meth:`setpos`. Επίσης, υπάρχουν οι " +#~ "εξής μέθοδοι. Οι μέθοδοι :meth:`get\\*` μπορούν να κληθούν μόνο αφού " +#~ "έχουν κληθεί οι αντίστοιχες μέθοδοι :meth:`set\\*`. Πριν την πρώτη κλήση " +#~ "των μεθόδων :meth:`writeframes` ή :meth:`writeframesraw`, όλες οι " +#~ "παράμετροι εκτός από τον αριθμό των καρέ πρέπει να είναι συμπληρωμένες." + +#~ msgid "" +#~ "Create an AIFF file. The default is that an AIFF-C file is created, " +#~ "unless the name of the file ends in ``'.aiff'`` in which case the default " +#~ "is an AIFF file." +#~ msgstr "" +#~ "Δημιουργία αρχείου AIFF. Η προεπιλογή είναι να δημιουργηθεί ένα αρχείο " +#~ "AIFF-C, εκτός αν το όνομα του αρχείου λήγει σε ``'.aiff'`` οπότε η " +#~ "προεπιλογή είναι ένα αρχείο AIFF." + +#~ msgid "" +#~ "Create an AIFF-C file. The default is that an AIFF-C file is created, " +#~ "unless the name of the file ends in ``'.aiff'`` in which case the default " +#~ "is an AIFF file." +#~ msgstr "" +#~ "Δημιουργία αρχείου AIFF-C. Η προεπιλογή είναι να δημιουργηθεί ένα αρχείο " +#~ "AIFF-C, εκτός αν το όνομα του αρχείου λήγει σε ``'.aiff'`` οπότε η " +#~ "προεπιλογή είναι ένα αρχείο AIFF." + +#~ msgid "Specify the number of channels in the audio file." +#~ msgstr "Καθορίζει τον αριθμό των καναλιών στο αρχείο ήχου." + +#~ msgid "Specify the size in bytes of audio samples." +#~ msgstr "Καθορίζει το μέγεθος σε bytes των δειγμάτων ήχου." + +#~ msgid "Specify the sampling frequency in frames per second." +#~ msgstr "Καθορίζει τη συχνότητα δειγματοληψίας σε καρέ ανά δευτερόλεπτο." + +#~ msgid "" +#~ "Specify the number of frames that are to be written to the audio file. If " +#~ "this parameter is not set, or not set correctly, the file needs to " +#~ "support seeking." +#~ msgstr "" +#~ "Καθορίστε τον αριθμό των καρέ που πρέπει να εγγραφούν στο αρχείο ήχου. " +#~ "Εάν αυτή η παράμετρος δεν έχει ρυθμιστεί ή δεν έχει ρυθμιστεί σωστά, το " +#~ "αρχείο πρέπει να υποστηρίζει αναζήτηση. " + +#~ msgid "" +#~ "Specify the compression type. If not specified, the audio data will not " +#~ "be compressed. In AIFF files, compression is not possible. The name " +#~ "parameter should be a human-readable description of the compression type " +#~ "as a bytes array, the type parameter should be a bytes array of length " +#~ "4. Currently the following compression types are supported: ``b'NONE'``, " +#~ "``b'ULAW'``, ``b'ALAW'``, ``b'G722'``." +#~ msgstr "" +#~ "Καθορίζει τον τύπο συμπίεσης. Εάν δεν καθοριστεί, τα δεδομένα ήχου δεν θα " +#~ "συμπιεστούν. Στα αρχεία AIFF, η συμπίεση δεν είναι δυνατή. Η παράμετρος " +#~ "όνομα θα πρέπει να είναι μια αναγνώσιμη περιγραφή του τύπου συμπίεσης ως " +#~ "πίνακας byte, ενώ η παράμετρος τύπος θα πρέπει να είναι ένας πίνακας από " +#~ "bytes μήκους 4. Προς το παρόν υποστηρίζονται οι εξής τύποι συμπίεσης: " +#~ "``b'NONE'``, ``b'ULAW'``, ``b'ALAW'``, ``b'G722'``." + +#~ msgid "" +#~ "Set all the above parameters at once. The argument is a tuple consisting " +#~ "of the various parameters. This means that it is possible to use the " +#~ "result of a :meth:`getparams` call as argument to :meth:`setparams`." +#~ msgstr "" +#~ "Ορίζει όλες τις παραμέτρους παραπάνω ταυτόχρονα. Η παράμετρος είναι μια " +#~ "πλειάδα που αποτελείται από τις διάφορες παραμέτρους. Αυτό σημαίνει ότι " +#~ "είναι δυνατό να χρησιμοποιηθεί το αποτέλεσμα μιας κλήσης μεθόδου :meth:" +#~ "`getparams` ως παράμετρος στην μέθοδο :meth:`setparams`." + +#~ msgid "" +#~ "Add a mark with the given id (larger than 0), and the given name at the " +#~ "given position. This method can be called at any time before :meth:" +#~ "`close`." +#~ msgstr "" +#~ "Προσθέστε ένα δείκτη με το δοσμένο αναγνωριστικό (μεγαλύτερο από 0), και " +#~ "το δοσμένο όνομα στη δοσμένη θέση. Αυτή η μέθοδος μπορεί να κληθεί " +#~ "οποιαδήποτε στιγμή πριν από την μέθοδο :meth:`close`." + +#~ msgid "" +#~ "Return the current write position in the output file. Useful in " +#~ "combination with :meth:`setmark`." +#~ msgstr "" +#~ "Επιστρέφει την τρέχουσα θέση εγγραφής στο αρχείο εξόδου. Χρήσιμο σε " +#~ "συνδυασμό με τη μέθοδο :meth:`setmark`." + +#~ msgid "" +#~ "Write data to the output file. This method can only be called after the " +#~ "audio file parameters have been set." +#~ msgstr "" +#~ "Γράφει δεδομένα στο αρχείο εξόδου. Αυτή η μέθοδος μπορεί να κληθεί μόνο " +#~ "μετά τη ρύθμιση των παραμέτρων του αρχείου ήχου." + +#~ msgid "Any :term:`bytes-like object` is now accepted." +#~ msgstr "" +#~ "Τώρα γίνονται αποδεκτά όλα τα αντικείμενα τύπου :term:`bytes-like object`." + +#~ msgid "" +#~ "Like :meth:`writeframes`, except that the header of the audio file is not " +#~ "updated." +#~ msgstr "" +#~ "Όπως η μέθοδος :meth:`writeframes`, εκτός από το γεγονός ότι η κεφαλίδα " +#~ "του αρχείου ήχου δεν ενημερώνεται." + +#~ msgid "" +#~ "Close the AIFF file. The header of the file is updated to reflect the " +#~ "actual size of the audio data. After calling this method, the object can " +#~ "no longer be used." +#~ msgstr "" +#~ "Κλείστε το αρχείο AIFF. Η κεφαλίδα του αρχείου ενημερώνεται για να " +#~ "αντανακλά το πραγματικό μέγεθος των δεδομένων ήχου. Μετά την κλήση αυτής " +#~ "της μεθόδου, το αντικείμενο δεν μπορεί να χρησιμοποιηθεί πια." + +#~ msgid "Audio Interchange File Format" +#~ msgstr "Audio Interchange File Format" + +#~ msgid "AIFF" +#~ msgstr "AIFF" + +#~ msgid "AIFF-C" +#~ msgstr "AIFF-C" + +#~ msgid "u-LAW" +#~ msgstr "u-LAW" + +#~ msgid "A-LAW" +#~ msgstr "A-LAW" + +#~ msgid "G.722" +#~ msgstr "G.722" diff --git a/library/allos.po b/library/allos.po index 03258fc1..c6fc13f7 100644 --- a/library/allos.po +++ b/library/allos.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/annotationlib.po b/library/annotationlib.po new file mode 100644 index 00000000..8f186e93 --- /dev/null +++ b/library/annotationlib.po @@ -0,0 +1,996 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/annotationlib.rst:2 +msgid ":mod:`!annotationlib` --- Functionality for introspecting annotations" +msgstr "" + +#: library/annotationlib.rst:9 +msgid "**Source code:** :source:`Lib/annotationlib.py`" +msgstr "" + +#: library/annotationlib.rst:18 +msgid "" +"The :mod:`!annotationlib` module provides tools for introspecting :term:" +"`annotations ` on modules, classes, and functions." +msgstr "" + +#: library/annotationlib.rst:21 +msgid "" +"Annotations are :ref:`lazily evaluated ` and often contain " +"forward references to objects that are not yet defined when the annotation " +"is created. This module provides a set of low-level tools that can be used " +"to retrieve annotations in a reliable way, even in the presence of forward " +"references and other edge cases." +msgstr "" + +#: library/annotationlib.rst:26 +msgid "" +"This module supports retrieving annotations in three main formats (see :" +"class:`Format`), each of which works best for different use cases:" +msgstr "" + +#: library/annotationlib.rst:29 +msgid "" +":attr:`~Format.VALUE` evaluates the annotations and returns their value. " +"This is most straightforward to work with, but it may raise errors, for " +"example if the annotations contain references to undefined names." +msgstr "" + +#: library/annotationlib.rst:32 +msgid "" +":attr:`~Format.FORWARDREF` returns :class:`ForwardRef` objects for " +"annotations that cannot be resolved, allowing you to inspect the annotations " +"without evaluating them. This is useful when you need to work with " +"annotations that may contain unresolved forward references." +msgstr "" + +#: library/annotationlib.rst:36 +msgid "" +":attr:`~Format.STRING` returns the annotations as a string, similar to how " +"it would appear in the source file. This is useful for documentation " +"generators that want to display annotations in a readable way." +msgstr "" + +#: library/annotationlib.rst:40 +msgid "" +"The :func:`get_annotations` function is the main entry point for retrieving " +"annotations. Given a function, class, or module, it returns an annotations " +"dictionary in the requested format. This module also provides functionality " +"for working directly with the :term:`annotate function` that is used to " +"evaluate annotations, such as :func:`get_annotate_from_class_namespace` and :" +"func:`call_annotate_function`, as well as the :func:`call_evaluate_function` " +"function for working with :term:`evaluate functions `." +msgstr "" + +#: library/annotationlib.rst:51 +msgid "" +"Most functionality in this module can execute arbitrary code; see :ref:`the " +"security section ` for more information." +msgstr "" + +#: library/annotationlib.rst:56 +msgid "" +":pep:`649` proposed the current model for how annotations work in Python." +msgstr "" + +#: library/annotationlib.rst:58 +msgid "" +":pep:`749` expanded on various aspects of :pep:`649` and introduced the :mod:" +"`!annotationlib` module." +msgstr "" + +#: library/annotationlib.rst:61 +msgid "" +":ref:`annotations-howto` provides best practices for working with " +"annotations." +msgstr "" + +#: library/annotationlib.rst:64 +msgid "" +":pypi:`typing-extensions` provides a backport of :func:`get_annotations` " +"that works on earlier versions of Python." +msgstr "" + +#: library/annotationlib.rst:68 +msgid "Annotation semantics" +msgstr "" + +#: library/annotationlib.rst:70 +msgid "" +"The way annotations are evaluated has changed over the history of Python 3, " +"and currently still depends on a :ref:`future import `. There have " +"been execution models for annotations:" +msgstr "" + +#: library/annotationlib.rst:74 +msgid "" +"*Stock semantics* (default in Python 3.0 through 3.13; see :pep:`3107` and :" +"pep:`526`): Annotations are evaluated eagerly, as they are encountered in " +"the source code." +msgstr "" + +#: library/annotationlib.rst:77 +msgid "" +"*Stringified annotations* (used with ``from __future__ import annotations`` " +"in Python 3.7 and newer; see :pep:`563`): Annotations are stored as strings " +"only." +msgstr "" + +#: library/annotationlib.rst:80 +msgid "" +"*Deferred evaluation* (default in Python 3.14 and newer; see :pep:`649` and :" +"pep:`749`): Annotations are evaluated lazily, only when they are accessed." +msgstr "" + +#: library/annotationlib.rst:83 +msgid "As an example, consider the following program::" +msgstr "" + +#: library/annotationlib.rst:85 +msgid "" +"def func(a: Cls) -> None:\n" +" print(a)\n" +"\n" +"class Cls: pass\n" +"\n" +"print(func.__annotations__)" +msgstr "" + +#: library/annotationlib.rst:92 +msgid "This will behave as follows:" +msgstr "" + +#: library/annotationlib.rst:94 +msgid "" +"Under stock semantics (Python 3.13 and earlier), it will throw a :exc:" +"`NameError` at the line where ``func`` is defined, because ``Cls`` is an " +"undefined name at that point." +msgstr "" + +#: library/annotationlib.rst:97 +msgid "" +"Under stringified annotations (if ``from __future__ import annotations`` is " +"used), it will print ``{'a': 'Cls', 'return': 'None'}``." +msgstr "" + +#: library/annotationlib.rst:99 +msgid "" +"Under deferred evaluation (Python 3.14 and later), it will print ``{'a': " +", 'return': None}``." +msgstr "" + +#: library/annotationlib.rst:102 +msgid "" +"Stock semantics were used when function annotations were first introduced in " +"Python 3.0 (by :pep:`3107`) because this was the simplest, most obvious way " +"to implement annotations. The same execution model was used when variable " +"annotations were introduced in Python 3.6 (by :pep:`526`). However, stock " +"semantics caused problems when using annotations as type hints, such as a " +"need to refer to names that are not yet defined when the annotation is " +"encountered. In addition, there were performance problems with executing " +"annotations at module import time. Therefore, in Python 3.7, :pep:`563` " +"introduced the ability to store annotations as strings using the ``from " +"__future__ import annotations`` syntax. The plan at the time was to " +"eventually make this behavior the default, but a problem appeared: " +"stringified annotations are more difficult to process for those who " +"introspect annotations at runtime. An alternative proposal, :pep:`649`, " +"introduced the third execution model, deferred evaluation, and was " +"implemented in Python 3.14. Stringified annotations are still used if ``from " +"__future__ import annotations`` is present, but this behavior will " +"eventually be removed." +msgstr "" + +#: library/annotationlib.rst:121 +msgid "Classes" +msgstr "" + +#: library/annotationlib.rst:125 +msgid "" +"An :class:`~enum.IntEnum` describing the formats in which annotations can be " +"returned. Members of the enum, or their equivalent integer values, can be " +"passed to :func:`get_annotations` and other functions in this module, as " +"well as to :attr:`~object.__annotate__` functions." +msgstr "" + +#: library/annotationlib.rst:133 +msgid "Values are the result of evaluating the annotation expressions." +msgstr "" + +#: library/annotationlib.rst:138 +msgid "" +"Special value used to signal that an annotate function is being evaluated in " +"a special environment with fake globals. When passed this value, annotate " +"functions should either return the same value as for the :attr:`Format." +"VALUE` format, or raise :exc:`NotImplementedError` to signal that they do " +"not support execution in this environment. This format is only used " +"internally and should not be passed to the functions in this module." +msgstr "" + +#: library/annotationlib.rst:149 +msgid "" +"Values are real annotation values (as per :attr:`Format.VALUE` format) for " +"defined values, and :class:`ForwardRef` proxies for undefined values. Real " +"objects may contain references to :class:`ForwardRef` proxy objects." +msgstr "" + +#: library/annotationlib.rst:157 +msgid "" +"Values are the text string of the annotation as it appears in the source " +"code, up to modifications including, but not restricted to, whitespace " +"normalizations and constant values optimizations." +msgstr "" + +#: library/annotationlib.rst:161 +msgid "" +"The exact values of these strings may change in future versions of Python." +msgstr "" + +#: library/annotationlib.rst:167 +msgid "A proxy object for forward references in annotations." +msgstr "" + +#: library/annotationlib.rst:169 +msgid "" +"Instances of this class are returned when the :attr:`~Format.FORWARDREF` " +"format is used and annotations contain a name that cannot be resolved. This " +"can happen when a forward reference is used in an annotation, such as when a " +"class is referenced before it is defined." +msgstr "" + +#: library/annotationlib.rst:176 +msgid "" +"A string containing the code that was evaluated to produce the :class:" +"`~ForwardRef`. The string may not be exactly equivalent to the original " +"source." +msgstr "" + +#: library/annotationlib.rst:182 +msgid "Evaluate the forward reference, returning its value." +msgstr "" + +#: library/annotationlib.rst:184 +msgid "" +"If the *format* argument is :attr:`~Format.VALUE` (the default), this method " +"may throw an exception, such as :exc:`NameError`, if the forward reference " +"refers to a name that cannot be resolved. The arguments to this method can " +"be used to provide bindings for names that would otherwise be undefined. If " +"the *format* argument is :attr:`~Format.FORWARDREF`, the method will never " +"throw an exception, but may return a :class:`~ForwardRef` instance. For " +"example, if the forward reference object contains the code " +"``list[undefined]``, where ``undefined`` is a name that is not defined, " +"evaluating it with the :attr:`~Format.FORWARDREF` format will return " +"``list[ForwardRef('undefined')]``. If the *format* argument is :attr:" +"`~Format.STRING`, the method will return :attr:`~ForwardRef.__forward_arg__`." +msgstr "" + +#: library/annotationlib.rst:196 +msgid "" +"The *owner* parameter provides the preferred mechanism for passing scope " +"information to this method. The owner of a :class:`~ForwardRef` is the " +"object that contains the annotation from which the :class:`~ForwardRef` " +"derives, such as a module object, type object, or function object." +msgstr "" + +#: library/annotationlib.rst:201 +msgid "" +"The *globals*, *locals*, and *type_params* parameters provide a more precise " +"mechanism for influencing the names that are available when the :class:" +"`~ForwardRef` is evaluated. *globals* and *locals* are passed to :func:" +"`eval`, representing the global and local namespaces in which the name is " +"evaluated. The *type_params* parameter is relevant for objects created using " +"the native syntax for :ref:`generic classes ` and :ref:" +"`functions `. It is a tuple of :ref:`type parameters " +"` that are in scope while the forward reference is being " +"evaluated. For example, if evaluating a :class:`~ForwardRef` retrieved from " +"an annotation found in the class namespace of a generic class ``C``, " +"*type_params* should be set to ``C.__type_params__``." +msgstr "" + +#: library/annotationlib.rst:212 +msgid "" +":class:`~ForwardRef` instances returned by :func:`get_annotations` retain " +"references to information about the scope they originated from, so calling " +"this method with no further arguments may be sufficient to evaluate such " +"objects. :class:`~ForwardRef` instances created by other means may not have " +"any information about their scope, so passing arguments to this method may " +"be necessary to evaluate them successfully." +msgstr "" + +#: library/annotationlib.rst:219 +msgid "" +"If no *owner*, *globals*, *locals*, or *type_params* are provided and the :" +"class:`~ForwardRef` does not contain information about its origin, empty " +"globals and locals dictionaries are used." +msgstr "" + +#: library/annotationlib.rst:227 +msgid "Functions" +msgstr "" + +#: library/annotationlib.rst:231 +msgid "" +"Convert an annotations dict containing runtime values to a dict containing " +"only strings. If the values are not already strings, they are converted " +"using :func:`type_repr`. This is meant as a helper for user-provided " +"annotate functions that support the :attr:`~Format.STRING` format but do not " +"have access to the code creating the annotations." +msgstr "" + +#: library/annotationlib.rst:238 +msgid "" +"For example, this is used to implement the :attr:`~Format.STRING` for :class:" +"`typing.TypedDict` classes created through the functional syntax:" +msgstr "" + +#: library/annotationlib.rst:241 +msgid "" +">>> from typing import TypedDict\n" +">>> Movie = TypedDict(\"movie\", {\"name\": str, \"year\": int})\n" +">>> get_annotations(Movie, format=Format.STRING)\n" +"{'name': 'str', 'year': 'int'}" +msgstr "" + +#: library/annotationlib.rst:252 +msgid "" +"Call the :term:`annotate function` *annotate* with the given *format*, a " +"member of the :class:`Format` enum, and return the annotations dictionary " +"produced by the function." +msgstr "" + +#: library/annotationlib.rst:256 +msgid "" +"This helper function is required because annotate functions generated by the " +"compiler for functions, classes, and modules only support the :attr:`~Format." +"VALUE` format when called directly. To support other formats, this function " +"calls the annotate function in a special environment that allows it to " +"produce annotations in the other formats. This is a useful building block " +"when implementing functionality that needs to partially evaluate annotations " +"while a class is being constructed." +msgstr "" + +#: library/annotationlib.rst:265 +msgid "" +"*owner* is the object that owns the annotation function, usually a function, " +"class, or module. If provided, it is used in the :attr:`~Format.FORWARDREF` " +"format to produce a :class:`ForwardRef` object that carries more information." +msgstr "" + +#: library/annotationlib.rst:272 +msgid "" +":PEP:`PEP 649 <649#the-stringizer-and-the-fake-globals-environment>` " +"contains an explanation of the implementation technique used by this " +"function." +msgstr "" + +#: library/annotationlib.rst:280 +msgid "" +"Call the :term:`evaluate function` *evaluate* with the given *format*, a " +"member of the :class:`Format` enum, and return the value produced by the " +"function. This is similar to :func:`call_annotate_function`, but the latter " +"always returns a dictionary mapping strings to annotations, while this " +"function returns a single value." +msgstr "" + +#: library/annotationlib.rst:286 +msgid "" +"This is intended for use with the evaluate functions generated for lazily " +"evaluated elements related to type aliases and type parameters:" +msgstr "" + +#: library/annotationlib.rst:289 +msgid ":meth:`typing.TypeAliasType.evaluate_value`, the value of type aliases" +msgstr "" + +#: library/annotationlib.rst:290 +msgid ":meth:`typing.TypeVar.evaluate_bound`, the bound of type variables" +msgstr "" + +#: library/annotationlib.rst:291 +msgid "" +":meth:`typing.TypeVar.evaluate_constraints`, the constraints of type " +"variables" +msgstr "" + +#: library/annotationlib.rst:293 +msgid "" +":meth:`typing.TypeVar.evaluate_default`, the default value of type variables" +msgstr "" + +#: library/annotationlib.rst:295 +msgid "" +":meth:`typing.ParamSpec.evaluate_default`, the default value of parameter " +"specifications" +msgstr "" + +#: library/annotationlib.rst:297 +msgid "" +":meth:`typing.TypeVarTuple.evaluate_default`, the default value of type " +"variable tuples" +msgstr "" + +#: library/annotationlib.rst:300 +msgid "" +"*owner* is the object that owns the evaluate function, such as the type " +"alias or type variable object." +msgstr "" + +#: library/annotationlib.rst:303 +msgid "" +"*format* can be used to control the format in which the value is returned:" +msgstr "" + +#: library/annotationlib.rst:305 +msgid "" +">>> type Alias = undefined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.VALUE)\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" +"ForwardRef('undefined')\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.STRING)\n" +"'undefined'" +msgstr "" + +#: library/annotationlib.rst:321 +msgid "" +"Retrieve the :term:`annotate function` from a class namespace dictionary " +"*namespace*. Return :const:`!None` if the namespace does not contain an " +"annotate function. This is primarily useful before the class has been fully " +"created (e.g., in a metaclass); after the class exists, the annotate " +"function can be retrieved with ``cls.__annotate__``. See :ref:`below " +"` for an example using this function in a metaclass." +msgstr "" + +#: library/annotationlib.rst:331 +msgid "Compute the annotations dict for an object." +msgstr "" + +#: library/annotationlib.rst:333 +msgid "" +"*obj* may be a callable, class, module, or other object with :attr:`~object." +"__annotate__` or :attr:`~object.__annotations__` attributes. Passing any " +"other object raises :exc:`TypeError`." +msgstr "" + +#: library/annotationlib.rst:337 +msgid "" +"The *format* parameter controls the format in which annotations are " +"returned, and must be a member of the :class:`Format` enum or its integer " +"equivalent. The different formats work as follows:" +msgstr "" + +#: library/annotationlib.rst:341 +msgid "" +"VALUE: :attr:`!object.__annotations__` is tried first; if that does not " +"exist, the :attr:`!object.__annotate__` function is called if it exists." +msgstr "" + +#: library/annotationlib.rst:344 +msgid "" +"FORWARDREF: If :attr:`!object.__annotations__` exists and can be evaluated " +"successfully, it is used; otherwise, the :attr:`!object.__annotate__` " +"function is called. If it does not exist either, :attr:`!object." +"__annotations__` is tried again and any error from accessing it is re-raised." +msgstr "" + +#: library/annotationlib.rst:349 +msgid "" +"When calling :attr:`!object.__annotate__` it is first called with :attr:" +"`~Format.FORWARDREF`. If this is not implemented, it will then check if :" +"attr:`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the fake " +"globals environment. If neither of these formats are supported, it will fall " +"back to using :attr:`~Format.VALUE`. If :attr:`~Format.VALUE` fails, the " +"error from this call will be raised." +msgstr "" + +#: library/annotationlib.rst:355 +msgid "" +"STRING: If :attr:`!object.__annotate__` exists, it is called first; " +"otherwise, :attr:`!object.__annotations__` is used and stringified using :" +"func:`annotations_to_string`." +msgstr "" + +#: library/annotationlib.rst:359 +msgid "" +"When calling :attr:`!object.__annotate__` it is first called with :attr:" +"`~Format.STRING`. If this is not implemented, it will then check if :attr:" +"`~Format.VALUE_WITH_FAKE_GLOBALS` is supported and use that in the fake " +"globals environment. If neither of these formats are supported, it will fall " +"back to using :attr:`~Format.VALUE` with the result converted using :func:" +"`annotations_to_string`. If :attr:`~Format.VALUE` fails, the error from this " +"call will be raised." +msgstr "" + +#: library/annotationlib.rst:366 +msgid "" +"Returns a dict. :func:`!get_annotations` returns a new dict every time it's " +"called; calling it twice on the same object will return two different but " +"equivalent dicts." +msgstr "" + +#: library/annotationlib.rst:370 +msgid "This function handles several details for you:" +msgstr "" + +#: library/annotationlib.rst:372 +msgid "" +"If *eval_str* is true, values of type :class:`!str` will be un-stringized " +"using :func:`eval`. This is intended for use with stringized annotations " +"(``from __future__ import annotations``). It is an error to set *eval_str* " +"to true with formats other than :attr:`Format.VALUE`." +msgstr "" + +#: library/annotationlib.rst:377 +msgid "" +"If *obj* doesn't have an annotations dict, returns an empty dict. (Functions " +"and methods always have an annotations dict; classes, modules, and other " +"types of callables may not.)" +msgstr "" + +#: library/annotationlib.rst:381 +msgid "" +"Ignores inherited annotations on classes, as well as annotations on " +"metaclasses. If a class doesn't have its own annotations dict, returns an " +"empty dict." +msgstr "" + +#: library/annotationlib.rst:384 +msgid "" +"All accesses to object members and dict values are done using ``getattr()`` " +"and ``dict.get()`` for safety." +msgstr "" + +#: library/annotationlib.rst:387 +msgid "" +"*eval_str* controls whether or not values of type :class:`!str` are replaced " +"with the result of calling :func:`eval` on those values:" +msgstr "" + +#: library/annotationlib.rst:390 +msgid "" +"If eval_str is true, :func:`eval` is called on values of type :class:`!str`. " +"(Note that :func:`!get_annotations` doesn't catch exceptions; if :func:" +"`eval` raises an exception, it will unwind the stack past the :func:`!" +"get_annotations` call.)" +msgstr "" + +#: library/annotationlib.rst:394 +msgid "" +"If *eval_str* is false (the default), values of type :class:`!str` are " +"unchanged." +msgstr "" + +#: library/annotationlib.rst:397 +msgid "" +"*globals* and *locals* are passed in to :func:`eval`; see the documentation " +"for :func:`eval` for more information. If *globals* or *locals* is :const:`!" +"None`, this function may replace that value with a context-specific default, " +"contingent on ``type(obj)``:" +msgstr "" + +#: library/annotationlib.rst:402 +msgid "If *obj* is a module, *globals* defaults to ``obj.__dict__``." +msgstr "" + +#: library/annotationlib.rst:403 +msgid "" +"If *obj* is a class, *globals* defaults to ``sys.modules[obj.__module__]." +"__dict__`` and *locals* defaults to the *obj* class namespace." +msgstr "" + +#: library/annotationlib.rst:406 +msgid "" +"If *obj* is a callable, *globals* defaults to :attr:`obj.__globals__ " +"`, although if *obj* is a wrapped function (using :" +"func:`functools.update_wrapper`) or a :class:`functools.partial` object, it " +"is unwrapped until a non-wrapped function is found." +msgstr "" + +#: library/annotationlib.rst:412 +msgid "" +"Calling :func:`!get_annotations` is best practice for accessing the " +"annotations dict of any object. See :ref:`annotations-howto` for more " +"information on annotations best practices." +msgstr "" + +#: library/annotationlib.rst:416 +msgid "" +">>> def f(a: int, b: str) -> float:\n" +"... pass\n" +">>> get_annotations(f)\n" +"{'a': , 'b': , 'return': }" +msgstr "" + +#: library/annotationlib.rst:427 +msgid "" +"Convert an arbitrary Python value to a format suitable for use by the :attr:" +"`~Format.STRING` format. This calls :func:`repr` for most objects, but has " +"special handling for some objects, such as type objects." +msgstr "" + +#: library/annotationlib.rst:431 +msgid "" +"This is meant as a helper for user-provided annotate functions that support " +"the :attr:`~Format.STRING` format but do not have access to the code " +"creating the annotations. It can also be used to provide a user-friendly " +"string representation for other objects that contain values that are " +"commonly encountered in annotations." +msgstr "" + +#: library/annotationlib.rst:441 +msgid "Recipes" +msgstr "" + +#: library/annotationlib.rst:446 +msgid "Using annotations in a metaclass" +msgstr "" + +#: library/annotationlib.rst:448 +msgid "" +"A :ref:`metaclass ` may want to inspect or even modify the " +"annotations in a class body during class creation. Doing so requires " +"retrieving annotations from the class namespace dictionary. For classes " +"created with ``from __future__ import annotations``, the annotations will be " +"in the ``__annotations__`` key of the dictionary. For other classes with " +"annotations, :func:`get_annotate_from_class_namespace` can be used to get " +"the annotate function, and :func:`call_annotate_function` can be used to " +"call it and retrieve the annotations. Using the :attr:`~Format.FORWARDREF` " +"format will usually be best, because this allows the annotations to refer to " +"names that cannot yet be resolved when the class is created." +msgstr "" + +#: library/annotationlib.rst:459 +msgid "" +"To modify the annotations, it is best to create a wrapper annotate function " +"that calls the original annotate function, makes any necessary adjustments, " +"and returns the result." +msgstr "" + +#: library/annotationlib.rst:463 +msgid "" +"Below is an example of a metaclass that filters out all :class:`typing." +"ClassVar` annotations from the class and puts them in a separate attribute:" +msgstr "" + +#: library/annotationlib.rst:466 +msgid "" +"import annotationlib\n" +"import typing\n" +"\n" +"class ClassVarSeparator(type):\n" +" def __new__(mcls, name, bases, ns):\n" +" if \"__annotations__\" in ns: # from __future__ import annotations\n" +" annotations = ns[\"__annotations__\"]\n" +" classvar_keys = {\n" +" key for key, value in annotations.items()\n" +" # Use string comparison for simplicity; a more robust solution\n" +" # could use annotationlib.ForwardRef.evaluate\n" +" if value.startswith(\"ClassVar\")\n" +" }\n" +" classvars = {key: annotations[key] for key in classvar_keys}\n" +" ns[\"__annotations__\"] = {\n" +" key: value for key, value in annotations.items()\n" +" if key not in classvar_keys\n" +" }\n" +" wrapped_annotate = None\n" +" elif annotate := annotationlib.get_annotate_from_class_namespace(ns):\n" +" annotations = annotationlib.call_annotate_function(\n" +" annotate, format=annotationlib.Format.FORWARDREF\n" +" )\n" +" classvar_keys = {\n" +" key for key, value in annotations.items()\n" +" if typing.get_origin(value) is typing.ClassVar\n" +" }\n" +" classvars = {key: annotations[key] for key in classvar_keys}\n" +"\n" +" def wrapped_annotate(format):\n" +" annos = annotationlib.call_annotate_function(annotate, format, " +"owner=typ)\n" +" return {key: value for key, value in annos.items() if key not in " +"classvar_keys}\n" +"\n" +" else: # no annotations\n" +" classvars = {}\n" +" wrapped_annotate = None\n" +" typ = super().__new__(mcls, name, bases, ns)\n" +"\n" +" if wrapped_annotate is not None:\n" +" # Wrap the original __annotate__ with a wrapper that removes " +"ClassVars\n" +" typ.__annotate__ = wrapped_annotate\n" +" typ.classvars = classvars # Store the ClassVars in a separate " +"attribute\n" +" return typ" +msgstr "" + +#: library/annotationlib.rst:514 +msgid "Limitations of the ``STRING`` format" +msgstr "" + +#: library/annotationlib.rst:516 +msgid "" +"The :attr:`~Format.STRING` format is meant to approximate the source code of " +"the annotation, but the implementation strategy used means that it is not " +"always possible to recover the exact source code." +msgstr "" + +#: library/annotationlib.rst:520 +msgid "" +"First, the stringifier of course cannot recover any information that is not " +"present in the compiled code, including comments, whitespace, " +"parenthesization, and operations that get simplified by the compiler." +msgstr "" + +#: library/annotationlib.rst:524 +msgid "" +"Second, the stringifier can intercept almost all operations that involve " +"names looked up in some scope, but it cannot intercept operations that " +"operate fully on constants. As a corollary, this also means it is not safe " +"to request the ``STRING`` format on untrusted code: Python is powerful " +"enough that it is possible to achieve arbitrary code execution even with no " +"access to any globals or builtins. For example:" +msgstr "" + +#: library/annotationlib.rst:530 +msgid "" +">>> def f(x: (1).__class__.__base__.__subclasses__()[-1].__init__." +"__builtins__[\"print\"](\"Hello world\")): pass\n" +"...\n" +">>> annotationlib.get_annotations(f, format=annotationlib.Format.STRING)\n" +"Hello world\n" +"{'x': 'None'}" +msgstr "" + +#: library/annotationlib.rst:539 +msgid "" +"This particular example works as of the time of writing, but it relies on " +"implementation details and is not guaranteed to work in the future." +msgstr "" + +#: library/annotationlib.rst:542 +msgid "" +"Among the different kinds of expressions that exist in Python, as " +"represented by the :mod:`ast` module, some expressions are supported, " +"meaning that the ``STRING`` format can generally recover the original source " +"code; others are unsupported, meaning that they may result in incorrect " +"output or an error." +msgstr "" + +#: library/annotationlib.rst:547 +msgid "The following are supported (sometimes with caveats):" +msgstr "" + +#: library/annotationlib.rst:549 +msgid ":class:`ast.BinOp`" +msgstr "" + +#: library/annotationlib.rst:550 +msgid ":class:`ast.UnaryOp`" +msgstr "" + +#: library/annotationlib.rst:552 +msgid "" +":class:`ast.Invert` (``~``), :class:`ast.UAdd` (``+``), and :class:`ast." +"USub` (``-``) are supported" +msgstr "" + +#: library/annotationlib.rst:553 +msgid ":class:`ast.Not` (``not``) is not supported" +msgstr "" + +#: library/annotationlib.rst:555 +msgid ":class:`ast.Dict` (except when using ``**`` unpacking)" +msgstr "" + +#: library/annotationlib.rst:556 +msgid ":class:`ast.Set`" +msgstr "" + +#: library/annotationlib.rst:557 +msgid ":class:`ast.Compare`" +msgstr "" + +#: library/annotationlib.rst:559 +msgid ":class:`ast.Eq` and :class:`ast.NotEq` are supported" +msgstr "" + +#: library/annotationlib.rst:560 +msgid "" +":class:`ast.Lt`, :class:`ast.LtE`, :class:`ast.Gt`, and :class:`ast.GtE` are " +"supported, but the operand may be flipped" +msgstr "" + +#: library/annotationlib.rst:561 +msgid "" +":class:`ast.Is`, :class:`ast.IsNot`, :class:`ast.In`, and :class:`ast.NotIn` " +"are not supported" +msgstr "" + +#: library/annotationlib.rst:563 +msgid ":class:`ast.Call` (except when using ``**`` unpacking)" +msgstr "" + +#: library/annotationlib.rst:564 +msgid "" +":class:`ast.Constant` (though not the exact representation of the constant; " +"for example, escape sequences in strings are lost; hexadecimal numbers are " +"converted to decimal)" +msgstr "" + +#: library/annotationlib.rst:566 +msgid ":class:`ast.Attribute` (assuming the value is not a constant)" +msgstr "" + +#: library/annotationlib.rst:567 +msgid ":class:`ast.Subscript` (assuming the value is not a constant)" +msgstr "" + +#: library/annotationlib.rst:568 +msgid ":class:`ast.Starred` (``*`` unpacking)" +msgstr "" + +#: library/annotationlib.rst:569 +msgid ":class:`ast.Name`" +msgstr "" + +#: library/annotationlib.rst:570 +msgid ":class:`ast.List`" +msgstr "" + +#: library/annotationlib.rst:571 +msgid ":class:`ast.Tuple`" +msgstr "" + +#: library/annotationlib.rst:572 +msgid ":class:`ast.Slice`" +msgstr "" + +#: library/annotationlib.rst:574 +msgid "" +"The following are unsupported, but throw an informative error when " +"encountered by the stringifier:" +msgstr "" + +#: library/annotationlib.rst:577 +msgid "" +":class:`ast.FormattedValue` (f-strings; error is not detected if conversion " +"specifiers like ``!r`` are used)" +msgstr "" + +#: library/annotationlib.rst:579 +msgid ":class:`ast.JoinedStr` (f-strings)" +msgstr "" + +#: library/annotationlib.rst:581 +msgid "The following are unsupported and result in incorrect output:" +msgstr "" + +#: library/annotationlib.rst:583 +msgid ":class:`ast.BoolOp` (``and`` and ``or``)" +msgstr "" + +#: library/annotationlib.rst:584 +msgid ":class:`ast.IfExp`" +msgstr "" + +#: library/annotationlib.rst:585 +msgid ":class:`ast.Lambda`" +msgstr "" + +#: library/annotationlib.rst:586 +msgid ":class:`ast.ListComp`" +msgstr "" + +#: library/annotationlib.rst:587 +msgid ":class:`ast.SetComp`" +msgstr "" + +#: library/annotationlib.rst:588 +msgid ":class:`ast.DictComp`" +msgstr "" + +#: library/annotationlib.rst:589 +msgid ":class:`ast.GeneratorExp`" +msgstr "" + +#: library/annotationlib.rst:591 +msgid "" +"The following are disallowed in annotation scopes and therefore not relevant:" +msgstr "" + +#: library/annotationlib.rst:593 +msgid ":class:`ast.NamedExpr` (``:=``)" +msgstr "" + +#: library/annotationlib.rst:594 +msgid ":class:`ast.Await`" +msgstr "" + +#: library/annotationlib.rst:595 +msgid ":class:`ast.Yield`" +msgstr "" + +#: library/annotationlib.rst:596 +msgid ":class:`ast.YieldFrom`" +msgstr "" + +#: library/annotationlib.rst:600 +msgid "Limitations of the ``FORWARDREF`` format" +msgstr "" + +#: library/annotationlib.rst:602 +msgid "" +"The :attr:`~Format.FORWARDREF` format aims to produce real values as much as " +"possible, with anything that cannot be resolved replaced with :class:" +"`ForwardRef` objects. It is affected by broadly the same Limitations as the :" +"attr:`~Format.STRING` format: annotations that perform operations on " +"literals or that use unsupported expression types may raise exceptions when " +"evaluated using the :attr:`~Format.FORWARDREF` format." +msgstr "" + +#: library/annotationlib.rst:609 +msgid "Below are a few examples of the behavior with unsupported expressions:" +msgstr "" + +#: library/annotationlib.rst:611 +msgid "" +">>> from annotationlib import get_annotations, Format\n" +">>> def zerodiv(x: 1 / 0): ...\n" +">>> get_annotations(zerodiv, format=Format.STRING)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> get_annotations(zerodiv, format=Format.FORWARDREF)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> def ifexp(x: 1 if y else 0): ...\n" +">>> get_annotations(ifexp, format=Format.STRING)\n" +"{'x': '1'}" +msgstr "" + +#: library/annotationlib.rst:630 +msgid "Security implications of introspecting annotations" +msgstr "" + +#: library/annotationlib.rst:632 +msgid "" +"Much of the functionality in this module involves executing code related to " +"annotations, which can then do arbitrary things. For example, :func:" +"`get_annotations` may call an arbitrary :term:`annotate function`, and :meth:" +"`ForwardRef.evaluate` may call :func:`eval` on an arbitrary string. Code " +"contained in an annotation might make arbitrary system calls, enter an " +"infinite loop, or perform any other operation. This is also true for any " +"access of the :attr:`~object.__annotations__` attribute, and for various " +"functions in the :mod:`typing` module that work with annotations, such as :" +"func:`typing.get_type_hints`." +msgstr "" + +#: library/annotationlib.rst:641 +msgid "" +"Any security issue arising from this also applies immediately after " +"importing code that may contain untrusted annotations: importing code can " +"always cause arbitrary operations to be performed. However, it is unsafe to " +"accept strings or other input from an untrusted source and pass them to any " +"of the APIs for introspecting annotations, for example by editing an " +"``__annotations__`` dictionary or directly creating a :class:`ForwardRef` " +"object." +msgstr "" diff --git a/library/archiving.po b/library/archiving.po index f0cd772a..72272be4 100644 --- a/library/archiving.po +++ b/library/archiving.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -23,7 +24,7 @@ msgstr "" #: library/archiving.rst:7 msgid "" "The modules described in this chapter support data compression with the " -"zlib, gzip, bzip2 and lzma algorithms, and the creation of ZIP- and tar-" -"format archives. See also :ref:`archiving-operations` provided by the :mod:" -"`shutil` module." +"zlib, gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and " +"tar-format archives. See also :ref:`archiving-operations` provided by the :" +"mod:`shutil` module." msgstr "" diff --git a/library/argparse.po b/library/argparse.po index 97951801..493ed308 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -8,480 +8,396 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/argparse.rst:2 msgid "" -":mod:`argparse` --- Parser for command-line options, arguments and sub-" -"commands" +":mod:`!argparse` --- Parser for command-line options, arguments and " +"subcommands" msgstr "" #: library/argparse.rst:12 msgid "**Source code:** :source:`Lib/argparse.py`" msgstr "" +#: library/argparse.rst:16 +msgid "" +"While :mod:`argparse` is the default recommended standard library module for " +"implementing basic command line applications, authors with more exacting " +"requirements for exactly how their command line applications behave may find " +"it doesn't provide the necessary level of control. Refer to :ref:`choosing-" +"an-argument-parser` for alternatives to consider when ``argparse`` doesn't " +"support behaviors that the application requires (such as entirely disabling " +"support for interspersed options and positional arguments, or accepting " +"option parameter values that start with ``-`` even when they correspond to " +"another defined option)." +msgstr "" + #: library/argparse.rst:-1 msgid "Tutorial" msgstr "" -#: library/argparse.rst:18 +#: library/argparse.rst:30 msgid "" "This page contains the API reference information. For a more gentle " "introduction to Python command-line parsing, have a look at the :ref:" "`argparse tutorial `." msgstr "" -#: library/argparse.rst:22 +#: library/argparse.rst:34 msgid "" -"The :mod:`argparse` module makes it easy to write user-friendly command-line " -"interfaces. The program defines what arguments it requires, and :mod:" -"`argparse` will figure out how to parse those out of :data:`sys.argv`. The :" -"mod:`argparse` module also automatically generates help and usage messages. " -"The module will also issue errors when users give the program invalid " -"arguments." +"The :mod:`!argparse` module makes it easy to write user-friendly command-" +"line interfaces. The program defines what arguments it requires, and :mod:`!" +"argparse` will figure out how to parse those out of :data:`sys.argv`. The :" +"mod:`!argparse` module also automatically generates help and usage " +"messages. The module will also issue errors when users give the program " +"invalid arguments." msgstr "" -#: library/argparse.rst:30 -msgid "Core Functionality" -msgstr "" - -#: library/argparse.rst:32 +#: library/argparse.rst:40 msgid "" -"The :mod:`argparse` module's support for command-line interfaces is built " +"The :mod:`!argparse` module's support for command-line interfaces is built " "around an instance of :class:`argparse.ArgumentParser`. It is a container " "for argument specifications and has options that apply to the parser as " "whole::" msgstr "" -#: library/argparse.rst:41 +#: library/argparse.rst:44 +msgid "" +"parser = argparse.ArgumentParser(\n" +" prog='ProgramName',\n" +" description='What the program does',\n" +" epilog='Text at the bottom of help')" +msgstr "" + +#: library/argparse.rst:49 msgid "" "The :meth:`ArgumentParser.add_argument` method attaches individual argument " "specifications to the parser. It supports positional arguments, options " "that accept values, and on/off flags::" msgstr "" -#: library/argparse.rst:50 +#: library/argparse.rst:53 msgid "" -"The :meth:`ArgumentParser.parse_args` method runs the parser and places the " -"extracted data in a :class:`argparse.Namespace` object::" +"parser.add_argument('filename') # positional argument\n" +"parser.add_argument('-c', '--count') # option that takes a value\n" +"parser.add_argument('-v', '--verbose',\n" +" action='store_true') # on/off flag" msgstr "" #: library/argparse.rst:58 -msgid "Quick Links for add_argument()" -msgstr "" - -#: library/argparse.rst:61 -msgid "Name" -msgstr "" - -#: library/argparse.rst:61 -msgid "Description" -msgstr "" - -#: library/argparse.rst:61 -msgid "Values" -msgstr "" - -#: library/argparse.rst:63 -msgid "action_" -msgstr "" - -#: library/argparse.rst:63 -msgid "Specify how an argument should be handled" -msgstr "" - -#: library/argparse.rst:63 msgid "" -"``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " -"``'append_const'``, ``'count'``, ``'help'``, ``'version'``" -msgstr "" - -#: library/argparse.rst:64 -msgid "choices_" -msgstr "" - -#: library/argparse.rst:64 -msgid "Limit values to a specific set of choices" +"The :meth:`ArgumentParser.parse_args` method runs the parser and places the " +"extracted data in a :class:`argparse.Namespace` object::" msgstr "" -#: library/argparse.rst:64 +#: library/argparse.rst:61 msgid "" -"``['foo', 'bar']``, ``range(1, 10)``, or :class:`~collections.abc.Container` " -"instance" -msgstr "" - -#: library/argparse.rst:65 -msgid "const_" +"args = parser.parse_args()\n" +"print(args.filename, args.count, args.verbose)" msgstr "" #: library/argparse.rst:65 -msgid "Store a constant value" -msgstr "" - -#: library/argparse.rst:66 -msgid "default_" -msgstr "" - -#: library/argparse.rst:66 -msgid "Default value used when an argument is not provided" -msgstr "" - -#: library/argparse.rst:66 -msgid "Defaults to ``None``" -msgstr "" - -#: library/argparse.rst:67 -msgid "dest_" -msgstr "" - -#: library/argparse.rst:67 -msgid "Specify the attribute name used in the result namespace" -msgstr "" - -#: library/argparse.rst:68 -msgid "help_" -msgstr "" - -#: library/argparse.rst:68 -msgid "Help message for an argument" -msgstr "" - -#: library/argparse.rst:69 -msgid "metavar_" -msgstr "" - -#: library/argparse.rst:69 -msgid "Alternate display name for the argument as shown in help" -msgstr "" - -#: library/argparse.rst:70 -msgid "nargs_" -msgstr "" - -#: library/argparse.rst:70 -msgid "Number of times the argument can be used" -msgstr "" - -#: library/argparse.rst:70 -msgid ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" -msgstr "" - -#: library/argparse.rst:71 -msgid "required_" -msgstr "" - -#: library/argparse.rst:71 -msgid "Indicate whether an argument is required or optional" -msgstr "" - -#: library/argparse.rst:71 -msgid "``True`` or ``False``" -msgstr "" - -#: library/argparse.rst:72 -msgid ":ref:`type `" -msgstr "" - -#: library/argparse.rst:72 -msgid "Automatically convert an argument to the given type" -msgstr "" - -#: library/argparse.rst:72 -msgid "" -":class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable " -"function" -msgstr "" - -#: library/argparse.rst:77 -msgid "Example" -msgstr "" - -#: library/argparse.rst:79 msgid "" -"The following code is a Python program that takes a list of integers and " -"produces either the sum or the max::" +"If you're looking for a guide about how to upgrade :mod:`optparse` code to :" +"mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" -#: library/argparse.rst:94 -msgid "" -"Assuming the above Python code is saved into a file called ``prog.py``, it " -"can be run at the command line and it provides useful help messages:" -msgstr "" - -#: library/argparse.rst:111 -msgid "" -"When run with the appropriate arguments, it prints either the sum or the max " -"of the command-line integers:" -msgstr "" - -#: library/argparse.rst:122 -msgid "If invalid arguments are passed in, an error will be displayed:" -msgstr "" - -#: library/argparse.rst:130 -msgid "The following sections walk you through this example." -msgstr "" - -#: library/argparse.rst:134 -msgid "Creating a parser" -msgstr "" - -#: library/argparse.rst:136 -msgid "" -"The first step in using the :mod:`argparse` is creating an :class:" -"`ArgumentParser` object::" -msgstr "" - -#: library/argparse.rst:141 -msgid "" -"The :class:`ArgumentParser` object will hold all the information necessary " -"to parse the command line into Python data types." -msgstr "" - -#: library/argparse.rst:146 -msgid "Adding arguments" -msgstr "" - -#: library/argparse.rst:148 -msgid "" -"Filling an :class:`ArgumentParser` with information about program arguments " -"is done by making calls to the :meth:`~ArgumentParser.add_argument` method. " -"Generally, these calls tell the :class:`ArgumentParser` how to take the " -"strings on the command line and turn them into objects. This information is " -"stored and used when :meth:`~ArgumentParser.parse_args` is called. For " -"example::" -msgstr "" - -#: library/argparse.rst:160 -msgid "" -"Later, calling :meth:`~ArgumentParser.parse_args` will return an object with " -"two attributes, ``integers`` and ``accumulate``. The ``integers`` attribute " -"will be a list of one or more integers, and the ``accumulate`` attribute " -"will be either the :func:`sum` function, if ``--sum`` was specified at the " -"command line, or the :func:`max` function if it was not." -msgstr "" - -#: library/argparse.rst:168 -msgid "Parsing arguments" -msgstr "" - -#: library/argparse.rst:170 -msgid "" -":class:`ArgumentParser` parses arguments through the :meth:`~ArgumentParser." -"parse_args` method. This will inspect the command line, convert each " -"argument to the appropriate type and then invoke the appropriate action. In " -"most cases, this means a simple :class:`Namespace` object will be built up " -"from attributes parsed out of the command line::" -msgstr "" - -#: library/argparse.rst:179 -msgid "" -"In a script, :meth:`~ArgumentParser.parse_args` will typically be called " -"with no arguments, and the :class:`ArgumentParser` will automatically " -"determine the command-line arguments from :data:`sys.argv`." -msgstr "" - -#: library/argparse.rst:185 +#: library/argparse.rst:69 msgid "ArgumentParser objects" msgstr "" -#: library/argparse.rst:194 +#: library/argparse.rst:79 msgid "" "Create a new :class:`ArgumentParser` object. All parameters should be passed " "as keyword arguments. Each parameter has its own more detailed description " "below, but in short they are:" msgstr "" -#: library/argparse.rst:198 +#: library/argparse.rst:83 msgid "" -"prog_ - The name of the program (default: ``os.path.basename(sys.argv[0])``)" +"prog_ - The name of the program (default: generated from the ``__main__`` " +"module attributes and ``sys.argv[0]``)" msgstr "" -#: library/argparse.rst:201 +#: library/argparse.rst:86 msgid "" "usage_ - The string describing the program usage (default: generated from " "arguments added to parser)" msgstr "" -#: library/argparse.rst:204 +#: library/argparse.rst:89 msgid "" "description_ - Text to display before the argument help (by default, no text)" msgstr "" -#: library/argparse.rst:207 +#: library/argparse.rst:92 msgid "epilog_ - Text to display after the argument help (by default, no text)" msgstr "" -#: library/argparse.rst:209 +#: library/argparse.rst:94 msgid "" "parents_ - A list of :class:`ArgumentParser` objects whose arguments should " "also be included" msgstr "" -#: library/argparse.rst:212 +#: library/argparse.rst:97 msgid "formatter_class_ - A class for customizing the help output" msgstr "" -#: library/argparse.rst:214 +#: library/argparse.rst:99 msgid "" "prefix_chars_ - The set of characters that prefix optional arguments " "(default: '-')" msgstr "" -#: library/argparse.rst:217 +#: library/argparse.rst:102 msgid "" "fromfile_prefix_chars_ - The set of characters that prefix files from which " "additional arguments should be read (default: ``None``)" msgstr "" -#: library/argparse.rst:220 +#: library/argparse.rst:105 msgid "" "argument_default_ - The global default value for arguments (default: " "``None``)" msgstr "" -#: library/argparse.rst:223 +#: library/argparse.rst:108 msgid "" "conflict_handler_ - The strategy for resolving conflicting optionals " "(usually unnecessary)" msgstr "" -#: library/argparse.rst:226 +#: library/argparse.rst:111 msgid "" "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" -#: library/argparse.rst:228 +#: library/argparse.rst:113 msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " -"unambiguous. (default: ``True``)" +"unambiguous (default: ``True``)" msgstr "" -#: library/argparse.rst:231 +#: library/argparse.rst:116 msgid "" -"exit_on_error_ - Determines whether or not ArgumentParser exits with error " -"info when an error occurs. (default: ``True``)" +"exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " +"with error info when an error occurs. (default: ``True``)" msgstr "" -#: library/argparse.rst:234 +#: library/argparse.rst:119 +msgid "" +"suggest_on_error_ - Enables suggestions for mistyped argument choices and " +"subparser names (default: ``False``)" +msgstr "" + +#: library/argparse.rst:122 +msgid "color_ - Allow color output (default: ``True``)" +msgstr "" + +#: library/argparse.rst:124 msgid "*allow_abbrev* parameter was added." msgstr "" -#: library/argparse.rst:237 +#: library/argparse.rst:127 msgid "" "In previous versions, *allow_abbrev* also disabled grouping of short flags " "such as ``-vv`` to mean ``-v -v``." msgstr "" -#: library/argparse.rst:241 +#: library/argparse.rst:131 msgid "*exit_on_error* parameter was added." msgstr "" -#: library/argparse.rst:780 +#: library/argparse.rst:134 +msgid "*suggest_on_error* and *color* parameters were added." +msgstr "" + +#: library/argparse.rst:689 msgid "The following sections describe how each of these are used." msgstr "" -#: library/argparse.rst:250 +#: library/argparse.rst:143 msgid "prog" msgstr "" -#: library/argparse.rst:252 +#: library/argparse.rst:146 +msgid "" +"By default, :class:`ArgumentParser` calculates the name of the program to " +"display in help messages depending on the way the Python interpreter was run:" +msgstr "" + +#: library/argparse.rst:149 +msgid "" +"The :func:`base name ` of ``sys.argv[0]`` if a file was " +"passed as argument." +msgstr "" + +#: library/argparse.rst:151 +msgid "" +"The Python interpreter name followed by ``sys.argv[0]`` if a directory or a " +"zipfile was passed as argument." +msgstr "" + +#: library/argparse.rst:153 +msgid "" +"The Python interpreter name followed by ``-m`` followed by the module or " +"package name if the :option:`-m` option was used." +msgstr "" + +#: library/argparse.rst:156 +msgid "" +"This default is almost always desirable because it will make the help " +"messages match the string that was used to invoke the program on the command " +"line. However, to change this default behavior, another value can be " +"supplied using the ``prog=`` argument to :class:`ArgumentParser`::" +msgstr "" + +#: library/argparse.rst:161 msgid "" -"By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine " -"how to display the name of the program in help messages. This default is " -"almost always desirable because it will make the help messages match how the " -"program was invoked on the command line. For example, consider a file named " -"``myprogram.py`` with the following code::" +">>> parser = argparse.ArgumentParser(prog='myprogram')\n" +">>> parser.print_help()\n" +"usage: myprogram [-h]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" msgstr "" -#: library/argparse.rst:263 +#: library/argparse.rst:168 msgid "" -"The help for this program will display ``myprogram.py`` as the program name " -"(regardless of where the program was invoked from):" +"Note that the program name, whether determined from ``sys.argv[0]``, from " +"the ``__main__`` module attributes or from the ``prog=`` argument, is " +"available to help messages using the ``%(prog)s`` format specifier." msgstr "" -#: library/argparse.rst:282 +#: library/argparse.rst:175 msgid "" -"To change this default behavior, another value can be supplied using the " -"``prog=`` argument to :class:`ArgumentParser`::" +">>> parser = argparse.ArgumentParser(prog='myprogram')\n" +">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" +">>> parser.print_help()\n" +"usage: myprogram [-h] [--foo FOO]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo FOO foo of the myprogram program" msgstr "" -#: library/argparse.rst:292 +#: library/argparse.rst:184 msgid "" -"Note that the program name, whether determined from ``sys.argv[0]`` or from " -"the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " -"format specifier." +"The default ``prog`` value now reflects how ``__main__`` was actually " +"executed, rather than always being ``os.path.basename(sys.argv[0])``." msgstr "" -#: library/argparse.rst:309 +#: library/argparse.rst:189 msgid "usage" msgstr "" -#: library/argparse.rst:311 +#: library/argparse.rst:191 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " -"arguments it contains::" +"arguments it contains. The default message can be overridden with the " +"``usage=`` keyword argument::" msgstr "" -#: library/argparse.rst:327 +#: library/argparse.rst:195 msgid "" -"The default message can be overridden with the ``usage=`` keyword argument::" +">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " +"[options]')\n" +">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" +">>> parser.add_argument('bar', nargs='+', help='bar help')\n" +">>> parser.print_help()\n" +"usage: PROG [options]\n" +"\n" +"positional arguments:\n" +" bar bar help\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo [FOO] foo help" msgstr "" -#: library/argparse.rst:342 +#: library/argparse.rst:208 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: library/argparse.rst:349 +#: library/argparse.rst:211 +msgid "" +"When a custom usage message is specified for the main parser, you may also " +"want to consider passing the ``prog`` argument to :meth:`~ArgumentParser." +"add_subparsers` or the ``prog`` and the ``usage`` arguments to :meth:" +"`~_SubParsersAction.add_parser`, to ensure consistent command prefixes and " +"usage information across subparsers." +msgstr "" + +#: library/argparse.rst:221 msgid "description" msgstr "" -#: library/argparse.rst:351 +#: library/argparse.rst:223 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " "of what the program does and how it works. In help messages, the " "description is displayed between the command-line usage string and the help " -"messages for the various arguments::" +"messages for the various arguments." msgstr "" -#: library/argparse.rst:366 +#: library/argparse.rst:229 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: library/argparse.rst:371 +#: library/argparse.rst:234 msgid "epilog" msgstr "" -#: library/argparse.rst:373 +#: library/argparse.rst:236 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: library/argparse.rst:390 +#: library/argparse.rst:240 +msgid "" +">>> parser = argparse.ArgumentParser(\n" +"... description='A foo that bars',\n" +"... epilog=\"And that's how you'd foo a bar\")\n" +">>> parser.print_help()\n" +"usage: argparse.py [-h]\n" +"\n" +"A foo that bars\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"And that's how you'd foo a bar" +msgstr "" + +#: library/argparse.rst:253 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: library/argparse.rst:396 +#: library/argparse.rst:259 msgid "parents" msgstr "" -#: library/argparse.rst:398 +#: library/argparse.rst:261 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " @@ -492,32 +408,48 @@ msgid "" "object being constructed::" msgstr "" -#: library/argparse.rst:418 +#: library/argparse.rst:268 +msgid "" +">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" +">>> parent_parser.add_argument('--parent', type=int)\n" +"\n" +">>> foo_parser = argparse.ArgumentParser(parents=[parent_parser])\n" +">>> foo_parser.add_argument('foo')\n" +">>> foo_parser.parse_args(['--parent', '2', 'XXX'])\n" +"Namespace(foo='XXX', parent=2)\n" +"\n" +">>> bar_parser = argparse.ArgumentParser(parents=[parent_parser])\n" +">>> bar_parser.add_argument('--bar')\n" +">>> bar_parser.parse_args(['--bar', 'YYY'])\n" +"Namespace(bar='YYY', parent=None)" +msgstr "" + +#: library/argparse.rst:281 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: library/argparse.rst:423 +#: library/argparse.rst:286 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: library/argparse.rst:431 +#: library/argparse.rst:294 msgid "formatter_class" msgstr "" -#: library/argparse.rst:433 +#: library/argparse.rst:296 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: library/argparse.rst:442 +#: library/argparse.rst:305 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " "more control over how textual descriptions are displayed. By default, :class:" @@ -525,58 +457,152 @@ msgid "" "command-line help messages::" msgstr "" -#: library/argparse.rst:467 +#: library/argparse.rst:310 +msgid "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... description='''this description\n" +"... was indented weird\n" +"... but that is okay''',\n" +"... epilog='''\n" +"... likewise for this epilog whose whitespace will\n" +"... be cleaned up and whose words will be wrapped\n" +"... across a couple lines''')\n" +">>> parser.print_help()\n" +"usage: PROG [-h]\n" +"\n" +"this description was indented weird but that is okay\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"likewise for this epilog whose whitespace will be cleaned up and whose " +"words\n" +"will be wrapped across a couple lines" +msgstr "" + +#: library/argparse.rst:330 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: library/argparse.rst:493 +#: library/argparse.rst:334 +msgid "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... formatter_class=argparse.RawDescriptionHelpFormatter,\n" +"... description=textwrap.dedent('''\\\n" +"... Please do not mess up this text!\n" +"... --------------------------------\n" +"... I have indented it\n" +"... exactly the way\n" +"... I want it\n" +"... '''))\n" +">>> parser.print_help()\n" +"usage: PROG [-h]\n" +"\n" +"Please do not mess up this text!\n" +"--------------------------------\n" +" I have indented it\n" +" exactly the way\n" +" I want it\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" +msgstr "" + +#: library/argparse.rst:356 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " -"text, including argument descriptions. However, multiple new lines are " +"text, including argument descriptions. However, multiple newlines are " "replaced with one. If you wish to preserve multiple blank lines, add spaces " "between the newlines." msgstr "" -#: library/argparse.rst:498 +#: library/argparse.rst:361 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: library/argparse.rst:516 +#: library/argparse.rst:364 +msgid "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n" +">>> parser.add_argument('--foo', type=int, default=42, help='FOO!')\n" +">>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!')\n" +">>> parser.print_help()\n" +"usage: PROG [-h] [--foo FOO] [bar ...]\n" +"\n" +"positional arguments:\n" +" bar BAR! (default: [1, 2, 3])\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo FOO FOO! (default: 42)" +msgstr "" + +#: library/argparse.rst:379 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: library/argparse.rst:537 +#: library/argparse.rst:383 +msgid "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... formatter_class=argparse.MetavarTypeHelpFormatter)\n" +">>> parser.add_argument('--foo', type=int)\n" +">>> parser.add_argument('bar', type=float)\n" +">>> parser.print_help()\n" +"usage: PROG [-h] [--foo int] float\n" +"\n" +"positional arguments:\n" +" float\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo int" +msgstr "" + +#: library/argparse.rst:400 msgid "prefix_chars" msgstr "" -#: library/argparse.rst:539 +#: library/argparse.rst:402 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " "for options like ``+f`` or ``/foo``, may specify them using the " -"``prefix_chars=`` argument to the ArgumentParser constructor::" +"``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" msgstr "" -#: library/argparse.rst:551 +#: library/argparse.rst:408 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" +">>> parser.add_argument('+f')\n" +">>> parser.add_argument('++bar')\n" +">>> parser.parse_args('+f X ++bar Y'.split())\n" +"Namespace(bar='Y', f='X')" +msgstr "" + +#: library/argparse.rst:414 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: library/argparse.rst:557 +#: library/argparse.rst:420 msgid "fromfile_prefix_chars" msgstr "" -#: library/argparse.rst:559 +#: library/argparse.rst:422 msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " @@ -586,9 +612,20 @@ msgid "" "by the arguments they contain. For example::" msgstr "" -#: library/argparse.rst:574 +#: library/argparse.rst:429 +msgid "" +">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" +"... fp.write('-f\\nbar')\n" +"...\n" +">>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@')\n" +">>> parser.add_argument('-f')\n" +">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" +"Namespace(f='bar')" +msgstr "" + +#: library/argparse.rst:437 msgid "" -"Arguments read from a file must by default be one per line (but see also :" +"Arguments read from a file must be one per line by default (but see also :" "meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " "were in the same place as the original file referencing argument on the " "command line. So in the example above, the expression ``['-f', 'foo', " @@ -596,32 +633,39 @@ msgid "" "f', 'bar']``." msgstr "" -#: library/argparse.rst:580 +#: library/argparse.rst:445 +msgid "" +"Empty lines are treated as empty strings (``''``), which are allowed as " +"values but not as arguments. Empty lines that are read as arguments will " +"result in an \"unrecognized arguments\" error." +msgstr "" + +#: library/argparse.rst:449 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" -#: library/argparse.rst:583 +#: library/argparse.rst:452 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: library/argparse.rst:586 +#: library/argparse.rst:455 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) ` and ``\"strict\"``) to :term:`filesystem encoding and " -"error handler`. Arguments file should be encoded in UTF-8 instead of ANSI " -"Codepage on Windows." +"getpreferredencoding>` and ``\"strict\"``) to the :term:`filesystem encoding " +"and error handler`. Arguments file should be encoded in UTF-8 instead of " +"ANSI Codepage on Windows." msgstr "" -#: library/argparse.rst:594 +#: library/argparse.rst:463 msgid "argument_default" msgstr "" -#: library/argparse.rst:596 +#: library/argparse.rst:465 msgid "" "Generally, argument defaults are specified either by passing a default to :" "meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." @@ -633,26 +677,47 @@ msgid "" "supply ``argument_default=SUPPRESS``::" msgstr "" -#: library/argparse.rst:616 +#: library/argparse.rst:474 +msgid "" +">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" +">>> parser.add_argument('--foo')\n" +">>> parser.add_argument('bar', nargs='?')\n" +">>> parser.parse_args(['--foo', '1', 'BAR'])\n" +"Namespace(bar='BAR', foo='1')\n" +">>> parser.parse_args([])\n" +"Namespace()" +msgstr "" + +#: library/argparse.rst:485 msgid "allow_abbrev" msgstr "" -#: library/argparse.rst:618 +#: library/argparse.rst:487 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " "abbreviations ` of long options." msgstr "" -#: library/argparse.rst:622 +#: library/argparse.rst:491 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: library/argparse.rst:635 +#: library/argparse.rst:493 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" +">>> parser.add_argument('--foobar', action='store_true')\n" +">>> parser.add_argument('--foonley', action='store_false')\n" +">>> parser.parse_args(['--foon'])\n" +"usage: PROG [-h] [--foobar] [--foonley]\n" +"PROG: error: unrecognized arguments: --foon" +msgstr "" + +#: library/argparse.rst:504 msgid "conflict_handler" msgstr "" -#: library/argparse.rst:637 +#: library/argparse.rst:506 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -660,7 +725,17 @@ msgid "" "that is already in use::" msgstr "" -#: library/argparse.rst:649 +#: library/argparse.rst:511 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-f', '--foo', help='old foo help')\n" +">>> parser.add_argument('--foo', help='new foo help')\n" +"Traceback (most recent call last):\n" +" ..\n" +"ArgumentError: argument --foo: conflicting option string(s): --foo" +msgstr "" + +#: library/argparse.rst:518 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -668,7 +743,22 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: library/argparse.rst:665 +#: library/argparse.rst:523 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG', " +"conflict_handler='resolve')\n" +">>> parser.add_argument('-f', '--foo', help='old foo help')\n" +">>> parser.add_argument('--foo', help='new foo help')\n" +">>> parser.print_help()\n" +"usage: PROG [-h] [-f FOO] [--foo FOO]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -f FOO old foo help\n" +" --foo FOO new foo help" +msgstr "" + +#: library/argparse.rst:534 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -676,31 +766,36 @@ msgid "" "option string was overridden." msgstr "" -#: library/argparse.rst:672 +#: library/argparse.rst:541 msgid "add_help" msgstr "" -#: library/argparse.rst:674 +#: library/argparse.rst:543 msgid "" -"By default, ArgumentParser objects add an option which simply displays the " -"parser's help message. For example, consider a file named ``myprogram.py`` " -"containing the following code::" +"By default, :class:`ArgumentParser` objects add an option which simply " +"displays the parser's help message. If ``-h`` or ``--help`` is supplied at " +"the command line, the :class:`!ArgumentParser` help will be printed." msgstr "" -#: library/argparse.rst:683 -msgid "" -"If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser " -"help will be printed:" -msgstr "" - -#: library/argparse.rst:695 +#: library/argparse.rst:547 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" "class:`ArgumentParser`::" msgstr "" -#: library/argparse.rst:707 +#: library/argparse.rst:551 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" +">>> parser.add_argument('--foo', help='foo help')\n" +">>> parser.print_help()\n" +"usage: PROG [--foo FOO]\n" +"\n" +"options:\n" +" --foo FOO foo help" +msgstr "" + +#: library/argparse.rst:559 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -708,94 +803,200 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: library/argparse.rst:722 +#: library/argparse.rst:565 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" +">>> parser.print_help()\n" +"usage: PROG [+h]\n" +"\n" +"options:\n" +" +h, ++help show this help message and exit" +msgstr "" + +#: library/argparse.rst:574 msgid "exit_on_error" msgstr "" -#: library/argparse.rst:724 +#: library/argparse.rst:576 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " -"exit with error info." +"print a *message* to :data:`sys.stderr` and exit with a status code of 2." msgstr "" -#: library/argparse.rst:727 +#: library/argparse.rst:580 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: library/argparse.rst:744 +#: library/argparse.rst:583 +msgid "" +">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" +">>> parser.add_argument('--integers', type=int)\n" +"_StoreAction(option_strings=['--integers'], dest='integers', nargs=None, " +"const=None, default=None, type=, choices=None, help=None, " +"metavar=None)\n" +">>> try:\n" +"... parser.parse_args('--integers a'.split())\n" +"... except argparse.ArgumentError:\n" +"... print('Catching an argumentError')\n" +"...\n" +"Catching an argumentError" +msgstr "" + +#: library/argparse.rst:596 +msgid "suggest_on_error" +msgstr "" + +#: library/argparse.rst:598 +msgid "" +"By default, when a user passes an invalid argument choice or subparser " +"name, :class:`ArgumentParser` will exit with error info and list the " +"permissible argument choices (if specified) or subparser names as part of " +"the error message." +msgstr "" + +#: library/argparse.rst:602 +msgid "" +"If the user would like to enable suggestions for mistyped argument choices " +"and subparser names, the feature can be enabled by setting " +"``suggest_on_error`` to ``True``. Note that this only applies for arguments " +"when the choices specified are strings::" +msgstr "" + +#: library/argparse.rst:607 +msgid "" +">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" +" suggest_on_error=True)\n" +">>> parser.add_argument('--action', choices=['sum', 'max'])\n" +">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +"... help='an integer for the accumulator')\n" +">>> parser.parse_args(['--action', 'sumn', 1, 2, 3])\n" +"tester.py: error: argument --action: invalid choice: 'sumn', maybe you meant " +"'sum'? (choose from 'sum', 'max')" +msgstr "" + +#: library/argparse.rst:615 +msgid "" +"If you're writing code that needs to be compatible with older Python " +"versions and want to opportunistically use ``suggest_on_error`` when it's " +"available, you can set it as an attribute after initializing the parser " +"instead of using the keyword argument::" +msgstr "" + +#: library/argparse.rst:620 +msgid "" +">>> parser = argparse.ArgumentParser(description='Process some integers.')\n" +">>> parser.suggest_on_error = True" +msgstr "" + +#: library/argparse.rst:627 +msgid "color" +msgstr "" + +#: library/argparse.rst:629 +msgid "" +"By default, the help message is printed in color using `ANSI escape " +"sequences `__. If you want " +"plain text help messages, you can disable this :ref:`in your local " +"environment `, or in the argument parser itself " +"by setting ``color`` to ``False``::" +msgstr "" + +#: library/argparse.rst:635 +msgid "" +">>> parser = argparse.ArgumentParser(description='Process some integers.',\n" +"... color=False)\n" +">>> parser.add_argument('--action', choices=['sum', 'max'])\n" +">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +"... help='an integer for the accumulator')\n" +">>> parser.parse_args(['--help'])" +msgstr "" + +#: library/argparse.rst:642 +msgid "" +"Note that when ``color=True``, colored output depends on both environment " +"variables and terminal capabilities. However, if ``color=False``, colored " +"output is always disabled, even if environment variables like " +"``FORCE_COLOR`` are set." +msgstr "" + +#: library/argparse.rst:651 msgid "The add_argument() method" msgstr "" -#: library/argparse.rst:750 +#: library/argparse.rst:657 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: library/argparse.rst:753 +#: library/argparse.rst:660 msgid "" -"`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " -"or ``-f, --foo``." +"`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " +"or ``'-f', '--foo'``." msgstr "" -#: library/argparse.rst:756 +#: library/argparse.rst:663 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: library/argparse.rst:759 +#: library/argparse.rst:666 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: library/argparse.rst:761 +#: library/argparse.rst:668 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: library/argparse.rst:763 +#: library/argparse.rst:670 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: library/argparse.rst:766 +#: library/argparse.rst:673 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: library/argparse.rst:768 +#: library/argparse.rst:675 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: library/argparse.rst:770 +#: library/argparse.rst:677 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: library/argparse.rst:773 +#: library/argparse.rst:680 msgid "help_ - A brief description of what the argument does." msgstr "" -#: library/argparse.rst:775 +#: library/argparse.rst:682 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: library/argparse.rst:777 +#: library/argparse.rst:684 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" -#: library/argparse.rst:786 +#: library/argparse.rst:687 +msgid "deprecated_ - Whether or not use of the argument is deprecated." +msgstr "" + +#: library/argparse.rst:695 msgid "name or flags" msgstr "" -#: library/argparse.rst:788 +#: library/argparse.rst:697 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -804,26 +1005,72 @@ msgid "" "or a simple argument name." msgstr "" -#: library/argparse.rst:794 +#: library/argparse.rst:703 msgid "For example, an optional argument could be created like::" msgstr "" -#: library/argparse.rst:798 +#: library/argparse.rst:705 +msgid ">>> parser.add_argument('-f', '--foo')" +msgstr "" + +#: library/argparse.rst:707 msgid "while a positional argument could be created like::" msgstr "" -#: library/argparse.rst:802 +#: library/argparse.rst:709 +msgid ">>> parser.add_argument('bar')" +msgstr "" + +#: library/argparse.rst:711 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: library/argparse.rst:821 +#: library/argparse.rst:715 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-f', '--foo')\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_args(['BAR'])\n" +"Namespace(bar='BAR', foo=None)\n" +">>> parser.parse_args(['BAR', '--foo', 'FOO'])\n" +"Namespace(bar='BAR', foo='FOO')\n" +">>> parser.parse_args(['--foo', 'FOO'])\n" +"usage: PROG [-h] [-f FOO] bar\n" +"PROG: error: the following arguments are required: bar" +msgstr "" + +#: library/argparse.rst:726 +msgid "" +"By default, :mod:`!argparse` automatically handles the internal naming and " +"display names of arguments, simplifying the process without requiring " +"additional configuration. As such, you do not need to specify the dest_ and " +"metavar_ parameters. The dest_ parameter defaults to the argument name with " +"underscores ``_`` replacing hyphens ``-`` . The metavar_ parameter defaults " +"to the upper-cased name. For example::" +msgstr "" + +#: library/argparse.rst:734 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--foo-bar')\n" +">>> parser.parse_args(['--foo-bar', 'FOO-BAR']\n" +"Namespace(foo_bar='FOO-BAR')\n" +">>> parser.print_help()\n" +"usage: [-h] [--foo-bar FOO-BAR]\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" --foo-bar FOO-BAR" +msgstr "" + +#: library/argparse.rst:749 msgid "action" msgstr "" -#: library/argparse.rst:823 +#: library/argparse.rst:751 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -833,13 +1080,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: library/argparse.rst:829 +#: library/argparse.rst:757 msgid "" "``'store'`` - This just stores the argument's value. This is the default " -"action. For example::" +"action." msgstr "" -#: library/argparse.rst:837 +#: library/argparse.rst:760 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -847,43 +1094,105 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: library/argparse.rst:847 +#: library/argparse.rst:765 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action='store_const', const=42)\n" +">>> parser.parse_args(['--foo'])\n" +"Namespace(foo=42)" +msgstr "" + +#: library/argparse.rst:770 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " -"``'store_const'`` used for storing the values ``True`` and ``False`` " -"respectively. In addition, they create default values of ``False`` and " -"``True`` respectively. For example::" +"``'store_const'`` that respectively store the values ``True`` and ``False`` " +"with default values of ``False`` and ``True``::" msgstr "" -#: library/argparse.rst:859 +#: library/argparse.rst:775 msgid "" -"``'append'`` - This stores a list, and appends each argument value to the " -"list. It is useful to allow an option to be specified multiple times. If the " -"default value is non-empty, the default elements will be present in the " -"parsed value for the option, with any values from the command line appended " -"after those default values. Example usage::" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action='store_true')\n" +">>> parser.add_argument('--bar', action='store_false')\n" +">>> parser.add_argument('--baz', action='store_false')\n" +">>> parser.parse_args('--foo --bar'.split())\n" +"Namespace(foo=True, bar=False, baz=True)" msgstr "" -#: library/argparse.rst:870 +#: library/argparse.rst:782 msgid "" -"``'append_const'`` - This stores a list, and appends the value specified by " -"the const_ keyword argument to the list; note that the const_ keyword " -"argument defaults to ``None``. The ``'append_const'`` action is typically " -"useful when multiple arguments need to store constants to the same list. For " -"example::" +"``'append'`` - This appends each argument value to a list. It is useful for " +"allowing an option to be specified multiple times. If the default value is a " +"non-empty list, the parsed value will start with the default list's elements " +"and any values from the command line will be appended after those default " +"values. Example usage::" msgstr "" -#: library/argparse.rst:882 +#: library/argparse.rst:788 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action='append', default=['0'])\n" +">>> parser.parse_args('--foo 1 --foo 2'.split())\n" +"Namespace(foo=['0', '1', '2'])" +msgstr "" + +#: library/argparse.rst:793 +msgid "" +"``'append_const'`` - This appends the value specified by the const_ keyword " +"argument to a list; note that the const_ keyword argument defaults to " +"``None``. The ``'append_const'`` action is typically useful when multiple " +"arguments need to store constants to the same list. For example::" +msgstr "" + +#: library/argparse.rst:799 msgid "" -"``'count'`` - This counts the number of times a keyword argument occurs. For " +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--str', dest='types', action='append_const', " +"const=str)\n" +">>> parser.add_argument('--int', dest='types', action='append_const', " +"const=int)\n" +">>> parser.parse_args('--str --int'.split())\n" +"Namespace(types=[, ])" +msgstr "" + +#: library/argparse.rst:805 +msgid "" +"``'extend'`` - This appends each item from a multi-value argument to a list. " +"The ``'extend'`` action is typically used with the nargs_ keyword argument " +"value ``'+'`` or ``'*'``. Note that when nargs_ is ``None`` (the default) or " +"``'?'``, each character of the argument string will be appended to the list. " +"Example usage::" +msgstr "" + +#: library/argparse.rst:813 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " +"type=str)\n" +">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " +"\"f4\"])\n" +"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" +msgstr "" + +#: library/argparse.rst:820 +msgid "" +"``'count'`` - This counts the number of times an argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: library/argparse.rst:890 +#: library/argparse.rst:823 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" +">>> parser.parse_args(['-vvv'])\n" +"Namespace(verbose=3)" +msgstr "" + +#: library/argparse.rst:828 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: library/argparse.rst:892 +#: library/argparse.rst:830 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -891,67 +1200,105 @@ msgid "" "output is created." msgstr "" -#: library/argparse.rst:897 +#: library/argparse.rst:835 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: library/argparse.rst:907 +#: library/argparse.rst:839 msgid "" -"``'extend'`` - This stores a list, and extends each argument value to the " -"list. Example usage::" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--version', action='version', version='%(prog)s " +"2.0')\n" +">>> parser.parse_args(['--version'])\n" +"PROG 2.0" msgstr "" -#: library/argparse.rst:918 +#: library/argparse.rst:845 msgid "" -"You may also specify an arbitrary action by passing an Action subclass or " -"other object that implements the same interface. The " -"``BooleanOptionalAction`` is available in ``argparse`` and adds support for " -"boolean actions such as ``--foo`` and ``--no-foo``::" +"You may also specify an arbitrary action by passing an :class:`Action` " +"subclass (e.g. :class:`BooleanOptionalAction`) or other object that " +"implements the same interface. Only actions that consume command-line " +"arguments (e.g. ``'store'``, ``'append'``, ``'extend'``, or custom actions " +"with non-zero ``nargs``) can be used with positional arguments." msgstr "" -#: library/argparse.rst:931 +#: library/argparse.rst:851 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " -"overriding the ``__call__`` method and optionally the ``__init__`` and " -"``format_usage`` methods." +"overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " +"and :meth:`!format_usage` methods. You can also register custom actions " +"using the :meth:`~ArgumentParser.register` method and reference them by " +"their registered name." msgstr "" -#: library/argparse.rst:935 +#: library/argparse.rst:856 msgid "An example of a custom action::" msgstr "" -#: library/argparse.rst:955 +#: library/argparse.rst:858 +msgid "" +">>> class FooAction(argparse.Action):\n" +"... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" +"... if nargs is not None:\n" +"... raise ValueError(\"nargs not allowed\")\n" +"... super().__init__(option_strings, dest, **kwargs)\n" +"... def __call__(self, parser, namespace, values, option_string=None):\n" +"... print('%r %r %r' % (namespace, values, option_string))\n" +"... setattr(namespace, self.dest, values)\n" +"...\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action=FooAction)\n" +">>> parser.add_argument('bar', action=FooAction)\n" +">>> args = parser.parse_args('1 --foo 2'.split())\n" +"Namespace(bar=None, foo=None) '1' None\n" +"Namespace(bar='1', foo=None) '2' '--foo'\n" +">>> args\n" +"Namespace(bar='1', foo='2')" +msgstr "" + +#: library/argparse.rst:876 msgid "For more details, see :class:`Action`." msgstr "" -#: library/argparse.rst:961 +#: library/argparse.rst:882 msgid "nargs" msgstr "" -#: library/argparse.rst:963 +#: library/argparse.rst:884 msgid "" -"ArgumentParser objects usually associate a single command-line argument with " -"a single action to be taken. The ``nargs`` keyword argument associates a " -"different number of command-line arguments with a single action. See also :" -"ref:`specifying-ambiguous-arguments`. The supported values are:" +":class:`ArgumentParser` objects usually associate a single command-line " +"argument with a single action to be taken. The ``nargs`` keyword argument " +"associates a different number of command-line arguments with a single " +"action. See also :ref:`specifying-ambiguous-arguments`. The supported values " +"are:" msgstr "" -#: library/argparse.rst:968 +#: library/argparse.rst:889 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: library/argparse.rst:977 +#: library/argparse.rst:892 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', nargs=2)\n" +">>> parser.add_argument('bar', nargs=1)\n" +">>> parser.parse_args('c --foo a b'.split())\n" +"Namespace(bar=['c'], foo=['a', 'b'])" +msgstr "" + +#: library/argparse.rst:898 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: library/argparse.rst:982 +#: library/argparse.rst:903 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -961,13 +1308,39 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: library/argparse.rst:999 +#: library/argparse.rst:910 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" +">>> parser.add_argument('bar', nargs='?', default='d')\n" +">>> parser.parse_args(['XX', '--foo', 'YY'])\n" +"Namespace(bar='XX', foo='YY')\n" +">>> parser.parse_args(['XX', '--foo'])\n" +"Namespace(bar='XX', foo='c')\n" +">>> parser.parse_args([])\n" +"Namespace(bar='d', foo='d')" +msgstr "" + +#: library/argparse.rst:920 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: library/argparse.rst:1016 +#: library/argparse.rst:923 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('infile', nargs='?')\n" +">>> parser.add_argument('outfile', nargs='?')\n" +">>> parser.parse_args(['input.txt', 'output.txt'])\n" +"Namespace(infile='input.txt', outfile='output.txt')\n" +">>> parser.parse_args(['input.txt'])\n" +"Namespace(infile='input.txt', outfile=None)\n" +">>> parser.parse_args([])\n" +"Namespace(infile=None, outfile=None)" +msgstr "" + +#: library/argparse.rst:935 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -975,26 +1348,48 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: library/argparse.rst:1030 +#: library/argparse.rst:940 msgid "" -"``'+'``. Just like ``'*'``, all command-line args present are gathered into " -"a list. Additionally, an error message will be generated if there wasn't at " -"least one command-line argument present. For example::" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', nargs='*')\n" +">>> parser.add_argument('--bar', nargs='*')\n" +">>> parser.add_argument('baz', nargs='*')\n" +">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" +"Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" msgstr "" -#: library/argparse.rst:1042 +#: library/argparse.rst:949 +msgid "" +"``'+'``. Just like ``'*'``, all command-line arguments present are gathered " +"into a list. Additionally, an error message will be generated if there " +"wasn't at least one command-line argument present. For example::" +msgstr "" + +#: library/argparse.rst:953 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('foo', nargs='+')\n" +">>> parser.parse_args(['a', 'b'])\n" +"Namespace(foo=['a', 'b'])\n" +">>> parser.parse_args([])\n" +"usage: PROG [-h] foo [foo ...]\n" +"PROG: error: the following arguments are required: foo" +msgstr "" + +#: library/argparse.rst:961 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " "command-line argument will be consumed and a single item (not a list) will " -"be produced." +"be produced. Actions that do not consume command-line arguments (e.g. " +"``'store_const'``) set ``nargs=0``." msgstr "" -#: library/argparse.rst:1050 +#: library/argparse.rst:971 msgid "const" msgstr "" -#: library/argparse.rst:1052 +#: library/argparse.rst:973 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1002,7 +1397,7 @@ msgid "" "common uses of it are:" msgstr "" -#: library/argparse.rst:1056 +#: library/argparse.rst:977 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " @@ -1012,27 +1407,27 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: library/argparse.rst:1064 +#: library/argparse.rst:985 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " "argument that can be followed by zero or one command-line arguments. When " "parsing the command line, if the option string is encountered with no " -"command-line argument following it, the value of ``const`` will be assumed " -"to be ``None`` instead. See the nargs_ description for examples." +"command-line argument following it, the value from ``const`` will be used. " +"See the nargs_ description for examples." msgstr "" -#: library/argparse.rst:1071 +#: library/argparse.rst:992 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." msgstr "" -#: library/argparse.rst:1078 +#: library/argparse.rst:999 msgid "default" msgstr "" -#: library/argparse.rst:1080 +#: library/argparse.rst:1001 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1042,13 +1437,31 @@ msgid "" "command line::" msgstr "" -#: library/argparse.rst:1094 +#: library/argparse.rst:1008 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default=42)\n" +">>> parser.parse_args(['--foo', '2'])\n" +"Namespace(foo='2')\n" +">>> parser.parse_args([])\n" +"Namespace(foo=42)" +msgstr "" + +#: library/argparse.rst:1015 msgid "" "If the target namespace already has an attribute set, the action *default* " -"will not over write it::" +"will not overwrite it::" +msgstr "" + +#: library/argparse.rst:1018 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default=42)\n" +">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" +"Namespace(foo=101)" msgstr "" -#: library/argparse.rst:1102 +#: library/argparse.rst:1023 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -1056,23 +1469,59 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: library/argparse.rst:1113 +#: library/argparse.rst:1028 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--length', default='10', type=int)\n" +">>> parser.add_argument('--width', default=10.5, type=int)\n" +">>> parser.parse_args()\n" +"Namespace(length=10, width=10.5)" +msgstr "" + +#: library/argparse.rst:1034 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: library/argparse.rst:1124 +#: library/argparse.rst:1037 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('foo', nargs='?', default=42)\n" +">>> parser.parse_args(['a'])\n" +"Namespace(foo='a')\n" +">>> parser.parse_args([])\n" +"Namespace(foo=42)" +msgstr "" + +#: library/argparse.rst:1044 +msgid "" +"For required_ arguments, the ``default`` value is ignored. For example, this " +"applies to positional arguments with nargs_ values other than ``?`` or " +"``*``, or optional arguments marked as ``required=True``." +msgstr "" + +#: library/argparse.rst:1048 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: library/argparse.rst:1138 +#: library/argparse.rst:1051 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" +">>> parser.parse_args([])\n" +"Namespace()\n" +">>> parser.parse_args(['--foo', '1'])\n" +"Namespace(foo='1')" +msgstr "" + +#: library/argparse.rst:1062 msgid "type" msgstr "" -#: library/argparse.rst:1140 +#: library/argparse.rst:1064 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -1081,36 +1530,61 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: library/argparse.rst:1146 +#: library/argparse.rst:1070 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: library/argparse.rst:1149 +#: library/argparse.rst:1073 msgid "" -"The argument to ``type`` can be any callable that accepts a single string. " -"If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" +"The argument to ``type`` can be a callable that accepts a single string or " +"the name of a registered type (see :meth:`~ArgumentParser.register`) If the " +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" "`ValueError`, the exception is caught and a nicely formatted error message " -"is displayed. No other exception types are handled." +"is displayed. Other exception types are not handled." msgstr "" -#: library/argparse.rst:1154 +#: library/argparse.rst:1079 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: library/argparse.rst:1170 +#: library/argparse.rst:1081 +msgid "" +"import argparse\n" +"import pathlib\n" +"\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument('count', type=int)\n" +"parser.add_argument('distance', type=float)\n" +"parser.add_argument('street', type=ascii)\n" +"parser.add_argument('code_point', type=ord)\n" +"parser.add_argument('datapath', type=pathlib.Path)" +msgstr "" + +#: library/argparse.rst:1093 msgid "User defined functions can be used as well:" msgstr "" -#: library/argparse.rst:1182 +#: library/argparse.rst:1095 +msgid "" +">>> def hyphenated(string):\n" +"... return '-'.join([word[:4] for word in string.casefold().split()])\n" +"...\n" +">>> parser = argparse.ArgumentParser()\n" +">>> _ = parser.add_argument('short_title', type=hyphenated)\n" +">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" +"Namespace(short_title='\"the-tale-of-two-citi')" +msgstr "" + +#: library/argparse.rst:1105 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: library/argparse.rst:1186 +#: library/argparse.rst:1109 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -1118,7 +1592,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: library/argparse.rst:1191 +#: library/argparse.rst:1114 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -1126,26 +1600,27 @@ msgid "" "exception would not be handled at all." msgstr "" -#: library/argparse.rst:1196 +#: library/argparse.rst:1119 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " -"``type`` keyword. If one argument uses *FileType* and then a subsequent " -"argument fails, an error is reported but the file is not automatically " -"closed. In this case, it would be better to wait until after the parser has " -"run and then use the :keyword:`with`-statement to manage the files." +"``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " +"a subsequent argument fails, an error is reported but the file is not " +"automatically closed. In this case, it would be better to wait until after " +"the parser has run and then use the :keyword:`with`-statement to manage the " +"files." msgstr "" -#: library/argparse.rst:1202 +#: library/argparse.rst:1126 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: library/argparse.rst:1209 +#: library/argparse.rst:1133 msgid "choices" msgstr "" -#: library/argparse.rst:1211 +#: library/argparse.rst:1135 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -1154,26 +1629,45 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: library/argparse.rst:1226 +#: library/argparse.rst:1141 msgid "" -"Note that inclusion in the *choices* sequence is checked after any type_ " -"conversions have been performed, so the type of the objects in the *choices* " -"sequence should match the type_ specified::" +">>> parser = argparse.ArgumentParser(prog='game.py')\n" +">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" +">>> parser.parse_args(['rock'])\n" +"Namespace(move='rock')\n" +">>> parser.parse_args(['fire'])\n" +"usage: game.py [-h] {rock,paper,scissors}\n" +"game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" +"'paper', 'scissors')" msgstr "" -#: library/argparse.rst:1238 +#: library/argparse.rst:1150 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: library/argparse.rst:1241 +#: library/argparse.rst:1153 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: library/argparse.rst:1244 +#: library/argparse.rst:1156 +msgid "" +"Note that *choices* are checked after any type_ conversions have been " +"performed, so objects in *choices* should match the type_ specified. This " +"can make *choices* appear unfamiliar in usage, help, or error messages." +msgstr "" + +#: library/argparse.rst:1161 +msgid "" +"To keep *choices* user-friendly, consider a custom type wrapper that " +"converts and formats values, or omit type_ and handle conversion in your " +"application code." +msgstr "" + +#: library/argparse.rst:1165 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -1181,44 +1675,55 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: library/argparse.rst:1253 +#: library/argparse.rst:1174 msgid "required" msgstr "" -#: library/argparse.rst:1255 +#: library/argparse.rst:1176 msgid "" -"In general, the :mod:`argparse` module assumes that flags like ``-f`` and " +"In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " "command line. To make an option *required*, ``True`` can be specified for " "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: library/argparse.rst:1268 +#: library/argparse.rst:1181 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', required=True)\n" +">>> parser.parse_args(['--foo', 'BAR'])\n" +"Namespace(foo='BAR')\n" +">>> parser.parse_args([])\n" +"usage: [-h] --foo FOO\n" +": error: the following arguments are required: --foo" +msgstr "" + +#: library/argparse.rst:1189 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: library/argparse.rst:1274 +#: library/argparse.rst:1195 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: library/argparse.rst:1281 +#: library/argparse.rst:1202 msgid "help" msgstr "" -#: library/argparse.rst:1283 +#: library/argparse.rst:1204 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " "at the command line), these ``help`` descriptions will be displayed with " -"each argument::" +"each argument." msgstr "" -#: library/argparse.rst:1303 +#: library/argparse.rst:1209 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -1227,57 +1732,133 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: library/argparse.rst:1320 +#: library/argparse.rst:1214 +msgid "" +">>> parser = argparse.ArgumentParser(prog='frobble')\n" +">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" +"... help='the bar to %(prog)s (default: %(default)s)')\n" +">>> parser.print_help()\n" +"usage: frobble [-h] [bar]\n" +"\n" +"positional arguments:\n" +" bar the bar to frobble (default: 42)\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" +msgstr "" + +#: library/argparse.rst:1226 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: library/argparse.rst:1323 +#: library/argparse.rst:1229 msgid "" -":mod:`argparse` supports silencing the help entry for certain options, by " +":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: library/argparse.rst:1338 +#: library/argparse.rst:1232 +msgid "" +">>> parser = argparse.ArgumentParser(prog='frobble')\n" +">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" +">>> parser.print_help()\n" +"usage: frobble [-h]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" +msgstr "" + +#: library/argparse.rst:1244 msgid "metavar" msgstr "" -#: library/argparse.rst:1340 +#: library/argparse.rst:1246 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " -"refer to each expected argument. By default, ArgumentParser objects use the " -"dest_ value as the \"name\" of each object. By default, for positional " -"argument actions, the dest_ value is used directly, and for optional " -"argument actions, the dest_ value is uppercased. So, a single positional " -"argument with ``dest='bar'`` will be referred to as ``bar``. A single " -"optional argument ``--foo`` that should be followed by a single command-line " -"argument will be referred to as ``FOO``. An example::" +"refer to each expected argument. By default, :class:`!ArgumentParser` " +"objects use the dest_ value as the \"name\" of each object. By default, for " +"positional argument actions, the dest_ value is used directly, and for " +"optional argument actions, the dest_ value is uppercased. So, a single " +"positional argument with ``dest='bar'`` will be referred to as ``bar``. A " +"single optional argument ``--foo`` that should be followed by a single " +"command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: library/argparse.rst:1364 +#: library/argparse.rst:1255 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_args('X --foo Y'.split())\n" +"Namespace(bar='X', foo='Y')\n" +">>> parser.print_help()\n" +"usage: [-h] [--foo FOO] bar\n" +"\n" +"positional arguments:\n" +" bar\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo FOO" +msgstr "" + +#: library/argparse.rst:1270 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: library/argparse.rst:1381 +#: library/argparse.rst:1272 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', metavar='YYY')\n" +">>> parser.add_argument('bar', metavar='XXX')\n" +">>> parser.parse_args('X --foo Y'.split())\n" +"Namespace(bar='X', foo='Y')\n" +">>> parser.print_help()\n" +"usage: [-h] [--foo YYY] XXX\n" +"\n" +"positional arguments:\n" +" XXX\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo YYY" +msgstr "" + +#: library/argparse.rst:1287 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: library/argparse.rst:1385 +#: library/argparse.rst:1291 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: library/argparse.rst:1404 +#: library/argparse.rst:1295 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-x', nargs=2)\n" +">>> parser.add_argument('--foo', nargs=2, metavar=('bar', 'baz'))\n" +">>> parser.print_help()\n" +"usage: PROG [-h] [-x X X] [--foo bar baz]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -x X X\n" +" --foo bar baz" +msgstr "" + +#: library/argparse.rst:1310 msgid "dest" msgstr "" -#: library/argparse.rst:1406 +#: library/argparse.rst:1312 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -1287,7 +1868,15 @@ msgid "" "add_argument`::" msgstr "" -#: library/argparse.rst:1418 +#: library/argparse.rst:1319 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_args(['XXX'])\n" +"Namespace(bar='XXX')" +msgstr "" + +#: library/argparse.rst:1324 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -1299,147 +1888,247 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: library/argparse.rst:1435 +#: library/argparse.rst:1333 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" +">>> parser.add_argument('-x', '-y')\n" +">>> parser.parse_args('-f 1 -x 2'.split())\n" +"Namespace(foo_bar='1', x='2')\n" +">>> parser.parse_args('--foo 1 -y 2'.split())\n" +"Namespace(foo_bar='1', x='2')" +msgstr "" + +#: library/argparse.rst:1341 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: library/argparse.rst:1443 +#: library/argparse.rst:1343 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', dest='bar')\n" +">>> parser.parse_args('--foo XXX'.split())\n" +"Namespace(bar='XXX')" +msgstr "" + +#: library/argparse.rst:1352 +msgid "deprecated" +msgstr "" + +#: library/argparse.rst:1354 +msgid "" +"During a project's lifetime, some arguments may need to be removed from the " +"command line. Before removing them, you should inform your users that the " +"arguments are deprecated and will be removed. The ``deprecated`` keyword " +"argument of :meth:`~ArgumentParser.add_argument`, which defaults to " +"``False``, specifies if the argument is deprecated and will be removed in " +"the future. For arguments, if ``deprecated`` is ``True``, then a warning " +"will be printed to :data:`sys.stderr` when the argument is used::" +msgstr "" + +#: library/argparse.rst:1364 +msgid "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser(prog='snake.py')\n" +">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" +">>> parser.parse_args([])\n" +"Namespace(legs=0)\n" +">>> parser.parse_args(['--legs', '4'])\n" +"snake.py: warning: option '--legs' is deprecated\n" +"Namespace(legs=4)" +msgstr "" + +#: library/argparse.rst:1377 msgid "Action classes" msgstr "" -#: library/argparse.rst:1445 +#: library/argparse.rst:1379 msgid "" -"Action classes implement the Action API, a callable which returns a callable " -"which processes arguments from the command-line. Any object which follows " -"this API may be passed as the ``action`` parameter to :meth:`~ArgumentParser." -"add_argument`." +":class:`!Action` classes implement the Action API, a callable which returns " +"a callable which processes arguments from the command-line. Any object which " +"follows this API may be passed as the ``action`` parameter to :meth:" +"`~ArgumentParser.add_argument`." msgstr "" -#: library/argparse.rst:1454 +#: library/argparse.rst:1388 msgid "" -"Action objects are used by an ArgumentParser to represent the information " -"needed to parse a single argument from one or more strings from the command " -"line. The Action class must accept the two positional arguments plus any " -"keyword arguments passed to :meth:`ArgumentParser.add_argument` except for " -"the ``action`` itself." +":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " +"the information needed to parse a single argument from one or more strings " +"from the command line. The :class:`!Action` class must accept the two " +"positional arguments plus any keyword arguments passed to :meth:" +"`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: library/argparse.rst:1460 +#: library/argparse.rst:1394 msgid "" -"Instances of Action (or return value of any callable to the ``action`` " -"parameter) should have attributes \"dest\", \"option_strings\", \"default\", " -"\"type\", \"required\", \"help\", etc. defined. The easiest way to ensure " -"these attributes are defined is to call ``Action.__init__``." +"Instances of :class:`!Action` (or return value of any callable to the " +"``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" +"option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, :attr:`!" +"help`, etc. defined. The easiest way to ensure these attributes are defined " +"is to call :meth:`!Action.__init__`." msgstr "" -#: library/argparse.rst:1465 +#: library/argparse.rst:1402 msgid "" -"Action instances should be callable, so subclasses must override the " -"``__call__`` method, which should accept four parameters:" +":class:`!Action` instances should be callable, so subclasses must override " +"the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: library/argparse.rst:1468 -msgid "``parser`` - The ArgumentParser object which contains this action." +#: library/argparse.rst:1405 +msgid "" +"*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: library/argparse.rst:1470 +#: library/argparse.rst:1407 msgid "" -"``namespace`` - The :class:`Namespace` object that will be returned by :meth:" +"*namespace* - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: library/argparse.rst:1474 +#: library/argparse.rst:1411 msgid "" -"``values`` - The associated command-line arguments, with any type " -"conversions applied. Type conversions are specified with the type_ keyword " -"argument to :meth:`~ArgumentParser.add_argument`." +"*values* - The associated command-line arguments, with any type conversions " +"applied. Type conversions are specified with the type_ keyword argument to :" +"meth:`~ArgumentParser.add_argument`." msgstr "" -#: library/argparse.rst:1478 +#: library/argparse.rst:1415 msgid "" -"``option_string`` - The option string that was used to invoke this action. " -"The ``option_string`` argument is optional, and will be absent if the action " -"is associated with a positional argument." +"*option_string* - The option string that was used to invoke this action. The " +"``option_string`` argument is optional, and will be absent if the action is " +"associated with a positional argument." msgstr "" -#: library/argparse.rst:1482 +#: library/argparse.rst:1419 msgid "" -"The ``__call__`` method may perform arbitrary actions, but will typically " -"set attributes on the ``namespace`` based on ``dest`` and ``values``." +"The :meth:`!__call__` method may perform arbitrary actions, but will " +"typically set attributes on the ``namespace`` based on ``dest`` and " +"``values``." msgstr "" -#: library/argparse.rst:1485 +#: library/argparse.rst:1424 +msgid "" +":class:`!Action` subclasses can define a :meth:`!format_usage` method that " +"takes no argument and return a string which will be used when printing the " +"usage of the program. If such method is not provided, a sensible default " +"will be used." +msgstr "" + +#: library/argparse.rst:1430 +msgid "" +"A subclass of :class:`Action` for handling boolean flags with positive and " +"negative options. Adding a single argument such as ``--foo`` automatically " +"creates both ``--foo`` and ``--no-foo`` options, storing ``True`` and " +"``False`` respectively::" +msgstr "" + +#: library/argparse.rst:1435 msgid "" -"Action subclasses can define a ``format_usage`` method that takes no " -"argument and return a string which will be used when printing the usage of " -"the program. If such method is not provided, a sensible default will be used." +">>> import argparse\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action=argparse.BooleanOptionalAction)\n" +">>> parser.parse_args(['--no-foo'])\n" +"Namespace(foo=False)" msgstr "" -#: library/argparse.rst:1490 +#: library/argparse.rst:1445 msgid "The parse_args() method" msgstr "" -#: library/argparse.rst:1494 +#: library/argparse.rst:1449 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: library/argparse.rst:1497 +#: library/argparse.rst:1452 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " -"created and how they are assigned. See the documentation for :meth:" -"`add_argument` for details." +"created and how they are assigned. See the documentation for :meth:`!" +"add_argument` for details." msgstr "" -#: library/argparse.rst:1501 +#: library/argparse.rst:1456 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: library/argparse.rst:1504 +#: library/argparse.rst:1459 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: library/argparse.rst:1509 +#: library/argparse.rst:1464 msgid "Option value syntax" msgstr "" -#: library/argparse.rst:1511 +#: library/argparse.rst:1466 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: library/argparse.rst:1523 +#: library/argparse.rst:1470 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-x')\n" +">>> parser.add_argument('--foo')\n" +">>> parser.parse_args(['-x', 'X'])\n" +"Namespace(foo=None, x='X')\n" +">>> parser.parse_args(['--foo', 'FOO'])\n" +"Namespace(foo='FOO', x=None)" +msgstr "" + +#: library/argparse.rst:1478 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: library/argparse.rst:1530 +#: library/argparse.rst:1482 +msgid "" +">>> parser.parse_args(['--foo=FOO'])\n" +"Namespace(foo='FOO', x=None)" +msgstr "" + +#: library/argparse.rst:1485 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: library/argparse.rst:1536 +#: library/argparse.rst:1488 +msgid "" +">>> parser.parse_args(['-xX'])\n" +"Namespace(foo=None, x='X')" +msgstr "" + +#: library/argparse.rst:1491 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: library/argparse.rst:1548 +#: library/argparse.rst:1494 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-x', action='store_true')\n" +">>> parser.add_argument('-y', action='store_true')\n" +">>> parser.add_argument('-z')\n" +">>> parser.parse_args(['-xyzZ'])\n" +"Namespace(x=True, y=True, z='Z')" +msgstr "" + +#: library/argparse.rst:1503 msgid "Invalid arguments" msgstr "" -#: library/argparse.rst:1550 +#: library/argparse.rst:1505 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -1447,11 +2136,33 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: library/argparse.rst:1576 +#: library/argparse.rst:1510 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--foo', type=int)\n" +">>> parser.add_argument('bar', nargs='?')\n" +"\n" +">>> # invalid type\n" +">>> parser.parse_args(['--foo', 'spam'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: argument --foo: invalid int value: 'spam'\n" +"\n" +">>> # invalid option\n" +">>> parser.parse_args(['--bar'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: no such option: --bar\n" +"\n" +">>> # wrong number of arguments\n" +">>> parser.parse_args(['spam', 'badger'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: extra arguments found: badger" +msgstr "" + +#: library/argparse.rst:1531 msgid "Arguments containing ``-``" msgstr "" -#: library/argparse.rst:1578 +#: library/argparse.rst:1533 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -1463,7 +2174,40 @@ msgid "" "negative numbers::" msgstr "" -#: library/argparse.rst:1616 +#: library/argparse.rst:1541 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-x')\n" +">>> parser.add_argument('foo', nargs='?')\n" +"\n" +">>> # no negative number options, so -1 is a positional argument\n" +">>> parser.parse_args(['-x', '-1'])\n" +"Namespace(foo=None, x='-1')\n" +"\n" +">>> # no negative number options, so -1 and -5 are positional arguments\n" +">>> parser.parse_args(['-x', '-1', '-5'])\n" +"Namespace(foo='-5', x='-1')\n" +"\n" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-1', dest='one')\n" +">>> parser.add_argument('foo', nargs='?')\n" +"\n" +">>> # negative number options present, so -1 is an option\n" +">>> parser.parse_args(['-1', 'X'])\n" +"Namespace(foo=None, one='X')\n" +"\n" +">>> # negative number options present, so -2 is an option\n" +">>> parser.parse_args(['-2'])\n" +"usage: PROG [-h] [-1 ONE] [foo]\n" +"PROG: error: no such option: -2\n" +"\n" +">>> # negative number options present, so both -1s are options\n" +">>> parser.parse_args(['-1', '-1'])\n" +"usage: PROG [-h] [-1 ONE] [foo]\n" +"PROG: error: argument -1: expected one argument" +msgstr "" + +#: library/argparse.rst:1571 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -1471,152 +2215,231 @@ msgid "" "positional argument::" msgstr "" -#: library/argparse.rst:1624 +#: library/argparse.rst:1576 +msgid "" +">>> parser.parse_args(['--', '-f'])\n" +"Namespace(foo='-f', one=None)" +msgstr "" + +#: library/argparse.rst:1579 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: library/argparse.rst:1630 +#: library/argparse.rst:1585 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: library/argparse.rst:1632 +#: library/argparse.rst:1587 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: library/argparse.rst:1647 +#: library/argparse.rst:1591 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-bacon')\n" +">>> parser.add_argument('-badger')\n" +">>> parser.parse_args('-bac MMM'.split())\n" +"Namespace(bacon='MMM', badger=None)\n" +">>> parser.parse_args('-bad WOOD'.split())\n" +"Namespace(bacon=None, badger='WOOD')\n" +">>> parser.parse_args('-ba BA'.split())\n" +"usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" +"PROG: error: ambiguous option: -ba could match -badger, -bacon" +msgstr "" + +#: library/argparse.rst:1602 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: library/argparse.rst:1653 +#: library/argparse.rst:1608 msgid "Beyond ``sys.argv``" msgstr "" -#: library/argparse.rst:1655 +#: library/argparse.rst:1610 msgid "" -"Sometimes it may be useful to have an ArgumentParser parse arguments other " -"than those of :data:`sys.argv`. This can be accomplished by passing a list " -"of strings to :meth:`~ArgumentParser.parse_args`. This is useful for " -"testing at the interactive prompt::" +"Sometimes it may be useful to have an :class:`ArgumentParser` parse " +"arguments other than those of :data:`sys.argv`. This can be accomplished by " +"passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is " +"useful for testing at the interactive prompt::" msgstr "" -#: library/argparse.rst:1675 +#: library/argparse.rst:1615 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument(\n" +"... 'integers', metavar='int', type=int, choices=range(10),\n" +"... nargs='+', help='an integer in the range 0..9')\n" +">>> parser.add_argument(\n" +"... '--sum', dest='accumulate', action='store_const', const=sum,\n" +"... default=max, help='sum the integers (default: find the max)')\n" +">>> parser.parse_args(['1', '2', '3', '4'])\n" +"Namespace(accumulate=, integers=[1, 2, 3, 4])\n" +">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" +"Namespace(accumulate=, integers=[1, 2, 3, 4])" +msgstr "" + +#: library/argparse.rst:1630 msgid "The Namespace object" msgstr "" -#: library/argparse.rst:1679 +#: library/argparse.rst:1634 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: library/argparse.rst:1682 +#: library/argparse.rst:1637 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: library/argparse.rst:1692 +#: library/argparse.rst:1641 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> args = parser.parse_args(['--foo', 'BAR'])\n" +">>> vars(args)\n" +"{'foo': 'BAR'}" +msgstr "" + +#: library/argparse.rst:1647 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: library/argparse.rst:1708 +#: library/argparse.rst:1651 +msgid "" +">>> class C:\n" +"... pass\n" +"...\n" +">>> c = C()\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> parser.parse_args(args=['--foo', 'BAR'], namespace=c)\n" +">>> c.foo\n" +"'BAR'" +msgstr "" + +#: library/argparse.rst:1663 msgid "Other utilities" msgstr "" -#: library/argparse.rst:1711 +#: library/argparse.rst:1666 msgid "Sub-commands" msgstr "" -#: library/argparse.rst:1718 +#: library/argparse.rst:1673 msgid "" -"Many programs split up their functionality into a number of sub-commands, " -"for example, the ``svn`` program can invoke sub-commands like ``svn " -"checkout``, ``svn update``, and ``svn commit``. Splitting up functionality " -"this way can be a particularly good idea when a program performs several " -"different functions which require different kinds of command-line " -"arguments. :class:`ArgumentParser` supports the creation of such sub-" -"commands with the :meth:`add_subparsers` method. The :meth:`add_subparsers` " -"method is normally called with no arguments and returns a special action " -"object. This object has a single method, :meth:`~_SubParsersAction." -"add_parser`, which takes a command name and any :class:`ArgumentParser` " -"constructor arguments, and returns an :class:`ArgumentParser` object that " -"can be modified as usual." +"Many programs split up their functionality into a number of subcommands, for " +"example, the ``svn`` program can invoke subcommands like ``svn checkout``, " +"``svn update``, and ``svn commit``. Splitting up functionality this way can " +"be a particularly good idea when a program performs several different " +"functions which require different kinds of command-line arguments. :class:" +"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" +"add_subparsers` method. The :meth:`!add_subparsers` method is normally " +"called with no arguments and returns a special action object. This object " +"has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " +"command name and any :class:`!ArgumentParser` constructor arguments, and " +"returns an :class:`!ArgumentParser` object that can be modified as usual." msgstr "" -#: library/argparse.rst:1730 +#: library/argparse.rst:1685 msgid "Description of parameters:" msgstr "" -#: library/argparse.rst:1732 +#: library/argparse.rst:1687 msgid "" -"title - title for the sub-parser group in help output; by default " +"*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: library/argparse.rst:1736 +#: library/argparse.rst:1691 msgid "" -"description - description for the sub-parser group in help output, by " +"*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: library/argparse.rst:1739 +#: library/argparse.rst:1694 msgid "" -"prog - usage information that will be displayed with sub-command help, by " +"*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: library/argparse.rst:1743 +#: library/argparse.rst:1698 msgid "" -"parser_class - class which will be used to create sub-parser instances, by " -"default the class of the current parser (e.g. ArgumentParser)" +"*parser_class* - class which will be used to create sub-parser instances, by " +"default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: library/argparse.rst:1746 +#: library/argparse.rst:1701 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: library/argparse.rst:1749 +#: library/argparse.rst:1704 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: library/argparse.rst:1752 +#: library/argparse.rst:1707 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: library/argparse.rst:1755 +#: library/argparse.rst:1710 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: library/argparse.rst:1757 +#: library/argparse.rst:1712 msgid "" -"metavar_ - string presenting available sub-commands in help; by default it " -"is ``None`` and presents sub-commands in form {cmd1, cmd2, ..}" +"metavar_ - string presenting available subcommands in help; by default it is " +"``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: library/argparse.rst:1760 +#: library/argparse.rst:1715 msgid "Some example usage::" msgstr "" -#: library/argparse.rst:1781 +#: library/argparse.rst:1717 +msgid "" +">>> # create the top-level parser\n" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--foo', action='store_true', help='foo help')\n" +">>> subparsers = parser.add_subparsers(help='subcommand help')\n" +">>>\n" +">>> # create the parser for the \"a\" command\n" +">>> parser_a = subparsers.add_parser('a', help='a help')\n" +">>> parser_a.add_argument('bar', type=int, help='bar help')\n" +">>>\n" +">>> # create the parser for the \"b\" command\n" +">>> parser_b = subparsers.add_parser('b', help='b help')\n" +">>> parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz " +"help')\n" +">>>\n" +">>> # parse some argument lists\n" +">>> parser.parse_args(['a', '12'])\n" +"Namespace(bar=12, foo=False)\n" +">>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])\n" +"Namespace(baz='Z', foo=True)" +msgstr "" + +#: library/argparse.rst:1736 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -1626,7 +2449,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: library/argparse.rst:1788 +#: library/argparse.rst:1743 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -1635,29 +2458,132 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: library/argparse.rst:1824 +#: library/argparse.rst:1751 +msgid "" +">>> parser.parse_args(['--help'])\n" +"usage: PROG [-h] [--foo] {a,b} ...\n" +"\n" +"positional arguments:\n" +" {a,b} subcommand help\n" +" a a help\n" +" b b help\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo foo help\n" +"\n" +">>> parser.parse_args(['a', '--help'])\n" +"usage: PROG a [-h] bar\n" +"\n" +"positional arguments:\n" +" bar bar help\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +">>> parser.parse_args(['b', '--help'])\n" +"usage: PROG b [-h] [--baz {X,Y,Z}]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --baz {X,Y,Z} baz help" +msgstr "" + +#: library/argparse.rst:1779 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: library/argparse.rst:1845 +#: library/argparse.rst:1783 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> subparsers = parser.add_subparsers(title='subcommands',\n" +"... description='valid subcommands',\n" +"... help='additional help')\n" +">>> subparsers.add_parser('foo')\n" +">>> subparsers.add_parser('bar')\n" +">>> parser.parse_args(['-h'])\n" +"usage: [-h] {foo,bar} ...\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"subcommands:\n" +" valid subcommands\n" +"\n" +" {foo,bar} additional help" +msgstr "" + +#: library/argparse.rst:1800 +msgid "" +"Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " +"*aliases* argument, which allows multiple strings to refer to the same " +"subparser. This example, like ``svn``, aliases ``co`` as a shorthand for " +"``checkout``::" +msgstr "" + +#: library/argparse.rst:1805 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> subparsers = parser.add_subparsers()\n" +">>> checkout = subparsers.add_parser('checkout', aliases=['co'])\n" +">>> checkout.add_argument('foo')\n" +">>> parser.parse_args(['co', 'bar'])\n" +"Namespace(foo='bar')" +msgstr "" + +#: library/argparse.rst:1812 msgid "" -"Furthermore, ``add_parser`` supports an additional ``aliases`` argument, " -"which allows multiple strings to refer to the same subparser. This example, " -"like ``svn``, aliases ``co`` as a shorthand for ``checkout``::" +":meth:`~_SubParsersAction.add_parser` supports also an additional " +"*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: library/argparse.rst:1856 +#: library/argparse.rst:1826 msgid "" -"One particularly effective way of handling sub-commands is to combine the " -"use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` " -"so that each subparser knows which Python function it should execute. For " +"One particularly effective way of handling subcommands is to combine the use " +"of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " +"that each subparser knows which Python function it should execute. For " "example::" msgstr "" -#: library/argparse.rst:1893 +#: library/argparse.rst:1831 +msgid "" +">>> # subcommand functions\n" +">>> def foo(args):\n" +"... print(args.x * args.y)\n" +"...\n" +">>> def bar(args):\n" +"... print('((%s))' % args.z)\n" +"...\n" +">>> # create the top-level parser\n" +">>> parser = argparse.ArgumentParser()\n" +">>> subparsers = parser.add_subparsers(required=True)\n" +">>>\n" +">>> # create the parser for the \"foo\" command\n" +">>> parser_foo = subparsers.add_parser('foo')\n" +">>> parser_foo.add_argument('-x', type=int, default=1)\n" +">>> parser_foo.add_argument('y', type=float)\n" +">>> parser_foo.set_defaults(func=foo)\n" +">>>\n" +">>> # create the parser for the \"bar\" command\n" +">>> parser_bar = subparsers.add_parser('bar')\n" +">>> parser_bar.add_argument('z')\n" +">>> parser_bar.set_defaults(func=bar)\n" +">>>\n" +">>> # parse the args and call whatever function was selected\n" +">>> args = parser.parse_args('foo 1 -x 2'.split())\n" +">>> args.func(args)\n" +"2.0\n" +">>>\n" +">>> # parse the args and call whatever function was selected\n" +">>> args = parser.parse_args('bar XYZYX'.split())\n" +">>> args.func(args)\n" +"((XYZYX))" +msgstr "" + +#: library/argparse.rst:1863 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -1667,15 +2593,33 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: library/argparse.rst:1909 -msgid "New *required* keyword argument." +#: library/argparse.rst:1870 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" +">>> subparser1 = subparsers.add_parser('1')\n" +">>> subparser1.add_argument('-x')\n" +">>> subparser2 = subparsers.add_parser('2')\n" +">>> subparser2.add_argument('y')\n" +">>> parser.parse_args(['2', 'frobble'])\n" +"Namespace(subparser_name='2', y='frobble')" +msgstr "" + +#: library/argparse.rst:1879 +msgid "New *required* keyword-only parameter." +msgstr "" + +#: library/argparse.rst:1882 +msgid "" +"Subparser's *prog* is no longer affected by a custom usage message in the " +"main parser." msgstr "" -#: library/argparse.rst:1914 +#: library/argparse.rst:1888 msgid "FileType objects" msgstr "" -#: library/argparse.rst:1918 +#: library/argparse.rst:1892 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -1684,74 +2628,175 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: library/argparse.rst:1930 +#: library/argparse.rst:1898 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" +">>> parser.add_argument('out', type=argparse.FileType('w', " +"encoding='UTF-8'))\n" +">>> parser.parse_args(['--raw', 'raw.dat', 'file.txt'])\n" +"Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " +"raw=<_io.FileIO name='raw.dat' mode='wb'>)" +msgstr "" + +#: library/argparse.rst:1904 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: library/argparse.rst:1939 +#: library/argparse.rst:1908 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" +">>> parser.parse_args(['-'])\n" +"Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" +msgstr "" + +#: library/argparse.rst:1915 +msgid "" +"If one argument uses *FileType* and then a subsequent argument fails, an " +"error is reported but the file is not automatically closed. This can also " +"clobber the output files. In this case, it would be better to wait until " +"after the parser has run and then use the :keyword:`with`-statement to " +"manage the files." +msgstr "" + +#: library/argparse.rst:1921 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: library/argparse.rst:1944 +#: library/argparse.rst:1928 msgid "Argument groups" msgstr "" -#: library/argparse.rst:1948 +#: library/argparse.rst:1933 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " "there is a better conceptual grouping of arguments than this default one, " -"appropriate groups can be created using the :meth:`add_argument_group` " +"appropriate groups can be created using the :meth:`!add_argument_group` " "method::" msgstr "" -#: library/argparse.rst:1965 +#: library/argparse.rst:1939 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" +">>> group = parser.add_argument_group('group')\n" +">>> group.add_argument('--foo', help='foo help')\n" +">>> group.add_argument('bar', help='bar help')\n" +">>> parser.print_help()\n" +"usage: PROG [--foo FOO] bar\n" +"\n" +"group:\n" +" bar bar help\n" +" --foo FOO foo help" +msgstr "" + +#: library/argparse.rst:1950 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" "class:`ArgumentParser`. When an argument is added to the group, the parser " "treats it just like a normal argument, but displays the argument in a " -"separate group for help messages. The :meth:`add_argument_group` method " +"separate group for help messages. The :meth:`!add_argument_group` method " "accepts *title* and *description* arguments which can be used to customize " "this display::" msgstr "" -#: library/argparse.rst:1991 +#: library/argparse.rst:1958 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" +">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" +">>> group1.add_argument('foo', help='foo help')\n" +">>> group2 = parser.add_argument_group('group2', 'group2 description')\n" +">>> group2.add_argument('--bar', help='bar help')\n" +">>> parser.print_help()\n" +"usage: PROG [--bar BAR] foo\n" +"\n" +"group1:\n" +" group1 description\n" +"\n" +" foo foo help\n" +"\n" +"group2:\n" +" group2 description\n" +"\n" +" --bar BAR bar help" +msgstr "" + +#: library/argparse.rst:1976 +msgid "" +"The optional, keyword-only parameters argument_default_ and " +"conflict_handler_ allow for finer-grained control of the behavior of the " +"argument group. These parameters have the same meaning as in the :class:" +"`ArgumentParser` constructor, but apply specifically to the argument group " +"rather than the entire parser." +msgstr "" + +#: library/argparse.rst:1981 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: library/argparse.rst:1994 +#: library/argparse.rst:1984 msgid "" -"Calling :meth:`add_argument_group` on an argument group is deprecated. This " -"feature was never supported and does not always work correctly. The function " -"exists on the API by accident through inheritance and will be removed in the " -"future." +"Calling :meth:`add_argument_group` on an argument group now raises an " +"exception. This nesting was never supported, often failed to work correctly, " +"and was unintentionally exposed through inheritance." msgstr "" -#: library/argparse.rst:2002 +#: library/argparse.rst:1989 +msgid "Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated." +msgstr "" + +#: library/argparse.rst:1995 msgid "Mutual exclusion" msgstr "" -#: library/argparse.rst:2006 +#: library/argparse.rst:1999 msgid "" -"Create a mutually exclusive group. :mod:`argparse` will make sure that only " +"Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: library/argparse.rst:2022 +#: library/argparse.rst:2003 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> group = parser.add_mutually_exclusive_group()\n" +">>> group.add_argument('--foo', action='store_true')\n" +">>> group.add_argument('--bar', action='store_false')\n" +">>> parser.parse_args(['--foo'])\n" +"Namespace(bar=True, foo=True)\n" +">>> parser.parse_args(['--bar'])\n" +"Namespace(bar=False, foo=False)\n" +">>> parser.parse_args(['--foo', '--bar'])\n" +"usage: PROG [-h] [--foo | --bar]\n" +"PROG: error: argument --bar: not allowed with argument --foo" +msgstr "" + +#: library/argparse.rst:2015 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: library/argparse.rst:2034 +#: library/argparse.rst:2019 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> group = parser.add_mutually_exclusive_group(required=True)\n" +">>> group.add_argument('--foo', action='store_true')\n" +">>> group.add_argument('--bar', action='store_false')\n" +">>> parser.parse_args([])\n" +"usage: PROG [-h] (--foo | --bar)\n" +"PROG: error: one of the arguments --foo --bar is required" +msgstr "" + +#: library/argparse.rst:2027 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -1759,19 +2804,39 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: library/argparse.rst:2057 +#: library/argparse.rst:2033 +msgid "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> group = parser.add_argument_group('Group title', 'Group description')\n" +">>> exclusive_group = group.add_mutually_exclusive_group(required=True)\n" +">>> exclusive_group.add_argument('--foo', help='foo help')\n" +">>> exclusive_group.add_argument('--bar', help='bar help')\n" +">>> parser.print_help()\n" +"usage: PROG [-h] (--foo FOO | --bar BAR)\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"Group title:\n" +" Group description\n" +"\n" +" --foo FOO foo help\n" +" --bar BAR bar help" +msgstr "" + +#: library/argparse.rst:2050 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " -"on a mutually exclusive group is deprecated. These features were never " -"supported and do not always work correctly. The functions exist on the API " -"by accident through inheritance and will be removed in the future." +"on a mutually exclusive group now raises an exception. This nesting was " +"never supported, often failed to work correctly, and was unintentionally " +"exposed through inheritance." msgstr "" -#: library/argparse.rst:2065 +#: library/argparse.rst:2058 msgid "Parser defaults" msgstr "" -#: library/argparse.rst:2069 +#: library/argparse.rst:2062 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -1780,83 +2845,126 @@ msgid "" "command line to be added::" msgstr "" -#: library/argparse.rst:2081 +#: library/argparse.rst:2068 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('foo', type=int)\n" +">>> parser.set_defaults(bar=42, baz='badger')\n" +">>> parser.parse_args(['736'])\n" +"Namespace(bar=42, baz='badger', foo=736)" +msgstr "" + +#: library/argparse.rst:2074 +msgid "" +"Note that defaults can be set at both the parser level using :meth:" +"`set_defaults` and at the argument level using :meth:`add_argument`. If both " +"are called for the same argument, the last default set for an argument is " +"used::" +msgstr "" + +#: library/argparse.rst:2078 msgid "" -"Note that parser-level defaults always override argument-level defaults::" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default='bar')\n" +">>> parser.set_defaults(foo='spam')\n" +">>> parser.parse_args([])\n" +"Namespace(foo='spam')" msgstr "" -#: library/argparse.rst:2089 +#: library/argparse.rst:2084 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: library/argparse.rst:2095 +#: library/argparse.rst:2090 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: library/argparse.rst:2106 +#: library/argparse.rst:2094 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default='badger')\n" +">>> parser.get_default('foo')\n" +"'badger'" +msgstr "" + +#: library/argparse.rst:2101 msgid "Printing help" msgstr "" -#: library/argparse.rst:2108 +#: library/argparse.rst:2103 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: library/argparse.rst:2114 +#: library/argparse.rst:2109 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: library/argparse.rst:2120 +#: library/argparse.rst:2115 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: library/argparse.rst:2124 +#: library/argparse.rst:2119 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: library/argparse.rst:2129 +#: library/argparse.rst:2124 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: library/argparse.rst:2134 +#: library/argparse.rst:2129 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: library/argparse.rst:2139 +#: library/argparse.rst:2134 msgid "Partial parsing" msgstr "" +#: library/argparse.rst:2138 +msgid "" +"Sometimes a script only needs to handle a specific set of command-line " +"arguments, leaving any unrecognized arguments for another script or program. " +"In these cases, the :meth:`~ArgumentParser.parse_known_args` method can be " +"useful." +msgstr "" + #: library/argparse.rst:2143 msgid "" -"Sometimes a script may only parse a few of the command-line arguments, " -"passing the remaining arguments on to another script or program. In these " -"cases, the :meth:`~ArgumentParser.parse_known_args` method can be useful. " -"It works much like :meth:`~ArgumentParser.parse_args` except that it does " -"not produce an error when extra arguments are present. Instead, it returns " -"a two item tuple containing the populated namespace and the list of " -"remaining argument strings." +"This method works similarly to :meth:`~ArgumentParser.parse_args`, but it " +"does not raise an error for extra, unrecognized arguments. Instead, it " +"parses the known arguments and returns a two item tuple that contains the " +"populated namespace and the list of any unrecognized arguments." +msgstr "" + +#: library/argparse.rst:2150 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action='store_true')\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" +"(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" msgstr "" -#: library/argparse.rst:2159 +#: library/argparse.rst:2157 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -1864,11 +2972,11 @@ msgid "" "remaining arguments list." msgstr "" -#: library/argparse.rst:2166 +#: library/argparse.rst:2164 msgid "Customizing file parsing" msgstr "" -#: library/argparse.rst:2170 +#: library/argparse.rst:2168 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -1876,41 +2984,57 @@ msgid "" "reading." msgstr "" -#: library/argparse.rst:2175 +#: library/argparse.rst:2173 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: library/argparse.rst:2179 +#: library/argparse.rst:2177 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: library/argparse.rst:2188 +#: library/argparse.rst:2180 +msgid "" +"class MyArgumentParser(argparse.ArgumentParser):\n" +" def convert_arg_line_to_args(self, arg_line):\n" +" return arg_line.split()" +msgstr "" + +#: library/argparse.rst:2186 msgid "Exiting methods" msgstr "" -#: library/argparse.rst:2192 +#: library/argparse.rst:2190 msgid "" "This method terminates the program, exiting with the specified *status* and, " -"if given, it prints a *message* before that. The user can override this " -"method to handle these steps differently::" +"if given, it prints a *message* to :data:`sys.stderr` before that. The user " +"can override this method to handle these steps differently::" +msgstr "" + +#: library/argparse.rst:2194 +msgid "" +"class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" +" def exit(self, status=0, message=None):\n" +" if status:\n" +" raise Exception(f'Exiting because of an error: {message}')\n" +" exit(status)" msgstr "" -#: library/argparse.rst:2204 +#: library/argparse.rst:2202 msgid "" -"This method prints a usage message including the *message* to the standard " -"error and terminates the program with a status code of 2." +"This method prints a usage message, including the *message*, to :data:`sys." +"stderr` and terminates the program with a status code of 2." msgstr "" -#: library/argparse.rst:2209 +#: library/argparse.rst:2207 msgid "Intermixed parsing" msgstr "" -#: library/argparse.rst:2214 +#: library/argparse.rst:2212 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -1918,15 +3042,15 @@ msgid "" "parsing style." msgstr "" -#: library/argparse.rst:2219 +#: library/argparse.rst:2217 msgid "" -"These parsers do not support all the argparse features, and will raise " -"exceptions if unsupported features are used. In particular, subparsers, and " -"mutually exclusive groups that include both optionals and positionals are " -"not supported." +"These parsers do not support all the :mod:`!argparse` features, and will " +"raise exceptions if unsupported features are used. In particular, " +"subparsers, and mutually exclusive groups that include both optionals and " +"positionals are not supported." msgstr "" -#: library/argparse.rst:2224 +#: library/argparse.rst:2222 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -1934,7 +3058,19 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: library/argparse.rst:2239 +#: library/argparse.rst:2228 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> parser.add_argument('cmd')\n" +">>> parser.add_argument('rest', nargs='*', type=int)\n" +">>> parser.parse_known_args('doit 1 --foo bar 2 3'.split())\n" +"(Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3'])\n" +">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" +"Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" +msgstr "" + +#: library/argparse.rst:2237 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -1942,139 +3078,82 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: library/argparse.rst:2249 -msgid "Upgrading optparse code" -msgstr "" - -#: library/argparse.rst:2251 -msgid "" -"Originally, the :mod:`argparse` module had attempted to maintain " -"compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " -"to extend transparently, particularly with the changes required to support " -"the new ``nargs=`` specifiers and better usage messages. When most " -"everything in :mod:`optparse` had either been copy-pasted over or monkey-" -"patched, it no longer seemed practical to try to maintain the backwards " -"compatibility." -msgstr "" - -#: library/argparse.rst:2258 -msgid "" -"The :mod:`argparse` module improves on the standard library :mod:`optparse` " -"module in a number of ways including:" -msgstr "" - -#: library/argparse.rst:2261 -msgid "Handling positional arguments." -msgstr "" - -#: library/argparse.rst:2262 -msgid "Supporting sub-commands." -msgstr "" - -#: library/argparse.rst:2263 -msgid "Allowing alternative option prefixes like ``+`` and ``/``." -msgstr "" - -#: library/argparse.rst:2264 -msgid "Handling zero-or-more and one-or-more style arguments." -msgstr "" - -#: library/argparse.rst:2265 -msgid "Producing more informative usage messages." -msgstr "" - -#: library/argparse.rst:2266 -msgid "Providing a much simpler interface for custom ``type`` and ``action``." -msgstr "" - -#: library/argparse.rst:2268 -msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" -msgstr "" - -#: library/argparse.rst:2270 -msgid "" -"Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" -"`ArgumentParser.add_argument` calls." -msgstr "" - -#: library/argparse.rst:2273 -msgid "" -"Replace ``(options, args) = parser.parse_args()`` with ``args = parser." -"parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " -"for the positional arguments. Keep in mind that what was previously called " -"``options``, now in the :mod:`argparse` context is called ``args``." -msgstr "" - -#: library/argparse.rst:2278 -msgid "" -"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" -"meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" -"`~ArgumentParser.parse_args`." -msgstr "" - -#: library/argparse.rst:2282 -msgid "" -"Replace callback actions and the ``callback_*`` keyword arguments with " -"``type`` or ``action`` arguments." +#: library/argparse.rst:2246 +msgid "Registering custom types or actions" msgstr "" -#: library/argparse.rst:2285 +#: library/argparse.rst:2250 msgid "" -"Replace string names for ``type`` keyword arguments with the corresponding " -"type objects (e.g. int, float, complex, etc)." +"Sometimes it's desirable to use a custom string in error messages to provide " +"more user-friendly output. In these cases, :meth:`!register` can be used to " +"register custom actions or types with a parser and allow you to reference " +"the type by their registered name instead of their callable name." msgstr "" -#: library/argparse.rst:2288 +#: library/argparse.rst:2255 msgid "" -"Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." -"OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." +"The :meth:`!register` method accepts three arguments - a *registry_name*, " +"specifying the internal registry where the object will be stored (e.g., " +"``action``, ``type``), *value*, which is the key under which the object will " +"be registered, and object, the callable to be registered." msgstr "" -#: library/argparse.rst:2292 +#: library/argparse.rst:2260 msgid "" -"Replace strings with implicit arguments such as ``%default`` or ``%prog`` " -"with the standard Python syntax to use dictionaries to format strings, that " -"is, ``%(default)s`` and ``%(prog)s``." +"The following example shows how to register a custom type with a parser::" msgstr "" -#: library/argparse.rst:2296 +#: library/argparse.rst:2262 msgid "" -"Replace the OptionParser constructor ``version`` argument with a call to " -"``parser.add_argument('--version', action='version', version='')``." -msgstr "" - -#: library/argparse.rst:2300 +">>> import argparse\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))\n" +">>> parser.add_argument('--foo', type='hexadecimal integer')\n" +"_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, " +"default=None, type='hexadecimal integer', choices=None, required=False, " +"help=None, metavar=None, deprecated=False)\n" +">>> parser.parse_args(['--foo', '0xFA'])\n" +"Namespace(foo=250)\n" +">>> parser.parse_args(['--foo', '1.2'])\n" +"usage: PROG [-h] [--foo FOO]\n" +"PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" +msgstr "" + +#: library/argparse.rst:2274 msgid "Exceptions" msgstr "" -#: library/argparse.rst:2304 +#: library/argparse.rst:2278 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: library/argparse.rst:2306 +#: library/argparse.rst:2280 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: library/argparse.rst:2311 +#: library/argparse.rst:2285 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: library/argparse.rst:980 +#: library/argparse.rst:2289 +msgid "Guides and Tutorials" +msgstr "" + +#: library/argparse.rst:901 msgid "? (question mark)" msgstr "" -#: library/argparse.rst:1014 library/argparse.rst:1028 +#: library/argparse.rst:933 library/argparse.rst:947 msgid "in argparse module" msgstr "" -#: library/argparse.rst:1014 +#: library/argparse.rst:933 msgid "* (asterisk)" msgstr "" -#: library/argparse.rst:1028 +#: library/argparse.rst:947 msgid "+ (plus)" msgstr "" diff --git a/library/array.po b/library/array.po index c0389520..ae80ff16 100644 --- a/library/array.po +++ b/library/array.po @@ -8,22 +8,23 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/array.rst:2 -msgid ":mod:`array` --- Efficient arrays of numeric values" +msgid ":mod:`!array` --- Efficient arrays of numeric values" msgstr "" #: library/array.rst:11 msgid "" "This module defines an object type which can compactly represent an array of " -"basic values: characters, integers, floating point numbers. Arrays are " +"basic values: characters, integers, floating-point numbers. Arrays are " "sequence types and behave very much like lists, except that the type of " "objects stored in them is constrained. The type is specified at object " "creation time by using a :dfn:`type code`, which is a single character. The " @@ -58,8 +59,8 @@ msgstr "" msgid "signed char" msgstr "" -#: library/array.rst:23 library/array.rst:29 library/array.rst:33 -#: library/array.rst:37 library/array.rst:41 +#: library/array.rst:23 library/array.rst:31 library/array.rst:35 +#: library/array.rst:39 library/array.rst:43 msgid "int" msgstr "" @@ -83,11 +84,11 @@ msgstr "" msgid "wchar_t" msgstr "" -#: library/array.rst:25 +#: library/array.rst:27 msgid "Unicode character" msgstr "" -#: library/array.rst:27 library/array.rst:31 library/array.rst:33 +#: library/array.rst:29 library/array.rst:33 library/array.rst:35 msgid "2" msgstr "" @@ -96,128 +97,144 @@ msgid "\\(1)" msgstr "" #: library/array.rst:27 -msgid "``'h'``" +msgid "``'w'``" msgstr "" #: library/array.rst:27 -msgid "signed short" +msgid "Py_UCS4" +msgstr "" + +#: library/array.rst:37 library/array.rst:45 +msgid "4" +msgstr "" + +#: library/array.rst:27 +msgid "\\(2)" msgstr "" #: library/array.rst:29 -msgid "``'H'``" +msgid "``'h'``" msgstr "" #: library/array.rst:29 -msgid "unsigned short" +msgid "signed short" msgstr "" #: library/array.rst:31 -msgid "``'i'``" +msgid "``'H'``" msgstr "" #: library/array.rst:31 -msgid "signed int" +msgid "unsigned short" msgstr "" #: library/array.rst:33 -msgid "``'I'``" +msgid "``'i'``" msgstr "" #: library/array.rst:33 -msgid "unsigned int" +msgid "signed int" msgstr "" #: library/array.rst:35 -msgid "``'l'``" +msgid "``'I'``" msgstr "" #: library/array.rst:35 -msgid "signed long" +msgid "unsigned int" msgstr "" -#: library/array.rst:37 library/array.rst:43 -msgid "4" +#: library/array.rst:37 +msgid "``'l'``" msgstr "" #: library/array.rst:37 +msgid "signed long" +msgstr "" + +#: library/array.rst:39 msgid "``'L'``" msgstr "" -#: library/array.rst:37 +#: library/array.rst:39 msgid "unsigned long" msgstr "" -#: library/array.rst:39 +#: library/array.rst:41 msgid "``'q'``" msgstr "" -#: library/array.rst:39 +#: library/array.rst:41 msgid "signed long long" msgstr "" -#: library/array.rst:41 library/array.rst:45 +#: library/array.rst:43 library/array.rst:47 msgid "8" msgstr "" -#: library/array.rst:41 +#: library/array.rst:43 msgid "``'Q'``" msgstr "" -#: library/array.rst:41 +#: library/array.rst:43 msgid "unsigned long long" msgstr "" -#: library/array.rst:43 +#: library/array.rst:45 msgid "``'f'``" msgstr "" -#: library/array.rst:45 +#: library/array.rst:47 msgid "float" msgstr "" -#: library/array.rst:45 +#: library/array.rst:47 msgid "``'d'``" msgstr "" -#: library/array.rst:45 +#: library/array.rst:47 msgid "double" msgstr "" -#: library/array.rst:48 +#: library/array.rst:50 msgid "Notes:" msgstr "" -#: library/array.rst:51 +#: library/array.rst:53 msgid "It can be 16 bits or 32 bits depending on the platform." msgstr "" -#: library/array.rst:53 +#: library/array.rst:55 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated " "``Py_UNICODE``. This change doesn't affect its behavior because " "``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3." msgstr "" -#: library/array.rst:61 +#: library/array.rst:60 +msgid "Please migrate to ``'w'`` typecode." +msgstr "" + +#: library/array.rst:67 msgid "" "The actual representation of values is determined by the machine " "architecture (strictly speaking, by the C implementation). The actual size " "can be accessed through the :attr:`array.itemsize` attribute." msgstr "" -#: library/array.rst:65 +#: library/array.rst:71 msgid "The module defines the following item:" msgstr "" -#: library/array.rst:70 +#: library/array.rst:76 msgid "A string with all available type codes." msgstr "" -#: library/array.rst:73 +#: library/array.rst:79 msgid "The module defines the following type:" msgstr "" -#: library/array.rst:78 +#: library/array.rst:84 msgid "" "A new array whose items are restricted by *typecode*, and initialized from " "the optional *initializer* value, which must be a :class:`bytes` or :class:" @@ -225,7 +242,7 @@ msgid "" "appropriate type." msgstr "" -#: library/array.rst:83 +#: library/array.rst:89 msgid "" "If given a :class:`bytes` or :class:`bytearray` object, the initializer is " "passed to the new array's :meth:`frombytes` method; if given a Unicode " @@ -234,7 +251,7 @@ msgid "" "to add initial items to the array." msgstr "" -#: library/array.rst:90 +#: library/array.rst:96 msgid "" "Array objects support the ordinary sequence operations of indexing, slicing, " "concatenation, and multiplication. When using slice assignment, the " @@ -244,25 +261,25 @@ msgid "" "object>` are supported." msgstr "" -#: library/array.rst:96 +#: library/array.rst:102 msgid "" "Raises an :ref:`auditing event ` ``array.__new__`` with arguments " "``typecode``, ``initializer``." msgstr "" -#: library/array.rst:101 +#: library/array.rst:107 msgid "The typecode character used to create the array." msgstr "" -#: library/array.rst:106 +#: library/array.rst:112 msgid "The length in bytes of one array item in the internal representation." msgstr "" -#: library/array.rst:111 +#: library/array.rst:117 msgid "Append a new item with value *x* to the end of the array." msgstr "" -#: library/array.rst:116 +#: library/array.rst:122 msgid "" "Return a tuple ``(address, length)`` giving the current memory address and " "the length in elements of the buffer used to hold array's contents. The " @@ -274,7 +291,7 @@ msgid "" "it." msgstr "" -#: library/array.rst:126 +#: library/array.rst:132 msgid "" "When using array objects from code written in C or C++ (the only way to " "effectively make use of this information), it makes more sense to use the " @@ -283,7 +300,7 @@ msgid "" "interface is documented in :ref:`bufferobjects`." msgstr "" -#: library/array.rst:135 +#: library/array.rst:141 msgid "" "\"Byteswap\" all items of the array. This is only supported for values " "which are 1, 2, 4, or 8 bytes in size; for other types of values, :exc:" @@ -291,11 +308,11 @@ msgid "" "written on a machine with a different byte order." msgstr "" -#: library/array.rst:143 +#: library/array.rst:149 msgid "Return the number of occurrences of *x* in the array." msgstr "" -#: library/array.rst:148 +#: library/array.rst:154 msgid "" "Append items from *iterable* to the end of the array. If *iterable* is " "another array, it must have *exactly* the same type code; if not, :exc:" @@ -303,18 +320,18 @@ msgid "" "iterable and its elements must be the right type to be appended to the array." msgstr "" -#: library/array.rst:156 +#: library/array.rst:162 msgid "" "Appends items from the :term:`bytes-like object`, interpreting its content " "as an array of machine values (as if it had been read from a file using the :" "meth:`fromfile` method)." msgstr "" -#: library/array.rst:160 +#: library/array.rst:166 msgid ":meth:`!fromstring` is renamed to :meth:`frombytes` for clarity." msgstr "" -#: library/array.rst:166 +#: library/array.rst:172 msgid "" "Read *n* items (as machine values) from the :term:`file object` *f* and " "append them to the end of the array. If less than *n* items are available, :" @@ -322,21 +339,21 @@ msgid "" "inserted into the array." msgstr "" -#: library/array.rst:174 +#: library/array.rst:180 msgid "" "Append items from the list. This is equivalent to ``for x in list: a." "append(x)`` except that if there is a type error, the array is unchanged." msgstr "" -#: library/array.rst:180 +#: library/array.rst:186 msgid "" "Extends this array with data from the given Unicode string. The array must " -"have type code ``'u'``; otherwise a :exc:`ValueError` is raised. Use ``array." -"frombytes(unicodestring.encode(enc))`` to append Unicode data to an array of " -"some other type." +"have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. " +"Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to " +"an array of some other type." msgstr "" -#: library/array.rst:188 +#: library/array.rst:194 msgid "" "Return the smallest *i* such that *i* is the index of the first occurrence " "of *x* in the array. The optional arguments *start* and *stop* can be " @@ -344,92 +361,95 @@ msgid "" "`ValueError` if *x* is not found." msgstr "" -#: library/array.rst:193 +#: library/array.rst:199 msgid "Added optional *start* and *stop* parameters." msgstr "" -#: library/array.rst:199 +#: library/array.rst:205 msgid "" "Insert a new item with value *x* in the array before position *i*. Negative " "values are treated as being relative to the end of the array." msgstr "" -#: library/array.rst:205 +#: library/array.rst:211 msgid "" "Removes the item with the index *i* from the array and returns it. The " "optional argument defaults to ``-1``, so that by default the last item is " "removed and returned." msgstr "" -#: library/array.rst:212 +#: library/array.rst:218 msgid "Remove the first occurrence of *x* from the array." msgstr "" -#: library/array.rst:217 +#: library/array.rst:223 +msgid "Remove all elements from the array." +msgstr "" + +#: library/array.rst:230 msgid "Reverse the order of the items in the array." msgstr "" -#: library/array.rst:222 +#: library/array.rst:235 msgid "" "Convert the array to an array of machine values and return the bytes " "representation (the same sequence of bytes that would be written to a file " "by the :meth:`tofile` method.)" msgstr "" -#: library/array.rst:226 +#: library/array.rst:239 msgid ":meth:`!tostring` is renamed to :meth:`tobytes` for clarity." msgstr "" -#: library/array.rst:232 +#: library/array.rst:245 msgid "Write all items (as machine values) to the :term:`file object` *f*." msgstr "" -#: library/array.rst:237 +#: library/array.rst:250 msgid "Convert the array to an ordinary list with the same items." msgstr "" -#: library/array.rst:242 +#: library/array.rst:255 msgid "" -"Convert the array to a Unicode string. The array must have a type ``'u'``; " -"otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` " -"to obtain a Unicode string from an array of some other type." +"Convert the array to a Unicode string. The array must have a type ``'u'`` " +"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes()." +"decode(enc)`` to obtain a Unicode string from an array of some other type." msgstr "" -#: library/array.rst:247 +#: library/array.rst:260 msgid "" "The string representation of array objects has the form ``array(typecode, " "initializer)``. The *initializer* is omitted if the array is empty, " -"otherwise it is a Unicode string if the *typecode* is ``'u'``, otherwise it " -"is a list of numbers. The string representation is guaranteed to be able to " -"be converted back to an array with the same type and value using :func:" -"`eval`, so long as the :class:`~array.array` class has been imported using " -"``from array import array``. Variables ``inf`` and ``nan`` must also be " -"defined if it contains corresponding floating point values. Examples::" -msgstr "" - -#: library/array.rst:268 -msgid "Module :mod:`struct`" +"otherwise it is a Unicode string if the *typecode* is ``'u'`` or ``'w'``, " +"otherwise it is a list of numbers. The string representation is guaranteed " +"to be able to be converted back to an array with the same type and value " +"using :func:`eval`, so long as the :class:`~array.array` class has been " +"imported using ``from array import array``. Variables ``inf`` and ``nan`` " +"must also be defined if it contains corresponding floating-point values. " +"Examples::" msgstr "" -#: library/array.rst:268 -msgid "Packing and unpacking of heterogeneous binary data." +#: library/array.rst:272 +msgid "" +"array('l')\n" +"array('w', 'hello \\u2641')\n" +"array('l', [1, 2, 3, 4, 5])\n" +"array('d', [1.0, 2.0, 3.14, -inf, nan])" msgstr "" -#: library/array.rst:272 -msgid "Module :mod:`xdrlib`" +#: library/array.rst:280 +msgid "Module :mod:`struct`" msgstr "" -#: library/array.rst:271 -msgid "" -"Packing and unpacking of External Data Representation (XDR) data as used in " -"some remote procedure call systems." +#: library/array.rst:281 +msgid "Packing and unpacking of heterogeneous binary data." msgstr "" -#: library/array.rst:274 +#: library/array.rst:283 msgid "`NumPy `_" msgstr "" -#: library/array.rst:275 +#: library/array.rst:284 msgid "The NumPy package defines another array type." msgstr "" diff --git a/library/ast.po b/library/ast.po index d1d13730..7d3a7cc6 100644 --- a/library/ast.po +++ b/library/ast.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/ast.rst:2 -msgid ":mod:`ast` --- Abstract Syntax Trees" +msgid ":mod:`!ast` --- Abstract syntax trees" msgstr "" #: library/ast.rst:14 @@ -43,13 +44,190 @@ msgid "" msgstr "" #: library/ast.rst:33 -msgid "Abstract Grammar" +msgid "Abstract grammar" msgstr "" #: library/ast.rst:35 msgid "The abstract grammar is currently defined as follows:" msgstr "" +#: library/ast.rst:37 +msgid "" +"-- ASDL's 4 builtin types are:\n" +"-- identifier, int, string, constant\n" +"\n" +"module Python\n" +"{\n" +" mod = Module(stmt* body, type_ignore* type_ignores)\n" +" | Interactive(stmt* body)\n" +" | Expression(expr body)\n" +" | FunctionType(expr* argtypes, expr returns)\n" +"\n" +" stmt = FunctionDef(identifier name, arguments args,\n" +" stmt* body, expr* decorator_list, expr? returns,\n" +" string? type_comment, type_param* type_params)\n" +" | AsyncFunctionDef(identifier name, arguments args,\n" +" stmt* body, expr* decorator_list, expr? " +"returns,\n" +" string? type_comment, type_param* type_params)\n" +"\n" +" | ClassDef(identifier name,\n" +" expr* bases,\n" +" keyword* keywords,\n" +" stmt* body,\n" +" expr* decorator_list,\n" +" type_param* type_params)\n" +" | Return(expr? value)\n" +"\n" +" | Delete(expr* targets)\n" +" | Assign(expr* targets, expr value, string? type_comment)\n" +" | TypeAlias(expr name, type_param* type_params, expr value)\n" +" | AugAssign(expr target, operator op, expr value)\n" +" -- 'simple' indicates that we annotate simple name without parens\n" +" | AnnAssign(expr target, expr annotation, expr? value, int " +"simple)\n" +"\n" +" -- use 'orelse' because else is a keyword in target languages\n" +" | For(expr target, expr iter, stmt* body, stmt* orelse, string? " +"type_comment)\n" +" | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, " +"string? type_comment)\n" +" | While(expr test, stmt* body, stmt* orelse)\n" +" | If(expr test, stmt* body, stmt* orelse)\n" +" | With(withitem* items, stmt* body, string? type_comment)\n" +" | AsyncWith(withitem* items, stmt* body, string? type_comment)\n" +"\n" +" | Match(expr subject, match_case* cases)\n" +"\n" +" | Raise(expr? exc, expr? cause)\n" +" | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* " +"finalbody)\n" +" | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* " +"finalbody)\n" +" | Assert(expr test, expr? msg)\n" +"\n" +" | Import(alias* names)\n" +" | ImportFrom(identifier? module, alias* names, int? level)\n" +"\n" +" | Global(identifier* names)\n" +" | Nonlocal(identifier* names)\n" +" | Expr(expr value)\n" +" | Pass | Break | Continue\n" +"\n" +" -- col_offset is the byte offset in the utf8 string the parser " +"uses\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" -- BoolOp() can use left & right?\n" +" expr = BoolOp(boolop op, expr* values)\n" +" | NamedExpr(expr target, expr value)\n" +" | BinOp(expr left, operator op, expr right)\n" +" | UnaryOp(unaryop op, expr operand)\n" +" | Lambda(arguments args, expr body)\n" +" | IfExp(expr test, expr body, expr orelse)\n" +" | Dict(expr?* keys, expr* values)\n" +" | Set(expr* elts)\n" +" | ListComp(expr elt, comprehension* generators)\n" +" | SetComp(expr elt, comprehension* generators)\n" +" | DictComp(expr key, expr value, comprehension* generators)\n" +" | GeneratorExp(expr elt, comprehension* generators)\n" +" -- the grammar constrains where yield expressions can occur\n" +" | Await(expr value)\n" +" | Yield(expr? value)\n" +" | YieldFrom(expr value)\n" +" -- need sequences for compare to distinguish between\n" +" -- x < 4 < 3 and (x < 4) < 3\n" +" | Compare(expr left, cmpop* ops, expr* comparators)\n" +" | Call(expr func, expr* args, keyword* keywords)\n" +" | FormattedValue(expr value, int conversion, expr? format_spec)\n" +" | Interpolation(expr value, constant str, int conversion, expr? " +"format_spec)\n" +" | JoinedStr(expr* values)\n" +" | TemplateStr(expr* values)\n" +" | Constant(constant value, string? kind)\n" +"\n" +" -- the following expression can appear in assignment context\n" +" | Attribute(expr value, identifier attr, expr_context ctx)\n" +" | Subscript(expr value, expr slice, expr_context ctx)\n" +" | Starred(expr value, expr_context ctx)\n" +" | Name(identifier id, expr_context ctx)\n" +" | List(expr* elts, expr_context ctx)\n" +" | Tuple(expr* elts, expr_context ctx)\n" +"\n" +" -- can appear only in Subscript\n" +" | Slice(expr? lower, expr? upper, expr? step)\n" +"\n" +" -- col_offset is the byte offset in the utf8 string the parser " +"uses\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" expr_context = Load | Store | Del\n" +"\n" +" boolop = And | Or\n" +"\n" +" operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift\n" +" | RShift | BitOr | BitXor | BitAnd | FloorDiv\n" +"\n" +" unaryop = Invert | Not | UAdd | USub\n" +"\n" +" cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn\n" +"\n" +" comprehension = (expr target, expr iter, expr* ifs, int is_async)\n" +"\n" +" excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)\n" +" attributes (int lineno, int col_offset, int? end_lineno, " +"int? end_col_offset)\n" +"\n" +" arguments = (arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs,\n" +" expr* kw_defaults, arg? kwarg, expr* defaults)\n" +"\n" +" arg = (identifier arg, expr? annotation, string? type_comment)\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" -- keyword arguments supplied to call (NULL identifier for **kwargs)\n" +" keyword = (identifier? arg, expr value)\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" -- import name with optional 'as' alias.\n" +" alias = (identifier name, identifier? asname)\n" +" attributes (int lineno, int col_offset, int? end_lineno, int? " +"end_col_offset)\n" +"\n" +" withitem = (expr context_expr, expr? optional_vars)\n" +"\n" +" match_case = (pattern pattern, expr? guard, stmt* body)\n" +"\n" +" pattern = MatchValue(expr value)\n" +" | MatchSingleton(constant value)\n" +" | MatchSequence(pattern* patterns)\n" +" | MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n" +" | MatchClass(expr cls, pattern* patterns, identifier* kwd_attrs, " +"pattern* kwd_patterns)\n" +"\n" +" | MatchStar(identifier? name)\n" +" -- The optional \"rest\" MatchMapping parameter handles " +"capturing extra mapping keys\n" +"\n" +" | MatchAs(pattern? pattern, identifier? name)\n" +" | MatchOr(pattern* patterns)\n" +"\n" +" attributes (int lineno, int col_offset, int end_lineno, int " +"end_col_offset)\n" +"\n" +" type_ignore = TypeIgnore(int lineno, string tag)\n" +"\n" +" type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n" +" | ParamSpec(identifier name, expr? default_value)\n" +" | TypeVarTuple(identifier name, expr? default_value)\n" +" attributes (int lineno, int col_offset, int end_lineno, int " +"end_col_offset)\n" +"}\n" +msgstr "" + #: library/ast.rst:42 msgid "Node classes" msgstr "" @@ -75,7 +253,7 @@ msgstr "" #: library/ast.rst:64 msgid "" -"Each concrete class has an attribute :attr:`_fields` which gives the names " +"Each concrete class has an attribute :attr:`!_fields` which gives the names " "of all child nodes." msgstr "" @@ -95,8 +273,21 @@ msgid "" "compiling an AST with :func:`compile`." msgstr "" +#: library/ast.rst:79 +msgid "" +"The :attr:`!_field_types` attribute on each concrete class is a dictionary " +"mapping field names (as also listed in :attr:`_fields`) to their types." +msgstr "" + #: library/ast.rst:82 msgid "" +">>> ast.TypeVar._field_types\n" +"{'name': , 'bound': ast.expr | None, 'default_value': ast.expr " +"| None}" +msgstr "" + +#: library/ast.rst:94 +msgid "" "Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" "`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " "attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " @@ -107,7 +298,7 @@ msgid "" "internally." msgstr "" -#: library/ast.rst:91 +#: library/ast.rst:103 msgid "" "Note that the end positions are not required by the compiler and are " "therefore optional. The end offset is *after* the last symbol, for example " @@ -115,44 +306,62 @@ msgid "" "``source_line[node.col_offset : node.end_col_offset]``." msgstr "" -#: library/ast.rst:96 +#: library/ast.rst:108 msgid "" "The constructor of a class :class:`ast.T` parses its arguments as follows:" msgstr "" -#: library/ast.rst:98 +#: library/ast.rst:110 msgid "" "If there are positional arguments, there must be as many as there are items " "in :attr:`T._fields`; they will be assigned as attributes of these names." msgstr "" -#: library/ast.rst:100 +#: library/ast.rst:112 msgid "" "If there are keyword arguments, they will set the attributes of the same " "names to the given values." msgstr "" -#: library/ast.rst:103 +#: library/ast.rst:115 msgid "" "For example, to create and populate an :class:`ast.UnaryOp` node, you could " "use ::" msgstr "" -#: library/ast.rst:115 -msgid "or the more compact ::" +#: library/ast.rst:118 +msgid "" +"node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" +" lineno=0, col_offset=0)" msgstr "" -#: library/ast.rst:122 +#: library/ast.rst:121 +msgid "" +"If a field that is optional in the grammar is omitted from the constructor, " +"it defaults to ``None``. If a list field is omitted, it defaults to the " +"empty list. If a field of type :class:`!ast.expr_context` is omitted, it " +"defaults to :class:`Load() `. If any other field is omitted, a :" +"exc:`DeprecationWarning` is raised and the AST node will not have this " +"field. In Python 3.15, this condition will raise an error." +msgstr "" + +#: library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." msgstr "" -#: library/ast.rst:126 +#: library/ast.rst:134 msgid "" "Simple indices are represented by their value, extended slices are " "represented as tuples." msgstr "" -#: library/ast.rst:131 +#: library/ast.rst:139 +msgid "" +"The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes the " +"values of the node fields." +msgstr "" + +#: library/ast.rst:144 msgid "" "Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" "class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available, " @@ -160,195 +369,445 @@ msgid "" "instantiating them will return an instance of a different class." msgstr "" -#: library/ast.rst:138 +#: library/ast.rst:151 msgid "" "Old classes :class:`!ast.Index` and :class:`!ast.ExtSlice` are still " "available, but they will be removed in future Python releases. In the " "meantime, instantiating them will return an instance of a different class." msgstr "" -#: library/ast.rst:144 +#: library/ast.rst:158 +msgid "" +"Previous versions of Python allowed the creation of AST nodes that were " +"missing required fields. Similarly, AST node constructors allowed arbitrary " +"keyword arguments that were set as attributes of the AST node, even if they " +"did not match any of the fields of the AST node. This behavior is deprecated " +"and will be removed in Python 3.15." +msgstr "" + +#: library/ast.rst:165 msgid "" "The descriptions of the specific node classes displayed here were initially " "adapted from the fantastic `Green Tree Snakes `__ project and all its contributors." msgstr "" -#: library/ast.rst:153 +#: library/ast.rst:174 msgid "Root nodes" msgstr "" -#: library/ast.rst:157 +#: library/ast.rst:178 msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "" -#: library/ast.rst:160 -msgid "*body* is a :class:`list` of the module's :ref:`ast-statements`." +#: library/ast.rst:181 +msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." msgstr "" -#: library/ast.rst:162 +#: library/ast.rst:183 msgid "" -"*type_ignores* is a :class:`list` of the module's type ignore comments; see :" -"func:`ast.parse` for more details." +"``type_ignores`` is a :class:`list` of the module's type ignore comments; " +"see :func:`ast.parse` for more details." msgstr "" -#: library/ast.rst:179 +#: library/ast.rst:186 +msgid "" +">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1))])" +msgstr "" + +#: library/ast.rst:199 msgid "" "A single Python :ref:`expression input `. Node type " "generated by :func:`ast.parse` when *mode* is ``\"eval\"``." msgstr "" -#: library/ast.rst:182 +#: library/ast.rst:202 msgid "" -"*body* is a single node, one of the :ref:`expression types `." msgstr "" -#: library/ast.rst:194 +#: library/ast.rst:275 +msgid "" +">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Constant(value=123))" +msgstr "" + +#: library/ast.rst:214 msgid "" "A single :ref:`interactive input `, like in :ref:`tut-interac`. " "Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." msgstr "" -#: library/ast.rst:197 -msgid "*body* is a :class:`list` of :ref:`statement nodes `." +#: library/ast.rst:217 +msgid "``body`` is a :class:`list` of :ref:`statement nodes `." +msgstr "" + +#: library/ast.rst:219 +msgid "" +">>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\n" +"Interactive(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1)),\n" +" Assign(\n" +" targets=[\n" +" Name(id='y', ctx=Store())],\n" +" value=Constant(value=2))])" msgstr "" -#: library/ast.rst:216 +#: library/ast.rst:236 msgid "" "A representation of an old-style type comments for functions, as Python " "versions prior to 3.5 didn't support :pep:`484` annotations. Node type " "generated by :func:`ast.parse` when *mode* is ``\"func_type\"``." msgstr "" -#: library/ast.rst:220 +#: library/ast.rst:240 msgid "Such type comments would look like this::" msgstr "" -#: library/ast.rst:226 +#: library/ast.rst:242 msgid "" -"*argtypes* is a :class:`list` of :ref:`expression nodes `." +"def sum_two_number(a, b):\n" +" # type: (int, int) -> int\n" +" return a + b" msgstr "" -#: library/ast.rst:228 -msgid "*returns* is a single :ref:`expression node `." +#: library/ast.rst:246 +msgid "" +"``argtypes`` is a :class:`list` of :ref:`expression nodes `." msgstr "" -#: library/ast.rst:246 -msgid "Literals" +#: library/ast.rst:248 +msgid "``returns`` is a single :ref:`expression node `." msgstr "" #: library/ast.rst:250 msgid "" +">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), " +"indent=4))\n" +"FunctionType(\n" +" argtypes=[\n" +" Name(id='int', ctx=Load()),\n" +" Name(id='str', ctx=Load())],\n" +" returns=Subscript(\n" +" value=Name(id='List', ctx=Load()),\n" +" slice=Name(id='int', ctx=Load()),\n" +" ctx=Load()))" +msgstr "" + +#: library/ast.rst:266 +msgid "Literals" +msgstr "" + +#: library/ast.rst:270 +msgid "" "A constant value. The ``value`` attribute of the ``Constant`` literal " "contains the Python object it represents. The values represented can be " -"simple types such as a number, string or ``None``, but also immutable " -"container types (tuples and frozensets) if all of their elements are " -"constant." +"instances of :class:`str`, :class:`bytes`, :class:`int`, :class:`float`, :" +"class:`complex`, and :class:`bool`, and the constants :data:`None` and :data:" +"`Ellipsis`." msgstr "" -#: library/ast.rst:264 +#: library/ast.rst:284 msgid "" "Node representing a single formatting field in an f-string. If the string " "contains a single formatting field and nothing else the node can be isolated " "otherwise it appears in :class:`JoinedStr`." msgstr "" -#: library/ast.rst:268 +#: library/ast.rst:288 msgid "" "``value`` is any expression node (such as a literal, a variable, or a " "function call)." msgstr "" -#: library/ast.rst:270 +#: library/ast.rst:372 msgid "``conversion`` is an integer:" msgstr "" -#: library/ast.rst:272 +#: library/ast.rst:292 msgid "-1: no formatting" msgstr "" -#: library/ast.rst:273 -msgid "115: ``!s`` string formatting" +#: library/ast.rst:293 +msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` formatting" msgstr "" -#: library/ast.rst:274 -msgid "114: ``!r`` repr formatting" +#: library/ast.rst:294 +msgid "114 (``ord('r')``): ``!r`` :func:`repr` formatting" msgstr "" -#: library/ast.rst:275 -msgid "97: ``!a`` ascii formatting" +#: library/ast.rst:295 +msgid "115 (``ord('s')``): ``!s`` :func:`string ` formatting" msgstr "" -#: library/ast.rst:277 +#: library/ast.rst:297 msgid "" "``format_spec`` is a :class:`JoinedStr` node representing the formatting of " "the value, or ``None`` if no format was specified. Both ``conversion`` and " "``format_spec`` can be set at the same time." msgstr "" -#: library/ast.rst:284 +#: library/ast.rst:304 msgid "" "An f-string, comprising a series of :class:`FormattedValue` and :class:" "`Constant` nodes." msgstr "" -#: library/ast.rst:313 +#: library/ast.rst:307 +msgid "" +">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=JoinedStr(\n" +" values=[\n" +" Constant(value='sin('),\n" +" FormattedValue(\n" +" value=Name(id='a', ctx=Load()),\n" +" conversion=-1),\n" +" Constant(value=') is '),\n" +" FormattedValue(\n" +" value=Call(\n" +" func=Name(id='sin', ctx=Load()),\n" +" args=[\n" +" Name(id='a', ctx=Load())]),\n" +" conversion=-1,\n" +" format_spec=JoinedStr(\n" +" values=[\n" +" Constant(value='.3')]))]))" +msgstr "" + +#: library/ast.rst:333 +msgid "" +"Node representing a template string literal, comprising a series of :class:" +"`Interpolation` and :class:`Constant` nodes. These nodes may be any order, " +"and do not need to be interleaved." +msgstr "" + +#: library/ast.rst:337 +msgid "" +">>> expr = ast.parse('t\"{name} finished {place:ordinal}\"', mode='eval')\n" +">>> print(ast.dump(expr, indent=4))\n" +"Expression(\n" +" body=TemplateStr(\n" +" values=[\n" +" Interpolation(\n" +" value=Name(id='name', ctx=Load()),\n" +" str='name',\n" +" conversion=-1),\n" +" Constant(value=' finished '),\n" +" Interpolation(\n" +" value=Name(id='place', ctx=Load()),\n" +" str='place',\n" +" conversion=-1,\n" +" format_spec=JoinedStr(\n" +" values=[\n" +" Constant(value='ordinal')]))]))" +msgstr "" + +#: library/ast.rst:361 +msgid "" +"Node representing a single interpolation field in a template string literal." +msgstr "" + +#: library/ast.rst:363 +msgid "" +"``value`` is any expression node (such as a literal, a variable, or a " +"function call). This has the same meaning as ``FormattedValue.value``." +msgstr "" + +#: library/ast.rst:366 +msgid "" +"``str`` is a constant containing the text of the interpolation expression." +msgstr "" + +#: library/ast.rst:368 +msgid "" +"If ``str`` is set to ``None``, then ``value`` is used to generate code when " +"calling :func:`ast.unparse`. This no longer guarantees that the generated " +"code is identical to the original and is intended for code generation." +msgstr "" + +#: library/ast.rst:374 +msgid "-1: no conversion" +msgstr "" + +#: library/ast.rst:375 +msgid "97 (``ord('a')``): ``!a`` :func:`ASCII ` conversion" +msgstr "" + +#: library/ast.rst:376 +msgid "114 (``ord('r')``): ``!r`` :func:`repr` conversion" +msgstr "" + +#: library/ast.rst:377 +msgid "115 (``ord('s')``): ``!s`` :func:`string ` conversion" +msgstr "" + +#: library/ast.rst:379 +msgid "This has the same meaning as ``FormattedValue.conversion``." +msgstr "" + +#: library/ast.rst:380 +msgid "" +"``format_spec`` is a :class:`JoinedStr` node representing the formatting of " +"the value, or ``None`` if no format was specified. Both ``conversion`` and " +"``format_spec`` can be set at the same time. This has the same meaning as " +"``FormattedValue.format_spec``." +msgstr "" + +#: library/ast.rst:389 msgid "" "A list or tuple. ``elts`` holds a list of nodes representing the elements. " "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " "``(x,y)=something``), and :class:`Load` otherwise." msgstr "" -#: library/ast.rst:339 +#: library/ast.rst:393 +msgid "" +">>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\n" +"Expression(\n" +" body=List(\n" +" elts=[\n" +" Constant(value=1),\n" +" Constant(value=2),\n" +" Constant(value=3)],\n" +" ctx=Load()))\n" +">>> print(ast.dump(ast.parse('(1, 2, 3)', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Tuple(\n" +" elts=[\n" +" Constant(value=1),\n" +" Constant(value=2),\n" +" Constant(value=3)],\n" +" ctx=Load()))" +msgstr "" + +#: library/ast.rst:415 msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "" -#: library/ast.rst:354 +#: library/ast.rst:417 +msgid "" +">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Set(\n" +" elts=[\n" +" Constant(value=1),\n" +" Constant(value=2),\n" +" Constant(value=3)]))" +msgstr "" + +#: library/ast.rst:430 msgid "" "A dictionary. ``keys`` and ``values`` hold lists of nodes representing the " "keys and the values respectively, in matching order (what would be returned " "when calling :code:`dictionary.keys()` and :code:`dictionary.values()`)." msgstr "" -#: library/ast.rst:358 +#: library/ast.rst:434 msgid "" "When doing dictionary unpacking using dictionary literals the expression to " "be expanded goes in the ``values`` list, with a ``None`` at the " "corresponding position in ``keys``." msgstr "" -#: library/ast.rst:376 +#: library/ast.rst:438 +msgid "" +">>> print(ast.dump(ast.parse('{\"a\":1, **d}', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Dict(\n" +" keys=[\n" +" Constant(value='a'),\n" +" None],\n" +" values=[\n" +" Constant(value=1),\n" +" Name(id='d', ctx=Load())]))" +msgstr "" + +#: library/ast.rst:452 msgid "Variables" msgstr "" -#: library/ast.rst:380 +#: library/ast.rst:456 msgid "" "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of " "the following types." msgstr "" -#: library/ast.rst:388 +#: library/ast.rst:464 msgid "" "Variable references can be used to load the value of a variable, to assign a " "new value to it, or to delete it. Variable references are given a context to " "distinguish these cases." msgstr "" -#: library/ast.rst:421 +#: library/ast.rst:468 +msgid "" +">>> print(ast.dump(ast.parse('a'), indent=4))\n" +"Module(\n" +" body=[\n" +" Expr(\n" +" value=Name(id='a', ctx=Load()))])\n" +"\n" +">>> print(ast.dump(ast.parse('a = 1'), indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='a', ctx=Store())],\n" +" value=Constant(value=1))])\n" +"\n" +">>> print(ast.dump(ast.parse('del a'), indent=4))\n" +"Module(\n" +" body=[\n" +" Delete(\n" +" targets=[\n" +" Name(id='a', ctx=Del())])])" +msgstr "" + +#: library/ast.rst:494 msgid "" "A ``*var`` variable reference. ``value`` holds the variable, typically a :" "class:`Name` node. This type must be used when building a :class:`Call` node " "with ``*args``." msgstr "" -#: library/ast.rst:446 +#: library/ast.rst:498 +msgid "" +">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Tuple(\n" +" elts=[\n" +" Name(id='a', ctx=Store()),\n" +" Starred(\n" +" value=Name(id='b', ctx=Store()),\n" +" ctx=Store())],\n" +" ctx=Store())],\n" +" value=Name(id='it', ctx=Load()))])" +msgstr "" + +#: library/ast.rst:518 msgid "Expressions" msgstr "" -#: library/ast.rst:450 +#: library/ast.rst:522 msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " @@ -357,29 +816,59 @@ msgid "" "`YieldFrom` node." msgstr "" -#: library/ast.rst:469 +#: library/ast.rst:527 +msgid "" +">>> print(ast.dump(ast.parse('-a'), indent=4))\n" +"Module(\n" +" body=[\n" +" Expr(\n" +" value=UnaryOp(\n" +" op=USub(),\n" +" operand=Name(id='a', ctx=Load())))])" +msgstr "" + +#: library/ast.rst:540 msgid "" "A unary operation. ``op`` is the operator, and ``operand`` any expression " "node." msgstr "" -#: library/ast.rst:478 +#: library/ast.rst:549 msgid "" "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` " "is the ``~`` operator." msgstr "" -#: library/ast.rst:492 +#: library/ast.rst:552 +msgid "" +">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n" +"Expression(\n" +" body=UnaryOp(\n" +" op=Not(),\n" +" operand=Name(id='x', ctx=Load())))" +msgstr "" + +#: library/ast.rst:563 msgid "" "A binary operation (like addition or division). ``op`` is the operator, and " "``left`` and ``right`` are any expression nodes." msgstr "" -#: library/ast.rst:519 +#: library/ast.rst:566 +msgid "" +">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" +"Expression(\n" +" body=BinOp(\n" +" left=Name(id='x', ctx=Load()),\n" +" op=Add(),\n" +" right=Name(id='y', ctx=Load())))" +msgstr "" + +#: library/ast.rst:590 msgid "Binary operator tokens." msgstr "" -#: library/ast.rst:524 +#: library/ast.rst:595 msgid "" "A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. " "``values`` are the values involved. Consecutive operations with the same " @@ -387,60 +876,115 @@ msgid "" "values." msgstr "" -#: library/ast.rst:529 +#: library/ast.rst:600 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "" -#: library/ast.rst:545 +#: library/ast.rst:602 +msgid "" +">>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\n" +"Expression(\n" +" body=BoolOp(\n" +" op=Or(),\n" +" values=[\n" +" Name(id='x', ctx=Load()),\n" +" Name(id='y', ctx=Load())]))" +msgstr "" + +#: library/ast.rst:616 msgid "Boolean operator tokens." msgstr "" -#: library/ast.rst:550 +#: library/ast.rst:621 msgid "" "A comparison of two or more values. ``left`` is the first value in the " "comparison, ``ops`` the list of operators, and ``comparators`` the list of " "values after the first element in the comparison." msgstr "" -#: library/ast.rst:579 +#: library/ast.rst:625 +msgid "" +">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Compare(\n" +" left=Constant(value=1),\n" +" ops=[\n" +" LtE(),\n" +" Lt()],\n" +" comparators=[\n" +" Name(id='a', ctx=Load()),\n" +" Constant(value=10)]))" +msgstr "" + +#: library/ast.rst:650 msgid "Comparison operator tokens." msgstr "" -#: library/ast.rst:584 +#: library/ast.rst:655 msgid "" "A function call. ``func`` is the function, which will often be a :class:" "`Name` or :class:`Attribute` object. Of the arguments:" msgstr "" -#: library/ast.rst:587 +#: library/ast.rst:658 msgid "``args`` holds a list of the arguments passed by position." msgstr "" -#: library/ast.rst:588 +#: library/ast.rst:659 msgid "" "``keywords`` holds a list of :class:`.keyword` objects representing " "arguments passed by keyword." msgstr "" -#: library/ast.rst:591 +#: library/ast.rst:662 msgid "" -"When creating a ``Call`` node, ``args`` and ``keywords`` are required, but " -"they can be empty lists." +"The ``args`` and ``keywords`` arguments are optional and default to empty " +"lists." msgstr "" -#: library/ast.rst:615 +#: library/ast.rst:664 +msgid "" +">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=Call(\n" +" func=Name(id='func', ctx=Load()),\n" +" args=[\n" +" Name(id='a', ctx=Load()),\n" +" Starred(\n" +" value=Name(id='d', ctx=Load()),\n" +" ctx=Load())],\n" +" keywords=[\n" +" keyword(\n" +" arg='b',\n" +" value=Name(id='c', ctx=Load())),\n" +" keyword(\n" +" value=Name(id='e', ctx=Load()))]))" +msgstr "" + +#: library/ast.rst:685 msgid "" "A keyword argument to a function call or class definition. ``arg`` is a raw " "string of the parameter name, ``value`` is a node to pass in." msgstr "" -#: library/ast.rst:621 +#: library/ast.rst:691 msgid "" "An expression such as ``a if b else c``. Each field holds a single node, so " "in the following example, all three are :class:`Name` nodes." msgstr "" -#: library/ast.rst:636 +#: library/ast.rst:694 +msgid "" +">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" +"Expression(\n" +" body=IfExp(\n" +" test=Name(id='b', ctx=Load()),\n" +" body=Name(id='a', ctx=Load()),\n" +" orelse=Name(id='c', ctx=Load())))" +msgstr "" + +#: library/ast.rst:706 msgid "" "Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" "`Name`. ``attr`` is a bare string giving the name of the attribute, and " @@ -448,7 +992,17 @@ msgid "" "the attribute is acted on." msgstr "" -#: library/ast.rst:653 +#: library/ast.rst:711 +msgid "" +">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Attribute(\n" +" value=Name(id='snake', ctx=Load()),\n" +" attr='colour',\n" +" ctx=Load()))" +msgstr "" + +#: library/ast.rst:723 msgid "" "A named expression. This AST node is produced by the assignment expressions " "operator (also known as the walrus operator). As opposed to the :class:" @@ -456,11 +1010,20 @@ msgid "" "case both ``target`` and ``value`` must be single nodes." msgstr "" -#: library/ast.rst:669 +#: library/ast.rst:728 +msgid "" +">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" +"Expression(\n" +" body=NamedExpr(\n" +" target=Name(id='x', ctx=Store()),\n" +" value=Constant(value=4)))" +msgstr "" + +#: library/ast.rst:739 msgid "Subscripting" msgstr "" -#: library/ast.rst:673 +#: library/ast.rst:743 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " "sequence or mapping). ``slice`` is an index, slice or key. It can be a :" @@ -468,29 +1031,101 @@ msgid "" "`Store` or :class:`Del` according to the action performed with the subscript." msgstr "" -#: library/ast.rst:697 +#: library/ast.rst:749 +msgid "" +">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Subscript(\n" +" value=Name(id='l', ctx=Load()),\n" +" slice=Tuple(\n" +" elts=[\n" +" Slice(\n" +" lower=Constant(value=1),\n" +" upper=Constant(value=2)),\n" +" Constant(value=3)],\n" +" ctx=Load()),\n" +" ctx=Load()))" +msgstr "" + +#: library/ast.rst:767 msgid "" "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can " "occur only inside the *slice* field of :class:`Subscript`, either directly " "or as an element of :class:`Tuple`." msgstr "" -#: library/ast.rst:714 +#: library/ast.rst:771 +msgid "" +">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Subscript(\n" +" value=Name(id='l', ctx=Load()),\n" +" slice=Slice(\n" +" lower=Constant(value=1),\n" +" upper=Constant(value=2)),\n" +" ctx=Load()))" +msgstr "" + +#: library/ast.rst:784 msgid "Comprehensions" msgstr "" -#: library/ast.rst:721 +#: library/ast.rst:791 msgid "" "List and set comprehensions, generator expressions, and dictionary " "comprehensions. ``elt`` (or ``key`` and ``value``) is a single node " "representing the part that will be evaluated for each item." msgstr "" -#: library/ast.rst:725 +#: library/ast.rst:795 msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "" -#: library/ast.rst:767 +#: library/ast.rst:797 +msgid "" +">>> print(ast.dump(\n" +"... ast.parse('[x for x in numbers]', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" +"Expression(\n" +" body=ListComp(\n" +" elt=Name(id='x', ctx=Load()),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" is_async=0)]))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x: x**2 for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" +"Expression(\n" +" body=DictComp(\n" +" key=Name(id='x', ctx=Load()),\n" +" value=BinOp(\n" +" left=Name(id='x', ctx=Load()),\n" +" op=Pow(),\n" +" right=Constant(value=2)),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" is_async=0)]))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" +"Expression(\n" +" body=SetComp(\n" +" elt=Name(id='x', ctx=Load()),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" is_async=0)]))" +msgstr "" + +#: library/ast.rst:843 msgid "" "One ``for`` clause in a comprehension. ``target`` is the reference to use " "for each element - typically a :class:`Name` or :class:`Tuple` node. " @@ -498,45 +1133,181 @@ msgid "" "expressions: each ``for`` clause can have multiple ``ifs``." msgstr "" -#: library/ast.rst:772 +#: library/ast.rst:848 msgid "" "``is_async`` indicates a comprehension is asynchronous (using an ``async " "for`` instead of ``for``). The value is an integer (0 or 1)." msgstr "" -#: library/ast.rst:841 +#: library/ast.rst:851 +msgid "" +">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " +"mode='eval'),\n" +"... indent=4)) # Multiple comprehensions in one.\n" +"Expression(\n" +" body=ListComp(\n" +" elt=Call(\n" +" func=Name(id='ord', ctx=Load()),\n" +" args=[\n" +" Name(id='c', ctx=Load())]),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='line', ctx=Store()),\n" +" iter=Name(id='file', ctx=Load()),\n" +" is_async=0),\n" +" comprehension(\n" +" target=Name(id='c', ctx=Store()),\n" +" iter=Name(id='line', ctx=Load()),\n" +" is_async=0)]))\n" +"\n" +">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', " +"mode='eval'),\n" +"... indent=4)) # generator comprehension\n" +"Expression(\n" +" body=GeneratorExp(\n" +" elt=BinOp(\n" +" left=Name(id='n', ctx=Load()),\n" +" op=Pow(),\n" +" right=Constant(value=2)),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='n', ctx=Store()),\n" +" iter=Name(id='it', ctx=Load()),\n" +" ifs=[\n" +" Compare(\n" +" left=Name(id='n', ctx=Load()),\n" +" ops=[\n" +" Gt()],\n" +" comparators=[\n" +" Constant(value=5)]),\n" +" Compare(\n" +" left=Name(id='n', ctx=Load()),\n" +" ops=[\n" +" Lt()],\n" +" comparators=[\n" +" Constant(value=10)])],\n" +" is_async=0)]))\n" +"\n" +">>> print(ast.dump(ast.parse('[i async for i in soc]', mode='eval'),\n" +"... indent=4)) # Async comprehension\n" +"Expression(\n" +" body=ListComp(\n" +" elt=Name(id='i', ctx=Load()),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='i', ctx=Store()),\n" +" iter=Name(id='soc', ctx=Load()),\n" +" is_async=1)]))" +msgstr "" + +#: library/ast.rst:913 msgid "Statements" msgstr "" -#: library/ast.rst:845 +#: library/ast.rst:917 msgid "" "An assignment. ``targets`` is a list of nodes, and ``value`` is a single " "node." msgstr "" -#: library/ast.rst:847 +#: library/ast.rst:919 msgid "" "Multiple nodes in ``targets`` represents assigning the same value to each. " "Unpacking is represented by putting a :class:`Tuple` or :class:`List` within " "``targets``." msgstr "" -#: library/ast.rst:1161 library/ast.rst:1891 +#: library/ast.rst:1220 library/ast.rst:1980 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "" -#: library/ast.rst:883 +#: library/ast.rst:927 +msgid "" +">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='a', ctx=Store()),\n" +" Name(id='b', ctx=Store())],\n" +" value=Constant(value=1))])\n" +"\n" +">>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Tuple(\n" +" elts=[\n" +" Name(id='a', ctx=Store()),\n" +" Name(id='b', ctx=Store())],\n" +" ctx=Store())],\n" +" value=Name(id='c', ctx=Load()))])" +msgstr "" + +#: library/ast.rst:953 msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " -"a :class:`Name`, a :class:`Attribute` or a :class:`Subscript`. " +"a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " "``annotation`` is the annotation, such as a :class:`Constant` or :class:" -"`Name` node. ``value`` is a single optional node. ``simple`` is a boolean " -"integer set to True for a :class:`Name` node in ``target`` that do not " -"appear in between parenthesis and are hence pure names and not expressions." -msgstr "" - -#: library/ast.rst:938 +"`Name` node. ``value`` is a single optional node." +msgstr "" + +#: library/ast.rst:958 +msgid "" +"``simple`` is always either 0 (indicating a \"complex\" target) or 1 " +"(indicating a \"simple\" target). A \"simple\" target consists solely of a :" +"class:`Name` node that does not appear between parentheses; all other " +"targets are considered complex. Only simple targets appear in the :attr:" +"`~object.__annotations__` dictionary of modules and classes." +msgstr "" + +#: library/ast.rst:964 +msgid "" +">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='c', ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=1)])\n" +"\n" +">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with " +"parenthesis\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='a', ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" value=Constant(value=1),\n" +" simple=0)])\n" +"\n" +">>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Attribute(\n" +" value=Name(id='a', ctx=Load()),\n" +" attr='b',\n" +" ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=0)])\n" +"\n" +">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript " +"annotation\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Subscript(\n" +" value=Name(id='a', ctx=Load()),\n" +" slice=Constant(value=1),\n" +" ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=0)])" +msgstr "" + +#: library/ast.rst:1008 msgid "" "Augmented assignment, such as ``a += 1``. In the following example, " "``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " @@ -544,36 +1315,87 @@ msgid "" "value for 1." msgstr "" -#: library/ast.rst:943 +#: library/ast.rst:1013 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." msgstr "" -#: library/ast.rst:960 +#: library/ast.rst:1016 +msgid "" +">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" +"Module(\n" +" body=[\n" +" AugAssign(\n" +" target=Name(id='x', ctx=Store()),\n" +" op=Add(),\n" +" value=Constant(value=2))])" +msgstr "" + +#: library/ast.rst:1029 msgid "" "A ``raise`` statement. ``exc`` is the exception object to be raised, " "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " "``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" -#: library/ast.rst:977 +#: library/ast.rst:1033 +msgid "" +">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" +"Module(\n" +" body=[\n" +" Raise(\n" +" exc=Name(id='x', ctx=Load()),\n" +" cause=Name(id='y', ctx=Load()))])" +msgstr "" + +#: library/ast.rst:1045 msgid "" "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " "``msg`` holds the failure message." msgstr "" -#: library/ast.rst:993 +#: library/ast.rst:1048 +msgid "" +">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" +"Module(\n" +" body=[\n" +" Assert(\n" +" test=Name(id='x', ctx=Load()),\n" +" msg=Name(id='y', ctx=Load()))])" +msgstr "" + +#: library/ast.rst:1060 msgid "" "Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" "class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" -#: library/ast.rst:1011 +#: library/ast.rst:1063 +msgid "" +">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" +"Module(\n" +" body=[\n" +" Delete(\n" +" targets=[\n" +" Name(id='x', ctx=Del()),\n" +" Name(id='y', ctx=Del()),\n" +" Name(id='z', ctx=Del())])])" +msgstr "" + +#: library/ast.rst:1077 msgid "A ``pass`` statement." msgstr "" -#: library/ast.rst:1024 +#: library/ast.rst:1079 +msgid "" +">>> print(ast.dump(ast.parse('pass'), indent=4))\n" +"Module(\n" +" body=[\n" +" Pass()])" +msgstr "" + +#: library/ast.rst:1089 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " "statement. ``name`` is the name of the alias, ``type_params`` is a list of :" @@ -581,21 +1403,43 @@ msgid "" "type alias." msgstr "" -#: library/ast.rst:1042 +#: library/ast.rst:1094 +msgid "" +">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" +"Module(\n" +" body=[\n" +" TypeAlias(\n" +" name=Name(id='Alias', ctx=Store()),\n" +" value=Name(id='int', ctx=Load()))])" +msgstr "" + +#: library/ast.rst:1105 msgid "" "Other statements which are only applicable inside functions or loops are " "described in other sections." msgstr "" -#: library/ast.rst:1046 +#: library/ast.rst:1109 msgid "Imports" msgstr "" -#: library/ast.rst:1050 +#: library/ast.rst:1113 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "" -#: library/ast.rst:1067 +#: library/ast.rst:1115 +msgid "" +">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" +"Module(\n" +" body=[\n" +" Import(\n" +" names=[\n" +" alias(name='x'),\n" +" alias(name='y'),\n" +" alias(name='z')])])" +msgstr "" + +#: library/ast.rst:1129 msgid "" "Represents ``from x import y``. ``module`` is a raw string of the 'from' " "name, without any leading dots, or ``None`` for statements such as ``from . " @@ -603,36 +1447,91 @@ msgid "" "import (0 means absolute import)." msgstr "" -#: library/ast.rst:1089 +#: library/ast.rst:1134 +msgid "" +">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" +"Module(\n" +" body=[\n" +" ImportFrom(\n" +" module='y',\n" +" names=[\n" +" alias(name='x'),\n" +" alias(name='y'),\n" +" alias(name='z')],\n" +" level=0)])" +msgstr "" + +#: library/ast.rst:1150 msgid "" "Both parameters are raw strings of the names. ``asname`` can be ``None`` if " "the regular name is to be used." msgstr "" -#: library/ast.rst:1106 +#: library/ast.rst:1153 +msgid "" +">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" +"Module(\n" +" body=[\n" +" ImportFrom(\n" +" module='foo.bar',\n" +" names=[\n" +" alias(name='a', asname='b'),\n" +" alias(name='c')],\n" +" level=2)])" +msgstr "" + +#: library/ast.rst:1166 msgid "Control flow" msgstr "" -#: library/ast.rst:1109 +#: library/ast.rst:1169 msgid "" "Optional clauses such as ``else`` are stored as an empty list if they're not " "present." msgstr "" -#: library/ast.rst:1114 +#: library/ast.rst:1174 msgid "" "An ``if`` statement. ``test`` holds a single node, such as a :class:" "`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" -#: library/ast.rst:1117 +#: library/ast.rst:1177 msgid "" "``elif`` clauses don't have a special representation in the AST, but rather " "appear as extra :class:`If` nodes within the ``orelse`` section of the " "previous one." msgstr "" -#: library/ast.rst:1152 +#: library/ast.rst:1181 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... if x:\n" +"... ...\n" +"... elif y:\n" +"... ...\n" +"... else:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" If(\n" +" test=Name(id='x', ctx=Load()),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))],\n" +" orelse=[\n" +" If(\n" +" test=Name(id='y', ctx=Load()),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))],\n" +" orelse=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1211 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " "single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" @@ -642,30 +1541,162 @@ msgid "" "via a ``break`` statement." msgstr "" -#: library/ast.rst:1187 +#: library/ast.rst:1222 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... for x in y:\n" +"... ...\n" +"... else:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" For(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='y', ctx=Load()),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))],\n" +" orelse=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])" +msgstr "" + +#: library/ast.rst:1245 msgid "" "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " "node." msgstr "" -#: library/ast.rst:1214 +#: library/ast.rst:1248 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... while x:\n" +"... ...\n" +"... else:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" While(\n" +" test=Name(id='x', ctx=Load()),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))],\n" +" orelse=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])" +msgstr "" + +#: library/ast.rst:1271 msgid "The ``break`` and ``continue`` statements." msgstr "" -#: library/ast.rst:1249 +#: library/ast.rst:1273 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... for a in b:\n" +"... if a > 5:\n" +"... break\n" +"... else:\n" +"... continue\n" +"...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" For(\n" +" target=Name(id='a', ctx=Store()),\n" +" iter=Name(id='b', ctx=Load()),\n" +" body=[\n" +" If(\n" +" test=Compare(\n" +" left=Name(id='a', ctx=Load()),\n" +" ops=[\n" +" Gt()],\n" +" comparators=[\n" +" Constant(value=5)]),\n" +" body=[\n" +" Break()],\n" +" orelse=[\n" +" Continue()])])])" +msgstr "" + +#: library/ast.rst:1304 msgid "" "``try`` blocks. All attributes are list of nodes to execute, except for " "``handlers``, which is a list of :class:`ExceptHandler` nodes." msgstr "" -#: library/ast.rst:1295 +#: library/ast.rst:1307 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... try:\n" +"... ...\n" +"... except Exception:\n" +"... ...\n" +"... except OtherException as e:\n" +"... ...\n" +"... else:\n" +"... ...\n" +"... finally:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Try(\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))],\n" +" handlers=[\n" +" ExceptHandler(\n" +" type=Name(id='Exception', ctx=Load()),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))]),\n" +" ExceptHandler(\n" +" type=Name(id='OtherException', ctx=Load()),\n" +" name='e',\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])],\n" +" orelse=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))],\n" +" finalbody=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])" +msgstr "" + +#: library/ast.rst:1349 msgid "" "``try`` blocks which are followed by ``except*`` clauses. The attributes are " "the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " "``handlers`` are interpreted as ``except*`` blocks rather then ``except``." msgstr "" -#: library/ast.rst:1327 +#: library/ast.rst:1353 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... try:\n" +"... ...\n" +"... except* Exception:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" TryStar(\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))],\n" +" handlers=[\n" +" ExceptHandler(\n" +" type=Name(id='Exception', ctx=Load()),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1378 msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " @@ -673,14 +1704,38 @@ msgid "" "``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" -#: library/ast.rst:1361 +#: library/ast.rst:1383 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... try:\n" +"... a + 1\n" +"... except TypeError:\n" +"... pass\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Try(\n" +" body=[\n" +" Expr(\n" +" value=BinOp(\n" +" left=Name(id='a', ctx=Load()),\n" +" op=Add(),\n" +" right=Constant(value=1)))],\n" +" handlers=[\n" +" ExceptHandler(\n" +" type=Name(id='TypeError', ctx=Load()),\n" +" body=[\n" +" Pass()])])])" +msgstr "" + +#: library/ast.rst:1409 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " "the context." msgstr "" -#: library/ast.rst:1371 +#: library/ast.rst:1419 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " "context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" @@ -688,18 +1743,43 @@ msgid "" "if that isn't used." msgstr "" -#: library/ast.rst:1404 +#: library/ast.rst:1424 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... with a as b, c as d:\n" +"... something(b, d)\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" With(\n" +" items=[\n" +" withitem(\n" +" context_expr=Name(id='a', ctx=Load()),\n" +" optional_vars=Name(id='b', ctx=Store())),\n" +" withitem(\n" +" context_expr=Name(id='c', ctx=Load()),\n" +" optional_vars=Name(id='d', ctx=Store()))],\n" +" body=[\n" +" Expr(\n" +" value=Call(\n" +" func=Name(id='something', ctx=Load()),\n" +" args=[\n" +" Name(id='b', ctx=Load()),\n" +" Name(id='d', ctx=Load())]))])])" +msgstr "" + +#: library/ast.rst:1450 msgid "Pattern matching" msgstr "" -#: library/ast.rst:1409 +#: library/ast.rst:1455 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " "iterable of :class:`match_case` nodes with the different cases." msgstr "" -#: library/ast.rst:1417 +#: library/ast.rst:1463 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " "match pattern that the subject will be matched against. Note that the :class:" @@ -707,19 +1787,54 @@ msgid "" "expressions, even when they share the same syntax." msgstr "" -#: library/ast.rst:1422 +#: library/ast.rst:1468 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "" -#: library/ast.rst:1425 +#: library/ast.rst:1471 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." msgstr "" -#: library/ast.rst:1470 +#: library/ast.rst:1474 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case [x] if x>0:\n" +"... ...\n" +"... case tuple():\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchSequence(\n" +" patterns=[\n" +" MatchAs(name='x')]),\n" +" guard=Compare(\n" +" left=Name(id='x', ctx=Load()),\n" +" ops=[\n" +" Gt()],\n" +" comparators=[\n" +" Constant(value=0)]),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))]),\n" +" match_case(\n" +" pattern=MatchClass(\n" +" cls=Name(id='tuple', ctx=Load())),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1512 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -727,14 +1842,53 @@ msgid "" "equal to the evaluated value." msgstr "" -#: library/ast.rst:1499 +#: library/ast.rst:1517 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case \"Relevant\":\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchValue(\n" +" value=Constant(value='Relevant')),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1540 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " "pattern succeeds if the match subject is the given constant." msgstr "" -#: library/ast.rst:1526 +#: library/ast.rst:1544 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case None:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchSingleton(value=None),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1566 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -742,7 +1896,31 @@ msgid "" "otherwise matches a fixed length sequence." msgstr "" -#: library/ast.rst:1559 +#: library/ast.rst:1571 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case [1, 2]:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchSequence(\n" +" patterns=[\n" +" MatchValue(\n" +" value=Constant(value=1)),\n" +" MatchValue(\n" +" value=Constant(value=2))]),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1598 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -750,7 +1928,41 @@ msgid "" "successful." msgstr "" -#: library/ast.rst:1601 +#: library/ast.rst:1602 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case [1, 2, *rest]:\n" +"... ...\n" +"... case [*_]:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchSequence(\n" +" patterns=[\n" +" MatchValue(\n" +" value=Constant(value=1)),\n" +" MatchValue(\n" +" value=Constant(value=2)),\n" +" MatchStar(name='rest')]),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))]),\n" +" match_case(\n" +" pattern=MatchSequence(\n" +" patterns=[\n" +" MatchStar()]),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1639 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -759,7 +1971,7 @@ msgid "" "statement documentation." msgstr "" -#: library/ast.rst:1607 +#: library/ast.rst:1645 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -768,7 +1980,39 @@ msgid "" "overall mapping pattern is successful." msgstr "" -#: library/ast.rst:1649 +#: library/ast.rst:1651 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case {1: _, 2: _}:\n" +"... ...\n" +"... case {**rest}:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchMapping(\n" +" keys=[\n" +" Constant(value=1),\n" +" Constant(value=2)],\n" +" patterns=[\n" +" MatchAs(),\n" +" MatchAs()]),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))]),\n" +" match_case(\n" +" pattern=MatchMapping(rest='rest'),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1686 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -779,21 +2023,65 @@ msgid "" "pattern)." msgstr "" -#: library/ast.rst:1656 +#: library/ast.rst:1693 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " "and any specified keyword attributes match their corresponding pattern." msgstr "" -#: library/ast.rst:1660 +#: library/ast.rst:1697 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " "also matched that way, as described in the match statement documentation." msgstr "" -#: library/ast.rst:1715 +#: library/ast.rst:1701 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case Point2D(0, 0):\n" +"... ...\n" +"... case Point3D(x=0, y=0, z=0):\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchClass(\n" +" cls=Name(id='Point2D', ctx=Load()),\n" +" patterns=[\n" +" MatchValue(\n" +" value=Constant(value=0)),\n" +" MatchValue(\n" +" value=Constant(value=0))]),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))]),\n" +" match_case(\n" +" pattern=MatchClass(\n" +" cls=Name(id='Point3D', ctx=Load()),\n" +" kwd_attrs=[\n" +" 'x',\n" +" 'y',\n" +" 'z'],\n" +" kwd_patterns=[\n" +" MatchValue(\n" +" value=Constant(value=0)),\n" +" MatchValue(\n" +" value=Constant(value=0)),\n" +" MatchValue(\n" +" value=Constant(value=0))]),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1748 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -801,14 +2089,44 @@ msgid "" "and will always succeed." msgstr "" -#: library/ast.rst:1720 +#: library/ast.rst:1753 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " "and the node represents the wildcard pattern." msgstr "" -#: library/ast.rst:1758 +#: library/ast.rst:1757 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case [x] as y:\n" +"... ...\n" +"... case _:\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchAs(\n" +" pattern=MatchSequence(\n" +" patterns=[\n" +" MatchAs(name='x')]),\n" +" name='y'),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))]),\n" +" match_case(\n" +" pattern=MatchAs(),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1790 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -817,217 +2135,505 @@ msgid "" "matched against the subject." msgstr "" -#: library/ast.rst:1793 +#: library/ast.rst:1796 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\n" +"... match x:\n" +"... case [x] | (y):\n" +"... ...\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" Match(\n" +" subject=Name(id='x', ctx=Load()),\n" +" cases=[\n" +" match_case(\n" +" pattern=MatchOr(\n" +" patterns=[\n" +" MatchSequence(\n" +" patterns=[\n" +" MatchAs(name='x')]),\n" +" MatchAs(name='y')]),\n" +" body=[\n" +" Expr(\n" +" value=Constant(value=Ellipsis))])])])" +msgstr "" + +#: library/ast.rst:1823 +msgid "Type annotations" +msgstr "" + +#: library/ast.rst:1827 +msgid "" +"A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag " +"specified by the form ``# type: ignore ``." +msgstr "" + +#: library/ast.rst:1830 +msgid "" +">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " +"indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1))],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='')])\n" +">>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', " +"type_comments=True), indent=4))\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='x', ctx=Store()),\n" +" annotation=Name(id='bool', ctx=Load()),\n" +" value=Constant(value=1),\n" +" simple=1)],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='[assignment]')])" +msgstr "" + +#: library/ast.rst:1853 +msgid "" +":class:`!TypeIgnore` nodes are not generated when the *type_comments* " +"parameter is set to ``False`` (default). See :func:`ast.parse` for more " +"details." +msgstr "" + +#: library/ast.rst:1861 msgid "Type parameters" msgstr "" -#: library/ast.rst:1795 +#: library/ast.rst:1863 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr "" -#: library/ast.rst:1800 +#: library/ast.rst:1868 msgid "" "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " "``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" -"`Tuple`, it represents constraints; otherwise it represents the bound." +"`Tuple`, it represents constraints; otherwise it represents the bound. " +"``default_value`` is the default value; if the :class:`!TypeVar` has no " +"default, this attribute will be set to ``None``." msgstr "" -#: library/ast.rst:1825 +#: library/ast.rst:1874 msgid "" -"A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " -"specification." +">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " +"indent=4))\n" +"Module(\n" +" body=[\n" +" TypeAlias(\n" +" name=Name(id='Alias', ctx=Store()),\n" +" type_params=[\n" +" TypeVar(\n" +" name='T',\n" +" bound=Name(id='int', ctx=Load()),\n" +" default_value=Name(id='bool', ctx=Load()))],\n" +" value=Subscript(\n" +" value=Name(id='list', ctx=Load()),\n" +" slice=Name(id='T', ctx=Load()),\n" +" ctx=Load()))])" +msgstr "" + +#: library/ast.rst:1928 library/ast.rst:1960 +msgid "Added the *default_value* parameter." msgstr "" -#: library/ast.rst:1850 +#: library/ast.rst:1898 +msgid "" +"A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " +"specification. ``default_value`` is the default value; if the :class:`!" +"ParamSpec` has no default, this attribute will be set to ``None``." +msgstr "" + +#: library/ast.rst:1902 +msgid "" +">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " +"int]\"), indent=4))\n" +"Module(\n" +" body=[\n" +" TypeAlias(\n" +" name=Name(id='Alias', ctx=Store()),\n" +" type_params=[\n" +" ParamSpec(\n" +" name='P',\n" +" default_value=List(\n" +" elts=[\n" +" Name(id='int', ctx=Load()),\n" +" Name(id='str', ctx=Load())],\n" +" ctx=Load()))],\n" +" value=Subscript(\n" +" value=Name(id='Callable', ctx=Load()),\n" +" slice=Tuple(\n" +" elts=[\n" +" Name(id='P', ctx=Load()),\n" +" Name(id='int', ctx=Load())],\n" +" ctx=Load()),\n" +" ctx=Load()))])" +msgstr "" + +#: library/ast.rst:1933 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " -"tuple." +"tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " +"has no default, this attribute will be set to ``None``." msgstr "" -#: library/ast.rst:1875 +#: library/ast.rst:1937 +msgid "" +">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " +"indent=4))\n" +"Module(\n" +" body=[\n" +" TypeAlias(\n" +" name=Name(id='Alias', ctx=Store()),\n" +" type_params=[\n" +" TypeVarTuple(\n" +" name='Ts',\n" +" default_value=Tuple(ctx=Load()))],\n" +" value=Subscript(\n" +" value=Name(id='tuple', ctx=Load()),\n" +" slice=Tuple(\n" +" elts=[\n" +" Starred(\n" +" value=Name(id='Ts', ctx=Load()),\n" +" ctx=Load())],\n" +" ctx=Load()),\n" +" ctx=Load()))])" +msgstr "" + +#: library/ast.rst:1964 msgid "Function and class definitions" msgstr "" -#: library/ast.rst:1879 +#: library/ast.rst:1968 msgid "A function definition." msgstr "" -#: library/ast.rst:1881 +#: library/ast.rst:1970 msgid "``name`` is a raw string of the function name." msgstr "" -#: library/ast.rst:1882 +#: library/ast.rst:1971 msgid "``args`` is an :class:`arguments` node." msgstr "" -#: library/ast.rst:1883 +#: library/ast.rst:1972 msgid "``body`` is the list of nodes inside the function." msgstr "" -#: library/ast.rst:1884 +#: library/ast.rst:1973 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." msgstr "" -#: library/ast.rst:1886 +#: library/ast.rst:1975 msgid "``returns`` is the return annotation." msgstr "" -#: library/ast.rst:2064 +#: library/ast.rst:2139 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "" -#: library/ast.rst:2093 library/ast.rst:2104 +#: library/ast.rst:2166 library/ast.rst:2177 msgid "Added ``type_params``." msgstr "" -#: library/ast.rst:1899 +#: library/ast.rst:1988 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." msgstr "" -#: library/ast.rst:1923 +#: library/ast.rst:1991 +msgid "" +">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" +"Module(\n" +" body=[\n" +" Expr(\n" +" value=Lambda(\n" +" args=arguments(\n" +" args=[\n" +" arg(arg='x'),\n" +" arg(arg='y')]),\n" +" body=Constant(value=Ellipsis)))])" +msgstr "" + +#: library/ast.rst:2007 msgid "The arguments for a function." msgstr "" -#: library/ast.rst:1925 +#: library/ast.rst:2009 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" -#: library/ast.rst:1926 +#: library/ast.rst:2010 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." msgstr "" -#: library/ast.rst:1928 +#: library/ast.rst:2012 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." msgstr "" -#: library/ast.rst:1930 +#: library/ast.rst:2014 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " "arguments." msgstr "" -#: library/ast.rst:1937 +#: library/ast.rst:2021 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." msgstr "" -#: library/ast.rst:1942 +#: library/ast.rst:2026 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "" -#: library/ast.rst:1987 +#: library/ast.rst:2028 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... @decorator1\n" +"... @decorator2\n" +"... def f(a: 'annotation', b=1, c=2, *d, e, f=3, **g) -> 'return " +"annotation':\n" +"... pass\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" FunctionDef(\n" +" name='f',\n" +" args=arguments(\n" +" args=[\n" +" arg(\n" +" arg='a',\n" +" annotation=Constant(value='annotation')),\n" +" arg(arg='b'),\n" +" arg(arg='c')],\n" +" vararg=arg(arg='d'),\n" +" kwonlyargs=[\n" +" arg(arg='e'),\n" +" arg(arg='f')],\n" +" kw_defaults=[\n" +" None,\n" +" Constant(value=3)],\n" +" kwarg=arg(arg='g'),\n" +" defaults=[\n" +" Constant(value=1),\n" +" Constant(value=2)]),\n" +" body=[\n" +" Pass()],\n" +" decorator_list=[\n" +" Name(id='decorator1', ctx=Load()),\n" +" Name(id='decorator2', ctx=Load())],\n" +" returns=Constant(value='return annotation'))])" +msgstr "" + +#: library/ast.rst:2068 msgid "A ``return`` statement." msgstr "" -#: library/ast.rst:2002 +#: library/ast.rst:2070 +msgid "" +">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" +"Module(\n" +" body=[\n" +" Return(\n" +" value=Constant(value=4))])" +msgstr "" + +#: library/ast.rst:2082 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " -"they must be wrapped in a :class:`Expr` node if the value sent back is not " +"they must be wrapped in an :class:`Expr` node if the value sent back is not " "used." msgstr "" -#: library/ast.rst:2027 +#: library/ast.rst:2085 +msgid "" +">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" +"Module(\n" +" body=[\n" +" Expr(\n" +" value=Yield(\n" +" value=Name(id='x', ctx=Load())))])\n" +"\n" +">>> print(ast.dump(ast.parse('yield from x'), indent=4))\n" +"Module(\n" +" body=[\n" +" Expr(\n" +" value=YieldFrom(\n" +" value=Name(id='x', ctx=Load())))])" +msgstr "" + +#: library/ast.rst:2105 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "" -#: library/ast.rst:2054 +#: library/ast.rst:2107 +msgid "" +">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" +"Module(\n" +" body=[\n" +" Global(\n" +" names=[\n" +" 'x',\n" +" 'y',\n" +" 'z'])])\n" +"\n" +">>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))\n" +"Module(\n" +" body=[\n" +" Nonlocal(\n" +" names=[\n" +" 'x',\n" +" 'y',\n" +" 'z'])])" +msgstr "" + +#: library/ast.rst:2130 msgid "A class definition." msgstr "" -#: library/ast.rst:2056 +#: library/ast.rst:2132 msgid "``name`` is a raw string for the class name" msgstr "" -#: library/ast.rst:2057 +#: library/ast.rst:2133 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "" -#: library/ast.rst:2058 +#: library/ast.rst:2134 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " -"'metaclass'. Other keywords will be passed to the metaclass, as per " -"`PEP-3115 `_." +"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" +"`3115`." msgstr "" -#: library/ast.rst:2061 +#: library/ast.rst:2136 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "" -#: library/ast.rst:2063 +#: library/ast.rst:2138 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "" -#: library/ast.rst:2097 +#: library/ast.rst:2141 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... @decorator1\n" +"... @decorator2\n" +"... class Foo(base1, base2, metaclass=meta):\n" +"... pass\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" ClassDef(\n" +" name='Foo',\n" +" bases=[\n" +" Name(id='base1', ctx=Load()),\n" +" Name(id='base2', ctx=Load())],\n" +" keywords=[\n" +" keyword(\n" +" arg='metaclass',\n" +" value=Name(id='meta', ctx=Load()))],\n" +" body=[\n" +" Pass()],\n" +" decorator_list=[\n" +" Name(id='decorator1', ctx=Load()),\n" +" Name(id='decorator2', ctx=Load())])])" +msgstr "" + +#: library/ast.rst:2170 msgid "Async and await" msgstr "" -#: library/ast.rst:2101 +#: library/ast.rst:2174 msgid "" "An ``async def`` function definition. Has the same fields as :class:" "`FunctionDef`." msgstr "" -#: library/ast.rst:2110 +#: library/ast.rst:2183 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -#: library/ast.rst:2144 +#: library/ast.rst:2186 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... async def f():\n" +"... await other_func()\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" AsyncFunctionDef(\n" +" name='f',\n" +" args=arguments(),\n" +" body=[\n" +" Expr(\n" +" value=Await(\n" +" value=Call(\n" +" func=Name(id='other_func', ctx=Load()))))])])" +msgstr "" + +#: library/ast.rst:2207 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -#: library/ast.rst:2149 +#: library/ast.rst:2212 msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" "class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." "boolop` and :class:`ast.expr_context`) on the returned tree will be " "singletons. Changes to one will be reflected in all other occurrences of the " -"same value (e.g. :class:`ast.Add`)." +"same value (for example, :class:`ast.Add`)." msgstr "" -#: library/ast.rst:2157 -msgid ":mod:`ast` Helpers" +#: library/ast.rst:2220 +msgid ":mod:`ast` helpers" msgstr "" -#: library/ast.rst:2159 +#: library/ast.rst:2222 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" msgstr "" -#: library/ast.rst:2164 +#: library/ast.rst:2227 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " -"filename, mode, ast.PyCF_ONLY_AST)``." +"filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." +"PyCF_OPTIMIZED_AST`` otherwise." msgstr "" -#: library/ast.rst:2167 +#: library/ast.rst:2232 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " "equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :" -"func:`compile()`. This will report syntax errors for misplaced type " +"func:`compile`. This will report syntax errors for misplaced type " "comments. Without this flag, type comments will be ignored, and the " "``type_comment`` field on selected AST nodes will always be ``None``. In " "addition, the locations of ``# type: ignore`` comments will be returned as " @@ -1035,32 +2641,32 @@ msgid "" "empty list)." msgstr "" -#: library/ast.rst:2177 +#: library/ast.rst:2242 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " "List[str]``." msgstr "" -#: library/ast.rst:2181 +#: library/ast.rst:2246 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " "example, setting ``feature_version=(3, 9)`` will attempt to disallow parsing " "of :keyword:`match` statements. Currently ``major`` must equal to ``3``. The " -"lowest supported version is ``(3, 4)`` (and this may increase in future " +"lowest supported version is ``(3, 7)`` (and this may increase in future " "Python versions); the highest is ``sys.version_info[0:2]``. \"Best-effort\" " "attempt means there is no guarantee that the parse (or success of the parse) " "is the same as when run on the Python version corresponding to " "``feature_version``." msgstr "" -#: library/ast.rst:2191 +#: library/ast.rst:2256 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "" -#: library/ast.rst:2194 +#: library/ast.rst:2259 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -1070,43 +2676,49 @@ msgid "" "inside a function node)." msgstr "" -#: library/ast.rst:2201 +#: library/ast.rst:2266 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" -#: library/ast.rst:2205 +#: library/ast.rst:2270 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." msgstr "" -#: library/ast.rst:2209 +#: library/ast.rst:2274 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "" -#: library/ast.rst:2215 +#: library/ast.rst:2277 +msgid "" +"The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " +"``optimize`` argument was added." +msgstr "" + +#: library/ast.rst:2284 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " "would produce an equivalent :class:`ast.AST` object if parsed back with :" "func:`ast.parse`." msgstr "" -#: library/ast.rst:2220 +#: library/ast.rst:2289 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " "optimizations, such as constant tuples/frozensets)." msgstr "" -#: library/ast.rst:2225 +#: library/ast.rst:2294 msgid "" "Trying to unparse a highly complex expression would result with :exc:" "`RecursionError`." msgstr "" -#: library/ast.rst:2233 +#: library/ast.rst:2302 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -1114,14 +2726,14 @@ msgid "" "dicts, sets, booleans, ``None`` and ``Ellipsis``." msgstr "" -#: library/ast.rst:2238 +#: library/ast.rst:2307 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " "arbitrarily complex expressions, for example involving operators or indexing." msgstr "" -#: library/ast.rst:2243 +#: library/ast.rst:2312 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -1133,31 +2745,31 @@ msgid "" "untrusted data is thus not recommended." msgstr "" -#: library/ast.rst:2253 +#: library/ast.rst:2322 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "" -#: library/ast.rst:2256 +#: library/ast.rst:2325 msgid "" "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" "`MemoryError` and :exc:`RecursionError` depending on the malformed input." msgstr "" -#: library/ast.rst:2260 +#: library/ast.rst:2329 msgid "Now allows bytes and set literals." msgstr "" -#: library/ast.rst:2263 +#: library/ast.rst:2332 msgid "Now supports creating empty sets with ``'set()'``." msgstr "" -#: library/ast.rst:2266 +#: library/ast.rst:2335 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "" -#: library/ast.rst:2272 +#: library/ast.rst:2341 msgid "" "Return the docstring of the given *node* (which must be a :class:" "`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" @@ -1165,11 +2777,11 @@ msgid "" "clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -#: library/ast.rst:2278 +#: library/ast.rst:2347 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "" -#: library/ast.rst:2284 +#: library/ast.rst:2353 msgid "" "Get source code segment of the *source* that generated *node*. If some " "location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" @@ -1177,13 +2789,13 @@ msgid "" "return ``None``." msgstr "" -#: library/ast.rst:2288 +#: library/ast.rst:2357 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." msgstr "" -#: library/ast.rst:2296 +#: library/ast.rst:2365 msgid "" "When you compile a node tree with :func:`compile`, the compiler expects :" "attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " @@ -1193,81 +2805,81 @@ msgid "" "starting at *node*." msgstr "" -#: library/ast.rst:2305 +#: library/ast.rst:2374 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " "location in a file." msgstr "" -#: library/ast.rst:2312 +#: library/ast.rst:2381 msgid "" "Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" "attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " "*old_node* to *new_node* if possible, and return *new_node*." msgstr "" -#: library/ast.rst:2319 +#: library/ast.rst:2388 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." msgstr "" -#: library/ast.rst:2325 +#: library/ast.rst:2394 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." msgstr "" -#: library/ast.rst:2331 +#: library/ast.rst:2400 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " "only want to modify nodes in place and don't care about the context." msgstr "" -#: library/ast.rst:2338 +#: library/ast.rst:2407 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " "which is forwarded by the :meth:`visit` method." msgstr "" -#: library/ast.rst:2342 +#: library/ast.rst:2411 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "" -#: library/ast.rst:2347 +#: library/ast.rst:2416 msgid "" "Visit a node. The default implementation calls the method called :samp:" "`self.visit_{classname}` where *classname* is the name of the node class, " "or :meth:`generic_visit` if that method doesn't exist." msgstr "" -#: library/ast.rst:2353 +#: library/ast.rst:2422 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "" -#: library/ast.rst:2355 +#: library/ast.rst:2424 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." msgstr "" -#: library/ast.rst:2361 +#: library/ast.rst:2430 msgid "Handles all constant nodes." msgstr "" -#: library/ast.rst:2363 +#: library/ast.rst:2432 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " "during traversal. For this a special visitor exists (:class:" "`NodeTransformer`) that allows modifications." msgstr "" -#: library/ast.rst:2369 +#: library/ast.rst:2438 msgid "" "Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" "`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " @@ -1275,13 +2887,13 @@ msgid "" "`visit_Constant` method to handle all constant nodes." msgstr "" -#: library/ast.rst:2377 +#: library/ast.rst:2446 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "" -#: library/ast.rst:2380 +#: library/ast.rst:2449 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -1290,27 +2902,39 @@ msgid "" "may be the original node in which case no replacement takes place." msgstr "" -#: library/ast.rst:2386 +#: library/ast.rst:2455 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" msgstr "" -#: library/ast.rst:2398 +#: library/ast.rst:2458 +msgid "" +"class RewriteName(NodeTransformer):\n" +"\n" +" def visit_Name(self, node):\n" +" return Subscript(\n" +" value=Name(id='data', ctx=Load()),\n" +" slice=Constant(value=node.id),\n" +" ctx=node.ctx\n" +" )" +msgstr "" + +#: library/ast.rst:2467 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " "either transform the child nodes yourself or call the :meth:`~ast." "NodeVisitor.generic_visit` method for the node first." msgstr "" -#: library/ast.rst:2402 +#: library/ast.rst:2471 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " "just a single node." msgstr "" -#: library/ast.rst:2406 +#: library/ast.rst:2475 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " "original tree) without giving them location information (such as :attr:`~ast." @@ -1318,11 +2942,21 @@ msgid "" "sub-tree to recalculate the location information::" msgstr "" -#: library/ast.rst:2414 +#: library/ast.rst:2480 +msgid "" +"tree = ast.parse('foo', mode='eval')\n" +"new_tree = fix_missing_locations(RewriteName().visit(tree))" +msgstr "" + +#: library/ast.rst:2483 msgid "Usually you use the transformer like this::" msgstr "" -#: library/ast.rst:2421 +#: library/ast.rst:2485 +msgid "node = YourTransformer().visit(node)" +msgstr "" + +#: library/ast.rst:2490 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -1333,7 +2967,7 @@ msgid "" "true." msgstr "" -#: library/ast.rst:2429 +#: library/ast.rst:2498 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -1343,87 +2977,164 @@ msgid "" "string is used to indent each level." msgstr "" -#: library/ast.rst:2436 +#: library/ast.rst:2505 +msgid "" +"If *show_empty* is false (the default), optional empty lists will be omitted " +"from the output. Optional ``None`` values are always omitted." +msgstr "" + +#: library/ast.rst:2509 msgid "Added the *indent* option." msgstr "" -#: library/ast.rst:2443 -msgid "Compiler Flags" +#: library/ast.rst:2512 +msgid "Added the *show_empty* option." msgstr "" -#: library/ast.rst:2445 +#: library/ast.rst:2515 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... async def f():\n" +"... await other_func()\n" +"... \"\"\"), indent=4, show_empty=True))\n" +"Module(\n" +" body=[\n" +" AsyncFunctionDef(\n" +" name='f',\n" +" args=arguments(\n" +" posonlyargs=[],\n" +" args=[],\n" +" kwonlyargs=[],\n" +" kw_defaults=[],\n" +" defaults=[]),\n" +" body=[\n" +" Expr(\n" +" value=Await(\n" +" value=Call(\n" +" func=Name(id='other_func', ctx=Load()),\n" +" args=[],\n" +" keywords=[])))],\n" +" decorator_list=[],\n" +" type_params=[])],\n" +" type_ignores=[])" +msgstr "" + +#: library/ast.rst:2546 +msgid "Compiler flags" +msgstr "" + +#: library/ast.rst:2548 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "" -#: library/ast.rst:2450 +#: library/ast.rst:2553 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." msgstr "" -#: library/ast.rst:2457 +#: library/ast.rst:2560 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "" -#: library/ast.rst:2462 +#: library/ast.rst:2565 +msgid "" +"The returned AST is optimized according to the *optimize* argument in :func:" +"`compile` or :func:`ast.parse`." +msgstr "" + +#: library/ast.rst:2572 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." msgstr "" -#: library/ast.rst:2471 -msgid "Command-Line Usage" +#: library/ast.rst:2580 +msgid "Recursively compares two ASTs." msgstr "" -#: library/ast.rst:2475 +#: library/ast.rst:2582 +msgid "" +"*compare_attributes* affects whether AST attributes are considered in the " +"comparison. If *compare_attributes* is ``False`` (default), then attributes " +"are ignored. Otherwise they must all be equal. This option is useful to " +"check whether the ASTs are structurally equal but differ in whitespace or " +"similar details. Attributes include line numbers and column offsets." +msgstr "" + +#: library/ast.rst:2595 +msgid "Command-line usage" +msgstr "" + +#: library/ast.rst:2599 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr "" -#: library/ast.rst:2482 +#: library/ast.rst:2602 +msgid "python -m ast [-m ] [-a] [infile]" +msgstr "" + +#: library/ast.rst:2606 msgid "The following options are accepted:" msgstr "" -#: library/ast.rst:2488 +#: library/ast.rst:2612 msgid "Show the help message and exit." msgstr "" -#: library/ast.rst:2493 +#: library/ast.rst:2617 msgid "" "Specify what kind of code must be compiled, like the *mode* argument in :" "func:`parse`." msgstr "" -#: library/ast.rst:2498 +#: library/ast.rst:2622 msgid "Don't parse type comments." msgstr "" -#: library/ast.rst:2502 +#: library/ast.rst:2626 msgid "Include attributes such as line numbers and column offsets." msgstr "" -#: library/ast.rst:2507 +#: library/ast.rst:2631 msgid "Indentation of nodes in AST (number of spaces)." msgstr "" -#: library/ast.rst:2509 +#: library/ast.rst:2635 +msgid "" +"Python version in the format 3.x (for example, 3.10). Defaults to the " +"current version of the interpreter." +msgstr "" + +#: library/ast.rst:2643 +msgid "Optimization level for parser. Defaults to no optimization." +msgstr "" + +#: library/ast.rst:2649 +msgid "" +"Show empty lists and fields that are ``None``. Defaults to not showing empty " +"objects." +msgstr "" + +#: library/ast.rst:2655 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." msgstr "" -#: library/ast.rst:2515 +#: library/ast.rst:2661 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." msgstr "" -#: library/ast.rst:2518 +#: library/ast.rst:2664 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -1431,26 +3142,26 @@ msgid "" "transformations." msgstr "" -#: library/ast.rst:2523 +#: library/ast.rst:2669 msgid "" -"`leoAst.py `_ unifies the " -"token-based and parse-tree-based views of python programs by inserting two-" -"way links between tokens and ast nodes." +"`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " +"by inserting two-way links between tokens and ast nodes." msgstr "" -#: library/ast.rst:2527 +#: library/ast.rst:2674 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " "useful for building automated refactoring (codemod) applications and linters." msgstr "" -#: library/ast.rst:2532 +#: library/ast.rst:2679 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " "multiple Python versions). Parso is also able to list multiple syntax errors " -"in your python file." +"in your Python file." msgstr "" #: library/ast.rst:59 diff --git a/library/asynchat.po b/library/asynchat.po new file mode 100644 index 00000000..f547e783 --- /dev/null +++ b/library/asynchat.po @@ -0,0 +1,45 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-20 17:00+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/asynchat.rst:2 +msgid ":mod:`!asynchat` --- Asynchronous socket command/response handler" +msgstr "" +":mod:`!asynchat` --- Διαχειριστής εντολών/απαντήσεων ασύγχρονων υποδοχών" + +#: library/asynchat.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being deprecated in " +"Python 3.6. The removal was decided in :pep:`594`." +msgstr "" +"Αυτό το module δεν αποτελεί πλέον μέρος της βασικής βιβλιοθήκης της Python. " +"Αφαιρέθηκε στην έκδοση :ref:`Python 3.12 ` αφού είχε " +"ήδη καταργηθεί στην Python 3.6. Η αφαίρεση αποφασίστηκε στο :pep:`594`." + +#: library/asynchat.rst:14 +msgid "Applications should use the :mod:`asyncio` module instead." +msgstr "Οι εφαρμογές θα πρέπει να χρησιμοποιούν το module :mod:`asyncio`." + +#: library/asynchat.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!asynchat` module was " +"`Python 3.11 `_." +msgstr "" +"Η τελευταία έκδοση της Python που περιλάμβανε το module :mod:`!asynchat` " +"ήταν η `Python 3.11 `_." diff --git a/library/asyncio-api-index.po b/library/asyncio-api-index.po index de3437e6..d40f6634 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index 768135b1..97b1ee18 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -72,6 +73,10 @@ msgid "" "at startup of the application::" msgstr "" +#: library/asyncio-dev.rst:40 +msgid "logging.basicConfig(level=logging.DEBUG)" +msgstr "" + #: library/asyncio-dev.rst:42 msgid "" "configuring the :mod:`warnings` module to display :exc:`ResourceWarning` " @@ -85,36 +90,29 @@ msgstr "" #: library/asyncio-dev.rst:49 msgid "" -"asyncio checks for :ref:`coroutines that were not awaited ` and logs them; this mitigates the \"forgotten await\" " -"pitfall." -msgstr "" - -#: library/asyncio-dev.rst:53 -msgid "" "Many non-threadsafe asyncio APIs (such as :meth:`loop.call_soon` and :meth:" "`loop.call_at` methods) raise an exception if they are called from a wrong " "thread." msgstr "" -#: library/asyncio-dev.rst:57 +#: library/asyncio-dev.rst:53 msgid "" "The execution time of the I/O selector is logged if it takes too long to " "perform an I/O operation." msgstr "" -#: library/asyncio-dev.rst:60 +#: library/asyncio-dev.rst:56 msgid "" "Callbacks taking longer than 100 milliseconds are logged. The :attr:`loop." "slow_callback_duration` attribute can be used to set the minimum execution " "duration in seconds that is considered \"slow\"." msgstr "" -#: library/asyncio-dev.rst:68 +#: library/asyncio-dev.rst:64 msgid "Concurrency and Multithreading" msgstr "" -#: library/asyncio-dev.rst:70 +#: library/asyncio-dev.rst:66 msgid "" "An event loop runs in a thread (typically the main thread) and executes all " "callbacks and Tasks in its thread. While a Task is running in the event " @@ -123,13 +121,17 @@ msgid "" "executes the next Task." msgstr "" -#: library/asyncio-dev.rst:76 +#: library/asyncio-dev.rst:72 msgid "" "To schedule a :term:`callback` from another OS thread, the :meth:`loop." "call_soon_threadsafe` method should be used. Example::" msgstr "" -#: library/asyncio-dev.rst:81 +#: library/asyncio-dev.rst:75 +msgid "loop.call_soon_threadsafe(callback, *args)" +msgstr "" + +#: library/asyncio-dev.rst:77 msgid "" "Almost all asyncio objects are not thread safe, which is typically not a " "problem unless there is code that works with them from outside of a Task or " @@ -137,26 +139,42 @@ msgid "" "API, the :meth:`loop.call_soon_threadsafe` method should be used, e.g.::" msgstr "" -#: library/asyncio-dev.rst:89 +#: library/asyncio-dev.rst:83 +msgid "loop.call_soon_threadsafe(fut.cancel)" +msgstr "" + +#: library/asyncio-dev.rst:85 msgid "" "To schedule a coroutine object from a different OS thread, the :func:" "`run_coroutine_threadsafe` function should be used. It returns a :class:" "`concurrent.futures.Future` to access the result::" msgstr "" -#: library/asyncio-dev.rst:102 +#: library/asyncio-dev.rst:89 +msgid "" +"async def coro_func():\n" +" return await asyncio.sleep(1, 42)\n" +"\n" +"# Later in another OS thread:\n" +"\n" +"future = asyncio.run_coroutine_threadsafe(coro_func(), loop)\n" +"# Wait for the result:\n" +"result = future.result()" +msgstr "" + +#: library/asyncio-dev.rst:98 msgid "To handle signals the event loop must be run in the main thread." msgstr "" -#: library/asyncio-dev.rst:105 +#: library/asyncio-dev.rst:101 msgid "" "The :meth:`loop.run_in_executor` method can be used with a :class:" -"`concurrent.futures.ThreadPoolExecutor` to execute blocking code in a " -"different OS thread without blocking the OS thread that the event loop runs " -"in." +"`concurrent.futures.ThreadPoolExecutor` or :class:`~concurrent.futures." +"InterpreterPoolExecutor` to execute blocking code in a different OS thread " +"without blocking the OS thread that the event loop runs in." msgstr "" -#: library/asyncio-dev.rst:110 +#: library/asyncio-dev.rst:107 msgid "" "There is currently no way to schedule coroutines or callbacks directly from " "a different process (such as one started with :mod:`multiprocessing`). The :" @@ -169,77 +187,121 @@ msgid "" "different process." msgstr "" -#: library/asyncio-dev.rst:124 +#: library/asyncio-dev.rst:121 msgid "Running Blocking Code" msgstr "" -#: library/asyncio-dev.rst:126 +#: library/asyncio-dev.rst:123 msgid "" "Blocking (CPU-bound) code should not be called directly. For example, if a " "function performs a CPU-intensive calculation for 1 second, all concurrent " "asyncio Tasks and IO operations would be delayed by 1 second." msgstr "" -#: library/asyncio-dev.rst:131 +#: library/asyncio-dev.rst:128 msgid "" -"An executor can be used to run a task in a different thread or even in a " -"different process to avoid blocking the OS thread with the event loop. See " -"the :meth:`loop.run_in_executor` method for more details." +"An executor can be used to run a task in a different thread, including in a " +"different interpreter, or even in a different process to avoid blocking the " +"OS thread with the event loop. See the :meth:`loop.run_in_executor` method " +"for more details." msgstr "" -#: library/asyncio-dev.rst:140 +#: library/asyncio-dev.rst:138 msgid "Logging" msgstr "" -#: library/asyncio-dev.rst:142 +#: library/asyncio-dev.rst:140 msgid "" "asyncio uses the :mod:`logging` module and all logging is performed via the " "``\"asyncio\"`` logger." msgstr "" -#: library/asyncio-dev.rst:145 +#: library/asyncio-dev.rst:143 msgid "" "The default log level is :py:const:`logging.INFO`, which can be easily " "adjusted::" msgstr "" -#: library/asyncio-dev.rst:151 +#: library/asyncio-dev.rst:146 +msgid "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)" +msgstr "" + +#: library/asyncio-dev.rst:149 msgid "" "Network logging can block the event loop. It is recommended to use a " "separate thread for handling logs or use non-blocking IO. For example, see :" "ref:`blocking-handlers`." msgstr "" -#: library/asyncio-dev.rst:159 +#: library/asyncio-dev.rst:157 msgid "Detect never-awaited coroutines" msgstr "" -#: library/asyncio-dev.rst:161 +#: library/asyncio-dev.rst:159 msgid "" "When a coroutine function is called, but not awaited (e.g. ``coro()`` " "instead of ``await coro()``) or the coroutine is not scheduled with :meth:" "`asyncio.create_task`, asyncio will emit a :exc:`RuntimeWarning`::" msgstr "" -#: library/asyncio-dev.rst:221 +#: library/asyncio-dev.rst:164 +msgid "" +"import asyncio\n" +"\n" +"async def test():\n" +" print(\"never scheduled\")\n" +"\n" +"async def main():\n" +" test()\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-dev.rst:219 msgid "Output::" msgstr "" -#: library/asyncio-dev.rst:237 +#: library/asyncio-dev.rst:176 +msgid "" +"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" +" test()" +msgstr "" + +#: library/asyncio-dev.rst:235 msgid "Output in debug mode::" msgstr "" -#: library/asyncio-dev.rst:194 +#: library/asyncio-dev.rst:181 +msgid "" +"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" +"Coroutine created at (most recent call last)\n" +" File \"../t.py\", line 9, in \n" +" asyncio.run(main(), debug=True)\n" +"\n" +" < .. >\n" +"\n" +" File \"../t.py\", line 7, in main\n" +" test()\n" +" test()" +msgstr "" + +#: library/asyncio-dev.rst:192 msgid "" "The usual fix is to either await the coroutine or call the :meth:`asyncio." "create_task` function::" msgstr "" -#: library/asyncio-dev.rst:202 +#: library/asyncio-dev.rst:195 +msgid "" +"async def main():\n" +" await test()" +msgstr "" + +#: library/asyncio-dev.rst:200 msgid "Detect never-retrieved exceptions" msgstr "" -#: library/asyncio-dev.rst:204 +#: library/asyncio-dev.rst:202 msgid "" "If a :meth:`Future.set_exception` is called but the Future object is never " "awaited on, the exception would never be propagated to the user code. In " @@ -247,12 +309,59 @@ msgid "" "garbage collected." msgstr "" -#: library/asyncio-dev.rst:209 +#: library/asyncio-dev.rst:207 msgid "Example of an unhandled exception::" msgstr "" -#: library/asyncio-dev.rst:232 +#: library/asyncio-dev.rst:209 +msgid "" +"import asyncio\n" +"\n" +"async def bug():\n" +" raise Exception(\"not consumed\")\n" +"\n" +"async def main():\n" +" asyncio.create_task(bug())\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-dev.rst:221 +msgid "" +"Task exception was never retrieved\n" +"future: \n" +" exception=Exception('not consumed')>\n" +"\n" +"Traceback (most recent call last):\n" +" File \"test.py\", line 4, in bug\n" +" raise Exception(\"not consumed\")\n" +"Exception: not consumed" +msgstr "" + +#: library/asyncio-dev.rst:230 msgid "" ":ref:`Enable the debug mode ` to get the traceback where " "the task was created::" msgstr "" + +#: library/asyncio-dev.rst:233 +msgid "asyncio.run(main(), debug=True)" +msgstr "" + +#: library/asyncio-dev.rst:237 +msgid "" +"Task exception was never retrieved\n" +"future: \n" +" exception=Exception('not consumed') created at asyncio/tasks.py:321>\n" +"\n" +"source_traceback: Object created at (most recent call last):\n" +" File \"../t.py\", line 9, in \n" +" asyncio.run(main(), debug=True)\n" +"\n" +"< .. >\n" +"\n" +"Traceback (most recent call last):\n" +" File \"../t.py\", line 4, in bug\n" +" raise Exception(\"not consumed\")\n" +"Exception: not consumed" +msgstr "" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index eaaa3707..9b3e405d 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -99,103 +100,109 @@ msgid "" msgstr "" #: library/asyncio-eventloop.rst:62 +msgid "Raises a :exc:`RuntimeError` if there is no current event loop." +msgstr "" + +#: library/asyncio-eventloop.rst:67 msgid "" -"Deprecation warning is emitted if there is no current event loop. In some " -"future Python release this will become an error." +"The :mod:`!asyncio` policy system is deprecated and will be removed in " +"Python 3.16; from there on, this function will return the current running " +"event loop if present else it will return the loop set by :func:" +"`set_event_loop`." msgstr "" -#: library/asyncio-eventloop.rst:68 +#: library/asyncio-eventloop.rst:74 msgid "Set *loop* as the current event loop for the current OS thread." msgstr "" -#: library/asyncio-eventloop.rst:72 +#: library/asyncio-eventloop.rst:78 msgid "Create and return a new event loop object." msgstr "" -#: library/asyncio-eventloop.rst:74 +#: library/asyncio-eventloop.rst:80 msgid "" "Note that the behaviour of :func:`get_event_loop`, :func:`set_event_loop`, " "and :func:`new_event_loop` functions can be altered by :ref:`setting a " "custom event loop policy `." msgstr "" -#: library/asyncio-eventloop.rst:80 +#: library/asyncio-eventloop.rst:86 msgid "Contents" msgstr "" -#: library/asyncio-eventloop.rst:81 +#: library/asyncio-eventloop.rst:87 msgid "This documentation page contains the following sections:" msgstr "" -#: library/asyncio-eventloop.rst:83 +#: library/asyncio-eventloop.rst:89 msgid "" "The `Event Loop Methods`_ section is the reference documentation of the " "event loop APIs;" msgstr "" -#: library/asyncio-eventloop.rst:86 +#: library/asyncio-eventloop.rst:92 msgid "" "The `Callback Handles`_ section documents the :class:`Handle` and :class:" "`TimerHandle` instances which are returned from scheduling methods such as :" "meth:`loop.call_soon` and :meth:`loop.call_later`;" msgstr "" -#: library/asyncio-eventloop.rst:90 +#: library/asyncio-eventloop.rst:96 msgid "" "The `Server Objects`_ section documents types returned from event loop " "methods like :meth:`loop.create_server`;" msgstr "" -#: library/asyncio-eventloop.rst:93 +#: library/asyncio-eventloop.rst:99 msgid "" "The `Event Loop Implementations`_ section documents the :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" msgstr "" -#: library/asyncio-eventloop.rst:96 +#: library/asyncio-eventloop.rst:102 msgid "" "The `Examples`_ section showcases how to work with some event loop APIs." msgstr "" -#: library/asyncio-eventloop.rst:103 +#: library/asyncio-eventloop.rst:109 msgid "Event Loop Methods" msgstr "" -#: library/asyncio-eventloop.rst:105 +#: library/asyncio-eventloop.rst:111 msgid "Event loops have **low-level** APIs for the following:" msgstr "" -#: library/asyncio-eventloop.rst:113 +#: library/asyncio-eventloop.rst:119 msgid "Running and stopping the loop" msgstr "" -#: library/asyncio-eventloop.rst:117 +#: library/asyncio-eventloop.rst:123 msgid "Run until the *future* (an instance of :class:`Future`) has completed." msgstr "" -#: library/asyncio-eventloop.rst:120 +#: library/asyncio-eventloop.rst:126 msgid "" "If the argument is a :ref:`coroutine object ` it is implicitly " "scheduled to run as a :class:`asyncio.Task`." msgstr "" -#: library/asyncio-eventloop.rst:123 +#: library/asyncio-eventloop.rst:129 msgid "Return the Future's result or raise its exception." msgstr "" -#: library/asyncio-eventloop.rst:127 +#: library/asyncio-eventloop.rst:133 msgid "Run the event loop until :meth:`stop` is called." msgstr "" -#: library/asyncio-eventloop.rst:129 +#: library/asyncio-eventloop.rst:135 msgid "" -"If :meth:`stop` is called before :meth:`run_forever()` is called, the loop " +"If :meth:`stop` is called before :meth:`run_forever` is called, the loop " "will poll the I/O selector once with a timeout of zero, run all callbacks " "scheduled in response to I/O events (and those that were already scheduled), " "and then exit." msgstr "" -#: library/asyncio-eventloop.rst:134 +#: library/asyncio-eventloop.rst:140 msgid "" "If :meth:`stop` is called while :meth:`run_forever` is running, the loop " "will run the current batch of callbacks and then exit. Note that new " @@ -204,60 +211,69 @@ msgid "" "called." msgstr "" -#: library/asyncio-eventloop.rst:142 +#: library/asyncio-eventloop.rst:148 msgid "Stop the event loop." msgstr "" -#: library/asyncio-eventloop.rst:146 +#: library/asyncio-eventloop.rst:152 msgid "Return ``True`` if the event loop is currently running." msgstr "" -#: library/asyncio-eventloop.rst:150 +#: library/asyncio-eventloop.rst:156 msgid "Return ``True`` if the event loop was closed." msgstr "" -#: library/asyncio-eventloop.rst:154 +#: library/asyncio-eventloop.rst:160 msgid "Close the event loop." msgstr "" -#: library/asyncio-eventloop.rst:156 +#: library/asyncio-eventloop.rst:162 msgid "" "The loop must not be running when this function is called. Any pending " "callbacks will be discarded." msgstr "" -#: library/asyncio-eventloop.rst:159 +#: library/asyncio-eventloop.rst:165 msgid "" "This method clears all queues and shuts down the executor, but does not wait " "for the executor to finish." msgstr "" -#: library/asyncio-eventloop.rst:162 +#: library/asyncio-eventloop.rst:168 msgid "" "This method is idempotent and irreversible. No other methods should be " "called after the event loop is closed." msgstr "" -#: library/asyncio-eventloop.rst:167 +#: library/asyncio-eventloop.rst:174 msgid "" "Schedule all currently open :term:`asynchronous generator` objects to close " -"with an :meth:`~agen.aclose()` call. After calling this method, the event " +"with an :meth:`~agen.aclose` call. After calling this method, the event " "loop will issue a warning if a new asynchronous generator is iterated. This " "should be used to reliably finalize all scheduled asynchronous generators." msgstr "" -#: library/asyncio-eventloop.rst:173 +#: library/asyncio-eventloop.rst:180 msgid "" "Note that there is no need to call this function when :func:`asyncio.run` is " "used." msgstr "" -#: library/asyncio-eventloop.rst:176 library/asyncio-eventloop.rst:1242 -#: library/asyncio-eventloop.rst:1660 +#: library/asyncio-eventloop.rst:183 library/asyncio-eventloop.rst:1354 +#: library/asyncio-eventloop.rst:1816 msgid "Example::" msgstr "" -#: library/asyncio-eventloop.rst:188 +#: library/asyncio-eventloop.rst:185 +msgid "" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.run_until_complete(loop.shutdown_asyncgens())\n" +" loop.close()" +msgstr "" + +#: library/asyncio-eventloop.rst:196 msgid "" "Schedule the closure of the default executor and wait for it to join all of " "the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once " @@ -265,318 +281,396 @@ msgid "" "run_in_executor` will raise a :exc:`RuntimeError`." msgstr "" -#: library/asyncio-eventloop.rst:194 +#: library/asyncio-eventloop.rst:202 msgid "" "The *timeout* parameter specifies the amount of time (in :class:`float` " "seconds) the executor will be given to finish joining. With the default, " "``None``, the executor is allowed an unlimited amount of time." msgstr "" -#: library/asyncio-eventloop.rst:199 +#: library/asyncio-eventloop.rst:207 msgid "" "If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted and the " "default executor is terminated without waiting for its threads to finish " "joining." msgstr "" -#: library/asyncio-eventloop.rst:205 +#: library/asyncio-eventloop.rst:213 msgid "" "Do not call this method when using :func:`asyncio.run`, as the latter " "handles default executor shutdown automatically." msgstr "" -#: library/asyncio-eventloop.rst:210 +#: library/asyncio-eventloop.rst:218 msgid "Added the *timeout* parameter." msgstr "" -#: library/asyncio-eventloop.rst:214 +#: library/asyncio-eventloop.rst:222 msgid "Scheduling callbacks" msgstr "" -#: library/asyncio-eventloop.rst:218 +#: library/asyncio-eventloop.rst:226 msgid "" "Schedule the *callback* :term:`callback` to be called with *args* arguments " "at the next iteration of the event loop." msgstr "" -#: library/asyncio-eventloop.rst:221 +#: library/asyncio-eventloop.rst:229 msgid "" "Return an instance of :class:`asyncio.Handle`, which can be used later to " "cancel the callback." msgstr "" -#: library/asyncio-eventloop.rst:224 +#: library/asyncio-eventloop.rst:232 msgid "" "Callbacks are called in the order in which they are registered. Each " "callback will be called exactly once." msgstr "" -#: library/asyncio-eventloop.rst:227 +#: library/asyncio-eventloop.rst:235 msgid "" "The optional keyword-only *context* argument specifies a custom :class:" "`contextvars.Context` for the *callback* to run in. Callbacks use the " "current context when no *context* is provided." msgstr "" -#: library/asyncio-eventloop.rst:231 +#: library/asyncio-eventloop.rst:239 msgid "Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe." msgstr "" -#: library/asyncio-eventloop.rst:235 +#: library/asyncio-eventloop.rst:243 msgid "" "A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from " "another thread, this function *must* be used, since :meth:`call_soon` is not " "thread-safe." msgstr "" -#: library/asyncio-eventloop.rst:239 +#: library/asyncio-eventloop.rst:247 +msgid "" +"This function is safe to be called from a reentrant context or signal " +"handler, however, it is not safe or fruitful to use the returned handle in " +"such contexts." +msgstr "" + +#: library/asyncio-eventloop.rst:250 msgid "" "Raises :exc:`RuntimeError` if called on a loop that's been closed. This can " "happen on a secondary thread when the main application is shutting down." msgstr "" -#: library/asyncio-eventloop.rst:243 +#: library/asyncio-eventloop.rst:254 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: library/asyncio-eventloop.rst:246 library/asyncio-eventloop.rst:296 -#: library/asyncio-eventloop.rst:316 +#: library/asyncio-eventloop.rst:257 library/asyncio-eventloop.rst:313 +#: library/asyncio-eventloop.rst:339 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "" -#: library/asyncio-eventloop.rst:254 +#: library/asyncio-eventloop.rst:265 msgid "" "Most :mod:`asyncio` scheduling functions don't allow passing keyword " "arguments. To do that, use :func:`functools.partial`::" msgstr "" -#: library/asyncio-eventloop.rst:261 +#: library/asyncio-eventloop.rst:268 +msgid "" +"# will schedule \"print(\"Hello\", flush=True)\"\n" +"loop.call_soon(\n" +" functools.partial(print, \"Hello\", flush=True))" +msgstr "" + +#: library/asyncio-eventloop.rst:272 msgid "" "Using partial objects is usually more convenient than using lambdas, as " "asyncio can render partial objects better in debug and error messages." msgstr "" -#: library/asyncio-eventloop.rst:269 +#: library/asyncio-eventloop.rst:280 msgid "Scheduling delayed callbacks" msgstr "" -#: library/asyncio-eventloop.rst:271 +#: library/asyncio-eventloop.rst:282 msgid "" "Event loop provides mechanisms to schedule callback functions to be called " "at some point in the future. Event loop uses monotonic clocks to track time." msgstr "" -#: library/asyncio-eventloop.rst:278 +#: library/asyncio-eventloop.rst:289 msgid "" "Schedule *callback* to be called after the given *delay* number of seconds " "(can be either an int or a float)." msgstr "" -#: library/asyncio-eventloop.rst:281 library/asyncio-eventloop.rst:313 +#: library/asyncio-eventloop.rst:292 library/asyncio-eventloop.rst:330 msgid "" "An instance of :class:`asyncio.TimerHandle` is returned which can be used to " "cancel the callback." msgstr "" -#: library/asyncio-eventloop.rst:284 +#: library/asyncio-eventloop.rst:295 msgid "" "*callback* will be called exactly once. If two callbacks are scheduled for " "exactly the same time, the order in which they are called is undefined." msgstr "" -#: library/asyncio-eventloop.rst:288 +#: library/asyncio-eventloop.rst:299 msgid "" "The optional positional *args* will be passed to the callback when it is " "called. If you want the callback to be called with keyword arguments use :" "func:`functools.partial`." msgstr "" -#: library/asyncio-eventloop.rst:292 +#: library/asyncio-eventloop.rst:303 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *callback* to run in. The current " "context is used when no *context* is provided." msgstr "" -#: library/asyncio-eventloop.rst:300 +#: library/asyncio-eventloop.rst:309 +msgid "" +"For performance, callbacks scheduled with :meth:`loop.call_later` may run up " +"to one clock-resolution early (see ``time.get_clock_info('monotonic')." +"resolution``)." +msgstr "" + +#: library/asyncio-eventloop.rst:317 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "*delay* could not exceed one day. This has been fixed in Python 3.8." msgstr "" -#: library/asyncio-eventloop.rst:307 +#: library/asyncio-eventloop.rst:324 msgid "" "Schedule *callback* to be called at the given absolute timestamp *when* (an " "int or a float), using the same time reference as :meth:`loop.time`." msgstr "" -#: library/asyncio-eventloop.rst:311 +#: library/asyncio-eventloop.rst:328 msgid "This method's behavior is the same as :meth:`call_later`." msgstr "" -#: library/asyncio-eventloop.rst:320 +#: library/asyncio-eventloop.rst:335 +msgid "" +"For performance, callbacks scheduled with :meth:`loop.call_at` may run up to " +"one clock-resolution early (see ``time.get_clock_info('monotonic')." +"resolution``)." +msgstr "" + +#: library/asyncio-eventloop.rst:343 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "difference between *when* and the current time could not exceed one day. " "This has been fixed in Python 3.8." msgstr "" -#: library/asyncio-eventloop.rst:327 +#: library/asyncio-eventloop.rst:350 msgid "" "Return the current time, as a :class:`float` value, according to the event " "loop's internal monotonic clock." msgstr "" -#: library/asyncio-eventloop.rst:331 +#: library/asyncio-eventloop.rst:354 msgid "" "In Python 3.7 and earlier timeouts (relative *delay* or absolute *when*) " "should not exceed one day. This has been fixed in Python 3.8." msgstr "" -#: library/asyncio-eventloop.rst:337 +#: library/asyncio-eventloop.rst:360 msgid "The :func:`asyncio.sleep` function." msgstr "" -#: library/asyncio-eventloop.rst:341 +#: library/asyncio-eventloop.rst:364 msgid "Creating Futures and Tasks" msgstr "" -#: library/asyncio-eventloop.rst:345 +#: library/asyncio-eventloop.rst:368 msgid "Create an :class:`asyncio.Future` object attached to the event loop." msgstr "" -#: library/asyncio-eventloop.rst:347 +#: library/asyncio-eventloop.rst:370 msgid "" "This is the preferred way to create Futures in asyncio. This lets third-" "party event loops provide alternative implementations of the Future object " "(with better performance or instrumentation)." msgstr "" -#: library/asyncio-eventloop.rst:355 +#: library/asyncio-eventloop.rst:378 msgid "" "Schedule the execution of :ref:`coroutine ` *coro*. Return a :" "class:`Task` object." msgstr "" -#: library/asyncio-eventloop.rst:358 +#: library/asyncio-eventloop.rst:381 msgid "" "Third-party event loops can use their own subclass of :class:`Task` for " "interoperability. In this case, the result type is a subclass of :class:" "`Task`." msgstr "" -#: library/asyncio-eventloop.rst:362 +#: library/asyncio-eventloop.rst:385 +msgid "" +"The full function signature is largely the same as that of the :class:`Task` " +"constructor (or factory) - all of the keyword arguments to this function are " +"passed through to that interface." +msgstr "" + +#: library/asyncio-eventloop.rst:389 msgid "" "If the *name* argument is provided and not ``None``, it is set as the name " "of the task using :meth:`Task.set_name`." msgstr "" -#: library/asyncio-eventloop.rst:365 +#: library/asyncio-eventloop.rst:392 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. The current context " "copy is created when no *context* is provided." msgstr "" -#: library/asyncio-eventloop.rst:369 +#: library/asyncio-eventloop.rst:396 +msgid "" +"An optional keyword-only *eager_start* argument allows specifying if the " +"task should execute eagerly during the call to create_task, or be scheduled " +"later. If *eager_start* is not passed the mode set by :meth:`loop." +"set_task_factory` will be used." +msgstr "" + +#: library/asyncio-eventloop.rst:401 msgid "Added the *name* parameter." msgstr "" -#: library/asyncio-eventloop.rst:372 +#: library/asyncio-eventloop.rst:404 msgid "Added the *context* parameter." msgstr "" -#: library/asyncio-eventloop.rst:377 +#: library/asyncio-eventloop.rst:407 +msgid "" +"Added ``kwargs`` which passes on arbitrary extra parameters, including " +"``name`` and ``context``." +msgstr "" + +#: library/asyncio-eventloop.rst:410 +msgid "" +"Rolled back the change that passes on *name* and *context* (if it is None), " +"while still passing on other arbitrary keyword arguments (to avoid breaking " +"backwards compatibility with 3.13.3)." +msgstr "" + +#: library/asyncio-eventloop.rst:414 +msgid "" +"All *kwargs* are now passed on. The *eager_start* parameter works with eager " +"task factories." +msgstr "" + +#: library/asyncio-eventloop.rst:419 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "" -#: library/asyncio-eventloop.rst:380 +#: library/asyncio-eventloop.rst:422 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " "*factory* must be a *callable* with the signature matching ``(loop, coro, " -"context=None)``, where *loop* is a reference to the active event loop, and " -"*coro* is a coroutine object. The callable must return a :class:`asyncio." -"Future`-compatible object." +"**kwargs)``, where *loop* is a reference to the active event loop, and " +"*coro* is a coroutine object. The callable must pass on all *kwargs*, and " +"return a :class:`asyncio.Task`-compatible object." msgstr "" -#: library/asyncio-eventloop.rst:388 +#: library/asyncio-eventloop.rst:428 +msgid "Required that all *kwargs* are passed on to :class:`asyncio.Task`." +msgstr "" + +#: library/asyncio-eventloop.rst:431 +msgid "" +"*name* is no longer passed to task factories. *context* is no longer passed " +"to task factories if it is ``None``." +msgstr "" + +#: library/asyncio-eventloop.rst:435 +msgid "" +"*name* and *context* are now unconditionally passed on to task factories " +"again." +msgstr "" + +#: library/asyncio-eventloop.rst:440 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "" -#: library/asyncio-eventloop.rst:392 +#: library/asyncio-eventloop.rst:444 msgid "Opening network connections" msgstr "" -#: library/asyncio-eventloop.rst:403 +#: library/asyncio-eventloop.rst:456 msgid "" "Open a streaming transport connection to a given address specified by *host* " "and *port*." msgstr "" -#: library/asyncio-eventloop.rst:406 +#: library/asyncio-eventloop.rst:459 msgid "" "The socket family can be either :py:const:`~socket.AF_INET` or :py:const:" "`~socket.AF_INET6` depending on *host* (or the *family* argument, if " "provided)." msgstr "" -#: library/asyncio-eventloop.rst:410 +#: library/asyncio-eventloop.rst:463 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "" -#: library/asyncio-eventloop.rst:412 library/asyncio-eventloop.rst:1156 -#: library/asyncio-eventloop.rst:1172 +#: library/asyncio-eventloop.rst:465 library/asyncio-eventloop.rst:1264 +#: library/asyncio-eventloop.rst:1281 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." msgstr "" -#: library/asyncio-eventloop.rst:415 +#: library/asyncio-eventloop.rst:468 msgid "" "This method will try to establish the connection in the background. When " "successful, it returns a ``(transport, protocol)`` pair." msgstr "" -#: library/asyncio-eventloop.rst:418 +#: library/asyncio-eventloop.rst:471 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "" -#: library/asyncio-eventloop.rst:420 +#: library/asyncio-eventloop.rst:473 msgid "" "The connection is established and a :ref:`transport ` is " "created for it." msgstr "" -#: library/asyncio-eventloop.rst:423 +#: library/asyncio-eventloop.rst:476 msgid "" "*protocol_factory* is called without arguments and is expected to return a :" "ref:`protocol ` instance." msgstr "" -#: library/asyncio-eventloop.rst:426 +#: library/asyncio-eventloop.rst:479 msgid "" "The protocol instance is coupled with the transport by calling its :meth:" "`~BaseProtocol.connection_made` method." msgstr "" -#: library/asyncio-eventloop.rst:429 +#: library/asyncio-eventloop.rst:482 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "" -#: library/asyncio-eventloop.rst:431 +#: library/asyncio-eventloop.rst:484 msgid "" "The created transport is an implementation-dependent bidirectional stream." msgstr "" -#: library/asyncio-eventloop.rst:434 library/asyncio-eventloop.rst:566 +#: library/asyncio-eventloop.rst:487 library/asyncio-eventloop.rst:620 msgid "Other arguments:" msgstr "" -#: library/asyncio-eventloop.rst:436 +#: library/asyncio-eventloop.rst:489 msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " @@ -585,11 +679,11 @@ msgid "" "is used." msgstr "" -#: library/asyncio-eventloop.rst:442 +#: library/asyncio-eventloop.rst:495 msgid ":ref:`SSL/TLS security considerations `" msgstr "" -#: library/asyncio-eventloop.rst:444 +#: library/asyncio-eventloop.rst:497 msgid "" "*server_hostname* sets or overrides the hostname that the target server's " "certificate will be matched against. Should only be passed if *ssl* is not " @@ -600,7 +694,7 @@ msgid "" "potential man-in-the-middle attacks)." msgstr "" -#: library/asyncio-eventloop.rst:452 +#: library/asyncio-eventloop.rst:505 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " @@ -608,7 +702,7 @@ msgid "" "constants." msgstr "" -#: library/asyncio-eventloop.rst:457 +#: library/asyncio-eventloop.rst:510 msgid "" "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " "connection. It should be a floating-point number representing the amount of " @@ -618,7 +712,7 @@ msgid "" "the RFC is ``0.25`` (250 milliseconds)." msgstr "" -#: library/asyncio-eventloop.rst:465 +#: library/asyncio-eventloop.rst:518 msgid "" "*interleave* controls address reordering when a host name resolves to " "multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " @@ -629,7 +723,7 @@ msgid "" "*happy_eyeballs_delay* is not specified, and ``1`` if it is." msgstr "" -#: library/asyncio-eventloop.rst:474 +#: library/asyncio-eventloop.rst:527 msgid "" "*sock*, if given, should be an existing, already connected :class:`socket." "socket` object to be used by the transport. If *sock* is given, none of " @@ -637,37 +731,37 @@ msgid "" "*interleave* and *local_addr* should be specified." msgstr "" -#: library/asyncio-eventloop.rst:482 library/asyncio-eventloop.rst:597 -#: library/asyncio-eventloop.rst:825 +#: library/asyncio-eventloop.rst:535 library/asyncio-eventloop.rst:657 +#: library/asyncio-eventloop.rst:905 msgid "" "The *sock* argument transfers ownership of the socket to the transport " "created. To close the socket, call the transport's :meth:`~asyncio." "BaseTransport.close` method." msgstr "" -#: library/asyncio-eventloop.rst:486 +#: library/asyncio-eventloop.rst:539 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using " "``getaddrinfo()``, similarly to *host* and *port*." msgstr "" -#: library/asyncio-eventloop.rst:490 library/asyncio-eventloop.rst:919 +#: library/asyncio-eventloop.rst:543 library/asyncio-eventloop.rst:1001 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " "``60.0`` seconds if ``None`` (default)." msgstr "" -#: library/asyncio-eventloop.rst:494 library/asyncio-eventloop.rst:742 -#: library/asyncio-eventloop.rst:836 library/asyncio-eventloop.rst:923 +#: library/asyncio-eventloop.rst:547 library/asyncio-eventloop.rst:812 +#: library/asyncio-eventloop.rst:916 library/asyncio-eventloop.rst:1005 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: library/asyncio-eventloop.rst:498 +#: library/asyncio-eventloop.rst:551 msgid "" "*all_errors* determines what exceptions are raised when a connection cannot " "be created. By default, only a single ``Exception`` is raised: the first " @@ -677,25 +771,25 @@ msgid "" "(even if there is only one)." msgstr "" -#: library/asyncio-eventloop.rst:508 library/asyncio-eventloop.rst:754 +#: library/asyncio-eventloop.rst:561 library/asyncio-eventloop.rst:824 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "" -#: library/asyncio-eventloop.rst:512 +#: library/asyncio-eventloop.rst:565 msgid "" "The socket option :ref:`socket.TCP_NODELAY ` is set " "by default for all TCP connections." msgstr "" -#: library/asyncio-eventloop.rst:517 library/asyncio-eventloop.rst:846 +#: library/asyncio-eventloop.rst:570 library/asyncio-eventloop.rst:926 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "" -#: library/asyncio-eventloop.rst:521 +#: library/asyncio-eventloop.rst:574 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "" -#: library/asyncio-eventloop.rst:523 +#: library/asyncio-eventloop.rst:576 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -706,68 +800,74 @@ msgid "" "visible delay and provides an algorithm." msgstr "" -#: library/asyncio-eventloop.rst:532 +#: library/asyncio-eventloop.rst:585 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "" -#: library/asyncio-eventloop.rst:536 library/asyncio-eventloop.rst:660 -#: library/asyncio-eventloop.rst:768 library/asyncio-eventloop.rst:803 -#: library/asyncio-eventloop.rst:850 library/asyncio-eventloop.rst:931 +#: library/asyncio-eventloop.rst:589 library/asyncio-eventloop.rst:721 +#: library/asyncio-eventloop.rst:838 library/asyncio-eventloop.rst:878 +#: library/asyncio-eventloop.rst:930 library/asyncio-eventloop.rst:1013 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "" -#: library/asyncio-eventloop.rst:538 +#: library/asyncio-eventloop.rst:591 msgid "*all_errors* was added." msgstr "" -#: library/asyncio-eventloop.rst:543 +#: library/asyncio-eventloop.rst:596 msgid "" "The :func:`open_connection` function is a high-level alternative API. It " "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " "used directly in async/await code." msgstr "" -#: library/asyncio-eventloop.rst:553 +#: library/asyncio-eventloop.rst:607 msgid "Create a datagram connection." msgstr "" -#: library/asyncio-eventloop.rst:555 +#: library/asyncio-eventloop.rst:609 msgid "" "The socket family can be either :py:const:`~socket.AF_INET`, :py:const:" "`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " "the *family* argument, if provided)." msgstr "" -#: library/asyncio-eventloop.rst:559 +#: library/asyncio-eventloop.rst:613 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "" -#: library/asyncio-eventloop.rst:561 library/asyncio-eventloop.rst:685 -#: library/asyncio-eventloop.rst:817 +#: library/asyncio-eventloop.rst:615 library/asyncio-eventloop.rst:748 +#: library/asyncio-eventloop.rst:897 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." msgstr "" -#: library/asyncio-eventloop.rst:564 library/asyncio-eventloop.rst:642 +#: library/asyncio-eventloop.rst:618 library/asyncio-eventloop.rst:703 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "" -#: library/asyncio-eventloop.rst:568 +#: library/asyncio-eventloop.rst:622 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using :" "meth:`getaddrinfo`." msgstr "" -#: library/asyncio-eventloop.rst:572 +#: library/asyncio-eventloop.rst:628 +msgid "" +"On Windows, when using the proactor event loop with ``local_addr=None``, an :" +"exc:`OSError` with :attr:`!errno.WSAEINVAL` will be raised when running it." +msgstr "" + +#: library/asyncio-eventloop.rst:632 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " "are looked up using :meth:`getaddrinfo`." msgstr "" -#: library/asyncio-eventloop.rst:576 +#: library/asyncio-eventloop.rst:636 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -775,7 +875,7 @@ msgid "" "module constants." msgstr "" -#: library/asyncio-eventloop.rst:581 +#: library/asyncio-eventloop.rst:641 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -784,13 +884,13 @@ msgid "" "is not defined then this capability is unsupported." msgstr "" -#: library/asyncio-eventloop.rst:587 +#: library/asyncio-eventloop.rst:647 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "" -#: library/asyncio-eventloop.rst:590 +#: library/asyncio-eventloop.rst:650 msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " @@ -798,37 +898,37 @@ msgid "" "`None`)." msgstr "" -#: library/asyncio-eventloop.rst:601 +#: library/asyncio-eventloop.rst:661 msgid "" "See :ref:`UDP echo client protocol ` and :" "ref:`UDP echo server protocol ` examples." msgstr "" -#: library/asyncio-eventloop.rst:604 +#: library/asyncio-eventloop.rst:664 msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." msgstr "" -#: library/asyncio-eventloop.rst:608 +#: library/asyncio-eventloop.rst:668 msgid "Added support for Windows." msgstr "" -#: library/asyncio-eventloop.rst:611 +#: library/asyncio-eventloop.rst:671 msgid "" "The *reuse_address* parameter is no longer supported, as using :ref:`socket." "SO_REUSEADDR ` poses a significant security concern " "for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." msgstr "" -#: library/asyncio-eventloop.rst:617 +#: library/asyncio-eventloop.rst:677 msgid "" "When multiple processes with differing UIDs assign sockets to an identical " "UDP socket address with ``SO_REUSEADDR``, incoming packets can become " "randomly distributed among the sockets." msgstr "" -#: library/asyncio-eventloop.rst:621 +#: library/asyncio-eventloop.rst:681 msgid "" "For supported platforms, *reuse_port* can be used as a replacement for " "similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT `: Unix." +#: library/asyncio-eventloop.rst:713 library/asyncio-eventloop.rst:869 +#: library/asyncio-eventloop.rst:1334 library/asyncio-eventloop.rst:1886 +#: library/asyncio-eventloop.rst:1893 +msgid "Availability" msgstr "" -#: library/asyncio-eventloop.rst:654 +#: library/asyncio-eventloop.rst:715 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`." msgstr "" -#: library/asyncio-eventloop.rst:664 +#: library/asyncio-eventloop.rst:725 msgid "Creating network servers" msgstr "" -#: library/asyncio-eventloop.rst:678 +#: library/asyncio-eventloop.rst:741 msgid "" "Create a TCP server (socket type :const:`~socket.SOCK_STREAM`) listening on " "*port* of the *host* address." msgstr "" -#: library/asyncio-eventloop.rst:681 +#: library/asyncio-eventloop.rst:744 msgid "Returns a :class:`Server` object." msgstr "" -#: library/asyncio-eventloop.rst:683 +#: library/asyncio-eventloop.rst:746 msgid "Arguments:" msgstr "" -#: library/asyncio-eventloop.rst:688 +#: library/asyncio-eventloop.rst:751 msgid "" "The *host* parameter can be set to several types which determine where the " "server would be listening:" msgstr "" -#: library/asyncio-eventloop.rst:691 +#: library/asyncio-eventloop.rst:754 msgid "" "If *host* is a string, the TCP server is bound to a single network interface " "specified by *host*." msgstr "" -#: library/asyncio-eventloop.rst:694 +#: library/asyncio-eventloop.rst:757 msgid "" "If *host* is a sequence of strings, the TCP server is bound to all network " "interfaces specified by the sequence." msgstr "" -#: library/asyncio-eventloop.rst:697 +#: library/asyncio-eventloop.rst:760 msgid "" "If *host* is an empty string or ``None``, all interfaces are assumed and a " "list of multiple sockets will be returned (most likely one for IPv4 and " "another one for IPv6)." msgstr "" -#: library/asyncio-eventloop.rst:701 +#: library/asyncio-eventloop.rst:764 msgid "" "The *port* parameter can be set to specify which port the server should " "listen on. If ``0`` or ``None`` (the default), a random unused port will be " @@ -927,63 +1028,73 @@ msgid "" "different random port will be selected for each interface)." msgstr "" -#: library/asyncio-eventloop.rst:706 +#: library/asyncio-eventloop.rst:769 msgid "" "*family* can be set to either :const:`socket.AF_INET` or :const:`~socket." "AF_INET6` to force the socket to use IPv4 or IPv6. If not set, the *family* " "will be determined from host name (defaults to :const:`~socket.AF_UNSPEC`)." msgstr "" -#: library/asyncio-eventloop.rst:711 +#: library/asyncio-eventloop.rst:774 msgid "*flags* is a bitmask for :meth:`getaddrinfo`." msgstr "" -#: library/asyncio-eventloop.rst:713 +#: library/asyncio-eventloop.rst:776 msgid "" "*sock* can optionally be specified in order to use a preexisting socket " "object. If specified, *host* and *port* must not be specified." msgstr "" -#: library/asyncio-eventloop.rst:718 +#: library/asyncio-eventloop.rst:781 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" -#: library/asyncio-eventloop.rst:722 +#: library/asyncio-eventloop.rst:785 msgid "" "*backlog* is the maximum number of queued connections passed to :meth:" "`~socket.socket.listen` (defaults to 100)." msgstr "" -#: library/asyncio-eventloop.rst:725 +#: library/asyncio-eventloop.rst:788 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` instance to enable TLS over " "the accepted connections." msgstr "" -#: library/asyncio-eventloop.rst:728 +#: library/asyncio-eventloop.rst:791 msgid "" "*reuse_address* tells the kernel to reuse a local socket in ``TIME_WAIT`` " "state, without waiting for its natural timeout to expire. If not specified " "will automatically be set to ``True`` on Unix." msgstr "" -#: library/asyncio-eventloop.rst:733 +#: library/asyncio-eventloop.rst:796 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " "flag when being created. This option is not supported on Windows." msgstr "" -#: library/asyncio-eventloop.rst:738 +#: library/asyncio-eventloop.rst:801 +msgid "" +"*keep_alive* set to ``True`` keeps connections active by enabling the " +"periodic transmission of messages." +msgstr "" + +#: library/asyncio-eventloop.rst:806 +msgid "Added the *keep_alive* parameter." +msgstr "" + +#: library/asyncio-eventloop.rst:808 msgid "" "*ssl_handshake_timeout* is (for a TLS server) the time in seconds to wait " "for the TLS handshake to complete before aborting the connection. ``60.0`` " "seconds if ``None`` (default)." msgstr "" -#: library/asyncio-eventloop.rst:746 +#: library/asyncio-eventloop.rst:816 msgid "" "*start_serving* set to ``True`` (the default) causes the created server to " "start accepting connections immediately. When set to ``False``, the user " @@ -991,104 +1102,115 @@ msgid "" "to make the server to start accepting connections." msgstr "" -#: library/asyncio-eventloop.rst:758 +#: library/asyncio-eventloop.rst:828 msgid "The *host* parameter can be a sequence of strings." msgstr "" -#: library/asyncio-eventloop.rst:762 +#: library/asyncio-eventloop.rst:832 msgid "" "Added *ssl_handshake_timeout* and *start_serving* parameters. The socket " "option :ref:`socket.TCP_NODELAY ` is set by default " "for all TCP connections." msgstr "" -#: library/asyncio-eventloop.rst:772 +#: library/asyncio-eventloop.rst:842 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " "be used in an async/await code." msgstr "" -#: library/asyncio-eventloop.rst:783 +#: library/asyncio-eventloop.rst:854 msgid "" "Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." "AF_UNIX` socket family." msgstr "" -#: library/asyncio-eventloop.rst:786 +#: library/asyncio-eventloop.rst:857 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " "and :class:`~pathlib.Path` paths are supported." msgstr "" -#: library/asyncio-eventloop.rst:791 +#: library/asyncio-eventloop.rst:862 +msgid "" +"If *cleanup_socket* is true then the Unix socket will automatically be " +"removed from the filesystem when the server is closed, unless the socket has " +"been replaced after the server has been created." +msgstr "" + +#: library/asyncio-eventloop.rst:866 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "" -#: library/asyncio-eventloop.rst:798 +#: library/asyncio-eventloop.rst:873 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." msgstr "" -#: library/asyncio-eventloop.rst:810 +#: library/asyncio-eventloop.rst:882 +msgid "Added the *cleanup_socket* parameter." +msgstr "" + +#: library/asyncio-eventloop.rst:890 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "" -#: library/asyncio-eventloop.rst:812 +#: library/asyncio-eventloop.rst:892 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "" -#: library/asyncio-eventloop.rst:815 library/asyncio-eventloop.rst:905 +#: library/asyncio-eventloop.rst:895 library/asyncio-eventloop.rst:987 msgid "Parameters:" msgstr "" -#: library/asyncio-eventloop.rst:820 +#: library/asyncio-eventloop.rst:900 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." msgstr "" -#: library/asyncio-eventloop.rst:829 +#: library/asyncio-eventloop.rst:909 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "" -#: library/asyncio-eventloop.rst:832 +#: library/asyncio-eventloop.rst:912 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " "``60.0`` seconds if ``None`` (default)." msgstr "" -#: library/asyncio-eventloop.rst:840 +#: library/asyncio-eventloop.rst:920 msgid "Returns a ``(transport, protocol)`` pair." msgstr "" -#: library/asyncio-eventloop.rst:854 +#: library/asyncio-eventloop.rst:934 msgid "Transferring files" msgstr "" -#: library/asyncio-eventloop.rst:859 +#: library/asyncio-eventloop.rst:940 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "" -#: library/asyncio-eventloop.rst:862 +#: library/asyncio-eventloop.rst:943 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "" -#: library/asyncio-eventloop.rst:864 +#: library/asyncio-eventloop.rst:945 msgid "*file* must be a regular file object opened in binary mode." msgstr "" -#: library/asyncio-eventloop.rst:866 library/asyncio-eventloop.rst:1111 +#: library/asyncio-eventloop.rst:947 library/asyncio-eventloop.rst:1208 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1097,35 +1219,35 @@ msgid "" "obtain the actual number of bytes sent." msgstr "" -#: library/asyncio-eventloop.rst:873 +#: library/asyncio-eventloop.rst:954 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " "SSL socket on Unix)." msgstr "" -#: library/asyncio-eventloop.rst:877 +#: library/asyncio-eventloop.rst:958 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -#: library/asyncio-eventloop.rst:884 +#: library/asyncio-eventloop.rst:965 msgid "TLS Upgrade" msgstr "" -#: library/asyncio-eventloop.rst:891 +#: library/asyncio-eventloop.rst:973 msgid "Upgrade an existing transport-based connection to TLS." msgstr "" -#: library/asyncio-eventloop.rst:893 +#: library/asyncio-eventloop.rst:975 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " "protocol and *protocol*-facing transport." msgstr "" -#: library/asyncio-eventloop.rst:897 +#: library/asyncio-eventloop.rst:979 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1133,79 +1255,85 @@ msgid "" "exchanges extra TLS session packets with *transport*." msgstr "" -#: library/asyncio-eventloop.rst:902 +#: library/asyncio-eventloop.rst:984 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "" -#: library/asyncio-eventloop.rst:907 +#: library/asyncio-eventloop.rst:989 msgid "" "*transport* and *protocol* instances that methods like :meth:`~loop." "create_server` and :meth:`~loop.create_connection` return." msgstr "" -#: library/asyncio-eventloop.rst:911 +#: library/asyncio-eventloop.rst:993 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "" -#: library/asyncio-eventloop.rst:913 +#: library/asyncio-eventloop.rst:995 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." msgstr "" -#: library/asyncio-eventloop.rst:916 +#: library/asyncio-eventloop.rst:998 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "" -#: library/asyncio-eventloop.rst:936 +#: library/asyncio-eventloop.rst:1018 msgid "Watching file descriptors" msgstr "" -#: library/asyncio-eventloop.rst:940 +#: library/asyncio-eventloop.rst:1022 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." msgstr "" -#: library/asyncio-eventloop.rst:946 +#: library/asyncio-eventloop.rst:1026 library/asyncio-eventloop.rst:1040 +msgid "" +"Any preexisting callback registered for *fd* is cancelled and replaced by " +"*callback*." +msgstr "" + +#: library/asyncio-eventloop.rst:1031 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." msgstr "" -#: library/asyncio-eventloop.rst:951 +#: library/asyncio-eventloop.rst:1036 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." msgstr "" -#: library/asyncio-eventloop.rst:955 library/asyncio-eventloop.rst:1212 +#: library/asyncio-eventloop.rst:1043 library/asyncio-eventloop.rst:1321 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." msgstr "" -#: library/asyncio-eventloop.rst:960 +#: library/asyncio-eventloop.rst:1048 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." msgstr "" -#: library/asyncio-eventloop.rst:963 +#: library/asyncio-eventloop.rst:1051 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." msgstr "" -#: library/asyncio-eventloop.rst:968 +#: library/asyncio-eventloop.rst:1056 msgid "Working with socket objects directly" msgstr "" -#: library/asyncio-eventloop.rst:970 +#: library/asyncio-eventloop.rst:1058 msgid "" "In general, protocol implementations that use transport-based APIs such as :" "meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " @@ -1214,68 +1342,68 @@ msgid "" "socket` objects directly is more convenient." msgstr "" -#: library/asyncio-eventloop.rst:979 +#: library/asyncio-eventloop.rst:1068 msgid "" "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." "recv() `." msgstr "" -#: library/asyncio-eventloop.rst:982 +#: library/asyncio-eventloop.rst:1071 msgid "Return the received data as a bytes object." msgstr "" -#: library/asyncio-eventloop.rst:984 library/asyncio-eventloop.rst:998 -#: library/asyncio-eventloop.rst:1009 library/asyncio-eventloop.rst:1021 -#: library/asyncio-eventloop.rst:1036 library/asyncio-eventloop.rst:1051 -#: library/asyncio-eventloop.rst:1061 library/asyncio-eventloop.rst:1087 -#: library/asyncio-eventloop.rst:1125 +#: library/asyncio-eventloop.rst:1073 library/asyncio-eventloop.rst:1088 +#: library/asyncio-eventloop.rst:1100 library/asyncio-eventloop.rst:1113 +#: library/asyncio-eventloop.rst:1129 library/asyncio-eventloop.rst:1145 +#: library/asyncio-eventloop.rst:1156 library/asyncio-eventloop.rst:1183 +#: library/asyncio-eventloop.rst:1222 msgid "*sock* must be a non-blocking socket." msgstr "" -#: library/asyncio-eventloop.rst:986 +#: library/asyncio-eventloop.rst:1075 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " "is an ``async def`` method." msgstr "" -#: library/asyncio-eventloop.rst:993 +#: library/asyncio-eventloop.rst:1083 msgid "" "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" "meth:`socket.recv_into() ` method." msgstr "" -#: library/asyncio-eventloop.rst:996 +#: library/asyncio-eventloop.rst:1086 msgid "Return the number of bytes written to the buffer." msgstr "" -#: library/asyncio-eventloop.rst:1004 +#: library/asyncio-eventloop.rst:1095 msgid "" "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" "meth:`socket.recvfrom() `." msgstr "" -#: library/asyncio-eventloop.rst:1007 +#: library/asyncio-eventloop.rst:1098 msgid "Return a tuple of (received data, remote address)." msgstr "" -#: library/asyncio-eventloop.rst:1015 +#: library/asyncio-eventloop.rst:1107 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." msgstr "" -#: library/asyncio-eventloop.rst:1019 +#: library/asyncio-eventloop.rst:1111 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "" -#: library/asyncio-eventloop.rst:1027 +#: library/asyncio-eventloop.rst:1120 msgid "" "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." "sendall() `." msgstr "" -#: library/asyncio-eventloop.rst:1030 +#: library/asyncio-eventloop.rst:1123 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1284,33 +1412,33 @@ msgid "" "the connection." msgstr "" -#: library/asyncio-eventloop.rst:1038 library/asyncio-eventloop.rst:1089 +#: library/asyncio-eventloop.rst:1131 library/asyncio-eventloop.rst:1185 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " "``async def`` method." msgstr "" -#: library/asyncio-eventloop.rst:1045 +#: library/asyncio-eventloop.rst:1139 msgid "" "Send a datagram from *sock* to *address*. Asynchronous version of :meth:" "`socket.sendto() `." msgstr "" -#: library/asyncio-eventloop.rst:1049 +#: library/asyncio-eventloop.rst:1143 msgid "Return the number of bytes sent." msgstr "" -#: library/asyncio-eventloop.rst:1057 +#: library/asyncio-eventloop.rst:1152 msgid "Connect *sock* to a remote socket at *address*." msgstr "" -#: library/asyncio-eventloop.rst:1059 +#: library/asyncio-eventloop.rst:1154 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr "" -#: library/asyncio-eventloop.rst:1063 +#: library/asyncio-eventloop.rst:1158 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " "check if the *address* is already resolved by calling :func:`socket." @@ -1318,19 +1446,19 @@ msgid "" "*address*." msgstr "" -#: library/asyncio-eventloop.rst:1072 +#: library/asyncio-eventloop.rst:1167 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." msgstr "" -#: library/asyncio-eventloop.rst:1078 +#: library/asyncio-eventloop.rst:1174 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." msgstr "" -#: library/asyncio-eventloop.rst:1081 +#: library/asyncio-eventloop.rst:1177 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1338,57 +1466,67 @@ msgid "" "the address bound to the socket on the other end of the connection." msgstr "" -#: library/asyncio-eventloop.rst:1096 +#: library/asyncio-eventloop.rst:1192 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr "" -#: library/asyncio-eventloop.rst:1101 +#: library/asyncio-eventloop.rst:1198 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" -#: library/asyncio-eventloop.rst:1104 +#: library/asyncio-eventloop.rst:1201 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr "" -#: library/asyncio-eventloop.rst:1106 +#: library/asyncio-eventloop.rst:1203 msgid "" "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." "socket`." msgstr "" -#: library/asyncio-eventloop.rst:1109 +#: library/asyncio-eventloop.rst:1206 msgid "*file* must be a regular file object open in binary mode." msgstr "" -#: library/asyncio-eventloop.rst:1118 +#: library/asyncio-eventloop.rst:1215 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " "or SSL socket on Unix)." msgstr "" -#: library/asyncio-eventloop.rst:1122 +#: library/asyncio-eventloop.rst:1219 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -#: library/asyncio-eventloop.rst:1131 +#: library/asyncio-eventloop.rst:1228 msgid "DNS" msgstr "" -#: library/asyncio-eventloop.rst:1136 +#: library/asyncio-eventloop.rst:1234 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr "" -#: library/asyncio-eventloop.rst:1140 +#: library/asyncio-eventloop.rst:1239 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr "" -#: library/asyncio-eventloop.rst:1142 +#: library/asyncio-eventloop.rst:1242 +msgid "" +"Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " +"versions through the loop's default thread pool executor. When this executor " +"is saturated, these methods may experience delays, which higher-level " +"networking libraries may report as increased timeouts. To mitigate this, " +"consider using a custom executor for other user tasks, or setting a default " +"executor with a larger number of workers." +msgstr "" + +#: library/asyncio-eventloop.rst:1249 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1396,66 +1534,66 @@ msgid "" "coroutines." msgstr "" -#: library/asyncio-eventloop.rst:1150 +#: library/asyncio-eventloop.rst:1257 msgid "Working with pipes" msgstr "" -#: library/asyncio-eventloop.rst:1154 +#: library/asyncio-eventloop.rst:1262 msgid "Register the read end of *pipe* in the event loop." msgstr "" -#: library/asyncio-eventloop.rst:1159 +#: library/asyncio-eventloop.rst:1267 msgid "*pipe* is a :term:`file-like object `." msgstr "" -#: library/asyncio-eventloop.rst:1161 +#: library/asyncio-eventloop.rst:1269 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports the :class:" "`ReadTransport` interface and *protocol* is an object instantiated by the " "*protocol_factory*." msgstr "" -#: library/asyncio-eventloop.rst:1165 library/asyncio-eventloop.rst:1181 +#: library/asyncio-eventloop.rst:1273 library/asyncio-eventloop.rst:1290 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "" -#: library/asyncio-eventloop.rst:1170 +#: library/asyncio-eventloop.rst:1279 msgid "Register the write end of *pipe* in the event loop." msgstr "" -#: library/asyncio-eventloop.rst:1175 +#: library/asyncio-eventloop.rst:1284 msgid "*pipe* is :term:`file-like object `." msgstr "" -#: library/asyncio-eventloop.rst:1177 +#: library/asyncio-eventloop.rst:1286 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports :class:" "`WriteTransport` interface and *protocol* is an object instantiated by the " "*protocol_factory*." msgstr "" -#: library/asyncio-eventloop.rst:1186 +#: library/asyncio-eventloop.rst:1295 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." msgstr "" -#: library/asyncio-eventloop.rst:1191 +#: library/asyncio-eventloop.rst:1300 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr "" -#: library/asyncio-eventloop.rst:1196 +#: library/asyncio-eventloop.rst:1305 msgid "Unix signals" msgstr "" -#: library/asyncio-eventloop.rst:1202 +#: library/asyncio-eventloop.rst:1311 msgid "Set *callback* as the handler for the *signum* signal." msgstr "" -#: library/asyncio-eventloop.rst:1204 +#: library/asyncio-eventloop.rst:1313 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1463,46 +1601,98 @@ msgid "" "function is allowed to interact with the event loop." msgstr "" -#: library/asyncio-eventloop.rst:1209 +#: library/asyncio-eventloop.rst:1318 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." msgstr "" -#: library/asyncio-eventloop.rst:1215 +#: library/asyncio-eventloop.rst:1324 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "" -#: library/asyncio-eventloop.rst:1220 +#: library/asyncio-eventloop.rst:1329 msgid "Remove the handler for the *sig* signal." msgstr "" -#: library/asyncio-eventloop.rst:1222 +#: library/asyncio-eventloop.rst:1331 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." msgstr "" -#: library/asyncio-eventloop.rst:1229 +#: library/asyncio-eventloop.rst:1338 msgid "The :mod:`signal` module." msgstr "" -#: library/asyncio-eventloop.rst:1233 +#: library/asyncio-eventloop.rst:1342 msgid "Executing code in thread or process pools" msgstr "" -#: library/asyncio-eventloop.rst:1237 +#: library/asyncio-eventloop.rst:1346 msgid "Arrange for *func* to be called in the specified executor." msgstr "" -#: library/asyncio-eventloop.rst:1239 +#: library/asyncio-eventloop.rst:1348 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " -"instance. The default executor is used if *executor* is ``None``." +"instance. The default executor is used if *executor* is ``None``. The " +"default executor can be set by :meth:`loop.set_default_executor`, otherwise, " +"a :class:`concurrent.futures.ThreadPoolExecutor` will be lazy-initialized " +"and used by :func:`run_in_executor` if needed." +msgstr "" + +#: library/asyncio-eventloop.rst:1356 +msgid "" +"import asyncio\n" +"import concurrent.futures\n" +"\n" +"def blocking_io():\n" +" # File operations (such as logging) can block the\n" +" # event loop: run them in a thread pool.\n" +" with open('/dev/urandom', 'rb') as f:\n" +" return f.read(100)\n" +"\n" +"def cpu_bound():\n" +" # CPU-bound operations will block the event loop:\n" +" # in general it is preferable to run them in a\n" +" # process pool.\n" +" return sum(i * i for i in range(10 ** 7))\n" +"\n" +"async def main():\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" ## Options:\n" +"\n" +" # 1. Run in the default loop's executor:\n" +" result = await loop.run_in_executor(\n" +" None, blocking_io)\n" +" print('default thread pool', result)\n" +"\n" +" # 2. Run in a custom thread pool:\n" +" with concurrent.futures.ThreadPoolExecutor() as pool:\n" +" result = await loop.run_in_executor(\n" +" pool, blocking_io)\n" +" print('custom thread pool', result)\n" +"\n" +" # 3. Run in a custom process pool:\n" +" with concurrent.futures.ProcessPoolExecutor() as pool:\n" +" result = await loop.run_in_executor(\n" +" pool, cpu_bound)\n" +" print('custom process pool', result)\n" +"\n" +" # 4. Run in a custom interpreter pool:\n" +" with concurrent.futures.InterpreterPoolExecutor() as pool:\n" +" result = await loop.run_in_executor(\n" +" pool, cpu_bound)\n" +" print('custom interpreter pool', result)\n" +"\n" +"if __name__ == '__main__':\n" +" asyncio.run(main())" msgstr "" -#: library/asyncio-eventloop.rst:1284 +#: library/asyncio-eventloop.rst:1402 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " @@ -1510,17 +1700,17 @@ msgid "" "importing of main module `." msgstr "" -#: library/asyncio-eventloop.rst:1289 +#: library/asyncio-eventloop.rst:1407 msgid "This method returns a :class:`asyncio.Future` object." msgstr "" -#: library/asyncio-eventloop.rst:1291 +#: library/asyncio-eventloop.rst:1409 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." msgstr "" -#: library/asyncio-eventloop.rst:1294 +#: library/asyncio-eventloop.rst:1412 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1528,32 +1718,33 @@ msgid "" "default." msgstr "" -#: library/asyncio-eventloop.rst:1303 +#: library/asyncio-eventloop.rst:1421 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance of :class:`~concurrent.futures." -"ThreadPoolExecutor`." +"ThreadPoolExecutor`, which includes :class:`~concurrent.futures." +"InterpreterPoolExecutor`." msgstr "" -#: library/asyncio-eventloop.rst:1307 +#: library/asyncio-eventloop.rst:1426 msgid "" "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" -#: library/asyncio-eventloop.rst:1313 +#: library/asyncio-eventloop.rst:1432 msgid "Error Handling API" msgstr "" -#: library/asyncio-eventloop.rst:1315 +#: library/asyncio-eventloop.rst:1434 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "" -#: library/asyncio-eventloop.rst:1319 +#: library/asyncio-eventloop.rst:1438 msgid "Set *handler* as the new event loop exception handler." msgstr "" -#: library/asyncio-eventloop.rst:1321 +#: library/asyncio-eventloop.rst:1440 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -1562,182 +1753,190 @@ msgid "" "(see :meth:`call_exception_handler` documentation for details about context)." msgstr "" -#: library/asyncio-eventloop.rst:1329 +#: library/asyncio-eventloop.rst:1448 msgid "" "If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" "`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " "task or callback handle." msgstr "" -#: library/asyncio-eventloop.rst:1335 +#: library/asyncio-eventloop.rst:1454 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." msgstr "" -#: library/asyncio-eventloop.rst:1340 +#: library/asyncio-eventloop.rst:1459 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" -#: library/asyncio-eventloop.rst:1347 +#: library/asyncio-eventloop.rst:1466 msgid "Default exception handler." msgstr "" -#: library/asyncio-eventloop.rst:1349 +#: library/asyncio-eventloop.rst:1468 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " "default handler behavior." msgstr "" -#: library/asyncio-eventloop.rst:1353 +#: library/asyncio-eventloop.rst:1472 msgid "" "*context* parameter has the same meaning as in :meth:" "`call_exception_handler`." msgstr "" -#: library/asyncio-eventloop.rst:1358 +#: library/asyncio-eventloop.rst:1477 msgid "Call the current event loop exception handler." msgstr "" -#: library/asyncio-eventloop.rst:1360 +#: library/asyncio-eventloop.rst:1479 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" msgstr "" -#: library/asyncio-eventloop.rst:1363 +#: library/asyncio-eventloop.rst:1482 msgid "'message': Error message;" msgstr "" -#: library/asyncio-eventloop.rst:1364 +#: library/asyncio-eventloop.rst:1483 msgid "'exception' (optional): Exception object;" msgstr "" -#: library/asyncio-eventloop.rst:1365 +#: library/asyncio-eventloop.rst:1484 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "" -#: library/asyncio-eventloop.rst:1366 +#: library/asyncio-eventloop.rst:1485 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "" -#: library/asyncio-eventloop.rst:1367 +#: library/asyncio-eventloop.rst:1486 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "" -#: library/asyncio-eventloop.rst:1368 +#: library/asyncio-eventloop.rst:1487 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "" -#: library/asyncio-eventloop.rst:1369 +#: library/asyncio-eventloop.rst:1488 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "" -#: library/asyncio-eventloop.rst:1370 +#: library/asyncio-eventloop.rst:1489 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "" -#: library/asyncio-eventloop.rst:1372 +#: library/asyncio-eventloop.rst:1490 +msgid "'source_traceback' (optional): Traceback of the source;" +msgstr "" + +#: library/asyncio-eventloop.rst:1491 +msgid "'handle_traceback' (optional): Traceback of the handle;" +msgstr "" + +#: library/asyncio-eventloop.rst:1492 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "" -#: library/asyncio-eventloop.rst:1372 +#: library/asyncio-eventloop.rst:1493 msgid "the exception." msgstr "" -#: library/asyncio-eventloop.rst:1376 +#: library/asyncio-eventloop.rst:1497 msgid "" "This method should not be overloaded in subclassed event loops. For custom " -"exception handling, use the :meth:`set_exception_handler()` method." +"exception handling, use the :meth:`set_exception_handler` method." msgstr "" -#: library/asyncio-eventloop.rst:1381 +#: library/asyncio-eventloop.rst:1502 msgid "Enabling debug mode" msgstr "" -#: library/asyncio-eventloop.rst:1385 +#: library/asyncio-eventloop.rst:1506 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "" -#: library/asyncio-eventloop.rst:1387 +#: library/asyncio-eventloop.rst:1508 msgid "" "The default value is ``True`` if the environment variable :envvar:" "`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." msgstr "" -#: library/asyncio-eventloop.rst:1393 +#: library/asyncio-eventloop.rst:1514 msgid "Set the debug mode of the event loop." msgstr "" -#: library/asyncio-eventloop.rst:1397 +#: library/asyncio-eventloop.rst:1518 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "" -#: library/asyncio-eventloop.rst:1402 +#: library/asyncio-eventloop.rst:1523 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " "are logged." msgstr "" -#: library/asyncio-eventloop.rst:1406 +#: library/asyncio-eventloop.rst:1527 msgid "Default value is 100 milliseconds." msgstr "" -#: library/asyncio-eventloop.rst:1410 +#: library/asyncio-eventloop.rst:1531 msgid "The :ref:`debug mode of asyncio `." msgstr "" -#: library/asyncio-eventloop.rst:1414 +#: library/asyncio-eventloop.rst:1535 msgid "Running Subprocesses" msgstr "" -#: library/asyncio-eventloop.rst:1416 +#: library/asyncio-eventloop.rst:1537 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " "and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" -#: library/asyncio-eventloop.rst:1423 +#: library/asyncio-eventloop.rst:1544 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" "`Subprocess Support on Windows ` for details." msgstr "" -#: library/asyncio-eventloop.rst:1434 +#: library/asyncio-eventloop.rst:1556 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "" -#: library/asyncio-eventloop.rst:1437 +#: library/asyncio-eventloop.rst:1559 msgid "*args* must be a list of strings represented by:" msgstr "" -#: library/asyncio-eventloop.rst:1439 +#: library/asyncio-eventloop.rst:1561 msgid ":class:`str`;" msgstr "" -#: library/asyncio-eventloop.rst:1440 +#: library/asyncio-eventloop.rst:1562 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "" -#: library/asyncio-eventloop.rst:1443 +#: library/asyncio-eventloop.rst:1565 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " "program." msgstr "" -#: library/asyncio-eventloop.rst:1447 +#: library/asyncio-eventloop.rst:1569 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -1745,81 +1944,81 @@ msgid "" "which is list of strings, *subprocess_exec* takes multiple string arguments." msgstr "" -#: library/asyncio-eventloop.rst:1453 +#: library/asyncio-eventloop.rst:1575 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`asyncio.SubprocessProtocol` class." msgstr "" -#: library/asyncio-eventloop.rst:1456 +#: library/asyncio-eventloop.rst:1578 msgid "Other parameters:" msgstr "" -#: library/asyncio-eventloop.rst:1458 +#: library/asyncio-eventloop.rst:1580 msgid "*stdin* can be any of these:" msgstr "" -#: library/asyncio-eventloop.rst:1460 library/asyncio-eventloop.rst:1471 -#: library/asyncio-eventloop.rst:1481 +#: library/asyncio-eventloop.rst:1582 library/asyncio-eventloop.rst:1593 +#: library/asyncio-eventloop.rst:1603 msgid "a file-like object" msgstr "" -#: library/asyncio-eventloop.rst:1461 +#: library/asyncio-eventloop.rst:1583 msgid "" "an existing file descriptor (a positive integer), for example those created " -"with :meth:`os.pipe()`" +"with :meth:`os.pipe`" msgstr "" -#: library/asyncio-eventloop.rst:1462 library/asyncio-eventloop.rst:1472 -#: library/asyncio-eventloop.rst:1482 +#: library/asyncio-eventloop.rst:1584 library/asyncio-eventloop.rst:1594 +#: library/asyncio-eventloop.rst:1604 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr "" -#: library/asyncio-eventloop.rst:1464 library/asyncio-eventloop.rst:1474 -#: library/asyncio-eventloop.rst:1484 +#: library/asyncio-eventloop.rst:1586 library/asyncio-eventloop.rst:1596 +#: library/asyncio-eventloop.rst:1606 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "" -#: library/asyncio-eventloop.rst:1466 library/asyncio-eventloop.rst:1476 -#: library/asyncio-eventloop.rst:1486 +#: library/asyncio-eventloop.rst:1588 library/asyncio-eventloop.rst:1598 +#: library/asyncio-eventloop.rst:1608 msgid "" "the :const:`subprocess.DEVNULL` constant which indicates that the special :" "data:`os.devnull` file will be used" msgstr "" -#: library/asyncio-eventloop.rst:1469 +#: library/asyncio-eventloop.rst:1591 msgid "*stdout* can be any of these:" msgstr "" -#: library/asyncio-eventloop.rst:1479 +#: library/asyncio-eventloop.rst:1601 msgid "*stderr* can be any of these:" msgstr "" -#: library/asyncio-eventloop.rst:1488 +#: library/asyncio-eventloop.rst:1610 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" -#: library/asyncio-eventloop.rst:1491 +#: library/asyncio-eventloop.rst:1613 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " "*encoding* and *errors*, which should not be specified at all." msgstr "" -#: library/asyncio-eventloop.rst:1496 +#: library/asyncio-eventloop.rst:1618 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " "the stream to text." msgstr "" -#: library/asyncio-eventloop.rst:1500 +#: library/asyncio-eventloop.rst:1622 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " "pipe, then the other side of this pipe should be registered with :meth:" @@ -1827,52 +2026,58 @@ msgid "" "the event loop." msgstr "" -#: library/asyncio-eventloop.rst:1505 +#: library/asyncio-eventloop.rst:1627 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "" -#: library/asyncio-eventloop.rst:1508 +#: library/asyncio-eventloop.rst:1630 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " "object instantiated by the *protocol_factory*." msgstr "" -#: library/asyncio-eventloop.rst:1516 +#: library/asyncio-eventloop.rst:1634 library/asyncio-eventloop.rst:1660 +msgid "" +"If the transport is closed or is garbage collected, the child process is " +"killed if it is still running." +msgstr "" + +#: library/asyncio-eventloop.rst:1642 msgid "" "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" "`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" -#: library/asyncio-eventloop.rst:1521 +#: library/asyncio-eventloop.rst:1647 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." msgstr "" -#: library/asyncio-eventloop.rst:1524 +#: library/asyncio-eventloop.rst:1650 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`SubprocessProtocol` class." msgstr "" -#: library/asyncio-eventloop.rst:1527 +#: library/asyncio-eventloop.rst:1653 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "" -#: library/asyncio-eventloop.rst:1530 +#: library/asyncio-eventloop.rst:1656 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " "instantiated by the *protocol_factory*." msgstr "" -#: library/asyncio-eventloop.rst:1535 +#: library/asyncio-eventloop.rst:1664 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -1882,116 +2087,158 @@ msgid "" "used to construct shell commands." msgstr "" -#: library/asyncio-eventloop.rst:1544 +#: library/asyncio-eventloop.rst:1673 msgid "Callback Handles" msgstr "" -#: library/asyncio-eventloop.rst:1548 +#: library/asyncio-eventloop.rst:1677 msgid "" "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." "call_soon_threadsafe`." msgstr "" -#: library/asyncio-eventloop.rst:1553 +#: library/asyncio-eventloop.rst:1682 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "" -#: library/asyncio-eventloop.rst:1560 +#: library/asyncio-eventloop.rst:1689 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "" -#: library/asyncio-eventloop.rst:1565 +#: library/asyncio-eventloop.rst:1694 msgid "Return ``True`` if the callback was cancelled." msgstr "" -#: library/asyncio-eventloop.rst:1571 +#: library/asyncio-eventloop.rst:1700 msgid "" "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" "`loop.call_at`." msgstr "" -#: library/asyncio-eventloop.rst:1574 +#: library/asyncio-eventloop.rst:1703 msgid "This class is a subclass of :class:`Handle`." msgstr "" -#: library/asyncio-eventloop.rst:1578 +#: library/asyncio-eventloop.rst:1707 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "" -#: library/asyncio-eventloop.rst:1580 +#: library/asyncio-eventloop.rst:1709 msgid "" "The time is an absolute timestamp, using the same time reference as :meth:" "`loop.time`." msgstr "" -#: library/asyncio-eventloop.rst:1587 +#: library/asyncio-eventloop.rst:1716 msgid "Server Objects" msgstr "" -#: library/asyncio-eventloop.rst:1589 +#: library/asyncio-eventloop.rst:1718 msgid "" "Server objects are created by :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " "functions." msgstr "" -#: library/asyncio-eventloop.rst:1593 +#: library/asyncio-eventloop.rst:1722 msgid "Do not instantiate the :class:`Server` class directly." msgstr "" -#: library/asyncio-eventloop.rst:1597 +#: library/asyncio-eventloop.rst:1726 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " "accepting new connections when the ``async with`` statement is completed::" msgstr "" -#: library/asyncio-eventloop.rst:1610 +#: library/asyncio-eventloop.rst:1731 +msgid "" +"srv = await loop.create_server(...)\n" +"\n" +"async with srv:\n" +" # some code\n" +"\n" +"# At this point, srv is closed and no longer accepts new connections." +msgstr "" + +#: library/asyncio-eventloop.rst:1739 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "" -#: library/asyncio-eventloop.rst:1613 +#: library/asyncio-eventloop.rst:1742 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" -#: library/asyncio-eventloop.rst:1618 +#: library/asyncio-eventloop.rst:1747 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "" -#: library/asyncio-eventloop.rst:1621 +#: library/asyncio-eventloop.rst:1750 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "" -#: library/asyncio-eventloop.rst:1624 +#: library/asyncio-eventloop.rst:1753 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." msgstr "" -#: library/asyncio-eventloop.rst:1630 +#: library/asyncio-eventloop.rst:1759 +msgid "Close all existing incoming client connections." +msgstr "" + +#: library/asyncio-eventloop.rst:1761 +msgid "" +"Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." +msgstr "" + +#: library/asyncio-eventloop.rst:1764 +msgid "" +":meth:`close` should be called before :meth:`close_clients` when closing the " +"server to avoid races with new clients connecting." +msgstr "" + +#: library/asyncio-eventloop.rst:1771 +msgid "" +"Close all existing incoming client connections immediately, without waiting " +"for pending operations to complete." +msgstr "" + +#: library/asyncio-eventloop.rst:1774 +msgid "" +"Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." +msgstr "" + +#: library/asyncio-eventloop.rst:1777 +msgid "" +":meth:`close` should be called before :meth:`abort_clients` when closing the " +"server to avoid races with new clients connecting." +msgstr "" + +#: library/asyncio-eventloop.rst:1784 msgid "Return the event loop associated with the server object." msgstr "" -#: library/asyncio-eventloop.rst:1636 +#: library/asyncio-eventloop.rst:1791 msgid "Start accepting connections." msgstr "" -#: library/asyncio-eventloop.rst:1638 +#: library/asyncio-eventloop.rst:1793 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "" -#: library/asyncio-eventloop.rst:1641 +#: library/asyncio-eventloop.rst:1796 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2000,100 +2247,134 @@ msgid "" "accepting connections." msgstr "" -#: library/asyncio-eventloop.rst:1652 +#: library/asyncio-eventloop.rst:1808 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" -#: library/asyncio-eventloop.rst:1656 +#: library/asyncio-eventloop.rst:1812 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." msgstr "" -#: library/asyncio-eventloop.rst:1678 +#: library/asyncio-eventloop.rst:1818 +msgid "" +"async def client_connected(reader, writer):\n" +" # Communicate with the client with\n" +" # reader/writer streams. For example:\n" +" await reader.readline()\n" +"\n" +"async def main(host, port):\n" +" srv = await asyncio.start_server(\n" +" client_connected, host, port)\n" +" await srv.serve_forever()\n" +"\n" +"asyncio.run(main('127.0.0.1', 0))" +msgstr "" + +#: library/asyncio-eventloop.rst:1834 msgid "Return ``True`` if the server is accepting new connections." msgstr "" -#: library/asyncio-eventloop.rst:1684 +#: library/asyncio-eventloop.rst:1841 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "" -#: library/asyncio-eventloop.rst:1689 +#: library/asyncio-eventloop.rst:1846 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" -#: library/asyncio-eventloop.rst:1692 +#: library/asyncio-eventloop.rst:1849 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." msgstr "" -#: library/asyncio-eventloop.rst:1702 +#: library/asyncio-eventloop.rst:1859 msgid "Event Loop Implementations" msgstr "" -#: library/asyncio-eventloop.rst:1704 +#: library/asyncio-eventloop.rst:1861 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" -#: library/asyncio-eventloop.rst:1707 -msgid "" -"By default asyncio is configured to use :class:`SelectorEventLoop` on Unix " -"and :class:`ProactorEventLoop` on Windows." +#: library/asyncio-eventloop.rst:1864 +msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "" -#: library/asyncio-eventloop.rst:1713 -msgid "An event loop based on the :mod:`selectors` module." +#: library/asyncio-eventloop.rst:1869 +msgid "" +"A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " +"module." msgstr "" -#: library/asyncio-eventloop.rst:1715 +#: library/asyncio-eventloop.rst:1872 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " "used::" msgstr "" -#: library/asyncio-eventloop.rst:1730 -msgid ":ref:`Availability `: Unix, Windows." +#: library/asyncio-eventloop.rst:1876 +msgid "" +"import asyncio\n" +"import selectors\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"loop_factory = lambda: asyncio.SelectorEventLoop(selectors." +"SelectSelector())\n" +"asyncio.run(main(), loop_factory=loop_factory)" msgstr "" -#: library/asyncio-eventloop.rst:1735 -msgid "An event loop for Windows that uses \"I/O Completion Ports\" (IOCP)." +#: library/asyncio-eventloop.rst:1891 +msgid "" +"A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " +"Completion Ports\" (IOCP)." msgstr "" -#: library/asyncio-eventloop.rst:1737 -msgid ":ref:`Availability `: Windows." +#: library/asyncio-eventloop.rst:1897 +msgid "" +"`MSDN documentation on I/O Completion Ports `_." msgstr "" -#: library/asyncio-eventloop.rst:1741 +#: library/asyncio-eventloop.rst:1902 msgid "" -"`MSDN documentation on I/O Completion Ports `_." +"An alias to the most efficient available subclass of :class:" +"`AbstractEventLoop` for the given platform." msgstr "" -#: library/asyncio-eventloop.rst:1747 +#: library/asyncio-eventloop.rst:1905 +msgid "" +"It is an alias to :class:`SelectorEventLoop` on Unix and :class:" +"`ProactorEventLoop` on Windows." +msgstr "" + +#: library/asyncio-eventloop.rst:1911 msgid "Abstract base class for asyncio-compliant event loops." msgstr "" -#: library/asyncio-eventloop.rst:1749 +#: library/asyncio-eventloop.rst:1913 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." msgstr "" -#: library/asyncio-eventloop.rst:1755 +#: library/asyncio-eventloop.rst:1919 msgid "Examples" msgstr "" -#: library/asyncio-eventloop.rst:1757 +#: library/asyncio-eventloop.rst:1921 msgid "" "Note that all examples in this section **purposefully** show how to use the " "low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." @@ -2101,71 +2382,180 @@ msgid "" "consider using the high-level functions like :func:`asyncio.run`." msgstr "" -#: library/asyncio-eventloop.rst:1767 +#: library/asyncio-eventloop.rst:1931 msgid "Hello World with call_soon()" msgstr "" -#: library/asyncio-eventloop.rst:1769 +#: library/asyncio-eventloop.rst:1933 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" msgstr "" -#: library/asyncio-eventloop.rst:1793 +#: library/asyncio-eventloop.rst:1937 +msgid "" +"import asyncio\n" +"\n" +"def hello_world(loop):\n" +" \"\"\"A callback to print 'Hello World' and stop the event loop\"\"\"\n" +" print('Hello World')\n" +" loop.stop()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"# Schedule a call to hello_world()\n" +"loop.call_soon(hello_world, loop)\n" +"\n" +"# Blocking call interrupted by loop.stop()\n" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.close()" +msgstr "" + +#: library/asyncio-eventloop.rst:1957 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" -#: library/asyncio-eventloop.rst:1800 +#: library/asyncio-eventloop.rst:1964 msgid "Display the current date with call_later()" msgstr "" -#: library/asyncio-eventloop.rst:1802 +#: library/asyncio-eventloop.rst:1966 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " "5 seconds, and then stops the event loop::" msgstr "" -#: library/asyncio-eventloop.rst:1830 +#: library/asyncio-eventloop.rst:1970 +msgid "" +"import asyncio\n" +"import datetime\n" +"\n" +"def display_date(end_time, loop):\n" +" print(datetime.datetime.now())\n" +" if (loop.time() + 1.0) < end_time:\n" +" loop.call_later(1, display_date, end_time, loop)\n" +" else:\n" +" loop.stop()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"# Schedule the first call to display_date()\n" +"end_time = loop.time() + 5.0\n" +"loop.call_soon(display_date, end_time, loop)\n" +"\n" +"# Blocking call interrupted by loop.stop()\n" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.close()" +msgstr "" + +#: library/asyncio-eventloop.rst:1994 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." msgstr "" -#: library/asyncio-eventloop.rst:1837 +#: library/asyncio-eventloop.rst:2001 msgid "Watch a file descriptor for read events" msgstr "" -#: library/asyncio-eventloop.rst:1839 +#: library/asyncio-eventloop.rst:2003 msgid "" "Wait until a file descriptor received some data using the :meth:`loop." "add_reader` method and then close the event loop::" msgstr "" -#: library/asyncio-eventloop.rst:1877 +#: library/asyncio-eventloop.rst:2006 +msgid "" +"import asyncio\n" +"from socket import socketpair\n" +"\n" +"# Create a pair of connected file descriptors\n" +"rsock, wsock = socketpair()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"def reader():\n" +" data = rsock.recv(100)\n" +" print(\"Received:\", data.decode())\n" +"\n" +" # We are done: unregister the file descriptor\n" +" loop.remove_reader(rsock)\n" +"\n" +" # Stop the event loop\n" +" loop.stop()\n" +"\n" +"# Register the file descriptor for read event\n" +"loop.add_reader(rsock, reader)\n" +"\n" +"# Simulate the reception of data from the network\n" +"loop.call_soon(wsock.send, 'abc'.encode())\n" +"\n" +"try:\n" +" # Run the event loop\n" +" loop.run_forever()\n" +"finally:\n" +" # We are done. Close sockets and the event loop.\n" +" rsock.close()\n" +" wsock.close()\n" +" loop.close()" +msgstr "" + +#: library/asyncio-eventloop.rst:2041 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." msgstr "" -#: library/asyncio-eventloop.rst:1881 +#: library/asyncio-eventloop.rst:2045 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." msgstr "" -#: library/asyncio-eventloop.rst:1889 +#: library/asyncio-eventloop.rst:2053 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "" -#: library/asyncio-eventloop.rst:1891 +#: library/asyncio-eventloop.rst:2055 msgid "(This ``signals`` example only works on Unix.)" msgstr "" -#: library/asyncio-eventloop.rst:1893 +#: library/asyncio-eventloop.rst:2057 msgid "" "Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." "SIGTERM` using the :meth:`loop.add_signal_handler` method::" msgstr "" + +#: library/asyncio-eventloop.rst:2060 +msgid "" +"import asyncio\n" +"import functools\n" +"import os\n" +"import signal\n" +"\n" +"def ask_exit(signame, loop):\n" +" print(\"got signal %s: exit\" % signame)\n" +" loop.stop()\n" +"\n" +"async def main():\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" for signame in {'SIGINT', 'SIGTERM'}:\n" +" loop.add_signal_handler(\n" +" getattr(signal, signame),\n" +" functools.partial(ask_exit, signame, loop))\n" +"\n" +" await asyncio.sleep(3600)\n" +"\n" +"print(\"Event loop running for 1 hour, press Ctrl+C to interrupt.\")\n" +"print(f\"pid {os.getpid()}: send SIGINT or SIGTERM to exit.\")\n" +"\n" +"asyncio.run(main())" +msgstr "" diff --git a/library/asyncio-exceptions.po b/library/asyncio-exceptions.po index 6beed70f..dba0da62 100644 --- a/library/asyncio-exceptions.po +++ b/library/asyncio-exceptions.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/asyncio-extending.po b/library/asyncio-extending.po index a6f04f25..d270ca73 100644 --- a/library/asyncio-extending.po +++ b/library/asyncio-extending.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index bababb9a..88a061f8 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -81,63 +82,64 @@ msgstr "" #: library/asyncio-future.rst:54 msgid "" -"See also the :func:`create_task` function which is the preferred way for " -"creating new Tasks." +"Save a reference to the result of this function, to avoid a task " +"disappearing mid-execution." msgstr "" #: library/asyncio-future.rst:57 msgid "" -"Save a reference to the result of this function, to avoid a task " -"disappearing mid-execution." +"See also the :func:`create_task` function which is the preferred way for " +"creating new tasks or use :class:`asyncio.TaskGroup` which keeps reference " +"to the task internally." msgstr "" -#: library/asyncio-future.rst:60 +#: library/asyncio-future.rst:61 msgid "The function accepts any :term:`awaitable` object." msgstr "" -#: library/asyncio-future.rst:63 +#: library/asyncio-future.rst:64 msgid "" "Deprecation warning is emitted if *obj* is not a Future-like object and " "*loop* is not specified and there is no running event loop." msgstr "" -#: library/asyncio-future.rst:70 +#: library/asyncio-future.rst:71 msgid "" "Wrap a :class:`concurrent.futures.Future` object in a :class:`asyncio." "Future` object." msgstr "" -#: library/asyncio-future.rst:73 +#: library/asyncio-future.rst:74 msgid "" "Deprecation warning is emitted if *future* is not a Future-like object and " "*loop* is not specified and there is no running event loop." msgstr "" -#: library/asyncio-future.rst:79 +#: library/asyncio-future.rst:81 msgid "Future Object" msgstr "" -#: library/asyncio-future.rst:83 +#: library/asyncio-future.rst:85 msgid "" "A Future represents an eventual result of an asynchronous operation. Not " "thread-safe." msgstr "" -#: library/asyncio-future.rst:86 +#: library/asyncio-future.rst:88 msgid "" "Future is an :term:`awaitable` object. Coroutines can await on Future " "objects until they either have a result or an exception set, or until they " "are cancelled. A Future can be awaited multiple times and the result is same." msgstr "" -#: library/asyncio-future.rst:91 +#: library/asyncio-future.rst:93 msgid "" "Typically Futures are used to enable low-level callback-based code (e.g. in " "protocols implemented using asyncio :ref:`transports `) to interoperate with high-level async/await code." msgstr "" -#: library/asyncio-future.rst:96 +#: library/asyncio-future.rst:98 msgid "" "The rule of thumb is to never expose Future objects in user-facing APIs, and " "the recommended way to create a Future object is to call :meth:`loop." @@ -145,198 +147,242 @@ msgid "" "their own optimized implementations of a Future object." msgstr "" -#: library/asyncio-future.rst:102 +#: library/asyncio-future.rst:104 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: library/asyncio-future.rst:105 +#: library/asyncio-future.rst:107 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: library/asyncio-future.rst:111 +#: library/asyncio-future.rst:113 msgid "Return the result of the Future." msgstr "" -#: library/asyncio-future.rst:113 +#: library/asyncio-future.rst:115 msgid "" "If the Future is *done* and has a result set by the :meth:`set_result` " "method, the result value is returned." msgstr "" -#: library/asyncio-future.rst:116 +#: library/asyncio-future.rst:118 msgid "" "If the Future is *done* and has an exception set by the :meth:" "`set_exception` method, this method raises the exception." msgstr "" -#: library/asyncio-future.rst:207 +#: library/asyncio-future.rst:209 msgid "" "If the Future has been *cancelled*, this method raises a :exc:" "`CancelledError` exception." msgstr "" -#: library/asyncio-future.rst:122 +#: library/asyncio-future.rst:124 msgid "" -"If the Future's result isn't yet available, this method raises a :exc:" +"If the Future's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: library/asyncio-future.rst:127 +#: library/asyncio-future.rst:129 msgid "Mark the Future as *done* and set its result." msgstr "" -#: library/asyncio-future.rst:136 +#: library/asyncio-future.rst:138 msgid "" -"Raises a :exc:`InvalidStateError` error if the Future is already *done*." +"Raises an :exc:`InvalidStateError` error if the Future is already *done*." msgstr "" -#: library/asyncio-future.rst:134 +#: library/asyncio-future.rst:136 msgid "Mark the Future as *done* and set an exception." msgstr "" -#: library/asyncio-future.rst:141 +#: library/asyncio-future.rst:143 msgid "Return ``True`` if the Future is *done*." msgstr "" -#: library/asyncio-future.rst:143 +#: library/asyncio-future.rst:145 msgid "" "A Future is *done* if it was *cancelled* or if it has a result or an " "exception set with :meth:`set_result` or :meth:`set_exception` calls." msgstr "" -#: library/asyncio-future.rst:149 +#: library/asyncio-future.rst:151 msgid "Return ``True`` if the Future was *cancelled*." msgstr "" -#: library/asyncio-future.rst:151 +#: library/asyncio-future.rst:153 msgid "" "The method is usually used to check if a Future is not *cancelled* before " "setting a result or an exception for it::" msgstr "" -#: library/asyncio-future.rst:159 -msgid "Add a callback to be run when the Future is *done*." +#: library/asyncio-future.rst:156 +msgid "" +"if not fut.cancelled():\n" +" fut.set_result(42)" msgstr "" #: library/asyncio-future.rst:161 +msgid "Add a callback to be run when the Future is *done*." +msgstr "" + +#: library/asyncio-future.rst:163 msgid "The *callback* is called with the Future object as its only argument." msgstr "" -#: library/asyncio-future.rst:164 +#: library/asyncio-future.rst:166 msgid "" "If the Future is already *done* when this method is called, the callback is " "scheduled with :meth:`loop.call_soon`." msgstr "" -#: library/asyncio-future.rst:167 +#: library/asyncio-future.rst:169 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *callback* to run in. The current " "context is used when no *context* is provided." msgstr "" -#: library/asyncio-future.rst:171 +#: library/asyncio-future.rst:173 msgid "" ":func:`functools.partial` can be used to pass parameters to the callback, e." "g.::" msgstr "" -#: library/asyncio-future.rst:178 +#: library/asyncio-future.rst:176 +msgid "" +"# Call 'print(\"Future:\", fut)' when \"fut\" is done.\n" +"fut.add_done_callback(\n" +" functools.partial(print, \"Future:\"))" +msgstr "" + +#: library/asyncio-future.rst:180 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "" -#: library/asyncio-future.rst:184 +#: library/asyncio-future.rst:186 msgid "Remove *callback* from the callbacks list." msgstr "" -#: library/asyncio-future.rst:186 +#: library/asyncio-future.rst:188 msgid "" "Returns the number of callbacks removed, which is typically 1, unless a " "callback was added more than once." msgstr "" -#: library/asyncio-future.rst:191 +#: library/asyncio-future.rst:193 msgid "Cancel the Future and schedule callbacks." msgstr "" -#: library/asyncio-future.rst:193 +#: library/asyncio-future.rst:195 msgid "" "If the Future is already *done* or *cancelled*, return ``False``. Otherwise, " "change the Future's state to *cancelled*, schedule the callbacks, and return " "``True``." msgstr "" -#: library/asyncio-future.rst:197 +#: library/asyncio-future.rst:199 msgid "Added the *msg* parameter." msgstr "" -#: library/asyncio-future.rst:202 +#: library/asyncio-future.rst:204 msgid "Return the exception that was set on this Future." msgstr "" -#: library/asyncio-future.rst:204 +#: library/asyncio-future.rst:206 msgid "" "The exception (or ``None`` if no exception was set) is returned only if the " "Future is *done*." msgstr "" -#: library/asyncio-future.rst:210 +#: library/asyncio-future.rst:212 msgid "" "If the Future isn't *done* yet, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: library/asyncio-future.rst:215 +#: library/asyncio-future.rst:217 msgid "Return the event loop the Future object is bound to." msgstr "" -#: library/asyncio-future.rst:222 +#: library/asyncio-future.rst:224 msgid "" "This example creates a Future object, creates and schedules an asynchronous " "Task to set result for the Future, and waits until the Future has a result::" msgstr "" -#: library/asyncio-future.rst:257 +#: library/asyncio-future.rst:228 +msgid "" +"async def set_after(fut, delay, value):\n" +" # Sleep for *delay* seconds.\n" +" await asyncio.sleep(delay)\n" +"\n" +" # Set *value* as a result of *fut* Future.\n" +" fut.set_result(value)\n" +"\n" +"async def main():\n" +" # Get the current event loop.\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" # Create a new Future object.\n" +" fut = loop.create_future()\n" +"\n" +" # Run \"set_after()\" coroutine in a parallel Task.\n" +" # We are using the low-level \"loop.create_task()\" API here because\n" +" # we already have a reference to the event loop at hand.\n" +" # Otherwise we could have just used \"asyncio.create_task()\".\n" +" loop.create_task(\n" +" set_after(fut, 1, '... world'))\n" +"\n" +" print('hello ...')\n" +"\n" +" # Wait until *fut* has a result (1 second) and print it.\n" +" print(await fut)\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-future.rst:259 msgid "" "The Future object was designed to mimic :class:`concurrent.futures.Future`. " "Key differences include:" msgstr "" -#: library/asyncio-future.rst:260 +#: library/asyncio-future.rst:262 msgid "" "unlike asyncio Futures, :class:`concurrent.futures.Future` instances cannot " "be awaited." msgstr "" -#: library/asyncio-future.rst:263 +#: library/asyncio-future.rst:265 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` do not " "accept the *timeout* argument." msgstr "" -#: library/asyncio-future.rst:266 +#: library/asyncio-future.rst:268 msgid "" ":meth:`asyncio.Future.result` and :meth:`asyncio.Future.exception` raise an :" "exc:`InvalidStateError` exception when the Future is not *done*." msgstr "" -#: library/asyncio-future.rst:270 +#: library/asyncio-future.rst:272 msgid "" "Callbacks registered with :meth:`asyncio.Future.add_done_callback` are not " "called immediately. They are scheduled with :meth:`loop.call_soon` instead." msgstr "" -#: library/asyncio-future.rst:274 +#: library/asyncio-future.rst:276 msgid "" "asyncio Future is not compatible with the :func:`concurrent.futures.wait` " "and :func:`concurrent.futures.as_completed` functions." msgstr "" -#: library/asyncio-future.rst:278 +#: library/asyncio-future.rst:280 msgid "" ":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :" "meth:`concurrent.futures.Future.cancel` does not." diff --git a/library/asyncio-graph.po b/library/asyncio-graph.po new file mode 100644 index 00000000..48422017 --- /dev/null +++ b/library/asyncio-graph.po @@ -0,0 +1,201 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/asyncio-graph.rst:8 +msgid "Call Graph Introspection" +msgstr "" + +#: library/asyncio-graph.rst:10 +msgid "**Source code:** :source:`Lib/asyncio/graph.py`" +msgstr "" + +#: library/asyncio-graph.rst:14 +msgid "" +"asyncio has powerful runtime call graph introspection utilities to trace the " +"entire call graph of a running *coroutine* or *task*, or a suspended " +"*future*. These utilities and the underlying machinery can be used from " +"within a Python program or by external profilers and debuggers." +msgstr "" + +#: library/asyncio-graph.rst:25 +msgid "" +"Print the async call graph for the current task or the provided :class:" +"`Task` or :class:`Future`." +msgstr "" + +#: library/asyncio-graph.rst:28 +msgid "" +"This function prints entries starting from the top frame and going down " +"towards the invocation point." +msgstr "" + +#: library/asyncio-graph.rst:31 +msgid "" +"The function receives an optional *future* argument. If not passed, the " +"current running task will be used." +msgstr "" + +#: library/asyncio-graph.rst:93 +msgid "" +"If the function is called on *the current task*, the optional keyword-only " +"*depth* argument can be used to skip the specified number of frames from top " +"of the stack." +msgstr "" + +#: library/asyncio-graph.rst:38 +msgid "" +"If the optional keyword-only *limit* argument is provided, each call stack " +"in the resulting graph is truncated to include at most ``abs(limit)`` " +"entries. If *limit* is positive, the entries left are the closest to the " +"invocation point. If *limit* is negative, the topmost entries are left. If " +"*limit* is omitted or ``None``, all entries are present. If *limit* is " +"``0``, the call stack is not printed at all, only \"awaited by\" information " +"is printed." +msgstr "" + +#: library/asyncio-graph.rst:46 +msgid "" +"If *file* is omitted or ``None``, the function will print to :data:`sys." +"stdout`." +msgstr "" + +#: library/asyncio-graph.rst:49 +msgid "**Example:**" +msgstr "" + +#: library/asyncio-graph.rst:51 +msgid "The following Python code:" +msgstr "" + +#: library/asyncio-graph.rst:53 +msgid "" +"import asyncio\n" +"\n" +"async def test():\n" +" asyncio.print_call_graph()\n" +"\n" +"async def main():\n" +" async with asyncio.TaskGroup() as g:\n" +" g.create_task(test(), name='test')\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-graph.rst:66 +msgid "will print::" +msgstr "" + +#: library/asyncio-graph.rst:68 +msgid "" +"* Task(name='test', id=0x1039f0fe0)\n" +"+ Call stack:\n" +"| File 't2.py', line 4, in async test()\n" +"+ Awaited by:\n" +" * Task(name='Task-1', id=0x103a5e060)\n" +" + Call stack:\n" +" | File 'taskgroups.py', line 107, in async TaskGroup.__aexit__()\n" +" | File 't2.py', line 7, in async main()" +msgstr "" + +#: library/asyncio-graph.rst:79 +msgid "" +"Like :func:`print_call_graph`, but returns a string. If *future* is ``None`` " +"and there's no current task, the function returns an empty string." +msgstr "" + +#: library/asyncio-graph.rst:86 +msgid "" +"Capture the async call graph for the current task or the provided :class:" +"`Task` or :class:`Future`." +msgstr "" + +#: library/asyncio-graph.rst:89 +msgid "" +"The function receives an optional *future* argument. If not passed, the " +"current running task will be used. If there's no current task, the function " +"returns ``None``." +msgstr "" + +#: library/asyncio-graph.rst:97 +msgid "Returns a ``FutureCallGraph`` data class object:" +msgstr "" + +#: library/asyncio-graph.rst:99 +msgid "``FutureCallGraph(future, call_stack, awaited_by)``" +msgstr "" + +#: library/asyncio-graph.rst:101 +msgid "" +"Where *future* is a reference to a :class:`Future` or a :class:`Task` (or " +"their subclasses.)" +msgstr "" + +#: library/asyncio-graph.rst:104 +msgid "``call_stack`` is a tuple of ``FrameCallGraphEntry`` objects." +msgstr "" + +#: library/asyncio-graph.rst:106 +msgid "``awaited_by`` is a tuple of ``FutureCallGraph`` objects." +msgstr "" + +#: library/asyncio-graph.rst:108 +msgid "``FrameCallGraphEntry(frame)``" +msgstr "" + +#: library/asyncio-graph.rst:110 +msgid "" +"Where *frame* is a frame object of a regular Python function in the call " +"stack." +msgstr "" + +#: library/asyncio-graph.rst:115 +msgid "Low level utility functions" +msgstr "" + +#: library/asyncio-graph.rst:117 +msgid "" +"To introspect an async call graph asyncio requires cooperation from control " +"flow structures, such as :func:`shield` or :class:`TaskGroup`. Any time an " +"intermediate :class:`Future` object with low-level APIs like :meth:`Future." +"add_done_callback() ` is involved, the " +"following two functions should be used to inform asyncio about how exactly " +"such intermediate future objects are connected with the tasks they wrap or " +"control." +msgstr "" + +#: library/asyncio-graph.rst:128 +msgid "Record that *future* is awaited on by *waiter*." +msgstr "" + +#: library/asyncio-graph.rst:143 +msgid "" +"Both *future* and *waiter* must be instances of :class:`Future` or :class:" +"`Task` or their subclasses, otherwise the call would have no effect." +msgstr "" + +#: library/asyncio-graph.rst:134 +msgid "" +"A call to ``future_add_to_awaited_by()`` must be followed by an eventual " +"call to the :func:`future_discard_from_awaited_by` function with the same " +"arguments." +msgstr "" + +#: library/asyncio-graph.rst:141 +msgid "Record that *future* is no longer awaited on by *waiter*." +msgstr "" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index 14315d66..346c31fc 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -115,7 +116,7 @@ msgid "Close the event loop." msgstr "" #: library/asyncio-llapi-index.rst:59 -msgid ":meth:`loop.is_running()`" +msgid ":meth:`loop.is_running`" msgstr "" #: library/asyncio-llapi-index.rst:60 @@ -123,7 +124,7 @@ msgid "Return ``True`` if the event loop is running." msgstr "" #: library/asyncio-llapi-index.rst:62 -msgid ":meth:`loop.is_closed()`" +msgid ":meth:`loop.is_closed`" msgstr "" #: library/asyncio-llapi-index.rst:63 @@ -195,7 +196,7 @@ msgid "Invoke a callback *at* the given time." msgstr "" #: library/asyncio-llapi-index.rst:99 -msgid "Thread/Process Pool" +msgid "Thread/Interpreter/Process Pool" msgstr "" #: library/asyncio-llapi-index.rst:104 diff --git a/library/asyncio-platforms.po b/library/asyncio-platforms.po index 9200d082..7f6e536b 100644 --- a/library/asyncio-platforms.po +++ b/library/asyncio-platforms.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -124,26 +125,19 @@ msgid "" "subprocesses, whereas :class:`SelectorEventLoop` does not." msgstr "" -#: library/asyncio-platforms.rst:80 -msgid "" -"The :meth:`policy.set_child_watcher() ` function is also not supported, as :class:" -"`ProactorEventLoop` has a different mechanism to watch child processes." -msgstr "" - -#: library/asyncio-platforms.rst:87 +#: library/asyncio-platforms.rst:82 msgid "macOS" msgstr "" -#: library/asyncio-platforms.rst:89 +#: library/asyncio-platforms.rst:84 msgid "Modern macOS versions are fully supported." msgstr "" -#: library/asyncio-platforms.rst:92 +#: library/asyncio-platforms.rst:87 msgid "macOS <= 10.8" msgstr "" -#: library/asyncio-platforms.rst:93 +#: library/asyncio-platforms.rst:88 msgid "" "On macOS 10.6, 10.7 and 10.8, the default event loop uses :class:`selectors." "KqueueSelector`, which does not support character devices on these " @@ -151,3 +145,13 @@ msgid "" "class:`~selectors.SelectSelector` or :class:`~selectors.PollSelector` to " "support character devices on these older versions of macOS. Example::" msgstr "" + +#: library/asyncio-platforms.rst:95 +msgid "" +"import asyncio\n" +"import selectors\n" +"\n" +"selector = selectors.SelectSelector()\n" +"loop = asyncio.SelectorEventLoop(selector)\n" +"asyncio.set_event_loop(loop)" +msgstr "" diff --git a/library/asyncio-policy.po b/library/asyncio-policy.po index 94008f82..5d6b0a7f 100644 --- a/library/asyncio-policy.po +++ b/library/asyncio-policy.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -20,7 +21,14 @@ msgstr "" msgid "Policies" msgstr "" -#: library/asyncio-policy.rst:10 +#: library/asyncio-policy.rst:12 +msgid "" +"Policies are deprecated and will be removed in Python 3.16. Users are " +"encouraged to use the :func:`asyncio.run` function or the :class:`asyncio." +"Runner` with *loop_factory* to use the desired loop implementation." +msgstr "" + +#: library/asyncio-policy.rst:18 msgid "" "An event loop policy is a global object used to get and set the current :ref:" "`event loop `, as well as create new event loops. The " @@ -30,356 +38,182 @@ msgid "" "policies>` that can override these behaviors." msgstr "" -#: library/asyncio-policy.rst:19 +#: library/asyncio-policy.rst:27 msgid "" "The :ref:`policy object ` gets and sets a separate " "event loop per *context*. This is per-thread by default, though custom " "policies could define *context* differently." msgstr "" -#: library/asyncio-policy.rst:24 +#: library/asyncio-policy.rst:32 msgid "" "Custom event loop policies can control the behavior of :func:" "`get_event_loop`, :func:`set_event_loop`, and :func:`new_event_loop`." msgstr "" -#: library/asyncio-policy.rst:27 +#: library/asyncio-policy.rst:35 msgid "" "Policy objects should implement the APIs defined in the :class:" "`AbstractEventLoopPolicy` abstract base class." msgstr "" -#: library/asyncio-policy.rst:34 +#: library/asyncio-policy.rst:42 msgid "Getting and Setting the Policy" msgstr "" -#: library/asyncio-policy.rst:36 +#: library/asyncio-policy.rst:44 msgid "" "The following functions can be used to get and set the policy for the " "current process:" msgstr "" -#: library/asyncio-policy.rst:41 +#: library/asyncio-policy.rst:49 msgid "Return the current process-wide policy." msgstr "" -#: library/asyncio-policy.rst:45 +#: library/asyncio-policy.rst:51 +msgid "" +"The :func:`get_event_loop_policy` function is deprecated and will be removed " +"in Python 3.16." +msgstr "" + +#: library/asyncio-policy.rst:57 msgid "Set the current process-wide policy to *policy*." msgstr "" -#: library/asyncio-policy.rst:47 +#: library/asyncio-policy.rst:59 msgid "If *policy* is set to ``None``, the default policy is restored." msgstr "" -#: library/asyncio-policy.rst:53 +#: library/asyncio-policy.rst:61 +msgid "" +"The :func:`set_event_loop_policy` function is deprecated and will be removed " +"in Python 3.16." +msgstr "" + +#: library/asyncio-policy.rst:69 msgid "Policy Objects" msgstr "" -#: library/asyncio-policy.rst:55 +#: library/asyncio-policy.rst:71 msgid "The abstract event loop policy base class is defined as follows:" msgstr "" -#: library/asyncio-policy.rst:59 +#: library/asyncio-policy.rst:75 msgid "An abstract base class for asyncio policies." msgstr "" -#: library/asyncio-policy.rst:63 +#: library/asyncio-policy.rst:79 msgid "Get the event loop for the current context." msgstr "" -#: library/asyncio-policy.rst:65 +#: library/asyncio-policy.rst:81 msgid "" "Return an event loop object implementing the :class:`AbstractEventLoop` " "interface." msgstr "" -#: library/asyncio-policy.rst:80 +#: library/asyncio-policy.rst:96 msgid "This method should never return ``None``." msgstr "" -#: library/asyncio-policy.rst:74 +#: library/asyncio-policy.rst:90 msgid "Set the event loop for the current context to *loop*." msgstr "" -#: library/asyncio-policy.rst:78 +#: library/asyncio-policy.rst:94 msgid "Create and return a new event loop object." msgstr "" -#: library/asyncio-policy.rst:84 -msgid "Get a child process watcher object." -msgstr "" - -#: library/asyncio-policy.rst:86 +#: library/asyncio-policy.rst:98 msgid "" -"Return a watcher object implementing the :class:`AbstractChildWatcher` " -"interface." -msgstr "" - -#: library/asyncio-policy.rst:97 -msgid "This function is Unix specific." +"The :class:`AbstractEventLoopPolicy` class is deprecated and will be removed " +"in Python 3.16." msgstr "" -#: library/asyncio-policy.rst:95 -msgid "Set the current child process watcher to *watcher*." -msgstr "" - -#: library/asyncio-policy.rst:104 +#: library/asyncio-policy.rst:105 msgid "asyncio ships with the following built-in policies:" msgstr "" -#: library/asyncio-policy.rst:109 +#: library/asyncio-policy.rst:110 msgid "" "The default asyncio policy. Uses :class:`SelectorEventLoop` on Unix and :" "class:`ProactorEventLoop` on Windows." msgstr "" -#: library/asyncio-policy.rst:112 +#: library/asyncio-policy.rst:113 msgid "" "There is no need to install the default policy manually. asyncio is " "configured to use the default policy automatically." msgstr "" -#: library/asyncio-policy.rst:117 +#: library/asyncio-policy.rst:118 msgid "On Windows, :class:`ProactorEventLoop` is now used by default." msgstr "" -#: library/asyncio-policy.rst:119 +#: library/asyncio-policy.rst:120 msgid "" -"The :meth:`get_event_loop` method of the default asyncio policy now emits a :" -"exc:`DeprecationWarning` if there is no current event loop set and it " -"decides to create one. In some future Python release this will become an " -"error." +"The :meth:`get_event_loop` method of the default asyncio policy now raises " +"a :exc:`RuntimeError` if there is no set event loop." msgstr "" -#: library/asyncio-policy.rst:128 +#: library/asyncio-policy.rst:124 msgid "" -"An alternative event loop policy that uses the :class:`SelectorEventLoop` " -"event loop implementation." +"The :class:`DefaultEventLoopPolicy` class is deprecated and will be removed " +"in Python 3.16." msgstr "" -#: library/asyncio-policy.rst:139 -msgid ":ref:`Availability `: Windows." -msgstr "" - -#: library/asyncio-policy.rst:136 +#: library/asyncio-policy.rst:131 msgid "" -"An alternative event loop policy that uses the :class:`ProactorEventLoop` " +"An alternative event loop policy that uses the :class:`SelectorEventLoop` " "event loop implementation." msgstr "" -#: library/asyncio-policy.rst:145 -msgid "Process Watchers" -msgstr "" - -#: library/asyncio-policy.rst:147 -msgid "" -"A process watcher allows customization of how an event loop monitors child " -"processes on Unix. Specifically, the event loop needs to know when a child " -"process has exited." -msgstr "" - -#: library/asyncio-policy.rst:151 -msgid "" -"In asyncio, child processes are created with :func:`create_subprocess_exec` " -"and :meth:`loop.subprocess_exec` functions." -msgstr "" - -#: library/asyncio-policy.rst:155 -msgid "" -"asyncio defines the :class:`AbstractChildWatcher` abstract base class, which " -"child watchers should implement, and has four different implementations: :" -"class:`ThreadedChildWatcher` (configured to be used by default), :class:" -"`MultiLoopChildWatcher`, :class:`SafeChildWatcher`, and :class:" -"`FastChildWatcher`." -msgstr "" - -#: library/asyncio-policy.rst:161 -msgid "" -"See also the :ref:`Subprocess and Threads ` " -"section." -msgstr "" - -#: library/asyncio-policy.rst:164 -msgid "" -"The following two functions can be used to customize the child process " -"watcher implementation used by the asyncio event loop:" -msgstr "" - -#: library/asyncio-policy.rst:169 -msgid "Return the current child watcher for the current policy." -msgstr "" - -#: library/asyncio-policy.rst:175 -msgid "" -"Set the current child watcher to *watcher* for the current policy. " -"*watcher* must implement methods defined in the :class:" -"`AbstractChildWatcher` base class." -msgstr "" - -#: library/asyncio-policy.rst:182 -msgid "" -"Third-party event loops implementations might not support custom child " -"watchers. For such event loops, using :func:`set_child_watcher` might be " -"prohibited or have no effect." -msgstr "" - -#: library/asyncio-policy.rst:190 -msgid "Register a new child handler." -msgstr "" - -#: library/asyncio-policy.rst:192 -msgid "" -"Arrange for ``callback(pid, returncode, *args)`` to be called when a process " -"with PID equal to *pid* terminates. Specifying another callback for the " -"same process replaces the previous handler." -msgstr "" - -#: library/asyncio-policy.rst:197 -msgid "The *callback* callable must be thread-safe." -msgstr "" - -#: library/asyncio-policy.rst:201 -msgid "Removes the handler for process with PID equal to *pid*." -msgstr "" - -#: library/asyncio-policy.rst:203 -msgid "" -"The function returns ``True`` if the handler was successfully removed, " -"``False`` if there was nothing to remove." -msgstr "" - -#: library/asyncio-policy.rst:208 -msgid "Attach the watcher to an event loop." -msgstr "" - -#: library/asyncio-policy.rst:210 -msgid "" -"If the watcher was previously attached to an event loop, then it is first " -"detached before attaching to the new loop." -msgstr "" - -#: library/asyncio-policy.rst:213 -msgid "Note: loop may be ``None``." -msgstr "" - -#: library/asyncio-policy.rst:217 -msgid "Return ``True`` if the watcher is ready to use." -msgstr "" - -#: library/asyncio-policy.rst:219 -msgid "" -"Spawning a subprocess with *inactive* current child watcher raises :exc:" -"`RuntimeError`." -msgstr "" - -#: library/asyncio-policy.rst:226 -msgid "Close the watcher." -msgstr "" - -#: library/asyncio-policy.rst:228 -msgid "" -"This method has to be called to ensure that underlying resources are cleaned-" -"up." -msgstr "" - -#: library/asyncio-policy.rst:236 -msgid "" -"This implementation starts a new waiting thread for every subprocess spawn." -msgstr "" - -#: library/asyncio-policy.rst:238 -msgid "" -"It works reliably even when the asyncio event loop is run in a non-main OS " -"thread." -msgstr "" - -#: library/asyncio-policy.rst:240 -msgid "" -"There is no noticeable overhead when handling a big number of children " -"(*O*\\ (1) each time a child terminates), but starting a thread per process " -"requires extra memory." -msgstr "" - -#: library/asyncio-policy.rst:243 -msgid "This watcher is used by default." -msgstr "" - -#: library/asyncio-policy.rst:249 -msgid "" -"This implementation registers a :py:data:`SIGCHLD` signal handler on " -"instantiation. That can break third-party code that installs a custom " -"handler for :py:data:`SIGCHLD` signal." -msgstr "" - -#: library/asyncio-policy.rst:273 -msgid "" -"The watcher avoids disrupting other code spawning processes by polling every " -"process explicitly on a :py:data:`SIGCHLD` signal." -msgstr "" - -#: library/asyncio-policy.rst:256 -msgid "" -"There is no limitation for running subprocesses from different threads once " -"the watcher is installed." -msgstr "" - -#: library/asyncio-policy.rst:259 -msgid "" -"The solution is safe but it has a significant overhead when handling a big " -"number of processes (*O*\\ (*n*) each time a :py:data:`SIGCHLD` is received)." +#: library/asyncio-policy.rst:146 +msgid "Availability" msgstr "" -#: library/asyncio-policy.rst:269 -msgid "" -"This implementation uses active event loop from the main thread to handle :" -"py:data:`SIGCHLD` signal. If the main thread has no running event loop " -"another thread cannot spawn a subprocess (:exc:`RuntimeError` is raised)." -msgstr "" - -#: library/asyncio-policy.rst:276 -msgid "" -"This solution is as safe as :class:`MultiLoopChildWatcher` and has the same " -"*O*\\ (*n*) complexity but requires a running event loop in the main thread " -"to work." -msgstr "" - -#: library/asyncio-policy.rst:283 -msgid "" -"This implementation reaps every terminated processes by calling ``os." -"waitpid(-1)`` directly, possibly breaking other code spawning processes and " -"waiting for their termination." -msgstr "" - -#: library/asyncio-policy.rst:287 +#: library/asyncio-policy.rst:136 msgid "" -"There is no noticeable overhead when handling a big number of children " -"(*O*\\ (1) each time a child terminates)." +"The :class:`WindowsSelectorEventLoopPolicy` class is deprecated and will be " +"removed in Python 3.16." msgstr "" -#: library/asyncio-policy.rst:290 +#: library/asyncio-policy.rst:143 msgid "" -"This solution requires a running event loop in the main thread to work, as :" -"class:`SafeChildWatcher`." +"An alternative event loop policy that uses the :class:`ProactorEventLoop` " +"event loop implementation." msgstr "" -#: library/asyncio-policy.rst:297 +#: library/asyncio-policy.rst:148 msgid "" -"This implementation polls process file descriptors (pidfds) to await child " -"process termination. In some respects, :class:`PidfdChildWatcher` is a " -"\"Goldilocks\" child watcher implementation. It doesn't require signals or " -"threads, doesn't interfere with any processes launched outside the event " -"loop, and scales linearly with the number of subprocesses launched by the " -"event loop. The main disadvantage is that pidfds are specific to Linux, and " -"only work on recent (5.3+) kernels." +"The :class:`WindowsProactorEventLoopPolicy` class is deprecated and will be " +"removed in Python 3.16." msgstr "" -#: library/asyncio-policy.rst:311 +#: library/asyncio-policy.rst:156 msgid "Custom Policies" msgstr "" -#: library/asyncio-policy.rst:313 +#: library/asyncio-policy.rst:158 msgid "" "To implement a new event loop policy, it is recommended to subclass :class:" "`DefaultEventLoopPolicy` and override the methods for which custom behavior " "is wanted, e.g.::" msgstr "" + +#: library/asyncio-policy.rst:162 +msgid "" +"class MyEventLoopPolicy(asyncio.DefaultEventLoopPolicy):\n" +"\n" +" def get_event_loop(self):\n" +" \"\"\"Get the event loop.\n" +"\n" +" This may be None or an instance of EventLoop.\n" +" \"\"\"\n" +" loop = super().get_event_loop()\n" +" # Do something with loop ...\n" +" return loop\n" +"\n" +"asyncio.set_event_loop_policy(MyEventLoopPolicy())" +msgstr "" diff --git a/library/asyncio-protocol.po b/library/asyncio-protocol.po index 20dd6720..85578a3b 100644 --- a/library/asyncio-protocol.po +++ b/library/asyncio-protocol.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -259,6 +260,13 @@ msgid "" "of the transport::" msgstr "" +#: library/asyncio-protocol.rst:182 +msgid "" +"sock = transport.get_extra_info('socket')\n" +"if sock is not None:\n" +" print(sock.getsockopt(...))" +msgstr "" + #: library/asyncio-protocol.rst:186 msgid "Categories of information that can be queried on some transports:" msgstr "" @@ -488,7 +496,14 @@ msgid "" "the target address given on transport creation." msgstr "" -#: library/asyncio-protocol.rst:367 +#: library/asyncio-protocol.rst:365 +msgid "" +"This method can be called with an empty bytes object to send a zero-length " +"datagram. The buffer size calculation used for flow control is also updated " +"to account for the datagram header." +msgstr "" + +#: library/asyncio-protocol.rst:372 msgid "" "Close the transport immediately, without waiting for pending operations to " "complete. Buffered data will be lost. No more data will be received. The " @@ -496,110 +511,110 @@ msgid "" "method will eventually be called with :const:`None` as its argument." msgstr "" -#: library/asyncio-protocol.rst:377 +#: library/asyncio-protocol.rst:382 msgid "Subprocess Transports" msgstr "" -#: library/asyncio-protocol.rst:381 +#: library/asyncio-protocol.rst:386 msgid "Return the subprocess process id as an integer." msgstr "" -#: library/asyncio-protocol.rst:385 +#: library/asyncio-protocol.rst:390 msgid "" "Return the transport for the communication pipe corresponding to the integer " "file descriptor *fd*:" msgstr "" -#: library/asyncio-protocol.rst:388 +#: library/asyncio-protocol.rst:393 msgid "" -"``0``: readable streaming transport of the standard input (*stdin*), or :" +"``0``: writable streaming transport of the standard input (*stdin*), or :" "const:`None` if the subprocess was not created with ``stdin=PIPE``" msgstr "" -#: library/asyncio-protocol.rst:390 +#: library/asyncio-protocol.rst:395 msgid "" -"``1``: writable streaming transport of the standard output (*stdout*), or :" +"``1``: readable streaming transport of the standard output (*stdout*), or :" "const:`None` if the subprocess was not created with ``stdout=PIPE``" msgstr "" -#: library/asyncio-protocol.rst:392 +#: library/asyncio-protocol.rst:397 msgid "" -"``2``: writable streaming transport of the standard error (*stderr*), or :" +"``2``: readable streaming transport of the standard error (*stderr*), or :" "const:`None` if the subprocess was not created with ``stderr=PIPE``" msgstr "" -#: library/asyncio-protocol.rst:394 +#: library/asyncio-protocol.rst:399 msgid "other *fd*: :const:`None`" msgstr "" -#: library/asyncio-protocol.rst:398 +#: library/asyncio-protocol.rst:403 msgid "" "Return the subprocess return code as an integer or :const:`None` if it " "hasn't returned, which is similar to the :attr:`subprocess.Popen.returncode` " "attribute." msgstr "" -#: library/asyncio-protocol.rst:404 +#: library/asyncio-protocol.rst:409 msgid "Kill the subprocess." msgstr "" -#: library/asyncio-protocol.rst:406 +#: library/asyncio-protocol.rst:411 msgid "" "On POSIX systems, the function sends SIGKILL to the subprocess. On Windows, " "this method is an alias for :meth:`terminate`." msgstr "" -#: library/asyncio-protocol.rst:409 +#: library/asyncio-protocol.rst:414 msgid "See also :meth:`subprocess.Popen.kill`." msgstr "" -#: library/asyncio-protocol.rst:413 +#: library/asyncio-protocol.rst:418 msgid "" "Send the *signal* number to the subprocess, as in :meth:`subprocess.Popen." "send_signal`." msgstr "" -#: library/asyncio-protocol.rst:418 +#: library/asyncio-protocol.rst:423 msgid "Stop the subprocess." msgstr "" -#: library/asyncio-protocol.rst:420 +#: library/asyncio-protocol.rst:425 msgid "" "On POSIX systems, this method sends :py:const:`~signal.SIGTERM` to the " "subprocess. On Windows, the Windows API function :c:func:`!TerminateProcess` " "is called to stop the subprocess." msgstr "" -#: library/asyncio-protocol.rst:424 +#: library/asyncio-protocol.rst:429 msgid "See also :meth:`subprocess.Popen.terminate`." msgstr "" -#: library/asyncio-protocol.rst:428 +#: library/asyncio-protocol.rst:433 msgid "Kill the subprocess by calling the :meth:`kill` method." msgstr "" -#: library/asyncio-protocol.rst:430 +#: library/asyncio-protocol.rst:435 msgid "" "If the subprocess hasn't returned yet, and close transports of *stdin*, " "*stdout*, and *stderr* pipes." msgstr "" -#: library/asyncio-protocol.rst:437 +#: library/asyncio-protocol.rst:442 msgid "Protocols" msgstr "" -#: library/asyncio-protocol.rst:439 +#: library/asyncio-protocol.rst:444 msgid "**Source code:** :source:`Lib/asyncio/protocols.py`" msgstr "" -#: library/asyncio-protocol.rst:443 +#: library/asyncio-protocol.rst:448 msgid "" "asyncio provides a set of abstract base classes that should be used to " "implement network protocols. Those classes are meant to be used together " "with :ref:`transports `." msgstr "" -#: library/asyncio-protocol.rst:447 +#: library/asyncio-protocol.rst:452 msgid "" "Subclasses of abstract base protocol classes may implement some or all " "methods. All these methods are callbacks: they are called by transports on " @@ -607,117 +622,117 @@ msgid "" "method should be called by the corresponding transport." msgstr "" -#: library/asyncio-protocol.rst:454 +#: library/asyncio-protocol.rst:459 msgid "Base Protocols" msgstr "" -#: library/asyncio-protocol.rst:458 +#: library/asyncio-protocol.rst:463 msgid "Base protocol with methods that all protocols share." msgstr "" -#: library/asyncio-protocol.rst:462 +#: library/asyncio-protocol.rst:467 msgid "" "The base class for implementing streaming protocols (TCP, Unix sockets, etc)." msgstr "" -#: library/asyncio-protocol.rst:467 +#: library/asyncio-protocol.rst:472 msgid "" "A base class for implementing streaming protocols with manual control of the " "receive buffer." msgstr "" -#: library/asyncio-protocol.rst:472 +#: library/asyncio-protocol.rst:477 msgid "The base class for implementing datagram (UDP) protocols." msgstr "" -#: library/asyncio-protocol.rst:476 +#: library/asyncio-protocol.rst:481 msgid "" "The base class for implementing protocols communicating with child processes " "(unidirectional pipes)." msgstr "" -#: library/asyncio-protocol.rst:481 +#: library/asyncio-protocol.rst:486 msgid "Base Protocol" msgstr "" -#: library/asyncio-protocol.rst:483 +#: library/asyncio-protocol.rst:488 msgid "All asyncio protocols can implement Base Protocol callbacks." msgstr "" -#: library/asyncio-protocol.rst:486 +#: library/asyncio-protocol.rst:491 msgid "Connection Callbacks" msgstr "" -#: library/asyncio-protocol.rst:487 +#: library/asyncio-protocol.rst:492 msgid "" "Connection callbacks are called on all protocols, exactly once per a " "successful connection. All other protocol callbacks can only be called " "between those two methods." msgstr "" -#: library/asyncio-protocol.rst:493 +#: library/asyncio-protocol.rst:498 msgid "Called when a connection is made." msgstr "" -#: library/asyncio-protocol.rst:495 +#: library/asyncio-protocol.rst:500 msgid "" "The *transport* argument is the transport representing the connection. The " "protocol is responsible for storing the reference to its transport." msgstr "" -#: library/asyncio-protocol.rst:501 +#: library/asyncio-protocol.rst:506 msgid "Called when the connection is lost or closed." msgstr "" -#: library/asyncio-protocol.rst:503 +#: library/asyncio-protocol.rst:508 msgid "" "The argument is either an exception object or :const:`None`. The latter " "means a regular EOF is received, or the connection was aborted or closed by " "this side of the connection." msgstr "" -#: library/asyncio-protocol.rst:509 +#: library/asyncio-protocol.rst:514 msgid "Flow Control Callbacks" msgstr "" -#: library/asyncio-protocol.rst:510 +#: library/asyncio-protocol.rst:515 msgid "" "Flow control callbacks can be called by transports to pause or resume " "writing performed by the protocol." msgstr "" -#: library/asyncio-protocol.rst:513 +#: library/asyncio-protocol.rst:518 msgid "" "See the documentation of the :meth:`~WriteTransport.set_write_buffer_limits` " "method for more details." msgstr "" -#: library/asyncio-protocol.rst:518 +#: library/asyncio-protocol.rst:523 msgid "Called when the transport's buffer goes over the high watermark." msgstr "" -#: library/asyncio-protocol.rst:522 +#: library/asyncio-protocol.rst:527 msgid "Called when the transport's buffer drains below the low watermark." msgstr "" -#: library/asyncio-protocol.rst:524 +#: library/asyncio-protocol.rst:529 msgid "" "If the buffer size equals the high watermark, :meth:`~BaseProtocol." "pause_writing` is not called: the buffer size must go strictly over." msgstr "" -#: library/asyncio-protocol.rst:528 +#: library/asyncio-protocol.rst:533 msgid "" "Conversely, :meth:`~BaseProtocol.resume_writing` is called when the buffer " "size is equal or lower than the low watermark. These end conditions are " "important to ensure that things go as expected when either mark is zero." msgstr "" -#: library/asyncio-protocol.rst:535 +#: library/asyncio-protocol.rst:540 msgid "Streaming Protocols" msgstr "" -#: library/asyncio-protocol.rst:537 +#: library/asyncio-protocol.rst:542 msgid "" "Event methods, such as :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :meth:`loop.create_connection`, :meth:`loop." @@ -726,13 +741,13 @@ msgid "" "that return streaming protocols." msgstr "" -#: library/asyncio-protocol.rst:545 +#: library/asyncio-protocol.rst:550 msgid "" "Called when some data is received. *data* is a non-empty bytes object " "containing the incoming data." msgstr "" -#: library/asyncio-protocol.rst:548 +#: library/asyncio-protocol.rst:553 msgid "" "Whether the data is buffered, chunked or reassembled depends on the " "transport. In general, you shouldn't rely on specific semantics and instead " @@ -740,27 +755,27 @@ msgid "" "the correct order." msgstr "" -#: library/asyncio-protocol.rst:553 +#: library/asyncio-protocol.rst:558 msgid "" "The method can be called an arbitrary number of times while a connection is " "open." msgstr "" -#: library/asyncio-protocol.rst:556 +#: library/asyncio-protocol.rst:561 msgid "" "However, :meth:`protocol.eof_received() ` is called " "at most once. Once ``eof_received()`` is called, ``data_received()`` is not " "called anymore." msgstr "" -#: library/asyncio-protocol.rst:562 +#: library/asyncio-protocol.rst:567 msgid "" "Called when the other end signals it won't send any more data (for example " "by calling :meth:`transport.write_eof() `, if the " "other end also uses asyncio)." msgstr "" -#: library/asyncio-protocol.rst:567 +#: library/asyncio-protocol.rst:572 msgid "" "This method may return a false value (including ``None``), in which case the " "transport will close itself. Conversely, if this method returns a true " @@ -769,28 +784,36 @@ msgid "" "connection." msgstr "" -#: library/asyncio-protocol.rst:573 +#: library/asyncio-protocol.rst:578 msgid "" "Some transports, including SSL, don't support half-closed connections, in " "which case returning true from this method will result in the connection " "being closed." msgstr "" -#: library/asyncio-protocol.rst:578 library/asyncio-protocol.rst:636 +#: library/asyncio-protocol.rst:583 library/asyncio-protocol.rst:641 msgid "State machine:" msgstr "" -#: library/asyncio-protocol.rst:589 +#: library/asyncio-protocol.rst:585 +msgid "" +"start -> connection_made\n" +" [-> data_received]*\n" +" [-> eof_received]?\n" +"-> connection_lost -> end" +msgstr "" + +#: library/asyncio-protocol.rst:594 msgid "Buffered Streaming Protocols" msgstr "" -#: library/asyncio-protocol.rst:593 +#: library/asyncio-protocol.rst:598 msgid "" "Buffered Protocols can be used with any event loop method that supports " "`Streaming Protocols`_." msgstr "" -#: library/asyncio-protocol.rst:596 +#: library/asyncio-protocol.rst:601 msgid "" "``BufferedProtocol`` implementations allow explicit manual allocation and " "control of the receive buffer. Event loops can then use the buffer provided " @@ -800,16 +823,16 @@ msgid "" "number of buffer allocations." msgstr "" -#: library/asyncio-protocol.rst:603 +#: library/asyncio-protocol.rst:608 msgid "" "The following callbacks are called on :class:`BufferedProtocol` instances:" msgstr "" -#: library/asyncio-protocol.rst:608 +#: library/asyncio-protocol.rst:613 msgid "Called to allocate a new receive buffer." msgstr "" -#: library/asyncio-protocol.rst:610 +#: library/asyncio-protocol.rst:615 msgid "" "*sizehint* is the recommended minimum size for the returned buffer. It is " "acceptable to return smaller or larger buffers than what *sizehint* " @@ -817,27 +840,27 @@ msgid "" "to return a buffer with a zero size." msgstr "" -#: library/asyncio-protocol.rst:615 +#: library/asyncio-protocol.rst:620 msgid "" "``get_buffer()`` must return an object implementing the :ref:`buffer " "protocol `." msgstr "" -#: library/asyncio-protocol.rst:620 +#: library/asyncio-protocol.rst:625 msgid "Called when the buffer was updated with the received data." msgstr "" -#: library/asyncio-protocol.rst:622 +#: library/asyncio-protocol.rst:627 msgid "*nbytes* is the total number of bytes that were written to the buffer." msgstr "" -#: library/asyncio-protocol.rst:626 +#: library/asyncio-protocol.rst:631 msgid "" "See the documentation of the :meth:`protocol.eof_received() ` method." msgstr "" -#: library/asyncio-protocol.rst:630 +#: library/asyncio-protocol.rst:635 msgid "" ":meth:`~BufferedProtocol.get_buffer` can be called an arbitrary number of " "times during a connection. However, :meth:`protocol.eof_received() " @@ -846,44 +869,54 @@ msgid "" "won't be called after it." msgstr "" -#: library/asyncio-protocol.rst:649 +#: library/asyncio-protocol.rst:643 +msgid "" +"start -> connection_made\n" +" [-> get_buffer\n" +" [-> buffer_updated]?\n" +" ]*\n" +" [-> eof_received]?\n" +"-> connection_lost -> end" +msgstr "" + +#: library/asyncio-protocol.rst:654 msgid "Datagram Protocols" msgstr "" -#: library/asyncio-protocol.rst:651 +#: library/asyncio-protocol.rst:656 msgid "" "Datagram Protocol instances should be constructed by protocol factories " "passed to the :meth:`loop.create_datagram_endpoint` method." msgstr "" -#: library/asyncio-protocol.rst:656 +#: library/asyncio-protocol.rst:661 msgid "" "Called when a datagram is received. *data* is a bytes object containing the " "incoming data. *addr* is the address of the peer sending the data; the " "exact format depends on the transport." msgstr "" -#: library/asyncio-protocol.rst:662 +#: library/asyncio-protocol.rst:667 msgid "" "Called when a previous send or receive operation raises an :class:" "`OSError`. *exc* is the :class:`OSError` instance." msgstr "" -#: library/asyncio-protocol.rst:665 +#: library/asyncio-protocol.rst:670 msgid "" "This method is called in rare conditions, when the transport (e.g. UDP) " "detects that a datagram could not be delivered to its recipient. In many " "conditions though, undeliverable datagrams will be silently dropped." msgstr "" -#: library/asyncio-protocol.rst:672 +#: library/asyncio-protocol.rst:677 msgid "" "On BSD systems (macOS, FreeBSD, etc.) flow control is not supported for " "datagram protocols, because there is no reliable way to detect send failures " "caused by writing too many packets." msgstr "" -#: library/asyncio-protocol.rst:676 +#: library/asyncio-protocol.rst:681 msgid "" "The socket always appears 'ready' and excess packets are dropped. An :class:" "`OSError` with ``errno`` set to :const:`errno.ENOBUFS` may or may not be " @@ -891,144 +924,429 @@ msgid "" "error_received` but otherwise ignored." msgstr "" -#: library/asyncio-protocol.rst:685 +#: library/asyncio-protocol.rst:690 msgid "Subprocess Protocols" msgstr "" -#: library/asyncio-protocol.rst:687 +#: library/asyncio-protocol.rst:692 msgid "" "Subprocess Protocol instances should be constructed by protocol factories " "passed to the :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` " "methods." msgstr "" -#: library/asyncio-protocol.rst:693 +#: library/asyncio-protocol.rst:698 msgid "" "Called when the child process writes data into its stdout or stderr pipe." msgstr "" -#: library/asyncio-protocol.rst:696 +#: library/asyncio-protocol.rst:701 msgid "*fd* is the integer file descriptor of the pipe." msgstr "" -#: library/asyncio-protocol.rst:698 +#: library/asyncio-protocol.rst:703 msgid "*data* is a non-empty bytes object containing the received data." msgstr "" -#: library/asyncio-protocol.rst:702 +#: library/asyncio-protocol.rst:707 msgid "" "Called when one of the pipes communicating with the child process is closed." msgstr "" -#: library/asyncio-protocol.rst:705 +#: library/asyncio-protocol.rst:710 msgid "*fd* is the integer file descriptor that was closed." msgstr "" -#: library/asyncio-protocol.rst:709 +#: library/asyncio-protocol.rst:714 msgid "Called when the child process has exited." msgstr "" -#: library/asyncio-protocol.rst:711 +#: library/asyncio-protocol.rst:716 msgid "" "It can be called before :meth:`~SubprocessProtocol.pipe_data_received` and :" "meth:`~SubprocessProtocol.pipe_connection_lost` methods." msgstr "" -#: library/asyncio-protocol.rst:716 +#: library/asyncio-protocol.rst:721 msgid "Examples" msgstr "" -#: library/asyncio-protocol.rst:721 +#: library/asyncio-protocol.rst:726 msgid "TCP Echo Server" msgstr "" -#: library/asyncio-protocol.rst:723 +#: library/asyncio-protocol.rst:728 msgid "" "Create a TCP echo server using the :meth:`loop.create_server` method, send " "back received data, and close the connection::" msgstr "" -#: library/asyncio-protocol.rst:764 +#: library/asyncio-protocol.rst:731 +msgid "" +"import asyncio\n" +"\n" +"\n" +"class EchoServerProtocol(asyncio.Protocol):\n" +" def connection_made(self, transport):\n" +" peername = transport.get_extra_info('peername')\n" +" print('Connection from {}'.format(peername))\n" +" self.transport = transport\n" +"\n" +" def data_received(self, data):\n" +" message = data.decode()\n" +" print('Data received: {!r}'.format(message))\n" +"\n" +" print('Send: {!r}'.format(message))\n" +" self.transport.write(data)\n" +"\n" +" print('Close the client socket')\n" +" self.transport.close()\n" +"\n" +"\n" +"async def main():\n" +" # Get a reference to the event loop as we plan to use\n" +" # low-level APIs.\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" server = await loop.create_server(\n" +" EchoServerProtocol,\n" +" '127.0.0.1', 8888)\n" +"\n" +" async with server:\n" +" await server.serve_forever()\n" +"\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-protocol.rst:769 msgid "" "The :ref:`TCP echo server using streams ` " "example uses the high-level :func:`asyncio.start_server` function." msgstr "" -#: library/asyncio-protocol.rst:770 +#: library/asyncio-protocol.rst:775 msgid "TCP Echo Client" msgstr "" -#: library/asyncio-protocol.rst:772 +#: library/asyncio-protocol.rst:777 msgid "" "A TCP echo client using the :meth:`loop.create_connection` method, sends " "data, and waits until the connection is closed::" msgstr "" -#: library/asyncio-protocol.rst:820 +#: library/asyncio-protocol.rst:780 +msgid "" +"import asyncio\n" +"\n" +"\n" +"class EchoClientProtocol(asyncio.Protocol):\n" +" def __init__(self, message, on_con_lost):\n" +" self.message = message\n" +" self.on_con_lost = on_con_lost\n" +"\n" +" def connection_made(self, transport):\n" +" transport.write(self.message.encode())\n" +" print('Data sent: {!r}'.format(self.message))\n" +"\n" +" def data_received(self, data):\n" +" print('Data received: {!r}'.format(data.decode()))\n" +"\n" +" def connection_lost(self, exc):\n" +" print('The server closed the connection')\n" +" self.on_con_lost.set_result(True)\n" +"\n" +"\n" +"async def main():\n" +" # Get a reference to the event loop as we plan to use\n" +" # low-level APIs.\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" on_con_lost = loop.create_future()\n" +" message = 'Hello World!'\n" +"\n" +" transport, protocol = await loop.create_connection(\n" +" lambda: EchoClientProtocol(message, on_con_lost),\n" +" '127.0.0.1', 8888)\n" +"\n" +" # Wait until the protocol signals that the connection\n" +" # is lost and close the transport.\n" +" try:\n" +" await on_con_lost\n" +" finally:\n" +" transport.close()\n" +"\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-protocol.rst:825 msgid "" "The :ref:`TCP echo client using streams ` " "example uses the high-level :func:`asyncio.open_connection` function." msgstr "" -#: library/asyncio-protocol.rst:827 +#: library/asyncio-protocol.rst:832 msgid "UDP Echo Server" msgstr "" -#: library/asyncio-protocol.rst:829 +#: library/asyncio-protocol.rst:834 msgid "" "A UDP echo server, using the :meth:`loop.create_datagram_endpoint` method, " "sends back received data::" msgstr "" -#: library/asyncio-protocol.rst:871 +#: library/asyncio-protocol.rst:837 +msgid "" +"import asyncio\n" +"\n" +"\n" +"class EchoServerProtocol:\n" +" def connection_made(self, transport):\n" +" self.transport = transport\n" +"\n" +" def datagram_received(self, data, addr):\n" +" message = data.decode()\n" +" print('Received %r from %s' % (message, addr))\n" +" print('Send %r to %s' % (message, addr))\n" +" self.transport.sendto(data, addr)\n" +"\n" +"\n" +"async def main():\n" +" print(\"Starting UDP server\")\n" +"\n" +" # Get a reference to the event loop as we plan to use\n" +" # low-level APIs.\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" # One protocol instance will be created to serve all\n" +" # client requests.\n" +" transport, protocol = await loop.create_datagram_endpoint(\n" +" EchoServerProtocol,\n" +" local_addr=('127.0.0.1', 9999))\n" +"\n" +" try:\n" +" await asyncio.sleep(3600) # Serve for 1 hour.\n" +" finally:\n" +" transport.close()\n" +"\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-protocol.rst:876 msgid "UDP Echo Client" msgstr "" -#: library/asyncio-protocol.rst:873 +#: library/asyncio-protocol.rst:878 msgid "" "A UDP echo client, using the :meth:`loop.create_datagram_endpoint` method, " "sends data and closes the transport when it receives the answer::" msgstr "" -#: library/asyncio-protocol.rst:928 +#: library/asyncio-protocol.rst:881 +msgid "" +"import asyncio\n" +"\n" +"\n" +"class EchoClientProtocol:\n" +" def __init__(self, message, on_con_lost):\n" +" self.message = message\n" +" self.on_con_lost = on_con_lost\n" +" self.transport = None\n" +"\n" +" def connection_made(self, transport):\n" +" self.transport = transport\n" +" print('Send:', self.message)\n" +" self.transport.sendto(self.message.encode())\n" +"\n" +" def datagram_received(self, data, addr):\n" +" print(\"Received:\", data.decode())\n" +"\n" +" print(\"Close the socket\")\n" +" self.transport.close()\n" +"\n" +" def error_received(self, exc):\n" +" print('Error received:', exc)\n" +"\n" +" def connection_lost(self, exc):\n" +" print(\"Connection closed\")\n" +" self.on_con_lost.set_result(True)\n" +"\n" +"\n" +"async def main():\n" +" # Get a reference to the event loop as we plan to use\n" +" # low-level APIs.\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" on_con_lost = loop.create_future()\n" +" message = \"Hello World!\"\n" +"\n" +" transport, protocol = await loop.create_datagram_endpoint(\n" +" lambda: EchoClientProtocol(message, on_con_lost),\n" +" remote_addr=('127.0.0.1', 9999))\n" +"\n" +" try:\n" +" await on_con_lost\n" +" finally:\n" +" transport.close()\n" +"\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-protocol.rst:933 msgid "Connecting Existing Sockets" msgstr "" -#: library/asyncio-protocol.rst:930 +#: library/asyncio-protocol.rst:935 msgid "" "Wait until a socket receives data using the :meth:`loop.create_connection` " "method with a protocol::" msgstr "" -#: library/asyncio-protocol.rst:984 +#: library/asyncio-protocol.rst:938 +msgid "" +"import asyncio\n" +"import socket\n" +"\n" +"\n" +"class MyProtocol(asyncio.Protocol):\n" +"\n" +" def __init__(self, on_con_lost):\n" +" self.transport = None\n" +" self.on_con_lost = on_con_lost\n" +"\n" +" def connection_made(self, transport):\n" +" self.transport = transport\n" +"\n" +" def data_received(self, data):\n" +" print(\"Received:\", data.decode())\n" +"\n" +" # We are done: close the transport;\n" +" # connection_lost() will be called automatically.\n" +" self.transport.close()\n" +"\n" +" def connection_lost(self, exc):\n" +" # The socket has been closed\n" +" self.on_con_lost.set_result(True)\n" +"\n" +"\n" +"async def main():\n" +" # Get a reference to the event loop as we plan to use\n" +" # low-level APIs.\n" +" loop = asyncio.get_running_loop()\n" +" on_con_lost = loop.create_future()\n" +"\n" +" # Create a pair of connected sockets\n" +" rsock, wsock = socket.socketpair()\n" +"\n" +" # Register the socket to wait for data.\n" +" transport, protocol = await loop.create_connection(\n" +" lambda: MyProtocol(on_con_lost), sock=rsock)\n" +"\n" +" # Simulate the reception of data from the network.\n" +" loop.call_soon(wsock.send, 'abc'.encode())\n" +"\n" +" try:\n" +" await protocol.on_con_lost\n" +" finally:\n" +" transport.close()\n" +" wsock.close()\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-protocol.rst:989 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." "add_reader` method to register an FD." msgstr "" -#: library/asyncio-protocol.rst:988 +#: library/asyncio-protocol.rst:993 msgid "" "The :ref:`register an open socket to wait for data using streams " "` example uses high-level streams " "created by the :func:`open_connection` function in a coroutine." msgstr "" -#: library/asyncio-protocol.rst:995 +#: library/asyncio-protocol.rst:1000 msgid "loop.subprocess_exec() and SubprocessProtocol" msgstr "" -#: library/asyncio-protocol.rst:997 +#: library/asyncio-protocol.rst:1002 msgid "" "An example of a subprocess protocol used to get the output of a subprocess " "and to wait for the subprocess exit." msgstr "" -#: library/asyncio-protocol.rst:1000 +#: library/asyncio-protocol.rst:1005 msgid "The subprocess is created by the :meth:`loop.subprocess_exec` method::" msgstr "" -#: library/asyncio-protocol.rst:1060 +#: library/asyncio-protocol.rst:1007 +msgid "" +"import asyncio\n" +"import sys\n" +"\n" +"class DateProtocol(asyncio.SubprocessProtocol):\n" +" def __init__(self, exit_future):\n" +" self.exit_future = exit_future\n" +" self.output = bytearray()\n" +" self.pipe_closed = False\n" +" self.exited = False\n" +"\n" +" def pipe_connection_lost(self, fd, exc):\n" +" self.pipe_closed = True\n" +" self.check_for_exit()\n" +"\n" +" def pipe_data_received(self, fd, data):\n" +" self.output.extend(data)\n" +"\n" +" def process_exited(self):\n" +" self.exited = True\n" +" # process_exited() method can be called before\n" +" # pipe_connection_lost() method: wait until both methods are\n" +" # called.\n" +" self.check_for_exit()\n" +"\n" +" def check_for_exit(self):\n" +" if self.pipe_closed and self.exited:\n" +" self.exit_future.set_result(True)\n" +"\n" +"async def get_date():\n" +" # Get a reference to the event loop as we plan to use\n" +" # low-level APIs.\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" code = 'import datetime; print(datetime.datetime.now())'\n" +" exit_future = asyncio.Future(loop=loop)\n" +"\n" +" # Create the subprocess controlled by DateProtocol;\n" +" # redirect the standard output into a pipe.\n" +" transport, protocol = await loop.subprocess_exec(\n" +" lambda: DateProtocol(exit_future),\n" +" sys.executable, '-c', code,\n" +" stdin=None, stderr=None)\n" +"\n" +" # Wait for the subprocess exit using the process_exited()\n" +" # method of the protocol.\n" +" await exit_future\n" +"\n" +" # Close the stdout pipe.\n" +" transport.close()\n" +"\n" +" # Read the output which was collected by the\n" +" # pipe_data_received() method of the protocol.\n" +" data = bytes(protocol.output)\n" +" return data.decode('ascii').rstrip()\n" +"\n" +"date = asyncio.run(get_date())\n" +"print(f\"Current date: {date}\")" +msgstr "" + +#: library/asyncio-protocol.rst:1065 msgid "" "See also the :ref:`same example ` " "written using high-level APIs." diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 20d8f5b4..7dd9e9c7 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-05 22:16+0300\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/asyncio-queue.rst:7 msgid "Queues" -msgstr "" +msgstr "Ουρές" #: library/asyncio-queue.rst:9 msgid "**Source code:** :source:`Lib/asyncio/queues.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/asyncio/queues.py`" #: library/asyncio-queue.rst:13 msgid "" @@ -30,24 +31,31 @@ msgid "" "module. Although asyncio queues are not thread-safe, they are designed to " "be used specifically in async/await code." msgstr "" +"Οι ουρές asyncio έχουν σχεδιαστεί ώστε να μοιάζουν με τις κλάσεις του " +"module :mod:`queue`. Αν και οι ουρές asyncio δεν είναι ασφαλείς για χρήση " +"με νήματα (thread-safe), έχουν σχεδιαστεί για να χρησιμοποιούνται " +"συγκεκριμένα σε κώδικα async/await." #: library/asyncio-queue.rst:17 msgid "" "Note that methods of asyncio queues don't have a *timeout* parameter; use :" "func:`asyncio.wait_for` function to do queue operations with a timeout." msgstr "" +"Σημειώστε ότι οι μέθοδοι των ουρών asyncio δεν διαθέτουν παράμετρο " +"*timeout*. Χρησιμοποιήστε την συνάρτηση :func:`asyncio.wait_for` για να " +"εκτελέσετε λειτουργίες ουράς με χρονικό όριο." #: library/asyncio-queue.rst:21 msgid "See also the `Examples`_ section below." -msgstr "" +msgstr "Δείτε επίσης την ενότητα `Examples`_ παρακάτω." #: library/asyncio-queue.rst:24 msgid "Queue" -msgstr "" +msgstr "Ουρά" #: library/asyncio-queue.rst:28 msgid "A first in, first out (FIFO) queue." -msgstr "" +msgstr "Μια ουρά τύπου πρώτος που εισέρχεται, πρώτος που εξέρχεται (FIFO)." #: library/asyncio-queue.rst:30 msgid "" @@ -55,55 +63,78 @@ msgid "" "it is an integer greater than ``0``, then ``await put()`` blocks when the " "queue reaches *maxsize* until an item is removed by :meth:`get`." msgstr "" +"Αν η τιμή του *maxsize* είναι λιγότερη ή ίση με το μηδέν, το μέγεθος της " +"ουράς είναι άπειρο. Αν είναι ένας ακέραιος μεγαλύτερος από το ``0``, τότε η " +"εντολή ``await put()`` μπλοκάρει, όταν η ουρά φτάσει το *maxsize* μέχρι να " +"αφαιρεθεί ένα στοιχείο μέσω της μεθόδου :meth:`get`." #: library/asyncio-queue.rst:35 msgid "" "Unlike the standard library threading :mod:`queue`, the size of the queue is " "always known and can be returned by calling the :meth:`qsize` method." msgstr "" +"Σε αντίθεση με την ουρά του :mod:`queue` στην βιβλιοθήκη threading, το " +"μέγεθος της ουράς είναι πάντα γνωστό και μπορεί να επιστραφεί καλώντας τη " +"μέθοδο :meth:`qsize`." #: library/asyncio-queue.rst:39 msgid "Removed the *loop* parameter." -msgstr "" +msgstr "Αφαιρέθηκε η παράμετρος *loop*." #: library/asyncio-queue.rst:43 msgid "This class is :ref:`not thread safe `." -msgstr "" +msgstr "Αυτή η κλάση είναι :ref:`not thread safe `." #: library/asyncio-queue.rst:47 msgid "Number of items allowed in the queue." -msgstr "" +msgstr "Αριθμός στοιχείων που επιτρέπονται στην ουρά." #: library/asyncio-queue.rst:51 msgid "Return ``True`` if the queue is empty, ``False`` otherwise." -msgstr "" +msgstr "Επιστρέφει ``True`` αν η ουρά είναι άδεια, διαφορετικά ``False``." #: library/asyncio-queue.rst:55 msgid "Return ``True`` if there are :attr:`maxsize` items in the queue." -msgstr "" +msgstr "Επιστρέφει ``True`` αν υπάρχουν :attr:`maxsize` αντικείμενα στην ουρά." #: library/asyncio-queue.rst:57 msgid "" "If the queue was initialized with ``maxsize=0`` (the default), then :meth:" -"`full()` never returns ``True``." +"`full` never returns ``True``." msgstr "" +"Αν η ουρά αρχικοποιήθηκε με ``maxsize=0`` (προεπιλογή), τότε η :meth:`full` " +"δεν επιστρέφει ποτέ ``True``." -#: library/asyncio-queue.rst:62 +#: library/asyncio-queue.rst:63 msgid "" "Remove and return an item from the queue. If queue is empty, wait until an " "item is available." msgstr "" +"Αφαίρεση και επιστροφή ενός αντικειμένου από την ουρά. Αν η ουρά είναι κενή, " +"περιμένετε μέχρι να είναι διαθέσιμο ένα αντικείμενο." + +#: library/asyncio-queue.rst:66 +msgid "" +"Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or " +"if the queue has been shut down immediately." +msgstr "" +"Κάνει raise μια :exc:`QueueShutDown` αν η ουρά έχει τερματιστεί και είναι " +"κενή, ή αν η ουρά έχει τερματιστεί άμεσα." -#: library/asyncio-queue.rst:67 +#: library/asyncio-queue.rst:71 msgid "" "Return an item if one is immediately available, else raise :exc:`QueueEmpty`." msgstr "" +"Επιστρέφει ένα αντικείμενο, αν είναι άμεσα διαθέσιμο, αλλιώς κάνε raise την :" +"exc:`QueueEmpty`." -#: library/asyncio-queue.rst:72 +#: library/asyncio-queue.rst:77 msgid "Block until all items in the queue have been received and processed." msgstr "" +"Αποκλείει μέχρι να ληφθούν και να υποβληθούν σε επεξεργασία όλα τα στοιχεία " +"στην ουρά." -#: library/asyncio-queue.rst:74 +#: library/asyncio-queue.rst:79 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer coroutine calls :meth:" @@ -111,94 +142,341 @@ msgid "" "complete. When the count of unfinished tasks drops to zero, :meth:`join` " "unblocks." msgstr "" +"Ο αριθμός των ημιτελών εργασιών αυξάνεται κάθε φορά που προστίθεται ένα " +"αντικείμενο στην ουρά. Ο αριθμός μειώνεται όταν μια καταναλωτική coroutine " +"καλεί τη μέθοδο :meth:`task_done` για να υποδείξει ότι το αντικείμενο " +"λήφθηκε και η εργασία πάνω του έχει ολοκληρωθεί. Όταν ο αριθμός των " +"ατελείωτων εργασιών μειωθεί στο μηδέν, η μέθοδος :meth:`join` αποδεσμεύεται." -#: library/asyncio-queue.rst:82 +#: library/asyncio-queue.rst:88 msgid "" "Put an item into the queue. If the queue is full, wait until a free slot is " "available before adding the item." msgstr "" +"Τοποθετεί ένα αντικείμενο στην ουρά. Αν η ουρά είναι γεμάτη, περιμένετε " +"μέχρι να είναι διαθέσιμη μια ελεύθερη θέση, πριν προσθέσετε το αντικείμενο." -#: library/asyncio-queue.rst:87 +#: library/asyncio-queue.rst:91 +msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." +msgstr "Κάνει raise μια :exc:`QueueShutDown` αν η ουρά έχει τερματιστεί." + +#: library/asyncio-queue.rst:95 msgid "Put an item into the queue without blocking." -msgstr "" +msgstr "Τοποθετεί ένα αντικείμενο στην ουρά χωρίς να μπλοκάρει." -#: library/asyncio-queue.rst:89 +#: library/asyncio-queue.rst:97 msgid "If no free slot is immediately available, raise :exc:`QueueFull`." msgstr "" +"Αν δεν είναι διαθέσιμη μια ελεύθερη θέση αμέσως, γίνεται raise η :exc:" +"`QueueFull`." -#: library/asyncio-queue.rst:93 +#: library/asyncio-queue.rst:101 msgid "Return the number of items in the queue." +msgstr "Επιστρέφει τον αριθμό των αντικειμένων στην ουρά." + +#: library/asyncio-queue.rst:105 +msgid "Put a :class:`Queue` instance into a shutdown mode." +msgstr "Βάζει ένα στιγμιότυπο της :class:`Queue` σε λειτουργία τερματισμού." + +#: library/asyncio-queue.rst:107 +msgid "" +"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:" +"`QueueShutDown`. Currently blocked callers of :meth:`~Queue.put` will be " +"unblocked and will raise :exc:`QueueShutDown` in the formerly blocked thread." msgstr "" +"Η ουρά δεν μπορεί πλέον να μεγαλώσει. Μελλοντικές κλήσεις της :meth:`~Queue." +"put` κάνουν raise την :exc:`QueueShutDown`. Οι τρέχοντες αποκλεισμένοι " +"καλούντες της :meth:`~Queue.put` θα αποδεσμευτούν και θα κάνουν raise την :" +"exc:`QueueShutDown` στο προηγουμένως αποκλεισμένο νήμα." -#: library/asyncio-queue.rst:97 -msgid "Indicate that a formerly enqueued task is complete." +#: library/asyncio-queue.rst:112 +msgid "" +"If *immediate* is false (the default), the queue can be wound down normally " +"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." +msgstr "" +"Αν το *immediate* είναι false (η προεπιλογή), η ουρά μπορεί να τερματιστεί " +"κανονικά με κλήσεις της :meth:`~Queue.get` για να εξαχθούν εργασίες που " +"έχουν ήδη φορτωθεί." + +#: library/asyncio-queue.rst:116 +msgid "" +"And if :meth:`~Queue.task_done` is called for each remaining task, a " +"pending :meth:`~Queue.join` will be unblocked normally." msgstr "" +"Και αν η :meth:`~Queue.task_done` κληθεί για κάθε υπόλοιπη εργασία, μια " +"εκκρεμής :meth:`~Queue.join` θα αποδεσμευτεί κανονικά." -#: library/asyncio-queue.rst:99 +#: library/asyncio-queue.rst:119 msgid "" -"Used by queue consumers. For each :meth:`~Queue.get` used to fetch a task, a " -"subsequent call to :meth:`task_done` tells the queue that the processing on " -"the task is complete." +"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:" +"`QueueShutDown`." msgstr "" +"Μόλις η ουρά είναι κενή, μελλοντικές κλήσεις της :meth:`~Queue.get` θα " +"κάνουν raise την :exc:`QueueShutDown`." -#: library/asyncio-queue.rst:103 +#: library/asyncio-queue.rst:122 +msgid "" +"If *immediate* is true, the queue is terminated immediately. The queue is " +"drained to be completely empty and the count of unfinished tasks is reduced " +"by the number of tasks drained. If unfinished tasks is zero, callers of :" +"meth:`~Queue.join` are unblocked. Also, blocked callers of :meth:`~Queue." +"get` are unblocked and will raise :exc:`QueueShutDown` because the queue is " +"empty." +msgstr "" +"Αν το *immediate* είναι true, η ουρά τερματίζεται αμέσως. Η ουρά αδειάζει " +"για να είναι εντελώς κενή και ο αριθμός των ημιτελών εργασιών μειώνεται κατά " +"τον αριθμό των εργασιών που αδειάστηκαν. Αν οι ημιτελείς εργασίες είναι " +"μηδέν, οι καλούντες της :meth:`~Queue.join` αποδεσμεύονται. Επίσης, οι " +"αποκλεισμένοι καλούντες της :meth:`~Queue.get` αποδεσμεύονται και θα κάνουν " +"raise την :exc:`QueueShutDown` επειδή η ουρά είναι κενή." + +#: library/asyncio-queue.rst:130 +msgid "" +"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " +"This unblocks the join even when no work has been done on the tasks, " +"violating the usual invariant for joining a queue." +msgstr "" +"Χρησιμοποιήστε προσοχή όταν χρησιμοποιείτε την :meth:`~Queue.join` με το " +"*immediate* ορισμένο σε αληθές. Αυτό αποδεσμεύει την ένωση ακόμη και όταν " +"δεν έχει γίνει καμία εργασία στις εργασίες, παραβιάζοντας το συνηθισμένο " +"αμετάβλητο για την ένωση μιας ουράς." + +#: library/asyncio-queue.rst:138 +msgid "Indicate that a formerly enqueued work item is complete." +msgstr "" +"Υποδεικνύει ότι μια εργασία που είχε προστεθεί στην ουρά έχει ολοκληρωθεί." + +#: library/asyncio-queue.rst:140 +msgid "" +"Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " +"item, a subsequent call to :meth:`task_done` tells the queue that the " +"processing on the work item is complete." +msgstr "" +"Χρησιμοποιείται από τους καταναλωτές της ουράς. Για κάθε κλήση της :meth:" +"`~Queue.get` για να ανακτηθεί μια εργασία, μια επακόλουθη κλήση της :meth:" +"`task_done` ενημερώνει την ουρά ότι η επεξεργασία της εργασίας έχει " +"ολοκληρωθεί." + +#: library/asyncio-queue.rst:144 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " "item that had been :meth:`~Queue.put` into the queue)." msgstr "" +"Εάν μια κλήση της :meth:`join` μπλοκάρει αυτή την στιγμή, θα συνεχιστεί όταν " +"όλα τα αντικείμενα έχουν επεξεργαστεί (σημαίνει ότι λήφθηκε μια κλήση της :" +"meth:`task_done` για κάθε αντικείμενο που είχε προστεθεί με :meth:`~Queue." +"put` στην ουρά)." -#: library/asyncio-queue.rst:108 +#: library/asyncio-queue.rst:149 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "" +"Κάνει raise την :exc:`ValueError` εάν κληθεί περισσότερες φορές από όσες τα " +"αντικείμενα που είχαν τοποθετηθεί στην ουρά." -#: library/asyncio-queue.rst:113 +#: library/asyncio-queue.rst:154 msgid "Priority Queue" -msgstr "" +msgstr "Σειρά Προτεραιότητας" -#: library/asyncio-queue.rst:117 +#: library/asyncio-queue.rst:158 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr "" +"Μια παραλλαγή της :class:`Queue`; η οποία ανακτά τις καταχωρήσεις με σειρά " +"προτεραιότητας (οι χαμηλότερες πρώτες)." -#: library/asyncio-queue.rst:120 +#: library/asyncio-queue.rst:161 msgid "Entries are typically tuples of the form ``(priority_number, data)``." -msgstr "" +msgstr "Οι καταχωρήσεις είναι συνήθως της μορφής ``(priority_number, data)``." -#: library/asyncio-queue.rst:125 +#: library/asyncio-queue.rst:166 msgid "LIFO Queue" -msgstr "" +msgstr "Ουρά LIFO" -#: library/asyncio-queue.rst:129 +#: library/asyncio-queue.rst:170 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr "" +"Μια παραλλαγή της κλάσης :class:`Queue` που ανακτά τις πιο πρόσφατα " +"προστιθέμενες καταχωρίσεις πρώτες (με τη λογική τελευταίος μέσα, πρώτος έξω)." -#: library/asyncio-queue.rst:134 +#: library/asyncio-queue.rst:175 msgid "Exceptions" -msgstr "" +msgstr "Εξαιρέσεις" -#: library/asyncio-queue.rst:138 +#: library/asyncio-queue.rst:179 msgid "" "This exception is raised when the :meth:`~Queue.get_nowait` method is called " "on an empty queue." msgstr "" +"Αυτή η εξαίρεση γίνεται raise όταν η μέθοδος :meth:`~Queue.get_nowait` " +"καλείται σε μια άδεια ουρά." -#: library/asyncio-queue.rst:144 +#: library/asyncio-queue.rst:185 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." msgstr "" +"Εξαίρεση που γίνεται raise όταν η μέθοδος :meth:`~Queue.put_nowait` καλείται " +"σε μια ουρά που έχει φτάσει στο *maxsize* της." -#: library/asyncio-queue.rst:149 -msgid "Examples" +#: library/asyncio-queue.rst:191 +msgid "" +"Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " +"a queue which has been shut down." msgstr "" +"Εξαίρεση που γίνεται raise όταν η μέθοδος :meth:`~Queue.put` ή :meth:`~Queue." +"get` καλείται σε μια ουρά που έχει τερματιστεί." + +#: library/asyncio-queue.rst:198 +msgid "Examples" +msgstr "Παραδείγματα" -#: library/asyncio-queue.rst:153 +#: library/asyncio-queue.rst:202 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "" +"Οι ουρές μπορούν να χρησιμοποιηθούν για τη διανομή εργασίας μεταξύ αρκετών " +"παράλληλων εργασιών::" + +#: library/asyncio-queue.rst:205 +msgid "" +"import asyncio\n" +"import random\n" +"import time\n" +"\n" +"\n" +"async def worker(name, queue):\n" +" while True:\n" +" # Get a \"work item\" out of the queue.\n" +" sleep_for = await queue.get()\n" +"\n" +" # Sleep for the \"sleep_for\" seconds.\n" +" await asyncio.sleep(sleep_for)\n" +"\n" +" # Notify the queue that the \"work item\" has been processed.\n" +" queue.task_done()\n" +"\n" +" print(f'{name} has slept for {sleep_for:.2f} seconds')\n" +"\n" +"\n" +"async def main():\n" +" # Create a queue that we will use to store our \"workload\".\n" +" queue = asyncio.Queue()\n" +"\n" +" # Generate random timings and put them into the queue.\n" +" total_sleep_time = 0\n" +" for _ in range(20):\n" +" sleep_for = random.uniform(0.05, 1.0)\n" +" total_sleep_time += sleep_for\n" +" queue.put_nowait(sleep_for)\n" +"\n" +" # Create three worker tasks to process the queue concurrently.\n" +" tasks = []\n" +" for i in range(3):\n" +" task = asyncio.create_task(worker(f'worker-{i}', queue))\n" +" tasks.append(task)\n" +"\n" +" # Wait until the queue is fully processed.\n" +" started_at = time.monotonic()\n" +" await queue.join()\n" +" total_slept_for = time.monotonic() - started_at\n" +"\n" +" # Cancel our worker tasks.\n" +" for task in tasks:\n" +" task.cancel()\n" +" # Wait until all worker tasks are cancelled.\n" +" await asyncio.gather(*tasks, return_exceptions=True)\n" +"\n" +" print('====')\n" +" print(f'3 workers slept in parallel for {total_slept_for:.2f} seconds')\n" +" print(f'total expected sleep time: {total_sleep_time:.2f} seconds')\n" +"\n" +"\n" +"asyncio.run(main())" +msgstr "" +"import asyncio\n" +"import random\n" +"import time\n" +"\n" +"\n" +"async def worker(name, queue):\n" +" while True:\n" +" # Get a \"work item\" out of the queue.\n" +" sleep_for = await queue.get()\n" +"\n" +" # Sleep for the \"sleep_for\" seconds.\n" +" await asyncio.sleep(sleep_for)\n" +"\n" +" # Notify the queue that the \"work item\" has been processed.\n" +" queue.task_done()\n" +"\n" +" print(f'{name} has slept for {sleep_for:.2f} seconds')\n" +"\n" +"\n" +"async def main():\n" +" # Create a queue that we will use to store our \"workload\".\n" +" queue = asyncio.Queue()\n" +"\n" +" # Generate random timings and put them into the queue.\n" +" total_sleep_time = 0\n" +" for _ in range(20):\n" +" sleep_for = random.uniform(0.05, 1.0)\n" +" total_sleep_time += sleep_for\n" +" queue.put_nowait(sleep_for)\n" +"\n" +" # Create three worker tasks to process the queue concurrently.\n" +" tasks = []\n" +" for i in range(3):\n" +" task = asyncio.create_task(worker(f'worker-{i}', queue))\n" +" tasks.append(task)\n" +"\n" +" # Wait until the queue is fully processed.\n" +" started_at = time.monotonic()\n" +" await queue.join()\n" +" total_slept_for = time.monotonic() - started_at\n" +"\n" +" # Cancel our worker tasks.\n" +" for task in tasks:\n" +" task.cancel()\n" +" # Wait until all worker tasks are cancelled.\n" +" await asyncio.gather(*tasks, return_exceptions=True)\n" +"\n" +" print('====')\n" +" print(f'3 workers slept in parallel for {total_slept_for:.2f} seconds')\n" +" print(f'total expected sleep time: {total_sleep_time:.2f} seconds')\n" +"\n" +"\n" +"asyncio.run(main())" + +#~ msgid "" +#~ "By default, :meth:`~Queue.get` on a shut down queue will only raise once " +#~ "the queue is empty. Set *immediate* to true to make :meth:`~Queue.get` " +#~ "raise immediately instead." +#~ msgstr "" +#~ "Από προεπιλογή, η :meth:`~Queue.get` σε μια τερματισμένη ουρά θα κάνει " +#~ "raise εξαίρεση μόνο όταν η ουρά είναι κενή. Ορίστε το *immediate* σε true " +#~ "για να κάνετε την :meth:`~Queue.get` να εξάγει την εξαίρεση αμέσως αντί " +#~ "για αργότερα." + +#~ msgid "" +#~ "All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " +#~ "unblocked. If *immediate* is true, a task will be marked as done for each " +#~ "remaining item in the queue, which may unblock callers of :meth:`~Queue." +#~ "join`." +#~ msgstr "" +#~ "Όλοι οι αποκλεισμένοι καλούντες των :meth:`~Queue.put` και :meth:`~Queue." +#~ "get` θα αποδεσμευτούν. Αν το *immediate* είναι αληθές, μια εργασία θα " +#~ "χαρακτηριστεί ως ολοκληρωμένη για κάθε εναπομείναν αντικείμενο στην ουρά, " +#~ "το οποίο μπορεί να αποδεσμευτεί στους καλούντες της :meth:`~Queue.join`." + +#~ msgid "" +#~ "``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining " +#~ "item in the queue." +#~ msgstr "" +#~ "Το ``shutdown(immediate=True)`` καλεί τη :meth:`task_done` για κάθε " +#~ "υπόλοιπο στοιχείο στην ουρά." diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 5d3b473e..42e9b63b 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -40,78 +41,103 @@ msgid "Running an asyncio Program" msgstr "" #: library/asyncio-runner.rst:27 -msgid "Execute the :term:`coroutine` *coro* and return the result." +msgid "Execute *coro* in an asyncio event loop and return the result." msgstr "" -#: library/asyncio-runner.rst:29 +#: library/asyncio-runner.rst:121 +msgid "The argument can be any awaitable object." +msgstr "" + +#: library/asyncio-runner.rst:31 msgid "" -"This function runs the passed coroutine, taking care of managing the asyncio " -"event loop, *finalizing asynchronous generators*, and closing the executor." +"This function runs the awaitable, taking care of managing the asyncio event " +"loop, *finalizing asynchronous generators*, and closing the executor." msgstr "" -#: library/asyncio-runner.rst:113 +#: library/asyncio-runner.rst:131 msgid "" "This function cannot be called when another asyncio event loop is running in " "the same thread." msgstr "" -#: library/asyncio-runner.rst:83 +#: library/asyncio-runner.rst:97 msgid "" "If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " "disables debug mode explicitly. ``None`` is used to respect the global :ref:" "`asyncio-debug-mode` settings." msgstr "" -#: library/asyncio-runner.rst:40 +#: library/asyncio-runner.rst:42 msgid "" "If *loop_factory* is not ``None``, it is used to create a new event loop; " "otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the " "end. This function should be used as a main entry point for asyncio " "programs, and should ideally only be called once. It is recommended to use " -"*loop_factory* to configure the event loop instead of policies." +"*loop_factory* to configure the event loop instead of policies. Passing :" +"class:`asyncio.EventLoop` allows running asyncio without the policy system." msgstr "" -#: library/asyncio-runner.rst:46 +#: library/asyncio-runner.rst:50 msgid "" "The executor is given a timeout duration of 5 minutes to shutdown. If the " "executor hasn't finished within that duration, a warning is emitted and the " "executor is closed." msgstr "" -#: library/asyncio-runner.rst:50 +#: library/asyncio-runner.rst:54 msgid "Example::" msgstr "" -#: library/asyncio-runner.rst:60 +#: library/asyncio-runner.rst:56 +msgid "" +"async def main():\n" +" await asyncio.sleep(1)\n" +" print('hello')\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-runner.rst:64 msgid "Updated to use :meth:`loop.shutdown_default_executor`." msgstr "" -#: library/asyncio-runner.rst:65 +#: library/asyncio-runner.rst:69 msgid "" "*debug* is ``None`` by default to respect the global debug mode settings." msgstr "" -#: library/asyncio-runner.rst:69 +#: library/asyncio-runner.rst:73 msgid "Added *loop_factory* parameter." msgstr "" -#: library/asyncio-runner.rst:73 +#: library/asyncio-runner.rst:136 +msgid "*coro* can be any awaitable object." +msgstr "" + +#: library/asyncio-runner.rst:81 +msgid "" +"The :mod:`!asyncio` policy system is deprecated and will be removed in " +"Python 3.16; from there on, an explicit *loop_factory* is needed to " +"configure the event loop." +msgstr "" + +#: library/asyncio-runner.rst:87 msgid "Runner context manager" msgstr "" -#: library/asyncio-runner.rst:77 +#: library/asyncio-runner.rst:91 msgid "" "A context manager that simplifies *multiple* async function calls in the " "same context." msgstr "" -#: library/asyncio-runner.rst:80 +#: library/asyncio-runner.rst:94 msgid "" "Sometimes several top-level async functions should be called in the same :" "ref:`event loop ` and :class:`contextvars.Context`." msgstr "" -#: library/asyncio-runner.rst:87 +#: library/asyncio-runner.rst:101 msgid "" "*loop_factory* could be used for overriding the loop creation. It is the " "responsibility of the *loop_factory* to set the created loop as the current " @@ -119,58 +145,72 @@ msgid "" "event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``." msgstr "" -#: library/asyncio-runner.rst:92 +#: library/asyncio-runner.rst:106 msgid "" -"Basically, :func:`asyncio.run()` example can be rewritten with the runner " +"Basically, :func:`asyncio.run` example can be rewritten with the runner " "usage::" msgstr "" -#: library/asyncio-runner.rst:105 -msgid "Run a :term:`coroutine ` *coro* in the embedded loop." +#: library/asyncio-runner.rst:108 +msgid "" +"async def main():\n" +" await asyncio.sleep(1)\n" +" print('hello')\n" +"\n" +"with asyncio.Runner() as runner:\n" +" runner.run(main())" +msgstr "" + +#: library/asyncio-runner.rst:119 +msgid "Execute *coro* in the embedded event loop." msgstr "" -#: library/asyncio-runner.rst:107 -msgid "Return the coroutine's result or raise its exception." +#: library/asyncio-runner.rst:123 +msgid "If the argument is a coroutine, it is wrapped in a Task." msgstr "" -#: library/asyncio-runner.rst:109 +#: library/asyncio-runner.rst:125 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The runner's default " -"context is used if ``None``." +"class:`contextvars.Context` for the code to run in. The runner's default " +"context is used if context is ``None``." +msgstr "" + +#: library/asyncio-runner.rst:129 +msgid "Returns the awaitable's result or raises an exception." msgstr "" -#: library/asyncio-runner.rst:118 +#: library/asyncio-runner.rst:140 msgid "Close the runner." msgstr "" -#: library/asyncio-runner.rst:120 +#: library/asyncio-runner.rst:142 msgid "" "Finalize asynchronous generators, shutdown default executor, close the event " "loop and release embedded :class:`contextvars.Context`." msgstr "" -#: library/asyncio-runner.rst:125 +#: library/asyncio-runner.rst:147 msgid "Return the event loop associated with the runner instance." msgstr "" -#: library/asyncio-runner.rst:129 +#: library/asyncio-runner.rst:151 msgid "" ":class:`Runner` uses the lazy initialization strategy, its constructor " "doesn't initialize underlying low-level structures." msgstr "" -#: library/asyncio-runner.rst:132 +#: library/asyncio-runner.rst:154 msgid "" "Embedded *loop* and *context* are created at the :keyword:`with` body " "entering or the first call of :meth:`run` or :meth:`get_loop`." msgstr "" -#: library/asyncio-runner.rst:137 +#: library/asyncio-runner.rst:159 msgid "Handling Keyboard Interruption" msgstr "" -#: library/asyncio-runner.rst:141 +#: library/asyncio-runner.rst:163 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:" "`KeyboardInterrupt` exception is raised in the main thread by default. " @@ -178,26 +218,26 @@ msgid "" "asyncio internals and can hang the program from exiting." msgstr "" -#: library/asyncio-runner.rst:146 +#: library/asyncio-runner.rst:168 msgid "" "To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as " "follows:" msgstr "" -#: library/asyncio-runner.rst:148 +#: library/asyncio-runner.rst:170 msgid "" ":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler " "before any user code is executed and removes it when exiting from the " "function." msgstr "" -#: library/asyncio-runner.rst:150 +#: library/asyncio-runner.rst:172 msgid "" "The :class:`~asyncio.Runner` creates the main task for the passed coroutine " "for its execution." msgstr "" -#: library/asyncio-runner.rst:152 +#: library/asyncio-runner.rst:174 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, the custom signal " "handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " @@ -207,7 +247,7 @@ msgid "" "Runner.run` raises :exc:`KeyboardInterrupt`." msgstr "" -#: library/asyncio-runner.rst:158 +#: library/asyncio-runner.rst:180 msgid "" "A user could write a tight loop which cannot be interrupted by :meth:" "`asyncio.Task.cancel`, in which case the second following :kbd:`Ctrl-C` " diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 2b276224..70ff0030 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -35,6 +36,28 @@ msgstr "" msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "" +#: library/asyncio-stream.rst:441 +msgid "" +"import asyncio\n" +"\n" +"async def tcp_echo_client(message):\n" +" reader, writer = await asyncio.open_connection(\n" +" '127.0.0.1', 8888)\n" +"\n" +" print(f'Send: {message!r}')\n" +" writer.write(message.encode())\n" +" await writer.drain()\n" +"\n" +" data = await reader.read(100)\n" +" print(f'Received: {data.decode()!r}')\n" +"\n" +" print('Close the connection')\n" +" writer.close()\n" +" await writer.wait_closed()\n" +"\n" +"asyncio.run(tcp_echo_client('Hello World!'))" +msgstr "" + #: library/asyncio-stream.rst:42 msgid "See also the `Examples`_ section below." msgstr "" @@ -49,59 +72,59 @@ msgid "" "with streams:" msgstr "" -#: library/asyncio-stream.rst:58 +#: library/asyncio-stream.rst:59 msgid "" "Establish a network connection and return a pair of ``(reader, writer)`` " "objects." msgstr "" -#: library/asyncio-stream.rst:61 +#: library/asyncio-stream.rst:62 msgid "" "The returned *reader* and *writer* objects are instances of :class:" "`StreamReader` and :class:`StreamWriter` classes." msgstr "" -#: library/asyncio-stream.rst:109 +#: library/asyncio-stream.rst:112 msgid "" "*limit* determines the buffer size limit used by the returned :class:" "`StreamReader` instance. By default the *limit* is set to 64 KiB." msgstr "" -#: library/asyncio-stream.rst:68 +#: library/asyncio-stream.rst:69 msgid "" "The rest of the arguments are passed directly to :meth:`loop." "create_connection`." msgstr "" -#: library/asyncio-stream.rst:147 +#: library/asyncio-stream.rst:154 msgid "" "The *sock* argument transfers ownership of the socket to the :class:" "`StreamWriter` created. To close the socket, call its :meth:`~asyncio." "StreamWriter.close` method." msgstr "" -#: library/asyncio-stream.rst:77 +#: library/asyncio-stream.rst:78 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "" -#: library/asyncio-stream.rst:80 +#: library/asyncio-stream.rst:81 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "" -#: library/asyncio-stream.rst:125 library/asyncio-stream.rst:187 +#: library/asyncio-stream.rst:128 library/asyncio-stream.rst:199 msgid "Removed the *loop* parameter." msgstr "" -#: library/asyncio-stream.rst:128 library/asyncio-stream.rst:190 -#: library/asyncio-stream.rst:372 +#: library/asyncio-stream.rst:131 library/asyncio-stream.rst:202 +#: library/asyncio-stream.rst:408 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "" -#: library/asyncio-stream.rst:98 +#: library/asyncio-stream.rst:101 msgid "Start a socket server." msgstr "" -#: library/asyncio-stream.rst:100 +#: library/asyncio-stream.rst:103 msgid "" "The *client_connected_cb* callback is called whenever a new client " "connection is established. It receives a ``(reader, writer)`` pair as two " @@ -109,162 +132,177 @@ msgid "" "classes." msgstr "" -#: library/asyncio-stream.rst:105 +#: library/asyncio-stream.rst:108 msgid "" "*client_connected_cb* can be a plain callable or a :ref:`coroutine function " "`; if it is a coroutine function, it will be automatically " "scheduled as a :class:`Task`." msgstr "" -#: library/asyncio-stream.rst:113 +#: library/asyncio-stream.rst:116 msgid "" "The rest of the arguments are passed directly to :meth:`loop.create_server`." msgstr "" -#: library/asyncio-stream.rst:177 +#: library/asyncio-stream.rst:189 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" -#: library/asyncio-stream.rst:122 +#: library/asyncio-stream.rst:125 msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters." msgstr "" -#: library/asyncio-stream.rst:133 +#: library/asyncio-stream.rst:134 +msgid "Added the *keep_alive* parameter." +msgstr "" + +#: library/asyncio-stream.rst:139 msgid "Unix Sockets" msgstr "" -#: library/asyncio-stream.rst:138 +#: library/asyncio-stream.rst:145 msgid "" "Establish a Unix socket connection and return a pair of ``(reader, writer)``." msgstr "" -#: library/asyncio-stream.rst:141 +#: library/asyncio-stream.rst:148 msgid "Similar to :func:`open_connection` but operates on Unix sockets." msgstr "" -#: library/asyncio-stream.rst:143 +#: library/asyncio-stream.rst:150 msgid "See also the documentation of :meth:`loop.create_unix_connection`." msgstr "" -#: library/asyncio-stream.rst:181 -msgid ":ref:`Availability `: Unix." +#: library/asyncio-stream.rst:193 +msgid "Availability" msgstr "" -#: library/asyncio-stream.rst:153 +#: library/asyncio-stream.rst:160 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`" msgstr "" -#: library/asyncio-stream.rst:169 +#: library/asyncio-stream.rst:177 msgid "Start a Unix socket server." msgstr "" -#: library/asyncio-stream.rst:171 +#: library/asyncio-stream.rst:179 msgid "Similar to :func:`start_server` but works with Unix sockets." msgstr "" -#: library/asyncio-stream.rst:173 +#: library/asyncio-stream.rst:181 +msgid "" +"If *cleanup_socket* is true then the Unix socket will automatically be " +"removed from the filesystem when the server is closed, unless the socket has " +"been replaced after the server has been created." +msgstr "" + +#: library/asyncio-stream.rst:185 msgid "See also the documentation of :meth:`loop.create_unix_server`." msgstr "" -#: library/asyncio-stream.rst:183 +#: library/asyncio-stream.rst:195 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :term:`path-like object`." msgstr "" -#: library/asyncio-stream.rst:195 +#: library/asyncio-stream.rst:205 +msgid "Added the *cleanup_socket* parameter." +msgstr "" + +#: library/asyncio-stream.rst:210 msgid "StreamReader" msgstr "" -#: library/asyncio-stream.rst:199 +#: library/asyncio-stream.rst:214 msgid "" "Represents a reader object that provides APIs to read data from the IO " "stream. As an :term:`asynchronous iterable`, the object supports the :" "keyword:`async for` statement." msgstr "" -#: library/asyncio-stream.rst:203 +#: library/asyncio-stream.rst:218 msgid "" "It is not recommended to instantiate *StreamReader* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." msgstr "" -#: library/asyncio-stream.rst:209 +#: library/asyncio-stream.rst:224 msgid "Acknowledge the EOF." msgstr "" -#: library/asyncio-stream.rst:213 +#: library/asyncio-stream.rst:229 msgid "Read up to *n* bytes from the stream." msgstr "" -#: library/asyncio-stream.rst:215 +#: library/asyncio-stream.rst:231 msgid "" "If *n* is not provided or set to ``-1``, read until EOF, then return all " "read :class:`bytes`. If EOF was received and the internal buffer is empty, " "return an empty ``bytes`` object." msgstr "" -#: library/asyncio-stream.rst:220 +#: library/asyncio-stream.rst:236 msgid "If *n* is ``0``, return an empty ``bytes`` object immediately." msgstr "" -#: library/asyncio-stream.rst:222 +#: library/asyncio-stream.rst:238 msgid "" "If *n* is positive, return at most *n* available ``bytes`` as soon as at " "least 1 byte is available in the internal buffer. If EOF is received before " "any byte is read, return an empty ``bytes`` object." msgstr "" -#: library/asyncio-stream.rst:229 +#: library/asyncio-stream.rst:246 msgid "" "Read one line, where \"line\" is a sequence of bytes ending with ``\\n``." msgstr "" -#: library/asyncio-stream.rst:232 +#: library/asyncio-stream.rst:249 msgid "" "If EOF is received and ``\\n`` was not found, the method returns partially " "read data." msgstr "" -#: library/asyncio-stream.rst:235 +#: library/asyncio-stream.rst:252 msgid "" "If EOF is received and the internal buffer is empty, return an empty " "``bytes`` object." msgstr "" -#: library/asyncio-stream.rst:240 +#: library/asyncio-stream.rst:258 msgid "Read exactly *n* bytes." msgstr "" -#: library/asyncio-stream.rst:242 +#: library/asyncio-stream.rst:260 msgid "" "Raise an :exc:`IncompleteReadError` if EOF is reached before *n* can be " "read. Use the :attr:`IncompleteReadError.partial` attribute to get the " "partially read data." msgstr "" -#: library/asyncio-stream.rst:248 +#: library/asyncio-stream.rst:267 msgid "Read data from the stream until *separator* is found." msgstr "" -#: library/asyncio-stream.rst:250 +#: library/asyncio-stream.rst:269 msgid "" "On success, the data and separator will be removed from the internal buffer " "(consumed). Returned data will include the separator at the end." msgstr "" -#: library/asyncio-stream.rst:254 +#: library/asyncio-stream.rst:273 msgid "" "If the amount of data read exceeds the configured stream limit, a :exc:" "`LimitOverrunError` exception is raised, and the data is left in the " "internal buffer and can be read again." msgstr "" -#: library/asyncio-stream.rst:258 +#: library/asyncio-stream.rst:277 msgid "" "If EOF is reached before the complete separator is found, an :exc:" "`IncompleteReadError` exception is raised, and the internal buffer is " @@ -272,79 +310,121 @@ msgid "" "portion of the separator." msgstr "" -#: library/asyncio-stream.rst:267 +#: library/asyncio-stream.rst:282 +msgid "" +"The *separator* may also be a tuple of separators. In this case the return " +"value will be the shortest possible that has any separator as the suffix. " +"For the purposes of :exc:`LimitOverrunError`, the shortest possible " +"separator is considered to be the one that matched." +msgstr "" + +#: library/asyncio-stream.rst:292 +msgid "The *separator* parameter may now be a :class:`tuple` of separators." +msgstr "" + +#: library/asyncio-stream.rst:297 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." msgstr "" -#: library/asyncio-stream.rst:272 +#: library/asyncio-stream.rst:302 msgid "StreamWriter" msgstr "" -#: library/asyncio-stream.rst:276 +#: library/asyncio-stream.rst:306 msgid "" "Represents a writer object that provides APIs to write data to the IO stream." msgstr "" -#: library/asyncio-stream.rst:279 +#: library/asyncio-stream.rst:309 msgid "" "It is not recommended to instantiate *StreamWriter* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." msgstr "" -#: library/asyncio-stream.rst:285 +#: library/asyncio-stream.rst:315 msgid "" "The method attempts to write the *data* to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " "until it can be sent." msgstr "" -#: library/asyncio-stream.rst:301 +#: library/asyncio-stream.rst:319 +msgid "" +"The *data* buffer should be a bytes, bytearray, or C-contiguous one-" +"dimensional memoryview object." +msgstr "" + +#: library/asyncio-stream.rst:335 msgid "The method should be used along with the ``drain()`` method::" msgstr "" -#: library/asyncio-stream.rst:296 +#: library/asyncio-stream.rst:324 +msgid "" +"stream.write(data)\n" +"await stream.drain()" +msgstr "" + +#: library/asyncio-stream.rst:330 msgid "" "The method writes a list (or any iterable) of bytes to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " "until it can be sent." msgstr "" -#: library/asyncio-stream.rst:308 +#: library/asyncio-stream.rst:337 +msgid "" +"stream.writelines(lines)\n" +"await stream.drain()" +msgstr "" + +#: library/asyncio-stream.rst:342 msgid "The method closes the stream and the underlying socket." msgstr "" -#: library/asyncio-stream.rst:310 +#: library/asyncio-stream.rst:344 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "" -#: library/asyncio-stream.rst:318 +#: library/asyncio-stream.rst:347 +msgid "" +"stream.close()\n" +"await stream.wait_closed()" +msgstr "" + +#: library/asyncio-stream.rst:352 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." msgstr "" -#: library/asyncio-stream.rst:323 +#: library/asyncio-stream.rst:357 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "" -#: library/asyncio-stream.rst:328 +#: library/asyncio-stream.rst:362 msgid "Return the underlying asyncio transport." msgstr "" -#: library/asyncio-stream.rst:332 +#: library/asyncio-stream.rst:366 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "" -#: library/asyncio-stream.rst:337 +#: library/asyncio-stream.rst:372 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "" -#: library/asyncio-stream.rst:343 +#: library/asyncio-stream.rst:375 +msgid "" +"writer.write(data)\n" +"await writer.drain()" +msgstr "" + +#: library/asyncio-stream.rst:378 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -353,123 +433,235 @@ msgid "" "`drain` returns immediately." msgstr "" -#: library/asyncio-stream.rst:353 +#: library/asyncio-stream.rst:389 msgid "Upgrade an existing stream-based connection to TLS." msgstr "" -#: library/asyncio-stream.rst:355 +#: library/asyncio-stream.rst:391 msgid "Parameters:" msgstr "" -#: library/asyncio-stream.rst:357 +#: library/asyncio-stream.rst:393 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "" -#: library/asyncio-stream.rst:359 +#: library/asyncio-stream.rst:395 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "" -#: library/asyncio-stream.rst:362 +#: library/asyncio-stream.rst:398 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" -#: library/asyncio-stream.rst:366 +#: library/asyncio-stream.rst:402 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: library/asyncio-stream.rst:378 +#: library/asyncio-stream.rst:414 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "" -#: library/asyncio-stream.rst:385 +#: library/asyncio-stream.rst:422 msgid "Wait until the stream is closed." msgstr "" -#: library/asyncio-stream.rst:387 +#: library/asyncio-stream.rst:424 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " "program." msgstr "" -#: library/asyncio-stream.rst:395 +#: library/asyncio-stream.rst:432 msgid "Examples" msgstr "" -#: library/asyncio-stream.rst:400 +#: library/asyncio-stream.rst:437 msgid "TCP echo client using streams" msgstr "" -#: library/asyncio-stream.rst:402 +#: library/asyncio-stream.rst:439 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "" -#: library/asyncio-stream.rst:426 +#: library/asyncio-stream.rst:463 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" "`loop.create_connection` method." msgstr "" -#: library/asyncio-stream.rst:433 +#: library/asyncio-stream.rst:470 msgid "TCP echo server using streams" msgstr "" -#: library/asyncio-stream.rst:435 +#: library/asyncio-stream.rst:472 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "" -#: library/asyncio-stream.rst:469 +#: library/asyncio-stream.rst:474 +msgid "" +"import asyncio\n" +"\n" +"async def handle_echo(reader, writer):\n" +" data = await reader.read(100)\n" +" message = data.decode()\n" +" addr = writer.get_extra_info('peername')\n" +"\n" +" print(f\"Received {message!r} from {addr!r}\")\n" +"\n" +" print(f\"Send: {message!r}\")\n" +" writer.write(data)\n" +" await writer.drain()\n" +"\n" +" print(\"Close the connection\")\n" +" writer.close()\n" +" await writer.wait_closed()\n" +"\n" +"async def main():\n" +" server = await asyncio.start_server(\n" +" handle_echo, '127.0.0.1', 8888)\n" +"\n" +" addrs = ', '.join(str(sock.getsockname()) for sock in server.sockets)\n" +" print(f'Serving on {addrs}')\n" +"\n" +" async with server:\n" +" await server.serve_forever()\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-stream.rst:506 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." "create_server` method." msgstr "" -#: library/asyncio-stream.rst:474 +#: library/asyncio-stream.rst:511 msgid "Get HTTP headers" msgstr "" -#: library/asyncio-stream.rst:476 +#: library/asyncio-stream.rst:513 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "" #: library/asyncio-stream.rst:515 +msgid "" +"import asyncio\n" +"import urllib.parse\n" +"import sys\n" +"\n" +"async def print_http_headers(url):\n" +" url = urllib.parse.urlsplit(url)\n" +" if url.scheme == 'https':\n" +" reader, writer = await asyncio.open_connection(\n" +" url.hostname, 443, ssl=True)\n" +" else:\n" +" reader, writer = await asyncio.open_connection(\n" +" url.hostname, 80)\n" +"\n" +" query = (\n" +" f\"HEAD {url.path or '/'} HTTP/1.0\\r\\n\"\n" +" f\"Host: {url.hostname}\\r\\n\"\n" +" f\"\\r\\n\"\n" +" )\n" +"\n" +" writer.write(query.encode('latin-1'))\n" +" while True:\n" +" line = await reader.readline()\n" +" if not line:\n" +" break\n" +"\n" +" line = line.decode('latin1').rstrip()\n" +" if line:\n" +" print(f'HTTP header> {line}')\n" +"\n" +" # Ignore the body, close the socket\n" +" writer.close()\n" +" await writer.wait_closed()\n" +"\n" +"url = sys.argv[1]\n" +"asyncio.run(print_http_headers(url))" +msgstr "" + +#: library/asyncio-stream.rst:552 msgid "Usage::" msgstr "" -#: library/asyncio-stream.rst:519 +#: library/asyncio-stream.rst:554 +msgid "python example.py http://example.com/path/page.html" +msgstr "" + +#: library/asyncio-stream.rst:556 msgid "or with HTTPS::" msgstr "" -#: library/asyncio-stream.rst:527 +#: library/asyncio-stream.rst:558 +msgid "python example.py https://example.com/path/page.html" +msgstr "" + +#: library/asyncio-stream.rst:564 msgid "Register an open socket to wait for data using streams" msgstr "" -#: library/asyncio-stream.rst:529 +#: library/asyncio-stream.rst:566 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" -#: library/asyncio-stream.rst:564 +#: library/asyncio-stream.rst:569 +msgid "" +"import asyncio\n" +"import socket\n" +"\n" +"async def wait_for_data():\n" +" # Get a reference to the current event loop because\n" +" # we want to access low-level APIs.\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" # Create a pair of connected sockets.\n" +" rsock, wsock = socket.socketpair()\n" +"\n" +" # Register the open socket to wait for data.\n" +" reader, writer = await asyncio.open_connection(sock=rsock)\n" +"\n" +" # Simulate the reception of data from the network\n" +" loop.call_soon(wsock.send, 'abc'.encode())\n" +"\n" +" # Wait for data\n" +" data = await reader.read(100)\n" +"\n" +" # Got data, we are done: close the socket\n" +" print(\"Received:\", data.decode())\n" +" writer.close()\n" +" await writer.wait_closed()\n" +"\n" +" # Close the second socket\n" +" wsock.close()\n" +"\n" +"asyncio.run(wait_for_data())" +msgstr "" + +#: library/asyncio-stream.rst:601 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " "the :meth:`loop.create_connection` method." msgstr "" -#: library/asyncio-stream.rst:568 +#: library/asyncio-stream.rst:605 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index e74b0603..9db9fa83 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -38,10 +39,38 @@ msgid "" "result::" msgstr "" +#: library/asyncio-subprocess.rst:22 +msgid "" +"import asyncio\n" +"\n" +"async def run(cmd):\n" +" proc = await asyncio.create_subprocess_shell(\n" +" cmd,\n" +" stdout=asyncio.subprocess.PIPE,\n" +" stderr=asyncio.subprocess.PIPE)\n" +"\n" +" stdout, stderr = await proc.communicate()\n" +"\n" +" print(f'[{cmd!r} exited with {proc.returncode}]')\n" +" if stdout:\n" +" print(f'[stdout]\\n{stdout.decode()}')\n" +" if stderr:\n" +" print(f'[stderr]\\n{stderr.decode()}')\n" +"\n" +"asyncio.run(run('ls /zzz'))" +msgstr "" + #: library/asyncio-subprocess.rst:40 msgid "will print::" msgstr "" +#: library/asyncio-subprocess.rst:42 +msgid "" +"['ls /zzz' exited with 1]\n" +"[stderr]\n" +"ls: /zzz: No such file or directory" +msgstr "" + #: library/asyncio-subprocess.rst:46 msgid "" "Because all asyncio subprocess functions are asynchronous and asyncio " @@ -50,6 +79,16 @@ msgid "" "the above example to run several commands simultaneously::" msgstr "" +#: library/asyncio-subprocess.rst:51 +msgid "" +"async def main():\n" +" await asyncio.gather(\n" +" run('ls /zzz'),\n" +" run('sleep 1; echo \"hello\"'))\n" +"\n" +"asyncio.run(main())" +msgstr "" + #: library/asyncio-subprocess.rst:58 msgid "See also the `Examples`_ subsection." msgstr "" @@ -58,40 +97,47 @@ msgstr "" msgid "Creating Subprocesses" msgstr "" -#: library/asyncio-subprocess.rst:67 +#: library/asyncio-subprocess.rst:68 msgid "Create a subprocess." msgstr "" -#: library/asyncio-subprocess.rst:69 library/asyncio-subprocess.rst:87 +#: library/asyncio-subprocess.rst:70 library/asyncio-subprocess.rst:92 msgid "" "The *limit* argument sets the buffer limit for :class:`StreamReader` " -"wrappers for :attr:`Process.stdout` and :attr:`Process.stderr` (if :const:" -"`subprocess.PIPE` is passed to *stdout* and *stderr* arguments)." +"wrappers for :attr:`~asyncio.subprocess.Process.stdout` and :attr:`~asyncio." +"subprocess.Process.stderr` (if :const:`subprocess.PIPE` is passed to " +"*stdout* and *stderr* arguments)." msgstr "" -#: library/asyncio-subprocess.rst:73 library/asyncio-subprocess.rst:91 +#: library/asyncio-subprocess.rst:74 library/asyncio-subprocess.rst:96 msgid "Return a :class:`~asyncio.subprocess.Process` instance." msgstr "" -#: library/asyncio-subprocess.rst:75 +#: library/asyncio-subprocess.rst:76 msgid "" "See the documentation of :meth:`loop.subprocess_exec` for other parameters." msgstr "" -#: library/asyncio-subprocess.rst:78 library/asyncio-subprocess.rst:105 +#: library/asyncio-subprocess.rst:79 library/asyncio-subprocess.rst:101 +msgid "" +"If the process object is garbage collected while the process is still " +"running, the child process will be killed." +msgstr "" + +#: library/asyncio-subprocess.rst:82 library/asyncio-subprocess.rst:113 msgid "Removed the *loop* parameter." msgstr "" -#: library/asyncio-subprocess.rst:85 +#: library/asyncio-subprocess.rst:90 msgid "Run the *cmd* shell command." msgstr "" -#: library/asyncio-subprocess.rst:93 +#: library/asyncio-subprocess.rst:98 msgid "" "See the documentation of :meth:`loop.subprocess_shell` for other parameters." msgstr "" -#: library/asyncio-subprocess.rst:98 +#: library/asyncio-subprocess.rst:106 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -101,14 +147,14 @@ msgid "" "be used to construct shell commands." msgstr "" -#: library/asyncio-subprocess.rst:110 +#: library/asyncio-subprocess.rst:118 msgid "" "Subprocesses are available for Windows if a :class:`ProactorEventLoop` is " "used. See :ref:`Subprocess Support on Windows ` " "for details." msgstr "" -#: library/asyncio-subprocess.rst:116 +#: library/asyncio-subprocess.rst:124 msgid "" "asyncio also has the following *low-level* APIs to work with subprocesses: :" "meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop." @@ -117,47 +163,47 @@ msgid "" "Protocols `." msgstr "" -#: library/asyncio-subprocess.rst:124 +#: library/asyncio-subprocess.rst:132 msgid "Constants" msgstr "" -#: library/asyncio-subprocess.rst:129 +#: library/asyncio-subprocess.rst:137 msgid "Can be passed to the *stdin*, *stdout* or *stderr* parameters." msgstr "" -#: library/asyncio-subprocess.rst:131 +#: library/asyncio-subprocess.rst:139 msgid "" "If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin ` attribute will point to a :class:`StreamWriter` " -"instance." +"subprocess.Process.stdin>` attribute will point to a :class:`~asyncio." +"StreamWriter` instance." msgstr "" -#: library/asyncio-subprocess.rst:135 +#: library/asyncio-subprocess.rst:143 msgid "" "If *PIPE* is passed to *stdout* or *stderr* arguments, the :attr:`Process." "stdout ` and :attr:`Process.stderr " "` attributes will point to :class:" -"`StreamReader` instances." +"`~asyncio.StreamReader` instances." msgstr "" -#: library/asyncio-subprocess.rst:143 +#: library/asyncio-subprocess.rst:151 msgid "" "Special value that can be used as the *stderr* argument and indicates that " "standard error should be redirected into standard output." msgstr "" -#: library/asyncio-subprocess.rst:149 +#: library/asyncio-subprocess.rst:157 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " "to process creation functions. It indicates that the special file :data:`os." "devnull` will be used for the corresponding subprocess stream." msgstr "" -#: library/asyncio-subprocess.rst:155 +#: library/asyncio-subprocess.rst:163 msgid "Interacting with Subprocesses" msgstr "" -#: library/asyncio-subprocess.rst:157 +#: library/asyncio-subprocess.rst:165 msgid "" "Both :func:`create_subprocess_exec` and :func:`create_subprocess_shell` " "functions return instances of the *Process* class. *Process* is a high-" @@ -165,61 +211,62 @@ msgid "" "their completion." msgstr "" -#: library/asyncio-subprocess.rst:165 +#: library/asyncio-subprocess.rst:173 msgid "" -"An object that wraps OS processes created by the :func:" -"`create_subprocess_exec` and :func:`create_subprocess_shell` functions." +"An object that wraps OS processes created by the :func:`~asyncio." +"create_subprocess_exec` and :func:`~asyncio.create_subprocess_shell` " +"functions." msgstr "" -#: library/asyncio-subprocess.rst:169 +#: library/asyncio-subprocess.rst:177 msgid "" "This class is designed to have a similar API to the :class:`subprocess." "Popen` class, but there are some notable differences:" msgstr "" -#: library/asyncio-subprocess.rst:173 +#: library/asyncio-subprocess.rst:181 msgid "" "unlike Popen, Process instances do not have an equivalent to the :meth:" "`~subprocess.Popen.poll` method;" msgstr "" -#: library/asyncio-subprocess.rst:176 +#: library/asyncio-subprocess.rst:184 msgid "" "the :meth:`~asyncio.subprocess.Process.communicate` and :meth:`~asyncio." "subprocess.Process.wait` methods don't have a *timeout* parameter: use the :" "func:`~asyncio.wait_for` function;" msgstr "" -#: library/asyncio-subprocess.rst:180 +#: library/asyncio-subprocess.rst:188 msgid "" "the :meth:`Process.wait() ` method is " "asynchronous, whereas :meth:`subprocess.Popen.wait` method is implemented as " "a blocking busy loop;" msgstr "" -#: library/asyncio-subprocess.rst:184 +#: library/asyncio-subprocess.rst:192 msgid "the *universal_newlines* parameter is not supported." msgstr "" -#: library/asyncio-subprocess.rst:186 +#: library/asyncio-subprocess.rst:194 msgid "This class is :ref:`not thread safe `." msgstr "" -#: library/asyncio-subprocess.rst:188 +#: library/asyncio-subprocess.rst:196 msgid "" "See also the :ref:`Subprocess and Threads ` " "section." msgstr "" -#: library/asyncio-subprocess.rst:193 +#: library/asyncio-subprocess.rst:202 msgid "Wait for the child process to terminate." msgstr "" -#: library/asyncio-subprocess.rst:195 +#: library/asyncio-subprocess.rst:204 msgid "Set and return the :attr:`returncode` attribute." msgstr "" -#: library/asyncio-subprocess.rst:199 +#: library/asyncio-subprocess.rst:208 msgid "" "This method can deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and " "the child process generates so much output that it blocks waiting for the OS " @@ -227,37 +274,37 @@ msgid "" "using pipes to avoid this condition." msgstr "" -#: library/asyncio-subprocess.rst:207 +#: library/asyncio-subprocess.rst:217 msgid "Interact with process:" msgstr "" -#: library/asyncio-subprocess.rst:209 +#: library/asyncio-subprocess.rst:219 msgid "send data to *stdin* (if *input* is not ``None``);" msgstr "" -#: library/asyncio-subprocess.rst:210 +#: library/asyncio-subprocess.rst:220 msgid "closes *stdin*;" msgstr "" -#: library/asyncio-subprocess.rst:211 +#: library/asyncio-subprocess.rst:221 msgid "read data from *stdout* and *stderr*, until EOF is reached;" msgstr "" -#: library/asyncio-subprocess.rst:212 +#: library/asyncio-subprocess.rst:222 msgid "wait for process to terminate." msgstr "" -#: library/asyncio-subprocess.rst:214 +#: library/asyncio-subprocess.rst:224 msgid "" "The optional *input* argument is the data (:class:`bytes` object) that will " "be sent to the child process." msgstr "" -#: library/asyncio-subprocess.rst:217 +#: library/asyncio-subprocess.rst:227 msgid "Return a tuple ``(stdout_data, stderr_data)``." msgstr "" -#: library/asyncio-subprocess.rst:219 +#: library/asyncio-subprocess.rst:229 msgid "" "If either :exc:`BrokenPipeError` or :exc:`ConnectionResetError` exception is " "raised when writing *input* into *stdin*, the exception is ignored. This " @@ -265,7 +312,7 @@ msgid "" "*stdin*." msgstr "" -#: library/asyncio-subprocess.rst:224 +#: library/asyncio-subprocess.rst:234 msgid "" "If it is desired to send data to the process' *stdin*, the process needs to " "be created with ``stdin=PIPE``. Similarly, to get anything other than " @@ -273,75 +320,76 @@ msgid "" "``stdout=PIPE`` and/or ``stderr=PIPE`` arguments." msgstr "" -#: library/asyncio-subprocess.rst:230 +#: library/asyncio-subprocess.rst:240 msgid "" "Note, that the data read is buffered in memory, so do not use this method if " "the data size is large or unlimited." msgstr "" -#: library/asyncio-subprocess.rst:235 -msgid "*stdin* gets closed when `input=None` too." +#: library/asyncio-subprocess.rst:245 +msgid "*stdin* gets closed when ``input=None`` too." msgstr "" -#: library/asyncio-subprocess.rst:239 +#: library/asyncio-subprocess.rst:249 msgid "Sends the signal *signal* to the child process." msgstr "" -#: library/asyncio-subprocess.rst:243 +#: library/asyncio-subprocess.rst:253 msgid "" "On Windows, :py:const:`~signal.SIGTERM` is an alias for :meth:`terminate`. " "``CTRL_C_EVENT`` and ``CTRL_BREAK_EVENT`` can be sent to processes started " "with a *creationflags* parameter which includes ``CREATE_NEW_PROCESS_GROUP``." msgstr "" -#: library/asyncio-subprocess.rst:250 +#: library/asyncio-subprocess.rst:260 msgid "Stop the child process." msgstr "" -#: library/asyncio-subprocess.rst:252 +#: library/asyncio-subprocess.rst:262 msgid "" "On POSIX systems this method sends :py:const:`~signal.SIGTERM` to the child " "process." msgstr "" -#: library/asyncio-subprocess.rst:255 +#: library/asyncio-subprocess.rst:265 msgid "" "On Windows the Win32 API function :c:func:`!TerminateProcess` is called to " "stop the child process." msgstr "" -#: library/asyncio-subprocess.rst:260 +#: library/asyncio-subprocess.rst:270 msgid "Kill the child process." msgstr "" -#: library/asyncio-subprocess.rst:262 +#: library/asyncio-subprocess.rst:272 msgid "" -"On POSIX systems this method sends :py:data:`SIGKILL` to the child process." +"On POSIX systems this method sends :py:data:`~signal.SIGKILL` to the child " +"process." msgstr "" -#: library/asyncio-subprocess.rst:265 +#: library/asyncio-subprocess.rst:275 msgid "On Windows this method is an alias for :meth:`terminate`." msgstr "" -#: library/asyncio-subprocess.rst:269 +#: library/asyncio-subprocess.rst:279 msgid "" -"Standard input stream (:class:`StreamWriter`) or ``None`` if the process was " -"created with ``stdin=None``." +"Standard input stream (:class:`~asyncio.StreamWriter`) or ``None`` if the " +"process was created with ``stdin=None``." msgstr "" -#: library/asyncio-subprocess.rst:274 +#: library/asyncio-subprocess.rst:284 msgid "" -"Standard output stream (:class:`StreamReader`) or ``None`` if the process " -"was created with ``stdout=None``." +"Standard output stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stdout=None``." msgstr "" -#: library/asyncio-subprocess.rst:279 +#: library/asyncio-subprocess.rst:289 msgid "" -"Standard error stream (:class:`StreamReader`) or ``None`` if the process was " -"created with ``stderr=None``." +"Standard error stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stderr=None``." msgstr "" -#: library/asyncio-subprocess.rst:284 +#: library/asyncio-subprocess.rst:294 msgid "" "Use the :meth:`communicate` method rather than :attr:`process.stdin.write() " "`, :attr:`await process.stdout.read() ` or :attr:`await " @@ -349,93 +397,102 @@ msgid "" "pausing reading or writing and blocking the child process." msgstr "" -#: library/asyncio-subprocess.rst:293 +#: library/asyncio-subprocess.rst:303 msgid "Process identification number (PID)." msgstr "" -#: library/asyncio-subprocess.rst:295 +#: library/asyncio-subprocess.rst:305 msgid "" -"Note that for processes created by the :func:`create_subprocess_shell` " -"function, this attribute is the PID of the spawned shell." +"Note that for processes created by the :func:`~asyncio." +"create_subprocess_shell` function, this attribute is the PID of the spawned " +"shell." msgstr "" -#: library/asyncio-subprocess.rst:300 +#: library/asyncio-subprocess.rst:310 msgid "Return code of the process when it exits." msgstr "" -#: library/asyncio-subprocess.rst:302 +#: library/asyncio-subprocess.rst:312 msgid "A ``None`` value indicates that the process has not terminated yet." msgstr "" -#: library/asyncio-subprocess.rst:304 +#: library/asyncio-subprocess.rst:314 msgid "" "A negative value ``-N`` indicates that the child was terminated by signal " "``N`` (POSIX only)." msgstr "" -#: library/asyncio-subprocess.rst:311 +#: library/asyncio-subprocess.rst:321 msgid "Subprocess and Threads" msgstr "" -#: library/asyncio-subprocess.rst:313 +#: library/asyncio-subprocess.rst:323 msgid "" "Standard asyncio event loop supports running subprocesses from different " "threads by default." msgstr "" -#: library/asyncio-subprocess.rst:316 +#: library/asyncio-subprocess.rst:326 msgid "" "On Windows subprocesses are provided by :class:`ProactorEventLoop` only " "(default), :class:`SelectorEventLoop` has no subprocess support." msgstr "" -#: library/asyncio-subprocess.rst:319 -msgid "" -"On UNIX *child watchers* are used for subprocess finish waiting, see :ref:" -"`asyncio-watchers` for more info." -msgstr "" - -#: library/asyncio-subprocess.rst:325 -msgid "" -"UNIX switched to use :class:`ThreadedChildWatcher` for spawning subprocesses " -"from different threads without any limitation." -msgstr "" - -#: library/asyncio-subprocess.rst:328 -msgid "" -"Spawning a subprocess with *inactive* current child watcher raises :exc:" -"`RuntimeError`." -msgstr "" - -#: library/asyncio-subprocess.rst:331 +#: library/asyncio-subprocess.rst:329 msgid "" "Note that alternative event loop implementations might have own limitations; " "please refer to their documentation." msgstr "" -#: library/asyncio-subprocess.rst:336 +#: library/asyncio-subprocess.rst:334 msgid "" "The :ref:`Concurrency and multithreading in asyncio ` section." msgstr "" -#: library/asyncio-subprocess.rst:341 +#: library/asyncio-subprocess.rst:339 msgid "Examples" msgstr "" -#: library/asyncio-subprocess.rst:343 +#: library/asyncio-subprocess.rst:341 msgid "" "An example using the :class:`~asyncio.subprocess.Process` class to control a " "subprocess and the :class:`StreamReader` class to read from its standard " "output." msgstr "" -#: library/asyncio-subprocess.rst:349 +#: library/asyncio-subprocess.rst:347 msgid "" "The subprocess is created by the :func:`create_subprocess_exec` function::" msgstr "" -#: library/asyncio-subprocess.rst:376 +#: library/asyncio-subprocess.rst:350 +msgid "" +"import asyncio\n" +"import sys\n" +"\n" +"async def get_date():\n" +" code = 'import datetime; print(datetime.datetime.now())'\n" +"\n" +" # Create the subprocess; redirect the standard output\n" +" # into a pipe.\n" +" proc = await asyncio.create_subprocess_exec(\n" +" sys.executable, '-c', code,\n" +" stdout=asyncio.subprocess.PIPE)\n" +"\n" +" # Read one line of output.\n" +" data = await proc.stdout.readline()\n" +" line = data.decode('ascii').rstrip()\n" +"\n" +" # Wait for the subprocess exit.\n" +" await proc.wait()\n" +" return line\n" +"\n" +"date = asyncio.run(get_date())\n" +"print(f\"Current date: {date}\")" +msgstr "" + +#: library/asyncio-subprocess.rst:374 msgid "" "See also the :ref:`same example ` written " "using low-level APIs." diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index e0cb42ce..c7c5c9fd 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -89,68 +90,89 @@ msgstr "" msgid "The preferred way to use a Lock is an :keyword:`async with` statement::" msgstr "" -#: library/asyncio-sync.rst:199 library/asyncio-sync.rst:298 +#: library/asyncio-sync.rst:50 +msgid "" +"lock = asyncio.Lock()\n" +"\n" +"# ... later\n" +"async with lock:\n" +" # access shared state" +msgstr "" + +#: library/asyncio-sync.rst:201 library/asyncio-sync.rst:309 msgid "which is equivalent to::" msgstr "" -#: library/asyncio-sync.rst:112 library/asyncio-sync.rst:286 -#: library/asyncio-sync.rst:341 +#: library/asyncio-sync.rst:58 +msgid "" +"lock = asyncio.Lock()\n" +"\n" +"# ... later\n" +"await lock.acquire()\n" +"try:\n" +" # access shared state\n" +"finally:\n" +" lock.release()" +msgstr "" + +#: library/asyncio-sync.rst:113 library/asyncio-sync.rst:297 +#: library/asyncio-sync.rst:353 msgid "Removed the *loop* parameter." msgstr "" -#: library/asyncio-sync.rst:72 +#: library/asyncio-sync.rst:73 msgid "Acquire the lock." msgstr "" -#: library/asyncio-sync.rst:74 +#: library/asyncio-sync.rst:75 msgid "" "This method waits until the lock is *unlocked*, sets it to *locked* and " "returns ``True``." msgstr "" -#: library/asyncio-sync.rst:77 +#: library/asyncio-sync.rst:78 msgid "" "When more than one coroutine is blocked in :meth:`acquire` waiting for the " "lock to be unlocked, only one coroutine eventually proceeds." msgstr "" -#: library/asyncio-sync.rst:81 +#: library/asyncio-sync.rst:82 msgid "" "Acquiring a lock is *fair*: the coroutine that proceeds will be the first " "coroutine that started waiting on the lock." msgstr "" -#: library/asyncio-sync.rst:86 +#: library/asyncio-sync.rst:87 msgid "Release the lock." msgstr "" -#: library/asyncio-sync.rst:88 +#: library/asyncio-sync.rst:89 msgid "When the lock is *locked*, reset it to *unlocked* and return." msgstr "" -#: library/asyncio-sync.rst:90 +#: library/asyncio-sync.rst:91 msgid "If the lock is *unlocked*, a :exc:`RuntimeError` is raised." msgstr "" -#: library/asyncio-sync.rst:94 +#: library/asyncio-sync.rst:95 msgid "Return ``True`` if the lock is *locked*." msgstr "" -#: library/asyncio-sync.rst:98 +#: library/asyncio-sync.rst:99 msgid "Event" msgstr "" -#: library/asyncio-sync.rst:102 +#: library/asyncio-sync.rst:103 msgid "An event object. Not thread-safe." msgstr "" -#: library/asyncio-sync.rst:104 +#: library/asyncio-sync.rst:105 msgid "" "An asyncio event can be used to notify multiple asyncio tasks that some " "event has happened." msgstr "" -#: library/asyncio-sync.rst:107 +#: library/asyncio-sync.rst:108 msgid "" "An Event object manages an internal flag that can be set to *true* with the :" "meth:`~Event.set` method and reset to *false* with the :meth:`clear` " @@ -158,57 +180,81 @@ msgid "" "*true*. The flag is set to *false* initially." msgstr "" -#: library/asyncio-sync.rst:365 +#: library/asyncio-sync.rst:377 msgid "Example::" msgstr "" -#: library/asyncio-sync.rst:142 -msgid "Wait until the event is set." +#: library/asyncio-sync.rst:120 +msgid "" +"async def waiter(event):\n" +" print('waiting for it ...')\n" +" await event.wait()\n" +" print('... got it!')\n" +"\n" +"async def main():\n" +" # Create an Event object.\n" +" event = asyncio.Event()\n" +"\n" +" # Spawn a Task to wait until 'event' is set.\n" +" waiter_task = asyncio.create_task(waiter(event))\n" +"\n" +" # Sleep for 1 second and set the event.\n" +" await asyncio.sleep(1)\n" +" event.set()\n" +"\n" +" # Wait until the waiter task is finished.\n" +" await waiter_task\n" +"\n" +"asyncio.run(main())" msgstr "" #: library/asyncio-sync.rst:144 +msgid "Wait until the event is set." +msgstr "" + +#: library/asyncio-sync.rst:146 msgid "" "If the event is set, return ``True`` immediately. Otherwise block until " "another task calls :meth:`~Event.set`." msgstr "" -#: library/asyncio-sync.rst:149 +#: library/asyncio-sync.rst:151 msgid "Set the event." msgstr "" -#: library/asyncio-sync.rst:151 +#: library/asyncio-sync.rst:153 msgid "All tasks waiting for event to be set will be immediately awakened." msgstr "" -#: library/asyncio-sync.rst:156 +#: library/asyncio-sync.rst:158 msgid "Clear (unset) the event." msgstr "" -#: library/asyncio-sync.rst:158 +#: library/asyncio-sync.rst:160 msgid "" -"Tasks awaiting on :meth:`~Event.wait` will now block until the :meth:`~Event." -"set` method is called again." +"Subsequent tasks awaiting on :meth:`~Event.wait` will now block until the :" +"meth:`~Event.set` method is called again." msgstr "" -#: library/asyncio-sync.rst:163 +#: library/asyncio-sync.rst:165 msgid "Return ``True`` if the event is set." msgstr "" -#: library/asyncio-sync.rst:167 +#: library/asyncio-sync.rst:169 msgid "Condition" msgstr "" -#: library/asyncio-sync.rst:171 +#: library/asyncio-sync.rst:173 msgid "A Condition object. Not thread-safe." msgstr "" -#: library/asyncio-sync.rst:173 +#: library/asyncio-sync.rst:175 msgid "" "An asyncio condition primitive can be used by a task to wait for some event " "to happen and then get exclusive access to a shared resource." msgstr "" -#: library/asyncio-sync.rst:177 +#: library/asyncio-sync.rst:179 msgid "" "In essence, a Condition object combines the functionality of an :class:" "`Event` and a :class:`Lock`. It is possible to have multiple Condition " @@ -217,96 +263,126 @@ msgid "" "that shared resource." msgstr "" -#: library/asyncio-sync.rst:183 +#: library/asyncio-sync.rst:185 msgid "" "The optional *lock* argument must be a :class:`Lock` object or ``None``. In " "the latter case a new Lock object is created automatically." msgstr "" -#: library/asyncio-sync.rst:190 +#: library/asyncio-sync.rst:192 msgid "" "The preferred way to use a Condition is an :keyword:`async with` statement::" msgstr "" -#: library/asyncio-sync.rst:212 +#: library/asyncio-sync.rst:195 +msgid "" +"cond = asyncio.Condition()\n" +"\n" +"# ... later\n" +"async with cond:\n" +" await cond.wait()" +msgstr "" + +#: library/asyncio-sync.rst:203 +msgid "" +"cond = asyncio.Condition()\n" +"\n" +"# ... later\n" +"await cond.acquire()\n" +"try:\n" +" await cond.wait()\n" +"finally:\n" +" cond.release()" +msgstr "" + +#: library/asyncio-sync.rst:215 msgid "Acquire the underlying lock." msgstr "" -#: library/asyncio-sync.rst:214 +#: library/asyncio-sync.rst:217 msgid "" "This method waits until the underlying lock is *unlocked*, sets it to " "*locked* and returns ``True``." msgstr "" -#: library/asyncio-sync.rst:219 +#: library/asyncio-sync.rst:222 msgid "" -"Wake up at most *n* tasks (1 by default) waiting on this condition. The " -"method is no-op if no tasks are waiting." +"Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " +"*n* tasks are waiting they are all awakened." msgstr "" -#: library/asyncio-sync.rst:237 +#: library/asyncio-sync.rst:240 msgid "" "The lock must be acquired before this method is called and released shortly " "after. If called with an *unlocked* lock a :exc:`RuntimeError` error is " "raised." msgstr "" -#: library/asyncio-sync.rst:228 +#: library/asyncio-sync.rst:231 msgid "Return ``True`` if the underlying lock is acquired." msgstr "" -#: library/asyncio-sync.rst:232 +#: library/asyncio-sync.rst:235 msgid "Wake up all tasks waiting on this condition." msgstr "" -#: library/asyncio-sync.rst:234 +#: library/asyncio-sync.rst:237 msgid "This method acts like :meth:`notify`, but wakes up all waiting tasks." msgstr "" -#: library/asyncio-sync.rst:243 +#: library/asyncio-sync.rst:246 msgid "Release the underlying lock." msgstr "" -#: library/asyncio-sync.rst:245 +#: library/asyncio-sync.rst:248 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "" -#: library/asyncio-sync.rst:250 +#: library/asyncio-sync.rst:254 msgid "Wait until notified." msgstr "" -#: library/asyncio-sync.rst:252 +#: library/asyncio-sync.rst:256 msgid "" "If the calling task has not acquired the lock when this method is called, a :" "exc:`RuntimeError` is raised." msgstr "" -#: library/asyncio-sync.rst:255 +#: library/asyncio-sync.rst:259 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the " "Condition re-acquires its lock and this method returns ``True``." msgstr "" -#: library/asyncio-sync.rst:262 +#: library/asyncio-sync.rst:264 +msgid "" +"Note that a task *may* return from this call spuriously, which is why the " +"caller should always re-check the state and be prepared to :meth:`~Condition." +"wait` again. For this reason, you may prefer to use :meth:`~Condition." +"wait_for` instead." +msgstr "" + +#: library/asyncio-sync.rst:272 msgid "Wait until a predicate becomes *true*." msgstr "" -#: library/asyncio-sync.rst:264 +#: library/asyncio-sync.rst:274 msgid "" "The predicate must be a callable which result will be interpreted as a " -"boolean value. The final value is the return value." +"boolean value. The method will repeatedly :meth:`~Condition.wait` until the " +"predicate evaluates to *true*. The final value is the return value." msgstr "" -#: library/asyncio-sync.rst:270 +#: library/asyncio-sync.rst:281 msgid "Semaphore" msgstr "" -#: library/asyncio-sync.rst:274 +#: library/asyncio-sync.rst:285 msgid "A Semaphore object. Not thread-safe." msgstr "" -#: library/asyncio-sync.rst:276 +#: library/asyncio-sync.rst:287 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`acquire` call and incremented by each :meth:`release` call. The counter can " @@ -314,69 +390,90 @@ msgid "" "waiting until some task calls :meth:`release`." msgstr "" -#: library/asyncio-sync.rst:282 +#: library/asyncio-sync.rst:293 msgid "" "The optional *value* argument gives the initial value for the internal " "counter (``1`` by default). If the given value is less than ``0`` a :exc:" "`ValueError` is raised." msgstr "" -#: library/asyncio-sync.rst:289 +#: library/asyncio-sync.rst:300 msgid "" "The preferred way to use a Semaphore is an :keyword:`async with` statement::" msgstr "" +#: library/asyncio-sync.rst:303 +msgid "" +"sem = asyncio.Semaphore(10)\n" +"\n" +"# ... later\n" +"async with sem:\n" +" # work with shared resource" +msgstr "" + #: library/asyncio-sync.rst:311 +msgid "" +"sem = asyncio.Semaphore(10)\n" +"\n" +"# ... later\n" +"await sem.acquire()\n" +"try:\n" +" # work with shared resource\n" +"finally:\n" +" sem.release()" +msgstr "" + +#: library/asyncio-sync.rst:323 msgid "Acquire a semaphore." msgstr "" -#: library/asyncio-sync.rst:313 +#: library/asyncio-sync.rst:325 msgid "" "If the internal counter is greater than zero, decrement it by one and return " "``True`` immediately. If it is zero, wait until a :meth:`release` is called " "and return ``True``." msgstr "" -#: library/asyncio-sync.rst:319 +#: library/asyncio-sync.rst:331 msgid "Returns ``True`` if semaphore can not be acquired immediately." msgstr "" -#: library/asyncio-sync.rst:323 +#: library/asyncio-sync.rst:335 msgid "" "Release a semaphore, incrementing the internal counter by one. Can wake up a " "task waiting to acquire the semaphore." msgstr "" -#: library/asyncio-sync.rst:326 +#: library/asyncio-sync.rst:338 msgid "" "Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more " "``release()`` calls than ``acquire()`` calls." msgstr "" -#: library/asyncio-sync.rst:331 +#: library/asyncio-sync.rst:343 msgid "BoundedSemaphore" msgstr "" -#: library/asyncio-sync.rst:335 +#: library/asyncio-sync.rst:347 msgid "A bounded semaphore object. Not thread-safe." msgstr "" -#: library/asyncio-sync.rst:337 +#: library/asyncio-sync.rst:349 msgid "" "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:" "`ValueError` in :meth:`~Semaphore.release` if it increases the internal " "counter above the initial *value*." msgstr "" -#: library/asyncio-sync.rst:346 +#: library/asyncio-sync.rst:358 msgid "Barrier" msgstr "" -#: library/asyncio-sync.rst:350 +#: library/asyncio-sync.rst:362 msgid "A barrier object. Not thread-safe." msgstr "" -#: library/asyncio-sync.rst:352 +#: library/asyncio-sync.rst:364 msgid "" "A barrier is a simple synchronization primitive that allows to block until " "*parties* number of tasks are waiting on it. Tasks can wait on the :meth:" @@ -385,85 +482,127 @@ msgid "" "waiting tasks would unblock simultaneously." msgstr "" -#: library/asyncio-sync.rst:358 +#: library/asyncio-sync.rst:370 msgid "" ":keyword:`async with` can be used as an alternative to awaiting on :meth:" "`~Barrier.wait`." msgstr "" -#: library/asyncio-sync.rst:361 +#: library/asyncio-sync.rst:373 msgid "The barrier can be reused any number of times." msgstr "" -#: library/asyncio-sync.rst:388 +#: library/asyncio-sync.rst:379 +msgid "" +"async def example_barrier():\n" +" # barrier with 3 parties\n" +" b = asyncio.Barrier(3)\n" +"\n" +" # create 2 new waiting tasks\n" +" asyncio.create_task(b.wait())\n" +" asyncio.create_task(b.wait())\n" +"\n" +" await asyncio.sleep(0)\n" +" print(b)\n" +"\n" +" # The third .wait() call passes the barrier\n" +" await b.wait()\n" +" print(b)\n" +" print(\"barrier passed\")\n" +"\n" +" await asyncio.sleep(0)\n" +" print(b)\n" +"\n" +"asyncio.run(example_barrier())" +msgstr "" + +#: library/asyncio-sync.rst:400 msgid "Result of this example is::" msgstr "" -#: library/asyncio-sync.rst:399 +#: library/asyncio-sync.rst:402 +msgid "" +"\n" +"\n" +"barrier passed\n" +"" +msgstr "" + +#: library/asyncio-sync.rst:412 msgid "" "Pass the barrier. When all the tasks party to the barrier have called this " "function, they are all unblocked simultaneously." msgstr "" -#: library/asyncio-sync.rst:402 +#: library/asyncio-sync.rst:415 msgid "" "When a waiting or blocked task in the barrier is cancelled, this task exits " "the barrier which stays in the same state. If the state of the barrier is " "\"filling\", the number of waiting task decreases by 1." msgstr "" -#: library/asyncio-sync.rst:407 +#: library/asyncio-sync.rst:420 msgid "" "The return value is an integer in the range of 0 to ``parties-1``, different " "for each task. This can be used to select a task to do some special " "housekeeping, e.g.::" msgstr "" -#: library/asyncio-sync.rst:417 +#: library/asyncio-sync.rst:424 +msgid "" +"...\n" +"async with barrier as position:\n" +" if position == 0:\n" +" # Only one task prints this\n" +" print('End of *draining phase*')" +msgstr "" + +#: library/asyncio-sync.rst:430 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a task is waiting. It could raise a :exc:" "`CancelledError` if a task is cancelled." msgstr "" -#: library/asyncio-sync.rst:423 +#: library/asyncio-sync.rst:437 msgid "" "Return the barrier to the default, empty state. Any tasks waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: library/asyncio-sync.rst:426 +#: library/asyncio-sync.rst:440 msgid "" "If a barrier is broken it may be better to just leave it and create a new " "one." msgstr "" -#: library/asyncio-sync.rst:430 +#: library/asyncio-sync.rst:445 msgid "" "Put the barrier into a broken state. This causes any active or future calls " -"to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " -"example if one of the tasks needs to abort, to avoid infinite waiting tasks." +"to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use " +"this for example if one of the tasks needs to abort, to avoid infinite " +"waiting tasks." msgstr "" -#: library/asyncio-sync.rst:437 +#: library/asyncio-sync.rst:452 msgid "The number of tasks required to pass the barrier." msgstr "" -#: library/asyncio-sync.rst:441 +#: library/asyncio-sync.rst:456 msgid "The number of tasks currently waiting in the barrier while filling." msgstr "" -#: library/asyncio-sync.rst:445 +#: library/asyncio-sync.rst:460 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: library/asyncio-sync.rst:450 +#: library/asyncio-sync.rst:465 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: library/asyncio-sync.rst:458 +#: library/asyncio-sync.rst:473 msgid "" "Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:" "`with` statement (``with await lock``, ``with (yield from lock)``) was " diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 59f36ed1..e341c0be 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -41,11 +42,31 @@ msgid "" "snippet of code prints \"hello\", waits 1 second, and then prints \"world\"::" msgstr "" +#: library/asyncio-task.rst:30 +msgid "" +">>> import asyncio\n" +"\n" +">>> async def main():\n" +"... print('hello')\n" +"... await asyncio.sleep(1)\n" +"... print('world')\n" +"\n" +">>> asyncio.run(main())\n" +"hello\n" +"world" +msgstr "" + #: library/asyncio-task.rst:41 msgid "" "Note that simply calling a coroutine will not schedule it to be executed::" msgstr "" +#: library/asyncio-task.rst:44 +msgid "" +">>> main()\n" +"" +msgstr "" + #: library/asyncio-task.rst:47 msgid "To actually run a coroutine, asyncio provides the following mechanisms:" msgstr "" @@ -63,10 +84,38 @@ msgid "" "*another* 2 seconds::" msgstr "" +#: library/asyncio-task.rst:56 +msgid "" +"import asyncio\n" +"import time\n" +"\n" +"async def say_after(delay, what):\n" +" await asyncio.sleep(delay)\n" +" print(what)\n" +"\n" +"async def main():\n" +" print(f\"started at {time.strftime('%X')}\")\n" +"\n" +" await say_after(1, 'hello')\n" +" await say_after(2, 'world')\n" +"\n" +" print(f\"finished at {time.strftime('%X')}\")\n" +"\n" +"asyncio.run(main())" +msgstr "" + #: library/asyncio-task.rst:73 msgid "Expected output::" msgstr "" +#: library/asyncio-task.rst:75 +msgid "" +"started at 17:13:52\n" +"hello\n" +"world\n" +"finished at 17:13:55" +msgstr "" + #: library/asyncio-task.rst:80 msgid "" "The :func:`asyncio.create_task` function to run coroutines concurrently as " @@ -79,18 +128,62 @@ msgid "" "*concurrently*::" msgstr "" +#: library/asyncio-task.rst:86 +msgid "" +"async def main():\n" +" task1 = asyncio.create_task(\n" +" say_after(1, 'hello'))\n" +"\n" +" task2 = asyncio.create_task(\n" +" say_after(2, 'world'))\n" +"\n" +" print(f\"started at {time.strftime('%X')}\")\n" +"\n" +" # Wait until both tasks are completed (should take\n" +" # around 2 seconds.)\n" +" await task1\n" +" await task2\n" +"\n" +" print(f\"finished at {time.strftime('%X')}\")" +msgstr "" + #: library/asyncio-task.rst:102 msgid "" "Note that expected output now shows that the snippet runs 1 second faster " "than before::" msgstr "" +#: library/asyncio-task.rst:105 +msgid "" +"started at 17:14:32\n" +"hello\n" +"world\n" +"finished at 17:14:34" +msgstr "" + #: library/asyncio-task.rst:110 msgid "" "The :class:`asyncio.TaskGroup` class provides a more modern alternative to :" "func:`create_task`. Using this API, the last example becomes::" msgstr "" +#: library/asyncio-task.rst:114 +msgid "" +"async def main():\n" +" async with asyncio.TaskGroup() as tg:\n" +" task1 = tg.create_task(\n" +" say_after(1, 'hello'))\n" +"\n" +" task2 = tg.create_task(\n" +" say_after(2, 'world'))\n" +"\n" +" print(f\"started at {time.strftime('%X')}\")\n" +"\n" +" # The await is implicit when the context manager exits.\n" +"\n" +" print(f\"finished at {time.strftime('%X')}\")" +msgstr "" + #: library/asyncio-task.rst:128 msgid "The timing and output should be the same as for the previous version." msgstr "" @@ -122,6 +215,25 @@ msgid "" "coroutines::" msgstr "" +#: library/asyncio-task.rst:152 +msgid "" +"import asyncio\n" +"\n" +"async def nested():\n" +" return 42\n" +"\n" +"async def main():\n" +" # Nothing happens if we just call \"nested()\".\n" +" # A coroutine object is created but not awaited,\n" +" # so it *won't run at all*.\n" +" nested() # will raise a \"RuntimeWarning\".\n" +"\n" +" # Let's do it differently now and await it:\n" +" print(await nested()) # will print \"42\".\n" +"\n" +"asyncio.run(main())" +msgstr "" + #: library/asyncio-task.rst:170 msgid "" "In this documentation the term \"coroutine\" can be used for two closely " @@ -151,6 +263,25 @@ msgid "" "create_task` the coroutine is automatically scheduled to run soon::" msgstr "" +#: library/asyncio-task.rst:187 +msgid "" +"import asyncio\n" +"\n" +"async def nested():\n" +" return 42\n" +"\n" +"async def main():\n" +" # Schedule nested() to run soon concurrently\n" +" # with \"main()\".\n" +" task = asyncio.create_task(nested())\n" +"\n" +" # \"task\" can now be used to cancel \"nested()\", or\n" +" # can simply be awaited to wait until it is complete:\n" +" await task\n" +"\n" +"asyncio.run(main())" +msgstr "" + #: library/asyncio-task.rst:205 msgid "Futures" msgstr "" @@ -185,6 +316,18 @@ msgid "" "awaited::" msgstr "" +#: library/asyncio-task.rst:221 +msgid "" +"async def main():\n" +" await function_that_returns_a_future_object()\n" +"\n" +" # this is also valid:\n" +" await asyncio.gather(\n" +" function_that_returns_a_future_object(),\n" +" some_python_coroutine()\n" +" )" +msgstr "" + #: library/asyncio-task.rst:230 msgid "" "A good example of a low-level function that returns a Future object is :meth:" @@ -207,31 +350,40 @@ msgstr "" #: library/asyncio-task.rst:246 msgid "" -"If *name* is not ``None``, it is set as the name of the task using :meth:" -"`Task.set_name`." +"The full function signature is largely the same as that of the :class:`Task` " +"constructor (or factory) - all of the keyword arguments to this function are " +"passed through to that interface." msgstr "" -#: library/asyncio-task.rst:249 +#: library/asyncio-task.rst:250 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. The current context " "copy is created when no *context* is provided." msgstr "" -#: library/asyncio-task.rst:253 +#: library/asyncio-task.rst:254 +msgid "" +"An optional keyword-only *eager_start* argument allows specifying if the " +"task should execute eagerly during the call to create_task, or be scheduled " +"later. If *eager_start* is not passed the mode set by :meth:`loop." +"set_task_factory` will be used." +msgstr "" + +#: library/asyncio-task.rst:259 msgid "" "The task is executed in the loop returned by :func:`get_running_loop`, :exc:" "`RuntimeError` is raised if there is no running loop in current thread." msgstr "" -#: library/asyncio-task.rst:259 +#: library/asyncio-task.rst:265 msgid "" ":meth:`asyncio.TaskGroup.create_task` is a new alternative leveraging " "structural concurrency; it allows for waiting for a group of related tasks " "with strong safety guarantees." msgstr "" -#: library/asyncio-task.rst:265 +#: library/asyncio-task.rst:271 msgid "" "Save a reference to the result of this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -240,25 +392,45 @@ msgid "" "tasks, gather them in a collection::" msgstr "" -#: library/asyncio-task.rst:1075 +#: library/asyncio-task.rst:278 +msgid "" +"background_tasks = set()\n" +"\n" +"for i in range(10):\n" +" task = asyncio.create_task(some_coro(param=i))\n" +"\n" +" # Add task to the set. This creates a strong reference.\n" +" background_tasks.add(task)\n" +"\n" +" # To prevent keeping references to finished tasks forever,\n" +" # make each task remove its own reference from the set after\n" +" # completion:\n" +" task.add_done_callback(background_tasks.discard)" +msgstr "" + +#: library/asyncio-task.rst:1251 msgid "Added the *name* parameter." msgstr "" -#: library/asyncio-task.rst:1082 +#: library/asyncio-task.rst:1258 msgid "Added the *context* parameter." msgstr "" -#: library/asyncio-task.rst:295 +#: library/asyncio-task.rst:299 +msgid "Added the *eager_start* parameter by passing on all *kwargs*." +msgstr "" + +#: library/asyncio-task.rst:304 msgid "Task Cancellation" msgstr "" -#: library/asyncio-task.rst:297 +#: library/asyncio-task.rst:306 msgid "" "Tasks can easily and safely be cancelled. When a task is cancelled, :exc:" "`asyncio.CancelledError` will be raised in the task at the next opportunity." msgstr "" -#: library/asyncio-task.rst:301 +#: library/asyncio-task.rst:310 msgid "" "It is recommended that coroutines use ``try/finally`` blocks to robustly " "perform clean-up logic. In case :exc:`asyncio.CancelledError` is explicitly " @@ -267,7 +439,7 @@ msgid "" "code will not need to be aware of it." msgstr "" -#: library/asyncio-task.rst:307 +#: library/asyncio-task.rst:316 msgid "" "The asyncio components that enable structured concurrency, like :class:" "`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented using " @@ -278,35 +450,55 @@ msgid "" "``uncancel()`` to completely remove the cancellation state." msgstr "" -#: library/asyncio-task.rst:319 +#: library/asyncio-task.rst:328 msgid "Task Groups" msgstr "" -#: library/asyncio-task.rst:321 +#: library/asyncio-task.rst:330 msgid "" "Task groups combine a task creation API with a convenient and reliable way " "to wait for all tasks in the group to finish." msgstr "" -#: library/asyncio-task.rst:326 +#: library/asyncio-task.rst:335 msgid "" "An :ref:`asynchronous context manager ` holding a " "group of tasks. Tasks can be added to the group using :meth:`create_task`. " "All tasks are awaited when the context manager exits." msgstr "" -#: library/asyncio-task.rst:335 +#: library/asyncio-task.rst:344 msgid "" "Create a task in this task group. The signature matches that of :func:" -"`asyncio.create_task`." +"`asyncio.create_task`. If the task group is inactive (e.g. not yet entered, " +"already finished, or in the process of shutting down), we will close the " +"given ``coro``." msgstr "" -#: library/asyncio-task.rst:472 library/asyncio-task.rst:703 -#: library/asyncio-task.rst:769 library/asyncio-task.rst:868 +#: library/asyncio-task.rst:352 +msgid "Close the given coroutine if the task group is not active." +msgstr "" + +#: library/asyncio-task.rst:356 +msgid "Passes on all *kwargs* to :meth:`loop.create_task`" +msgstr "" + +#: library/asyncio-task.rst:564 library/asyncio-task.rst:795 +#: library/asyncio-task.rst:862 msgid "Example::" msgstr "" -#: library/asyncio-task.rst:346 +#: library/asyncio-task.rst:360 +msgid "" +"async def main():\n" +" async with asyncio.TaskGroup() as tg:\n" +" task1 = tg.create_task(some_coro(...))\n" +" task2 = tg.create_task(another_coro(...))\n" +" print(f\"Both tasks have completed now: {task1.result()}, {task2." +"result()}\")" +msgstr "" + +#: library/asyncio-task.rst:366 msgid "" "The ``async with`` statement will wait for all tasks in the group to finish. " "While waiting, new tasks may still be added to the group (for example, by " @@ -315,7 +507,7 @@ msgid "" "block is exited, no new tasks may be added to the group." msgstr "" -#: library/asyncio-task.rst:353 +#: library/asyncio-task.rst:373 msgid "" "The first time any of the tasks belonging to the group fails with an " "exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " @@ -327,7 +519,7 @@ msgid "" "bubble out of the containing ``async with`` statement." msgstr "" -#: library/asyncio-task.rst:363 +#: library/asyncio-task.rst:383 msgid "" "Once all tasks have finished, if any tasks have failed with an exception " "other than :exc:`asyncio.CancelledError`, those exceptions are combined in " @@ -335,7 +527,7 @@ msgid "" "their documentation) which is then raised." msgstr "" -#: library/asyncio-task.rst:370 +#: library/asyncio-task.rst:390 msgid "" "Two base exceptions are treated specially: If any task fails with :exc:" "`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the " @@ -344,7 +536,7 @@ msgid "" "`ExceptionGroup` or :exc:`BaseExceptionGroup`." msgstr "" -#: library/asyncio-task.rst:376 +#: library/asyncio-task.rst:396 msgid "" "If the body of the ``async with`` statement exits with an exception (so :" "meth:`~object.__aexit__` is called with an exception set), this is treated " @@ -356,66 +548,173 @@ msgid "" "`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." msgstr "" -#: library/asyncio-task.rst:390 +#: library/asyncio-task.rst:408 +msgid "" +"Task groups are careful not to mix up the internal cancellation used to " +"\"wake up\" their :meth:`~object.__aexit__` with cancellation requests for " +"the task in which they are running made by other parties. In particular, " +"when one task group is syntactically nested in another, and both experience " +"an exception in one of their child tasks simultaneously, the inner task " +"group will process its exceptions, and then the outer task group will " +"receive another cancellation and process its own exceptions." +msgstr "" + +#: library/asyncio-task.rst:416 +msgid "" +"In the case where a task group is cancelled externally and also must raise " +"an :exc:`ExceptionGroup`, it will call the parent task's :meth:`~asyncio." +"Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will " +"be raised at the next :keyword:`await`, so the cancellation is not lost." +msgstr "" + +#: library/asyncio-task.rst:422 +msgid "" +"Task groups preserve the cancellation count reported by :meth:`asyncio.Task." +"cancelling`." +msgstr "" + +#: library/asyncio-task.rst:427 +msgid "" +"Improved handling of simultaneous internal and external cancellations and " +"correct preservation of cancellation counts." +msgstr "" + +#: library/asyncio-task.rst:431 +msgid "Terminating a Task Group" +msgstr "" + +#: library/asyncio-task.rst:433 +msgid "" +"While terminating a task group is not natively supported by the standard " +"library, termination can be achieved by adding an exception-raising task to " +"the task group and ignoring the raised exception:" +msgstr "" + +#: library/asyncio-task.rst:437 +msgid "" +"import asyncio\n" +"from asyncio import TaskGroup\n" +"\n" +"class TerminateTaskGroup(Exception):\n" +" \"\"\"Exception raised to terminate a task group.\"\"\"\n" +"\n" +"async def force_terminate_task_group():\n" +" \"\"\"Used to force termination of a task group.\"\"\"\n" +" raise TerminateTaskGroup()\n" +"\n" +"async def job(task_id, sleep_time):\n" +" print(f'Task {task_id}: start')\n" +" await asyncio.sleep(sleep_time)\n" +" print(f'Task {task_id}: done')\n" +"\n" +"async def main():\n" +" try:\n" +" async with TaskGroup() as group:\n" +" # spawn some tasks\n" +" group.create_task(job(1, 0.5))\n" +" group.create_task(job(2, 1.5))\n" +" # sleep for 1 second\n" +" await asyncio.sleep(1)\n" +" # add an exception-raising task to force the group to terminate\n" +" group.create_task(force_terminate_task_group())\n" +" except* TerminateTaskGroup:\n" +" pass\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: library/asyncio-task.rst:469 +msgid "Expected output:" +msgstr "" + +#: library/asyncio-task.rst:471 +msgid "" +"Task 1: start\n" +"Task 2: start\n" +"Task 1: done" +msgstr "" + +#: library/asyncio-task.rst:478 msgid "Sleeping" msgstr "" -#: library/asyncio-task.rst:394 +#: library/asyncio-task.rst:483 msgid "Block for *delay* seconds." msgstr "" -#: library/asyncio-task.rst:396 +#: library/asyncio-task.rst:485 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: library/asyncio-task.rst:399 +#: library/asyncio-task.rst:488 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: library/asyncio-task.rst:402 +#: library/asyncio-task.rst:491 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: library/asyncio-task.rst:408 +#: library/asyncio-task.rst:497 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: library/asyncio-task.rst:521 library/asyncio-task.rst:794 -#: library/asyncio-task.rst:874 +#: library/asyncio-task.rst:500 +msgid "" +"import asyncio\n" +"import datetime\n" +"\n" +"async def display_date():\n" +" loop = asyncio.get_running_loop()\n" +" end_time = loop.time() + 5.0\n" +" while True:\n" +" print(datetime.datetime.now())\n" +" if (loop.time() + 1.0) >= end_time:\n" +" break\n" +" await asyncio.sleep(1)\n" +"\n" +"asyncio.run(display_date())" +msgstr "" + +#: library/asyncio-task.rst:613 library/asyncio-task.rst:887 +#: library/asyncio-task.rst:999 msgid "Removed the *loop* parameter." msgstr "" -#: library/asyncio-task.rst:431 +#: library/asyncio-task.rst:518 +msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." +msgstr "" + +#: library/asyncio-task.rst:523 msgid "Running Tasks Concurrently" msgstr "" -#: library/asyncio-task.rst:435 +#: library/asyncio-task.rst:527 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: library/asyncio-task.rst:438 +#: library/asyncio-task.rst:530 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: library/asyncio-task.rst:441 +#: library/asyncio-task.rst:533 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: library/asyncio-task.rst:445 +#: library/asyncio-task.rst:537 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -423,19 +722,19 @@ msgid "" "run." msgstr "" -#: library/asyncio-task.rst:450 +#: library/asyncio-task.rst:542 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: library/asyncio-task.rst:453 +#: library/asyncio-task.rst:545 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: library/asyncio-task.rst:456 +#: library/asyncio-task.rst:548 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -443,7 +742,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: library/asyncio-task.rst:463 +#: library/asyncio-task.rst:555 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -453,37 +752,76 @@ msgid "" "tasks)." msgstr "" -#: library/asyncio-task.rst:510 -msgid "" -"If *return_exceptions* is False, cancelling gather() after it has been " +#: library/asyncio-task.rst:566 +msgid "" +"import asyncio\n" +"\n" +"async def factorial(name, number):\n" +" f = 1\n" +" for i in range(2, number + 1):\n" +" print(f\"Task {name}: Compute factorial({number}), currently i={i}..." +"\")\n" +" await asyncio.sleep(1)\n" +" f *= i\n" +" print(f\"Task {name}: factorial({number}) = {f}\")\n" +" return f\n" +"\n" +"async def main():\n" +" # Schedule three calls *concurrently*:\n" +" L = await asyncio.gather(\n" +" factorial(\"A\", 2),\n" +" factorial(\"B\", 3),\n" +" factorial(\"C\", 4),\n" +" )\n" +" print(L)\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# Expected output:\n" +"#\n" +"# Task A: Compute factorial(2), currently i=2...\n" +"# Task B: Compute factorial(3), currently i=2...\n" +"# Task C: Compute factorial(4), currently i=2...\n" +"# Task A: factorial(2) = 2\n" +"# Task B: Compute factorial(3), currently i=3...\n" +"# Task C: Compute factorial(4), currently i=3...\n" +"# Task B: factorial(3) = 6\n" +"# Task C: Compute factorial(4), currently i=4...\n" +"# Task C: factorial(4) = 24\n" +"# [2, 6, 24]" +msgstr "" + +#: library/asyncio-task.rst:602 +msgid "" +"If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " "be marked done after propagating an exception to the caller, therefore, " "calling ``gather.cancel()`` after catching an exception (raised by one of " "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: library/asyncio-task.rst:517 +#: library/asyncio-task.rst:609 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: library/asyncio-task.rst:524 +#: library/asyncio-task.rst:616 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: library/asyncio-task.rst:533 +#: library/asyncio-task.rst:625 msgid "Eager Task Factory" msgstr "" -#: library/asyncio-task.rst:537 +#: library/asyncio-task.rst:629 msgid "A task factory for eager task execution." msgstr "" -#: library/asyncio-task.rst:539 +#: library/asyncio-task.rst:631 msgid "" "When using this factory (via :meth:`loop.set_task_factory(asyncio." "eager_task_factory) `), coroutines begin execution " @@ -493,13 +831,13 @@ msgid "" "synchronously." msgstr "" -#: library/asyncio-task.rst:545 +#: library/asyncio-task.rst:637 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: library/asyncio-task.rst:550 +#: library/asyncio-task.rst:642 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -508,50 +846,60 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: library/asyncio-task.rst:561 +#: library/asyncio-task.rst:653 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: library/asyncio-task.rst:565 +#: library/asyncio-task.rst:657 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " "the signature of :class:`Task.__init__ `. The callable must return a :" "class:`asyncio.Task`-compatible object." msgstr "" -#: library/asyncio-task.rst:569 +#: library/asyncio-task.rst:661 msgid "" "This function returns a *callable* intended to be used as a task factory of " "an event loop via :meth:`loop.set_task_factory(factory) `)." msgstr "" -#: library/asyncio-task.rst:576 +#: library/asyncio-task.rst:668 msgid "Shielding From Cancellation" msgstr "" -#: library/asyncio-task.rst:580 +#: library/asyncio-task.rst:672 msgid "" "Protect an :ref:`awaitable object ` from being :meth:" "`cancelled `." msgstr "" -#: library/asyncio-task.rst:749 +#: library/asyncio-task.rst:842 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: library/asyncio-task.rst:585 +#: library/asyncio-task.rst:677 msgid "The statement::" msgstr "" -#: library/asyncio-task.rst:590 +#: library/asyncio-task.rst:679 +msgid "" +"task = asyncio.create_task(something())\n" +"res = await shield(task)" +msgstr "" + +#: library/asyncio-task.rst:682 msgid "is equivalent to::" msgstr "" -#: library/asyncio-task.rst:594 +#: library/asyncio-task.rst:684 +msgid "res = await something()" +msgstr "" + +#: library/asyncio-task.rst:686 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -560,20 +908,29 @@ msgid "" "`CancelledError`." msgstr "" -#: library/asyncio-task.rst:600 +#: library/asyncio-task.rst:692 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: library/asyncio-task.rst:603 +#: library/asyncio-task.rst:695 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: library/asyncio-task.rst:615 +#: library/asyncio-task.rst:699 +msgid "" +"task = asyncio.create_task(something())\n" +"try:\n" +" res = await shield(task)\n" +"except CancelledError:\n" +" res = None" +msgstr "" + +#: library/asyncio-task.rst:707 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -581,36 +938,43 @@ msgid "" "any time, even before it's done." msgstr "" -#: library/asyncio-task.rst:623 +#: library/asyncio-task.rst:715 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: library/asyncio-task.rst:629 +#: library/asyncio-task.rst:721 msgid "Timeouts" msgstr "" -#: library/asyncio-task.rst:633 +#: library/asyncio-task.rst:725 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: library/asyncio-task.rst:637 +#: library/asyncio-task.rst:729 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: library/asyncio-task.rst:642 +#: library/asyncio-task.rst:734 msgid "" "In either case, the context manager can be rescheduled after creation using :" "meth:`Timeout.reschedule`." msgstr "" -#: library/asyncio-task.rst:651 +#: library/asyncio-task.rst:739 +msgid "" +"async def main():\n" +" async with asyncio.timeout(10):\n" +" await long_running_task()" +msgstr "" + +#: library/asyncio-task.rst:743 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " "manager will cancel the current task and handle the resulting :exc:`asyncio." @@ -618,219 +982,347 @@ msgid "" "can be caught and handled." msgstr "" -#: library/asyncio-task.rst:658 +#: library/asyncio-task.rst:750 msgid "" "The :func:`asyncio.timeout` context manager is what transforms the :exc:" "`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" "`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: library/asyncio-task.rst:663 +#: library/asyncio-task.rst:755 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: library/asyncio-task.rst:674 +#: library/asyncio-task.rst:757 +msgid "" +"async def main():\n" +" try:\n" +" async with asyncio.timeout(10):\n" +" await long_running_task()\n" +" except TimeoutError:\n" +" print(\"The long operation timed out, but we've handled it.\")\n" +"\n" +" print(\"This statement will run regardless.\")" +msgstr "" + +#: library/asyncio-task.rst:766 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: library/asyncio-task.rst:679 +#: library/asyncio-task.rst:771 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: library/asyncio-task.rst:682 +#: library/asyncio-task.rst:774 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: library/asyncio-task.rst:685 +#: library/asyncio-task.rst:777 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: library/asyncio-task.rst:686 +#: library/asyncio-task.rst:778 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: library/asyncio-task.rst:691 +#: library/asyncio-task.rst:783 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: library/asyncio-task.rst:696 +#: library/asyncio-task.rst:788 msgid "Reschedule the timeout." msgstr "" -#: library/asyncio-task.rst:700 +#: library/asyncio-task.rst:792 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: library/asyncio-task.rst:720 +#: library/asyncio-task.rst:797 +msgid "" +"async def main():\n" +" try:\n" +" # We do not know the timeout when starting, so we pass ``None``.\n" +" async with asyncio.timeout(None) as cm:\n" +" # We know the timeout now, so we reschedule it.\n" +" new_deadline = get_running_loop().time() + 10\n" +" cm.reschedule(new_deadline)\n" +"\n" +" await long_running_task()\n" +" except TimeoutError:\n" +" pass\n" +"\n" +" if cm.expired():\n" +" print(\"Looks like we haven't finished on time.\")" +msgstr "" + +#: library/asyncio-task.rst:812 msgid "Timeout context managers can be safely nested." msgstr "" -#: library/asyncio-task.rst:726 +#: library/asyncio-task.rst:818 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: library/asyncio-task.rst:746 +#: library/asyncio-task.rst:823 +msgid "" +"async def main():\n" +" loop = get_running_loop()\n" +" deadline = loop.time() + 20\n" +" try:\n" +" async with asyncio.timeout_at(deadline):\n" +" await long_running_task()\n" +" except TimeoutError:\n" +" print(\"The long operation timed out, but we've handled it.\")\n" +"\n" +" print(\"This statement will run regardless.\")" +msgstr "" + +#: library/asyncio-task.rst:839 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: library/asyncio-task.rst:751 +#: library/asyncio-task.rst:844 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: library/asyncio-task.rst:755 +#: library/asyncio-task.rst:848 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: library/asyncio-task.rst:758 +#: library/asyncio-task.rst:851 msgid "" "To avoid the task :meth:`cancellation `, wrap it in :func:" "`shield`." msgstr "" -#: library/asyncio-task.rst:761 +#: library/asyncio-task.rst:854 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: library/asyncio-task.rst:765 +#: library/asyncio-task.rst:858 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: library/asyncio-task.rst:789 +#: library/asyncio-task.rst:864 +msgid "" +"async def eternity():\n" +" # Sleep for one hour\n" +" await asyncio.sleep(3600)\n" +" print('yay!')\n" +"\n" +"async def main():\n" +" # Wait for at most 1 second\n" +" try:\n" +" await asyncio.wait_for(eternity(), timeout=1.0)\n" +" except TimeoutError:\n" +" print('timeout!')\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# Expected output:\n" +"#\n" +"# timeout!" +msgstr "" + +#: library/asyncio-task.rst:882 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: library/asyncio-task.rst:797 +#: library/asyncio-task.rst:890 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "" -#: library/asyncio-task.rst:802 +#: library/asyncio-task.rst:895 msgid "Waiting Primitives" msgstr "" -#: library/asyncio-task.rst:806 +#: library/asyncio-task.rst:900 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: library/asyncio-task.rst:810 +#: library/asyncio-task.rst:904 msgid "The *aws* iterable must not be empty." msgstr "" -#: library/asyncio-task.rst:812 +#: library/asyncio-task.rst:906 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: library/asyncio-task.rst:814 +#: library/asyncio-task.rst:908 msgid "Usage::" msgstr "" -#: library/asyncio-task.rst:818 +#: library/asyncio-task.rst:910 +msgid "done, pending = await asyncio.wait(aws)" +msgstr "" + +#: library/asyncio-task.rst:912 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: library/asyncio-task.rst:821 +#: library/asyncio-task.rst:915 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: library/asyncio-task.rst:825 +#: library/asyncio-task.rst:919 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: library/asyncio-task.rst:831 +#: library/asyncio-task.rst:925 msgid "Constant" msgstr "" -#: library/asyncio-task.rst:832 +#: library/asyncio-task.rst:926 msgid "Description" msgstr "" -#: library/asyncio-task.rst:835 +#: library/asyncio-task.rst:929 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: library/asyncio-task.rst:838 +#: library/asyncio-task.rst:932 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: library/asyncio-task.rst:843 +#: library/asyncio-task.rst:937 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: library/asyncio-task.rst:845 +#: library/asyncio-task.rst:939 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: library/asyncio-task.rst:851 +#: library/asyncio-task.rst:945 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: library/asyncio-task.rst:881 +#: library/asyncio-task.rst:1006 msgid "Added support for generators yielding tasks." msgstr "" -#: library/asyncio-task.rst:860 +#: library/asyncio-task.rst:954 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " -"concurrently. Return an iterator of coroutines. Each coroutine returned can " -"be awaited to get the earliest next result from the iterable of the " -"remaining awaitables." +"concurrently. The returned object can be iterated to obtain the results of " +"the awaitables as they finish." +msgstr "" + +#: library/asyncio-task.rst:958 +msgid "" +"The object returned by ``as_completed()`` can be iterated as an :term:" +"`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " +"iteration is used, the originally-supplied awaitables are yielded if they " +"are tasks or futures. This makes it easy to correlate previously-scheduled " +"tasks with their results. Example::" msgstr "" -#: library/asyncio-task.rst:865 +#: library/asyncio-task.rst:964 msgid "" -"Raises :exc:`TimeoutError` if the timeout occurs before all Futures are done." +"ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" +"ipv6_connect = create_task(open_connection(\"::1\", 80))\n" +"tasks = [ipv4_connect, ipv6_connect]\n" +"\n" +"async for earliest_connect in as_completed(tasks):\n" +" # earliest_connect is done. The result can be obtained by\n" +" # awaiting it or calling earliest_connect.result()\n" +" reader, writer = await earliest_connect\n" +"\n" +" if earliest_connect is ipv6_connect:\n" +" print(\"IPv6 connection established.\")\n" +" else:\n" +" print(\"IPv4 connection established.\")" msgstr "" -#: library/asyncio-task.rst:877 +#: library/asyncio-task.rst:978 +msgid "" +"During asynchronous iteration, implicitly-created tasks will be yielded for " +"supplied awaitables that aren't tasks or futures." +msgstr "" + +#: library/asyncio-task.rst:981 +msgid "" +"When used as a plain iterator, each iteration yields a new coroutine that " +"returns the result or raises the exception of the next completed awaitable. " +"This pattern is compatible with Python versions older than 3.13::" +msgstr "" + +#: library/asyncio-task.rst:985 +msgid "" +"ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" +"ipv6_connect = create_task(open_connection(\"::1\", 80))\n" +"tasks = [ipv4_connect, ipv6_connect]\n" +"\n" +"for next_connect in as_completed(tasks):\n" +" # next_connect is not one of the original task objects. It must be\n" +" # awaited to obtain the result value or raise the exception of the\n" +" # awaitable that finishes next.\n" +" reader, writer = await next_connect" +msgstr "" + +#: library/asyncio-task.rst:995 +msgid "" +"A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " +"are done. This is raised by the ``async for`` loop during asynchronous " +"iteration or by the coroutines yielded during plain iteration." +msgstr "" + +#: library/asyncio-task.rst:1002 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: library/asyncio-task.rst:886 +#: library/asyncio-task.rst:1009 +msgid "" +"The result can now be used as either an :term:`asynchronous iterator` or as " +"a plain :term:`iterator` (previously it was only a plain iterator)." +msgstr "" + +#: library/asyncio-task.rst:1015 msgid "Running in Threads" msgstr "" -#: library/asyncio-task.rst:890 +#: library/asyncio-task.rst:1020 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: library/asyncio-task.rst:892 +#: library/asyncio-task.rst:1022 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -838,19 +1330,48 @@ msgid "" "separate thread." msgstr "" -#: library/asyncio-task.rst:897 +#: library/asyncio-task.rst:1027 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: library/asyncio-task.rst:899 +#: library/asyncio-task.rst:1029 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: library/asyncio-task.rst:929 +#: library/asyncio-task.rst:1033 +msgid "" +"def blocking_io():\n" +" print(f\"start blocking_io at {time.strftime('%X')}\")\n" +" # Note that time.sleep() can be replaced with any blocking\n" +" # IO-bound operation, such as file operations.\n" +" time.sleep(1)\n" +" print(f\"blocking_io complete at {time.strftime('%X')}\")\n" +"\n" +"async def main():\n" +" print(f\"started main at {time.strftime('%X')}\")\n" +"\n" +" await asyncio.gather(\n" +" asyncio.to_thread(blocking_io),\n" +" asyncio.sleep(1))\n" +"\n" +" print(f\"finished main at {time.strftime('%X')}\")\n" +"\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# Expected output:\n" +"#\n" +"# started main at 19:50:53\n" +"# start blocking_io at 19:50:53\n" +"# blocking_io complete at 19:50:54\n" +"# finished main at 19:50:54" +msgstr "" + +#: library/asyncio-task.rst:1059 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -858,7 +1379,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: library/asyncio-task.rst:936 +#: library/asyncio-task.rst:1066 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -866,85 +1387,162 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: library/asyncio-task.rst:945 +#: library/asyncio-task.rst:1075 msgid "Scheduling From Other Threads" msgstr "" -#: library/asyncio-task.rst:949 +#: library/asyncio-task.rst:1079 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: library/asyncio-task.rst:951 +#: library/asyncio-task.rst:1081 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: library/asyncio-task.rst:954 +#: library/asyncio-task.rst:1084 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: library/asyncio-task.rst:966 +#: library/asyncio-task.rst:1087 +msgid "" +"def in_thread(loop: asyncio.AbstractEventLoop) -> None:\n" +" # Run some blocking IO\n" +" pathlib.Path(\"example.txt\").write_text(\"hello world\", " +"encoding=\"utf8\")\n" +"\n" +" # Create a coroutine\n" +" coro = asyncio.sleep(1, result=3)\n" +"\n" +" # Submit the coroutine to a given loop\n" +" future = asyncio.run_coroutine_threadsafe(coro, loop)\n" +"\n" +" # Wait for the result with an optional timeout argument\n" +" assert future.result(timeout=2) == 3\n" +"\n" +"async def amain() -> None:\n" +" # Get the running loop\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" # Run something in a thread\n" +" await asyncio.to_thread(in_thread, loop)" +msgstr "" + +#: library/asyncio-task.rst:1107 +msgid "It's also possible to run the other way around. Example::" +msgstr "" + +#: library/asyncio-task.rst:1109 +msgid "" +"@contextlib.contextmanager\n" +"def loop_in_thread() -> Generator[asyncio.AbstractEventLoop]:\n" +" loop_fut = concurrent.futures.Future[asyncio.AbstractEventLoop]()\n" +" stop_event = asyncio.Event()\n" +"\n" +" async def main() -> None:\n" +" loop_fut.set_result(asyncio.get_running_loop())\n" +" await stop_event.wait()\n" +"\n" +" with concurrent.futures.ThreadPoolExecutor(1) as tpe:\n" +" complete_fut = tpe.submit(asyncio.run, main())\n" +" for fut in concurrent.futures.as_completed((loop_fut, " +"complete_fut)):\n" +" if fut is loop_fut:\n" +" loop = loop_fut.result()\n" +" try:\n" +" yield loop\n" +" finally:\n" +" loop.call_soon_threadsafe(stop_event.set)\n" +" else:\n" +" fut.result()\n" +"\n" +"# Create a loop in another thread\n" +"with loop_in_thread() as loop:\n" +" # Create a coroutine\n" +" coro = asyncio.sleep(1, result=3)\n" +"\n" +" # Submit the coroutine to a given loop\n" +" future = asyncio.run_coroutine_threadsafe(coro, loop)\n" +"\n" +" # Wait for the result with an optional timeout argument\n" +" assert future.result(timeout=2) == 3" +msgstr "" + +#: library/asyncio-task.rst:1141 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: library/asyncio-task.rst:980 +#: library/asyncio-task.rst:1145 +msgid "" +"try:\n" +" result = future.result(timeout)\n" +"except TimeoutError:\n" +" print('The coroutine took too long, cancelling the task...')\n" +" future.cancel()\n" +"except Exception as exc:\n" +" print(f'The coroutine raised an exception: {exc!r}')\n" +"else:\n" +" print(f'The coroutine returned: {result!r}')" +msgstr "" + +#: library/asyncio-task.rst:1155 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: library/asyncio-task.rst:983 +#: library/asyncio-task.rst:1158 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: library/asyncio-task.rst:990 +#: library/asyncio-task.rst:1165 msgid "Introspection" msgstr "" -#: library/asyncio-task.rst:995 +#: library/asyncio-task.rst:1170 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: library/asyncio-task.rst:998 +#: library/asyncio-task.rst:1173 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: library/asyncio-task.rst:1006 +#: library/asyncio-task.rst:1181 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: library/asyncio-task.rst:1009 +#: library/asyncio-task.rst:1184 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: library/asyncio-task.rst:1017 +#: library/asyncio-task.rst:1192 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: library/asyncio-task.rst:1023 +#: library/asyncio-task.rst:1199 msgid "Task Object" msgstr "" -#: library/asyncio-task.rst:1027 +#: library/asyncio-task.rst:1203 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: library/asyncio-task.rst:1030 +#: library/asyncio-task.rst:1206 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -952,21 +1550,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: library/asyncio-task.rst:1036 +#: library/asyncio-task.rst:1212 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: library/asyncio-task.rst:1041 +#: library/asyncio-task.rst:1217 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: library/asyncio-task.rst:1046 +#: library/asyncio-task.rst:1222 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -974,20 +1572,20 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: library/asyncio-task.rst:1051 +#: library/asyncio-task.rst:1227 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " "returns ``True`` if the wrapped coroutine did not suppress the :exc:" "`CancelledError` exception and was actually cancelled." msgstr "" -#: library/asyncio-task.rst:1056 +#: library/asyncio-task.rst:1232 msgid "" ":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" "meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: library/asyncio-task.rst:1060 +#: library/asyncio-task.rst:1236 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. If no *context* is " @@ -995,7 +1593,7 @@ msgid "" "in the copied context." msgstr "" -#: library/asyncio-task.rst:1065 +#: library/asyncio-task.rst:1241 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1005,96 +1603,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: library/asyncio-task.rst:1072 +#: library/asyncio-task.rst:1248 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: library/asyncio-task.rst:1078 +#: library/asyncio-task.rst:1254 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: library/asyncio-task.rst:1085 +#: library/asyncio-task.rst:1261 msgid "Added the *eager_start* parameter." msgstr "" -#: library/asyncio-task.rst:1090 +#: library/asyncio-task.rst:1266 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: library/asyncio-task.rst:1092 +#: library/asyncio-task.rst:1268 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: library/asyncio-task.rst:1097 +#: library/asyncio-task.rst:1273 msgid "Return the result of the Task." msgstr "" -#: library/asyncio-task.rst:1099 +#: library/asyncio-task.rst:1275 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: library/asyncio-task.rst:1117 +#: library/asyncio-task.rst:1293 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: library/asyncio-task.rst:1106 +#: library/asyncio-task.rst:1282 msgid "" -"If the Task's result isn't yet available, this method raises a :exc:" +"If the Task's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: library/asyncio-task.rst:1111 +#: library/asyncio-task.rst:1287 msgid "Return the exception of the Task." msgstr "" -#: library/asyncio-task.rst:1113 +#: library/asyncio-task.rst:1289 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: library/asyncio-task.rst:1120 +#: library/asyncio-task.rst:1296 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: library/asyncio-task.rst:1125 +#: library/asyncio-task.rst:1301 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: library/asyncio-task.rst:1136 +#: library/asyncio-task.rst:1312 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: library/asyncio-task.rst:1129 +#: library/asyncio-task.rst:1305 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: library/asyncio-task.rst:1134 +#: library/asyncio-task.rst:1310 msgid "Remove *callback* from the callbacks list." msgstr "" -#: library/asyncio-task.rst:1138 +#: library/asyncio-task.rst:1314 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: library/asyncio-task.rst:1143 +#: library/asyncio-task.rst:1319 msgid "Return the list of stack frames for this Task." msgstr "" -#: library/asyncio-task.rst:1145 +#: library/asyncio-task.rst:1321 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1102,15 +1700,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: library/asyncio-task.rst:1151 +#: library/asyncio-task.rst:1327 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: library/asyncio-task.rst:1153 +#: library/asyncio-task.rst:1329 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: library/asyncio-task.rst:1155 +#: library/asyncio-task.rst:1331 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1119,81 +1717,87 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: library/asyncio-task.rst:1164 +#: library/asyncio-task.rst:1340 msgid "Print the stack or traceback for this Task." msgstr "" -#: library/asyncio-task.rst:1166 +#: library/asyncio-task.rst:1342 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: library/asyncio-task.rst:1169 +#: library/asyncio-task.rst:1345 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: library/asyncio-task.rst:1171 +#: library/asyncio-task.rst:1347 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: library/asyncio-task.rst:1176 +#: library/asyncio-task.rst:1352 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: library/asyncio-task.rst:1180 +#: library/asyncio-task.rst:1356 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: library/asyncio-task.rst:1187 +#: library/asyncio-task.rst:1363 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: library/asyncio-task.rst:1191 +#: library/asyncio-task.rst:1367 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: library/asyncio-task.rst:1198 +#: library/asyncio-task.rst:1374 msgid "Return the name of the Task." msgstr "" -#: library/asyncio-task.rst:1200 +#: library/asyncio-task.rst:1376 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: library/asyncio-task.rst:1208 +#: library/asyncio-task.rst:1384 msgid "Set the name of the Task." msgstr "" -#: library/asyncio-task.rst:1210 +#: library/asyncio-task.rst:1386 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: library/asyncio-task.rst:1213 +#: library/asyncio-task.rst:1389 msgid "" "In the default Task implementation, the name will be visible in the :func:" "`repr` output of a task object." msgstr "" -#: library/asyncio-task.rst:1220 +#: library/asyncio-task.rst:1396 msgid "Request the Task to be cancelled." msgstr "" -#: library/asyncio-task.rst:1222 +#: library/asyncio-task.rst:1398 msgid "" -"This arranges for a :exc:`CancelledError` exception to be thrown into the " -"wrapped coroutine on the next cycle of the event loop." +"If the Task is already *done* or *cancelled*, return ``False``, otherwise, " +"return ``True``." msgstr "" -#: library/asyncio-task.rst:1225 +#: library/asyncio-task.rst:1401 +msgid "" +"The method arranges for a :exc:`CancelledError` exception to be thrown into " +"the wrapped coroutine on the next cycle of the event loop." +msgstr "" + +#: library/asyncio-task.rst:1404 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " @@ -1205,46 +1809,83 @@ msgid "" "addition to catching the exception." msgstr "" -#: library/asyncio-task.rst:1235 +#: library/asyncio-task.rst:1414 msgid "Added the *msg* parameter." msgstr "" -#: library/asyncio-task.rst:1238 +#: library/asyncio-task.rst:1417 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: library/asyncio-task.rst:1243 +#: library/asyncio-task.rst:1422 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: library/asyncio-task.rst:1282 +#: library/asyncio-task.rst:1425 +msgid "" +"async def cancel_me():\n" +" print('cancel_me(): before sleep')\n" +"\n" +" try:\n" +" # Wait for 1 hour\n" +" await asyncio.sleep(3600)\n" +" except asyncio.CancelledError:\n" +" print('cancel_me(): cancel sleep')\n" +" raise\n" +" finally:\n" +" print('cancel_me(): after sleep')\n" +"\n" +"async def main():\n" +" # Create a \"cancel_me\" Task\n" +" task = asyncio.create_task(cancel_me())\n" +"\n" +" # Wait for 1 second\n" +" await asyncio.sleep(1)\n" +"\n" +" task.cancel()\n" +" try:\n" +" await task\n" +" except asyncio.CancelledError:\n" +" print(\"main(): cancel_me is cancelled now\")\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# Expected output:\n" +"#\n" +"# cancel_me(): before sleep\n" +"# cancel_me(): cancel sleep\n" +"# cancel_me(): after sleep\n" +"# main(): cancel_me is cancelled now" +msgstr "" + +#: library/asyncio-task.rst:1461 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: library/asyncio-task.rst:1284 +#: library/asyncio-task.rst:1463 msgid "" "The Task is *cancelled* when the cancellation was requested with :meth:" "`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " "exception thrown into it." msgstr "" -#: library/asyncio-task.rst:1290 +#: library/asyncio-task.rst:1469 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: library/asyncio-task.rst:1292 +#: library/asyncio-task.rst:1471 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: library/asyncio-task.rst:1294 +#: library/asyncio-task.rst:1473 msgid "" "Note that once execution of a cancelled task completed, further calls to :" "meth:`uncancel` are ineffective." msgstr "" -#: library/asyncio-task.rst:1299 +#: library/asyncio-task.rst:1478 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " @@ -1253,7 +1894,21 @@ msgid "" "respective structured block. For example::" msgstr "" -#: library/asyncio-task.rst:1317 +#: library/asyncio-task.rst:1485 +msgid "" +"async def make_request_with_timeout():\n" +" try:\n" +" async with asyncio.timeout(1):\n" +" # Structured block affected by the timeout:\n" +" await make_request()\n" +" await make_another_request()\n" +" except TimeoutError:\n" +" log(\"There was a timeout\")\n" +" # Outer code not affected by the timeout:\n" +" await unrelated_code()" +msgstr "" + +#: library/asyncio-task.rst:1496 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " @@ -1262,20 +1917,33 @@ msgid "" "similar fashion." msgstr "" -#: library/asyncio-task.rst:1323 +#: library/asyncio-task.rst:1502 msgid "" -"If end-user code is, for some reason, suppresing cancellation by catching :" +"If end-user code is, for some reason, suppressing cancellation by catching :" "exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: library/asyncio-task.rst:1329 +#: library/asyncio-task.rst:1506 +msgid "" +"When this method decrements the cancellation count to zero, the method " +"checks if a previous :meth:`cancel` call had arranged for :exc:" +"`CancelledError` to be thrown into the task. If it hasn't been thrown yet, " +"that arrangement will be rescinded (by resetting the internal " +"``_must_cancel`` flag)." +msgstr "" + +#: library/asyncio-task.rst:1512 +msgid "Changed to rescind pending cancellation requests upon reaching zero." +msgstr "" + +#: library/asyncio-task.rst:1517 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: library/asyncio-task.rst:1333 +#: library/asyncio-task.rst:1521 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1284,7 +1952,7 @@ msgid "" "to zero." msgstr "" -#: library/asyncio-task.rst:1339 +#: library/asyncio-task.rst:1527 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." diff --git a/library/asyncio.po b/library/asyncio.po index 1cc23f41..31ada754 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -8,34 +8,47 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: library/asyncio.rst:80 +#: library/asyncio.rst:100 msgid "High-level APIs" msgstr "" -#: library/asyncio.rst:92 +#: library/asyncio.rst:113 msgid "Low-level APIs" msgstr "" -#: library/asyncio.rst:103 +#: library/asyncio.rst:124 msgid "Guides and Tutorials" msgstr "" #: library/asyncio.rst:2 -msgid ":mod:`asyncio` --- Asynchronous I/O" +msgid ":mod:`!asyncio` --- Asynchronous I/O" msgstr "" #: library/asyncio.rst:-1 msgid "Hello World!" msgstr "" +#: library/asyncio.rst:13 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" print('Hello ...')\n" +" await asyncio.sleep(1)\n" +" print('... World!')\n" +"\n" +"asyncio.run(main())" +msgstr "" + #: library/asyncio.rst:22 msgid "" "asyncio is a library to write **concurrent** code using the **async/await** " @@ -55,39 +68,47 @@ msgid "" "network code." msgstr "" -#: library/asyncio.rst:32 +#: library/asyncio.rst:34 +msgid ":ref:`a-conceptual-overview-of-asyncio`" +msgstr "" + +#: library/asyncio.rst:35 +msgid "Explanation of the fundamentals of asyncio." +msgstr "" + +#: library/asyncio.rst:37 msgid "asyncio provides a set of **high-level** APIs to:" msgstr "" -#: library/asyncio.rst:34 +#: library/asyncio.rst:39 msgid "" ":ref:`run Python coroutines ` concurrently and have full control " "over their execution;" msgstr "" -#: library/asyncio.rst:37 +#: library/asyncio.rst:42 msgid "perform :ref:`network IO and IPC `;" msgstr "" -#: library/asyncio.rst:39 +#: library/asyncio.rst:44 msgid "control :ref:`subprocesses `;" msgstr "" -#: library/asyncio.rst:41 +#: library/asyncio.rst:46 msgid "distribute tasks via :ref:`queues `;" msgstr "" -#: library/asyncio.rst:43 +#: library/asyncio.rst:48 msgid ":ref:`synchronize ` concurrent code;" msgstr "" -#: library/asyncio.rst:45 +#: library/asyncio.rst:50 msgid "" "Additionally, there are **low-level** APIs for *library and framework " "developers* to:" msgstr "" -#: library/asyncio.rst:48 +#: library/asyncio.rst:53 msgid "" "create and manage :ref:`event loops `, which provide " "asynchronous APIs for :ref:`networking `, running :ref:" @@ -95,37 +116,77 @@ msgid "" "`, etc;" msgstr "" -#: library/asyncio.rst:53 +#: library/asyncio.rst:58 msgid "" "implement efficient protocols using :ref:`transports `;" msgstr "" -#: library/asyncio.rst:56 +#: library/asyncio.rst:61 msgid "" ":ref:`bridge ` callback-based libraries and code with async/" "await syntax." msgstr "" -#: library/asyncio.rst:61 -msgid "You can experiment with an ``asyncio`` concurrent context in the REPL:" -msgstr "" - #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." +msgstr "" + +#: library/asyncio.rst:69 +msgid "asyncio REPL" +msgstr "" + +#: library/asyncio.rst:70 +msgid "" +"You can experiment with an ``asyncio`` concurrent context in the :term:" +"`REPL`:" +msgstr "" + +#: library/asyncio.rst:72 +msgid "" +"$ python -m asyncio\n" +"asyncio REPL ...\n" +"Use \"await\" directly instead of \"asyncio.run()\".\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>> import asyncio\n" +">>> await asyncio.sleep(10, result='hello')\n" +"'hello'" +msgstr "" + +#: library/asyncio.rst:82 +msgid "" +"This REPL provides limited compatibility with :envvar:`PYTHON_BASIC_REPL`. " +"It is recommended that the default REPL is used for full functionality and " +"the latest features." +msgstr "" + +#: library/asyncio.rst:86 +msgid "" +"Raises an :ref:`auditing event ` ``cpython.run_stdin`` with no " +"arguments." +msgstr "" + +#: library/asyncio.rst:88 +msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." +msgstr "" + +#: library/asyncio.rst:91 +msgid "" +"Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " +"executed. Emits audit events." msgstr "" -#: library/asyncio.rst:79 +#: library/asyncio.rst:99 msgid "Reference" msgstr "" -#: library/asyncio.rst:112 +#: library/asyncio.rst:133 msgid "The source code for asyncio can be found in :source:`Lib/asyncio/`." msgstr "" diff --git a/library/asyncore.po b/library/asyncore.po new file mode 100644 index 00000000..a2fde12d --- /dev/null +++ b/library/asyncore.po @@ -0,0 +1,39 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/asyncore.rst:2 +msgid ":mod:`!asyncore` --- Asynchronous socket handler" +msgstr "" + +#: library/asyncore.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being deprecated in " +"Python 3.6. The removal was decided in :pep:`594`." +msgstr "" + +#: library/asyncore.rst:14 +msgid "Applications should use the :mod:`asyncio` module instead." +msgstr "" + +#: library/asyncore.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!asyncore` module was " +"`Python 3.11 `_." +msgstr "" diff --git a/library/atexit.po b/library/atexit.po index dc967c3f..5ed4074a 100644 --- a/library/atexit.po +++ b/library/atexit.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/atexit.rst:2 -msgid ":mod:`atexit` --- Exit handlers" +msgid ":mod:`!atexit` --- Exit handlers" msgstr "" #: library/atexit.rst:12 @@ -104,7 +105,7 @@ msgid "" "references do not need to have matching identities." msgstr "" -#: library/atexit.rst:75 +#: library/atexit.rst:74 msgid "Module :mod:`readline`" msgstr "" @@ -126,16 +127,58 @@ msgid "" "making an explicit call into this module at termination. ::" msgstr "" +#: library/atexit.rst:89 +msgid "" +"try:\n" +" with open('counterfile') as infile:\n" +" _count = int(infile.read())\n" +"except FileNotFoundError:\n" +" _count = 0\n" +"\n" +"def incrcounter(n):\n" +" global _count\n" +" _count = _count + n\n" +"\n" +"def savecounter():\n" +" with open('counterfile', 'w') as outfile:\n" +" outfile.write('%d' % _count)\n" +"\n" +"import atexit\n" +"\n" +"atexit.register(savecounter)" +msgstr "" + #: library/atexit.rst:107 msgid "" "Positional and keyword arguments may also be passed to :func:`register` to " "be passed along to the registered function when it is called::" msgstr "" +#: library/atexit.rst:110 +msgid "" +"def goodbye(name, adjective):\n" +" print('Goodbye %s, it was %s to meet you.' % (name, adjective))\n" +"\n" +"import atexit\n" +"\n" +"atexit.register(goodbye, 'Donny', 'nice')\n" +"# or:\n" +"atexit.register(goodbye, adjective='nice', name='Donny')" +msgstr "" + #: library/atexit.rst:119 msgid "Usage as a :term:`decorator`::" msgstr "" +#: library/atexit.rst:121 +msgid "" +"import atexit\n" +"\n" +"@atexit.register\n" +"def goodbye():\n" +" print('You are now leaving the Python sector.')" +msgstr "" + #: library/atexit.rst:127 msgid "This only works with functions that can be called without arguments." msgstr "" diff --git a/library/audioop.po b/library/audioop.po index 6d954999..ff035419 100644 --- a/library/audioop.po +++ b/library/audioop.po @@ -8,321 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/audioop.rst:2 -msgid ":mod:`audioop` --- Manipulate raw audio data" +msgid ":mod:`!audioop` --- Manipulate raw audio data" msgstr "" -#: library/audioop.rst:11 +#: library/audioop.rst:10 msgid "" -"The :mod:`audioop` module is deprecated (see :pep:`PEP 594 <594#audioop>` " -"for details)." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" #: library/audioop.rst:14 msgid "" -"The :mod:`audioop` module contains some useful operations on sound " -"fragments. It operates on sound fragments consisting of signed integer " -"samples 8, 16, 24 or 32 bits wide, stored in :term:`bytes-like objects " -"`. All scalar items are integers, unless specified " -"otherwise." -msgstr "" - -#: library/audioop.rst:19 -msgid "" -"Support for 24-bit samples was added. All functions now accept any :term:" -"`bytes-like object`. String input now results in an immediate error." -msgstr "" - -#: library/audioop.rst:30 -msgid "" -"This module provides support for a-LAW, u-LAW and Intel/DVI ADPCM encodings." -msgstr "" - -#: library/audioop.rst:34 -msgid "" -"A few of the more complicated operations only take 16-bit samples, otherwise " -"the sample size (in bytes) is always a parameter of the operation." -msgstr "" - -#: library/audioop.rst:37 -msgid "The module defines the following variables and functions:" -msgstr "" - -#: library/audioop.rst:42 -msgid "" -"This exception is raised on all errors, such as unknown number of bytes per " -"sample, etc." -msgstr "" - -#: library/audioop.rst:48 -msgid "" -"Return a fragment which is the addition of the two samples passed as " -"parameters. *width* is the sample width in bytes, either ``1``, ``2``, ``3`` " -"or ``4``. Both fragments should have the same length. Samples are " -"truncated in case of overflow." -msgstr "" - -#: library/audioop.rst:55 -msgid "" -"Decode an Intel/DVI ADPCM coded fragment to a linear fragment. See the " -"description of :func:`lin2adpcm` for details on ADPCM coding. Return a tuple " -"``(sample, newstate)`` where the sample has the width specified in *width*." -msgstr "" - -#: library/audioop.rst:62 -msgid "" -"Convert sound fragments in a-LAW encoding to linearly encoded sound " -"fragments. a-LAW encoding always uses 8 bits samples, so *width* refers only " -"to the sample width of the output fragment here." -msgstr "" - -#: library/audioop.rst:69 -msgid "Return the average over all samples in the fragment." -msgstr "" - -#: library/audioop.rst:74 -msgid "" -"Return the average peak-peak value over all samples in the fragment. No " -"filtering is done, so the usefulness of this routine is questionable." -msgstr "" - -#: library/audioop.rst:80 -msgid "" -"Return a fragment that is the original fragment with a bias added to each " -"sample. Samples wrap around in case of overflow." -msgstr "" - -#: library/audioop.rst:86 -msgid "" -"\"Byteswap\" all samples in a fragment and returns the modified fragment. " -"Converts big-endian samples to little-endian and vice versa." -msgstr "" - -#: library/audioop.rst:94 -msgid "" -"Return the number of zero crossings in the fragment passed as an argument." -msgstr "" - -#: library/audioop.rst:99 -msgid "" -"Return a factor *F* such that ``rms(add(fragment, mul(reference, -F)))`` is " -"minimal, i.e., return the factor with which you should multiply *reference* " -"to make it match as well as possible to *fragment*. The fragments should " -"both contain 2-byte samples." -msgstr "" - -#: library/audioop.rst:104 -msgid "The time taken by this routine is proportional to ``len(fragment)``." -msgstr "" - -#: library/audioop.rst:109 -msgid "" -"Try to match *reference* as well as possible to a portion of *fragment* " -"(which should be the longer fragment). This is (conceptually) done by " -"taking slices out of *fragment*, using :func:`findfactor` to compute the " -"best match, and minimizing the result. The fragments should both contain 2-" -"byte samples. Return a tuple ``(offset, factor)`` where *offset* is the " -"(integer) offset into *fragment* where the optimal match started and " -"*factor* is the (floating-point) factor as per :func:`findfactor`." -msgstr "" - -#: library/audioop.rst:120 -msgid "" -"Search *fragment* for a slice of length *length* samples (not bytes!) with " -"maximum energy, i.e., return *i* for which ``rms(fragment[i*2:" -"(i+length)*2])`` is maximal. The fragments should both contain 2-byte " -"samples." -msgstr "" - -#: library/audioop.rst:124 -msgid "The routine takes time proportional to ``len(fragment)``." -msgstr "" - -#: library/audioop.rst:129 -msgid "Return the value of sample *index* from the fragment." -msgstr "" - -#: library/audioop.rst:134 -msgid "" -"Convert samples to 4 bit Intel/DVI ADPCM encoding. ADPCM coding is an " -"adaptive coding scheme, whereby each 4 bit number is the difference between " -"one sample and the next, divided by a (varying) step. The Intel/DVI ADPCM " -"algorithm has been selected for use by the IMA, so it may well become a " -"standard." -msgstr "" - -#: library/audioop.rst:139 -msgid "" -"*state* is a tuple containing the state of the coder. The coder returns a " -"tuple ``(adpcmfrag, newstate)``, and the *newstate* should be passed to the " -"next call of :func:`lin2adpcm`. In the initial call, ``None`` can be passed " -"as the state. *adpcmfrag* is the ADPCM coded fragment packed 2 4-bit values " -"per byte." -msgstr "" - -#: library/audioop.rst:147 -msgid "" -"Convert samples in the audio fragment to a-LAW encoding and return this as a " -"bytes object. a-LAW is an audio encoding format whereby you get a dynamic " -"range of about 13 bits using only 8 bit samples. It is used by the Sun " -"audio hardware, among others." -msgstr "" - -#: library/audioop.rst:155 -msgid "Convert samples between 1-, 2-, 3- and 4-byte formats." -msgstr "" - -#: library/audioop.rst:159 -msgid "" -"In some audio formats, such as .WAV files, 16, 24 and 32 bit samples are " -"signed, but 8 bit samples are unsigned. So when converting to 8 bit wide " -"samples for these formats, you need to also add 128 to the result::" -msgstr "" - -#: library/audioop.rst:166 -msgid "" -"The same, in reverse, has to be applied when converting from 8 to 16, 24 or " -"32 bit width samples." -msgstr "" - -#: library/audioop.rst:172 -msgid "" -"Convert samples in the audio fragment to u-LAW encoding and return this as a " -"bytes object. u-LAW is an audio encoding format whereby you get a dynamic " -"range of about 14 bits using only 8 bit samples. It is used by the Sun " -"audio hardware, among others." -msgstr "" - -#: library/audioop.rst:180 -msgid "" -"Return the maximum of the *absolute value* of all samples in a fragment." -msgstr "" - -#: library/audioop.rst:185 -msgid "Return the maximum peak-peak value in the sound fragment." -msgstr "" - -#: library/audioop.rst:190 -msgid "" -"Return a tuple consisting of the minimum and maximum values of all samples " -"in the sound fragment." -msgstr "" - -#: library/audioop.rst:196 -msgid "" -"Return a fragment that has all samples in the original fragment multiplied " -"by the floating-point value *factor*. Samples are truncated in case of " -"overflow." -msgstr "" - -#: library/audioop.rst:202 -msgid "Convert the frame rate of the input fragment." -msgstr "" - -#: library/audioop.rst:204 -msgid "" -"*state* is a tuple containing the state of the converter. The converter " -"returns a tuple ``(newfragment, newstate)``, and *newstate* should be passed " -"to the next call of :func:`ratecv`. The initial call should pass ``None`` " -"as the state." -msgstr "" - -#: library/audioop.rst:208 -msgid "" -"The *weightA* and *weightB* arguments are parameters for a simple digital " -"filter and default to ``1`` and ``0`` respectively." -msgstr "" - -#: library/audioop.rst:214 -msgid "Reverse the samples in a fragment and returns the modified fragment." -msgstr "" - -#: library/audioop.rst:219 -msgid "" -"Return the root-mean-square of the fragment, i.e. ``sqrt(sum(S_i^2)/n)``." -msgstr "" - -#: library/audioop.rst:221 -msgid "This is a measure of the power in an audio signal." -msgstr "" - -#: library/audioop.rst:226 -msgid "" -"Convert a stereo fragment to a mono fragment. The left channel is " -"multiplied by *lfactor* and the right channel by *rfactor* before adding the " -"two channels to give a mono signal." -msgstr "" - -#: library/audioop.rst:233 -msgid "" -"Generate a stereo fragment from a mono fragment. Each pair of samples in " -"the stereo fragment are computed from the mono sample, whereby left channel " -"samples are multiplied by *lfactor* and right channel samples by *rfactor*." -msgstr "" - -#: library/audioop.rst:240 -msgid "" -"Convert sound fragments in u-LAW encoding to linearly encoded sound " -"fragments. u-LAW encoding always uses 8 bits samples, so *width* refers only " -"to the sample width of the output fragment here." -msgstr "" - -#: library/audioop.rst:244 -msgid "" -"Note that operations such as :func:`.mul` or :func:`.max` make no " -"distinction between mono and stereo fragments, i.e. all samples are treated " -"equal. If this is a problem the stereo fragment should be split into two " -"mono fragments first and recombined later. Here is an example of how to do " -"that::" -msgstr "" - -#: library/audioop.rst:258 -msgid "" -"If you use the ADPCM coder to build network packets and you want your " -"protocol to be stateless (i.e. to be able to tolerate packet loss) you " -"should not only transmit the data but also the state. Note that you should " -"send the *initial* state (the one you passed to :func:`lin2adpcm`) along to " -"the decoder, not the final state (as returned by the coder). If you want to " -"use :class:`struct.Struct` to store the state in binary you can code the " -"first element (the predicted value) in 16 bits and the second (the delta " -"index) in 8." -msgstr "" - -#: library/audioop.rst:266 -msgid "" -"The ADPCM coders have never been tried against other ADPCM coders, only " -"against themselves. It could well be that I misinterpreted the standards in " -"which case they will not be interoperable with the respective standards." -msgstr "" - -#: library/audioop.rst:270 -msgid "" -"The :func:`find\\*` routines might look a bit funny at first sight. They are " -"primarily meant to do echo cancellation. A reasonably fast way to do this " -"is to pick the most energetic piece of the output sample, locate that in the " -"input sample and subtract the whole output sample from the input sample::" -msgstr "" - -#: library/audioop.rst:24 -msgid "Intel/DVI ADPCM" -msgstr "" - -#: library/audioop.rst:24 -msgid "ADPCM, Intel/DVI" -msgstr "" - -#: library/audioop.rst:24 -msgid "a-LAW" -msgstr "" - -#: library/audioop.rst:24 -msgid "u-LAW" +"The last version of Python that provided the :mod:`!audioop` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/audit_events.po b/library/audit_events.po index a6b94292..179f5b8e 100644 --- a/library/audit_events.po +++ b/library/audit_events.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -109,13 +110,25 @@ msgid "``handle``, ``exit_code``" msgstr "" #: library/audit_events.rst:46 -msgid "ctypes.PyObj_FromPtr" +msgid "_posixsubprocess.fork_exec" msgstr "" #: library/audit_events.rst:46 +msgid "``exec_list``, ``args``, ``env``" +msgstr "" + +#: library/audit_events.rst:48 +msgid "ctypes.PyObj_FromPtr" +msgstr "" + +#: library/audit_events.rst:48 msgid "``obj``" msgstr "" +#: library/audit_events.rst:51 +msgid "The ``_posixsubprocess.fork_exec`` internal audit event." +msgstr "" + #: library/audit_events.rst:3 msgid "audit events" msgstr "" diff --git a/library/base64.po b/library/base64.po index 1c0a7a3c..fd5bb68d 100644 --- a/library/base64.po +++ b/library/base64.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/base64.rst:2 -msgid ":mod:`base64` --- Base16, Base32, Base64, Base85 Data Encodings" +msgid ":mod:`!base64` --- Base16, Base32, Base64, Base85 Data Encodings" msgstr "" #: library/base64.rst:8 @@ -27,22 +28,14 @@ msgstr "" #: library/base64.rst:16 msgid "" "This module provides functions for encoding binary data to printable ASCII " -"characters and decoding such encodings back to binary data. It provides " -"encoding and decoding functions for the encodings specified in :rfc:`4648`, " -"which defines the Base16, Base32, and Base64 algorithms, and for the de-" -"facto standard Ascii85 and Base85 encodings." +"characters and decoding such encodings back to binary data. This includes " +"the :ref:`encodings specified in ` :rfc:`4648` (Base64, " +"Base32 and Base16) and the non-standard :ref:`Base85 encodings `." msgstr "" #: library/base64.rst:22 msgid "" -"The :rfc:`4648` encodings are suitable for encoding binary data so that it " -"can be safely sent by email, used as parts of URLs, or included as part of " -"an HTTP POST request. The encoding algorithm is not the same as the :" -"program:`uuencode` program." -msgstr "" - -#: library/base64.rst:27 -msgid "" "There are two interfaces provided by this module. The modern interface " "supports encoding :term:`bytes-like objects ` to ASCII :" "class:`bytes`, and decoding :term:`bytes-like objects ` " @@ -50,40 +43,47 @@ msgid "" "defined in :rfc:`4648` (normal, and URL- and filesystem-safe) are supported." msgstr "" -#: library/base64.rst:33 +#: library/base64.rst:28 msgid "" -"The legacy interface does not support decoding from strings, but it does " -"provide functions for encoding and decoding to and from :term:`file objects " -"`. It only supports the Base64 standard alphabet, and it adds " -"newlines every 76 characters as per :rfc:`2045`. Note that if you are " -"looking for :rfc:`2045` support you probably want to be looking at the :mod:" -"`email` package instead." +"The :ref:`legacy interface ` does not support decoding from " +"strings, but it does provide functions for encoding and decoding to and " +"from :term:`file objects `. It only supports the Base64 " +"standard alphabet, and it adds newlines every 76 characters as per :rfc:" +"`2045`. Note that if you are looking for :rfc:`2045` support you probably " +"want to be looking at the :mod:`email` package instead." msgstr "" -#: library/base64.rst:41 +#: library/base64.rst:36 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of the " "modern interface." msgstr "" -#: library/base64.rst:45 +#: library/base64.rst:40 msgid "" "Any :term:`bytes-like objects ` are now accepted by all " "encoding and decoding functions in this module. Ascii85/Base85 support " "added." msgstr "" -#: library/base64.rst:49 -msgid "The modern interface provides:" +#: library/base64.rst:48 +msgid "RFC 4648 Encodings" +msgstr "" + +#: library/base64.rst:50 +msgid "" +"The :rfc:`4648` encodings are suitable for encoding binary data so that it " +"can be safely sent by email, used as parts of URLs, or included as part of " +"an HTTP POST request." msgstr "" -#: library/base64.rst:53 +#: library/base64.rst:56 msgid "" "Encode the :term:`bytes-like object` *s* using Base64 and return the " "encoded :class:`bytes`." msgstr "" -#: library/base64.rst:56 +#: library/base64.rst:59 msgid "" "Optional *altchars* must be a :term:`bytes-like object` of length 2 which " "specifies an alternative alphabet for the ``+`` and ``/`` characters. This " @@ -92,32 +92,32 @@ msgid "" "used." msgstr "" -#: library/base64.rst:61 +#: library/base64.rst:64 msgid "" "May assert or raise a :exc:`ValueError` if the length of *altchars* is not " "2. Raises a :exc:`TypeError` if *altchars* is not a :term:`bytes-like " "object`." msgstr "" -#: library/base64.rst:67 +#: library/base64.rst:70 msgid "" "Decode the Base64 encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`." msgstr "" -#: library/base64.rst:70 +#: library/base64.rst:73 msgid "" "Optional *altchars* must be a :term:`bytes-like object` or ASCII string of " "length 2 which specifies the alternative alphabet used instead of the ``+`` " "and ``/`` characters." msgstr "" -#: library/base64.rst:74 +#: library/base64.rst:77 msgid "" "A :exc:`binascii.Error` exception is raised if *s* is incorrectly padded." msgstr "" -#: library/base64.rst:77 +#: library/base64.rst:80 msgid "" "If *validate* is ``False`` (the default), characters that are neither in the " "normal base-64 alphabet nor the alternative alphabet are discarded prior to " @@ -125,30 +125,30 @@ msgid "" "in the input result in a :exc:`binascii.Error`." msgstr "" -#: library/base64.rst:83 +#: library/base64.rst:86 msgid "" "For more information about the strict base64 check, see :func:`binascii." "a2b_base64`" msgstr "" -#: library/base64.rst:85 +#: library/base64.rst:88 msgid "" "May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2." msgstr "" -#: library/base64.rst:89 +#: library/base64.rst:92 msgid "" "Encode :term:`bytes-like object` *s* using the standard Base64 alphabet and " "return the encoded :class:`bytes`." msgstr "" -#: library/base64.rst:95 +#: library/base64.rst:98 msgid "" "Decode :term:`bytes-like object` or ASCII string *s* using the standard " "Base64 alphabet and return the decoded :class:`bytes`." msgstr "" -#: library/base64.rst:101 +#: library/base64.rst:104 msgid "" "Encode :term:`bytes-like object` *s* using the URL- and filesystem-safe " "alphabet, which substitutes ``-`` instead of ``+`` and ``_`` instead of ``/" @@ -156,7 +156,7 @@ msgid "" "The result can still contain ``=``." msgstr "" -#: library/base64.rst:110 +#: library/base64.rst:113 msgid "" "Decode :term:`bytes-like object` or ASCII string *s* using the URL- and " "filesystem-safe alphabet, which substitutes ``-`` instead of ``+`` and ``_`` " @@ -164,25 +164,25 @@ msgid "" "class:`bytes`." msgstr "" -#: library/base64.rst:119 +#: library/base64.rst:122 msgid "" "Encode the :term:`bytes-like object` *s* using Base32 and return the " "encoded :class:`bytes`." msgstr "" -#: library/base64.rst:125 +#: library/base64.rst:128 msgid "" "Decode the Base32 encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`." msgstr "" -#: library/base64.rst:176 +#: library/base64.rst:179 msgid "" "Optional *casefold* is a flag specifying whether a lowercase alphabet is " "acceptable as input. For security purposes, the default is ``False``." msgstr "" -#: library/base64.rst:132 +#: library/base64.rst:135 msgid "" ":rfc:`4648` allows for optional mapping of the digit 0 (zero) to the letter " "O (oh), and for optional mapping of the digit 1 (one) to either the letter I " @@ -193,25 +193,25 @@ msgid "" "input." msgstr "" -#: library/base64.rst:180 +#: library/base64.rst:183 msgid "" "A :exc:`binascii.Error` is raised if *s* is incorrectly padded or if there " "are non-alphabet characters present in the input." msgstr "" -#: library/base64.rst:146 +#: library/base64.rst:149 msgid "" "Similar to :func:`b32encode` but uses the Extended Hex Alphabet, as defined " "in :rfc:`4648`." msgstr "" -#: library/base64.rst:154 +#: library/base64.rst:157 msgid "" "Similar to :func:`b32decode` but uses the Extended Hex Alphabet, as defined " "in :rfc:`4648`." msgstr "" -#: library/base64.rst:157 +#: library/base64.rst:160 msgid "" "This version does not allow the digit 0 (zero) to the letter O (oh) and " "digit 1 (one) to either the letter I (eye) or letter L (el) mappings, all " @@ -219,70 +219,114 @@ msgid "" "interchangeable." msgstr "" -#: library/base64.rst:167 +#: library/base64.rst:170 msgid "" "Encode the :term:`bytes-like object` *s* using Base16 and return the " "encoded :class:`bytes`." msgstr "" -#: library/base64.rst:173 +#: library/base64.rst:176 msgid "" "Decode the Base16 encoded :term:`bytes-like object` or ASCII string *s* and " "return the decoded :class:`bytes`." msgstr "" -#: library/base64.rst:187 +#: library/base64.rst:190 +msgid "Base85 Encodings" +msgstr "" + +#: library/base64.rst:192 +msgid "" +"Base85 encoding is not formally specified but rather a de facto standard, " +"thus different systems perform the encoding differently." +msgstr "" + +#: library/base64.rst:195 +msgid "" +"The :func:`a85encode` and :func:`b85encode` functions in this module are two " +"implementations of the de facto standard. You should call the function with " +"the Base85 implementation used by the software you intend to work with." +msgstr "" + +#: library/base64.rst:199 +msgid "" +"The two functions present in this module differ in how they handle the " +"following:" +msgstr "" + +#: library/base64.rst:201 +msgid "Whether to include enclosing ``<~`` and ``~>`` markers" +msgstr "" + +#: library/base64.rst:202 +msgid "Whether to include newline characters" +msgstr "" + +#: library/base64.rst:203 +msgid "The set of ASCII characters used for encoding" +msgstr "" + +#: library/base64.rst:204 +msgid "Handling of null bytes" +msgstr "" + +#: library/base64.rst:206 +msgid "" +"Refer to the documentation of the individual functions for more information." +msgstr "" + +#: library/base64.rst:210 msgid "" "Encode the :term:`bytes-like object` *b* using Ascii85 and return the " "encoded :class:`bytes`." msgstr "" -#: library/base64.rst:190 +#: library/base64.rst:213 msgid "" "*foldspaces* is an optional flag that uses the special short sequence 'y' " "instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This " "feature is not supported by the \"standard\" Ascii85 encoding." msgstr "" -#: library/base64.rst:194 +#: library/base64.rst:217 msgid "" "*wrapcol* controls whether the output should have newline (``b'\\n'``) " "characters added to it. If this is non-zero, each output line will be at " -"most this many characters long." +"most this many characters long, excluding the trailing newline." msgstr "" -#: library/base64.rst:198 +#: library/base64.rst:221 msgid "" "*pad* controls whether the input is padded to a multiple of 4 before " "encoding. Note that the ``btoa`` implementation always pads." msgstr "" -#: library/base64.rst:201 +#: library/base64.rst:224 msgid "" "*adobe* controls whether the encoded byte sequence is framed with ``<~`` and " "``~>``, which is used by the Adobe implementation." msgstr "" -#: library/base64.rst:209 +#: library/base64.rst:232 msgid "" "Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and " "return the decoded :class:`bytes`." msgstr "" -#: library/base64.rst:212 +#: library/base64.rst:235 msgid "" "*foldspaces* is a flag that specifies whether the 'y' short sequence should " "be accepted as shorthand for 4 consecutive spaces (ASCII 0x20). This feature " "is not supported by the \"standard\" Ascii85 encoding." msgstr "" -#: library/base64.rst:216 +#: library/base64.rst:239 msgid "" "*adobe* controls whether the input sequence is in Adobe Ascii85 format (i.e. " "is framed with <~ and ~>)." msgstr "" -#: library/base64.rst:219 +#: library/base64.rst:242 msgid "" "*ignorechars* should be a :term:`bytes-like object` or ASCII string " "containing characters to ignore from the input. This should only contain " @@ -290,30 +334,44 @@ msgid "" "ASCII." msgstr "" -#: library/base64.rst:229 +#: library/base64.rst:252 msgid "" "Encode the :term:`bytes-like object` *b* using base85 (as used in e.g. git-" "style binary diffs) and return the encoded :class:`bytes`." msgstr "" -#: library/base64.rst:232 +#: library/base64.rst:255 msgid "" "If *pad* is true, the input is padded with ``b'\\0'`` so its length is a " "multiple of 4 bytes before encoding." msgstr "" -#: library/base64.rst:240 +#: library/base64.rst:263 msgid "" "Decode the base85-encoded :term:`bytes-like object` or ASCII string *b* and " "return the decoded :class:`bytes`. Padding is implicitly removed, if " "necessary." msgstr "" -#: library/base64.rst:247 -msgid "The legacy interface:" +#: library/base64.rst:272 +msgid "" +"Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and " +"return the encoded :class:`bytes`. See `Z85 specification `_ for more information." +msgstr "" + +#: library/base64.rst:281 +msgid "" +"Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and " +"return the decoded :class:`bytes`. See `Z85 specification `_ for more information." +msgstr "" + +#: library/base64.rst:291 +msgid "Legacy Interface" msgstr "" -#: library/base64.rst:251 +#: library/base64.rst:295 msgid "" "Decode the contents of the binary *input* file and write the resulting " "binary data to the *output* file. *input* and *output* must be :term:`file " @@ -321,13 +379,13 @@ msgid "" "returns an empty bytes object." msgstr "" -#: library/base64.rst:259 +#: library/base64.rst:303 msgid "" "Decode the :term:`bytes-like object` *s*, which must contain one or more " "lines of base64 encoded data, and return the decoded :class:`bytes`." msgstr "" -#: library/base64.rst:267 +#: library/base64.rst:311 msgid "" "Encode the contents of the binary *input* file and write the resulting " "base64 encoded data to the *output* file. *input* and *output* must be :term:" @@ -337,7 +395,7 @@ msgid "" "the output always ends with a newline, as per :rfc:`2045` (MIME)." msgstr "" -#: library/base64.rst:277 +#: library/base64.rst:321 msgid "" "Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary " "data, and return :class:`bytes` containing the base64-encoded data, with " @@ -345,38 +403,38 @@ msgid "" "that there is a trailing newline, as per :rfc:`2045` (MIME)." msgstr "" -#: library/base64.rst:285 +#: library/base64.rst:329 msgid "An example usage of the module:" msgstr "" -#: library/base64.rst:298 +#: library/base64.rst:342 msgid "Security Considerations" msgstr "" -#: library/base64.rst:300 +#: library/base64.rst:344 msgid "" "A new security considerations section was added to :rfc:`4648` (section 12); " "it's recommended to review the security section for any code deployed to " "production." msgstr "" -#: library/base64.rst:306 +#: library/base64.rst:349 msgid "Module :mod:`binascii`" msgstr "" -#: library/base64.rst:306 +#: library/base64.rst:350 msgid "" "Support module containing ASCII-to-binary and binary-to-ASCII conversions." msgstr "" -#: library/base64.rst:309 +#: library/base64.rst:352 msgid "" ":rfc:`1521` - MIME (Multipurpose Internet Mail Extensions) Part One: " "Mechanisms for Specifying and Describing the Format of Internet Message " "Bodies" msgstr "" -#: library/base64.rst:309 +#: library/base64.rst:353 msgid "" "Section 5.2, \"Base64 Content-Transfer-Encoding,\" provides the definition " "of the base64 encoding." diff --git a/library/bdb.po b/library/bdb.po index b12ca4a4..288d3cd0 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/bdb.rst:2 -msgid ":mod:`bdb` --- Debugger framework" +msgid ":mod:`!bdb` --- Debugger framework" msgstr "" #: library/bdb.rst:7 @@ -133,7 +134,7 @@ msgid "Line number of the :class:`Breakpoint` within :attr:`file`." msgstr "" #: library/bdb.rst:89 -msgid "True if a :class:`Breakpoint` at (file, line) is temporary." +msgid "``True`` if a :class:`Breakpoint` at (file, line) is temporary." msgstr "" #: library/bdb.rst:93 @@ -147,7 +148,7 @@ msgid "" msgstr "" #: library/bdb.rst:102 -msgid "True if :class:`Breakpoint` is enabled." +msgid "``True`` if :class:`Breakpoint` is enabled." msgstr "" #: library/bdb.rst:106 @@ -189,19 +190,35 @@ msgid "" msgstr "" #: library/bdb.rst:135 +msgid "" +"The *backend* argument specifies the backend to use for :class:`Bdb`. It can " +"be either ``'settrace'`` or ``'monitoring'``. ``'settrace'`` uses :func:`sys." +"settrace` which has the best backward compatibility. The ``'monitoring'`` " +"backend uses the new :mod:`sys.monitoring` that was introduced in Python " +"3.12, which can be much more efficient because it can disable unused events. " +"We are trying to keep the exact interfaces for both backends, but there are " +"some differences. The debugger developers are encouraged to use the " +"``'monitoring'`` backend to achieve better performance." +msgstr "" + +#: library/bdb.rst:145 msgid "Added the *skip* parameter." msgstr "" -#: library/bdb.rst:138 +#: library/bdb.rst:148 +msgid "Added the *backend* parameter." +msgstr "" + +#: library/bdb.rst:151 msgid "" "The following methods of :class:`Bdb` normally don't need to be overridden." msgstr "" -#: library/bdb.rst:142 +#: library/bdb.rst:155 msgid "Return canonical form of *filename*." msgstr "" -#: library/bdb.rst:144 +#: library/bdb.rst:157 msgid "" "For real file names, the canonical form is an operating-system-dependent, :" "func:`case-normalized ` :func:`absolute path ` attributes with values ready to start " "debugging." msgstr "" -#: library/bdb.rst:156 +#: library/bdb.rst:183 msgid "" "This function is installed as the trace function of debugged frames. Its " "return value is the new trace function (in most cases, that is, itself)." msgstr "" -#: library/bdb.rst:159 +#: library/bdb.rst:186 msgid "" "The default implementation decides how to dispatch a frame, depending on the " "type of event (passed as a string) that is about to be executed. *event* can " "be one of the following:" msgstr "" -#: library/bdb.rst:163 +#: library/bdb.rst:190 msgid "``\"line\"``: A new line of code is going to be executed." msgstr "" -#: library/bdb.rst:164 +#: library/bdb.rst:191 msgid "" "``\"call\"``: A function is about to be called, or another code block " "entered." msgstr "" -#: library/bdb.rst:166 +#: library/bdb.rst:193 msgid "``\"return\"``: A function or other code block is about to return." msgstr "" -#: library/bdb.rst:167 +#: library/bdb.rst:194 msgid "``\"exception\"``: An exception has occurred." msgstr "" -#: library/bdb.rst:168 +#: library/bdb.rst:195 msgid "``\"c_call\"``: A C function is about to be called." msgstr "" -#: library/bdb.rst:169 +#: library/bdb.rst:196 msgid "``\"c_return\"``: A C function has returned." msgstr "" -#: library/bdb.rst:170 +#: library/bdb.rst:197 msgid "``\"c_exception\"``: A C function has raised an exception." msgstr "" -#: library/bdb.rst:172 +#: library/bdb.rst:199 msgid "" "For the Python events, specialized functions (see below) are called. For " "the C events, no action is taken." msgstr "" -#: library/bdb.rst:175 +#: library/bdb.rst:202 msgid "The *arg* parameter depends on the previous event." msgstr "" -#: library/bdb.rst:177 +#: library/bdb.rst:204 msgid "" "See the documentation for :func:`sys.settrace` for more information on the " "trace function. For more information on code and frame objects, refer to :" "ref:`types`." msgstr "" -#: library/bdb.rst:183 +#: library/bdb.rst:210 msgid "" "If the debugger should stop on the current line, invoke the :meth:" "`user_line` method (which should be overridden in subclasses). Raise a :exc:" @@ -285,7 +314,7 @@ msgid "" "`trace_dispatch` method for further tracing in that scope." msgstr "" -#: library/bdb.rst:191 +#: library/bdb.rst:218 msgid "" "If the debugger should stop on this function call, invoke the :meth:" "`user_call` method (which should be overridden in subclasses). Raise a :exc:" @@ -294,7 +323,7 @@ msgid "" "`trace_dispatch` method for further tracing in that scope." msgstr "" -#: library/bdb.rst:199 +#: library/bdb.rst:226 msgid "" "If the debugger should stop on this function return, invoke the :meth:" "`user_return` method (which should be overridden in subclasses). Raise a :" @@ -303,7 +332,7 @@ msgid "" "meth:`trace_dispatch` method for further tracing in that scope." msgstr "" -#: library/bdb.rst:207 +#: library/bdb.rst:234 msgid "" "If the debugger should stop at this exception, invokes the :meth:" "`user_exception` method (which should be overridden in subclasses). Raise a :" @@ -312,152 +341,164 @@ msgid "" "meth:`trace_dispatch` method for further tracing in that scope." msgstr "" -#: library/bdb.rst:213 +#: library/bdb.rst:240 msgid "" "Normally derived classes don't override the following methods, but they may " "if they want to redefine the definition of stopping and breakpoints." msgstr "" -#: library/bdb.rst:218 -msgid "Return True if *module_name* matches any skip pattern." +#: library/bdb.rst:245 +msgid "Return ``True`` if *module_name* matches any skip pattern." msgstr "" -#: library/bdb.rst:222 -msgid "Return True if *frame* is below the starting frame in the stack." +#: library/bdb.rst:249 +msgid "Return ``True`` if *frame* is below the starting frame in the stack." msgstr "" -#: library/bdb.rst:226 -msgid "Return True if there is an effective breakpoint for this line." +#: library/bdb.rst:253 +msgid "Return ``True`` if there is an effective breakpoint for this line." msgstr "" -#: library/bdb.rst:228 +#: library/bdb.rst:255 msgid "" "Check whether a line or function breakpoint exists and is in effect. Delete " "temporary breakpoints based on information from :func:`effective`." msgstr "" -#: library/bdb.rst:233 -msgid "Return True if any breakpoint exists for *frame*'s filename." +#: library/bdb.rst:260 +msgid "Return ``True`` if any breakpoint exists for *frame*'s filename." msgstr "" -#: library/bdb.rst:235 +#: library/bdb.rst:262 msgid "" "Derived classes should override these methods to gain control over debugger " "operation." msgstr "" -#: library/bdb.rst:240 +#: library/bdb.rst:267 msgid "" "Called from :meth:`dispatch_call` if a break might stop inside the called " "function." msgstr "" -#: library/bdb.rst:245 +#: library/bdb.rst:270 +msgid "" +"*argument_list* is not used anymore and will always be ``None``. The " +"argument is kept for backwards compatibility." +msgstr "" + +#: library/bdb.rst:275 msgid "" "Called from :meth:`dispatch_line` when either :meth:`stop_here` or :meth:" "`break_here` returns ``True``." msgstr "" -#: library/bdb.rst:250 +#: library/bdb.rst:280 msgid "" "Called from :meth:`dispatch_return` when :meth:`stop_here` returns ``True``." msgstr "" -#: library/bdb.rst:254 +#: library/bdb.rst:284 msgid "" "Called from :meth:`dispatch_exception` when :meth:`stop_here` returns " "``True``." msgstr "" -#: library/bdb.rst:259 +#: library/bdb.rst:289 msgid "Handle how a breakpoint must be removed when it is a temporary one." msgstr "" -#: library/bdb.rst:261 +#: library/bdb.rst:291 msgid "This method must be implemented by derived classes." msgstr "" -#: library/bdb.rst:264 +#: library/bdb.rst:294 msgid "" "Derived classes and clients can call the following methods to affect the " "stepping state." msgstr "" -#: library/bdb.rst:269 +#: library/bdb.rst:299 msgid "Stop after one line of code." msgstr "" -#: library/bdb.rst:273 +#: library/bdb.rst:303 msgid "Stop on the next line in or below the given frame." msgstr "" -#: library/bdb.rst:277 +#: library/bdb.rst:307 msgid "Stop when returning from the given frame." msgstr "" -#: library/bdb.rst:281 +#: library/bdb.rst:311 msgid "" "Stop when the line with the *lineno* greater than the current one is reached " "or when returning from current frame." msgstr "" -#: library/bdb.rst:286 +#: library/bdb.rst:316 msgid "" "Start debugging from *frame*. If *frame* is not specified, debugging starts " "from caller's frame." msgstr "" -#: library/bdb.rst:291 +#: library/bdb.rst:319 +msgid "" +":func:`set_trace` will enter the debugger immediately, rather than on the " +"next line of code to be executed." +msgstr "" + +#: library/bdb.rst:325 msgid "" "Stop only at breakpoints or when finished. If there are no breakpoints, set " "the system trace function to ``None``." msgstr "" -#: library/bdb.rst:298 +#: library/bdb.rst:332 msgid "" "Set the :attr:`!quitting` attribute to ``True``. This raises :exc:`BdbQuit` " "in the next call to one of the :meth:`!dispatch_\\*` methods." msgstr "" -#: library/bdb.rst:302 +#: library/bdb.rst:336 msgid "" "Derived classes and clients can call the following methods to manipulate " "breakpoints. These methods return a string containing an error message if " "something went wrong, or ``None`` if all is well." msgstr "" -#: library/bdb.rst:308 +#: library/bdb.rst:342 msgid "" "Set a new breakpoint. If the *lineno* line doesn't exist for the *filename* " "passed as argument, return an error message. The *filename* should be in " "canonical form, as described in the :meth:`canonic` method." msgstr "" -#: library/bdb.rst:314 +#: library/bdb.rst:348 msgid "" "Delete the breakpoints in *filename* and *lineno*. If none were set, return " "an error message." msgstr "" -#: library/bdb.rst:319 +#: library/bdb.rst:353 msgid "" "Delete the breakpoint which has the index *arg* in the :attr:`Breakpoint." "bpbynumber`. If *arg* is not numeric or out of range, return an error " "message." msgstr "" -#: library/bdb.rst:325 +#: library/bdb.rst:359 msgid "" "Delete all breakpoints in *filename*. If none were set, return an error " "message." msgstr "" -#: library/bdb.rst:330 +#: library/bdb.rst:364 msgid "" "Delete all existing breakpoints. If none were set, return an error message." msgstr "" -#: library/bdb.rst:335 +#: library/bdb.rst:369 msgid "" "Return a breakpoint specified by the given number. If *arg* is a string, it " "will be converted to a number. If *arg* is a non-numeric string, if the " @@ -465,103 +506,125 @@ msgid "" "raised." msgstr "" -#: library/bdb.rst:344 -msgid "Return True if there is a breakpoint for *lineno* in *filename*." +#: library/bdb.rst:378 +msgid "Return ``True`` if there is a breakpoint for *lineno* in *filename*." msgstr "" -#: library/bdb.rst:348 +#: library/bdb.rst:382 msgid "" "Return all breakpoints for *lineno* in *filename*, or an empty list if none " "are set." msgstr "" -#: library/bdb.rst:353 +#: library/bdb.rst:387 msgid "Return all breakpoints in *filename*, or an empty list if none are set." msgstr "" -#: library/bdb.rst:357 +#: library/bdb.rst:391 msgid "Return all breakpoints that are set." msgstr "" -#: library/bdb.rst:360 +#: library/bdb.rst:394 +msgid "" +"Derived classes and clients can call the following methods to disable and " +"restart events to achieve better performance. These methods only work when " +"using the ``'monitoring'`` backend." +msgstr "" + +#: library/bdb.rst:400 +msgid "" +"Disable the current event until the next time :func:`restart_events` is " +"called. This is helpful when the debugger is not interested in the current " +"line." +msgstr "" + +#: library/bdb.rst:408 +msgid "" +"Restart all the disabled events. This function is automatically called in " +"``dispatch_*`` methods after ``user_*`` methods are called. If the " +"``dispatch_*`` methods are not overridden, the disabled events will be " +"restarted after each user interaction." +msgstr "" + +#: library/bdb.rst:416 msgid "" "Derived classes and clients can call the following methods to get a data " "structure representing a stack trace." msgstr "" -#: library/bdb.rst:365 +#: library/bdb.rst:421 msgid "Return a list of (frame, lineno) tuples in a stack trace, and a size." msgstr "" -#: library/bdb.rst:367 +#: library/bdb.rst:423 msgid "" "The most recently called frame is last in the list. The size is the number " "of frames below the frame where the debugger was invoked." msgstr "" -#: library/bdb.rst:372 +#: library/bdb.rst:428 msgid "" "Return a string with information about a stack entry, which is a ``(frame, " "lineno)`` tuple. The return string contains:" msgstr "" -#: library/bdb.rst:375 +#: library/bdb.rst:431 msgid "The canonical filename which contains the frame." msgstr "" -#: library/bdb.rst:376 +#: library/bdb.rst:432 msgid "The function name or ``\"\"``." msgstr "" -#: library/bdb.rst:377 +#: library/bdb.rst:433 msgid "The input arguments." msgstr "" -#: library/bdb.rst:378 +#: library/bdb.rst:434 msgid "The return value." msgstr "" -#: library/bdb.rst:379 +#: library/bdb.rst:435 msgid "The line of code (if it exists)." msgstr "" -#: library/bdb.rst:382 +#: library/bdb.rst:438 msgid "" "The following two methods can be called by clients to use a debugger to " "debug a :term:`statement`, given as a string." msgstr "" -#: library/bdb.rst:387 +#: library/bdb.rst:443 msgid "" "Debug a statement executed via the :func:`exec` function. *globals* " "defaults to :attr:`!__main__.__dict__`, *locals* defaults to *globals*." msgstr "" -#: library/bdb.rst:392 +#: library/bdb.rst:448 msgid "" "Debug an expression executed via the :func:`eval` function. *globals* and " "*locals* have the same meaning as in :meth:`run`." msgstr "" -#: library/bdb.rst:397 +#: library/bdb.rst:453 msgid "For backwards compatibility. Calls the :meth:`run` method." msgstr "" -#: library/bdb.rst:401 +#: library/bdb.rst:457 msgid "Debug a single function call, and return its result." msgstr "" -#: library/bdb.rst:404 +#: library/bdb.rst:460 msgid "Finally, the module defines the following functions:" msgstr "" -#: library/bdb.rst:408 +#: library/bdb.rst:464 msgid "" -"Return True if we should break here, depending on the way the :class:" +"Return ``True`` if we should break here, depending on the way the :class:" "`Breakpoint` *b* was set." msgstr "" -#: library/bdb.rst:411 +#: library/bdb.rst:467 msgid "" "If it was set via line number, it checks if :attr:`b.line ` is the same as the one in *frame*. If the breakpoint was set via :" @@ -570,33 +633,33 @@ msgid "" "line." msgstr "" -#: library/bdb.rst:420 +#: library/bdb.rst:476 msgid "" "Return ``(active breakpoint, delete temporary flag)`` or ``(None, None)`` as " "the breakpoint to act upon." msgstr "" -#: library/bdb.rst:423 +#: library/bdb.rst:479 msgid "" "The *active breakpoint* is the first entry in :attr:`bplist ` for the (:attr:`file `, :attr:`line `) (which must exist) that is :attr:`enabled `, for which :func:`checkfuncname` is True, and that has neither a " -"False :attr:`condition ` nor positive :attr:`ignore " +"enabled>`, for which :func:`checkfuncname` is true, and that has neither a " +"false :attr:`condition ` nor positive :attr:`ignore " "` count. The *flag*, meaning that a temporary " -"breakpoint should be deleted, is False only when the :attr:`cond ` cannot be evaluated (in which case, :attr:`ignore ` count is ignored)." msgstr "" -#: library/bdb.rst:434 -msgid "If no such entry exists, then (None, None) is returned." +#: library/bdb.rst:490 +msgid "If no such entry exists, then ``(None, None)`` is returned." msgstr "" -#: library/bdb.rst:439 +#: library/bdb.rst:495 msgid "Start debugging with a :class:`Bdb` instance from caller's frame." msgstr "" -#: library/bdb.rst:296 +#: library/bdb.rst:330 msgid "quitting (bdb.Bdb attribute)" msgstr "" diff --git a/library/binary.po b/library/binary.po index 8eefeeb7..2b0d2715 100644 --- a/library/binary.po +++ b/library/binary.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-20 17:46+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/binary.rst:5 msgid "Binary Data Services" -msgstr "" +msgstr "Υπηρεσίες Δυαδικών Δεδομένων" #: library/binary.rst:7 msgid "" @@ -27,6 +28,10 @@ msgid "" "specifically in relation to file formats and network protocols, are " "described in the relevant sections." msgstr "" +"Τα modules που περιγράφονται σε αυτό το κεφάλαιο παρέχουν βασικές " +"λειτουργίες για τη διαχείριση δυαδικών δεδομένων. Άλλες λειτουργίες σε " +"δυαδικά δεδομένα, ιδιαίτερα σε σχέση με μορφές αρχείων και δικτυακά " +"πρωτόκολλα, περιγράφονται στις αντίστοιχες ενότητες." #: library/binary.rst:12 msgid "" @@ -34,9 +39,14 @@ msgid "" "ASCII-compatible binary formats (for example, :mod:`re`) or all binary data " "(for example, :mod:`difflib`)." msgstr "" +"Ορισμένες βιβλιοθήκες που περιγράφονται στο :ref:`textservices` λειτουργούν " +"επίσης με δυαδικές μορφές συμβατές με ASCII (για παράδειγμα, :mod:`re`) ή με " +"όλα τα δυαδικά δεδομένα (για παράδειγμα, :mod:`difflib`)." #: library/binary.rst:16 msgid "" "In addition, see the documentation for Python's built-in binary data types " "in :ref:`binaryseq`." msgstr "" +"Επιπλέον, δείτε την τεκμηρίωση για τους ενσωματωμένους τύπους δυαδικών " +"δεδομένων της Python στο :ref:`binaryseq`." diff --git a/library/binascii.po b/library/binascii.po index fdfd920f..352c4b61 100644 --- a/library/binascii.po +++ b/library/binascii.po @@ -8,29 +8,29 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/binascii.rst:2 -msgid ":mod:`binascii` --- Convert between binary and ASCII" +msgid ":mod:`!binascii` --- Convert between binary and ASCII" msgstr "" -#: library/binascii.rst:14 +#: library/binascii.rst:13 msgid "" "The :mod:`binascii` module contains a number of methods to convert between " "binary and various ASCII-encoded binary representations. Normally, you will " -"not use these functions directly but use wrapper modules like :mod:`uu` or :" -"mod:`base64` instead. The :mod:`binascii` module contains low-level " -"functions written in C for greater speed that are used by the higher-level " -"modules." +"not use these functions directly but use wrapper modules like :mod:`base64` " +"instead. The :mod:`binascii` module contains low-level functions written in " +"C for greater speed that are used by the higher-level modules." msgstr "" -#: library/binascii.rst:23 +#: library/binascii.rst:22 msgid "" "``a2b_*`` functions accept Unicode strings containing only ASCII characters. " "Other functions only accept :term:`bytes-like objects ` " @@ -38,22 +38,22 @@ msgid "" "the buffer protocol)." msgstr "" -#: library/binascii.rst:28 +#: library/binascii.rst:27 msgid "ASCII-only unicode strings are now accepted by the ``a2b_*`` functions." msgstr "" -#: library/binascii.rst:32 +#: library/binascii.rst:31 msgid "The :mod:`binascii` module defines the following functions:" msgstr "" -#: library/binascii.rst:37 +#: library/binascii.rst:36 msgid "" "Convert a single line of uuencoded data back to binary and return the binary " "data. Lines normally contain 45 (binary) bytes, except for the last line. " "Line data may be followed by whitespace." msgstr "" -#: library/binascii.rst:44 +#: library/binascii.rst:43 msgid "" "Convert binary data to a line of ASCII characters, the return value is the " "converted line, including a newline char. The length of *data* should be at " @@ -61,67 +61,67 @@ msgid "" "spaces." msgstr "" -#: library/binascii.rst:48 +#: library/binascii.rst:47 msgid "Added the *backtick* parameter." msgstr "" -#: library/binascii.rst:54 +#: library/binascii.rst:53 msgid "" "Convert a block of base64 data back to binary and return the binary data. " "More than one line may be passed at a time." msgstr "" -#: library/binascii.rst:57 +#: library/binascii.rst:56 msgid "" "If *strict_mode* is true, only valid base64 data will be converted. Invalid " "base64 data will raise :exc:`binascii.Error`." msgstr "" -#: library/binascii.rst:60 +#: library/binascii.rst:59 msgid "Valid base64:" msgstr "" -#: library/binascii.rst:62 +#: library/binascii.rst:61 msgid "Conforms to :rfc:`3548`." msgstr "" -#: library/binascii.rst:63 +#: library/binascii.rst:62 msgid "Contains only characters from the base64 alphabet." msgstr "" -#: library/binascii.rst:64 +#: library/binascii.rst:63 msgid "" "Contains no excess data after padding (including excess padding, newlines, " "etc.)." msgstr "" -#: library/binascii.rst:65 +#: library/binascii.rst:64 msgid "Does not start with a padding." msgstr "" -#: library/binascii.rst:67 +#: library/binascii.rst:66 msgid "Added the *strict_mode* parameter." msgstr "" -#: library/binascii.rst:73 +#: library/binascii.rst:72 msgid "" "Convert binary data to a line of ASCII characters in base64 coding. The " "return value is the converted line, including a newline char if *newline* is " "true. The output of this function conforms to :rfc:`3548`." msgstr "" -#: library/binascii.rst:77 +#: library/binascii.rst:76 msgid "Added the *newline* parameter." msgstr "" -#: library/binascii.rst:83 +#: library/binascii.rst:82 msgid "" "Convert a block of quoted-printable data back to binary and return the " "binary data. More than one line may be passed at a time. If the optional " "argument *header* is present and true, underscores will be decoded as spaces." msgstr "" -#: library/binascii.rst:90 +#: library/binascii.rst:89 msgid "" "Convert binary data to a line(s) of ASCII characters in quoted-printable " "encoding. The return value is the converted line(s). If the optional " @@ -134,7 +134,7 @@ msgid "" "might corrupt the binary data stream." msgstr "" -#: library/binascii.rst:103 +#: library/binascii.rst:102 msgid "" "Compute a 16-bit CRC value of *data*, starting with *value* as the initial " "CRC, and return the result. This uses the CRC-CCITT polynomial *x*:sup:`16` " @@ -142,7 +142,7 @@ msgid "" "used in the binhex4 format." msgstr "" -#: library/binascii.rst:111 +#: library/binascii.rst:110 msgid "" "Compute CRC-32, the unsigned 32-bit checksum of *data*, starting with an " "initial CRC of *value*. The default initial CRC is zero. The algorithm is " @@ -151,24 +151,33 @@ msgid "" "algorithm. Use as follows::" msgstr "" -#: library/binascii.rst:123 +#: library/binascii.rst:116 +msgid "" +"print(binascii.crc32(b\"hello world\"))\n" +"# Or, in two pieces:\n" +"crc = binascii.crc32(b\"hello\")\n" +"crc = binascii.crc32(b\" world\", crc)\n" +"print('crc32 = {:#010x}'.format(crc))" +msgstr "" + +#: library/binascii.rst:122 msgid "The result is always unsigned." msgstr "" -#: library/binascii.rst:129 +#: library/binascii.rst:128 msgid "" "Return the hexadecimal representation of the binary *data*. Every byte of " "*data* is converted into the corresponding 2-digit hex representation. The " "returned bytes object is therefore twice as long as the length of *data*." msgstr "" -#: library/binascii.rst:133 +#: library/binascii.rst:132 msgid "" "Similar functionality (but returning a text string) is also conveniently " "accessible using the :meth:`bytes.hex` method." msgstr "" -#: library/binascii.rst:136 +#: library/binascii.rst:135 msgid "" "If *sep* is specified, it must be a single character str or bytes object. It " "will be inserted in the output after every *bytes_per_sep* input bytes. " @@ -176,11 +185,11 @@ msgid "" "if you wish to count from the left, supply a negative *bytes_per_sep* value." msgstr "" -#: library/binascii.rst:151 +#: library/binascii.rst:150 msgid "The *sep* and *bytes_per_sep* parameters were added." msgstr "" -#: library/binascii.rst:157 +#: library/binascii.rst:156 msgid "" "Return the binary data represented by the hexadecimal string *hexstr*. This " "function is the inverse of :func:`b2a_hex`. *hexstr* must contain an even " @@ -188,45 +197,37 @@ msgid "" "an :exc:`Error` exception is raised." msgstr "" -#: library/binascii.rst:162 +#: library/binascii.rst:161 msgid "" "Similar functionality (accepting only text string arguments, but more " "liberal towards whitespace) is also accessible using the :meth:`bytes." "fromhex` class method." msgstr "" -#: library/binascii.rst:168 +#: library/binascii.rst:167 msgid "Exception raised on errors. These are usually programming errors." msgstr "" -#: library/binascii.rst:173 +#: library/binascii.rst:172 msgid "" "Exception raised on incomplete data. These are usually not programming " "errors, but may be handled by reading a little more data and trying again." msgstr "" -#: library/binascii.rst:181 +#: library/binascii.rst:178 msgid "Module :mod:`base64`" msgstr "" -#: library/binascii.rst:180 +#: library/binascii.rst:179 msgid "" "Support for RFC compliant base64-style encoding in base 16, 32, 64, and 85." msgstr "" -#: library/binascii.rst:184 -msgid "Module :mod:`uu`" -msgstr "" - -#: library/binascii.rst:184 -msgid "Support for UU encoding used on Unix." -msgstr "" - -#: library/binascii.rst:186 +#: library/binascii.rst:182 msgid "Module :mod:`quopri`" msgstr "" -#: library/binascii.rst:187 +#: library/binascii.rst:183 msgid "Support for quoted-printable encoding used in MIME email messages." msgstr "" @@ -234,10 +235,6 @@ msgstr "" msgid "module" msgstr "" -#: library/binascii.rst:8 -msgid "uu" -msgstr "" - #: library/binascii.rst:8 msgid "base64" msgstr "" diff --git a/library/bisect.po b/library/bisect.po index 7c4ce512..6e4392af 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/bisect.rst:2 -msgid ":mod:`bisect` --- Array bisection algorithm" +msgid ":mod:`!bisect` --- Array bisection algorithm" msgstr "" #: library/bisect.rst:10 @@ -44,10 +45,20 @@ msgid "" msgstr "" #: library/bisect.rst:29 +msgid "" +"The functions in this module are not thread-safe. If multiple threads " +"concurrently use :mod:`bisect` functions on the same sequence, this may " +"result in undefined behaviour. Likewise, if the provided sequence is mutated " +"by a different thread while a :mod:`bisect` function is operating on it, the " +"result is undefined. For example, using :py:func:`~bisect.insort_left` on " +"the same list from multiple threads may result in the list becoming unsorted." +msgstr "" + +#: library/bisect.rst:39 msgid "The following functions are provided:" msgstr "" -#: library/bisect.rst:34 +#: library/bisect.rst:44 msgid "" "Locate the insertion point for *x* in *a* to maintain sorted order. The " "parameters *lo* and *hi* may be used to specify a subset of the list which " @@ -57,7 +68,7 @@ msgid "" "parameter to ``list.insert()`` assuming that *a* is already sorted." msgstr "" -#: library/bisect.rst:41 +#: library/bisect.rst:51 msgid "" "The returned insertion point *ip* partitions the array *a* into two slices " "such that ``all(elem < x for elem in a[lo : ip])`` is true for the left " @@ -65,30 +76,30 @@ msgid "" "slice." msgstr "" -#: library/bisect.rst:46 +#: library/bisect.rst:56 msgid "" "*key* specifies a :term:`key function` of one argument that is used to " "extract a comparison key from each element in the array. To support " "searching complex records, the key function is not applied to the *x* value." msgstr "" -#: library/bisect.rst:50 +#: library/bisect.rst:60 msgid "" "If *key* is ``None``, the elements are compared directly and no key function " "is called." msgstr "" -#: library/bisect.rst:67 library/bisect.rst:105 +#: library/bisect.rst:77 library/bisect.rst:115 msgid "Added the *key* parameter." msgstr "" -#: library/bisect.rst:60 +#: library/bisect.rst:70 msgid "" "Similar to :py:func:`~bisect.bisect_left`, but returns an insertion point " "which comes after (to the right of) any existing entries of *x* in *a*." msgstr "" -#: library/bisect.rst:63 +#: library/bisect.rst:73 msgid "" "The returned insertion point *ip* partitions the array *a* into two slices " "such that ``all(elem <= x for elem in a[lo : ip])`` is true for the left " @@ -96,65 +107,65 @@ msgid "" "slice." msgstr "" -#: library/bisect.rst:73 +#: library/bisect.rst:83 msgid "Insert *x* in *a* in sorted order." msgstr "" -#: library/bisect.rst:75 +#: library/bisect.rst:85 msgid "" "This function first runs :py:func:`~bisect.bisect_left` to locate an " -"insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " -"*x* at the appropriate position to maintain sort order." +"insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to " +"insert *x* at the appropriate position to maintain sort order." msgstr "" -#: library/bisect.rst:99 +#: library/bisect.rst:109 msgid "" "To support inserting records in a table, the *key* function (if any) is " "applied to *x* for the search step but not for the insertion step." msgstr "" -#: library/bisect.rst:102 +#: library/bisect.rst:112 msgid "" "Keep in mind that the *O*\\ (log *n*) search is dominated by the slow *O*\\ " "(*n*) insertion step." msgstr "" -#: library/bisect.rst:92 +#: library/bisect.rst:102 msgid "" "Similar to :py:func:`~bisect.insort_left`, but inserting *x* in *a* after " "any existing entries of *x*." msgstr "" -#: library/bisect.rst:95 +#: library/bisect.rst:105 msgid "" "This function first runs :py:func:`~bisect.bisect_right` to locate an " -"insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " -"*x* at the appropriate position to maintain sort order." +"insertion point. Next, it runs the :meth:`~sequence.insert` method on *a* to " +"insert *x* at the appropriate position to maintain sort order." msgstr "" -#: library/bisect.rst:110 +#: library/bisect.rst:120 msgid "Performance Notes" msgstr "" -#: library/bisect.rst:112 +#: library/bisect.rst:122 msgid "" "When writing time sensitive code using *bisect()* and *insort()*, keep these " "thoughts in mind:" msgstr "" -#: library/bisect.rst:115 +#: library/bisect.rst:125 msgid "" "Bisection is effective for searching ranges of values. For locating specific " "values, dictionaries are more performant." msgstr "" -#: library/bisect.rst:118 +#: library/bisect.rst:128 msgid "" "The *insort()* functions are *O*\\ (*n*) because the logarithmic search step " "is dominated by the linear time insertion step." msgstr "" -#: library/bisect.rst:121 +#: library/bisect.rst:131 msgid "" "The search functions are stateless and discard key function results after " "they are used. Consequently, if the search functions are used in a loop, " @@ -165,14 +176,14 @@ msgid "" "shown in the examples section below)." msgstr "" -#: library/bisect.rst:131 +#: library/bisect.rst:141 msgid "" "`Sorted Collections `_ is a " "high performance module that uses *bisect* to managed sorted collections of " "data." msgstr "" -#: library/bisect.rst:135 +#: library/bisect.rst:145 msgid "" "The `SortedCollection recipe `_ uses bisect to build a full-featured collection class " @@ -181,11 +192,11 @@ msgid "" "searches." msgstr "" -#: library/bisect.rst:143 +#: library/bisect.rst:153 msgid "Searching Sorted Lists" msgstr "" -#: library/bisect.rst:145 +#: library/bisect.rst:155 msgid "" "The above `bisect functions`_ are useful for finding insertion points but " "can be tricky or awkward to use for common searching tasks. The following " @@ -193,11 +204,49 @@ msgid "" "sorted lists::" msgstr "" -#: library/bisect.rst:187 +#: library/bisect.rst:160 +msgid "" +"def index(a, x):\n" +" 'Locate the leftmost value exactly equal to x'\n" +" i = bisect_left(a, x)\n" +" if i != len(a) and a[i] == x:\n" +" return i\n" +" raise ValueError\n" +"\n" +"def find_lt(a, x):\n" +" 'Find rightmost value less than x'\n" +" i = bisect_left(a, x)\n" +" if i:\n" +" return a[i-1]\n" +" raise ValueError\n" +"\n" +"def find_le(a, x):\n" +" 'Find rightmost value less than or equal to x'\n" +" i = bisect_right(a, x)\n" +" if i:\n" +" return a[i-1]\n" +" raise ValueError\n" +"\n" +"def find_gt(a, x):\n" +" 'Find leftmost value greater than x'\n" +" i = bisect_right(a, x)\n" +" if i != len(a):\n" +" return a[i]\n" +" raise ValueError\n" +"\n" +"def find_ge(a, x):\n" +" 'Find leftmost item greater than or equal to x'\n" +" i = bisect_left(a, x)\n" +" if i != len(a):\n" +" return a[i]\n" +" raise ValueError" +msgstr "" + +#: library/bisect.rst:197 msgid "Examples" msgstr "" -#: library/bisect.rst:191 +#: library/bisect.rst:201 msgid "" "The :py:func:`~bisect.bisect` function can be useful for numeric table " "lookups. This example uses :py:func:`~bisect.bisect` to look up a letter " @@ -205,15 +254,73 @@ msgid "" "90 and up is an 'A', 80 to 89 is a 'B', and so on::" msgstr "" -#: library/bisect.rst:203 +#: library/bisect.rst:206 +msgid "" +">>> def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'):\n" +"... i = bisect(breakpoints, score)\n" +"... return grades[i]\n" +"...\n" +">>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]\n" +"['F', 'A', 'C', 'C', 'B', 'A', 'A']" +msgstr "" + +#: library/bisect.rst:213 msgid "" "The :py:func:`~bisect.bisect` and :py:func:`~bisect.insort` functions also " "work with lists of tuples. The *key* argument can serve to extract the " "field used for ordering records in a table::" msgstr "" -#: library/bisect.rst:237 +#: library/bisect.rst:217 +msgid "" +">>> from collections import namedtuple\n" +">>> from operator import attrgetter\n" +">>> from bisect import bisect, insort\n" +">>> from pprint import pprint\n" +"\n" +">>> Movie = namedtuple('Movie', ('name', 'released', 'director'))\n" +"\n" +">>> movies = [\n" +"... Movie('Jaws', 1975, 'Spielberg'),\n" +"... Movie('Titanic', 1997, 'Cameron'),\n" +"... Movie('The Birds', 1963, 'Hitchcock'),\n" +"... Movie('Aliens', 1986, 'Cameron')\n" +"... ]\n" +"\n" +">>> # Find the first movie released after 1960\n" +">>> by_year = attrgetter('released')\n" +">>> movies.sort(key=by_year)\n" +">>> movies[bisect(movies, 1960, key=by_year)]\n" +"Movie(name='The Birds', released=1963, director='Hitchcock')\n" +"\n" +">>> # Insert a movie while maintaining sort order\n" +">>> romance = Movie('Love Story', 1970, 'Hiller')\n" +">>> insort(movies, romance, key=by_year)\n" +">>> pprint(movies)\n" +"[Movie(name='The Birds', released=1963, director='Hitchcock'),\n" +" Movie(name='Love Story', released=1970, director='Hiller'),\n" +" Movie(name='Jaws', released=1975, director='Spielberg'),\n" +" Movie(name='Aliens', released=1986, director='Cameron'),\n" +" Movie(name='Titanic', released=1997, director='Cameron')]" +msgstr "" + +#: library/bisect.rst:247 msgid "" "If the key function is expensive, it is possible to avoid repeated function " "calls by searching a list of precomputed keys to find the index of a record::" msgstr "" + +#: library/bisect.rst:250 +msgid "" +">>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)]\n" +">>> data.sort(key=lambda r: r[1]) # Or use operator.itemgetter(1).\n" +">>> keys = [r[1] for r in data] # Precompute a list of keys.\n" +">>> data[bisect_left(keys, 0)]\n" +"('black', 0)\n" +">>> data[bisect_left(keys, 1)]\n" +"('blue', 1)\n" +">>> data[bisect_left(keys, 5)]\n" +"('red', 5)\n" +">>> data[bisect_left(keys, 8)]\n" +"('yellow', 8)" +msgstr "" diff --git a/library/builtins.po b/library/builtins.po index 331c429b..10d7c905 100644 --- a/library/builtins.po +++ b/library/builtins.po @@ -8,27 +8,27 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/builtins.rst:2 -msgid ":mod:`builtins` --- Built-in objects" +msgid ":mod:`!builtins` --- Built-in objects" msgstr "" #: library/builtins.rst:9 msgid "" "This module provides direct access to all 'built-in' identifiers of Python; " "for example, ``builtins.open`` is the full name for the built-in function :" -"func:`open`. See :ref:`built-in-funcs` and :ref:`built-in-consts` for " -"documentation." +"func:`open`." msgstr "" -#: library/builtins.rst:15 +#: library/builtins.rst:12 msgid "" "This module is not normally accessed explicitly by most applications, but " "can be useful in modules that provide objects with the same name as a built-" @@ -37,7 +37,27 @@ msgid "" "wraps the built-in :func:`open`, this module can be used directly::" msgstr "" -#: library/builtins.rst:38 +#: library/builtins.rst:18 +msgid "" +"import builtins\n" +"\n" +"def open(path):\n" +" f = builtins.open(path, 'r')\n" +" return UpperCaser(f)\n" +"\n" +"class UpperCaser:\n" +" '''Wrapper around a file that converts output to uppercase.'''\n" +"\n" +" def __init__(self, f):\n" +" self._f = f\n" +"\n" +" def read(self, count=-1):\n" +" return self._f.read(count).upper()\n" +"\n" +" # ..." +msgstr "" + +#: library/builtins.rst:35 msgid "" "As an implementation detail, most modules have the name ``__builtins__`` " "made available as part of their globals. The value of ``__builtins__`` is " @@ -45,3 +65,19 @@ msgid "" "__dict__` attribute. Since this is an implementation detail, it may not be " "used by alternate implementations of Python." msgstr "" + +#: library/builtins.rst:43 +msgid ":ref:`built-in-consts`" +msgstr "" + +#: library/builtins.rst:44 +msgid ":ref:`bltin-exceptions`" +msgstr "" + +#: library/builtins.rst:45 +msgid ":ref:`built-in-funcs`" +msgstr "" + +#: library/builtins.rst:46 +msgid ":ref:`bltin-types`" +msgstr "" diff --git a/library/bz2.po b/library/bz2.po index 61052271..8861054b 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/bz2.rst:2 -msgid ":mod:`bz2` --- Support for :program:`bzip2` compression" +msgid ":mod:`!bz2` --- Support for :program:`bzip2` compression" msgstr "" #: library/bz2.rst:12 @@ -52,37 +53,45 @@ msgid "" "(de)compression." msgstr "" -#: library/bz2.rst:30 +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/bz2.rst:32 msgid "(De)compression of files" msgstr "" -#: library/bz2.rst:34 +#: library/bz2.rst:36 msgid "" "Open a bzip2-compressed file in binary or text mode, returning a :term:`file " "object`." msgstr "" -#: library/bz2.rst:37 +#: library/bz2.rst:39 msgid "" "As with the constructor for :class:`BZ2File`, the *filename* argument can be " "an actual filename (a :class:`str` or :class:`bytes` object), or an existing " "file object to read from or write to." msgstr "" -#: library/bz2.rst:41 +#: library/bz2.rst:43 msgid "" "The *mode* argument can be any of ``'r'``, ``'rb'``, ``'w'``, ``'wb'``, " "``'x'``, ``'xb'``, ``'a'`` or ``'ab'`` for binary mode, or ``'rt'``, " "``'wt'``, ``'xt'``, or ``'at'`` for text mode. The default is ``'rb'``." msgstr "" -#: library/bz2.rst:45 +#: library/bz2.rst:47 msgid "" "The *compresslevel* argument is an integer from 1 to 9, as for the :class:" "`BZ2File` constructor." msgstr "" -#: library/bz2.rst:48 +#: library/bz2.rst:50 msgid "" "For binary mode, this function is equivalent to the :class:`BZ2File` " "constructor: ``BZ2File(filename, mode, compresslevel=compresslevel)``. In " @@ -90,33 +99,33 @@ msgid "" "provided." msgstr "" -#: library/bz2.rst:53 +#: library/bz2.rst:55 msgid "" "For text mode, a :class:`BZ2File` object is created, and wrapped in an :" "class:`io.TextIOWrapper` instance with the specified encoding, error " "handling behavior, and line ending(s)." msgstr "" -#: library/bz2.rst:162 +#: library/bz2.rst:177 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" -#: library/bz2.rst:169 +#: library/bz2.rst:184 msgid "Accepts a :term:`path-like object`." msgstr "" -#: library/bz2.rst:68 +#: library/bz2.rst:70 msgid "Open a bzip2-compressed file in binary mode." msgstr "" -#: library/bz2.rst:70 +#: library/bz2.rst:72 msgid "" "If *filename* is a :class:`str` or :class:`bytes` object, open the named " "file directly. Otherwise, *filename* should be a :term:`file object`, which " "will be used to read or write the compressed data." msgstr "" -#: library/bz2.rst:74 +#: library/bz2.rst:76 msgid "" "The *mode* argument can be either ``'r'`` for reading (default), ``'w'`` for " "overwriting, ``'x'`` for exclusive creation, or ``'a'`` for appending. These " @@ -124,44 +133,44 @@ msgid "" "respectively." msgstr "" -#: library/bz2.rst:79 +#: library/bz2.rst:81 msgid "" "If *filename* is a file object (rather than an actual file name), a mode of " "``'w'`` does not truncate the file, and is instead equivalent to ``'a'``." msgstr "" -#: library/bz2.rst:82 +#: library/bz2.rst:84 msgid "" "If *mode* is ``'w'`` or ``'a'``, *compresslevel* can be an integer between " "``1`` and ``9`` specifying the level of compression: ``1`` produces the " "least compression, and ``9`` (default) produces the most compression." msgstr "" -#: library/bz2.rst:86 +#: library/bz2.rst:88 msgid "" "If *mode* is ``'r'``, the input file may be the concatenation of multiple " "compressed streams." msgstr "" -#: library/bz2.rst:89 +#: library/bz2.rst:91 msgid "" ":class:`BZ2File` provides all of the members specified by the :class:`io." "BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` and :meth:`~io." "IOBase.truncate`. Iteration and the :keyword:`with` statement are supported." msgstr "" -#: library/bz2.rst:94 -msgid ":class:`BZ2File` also provides the following methods:" +#: library/bz2.rst:96 +msgid ":class:`BZ2File` also provides the following methods and attributes:" msgstr "" -#: library/bz2.rst:98 +#: library/bz2.rst:100 msgid "" "Return buffered data without advancing the file position. At least one byte " "of data will be returned (unless at EOF). The exact number of bytes returned " "is unspecified." msgstr "" -#: library/bz2.rst:102 +#: library/bz2.rst:104 msgid "" "While calling :meth:`peek` does not change the file position of the :class:" "`BZ2File`, it may change the position of the underlying file object (e.g. if " @@ -169,128 +178,138 @@ msgid "" "*filename*)." msgstr "" -#: library/bz2.rst:111 +#: library/bz2.rst:113 msgid "Return the file descriptor for the underlying file." msgstr "" -#: library/bz2.rst:117 +#: library/bz2.rst:119 msgid "Return whether the file was opened for reading." msgstr "" -#: library/bz2.rst:123 +#: library/bz2.rst:125 msgid "Return whether the file supports seeking." msgstr "" -#: library/bz2.rst:129 +#: library/bz2.rst:131 msgid "Return whether the file was opened for writing." msgstr "" -#: library/bz2.rst:135 +#: library/bz2.rst:137 msgid "" "Read up to *size* uncompressed bytes, while trying to avoid making multiple " "reads from the underlying stream. Reads up to a buffer's worth of data if " "size is negative." msgstr "" -#: library/bz2.rst:139 +#: library/bz2.rst:141 msgid "Returns ``b''`` if the file is at EOF." msgstr "" -#: library/bz2.rst:145 +#: library/bz2.rst:147 msgid "Read bytes into *b*." msgstr "" -#: library/bz2.rst:147 +#: library/bz2.rst:149 msgid "Returns the number of bytes read (0 for EOF)." msgstr "" -#: library/bz2.rst:152 +#: library/bz2.rst:155 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "" + +#: library/bz2.rst:161 +msgid "" +"The bzip2 file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " +"the underlying :term:`file object`." +msgstr "" + +#: library/bz2.rst:167 msgid "Support for the :keyword:`with` statement was added." msgstr "" -#: library/bz2.rst:155 +#: library/bz2.rst:170 msgid "" "Support was added for *filename* being a :term:`file object` instead of an " "actual filename." msgstr "" -#: library/bz2.rst:159 +#: library/bz2.rst:174 msgid "" "The ``'a'`` (append) mode was added, along with support for reading multi-" "stream files." msgstr "" -#: library/bz2.rst:165 +#: library/bz2.rst:180 msgid "" "The :meth:`~io.BufferedIOBase.read` method now accepts an argument of " "``None``." msgstr "" -#: library/bz2.rst:172 +#: library/bz2.rst:187 msgid "" "The *buffering* parameter has been removed. It was ignored and deprecated " "since Python 3.0. Pass an open file object to control how the file is opened." msgstr "" -#: library/bz2.rst:177 +#: library/bz2.rst:192 msgid "The *compresslevel* parameter became keyword-only." msgstr "" -#: library/bz2.rst:179 +#: library/bz2.rst:194 msgid "" "This class is thread unsafe in the face of multiple simultaneous readers or " "writers, just like its equivalent classes in :mod:`gzip` and :mod:`lzma` " "have always been." msgstr "" -#: library/bz2.rst:186 +#: library/bz2.rst:201 msgid "Incremental (de)compression" msgstr "" -#: library/bz2.rst:190 +#: library/bz2.rst:205 msgid "" "Create a new compressor object. This object may be used to compress data " "incrementally. For one-shot compression, use the :func:`compress` function " "instead." msgstr "" -#: library/bz2.rst:282 +#: library/bz2.rst:297 msgid "" "*compresslevel*, if given, must be an integer between ``1`` and ``9``. The " "default is ``9``." msgstr "" -#: library/bz2.rst:199 +#: library/bz2.rst:214 msgid "" "Provide data to the compressor object. Returns a chunk of compressed data if " "possible, or an empty byte string otherwise." msgstr "" -#: library/bz2.rst:202 +#: library/bz2.rst:217 msgid "" "When you have finished providing data to the compressor, call the :meth:" "`flush` method to finish the compression process." msgstr "" -#: library/bz2.rst:208 +#: library/bz2.rst:223 msgid "" "Finish the compression process. Returns the compressed data left in internal " "buffers." msgstr "" -#: library/bz2.rst:211 +#: library/bz2.rst:226 msgid "" "The compressor object may not be used after this method has been called." msgstr "" -#: library/bz2.rst:216 +#: library/bz2.rst:231 msgid "" "Create a new decompressor object. This object may be used to decompress data " "incrementally. For one-shot compression, use the :func:`decompress` function " "instead." msgstr "" -#: library/bz2.rst:221 +#: library/bz2.rst:236 msgid "" "This class does not transparently handle inputs containing multiple " "compressed streams, unlike :func:`decompress` and :class:`BZ2File`. If you " @@ -298,7 +317,7 @@ msgid "" "must use a new decompressor for each stream." msgstr "" -#: library/bz2.rst:228 +#: library/bz2.rst:243 msgid "" "Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " "as bytes. Some of *data* may be buffered internally, for use in later calls " @@ -306,7 +325,7 @@ msgid "" "output of any previous calls to :meth:`decompress`." msgstr "" -#: library/bz2.rst:234 +#: library/bz2.rst:249 msgid "" "If *max_length* is nonnegative, returns at most *max_length* bytes of " "decompressed data. If this limit is reached and further output can be " @@ -315,99 +334,99 @@ msgid "" "``b''`` to obtain more of the output." msgstr "" -#: library/bz2.rst:241 +#: library/bz2.rst:256 msgid "" "If all of the input data was decompressed and returned (either because this " "was less than *max_length* bytes, or because *max_length* was negative), " "the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -#: library/bz2.rst:246 +#: library/bz2.rst:261 msgid "" "Attempting to decompress data after the end of stream is reached raises an :" "exc:`EOFError`. Any data found after the end of the stream is ignored and " "saved in the :attr:`~.unused_data` attribute." msgstr "" -#: library/bz2.rst:250 +#: library/bz2.rst:265 msgid "Added the *max_length* parameter." msgstr "" -#: library/bz2.rst:255 +#: library/bz2.rst:270 msgid "``True`` if the end-of-stream marker has been reached." msgstr "" -#: library/bz2.rst:262 +#: library/bz2.rst:277 msgid "Data found after the end of the compressed stream." msgstr "" -#: library/bz2.rst:264 +#: library/bz2.rst:279 msgid "" "If this attribute is accessed before the end of the stream has been reached, " "its value will be ``b''``." msgstr "" -#: library/bz2.rst:269 +#: library/bz2.rst:284 msgid "" "``False`` if the :meth:`.decompress` method can provide more decompressed " "data before requiring new uncompressed input." msgstr "" -#: library/bz2.rst:276 +#: library/bz2.rst:291 msgid "One-shot (de)compression" msgstr "" -#: library/bz2.rst:280 +#: library/bz2.rst:295 msgid "Compress *data*, a :term:`bytes-like object `." msgstr "" -#: library/bz2.rst:285 +#: library/bz2.rst:300 msgid "For incremental compression, use a :class:`BZ2Compressor` instead." msgstr "" -#: library/bz2.rst:290 +#: library/bz2.rst:305 msgid "Decompress *data*, a :term:`bytes-like object `." msgstr "" -#: library/bz2.rst:292 +#: library/bz2.rst:307 msgid "" "If *data* is the concatenation of multiple compressed streams, decompress " "all of the streams." msgstr "" -#: library/bz2.rst:295 +#: library/bz2.rst:310 msgid "For incremental decompression, use a :class:`BZ2Decompressor` instead." msgstr "" -#: library/bz2.rst:297 +#: library/bz2.rst:312 msgid "Support for multi-stream inputs was added." msgstr "" -#: library/bz2.rst:303 +#: library/bz2.rst:318 msgid "Examples of usage" msgstr "" -#: library/bz2.rst:305 +#: library/bz2.rst:320 msgid "Below are some examples of typical usage of the :mod:`bz2` module." msgstr "" -#: library/bz2.rst:307 +#: library/bz2.rst:322 msgid "" "Using :func:`compress` and :func:`decompress` to demonstrate round-trip " "compression:" msgstr "" -#: library/bz2.rst:325 +#: library/bz2.rst:340 msgid "Using :class:`BZ2Compressor` for incremental compression:" msgstr "" -#: library/bz2.rst:343 +#: library/bz2.rst:358 msgid "" "The example above uses a very \"nonrandom\" stream of data (a stream of " "``b\"z\"`` chunks). Random data tends to compress poorly, while ordered, " "repetitive data usually yields a high compression ratio." msgstr "" -#: library/bz2.rst:347 +#: library/bz2.rst:362 msgid "Writing and reading a bzip2-compressed file in binary mode:" msgstr "" diff --git a/library/calendar.po b/library/calendar.po index 70e0e251..1b329296 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/calendar.rst:2 -msgid ":mod:`calendar` --- General calendar-related functions" +msgid ":mod:`!calendar` --- General calendar-related functions" msgstr "" #: library/calendar.rst:10 @@ -61,17 +62,44 @@ msgid "" msgstr "" #: library/calendar.rst:41 -msgid ":class:`Calendar` instances have the following methods:" +msgid ":class:`Calendar` instances have the following methods and attributes:" msgstr "" #: library/calendar.rst:45 +msgid "The first weekday as an integer (0--6)." +msgstr "" + +#: library/calendar.rst:47 +msgid "" +"This property can also be set and read using :meth:`~Calendar." +"setfirstweekday` and :meth:`~Calendar.getfirstweekday` respectively." +msgstr "" + +#: library/calendar.rst:53 +msgid "Return an :class:`int` for the current first weekday (0--6)." +msgstr "" + +#: library/calendar.rst:55 +msgid "Identical to reading the :attr:`~Calendar.firstweekday` property." +msgstr "" + +#: library/calendar.rst:59 +msgid "" +"Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)" +msgstr "" + +#: library/calendar.rst:61 +msgid "Identical to setting the :attr:`~Calendar.firstweekday` property." +msgstr "" + +#: library/calendar.rst:65 msgid "" "Return an iterator for the week day numbers that will be used for one week. " "The first value from the iterator will be the same as the value of the :attr:" -"`firstweekday` property." +"`~Calendar.firstweekday` property." msgstr "" -#: library/calendar.rst:52 +#: library/calendar.rst:72 msgid "" "Return an iterator for the month *month* (1--12) in the year *year*. This " "iterator will return all days (as :class:`datetime.date` objects) for the " @@ -79,7 +107,7 @@ msgid "" "month that are required to get a complete week." msgstr "" -#: library/calendar.rst:60 +#: library/calendar.rst:80 msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " @@ -87,7 +115,7 @@ msgid "" "of the specified month, the day number is ``0``." msgstr "" -#: library/calendar.rst:68 +#: library/calendar.rst:88 msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " @@ -95,7 +123,7 @@ msgid "" "week day number." msgstr "" -#: library/calendar.rst:76 +#: library/calendar.rst:96 msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " @@ -103,7 +131,7 @@ msgid "" "month numbers." msgstr "" -#: library/calendar.rst:86 +#: library/calendar.rst:106 msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " @@ -111,25 +139,25 @@ msgid "" "month, and a day of the week numbers." msgstr "" -#: library/calendar.rst:96 +#: library/calendar.rst:116 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven :class:`datetime.date` objects." msgstr "" -#: library/calendar.rst:102 +#: library/calendar.rst:122 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven tuples of day numbers and weekday numbers." msgstr "" -#: library/calendar.rst:109 +#: library/calendar.rst:129 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven day numbers." msgstr "" -#: library/calendar.rst:115 +#: library/calendar.rst:135 msgid "" "Return the data for the specified year ready for formatting. The return " "value is a list of month rows. Each month row contains up to *width* months " @@ -137,29 +165,58 @@ msgid "" "contains 1--7 days. Days are :class:`datetime.date` objects." msgstr "" -#: library/calendar.rst:123 +#: library/calendar.rst:143 msgid "" "Return the data for the specified year ready for formatting (similar to :" "meth:`yeardatescalendar`). Entries in the week lists are tuples of day " "numbers and weekday numbers. Day numbers outside this month are zero." msgstr "" -#: library/calendar.rst:130 +#: library/calendar.rst:150 msgid "" "Return the data for the specified year ready for formatting (similar to :" "meth:`yeardatescalendar`). Entries in the week lists are day numbers. Day " "numbers outside this month are zero." msgstr "" -#: library/calendar.rst:137 +#: library/calendar.rst:157 msgid "This class can be used to generate plain text calendars." msgstr "" -#: library/calendar.rst:139 +#: library/calendar.rst:159 msgid ":class:`TextCalendar` instances have the following methods:" msgstr "" -#: library/calendar.rst:143 +#: library/calendar.rst:164 +msgid "" +"Return a string representing a single day formatted with the given *width*. " +"If *theday* is ``0``, return a string of spaces of the specified width, " +"representing an empty day. The *weekday* parameter is unused." +msgstr "" + +#: library/calendar.rst:171 +msgid "" +"Return a single week in a string with no newline. If *w* is provided, it " +"specifies the width of the date columns, which are centered. Depends on the " +"first weekday as specified in the constructor or set by the :meth:" +"`setfirstweekday` method." +msgstr "" + +#: library/calendar.rst:179 +msgid "" +"Return a string representing the name of a single weekday formatted to the " +"specified *width*. The *weekday* parameter is an integer representing the " +"day of the week, where ``0`` is Monday and ``6`` is Sunday." +msgstr "" + +#: library/calendar.rst:186 +msgid "" +"Return a string containing the header row of weekday names, formatted with " +"the given *width* for each column. The names depend on the locale settings " +"and are padded to the specified width." +msgstr "" + +#: library/calendar.rst:193 msgid "" "Return a month's calendar in a multi-line string. If *w* is provided, it " "specifies the width of the date columns, which are centered. If *l* is " @@ -168,11 +225,19 @@ msgid "" "`setfirstweekday` method." msgstr "" -#: library/calendar.rst:152 +#: library/calendar.rst:202 +msgid "" +"Return a string representing the month's name centered within the specified " +"*width*. If *withyear* is ``True``, include the year in the output. The " +"*theyear* and *themonth* parameters specify the year and month for the name " +"to be formatted respectively." +msgstr "" + +#: library/calendar.rst:210 msgid "Print a month's calendar as returned by :meth:`formatmonth`." msgstr "" -#: library/calendar.rst:157 +#: library/calendar.rst:215 msgid "" "Return a *m*-column calendar for an entire year as a multi-line string. " "Optional parameters *w*, *l*, and *c* are for date column width, lines per " @@ -182,32 +247,32 @@ msgid "" "generated is platform-dependent." msgstr "" -#: library/calendar.rst:167 +#: library/calendar.rst:225 msgid "" "Print the calendar for an entire year as returned by :meth:`formatyear`." msgstr "" -#: library/calendar.rst:172 +#: library/calendar.rst:230 msgid "This class can be used to generate HTML calendars." msgstr "" -#: library/calendar.rst:175 +#: library/calendar.rst:233 msgid ":class:`!HTMLCalendar` instances have the following methods:" msgstr "" -#: library/calendar.rst:179 +#: library/calendar.rst:237 msgid "" "Return a month's calendar as an HTML table. If *withyear* is true the year " "will be included in the header, otherwise just the month name will be used." msgstr "" -#: library/calendar.rst:186 +#: library/calendar.rst:244 msgid "" "Return a year's calendar as an HTML table. *width* (defaulting to 3) " "specifies the number of months per row." msgstr "" -#: library/calendar.rst:192 +#: library/calendar.rst:250 msgid "" "Return a year's calendar as a complete HTML page. *width* (defaulting to 3) " "specifies the number of months per row. *css* is the name for the cascading " @@ -216,89 +281,114 @@ msgid "" "(defaulting to the system default encoding)." msgstr "" -#: library/calendar.rst:201 +#: library/calendar.rst:259 msgid "" "Return a month name as an HTML table row. If *withyear* is true the year " "will be included in the row, otherwise just the month name will be used." msgstr "" -#: library/calendar.rst:206 +#: library/calendar.rst:264 msgid "" ":class:`!HTMLCalendar` has the following attributes you can override to " "customize the CSS classes used by the calendar:" msgstr "" -#: library/calendar.rst:211 +#: library/calendar.rst:269 msgid "" "A list of CSS classes used for each weekday. The default class list is::" msgstr "" -#: library/calendar.rst:215 +#: library/calendar.rst:271 +msgid "" +"cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" +msgstr "" + +#: library/calendar.rst:273 msgid "more styles can be added for each day::" msgstr "" -#: library/calendar.rst:219 +#: library/calendar.rst:275 +msgid "" +"cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " +"\"sat\", \"sun red\"]" +msgstr "" + +#: library/calendar.rst:277 msgid "Note that the length of this list must be seven items." msgstr "" -#: library/calendar.rst:224 +#: library/calendar.rst:282 msgid "The CSS class for a weekday occurring in the previous or coming month." msgstr "" -#: library/calendar.rst:231 +#: library/calendar.rst:289 msgid "" "A list of CSS classes used for weekday names in the header row. The default " "is the same as :attr:`cssclasses`." msgstr "" -#: library/calendar.rst:239 +#: library/calendar.rst:297 msgid "" "The month's head CSS class (used by :meth:`formatmonthname`). The default " "value is ``\"month\"``." msgstr "" -#: library/calendar.rst:247 +#: library/calendar.rst:305 msgid "" "The CSS class for the whole month's table (used by :meth:`formatmonth`). The " "default value is ``\"month\"``." msgstr "" -#: library/calendar.rst:255 +#: library/calendar.rst:313 msgid "" "The CSS class for the whole year's table of tables (used by :meth:" "`formatyear`). The default value is ``\"year\"``." msgstr "" -#: library/calendar.rst:263 +#: library/calendar.rst:321 msgid "" "The CSS class for the table head for the whole year (used by :meth:" "`formatyear`). The default value is ``\"year\"``." msgstr "" -#: library/calendar.rst:269 +#: library/calendar.rst:327 msgid "" "Note that although the naming for the above described class attributes is " "singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the " "single CSS class with a space separated list of CSS classes, for example::" msgstr "" -#: library/calendar.rst:275 +#: library/calendar.rst:331 +msgid "\"text-bold text-red\"" +msgstr "" + +#: library/calendar.rst:333 msgid "Here is an example how :class:`!HTMLCalendar` can be customized::" msgstr "" -#: library/calendar.rst:287 +#: library/calendar.rst:335 +msgid "" +"class CustomHTMLCal(calendar.HTMLCalendar):\n" +" cssclasses = [style + \" text-nowrap\" for style in\n" +" calendar.HTMLCalendar.cssclasses]\n" +" cssclass_month_head = \"text-center month-head\"\n" +" cssclass_month = \"text-center month\"\n" +" cssclass_year = \"text-italic lead\"" +msgstr "" + +#: library/calendar.rst:345 msgid "" "This subclass of :class:`TextCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." msgstr "" -#: library/calendar.rst:293 +#: library/calendar.rst:351 msgid "" "This subclass of :class:`HTMLCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." msgstr "" -#: library/calendar.rst:299 +#: library/calendar.rst:357 msgid "" "The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods " "of these two classes temporarily change the ``LC_TIME`` locale to the given " @@ -306,11 +396,11 @@ msgid "" "thread-safe." msgstr "" -#: library/calendar.rst:305 +#: library/calendar.rst:363 msgid "For simple text calendars this module provides the following functions." msgstr "" -#: library/calendar.rst:309 +#: library/calendar.rst:367 msgid "" "Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The " "values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:" @@ -318,72 +408,78 @@ msgid "" "provided for convenience. For example, to set the first weekday to Sunday::" msgstr "" -#: library/calendar.rst:320 +#: library/calendar.rst:372 +msgid "" +"import calendar\n" +"calendar.setfirstweekday(calendar.SUNDAY)" +msgstr "" + +#: library/calendar.rst:378 msgid "Returns the current setting for the weekday to start each week." msgstr "" -#: library/calendar.rst:325 +#: library/calendar.rst:383 msgid "" "Returns :const:`True` if *year* is a leap year, otherwise :const:`False`." msgstr "" -#: library/calendar.rst:330 +#: library/calendar.rst:388 msgid "" "Returns the number of leap years in the range from *y1* to *y2* (exclusive), " "where *y1* and *y2* are years." msgstr "" -#: library/calendar.rst:333 +#: library/calendar.rst:391 msgid "This function works for ranges spanning a century change." msgstr "" -#: library/calendar.rst:338 +#: library/calendar.rst:396 msgid "" "Returns the day of the week (``0`` is Monday) for *year* (``1970``--...), " "*month* (``1``--``12``), *day* (``1``--``31``)." msgstr "" -#: library/calendar.rst:344 +#: library/calendar.rst:402 msgid "" "Return a header containing abbreviated weekday names. *n* specifies the " "width in characters for one weekday." msgstr "" -#: library/calendar.rst:350 +#: library/calendar.rst:408 msgid "" "Returns weekday of first day of the month and number of days in month, for " "the specified *year* and *month*." msgstr "" -#: library/calendar.rst:356 +#: library/calendar.rst:414 msgid "" "Returns a matrix representing a month's calendar. Each row represents a " "week; days outside of the month are represented by zeros. Each week begins " "with Monday unless set by :func:`setfirstweekday`." msgstr "" -#: library/calendar.rst:363 +#: library/calendar.rst:421 msgid "Prints a month's calendar as returned by :func:`month`." msgstr "" -#: library/calendar.rst:368 +#: library/calendar.rst:426 msgid "" "Returns a month's calendar in a multi-line string using the :meth:" "`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." msgstr "" -#: library/calendar.rst:374 +#: library/calendar.rst:432 msgid "" "Prints the calendar for an entire year as returned by :func:`calendar`." msgstr "" -#: library/calendar.rst:379 +#: library/calendar.rst:437 msgid "" "Returns a 3-column calendar for an entire year as a multi-line string using " "the :meth:`~TextCalendar.formatyear` of the :class:`TextCalendar` class." msgstr "" -#: library/calendar.rst:385 +#: library/calendar.rst:443 msgid "" "An unrelated but handy function that takes a time tuple such as returned by " "the :func:`~time.gmtime` function in the :mod:`time` module, and returns the " @@ -392,182 +488,242 @@ msgid "" "inverse." msgstr "" -#: library/calendar.rst:392 +#: library/calendar.rst:450 msgid "The :mod:`calendar` module exports the following data attributes:" msgstr "" -#: library/calendar.rst:396 -msgid "An array that represents the days of the week in the current locale." +#: library/calendar.rst:454 +msgid "" +"A sequence that represents the days of the week in the current locale, where " +"Monday is day number 0." msgstr "" -#: library/calendar.rst:401 +#: library/calendar.rst:464 msgid "" -"An array that represents the abbreviated days of the week in the current " -"locale." +"A sequence that represents the abbreviated days of the week in the current " +"locale, where Mon is day number 0." msgstr "" -#: library/calendar.rst:412 +#: library/calendar.rst:479 msgid "" "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " "is ``6``." msgstr "" -#: library/calendar.rst:420 +#: library/calendar.rst:487 msgid "" "Enumeration defining days of the week as integer constants. The members of " "this enumeration are exported to the module scope as :data:`MONDAY` through :" "data:`SUNDAY`." msgstr "" -#: library/calendar.rst:429 +#: library/calendar.rst:496 msgid "" -"An array that represents the months of the year in the current locale. This " -"follows normal convention of January being month number 1, so it has a " -"length of 13 and ``month_name[0]`` is the empty string." +"A sequence that represents the months of the year in the current locale. " +"This follows normal convention of January being month number 1, so it has a " +"length of 13 and ``month_name[0]`` is the empty string." msgstr "" -#: library/calendar.rst:436 +#: library/calendar.rst:507 msgid "" -"An array that represents the abbreviated months of the year in the current " +"A sequence that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " "it has a length of 13 and ``month_abbr[0]`` is the empty string." msgstr "" -#: library/calendar.rst:454 +#: library/calendar.rst:528 msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" -#: library/calendar.rst:462 +#: library/calendar.rst:536 msgid "" "Enumeration defining months of the year as integer constants. The members of " "this enumeration are exported to the module scope as :data:`JANUARY` " "through :data:`DECEMBER`." msgstr "" -#: library/calendar.rst:469 +#: library/calendar.rst:543 msgid "The :mod:`calendar` module defines the following exceptions:" msgstr "" -#: library/calendar.rst:473 +#: library/calendar.rst:547 msgid "" "A subclass of :exc:`ValueError`, raised when the given month number is " "outside of the range 1-12 (inclusive)." msgstr "" -#: library/calendar.rst:478 +#: library/calendar.rst:552 msgid "The invalid month number." msgstr "" -#: library/calendar.rst:483 +#: library/calendar.rst:557 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" -#: library/calendar.rst:488 +#: library/calendar.rst:562 msgid "The invalid weekday number." msgstr "" -#: library/calendar.rst:495 +#: library/calendar.rst:567 msgid "Module :mod:`datetime`" msgstr "" -#: library/calendar.rst:494 +#: library/calendar.rst:568 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "" -#: library/calendar.rst:497 +#: library/calendar.rst:571 msgid "Module :mod:`time`" msgstr "" -#: library/calendar.rst:498 +#: library/calendar.rst:572 msgid "Low-level time related functions." msgstr "" -#: library/calendar.rst:504 -msgid "Command-Line Usage" +#: library/calendar.rst:578 +msgid "Command-line usage" msgstr "" -#: library/calendar.rst:508 +#: library/calendar.rst:582 msgid "" "The :mod:`calendar` module can be executed as a script from the command line " "to interactively print a calendar." msgstr "" -#: library/calendar.rst:518 +#: library/calendar.rst:585 +msgid "" +"python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" +" [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" +" [-f FIRST_WEEKDAY] [year] [month]" +msgstr "" + +#: library/calendar.rst:592 msgid "For example, to print a calendar for the year 2000:" msgstr "" -#: library/calendar.rst:561 +#: library/calendar.rst:594 +msgid "" +"$ python -m calendar 2000\n" +" 2000\n" +"\n" +" January February March\n" +"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n" +" 1 2 1 2 3 4 5 6 1 2 3 4 5\n" +" 3 4 5 6 7 8 9 7 8 9 10 11 12 13 6 7 8 9 10 11 12\n" +"10 11 12 13 14 15 16 14 15 16 17 18 19 20 13 14 15 16 17 18 19\n" +"17 18 19 20 21 22 23 21 22 23 24 25 26 27 20 21 22 23 24 25 26\n" +"24 25 26 27 28 29 30 28 29 27 28 29 30 31\n" +"31\n" +"\n" +" April May June\n" +"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n" +" 1 2 1 2 3 4 5 6 7 1 2 3 4\n" +" 3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11\n" +"10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18\n" +"17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25\n" +"24 25 26 27 28 29 30 29 30 31 26 27 28 29 30\n" +"\n" +" July August September\n" +"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n" +" 1 2 1 2 3 4 5 6 1 2 3\n" +" 3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10\n" +"10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17\n" +"17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24\n" +"24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30\n" +"31\n" +"\n" +" October November December\n" +"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n" +" 1 1 2 3 4 5 1 2 3\n" +" 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10\n" +" 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17\n" +"16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24\n" +"23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" +"30 31" +msgstr "" + +#: library/calendar.rst:635 msgid "The following options are accepted:" msgstr "" -#: library/calendar.rst:568 +#: library/calendar.rst:642 msgid "Show the help message and exit." msgstr "" -#: library/calendar.rst:573 +#: library/calendar.rst:647 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "" -#: library/calendar.rst:579 +#: library/calendar.rst:653 msgid "" "The encoding to use for output. :option:`--encoding` is required if :option:" "`--locale` is set." msgstr "" -#: library/calendar.rst:585 +#: library/calendar.rst:659 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "" -#: library/calendar.rst:591 +#: library/calendar.rst:665 msgid "" -"The year to print the calendar for. Must be a number between 1 and 9999. " -"Defaults to the current year." +"The weekday to start each week. Must be a number between 0 (Monday) and 6 " +"(Sunday). Defaults to 0." +msgstr "" + +#: library/calendar.rst:673 +msgid "The year to print the calendar for. Defaults to the current year." msgstr "" -#: library/calendar.rst:598 +#: library/calendar.rst:679 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " "printing a calendar for the full year." msgstr "" -#: library/calendar.rst:604 +#: library/calendar.rst:685 msgid "*Text-mode options:*" msgstr "" -#: library/calendar.rst:608 +#: library/calendar.rst:689 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." msgstr "" -#: library/calendar.rst:616 +#: library/calendar.rst:697 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." msgstr "" -#: library/calendar.rst:624 +#: library/calendar.rst:705 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "" -#: library/calendar.rst:631 +#: library/calendar.rst:712 msgid "The number of months printed per row. Defaults to 3." msgstr "" -#: library/calendar.rst:635 +#: library/calendar.rst:715 +msgid "" +"By default, today's date is highlighted in color and can be :ref:`controlled " +"using environment variables `." +msgstr "" + +#: library/calendar.rst:719 msgid "*HTML-mode options:*" msgstr "" -#: library/calendar.rst:639 +#: library/calendar.rst:723 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/cgi.po b/library/cgi.po index 2e7eeff5..e09cb10a 100644 --- a/library/cgi.po +++ b/library/cgi.po @@ -8,736 +8,35 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/cgi.rst:2 -msgid ":mod:`cgi` --- Common Gateway Interface support" +msgid ":mod:`!cgi` --- Common Gateway Interface support" msgstr "" -#: library/cgi.rst:8 -msgid "**Source code:** :source:`Lib/cgi.py`" -msgstr "" - -#: library/cgi.rst:27 -msgid "" -"The :mod:`cgi` module is deprecated (see :pep:`PEP 594 <594#cgi>` for " -"details and alternatives)." -msgstr "" - -#: library/cgi.rst:22 -msgid "" -"The :class:`FieldStorage` class can typically be replaced with :func:`urllib." -"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." -"message` module or `multipart `_ for " -"``POST`` and ``PUT``. Most :ref:`utility functions ` have replacements." -msgstr "" - -#: library/cgi.rst:30 -msgid "Support module for Common Gateway Interface (CGI) scripts." -msgstr "" - -#: library/cgi.rst:32 -msgid "" -"This module defines a number of utilities for use by CGI scripts written in " -"Python." -msgstr "" - -#: library/cgi.rst:35 -msgid "" -"The global variable ``maxlen`` can be set to an integer indicating the " -"maximum size of a POST request. POST requests larger than this size will " -"result in a :exc:`ValueError` being raised during parsing. The default value " -"of this variable is ``0``, meaning the request size is unlimited." -msgstr "" - -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" - -#: library/cgi.rst:43 -msgid "Introduction" -msgstr "" - -#: library/cgi.rst:47 -msgid "" -"A CGI script is invoked by an HTTP server, usually to process user input " -"submitted through an HTML ``
`` or ```` element." -msgstr "" - -#: library/cgi.rst:50 -msgid "" -"Most often, CGI scripts live in the server's special :file:`cgi-bin` " -"directory. The HTTP server places all sorts of information about the request " -"(such as the client's hostname, the requested URL, the query string, and " -"lots of other goodies) in the script's shell environment, executes the " -"script, and sends the script's output back to the client." -msgstr "" - -#: library/cgi.rst:56 -msgid "" -"The script's input is connected to the client too, and sometimes the form " -"data is read this way; at other times the form data is passed via the " -"\"query string\" part of the URL. This module is intended to take care of " -"the different cases and provide a simpler interface to the Python script. " -"It also provides a number of utilities that help in debugging scripts, and " -"the latest addition is support for file uploads from a form (if your browser " -"supports it)." -msgstr "" - -#: library/cgi.rst:63 -msgid "" -"The output of a CGI script should consist of two sections, separated by a " -"blank line. The first section contains a number of headers, telling the " -"client what kind of data is following. Python code to generate a minimal " -"header section looks like this::" -msgstr "" - -#: library/cgi.rst:71 -msgid "" -"The second section is usually HTML, which allows the client software to " -"display nicely formatted text with header, in-line images, etc. Here's " -"Python code that prints a simple piece of HTML::" -msgstr "" - -#: library/cgi.rst:83 -msgid "Using the cgi module" -msgstr "" - -#: library/cgi.rst:85 -msgid "Begin by writing ``import cgi``." -msgstr "" - -#: library/cgi.rst:87 -msgid "When you write a new script, consider adding these lines::" -msgstr "" - -#: library/cgi.rst:92 -msgid "" -"This activates a special exception handler that will display detailed " -"reports in the web browser if any errors occur. If you'd rather not show " -"the guts of your program to users of your script, you can have the reports " -"saved to files instead, with code like this::" -msgstr "" - -#: library/cgi.rst:100 -msgid "" -"It's very helpful to use this feature during script development. The reports " -"produced by :mod:`cgitb` provide information that can save you a lot of time " -"in tracking down bugs. You can always remove the ``cgitb`` line later when " -"you have tested your script and are confident that it works correctly." -msgstr "" - -#: library/cgi.rst:105 -msgid "" -"To get at submitted form data, use the :class:`FieldStorage` class. If the " -"form contains non-ASCII characters, use the *encoding* keyword parameter set " -"to the value of the encoding defined for the document. It is usually " -"contained in the META tag in the HEAD section of the HTML document or by " -"the :mailheader:`Content-Type` header. This reads the form contents from " -"the standard input or the environment (depending on the value of various " -"environment variables set according to the CGI standard). Since it may " -"consume standard input, it should be instantiated only once." -msgstr "" - -#: library/cgi.rst:114 -msgid "" -"The :class:`FieldStorage` instance can be indexed like a Python dictionary. " -"It allows membership testing with the :keyword:`in` operator, and also " -"supports the standard dictionary method :meth:`~dict.keys` and the built-in " -"function :func:`len`. Form fields containing empty strings are ignored and " -"do not appear in the dictionary; to keep such values, provide a true value " -"for the optional *keep_blank_values* keyword parameter when creating the :" -"class:`FieldStorage` instance." -msgstr "" - -#: library/cgi.rst:122 -msgid "" -"For instance, the following code (which assumes that the :mailheader:" -"`Content-Type` header and blank line have already been printed) checks that " -"the fields ``name`` and ``addr`` are both set to a non-empty string::" -msgstr "" - -#: library/cgi.rst:136 -msgid "" -"Here the fields, accessed through ``form[key]``, are themselves instances " -"of :class:`FieldStorage` (or :class:`MiniFieldStorage`, depending on the " -"form encoding). The :attr:`~FieldStorage.value` attribute of the instance " -"yields the string value of the field. The :meth:`~FieldStorage.getvalue` " -"method returns this string value directly; it also accepts an optional " -"second argument as a default to return if the requested key is not present." -msgstr "" - -#: library/cgi.rst:143 -msgid "" -"If the submitted form data contains more than one field with the same name, " -"the object retrieved by ``form[key]`` is not a :class:`FieldStorage` or :" -"class:`MiniFieldStorage` instance but a list of such instances. Similarly, " -"in this situation, ``form.getvalue(key)`` would return a list of strings. If " -"you expect this possibility (when your HTML form contains multiple fields " -"with the same name), use the :meth:`~FieldStorage.getlist` method, which " -"always returns a list of values (so that you do not need to special-case the " -"single item case). For example, this code concatenates any number of " -"username fields, separated by commas::" -msgstr "" - -#: library/cgi.rst:156 -msgid "" -"If a field represents an uploaded file, accessing the value via the :attr:" -"`~FieldStorage.value` attribute or the :meth:`~FieldStorage.getvalue` method " -"reads the entire file in memory as bytes. This may not be what you want. " -"You can test for an uploaded file by testing either the :attr:`~FieldStorage." -"filename` attribute or the :attr:`~FieldStorage.file` attribute. You can " -"then read the data from the :attr:`!file` attribute before it is " -"automatically closed as part of the garbage collection of the :class:" -"`FieldStorage` instance (the :func:`~io.RawIOBase.read` and :func:`~io." -"IOBase.readline` methods will return bytes)::" -msgstr "" - -#: library/cgi.rst:176 -msgid "" -":class:`FieldStorage` objects also support being used in a :keyword:`with` " -"statement, which will automatically close them when done." -msgstr "" - -#: library/cgi.rst:179 -msgid "" -"If an error is encountered when obtaining the contents of an uploaded file " -"(for example, when the user interrupts the form submission by clicking on a " -"Back or Cancel button) the :attr:`~FieldStorage.done` attribute of the " -"object for the field will be set to the value -1." -msgstr "" - -#: library/cgi.rst:184 -msgid "" -"The file upload draft standard entertains the possibility of uploading " -"multiple files from one field (using a recursive :mimetype:`multipart/\\*` " -"encoding). When this occurs, the item will be a dictionary-like :class:" -"`FieldStorage` item. This can be determined by testing its :attr:`!type` " -"attribute, which should be :mimetype:`multipart/form-data` (or perhaps " -"another MIME type matching :mimetype:`multipart/\\*`). In this case, it can " -"be iterated over recursively just like the top-level form object." -msgstr "" - -#: library/cgi.rst:192 -msgid "" -"When a form is submitted in the \"old\" format (as the query string or as a " -"single data part of type :mimetype:`application/x-www-form-urlencoded`), the " -"items will actually be instances of the class :class:`MiniFieldStorage`. In " -"this case, the :attr:`!list`, :attr:`!file`, and :attr:`filename` attributes " -"are always ``None``." -msgstr "" - -#: library/cgi.rst:197 -msgid "" -"A form submitted via POST that also has a query string will contain both :" -"class:`FieldStorage` and :class:`MiniFieldStorage` items." -msgstr "" - -#: library/cgi.rst:200 -msgid "" -"The :attr:`~FieldStorage.file` attribute is automatically closed upon the " -"garbage collection of the creating :class:`FieldStorage` instance." -msgstr "" - -#: library/cgi.rst:204 -msgid "" -"Added support for the context management protocol to the :class:" -"`FieldStorage` class." -msgstr "" - -#: library/cgi.rst:210 -msgid "Higher Level Interface" -msgstr "" - -#: library/cgi.rst:212 -msgid "" -"The previous section explains how to read CGI form data using the :class:" -"`FieldStorage` class. This section describes a higher level interface which " -"was added to this class to allow one to do it in a more readable and " -"intuitive way. The interface doesn't make the techniques described in " -"previous sections obsolete --- they are still useful to process file uploads " -"efficiently, for example." -msgstr "" - -#: library/cgi.rst:221 -msgid "" -"The interface consists of two simple methods. Using the methods you can " -"process form data in a generic way, without the need to worry whether only " -"one or more values were posted under one name." -msgstr "" - -#: library/cgi.rst:225 -msgid "" -"In the previous section, you learned to write following code anytime you " -"expected a user to post more than one value under one name::" -msgstr "" - -#: library/cgi.rst:234 -msgid "" -"This situation is common for example when a form contains a group of " -"multiple checkboxes with the same name::" -msgstr "" - -#: library/cgi.rst:240 -msgid "" -"In most situations, however, there's only one form control with a particular " -"name in a form and then you expect and need only one value associated with " -"this name. So you write a script containing for example this code::" -msgstr "" - -#: library/cgi.rst:246 -msgid "" -"The problem with the code is that you should never expect that a client will " -"provide valid input to your scripts. For example, if a curious user appends " -"another ``user=foo`` pair to the query string, then the script would crash, " -"because in this situation the ``getvalue(\"user\")`` method call returns a " -"list instead of a string. Calling the :meth:`~str.upper` method on a list " -"is not valid (since lists do not have a method of this name) and results in " -"an :exc:`AttributeError` exception." -msgstr "" - -#: library/cgi.rst:254 -msgid "" -"Therefore, the appropriate way to read form data values was to always use " -"the code which checks whether the obtained value is a single value or a list " -"of values. That's annoying and leads to less readable scripts." -msgstr "" - -#: library/cgi.rst:258 -msgid "" -"A more convenient approach is to use the methods :meth:`~FieldStorage." -"getfirst` and :meth:`~FieldStorage.getlist` provided by this higher level " -"interface." -msgstr "" - -#: library/cgi.rst:264 -msgid "" -"This method always returns only one value associated with form field *name*. " -"The method returns only the first value in case that more values were posted " -"under such name. Please note that the order in which the values are " -"received may vary from browser to browser and should not be counted on. " -"[#]_ If no such form field or value exists then the method returns the " -"value specified by the optional parameter *default*. This parameter " -"defaults to ``None`` if not specified." -msgstr "" - -#: library/cgi.rst:275 -msgid "" -"This method always returns a list of values associated with form field " -"*name*. The method returns an empty list if no such form field or value " -"exists for *name*. It returns a list consisting of one item if only one " -"such value exists." -msgstr "" - -#: library/cgi.rst:279 -msgid "Using these methods you can write nice compact code::" -msgstr "" - -#: library/cgi.rst:291 -msgid "Functions" -msgstr "" - -#: library/cgi.rst:293 -msgid "" -"These are useful if you want more control, or if you want to employ some of " -"the algorithms implemented in this module in other circumstances." -msgstr "" - -#: library/cgi.rst:299 -msgid "" -"Parse a query in the environment or from a file (the file defaults to ``sys." -"stdin``). The *keep_blank_values*, *strict_parsing* and *separator* " -"parameters are passed to :func:`urllib.parse.parse_qs` unchanged." -msgstr "" - -#: library/cgi.rst:307 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced by calling :func:`urllib.parse.parse_qs` directly on the desired " -"query string (except for ``multipart/form-data`` input, which can be handled " -"as described for :func:`parse_multipart`)." -msgstr "" - -#: library/cgi.rst:312 -msgid "" -"Parse input of type :mimetype:`multipart/form-data` (for file uploads). " -"Arguments are *fp* for the input file, *pdict* for a dictionary containing " -"other parameters in the :mailheader:`Content-Type` header, and *encoding*, " -"the request encoding." -msgstr "" - -#: library/cgi.rst:317 -msgid "" -"Returns a dictionary just like :func:`urllib.parse.parse_qs`: keys are the " -"field names, each value is a list of values for that field. For non-file " -"fields, the value is a list of strings." -msgstr "" - -#: library/cgi.rst:321 -msgid "" -"This is easy to use but not much good if you are expecting megabytes to be " -"uploaded --- in that case, use the :class:`FieldStorage` class instead which " -"is much more flexible." -msgstr "" - -#: library/cgi.rst:325 -msgid "" -"Added the *encoding* and *errors* parameters. For non-file fields, the " -"value is now a list of strings, not bytes." -msgstr "" - -#: library/cgi.rst:329 -msgid "Added the *separator* parameter." -msgstr "" - -#: library/cgi.rst:337 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced with the functionality in the :mod:`email` package (e.g. :class:" -"`email.message.EmailMessage`/:class:`email.message.Message`) which " -"implements the same MIME RFCs, or with the `multipart `__ PyPI project." -msgstr "" - -#: library/cgi.rst:342 -msgid "" -"Parse a MIME header (such as :mailheader:`Content-Type`) into a main value " -"and a dictionary of parameters." -msgstr "" - -#: library/cgi.rst:355 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced with the functionality in the :mod:`email` package, which " -"implements the same MIME RFCs." -msgstr "" - -#: library/cgi.rst:350 -msgid "For example, with :class:`email.message.EmailMessage`::" -msgstr "" - -#: library/cgi.rst:360 -msgid "" -"Robust test CGI script, usable as main program. Writes minimal HTTP headers " -"and formats all information provided to the script in HTML format." -msgstr "" - -#: library/cgi.rst:366 -msgid "Format the shell environment in HTML." -msgstr "" - -#: library/cgi.rst:371 -msgid "Format a form in HTML." -msgstr "" - -#: library/cgi.rst:376 -msgid "Format the current directory in HTML." -msgstr "" - -#: library/cgi.rst:381 -msgid "Print a list of useful (used by CGI) environment variables in HTML." -msgstr "" - -#: library/cgi.rst:387 -msgid "Caring about security" -msgstr "" - -#: library/cgi.rst:391 -msgid "" -"There's one important rule: if you invoke an external program (via :func:`os." -"system`, :func:`os.popen` or other functions with similar functionality), " -"make very sure you don't pass arbitrary strings received from the client to " -"the shell. This is a well-known security hole whereby clever hackers " -"anywhere on the web can exploit a gullible CGI script to invoke arbitrary " -"shell commands. Even parts of the URL or field names cannot be trusted, " -"since the request doesn't have to come from your form!" -msgstr "" - -#: library/cgi.rst:399 -msgid "" -"To be on the safe side, if you must pass a string gotten from a form to a " -"shell command, you should make sure the string contains only alphanumeric " -"characters, dashes, underscores, and periods." -msgstr "" - -#: library/cgi.rst:405 -msgid "Installing your CGI script on a Unix system" -msgstr "" - -#: library/cgi.rst:407 -msgid "" -"Read the documentation for your HTTP server and check with your local system " -"administrator to find the directory where CGI scripts should be installed; " -"usually this is in a directory :file:`cgi-bin` in the server tree." -msgstr "" - -#: library/cgi.rst:411 -msgid "" -"Make sure that your script is readable and executable by \"others\"; the " -"Unix file mode should be ``0o755`` octal (use ``chmod 0755 filename``). " -"Make sure that the first line of the script contains ``#!`` starting in " -"column 1 followed by the pathname of the Python interpreter, for instance::" -msgstr "" - -#: library/cgi.rst:418 -msgid "" -"Make sure the Python interpreter exists and is executable by \"others\"." -msgstr "" - -#: library/cgi.rst:420 -msgid "" -"Make sure that any files your script needs to read or write are readable or " -"writable, respectively, by \"others\" --- their mode should be ``0o644`` for " -"readable and ``0o666`` for writable. This is because, for security reasons, " -"the HTTP server executes your script as user \"nobody\", without any special " -"privileges. It can only read (write, execute) files that everybody can read " -"(write, execute). The current directory at execution time is also different " -"(it is usually the server's cgi-bin directory) and the set of environment " -"variables is also different from what you get when you log in. In " -"particular, don't count on the shell's search path for executables (:envvar:" -"`PATH`) or the Python module search path (:envvar:`PYTHONPATH`) to be set to " -"anything interesting." -msgstr "" - -#: library/cgi.rst:431 -msgid "" -"If you need to load modules from a directory which is not on Python's " -"default module search path, you can change the path in your script, before " -"importing other modules. For example::" -msgstr "" - -#: library/cgi.rst:439 -msgid "(This way, the directory inserted last will be searched first!)" -msgstr "" - -#: library/cgi.rst:441 -msgid "" -"Instructions for non-Unix systems will vary; check your HTTP server's " -"documentation (it will usually have a section on CGI scripts)." -msgstr "" - -#: library/cgi.rst:446 -msgid "Testing your CGI script" -msgstr "" - -#: library/cgi.rst:448 -msgid "" -"Unfortunately, a CGI script will generally not run when you try it from the " -"command line, and a script that works perfectly from the command line may " -"fail mysteriously when run from the server. There's one reason why you " -"should still test your script from the command line: if it contains a syntax " -"error, the Python interpreter won't execute it at all, and the HTTP server " -"will most likely send a cryptic error to the client." -msgstr "" - -#: library/cgi.rst:455 -msgid "" -"Assuming your script has no syntax errors, yet it does not work, you have no " -"choice but to read the next section." -msgstr "" - -#: library/cgi.rst:460 -msgid "Debugging CGI scripts" -msgstr "" - -#: library/cgi.rst:464 -msgid "" -"First of all, check for trivial installation errors --- reading the section " -"above on installing your CGI script carefully can save you a lot of time. " -"If you wonder whether you have understood the installation procedure " -"correctly, try installing a copy of this module file (:file:`cgi.py`) as a " -"CGI script. When invoked as a script, the file will dump its environment " -"and the contents of the form in HTML format. Give it the right mode etc., " -"and send it a request. If it's installed in the standard :file:`cgi-bin` " -"directory, it should be possible to send it a request by entering a URL into " -"your browser of the form:" -msgstr "" - -#: library/cgi.rst:477 -msgid "" -"If this gives an error of type 404, the server cannot find the script -- " -"perhaps you need to install it in a different directory. If it gives " -"another error, there's an installation problem that you should fix before " -"trying to go any further. If you get a nicely formatted listing of the " -"environment and form content (in this example, the fields should be listed " -"as \"addr\" with value \"At Home\" and \"name\" with value \"Joe Blow\"), " -"the :file:`cgi.py` script has been installed correctly. If you follow the " -"same procedure for your own script, you should now be able to debug it." -msgstr "" - -#: library/cgi.rst:486 -msgid "" -"The next step could be to call the :mod:`cgi` module's :func:`test` function " -"from your script: replace its main code with the single statement ::" -msgstr "" - -#: library/cgi.rst:491 -msgid "" -"This should produce the same results as those gotten from installing the :" -"file:`cgi.py` file itself." -msgstr "" - -#: library/cgi.rst:494 -msgid "" -"When an ordinary Python script raises an unhandled exception (for whatever " -"reason: of a typo in a module name, a file that can't be opened, etc.), the " -"Python interpreter prints a nice traceback and exits. While the Python " -"interpreter will still do this when your CGI script raises an exception, " -"most likely the traceback will end up in one of the HTTP server's log files, " -"or be discarded altogether." -msgstr "" - -#: library/cgi.rst:501 -msgid "" -"Fortunately, once you have managed to get your script to execute *some* " -"code, you can easily send tracebacks to the web browser using the :mod:" -"`cgitb` module. If you haven't done so already, just add the lines::" -msgstr "" - -#: library/cgi.rst:508 -msgid "" -"to the top of your script. Then try running it again; when a problem " -"occurs, you should see a detailed report that will likely make apparent the " -"cause of the crash." -msgstr "" - -#: library/cgi.rst:512 -msgid "" -"If you suspect that there may be a problem in importing the :mod:`cgitb` " -"module, you can use an even more robust approach (which only uses built-in " -"modules)::" -msgstr "" - -#: library/cgi.rst:521 -msgid "" -"This relies on the Python interpreter to print the traceback. The content " -"type of the output is set to plain text, which disables all HTML " -"processing. If your script works, the raw HTML will be displayed by your " -"client. If it raises an exception, most likely after the first two lines " -"have been printed, a traceback will be displayed. Because no HTML " -"interpretation is going on, the traceback will be readable." -msgstr "" - -#: library/cgi.rst:530 -msgid "Common problems and solutions" -msgstr "" - -#: library/cgi.rst:532 -msgid "" -"Most HTTP servers buffer the output from CGI scripts until the script is " -"completed. This means that it is not possible to display a progress report " -"on the client's display while the script is running." -msgstr "" - -#: library/cgi.rst:536 -msgid "Check the installation instructions above." -msgstr "" - -#: library/cgi.rst:538 -msgid "" -"Check the HTTP server's log files. (``tail -f logfile`` in a separate " -"window may be useful!)" -msgstr "" - -#: library/cgi.rst:541 -msgid "" -"Always check a script for syntax errors first, by doing something like " -"``python script.py``." -msgstr "" - -#: library/cgi.rst:544 -msgid "" -"If your script does not have any syntax errors, try adding ``import cgitb; " -"cgitb.enable()`` to the top of the script." -msgstr "" - -#: library/cgi.rst:547 +#: library/cgi.rst:10 msgid "" -"When invoking external programs, make sure they can be found. Usually, this " -"means using absolute path names --- :envvar:`PATH` is usually not set to a " -"very useful value in a CGI script." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/cgi.rst:551 +#: library/cgi.rst:14 msgid "" -"When reading or writing external files, make sure they can be read or " -"written by the userid under which your CGI script will be running: this is " -"typically the userid under which the web server is running, or some " -"explicitly specified userid for a web server's ``suexec`` feature." +"A fork of the module on PyPI can be used instead: :pypi:`legacy-cgi`. This " +"is a copy of the cgi module, no longer maintained or supported by the core " +"Python team." msgstr "" -#: library/cgi.rst:556 +#: library/cgi.rst:18 msgid "" -"Don't try to give a CGI script a set-uid mode. This doesn't work on most " -"systems, and is a security liability as well." -msgstr "" - -#: library/cgi.rst:560 -msgid "Footnotes" -msgstr "" - -#: library/cgi.rst:561 -msgid "" -"Note that some recent versions of the HTML specification do state what order " -"the field values should be supplied in, but knowing whether a request was " -"received from a conforming browser, or even from a browser at all, is " -"tedious and error-prone." -msgstr "" - -#: library/cgi.rst:10 -msgid "WWW" -msgstr "" - -#: library/cgi.rst:10 -msgid "server" -msgstr "" - -#: library/cgi.rst:389 library/cgi.rst:462 -msgid "CGI" -msgstr "" - -#: library/cgi.rst:10 -msgid "protocol" -msgstr "" - -#: library/cgi.rst:10 -msgid "HTTP" -msgstr "" - -#: library/cgi.rst:10 -msgid "MIME" -msgstr "" - -#: library/cgi.rst:10 -msgid "headers" -msgstr "" - -#: library/cgi.rst:10 -msgid "URL" -msgstr "" - -#: library/cgi.rst:10 -msgid "Common Gateway Interface" -msgstr "" - -#: library/cgi.rst:389 -msgid "security" -msgstr "" - -#: library/cgi.rst:462 -msgid "debugging" +"The last version of Python that provided the :mod:`!cgi` module was `Python " +"3.12 `_." msgstr "" diff --git a/library/cgitb.po b/library/cgitb.po index 77eda8ba..76fbff6a 100644 --- a/library/cgitb.po +++ b/library/cgitb.po @@ -8,118 +8,35 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/cgitb.rst:2 -msgid ":mod:`cgitb` --- Traceback manager for CGI scripts" +msgid ":mod:`!cgitb` --- Traceback manager for CGI scripts" msgstr "" -#: library/cgitb.rst:11 -msgid "**Source code:** :source:`Lib/cgitb.py`" -msgstr "" - -#: library/cgitb.rst:22 -msgid "" -"The :mod:`cgitb` module is deprecated (see :pep:`PEP 594 <594#cgitb>` for " -"details)." -msgstr "" - -#: library/cgitb.rst:25 +#: library/cgitb.rst:10 msgid "" -"The :mod:`cgitb` module provides a special exception handler for Python " -"scripts. (Its name is a bit misleading. It was originally designed to " -"display extensive traceback information in HTML for CGI scripts. It was " -"later generalized to also display this information in plain text.) After " -"this module is activated, if an uncaught exception occurs, a detailed, " -"formatted report will be displayed. The report includes a traceback showing " -"excerpts of the source code for each level, as well as the values of the " -"arguments and local variables to currently running functions, to help you " -"debug the problem. Optionally, you can save this information to a file " -"instead of sending it to the browser." -msgstr "" - -#: library/cgitb.rst:35 -msgid "To enable this feature, simply add this to the top of your CGI script::" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/cgitb.rst:40 +#: library/cgitb.rst:14 msgid "" -"The options to the :func:`enable` function control whether the report is " -"displayed in the browser and whether the report is logged to a file for " -"later analysis." +"A fork of the module on PyPI can now be used instead: :pypi:`legacy-cgi`. " +"This is a copy of the cgi module, no longer maintained or supported by the " +"core Python team." msgstr "" -#: library/cgitb.rst:49 +#: library/cgitb.rst:18 msgid "" -"This function causes the :mod:`cgitb` module to take over the interpreter's " -"default handling for exceptions by setting the value of :attr:`sys." -"excepthook`." -msgstr "" - -#: library/cgitb.rst:52 -msgid "" -"The optional argument *display* defaults to ``1`` and can be set to ``0`` to " -"suppress sending the traceback to the browser. If the argument *logdir* is " -"present, the traceback reports are written to files. The value of *logdir* " -"should be a directory where these files will be placed. The optional " -"argument *context* is the number of lines of context to display around the " -"current line of source code in the traceback; this defaults to ``5``. If the " -"optional argument *format* is ``\"html\"``, the output is formatted as " -"HTML. Any other value forces plain text output. The default value is " -"``\"html\"``." -msgstr "" - -#: library/cgitb.rst:64 -msgid "" -"This function handles the exception described by *info* (a 3-tuple " -"containing the result of :func:`sys.exc_info`), formatting its traceback as " -"text and returning the result as a string. The optional argument *context* " -"is the number of lines of context to display around the current line of " -"source code in the traceback; this defaults to ``5``." -msgstr "" - -#: library/cgitb.rst:73 -msgid "" -"This function handles the exception described by *info* (a 3-tuple " -"containing the result of :func:`sys.exc_info`), formatting its traceback as " -"HTML and returning the result as a string. The optional argument *context* " -"is the number of lines of context to display around the current line of " -"source code in the traceback; this defaults to ``5``." -msgstr "" - -#: library/cgitb.rst:82 -msgid "" -"This function handles an exception using the default settings (that is, show " -"a report in the browser, but don't log to a file). This can be used when " -"you've caught an exception and want to report it using :mod:`cgitb`. The " -"optional *info* argument should be a 3-tuple containing an exception type, " -"exception value, and traceback object, exactly like the tuple returned by :" -"func:`sys.exc_info`. If the *info* argument is not supplied, the current " -"exception is obtained from :func:`sys.exc_info`." -msgstr "" - -#: library/cgitb.rst:13 -msgid "CGI" -msgstr "" - -#: library/cgitb.rst:13 -msgid "exceptions" -msgstr "" - -#: library/cgitb.rst:13 -msgid "tracebacks" -msgstr "" - -#: library/cgitb.rst:13 -msgid "in CGI scripts" -msgstr "" - -#: library/cgitb.rst:47 -msgid "excepthook() (in module sys)" +"The last version of Python that provided the :mod:`!cgitb` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/chunk.po b/library/chunk.po index 3f9f9ad7..3968251e 100644 --- a/library/chunk.po +++ b/library/chunk.po @@ -8,214 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/chunk.rst:2 -msgid ":mod:`chunk` --- Read IFF chunked data" +msgid ":mod:`!chunk` --- Read IFF chunked data" msgstr "" -#: library/chunk.rst:11 -msgid "**Source code:** :source:`Lib/chunk.py`" -msgstr "" - -#: library/chunk.rst:23 -msgid "" -"The :mod:`chunk` module is deprecated (see :pep:`PEP 594 <594#chunk>` for " -"details)." -msgstr "" - -#: library/chunk.rst:26 -msgid "" -"This module provides an interface for reading files that use EA IFF 85 " -"chunks. [#]_ This format is used in at least the Audio Interchange File " -"Format (AIFF/AIFF-C) and the Real Media File Format (RMFF). The WAVE audio " -"file format is closely related and can also be read using this module." -msgstr "" - -#: library/chunk.rst:31 -msgid "A chunk has the following structure:" -msgstr "" - -#: library/chunk.rst:34 -msgid "Offset" -msgstr "" - -#: library/chunk.rst:34 -msgid "Length" -msgstr "" - -#: library/chunk.rst:34 -msgid "Contents" -msgstr "" - -#: library/chunk.rst:36 -msgid "0" -msgstr "" - -#: library/chunk.rst:38 -msgid "4" -msgstr "" - -#: library/chunk.rst:36 -msgid "Chunk ID" -msgstr "" - -#: library/chunk.rst:38 -msgid "Size of chunk in big-endian byte order, not including the header" -msgstr "" - -#: library/chunk.rst:42 -msgid "8" -msgstr "" - -#: library/chunk.rst:42 -msgid "*n*" -msgstr "" - -#: library/chunk.rst:42 -msgid "Data bytes, where *n* is the size given in the preceding field" -msgstr "" - -#: library/chunk.rst:46 -msgid "8 + *n*" -msgstr "" - -#: library/chunk.rst:46 -msgid "0 or 1" -msgstr "" - -#: library/chunk.rst:46 -msgid "Pad byte needed if *n* is odd and chunk alignment is used" -msgstr "" - -#: library/chunk.rst:50 -msgid "The ID is a 4-byte string which identifies the type of chunk." -msgstr "" - -#: library/chunk.rst:52 -msgid "" -"The size field (a 32-bit value, encoded using big-endian byte order) gives " -"the size of the chunk data, not including the 8-byte header." -msgstr "" - -#: library/chunk.rst:55 +#: library/chunk.rst:10 msgid "" -"Usually an IFF-type file consists of one or more chunks. The proposed usage " -"of the :class:`Chunk` class defined here is to instantiate an instance at " -"the start of each chunk and read from the instance until it reaches the end, " -"after which a new instance can be instantiated. At the end of the file, " -"creating a new instance will fail with an :exc:`EOFError` exception." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/chunk.rst:64 +#: library/chunk.rst:14 msgid "" -"Class which represents a chunk. The *file* argument is expected to be a " -"file-like object. An instance of this class is specifically allowed. The " -"only method that is needed is :meth:`~io.IOBase.read`. If the methods :meth:" -"`~io.IOBase.seek` and :meth:`~io.IOBase.tell` are present and don't raise an " -"exception, they are also used. If these methods are present and raise an " -"exception, they are expected to not have altered the object. If the " -"optional argument *align* is true, chunks are assumed to be aligned on 2-" -"byte boundaries. If *align* is false, no alignment is assumed. The default " -"value is true. If the optional argument *bigendian* is false, the chunk " -"size is assumed to be in little-endian order. This is needed for WAVE audio " -"files. The default value is true. If the optional argument *inclheader* is " -"true, the size given in the chunk header includes the size of the header. " -"The default value is false." -msgstr "" - -#: library/chunk.rst:78 -msgid "A :class:`Chunk` object supports the following methods:" -msgstr "" - -#: library/chunk.rst:83 -msgid "" -"Returns the name (ID) of the chunk. This is the first 4 bytes of the chunk." -msgstr "" - -#: library/chunk.rst:89 -msgid "Returns the size of the chunk." -msgstr "" - -#: library/chunk.rst:94 -msgid "" -"Close and skip to the end of the chunk. This does not close the underlying " -"file." -msgstr "" - -#: library/chunk.rst:97 -msgid "" -"The remaining methods will raise :exc:`OSError` if called after the :meth:" -"`close` method has been called. Before Python 3.3, they used to raise :exc:" -"`IOError`, now an alias of :exc:`OSError`." -msgstr "" - -#: library/chunk.rst:104 -msgid "Returns ``False``." -msgstr "" - -#: library/chunk.rst:109 -msgid "" -"Set the chunk's current position. The *whence* argument is optional and " -"defaults to ``0`` (absolute file positioning); other values are ``1`` (seek " -"relative to the current position) and ``2`` (seek relative to the file's " -"end). There is no return value. If the underlying file does not allow seek, " -"only forward seeks are allowed." -msgstr "" - -#: library/chunk.rst:118 -msgid "Return the current position into the chunk." -msgstr "" - -#: library/chunk.rst:123 -msgid "" -"Read at most *size* bytes from the chunk (less if the read hits the end of " -"the chunk before obtaining *size* bytes). If the *size* argument is " -"negative or omitted, read all data until the end of the chunk. An empty " -"bytes object is returned when the end of the chunk is encountered " -"immediately." -msgstr "" - -#: library/chunk.rst:132 -msgid "" -"Skip to the end of the chunk. All further calls to :meth:`read` for the " -"chunk will return ``b''``. If you are not interested in the contents of the " -"chunk, this method should be called so that the file points to the start of " -"the next chunk." -msgstr "" - -#: library/chunk.rst:139 -msgid "Footnotes" -msgstr "" - -#: library/chunk.rst:140 -msgid "" -"\"EA IFF 85\" Standard for Interchange Format Files, Jerry Morrison, " -"Electronic Arts, January 1985." -msgstr "" - -#: library/chunk.rst:13 -msgid "Audio Interchange File Format" -msgstr "" - -#: library/chunk.rst:13 -msgid "AIFF" -msgstr "" - -#: library/chunk.rst:13 -msgid "AIFF-C" -msgstr "" - -#: library/chunk.rst:13 -msgid "Real Media File Format" -msgstr "" - -#: library/chunk.rst:13 -msgid "RMFF" +"The last version of Python that provided the :mod:`!chunk` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/cmath.po b/library/cmath.po index c374024f..3db16907 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/cmath.rst:2 -msgid ":mod:`cmath` --- Mathematical functions for complex numbers" +msgid ":mod:`!cmath` --- Mathematical functions for complex numbers" msgstr "" #: library/cmath.rst:9 @@ -45,29 +46,305 @@ msgstr "" #: library/cmath.rst:26 msgid "" "For example, the :func:`cmath.sqrt` function has a branch cut along the " -"negative real axis. An argument of ``complex(-2.0, -0.0)`` is treated as " -"though it lies *below* the branch cut, and so gives a result on the negative " -"imaginary axis::" +"negative real axis. An argument of ``-2-0j`` is treated as though it lies " +"*below* the branch cut, and so gives a result on the negative imaginary " +"axis::" +msgstr "" + +#: library/cmath.rst:31 +msgid "" +">>> cmath.sqrt(-2-0j)\n" +"-1.4142135623730951j" msgstr "" #: library/cmath.rst:34 msgid "" -"But an argument of ``complex(-2.0, 0.0)`` is treated as though it lies above " -"the branch cut::" +"But an argument of ``-2+0j`` is treated as though it lies above the branch " +"cut::" +msgstr "" + +#: library/cmath.rst:37 +msgid "" +">>> cmath.sqrt(-2+0j)\n" +"1.4142135623730951j" msgstr "" #: library/cmath.rst:42 -msgid "Conversions to and from polar coordinates" +msgid "**Conversions to and from polar coordinates**" msgstr "" #: library/cmath.rst:44 +msgid ":func:`phase(z) `" +msgstr "" + +#: library/cmath.rst:44 +msgid "Return the phase of *z*" +msgstr "" + +#: library/cmath.rst:45 +msgid ":func:`polar(z) `" +msgstr "" + +#: library/cmath.rst:45 +msgid "Return the representation of *z* in polar coordinates" +msgstr "" + +#: library/cmath.rst:46 +msgid ":func:`rect(r, phi) `" +msgstr "" + +#: library/cmath.rst:46 +msgid "Return the complex number *z* with polar coordinates *r* and *phi*" +msgstr "" + +#: library/cmath.rst:48 +msgid "**Power and logarithmic functions**" +msgstr "" + +#: library/cmath.rst:50 +msgid ":func:`exp(z) `" +msgstr "" + +#: library/cmath.rst:50 +msgid "Return *e* raised to the power *z*" +msgstr "" + +#: library/cmath.rst:51 +msgid ":func:`log(z[, base]) `" +msgstr "" + +#: library/cmath.rst:51 +msgid "Return the logarithm of *z* to the given *base* (*e* by default)" +msgstr "" + +#: library/cmath.rst:52 +msgid ":func:`log10(z) `" +msgstr "" + +#: library/cmath.rst:52 +msgid "Return the base-10 logarithm of *z*" +msgstr "" + +#: library/cmath.rst:53 +msgid ":func:`sqrt(z) `" +msgstr "" + +#: library/cmath.rst:53 +msgid "Return the square root of *z*" +msgstr "" + +#: library/cmath.rst:55 +msgid "**Trigonometric functions**" +msgstr "" + +#: library/cmath.rst:57 +msgid ":func:`acos(z) `" +msgstr "" + +#: library/cmath.rst:57 +msgid "Return the arc cosine of *z*" +msgstr "" + +#: library/cmath.rst:58 +msgid ":func:`asin(z) `" +msgstr "" + +#: library/cmath.rst:58 +msgid "Return the arc sine of *z*" +msgstr "" + +#: library/cmath.rst:59 +msgid ":func:`atan(z) `" +msgstr "" + +#: library/cmath.rst:59 +msgid "Return the arc tangent of *z*" +msgstr "" + +#: library/cmath.rst:60 +msgid ":func:`cos(z) `" +msgstr "" + +#: library/cmath.rst:60 +msgid "Return the cosine of *z*" +msgstr "" + +#: library/cmath.rst:61 +msgid ":func:`sin(z) `" +msgstr "" + +#: library/cmath.rst:61 +msgid "Return the sine of *z*" +msgstr "" + +#: library/cmath.rst:62 +msgid ":func:`tan(z) `" +msgstr "" + +#: library/cmath.rst:62 +msgid "Return the tangent of *z*" +msgstr "" + +#: library/cmath.rst:64 +msgid "**Hyperbolic functions**" +msgstr "" + +#: library/cmath.rst:66 +msgid ":func:`acosh(z) `" +msgstr "" + +#: library/cmath.rst:66 +msgid "Return the inverse hyperbolic cosine of *z*" +msgstr "" + +#: library/cmath.rst:67 +msgid ":func:`asinh(z) `" +msgstr "" + +#: library/cmath.rst:67 +msgid "Return the inverse hyperbolic sine of *z*" +msgstr "" + +#: library/cmath.rst:68 +msgid ":func:`atanh(z) `" +msgstr "" + +#: library/cmath.rst:68 +msgid "Return the inverse hyperbolic tangent of *z*" +msgstr "" + +#: library/cmath.rst:69 +msgid ":func:`cosh(z) `" +msgstr "" + +#: library/cmath.rst:69 +msgid "Return the hyperbolic cosine of *z*" +msgstr "" + +#: library/cmath.rst:70 +msgid ":func:`sinh(z) `" +msgstr "" + +#: library/cmath.rst:70 +msgid "Return the hyperbolic sine of *z*" +msgstr "" + +#: library/cmath.rst:71 +msgid ":func:`tanh(z) `" +msgstr "" + +#: library/cmath.rst:71 +msgid "Return the hyperbolic tangent of *z*" +msgstr "" + +#: library/cmath.rst:73 +msgid "**Classification functions**" +msgstr "" + +#: library/cmath.rst:75 +msgid ":func:`isfinite(z) `" +msgstr "" + +#: library/cmath.rst:75 +msgid "Check if all components of *z* are finite" +msgstr "" + +#: library/cmath.rst:76 +msgid ":func:`isinf(z) `" +msgstr "" + +#: library/cmath.rst:76 +msgid "Check if any component of *z* is infinite" +msgstr "" + +#: library/cmath.rst:77 +msgid ":func:`isnan(z) `" +msgstr "" + +#: library/cmath.rst:77 +msgid "Check if any component of *z* is a NaN" +msgstr "" + +#: library/cmath.rst:78 +msgid ":func:`isclose(a, b, *, rel_tol, abs_tol) `" +msgstr "" + +#: library/cmath.rst:78 +msgid "Check if the values *a* and *b* are close to each other" +msgstr "" + +#: library/cmath.rst:80 +msgid "**Constants**" +msgstr "" + +#: library/cmath.rst:82 +msgid ":data:`pi`" +msgstr "" + +#: library/cmath.rst:82 +msgid "*π* = 3.141592..." +msgstr "" + +#: library/cmath.rst:83 +msgid ":data:`e`" +msgstr "" + +#: library/cmath.rst:83 +msgid "*e* = 2.718281..." +msgstr "" + +#: library/cmath.rst:84 +msgid ":data:`tau`" +msgstr "" + +#: library/cmath.rst:84 +msgid "*τ* = 2\\ *π* = 6.283185..." +msgstr "" + +#: library/cmath.rst:85 +msgid ":data:`inf`" +msgstr "" + +#: library/cmath.rst:85 +msgid "Positive infinity" +msgstr "" + +#: library/cmath.rst:86 +msgid ":data:`infj`" +msgstr "" + +#: library/cmath.rst:86 +msgid "Pure imaginary infinity" +msgstr "" + +#: library/cmath.rst:87 +msgid ":data:`nan`" +msgstr "" + +#: library/cmath.rst:87 +msgid "\"Not a number\" (NaN)" +msgstr "" + +#: library/cmath.rst:88 +msgid ":data:`nanj`" +msgstr "" + +#: library/cmath.rst:88 +msgid "Pure imaginary NaN" +msgstr "" + +#: library/cmath.rst:93 +msgid "Conversions to and from polar coordinates" +msgstr "" + +#: library/cmath.rst:95 msgid "" "A Python complex number ``z`` is stored internally using *rectangular* or " "*Cartesian* coordinates. It is completely determined by its *real part* ``z." -"real`` and its *imaginary part* ``z.imag``. In other words::" +"real`` and its *imaginary part* ``z.imag``." msgstr "" -#: library/cmath.rst:51 +#: library/cmath.rst:99 msgid "" "*Polar coordinates* give an alternative way to represent a complex number. " "In polar coordinates, a complex number *z* is defined by the modulus *r* and " @@ -77,196 +354,203 @@ msgid "" "to *z*." msgstr "" -#: library/cmath.rst:58 +#: library/cmath.rst:106 msgid "" "The following functions can be used to convert from the native rectangular " "coordinates to polar coordinates and back." msgstr "" -#: library/cmath.rst:63 +#: library/cmath.rst:111 msgid "" -"Return the phase of *x* (also known as the *argument* of *x*), as a float. " -"``phase(x)`` is equivalent to ``math.atan2(x.imag, x.real)``. The result " +"Return the phase of *z* (also known as the *argument* of *z*), as a float. " +"``phase(z)`` is equivalent to ``math.atan2(z.imag, z.real)``. The result " "lies in the range [-\\ *π*, *π*], and the branch cut for this operation lies " "along the negative real axis. The sign of the result is the same as the " -"sign of ``x.imag``, even when ``x.imag`` is zero::" +"sign of ``z.imag``, even when ``z.imag`` is zero::" msgstr "" -#: library/cmath.rst:77 +#: library/cmath.rst:117 +msgid "" +">>> phase(-1+0j)\n" +"3.141592653589793\n" +">>> phase(-1-0j)\n" +"-3.141592653589793" +msgstr "" + +#: library/cmath.rst:125 msgid "" -"The modulus (absolute value) of a complex number *x* can be computed using " +"The modulus (absolute value) of a complex number *z* can be computed using " "the built-in :func:`abs` function. There is no separate :mod:`cmath` module " "function for this operation." msgstr "" -#: library/cmath.rst:84 +#: library/cmath.rst:132 msgid "" -"Return the representation of *x* in polar coordinates. Returns a pair ``(r, " -"phi)`` where *r* is the modulus of *x* and phi is the phase of *x*. " -"``polar(x)`` is equivalent to ``(abs(x), phase(x))``." +"Return the representation of *z* in polar coordinates. Returns a pair ``(r, " +"phi)`` where *r* is the modulus of *z* and *phi* is the phase of *z*. " +"``polar(z)`` is equivalent to ``(abs(z), phase(z))``." msgstr "" -#: library/cmath.rst:92 +#: library/cmath.rst:140 msgid "" -"Return the complex number *x* with polar coordinates *r* and *phi*. " -"Equivalent to ``r * (math.cos(phi) + math.sin(phi)*1j)``." +"Return the complex number *z* with polar coordinates *r* and *phi*. " +"Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``." msgstr "" -#: library/cmath.rst:97 +#: library/cmath.rst:145 msgid "Power and logarithmic functions" msgstr "" -#: library/cmath.rst:101 +#: library/cmath.rst:149 msgid "" -"Return *e* raised to the power *x*, where *e* is the base of natural " +"Return *e* raised to the power *z*, where *e* is the base of natural " "logarithms." msgstr "" -#: library/cmath.rst:107 +#: library/cmath.rst:155 msgid "" -"Returns the logarithm of *x* to the given *base*. If the *base* is not " -"specified, returns the natural logarithm of *x*. There is one branch cut, " +"Return the logarithm of *z* to the given *base*. If the *base* is not " +"specified, returns the natural logarithm of *z*. There is one branch cut, " "from 0 along the negative real axis to -∞." msgstr "" -#: library/cmath.rst:114 +#: library/cmath.rst:162 msgid "" -"Return the base-10 logarithm of *x*. This has the same branch cut as :func:" +"Return the base-10 logarithm of *z*. This has the same branch cut as :func:" "`log`." msgstr "" -#: library/cmath.rst:120 +#: library/cmath.rst:168 msgid "" -"Return the square root of *x*. This has the same branch cut as :func:`log`." +"Return the square root of *z*. This has the same branch cut as :func:`log`." msgstr "" -#: library/cmath.rst:124 +#: library/cmath.rst:172 msgid "Trigonometric functions" msgstr "" -#: library/cmath.rst:128 +#: library/cmath.rst:176 msgid "" -"Return the arc cosine of *x*. There are two branch cuts: One extends right " +"Return the arc cosine of *z*. There are two branch cuts: One extends right " "from 1 along the real axis to ∞. The other extends left from -1 along the " "real axis to -∞." msgstr "" -#: library/cmath.rst:135 +#: library/cmath.rst:183 msgid "" -"Return the arc sine of *x*. This has the same branch cuts as :func:`acos`." +"Return the arc sine of *z*. This has the same branch cuts as :func:`acos`." msgstr "" -#: library/cmath.rst:140 +#: library/cmath.rst:188 msgid "" -"Return the arc tangent of *x*. There are two branch cuts: One extends from " +"Return the arc tangent of *z*. There are two branch cuts: One extends from " "``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j`` " "along the imaginary axis to ``-∞j``." msgstr "" -#: library/cmath.rst:147 -msgid "Return the cosine of *x*." +#: library/cmath.rst:195 +msgid "Return the cosine of *z*." msgstr "" -#: library/cmath.rst:152 -msgid "Return the sine of *x*." +#: library/cmath.rst:200 +msgid "Return the sine of *z*." msgstr "" -#: library/cmath.rst:157 -msgid "Return the tangent of *x*." +#: library/cmath.rst:205 +msgid "Return the tangent of *z*." msgstr "" -#: library/cmath.rst:161 +#: library/cmath.rst:209 msgid "Hyperbolic functions" msgstr "" -#: library/cmath.rst:165 +#: library/cmath.rst:213 msgid "" -"Return the inverse hyperbolic cosine of *x*. There is one branch cut, " +"Return the inverse hyperbolic cosine of *z*. There is one branch cut, " "extending left from 1 along the real axis to -∞." msgstr "" -#: library/cmath.rst:171 +#: library/cmath.rst:219 msgid "" -"Return the inverse hyperbolic sine of *x*. There are two branch cuts: One " +"Return the inverse hyperbolic sine of *z*. There are two branch cuts: One " "extends from ``1j`` along the imaginary axis to ``∞j``. The other extends " "from ``-1j`` along the imaginary axis to ``-∞j``." msgstr "" -#: library/cmath.rst:178 +#: library/cmath.rst:226 msgid "" -"Return the inverse hyperbolic tangent of *x*. There are two branch cuts: One " +"Return the inverse hyperbolic tangent of *z*. There are two branch cuts: One " "extends from ``1`` along the real axis to ``∞``. The other extends from " "``-1`` along the real axis to ``-∞``." msgstr "" -#: library/cmath.rst:185 -msgid "Return the hyperbolic cosine of *x*." +#: library/cmath.rst:233 +msgid "Return the hyperbolic cosine of *z*." msgstr "" -#: library/cmath.rst:190 -msgid "Return the hyperbolic sine of *x*." +#: library/cmath.rst:238 +msgid "Return the hyperbolic sine of *z*." msgstr "" -#: library/cmath.rst:195 -msgid "Return the hyperbolic tangent of *x*." +#: library/cmath.rst:243 +msgid "Return the hyperbolic tangent of *z*." msgstr "" -#: library/cmath.rst:199 +#: library/cmath.rst:247 msgid "Classification functions" msgstr "" -#: library/cmath.rst:203 +#: library/cmath.rst:251 msgid "" -"Return ``True`` if both the real and imaginary parts of *x* are finite, and " +"Return ``True`` if both the real and imaginary parts of *z* are finite, and " "``False`` otherwise." msgstr "" -#: library/cmath.rst:211 +#: library/cmath.rst:259 msgid "" -"Return ``True`` if either the real or the imaginary part of *x* is an " +"Return ``True`` if either the real or the imaginary part of *z* is an " "infinity, and ``False`` otherwise." msgstr "" -#: library/cmath.rst:217 +#: library/cmath.rst:265 msgid "" -"Return ``True`` if either the real or the imaginary part of *x* is a NaN, " +"Return ``True`` if either the real or the imaginary part of *z* is a NaN, " "and ``False`` otherwise." msgstr "" -#: library/cmath.rst:223 +#: library/cmath.rst:271 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "" -#: library/cmath.rst:226 +#: library/cmath.rst:274 msgid "" "Whether or not two values are considered close is determined according to " -"given absolute and relative tolerances." +"given absolute and relative tolerances. If no errors occur, the result will " +"be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." msgstr "" -#: library/cmath.rst:229 +#: library/cmath.rst:278 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " "For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default " "tolerance is ``1e-09``, which assures that the two values are the same " -"within about 9 decimal digits. *rel_tol* must be greater than zero." -msgstr "" - -#: library/cmath.rst:235 -msgid "" -"*abs_tol* is the minimum absolute tolerance -- useful for comparisons near " -"zero. *abs_tol* must be at least zero." +"within about 9 decimal digits. *rel_tol* must be nonnegative and less than " +"``1.0``." msgstr "" -#: library/cmath.rst:238 +#: library/cmath.rst:285 msgid "" -"If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * " -"max(abs(a), abs(b)), abs_tol)``." +"*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " +"nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " +"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " +"to the call." msgstr "" -#: library/cmath.rst:241 +#: library/cmath.rst:291 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -274,49 +558,49 @@ msgid "" "considered close to themselves." msgstr "" -#: library/cmath.rst:250 +#: library/cmath.rst:300 msgid ":pep:`485` -- A function for testing approximate equality" msgstr "" -#: library/cmath.rst:254 +#: library/cmath.rst:304 msgid "Constants" msgstr "" -#: library/cmath.rst:258 +#: library/cmath.rst:308 msgid "The mathematical constant *π*, as a float." msgstr "" -#: library/cmath.rst:263 +#: library/cmath.rst:313 msgid "The mathematical constant *e*, as a float." msgstr "" -#: library/cmath.rst:268 +#: library/cmath.rst:318 msgid "The mathematical constant *τ*, as a float." msgstr "" -#: library/cmath.rst:275 +#: library/cmath.rst:325 msgid "Floating-point positive infinity. Equivalent to ``float('inf')``." msgstr "" -#: library/cmath.rst:282 +#: library/cmath.rst:332 msgid "" "Complex number with zero real part and positive infinity imaginary part. " "Equivalent to ``complex(0.0, float('inf'))``." msgstr "" -#: library/cmath.rst:290 +#: library/cmath.rst:340 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to " -"``float('nan')``." +"``float('nan')``. See also :data:`math.nan`." msgstr "" -#: library/cmath.rst:298 +#: library/cmath.rst:348 msgid "" "Complex number with zero real part and NaN imaginary part. Equivalent to " "``complex(0.0, float('nan'))``." msgstr "" -#: library/cmath.rst:306 +#: library/cmath.rst:356 msgid "" "Note that the selection of functions is similar, but not identical, to that " "in module :mod:`math`. The reason for having two modules is that some users " @@ -328,7 +612,7 @@ msgid "" "zero)." msgstr "" -#: library/cmath.rst:314 +#: library/cmath.rst:364 msgid "" "A note on branch cuts: They are curves along which the given function fails " "to be continuous. They are a necessary feature of many complex functions. " @@ -339,17 +623,17 @@ msgid "" "following:" msgstr "" -#: library/cmath.rst:324 +#: library/cmath.rst:374 msgid "" "Kahan, W: Branch cuts for complex elementary functions; or, Much ado about " "nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the " "art in numerical analysis. Clarendon Press (1987) pp165--211." msgstr "" -#: library/cmath.rst:304 +#: library/cmath.rst:354 msgid "module" msgstr "" -#: library/cmath.rst:304 +#: library/cmath.rst:354 msgid "math" msgstr "" diff --git a/library/cmd.po b/library/cmd.po index ab4ece5f..511a5db6 100644 --- a/library/cmd.po +++ b/library/cmd.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/cmd.rst:2 -msgid ":mod:`cmd` --- Support for line-oriented command interpreters" +msgid ":mod:`!cmd` --- Support for line-oriented command interpreters" msgstr "" #: library/cmd.rst:9 @@ -51,41 +52,54 @@ msgstr "" #: library/cmd.rst:29 msgid "" +"The default, ``'tab'``, is treated specially, so that it refers to the :kbd:" +"`Tab` key on every :data:`readline.backend`. Specifically, if :data:" +"`readline.backend` is ``editline``, ``Cmd`` will use ``'^I'`` instead of " +"``'tab'``. Note that other values are not treated this way, and might only " +"work with a specific backend." +msgstr "" + +#: library/cmd.rst:36 +msgid "" "The optional arguments *stdin* and *stdout* specify the input and output " "file objects that the Cmd instance or subclass instance will use for input " "and output. If not specified, they will default to :data:`sys.stdin` and :" "data:`sys.stdout`." msgstr "" -#: library/cmd.rst:34 +#: library/cmd.rst:41 msgid "" "If you want a given *stdin* to be used, make sure to set the instance's :" "attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be " "ignored." msgstr "" -#: library/cmd.rst:42 +#: library/cmd.rst:45 +msgid "``completekey='tab'`` is replaced by ``'^I'`` for ``editline``." +msgstr "" + +#: library/cmd.rst:52 msgid "Cmd Objects" msgstr "" -#: library/cmd.rst:44 +#: library/cmd.rst:54 msgid "A :class:`Cmd` instance has the following methods:" msgstr "" -#: library/cmd.rst:49 +#: library/cmd.rst:59 msgid "" "Repeatedly issue a prompt, accept input, parse an initial prefix off the " "received input, and dispatch to action methods, passing them the remainder " "of the line as argument." msgstr "" -#: library/cmd.rst:53 +#: library/cmd.rst:63 msgid "" "The optional argument is a banner or intro string to be issued before the " "first prompt (this overrides the :attr:`intro` class attribute)." msgstr "" -#: library/cmd.rst:56 +#: library/cmd.rst:66 msgid "" "If the :mod:`readline` module is loaded, input will automatically inherit :" "program:`bash`\\ -like history-list editing (e.g. :kbd:`Control-P` scrolls " @@ -94,11 +108,11 @@ msgid "" "B` moves the cursor to the left non-destructively, etc.)." msgstr "" -#: library/cmd.rst:62 +#: library/cmd.rst:72 msgid "An end-of-file on input is passed back as the string ``'EOF'``." msgstr "" -#: library/cmd.rst:68 +#: library/cmd.rst:78 msgid "" "An interpreter instance will recognize a command name ``foo`` if and only if " "it has a method :meth:`!do_foo`. As a special case, a line beginning with " @@ -107,14 +121,14 @@ msgid "" "dispatched to the method :meth:`!do_shell` (if such a method is defined)." msgstr "" -#: library/cmd.rst:74 +#: library/cmd.rst:84 msgid "" "This method will return when the :meth:`postcmd` method returns a true " "value. The *stop* argument to :meth:`postcmd` is the return value from the " "command's corresponding :meth:`!do_\\*` method." msgstr "" -#: library/cmd.rst:78 +#: library/cmd.rst:88 msgid "" "If completion is enabled, completing commands will be done automatically, " "and completing of commands args is done by calling :meth:`!complete_foo` " @@ -126,7 +140,7 @@ msgid "" "the argument is in." msgstr "" -#: library/cmd.rst:89 +#: library/cmd.rst:99 msgid "" "All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This " "method, called with an argument ``'bar'``, invokes the corresponding method :" @@ -137,7 +151,7 @@ msgid "" "undocumented commands." msgstr "" -#: library/cmd.rst:100 +#: library/cmd.rst:110 msgid "" "Interpret the argument as though it had been typed in response to the " "prompt. This may be overridden, but should not normally need to be; see the :" @@ -148,32 +162,32 @@ msgid "" "return value from the :meth:`default` method is returned." msgstr "" -#: library/cmd.rst:111 +#: library/cmd.rst:121 msgid "" "Method called when an empty line is entered in response to the prompt. If " "this method is not overridden, it repeats the last nonempty command entered." msgstr "" -#: library/cmd.rst:117 +#: library/cmd.rst:127 msgid "" "Method called on an input line when the command prefix is not recognized. If " "this method is not overridden, it prints an error message and returns." msgstr "" -#: library/cmd.rst:123 +#: library/cmd.rst:133 msgid "" "Method called to complete an input line when no command-specific :meth:`!" "complete_\\*` method is available. By default, it returns an empty list." msgstr "" -#: library/cmd.rst:129 +#: library/cmd.rst:139 msgid "" "Method called to display a list of strings as a compact set of columns. Each " "column is only as wide as necessary. Columns are separated by two spaces for " "readability." msgstr "" -#: library/cmd.rst:136 +#: library/cmd.rst:146 msgid "" "Hook method executed just before the command line *line* is interpreted, but " "after the input prompt is generated and issued. This method is a stub in :" @@ -183,7 +197,7 @@ msgid "" "*line* unchanged." msgstr "" -#: library/cmd.rst:146 +#: library/cmd.rst:156 msgid "" "Hook method executed just after a command dispatch is finished. This method " "is a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* " @@ -194,74 +208,74 @@ msgid "" "corresponds to *stop*; returning false will cause interpretation to continue." msgstr "" -#: library/cmd.rst:157 +#: library/cmd.rst:167 msgid "" "Hook method executed once when :meth:`cmdloop` is called. This method is a " "stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -#: library/cmd.rst:163 +#: library/cmd.rst:173 msgid "" "Hook method executed once when :meth:`cmdloop` is about to return. This " "method is a stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -#: library/cmd.rst:167 +#: library/cmd.rst:177 msgid "" "Instances of :class:`Cmd` subclasses have some public instance variables:" msgstr "" -#: library/cmd.rst:171 +#: library/cmd.rst:181 msgid "The prompt issued to solicit input." msgstr "" -#: library/cmd.rst:176 +#: library/cmd.rst:186 msgid "The string of characters accepted for the command prefix." msgstr "" -#: library/cmd.rst:181 +#: library/cmd.rst:191 msgid "The last nonempty command prefix seen." msgstr "" -#: library/cmd.rst:186 +#: library/cmd.rst:196 msgid "" "A list of queued input lines. The cmdqueue list is checked in :meth:" "`cmdloop` when new input is needed; if it is nonempty, its elements will be " "processed in order, as if entered at the prompt." msgstr "" -#: library/cmd.rst:193 +#: library/cmd.rst:203 msgid "" "A string to issue as an intro or banner. May be overridden by giving the :" "meth:`cmdloop` method an argument." msgstr "" -#: library/cmd.rst:199 +#: library/cmd.rst:209 msgid "" "The header to issue if the help output has a section for documented commands." msgstr "" -#: library/cmd.rst:204 +#: library/cmd.rst:214 msgid "" "The header to issue if the help output has a section for miscellaneous help " "topics (that is, there are :meth:`!help_\\*` methods without corresponding :" "meth:`!do_\\*` methods)." msgstr "" -#: library/cmd.rst:211 +#: library/cmd.rst:221 msgid "" "The header to issue if the help output has a section for undocumented " "commands (that is, there are :meth:`!do_\\*` methods without corresponding :" "meth:`!help_\\*` methods)." msgstr "" -#: library/cmd.rst:218 +#: library/cmd.rst:228 msgid "" "The character used to draw separator lines under the help-message headers. " "If empty, no ruler line is drawn. It defaults to ``'='``." msgstr "" -#: library/cmd.rst:224 +#: library/cmd.rst:234 msgid "" "A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to " "display a prompt and read the next command; if false, :data:`sys.stdout." @@ -271,23 +285,23 @@ msgid "" "editing and command-history keystrokes.)" msgstr "" -#: library/cmd.rst:234 +#: library/cmd.rst:244 msgid "Cmd Example" msgstr "" -#: library/cmd.rst:238 +#: library/cmd.rst:248 msgid "" "The :mod:`cmd` module is mainly useful for building custom shells that let a " "user work with a program interactively." msgstr "" -#: library/cmd.rst:241 +#: library/cmd.rst:251 msgid "" "This section presents a simple example of how to build a shell around a few " "of the commands in the :mod:`turtle` module." msgstr "" -#: library/cmd.rst:244 +#: library/cmd.rst:254 msgid "" "Basic turtle commands such as :meth:`~turtle.forward` are added to a :class:" "`Cmd` subclass with method named :meth:`!do_forward`. The argument is " @@ -295,7 +309,7 @@ msgid "" "used in the help utility provided by the shell." msgstr "" -#: library/cmd.rst:249 +#: library/cmd.rst:259 msgid "" "The example also includes a basic record and playback facility implemented " "with the :meth:`~Cmd.precmd` method which is responsible for converting the " @@ -304,21 +318,162 @@ msgid "" "attr:`~Cmd.cmdqueue` for immediate playback::" msgstr "" -#: library/cmd.rst:330 +#: library/cmd.rst:265 +msgid "" +"import cmd, sys\n" +"from turtle import *\n" +"\n" +"class TurtleShell(cmd.Cmd):\n" +" intro = 'Welcome to the turtle shell. Type help or ? to list commands." +"\\n'\n" +" prompt = '(turtle) '\n" +" file = None\n" +"\n" +" # ----- basic turtle commands -----\n" +" def do_forward(self, arg):\n" +" 'Move the turtle forward by the specified distance: FORWARD 10'\n" +" forward(*parse(arg))\n" +" def do_right(self, arg):\n" +" 'Turn turtle right by given number of degrees: RIGHT 20'\n" +" right(*parse(arg))\n" +" def do_left(self, arg):\n" +" 'Turn turtle left by given number of degrees: LEFT 90'\n" +" left(*parse(arg))\n" +" def do_goto(self, arg):\n" +" 'Move turtle to an absolute position with changing orientation. " +"GOTO 100 200'\n" +" goto(*parse(arg))\n" +" def do_home(self, arg):\n" +" 'Return turtle to the home position: HOME'\n" +" home()\n" +" def do_circle(self, arg):\n" +" 'Draw circle with given radius an options extent and steps: CIRCLE " +"50'\n" +" circle(*parse(arg))\n" +" def do_position(self, arg):\n" +" 'Print the current turtle position: POSITION'\n" +" print('Current position is %d %d\\n' % position())\n" +" def do_heading(self, arg):\n" +" 'Print the current turtle heading in degrees: HEADING'\n" +" print('Current heading is %d\\n' % (heading(),))\n" +" def do_color(self, arg):\n" +" 'Set the color: COLOR BLUE'\n" +" color(arg.lower())\n" +" def do_undo(self, arg):\n" +" 'Undo (repeatedly) the last turtle action(s): UNDO'\n" +" def do_reset(self, arg):\n" +" 'Clear the screen and return turtle to center: RESET'\n" +" reset()\n" +" def do_bye(self, arg):\n" +" 'Stop recording, close the turtle window, and exit: BYE'\n" +" print('Thank you for using Turtle')\n" +" self.close()\n" +" bye()\n" +" return True\n" +"\n" +" # ----- record and playback -----\n" +" def do_record(self, arg):\n" +" 'Save future commands to filename: RECORD rose.cmd'\n" +" self.file = open(arg, 'w')\n" +" def do_playback(self, arg):\n" +" 'Playback commands from a file: PLAYBACK rose.cmd'\n" +" self.close()\n" +" with open(arg) as f:\n" +" self.cmdqueue.extend(f.read().splitlines())\n" +" def precmd(self, line):\n" +" line = line.lower()\n" +" if self.file and 'playback' not in line:\n" +" print(line, file=self.file)\n" +" return line\n" +" def close(self):\n" +" if self.file:\n" +" self.file.close()\n" +" self.file = None\n" +"\n" +"def parse(arg):\n" +" 'Convert a series of zero or more numbers to an argument tuple'\n" +" return tuple(map(int, arg.split()))\n" +"\n" +"if __name__ == '__main__':\n" +" TurtleShell().cmdloop()" +msgstr "" + +#: library/cmd.rst:340 msgid "" "Here is a sample session with the turtle shell showing the help functions, " "using blank lines to repeat commands, and the simple record and playback " "facility:" msgstr "" -#: library/cmd.rst:64 +#: library/cmd.rst:343 +msgid "" +"Welcome to the turtle shell. Type help or ? to list commands.\n" +"\n" +"(turtle) ?\n" +"\n" +"Documented commands (type help ):\n" +"========================================\n" +"bye color goto home playback record right\n" +"circle forward heading left position reset undo\n" +"\n" +"(turtle) help forward\n" +"Move the turtle forward by the specified distance: FORWARD 10\n" +"(turtle) record spiral.cmd\n" +"(turtle) position\n" +"Current position is 0 0\n" +"\n" +"(turtle) heading\n" +"Current heading is 0\n" +"\n" +"(turtle) reset\n" +"(turtle) circle 20\n" +"(turtle) right 30\n" +"(turtle) circle 40\n" +"(turtle) right 30\n" +"(turtle) circle 60\n" +"(turtle) right 30\n" +"(turtle) circle 80\n" +"(turtle) right 30\n" +"(turtle) circle 100\n" +"(turtle) right 30\n" +"(turtle) circle 120\n" +"(turtle) right 30\n" +"(turtle) circle 120\n" +"(turtle) heading\n" +"Current heading is 180\n" +"\n" +"(turtle) forward 100\n" +"(turtle)\n" +"(turtle) right 90\n" +"(turtle) forward 100\n" +"(turtle)\n" +"(turtle) right 90\n" +"(turtle) forward 400\n" +"(turtle) right 90\n" +"(turtle) forward 500\n" +"(turtle) right 90\n" +"(turtle) forward 400\n" +"(turtle) right 90\n" +"(turtle) forward 300\n" +"(turtle) playback spiral.cmd\n" +"Current position is 0 0\n" +"\n" +"Current heading is 0\n" +"\n" +"Current heading is 180\n" +"\n" +"(turtle) bye\n" +"Thank you for using Turtle" +msgstr "" + +#: library/cmd.rst:74 msgid "? (question mark)" msgstr "" -#: library/cmd.rst:64 +#: library/cmd.rst:74 msgid "in a command interpreter" msgstr "" -#: library/cmd.rst:64 +#: library/cmd.rst:74 msgid "! (exclamation)" msgstr "" diff --git a/library/cmdline.po b/library/cmdline.po index 89a507c9..2a848fde 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -8,218 +8,239 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: library/cmdline.rst:3 -msgid "Modules command-line interface (CLI)" -msgstr "" - #: library/cmdline.rst:5 -msgid "The following modules have a command-line interface." -msgstr "" +msgid "Modules command-line interface (CLI)" +msgstr "Command-line interface (Διεπαφή Γραμμής Εντολών) (CLI) για modules" #: library/cmdline.rst:7 -msgid ":ref:`ast `" -msgstr "" - -#: library/cmdline.rst:8 -msgid ":ref:`asyncio `" -msgstr "" +msgid "The following modules have a command-line interface." +msgstr "Τα παρακάτω modules έχουν command-line interface." #: library/cmdline.rst:9 -msgid ":mod:`base64`" -msgstr "" +msgid ":ref:`ast `" +msgstr ":ref:`ast `" #: library/cmdline.rst:10 -msgid ":ref:`calendar `" -msgstr "" +msgid ":ref:`asyncio `" +msgstr ":ref:`asyncio `" #: library/cmdline.rst:11 -msgid ":mod:`code`" -msgstr "" +msgid ":mod:`base64`" +msgstr ":mod:`base64`" #: library/cmdline.rst:12 -msgid ":ref:`compileall `" -msgstr "" +msgid ":ref:`calendar `" +msgstr ":ref:`calendar `" #: library/cmdline.rst:13 -msgid ":mod:`cProfile`: see :ref:`profile `" -msgstr "" +msgid ":mod:`code`" +msgstr ":mod:`code`" #: library/cmdline.rst:14 -msgid ":ref:`difflib `" -msgstr "" +msgid ":ref:`compileall `" +msgstr ":ref:`compileall `" #: library/cmdline.rst:15 -msgid ":ref:`dis `" -msgstr "" +msgid ":mod:`cProfile`: see :ref:`profile `" +msgstr ":mod:`cProfile`: δες :ref:`profile `" #: library/cmdline.rst:16 -msgid ":mod:`doctest`" -msgstr "" +msgid ":ref:`dis `" +msgstr ":ref:`dis `" #: library/cmdline.rst:17 -msgid ":mod:`!encodings.rot_13`" -msgstr "" +msgid ":ref:`doctest `" +msgstr ":ref:`doctest `" #: library/cmdline.rst:18 -msgid ":mod:`ensurepip`" -msgstr "" +msgid ":mod:`!encodings.rot_13`" +msgstr ":mod:`!encodings.rot_13`" #: library/cmdline.rst:19 -msgid ":mod:`filecmp`" -msgstr "" +msgid ":ref:`ensurepip `" +msgstr ":ref:`ensurepip `" #: library/cmdline.rst:20 -msgid ":mod:`fileinput`" -msgstr "" +msgid ":mod:`filecmp`" +msgstr ":mod:`filecmp`" #: library/cmdline.rst:21 -msgid ":mod:`ftplib`" -msgstr "" +msgid ":mod:`fileinput`" +msgstr ":mod:`fileinput`" #: library/cmdline.rst:22 -msgid ":ref:`gzip `" -msgstr "" +msgid ":mod:`ftplib`" +msgstr ":mod:`ftplib`" #: library/cmdline.rst:23 -msgid ":ref:`http.server `" -msgstr "" +msgid ":ref:`gzip `" +msgstr ":ref:`gzip `" #: library/cmdline.rst:24 -msgid ":mod:`!idlelib`" -msgstr "" +msgid ":ref:`http.server `" +msgstr ":ref:`http.server `" #: library/cmdline.rst:25 -msgid ":ref:`inspect `" -msgstr "" +msgid ":ref:`idlelib `" +msgstr ":ref:`idlelib `" #: library/cmdline.rst:26 -msgid ":ref:`json.tool `" -msgstr "" +msgid ":ref:`inspect `" +msgstr ":ref:`inspect `" #: library/cmdline.rst:27 -msgid ":mod:`mimetypes`" -msgstr "" +msgid ":ref:`json `" +msgstr ":ref:`json `" #: library/cmdline.rst:28 -msgid ":mod:`pdb`" -msgstr "" +msgid ":ref:`mimetypes `" +msgstr ":ref:`mimetypes `" #: library/cmdline.rst:29 -msgid ":mod:`pickle`" -msgstr "" +msgid ":ref:`pdb `" +msgstr ":ref:`pdb `" #: library/cmdline.rst:30 -msgid ":ref:`pickletools `" -msgstr "" +msgid ":ref:`pickle `" +msgstr ":ref:`pickle `" #: library/cmdline.rst:31 -msgid ":mod:`platform`" -msgstr "" +msgid ":ref:`pickletools `" +msgstr ":ref:`pickletools `" #: library/cmdline.rst:32 -msgid ":mod:`poplib`" -msgstr "" +msgid ":ref:`platform `" +msgstr ":ref:`platform `" #: library/cmdline.rst:33 -msgid ":ref:`profile `" -msgstr "" +msgid ":mod:`poplib`" +msgstr ":mod:`poplib`" #: library/cmdline.rst:34 -msgid ":mod:`pstats`" -msgstr "" +msgid ":ref:`profile `" +msgstr ":ref:`profile `" #: library/cmdline.rst:35 -msgid ":ref:`py_compile `" -msgstr "" +msgid ":mod:`pstats`" +msgstr ":mod:`pstats`" #: library/cmdline.rst:36 -msgid ":mod:`pyclbr`" -msgstr "" +msgid ":ref:`py_compile `" +msgstr ":ref:`py_compile `" #: library/cmdline.rst:37 -msgid ":mod:`pydoc`" -msgstr "" +msgid ":mod:`pyclbr`" +msgstr ":mod:`pyclbr`" #: library/cmdline.rst:38 -msgid ":mod:`quopri`" -msgstr "" +msgid ":mod:`pydoc`" +msgstr ":mod:`pydoc`" #: library/cmdline.rst:39 -msgid ":mod:`runpy`" -msgstr "" +msgid ":mod:`quopri`" +msgstr ":mod:`quopri`" #: library/cmdline.rst:40 -msgid ":ref:`site `" -msgstr "" +msgid ":ref:`random `" +msgstr ":ref:`random `" #: library/cmdline.rst:41 -msgid ":ref:`sqlite3 `" -msgstr "" +msgid ":mod:`runpy`" +msgstr ":mod:`runpy`" #: library/cmdline.rst:42 -msgid ":ref:`sysconfig `" -msgstr "" +msgid ":ref:`site `" +msgstr ":ref:`site `" #: library/cmdline.rst:43 -msgid ":mod:`tabnanny`" -msgstr "" +msgid ":ref:`sqlite3 `" +msgstr ":ref:`sqlite3 `" #: library/cmdline.rst:44 -msgid ":ref:`tarfile `" -msgstr "" +msgid ":ref:`symtable `" +msgstr ":ref:`symtable `" #: library/cmdline.rst:45 -msgid ":mod:`!this`" -msgstr "" +msgid ":ref:`sysconfig `" +msgstr ":ref:`sysconfig `" #: library/cmdline.rst:46 -msgid ":ref:`timeit `" -msgstr "" +msgid ":mod:`tabnanny`" +msgstr ":mod:`tabnanny`" #: library/cmdline.rst:47 -msgid ":ref:`tokenize `" -msgstr "" +msgid ":ref:`tarfile `" +msgstr ":ref:`tarfile `" #: library/cmdline.rst:48 -msgid ":ref:`trace `" -msgstr "" +msgid ":mod:`!this`" +msgstr ":mod:`!this`" #: library/cmdline.rst:49 -msgid ":mod:`turtledemo`" -msgstr "" +msgid ":ref:`timeit `" +msgstr ":ref:`timeit `" #: library/cmdline.rst:50 -msgid ":ref:`unittest `" -msgstr "" +msgid ":ref:`tokenize `" +msgstr ":ref:`tokenize `" #: library/cmdline.rst:51 -msgid ":ref:`uuid `" -msgstr "" +msgid ":ref:`trace `" +msgstr ":ref:`trace `" #: library/cmdline.rst:52 -msgid ":mod:`venv`" -msgstr "" +msgid ":mod:`turtledemo`" +msgstr ":mod:`turtledemo`" #: library/cmdline.rst:53 -msgid ":mod:`webbrowser`" -msgstr "" +msgid ":ref:`unittest `" +msgstr ":ref:`unittest `" #: library/cmdline.rst:54 -msgid ":ref:`zipapp `" -msgstr "" +msgid ":ref:`uuid `" +msgstr ":ref:`uuid `" #: library/cmdline.rst:55 -msgid ":ref:`zipfile `" -msgstr "" +msgid ":ref:`venv `" +msgstr ":ref:`venv `" + +#: library/cmdline.rst:56 +msgid ":ref:`webbrowser `" +msgstr ":ref:`webbrowser `" #: library/cmdline.rst:57 +msgid ":ref:`zipapp `" +msgstr ":ref:`zipapp `" + +#: library/cmdline.rst:58 +msgid ":ref:`zipfile `" +msgstr ":ref:`zipfile `" + +#: library/cmdline.rst:60 msgid "See also the :ref:`Python command-line interface `." msgstr "" +"Δείτε επίσης το :ref:`Python command-line interface `." + +#~ msgid ":mod:`ensurepip`" +#~ msgstr ":mod:`ensurepip`" + +#~ msgid ":mod:`!idlelib`" +#~ msgstr ":mod:`!idlelib`" + +#~ msgid ":mod:`pdb`" +#~ msgstr ":mod:`pdb`" + +#~ msgid ":mod:`venv`" +#~ msgstr ":mod:`venv`" + +#~ msgid ":mod:`webbrowser`" +#~ msgstr ":mod:`webbrowser`" diff --git a/library/cmdlinelibs.po b/library/cmdlinelibs.po new file mode 100644 index 00000000..8823c9b1 --- /dev/null +++ b/library/cmdlinelibs.po @@ -0,0 +1,32 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/cmdlinelibs.rst:5 +msgid "Command-line interface libraries" +msgstr "" + +#: library/cmdlinelibs.rst:7 +msgid "" +"The modules described in this chapter assist with implementing command line " +"and terminal interfaces for applications." +msgstr "" + +#: library/cmdlinelibs.rst:10 +msgid "Here's an overview:" +msgstr "" diff --git a/library/code.po b/library/code.po index 336b3306..b8a7f41d 100644 --- a/library/code.po +++ b/library/code.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/code.rst:2 -msgid ":mod:`code` --- Interpreter base classes" +msgid ":mod:`!code` --- Interpreter base classes" msgstr "" #: library/code.rst:7 @@ -36,35 +37,50 @@ msgid "" "This class deals with parsing and interpreter state (the user's namespace); " "it does not deal with input buffering or prompting or input file naming (the " "filename is always passed in explicitly). The optional *locals* argument " -"specifies the dictionary in which code will be executed; it defaults to a " -"newly created dictionary with key ``'__name__'`` set to ``'__console__'`` " -"and key ``'__doc__'`` set to ``None``." +"specifies a mapping to use as the namespace in which code will be executed; " +"it defaults to a newly created dictionary with key ``'__name__'`` set to " +"``'__console__'`` and key ``'__doc__'`` set to ``None``." msgstr "" -#: library/code.rst:28 +#: library/code.rst:25 +msgid "" +"Note that functions and classes objects created under an :class:`!" +"InteractiveInterpreter` instance will belong to the namespace specified by " +"*locals*. They are only pickleable if *locals* is the namespace of an " +"existing module." +msgstr "" + +#: library/code.rst:34 msgid "" "Closely emulate the behavior of the interactive Python interpreter. This " "class builds on :class:`InteractiveInterpreter` and adds prompting using the " -"familiar ``sys.ps1`` and ``sys.ps2``, and input buffering." +"familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " +"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:" +"`SystemExit`, but instead return to the calling code." +msgstr "" + +#: library/code.rst:58 +msgid "Added *local_exit* parameter." msgstr "" -#: library/code.rst:35 +#: library/code.rst:45 msgid "" "Convenience function to run a read-eval-print loop. This creates a new " "instance of :class:`InteractiveConsole` and sets *readfunc* to be used as " "the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " "provided, it is passed to the :class:`InteractiveConsole` constructor for " -"use as the default namespace for the interpreter loop. The :meth:`interact` " -"method of the instance is then run with *banner* and *exitmsg* passed as the " -"banner and exit message to use, if provided. The console object is " -"discarded after use." +"use as the default namespace for the interpreter loop. If *local_exit* is " +"provided, it is passed to the :class:`InteractiveConsole` constructor. The :" +"meth:`~InteractiveConsole.interact` method of the instance is then run with " +"*banner* and *exitmsg* passed as the banner and exit message to use, if " +"provided. The console object is discarded after use." msgstr "" -#: library/code.rst:44 +#: library/code.rst:55 msgid "Added *exitmsg* parameter." msgstr "" -#: library/code.rst:50 +#: library/code.rst:63 msgid "" "This function is useful for programs that want to emulate Python's " "interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is " @@ -74,7 +90,7 @@ msgid "" "real interpreter main loop." msgstr "" -#: library/code.rst:57 +#: library/code.rst:70 msgid "" "*source* is the source string; *filename* is the optional filename from " "which source was read, defaulting to ``''``; and *symbol* is the " @@ -82,7 +98,7 @@ msgid "" "``'eval'`` or ``'exec'``." msgstr "" -#: library/code.rst:62 +#: library/code.rst:75 msgid "" "Returns a code object (the same as ``compile(source, filename, symbol)``) if " "the command is complete and valid; ``None`` if the command is incomplete; " @@ -91,18 +107,18 @@ msgid "" "contains an invalid literal." msgstr "" -#: library/code.rst:72 +#: library/code.rst:85 msgid "Interactive Interpreter Objects" msgstr "" -#: library/code.rst:77 +#: library/code.rst:90 msgid "" "Compile and run some source in the interpreter. Arguments are the same as " "for :func:`compile_command`; the default for *filename* is ``''``, " "and for *symbol* is ``'single'``. One of several things can happen:" msgstr "" -#: library/code.rst:81 +#: library/code.rst:94 msgid "" "The input is incorrect; :func:`compile_command` raised an exception (:exc:" "`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed " @@ -110,13 +126,13 @@ msgid "" "``False``." msgstr "" -#: library/code.rst:86 +#: library/code.rst:99 msgid "" "The input is incomplete, and more input is required; :func:`compile_command` " "returned ``None``. :meth:`runsource` returns ``True``." msgstr "" -#: library/code.rst:89 +#: library/code.rst:102 msgid "" "The input is complete; :func:`compile_command` returned a code object. The " "code is executed by calling the :meth:`runcode` (which also handles run-time " @@ -124,27 +140,27 @@ msgid "" "``False``." msgstr "" -#: library/code.rst:93 +#: library/code.rst:106 msgid "" "The return value can be used to decide whether to use ``sys.ps1`` or ``sys." "ps2`` to prompt the next line." msgstr "" -#: library/code.rst:99 +#: library/code.rst:112 msgid "" "Execute a code object. When an exception occurs, :meth:`showtraceback` is " "called to display a traceback. All exceptions are caught except :exc:" "`SystemExit`, which is allowed to propagate." msgstr "" -#: library/code.rst:103 +#: library/code.rst:116 msgid "" "A note about :exc:`KeyboardInterrupt`: this exception may occur elsewhere in " "this code, and may not always be caught. The caller should be prepared to " "deal with it." msgstr "" -#: library/code.rst:110 +#: library/code.rst:123 msgid "" "Display the syntax error that just occurred. This does not display a stack " "trace because there isn't one for syntax errors. If *filename* is given, it " @@ -153,38 +169,38 @@ msgid "" "string. The output is written by the :meth:`write` method." msgstr "" -#: library/code.rst:119 +#: library/code.rst:132 msgid "" "Display the exception that just occurred. We remove the first stack item " "because it is within the interpreter object implementation. The output is " "written by the :meth:`write` method." msgstr "" -#: library/code.rst:123 +#: library/code.rst:136 msgid "" "The full chained traceback is displayed instead of just the primary " "traceback." msgstr "" -#: library/code.rst:129 +#: library/code.rst:142 msgid "" "Write a string to the standard error stream (``sys.stderr``). Derived " "classes should override this to provide the appropriate output handling as " "needed." msgstr "" -#: library/code.rst:136 +#: library/code.rst:149 msgid "Interactive Console Objects" msgstr "" -#: library/code.rst:138 +#: library/code.rst:151 msgid "" "The :class:`InteractiveConsole` class is a subclass of :class:" "`InteractiveInterpreter`, and so offers all the methods of the interpreter " "objects as well as the following additions." msgstr "" -#: library/code.rst:145 +#: library/code.rst:158 msgid "" "Closely emulate the interactive Python console. The optional *banner* " "argument specify the banner to print before the first interaction; by " @@ -194,22 +210,22 @@ msgid "" "close!)." msgstr "" -#: library/code.rst:151 +#: library/code.rst:164 msgid "" "The optional *exitmsg* argument specifies an exit message printed when " "exiting. Pass the empty string to suppress the exit message. If *exitmsg* is " "not given or ``None``, a default message is printed." msgstr "" -#: library/code.rst:155 +#: library/code.rst:168 msgid "To suppress printing any banner, pass an empty string." msgstr "" -#: library/code.rst:158 +#: library/code.rst:171 msgid "Print an exit message when exiting." msgstr "" -#: library/code.rst:164 +#: library/code.rst:177 msgid "" "Push a line of source text to the interpreter. The line should not have a " "trailing newline; it may have internal newlines. The line is appended to a " @@ -222,11 +238,11 @@ msgid "" "same as :meth:`!runsource`)." msgstr "" -#: library/code.rst:176 +#: library/code.rst:189 msgid "Remove any unhandled source text from the input buffer." msgstr "" -#: library/code.rst:181 +#: library/code.rst:194 msgid "" "Write a prompt and read a line. The returned line does not include the " "trailing newline. When the user enters the EOF key sequence, :exc:" diff --git a/library/codecs.po b/library/codecs.po index 1bbda107..20b915f8 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/codecs.rst:2 -msgid ":mod:`codecs` --- Codec registry and base classes" +msgid ":mod:`!codecs` --- Codec registry and base classes" msgstr "" #: library/codecs.rst:11 @@ -69,17 +70,26 @@ msgid "" "information on codec error handling." msgstr "" -#: library/codecs.rst:56 +#: library/codecs.rst:58 +msgid "" +"Return a mapping suitable for encoding with a custom single-byte encoding. " +"Given a :class:`str` *string* of up to 256 characters representing a " +"decoding table, returns either a compact internal mapping object " +"``EncodingMap`` or a :class:`dictionary ` mapping character ordinals " +"to byte values. Raises a :exc:`TypeError` on invalid input." +msgstr "" + +#: library/codecs.rst:64 msgid "The full details for each codec can also be looked up directly:" msgstr "" -#: library/codecs.rst:60 +#: library/codecs.rst:68 msgid "" "Looks up the codec info in the Python codec registry and returns a :class:" "`CodecInfo` object as defined below." msgstr "" -#: library/codecs.rst:63 +#: library/codecs.rst:71 msgid "" "Encodings are first looked up in the registry's cache. If not found, the " "list of registered search functions is scanned. If no :class:`CodecInfo` " @@ -87,17 +97,17 @@ msgid "" "`CodecInfo` object is stored in the cache and returned to the caller." msgstr "" -#: library/codecs.rst:70 +#: library/codecs.rst:78 msgid "" "Codec details when looking up the codec registry. The constructor arguments " "are stored in attributes of the same name:" msgstr "" -#: library/codecs.rst:76 +#: library/codecs.rst:84 msgid "The name of the encoding." msgstr "" -#: library/codecs.rst:82 +#: library/codecs.rst:90 msgid "" "The stateless encoding and decoding functions. These must be functions or " "methods which have the same interface as the :meth:`~Codec.encode` and :meth:" @@ -106,7 +116,7 @@ msgid "" "mode." msgstr "" -#: library/codecs.rst:92 +#: library/codecs.rst:100 msgid "" "Incremental encoder and decoder classes or factory functions. These have to " "provide the interface defined by the base classes :class:" @@ -114,76 +124,76 @@ msgid "" "Incremental codecs can maintain state." msgstr "" -#: library/codecs.rst:101 +#: library/codecs.rst:109 msgid "" "Stream writer and reader classes or factory functions. These have to provide " "the interface defined by the base classes :class:`StreamWriter` and :class:" "`StreamReader`, respectively. Stream codecs can maintain state." msgstr "" -#: library/codecs.rst:106 +#: library/codecs.rst:114 msgid "" "To simplify access to the various codec components, the module provides " "these additional functions which use :func:`lookup` for the codec lookup:" msgstr "" -#: library/codecs.rst:111 +#: library/codecs.rst:119 msgid "" "Look up the codec for the given encoding and return its encoder function." msgstr "" -#: library/codecs.rst:120 library/codecs.rst:154 +#: library/codecs.rst:128 library/codecs.rst:162 msgid "Raises a :exc:`LookupError` in case the encoding cannot be found." msgstr "" -#: library/codecs.rst:118 +#: library/codecs.rst:126 msgid "" "Look up the codec for the given encoding and return its decoder function." msgstr "" -#: library/codecs.rst:125 +#: library/codecs.rst:133 msgid "" "Look up the codec for the given encoding and return its incremental encoder " "class or factory function." msgstr "" -#: library/codecs.rst:128 +#: library/codecs.rst:136 msgid "" "Raises a :exc:`LookupError` in case the encoding cannot be found or the " "codec doesn't support an incremental encoder." msgstr "" -#: library/codecs.rst:134 +#: library/codecs.rst:142 msgid "" "Look up the codec for the given encoding and return its incremental decoder " "class or factory function." msgstr "" -#: library/codecs.rst:137 +#: library/codecs.rst:145 msgid "" "Raises a :exc:`LookupError` in case the encoding cannot be found or the " "codec doesn't support an incremental decoder." msgstr "" -#: library/codecs.rst:143 +#: library/codecs.rst:151 msgid "" "Look up the codec for the given encoding and return its :class:" "`StreamReader` class or factory function." msgstr "" -#: library/codecs.rst:151 +#: library/codecs.rst:159 msgid "" "Look up the codec for the given encoding and return its :class:" "`StreamWriter` class or factory function." msgstr "" -#: library/codecs.rst:156 +#: library/codecs.rst:164 msgid "" "Custom codecs are made available by registering a suitable codec search " "function:" msgstr "" -#: library/codecs.rst:161 +#: library/codecs.rst:169 msgid "" "Register a codec search function. Search functions are expected to take one " "argument, being the encoding name in all lower case letters with hyphens and " @@ -192,17 +202,17 @@ msgid "" "``None``." msgstr "" -#: library/codecs.rst:167 +#: library/codecs.rst:175 msgid "Hyphens and spaces are converted to underscore." msgstr "" -#: library/codecs.rst:173 +#: library/codecs.rst:181 msgid "" "Unregister a codec search function and clear the registry's cache. If the " "search function is not registered, do nothing." msgstr "" -#: library/codecs.rst:179 +#: library/codecs.rst:187 msgid "" "While the builtin :func:`open` and the associated :mod:`io` module are the " "recommended approach for working with encoded text files, this module " @@ -210,14 +220,14 @@ msgid "" "wider range of codecs when working with binary files:" msgstr "" -#: library/codecs.rst:186 +#: library/codecs.rst:194 msgid "" "Open an encoded file using the given *mode* and return an instance of :class:" "`StreamReaderWriter`, providing transparent encoding/decoding. The default " "file mode is ``'r'``, meaning to open the file in read mode." msgstr "" -#: library/codecs.rst:192 +#: library/codecs.rst:200 msgid "" "If *encoding* is not ``None``, then the underlying encoded files are always " "opened in binary mode. No automatic conversion of ``'\\n'`` is done on " @@ -225,38 +235,42 @@ msgid "" "to the built-in :func:`open` function; the ``'b'`` is automatically added." msgstr "" -#: library/codecs.rst:198 +#: library/codecs.rst:206 msgid "" "*encoding* specifies the encoding which is to be used for the file. Any " "encoding that encodes to and decodes from bytes is allowed, and the data " "types supported by the file methods depend on the codec used." msgstr "" -#: library/codecs.rst:202 +#: library/codecs.rst:210 msgid "" "*errors* may be given to define the error handling. It defaults to " "``'strict'`` which causes a :exc:`ValueError` to be raised in case an " "encoding error occurs." msgstr "" -#: library/codecs.rst:205 +#: library/codecs.rst:213 msgid "" "*buffering* has the same meaning as for the built-in :func:`open` function. " "It defaults to -1 which means that the default buffer size will be used." msgstr "" -#: library/codecs.rst:208 +#: library/codecs.rst:216 msgid "The ``'U'`` mode has been removed." msgstr "" -#: library/codecs.rst:214 +#: library/codecs.rst:221 +msgid ":func:`codecs.open` has been superseded by :func:`open`." +msgstr "" + +#: library/codecs.rst:226 msgid "" "Return a :class:`StreamRecoder` instance, a wrapped version of *file* which " "provides transparent transcoding. The original file is closed when the " "wrapped version is closed." msgstr "" -#: library/codecs.rst:218 +#: library/codecs.rst:230 msgid "" "Data written to the wrapped file is decoded according to the given " "*data_encoding* and then written to the original file as bytes using " @@ -264,41 +278,41 @@ msgid "" "*file_encoding*, and the result is encoded using *data_encoding*." msgstr "" -#: library/codecs.rst:224 +#: library/codecs.rst:236 msgid "If *file_encoding* is not given, it defaults to *data_encoding*." msgstr "" -#: library/codecs.rst:226 +#: library/codecs.rst:238 msgid "" "*errors* may be given to define the error handling. It defaults to " "``'strict'``, which causes :exc:`ValueError` to be raised in case an " "encoding error occurs." msgstr "" -#: library/codecs.rst:233 +#: library/codecs.rst:245 msgid "" "Uses an incremental encoder to iteratively encode the input provided by " -"*iterator*. This function is a :term:`generator`. The *errors* argument (as " -"well as any other keyword argument) is passed through to the incremental " -"encoder." +"*iterator*. *iterator* must yield :class:`str` objects. This function is a :" +"term:`generator`. The *errors* argument (as well as any other keyword " +"argument) is passed through to the incremental encoder." msgstr "" -#: library/codecs.rst:238 +#: library/codecs.rst:250 msgid "" "This function requires that the codec accept text :class:`str` objects to " "encode. Therefore it does not support bytes-to-bytes encoders such as " "``base64_codec``." msgstr "" -#: library/codecs.rst:245 +#: library/codecs.rst:257 msgid "" "Uses an incremental decoder to iteratively decode the input provided by " -"*iterator*. This function is a :term:`generator`. The *errors* argument (as " -"well as any other keyword argument) is passed through to the incremental " -"decoder." +"*iterator*. *iterator* must yield :class:`bytes` objects. This function is " +"a :term:`generator`. The *errors* argument (as well as any other keyword " +"argument) is passed through to the incremental decoder." msgstr "" -#: library/codecs.rst:250 +#: library/codecs.rst:262 msgid "" "This function requires that the codec accept :class:`bytes` objects to " "decode. Therefore it does not support text-to-text encoders such as " @@ -306,13 +320,30 @@ msgid "" "`iterencode`." msgstr "" -#: library/codecs.rst:256 +#: library/codecs.rst:270 +msgid "" +"Return a :class:`tuple` containing the raw bytes of *buffer*, a :ref:`buffer-" +"compatible object ` or :class:`str` (encoded to UTF-8 before " +"processing), and their length in bytes." +msgstr "" + +#: library/codecs.rst:274 +msgid "The *errors* argument is ignored." +msgstr "" + +#: library/codecs.rst:276 +msgid "" +">>> codecs.readbuffer_encode(b\"Zito\")\n" +"(b'Zito', 4)" +msgstr "" + +#: library/codecs.rst:282 msgid "" "The module also provides the following constants which are useful for " "reading and writing to platform dependent files:" msgstr "" -#: library/codecs.rst:271 +#: library/codecs.rst:297 msgid "" "These constants define various byte sequences, being Unicode byte order " "marks (BOMs) for several encodings. They are used in UTF-16 and UTF-32 data " @@ -324,18 +355,18 @@ msgid "" "represent the BOM in UTF-8 and UTF-32 encodings." msgstr "" -#: library/codecs.rst:285 +#: library/codecs.rst:311 msgid "Codec Base Classes" msgstr "" -#: library/codecs.rst:287 +#: library/codecs.rst:313 msgid "" "The :mod:`codecs` module defines a set of base classes which define the " "interfaces for working with codec objects, and can also be used as the basis " "for custom codec implementations." msgstr "" -#: library/codecs.rst:291 +#: library/codecs.rst:317 msgid "" "Each codec has to define four interfaces to make it usable as codec in " "Python: stateless encoder, stateless decoder, stream reader and stream " @@ -344,66 +375,66 @@ msgid "" "how the codec will handle encoding and decoding errors." msgstr "" -#: library/codecs.rst:302 +#: library/codecs.rst:328 msgid "Error Handlers" msgstr "" -#: library/codecs.rst:304 +#: library/codecs.rst:330 msgid "" "To simplify and standardize error handling, codecs may implement different " "error handling schemes by accepting the *errors* string argument:" msgstr "" -#: library/codecs.rst:324 +#: library/codecs.rst:350 msgid "" "The following error handlers can be used with all Python :ref:`standard-" "encodings` codecs:" msgstr "" -#: library/codecs.rst:373 library/codecs.rst:393 +#: library/codecs.rst:399 library/codecs.rst:419 msgid "Value" msgstr "" -#: library/codecs.rst:373 library/codecs.rst:1330 library/codecs.rst:1455 +#: library/codecs.rst:399 library/codecs.rst:1376 library/codecs.rst:1533 msgid "Meaning" msgstr "" -#: library/codecs.rst:332 +#: library/codecs.rst:358 msgid "``'strict'``" msgstr "" -#: library/codecs.rst:332 +#: library/codecs.rst:358 msgid "" "Raise :exc:`UnicodeError` (or a subclass), this is the default. Implemented " "in :func:`strict_errors`." msgstr "" -#: library/codecs.rst:336 +#: library/codecs.rst:362 msgid "``'ignore'``" msgstr "" -#: library/codecs.rst:336 +#: library/codecs.rst:362 msgid "" "Ignore the malformed data and continue without further notice. Implemented " "in :func:`ignore_errors`." msgstr "" -#: library/codecs.rst:340 +#: library/codecs.rst:366 msgid "``'replace'``" msgstr "" -#: library/codecs.rst:340 +#: library/codecs.rst:366 msgid "" "Replace with a replacement marker. On encoding, use ``?`` (ASCII character). " "On decoding, use ``�`` (U+FFFD, the official REPLACEMENT CHARACTER). " "Implemented in :func:`replace_errors`." msgstr "" -#: library/codecs.rst:346 +#: library/codecs.rst:372 msgid "``'backslashreplace'``" msgstr "" -#: library/codecs.rst:346 +#: library/codecs.rst:372 msgid "" "Replace with backslashed escape sequences. On encoding, use hexadecimal form " "of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}` :" @@ -411,11 +442,11 @@ msgid "" "format :samp:`\\\\x{hh}`. Implemented in :func:`backslashreplace_errors`." msgstr "" -#: library/codecs.rst:355 +#: library/codecs.rst:381 msgid "``'surrogateescape'``" msgstr "" -#: library/codecs.rst:355 +#: library/codecs.rst:381 msgid "" "On decoding, replace byte with individual surrogate code ranging from " "``U+DC80`` to ``U+DCFF``. This code will then be turned back into the same " @@ -423,92 +454,92 @@ msgid "" "data. (See :pep:`383` for more.)" msgstr "" -#: library/codecs.rst:369 +#: library/codecs.rst:395 msgid "" "The following error handlers are only applicable to encoding (within :term:" "`text encodings `):" msgstr "" -#: library/codecs.rst:375 +#: library/codecs.rst:401 msgid "``'xmlcharrefreplace'``" msgstr "" -#: library/codecs.rst:375 +#: library/codecs.rst:401 msgid "" "Replace with XML/HTML numeric character reference, which is a decimal form " "of Unicode code point with format :samp:`&#{num};`. Implemented in :func:" "`xmlcharrefreplace_errors`." msgstr "" -#: library/codecs.rst:381 +#: library/codecs.rst:407 msgid "``'namereplace'``" msgstr "" -#: library/codecs.rst:381 +#: library/codecs.rst:407 msgid "" "Replace with ``\\N{...}`` escape sequences, what appears in the braces is " "the Name property from Unicode Character Database. Implemented in :func:" "`namereplace_errors`." msgstr "" -#: library/codecs.rst:390 +#: library/codecs.rst:416 msgid "" "In addition, the following error handler is specific to the given codecs:" msgstr "" -#: library/codecs.rst:393 +#: library/codecs.rst:419 msgid "Codecs" msgstr "" -#: library/codecs.rst:395 +#: library/codecs.rst:421 msgid "``'surrogatepass'``" msgstr "" -#: library/codecs.rst:395 +#: library/codecs.rst:421 msgid "utf-8, utf-16, utf-32, utf-16-be, utf-16-le, utf-32-be, utf-32-le" msgstr "" -#: library/codecs.rst:395 +#: library/codecs.rst:421 msgid "" "Allow encoding and decoding surrogate code point (``U+D800`` - ``U+DFFF``) " "as normal code point. Otherwise these codecs treat the presence of surrogate " "code point in :class:`str` as an error." msgstr "" -#: library/codecs.rst:402 +#: library/codecs.rst:428 msgid "The ``'surrogateescape'`` and ``'surrogatepass'`` error handlers." msgstr "" -#: library/codecs.rst:405 +#: library/codecs.rst:431 msgid "" "The ``'surrogatepass'`` error handler now works with utf-16\\* and utf-32\\* " "codecs." msgstr "" -#: library/codecs.rst:409 +#: library/codecs.rst:435 msgid "The ``'namereplace'`` error handler." msgstr "" -#: library/codecs.rst:412 +#: library/codecs.rst:438 msgid "" "The ``'backslashreplace'`` error handler now works with decoding and " "translating." msgstr "" -#: library/codecs.rst:416 +#: library/codecs.rst:442 msgid "" "The set of allowed values can be extended by registering a new named error " "handler:" msgstr "" -#: library/codecs.rst:421 +#: library/codecs.rst:447 msgid "" "Register the error handling function *error_handler* under the name *name*. " "The *error_handler* argument will be called during encoding and decoding in " "case of an error, when *name* is specified as the errors parameter." msgstr "" -#: library/codecs.rst:425 +#: library/codecs.rst:451 msgid "" "For encoding, *error_handler* will be called with a :exc:" "`UnicodeEncodeError` instance, which contains information about the location " @@ -523,66 +554,66 @@ msgid "" "position is out of bound an :exc:`IndexError` will be raised." msgstr "" -#: library/codecs.rst:437 +#: library/codecs.rst:463 msgid "" "Decoding and translating works similarly, except :exc:`UnicodeDecodeError` " "or :exc:`UnicodeTranslateError` will be passed to the handler and that the " "replacement from the error handler will be put into the output directly." msgstr "" -#: library/codecs.rst:442 +#: library/codecs.rst:468 msgid "" "Previously registered error handlers (including the standard error handlers) " "can be looked up by name:" msgstr "" -#: library/codecs.rst:447 +#: library/codecs.rst:473 msgid "Return the error handler previously registered under the name *name*." msgstr "" -#: library/codecs.rst:449 +#: library/codecs.rst:475 msgid "Raises a :exc:`LookupError` in case the handler cannot be found." msgstr "" -#: library/codecs.rst:451 +#: library/codecs.rst:477 msgid "" "The following standard error handlers are also made available as module " "level functions:" msgstr "" -#: library/codecs.rst:456 +#: library/codecs.rst:482 msgid "Implements the ``'strict'`` error handling." msgstr "" -#: library/codecs.rst:458 +#: library/codecs.rst:484 msgid "Each encoding or decoding error raises a :exc:`UnicodeError`." msgstr "" -#: library/codecs.rst:463 +#: library/codecs.rst:489 msgid "Implements the ``'ignore'`` error handling." msgstr "" -#: library/codecs.rst:465 +#: library/codecs.rst:491 msgid "" "Malformed data is ignored; encoding or decoding is continued without further " "notice." msgstr "" -#: library/codecs.rst:471 +#: library/codecs.rst:497 msgid "Implements the ``'replace'`` error handling." msgstr "" -#: library/codecs.rst:473 +#: library/codecs.rst:499 msgid "" "Substitutes ``?`` (ASCII character) for encoding errors or ``�`` (U+FFFD, " "the official REPLACEMENT CHARACTER) for decoding errors." msgstr "" -#: library/codecs.rst:479 +#: library/codecs.rst:505 msgid "Implements the ``'backslashreplace'`` error handling." msgstr "" -#: library/codecs.rst:481 +#: library/codecs.rst:507 msgid "" "Malformed data is replaced by a backslashed escape sequence. On encoding, " "use the hexadecimal form of Unicode code point with formats :samp:`\\\\x{hh}" @@ -590,30 +621,30 @@ msgid "" "hexadecimal form of byte value with format :samp:`\\\\x{hh}`." msgstr "" -#: library/codecs.rst:487 +#: library/codecs.rst:513 msgid "Works with decoding and translating." msgstr "" -#: library/codecs.rst:493 +#: library/codecs.rst:519 msgid "" "Implements the ``'xmlcharrefreplace'`` error handling (for encoding within :" "term:`text encoding` only)." msgstr "" -#: library/codecs.rst:496 +#: library/codecs.rst:522 msgid "" "The unencodable character is replaced by an appropriate XML/HTML numeric " "character reference, which is a decimal form of Unicode code point with " "format :samp:`&#{num};` ." msgstr "" -#: library/codecs.rst:503 +#: library/codecs.rst:529 msgid "" "Implements the ``'namereplace'`` error handling (for encoding within :term:" "`text encoding` only)." msgstr "" -#: library/codecs.rst:506 +#: library/codecs.rst:532 msgid "" "The unencodable character is replaced by a ``\\N{...}`` escape sequence. The " "set of characters that appear in the braces is the Name property from " @@ -621,17 +652,17 @@ msgid "" "will be converted to byte sequence ``\\N{LATIN SMALL LETTER SHARP S}`` ." msgstr "" -#: library/codecs.rst:517 +#: library/codecs.rst:543 msgid "Stateless Encoding and Decoding" msgstr "" -#: library/codecs.rst:519 +#: library/codecs.rst:545 msgid "" "The base :class:`Codec` class defines these methods which also define the " "function interfaces of the stateless encoder and decoder:" msgstr "" -#: library/codecs.rst:527 +#: library/codecs.rst:553 msgid "" "Encodes the object *input* and returns a tuple (output object, length " "consumed). For instance, :term:`text encoding` converts a string object to a " @@ -639,26 +670,26 @@ msgid "" "``iso-8859-1``)." msgstr "" -#: library/codecs.rst:554 +#: library/codecs.rst:580 msgid "" "The *errors* argument defines the error handling to apply. It defaults to " "``'strict'`` handling." msgstr "" -#: library/codecs.rst:535 +#: library/codecs.rst:561 msgid "" "The method may not store state in the :class:`Codec` instance. Use :class:" "`StreamWriter` for codecs which have to keep state in order to make encoding " "efficient." msgstr "" -#: library/codecs.rst:539 +#: library/codecs.rst:565 msgid "" "The encoder must be able to handle zero length input and return an empty " "object of the output object type in this situation." msgstr "" -#: library/codecs.rst:545 +#: library/codecs.rst:571 msgid "" "Decodes the object *input* and returns a tuple (output object, length " "consumed). For instance, for a :term:`text encoding`, decoding converts a " @@ -666,31 +697,31 @@ msgid "" "object." msgstr "" -#: library/codecs.rst:550 +#: library/codecs.rst:576 msgid "" "For text encodings and bytes-to-bytes codecs, *input* must be a bytes object " "or one which provides the read-only buffer interface -- for example, buffer " "objects and memory mapped files." msgstr "" -#: library/codecs.rst:557 +#: library/codecs.rst:583 msgid "" "The method may not store state in the :class:`Codec` instance. Use :class:" "`StreamReader` for codecs which have to keep state in order to make decoding " "efficient." msgstr "" -#: library/codecs.rst:561 +#: library/codecs.rst:587 msgid "" "The decoder must be able to handle zero length input and return an empty " "object of the output object type in this situation." msgstr "" -#: library/codecs.rst:566 +#: library/codecs.rst:592 msgid "Incremental Encoding and Decoding" msgstr "" -#: library/codecs.rst:568 +#: library/codecs.rst:594 msgid "" "The :class:`IncrementalEncoder` and :class:`IncrementalDecoder` classes " "provide the basic interface for incremental encoding and decoding. Encoding/" @@ -701,7 +732,7 @@ msgid "" "during method calls." msgstr "" -#: library/codecs.rst:576 +#: library/codecs.rst:602 msgid "" "The joined output of calls to the :meth:`~IncrementalEncoder.encode`/:meth:" "`~IncrementalDecoder.decode` method is the same as if all the single inputs " @@ -709,36 +740,36 @@ msgid "" "encoder/decoder." msgstr "" -#: library/codecs.rst:585 +#: library/codecs.rst:611 msgid "IncrementalEncoder Objects" msgstr "" -#: library/codecs.rst:587 +#: library/codecs.rst:613 msgid "" "The :class:`IncrementalEncoder` class is used for encoding an input in " "multiple steps. It defines the following methods which every incremental " "encoder must define in order to be compatible with the Python codec registry." msgstr "" -#: library/codecs.rst:594 +#: library/codecs.rst:620 msgid "Constructor for an :class:`IncrementalEncoder` instance." msgstr "" -#: library/codecs.rst:596 +#: library/codecs.rst:622 msgid "" "All incremental encoders must provide this constructor interface. They are " "free to add additional keyword arguments, but only the ones defined here are " "used by the Python codec registry." msgstr "" -#: library/codecs.rst:600 +#: library/codecs.rst:626 msgid "" "The :class:`IncrementalEncoder` may implement different error handling " "schemes by providing the *errors* keyword argument. See :ref:`error-" "handlers` for possible values." msgstr "" -#: library/codecs.rst:604 +#: library/codecs.rst:630 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -746,21 +777,21 @@ msgid "" "`IncrementalEncoder` object." msgstr "" -#: library/codecs.rst:612 +#: library/codecs.rst:638 msgid "" "Encodes *object* (taking the current state of the encoder into account) and " "returns the resulting encoded object. If this is the last call to :meth:" "`encode` *final* must be true (the default is false)." msgstr "" -#: library/codecs.rst:619 +#: library/codecs.rst:645 msgid "" "Reset the encoder to the initial state. The output is discarded: call ``." "encode(object, final=True)``, passing an empty byte or text string if " "necessary, to reset the encoder and to get the output." msgstr "" -#: library/codecs.rst:626 +#: library/codecs.rst:652 msgid "" "Return the current state of the encoder which must be an integer. The " "implementation should make sure that ``0`` is the most common state. (States " @@ -769,42 +800,42 @@ msgid "" "into an integer.)" msgstr "" -#: library/codecs.rst:635 +#: library/codecs.rst:661 msgid "" "Set the state of the encoder to *state*. *state* must be an encoder state " "returned by :meth:`getstate`." msgstr "" -#: library/codecs.rst:642 +#: library/codecs.rst:668 msgid "IncrementalDecoder Objects" msgstr "" -#: library/codecs.rst:644 +#: library/codecs.rst:670 msgid "" "The :class:`IncrementalDecoder` class is used for decoding an input in " "multiple steps. It defines the following methods which every incremental " "decoder must define in order to be compatible with the Python codec registry." msgstr "" -#: library/codecs.rst:651 +#: library/codecs.rst:677 msgid "Constructor for an :class:`IncrementalDecoder` instance." msgstr "" -#: library/codecs.rst:653 +#: library/codecs.rst:679 msgid "" "All incremental decoders must provide this constructor interface. They are " "free to add additional keyword arguments, but only the ones defined here are " "used by the Python codec registry." msgstr "" -#: library/codecs.rst:657 +#: library/codecs.rst:683 msgid "" "The :class:`IncrementalDecoder` may implement different error handling " "schemes by providing the *errors* keyword argument. See :ref:`error-" "handlers` for possible values." msgstr "" -#: library/codecs.rst:661 +#: library/codecs.rst:687 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -812,7 +843,7 @@ msgid "" "`IncrementalDecoder` object." msgstr "" -#: library/codecs.rst:669 +#: library/codecs.rst:695 msgid "" "Decodes *object* (taking the current state of the decoder into account) and " "returns the resulting decoded object. If this is the last call to :meth:" @@ -823,11 +854,11 @@ msgid "" "(which might raise an exception)." msgstr "" -#: library/codecs.rst:680 +#: library/codecs.rst:706 msgid "Reset the decoder to the initial state." msgstr "" -#: library/codecs.rst:685 +#: library/codecs.rst:711 msgid "" "Return the current state of the decoder. This must be a tuple with two " "items, the first must be the buffer containing the still undecoded input. " @@ -842,59 +873,59 @@ msgid "" "bytes of the resulting string into an integer.)" msgstr "" -#: library/codecs.rst:700 +#: library/codecs.rst:726 msgid "" "Set the state of the decoder to *state*. *state* must be a decoder state " "returned by :meth:`getstate`." msgstr "" -#: library/codecs.rst:705 +#: library/codecs.rst:731 msgid "Stream Encoding and Decoding" msgstr "" -#: library/codecs.rst:708 +#: library/codecs.rst:734 msgid "" "The :class:`StreamWriter` and :class:`StreamReader` classes provide generic " "working interfaces which can be used to implement new encoding submodules " "very easily. See :mod:`!encodings.utf_8` for an example of how this is done." msgstr "" -#: library/codecs.rst:716 +#: library/codecs.rst:742 msgid "StreamWriter Objects" msgstr "" -#: library/codecs.rst:718 +#: library/codecs.rst:744 msgid "" "The :class:`StreamWriter` class is a subclass of :class:`Codec` and defines " "the following methods which every stream writer must define in order to be " "compatible with the Python codec registry." msgstr "" -#: library/codecs.rst:725 +#: library/codecs.rst:751 msgid "Constructor for a :class:`StreamWriter` instance." msgstr "" -#: library/codecs.rst:727 +#: library/codecs.rst:753 msgid "" "All stream writers must provide this constructor interface. They are free to " "add additional keyword arguments, but only the ones defined here are used by " "the Python codec registry." msgstr "" -#: library/codecs.rst:731 +#: library/codecs.rst:757 msgid "" "The *stream* argument must be a file-like object open for writing text or " "binary data, as appropriate for the specific codec." msgstr "" -#: library/codecs.rst:734 +#: library/codecs.rst:760 msgid "" "The :class:`StreamWriter` may implement different error handling schemes by " "providing the *errors* keyword argument. See :ref:`error-handlers` for the " "standard error handlers the underlying stream codec may support." msgstr "" -#: library/codecs.rst:738 +#: library/codecs.rst:764 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -902,70 +933,70 @@ msgid "" "object." msgstr "" -#: library/codecs.rst:744 +#: library/codecs.rst:770 msgid "Writes the object's contents encoded to the stream." msgstr "" -#: library/codecs.rst:749 +#: library/codecs.rst:775 msgid "" "Writes the concatenated iterable of strings to the stream (possibly by " "reusing the :meth:`write` method). Infinite or very large iterables are not " "supported. The standard bytes-to-bytes codecs do not support this method." msgstr "" -#: library/codecs.rst:852 +#: library/codecs.rst:878 msgid "Resets the codec buffers used for keeping internal state." msgstr "" -#: library/codecs.rst:759 +#: library/codecs.rst:785 msgid "" "Calling this method should ensure that the data on the output is put into a " "clean state that allows appending of new fresh data without having to rescan " "the whole stream to recover state." msgstr "" -#: library/codecs.rst:764 +#: library/codecs.rst:790 msgid "" "In addition to the above methods, the :class:`StreamWriter` must also " "inherit all other methods and attributes from the underlying stream." msgstr "" -#: library/codecs.rst:771 +#: library/codecs.rst:797 msgid "StreamReader Objects" msgstr "" -#: library/codecs.rst:773 +#: library/codecs.rst:799 msgid "" "The :class:`StreamReader` class is a subclass of :class:`Codec` and defines " "the following methods which every stream reader must define in order to be " "compatible with the Python codec registry." msgstr "" -#: library/codecs.rst:780 +#: library/codecs.rst:806 msgid "Constructor for a :class:`StreamReader` instance." msgstr "" -#: library/codecs.rst:782 +#: library/codecs.rst:808 msgid "" "All stream readers must provide this constructor interface. They are free to " "add additional keyword arguments, but only the ones defined here are used by " "the Python codec registry." msgstr "" -#: library/codecs.rst:786 +#: library/codecs.rst:812 msgid "" "The *stream* argument must be a file-like object open for reading text or " "binary data, as appropriate for the specific codec." msgstr "" -#: library/codecs.rst:789 +#: library/codecs.rst:815 msgid "" "The :class:`StreamReader` may implement different error handling schemes by " "providing the *errors* keyword argument. See :ref:`error-handlers` for the " "standard error handlers the underlying stream codec may support." msgstr "" -#: library/codecs.rst:793 +#: library/codecs.rst:819 msgid "" "The *errors* argument will be assigned to an attribute of the same name. " "Assigning to this attribute makes it possible to switch between different " @@ -973,24 +1004,24 @@ msgid "" "object." msgstr "" -#: library/codecs.rst:797 +#: library/codecs.rst:823 msgid "" "The set of allowed values for the *errors* argument can be extended with :" "func:`register_error`." msgstr "" -#: library/codecs.rst:803 +#: library/codecs.rst:829 msgid "Decodes data from the stream and returns the resulting object." msgstr "" -#: library/codecs.rst:805 +#: library/codecs.rst:831 msgid "" "The *chars* argument indicates the number of decoded code points or bytes to " "return. The :func:`read` method will never return more data than requested, " "but it might return less, if there is not enough available." msgstr "" -#: library/codecs.rst:810 +#: library/codecs.rst:836 msgid "" "The *size* argument indicates the approximate maximum number of encoded " "bytes or code points to read for decoding. The decoder can modify this " @@ -999,13 +1030,13 @@ msgid "" "huge files in one step." msgstr "" -#: library/codecs.rst:817 +#: library/codecs.rst:843 msgid "" "The *firstline* flag indicates that it would be sufficient to only return " "the first line, if there are decoding errors on later lines." msgstr "" -#: library/codecs.rst:821 +#: library/codecs.rst:847 msgid "" "The method should use a greedy read strategy meaning that it should read as " "much data as is allowed within the definition of the encoding and the given " @@ -1013,68 +1044,68 @@ msgid "" "the stream, these should be read too." msgstr "" -#: library/codecs.rst:829 +#: library/codecs.rst:855 msgid "Read one line from the input stream and return the decoded data." msgstr "" -#: library/codecs.rst:831 +#: library/codecs.rst:857 msgid "" "*size*, if given, is passed as size argument to the stream's :meth:`read` " "method." msgstr "" -#: library/codecs.rst:834 +#: library/codecs.rst:860 msgid "" "If *keepends* is false line-endings will be stripped from the lines returned." msgstr "" -#: library/codecs.rst:840 +#: library/codecs.rst:866 msgid "" "Read all lines available on the input stream and return them as a list of " "lines." msgstr "" -#: library/codecs.rst:843 +#: library/codecs.rst:869 msgid "" "Line-endings are implemented using the codec's :meth:`decode` method and are " "included in the list entries if *keepends* is true." msgstr "" -#: library/codecs.rst:846 +#: library/codecs.rst:872 msgid "" "*sizehint*, if given, is passed as the *size* argument to the stream's :meth:" "`read` method." msgstr "" -#: library/codecs.rst:854 +#: library/codecs.rst:880 msgid "" "Note that no stream repositioning should take place. This method is " "primarily intended to be able to recover from decoding errors." msgstr "" -#: library/codecs.rst:858 +#: library/codecs.rst:884 msgid "" "In addition to the above methods, the :class:`StreamReader` must also " "inherit all other methods and attributes from the underlying stream." msgstr "" -#: library/codecs.rst:864 +#: library/codecs.rst:890 msgid "StreamReaderWriter Objects" msgstr "" -#: library/codecs.rst:866 +#: library/codecs.rst:892 msgid "" "The :class:`StreamReaderWriter` is a convenience class that allows wrapping " "streams which work in both read and write modes." msgstr "" -#: library/codecs.rst:893 +#: library/codecs.rst:919 msgid "" "The design is such that one can use the factory functions returned by the :" "func:`lookup` function to construct the instance." msgstr "" -#: library/codecs.rst:875 +#: library/codecs.rst:901 msgid "" "Creates a :class:`StreamReaderWriter` instance. *stream* must be a file-like " "object. *Reader* and *Writer* must be factory functions or classes providing " @@ -1083,24 +1114,24 @@ msgid "" "writers." msgstr "" -#: library/codecs.rst:880 +#: library/codecs.rst:906 msgid "" ":class:`StreamReaderWriter` instances define the combined interfaces of :" "class:`StreamReader` and :class:`StreamWriter` classes. They inherit all " "other methods and attributes from the underlying stream." msgstr "" -#: library/codecs.rst:888 +#: library/codecs.rst:914 msgid "StreamRecoder Objects" msgstr "" -#: library/codecs.rst:890 +#: library/codecs.rst:916 msgid "" "The :class:`StreamRecoder` translates data from one encoding to another, " "which is sometimes useful when dealing with different encoding environments." msgstr "" -#: library/codecs.rst:899 +#: library/codecs.rst:925 msgid "" "Creates a :class:`StreamRecoder` instance which implements a two-way " "conversion: *encode* and *decode* work on the frontend — the data visible to " @@ -1108,17 +1139,17 @@ msgid "" "while *Reader* and *Writer* work on the backend — the data in *stream*." msgstr "" -#: library/codecs.rst:905 +#: library/codecs.rst:931 msgid "" "You can use these objects to do transparent transcodings, e.g., from Latin-1 " "to UTF-8 and back." msgstr "" -#: library/codecs.rst:908 +#: library/codecs.rst:934 msgid "The *stream* argument must be a file-like object." msgstr "" -#: library/codecs.rst:910 +#: library/codecs.rst:936 msgid "" "The *encode* and *decode* arguments must adhere to the :class:`Codec` " "interface. *Reader* and *Writer* must be factory functions or classes " @@ -1126,24 +1157,24 @@ msgid "" "interface respectively." msgstr "" -#: library/codecs.rst:915 +#: library/codecs.rst:941 msgid "" "Error handling is done in the same way as defined for the stream readers and " "writers." msgstr "" -#: library/codecs.rst:919 +#: library/codecs.rst:945 msgid "" ":class:`StreamRecoder` instances define the combined interfaces of :class:" "`StreamReader` and :class:`StreamWriter` classes. They inherit all other " "methods and attributes from the underlying stream." msgstr "" -#: library/codecs.rst:927 +#: library/codecs.rst:953 msgid "Encodings and Unicode" msgstr "" -#: library/codecs.rst:929 +#: library/codecs.rst:955 msgid "" "Strings are stored internally as sequences of code points in range " "``U+0000``--``U+10FFFF``. (See :pep:`393` for more details about the " @@ -1155,7 +1186,7 @@ msgid "" "which are collectivity referred to as :term:`text encodings `." msgstr "" -#: library/codecs.rst:939 +#: library/codecs.rst:965 msgid "" "The simplest text encoding (called ``'latin-1'`` or ``'iso-8859-1'``) maps " "the code points 0--255 to the bytes ``0x0``--``0xff``, which means that a " @@ -1166,7 +1197,7 @@ msgid "" "position 3: ordinal not in range(256)``." msgstr "" -#: library/codecs.rst:947 +#: library/codecs.rst:973 msgid "" "There's another group of encodings (the so called charmap encodings) that " "choose a different subset of all Unicode code points and how these code " @@ -1176,37 +1207,45 @@ msgid "" "that shows you which character is mapped to which byte value." msgstr "" -#: library/codecs.rst:954 +#: library/codecs.rst:980 msgid "" "All of these encodings can only encode 256 of the 1114112 code points " "defined in Unicode. A simple and straightforward way that can store each " "Unicode code point, is to store each code point as four consecutive bytes. " "There are two possibilities: store the bytes in big endian or in little " "endian order. These two encodings are called ``UTF-32-BE`` and ``UTF-32-LE`` " -"respectively. Their disadvantage is that if e.g. you use ``UTF-32-BE`` on a " -"little endian machine you will always have to swap bytes on encoding and " -"decoding. ``UTF-32`` avoids this problem: bytes will always be in natural " -"endianness. When these bytes are read by a CPU with a different endianness, " -"then bytes have to be swapped though. To be able to detect the endianness of " -"a ``UTF-16`` or ``UTF-32`` byte sequence, there's the so called BOM (\"Byte " -"Order Mark\"). This is the Unicode character ``U+FEFF``. This character can " -"be prepended to every ``UTF-16`` or ``UTF-32`` byte sequence. The byte " -"swapped version of this character (``0xFFFE``) is an illegal character that " -"may not appear in a Unicode text. So when the first character in a " -"``UTF-16`` or ``UTF-32`` byte sequence appears to be a ``U+FFFE`` the bytes " -"have to be swapped on decoding. Unfortunately the character ``U+FEFF`` had a " -"second purpose as a ``ZERO WIDTH NO-BREAK SPACE``: a character that has no " -"width and doesn't allow a word to be split. It can e.g. be used to give " -"hints to a ligature algorithm. With Unicode 4.0 using ``U+FEFF`` as a ``ZERO " -"WIDTH NO-BREAK SPACE`` has been deprecated (with ``U+2060`` (``WORD " -"JOINER``) assuming this role). Nevertheless Unicode software still must be " -"able to handle ``U+FEFF`` in both roles: as a BOM it's a device to determine " -"the storage layout of the encoded bytes, and vanishes once the byte sequence " -"has been decoded into a string; as a ``ZERO WIDTH NO-BREAK SPACE`` it's a " -"normal character that will be decoded like any other." -msgstr "" - -#: library/codecs.rst:980 +"respectively. Their disadvantage is that if, for example, you use ``UTF-32-" +"BE`` on a little endian machine you will always have to swap bytes on " +"encoding and decoding. Python's ``UTF-16`` and ``UTF-32`` codecs avoid this " +"problem by using the platform's native byte order when no BOM is present. " +"Python follows prevailing platform practice, so native-endian data round-" +"trips without redundant byte swapping, even though the Unicode Standard " +"defaults to big-endian when the byte order is unspecified. When these bytes " +"are read by a CPU with a different endianness, the bytes have to be swapped. " +"To be able to detect the endianness of a ``UTF-16`` or ``UTF-32`` byte " +"sequence, a BOM (\"Byte Order Mark\") is used. This is the Unicode character " +"``U+FEFF``. This character can be prepended to every ``UTF-16`` or " +"``UTF-32`` byte sequence. The byte swapped version of this character " +"(``0xFFFE``) is an illegal character that may not appear in a Unicode text. " +"When the first character of a ``UTF-16`` or ``UTF-32`` byte sequence is " +"``U+FFFE``, the bytes have to be swapped on decoding." +msgstr "" + +#: library/codecs.rst:1001 +msgid "" +"Unfortunately the character ``U+FEFF`` had a second purpose as a ``ZERO " +"WIDTH NO-BREAK SPACE``: a character that has no width and doesn't allow a " +"word to be split. It can e.g. be used to give hints to a ligature algorithm. " +"With Unicode 4.0 using ``U+FEFF`` as a ``ZERO WIDTH NO-BREAK SPACE`` has " +"been deprecated (with ``U+2060`` (``WORD JOINER``) assuming this role). " +"Nevertheless Unicode software still must be able to handle ``U+FEFF`` in " +"both roles: as a BOM it's a device to determine the storage layout of the " +"encoded bytes, and vanishes once the byte sequence has been decoded into a " +"string; as a ``ZERO WIDTH NO-BREAK SPACE`` it's a normal character that will " +"be decoded like any other." +msgstr "" + +#: library/codecs.rst:1011 msgid "" "There's another encoding that is able to encode the full range of Unicode " "characters: UTF-8. UTF-8 is an 8-bit encoding, which means there are no " @@ -1217,59 +1256,59 @@ msgid "" "which when concatenated give the Unicode character):" msgstr "" -#: library/codecs.rst:989 +#: library/codecs.rst:1020 msgid "Range" msgstr "" -#: library/codecs.rst:989 +#: library/codecs.rst:1020 msgid "Encoding" msgstr "" -#: library/codecs.rst:991 +#: library/codecs.rst:1022 msgid "``U-00000000`` ... ``U-0000007F``" msgstr "" -#: library/codecs.rst:991 +#: library/codecs.rst:1022 msgid "0xxxxxxx" msgstr "" -#: library/codecs.rst:993 +#: library/codecs.rst:1024 msgid "``U-00000080`` ... ``U-000007FF``" msgstr "" -#: library/codecs.rst:993 +#: library/codecs.rst:1024 msgid "110xxxxx 10xxxxxx" msgstr "" -#: library/codecs.rst:995 +#: library/codecs.rst:1026 msgid "``U-00000800`` ... ``U-0000FFFF``" msgstr "" -#: library/codecs.rst:995 +#: library/codecs.rst:1026 msgid "1110xxxx 10xxxxxx 10xxxxxx" msgstr "" -#: library/codecs.rst:997 +#: library/codecs.rst:1028 msgid "``U-00010000`` ... ``U-0010FFFF``" msgstr "" -#: library/codecs.rst:997 +#: library/codecs.rst:1028 msgid "11110xxx 10xxxxxx 10xxxxxx 10xxxxxx" msgstr "" -#: library/codecs.rst:1000 +#: library/codecs.rst:1031 msgid "" "The least significant bit of the Unicode character is the rightmost x bit." msgstr "" -#: library/codecs.rst:1002 +#: library/codecs.rst:1033 msgid "" "As UTF-8 is an 8-bit encoding no BOM is required and any ``U+FEFF`` " "character in the decoded string (even if it's the first character) is " "treated as a ``ZERO WIDTH NO-BREAK SPACE``." msgstr "" -#: library/codecs.rst:1006 +#: library/codecs.rst:1037 msgid "" "Without external information it's impossible to reliably determine which " "encoding was used for encoding a string. Each charmap encoding can decode " @@ -1295,7 +1334,7 @@ msgstr "" msgid "INVERTED QUESTION MARK" msgstr "" -#: library/codecs.rst:1022 +#: library/codecs.rst:1053 msgid "" "in iso-8859-1), this increases the probability that a ``utf-8-sig`` encoding " "can be correctly guessed from the byte sequence. So here the BOM is not used " @@ -1307,11 +1346,11 @@ msgid "" "the use of the BOM is discouraged and should generally be avoided." msgstr "" -#: library/codecs.rst:1035 +#: library/codecs.rst:1066 msgid "Standard Encodings" msgstr "" -#: library/codecs.rst:1037 +#: library/codecs.rst:1068 msgid "" "Python comes with a number of codecs built-in, either implemented as C " "functions or with dictionaries as mapping tables. The following table lists " @@ -1319,11 +1358,25 @@ msgid "" "for which the encoding is likely used. Neither the list of aliases nor the " "list of languages is meant to be exhaustive. Notice that spelling " "alternatives that only differ in case or use a hyphen instead of an " -"underscore are also valid aliases; therefore, e.g. ``'utf-8'`` is a valid " -"alias for the ``'utf_8'`` codec." +"underscore are also valid aliases because they are equivalent when " +"normalized by :func:`~encodings.normalize_encoding`. For example, " +"``'utf-8'`` is a valid alias for the ``'utf_8'`` codec." +msgstr "" + +#: library/codecs.rst:1080 +msgid "" +"The below table lists the most common aliases, for a complete list refer to " +"the source :source:`aliases.py ` file." msgstr "" -#: library/codecs.rst:1047 +#: library/codecs.rst:1083 +msgid "" +"On Windows, ``cpXXX`` codecs are available for all code pages. But only " +"codecs listed in the following table are guarantead to exist on other " +"platforms." +msgstr "" + +#: library/codecs.rst:1089 msgid "" "Some common encodings can bypass the codecs lookup machinery to improve " "performance. These optimization opportunities are only recognized by CPython " @@ -1333,11 +1386,11 @@ msgid "" "Using alternative aliases for these encodings may result in slower execution." msgstr "" -#: library/codecs.rst:1055 +#: library/codecs.rst:1097 msgid "Optimization opportunity recognized for us-ascii." msgstr "" -#: library/codecs.rst:1058 +#: library/codecs.rst:1100 msgid "" "Many of the character sets support the same languages. They vary in " "individual characters (e.g. whether the EURO SIGN is supported or not), and " @@ -1345,925 +1398,933 @@ msgid "" "languages in particular, the following variants typically exist:" msgstr "" -#: library/codecs.rst:1063 +#: library/codecs.rst:1105 msgid "an ISO 8859 codeset" msgstr "" -#: library/codecs.rst:1065 +#: library/codecs.rst:1107 msgid "" "a Microsoft Windows code page, which is typically derived from an 8859 " "codeset, but replaces control characters with additional graphic characters" msgstr "" -#: library/codecs.rst:1068 +#: library/codecs.rst:1110 msgid "an IBM EBCDIC code page" msgstr "" -#: library/codecs.rst:1070 +#: library/codecs.rst:1112 msgid "an IBM PC code page, which is ASCII compatible" msgstr "" -#: library/codecs.rst:1330 library/codecs.rst:1455 +#: library/codecs.rst:1376 library/codecs.rst:1533 msgid "Codec" msgstr "" -#: library/codecs.rst:1330 library/codecs.rst:1455 +#: library/codecs.rst:1376 library/codecs.rst:1533 msgid "Aliases" msgstr "" -#: library/codecs.rst:1075 +#: library/codecs.rst:1117 msgid "Languages" msgstr "" -#: library/codecs.rst:1077 +#: library/codecs.rst:1119 msgid "ascii" msgstr "" -#: library/codecs.rst:1077 +#: library/codecs.rst:1119 msgid "646, us-ascii" msgstr "" -#: library/codecs.rst:1083 library/codecs.rst:1091 +#: library/codecs.rst:1125 library/codecs.rst:1133 msgid "English" msgstr "" -#: library/codecs.rst:1079 +#: library/codecs.rst:1121 msgid "big5" msgstr "" -#: library/codecs.rst:1079 +#: library/codecs.rst:1121 msgid "big5-tw, csbig5" msgstr "" -#: library/codecs.rst:1081 library/codecs.rst:1139 +#: library/codecs.rst:1123 library/codecs.rst:1182 msgid "Traditional Chinese" msgstr "" -#: library/codecs.rst:1081 +#: library/codecs.rst:1123 msgid "big5hkscs" msgstr "" -#: library/codecs.rst:1081 +#: library/codecs.rst:1123 msgid "big5-hkscs, hkscs" msgstr "" -#: library/codecs.rst:1083 +#: library/codecs.rst:1125 msgid "cp037" msgstr "" -#: library/codecs.rst:1083 +#: library/codecs.rst:1125 msgid "IBM037, IBM039" msgstr "" -#: library/codecs.rst:1085 +#: library/codecs.rst:1127 msgid "cp273" msgstr "" -#: library/codecs.rst:1085 +#: library/codecs.rst:1127 msgid "273, IBM273, csIBM273" msgstr "" -#: library/codecs.rst:1085 +#: library/codecs.rst:1127 msgid "German" msgstr "" -#: library/codecs.rst:1089 +#: library/codecs.rst:1131 msgid "cp424" msgstr "" -#: library/codecs.rst:1089 +#: library/codecs.rst:1131 msgid "EBCDIC-CP-HE, IBM424" msgstr "" -#: library/codecs.rst:1109 library/codecs.rst:1162 library/codecs.rst:1225 +#: library/codecs.rst:1151 library/codecs.rst:1205 library/codecs.rst:1268 msgid "Hebrew" msgstr "" -#: library/codecs.rst:1091 +#: library/codecs.rst:1133 msgid "cp437" msgstr "" -#: library/codecs.rst:1091 +#: library/codecs.rst:1133 msgid "437, IBM437" msgstr "" -#: library/codecs.rst:1093 +#: library/codecs.rst:1135 msgid "cp500" msgstr "" -#: library/codecs.rst:1093 +#: library/codecs.rst:1135 msgid "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" msgstr "" -#: library/codecs.rst:1102 library/codecs.rst:1149 library/codecs.rst:1209 -#: library/codecs.rst:1265 +#: library/codecs.rst:1144 library/codecs.rst:1192 library/codecs.rst:1252 +#: library/codecs.rst:1308 msgid "Western Europe" msgstr "" -#: library/codecs.rst:1096 +#: library/codecs.rst:1138 msgid "cp720" msgstr "" -#: library/codecs.rst:1123 library/codecs.rst:1221 +#: library/codecs.rst:1165 library/codecs.rst:1264 msgid "Arabic" msgstr "" -#: library/codecs.rst:1098 +#: library/codecs.rst:1140 msgid "cp737" msgstr "" -#: library/codecs.rst:1129 library/codecs.rst:1158 library/codecs.rst:1258 +#: library/codecs.rst:1171 library/codecs.rst:1201 library/codecs.rst:1301 msgid "Greek" msgstr "" -#: library/codecs.rst:1100 +#: library/codecs.rst:1142 msgid "cp775" msgstr "" -#: library/codecs.rst:1100 +#: library/codecs.rst:1142 msgid "IBM775" msgstr "" -#: library/codecs.rst:1166 library/codecs.rst:1233 +#: library/codecs.rst:1209 library/codecs.rst:1276 msgid "Baltic languages" msgstr "" -#: library/codecs.rst:1102 +#: library/codecs.rst:1144 msgid "cp850" msgstr "" -#: library/codecs.rst:1102 +#: library/codecs.rst:1144 msgid "850, IBM850" msgstr "" -#: library/codecs.rst:1104 +#: library/codecs.rst:1146 msgid "cp852" msgstr "" -#: library/codecs.rst:1104 +#: library/codecs.rst:1146 msgid "852, IBM852" msgstr "" -#: library/codecs.rst:1151 library/codecs.rst:1262 +#: library/codecs.rst:1194 library/codecs.rst:1305 msgid "Central and Eastern Europe" msgstr "" -#: library/codecs.rst:1106 +#: library/codecs.rst:1148 msgid "cp855" msgstr "" -#: library/codecs.rst:1106 +#: library/codecs.rst:1148 msgid "855, IBM855" msgstr "" -#: library/codecs.rst:1153 library/codecs.rst:1255 -msgid "Bulgarian, Byelorussian, Macedonian, Russian, Serbian" +#: library/codecs.rst:1196 library/codecs.rst:1298 +msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" msgstr "" -#: library/codecs.rst:1109 +#: library/codecs.rst:1151 msgid "cp856" msgstr "" -#: library/codecs.rst:1111 +#: library/codecs.rst:1153 msgid "cp857" msgstr "" -#: library/codecs.rst:1111 +#: library/codecs.rst:1153 msgid "857, IBM857" msgstr "" -#: library/codecs.rst:1143 library/codecs.rst:1227 library/codecs.rst:1267 +#: library/codecs.rst:1186 library/codecs.rst:1270 library/codecs.rst:1310 msgid "Turkish" msgstr "" -#: library/codecs.rst:1113 +#: library/codecs.rst:1155 msgid "cp858" msgstr "" -#: library/codecs.rst:1113 +#: library/codecs.rst:1155 msgid "858, IBM858" msgstr "" -#: library/codecs.rst:1115 +#: library/codecs.rst:1157 msgid "cp860" msgstr "" -#: library/codecs.rst:1115 +#: library/codecs.rst:1157 msgid "860, IBM860" msgstr "" -#: library/codecs.rst:1115 +#: library/codecs.rst:1157 msgid "Portuguese" msgstr "" -#: library/codecs.rst:1117 +#: library/codecs.rst:1159 msgid "cp861" msgstr "" -#: library/codecs.rst:1117 +#: library/codecs.rst:1159 msgid "861, CP-IS, IBM861" msgstr "" -#: library/codecs.rst:1260 +#: library/codecs.rst:1303 msgid "Icelandic" msgstr "" -#: library/codecs.rst:1119 +#: library/codecs.rst:1161 msgid "cp862" msgstr "" -#: library/codecs.rst:1119 +#: library/codecs.rst:1161 msgid "862, IBM862" msgstr "" -#: library/codecs.rst:1121 +#: library/codecs.rst:1163 msgid "cp863" msgstr "" -#: library/codecs.rst:1121 +#: library/codecs.rst:1163 msgid "863, IBM863" msgstr "" -#: library/codecs.rst:1121 +#: library/codecs.rst:1163 msgid "Canadian" msgstr "" -#: library/codecs.rst:1123 +#: library/codecs.rst:1165 msgid "cp864" msgstr "" -#: library/codecs.rst:1123 +#: library/codecs.rst:1165 msgid "IBM864" msgstr "" -#: library/codecs.rst:1125 +#: library/codecs.rst:1167 msgid "cp865" msgstr "" -#: library/codecs.rst:1125 +#: library/codecs.rst:1167 msgid "865, IBM865" msgstr "" -#: library/codecs.rst:1125 +#: library/codecs.rst:1167 msgid "Danish, Norwegian" msgstr "" -#: library/codecs.rst:1127 +#: library/codecs.rst:1169 msgid "cp866" msgstr "" -#: library/codecs.rst:1127 +#: library/codecs.rst:1169 msgid "866, IBM866" msgstr "" -#: library/codecs.rst:1243 +#: library/codecs.rst:1286 msgid "Russian" msgstr "" -#: library/codecs.rst:1129 +#: library/codecs.rst:1171 msgid "cp869" msgstr "" -#: library/codecs.rst:1129 +#: library/codecs.rst:1171 msgid "869, CP-GR, IBM869" msgstr "" -#: library/codecs.rst:1131 +#: library/codecs.rst:1173 msgid "cp874" msgstr "" -#: library/codecs.rst:1131 +#: library/codecs.rst:1173 msgid "Thai" msgstr "" -#: library/codecs.rst:1133 +#: library/codecs.rst:1175 msgid "cp875" msgstr "" -#: library/codecs.rst:1135 +#: library/codecs.rst:1177 msgid "cp932" msgstr "" -#: library/codecs.rst:1135 -msgid "932, ms932, mskanji, ms-kanji" +#: library/codecs.rst:1177 +msgid "932, ms932, mskanji, ms-kanji, windows-31j" msgstr "" -#: library/codecs.rst:1170 library/codecs.rst:1174 library/codecs.rst:1194 -#: library/codecs.rst:1202 library/codecs.rst:1272 library/codecs.rst:1278 +#: library/codecs.rst:1213 library/codecs.rst:1217 library/codecs.rst:1237 +#: library/codecs.rst:1245 library/codecs.rst:1315 library/codecs.rst:1321 msgid "Japanese" msgstr "" -#: library/codecs.rst:1137 +#: library/codecs.rst:1180 msgid "cp949" msgstr "" -#: library/codecs.rst:1137 +#: library/codecs.rst:1180 msgid "949, ms949, uhc" msgstr "" -#: library/codecs.rst:1176 library/codecs.rst:1241 +#: library/codecs.rst:1219 library/codecs.rst:1284 msgid "Korean" msgstr "" -#: library/codecs.rst:1139 +#: library/codecs.rst:1182 msgid "cp950" msgstr "" -#: library/codecs.rst:1139 +#: library/codecs.rst:1182 msgid "950, ms950" msgstr "" -#: library/codecs.rst:1141 +#: library/codecs.rst:1184 msgid "cp1006" msgstr "" -#: library/codecs.rst:1141 +#: library/codecs.rst:1184 msgid "Urdu" msgstr "" -#: library/codecs.rst:1143 +#: library/codecs.rst:1186 msgid "cp1026" msgstr "" -#: library/codecs.rst:1143 +#: library/codecs.rst:1186 msgid "ibm1026" msgstr "" -#: library/codecs.rst:1145 +#: library/codecs.rst:1188 msgid "cp1125" msgstr "" -#: library/codecs.rst:1145 +#: library/codecs.rst:1188 msgid "1125, ibm1125, cp866u, ruscii" msgstr "" -#: library/codecs.rst:1249 +#: library/codecs.rst:1292 msgid "Ukrainian" msgstr "" -#: library/codecs.rst:1149 +#: library/codecs.rst:1192 msgid "cp1140" msgstr "" -#: library/codecs.rst:1149 +#: library/codecs.rst:1192 msgid "ibm1140" msgstr "" -#: library/codecs.rst:1151 +#: library/codecs.rst:1194 msgid "cp1250" msgstr "" -#: library/codecs.rst:1151 +#: library/codecs.rst:1194 msgid "windows-1250" msgstr "" -#: library/codecs.rst:1153 +#: library/codecs.rst:1196 msgid "cp1251" msgstr "" -#: library/codecs.rst:1153 +#: library/codecs.rst:1196 msgid "windows-1251" msgstr "" -#: library/codecs.rst:1156 +#: library/codecs.rst:1199 msgid "cp1252" msgstr "" -#: library/codecs.rst:1156 +#: library/codecs.rst:1199 msgid "windows-1252" msgstr "" -#: library/codecs.rst:1158 +#: library/codecs.rst:1201 msgid "cp1253" msgstr "" -#: library/codecs.rst:1158 +#: library/codecs.rst:1201 msgid "windows-1253" msgstr "" -#: library/codecs.rst:1160 +#: library/codecs.rst:1203 msgid "cp1254" msgstr "" -#: library/codecs.rst:1160 +#: library/codecs.rst:1203 msgid "windows-1254" msgstr "" -#: library/codecs.rst:1162 +#: library/codecs.rst:1205 msgid "cp1255" msgstr "" -#: library/codecs.rst:1162 +#: library/codecs.rst:1205 msgid "windows-1255" msgstr "" -#: library/codecs.rst:1164 +#: library/codecs.rst:1207 msgid "cp1256" msgstr "" -#: library/codecs.rst:1164 +#: library/codecs.rst:1207 msgid "windows-1256" msgstr "" -#: library/codecs.rst:1166 +#: library/codecs.rst:1209 msgid "cp1257" msgstr "" -#: library/codecs.rst:1166 +#: library/codecs.rst:1209 msgid "windows-1257" msgstr "" -#: library/codecs.rst:1168 +#: library/codecs.rst:1211 msgid "cp1258" msgstr "" -#: library/codecs.rst:1168 +#: library/codecs.rst:1211 msgid "windows-1258" msgstr "" -#: library/codecs.rst:1168 +#: library/codecs.rst:1211 msgid "Vietnamese" msgstr "" -#: library/codecs.rst:1170 +#: library/codecs.rst:1213 msgid "euc_jp" msgstr "" -#: library/codecs.rst:1170 +#: library/codecs.rst:1213 msgid "eucjp, ujis, u-jis" msgstr "" -#: library/codecs.rst:1172 +#: library/codecs.rst:1215 msgid "euc_jis_2004" msgstr "" -#: library/codecs.rst:1172 +#: library/codecs.rst:1215 msgid "jisx0213, eucjis2004" msgstr "" -#: library/codecs.rst:1174 +#: library/codecs.rst:1217 msgid "euc_jisx0213" msgstr "" -#: library/codecs.rst:1174 +#: library/codecs.rst:1217 msgid "eucjisx0213" msgstr "" -#: library/codecs.rst:1176 +#: library/codecs.rst:1219 msgid "euc_kr" msgstr "" -#: library/codecs.rst:1176 +#: library/codecs.rst:1219 msgid "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" msgstr "" -#: library/codecs.rst:1180 +#: library/codecs.rst:1223 msgid "gb2312" msgstr "" -#: library/codecs.rst:1180 +#: library/codecs.rst:1223 msgid "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" msgstr "" -#: library/codecs.rst:1189 +#: library/codecs.rst:1232 msgid "Simplified Chinese" msgstr "" -#: library/codecs.rst:1185 +#: library/codecs.rst:1228 msgid "gbk" msgstr "" -#: library/codecs.rst:1185 +#: library/codecs.rst:1228 msgid "936, cp936, ms936" msgstr "" -#: library/codecs.rst:1187 +#: library/codecs.rst:1230 msgid "Unified Chinese" msgstr "" -#: library/codecs.rst:1187 +#: library/codecs.rst:1230 msgid "gb18030" msgstr "" -#: library/codecs.rst:1187 +#: library/codecs.rst:1230 msgid "gb18030-2000" msgstr "" -#: library/codecs.rst:1189 +#: library/codecs.rst:1232 msgid "hz" msgstr "" -#: library/codecs.rst:1189 +#: library/codecs.rst:1232 msgid "hzgb, hz-gb, hz-gb-2312" msgstr "" -#: library/codecs.rst:1191 +#: library/codecs.rst:1234 msgid "iso2022_jp" msgstr "" -#: library/codecs.rst:1191 +#: library/codecs.rst:1234 msgid "csiso2022jp, iso2022jp, iso-2022-jp" msgstr "" -#: library/codecs.rst:1194 +#: library/codecs.rst:1237 msgid "iso2022_jp_1" msgstr "" -#: library/codecs.rst:1194 +#: library/codecs.rst:1237 msgid "iso2022jp-1, iso-2022-jp-1" msgstr "" -#: library/codecs.rst:1196 +#: library/codecs.rst:1239 msgid "iso2022_jp_2" msgstr "" -#: library/codecs.rst:1196 +#: library/codecs.rst:1239 msgid "iso2022jp-2, iso-2022-jp-2" msgstr "" -#: library/codecs.rst:1196 +#: library/codecs.rst:1239 msgid "Japanese, Korean, Simplified Chinese, Western Europe, Greek" msgstr "" -#: library/codecs.rst:1199 +#: library/codecs.rst:1242 msgid "iso2022_jp_2004" msgstr "" -#: library/codecs.rst:1199 +#: library/codecs.rst:1242 msgid "iso2022jp-2004, iso-2022-jp-2004" msgstr "" -#: library/codecs.rst:1202 +#: library/codecs.rst:1245 msgid "iso2022_jp_3" msgstr "" -#: library/codecs.rst:1202 +#: library/codecs.rst:1245 msgid "iso2022jp-3, iso-2022-jp-3" msgstr "" -#: library/codecs.rst:1204 +#: library/codecs.rst:1247 msgid "iso2022_jp_ext" msgstr "" -#: library/codecs.rst:1204 +#: library/codecs.rst:1247 msgid "iso2022jp-ext, iso-2022-jp-ext" msgstr "" -#: library/codecs.rst:1206 +#: library/codecs.rst:1249 msgid "iso2022_kr" msgstr "" -#: library/codecs.rst:1206 +#: library/codecs.rst:1249 msgid "csiso2022kr, iso2022kr, iso-2022-kr" msgstr "" -#: library/codecs.rst:1209 +#: library/codecs.rst:1252 msgid "latin_1" msgstr "" -#: library/codecs.rst:1209 +#: library/codecs.rst:1252 msgid "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" msgstr "" -#: library/codecs.rst:1212 +#: library/codecs.rst:1255 msgid "iso8859_2" msgstr "" -#: library/codecs.rst:1212 +#: library/codecs.rst:1255 msgid "iso-8859-2, latin2, L2" msgstr "" -#: library/codecs.rst:1214 +#: library/codecs.rst:1257 msgid "iso8859_3" msgstr "" -#: library/codecs.rst:1214 +#: library/codecs.rst:1257 msgid "iso-8859-3, latin3, L3" msgstr "" -#: library/codecs.rst:1214 +#: library/codecs.rst:1257 msgid "Esperanto, Maltese" msgstr "" -#: library/codecs.rst:1216 +#: library/codecs.rst:1259 msgid "iso8859_4" msgstr "" -#: library/codecs.rst:1216 +#: library/codecs.rst:1259 msgid "iso-8859-4, latin4, L4" msgstr "" -#: library/codecs.rst:1218 +#: library/codecs.rst:1259 +msgid "Northern Europe" +msgstr "" + +#: library/codecs.rst:1261 msgid "iso8859_5" msgstr "" -#: library/codecs.rst:1218 +#: library/codecs.rst:1261 msgid "iso-8859-5, cyrillic" msgstr "" -#: library/codecs.rst:1221 +#: library/codecs.rst:1264 msgid "iso8859_6" msgstr "" -#: library/codecs.rst:1221 +#: library/codecs.rst:1264 msgid "iso-8859-6, arabic" msgstr "" -#: library/codecs.rst:1223 +#: library/codecs.rst:1266 msgid "iso8859_7" msgstr "" -#: library/codecs.rst:1223 +#: library/codecs.rst:1266 msgid "iso-8859-7, greek, greek8" msgstr "" -#: library/codecs.rst:1225 +#: library/codecs.rst:1268 msgid "iso8859_8" msgstr "" -#: library/codecs.rst:1225 +#: library/codecs.rst:1268 msgid "iso-8859-8, hebrew" msgstr "" -#: library/codecs.rst:1227 +#: library/codecs.rst:1270 msgid "iso8859_9" msgstr "" -#: library/codecs.rst:1227 +#: library/codecs.rst:1270 msgid "iso-8859-9, latin5, L5" msgstr "" -#: library/codecs.rst:1229 +#: library/codecs.rst:1272 msgid "iso8859_10" msgstr "" -#: library/codecs.rst:1229 +#: library/codecs.rst:1272 msgid "iso-8859-10, latin6, L6" msgstr "" -#: library/codecs.rst:1229 +#: library/codecs.rst:1272 msgid "Nordic languages" msgstr "" -#: library/codecs.rst:1231 +#: library/codecs.rst:1274 msgid "iso8859_11" msgstr "" -#: library/codecs.rst:1231 +#: library/codecs.rst:1274 msgid "iso-8859-11, thai" msgstr "" -#: library/codecs.rst:1231 +#: library/codecs.rst:1274 msgid "Thai languages" msgstr "" -#: library/codecs.rst:1233 +#: library/codecs.rst:1276 msgid "iso8859_13" msgstr "" -#: library/codecs.rst:1233 +#: library/codecs.rst:1276 msgid "iso-8859-13, latin7, L7" msgstr "" -#: library/codecs.rst:1235 +#: library/codecs.rst:1278 msgid "iso8859_14" msgstr "" -#: library/codecs.rst:1235 +#: library/codecs.rst:1278 msgid "iso-8859-14, latin8, L8" msgstr "" -#: library/codecs.rst:1235 +#: library/codecs.rst:1278 msgid "Celtic languages" msgstr "" -#: library/codecs.rst:1237 +#: library/codecs.rst:1280 msgid "iso8859_15" msgstr "" -#: library/codecs.rst:1237 +#: library/codecs.rst:1280 msgid "iso-8859-15, latin9, L9" msgstr "" -#: library/codecs.rst:1239 +#: library/codecs.rst:1282 msgid "iso8859_16" msgstr "" -#: library/codecs.rst:1239 +#: library/codecs.rst:1282 msgid "iso-8859-16, latin10, L10" msgstr "" -#: library/codecs.rst:1239 +#: library/codecs.rst:1282 msgid "South-Eastern Europe" msgstr "" -#: library/codecs.rst:1241 +#: library/codecs.rst:1284 msgid "johab" msgstr "" -#: library/codecs.rst:1241 +#: library/codecs.rst:1284 msgid "cp1361, ms1361" msgstr "" -#: library/codecs.rst:1243 +#: library/codecs.rst:1286 msgid "koi8_r" msgstr "" -#: library/codecs.rst:1245 +#: library/codecs.rst:1288 msgid "koi8_t" msgstr "" -#: library/codecs.rst:1245 +#: library/codecs.rst:1288 msgid "Tajik" msgstr "" -#: library/codecs.rst:1249 +#: library/codecs.rst:1292 msgid "koi8_u" msgstr "" -#: library/codecs.rst:1251 +#: library/codecs.rst:1294 msgid "kz1048" msgstr "" -#: library/codecs.rst:1251 +#: library/codecs.rst:1294 msgid "kz_1048, strk1048_2002, rk1048" msgstr "" -#: library/codecs.rst:1269 +#: library/codecs.rst:1312 msgid "Kazakh" msgstr "" -#: library/codecs.rst:1255 +#: library/codecs.rst:1298 msgid "mac_cyrillic" msgstr "" -#: library/codecs.rst:1255 +#: library/codecs.rst:1298 msgid "maccyrillic" msgstr "" -#: library/codecs.rst:1258 +#: library/codecs.rst:1301 msgid "mac_greek" msgstr "" -#: library/codecs.rst:1258 +#: library/codecs.rst:1301 msgid "macgreek" msgstr "" -#: library/codecs.rst:1260 +#: library/codecs.rst:1303 msgid "mac_iceland" msgstr "" -#: library/codecs.rst:1260 +#: library/codecs.rst:1303 msgid "maciceland" msgstr "" -#: library/codecs.rst:1262 +#: library/codecs.rst:1305 msgid "mac_latin2" msgstr "" -#: library/codecs.rst:1262 +#: library/codecs.rst:1305 msgid "maclatin2, maccentraleurope, mac_centeuro" msgstr "" -#: library/codecs.rst:1265 +#: library/codecs.rst:1308 msgid "mac_roman" msgstr "" -#: library/codecs.rst:1265 +#: library/codecs.rst:1308 msgid "macroman, macintosh" msgstr "" -#: library/codecs.rst:1267 +#: library/codecs.rst:1310 msgid "mac_turkish" msgstr "" -#: library/codecs.rst:1267 +#: library/codecs.rst:1310 msgid "macturkish" msgstr "" -#: library/codecs.rst:1269 +#: library/codecs.rst:1312 msgid "ptcp154" msgstr "" -#: library/codecs.rst:1269 +#: library/codecs.rst:1312 msgid "csptcp154, pt154, cp154, cyrillic-asian" msgstr "" -#: library/codecs.rst:1272 +#: library/codecs.rst:1315 msgid "shift_jis" msgstr "" -#: library/codecs.rst:1272 +#: library/codecs.rst:1315 msgid "csshiftjis, shiftjis, sjis, s_jis" msgstr "" -#: library/codecs.rst:1275 +#: library/codecs.rst:1318 msgid "shift_jis_2004" msgstr "" -#: library/codecs.rst:1275 +#: library/codecs.rst:1318 msgid "shiftjis2004, sjis_2004, sjis2004" msgstr "" -#: library/codecs.rst:1278 +#: library/codecs.rst:1321 msgid "shift_jisx0213" msgstr "" -#: library/codecs.rst:1278 +#: library/codecs.rst:1321 msgid "shiftjisx0213, sjisx0213, s_jisx0213" msgstr "" -#: library/codecs.rst:1281 +#: library/codecs.rst:1324 msgid "utf_32" msgstr "" -#: library/codecs.rst:1281 +#: library/codecs.rst:1324 msgid "U32, utf32" msgstr "" -#: library/codecs.rst:1283 library/codecs.rst:1287 library/codecs.rst:1291 -#: library/codecs.rst:1295 library/codecs.rst:1297 +#: library/codecs.rst:1326 library/codecs.rst:1330 library/codecs.rst:1334 +#: library/codecs.rst:1338 library/codecs.rst:1340 msgid "all languages" msgstr "" -#: library/codecs.rst:1283 +#: library/codecs.rst:1326 msgid "utf_32_be" msgstr "" -#: library/codecs.rst:1283 +#: library/codecs.rst:1326 msgid "UTF-32BE" msgstr "" -#: library/codecs.rst:1285 +#: library/codecs.rst:1328 msgid "utf_32_le" msgstr "" -#: library/codecs.rst:1285 +#: library/codecs.rst:1328 msgid "UTF-32LE" msgstr "" -#: library/codecs.rst:1287 +#: library/codecs.rst:1330 msgid "utf_16" msgstr "" -#: library/codecs.rst:1287 +#: library/codecs.rst:1330 msgid "U16, utf16" msgstr "" -#: library/codecs.rst:1289 +#: library/codecs.rst:1332 msgid "utf_16_be" msgstr "" -#: library/codecs.rst:1289 +#: library/codecs.rst:1332 msgid "UTF-16BE" msgstr "" -#: library/codecs.rst:1291 +#: library/codecs.rst:1334 msgid "utf_16_le" msgstr "" -#: library/codecs.rst:1291 +#: library/codecs.rst:1334 msgid "UTF-16LE" msgstr "" -#: library/codecs.rst:1293 +#: library/codecs.rst:1336 msgid "utf_7" msgstr "" -#: library/codecs.rst:1293 +#: library/codecs.rst:1336 msgid "U7, unicode-1-1-utf-7" msgstr "" -#: library/codecs.rst:1295 +#: library/codecs.rst:1338 msgid "utf_8" msgstr "" -#: library/codecs.rst:1295 +#: library/codecs.rst:1338 msgid "U8, UTF, utf8, cp65001" msgstr "" -#: library/codecs.rst:1297 +#: library/codecs.rst:1340 msgid "utf_8_sig" msgstr "" -#: library/codecs.rst:1300 +#: library/codecs.rst:1343 msgid "" "The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points " "(``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer " "decode byte sequences that correspond to surrogate code points." msgstr "" -#: library/codecs.rst:1306 +#: library/codecs.rst:1349 msgid "``cp65001`` is now an alias to ``utf_8``." msgstr "" -#: library/codecs.rst:1311 +#: library/codecs.rst:1352 +msgid "On Windows, ``cpXXX`` codecs are now available for all code pages." +msgstr "" + +#: library/codecs.rst:1357 msgid "Python Specific Encodings" msgstr "" -#: library/codecs.rst:1313 +#: library/codecs.rst:1359 msgid "" "A number of predefined codecs are specific to Python, so their codec names " "have no meaning outside Python. These are listed in the tables below based " @@ -2273,273 +2334,384 @@ msgid "" "asymmetric codecs, the stated meaning describes the encoding direction." msgstr "" -#: library/codecs.rst:1321 +#: library/codecs.rst:1367 msgid "Text Encodings" msgstr "" -#: library/codecs.rst:1323 +#: library/codecs.rst:1369 msgid "" "The following codecs provide :class:`str` to :class:`bytes` encoding and :" "term:`bytes-like object` to :class:`str` decoding, similar to the Unicode " "text encodings." msgstr "" -#: library/codecs.rst:1332 +#: library/codecs.rst:1378 msgid "idna" msgstr "" -#: library/codecs.rst:1332 +#: library/codecs.rst:1378 msgid "" "Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only " "``errors='strict'`` is supported." msgstr "" -#: library/codecs.rst:1338 +#: library/codecs.rst:1384 msgid "mbcs" msgstr "" -#: library/codecs.rst:1338 +#: library/codecs.rst:1384 msgid "ansi, dbcs" msgstr "" -#: library/codecs.rst:1338 +#: library/codecs.rst:1384 msgid "" "Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." msgstr "" -#: library/codecs.rst:1342 +#: library/codecs.rst:1388 msgid "oem" msgstr "" -#: library/codecs.rst:1342 +#: library/codecs.rst:1388 msgid "" "Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." msgstr "" -#: library/codecs.rst:1348 +#: library/codecs.rst:1394 msgid "palmos" msgstr "" -#: library/codecs.rst:1348 +#: library/codecs.rst:1394 msgid "Encoding of PalmOS 3.5." msgstr "" -#: library/codecs.rst:1350 +#: library/codecs.rst:1396 msgid "punycode" msgstr "" -#: library/codecs.rst:1350 +#: library/codecs.rst:1396 msgid "Implement :rfc:`3492`. Stateful codecs are not supported." msgstr "" -#: library/codecs.rst:1354 +#: library/codecs.rst:1400 msgid "raw_unicode_escape" msgstr "" -#: library/codecs.rst:1354 +#: library/codecs.rst:1400 msgid "" "Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for " "other code points. Existing backslashes are not escaped in any way. It is " "used in the Python pickle protocol." msgstr "" -#: library/codecs.rst:1364 +#: library/codecs.rst:1410 msgid "undefined" msgstr "" -#: library/codecs.rst:1364 +#: library/codecs.rst:1410 +msgid "This Codec should only be used for testing purposes." +msgstr "" + +#: library/codecs.rst:1414 msgid "" "Raise an exception for all conversions, even empty strings. The error " "handler is ignored." msgstr "" -#: library/codecs.rst:1369 +#: library/codecs.rst:1419 msgid "unicode_escape" msgstr "" -#: library/codecs.rst:1369 +#: library/codecs.rst:1419 msgid "" "Encoding suitable as the contents of a Unicode literal in ASCII-encoded " "Python source code, except that quotes are not escaped. Decode from Latin-1 " "source code. Beware that Python source code actually uses UTF-8 by default." msgstr "" -#: library/codecs.rst:1381 +#: library/codecs.rst:1431 msgid "\"unicode_internal\" codec is removed." msgstr "" -#: library/codecs.rst:1388 +#: library/codecs.rst:1438 msgid "Binary Transforms" msgstr "" -#: library/codecs.rst:1390 +#: library/codecs.rst:1440 msgid "" "The following codecs provide binary transforms: :term:`bytes-like object` " "to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` " "(which only produces :class:`str` output)." msgstr "" -#: library/codecs.rst:1398 +#: library/codecs.rst:1448 msgid "Encoder / decoder" msgstr "" -#: library/codecs.rst:1400 +#: library/codecs.rst:1450 msgid "base64_codec [#b64]_" msgstr "" -#: library/codecs.rst:1400 +#: library/codecs.rst:1450 msgid "base64, base_64" msgstr "" -#: library/codecs.rst:1400 +#: library/codecs.rst:1450 msgid "" "Convert the operand to multiline MIME base64 (the result always includes a " "trailing ``'\\n'``)." msgstr "" -#: library/codecs.rst:1405 +#: library/codecs.rst:1455 msgid "" "accepts any :term:`bytes-like object` as input for encoding and decoding" msgstr "" -#: library/codecs.rst:1400 +#: library/codecs.rst:1450 msgid ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" msgstr "" -#: library/codecs.rst:1411 +#: library/codecs.rst:1461 msgid "bz2_codec" msgstr "" -#: library/codecs.rst:1411 +#: library/codecs.rst:1461 msgid "bz2" msgstr "" -#: library/codecs.rst:1411 +#: library/codecs.rst:1461 msgid "Compress the operand using bz2." msgstr "" -#: library/codecs.rst:1411 +#: library/codecs.rst:1461 msgid ":meth:`bz2.compress` / :meth:`bz2.decompress`" msgstr "" -#: library/codecs.rst:1414 +#: library/codecs.rst:1464 msgid "hex_codec" msgstr "" -#: library/codecs.rst:1414 +#: library/codecs.rst:1464 msgid "hex" msgstr "" -#: library/codecs.rst:1414 +#: library/codecs.rst:1464 msgid "" "Convert the operand to hexadecimal representation, with two digits per byte." msgstr "" -#: library/codecs.rst:1414 +#: library/codecs.rst:1464 msgid ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" msgstr "" -#: library/codecs.rst:1419 +#: library/codecs.rst:1469 msgid "quopri_codec" msgstr "" -#: library/codecs.rst:1419 +#: library/codecs.rst:1469 msgid "quopri, quotedprintable, quoted_printable" msgstr "" -#: library/codecs.rst:1419 +#: library/codecs.rst:1469 msgid "Convert the operand to MIME quoted printable." msgstr "" -#: library/codecs.rst:1419 +#: library/codecs.rst:1469 msgid ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" msgstr "" -#: library/codecs.rst:1423 +#: library/codecs.rst:1473 msgid "uu_codec" msgstr "" -#: library/codecs.rst:1423 +#: library/codecs.rst:1473 msgid "uu" msgstr "" -#: library/codecs.rst:1423 +#: library/codecs.rst:1473 msgid "Convert the operand using uuencode." msgstr "" -#: library/codecs.rst:1423 -msgid "" -":meth:`!uu.encode` / :meth:`!uu.decode` (Note: :mod:`uu` is deprecated.)" -msgstr "" - -#: library/codecs.rst:1428 +#: library/codecs.rst:1476 msgid "zlib_codec" msgstr "" -#: library/codecs.rst:1428 +#: library/codecs.rst:1476 msgid "zip, zlib" msgstr "" -#: library/codecs.rst:1428 +#: library/codecs.rst:1476 msgid "Compress the operand using gzip." msgstr "" -#: library/codecs.rst:1428 +#: library/codecs.rst:1476 msgid ":meth:`zlib.compress` / :meth:`zlib.decompress`" msgstr "" -#: library/codecs.rst:1432 +#: library/codecs.rst:1480 msgid "" "In addition to :term:`bytes-like objects `, " "``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for " "decoding" msgstr "" -#: library/codecs.rst:1436 +#: library/codecs.rst:1484 msgid "Restoration of the binary transforms." msgstr "" -#: library/codecs.rst:1439 +#: library/codecs.rst:1487 msgid "Restoration of the aliases for the binary transforms." msgstr "" -#: library/codecs.rst:1446 +#: library/codecs.rst:1494 +msgid "Standalone Codec Functions" +msgstr "" + +#: library/codecs.rst:1496 +msgid "" +"The following functions provide encoding and decoding functionality similar " +"to codecs, but are not available as named codecs through :func:`codecs." +"encode` or :func:`codecs.decode`. They are used internally (for example, by :" +"mod:`pickle`) and behave similarly to the ``string_escape`` codec that was " +"removed in Python 3." +msgstr "" + +#: library/codecs.rst:1503 +msgid "" +"Encode *input* using escape sequences. Similar to how :func:`repr` on bytes " +"produces escaped byte values." +msgstr "" + +#: library/codecs.rst:1506 +msgid "*input* must be a :class:`bytes` object." +msgstr "" + +#: library/codecs.rst:1517 +msgid "" +"Returns a tuple ``(output, length)`` where *output* is a :class:`bytes` " +"object and *length* is the number of bytes consumed." +msgstr "" + +#: library/codecs.rst:1513 +msgid "Decode *input* from escape sequences back to the original bytes." +msgstr "" + +#: library/codecs.rst:1515 +msgid "*input* must be a :term:`bytes-like object`." +msgstr "" + +#: library/codecs.rst:1524 msgid "Text Transforms" msgstr "" -#: library/codecs.rst:1448 +#: library/codecs.rst:1526 msgid "" "The following codec provides a text transform: a :class:`str` to :class:" "`str` mapping. It is not supported by :meth:`str.encode` (which only " "produces :class:`bytes` output)." msgstr "" -#: library/codecs.rst:1457 +#: library/codecs.rst:1535 msgid "rot_13" msgstr "" -#: library/codecs.rst:1457 +#: library/codecs.rst:1535 msgid "rot13" msgstr "" -#: library/codecs.rst:1457 +#: library/codecs.rst:1535 msgid "Return the Caesar-cypher encryption of the operand." msgstr "" -#: library/codecs.rst:1462 +#: library/codecs.rst:1540 msgid "Restoration of the ``rot_13`` text transform." msgstr "" -#: library/codecs.rst:1465 +#: library/codecs.rst:1543 msgid "Restoration of the ``rot13`` alias." msgstr "" -#: library/codecs.rst:1470 +#: library/codecs.rst:1548 +msgid ":mod:`encodings` --- Encodings package" +msgstr "" + +#: library/codecs.rst:1553 +msgid "This module implements the following functions:" +msgstr "" + +#: library/codecs.rst:1557 +msgid "Normalize encoding name *encoding*." +msgstr "" + +#: library/codecs.rst:1559 +msgid "" +"Normalization works as follows: all non-alphanumeric characters except the " +"dot used for Python package names are collapsed and replaced with a single " +"underscore, leading and trailing underscores are removed. For example, ``' " +"-;#'`` becomes ``'_'``." +msgstr "" + +#: library/codecs.rst:1564 +msgid "Note that *encoding* should be ASCII only." +msgstr "" + +#: library/codecs.rst:1568 +msgid "" +"The following functions should not be used directly, except for testing " +"purposes; :func:`codecs.lookup` should be used instead." +msgstr "" + +#: library/codecs.rst:1574 +msgid "" +"Search for the codec module corresponding to the given encoding name " +"*encoding*." +msgstr "" + +#: library/codecs.rst:1577 +msgid "" +"This function first normalizes the *encoding* using :func:" +"`normalize_encoding`, then looks for a corresponding alias. It attempts to " +"import a codec module from the encodings package using either the alias or " +"the normalized name. If the module is found and defines a valid " +"``getregentry()`` function that returns a :class:`codecs.CodecInfo` object, " +"the codec is cached and returned." +msgstr "" + +#: library/codecs.rst:1584 +msgid "" +"If the codec module defines a ``getaliases()`` function any returned aliases " +"are registered for future use." +msgstr "" + +#: library/codecs.rst:1590 +msgid "" +"Search for a Windows code page encoding *encoding* of the form ``cpXXXX``." +msgstr "" + +#: library/codecs.rst:1592 +msgid "" +"If the code page is valid and supported, return a :class:`codecs.CodecInfo` " +"object for it." +msgstr "" + +#: library/codecs.rst:1681 +msgid "Availability" +msgstr "" + +#: library/codecs.rst:1600 +msgid "This module implements the following exception:" +msgstr "" + +#: library/codecs.rst:1604 +msgid "Raised when a codec is invalid or incompatible." +msgstr "" + +#: library/codecs.rst:1608 msgid "" ":mod:`encodings.idna` --- Internationalized Domain Names in Applications" msgstr "" -#: library/codecs.rst:1476 +#: library/codecs.rst:1614 msgid "" "This module implements :rfc:`3490` (Internationalized Domain Names in " "Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for " @@ -2547,13 +2719,13 @@ msgid "" "encoding and :mod:`stringprep`." msgstr "" -#: library/codecs.rst:1481 +#: library/codecs.rst:1619 msgid "" "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " -"third-party `idna module `_." +"third-party :pypi:`idna` module." msgstr "" -#: library/codecs.rst:1484 +#: library/codecs.rst:1622 msgid "" "These RFCs together define a protocol to support non-ASCII characters in " "domain names. A domain name containing non-ASCII characters (such as ``www." @@ -2567,7 +2739,7 @@ msgid "" "presenting them to the user." msgstr "" -#: library/codecs.rst:1495 +#: library/codecs.rst:1633 msgid "" "Python supports this conversion in several ways: the ``idna`` codec " "performs conversion between Unicode and ACE, separating an input string into " @@ -2584,14 +2756,14 @@ msgid "" "sends that field at all)." msgstr "" -#: library/codecs.rst:1508 +#: library/codecs.rst:1646 msgid "" "When receiving host names from the wire (such as in reverse name lookup), no " "automatic conversion to Unicode is performed: applications wishing to " "present such host names to the user should decode them to Unicode." msgstr "" -#: library/codecs.rst:1512 +#: library/codecs.rst:1650 msgid "" "The module :mod:`encodings.idna` also implements the nameprep procedure, " "which performs certain normalizations on host names, to achieve case-" @@ -2599,49 +2771,45 @@ msgid "" "characters. The nameprep functions can be used directly if desired." msgstr "" -#: library/codecs.rst:1520 +#: library/codecs.rst:1658 msgid "" "Return the nameprepped version of *label*. The implementation currently " "assumes query strings, so ``AllowUnassigned`` is true." msgstr "" -#: library/codecs.rst:1526 +#: library/codecs.rst:1664 msgid "" "Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` " "is assumed to be false." msgstr "" -#: library/codecs.rst:1532 +#: library/codecs.rst:1670 msgid "Convert a label to Unicode, as specified in :rfc:`3490`." msgstr "" -#: library/codecs.rst:1536 +#: library/codecs.rst:1674 msgid ":mod:`encodings.mbcs` --- Windows ANSI codepage" msgstr "" -#: library/codecs.rst:1541 +#: library/codecs.rst:1679 msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "" -#: library/codecs.rst:1543 -msgid ":ref:`Availability `: Windows." -msgstr "" - -#: library/codecs.rst:1545 +#: library/codecs.rst:1683 msgid "" "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " "to encode, and ``'ignore'`` to decode." msgstr "" -#: library/codecs.rst:1549 +#: library/codecs.rst:1687 msgid "Support any error handler." msgstr "" -#: library/codecs.rst:1554 +#: library/codecs.rst:1692 msgid ":mod:`encodings.utf_8_sig` --- UTF-8 codec with BOM signature" msgstr "" -#: library/codecs.rst:1560 +#: library/codecs.rst:1698 msgid "" "This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 " "encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful " @@ -2670,70 +2838,70 @@ msgstr "" msgid "stackable" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "strict" msgstr "" -#: library/codecs.rst:364 library/codecs.rst:387 +#: library/codecs.rst:390 library/codecs.rst:413 msgid "error handler's name" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "ignore" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "replace" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "backslashreplace" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "surrogateescape" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "? (question mark)" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "replacement character" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "\\ (backslash)" msgstr "" -#: library/codecs.rst:364 +#: library/codecs.rst:390 msgid "escape sequence" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "\\x" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "\\u" msgstr "" -#: library/codecs.rst:312 +#: library/codecs.rst:338 msgid "\\U" msgstr "" -#: library/codecs.rst:364 +#: library/codecs.rst:390 msgid "xmlcharrefreplace" msgstr "" -#: library/codecs.rst:364 +#: library/codecs.rst:390 msgid "namereplace" msgstr "" -#: library/codecs.rst:364 +#: library/codecs.rst:390 msgid "\\N" msgstr "" -#: library/codecs.rst:387 +#: library/codecs.rst:413 msgid "surrogatepass" msgstr "" diff --git a/library/codeop.po b/library/codeop.po index 250dffca..7b7bc177 100644 --- a/library/codeop.po +++ b/library/codeop.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/codeop.rst:2 -msgid ":mod:`codeop` --- Compile Python code" +msgid ":mod:`!codeop` --- Compile Python code" msgstr "" #: library/codeop.rst:10 diff --git a/library/collections.abc.po b/library/collections.abc.po index 781c5039..43ac7612 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -8,25 +8,26 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/collections.abc.rst:2 -msgid ":mod:`collections.abc` --- Abstract Base Classes for Containers" -msgstr "" +msgid ":mod:`!collections.abc` --- Abstract Base Classes for Containers" +msgstr ":mod:`!collections.abc` --- Αφηρημένες Βασικές Κλάσεις για Containers" #: library/collections.abc.rst:10 msgid "Formerly, this module was part of the :mod:`collections` module." -msgstr "" +msgstr "Παλαιότερα, αυτό το module ήταν μέρος του :mod:`collections` module." #: library/collections.abc.rst:13 msgid "**Source code:** :source:`Lib/_collections_abc.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/_collections_abc.py`" #: library/collections.abc.rst:23 msgid "" @@ -35,30 +36,110 @@ msgid "" "for example, whether it is :term:`hashable` or whether it is a :term:" "`mapping`." msgstr "" +"Αυτό το module παρέχει :term:`αφηρημένες βασικές κλάσεις ` που μπορούν να χρησιμοποιηθούν για να ελεγχθεί εάν μια κλάση παρέχει " +"μια συγκεκριμένη διεπαφή· για παράδειγμα, εάν είναι :term:`hashable` ή εάν " +"είναι :term:`mapping`." #: library/collections.abc.rst:27 msgid "" "An :func:`issubclass` or :func:`isinstance` test for an interface works in " "one of three ways." msgstr "" +"Ένας έλεγχος :func:`issubclass` ή :func:`isinstance` για μια διεπαφή " +"λειτουργεί με έναν από τρεις τρόπους." #: library/collections.abc.rst:30 msgid "" -"1) A newly written class can inherit directly from one of the abstract base " +"A newly written class can inherit directly from one of the abstract base " "classes. The class must supply the required abstract methods. The " "remaining mixin methods come from inheritance and can be overridden if " "desired. Other methods may be added as needed:" msgstr "" +"Μια νέα γραμμένη κλάση μπορεί να κληρονομήσει άμεσα από τις αφηρημένες " +"βασικές κλάσεις. Η κλάση πρέπει να παρέχει τις απαιτούμενες αφηρημένες " +"μεθόδους. Οι υπόλοιπες μέθοδοι mixin προέρχονται από την κληρονομικότητα και " +"μπορούν να παρακαμφθούν αν χρειάζεται. Άλλες μέθοδοι μπορούν να προστεθούν " +"όταν είναι αναγκαίο:" + +#: library/collections.abc.rst:35 +msgid "" +"class C(Sequence): # Direct inheritance\n" +" def __init__(self): ... # Extra method not required by the " +"ABC\n" +" def __getitem__(self, index): ... # Required abstract method\n" +" def __len__(self): ... # Required abstract method\n" +" def count(self, value): ... # Optionally override a mixin method" +msgstr "" +"class C(Sequence): # Direct inheritance\n" +" def __init__(self): ... # Extra method not required by the " +"ABC\n" +" def __getitem__(self, index): ... # Required abstract method\n" +" def __len__(self): ... # Required abstract method\n" +" def count(self, value): ... # Optionally override a mixin method" + +#: library/collections.abc.rst:43 +msgid "" +">>> issubclass(C, Sequence)\n" +"True\n" +">>> isinstance(C(), Sequence)\n" +"True" +msgstr "" +">>> issubclass(C, Sequence)\n" +"True\n" +">>> isinstance(C(), Sequence)\n" +"True" #: library/collections.abc.rst:50 msgid "" -"2) Existing classes and built-in classes can be registered as \"virtual " +"Existing classes and built-in classes can be registered as \"virtual " "subclasses\" of the ABCs. Those classes should define the full API " "including all of the abstract methods and all of the mixin methods. This " "lets users rely on :func:`issubclass` or :func:`isinstance` tests to " "determine whether the full interface is supported. The exception to this " "rule is for methods that are automatically inferred from the rest of the API:" msgstr "" +"Υπάρχουσες κλάσεις και ενσωματωμένες κλάσεις μπορούν να καταχωρηθούν ως " +"\"εικονικές υποκλάσεις\" των ABCs. Αυτές οι κλάσεις θα πρέπει να ορίζουν το " +"πλήρες API, συμπεριλαμβανομένων όλων των αφηρημένων μεθόδων και όλων των " +"μεθόδων mixin. Αυτό επιτρέπει στους χρήστες να βασίζονται στους ελέγχους :" +"func:`issubclass` ή :func:`isinstance` για να καθορίσουν εάν υποστηρίζεται η " +"πλήρης διεπαφή. Η εξαίρεση σε αυτό τον κανόνα είναι για τις μεθόδους που " +"προσδιορίζονται αυτόματα από το υπόλοιπο API:" + +#: library/collections.abc.rst:58 +msgid "" +"class D: # No inheritance\n" +" def __init__(self): ... # Extra method not required by the " +"ABC\n" +" def __getitem__(self, index): ... # Abstract method\n" +" def __len__(self): ... # Abstract method\n" +" def count(self, value): ... # Mixin method\n" +" def index(self, value): ... # Mixin method\n" +"\n" +"Sequence.register(D) # Register instead of inherit" +msgstr "" +"class D: # No inheritance\n" +" def __init__(self): ... # Extra method not required by the " +"ABC\n" +" def __getitem__(self, index): ... # Abstract method\n" +" def __len__(self): ... # Abstract method\n" +" def count(self, value): ... # Mixin method\n" +" def index(self, value): ... # Mixin method\n" +"\n" +"Sequence.register(D) # Register instead of inherit" + +#: library/collections.abc.rst:69 +msgid "" +">>> issubclass(D, Sequence)\n" +"True\n" +">>> isinstance(D(), Sequence)\n" +"True" +msgstr "" +">>> issubclass(D, Sequence)\n" +"True\n" +">>> isinstance(D(), Sequence)\n" +"True" #: library/collections.abc.rst:76 msgid "" @@ -68,14 +149,44 @@ msgid "" "`reversed` function automatically fall back to using ``__getitem__`` and " "``__len__``." msgstr "" +"Σε αυτό το παράδειγμα, η κλάση :class:`!D` δεν χρειάζεται να ορίσει τις " +"μεθόδους ``__contains__``, ``__iter__``, και ``__reversed__`` επειδή ο " +"τελεστής :ref:`in-operator `, η λογική :term:`iteration " +"`, και η συνάρτηση :func:`reversed` χρησιμοποιούν αυτόματα τις " +"μεθόδους ``__getitem__`` και ``__len__``." #: library/collections.abc.rst:82 msgid "" -"3) Some simple interfaces are directly recognizable by the presence of the " +"Some simple interfaces are directly recognizable by the presence of the " "required methods (unless those methods have been set to :const:`None`):" msgstr "" +"Ορισμένες απλές διεπαφές είναι άμεσα αναγνωρίσιμες από την παρουσία των " +"απαιτούμενων μεθόδων (εκτός αν αυτές οι μέθοδοι έχουν οριστεί σε :const:" +"`None`):" + +#: library/collections.abc.rst:85 +msgid "" +"class E:\n" +" def __iter__(self): ...\n" +" def __next__(self): ..." +msgstr "" +"class E:\n" +" def __iter__(self): ...\n" +" def __next__(self): ..." + +#: library/collections.abc.rst:91 +msgid "" +">>> issubclass(E, Iterable)\n" +"True\n" +">>> isinstance(E(), Iterable)\n" +"True" +msgstr "" +">>> issubclass(E, Iterable)\n" +"True\n" +">>> isinstance(E(), Iterable)\n" +"True" -#: library/collections.abc.rst:99 +#: library/collections.abc.rst:98 msgid "" "Complex interfaces do not support this last technique because an interface " "is more than just the presence of method names. Interfaces specify " @@ -84,325 +195,354 @@ msgid "" "class supplies ``__getitem__``, ``__len__``, and ``__iter__`` is " "insufficient for distinguishing a :class:`Sequence` from a :class:`Mapping`." msgstr "" +"Οι σύνθετες διεπαφές δεν υποστηρίζουν αυτή την τελευταία τεχνική επειδή μια " +"διεπαφή είναι κάτι περισσότερο από την παρουσία ονομάτων μεθόδων. Οι " +"διεπαφές καθορίζουν τη σημασιολογία και τις σχέσεις μεταξύ των μεθόδων που " +"δεν μπορούν να συναχθούν αποκλειστικά από την παρουσία συγκεκριμένων " +"ονομάτων μεθόδων. Για παράδειγμα, η γνώση ότι μια κλάση παρέχει τις μεθόδους " +"``__getitem__``, ``__len__`` και ``__iter__`` δεν είναι επαρκής για να " +"διακρίνει μια κλάση :class:`Sequence` από μια κλάση :class:`Mapping`." -#: library/collections.abc.rst:107 +#: library/collections.abc.rst:106 msgid "" "These abstract classes now support ``[]``. See :ref:`types-genericalias` " "and :pep:`585`." msgstr "" +"Αυτές οι αφηρημένες κλάσεις υποστηρίζουν πλέον ``[]``. Δείτε :ref:`types-" +"genericalias` και :pep:`585`." -#: library/collections.abc.rst:114 +#: library/collections.abc.rst:113 msgid "Collections Abstract Base Classes" -msgstr "" +msgstr "Αφηρημένες Βασικές Κλάσεις Συλλογών" -#: library/collections.abc.rst:116 +#: library/collections.abc.rst:115 msgid "" "The collections module offers the following :term:`ABCs `:" msgstr "" +"Το collections module προσφέρει τις εξής :term:`ABCs `:" -#: library/collections.abc.rst:121 +#: library/collections.abc.rst:120 msgid "ABC" -msgstr "" +msgstr "ABC" -#: library/collections.abc.rst:121 +#: library/collections.abc.rst:120 msgid "Inherits from" -msgstr "" +msgstr "Κληρονομεί από" -#: library/collections.abc.rst:121 +#: library/collections.abc.rst:120 msgid "Abstract Methods" -msgstr "" +msgstr "Αφηρημένες Μέθοδοι" -#: library/collections.abc.rst:121 +#: library/collections.abc.rst:120 msgid "Mixin Methods" -msgstr "" +msgstr "Mixin Μέθοδοι" -#: library/collections.abc.rst:123 +#: library/collections.abc.rst:122 msgid ":class:`Container` [1]_" -msgstr "" +msgstr ":class:`Container` [1]_" -#: library/collections.abc.rst:123 +#: library/collections.abc.rst:122 msgid "``__contains__``" -msgstr "" +msgstr "``__contains__``" -#: library/collections.abc.rst:124 +#: library/collections.abc.rst:123 msgid ":class:`Hashable` [1]_" -msgstr "" +msgstr ":class:`Hashable` [1]_" -#: library/collections.abc.rst:124 +#: library/collections.abc.rst:123 msgid "``__hash__``" -msgstr "" +msgstr "``__hash__``" -#: library/collections.abc.rst:125 +#: library/collections.abc.rst:124 msgid ":class:`Iterable` [1]_ [2]_" -msgstr "" +msgstr ":class:`Iterable` [1]_ [2]_" -#: library/collections.abc.rst:125 library/collections.abc.rst:126 +#: library/collections.abc.rst:124 library/collections.abc.rst:125 msgid "``__iter__``" -msgstr "" +msgstr "``__iter__``" -#: library/collections.abc.rst:126 +#: library/collections.abc.rst:125 msgid ":class:`Iterator` [1]_" -msgstr "" +msgstr ":class:`Iterator` [1]_" -#: library/collections.abc.rst:126 library/collections.abc.rst:127 +#: library/collections.abc.rst:125 library/collections.abc.rst:126 msgid ":class:`Iterable`" -msgstr "" +msgstr ":class:`Iterable`" -#: library/collections.abc.rst:126 +#: library/collections.abc.rst:125 msgid "``__next__``" -msgstr "" +msgstr "``__next__``" -#: library/collections.abc.rst:127 +#: library/collections.abc.rst:126 msgid ":class:`Reversible` [1]_" -msgstr "" +msgstr ":class:`Reversible` [1]_" -#: library/collections.abc.rst:127 +#: library/collections.abc.rst:126 msgid "``__reversed__``" -msgstr "" +msgstr "``__reversed__``" -#: library/collections.abc.rst:128 +#: library/collections.abc.rst:127 msgid ":class:`Generator` [1]_" -msgstr "" +msgstr ":class:`Generator` [1]_" -#: library/collections.abc.rst:128 +#: library/collections.abc.rst:127 msgid ":class:`Iterator`" -msgstr "" +msgstr ":class:`Iterator`" -#: library/collections.abc.rst:128 library/collections.abc.rst:176 +#: library/collections.abc.rst:127 library/collections.abc.rst:176 msgid "``send``, ``throw``" -msgstr "" +msgstr "``send``, ``throw``" -#: library/collections.abc.rst:128 +#: library/collections.abc.rst:127 msgid "``close``, ``__iter__``, ``__next__``" -msgstr "" +msgstr "``close``, ``__iter__``, ``__next__``" -#: library/collections.abc.rst:129 +#: library/collections.abc.rst:128 msgid ":class:`Sized` [1]_" -msgstr "" +msgstr ":class:`Sized` [1]_" -#: library/collections.abc.rst:129 library/collections.abc.rst:168 +#: library/collections.abc.rst:128 msgid "``__len__``" -msgstr "" +msgstr "``__len__``" -#: library/collections.abc.rst:130 +#: library/collections.abc.rst:129 msgid ":class:`Callable` [1]_" -msgstr "" +msgstr ":class:`Callable` [1]_" -#: library/collections.abc.rst:130 +#: library/collections.abc.rst:129 msgid "``__call__``" -msgstr "" +msgstr "``__call__``" -#: library/collections.abc.rst:131 +#: library/collections.abc.rst:130 msgid ":class:`Collection` [1]_" -msgstr "" +msgstr ":class:`Collection` [1]_" -#: library/collections.abc.rst:131 +#: library/collections.abc.rst:130 msgid ":class:`Sized`, :class:`Iterable`, :class:`Container`" -msgstr "" +msgstr ":class:`Sized`, :class:`Iterable`, :class:`Container`" -#: library/collections.abc.rst:131 library/collections.abc.rst:147 +#: library/collections.abc.rst:130 library/collections.abc.rst:146 msgid "``__contains__``, ``__iter__``, ``__len__``" -msgstr "" +msgstr "``__contains__``, ``__iter__``, ``__len__``" -#: library/collections.abc.rst:135 library/collections.abc.rst:138 -#: library/collections.abc.rst:144 +#: library/collections.abc.rst:134 library/collections.abc.rst:137 +#: library/collections.abc.rst:143 msgid ":class:`Sequence`" -msgstr "" +msgstr ":class:`Sequence`" -#: library/collections.abc.rst:135 +#: library/collections.abc.rst:134 msgid ":class:`Reversible`, :class:`Collection`" -msgstr "" +msgstr ":class:`Reversible`, :class:`Collection`" -#: library/collections.abc.rst:135 library/collections.abc.rst:144 +#: library/collections.abc.rst:134 library/collections.abc.rst:143 msgid "``__getitem__``, ``__len__``" -msgstr "" +msgstr "``__getitem__``, ``__len__``" -#: library/collections.abc.rst:135 +#: library/collections.abc.rst:134 msgid "" "``__contains__``, ``__iter__``, ``__reversed__``, ``index``, and ``count``" msgstr "" +"``__contains__``, ``__iter__``, ``__reversed__``, ``index``, and ``count``" -#: library/collections.abc.rst:138 +#: library/collections.abc.rst:137 msgid ":class:`MutableSequence`" -msgstr "" +msgstr ":class:`MutableSequence`" -#: library/collections.abc.rst:138 +#: library/collections.abc.rst:137 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__len__``, ``insert``" msgstr "" +"``__getitem__``, ``__setitem__``, ``__delitem__``, ``__len__``, ``insert``" -#: library/collections.abc.rst:138 +#: library/collections.abc.rst:137 msgid "" "Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, " "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" +"Κληρονομημένες :class:`Sequence` μέθοδοι και ``append``, ``clear``, " +"``reverse``, ``extend``, ``pop``, ``remove``, and ``__iadd__``" -#: library/collections.abc.rst:144 +#: library/collections.abc.rst:143 msgid ":class:`ByteString`" -msgstr "" +msgstr ":class:`ByteString`" -#: library/collections.abc.rst:144 +#: library/collections.abc.rst:143 msgid "Inherited :class:`Sequence` methods" -msgstr "" +msgstr "Κληρονομημένες :class:`Sequence` μέθοδοι" -#: library/collections.abc.rst:147 library/collections.abc.rst:151 +#: library/collections.abc.rst:146 library/collections.abc.rst:151 msgid ":class:`Set`" -msgstr "" +msgstr ":class:`Set`" -#: library/collections.abc.rst:147 library/collections.abc.rst:157 +#: library/collections.abc.rst:146 library/collections.abc.rst:157 msgid ":class:`Collection`" -msgstr "" +msgstr ":class:`Collection`" -#: library/collections.abc.rst:147 +#: library/collections.abc.rst:146 msgid "" "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " -"``__and__``, ``__or__``, ``__sub__``, ``__xor__``, and ``isdisjoint``" +"``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " +"``__rxor__`` and ``isdisjoint``" msgstr "" +"``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " +"``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " +"``__rxor__`` και ``isdisjoint``" #: library/collections.abc.rst:151 msgid ":class:`MutableSet`" -msgstr "" +msgstr ":class:`MutableSet`" #: library/collections.abc.rst:151 msgid "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" -msgstr "" +msgstr "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" #: library/collections.abc.rst:151 msgid "" "Inherited :class:`Set` methods and ``clear``, ``pop``, ``remove``, " "``__ior__``, ``__iand__``, ``__ixor__``, and ``__isub__``" msgstr "" +"Κληρονομημένες :class:`Set` μέθοδοι και ``clear``, ``pop``, ``remove``, " +"``__ior__``, ``__iand__``, ``__ixor__``, και ``__isub__``" #: library/collections.abc.rst:157 library/collections.abc.rst:161 msgid ":class:`Mapping`" -msgstr "" +msgstr ":class:`Mapping`" #: library/collections.abc.rst:157 msgid "``__getitem__``, ``__iter__``, ``__len__``" -msgstr "" +msgstr "``__getitem__``, ``__iter__``, ``__len__``" #: library/collections.abc.rst:157 msgid "" "``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, and " "``__ne__``" msgstr "" +"``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, και " +"``__ne__``" #: library/collections.abc.rst:161 msgid ":class:`MutableMapping`" -msgstr "" +msgstr ":class:`MutableMapping`" #: library/collections.abc.rst:161 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" msgstr "" +"``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" #: library/collections.abc.rst:161 msgid "" "Inherited :class:`Mapping` methods and ``pop``, ``popitem``, ``clear``, " "``update``, and ``setdefault``" msgstr "" +"Κληρονομημένες :class:`Mapping` μέθοδοι και ``pop``, ``popitem``, ``clear``, " +"``update``, και ``setdefault``" #: library/collections.abc.rst:168 msgid ":class:`MappingView`" -msgstr "" +msgstr ":class:`MappingView`" #: library/collections.abc.rst:168 msgid ":class:`Sized`" -msgstr "" +msgstr ":class:`Sized`" + +#: library/collections.abc.rst:168 +msgid "``__init__``, ``__len__`` and ``__repr__``" +msgstr "``__init__``, ``__len__`` and ``__repr__``" #: library/collections.abc.rst:169 msgid ":class:`ItemsView`" -msgstr "" +msgstr ":class:`ItemsView`" #: library/collections.abc.rst:169 library/collections.abc.rst:171 msgid ":class:`MappingView`, :class:`Set`" -msgstr "" +msgstr ":class:`MappingView`, :class:`Set`" #: library/collections.abc.rst:169 library/collections.abc.rst:171 #: library/collections.abc.rst:173 msgid "``__contains__``, ``__iter__``" -msgstr "" +msgstr "``__contains__``, ``__iter__``" #: library/collections.abc.rst:171 msgid ":class:`KeysView`" -msgstr "" +msgstr ":class:`KeysView`" #: library/collections.abc.rst:173 msgid ":class:`ValuesView`" -msgstr "" +msgstr ":class:`ValuesView`" #: library/collections.abc.rst:173 msgid ":class:`MappingView`, :class:`Collection`" -msgstr "" +msgstr ":class:`MappingView`, :class:`Collection`" #: library/collections.abc.rst:175 msgid ":class:`Awaitable` [1]_" -msgstr "" +msgstr ":class:`Awaitable` [1]_" #: library/collections.abc.rst:175 msgid "``__await__``" -msgstr "" +msgstr "``__await__``" #: library/collections.abc.rst:176 msgid ":class:`Coroutine` [1]_" -msgstr "" +msgstr ":class:`Coroutine` [1]_" #: library/collections.abc.rst:176 msgid ":class:`Awaitable`" -msgstr "" +msgstr ":class:`Awaitable`" #: library/collections.abc.rst:176 msgid "``close``" -msgstr "" +msgstr "``close``" #: library/collections.abc.rst:177 msgid ":class:`AsyncIterable` [1]_" -msgstr "" +msgstr ":class:`AsyncIterable` [1]_" #: library/collections.abc.rst:177 library/collections.abc.rst:178 msgid "``__aiter__``" -msgstr "" +msgstr "``__aiter__``" #: library/collections.abc.rst:178 msgid ":class:`AsyncIterator` [1]_" -msgstr "" +msgstr ":class:`AsyncIterator` [1]_" #: library/collections.abc.rst:178 msgid ":class:`AsyncIterable`" -msgstr "" +msgstr ":class:`AsyncIterable`" #: library/collections.abc.rst:178 msgid "``__anext__``" -msgstr "" +msgstr "``__anext__``" #: library/collections.abc.rst:179 msgid ":class:`AsyncGenerator` [1]_" -msgstr "" +msgstr ":class:`AsyncGenerator` [1]_" #: library/collections.abc.rst:179 msgid ":class:`AsyncIterator`" -msgstr "" +msgstr ":class:`AsyncIterator`" #: library/collections.abc.rst:179 msgid "``asend``, ``athrow``" -msgstr "" +msgstr "``asend``, ``athrow``" #: library/collections.abc.rst:179 msgid "``aclose``, ``__aiter__``, ``__anext__``" -msgstr "" +msgstr "``aclose``, ``__aiter__``, ``__anext__``" #: library/collections.abc.rst:180 msgid ":class:`Buffer` [1]_" -msgstr "" +msgstr ":class:`Buffer` [1]_" #: library/collections.abc.rst:180 msgid "``__buffer__``" -msgstr "" +msgstr "``__buffer__``" #: library/collections.abc.rst:185 msgid "Footnotes" -msgstr "" +msgstr "Υποσημειώσεις" #: library/collections.abc.rst:186 msgid "" @@ -411,6 +551,11 @@ msgid "" "set to :const:`None`. This only works for simple interfaces. More complex " "interfaces require registration or direct subclassing." msgstr "" +"Αυτές οι ABCs παρακάμπτουν την μέθοδο :meth:`~abc.ABCMeta.__subclasshook__` " +"για να υποστηρίξουν τον έλεγχο μιας διεπαφής μέσω της επαλήθευσης της " +"παρουσίας των απαιτούμενων μεθόδων και του ότι δεν έχουν ρυθμιστεί σε :const:" +"`None`. Αυτό λειτουργεί μόνο για απλές διεπαφές. Πιο σύνθετες διεπαφές " +"απαιτούν εγγραφή ή άμεση υποκλάση." #: library/collections.abc.rst:192 msgid "" @@ -420,32 +565,46 @@ msgid "" "method. The only reliable way to determine whether an object is :term:" "`iterable` is to call ``iter(obj)``." msgstr "" +"Ο έλεγχος ``isinstance(obj, Iterable)`` εντοπίζει κλάσεις που είναι " +"καταχωρημένες ως :class:`Iterable` ή που έχουν την μέθοδο :meth:`~container." +"__iter__`, αλλά δεν εντοπίζει τις κλάσεις που πραγματοποιούν επανάληψη με τη " +"μέθοδο :meth:`~object.__getitem__`. Ο μόνος αξιόπιστος τρόπος για να " +"προσδιοριστεί αν ένα αντικείμενο είναι :term:`iterable` είναι να καλέσετε " +"``iter(obj)``." #: library/collections.abc.rst:200 msgid "Collections Abstract Base Classes -- Detailed Descriptions" -msgstr "" +msgstr "Αφηρημένες Βασικές Κλάσεις Συλλογών -- Αναλυτικές Περιγραφές" #: library/collections.abc.rst:205 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." -msgstr "" +msgstr "ABC για κλάσεις που παρέχουν την μέθοδο :meth:`~object.__contains__`." #: library/collections.abc.rst:209 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." -msgstr "" +msgstr "ABC για κλάσεις που παρέχουν την μέθοδο :meth:`~object.__hash__`." #: library/collections.abc.rst:213 msgid "ABC for classes that provide the :meth:`~object.__len__` method." -msgstr "" +msgstr "ABC για κλάσεις που παρέχουν την μέθοδο :meth:`~object.__len__`." #: library/collections.abc.rst:217 msgid "ABC for classes that provide the :meth:`~object.__call__` method." +msgstr "ABC για κλάσεις που παρέχουν την μέθοδο :meth:`~object.__call__`." + +#: library/collections.abc.rst:219 +msgid "" +"See :ref:`annotating-callables` for details on how to use :class:`!Callable` " +"in type annotations." msgstr "" +"Ανατρέξτε στο :ref:`annotating-callables` για λεπτομέρειες σχετικά με τον " +"τρόπο χρήσης του :class:`!Callable` σε τύπους annotations." -#: library/collections.abc.rst:221 +#: library/collections.abc.rst:224 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." -msgstr "" +msgstr "ABC για κλάσεις που παρέχουν την μέθοδο :meth:`~container.__iter__`." -#: library/collections.abc.rst:223 +#: library/collections.abc.rst:226 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " @@ -453,93 +612,192 @@ msgid "" "method. The only reliable way to determine whether an object is :term:" "`iterable` is to call ``iter(obj)``." msgstr "" +"Ο έλεγχος ``isinstance(obj, Iterable)`` εντοπίζει κλάσεις που είναι " +"καταχωρημένες ως :class:`Iterable` ή που διαθέτουν τη μέθοδο :meth:" +"`~container.__iter__`, αλλά δεν εντοπίζει κλάσεις που πραγματοποιούν " +"επανάληψη με τη μέθοδο :meth:`~object.__getitem__`. Ο μόνος αξιόπιστος " +"τρόπος για να προσδιοριστεί αν ένα αντικείμενο είναι :term:`iterable` είναι " +"να κληθεί ``iter(obj)``." -#: library/collections.abc.rst:232 +#: library/collections.abc.rst:235 msgid "ABC for sized iterable container classes." -msgstr "" +msgstr "ABC για τις κλάσεις επαναλαμβανόμενων container με μέγεθος." -#: library/collections.abc.rst:238 +#: library/collections.abc.rst:241 msgid "" "ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" "`~iterator.__next__` methods. See also the definition of :term:`iterator`." msgstr "" +"ABC για κλάσεις που παρέχουν τις μεθόδους :meth:`~iterator.__iter__` και :" +"meth:`~iterator.__next__`. Δείτε επίσης τον ορισμό του :term:`iterator`." -#: library/collections.abc.rst:244 +#: library/collections.abc.rst:247 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." msgstr "" +"ABC για τις επαναλαμβανόμενες κλάσεις που παρέχουν επίσης τη μέθοδο :meth:" +"`~object.__reversed__`." -#: library/collections.abc.rst:251 +#: library/collections.abc.rst:254 msgid "" "ABC for :term:`generator` classes that implement the protocol defined in :" "pep:`342` that extends :term:`iterators ` with the :meth:" "`~generator.send`, :meth:`~generator.throw` and :meth:`~generator.close` " "methods." msgstr "" +"ABC για τις κλάσεις :term:`generator` που υλοποιούν το πρωτόκολλο που " +"ορίζεται στο :pep:`342` το οποίο επεκτείνει τους :term:`iterators " +"` με τις μεθόδους :meth:`~generator.send`, :meth:`~generator." +"throw` και :meth:`~generator.close`." -#: library/collections.abc.rst:262 +#: library/collections.abc.rst:259 +msgid "" +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!Generator` in type annotations." +msgstr "" +"Δείτε. :ref:`annotating-generators-and-coroutines` για λεπτομέρειες σχετικά " +"με τη χρήση του :class:`!Generator` σε τύπους annotations." + +#: library/collections.abc.rst:268 msgid "ABCs for read-only and mutable :term:`sequences `." msgstr "" +"ABCs μόνο για ανάγνωση (read-only) και mutable :term:`sequences `." -#: library/collections.abc.rst:264 +#: library/collections.abc.rst:270 msgid "" "Implementation note: Some of the mixin methods, such as :meth:`~container." -"__iter__`, :meth:`~object.__reversed__` and :meth:`index`, make repeated " -"calls to the underlying :meth:`~object.__getitem__` method. Consequently, " -"if :meth:`~object.__getitem__` is implemented with constant access speed, " -"the mixin methods will have linear performance; however, if the underlying " -"method is linear (as it would be with a linked list), the mixins will have " -"quadratic performance and will likely need to be overridden." -msgstr "" +"__iter__`, :meth:`~object.__reversed__`, and :meth:`~sequence.index` make " +"repeated calls to the underlying :meth:`~object.__getitem__` method. " +"Consequently, if :meth:`~object.__getitem__` is implemented with constant " +"access speed, the mixin methods will have linear performance; however, if " +"the underlying method is linear (as it would be with a linked list), the " +"mixins will have quadratic performance and will likely need to be overridden." +msgstr "" +"Σημείωση υλοποίησης: Μερικές από τις μεθόδους mixin, όπως :meth:`~container." +"__iter__`, :meth:`~object.__reversed__` και :meth:`~sequence.index`, κάνουν " +"επανειλημμένες κλήσεις στην μέθοδο :meth:`~object.__getitem__`. Ως " +"αποτέλεσμα, αν η :meth:`~object.__getitem__` είναι υλοποιημένη με σταθερή " +"ταχύτητα πρόσβασης, οι μέθοδοι mixin θα έχουν γραμμική απόδοση∙ ωστόσο, αν η " +"υποκείμενη μέθοδος είναι γραμμική (όπως θα ήταν με μια συνδεδεμένη λίστα), " +"οι mixins θα έχουν τετραγωνική απόδοση και πιθανώς θα χρειαστεί να " +"αντικατασταθούν." + +#: library/collections.abc.rst:282 +msgid "Return first index of *value*." +msgstr "Επιστρέφει τον πρώτο δείκτη του *value*." + +#: library/collections.abc.rst:284 +msgid "Raises :exc:`ValueError` if the value is not present." +msgstr "Κάνει raise μια :exc:`ValueError` αν η τιμή δεν είναι παρούσα." -#: library/collections.abc.rst:273 -msgid "The index() method added support for *stop* and *start* arguments." +#: library/collections.abc.rst:286 +msgid "" +"Supporting the *start* and *stop* arguments is optional, but recommended." msgstr "" +"Η υποστήριξη των ορισμάτων *start* και *stop* είναι προαιρετική, αλλά " +"συνιστάται." -#: library/collections.abc.rst:281 +#: library/collections.abc.rst:288 msgid "" -"The :class:`ByteString` ABC has been deprecated. For use in typing, prefer a " -"union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`. For " -"use as an ABC, prefer :class:`Sequence` or :class:`collections.abc.Buffer`." +"The :meth:`~sequence.index` method gained support for the *stop* and *start* " +"arguments." msgstr "" +"Η μέθοδος :meth:`~sequence.index` πρόσθεσε υποστήριξη για τα ορίσματα *stop* " +"και *start*." -#: library/collections.abc.rst:286 +#: library/collections.abc.rst:292 +msgid "The :class:`ByteString` ABC has been deprecated." +msgstr "Η ABC :class:`ByteString` έχει αποσυρθεί." + +#: library/collections.abc.rst:295 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`Buffer` or a union that explicitly " +"specifies the types your code supports (e.g., ``bytes | bytearray | " +"memoryview``)." +msgstr "" +"Χρησιμοποιήστε το ``isinstance(obj, collections.abc.Buffer)`` για να " +"ελέγξετε αν το ``obj`` υλοποιεί το :ref:`buffer protocol ` " +"κατά το runtime. Για χρήση σε type annotations, είτε χρησιμοποιήστε την :" +"class:`Buffer` είτε μια ένωση που να καθορίζει ρητά τους τύπους που " +"υποστηρίζει ο κώδικάς σας (π.χ., ``bytes | bytearray | memoryview``)." + +#: library/collections.abc.rst:301 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" +"Η :class:`!ByteString` προοριζόταν αρχικά να είναι μια αφηρημένη κλάση που " +"θα λειτουργούσε ως υπερτύπος τόσο για την :class:`bytes` όσο και για την :" +"class:`bytearray`. Ωστόσο, δεδομένου ότι η ABC δεν είχε καμία μέθοδο, η " +"γνώση ότι ένα αντικείμενο ήταν στιγμιότυπο της :class:`!ByteString` δεν σας " +"έλεγε ποτέ κάτι χρήσιμο για το αντικείμενο. Άλλοι κοινοί τύποι buffer όπως " +"η :class:`memoryview` επίσης δεν θεωρούνταν ποτέ ως υποτύποι της :class:`!" +"ByteString` (ούτε κατά το runtime ούτε από στατικούς ελεγκτές τύπων)." + +#: library/collections.abc.rst:309 +msgid "See :pep:`PEP 688 <688#current-options>` for more details." +msgstr "" +"Δείτε :pep:`PEP 688 <688#current-options>` για περισσότερες λεπτομέρειες." + +#: library/collections.abc.rst:314 msgid "ABCs for read-only and mutable :ref:`sets `." msgstr "" +"ABCs μόνο για ανάγνωση (read-only) και mutable :ref:`sets `." -#: library/collections.abc.rst:291 +#: library/collections.abc.rst:319 msgid "ABCs for read-only and mutable :term:`mappings `." msgstr "" +"ABCs μόνο για ανάγνωση (read-only) και mutable :term:`mappings `." -#: library/collections.abc.rst:298 +#: library/collections.abc.rst:326 msgid "" "ABCs for mapping, items, keys, and values :term:`views `." msgstr "" +"ABCs για αντιστοιχήσεις, στοιχεία, κλειδιά και τιμές :term:`views " +"`." -#: library/collections.abc.rst:302 +#: library/collections.abc.rst:330 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " "expressions. Custom implementations must provide the :meth:`~object." "__await__` method." msgstr "" +"ABC για αντικείμενα :term:`awaitable`, που μπορούν να χρησιμοποιηθούν σε " +"εκφράσεις :keyword:`await`. Οι προσαρμοσμένες υλοποιήσεις πρέπει να παρέχουν " +"τη μέθοδο :meth:`~object.__await__`." -#: library/collections.abc.rst:306 +#: library/collections.abc.rst:334 msgid "" ":term:`Coroutine ` objects and instances of the :class:" "`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" +"Τα αντικείμενα :term:`Coroutine ` και τα στιγμιότυπα της κλάσης :" +"class:`~collections.abc.Coroutine` είναι όλα παραδείγματα αυτής της ABC." -#: library/collections.abc.rst:310 +#: library/collections.abc.rst:338 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " -"decorated with :func:`@types.coroutine `) are *awaitables*, " -"even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." -msgstr "" - -#: library/collections.abc.rst:320 +"decorated with :deco:`types.coroutine`) are *awaitables*, even though they " +"do not have an :meth:`~object.__await__` method. Using ``isinstance(gencoro, " +"Awaitable)`` for them will return ``False``. Use :func:`inspect.isawaitable` " +"to detect them." +msgstr "" +"Στην CPython, οι generator-based coroutines (:term:`generators ` " +"που είναι decorated με :deco:`types.coroutine`) είναι *awaitables*, αν και " +"δεν διαθέτουν μέθοδο :meth:`~object.__await__`. Η χρήση της " +"``isinstance(gencoro, Awaitable)`` γι' αυτές θα επιστρέψει ``False``. " +"Χρησιμοποιείτε τη συνάρτηση :func:`inspect.isawaitable` για να τις " +"εντοπίσετε." + +#: library/collections.abc.rst:348 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " "methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" @@ -547,51 +805,100 @@ msgid "" "must also implement :meth:`~object.__await__`. All :class:`Coroutine` " "instances are also instances of :class:`Awaitable`." msgstr "" +"ABC για κλάσεις συμβατές με το :term:`coroutine`. Αυτές υλοποιούν τις εξής " +"μεθόδους, οι οποίες ορίζονται στο :ref:`coroutine-objects`: :meth:" +"`~coroutine.send`, :meth:`~coroutine.throw`, και :meth:`~coroutine.close`. " +"Οι προσαρμοσμένες υλοποιήσεις πρέπει επίσης να υλοποιούν τη μέθοδο :meth:" +"`~object.__await__`. Όλα τα :class:`Coroutine` στιγμιότυπα είναι επίσης " +"στιγμιότυπα της κλάσης :class:`Awaitable`." -#: library/collections.abc.rst:328 +#: library/collections.abc.rst:356 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " -"decorated with :func:`@types.coroutine `) are *awaitables*, " -"even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"decorated with :deco:`types.coroutine`) are *awaitables*, even though they " +"do not have an :meth:`~object.__await__` method. Using ``isinstance(gencoro, " +"Coroutine)`` for them will return ``False``. Use :func:`inspect.isawaitable` " +"to detect them." +msgstr "" +"Στην CPython, οι generator-based coroutines (:term:`generators ` " +"που είναι διακοσμημένες με :deco:`types.coroutine`) είναι *awaitables*, αν " +"και δεν έχουν τη μέθοδο :meth:`~object.__await__`. Η χρήση της ``isinstance " +"(gencoro, Coroutine)`` γι' αυτές θα επιστρέψει ``False``. Χρησιμοποιείται η " +"συνάρτηση :func:`inspect.isawaitable` για να εντοπιστούν." + +#: library/collections.abc.rst:362 +msgid "" +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!Coroutine` in type annotations. The variance and order of type parameters " +"correspond to those of :class:`Generator`." msgstr "" +"Βλ. :ref:`annotating-generators-and-coroutines` για λεπτομέρειες σχετικά με " +"τη χρήση της :class:`!Coroutine` σε σχολιασμούς τύπου. Η διακύμανση και η " +"σειρά των παραμέτρων τύπου αντιστοιχούν σε εκείνες της :class:`Generator`." -#: library/collections.abc.rst:338 +#: library/collections.abc.rst:371 msgid "" "ABC for classes that provide an ``__aiter__`` method. See also the " "definition of :term:`asynchronous iterable`." msgstr "" +"ABC για κλάσεις που παρέχουν μια μέθοδο ``__aiter__``. Δείτε επίσης τον " +"ορισμό του :term:`asynchronous iterable`." -#: library/collections.abc.rst:345 +#: library/collections.abc.rst:378 msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" +"ABC για κλάσεις που παρέχουν τις μεθόδους ``__aiter__`` και ``__anext__``. " +"Δείτε επίσης τον ορισμό του :term:`asynchronous iterator`." -#: library/collections.abc.rst:352 +#: library/collections.abc.rst:385 msgid "" "ABC for :term:`asynchronous generator` classes that implement the protocol " "defined in :pep:`525` and :pep:`492`." msgstr "" +"ABC για κλάσεις :term:`asynchronous generator` που υλοποιούν το πρωτόκολλο " +"που ορίζεται στο :pep:`525` και :pep:`492`." -#: library/collections.abc.rst:359 +#: library/collections.abc.rst:388 +msgid "" +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!AsyncGenerator` in type annotations." +msgstr "" +"Δείτε :ref:`annotating-generators-and-coroutines` για λεπτομέρειες σχετικά " +"με τη χρήση του :class:`!AsyncGenerator` σε σχολιασμούς τύπου." + +#: library/collections.abc.rst:395 msgid "" "ABC for classes that provide the :meth:`~object.__buffer__` method, " "implementing the :ref:`buffer protocol `. See :pep:`688`." msgstr "" +"ABC για κλάσεις που παρέχουν τη μέθοδο :meth:`~object.__buffer__`, " +"υλοποιώντας το :ref:`buffer protocol `. Δείτε το :pep:`688`." -#: library/collections.abc.rst:365 +#: library/collections.abc.rst:401 msgid "Examples and Recipes" -msgstr "" +msgstr "Παραδείγματα και Συνταγές" -#: library/collections.abc.rst:367 +#: library/collections.abc.rst:403 msgid "" "ABCs allow us to ask classes or instances if they provide particular " "functionality, for example::" msgstr "" +"Οι ABCs επιτρέπουν να ρωτήσουμε τις κλάσεις ή τα αντικείμενα αν παρέχουν " +"συγκεκριμένη λειτουργικότητα, για παράδειγμα::" -#: library/collections.abc.rst:374 +#: library/collections.abc.rst:406 +msgid "" +"size = None\n" +"if isinstance(myvar, collections.abc.Sized):\n" +" size = len(myvar)" +msgstr "" +"size = None\n" +"if isinstance(myvar, collections.abc.Sized):\n" +" size = len(myvar)" + +#: library/collections.abc.rst:410 msgid "" "Several of the ABCs are also useful as mixins that make it easier to develop " "classes supporting container APIs. For example, to write a class supporting " @@ -600,12 +907,68 @@ msgid "" "__iter__`, and :meth:`~object.__len__`. The ABC supplies the remaining " "methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" +"Μερικές από τις ABCs είναι επίσης χρήσιμες ως mixins που διευκολύνουν την " +"ανάπτυξη κλάσεων που υποστηρίζουν τα APIs των container. Για παράδειγμα, για " +"να γράψετε μια κλάση που υποστηρίζει το πλήρες API του :class:`Set`, αρκεί " +"να παρέχετε τις τρεις υποκείμενες αφηρημένες μεθόδους: :meth:`~object." +"__contains__`, :meth:`~container.__iter__`, και :meth:`~object.__len__`. Η " +"ABC παρέχει τις υπόλοιπες μεθόδους, όπως :meth:`!__and__` και :meth:" +"`~frozenset.isdisjoint`::" -#: library/collections.abc.rst:403 +#: library/collections.abc.rst:417 +msgid "" +"class ListBasedSet(collections.abc.Set):\n" +" ''' Alternate set implementation favoring space over speed\n" +" and not requiring the set elements to be hashable. '''\n" +" def __init__(self, iterable):\n" +" self.elements = lst = []\n" +" for value in iterable:\n" +" if value not in lst:\n" +" lst.append(value)\n" +"\n" +" def __iter__(self):\n" +" return iter(self.elements)\n" +"\n" +" def __contains__(self, value):\n" +" return value in self.elements\n" +"\n" +" def __len__(self):\n" +" return len(self.elements)\n" +"\n" +"s1 = ListBasedSet('abcdef')\n" +"s2 = ListBasedSet('defghi')\n" +"overlap = s1 & s2 # The __and__() method is supported " +"automatically" +msgstr "" +"class ListBasedSet(collections.abc.Set):\n" +" ''' Alternate set implementation favoring space over speed\n" +" and not requiring the set elements to be hashable. '''\n" +" def __init__(self, iterable):\n" +" self.elements = lst = []\n" +" for value in iterable:\n" +" if value not in lst:\n" +" lst.append(value)\n" +"\n" +" def __iter__(self):\n" +" return iter(self.elements)\n" +"\n" +" def __contains__(self, value):\n" +" return value in self.elements\n" +"\n" +" def __len__(self):\n" +" return len(self.elements)\n" +"\n" +"s1 = ListBasedSet('abcdef')\n" +"s2 = ListBasedSet('defghi')\n" +"overlap = s1 & s2 # The __and__() method is supported " +"automatically" + +#: library/collections.abc.rst:439 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" +"Σημειώσεις για τη χρήση των :class:`Set` και :class:`MutableSet` ως mixin:" -#: library/collections.abc.rst:406 +#: library/collections.abc.rst:442 msgid "" "Since some set operations create new sets, the default mixin methods need a " "way to create new instances from an :term:`iterable`. The class constructor " @@ -617,15 +980,29 @@ msgid "" "classmethod or regular method that can construct new instances from an " "iterable argument." msgstr "" - -#: library/collections.abc.rst:417 +"Δεδομένου ότι ορισμένες λειτουργίες συνόλων δημιουργούν νέα σύνολα, οι " +"προεπιλεγμένες μέθοδοι mixin χρειάζονται έναν τρόπο δημιουργίας νέων " +"αντικειμένων από ένα :term:`iterable`. Υποτίθεται ότι ο κατασκευαστής της " +"κλάσης έχει μια υπογραφή της μορφής ``ClassName(iterable)``. Αυτή η υπόθεση " +"είναι αποσυνδεδεμένη σε μια εσωτερική :class:`classmethod` που ονομάζεται :" +"meth:`!_from_iterable`, η οποία καλεί το ``cls(iterable)`` για να " +"δημιουργήσει ένα νέο σύνολο. Εάν το mixin :class:`Set` χρησιμοποιείται σε " +"μια κλάση με διαφορετική υπογραφή κατασκευαστή, θα χρειαστεί να " +"αντικαταστήσετε την :meth:`!_from_iterable` με μια μέθοδο κλάσης ή κανονική " +"μέθοδο που μπορεί να δημιουργήσει νέα αντικείμενα από ένα όρισμα iterable." + +#: library/collections.abc.rst:453 msgid "" "To override the comparisons (presumably for speed, as the semantics are " "fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " "other operations will automatically follow suit." msgstr "" +"Για να παρακάμψετε τις συγκρίσεις (πιθανότατα για λόγους απόδοσης, καθώς η " +"σημασιολογία είναι καθορισμένη), ορίστε ξανά τις μεθόδους :meth:`~object." +"__le__`, και :meth:`~object.__ge__`, και οι άλλες λειτουργίες θα " +"ακολουθήσουν αυτόματα." -#: library/collections.abc.rst:423 +#: library/collections.abc.rst:459 msgid "" "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " "value for the set; however, :meth:`~object.__hash__` is not defined because " @@ -633,13 +1010,34 @@ msgid "" "using mixins, inherit from both :meth:`Set` and :meth:`Hashable`, then " "define ``__hash__ = Set._hash``." msgstr "" +"Το mixin :class:`Set` παρέχει τη μέθοδο :meth:`!_hash` για να υπολογίσει μια " +"τιμή κατακερματισμού για το σύνολο. Ωστόσο, η μέθοδος :meth:`~object." +"__hash__` δεν είναι ορισμένη, επειδή δεν είναι όλα τα σύνολα :term:" +"`hashable` ή αμετάβλητα. Για να προσθέσετε hashability σε ένα σύνολο " +"χρησιμοποιώντας mixins, κληρονομήστε τόσο από τις κλάσεις :meth:`Set` όσο " +"και :meth:`Hashable`, και στη συνέχεια ορίστε ``__hash__ = Set._hash``." -#: library/collections.abc.rst:431 +#: library/collections.abc.rst:467 msgid "" "`OrderedSet recipe `_ for an " "example built on :class:`MutableSet`." msgstr "" +"Συνταγή `OrderedSet `_ για ένα " +"παράδειγμα που βασίζεται στην κλάση :class:`MutableSet`." -#: library/collections.abc.rst:434 +#: library/collections.abc.rst:470 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "" +"Για περισσότερα σχετικά με τις ABCs, δείτε το :mod:`abc` module και το :pep:" +"`3119`." + +#~ msgid "" +#~ "The :class:`ByteString` ABC has been deprecated. For use in typing, " +#~ "prefer a union, like ``bytes | bytearray``, or :class:`collections.abc." +#~ "Buffer`. For use as an ABC, prefer :class:`Sequence` or :class:" +#~ "`collections.abc.Buffer`." +#~ msgstr "" +#~ "Η ABC :class:`ByteString` έχει αποσυρθεί. Για χρήση στην δακτυλογράφηση, " +#~ "προτιμάται ένωση, όπως ``bytes | bytearray``, ή :class:`collections.abc." +#~ "Buffer`. Για χρήση ως ABC, προτιμάται :class:`Sequence` ή :class:" +#~ "`collections.abc.Buffer`." diff --git a/library/collections.po b/library/collections.po index d76a298b..6c6ad517 100644 --- a/library/collections.po +++ b/library/collections.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/collections.rst:2 -msgid ":mod:`collections` --- Container datatypes" +msgid ":mod:`!collections` --- Container datatypes" msgstr "" #: library/collections.rst:10 @@ -194,16 +195,32 @@ msgstr "" #: library/collections.rst:102 msgid "" -"Note, the iteration order of a :class:`ChainMap()` is determined by scanning " +"Note, the iteration order of a :class:`ChainMap` is determined by scanning " "the mappings last to first::" msgstr "" +#: library/collections.rst:105 +msgid "" +">>> baseline = {'music': 'bach', 'art': 'rembrandt'}\n" +">>> adjustments = {'art': 'van gogh', 'opera': 'carmen'}\n" +">>> list(ChainMap(adjustments, baseline))\n" +"['music', 'art', 'opera']" +msgstr "" + #: library/collections.rst:110 msgid "" "This gives the same ordering as a series of :meth:`dict.update` calls " "starting with the last mapping::" msgstr "" +#: library/collections.rst:113 +msgid "" +">>> combined = baseline.copy()\n" +">>> combined.update(adjustments)\n" +">>> list(combined)\n" +"['music', 'art', 'opera']" +msgstr "" + #: library/collections.rst:118 msgid "Added support for ``|`` and ``|=`` operators, specified in :pep:`584`." msgstr "" @@ -227,9 +244,10 @@ msgstr "" #: library/collections.rst:136 msgid "" -"The `Nested Contexts recipe `_ " -"has options to control whether writes and other mutations apply only to the " -"first mapping or to any mapping in the chain." +"The `Nested Contexts recipe `_ has options to control " +"whether writes and other mutations apply only to the first mapping or to any " +"mapping in the chain." msgstr "" #: library/collections.rst:141 @@ -250,6 +268,12 @@ msgstr "" msgid "Example of simulating Python's internal lookup chain::" msgstr "" +#: library/collections.rst:153 +msgid "" +"import builtins\n" +"pylookup = ChainMap(locals(), globals(), vars(builtins))" +msgstr "" + #: library/collections.rst:156 msgid "" "Example of letting user specified command-line arguments take precedence " @@ -257,12 +281,50 @@ msgid "" "values::" msgstr "" +#: library/collections.rst:159 +msgid "" +"import os, argparse\n" +"\n" +"defaults = {'color': 'red', 'user': 'guest'}\n" +"\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument('-u', '--user')\n" +"parser.add_argument('-c', '--color')\n" +"namespace = parser.parse_args()\n" +"command_line_args = {k: v for k, v in vars(namespace).items() if v is not " +"None}\n" +"\n" +"combined = ChainMap(command_line_args, os.environ, defaults)\n" +"print(combined['color'])\n" +"print(combined['user'])" +msgstr "" + #: library/collections.rst:173 msgid "" "Example patterns for using the :class:`ChainMap` class to simulate nested " "contexts::" msgstr "" +#: library/collections.rst:176 +msgid "" +"c = ChainMap() # Create root context\n" +"d = c.new_child() # Create nested child context\n" +"e = c.new_child() # Child of c, independent from d\n" +"e.maps[0] # Current context dictionary -- like Python's " +"locals()\n" +"e.maps[-1] # Root context -- like Python's globals()\n" +"e.parents # Enclosing context chain -- like Python's nonlocals\n" +"\n" +"d['x'] = 1 # Set value in current context\n" +"d['x'] # Get first key in the chain of contexts\n" +"del d['x'] # Delete from current context\n" +"list(d) # All nested values\n" +"k in d # Check all nested values\n" +"len(d) # Number of nested values\n" +"d.items() # All nested items\n" +"dict(d) # Flatten into a regular dictionary" +msgstr "" + #: library/collections.rst:192 msgid "" "The :class:`ChainMap` class only makes updates (writes and deletions) to the " @@ -271,6 +333,34 @@ msgid "" "subclass that updates keys found deeper in the chain::" msgstr "" +#: library/collections.rst:197 +msgid "" +"class DeepChainMap(ChainMap):\n" +" 'Variant of ChainMap that allows direct updates to inner scopes'\n" +"\n" +" def __setitem__(self, key, value):\n" +" for mapping in self.maps:\n" +" if key in mapping:\n" +" mapping[key] = value\n" +" return\n" +" self.maps[0][key] = value\n" +"\n" +" def __delitem__(self, key):\n" +" for mapping in self.maps:\n" +" if key in mapping:\n" +" del mapping[key]\n" +" return\n" +" raise KeyError(key)\n" +"\n" +">>> d = DeepChainMap({'zebra': 'black'}, {'elephant': 'blue'}, {'lion': " +"'yellow'})\n" +">>> d['lion'] = 'orange' # update an existing key two levels down\n" +">>> d['snake'] = 'red' # new keys get added to the topmost dict\n" +">>> del d['elephant'] # remove an existing key one level down\n" +">>> d # display result\n" +"DeepChainMap({'zebra': 'black', 'snake': 'red'}, {}, {'lion': 'orange'})" +msgstr "" + #: library/collections.rst:223 msgid ":class:`Counter` objects" msgstr "" @@ -281,6 +371,24 @@ msgid "" "example::" msgstr "" +#: library/collections.rst:228 +msgid "" +">>> # Tally occurrences of words in a list\n" +">>> cnt = Counter()\n" +">>> for word in ['red', 'blue', 'red', 'green', 'blue', 'blue']:\n" +"... cnt[word] += 1\n" +"...\n" +">>> cnt\n" +"Counter({'blue': 3, 'red': 2, 'green': 1})\n" +"\n" +">>> # Find the ten most common words in Hamlet\n" +">>> import re\n" +">>> words = re.findall(r'\\w+', open('hamlet.txt').read().lower())\n" +">>> Counter(words).most_common(10)\n" +"[('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631),\n" +" ('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]" +msgstr "" + #: library/collections.rst:245 msgid "" "A :class:`Counter` is a :class:`dict` subclass for counting :term:`hashable` " @@ -390,6 +498,19 @@ msgstr "" msgid "Common patterns for working with :class:`Counter` objects::" msgstr "" +#: library/collections.rst:356 +msgid "" +"c.total() # total of all counts\n" +"c.clear() # reset all counts\n" +"list(c) # list unique elements\n" +"set(c) # convert to a set\n" +"dict(c) # convert to a regular dictionary\n" +"c.items() # access the (elem, cnt) pairs\n" +"Counter(dict(list_of_pairs)) # convert from a list of (elem, cnt) pairs\n" +"c.most_common()[:-n-1:-1] # n least common elements\n" +"+c # remove zero and negative counts" +msgstr "" + #: library/collections.rst:366 msgid "" "Several mathematical operations are provided for combining :class:`Counter` " @@ -401,6 +522,24 @@ msgid "" "but the output will exclude results with counts of zero or less." msgstr "" +#: library/collections.rst:374 +msgid "" +">>> c = Counter(a=3, b=1)\n" +">>> d = Counter(a=1, b=2)\n" +">>> c + d # add two counters together: c[x] + d[x]\n" +"Counter({'a': 4, 'b': 3})\n" +">>> c - d # subtract (keeping only positive counts)\n" +"Counter({'a': 2})\n" +">>> c & d # intersection: min(c[x], d[x])\n" +"Counter({'a': 1, 'b': 1})\n" +">>> c | d # union: max(c[x], d[x])\n" +"Counter({'a': 3, 'b': 2})\n" +">>> c == d # equality: c[x] == d[x]\n" +"False\n" +">>> c <= d # inclusion: c[x] <= d[x]\n" +"False" +msgstr "" + #: library/collections.rst:391 msgid "" "Unary addition and subtraction are shortcuts for adding an empty counter or " @@ -486,6 +625,11 @@ msgid "" "elements, see :func:`itertools.combinations_with_replacement`::" msgstr "" +#: library/collections.rst:447 +msgid "" +"map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC" +msgstr "" + #: library/collections.rst:451 msgid ":class:`deque` objects" msgstr "" @@ -641,6 +785,62 @@ msgstr "" msgid "Example:" msgstr "" +#: library/collections.rst:596 +msgid "" +">>> from collections import deque\n" +">>> d = deque('ghi') # make a new deque with three items\n" +">>> for elem in d: # iterate over the deque's elements\n" +"... print(elem.upper())\n" +"G\n" +"H\n" +"I\n" +"\n" +">>> d.append('j') # add a new entry to the right side\n" +">>> d.appendleft('f') # add a new entry to the left side\n" +">>> d # show the representation of the deque\n" +"deque(['f', 'g', 'h', 'i', 'j'])\n" +"\n" +">>> d.pop() # return and remove the rightmost item\n" +"'j'\n" +">>> d.popleft() # return and remove the leftmost item\n" +"'f'\n" +">>> list(d) # list the contents of the deque\n" +"['g', 'h', 'i']\n" +">>> d[0] # peek at leftmost item\n" +"'g'\n" +">>> d[-1] # peek at rightmost item\n" +"'i'\n" +"\n" +">>> list(reversed(d)) # list the contents of a deque in " +"reverse\n" +"['i', 'h', 'g']\n" +">>> 'h' in d # search the deque\n" +"True\n" +">>> d.extend('jkl') # add multiple elements at once\n" +">>> d\n" +"deque(['g', 'h', 'i', 'j', 'k', 'l'])\n" +">>> d.rotate(1) # right rotation\n" +">>> d\n" +"deque(['l', 'g', 'h', 'i', 'j', 'k'])\n" +">>> d.rotate(-1) # left rotation\n" +">>> d\n" +"deque(['g', 'h', 'i', 'j', 'k', 'l'])\n" +"\n" +">>> deque(reversed(d)) # make a new deque in reverse order\n" +"deque(['l', 'k', 'j', 'i', 'h', 'g'])\n" +">>> d.clear() # empty the deque\n" +">>> d.pop() # cannot pop from an empty deque\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in -toplevel-\n" +" d.pop()\n" +"IndexError: pop from an empty deque\n" +"\n" +">>> d.extendleft('abc') # extendleft() reverses the input " +"order\n" +">>> d\n" +"deque(['c', 'b', 'a'])" +msgstr "" + #: library/collections.rst:651 msgid ":class:`deque` Recipes" msgstr "" @@ -655,12 +855,35 @@ msgid "" "in Unix::" msgstr "" +#: library/collections.rst:658 +msgid "" +"def tail(filename, n=10):\n" +" 'Return the last n lines of a file'\n" +" with open(filename) as f:\n" +" return deque(f, n)" +msgstr "" + #: library/collections.rst:663 msgid "" "Another approach to using deques is to maintain a sequence of recently added " "elements by appending to the right and popping to the left::" msgstr "" +#: library/collections.rst:666 +msgid "" +"def moving_average(iterable, n=3):\n" +" # moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0\n" +" # https://en.wikipedia.org/wiki/Moving_average\n" +" it = iter(iterable)\n" +" d = deque(itertools.islice(it, n-1))\n" +" d.appendleft(0)\n" +" s = sum(d)\n" +" for elem in it:\n" +" s += elem - d.popleft()\n" +" d.append(elem)\n" +" yield s / n" +msgstr "" + #: library/collections.rst:678 msgid "" "A `round-robin scheduler A D E B F C\"\n" +" iterators = deque(map(iter, iterables))\n" +" while iterators:\n" +" try:\n" +" while True:\n" +" yield next(iterators[0])\n" +" iterators.rotate(-1)\n" +" except StopIteration:\n" +" # Remove an exhausted iterator.\n" +" iterators.popleft()" +msgstr "" + #: library/collections.rst:697 msgid "" "The :meth:`~deque.rotate` method provides a way to implement :class:`deque` " @@ -678,6 +916,14 @@ msgid "" "d[n]`` relies on the ``rotate()`` method to position elements to be popped::" msgstr "" +#: library/collections.rst:701 +msgid "" +"def delete_nth(d, n):\n" +" d.rotate(-n)\n" +" d.popleft()\n" +" d.rotate(n)" +msgstr "" + #: library/collections.rst:706 msgid "" "To implement :class:`deque` slicing, use a similar approach applying :meth:" @@ -743,8 +989,8 @@ msgstr "" #: library/collections.rst:750 msgid "" "Note that :meth:`__missing__` is *not* called for any operations besides :" -"meth:`~object.__getitem__`. This means that :meth:`get` will, like normal " -"dictionaries, return ``None`` as a default rather than using :attr:" +"meth:`~object.__getitem__`. This means that :meth:`~dict.get` will, like " +"normal dictionaries, return ``None`` as a default rather than using :attr:" "`default_factory`." msgstr "" @@ -754,12 +1000,12 @@ msgstr "" #: library/collections.rst:761 msgid "" -"This attribute is used by the :meth:`__missing__` method; it is initialized " -"from the first argument to the constructor, if present, or to ``None``, if " -"absent." +"This attribute is used by the :meth:`~defaultdict.__missing__` method; it is " +"initialized from the first argument to the constructor, if present, or to " +"``None``, if absent." msgstr "" -#: library/collections.rst:1182 +#: library/collections.rst:1192 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "" @@ -832,18 +1078,19 @@ msgid "" "Returns a new tuple subclass named *typename*. The new subclass is used to " "create tuple-like objects that have fields accessible by attribute lookup as " "well as being indexable and iterable. Instances of the subclass also have a " -"helpful docstring (with typename and field_names) and a helpful :meth:" -"`__repr__` method which lists the tuple contents in a ``name=value`` format." +"helpful docstring (with *typename* and *field_names*) and a helpful :meth:" +"`~object.__repr__` method which lists the tuple contents in a ``name=value`` " +"format." msgstr "" -#: library/collections.rst:855 +#: library/collections.rst:856 msgid "" "The *field_names* are a sequence of strings such as ``['x', 'y']``. " "Alternatively, *field_names* can be a single string with each fieldname " "separated by whitespace and/or commas, for example ``'x y'`` or ``'x, y'``." msgstr "" -#: library/collections.rst:859 +#: library/collections.rst:860 msgid "" "Any valid Python identifier may be used for a fieldname except for names " "starting with an underscore. Valid identifiers consist of letters, digits, " @@ -851,7 +1098,7 @@ msgid "" "mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or *raise*." msgstr "" -#: library/collections.rst:865 +#: library/collections.rst:866 msgid "" "If *rename* is true, invalid fieldnames are automatically replaced with " "positional names. For example, ``['abc', 'def', 'ghi', 'abc']`` is " @@ -859,7 +1106,7 @@ msgid "" "and the duplicate fieldname ``abc``." msgstr "" -#: library/collections.rst:870 +#: library/collections.rst:871 msgid "" "*defaults* can be ``None`` or an :term:`iterable` of default values. Since " "fields with a default value must come after any fields without a default, " @@ -869,76 +1116,127 @@ msgid "" "will default to ``2``." msgstr "" -#: library/collections.rst:877 +#: library/collections.rst:878 msgid "" -"If *module* is defined, the ``__module__`` attribute of the named tuple is " -"set to that value." +"If *module* is defined, the :attr:`~type.__module__` attribute of the named " +"tuple is set to that value." msgstr "" -#: library/collections.rst:880 +#: library/collections.rst:881 msgid "" "Named tuple instances do not have per-instance dictionaries, so they are " "lightweight and require no more memory than regular tuples." msgstr "" -#: library/collections.rst:883 +#: library/collections.rst:884 msgid "" "To support pickling, the named tuple class should be assigned to a variable " "that matches *typename*." msgstr "" -#: library/collections.rst:886 +#: library/collections.rst:887 msgid "Added support for *rename*." msgstr "" -#: library/collections.rst:889 +#: library/collections.rst:890 msgid "" "The *verbose* and *rename* parameters became :ref:`keyword-only arguments " "`." msgstr "" -#: library/collections.rst:893 +#: library/collections.rst:894 msgid "Added the *module* parameter." msgstr "" -#: library/collections.rst:896 -msgid "Removed the *verbose* parameter and the :attr:`_source` attribute." +#: library/collections.rst:897 +msgid "Removed the *verbose* parameter and the :attr:`!_source` attribute." +msgstr "" + +#: library/collections.rst:900 +msgid "" +"Added the *defaults* parameter and the :attr:`~somenamedtuple." +"_field_defaults` attribute." msgstr "" -#: library/collections.rst:899 +#: library/collections.rst:904 msgid "" -"Added the *defaults* parameter and the :attr:`_field_defaults` attribute." +">>> # Basic example\n" +">>> Point = namedtuple('Point', ['x', 'y'])\n" +">>> p = Point(11, y=22) # instantiate with positional or keyword " +"arguments\n" +">>> p[0] + p[1] # indexable like the plain tuple (11, 22)\n" +"33\n" +">>> x, y = p # unpack like a regular tuple\n" +">>> x, y\n" +"(11, 22)\n" +">>> p.x + p.y # fields also accessible by name\n" +"33\n" +">>> p # readable __repr__ with a name=value style\n" +"Point(x=11, y=22)" msgstr "" -#: library/collections.rst:919 +#: library/collections.rst:920 msgid "" "Named tuples are especially useful for assigning field names to result " "tuples returned by the :mod:`csv` or :mod:`sqlite3` modules::" msgstr "" -#: library/collections.rst:935 +#: library/collections.rst:923 +msgid "" +"EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, " +"paygrade')\n" +"\n" +"import csv\n" +"for emp in map(EmployeeRecord._make, csv.reader(open(\"employees.csv\", " +"\"rb\"))):\n" +" print(emp.name, emp.title)\n" +"\n" +"import sqlite3\n" +"conn = sqlite3.connect('/companydata')\n" +"cursor = conn.cursor()\n" +"cursor.execute('SELECT name, age, title, department, paygrade FROM " +"employees')\n" +"for emp in map(EmployeeRecord._make, cursor.fetchall()):\n" +" print(emp.name, emp.title)" +msgstr "" + +#: library/collections.rst:936 msgid "" "In addition to the methods inherited from tuples, named tuples support three " "additional methods and two attributes. To prevent conflicts with field " "names, the method and attribute names start with an underscore." msgstr "" -#: library/collections.rst:941 +#: library/collections.rst:942 msgid "" "Class method that makes a new instance from an existing sequence or iterable." msgstr "" -#: library/collections.rst:951 +#: library/collections.rst:944 +msgid "" +">>> t = [11, 22]\n" +">>> Point._make(t)\n" +"Point(x=11, y=22)" +msgstr "" + +#: library/collections.rst:952 msgid "" "Return a new :class:`dict` which maps field names to their corresponding " "values:" msgstr "" -#: library/collections.rst:960 +#: library/collections.rst:955 +msgid "" +">>> p = Point(x=11, y=22)\n" +">>> p._asdict()\n" +"{'x': 11, 'y': 22}" +msgstr "" + +#: library/collections.rst:961 msgid "Returns an :class:`OrderedDict` instead of a regular :class:`dict`." msgstr "" -#: library/collections.rst:963 +#: library/collections.rst:964 msgid "" "Returns a regular :class:`dict` instead of an :class:`OrderedDict`. As of " "Python 3.7, regular dicts are guaranteed to be ordered. If the extra " @@ -946,89 +1244,156 @@ msgid "" "to cast the result to the desired type: ``OrderedDict(nt._asdict())``." msgstr "" -#: library/collections.rst:972 +#: library/collections.rst:973 msgid "" "Return a new instance of the named tuple replacing specified fields with new " "values::" msgstr "" -#: library/collections.rst:984 +#: library/collections.rst:976 +msgid "" +">>> p = Point(x=11, y=22)\n" +">>> p._replace(x=33)\n" +"Point(x=33, y=22)\n" +"\n" +">>> for partnum, record in inventory.items():\n" +"... inventory[partnum] = record._replace(price=newprices[partnum], " +"timestamp=time.now())" +msgstr "" + +#: library/collections.rst:983 +msgid "" +"Named tuples are also supported by generic function :func:`copy.replace`." +msgstr "" + +#: library/collections.rst:985 +msgid "" +"Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid keyword " +"arguments." +msgstr "" + +#: library/collections.rst:991 msgid "" "Tuple of strings listing the field names. Useful for introspection and for " "creating new named tuple types from existing named tuples." msgstr "" -#: library/collections.rst:999 +#: library/collections.rst:994 +msgid "" +">>> p._fields # view the field names\n" +"('x', 'y')\n" +"\n" +">>> Color = namedtuple('Color', 'red green blue')\n" +">>> Pixel = namedtuple('Pixel', Point._fields + Color._fields)\n" +">>> Pixel(11, 22, 128, 255, 0)\n" +"Pixel(x=11, y=22, red=128, green=255, blue=0)" +msgstr "" + +#: library/collections.rst:1006 msgid "Dictionary mapping field names to default values." msgstr "" -#: library/collections.rst:1009 +#: library/collections.rst:1008 +msgid "" +">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" +">>> Account._field_defaults\n" +"{'balance': 0}\n" +">>> Account('premium')\n" +"Account(type='premium', balance=0)" +msgstr "" + +#: library/collections.rst:1016 msgid "" "To retrieve a field whose name is stored in a string, use the :func:" "`getattr` function:" msgstr "" -#: library/collections.rst:1015 +#: library/collections.rst:1022 msgid "" "To convert a dictionary to a named tuple, use the double-star-operator (as " "described in :ref:`tut-unpacking-arguments`):" msgstr "" -#: library/collections.rst:1022 +#: library/collections.rst:1029 msgid "" "Since a named tuple is a regular Python class, it is easy to add or change " "functionality with a subclass. Here is how to add a calculated field and a " "fixed-width print format:" msgstr "" -#: library/collections.rst:1041 +#: library/collections.rst:1033 +msgid "" +">>> class Point(namedtuple('Point', ['x', 'y'])):\n" +"... __slots__ = ()\n" +"... @property\n" +"... def hypot(self):\n" +"... return (self.x ** 2 + self.y ** 2) ** 0.5\n" +"... def __str__(self):\n" +"... return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, " +"self.hypot)\n" +"\n" +">>> for p in Point(3, 4), Point(14, 5/7):\n" +"... print(p)\n" +"Point: x= 3.000 y= 4.000 hypot= 5.000\n" +"Point: x=14.000 y= 0.714 hypot=14.018" +msgstr "" + +#: library/collections.rst:1048 msgid "" "The subclass shown above sets ``__slots__`` to an empty tuple. This helps " "keep memory requirements low by preventing the creation of instance " "dictionaries." msgstr "" -#: library/collections.rst:1044 +#: library/collections.rst:1051 msgid "" "Subclassing is not useful for adding new, stored fields. Instead, simply " "create a new named tuple type from the :attr:`~somenamedtuple._fields` " "attribute:" msgstr "" -#: library/collections.rst:1049 +#: library/collections.rst:1056 msgid "" "Docstrings can be customized by making direct assignments to the ``__doc__`` " "fields:" msgstr "" -#: library/collections.rst:1058 +#: library/collections.rst:1065 msgid "Property docstrings became writeable." msgstr "" -#: library/collections.rst:1063 +#: library/collections.rst:1070 msgid "" "See :class:`typing.NamedTuple` for a way to add type hints for named " "tuples. It also provides an elegant notation using the :keyword:`class` " "keyword::" msgstr "" -#: library/collections.rst:1072 +#: library/collections.rst:1074 +msgid "" +"class Component(NamedTuple):\n" +" part_number: int\n" +" weight: float\n" +" description: Optional[str] = None" +msgstr "" + +#: library/collections.rst:1079 msgid "" "See :meth:`types.SimpleNamespace` for a mutable namespace based on an " "underlying dictionary instead of a tuple." msgstr "" -#: library/collections.rst:1075 +#: library/collections.rst:1082 msgid "" "The :mod:`dataclasses` module provides a decorator and functions for " "automatically adding generated special methods to user-defined classes." msgstr "" -#: library/collections.rst:1080 +#: library/collections.rst:1087 msgid ":class:`OrderedDict` objects" msgstr "" -#: library/collections.rst:1082 +#: library/collections.rst:1089 msgid "" "Ordered dictionaries are just like regular dictionaries but have some extra " "capabilities relating to ordering operations. They have become less " @@ -1036,91 +1401,93 @@ msgid "" "remember insertion order (this new behavior became guaranteed in Python 3.7)." msgstr "" -#: library/collections.rst:1088 +#: library/collections.rst:1095 msgid "Some differences from :class:`dict` still remain:" msgstr "" -#: library/collections.rst:1090 +#: library/collections.rst:1097 msgid "" "The regular :class:`dict` was designed to be very good at mapping " "operations. Tracking insertion order was secondary." msgstr "" -#: library/collections.rst:1093 +#: library/collections.rst:1100 msgid "" "The :class:`OrderedDict` was designed to be good at reordering operations. " "Space efficiency, iteration speed, and the performance of update operations " "were secondary." msgstr "" -#: library/collections.rst:1097 +#: library/collections.rst:1104 msgid "" "The :class:`OrderedDict` algorithm can handle frequent reordering operations " "better than :class:`dict`. As shown in the recipes below, this makes it " "suitable for implementing various kinds of LRU caches." msgstr "" -#: library/collections.rst:1101 +#: library/collections.rst:1108 msgid "" "The equality operation for :class:`OrderedDict` checks for matching order." msgstr "" -#: library/collections.rst:1103 +#: library/collections.rst:1110 msgid "" "A regular :class:`dict` can emulate the order sensitive equality test with " "``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." msgstr "" -#: library/collections.rst:1106 +#: library/collections.rst:1113 msgid "" -"The :meth:`popitem` method of :class:`OrderedDict` has a different " -"signature. It accepts an optional argument to specify which item is popped." +"The :meth:`~OrderedDict.popitem` method of :class:`OrderedDict` has a " +"different signature. It accepts an optional argument to specify which item " +"is popped." msgstr "" -#: library/collections.rst:1109 +#: library/collections.rst:1116 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` " "with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." msgstr "" -#: library/collections.rst:1112 +#: library/collections.rst:1119 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` " "with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the " "leftmost (first) item if it exists." msgstr "" -#: library/collections.rst:1116 +#: library/collections.rst:1123 msgid "" -":class:`OrderedDict` has a :meth:`move_to_end` method to efficiently " -"reposition an element to an endpoint." +":class:`OrderedDict` has a :meth:`~OrderedDict.move_to_end` method to " +"efficiently reposition an element to an endpoint." msgstr "" -#: library/collections.rst:1119 +#: library/collections.rst:1126 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, " "last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its " "associated value to the rightmost (last) position." msgstr "" -#: library/collections.rst:1123 +#: library/collections.rst:1130 msgid "" "A regular :class:`dict` does not have an efficient equivalent for " "OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " "associated value to the leftmost (first) position." msgstr "" -#: library/collections.rst:1127 -msgid "Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method." +#: library/collections.rst:1134 +msgid "" +"Until Python 3.8, :class:`dict` lacked a :meth:`~object.__reversed__` method." msgstr "" -#: library/collections.rst:1132 +#: library/collections.rst:1139 msgid "" "Return an instance of a :class:`dict` subclass that has methods specialized " "for rearranging dictionary order." msgstr "" -#: library/collections.rst:1139 +#: library/collections.rst:1146 msgid "" "The :meth:`popitem` method for ordered dictionaries returns and removes a " "(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-" @@ -1128,46 +1495,62 @@ msgid "" "false." msgstr "" -#: library/collections.rst:1146 +#: library/collections.rst:1153 msgid "" "Move an existing *key* to either end of an ordered dictionary. The item is " "moved to the right end if *last* is true (the default) or to the beginning " "if *last* is false. Raises :exc:`KeyError` if the *key* does not exist:" msgstr "" -#: library/collections.rst:1163 +#: library/collections.rst:1158 +msgid "" +">>> d = OrderedDict.fromkeys('abcde')\n" +">>> d.move_to_end('b')\n" +">>> ''.join(d)\n" +"'acdeb'\n" +">>> d.move_to_end('b', last=False)\n" +">>> ''.join(d)\n" +"'bacde'" +msgstr "" + +#: library/collections.rst:1170 msgid "" "In addition to the usual mapping methods, ordered dictionaries also support " "reverse iteration using :func:`reversed`." msgstr "" -#: library/collections.rst:1166 +#: library/collections.rst:1175 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " -"are implemented as ``list(od1.items())==list(od2.items())``. Equality tests " -"between :class:`OrderedDict` objects and other :class:`~collections.abc." -"Mapping` objects are order-insensitive like regular dictionaries. This " -"allows :class:`OrderedDict` objects to be substituted anywhere a regular " -"dictionary is used." +"are roughly equivalent to ``list(od1.items())==list(od2.items())``." +msgstr "" + +#: library/collections.rst:1178 +msgid "" +"Equality tests between :class:`OrderedDict` objects and other :class:" +"`~collections.abc.Mapping` objects are order-insensitive like regular " +"dictionaries. This allows :class:`OrderedDict` objects to be substituted " +"anywhere a regular dictionary is used." msgstr "" -#: library/collections.rst:1173 +#: library/collections.rst:1183 msgid "" "The items, keys, and values :term:`views ` of :class:" "`OrderedDict` now support reverse iteration using :func:`reversed`." msgstr "" -#: library/collections.rst:1177 +#: library/collections.rst:1187 msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " -"passed to the :class:`OrderedDict` constructor and its :meth:`update` method." +"passed to the :class:`OrderedDict` constructor and its :meth:`~dict.update` " +"method." msgstr "" -#: library/collections.rst:1187 +#: library/collections.rst:1197 msgid ":class:`OrderedDict` Examples and Recipes" msgstr "" -#: library/collections.rst:1189 +#: library/collections.rst:1199 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1175,17 +1558,92 @@ msgid "" "end::" msgstr "" -#: library/collections.rst:1201 +#: library/collections.rst:1204 +msgid "" +"class LastUpdatedOrderedDict(OrderedDict):\n" +" 'Store items in the order the keys were last added'\n" +"\n" +" def __setitem__(self, key, value):\n" +" super().__setitem__(key, value)\n" +" self.move_to_end(key)" +msgstr "" + +#: library/collections.rst:1211 msgid "" "An :class:`OrderedDict` would also be useful for implementing variants of :" "func:`functools.lru_cache`:" msgstr "" -#: library/collections.rst:1300 +#: library/collections.rst:1214 +msgid "" +"from collections import OrderedDict\n" +"from time import time\n" +"\n" +"class TimeBoundedLRU:\n" +" \"LRU Cache that invalidates and refreshes old entries.\"\n" +"\n" +" def __init__(self, func, maxsize=128, maxage=30):\n" +" self.cache = OrderedDict() # { args : (timestamp, result)}\n" +" self.func = func\n" +" self.maxsize = maxsize\n" +" self.maxage = maxage\n" +"\n" +" def __call__(self, *args):\n" +" if args in self.cache:\n" +" self.cache.move_to_end(args)\n" +" timestamp, result = self.cache[args]\n" +" if time() - timestamp <= self.maxage:\n" +" return result\n" +" result = self.func(*args)\n" +" self.cache[args] = time(), result\n" +" if len(self.cache) > self.maxsize:\n" +" self.cache.popitem(last=False)\n" +" return result" +msgstr "" + +#: library/collections.rst:1241 +msgid "" +"class MultiHitLRUCache:\n" +" \"\"\" LRU cache that defers caching a result until\n" +" it has been requested multiple times.\n" +"\n" +" To avoid flushing the LRU cache with one-time requests,\n" +" we don't cache until a request has been made more than once.\n" +"\n" +" \"\"\"\n" +"\n" +" def __init__(self, func, maxsize=128, maxrequests=4096, cache_after=1):\n" +" self.requests = OrderedDict() # { uncached_key : request_count }\n" +" self.cache = OrderedDict() # { cached_key : function_result }\n" +" self.func = func\n" +" self.maxrequests = maxrequests # max number of uncached requests\n" +" self.maxsize = maxsize # max number of stored return " +"values\n" +" self.cache_after = cache_after\n" +"\n" +" def __call__(self, *args):\n" +" if args in self.cache:\n" +" self.cache.move_to_end(args)\n" +" return self.cache[args]\n" +" result = self.func(*args)\n" +" self.requests[args] = self.requests.get(args, 0) + 1\n" +" if self.requests[args] <= self.cache_after:\n" +" self.requests.move_to_end(args)\n" +" if len(self.requests) > self.maxrequests:\n" +" self.requests.popitem(last=False)\n" +" else:\n" +" self.requests.pop(args, None)\n" +" self.cache[args] = result\n" +" if len(self.cache) > self.maxsize:\n" +" self.cache.popitem(last=False)\n" +" return result" +msgstr "" + +#: library/collections.rst:1310 msgid ":class:`UserDict` objects" msgstr "" -#: library/collections.rst:1302 +#: library/collections.rst:1312 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " @@ -1193,7 +1651,7 @@ msgid "" "work with because the underlying dictionary is accessible as an attribute." msgstr "" -#: library/collections.rst:1310 +#: library/collections.rst:1320 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " "regular dictionary, which is accessible via the :attr:`data` attribute of :" @@ -1202,22 +1660,22 @@ msgid "" "not be kept, allowing it to be used for other purposes." msgstr "" -#: library/collections.rst:1316 +#: library/collections.rst:1326 msgid "" "In addition to supporting the methods and operations of mappings, :class:" "`UserDict` instances provide the following attribute:" msgstr "" -#: library/collections.rst:1321 +#: library/collections.rst:1331 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "" -#: library/collections.rst:1327 +#: library/collections.rst:1337 msgid ":class:`UserList` objects" msgstr "" -#: library/collections.rst:1329 +#: library/collections.rst:1339 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -1225,14 +1683,14 @@ msgid "" "lists." msgstr "" -#: library/collections.rst:1334 +#: library/collections.rst:1344 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " "work with because the underlying list is accessible as an attribute." msgstr "" -#: library/collections.rst:1340 +#: library/collections.rst:1350 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " "list, which is accessible via the :attr:`data` attribute of :class:" @@ -1241,19 +1699,19 @@ msgid "" "for example a real Python list or a :class:`UserList` object." msgstr "" -#: library/collections.rst:1346 +#: library/collections.rst:1356 msgid "" "In addition to supporting the methods and operations of mutable sequences, :" "class:`UserList` instances provide the following attribute:" msgstr "" -#: library/collections.rst:1351 +#: library/collections.rst:1361 msgid "" "A real :class:`list` object used to store the contents of the :class:" "`UserList` class." msgstr "" -#: library/collections.rst:1354 +#: library/collections.rst:1364 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -1263,7 +1721,7 @@ msgid "" "object used as a data source." msgstr "" -#: library/collections.rst:1361 +#: library/collections.rst:1371 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -1271,11 +1729,11 @@ msgid "" "provided in that case." msgstr "" -#: library/collections.rst:1367 +#: library/collections.rst:1377 msgid ":class:`UserString` objects" msgstr "" -#: library/collections.rst:1369 +#: library/collections.rst:1379 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -1283,7 +1741,7 @@ msgid "" "because the underlying string is accessible as an attribute." msgstr "" -#: library/collections.rst:1377 +#: library/collections.rst:1387 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -1292,19 +1750,19 @@ msgid "" "converted into a string using the built-in :func:`str` function." msgstr "" -#: library/collections.rst:1384 +#: library/collections.rst:1394 msgid "" "In addition to supporting the methods and operations of strings, :class:" "`UserString` instances provide the following attribute:" msgstr "" -#: library/collections.rst:1389 +#: library/collections.rst:1399 msgid "" "A real :class:`str` object used to store the contents of the :class:" "`UserString` class." msgstr "" -#: library/collections.rst:1392 +#: library/collections.rst:1402 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/colorsys.po b/library/colorsys.po index 76181447..d14019aa 100644 --- a/library/colorsys.po +++ b/library/colorsys.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-20 12:46+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/colorsys.rst:2 -msgid ":mod:`colorsys` --- Conversions between color systems" -msgstr "" +msgid ":mod:`!colorsys` --- Conversions between color systems" +msgstr ":mod:`!colorsys` --- Μετατροπές μεταξύ συστημάτων χρωμάτων" #: library/colorsys.rst:9 msgid "**Source code:** :source:`Lib/colorsys.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας** :source:`Lib/colorsys.py`" #: library/colorsys.rst:13 msgid "" @@ -30,10 +31,18 @@ msgid "" "between colors expressed in the RGB (Red Green Blue) color space used in " "computer monitors and three other coordinate systems: YIQ, HLS (Hue " "Lightness Saturation) and HSV (Hue Saturation Value). Coordinates in all of " -"these color spaces are floating point values. In the YIQ space, the Y " +"these color spaces are floating-point values. In the YIQ space, the Y " "coordinate is between 0 and 1, but the I and Q coordinates can be positive " "or negative. In all other spaces, the coordinates are all between 0 and 1." msgstr "" +"Το module :mod:`colorsys` ορίζει αμφίδρομες μετατροπές των χρωματικών τιμών " +"μεταξύ των χρωμάτων που εκφράζονται στον χρωματικό χώρο RGB (Red Green Blue) " +"που χρησιμοποιείται στις οθόνες υπολογιστών και σε τρία άλλα συστήματα " +"συντεταγμένων: YIQ, HLS (Hue Lightness Saturation) και HSV (Hue Saturation " +"Value). Οι συντεταγμένες σε όλους αυτούς τους χρωματικούς χώρους είναι τιμές " +"κινητής υποδιαστολής. Στο χώρο YIQ, η συντεταγμένη Y είναι μεταξύ 0 και 1, " +"αλλά οι συντεταγμένες I και Q μπορούν να είναι θετικές ή αρνητικές. Σε όλους " +"τους άλλους χώρους, οι συντεταγμένες είναι όλες μεταξύ 0 και 1." #: library/colorsys.rst:23 msgid "" @@ -41,35 +50,52 @@ msgid "" "ColorFAQ.html and https://www.cambridgeincolour.com/tutorials/color-spaces." "htm." msgstr "" +"Περισσότερες πληροφορίες σχετικά με τους χρωματικούς χώρους μπορούν να " +"βρεθούν στις διευθύνσεις https://poynton.ca/ColorFAQ.html και https://www." +"cambridgeincolour.com/tutorials/color-spaces.htm." #: library/colorsys.rst:27 msgid "The :mod:`colorsys` module defines the following functions:" -msgstr "" +msgstr "Το module :mod:`colorsys` ορίζει τις παρακάτω λειτουργίες:" #: library/colorsys.rst:32 msgid "Convert the color from RGB coordinates to YIQ coordinates." -msgstr "" +msgstr "Μετατρέπει το χρώμα από συντεταγμένες RGB σε συντεταγμένες YIQ." #: library/colorsys.rst:37 msgid "Convert the color from YIQ coordinates to RGB coordinates." -msgstr "" +msgstr "Μετατρέπει το χρώμα από συντεταγμένες YIQ σε συντεταγμένες RGB." #: library/colorsys.rst:42 msgid "Convert the color from RGB coordinates to HLS coordinates." -msgstr "" +msgstr "Μετατρέπει το χρώμα από συντεταγμένες RGB σε συντεταγμένες HLS." #: library/colorsys.rst:47 msgid "Convert the color from HLS coordinates to RGB coordinates." -msgstr "" +msgstr "Μετατρέπει το χρώμα από συντεταγμένες HLS σε συντεταγμένες RGB." #: library/colorsys.rst:52 msgid "Convert the color from RGB coordinates to HSV coordinates." -msgstr "" +msgstr "Μετατρέπει το χρώμα από συντεταγμένες RGB σε συντεταγμένες HSV." #: library/colorsys.rst:57 msgid "Convert the color from HSV coordinates to RGB coordinates." -msgstr "" +msgstr "Μετατρέπει το χρώμα από συντεταγμένες HSV σε συντεταγμένες RGB." #: library/colorsys.rst:59 msgid "Example::" +msgstr "Παράδειγμα::" + +#: library/colorsys.rst:61 +msgid "" +">>> import colorsys\n" +">>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4)\n" +"(0.5, 0.5, 0.4)\n" +">>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4)\n" +"(0.2, 0.4, 0.4)" msgstr "" +">>> import colorsys\n" +">>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4)\n" +"(0.5, 0.5, 0.4)\n" +">>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4)\n" +"(0.2, 0.4, 0.4)" diff --git a/library/compileall.po b/library/compileall.po index cf4c49a8..d4e71249 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/compileall.rst:2 -msgid ":mod:`compileall` --- Byte-compile Python libraries" +msgid ":mod:`!compileall` --- Byte-compile Python libraries" msgstr "" #: library/compileall.rst:7 @@ -34,14 +35,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/compileall.rst:22 @@ -86,26 +86,40 @@ msgid "" "executed." msgstr "" -#: library/compileall.rst:61 +#: library/compileall.rst:60 msgid "" -"Remove (``-s``) or append (``-p``) the given prefix of paths recorded in the " -"``.pyc`` files. Cannot be combined with ``-d``." +"Remove the given prefix from paths recorded in the ``.pyc`` files. Paths are " +"made relative to the prefix." +msgstr "" + +#: library/compileall.rst:63 +msgid "This option can be used with ``-p`` but not with ``-d``." msgstr "" #: library/compileall.rst:67 msgid "" +"Prepend the given prefix to paths recorded in the ``.pyc`` files. Use ``-p /" +"`` to make the paths absolute." +msgstr "" + +#: library/compileall.rst:70 +msgid "This option can be used with ``-s`` but not with ``-d``." +msgstr "" + +#: library/compileall.rst:74 +msgid "" "regex is used to search the full path to each file considered for " "compilation, and if the regex produces a match, the file is skipped." msgstr "" -#: library/compileall.rst:72 +#: library/compileall.rst:79 msgid "" "Read the file ``list`` and add each line that it contains to the list of " "files and directories to compile. If ``list`` is ``-``, read lines from " "``stdin``." msgstr "" -#: library/compileall.rst:78 +#: library/compileall.rst:85 msgid "" "Write the byte-code files to their legacy locations and names, which may " "overwrite byte-code files created by another version of Python. The default " @@ -113,7 +127,7 @@ msgid "" "byte-code files from multiple versions of Python to coexist." msgstr "" -#: library/compileall.rst:85 +#: library/compileall.rst:92 msgid "" "Control the maximum recursion level for subdirectories. If this is given, " "then ``-l`` option will not be taken into account. :program:`python -m " @@ -121,13 +135,13 @@ msgid "" " -l`." msgstr "" -#: library/compileall.rst:92 +#: library/compileall.rst:99 msgid "" "Use *N* workers to compile the files within the given directory. If ``0`` is " -"used, then the result of :func:`os.cpu_count()` will be used." +"used, then the result of :func:`os.process_cpu_count` will be used." msgstr "" -#: library/compileall.rst:98 +#: library/compileall.rst:105 msgid "" "Control how the generated byte-code files are invalidated at runtime. The " "``timestamp`` value, means that ``.pyc`` files with the source timestamp and " @@ -140,53 +154,53 @@ msgid "" "the ``SOURCE_DATE_EPOCH`` environment variable is set." msgstr "" -#: library/compileall.rst:111 +#: library/compileall.rst:118 msgid "" "Compile with the given optimization level. May be used multiple times to " "compile for multiple levels at a time (for example, ``compileall -o 1 -o " "2``)." msgstr "" -#: library/compileall.rst:117 +#: library/compileall.rst:124 msgid "Ignore symlinks pointing outside the given directory." msgstr "" -#: library/compileall.rst:121 +#: library/compileall.rst:128 msgid "" "If two ``.pyc`` files with different optimization level have the same " "content, use hard links to consolidate duplicate files." msgstr "" -#: library/compileall.rst:124 +#: library/compileall.rst:131 msgid "Added the ``-i``, ``-b`` and ``-h`` options." msgstr "" -#: library/compileall.rst:127 +#: library/compileall.rst:134 msgid "" "Added the ``-j``, ``-r``, and ``-qq`` options. ``-q`` option was changed " "to a multilevel value. ``-b`` will always produce a byte-code file ending " "in ``.pyc``, never ``.pyo``." msgstr "" -#: library/compileall.rst:132 +#: library/compileall.rst:139 msgid "Added the ``--invalidation-mode`` option." msgstr "" -#: library/compileall.rst:135 +#: library/compileall.rst:142 msgid "" "Added the ``-s``, ``-p``, ``-e`` and ``--hardlink-dupes`` options. Raised " "the default recursion limit from 10 to :py:func:`sys.getrecursionlimit()`. " "Added the possibility to specify the ``-o`` option multiple times." msgstr "" -#: library/compileall.rst:142 +#: library/compileall.rst:149 msgid "" "There is no command-line option to control the optimization level used by " "the :func:`compile` function, because the Python interpreter itself already " "provides the option: :program:`python -O -m compileall`." msgstr "" -#: library/compileall.rst:146 +#: library/compileall.rst:153 msgid "" "Similarly, the :func:`compile` function respects the :data:`sys." "pycache_prefix` setting. The generated bytecode cache will only be useful " @@ -194,24 +208,24 @@ msgid "" "that will be used at runtime." msgstr "" -#: library/compileall.rst:152 +#: library/compileall.rst:159 msgid "Public functions" msgstr "" -#: library/compileall.rst:156 +#: library/compileall.rst:163 msgid "" "Recursively descend the directory tree named by *dir*, compiling all :file:`." "py` files along the way. Return a true value if all the files compiled " "successfully, and a false value otherwise." msgstr "" -#: library/compileall.rst:160 +#: library/compileall.rst:167 msgid "" "The *maxlevels* parameter is used to limit the depth of the recursion; it " "defaults to ``sys.getrecursionlimit()``." msgstr "" -#: library/compileall.rst:163 +#: library/compileall.rst:170 msgid "" "If *ddir* is given, it is prepended to the path to each file being compiled " "for use in compilation time tracebacks, and is also compiled in to the byte-" @@ -220,13 +234,13 @@ msgid "" "executed." msgstr "" -#: library/compileall.rst:169 +#: library/compileall.rst:176 msgid "" "If *force* is true, modules are re-compiled even if the timestamps are up to " "date." msgstr "" -#: library/compileall.rst:172 +#: library/compileall.rst:179 msgid "" "If *rx* is given, its ``search`` method is called on the complete path to " "each file considered for compilation, and if it returns a true value, the " @@ -234,14 +248,14 @@ msgid "" "expression, given as a :ref:`re.Pattern ` object." msgstr "" -#: library/compileall.rst:254 +#: library/compileall.rst:261 msgid "" "If *quiet* is ``False`` or ``0`` (the default), the filenames and other " "information are printed to standard out. Set to ``1``, only errors are " "printed. Set to ``2``, all output is suppressed." msgstr "" -#: library/compileall.rst:258 +#: library/compileall.rst:265 msgid "" "If *legacy* is true, byte-code files are written to their legacy locations " "and names, which may overwrite byte-code files created by another version of " @@ -250,7 +264,7 @@ msgid "" "coexist." msgstr "" -#: library/compileall.rst:264 +#: library/compileall.rst:271 msgid "" "*optimize* specifies the optimization level for the compiler. It is passed " "to the built-in :func:`compile` function. Accepts also a sequence of " @@ -258,7 +272,7 @@ msgid "" "file in one call." msgstr "" -#: library/compileall.rst:191 +#: library/compileall.rst:198 msgid "" "The argument *workers* specifies how many workers are used to compile files " "in parallel. The default is to not use multiple workers. If the platform " @@ -268,75 +282,76 @@ msgid "" "`ValueError` will be raised." msgstr "" -#: library/compileall.rst:268 +#: library/compileall.rst:275 msgid "" "*invalidation_mode* should be a member of the :class:`py_compile." "PycInvalidationMode` enum and controls how the generated pycs are " "invalidated at runtime." msgstr "" -#: library/compileall.rst:272 +#: library/compileall.rst:279 msgid "" "The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to the " "``-s``, ``-p`` and ``-e`` options described above. They may be specified as " "``str`` or :py:class:`os.PathLike`." msgstr "" -#: library/compileall.rst:276 +#: library/compileall.rst:283 msgid "" "If *hardlink_dupes* is true and two ``.pyc`` files with different " "optimization level have the same content, use hard links to consolidate " "duplicate files." msgstr "" -#: library/compileall.rst:307 +#: library/compileall.rst:314 msgid "Added the *legacy* and *optimize* parameter." msgstr "" -#: library/compileall.rst:212 +#: library/compileall.rst:219 msgid "Added the *workers* parameter." msgstr "" -#: library/compileall.rst:281 library/compileall.rst:310 +#: library/compileall.rst:288 library/compileall.rst:317 msgid "*quiet* parameter was changed to a multilevel value." msgstr "" -#: library/compileall.rst:284 library/compileall.rst:313 +#: library/compileall.rst:291 library/compileall.rst:320 msgid "" "The *legacy* parameter only writes out ``.pyc`` files, not ``.pyo`` files no " "matter what the value of *optimize* is." msgstr "" -#: library/compileall.rst:222 +#: library/compileall.rst:229 msgid "Accepts a :term:`path-like object`." msgstr "" -#: library/compileall.rst:288 library/compileall.rst:317 +#: library/compileall.rst:295 library/compileall.rst:324 msgid "The *invalidation_mode* parameter was added." msgstr "" -#: library/compileall.rst:291 library/compileall.rst:320 -msgid "The *invalidation_mode* parameter's default value is updated to None." +#: library/compileall.rst:298 library/compileall.rst:327 +msgid "" +"The *invalidation_mode* parameter's default value is updated to ``None``." msgstr "" -#: library/compileall.rst:231 +#: library/compileall.rst:238 msgid "Setting *workers* to 0 now chooses the optimal number of cores." msgstr "" -#: library/compileall.rst:234 +#: library/compileall.rst:241 msgid "" "Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* " "arguments. Default value of *maxlevels* was changed from ``10`` to ``sys." "getrecursionlimit()``" msgstr "" -#: library/compileall.rst:240 +#: library/compileall.rst:247 msgid "" "Compile the file with path *fullname*. Return a true value if the file " "compiled successfully, and a false value otherwise." msgstr "" -#: library/compileall.rst:243 +#: library/compileall.rst:250 msgid "" "If *ddir* is given, it is prepended to the path to the file being compiled " "for use in compilation time tracebacks, and is also compiled in to the byte-" @@ -345,7 +360,7 @@ msgid "" "executed." msgstr "" -#: library/compileall.rst:249 +#: library/compileall.rst:256 msgid "" "If *rx* is given, its ``search`` method is passed the full path name to the " "file being compiled, and if it returns a true value, the file is not " @@ -354,20 +369,20 @@ msgid "" "object." msgstr "" -#: library/compileall.rst:294 +#: library/compileall.rst:301 msgid "" "Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* " "arguments." msgstr "" -#: library/compileall.rst:299 +#: library/compileall.rst:306 msgid "" "Byte-compile all the :file:`.py` files found along ``sys.path``. Return a " "true value if all the files compiled successfully, and a false value " "otherwise." msgstr "" -#: library/compileall.rst:302 +#: library/compileall.rst:309 msgid "" "If *skip_curdir* is true (the default), the current directory is not " "included in the search. All other parameters are passed to the :func:" @@ -375,16 +390,31 @@ msgid "" "``maxlevels`` defaults to ``0``." msgstr "" -#: library/compileall.rst:323 +#: library/compileall.rst:330 msgid "" "To force a recompile of all the :file:`.py` files in the :file:`Lib/` " "subdirectory and all its subdirectories::" msgstr "" -#: library/compileall.rst:340 +#: library/compileall.rst:333 +msgid "" +"import compileall\n" +"\n" +"compileall.compile_dir('Lib/', force=True)\n" +"\n" +"# Perform same compilation, excluding files in .svn directories.\n" +"import re\n" +"compileall.compile_dir('Lib/', rx=re.compile(r'[/\\\\][.]svn'), force=True)\n" +"\n" +"# pathlib.Path objects can also be used.\n" +"import pathlib\n" +"compileall.compile_dir(pathlib.Path('Lib/'), force=True)" +msgstr "" + +#: library/compileall.rst:347 msgid "Module :mod:`py_compile`" msgstr "" -#: library/compileall.rst:341 +#: library/compileall.rst:348 msgid "Byte-compile a single source file." msgstr "" diff --git a/library/compression.po b/library/compression.po new file mode 100644 index 00000000..c0a5c0be --- /dev/null +++ b/library/compression.po @@ -0,0 +1,53 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/compression.rst:2 +msgid "The :mod:`!compression` package" +msgstr "" + +#: library/compression.rst:8 +msgid "" +"The :mod:`!compression` package contains the canonical compression modules " +"containing interfaces to several different compression algorithms. Some of " +"these modules have historically been available as separate modules; those " +"will continue to be available under their original names for compatibility " +"reasons, and will not be removed without a deprecation cycle. The use of " +"modules in :mod:`!compression` is encouraged where practical." +msgstr "" + +#: library/compression.rst:15 +msgid ":mod:`!compression.bz2` -- Re-exports :mod:`bz2`" +msgstr "" + +#: library/compression.rst:16 +msgid ":mod:`!compression.gzip` -- Re-exports :mod:`gzip`" +msgstr "" + +#: library/compression.rst:17 +msgid ":mod:`!compression.lzma` -- Re-exports :mod:`lzma`" +msgstr "" + +#: library/compression.rst:18 +msgid ":mod:`!compression.zlib` -- Re-exports :mod:`zlib`" +msgstr "" + +#: library/compression.rst:19 +msgid "" +":mod:`compression.zstd` -- Wrapper for the Zstandard compression library" +msgstr "" diff --git a/library/compression.zstd.po b/library/compression.zstd.po new file mode 100644 index 00000000..ecfcf85e --- /dev/null +++ b/library/compression.zstd.po @@ -0,0 +1,1146 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/compression.zstd.rst:2 +msgid "" +":mod:`!compression.zstd` --- Compression compatible with the Zstandard format" +msgstr "" + +#: library/compression.zstd.rst:10 +msgid "**Source code:** :source:`Lib/compression/zstd/__init__.py`" +msgstr "" + +#: library/compression.zstd.rst:14 +msgid "" +"This module provides classes and functions for compressing and decompressing " +"data using the Zstandard (or *zstd*) compression algorithm. The `zstd manual " +"`__ describes " +"Zstandard as \"a fast lossless compression algorithm, targeting real-time " +"compression scenarios at zlib-level and better compression ratios.\" Also " +"included is a file interface that supports reading and writing the contents " +"of ``.zst`` files created by the :program:`zstd` utility, as well as raw " +"zstd compressed streams." +msgstr "" + +#: library/compression.zstd.rst:23 +msgid "The :mod:`!compression.zstd` module contains:" +msgstr "" + +#: library/compression.zstd.rst:25 +msgid "" +"The :func:`.open` function and :class:`ZstdFile` class for reading and " +"writing compressed files." +msgstr "" + +#: library/compression.zstd.rst:27 +msgid "" +"The :class:`ZstdCompressor` and :class:`ZstdDecompressor` classes for " +"incremental (de)compression." +msgstr "" + +#: library/compression.zstd.rst:29 +msgid "" +"The :func:`compress` and :func:`decompress` functions for one-shot " +"(de)compression." +msgstr "" + +#: library/compression.zstd.rst:31 +msgid "" +"The :func:`train_dict` and :func:`finalize_dict` functions and the :class:" +"`ZstdDict` class to train and manage Zstandard dictionaries." +msgstr "" + +#: library/compression.zstd.rst:33 +msgid "" +"The :class:`CompressionParameter`, :class:`DecompressionParameter`, and :" +"class:`Strategy` classes for setting advanced (de)compression parameters." +msgstr "" + +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/compression.zstd.rst:40 +msgid "Exceptions" +msgstr "" + +#: library/compression.zstd.rst:44 +msgid "" +"This exception is raised when an error occurs during compression or " +"decompression, or while initializing the (de)compressor state." +msgstr "" + +#: library/compression.zstd.rst:49 +msgid "Reading and writing compressed files" +msgstr "" + +#: library/compression.zstd.rst:54 +msgid "" +"Open a Zstandard-compressed file in binary or text mode, returning a :term:" +"`file object`." +msgstr "" + +#: library/compression.zstd.rst:57 +msgid "" +"The *file* argument can be either a file name (given as a :class:`str`, :" +"class:`bytes` or :term:`path-like ` object), in which case " +"the named file is opened, or it can be an existing file object to read from " +"or write to." +msgstr "" + +#: library/compression.zstd.rst:62 +msgid "" +"The mode argument can be either ``'rb'`` for reading (default), ``'wb'`` for " +"overwriting, ``'ab'`` for appending, or ``'xb'`` for exclusive creation. " +"These can equivalently be given as ``'r'``, ``'w'``, ``'a'``, and ``'x'`` " +"respectively. You may also open in text mode with ``'rt'``, ``'wt'``, " +"``'at'``, and ``'xt'`` respectively." +msgstr "" + +#: library/compression.zstd.rst:68 library/compression.zstd.rst:112 +msgid "" +"When reading, the *options* argument can be a dictionary providing advanced " +"decompression parameters; see :class:`DecompressionParameter` for detailed " +"information about supported parameters. The *zstd_dict* argument is a :class:" +"`ZstdDict` instance to be used during decompression. When reading, if the " +"*level* argument is not None, a :exc:`!TypeError` will be raised." +msgstr "" + +#: library/compression.zstd.rst:75 +msgid "" +"When writing, the *options* argument can be a dictionary providing advanced " +"decompression parameters; see :class:`CompressionParameter` for detailed " +"information about supported parameters. The *level* argument is the " +"compression level to use when writing compressed data. Only one of *level* " +"or *options* may be non-None. The *zstd_dict* argument is a :class:" +"`ZstdDict` instance to be used during compression." +msgstr "" + +#: library/compression.zstd.rst:83 +msgid "" +"In binary mode, this function is equivalent to the :class:`ZstdFile` " +"constructor: ``ZstdFile(file, mode, ...)``. In this case, the *encoding*, " +"*errors*, and *newline* parameters must not be provided." +msgstr "" + +#: library/compression.zstd.rst:87 +msgid "" +"In text mode, a :class:`ZstdFile` object is created, and wrapped in an :" +"class:`io.TextIOWrapper` instance with the specified encoding, error " +"handling behavior, and line endings." +msgstr "" + +#: library/compression.zstd.rst:95 +msgid "Open a Zstandard-compressed file in binary mode." +msgstr "" + +#: library/compression.zstd.rst:97 +msgid "" +"A :class:`ZstdFile` can wrap an already-open :term:`file object`, or operate " +"directly on a named file. The *file* argument specifies either the file " +"object to wrap, or the name of the file to open (as a :class:`str`, :class:" +"`bytes` or :term:`path-like ` object). If wrapping an " +"existing file object, the wrapped file will not be closed when the :class:" +"`ZstdFile` is closed." +msgstr "" + +#: library/compression.zstd.rst:104 +msgid "" +"The *mode* argument can be either ``'rb'`` for reading (default), ``'wb'`` " +"for overwriting, ``'xb'`` for exclusive creation, or ``'ab'`` for appending. " +"These can equivalently be given as ``'r'``, ``'w'``, ``'x'`` and ``'a'`` " +"respectively." +msgstr "" + +#: library/compression.zstd.rst:109 +msgid "" +"If *file* is a file object (rather than an actual file name), a mode of " +"``'w'`` does not truncate the file, and is instead equivalent to ``'a'``." +msgstr "" + +#: library/compression.zstd.rst:119 +msgid "" +"When writing, the *options* argument can be a dictionary providing advanced " +"decompression parameters; see :class:`CompressionParameter` for detailed " +"information about supported parameters. The *level* argument is the " +"compression level to use when writing compressed data. Only one of *level* " +"or *options* may be passed. The *zstd_dict* argument is a :class:`ZstdDict` " +"instance to be used during compression." +msgstr "" + +#: library/compression.zstd.rst:127 +msgid "" +":class:`!ZstdFile` supports all the members specified by :class:`io." +"BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` and :meth:`~io." +"IOBase.truncate`. Iteration and the :keyword:`with` statement are supported." +msgstr "" + +#: library/compression.zstd.rst:132 +msgid "The following method and attributes are also provided:" +msgstr "" + +#: library/compression.zstd.rst:136 +msgid "" +"Return buffered data without advancing the file position. At least one byte " +"of data will be returned, unless EOF has been reached. The exact number of " +"bytes returned is unspecified (the *size* argument is ignored)." +msgstr "" + +#: library/compression.zstd.rst:140 +msgid "" +"While calling :meth:`peek` does not change the file position of the :class:" +"`ZstdFile`, it may change the position of the underlying file object (for " +"example, if the :class:`ZstdFile` was constructed by passing a file object " +"for *file*)." +msgstr "" + +#: library/compression.zstd.rst:147 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "" + +#: library/compression.zstd.rst:151 +msgid "" +"The name of the Zstandard file. Equivalent to the :attr:`~io.FileIO.name` " +"attribute of the underlying :term:`file object`." +msgstr "" + +#: library/compression.zstd.rst:156 +msgid "Compressing and decompressing data in memory" +msgstr "" + +#: library/compression.zstd.rst:160 +msgid "" +"Compress *data* (a :term:`bytes-like object`), returning the compressed data " +"as a :class:`bytes` object." +msgstr "" + +#: library/compression.zstd.rst:163 library/compression.zstd.rst:207 +msgid "" +"The *level* argument is an integer controlling the level of compression. " +"*level* is an alternative to setting :attr:`CompressionParameter." +"compression_level` in *options*. Use :meth:`~CompressionParameter.bounds` " +"on :attr:`~CompressionParameter.compression_level` to get the values that " +"can be passed for *level*. If advanced compression options are needed, the " +"*level* argument must be omitted and in the *options* dictionary the :attr:`!" +"CompressionParameter.compression_level` parameter should be set." +msgstr "" + +#: library/compression.zstd.rst:172 library/compression.zstd.rst:216 +msgid "" +"The *options* argument is a Python dictionary containing advanced " +"compression parameters. The valid keys and values for compression parameters " +"are documented as part of the :class:`CompressionParameter` documentation." +msgstr "" + +#: library/compression.zstd.rst:176 +msgid "" +"The *zstd_dict* argument is an instance of :class:`ZstdDict` containing " +"trained data to improve compression efficiency. The function :func:" +"`train_dict` can be used to generate a Zstandard dictionary." +msgstr "" + +#: library/compression.zstd.rst:183 +msgid "" +"Decompress *data* (a :term:`bytes-like object`), returning the uncompressed " +"data as a :class:`bytes` object." +msgstr "" + +#: library/compression.zstd.rst:186 library/compression.zstd.rst:308 +msgid "" +"The *options* argument is a Python dictionary containing advanced " +"decompression parameters. The valid keys and values for compression " +"parameters are documented as part of the :class:`DecompressionParameter` " +"documentation." +msgstr "" + +#: library/compression.zstd.rst:191 library/compression.zstd.rst:313 +msgid "" +"The *zstd_dict* argument is an instance of :class:`ZstdDict` containing " +"trained data used during compression. This must be the same Zstandard " +"dictionary used during compression." +msgstr "" + +#: library/compression.zstd.rst:195 +msgid "" +"If *data* is the concatenation of multiple distinct compressed frames, " +"decompress all of these frames, and return the concatenation of the results." +msgstr "" + +#: library/compression.zstd.rst:201 +msgid "" +"Create a compressor object, which can be used to compress data incrementally." +msgstr "" + +#: library/compression.zstd.rst:204 +msgid "" +"For a more convenient way of compressing a single chunk of data, see the " +"module-level function :func:`compress`." +msgstr "" + +#: library/compression.zstd.rst:220 +msgid "" +"The *zstd_dict* argument is an optional instance of :class:`ZstdDict` " +"containing trained data to improve compression efficiency. The function :" +"func:`train_dict` can be used to generate a Zstandard dictionary." +msgstr "" + +#: library/compression.zstd.rst:227 +msgid "" +"Compress *data* (a :term:`bytes-like object`), returning a :class:`bytes` " +"object with compressed data if possible, or otherwise an empty :class:`!" +"bytes` object. Some of *data* may be buffered internally, for use in later " +"calls to :meth:`!compress` and :meth:`~.flush`. The returned data should be " +"concatenated with the output of any previous calls to :meth:`~.compress`." +msgstr "" + +#: library/compression.zstd.rst:234 +msgid "" +"The *mode* argument is a :class:`ZstdCompressor` attribute, either :attr:`~." +"CONTINUE`, :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`." +msgstr "" + +#: library/compression.zstd.rst:238 +msgid "" +"When all data has been provided to the compressor, call the :meth:`~.flush` " +"method to finish the compression process. If :meth:`~.compress` is called " +"with *mode* set to :attr:`~.FLUSH_FRAME`, :meth:`~.flush` should not be " +"called, as it would write out a new empty frame." +msgstr "" + +#: library/compression.zstd.rst:246 +msgid "" +"Finish the compression process, returning a :class:`bytes` object containing " +"any data stored in the compressor's internal buffers." +msgstr "" + +#: library/compression.zstd.rst:249 +msgid "" +"The *mode* argument is a :class:`ZstdCompressor` attribute, either :attr:`~." +"FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`." +msgstr "" + +#: library/compression.zstd.rst:254 +msgid "" +"Specify the amount of uncompressed data *size* that will be provided for the " +"next frame. *size* will be written into the frame header of the next frame " +"unless :attr:`CompressionParameter.content_size_flag` is ``False`` or ``0``. " +"A size of ``0`` means that the frame is empty. If *size* is ``None``, the " +"frame header will omit the frame size. Frames that include the uncompressed " +"data size require less memory to decompress, especially at higher " +"compression levels." +msgstr "" + +#: library/compression.zstd.rst:262 +msgid "" +"If :attr:`last_mode` is not :attr:`FLUSH_FRAME`, a :exc:`ValueError` is " +"raised as the compressor is not at the start of a frame. If the pledged size " +"does not match the actual size of data provided to :meth:`.compress`, future " +"calls to :meth:`!compress` or :meth:`flush` may raise :exc:`ZstdError` and " +"the last chunk of data may be lost." +msgstr "" + +#: library/compression.zstd.rst:269 +msgid "" +"After :meth:`flush` or :meth:`.compress` are called with mode :attr:" +"`FLUSH_FRAME`, the next frame will not include the frame size into the " +"header unless :meth:`!set_pledged_input_size` is called again." +msgstr "" + +#: library/compression.zstd.rst:275 +msgid "" +"Collect more data for compression, which may or may not generate output " +"immediately. This mode optimizes the compression ratio by maximizing the " +"amount of data per block and frame." +msgstr "" + +#: library/compression.zstd.rst:281 +msgid "" +"Complete and write a block to the data stream. The data returned so far can " +"be immediately decompressed. Past data can still be referenced in future " +"blocks generated by calls to :meth:`~.compress`, improving compression." +msgstr "" + +#: library/compression.zstd.rst:288 +msgid "" +"Complete and write out a frame. Future data provided to :meth:`~.compress` " +"will be written into a new frame and *cannot* reference past data." +msgstr "" + +#: library/compression.zstd.rst:294 +msgid "" +"The last mode passed to either :meth:`~.compress` or :meth:`~.flush`. The " +"value can be one of :attr:`~.CONTINUE`, :attr:`~.FLUSH_BLOCK`, or :attr:`~." +"FLUSH_FRAME`. The initial value is :attr:`~.FLUSH_FRAME`, signifying that " +"the compressor is at the start of a new frame." +msgstr "" + +#: library/compression.zstd.rst:302 +msgid "" +"Create a decompressor object, which can be used to decompress data " +"incrementally." +msgstr "" + +#: library/compression.zstd.rst:305 +msgid "" +"For a more convenient way of decompressing an entire compressed stream at " +"once, see the module-level function :func:`decompress`." +msgstr "" + +#: library/compression.zstd.rst:318 +msgid "" +"This class does not transparently handle inputs containing multiple " +"compressed frames, unlike the :func:`decompress` function and :class:" +"`ZstdFile` class. To decompress a multi-frame input, you should use :func:" +"`decompress`, :class:`ZstdFile` if working with a :term:`file object`, or " +"multiple :class:`!ZstdDecompressor` instances." +msgstr "" + +#: library/compression.zstd.rst:326 +msgid "" +"Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " +"as bytes. Some of *data* may be buffered internally, for use in later calls " +"to :meth:`!decompress`. The returned data should be concatenated with the " +"output of any previous calls to :meth:`!decompress`." +msgstr "" + +#: library/compression.zstd.rst:332 +msgid "" +"If *max_length* is non-negative, the method returns at most *max_length* " +"bytes of decompressed data. If this limit is reached and further output can " +"be produced, the :attr:`~.needs_input` attribute will be set to ``False``. " +"In this case, the next call to :meth:`~.decompress` may provide *data* as " +"``b''`` to obtain more of the output." +msgstr "" + +#: library/compression.zstd.rst:339 +msgid "" +"If all of the input data was decompressed and returned (either because this " +"was less than *max_length* bytes, or because *max_length* was negative), " +"the :attr:`~.needs_input` attribute will be set to ``True``." +msgstr "" + +#: library/compression.zstd.rst:344 +msgid "" +"Attempting to decompress data after the end of a frame will raise a :exc:" +"`ZstdError`. Any data found after the end of the frame is ignored and saved " +"in the :attr:`~.unused_data` attribute." +msgstr "" + +#: library/compression.zstd.rst:350 +msgid "``True`` if the end-of-stream marker has been reached." +msgstr "" + +#: library/compression.zstd.rst:354 +msgid "Data found after the end of the compressed stream." +msgstr "" + +#: library/compression.zstd.rst:356 +msgid "Before the end of the stream is reached, this will be ``b''``." +msgstr "" + +#: library/compression.zstd.rst:360 +msgid "" +"``False`` if the :meth:`.decompress` method can provide more decompressed " +"data before requiring new compressed input." +msgstr "" + +#: library/compression.zstd.rst:365 +msgid "Zstandard dictionaries" +msgstr "" + +#: library/compression.zstd.rst:370 +msgid "" +"Train a Zstandard dictionary, returning a :class:`ZstdDict` instance. " +"Zstandard dictionaries enable more efficient compression of smaller sizes of " +"data, which is traditionally difficult to compress due to less repetition. " +"If you are compressing multiple similar groups of data (such as similar " +"files), Zstandard dictionaries can improve compression ratios and speed " +"significantly." +msgstr "" + +#: library/compression.zstd.rst:377 +msgid "" +"The *samples* argument (an iterable of :class:`bytes` objects), is the " +"population of samples used to train the Zstandard dictionary." +msgstr "" + +#: library/compression.zstd.rst:380 +msgid "" +"The *dict_size* argument, an integer, is the maximum size (in bytes) the " +"Zstandard dictionary should be. The Zstandard documentation suggests an " +"absolute maximum of no more than 100 KB, but the maximum can often be " +"smaller depending on the data. Larger dictionaries generally slow down " +"compression, but improve compression ratios. Smaller dictionaries lead to " +"faster compression, but reduce the compression ratio." +msgstr "" + +#: library/compression.zstd.rst:390 +msgid "" +"An advanced function for converting a \"raw content\" Zstandard dictionary " +"into a regular Zstandard dictionary. \"Raw content\" dictionaries are a " +"sequence of bytes that do not need to follow the structure of a normal " +"Zstandard dictionary." +msgstr "" + +#: library/compression.zstd.rst:395 +msgid "" +"The *zstd_dict* argument is a :class:`ZstdDict` instance with the :attr:" +"`~ZstdDict.dict_content` containing the raw dictionary contents." +msgstr "" + +#: library/compression.zstd.rst:398 +msgid "" +"The *samples* argument (an iterable of :class:`bytes` objects), contains " +"sample data for generating the Zstandard dictionary." +msgstr "" + +#: library/compression.zstd.rst:401 +msgid "" +"The *dict_size* argument, an integer, is the maximum size (in bytes) the " +"Zstandard dictionary should be. See :func:`train_dict` for suggestions on " +"the maximum dictionary size." +msgstr "" + +#: library/compression.zstd.rst:405 +msgid "" +"The *level* argument (an integer) is the compression level expected to be " +"passed to the compressors using this dictionary. The dictionary information " +"varies for each compression level, so tuning for the proper compression " +"level can make compression more efficient." +msgstr "" + +#: library/compression.zstd.rst:413 +msgid "" +"A wrapper around Zstandard dictionaries. Dictionaries can be used to improve " +"the compression of many small chunks of data. Use :func:`train_dict` if you " +"need to train a new dictionary from sample data." +msgstr "" + +#: library/compression.zstd.rst:417 +msgid "" +"The *dict_content* argument (a :term:`bytes-like object`), is the already " +"trained dictionary information." +msgstr "" + +#: library/compression.zstd.rst:420 +msgid "" +"The *is_raw* argument, a boolean, is an advanced parameter controlling the " +"meaning of *dict_content*. ``True`` means *dict_content* is a \"raw " +"content\" dictionary, without any format restrictions. ``False`` means " +"*dict_content* is an ordinary Zstandard dictionary, created from Zstandard " +"functions, for example, :func:`train_dict` or the external :program:`zstd` " +"CLI." +msgstr "" + +#: library/compression.zstd.rst:426 +msgid "" +"When passing a :class:`!ZstdDict` to a function, the :attr:`!" +"as_digested_dict` and :attr:`!as_undigested_dict` attributes can control how " +"the dictionary is loaded by passing them as the ``zstd_dict`` argument, for " +"example, ``compress(data, zstd_dict=zd.as_digested_dict)``. Digesting a " +"dictionary is a costly operation that occurs when loading a Zstandard " +"dictionary. When making multiple calls to compression or decompression, " +"passing a digested dictionary will reduce the overhead of loading the " +"dictionary." +msgstr "" + +#: library/compression.zstd.rst:435 +msgid "Difference for compression" +msgstr "" + +#: library/compression.zstd.rst:440 +msgid "Digested dictionary" +msgstr "" + +#: library/compression.zstd.rst:441 +msgid "Undigested dictionary" +msgstr "" + +#: library/compression.zstd.rst:442 +msgid "" +"Advanced parameters of the compressor which may be overridden by the " +"dictionary's parameters" +msgstr "" + +#: library/compression.zstd.rst:444 +msgid "" +"``window_log``, ``hash_log``, ``chain_log``, ``search_log``, ``min_match``, " +"``target_length``, ``strategy``, ``enable_long_distance_matching``, " +"``ldm_hash_log``, ``ldm_min_match``, ``ldm_bucket_size_log``, " +"``ldm_hash_rate_log``, and some non-public parameters." +msgstr "" + +#: library/compression.zstd.rst:449 +msgid "None" +msgstr "" + +#: library/compression.zstd.rst:450 +msgid ":class:`!ZstdDict` internally caches the dictionary" +msgstr "" + +#: library/compression.zstd.rst:451 +msgid "" +"Yes. It's faster when loading a digested dictionary again with the same " +"compression level." +msgstr "" + +#: library/compression.zstd.rst:453 +msgid "" +"No. If you wish to load an undigested dictionary multiple times, consider " +"reusing a compressor object." +msgstr "" + +#: library/compression.zstd.rst:456 +msgid "" +"If passing a :class:`!ZstdDict` without any attribute, an undigested " +"dictionary is passed by default when compressing and a digested dictionary " +"is generated if necessary and passed by default when decompressing." +msgstr "" + +#: library/compression.zstd.rst:462 +msgid "" +"The content of the Zstandard dictionary, a ``bytes`` object. It's the same " +"as the *dict_content* argument in the ``__init__`` method. It can be used " +"with other programs, such as the ``zstd`` CLI program." +msgstr "" + +#: library/compression.zstd.rst:468 +msgid "Identifier of the Zstandard dictionary, a non-negative int value." +msgstr "" + +#: library/compression.zstd.rst:470 +msgid "" +"Non-zero means the dictionary is ordinary, created by Zstandard functions " +"and following the Zstandard format." +msgstr "" + +#: library/compression.zstd.rst:473 +msgid "" +"``0`` means a \"raw content\" dictionary, free of any format restriction, " +"used for advanced users." +msgstr "" + +#: library/compression.zstd.rst:478 +msgid "" +"The meaning of ``0`` for :attr:`!ZstdDict.dict_id` is different from the " +"``dictionary_id`` attribute to the :func:`get_frame_info` function." +msgstr "" + +#: library/compression.zstd.rst:484 +msgid "Load as a digested dictionary." +msgstr "" + +#: library/compression.zstd.rst:488 +msgid "Load as an undigested dictionary." +msgstr "" + +#: library/compression.zstd.rst:492 +msgid "Advanced parameter control" +msgstr "" + +#: library/compression.zstd.rst:496 +msgid "" +"An :class:`~enum.IntEnum` containing the advanced compression parameter keys " +"that can be used when compressing data." +msgstr "" + +#: library/compression.zstd.rst:499 library/compression.zstd.rst:733 +msgid "" +"The :meth:`~.bounds` method can be used on any attribute to get the valid " +"values for that parameter." +msgstr "" + +#: library/compression.zstd.rst:502 +msgid "" +"Parameters are optional; any omitted parameter will have it's value selected " +"automatically." +msgstr "" + +#: library/compression.zstd.rst:505 +msgid "" +"Example getting the lower and upper bound of :attr:`~.compression_level`::" +msgstr "" + +#: library/compression.zstd.rst:507 +msgid "lower, upper = CompressionParameter.compression_level.bounds()" +msgstr "" + +#: library/compression.zstd.rst:509 +msgid "Example setting the :attr:`~.window_log` to the maximum size::" +msgstr "" + +#: library/compression.zstd.rst:511 +msgid "" +"_lower, upper = CompressionParameter.window_log.bounds()\n" +"options = {CompressionParameter.window_log: upper}\n" +"compress(b'venezuelan beaver cheese', options=options)" +msgstr "" + +#: library/compression.zstd.rst:517 +msgid "" +"Return the tuple of int bounds, ``(lower, upper)``, of a compression " +"parameter. This method should be called on the attribute you wish to " +"retrieve the bounds of. For example, to get the valid values for :attr:`~." +"compression_level`, one may check the result of ``CompressionParameter." +"compression_level.bounds()``." +msgstr "" + +#: library/compression.zstd.rst:523 library/compression.zstd.rst:751 +msgid "Both the lower and upper bounds are inclusive." +msgstr "" + +#: library/compression.zstd.rst:527 +msgid "" +"A high-level means of setting other compression parameters that affect the " +"speed and ratio of compressing data." +msgstr "" + +#: library/compression.zstd.rst:530 +msgid "" +"Regular compression levels are greater than ``0``. Values greater than " +"``20`` are considered \"ultra\" compression and require more memory than " +"other levels. Negative values can be used to trade off faster compression " +"for worse compression ratios." +msgstr "" + +#: library/compression.zstd.rst:535 +msgid "Setting the level to zero uses :attr:`COMPRESSION_LEVEL_DEFAULT`." +msgstr "" + +#: library/compression.zstd.rst:539 +msgid "" +"Maximum allowed back-reference distance the compressor can use when " +"compressing data, expressed as power of two, ``1 << window_log`` bytes. This " +"parameter greatly influences the memory usage of compression. Higher values " +"require more memory but gain better compression values." +msgstr "" + +#: library/compression.zstd.rst:544 library/compression.zstd.rst:553 +#: library/compression.zstd.rst:564 library/compression.zstd.rst:572 +#: library/compression.zstd.rst:583 library/compression.zstd.rst:598 +#: library/compression.zstd.rst:629 library/compression.zstd.rst:636 +#: library/compression.zstd.rst:644 library/compression.zstd.rst:652 +#: library/compression.zstd.rst:711 library/compression.zstd.rst:760 +msgid "A value of zero causes the value to be selected automatically." +msgstr "" + +#: library/compression.zstd.rst:548 +msgid "" +"Size of the initial probe table, as a power of two. The resulting memory " +"usage is ``1 << (hash_log+2)`` bytes. Larger tables improve compression " +"ratio of strategies <= :attr:`~Strategy.dfast`, and improve compression " +"speed of strategies > :attr:`~Strategy.dfast`." +msgstr "" + +#: library/compression.zstd.rst:557 +msgid "" +"Size of the multi-probe search table, as a power of two. The resulting " +"memory usage is ``1 << (chain_log+2)`` bytes. Larger tables result in better " +"and slower compression. This parameter has no effect for the :attr:" +"`~Strategy.fast` strategy. It's still useful when using :attr:`~Strategy." +"dfast` strategy, in which case it defines a secondary probe table." +msgstr "" + +#: library/compression.zstd.rst:568 +msgid "" +"Number of search attempts, as a power of two. More attempts result in better " +"and slower compression. This parameter is useless for :attr:`~Strategy.fast` " +"and :attr:`~Strategy.dfast` strategies." +msgstr "" + +#: library/compression.zstd.rst:576 +msgid "" +"Minimum size of searched matches. Larger values increase compression and " +"decompression speed, but decrease ratio. Note that Zstandard can still find " +"matches of smaller size, it just tweaks its search algorithm to look for " +"this size and larger. For all strategies < :attr:`~Strategy.btopt`, the " +"effective minimum is ``4``; for all strategies > :attr:`~Strategy.fast`, the " +"effective maximum is ``6``." +msgstr "" + +#: library/compression.zstd.rst:587 +msgid "The impact of this field depends on the selected :class:`Strategy`." +msgstr "" + +#: library/compression.zstd.rst:589 +msgid "" +"For strategies :attr:`~Strategy.btopt`, :attr:`~Strategy.btultra` and :attr:" +"`~Strategy.btultra2`, the value is the length of a match considered \"good " +"enough\" to stop searching. Larger values make compression ratios better, " +"but compresses slower." +msgstr "" + +#: library/compression.zstd.rst:594 +msgid "" +"For strategy :attr:`~Strategy.fast`, it is the distance between match " +"sampling. Larger values make compression faster, but with a worse " +"compression ratio." +msgstr "" + +#: library/compression.zstd.rst:602 +msgid "" +"The higher the value of selected strategy, the more complex the compression " +"technique used by zstd, resulting in higher compression ratios but slower " +"compression." +msgstr "" + +#: library/compression.zstd.rst:606 +msgid ":class:`Strategy`" +msgstr "" + +#: library/compression.zstd.rst:610 +msgid "" +"Long distance matching can be used to improve compression for large inputs " +"by finding large matches at greater distances. It increases memory usage and " +"window size." +msgstr "" + +#: library/compression.zstd.rst:614 +msgid "" +"``True`` or ``1`` enable long distance matching while ``False`` or ``0`` " +"disable it." +msgstr "" + +#: library/compression.zstd.rst:617 +msgid "" +"Enabling this parameter increases default :attr:`~CompressionParameter." +"window_log` to 128 MiB except when expressly set to a different value. This " +"setting is enabled by default if :attr:`!window_log` >= 128 MiB and the " +"compression strategy >= :attr:`~Strategy.btopt` (compression level 16+)." +msgstr "" + +#: library/compression.zstd.rst:625 +msgid "" +"Size of the table for long distance matching, as a power of two. Larger " +"values increase memory usage and compression ratio, but decrease compression " +"speed." +msgstr "" + +#: library/compression.zstd.rst:633 +msgid "" +"Minimum match size for long distance matcher. Larger or too small values can " +"often decrease the compression ratio." +msgstr "" + +#: library/compression.zstd.rst:640 +msgid "" +"Log size of each bucket in the long distance matcher hash table for " +"collision resolution. Larger values improve collision resolution but " +"decrease compression speed." +msgstr "" + +#: library/compression.zstd.rst:648 +msgid "" +"Frequency of inserting/looking up entries into the long distance matcher " +"hash table. Larger values improve compression speed. Deviating far from the " +"default value will likely result in a compression ratio decrease." +msgstr "" + +#: library/compression.zstd.rst:656 +msgid "" +"Write the size of the data to be compressed into the Zstandard frame header " +"when known prior to compressing." +msgstr "" + +#: library/compression.zstd.rst:659 +msgid "This flag only takes effect under the following scenarios:" +msgstr "" + +#: library/compression.zstd.rst:661 +msgid "Calling :func:`compress` for one-shot compression" +msgstr "" + +#: library/compression.zstd.rst:662 +msgid "" +"Providing all of the data to be compressed in the frame in a single :meth:" +"`ZstdCompressor.compress` call, with the :attr:`ZstdCompressor.FLUSH_FRAME` " +"mode." +msgstr "" + +#: library/compression.zstd.rst:665 +msgid "" +"Calling :meth:`ZstdCompressor.set_pledged_input_size` with the exact amount " +"of data that will be provided to the compressor prior to any calls to :meth:" +"`ZstdCompressor.compress` for the current frame. :meth:`!ZstdCompressor." +"set_pledged_input_size` must be called for each new frame." +msgstr "" + +#: library/compression.zstd.rst:671 +msgid "" +"All other compression calls may not write the size information into the " +"frame header." +msgstr "" + +#: library/compression.zstd.rst:674 +msgid "" +"``True`` or ``1`` enable the content size flag while ``False`` or ``0`` " +"disable it." +msgstr "" + +#: library/compression.zstd.rst:679 +msgid "" +"A four-byte checksum using XXHash64 of the uncompressed content is written " +"at the end of each frame. Zstandard's decompression code verifies the " +"checksum. If there is a mismatch a :class:`ZstdError` exception is raised." +msgstr "" + +#: library/compression.zstd.rst:684 +msgid "" +"``True`` or ``1`` enable checksum generation while ``False`` or ``0`` " +"disable it." +msgstr "" + +#: library/compression.zstd.rst:689 +msgid "" +"When compressing with a :class:`ZstdDict`, the dictionary's ID is written " +"into the frame header." +msgstr "" + +#: library/compression.zstd.rst:692 +msgid "" +"``True`` or ``1`` enable storing the dictionary ID while ``False`` or ``0`` " +"disable it." +msgstr "" + +#: library/compression.zstd.rst:697 +msgid "" +"Select how many threads will be spawned to compress in parallel. When :attr:" +"`!nb_workers` > 0, enables multi-threaded compression, a value of ``1`` " +"means \"one-thread multi-threaded mode\". More workers improve speed, but " +"also increase memory usage and slightly reduce compression ratio." +msgstr "" + +#: library/compression.zstd.rst:702 +msgid "A value of zero disables multi-threading." +msgstr "" + +#: library/compression.zstd.rst:706 +msgid "" +"Size of a compression job, in bytes. This value is enforced only when :attr:" +"`~CompressionParameter.nb_workers` >= 1. Each compression job is completed " +"in parallel, so this value can indirectly impact the number of active " +"threads." +msgstr "" + +#: library/compression.zstd.rst:715 +msgid "" +"Sets how much data is reloaded from previous jobs (threads) for new jobs to " +"be used by the look behind window during compression. This value is only " +"used when :attr:`~CompressionParameter.nb_workers` >= 1. Acceptable values " +"vary from 0 to 9." +msgstr "" + +#: library/compression.zstd.rst:720 +msgid "0 means dynamically set the overlap amount" +msgstr "" + +#: library/compression.zstd.rst:721 +msgid "1 means no overlap" +msgstr "" + +#: library/compression.zstd.rst:722 +msgid "9 means use a full window size from the previous job" +msgstr "" + +#: library/compression.zstd.rst:724 +msgid "" +"Each increment halves/doubles the overlap size. \"8\" means an overlap of " +"``window_size/2``, \"7\" means an overlap of ``window_size/4``, etc." +msgstr "" + +#: library/compression.zstd.rst:729 +msgid "" +"An :class:`~enum.IntEnum` containing the advanced decompression parameter " +"keys that can be used when decompressing data. Parameters are optional; any " +"omitted parameter will have it's value selected automatically." +msgstr "" + +#: library/compression.zstd.rst:736 +msgid "Example setting the :attr:`~.window_log_max` to the maximum size::" +msgstr "" + +#: library/compression.zstd.rst:738 +msgid "" +"data = compress(b'Some very long buffer of bytes...')\n" +"\n" +"_lower, upper = DecompressionParameter.window_log_max.bounds()\n" +"\n" +"options = {DecompressionParameter.window_log_max: upper}\n" +"decompress(data, options=options)" +msgstr "" + +#: library/compression.zstd.rst:747 +msgid "" +"Return the tuple of int bounds, ``(lower, upper)``, of a decompression " +"parameter. This method should be called on the attribute you wish to " +"retrieve the bounds of." +msgstr "" + +#: library/compression.zstd.rst:755 +msgid "" +"The base-two logarithm of the maximum size of the window used during " +"decompression. This can be useful to limit the amount of memory used when " +"decompressing data. A larger maximum window size leads to faster " +"decompression." +msgstr "" + +#: library/compression.zstd.rst:765 +msgid "" +"An :class:`~enum.IntEnum` containing strategies for compression. Higher-" +"numbered strategies correspond to more complex and slower compression." +msgstr "" + +#: library/compression.zstd.rst:771 +msgid "" +"The values of attributes of :class:`!Strategy` are not necessarily stable " +"across zstd versions. Only the ordering of the attributes may be relied " +"upon. The attributes are listed below in order." +msgstr "" + +#: library/compression.zstd.rst:775 +msgid "The following strategies are available:" +msgstr "" + +#: library/compression.zstd.rst:797 +msgid "Miscellaneous" +msgstr "" + +#: library/compression.zstd.rst:801 +msgid "" +"Retrieve a :class:`FrameInfo` object containing metadata about a Zstandard " +"frame. Frames contain metadata related to the compressed data they hold." +msgstr "" + +#: library/compression.zstd.rst:807 +msgid "Metadata related to a Zstandard frame." +msgstr "" + +#: library/compression.zstd.rst:811 +msgid "The size of the decompressed contents of the frame." +msgstr "" + +#: library/compression.zstd.rst:815 +msgid "" +"An integer representing the Zstandard dictionary ID needed for decompressing " +"the frame. ``0`` means the dictionary ID was not recorded in the frame " +"header. This may mean that a Zstandard dictionary is not needed, or that the " +"ID of a required dictionary was not recorded." +msgstr "" + +#: library/compression.zstd.rst:823 +msgid "The default compression level for Zstandard: ``3``." +msgstr "" + +#: library/compression.zstd.rst:828 +msgid "" +"Version number of the runtime zstd library as a tuple of integers (major, " +"minor, release)." +msgstr "" + +#: library/compression.zstd.rst:833 +msgid "Examples" +msgstr "" + +#: library/compression.zstd.rst:835 +msgid "Reading in a compressed file:" +msgstr "" + +#: library/compression.zstd.rst:837 +msgid "" +"from compression import zstd\n" +"\n" +"with zstd.open(\"file.zst\") as f:\n" +" file_content = f.read()" +msgstr "" + +#: library/compression.zstd.rst:844 +msgid "Creating a compressed file:" +msgstr "" + +#: library/compression.zstd.rst:846 +msgid "" +"from compression import zstd\n" +"\n" +"data = b\"Insert Data Here\"\n" +"with zstd.open(\"file.zst\", \"w\") as f:\n" +" f.write(data)" +msgstr "" + +#: library/compression.zstd.rst:854 +msgid "Compressing data in memory:" +msgstr "" + +#: library/compression.zstd.rst:856 +msgid "" +"from compression import zstd\n" +"\n" +"data_in = b\"Insert Data Here\"\n" +"data_out = zstd.compress(data_in)" +msgstr "" + +#: library/compression.zstd.rst:863 +msgid "Incremental compression:" +msgstr "" + +#: library/compression.zstd.rst:865 +msgid "" +"from compression import zstd\n" +"\n" +"comp = zstd.ZstdCompressor()\n" +"out1 = comp.compress(b\"Some data\\n\")\n" +"out2 = comp.compress(b\"Another piece of data\\n\")\n" +"out3 = comp.compress(b\"Even more data\\n\")\n" +"out4 = comp.flush()\n" +"# Concatenate all the partial results:\n" +"result = b\"\".join([out1, out2, out3, out4])" +msgstr "" + +#: library/compression.zstd.rst:877 +msgid "Writing compressed data to an already-open file:" +msgstr "" + +#: library/compression.zstd.rst:879 +msgid "" +"from compression import zstd\n" +"\n" +"with open(\"myfile\", \"wb\") as f:\n" +" f.write(b\"This data will not be compressed\\n\")\n" +" with zstd.open(f, \"w\") as zstf:\n" +" zstf.write(b\"This *will* be compressed\\n\")\n" +" f.write(b\"Not compressed\\n\")" +msgstr "" + +#: library/compression.zstd.rst:889 +msgid "Creating a compressed file using compression parameters:" +msgstr "" + +#: library/compression.zstd.rst:891 +msgid "" +"from compression import zstd\n" +"\n" +"options = {\n" +" zstd.CompressionParameter.checksum_flag: 1\n" +"}\n" +"with zstd.open(\"file.zst\", \"w\", options=options) as f:\n" +" f.write(b\"Mind if I squeeze in?\")" +msgstr "" diff --git a/library/concurrency.po b/library/concurrency.po index 5619e78f..60ab2dd2 100644 --- a/library/concurrency.po +++ b/library/concurrency.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -29,6 +30,6 @@ msgid "" "an overview:" msgstr "" -#: library/concurrency.rst:27 +#: library/concurrency.rst:28 msgid "The following are support modules for some of the above services:" msgstr "" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index a7b7b065..2a8ad01f 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -8,81 +8,93 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/concurrent.futures.rst:2 -msgid ":mod:`concurrent.futures` --- Launching parallel tasks" +msgid ":mod:`!concurrent.futures` --- Launching parallel tasks" msgstr "" #: library/concurrent.futures.rst:9 msgid "" -"**Source code:** :source:`Lib/concurrent/futures/thread.py` and :source:`Lib/" -"concurrent/futures/process.py`" +"**Source code:** :source:`Lib/concurrent/futures/thread.py`, :source:`Lib/" +"concurrent/futures/process.py`, and :source:`Lib/concurrent/futures/" +"interpreter.py`" msgstr "" -#: library/concurrent.futures.rst:14 +#: library/concurrent.futures.rst:15 msgid "" "The :mod:`concurrent.futures` module provides a high-level interface for " "asynchronously executing callables." msgstr "" -#: library/concurrent.futures.rst:17 +#: library/concurrent.futures.rst:18 msgid "" "The asynchronous execution can be performed with threads, using :class:" -"`ThreadPoolExecutor`, or separate processes, using :class:" -"`ProcessPoolExecutor`. Both implement the same interface, which is defined " -"by the abstract :class:`Executor` class." +"`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or separate " +"processes, using :class:`ProcessPoolExecutor`. Each implements the same " +"interface, which is defined by the abstract :class:`Executor` class." msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -#: library/concurrent.futures.rst:25 +#: library/concurrent.futures.rst:27 msgid "Executor Objects" msgstr "" -#: library/concurrent.futures.rst:29 +#: library/concurrent.futures.rst:31 msgid "" "An abstract class that provides methods to execute calls asynchronously. It " "should not be used directly, but through its concrete subclasses." msgstr "" -#: library/concurrent.futures.rst:34 +#: library/concurrent.futures.rst:36 msgid "" "Schedules the callable, *fn*, to be executed as ``fn(*args, **kwargs)`` and " "returns a :class:`Future` object representing the execution of the " "callable. ::" msgstr "" -#: library/concurrent.futures.rst:44 -msgid "Similar to :func:`map(fn, *iterables) ` except:" +#: library/concurrent.futures.rst:40 +msgid "" +"with ThreadPoolExecutor(max_workers=1) as executor:\n" +" future = executor.submit(pow, 323, 1235)\n" +" print(future.result())" msgstr "" #: library/concurrent.futures.rst:46 -msgid "the *iterables* are collected immediately rather than lazily;" +msgid "Similar to :func:`map(fn, *iterables) ` except:" msgstr "" #: library/concurrent.futures.rst:48 msgid "" +"The *iterables* are collected immediately rather than lazily, unless a " +"*buffersize* is specified to limit the number of submitted tasks whose " +"results have not yet been yielded. If the buffer is full, iteration over the " +"*iterables* pauses until a result is yielded from the buffer." +msgstr "" + +#: library/concurrent.futures.rst:53 +msgid "" "*fn* is executed asynchronously and several calls to *fn* may be made " "concurrently." msgstr "" -#: library/concurrent.futures.rst:51 +#: library/concurrent.futures.rst:56 msgid "" "The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator." "__next__` is called and the result isn't available after *timeout* seconds " @@ -91,27 +103,32 @@ msgid "" "wait time." msgstr "" -#: library/concurrent.futures.rst:57 +#: library/concurrent.futures.rst:62 msgid "" "If a *fn* call raises an exception, then that exception will be raised when " "its value is retrieved from the iterator." msgstr "" -#: library/concurrent.futures.rst:60 +#: library/concurrent.futures.rst:65 msgid "" "When using :class:`ProcessPoolExecutor`, this method chops *iterables* into " "a number of chunks which it submits to the pool as separate tasks. The " "(approximate) size of these chunks can be specified by setting *chunksize* " "to a positive integer. For very long iterables, using a large value for " "*chunksize* can significantly improve performance compared to the default " -"size of 1. With :class:`ThreadPoolExecutor`, *chunksize* has no effect." +"size of 1. With :class:`ThreadPoolExecutor` and :class:" +"`InterpreterPoolExecutor`, *chunksize* has no effect." msgstr "" -#: library/concurrent.futures.rst:68 -msgid "Added the *chunksize* argument." +#: library/concurrent.futures.rst:74 +msgid "Added the *chunksize* parameter." msgstr "" -#: library/concurrent.futures.rst:73 +#: library/concurrent.futures.rst:77 +msgid "Added the *buffersize* parameter." +msgstr "" + +#: library/concurrent.futures.rst:82 msgid "" "Signal the executor that it should free any resources that it is using when " "the currently pending futures are done executing. Calls to :meth:`Executor." @@ -119,7 +136,7 @@ msgid "" "`RuntimeError`." msgstr "" -#: library/concurrent.futures.rst:78 +#: library/concurrent.futures.rst:87 msgid "" "If *wait* is ``True`` then this method will not return until all the pending " "futures are done executing and the resources associated with the executor " @@ -130,58 +147,100 @@ msgid "" "are done executing." msgstr "" -#: library/concurrent.futures.rst:86 +#: library/concurrent.futures.rst:95 msgid "" "If *cancel_futures* is ``True``, this method will cancel all pending futures " "that the executor has not started running. Any futures that are completed or " "running won't be cancelled, regardless of the value of *cancel_futures*." msgstr "" -#: library/concurrent.futures.rst:91 +#: library/concurrent.futures.rst:100 msgid "" "If both *cancel_futures* and *wait* are ``True``, all futures that the " "executor has started running will be completed prior to this method " "returning. The remaining futures are cancelled." msgstr "" -#: library/concurrent.futures.rst:95 +#: library/concurrent.futures.rst:104 +msgid "" +"You can avoid having to call this method explicitly if you use the executor " +"as a :term:`context manager` via the :keyword:`with` statement, which will " +"shutdown the :class:`Executor` (waiting as if :meth:`Executor.shutdown` were " +"called with *wait* set to ``True``)::" +msgstr "" + +#: library/concurrent.futures.rst:109 msgid "" -"You can avoid having to call this method explicitly if you use the :keyword:" -"`with` statement, which will shutdown the :class:`Executor` (waiting as if :" -"meth:`Executor.shutdown` were called with *wait* set to ``True``)::" +"import shutil\n" +"with ThreadPoolExecutor(max_workers=4) as e:\n" +" e.submit(shutil.copy, 'src1.txt', 'dest1.txt')\n" +" e.submit(shutil.copy, 'src2.txt', 'dest2.txt')\n" +" e.submit(shutil.copy, 'src3.txt', 'dest3.txt')\n" +" e.submit(shutil.copy, 'src4.txt', 'dest4.txt')" msgstr "" -#: library/concurrent.futures.rst:107 +#: library/concurrent.futures.rst:116 msgid "Added *cancel_futures*." msgstr "" -#: library/concurrent.futures.rst:112 +#: library/concurrent.futures.rst:121 msgid "ThreadPoolExecutor" msgstr "" -#: library/concurrent.futures.rst:114 +#: library/concurrent.futures.rst:123 msgid "" ":class:`ThreadPoolExecutor` is an :class:`Executor` subclass that uses a " "pool of threads to execute calls asynchronously." msgstr "" -#: library/concurrent.futures.rst:117 +#: library/concurrent.futures.rst:126 msgid "" "Deadlocks can occur when the callable associated with a :class:`Future` " "waits on the results of another :class:`Future`. For example::" msgstr "" -#: library/concurrent.futures.rst:136 +#: library/concurrent.futures.rst:129 +msgid "" +"import time\n" +"def wait_on_b():\n" +" time.sleep(5)\n" +" print(b.result()) # b will never complete because it is waiting on a.\n" +" return 5\n" +"\n" +"def wait_on_a():\n" +" time.sleep(5)\n" +" print(a.result()) # a will never complete because it is waiting on b.\n" +" return 6\n" +"\n" +"\n" +"executor = ThreadPoolExecutor(max_workers=2)\n" +"a = executor.submit(wait_on_b)\n" +"b = executor.submit(wait_on_a)" +msgstr "" + +#: library/concurrent.futures.rst:145 msgid "And::" msgstr "" -#: library/concurrent.futures.rst:150 +#: library/concurrent.futures.rst:147 +msgid "" +"def wait_on_future():\n" +" f = executor.submit(pow, 5, 2)\n" +" # This will never complete because there is only one worker thread and\n" +" # it is executing this function.\n" +" print(f.result())\n" +"\n" +"executor = ThreadPoolExecutor(max_workers=1)\n" +"executor.submit(wait_on_future)" +msgstr "" + +#: library/concurrent.futures.rst:159 msgid "" "An :class:`Executor` subclass that uses a pool of at most *max_workers* " "threads to execute calls asynchronously." msgstr "" -#: library/concurrent.futures.rst:153 +#: library/concurrent.futures.rst:162 msgid "" "All threads enqueued to ``ThreadPoolExecutor`` will be joined before the " "interpreter can exit. Note that the exit handler which does this is executed " @@ -191,7 +250,7 @@ msgid "" "``ThreadPoolExecutor`` not be used for long-running tasks." msgstr "" -#: library/concurrent.futures.rst:160 +#: library/concurrent.futures.rst:169 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker thread; *initargs* is a tuple of arguments passed to the " @@ -200,7 +259,7 @@ msgid "" "well as any attempt to submit more jobs to the pool." msgstr "" -#: library/concurrent.futures.rst:166 +#: library/concurrent.futures.rst:175 msgid "" "If *max_workers* is ``None`` or not given, it will default to the number of " "processors on the machine, multiplied by ``5``, assuming that :class:" @@ -209,18 +268,18 @@ msgid "" "`ProcessPoolExecutor`." msgstr "" -#: library/concurrent.futures.rst:174 +#: library/concurrent.futures.rst:183 msgid "" "Added the *thread_name_prefix* parameter to allow users to control the :" "class:`threading.Thread` names for worker threads created by the pool for " "easier debugging." msgstr "" -#: library/concurrent.futures.rst:179 library/concurrent.futures.rst:283 +#: library/concurrent.futures.rst:188 library/concurrent.futures.rst:393 msgid "Added the *initializer* and *initargs* arguments." msgstr "" -#: library/concurrent.futures.rst:182 +#: library/concurrent.futures.rst:191 msgid "" "Default value of *max_workers* is changed to ``min(32, os.cpu_count() + " "4)``. This default value preserves at least 5 workers for I/O bound tasks. " @@ -228,21 +287,174 @@ msgid "" "And it avoids using very large resources implicitly on many-core machines." msgstr "" -#: library/concurrent.futures.rst:188 +#: library/concurrent.futures.rst:197 msgid "" "ThreadPoolExecutor now reuses idle worker threads before starting " "*max_workers* worker threads too." msgstr "" -#: library/concurrent.futures.rst:195 +#: library/concurrent.futures.rst:200 +msgid "" +"Default value of *max_workers* is changed to ``min(32, (os." +"process_cpu_count() or 1) + 4)``." +msgstr "" + +#: library/concurrent.futures.rst:208 msgid "ThreadPoolExecutor Example" msgstr "" -#: library/concurrent.futures.rst:227 +#: library/concurrent.futures.rst:211 +msgid "" +"import concurrent.futures\n" +"import urllib.request\n" +"\n" +"URLS = ['http://www.foxnews.com/',\n" +" 'http://www.cnn.com/',\n" +" 'http://europe.wsj.com/',\n" +" 'http://www.bbc.co.uk/',\n" +" 'http://nonexistent-subdomain.python.org/']\n" +"\n" +"# Retrieve a single page and report the URL and contents\n" +"def load_url(url, timeout):\n" +" with urllib.request.urlopen(url, timeout=timeout) as conn:\n" +" return conn.read()\n" +"\n" +"# We can use a with statement to ensure threads are cleaned up promptly\n" +"with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:\n" +" # Start the load operations and mark each future with its URL\n" +" future_to_url = {executor.submit(load_url, url, 60): url for url in " +"URLS}\n" +" for future in concurrent.futures.as_completed(future_to_url):\n" +" url = future_to_url[future]\n" +" try:\n" +" data = future.result()\n" +" except Exception as exc:\n" +" print('%r generated an exception: %s' % (url, exc))\n" +" else:\n" +" print('%r page is %d bytes' % (url, len(data)))" +msgstr "" + +#: library/concurrent.futures.rst:240 +msgid "InterpreterPoolExecutor" +msgstr "" + +#: library/concurrent.futures.rst:244 +msgid "" +"The :class:`InterpreterPoolExecutor` class uses a pool of interpreters to " +"execute calls asynchronously. It is a :class:`ThreadPoolExecutor` subclass, " +"which means each worker is running in its own thread. The difference here is " +"that each worker has its own interpreter, and runs each task using that " +"interpreter." +msgstr "" + +#: library/concurrent.futures.rst:250 +msgid "" +"The biggest benefit to using interpreters instead of only threads is true " +"multi-core parallelism. Each interpreter has its own :term:`Global " +"Interpreter Lock `, so code running in one " +"interpreter can run on one CPU core, while code in another interpreter runs " +"unblocked on a different core." +msgstr "" + +#: library/concurrent.futures.rst:256 +msgid "" +"The tradeoff is that writing concurrent code for use with multiple " +"interpreters can take extra effort. However, this is because it forces you " +"to be deliberate about how and when interpreters interact, and to be " +"explicit about what data is shared between interpreters. This results in " +"several benefits that help balance the extra effort, including true multi-" +"core parallelism, For example, code written this way can make it easier to " +"reason about concurrency. Another major benefit is that you don't have to " +"deal with several of the big pain points of using threads, like race " +"conditions." +msgstr "" + +#: library/concurrent.futures.rst:266 +msgid "" +"Each worker's interpreter is isolated from all the other interpreters. " +"\"Isolated\" means each interpreter has its own runtime state and operates " +"completely independently. For example, if you redirect :data:`sys.stdout` " +"in one interpreter, it will not be automatically redirected to any other " +"interpreter. If you import a module in one interpreter, it is not " +"automatically imported in any other. You would need to import the module " +"separately in interpreter where you need it. In fact, each module imported " +"in an interpreter is a completely separate object from the same module in a " +"different interpreter, including :mod:`sys`, :mod:`builtins`, and even " +"``__main__``." +msgstr "" + +#: library/concurrent.futures.rst:278 +msgid "" +"Isolation means a mutable object, or other data, cannot be used by more than " +"one interpreter at the same time. That effectively means interpreters " +"cannot actually share such objects or data. Instead, each interpreter must " +"have its own copy, and you will have to synchronize any changes between the " +"copies manually. Immutable objects and data, like the builtin singletons, " +"strings, and tuples of immutable objects, don't have these limitations." +msgstr "" + +#: library/concurrent.futures.rst:286 +msgid "" +"Communicating and synchronizing between interpreters is most effectively " +"done using dedicated tools, like those proposed in :pep:`734`. One less " +"efficient alternative is to serialize with :mod:`pickle` and then send the " +"bytes over a shared :mod:`socket ` or :func:`pipe `." +msgstr "" + +#: library/concurrent.futures.rst:294 +msgid "" +"A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously " +"using a pool of at most *max_workers* threads. Each thread runs tasks in " +"its own interpreter. The worker interpreters are isolated from each other, " +"which means each has its own runtime state and that they can't share any " +"mutable objects or other data. Each interpreter has its own :term:`Global " +"Interpreter Lock `, which means code run with this " +"executor has true multi-core parallelism." +msgstr "" + +#: library/concurrent.futures.rst:302 +msgid "" +"The optional *initializer* and *initargs* arguments have the same meaning as " +"for :class:`!ThreadPoolExecutor`: the initializer is run when each worker is " +"created, though in this case it is run in the worker's interpreter. The " +"executor serializes the *initializer* and *initargs* using :mod:`pickle` " +"when sending them to the worker's interpreter." +msgstr "" + +#: library/concurrent.futures.rst:310 +msgid "" +"The executor may replace uncaught exceptions from *initializer* with :class:" +"`~concurrent.futures.interpreter.ExecutionFailed`." +msgstr "" + +#: library/concurrent.futures.rst:313 +msgid "Other caveats from parent :class:`ThreadPoolExecutor` apply here." +msgstr "" + +#: library/concurrent.futures.rst:315 +msgid "" +":meth:`~Executor.submit` and :meth:`~Executor.map` work like normal, except " +"the worker serializes the callable and arguments using :mod:`pickle` when " +"sending them to its interpreter. The worker likewise serializes the return " +"value when sending it back." +msgstr "" + +#: library/concurrent.futures.rst:320 +msgid "" +"When a worker's current task raises an uncaught exception, the worker always " +"tries to preserve the exception as-is. If that is successful then it also " +"sets the ``__cause__`` to a corresponding :class:`~concurrent.futures." +"interpreter.ExecutionFailed` instance, which contains a summary of the " +"original exception. In the uncommon case that the worker is not able to " +"preserve the original as-is then it directly preserves the corresponding :" +"class:`~concurrent.futures.interpreter.ExecutionFailed` instance instead." +msgstr "" + +#: library/concurrent.futures.rst:332 msgid "ProcessPoolExecutor" msgstr "" -#: library/concurrent.futures.rst:229 +#: library/concurrent.futures.rst:334 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " "uses a pool of processes to execute calls asynchronously. :class:" @@ -252,35 +464,43 @@ msgid "" "returned." msgstr "" -#: library/concurrent.futures.rst:236 +#: library/concurrent.futures.rst:341 msgid "" "The ``__main__`` module must be importable by worker subprocesses. This " "means that :class:`ProcessPoolExecutor` will not work in the interactive " "interpreter." msgstr "" -#: library/concurrent.futures.rst:239 +#: library/concurrent.futures.rst:344 msgid "" "Calling :class:`Executor` or :class:`Future` methods from a callable " "submitted to a :class:`ProcessPoolExecutor` will result in deadlock." msgstr "" -#: library/concurrent.futures.rst:244 +#: library/concurrent.futures.rst:347 +msgid "" +"Note that the restrictions on functions and arguments needing to picklable " +"as per :class:`multiprocessing.Process` apply when using :meth:`~Executor." +"submit` and :meth:`~Executor.map` on a :class:`ProcessPoolExecutor`. A " +"function defined in a REPL or a lambda should not be expected to work." +msgstr "" + +#: library/concurrent.futures.rst:354 msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " -"not given, it will default to the number of processors on the machine. If " -"*max_workers* is less than or equal to ``0``, then a :exc:`ValueError` will " -"be raised. On Windows, *max_workers* must be less than or equal to ``61``. " -"If it is not then :exc:`ValueError` will be raised. If *max_workers* is " -"``None``, then the default chosen will be at most ``61``, even if more " -"processors are available. *mp_context* can be a :mod:`multiprocessing` " -"context or ``None``. It will be used to launch the workers. If *mp_context* " -"is ``None`` or not given, the default :mod:`multiprocessing` context is " -"used. See :ref:`multiprocessing-start-methods`." +"not given, it will default to :func:`os.process_cpu_count`. If *max_workers* " +"is less than or equal to ``0``, then a :exc:`ValueError` will be raised. On " +"Windows, *max_workers* must be less than or equal to ``61``. If it is not " +"then :exc:`ValueError` will be raised. If *max_workers* is ``None``, then " +"the default chosen will be at most ``61``, even if more processors are " +"available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " +"It will be used to launch the workers. If *mp_context* is ``None`` or not " +"given, the default :mod:`multiprocessing` context is used. See :ref:" +"`multiprocessing-start-methods`." msgstr "" -#: library/concurrent.futures.rst:258 +#: library/concurrent.futures.rst:368 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker process; *initargs* is a tuple of arguments passed to the " @@ -289,7 +509,7 @@ msgid "" "well as any attempt to submit more jobs to the pool." msgstr "" -#: library/concurrent.futures.rst:264 +#: library/concurrent.futures.rst:374 msgid "" "*max_tasks_per_child* is an optional argument that specifies the maximum " "number of tasks a single process can execute before it will exit and be " @@ -300,7 +520,7 @@ msgid "" "with the \"fork\" start method." msgstr "" -#: library/concurrent.futures.rst:272 +#: library/concurrent.futures.rst:382 msgid "" "When one of the worker processes terminates abruptly, a :exc:`~concurrent." "futures.process.BrokenProcessPool` error is now raised. Previously, " @@ -308,28 +528,19 @@ msgid "" "often freeze or deadlock." msgstr "" -#: library/concurrent.futures.rst:279 +#: library/concurrent.futures.rst:389 msgid "" "The *mp_context* argument was added to allow users to control the " "start_method for worker processes created by the pool." msgstr "" -#: library/concurrent.futures.rst:286 -msgid "" -"The default :mod:`multiprocessing` start method (see :ref:`multiprocessing-" -"start-methods`) will change away from *fork* in Python 3.14. Code that " -"requires *fork* be used for their :class:`ProcessPoolExecutor` should " -"explicitly specify that by passing a ``mp_context=multiprocessing." -"get_context(\"fork\")`` parameter." -msgstr "" - -#: library/concurrent.futures.rst:293 +#: library/concurrent.futures.rst:395 msgid "" "The *max_tasks_per_child* argument was added to allow users to control the " "lifetime of workers in the pool." msgstr "" -#: library/concurrent.futures.rst:297 +#: library/concurrent.futures.rst:399 msgid "" "On POSIX systems, if your application has multiple threads and the :mod:" "`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." @@ -338,28 +549,100 @@ msgid "" "start method. See the :func:`os.fork` documentation for further explanation." msgstr "" -#: library/concurrent.futures.rst:308 +#: library/concurrent.futures.rst:407 +msgid "" +"*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" +"`os.cpu_count`." +msgstr "" + +#: library/concurrent.futures.rst:411 +msgid "" +"The default process start method (see :ref:`multiprocessing-start-methods`) " +"changed away from *fork*. If you require the *fork* start method for :class:" +"`ProcessPoolExecutor` you must explicitly pass ``mp_context=multiprocessing." +"get_context(\"fork\")``." +msgstr "" + +#: library/concurrent.futures.rst:419 +msgid "" +"Attempt to terminate all living worker processes immediately by calling :" +"meth:`Process.terminate ` on each of " +"them. Internally, it will also call :meth:`Executor.shutdown` to ensure that " +"all other resources associated with the executor are freed." +msgstr "" + +#: library/concurrent.futures.rst:424 library/concurrent.futures.rst:436 +msgid "" +"After calling this method the caller should no longer submit tasks to the " +"executor." +msgstr "" + +#: library/concurrent.futures.rst:431 +msgid "" +"Attempt to kill all living worker processes immediately by calling :meth:" +"`Process.kill ` on each of them. Internally, " +"it will also call :meth:`Executor.shutdown` to ensure that all other " +"resources associated with the executor are freed." +msgstr "" + +#: library/concurrent.futures.rst:444 msgid "ProcessPoolExecutor Example" msgstr "" -#: library/concurrent.futures.rst:346 +#: library/concurrent.futures.rst:447 +msgid "" +"import concurrent.futures\n" +"import math\n" +"\n" +"PRIMES = [\n" +" 112272535095293,\n" +" 112582705942171,\n" +" 112272535095293,\n" +" 115280095190773,\n" +" 115797848077099,\n" +" 1099726899285419]\n" +"\n" +"def is_prime(n):\n" +" if n < 2:\n" +" return False\n" +" if n == 2:\n" +" return True\n" +" if n % 2 == 0:\n" +" return False\n" +"\n" +" sqrt_n = int(math.floor(math.sqrt(n)))\n" +" for i in range(3, sqrt_n + 1, 2):\n" +" if n % i == 0:\n" +" return False\n" +" return True\n" +"\n" +"def main():\n" +" with concurrent.futures.ProcessPoolExecutor() as executor:\n" +" for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):\n" +" print('%d is prime: %s' % (number, prime))\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: library/concurrent.futures.rst:482 msgid "Future Objects" msgstr "" -#: library/concurrent.futures.rst:348 +#: library/concurrent.futures.rst:484 msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -#: library/concurrent.futures.rst:353 +#: library/concurrent.futures.rst:489 msgid "" "Encapsulates the asynchronous execution of a callable. :class:`Future` " "instances are created by :meth:`Executor.submit` and should not be created " "directly except for testing." msgstr "" -#: library/concurrent.futures.rst:359 +#: library/concurrent.futures.rst:495 msgid "" "Attempt to cancel the call. If the call is currently being executed or " "finished running and cannot be cancelled then the method will return " @@ -367,22 +650,22 @@ msgid "" "``True``." msgstr "" -#: library/concurrent.futures.rst:366 +#: library/concurrent.futures.rst:502 msgid "Return ``True`` if the call was successfully cancelled." msgstr "" -#: library/concurrent.futures.rst:370 +#: library/concurrent.futures.rst:506 msgid "" "Return ``True`` if the call is currently being executed and cannot be " "cancelled." msgstr "" -#: library/concurrent.futures.rst:375 +#: library/concurrent.futures.rst:511 msgid "" "Return ``True`` if the call was successfully cancelled or finished running." msgstr "" -#: library/concurrent.futures.rst:380 +#: library/concurrent.futures.rst:516 msgid "" "Return the value returned by the call. If the call hasn't yet completed then " "this method will wait up to *timeout* seconds. If the call hasn't completed " @@ -391,18 +674,18 @@ msgid "" "no limit to the wait time." msgstr "" -#: library/concurrent.futures.rst:387 library/concurrent.futures.rst:401 +#: library/concurrent.futures.rst:523 library/concurrent.futures.rst:537 msgid "" "If the future is cancelled before completing then :exc:`.CancelledError` " "will be raised." msgstr "" -#: library/concurrent.futures.rst:390 +#: library/concurrent.futures.rst:526 msgid "" "If the call raised an exception, this method will raise the same exception." msgstr "" -#: library/concurrent.futures.rst:394 +#: library/concurrent.futures.rst:530 msgid "" "Return the exception raised by the call. If the call hasn't yet completed " "then this method will wait up to *timeout* seconds. If the call hasn't " @@ -411,18 +694,18 @@ msgid "" "``None``, there is no limit to the wait time." msgstr "" -#: library/concurrent.futures.rst:404 +#: library/concurrent.futures.rst:540 msgid "If the call completed without raising, ``None`` is returned." msgstr "" -#: library/concurrent.futures.rst:408 +#: library/concurrent.futures.rst:544 msgid "" "Attaches the callable *fn* to the future. *fn* will be called, with the " "future as its only argument, when the future is cancelled or finishes " "running." msgstr "" -#: library/concurrent.futures.rst:412 +#: library/concurrent.futures.rst:548 msgid "" "Added callables are called in the order that they were added and are always " "called in a thread belonging to the process that added them. If the " @@ -431,26 +714,26 @@ msgid "" "behavior is undefined." msgstr "" -#: library/concurrent.futures.rst:418 +#: library/concurrent.futures.rst:554 msgid "" "If the future has already completed or been cancelled, *fn* will be called " "immediately." msgstr "" -#: library/concurrent.futures.rst:421 +#: library/concurrent.futures.rst:557 msgid "" "The following :class:`Future` methods are meant for use in unit tests and :" "class:`Executor` implementations." msgstr "" -#: library/concurrent.futures.rst:426 +#: library/concurrent.futures.rst:562 msgid "" "This method should only be called by :class:`Executor` implementations " "before executing the work associated with the :class:`Future` and by unit " "tests." msgstr "" -#: library/concurrent.futures.rst:430 +#: library/concurrent.futures.rst:566 msgid "" "If the method returns ``False`` then the :class:`Future` was cancelled, i." "e. :meth:`Future.cancel` was called and returned ``True``. Any threads " @@ -458,47 +741,47 @@ msgid "" "or :func:`wait`) will be woken up." msgstr "" -#: library/concurrent.futures.rst:435 +#: library/concurrent.futures.rst:571 msgid "" "If the method returns ``True`` then the :class:`Future` was not cancelled " "and has been put in the running state, i.e. calls to :meth:`Future.running` " "will return ``True``." msgstr "" -#: library/concurrent.futures.rst:439 +#: library/concurrent.futures.rst:575 msgid "" "This method can only be called once and cannot be called after :meth:`Future." "set_result` or :meth:`Future.set_exception` have been called." msgstr "" -#: library/concurrent.futures.rst:445 +#: library/concurrent.futures.rst:581 msgid "" "Sets the result of the work associated with the :class:`Future` to *result*." msgstr "" -#: library/concurrent.futures.rst:448 library/concurrent.futures.rst:461 +#: library/concurrent.futures.rst:584 library/concurrent.futures.rst:597 msgid "" "This method should only be used by :class:`Executor` implementations and " "unit tests." msgstr "" -#: library/concurrent.futures.rst:451 library/concurrent.futures.rst:464 +#: library/concurrent.futures.rst:587 library/concurrent.futures.rst:600 msgid "" "This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" "`Future` is already done." msgstr "" -#: library/concurrent.futures.rst:458 +#: library/concurrent.futures.rst:594 msgid "" "Sets the result of the work associated with the :class:`Future` to the :" "class:`Exception` *exception*." msgstr "" -#: library/concurrent.futures.rst:470 +#: library/concurrent.futures.rst:606 msgid "Module Functions" msgstr "" -#: library/concurrent.futures.rst:474 +#: library/concurrent.futures.rst:610 msgid "" "Wait for the :class:`Future` instances (possibly created by different :class:" "`Executor` instances) given by *fs* to complete. Duplicate futures given to " @@ -509,43 +792,43 @@ msgid "" "running futures)." msgstr "" -#: library/concurrent.futures.rst:482 +#: library/concurrent.futures.rst:618 msgid "" "*timeout* can be used to control the maximum number of seconds to wait " "before returning. *timeout* can be an int or float. If *timeout* is not " "specified or ``None``, there is no limit to the wait time." msgstr "" -#: library/concurrent.futures.rst:486 +#: library/concurrent.futures.rst:622 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: library/concurrent.futures.rst:492 +#: library/concurrent.futures.rst:628 msgid "Constant" msgstr "" -#: library/concurrent.futures.rst:493 +#: library/concurrent.futures.rst:629 msgid "Description" msgstr "" -#: library/concurrent.futures.rst:496 +#: library/concurrent.futures.rst:632 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: library/concurrent.futures.rst:499 +#: library/concurrent.futures.rst:635 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: library/concurrent.futures.rst:504 +#: library/concurrent.futures.rst:640 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: library/concurrent.futures.rst:508 +#: library/concurrent.futures.rst:644 msgid "" "Returns an iterator over the :class:`Future` instances (possibly created by " "different :class:`Executor` instances) given by *fs* that yields futures as " @@ -558,55 +841,69 @@ msgid "" "*timeout* is not specified or ``None``, there is no limit to the wait time." msgstr "" -#: library/concurrent.futures.rst:522 +#: library/concurrent.futures.rst:657 msgid ":pep:`3148` -- futures - execute computations asynchronously" msgstr "" -#: library/concurrent.futures.rst:522 +#: library/concurrent.futures.rst:658 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: library/concurrent.futures.rst:527 +#: library/concurrent.futures.rst:663 msgid "Exception classes" msgstr "" -#: library/concurrent.futures.rst:533 +#: library/concurrent.futures.rst:669 msgid "Raised when a future is cancelled." msgstr "" -#: library/concurrent.futures.rst:537 +#: library/concurrent.futures.rst:673 msgid "" "A deprecated alias of :exc:`TimeoutError`, raised when a future operation " "exceeds the given timeout." msgstr "" -#: library/concurrent.futures.rst:542 +#: library/concurrent.futures.rst:678 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" -#: library/concurrent.futures.rst:547 +#: library/concurrent.futures.rst:683 msgid "" "Derived from :exc:`RuntimeError`, this exception class is raised when an " "executor is broken for some reason, and cannot be used to submit or execute " "new tasks." msgstr "" -#: library/concurrent.futures.rst:555 +#: library/concurrent.futures.rst:691 msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." msgstr "" -#: library/concurrent.futures.rst:564 +#: library/concurrent.futures.rst:700 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " "is raised when one of the workers of a :class:`~concurrent.futures." "ThreadPoolExecutor` has failed initializing." msgstr "" -#: library/concurrent.futures.rst:575 +#: library/concurrent.futures.rst:711 +msgid "" +"Derived from :exc:`~concurrent.futures.thread.BrokenThreadPool`, this " +"exception class is raised when one of the workers of a :class:`~concurrent." +"futures.InterpreterPoolExecutor` has failed initializing." +msgstr "" + +#: library/concurrent.futures.rst:720 +msgid "" +"Raised from :class:`~concurrent.futures.InterpreterPoolExecutor` when the " +"given initializer fails or from :meth:`~concurrent.futures.Executor.submit` " +"when there's an uncaught exception from the submitted task." +msgstr "" + +#: library/concurrent.futures.rst:731 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" "`RuntimeError`), this exception class is raised when one of the workers of " diff --git a/library/concurrent.interpreters.po b/library/concurrent.interpreters.po new file mode 100644 index 00000000..9f30957f --- /dev/null +++ b/library/concurrent.interpreters.po @@ -0,0 +1,524 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/concurrent.interpreters.rst:2 +msgid "" +":mod:`!concurrent.interpreters` --- Multiple interpreters in the same process" +msgstr "" + +#: library/concurrent.interpreters.rst:12 +msgid "**Source code:** :source:`Lib/concurrent/interpreters`" +msgstr "" + +#: library/concurrent.interpreters.rst:16 +msgid "" +"The :mod:`!concurrent.interpreters` module constructs higher-level " +"interfaces on top of the lower level :mod:`!_interpreters` module." +msgstr "" + +#: library/concurrent.interpreters.rst:19 +msgid "" +"The module is primarily meant to provide a basic API for managing " +"interpreters (AKA \"subinterpreters\") and running things in them. Running " +"mostly involves switching to an interpreter (in the current thread) and " +"calling a function in that execution context." +msgstr "" + +#: library/concurrent.interpreters.rst:24 +msgid "" +"For concurrency, interpreters themselves (and this module) don't provide " +"much more than isolation, which on its own isn't useful. Actual concurrency " +"is available separately through :mod:`threads ` See `below " +"`_" +msgstr "" + +#: library/concurrent.interpreters.rst:31 +msgid ":class:`~concurrent.futures.InterpreterPoolExecutor`" +msgstr "" + +#: library/concurrent.interpreters.rst:32 +msgid "Combines threads with interpreters in a familiar interface." +msgstr "" + +#: library/concurrent.interpreters.rst:36 +msgid ":ref:`isolating-extensions-howto`" +msgstr "" + +#: library/concurrent.interpreters.rst:37 +msgid "How to update an extension module to support multiple interpreters." +msgstr "" + +#: library/concurrent.interpreters.rst:39 +msgid ":pep:`554`" +msgstr "" + +#: library/concurrent.interpreters.rst:41 +msgid ":pep:`734`" +msgstr "" + +#: library/concurrent.interpreters.rst:43 +msgid ":pep:`684`" +msgstr "" + +#: includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" + +#: includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." +msgstr "" + +#: library/concurrent.interpreters.rst:51 +msgid "Key details" +msgstr "" + +#: library/concurrent.interpreters.rst:53 +msgid "" +"Before we dive in further, there are a small number of details to keep in " +"mind about using multiple interpreters:" +msgstr "" + +#: library/concurrent.interpreters.rst:56 +msgid "`isolated `_, by default" +msgstr "" + +#: library/concurrent.interpreters.rst:57 +msgid "no implicit threads" +msgstr "" + +#: library/concurrent.interpreters.rst:58 +msgid "not all PyPI packages support use in multiple interpreters yet" +msgstr "" + +#: library/concurrent.interpreters.rst:66 +msgid "Introduction" +msgstr "" + +#: library/concurrent.interpreters.rst:68 +msgid "" +"An \"interpreter\" is effectively the execution context of the Python " +"runtime. It contains all of the state the runtime needs to execute a " +"program. This includes things like the import state and builtins. (Each " +"thread, even if there's only the main thread, has some extra runtime state, " +"in addition to the current interpreter, related to the current exception and " +"the bytecode eval loop.)" +msgstr "" + +#: library/concurrent.interpreters.rst:75 +msgid "" +"The concept and functionality of the interpreter have been a part of Python " +"since version 2.2, but the feature was only available through the C-API and " +"not well known, and the `isolation `_ was relatively " +"incomplete until version 3.12." +msgstr "" + +#: library/concurrent.interpreters.rst:83 +msgid "Multiple Interpreters and Isolation" +msgstr "" + +#: library/concurrent.interpreters.rst:85 +msgid "" +"A Python implementation may support using multiple interpreters in the same " +"process. CPython has this support. Each interpreter is effectively " +"isolated from the others (with a limited number of carefully managed process-" +"global exceptions to the rule)." +msgstr "" + +#: library/concurrent.interpreters.rst:90 +msgid "" +"That isolation is primarily useful as a strong separation between distinct " +"logical components of a program, where you want to have careful control of " +"how those components interact." +msgstr "" + +#: library/concurrent.interpreters.rst:96 +msgid "" +"Interpreters in the same process can technically never be strictly isolated " +"from one another since there are few restrictions on memory access within " +"the same process. The Python runtime makes a best effort at isolation but " +"extension modules may easily violate that. Therefore, do not use multiple " +"interpreters in security-sensitive situations, where they shouldn't have " +"access to each other's data." +msgstr "" + +#: library/concurrent.interpreters.rst:104 +msgid "Running in an Interpreter" +msgstr "" + +#: library/concurrent.interpreters.rst:106 +msgid "" +"Running in a different interpreter involves switching to it in the current " +"thread and then calling some function. The runtime will execute the " +"function using the current interpreter's state. The :mod:`!concurrent." +"interpreters` module provides a basic API for creating and managing " +"interpreters, as well as the switch-and-call operation." +msgstr "" + +#: library/concurrent.interpreters.rst:113 +msgid "" +"No other threads are automatically started for the operation. There is `a " +"helper `_ for that though. There is another " +"dedicated helper for calling the builtin :func:`exec` in an interpreter." +msgstr "" + +#: library/concurrent.interpreters.rst:118 +msgid "" +"When :func:`exec` (or :func:`eval`) are called in an interpreter, they run " +"using the interpreter's :mod:`!__main__` module as the \"globals\" " +"namespace. The same is true for functions that aren't associated with any " +"module. This is the same as how scripts invoked from the command-line run " +"in the :mod:`!__main__` module." +msgstr "" + +#: library/concurrent.interpreters.rst:128 +msgid "Concurrency and Parallelism" +msgstr "" + +#: library/concurrent.interpreters.rst:130 +msgid "" +"As noted earlier, interpreters do not provide any concurrency on their own. " +"They strictly represent the isolated execution context the runtime will use " +"*in the current thread*. That isolation makes them similar to processes, " +"but they still enjoy in-process efficiency, like threads." +msgstr "" + +#: library/concurrent.interpreters.rst:136 +msgid "" +"All that said, interpreters do naturally support certain flavors of " +"concurrency. There's a powerful side effect of that isolation. It enables a " +"different approach to concurrency than you can take with async or threads. " +"It's a similar concurrency model to CSP or the actor model, a model which is " +"relatively easy to reason about." +msgstr "" + +#: library/concurrent.interpreters.rst:143 +msgid "" +"You can take advantage of that concurrency model in a single thread, " +"switching back and forth between interpreters, Stackless-style. However, " +"this model is more useful when you combine interpreters with multiple " +"threads. This mostly involves starting a new thread, where you switch to " +"another interpreter and run what you want there." +msgstr "" + +#: library/concurrent.interpreters.rst:149 +msgid "" +"Each actual thread in Python, even if you're only running in the main " +"thread, has its own *current* execution context. Multiple threads can use " +"the same interpreter or different ones." +msgstr "" + +#: library/concurrent.interpreters.rst:153 +msgid "" +"At a high level, you can think of the combination of threads and " +"interpreters as threads with opt-in sharing." +msgstr "" + +#: library/concurrent.interpreters.rst:156 +msgid "" +"As a significant bonus, interpreters are sufficiently isolated that they do " +"not share the :term:`GIL`, which means combining threads with multiple " +"interpreters enables full multi-core parallelism. (This has been the case " +"since Python 3.12.)" +msgstr "" + +#: library/concurrent.interpreters.rst:162 +msgid "Communication Between Interpreters" +msgstr "" + +#: library/concurrent.interpreters.rst:164 +msgid "" +"In practice, multiple interpreters are useful only if we have a way to " +"communicate between them. This usually involves some form of message " +"passing, but can even mean sharing data in some carefully managed way." +msgstr "" + +#: library/concurrent.interpreters.rst:169 +msgid "" +"With this in mind, the :mod:`!concurrent.interpreters` module provides a :" +"class:`queue.Queue` implementation, available through :func:`create_queue`." +msgstr "" + +#: library/concurrent.interpreters.rst:176 +msgid "\"Sharing\" Objects" +msgstr "" + +#: library/concurrent.interpreters.rst:178 +msgid "" +"Any data actually shared between interpreters loses the thread-safety " +"provided by the :term:`GIL`. There are various options for dealing with " +"this in extension modules. However, from Python code the lack of thread-" +"safety means objects can't actually be shared, with a few exceptions. " +"Instead, a copy must be created, which means mutable objects won't stay in " +"sync." +msgstr "" + +#: library/concurrent.interpreters.rst:185 +msgid "" +"By default, most objects are copied with :mod:`pickle` when they are passed " +"to another interpreter. Nearly all of the immutable builtin objects are " +"either directly shared or copied efficiently. For example:" +msgstr "" + +#: library/concurrent.interpreters.rst:189 +msgid ":const:`None`" +msgstr "" + +#: library/concurrent.interpreters.rst:190 +msgid ":class:`bool` (:const:`True` and :const:`False`)" +msgstr "" + +#: library/concurrent.interpreters.rst:191 +msgid ":class:`bytes`" +msgstr "" + +#: library/concurrent.interpreters.rst:192 +msgid ":class:`str`" +msgstr "" + +#: library/concurrent.interpreters.rst:193 +msgid ":class:`int`" +msgstr "" + +#: library/concurrent.interpreters.rst:194 +msgid ":class:`float`" +msgstr "" + +#: library/concurrent.interpreters.rst:195 +msgid ":class:`tuple` (of similarly supported objects)" +msgstr "" + +#: library/concurrent.interpreters.rst:197 +msgid "" +"There is a small number of Python types that actually share mutable data " +"between interpreters:" +msgstr "" + +#: library/concurrent.interpreters.rst:200 +msgid ":class:`memoryview`" +msgstr "" + +#: library/concurrent.interpreters.rst:201 +msgid ":class:`Queue`" +msgstr "" + +#: library/concurrent.interpreters.rst:205 +msgid "Reference" +msgstr "" + +#: library/concurrent.interpreters.rst:207 +msgid "This module defines the following functions:" +msgstr "" + +#: library/concurrent.interpreters.rst:211 +msgid "" +"Return a :class:`list` of :class:`Interpreter` objects, one for each " +"existing interpreter." +msgstr "" + +#: library/concurrent.interpreters.rst:216 +msgid "" +"Return an :class:`Interpreter` object for the currently running interpreter." +msgstr "" + +#: library/concurrent.interpreters.rst:221 +msgid "" +"Return an :class:`Interpreter` object for the main interpreter. This is the " +"interpreter the runtime created to run the :term:`REPL` or the script given " +"at the command-line. It is usually the only one." +msgstr "" + +#: library/concurrent.interpreters.rst:227 +msgid "" +"Initialize a new (idle) Python interpreter and return a :class:`Interpreter` " +"object for it." +msgstr "" + +#: library/concurrent.interpreters.rst:232 +msgid "" +"Initialize a new cross-interpreter queue and return a :class:`Queue` object " +"for it." +msgstr "" + +#: library/concurrent.interpreters.rst:237 +msgid "Interpreter objects" +msgstr "" + +#: library/concurrent.interpreters.rst:241 +msgid "A single interpreter in the current process." +msgstr "" + +#: library/concurrent.interpreters.rst:243 +msgid "" +"Generally, :class:`Interpreter` shouldn't be called directly. Instead, use :" +"func:`create` or one of the other module functions." +msgstr "" + +#: library/concurrent.interpreters.rst:248 +#: library/concurrent.interpreters.rst:254 +#: library/concurrent.interpreters.rst:333 +msgid "(read-only)" +msgstr "" + +#: library/concurrent.interpreters.rst:250 +msgid "The underlying interpreter's ID." +msgstr "" + +#: library/concurrent.interpreters.rst:256 +msgid "A string describing where the interpreter came from." +msgstr "" + +#: library/concurrent.interpreters.rst:260 +msgid "" +"Return ``True`` if the interpreter is currently executing code in its :mod:`!" +"__main__` module and ``False`` otherwise." +msgstr "" + +#: library/concurrent.interpreters.rst:265 +msgid "Finalize and destroy the interpreter." +msgstr "" + +#: library/concurrent.interpreters.rst:269 +msgid "Bind objects in the interpreter's :mod:`!__main__` module." +msgstr "" + +#: library/concurrent.interpreters.rst:271 +#: library/concurrent.interpreters.rst:328 +msgid "" +"Some objects are actually shared and some are copied efficiently, but most " +"are copied via :mod:`pickle`. See :ref:`interp-object-sharing`." +msgstr "" + +#: library/concurrent.interpreters.rst:276 +msgid "Run the given source code in the interpreter (in the current thread)." +msgstr "" + +#: library/concurrent.interpreters.rst:280 +msgid "" +"Return the result of calling running the given function in the interpreter " +"(in the current thread)." +msgstr "" + +#: library/concurrent.interpreters.rst:287 +msgid "Run the given function in the interpreter (in a new thread)." +msgstr "" + +#: library/concurrent.interpreters.rst:290 +msgid "Exceptions" +msgstr "" + +#: library/concurrent.interpreters.rst:294 +msgid "" +"This exception, a subclass of :exc:`Exception`, is raised when an " +"interpreter-related error happens." +msgstr "" + +#: library/concurrent.interpreters.rst:299 +msgid "" +"This exception, a subclass of :exc:`InterpreterError`, is raised when the " +"targeted interpreter no longer exists." +msgstr "" + +#: library/concurrent.interpreters.rst:304 +msgid "" +"This exception, a subclass of :exc:`InterpreterError`, is raised when the " +"running code raised an uncaught exception." +msgstr "" + +#: library/concurrent.interpreters.rst:309 +msgid "A basic snapshot of the exception raised in the other interpreter." +msgstr "" + +#: library/concurrent.interpreters.rst:315 +msgid "" +"This exception, a subclass of :exc:`TypeError`, is raised when an object " +"cannot be sent to another interpreter." +msgstr "" + +#: library/concurrent.interpreters.rst:320 +msgid "Communicating Between Interpreters" +msgstr "" + +#: library/concurrent.interpreters.rst:324 +msgid "" +"A wrapper around a low-level, cross-interpreter queue, which implements the :" +"class:`queue.Queue` interface. The underlying queue can only be created " +"through :func:`create_queue`." +msgstr "" + +#: library/concurrent.interpreters.rst:335 +msgid "The queue's ID." +msgstr "" + +#: library/concurrent.interpreters.rst:340 +msgid "" +"This exception, a subclass of :exc:`queue.Empty`, is raised from :meth:`!" +"Queue.get` and :meth:`!Queue.get_nowait` when the queue is empty." +msgstr "" + +#: library/concurrent.interpreters.rst:346 +msgid "" +"This exception, a subclass of :exc:`queue.Full`, is raised from :meth:`!" +"Queue.put` and :meth:`!Queue.put_nowait` when the queue is full." +msgstr "" + +#: library/concurrent.interpreters.rst:352 +msgid "Basic usage" +msgstr "" + +#: library/concurrent.interpreters.rst:354 +msgid "Creating an interpreter and running code in it::" +msgstr "" + +#: library/concurrent.interpreters.rst:356 +msgid "" +"from concurrent import interpreters\n" +"\n" +"interp = interpreters.create()\n" +"\n" +"# Run in the current OS thread.\n" +"\n" +"interp.exec('print(\"spam!\")')\n" +"\n" +"interp.exec(\"\"\"if True:\n" +" print('spam!')\n" +" \"\"\")\n" +"\n" +"from textwrap import dedent\n" +"interp.exec(dedent(\"\"\"\n" +" print('spam!')\n" +" \"\"\"))\n" +"\n" +"def run(arg):\n" +" return arg\n" +"\n" +"res = interp.call(run, 'spam!')\n" +"print(res)\n" +"\n" +"def run():\n" +" print('spam!')\n" +"\n" +"interp.call(run)\n" +"\n" +"# Run in new OS thread.\n" +"\n" +"t = interp.call_in_thread(run)\n" +"t.join()" +msgstr "" diff --git a/library/concurrent.po b/library/concurrent.po index e3a505a4..b8f0678e 100644 --- a/library/concurrent.po +++ b/library/concurrent.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -21,9 +22,14 @@ msgid "The :mod:`!concurrent` package" msgstr "" #: library/concurrent.rst:4 -msgid "Currently, there is only one module in this package:" +msgid "This package contains the following modules:" msgstr "" #: library/concurrent.rst:6 msgid ":mod:`concurrent.futures` -- Launching parallel tasks" msgstr "" + +#: library/concurrent.rst:7 +msgid "" +":mod:`concurrent.interpreters` -- Multiple interpreters in the same process" +msgstr "" diff --git a/library/configparser.po b/library/configparser.po index 60f192d9..c7e8f5e8 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/configparser.rst:2 -msgid ":mod:`configparser` --- Configuration file parser" +msgid ":mod:`!configparser` --- Configuration file parser" msgstr "" #: library/configparser.rst:14 @@ -38,7 +39,7 @@ msgid "" "the Windows Registry extended version of INI syntax." msgstr "" -#: library/configparser.rst:38 +#: library/configparser.rst:36 msgid "Module :mod:`tomllib`" msgstr "" @@ -48,7 +49,7 @@ msgid "" "specifically designed to be an improved version of INI." msgstr "" -#: library/configparser.rst:42 +#: library/configparser.rst:40 msgid "Module :mod:`shlex`" msgstr "" @@ -58,7 +59,7 @@ msgid "" "for application configuration files." msgstr "" -#: library/configparser.rst:45 +#: library/configparser.rst:44 msgid "Module :mod:`json`" msgstr "" @@ -68,15 +69,31 @@ msgid "" "sometimes used for configuration, but does not support comments." msgstr "" -#: library/configparser.rst:60 +#: library/configparser.rst:61 msgid "Quick Start" msgstr "" -#: library/configparser.rst:62 +#: library/configparser.rst:63 msgid "Let's take a very basic configuration file that looks like this:" msgstr "" -#: library/configparser.rst:79 +#: library/configparser.rst:65 +msgid "" +"[DEFAULT]\n" +"ServerAliveInterval = 45\n" +"Compression = yes\n" +"CompressionLevel = 9\n" +"ForwardX11 = yes\n" +"\n" +"[forge.example]\n" +"User = hg\n" +"\n" +"[topsecret.server.example]\n" +"Port = 50022\n" +"ForwardX11 = no" +msgstr "" + +#: library/configparser.rst:80 msgid "" "The structure of INI files is described `in the following section " "<#supported-ini-file-structure>`_. Essentially, the file consists of " @@ -85,20 +102,72 @@ msgid "" "configuration file programmatically." msgstr "" -#: library/configparser.rst:103 +#: library/configparser.rst:86 +msgid "" +">>> import configparser\n" +">>> config = configparser.ConfigParser()\n" +">>> config['DEFAULT'] = {'ServerAliveInterval': '45',\n" +"... 'Compression': 'yes',\n" +"... 'CompressionLevel': '9'}\n" +">>> config['forge.example'] = {}\n" +">>> config['forge.example']['User'] = 'hg'\n" +">>> config['topsecret.server.example'] = {}\n" +">>> topsecret = config['topsecret.server.example']\n" +">>> topsecret['Port'] = '50022' # mutates the parser\n" +">>> topsecret['ForwardX11'] = 'no' # same here\n" +">>> config['DEFAULT']['ForwardX11'] = 'yes'\n" +">>> with open('example.ini', 'w') as configfile:\n" +"... config.write(configfile)\n" +"..." +msgstr "" + +#: library/configparser.rst:104 msgid "" "As you can see, we can treat a config parser much like a dictionary. There " "are differences, `outlined later <#mapping-protocol-access>`_, but the " "behavior is very close to what you would expect from a dictionary." msgstr "" -#: library/configparser.rst:107 +#: library/configparser.rst:108 msgid "" "Now that we have created and saved a configuration file, let's read it back " "and explore the data it holds." msgstr "" -#: library/configparser.rst:142 +#: library/configparser.rst:111 +msgid "" +">>> config = configparser.ConfigParser()\n" +">>> config.sections()\n" +"[]\n" +">>> config.read('example.ini')\n" +"['example.ini']\n" +">>> config.sections()\n" +"['forge.example', 'topsecret.server.example']\n" +">>> 'forge.example' in config\n" +"True\n" +">>> 'python.org' in config\n" +"False\n" +">>> config['forge.example']['User']\n" +"'hg'\n" +">>> config['DEFAULT']['Compression']\n" +"'yes'\n" +">>> topsecret = config['topsecret.server.example']\n" +">>> topsecret['ForwardX11']\n" +"'no'\n" +">>> topsecret['Port']\n" +"'50022'\n" +">>> for key in config['forge.example']:\n" +"... print(key)\n" +"user\n" +"compressionlevel\n" +"serveraliveinterval\n" +"compression\n" +"forwardx11\n" +">>> config['forge.example']['ForwardX11']\n" +"'yes'" +msgstr "" + +#: library/configparser.rst:143 msgid "" "As we can see above, the API is pretty straightforward. The only bit of " "magic involves the ``DEFAULT`` section which provides default values for all " @@ -106,32 +175,62 @@ msgid "" "and stored in lowercase [1]_." msgstr "" -#: library/configparser.rst:147 +#: library/configparser.rst:1003 msgid "" "It is possible to read several configurations into a single :class:" "`ConfigParser`, where the most recently added configuration has the highest " "priority. Any conflicting keys are taken from the more recent configuration " -"while the previously existing keys are retained." +"while the previously existing keys are retained. The example below reads in " +"an ``override.ini`` file, which will override any conflicting keys from the " +"``example.ini`` file." +msgstr "" + +#: library/configparser.rst:1010 +msgid "" +"[DEFAULT]\n" +"ServerAliveInterval = -1" msgstr "" -#: library/configparser.rst:168 +#: library/configparser.rst:1015 +msgid "" +">>> config_override = configparser.ConfigParser()\n" +">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" +">>> with open('override.ini', 'w') as configfile:\n" +"... config_override.write(configfile)\n" +"...\n" +">>> config_override = configparser.ConfigParser()\n" +">>> config_override.read(['example.ini', 'override.ini'])\n" +"['example.ini', 'override.ini']\n" +">>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))\n" +"-1" +msgstr "" + +#: library/configparser.rst:174 msgid "" "This behaviour is equivalent to a :meth:`ConfigParser.read` call with " "several files passed to the *filenames* parameter." msgstr "" -#: library/configparser.rst:173 +#: library/configparser.rst:179 msgid "Supported Datatypes" msgstr "" -#: library/configparser.rst:175 +#: library/configparser.rst:181 msgid "" "Config parsers do not guess datatypes of values in configuration files, " "always storing them internally as strings. This means that if you need " "other datatypes, you should convert on your own:" msgstr "" -#: library/configparser.rst:186 +#: library/configparser.rst:185 +msgid "" +">>> int(topsecret['Port'])\n" +"50022\n" +">>> float(topsecret['CompressionLevel'])\n" +"9.0" +msgstr "" + +#: library/configparser.rst:192 msgid "" "Since this task is so common, config parsers provide a range of handy getter " "methods to handle integers, floats and booleans. The last one is the most " @@ -142,7 +241,17 @@ msgid "" "``'true'``/``'false'`` and ``'1'``/``'0'`` [1]_. For example:" msgstr "" -#: library/configparser.rst:203 +#: library/configparser.rst:200 +msgid "" +">>> topsecret.getboolean('ForwardX11')\n" +"False\n" +">>> config['forge.example'].getboolean('ForwardX11')\n" +"True\n" +">>> config.getboolean('forge.example', 'Compression')\n" +"True" +msgstr "" + +#: library/configparser.rst:209 msgid "" "Apart from :meth:`~ConfigParser.getboolean`, config parsers also provide " "equivalent :meth:`~ConfigParser.getint` and :meth:`~ConfigParser.getfloat` " @@ -150,17 +259,28 @@ msgid "" "ones. [1]_" msgstr "" -#: library/configparser.rst:209 +#: library/configparser.rst:215 msgid "Fallback Values" msgstr "" -#: library/configparser.rst:211 +#: library/configparser.rst:217 msgid "" "As with a dictionary, you can use a section's :meth:`~ConfigParser.get` " "method to provide fallback values:" msgstr "" -#: library/configparser.rst:224 +#: library/configparser.rst:220 +msgid "" +">>> topsecret.get('Port')\n" +"'50022'\n" +">>> topsecret.get('CompressionLevel')\n" +"'9'\n" +">>> topsecret.get('Cipher')\n" +">>> topsecret.get('Cipher', '3des-cbc')\n" +"'3des-cbc'" +msgstr "" + +#: library/configparser.rst:230 msgid "" "Please note that default values have precedence over fallback values. For " "instance, in our example the ``'CompressionLevel'`` key was specified only " @@ -169,7 +289,13 @@ msgid "" "specify a fallback:" msgstr "" -#: library/configparser.rst:235 +#: library/configparser.rst:236 +msgid "" +">>> topsecret.get('CompressionLevel', '3')\n" +"'9'" +msgstr "" + +#: library/configparser.rst:241 msgid "" "One more thing to be aware of is that the parser-level :meth:`~ConfigParser." "get` method provides a custom, more complex interface, maintained for " @@ -179,16 +305,34 @@ msgstr "" #: library/configparser.rst:246 msgid "" +">>> config.get('forge.example', 'monster',\n" +"... fallback='No such things as monsters')\n" +"'No such things as monsters'" +msgstr "" + +#: library/configparser.rst:252 +msgid "" "The same ``fallback`` argument can be used with the :meth:`~ConfigParser." "getint`, :meth:`~ConfigParser.getfloat` and :meth:`~ConfigParser.getboolean` " "methods, for example:" msgstr "" -#: library/configparser.rst:262 +#: library/configparser.rst:256 +msgid "" +">>> 'BatchMode' in topsecret\n" +"False\n" +">>> topsecret.getboolean('BatchMode', fallback=True)\n" +"True\n" +">>> config['DEFAULT']['BatchMode'] = 'no'\n" +">>> topsecret.getboolean('BatchMode', fallback=True)\n" +"False" +msgstr "" + +#: library/configparser.rst:268 msgid "Supported INI File Structure" msgstr "" -#: library/configparser.rst:264 +#: library/configparser.rst:270 msgid "" "A configuration file consists of sections, each led by a ``[section]`` " "header, followed by key/value entries separated by a specific string (``=`` " @@ -201,35 +345,112 @@ msgid "" "parts of multiline values or ignored." msgstr "" -#: library/configparser.rst:274 +#: library/configparser.rst:280 msgid "" "By default, a valid section name can be any string that does not contain '\\" "\\n'. To change this, see :attr:`ConfigParser.SECTCRE`." msgstr "" -#: library/configparser.rst:277 +#: library/configparser.rst:283 +msgid "" +"The first section name may be omitted if the parser is configured to allow " +"an unnamed top level section with ``allow_unnamed_section=True``. In this " +"case, the keys/values may be retrieved by :const:`UNNAMED_SECTION` as in " +"``config[UNNAMED_SECTION]``." +msgstr "" + +#: library/configparser.rst:288 msgid "" "Configuration files may include comments, prefixed by specific characters " "(``#`` and ``;`` by default [1]_). Comments may appear on their own on an " "otherwise empty line, possibly indented. [1]_" msgstr "" -#: library/configparser.rst:344 +#: library/configparser.rst:376 msgid "For example:" msgstr "" -#: library/configparser.rst:329 +#: library/configparser.rst:294 +msgid "" +"[Simple Values]\n" +"key=value\n" +"spaces in keys=allowed\n" +"spaces in values=allowed as well\n" +"spaces around the delimiter = obviously\n" +"you can also use : to delimit keys from values\n" +"\n" +"[All Values Are Strings]\n" +"values like this: 1000000\n" +"or this: 3.14159265359\n" +"are they treated as numbers? : no\n" +"integers, floats and booleans are held as: strings\n" +"can use the API to get converted values directly: true\n" +"\n" +"[Multiline Values]\n" +"chorus: I'm a lumberjack, and I'm okay\n" +" I sleep all night and I work all day\n" +"\n" +"[No Values]\n" +"key_without_value\n" +"empty string value here =\n" +"\n" +"[You can use comments]\n" +"# like this\n" +"; or this\n" +"\n" +"# By default only in an empty line.\n" +"# Inline comments can be harmful because they prevent users\n" +"# from using the delimiting characters as parts of values.\n" +"# That being said, this can be customized.\n" +"\n" +" [Sections Can Be Indented]\n" +" can_values_be_as_well = True\n" +" does_that_mean_anything_special = False\n" +" purpose = formatting for readability\n" +" multiline_values = are\n" +" handled just fine as\n" +" long as they are indented\n" +" deeper than the first line\n" +" of a value\n" +" # Did I mention we can indent comments, too?" +msgstr "" + +#: library/configparser.rst:342 +msgid "Unnamed Sections" +msgstr "" + +#: library/configparser.rst:344 +msgid "" +"The name of the first section (or unique) may be omitted and values " +"retrieved by the :const:`UNNAMED_SECTION` attribute." +msgstr "" + +#: library/configparser.rst:347 +msgid "" +">>> config = \"\"\"\n" +"... option = value\n" +"...\n" +"... [ Section 2 ]\n" +"... another = val\n" +"... \"\"\"\n" +">>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)\n" +">>> unnamed.read_string(config)\n" +">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" +"'value'" +msgstr "" + +#: library/configparser.rst:361 msgid "Interpolation of values" msgstr "" -#: library/configparser.rst:331 +#: library/configparser.rst:363 msgid "" "On top of the core functionality, :class:`ConfigParser` supports " "interpolation. This means values can be preprocessed before returning them " "from ``get()`` calls." msgstr "" -#: library/configparser.rst:339 +#: library/configparser.rst:371 msgid "" "The default implementation used by :class:`ConfigParser`. It enables values " "to contain format strings which refer to other values in the same section, " @@ -237,7 +458,20 @@ msgid "" "can be provided on initialization." msgstr "" -#: library/configparser.rst:357 +#: library/configparser.rst:378 +msgid "" +"[Paths]\n" +"home_dir: /Users\n" +"my_dir: %(home_dir)s/lumberjack\n" +"my_pictures: %(my_dir)s/Pictures\n" +"\n" +"[Escape]\n" +"# use a %% to escape the % sign (% is the only character that needs to be " +"escaped):\n" +"gain: 80%%" +msgstr "" + +#: library/configparser.rst:389 msgid "" "In the example above, :class:`ConfigParser` with *interpolation* set to " "``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of " @@ -247,14 +481,14 @@ msgid "" "specific order in the configuration file." msgstr "" -#: library/configparser.rst:364 +#: library/configparser.rst:396 msgid "" "With ``interpolation`` set to ``None``, the parser would simply return " "``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" -#: library/configparser.rst:372 +#: library/configparser.rst:404 msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " @@ -264,21 +498,54 @@ msgid "" "possibly the default values from the special section)." msgstr "" -#: library/configparser.rst:379 +#: library/configparser.rst:411 msgid "" "For example, the configuration specified above with basic interpolation, " "would look like this with extended interpolation:" msgstr "" -#: library/configparser.rst:393 +#: library/configparser.rst:414 +msgid "" +"[Paths]\n" +"home_dir: /Users\n" +"my_dir: ${home_dir}/lumberjack\n" +"my_pictures: ${my_dir}/Pictures\n" +"\n" +"[Escape]\n" +"# use a $$ to escape the $ sign ($ is the only character that needs to be " +"escaped):\n" +"cost: $$80" +msgstr "" + +#: library/configparser.rst:425 msgid "Values from other sections can be fetched as well:" msgstr "" -#: library/configparser.rst:415 +#: library/configparser.rst:427 +msgid "" +"[Common]\n" +"home_dir: /Users\n" +"library_dir: /Library\n" +"system_dir: /System\n" +"macports_dir: /opt/local\n" +"\n" +"[Frameworks]\n" +"Python: 3.2\n" +"path: ${Common:system_dir}/Library/Frameworks/\n" +"\n" +"[Arthur]\n" +"nickname: Two Sheds\n" +"last_name: Jackson\n" +"my_dir: ${Common:home_dir}/twosheds\n" +"my_pictures: ${my_dir}/Pictures\n" +"python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}" +msgstr "" + +#: library/configparser.rst:447 msgid "Mapping Protocol Access" msgstr "" -#: library/configparser.rst:419 +#: library/configparser.rst:451 msgid "" "Mapping protocol access is a generic name for functionality that enables " "using custom objects as if they were dictionaries. In case of :mod:" @@ -286,7 +553,7 @@ msgid "" "``parser['section']['option']`` notation." msgstr "" -#: library/configparser.rst:424 +#: library/configparser.rst:456 msgid "" "``parser['section']`` in particular returns a proxy for the section's data " "in the parser. This means that the values are not copied but they are taken " @@ -295,7 +562,7 @@ msgid "" "original parser." msgstr "" -#: library/configparser.rst:430 +#: library/configparser.rst:462 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " "possible. The mapping interface is complete and adheres to the :class:" @@ -303,7 +570,7 @@ msgid "" "that should be taken into account:" msgstr "" -#: library/configparser.rst:435 +#: library/configparser.rst:467 msgid "" "By default, all keys in sections are accessible in a case-insensitive manner " "[1]_. E.g. ``for option in parser[\"section\"]`` yields only " @@ -312,7 +579,13 @@ msgid "" "expressions return ``True``::" msgstr "" -#: library/configparser.rst:443 +#: library/configparser.rst:472 +msgid "" +"\"a\" in parser[\"section\"]\n" +"\"A\" in parser[\"section\"]" +msgstr "" + +#: library/configparser.rst:475 msgid "" "All sections include ``DEFAULTSECT`` values as well which means that ``." "clear()`` on a section may not leave the section visibly empty. This is " @@ -322,30 +595,30 @@ msgid "" "default value causes a :exc:`KeyError`." msgstr "" -#: library/configparser.rst:450 +#: library/configparser.rst:482 msgid "``DEFAULTSECT`` cannot be removed from the parser:" msgstr "" -#: library/configparser.rst:452 +#: library/configparser.rst:484 msgid "trying to delete it raises :exc:`ValueError`," msgstr "" -#: library/configparser.rst:454 +#: library/configparser.rst:486 msgid "``parser.clear()`` leaves it intact," msgstr "" -#: library/configparser.rst:456 +#: library/configparser.rst:488 msgid "``parser.popitem()`` never returns it." msgstr "" -#: library/configparser.rst:458 +#: library/configparser.rst:490 msgid "" "``parser.get(section, option, **kwargs)`` - the second argument is **not** a " "fallback value. Note however that the section-level ``get()`` methods are " "compatible both with the mapping protocol and the classic configparser API." msgstr "" -#: library/configparser.rst:462 +#: library/configparser.rst:494 msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " @@ -355,18 +628,18 @@ msgid "" "(unless ``raw=True`` is provided)." msgstr "" -#: library/configparser.rst:469 +#: library/configparser.rst:501 msgid "" "The mapping protocol is implemented on top of the existing legacy API so " "that subclasses overriding the original interface still should have mappings " "working as expected." msgstr "" -#: library/configparser.rst:475 +#: library/configparser.rst:507 msgid "Customizing Parser Behaviour" msgstr "" -#: library/configparser.rst:477 +#: library/configparser.rst:509 msgid "" "There are nearly as many INI format variants as there are applications using " "it. :mod:`configparser` goes a long way to provide support for the largest " @@ -375,17 +648,17 @@ msgid "" "customize some of the features." msgstr "" -#: library/configparser.rst:483 +#: library/configparser.rst:515 msgid "" "The most common way to change the way a specific config parser works is to " "use the :meth:`!__init__` options:" msgstr "" -#: library/configparser.rst:486 +#: library/configparser.rst:518 msgid "*defaults*, default value: ``None``" msgstr "" -#: library/configparser.rst:488 +#: library/configparser.rst:520 msgid "" "This option accepts a dictionary of key-value pairs which will be initially " "put in the ``DEFAULT`` section. This makes for an elegant way to support " @@ -393,17 +666,17 @@ msgid "" "the documented default." msgstr "" -#: library/configparser.rst:493 +#: library/configparser.rst:525 msgid "" "Hint: if you want to specify default values for a specific section, use :" "meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" -#: library/configparser.rst:496 +#: library/configparser.rst:528 msgid "*dict_type*, default value: :class:`dict`" msgstr "" -#: library/configparser.rst:498 +#: library/configparser.rst:530 msgid "" "This option has a major impact on how the mapping protocol will behave and " "how the written configuration files look. With the standard dictionary, " @@ -411,24 +684,43 @@ msgid "" "goes for options within sections." msgstr "" -#: library/configparser.rst:503 +#: library/configparser.rst:535 msgid "" "An alternative dictionary type can be used for example to sort sections and " "options on write-back." msgstr "" -#: library/configparser.rst:506 +#: library/configparser.rst:538 msgid "" "Please note: there are ways to add a set of key-value pairs in a single " "operation. When you use a regular dictionary in those operations, the order " "of the keys will be ordered. For example:" msgstr "" -#: library/configparser.rst:528 +#: library/configparser.rst:542 +msgid "" +">>> parser = configparser.ConfigParser()\n" +">>> parser.read_dict({'section1': {'key1': 'value1',\n" +"... 'key2': 'value2',\n" +"... 'key3': 'value3'},\n" +"... 'section2': {'keyA': 'valueA',\n" +"... 'keyB': 'valueB',\n" +"... 'keyC': 'valueC'},\n" +"... 'section3': {'foo': 'x',\n" +"... 'bar': 'y',\n" +"... 'baz': 'z'}\n" +"... })\n" +">>> parser.sections()\n" +"['section1', 'section2', 'section3']\n" +">>> [option for option in parser['section3']]\n" +"['foo', 'bar', 'baz']" +msgstr "" + +#: library/configparser.rst:560 msgid "*allow_no_value*, default value: ``False``" msgstr "" -#: library/configparser.rst:530 +#: library/configparser.rst:562 msgid "" "Some configuration files are known to include settings without values, but " "which otherwise conform to the syntax supported by :mod:`configparser`. The " @@ -436,32 +728,63 @@ msgid "" "such values should be accepted:" msgstr "" -#: library/configparser.rst:565 +#: library/configparser.rst:567 +msgid "" +">>> import configparser\n" +"\n" +">>> sample_config = \"\"\"\n" +"... [mysqld]\n" +"... user = mysql\n" +"... pid-file = /var/run/mysqld/mysqld.pid\n" +"... skip-external-locking\n" +"... old_passwords = 1\n" +"... skip-bdb\n" +"... # we don't need ACID today\n" +"... skip-innodb\n" +"... \"\"\"\n" +">>> config = configparser.ConfigParser(allow_no_value=True)\n" +">>> config.read_string(sample_config)\n" +"\n" +">>> # Settings with values are treated as before:\n" +">>> config[\"mysqld\"][\"user\"]\n" +"'mysql'\n" +"\n" +">>> # Settings without values provide None:\n" +">>> config[\"mysqld\"][\"skip-bdb\"]\n" +"\n" +">>> # Settings which aren't specified still raise an error:\n" +">>> config[\"mysqld\"][\"does-not-exist\"]\n" +"Traceback (most recent call last):\n" +" ...\n" +"KeyError: 'does-not-exist'" +msgstr "" + +#: library/configparser.rst:597 msgid "*delimiters*, default value: ``('=', ':')``" msgstr "" -#: library/configparser.rst:567 +#: library/configparser.rst:599 msgid "" "Delimiters are substrings that delimit keys from values within a section. " "The first occurrence of a delimiting substring on a line is considered a " "delimiter. This means values (but not keys) can contain the delimiters." msgstr "" -#: library/configparser.rst:571 +#: library/configparser.rst:603 msgid "" "See also the *space_around_delimiters* argument to :meth:`ConfigParser." "write`." msgstr "" -#: library/configparser.rst:574 +#: library/configparser.rst:606 msgid "*comment_prefixes*, default value: ``('#', ';')``" msgstr "" -#: library/configparser.rst:576 +#: library/configparser.rst:608 msgid "*inline_comment_prefixes*, default value: ``None``" msgstr "" -#: library/configparser.rst:578 +#: library/configparser.rst:610 msgid "" "Comment prefixes are strings that indicate the start of a valid comment " "within a config file. *comment_prefixes* are used only on otherwise empty " @@ -471,13 +794,13 @@ msgid "" "used as prefixes for whole line comments." msgstr "" -#: library/configparser.rst:585 +#: library/configparser.rst:617 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``comment_prefixes=('#',';')`` and ``inline_comment_prefixes=(';',)``." msgstr "" -#: library/configparser.rst:589 +#: library/configparser.rst:621 msgid "" "Please note that config parsers don't support escaping of comment prefixes " "so using *inline_comment_prefixes* may prevent users from specifying option " @@ -487,11 +810,53 @@ msgid "" "values is to interpolate the prefix, for example::" msgstr "" -#: library/configparser.rst:635 +#: library/configparser.rst:628 +msgid "" +">>> from configparser import ConfigParser, ExtendedInterpolation\n" +">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" +">>> # the default BasicInterpolation could be used as well\n" +">>> parser.read_string(\"\"\"\n" +"... [DEFAULT]\n" +"... hash = #\n" +"...\n" +"... [hashes]\n" +"... shebang =\n" +"... ${hash}!/usr/bin/env python\n" +"... ${hash} -*- coding: utf-8 -*-\n" +"...\n" +"... extensions =\n" +"... enabled_extension\n" +"... another_extension\n" +"... #disabled_by_comment\n" +"... yet_another_extension\n" +"...\n" +"... interpolation not necessary = if # is not at line start\n" +"... even in multiline values = line #1\n" +"... line #2\n" +"... line #3\n" +"... \"\"\")\n" +">>> print(parser['hashes']['shebang'])\n" +"\n" +"#!/usr/bin/env python\n" +"# -*- coding: utf-8 -*-\n" +">>> print(parser['hashes']['extensions'])\n" +"\n" +"enabled_extension\n" +"another_extension\n" +"yet_another_extension\n" +">>> print(parser['hashes']['interpolation not necessary'])\n" +"if # is not at line start\n" +">>> print(parser['hashes']['even in multiline values'])\n" +"line #1\n" +"line #2\n" +"line #3" +msgstr "" + +#: library/configparser.rst:667 msgid "*strict*, default value: ``True``" msgstr "" -#: library/configparser.rst:637 +#: library/configparser.rst:669 msgid "" "When set to ``True``, the parser will not allow for any section or option " "duplicates while reading from a single source (using :meth:`~ConfigParser." @@ -499,17 +864,17 @@ msgid "" "read_dict`). It is recommended to use strict parsers in new applications." msgstr "" -#: library/configparser.rst:642 +#: library/configparser.rst:674 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``strict=False``." msgstr "" -#: library/configparser.rst:646 +#: library/configparser.rst:678 msgid "*empty_lines_in_values*, default value: ``True``" msgstr "" -#: library/configparser.rst:648 +#: library/configparser.rst:680 msgid "" "In config parsers, values can span multiple lines as long as they are " "indented more than the key that holds them. By default parsers also let " @@ -519,7 +884,16 @@ msgid "" "lose track of the file structure. Take for instance:" msgstr "" -#: library/configparser.rst:663 +#: library/configparser.rst:687 +msgid "" +"[Section]\n" +"key = multiline\n" +" value with a gotcha\n" +"\n" +" this = is still a part of the multiline value of 'key'" +msgstr "" + +#: library/configparser.rst:695 msgid "" "This can be especially problematic for the user to see if she's using a " "proportional font to edit the file. That is why when your application does " @@ -528,13 +902,13 @@ msgid "" "would produce two keys, ``key`` and ``this``." msgstr "" -#: library/configparser.rst:669 +#: library/configparser.rst:701 msgid "" "*default_section*, default value: ``configparser.DEFAULTSECT`` (that is: " "``\"DEFAULT\"``)" msgstr "" -#: library/configparser.rst:672 +#: library/configparser.rst:704 msgid "" "The convention of allowing a special section of default values for other " "sections or interpolation purposes is a powerful concept of this library, " @@ -548,11 +922,11 @@ msgid "" "files from one format to another)." msgstr "" -#: library/configparser.rst:683 +#: library/configparser.rst:715 msgid "*interpolation*, default value: ``configparser.BasicInterpolation``" msgstr "" -#: library/configparser.rst:685 +#: library/configparser.rst:717 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -562,11 +936,11 @@ msgid "" "`RawConfigParser` has a default value of ``None``." msgstr "" -#: library/configparser.rst:692 +#: library/configparser.rst:724 msgid "*converters*, default value: not set" msgstr "" -#: library/configparser.rst:694 +#: library/configparser.rst:726 msgid "" "Config parsers provide option value getters that perform type conversion. " "By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, " @@ -580,7 +954,7 @@ msgid "" "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" -#: library/configparser.rst:705 +#: library/configparser.rst:737 msgid "" "If the converter needs to access the state of the parser, it can be " "implemented as a method on a config parser subclass. If the name of this " @@ -588,14 +962,14 @@ msgid "" "the dict-compatible form (see the ``getdecimal()`` example above)." msgstr "" -#: library/configparser.rst:710 +#: library/configparser.rst:742 msgid "" "More advanced customization may be achieved by overriding default values of " "these parser attributes. The defaults are defined on the classes, so they " "may be overridden by subclasses or by attribute assignment." msgstr "" -#: library/configparser.rst:716 +#: library/configparser.rst:748 msgid "" "By default when using :meth:`~ConfigParser.getboolean`, config parsers " "consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``, " @@ -604,13 +978,26 @@ msgid "" "strings and their Boolean outcomes. For example:" msgstr "" -#: library/configparser.rst:734 +#: library/configparser.rst:754 +msgid "" +">>> custom = configparser.ConfigParser()\n" +">>> custom['section1'] = {'funky': 'nope'}\n" +">>> custom['section1'].getboolean('funky')\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Not a boolean: nope\n" +">>> custom.BOOLEAN_STATES = {'sure': True, 'nope': False}\n" +">>> custom['section1'].getboolean('funky')\n" +"False" +msgstr "" + +#: library/configparser.rst:766 msgid "" "Other typical Boolean pairs include ``accept``/``reject`` or ``enabled``/" "``disabled``." msgstr "" -#: library/configparser.rst:740 +#: library/configparser.rst:772 msgid "" "This method transforms option names on every read, get, or set operation. " "The default converts the name to lowercase. This also means that when a " @@ -618,14 +1005,38 @@ msgid "" "method if that's unsuitable. For example:" msgstr "" -#: library/configparser.rst:770 +#: library/configparser.rst:778 +msgid "" +">>> config = \"\"\"\n" +"... [Section1]\n" +"... Key = Value\n" +"...\n" +"... [Section2]\n" +"... AnotherKey = Value\n" +"... \"\"\"\n" +">>> typical = configparser.ConfigParser()\n" +">>> typical.read_string(config)\n" +">>> list(typical['Section1'].keys())\n" +"['key']\n" +">>> list(typical['Section2'].keys())\n" +"['anotherkey']\n" +">>> custom = configparser.RawConfigParser()\n" +">>> custom.optionxform = lambda option: option\n" +">>> custom.read_string(config)\n" +">>> list(custom['Section1'].keys())\n" +"['Key']\n" +">>> list(custom['Section2'].keys())\n" +"['AnotherKey']" +msgstr "" + +#: library/configparser.rst:802 msgid "" "The optionxform function transforms option names to a canonical form. This " "should be an idempotent function: if the name is already in canonical form, " "it should be returned unchanged." msgstr "" -#: library/configparser.rst:777 +#: library/configparser.rst:809 msgid "" "A compiled regular expression used to parse section headers. The default " "matches ``[section]`` to the name ``\"section\"``. Whitespace is considered " @@ -634,18 +1045,39 @@ msgid "" "example:" msgstr "" -#: library/configparser.rst:805 +#: library/configparser.rst:815 +msgid "" +">>> import re\n" +">>> config = \"\"\"\n" +"... [Section 1]\n" +"... option = value\n" +"...\n" +"... [ Section 2 ]\n" +"... another = val\n" +"... \"\"\"\n" +">>> typical = configparser.ConfigParser()\n" +">>> typical.read_string(config)\n" +">>> typical.sections()\n" +"['Section 1', ' Section 2 ']\n" +">>> custom = configparser.ConfigParser()\n" +">>> custom.SECTCRE = re.compile(r\"\\[ *(?P
[^]]+?) *\\]\")\n" +">>> custom.read_string(config)\n" +">>> custom.sections()\n" +"['Section 1', 'Section 2']" +msgstr "" + +#: library/configparser.rst:837 msgid "" "While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing " "option lines, it's not recommended to override it because that would " "interfere with constructor options *allow_no_value* and *delimiters*." msgstr "" -#: library/configparser.rst:811 +#: library/configparser.rst:843 msgid "Legacy API Examples" msgstr "" -#: library/configparser.rst:813 +#: library/configparser.rst:845 msgid "" "Mainly because of backwards compatibility concerns, :mod:`configparser` " "provides also a legacy API with explicit ``get``/``set`` methods. While " @@ -654,29 +1086,121 @@ msgid "" "advanced, low-level and downright counterintuitive." msgstr "" -#: library/configparser.rst:819 +#: library/configparser.rst:851 msgid "An example of writing to a configuration file::" msgstr "" -#: library/configparser.rst:842 +#: library/configparser.rst:853 +msgid "" +"import configparser\n" +"\n" +"config = configparser.RawConfigParser()\n" +"\n" +"# Please note that using RawConfigParser's set functions, you can assign\n" +"# non-string values to keys internally, but will receive an error when\n" +"# attempting to write to a file or when you get it in non-raw mode. Setting\n" +"# values using the mapping protocol or ConfigParser's set() does not allow\n" +"# such assignments to take place.\n" +"config.add_section('Section1')\n" +"config.set('Section1', 'an_int', '15')\n" +"config.set('Section1', 'a_bool', 'true')\n" +"config.set('Section1', 'a_float', '3.1415')\n" +"config.set('Section1', 'baz', 'fun')\n" +"config.set('Section1', 'bar', 'Python')\n" +"config.set('Section1', 'foo', '%(bar)s is %(baz)s!')\n" +"\n" +"# Writing our configuration file to 'example.cfg'\n" +"with open('example.cfg', 'w') as configfile:\n" +" config.write(configfile)" +msgstr "" + +#: library/configparser.rst:874 msgid "An example of reading the configuration file again::" msgstr "" -#: library/configparser.rst:860 +#: library/configparser.rst:876 +msgid "" +"import configparser\n" +"\n" +"config = configparser.RawConfigParser()\n" +"config.read('example.cfg')\n" +"\n" +"# getfloat() raises an exception if the value is not a float\n" +"# getint() and getboolean() also do this for their respective types\n" +"a_float = config.getfloat('Section1', 'a_float')\n" +"an_int = config.getint('Section1', 'an_int')\n" +"print(a_float + an_int)\n" +"\n" +"# Notice that the next output does not interpolate '%(bar)s' or '%(baz)s'.\n" +"# This is because we are using a RawConfigParser().\n" +"if config.getboolean('Section1', 'a_bool'):\n" +" print(config.get('Section1', 'foo'))" +msgstr "" + +#: library/configparser.rst:892 msgid "To get interpolation, use :class:`ConfigParser`::" msgstr "" -#: library/configparser.rst:893 +#: library/configparser.rst:894 +msgid "" +"import configparser\n" +"\n" +"cfg = configparser.ConfigParser()\n" +"cfg.read('example.cfg')\n" +"\n" +"# Set the optional *raw* argument of get() to True if you wish to disable\n" +"# interpolation in a single get operation.\n" +"print(cfg.get('Section1', 'foo', raw=False)) # -> \"Python is fun!\"\n" +"print(cfg.get('Section1', 'foo', raw=True)) # -> \"%(bar)s is %(baz)s!\"\n" +"\n" +"# The optional *vars* argument is a dict with members that will take\n" +"# precedence in interpolation.\n" +"print(cfg.get('Section1', 'foo', vars={'bar': 'Documentation',\n" +" 'baz': 'evil'}))\n" +"\n" +"# The optional *fallback* argument can be used to provide a fallback value\n" +"print(cfg.get('Section1', 'foo'))\n" +" # -> \"Python is fun!\"\n" +"\n" +"print(cfg.get('Section1', 'foo', fallback='Monty is not.'))\n" +" # -> \"Python is fun!\"\n" +"\n" +"print(cfg.get('Section1', 'monster', fallback='No such things as " +"monsters.'))\n" +" # -> \"No such things as monsters.\"\n" +"\n" +"# A bare print(cfg.get('Section1', 'monster')) would raise NoOptionError\n" +"# but we can also use:\n" +"\n" +"print(cfg.get('Section1', 'monster', fallback=None))\n" +" # -> None" +msgstr "" + +#: library/configparser.rst:925 msgid "" "Default values are available in both types of ConfigParsers. They are used " "in interpolation if an option used is not defined elsewhere. ::" msgstr "" -#: library/configparser.rst:911 +#: library/configparser.rst:928 +msgid "" +"import configparser\n" +"\n" +"# New instance with 'bar' and 'baz' defaulting to 'Life' and 'hard' each\n" +"config = configparser.ConfigParser({'bar': 'Life', 'baz': 'hard'})\n" +"config.read('example.cfg')\n" +"\n" +"print(config.get('Section1', 'foo')) # -> \"Python is fun!\"\n" +"config.remove_option('Section1', 'bar')\n" +"config.remove_option('Section1', 'baz')\n" +"print(config.get('Section1', 'foo')) # -> \"Life is hard!\"" +msgstr "" + +#: library/configparser.rst:943 msgid "ConfigParser Objects" msgstr "" -#: library/configparser.rst:915 +#: library/configparser.rst:953 msgid "" "The main configuration parser. When *defaults* is given, it is initialized " "into the dictionary of intrinsic defaults. When *dict_type* is given, it " @@ -684,7 +1208,7 @@ msgid "" "the options within a section, and for the default values." msgstr "" -#: library/configparser.rst:920 +#: library/configparser.rst:958 msgid "" "When *delimiters* is given, it is used as the set of substrings that divide " "keys from values. When *comment_prefixes* is given, it will be used as the " @@ -693,7 +1217,7 @@ msgid "" "as the set of substrings that prefix comments in non-empty lines." msgstr "" -#: library/configparser.rst:926 +#: library/configparser.rst:964 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -706,7 +1230,7 @@ msgid "" "without the trailing delimiter." msgstr "" -#: library/configparser.rst:936 +#: library/configparser.rst:974 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -716,7 +1240,7 @@ msgid "" "settings to a new config file." msgstr "" -#: library/configparser.rst:943 +#: library/configparser.rst:981 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -725,7 +1249,7 @@ msgid "" "`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -#: library/configparser.rst:949 +#: library/configparser.rst:987 msgid "" "All option names used in interpolation will be passed through the :meth:" "`optionxform` method just like any other option name reference. For " @@ -734,53 +1258,70 @@ msgid "" "%(BAR)s`` are equivalent." msgstr "" -#: library/configparser.rst:955 +#: library/configparser.rst:993 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " "implementing the conversion from string to the desired datatype. Every " -"converter gets its own corresponding :meth:`!get*()` method on the parser " +"converter gets its own corresponding :meth:`!get*` method on the parser " "object and section proxies." msgstr "" -#: library/configparser.rst:961 +#: library/configparser.rst:999 +msgid "" +"When *allow_unnamed_section* is ``True`` (default: ``False``), the first " +"section name can be omitted. See the `\"Unnamed Sections\" section <#unnamed-" +"sections>`_." +msgstr "" + +#: library/configparser.rst:1028 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: library/configparser.rst:964 +#: library/configparser.rst:1324 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: library/configparser.rst:969 +#: library/configparser.rst:1329 msgid "The *converters* argument was added." msgstr "" -#: library/configparser.rst:972 +#: library/configparser.rst:1039 msgid "" -"The *defaults* argument is read with :meth:`read_dict()`, providing " -"consistent behavior across the parser: non-string keys and values are " -"implicitly converted to strings." +"The *defaults* argument is read with :meth:`read_dict`, providing consistent " +"behavior across the parser: non-string keys and values are implicitly " +"converted to strings." msgstr "" -#: library/configparser.rst:1240 +#: library/configparser.rst:1332 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" -#: library/configparser.rst:983 +#: library/configparser.rst:1048 +msgid "" +"Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, " +"and a key without a value is continued with an indented line." +msgstr "" + +#: library/configparser.rst:1336 +msgid "The *allow_unnamed_section* argument was added." +msgstr "" + +#: library/configparser.rst:1057 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -#: library/configparser.rst:988 +#: library/configparser.rst:1062 msgid "" "Return a list of the sections available; the *default section* is not " "included in the list." msgstr "" -#: library/configparser.rst:994 +#: library/configparser.rst:1068 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " @@ -788,34 +1329,34 @@ msgid "" "the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" -#: library/configparser.rst:999 +#: library/configparser.rst:1073 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -#: library/configparser.rst:1005 +#: library/configparser.rst:1079 msgid "" "Indicates whether the named *section* is present in the configuration. The " "*default section* is not acknowledged." msgstr "" -#: library/configparser.rst:1011 +#: library/configparser.rst:1085 msgid "Return a list of options available in the specified *section*." msgstr "" -#: library/configparser.rst:1016 +#: library/configparser.rst:1090 msgid "" "If the given *section* exists, and contains the given *option*, return :" "const:`True`; otherwise return :const:`False`. If the specified *section* " "is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -#: library/configparser.rst:1023 +#: library/configparser.rst:1097 msgid "" "Attempt to read and parse an iterable of filenames, returning a list of " "filenames which were successfully parsed." msgstr "" -#: library/configparser.rst:1026 +#: library/configparser.rst:1100 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -826,7 +1367,7 @@ msgid "" "be read." msgstr "" -#: library/configparser.rst:1035 +#: library/configparser.rst:1109 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " @@ -834,49 +1375,59 @@ msgid "" "`read_file` before calling :meth:`read` for any optional files::" msgstr "" -#: library/configparser.rst:1048 +#: library/configparser.rst:1115 +msgid "" +"import configparser, os\n" +"\n" +"config = configparser.ConfigParser()\n" +"config.read_file(open('defaults.cfg'))\n" +"config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\n" +" encoding='cp1250')" +msgstr "" + +#: library/configparser.rst:1122 msgid "" "Added the *encoding* parameter. Previously, all files were read using the " "default encoding for :func:`open`." msgstr "" -#: library/configparser.rst:1052 +#: library/configparser.rst:1126 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" -#: library/configparser.rst:1055 +#: library/configparser.rst:1129 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -#: library/configparser.rst:1061 +#: library/configparser.rst:1135 msgid "" "Read and parse configuration data from *f* which must be an iterable " "yielding Unicode strings (for example files opened in text mode)." msgstr "" -#: library/configparser.rst:1064 +#: library/configparser.rst:1138 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`!name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" -#: library/configparser.rst:1068 +#: library/configparser.rst:1142 msgid "Replaces :meth:`!readfp`." msgstr "" -#: library/configparser.rst:1073 +#: library/configparser.rst:1147 msgid "Parse configuration data from a string." msgstr "" -#: library/configparser.rst:1075 +#: library/configparser.rst:1149 msgid "" "Optional argument *source* specifies a context-specific name of the string " "passed. If not given, ``''`` is used. This should commonly be a " "filesystem path or a URL." msgstr "" -#: library/configparser.rst:1084 +#: library/configparser.rst:1158 msgid "" "Load configuration from any object that provides a dict-like ``items()`` " "method. Keys are section names, values are dictionaries with keys and " @@ -885,17 +1436,17 @@ msgid "" "automatically converted to strings." msgstr "" -#: library/configparser.rst:1090 +#: library/configparser.rst:1164 msgid "" "Optional argument *source* specifies a context-specific name of the " "dictionary passed. If not given, ```` is used." msgstr "" -#: library/configparser.rst:1093 +#: library/configparser.rst:1167 msgid "This method can be used to copy state between parsers." msgstr "" -#: library/configparser.rst:1100 +#: library/configparser.rst:1174 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -904,35 +1455,35 @@ msgid "" "provided as a *fallback* value." msgstr "" -#: library/configparser.rst:1106 +#: library/configparser.rst:1180 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -#: library/configparser.rst:1110 +#: library/configparser.rst:1184 msgid "" "Arguments *raw*, *vars* and *fallback* are keyword only to protect users " "from trying to use the third argument as the *fallback* fallback (especially " "when using the mapping protocol)." msgstr "" -#: library/configparser.rst:1118 +#: library/configparser.rst:1192 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to an integer. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -#: library/configparser.rst:1125 +#: library/configparser.rst:1199 msgid "" "A convenience method which coerces the *option* in the specified *section* " -"to a floating point number. See :meth:`get` for explanation of *raw*, " +"to a floating-point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" -#: library/configparser.rst:1132 +#: library/configparser.rst:1206 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -944,34 +1495,34 @@ msgid "" "*fallback*." msgstr "" -#: library/configparser.rst:1145 +#: library/configparser.rst:1219 msgid "" "When *section* is not given, return a list of *section_name*, " "*section_proxy* pairs, including DEFAULTSECT." msgstr "" -#: library/configparser.rst:1148 +#: library/configparser.rst:1222 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " "given *section*. Optional arguments have the same meaning as for the :meth:" "`get` method." msgstr "" -#: library/configparser.rst:1152 +#: library/configparser.rst:1226 msgid "" "Items present in *vars* no longer appear in the result. The previous " "behaviour mixed actual parser options with variables provided for " "interpolation." msgstr "" -#: library/configparser.rst:1160 +#: library/configparser.rst:1234 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. *option* and *value* must be " "strings; if not, :exc:`TypeError` is raised." msgstr "" -#: library/configparser.rst:1167 +#: library/configparser.rst:1241 msgid "" "Write a representation of the configuration to the specified :term:`file " "object`, which must be opened in text mode (accepting strings). This " @@ -980,27 +1531,33 @@ msgid "" "surrounded by spaces." msgstr "" -#: library/configparser.rst:1175 +#: library/configparser.rst:1247 +msgid "" +"Raises InvalidWriteError if this would write a representation which cannot " +"be accurately parsed by a future :meth:`read` call from this parser." +msgstr "" + +#: library/configparser.rst:1253 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: library/configparser.rst:1183 +#: library/configparser.rst:1261 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: library/configparser.rst:1191 +#: library/configparser.rst:1269 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: library/configparser.rst:1197 +#: library/configparser.rst:1275 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -1009,7 +1566,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: library/configparser.rst:1203 +#: library/configparser.rst:1281 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1017,24 +1574,36 @@ msgid "" "sensitive::" msgstr "" -#: library/configparser.rst:1211 +#: library/configparser.rst:1286 +msgid "" +"cfgparser = ConfigParser()\n" +"cfgparser.optionxform = str" +msgstr "" + +#: library/configparser.rst:1289 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: library/configparser.rst:1217 +#: library/configparser.rst:1295 +msgid "" +"A special object representing a section name used to reference the unnamed " +"section (see :ref:`unnamed-sections`)." +msgstr "" + +#: library/configparser.rst:1300 msgid "" "The maximum depth for recursive interpolation for :meth:`~configparser." "ConfigParser.get` when the *raw* parameter is false. This is relevant only " "when the default *interpolation* is used." msgstr "" -#: library/configparser.rst:1225 +#: library/configparser.rst:1308 msgid "RawConfigParser Objects" msgstr "" -#: library/configparser.rst:1235 +#: library/configparser.rst:1319 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1042,27 +1611,37 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: library/configparser.rst:1245 +#: library/configparser.rst:1340 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: library/configparser.rst:1252 +#: library/configparser.rst:1347 msgid "" -"Add a section named *section* to the instance. If a section by the given " -"name already exists, :exc:`DuplicateSectionError` is raised. If the " -"*default section* name is passed, :exc:`ValueError` is raised." +"Add a section named *section* or :const:`UNNAMED_SECTION` to the instance." msgstr "" -#: library/configparser.rst:1256 +#: library/configparser.rst:1349 +msgid "" +"If the given section already exists, :exc:`DuplicateSectionError` is raised. " +"If the *default section* name is passed, :exc:`ValueError` is raised. If :" +"const:`UNNAMED_SECTION` is passed and support is disabled, :exc:" +"`UnnamedSectionDisabledError` is raised." +msgstr "" + +#: library/configparser.rst:1354 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: library/configparser.rst:1262 +#: library/configparser.rst:1357 +msgid "Added support for :const:`UNNAMED_SECTION`." +msgstr "" + +#: library/configparser.rst:1363 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" @@ -1072,7 +1651,7 @@ msgid "" "string values." msgstr "" -#: library/configparser.rst:1269 +#: library/configparser.rst:1370 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1080,32 +1659,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: library/configparser.rst:1276 +#: library/configparser.rst:1377 msgid "Exceptions" msgstr "" -#: library/configparser.rst:1280 +#: library/configparser.rst:1381 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: library/configparser.rst:1285 +#: library/configparser.rst:1386 msgid "Exception raised when a specified section is not found." msgstr "" -#: library/configparser.rst:1290 +#: library/configparser.rst:1391 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" -#: library/configparser.rst:1294 +#: library/configparser.rst:1395 msgid "" "Added the optional *source* and *lineno* attributes and parameters to :meth:" "`!__init__`." msgstr "" -#: library/configparser.rst:1301 +#: library/configparser.rst:1402 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1113,58 +1692,83 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: library/configparser.rst:1309 +#: library/configparser.rst:1410 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: library/configparser.rst:1315 +#: library/configparser.rst:1416 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: library/configparser.rst:1321 +#: library/configparser.rst:1422 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" "exc:`InterpolationError`." msgstr "" -#: library/configparser.rst:1328 +#: library/configparser.rst:1429 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: library/configparser.rst:1334 +#: library/configparser.rst:1435 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: library/configparser.rst:1340 +#: library/configparser.rst:1441 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: library/configparser.rst:1346 +#: library/configparser.rst:1446 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: library/configparser.rst:1348 +#: library/configparser.rst:1448 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" -#: library/configparser.rst:1353 +#: library/configparser.rst:1454 +msgid "" +"Exception raised when a key without a corresponding value is continued with " +"an indented line." +msgstr "" + +#: library/configparser.rst:1461 +msgid "" +"Exception raised when attempting to use the :const:`UNNAMED_SECTION` without " +"enabling it." +msgstr "" + +#: library/configparser.rst:1468 +msgid "" +"Exception raised when an attempted :meth:`ConfigParser.write` would not be " +"parsed accurately with a future :meth:`ConfigParser.read` call." +msgstr "" + +#: library/configparser.rst:1471 +msgid "" +"Ex: Writing a key beginning with the :attr:`ConfigParser.SECTCRE` pattern " +"would parse as a section header when read. Attempting to write this will " +"raise this exception." +msgstr "" + +#: library/configparser.rst:1478 msgid "Footnotes" msgstr "" -#: library/configparser.rst:1354 +#: library/configparser.rst:1479 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " @@ -1191,14 +1795,14 @@ msgstr "" msgid "Windows ini file" msgstr "" -#: library/configparser.rst:335 +#: library/configparser.rst:367 msgid "% (percent)" msgstr "" -#: library/configparser.rst:368 +#: library/configparser.rst:400 msgid "interpolation in configuration files" msgstr "" -#: library/configparser.rst:368 +#: library/configparser.rst:400 msgid "$ (dollar)" msgstr "" diff --git a/library/constants.po b/library/constants.po index 1e28244c..69ac0adf 100644 --- a/library/constants.po +++ b/library/constants.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -73,44 +74,48 @@ msgstr "" #: library/constants.rst:51 msgid "" -"``NotImplementedError`` and :data:`!NotImplemented` are not interchangeable, " -"even though they have similar names and purposes. See :exc:" -"`NotImplementedError` for details on when to use it." +":data:`!NotImplemented` and :exc:`!NotImplementedError` are not " +"interchangeable. This constant should only be used as described above; see :" +"exc:`NotImplementedError` for details on correct usage of the exception." msgstr "" -#: library/constants.rst:55 +#: library/constants.rst:56 +msgid "Evaluating :data:`!NotImplemented` in a boolean context was deprecated." +msgstr "" + +#: library/constants.rst:59 msgid "" -"Evaluating :data:`!NotImplemented` in a boolean context is deprecated. While " -"it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. It " -"will raise a :exc:`TypeError` in a future version of Python." +"Evaluating :data:`!NotImplemented` in a boolean context now raises a :exc:" +"`TypeError`. It previously evaluated to :const:`True` and emitted a :exc:" +"`DeprecationWarning` since Python 3.9." msgstr "" -#: library/constants.rst:64 +#: library/constants.rst:68 msgid "" -"The same as the ellipsis literal \"``...``\". Special value used mostly in " -"conjunction with extended slicing syntax for user-defined container data " -"types. ``Ellipsis`` is the sole instance of the :data:`types.EllipsisType` " -"type." +"The same as the ellipsis literal \"``...``\", an object frequently used to " +"indicate that something is omitted. Assignment to ``Ellipsis`` is possible, " +"but assignment to ``...`` raises a :exc:`SyntaxError`. ``Ellipsis`` is the " +"sole instance of the :data:`types.EllipsisType` type." msgstr "" -#: library/constants.rst:71 +#: library/constants.rst:76 msgid "" "This constant is true if Python was not started with an :option:`-O` option. " "See also the :keyword:`assert` statement." msgstr "" -#: library/constants.rst:77 +#: library/constants.rst:82 msgid "" "The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` " "cannot be reassigned (assignments to them, even as an attribute name, raise :" "exc:`SyntaxError`), so they can be considered \"true\" constants." msgstr "" -#: library/constants.rst:83 +#: library/constants.rst:90 msgid "Constants added by the :mod:`site` module" msgstr "" -#: library/constants.rst:85 +#: library/constants.rst:92 msgid "" "The :mod:`site` module (which is imported automatically during startup, " "except if the :option:`-S` command-line option is given) adds several " @@ -118,30 +123,38 @@ msgid "" "interpreter shell and should not be used in programs." msgstr "" -#: library/constants.rst:93 +#: library/constants.rst:100 msgid "" "Objects that when printed, print a message like \"Use quit() or Ctrl-D (i.e. " -"EOF) to exit\", and when called, raise :exc:`SystemExit` with the specified " -"exit code." +"EOF) to exit\", and when accessed directly in the interactive interpreter or " +"called as functions, raise :exc:`SystemExit` with the specified exit code." msgstr "" -#: library/constants.rst:100 +#: library/constants.rst:108 +msgid "" +"Object that when printed, prints the message \"Type help() for interactive " +"help, or help(object) for help about object.\", and when accessed directly " +"in the interactive interpreter, invokes the built-in help system (see :func:" +"`help`)." +msgstr "" + +#: library/constants.rst:116 msgid "" "Objects that when printed or called, print the text of copyright or credits, " "respectively." msgstr "" -#: library/constants.rst:105 +#: library/constants.rst:121 msgid "" "Object that when printed, prints the message \"Type license() to see the " "full license text\", and when called, displays the full license text in a " "pager-like fashion (one screen at a time)." msgstr "" -#: library/constants.rst:61 +#: library/constants.rst:65 msgid "..." msgstr "" -#: library/constants.rst:61 +#: library/constants.rst:65 msgid "ellipsis literal" msgstr "" diff --git a/library/contextlib.po b/library/contextlib.po index 62c6e6f8..6b34ae6d 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -71,7 +72,7 @@ msgid "" "While many objects natively support use in with statements, sometimes a " "resource needs to be managed that isn't a context manager in its own right, " "and doesn't implement a ``close()`` method for use with ``contextlib." -"closing``" +"closing``." msgstr "" #: library/contextlib.rst:54 @@ -80,10 +81,32 @@ msgid "" "management::" msgstr "" +#: library/contextlib.rst:57 +msgid "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def managed_resource(*args, **kwds):\n" +" # Code to acquire resource, e.g.:\n" +" resource = acquire_resource(*args, **kwds)\n" +" try:\n" +" yield resource\n" +" finally:\n" +" # Code to release resource, e.g.:\n" +" release_resource(resource)" +msgstr "" + #: library/contextlib.rst:69 msgid "The function can then be used like this::" msgstr "" +#: library/contextlib.rst:71 +msgid "" +">>> with managed_resource(timeout=3600) as resource:\n" +"... # Resource is released at the end of this block,\n" +"... # even if code in the block raises an exception" +msgstr "" + #: library/contextlib.rst:75 msgid "" "The function being decorated must return a :term:`generator`-iterator when " @@ -141,12 +164,47 @@ msgstr "" msgid "A simple example::" msgstr "" +#: library/contextlib.rst:115 +msgid "" +"from contextlib import asynccontextmanager\n" +"\n" +"@asynccontextmanager\n" +"async def get_connection():\n" +" conn = await acquire_db_connection()\n" +" try:\n" +" yield conn\n" +" finally:\n" +" await release_db_connection(conn)\n" +"\n" +"async def get_all_users():\n" +" async with get_connection() as conn:\n" +" return conn.query('SELECT ...')" +msgstr "" + #: library/contextlib.rst:131 msgid "" "Context managers defined with :func:`asynccontextmanager` can be used either " "as decorators or with :keyword:`async with` statements::" msgstr "" +#: library/contextlib.rst:134 +msgid "" +"import time\n" +"from contextlib import asynccontextmanager\n" +"\n" +"@asynccontextmanager\n" +"async def timeit():\n" +" now = time.monotonic()\n" +" try:\n" +" yield\n" +" finally:\n" +" print(f'it took {time.monotonic() - now}s to run')\n" +"\n" +"@timeit()\n" +"async def main():\n" +" # ... async code ..." +msgstr "" + #: library/contextlib.rst:149 msgid "" "When used as a decorator, a new generator instance is implicitly created on " @@ -167,10 +225,32 @@ msgid "" "This is basically equivalent to::" msgstr "" +#: library/contextlib.rst:164 +msgid "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def closing(thing):\n" +" try:\n" +" yield thing\n" +" finally:\n" +" thing.close()" +msgstr "" + #: library/contextlib.rst:173 msgid "And lets you write code like this::" msgstr "" +#: library/contextlib.rst:175 +msgid "" +"from contextlib import closing\n" +"from urllib.request import urlopen\n" +"\n" +"with closing(urlopen('https://www.python.org')) as page:\n" +" for line in page:\n" +" print(line)" +msgstr "" + #: library/contextlib.rst:182 msgid "" "without needing to explicitly close ``page``. Even if an error occurs, " @@ -192,6 +272,18 @@ msgid "" "*thing* upon completion of the block. This is basically equivalent to::" msgstr "" +#: library/contextlib.rst:199 +msgid "" +"from contextlib import asynccontextmanager\n" +"\n" +"@asynccontextmanager\n" +"async def aclosing(thing):\n" +" try:\n" +" yield thing\n" +" finally:\n" +" await thing.aclose()" +msgstr "" + #: library/contextlib.rst:208 msgid "" "Significantly, ``aclosing()`` supports deterministic cleanup of async " @@ -199,6 +291,16 @@ msgid "" "exception. For example::" msgstr "" +#: library/contextlib.rst:212 +msgid "" +"from contextlib import aclosing\n" +"\n" +"async with aclosing(my_generator()) as values:\n" +" async for value in values:\n" +" if value == 42:\n" +" break" +msgstr "" + #: library/contextlib.rst:219 msgid "" "This pattern ensures that the generator's async exit code is executed in the " @@ -214,16 +316,57 @@ msgid "" "optional context manager, for example::" msgstr "" +#: library/contextlib.rst:235 +msgid "" +"def myfunction(arg, ignore_exceptions=False):\n" +" if ignore_exceptions:\n" +" # Use suppress to ignore all exceptions.\n" +" cm = contextlib.suppress(Exception)\n" +" else:\n" +" # Do not ignore any exceptions, cm has no effect.\n" +" cm = contextlib.nullcontext()\n" +" with cm:\n" +" # Do something" +msgstr "" + #: library/contextlib.rst:245 msgid "An example using *enter_result*::" msgstr "" +#: library/contextlib.rst:247 +msgid "" +"def process_file(file_or_path):\n" +" if isinstance(file_or_path, str):\n" +" # If string, open file\n" +" cm = open(file_or_path)\n" +" else:\n" +" # Caller is responsible for closing file\n" +" cm = nullcontext(file_or_path)\n" +"\n" +" with cm as file:\n" +" # Perform processing on the file" +msgstr "" + #: library/contextlib.rst:258 msgid "" "It can also be used as a stand-in for :ref:`asynchronous context managers " "`::" msgstr "" +#: library/contextlib.rst:261 +msgid "" +"async def send_http(session=None):\n" +" if not session:\n" +" # If no http session, create it with aiohttp\n" +" cm = aiohttp.ClientSession()\n" +" else:\n" +" # Caller is responsible for closing the session\n" +" cm = nullcontext(session)\n" +"\n" +" async with cm as session:\n" +" # Send http requests with session" +msgstr "" + #: library/contextlib.rst:274 msgid ":term:`asynchronous context manager` support was added." msgstr "" @@ -248,41 +391,66 @@ msgstr "" msgid "For example::" msgstr "" +#: library/contextlib.rst:293 +msgid "" +"from contextlib import suppress\n" +"\n" +"with suppress(FileNotFoundError):\n" +" os.remove('somefile.tmp')\n" +"\n" +"with suppress(FileNotFoundError):\n" +" os.remove('someotherfile.tmp')" +msgstr "" + #: library/contextlib.rst:301 msgid "This code is equivalent to::" msgstr "" -#: library/contextlib.rst:360 library/contextlib.rst:387 +#: library/contextlib.rst:303 +msgid "" +"try:\n" +" os.remove('somefile.tmp')\n" +"except FileNotFoundError:\n" +" pass\n" +"\n" +"try:\n" +" os.remove('someotherfile.tmp')\n" +"except FileNotFoundError:\n" +" pass" +msgstr "" + +#: library/contextlib.rst:362 library/contextlib.rst:389 msgid "This context manager is :ref:`reentrant `." msgstr "" #: library/contextlib.rst:315 msgid "" "If the code within the :keyword:`!with` block raises a :exc:" -"`BaseExceptionGroup`, suppressed exceptions are removed from the group. If " -"any exceptions in the group are not suppressed, a group containing them is " -"re-raised." +"`BaseExceptionGroup`, suppressed exceptions are removed from the group. Any " +"exceptions of the group which are not suppressed are re-raised in a new " +"group which is created using the original group's :meth:`~BaseExceptionGroup." +"derive` method." msgstr "" -#: library/contextlib.rst:321 +#: library/contextlib.rst:323 msgid "" -"``suppress`` now supports suppressing exceptions raised as part of an :exc:" +"``suppress`` now supports suppressing exceptions raised as part of a :exc:" "`BaseExceptionGroup`." msgstr "" -#: library/contextlib.rst:327 +#: library/contextlib.rst:329 msgid "" "Context manager for temporarily redirecting :data:`sys.stdout` to another " "file or file-like object." msgstr "" -#: library/contextlib.rst:330 +#: library/contextlib.rst:332 msgid "" "This tool adds flexibility to existing functions or classes whose output is " "hardwired to stdout." msgstr "" -#: library/contextlib.rst:333 +#: library/contextlib.rst:335 msgid "" "For example, the output of :func:`help` normally is sent to *sys.stdout*. " "You can capture that output in a string by redirecting the output to an :" @@ -291,17 +459,37 @@ msgid "" "`with` statement::" msgstr "" -#: library/contextlib.rst:343 +#: library/contextlib.rst:341 +msgid "" +"with redirect_stdout(io.StringIO()) as f:\n" +" help(pow)\n" +"s = f.getvalue()" +msgstr "" + +#: library/contextlib.rst:345 msgid "" "To send the output of :func:`help` to a file on disk, redirect the output to " "a regular file::" msgstr "" -#: library/contextlib.rst:350 +#: library/contextlib.rst:348 +msgid "" +"with open('help.txt', 'w') as f:\n" +" with redirect_stdout(f):\n" +" help(pow)" +msgstr "" + +#: library/contextlib.rst:352 msgid "To send the output of :func:`help` to *sys.stderr*::" msgstr "" -#: library/contextlib.rst:355 +#: library/contextlib.rst:354 +msgid "" +"with redirect_stdout(sys.stderr):\n" +" help(pow)" +msgstr "" + +#: library/contextlib.rst:357 msgid "" "Note that the global side effect on :data:`sys.stdout` means that this " "context manager is not suitable for use in library code and most threaded " @@ -309,13 +497,13 @@ msgid "" "it is still a useful approach for many utility scripts." msgstr "" -#: library/contextlib.rst:367 +#: library/contextlib.rst:369 msgid "" "Similar to :func:`~contextlib.redirect_stdout` but redirecting :data:`sys." "stderr` to another file or file-like object." msgstr "" -#: library/contextlib.rst:377 +#: library/contextlib.rst:379 msgid "" "Non parallel-safe context manager to change the current working directory. " "As this changes a global state, the working directory, it is not suitable " @@ -325,60 +513,119 @@ msgid "" "when this context manager is active." msgstr "" -#: library/contextlib.rst:384 +#: library/contextlib.rst:386 msgid "" "This is a simple wrapper around :func:`~os.chdir`, it changes the current " "working directory upon entering and restores the old one on exit." msgstr "" -#: library/contextlib.rst:394 +#: library/contextlib.rst:396 msgid "" "A base class that enables a context manager to also be used as a decorator." msgstr "" -#: library/contextlib.rst:396 +#: library/contextlib.rst:398 msgid "" "Context managers inheriting from ``ContextDecorator`` have to implement " "``__enter__`` and ``__exit__`` as normal. ``__exit__`` retains its optional " "exception handling even when used as a decorator." msgstr "" -#: library/contextlib.rst:400 +#: library/contextlib.rst:402 msgid "" "``ContextDecorator`` is used by :func:`contextmanager`, so you get this " "functionality automatically." msgstr "" -#: library/contextlib.rst:403 +#: library/contextlib.rst:405 msgid "Example of ``ContextDecorator``::" msgstr "" -#: library/contextlib.rst:488 +#: library/contextlib.rst:407 +msgid "" +"from contextlib import ContextDecorator\n" +"\n" +"class mycontext(ContextDecorator):\n" +" def __enter__(self):\n" +" print('Starting')\n" +" return self\n" +"\n" +" def __exit__(self, *exc):\n" +" print('Finishing')\n" +" return False" +msgstr "" + +#: library/contextlib.rst:490 msgid "The class can then be used like this::" msgstr "" -#: library/contextlib.rst:434 +#: library/contextlib.rst:420 +msgid "" +">>> @mycontext()\n" +"... def function():\n" +"... print('The bit in the middle')\n" +"...\n" +">>> function()\n" +"Starting\n" +"The bit in the middle\n" +"Finishing\n" +"\n" +">>> with mycontext():\n" +"... print('The bit in the middle')\n" +"...\n" +"Starting\n" +"The bit in the middle\n" +"Finishing" +msgstr "" + +#: library/contextlib.rst:436 msgid "" "This change is just syntactic sugar for any construct of the following form::" msgstr "" -#: library/contextlib.rst:440 +#: library/contextlib.rst:438 +msgid "" +"def f():\n" +" with cm():\n" +" # Do stuff" +msgstr "" + +#: library/contextlib.rst:442 msgid "``ContextDecorator`` lets you instead write::" msgstr "" -#: library/contextlib.rst:446 +#: library/contextlib.rst:444 +msgid "" +"@cm()\n" +"def f():\n" +" # Do stuff" +msgstr "" + +#: library/contextlib.rst:448 msgid "" "It makes it clear that the ``cm`` applies to the whole function, rather than " "just a piece of it (and saving an indentation level is nice, too)." msgstr "" -#: library/contextlib.rst:449 +#: library/contextlib.rst:451 msgid "" "Existing context managers that already have a base class can be extended by " "using ``ContextDecorator`` as a mixin class::" msgstr "" -#: library/contextlib.rst:462 +#: library/contextlib.rst:454 +msgid "" +"from contextlib import ContextDecorator\n" +"\n" +"class mycontext(ContextBaseClass, ContextDecorator):\n" +" def __enter__(self):\n" +" return self\n" +"\n" +" def __exit__(self, *exc):\n" +" return False" +msgstr "" + +#: library/contextlib.rst:464 msgid "" "As the decorated function must be able to be called multiple times, the " "underlying context manager must support use in multiple :keyword:`with` " @@ -386,35 +633,80 @@ msgid "" "explicit :keyword:`!with` statement inside the function should be used." msgstr "" -#: library/contextlib.rst:472 +#: library/contextlib.rst:474 msgid "" "Similar to :class:`ContextDecorator` but only for asynchronous functions." msgstr "" -#: library/contextlib.rst:474 +#: library/contextlib.rst:476 msgid "Example of ``AsyncContextDecorator``::" msgstr "" -#: library/contextlib.rst:513 +#: library/contextlib.rst:478 +msgid "" +"from asyncio import run\n" +"from contextlib import AsyncContextDecorator\n" +"\n" +"class mycontext(AsyncContextDecorator):\n" +" async def __aenter__(self):\n" +" print('Starting')\n" +" return self\n" +"\n" +" async def __aexit__(self, *exc):\n" +" print('Finishing')\n" +" return False" +msgstr "" + +#: library/contextlib.rst:492 +msgid "" +">>> @mycontext()\n" +"... async def function():\n" +"... print('The bit in the middle')\n" +"...\n" +">>> run(function())\n" +"Starting\n" +"The bit in the middle\n" +"Finishing\n" +"\n" +">>> async def function():\n" +"... async with mycontext():\n" +"... print('The bit in the middle')\n" +"...\n" +">>> run(function())\n" +"Starting\n" +"The bit in the middle\n" +"Finishing" +msgstr "" + +#: library/contextlib.rst:515 msgid "" "A context manager that is designed to make it easy to programmatically " "combine other context managers and cleanup functions, especially those that " "are optional or otherwise driven by input data." msgstr "" -#: library/contextlib.rst:517 +#: library/contextlib.rst:519 msgid "" "For example, a set of files may easily be handled in a single with statement " "as follows::" msgstr "" -#: library/contextlib.rst:526 +#: library/contextlib.rst:522 +msgid "" +"with ExitStack() as stack:\n" +" files = [stack.enter_context(open(fname)) for fname in filenames]\n" +" # All opened files will automatically be closed at the end of\n" +" # the with statement, even if attempts to open files later\n" +" # in the list raise an exception" +msgstr "" + +#: library/contextlib.rst:528 msgid "" "The :meth:`~object.__enter__` method returns the :class:`ExitStack` " "instance, and performs no additional operations." msgstr "" -#: library/contextlib.rst:529 +#: library/contextlib.rst:531 msgid "" "Each instance maintains a stack of registered callbacks that are called in " "reverse order when the instance is closed (either explicitly or implicitly " @@ -422,14 +714,14 @@ msgid "" "invoked implicitly when the context stack instance is garbage collected." msgstr "" -#: library/contextlib.rst:534 +#: library/contextlib.rst:536 msgid "" "This stack model is used so that context managers that acquire their " "resources in their ``__init__`` method (such as file objects) can be handled " "correctly." msgstr "" -#: library/contextlib.rst:538 +#: library/contextlib.rst:540 msgid "" "Since registered callbacks are invoked in the reverse order of registration, " "this ends up behaving as if multiple nested :keyword:`with` statements had " @@ -439,7 +731,7 @@ msgid "" "updated state." msgstr "" -#: library/contextlib.rst:545 +#: library/contextlib.rst:547 msgid "" "This is a relatively low level API that takes care of the details of " "correctly unwinding the stack of exit callbacks. It provides a suitable " @@ -447,76 +739,76 @@ msgid "" "in application specific ways." msgstr "" -#: library/contextlib.rst:554 +#: library/contextlib.rst:556 msgid "" "Enters a new context manager and adds its :meth:`~object.__exit__` method to " "the callback stack. The return value is the result of the context manager's " "own :meth:`~object.__enter__` method." msgstr "" -#: library/contextlib.rst:558 +#: library/contextlib.rst:560 msgid "" "These context managers may suppress exceptions just as they normally would " "if used directly as part of a :keyword:`with` statement." msgstr "" -#: library/contextlib.rst:561 +#: library/contextlib.rst:563 msgid "" "Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not a " "context manager." msgstr "" -#: library/contextlib.rst:567 +#: library/contextlib.rst:569 msgid "" "Adds a context manager's :meth:`~object.__exit__` method to the callback " "stack." msgstr "" -#: library/contextlib.rst:569 +#: library/contextlib.rst:571 msgid "" "As ``__enter__`` is *not* invoked, this method can be used to cover part of " "an :meth:`~object.__enter__` implementation with a context manager's own :" "meth:`~object.__exit__` method." msgstr "" -#: library/contextlib.rst:573 +#: library/contextlib.rst:575 msgid "" "If passed an object that is not a context manager, this method assumes it is " "a callback with the same signature as a context manager's :meth:`~object." "__exit__` method and adds it directly to the callback stack." msgstr "" -#: library/contextlib.rst:577 +#: library/contextlib.rst:579 msgid "" "By returning true values, these callbacks can suppress exceptions the same " "way context manager :meth:`~object.__exit__` methods can." msgstr "" -#: library/contextlib.rst:580 +#: library/contextlib.rst:582 msgid "" "The passed in object is returned from the function, allowing this method to " "be used as a function decorator." msgstr "" -#: library/contextlib.rst:585 +#: library/contextlib.rst:587 msgid "" "Accepts an arbitrary callback function and arguments and adds it to the " "callback stack." msgstr "" -#: library/contextlib.rst:588 +#: library/contextlib.rst:590 msgid "" "Unlike the other methods, callbacks added this way cannot suppress " "exceptions (as they are never passed the exception details)." msgstr "" -#: library/contextlib.rst:591 +#: library/contextlib.rst:593 msgid "" "The passed in callback is returned from the function, allowing this method " "to be used as a function decorator." msgstr "" -#: library/contextlib.rst:596 +#: library/contextlib.rst:598 msgid "" "Transfers the callback stack to a fresh :class:`ExitStack` instance and " "returns it. No callbacks are invoked by this operation - instead, they will " @@ -524,77 +816,99 @@ msgid "" "at the end of a :keyword:`with` statement)." msgstr "" -#: library/contextlib.rst:601 +#: library/contextlib.rst:603 msgid "" "For example, a group of files can be opened as an \"all or nothing\" " "operation as follows::" msgstr "" -#: library/contextlib.rst:615 +#: library/contextlib.rst:606 +msgid "" +"with ExitStack() as stack:\n" +" files = [stack.enter_context(open(fname)) for fname in filenames]\n" +" # Hold onto the close method, but don't call it yet.\n" +" close_files = stack.pop_all().close\n" +" # If opening any file fails, all previously opened files will be\n" +" # closed automatically. If all files are opened successfully,\n" +" # they will remain open even after the with statement ends.\n" +" # close_files() can then be invoked explicitly to close them all." +msgstr "" + +#: library/contextlib.rst:617 msgid "" "Immediately unwinds the callback stack, invoking callbacks in the reverse " "order of registration. For any context managers and exit callbacks " "registered, the arguments passed in will indicate that no exception occurred." msgstr "" -#: library/contextlib.rst:622 +#: library/contextlib.rst:624 msgid "" "An :ref:`asynchronous context manager `, similar to :" "class:`ExitStack`, that supports combining both synchronous and asynchronous " "context managers, as well as having coroutines for cleanup logic." msgstr "" -#: library/contextlib.rst:627 +#: library/contextlib.rst:629 msgid "" "The :meth:`~ExitStack.close` method is not implemented; :meth:`aclose` must " "be used instead." msgstr "" -#: library/contextlib.rst:632 +#: library/contextlib.rst:635 msgid "" "Similar to :meth:`ExitStack.enter_context` but expects an asynchronous " "context manager." msgstr "" -#: library/contextlib.rst:635 +#: library/contextlib.rst:638 msgid "" "Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not an " "asynchronous context manager." msgstr "" -#: library/contextlib.rst:641 +#: library/contextlib.rst:644 msgid "" "Similar to :meth:`ExitStack.push` but expects either an asynchronous context " "manager or a coroutine function." msgstr "" -#: library/contextlib.rst:646 +#: library/contextlib.rst:649 msgid "Similar to :meth:`ExitStack.callback` but expects a coroutine function." msgstr "" -#: library/contextlib.rst:650 +#: library/contextlib.rst:654 msgid "Similar to :meth:`ExitStack.close` but properly handles awaitables." msgstr "" -#: library/contextlib.rst:652 +#: library/contextlib.rst:656 msgid "Continuing the example for :func:`asynccontextmanager`::" msgstr "" -#: library/contextlib.rst:664 +#: library/contextlib.rst:658 +msgid "" +"async with AsyncExitStack() as stack:\n" +" connections = [await stack.enter_async_context(get_connection())\n" +" for i in range(5)]\n" +" # All opened connections will automatically be released at the end of\n" +" # the async with statement, even if attempts to open a connection\n" +" # later in the list raise an exception." +msgstr "" + +#: library/contextlib.rst:668 msgid "Examples and Recipes" msgstr "" -#: library/contextlib.rst:666 +#: library/contextlib.rst:670 msgid "" "This section describes some examples and recipes for making effective use of " "the tools provided by :mod:`contextlib`." msgstr "" -#: library/contextlib.rst:671 +#: library/contextlib.rst:675 msgid "Supporting a variable number of context managers" msgstr "" -#: library/contextlib.rst:673 +#: library/contextlib.rst:677 msgid "" "The primary use case for :class:`ExitStack` is the one given in the class " "documentation: supporting a variable number of context managers and other " @@ -604,18 +918,29 @@ msgid "" "of the context managers being optional::" msgstr "" -#: library/contextlib.rst:688 +#: library/contextlib.rst:684 +msgid "" +"with ExitStack() as stack:\n" +" for resource in resources:\n" +" stack.enter_context(resource)\n" +" if need_special_resource():\n" +" special = acquire_special_resource()\n" +" stack.callback(release_special_resource, special)\n" +" # Perform operations that use the acquired resources" +msgstr "" + +#: library/contextlib.rst:692 msgid "" "As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` " "statements to manage arbitrary resources that don't natively support the " "context management protocol." msgstr "" -#: library/contextlib.rst:694 +#: library/contextlib.rst:698 msgid "Catching exceptions from ``__enter__`` methods" msgstr "" -#: library/contextlib.rst:696 +#: library/contextlib.rst:700 msgid "" "It is occasionally desirable to catch exceptions from an ``__enter__`` " "method implementation, *without* inadvertently catching exceptions from the :" @@ -624,7 +949,19 @@ msgid "" "be separated slightly in order to allow this::" msgstr "" -#: library/contextlib.rst:711 +#: library/contextlib.rst:706 +msgid "" +"stack = ExitStack()\n" +"try:\n" +" x = stack.enter_context(cm)\n" +"except Exception:\n" +" # handle __enter__ exception\n" +"else:\n" +" with stack:\n" +" # Handle normal case" +msgstr "" + +#: library/contextlib.rst:715 msgid "" "Actually needing to do this is likely to indicate that the underlying API " "should be providing a direct resource management interface for use with :" @@ -635,29 +972,67 @@ msgid "" "`with` statement." msgstr "" -#: library/contextlib.rst:721 +#: library/contextlib.rst:725 msgid "Cleaning up in an ``__enter__`` implementation" msgstr "" -#: library/contextlib.rst:723 +#: library/contextlib.rst:727 msgid "" "As noted in the documentation of :meth:`ExitStack.push`, this method can be " "useful in cleaning up an already allocated resource if later steps in the :" "meth:`~object.__enter__` implementation fail." msgstr "" -#: library/contextlib.rst:727 +#: library/contextlib.rst:731 msgid "" "Here's an example of doing this for a context manager that accepts resource " "acquisition and release functions, along with an optional validation " "function, and maps them to the context management protocol::" msgstr "" -#: library/contextlib.rst:767 +#: library/contextlib.rst:735 +msgid "" +"from contextlib import contextmanager, AbstractContextManager, ExitStack\n" +"\n" +"class ResourceManager(AbstractContextManager):\n" +"\n" +" def __init__(self, acquire_resource, release_resource, " +"check_resource_ok=None):\n" +" self.acquire_resource = acquire_resource\n" +" self.release_resource = release_resource\n" +" if check_resource_ok is None:\n" +" def check_resource_ok(resource):\n" +" return True\n" +" self.check_resource_ok = check_resource_ok\n" +"\n" +" @contextmanager\n" +" def _cleanup_on_error(self):\n" +" with ExitStack() as stack:\n" +" stack.push(self)\n" +" yield\n" +" # The validation check passed and didn't raise an exception\n" +" # Accordingly, we want to keep the resource, and pass it\n" +" # back to our caller\n" +" stack.pop_all()\n" +"\n" +" def __enter__(self):\n" +" resource = self.acquire_resource()\n" +" with self._cleanup_on_error():\n" +" if not self.check_resource_ok(resource):\n" +" msg = \"Failed validation for {!r}\"\n" +" raise RuntimeError(msg.format(resource))\n" +" return resource\n" +"\n" +" def __exit__(self, *exc_details):\n" +" # We don't need to duplicate any of our resource release logic\n" +" self.release_resource()" +msgstr "" + +#: library/contextlib.rst:771 msgid "Replacing any use of ``try-finally`` and flag variables" msgstr "" -#: library/contextlib.rst:769 +#: library/contextlib.rst:773 msgid "" "A pattern you will sometimes see is a ``try-finally`` statement with a flag " "variable to indicate whether or not the body of the ``finally`` clause " @@ -665,57 +1040,111 @@ msgid "" "by using an ``except`` clause instead), it looks something like this::" msgstr "" -#: library/contextlib.rst:783 +#: library/contextlib.rst:778 +msgid "" +"cleanup_needed = True\n" +"try:\n" +" result = perform_operation()\n" +" if result:\n" +" cleanup_needed = False\n" +"finally:\n" +" if cleanup_needed:\n" +" cleanup_resources()" +msgstr "" + +#: library/contextlib.rst:787 msgid "" "As with any ``try`` statement based code, this can cause problems for " "development and review, because the setup code and the cleanup code can end " "up being separated by arbitrarily long sections of code." msgstr "" -#: library/contextlib.rst:787 +#: library/contextlib.rst:791 msgid "" ":class:`ExitStack` makes it possible to instead register a callback for " "execution at the end of a ``with`` statement, and then later decide to skip " "executing that callback::" msgstr "" -#: library/contextlib.rst:799 +#: library/contextlib.rst:795 msgid "" -"This allows the intended cleanup up behaviour to be made explicit up front, " +"from contextlib import ExitStack\n" +"\n" +"with ExitStack() as stack:\n" +" stack.callback(cleanup_resources)\n" +" result = perform_operation()\n" +" if result:\n" +" stack.pop_all()" +msgstr "" + +#: library/contextlib.rst:803 +msgid "" +"This allows the intended cleanup behaviour to be made explicit up front, " "rather than requiring a separate flag variable." msgstr "" -#: library/contextlib.rst:802 +#: library/contextlib.rst:806 msgid "" "If a particular application uses this pattern a lot, it can be simplified " "even further by means of a small helper class::" msgstr "" -#: library/contextlib.rst:820 +#: library/contextlib.rst:809 +msgid "" +"from contextlib import ExitStack\n" +"\n" +"class Callback(ExitStack):\n" +" def __init__(self, callback, /, *args, **kwds):\n" +" super().__init__()\n" +" self.callback(callback, *args, **kwds)\n" +"\n" +" def cancel(self):\n" +" self.pop_all()\n" +"\n" +"with Callback(cleanup_resources) as cb:\n" +" result = perform_operation()\n" +" if result:\n" +" cb.cancel()" +msgstr "" + +#: library/contextlib.rst:824 msgid "" "If the resource cleanup isn't already neatly bundled into a standalone " "function, then it is still possible to use the decorator form of :meth:" "`ExitStack.callback` to declare the resource cleanup in advance::" msgstr "" -#: library/contextlib.rst:835 +#: library/contextlib.rst:829 +msgid "" +"from contextlib import ExitStack\n" +"\n" +"with ExitStack() as stack:\n" +" @stack.callback\n" +" def cleanup_resources():\n" +" ...\n" +" result = perform_operation()\n" +" if result:\n" +" stack.pop_all()" +msgstr "" + +#: library/contextlib.rst:839 msgid "" "Due to the way the decorator protocol works, a callback function declared " "this way cannot take any parameters. Instead, any resources to be released " "must be accessed as closure variables." msgstr "" -#: library/contextlib.rst:841 +#: library/contextlib.rst:845 msgid "Using a context manager as a function decorator" msgstr "" -#: library/contextlib.rst:843 +#: library/contextlib.rst:847 msgid "" ":class:`ContextDecorator` makes it possible to use a context manager in both " "an ordinary ``with`` statement and also as a function decorator." msgstr "" -#: library/contextlib.rst:846 +#: library/contextlib.rst:850 msgid "" "For example, it is sometimes useful to wrap functions or groups of " "statements with a logger that can track the time of entry and time of exit. " @@ -724,15 +1153,48 @@ msgid "" "in a single definition::" msgstr "" -#: library/contextlib.rst:867 +#: library/contextlib.rst:856 +msgid "" +"from contextlib import ContextDecorator\n" +"import logging\n" +"\n" +"logging.basicConfig(level=logging.INFO)\n" +"\n" +"class track_entry_and_exit(ContextDecorator):\n" +" def __init__(self, name):\n" +" self.name = name\n" +"\n" +" def __enter__(self):\n" +" logging.info('Entering: %s', self.name)\n" +"\n" +" def __exit__(self, exc_type, exc, exc_tb):\n" +" logging.info('Exiting: %s', self.name)" +msgstr "" + +#: library/contextlib.rst:871 msgid "Instances of this class can be used as both a context manager::" msgstr "" #: library/contextlib.rst:873 +msgid "" +"with track_entry_and_exit('widget loader'):\n" +" print('Some time consuming activity goes here')\n" +" load_widget()" +msgstr "" + +#: library/contextlib.rst:877 msgid "And also as a function decorator::" msgstr "" -#: library/contextlib.rst:880 +#: library/contextlib.rst:879 +msgid "" +"@track_entry_and_exit('widget loader')\n" +"def activity():\n" +" print('Some time consuming activity goes here')\n" +" load_widget()" +msgstr "" + +#: library/contextlib.rst:884 msgid "" "Note that there is one additional limitation when using context managers as " "function decorators: there's no way to access the return value of :meth:" @@ -740,21 +1202,21 @@ msgid "" "use an explicit ``with`` statement." msgstr "" -#: library/contextlib.rst:888 +#: library/contextlib.rst:891 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: library/contextlib.rst:888 +#: library/contextlib.rst:892 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: library/contextlib.rst:894 +#: library/contextlib.rst:898 msgid "Single use, reusable and reentrant context managers" msgstr "" -#: library/contextlib.rst:896 +#: library/contextlib.rst:900 msgid "" "Most context managers are written in a way that means they can only be used " "effectively in a :keyword:`with` statement once. These single use context " @@ -762,32 +1224,55 @@ msgid "" "them a second time will trigger an exception or otherwise not work correctly." msgstr "" -#: library/contextlib.rst:902 +#: library/contextlib.rst:906 msgid "" "This common limitation means that it is generally advisable to create " "context managers directly in the header of the :keyword:`with` statement " "where they are used (as shown in all of the usage examples above)." msgstr "" -#: library/contextlib.rst:906 +#: library/contextlib.rst:910 msgid "" "Files are an example of effectively single use context managers, since the " "first :keyword:`with` statement will close the file, preventing any further " "IO operations using that file object." msgstr "" -#: library/contextlib.rst:910 +#: library/contextlib.rst:914 msgid "" "Context managers created using :func:`contextmanager` are also single use " "context managers, and will complain about the underlying generator failing " "to yield if an attempt is made to use them a second time::" msgstr "" -#: library/contextlib.rst:938 +#: library/contextlib.rst:918 +msgid "" +">>> from contextlib import contextmanager\n" +">>> @contextmanager\n" +"... def singleuse():\n" +"... print(\"Before\")\n" +"... yield\n" +"... print(\"After\")\n" +"...\n" +">>> cm = singleuse()\n" +">>> with cm:\n" +"... pass\n" +"...\n" +"Before\n" +"After\n" +">>> with cm:\n" +"... pass\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"RuntimeError: generator didn't yield" +msgstr "" + +#: library/contextlib.rst:942 msgid "Reentrant context managers" msgstr "" -#: library/contextlib.rst:940 +#: library/contextlib.rst:944 msgid "" "More sophisticated context managers may be \"reentrant\". These context " "managers can not only be used in multiple :keyword:`with` statements, but " @@ -795,21 +1280,39 @@ msgid "" "the same context manager." msgstr "" -#: library/contextlib.rst:945 +#: library/contextlib.rst:949 msgid "" ":class:`threading.RLock` is an example of a reentrant context manager, as " "are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a " "very simple example of reentrant use::" msgstr "" -#: library/contextlib.rst:964 +#: library/contextlib.rst:953 +msgid "" +">>> from contextlib import redirect_stdout\n" +">>> from io import StringIO\n" +">>> stream = StringIO()\n" +">>> write_to_stream = redirect_stdout(stream)\n" +">>> with write_to_stream:\n" +"... print(\"This is written to the stream rather than stdout\")\n" +"... with write_to_stream:\n" +"... print(\"This is also written to the stream\")\n" +"...\n" +">>> print(\"This is written directly to stdout\")\n" +"This is written directly to stdout\n" +">>> print(stream.getvalue())\n" +"This is written to the stream rather than stdout\n" +"This is also written to the stream" +msgstr "" + +#: library/contextlib.rst:968 msgid "" "Real world examples of reentrancy are more likely to involve multiple " "functions calling each other and hence be far more complicated than this " "example." msgstr "" -#: library/contextlib.rst:968 +#: library/contextlib.rst:972 msgid "" "Note also that being reentrant is *not* the same thing as being thread " "safe. :func:`redirect_stdout`, for example, is definitely not thread safe, " @@ -817,11 +1320,11 @@ msgid "" "stdout` to a different stream." msgstr "" -#: library/contextlib.rst:977 +#: library/contextlib.rst:981 msgid "Reusable context managers" msgstr "" -#: library/contextlib.rst:979 +#: library/contextlib.rst:983 msgid "" "Distinct from both single use and reentrant context managers are " "\"reusable\" context managers (or, to be completely explicit, \"reusable, " @@ -831,21 +1334,50 @@ msgid "" "manager instance has already been used in a containing with statement." msgstr "" -#: library/contextlib.rst:986 +#: library/contextlib.rst:990 msgid "" ":class:`threading.Lock` is an example of a reusable, but not reentrant, " "context manager (for a reentrant lock, it is necessary to use :class:" "`threading.RLock` instead)." msgstr "" -#: library/contextlib.rst:990 +#: library/contextlib.rst:994 msgid "" "Another example of a reusable, but not reentrant, context manager is :class:" "`ExitStack`, as it invokes *all* currently registered callbacks when leaving " "any with statement, regardless of where those callbacks were added::" msgstr "" -#: library/contextlib.rst:1021 +#: library/contextlib.rst:999 +msgid "" +">>> from contextlib import ExitStack\n" +">>> stack = ExitStack()\n" +">>> with stack:\n" +"... stack.callback(print, \"Callback: from first context\")\n" +"... print(\"Leaving first context\")\n" +"...\n" +"Leaving first context\n" +"Callback: from first context\n" +">>> with stack:\n" +"... stack.callback(print, \"Callback: from second context\")\n" +"... print(\"Leaving second context\")\n" +"...\n" +"Leaving second context\n" +"Callback: from second context\n" +">>> with stack:\n" +"... stack.callback(print, \"Callback: from outer context\")\n" +"... with stack:\n" +"... stack.callback(print, \"Callback: from inner context\")\n" +"... print(\"Leaving inner context\")\n" +"... print(\"Leaving outer context\")\n" +"...\n" +"Leaving inner context\n" +"Callback: from inner context\n" +"Callback: from outer context\n" +"Leaving outer context" +msgstr "" + +#: library/contextlib.rst:1025 msgid "" "As the output from the example shows, reusing a single stack object across " "multiple with statements works correctly, but attempting to nest them will " @@ -853,8 +1385,24 @@ msgid "" "which is unlikely to be desirable behaviour." msgstr "" -#: library/contextlib.rst:1026 +#: library/contextlib.rst:1030 msgid "" "Using separate :class:`ExitStack` instances instead of reusing a single " "instance avoids that problem::" msgstr "" + +#: library/contextlib.rst:1033 +msgid "" +">>> from contextlib import ExitStack\n" +">>> with ExitStack() as outer_stack:\n" +"... outer_stack.callback(print, \"Callback: from outer context\")\n" +"... with ExitStack() as inner_stack:\n" +"... inner_stack.callback(print, \"Callback: from inner context\")\n" +"... print(\"Leaving inner context\")\n" +"... print(\"Leaving outer context\")\n" +"...\n" +"Leaving inner context\n" +"Callback: from inner context\n" +"Leaving outer context\n" +"Callback: from outer context" +msgstr "" diff --git a/library/contextvars.po b/library/contextvars.po index 2007ab1f..d30dbcb7 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/contextvars.rst:2 -msgid ":mod:`contextvars` --- Context Variables" +msgid ":mod:`!contextvars` --- Context Variables" msgstr "" #: library/contextvars.rst:11 @@ -32,7 +33,7 @@ msgstr "" #: library/contextvars.rst:17 msgid "" "Context managers that have state should use Context Variables instead of :" -"func:`threading.local()` to prevent their state from bleeding to other code " +"func:`threading.local` to prevent their state from bleeding to other code " "unexpectedly, when used in concurrent code." msgstr "" @@ -48,6 +49,10 @@ msgstr "" msgid "This class is used to declare a new Context Variable, e.g.::" msgstr "" +#: library/contextvars.rst:33 +msgid "var: ContextVar[int] = ContextVar('var', default=42)" +msgstr "" + #: library/contextvars.rst:35 msgid "" "The required *name* parameter is used for introspection and debug purposes." @@ -123,6 +128,18 @@ msgstr "" msgid "For example::" msgstr "" +#: library/contextvars.rst:87 +msgid "" +"var = ContextVar('var')\n" +"\n" +"token = var.set('new value')\n" +"# code that uses 'var'; var.get() returns 'new value'.\n" +"var.reset(token)\n" +"\n" +"# After the reset call the var has no value again, so\n" +"# var.get() would raise a LookupError." +msgstr "" + #: library/contextvars.rst:99 msgid "" "*Token* objects are returned by the :meth:`ContextVar.set` method. They can " @@ -130,137 +147,278 @@ msgid "" "variable to what it was before the corresponding *set*." msgstr "" -#: library/contextvars.rst:106 +#: library/contextvars.rst:104 +msgid "" +"The token supports :ref:`context manager protocol ` to " +"restore the corresponding context variable value at the exit from :keyword:" +"`with` block::" +msgstr "" + +#: library/contextvars.rst:108 +msgid "" +"var = ContextVar('var', default='default value')\n" +"\n" +"with var.set('new value'):\n" +" assert var.get() == 'new value'\n" +"\n" +"assert var.get() == 'default value'" +msgstr "" + +#: library/contextvars.rst:117 +msgid "Added support for usage as a context manager." +msgstr "" + +#: library/contextvars.rst:121 msgid "" "A read-only property. Points to the :class:`ContextVar` object that created " "the token." msgstr "" -#: library/contextvars.rst:111 +#: library/contextvars.rst:126 msgid "" "A read-only property. Set to the value the variable had before the :meth:" "`ContextVar.set` method call that created the token. It points to :attr:" "`Token.MISSING` if the variable was not set before the call." msgstr "" -#: library/contextvars.rst:118 +#: library/contextvars.rst:133 msgid "A marker object used by :attr:`Token.old_value`." msgstr "" -#: library/contextvars.rst:122 +#: library/contextvars.rst:137 msgid "Manual Context Management" msgstr "" -#: library/contextvars.rst:126 +#: library/contextvars.rst:141 msgid "Returns a copy of the current :class:`~contextvars.Context` object." msgstr "" -#: library/contextvars.rst:128 +#: library/contextvars.rst:143 msgid "" "The following snippet gets a copy of the current context and prints all " "variables and their values that are set in it::" msgstr "" -#: library/contextvars.rst:134 +#: library/contextvars.rst:146 +msgid "" +"ctx: Context = copy_context()\n" +"print(list(ctx.items()))" +msgstr "" + +#: library/contextvars.rst:149 msgid "" "The function has an *O*\\ (1) complexity, i.e. works equally fast for " "contexts with a few context variables and for contexts that have a lot of " "them." msgstr "" -#: library/contextvars.rst:141 +#: library/contextvars.rst:156 msgid "A mapping of :class:`ContextVars ` to their values." msgstr "" -#: library/contextvars.rst:143 +#: library/contextvars.rst:158 msgid "" "``Context()`` creates an empty context with no values in it. To get a copy " "of the current context use the :func:`~contextvars.copy_context` function." msgstr "" -#: library/contextvars.rst:147 +#: library/contextvars.rst:162 msgid "" -"Every thread will have a different top-level :class:`~contextvars.Context` " -"object. This means that a :class:`ContextVar` object behaves in a similar " -"fashion to :func:`threading.local()` when values are assigned in different " -"threads." +"Each thread has its own effective stack of :class:`!Context` objects. The :" +"term:`current context` is the :class:`!Context` object at the top of the " +"current thread's stack. All :class:`!Context` objects in the stacks are " +"considered to be *entered*." msgstr "" -#: library/contextvars.rst:152 -msgid "Context implements the :class:`collections.abc.Mapping` interface." +#: library/contextvars.rst:167 +msgid "" +"*Entering* a context, which can be done by calling its :meth:`~Context.run` " +"method, makes the context the current context by pushing it onto the top of " +"the current thread's context stack." msgstr "" -#: library/contextvars.rst:156 +#: library/contextvars.rst:171 msgid "" -"Execute ``callable(*args, **kwargs)`` code in the context object the *run* " -"method is called on. Return the result of the execution or propagate an " -"exception if one occurred." +"*Exiting* from the current context, which can be done by returning from the " +"callback passed to the :meth:`~Context.run` method, restores the current " +"context to what it was before the context was entered by popping the context " +"off the top of the context stack." msgstr "" -#: library/contextvars.rst:160 +#: library/contextvars.rst:176 msgid "" -"Any changes to any context variables that *callable* makes will be contained " -"in the context object::" +"Since each thread has its own context stack, :class:`ContextVar` objects " +"behave in a similar fashion to :func:`threading.local` when values are " +"assigned in different threads." msgstr "" -#: library/contextvars.rst:189 +#: library/contextvars.rst:180 msgid "" -"The method raises a :exc:`RuntimeError` when called on the same context " -"object from more than one OS thread, or when called recursively." +"Attempting to enter an already entered context, including contexts entered " +"in other threads, raises a :exc:`RuntimeError`." +msgstr "" + +#: library/contextvars.rst:183 +msgid "After exiting a context, it can later be re-entered (from any thread)." msgstr "" -#: library/contextvars.rst:195 +#: library/contextvars.rst:185 +msgid "" +"Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` " +"method are recorded in the current context. The :meth:`ContextVar.get` " +"method returns the value associated with the current context. Exiting a " +"context effectively reverts any changes made to context variables while the " +"context was entered (if needed, the values can be restored by re-entering " +"the context)." +msgstr "" + +#: library/contextvars.rst:192 +msgid "Context implements the :class:`collections.abc.Mapping` interface." +msgstr "" + +#: library/contextvars.rst:196 +msgid "" +"Enters the Context, executes ``callable(*args, **kwargs)``, then exits the " +"Context. Returns *callable*'s return value, or propagates an exception if " +"one occurred." +msgstr "" + +#: library/contextvars.rst:200 +msgid "Example:" +msgstr "" + +#: library/contextvars.rst:202 +msgid "" +"import contextvars\n" +"\n" +"var = contextvars.ContextVar('var')\n" +"var.set('spam')\n" +"print(var.get()) # 'spam'\n" +"\n" +"ctx = contextvars.copy_context()\n" +"\n" +"def main():\n" +" # 'var' was set to 'spam' before\n" +" # calling 'copy_context()' and 'ctx.run(main)', so:\n" +" print(var.get()) # 'spam'\n" +" print(ctx[var]) # 'spam'\n" +"\n" +" var.set('ham')\n" +"\n" +" # Now, after setting 'var' to 'ham':\n" +" print(var.get()) # 'ham'\n" +" print(ctx[var]) # 'ham'\n" +"\n" +"# Any changes that the 'main' function makes to 'var'\n" +"# will be contained in 'ctx'.\n" +"ctx.run(main)\n" +"\n" +"# The 'main()' function was run in the 'ctx' context,\n" +"# so changes to 'var' are contained in it:\n" +"print(ctx[var]) # 'ham'\n" +"\n" +"# However, outside of 'ctx', 'var' is still set to 'spam':\n" +"print(var.get()) # 'spam'" +msgstr "" + +#: library/contextvars.rst:248 msgid "Return a shallow copy of the context object." msgstr "" -#: library/contextvars.rst:199 +#: library/contextvars.rst:252 msgid "" "Return ``True`` if the *context* has a value for *var* set; return ``False`` " "otherwise." msgstr "" -#: library/contextvars.rst:204 +#: library/contextvars.rst:257 msgid "" "Return the value of the *var* :class:`ContextVar` variable. If the variable " "is not set in the context object, a :exc:`KeyError` is raised." msgstr "" -#: library/contextvars.rst:210 +#: library/contextvars.rst:263 msgid "" "Return the value for *var* if *var* has the value in the context object. " "Return *default* otherwise. If *default* is not given, return ``None``." msgstr "" -#: library/contextvars.rst:216 +#: library/contextvars.rst:269 msgid "Return an iterator over the variables stored in the context object." msgstr "" -#: library/contextvars.rst:221 +#: library/contextvars.rst:274 msgid "Return the number of variables set in the context object." msgstr "" -#: library/contextvars.rst:225 +#: library/contextvars.rst:278 msgid "Return a list of all variables in the context object." msgstr "" -#: library/contextvars.rst:229 +#: library/contextvars.rst:282 msgid "Return a list of all variables' values in the context object." msgstr "" -#: library/contextvars.rst:234 +#: library/contextvars.rst:287 msgid "" "Return a list of 2-tuples containing all variables and their values in the " "context object." msgstr "" -#: library/contextvars.rst:239 +#: library/contextvars.rst:292 msgid "asyncio support" msgstr "" -#: library/contextvars.rst:241 +#: library/contextvars.rst:294 msgid "" "Context variables are natively supported in :mod:`asyncio` and are ready to " "be used without any extra configuration. For example, here is a simple echo " "server, that uses a context variable to make the address of a remote client " "available in the Task that handles that client::" msgstr "" + +#: library/contextvars.rst:300 +msgid "" +"import asyncio\n" +"import contextvars\n" +"\n" +"client_addr_var = contextvars.ContextVar('client_addr')\n" +"\n" +"def render_goodbye():\n" +" # The address of the currently handled client can be accessed\n" +" # without passing it explicitly to this function.\n" +"\n" +" client_addr = client_addr_var.get()\n" +" return f'Good bye, client @ {client_addr}\\r\\n'.encode()\n" +"\n" +"async def handle_request(reader, writer):\n" +" addr = writer.transport.get_extra_info('socket').getpeername()\n" +" client_addr_var.set(addr)\n" +"\n" +" # In any code that we call is now possible to get\n" +" # client's address by calling 'client_addr_var.get()'.\n" +"\n" +" while True:\n" +" line = await reader.readline()\n" +" print(line)\n" +" if not line.strip():\n" +" break\n" +"\n" +" writer.write(b'HTTP/1.1 200 OK\\r\\n') # status line\n" +" writer.write(b'\\r\\n') # headers\n" +" writer.write(render_goodbye()) # body\n" +" writer.close()\n" +"\n" +"async def main():\n" +" srv = await asyncio.start_server(\n" +" handle_request, '127.0.0.1', 8081)\n" +"\n" +" async with srv:\n" +" await srv.serve_forever()\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# To test it you can use telnet or curl:\n" +"# telnet 127.0.0.1 8081\n" +"# curl 127.0.0.1:8081" +msgstr "" diff --git a/library/copy.po b/library/copy.po index f9085add..8598631c 100644 --- a/library/copy.po +++ b/library/copy.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/copy.rst:2 -msgid ":mod:`copy` --- Shallow and deep copy operations" +msgid ":mod:`!copy` --- Shallow and deep copy operations" msgstr "" #: library/copy.rst:7 @@ -38,71 +39,77 @@ msgid "Interface summary:" msgstr "" #: library/copy.rst:22 -msgid "Return a shallow copy of *x*." +msgid "Return a shallow copy of *obj*." msgstr "" #: library/copy.rst:27 -msgid "Return a deep copy of *x*." +msgid "Return a deep copy of *obj*." msgstr "" #: library/copy.rst:32 +msgid "" +"Creates a new object of the same type as *obj*, replacing fields with values " +"from *changes*." +msgstr "" + +#: library/copy.rst:40 msgid "Raised for module specific errors." msgstr "" -#: library/copy.rst:36 +#: library/copy.rst:44 msgid "" "The difference between shallow and deep copying is only relevant for " "compound objects (objects that contain other objects, like lists or class " "instances):" msgstr "" -#: library/copy.rst:39 +#: library/copy.rst:47 msgid "" "A *shallow copy* constructs a new compound object and then (to the extent " "possible) inserts *references* into it to the objects found in the original." msgstr "" -#: library/copy.rst:42 +#: library/copy.rst:50 msgid "" "A *deep copy* constructs a new compound object and then, recursively, " "inserts *copies* into it of the objects found in the original." msgstr "" -#: library/copy.rst:45 +#: library/copy.rst:53 msgid "" "Two problems often exist with deep copy operations that don't exist with " "shallow copy operations:" msgstr "" -#: library/copy.rst:48 +#: library/copy.rst:56 msgid "" "Recursive objects (compound objects that, directly or indirectly, contain a " "reference to themselves) may cause a recursive loop." msgstr "" -#: library/copy.rst:51 +#: library/copy.rst:59 msgid "" "Because deep copy copies everything it may copy too much, such as data which " "is intended to be shared between copies." msgstr "" -#: library/copy.rst:54 +#: library/copy.rst:62 msgid "The :func:`deepcopy` function avoids these problems by:" msgstr "" -#: library/copy.rst:56 +#: library/copy.rst:64 msgid "" "keeping a ``memo`` dictionary of objects already copied during the current " "copying pass; and" msgstr "" -#: library/copy.rst:59 +#: library/copy.rst:67 msgid "" "letting user-defined classes override the copying operation or the set of " "components copied." msgstr "" -#: library/copy.rst:62 +#: library/copy.rst:70 msgid "" "This module does not copy types like module, method, stack trace, stack " "frame, file, socket, window, or any similar types. It does \"copy\" " @@ -111,14 +118,14 @@ msgid "" "`pickle` module." msgstr "" -#: library/copy.rst:67 +#: library/copy.rst:75 msgid "" "Shallow copies of dictionaries can be made using :meth:`dict.copy`, and of " "lists by assigning a slice of the entire list, for example, ``copied_list = " "original_list[:]``." msgstr "" -#: library/copy.rst:73 +#: library/copy.rst:81 msgid "" "Classes can use the same interfaces to control copying that they use to " "control pickling. See the description of module :mod:`pickle` for " @@ -126,41 +133,67 @@ msgid "" "registered pickle functions from the :mod:`copyreg` module." msgstr "" -#: library/copy.rst:82 +#: library/copy.rst:92 msgid "" "In order for a class to define its own copy implementation, it can define " -"special methods :meth:`__copy__` and :meth:`__deepcopy__`. The former is " -"called to implement the shallow copy operation; no additional arguments are " -"passed. The latter is called to implement the deep copy operation; it is " -"passed one argument, the ``memo`` dictionary. If the :meth:`__deepcopy__` " -"implementation needs to make a deep copy of a component, it should call the :" -"func:`deepcopy` function with the component as first argument and the memo " -"dictionary as second argument. The memo dictionary should be treated as an " -"opaque object." +"special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`." msgstr "" -#: library/copy.rst:95 +#: library/copy.rst:98 +msgid "" +"Called to implement the shallow copy operation; no additional arguments are " +"passed." +msgstr "" + +#: library/copy.rst:104 +msgid "" +"Called to implement the deep copy operation; it is passed one argument, the " +"*memo* dictionary. If the ``__deepcopy__`` implementation needs to make a " +"deep copy of a component, it should call the :func:`~copy.deepcopy` function " +"with the component as first argument and the *memo* dictionary as second " +"argument. The *memo* dictionary should be treated as an opaque object." +msgstr "" + +#: library/copy.rst:114 +msgid "" +"Function :func:`!copy.replace` is more limited than :func:`~copy.copy` and :" +"func:`~copy.deepcopy`, and only supports named tuples created by :func:" +"`~collections.namedtuple`, :mod:`dataclasses`, and other classes which " +"define method :meth:`~object.__replace__`." +msgstr "" + +#: library/copy.rst:122 +msgid "" +"This method should create a new object of the same type, replacing fields " +"with values from *changes*." +msgstr "" + +#: library/copy.rst:130 msgid "Module :mod:`pickle`" msgstr "" -#: library/copy.rst:95 +#: library/copy.rst:131 msgid "" "Discussion of the special methods used to support object state retrieval and " "restoration." msgstr "" -#: library/copy.rst:71 +#: library/copy.rst:79 msgid "module" msgstr "" -#: library/copy.rst:71 +#: library/copy.rst:79 msgid "pickle" msgstr "" -#: library/copy.rst:78 +#: library/copy.rst:86 msgid "__copy__() (copy protocol)" msgstr "" -#: library/copy.rst:78 +#: library/copy.rst:86 msgid "__deepcopy__() (copy protocol)" msgstr "" + +#: library/copy.rst:111 +msgid "__replace__() (replace protocol)" +msgstr "" diff --git a/library/copyreg.po b/library/copyreg.po index d612616c..0ed8eb0e 100644 --- a/library/copyreg.po +++ b/library/copyreg.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/copyreg.rst:2 -msgid ":mod:`copyreg` --- Register :mod:`pickle` support functions" +msgid ":mod:`!copyreg` --- Register :mod:`!pickle` support functions" msgstr "" #: library/copyreg.rst:7 diff --git a/library/crypt.po b/library/crypt.po index 6f216e7e..247d2e39 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -8,214 +8,36 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/crypt.rst:2 -msgid ":mod:`crypt` --- Function to check Unix passwords" +msgid ":mod:`!crypt` --- Function to check Unix passwords" msgstr "" -#: library/crypt.rst:13 -msgid "**Source code:** :source:`Lib/crypt.py`" -msgstr "" - -#: library/crypt.rst:24 -msgid "" -"The :mod:`crypt` module is deprecated (see :pep:`PEP 594 <594#crypt>` for " -"details and alternatives). The :mod:`hashlib` module is a potential " -"replacement for certain use cases. The `passlib `_ package can replace all use cases of this module." -msgstr "" - -#: library/crypt.rst:27 -msgid "" -"This module implements an interface to the :manpage:`crypt(3)` routine, " -"which is a one-way hash function based upon a modified DES algorithm; see " -"the Unix man page for further details. Possible uses include storing hashed " -"passwords so you can check passwords without storing the actual password, or " -"attempting to crack Unix passwords with a dictionary." -msgstr "" - -#: library/crypt.rst:35 -msgid "" -"Notice that the behavior of this module depends on the actual " -"implementation of the :manpage:`crypt(3)` routine in the running system. " -"Therefore, any extensions available on the current implementation will also " -"be available on this module." -msgstr "" - -#: library/crypt.rst:40 -msgid ":ref:`Availability `: Unix, not VxWorks." -msgstr "" - -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" - -#: library/crypt.rst:45 -msgid "Hashing Methods" -msgstr "" - -#: library/crypt.rst:49 -msgid "" -"The :mod:`crypt` module defines the list of hashing methods (not all methods " -"are available on all platforms):" -msgstr "" - -#: library/crypt.rst:54 -msgid "" -"A Modular Crypt Format method with 16 character salt and 86 character hash " -"based on the SHA-512 hash function. This is the strongest method." -msgstr "" - -#: library/crypt.rst:59 -msgid "" -"Another Modular Crypt Format method with 16 character salt and 43 character " -"hash based on the SHA-256 hash function." -msgstr "" - -#: library/crypt.rst:64 -msgid "" -"Another Modular Crypt Format method with 22 character salt and 31 character " -"hash based on the Blowfish cipher." -msgstr "" - -#: library/crypt.rst:71 -msgid "" -"Another Modular Crypt Format method with 8 character salt and 22 character " -"hash based on the MD5 hash function." -msgstr "" - -#: library/crypt.rst:76 -msgid "" -"The traditional method with a 2 character salt and 13 characters of hash. " -"This is the weakest method." -msgstr "" - -#: library/crypt.rst:81 -msgid "Module Attributes" -msgstr "" - -#: library/crypt.rst:87 +#: library/crypt.rst:10 msgid "" -"A list of available password hashing algorithms, as ``crypt.METHOD_*`` " -"objects. This list is sorted from strongest to weakest." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/crypt.rst:93 -msgid "Module Functions" -msgstr "" - -#: library/crypt.rst:95 -msgid "The :mod:`crypt` module defines the following functions:" -msgstr "" - -#: library/crypt.rst:99 -msgid "" -"*word* will usually be a user's password as typed at a prompt or in a " -"graphical interface. The optional *salt* is either a string as returned " -"from :func:`mksalt`, one of the ``crypt.METHOD_*`` values (though not all " -"may be available on all platforms), or a full encrypted password including " -"salt, as returned by this function. If *salt* is not provided, the " -"strongest method available in :attr:`methods` will be used." -msgstr "" - -#: library/crypt.rst:106 -msgid "" -"Checking a password is usually done by passing the plain-text password as " -"*word* and the full results of a previous :func:`crypt` call, which should " -"be the same as the results of this call." -msgstr "" - -#: library/crypt.rst:110 -msgid "" -"*salt* (either a random 2 or 16 character string, possibly prefixed with " -"``$digit$`` to indicate the method) which will be used to perturb the " -"encryption algorithm. The characters in *salt* must be in the set ``[./a-zA-" -"Z0-9]``, with the exception of Modular Crypt Format which prefixes a " -"``$digit$``." -msgstr "" - -#: library/crypt.rst:116 -msgid "" -"Returns the hashed password as a string, which will be composed of " -"characters from the same alphabet as the salt." -msgstr "" - -#: library/crypt.rst:121 -msgid "" -"Since a few :manpage:`crypt(3)` extensions allow different values, with " -"different sizes in the *salt*, it is recommended to use the full crypted " -"password as salt when checking for a password." -msgstr "" - -#: library/crypt.rst:125 -msgid "Accept ``crypt.METHOD_*`` values in addition to strings for *salt*." -msgstr "" - -#: library/crypt.rst:131 -msgid "" -"Return a randomly generated salt of the specified method. If no *method* is " -"given, the strongest method available in :attr:`methods` is used." -msgstr "" - -#: library/crypt.rst:135 -msgid "" -"The return value is a string suitable for passing as the *salt* argument to :" -"func:`crypt`." -msgstr "" - -#: library/crypt.rst:138 -msgid "" -"*rounds* specifies the number of rounds for ``METHOD_SHA256``, " -"``METHOD_SHA512`` and ``METHOD_BLOWFISH``. For ``METHOD_SHA256`` and " -"``METHOD_SHA512`` it must be an integer between ``1000`` and " -"``999_999_999``, the default is ``5000``. For ``METHOD_BLOWFISH`` it must " -"be a power of two between ``16`` (2\\ :sup:`4`) and ``2_147_483_648`` (2\\ :" -"sup:`31`), the default is ``4096`` (2\\ :sup:`12`)." -msgstr "" - -#: library/crypt.rst:148 -msgid "Added the *rounds* parameter." -msgstr "" - -#: library/crypt.rst:153 -msgid "Examples" -msgstr "" - -#: library/crypt.rst:155 +#: library/crypt.rst:14 msgid "" -"A simple example illustrating typical use (a constant-time comparison " -"operation is needed to limit exposure to timing attacks. :func:`hmac." -"compare_digest` is suitable for this purpose)::" +"Applications can use the :mod:`hashlib` module from the standard library. " +"Other possible replacements are third-party libraries from PyPI: :pypi:" +"`legacycrypt`, :pypi:`bcrypt`, or :pypi:`argon2-cffi`. These are not " +"supported or maintained by the Python core team." msgstr "" -#: library/crypt.rst:175 +#: library/crypt.rst:19 msgid "" -"To generate a hash of a password using the strongest available method and " -"check it against the original::" -msgstr "" - -#: library/crypt.rst:33 library/crypt.rst:119 -msgid "crypt(3)" -msgstr "" - -#: library/crypt.rst:15 -msgid "cipher" -msgstr "" - -#: library/crypt.rst:15 -msgid "DES" +"The last version of Python that provided the :mod:`!crypt` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/crypto.po b/library/crypto.po index ce956935..63b8e6e3 100644 --- a/library/crypto.po +++ b/library/crypto.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -24,8 +25,7 @@ msgstr "" msgid "" "The modules described in this chapter implement various algorithms of a " "cryptographic nature. They are available at the discretion of the " -"installation. On Unix systems, the :mod:`crypt` module may also be " -"available. Here's an overview:" +"installation. Here's an overview:" msgstr "" #: library/crypto.rst:7 diff --git a/library/csv.po b/library/csv.po index 3f1f9816..81c660ac 100644 --- a/library/csv.po +++ b/library/csv.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-07-27 17:28+0300\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/csv.rst:2 -msgid ":mod:`csv` --- CSV File Reading and Writing" -msgstr "" +msgid ":mod:`!csv` --- CSV File Reading and Writing" +msgstr ":mod:`!csv` --- Ανάγνωση και Εγγραφή Αρχείων CSV" #: library/csv.rst:9 msgid "**Source code:** :source:`Lib/csv.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/csv.py`" #: library/csv.rst:17 msgid "" @@ -37,6 +38,18 @@ msgid "" "single module which can efficiently manipulate such data, hiding the details " "of reading and writing the data from the programmer." msgstr "" +"Το λεγόμενο CSV (Comma Separated Values) είναι η πιο κοινή μορφή εισαγωγής " +"και εξαγωγής για υπολογιστικά φύλλα και βάσεις δεδομένων. Η μορφή CSV " +"χρησιμοποιήθηκε για πολλά χρόνια πριν από τις προσπάθειες περιγραφής της " +"μορφής με έναν τυποποιημένο τρόπο στο :rfc:`4180`. Η έλλειψη ενός καλά " +"καθορισμένου προτύπου σημαίνει ότι συχνά υπάρχουν λεπτές διαφορές στα " +"δεδομένα που παράγονται και καταναλώνονται από διαφορετικές εφαρμογές. Αυτές " +"οι διαφορές μπορούν να κάνουν ενοχλητική την επεξεργασία αρχείων CSV από " +"πολλαπλές πηγές. Ωστόσο, ενώ οι διαχωριστές και οι χαρακτήρες παράθεσης " +"ποικίλλουν, η συνολική μορφή είναι αρκετά παρόμοια ώστε να είναι δυνατό να " +"γραφτεί ένα ενιαίο module που μπορεί να χειριστεί αποτελεσματικά αυτά τα " +"δεδομένα, κρύβοντας τις λεπτομέρειες της ανάγνωσης και εγγραφής των " +"δεδομένων από τον προγραμματιστή." #: library/csv.rst:28 msgid "" @@ -47,6 +60,14 @@ msgid "" "Excel. Programmers can also describe the CSV formats understood by other " "applications or define their own special-purpose CSV formats." msgstr "" +"Το module :mod:`csv` υλοποιεί κλάσεις για την ανάγνωση και εγγραφή δομημένων " +"δεδομένων σε μορφή CSV. Επιτρέπει στους προγραμματιστές να δηλώνουν, \"γράψε " +"αυτά τα δεδομένα στη μορφή που προτιμάται το Excel,\" ή \"διάβασε δεδομένα " +"από αυτό το αρχείο που δημιουργήθηκε από το Excel,\" χωρίς να γνωρίζουν τις " +"ακριβείς λεπτομέρειες της μορφής CSV που χρησιμοποιείται από το Excel. Οι " +"προγραμματιστές μπορούν επίσης να περιγράψουν τις μορφές CSV που " +"κατανοούνται από άλλες εφαρμογές ή να ορίσουν τις δικές τους ειδικές μορφές " +"CSV." #: library/csv.rst:35 msgid "" @@ -54,22 +75,27 @@ msgid "" "write sequences. Programmers can also read and write data in dictionary " "form using the :class:`DictReader` and :class:`DictWriter` classes." msgstr "" +"Τα αντικείμενα :class:`reader` και :class:`writer` του module :mod:`csv` " +"διαβάζουν και γράφουν ακολουθίες. Οι προγραμματιστές μπορούν επίσης να " +"διαβάσουν και να γράψουν δεδομένα σε μορφή λεξικού χρησιμοποιώντας τις " +"κλάσεις :class:`DictReader` και :class:`DictWriter`." #: library/csv.rst:41 msgid ":pep:`305` - CSV File API" -msgstr "" +msgstr ":pep:`305` - API Αρχείων CSV" #: library/csv.rst:42 msgid "The Python Enhancement Proposal which proposed this addition to Python." msgstr "" +"Η Πρόταση Βελτίωσης της Python που πρότεινε αυτή την προσθήκη στην Python." #: library/csv.rst:48 msgid "Module Contents" -msgstr "" +msgstr "Περιεχόμενα του Module" #: library/csv.rst:50 msgid "The :mod:`csv` module defines the following functions:" -msgstr "" +msgstr "Το module :mod:`csv` ορίζει τις παρακάτω συναρτήσεις:" #: library/csv.rst:58 msgid "" @@ -85,18 +111,54 @@ msgid "" "parameters in the current dialect. For full details about the dialect and " "formatting parameters, see section :ref:`csv-fmt-params`." msgstr "" +"Επιστρέφει ένα αντικείμενο :ref:`reader ` που θα " +"επεξεργάζεται γραμμές από το δεδομένο *csvfile*. Ένα csvfile πρέπει να είναι " +"μια ακολουθία από συμβολοσειρές, κάθε μια στη μορφή CSV που ορίζει ο " +"αναγνώστης. Ένα csvfile είναι πιο συχνά ένα αντικείμενο παρόμοιο με αρχείο ή " +"μια λίστα. Αν το *csvfile* είναι ένα αντικείμενο αρχείου, θα πρέπει να " +"ανοιχτεί με ``newline=''``. [1]_ Μια προαιρετική παράμετρος *dialect* μπορεί " +"να δοθεί η οποία χρησιμοποιείται για τον ορισμό ενός συνόλου παραμέτρων " +"ειδικών για μια συγκεκριμένη διάλεκτο CSV. Μπορεί να είναι ένα στιγμιότυπο " +"μιας υποκλάσης της κλάσης :class:`Dialect` ή μια από τις συμβολοσειρές που " +"επιστρέφει η συνάρτηση :func:`list_dialects`. Οι άλλες προαιρετικές " +"παράμετροι *fmtparams* μπορούν να δοθούν για να αντικαταστήσουν μεμονωμένες " +"παραμέτρους μορφοποίησης στην τρέχουσα διάλεκτο. Για πλήρεις λεπτομέρειες " +"σχετικά με τις διαλέκτους και τις παραμέτρους μορφοποίησης, δείτε την " +"ενότητα :ref:`csv-fmt-params`." #: library/csv.rst:72 msgid "" "Each row read from the csv file is returned as a list of strings. No " -"automatic data type conversion is performed unless the ``QUOTE_NONNUMERIC`` " -"format option is specified (in which case unquoted fields are transformed " -"into floats)." +"automatic data type conversion is performed unless the :data:" +"`QUOTE_NONNUMERIC` format option is specified (in which case unquoted fields " +"are transformed into floats)." msgstr "" +"Κάθε γραμμή που διαβάζεται από το αρχείο csv επιστρέφεται ως μια λίστα " +"συμβολοσειρών. Δεν γίνεται αυτόματη μετατροπή τύπων δεδομένων εκτός αν " +"οριστεί η επιλογή μορφοποίησης :data:`QUOTE_NONNUMERIC` (στην οποία " +"περίπτωση τα μη παρατεθειμένα πεδία μετατρέπονται σε float)." -#: library/csv.rst:106 library/csv.rst:217 +#: library/csv.rst:106 library/csv.rst:220 msgid "A short usage example::" -msgstr "" +msgstr "Ένα σύντομο παράδειγμα χρήσης::" + +#: library/csv.rst:78 +msgid "" +">>> import csv\n" +">>> with open('eggs.csv', newline='') as csvfile:\n" +"... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')\n" +"... for row in spamreader:\n" +"... print(', '.join(row))\n" +"Spam, Spam, Spam, Spam, Spam, Baked Beans\n" +"Spam, Lovely Spam, Wonderful Spam" +msgstr "" +">>> import csv\n" +">>> with open('eggs.csv', newline='') as csvfile:\n" +"... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')\n" +"... for row in spamreader:\n" +"... print(', '.join(row))\n" +"Spam, Spam, Spam, Spam, Spam, Baked Beans\n" +"Spam, Lovely Spam, Wonderful Spam" #: library/csv.rst:89 msgid "" @@ -117,6 +179,41 @@ msgid "" "without preprocessing the data returned from a ``cursor.fetch*`` call. All " "other non-string data are stringified with :func:`str` before being written." msgstr "" +"Επιστρέφει ένα αντικείμενο writer υπεύθυνο για τη μετατροπή των δεδομένων " +"του χρήστη σε διαχωρισμένες συμβολοσειρές στο δεδομένο αντικείμενο παρόμοιο " +"με αρχείο. Το *csvfile* μπορεί να είναι οποιοδήποτε αντικείμενο με μια " +"μέθοδο :meth:`~io.TextIOBase.write`. Αν το *csvfile* είναι ένα αντικείμενο " +"αρχείου, θα πρέπει να ανοιχτεί με ``newline=''`` [1]_. Μια προαιρετική " +"παράμετρος *dialect* μπορεί να δοθεί η οποία χρησιμοποιείται για τον ορισμό " +"ενός συνόλου παραμέτρων ειδικών για μια συγκεκριμένη διάλεκτο CSV. Μπορεί να " +"είναι ένα στιγμιότυπο μιας υποκλάσης της κλάσης :class:`Dialect` ή μια από " +"τις συμβολοσειρές που επιστρέφει η συνάρτηση :func:`list_dialects`. Οι άλλες " +"προαιρετικές παράμετροι *fmtparams* μπορούν να δοθούν για να αντικαταστήσουν " +"μεμονωμένες παραμέτρους μορφοποίησης στην τρέχουσα διάλεκτο. Για πλήρεις " +"λεπτομέρειες σχετικά με τις διαλέκτους και τις παραμέτρους μορφοποίησης, " +"δείτε την ενότητα :ref:`csv-fmt-params`. Για να διευκολυνθεί όσο το δυνατόν " +"περισσότερο η διασύνδεση με modules που υλοποιούν το DB API, η τιμή :const:" +"`None` γράφεται ως η κενή συμβολοσειρά. Ενώ αυτή δεν είναι μια αντιστρέψιμη " +"μετατροπή, διευκολύνει την εξαγωγή τιμών NULL SQL σε αρχεία CSV χωρίς " +"προεπεξεργασία των δεδομένων που επιστρέφονται από μια κλήση `cursor." +"fetch*`. Όλα τα άλλα μη-συμβολοσειριακά δεδομένα μετατρέπονται σε " +"συμβολοσειρές με τη χρήση της :func:`str` πριν γραφούν." + +#: library/csv.rst:108 +msgid "" +"import csv\n" +"with open('eggs.csv', 'w', newline='') as csvfile:\n" +" spamwriter = csv.writer(csvfile, delimiter=' ',\n" +" quotechar='|', quoting=csv.QUOTE_MINIMAL)\n" +" spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])\n" +" spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])" +msgstr "" +"import csv\n" +"with open('eggs.csv', 'w', newline='') as csvfile:\n" +" spamwriter = csv.writer(csvfile, delimiter=' ',\n" +" quotechar='|', quoting=csv.QUOTE_MINIMAL)\n" +" spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])\n" +" spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])" #: library/csv.rst:118 msgid "" @@ -126,12 +223,21 @@ msgid "" "parameters of the dialect. For full details about dialects and formatting " "parameters, see section :ref:`csv-fmt-params`." msgstr "" +"Συσχετίζει το *dialect* με το *name*. Το *name* πρέπει να είναι μια " +"συμβολοσειρά. Η διάλεκτος μπορεί να καθοριστεί είτε περνώντας μια υποκλάση " +"της :class:`Dialect`, είτε με παραμέτρους *fmtparams* ως ορίσματα, είτε και " +"τα δύο, με τις παραμέτρους *fmtparams* να αντικαθιστούν τις παραμέτρους της " +"διαλέκτου. Για πλήρεις λεπτομέρειες σχετικά με τις διαλέκτους και τις " +"παραμέτρους μορφοποίησης, δείτε την ενότητα :ref:`csv-fmt-params`." #: library/csv.rst:127 msgid "" "Delete the dialect associated with *name* from the dialect registry. An :" "exc:`Error` is raised if *name* is not a registered dialect name." msgstr "" +"Διαγράφει τη διάλεκτο που συσχετίζεται με το *name* από το μητρώο διαλέκτων. " +"Μια :exc:`Error` γίνεται raise αν το *name* δεν είναι ένα καταχωρημένο όνομα " +"διαλέκτου." #: library/csv.rst:133 msgid "" @@ -139,37 +245,53 @@ msgid "" "*name* is not a registered dialect name. This function returns an " "immutable :class:`Dialect`." msgstr "" +"Επιστρέφει τη διάλεκτο που συσχετίζεται με το *name*. Μια :exc:`Error` " +"γίνεται raise αν το *name* δεν είναι ένα καταχωρημένο όνομα διαλέκτου. Αυτή " +"η συνάρτηση επιστρέφει μια αμετάβλητη :class:`Dialect`." #: library/csv.rst:139 msgid "Return the names of all registered dialects." -msgstr "" +msgstr "Επιστρέφει τα ονόματα όλων των καταχωρημένων διαλέκτων." -#: library/csv.rst:144 +#: library/csv.rst:145 msgid "" "Returns the current maximum field size allowed by the parser. If *new_limit* " "is given, this becomes the new limit." msgstr "" +"Επιστρέφει το τρέχον μέγιστο μέγεθος πεδίου που επιτρέπεται από τον αναλυτή. " +"Αν δοθεί *new_limit*, αυτό γίνεται το νέο όριο." -#: library/csv.rst:148 +#: library/csv.rst:149 msgid "The :mod:`csv` module defines the following classes:" -msgstr "" +msgstr "Το module :mod:`csv` ορίζει τις παρακάτω κλάσεις:" -#: library/csv.rst:153 +#: library/csv.rst:154 msgid "" "Create an object that operates like a regular reader but maps the " "information in each row to a :class:`dict` whose keys are given by the " "optional *fieldnames* parameter." msgstr "" +"Δημιουργεί ένα αντικείμενο που λειτουργεί όπως ένας κανονικός αναγνώστης " +"αλλά χαρτογραφεί τις πληροφορίες σε κάθε γραμμή σε ένα :class:`dict` των " +"οποίων τα κλειδιά δίνονται από την προαιρετική παράμετρο *fieldnames*." -#: library/csv.rst:157 +#: library/csv.rst:158 msgid "" "The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is " "omitted, the values in the first row of file *f* will be used as the " -"fieldnames. Regardless of how the fieldnames are determined, the dictionary " +"fieldnames and will be omitted from the results. If *fieldnames* is " +"provided, they will be used and the first row will be included in the " +"results. Regardless of how the fieldnames are determined, the dictionary " "preserves their original ordering." msgstr "" +"Η παράμετρος *fieldnames* είναι μια :term:`sequence`. Αν το *fieldnames* " +"έχει παραληφθεί, οι τιμές στην πρώτη γραμμή του αρχείου *f* θα " +"χρησιμοποιηθούν ως τα ονόματα πεδίων και θα παραλειφθούν από τα " +"αποτελέσματα. Αν το *fieldnames* παρέχεται, θα χρησιμοποιηθούν και η πρώτη " +"γραμμή θα περιληφθεί στα αποτελέσματα. Ανεξάρτητα από το πώς καθορίζονται τα " +"ονόματα πεδίων, το λεξικό διατηρεί την αρχική τους σειρά." -#: library/csv.rst:162 +#: library/csv.rst:165 msgid "" "If a row has more fields than fieldnames, the remaining data is put in a " "list and stored with the fieldname specified by *restkey* (which defaults to " @@ -177,28 +299,64 @@ msgid "" "values are filled-in with the value of *restval* (which defaults to " "``None``)." msgstr "" +"Αν μια γραμμή έχει περισσότερα πεδία από τα ονόματα πεδίων, τα υπόλοιπα " +"δεδομένα τοποθετούνται σε μια λίστα και αποθηκεύονται με το όνομα πεδίου που " +"καθορίζεται από το *restkey* (το οποίο προεπιλέγεται σε ``None``). Αν μια μη-" +"κενή γραμμή έχει λιγότερα πεδία από τα ονόματα πεδίων, οι ελλείπουσες τιμές " +"συμπληρώνονται με την τιμή του *restval* (το οποίο προεπιλέγεται σε " +"``None``)." -#: library/csv.rst:168 +#: library/csv.rst:171 msgid "" "All other optional or keyword arguments are passed to the underlying :class:" "`reader` instance." msgstr "" +"Όλες οι άλλες προαιρετικές ή παράμετροι λέξεων-κλειδιών μεταβιβάζονται στο " +"υποκείμενο αντικείμενο :class:`reader`." -#: library/csv.rst:215 +#: library/csv.rst:218 msgid "" "If the argument passed to *fieldnames* is an iterator, it will be coerced to " "a :class:`list`." msgstr "" +"Αν το όρισμα που δίνεται στο *fieldnames* είναι ένας iterator, θα μετατραπεί " +"σε μια :class:`list`." -#: library/csv.rst:173 +#: library/csv.rst:176 msgid "Returned rows are now of type :class:`OrderedDict`." -msgstr "" +msgstr "Οι επιστρεφόμενες γραμμές είναι τώρα τύπου :class:`OrderedDict`." -#: library/csv.rst:176 +#: library/csv.rst:179 msgid "Returned rows are now of type :class:`dict`." -msgstr "" +msgstr "Οι επιστρεφόμενες γραμμές είναι τώρα τύπου :class:`dict`." -#: library/csv.rst:197 +#: library/csv.rst:184 +msgid "" +">>> import csv\n" +">>> with open('names.csv', newline='') as csvfile:\n" +"... reader = csv.DictReader(csvfile)\n" +"... for row in reader:\n" +"... print(row['first_name'], row['last_name'])\n" +"...\n" +"Eric Idle\n" +"John Cleese\n" +"\n" +">>> print(row)\n" +"{'first_name': 'John', 'last_name': 'Cleese'}" +msgstr "" +">>> import csv\n" +">>> with open('names.csv', newline='') as csvfile:\n" +"... reader = csv.DictReader(csvfile)\n" +"... for row in reader:\n" +"... print(row['first_name'], row['last_name'])\n" +"...\n" +"Eric Idle\n" +"John Cleese\n" +"\n" +">>> print(row)\n" +"{'first_name': 'John', 'last_name': 'Cleese'}" + +#: library/csv.rst:200 msgid "" "Create an object which operates like a regular writer but maps dictionaries " "onto output rows. The *fieldnames* parameter is a :mod:`sequence " @@ -213,14 +371,53 @@ msgid "" "dictionary are ignored. Any other optional or keyword arguments are passed " "to the underlying :class:`writer` instance." msgstr "" +"Δημιουργεί ένα αντικείμενο που λειτουργεί όπως ένας κανονικός εγγραφέας αλλά " +"χαρτογραφεί λεξικά σε εξαγόμενες γραμμές. Η παράμετρος *fieldnames* είναι " +"μια :mod:`sequence ` κλειδιών που προσδιορίζουν τη σειρά " +"στην οποία οι τιμές στο λεξικό που περνιούνται στη μέθοδο :meth:`~csvwriter." +"writerow` γράφονται στο αρχείο *f*. Η προαιρετική παράμετρος *restval* " +"καθορίζει την τιμή που θα γραφτεί αν από το λεξικό λείπει ένα κλειδί στα " +"*fieldnames*. Αν το λεξικό που περνιέται στη μέθοδο :meth:`~csvwriter." +"writerow` περιέχει ένα κλειδί που δεν βρίσκεται στα *fieldnames*, η " +"προαιρετική παράμετρος *extrasaction* υποδεικνύει ποια ενέργεια να ληφθεί. " +"Αν οριστεί σε ``'raise'``, η προεπιλεγμένη τιμή, γίνεται raise μια :exc:" +"`ValueError`. Αν οριστεί σε ``'ignore'``, οι επιπλέον τιμές στο λεξικό " +"αγνοούνται. Οποιεσδήποτε άλλες προαιρετικές ή παράμετροι λέξεων-κλειδιών " +"μεταβιβάζονται στο υποκείμενο αντικείμενο :class:`writer`." -#: library/csv.rst:212 +#: library/csv.rst:215 msgid "" "Note that unlike the :class:`DictReader` class, the *fieldnames* parameter " "of the :class:`DictWriter` class is not optional." msgstr "" +"Σημειώστε ότι σε αντίθεση με την κλάση :class:`DictReader`, η παράμετρος " +"`*fieldnames*` της κλάσης :class:`DictWriter` δεν είναι προαιρετική." -#: library/csv.rst:233 +#: library/csv.rst:222 +msgid "" +"import csv\n" +"\n" +"with open('names.csv', 'w', newline='') as csvfile:\n" +" fieldnames = ['first_name', 'last_name']\n" +" writer = csv.DictWriter(csvfile, fieldnames=fieldnames)\n" +"\n" +" writer.writeheader()\n" +" writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})\n" +" writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" +" writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" +msgstr "" +"import csv\n" +"\n" +"with open('names.csv', 'w', newline='') as csvfile:\n" +" fieldnames = ['first_name', 'last_name']\n" +" writer = csv.DictWriter(csvfile, fieldnames=fieldnames)\n" +"\n" +" writer.writeheader()\n" +" writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})\n" +" writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" +" writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" + +#: library/csv.rst:236 msgid "" "The :class:`Dialect` class is a container class whose attributes contain " "information for how to handle doublequotes, whitespace, delimiters, etc. Due " @@ -228,161 +425,270 @@ msgid "" "subtly different CSV data. :class:`Dialect` instances define how :class:" "`reader` and :class:`writer` instances behave." msgstr "" +"Η κλάση :class:`Dialect` είναι μια κλάση κοντέινερ των οποίων τα " +"χαρακτηριστικά περιέχουν πληροφορίες για το πώς να χειριστούν τα διπλά " +"εισαγωγικά, τα κενά, τους διαχωριστές κ.λπ. Λόγω της έλλειψης αυστηρής " +"προδιαγραφής CSV, διαφορετικές εφαρμογές παράγουν λεπτές διαφορές στα " +"δεδομένα CSV. Τα στιγμιότυπα της :class:`Dialect` καθορίζουν πώς " +"συμπεριφέρονται τα αντικείμενα :class:`reader` και :class:`writer`." -#: library/csv.rst:239 +#: library/csv.rst:242 msgid "" "All available :class:`Dialect` names are returned by :func:`list_dialects`, " "and they can be registered with specific :class:`reader` and :class:`writer` " "classes through their initializer (``__init__``) functions like this::" msgstr "" +"Όλα τα διαθέσιμα ονόματα :class:`Dialect` επιστρέφονται από τη :func:" +"`list_dialects`, και μπορούν να καταχωρηθούν με συγκεκριμένες κλάσεις :class:" +"`reader` και :class:`writer` μέσω των συναρτήσεων αρχικοποίησης " +"(``__init__``) τους όπως αυτό::" + +#: library/csv.rst:246 +msgid "" +"import csv\n" +"\n" +"with open('students.csv', 'w', newline='') as csvfile:\n" +" writer = csv.writer(csvfile, dialect='unix')" +msgstr "" +"import csv\n" +"\n" +"with open('students.csv', 'w', newline='') as csvfile:\n" +" writer = csv.writer(csvfile, dialect='unix')" -#: library/csv.rst:251 +#: library/csv.rst:254 msgid "" "The :class:`excel` class defines the usual properties of an Excel-generated " "CSV file. It is registered with the dialect name ``'excel'``." msgstr "" +"Η κλάση :class:`excel` ορίζει τις συνήθεις ιδιότητες ενός αρχείου CSV που " +"δημιουργείται από το Excel. Είναι καταχωρημένη με το όνομα διαλέκτου " +"``'excel'``." -#: library/csv.rst:257 +#: library/csv.rst:260 msgid "" "The :class:`excel_tab` class defines the usual properties of an Excel-" "generated TAB-delimited file. It is registered with the dialect name " "``'excel-tab'``." msgstr "" +"Η κλάση :class:`excel_tab` ορίζει τις συνήθεις ιδιότητες ενός αρχείου CSV " +"που δημιουργείται από το Excel με διαχωριστικό TAB. Είναι καταχωρημένη με το " +"όνομα διαλέκτου ``'excel-tab'``." -#: library/csv.rst:263 +#: library/csv.rst:266 msgid "" "The :class:`unix_dialect` class defines the usual properties of a CSV file " "generated on UNIX systems, i.e. using ``'\\n'`` as line terminator and " "quoting all fields. It is registered with the dialect name ``'unix'``." msgstr "" +"Η κλάση :class:`unix_dialect` ορίζει τις συνήθεις ιδιότητες ενός αρχείου CSV " +"που δημιουργείται σε συστήματα UNIX, δηλαδή χρησιμοποιεί ``'\\n'`` ως " +"τερματιστή γραμμής και παραθέτει όλα τα πεδία. Είναι καταχωρημένη με το " +"όνομα διαλέκτου ``'unix'``." -#: library/csv.rst:272 +#: library/csv.rst:275 msgid "The :class:`Sniffer` class is used to deduce the format of a CSV file." msgstr "" +"Η κλάση :class:`Sniffer` χρησιμοποιείται για να προσδιορίσει τη μορφή ενός " +"αρχείου CSV." -#: library/csv.rst:274 +#: library/csv.rst:277 msgid "The :class:`Sniffer` class provides two methods:" -msgstr "" +msgstr "Η κλάση :class:`Sniffer` παρέχει δύο μεθόδους:" -#: library/csv.rst:278 +#: library/csv.rst:281 msgid "" "Analyze the given *sample* and return a :class:`Dialect` subclass reflecting " "the parameters found. If the optional *delimiters* parameter is given, it " "is interpreted as a string containing possible valid delimiter characters." msgstr "" +"Αναλύει το δεδομένο *sample* και επιστρέφει μια υποκλάση της :class:" +"`Dialect` που αντικατοπτρίζει τις παραμέτρους που βρέθηκαν. Αν η προαιρετική " +"παράμετρος *delimiters* δοθεί, ερμηνεύεται ως μια συμβολοσειρά που περιέχει " +"πιθανά έγκυρους χαρακτήρες διαχωρισμού." -#: library/csv.rst:286 +#: library/csv.rst:289 msgid "" "Analyze the sample text (presumed to be in CSV format) and return :const:" "`True` if the first row appears to be a series of column headers. Inspecting " "each column, one of two key criteria will be considered to estimate if the " "sample contains a header:" msgstr "" +"Αναλύει το δείγμα κειμένου (που θεωρείται ότι είναι σε μορφή CSV) και " +"επιστρέφει :const:`True` αν η πρώτη γραμμή φαίνεται να είναι μια σειρά " +"κεφαλίδων στηλών. Εξετάζοντας κάθε στήλη, ένα από τα δύο βασικά κριτήρια θα " +"εξεταστεί για να εκτιμηθεί αν το δείγμα περιέχει κεφαλίδα:" -#: library/csv.rst:291 +#: library/csv.rst:294 msgid "the second through n-th rows contain numeric values" -msgstr "" +msgstr "η δεύτερη έως την n-οστή γραμμή περιέχει αριθμητικές τιμές" -#: library/csv.rst:292 +#: library/csv.rst:295 msgid "" "the second through n-th rows contain strings where at least one value's " "length differs from that of the putative header of that column." msgstr "" +"η δεύτερη έως την n-οστή γραμμή περιέχει συμβολοσειρές όπου τουλάχιστον μία " +"τιμή έχει μήκος διαφορετικό από αυτό της υποτιθέμενης κεφαλίδας αυτής της " +"στήλης." -#: library/csv.rst:295 +#: library/csv.rst:298 msgid "" -"Twenty rows after the first row are sampled; if more than half of columns + " -"rows meet the criteria, :const:`True` is returned." +"Twenty-one rows after the header are sampled; if more than half of the " +"columns + rows meet the criteria, :const:`True` is returned." msgstr "" +"Είκοσι μία γραμμές μετά την κεφαλίδα δειγματοληπτούνται· αν περισσότερες από " +"τις μισές στήλες + γραμμές πληρούν τα κριτήρια, επιστρέφεται :const:`True`." -#: library/csv.rst:300 +#: library/csv.rst:303 msgid "" "This method is a rough heuristic and may produce both false positives and " "negatives." msgstr "" +"Αυτή η μέθοδος είναι μια χονδροειδής ευρετική και μπορεί να παράγει τόσο " +"ψευδώς θετικά όσο και ψευδώς αρνητικά αποτελέσματα." -#: library/csv.rst:303 +#: library/csv.rst:306 msgid "An example for :class:`Sniffer` use::" -msgstr "" +msgstr "Ένα παράδειγμα χρήσης της :class:`Sniffer`::" -#: library/csv.rst:314 +#: library/csv.rst:308 +msgid "" +"with open('example.csv', newline='') as csvfile:\n" +" dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" +" csvfile.seek(0)\n" +" reader = csv.reader(csvfile, dialect)\n" +" # ... process CSV file contents here ..." +msgstr "" +"with open('example.csv', newline='') as csvfile:\n" +" dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" +" csvfile.seek(0)\n" +" reader = csv.reader(csvfile, dialect)\n" +" # ... process CSV file contents here ..." + +#: library/csv.rst:317 msgid "The :mod:`csv` module defines the following constants:" -msgstr "" +msgstr "Το module :mod:`csv` ορίζει τις παρακάτω σταθερές:" -#: library/csv.rst:318 +#: library/csv.rst:321 msgid "Instructs :class:`writer` objects to quote all fields." -msgstr "" +msgstr "Οδηγεί τα αντικείμενα :class:`writer` να παραθέτουν όλα τα πεδία." -#: library/csv.rst:323 +#: library/csv.rst:326 msgid "" "Instructs :class:`writer` objects to only quote those fields which contain " -"special characters such as *delimiter*, *quotechar* or any of the characters " -"in *lineterminator*." +"special characters such as *delimiter*, *quotechar*, ``'\\r'``, ``'\\n'`` or " +"any of the characters in *lineterminator*." msgstr "" +"Οδηγεί τα αντικείμενα :class:`writer` να παραθέτουν μόνο εκείνα τα πεδία που " +"περιέχουν ειδικούς χαρακτήρες όπως το *delimiter*, *quotechar*, ``'\\r'``, " +"``'\\n'`` ή οποιονδήποτε από τους χαρακτήρες στο *lineterminator*." -#: library/csv.rst:330 +#: library/csv.rst:333 msgid "Instructs :class:`writer` objects to quote all non-numeric fields." msgstr "" +"Οδηγεί τα αντικείμενα :class:`writer` να παραθέτουν όλα τα μη-αριθμητικά " +"πεδία." -#: library/csv.rst:332 +#: library/csv.rst:335 msgid "" -"Instructs :class:`reader` objects to convert all non-quoted fields to type " -"*float*." +"Instructs :class:`reader` objects to convert all non-quoted fields to type :" +"class:`float`." msgstr "" +"Οδηγεί τα αντικείμενα :class:`reader` να μετατρέπουν όλα τα μη-παρατεθειμένα " +"πεδία σε τύπο :class:`float`." -#: library/csv.rst:337 +#: library/csv.rst:338 msgid "" -"Instructs :class:`writer` objects to never quote fields. When the current " -"*delimiter* occurs in output data it is preceded by the current *escapechar* " -"character. If *escapechar* is not set, the writer will raise :exc:`Error` " -"if any characters that require escaping are encountered." +"Some numeric types, such as :class:`bool`, :class:`~fractions.Fraction`, or :" +"class:`~enum.IntEnum`, have a string representation that cannot be converted " +"to :class:`float`. They cannot be read in the :data:`QUOTE_NONNUMERIC` and :" +"data:`QUOTE_STRINGS` modes." msgstr "" +"Ορισμένοι αριθμητικοί τύποι, όπως :class:`bool`, :class:`~fractions." +"Fraction`, ή :class:`~enum.IntEnum`, έχουν μια αναπαράσταση συμβολοσειράς " +"που δεν μπορεί να μετατραπεί σε :class:`float`. Δεν μπορούν να διαβαστούν σε " +"λειτουργίες :data:`QUOTE_NONNUMERIC` και :data:`QUOTE_STRINGS`." -#: library/csv.rst:342 +#: library/csv.rst:346 +msgid "" +"Instructs :class:`writer` objects to never quote fields. When the current " +"*delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` or any of the " +"characters in *lineterminator* occurs in output data it is preceded by the " +"current *escapechar* character. If *escapechar* is not set, the writer will " +"raise :exc:`Error` if any characters that require escaping are encountered. " +"Set *quotechar* to ``None`` to prevent its escaping." +msgstr "" +"Οδηγεί τα αντικείμενα :class:`writer` να μην παραθέτουν ποτέ πεδία. Όταν ο " +"τρέχων *delimiter*, *quotechar*, *escapechar*, ``'\\r'``, ``'\\n'`` ή " +"οποιοσδήποτε από τους χαρακτήρες στο *lineterminator* εμφανίζεται στα " +"δεδομένα εξόδου, προηγείται από τον τρέχοντα χαρακτήρα *escapechar*. Αν το " +"*escapechar* δεν έχει οριστεί, ο εγγραφέας θα κάνει raise μια :exc:`Error` " +"αν συναντηθούν χαρακτήρες που απαιτούν απόδραση. Ορίστε το *quotechar* σε " +"``None`` για να αποτρέψετε την απόδρασή του." + +#: library/csv.rst:354 msgid "" "Instructs :class:`reader` objects to perform no special processing of quote " "characters." msgstr "" +"Οδηγεί τα αντικείμενα :class:`reader` να μην εκτελούν ειδική επεξεργασία των " +"χαρακτήρων παράθεσης." -#: library/csv.rst:346 +#: library/csv.rst:358 msgid "" "Instructs :class:`writer` objects to quote all fields which are not " "``None``. This is similar to :data:`QUOTE_ALL`, except that if a field " "value is ``None`` an empty (unquoted) string is written." msgstr "" +"Οδηγεί τα αντικείμενα :class:`writer` να παραθέτουν όλα τα πεδία που δεν " +"είναι ``None``. Αυτό είναι παρόμοιο με :data:`QUOTE_ALL`, εκτός από το ότι " +"αν μια τιμή πεδίου είναι ``None``, γράφεται μια κενή (μη-παρατεθειμένη) " +"συμβολοσειρά." -#: library/csv.rst:350 +#: library/csv.rst:362 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) field as " -"None and to otherwise behave as :data:`QUOTE_ALL`." +"``None`` and to otherwise behave as :data:`QUOTE_ALL`." msgstr "" +"Οδηγεί τα αντικείμενα :class:`reader` να ερμηνεύουν ένα κενό (μη-" +"παρατεθειμένο) πεδίο ως ``None`` και να συμπεριφέρονται διαφορετικά ως :data:" +"`QUOTE_ALL`." -#: library/csv.rst:357 +#: library/csv.rst:369 msgid "" "Instructs :class:`writer` objects to always place quotes around fields which " "are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a " "field value is ``None`` an empty (unquoted) string is written." msgstr "" +"Οδηγεί τα αντικείμενα :class:`writer` να τοποθετούν πάντα εισαγωγικά γύρω " +"από πεδία που είναι συμβολοσειρές. Αυτό είναι παρόμοιο με :data:" +"`QUOTE_NONNUMERIC`, εκτός από το ότι αν μια τιμή πεδίου είναι ``None``, " +"γράφεται μια κενή (μη-παρατεθειμένη) συμβολοσειρά." -#: library/csv.rst:361 +#: library/csv.rst:373 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) string as " "``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." msgstr "" +"Οδηγεί τα αντικείμενα :class:`reader` να ερμηνεύουν μια κενή (μη-" +"παρατεθειμένη) συμβολοσειρά ως ``None`` και να συμπεριφέρονται διαφορετικά " +"ως :data:`QUOTE_NONNUMERIC`." -#: library/csv.rst:366 +#: library/csv.rst:378 msgid "The :mod:`csv` module defines the following exception:" -msgstr "" +msgstr "Το module :mod:`csv` ορίζει την παρακάτω εξαίρεση:" -#: library/csv.rst:371 +#: library/csv.rst:383 msgid "Raised by any of the functions when an error is detected." msgstr "" +"Γίνεται raise από οποιαδήποτε από τις συναρτήσεις όταν ανιχνεύεται ένα " +"σφάλμα." -#: library/csv.rst:376 +#: library/csv.rst:388 msgid "Dialects and Formatting Parameters" -msgstr "" +msgstr "Διάλεκτοι και Παράμετροι Μορφοποίησης" -#: library/csv.rst:378 +#: library/csv.rst:390 msgid "" "To make it easier to specify the format of input and output records, " "specific formatting parameters are grouped together into dialects. A " @@ -394,133 +700,220 @@ msgid "" "specify individual formatting parameters, which have the same names as the " "attributes defined below for the :class:`Dialect` class." msgstr "" - -#: library/csv.rst:388 +"Για να διευκολυνθεί ο καθορισμός της μορφής των εγγραφών εισόδου και εξόδου, " +"οι συγκεκριμένες παράμετροι μορφοποίησης ομαδοποιούνται σε διαλέκτους. Μια " +"διάλεκτος είναι μια υποκλάση της κλάσης :class:`Dialect` που περιέχει " +"διάφορα χαρακτηριστικά που περιγράφουν τη μορφή του αρχείου CSV. Κατά τη " +"δημιουργία αντικειμένων :class:`reader` ή :class:`writer`, ο προγραμματιστής " +"μπορεί να καθορίσει μια συμβολοσειρά ή μια υποκλάση της κλάσης :class:" +"`Dialect` ως παράμετρο διαλέκτου. Επιπλέον, αντί για ή εκτός από την " +"παράμετρο *dialect*, ο προγραμματιστής μπορεί επίσης να καθορίσει " +"μεμονωμένες παραμέτρους μορφοποίησης, οι οποίες έχουν τα ίδια ονόματα με τα " +"χαρακτηριστικά που ορίζονται παρακάτω για την κλάση :class:`Dialect`." + +#: library/csv.rst:400 msgid "Dialects support the following attributes:" -msgstr "" +msgstr "Οι διάλεκτοι υποστηρίζουν τα παρακάτω χαρακτηριστικά:" -#: library/csv.rst:393 +#: library/csv.rst:405 msgid "" "A one-character string used to separate fields. It defaults to ``','``." msgstr "" +"Μια συμβολοσειρά ενός χαρακτήρα που χρησιμοποιείται για να διαχωρίζει τα " +"πεδία. Προεπιλογή είναι το ``','``." -#: library/csv.rst:398 +#: library/csv.rst:410 msgid "" "Controls how instances of *quotechar* appearing inside a field should " "themselves be quoted. When :const:`True`, the character is doubled. When :" "const:`False`, the *escapechar* is used as a prefix to the *quotechar*. It " "defaults to :const:`True`." msgstr "" +"Ελέγχει πώς οι περιπτώσεις του *quotechar* που εμφανίζονται μέσα σε ένα " +"πεδίο θα παρατίθενται. Όταν είναι :const:`True`, ο χαρακτήρας διπλασιάζεται. " +"Όταν είναι :const:`False`, το *escapechar* χρησιμοποιείται ως πρόθεμα στο " +"*quotechar*. Προεπιλογή είναι το :const:`True`." -#: library/csv.rst:403 +#: library/csv.rst:415 msgid "" "On output, if *doublequote* is :const:`False` and no *escapechar* is set, :" "exc:`Error` is raised if a *quotechar* is found in a field." msgstr "" +"Στην έξοδο, αν το *doublequote* είναι :const:`False` και δεν έχει οριστεί " +"*escapechar*, γίνεται raise :exc:`Error` αν βρεθεί ένα *quotechar* σε ένα " +"πεδίο." -#: library/csv.rst:409 +#: library/csv.rst:421 msgid "" -"A one-character string used by the writer to escape the *delimiter* if " -"*quoting* is set to :const:`QUOTE_NONE` and the *quotechar* if *doublequote* " -"is :const:`False`. On reading, the *escapechar* removes any special meaning " -"from the following character. It defaults to :const:`None`, which disables " -"escaping." +"A one-character string used by the writer to escape characters that require " +"escaping:" msgstr "" +"Μια συμβολοσειρά ενός χαρακτήρα που χρησιμοποιείται από τον εγγραφέα για να " +"διαφύγει χαρακτήρες που απαιτούν escape:" -#: library/csv.rst:414 -msgid "An empty *escapechar* is not allowed." +#: library/csv.rst:424 +msgid "" +"the *delimiter*, the *quotechar*, ``'\\r'``, ``'\\n'`` and any of the " +"characters in *lineterminator* are escaped if *quoting* is set to :const:" +"`QUOTE_NONE`;" +msgstr "" +"το *delimiter*, το *quotechar*, ``'\\r'``, ``'\\n'`` και οποιοσδήποτε από " +"τους χαρακτήρες στο *lineterminator* διαφεύγουν αν το *quoting* έχει οριστεί " +"σε :const:`QUOTE_NONE` ∙" + +#: library/csv.rst:427 +msgid "the *quotechar* is escaped if *doublequote* is :const:`False`;" +msgstr "το *quotechar* διαφεύγει αν το *doublequote* είναι :const:`False` ∙" + +#: library/csv.rst:428 +msgid "the *escapechar* itself." +msgstr "το ίδιο το *escapechar*." + +#: library/csv.rst:430 +msgid "" +"On reading, the *escapechar* removes any special meaning from the following " +"character. It defaults to :const:`None`, which disables escaping." msgstr "" +"Κατά την ανάγνωση, το *escapechar* αφαιρεί οποιαδήποτε ειδική σημασία από " +"τον επόμενο χαρακτήρα. Προεπιλογή είναι το :const:`None`, που απενεργοποιεί " +"το escaping." -#: library/csv.rst:419 +#: library/csv.rst:433 +msgid "An empty *escapechar* is not allowed." +msgstr "Ένα κενό *escapechar* δεν επιτρέπεται." + +#: library/csv.rst:438 msgid "" "The string used to terminate lines produced by the :class:`writer`. It " "defaults to ``'\\r\\n'``." msgstr "" +"Η συμβολοσειρά που χρησιμοποιείται για να τερματίσει τις γραμμές που " +"παράγονται από τον :class:`writer`. Προεπιλογή είναι το ``'\\r\\n'``." -#: library/csv.rst:424 +#: library/csv.rst:443 msgid "" "The :class:`reader` is hard-coded to recognise either ``'\\r'`` or ``'\\n'`` " "as end-of-line, and ignores *lineterminator*. This behavior may change in " "the future." msgstr "" +"Ο :class:`reader` είναι σκληρά κωδικοποιημένος για να αναγνωρίζει είτε " +"``'\\r'`` είτε ``'\\n'`` ως τερματισμό γραμμής, και αγνοεί το " +"*lineterminator*. Αυτή η συμπεριφορά μπορεί να αλλάξει στο μέλλον." -#: library/csv.rst:431 +#: library/csv.rst:450 msgid "" "A one-character string used to quote fields containing special characters, " -"such as the *delimiter* or *quotechar*, or which contain new-line " -"characters. It defaults to ``'\"'``." -msgstr "" - -#: library/csv.rst:435 +"such as the *delimiter* or the *quotechar*, or which contain new-line " +"characters (``'\\r'``, ``'\\n'`` or any of the characters in " +"*lineterminator*). It defaults to ``'\"'``. Can be set to ``None`` to " +"prevent escaping ``'\"'`` if *quoting* is set to :const:`QUOTE_NONE`." +msgstr "" +"Μια συμβολοσειρά ενός χαρακτήρα που χρησιμοποιείται για να παραθέτει πεδία " +"που περιέχουν ειδικούς χαρακτήρες, όπως το *delimiter* ή το *quotechar*, ή " +"που περιέχουν χαρακτήρες νέας γραμμής (``'\\r'``, ``'\\n'`` ή οποιοσδήποτε " +"από τους χαρακτήρες στο *lineterminator*). Προεπιλογή είναι το ``'\"'``. " +"Μπορεί να οριστεί σε ``None`` για να αποτραπεί το escaping του ``'\"'`` αν " +"το *quoting* έχει οριστεί σε :const:`QUOTE_NONE`." + +#: library/csv.rst:457 msgid "An empty *quotechar* is not allowed." -msgstr "" +msgstr "Ένα κενό *quotechar* δεν επιτρέπεται." -#: library/csv.rst:440 +#: library/csv.rst:462 msgid "" "Controls when quotes should be generated by the writer and recognised by the " "reader. It can take on any of the :ref:`QUOTE_\\* constants ` and defaults to :const:`QUOTE_MINIMAL`." +"constants>` and defaults to :const:`QUOTE_MINIMAL` if *quotechar* is not " +"``None``, and :const:`QUOTE_NONE` otherwise." msgstr "" +"Ελέγχει πότε θα δημιουργούνται εισαγωγικά από τον εγγραφέα και θα " +"αναγνωρίζονται από τον αναγνώστη. Μπορεί να πάρει οποιαδήποτε από τις " +"σταθερές :ref:`QUOTE_\\* constants ` και προεπιλογή είναι το :" +"const:`QUOTE_MINIMAL` αν το *quotechar* δεν είναι ``None``, και το :const:" +"`QUOTE_NONE` διαφορετικά." -#: library/csv.rst:447 +#: library/csv.rst:470 msgid "" "When :const:`True`, spaces immediately following the *delimiter* are " -"ignored. The default is :const:`False`." +"ignored. The default is :const:`False`. When combining ``delimiter=' '`` " +"with ``skipinitialspace=True``, unquoted empty fields are not allowed." msgstr "" +"Όταν είναι :const:`True`, τα κενά που ακολουθούν άμεσα τον *delimiter* " +"αγνοούνται. Η προεπιλογή είναι :const:`False`. Όταν συνδυάζεται το " +"``delimiter=' '`` με το ``skipinitialspace=True``, δεν επιτρέπονται μη " +"παραθερισμένα κενά πεδία." -#: library/csv.rst:453 +#: library/csv.rst:477 msgid "" "When ``True``, raise exception :exc:`Error` on bad CSV input. The default is " "``False``." msgstr "" +"Όταν είναι ``True``, γίνεται raise η εξαίρεση :exc:`Error` σε κακή είσοδο " +"CSV. Η προεπιλογή είναι ``False``." -#: library/csv.rst:459 +#: library/csv.rst:483 msgid "Reader Objects" -msgstr "" +msgstr "Αντικείμενα Αναγνώστη" -#: library/csv.rst:461 +#: library/csv.rst:485 msgid "" "Reader objects (:class:`DictReader` instances and objects returned by the :" "func:`reader` function) have the following public methods:" msgstr "" +"Τα αντικείμενα αναγνώστη (στιγμιότυπα της :class:`DictReader` και " +"αντικείμενα που επιστρέφονται από τη συνάρτηση :func:`reader`) έχουν τις " +"παρακάτω δημόσιες μεθόδους:" -#: library/csv.rst:466 +#: library/csv.rst:490 msgid "" "Return the next row of the reader's iterable object as a list (if the object " "was returned from :func:`reader`) or a dict (if it is a :class:`DictReader` " "instance), parsed according to the current :class:`Dialect`. Usually you " "should call this as ``next(reader)``." msgstr "" +"Επιστρέφει την επόμενη γραμμή του αντικειμένου iterable του αναγνώστη ως " +"λίστα (αν το αντικείμενο επιστράφηκε από τη :func:`reader`) ή ως λεξικό (αν " +"είναι ένα στιγμιότυπο :class:`DictReader`), αναλυμένο σύμφωνα με την " +"τρέχουσα :class:`Dialect`. Συνήθως θα πρέπει να το καλέσετε ως " +"``next(reader)``." -#: library/csv.rst:472 +#: library/csv.rst:496 msgid "Reader objects have the following public attributes:" -msgstr "" +msgstr "Τα αντικείμενα αναγνώστη έχουν τα παρακάτω δημόσια χαρακτηριστικά:" -#: library/csv.rst:476 +#: library/csv.rst:500 msgid "A read-only description of the dialect in use by the parser." msgstr "" +"Ένα μόνο για ανάγνωση περιγραφικό χαρακτηριστικό της διαλέκτου που " +"χρησιμοποιείται από τον αναλυτή." -#: library/csv.rst:481 +#: library/csv.rst:505 msgid "" "The number of lines read from the source iterator. This is not the same as " "the number of records returned, as records can span multiple lines." msgstr "" +"Ο αριθμός των γραμμών που διαβάστηκαν από τον πηγαίο επαναληπτή. Αυτό δεν " +"είναι το ίδιο με τον αριθμό των εγγραφών που επιστράφηκαν, καθώς οι εγγραφές " +"μπορούν να εκτείνονται σε πολλές γραμμές." -#: library/csv.rst:485 +#: library/csv.rst:509 msgid "DictReader objects have the following public attribute:" -msgstr "" +msgstr "Τα αντικείμενα DictReader έχουν το παρακάτω δημόσιο χαρακτηριστικό:" -#: library/csv.rst:489 +#: library/csv.rst:513 msgid "" "If not passed as a parameter when creating the object, this attribute is " "initialized upon first access or when the first record is read from the file." msgstr "" +"Αν δεν περαστεί ως παράμετρος κατά τη δημιουργία του αντικειμένου, αυτό το " +"χαρακτηριστικό αρχικοποιείται κατά την πρώτη πρόσβαση ή όταν διαβαστεί η " +"πρώτη εγγραφή από το αρχείο." -#: library/csv.rst:496 +#: library/csv.rst:520 msgid "Writer Objects" -msgstr "" +msgstr "Αντικείμενα Εγγραφέα" -#: library/csv.rst:498 +#: library/csv.rst:522 msgid "" ":class:`writer` objects (:class:`DictWriter` instances and objects returned " "by the :func:`writer` function) have the following public methods. A *row* " @@ -531,125 +924,267 @@ msgid "" "problems for other programs which read CSV files (assuming they support " "complex numbers at all)." msgstr "" - -#: library/csv.rst:509 +"Τα αντικείμενα :class:`writer` (στιγμιότυπα της :class:`DictWriter` και " +"αντικείμενα που επιστρέφονται από τη συνάρτηση :func:`writer`) έχουν τις " +"παρακάτω δημόσιες μεθόδους. Ένα *row* πρέπει να είναι ένα επαναληπτικό " +"αντικείμενο συμβολοσειρών ή αριθμών για τα αντικείμενα :class:`writer` και " +"ένα λεξικό που αντιστοιχεί τα ονόματα πεδίων σε συμβολοσειρές ή αριθμούς (με " +"πέρασμα μέσω της συνάρτησης :func:`str` πρώτα) για τα αντικείμενα :class:" +"`DictWriter`. Σημειώστε ότι οι σύνθετοι αριθμοί γράφονται περιβαλλόμενοι από " +"παρενθέσεις. Αυτό μπορεί να προκαλέσει κάποια προβλήματα σε άλλα προγράμματα " +"που διαβάζουν αρχεία CSV (υποθέτοντας ότι υποστηρίζουν σύνθετους αριθμούς " +"καθόλου)." + +#: library/csv.rst:533 msgid "" "Write the *row* parameter to the writer's file object, formatted according " "to the current :class:`Dialect`. Return the return value of the call to the " "*write* method of the underlying file object." msgstr "" +"Γράφει την παράμετρο *row* στο αντικείμενο αρχείου του εγγραφέα, " +"μορφοποιημένο σύμφωνα με την τρέχουσα :class:`Dialect`. Επιστρέφει την τιμή " +"επιστροφής της κλήσης στη μέθοδο *write* του υποκείμενου αντικειμένου " +"αρχείου." -#: library/csv.rst:513 +#: library/csv.rst:537 msgid "Added support of arbitrary iterables." -msgstr "" +msgstr "Προστέθηκε υποστήριξη για αυθαίρετα επαναληπτικά αντικείμενα." -#: library/csv.rst:518 +#: library/csv.rst:542 msgid "" "Write all elements in *rows* (an iterable of *row* objects as described " "above) to the writer's file object, formatted according to the current " "dialect." msgstr "" +"Γράφει όλα τα στοιχεία στο *rows* (ένα επαναληπτικό αντικείμενο των *row* " +"αντικειμένων όπως περιγράφεται παραπάνω) στο αντικείμενο αρχείου του " +"εγγραφέα, μορφοποιημένο σύμφωνα με την τρέχουσα διάλεκτο." -#: library/csv.rst:522 +#: library/csv.rst:546 msgid "Writer objects have the following public attribute:" -msgstr "" +msgstr "Τα αντικείμενα εγγραφέα έχουν το παρακάτω δημόσιο χαρακτηριστικό:" -#: library/csv.rst:527 +#: library/csv.rst:551 msgid "A read-only description of the dialect in use by the writer." msgstr "" +"Ένα μόνο για ανάγνωση περιγραφικό χαρακτηριστικό της διαλέκτου που " +"χρησιμοποιείται από τον εγγραφέα." -#: library/csv.rst:530 +#: library/csv.rst:554 msgid "DictWriter objects have the following public method:" -msgstr "" +msgstr "Τα αντικείμενα DictWriter έχουν την παρακάτω δημόσια μέθοδο:" -#: library/csv.rst:535 +#: library/csv.rst:559 msgid "" "Write a row with the field names (as specified in the constructor) to the " "writer's file object, formatted according to the current dialect. Return the " "return value of the :meth:`csvwriter.writerow` call used internally." msgstr "" +"Γράφει μια γραμμή με τα ονόματα πεδίων (όπως καθορίζονται στον κατασκευαστή) " +"στο αντικείμενο αρχείου του εγγραφέα, μορφοποιημένο σύμφωνα με την τρέχουσα " +"διάλεκτο. Επιστρέφει την τιμή επιστροφής της κλήσης :meth:`csvwriter." +"writerow` που χρησιμοποιείται εσωτερικά." -#: library/csv.rst:540 +#: library/csv.rst:564 msgid "" ":meth:`writeheader` now also returns the value returned by the :meth:" "`csvwriter.writerow` method it uses internally." msgstr "" +"Η :meth:`writeheader` τώρα επιστρέφει επίσης την τιμή που επιστρέφεται από " +"τη μέθοδο :meth:`csvwriter.writerow` που χρησιμοποιεί εσωτερικά." -#: library/csv.rst:548 +#: library/csv.rst:572 msgid "Examples" -msgstr "" +msgstr "Παραδείγματα" -#: library/csv.rst:550 +#: library/csv.rst:574 msgid "The simplest example of reading a CSV file::" -msgstr "" +msgstr "Το πιο απλό παράδειγμα ανάγνωσης ενός αρχείου CSV::" -#: library/csv.rst:558 +#: library/csv.rst:576 +msgid "" +"import csv\n" +"with open('some.csv', newline='') as f:\n" +" reader = csv.reader(f)\n" +" for row in reader:\n" +" print(row)" +msgstr "" +"import csv\n" +"with open('some.csv', newline='') as f:\n" +" reader = csv.reader(f)\n" +" for row in reader:\n" +" print(row)" + +#: library/csv.rst:582 msgid "Reading a file with an alternate format::" -msgstr "" +msgstr "Ανάγνωση ενός αρχείου με εναλλακτική μορφή::" -#: library/csv.rst:566 +#: library/csv.rst:584 +msgid "" +"import csv\n" +"with open('passwd', newline='') as f:\n" +" reader = csv.reader(f, delimiter=':', quoting=csv.QUOTE_NONE)\n" +" for row in reader:\n" +" print(row)" +msgstr "" +"import csv\n" +"with open('passwd', newline='') as f:\n" +" reader = csv.reader(f, delimiter=':', quoting=csv.QUOTE_NONE)\n" +" for row in reader:\n" +" print(row)" + +#: library/csv.rst:590 msgid "The corresponding simplest possible writing example is::" +msgstr "Το αντίστοιχο απλούστερο παράδειγμα εγγραφής είναι::" + +#: library/csv.rst:592 +msgid "" +"import csv\n" +"with open('some.csv', 'w', newline='') as f:\n" +" writer = csv.writer(f)\n" +" writer.writerows(someiterable)" msgstr "" +"import csv\n" +"with open('some.csv', 'w', newline='') as f:\n" +" writer = csv.writer(f)\n" +" writer.writerows(someiterable)" -#: library/csv.rst:573 +#: library/csv.rst:597 msgid "" "Since :func:`open` is used to open a CSV file for reading, the file will by " "default be decoded into unicode using the system default encoding (see :func:" "`locale.getencoding`). To decode a file using a different encoding, use the " "``encoding`` argument of open::" msgstr "" +"Αφού η :func:`open` χρησιμοποιείται για να ανοίξει ένα αρχείο CSV για " +"ανάγνωση, το αρχείο θα αποκωδικοποιηθεί κατά προεπιλογή σε unicode " +"χρησιμοποιώντας την προεπιλεγμένη κωδικοποίηση του συστήματος (βλ. :func:" +"`locale.getencoding`). Για να αποκωδικοποιήσετε ένα αρχείο χρησιμοποιώντας " +"μια διαφορετική κωδικοποίηση, χρησιμοποιήστε το όρισμα ``encoding`` της " +"open::" -#: library/csv.rst:584 +#: library/csv.rst:602 +msgid "" +"import csv\n" +"with open('some.csv', newline='', encoding='utf-8') as f:\n" +" reader = csv.reader(f)\n" +" for row in reader:\n" +" print(row)" +msgstr "" +"import csv\n" +"with open('some.csv', newline='', encoding='utf-8') as f:\n" +" reader = csv.reader(f)\n" +" for row in reader:\n" +" print(row)" + +#: library/csv.rst:608 msgid "" "The same applies to writing in something other than the system default " "encoding: specify the encoding argument when opening the output file." msgstr "" +"Το ίδιο ισχύει και για την εγγραφή σε κάτι άλλο εκτός από την προεπιλεγμένη " +"κωδικοποίηση του συστήματος: καθορίστε το όρισμα κωδικοποίησης κατά το " +"άνοιγμα του αρχείου εξόδου." -#: library/csv.rst:587 +#: library/csv.rst:611 msgid "Registering a new dialect::" +msgstr "Καταχώρηση μιας νέας διαλέκτου::" + +#: library/csv.rst:613 +msgid "" +"import csv\n" +"csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" +"with open('passwd', newline='') as f:\n" +" reader = csv.reader(f, 'unixpwd')" msgstr "" +"import csv\n" +"csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" +"with open('passwd', newline='') as f:\n" +" reader = csv.reader(f, 'unixpwd')" -#: library/csv.rst:594 +#: library/csv.rst:618 msgid "" "A slightly more advanced use of the reader --- catching and reporting " "errors::" msgstr "" +"Μια ελαφρώς πιο προηγμένη χρήση του αναγνώστη --- σύλληψη και αναφορά " +"σφαλμάτων::" -#: library/csv.rst:606 +#: library/csv.rst:620 +msgid "" +"import csv, sys\n" +"filename = 'some.csv'\n" +"with open(filename, newline='') as f:\n" +" reader = csv.reader(f)\n" +" try:\n" +" for row in reader:\n" +" print(row)\n" +" except csv.Error as e:\n" +" sys.exit(f'file {filename}, line {reader.line_num}: {e}')" +msgstr "" +"import csv, sys\n" +"filename = 'some.csv'\n" +"with open(filename, newline='') as f:\n" +" reader = csv.reader(f)\n" +" try:\n" +" for row in reader:\n" +" print(row)\n" +" except csv.Error as e:\n" +" sys.exit(f'file {filename}, line {reader.line_num}: {e}')" + +#: library/csv.rst:630 msgid "" "And while the module doesn't directly support parsing strings, it can easily " "be done::" msgstr "" +"Και ενώ το module δεν υποστηρίζει άμεσα την ανάλυση συμβολοσειρών, μπορεί " +"εύκολα να γίνει::" -#: library/csv.rst:615 -msgid "Footnotes" +#: library/csv.rst:633 +msgid "" +"import csv\n" +"for row in csv.reader(['one,two,three']):\n" +" print(row)" msgstr "" +"import csv\n" +"for row in csv.reader(['one,two,three']):\n" +" print(row)" + +#: library/csv.rst:639 +msgid "Footnotes" +msgstr "Υποσημειώσεις" -#: library/csv.rst:616 +#: library/csv.rst:640 msgid "" "If ``newline=''`` is not specified, newlines embedded inside quoted fields " -"will not be interpreted correctly, and on platforms that use ``\\r\\n`` " -"linendings on write an extra ``\\r`` will be added. It should always be " -"safe to specify ``newline=''``, since the csv module does its own (:term:" +"will not be interpreted correctly, and on platforms that use ``\\r\\n`` line " +"endings on write an extra ``\\r`` will be added. It should always be safe " +"to specify ``newline=''``, since the csv module does its own (:term:" "`universal `) newline handling." msgstr "" +"Αν δεν καθοριστεί ``newline=''``, οι νέες γραμμές που ενσωματώνονται μέσα σε " +"παρατεθειμένα πεδία δεν θα ερμηνευτούν σωστά, και σε πλατφόρμες που " +"χρησιμοποιούν ``\\r\\n`` ως τερματισμούς γραμμών κατά την εγγραφή, θα " +"προστίθεται ένα επιπλέον ``\\r``. Πρέπει πάντα να είναι ασφαλές να " +"καθορίσετε ``newline=''``, καθώς το module csv χειρίζεται μόνο του (:term:" +"`universal `) τη διαχείριση νέων γραμμών." #: library/csv.rst:11 msgid "csv" -msgstr "" +msgstr "csv" #: library/csv.rst:11 msgid "data" -msgstr "" +msgstr "δεδομένα" #: library/csv.rst:11 msgid "tabular" -msgstr "" +msgstr "πίνακας" #: library/csv.rst:53 msgid "universal newlines" -msgstr "" +msgstr "καθολικές νέες γραμμές" #: library/csv.rst:53 msgid "csv.reader function" -msgstr "" +msgstr "συνάρτηση csv.reader" diff --git a/library/ctypes.po b/library/ctypes.po index 7edd1cba..b7251682 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/ctypes.rst:2 -msgid ":mod:`ctypes` --- A foreign function library for Python" +msgid ":mod:`!ctypes` --- A foreign function library for Python" msgstr "" #: library/ctypes.rst:9 @@ -31,18 +32,26 @@ msgid "" "libraries. It can be used to wrap these libraries in pure Python." msgstr "" -#: library/ctypes.rst:21 -msgid "ctypes tutorial" +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." msgstr "" #: library/ctypes.rst:23 +msgid "ctypes tutorial" +msgstr "" + +#: library/ctypes.rst:25 msgid "" "Note: The code samples in this tutorial use :mod:`doctest` to make sure that " "they actually work. Since some code samples behave differently under Linux, " "Windows, or macOS, they contain doctest directives in comments." msgstr "" -#: library/ctypes.rst:27 +#: library/ctypes.rst:29 msgid "" "Note: Some code samples reference the ctypes :class:`c_int` type. On " "platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:" @@ -50,17 +59,17 @@ msgid "" "you would expect :class:`c_int` --- they are actually the same type." msgstr "" -#: library/ctypes.rst:35 +#: library/ctypes.rst:37 msgid "Loading dynamic link libraries" msgstr "" -#: library/ctypes.rst:37 +#: library/ctypes.rst:39 msgid "" ":mod:`ctypes` exports the *cdll*, and on Windows *windll* and *oledll* " "objects, for loading dynamic link libraries." msgstr "" -#: library/ctypes.rst:40 +#: library/ctypes.rst:42 msgid "" "You load libraries by accessing them as attributes of these objects. *cdll* " "loads libraries which export functions using the standard ``cdecl`` calling " @@ -71,24 +80,35 @@ msgid "" "when the function call fails." msgstr "" -#: library/ctypes.rst:48 +#: library/ctypes.rst:50 msgid "" "Windows errors used to raise :exc:`WindowsError`, which is now an alias of :" "exc:`OSError`." msgstr "" -#: library/ctypes.rst:53 +#: library/ctypes.rst:55 msgid "" "Here are some examples for Windows. Note that ``msvcrt`` is the MS standard " -"C library containing most standard C functions, and uses the cdecl calling " -"convention::" +"C library containing most standard C functions, and uses the ``cdecl`` " +"calling convention::" +msgstr "" + +#: library/ctypes.rst:59 +msgid "" +">>> from ctypes import *\n" +">>> print(windll.kernel32)\n" +"\n" +">>> print(cdll.msvcrt)\n" +"\n" +">>> libc = cdll.msvcrt\n" +">>>" msgstr "" -#: library/ctypes.rst:65 +#: library/ctypes.rst:67 msgid "Windows appends the usual ``.dll`` file suffix automatically." msgstr "" -#: library/ctypes.rst:68 +#: library/ctypes.rst:70 msgid "" "Accessing the standard C library through ``cdll.msvcrt`` will use an " "outdated version of the library that may be incompatible with the one being " @@ -96,7 +116,7 @@ msgid "" "import and use the ``msvcrt`` module." msgstr "" -#: library/ctypes.rst:73 +#: library/ctypes.rst:75 msgid "" "On Linux, it is required to specify the filename *including* the extension " "to load a library, so attribute access can not be used to load libraries. " @@ -105,84 +125,176 @@ msgid "" "CDLL by calling the constructor::" msgstr "" -#: library/ctypes.rst:92 -msgid "Accessing functions from loaded dlls" +#: library/ctypes.rst:81 +msgid "" +">>> cdll.LoadLibrary(\"libc.so.6\")\n" +"\n" +">>> libc = CDLL(\"libc.so.6\")\n" +">>> libc\n" +"\n" +">>>" msgstr "" #: library/ctypes.rst:94 +msgid "Accessing functions from loaded dlls" +msgstr "" + +#: library/ctypes.rst:96 msgid "Functions are accessed as attributes of dll objects::" msgstr "" -#: library/ctypes.rst:109 +#: library/ctypes.rst:98 +msgid "" +">>> libc.printf\n" +"<_FuncPtr object at 0x...>\n" +">>> print(windll.kernel32.GetModuleHandleA)\n" +"<_FuncPtr object at 0x...>\n" +">>> print(windll.kernel32.MyOwnFunction)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"ctypes.py\", line 239, in __getattr__\n" +" func = _StdcallFuncPtr(name, self)\n" +"AttributeError: function 'MyOwnFunction' not found\n" +">>>" +msgstr "" + +#: library/ctypes.rst:110 msgid "" "Note that win32 system dlls like ``kernel32`` and ``user32`` often export " "ANSI as well as UNICODE versions of a function. The UNICODE version is " -"exported with an ``W`` appended to the name, while the ANSI version is " +"exported with a ``W`` appended to the name, while the ANSI version is " "exported with an ``A`` appended to the name. The win32 ``GetModuleHandle`` " "function, which returns a *module handle* for a given module name, has the " "following C prototype, and a macro is used to expose one of them as " "``GetModuleHandle`` depending on whether UNICODE is defined or not::" msgstr "" -#: library/ctypes.rst:122 +#: library/ctypes.rst:118 +msgid "" +"/* ANSI version */\n" +"HMODULE GetModuleHandleA(LPCSTR lpModuleName);\n" +"/* UNICODE version */\n" +"HMODULE GetModuleHandleW(LPCWSTR lpModuleName);" +msgstr "" + +#: library/ctypes.rst:123 msgid "" "*windll* does not try to select one of them by magic, you must access the " "version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` " "explicitly, and then call it with bytes or string objects respectively." msgstr "" -#: library/ctypes.rst:126 +#: library/ctypes.rst:127 msgid "" "Sometimes, dlls export functions with names which aren't valid Python " "identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:" "`getattr` to retrieve the function::" msgstr "" -#: library/ctypes.rst:134 +#: library/ctypes.rst:131 +msgid "" +">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" +"<_FuncPtr object at 0x...>\n" +">>>" +msgstr "" + +#: library/ctypes.rst:135 msgid "" "On Windows, some dlls export functions not by name but by ordinal. These " "functions can be accessed by indexing the dll object with the ordinal " "number::" msgstr "" -#: library/ctypes.rst:151 +#: library/ctypes.rst:138 +msgid "" +">>> cdll.kernel32[1]\n" +"<_FuncPtr object at 0x...>\n" +">>> cdll.kernel32[0]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"ctypes.py\", line 310, in __getitem__\n" +" func = _StdcallFuncPtr(name, self)\n" +"AttributeError: function ordinal 0 not found\n" +">>>" +msgstr "" + +#: library/ctypes.rst:152 msgid "Calling functions" msgstr "" -#: library/ctypes.rst:153 +#: library/ctypes.rst:154 msgid "" "You can call these functions like any other Python callable. This example " "uses the ``rand()`` function, which takes no arguments and returns a pseudo-" "random integer::" msgstr "" -#: library/ctypes.rst:159 +#: library/ctypes.rst:157 +msgid "" +">>> print(libc.rand())\n" +"1804289383" +msgstr "" + +#: library/ctypes.rst:160 msgid "" "On Windows, you can call the ``GetModuleHandleA()`` function, which returns " "a win32 module handle (passing ``None`` as single argument to call it with a " "``NULL`` pointer)::" msgstr "" -#: library/ctypes.rst:166 +#: library/ctypes.rst:163 +msgid "" +">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" +"0x1d000000\n" +">>>" +msgstr "" + +#: library/ctypes.rst:167 msgid "" ":exc:`ValueError` is raised when you call an ``stdcall`` function with the " "``cdecl`` calling convention, or vice versa::" msgstr "" -#: library/ctypes.rst:181 +#: library/ctypes.rst:170 +msgid "" +">>> cdll.kernel32.GetModuleHandleA(None)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: Procedure probably called with not enough arguments (4 bytes " +"missing)\n" +">>>\n" +"\n" +">>> windll.msvcrt.printf(b\"spam\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: Procedure probably called with too many arguments (4 bytes in " +"excess)\n" +">>>" +msgstr "" + +#: library/ctypes.rst:182 msgid "" "To find out the correct calling convention you have to look into the C " "header file or the documentation for the function you want to call." msgstr "" -#: library/ctypes.rst:184 +#: library/ctypes.rst:185 msgid "" "On Windows, :mod:`ctypes` uses win32 structured exception handling to " "prevent crashes from general protection faults when functions are called " "with invalid argument values::" msgstr "" -#: library/ctypes.rst:194 +#: library/ctypes.rst:189 +msgid "" +">>> windll.kernel32.GetModuleHandleA(32)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"OSError: exception: access violation reading 0x00000020\n" +">>>" +msgstr "" + +#: library/ctypes.rst:195 msgid "" "There are, however, enough ways to crash Python with :mod:`ctypes`, so you " "should be careful anyway. The :mod:`faulthandler` module can be helpful in " @@ -190,273 +302,415 @@ msgid "" "library calls)." msgstr "" -#: library/ctypes.rst:199 +#: library/ctypes.rst:200 msgid "" "``None``, integers, bytes objects and (unicode) strings are the only native " "Python objects that can directly be used as parameters in these function " "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " "are passed as pointer to the memory block that contains their data (:c:expr:" "`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " -"platforms default C :c:expr:`int` type, their value is masked to fit into " +"platform's default C :c:expr:`int` type, their value is masked to fit into " "the C type." msgstr "" -#: library/ctypes.rst:206 +#: library/ctypes.rst:207 msgid "" "Before we move on calling functions with other parameter types, we have to " "learn more about :mod:`ctypes` data types." msgstr "" -#: library/ctypes.rst:2199 +#: library/ctypes.rst:2428 msgid "Fundamental data types" msgstr "" -#: library/ctypes.rst:215 +#: library/ctypes.rst:216 msgid ":mod:`ctypes` defines a number of primitive C compatible data types:" msgstr "" -#: library/ctypes.rst:218 +#: library/ctypes.rst:291 msgid "ctypes type" msgstr "" -#: library/ctypes.rst:218 +#: library/ctypes.rst:291 msgid "C type" msgstr "" -#: library/ctypes.rst:218 +#: library/ctypes.rst:291 msgid "Python type" msgstr "" -#: library/ctypes.rst:220 +#: library/ctypes.rst:221 msgid ":class:`c_bool`" msgstr "" -#: library/ctypes.rst:220 +#: library/ctypes.rst:221 msgid ":c:expr:`_Bool`" msgstr "" -#: library/ctypes.rst:220 +#: library/ctypes.rst:221 msgid "bool (1)" msgstr "" -#: library/ctypes.rst:222 +#: library/ctypes.rst:223 msgid ":class:`c_char`" msgstr "" -#: library/ctypes.rst:226 +#: library/ctypes.rst:227 msgid ":c:expr:`char`" msgstr "" -#: library/ctypes.rst:222 +#: library/ctypes.rst:223 msgid "1-character bytes object" msgstr "" -#: library/ctypes.rst:224 +#: library/ctypes.rst:225 msgid ":class:`c_wchar`" msgstr "" -#: library/ctypes.rst:224 +#: library/ctypes.rst:225 msgid ":c:type:`wchar_t`" msgstr "" -#: library/ctypes.rst:224 +#: library/ctypes.rst:225 msgid "1-character string" msgstr "" -#: library/ctypes.rst:226 +#: library/ctypes.rst:227 msgid ":class:`c_byte`" msgstr "" -#: library/ctypes.rst:228 library/ctypes.rst:232 library/ctypes.rst:236 -#: library/ctypes.rst:240 library/ctypes.rst:244 library/ctypes.rst:249 -#: library/ctypes.rst:252 +#: library/ctypes.rst:229 library/ctypes.rst:233 library/ctypes.rst:237 +#: library/ctypes.rst:241 library/ctypes.rst:245 library/ctypes.rst:249 +#: library/ctypes.rst:253 library/ctypes.rst:257 library/ctypes.rst:261 +#: library/ctypes.rst:266 library/ctypes.rst:269 msgid "int" msgstr "" -#: library/ctypes.rst:228 +#: library/ctypes.rst:229 msgid ":class:`c_ubyte`" msgstr "" -#: library/ctypes.rst:228 +#: library/ctypes.rst:229 msgid ":c:expr:`unsigned char`" msgstr "" -#: library/ctypes.rst:230 +#: library/ctypes.rst:231 msgid ":class:`c_short`" msgstr "" -#: library/ctypes.rst:230 +#: library/ctypes.rst:231 msgid ":c:expr:`short`" msgstr "" -#: library/ctypes.rst:232 +#: library/ctypes.rst:233 msgid ":class:`c_ushort`" msgstr "" -#: library/ctypes.rst:232 +#: library/ctypes.rst:233 msgid ":c:expr:`unsigned short`" msgstr "" -#: library/ctypes.rst:234 +#: library/ctypes.rst:235 msgid ":class:`c_int`" msgstr "" -#: library/ctypes.rst:234 +#: library/ctypes.rst:235 msgid ":c:expr:`int`" msgstr "" -#: library/ctypes.rst:236 +#: library/ctypes.rst:237 +msgid ":class:`c_int8`" +msgstr "" + +#: library/ctypes.rst:237 +msgid ":c:type:`int8_t`" +msgstr "" + +#: library/ctypes.rst:239 +msgid ":class:`c_int16`" +msgstr "" + +#: library/ctypes.rst:239 +msgid ":c:type:`int16_t`" +msgstr "" + +#: library/ctypes.rst:241 +msgid ":class:`c_int32`" +msgstr "" + +#: library/ctypes.rst:241 +msgid ":c:type:`int32_t`" +msgstr "" + +#: library/ctypes.rst:243 +msgid ":class:`c_int64`" +msgstr "" + +#: library/ctypes.rst:243 +msgid ":c:type:`int64_t`" +msgstr "" + +#: library/ctypes.rst:245 msgid ":class:`c_uint`" msgstr "" -#: library/ctypes.rst:236 +#: library/ctypes.rst:245 msgid ":c:expr:`unsigned int`" msgstr "" -#: library/ctypes.rst:238 +#: library/ctypes.rst:247 +msgid ":class:`c_uint8`" +msgstr "" + +#: library/ctypes.rst:247 +msgid ":c:type:`uint8_t`" +msgstr "" + +#: library/ctypes.rst:249 +msgid ":class:`c_uint16`" +msgstr "" + +#: library/ctypes.rst:249 +msgid ":c:type:`uint16_t`" +msgstr "" + +#: library/ctypes.rst:251 +msgid ":class:`c_uint32`" +msgstr "" + +#: library/ctypes.rst:251 +msgid ":c:type:`uint32_t`" +msgstr "" + +#: library/ctypes.rst:253 +msgid ":class:`c_uint64`" +msgstr "" + +#: library/ctypes.rst:253 +msgid ":c:type:`uint64_t`" +msgstr "" + +#: library/ctypes.rst:255 msgid ":class:`c_long`" msgstr "" -#: library/ctypes.rst:238 +#: library/ctypes.rst:255 msgid ":c:expr:`long`" msgstr "" -#: library/ctypes.rst:240 +#: library/ctypes.rst:257 msgid ":class:`c_ulong`" msgstr "" -#: library/ctypes.rst:240 +#: library/ctypes.rst:257 msgid ":c:expr:`unsigned long`" msgstr "" -#: library/ctypes.rst:242 +#: library/ctypes.rst:259 msgid ":class:`c_longlong`" msgstr "" -#: library/ctypes.rst:242 +#: library/ctypes.rst:259 msgid ":c:expr:`__int64` or :c:expr:`long long`" msgstr "" -#: library/ctypes.rst:244 +#: library/ctypes.rst:261 msgid ":class:`c_ulonglong`" msgstr "" -#: library/ctypes.rst:244 +#: library/ctypes.rst:261 msgid ":c:expr:`unsigned __int64` or :c:expr:`unsigned long long`" msgstr "" -#: library/ctypes.rst:247 +#: library/ctypes.rst:264 msgid ":class:`c_size_t`" msgstr "" -#: library/ctypes.rst:247 +#: library/ctypes.rst:264 msgid ":c:type:`size_t`" msgstr "" -#: library/ctypes.rst:249 +#: library/ctypes.rst:266 msgid ":class:`c_ssize_t`" msgstr "" -#: library/ctypes.rst:249 +#: library/ctypes.rst:266 msgid ":c:type:`ssize_t` or :c:expr:`Py_ssize_t`" msgstr "" -#: library/ctypes.rst:252 +#: library/ctypes.rst:269 msgid ":class:`c_time_t`" msgstr "" -#: library/ctypes.rst:252 +#: library/ctypes.rst:269 msgid ":c:type:`time_t`" msgstr "" -#: library/ctypes.rst:254 +#: library/ctypes.rst:271 msgid ":class:`c_float`" msgstr "" -#: library/ctypes.rst:254 +#: library/ctypes.rst:271 msgid ":c:expr:`float`" msgstr "" -#: library/ctypes.rst:256 library/ctypes.rst:258 +#: library/ctypes.rst:273 library/ctypes.rst:275 msgid "float" msgstr "" -#: library/ctypes.rst:256 +#: library/ctypes.rst:273 msgid ":class:`c_double`" msgstr "" -#: library/ctypes.rst:256 +#: library/ctypes.rst:273 msgid ":c:expr:`double`" msgstr "" -#: library/ctypes.rst:258 +#: library/ctypes.rst:275 msgid ":class:`c_longdouble`" msgstr "" -#: library/ctypes.rst:258 +#: library/ctypes.rst:275 msgid ":c:expr:`long double`" msgstr "" -#: library/ctypes.rst:260 +#: library/ctypes.rst:277 msgid ":class:`c_char_p`" msgstr "" -#: library/ctypes.rst:260 +#: library/ctypes.rst:277 msgid ":c:expr:`char *` (NUL terminated)" msgstr "" -#: library/ctypes.rst:260 +#: library/ctypes.rst:277 msgid "bytes object or ``None``" msgstr "" -#: library/ctypes.rst:262 +#: library/ctypes.rst:279 msgid ":class:`c_wchar_p`" msgstr "" -#: library/ctypes.rst:262 +#: library/ctypes.rst:279 msgid ":c:expr:`wchar_t *` (NUL terminated)" msgstr "" -#: library/ctypes.rst:262 +#: library/ctypes.rst:279 msgid "string or ``None``" msgstr "" -#: library/ctypes.rst:264 +#: library/ctypes.rst:281 msgid ":class:`c_void_p`" msgstr "" -#: library/ctypes.rst:264 +#: library/ctypes.rst:281 msgid ":c:expr:`void *`" msgstr "" -#: library/ctypes.rst:264 +#: library/ctypes.rst:281 msgid "int or ``None``" msgstr "" -#: library/ctypes.rst:268 +#: library/ctypes.rst:285 msgid "The constructor accepts any object with a truth value." msgstr "" -#: library/ctypes.rst:270 +#: library/ctypes.rst:287 +msgid "" +"Additionally, if IEC 60559 compatible complex arithmetic (Annex G) is " +"supported in both C and ``libffi``, the following complex types are " +"available:" +msgstr "" + +#: library/ctypes.rst:293 +msgid ":class:`c_float_complex`" +msgstr "" + +#: library/ctypes.rst:293 +msgid ":c:expr:`float complex`" +msgstr "" + +#: library/ctypes.rst:295 library/ctypes.rst:297 +msgid "complex" +msgstr "" + +#: library/ctypes.rst:295 +msgid ":class:`c_double_complex`" +msgstr "" + +#: library/ctypes.rst:295 +msgid ":c:expr:`double complex`" +msgstr "" + +#: library/ctypes.rst:297 +msgid ":class:`c_longdouble_complex`" +msgstr "" + +#: library/ctypes.rst:297 +msgid ":c:expr:`long double complex`" +msgstr "" + +#: library/ctypes.rst:301 msgid "" "All these types can be created by calling them with an optional initializer " "of the correct type and value::" msgstr "" -#: library/ctypes.rst:281 +#: library/ctypes.rst:304 +msgid "" +">>> c_int()\n" +"c_long(0)\n" +">>> c_wchar_p(\"Hello, World\")\n" +"c_wchar_p(140018365411392)\n" +">>> c_ushort(-3)\n" +"c_ushort(65533)\n" +">>>" +msgstr "" + +#: library/ctypes.rst:312 msgid "" "Since these types are mutable, their value can also be changed afterwards::" msgstr "" -#: library/ctypes.rst:293 +#: library/ctypes.rst:314 +msgid "" +">>> i = c_int(42)\n" +">>> print(i)\n" +"c_long(42)\n" +">>> print(i.value)\n" +"42\n" +">>> i.value = -99\n" +">>> print(i.value)\n" +"-99\n" +">>>" +msgstr "" + +#: library/ctypes.rst:324 msgid "" "Assigning a new value to instances of the pointer types :class:`c_char_p`, :" "class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they " "point to, *not the contents* of the memory block (of course not, because " -"Python bytes objects are immutable)::" +"Python string objects are immutable)::" +msgstr "" + +#: library/ctypes.rst:329 +msgid "" +">>> s = \"Hello, World\"\n" +">>> c_s = c_wchar_p(s)\n" +">>> print(c_s)\n" +"c_wchar_p(139966785747344)\n" +">>> print(c_s.value)\n" +"Hello World\n" +">>> c_s.value = \"Hi, there\"\n" +">>> print(c_s) # the memory location has changed\n" +"c_wchar_p(139966783348904)\n" +">>> print(c_s.value)\n" +"Hi, there\n" +">>> print(s) # first object is unchanged\n" +"Hello, World\n" +">>>" msgstr "" -#: library/ctypes.rst:313 +#: library/ctypes.rst:344 msgid "" "You should be careful, however, not to pass them to functions expecting " "pointers to mutable memory. If you need mutable memory blocks, ctypes has a :" @@ -466,7 +720,29 @@ msgid "" "``value`` property::" msgstr "" -#: library/ctypes.rst:337 +#: library/ctypes.rst:351 +msgid "" +">>> from ctypes import *\n" +">>> p = create_string_buffer(3) # create a 3 byte buffer, " +"initialized to NUL bytes\n" +">>> print(sizeof(p), repr(p.raw))\n" +"3 b'\\x00\\x00\\x00'\n" +">>> p = create_string_buffer(b\"Hello\") # create a buffer containing a " +"NUL terminated string\n" +">>> print(sizeof(p), repr(p.raw))\n" +"6 b'Hello\\x00'\n" +">>> print(repr(p.value))\n" +"b'Hello'\n" +">>> p = create_string_buffer(b\"Hello\", 10) # create a 10 byte buffer\n" +">>> print(sizeof(p), repr(p.raw))\n" +"10 b'Hello\\x00\\x00\\x00\\x00\\x00'\n" +">>> p.value = b\"Hi\"\n" +">>> print(sizeof(p), repr(p.raw))\n" +"10 b'Hi\\x00lo\\x00\\x00\\x00\\x00\\x00'\n" +">>>" +msgstr "" + +#: library/ctypes.rst:368 msgid "" "The :func:`create_string_buffer` function replaces the old :func:`!c_buffer` " "function (which is still available as an alias). To create a mutable memory " @@ -474,29 +750,57 @@ msgid "" "the :func:`create_unicode_buffer` function." msgstr "" -#: library/ctypes.rst:346 +#: library/ctypes.rst:377 msgid "Calling functions, continued" msgstr "" -#: library/ctypes.rst:348 +#: library/ctypes.rst:379 msgid "" "Note that printf prints to the real standard output channel, *not* to :data:" "`sys.stdout`, so these examples will only work at the console prompt, not " "from within *IDLE* or *PythonWin*::" msgstr "" -#: library/ctypes.rst:368 +#: library/ctypes.rst:383 +msgid "" +">>> printf = libc.printf\n" +">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" +"Hello, World!\n" +"14\n" +">>> printf(b\"Hello, %S\\n\", \"World!\")\n" +"Hello, World!\n" +"14\n" +">>> printf(b\"%d bottles of beer\\n\", 42)\n" +"42 bottles of beer\n" +"19\n" +">>> printf(b\"%f bottles of beer\\n\", 42.5)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert " +"parameter 2\n" +">>>" +msgstr "" + +#: library/ctypes.rst:399 msgid "" "As has been mentioned before, all Python types except integers, strings, and " "bytes objects have to be wrapped in their corresponding :mod:`ctypes` type, " "so that they can be converted to the required C data type::" msgstr "" -#: library/ctypes.rst:380 +#: library/ctypes.rst:403 +msgid "" +">>> printf(b\"An int %d, a double %f\\n\", 1234, c_double(3.14))\n" +"An int 1234, a double 3.140000\n" +"31\n" +">>>" +msgstr "" + +#: library/ctypes.rst:411 msgid "Calling variadic functions" msgstr "" -#: library/ctypes.rst:382 +#: library/ctypes.rst:413 msgid "" "On a lot of platforms calling variadic functions through ctypes is exactly " "the same as calling functions with a fixed number of parameters. On some " @@ -505,23 +809,27 @@ msgid "" "functions." msgstr "" -#: library/ctypes.rst:387 +#: library/ctypes.rst:418 msgid "" -"On those platforms it is required to specify the :attr:`~_FuncPtr.argtypes` " +"On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes` " "attribute for the regular, non-variadic, function arguments:" msgstr "" -#: library/ctypes.rst:394 +#: library/ctypes.rst:421 +msgid "libc.printf.argtypes = [ctypes.c_char_p]" +msgstr "" + +#: library/ctypes.rst:425 msgid "" "Because specifying the attribute does not inhibit portability it is advised " -"to always specify :attr:`~_FuncPtr.argtypes` for all variadic functions." +"to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions." msgstr "" -#: library/ctypes.rst:401 +#: library/ctypes.rst:432 msgid "Calling functions with your own custom data types" msgstr "" -#: library/ctypes.rst:403 +#: library/ctypes.rst:434 msgid "" "You can also customize :mod:`ctypes` argument conversion to allow instances " "of your own classes be used as function arguments. :mod:`ctypes` looks for " @@ -530,44 +838,79 @@ msgid "" "or an object with an :attr:`!_as_parameter_` attribute::" msgstr "" -#: library/ctypes.rst:419 +#: library/ctypes.rst:440 +msgid "" +">>> class Bottles:\n" +"... def __init__(self, number):\n" +"... self._as_parameter_ = number\n" +"...\n" +">>> bottles = Bottles(42)\n" +">>> printf(b\"%d bottles of beer\\n\", bottles)\n" +"42 bottles of beer\n" +"19\n" +">>>" +msgstr "" + +#: library/ctypes.rst:450 msgid "" "If you don't want to store the instance's data in the :attr:`!" "_as_parameter_` instance variable, you could define a :class:`property` " "which makes the attribute available on request." msgstr "" -#: library/ctypes.rst:427 +#: library/ctypes.rst:458 msgid "Specifying the required argument types (function prototypes)" msgstr "" -#: library/ctypes.rst:429 +#: library/ctypes.rst:460 msgid "" "It is possible to specify the required argument types of functions exported " -"from DLLs by setting the :attr:`~_FuncPtr.argtypes` attribute." +"from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute." msgstr "" -#: library/ctypes.rst:432 +#: library/ctypes.rst:463 msgid "" -":attr:`~_FuncPtr.argtypes` must be a sequence of C data types (the :func:`!" +":attr:`~_CFuncPtr.argtypes` must be a sequence of C data types (the :func:`!" "printf` function is probably not a good example here, because it takes a " "variable number and different types of parameters depending on the format " "string, on the other hand this is quite handy to experiment with this " "feature)::" msgstr "" -#: library/ctypes.rst:443 +#: library/ctypes.rst:468 +msgid "" +">>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double]\n" +">>> printf(b\"String '%s', Int %d, Double %f\\n\", b\"Hi\", 10, 2.2)\n" +"String 'Hi', Int 10, Double 2.200000\n" +"37\n" +">>>" +msgstr "" + +#: library/ctypes.rst:474 msgid "" "Specifying a format protects against incompatible argument types (just as a " "prototype for a C function), and tries to convert the arguments to valid " "types::" msgstr "" -#: library/ctypes.rst:455 +#: library/ctypes.rst:477 +msgid "" +">>> printf(b\"%d %d %d\", 1, 2, 3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be " +"interpreted as ctypes.c_char_p\n" +">>> printf(b\"%s %d %f\\n\", b\"X\", 2, 3)\n" +"X 2 3.000000\n" +"13\n" +">>>" +msgstr "" + +#: library/ctypes.rst:486 msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_FuncPtr.argtypes` sequence. The :meth:" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" "`~_CData.from_param` class method receives the Python object passed to the " "function call, it should do a typecheck or whatever is needed to make sure " "this object is acceptable, and then return the object itself, its :attr:`!" @@ -577,58 +920,122 @@ msgid "" "_as_parameter_` attribute." msgstr "" -#: library/ctypes.rst:469 +#: library/ctypes.rst:500 msgid "Return types" msgstr "" -#: library/ctypes.rst:479 +#: library/ctypes.rst:510 msgid "" "By default functions are assumed to return the C :c:expr:`int` type. Other " -"return types can be specified by setting the :attr:`~_FuncPtr.restype` " +"return types can be specified by setting the :attr:`~_CFuncPtr.restype` " "attribute of the function object." msgstr "" -#: library/ctypes.rst:483 +#: library/ctypes.rst:514 msgid "" "The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:" "type:`time_t` might be of a different type than the default return type :c:" "expr:`int`, you should specify the :attr:`!restype` attribute::" msgstr "" -#: library/ctypes.rst:489 -msgid "The argument types can be specified using :attr:`~_FuncPtr.argtypes`::" +#: library/ctypes.rst:518 +msgid ">>> libc.time.restype = c_time_t" +msgstr "" + +#: library/ctypes.rst:520 +msgid "The argument types can be specified using :attr:`~_CFuncPtr.argtypes`::" msgstr "" -#: library/ctypes.rst:493 +#: library/ctypes.rst:522 +msgid ">>> libc.time.argtypes = (POINTER(c_time_t),)" +msgstr "" + +#: library/ctypes.rst:524 msgid "" "To call the function with a ``NULL`` pointer as first argument, use " "``None``::" msgstr "" -#: library/ctypes.rst:498 +#: library/ctypes.rst:526 +msgid "" +">>> print(libc.time(None))\n" +"1150640792" +msgstr "" + +#: library/ctypes.rst:529 msgid "" "Here is a more advanced example, it uses the :func:`!strchr` function, which " "expects a string pointer and a char, and returns a pointer to a string::" msgstr "" -#: library/ctypes.rst:511 +#: library/ctypes.rst:532 +msgid "" +">>> strchr = libc.strchr\n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" +"8059983\n" +">>> strchr.restype = c_char_p # c_char_p is a pointer to a string\n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" +"b'def'\n" +">>> print(strchr(b\"abcdef\", ord(\"x\")))\n" +"None\n" +">>>" +msgstr "" + +#: library/ctypes.rst:542 msgid "" "If you want to avoid the :func:`ord(\"x\") ` calls above, you can set " -"the :attr:`~_FuncPtr.argtypes` attribute, and the second argument will be " +"the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be " "converted from a single character Python bytes object into a C char:" msgstr "" -#: library/ctypes.rst:530 +#: library/ctypes.rst:546 msgid "" -"You can also use a callable Python object (a function or a class for " -"example) as the :attr:`~_FuncPtr.restype` attribute, if the foreign function " -"returns an integer. The callable will be called with the *integer* the C " -"function returns, and the result of this call will be used as the result of " -"your function call. This is useful to check for error return values and " -"automatically raise an exception::" +">>> strchr.restype = c_char_p\n" +">>> strchr.argtypes = [c_char_p, c_char]\n" +">>> strchr(b\"abcdef\", b\"d\")\n" +"b'def'\n" +">>> strchr(b\"abcdef\", b\"def\")\n" +"Traceback (most recent call last):\n" +"ctypes.ArgumentError: argument 2: TypeError: one character bytes, bytearray " +"or integer expected\n" +">>> print(strchr(b\"abcdef\", b\"x\"))\n" +"None\n" +">>> strchr(b\"abcdef\", b\"d\")\n" +"b'def'\n" +">>>" msgstr "" -#: library/ctypes.rst:553 +#: library/ctypes.rst:561 +msgid "" +"You can also use a callable Python object (a function or a class for " +"example) as the :attr:`~_CFuncPtr.restype` attribute, if the foreign " +"function returns an integer. The callable will be called with the *integer* " +"the C function returns, and the result of this call will be used as the " +"result of your function call. This is useful to check for error return " +"values and automatically raise an exception::" +msgstr "" + +#: library/ctypes.rst:567 +msgid "" +">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" +">>> def ValidHandle(value):\n" +"... if value == 0:\n" +"... raise WinError()\n" +"... return value\n" +"...\n" +">>>\n" +">>> GetModuleHandle.restype = ValidHandle\n" +">>> GetModuleHandle(None)\n" +"486539264\n" +">>> GetModuleHandle(\"something silly\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 3, in ValidHandle\n" +"OSError: [Errno 126] The specified module could not be found.\n" +">>>" +msgstr "" + +#: library/ctypes.rst:584 msgid "" "``WinError`` is a function which will call Windows ``FormatMessage()`` api " "to get the string representation of an error code, and *returns* an " @@ -636,18 +1043,18 @@ msgid "" "used, it calls :func:`GetLastError` to retrieve it." msgstr "" -#: library/ctypes.rst:558 +#: library/ctypes.rst:589 msgid "" "Please note that a much more powerful error checking mechanism is available " -"through the :attr:`~_FuncPtr.errcheck` attribute; see the reference manual " +"through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual " "for details." msgstr "" -#: library/ctypes.rst:566 +#: library/ctypes.rst:597 msgid "Passing pointers (or: passing parameters by reference)" msgstr "" -#: library/ctypes.rst:568 +#: library/ctypes.rst:599 msgid "" "Sometimes a C api function expects a *pointer* to a data type as parameter, " "probably to write into the corresponding location, or if the data is too " @@ -655,7 +1062,7 @@ msgid "" "reference*." msgstr "" -#: library/ctypes.rst:572 +#: library/ctypes.rst:603 msgid "" ":mod:`ctypes` exports the :func:`byref` function which is used to pass " "parameters by reference. The same effect can be achieved with the :func:" @@ -664,11 +1071,26 @@ msgid "" "you don't need the pointer object in Python itself::" msgstr "" -#: library/ctypes.rst:594 +#: library/ctypes.rst:609 +msgid "" +">>> i = c_int()\n" +">>> f = c_float()\n" +">>> s = create_string_buffer(b'\\000' * 32)\n" +">>> print(i.value, f.value, repr(s.value))\n" +"0 0.0 b''\n" +">>> libc.sscanf(b\"1 3.14 Hello\", b\"%d %f %s\",\n" +"... byref(i), byref(f), s)\n" +"3\n" +">>> print(i.value, f.value, repr(s.value))\n" +"1 3.1400001049 b'Hello'\n" +">>>" +msgstr "" + +#: library/ctypes.rst:625 msgid "Structures and unions" msgstr "" -#: library/ctypes.rst:596 +#: library/ctypes.rst:627 msgid "" "Structures and unions must derive from the :class:`Structure` and :class:" "`Union` base classes which are defined in the :mod:`ctypes` module. Each " @@ -677,44 +1099,94 @@ msgid "" "*field type*." msgstr "" -#: library/ctypes.rst:601 +#: library/ctypes.rst:632 msgid "" "The field type must be a :mod:`ctypes` type like :class:`c_int`, or any " "other derived :mod:`ctypes` type: structure, union, array, pointer." msgstr "" -#: library/ctypes.rst:604 +#: library/ctypes.rst:635 msgid "" "Here is a simple example of a POINT structure, which contains two integers " "named *x* and *y*, and also shows how to initialize a structure in the " "constructor::" msgstr "" -#: library/ctypes.rst:624 +#: library/ctypes.rst:638 +msgid "" +">>> from ctypes import *\n" +">>> class POINT(Structure):\n" +"... _fields_ = [(\"x\", c_int),\n" +"... (\"y\", c_int)]\n" +"...\n" +">>> point = POINT(10, 20)\n" +">>> print(point.x, point.y)\n" +"10 20\n" +">>> point = POINT(y=5)\n" +">>> print(point.x, point.y)\n" +"0 5\n" +">>> POINT(1, 2, 3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: too many initializers\n" +">>>" +msgstr "" + +#: library/ctypes.rst:655 msgid "" "You can, however, build much more complicated structures. A structure can " "itself contain other structures by using a structure as a field type." msgstr "" -#: library/ctypes.rst:627 +#: library/ctypes.rst:658 msgid "" "Here is a RECT structure which contains two POINTs named *upperleft* and " "*lowerright*::" msgstr "" -#: library/ctypes.rst:641 +#: library/ctypes.rst:661 +msgid "" +">>> class RECT(Structure):\n" +"... _fields_ = [(\"upperleft\", POINT),\n" +"... (\"lowerright\", POINT)]\n" +"...\n" +">>> rc = RECT(point)\n" +">>> print(rc.upperleft.x, rc.upperleft.y)\n" +"0 5\n" +">>> print(rc.lowerright.x, rc.lowerright.y)\n" +"0 0\n" +">>>" +msgstr "" + +#: library/ctypes.rst:672 msgid "" "Nested structures can also be initialized in the constructor in several " "ways::" msgstr "" -#: library/ctypes.rst:646 +#: library/ctypes.rst:674 +msgid "" +">>> r = RECT(POINT(1, 2), POINT(3, 4))\n" +">>> r = RECT((1, 2), (3, 4))" +msgstr "" + +#: library/ctypes.rst:677 msgid "" "Field :term:`descriptor`\\s can be retrieved from the *class*, they are " -"useful for debugging because they can provide useful information::" +"useful for debugging because they can provide useful information. See :class:" +"`CField`::" +msgstr "" + +#: library/ctypes.rst:681 +msgid "" +">>> POINT.x\n" +"\n" +">>> POINT.y\n" +"\n" +">>>" msgstr "" -#: library/ctypes.rst:660 +#: library/ctypes.rst:692 msgid "" ":mod:`ctypes` does not support passing unions or structures with bit-fields " "to functions by value. While this may work on 32-bit x86, it's not " @@ -722,20 +1194,27 @@ msgid "" "structures with bit-fields should always be passed to functions by pointer." msgstr "" -#: library/ctypes.rst:666 -msgid "Structure/union alignment and byte order" +#: library/ctypes.rst:698 +msgid "Structure/union layout, alignment and byte order" msgstr "" -#: library/ctypes.rst:668 +#: library/ctypes.rst:700 msgid "" -"By default, Structure and Union fields are aligned in the same way the C " -"compiler does it. It is possible to override this behavior by specifying a :" -"attr:`~Structure._pack_` class attribute in the subclass definition. This " -"must be set to a positive integer and specifies the maximum alignment for " -"the fields. This is what ``#pragma pack(n)`` also does in MSVC." +"By default, Structure and Union fields are laid out in the same way the C " +"compiler does it. It is possible to override this behavior entirely by " +"specifying a :attr:`~Structure._layout_` class attribute in the subclass " +"definition; see the attribute documentation for details." msgstr "" -#: library/ctypes.rst:674 +#: library/ctypes.rst:705 +msgid "" +"It is possible to specify the maximum alignment for the fields and/or for " +"the structure itself by setting the class attributes :attr:`~Structure." +"_pack_` and/or :attr:`~Structure._align_`, respectively. See the attribute " +"documentation for details." +msgstr "" + +#: library/ctypes.rst:710 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " "build structures with non-native byte order, you can use one of the :class:" @@ -744,91 +1223,202 @@ msgid "" "classes cannot contain pointer fields." msgstr "" -#: library/ctypes.rst:684 +#: library/ctypes.rst:720 msgid "Bit fields in structures and unions" msgstr "" -#: library/ctypes.rst:686 +#: library/ctypes.rst:722 msgid "" "It is possible to create structures and unions containing bit fields. Bit " "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`~Structure._fields_` tuples::" msgstr "" -#: library/ctypes.rst:704 +#: library/ctypes.rst:726 +msgid "" +">>> class Int(Structure):\n" +"... _fields_ = [(\"first_16\", c_int, 16),\n" +"... (\"second_16\", c_int, 16)]\n" +"...\n" +">>> print(Int.first_16)\n" +"\n" +">>> print(Int.second_16)\n" +"" +msgstr "" + +#: library/ctypes.rst:735 +msgid "" +"It is important to note that bit field allocation and layout in memory are " +"not defined as a C standard; their implementation is compiler-specific. By " +"default, Python will attempt to match the behavior of a \"native\" compiler " +"for the current platform. See the :attr:`~Structure._layout_` attribute for " +"details on the default behavior and how to change it." +msgstr "" + +#: library/ctypes.rst:746 msgid "Arrays" msgstr "" -#: library/ctypes.rst:706 +#: library/ctypes.rst:748 msgid "" "Arrays are sequences, containing a fixed number of instances of the same " "type." msgstr "" -#: library/ctypes.rst:708 +#: library/ctypes.rst:750 msgid "" "The recommended way to create array types is by multiplying a data type with " "a positive integer::" msgstr "" -#: library/ctypes.rst:713 +#: library/ctypes.rst:753 +msgid "TenPointsArrayType = POINT * 10" +msgstr "" + +#: library/ctypes.rst:755 msgid "" "Here is an example of a somewhat artificial data type, a structure " "containing 4 POINTs among other stuff::" msgstr "" -#: library/ctypes.rst:729 +#: library/ctypes.rst:758 +msgid "" +">>> from ctypes import *\n" +">>> class POINT(Structure):\n" +"... _fields_ = (\"x\", c_int), (\"y\", c_int)\n" +"...\n" +">>> class MyStruct(Structure):\n" +"... _fields_ = [(\"a\", c_int),\n" +"... (\"b\", c_float),\n" +"... (\"point_array\", POINT * 4)]\n" +">>>\n" +">>> print(len(MyStruct().point_array))\n" +"4\n" +">>>" +msgstr "" + +#: library/ctypes.rst:771 msgid "Instances are created in the usual way, by calling the class::" msgstr "" -#: library/ctypes.rst:735 +#: library/ctypes.rst:773 +msgid "" +"arr = TenPointsArrayType()\n" +"for pt in arr:\n" +" print(pt.x, pt.y)" +msgstr "" + +#: library/ctypes.rst:777 msgid "" "The above code print a series of ``0 0`` lines, because the array contents " "is initialized to zeros." msgstr "" -#: library/ctypes.rst:738 +#: library/ctypes.rst:780 msgid "Initializers of the correct type can also be specified::" msgstr "" -#: library/ctypes.rst:754 +#: library/ctypes.rst:782 +msgid "" +">>> from ctypes import *\n" +">>> TenIntegers = c_int * 10\n" +">>> ii = TenIntegers(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\n" +">>> print(ii)\n" +"\n" +">>> for i in ii: print(i, end=\" \")\n" +"...\n" +"1 2 3 4 5 6 7 8 9 10\n" +">>>" +msgstr "" + +#: library/ctypes.rst:796 msgid "Pointers" msgstr "" -#: library/ctypes.rst:756 +#: library/ctypes.rst:798 msgid "" "Pointer instances are created by calling the :func:`pointer` function on a :" "mod:`ctypes` type::" msgstr "" -#: library/ctypes.rst:764 +#: library/ctypes.rst:801 +msgid "" +">>> from ctypes import *\n" +">>> i = c_int(42)\n" +">>> pi = pointer(i)\n" +">>>" +msgstr "" + +#: library/ctypes.rst:806 msgid "" "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " "the object to which the pointer points, the ``i`` object above::" msgstr "" -#: library/ctypes.rst:771 +#: library/ctypes.rst:809 +msgid "" +">>> pi.contents\n" +"c_long(42)\n" +">>>" +msgstr "" + +#: library/ctypes.rst:813 msgid "" "Note that :mod:`ctypes` does not have OOR (original object return), it " "constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" -#: library/ctypes.rst:780 +#: library/ctypes.rst:816 +msgid "" +">>> pi.contents is i\n" +"False\n" +">>> pi.contents is pi.contents\n" +"False\n" +">>>" +msgstr "" + +#: library/ctypes.rst:822 msgid "" "Assigning another :class:`c_int` instance to the pointer's contents " "attribute would cause the pointer to point to the memory location where this " "is stored::" msgstr "" -#: library/ctypes.rst:792 +#: library/ctypes.rst:825 +msgid "" +">>> i = c_int(99)\n" +">>> pi.contents = i\n" +">>> pi.contents\n" +"c_long(99)\n" +">>>" +msgstr "" + +#: library/ctypes.rst:834 msgid "Pointer instances can also be indexed with integers::" msgstr "" -#: library/ctypes.rst:798 +#: library/ctypes.rst:836 +msgid "" +">>> pi[0]\n" +"99\n" +">>>" +msgstr "" + +#: library/ctypes.rst:840 msgid "Assigning to an integer index changes the pointed to value::" msgstr "" -#: library/ctypes.rst:807 +#: library/ctypes.rst:842 +msgid "" +">>> print(i)\n" +"c_long(99)\n" +">>> pi[0] = 22\n" +">>> print(i)\n" +"c_long(22)\n" +">>>" +msgstr "" + +#: library/ctypes.rst:849 msgid "" "It is also possible to use indexes different from 0, but you must know what " "you're doing, just as in C: You can access or change arbitrary memory " @@ -837,7 +1427,7 @@ msgid "" "instead of a single item." msgstr "" -#: library/ctypes.rst:813 +#: library/ctypes.rst:855 msgid "" "Behind the scenes, the :func:`pointer` function does more than simply create " "pointer instances, it has to create pointer *types* first. This is done with " @@ -845,26 +1435,102 @@ msgid "" "returns a new type::" msgstr "" -#: library/ctypes.rst:829 +#: library/ctypes.rst:860 +msgid "" +">>> PI = POINTER(c_int)\n" +">>> PI\n" +"\n" +">>> PI(42)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: expected c_long instead of int\n" +">>> PI(c_int(42))\n" +"\n" +">>>" +msgstr "" + +#: library/ctypes.rst:871 msgid "" "Calling the pointer type without an argument creates a ``NULL`` pointer. " "``NULL`` pointers have a ``False`` boolean value::" msgstr "" -#: library/ctypes.rst:837 +#: library/ctypes.rst:874 +msgid "" +">>> null_ptr = POINTER(c_int)()\n" +">>> print(bool(null_ptr))\n" +"False\n" +">>>" +msgstr "" + +#: library/ctypes.rst:879 msgid "" ":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but " "dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" -#: library/ctypes.rst:856 +#: library/ctypes.rst:882 +msgid "" +">>> null_ptr[0]\n" +"Traceback (most recent call last):\n" +" ....\n" +"ValueError: NULL pointer access\n" +">>>\n" +"\n" +">>> null_ptr[0] = 1234\n" +"Traceback (most recent call last):\n" +" ....\n" +"ValueError: NULL pointer access\n" +">>>" +msgstr "" + +#: library/ctypes.rst:897 +msgid "Thread safety without the GIL" +msgstr "" + +#: library/ctypes.rst:899 +msgid "" +"From Python 3.13 onward, the :term:`GIL` can be disabled on :term:`free " +"threaded ` builds. In ctypes, reads and writes to a single " +"object concurrently is safe, but not across multiple objects:" +msgstr "" + +#: library/ctypes.rst:902 +msgid "" +">>> number = c_int(42)\n" +">>> pointer_a = pointer(number)\n" +">>> pointer_b = pointer(number)" +msgstr "" + +#: library/ctypes.rst:908 +msgid "" +"In the above, it's only safe for one object to read and write to the address " +"at once if the GIL is disabled. So, ``pointer_a`` can be shared and written " +"to across multiple threads, but only if ``pointer_b`` is not also attempting " +"to do the same. If this is an issue, consider using a :class:`threading." +"Lock` to synchronize access to memory:" +msgstr "" + +#: library/ctypes.rst:913 +msgid "" +">>> import threading\n" +">>> lock = threading.Lock()\n" +">>> # Thread 1\n" +">>> with lock:\n" +"... pointer_a.contents = 24\n" +">>> # Thread 2\n" +">>> with lock:\n" +"... pointer_b.contents = 42" +msgstr "" + +#: library/ctypes.rst:928 msgid "Type conversions" msgstr "" -#: library/ctypes.rst:858 +#: library/ctypes.rst:930 msgid "" "Usually, ctypes does strict type checking. This means, if you have " -"``POINTER(c_int)`` in the :attr:`~_FuncPtr.argtypes` list of a function or " +"``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or " "as the type of a member field in a structure definition, only instances of " "exactly the same type are accepted. There are some exceptions to this rule, " "where ctypes accepts other objects. For example, you can pass compatible " @@ -872,20 +1538,43 @@ msgid "" "ctypes accepts an array of c_int::" msgstr "" -#: library/ctypes.rst:879 +#: library/ctypes.rst:937 +msgid "" +">>> class Bar(Structure):\n" +"... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" +"...\n" +">>> bar = Bar()\n" +">>> bar.values = (c_int * 3)(1, 2, 3)\n" +">>> bar.count = 3\n" +">>> for i in range(bar.count):\n" +"... print(bar.values[i])\n" +"...\n" +"1\n" +"2\n" +"3\n" +">>>" +msgstr "" + +#: library/ctypes.rst:951 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " -"type (such as ``POINTER(c_int)``) in :attr:`~_FuncPtr.argtypes`, an object " +"type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object " "of the pointed type (``c_int`` in this case) can be passed to the function. " "ctypes will apply the required :func:`byref` conversion in this case " "automatically." msgstr "" -#: library/ctypes.rst:884 +#: library/ctypes.rst:956 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" -#: library/ctypes.rst:891 +#: library/ctypes.rst:958 +msgid "" +">>> bar.values = None\n" +">>>" +msgstr "" + +#: library/ctypes.rst:963 msgid "" "Sometimes you have instances of incompatible types. In C, you can cast one " "type into another type. :mod:`ctypes` provides a :func:`cast` function " @@ -894,11 +1583,21 @@ msgid "" "``values`` field, but not instances of other types::" msgstr "" -#: library/ctypes.rst:903 +#: library/ctypes.rst:969 +msgid "" +">>> bar.values = (c_byte * 4)()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long " +"instance\n" +">>>" +msgstr "" + +#: library/ctypes.rst:975 msgid "For these cases, the :func:`cast` function is handy." msgstr "" -#: library/ctypes.rst:905 +#: library/ctypes.rst:977 msgid "" "The :func:`cast` function can be used to cast a ctypes instance into a " "pointer to a different ctypes data type. :func:`cast` takes two parameters, " @@ -907,60 +1606,128 @@ msgid "" "references the same memory block as the first argument::" msgstr "" -#: library/ctypes.rst:916 +#: library/ctypes.rst:983 +msgid "" +">>> a = (c_byte * 4)()\n" +">>> cast(a, POINTER(c_int))\n" +"\n" +">>>" +msgstr "" + +#: library/ctypes.rst:988 msgid "" "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " "the structure::" msgstr "" -#: library/ctypes.rst:929 +#: library/ctypes.rst:991 +msgid "" +">>> bar = Bar()\n" +">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" +">>> print(bar.values[0])\n" +"0\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1001 msgid "Incomplete Types" msgstr "" -#: library/ctypes.rst:931 +#: library/ctypes.rst:1003 msgid "" "*Incomplete Types* are structures, unions or arrays whose members are not " "yet specified. In C, they are specified by forward declarations, which are " "defined later::" msgstr "" -#: library/ctypes.rst:942 +#: library/ctypes.rst:1007 +msgid "" +"struct cell; /* forward declaration */\n" +"\n" +"struct cell {\n" +" char *name;\n" +" struct cell *next;\n" +"};" +msgstr "" + +#: library/ctypes.rst:1014 msgid "" "The straightforward translation into ctypes code would be this, but it does " "not work::" msgstr "" -#: library/ctypes.rst:955 +#: library/ctypes.rst:1017 +msgid "" +">>> class cell(Structure):\n" +"... _fields_ = [(\"name\", c_char_p),\n" +"... (\"next\", POINTER(cell))]\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 2, in cell\n" +"NameError: name 'cell' is not defined\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1027 msgid "" "because the new ``class cell`` is not available in the class statement " "itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" "`~Structure._fields_` attribute later, after the class statement::" msgstr "" -#: library/ctypes.rst:967 +#: library/ctypes.rst:1031 +msgid "" +">>> from ctypes import *\n" +">>> class cell(Structure):\n" +"... pass\n" +"...\n" +">>> cell._fields_ = [(\"name\", c_char_p),\n" +"... (\"next\", POINTER(cell))]\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1039 msgid "" "Let's try it. We create two instances of ``cell``, and let them point to " "each other, and finally follow the pointer chain a few times::" msgstr "" -#: library/ctypes.rst:988 +#: library/ctypes.rst:1042 +msgid "" +">>> c1 = cell()\n" +">>> c1.name = b\"foo\"\n" +">>> c2 = cell()\n" +">>> c2.name = b\"bar\"\n" +">>> c1.next = pointer(c2)\n" +">>> c2.next = pointer(c1)\n" +">>> p = c1\n" +">>> for i in range(8):\n" +"... print(p.name, end=\" \")\n" +"... p = p.next[0]\n" +"...\n" +"foo bar foo bar foo bar foo bar\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1060 msgid "Callback functions" msgstr "" -#: library/ctypes.rst:990 +#: library/ctypes.rst:1062 msgid "" ":mod:`ctypes` allows creating C callable function pointers from Python " "callables. These are sometimes called *callback functions*." msgstr "" -#: library/ctypes.rst:993 +#: library/ctypes.rst:1065 msgid "" "First, you must create a class for the callback function. The class knows " "the calling convention, the return type, and the number and types of " "arguments this function will receive." msgstr "" -#: library/ctypes.rst:997 +#: library/ctypes.rst:1069 msgid "" "The :func:`CFUNCTYPE` factory function creates types for callback functions " "using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` " @@ -968,21 +1735,30 @@ msgid "" "calling convention." msgstr "" -#: library/ctypes.rst:1002 +#: library/ctypes.rst:1074 msgid "" "Both of these factory functions are called with the result type as first " "argument, and the callback functions expected argument types as the " "remaining arguments." msgstr "" -#: library/ctypes.rst:1006 +#: library/ctypes.rst:1078 msgid "" "I will present an example here which uses the standard C library's :c:func:`!" "qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`!qsort` will be used to sort an array of integers::" msgstr "" -#: library/ctypes.rst:1016 +#: library/ctypes.rst:1082 +msgid "" +">>> IntArray5 = c_int * 5\n" +">>> ia = IntArray5(5, 1, 7, 33, 99)\n" +">>> qsort = libc.qsort\n" +">>> qsort.restype = None\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1088 msgid "" ":func:`!qsort` must be called with a pointer to the data to sort, the number " "of items in the data array, the size of one item, and a pointer to the " @@ -992,44 +1768,111 @@ msgid "" "otherwise." msgstr "" -#: library/ctypes.rst:1022 +#: library/ctypes.rst:1094 msgid "" "So our callback function receives pointers to integers, and must return an " "integer. First we create the ``type`` for the callback function::" msgstr "" -#: library/ctypes.rst:1028 +#: library/ctypes.rst:1097 +msgid "" +">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1100 msgid "" "To get started, here is a simple callback that shows the values it gets " "passed::" msgstr "" -#: library/ctypes.rst:1038 +#: library/ctypes.rst:1103 +msgid "" +">>> def py_cmp_func(a, b):\n" +"... print(\"py_cmp_func\", a[0], b[0])\n" +"... return 0\n" +"...\n" +">>> cmp_func = CMPFUNC(py_cmp_func)\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1110 msgid "The result::" msgstr "" -#: library/ctypes.rst:1048 +#: library/ctypes.rst:1112 +msgid "" +">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" +"py_cmp_func 5 1\n" +"py_cmp_func 33 99\n" +"py_cmp_func 7 33\n" +"py_cmp_func 5 7\n" +"py_cmp_func 1 7\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1120 msgid "Now we can actually compare the two items and return a useful result::" msgstr "" -#: library/ctypes.rst:1063 +#: library/ctypes.rst:1122 +msgid "" +">>> def py_cmp_func(a, b):\n" +"... print(\"py_cmp_func\", a[0], b[0])\n" +"... return a[0] - b[0]\n" +"...\n" +">>>\n" +">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n" +"py_cmp_func 5 1\n" +"py_cmp_func 33 99\n" +"py_cmp_func 7 33\n" +"py_cmp_func 1 7\n" +"py_cmp_func 5 7\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1135 msgid "As we can easily check, our array is sorted now::" msgstr "" -#: library/ctypes.rst:1070 +#: library/ctypes.rst:1137 +msgid "" +">>> for i in ia: print(i, end=\" \")\n" +"...\n" +"1 5 7 33 99\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1142 msgid "" "The function factories can be used as decorator factories, so we may as well " "write::" msgstr "" -#: library/ctypes.rst:1088 +#: library/ctypes.rst:1145 +msgid "" +">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" +"... def py_cmp_func(a, b):\n" +"... print(\"py_cmp_func\", a[0], b[0])\n" +"... return a[0] - b[0]\n" +"...\n" +">>> qsort(ia, len(ia), sizeof(c_int), py_cmp_func)\n" +"py_cmp_func 5 1\n" +"py_cmp_func 33 99\n" +"py_cmp_func 7 33\n" +"py_cmp_func 1 7\n" +"py_cmp_func 5 7\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1160 msgid "" "Make sure you keep references to :func:`CFUNCTYPE` objects as long as they " "are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be " "garbage collected, crashing your program when a callback is made." msgstr "" -#: library/ctypes.rst:1092 +#: library/ctypes.rst:1164 msgid "" "Also, note that if the callback function is called in a thread created " "outside of Python's control (e.g. by the foreign code that calls the " @@ -1039,35 +1882,42 @@ msgid "" "even when those calls are made from the same C thread." msgstr "" -#: library/ctypes.rst:1102 +#: library/ctypes.rst:1174 msgid "Accessing values exported from dlls" msgstr "" -#: library/ctypes.rst:1104 +#: library/ctypes.rst:1176 msgid "" "Some shared libraries not only export functions, they also export variables. " "An example in the Python library itself is the :c:data:`Py_Version`, Python " "runtime version number encoded in a single constant integer." msgstr "" -#: library/ctypes.rst:1108 +#: library/ctypes.rst:1180 msgid "" ":mod:`ctypes` can access values like this with the :meth:`~_CData.in_dll` " "class methods of the type. *pythonapi* is a predefined symbol giving access " "to the Python C api::" msgstr "" -#: library/ctypes.rst:1116 +#: library/ctypes.rst:1184 +msgid "" +">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" +">>> print(hex(version.value))\n" +"0x30c00a0" +msgstr "" + +#: library/ctypes.rst:1188 msgid "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" -#: library/ctypes.rst:1119 +#: library/ctypes.rst:1191 msgid "Quoting the docs for that value:" msgstr "" -#: library/ctypes.rst:1121 +#: library/ctypes.rst:1193 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -1076,19 +1926,40 @@ msgid "" "frozen modules." msgstr "" -#: library/ctypes.rst:1126 +#: library/ctypes.rst:1198 msgid "" "So manipulating this pointer could even prove useful. To restrict the " "example size, we show only how this table can be read with :mod:`ctypes`::" msgstr "" -#: library/ctypes.rst:1140 +#: library/ctypes.rst:1201 +msgid "" +">>> from ctypes import *\n" +">>>\n" +">>> class struct_frozen(Structure):\n" +"... _fields_ = [(\"name\", c_char_p),\n" +"... (\"code\", POINTER(c_ubyte)),\n" +"... (\"size\", c_int),\n" +"... (\"get_code\", POINTER(c_ubyte)), # Function pointer\n" +"... ]\n" +"...\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1212 msgid "" "We have defined the :c:struct:`_frozen` data type, so we can get the pointer " "to the table::" msgstr "" -#: library/ctypes.rst:1147 +#: library/ctypes.rst:1215 +msgid "" +">>> FrozenTable = POINTER(struct_frozen)\n" +">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1219 msgid "" "Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, " "we can iterate over it, but we just have to make sure that our loop " @@ -1097,34 +1968,76 @@ msgid "" "the loop when we hit the ``NULL`` entry::" msgstr "" -#: library/ctypes.rst:1163 +#: library/ctypes.rst:1225 +msgid "" +">>> for item in table:\n" +"... if item.name is None:\n" +"... break\n" +"... print(item.name.decode(\"ascii\"), item.size)\n" +"...\n" +"_frozen_importlib 31764\n" +"_frozen_importlib_external 41499\n" +"zipimport 12345\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1235 msgid "" "The fact that standard Python has a frozen module and a frozen package " "(indicated by the negative ``size`` member) is not well known, it is only " "used for testing. Try it out with ``import __hello__`` for example." msgstr "" -#: library/ctypes.rst:1171 +#: library/ctypes.rst:1243 msgid "Surprises" msgstr "" -#: library/ctypes.rst:1173 +#: library/ctypes.rst:1245 msgid "" "There are some edges in :mod:`ctypes` where you might expect something other " "than what actually happens." msgstr "" -#: library/ctypes.rst:1176 +#: library/ctypes.rst:1248 msgid "Consider the following example::" msgstr "" -#: library/ctypes.rst:1196 +#: library/ctypes.rst:1250 +msgid "" +">>> from ctypes import *\n" +">>> class POINT(Structure):\n" +"... _fields_ = (\"x\", c_int), (\"y\", c_int)\n" +"...\n" +">>> class RECT(Structure):\n" +"... _fields_ = (\"a\", POINT), (\"b\", POINT)\n" +"...\n" +">>> p1 = POINT(1, 2)\n" +">>> p2 = POINT(3, 4)\n" +">>> rc = RECT(p1, p2)\n" +">>> print(rc.a.x, rc.a.y, rc.b.x, rc.b.y)\n" +"1 2 3 4\n" +">>> # now swap the two points\n" +">>> rc.a, rc.b = rc.b, rc.a\n" +">>> print(rc.a.x, rc.a.y, rc.b.x, rc.b.y)\n" +"3 4 3 4\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1268 msgid "" "Hm. We certainly expected the last statement to print ``3 4 1 2``. What " "happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" -#: library/ctypes.rst:1204 +#: library/ctypes.rst:1271 +msgid "" +">>> temp0, temp1 = rc.b, rc.a\n" +">>> rc.a = temp0\n" +">>> rc.b = temp1\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1276 msgid "" "Note that ``temp0`` and ``temp1`` are objects still using the internal " "buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " @@ -1133,26 +2046,37 @@ msgid "" "have the expected effect." msgstr "" -#: library/ctypes.rst:1210 +#: library/ctypes.rst:1282 msgid "" "Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays " "doesn't *copy* the sub-object, instead it retrieves a wrapper object " "accessing the root-object's underlying buffer." msgstr "" -#: library/ctypes.rst:1214 +#: library/ctypes.rst:1286 msgid "" "Another example that may behave differently from what one would expect is " "this::" msgstr "" -#: library/ctypes.rst:1226 +#: library/ctypes.rst:1288 +msgid "" +">>> s = c_char_p()\n" +">>> s.value = b\"abc def ghi\"\n" +">>> s.value\n" +"b'abc def ghi'\n" +">>> s.value is s.value\n" +"False\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1298 msgid "" "Objects instantiated from :class:`c_char_p` can only have their value set to " "bytes or integers." msgstr "" -#: library/ctypes.rst:1229 +#: library/ctypes.rst:1301 msgid "" "Why is it printing ``False``? ctypes instances are objects containing a " "memory block plus some :term:`descriptor`\\s accessing the contents of the " @@ -1161,16 +2085,16 @@ msgid "" "the contents again constructs a new Python object each time!" msgstr "" -#: library/ctypes.rst:1239 +#: library/ctypes.rst:1311 msgid "Variable-sized data types" msgstr "" -#: library/ctypes.rst:1241 +#: library/ctypes.rst:1313 msgid "" ":mod:`ctypes` provides some support for variable-sized arrays and structures." msgstr "" -#: library/ctypes.rst:1243 +#: library/ctypes.rst:1315 msgid "" "The :func:`resize` function can be used to resize the memory buffer of an " "existing ctypes object. The function takes the object as first argument, " @@ -1179,35 +2103,63 @@ msgid "" "objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" -#: library/ctypes.rst:1263 +#: library/ctypes.rst:1321 +msgid "" +">>> short_array = (c_short * 4)()\n" +">>> print(sizeof(short_array))\n" +"8\n" +">>> resize(short_array, 4)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: minimum size is 8\n" +">>> resize(short_array, 32)\n" +">>> sizeof(short_array)\n" +"32\n" +">>> sizeof(type(short_array))\n" +"8\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1335 msgid "" "This is nice and fine, but how would one access the additional elements " "contained in this array? Since the type still only knows about 4 elements, " "we get errors accessing other elements::" msgstr "" -#: library/ctypes.rst:1275 +#: library/ctypes.rst:1339 +msgid "" +">>> short_array[:]\n" +"[0, 0, 0, 0]\n" +">>> short_array[7]\n" +"Traceback (most recent call last):\n" +" ...\n" +"IndexError: invalid index\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1347 msgid "" "Another way to use variable-sized data types with :mod:`ctypes` is to use " "the dynamic nature of Python, and (re-)define the data type after the " "required size is already known, on a case by case basis." msgstr "" -#: library/ctypes.rst:1283 +#: library/ctypes.rst:1355 msgid "ctypes reference" msgstr "" -#: library/ctypes.rst:1289 +#: library/ctypes.rst:1361 msgid "Finding shared libraries" msgstr "" -#: library/ctypes.rst:1291 +#: library/ctypes.rst:1363 msgid "" "When programming in a compiled language, shared libraries are accessed when " "compiling/linking a program, and when the program is run." msgstr "" -#: library/ctypes.rst:1294 +#: library/ctypes.rst:1366 msgid "" "The purpose of the :func:`~ctypes.util.find_library` function is to locate a " "library in a way similar to what the compiler or runtime loader does (on " @@ -1216,13 +2168,13 @@ msgid "" "and call the runtime loader directly." msgstr "" -#: library/ctypes.rst:1300 +#: library/ctypes.rst:1372 msgid "" "The :mod:`!ctypes.util` module provides a function which can help to " "determine the library to load." msgstr "" -#: library/ctypes.rst:1308 +#: library/ctypes.rst:1380 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version " @@ -1230,36 +2182,62 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: library/ctypes.rst:1973 +#: library/ctypes.rst:2133 msgid "The exact functionality is system dependent." msgstr "" -#: library/ctypes.rst:1315 +#: library/ctypes.rst:1387 msgid "" "On Linux, :func:`~ctypes.util.find_library` tries to run external programs " "(``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library " "file. It returns the filename of the library file." msgstr "" -#: library/ctypes.rst:1319 +#: library/ctypes.rst:1391 msgid "" "On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used " "when searching for libraries, if a library cannot be found by any other " "means." msgstr "" -#: library/ctypes.rst:1323 +#: library/ctypes.rst:1395 msgid "Here are some examples::" msgstr "" -#: library/ctypes.rst:1334 +#: library/ctypes.rst:1397 +msgid "" +">>> from ctypes.util import find_library\n" +">>> find_library(\"m\")\n" +"'libm.so.6'\n" +">>> find_library(\"c\")\n" +"'libc.so.6'\n" +">>> find_library(\"bz2\")\n" +"'libbz2.so.1.0'\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1406 +msgid "" +"On macOS and Android, :func:`~ctypes.util.find_library` uses the system's " +"standard naming schemes and paths to locate the library, and returns a full " +"pathname if successful::" +msgstr "" + +#: library/ctypes.rst:1410 msgid "" -"On macOS, :func:`~ctypes.util.find_library` tries several predefined naming " -"schemes and paths to locate the library, and returns a full pathname if " -"successful::" +">>> from ctypes.util import find_library\n" +">>> find_library(\"c\")\n" +"'/usr/lib/libc.dylib'\n" +">>> find_library(\"m\")\n" +"'/usr/lib/libm.dylib'\n" +">>> find_library(\"bz2\")\n" +"'/usr/lib/libbz2.dylib'\n" +">>> find_library(\"AGL\")\n" +"'/System/Library/Frameworks/AGL.framework/AGL'\n" +">>>" msgstr "" -#: library/ctypes.rst:1348 +#: library/ctypes.rst:1421 msgid "" "On Windows, :func:`~ctypes.util.find_library` searches along the system " "search path, and returns the full pathname, but since there is no predefined " @@ -1267,7 +2245,7 @@ msgid "" "``None``." msgstr "" -#: library/ctypes.rst:1352 +#: library/ctypes.rst:1425 msgid "" "If wrapping a shared library with :mod:`ctypes`, it *may* be better to " "determine the shared library name at development time, and hardcode that " @@ -1275,24 +2253,59 @@ msgid "" "to locate the library at runtime." msgstr "" -#: library/ctypes.rst:1360 +#: library/ctypes.rst:1433 +msgid "Listing loaded shared libraries" +msgstr "" + +#: library/ctypes.rst:1435 +msgid "" +"When writing code that relies on code loaded from shared libraries, it can " +"be useful to know which shared libraries have already been loaded into the " +"current process." +msgstr "" + +#: library/ctypes.rst:1439 +msgid "" +"The :mod:`!ctypes.util` module provides the :func:`~ctypes.util.dllist` " +"function, which calls the different APIs provided by the various platforms " +"to help determine which shared libraries have already been loaded into the " +"current process." +msgstr "" + +#: library/ctypes.rst:1443 +msgid "" +"The exact output of this function will be system dependent. On most " +"platforms, the first entry of this list represents the current process " +"itself, which may be an empty string. For example, on glibc-based Linux, the " +"return may look like::" +msgstr "" + +#: library/ctypes.rst:1448 +msgid "" +">>> from ctypes.util import dllist\n" +">>> dllist()\n" +"['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" +"linux-gnu/libc.so.6', ... ]" +msgstr "" + +#: library/ctypes.rst:1455 msgid "Loading shared libraries" msgstr "" -#: library/ctypes.rst:1362 +#: library/ctypes.rst:1457 msgid "" "There are several ways to load shared libraries into the Python process. " "One way is to instantiate one of the following classes:" msgstr "" -#: library/ctypes.rst:1368 +#: library/ctypes.rst:1463 msgid "" "Instances of this class represent loaded shared libraries. Functions in " "these libraries use the standard C calling convention, and are assumed to " "return :c:expr:`int`." msgstr "" -#: library/ctypes.rst:1372 +#: library/ctypes.rst:1467 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " "exists. When a dependent DLL of the loaded DLL is not found, a :exc:" @@ -1304,46 +2317,52 @@ msgid "" "determine which one is not found using Windows debugging and tracing tools." msgstr "" -#: library/ctypes.rst:1407 library/ctypes.rst:1435 +#: library/ctypes.rst:1504 library/ctypes.rst:1535 msgid "The *name* parameter can now be a :term:`path-like object`." msgstr "" -#: library/ctypes.rst:1388 +#: library/ctypes.rst:1483 msgid "" "`Microsoft DUMPBIN tool `_ -- A tool to find DLL dependents." msgstr "" -#: library/ctypes.rst:1394 +#: library/ctypes.rst:1489 msgid "" -"Windows only: Instances of this class represent loaded shared libraries, " -"functions in these libraries use the ``stdcall`` calling convention, and are " -"assumed to return the windows specific :class:`HRESULT` code. :class:" -"`HRESULT` values contain information specifying whether the function call " -"failed or succeeded, together with additional error code. If the return " -"value signals a failure, an :class:`OSError` is automatically raised." +"Instances of this class represent loaded shared libraries, functions in " +"these libraries use the ``stdcall`` calling convention, and are assumed to " +"return the windows specific :class:`HRESULT` code. :class:`HRESULT` values " +"contain information specifying whether the function call failed or " +"succeeded, together with additional error code. If the return value signals " +"a failure, an :class:`OSError` is automatically raised." msgstr "" -#: library/ctypes.rst:1401 +#: library/ctypes.rst:1513 library/ctypes.rst:1665 library/ctypes.rst:1889 +#: library/ctypes.rst:2113 library/ctypes.rst:2147 library/ctypes.rst:2170 +#: library/ctypes.rst:2194 library/ctypes.rst:2288 library/ctypes.rst:3106 +msgid "Availability" +msgstr "" + +#: library/ctypes.rst:1498 msgid "" ":exc:`WindowsError` used to be raised, which is now an alias of :exc:" "`OSError`." msgstr "" -#: library/ctypes.rst:1412 +#: library/ctypes.rst:1509 msgid "" -"Windows only: Instances of this class represent loaded shared libraries, " -"functions in these libraries use the ``stdcall`` calling convention, and are " -"assumed to return :c:expr:`int` by default." +"Instances of this class represent loaded shared libraries, functions in " +"these libraries use the ``stdcall`` calling convention, and are assumed to " +"return :c:expr:`int` by default." msgstr "" -#: library/ctypes.rst:1420 +#: library/ctypes.rst:1520 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -#: library/ctypes.rst:1426 +#: library/ctypes.rst:1526 msgid "" "Instances of this class behave like :class:`CDLL` instances, except that the " "Python GIL is *not* released during the function call, and after the " @@ -1351,21 +2370,21 @@ msgid "" "set, a Python exception is raised." msgstr "" -#: library/ctypes.rst:1431 +#: library/ctypes.rst:1531 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" -#: library/ctypes.rst:1437 +#: library/ctypes.rst:1537 msgid "" "All these classes can be instantiated by calling them with at least one " "argument, the pathname of the shared library. If you have an existing " "handle to an already loaded shared library, it can be passed as the " -"``handle`` named parameter, otherwise the underlying platforms :c:func:`!" +"``handle`` named parameter, otherwise the underlying platform's :c:func:`!" "dlopen` or :c:func:`!LoadLibrary` function is used to load the library into " "the process, and to get a handle to it." msgstr "" -#: library/ctypes.rst:1444 +#: library/ctypes.rst:1544 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " @@ -1373,24 +2392,24 @@ msgid "" "configurable." msgstr "" -#: library/ctypes.rst:1449 +#: library/ctypes.rst:1549 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " "allows accessing the system :data:`errno` error number in a safe way. :mod:" -"`ctypes` maintains a thread-local copy of the systems :data:`errno` " +"`ctypes` maintains a thread-local copy of the system's :data:`errno` " "variable; if you call foreign functions created with ``use_errno=True`` then " "the :data:`errno` value before the function call is swapped with the ctypes " "private copy, the same happens immediately after the function call." msgstr "" -#: library/ctypes.rst:1456 +#: library/ctypes.rst:1556 msgid "" "The function :func:`ctypes.get_errno` returns the value of the ctypes " "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" -#: library/ctypes.rst:1460 +#: library/ctypes.rst:1560 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " "for the Windows error code which is managed by the :func:`GetLastError` and :" @@ -1399,7 +2418,7 @@ msgid "" "private copy of the windows error code." msgstr "" -#: library/ctypes.rst:1466 +#: library/ctypes.rst:1566 msgid "" "The *winmode* parameter is used on Windows to specify how the library is " "loaded (since *mode* is ignored). It takes any value that is valid for the " @@ -1409,29 +2428,29 @@ msgid "" "ensure the correct library and dependencies are loaded." msgstr "" -#: library/ctypes.rst:1473 +#: library/ctypes.rst:1573 msgid "Added *winmode* parameter." msgstr "" -#: library/ctypes.rst:1480 +#: library/ctypes.rst:1580 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" -#: library/ctypes.rst:1487 +#: library/ctypes.rst:1587 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" -#: library/ctypes.rst:1494 +#: library/ctypes.rst:1594 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -#: library/ctypes.rst:1497 +#: library/ctypes.rst:1597 msgid "" "Instances of these classes have no public methods. Functions exported by " "the shared library can be accessed as attributes or by index. Please note " @@ -1440,21 +2459,31 @@ msgid "" "other hand, accessing it through an index returns a new object each time::" msgstr "" -#: library/ctypes.rst:1510 +#: library/ctypes.rst:1603 +msgid "" +">>> from ctypes import CDLL\n" +">>> libc = CDLL(\"libc.so.6\") # On Linux\n" +">>> libc.time == libc.time\n" +"True\n" +">>> libc['time'] == libc['time']\n" +"False" +msgstr "" + +#: library/ctypes.rst:1610 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" -#: library/ctypes.rst:1516 +#: library/ctypes.rst:1616 msgid "The system handle used to access the library." msgstr "" -#: library/ctypes.rst:1521 +#: library/ctypes.rst:1621 msgid "The name of the library passed in the constructor." msgstr "" -#: library/ctypes.rst:1523 +#: library/ctypes.rst:1623 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " @@ -1462,13 +2491,13 @@ msgid "" "library as attribute of the loader instance." msgstr "" -#: library/ctypes.rst:1531 +#: library/ctypes.rst:1631 msgid "" "Class which loads shared libraries. *dlltype* should be one of the :class:" "`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -#: library/ctypes.rst:1534 +#: library/ctypes.rst:1634 msgid "" ":meth:`!__getattr__` has special behavior: It allows loading a shared " "library by accessing it as attribute of a library loader instance. The " @@ -1476,39 +2505,39 @@ msgid "" "each time." msgstr "" -#: library/ctypes.rst:1540 +#: library/ctypes.rst:1640 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" -#: library/ctypes.rst:1544 +#: library/ctypes.rst:1644 msgid "These prefabricated library loaders are available:" msgstr "" -#: library/ctypes.rst:1549 +#: library/ctypes.rst:1649 msgid "Creates :class:`CDLL` instances." msgstr "" -#: library/ctypes.rst:1555 -msgid "Windows only: Creates :class:`WinDLL` instances." +#: library/ctypes.rst:1655 +msgid "Creates :class:`WinDLL` instances." msgstr "" -#: library/ctypes.rst:1561 -msgid "Windows only: Creates :class:`OleDLL` instances." +#: library/ctypes.rst:1663 +msgid "Creates :class:`OleDLL` instances." msgstr "" -#: library/ctypes.rst:1567 +#: library/ctypes.rst:1671 msgid "Creates :class:`PyDLL` instances." msgstr "" -#: library/ctypes.rst:1570 +#: library/ctypes.rst:1674 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" -#: library/ctypes.rst:1576 +#: library/ctypes.rst:1680 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " "attributes. Note that all these functions are assumed to return C :c:expr:" @@ -1516,81 +2545,79 @@ msgid "" "correct :attr:`!restype` attribute to use these functions." msgstr "" -#: library/ctypes.rst:1581 -msgid "" -"Raises an :ref:`auditing event ` ``ctypes.dlopen`` with argument " -"``name``." -msgstr "" - -#: library/ctypes.rst:1583 +#: library/ctypes.rst:1687 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" -#: library/ctypes.rst:1587 -msgid "" -"Raises an :ref:`auditing event ` ``ctypes.dlsym`` with arguments " -"``library``, ``name``." -msgstr "" - -#: library/ctypes.rst:1589 +#: library/ctypes.rst:1693 msgid "" "Accessing a function on a loaded library raises an auditing event ``ctypes." "dlsym`` with arguments ``library`` (the library object) and ``name`` (the " "symbol's name as a string or integer)." msgstr "" -#: library/ctypes.rst:1593 -msgid "" -"Raises an :ref:`auditing event ` ``ctypes.dlsym/handle`` with " -"arguments ``handle``, ``name``." -msgstr "" - -#: library/ctypes.rst:1595 +#: library/ctypes.rst:1699 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" -#: library/ctypes.rst:1602 +#: library/ctypes.rst:1706 msgid "Foreign functions" msgstr "" -#: library/ctypes.rst:1604 +#: library/ctypes.rst:1708 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " "way by default accept any number of arguments, accept any ctypes data " "instances as arguments, and return the default result type specified by the " -"library loader. They are instances of a private class:" +"library loader." msgstr "" -#: library/ctypes.rst:1613 +#: library/ctypes.rst:1713 +msgid "" +"They are instances of a private local class :class:`!_FuncPtr` (not exposed " +"in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" +msgstr "" + +#: library/ctypes.rst:1716 +msgid "" +">>> import ctypes\n" +">>> lib = ctypes.CDLL(None)\n" +">>> issubclass(lib._FuncPtr, ctypes._CFuncPtr)\n" +"True\n" +">>> lib._FuncPtr is ctypes._CFuncPtr\n" +"False" +msgstr "" + +#: library/ctypes.rst:1727 msgid "Base class for C callable foreign functions." msgstr "" -#: library/ctypes.rst:1615 +#: library/ctypes.rst:1729 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: library/ctypes.rst:1618 +#: library/ctypes.rst:1732 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: library/ctypes.rst:1623 +#: library/ctypes.rst:1737 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: library/ctypes.rst:1626 +#: library/ctypes.rst:1740 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -1600,7 +2627,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: library/ctypes.rst:1635 +#: library/ctypes.rst:1749 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -1609,7 +2636,7 @@ msgid "" "unspecified arguments as well." msgstr "" -#: library/ctypes.rst:1641 +#: library/ctypes.rst:1755 msgid "" "When a foreign function is called, each actual argument is passed to the :" "meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " @@ -1619,7 +2646,7 @@ msgid "" "object using ctypes conversion rules." msgstr "" -#: library/ctypes.rst:1648 +#: library/ctypes.rst:1762 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -1627,50 +2654,38 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: library/ctypes.rst:1655 +#: library/ctypes.rst:1769 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: library/ctypes.rst:1662 +#: library/ctypes.rst:1776 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: library/ctypes.rst:1665 +#: library/ctypes.rst:1779 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: library/ctypes.rst:1669 +#: library/ctypes.rst:1783 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: library/ctypes.rst:1673 +#: library/ctypes.rst:1787 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: library/ctypes.rst:1680 -msgid "" -"This exception is raised when a foreign function call cannot convert one of " -"the passed arguments." -msgstr "" - -#: library/ctypes.rst:1684 -msgid "" -"Raises an :ref:`auditing event ` ``ctypes.set_exception`` with " -"argument ``code``." -msgstr "" - -#: library/ctypes.rst:1686 +#: library/ctypes.rst:1794 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " @@ -1679,24 +2694,18 @@ msgid "" "hook to replace the exception with its own." msgstr "" -#: library/ctypes.rst:1692 +#: library/ctypes.rst:1802 msgid "" -"Raises an :ref:`auditing event ` ``ctypes.call_function`` with " -"arguments ``func_pointer``, ``arguments``." +"Some ways to invoke foreign function calls as well as some of the functions " +"in this module may raise an auditing event ``ctypes.call_function`` with " +"arguments ``function pointer`` and ``arguments``." msgstr "" -#: library/ctypes.rst:1694 -msgid "" -"Some ways to invoke foreign function calls may raise an auditing event " -"``ctypes.call_function`` with arguments ``function pointer`` and " -"``arguments``." -msgstr "" - -#: library/ctypes.rst:1700 +#: library/ctypes.rst:1809 msgid "Function prototypes" msgstr "" -#: library/ctypes.rst:1702 +#: library/ctypes.rst:1811 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -1707,7 +2716,7 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: library/ctypes.rst:1713 +#: library/ctypes.rst:1822 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " @@ -1716,37 +2725,37 @@ msgid "" "after the call; *use_last_error* does the same for the Windows error code." msgstr "" -#: library/ctypes.rst:1723 +#: library/ctypes.rst:1832 msgid "" -"Windows only: The returned function prototype creates functions that use the " -"``stdcall`` calling convention. The function will release the GIL during " -"the call. *use_errno* and *use_last_error* have the same meaning as above." +"The returned function prototype creates functions that use the ``stdcall`` " +"calling convention. The function will release the GIL during the call. " +"*use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: library/ctypes.rst:1731 +#: library/ctypes.rst:1842 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: library/ctypes.rst:1734 +#: library/ctypes.rst:1845 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: library/ctypes.rst:1741 +#: library/ctypes.rst:1852 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: library/ctypes.rst:1748 +#: library/ctypes.rst:1859 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: library/ctypes.rst:1755 +#: library/ctypes.rst:1866 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -1754,7 +2763,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: library/ctypes.rst:1765 +#: library/ctypes.rst:1876 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -1762,87 +2771,121 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: library/ctypes.rst:1770 +#: library/ctypes.rst:1881 +msgid "" +"If *iid* is not specified, an :exc:`OSError` is raised if the COM method " +"call fails. If *iid* is specified, a :exc:`~ctypes.COMError` is raised " +"instead." +msgstr "" + +#: library/ctypes.rst:1885 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: library/ctypes.rst:1774 +#: library/ctypes.rst:1892 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: library/ctypes.rst:1777 +#: library/ctypes.rst:1895 msgid "" -"*paramflags* must be a tuple of the same length as :attr:`~_FuncPtr." +"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." "argtypes`." msgstr "" -#: library/ctypes.rst:1779 +#: library/ctypes.rst:1897 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: library/ctypes.rst:1782 +#: library/ctypes.rst:1900 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: library/ctypes.rst:1786 +#: library/ctypes.rst:1903 msgid "1" msgstr "" -#: library/ctypes.rst:1786 +#: library/ctypes.rst:1904 msgid "Specifies an input parameter to the function." msgstr "" -#: library/ctypes.rst:1789 +#: library/ctypes.rst:1906 msgid "2" msgstr "" -#: library/ctypes.rst:1789 +#: library/ctypes.rst:1907 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: library/ctypes.rst:1792 +#: library/ctypes.rst:1909 msgid "4" msgstr "" -#: library/ctypes.rst:1792 +#: library/ctypes.rst:1910 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: library/ctypes.rst:1794 +#: library/ctypes.rst:1912 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: library/ctypes.rst:1797 +#: library/ctypes.rst:1915 msgid "The optional third item is the default value for this parameter." msgstr "" -#: library/ctypes.rst:1800 +#: library/ctypes.rst:1918 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: library/ctypes.rst:1834 +#: library/ctypes.rst:1922 +msgid "" +"WINUSERAPI int WINAPI\n" +"MessageBoxW(\n" +" HWND hWnd,\n" +" LPCWSTR lpText,\n" +" LPCWSTR lpCaption,\n" +" UINT uType);" +msgstr "" + +#: library/ctypes.rst:1952 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: library/ctypes.rst:1819 +#: library/ctypes.rst:1931 +msgid "" +">>> from ctypes import c_int, WINFUNCTYPE, windll\n" +">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" +">>> prototype = WINFUNCTYPE(c_int, HWND, LPCWSTR, LPCWSTR, UINT)\n" +">>> paramflags = (1, \"hwnd\", 0), (1, \"text\", \"Hi\"), (1, \"caption\", " +"\"Hello from ctypes\"), (1, \"flags\", 0)\n" +">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" +msgstr "" + +#: library/ctypes.rst:1937 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: library/ctypes.rst:1825 +#: library/ctypes.rst:1939 +msgid "" +">>> MessageBox()\n" +">>> MessageBox(text=\"Spam, spam, spam\")\n" +">>> MessageBox(flags=2, text=\"foo bar\")" +msgstr "" + +#: library/ctypes.rst:1943 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -1850,7 +2893,26 @@ msgid "" "the C declaration::" msgstr "" -#: library/ctypes.rst:1843 +#: library/ctypes.rst:1947 +msgid "" +"WINUSERAPI BOOL WINAPI\n" +"GetWindowRect(\n" +" HWND hWnd,\n" +" LPRECT lpRect);" +msgstr "" + +#: library/ctypes.rst:1954 +msgid "" +">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" +">>> from ctypes.wintypes import BOOL, HWND, RECT\n" +">>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))\n" +">>> paramflags = (1, \"hwnd\"), (2, \"lprect\")\n" +">>> GetWindowRect = prototype((\"GetWindowRect\", windll.user32), " +"paramflags)\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1961 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -1858,64 +2920,111 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: library/ctypes.rst:1848 +#: library/ctypes.rst:1966 msgid "" -"Output parameters can be combined with the :attr:`~_FuncPtr.errcheck` " +"Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " "``GetWindowRect`` api function returns a ``BOOL`` to signal success or " "failure, so this function could do the error checking, and raises an " "exception when the api call failed::" msgstr "" -#: library/ctypes.rst:1861 +#: library/ctypes.rst:1971 msgid "" -"If the :attr:`~_FuncPtr.errcheck` function returns the argument tuple it " +">>> def errcheck(result, func, args):\n" +"... if not result:\n" +"... raise WinError()\n" +"... return args\n" +"...\n" +">>> GetWindowRect.errcheck = errcheck\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1979 +msgid "" +"If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " "the output parameters. If you want to return a tuple of window coordinates " "instead of a ``RECT`` instance, you can retrieve the fields in the function " "and return them instead, the normal processing will no longer take place::" msgstr "" -#: library/ctypes.rst:1880 +#: library/ctypes.rst:1985 +msgid "" +">>> def errcheck(result, func, args):\n" +"... if not result:\n" +"... raise WinError()\n" +"... rc = args[1]\n" +"... return rc.left, rc.top, rc.bottom, rc.right\n" +"...\n" +">>> GetWindowRect.errcheck = errcheck\n" +">>>" +msgstr "" + +#: library/ctypes.rst:1998 msgid "Utility functions" msgstr "" -#: library/ctypes.rst:1884 +#: library/ctypes.rst:2002 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: library/ctypes.rst:1887 +#: library/ctypes.rst:2005 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" -#: library/ctypes.rst:1892 +#: library/ctypes.rst:2010 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: library/ctypes.rst:1898 +#: library/ctypes.rst:2016 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: library/ctypes.rst:1902 +#: library/ctypes.rst:2020 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: library/ctypes.rst:1906 +#: library/ctypes.rst:2022 +msgid "(((char *)&obj) + offset)" +msgstr "" + +#: library/ctypes.rst:2024 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: library/ctypes.rst:1912 +#: library/ctypes.rst:2030 +msgid "" +"Copies a COM pointer from *src* to *dst* and returns the Windows specific :c:" +"type:`!HRESULT` value." +msgstr "" + +#: library/ctypes.rst:2033 +msgid "" +"If *src* is not ``NULL``, its ``AddRef`` method is called, incrementing the " +"reference count." +msgstr "" + +#: library/ctypes.rst:2036 +msgid "" +"In contrast, the reference count of *dst* will not be decremented before " +"assigning the new value. Unless *dst* is ``NULL``, the caller is responsible " +"for decrementing the reference count by calling its ``Release`` method when " +"necessary." +msgstr "" + +#: library/ctypes.rst:2048 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -1923,75 +3032,101 @@ msgid "" "as a pointer." msgstr "" -#: library/ctypes.rst:1920 +#: library/ctypes.rst:2057 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: library/ctypes.rst:1923 +#: library/ctypes.rst:2060 msgid "" -"*init_or_size* must be an integer which specifies the size of the array, or " -"a bytes object which will be used to initialize the array items." +"If *size* is given (and not ``None``), it must be an :class:`int`. It " +"specifies the size of the returned array." msgstr "" -#: library/ctypes.rst:1926 +#: library/ctypes.rst:2063 msgid "" -"If a bytes object is specified as first argument, the buffer is made one " -"item larger than its length so that the last element in the array is a NUL " -"termination character. An integer can be passed as second argument which " -"allows specifying the size of the array if the length of the bytes should " -"not be used." +"If the *init* argument is given, it must be :class:`bytes`. It is used to " +"initialize the array items. Bytes not initialized this way are set to zero " +"(NUL)." msgstr "" -#: library/ctypes.rst:1931 +#: library/ctypes.rst:2067 +msgid "" +"If *size* is not given (or if it is ``None``), the buffer is made one " +"element larger than *init*, effectively adding a NUL terminator." +msgstr "" + +#: library/ctypes.rst:2070 +msgid "" +"If both arguments are given, *size* must not be less than ``len(init)``." +msgstr "" + +#: library/ctypes.rst:2074 +msgid "" +"If *size* is equal to ``len(init)``, a NUL terminator is not added. Do not " +"treat such a buffer as a C string." +msgstr "" + +#: library/ctypes.rst:2077 +msgid "For example::" +msgstr "" + +#: library/ctypes.rst:2079 +msgid "" +">>> bytes(create_string_buffer(2))\n" +"b'\\x00\\x00'\n" +">>> bytes(create_string_buffer(b'ab'))\n" +"b'ab\\x00'\n" +">>> bytes(create_string_buffer(b'ab', 2))\n" +"b'ab'\n" +">>> bytes(create_string_buffer(b'ab', 4))\n" +"b'ab\\x00\\x00'\n" +">>> bytes(create_string_buffer(b'abcdef', 2))\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: byte string too long" +msgstr "" + +#: library/ctypes.rst:2092 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." msgstr "" -#: library/ctypes.rst:1936 +#: library/ctypes.rst:2098 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: library/ctypes.rst:1939 +#: library/ctypes.rst:2101 msgid "" -"*init_or_size* must be an integer which specifies the size of the array, or " -"a string which will be used to initialize the array items." +"The function takes the same arguments as :func:`~create_string_buffer` " +"except *init* must be a string and *size* counts :class:`c_wchar`." msgstr "" -#: library/ctypes.rst:1942 -msgid "" -"If a string is specified as first argument, the buffer is made one item " -"larger than the length of the string so that the last element in the array " -"is a NUL termination character. An integer can be passed as second argument " -"which allows specifying the size of the array if the length of the string " -"should not be used." -msgstr "" - -#: library/ctypes.rst:1948 +#: library/ctypes.rst:2104 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." msgstr "" -#: library/ctypes.rst:1953 +#: library/ctypes.rst:2109 msgid "" -"Windows only: This function is a hook which allows implementing in-process " -"COM servers with ctypes. It is called from the DllCanUnloadNow function " -"that the _ctypes extension dll exports." +"This function is a hook which allows implementing in-process COM servers " +"with ctypes. It is called from the DllCanUnloadNow function that the " +"_ctypes extension dll exports." msgstr "" -#: library/ctypes.rst:1960 +#: library/ctypes.rst:2118 msgid "" -"Windows only: This function is a hook which allows implementing in-process " -"COM servers with ctypes. It is called from the DllGetClassObject function " -"that the ``_ctypes`` extension dll exports." +"This function is a hook which allows implementing in-process COM servers " +"with ctypes. It is called from the DllGetClassObject function that the " +"``_ctypes`` extension dll exports." msgstr "" -#: library/ctypes.rst:1968 +#: library/ctypes.rst:2128 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -1999,92 +3134,115 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: library/ctypes.rst:1979 +#: library/ctypes.rst:2139 msgid "" -"Windows only: return the filename of the VC runtime library used by Python, " -"and by the extension modules. If the name of the library cannot be " -"determined, ``None`` is returned." +"Returns the filename of the VC runtime library used by Python, and by the " +"extension modules. If the name of the library cannot be determined, " +"``None`` is returned." msgstr "" -#: library/ctypes.rst:1983 +#: library/ctypes.rst:2143 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: library/ctypes.rst:1990 +#: library/ctypes.rst:2153 +msgid "" +"Try to provide a list of paths of the shared libraries loaded into the " +"current process. These paths are not normalized or processed in any way. " +"The function can raise :exc:`OSError` if the underlying platform APIs fail. " +"The exact functionality is system dependent." +msgstr "" + +#: library/ctypes.rst:2158 msgid "" -"Windows only: Returns a textual description of the error code *code*. If no " -"error code is specified, the last error code is used by calling the Windows " -"api function GetLastError." +"On most platforms, the first element of the list represents the current " +"executable file. It may be an empty string." msgstr "" -#: library/ctypes.rst:1997 +#: library/ctypes.rst:2166 msgid "" -"Windows only: Returns the last error code set by Windows in the calling " -"thread. This function calls the Windows ``GetLastError()`` function " -"directly, it does not return the ctypes-private copy of the error code." +"Returns a textual description of the error code *code*. If no error code is " +"specified, the last error code is used by calling the Windows API function :" +"func:`GetLastError`." msgstr "" -#: library/ctypes.rst:2003 +#: library/ctypes.rst:2175 +msgid "" +"Returns the last error code set by Windows in the calling thread. This " +"function calls the Windows ``GetLastError()`` function directly, it does not " +"return the ctypes-private copy of the error code." +msgstr "" + +#: library/ctypes.rst:2184 msgid "" "Returns the current value of the ctypes-private copy of the system :data:" "`errno` variable in the calling thread." msgstr "" -#: library/ctypes.rst:2006 +#: library/ctypes.rst:2187 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" -#: library/ctypes.rst:2010 +#: library/ctypes.rst:2191 msgid "" -"Windows only: returns the current value of the ctypes-private copy of the " -"system :data:`!LastError` variable in the calling thread." +"Returns the current value of the ctypes-private copy of the system :data:`!" +"LastError` variable in the calling thread." msgstr "" -#: library/ctypes.rst:2013 +#: library/ctypes.rst:2196 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" -#: library/ctypes.rst:2017 +#: library/ctypes.rst:2201 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: library/ctypes.rst:2024 +#: library/ctypes.rst:2208 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: library/ctypes.rst:2031 +#: library/ctypes.rst:2215 msgid "" -"Create and return a new ctypes pointer type. Pointer types are cached and " -"reused internally, so calling this function repeatedly is cheap. *type* must " -"be a ctypes type." +"Create or return a ctypes pointer type. Pointer types are cached and reused " +"internally, so calling this function repeatedly is cheap. *type* must be a " +"ctypes type." msgstr "" -#: library/ctypes.rst:2038 +#: library/ctypes.rst:2221 +msgid "" +"The resulting pointer type is cached in the ``__pointer_type__`` attribute " +"of *type*. It is possible to set this attribute before the first call to " +"``POINTER`` in order to set a custom pointer type. However, doing this is " +"discouraged: manually creating a suitable pointer type is difficult without " +"relying on implementation details that may change in future Python versions." +msgstr "" + +#: library/ctypes.rst:2232 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: library/ctypes.rst:2041 +#: library/ctypes.rst:2235 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: library/ctypes.rst:2047 +#: library/ctypes.rst:2241 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -2092,84 +3250,110 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: library/ctypes.rst:2055 +#: library/ctypes.rst:2249 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: library/ctypes.rst:2058 +#: library/ctypes.rst:2252 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" -#: library/ctypes.rst:2063 +#: library/ctypes.rst:2257 msgid "" -"Windows only: set the current value of the ctypes-private copy of the " -"system :data:`!LastError` variable in the calling thread to *value* and " -"return the previous value." +"Sets the current value of the ctypes-private copy of the system :data:`!" +"LastError` variable in the calling thread to *value* and return the previous " +"value." msgstr "" -#: library/ctypes.rst:2067 +#: library/ctypes.rst:2263 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" -#: library/ctypes.rst:2072 +#: library/ctypes.rst:2268 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: library/ctypes.rst:2078 +#: library/ctypes.rst:2274 msgid "" -"This function returns the C string starting at memory address *address* as a " -"bytes object. If size is specified, it is used as size, otherwise the string " -"is assumed to be zero-terminated." +"Return the byte string at *void \\*ptr*. If *size* is specified, it is used " +"as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: library/ctypes.rst:2082 +#: library/ctypes.rst:2278 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " -"arguments ``address``, ``size``." +"arguments ``ptr``, ``size``." msgstr "" -#: library/ctypes.rst:2087 +#: library/ctypes.rst:2283 msgid "" -"Windows only: this function is probably the worst-named thing in ctypes. It " -"creates an instance of :exc:`OSError`. If *code* is not specified, " -"``GetLastError`` is called to determine the error code. If *descr* is not " +"Creates an instance of :exc:`OSError`. If *code* is not specified, :func:" +"`GetLastError` is called to determine the error code. If *descr* is not " "specified, :func:`FormatError` is called to get a textual description of the " "error." msgstr "" -#: library/ctypes.rst:2093 +#: library/ctypes.rst:2290 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: library/ctypes.rst:2100 +#: library/ctypes.rst:2297 msgid "" -"This function returns the wide character string starting at memory address " -"*address* as a string. If *size* is specified, it is used as the number of " -"characters of the string, otherwise the string is assumed to be zero-" -"terminated." +"Return the wide-character string at *void \\*ptr*. If *size* is specified, " +"it is used as the number of characters of the string, otherwise the string " +"is assumed to be zero-terminated." msgstr "" -#: library/ctypes.rst:2105 +#: library/ctypes.rst:2302 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " -"arguments ``address``, ``size``." +"arguments ``ptr``, ``size``." +msgstr "" + +#: library/ctypes.rst:2307 +msgid "" +"Return a :class:`memoryview` object of length *size* that references memory " +"starting at *void \\*ptr*." msgstr "" -#: library/ctypes.rst:2111 +#: library/ctypes.rst:2310 +msgid "" +"If *readonly* is true, the returned :class:`!memoryview` object can not be " +"used to modify the underlying memory. (Changes made by other means will " +"still be reflected in the returned object.)" +msgstr "" + +#: library/ctypes.rst:2315 +msgid "" +"This function is similar to :func:`string_at` with the key difference of not " +"making a copy of the specified memory. It is a semantically equivalent (but " +"more efficient) alternative to ``memoryview((c_byte * size)." +"from_address(ptr))``. (While :meth:`~_CData.from_address` only takes " +"integers, *ptr* can also be given as a :class:`ctypes.POINTER` or a :func:" +"`~ctypes.byref` object.)" +msgstr "" + +#: library/ctypes.rst:2322 +msgid "" +"Raises an :ref:`auditing event ` ``ctypes.memoryview_at`` with " +"arguments ``address``, ``size``, ``readonly``." +msgstr "" + +#: library/ctypes.rst:2330 msgid "Data types" msgstr "" -#: library/ctypes.rst:2116 +#: library/ctypes.rst:2335 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " @@ -2179,13 +3363,13 @@ msgid "" "alive in case the memory block contains pointers." msgstr "" -#: library/ctypes.rst:2123 +#: library/ctypes.rst:2342 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: library/ctypes.rst:2128 +#: library/ctypes.rst:2347 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " @@ -2194,13 +3378,13 @@ msgid "" "exc:`ValueError` is raised." msgstr "" -#: library/ctypes.rst:2144 +#: library/ctypes.rst:2363 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." msgstr "" -#: library/ctypes.rst:2138 +#: library/ctypes.rst:2357 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -2208,51 +3392,56 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: library/ctypes.rst:2148 +#: library/ctypes.rst:2367 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: library/ctypes.rst:2151 -msgid "" -"Raises an :ref:`auditing event ` ``ctypes.cdata`` with argument " -"``address``." -msgstr "" - -#: library/ctypes.rst:2153 +#: library/ctypes.rst:2372 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" -#: library/ctypes.rst:2159 +#: library/ctypes.rst:2378 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " -"foreign function's :attr:`~_FuncPtr.argtypes` tuple; it must return an " +"foreign function's :attr:`~_CFuncPtr.argtypes` tuple; it must return an " "object that can be used as a function call parameter." msgstr "" -#: library/ctypes.rst:2164 +#: library/ctypes.rst:2383 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: library/ctypes.rst:2170 +#: library/ctypes.rst:2389 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: library/ctypes.rst:2174 +#: library/ctypes.rst:2393 +msgid "Common class variables of ctypes data types:" +msgstr "" + +#: library/ctypes.rst:2397 +msgid "" +"The pointer type that was created by calling :func:`POINTER` for " +"corresponding ctypes data type. If a pointer type was not yet created, the " +"attribute is missing." +msgstr "" + +#: library/ctypes.rst:2403 msgid "Common instance variables of ctypes data types:" msgstr "" -#: library/ctypes.rst:2178 +#: library/ctypes.rst:2407 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " "instead they share part of the memory block of a base object. The :attr:" @@ -2260,13 +3449,13 @@ msgid "" "block." msgstr "" -#: library/ctypes.rst:2185 +#: library/ctypes.rst:2414 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: library/ctypes.rst:2190 +#: library/ctypes.rst:2419 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -2274,7 +3463,7 @@ msgid "" "dictionary." msgstr "" -#: library/ctypes.rst:2203 +#: library/ctypes.rst:2432 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " @@ -2283,11 +3472,11 @@ msgid "" "types that are not and do not contain pointers can now be pickled." msgstr "" -#: library/ctypes.rst:2209 +#: library/ctypes.rst:2438 msgid "Instances have a single attribute:" msgstr "" -#: library/ctypes.rst:2213 +#: library/ctypes.rst:2442 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -2295,7 +3484,7 @@ msgid "" "bytes object or string." msgstr "" -#: library/ctypes.rst:2218 +#: library/ctypes.rst:2447 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -2303,17 +3492,17 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: library/ctypes.rst:2224 +#: library/ctypes.rst:2453 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " "transparently converted to native Python types. In other words, if a " -"foreign function has a :attr:`~_FuncPtr.restype` of :class:`c_char_p`, you " +"foreign function has a :attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you " "will always receive a Python bytes object, *not* a :class:`c_char_p` " "instance." msgstr "" -#: library/ctypes.rst:2232 +#: library/ctypes.rst:2461 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -2321,25 +3510,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: library/ctypes.rst:2237 +#: library/ctypes.rst:2466 msgid "These are the fundamental ctypes data types:" msgstr "" -#: library/ctypes.rst:2241 +#: library/ctypes.rst:2470 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: library/ctypes.rst:2248 +#: library/ctypes.rst:2477 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: library/ctypes.rst:2255 +#: library/ctypes.rst:2484 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -2347,182 +3536,204 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: library/ctypes.rst:2263 +#: library/ctypes.rst:2492 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: library/ctypes.rst:2269 +#: library/ctypes.rst:2498 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: library/ctypes.rst:2275 +#: library/ctypes.rst:2504 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: library/ctypes.rst:2281 +#: library/ctypes.rst:2510 +msgid "" +"Represents the C :c:expr:`double complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." +msgstr "" + +#: library/ctypes.rst:2518 +msgid "" +"Represents the C :c:expr:`float complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." +msgstr "" + +#: library/ctypes.rst:2526 +msgid "" +"Represents the C :c:expr:`long double complex` datatype, if available. The " +"constructor accepts an optional :class:`complex` initializer." +msgstr "" + +#: library/ctypes.rst:2534 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: library/ctypes.rst:2288 +#: library/ctypes.rst:2541 msgid "" -"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" +"Represents the C 8-bit :c:expr:`signed int` datatype. It is an alias for :" "class:`c_byte`." msgstr "" -#: library/ctypes.rst:2294 +#: library/ctypes.rst:2547 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: library/ctypes.rst:2300 +#: library/ctypes.rst:2553 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: library/ctypes.rst:2306 +#: library/ctypes.rst:2559 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: library/ctypes.rst:2312 +#: library/ctypes.rst:2565 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: library/ctypes.rst:2318 +#: library/ctypes.rst:2571 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: library/ctypes.rst:2324 +#: library/ctypes.rst:2577 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: library/ctypes.rst:2330 +#: library/ctypes.rst:2583 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: library/ctypes.rst:2335 +#: library/ctypes.rst:2588 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: library/ctypes.rst:2342 +#: library/ctypes.rst:2595 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: library/ctypes.rst:2349 +#: library/ctypes.rst:2602 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: library/ctypes.rst:2356 +#: library/ctypes.rst:2609 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: library/ctypes.rst:2363 +#: library/ctypes.rst:2616 msgid "" -"Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias " -"for :class:`c_ubyte`." +"Represents the C 8-bit :c:expr:`unsigned int` datatype. It is an alias for :" +"class:`c_ubyte`." msgstr "" -#: library/ctypes.rst:2369 +#: library/ctypes.rst:2622 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: library/ctypes.rst:2375 +#: library/ctypes.rst:2628 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: library/ctypes.rst:2381 +#: library/ctypes.rst:2634 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: library/ctypes.rst:2387 +#: library/ctypes.rst:2640 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: library/ctypes.rst:2393 +#: library/ctypes.rst:2646 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: library/ctypes.rst:2399 +#: library/ctypes.rst:2652 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: library/ctypes.rst:2405 +#: library/ctypes.rst:2658 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: library/ctypes.rst:2411 +#: library/ctypes.rst:2664 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: library/ctypes.rst:2418 +#: library/ctypes.rst:2671 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: library/ctypes.rst:2425 +#: library/ctypes.rst:2678 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: library/ctypes.rst:2432 +#: library/ctypes.rst:2685 msgid "" -"Windows only: Represents a :c:type:`!HRESULT` value, which contains success " -"or error information for a function or method call." +"Represents a :c:type:`!HRESULT` value, which contains success or error " +"information for a function or method call." msgstr "" -#: library/ctypes.rst:2438 +#: library/ctypes.rst:2693 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: library/ctypes.rst:2441 +#: library/ctypes.rst:2696 +msgid ":class:`!py_object` is now a :term:`generic type`." +msgstr "" + +#: library/ctypes.rst:2699 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " "specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" @@ -2530,41 +3741,47 @@ msgid "" "are also defined." msgstr "" -#: library/ctypes.rst:2449 +#: library/ctypes.rst:2707 msgid "Structured data types" msgstr "" -#: library/ctypes.rst:2454 +#: library/ctypes.rst:2712 msgid "Abstract base class for unions in native byte order." msgstr "" -#: library/ctypes.rst:2459 +#: library/ctypes.rst:2714 +msgid "" +"Unions share common attributes and behavior with structures; see :class:" +"`Structure` documentation for details." +msgstr "" + +#: library/ctypes.rst:2719 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: library/ctypes.rst:2465 +#: library/ctypes.rst:2725 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: library/ctypes.rst:2471 +#: library/ctypes.rst:2731 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: library/ctypes.rst:2476 +#: library/ctypes.rst:2736 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: library/ctypes.rst:2478 +#: library/ctypes.rst:2738 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: library/ctypes.rst:2484 +#: library/ctypes.rst:2744 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: library/ctypes.rst:2486 +#: library/ctypes.rst:2746 msgid "" "Concrete structure and union types must be created by subclassing one of " "these types, and at least define a :attr:`_fields_` class variable. :mod:" @@ -2572,64 +3789,184 @@ msgid "" "the fields by direct attribute accesses. These are the" msgstr "" -#: library/ctypes.rst:2494 +#: library/ctypes.rst:2754 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: library/ctypes.rst:2498 +#: library/ctypes.rst:2758 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: library/ctypes.rst:2502 +#: library/ctypes.rst:2762 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: library/ctypes.rst:2505 +#: library/ctypes.rst:2765 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: library/ctypes.rst:2515 +#: library/ctypes.rst:2769 msgid "" -"The :attr:`_fields_` class variable must, however, be defined before the " -"type is first used (an instance is created, :func:`sizeof` is called on it, " -"and so on). Later assignments to the :attr:`_fields_` class variable will " -"raise an AttributeError." +"class List(Structure):\n" +" pass\n" +"List._fields_ = [(\"pnext\", POINTER(List)),\n" +" ...\n" +" ]" msgstr "" -#: library/ctypes.rst:2520 +#: library/ctypes.rst:2775 msgid "" -"It is possible to define sub-subclasses of structure types, they inherit the " -"fields of the base class plus the :attr:`_fields_` defined in the sub-" -"subclass, if any." +"The :attr:`!_fields_` class variable can only be set once. Later assignments " +"will raise an :exc:`AttributeError`." msgstr "" -#: library/ctypes.rst:2527 +#: library/ctypes.rst:2778 +msgid "" +"Additionally, the :attr:`!_fields_` class variable must be defined before " +"the structure or union type is first used: an instance or subclass is " +"created, :func:`sizeof` is called on it, and so on. Later assignments to :" +"attr:`!_fields_` will raise an :exc:`AttributeError`. If :attr:`!_fields_` " +"has not been set before such use, the structure or union will have no own " +"fields, as if :attr:`!_fields_` was empty." +msgstr "" + +#: library/ctypes.rst:2786 +msgid "" +"Sub-subclasses of structure types inherit the fields of the base class plus " +"the :attr:`_fields_` defined in the sub-subclass, if any." +msgstr "" + +#: library/ctypes.rst:2792 msgid "" "An optional small integer that allows overriding the alignment of structure " -"fields in the instance. :attr:`_pack_` must already be defined when :attr:" -"`_fields_` is assigned, otherwise it will have no effect. Setting this " -"attribute to 0 is the same as not setting it at all." +"fields in the instance." +msgstr "" + +#: library/ctypes.rst:2795 +msgid "" +"This is only implemented for the MSVC-compatible memory layout (see :attr:" +"`_layout_`)." +msgstr "" + +#: library/ctypes.rst:2798 +msgid "" +"Setting :attr:`!_pack_` to 0 is the same as not setting it at all. " +"Otherwise, the value must be a positive power of two. The effect is " +"equivalent to ``#pragma pack(N)`` in C, except :mod:`ctypes` may allow " +"larger *n* than what the compiler accepts." +msgstr "" + +#: library/ctypes.rst:2803 +msgid "" +":attr:`!_pack_` must already be defined when :attr:`_fields_` is assigned, " +"otherwise it will have no effect." +msgstr "" + +#: library/ctypes.rst:2808 +msgid "" +"For historical reasons, if :attr:`!_pack_` is non-zero, the MSVC-compatible " +"layout will be used by default. On non-Windows platforms, this default is " +"deprecated and is slated to become an error in Python 3.19. If it is " +"intended, set :attr:`~Structure._layout_` to ``'ms'`` explicitly." +msgstr "" + +#: library/ctypes.rst:2817 +msgid "" +"An optional small integer that allows increasing the alignment of the " +"structure when being packed or unpacked to/from memory." +msgstr "" + +#: library/ctypes.rst:2820 +msgid "" +"The value must not be negative. The effect is equivalent to " +"``__attribute__((aligned(N)))`` on GCC or ``#pragma align(N)`` on MSVC, " +"except :mod:`ctypes` may allow values that the compiler would reject." +msgstr "" + +#: library/ctypes.rst:2825 +msgid "" +":attr:`!_align_` can only *increase* a structure's alignment requirements. " +"Setting it to 0 or 1 has no effect." +msgstr "" + +#: library/ctypes.rst:2828 +msgid "" +"Using values that are not powers of two is discouraged and may lead to " +"surprising behavior." +msgstr "" + +#: library/ctypes.rst:2831 +msgid "" +":attr:`!_align_` must already be defined when :attr:`_fields_` is assigned, " +"otherwise it will have no effect." +msgstr "" + +#: library/ctypes.rst:2838 +msgid "" +"An optional string naming the struct/union layout. It can currently be set " +"to:" +msgstr "" + +#: library/ctypes.rst:2841 +msgid "" +"``\"ms\"``: the layout used by the Microsoft compiler (MSVC). On GCC and " +"Clang, this layout can be selected with ``__attribute__((ms_struct))``." +msgstr "" + +#: library/ctypes.rst:2844 +msgid "" +"``\"gcc-sysv\"``: the layout used by GCC with the System V or “SysV-like” " +"data model, as used on Linux and macOS. With this layout, :attr:`~Structure." +"_pack_` must be unset or zero." +msgstr "" + +#: library/ctypes.rst:2848 +msgid "" +"If not set explicitly, ``ctypes`` will use a default that matches the " +"platform conventions. This default may change in future Python releases (for " +"example, when a new platform gains official support, or when a difference " +"between similar platforms is found). Currently the default will be:" +msgstr "" + +#: library/ctypes.rst:2854 +msgid "On Windows: ``\"ms\"``" +msgstr "" + +#: library/ctypes.rst:2855 +msgid "" +"When :attr:`~Structure._pack_` is specified: ``\"ms\"``. (This is " +"deprecated; see :attr:`~Structure._pack_` documentation.)" +msgstr "" + +#: library/ctypes.rst:2857 +msgid "Otherwise: ``\"gcc-sysv\"``" +msgstr "" + +#: library/ctypes.rst:2859 +msgid "" +":attr:`!_layout_` must already be defined when :attr:`~Structure._fields_` " +"is assigned, otherwise it will have no effect." msgstr "" -#: library/ctypes.rst:2535 +#: library/ctypes.rst:2866 msgid "" "An optional sequence that lists the names of unnamed (anonymous) fields. :" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: library/ctypes.rst:2539 +#: library/ctypes.rst:2870 msgid "" "The fields listed in this variable must be structure or union type fields. :" "mod:`ctypes` will create descriptors in the structure type that allows " @@ -2637,11 +3974,24 @@ msgid "" "structure or union field." msgstr "" -#: library/ctypes.rst:2544 +#: library/ctypes.rst:2875 msgid "Here is an example type (Windows)::" msgstr "" -#: library/ctypes.rst:2557 +#: library/ctypes.rst:2877 +msgid "" +"class _U(Union):\n" +" _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" +" (\"lpadesc\", POINTER(ARRAYDESC)),\n" +" (\"hreftype\", HREFTYPE)]\n" +"\n" +"class TYPEDESC(Structure):\n" +" _anonymous_ = (\"u\",)\n" +" _fields_ = [(\"u\", _U),\n" +" (\"vt\", VARTYPE)]" +msgstr "" + +#: library/ctypes.rst:2888 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -2651,7 +4001,15 @@ msgid "" "temporary union instance::" msgstr "" -#: library/ctypes.rst:2569 +#: library/ctypes.rst:2895 +msgid "" +"td = TYPEDESC()\n" +"td.vt = VT_PTR\n" +"td.lptdesc = POINTER(some_type)\n" +"td.u.lptdesc = POINTER(some_type)" +msgstr "" + +#: library/ctypes.rst:2900 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " "fields of the base class. If the subclass definition has a separate :attr:" @@ -2659,7 +4017,7 @@ msgid "" "of the base class." msgstr "" -#: library/ctypes.rst:2574 +#: library/ctypes.rst:2905 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -2669,15 +4027,129 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: library/ctypes.rst:2585 +#: library/ctypes.rst:2915 +msgid "" +"Descriptor for fields of a :class:`Structure` and :class:`Union`. For " +"example::" +msgstr "" + +#: library/ctypes.rst:2918 +msgid "" +">>> class Color(Structure):\n" +"... _fields_ = (\n" +"... ('red', c_uint8),\n" +"... ('green', c_uint8),\n" +"... ('blue', c_uint8),\n" +"... ('intense', c_bool, 1),\n" +"... ('blinking', c_bool, 1),\n" +"... )\n" +"...\n" +">>> Color.red\n" +"\n" +">>> Color.green.type\n" +"\n" +">>> Color.blue.byte_offset\n" +"2\n" +">>> Color.intense\n" +"\n" +">>> Color.blinking.bit_offset\n" +"1" +msgstr "" + +#: library/ctypes.rst:2938 +msgid "All attributes are read-only." +msgstr "" + +#: library/ctypes.rst:2940 +msgid "" +":class:`!CField` objects are created via :attr:`~Structure._fields_`; do not " +"instantiate the class directly." +msgstr "" + +#: library/ctypes.rst:2945 +msgid "" +"Previously, descriptors only had ``offset`` and ``size`` attributes and a " +"readable string representation; the :class:`!CField` class was not available " +"directly." +msgstr "" + +#: library/ctypes.rst:2951 +msgid "Name of the field, as a string." +msgstr "" + +#: library/ctypes.rst:2955 +msgid "Type of the field, as a :ref:`ctypes class `." +msgstr "" + +#: library/ctypes.rst:2960 +msgid "Offset of the field, in bytes." +msgstr "" + +#: library/ctypes.rst:2962 +msgid "" +"For bitfields, this is the offset of the underlying byte-aligned *storage " +"unit*; see :attr:`~CField.bit_offset`." +msgstr "" + +#: library/ctypes.rst:2967 +msgid "Size of the field, in bytes." +msgstr "" + +#: library/ctypes.rst:2969 +msgid "" +"For bitfields, this is the size of the underlying *storage unit*. Typically, " +"it has the same size as the bitfield's type." +msgstr "" + +#: library/ctypes.rst:2974 +msgid "For non-bitfields, equivalent to :attr:`~CField.byte_size`." +msgstr "" + +#: library/ctypes.rst:2976 +msgid "" +"For bitfields, this contains a backwards-compatible bit-packed value that " +"combines :attr:`~CField.bit_size` and :attr:`~CField.bit_offset`. Prefer " +"using the explicit attributes instead." +msgstr "" + +#: library/ctypes.rst:2983 +msgid "True if this is a bitfield." +msgstr "" + +#: library/ctypes.rst:2988 +msgid "" +"The location of a bitfield within its *storage unit*, that is, within :attr:" +"`~CField.byte_size` bytes of memory starting at :attr:`~CField.byte_offset`." +msgstr "" + +#: library/ctypes.rst:2992 +msgid "" +"To get the field's value, read the storage unit as an integer, :ref:`shift " +"left ` by :attr:`!bit_offset` and take the :attr:`!bit_size` least " +"significant bits." +msgstr "" + +#: library/ctypes.rst:2996 +msgid "" +"For non-bitfields, :attr:`!bit_offset` is zero and :attr:`!bit_size` is " +"equal to ``byte_size * 8``." +msgstr "" + +#: library/ctypes.rst:3001 +msgid "" +"True if this field is anonymous, that is, it contains nested sub-fields that " +"should be merged into a containing structure or union." +msgstr "" + +#: library/ctypes.rst:3008 msgid "Arrays and pointers" msgstr "" -#: library/ctypes.rst:2589 +#: library/ctypes.rst:3012 msgid "Abstract base class for arrays." msgstr "" -#: library/ctypes.rst:2591 +#: library/ctypes.rst:3014 msgid "" "The recommended way to create concrete array types is by multiplying any :" "mod:`ctypes` data type with a non-negative integer. Alternatively, you can " @@ -2687,34 +4159,46 @@ msgid "" "an :class:`Array`." msgstr "" -#: library/ctypes.rst:2601 +#: library/ctypes.rst:3024 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" -#: library/ctypes.rst:2608 +#: library/ctypes.rst:3031 msgid "Specifies the type of each element in the array." msgstr "" -#: library/ctypes.rst:2611 +#: library/ctypes.rst:3034 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: library/ctypes.rst:2617 +#: library/ctypes.rst:3039 +msgid "" +"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" +"`ctypes` data type and *length* an integer." +msgstr "" + +#: library/ctypes.rst:3043 +msgid "" +"This function is :term:`soft deprecated` in favor of multiplication. There " +"are no plans to remove it." +msgstr "" + +#: library/ctypes.rst:3049 msgid "Private, abstract base class for pointers." msgstr "" -#: library/ctypes.rst:2619 +#: library/ctypes.rst:3051 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: library/ctypes.rst:2623 +#: library/ctypes.rst:3055 msgid "" "If a pointer points to an array, its elements can be read and written using " "standard subscript and slice accesses. Pointer objects have no size, so :" @@ -2723,12 +4207,47 @@ msgid "" "probably crash with an access violation (if you're lucky)." msgstr "" -#: library/ctypes.rst:2633 +#: library/ctypes.rst:3065 msgid "Specifies the type pointed to." msgstr "" -#: library/ctypes.rst:2637 +#: library/ctypes.rst:3069 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." msgstr "" + +#: library/ctypes.rst:3076 +msgid "Exceptions" +msgstr "" + +#: library/ctypes.rst:3080 +msgid "" +"This exception is raised when a foreign function call cannot convert one of " +"the passed arguments." +msgstr "" + +#: library/ctypes.rst:3086 +msgid "This exception is raised when a COM method call failed." +msgstr "" + +#: library/ctypes.rst:3090 +msgid "The integer value representing the error code." +msgstr "" + +#: library/ctypes.rst:3094 +msgid "The error message." +msgstr "" + +#: library/ctypes.rst:3098 +msgid "The 5-tuple ``(descr, source, helpfile, helpcontext, progid)``." +msgstr "" + +#: library/ctypes.rst:3100 +msgid "" +"*descr* is the textual description. *source* is the language-dependent " +"``ProgID`` for the class or application that raised the error. *helpfile* " +"is the path of the help file. *helpcontext* is the help context " +"identifier. *progid* is the ``ProgID`` of the interface that defined the " +"error." +msgstr "" diff --git a/library/curses.ascii.po b/library/curses.ascii.po index 0b8b5f8a..098d6da4 100644 --- a/library/curses.ascii.po +++ b/library/curses.ascii.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/curses.ascii.rst:2 -msgid ":mod:`curses.ascii` --- Utilities for ASCII characters" +msgid ":mod:`!curses.ascii` --- Utilities for ASCII characters" msgstr "" #: library/curses.ascii.rst:10 diff --git a/library/curses.panel.po b/library/curses.panel.po index 11c4acfb..79410c7c 100644 --- a/library/curses.panel.po +++ b/library/curses.panel.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/curses.panel.rst:2 -msgid ":mod:`curses.panel` --- A panel stack extension for curses" +msgid ":mod:`!curses.panel` --- A panel stack extension for curses" msgstr "" #: library/curses.panel.rst:11 diff --git a/library/curses.po b/library/curses.po index 2e17e551..d598112e 100644 --- a/library/curses.po +++ b/library/curses.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/curses.rst:2 -msgid ":mod:`curses` --- Terminal handling for character-cell displays" +msgid ":mod:`!curses` --- Terminal handling for character-cell displays" msgstr "" #: library/curses.rst:12 @@ -38,80 +39,116 @@ msgid "" "curses library hosted on Linux and the BSD variants of Unix." msgstr "" -#: library/curses.rst:26 +#: includes/wasm-mobile-notavail.rst:3 +msgid "Availability" +msgstr "" + +#: includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +msgstr "" + +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/curses.rst:30 msgid "" "Whenever the documentation mentions a *character* it can be specified as an " "integer, a one-character Unicode string or a one-byte byte string." msgstr "" -#: library/curses.rst:29 +#: library/curses.rst:33 msgid "" "Whenever the documentation mentions a *character string* it can be specified " "as a Unicode string or a byte string." msgstr "" -#: library/curses.rst:35 +#: library/curses.rst:38 msgid "Module :mod:`curses.ascii`" msgstr "" -#: library/curses.rst:35 +#: library/curses.rst:39 msgid "" "Utilities for working with ASCII characters, regardless of your locale " "settings." msgstr "" -#: library/curses.rst:38 +#: library/curses.rst:41 msgid "Module :mod:`curses.panel`" msgstr "" -#: library/curses.rst:38 +#: library/curses.rst:42 msgid "A panel stack extension that adds depth to curses windows." msgstr "" -#: library/curses.rst:41 +#: library/curses.rst:44 msgid "Module :mod:`curses.textpad`" msgstr "" -#: library/curses.rst:41 +#: library/curses.rst:45 msgid "" "Editable text widget for curses supporting :program:`Emacs`\\ -like " "bindings." msgstr "" -#: library/curses.rst:44 +#: library/curses.rst:47 msgid ":ref:`curses-howto`" msgstr "" -#: library/curses.rst:44 +#: library/curses.rst:48 msgid "" "Tutorial material on using curses with Python, by Andrew Kuchling and Eric " "Raymond." msgstr "" -#: library/curses.rst:51 +#: library/curses.rst:55 msgid "Functions" msgstr "" -#: library/curses.rst:53 +#: library/curses.rst:57 msgid "The module :mod:`curses` defines the following exception:" msgstr "" -#: library/curses.rst:58 +#: library/curses.rst:62 msgid "Exception raised when a curses library function returns an error." msgstr "" -#: library/curses.rst:62 +#: library/curses.rst:66 msgid "" "Whenever *x* or *y* arguments to a function or a method are optional, they " "default to the current cursor location. Whenever *attr* is optional, it " "defaults to :const:`A_NORMAL`." msgstr "" -#: library/curses.rst:66 +#: library/curses.rst:70 msgid "The module :mod:`curses` defines the following functions:" msgstr "" -#: library/curses.rst:71 +#: library/curses.rst:75 +msgid "" +"Allow use of default values for colors on terminals supporting this feature. " +"Use this to support transparency in your application." +msgstr "" + +#: library/curses.rst:78 +msgid "" +"Assign terminal default foreground/background colors to color number ``-1``. " +"So ``init_pair(x, COLOR_RED, -1)`` will initialize pair *x* as red on " +"default background and ``init_pair(x, -1, COLOR_BLUE)`` will initialize pair " +"*x* as default foreground on blue." +msgstr "" + +#: library/curses.rst:83 +msgid "Change the definition of the color-pair ``0`` to ``(fg, bg)``." +msgstr "" + +#: library/curses.rst:90 msgid "" "Return the output speed of the terminal in bits per second. On software " "terminal emulators it will have a fixed high value. Included for historical " @@ -119,17 +156,17 @@ msgid "" "and occasionally to change interfaces depending on the line speed." msgstr "" -#: library/curses.rst:79 +#: library/curses.rst:98 msgid "Emit a short attention sound." msgstr "" -#: library/curses.rst:84 +#: library/curses.rst:103 msgid "" "Return ``True`` or ``False``, depending on whether the programmer can change " "the colors displayed by the terminal." msgstr "" -#: library/curses.rst:90 +#: library/curses.rst:109 msgid "" "Enter cbreak mode. In cbreak mode (sometimes called \"rare\" mode) normal " "tty line buffering is turned off and characters are available to be read one " @@ -139,7 +176,7 @@ msgid "" "terminal in cbreak mode." msgstr "" -#: library/curses.rst:99 +#: library/curses.rst:118 msgid "" "Return the intensity of the red, green, and blue (RGB) components in the " "color *color_number*, which must be between ``0`` and ``COLORS - 1``. " @@ -148,7 +185,7 @@ msgid "" "component)." msgstr "" -#: library/curses.rst:107 +#: library/curses.rst:126 msgid "" "Return the attribute value for displaying text in the specified color pair. " "Only the first 256 color pairs are supported. This attribute value can be " @@ -157,7 +194,7 @@ msgid "" "function." msgstr "" -#: library/curses.rst:116 +#: library/curses.rst:135 msgid "" "Set the cursor state. *visibility* can be set to ``0``, ``1``, or ``2``, " "for invisible, normal, or very visible. If the terminal supports the " @@ -166,7 +203,7 @@ msgid "" "and the \"very visible\" mode is a block cursor." msgstr "" -#: library/curses.rst:125 +#: library/curses.rst:144 msgid "" "Save the current terminal mode as the \"program\" mode, the mode when the " "running program is using curses. (Its counterpart is the \"shell\" mode, " @@ -174,7 +211,7 @@ msgid "" "`reset_prog_mode` will restore this mode." msgstr "" -#: library/curses.rst:133 +#: library/curses.rst:152 msgid "" "Save the current terminal mode as the \"shell\" mode, the mode when the " "running program is not using curses. (Its counterpart is the \"program\" " @@ -182,11 +219,11 @@ msgid "" "func:`reset_shell_mode` will restore this mode." msgstr "" -#: library/curses.rst:141 +#: library/curses.rst:160 msgid "Insert an *ms* millisecond pause in output." msgstr "" -#: library/curses.rst:146 +#: library/curses.rst:165 msgid "" "Update the physical screen. The curses library keeps two data structures, " "one representing the current physical screen contents and a virtual screen " @@ -194,7 +231,7 @@ msgid "" "the physical screen to match the virtual screen." msgstr "" -#: library/curses.rst:151 +#: library/curses.rst:170 msgid "" "The virtual screen may be updated by a :meth:`~window.noutrefresh` call " "after write operations such as :meth:`~window.addstr` have been performed on " @@ -205,24 +242,24 @@ msgid "" "func:`!doupdate`." msgstr "" -#: library/curses.rst:161 +#: library/curses.rst:180 msgid "" "Enter echo mode. In echo mode, each character input is echoed to the screen " "as it is entered." msgstr "" -#: library/curses.rst:167 +#: library/curses.rst:186 msgid "De-initialize the library, and return terminal to normal status." msgstr "" -#: library/curses.rst:172 +#: library/curses.rst:191 msgid "" "Return the user's current erase character as a one-byte bytes object. Under " "Unix operating systems this is a property of the controlling tty of the " "curses program, and is not set by the curses library itself." msgstr "" -#: library/curses.rst:179 +#: library/curses.rst:198 msgid "" "The :func:`.filter` routine, if used, must be called before :func:`initscr` " "is called. The effect is that, during those calls, :envvar:`LINES` is set " @@ -233,20 +270,20 @@ msgid "" "time line editing without touching the rest of the screen." msgstr "" -#: library/curses.rst:189 +#: library/curses.rst:208 msgid "" "Flash the screen. That is, change it to reverse-video and then change it " "back in a short interval. Some people prefer such as 'visible bell' to the " "audible attention signal produced by :func:`beep`." msgstr "" -#: library/curses.rst:196 +#: library/curses.rst:215 msgid "" "Flush all input buffers. This throws away any typeahead that has been " "typed by the user and has not yet been processed by the program." msgstr "" -#: library/curses.rst:202 +#: library/curses.rst:221 msgid "" "After :meth:`~window.getch` returns :const:`KEY_MOUSE` to signal a mouse " "event, this method should be called to retrieve the queued mouse event, " @@ -261,51 +298,51 @@ msgid "" "const:`BUTTON_ALT`." msgstr "" -#: library/curses.rst:1774 +#: library/curses.rst:1800 msgid "" "The ``BUTTON5_*`` constants are now exposed if they are provided by the " "underlying curses library." msgstr "" -#: library/curses.rst:220 +#: library/curses.rst:239 msgid "" "Return the current coordinates of the virtual screen cursor as a tuple ``(y, " "x)``. If :meth:`leaveok ` is currently ``True``, then " "return ``(-1, -1)``." msgstr "" -#: library/curses.rst:226 +#: library/curses.rst:245 msgid "" "Read window related data stored in the file by an earlier :func:`window." "putwin` call. The routine then creates and initializes a new window using " "that data, returning the new window object." msgstr "" -#: library/curses.rst:233 +#: library/curses.rst:252 msgid "" "Return ``True`` if the terminal can display colors; otherwise, return " "``False``." msgstr "" -#: library/curses.rst:237 +#: library/curses.rst:256 msgid "" "Return ``True`` if the module supports extended colors; otherwise, return " "``False``. Extended color support allows more than 256 color pairs for " "terminals that support more than 16 colors (e.g. xterm-256color)." msgstr "" -#: library/curses.rst:241 +#: library/curses.rst:260 msgid "Extended color support requires ncurses version 6.1 or later." msgstr "" -#: library/curses.rst:247 +#: library/curses.rst:266 msgid "" "Return ``True`` if the terminal has insert- and delete-character " "capabilities. This function is included for historical reasons only, as all " "modern software terminal emulators have such capabilities." msgstr "" -#: library/curses.rst:254 +#: library/curses.rst:273 msgid "" "Return ``True`` if the terminal has insert- and delete-line capabilities, or " "can simulate them using scrolling regions. This function is included for " @@ -313,13 +350,13 @@ msgid "" "capabilities." msgstr "" -#: library/curses.rst:262 +#: library/curses.rst:281 msgid "" "Take a key value *ch*, and return ``True`` if the current terminal type " "recognizes a key with that value." msgstr "" -#: library/curses.rst:268 +#: library/curses.rst:287 msgid "" "Used for half-delay mode, which is similar to cbreak mode in that characters " "typed by the user are immediately available to the program. However, after " @@ -328,7 +365,7 @@ msgid "" "``255``. Use :func:`nocbreak` to leave half-delay mode." msgstr "" -#: library/curses.rst:277 +#: library/curses.rst:296 msgid "" "Change the definition of a color, taking the number of the color to be " "changed followed by three RGB values (for the amounts of red, green, and " @@ -340,44 +377,45 @@ msgid "" "``True``." msgstr "" -#: library/curses.rst:288 +#: library/curses.rst:307 msgid "" "Change the definition of a color-pair. It takes three arguments: the number " "of the color-pair to be changed, the foreground color number, and the " "background color number. The value of *pair_number* must be between ``1`` " -"and ``COLOR_PAIRS - 1`` (the ``0`` color pair is wired to white on black and " -"cannot be changed). The value of *fg* and *bg* arguments must be between " -"``0`` and ``COLORS - 1``, or, after calling :func:`use_default_colors`, " +"and ``COLOR_PAIRS - 1`` (the ``0`` color pair can only be changed by :func:" +"`use_default_colors` and :func:`assume_default_colors`). The value of *fg* " +"and *bg* arguments must be between ``0`` and ``COLORS - 1``, or, after " +"calling :func:`!use_default_colors` or :func:`!assume_default_colors`, " "``-1``. If the color-pair was previously initialized, the screen is " "refreshed and all occurrences of that color-pair are changed to the new " "definition." msgstr "" -#: library/curses.rst:301 +#: library/curses.rst:322 msgid "" "Initialize the library. Return a :ref:`window ` " "object which represents the whole screen." msgstr "" -#: library/curses.rst:306 +#: library/curses.rst:327 msgid "" "If there is an error opening the terminal, the underlying curses library may " "cause the interpreter to exit." msgstr "" -#: library/curses.rst:312 +#: library/curses.rst:333 msgid "" "Return ``True`` if :func:`resize_term` would modify the window structure, " "``False`` otherwise." msgstr "" -#: library/curses.rst:318 +#: library/curses.rst:339 msgid "" "Return ``True`` if :func:`endwin` has been called (that is, the curses " "library has been deinitialized)." msgstr "" -#: library/curses.rst:324 +#: library/curses.rst:345 msgid "" "Return the name of the key numbered *k* as a bytes object. The name of a " "key generating printable ASCII character is the key's character. The name " @@ -388,27 +426,27 @@ msgid "" "character." msgstr "" -#: library/curses.rst:334 +#: library/curses.rst:355 msgid "" "Return the user's current line kill character as a one-byte bytes object. " "Under Unix operating systems this is a property of the controlling tty of " "the curses program, and is not set by the curses library itself." msgstr "" -#: library/curses.rst:341 +#: library/curses.rst:362 msgid "" "Return a bytes object containing the terminfo long name field describing the " "current terminal. The maximum length of a verbose description is 128 " "characters. It is defined only after the call to :func:`initscr`." msgstr "" -#: library/curses.rst:348 +#: library/curses.rst:369 msgid "" "If *flag* is ``True``, allow 8-bit characters to be input. If *flag* is " "``False``, allow only 7-bit chars." msgstr "" -#: library/curses.rst:354 +#: library/curses.rst:375 msgid "" "Set the maximum time in milliseconds that can elapse between press and " "release events in order for them to be recognized as a click, and return the " @@ -416,7 +454,7 @@ msgid "" "fifth of a second." msgstr "" -#: library/curses.rst:361 +#: library/curses.rst:382 msgid "" "Set the mouse events to be reported, and return a tuple ``(availmask, " "oldmask)``. *availmask* indicates which of the specified mouse events can " @@ -425,17 +463,17 @@ msgid "" "never called, no mouse events are ever reported." msgstr "" -#: library/curses.rst:370 +#: library/curses.rst:391 msgid "Sleep for *ms* milliseconds." msgstr "" -#: library/curses.rst:375 +#: library/curses.rst:396 msgid "" "Create and return a pointer to a new pad data structure with the given " "number of lines and columns. Return a pad as a window object." msgstr "" -#: library/curses.rst:378 +#: library/curses.rst:399 msgid "" "A pad is like a window, except that it is not restricted by the screen size, " "and is not necessarily associated with a particular part of the screen. " @@ -451,35 +489,35 @@ msgid "" "to be displayed." msgstr "" -#: library/curses.rst:394 +#: library/curses.rst:415 msgid "" "Return a new :ref:`window `, whose left-upper corner " "is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*." msgstr "" -#: library/curses.rst:397 +#: library/curses.rst:418 msgid "" "By default, the window will extend from the specified position to the lower " "right corner of the screen." msgstr "" -#: library/curses.rst:403 +#: library/curses.rst:424 msgid "" "Enter newline mode. This mode translates the return key into newline on " "input, and translates newline into return and line-feed on output. Newline " "mode is initially on." msgstr "" -#: library/curses.rst:410 +#: library/curses.rst:431 msgid "" "Leave cbreak mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: library/curses.rst:415 +#: library/curses.rst:436 msgid "Leave echo mode. Echoing of input characters is turned off." msgstr "" -#: library/curses.rst:420 +#: library/curses.rst:441 msgid "" "Leave newline mode. Disable translation of return into newline on input, " "and disable low-level translation of newline into newline/return on output " @@ -489,7 +527,7 @@ msgid "" "also, it will be able to detect the return key on input." msgstr "" -#: library/curses.rst:430 +#: library/curses.rst:451 msgid "" "When the :func:`!noqiflush` routine is used, normal flush of input and " "output queues associated with the ``INTR``, ``QUIT`` and ``SUSP`` characters " @@ -498,63 +536,63 @@ msgid "" "occurred, after the handler exits." msgstr "" -#: library/curses.rst:438 +#: library/curses.rst:459 msgid "Leave raw mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: library/curses.rst:443 +#: library/curses.rst:464 msgid "" "Return a tuple ``(fg, bg)`` containing the colors for the requested color " "pair. The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - " "1``." msgstr "" -#: library/curses.rst:449 +#: library/curses.rst:470 msgid "" "Return the number of the color-pair set by the attribute value *attr*. :func:" "`color_pair` is the counterpart to this function." msgstr "" -#: library/curses.rst:455 +#: library/curses.rst:476 msgid "" "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " "terminfo capability for the current terminal. Note that the output of :func:" "`putp` always goes to standard output." msgstr "" -#: library/curses.rst:462 +#: library/curses.rst:483 msgid "" "If *flag* is ``False``, the effect is the same as calling :func:`noqiflush`. " "If *flag* is ``True``, or no argument is provided, the queues will be " "flushed when these control characters are read." msgstr "" -#: library/curses.rst:469 +#: library/curses.rst:490 msgid "" "Enter raw mode. In raw mode, normal line buffering and processing of " "interrupt, quit, suspend, and flow control keys are turned off; characters " "are presented to curses input functions one by one." msgstr "" -#: library/curses.rst:476 +#: library/curses.rst:497 msgid "" "Restore the terminal to \"program\" mode, as previously saved by :func:" "`def_prog_mode`." msgstr "" -#: library/curses.rst:482 +#: library/curses.rst:503 msgid "" "Restore the terminal to \"shell\" mode, as previously saved by :func:" "`def_shell_mode`." msgstr "" -#: library/curses.rst:488 +#: library/curses.rst:509 msgid "" "Restore the state of the terminal modes to what it was at the last call to :" "func:`savetty`." msgstr "" -#: library/curses.rst:494 +#: library/curses.rst:515 msgid "" "Backend function used by :func:`resizeterm`, performing most of the work; " "when resizing the windows, :func:`resize_term` blank-fills the areas that " @@ -564,47 +602,47 @@ msgid "" "to resize these without additional interaction with the application." msgstr "" -#: library/curses.rst:504 +#: library/curses.rst:525 msgid "" "Resize the standard and current windows to the specified dimensions, and " "adjusts other bookkeeping data used by the curses library that record the " "window dimensions (in particular the SIGWINCH handler)." msgstr "" -#: library/curses.rst:511 +#: library/curses.rst:532 msgid "" "Save the current state of the terminal modes in a buffer, usable by :func:" "`resetty`." msgstr "" -#: library/curses.rst:516 +#: library/curses.rst:537 msgid "Retrieves the value set by :func:`set_escdelay`." msgstr "" -#: library/curses.rst:522 +#: library/curses.rst:543 msgid "" "Sets the number of milliseconds to wait after reading an escape character, " "to distinguish between an individual escape character entered on the " "keyboard from escape sequences sent by cursor and function keys." msgstr "" -#: library/curses.rst:530 +#: library/curses.rst:551 msgid "Retrieves the value set by :func:`set_tabsize`." msgstr "" -#: library/curses.rst:536 +#: library/curses.rst:557 msgid "" "Sets the number of columns used by the curses library when converting a tab " "character to spaces as it adds the tab to a window." msgstr "" -#: library/curses.rst:543 +#: library/curses.rst:564 msgid "" "Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both ``-1``, " "then :meth:`leaveok ` is set ``True``." msgstr "" -#: library/curses.rst:549 +#: library/curses.rst:570 msgid "" "Initialize the terminal. *term* is a string giving the terminal name, or " "``None``; if omitted or ``None``, the value of the :envvar:`TERM` " @@ -613,14 +651,14 @@ msgid "" "descriptor for ``sys.stdout`` will be used." msgstr "" -#: library/curses.rst:558 +#: library/curses.rst:579 msgid "" "Must be called if the programmer wants to use colors, and before any other " "color manipulation routine is called. It is good practice to call this " "routine right after :func:`initscr`." msgstr "" -#: library/curses.rst:562 +#: library/curses.rst:583 msgid "" ":func:`start_color` initializes eight basic colors (black, red, green, " "yellow, blue, magenta, cyan, and white), and two global variables in the :" @@ -630,20 +668,20 @@ msgid "" "terminal was just turned on." msgstr "" -#: library/curses.rst:571 +#: library/curses.rst:592 msgid "" "Return a logical OR of all video attributes supported by the terminal. This " "information is useful when a curses program needs complete control over the " "appearance of the screen." msgstr "" -#: library/curses.rst:578 +#: library/curses.rst:599 msgid "" "Return the value of the environment variable :envvar:`TERM`, as a bytes " "object, truncated to 14 characters." msgstr "" -#: library/curses.rst:584 +#: library/curses.rst:605 msgid "" "Return the value of the Boolean capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-1`` if " @@ -651,7 +689,7 @@ msgid "" "from the terminal description." msgstr "" -#: library/curses.rst:592 +#: library/curses.rst:613 msgid "" "Return the value of the numeric capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-2`` if " @@ -659,7 +697,7 @@ msgid "" "from the terminal description." msgstr "" -#: library/curses.rst:600 +#: library/curses.rst:621 msgid "" "Return the value of the string capability corresponding to the terminfo " "capability name *capname* as a bytes object. Return ``None`` if *capname* " @@ -667,7 +705,7 @@ msgid "" "terminal description." msgstr "" -#: library/curses.rst:608 +#: library/curses.rst:629 msgid "" "Instantiate the bytes object *str* with the supplied parameters, where *str* " "should be a parameterized string obtained from the terminfo database. E.g. " @@ -675,13 +713,13 @@ msgid "" "exact result depending on terminal type." msgstr "" -#: library/curses.rst:616 +#: library/curses.rst:637 msgid "" "Specify that the file descriptor *fd* be used for typeahead checking. If " "*fd* is ``-1``, then no typeahead checking is done." msgstr "" -#: library/curses.rst:619 +#: library/curses.rst:640 msgid "" "The curses library does \"line-breakout optimization\" by looking for " "typeahead periodically while updating the screen. If input is found, and it " @@ -691,7 +729,7 @@ msgid "" "typeahead checking." msgstr "" -#: library/curses.rst:628 +#: library/curses.rst:649 msgid "" "Return a bytes object which is a printable representation of the character " "*ch*. Control characters are represented as a caret followed by the " @@ -699,35 +737,35 @@ msgid "" "are." msgstr "" -#: library/curses.rst:635 +#: library/curses.rst:656 msgid "Push *ch* so the next :meth:`~window.getch` will return it." msgstr "" -#: library/curses.rst:639 +#: library/curses.rst:660 msgid "Only one *ch* can be pushed before :meth:`!getch` is called." msgstr "" -#: library/curses.rst:644 +#: library/curses.rst:665 msgid "" "Update the :const:`LINES` and :const:`COLS` module variables. Useful for " "detecting manual screen resize." msgstr "" -#: library/curses.rst:652 +#: library/curses.rst:673 msgid "Push *ch* so the next :meth:`~window.get_wch` will return it." msgstr "" -#: library/curses.rst:656 +#: library/curses.rst:677 msgid "Only one *ch* can be pushed before :meth:`!get_wch` is called." msgstr "" -#: library/curses.rst:663 +#: library/curses.rst:684 msgid "" "Push a :const:`KEY_MOUSE` event onto the input queue, associating the given " "state data with it." msgstr "" -#: library/curses.rst:669 +#: library/curses.rst:690 msgid "" "If used, this function should be called before :func:`initscr` or newterm " "are called. When *flag* is ``False``, the values of lines and columns " @@ -737,16 +775,11 @@ msgid "" "to use the window size if :envvar:`LINES` and :envvar:`COLUMNS` are not set)." msgstr "" -#: library/curses.rst:679 -msgid "" -"Allow use of default values for colors on terminals supporting this feature. " -"Use this to support transparency in your application. The default color is " -"assigned to the color number ``-1``. After calling this function, " -"``init_pair(x, curses.COLOR_RED, -1)`` initializes, for instance, color pair " -"*x* to a red foreground color on the default background." +#: library/curses.rst:700 +msgid "Equivalent to ``assume_default_colors(-1, -1)``." msgstr "" -#: library/curses.rst:688 +#: library/curses.rst:705 msgid "" "Initialize curses and call another callable object, *func*, which should be " "the rest of your curses-using application. If the application raises an " @@ -760,50 +793,50 @@ msgid "" "echo, and disables the terminal keypad." msgstr "" -#: library/curses.rst:702 +#: library/curses.rst:719 msgid "Window Objects" msgstr "" -#: library/curses.rst:704 +#: library/curses.rst:723 msgid "" "Window objects, as returned by :func:`initscr` and :func:`newwin` above, " "have the following methods and attributes:" msgstr "" -#: library/curses.rst:711 +#: library/curses.rst:730 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, overwriting any " "character previously painted at that location. By default, the character " "position and attributes are the current settings for the window object." msgstr "" -#: library/curses.rst:717 +#: library/curses.rst:736 msgid "" "Writing outside the window, subwindow, or pad raises a :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the character is printed." msgstr "" -#: library/curses.rst:725 +#: library/curses.rst:744 msgid "" "Paint at most *n* characters of the character string *str* at ``(y, x)`` " "with attributes *attr*, overwriting anything previously on the display." msgstr "" -#: library/curses.rst:733 +#: library/curses.rst:752 msgid "" "Paint the character string *str* at ``(y, x)`` with attributes *attr*, " "overwriting anything previously on the display." msgstr "" -#: library/curses.rst:738 +#: library/curses.rst:757 msgid "" "Writing outside the window, subwindow, or pad raises :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the string is printed." msgstr "" -#: library/curses.rst:742 +#: library/curses.rst:761 msgid "" "A `bug in ncurses `_, the backend for " "this Python module, can cause SegFaults when resizing windows. This is fixed " @@ -813,44 +846,44 @@ msgid "" "line." msgstr "" -#: library/curses.rst:752 +#: library/curses.rst:771 msgid "" "Remove attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: library/curses.rst:758 +#: library/curses.rst:777 msgid "" -"Add attribute *attr* from the \"background\" set applied to all writes to " -"the current window." +"Add attribute *attr* to the \"background\" set applied to all writes to the " +"current window." msgstr "" -#: library/curses.rst:764 +#: library/curses.rst:783 msgid "" "Set the \"background\" set of attributes to *attr*. This set is initially " "``0`` (no attributes)." msgstr "" -#: library/curses.rst:770 +#: library/curses.rst:789 msgid "" "Set the background property of the window to the character *ch*, with " "attributes *attr*. The change is then applied to every character position " "in that window:" msgstr "" -#: library/curses.rst:774 +#: library/curses.rst:793 msgid "" "The attribute of every character in the window is changed to the new " "background attribute." msgstr "" -#: library/curses.rst:777 +#: library/curses.rst:796 msgid "" "Wherever the former background character appears, it is changed to the new " "background character." msgstr "" -#: library/curses.rst:783 +#: library/curses.rst:802 msgid "" "Set the window's background. A window's background consists of a character " "and any combination of attributes. The attribute part of the background is " @@ -861,128 +894,128 @@ msgid "" "delete line/character operations." msgstr "" -#: library/curses.rst:793 +#: library/curses.rst:812 msgid "" "Draw a border around the edges of the window. Each parameter specifies the " "character to use for a specific part of the border; see the table below for " "more details." msgstr "" -#: library/curses.rst:799 +#: library/curses.rst:818 msgid "" "A ``0`` value for any parameter will cause the default character to be used " "for that parameter. Keyword parameters can *not* be used. The defaults are " "listed in this table:" msgstr "" -#: library/curses.rst:804 +#: library/curses.rst:823 msgid "Parameter" msgstr "" -#: library/curses.rst:804 +#: library/curses.rst:823 msgid "Description" msgstr "" -#: library/curses.rst:804 +#: library/curses.rst:823 msgid "Default value" msgstr "" -#: library/curses.rst:806 +#: library/curses.rst:825 msgid "*ls*" msgstr "" -#: library/curses.rst:806 +#: library/curses.rst:825 msgid "Left side" msgstr "" -#: library/curses.rst:808 +#: library/curses.rst:827 msgid ":const:`ACS_VLINE`" msgstr "" -#: library/curses.rst:808 +#: library/curses.rst:827 msgid "*rs*" msgstr "" -#: library/curses.rst:808 +#: library/curses.rst:827 msgid "Right side" msgstr "" -#: library/curses.rst:810 +#: library/curses.rst:829 msgid "*ts*" msgstr "" -#: library/curses.rst:810 +#: library/curses.rst:829 msgid "Top" msgstr "" -#: library/curses.rst:812 +#: library/curses.rst:831 msgid ":const:`ACS_HLINE`" msgstr "" -#: library/curses.rst:812 +#: library/curses.rst:831 msgid "*bs*" msgstr "" -#: library/curses.rst:812 +#: library/curses.rst:831 msgid "Bottom" msgstr "" -#: library/curses.rst:814 +#: library/curses.rst:833 msgid "*tl*" msgstr "" -#: library/curses.rst:814 +#: library/curses.rst:833 msgid "Upper-left corner" msgstr "" -#: library/curses.rst:814 +#: library/curses.rst:833 msgid ":const:`ACS_ULCORNER`" msgstr "" -#: library/curses.rst:816 +#: library/curses.rst:835 msgid "*tr*" msgstr "" -#: library/curses.rst:816 +#: library/curses.rst:835 msgid "Upper-right corner" msgstr "" -#: library/curses.rst:816 +#: library/curses.rst:835 msgid ":const:`ACS_URCORNER`" msgstr "" -#: library/curses.rst:818 +#: library/curses.rst:837 msgid "*bl*" msgstr "" -#: library/curses.rst:818 +#: library/curses.rst:837 msgid "Bottom-left corner" msgstr "" -#: library/curses.rst:818 +#: library/curses.rst:837 msgid ":const:`ACS_LLCORNER`" msgstr "" -#: library/curses.rst:820 +#: library/curses.rst:839 msgid "*br*" msgstr "" -#: library/curses.rst:820 +#: library/curses.rst:839 msgid "Bottom-right corner" msgstr "" -#: library/curses.rst:820 +#: library/curses.rst:839 msgid ":const:`ACS_LRCORNER`" msgstr "" -#: library/curses.rst:826 +#: library/curses.rst:845 msgid "" "Similar to :meth:`border`, but both *ls* and *rs* are *vertch* and both *ts* " "and *bs* are *horch*. The default corner characters are always used by this " "function." msgstr "" -#: library/curses.rst:835 +#: library/curses.rst:854 msgid "" "Set the attributes of *num* characters at the current cursor position, or at " "position ``(y, x)`` if supplied. If *num* is not given or is ``-1``, the " @@ -992,45 +1025,45 @@ msgid "" "be redisplayed by the next window refresh." msgstr "" -#: library/curses.rst:845 +#: library/curses.rst:864 msgid "" "Like :meth:`erase`, but also cause the whole window to be repainted upon " "next call to :meth:`refresh`." msgstr "" -#: library/curses.rst:851 +#: library/curses.rst:870 msgid "" "If *flag* is ``True``, the next call to :meth:`refresh` will clear the " "window completely." msgstr "" -#: library/curses.rst:857 +#: library/curses.rst:876 msgid "" "Erase from cursor to the end of the window: all lines below the cursor are " "deleted, and then the equivalent of :meth:`clrtoeol` is performed." msgstr "" -#: library/curses.rst:863 +#: library/curses.rst:882 msgid "Erase from cursor to the end of the line." msgstr "" -#: library/curses.rst:868 +#: library/curses.rst:887 msgid "" "Update the current cursor position of all the ancestors of the window to " "reflect the current cursor position of the window." msgstr "" -#: library/curses.rst:874 +#: library/curses.rst:893 msgid "Delete any character at ``(y, x)``." msgstr "" -#: library/curses.rst:879 +#: library/curses.rst:898 msgid "" "Delete the line under the cursor. All following lines are moved up by one " "line." msgstr "" -#: library/curses.rst:885 +#: library/curses.rst:904 msgid "" "An abbreviation for \"derive window\", :meth:`derwin` is the same as " "calling :meth:`subwin`, except that *begin_y* and *begin_x* are relative to " @@ -1038,13 +1071,13 @@ msgid "" "a window object for the derived window." msgstr "" -#: library/curses.rst:893 +#: library/curses.rst:912 msgid "" "Add character *ch* with attribute *attr*, and immediately call :meth:" "`refresh` on the window." msgstr "" -#: library/curses.rst:899 +#: library/curses.rst:918 msgid "" "Test whether the given pair of screen-relative character-cell coordinates " "are enclosed by the given window, returning ``True`` or ``False``. It is " @@ -1052,11 +1085,11 @@ msgid "" "location of a mouse event." msgstr "" -#: library/curses.rst:904 +#: library/curses.rst:923 msgid "Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``." msgstr "" -#: library/curses.rst:910 +#: library/curses.rst:929 msgid "" "Encoding used to encode method arguments (Unicode strings and characters). " "The encoding attribute is inherited from the parent window when a subwindow " @@ -1064,19 +1097,19 @@ msgid "" "locale encoding is used (see :func:`locale.getencoding`)." msgstr "" -#: library/curses.rst:920 +#: library/curses.rst:939 msgid "Clear the window." msgstr "" -#: library/curses.rst:925 -msgid "Return a tuple ``(y, x)`` of co-ordinates of upper-left corner." +#: library/curses.rst:944 +msgid "Return a tuple ``(y, x)`` of coordinates of upper-left corner." msgstr "" -#: library/curses.rst:930 +#: library/curses.rst:949 msgid "Return the given window's current background character/attribute pair." msgstr "" -#: library/curses.rst:935 +#: library/curses.rst:954 msgid "" "Get a character. Note that the integer returned does *not* have to be in " "ASCII range: function keys, keypad keys and so on are represented by numbers " @@ -1084,14 +1117,14 @@ msgid "" "otherwise wait until a key is pressed." msgstr "" -#: library/curses.rst:943 +#: library/curses.rst:962 msgid "" "Get a wide character. Return a character for most keys, or an integer for " "function keys, keypad keys, and other special keys. In no-delay mode, raise " "an exception if there is no input." msgstr "" -#: library/curses.rst:952 +#: library/curses.rst:971 msgid "" "Get a character, returning a string instead of an integer, as :meth:`getch` " "does. Function keys, keypad keys and other special keys return a multibyte " @@ -1099,35 +1132,40 @@ msgid "" "there is no input." msgstr "" -#: library/curses.rst:960 +#: library/curses.rst:979 msgid "Return a tuple ``(y, x)`` of the height and width of the window." msgstr "" -#: library/curses.rst:965 +#: library/curses.rst:984 msgid "" "Return the beginning coordinates of this window relative to its parent " "window as a tuple ``(y, x)``. Return ``(-1, -1)`` if this window has no " "parent." msgstr "" -#: library/curses.rst:975 +#: library/curses.rst:994 msgid "" -"Read a bytes object from the user, with primitive line editing capacity." +"Read a bytes object from the user, with primitive line editing capacity. The " +"maximum value for *n* is 2047." +msgstr "" + +#: library/curses.rst:1092 +msgid "The maximum value for *n* was increased from 1023 to 2047." msgstr "" -#: library/curses.rst:980 +#: library/curses.rst:1003 msgid "" "Return a tuple ``(y, x)`` of current cursor position relative to the " "window's upper-left corner." msgstr "" -#: library/curses.rst:987 +#: library/curses.rst:1010 msgid "" "Display a horizontal line starting at ``(y, x)`` with length *n* consisting " "of the character *ch*." msgstr "" -#: library/curses.rst:993 +#: library/curses.rst:1016 msgid "" "If *flag* is ``False``, curses no longer considers using the hardware insert/" "delete character feature of the terminal; if *flag* is ``True``, use of " @@ -1135,13 +1173,13 @@ msgid "" "initialized, use of character insert/delete is enabled by default." msgstr "" -#: library/curses.rst:1001 +#: library/curses.rst:1024 msgid "" "If *flag* is ``True``, :mod:`curses` will try and use hardware line editing " "facilities. Otherwise, line insertion/deletion are disabled." msgstr "" -#: library/curses.rst:1007 +#: library/curses.rst:1030 msgid "" "If *flag* is ``True``, any change in the window image automatically causes " "the window to be refreshed; you no longer have to call :meth:`refresh` " @@ -1149,19 +1187,19 @@ msgid "" "calls to wrefresh. This option is disabled by default." msgstr "" -#: library/curses.rst:1015 +#: library/curses.rst:1038 msgid "" "Return the character at the given position in the window. The bottom 8 bits " "are the character proper, and upper bits are the attributes." msgstr "" -#: library/curses.rst:1022 +#: library/curses.rst:1045 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line " "from position *x* right by one character." msgstr "" -#: library/curses.rst:1028 +#: library/curses.rst:1051 msgid "" "Insert *nlines* lines into the specified window above the current line. The " "*nlines* bottom lines are lost. For negative *nlines*, delete *nlines* " @@ -1170,13 +1208,13 @@ msgid "" "remains the same." msgstr "" -#: library/curses.rst:1037 +#: library/curses.rst:1060 msgid "" "Insert a blank line under the cursor. All following lines are moved down by " "one line." msgstr "" -#: library/curses.rst:1044 +#: library/curses.rst:1067 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor, up to *n* characters. If *n* is " @@ -1186,7 +1224,7 @@ msgid "" "if specified)." msgstr "" -#: library/curses.rst:1054 +#: library/curses.rst:1077 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor. All characters to the right of the " @@ -1195,84 +1233,85 @@ msgid "" "specified)." msgstr "" -#: library/curses.rst:1063 +#: library/curses.rst:1086 msgid "" "Return a bytes object of characters, extracted from the window starting at " "the current cursor position, or at *y*, *x* if specified. Attributes are " "stripped from the characters. If *n* is specified, :meth:`instr` returns a " -"string at most *n* characters long (exclusive of the trailing NUL)." +"string at most *n* characters long (exclusive of the trailing NUL). The " +"maximum value for *n* is 2047." msgstr "" -#: library/curses.rst:1071 +#: library/curses.rst:1098 msgid "" "Return ``True`` if the specified line was modified since the last call to :" "meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " "exception if *line* is not valid for the given window." msgstr "" -#: library/curses.rst:1078 +#: library/curses.rst:1105 msgid "" "Return ``True`` if the specified window was modified since the last call to :" "meth:`refresh`; otherwise return ``False``." msgstr "" -#: library/curses.rst:1084 +#: library/curses.rst:1111 msgid "" "If *flag* is ``True``, escape sequences generated by some keys (keypad, " "function keys) will be interpreted by :mod:`curses`. If *flag* is ``False``, " "escape sequences will be left as is in the input stream." msgstr "" -#: library/curses.rst:1091 +#: library/curses.rst:1118 msgid "" "If *flag* is ``True``, cursor is left where it is on update, instead of " "being at \"cursor position.\" This reduces cursor movement where possible. " "If possible the cursor will be made invisible." msgstr "" -#: library/curses.rst:1095 +#: library/curses.rst:1122 msgid "" "If *flag* is ``False``, cursor will always be at \"cursor position\" after " "an update." msgstr "" -#: library/curses.rst:1100 +#: library/curses.rst:1127 msgid "Move cursor to ``(new_y, new_x)``." msgstr "" -#: library/curses.rst:1105 +#: library/curses.rst:1132 msgid "" "Move the window inside its parent window. The screen-relative parameters of " "the window are not changed. This routine is used to display different parts " "of the parent window at the same physical position on the screen." msgstr "" -#: library/curses.rst:1112 +#: library/curses.rst:1139 msgid "Move the window so its upper-left corner is at ``(new_y, new_x)``." msgstr "" -#: library/curses.rst:1117 +#: library/curses.rst:1144 msgid "If *flag* is ``True``, :meth:`getch` will be non-blocking." msgstr "" -#: library/curses.rst:1122 +#: library/curses.rst:1149 msgid "If *flag* is ``True``, escape sequences will not be timed out." msgstr "" -#: library/curses.rst:1124 +#: library/curses.rst:1151 msgid "" "If *flag* is ``False``, after a few milliseconds, an escape sequence will " "not be interpreted, and will be left in the input stream as is." msgstr "" -#: library/curses.rst:1130 +#: library/curses.rst:1157 msgid "" "Mark for refresh but wait. This function updates the data structure " "representing the desired state of the window, but does not force an update " "of the physical screen. To accomplish that, call :func:`doupdate`." msgstr "" -#: library/curses.rst:1137 +#: library/curses.rst:1164 msgid "" "Overlay the window on top of *destwin*. The windows need not be the same " "size, only the overlapping region is copied. This copy is non-destructive, " @@ -1280,7 +1319,7 @@ msgid "" "contents of *destwin*." msgstr "" -#: library/curses.rst:1142 +#: library/curses.rst:1169 msgid "" "To get fine-grained control over the copied region, the second form of :meth:" "`overlay` can be used. *sminrow* and *smincol* are the upper-left " @@ -1288,7 +1327,7 @@ msgid "" "in the destination window." msgstr "" -#: library/curses.rst:1150 +#: library/curses.rst:1177 msgid "" "Overwrite the window on top of *destwin*. The windows need not be the same " "size, in which case only the overlapping region is copied. This copy is " @@ -1296,7 +1335,7 @@ msgid "" "the old contents of *destwin*." msgstr "" -#: library/curses.rst:1155 +#: library/curses.rst:1182 msgid "" "To get fine-grained control over the copied region, the second form of :meth:" "`overwrite` can be used. *sminrow* and *smincol* are the upper-left " @@ -1304,31 +1343,31 @@ msgid "" "the destination window." msgstr "" -#: library/curses.rst:1163 +#: library/curses.rst:1190 msgid "" "Write all data associated with the window into the provided file object. " "This information can be later retrieved using the :func:`getwin` function." msgstr "" -#: library/curses.rst:1169 +#: library/curses.rst:1196 msgid "" "Indicate that the *num* screen lines, starting at line *beg*, are corrupted " "and should be completely redrawn on the next :meth:`refresh` call." msgstr "" -#: library/curses.rst:1175 +#: library/curses.rst:1202 msgid "" "Touch the entire window, causing it to be completely redrawn on the next :" "meth:`refresh` call." msgstr "" -#: library/curses.rst:1181 +#: library/curses.rst:1208 msgid "" "Update the display immediately (sync actual screen with previous drawing/" "deleting methods)." msgstr "" -#: library/curses.rst:1184 +#: library/curses.rst:1211 msgid "" "The 6 optional arguments can only be specified when the window is a pad " "created with :func:`newpad`. The additional parameters are needed to " @@ -1343,7 +1382,7 @@ msgid "" "*smincol* are treated as if they were zero." msgstr "" -#: library/curses.rst:1198 +#: library/curses.rst:1225 msgid "" "Reallocate storage for a curses window to adjust its dimensions to the " "specified values. If either dimension is larger than the current values, " @@ -1351,11 +1390,11 @@ msgid "" "rendition (as set by :meth:`bkgdset`) merged into them." msgstr "" -#: library/curses.rst:1206 +#: library/curses.rst:1233 msgid "Scroll the screen or scrolling region upward by *lines* lines." msgstr "" -#: library/curses.rst:1211 +#: library/curses.rst:1238 msgid "" "Control what happens when the cursor of a window is moved off the edge of " "the window or scrolling region, either as a result of a newline action on " @@ -1365,54 +1404,54 @@ msgid "" "scrolling effect on the terminal, it is also necessary to call :meth:`idlok`." msgstr "" -#: library/curses.rst:1221 +#: library/curses.rst:1248 msgid "" "Set the scrolling region from line *top* to line *bottom*. All scrolling " "actions will take place in this region." msgstr "" -#: library/curses.rst:1227 +#: library/curses.rst:1254 msgid "" "Turn off the standout attribute. On some terminals this has the side effect " "of turning off all attributes." msgstr "" -#: library/curses.rst:1233 +#: library/curses.rst:1260 msgid "Turn on attribute *A_STANDOUT*." msgstr "" -#: library/curses.rst:1246 +#: library/curses.rst:1273 msgid "" "Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, " "and whose width/height is *ncols*/*nlines*." msgstr "" -#: library/curses.rst:1249 +#: library/curses.rst:1276 msgid "" "By default, the sub-window will extend from the specified position to the " "lower right corner of the window." msgstr "" -#: library/curses.rst:1255 +#: library/curses.rst:1282 msgid "" "Touch each location in the window that has been touched in any of its " "ancestor windows. This routine is called by :meth:`refresh`, so it should " "almost never be necessary to call it manually." msgstr "" -#: library/curses.rst:1262 +#: library/curses.rst:1289 msgid "" "If *flag* is ``True``, then :meth:`syncup` is called automatically whenever " "there is a change in the window." msgstr "" -#: library/curses.rst:1268 +#: library/curses.rst:1295 msgid "" "Touch all locations in ancestors of the window that have been changed in " "the window." msgstr "" -#: library/curses.rst:1274 +#: library/curses.rst:1301 msgid "" "Set blocking or non-blocking read behavior for the window. If *delay* is " "negative, blocking read is used (which will wait indefinitely for input). " @@ -1422,7 +1461,7 @@ msgid "" "still no input at the end of that time." msgstr "" -#: library/curses.rst:1284 +#: library/curses.rst:1311 msgid "" "Pretend *count* lines have been changed, starting with line *start*. If " "*changed* is supplied, it specifies whether the affected lines are marked as " @@ -1430,49 +1469,49 @@ msgid "" "``=False``)." msgstr "" -#: library/curses.rst:1291 +#: library/curses.rst:1318 msgid "" "Pretend the whole window has been changed, for purposes of drawing " "optimizations." msgstr "" -#: library/curses.rst:1297 +#: library/curses.rst:1324 msgid "" "Mark all lines in the window as unchanged since the last call to :meth:" "`refresh`." msgstr "" -#: library/curses.rst:1304 +#: library/curses.rst:1331 msgid "" "Display a vertical line starting at ``(y, x)`` with length *n* consisting of " "the character *ch* with attributes *attr*." msgstr "" -#: library/curses.rst:1309 +#: library/curses.rst:1336 msgid "Constants" msgstr "" -#: library/curses.rst:1311 +#: library/curses.rst:1338 msgid "The :mod:`curses` module defines the following data members:" msgstr "" -#: library/curses.rst:1316 +#: library/curses.rst:1343 msgid "" "Some curses routines that return an integer, such as :meth:`~window." "getch`, return :const:`ERR` upon failure." msgstr "" -#: library/curses.rst:1322 +#: library/curses.rst:1349 msgid "" "Some curses routines that return an integer, such as :func:`napms`, " "return :const:`OK` upon success." msgstr "" -#: library/curses.rst:1329 +#: library/curses.rst:1355 msgid "A bytes object representing the current version of the module." msgstr "" -#: library/curses.rst:1334 +#: library/curses.rst:1360 msgid "" "A named tuple containing the three components of the ncurses library " "version: *major*, *minor*, and *patch*. All values are integers. The " @@ -1480,535 +1519,535 @@ msgid "" "is equivalent to ``curses.ncurses_version.major`` and so on." msgstr "" -#: library/curses.rst:1339 +#: library/curses.rst:1365 msgid "Availability: if the ncurses library is used." msgstr "" -#: library/curses.rst:1345 +#: library/curses.rst:1371 msgid "" "The maximum number of colors the terminal can support. It is defined only " "after the call to :func:`start_color`." msgstr "" -#: library/curses.rst:1350 +#: library/curses.rst:1376 msgid "" "The maximum number of color pairs the terminal can support. It is defined " "only after the call to :func:`start_color`." msgstr "" -#: library/curses.rst:1355 +#: library/curses.rst:1381 msgid "" "The width of the screen, i.e., the number of columns. It is defined only " "after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: library/curses.rst:1362 +#: library/curses.rst:1388 msgid "" "The height of the screen, i.e., the number of lines. It is defined only " "after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: library/curses.rst:1368 +#: library/curses.rst:1394 msgid "" "Some constants are available to specify character cell attributes. The exact " "constants available are system dependent." msgstr "" -#: library/curses.rst:1372 +#: library/curses.rst:1398 msgid "Attribute" msgstr "" -#: library/curses.rst:1417 library/curses.rst:1755 +#: library/curses.rst:1443 library/curses.rst:1781 msgid "Meaning" msgstr "" -#: library/curses.rst:1374 +#: library/curses.rst:1400 msgid "Alternate character set mode" msgstr "" -#: library/curses.rst:1376 +#: library/curses.rst:1402 msgid "Blink mode" msgstr "" -#: library/curses.rst:1378 +#: library/curses.rst:1404 msgid "Bold mode" msgstr "" -#: library/curses.rst:1380 +#: library/curses.rst:1406 msgid "Dim mode" msgstr "" -#: library/curses.rst:1382 +#: library/curses.rst:1408 msgid "Invisible or blank mode" msgstr "" -#: library/curses.rst:1384 +#: library/curses.rst:1410 msgid "Italic mode" msgstr "" -#: library/curses.rst:1386 +#: library/curses.rst:1412 msgid "Normal attribute" msgstr "" -#: library/curses.rst:1388 +#: library/curses.rst:1414 msgid "Protected mode" msgstr "" -#: library/curses.rst:1390 +#: library/curses.rst:1416 msgid "Reverse background and foreground colors" msgstr "" -#: library/curses.rst:1393 +#: library/curses.rst:1419 msgid "Standout mode" msgstr "" -#: library/curses.rst:1395 +#: library/curses.rst:1421 msgid "Underline mode" msgstr "" -#: library/curses.rst:1397 +#: library/curses.rst:1423 msgid "Horizontal highlight" msgstr "" -#: library/curses.rst:1399 +#: library/curses.rst:1425 msgid "Left highlight" msgstr "" -#: library/curses.rst:1401 +#: library/curses.rst:1427 msgid "Low highlight" msgstr "" -#: library/curses.rst:1403 +#: library/curses.rst:1429 msgid "Right highlight" msgstr "" -#: library/curses.rst:1405 +#: library/curses.rst:1431 msgid "Top highlight" msgstr "" -#: library/curses.rst:1407 +#: library/curses.rst:1433 msgid "Vertical highlight" msgstr "" -#: library/curses.rst:1410 +#: library/curses.rst:1436 msgid "``A_ITALIC`` was added." msgstr "" -#: library/curses.rst:1413 +#: library/curses.rst:1439 msgid "" "Several constants are available to extract corresponding attributes returned " "by some methods." msgstr "" -#: library/curses.rst:1417 +#: library/curses.rst:1443 msgid "Bit-mask" msgstr "" -#: library/curses.rst:1419 +#: library/curses.rst:1445 msgid "Bit-mask to extract attributes" msgstr "" -#: library/curses.rst:1422 +#: library/curses.rst:1448 msgid "Bit-mask to extract a character" msgstr "" -#: library/curses.rst:1425 +#: library/curses.rst:1451 msgid "Bit-mask to extract color-pair field information" msgstr "" -#: library/curses.rst:1429 +#: library/curses.rst:1455 msgid "" "Keys are referred to by integer constants with names starting with " "``KEY_``. The exact keycaps available are system dependent." msgstr "" -#: library/curses.rst:1435 +#: library/curses.rst:1461 msgid "Key constant" msgstr "" -#: library/curses.rst:1435 +#: library/curses.rst:1461 msgid "Key" msgstr "" -#: library/curses.rst:1437 +#: library/curses.rst:1463 msgid "Minimum key value" msgstr "" -#: library/curses.rst:1439 +#: library/curses.rst:1465 msgid "Break key (unreliable)" msgstr "" -#: library/curses.rst:1441 +#: library/curses.rst:1467 msgid "Down-arrow" msgstr "" -#: library/curses.rst:1443 +#: library/curses.rst:1469 msgid "Up-arrow" msgstr "" -#: library/curses.rst:1445 +#: library/curses.rst:1471 msgid "Left-arrow" msgstr "" -#: library/curses.rst:1447 +#: library/curses.rst:1473 msgid "Right-arrow" msgstr "" -#: library/curses.rst:1449 +#: library/curses.rst:1475 msgid "Home key (upward+left arrow)" msgstr "" -#: library/curses.rst:1451 +#: library/curses.rst:1477 msgid "Backspace (unreliable)" msgstr "" -#: library/curses.rst:1453 +#: library/curses.rst:1479 msgid "Function keys. Up to 64 function keys are supported." msgstr "" -#: library/curses.rst:1456 +#: library/curses.rst:1482 msgid "Value of function key *n*" msgstr "" -#: library/curses.rst:1458 +#: library/curses.rst:1484 msgid "Delete line" msgstr "" -#: library/curses.rst:1460 +#: library/curses.rst:1486 msgid "Insert line" msgstr "" -#: library/curses.rst:1462 +#: library/curses.rst:1488 msgid "Delete character" msgstr "" -#: library/curses.rst:1464 +#: library/curses.rst:1490 msgid "Insert char or enter insert mode" msgstr "" -#: library/curses.rst:1466 +#: library/curses.rst:1492 msgid "Exit insert char mode" msgstr "" -#: library/curses.rst:1468 +#: library/curses.rst:1494 msgid "Clear screen" msgstr "" -#: library/curses.rst:1470 +#: library/curses.rst:1496 msgid "Clear to end of screen" msgstr "" -#: library/curses.rst:1472 +#: library/curses.rst:1498 msgid "Clear to end of line" msgstr "" -#: library/curses.rst:1474 +#: library/curses.rst:1500 msgid "Scroll 1 line forward" msgstr "" -#: library/curses.rst:1476 +#: library/curses.rst:1502 msgid "Scroll 1 line backward (reverse)" msgstr "" -#: library/curses.rst:1478 +#: library/curses.rst:1504 msgid "Next page" msgstr "" -#: library/curses.rst:1480 +#: library/curses.rst:1506 msgid "Previous page" msgstr "" -#: library/curses.rst:1482 +#: library/curses.rst:1508 msgid "Set tab" msgstr "" -#: library/curses.rst:1484 +#: library/curses.rst:1510 msgid "Clear tab" msgstr "" -#: library/curses.rst:1486 +#: library/curses.rst:1512 msgid "Clear all tabs" msgstr "" -#: library/curses.rst:1488 +#: library/curses.rst:1514 msgid "Enter or send (unreliable)" msgstr "" -#: library/curses.rst:1490 +#: library/curses.rst:1516 msgid "Soft (partial) reset (unreliable)" msgstr "" -#: library/curses.rst:1492 +#: library/curses.rst:1518 msgid "Reset or hard reset (unreliable)" msgstr "" -#: library/curses.rst:1494 +#: library/curses.rst:1520 msgid "Print" msgstr "" -#: library/curses.rst:1496 +#: library/curses.rst:1522 msgid "Home down or bottom (lower left)" msgstr "" -#: library/curses.rst:1498 +#: library/curses.rst:1524 msgid "Upper left of keypad" msgstr "" -#: library/curses.rst:1500 +#: library/curses.rst:1526 msgid "Upper right of keypad" msgstr "" -#: library/curses.rst:1502 +#: library/curses.rst:1528 msgid "Center of keypad" msgstr "" -#: library/curses.rst:1504 +#: library/curses.rst:1530 msgid "Lower left of keypad" msgstr "" -#: library/curses.rst:1506 +#: library/curses.rst:1532 msgid "Lower right of keypad" msgstr "" -#: library/curses.rst:1508 +#: library/curses.rst:1534 msgid "Back tab" msgstr "" -#: library/curses.rst:1510 +#: library/curses.rst:1536 msgid "Beg (beginning)" msgstr "" -#: library/curses.rst:1512 +#: library/curses.rst:1538 msgid "Cancel" msgstr "" -#: library/curses.rst:1514 +#: library/curses.rst:1540 msgid "Close" msgstr "" -#: library/curses.rst:1516 +#: library/curses.rst:1542 msgid "Cmd (command)" msgstr "" -#: library/curses.rst:1518 +#: library/curses.rst:1544 msgid "Copy" msgstr "" -#: library/curses.rst:1520 +#: library/curses.rst:1546 msgid "Create" msgstr "" -#: library/curses.rst:1522 +#: library/curses.rst:1548 msgid "End" msgstr "" -#: library/curses.rst:1524 +#: library/curses.rst:1550 msgid "Exit" msgstr "" -#: library/curses.rst:1526 +#: library/curses.rst:1552 msgid "Find" msgstr "" -#: library/curses.rst:1528 +#: library/curses.rst:1554 msgid "Help" msgstr "" -#: library/curses.rst:1530 +#: library/curses.rst:1556 msgid "Mark" msgstr "" -#: library/curses.rst:1532 +#: library/curses.rst:1558 msgid "Message" msgstr "" -#: library/curses.rst:1534 +#: library/curses.rst:1560 msgid "Move" msgstr "" -#: library/curses.rst:1536 +#: library/curses.rst:1562 msgid "Next" msgstr "" -#: library/curses.rst:1538 +#: library/curses.rst:1564 msgid "Open" msgstr "" -#: library/curses.rst:1540 +#: library/curses.rst:1566 msgid "Options" msgstr "" -#: library/curses.rst:1542 +#: library/curses.rst:1568 msgid "Prev (previous)" msgstr "" -#: library/curses.rst:1544 +#: library/curses.rst:1570 msgid "Redo" msgstr "" -#: library/curses.rst:1546 +#: library/curses.rst:1572 msgid "Ref (reference)" msgstr "" -#: library/curses.rst:1548 +#: library/curses.rst:1574 msgid "Refresh" msgstr "" -#: library/curses.rst:1550 +#: library/curses.rst:1576 msgid "Replace" msgstr "" -#: library/curses.rst:1552 +#: library/curses.rst:1578 msgid "Restart" msgstr "" -#: library/curses.rst:1554 +#: library/curses.rst:1580 msgid "Resume" msgstr "" -#: library/curses.rst:1556 +#: library/curses.rst:1582 msgid "Save" msgstr "" -#: library/curses.rst:1558 +#: library/curses.rst:1584 msgid "Shifted Beg (beginning)" msgstr "" -#: library/curses.rst:1560 +#: library/curses.rst:1586 msgid "Shifted Cancel" msgstr "" -#: library/curses.rst:1562 +#: library/curses.rst:1588 msgid "Shifted Command" msgstr "" -#: library/curses.rst:1564 +#: library/curses.rst:1590 msgid "Shifted Copy" msgstr "" -#: library/curses.rst:1566 +#: library/curses.rst:1592 msgid "Shifted Create" msgstr "" -#: library/curses.rst:1568 +#: library/curses.rst:1594 msgid "Shifted Delete char" msgstr "" -#: library/curses.rst:1570 +#: library/curses.rst:1596 msgid "Shifted Delete line" msgstr "" -#: library/curses.rst:1572 +#: library/curses.rst:1598 msgid "Select" msgstr "" -#: library/curses.rst:1574 +#: library/curses.rst:1600 msgid "Shifted End" msgstr "" -#: library/curses.rst:1576 +#: library/curses.rst:1602 msgid "Shifted Clear line" msgstr "" -#: library/curses.rst:1578 +#: library/curses.rst:1604 msgid "Shifted Exit" msgstr "" -#: library/curses.rst:1580 +#: library/curses.rst:1606 msgid "Shifted Find" msgstr "" -#: library/curses.rst:1582 +#: library/curses.rst:1608 msgid "Shifted Help" msgstr "" -#: library/curses.rst:1584 +#: library/curses.rst:1610 msgid "Shifted Home" msgstr "" -#: library/curses.rst:1586 +#: library/curses.rst:1612 msgid "Shifted Input" msgstr "" -#: library/curses.rst:1588 +#: library/curses.rst:1614 msgid "Shifted Left arrow" msgstr "" -#: library/curses.rst:1590 +#: library/curses.rst:1616 msgid "Shifted Message" msgstr "" -#: library/curses.rst:1592 +#: library/curses.rst:1618 msgid "Shifted Move" msgstr "" -#: library/curses.rst:1594 +#: library/curses.rst:1620 msgid "Shifted Next" msgstr "" -#: library/curses.rst:1596 +#: library/curses.rst:1622 msgid "Shifted Options" msgstr "" -#: library/curses.rst:1598 +#: library/curses.rst:1624 msgid "Shifted Prev" msgstr "" -#: library/curses.rst:1600 +#: library/curses.rst:1626 msgid "Shifted Print" msgstr "" -#: library/curses.rst:1602 +#: library/curses.rst:1628 msgid "Shifted Redo" msgstr "" -#: library/curses.rst:1604 +#: library/curses.rst:1630 msgid "Shifted Replace" msgstr "" -#: library/curses.rst:1606 +#: library/curses.rst:1632 msgid "Shifted Right arrow" msgstr "" -#: library/curses.rst:1608 +#: library/curses.rst:1634 msgid "Shifted Resume" msgstr "" -#: library/curses.rst:1610 +#: library/curses.rst:1636 msgid "Shifted Save" msgstr "" -#: library/curses.rst:1612 +#: library/curses.rst:1638 msgid "Shifted Suspend" msgstr "" -#: library/curses.rst:1614 +#: library/curses.rst:1640 msgid "Shifted Undo" msgstr "" -#: library/curses.rst:1616 +#: library/curses.rst:1642 msgid "Suspend" msgstr "" -#: library/curses.rst:1618 +#: library/curses.rst:1644 msgid "Undo" msgstr "" -#: library/curses.rst:1620 +#: library/curses.rst:1646 msgid "Mouse event has occurred" msgstr "" -#: library/curses.rst:1622 +#: library/curses.rst:1648 msgid "Terminal resize event" msgstr "" -#: library/curses.rst:1624 +#: library/curses.rst:1650 msgid "Maximum key value" msgstr "" -#: library/curses.rst:1627 +#: library/curses.rst:1653 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " "are normally at least four function keys (:const:`KEY_F1 `, :const:" @@ -2020,63 +2059,63 @@ msgid "" "keypad mappings are standard:" msgstr "" -#: library/curses.rst:1636 +#: library/curses.rst:1662 msgid "Keycap" msgstr "" -#: library/curses.rst:1781 library/curses.rst:1905 +#: library/curses.rst:1807 library/curses.rst:1931 msgid "Constant" msgstr "" -#: library/curses.rst:1638 +#: library/curses.rst:1664 msgid ":kbd:`Insert`" msgstr "" -#: library/curses.rst:1638 +#: library/curses.rst:1664 msgid "KEY_IC" msgstr "" -#: library/curses.rst:1640 +#: library/curses.rst:1666 msgid ":kbd:`Delete`" msgstr "" -#: library/curses.rst:1640 +#: library/curses.rst:1666 msgid "KEY_DC" msgstr "" -#: library/curses.rst:1642 +#: library/curses.rst:1668 msgid ":kbd:`Home`" msgstr "" -#: library/curses.rst:1642 +#: library/curses.rst:1668 msgid "KEY_HOME" msgstr "" -#: library/curses.rst:1644 +#: library/curses.rst:1670 msgid ":kbd:`End`" msgstr "" -#: library/curses.rst:1644 +#: library/curses.rst:1670 msgid "KEY_END" msgstr "" -#: library/curses.rst:1646 +#: library/curses.rst:1672 msgid ":kbd:`Page Up`" msgstr "" -#: library/curses.rst:1646 +#: library/curses.rst:1672 msgid "KEY_PPAGE" msgstr "" -#: library/curses.rst:1648 +#: library/curses.rst:1674 msgid ":kbd:`Page Down`" msgstr "" -#: library/curses.rst:1648 +#: library/curses.rst:1674 msgid "KEY_NPAGE" msgstr "" -#: library/curses.rst:1653 +#: library/curses.rst:1679 msgid "" "The following table lists characters from the alternate character set. These " "are inherited from the VT100 terminal, and will generally be available on " @@ -2084,268 +2123,268 @@ msgid "" "available, curses falls back on a crude printable ASCII approximation." msgstr "" -#: library/curses.rst:1660 +#: library/curses.rst:1686 msgid "These are available only after :func:`initscr` has been called." msgstr "" -#: library/curses.rst:1663 +#: library/curses.rst:1689 msgid "ACS code" msgstr "" -#: library/curses.rst:1665 +#: library/curses.rst:1691 msgid "alternate name for upper right corner" msgstr "" -#: library/curses.rst:1667 +#: library/curses.rst:1693 msgid "solid square block" msgstr "" -#: library/curses.rst:1669 +#: library/curses.rst:1695 msgid "board of squares" msgstr "" -#: library/curses.rst:1671 +#: library/curses.rst:1697 msgid "alternate name for horizontal line" msgstr "" -#: library/curses.rst:1673 +#: library/curses.rst:1699 msgid "alternate name for upper left corner" msgstr "" -#: library/curses.rst:1675 +#: library/curses.rst:1701 msgid "alternate name for top tee" msgstr "" -#: library/curses.rst:1677 +#: library/curses.rst:1703 msgid "bottom tee" msgstr "" -#: library/curses.rst:1679 +#: library/curses.rst:1705 msgid "bullet" msgstr "" -#: library/curses.rst:1681 +#: library/curses.rst:1707 msgid "checker board (stipple)" msgstr "" -#: library/curses.rst:1683 +#: library/curses.rst:1709 msgid "arrow pointing down" msgstr "" -#: library/curses.rst:1685 +#: library/curses.rst:1711 msgid "degree symbol" msgstr "" -#: library/curses.rst:1687 +#: library/curses.rst:1713 msgid "diamond" msgstr "" -#: library/curses.rst:1689 +#: library/curses.rst:1715 msgid "greater-than-or-equal-to" msgstr "" -#: library/curses.rst:1691 +#: library/curses.rst:1717 msgid "horizontal line" msgstr "" -#: library/curses.rst:1693 +#: library/curses.rst:1719 msgid "lantern symbol" msgstr "" -#: library/curses.rst:1695 +#: library/curses.rst:1721 msgid "left arrow" msgstr "" -#: library/curses.rst:1697 +#: library/curses.rst:1723 msgid "less-than-or-equal-to" msgstr "" -#: library/curses.rst:1699 +#: library/curses.rst:1725 msgid "lower left-hand corner" msgstr "" -#: library/curses.rst:1701 +#: library/curses.rst:1727 msgid "lower right-hand corner" msgstr "" -#: library/curses.rst:1703 +#: library/curses.rst:1729 msgid "left tee" msgstr "" -#: library/curses.rst:1705 +#: library/curses.rst:1731 msgid "not-equal sign" msgstr "" -#: library/curses.rst:1707 +#: library/curses.rst:1733 msgid "letter pi" msgstr "" -#: library/curses.rst:1709 +#: library/curses.rst:1735 msgid "plus-or-minus sign" msgstr "" -#: library/curses.rst:1711 +#: library/curses.rst:1737 msgid "big plus sign" msgstr "" -#: library/curses.rst:1713 +#: library/curses.rst:1739 msgid "right arrow" msgstr "" -#: library/curses.rst:1715 +#: library/curses.rst:1741 msgid "right tee" msgstr "" -#: library/curses.rst:1717 +#: library/curses.rst:1743 msgid "scan line 1" msgstr "" -#: library/curses.rst:1719 +#: library/curses.rst:1745 msgid "scan line 3" msgstr "" -#: library/curses.rst:1721 +#: library/curses.rst:1747 msgid "scan line 7" msgstr "" -#: library/curses.rst:1723 +#: library/curses.rst:1749 msgid "scan line 9" msgstr "" -#: library/curses.rst:1725 +#: library/curses.rst:1751 msgid "alternate name for lower right corner" msgstr "" -#: library/curses.rst:1727 +#: library/curses.rst:1753 msgid "alternate name for vertical line" msgstr "" -#: library/curses.rst:1729 +#: library/curses.rst:1755 msgid "alternate name for right tee" msgstr "" -#: library/curses.rst:1731 +#: library/curses.rst:1757 msgid "alternate name for lower left corner" msgstr "" -#: library/curses.rst:1733 +#: library/curses.rst:1759 msgid "alternate name for bottom tee" msgstr "" -#: library/curses.rst:1735 +#: library/curses.rst:1761 msgid "alternate name for left tee" msgstr "" -#: library/curses.rst:1737 +#: library/curses.rst:1763 msgid "alternate name for crossover or big plus" msgstr "" -#: library/curses.rst:1739 +#: library/curses.rst:1765 msgid "pound sterling" msgstr "" -#: library/curses.rst:1741 +#: library/curses.rst:1767 msgid "top tee" msgstr "" -#: library/curses.rst:1743 +#: library/curses.rst:1769 msgid "up arrow" msgstr "" -#: library/curses.rst:1745 +#: library/curses.rst:1771 msgid "upper left corner" msgstr "" -#: library/curses.rst:1747 +#: library/curses.rst:1773 msgid "upper right corner" msgstr "" -#: library/curses.rst:1749 +#: library/curses.rst:1775 msgid "vertical line" msgstr "" -#: library/curses.rst:1752 +#: library/curses.rst:1778 msgid "" "The following table lists mouse button constants used by :meth:`getmouse`:" msgstr "" -#: library/curses.rst:1755 +#: library/curses.rst:1781 msgid "Mouse button constant" msgstr "" -#: library/curses.rst:1757 +#: library/curses.rst:1783 msgid "Mouse button *n* pressed" msgstr "" -#: library/curses.rst:1759 +#: library/curses.rst:1785 msgid "Mouse button *n* released" msgstr "" -#: library/curses.rst:1761 +#: library/curses.rst:1787 msgid "Mouse button *n* clicked" msgstr "" -#: library/curses.rst:1763 +#: library/curses.rst:1789 msgid "Mouse button *n* double clicked" msgstr "" -#: library/curses.rst:1765 +#: library/curses.rst:1791 msgid "Mouse button *n* triple clicked" msgstr "" -#: library/curses.rst:1767 +#: library/curses.rst:1793 msgid "Shift was down during button state change" msgstr "" -#: library/curses.rst:1771 +#: library/curses.rst:1797 msgid "Control was down during button state change" msgstr "" -#: library/curses.rst:1778 +#: library/curses.rst:1804 msgid "The following table lists the predefined colors:" msgstr "" -#: library/curses.rst:1781 +#: library/curses.rst:1807 msgid "Color" msgstr "" -#: library/curses.rst:1783 +#: library/curses.rst:1809 msgid "Black" msgstr "" -#: library/curses.rst:1785 +#: library/curses.rst:1811 msgid "Blue" msgstr "" -#: library/curses.rst:1787 +#: library/curses.rst:1813 msgid "Cyan (light greenish blue)" msgstr "" -#: library/curses.rst:1789 +#: library/curses.rst:1815 msgid "Green" msgstr "" -#: library/curses.rst:1791 +#: library/curses.rst:1817 msgid "Magenta (purplish red)" msgstr "" -#: library/curses.rst:1793 +#: library/curses.rst:1819 msgid "Red" msgstr "" -#: library/curses.rst:1795 +#: library/curses.rst:1821 msgid "White" msgstr "" -#: library/curses.rst:1797 +#: library/curses.rst:1823 msgid "Yellow" msgstr "" -#: library/curses.rst:1802 +#: library/curses.rst:1828 msgid ":mod:`curses.textpad` --- Text input widget for curses programs" msgstr "" -#: library/curses.rst:1810 +#: library/curses.rst:1836 msgid "" "The :mod:`curses.textpad` module provides a :class:`Textbox` class that " "handles elementary text editing in a curses window, supporting a set of " @@ -2355,11 +2394,11 @@ msgid "" "purposes." msgstr "" -#: library/curses.rst:1816 +#: library/curses.rst:1842 msgid "The module :mod:`curses.textpad` defines the following function:" msgstr "" -#: library/curses.rst:1821 +#: library/curses.rst:1847 msgid "" "Draw a rectangle. The first argument must be a window object; the remaining " "arguments are coordinates relative to that window. The second and third " @@ -2371,15 +2410,15 @@ msgid "" "will be drawn with ASCII dashes, vertical bars, and plus signs." msgstr "" -#: library/curses.rst:1834 +#: library/curses.rst:1860 msgid "Textbox objects" msgstr "" -#: library/curses.rst:1836 +#: library/curses.rst:1862 msgid "You can instantiate a :class:`Textbox` object as follows:" msgstr "" -#: library/curses.rst:1841 +#: library/curses.rst:1867 msgid "" "Return a textbox widget object. The *win* argument should be a curses :ref:" "`window ` object in which the textbox is to be " @@ -2388,11 +2427,11 @@ msgid "" "instance's :attr:`stripspaces` flag is initially on." msgstr "" -#: library/curses.rst:1847 +#: library/curses.rst:1873 msgid ":class:`Textbox` objects have the following methods:" msgstr "" -#: library/curses.rst:1852 +#: library/curses.rst:1878 msgid "" "This is the entry point you will normally use. It accepts editing " "keystrokes until one of the termination keystrokes is entered. If " @@ -2403,167 +2442,167 @@ msgid "" "`stripspaces` attribute." msgstr "" -#: library/curses.rst:1863 +#: library/curses.rst:1889 msgid "" "Process a single command keystroke. Here are the supported special " "keystrokes:" msgstr "" -#: library/curses.rst:1905 +#: library/curses.rst:1931 msgid "Keystroke" msgstr "" -#: library/curses.rst:1867 +#: library/curses.rst:1893 msgid "Action" msgstr "" -#: library/curses.rst:1869 +#: library/curses.rst:1895 msgid ":kbd:`Control-A`" msgstr "" -#: library/curses.rst:1869 +#: library/curses.rst:1895 msgid "Go to left edge of window." msgstr "" -#: library/curses.rst:1907 +#: library/curses.rst:1933 msgid ":kbd:`Control-B`" msgstr "" -#: library/curses.rst:1871 +#: library/curses.rst:1897 msgid "Cursor left, wrapping to previous line if appropriate." msgstr "" -#: library/curses.rst:1874 +#: library/curses.rst:1900 msgid ":kbd:`Control-D`" msgstr "" -#: library/curses.rst:1874 +#: library/curses.rst:1900 msgid "Delete character under cursor." msgstr "" -#: library/curses.rst:1876 +#: library/curses.rst:1902 msgid ":kbd:`Control-E`" msgstr "" -#: library/curses.rst:1876 +#: library/curses.rst:1902 msgid "Go to right edge (stripspaces off) or end of line (stripspaces on)." msgstr "" -#: library/curses.rst:1909 +#: library/curses.rst:1935 msgid ":kbd:`Control-F`" msgstr "" -#: library/curses.rst:1879 +#: library/curses.rst:1905 msgid "Cursor right, wrapping to next line when appropriate." msgstr "" -#: library/curses.rst:1882 +#: library/curses.rst:1908 msgid ":kbd:`Control-G`" msgstr "" -#: library/curses.rst:1882 +#: library/curses.rst:1908 msgid "Terminate, returning the window contents." msgstr "" -#: library/curses.rst:1884 +#: library/curses.rst:1910 msgid ":kbd:`Control-H`" msgstr "" -#: library/curses.rst:1884 +#: library/curses.rst:1910 msgid "Delete character backward." msgstr "" -#: library/curses.rst:1886 +#: library/curses.rst:1912 msgid ":kbd:`Control-J`" msgstr "" -#: library/curses.rst:1886 +#: library/curses.rst:1912 msgid "Terminate if the window is 1 line, otherwise insert newline." msgstr "" -#: library/curses.rst:1889 +#: library/curses.rst:1915 msgid ":kbd:`Control-K`" msgstr "" -#: library/curses.rst:1889 +#: library/curses.rst:1915 msgid "If line is blank, delete it, otherwise clear to end of line." msgstr "" -#: library/curses.rst:1892 +#: library/curses.rst:1918 msgid ":kbd:`Control-L`" msgstr "" -#: library/curses.rst:1892 +#: library/curses.rst:1918 msgid "Refresh screen." msgstr "" -#: library/curses.rst:1913 +#: library/curses.rst:1939 msgid ":kbd:`Control-N`" msgstr "" -#: library/curses.rst:1894 +#: library/curses.rst:1920 msgid "Cursor down; move down one line." msgstr "" -#: library/curses.rst:1896 +#: library/curses.rst:1922 msgid ":kbd:`Control-O`" msgstr "" -#: library/curses.rst:1896 +#: library/curses.rst:1922 msgid "Insert a blank line at cursor location." msgstr "" -#: library/curses.rst:1911 +#: library/curses.rst:1937 msgid ":kbd:`Control-P`" msgstr "" -#: library/curses.rst:1898 +#: library/curses.rst:1924 msgid "Cursor up; move up one line." msgstr "" -#: library/curses.rst:1901 +#: library/curses.rst:1927 msgid "" "Move operations do nothing if the cursor is at an edge where the movement is " "not possible. The following synonyms are supported where possible:" msgstr "" -#: library/curses.rst:1907 +#: library/curses.rst:1933 msgid ":const:`~curses.KEY_LEFT`" msgstr "" -#: library/curses.rst:1909 +#: library/curses.rst:1935 msgid ":const:`~curses.KEY_RIGHT`" msgstr "" -#: library/curses.rst:1911 +#: library/curses.rst:1937 msgid ":const:`~curses.KEY_UP`" msgstr "" -#: library/curses.rst:1913 +#: library/curses.rst:1939 msgid ":const:`~curses.KEY_DOWN`" msgstr "" -#: library/curses.rst:1915 +#: library/curses.rst:1941 msgid ":const:`~curses.KEY_BACKSPACE`" msgstr "" -#: library/curses.rst:1915 +#: library/curses.rst:1941 msgid ":kbd:`Control-h`" msgstr "" -#: library/curses.rst:1918 +#: library/curses.rst:1944 msgid "" "All other keystrokes are treated as a command to insert the given character " "and move right (with line wrapping)." msgstr "" -#: library/curses.rst:1924 +#: library/curses.rst:1950 msgid "" "Return the window contents as a string; whether blanks in the window are " "included is affected by the :attr:`stripspaces` member." msgstr "" -#: library/curses.rst:1930 +#: library/curses.rst:1956 msgid "" "This attribute is a flag which controls the interpretation of blanks in the " "window. When it is on, trailing blanks on each line are ignored; any cursor " diff --git a/library/custominterp.po b/library/custominterp.po index 12e32bb1..eabc89bd 100644 --- a/library/custominterp.po +++ b/library/custominterp.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/dataclasses.po b/library/dataclasses.po index 10755897..e3bbf98d 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/dataclasses.rst:2 -msgid ":mod:`dataclasses` --- Data Classes" +msgid ":mod:`!dataclasses` --- Data Classes" msgstr "" #: library/dataclasses.rst:10 @@ -27,9 +28,9 @@ msgstr "" #: library/dataclasses.rst:14 msgid "" "This module provides a decorator and functions for automatically adding " -"generated :term:`special method`\\s such as :meth:`~object.__init__` and :" -"meth:`~object.__repr__` to user-defined classes. It was originally " -"described in :pep:`557`." +"generated :term:`special methods ` such as :meth:`~object." +"__init__` and :meth:`~object.__repr__` to user-defined classes. It was " +"originally described in :pep:`557`." msgstr "" #: library/dataclasses.rst:19 @@ -38,15 +39,38 @@ msgid "" "pep:`526` type annotations. For example, this code::" msgstr "" +#: library/dataclasses.rst:22 +msgid "" +"from dataclasses import dataclass\n" +"\n" +"@dataclass\n" +"class InventoryItem:\n" +" \"\"\"Class for keeping track of an item in inventory.\"\"\"\n" +" name: str\n" +" unit_price: float\n" +" quantity_on_hand: int = 0\n" +"\n" +" def total_cost(self) -> float:\n" +" return self.unit_price * self.quantity_on_hand" +msgstr "" + #: library/dataclasses.rst:34 +msgid "will add, among other things, a :meth:`!__init__` that looks like::" +msgstr "" + +#: library/dataclasses.rst:36 msgid "" -"will add, among other things, a :meth:`~object.__init__` that looks like::" +"def __init__(self, name: str, unit_price: float, quantity_on_hand: int = " +"0):\n" +" self.name = name\n" +" self.unit_price = unit_price\n" +" self.quantity_on_hand = quantity_on_hand" msgstr "" #: library/dataclasses.rst:41 msgid "" "Note that this method is automatically added to the class: it is not " -"directly specified in the ``InventoryItem`` definition shown above." +"directly specified in the :class:`!InventoryItem` definition shown above." msgstr "" #: library/dataclasses.rst:47 @@ -56,15 +80,15 @@ msgstr "" #: library/dataclasses.rst:51 msgid "" "This function is a :term:`decorator` that is used to add generated :term:" -"`special method`\\s to classes, as described below." +"`special methods ` to classes, as described below." msgstr "" #: library/dataclasses.rst:54 msgid "" -"The :func:`dataclass` decorator examines the class to find ``field``\\s. A " +"The ``@dataclass`` decorator examines the class to find ``field``\\s. A " "``field`` is defined as a class variable that has a :term:`type annotation " -"`. With two exceptions described below, nothing in :" -"func:`dataclass` examines the type specified in the variable annotation." +"`. With two exceptions described below, nothing in " +"``@dataclass`` examines the type specified in the variable annotation." msgstr "" #: library/dataclasses.rst:60 @@ -75,7 +99,7 @@ msgstr "" #: library/dataclasses.rst:63 msgid "" -"The :func:`dataclass` decorator will add various \"dunder\" methods to the " +"The ``@dataclass`` decorator will add various \"dunder\" methods to the " "class, described below. If any of the added methods already exist in the " "class, the behavior depends on the parameter, as documented below. The " "decorator returns the same class that it is called on; no new class is " @@ -84,30 +108,46 @@ msgstr "" #: library/dataclasses.rst:69 msgid "" -"If :func:`dataclass` is used just as a simple decorator with no parameters, " -"it acts as if it has the default values documented in this signature. That " -"is, these three uses of :func:`dataclass` are equivalent::" +"If ``@dataclass`` is used just as a simple decorator with no parameters, it " +"acts as if it has the default values documented in this signature. That is, " +"these three uses of ``@dataclass`` are equivalent::" +msgstr "" + +#: library/dataclasses.rst:74 +msgid "" +"@dataclass\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass()\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, " +"frozen=False,\n" +" match_args=True, kw_only=False, slots=False, weakref_slot=False)\n" +"class C:\n" +" ..." msgstr "" #: library/dataclasses.rst:87 -msgid "The parameters to :func:`dataclass` are:" +msgid "The parameters to ``@dataclass`` are:" msgstr "" #: library/dataclasses.rst:89 msgid "" -"``init``: If true (the default), a :meth:`~object.__init__` method will be " +"*init*: If true (the default), a :meth:`~object.__init__` method will be " "generated." msgstr "" #: library/dataclasses.rst:92 msgid "" -"If the class already defines :meth:`~object.__init__`, this parameter is " -"ignored." +"If the class already defines :meth:`!__init__`, this parameter is ignored." msgstr "" #: library/dataclasses.rst:95 msgid "" -"``repr``: If true (the default), a :meth:`~object.__repr__` method will be " +"*repr*: If true (the default), a :meth:`~object.__repr__` method will be " "generated. The generated repr string will have the class name and the name " "and repr of each field, in the order they are defined in the class. Fields " "that are marked as being excluded from the repr are not included. For " @@ -117,13 +157,12 @@ msgstr "" #: library/dataclasses.rst:102 msgid "" -"If the class already defines :meth:`~object.__repr__`, this parameter is " -"ignored." +"If the class already defines :meth:`!__repr__`, this parameter is ignored." msgstr "" #: library/dataclasses.rst:105 msgid "" -"``eq``: If true (the default), an :meth:`~object.__eq__` method will be " +"*eq*: If true (the default), an :meth:`~object.__eq__` method will be " "generated. This method compares the class as if it were a tuple of its " "fields, in order. Both instances in the comparison must be of the identical " "type." @@ -131,166 +170,202 @@ msgstr "" #: library/dataclasses.rst:110 msgid "" -"If the class already defines :meth:`~object.__eq__`, this parameter is " -"ignored." +"If the class already defines :meth:`!__eq__`, this parameter is ignored." msgstr "" #: library/dataclasses.rst:113 msgid "" -"``order``: If true (the default is ``False``), :meth:`~object.__lt__`, :meth:" +"*order*: If true (the default is ``False``), :meth:`~object.__lt__`, :meth:" "`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods " "will be generated. These compare the class as if it were a tuple of its " "fields, in order. Both instances in the comparison must be of the identical " -"type. If ``order`` is true and ``eq`` is false, a :exc:`ValueError` is " -"raised." +"type. If *order* is true and *eq* is false, a :exc:`ValueError` is raised." msgstr "" #: library/dataclasses.rst:120 msgid "" -"If the class already defines any of :meth:`~object.__lt__`, :meth:`~object." -"__le__`, :meth:`~object.__gt__`, or :meth:`~object.__ge__`, then :exc:" -"`TypeError` is raised." +"If the class already defines any of :meth:`!__lt__`, :meth:`!__le__`, :meth:" +"`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised." msgstr "" #: library/dataclasses.rst:124 msgid "" -"``unsafe_hash``: If ``False`` (the default), a :meth:`~object.__hash__` " -"method is generated according to how ``eq`` and ``frozen`` are set." +"*unsafe_hash*: If true, force ``dataclasses`` to create a :meth:`~object." +"__hash__` method, even though it may not be safe to do so. Otherwise, " +"generate a :meth:`~object.__hash__` method according to how *eq* and " +"*frozen* are set. The default value is ``False``." msgstr "" -#: library/dataclasses.rst:127 +#: library/dataclasses.rst:130 msgid "" -":meth:`~object.__hash__` is used by built-in :meth:`hash()`, and when " -"objects are added to hashed collections such as dictionaries and sets. " -"Having a :meth:`~object.__hash__` implies that instances of the class are " -"immutable. Mutability is a complicated property that depends on the " -"programmer's intent, the existence and behavior of :meth:`~object.__eq__`, " -"and the values of the ``eq`` and ``frozen`` flags in the :func:`dataclass` " -"decorator." +":meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are " +"added to hashed collections such as dictionaries and sets. Having a :meth:`!" +"__hash__` implies that instances of the class are immutable. Mutability is a " +"complicated property that depends on the programmer's intent, the existence " +"and behavior of :meth:`!__eq__`, and the values of the *eq* and *frozen* " +"flags in the ``@dataclass`` decorator." msgstr "" -#: library/dataclasses.rst:134 +#: library/dataclasses.rst:137 msgid "" -"By default, :func:`dataclass` will not implicitly add a :meth:`~object." +"By default, ``@dataclass`` will not implicitly add a :meth:`~object." "__hash__` method unless it is safe to do so. Neither will it add or change " -"an existing explicitly defined :meth:`~object.__hash__` method. Setting the " -"class attribute ``__hash__ = None`` has a specific meaning to Python, as " -"described in the :meth:`~object.__hash__` documentation." +"an existing explicitly defined :meth:`!__hash__` method. Setting the class " +"attribute ``__hash__ = None`` has a specific meaning to Python, as described " +"in the :meth:`!__hash__` documentation." msgstr "" -#: library/dataclasses.rst:140 +#: library/dataclasses.rst:143 msgid "" -"If :meth:`~object.__hash__` is not explicitly defined, or if it is set to " -"``None``, then :func:`dataclass` *may* add an implicit :meth:`~object." -"__hash__` method. Although not recommended, you can force :func:`dataclass` " -"to create a :meth:`~object.__hash__` method with ``unsafe_hash=True``. This " -"might be the case if your class is logically immutable but can nonetheless " -"be mutated. This is a specialized use case and should be considered " -"carefully." +"If :meth:`!__hash__` is not explicitly defined, or if it is set to ``None``, " +"then ``@dataclass`` *may* add an implicit :meth:`!__hash__` method. Although " +"not recommended, you can force ``@dataclass`` to create a :meth:`!__hash__` " +"method with ``unsafe_hash=True``. This might be the case if your class is " +"logically immutable but can still be mutated. This is a specialized use case " +"and should be considered carefully." msgstr "" -#: library/dataclasses.rst:147 +#: library/dataclasses.rst:150 msgid "" -"Here are the rules governing implicit creation of a :meth:`~object.__hash__` " -"method. Note that you cannot both have an explicit :meth:`~object.__hash__` " -"method in your dataclass and set ``unsafe_hash=True``; this will result in " -"a :exc:`TypeError`." +"Here are the rules governing implicit creation of a :meth:`!__hash__` " +"method. Note that you cannot both have an explicit :meth:`!__hash__` method " +"in your dataclass and set ``unsafe_hash=True``; this will result in a :exc:" +"`TypeError`." +msgstr "" + +#: library/dataclasses.rst:155 +msgid "" +"If *eq* and *frozen* are both true, by default ``@dataclass`` will generate " +"a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is false, :" +"meth:`!__hash__` will be set to ``None``, marking it unhashable (which it " +"is, since it is mutable). If *eq* is false, :meth:`!__hash__` will be left " +"untouched meaning the :meth:`!__hash__` method of the superclass will be " +"used (if the superclass is :class:`object`, this means it will fall back to " +"id-based hashing)." msgstr "" -#: library/dataclasses.rst:152 +#: library/dataclasses.rst:163 msgid "" -"If ``eq`` and ``frozen`` are both true, by default :func:`dataclass` will " -"generate a :meth:`~object.__hash__` method for you. If ``eq`` is true and " -"``frozen`` is false, :meth:`~object.__hash__` will be set to ``None``, " -"marking it unhashable (which it is, since it is mutable). If ``eq`` is " -"false, :meth:`~object.__hash__` will be left untouched meaning the :meth:" -"`~object.__hash__` method of the superclass will be used (if the superclass " -"is :class:`object`, this means it will fall back to id-based hashing)." +"*frozen*: If true (the default is ``False``), assigning to fields will " +"generate an exception. This emulates read-only frozen instances. See the :" +"ref:`discussion ` below." msgstr "" -#: library/dataclasses.rst:160 +#: library/dataclasses.rst:167 msgid "" -"``frozen``: If true (the default is ``False``), assigning to fields will " -"generate an exception. This emulates read-only frozen instances. If :meth:" -"`~object.__setattr__` or :meth:`~object.__delattr__` is defined in the " -"class, then :exc:`TypeError` is raised. See the discussion below." +"If :meth:`~object.__setattr__` or :meth:`~object.__delattr__` is defined in " +"the class and *frozen* is true, then :exc:`TypeError` is raised." msgstr "" -#: library/dataclasses.rst:165 +#: library/dataclasses.rst:170 msgid "" -"``match_args``: If true (the default is ``True``), the ``__match_args__`` " -"tuple will be created from the list of parameters to the generated :meth:" -"`~object.__init__` method (even if :meth:`~object.__init__` is not " -"generated, see above). If false, or if ``__match_args__`` is already " -"defined in the class, then ``__match_args__`` will not be generated." +"*match_args*: If true (the default is ``True``), the :attr:`~object." +"__match_args__` tuple will be created from the list of non keyword-only " +"parameters to the generated :meth:`~object.__init__` method (even if :meth:`!" +"__init__` is not generated, see above). If false, or if :attr:`!" +"__match_args__` is already defined in the class, then :attr:`!" +"__match_args__` will not be generated." msgstr "" -#: library/dataclasses.rst:174 +#: library/dataclasses.rst:179 msgid "" -"``kw_only``: If true (the default value is ``False``), then all fields will " -"be marked as keyword-only. If a field is marked as keyword-only, then the " -"only effect is that the :meth:`~object.__init__` parameter generated from a " -"keyword-only field must be specified with a keyword when :meth:`~object." -"__init__` is called. There is no effect on any other aspect of " -"dataclasses. See the :term:`parameter` glossary entry for details. Also " -"see the :const:`KW_ONLY` section." +"*kw_only*: If true (the default value is ``False``), then all fields will be " +"marked as keyword-only. If a field is marked as keyword-only, then the only " +"effect is that the :meth:`~object.__init__` parameter generated from a " +"keyword-only field must be specified with a keyword when :meth:`!__init__` " +"is called. See the :term:`parameter` glossary entry for details. Also see " +"the :const:`KW_ONLY` section." msgstr "" -#: library/dataclasses.rst:185 +#: library/dataclasses.rst:187 +msgid "Keyword-only fields are not included in :attr:`!__match_args__`." +msgstr "" + +#: library/dataclasses.rst:191 msgid "" -"``slots``: If true (the default is ``False``), :attr:`~object.__slots__` " +"*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " "attribute will be generated and new class will be returned instead of the " -"original one. If :attr:`~object.__slots__` is already defined in the class, " -"then :exc:`TypeError` is raised." +"original one. If :attr:`!__slots__` is already defined in the class, then :" +"exc:`TypeError` is raised." +msgstr "" + +#: library/dataclasses.rst:197 +msgid "" +"Passing parameters to a base class :meth:`~object.__init_subclass__` when " +"using ``slots=True`` will result in a :exc:`TypeError`. Either use " +"``__init_subclass__`` with no parameters or use default values as a " +"workaround. See :gh:`91126` for full details." msgstr "" -#: library/dataclasses.rst:192 +#: library/dataclasses.rst:205 msgid "" -"If a field name is already included in the ``__slots__`` of a base class, it " -"will not be included in the generated ``__slots__`` to prevent :ref:" -"`overriding them `. Therefore, do not use " -"``__slots__`` to retrieve the field names of a dataclass. Use :func:`fields` " -"instead. To be able to determine inherited slots, base class ``__slots__`` " -"may be any iterable, but *not* an iterator." +"If a field name is already included in the :attr:`!__slots__` of a base " +"class, it will not be included in the generated :attr:`!__slots__` to " +"prevent :ref:`overriding them `. Therefore, do not " +"use :attr:`!__slots__` to retrieve the field names of a dataclass. Use :func:" +"`fields` instead. To be able to determine inherited slots, base class :attr:" +"`!__slots__` may be any iterable, but *not* an iterator." msgstr "" -#: library/dataclasses.rst:202 +#: library/dataclasses.rst:215 msgid "" -"``weakref_slot``: If true (the default is ``False``), add a slot named " -"\"__weakref__\", which is required to make an instance weakref-able. It is " -"an error to specify ``weakref_slot=True`` without also specifying " -"``slots=True``." +"*weakref_slot*: If true (the default is ``False``), add a slot named " +"\"__weakref__\", which is required to make an instance :func:`weakref-able " +"`. It is an error to specify ``weakref_slot=True`` without also " +"specifying ``slots=True``." msgstr "" -#: library/dataclasses.rst:209 +#: library/dataclasses.rst:223 msgid "" "``field``\\s may optionally specify a default value, using normal Python " "syntax::" msgstr "" -#: library/dataclasses.rst:217 +#: library/dataclasses.rst:226 +msgid "" +"@dataclass\n" +"class C:\n" +" a: int # 'a' has no default value\n" +" b: int = 0 # assign a default value for 'b'" +msgstr "" + +#: library/dataclasses.rst:231 msgid "" -"In this example, both ``a`` and ``b`` will be included in the added :meth:" -"`~object.__init__` method, which will be defined as::" +"In this example, both :attr:`!a` and :attr:`!b` will be included in the " +"added :meth:`~object.__init__` method, which will be defined as::" msgstr "" -#: library/dataclasses.rst:222 +#: library/dataclasses.rst:234 +msgid "def __init__(self, a: int, b: int = 0):" +msgstr "" + +#: library/dataclasses.rst:236 msgid "" ":exc:`TypeError` will be raised if a field without a default value follows a " "field with a default value. This is true whether this occurs in a single " "class, or as a result of class inheritance." msgstr "" -#: library/dataclasses.rst:228 +#: library/dataclasses.rst:242 msgid "" "For common and simple use cases, no other functionality is required. There " "are, however, some dataclass features that require additional per-field " "information. To satisfy this need for additional information, you can " -"replace the default field value with a call to the provided :func:`field` " +"replace the default field value with a call to the provided :func:`!field` " "function. For example::" msgstr "" -#: library/dataclasses.rst:241 +#: library/dataclasses.rst:248 +msgid "" +"@dataclass\n" +"class C:\n" +" mylist: list[int] = field(default_factory=list)\n" +"\n" +"c = C()\n" +"c.mylist += [1, 2, 3]" +msgstr "" + +#: library/dataclasses.rst:255 msgid "" "As shown above, the :const:`MISSING` value is a sentinel object used to " "detect if some parameters are provided by the user. This sentinel is used " @@ -298,49 +373,50 @@ msgid "" "meaning. No code should directly use the :const:`MISSING` value." msgstr "" -#: library/dataclasses.rst:246 -msgid "The parameters to :func:`field` are:" +#: library/dataclasses.rst:260 +msgid "The parameters to :func:`!field` are:" msgstr "" -#: library/dataclasses.rst:248 +#: library/dataclasses.rst:262 msgid "" -"``default``: If provided, this will be the default value for this field. " -"This is needed because the :meth:`field` call itself replaces the normal " +"*default*: If provided, this will be the default value for this field. This " +"is needed because the :func:`!field` call itself replaces the normal " "position of the default value." msgstr "" -#: library/dataclasses.rst:252 +#: library/dataclasses.rst:266 msgid "" -"``default_factory``: If provided, it must be a zero-argument callable that " +"*default_factory*: If provided, it must be a zero-argument callable that " "will be called when a default value is needed for this field. Among other " "purposes, this can be used to specify fields with mutable default values, as " -"discussed below. It is an error to specify both ``default`` and " -"``default_factory``." +"discussed below. It is an error to specify both *default* and " +"*default_factory*." msgstr "" -#: library/dataclasses.rst:258 +#: library/dataclasses.rst:272 msgid "" -"``init``: If true (the default), this field is included as a parameter to " -"the generated :meth:`~object.__init__` method." +"*init*: If true (the default), this field is included as a parameter to the " +"generated :meth:`~object.__init__` method." msgstr "" -#: library/dataclasses.rst:261 +#: library/dataclasses.rst:275 msgid "" -"``repr``: If true (the default), this field is included in the string " -"returned by the generated :meth:`~object.__repr__` method." +"*repr*: If true (the default), this field is included in the string returned " +"by the generated :meth:`~object.__repr__` method." msgstr "" -#: library/dataclasses.rst:264 +#: library/dataclasses.rst:278 msgid "" -"``hash``: This can be a bool or ``None``. If true, this field is included " -"in the generated :meth:`~object.__hash__` method. If ``None`` (the " -"default), use the value of ``compare``: this would normally be the expected " -"behavior. A field should be considered in the hash if it's used for " +"*hash*: This can be a bool or ``None``. If true, this field is included in " +"the generated :meth:`~object.__hash__` method. If false, this field is " +"excluded from the generated :meth:`~object.__hash__`. If ``None`` (the " +"default), use the value of *compare*: this would normally be the expected " +"behavior, since a field should be included in the hash if it's used for " "comparisons. Setting this value to anything other than ``None`` is " "discouraged." msgstr "" -#: library/dataclasses.rst:271 +#: library/dataclasses.rst:286 msgid "" "One possible reason to set ``hash=False`` but ``compare=True`` would be if a " "field is expensive to compute a hash value for, that field is needed for " @@ -349,77 +425,104 @@ msgid "" "used for comparisons." msgstr "" -#: library/dataclasses.rst:277 +#: library/dataclasses.rst:292 msgid "" -"``compare``: If true (the default), this field is included in the generated " +"*compare*: If true (the default), this field is included in the generated " "equality and comparison methods (:meth:`~object.__eq__`, :meth:`~object." "__gt__`, et al.)." msgstr "" -#: library/dataclasses.rst:281 +#: library/dataclasses.rst:296 msgid "" -"``metadata``: This can be a mapping or None. None is treated as an empty " -"dict. This value is wrapped in :func:`~types.MappingProxyType` to make it " -"read-only, and exposed on the :class:`Field` object. It is not used at all " -"by Data Classes, and is provided as a third-party extension mechanism. " -"Multiple third-parties can each have their own key, to use as a namespace in " -"the metadata." +"*metadata*: This can be a mapping or ``None``. ``None`` is treated as an " +"empty dict. This value is wrapped in :func:`~types.MappingProxyType` to " +"make it read-only, and exposed on the :class:`Field` object. It is not used " +"at all by Data Classes, and is provided as a third-party extension " +"mechanism. Multiple third-parties can each have their own key, to use as a " +"namespace in the metadata." msgstr "" -#: library/dataclasses.rst:289 +#: library/dataclasses.rst:304 msgid "" -"``kw_only``: If true, this field will be marked as keyword-only. This is " -"used when the generated :meth:`~object.__init__` method's parameters are " -"computed." +"*kw_only*: If true, this field will be marked as keyword-only. This is used " +"when the generated :meth:`~object.__init__` method's parameters are computed." +msgstr "" + +#: library/dataclasses.rst:308 +msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." +msgstr "" + +#: library/dataclasses.rst:312 +msgid "*doc*: optional docstring for this field." msgstr "" -#: library/dataclasses.rst:295 +#: library/dataclasses.rst:316 msgid "" -"If the default value of a field is specified by a call to :func:`field()`, " +"If the default value of a field is specified by a call to :func:`!field`, " "then the class attribute for this field will be replaced by the specified " -"``default`` value. If no ``default`` is provided, then the class attribute " -"will be deleted. The intent is that after the :func:`dataclass` decorator " +"*default* value. If *default* is not provided, then the class attribute " +"will be deleted. The intent is that after the :deco:`dataclass` decorator " "runs, the class attributes will all contain the default values for the " "fields, just as if the default value itself were specified. For example, " "after::" msgstr "" -#: library/dataclasses.rst:311 +#: library/dataclasses.rst:325 msgid "" -"The class attribute ``C.z`` will be ``10``, the class attribute ``C.t`` will " -"be ``20``, and the class attributes ``C.x`` and ``C.y`` will not be set." +"@dataclass\n" +"class C:\n" +" x: int\n" +" y: int = field(repr=False)\n" +" z: int = field(repr=False, default=10)\n" +" t: int = 20" msgstr "" -#: library/dataclasses.rst:317 +#: library/dataclasses.rst:332 msgid "" -":class:`Field` objects describe each defined field. These objects are " +"The class attribute :attr:`!C.z` will be ``10``, the class attribute :attr:`!" +"C.t` will be ``20``, and the class attributes :attr:`!C.x` and :attr:`!C.y` " +"will not be set." +msgstr "" + +#: library/dataclasses.rst:338 +msgid "" +":class:`!Field` objects describe each defined field. These objects are " "created internally, and are returned by the :func:`fields` module-level " -"method (see below). Users should never instantiate a :class:`Field` object " +"method (see below). Users should never instantiate a :class:`!Field` object " "directly. Its documented attributes are:" msgstr "" -#: library/dataclasses.rst:322 -msgid "``name``: The name of the field." +#: library/dataclasses.rst:343 +msgid ":attr:`!name`: The name of the field." msgstr "" -#: library/dataclasses.rst:323 -msgid "``type``: The type of the field." +#: library/dataclasses.rst:344 +msgid ":attr:`!type`: The type of the field." msgstr "" -#: library/dataclasses.rst:324 +#: library/dataclasses.rst:345 msgid "" -"``default``, ``default_factory``, ``init``, ``repr``, ``hash``, ``compare``, " -"``metadata``, and ``kw_only`` have the identical meaning and values as they " -"do in the :func:`field` function." +":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :" +"attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!kw_only` have " +"the identical meaning and values as they do in the :func:`field` function." msgstr "" -#: library/dataclasses.rst:328 +#: library/dataclasses.rst:349 msgid "" "Other attributes may exist, but they are private and must not be inspected " "or relied on." msgstr "" -#: library/dataclasses.rst:333 +#: library/dataclasses.rst:354 +msgid "" +"``InitVar[T]`` type annotations describe variables that are :ref:`init-only " +"`. Fields annotated with :class:`!InitVar` " +"are considered pseudo-fields, and thus are neither returned by the :func:" +"`fields` function nor used in any way except adding them as parameters to :" +"meth:`~object.__init__` and an optional :meth:`__post_init__`." +msgstr "" + +#: library/dataclasses.rst:363 msgid "" "Returns a tuple of :class:`Field` objects that define the fields for this " "dataclass. Accepts either a dataclass, or an instance of a dataclass. " @@ -427,273 +530,403 @@ msgid "" "not return pseudo-fields which are ``ClassVar`` or ``InitVar``." msgstr "" -#: library/dataclasses.rst:340 +#: library/dataclasses.rst:370 msgid "" -"Converts the dataclass ``obj`` to a dict (by using the factory function " -"``dict_factory``). Each dataclass is converted to a dict of its fields, as " +"Converts the dataclass *obj* to a dict (by using the factory function " +"*dict_factory*). Each dataclass is converted to a dict of its fields, as " "``name: value`` pairs. dataclasses, dicts, lists, and tuples are recursed " "into. Other objects are copied with :func:`copy.deepcopy`." msgstr "" -#: library/dataclasses.rst:346 -msgid "Example of using :func:`asdict` on nested dataclasses::" +#: library/dataclasses.rst:376 +msgid "Example of using :func:`!asdict` on nested dataclasses::" msgstr "" -#: library/dataclasses.rst:383 +#: library/dataclasses.rst:378 +msgid "" +"@dataclass\n" +"class Point:\n" +" x: int\n" +" y: int\n" +"\n" +"@dataclass\n" +"class C:\n" +" mylist: list[Point]\n" +"\n" +"p = Point(10, 20)\n" +"assert asdict(p) == {'x': 10, 'y': 20}\n" +"\n" +"c = C([Point(0, 0), Point(10, 4)])\n" +"assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" +msgstr "" + +#: library/dataclasses.rst:413 msgid "To create a shallow copy, the following workaround may be used::" msgstr "" -#: library/dataclasses.rst:367 +#: library/dataclasses.rst:395 +msgid "{field.name: getattr(obj, field.name) for field in fields(obj)}" +msgstr "" + +#: library/dataclasses.rst:397 msgid "" -":func:`asdict` raises :exc:`TypeError` if ``obj`` is not a dataclass " -"instance." +":func:`!asdict` raises :exc:`TypeError` if *obj* is not a dataclass instance." msgstr "" -#: library/dataclasses.rst:372 +#: library/dataclasses.rst:402 msgid "" -"Converts the dataclass ``obj`` to a tuple (by using the factory function " -"``tuple_factory``). Each dataclass is converted to a tuple of its field " +"Converts the dataclass *obj* to a tuple (by using the factory function " +"*tuple_factory*). Each dataclass is converted to a tuple of its field " "values. dataclasses, dicts, lists, and tuples are recursed into. Other " "objects are copied with :func:`copy.deepcopy`." msgstr "" -#: library/dataclasses.rst:378 +#: library/dataclasses.rst:408 msgid "Continuing from the previous example::" msgstr "" -#: library/dataclasses.rst:387 +#: library/dataclasses.rst:410 msgid "" -":func:`astuple` raises :exc:`TypeError` if ``obj`` is not a dataclass " +"assert astuple(p) == (10, 20)\n" +"assert astuple(c) == ([(0, 0), (10, 4)],)" +msgstr "" + +#: library/dataclasses.rst:415 +msgid "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" +msgstr "" + +#: library/dataclasses.rst:417 +msgid "" +":func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass " "instance." msgstr "" -#: library/dataclasses.rst:392 +#: library/dataclasses.rst:422 msgid "" -"Creates a new dataclass with name ``cls_name``, fields as defined in " -"``fields``, base classes as given in ``bases``, and initialized with a " -"namespace as given in ``namespace``. ``fields`` is an iterable whose " -"elements are each either ``name``, ``(name, type)``, or ``(name, type, " -"Field)``. If just ``name`` is supplied, ``typing.Any`` is used for " -"``type``. The values of ``init``, ``repr``, ``eq``, ``order``, " -"``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, ``slots``, and " -"``weakref_slot`` have the same meaning as they do in :func:`dataclass`." +"Creates a new dataclass with name *cls_name*, fields as defined in *fields*, " +"base classes as given in *bases*, and initialized with a namespace as given " +"in *namespace*. *fields* is an iterable whose elements are each either " +"``name``, ``(name, type)``, or ``(name, type, Field)``. If just ``name`` is " +"supplied, :data:`typing.Any` is used for ``type``. The values of *init*, " +"*repr*, *eq*, *order*, *unsafe_hash*, *frozen*, *match_args*, *kw_only*, " +"*slots*, and *weakref_slot* have the same meaning as they do in :deco:" +"`dataclass`." msgstr "" -#: library/dataclasses.rst:402 +#: library/dataclasses.rst:432 +msgid "" +"If *module* is defined, the :attr:`!__module__` attribute of the dataclass " +"is set to that value. By default, it is set to the module name of the caller." +msgstr "" + +#: library/dataclasses.rst:436 msgid "" -"If ``module`` is defined, the ``__module__`` attribute of the dataclass is " -"set to that value. By default, it is set to the module name of the caller." +"The *decorator* parameter is a callable that will be used to create the " +"dataclass. It should take the class object as a first argument and the same " +"keyword arguments as :deco:`dataclass`. By default, the :deco:`dataclass` " +"function is used." msgstr "" -#: library/dataclasses.rst:406 +#: library/dataclasses.rst:441 msgid "" "This function is not strictly required, because any Python mechanism for " -"creating a new class with ``__annotations__`` can then apply the :func:" -"`dataclass` function to convert that class to a dataclass. This function is " -"provided as a convenience. For example::" +"creating a new class with :attr:`~object.__annotations__` can then apply " +"the :deco:`dataclass` function to convert that class to a dataclass. This " +"function is provided as a convenience. For example::" msgstr "" -#: library/dataclasses.rst:418 +#: library/dataclasses.rst:447 +msgid "" +"C = make_dataclass('C',\n" +" [('x', int),\n" +" 'y',\n" +" ('z', int, field(default=5))],\n" +" namespace={'add_one': lambda self: self.x + 1})" +msgstr "" + +#: library/dataclasses.rst:453 msgid "Is equivalent to::" msgstr "" -#: library/dataclasses.rst:431 +#: library/dataclasses.rst:455 msgid "" -"Creates a new object of the same type as ``obj``, replacing fields with " -"values from ``changes``. If ``obj`` is not a Data Class, raises :exc:" -"`TypeError`. If values in ``changes`` do not specify fields, raises :exc:" +"@dataclass\n" +"class C:\n" +" x: int\n" +" y: 'typing.Any'\n" +" z: int = 5\n" +"\n" +" def add_one(self):\n" +" return self.x + 1" +msgstr "" + +#: library/dataclasses.rst:464 +msgid "Added the *decorator* parameter." +msgstr "" + +#: library/dataclasses.rst:469 +msgid "" +"Creates a new object of the same type as *obj*, replacing fields with values " +"from *changes*. If *obj* is not a Data Class, raises :exc:`TypeError`. If " +"keys in *changes* are not field names of the given dataclass, raises :exc:" "`TypeError`." msgstr "" -#: library/dataclasses.rst:436 +#: library/dataclasses.rst:474 msgid "" "The newly returned object is created by calling the :meth:`~object.__init__` " "method of the dataclass. This ensures that :meth:`__post_init__`, if " "present, is also called." msgstr "" -#: library/dataclasses.rst:440 +#: library/dataclasses.rst:478 msgid "" "Init-only variables without default values, if any exist, must be specified " -"on the call to :func:`replace` so that they can be passed to :meth:`~object." +"on the call to :func:`!replace` so that they can be passed to :meth:`!" "__init__` and :meth:`__post_init__`." msgstr "" -#: library/dataclasses.rst:444 +#: library/dataclasses.rst:482 msgid "" -"It is an error for ``changes`` to contain any fields that are defined as " +"It is an error for *changes* to contain any fields that are defined as " "having ``init=False``. A :exc:`ValueError` will be raised in this case." msgstr "" -#: library/dataclasses.rst:448 +#: library/dataclasses.rst:486 msgid "" -"Be forewarned about how ``init=False`` fields work during a call to :func:" -"`replace`. They are not copied from the source object, but rather are " +"Be forewarned about how ``init=False`` fields work during a call to :func:`!" +"replace`. They are not copied from the source object, but rather are " "initialized in :meth:`__post_init__`, if they're initialized at all. It is " "expected that ``init=False`` fields will be rarely and judiciously used. If " "they are used, it might be wise to have alternate class constructors, or " -"perhaps a custom ``replace()`` (or similarly named) method which handles " +"perhaps a custom :func:`!replace` (or similarly named) method which handles " "instance copying." msgstr "" -#: library/dataclasses.rst:459 +#: library/dataclasses.rst:495 +msgid "" +"Dataclass instances are also supported by generic function :func:`copy." +"replace`." +msgstr "" + +#: library/dataclasses.rst:499 msgid "" -"Return ``True`` if its parameter is a dataclass or an instance of one, " -"otherwise return ``False``." +"Return ``True`` if its parameter is a dataclass (including subclasses of a " +"dataclass) or an instance of one, otherwise return ``False``." msgstr "" -#: library/dataclasses.rst:462 +#: library/dataclasses.rst:502 msgid "" "If you need to know if a class is an instance of a dataclass (and not a " "dataclass itself), then add a further check for ``not isinstance(obj, " "type)``::" msgstr "" -#: library/dataclasses.rst:471 +#: library/dataclasses.rst:506 +msgid "" +"def is_dataclass_instance(obj):\n" +" return is_dataclass(obj) and not isinstance(obj, type)" +msgstr "" + +#: library/dataclasses.rst:511 msgid "A sentinel value signifying a missing default or default_factory." msgstr "" -#: library/dataclasses.rst:475 +#: library/dataclasses.rst:515 msgid "" "A sentinel value used as a type annotation. Any fields after a pseudo-field " -"with the type of :const:`KW_ONLY` are marked as keyword-only fields. Note " -"that a pseudo-field of type :const:`KW_ONLY` is otherwise completely " +"with the type of :const:`!KW_ONLY` are marked as keyword-only fields. Note " +"that a pseudo-field of type :const:`!KW_ONLY` is otherwise completely " "ignored. This includes the name of such a field. By convention, a name of " -"``_`` is used for a :const:`KW_ONLY` field. Keyword-only fields signify :" +"``_`` is used for a :const:`!KW_ONLY` field. Keyword-only fields signify :" "meth:`~object.__init__` parameters that must be specified as keywords when " "the class is instantiated." msgstr "" -#: library/dataclasses.rst:484 +#: library/dataclasses.rst:524 msgid "" "In this example, the fields ``y`` and ``z`` will be marked as keyword-only " "fields::" msgstr "" -#: library/dataclasses.rst:495 +#: library/dataclasses.rst:526 +msgid "" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" _: KW_ONLY\n" +" y: float\n" +" z: float\n" +"\n" +"p = Point(0, y=1.5, z=2.0)" +msgstr "" + +#: library/dataclasses.rst:535 msgid "" "In a single dataclass, it is an error to specify more than one field whose " -"type is :const:`KW_ONLY`." +"type is :const:`!KW_ONLY`." msgstr "" -#: library/dataclasses.rst:502 +#: library/dataclasses.rst:542 msgid "" "Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" "`~object.__delattr__` is called on a dataclass which was defined with " "``frozen=True``. It is a subclass of :exc:`AttributeError`." msgstr "" -#: library/dataclasses.rst:509 +#: library/dataclasses.rst:549 msgid "Post-init processing" msgstr "" -#: library/dataclasses.rst:513 +#: library/dataclasses.rst:553 msgid "" "When defined on the class, it will be called by the generated :meth:`~object." -"__init__`, normally as ``self.__post_init__()``. However, if any ``InitVar`` " -"fields are defined, they will also be passed to :meth:`__post_init__` in the " -"order they were defined in the class. If no :meth:`~object.__init__` method " -"is generated, then :meth:`__post_init__` will not automatically be called." +"__init__`, normally as :meth:`!self.__post_init__`. However, if any " +"``InitVar`` fields are defined, they will also be passed to :meth:`!" +"__post_init__` in the order they were defined in the class. If no :meth:`!" +"__init__` method is generated, then :meth:`!__post_init__` will not " +"automatically be called." msgstr "" -#: library/dataclasses.rst:520 +#: library/dataclasses.rst:560 msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "" -#: library/dataclasses.rst:532 +#: library/dataclasses.rst:563 msgid "" -"The :meth:`~object.__init__` method generated by :func:`dataclass` does not " -"call base class :meth:`~object.__init__` methods. If the base class has an :" -"meth:`~object.__init__` method that has to be called, it is common to call " -"this method in a :meth:`__post_init__` method::" +"@dataclass\n" +"class C:\n" +" a: float\n" +" b: float\n" +" c: float = field(init=False)\n" +"\n" +" def __post_init__(self):\n" +" self.c = self.a + self.b" msgstr "" -#: library/dataclasses.rst:549 +#: library/dataclasses.rst:572 msgid "" -"Note, however, that in general the dataclass-generated :meth:`~object." -"__init__` methods don't need to be called, since the derived dataclass will " -"take care of initializing all fields of any base class that is a dataclass " -"itself." +"The :meth:`~object.__init__` method generated by :deco:`dataclass` does not " +"call base class :meth:`!__init__` methods. If the base class has an :meth:`!" +"__init__` method that has to be called, it is common to call this method in " +"a :meth:`__post_init__` method::" msgstr "" -#: library/dataclasses.rst:553 +#: library/dataclasses.rst:577 +msgid "" +"class Rectangle:\n" +" def __init__(self, height, width):\n" +" self.height = height\n" +" self.width = width\n" +"\n" +"@dataclass\n" +"class Square(Rectangle):\n" +" side: float\n" +"\n" +" def __post_init__(self):\n" +" super().__init__(self.side, self.side)" +msgstr "" + +#: library/dataclasses.rst:589 +msgid "" +"Note, however, that in general the dataclass-generated :meth:`!__init__` " +"methods don't need to be called, since the derived dataclass will take care " +"of initializing all fields of any base class that is a dataclass itself." +msgstr "" + +#: library/dataclasses.rst:593 msgid "" "See the section below on init-only variables for ways to pass parameters to :" -"meth:`__post_init__`. Also see the warning about how :func:`replace` " +"meth:`!__post_init__`. Also see the warning about how :func:`replace` " "handles ``init=False`` fields." msgstr "" -#: library/dataclasses.rst:558 +#: library/dataclasses.rst:600 msgid "Class variables" msgstr "" -#: library/dataclasses.rst:560 +#: library/dataclasses.rst:602 msgid "" -"One of the few places where :func:`dataclass` actually inspects the type of " +"One of the few places where :deco:`dataclass` actually inspects the type of " "a field is to determine if a field is a class variable as defined in :pep:" -"`526`. It does this by checking if the type of the field is ``typing." -"ClassVar``. If a field is a ``ClassVar``, it is excluded from consideration " +"`526`. It does this by checking if the type of the field is :data:`typing." +"ClassVar`. If a field is a ``ClassVar``, it is excluded from consideration " "as a field and is ignored by the dataclass mechanisms. Such ``ClassVar`` " "pseudo-fields are not returned by the module-level :func:`fields` function." msgstr "" -#: library/dataclasses.rst:569 +#: library/dataclasses.rst:613 msgid "Init-only variables" msgstr "" -#: library/dataclasses.rst:571 +#: library/dataclasses.rst:615 msgid "" -"Another place where :func:`dataclass` inspects a type annotation is to " +"Another place where :deco:`dataclass` inspects a type annotation is to " "determine if a field is an init-only variable. It does this by seeing if " -"the type of a field is of type ``dataclasses.InitVar``. If a field is an " -"``InitVar``, it is considered a pseudo-field called an init-only field. As " -"it is not a true field, it is not returned by the module-level :func:" -"`fields` function. Init-only fields are added as parameters to the " -"generated :meth:`~object.__init__` method, and are passed to the optional :" -"meth:`__post_init__` method. They are not otherwise used by dataclasses." +"the type of a field is of type :class:`InitVar`. If a field is an :class:" +"`InitVar`, it is considered a pseudo-field called an init-only field. As it " +"is not a true field, it is not returned by the module-level :func:`fields` " +"function. Init-only fields are added as parameters to the generated :meth:" +"`~object.__init__` method, and are passed to the optional :meth:" +"`__post_init__` method. They are not otherwise used by dataclasses." msgstr "" -#: library/dataclasses.rst:581 +#: library/dataclasses.rst:625 msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" msgstr "" -#: library/dataclasses.rst:596 +#: library/dataclasses.rst:628 msgid "" -"In this case, :func:`fields` will return :class:`Field` objects for ``i`` " -"and ``j``, but not for ``database``." +"@dataclass\n" +"class C:\n" +" i: int\n" +" j: int | None = None\n" +" database: InitVar[DatabaseType | None] = None\n" +"\n" +" def __post_init__(self, database):\n" +" if self.j is None and database is not None:\n" +" self.j = database.lookup('j')\n" +"\n" +"c = C(10, database=my_database)" msgstr "" -#: library/dataclasses.rst:600 +#: library/dataclasses.rst:640 +msgid "" +"In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" +"i` and :attr:`!j`, but not for :attr:`!database`." +msgstr "" + +#: library/dataclasses.rst:646 msgid "Frozen instances" msgstr "" -#: library/dataclasses.rst:602 +#: library/dataclasses.rst:648 msgid "" "It is not possible to create truly immutable Python objects. However, by " -"passing ``frozen=True`` to the :meth:`dataclass` decorator you can emulate " +"passing ``frozen=True`` to the :deco:`dataclass` decorator you can emulate " "immutability. In that case, dataclasses will add :meth:`~object." "__setattr__` and :meth:`~object.__delattr__` methods to the class. These " "methods will raise a :exc:`FrozenInstanceError` when invoked." msgstr "" -#: library/dataclasses.rst:608 +#: library/dataclasses.rst:654 msgid "" "There is a tiny performance penalty when using ``frozen=True``: :meth:" "`~object.__init__` cannot use simple assignment to initialize fields, and " "must use :meth:`!object.__setattr__`." msgstr "" -#: library/dataclasses.rst:613 +#: library/dataclasses.rst:663 msgid "Inheritance" msgstr "" -#: library/dataclasses.rst:615 +#: library/dataclasses.rst:665 msgid "" -"When the dataclass is being created by the :meth:`dataclass` decorator, it " +"When the dataclass is being created by the :deco:`dataclass` decorator, it " "looks through all of the class's base classes in reverse MRO (that is, " "starting at :class:`object`) and, for each dataclass that it finds, adds the " "fields from that base class to an ordered mapping of fields. After all of " @@ -703,22 +936,41 @@ msgid "" "derived classes override base classes. An example::" msgstr "" -#: library/dataclasses.rst:635 +#: library/dataclasses.rst:675 msgid "" -"The final list of fields is, in order, ``x``, ``y``, ``z``. The final type " -"of ``x`` is ``int``, as specified in class ``C``." +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" y: int = 0\n" +"\n" +"@dataclass\n" +"class C(Base):\n" +" z: int = 10\n" +" x: int = 15" msgstr "" -#: library/dataclasses.rst:638 +#: library/dataclasses.rst:685 msgid "" -"The generated :meth:`~object.__init__` method for ``C`` will look like::" +"The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " +"The final type of :attr:`!x` is :class:`int`, as specified in class :class:`!" +"C`." +msgstr "" + +#: library/dataclasses.rst:688 +msgid "" +"The generated :meth:`~object.__init__` method for :class:`!C` will look " +"like::" +msgstr "" + +#: library/dataclasses.rst:690 +msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" msgstr "" -#: library/dataclasses.rst:643 -msgid "Re-ordering of keyword-only parameters in :meth:`~object.__init__`" +#: library/dataclasses.rst:693 +msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" msgstr "" -#: library/dataclasses.rst:645 +#: library/dataclasses.rst:695 msgid "" "After the parameters needed for :meth:`~object.__init__` are computed, any " "keyword-only parameters are moved to come after all regular (non-keyword-" @@ -726,135 +978,234 @@ msgid "" "implemented in Python: they must come after non-keyword-only parameters." msgstr "" -#: library/dataclasses.rst:651 +#: library/dataclasses.rst:701 +msgid "" +"In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " +"keyword-only fields, and :attr:`!Base.x` and :attr:`!D.z` are regular " +"fields::" +msgstr "" + +#: library/dataclasses.rst:704 msgid "" -"In this example, ``Base.y``, ``Base.w``, and ``D.t`` are keyword-only " -"fields, and ``Base.x`` and ``D.z`` are regular fields::" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" _: KW_ONLY\n" +" y: int = 0\n" +" w: int = 1\n" +"\n" +"@dataclass\n" +"class D(Base):\n" +" z: int = 10\n" +" t: int = field(kw_only=True, default=0)" +msgstr "" + +#: library/dataclasses.rst:716 +msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "" -#: library/dataclasses.rst:666 +#: library/dataclasses.rst:718 msgid "" -"The generated :meth:`~object.__init__` method for ``D`` will look like::" +"def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " +"int = 0):" msgstr "" -#: library/dataclasses.rst:670 +#: library/dataclasses.rst:720 msgid "" "Note that the parameters have been re-ordered from how they appear in the " "list of fields: parameters derived from regular fields are followed by " "parameters derived from keyword-only fields." msgstr "" -#: library/dataclasses.rst:674 +#: library/dataclasses.rst:724 msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" -"ordered :meth:`~object.__init__` parameter list." +"ordered :meth:`!__init__` parameter list." msgstr "" -#: library/dataclasses.rst:679 +#: library/dataclasses.rst:729 msgid "Default factory functions" msgstr "" -#: library/dataclasses.rst:681 +#: library/dataclasses.rst:731 msgid "" -"If a :func:`field` specifies a ``default_factory``, it is called with zero " +"If a :func:`field` specifies a *default_factory*, it is called with zero " "arguments when a default value for the field is needed. For example, to " "create a new instance of a list, use::" msgstr "" -#: library/dataclasses.rst:687 +#: library/dataclasses.rst:735 +msgid "mylist: list = field(default_factory=list)" +msgstr "" + +#: library/dataclasses.rst:737 msgid "" "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " -"and the field also specifies ``default_factory``, then the default factory " -"function will always be called from the generated :meth:`~object.__init__` " +"and the field also specifies *default_factory*, then the default factory " +"function will always be called from the generated :meth:`!__init__` " "function. This happens because there is no other way to give the field an " "initial value." msgstr "" -#: library/dataclasses.rst:694 +#: library/dataclasses.rst:744 msgid "Mutable default values" msgstr "" -#: library/dataclasses.rst:696 +#: library/dataclasses.rst:746 msgid "" "Python stores default member variable values in class attributes. Consider " "this example, not using dataclasses::" msgstr "" -#: library/dataclasses.rst:711 +#: library/dataclasses.rst:749 +msgid "" +"class C:\n" +" x = []\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"o1 = C()\n" +"o2 = C()\n" +"o1.add(1)\n" +"o2.add(2)\n" +"assert o1.x == [1, 2]\n" +"assert o1.x is o2.x" +msgstr "" + +#: library/dataclasses.rst:761 msgid "" -"Note that the two instances of class ``C`` share the same class variable " -"``x``, as expected." +"Note that the two instances of class :class:`!C` share the same class " +"variable :attr:`!x`, as expected." msgstr "" -#: library/dataclasses.rst:714 +#: library/dataclasses.rst:764 msgid "Using dataclasses, *if* this code was valid::" msgstr "" -#: library/dataclasses.rst:722 +#: library/dataclasses.rst:766 +msgid "" +"@dataclass\n" +"class D:\n" +" x: list = [] # This code raises ValueError\n" +" def add(self, element):\n" +" self.x.append(element)" +msgstr "" + +#: library/dataclasses.rst:772 msgid "it would generate code similar to::" msgstr "" -#: library/dataclasses.rst:733 +#: library/dataclasses.rst:774 msgid "" -"This has the same issue as the original example using class ``C``. That is, " -"two instances of class ``D`` that do not specify a value for ``x`` when " -"creating a class instance will share the same copy of ``x``. Because " -"dataclasses just use normal Python class creation they also share this " -"behavior. There is no general way for Data Classes to detect this " -"condition. Instead, the :func:`dataclass` decorator will raise a :exc:" +"class D:\n" +" x = []\n" +" def __init__(self, x=x):\n" +" self.x = x\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"assert D().x is D().x" +msgstr "" + +#: library/dataclasses.rst:783 +msgid "" +"This has the same issue as the original example using class :class:`!C`. " +"That is, two instances of class :class:`!D` that do not specify a value for :" +"attr:`!x` when creating a class instance will share the same copy of :attr:`!" +"x`. Because dataclasses just use normal Python class creation they also " +"share this behavior. There is no general way for Data Classes to detect " +"this condition. Instead, the :deco:`dataclass` decorator will raise a :exc:" "`ValueError` if it detects an unhashable default parameter. The assumption " "is that if a value is unhashable, it is mutable. This is a partial " "solution, but it does protect against many common errors." msgstr "" -#: library/dataclasses.rst:744 +#: library/dataclasses.rst:794 msgid "" "Using default factory functions is a way to create new instances of mutable " "types as default values for fields::" msgstr "" -#: library/dataclasses.rst:753 +#: library/dataclasses.rst:797 +msgid "" +"@dataclass\n" +"class D:\n" +" x: list = field(default_factory=list)\n" +"\n" +"assert D().x is not D().x" +msgstr "" + +#: library/dataclasses.rst:803 msgid "" -"Instead of looking for and disallowing objects of type ``list``, ``dict``, " -"or ``set``, unhashable objects are now not allowed as default values. " -"Unhashability is used to approximate mutability." +"Instead of looking for and disallowing objects of type :class:`list`, :class:" +"`dict`, or :class:`set`, unhashable objects are now not allowed as default " +"values. Unhashability is used to approximate mutability." msgstr "" -#: library/dataclasses.rst:760 +#: library/dataclasses.rst:810 msgid "Descriptor-typed fields" msgstr "" -#: library/dataclasses.rst:762 +#: library/dataclasses.rst:812 msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " "default value have the following special behaviors:" msgstr "" -#: library/dataclasses.rst:765 +#: library/dataclasses.rst:815 msgid "" -"The value for the field passed to the dataclass's ``__init__`` method is " -"passed to the descriptor's ``__set__`` method rather than overwriting the " -"descriptor object." +"The value for the field passed to the dataclass's :meth:`~object.__init__` " +"method is passed to the descriptor's :meth:`~object.__set__` method rather " +"than overwriting the descriptor object." msgstr "" -#: library/dataclasses.rst:768 +#: library/dataclasses.rst:819 msgid "" -"Similarly, when getting or setting the field, the descriptor's ``__get__`` " -"or ``__set__`` method is called rather than returning or overwriting the " -"descriptor object." +"Similarly, when getting or setting the field, the descriptor's :meth:" +"`~object.__get__` or :meth:`!__set__` method is called rather than returning " +"or overwriting the descriptor object." msgstr "" -#: library/dataclasses.rst:771 +#: library/dataclasses.rst:823 msgid "" -"To determine whether a field contains a default value, ``dataclasses`` will " -"call the descriptor's ``__get__`` method using its class access form (i.e. " -"``descriptor.__get__(obj=None, type=cls)``. If the descriptor returns a " -"value in this case, it will be used as the field's default. On the other " +"To determine whether a field contains a default value, :deco:`dataclass` " +"will call the descriptor's :meth:`!__get__` method using its class access " +"form: ``descriptor.__get__(obj=None, type=cls)``. If the descriptor returns " +"a value in this case, it will be used as the field's default. On the other " "hand, if the descriptor raises :exc:`AttributeError` in this situation, no " "default value will be provided for the field." msgstr "" -#: library/dataclasses.rst:806 +#: library/dataclasses.rst:833 +msgid "" +"class IntConversionDescriptor:\n" +" def __init__(self, *, default):\n" +" self._default = default\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self._name = \"_\" + name\n" +"\n" +" def __get__(self, obj, type):\n" +" if obj is None:\n" +" return self._default\n" +"\n" +" return getattr(obj, self._name, self._default)\n" +"\n" +" def __set__(self, obj, value):\n" +" setattr(obj, self._name, int(value))\n" +"\n" +"@dataclass\n" +"class InventoryItem:\n" +" quantity_on_hand: IntConversionDescriptor = " +"IntConversionDescriptor(default=100)\n" +"\n" +"i = InventoryItem()\n" +"print(i.quantity_on_hand) # 100\n" +"i.quantity_on_hand = 2.5 # calls __set__ with 2.5\n" +"print(i.quantity_on_hand) # 2" +msgstr "" + +#: library/dataclasses.rst:858 msgid "" "Note that if a field is annotated with a descriptor type, but is not " "assigned a descriptor object as its default value, the field will act like a " diff --git a/library/datatypes.po b/library/datatypes.po index 7f48de77..94ca3c0c 100644 --- a/library/datatypes.po +++ b/library/datatypes.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/datetime.po b/library/datetime.po index addc0c4e..c05710a5 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/datetime.rst:2 -msgid ":mod:`datetime` --- Basic date and time types" +msgid ":mod:`!datetime` --- Basic date and time types" msgstr "" #: library/datetime.rst:11 @@ -40,7 +41,7 @@ msgstr "" msgid "Skip to :ref:`the format codes `." msgstr "" -#: library/datetime.rst:29 +#: library/datetime.rst:28 msgid "Module :mod:`calendar`" msgstr "" @@ -48,7 +49,7 @@ msgstr "" msgid "General calendar related functions." msgstr "" -#: library/datetime.rst:32 +#: library/datetime.rst:31 msgid "Module :mod:`time`" msgstr "" @@ -56,7 +57,7 @@ msgstr "" msgid "Time access and conversions." msgstr "" -#: library/datetime.rst:35 +#: library/datetime.rst:34 msgid "Module :mod:`zoneinfo`" msgstr "" @@ -64,7 +65,7 @@ msgstr "" msgid "Concrete time zones representing the IANA time zone database." msgstr "" -#: library/datetime.rst:38 +#: library/datetime.rst:37 msgid "Package `dateutil `_" msgstr "" @@ -72,8 +73,8 @@ msgstr "" msgid "Third-party library with expanded time zone and parsing support." msgstr "" -#: library/datetime.rst:42 -msgid "Package `DateType `_" +#: library/datetime.rst:40 +msgid "Package :pypi:`DateType`" msgstr "" #: library/datetime.rst:41 @@ -90,7 +91,7 @@ msgstr "" #: library/datetime.rst:50 msgid "" "Date and time objects may be categorized as \"aware\" or \"naive\" depending " -"on whether or not they include timezone information." +"on whether or not they include time zone information." msgstr "" #: library/datetime.rst:53 @@ -107,7 +108,7 @@ msgid "" "A **naive** object does not contain enough information to unambiguously " "locate itself relative to other date/time objects. Whether a naive object " "represents Coordinated Universal Time (UTC), local time, or time in some " -"other timezone is purely up to the program, just like it is up to the " +"other time zone is purely up to the program, just like it is up to the " "program whether a particular number represents metres, miles, or mass. Naive " "objects are easy to understand and to work with, at the cost of ignoring " "some aspects of reality." @@ -126,9 +127,9 @@ msgstr "" #: library/datetime.rst:72 msgid "" "Only one concrete :class:`tzinfo` class, the :class:`timezone` class, is " -"supplied by the :mod:`!datetime` module. The :class:`timezone` class can " -"represent simple timezones with fixed offsets from UTC, such as UTC itself " -"or North American EST and EDT timezones. Supporting timezones at deeper " +"supplied by the :mod:`!datetime` module. The :class:`!timezone` class can " +"represent simple time zones with fixed offsets from UTC, such as UTC itself " +"or North American EST and EDT time zones. Supporting time zones at deeper " "levels of detail is up to the application. The rules for time adjustment " "across the world are more political than rational, change frequently, and " "there is no standard suitable for every application aside from UTC." @@ -145,17 +146,17 @@ msgstr "" #: library/datetime.rst:87 msgid "" "The smallest year number allowed in a :class:`date` or :class:`.datetime` " -"object. :const:`MINYEAR` is ``1``." +"object. :const:`MINYEAR` is 1." msgstr "" #: library/datetime.rst:93 msgid "" "The largest year number allowed in a :class:`date` or :class:`.datetime` " -"object. :const:`MAXYEAR` is ``9999``." +"object. :const:`MAXYEAR` is 9999." msgstr "" #: library/datetime.rst:98 -msgid "Alias for the UTC timezone singleton :attr:`datetime.timezone.utc`." +msgid "Alias for the UTC time zone singleton :attr:`datetime.timezone.utc`." msgstr "" #: library/datetime.rst:103 @@ -212,6 +213,17 @@ msgstr "" msgid "Subclass relationships::" msgstr "" +#: library/datetime.rst:157 +msgid "" +"object\n" +" timedelta\n" +" tzinfo\n" +" timezone\n" +" time\n" +" date\n" +" datetime" +msgstr "" + #: library/datetime.rst:166 msgid "Common Properties" msgstr "" @@ -248,7 +260,8 @@ msgid "" msgstr "" #: library/datetime.rst:183 -msgid "A :class:`.datetime` object *d* is aware if both of the following hold:" +msgid "" +"A :class:`.datetime` object ``d`` is aware if both of the following hold:" msgstr "" #: library/datetime.rst:185 @@ -260,11 +273,11 @@ msgid "``d.tzinfo.utcoffset(d)`` does not return ``None``" msgstr "" #: library/datetime.rst:188 -msgid "Otherwise, *d* is naive." +msgid "Otherwise, ``d`` is naive." msgstr "" #: library/datetime.rst:190 -msgid "A :class:`.time` object *t* is aware if both of the following hold:" +msgid "A :class:`.time` object ``t`` is aware if both of the following hold:" msgstr "" #: library/datetime.rst:192 @@ -276,7 +289,7 @@ msgid "``t.tzinfo.utcoffset(None)`` does not return ``None``." msgstr "" #: library/datetime.rst:195 -msgid "Otherwise, *t* is naive." +msgid "Otherwise, ``t`` is naive." msgstr "" #: library/datetime.rst:197 @@ -297,8 +310,8 @@ msgstr "" #: library/datetime.rst:210 msgid "" -"All arguments are optional and default to ``0``. Arguments may be integers " -"or floats, and may be positive or negative." +"All arguments are optional and default to 0. Arguments may be integers or " +"floats, and may be positive or negative." msgstr "" #: library/datetime.rst:213 @@ -348,6 +361,23 @@ msgid "" "resulting attributes::" msgstr "" +#: library/datetime.rst:232 +msgid "" +">>> from datetime import timedelta\n" +">>> delta = timedelta(\n" +"... days=50,\n" +"... seconds=27,\n" +"... microseconds=10,\n" +"... milliseconds=29000,\n" +"... minutes=5,\n" +"... hours=8,\n" +"... weeks=2\n" +"... )\n" +">>> # Only days, seconds, and microseconds remain\n" +">>> delta\n" +"datetime.timedelta(days=64, seconds=29156, microseconds=10)" +msgstr "" + #: library/datetime.rst:246 msgid "" "If any argument is a float and there are fractional microseconds, the " @@ -369,262 +399,296 @@ msgid "" "example::" msgstr "" -#: library/datetime.rst:546 library/datetime.rst:1696 library/datetime.rst:2298 +#: library/datetime.rst:259 +msgid "" +">>> from datetime import timedelta\n" +">>> d = timedelta(microseconds=-1)\n" +">>> (d.days, d.seconds, d.microseconds)\n" +"(-1, 86399, 999999)" +msgstr "" + +#: library/datetime.rst:264 +msgid "" +"Since the string representation of :class:`!timedelta` objects can be " +"confusing, use the following recipe to produce a more readable format:" +msgstr "" + +#: library/datetime.rst:267 +msgid "" +">>> def pretty_timedelta(td):\n" +"... if td.days >= 0:\n" +"... return str(td)\n" +"... return f'-({-td!s})'\n" +"...\n" +">>> d = timedelta(hours=-1)\n" +">>> str(d) # not human-friendly\n" +"'-1 day, 23:00:00'\n" +">>> pretty_timedelta(d)\n" +"'-(1:00:00)'" +msgstr "" + +#: library/datetime.rst:615 library/datetime.rst:1813 library/datetime.rst:2434 msgid "Class attributes:" msgstr "" -#: library/datetime.rst:269 +#: library/datetime.rst:285 msgid "The most negative :class:`timedelta` object, ``timedelta(-999999999)``." msgstr "" -#: library/datetime.rst:274 +#: library/datetime.rst:290 msgid "" "The most positive :class:`timedelta` object, ``timedelta(days=999999999, " "hours=23, minutes=59, seconds=59, microseconds=999999)``." msgstr "" -#: library/datetime.rst:280 +#: library/datetime.rst:296 msgid "" "The smallest possible difference between non-equal :class:`timedelta` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: library/datetime.rst:283 +#: library/datetime.rst:299 msgid "" -"Note that, because of normalization, ``timedelta.max`` > ``-timedelta.min``. " -"``-timedelta.max`` is not representable as a :class:`timedelta` object." +"Note that, because of normalization, ``timedelta.max`` is greater than ``-" +"timedelta.min``. ``-timedelta.max`` is not representable as a :class:" +"`timedelta` object." msgstr "" -#: library/datetime.rst:564 library/datetime.rst:1716 +#: library/datetime.rst:633 library/datetime.rst:1833 msgid "Instance attributes (read-only):" msgstr "" -#: library/datetime.rst:289 -msgid "Attribute" -msgstr "" - -#: library/datetime.rst:289 -msgid "Value" -msgstr "" - -#: library/datetime.rst:291 -msgid "``days``" -msgstr "" - -#: library/datetime.rst:291 -msgid "Between -999999999 and 999999999 inclusive" +#: library/datetime.rst:307 +msgid "Between -999,999,999 and 999,999,999 inclusive." msgstr "" -#: library/datetime.rst:293 -msgid "``seconds``" +#: library/datetime.rst:312 +msgid "Between 0 and 86,399 inclusive." msgstr "" -#: library/datetime.rst:293 -msgid "Between 0 and 86399 inclusive" +#: library/datetime.rst:316 +msgid "" +"It is a somewhat common bug for code to unintentionally use this attribute " +"when it is actually intended to get a :meth:`~timedelta.total_seconds` value " +"instead:" msgstr "" -#: library/datetime.rst:295 -msgid "``microseconds``" +#: library/datetime.rst:320 +msgid "" +">>> from datetime import timedelta\n" +">>> duration = timedelta(seconds=11235813)\n" +">>> duration.days, duration.seconds\n" +"(130, 3813)\n" +">>> duration.total_seconds()\n" +"11235813.0" msgstr "" -#: library/datetime.rst:295 -msgid "Between 0 and 999999 inclusive" +#: library/datetime.rst:331 +msgid "Between 0 and 999,999 inclusive." msgstr "" -#: library/datetime.rst:581 library/datetime.rst:1138 +#: library/datetime.rst:650 library/datetime.rst:1248 msgid "Supported operations:" msgstr "" -#: library/datetime.rst:584 library/datetime.rst:1141 +#: library/datetime.rst:653 library/datetime.rst:1251 msgid "Operation" msgstr "" -#: library/datetime.rst:584 library/datetime.rst:1141 +#: library/datetime.rst:653 library/datetime.rst:1251 msgid "Result" msgstr "" -#: library/datetime.rst:305 +#: library/datetime.rst:341 msgid "``t1 = t2 + t3``" msgstr "" -#: library/datetime.rst:305 +#: library/datetime.rst:341 msgid "" -"Sum of *t2* and *t3*. Afterwards *t1*-*t2* == *t3* and *t1*-*t3* == *t2* are " -"true. (1)" +"Sum of ``t2`` and ``t3``. Afterwards ``t1 - t2 == t3`` and ``t1 - t3 == t2`` " +"are true. (1)" msgstr "" -#: library/datetime.rst:308 +#: library/datetime.rst:345 msgid "``t1 = t2 - t3``" msgstr "" -#: library/datetime.rst:308 +#: library/datetime.rst:345 msgid "" -"Difference of *t2* and *t3*. Afterwards *t1* == *t2* - *t3* and *t2* == *t1* " -"+ *t3* are true. (1)(6)" +"Difference of ``t2`` and ``t3``. Afterwards ``t1 == t2 - t3`` and ``t2 == " +"t1 + t3`` are true. (1)(6)" msgstr "" -#: library/datetime.rst:312 +#: library/datetime.rst:349 msgid "``t1 = t2 * i or t1 = i * t2``" msgstr "" -#: library/datetime.rst:312 +#: library/datetime.rst:349 msgid "" -"Delta multiplied by an integer. Afterwards *t1* // i == *t2* is true, " +"Delta multiplied by an integer. Afterwards ``t1 // i == t2`` is true, " "provided ``i != 0``." msgstr "" -#: library/datetime.rst:316 -msgid "In general, *t1* \\* i == *t1* \\* (i-1) + *t1* is true. (1)" +#: library/datetime.rst:353 +msgid "In general, ``t1 * i == t1 * (i-1) + t1`` is true. (1)" msgstr "" -#: library/datetime.rst:319 +#: library/datetime.rst:356 msgid "``t1 = t2 * f or t1 = f * t2``" msgstr "" -#: library/datetime.rst:319 +#: library/datetime.rst:356 msgid "" "Delta multiplied by a float. The result is rounded to the nearest multiple " "of timedelta.resolution using round-half-to-even." msgstr "" -#: library/datetime.rst:323 +#: library/datetime.rst:360 msgid "``f = t2 / t3``" msgstr "" -#: library/datetime.rst:323 +#: library/datetime.rst:360 msgid "" -"Division (3) of overall duration *t2* by interval unit *t3*. Returns a :" +"Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns a :" "class:`float` object." msgstr "" -#: library/datetime.rst:327 +#: library/datetime.rst:364 msgid "``t1 = t2 / f or t1 = t2 / i``" msgstr "" -#: library/datetime.rst:327 +#: library/datetime.rst:364 msgid "" "Delta divided by a float or an int. The result is rounded to the nearest " "multiple of timedelta.resolution using round-half-to-even." msgstr "" -#: library/datetime.rst:331 +#: library/datetime.rst:368 msgid "``t1 = t2 // i`` or ``t1 = t2 // t3``" msgstr "" -#: library/datetime.rst:331 +#: library/datetime.rst:368 msgid "" "The floor is computed and the remainder (if any) is thrown away. In the " "second case, an integer is returned. (3)" msgstr "" -#: library/datetime.rst:335 +#: library/datetime.rst:372 msgid "``t1 = t2 % t3``" msgstr "" -#: library/datetime.rst:335 +#: library/datetime.rst:372 msgid "The remainder is computed as a :class:`timedelta` object. (3)" msgstr "" -#: library/datetime.rst:338 +#: library/datetime.rst:375 msgid "``q, r = divmod(t1, t2)``" msgstr "" -#: library/datetime.rst:338 +#: library/datetime.rst:375 msgid "" "Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % " -"t2``. q is an integer and r is a :class:`timedelta` object." +"t2``. ``q`` is an integer and ``r`` is a :class:`timedelta` object." msgstr "" -#: library/datetime.rst:343 +#: library/datetime.rst:380 msgid "``+t1``" msgstr "" -#: library/datetime.rst:343 +#: library/datetime.rst:380 msgid "Returns a :class:`timedelta` object with the same value. (2)" msgstr "" -#: library/datetime.rst:346 +#: library/datetime.rst:383 msgid "``-t1``" msgstr "" -#: library/datetime.rst:346 +#: library/datetime.rst:383 msgid "" -"equivalent to :class:`timedelta`\\ (-*t1.days*, -*t1.seconds*, -*t1." -"microseconds*), and to *t1*\\* -1. (1)(4)" +"Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to " +"``t1 * -1``. (1)(4)" msgstr "" -#: library/datetime.rst:351 +#: library/datetime.rst:387 msgid "``abs(t)``" msgstr "" -#: library/datetime.rst:351 +#: library/datetime.rst:387 msgid "" -"equivalent to +\\ *t* when ``t.days >= 0``, and to -*t* when ``t.days < 0``. " -"(2)" +"Equivalent to ``+t`` when ``t.days >= 0``, and to ``-t`` when ``t.days < " +"0``. (2)" msgstr "" -#: library/datetime.rst:354 +#: library/datetime.rst:390 msgid "``str(t)``" msgstr "" -#: library/datetime.rst:354 +#: library/datetime.rst:390 msgid "" "Returns a string in the form ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D is " "negative for negative ``t``. (5)" msgstr "" -#: library/datetime.rst:358 +#: library/datetime.rst:394 msgid "``repr(t)``" msgstr "" -#: library/datetime.rst:358 +#: library/datetime.rst:394 msgid "" "Returns a string representation of the :class:`timedelta` object as a " "constructor call with canonical attribute values." msgstr "" -#: library/datetime.rst:603 library/datetime.rst:2529 +#: library/datetime.rst:672 library/datetime.rst:2663 msgid "Notes:" msgstr "" -#: library/datetime.rst:367 +#: library/datetime.rst:403 msgid "This is exact but may overflow." msgstr "" -#: library/datetime.rst:370 +#: library/datetime.rst:406 msgid "This is exact and cannot overflow." msgstr "" -#: library/datetime.rst:373 -msgid "Division by 0 raises :exc:`ZeroDivisionError`." +#: library/datetime.rst:409 +msgid "Division by zero raises :exc:`ZeroDivisionError`." msgstr "" -#: library/datetime.rst:376 -msgid "-*timedelta.max* is not representable as a :class:`timedelta` object." +#: library/datetime.rst:412 +msgid "``-timedelta.max`` is not representable as a :class:`timedelta` object." msgstr "" -#: library/datetime.rst:379 +#: library/datetime.rst:415 msgid "" "String representations of :class:`timedelta` objects are normalized " "similarly to their internal representation. This leads to somewhat unusual " "results for negative timedeltas. For example::" msgstr "" -#: library/datetime.rst:389 +#: library/datetime.rst:419 +msgid "" +">>> timedelta(hours=-5)\n" +"datetime.timedelta(days=-1, seconds=68400)\n" +">>> print(_)\n" +"-1 day, 19:00:00" +msgstr "" + +#: library/datetime.rst:425 msgid "" "The expression ``t2 - t3`` will always be equal to the expression ``t2 + (-" "t3)`` except when t3 is equal to ``timedelta.max``; in that case the former " "will produce a result while the latter will overflow." msgstr "" -#: library/datetime.rst:393 +#: library/datetime.rst:429 msgid "" "In addition to the operations listed above, :class:`timedelta` objects " "support certain additions and subtractions with :class:`date` and :class:`." "datetime` objects (see below)." msgstr "" -#: library/datetime.rst:397 +#: library/datetime.rst:433 msgid "" "Floor division and true division of a :class:`timedelta` object by another :" "class:`timedelta` object are now supported, as are remainder operations and " @@ -632,104 +696,134 @@ msgid "" "`timedelta` object by a :class:`float` object are now supported." msgstr "" -#: library/datetime.rst:403 +#: library/datetime.rst:439 msgid ":class:`timedelta` objects support equality and order comparisons." msgstr "" -#: library/datetime.rst:405 +#: library/datetime.rst:441 msgid "" "In Boolean contexts, a :class:`timedelta` object is considered to be true if " "and only if it isn't equal to ``timedelta(0)``." msgstr "" -#: library/datetime.rst:629 library/datetime.rst:1823 +#: library/datetime.rst:714 library/datetime.rst:1956 msgid "Instance methods:" msgstr "" -#: library/datetime.rst:412 +#: library/datetime.rst:448 msgid "" "Return the total number of seconds contained in the duration. Equivalent to " "``td / timedelta(seconds=1)``. For interval units other than seconds, use " "the division form directly (e.g. ``td / timedelta(microseconds=1)``)." msgstr "" -#: library/datetime.rst:416 +#: library/datetime.rst:452 msgid "" "Note that for very large time intervals (greater than 270 years on most " "platforms) this method will lose microsecond accuracy." msgstr "" -#: library/datetime.rst:422 +#: library/datetime.rst:458 msgid "Examples of usage: :class:`timedelta`" msgstr "" -#: library/datetime.rst:424 +#: library/datetime.rst:460 msgid "An additional example of normalization::" msgstr "" -#: library/datetime.rst:436 +#: library/datetime.rst:462 +msgid "" +">>> # Components of another_year add up to exactly 365 days\n" +">>> from datetime import timedelta\n" +">>> year = timedelta(days=365)\n" +">>> another_year = timedelta(weeks=40, days=84, hours=23,\n" +"... minutes=50, seconds=600)\n" +">>> year == another_year\n" +"True\n" +">>> year.total_seconds()\n" +"31536000.0" +msgstr "" + +#: library/datetime.rst:472 msgid "Examples of :class:`timedelta` arithmetic::" msgstr "" -#: library/datetime.rst:455 +#: library/datetime.rst:474 +msgid "" +">>> from datetime import timedelta\n" +">>> year = timedelta(days=365)\n" +">>> ten_years = 10 * year\n" +">>> ten_years\n" +"datetime.timedelta(days=3650)\n" +">>> ten_years.days // 365\n" +"10\n" +">>> nine_years = ten_years - year\n" +">>> nine_years\n" +"datetime.timedelta(days=3285)\n" +">>> three_years = nine_years // 3\n" +">>> three_years, three_years.days // 365\n" +"(datetime.timedelta(days=1095), 3)" +msgstr "" + +#: library/datetime.rst:491 msgid ":class:`date` Objects" msgstr "" -#: library/datetime.rst:457 +#: library/datetime.rst:493 msgid "" "A :class:`date` object represents a date (year, month and day) in an " "idealized calendar, the current Gregorian calendar indefinitely extended in " "both directions." msgstr "" -#: library/datetime.rst:461 +#: library/datetime.rst:497 msgid "" "January 1 of year 1 is called day number 1, January 2 of year 1 is called " "day number 2, and so on. [#]_" msgstr "" -#: library/datetime.rst:466 +#: library/datetime.rst:502 msgid "" "All arguments are required. Arguments must be integers, in the following " "ranges:" msgstr "" -#: library/datetime.rst:469 +#: library/datetime.rst:505 msgid "``MINYEAR <= year <= MAXYEAR``" msgstr "" -#: library/datetime.rst:470 +#: library/datetime.rst:506 msgid "``1 <= month <= 12``" msgstr "" -#: library/datetime.rst:471 +#: library/datetime.rst:507 msgid "``1 <= day <= number of days in the given month and year``" msgstr "" -#: library/datetime.rst:844 +#: library/datetime.rst:932 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "" -#: library/datetime.rst:849 +#: library/datetime.rst:937 msgid "Other constructors, all class methods:" msgstr "" -#: library/datetime.rst:480 +#: library/datetime.rst:516 msgid "Return the current local date." msgstr "" -#: library/datetime.rst:482 +#: library/datetime.rst:518 msgid "This is equivalent to ``date.fromtimestamp(time.time())``." msgstr "" -#: library/datetime.rst:486 +#: library/datetime.rst:522 msgid "" "Return the local date corresponding to the POSIX timestamp, such as is " "returned by :func:`time.time`." msgstr "" -#: library/datetime.rst:489 +#: library/datetime.rst:525 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`localtime` function, and :exc:" @@ -739,7 +833,7 @@ msgid "" "ignored by :meth:`fromtimestamp`." msgstr "" -#: library/datetime.rst:496 +#: library/datetime.rst:532 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -747,101 +841,150 @@ msgid "" "`localtime` failure." msgstr "" -#: library/datetime.rst:505 +#: library/datetime.rst:541 msgid "" "Return the date corresponding to the proleptic Gregorian ordinal, where " "January 1 of year 1 has ordinal 1." msgstr "" -#: library/datetime.rst:508 +#: library/datetime.rst:544 msgid "" ":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. " -"For any date *d*, ``date.fromordinal(d.toordinal()) == d``." +"For any date ``d``, ``date.fromordinal(d.toordinal()) == d``." msgstr "" -#: library/datetime.rst:515 +#: library/datetime.rst:551 msgid "" "Return a :class:`date` corresponding to a *date_string* given in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: library/datetime.rst:1005 +#: library/datetime.rst:1097 msgid "" "Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." msgstr "" -#: library/datetime.rst:1007 +#: library/datetime.rst:1099 msgid "" "Extended date representations are not currently supported (``±YYYYYY-MM-" "DD``)." msgstr "" -#: library/datetime.rst:1009 +#: library/datetime.rst:1101 msgid "Ordinal dates are not currently supported (``YYYY-OOO``)." msgstr "" -#: library/datetime.rst:1011 library/datetime.rst:1452 +#: library/datetime.rst:1103 library/datetime.rst:1569 msgid "Examples::" msgstr "" -#: library/datetime.rst:535 +#: library/datetime.rst:562 +msgid "" +">>> from datetime import date\n" +">>> date.fromisoformat('2019-12-04')\n" +"datetime.date(2019, 12, 4)\n" +">>> date.fromisoformat('20191204')\n" +"datetime.date(2019, 12, 4)\n" +">>> date.fromisoformat('2021-W01-1')\n" +"datetime.date(2021, 1, 4)" +msgstr "" + +#: library/datetime.rst:571 msgid "Previously, this method only supported the format ``YYYY-MM-DD``." msgstr "" -#: library/datetime.rst:540 +#: library/datetime.rst:576 msgid "" "Return a :class:`date` corresponding to the ISO calendar date specified by " "year, week and day. This is the inverse of the function :meth:`date." "isocalendar`." msgstr "" -#: library/datetime.rst:550 +#: library/datetime.rst:583 +msgid "" +"Return a :class:`.date` corresponding to *date_string*, parsed according to " +"*format*. This is equivalent to::" +msgstr "" + +#: library/datetime.rst:586 +msgid "date(*(time.strptime(date_string, format)[0:3]))" +msgstr "" + +#: library/datetime.rst:588 +msgid "" +":exc:`ValueError` is raised if the date_string and format can't be parsed " +"by :func:`time.strptime` or if it returns a value which isn't a time tuple. " +"See also :ref:`strftime-strptime-behavior` and :meth:`date.fromisoformat`." +msgstr "" + +#: library/datetime.rst:595 +msgid "" +"If *format* specifies a day of month without a year a :exc:" +"`DeprecationWarning` is emitted. This is to avoid a quadrennial leap year " +"bug in code seeking to parse only a month and day as the default year used " +"in absence of one in the format is not a leap year. Such *format* values may " +"raise an error as of Python 3.15. The workaround is to always include a " +"year in your *format*. If parsing *date_string* values that do not have a " +"year, explicitly add a year that is a leap year before parsing:" +msgstr "" + +#: library/datetime.rst:604 +msgid "" +">>> from datetime import date\n" +">>> date_string = \"02/29\"\n" +">>> when = date.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # Avoids " +"leap year bug.\n" +">>> when.strftime(\"%B %d\")\n" +"'February 29'" +msgstr "" + +#: library/datetime.rst:619 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." msgstr "" -#: library/datetime.rst:555 +#: library/datetime.rst:624 msgid "The latest representable date, ``date(MAXYEAR, 12, 31)``." msgstr "" -#: library/datetime.rst:560 +#: library/datetime.rst:629 msgid "" "The smallest possible difference between non-equal date objects, " "``timedelta(days=1)``." msgstr "" -#: library/datetime.rst:1089 +#: library/datetime.rst:1199 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: library/datetime.rst:1094 +#: library/datetime.rst:1204 msgid "Between 1 and 12 inclusive." msgstr "" -#: library/datetime.rst:1099 +#: library/datetime.rst:1209 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" -#: library/datetime.rst:586 +#: library/datetime.rst:655 msgid "``date2 = date1 + timedelta``" msgstr "" -#: library/datetime.rst:586 -msgid "*date2* will be ``timedelta.days`` days after *date1*. (1)" +#: library/datetime.rst:655 +msgid "``date2`` will be ``timedelta.days`` days after ``date1``. (1)" msgstr "" -#: library/datetime.rst:589 +#: library/datetime.rst:658 msgid "``date2 = date1 - timedelta``" msgstr "" -#: library/datetime.rst:589 -msgid "Computes *date2* such that ``date2 + timedelta == date1``. (2)" +#: library/datetime.rst:658 +msgid "Computes ``date2`` such that ``date2 + timedelta == date1``. (2)" msgstr "" -#: library/datetime.rst:592 +#: library/datetime.rst:661 msgid "``timedelta = date1 - date2``" msgstr "" -#: library/datetime.rst:1147 +#: library/datetime.rst:1257 msgid "\\(3)" msgstr "" @@ -853,7 +996,7 @@ msgstr "" msgid "``date1 != date2``" msgstr "" -#: library/datetime.rst:1149 +#: library/datetime.rst:1259 msgid "Equality comparison. (4)" msgstr "" @@ -873,11 +1016,11 @@ msgstr "" msgid "``date1 >= date2``" msgstr "" -#: library/datetime.rst:1152 +#: library/datetime.rst:1262 msgid "Order comparison. (5)" msgstr "" -#: library/datetime.rst:606 +#: library/datetime.rst:675 msgid "" "*date2* is moved forward in time if ``timedelta.days > 0``, or backward if " "``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. " @@ -886,95 +1029,136 @@ msgid "" "`MINYEAR` or larger than :const:`MAXYEAR`." msgstr "" -#: library/datetime.rst:613 +#: library/datetime.rst:682 msgid "``timedelta.seconds`` and ``timedelta.microseconds`` are ignored." msgstr "" -#: library/datetime.rst:616 +#: library/datetime.rst:685 msgid "" -"This is exact, and cannot overflow. timedelta.seconds and timedelta." -"microseconds are 0, and date2 + timedelta == date1 after." +"This is exact, and cannot overflow. ``timedelta.seconds`` and ``timedelta." +"microseconds`` are 0, and ``date2 + timedelta == date1`` after." msgstr "" -#: library/datetime.rst:620 +#: library/datetime.rst:689 msgid ":class:`date` objects are equal if they represent the same date." msgstr "" -#: library/datetime.rst:623 +#: library/datetime.rst:691 +msgid "" +":class:`!date` objects that are not also :class:`.datetime` instances are " +"never equal to :class:`!datetime` objects, even if they represent the same " +"date." +msgstr "" + +#: library/datetime.rst:696 msgid "" "*date1* is considered less than *date2* when *date1* precedes *date2* in " "time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < " "date2.toordinal()``." msgstr "" -#: library/datetime.rst:627 +#: library/datetime.rst:700 +msgid "" +"Order comparison between a :class:`!date` object that is not also a :class:`." +"datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." +msgstr "" + +#: library/datetime.rst:1330 +msgid "" +"Comparison between :class:`.datetime` object and an instance of the :class:" +"`date` subclass that is not a :class:`!datetime` subclass no longer converts " +"the latter to :class:`!date`, ignoring the time part and the time zone. The " +"default behavior can be changed by overriding the special comparison methods " +"in subclasses." +msgstr "" + +#: library/datetime.rst:712 msgid "" "In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -#: library/datetime.rst:633 +#: library/datetime.rst:718 msgid "" -"Return a date with the same value, except for those parameters given new " -"values by whichever keyword arguments are specified." +"Return a new :class:`date` object with the same values, but with specified " +"parameters updated." msgstr "" -#: library/datetime.rst:1866 +#: library/datetime.rst:2002 msgid "Example::" msgstr "" -#: library/datetime.rst:1337 +#: library/datetime.rst:723 +msgid "" +">>> from datetime import date\n" +">>> d = date(2002, 12, 31)\n" +">>> d.replace(day=26)\n" +"datetime.date(2002, 12, 26)" +msgstr "" + +#: library/datetime.rst:728 +msgid "" +"The generic function :func:`copy.replace` also supports :class:`date` " +"objects." +msgstr "" + +#: library/datetime.rst:1454 msgid "" "Return a :class:`time.struct_time` such as returned by :func:`time." "localtime`." msgstr "" -#: library/datetime.rst:648 +#: library/datetime.rst:736 msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" -#: library/datetime.rst:1339 +#: library/datetime.rst:1456 msgid "``d.timetuple()`` is equivalent to::" msgstr "" -#: library/datetime.rst:654 +#: library/datetime.rst:740 +msgid "" +"time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" +msgstr "" + +#: library/datetime.rst:742 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " -"day number within the current year starting with ``1`` for January 1st." +"day number within the current year starting with 1 for January 1st." msgstr "" -#: library/datetime.rst:660 +#: library/datetime.rst:748 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " -"1 has ordinal 1. For any :class:`date` object *d*, ``date.fromordinal(d." +"1 has ordinal 1. For any :class:`date` object ``d``, ``date.fromordinal(d." "toordinal()) == d``." msgstr "" -#: library/datetime.rst:667 +#: library/datetime.rst:755 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :" "meth:`isoweekday`." msgstr "" -#: library/datetime.rst:674 +#: library/datetime.rst:762 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :" "meth:`weekday`, :meth:`isocalendar`." msgstr "" -#: library/datetime.rst:681 +#: library/datetime.rst:769 msgid "" "Return a :term:`named tuple` object with three components: ``year``, " "``week`` and ``weekday``." msgstr "" -#: library/datetime.rst:684 +#: library/datetime.rst:772 msgid "" "The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" msgstr "" -#: library/datetime.rst:686 +#: library/datetime.rst:774 msgid "" "The ISO year consists of 52 or 53 full weeks, and where a week starts on a " "Monday and ends on a Sunday. The first week of an ISO year is the first " @@ -983,41 +1167,68 @@ msgid "" "Gregorian year." msgstr "" -#: library/datetime.rst:691 +#: library/datetime.rst:779 msgid "" "For example, 2004 begins on a Thursday, so the first week of ISO year 2004 " "begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" msgstr "" -#: library/datetime.rst:700 +#: library/datetime.rst:782 +msgid "" +">>> from datetime import date\n" +">>> date(2003, 12, 29).isocalendar()\n" +"datetime.IsoCalendarDate(year=2004, week=1, weekday=1)\n" +">>> date(2004, 1, 4).isocalendar()\n" +"datetime.IsoCalendarDate(year=2004, week=1, weekday=7)" +msgstr "" + +#: library/datetime.rst:788 msgid "Result changed from a tuple to a :term:`named tuple`." msgstr "" -#: library/datetime.rst:705 +#: library/datetime.rst:793 msgid "" "Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" msgstr "" -#: library/datetime.rst:713 -msgid "For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``." +#: library/datetime.rst:795 +msgid "" +">>> from datetime import date\n" +">>> date(2002, 12, 4).isoformat()\n" +"'2002-12-04'" msgstr "" -#: library/datetime.rst:718 +#: library/datetime.rst:801 +msgid "For a date ``d``, ``str(d)`` is equivalent to ``d.isoformat()``." +msgstr "" + +#: library/datetime.rst:806 msgid "Return a string representing the date::" msgstr "" -#: library/datetime.rst:1523 +#: library/datetime.rst:808 +msgid "" +">>> from datetime import date\n" +">>> date(2002, 12, 4).ctime()\n" +"'Wed Dec 4 00:00:00 2002'" +msgstr "" + +#: library/datetime.rst:1640 msgid "``d.ctime()`` is equivalent to::" msgstr "" -#: library/datetime.rst:728 +#: library/datetime.rst:1642 +msgid "time.ctime(time.mktime(d.timetuple()))" +msgstr "" + +#: library/datetime.rst:816 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to " "the C standard." msgstr "" -#: library/datetime.rst:735 +#: library/datetime.rst:823 msgid "" "Return a string representing the date, controlled by an explicit format " "string. Format codes referring to hours, minutes or seconds will see 0 " @@ -1025,7 +1236,7 @@ msgid "" "isoformat`." msgstr "" -#: library/datetime.rst:742 +#: library/datetime.rst:830 msgid "" "Same as :meth:`.date.strftime`. This makes it possible to specify a format " "string for a :class:`.date` object in :ref:`formatted string literals >> import time\n" +">>> from datetime import date\n" +">>> today = date.today()\n" +">>> today\n" +"datetime.date(2007, 12, 5)\n" +">>> today == date.fromtimestamp(time.time())\n" +"True\n" +">>> my_birthday = date(today.year, 6, 24)\n" +">>> if my_birthday < today:\n" +"... my_birthday = my_birthday.replace(year=today.year + 1)\n" +"...\n" +">>> my_birthday\n" +"datetime.date(2008, 6, 24)\n" +">>> time_to_birthday = abs(my_birthday - today)\n" +">>> time_to_birthday.days\n" +"202" +msgstr "" + +#: library/datetime.rst:857 msgid "More examples of working with :class:`date`:" msgstr "" -#: library/datetime.rst:818 +#: library/datetime.rst:859 +msgid "" +">>> from datetime import date\n" +">>> d = date.fromordinal(730920) # 730920th day after 1. 1. 0001\n" +">>> d\n" +"datetime.date(2002, 3, 11)\n" +"\n" +">>> # Methods related to formatting string output\n" +">>> d.isoformat()\n" +"'2002-03-11'\n" +">>> d.strftime(\"%d/%m/%y\")\n" +"'11/03/02'\n" +">>> d.strftime(\"%A %d. %B %Y\")\n" +"'Monday 11. March 2002'\n" +">>> d.ctime()\n" +"'Mon Mar 11 00:00:00 2002'\n" +">>> 'The {1} is {0:%d}, the {2} is {0:%B}.'.format(d, \"day\", \"month\")\n" +"'The day is 11, the month is March.'\n" +"\n" +">>> # Methods for to extracting 'components' under different calendars\n" +">>> t = d.timetuple()\n" +">>> for i in t:\n" +"... print(i)\n" +"2002 # year\n" +"3 # month\n" +"11 # day\n" +"0\n" +"0\n" +"0\n" +"0 # weekday (0 = Monday)\n" +"70 # 70th day in the year\n" +"-1\n" +">>> ic = d.isocalendar()\n" +">>> for i in ic:\n" +"... print(i)\n" +"2002 # ISO year\n" +"11 # ISO week number\n" +"1 # ISO day number ( 1 = Monday )\n" +"\n" +">>> # A date object is immutable; all operations produce a new object\n" +">>> d.replace(year=2005)\n" +"datetime.date(2005, 3, 11)" +msgstr "" + +#: library/datetime.rst:906 msgid ":class:`.datetime` Objects" msgstr "" -#: library/datetime.rst:820 +#: library/datetime.rst:908 msgid "" "A :class:`.datetime` object is a single object containing all the " "information from a :class:`date` object and a :class:`.time` object." msgstr "" -#: library/datetime.rst:823 +#: library/datetime.rst:911 msgid "" "Like a :class:`date` object, :class:`.datetime` assumes the current " "Gregorian calendar extended in both directions; like a :class:`.time` " @@ -1063,76 +1338,80 @@ msgid "" "every day." msgstr "" -#: library/datetime.rst:827 +#: library/datetime.rst:915 msgid "Constructor:" msgstr "" -#: library/datetime.rst:831 +#: library/datetime.rst:919 msgid "" "The *year*, *month* and *day* arguments are required. *tzinfo* may be " "``None``, or an instance of a :class:`tzinfo` subclass. The remaining " "arguments must be integers in the following ranges:" msgstr "" -#: library/datetime.rst:835 +#: library/datetime.rst:923 msgid "``MINYEAR <= year <= MAXYEAR``," msgstr "" -#: library/datetime.rst:836 +#: library/datetime.rst:924 msgid "``1 <= month <= 12``," msgstr "" -#: library/datetime.rst:837 +#: library/datetime.rst:925 msgid "``1 <= day <= number of days in the given month and year``," msgstr "" -#: library/datetime.rst:1687 +#: library/datetime.rst:1804 msgid "``0 <= hour < 24``," msgstr "" -#: library/datetime.rst:1688 +#: library/datetime.rst:1805 msgid "``0 <= minute < 60``," msgstr "" -#: library/datetime.rst:1689 +#: library/datetime.rst:1806 msgid "``0 <= second < 60``," msgstr "" -#: library/datetime.rst:1690 +#: library/datetime.rst:1807 msgid "``0 <= microsecond < 1000000``," msgstr "" -#: library/datetime.rst:1691 +#: library/datetime.rst:1808 msgid "``fold in [0, 1]``." msgstr "" -#: library/datetime.rst:1258 library/datetime.rst:1833 +#: library/datetime.rst:1375 library/datetime.rst:1969 msgid "Added the *fold* parameter." msgstr "" -#: library/datetime.rst:853 -msgid "Return the current local datetime, with :attr:`.tzinfo` ``None``." +#: library/datetime.rst:941 +msgid "Return the current local date and time, with :attr:`.tzinfo` ``None``." msgstr "" -#: library/datetime.rst:855 +#: library/datetime.rst:943 msgid "Equivalent to::" msgstr "" -#: library/datetime.rst:859 +#: library/datetime.rst:945 +msgid "datetime.fromtimestamp(time.time())" +msgstr "" + +#: library/datetime.rst:947 msgid "See also :meth:`now`, :meth:`fromtimestamp`." msgstr "" -#: library/datetime.rst:861 +#: library/datetime.rst:949 msgid "" "This method is functionally equivalent to :meth:`now`, but without a ``tz`` " "parameter." msgstr "" -#: library/datetime.rst:866 +#: library/datetime.rst:954 msgid "Return the current local date and time." msgstr "" -#: library/datetime.rst:868 +#: library/datetime.rst:956 msgid "" "If optional argument *tz* is ``None`` or not specified, this is like :meth:" "`today`, but, if possible, supplies more precision than can be gotten from " @@ -1140,28 +1419,34 @@ msgid "" "possible on platforms supplying the C :c:func:`gettimeofday` function)." msgstr "" -#: library/datetime.rst:874 +#: library/datetime.rst:962 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the current date and time are converted to *tz*’s time zone." msgstr "" -#: library/datetime.rst:877 +#: library/datetime.rst:965 msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" -#: library/datetime.rst:882 +#: library/datetime.rst:969 +msgid "" +"Subsequent calls to :meth:`!datetime.now` may return the same instant " +"depending on the precision of the underlying clock." +msgstr "" + +#: library/datetime.rst:974 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." msgstr "" -#: library/datetime.rst:884 +#: library/datetime.rst:976 msgid "" "This is like :meth:`now`, but returns the current UTC date and time, as a " "naive :class:`.datetime` object. An aware current UTC datetime can be " "obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." msgstr "" -#: library/datetime.rst:890 +#: library/datetime.rst:982 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1169,11 +1454,11 @@ msgid "" "current time in UTC is by calling ``datetime.now(timezone.utc)``." msgstr "" -#: library/datetime.rst:897 -msgid "Use :meth:`datetime.now` with :attr:`UTC` instead." +#: library/datetime.rst:989 +msgid "Use :meth:`datetime.now` with :const:`UTC` instead." msgstr "" -#: library/datetime.rst:902 +#: library/datetime.rst:994 msgid "" "Return the local date and time corresponding to the POSIX timestamp, such as " "is returned by :func:`time.time`. If optional argument *tz* is ``None`` or " @@ -1181,13 +1466,13 @@ msgid "" "time, and the returned :class:`.datetime` object is naive." msgstr "" -#: library/datetime.rst:907 +#: library/datetime.rst:999 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the timestamp is converted to *tz*’s time zone." msgstr "" -#: library/datetime.rst:910 +#: library/datetime.rst:1002 msgid "" ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1200,7 +1485,7 @@ msgid "" "preferred over :meth:`utcfromtimestamp`." msgstr "" -#: library/datetime.rst:921 +#: library/datetime.rst:1013 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1208,17 +1493,17 @@ msgid "" "`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" -#: library/datetime.rst:928 +#: library/datetime.rst:1020 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -#: library/datetime.rst:933 +#: library/datetime.rst:1025 msgid "" "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " "with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -#: library/datetime.rst:936 +#: library/datetime.rst:1028 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`gmtime` function, and :exc:" @@ -1226,23 +1511,32 @@ msgid "" "to years in 1970 through 2038." msgstr "" -#: library/datetime.rst:941 +#: library/datetime.rst:1033 msgid "To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::" msgstr "" -#: library/datetime.rst:945 +#: library/datetime.rst:1035 +msgid "datetime.fromtimestamp(timestamp, timezone.utc)" +msgstr "" + +#: library/datetime.rst:1037 msgid "" "On the POSIX compliant platforms, it is equivalent to the following " "expression::" msgstr "" -#: library/datetime.rst:950 +#: library/datetime.rst:1040 +msgid "" +"datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" +msgstr "" + +#: library/datetime.rst:1042 msgid "" "except the latter formula always supports the full years range: between :" "const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: library/datetime.rst:955 +#: library/datetime.rst:1047 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1251,7 +1545,7 @@ msgid "" "tz=timezone.utc)``." msgstr "" -#: library/datetime.rst:961 +#: library/datetime.rst:1053 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`gmtime` " @@ -1259,11 +1553,11 @@ msgid "" "`gmtime` failure." msgstr "" -#: library/datetime.rst:969 -msgid "Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead." +#: library/datetime.rst:1061 +msgid "Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead." msgstr "" -#: library/datetime.rst:974 +#: library/datetime.rst:1066 msgid "" "Return the :class:`.datetime` corresponding to the proleptic Gregorian " "ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is " @@ -1272,7 +1566,7 @@ msgid "" "is ``None``." msgstr "" -#: library/datetime.rst:982 +#: library/datetime.rst:1074 msgid "" "Return a new :class:`.datetime` object whose date components are equal to " "the given :class:`date` object's, and whose time components are equal to the " @@ -1283,41 +1577,66 @@ msgid "" "attr:`.tzinfo` attributes are ignored." msgstr "" -#: library/datetime.rst:990 +#: library/datetime.rst:1082 msgid "" -"For any :class:`.datetime` object *d*, ``d == datetime.combine(d.date(), d." +"For any :class:`.datetime` object ``d``, ``d == datetime.combine(d.date(), d." "time(), d.tzinfo)``." msgstr "" -#: library/datetime.rst:993 +#: library/datetime.rst:1085 msgid "Added the *tzinfo* argument." msgstr "" -#: library/datetime.rst:999 +#: library/datetime.rst:1091 msgid "" "Return a :class:`.datetime` corresponding to a *date_string* in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: library/datetime.rst:1787 +#: library/datetime.rst:1904 msgid "Time zone offsets may have fractional seconds." msgstr "" -#: library/datetime.rst:1003 +#: library/datetime.rst:1095 msgid "The ``T`` separator may be replaced by any single unicode character." msgstr "" -#: library/datetime.rst:1792 +#: library/datetime.rst:1909 msgid "Fractional hours and minutes are not supported." msgstr "" -#: library/datetime.rst:1035 +#: library/datetime.rst:1105 +msgid "" +">>> from datetime import datetime\n" +">>> datetime.fromisoformat('2011-11-04')\n" +"datetime.datetime(2011, 11, 4, 0, 0)\n" +">>> datetime.fromisoformat('20111104')\n" +"datetime.datetime(2011, 11, 4, 0, 0)\n" +">>> datetime.fromisoformat('2011-11-04T00:05:23')\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23)\n" +">>> datetime.fromisoformat('2011-11-04T00:05:23Z')\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23, tzinfo=datetime.timezone.utc)\n" +">>> datetime.fromisoformat('20111104T000523')\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23)\n" +">>> datetime.fromisoformat('2011-W01-2T00:05:23.283')\n" +"datetime.datetime(2011, 1, 4, 0, 5, 23, 283000)\n" +">>> datetime.fromisoformat('2011-11-04 00:05:23.283')\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000)\n" +">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." +"utc)\n" +">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" +"datetime.datetime(2011, 11, 4, 0, 5, 23,\n" +" tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" +msgstr "" + +#: library/datetime.rst:1127 msgid "" "Previously, this method only supported formats that could be emitted by :" -"meth:`date.isoformat()` or :meth:`datetime.isoformat()`." +"meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" -#: library/datetime.rst:1042 +#: library/datetime.rst:1134 msgid "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " @@ -1325,19 +1644,23 @@ msgid "" "`datetime.isocalendar`." msgstr "" -#: library/datetime.rst:1051 +#: library/datetime.rst:1143 msgid "" "Return a :class:`.datetime` corresponding to *date_string*, parsed according " "to *format*." msgstr "" -#: library/datetime.rst:1054 +#: library/datetime.rst:1146 msgid "" -"If *format* does not contain microseconds or timezone information, this is " +"If *format* does not contain microseconds or time zone information, this is " "equivalent to::" msgstr "" -#: library/datetime.rst:1058 +#: library/datetime.rst:2643 +msgid "datetime(*(time.strptime(date_string, format)[0:6]))" +msgstr "" + +#: library/datetime.rst:1150 msgid "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " @@ -1345,69 +1668,91 @@ msgid "" "fromisoformat`." msgstr "" -#: library/datetime.rst:1069 +#: library/datetime.rst:1157 +msgid "" +"If *format* specifies a day of month without a year a :exc:" +"`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap " +"year bug in code seeking to parse only a month and day as the default year " +"used in absence of one in the format is not a leap year. Such *format* " +"values may raise an error as of Python 3.15. The workaround is to always " +"include a year in your *format*. If parsing *date_string* values that do " +"not have a year, explicitly add a year that is a leap year before parsing:" +msgstr "" + +#: library/datetime.rst:1166 +msgid "" +">>> from datetime import datetime\n" +">>> date_string = \"02/29\"\n" +">>> when = datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " +"Avoids leap year bug.\n" +">>> when.strftime(\"%B %d\")\n" +"'February 29'" +msgstr "" + +#: library/datetime.rst:1179 msgid "" "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " "tzinfo=None)``." msgstr "" -#: library/datetime.rst:1075 +#: library/datetime.rst:1185 msgid "" "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " "59, 59, 999999, tzinfo=None)``." msgstr "" -#: library/datetime.rst:1081 +#: library/datetime.rst:1191 msgid "" "The smallest possible difference between non-equal :class:`.datetime` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: library/datetime.rst:1720 +#: library/datetime.rst:1837 msgid "In ``range(24)``." msgstr "" -#: library/datetime.rst:1114 library/datetime.rst:1730 +#: library/datetime.rst:1224 library/datetime.rst:1847 msgid "In ``range(60)``." msgstr "" -#: library/datetime.rst:1735 +#: library/datetime.rst:1852 msgid "In ``range(1000000)``." msgstr "" -#: library/datetime.rst:1124 +#: library/datetime.rst:1234 msgid "" "The object passed as the *tzinfo* argument to the :class:`.datetime` " "constructor, or ``None`` if none was passed." msgstr "" -#: library/datetime.rst:1746 +#: library/datetime.rst:1863 msgid "" "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " "(A repeated interval occurs when clocks are rolled back at the end of " "daylight saving time or when the UTC offset for the current zone is " -"decreased for political reasons.) The value 0 (1) represents the earlier " -"(later) of the two moments with the same wall time representation." +"decreased for political reasons.) The values 0 and 1 represent, " +"respectively, the earlier and later of the two moments with the same wall " +"time representation." msgstr "" -#: library/datetime.rst:1143 +#: library/datetime.rst:1253 msgid "``datetime2 = datetime1 + timedelta``" msgstr "" -#: library/datetime.rst:2356 library/datetime.rst:2373 -#: library/datetime.rst:2438 library/datetime.rst:2447 +#: library/datetime.rst:2490 library/datetime.rst:2507 +#: library/datetime.rst:2572 library/datetime.rst:2581 msgid "\\(1)" msgstr "" -#: library/datetime.rst:1145 +#: library/datetime.rst:1255 msgid "``datetime2 = datetime1 - timedelta``" msgstr "" -#: library/datetime.rst:2389 +#: library/datetime.rst:2523 msgid "\\(2)" msgstr "" -#: library/datetime.rst:1147 +#: library/datetime.rst:1257 msgid "``timedelta = datetime1 - datetime2``" msgstr "" @@ -1435,63 +1780,60 @@ msgstr "" msgid "``datetime1 >= datetime2``" msgstr "" -#: library/datetime.rst:1159 +#: library/datetime.rst:1269 msgid "" -"datetime2 is a duration of timedelta removed from datetime1, moving forward " -"in time if ``timedelta.days`` > 0, or backward if ``timedelta.days`` < 0. " -"The result has the same :attr:`~.datetime.tzinfo` attribute as the input " -"datetime, and datetime2 - datetime1 == timedelta after. :exc:`OverflowError` " -"is raised if datetime2.year would be smaller than :const:`MINYEAR` or larger " -"than :const:`MAXYEAR`. Note that no time zone adjustments are done even if " -"the input is an aware object." +"``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " +"moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta." +"days < 0``. The result has the same :attr:`~.datetime.tzinfo` attribute as " +"the input datetime, and ``datetime2 - datetime1 == timedelta`` after. :exc:" +"`OverflowError` is raised if ``datetime2.year`` would be smaller than :const:" +"`MINYEAR` or larger than :const:`MAXYEAR`. Note that no time zone " +"adjustments are done even if the input is an aware object." msgstr "" -#: library/datetime.rst:1168 +#: library/datetime.rst:1278 msgid "" -"Computes the datetime2 such that datetime2 + timedelta == datetime1. As for " -"addition, the result has the same :attr:`~.datetime.tzinfo` attribute as the " -"input datetime, and no time zone adjustments are done even if the input is " -"aware." +"Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. " +"As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute " +"as the input datetime, and no time zone adjustments are done even if the " +"input is aware." msgstr "" -#: library/datetime.rst:1173 +#: library/datetime.rst:1283 msgid "" "Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined " "only if both operands are naive, or if both are aware. If one is aware and " "the other is naive, :exc:`TypeError` is raised." msgstr "" -#: library/datetime.rst:1177 +#: library/datetime.rst:1287 msgid "" "If both are naive, or both are aware and have the same :attr:`~.datetime." "tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " -"the result is a :class:`timedelta` object *t* such that ``datetime2 + t == " +"the result is a :class:`timedelta` object ``t`` such that ``datetime2 + t == " "datetime1``. No time zone adjustments are done in this case." msgstr "" -#: library/datetime.rst:1182 +#: library/datetime.rst:1292 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " -"``a-b`` acts as if *a* and *b* were first converted to naive UTC datetimes. " -"The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b." +"``a-b`` acts as if ``a`` and ``b`` were first converted to naive UTC " +"datetimes. The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b." "replace(tzinfo=None) - b.utcoffset())`` except that the implementation never " "overflows." msgstr "" -#: library/datetime.rst:1188 +#: library/datetime.rst:1298 msgid "" ":class:`.datetime` objects are equal if they represent the same date and " "time, taking into account the time zone." msgstr "" -#: library/datetime.rst:1191 -msgid "" -"Naive and aware :class:`!datetime` objects are never equal. :class:`!" -"datetime` objects are never equal to :class:`date` objects that are not " -"also :class:`!datetime` instances, even if they represent the same date." +#: library/datetime.rst:1301 +msgid "Naive and aware :class:`!datetime` objects are never equal." msgstr "" -#: library/datetime.rst:1196 +#: library/datetime.rst:1303 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1502,20 +1844,19 @@ msgid "" "interval are never equal to :class:`!datetime` instances in other time zone." msgstr "" -#: library/datetime.rst:1206 +#: library/datetime.rst:1313 msgid "" "*datetime1* is considered less than *datetime2* when *datetime1* precedes " "*datetime2* in time, taking into account the time zone." msgstr "" -#: library/datetime.rst:1209 +#: library/datetime.rst:1316 msgid "" -"Order comparison between naive and aware :class:`.datetime` objects, as well " -"as a :class:`!datetime` object and a :class:`!date` object that is not also " -"a :class:`!datetime` instance, raises :exc:`TypeError`." +"Order comparison between naive and aware :class:`.datetime` objects raises :" +"exc:`TypeError`." msgstr "" -#: library/datetime.rst:1213 +#: library/datetime.rst:1319 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1525,155 +1866,180 @@ msgid "" "implementation never overflows." msgstr "" -#: library/datetime.rst:1220 +#: library/datetime.rst:1326 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -#: library/datetime.rst:1228 +#: library/datetime.rst:1342 msgid "Return :class:`date` object with same year, month and day." msgstr "" -#: library/datetime.rst:1233 +#: library/datetime.rst:1347 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond and " "fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" -#: library/datetime.rst:1245 +#: library/datetime.rst:1359 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -#: library/datetime.rst:1242 +#: library/datetime.rst:1356 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -#: library/datetime.rst:1253 +#: library/datetime.rst:1367 msgid "" -"Return a datetime with the same attributes, except for those attributes " -"given new values by whichever keyword arguments are specified. Note that " -"``tzinfo=None`` can be specified to create a naive datetime from an aware " -"datetime with no conversion of date and time data." +"Return a new :class:`datetime` object with the same attributes, but with " +"specified parameters updated. Note that ``tzinfo=None`` can be specified to " +"create a naive datetime from an aware datetime with no conversion of date " +"and time data." msgstr "" -#: library/datetime.rst:1264 +#: library/datetime.rst:1372 +msgid "" +":class:`.datetime` objects are also supported by generic function :func:" +"`copy.replace`." +msgstr "" + +#: library/datetime.rst:1381 msgid "" "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " "adjusting the date and time data so the result is the same UTC time as " "*self*, but in *tz*'s local time." msgstr "" -#: library/datetime.rst:1268 +#: library/datetime.rst:1385 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " -"*self* is naive, it is presumed to represent time in the system timezone." +"*self* is naive, it is presumed to represent time in the system time zone." msgstr "" -#: library/datetime.rst:1272 +#: library/datetime.rst:1389 msgid "" -"If called without arguments (or with ``tz=None``) the system local timezone " -"is assumed for the target timezone. The ``.tzinfo`` attribute of the " +"If called without arguments (or with ``tz=None``) the system local time zone " +"is assumed for the target time zone. The ``.tzinfo`` attribute of the " "converted datetime instance will be set to an instance of :class:`timezone` " "with the zone name and offset obtained from the OS." msgstr "" -#: library/datetime.rst:1277 +#: library/datetime.rst:1394 msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " -"in the timezone *tz*, representing the same UTC time as *self*: after " +"in the time zone *tz*, representing the same UTC time as *self*: after " "``astz = dt.astimezone(tz)``, ``astz - astz.utcoffset()`` will have the same " "date and time data as ``dt - dt.utcoffset()``." msgstr "" -#: library/datetime.rst:1283 +#: library/datetime.rst:1400 msgid "" -"If you merely want to attach a time zone object *tz* to a datetime *dt* " -"without adjustment of date and time data, use ``dt.replace(tzinfo=tz)``. If " -"you merely want to remove the time zone object from an aware datetime *dt* " -"without conversion of date and time data, use ``dt.replace(tzinfo=None)``." +"If you merely want to attach a :class:`timezone` object *tz* to a datetime " +"*dt* without adjustment of date and time data, use ``dt." +"replace(tzinfo=tz)``. If you merely want to remove the :class:`!timezone` " +"object from an aware datetime *dt* without conversion of date and time data, " +"use ``dt.replace(tzinfo=None)``." msgstr "" -#: library/datetime.rst:1288 +#: library/datetime.rst:1405 msgid "" "Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" "class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " "Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" -#: library/datetime.rst:1300 +#: library/datetime.rst:1409 +msgid "" +"def astimezone(self, tz):\n" +" if self.tzinfo is tz:\n" +" return self\n" +" # Convert self to UTC, and attach the new timezone object.\n" +" utc = (self - self.utcoffset()).replace(tzinfo=tz)\n" +" # Convert from UTC to tz's local time.\n" +" return tz.fromutc(utc)" +msgstr "" + +#: library/datetime.rst:1417 msgid "*tz* now can be omitted." msgstr "" -#: library/datetime.rst:1303 +#: library/datetime.rst:1420 msgid "" "The :meth:`astimezone` method can now be called on naive instances that are " "presumed to represent system local time." msgstr "" -#: library/datetime.rst:1310 +#: library/datetime.rst:1427 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(self)``, and raises an exception if the latter doesn't return " "``None`` or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: library/datetime.rst:1906 library/datetime.rst:2258 -#: library/datetime.rst:2582 +#: library/datetime.rst:2042 library/datetime.rst:2394 +#: library/datetime.rst:2716 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -#: library/datetime.rst:1320 +#: library/datetime.rst:1437 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "dst(self)``, and raises an exception if the latter doesn't return ``None`` " "or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: library/datetime.rst:1916 library/datetime.rst:2067 +#: library/datetime.rst:2052 library/datetime.rst:2203 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -#: library/datetime.rst:1330 +#: library/datetime.rst:1447 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "tzname(self)``, raises an exception if the latter doesn't return ``None`` or " "a string object," msgstr "" -#: library/datetime.rst:1345 +#: library/datetime.rst:1458 +msgid "" +"time.struct_time((d.year, d.month, d.day,\n" +" d.hour, d.minute, d.second,\n" +" d.weekday(), yday, dst))" +msgstr "" + +#: library/datetime.rst:1462 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " -"day number within the current year starting with ``1`` for January 1st. The :" +"day number within the current year starting with 1 for January 1st. The :" "attr:`~time.struct_time.tm_isdst` flag of the result is set according to " "the :meth:`dst` method: :attr:`.tzinfo` is ``None`` or :meth:`dst` returns " "``None``, :attr:`!tm_isdst` is set to ``-1``; else if :meth:`dst` returns a " -"non-zero value, :attr:`!tm_isdst` is set to ``1``; else :attr:`!tm_isdst` is " -"set to ``0``." +"non-zero value, :attr:`!tm_isdst` is set to 1; else :attr:`!tm_isdst` is set " +"to 0." msgstr "" -#: library/datetime.rst:1356 +#: library/datetime.rst:1473 msgid "" -"If :class:`.datetime` instance *d* is naive, this is the same as ``d." +"If :class:`.datetime` instance ``d`` is naive, this is the same as ``d." "timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 " "regardless of what ``d.dst()`` returns. DST is never in effect for a UTC " "time." msgstr "" -#: library/datetime.rst:1360 +#: library/datetime.rst:1477 msgid "" -"If *d* is aware, *d* is normalized to UTC time, by subtracting ``d." +"If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting ``d." "utcoffset()``, and a :class:`time.struct_time` for the normalized time is " "returned. :attr:`!tm_isdst` is forced to 0. Note that an :exc:" -"`OverflowError` may be raised if *d*.year was ``MINYEAR`` or ``MAXYEAR`` and " -"UTC adjustment spills over a year boundary." +"`OverflowError` may be raised if ``d.year`` was ``MINYEAR`` or ``MAXYEAR`` " +"and UTC adjustment spills over a year boundary." msgstr "" -#: library/datetime.rst:1369 +#: library/datetime.rst:1486 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1683,20 +2049,20 @@ msgid "" "meth:`.datetime.timetuple`." msgstr "" -#: library/datetime.rst:1378 +#: library/datetime.rst:1495 msgid "" "Return the proleptic Gregorian ordinal of the date. The same as ``self." "date().toordinal()``." msgstr "" -#: library/datetime.rst:1383 +#: library/datetime.rst:1500 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " "return value is a :class:`float` similar to that returned by :func:`time." "time`." msgstr "" -#: library/datetime.rst:1387 +#: library/datetime.rst:1504 msgid "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " @@ -1706,164 +2072,216 @@ msgid "" "future." msgstr "" -#: library/datetime.rst:1394 +#: library/datetime.rst:1511 msgid "" "For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" -#: library/datetime.rst:1401 +#: library/datetime.rst:1514 +msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" +msgstr "" + +#: library/datetime.rst:1518 msgid "" "The :meth:`timestamp` method uses the :attr:`.fold` attribute to " "disambiguate the times during a repeated interval." msgstr "" -#: library/datetime.rst:1407 +#: library/datetime.rst:1524 msgid "" "There is no method to obtain the POSIX timestamp directly from a naive :" "class:`.datetime` instance representing UTC time. If your application uses " -"this convention and your system timezone is not set to UTC, you can obtain " +"this convention and your system time zone is not set to UTC, you can obtain " "the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" -#: library/datetime.rst:1415 +#: library/datetime.rst:1530 +msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" +msgstr "" + +#: library/datetime.rst:1532 msgid "or by calculating the timestamp directly::" msgstr "" -#: library/datetime.rst:1421 +#: library/datetime.rst:1534 +msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" +msgstr "" + +#: library/datetime.rst:1538 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -#: library/datetime.rst:1427 +#: library/datetime.rst:1544 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" "`isocalendar`." msgstr "" -#: library/datetime.rst:1434 +#: library/datetime.rst:1551 msgid "" "Return a :term:`named tuple` with three components: ``year``, ``week`` and " "``weekday``. The same as ``self.date().isocalendar()``." msgstr "" -#: library/datetime.rst:1440 +#: library/datetime.rst:1557 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" -#: library/datetime.rst:1442 +#: library/datetime.rst:1559 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: library/datetime.rst:1443 +#: library/datetime.rst:1560 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: library/datetime.rst:1445 +#: library/datetime.rst:1562 msgid "" "If :meth:`utcoffset` does not return ``None``, a string is appended, giving " "the UTC offset:" msgstr "" -#: library/datetime.rst:1448 +#: library/datetime.rst:1565 msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" msgstr "" -#: library/datetime.rst:1450 +#: library/datetime.rst:1567 msgid "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" -#: library/datetime.rst:1460 +#: library/datetime.rst:1571 +msgid "" +">>> from datetime import datetime, timezone\n" +">>> datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()\n" +"'2019-05-18T15:17:08.132263'\n" +">>> datetime(2019, 5, 18, 15, 17, tzinfo=timezone.utc).isoformat()\n" +"'2019-05-18T15:17:00+00:00'" +msgstr "" + +#: library/datetime.rst:1577 msgid "" "The optional argument *sep* (default ``'T'``) is a one-character separator, " "placed between the date and time portions of the result. For example::" msgstr "" -#: library/datetime.rst:1846 +#: library/datetime.rst:1580 +msgid "" +">>> from datetime import tzinfo, timedelta, datetime\n" +">>> class TZ(tzinfo):\n" +"... \"\"\"A time zone with an arbitrary, constant -06:39 offset.\"\"\"\n" +"... def utcoffset(self, dt):\n" +"... return timedelta(hours=-6, minutes=-39)\n" +"...\n" +">>> datetime(2002, 12, 25, tzinfo=TZ()).isoformat(' ')\n" +"'2002-12-25 00:00:00-06:39'\n" +">>> datetime(2009, 11, 27, microsecond=100, tzinfo=TZ()).isoformat()\n" +"'2009-11-27T00:00:00.000100-06:39'" +msgstr "" + +#: library/datetime.rst:1982 msgid "" "The optional argument *timespec* specifies the number of additional " "components of the time to include (the default is ``'auto'``). It can be one " "of the following:" msgstr "" -#: library/datetime.rst:1850 +#: library/datetime.rst:1986 msgid "" "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " "``'microseconds'`` otherwise." msgstr "" -#: library/datetime.rst:1852 +#: library/datetime.rst:1988 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -#: library/datetime.rst:1853 +#: library/datetime.rst:1989 msgid "" "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -#: library/datetime.rst:1854 +#: library/datetime.rst:1990 msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -#: library/datetime.rst:1856 +#: library/datetime.rst:1992 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -#: library/datetime.rst:1858 +#: library/datetime.rst:1994 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -#: library/datetime.rst:1862 +#: library/datetime.rst:1998 msgid "Excluded time components are truncated, not rounded." msgstr "" -#: library/datetime.rst:1492 +#: library/datetime.rst:1609 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" -#: library/datetime.rst:1877 +#: library/datetime.rst:1612 +msgid "" +">>> from datetime import datetime\n" +">>> datetime.now().isoformat(timespec='minutes')\n" +"'2002-12-25T00:00'\n" +">>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)\n" +">>> dt.isoformat(timespec='microseconds')\n" +"'2015-01-01T12:30:59.000000'" +msgstr "" + +#: library/datetime.rst:2013 msgid "Added the *timespec* parameter." msgstr "" -#: library/datetime.rst:1508 +#: library/datetime.rst:1625 msgid "" -"For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to ``d." +"For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to ``d." "isoformat(' ')``." msgstr "" -#: library/datetime.rst:1514 +#: library/datetime.rst:1631 msgid "Return a string representing the date and time::" msgstr "" -#: library/datetime.rst:1520 +#: library/datetime.rst:1633 +msgid "" +">>> from datetime import datetime\n" +">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" +"'Wed Dec 4 20:30:40 2002'" +msgstr "" + +#: library/datetime.rst:1637 msgid "" "The output string will *not* include time zone information, regardless of " "whether the input is aware or naive." msgstr "" -#: library/datetime.rst:1527 +#: library/datetime.rst:1644 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " "to the C standard." msgstr "" -#: library/datetime.rst:1534 +#: library/datetime.rst:1651 msgid "" "Return a string representing the date and time, controlled by an explicit " "format string. See also :ref:`strftime-strptime-behavior` and :meth:" "`datetime.isoformat`." msgstr "" -#: library/datetime.rst:1541 +#: library/datetime.rst:1658 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " @@ -1871,82 +2289,207 @@ msgid "" "`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" -#: library/datetime.rst:1548 +#: library/datetime.rst:1665 msgid "Examples of Usage: :class:`.datetime`" msgstr "" -#: library/datetime.rst:1550 +#: library/datetime.rst:1667 msgid "Examples of working with :class:`.datetime` objects:" msgstr "" -#: library/datetime.rst:1603 +#: library/datetime.rst:1669 +msgid "" +">>> from datetime import datetime, date, time, timezone\n" +"\n" +">>> # Using datetime.combine()\n" +">>> d = date(2005, 7, 14)\n" +">>> t = time(12, 30)\n" +">>> datetime.combine(d, t)\n" +"datetime.datetime(2005, 7, 14, 12, 30)\n" +"\n" +">>> # Using datetime.now()\n" +">>> datetime.now()\n" +"datetime.datetime(2007, 12, 6, 16, 29, 43, 79043) # GMT +1\n" +">>> datetime.now(timezone.utc)\n" +"datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone." +"utc)\n" +"\n" +">>> # Using datetime.strptime()\n" +">>> dt = datetime.strptime(\"21/11/06 16:30\", \"%d/%m/%y %H:%M\")\n" +">>> dt\n" +"datetime.datetime(2006, 11, 21, 16, 30)\n" +"\n" +">>> # Using datetime.timetuple() to get tuple of all attributes\n" +">>> tt = dt.timetuple()\n" +">>> for it in tt:\n" +"... print(it)\n" +"...\n" +"2006 # year\n" +"11 # month\n" +"21 # day\n" +"16 # hour\n" +"30 # minute\n" +"0 # second\n" +"1 # weekday (0 = Monday)\n" +"325 # number of days since 1st January\n" +"-1 # dst - method tzinfo.dst() returned None\n" +"\n" +">>> # Date in ISO format\n" +">>> ic = dt.isocalendar()\n" +">>> for it in ic:\n" +"... print(it)\n" +"...\n" +"2006 # ISO year\n" +"47 # ISO week\n" +"2 # ISO weekday\n" +"\n" +">>> # Formatting a datetime\n" +">>> dt.strftime(\"%A, %d. %B %Y %I:%M%p\")\n" +"'Tuesday, 21. November 2006 04:30PM'\n" +">>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.'." +"format(dt, \"day\", \"month\", \"time\")\n" +"'The day is 21, the month is November, the time is 04:30PM.'" +msgstr "" + +#: library/datetime.rst:1720 msgid "" "The example below defines a :class:`tzinfo` subclass capturing time zone " "information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " "+4:30 UTC thereafter::" msgstr "" -#: library/datetime.rst:1650 +#: library/datetime.rst:1724 +msgid "" +"from datetime import timedelta, datetime, tzinfo, timezone\n" +"\n" +"class KabulTz(tzinfo):\n" +" # Kabul used +4 until 1945, when they moved to +4:30\n" +" UTC_MOVE_DATE = datetime(1944, 12, 31, 20, tzinfo=timezone.utc)\n" +"\n" +" def utcoffset(self, dt):\n" +" if dt.year < 1945:\n" +" return timedelta(hours=4)\n" +" elif (1945, 1, 1, 0, 0) <= dt.timetuple()[:5] < (1945, 1, 1, 0, " +"30):\n" +" # An ambiguous (\"imaginary\") half-hour range representing\n" +" # a 'fold' in time due to the shift from +4 to +4:30.\n" +" # If dt falls in the imaginary range, use fold to decide how\n" +" # to resolve. See PEP495.\n" +" return timedelta(hours=4, minutes=(30 if dt.fold else 0))\n" +" else:\n" +" return timedelta(hours=4, minutes=30)\n" +"\n" +" def fromutc(self, dt):\n" +" # Follow same validations as in datetime.tzinfo\n" +" if not isinstance(dt, datetime):\n" +" raise TypeError(\"fromutc() requires a datetime argument\")\n" +" if dt.tzinfo is not self:\n" +" raise ValueError(\"dt.tzinfo is not self\")\n" +"\n" +" # A custom implementation is required for fromutc as\n" +" # the input to this function is a datetime with utc values\n" +" # but with a tzinfo set to self.\n" +" # See datetime.astimezone or fromtimestamp.\n" +" if dt.replace(tzinfo=timezone.utc) >= self.UTC_MOVE_DATE:\n" +" return dt + timedelta(hours=4, minutes=30)\n" +" else:\n" +" return dt + timedelta(hours=4)\n" +"\n" +" def dst(self, dt):\n" +" # Kabul does not observe daylight saving time.\n" +" return timedelta(0)\n" +"\n" +" def tzname(self, dt):\n" +" if dt >= self.UTC_MOVE_DATE:\n" +" return \"+04:30\"\n" +" return \"+04\"" +msgstr "" + +#: library/datetime.rst:1767 msgid "Usage of ``KabulTz`` from above::" msgstr "" -#: library/datetime.rst:1676 +#: library/datetime.rst:1769 +msgid "" +">>> tz1 = KabulTz()\n" +"\n" +">>> # Datetime before the change\n" +">>> dt1 = datetime(1900, 11, 21, 16, 30, tzinfo=tz1)\n" +">>> print(dt1.utcoffset())\n" +"4:00:00\n" +"\n" +">>> # Datetime after the change\n" +">>> dt2 = datetime(2006, 6, 14, 13, 0, tzinfo=tz1)\n" +">>> print(dt2.utcoffset())\n" +"4:30:00\n" +"\n" +">>> # Convert datetime to another time zone\n" +">>> dt3 = dt2.astimezone(timezone.utc)\n" +">>> dt3\n" +"datetime.datetime(2006, 6, 14, 8, 30, tzinfo=datetime.timezone.utc)\n" +">>> dt2\n" +"datetime.datetime(2006, 6, 14, 13, 0, tzinfo=KabulTz())\n" +">>> dt2 == dt3\n" +"True" +msgstr "" + +#: library/datetime.rst:1793 msgid ":class:`.time` Objects" msgstr "" -#: library/datetime.rst:1678 +#: library/datetime.rst:1795 msgid "" "A :class:`.time` object represents a (local) time of day, independent of any " "particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -#: library/datetime.rst:1683 +#: library/datetime.rst:1800 msgid "" "All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" "class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" -#: library/datetime.rst:1693 +#: library/datetime.rst:1810 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised. " -"All default to ``0`` except *tzinfo*, which defaults to :const:`None`." +"All default to 0 except *tzinfo*, which defaults to ``None``." msgstr "" -#: library/datetime.rst:1701 +#: library/datetime.rst:1818 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" -#: library/datetime.rst:1706 +#: library/datetime.rst:1823 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -#: library/datetime.rst:1711 +#: library/datetime.rst:1828 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " "``timedelta(microseconds=1)``, although note that arithmetic on :class:`." "time` objects is not supported." msgstr "" -#: library/datetime.rst:1740 +#: library/datetime.rst:1857 msgid "" "The object passed as the tzinfo argument to the :class:`.time` constructor, " "or ``None`` if none was passed." msgstr "" -#: library/datetime.rst:1754 +#: library/datetime.rst:1871 msgid "" -":class:`.time` objects support equality and order comparisons, where *a* is " -"considered less than *b* when *a* precedes *b* in time." +":class:`.time` objects support equality and order comparisons, where ``a`` " +"is considered less than ``b`` when ``a`` precedes ``b`` in time." msgstr "" -#: library/datetime.rst:1757 +#: library/datetime.rst:1874 msgid "" "Naive and aware :class:`!time` objects are never equal. Order comparison " "between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" -#: library/datetime.rst:1761 +#: library/datetime.rst:1878 msgid "" "If both comparands are aware, and have the same :attr:`~.time.tzinfo` " "attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and " @@ -1955,18 +2498,18 @@ msgid "" "subtracting their UTC offsets (obtained from ``self.utcoffset()``)." msgstr "" -#: library/datetime.rst:1767 +#: library/datetime.rst:1884 msgid "" "Equality comparisons between aware and naive :class:`.time` instances don't " "raise :exc:`TypeError`." msgstr "" -#: library/datetime.rst:1771 +#: library/datetime.rst:1888 msgid "" "In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -#: library/datetime.rst:1773 +#: library/datetime.rst:1890 msgid "" "Before Python 3.5, a :class:`.time` object was considered to be false if it " "represented midnight in UTC. This behavior was considered obscure and error-" @@ -1974,86 +2517,151 @@ msgid "" "details." msgstr "" -#: library/datetime.rst:1780 -msgid "Other constructor:" +#: library/datetime.rst:1897 +msgid "Other constructors:" msgstr "" -#: library/datetime.rst:1784 +#: library/datetime.rst:1901 msgid "" "Return a :class:`.time` corresponding to a *time_string* in any valid ISO " "8601 format, with the following exceptions:" msgstr "" -#: library/datetime.rst:1788 +#: library/datetime.rst:1905 msgid "" "The leading ``T``, normally required in cases where there may be ambiguity " "between a date and a time, is not required." msgstr "" -#: library/datetime.rst:1790 +#: library/datetime.rst:1907 msgid "" "Fractional seconds may have any number of digits (anything beyond 6 will be " "truncated)." msgstr "" -#: library/datetime.rst:1794 +#: library/datetime.rst:1911 msgid "Examples:" msgstr "" -#: library/datetime.rst:1818 +#: library/datetime.rst:1913 +msgid "" +">>> from datetime import time\n" +">>> time.fromisoformat('04:23:01')\n" +"datetime.time(4, 23, 1)\n" +">>> time.fromisoformat('T04:23:01')\n" +"datetime.time(4, 23, 1)\n" +">>> time.fromisoformat('T042301')\n" +"datetime.time(4, 23, 1)\n" +">>> time.fromisoformat('04:23:01.000384')\n" +"datetime.time(4, 23, 1, 384)\n" +">>> time.fromisoformat('04:23:01,000384')\n" +"datetime.time(4, 23, 1, 384)\n" +">>> time.fromisoformat('04:23:01+04:00')\n" +"datetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime." +"timedelta(seconds=14400)))\n" +">>> time.fromisoformat('04:23:01Z')\n" +"datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)\n" +">>> time.fromisoformat('04:23:01+00:00')\n" +"datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" +msgstr "" + +#: library/datetime.rst:1935 msgid "" "Previously, this method only supported formats that could be emitted by :" -"meth:`time.isoformat()`." +"meth:`time.isoformat`." msgstr "" -#: library/datetime.rst:1828 +#: library/datetime.rst:1941 +msgid "" +"Return a :class:`.time` corresponding to *date_string*, parsed according to " +"*format*." +msgstr "" + +#: library/datetime.rst:1944 +msgid "" +"If *format* does not contain microseconds or timezone information, this is " +"equivalent to::" +msgstr "" + +#: library/datetime.rst:1946 +msgid "time(*(time.strptime(date_string, format)[3:6]))" +msgstr "" + +#: library/datetime.rst:1948 +msgid "" +":exc:`ValueError` is raised if the *date_string* and *format* cannot be " +"parsed by :func:`time.strptime` or if it returns a value which is not a time " +"tuple. See also :ref:`strftime-strptime-behavior` and :meth:`time." +"fromisoformat`." +msgstr "" + +#: library/datetime.rst:1961 +msgid "" +"Return a new :class:`.time` with the same values, but with specified " +"parameters updated. Note that ``tzinfo=None`` can be specified to create a " +"naive :class:`.time` from an aware :class:`.time`, without conversion of the " +"time data." +msgstr "" + +#: library/datetime.rst:1966 msgid "" -"Return a :class:`.time` with the same value, except for those attributes " -"given new values by whichever keyword arguments are specified. Note that " -"``tzinfo=None`` can be specified to create a naive :class:`.time` from an " -"aware :class:`.time`, without conversion of the time data." +":class:`.time` objects are also supported by generic function :func:`copy." +"replace`." msgstr "" -#: library/datetime.rst:1839 +#: library/datetime.rst:1975 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" -#: library/datetime.rst:1841 +#: library/datetime.rst:1977 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: library/datetime.rst:1842 +#: library/datetime.rst:1978 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: library/datetime.rst:1843 +#: library/datetime.rst:1979 msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -#: library/datetime.rst:1844 +#: library/datetime.rst:1980 msgid "" "``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" "`utcoffset` does not return ``None``" msgstr "" -#: library/datetime.rst:1864 +#: library/datetime.rst:2000 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" -#: library/datetime.rst:1883 -msgid "For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``." +#: library/datetime.rst:2004 +msgid "" +">>> from datetime import time\n" +">>> time(hour=12, minute=34, second=56, microsecond=123456)." +"isoformat(timespec='minutes')\n" +"'12:34'\n" +">>> dt = time(hour=12, minute=34, second=56, microsecond=0)\n" +">>> dt.isoformat(timespec='microseconds')\n" +"'12:34:56.000000'\n" +">>> dt.isoformat(timespec='auto')\n" +"'12:34:56'" msgstr "" -#: library/datetime.rst:1888 +#: library/datetime.rst:2019 +msgid "For a time ``t``, ``str(t)`` is equivalent to ``t.isoformat()``." +msgstr "" + +#: library/datetime.rst:2024 msgid "" "Return a string representing the time, controlled by an explicit format " "string. See also :ref:`strftime-strptime-behavior` and :meth:`time." "isoformat`." msgstr "" -#: library/datetime.rst:1894 +#: library/datetime.rst:2030 msgid "" "Same as :meth:`.time.strftime`. This makes it possible to specify a format " "string for a :class:`.time` object in :ref:`formatted string literals >> from datetime import time, tzinfo, timedelta\n" +">>> class TZ1(tzinfo):\n" +"... def utcoffset(self, dt):\n" +"... return timedelta(hours=1)\n" +"... def dst(self, dt):\n" +"... return timedelta(0)\n" +"... def tzname(self,dt):\n" +"... return \"+01:00\"\n" +"... def __repr__(self):\n" +"... return f\"{self.__class__.__name__}()\"\n" +"...\n" +">>> t = time(12, 10, 30, tzinfo=TZ1())\n" +">>> t\n" +"datetime.time(12, 10, 30, tzinfo=TZ1())\n" +">>> t.isoformat()\n" +"'12:10:30+01:00'\n" +">>> t.dst()\n" +"datetime.timedelta(0)\n" +">>> t.tzname()\n" +"'+01:00'\n" +">>> t.strftime(\"%H:%M:%S %Z\")\n" +"'12:10:30 +01:00'\n" +">>> 'The {} is {:%H:%M}.'.format(\"time\", t)\n" +"'The time is 12:10.'" +msgstr "" + +#: library/datetime.rst:2095 msgid ":class:`tzinfo` Objects" msgstr "" -#: library/datetime.rst:1963 +#: library/datetime.rst:2099 msgid "" "This is an abstract base class, meaning that this class should not be " "instantiated directly. Define a subclass of :class:`tzinfo` to capture " "information about a particular time zone." msgstr "" -#: library/datetime.rst:1967 +#: library/datetime.rst:2103 msgid "" "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " "constructors for :class:`.datetime` and :class:`.time` objects. The latter " @@ -2111,17 +2747,17 @@ msgid "" "object passed to them." msgstr "" -#: library/datetime.rst:1973 +#: library/datetime.rst:2109 msgid "" "You need to derive a concrete subclass, and (at least) supply " "implementations of the standard :class:`tzinfo` methods needed by the :class:" "`.datetime` methods you use. The :mod:`!datetime` module provides :class:" "`timezone`, a simple concrete subclass of :class:`tzinfo` which can " -"represent timezones with fixed offset from UTC such as UTC itself or North " +"represent time zones with fixed offset from UTC such as UTC itself or North " "American EST and EDT." msgstr "" -#: library/datetime.rst:1980 +#: library/datetime.rst:2116 msgid "" "Special requirement for pickling: A :class:`tzinfo` subclass must have an :" "meth:`~object.__init__` method that can be called with no arguments, " @@ -2129,20 +2765,20 @@ msgid "" "technical requirement that may be relaxed in the future." msgstr "" -#: library/datetime.rst:1986 +#: library/datetime.rst:2122 msgid "" "A concrete subclass of :class:`tzinfo` may need to implement the following " "methods. Exactly which methods are needed depends on the uses made of aware :" "mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" -#: library/datetime.rst:1993 +#: library/datetime.rst:2129 msgid "" "Return offset of local time from UTC, as a :class:`timedelta` object that is " "positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -#: library/datetime.rst:1996 +#: library/datetime.rst:2132 msgid "" "This represents the *total* offset from UTC; for example, if a :class:" "`tzinfo` object represents both time zone and DST adjustments, :meth:" @@ -2153,25 +2789,31 @@ msgid "" "meth:`utcoffset` will probably look like one of these two::" msgstr "" -#: library/datetime.rst:2007 +#: library/datetime.rst:2140 +msgid "" +"return CONSTANT # fixed-offset class\n" +"return CONSTANT + self.dst(dt) # daylight-aware class" +msgstr "" + +#: library/datetime.rst:2143 msgid "" "If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return " "``None`` either." msgstr "" -#: library/datetime.rst:2010 +#: library/datetime.rst:2146 msgid "" "The default implementation of :meth:`utcoffset` raises :exc:" "`NotImplementedError`." msgstr "" -#: library/datetime.rst:2019 +#: library/datetime.rst:2155 msgid "" "Return the daylight saving time (DST) adjustment, as a :class:`timedelta` " "object or ``None`` if DST information isn't known." msgstr "" -#: library/datetime.rst:2023 +#: library/datetime.rst:2159 msgid "" "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " "the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " @@ -2184,20 +2826,20 @@ msgid "" "to account for DST changes when crossing time zones." msgstr "" -#: library/datetime.rst:2033 +#: library/datetime.rst:2169 msgid "" "An instance *tz* of a :class:`tzinfo` subclass that models both standard and " "daylight times must be consistent in this sense:" msgstr "" -#: library/datetime.rst:2036 +#: library/datetime.rst:2172 msgid "``tz.utcoffset(dt) - tz.dst(dt)``" msgstr "" -#: library/datetime.rst:2038 +#: library/datetime.rst:2174 msgid "" "must return the same result for every :class:`.datetime` *dt* with ``dt." -"tzinfo == tz`` For sane :class:`tzinfo` subclasses, this expression yields " +"tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression yields " "the time zone's \"standard offset\", which should not depend on the date or " "the time, but only on geographic location. The implementation of :meth:" "`datetime.astimezone` relies on this, but cannot detect violations; it's the " @@ -2207,41 +2849,62 @@ msgid "" "astimezone` regardless." msgstr "" -#: library/datetime.rst:2047 +#: library/datetime.rst:2183 msgid "" "Most implementations of :meth:`dst` will probably look like one of these " "two::" msgstr "" -#: library/datetime.rst:2053 +#: library/datetime.rst:2185 +msgid "" +"def dst(self, dt):\n" +" # a fixed-offset class: doesn't account for DST\n" +" return timedelta(0)" +msgstr "" + +#: library/datetime.rst:2189 msgid "or::" msgstr "" -#: library/datetime.rst:2065 +#: library/datetime.rst:2191 +msgid "" +"def dst(self, dt):\n" +" # Code to set dston and dstoff to the time zone's DST\n" +" # transition times based on the input dt.year, and expressed\n" +" # in standard local time.\n" +"\n" +" if dston <= dt.replace(tzinfo=None) < dstoff:\n" +" return timedelta(hours=1)\n" +" else:\n" +" return timedelta(0)" +msgstr "" + +#: library/datetime.rst:2201 msgid "" "The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." msgstr "" -#: library/datetime.rst:2073 +#: library/datetime.rst:2209 msgid "" "Return the time zone name corresponding to the :class:`.datetime` object " "*dt*, as a string. Nothing about string names is defined by the :mod:`!" "datetime` module, and there's no requirement that it mean anything in " -"particular. For example, \"GMT\", \"UTC\", \"-500\", \"-5:00\", \"EDT\", " -"\"US/Eastern\", \"America/New York\" are all valid replies. Return ``None`` " -"if a string name isn't known. Note that this is a method rather than a fixed " -"string primarily because some :class:`tzinfo` subclasses will wish to return " -"different names depending on the specific value of *dt* passed, especially " -"if the :class:`tzinfo` class is accounting for daylight time." +"particular. For example, ``\"GMT\"``, ``\"UTC\"``, ``\"-500\"``, " +"``\"-5:00\"``, ``\"EDT\"``, ``\"US/Eastern\"``, ``\"America/New York\"`` are " +"all valid replies. Return ``None`` if a string name isn't known. Note that " +"this is a method rather than a fixed string primarily because some :class:" +"`tzinfo` subclasses will wish to return different names depending on the " +"specific value of *dt* passed, especially if the :class:`tzinfo` class is " +"accounting for daylight time." msgstr "" -#: library/datetime.rst:2083 +#: library/datetime.rst:2219 msgid "" "The default implementation of :meth:`tzname` raises :exc:" "`NotImplementedError`." msgstr "" -#: library/datetime.rst:2086 +#: library/datetime.rst:2222 msgid "" "These methods are called by a :class:`.datetime` or :class:`.time` object, " "in response to their methods of the same names. A :class:`.datetime` object " @@ -2251,7 +2914,7 @@ msgid "" "datetime`." msgstr "" -#: library/datetime.rst:2092 +#: library/datetime.rst:2228 msgid "" "When ``None`` is passed, it's up to the class designer to decide the best " "response. For example, returning ``None`` is appropriate if the class wishes " @@ -2260,32 +2923,32 @@ msgid "" "offset, as there is no other convention for discovering the standard offset." msgstr "" -#: library/datetime.rst:2098 +#: library/datetime.rst:2234 msgid "" "When a :class:`.datetime` object is passed in response to a :class:`." "datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" "`tzinfo` methods can rely on this, unless user code calls :class:`tzinfo` " "methods directly. The intent is that the :class:`tzinfo` methods interpret " -"*dt* as being in local time, and not need worry about objects in other " -"timezones." +"*dt* as being in local time, and not need worry about objects in other time " +"zones." msgstr "" -#: library/datetime.rst:2104 +#: library/datetime.rst:2240 msgid "" "There is one more :class:`tzinfo` method that a subclass may wish to " "override:" msgstr "" -#: library/datetime.rst:2109 +#: library/datetime.rst:2245 msgid "" -"This is called from the default :class:`datetime.astimezone()` " -"implementation. When called from that, ``dt.tzinfo`` is *self*, and *dt*'s " -"date and time data are to be viewed as expressing a UTC time. The purpose " -"of :meth:`fromutc` is to adjust the date and time data, returning an " -"equivalent datetime in *self*'s local time." +"This is called from the default :meth:`datetime.astimezone` implementation. " +"When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " +"data are to be viewed as expressing a UTC time. The purpose of :meth:" +"`fromutc` is to adjust the date and time data, returning an equivalent " +"datetime in *self*'s local time." msgstr "" -#: library/datetime.rst:2115 +#: library/datetime.rst:2251 msgid "" "Most :class:`tzinfo` subclasses should be able to inherit the default :meth:" "`fromutc` implementation without problems. It's strong enough to handle " @@ -2300,19 +2963,217 @@ msgid "" "offset changes." msgstr "" -#: library/datetime.rst:2126 +#: library/datetime.rst:2262 msgid "" "Skipping code for error cases, the default :meth:`fromutc` implementation " "acts like::" msgstr "" -#: library/datetime.rst:2144 +#: library/datetime.rst:2265 +msgid "" +"def fromutc(self, dt):\n" +" # raise ValueError error if dt.tzinfo is not self\n" +" dtoff = dt.utcoffset()\n" +" dtdst = dt.dst()\n" +" # raise ValueError if dtoff is None or dtdst is None\n" +" delta = dtoff - dtdst # this is self's standard offset\n" +" if delta:\n" +" dt += delta # convert to standard local time\n" +" dtdst = dt.dst()\n" +" # raise ValueError if dtdst is None\n" +" if dtdst:\n" +" return dt + dtdst\n" +" else:\n" +" return dt" +msgstr "" + +#: library/datetime.rst:2280 msgid "" "In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples." "py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" -#: library/datetime.rst:2150 +#: library/datetime.rst:2284 +msgid "" +"from datetime import tzinfo, timedelta, datetime\n" +"\n" +"ZERO = timedelta(0)\n" +"HOUR = timedelta(hours=1)\n" +"SECOND = timedelta(seconds=1)\n" +"\n" +"# A class capturing the platform's idea of local time.\n" +"# (May result in wrong values on historical times in\n" +"# timezones where UTC offset and/or the DST rules had\n" +"# changed in the past.)\n" +"import time as _time\n" +"\n" +"STDOFFSET = timedelta(seconds = -_time.timezone)\n" +"if _time.daylight:\n" +" DSTOFFSET = timedelta(seconds = -_time.altzone)\n" +"else:\n" +" DSTOFFSET = STDOFFSET\n" +"\n" +"DSTDIFF = DSTOFFSET - STDOFFSET\n" +"\n" +"class LocalTimezone(tzinfo):\n" +"\n" +" def fromutc(self, dt):\n" +" assert dt.tzinfo is self\n" +" stamp = (dt - datetime(1970, 1, 1, tzinfo=self)) // SECOND\n" +" args = _time.localtime(stamp)[:6]\n" +" dst_diff = DSTDIFF // SECOND\n" +" # Detect fold\n" +" fold = (args == _time.localtime(stamp - dst_diff))\n" +" return datetime(*args, microsecond=dt.microsecond,\n" +" tzinfo=self, fold=fold)\n" +"\n" +" def utcoffset(self, dt):\n" +" if self._isdst(dt):\n" +" return DSTOFFSET\n" +" else:\n" +" return STDOFFSET\n" +"\n" +" def dst(self, dt):\n" +" if self._isdst(dt):\n" +" return DSTDIFF\n" +" else:\n" +" return ZERO\n" +"\n" +" def tzname(self, dt):\n" +" return _time.tzname[self._isdst(dt)]\n" +"\n" +" def _isdst(self, dt):\n" +" tt = (dt.year, dt.month, dt.day,\n" +" dt.hour, dt.minute, dt.second,\n" +" dt.weekday(), 0, 0)\n" +" stamp = _time.mktime(tt)\n" +" tt = _time.localtime(stamp)\n" +" return tt.tm_isdst > 0\n" +"\n" +"Local = LocalTimezone()\n" +"\n" +"\n" +"# A complete implementation of current DST rules for major US time zones.\n" +"\n" +"def first_sunday_on_or_after(dt):\n" +" days_to_go = 6 - dt.weekday()\n" +" if days_to_go:\n" +" dt += timedelta(days_to_go)\n" +" return dt\n" +"\n" +"\n" +"# US DST Rules\n" +"#\n" +"# This is a simplified (i.e., wrong for a few cases) set of rules for US\n" +"# DST start and end times. For a complete and up-to-date set of DST rules\n" +"# and timezone definitions, visit the Olson Database (or try pytz):\n" +"# http://www.twinsun.com/tz/tz-link.htm\n" +"# https://sourceforge.net/projects/pytz/ (might not be up-to-date)\n" +"#\n" +"# In the US, since 2007, DST starts at 2am (standard time) on the second\n" +"# Sunday in March, which is the first Sunday on or after Mar 8.\n" +"DSTSTART_2007 = datetime(1, 3, 8, 2)\n" +"# and ends at 2am (DST time) on the first Sunday of Nov.\n" +"DSTEND_2007 = datetime(1, 11, 1, 2)\n" +"# From 1987 to 2006, DST used to start at 2am (standard time) on the first\n" +"# Sunday in April and to end at 2am (DST time) on the last\n" +"# Sunday of October, which is the first Sunday on or after Oct 25.\n" +"DSTSTART_1987_2006 = datetime(1, 4, 1, 2)\n" +"DSTEND_1987_2006 = datetime(1, 10, 25, 2)\n" +"# From 1967 to 1986, DST used to start at 2am (standard time) on the last\n" +"# Sunday in April (the one on or after April 24) and to end at 2am (DST " +"time)\n" +"# on the last Sunday of October, which is the first Sunday\n" +"# on or after Oct 25.\n" +"DSTSTART_1967_1986 = datetime(1, 4, 24, 2)\n" +"DSTEND_1967_1986 = DSTEND_1987_2006\n" +"\n" +"def us_dst_range(year):\n" +" # Find start and end times for US DST. For years before 1967, return\n" +" # start = end for no DST.\n" +" if 2006 < year:\n" +" dststart, dstend = DSTSTART_2007, DSTEND_2007\n" +" elif 1986 < year < 2007:\n" +" dststart, dstend = DSTSTART_1987_2006, DSTEND_1987_2006\n" +" elif 1966 < year < 1987:\n" +" dststart, dstend = DSTSTART_1967_1986, DSTEND_1967_1986\n" +" else:\n" +" return (datetime(year, 1, 1), ) * 2\n" +"\n" +" start = first_sunday_on_or_after(dststart.replace(year=year))\n" +" end = first_sunday_on_or_after(dstend.replace(year=year))\n" +" return start, end\n" +"\n" +"\n" +"class USTimeZone(tzinfo):\n" +"\n" +" def __init__(self, hours, reprname, stdname, dstname):\n" +" self.stdoffset = timedelta(hours=hours)\n" +" self.reprname = reprname\n" +" self.stdname = stdname\n" +" self.dstname = dstname\n" +"\n" +" def __repr__(self):\n" +" return self.reprname\n" +"\n" +" def tzname(self, dt):\n" +" if self.dst(dt):\n" +" return self.dstname\n" +" else:\n" +" return self.stdname\n" +"\n" +" def utcoffset(self, dt):\n" +" return self.stdoffset + self.dst(dt)\n" +"\n" +" def dst(self, dt):\n" +" if dt is None or dt.tzinfo is None:\n" +" # An exception may be sensible here, in one or both cases.\n" +" # It depends on how you want to treat them. The default\n" +" # fromutc() implementation (called by the default astimezone()\n" +" # implementation) passes a datetime with dt.tzinfo is self.\n" +" return ZERO\n" +" assert dt.tzinfo is self\n" +" start, end = us_dst_range(dt.year)\n" +" # Can't compare naive to aware objects, so strip the timezone from\n" +" # dt first.\n" +" dt = dt.replace(tzinfo=None)\n" +" if start + HOUR <= dt < end - HOUR:\n" +" # DST is in effect.\n" +" return HOUR\n" +" if end - HOUR <= dt < end:\n" +" # Fold (an ambiguous hour): use dt.fold to disambiguate.\n" +" return ZERO if dt.fold else HOUR\n" +" if start <= dt < start + HOUR:\n" +" # Gap (a non-existent hour): reverse the fold rule.\n" +" return HOUR if dt.fold else ZERO\n" +" # DST is off.\n" +" return ZERO\n" +"\n" +" def fromutc(self, dt):\n" +" assert dt.tzinfo is self\n" +" start, end = us_dst_range(dt.year)\n" +" start = start.replace(tzinfo=self)\n" +" end = end.replace(tzinfo=self)\n" +" std_time = dt + self.stdoffset\n" +" dst_time = std_time + HOUR\n" +" if end <= dst_time < end + HOUR:\n" +" # Repeated hour\n" +" return std_time.replace(fold=1)\n" +" if std_time < start or dst_time >= end:\n" +" # Standard time\n" +" return std_time\n" +" if start <= std_time < end - HOUR:\n" +" # Daylight saving time\n" +" return dst_time\n" +"\n" +"\n" +"Eastern = USTimeZone(-5, \"Eastern\", \"EST\", \"EDT\")\n" +"Central = USTimeZone(-6, \"Central\", \"CST\", \"CDT\")\n" +"Mountain = USTimeZone(-7, \"Mountain\", \"MST\", \"MDT\")\n" +"Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" +msgstr "" + +#: library/datetime.rst:2286 msgid "" "Note that there are unavoidable subtleties twice per year in a :class:" "`tzinfo` subclass accounting for both standard and daylight time, at the DST " @@ -2321,7 +3182,18 @@ msgid "" "ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" -#: library/datetime.rst:2164 +#: library/datetime.rst:2292 +msgid "" +" UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" +" EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" +" EDT 23:MM 0:MM 1:MM 2:MM 3:MM 4:MM\n" +"\n" +"start 22:MM 23:MM 0:MM 1:MM 3:MM 4:MM\n" +"\n" +" end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" +msgstr "" + +#: library/datetime.rst:2300 msgid "" "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " "to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " @@ -2330,7 +3202,23 @@ msgid "" "get::" msgstr "" -#: library/datetime.rst:2183 +#: library/datetime.rst:2305 +msgid "" +">>> from datetime import datetime, timezone\n" +">>> from tzinfo_examples import HOUR, Eastern\n" +">>> u0 = datetime(2016, 3, 13, 5, tzinfo=timezone.utc)\n" +">>> for i in range(4):\n" +"... u = u0 + i*HOUR\n" +"... t = u.astimezone(Eastern)\n" +"... print(u.time(), 'UTC =', t.time(), t.tzname())\n" +"...\n" +"05:00:00 UTC = 00:00:00 EST\n" +"06:00:00 UTC = 01:00:00 EST\n" +"07:00:00 UTC = 03:00:00 EDT\n" +"08:00:00 UTC = 04:00:00 EDT" +msgstr "" + +#: library/datetime.rst:2319 msgid "" "When DST ends (the \"end\" line), there's a potentially worse problem: " "there's an hour that can't be spelled unambiguously in local wall time: the " @@ -2345,13 +3233,27 @@ msgid "" "Fall back transition of 2016, we get::" msgstr "" -#: library/datetime.rst:2205 +#: library/datetime.rst:2330 +msgid "" +">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" +">>> for i in range(4):\n" +"... u = u0 + i*HOUR\n" +"... t = u.astimezone(Eastern)\n" +"... print(u.time(), 'UTC =', t.time(), t.tzname(), t.fold)\n" +"...\n" +"04:00:00 UTC = 00:00:00 EDT 0\n" +"05:00:00 UTC = 01:00:00 EDT 0\n" +"06:00:00 UTC = 01:00:00 EST 1\n" +"07:00:00 UTC = 02:00:00 EST 0" +msgstr "" + +#: library/datetime.rst:2341 msgid "" "Note that the :class:`.datetime` instances that differ only by the value of " "the :attr:`~.datetime.fold` attribute are considered equal in comparisons." msgstr "" -#: library/datetime.rst:2208 +#: library/datetime.rst:2344 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " "the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :" @@ -2361,28 +3263,28 @@ msgid "" "offset -4 hours))." msgstr "" -#: library/datetime.rst:2222 +#: library/datetime.rst:2352 msgid ":mod:`zoneinfo`" msgstr "" -#: library/datetime.rst:2217 +#: library/datetime.rst:2353 msgid "" "The :mod:`!datetime` module has a basic :class:`timezone` class (for " "handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " -"attribute (a UTC timezone instance)." +"attribute (a UTC :class:`!timezone` instance)." msgstr "" -#: library/datetime.rst:2221 +#: library/datetime.rst:2357 msgid "" -"``zoneinfo`` brings the *IANA timezone database* (also known as the Olson " +"``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" -#: library/datetime.rst:2228 -msgid "`IANA timezone database `_" +#: library/datetime.rst:2360 +msgid "`IANA time zone database `_" msgstr "" -#: library/datetime.rst:2225 +#: library/datetime.rst:2361 msgid "" "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " "and data that represent the history of local time for many representative " @@ -2391,24 +3293,24 @@ msgid "" "saving rules." msgstr "" -#: library/datetime.rst:2235 +#: library/datetime.rst:2371 msgid ":class:`timezone` Objects" msgstr "" -#: library/datetime.rst:2237 +#: library/datetime.rst:2373 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " -"of which represents a timezone defined by a fixed offset from UTC." +"of which represents a time zone defined by a fixed offset from UTC." msgstr "" -#: library/datetime.rst:2241 +#: library/datetime.rst:2377 msgid "" -"Objects of this class cannot be used to represent timezone information in " +"Objects of this class cannot be used to represent time zone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" -#: library/datetime.rst:2248 +#: library/datetime.rst:2384 msgid "" "The *offset* argument must be specified as a :class:`timedelta` object " "representing the difference between the local time and UTC. It must be " @@ -2416,25 +3318,25 @@ msgid "" "otherwise :exc:`ValueError` is raised." msgstr "" -#: library/datetime.rst:2253 +#: library/datetime.rst:2389 msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -#: library/datetime.rst:2275 +#: library/datetime.rst:2411 msgid "" "Return the fixed value specified when the :class:`timezone` instance is " "constructed." msgstr "" -#: library/datetime.rst:2267 +#: library/datetime.rst:2403 msgid "" "The *dt* argument is ignored. The return value is a :class:`timedelta` " "instance equal to the difference between the local time and UTC." msgstr "" -#: library/datetime.rst:2278 +#: library/datetime.rst:2414 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -2443,145 +3345,141 @@ msgid "" "are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -#: library/datetime.rst:2284 +#: library/datetime.rst:2420 msgid "" "Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not " "``'UTC+00:00'``." msgstr "" -#: library/datetime.rst:2291 +#: library/datetime.rst:2427 msgid "Always returns ``None``." msgstr "" -#: library/datetime.rst:2295 +#: library/datetime.rst:2431 msgid "" "Return ``dt + offset``. The *dt* argument must be an aware :class:`." "datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" -#: library/datetime.rst:2302 -msgid "The UTC timezone, ``timezone(timedelta(0))``." +#: library/datetime.rst:2438 +msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "" -#: library/datetime.rst:2311 +#: library/datetime.rst:2447 msgid ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Behavior" msgstr "" -#: library/datetime.rst:2313 +#: library/datetime.rst:2449 msgid "" ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " "``strftime(format)`` method, to create a string representing the time under " "the control of an explicit format string." msgstr "" -#: library/datetime.rst:2317 +#: library/datetime.rst:2453 msgid "" -"Conversely, the :meth:`datetime.strptime` class method creates a :class:`." -"datetime` object from a string representing a date and time and a " -"corresponding format string." +"Conversely, the :meth:`date.strptime`, :meth:`datetime.strptime` and :meth:" +"`time.strptime` class methods create an object from a string representing " +"the time and a corresponding format string." msgstr "" -#: library/datetime.rst:2321 +#: library/datetime.rst:2457 msgid "" "The table below provides a high-level comparison of :meth:`~.datetime." "strftime` versus :meth:`~.datetime.strptime`:" msgstr "" -#: library/datetime.rst:2325 +#: library/datetime.rst:2461 msgid "``strftime``" msgstr "" -#: library/datetime.rst:2325 +#: library/datetime.rst:2461 msgid "``strptime``" msgstr "" -#: library/datetime.rst:2327 +#: library/datetime.rst:2463 msgid "Usage" msgstr "" -#: library/datetime.rst:2327 +#: library/datetime.rst:2463 msgid "Convert object to a string according to a given format" msgstr "" -#: library/datetime.rst:2327 -msgid "" -"Parse a string into a :class:`.datetime` object given a corresponding format" +#: library/datetime.rst:2463 +msgid "Parse a string into an object given a corresponding format" msgstr "" -#: library/datetime.rst:2329 +#: library/datetime.rst:2465 msgid "Type of method" msgstr "" -#: library/datetime.rst:2329 +#: library/datetime.rst:2465 msgid "Instance method" msgstr "" -#: library/datetime.rst:2329 +#: library/datetime.rst:2465 msgid "Class method" msgstr "" -#: library/datetime.rst:2331 -msgid "Method of" -msgstr "" - -#: library/datetime.rst:2331 -msgid ":class:`date`; :class:`.datetime`; :class:`.time`" -msgstr "" - -#: library/datetime.rst:2331 -msgid ":class:`.datetime`" -msgstr "" - -#: library/datetime.rst:2333 +#: library/datetime.rst:2467 msgid "Signature" msgstr "" -#: library/datetime.rst:2333 +#: library/datetime.rst:2467 msgid "``strftime(format)``" msgstr "" -#: library/datetime.rst:2333 +#: library/datetime.rst:2467 msgid "``strptime(date_string, format)``" msgstr "" -#: library/datetime.rst:2340 +#: library/datetime.rst:2474 msgid "" ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Format Codes" msgstr "" -#: library/datetime.rst:2342 +#: library/datetime.rst:2476 msgid "" "These methods accept format codes that can be used to parse and format " "dates::" msgstr "" -#: library/datetime.rst:2350 +#: library/datetime.rst:2478 +msgid "" +">>> datetime.strptime('31/01/22 23:59:59.999999',\n" +"... '%d/%m/%y %H:%M:%S.%f')\n" +"datetime.datetime(2022, 1, 31, 23, 59, 59, 999999)\n" +">>> _.strftime('%a %d %b %Y, %I:%M%p')\n" +"'Mon 31 Jan 2022, 11:59PM'" +msgstr "" + +#: library/datetime.rst:2484 msgid "" "The following is a list of all the format codes that the 1989 C standard " "requires, and these work on all platforms with a standard C implementation." msgstr "" -#: library/datetime.rst:2457 +#: library/datetime.rst:2591 msgid "Directive" msgstr "" -#: library/datetime.rst:2457 +#: library/datetime.rst:2591 msgid "Meaning" msgstr "" -#: library/datetime.rst:2457 +#: library/datetime.rst:2591 msgid "Example" msgstr "" -#: library/datetime.rst:2457 +#: library/datetime.rst:2591 msgid "Notes" msgstr "" -#: library/datetime.rst:2356 +#: library/datetime.rst:2490 msgid "``%a``" msgstr "" -#: library/datetime.rst:2356 +#: library/datetime.rst:2490 msgid "Weekday as locale's abbreviated name." msgstr "" @@ -2593,11 +3491,11 @@ msgstr "" msgid "So, Mo, ..., Sa (de_DE)" msgstr "" -#: library/datetime.rst:2361 +#: library/datetime.rst:2495 msgid "``%A``" msgstr "" -#: library/datetime.rst:2361 +#: library/datetime.rst:2495 msgid "Weekday as locale's full name." msgstr "" @@ -2609,40 +3507,40 @@ msgstr "" msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" -#: library/datetime.rst:2366 +#: library/datetime.rst:2500 msgid "``%w``" msgstr "" -#: library/datetime.rst:2366 +#: library/datetime.rst:2500 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" -#: library/datetime.rst:2366 +#: library/datetime.rst:2500 msgid "0, 1, ..., 6" msgstr "" -#: library/datetime.rst:2370 +#: library/datetime.rst:2504 msgid "``%d``" msgstr "" -#: library/datetime.rst:2370 +#: library/datetime.rst:2504 msgid "Day of the month as a zero-padded decimal number." msgstr "" -#: library/datetime.rst:2370 +#: library/datetime.rst:2504 msgid "01, 02, ..., 31" msgstr "" -#: library/datetime.rst:2383 library/datetime.rst:2392 -#: library/datetime.rst:2401 library/datetime.rst:2419 +#: library/datetime.rst:2517 library/datetime.rst:2526 +#: library/datetime.rst:2535 library/datetime.rst:2553 msgid "\\(9)" msgstr "" -#: library/datetime.rst:2373 +#: library/datetime.rst:2507 msgid "``%b``" msgstr "" -#: library/datetime.rst:2373 +#: library/datetime.rst:2507 msgid "Month as locale's abbreviated name." msgstr "" @@ -2654,11 +3552,11 @@ msgstr "" msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" -#: library/datetime.rst:2378 +#: library/datetime.rst:2512 msgid "``%B``" msgstr "" -#: library/datetime.rst:2378 +#: library/datetime.rst:2512 msgid "Month as locale's full name." msgstr "" @@ -2670,67 +3568,67 @@ msgstr "" msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" -#: library/datetime.rst:2383 +#: library/datetime.rst:2517 msgid "``%m``" msgstr "" -#: library/datetime.rst:2383 +#: library/datetime.rst:2517 msgid "Month as a zero-padded decimal number." msgstr "" -#: library/datetime.rst:2395 +#: library/datetime.rst:2529 msgid "01, 02, ..., 12" msgstr "" -#: library/datetime.rst:2386 +#: library/datetime.rst:2520 msgid "``%y``" msgstr "" -#: library/datetime.rst:2386 +#: library/datetime.rst:2520 msgid "Year without century as a zero-padded decimal number." msgstr "" -#: library/datetime.rst:2386 +#: library/datetime.rst:2520 msgid "00, 01, ..., 99" msgstr "" -#: library/datetime.rst:2389 +#: library/datetime.rst:2523 msgid "``%Y``" msgstr "" -#: library/datetime.rst:2389 +#: library/datetime.rst:2523 msgid "Year with century as a decimal number." msgstr "" -#: library/datetime.rst:2459 +#: library/datetime.rst:2593 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "" -#: library/datetime.rst:2392 +#: library/datetime.rst:2526 msgid "``%H``" msgstr "" -#: library/datetime.rst:2392 +#: library/datetime.rst:2526 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" -#: library/datetime.rst:2392 +#: library/datetime.rst:2526 msgid "00, 01, ..., 23" msgstr "" -#: library/datetime.rst:2395 +#: library/datetime.rst:2529 msgid "``%I``" msgstr "" -#: library/datetime.rst:2395 +#: library/datetime.rst:2529 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" -#: library/datetime.rst:2398 +#: library/datetime.rst:2532 msgid "``%p``" msgstr "" -#: library/datetime.rst:2398 +#: library/datetime.rst:2532 msgid "Locale's equivalent of either AM or PM." msgstr "" @@ -2742,127 +3640,127 @@ msgstr "" msgid "am, pm (de_DE)" msgstr "" -#: library/datetime.rst:2398 +#: library/datetime.rst:2532 msgid "\\(1), \\(3)" msgstr "" -#: library/datetime.rst:2401 +#: library/datetime.rst:2535 msgid "``%M``" msgstr "" -#: library/datetime.rst:2401 +#: library/datetime.rst:2535 msgid "Minute as a zero-padded decimal number." msgstr "" -#: library/datetime.rst:2404 +#: library/datetime.rst:2538 msgid "00, 01, ..., 59" msgstr "" -#: library/datetime.rst:2404 +#: library/datetime.rst:2538 msgid "``%S``" msgstr "" -#: library/datetime.rst:2404 +#: library/datetime.rst:2538 msgid "Second as a zero-padded decimal number." msgstr "" -#: library/datetime.rst:2404 +#: library/datetime.rst:2538 msgid "\\(4), \\(9)" msgstr "" -#: library/datetime.rst:2407 +#: library/datetime.rst:2541 msgid "``%f``" msgstr "" -#: library/datetime.rst:2407 +#: library/datetime.rst:2541 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" -#: library/datetime.rst:2407 +#: library/datetime.rst:2541 msgid "000000, 000001, ..., 999999" msgstr "" -#: library/datetime.rst:2407 +#: library/datetime.rst:2541 msgid "\\(5)" msgstr "" -#: library/datetime.rst:2580 +#: library/datetime.rst:2704 msgid "``%z``" msgstr "" -#: library/datetime.rst:2411 +#: library/datetime.rst:2545 msgid "" "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " "naive)." msgstr "" -#: library/datetime.rst:2411 +#: library/datetime.rst:2545 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" -#: library/datetime.rst:2416 library/datetime.rst:2473 +#: library/datetime.rst:2550 library/datetime.rst:2607 msgid "\\(6)" msgstr "" -#: library/datetime.rst:2608 +#: library/datetime.rst:2730 msgid "``%Z``" msgstr "" -#: library/datetime.rst:2416 +#: library/datetime.rst:2550 msgid "Time zone name (empty string if the object is naive)." msgstr "" -#: library/datetime.rst:2416 +#: library/datetime.rst:2550 msgid "(empty), UTC, GMT" msgstr "" -#: library/datetime.rst:2419 +#: library/datetime.rst:2553 msgid "``%j``" msgstr "" -#: library/datetime.rst:2419 +#: library/datetime.rst:2553 msgid "Day of the year as a zero-padded decimal number." msgstr "" -#: library/datetime.rst:2419 +#: library/datetime.rst:2553 msgid "001, 002, ..., 366" msgstr "" -#: library/datetime.rst:2422 +#: library/datetime.rst:2556 msgid "``%U``" msgstr "" -#: library/datetime.rst:2422 +#: library/datetime.rst:2556 msgid "" "Week number of the year (Sunday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: library/datetime.rst:2430 +#: library/datetime.rst:2564 msgid "00, 01, ..., 53" msgstr "" -#: library/datetime.rst:2430 +#: library/datetime.rst:2564 msgid "\\(7), \\(9)" msgstr "" -#: library/datetime.rst:2430 +#: library/datetime.rst:2564 msgid "``%W``" msgstr "" -#: library/datetime.rst:2430 +#: library/datetime.rst:2564 msgid "" "Week number of the year (Monday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: library/datetime.rst:2438 +#: library/datetime.rst:2572 msgid "``%c``" msgstr "" -#: library/datetime.rst:2438 +#: library/datetime.rst:2572 msgid "Locale's appropriate date and time representation." msgstr "" @@ -2874,11 +3772,11 @@ msgstr "" msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" -#: library/datetime.rst:2443 +#: library/datetime.rst:2577 msgid "``%x``" msgstr "" -#: library/datetime.rst:2443 +#: library/datetime.rst:2577 msgid "Locale's appropriate date representation." msgstr "" @@ -2894,11 +3792,11 @@ msgstr "" msgid "16.08.1988 (de_DE)" msgstr "" -#: library/datetime.rst:2447 +#: library/datetime.rst:2581 msgid "``%X``" msgstr "" -#: library/datetime.rst:2447 +#: library/datetime.rst:2581 msgid "Locale's appropriate time representation." msgstr "" @@ -2910,83 +3808,83 @@ msgstr "" msgid "21:30:00 (de_DE)" msgstr "" -#: library/datetime.rst:2450 +#: library/datetime.rst:2584 msgid "``%%``" msgstr "" -#: library/datetime.rst:2450 +#: library/datetime.rst:2584 msgid "A literal ``'%'`` character." msgstr "" -#: library/datetime.rst:2450 +#: library/datetime.rst:2584 msgid "%" msgstr "" -#: library/datetime.rst:2453 +#: library/datetime.rst:2587 msgid "" "Several additional directives not required by the C89 standard are included " "for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" -#: library/datetime.rst:2459 +#: library/datetime.rst:2593 msgid "``%G``" msgstr "" -#: library/datetime.rst:2459 +#: library/datetime.rst:2593 msgid "" "ISO 8601 year with century representing the year that contains the greater " "part of the ISO week (``%V``)." msgstr "" -#: library/datetime.rst:2459 +#: library/datetime.rst:2593 msgid "\\(8)" msgstr "" -#: library/datetime.rst:2464 +#: library/datetime.rst:2598 msgid "``%u``" msgstr "" -#: library/datetime.rst:2464 +#: library/datetime.rst:2598 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" -#: library/datetime.rst:2464 +#: library/datetime.rst:2598 msgid "1, 2, ..., 7" msgstr "" -#: library/datetime.rst:2467 +#: library/datetime.rst:2601 msgid "``%V``" msgstr "" -#: library/datetime.rst:2467 +#: library/datetime.rst:2601 msgid "" "ISO 8601 week as a decimal number with Monday as the first day of the week. " "Week 01 is the week containing Jan 4." msgstr "" -#: library/datetime.rst:2467 +#: library/datetime.rst:2601 msgid "01, 02, ..., 53" msgstr "" -#: library/datetime.rst:2467 +#: library/datetime.rst:2601 msgid "\\(8), \\(9)" msgstr "" -#: library/datetime.rst:2594 +#: library/datetime.rst:2726 msgid "``%:z``" msgstr "" -#: library/datetime.rst:2473 +#: library/datetime.rst:2607 msgid "" "UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object " "is naive)." msgstr "" -#: library/datetime.rst:2473 +#: library/datetime.rst:2607 msgid "(empty), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" msgstr "" -#: library/datetime.rst:2479 +#: library/datetime.rst:2613 msgid "" "These may not be available on all platforms when used with the :meth:`~." "datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives " @@ -2995,7 +3893,7 @@ msgid "" "directives will raise a :exc:`ValueError`." msgstr "" -#: library/datetime.rst:2484 +#: library/datetime.rst:2618 msgid "" "The full set of format codes supported varies across platforms, because " "Python calls the platform C library's :c:func:`strftime` function, and " @@ -3005,59 +3903,58 @@ msgid "" "unsupported format specifiers." msgstr "" -#: library/datetime.rst:2490 +#: library/datetime.rst:2624 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "" -#: library/datetime.rst:2493 +#: library/datetime.rst:2627 msgid "``%:z`` was added." msgstr "" -#: library/datetime.rst:2497 +#: library/datetime.rst:2631 msgid "Technical Detail" msgstr "" -#: library/datetime.rst:2499 +#: library/datetime.rst:2633 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " "``time.strftime(fmt, d.timetuple())`` although not all objects support a :" "meth:`~date.timetuple` method." msgstr "" -#: library/datetime.rst:2503 +#: library/datetime.rst:2637 msgid "" "For the :meth:`.datetime.strptime` class method, the default value is " "``1900-01-01T00:00:00.000``: any components not specified in the format " "string will be pulled from the default value. [#]_" msgstr "" -#: library/datetime.rst:2507 +#: library/datetime.rst:2641 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -#: library/datetime.rst:2511 +#: library/datetime.rst:2645 msgid "" -"except when the format includes sub-second components or timezone offset " +"except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -#: library/datetime.rst:2515 +#: library/datetime.rst:2649 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`!time` objects have no such values. If they're used " -"anyway, ``1900`` is substituted for the year, and ``1`` for the month and " -"day." +"anyway, 1900 is substituted for the year, and 1 for the month and day." msgstr "" -#: library/datetime.rst:2519 +#: library/datetime.rst:2653 msgid "" "For :class:`date` objects, the format codes for hours, minutes, seconds, and " "microseconds should not be used, as :class:`date` objects have no such " -"values. If they're used anyway, ``0`` is substituted for them." +"values. If they're used anyway, 0 is substituted for them." msgstr "" -#: library/datetime.rst:2523 +#: library/datetime.rst:2657 msgid "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " @@ -3066,7 +3963,7 @@ msgid "" "`UnicodeError` or return an empty string instead." msgstr "" -#: library/datetime.rst:2532 +#: library/datetime.rst:2666 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " @@ -3074,38 +3971,38 @@ msgid "" "contain non-ASCII characters." msgstr "" -#: library/datetime.rst:2538 +#: library/datetime.rst:2672 msgid "" "The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] " "range, but years < 1000 must be zero-filled to 4-digit width." msgstr "" -#: library/datetime.rst:2541 +#: library/datetime.rst:2675 msgid "" "In previous versions, :meth:`~.datetime.strftime` method was restricted to " "years >= 1900." msgstr "" -#: library/datetime.rst:2545 +#: library/datetime.rst:2679 msgid "" "In version 3.2, :meth:`~.datetime.strftime` method was restricted to years " ">= 1000." msgstr "" -#: library/datetime.rst:2550 +#: library/datetime.rst:2684 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " "only affects the output hour field if the ``%I`` directive is used to parse " "the hour." msgstr "" -#: library/datetime.rst:2554 +#: library/datetime.rst:2688 msgid "" "Unlike the :mod:`time` module, the :mod:`!datetime` module does not support " "leap seconds." msgstr "" -#: library/datetime.rst:2558 +#: library/datetime.rst:2692 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive " "accepts from one to six digits and zero pads on the right. ``%f`` is an " @@ -3113,17 +4010,17 @@ msgid "" "separately in datetime objects, and therefore always available)." msgstr "" -#: library/datetime.rst:2565 +#: library/datetime.rst:2699 msgid "" "For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced " "by empty strings." msgstr "" -#: library/datetime.rst:2568 +#: library/datetime.rst:2702 msgid "For an aware object:" msgstr "" -#: library/datetime.rst:2571 +#: library/datetime.rst:2705 msgid "" ":meth:`~.datetime.utcoffset` is transformed into a string of the form " "``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number " @@ -3137,7 +4034,7 @@ msgid "" "replaced with the string ``'-0330'``." msgstr "" -#: library/datetime.rst:2585 +#: library/datetime.rst:2719 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, the UTC offsets can have a colon as a separator between hours, " @@ -3146,53 +4043,53 @@ msgid "" "``'+00:00'``." msgstr "" -#: library/datetime.rst:2593 +#: library/datetime.rst:2727 msgid "" "Behaves exactly as ``%z``, but has a colon separator added between hours, " "minutes and seconds." msgstr "" -#: library/datetime.rst:2597 +#: library/datetime.rst:2731 msgid "" "In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :" "meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by " "the returned value, which must be a string." msgstr "" -#: library/datetime.rst:2601 +#: library/datetime.rst:2735 msgid ":meth:`~.datetime.strptime` only accepts certain values for ``%Z``:" msgstr "" -#: library/datetime.rst:2603 +#: library/datetime.rst:2737 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" -#: library/datetime.rst:2604 +#: library/datetime.rst:2738 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -#: library/datetime.rst:2606 +#: library/datetime.rst:2740 msgid "" "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " "values, but probably not ``EST``. It will raise ``ValueError`` for invalid " "values." msgstr "" -#: library/datetime.rst:2610 +#: library/datetime.rst:2744 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` " "of the result will be set to a :class:`timezone` instance." msgstr "" -#: library/datetime.rst:2616 +#: library/datetime.rst:2750 msgid "" "When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are " "only used in calculations when the day of the week and the calendar year " "(``%Y``) are specified." msgstr "" -#: library/datetime.rst:2621 +#: library/datetime.rst:2755 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " "day of the week and the ISO year (``%G``) are specified in a :meth:`~." @@ -3200,7 +4097,7 @@ msgid "" "interchangeable." msgstr "" -#: library/datetime.rst:2627 +#: library/datetime.rst:2761 msgid "" "When used with the :meth:`~.datetime.strptime` method, the leading zero is " "optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, " @@ -3208,15 +4105,40 @@ msgid "" "zero." msgstr "" -#: library/datetime.rst:2632 +#: library/datetime.rst:2766 +msgid "" +"When parsing a month and day using :meth:`~.datetime.strptime`, always " +"include a year in the format. If the value you need to parse lacks a year, " +"append an explicit dummy leap year. Otherwise your code will raise an " +"exception when it encounters leap day because the default year used by the " +"parser is not a leap year. Users run into this bug every four years..." +msgstr "" + +#: library/datetime.rst:2772 +msgid "" +">>> month_day = \"02/29\"\n" +">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap year " +"bug.\n" +"datetime.datetime(1984, 2, 29, 0, 0)" +msgstr "" + +#: library/datetime.rst:2778 +msgid "" +":meth:`~.datetime.strptime` calls using a format string containing a day of " +"month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later " +"we may change this into an error or change the default year to a leap year. " +"See :gh:`70647`." +msgstr "" + +#: library/datetime.rst:2785 msgid "Footnotes" msgstr "" -#: library/datetime.rst:2633 +#: library/datetime.rst:2786 msgid "If, that is, we ignore the effects of Relativity" msgstr "" -#: library/datetime.rst:2635 +#: library/datetime.rst:2788 msgid "" "This matches the definition of the \"proleptic Gregorian\" calendar in " "Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " @@ -3225,23 +4147,23 @@ msgid "" "systems." msgstr "" -#: library/datetime.rst:2641 +#: library/datetime.rst:2794 msgid "" "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " "`_ for a good explanation." msgstr "" -#: library/datetime.rst:2645 +#: library/datetime.rst:2798 msgid "" -"Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since ``1900`` is " -"not a leap year." +"Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since 1900 is not " +"a leap year." msgstr "" -#: library/datetime.rst:2305 +#: library/datetime.rst:2441 msgid "% (percent)" msgstr "" -#: library/datetime.rst:2305 +#: library/datetime.rst:2441 msgid "datetime format" msgstr "" diff --git a/library/dbm.po b/library/dbm.po index 7583e714..b88708cb 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/dbm.rst:2 -msgid ":mod:`dbm` --- Interfaces to Unix \"databases\"" +msgid ":mod:`!dbm` --- Interfaces to Unix \"databases\"" msgstr "" #: library/dbm.rst:7 @@ -25,52 +26,66 @@ msgid "**Source code:** :source:`Lib/dbm/__init__.py`" msgstr "" #: library/dbm.rst:11 +msgid ":mod:`dbm` is a generic interface to variants of the DBM database:" +msgstr "" + +#: library/dbm.rst:13 +msgid ":mod:`dbm.sqlite3`" +msgstr "" + +#: library/dbm.rst:14 +msgid ":mod:`dbm.gnu`" +msgstr "" + +#: library/dbm.rst:15 +msgid ":mod:`dbm.ndbm`" +msgstr "" + +#: library/dbm.rst:17 msgid "" -":mod:`dbm` is a generic interface to variants of the DBM database --- :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`. If none of these modules is installed, the " -"slow-but-simple implementation in module :mod:`dbm.dumb` will be used. " -"There is a `third party interface `_ to the Oracle Berkeley DB." +"If none of these modules are installed, the slow-but-simple implementation " +"in module :mod:`dbm.dumb` will be used. There is a `third party interface " +"`_ to the Oracle Berkeley DB." msgstr "" -#: library/dbm.rst:20 +#: library/dbm.rst:24 msgid "" "A tuple containing the exceptions that can be raised by each of the " "supported modules, with a unique exception also named :exc:`dbm.error` as " "the first item --- the latter is used when :exc:`dbm.error` is raised." msgstr "" -#: library/dbm.rst:27 +#: library/dbm.rst:31 msgid "" "This function attempts to guess which of the several simple database modules " -"available --- :mod:`dbm.gnu`, :mod:`dbm.ndbm` or :mod:`dbm.dumb` --- should " -"be used to open a given file." +"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:" +"`dbm.dumb` --- should be used to open a given file." msgstr "" -#: library/dbm.rst:31 +#: library/dbm.rst:35 msgid "Return one of the following values:" msgstr "" -#: library/dbm.rst:33 +#: library/dbm.rst:37 msgid "" "``None`` if the file can't be opened because it's unreadable or doesn't exist" msgstr "" -#: library/dbm.rst:34 +#: library/dbm.rst:38 msgid "the empty string (``''``) if the file's format can't be guessed" msgstr "" -#: library/dbm.rst:35 +#: library/dbm.rst:39 msgid "" "a string containing the required module name, such as ``'dbm.ndbm'`` or " "``'dbm.gnu'``" msgstr "" -#: library/dbm.rst:202 library/dbm.rst:386 +#: library/dbm.rst:270 library/dbm.rst:471 msgid "*filename* accepts a :term:`path-like object`." msgstr "" -#: library/dbm.rst:61 +#: library/dbm.rst:65 msgid "Open a database and return the corresponding database object." msgstr "" @@ -78,7 +93,7 @@ msgstr "" msgid "Parameters" msgstr "" -#: library/dbm.rst:63 +#: library/dbm.rst:67 msgid "" "The database file to open. If the database file already exists, the :func:" "`whichdb` function is used to determine its type and the appropriate module " @@ -86,138 +101,238 @@ msgid "" "imported is used." msgstr "" -#: library/dbm.rst:174 +#: library/dbm.rst:242 msgid "The database file to open." msgstr "" -#: library/dbm.rst:66 +#: library/dbm.rst:70 msgid "" "If the database file already exists, the :func:`whichdb` function is used to " "determine its type and the appropriate module is used; if it does not exist, " "the first submodule listed above that can be imported is used." msgstr "" -#: library/dbm.rst:297 +#: library/dbm.rst:182 library/dbm.rst:374 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" msgstr "" -#: library/dbm.rst:179 library/dbm.rst:298 +#: library/dbm.rst:184 library/dbm.rst:375 msgid "``'r'`` (default): |flag_r|" msgstr "" -#: library/dbm.rst:180 library/dbm.rst:367 +#: library/dbm.rst:185 library/dbm.rst:376 library/dbm.rst:452 msgid "``'w'``: |flag_w|" msgstr "" -#: library/dbm.rst:181 library/dbm.rst:300 +#: library/dbm.rst:186 library/dbm.rst:377 msgid "``'c'``: |flag_c|" msgstr "" -#: library/dbm.rst:182 library/dbm.rst:369 +#: library/dbm.rst:187 library/dbm.rst:378 library/dbm.rst:454 msgid "``'n'``: |flag_n|" msgstr "" -#: library/dbm.rst:196 library/dbm.rst:371 +#: library/dbm.rst:264 library/dbm.rst:456 msgid "|mode_param_doc|" msgstr "" -#: library/dbm.rst:80 +#: library/dbm.rst:84 msgid "*file* accepts a :term:`path-like object`." msgstr "" -#: library/dbm.rst:83 +#: library/dbm.rst:87 msgid "" -"The object returned by :func:`~dbm.open` supports the same basic " -"functionality as a :class:`dict`; keys and their corresponding values can be " -"stored, retrieved, and deleted, and the :keyword:`in` operator and the :meth:" -"`!keys` method are available, as well as :meth:`!get` and :meth:`!" -"setdefault` methods." +"The object returned by :func:`~dbm.open` supports the basic functionality of " +"mutable :term:`mappings `; keys and their corresponding values can " +"be stored, retrieved, and deleted, and iteration, the :keyword:`in` operator " +"and methods :meth:`!keys`, :meth:`!get`, :meth:`!setdefault` and :meth:`!" +"clear` are available. The :meth:`!keys` method returns a list instead of a " +"view object. The :meth:`!setdefault` method requires two arguments." msgstr "" -#: library/dbm.rst:88 +#: library/dbm.rst:95 msgid "" "Key and values are always stored as :class:`bytes`. This means that when " "strings are used they are implicitly converted to the default encoding " "before being stored." msgstr "" -#: library/dbm.rst:92 +#: library/dbm.rst:99 msgid "" "These objects also support being used in a :keyword:`with` statement, which " "will automatically close them when done." msgstr "" -#: library/dbm.rst:95 +#: library/dbm.rst:102 msgid "" ":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:" "`dbm` backends." msgstr "" -#: library/dbm.rst:99 +#: library/dbm.rst:106 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`~dbm.open`." msgstr "" -#: library/dbm.rst:103 +#: library/dbm.rst:110 msgid "" "Deleting a key from a read-only database raises a database module specific " "exception instead of :exc:`KeyError`." msgstr "" -#: library/dbm.rst:107 +#: library/dbm.rst:114 +msgid ":meth:`!clear` methods are now available for all :mod:`dbm` backends." +msgstr "" + +#: library/dbm.rst:118 msgid "" "The following example records some hostnames and a corresponding title, and " "then prints out the contents of the database::" msgstr "" -#: library/dbm.rst:137 +#: library/dbm.rst:121 +msgid "" +"import dbm\n" +"\n" +"# Open database, creating it if necessary.\n" +"with dbm.open('cache', 'c') as db:\n" +"\n" +" # Record some values\n" +" db[b'hello'] = b'there'\n" +" db['www.python.org'] = 'Python Website'\n" +" db['www.cnn.com'] = 'Cable News Network'\n" +"\n" +" # Note that the keys are considered bytes now.\n" +" assert db[b'www.python.org'] == b'Python Website'\n" +" # Notice how the value is now in bytes.\n" +" assert db['www.cnn.com'] == b'Cable News Network'\n" +"\n" +" # Often-used methods of the dict interface work too.\n" +" print(db.get('python.org', b'not present'))\n" +"\n" +" # Storing a non-string key or value will raise an exception (most\n" +" # likely a TypeError).\n" +" db['www.yahoo.com'] = 4\n" +"\n" +"# db is automatically closed when leaving the with statement." +msgstr "" + +#: library/dbm.rst:148 msgid "Module :mod:`shelve`" msgstr "" -#: library/dbm.rst:138 +#: library/dbm.rst:149 msgid "Persistence module which stores non-string data." msgstr "" -#: library/dbm.rst:141 +#: library/dbm.rst:152 msgid "The individual submodules are described in the following sections." msgstr "" -#: library/dbm.rst:145 +#: library/dbm.rst:155 +msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" +msgstr "" + +#: library/dbm.rst:163 +msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" +msgstr "" + +#: library/dbm.rst:167 +msgid "" +"This module uses the standard library :mod:`sqlite3` module to provide an " +"SQLite backend for the :mod:`dbm` module. The files created by :mod:`dbm." +"sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite browser, " +"including the SQLite CLI." +msgstr "" + +#: includes/wasm-mobile-notavail.rst:3 includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" + +#: includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." +msgstr "" + +#: library/dbm.rst:176 +msgid "Open an SQLite database." +msgstr "" + +#: library/dbm.rst:178 +msgid "The path to the database to be opened." +msgstr "" + +#: library/dbm.rst:189 +msgid "" +"The Unix file access mode of the file (default: octal ``0o666``), used only " +"when the database has to be created." +msgstr "" + +#: library/dbm.rst:193 +msgid "" +"The returned database object behaves similar to a mutable :term:`mapping`, " +"but the :meth:`!keys` method returns a list, and the :meth:`!setdefault` " +"method requires two arguments. It also supports a \"closing\" context " +"manager via the :keyword:`with` keyword." +msgstr "" + +#: library/dbm.rst:399 +msgid "The following method is also provided:" +msgstr "" + +#: library/dbm.rst:202 +msgid "Close the SQLite database." +msgstr "" + +#: library/dbm.rst:206 msgid ":mod:`dbm.gnu` --- GNU database manager" msgstr "" -#: library/dbm.rst:151 +#: library/dbm.rst:212 msgid "**Source code:** :source:`Lib/dbm/gnu.py`" msgstr "" -#: library/dbm.rst:155 +#: library/dbm.rst:216 msgid "" "The :mod:`dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU " "dbm)` library, similar to the :mod:`dbm.ndbm` module, but with additional " "functionality like crash tolerance." msgstr "" -#: library/dbm.rst:267 +#: library/dbm.rst:342 msgid "" "The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are " "incompatible and can not be used interchangeably." msgstr "" -#: library/dbm.rst:166 +#: includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +msgstr "" + +#: library/dbm.rst:229 msgid "" "Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: library/dbm.rst:172 +#: library/dbm.rst:235 +msgid "" +"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " +"supports." +msgstr "" + +#: library/dbm.rst:240 msgid "Open a GDBM database and return a :class:`!gdbm` object." msgstr "" -#: library/dbm.rst:178 +#: library/dbm.rst:246 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n| The following additional characters may be appended to " @@ -229,29 +344,29 @@ msgid "" "flag characters." msgstr "" -#: library/dbm.rst:184 +#: library/dbm.rst:252 msgid "" "The following additional characters may be appended to control how the " "database is opened:" msgstr "" -#: library/dbm.rst:187 +#: library/dbm.rst:255 msgid "" "``'f'``: Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" -#: library/dbm.rst:189 +#: library/dbm.rst:257 msgid "" "``'s'``: Synchronized mode. Changes to the database will be written " "immediately to the file." msgstr "" -#: library/dbm.rst:191 +#: library/dbm.rst:259 msgid "``'u'``: Do not lock database." msgstr "" -#: library/dbm.rst:193 +#: library/dbm.rst:261 msgid "" "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " "member for a list of supported flag characters." @@ -261,24 +376,36 @@ msgstr "" msgid "Raises" msgstr "" -#: library/dbm.rst:199 +#: library/dbm.rst:267 msgid "If an invalid *flag* argument is passed." msgstr "" -#: library/dbm.rst:207 +#: library/dbm.rst:273 msgid "" -"A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " -"supports." +":class:`!gdbm` objects behave similar to mutable :term:`mappings `, " +"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " +"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " +"list, and the :meth:`!setdefault` method requires two arguments. It also " +"supports a \"closing\" context manager via the :keyword:`with` keyword." msgstr "" -#: library/dbm.rst:209 -msgid "" -":class:`!gdbm` objects behave similar to :term:`mappings `, but :" -"meth:`!items` and :meth:`!values` methods are not supported. The following " -"methods are also provided:" +#: library/dbm.rst:393 +msgid "Added the :meth:`!get` and :meth:`!setdefault` methods." +msgstr "" + +#: library/dbm.rst:396 +msgid "Added the :meth:`!clear` method." +msgstr "" + +#: library/dbm.rst:479 +msgid "The following methods are also provided:" +msgstr "" + +#: library/dbm.rst:290 +msgid "Close the GDBM database." msgstr "" -#: library/dbm.rst:215 +#: library/dbm.rst:294 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " @@ -286,14 +413,22 @@ msgid "" "starting key." msgstr "" -#: library/dbm.rst:222 +#: library/dbm.rst:301 msgid "" "Returns the key that follows *key* in the traversal. The following code " "prints every key in the database ``db``, without having to create a list in " "memory that contains them all::" msgstr "" -#: library/dbm.rst:233 +#: library/dbm.rst:305 +msgid "" +"k = db.firstkey()\n" +"while k is not None:\n" +" print(k)\n" +" k = db.nextkey(k)" +msgstr "" + +#: library/dbm.rst:312 msgid "" "If you have carried out a lot of deletions and would like to shrink the " "space used by the GDBM file, this routine will reorganize the database. :" @@ -302,32 +437,28 @@ msgid "" "reused as new (key, value) pairs are added." msgstr "" -#: library/dbm.rst:241 +#: library/dbm.rst:320 msgid "" "When the database has been opened in fast mode, this method forces any " "unwritten data to be written to the disk." msgstr "" -#: library/dbm.rst:246 -msgid "Close the GDBM database." -msgstr "" - -#: library/dbm.rst:250 +#: library/dbm.rst:325 msgid ":mod:`dbm.ndbm` --- New Database Manager" msgstr "" -#: library/dbm.rst:256 +#: library/dbm.rst:331 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "" -#: library/dbm.rst:260 +#: library/dbm.rst:335 msgid "" "The :mod:`dbm.ndbm` module provides an interface to the :abbr:`NDBM (New " "Database Manager)` library. This module can be used with the \"classic\" " "NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -#: library/dbm.rst:272 +#: library/dbm.rst:347 msgid "" "The NDBM library shipped as part of macOS has an undocumented limitation on " "the size of values, which can result in corrupted database files when " @@ -335,51 +466,53 @@ msgid "" "result in a hard crash (segmentation fault)." msgstr "" -#: library/dbm.rst:279 +#: library/dbm.rst:356 msgid "" "Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: library/dbm.rst:285 +#: library/dbm.rst:362 msgid "Name of the NDBM implementation library used." msgstr "" -#: library/dbm.rst:290 +#: library/dbm.rst:367 msgid "Open an NDBM database and return an :class:`!ndbm` object." msgstr "" -#: library/dbm.rst:292 +#: library/dbm.rst:369 msgid "" "The basename of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" -#: library/dbm.rst:306 -msgid "" -":class:`!ndbm` objects behave similar to :term:`mappings `, but :" -"meth:`!items` and :meth:`!values` methods are not supported. The following " -"methods are also provided:" +#: library/dbm.rst:383 +msgid "Accepts :term:`path-like object` for filename." msgstr "" -#: library/dbm.rst:310 -msgid "Accepts :term:`path-like object` for filename." +#: library/dbm.rst:386 +msgid "" +":class:`!ndbm` objects behave similar to mutable :term:`mappings `, " +"but methods :meth:`!items`, :meth:`!values`, :meth:`!pop`, :meth:`!popitem`, " +"and :meth:`!update` are not supported, the :meth:`!keys` method returns a " +"list, and the :meth:`!setdefault` method requires two arguments. It also " +"supports a \"closing\" context manager via the :keyword:`with` keyword." msgstr "" -#: library/dbm.rst:315 +#: library/dbm.rst:403 msgid "Close the NDBM database." msgstr "" -#: library/dbm.rst:319 +#: library/dbm.rst:407 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" msgstr "" -#: library/dbm.rst:324 +#: library/dbm.rst:412 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "" -#: library/dbm.rst:330 +#: library/dbm.rst:418 msgid "" "The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" "mod:`dbm` module when a more robust module is not available. The :mod:`dbm." @@ -387,100 +520,99 @@ msgid "" "the other database modules." msgstr "" -#: library/dbm.rst:337 +#: library/dbm.rst:425 msgid "" "The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like " "interface which is written entirely in Python. Unlike other :mod:`dbm` " "backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" -#: library/dbm.rst:342 +#: library/dbm.rst:430 msgid "The :mod:`!dbm.dumb` module defines the following:" msgstr "" -#: library/dbm.rst:346 +#: library/dbm.rst:434 msgid "" "Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: library/dbm.rst:352 -msgid "" -"Open a :mod:`!dbm.dumb` database. The returned database object behaves " -"similar to a :term:`mapping`, in addition to providing :meth:`~dumbdbm.sync` " -"and :meth:`~dumbdbm.close` methods." +#: library/dbm.rst:440 +msgid "Open a :mod:`!dbm.dumb` database." msgstr "" -#: library/dbm.rst:357 +#: library/dbm.rst:442 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files: - :file:`{filename}.dat` - :file:`{filename}." "dir`" msgstr "" -#: library/dbm.rst:358 +#: library/dbm.rst:443 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files:" msgstr "" -#: library/dbm.rst:361 +#: library/dbm.rst:446 msgid ":file:`{filename}.dat`" msgstr "" -#: library/dbm.rst:362 +#: library/dbm.rst:447 msgid ":file:`{filename}.dir`" msgstr "" -#: library/dbm.rst:365 +#: library/dbm.rst:450 msgid "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" msgstr "" -#: library/dbm.rst:366 +#: library/dbm.rst:451 msgid "``'r'``: |flag_r|" msgstr "" -#: library/dbm.rst:368 +#: library/dbm.rst:453 msgid "``'c'`` (default): |flag_c|" msgstr "" -#: library/dbm.rst:375 +#: library/dbm.rst:460 msgid "" "It is possible to crash the Python interpreter when loading a database with " "a sufficiently large/complex entry due to stack depth limitations in " "Python's AST compiler." msgstr "" -#: library/dbm.rst:379 +#: library/dbm.rst:464 msgid "" ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" -#: library/dbm.rst:382 +#: library/dbm.rst:467 msgid "" "A database opened read-only if *flag* is ``'r'``. A database is not created " "if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" -#: library/dbm.rst:389 +#: library/dbm.rst:474 msgid "" -"In addition to the methods provided by the :class:`collections.abc." -"MutableMapping` class, the following methods are provided:" +"The returned database object behaves similar to a mutable :term:`mapping`, " +"but the :meth:`!keys` and :meth:`!items` methods return lists, and the :meth:" +"`!setdefault` method requires two arguments. It also supports a \"closing\" " +"context manager via the :keyword:`with` keyword." msgstr "" -#: library/dbm.rst:395 -msgid "" -"Synchronize the on-disk directory and data files. This method is called by " -"the :meth:`Shelve.sync` method." +#: library/dbm.rst:483 +msgid "Close the database." msgstr "" -#: library/dbm.rst:400 -msgid "Close the database." +#: library/dbm.rst:487 +msgid "" +"Synchronize the on-disk directory and data files. This method is called by " +"the :meth:`shelve.Shelf.sync` method." msgstr "" -#: library/dbm.rst:326 +#: library/dbm.rst:414 msgid "databases" msgstr "" diff --git a/library/debug.po b/library/debug.po index 53800b2d..dad8bfb5 100644 --- a/library/debug.po +++ b/library/debug.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-26 14:11+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/debug.rst:3 msgid "Debugging and Profiling" -msgstr "" +msgstr "Αποσφαλμάτωση και Ανάλυση Απόδοσης" #: library/debug.rst:5 msgid "" @@ -29,3 +30,11 @@ msgid "" "provide visibility into runtime behaviors that would otherwise require " "intrusive debugging or patching." msgstr "" +"Αυτές οι βιβλιοθήκες σας βοηθούν στην ανάπτυξη με την Python: ο " +"αποσφαλματωτής (debugger) σας επιτρέπει να εκτελείτε τον κώδικα βήμα προς " +"βήμα, να αναλύετε στοίβες κλήσεων και να ορίζετε σημεία διακοπής κ.ά., ενώ " +"τα εργαλεία ανάλυσης απόδοσης εκτελούν τον κώδικα και σας παρέχουν λεπτομερή " +"ανάλυση των χρόνων εκτέλεσης, επιτρέποντάς σας να εντοπίσετε σημεία " +"συμφόρησης στα προγράμματά σας. Τα συμβάντα ελέγχου παρέχουν ορατότητα στις " +"συμπεριφορές κατά τον χρόνο εκτέλεσης, οι οποίες διαφορετικά θα απαιτούσαν " +"παρεμβατική αποσφαλμάτωση ή επιδιόρθωση." diff --git a/library/decimal.po b/library/decimal.po index dc70e6b1..c08b86ef 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/decimal.rst:2 -msgid ":mod:`decimal` --- Decimal fixed point and floating point arithmetic" +msgid ":mod:`!decimal` --- Decimal fixed-point and floating-point arithmetic" msgstr "" #: library/decimal.rst:15 @@ -27,7 +28,7 @@ msgstr "" #: library/decimal.rst:33 msgid "" "The :mod:`decimal` module provides support for fast correctly rounded " -"decimal floating point arithmetic. It offers several advantages over the :" +"decimal floating-point arithmetic. It offers several advantages over the :" "class:`float` datatype:" msgstr "" @@ -144,7 +145,7 @@ msgid "" msgstr "" #: library/decimal.rst:125 -msgid "Quick-start Tutorial" +msgid "Quick-start tutorial" msgstr "" #: library/decimal.rst:127 @@ -154,6 +155,17 @@ msgid "" "values for precision, rounding, or enabled traps::" msgstr "" +#: library/decimal.rst:131 +msgid "" +">>> from decimal import *\n" +">>> getcontext()\n" +"Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,\n" +" capitals=1, clamp=0, flags=[], traps=[Overflow, DivisionByZero,\n" +" InvalidOperation])\n" +"\n" +">>> getcontext().prec = 7 # Set a new precision" +msgstr "" + #: library/decimal.rst:139 msgid "" "Decimal instances can be constructed from integers, strings, floats, or " @@ -163,6 +175,27 @@ msgid "" "negative ``Infinity``, and ``-0``::" msgstr "" +#: library/decimal.rst:145 +msgid "" +">>> getcontext().prec = 28\n" +">>> Decimal(10)\n" +"Decimal('10')\n" +">>> Decimal('3.14')\n" +"Decimal('3.14')\n" +">>> Decimal(3.14)\n" +"Decimal('3.140000000000000124344978758017532527446746826171875')\n" +">>> Decimal((0, (3, 1, 4), -2))\n" +"Decimal('3.14')\n" +">>> Decimal(str(2.0 ** 0.5))\n" +"Decimal('1.4142135623730951')\n" +">>> Decimal(2) ** Decimal('0.5')\n" +"Decimal('1.414213562373095048801688724')\n" +">>> Decimal('NaN')\n" +"Decimal('NaN')\n" +">>> Decimal('-Infinity')\n" +"Decimal('-Infinity')" +msgstr "" + #: library/decimal.rst:163 msgid "" "If the :exc:`FloatOperation` signal is trapped, accidental mixing of " @@ -170,6 +203,22 @@ msgid "" "exception::" msgstr "" +#: library/decimal.rst:167 +msgid "" +">>> c = getcontext()\n" +">>> c.traps[FloatOperation] = True\n" +">>> Decimal(3.14)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"decimal.FloatOperation: []\n" +">>> Decimal('3.5') < 3.7\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"decimal.FloatOperation: []\n" +">>> Decimal('3.5') == 3.5\n" +"True" +msgstr "" + #: library/decimal.rst:182 msgid "" "The significance of a new Decimal is determined solely by the number of " @@ -177,16 +226,67 @@ msgid "" "arithmetic operations." msgstr "" +#: library/decimal.rst:186 +msgid "" +">>> getcontext().prec = 6\n" +">>> Decimal('3.0')\n" +"Decimal('3.0')\n" +">>> Decimal('3.1415926535')\n" +"Decimal('3.1415926535')\n" +">>> Decimal('3.1415926535') + Decimal('2.7182818285')\n" +"Decimal('5.85987')\n" +">>> getcontext().rounding = ROUND_UP\n" +">>> Decimal('3.1415926535') + Decimal('2.7182818285')\n" +"Decimal('5.85988')" +msgstr "" + #: library/decimal.rst:199 msgid "" "If the internal limits of the C version are exceeded, constructing a decimal " "raises :class:`InvalidOperation`::" msgstr "" +#: library/decimal.rst:202 +msgid "" +">>> Decimal(\"1e9999999999999999999\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"decimal.InvalidOperation: []" +msgstr "" + #: library/decimal.rst:209 msgid "" "Decimals interact well with much of the rest of Python. Here is a small " -"decimal floating point flying circus:" +"decimal floating-point flying circus:" +msgstr "" + +#: library/decimal.rst:212 +msgid "" +">>> data = list(map(Decimal, '1.34 1.87 3.45 2.35 1.00 0.03 9.25'.split()))\n" +">>> max(data)\n" +"Decimal('9.25')\n" +">>> min(data)\n" +"Decimal('0.03')\n" +">>> sorted(data)\n" +"[Decimal('0.03'), Decimal('1.00'), Decimal('1.34'), Decimal('1.87'),\n" +" Decimal('2.35'), Decimal('3.45'), Decimal('9.25')]\n" +">>> sum(data)\n" +"Decimal('19.29')\n" +">>> a,b,c = data[:3]\n" +">>> str(a)\n" +"'1.34'\n" +">>> float(a)\n" +"1.34\n" +">>> round(a, 1)\n" +"Decimal('1.3')\n" +">>> int(a)\n" +"1\n" +">>> a * 5\n" +"Decimal('6.70')\n" +">>> a * b\n" +"Decimal('2.5058')\n" +">>> c % a\n" +"Decimal('0.77')" msgstr "" #: library/decimal.rst:241 @@ -210,7 +310,7 @@ msgstr "" #: library/decimal.rst:266 msgid "" "For more advanced work, it may be useful to create alternate contexts using " -"the Context() constructor. To make an alternate active, use the :func:" +"the :meth:`Context` constructor. To make an alternate active, use the :func:" "`setcontext` function." msgstr "" @@ -222,6 +322,30 @@ msgid "" "many of the traps are enabled:" msgstr "" +#: library/decimal.rst:275 +msgid "" +">>> myothercontext = Context(prec=60, rounding=ROUND_HALF_DOWN)\n" +">>> setcontext(myothercontext)\n" +">>> Decimal(1) / Decimal(7)\n" +"Decimal('0.142857142857142857142857142857142857142857142857142857142857')\n" +"\n" +">>> ExtendedContext\n" +"Context(prec=9, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,\n" +" capitals=1, clamp=0, flags=[], traps=[])\n" +">>> setcontext(ExtendedContext)\n" +">>> Decimal(1) / Decimal(7)\n" +"Decimal('0.142857143')\n" +">>> Decimal(42) / Decimal(0)\n" +"Decimal('Infinity')\n" +"\n" +">>> setcontext(BasicContext)\n" +">>> Decimal(42) / Decimal(0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in -toplevel-\n" +" Decimal(42) / Decimal(0)\n" +"DivisionByZero: x / 0" +msgstr "" + #: library/decimal.rst:299 msgid "" "Contexts also have signal flags for monitoring exceptional conditions " @@ -230,6 +354,17 @@ msgid "" "computations by using the :meth:`~Context.clear_flags` method. ::" msgstr "" +#: library/decimal.rst:304 +msgid "" +">>> setcontext(ExtendedContext)\n" +">>> getcontext().clear_flags()\n" +">>> Decimal(355) / Decimal(113)\n" +"Decimal('3.14159292')\n" +">>> getcontext()\n" +"Context(prec=9, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,\n" +" capitals=1, clamp=0, flags=[Inexact, Rounded], traps=[])" +msgstr "" + #: library/decimal.rst:312 msgid "" "The *flags* entry shows that the rational approximation to pi was rounded " @@ -243,6 +378,19 @@ msgid "" "attribute of a context:" msgstr "" +#: library/decimal.rst:319 +msgid "" +">>> setcontext(ExtendedContext)\n" +">>> Decimal(1) / Decimal(0)\n" +"Decimal('Infinity')\n" +">>> getcontext().traps[DivisionByZero] = 1\n" +">>> Decimal(1) / Decimal(0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in -toplevel-\n" +" Decimal(1) / Decimal(0)\n" +"DivisionByZero: x / 0" +msgstr "" + #: library/decimal.rst:331 msgid "" "Most programs adjust the current context only once, at the beginning of the " @@ -269,15 +417,32 @@ msgid "" "throughout, are removed::" msgstr "" +#: library/decimal.rst:355 +msgid "" +"sign ::= '+' | '-'\n" +"digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | " +"'9'\n" +"indicator ::= 'e' | 'E'\n" +"digits ::= digit [digit]...\n" +"decimal-part ::= digits '.' [digits] | ['.'] digits\n" +"exponent-part ::= indicator [sign] digits\n" +"infinity ::= 'Infinity' | 'Inf'\n" +"nan ::= 'NaN' [digits] | 'sNaN' [digits]\n" +"numeric-value ::= decimal-part [exponent-part] | infinity\n" +"numeric-string ::= [sign] numeric-value | [sign] nan" +msgstr "" + #: library/decimal.rst:366 msgid "" "Other Unicode decimal digits are also permitted where ``digit`` appears " "above. These include decimal digits from various other alphabets (for " "example, Arabic-Indic and Devanāgarī digits) along with the fullwidth digits " -"``'\\uff10'`` through ``'\\uff19'``." +"``'\\uff10'`` through ``'\\uff19'``. Case is not significant, so, for " +"example, ``inf``, ``Inf``, ``INFINITY``, and ``iNfINity`` are all acceptable " +"spellings for positive infinity." msgstr "" -#: library/decimal.rst:371 +#: library/decimal.rst:373 msgid "" "If *value* is a :class:`tuple`, it should have three components, a sign " "(``0`` for positive or ``1`` for negative), a :class:`tuple` of digits, and " @@ -285,16 +450,16 @@ msgid "" "``Decimal('1.414')``." msgstr "" -#: library/decimal.rst:376 +#: library/decimal.rst:378 msgid "" -"If *value* is a :class:`float`, the binary floating point value is " +"If *value* is a :class:`float`, the binary floating-point value is " "losslessly converted to its exact decimal equivalent. This conversion can " "often require 53 or more digits of precision. For example, " "``Decimal(float('1.1'))`` converts to " "``Decimal('1.100000000000000088817841970012523233890533447265625')``." msgstr "" -#: library/decimal.rst:382 +#: library/decimal.rst:384 msgid "" "The *context* precision does not affect how many digits are stored. That is " "determined exclusively by the number of digits in *value*. For example, " @@ -302,7 +467,7 @@ msgid "" "is only three." msgstr "" -#: library/decimal.rst:387 +#: library/decimal.rst:389 msgid "" "The purpose of the *context* argument is determining what to do if *value* " "is a malformed string. If the context traps :const:`InvalidOperation`, an " @@ -310,31 +475,31 @@ msgid "" "the value of ``NaN``." msgstr "" -#: library/decimal.rst:392 +#: library/decimal.rst:394 msgid "Once constructed, :class:`Decimal` objects are immutable." msgstr "" -#: library/decimal.rst:394 +#: library/decimal.rst:396 msgid "" "The argument to the constructor is now permitted to be a :class:`float` " "instance." msgstr "" -#: library/decimal.rst:398 +#: library/decimal.rst:400 msgid "" ":class:`float` arguments raise an exception if the :exc:`FloatOperation` " "trap is set. By default the trap is off." msgstr "" -#: library/decimal.rst:402 +#: library/decimal.rst:404 msgid "" "Underscores are allowed for grouping, as with integral and floating-point " "literals in code." msgstr "" -#: library/decimal.rst:406 +#: library/decimal.rst:408 msgid "" -"Decimal floating point objects share many properties with the other built-in " +"Decimal floating-point objects share many properties with the other built-in " "numeric types such as :class:`float` and :class:`int`. All of the usual " "math operations and special methods apply. Likewise, decimal objects can be " "copied, pickled, printed, used as dictionary keys, used as set elements, " @@ -342,7 +507,7 @@ msgid "" "class:`int`)." msgstr "" -#: library/decimal.rst:413 +#: library/decimal.rst:415 msgid "" "There are some small differences between arithmetic on Decimal objects and " "arithmetic on integers and floats. When the remainder operator ``%`` is " @@ -350,20 +515,36 @@ msgid "" "*dividend* rather than the sign of the divisor::" msgstr "" -#: library/decimal.rst:423 +#: library/decimal.rst:420 +msgid "" +">>> (-7) % 4\n" +"1\n" +">>> Decimal(-7) % Decimal(4)\n" +"Decimal('-3')" +msgstr "" + +#: library/decimal.rst:425 msgid "" "The integer division operator ``//`` behaves analogously, returning the " "integer part of the true quotient (truncating towards zero) rather than its " "floor, so as to preserve the usual identity ``x == (x // y) * y + x % y``::" msgstr "" -#: library/decimal.rst:432 +#: library/decimal.rst:429 +msgid "" +">>> -7 // 4\n" +"-2\n" +">>> Decimal(-7) // Decimal(4)\n" +"Decimal('-1')" +msgstr "" + +#: library/decimal.rst:434 msgid "" "The ``%`` and ``//`` operators implement the ``remainder`` and ``divide-" "integer`` operations (respectively) as described in the specification." msgstr "" -#: library/decimal.rst:436 +#: library/decimal.rst:438 msgid "" "Decimal objects cannot generally be combined with floats or instances of :" "class:`fractions.Fraction` in arithmetic operations: an attempt to add a :" @@ -374,19 +555,19 @@ msgid "" "numbers of different types." msgstr "" -#: library/decimal.rst:444 +#: library/decimal.rst:446 msgid "" "Mixed-type comparisons between :class:`Decimal` instances and other numeric " "types are now fully supported." msgstr "" -#: library/decimal.rst:448 +#: library/decimal.rst:450 msgid "" -"In addition to the standard numeric properties, decimal floating point " +"In addition to the standard numeric properties, decimal floating-point " "objects also have a number of specialized methods:" msgstr "" -#: library/decimal.rst:454 +#: library/decimal.rst:456 msgid "" "Return the adjusted exponent after shifting out the coefficient's rightmost " "digits until only the lead digit remains: ``Decimal('321e+5').adjusted()`` " @@ -394,46 +575,60 @@ msgid "" "digit with respect to the decimal point." msgstr "" -#: library/decimal.rst:461 +#: library/decimal.rst:463 msgid "" "Return a pair ``(n, d)`` of integers that represent the given :class:" "`Decimal` instance as a fraction, in lowest terms and with a positive " "denominator::" msgstr "" -#: library/decimal.rst:468 +#: library/decimal.rst:467 +msgid "" +">>> Decimal('-3.14').as_integer_ratio()\n" +"(-157, 50)" +msgstr "" + +#: library/decimal.rst:470 msgid "" "The conversion is exact. Raise OverflowError on infinities and ValueError " "on NaNs." msgstr "" -#: library/decimal.rst:475 +#: library/decimal.rst:477 msgid "" "Return a :term:`named tuple` representation of the number: " "``DecimalTuple(sign, digits, exponent)``." msgstr "" -#: library/decimal.rst:481 +#: library/decimal.rst:483 msgid "" "Return the canonical encoding of the argument. Currently, the encoding of " "a :class:`Decimal` instance is always canonical, so this operation returns " "its argument unchanged." msgstr "" -#: library/decimal.rst:487 +#: library/decimal.rst:489 msgid "" "Compare the values of two Decimal instances. :meth:`compare` returns a " "Decimal instance, and if either operand is a NaN then the result is a NaN::" msgstr "" -#: library/decimal.rst:498 +#: library/decimal.rst:493 +msgid "" +"a or b is a NaN ==> Decimal('NaN')\n" +"a < b ==> Decimal('-1')\n" +"a == b ==> Decimal('0')\n" +"a > b ==> Decimal('1')" +msgstr "" + +#: library/decimal.rst:500 msgid "" "This operation is identical to the :meth:`compare` method, except that all " "NaNs signal. That is, if neither operand is a signaling NaN then any quiet " "NaN operand is treated as though it were a signaling NaN." msgstr "" -#: library/decimal.rst:504 +#: library/decimal.rst:506 msgid "" "Compare two operands using their abstract representation rather than their " "numerical value. Similar to the :meth:`compare` method, but the result " @@ -442,7 +637,7 @@ msgid "" "unequal in this ordering:" msgstr "" -#: library/decimal.rst:513 +#: library/decimal.rst:515 msgid "" "Quiet and signaling NaNs are also included in the total ordering. The " "result of this function is ``Decimal('0')`` if both operands have the same " @@ -452,14 +647,14 @@ msgid "" "details of the total order." msgstr "" -#: library/decimal.rst:531 library/decimal.rst:846 +#: library/decimal.rst:533 library/decimal.rst:865 msgid "" "This operation is unaffected by context and is quiet: no flags are changed " "and no rounding is performed. As an exception, the C version may raise " "InvalidOperation if the second operand cannot be converted exactly." msgstr "" -#: library/decimal.rst:526 +#: library/decimal.rst:528 msgid "" "Compare two operands using their abstract representation rather than their " "value as in :meth:`compare_total`, but ignoring the sign of each operand. " @@ -467,44 +662,44 @@ msgid "" "copy_abs())``." msgstr "" -#: library/decimal.rst:537 +#: library/decimal.rst:539 msgid "" "Just returns self, this method is only to comply with the Decimal " "Specification." msgstr "" -#: library/decimal.rst:542 +#: library/decimal.rst:544 msgid "" "Return the absolute value of the argument. This operation is unaffected by " "the context and is quiet: no flags are changed and no rounding is performed." msgstr "" -#: library/decimal.rst:548 +#: library/decimal.rst:550 msgid "" "Return the negation of the argument. This operation is unaffected by the " "context and is quiet: no flags are changed and no rounding is performed." msgstr "" -#: library/decimal.rst:553 +#: library/decimal.rst:555 msgid "" "Return a copy of the first operand with the sign set to be the same as the " "sign of the second operand. For example:" msgstr "" -#: library/decimal.rst:565 +#: library/decimal.rst:567 msgid "" "Return the value of the (natural) exponential function ``e**x`` at the given " "number. The result is correctly rounded using the :const:`ROUND_HALF_EVEN` " "rounding mode." msgstr "" -#: library/decimal.rst:576 +#: library/decimal.rst:578 msgid "" "Alternative constructor that only accepts instances of :class:`float` or :" "class:`int`." msgstr "" -#: library/decimal.rst:579 +#: library/decimal.rst:581 msgid "" "Note ``Decimal.from_float(0.1)`` is not the same as ``Decimal('0.1')``. " "Since 0.1 is not exactly representable in binary floating point, the value " @@ -513,92 +708,120 @@ msgid "" "``0.1000000000000000055511151231257827021181583404541015625``." msgstr "" -#: library/decimal.rst:585 +#: library/decimal.rst:587 msgid "" "From Python 3.2 onwards, a :class:`Decimal` instance can also be constructed " "directly from a :class:`float`." msgstr "" -#: library/decimal.rst:603 +#: library/decimal.rst:590 +msgid "" +">>> Decimal.from_float(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +">>> Decimal.from_float(float('nan'))\n" +"Decimal('NaN')\n" +">>> Decimal.from_float(float('inf'))\n" +"Decimal('Infinity')\n" +">>> Decimal.from_float(float('-inf'))\n" +"Decimal('-Infinity')" +msgstr "" + +#: library/decimal.rst:605 +msgid "" +"Alternative constructor that only accepts instances of :class:`float`, :" +"class:`int` or :class:`Decimal`, but not strings or tuples." +msgstr "" + +#: library/decimal.rst:609 +msgid "" +">>> Decimal.from_number(314)\n" +"Decimal('314')\n" +">>> Decimal.from_number(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +">>> Decimal.from_number(Decimal('3.14'))\n" +"Decimal('3.14')" +msgstr "" + +#: library/decimal.rst:622 msgid "" "Fused multiply-add. Return self*other+third with no rounding of the " "intermediate product self*other." msgstr "" -#: library/decimal.rst:611 +#: library/decimal.rst:630 msgid "" "Return :const:`True` if the argument is canonical and :const:`False` " "otherwise. Currently, a :class:`Decimal` instance is always canonical, so " "this operation always returns :const:`True`." msgstr "" -#: library/decimal.rst:617 +#: library/decimal.rst:636 msgid "" "Return :const:`True` if the argument is a finite number, and :const:`False` " "if the argument is an infinity or a NaN." msgstr "" -#: library/decimal.rst:622 +#: library/decimal.rst:641 msgid "" "Return :const:`True` if the argument is either positive or negative infinity " "and :const:`False` otherwise." msgstr "" -#: library/decimal.rst:627 +#: library/decimal.rst:646 msgid "" "Return :const:`True` if the argument is a (quiet or signaling) NaN and :" "const:`False` otherwise." msgstr "" -#: library/decimal.rst:632 +#: library/decimal.rst:651 msgid "" "Return :const:`True` if the argument is a *normal* finite number. Return :" "const:`False` if the argument is zero, subnormal, infinite or a NaN." msgstr "" -#: library/decimal.rst:637 +#: library/decimal.rst:656 msgid "" "Return :const:`True` if the argument is a quiet NaN, and :const:`False` " "otherwise." msgstr "" -#: library/decimal.rst:642 +#: library/decimal.rst:661 msgid "" "Return :const:`True` if the argument has a negative sign and :const:`False` " "otherwise. Note that zeros and NaNs can both carry signs." msgstr "" -#: library/decimal.rst:647 +#: library/decimal.rst:666 msgid "" "Return :const:`True` if the argument is a signaling NaN and :const:`False` " "otherwise." msgstr "" -#: library/decimal.rst:652 +#: library/decimal.rst:671 msgid "" "Return :const:`True` if the argument is subnormal, and :const:`False` " "otherwise." msgstr "" -#: library/decimal.rst:657 +#: library/decimal.rst:676 msgid "" "Return :const:`True` if the argument is a (positive or negative) zero and :" "const:`False` otherwise." msgstr "" -#: library/decimal.rst:662 +#: library/decimal.rst:681 msgid "" "Return the natural (base e) logarithm of the operand. The result is " "correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -#: library/decimal.rst:667 +#: library/decimal.rst:686 msgid "" "Return the base ten logarithm of the operand. The result is correctly " "rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -#: library/decimal.rst:672 +#: library/decimal.rst:691 msgid "" "For a nonzero number, return the adjusted exponent of its operand as a :" "class:`Decimal` instance. If the operand is a zero then ``Decimal('-" @@ -606,74 +829,74 @@ msgid "" "the operand is an infinity then ``Decimal('Infinity')`` is returned." msgstr "" -#: library/decimal.rst:680 +#: library/decimal.rst:699 msgid "" ":meth:`logical_and` is a logical operation which takes two *logical " "operands* (see :ref:`logical_operands_label`). The result is the digit-wise " "``and`` of the two operands." msgstr "" -#: library/decimal.rst:686 +#: library/decimal.rst:705 msgid "" ":meth:`logical_invert` is a logical operation. The result is the digit-wise " "inversion of the operand." msgstr "" -#: library/decimal.rst:691 +#: library/decimal.rst:710 msgid "" ":meth:`logical_or` is a logical operation which takes two *logical operands* " "(see :ref:`logical_operands_label`). The result is the digit-wise ``or`` of " "the two operands." msgstr "" -#: library/decimal.rst:697 +#: library/decimal.rst:716 msgid "" ":meth:`logical_xor` is a logical operation which takes two *logical " "operands* (see :ref:`logical_operands_label`). The result is the digit-wise " "exclusive or of the two operands." msgstr "" -#: library/decimal.rst:703 +#: library/decimal.rst:722 msgid "" "Like ``max(self, other)`` except that the context rounding rule is applied " "before returning and that ``NaN`` values are either signaled or ignored " "(depending on the context and whether they are signaling or quiet)." msgstr "" -#: library/decimal.rst:710 +#: library/decimal.rst:729 msgid "" "Similar to the :meth:`.max` method, but the comparison is done using the " "absolute values of the operands." msgstr "" -#: library/decimal.rst:715 +#: library/decimal.rst:734 msgid "" "Like ``min(self, other)`` except that the context rounding rule is applied " "before returning and that ``NaN`` values are either signaled or ignored " "(depending on the context and whether they are signaling or quiet)." msgstr "" -#: library/decimal.rst:722 +#: library/decimal.rst:741 msgid "" "Similar to the :meth:`.min` method, but the comparison is done using the " "absolute values of the operands." msgstr "" -#: library/decimal.rst:727 +#: library/decimal.rst:746 msgid "" "Return the largest number representable in the given context (or in the " "current thread's context if no context is given) that is smaller than the " "given operand." msgstr "" -#: library/decimal.rst:733 +#: library/decimal.rst:752 msgid "" "Return the smallest number representable in the given context (or in the " "current thread's context if no context is given) that is larger than the " "given operand." msgstr "" -#: library/decimal.rst:739 +#: library/decimal.rst:758 msgid "" "If the two operands are unequal, return the number closest to the first " "operand in the direction of the second operand. If both operands are " @@ -681,13 +904,13 @@ msgid "" "be the same as the sign of the second operand." msgstr "" -#: library/decimal.rst:746 +#: library/decimal.rst:765 msgid "" "Used for producing canonical values of an equivalence class within either " "the current context or the specified context." msgstr "" -#: library/decimal.rst:749 +#: library/decimal.rst:768 msgid "" "This has the same semantics as the unary plus operation, except that if the " "final result is finite it is reduced to its simplest form, with all trailing " @@ -697,79 +920,79 @@ msgid "" "exponent is set to 0. In all cases the sign is unchanged." msgstr "" -#: library/decimal.rst:756 +#: library/decimal.rst:775 msgid "" "For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both " "normalize to the equivalent value ``Decimal('32.1')``." msgstr "" -#: library/decimal.rst:759 +#: library/decimal.rst:778 msgid "Note that rounding is applied *before* reducing to simplest form." msgstr "" -#: library/decimal.rst:761 +#: library/decimal.rst:780 msgid "" "In the latest versions of the specification, this operation is also known as " "``reduce``." msgstr "" -#: library/decimal.rst:766 +#: library/decimal.rst:785 msgid "" "Return a string describing the *class* of the operand. The returned value " "is one of the following ten strings." msgstr "" -#: library/decimal.rst:769 +#: library/decimal.rst:788 msgid "``\"-Infinity\"``, indicating that the operand is negative infinity." msgstr "" -#: library/decimal.rst:770 +#: library/decimal.rst:789 msgid "" "``\"-Normal\"``, indicating that the operand is a negative normal number." msgstr "" -#: library/decimal.rst:771 +#: library/decimal.rst:790 msgid "" "``\"-Subnormal\"``, indicating that the operand is negative and subnormal." msgstr "" -#: library/decimal.rst:772 +#: library/decimal.rst:791 msgid "``\"-Zero\"``, indicating that the operand is a negative zero." msgstr "" -#: library/decimal.rst:773 +#: library/decimal.rst:792 msgid "``\"+Zero\"``, indicating that the operand is a positive zero." msgstr "" -#: library/decimal.rst:774 +#: library/decimal.rst:793 msgid "" "``\"+Subnormal\"``, indicating that the operand is positive and subnormal." msgstr "" -#: library/decimal.rst:775 +#: library/decimal.rst:794 msgid "" "``\"+Normal\"``, indicating that the operand is a positive normal number." msgstr "" -#: library/decimal.rst:776 +#: library/decimal.rst:795 msgid "``\"+Infinity\"``, indicating that the operand is positive infinity." msgstr "" -#: library/decimal.rst:777 +#: library/decimal.rst:796 msgid "``\"NaN\"``, indicating that the operand is a quiet NaN (Not a Number)." msgstr "" -#: library/decimal.rst:778 +#: library/decimal.rst:797 msgid "``\"sNaN\"``, indicating that the operand is a signaling NaN." msgstr "" -#: library/decimal.rst:782 +#: library/decimal.rst:801 msgid "" "Return a value equal to the first operand after rounding and having the " "exponent of the second operand." msgstr "" -#: library/decimal.rst:788 +#: library/decimal.rst:807 msgid "" "Unlike other operations, if the length of the coefficient after the quantize " "operation would be greater than precision, then an :const:`InvalidOperation` " @@ -777,13 +1000,13 @@ msgid "" "quantized exponent is always equal to that of the right-hand operand." msgstr "" -#: library/decimal.rst:794 +#: library/decimal.rst:813 msgid "" "Also unlike other operations, quantize never signals Underflow, even if the " "result is subnormal and inexact." msgstr "" -#: library/decimal.rst:797 +#: library/decimal.rst:816 msgid "" "If the exponent of the second operand is larger than that of the first then " "rounding may be necessary. In this case, the rounding mode is determined by " @@ -792,19 +1015,19 @@ msgid "" "context is used." msgstr "" -#: library/decimal.rst:803 +#: library/decimal.rst:822 msgid "" "An error is returned whenever the resulting exponent is greater than :attr:" "`~Context.Emax` or less than :meth:`~Context.Etiny`." msgstr "" -#: library/decimal.rst:808 +#: library/decimal.rst:827 msgid "" "Return ``Decimal(10)``, the radix (base) in which the :class:`Decimal` class " "does all its arithmetic. Included for compatibility with the specification." msgstr "" -#: library/decimal.rst:814 +#: library/decimal.rst:833 msgid "" "Return the remainder from dividing *self* by *other*. This differs from " "``self % other`` in that the sign of the remainder is chosen so as to " @@ -813,11 +1036,11 @@ msgid "" "other``, and if two integers are equally near then the even one is chosen." msgstr "" -#: library/decimal.rst:821 +#: library/decimal.rst:840 msgid "If the result is zero then its sign will be the sign of *self*." msgstr "" -#: library/decimal.rst:832 +#: library/decimal.rst:851 msgid "" "Return the result of rotating the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -829,20 +1052,20 @@ msgid "" "are unchanged." msgstr "" -#: library/decimal.rst:843 +#: library/decimal.rst:862 msgid "" "Test whether self and other have the same exponent or whether both are " "``NaN``." msgstr "" -#: library/decimal.rst:852 +#: library/decimal.rst:871 msgid "" "Return the first operand with exponent adjusted by the second. Equivalently, " "return the first operand multiplied by ``10**other``. The second operand " "must be an integer." msgstr "" -#: library/decimal.rst:858 +#: library/decimal.rst:877 msgid "" "Return the result of shifting the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -853,34 +1076,34 @@ msgid "" "exponent of the first operand are unchanged." msgstr "" -#: library/decimal.rst:868 +#: library/decimal.rst:887 msgid "Return the square root of the argument to full precision." msgstr "" -#: library/decimal.rst:1468 +#: library/decimal.rst:1549 msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "" -#: library/decimal.rst:1470 +#: library/decimal.rst:1551 msgid "" "Engineering notation has an exponent which is a multiple of 3. This can " "leave up to 3 digits to the left of the decimal place and may require the " "addition of either one or two trailing zeros." msgstr "" -#: library/decimal.rst:879 +#: library/decimal.rst:898 msgid "" "For example, this converts ``Decimal('123E+1')`` to ``Decimal('1.23E+3')``." msgstr "" -#: library/decimal.rst:883 +#: library/decimal.rst:902 msgid "" "Identical to the :meth:`to_integral_value` method. The ``to_integral`` name " "has been kept for compatibility with older versions." msgstr "" -#: library/decimal.rst:888 +#: library/decimal.rst:907 msgid "" "Round to the nearest integer, signaling :const:`Inexact` or :const:`Rounded` " "as appropriate if rounding occurs. The rounding mode is determined by the " @@ -888,18 +1111,78 @@ msgid "" "parameter is given then the rounding mode of the current context is used." msgstr "" -#: library/decimal.rst:896 +#: library/decimal.rst:915 msgid "" "Round to the nearest integer without signaling :const:`Inexact` or :const:" "`Rounded`. If given, applies *rounding*; otherwise, uses the rounding " "method in either the supplied *context* or the current context." msgstr "" -#: library/decimal.rst:904 +#: library/decimal.rst:919 +msgid "Decimal numbers can be rounded using the :func:`.round` function:" +msgstr "" + +#: library/decimal.rst:924 +msgid "" +"If *ndigits* is not given or ``None``, returns the nearest :class:`int` to " +"*number*, rounding ties to even, and ignoring the rounding mode of the :" +"class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an " +"infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN." +msgstr "" + +#: library/decimal.rst:930 +msgid "" +"If *ndigits* is an :class:`int`, the context's rounding mode is respected " +"and a :class:`Decimal` representing *number* rounded to the nearest multiple " +"of ``Decimal('1E-ndigits')`` is returned; in this case, ``round(number, " +"ndigits)`` is equivalent to ``self.quantize(Decimal('1E-ndigits'))``. " +"Returns ``Decimal('NaN')`` if *number* is a quiet NaN. Raises :class:" +"`InvalidOperation` if *number* is an infinity, a signaling NaN, or if the " +"length of the coefficient after the quantize operation would be greater than " +"the current context's precision. In other words, for the non-corner cases:" +msgstr "" + +#: library/decimal.rst:940 +msgid "" +"if *ndigits* is positive, return *number* rounded to *ndigits* decimal " +"places;" +msgstr "" + +#: library/decimal.rst:942 +msgid "if *ndigits* is zero, return *number* rounded to the nearest integer;" +msgstr "" + +#: library/decimal.rst:943 +msgid "" +"if *ndigits* is negative, return *number* rounded to the nearest multiple of " +"``10**abs(ndigits)``." +msgstr "" + +#: library/decimal.rst:946 +msgid "For example::" +msgstr "" + +#: library/decimal.rst:948 +msgid "" +">>> from decimal import Decimal, getcontext, ROUND_DOWN\n" +">>> getcontext().rounding = ROUND_DOWN\n" +">>> round(Decimal('3.75')) # context rounding ignored\n" +"4\n" +">>> round(Decimal('3.5')) # round-ties-to-even\n" +"4\n" +">>> round(Decimal('3.75'), 0) # uses the context rounding\n" +"Decimal('3')\n" +">>> round(Decimal('3.75'), 1)\n" +"Decimal('3.7')\n" +">>> round(Decimal('3.75'), -1)\n" +"Decimal('0E+1')" +msgstr "" + +#: library/decimal.rst:965 msgid "Logical operands" msgstr "" -#: library/decimal.rst:906 +#: library/decimal.rst:967 msgid "" "The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:" "`~Decimal.logical_or`, and :meth:`~Decimal.logical_xor` methods expect their " @@ -908,38 +1191,38 @@ msgid "" "are all either ``0`` or ``1``." msgstr "" -#: library/decimal.rst:918 +#: library/decimal.rst:979 msgid "Context objects" msgstr "" -#: library/decimal.rst:920 +#: library/decimal.rst:981 msgid "" "Contexts are environments for arithmetic operations. They govern precision, " "set rules for rounding, determine which signals are treated as exceptions, " "and limit the range for exponents." msgstr "" -#: library/decimal.rst:924 +#: library/decimal.rst:985 msgid "" "Each thread has its own current context which is accessed or changed using " "the :func:`getcontext` and :func:`setcontext` functions:" msgstr "" -#: library/decimal.rst:930 +#: library/decimal.rst:991 msgid "Return the current context for the active thread." msgstr "" -#: library/decimal.rst:935 +#: library/decimal.rst:996 msgid "Set the current context for the active thread to *c*." msgstr "" -#: library/decimal.rst:937 +#: library/decimal.rst:998 msgid "" "You can also use the :keyword:`with` statement and the :func:`localcontext` " "function to temporarily change the active context." msgstr "" -#: library/decimal.rst:942 +#: library/decimal.rst:1003 msgid "" "Return a context manager that will set the current context for the active " "thread to a copy of *ctx* on entry to the with-statement and restore the " @@ -948,37 +1231,63 @@ msgid "" "used to set the attributes of the new context." msgstr "" -#: library/decimal.rst:948 +#: library/decimal.rst:1009 msgid "" "For example, the following code sets the current decimal precision to 42 " "places, performs a calculation, and then automatically restores the previous " "context::" msgstr "" -#: library/decimal.rst:958 +#: library/decimal.rst:1012 +msgid "" +"from decimal import localcontext\n" +"\n" +"with localcontext() as ctx:\n" +" ctx.prec = 42 # Perform a high precision calculation\n" +" s = calculate_something()\n" +"s = +s # Round the final result back to the default precision" +msgstr "" + +#: library/decimal.rst:1019 msgid "Using keyword arguments, the code would be the following::" msgstr "" -#: library/decimal.rst:966 +#: library/decimal.rst:1021 +msgid "" +"from decimal import localcontext\n" +"\n" +"with localcontext(prec=42) as ctx:\n" +" s = calculate_something()\n" +"s = +s" +msgstr "" + +#: library/decimal.rst:1027 msgid "" "Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:" "`Context` doesn't support. Raises either :exc:`TypeError` or :exc:" "`ValueError` if *kwargs* supplies an invalid value for an attribute." msgstr "" -#: library/decimal.rst:970 +#: library/decimal.rst:1031 msgid "" ":meth:`localcontext` now supports setting context attributes through the use " "of keyword arguments." msgstr "" -#: library/decimal.rst:973 +#: library/decimal.rst:1036 +msgid "" +"Return a context object initialized to the proper values for one of the IEEE " +"interchange formats. The argument must be a multiple of 32 and less than :" +"const:`IEEE_CONTEXT_MAX_BITS`." +msgstr "" + +#: library/decimal.rst:1042 msgid "" "New contexts can also be created using the :class:`Context` constructor " "described below. In addition, the module provides three pre-made contexts:" msgstr "" -#: library/decimal.rst:979 +#: library/decimal.rst:1048 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -987,12 +1296,12 @@ msgid "" "`Subnormal`." msgstr "" -#: library/decimal.rst:985 +#: library/decimal.rst:1054 msgid "" "Because many of the traps are enabled, this context is useful for debugging." msgstr "" -#: library/decimal.rst:990 +#: library/decimal.rst:1059 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -1000,7 +1309,7 @@ msgid "" "exceptions are not raised during computations)." msgstr "" -#: library/decimal.rst:995 +#: library/decimal.rst:1064 msgid "" "Because the traps are disabled, this context is useful for applications that " "prefer to have result value of ``NaN`` or ``Infinity`` instead of raising " @@ -1008,7 +1317,7 @@ msgid "" "conditions that would otherwise halt the program." msgstr "" -#: library/decimal.rst:1003 +#: library/decimal.rst:1072 msgid "" "This context is used by the :class:`Context` constructor as a prototype for " "new contexts. Changing a field (such a precision) has the effect of " @@ -1016,7 +1325,7 @@ msgid "" "constructor." msgstr "" -#: library/decimal.rst:1007 +#: library/decimal.rst:1076 msgid "" "This context is most useful in multi-threaded environments. Changing one of " "the fields before threads are started has the effect of setting system-wide " @@ -1024,85 +1333,88 @@ msgid "" "as it would require thread synchronization to prevent race conditions." msgstr "" -#: library/decimal.rst:1012 +#: library/decimal.rst:1081 msgid "" "In single threaded environments, it is preferable to not use this context at " "all. Instead, simply create contexts explicitly as described below." msgstr "" -#: library/decimal.rst:1015 +#: library/decimal.rst:1084 msgid "" "The default values are :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context." "rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:" "`Overflow`, :class:`InvalidOperation`, and :class:`DivisionByZero`." msgstr "" -#: library/decimal.rst:1020 +#: library/decimal.rst:1089 msgid "" "In addition to the three supplied contexts, new contexts can be created with " "the :class:`Context` constructor." msgstr "" -#: library/decimal.rst:1026 +#: library/decimal.rst:1095 msgid "" "Creates a new context. If a field is not specified or is :const:`None`, the " "default values are copied from the :const:`DefaultContext`. If the *flags* " "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -#: library/decimal.rst:1030 +#: library/decimal.rst:1101 msgid "" -"*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets the " -"precision for arithmetic operations in the context." +"An integer in the range [``1``, :const:`MAX_PREC`] that sets the precision " +"for arithmetic operations in the context." +msgstr "" + +#: library/decimal.rst:1106 +msgid "One of the constants listed in the section `Rounding Modes`_." msgstr "" -#: library/decimal.rst:1033 +#: library/decimal.rst:1111 msgid "" -"The *rounding* option is one of the constants listed in the section " -"`Rounding Modes`_." +"Lists of any signals to be set. Generally, new contexts should only set " +"traps and leave the flags clear." msgstr "" -#: library/decimal.rst:1036 +#: library/decimal.rst:1117 msgid "" -"The *traps* and *flags* fields list any signals to be set. Generally, new " -"contexts should only set traps and leave the flags clear." +"Integers specifying the outer limits allowable for exponents. *Emin* must be " +"in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range [``0``, :const:" +"`MAX_EMAX`]." msgstr "" -#: library/decimal.rst:1039 +#: library/decimal.rst:1123 msgid "" -"The *Emin* and *Emax* fields are integers specifying the outer limits " -"allowable for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, " -"``0``], *Emax* in the range [``0``, :const:`MAX_EMAX`]." +"Either ``0`` or ``1`` (the default). If set to ``1``, exponents are printed " +"with a capital ``E``; otherwise, a lowercase ``e`` is used: " +"``Decimal('6.02e+23')``." msgstr "" -#: library/decimal.rst:1043 +#: library/decimal.rst:1129 msgid "" -"The *capitals* field is either ``0`` or ``1`` (the default). If set to " -"``1``, exponents are printed with a capital ``E``; otherwise, a lowercase " -"``e`` is used: ``Decimal('6.02e+23')``." +"Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e`` of " +"a :class:`Decimal` instance representable in this context is strictly " +"limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* " +"is ``0`` then a weaker condition holds: the adjusted exponent of the :class:" +"`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is ``1``, " +"a large normal number will, where possible, have its exponent reduced and a " +"corresponding number of zeros added to its coefficient, in order to fit the " +"exponent constraints; this preserves the value of the number but loses " +"information about significant trailing zeros. For example::" msgstr "" -#: library/decimal.rst:1047 +#: library/decimal.rst:1140 msgid "" -"The *clamp* field is either ``0`` (the default) or ``1``. If set to ``1``, " -"the exponent ``e`` of a :class:`Decimal` instance representable in this " -"context is strictly limited to the range ``Emin - prec + 1 <= e <= Emax - " -"prec + 1``. If *clamp* is ``0`` then a weaker condition holds: the adjusted " -"exponent of the :class:`Decimal` instance is at most :attr:`~Context.Emax`. " -"When *clamp* is ``1``, a large normal number will, where possible, have its " -"exponent reduced and a corresponding number of zeros added to its " -"coefficient, in order to fit the exponent constraints; this preserves the " -"value of the number but loses information about significant trailing zeros. " -"For example::" +">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" +"Decimal('1.23000E+999')" msgstr "" -#: library/decimal.rst:1062 +#: library/decimal.rst:1143 msgid "" "A *clamp* value of ``1`` allows compatibility with the fixed-width decimal " "interchange formats specified in IEEE 754." msgstr "" -#: library/decimal.rst:1065 +#: library/decimal.rst:1146 msgid "" "The :class:`Context` class defines several general purpose methods as well " "as a large number of methods for doing arithmetic directly in a given " @@ -1115,30 +1427,30 @@ msgid "" "instance of :class:`int`) anywhere that a Decimal instance is accepted." msgstr "" -#: library/decimal.rst:1078 +#: library/decimal.rst:1159 msgid "Resets all of the flags to ``0``." msgstr "" -#: library/decimal.rst:1082 +#: library/decimal.rst:1163 msgid "Resets all of the traps to ``0``." msgstr "" -#: library/decimal.rst:1088 +#: library/decimal.rst:1169 msgid "Return a duplicate of the context." msgstr "" -#: library/decimal.rst:1092 +#: library/decimal.rst:1173 msgid "Return a copy of the Decimal instance num." msgstr "" -#: library/decimal.rst:1096 +#: library/decimal.rst:1177 msgid "" "Creates a new Decimal instance from *num* but using *self* as context. " "Unlike the :class:`Decimal` constructor, the context precision, rounding " "method, flags, and traps are applied to the conversion." msgstr "" -#: library/decimal.rst:1100 +#: library/decimal.rst:1181 msgid "" "This is useful because constants are often given to a greater precision than " "is needed by the application. Another benefit is that rounding immediately " @@ -1147,14 +1459,23 @@ msgid "" "sum can change the result:" msgstr "" -#: library/decimal.rst:1114 +#: library/decimal.rst:1187 +msgid "" +">>> getcontext().prec = 3\n" +">>> Decimal('3.4445') + Decimal('1.0023')\n" +"Decimal('4.45')\n" +">>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')\n" +"Decimal('4.44')" +msgstr "" + +#: library/decimal.rst:1195 msgid "" "This method implements the to-number operation of the IBM specification. If " "the argument is a string, no leading or trailing whitespace or underscores " "are permitted." msgstr "" -#: library/decimal.rst:1120 +#: library/decimal.rst:1201 msgid "" "Creates a new Decimal instance from a float *f* but rounding using *self* as " "the context. Unlike the :meth:`Decimal.from_float` class method, the " @@ -1162,18 +1483,30 @@ msgid "" "conversion." msgstr "" -#: library/decimal.rst:1140 +#: library/decimal.rst:1206 +msgid "" +">>> context = Context(prec=5, rounding=ROUND_DOWN)\n" +">>> context.create_decimal_from_float(math.pi)\n" +"Decimal('3.1415')\n" +">>> context = Context(prec=5, traps=[Inexact])\n" +">>> context.create_decimal_from_float(math.pi)\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.Inexact: None" +msgstr "" + +#: library/decimal.rst:1221 msgid "" "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " "value for subnormal results. When underflow occurs, the exponent is set to :" "const:`Etiny`." msgstr "" -#: library/decimal.rst:1146 +#: library/decimal.rst:1227 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -#: library/decimal.rst:1148 +#: library/decimal.rst:1229 msgid "" "The usual approach to working with decimals is to create :class:`Decimal` " "instances and then apply arithmetic operations which take place within the " @@ -1183,189 +1516,189 @@ msgid "" "recounted here." msgstr "" -#: library/decimal.rst:1158 +#: library/decimal.rst:1239 msgid "Returns the absolute value of *x*." msgstr "" -#: library/decimal.rst:1163 +#: library/decimal.rst:1244 msgid "Return the sum of *x* and *y*." msgstr "" -#: library/decimal.rst:1168 +#: library/decimal.rst:1249 msgid "Returns the same Decimal object *x*." msgstr "" -#: library/decimal.rst:1173 +#: library/decimal.rst:1254 msgid "Compares *x* and *y* numerically." msgstr "" -#: library/decimal.rst:1178 +#: library/decimal.rst:1259 msgid "Compares the values of the two operands numerically." msgstr "" -#: library/decimal.rst:1183 +#: library/decimal.rst:1264 msgid "Compares two operands using their abstract representation." msgstr "" -#: library/decimal.rst:1188 +#: library/decimal.rst:1269 msgid "" "Compares two operands using their abstract representation, ignoring sign." msgstr "" -#: library/decimal.rst:1193 +#: library/decimal.rst:1274 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" -#: library/decimal.rst:1198 +#: library/decimal.rst:1279 msgid "Returns a copy of *x* with the sign inverted." msgstr "" -#: library/decimal.rst:1203 +#: library/decimal.rst:1284 msgid "Copies the sign from *y* to *x*." msgstr "" -#: library/decimal.rst:1208 +#: library/decimal.rst:1289 msgid "Return *x* divided by *y*." msgstr "" -#: library/decimal.rst:1213 +#: library/decimal.rst:1294 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" -#: library/decimal.rst:1218 +#: library/decimal.rst:1299 msgid "Divides two numbers and returns the integer part of the result." msgstr "" -#: library/decimal.rst:1223 +#: library/decimal.rst:1304 msgid "Returns ``e ** x``." msgstr "" -#: library/decimal.rst:1228 +#: library/decimal.rst:1309 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" -#: library/decimal.rst:1233 +#: library/decimal.rst:1314 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1238 +#: library/decimal.rst:1319 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1243 +#: library/decimal.rst:1324 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1248 +#: library/decimal.rst:1329 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1253 +#: library/decimal.rst:1334 msgid "" "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1258 +#: library/decimal.rst:1339 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1263 +#: library/decimal.rst:1344 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1268 +#: library/decimal.rst:1349 msgid "" "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1273 +#: library/decimal.rst:1354 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1278 +#: library/decimal.rst:1359 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" -#: library/decimal.rst:1283 +#: library/decimal.rst:1364 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" -#: library/decimal.rst:1288 +#: library/decimal.rst:1369 msgid "Returns the base 10 logarithm of *x*." msgstr "" -#: library/decimal.rst:1293 +#: library/decimal.rst:1374 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" -#: library/decimal.rst:1298 +#: library/decimal.rst:1379 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" -#: library/decimal.rst:1303 +#: library/decimal.rst:1384 msgid "Invert all the digits in *x*." msgstr "" -#: library/decimal.rst:1308 +#: library/decimal.rst:1389 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" -#: library/decimal.rst:1313 +#: library/decimal.rst:1394 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" -#: library/decimal.rst:1318 +#: library/decimal.rst:1399 msgid "Compares two values numerically and returns the maximum." msgstr "" -#: library/decimal.rst:1333 +#: library/decimal.rst:1414 msgid "Compares the values numerically with their sign ignored." msgstr "" -#: library/decimal.rst:1328 +#: library/decimal.rst:1409 msgid "Compares two values numerically and returns the minimum." msgstr "" -#: library/decimal.rst:1338 +#: library/decimal.rst:1419 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" -#: library/decimal.rst:1343 +#: library/decimal.rst:1424 msgid "Return the product of *x* and *y*." msgstr "" -#: library/decimal.rst:1348 +#: library/decimal.rst:1429 msgid "Returns the largest representable number smaller than *x*." msgstr "" -#: library/decimal.rst:1353 +#: library/decimal.rst:1434 msgid "Returns the smallest representable number larger than *x*." msgstr "" -#: library/decimal.rst:1358 +#: library/decimal.rst:1439 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" -#: library/decimal.rst:1363 +#: library/decimal.rst:1444 msgid "Reduces *x* to its simplest form." msgstr "" -#: library/decimal.rst:1368 +#: library/decimal.rst:1449 msgid "Returns an indication of the class of *x*." msgstr "" -#: library/decimal.rst:1373 +#: library/decimal.rst:1454 msgid "" "Plus corresponds to the unary prefix plus operator in Python. This " "operation applies the context precision and rounding, so it is *not* an " "identity operation." msgstr "" -#: library/decimal.rst:1380 +#: library/decimal.rst:1461 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -#: library/decimal.rst:1382 +#: library/decimal.rst:1463 msgid "" "With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must " "be integral. The result will be inexact unless ``y`` is integral and the " @@ -1374,42 +1707,42 @@ msgid "" "in the Python version." msgstr "" -#: library/decimal.rst:1388 +#: library/decimal.rst:1469 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -#: library/decimal.rst:1391 +#: library/decimal.rst:1472 msgid "" "The C module computes :meth:`power` in terms of the correctly rounded :meth:" "`exp` and :meth:`ln` functions. The result is well-defined but only \"almost " "always correctly rounded\"." msgstr "" -#: library/decimal.rst:1396 +#: library/decimal.rst:1477 msgid "" "With three arguments, compute ``(x**y) % modulo``. For the three argument " "form, the following restrictions on the arguments hold:" msgstr "" -#: library/decimal.rst:1399 +#: library/decimal.rst:1480 msgid "all three arguments must be integral" msgstr "" -#: library/decimal.rst:1400 +#: library/decimal.rst:1481 msgid "``y`` must be nonnegative" msgstr "" -#: library/decimal.rst:1401 +#: library/decimal.rst:1482 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" -#: library/decimal.rst:1402 +#: library/decimal.rst:1483 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -#: library/decimal.rst:1404 +#: library/decimal.rst:1485 msgid "" "The value resulting from ``Context.power(x, y, modulo)`` is equal to the " "value that would be obtained by computing ``(x**y) % modulo`` with unbounded " @@ -1418,110 +1751,118 @@ msgid "" "result is always exact." msgstr "" -#: library/decimal.rst:1414 +#: library/decimal.rst:1495 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" -#: library/decimal.rst:1419 +#: library/decimal.rst:1500 msgid "Just returns 10, as this is Decimal, :)" msgstr "" -#: library/decimal.rst:1424 +#: library/decimal.rst:1505 msgid "Returns the remainder from integer division." msgstr "" -#: library/decimal.rst:1426 +#: library/decimal.rst:1507 msgid "" "The sign of the result, if non-zero, is the same as that of the original " "dividend." msgstr "" -#: library/decimal.rst:1432 +#: library/decimal.rst:1513 msgid "" "Returns ``x - y * n``, where *n* is the integer nearest the exact value of " "``x / y`` (if the result is 0 then its sign will be the sign of *x*)." msgstr "" -#: library/decimal.rst:1438 +#: library/decimal.rst:1519 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" -#: library/decimal.rst:1443 +#: library/decimal.rst:1524 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" -#: library/decimal.rst:1448 +#: library/decimal.rst:1529 msgid "Returns the first operand after adding the second value its exp." msgstr "" -#: library/decimal.rst:1453 +#: library/decimal.rst:1534 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" -#: library/decimal.rst:1458 +#: library/decimal.rst:1539 msgid "Square root of a non-negative number to context precision." msgstr "" -#: library/decimal.rst:1463 +#: library/decimal.rst:1544 msgid "Return the difference between *x* and *y*." msgstr "" -#: library/decimal.rst:1477 +#: library/decimal.rst:1558 msgid "Rounds to an integer." msgstr "" -#: library/decimal.rst:1482 +#: library/decimal.rst:1563 msgid "Converts a number to a string using scientific notation." msgstr "" -#: library/decimal.rst:1489 +#: library/decimal.rst:1570 msgid "Constants" msgstr "" -#: library/decimal.rst:1491 +#: library/decimal.rst:1572 msgid "" "The constants in this section are only relevant for the C module. They are " "also included in the pure Python version for compatibility." msgstr "" -#: library/decimal.rst:1495 +#: library/decimal.rst:1576 msgid "32-bit" msgstr "" -#: library/decimal.rst:1495 +#: library/decimal.rst:1576 msgid "64-bit" msgstr "" -#: library/decimal.rst:1499 +#: library/decimal.rst:1580 msgid "``425000000``" msgstr "" -#: library/decimal.rst:1499 +#: library/decimal.rst:1580 msgid "``999999999999999999``" msgstr "" -#: library/decimal.rst:1501 +#: library/decimal.rst:1582 msgid "``-425000000``" msgstr "" -#: library/decimal.rst:1501 +#: library/decimal.rst:1582 msgid "``-999999999999999999``" msgstr "" -#: library/decimal.rst:1503 +#: library/decimal.rst:1584 msgid "``-849999999``" msgstr "" -#: library/decimal.rst:1503 +#: library/decimal.rst:1584 msgid "``-1999999999999999997``" msgstr "" -#: library/decimal.rst:1509 +#: library/decimal.rst:1586 +msgid "``256``" +msgstr "" + +#: library/decimal.rst:1586 +msgid "``512``" +msgstr "" + +#: library/decimal.rst:1591 msgid "" "The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -#: library/decimal.rst:1515 +#: library/decimal.rst:1597 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -1530,55 +1871,55 @@ msgid "" "scenarios." msgstr "" -#: library/decimal.rst:1524 +#: library/decimal.rst:1606 msgid "Rounding modes" msgstr "" -#: library/decimal.rst:1528 +#: library/decimal.rst:1610 msgid "Round towards ``Infinity``." msgstr "" -#: library/decimal.rst:1532 +#: library/decimal.rst:1614 msgid "Round towards zero." msgstr "" -#: library/decimal.rst:1536 +#: library/decimal.rst:1618 msgid "Round towards ``-Infinity``." msgstr "" -#: library/decimal.rst:1540 +#: library/decimal.rst:1622 msgid "Round to nearest with ties going towards zero." msgstr "" -#: library/decimal.rst:1544 +#: library/decimal.rst:1626 msgid "Round to nearest with ties going to nearest even integer." msgstr "" -#: library/decimal.rst:1548 +#: library/decimal.rst:1630 msgid "Round to nearest with ties going away from zero." msgstr "" -#: library/decimal.rst:1552 +#: library/decimal.rst:1634 msgid "Round away from zero." msgstr "" -#: library/decimal.rst:1556 +#: library/decimal.rst:1638 msgid "" "Round away from zero if last digit after rounding towards zero would have " "been 0 or 5; otherwise round towards zero." msgstr "" -#: library/decimal.rst:1563 +#: library/decimal.rst:1645 msgid "Signals" msgstr "" -#: library/decimal.rst:1565 +#: library/decimal.rst:1647 msgid "" "Signals represent conditions that arise during computation. Each corresponds " "to one context flag and one context trap enabler." msgstr "" -#: library/decimal.rst:1568 +#: library/decimal.rst:1650 msgid "" "The context flag is set whenever the condition is encountered. After the " "computation, flags may be checked for informational purposes (for instance, " @@ -1586,7 +1927,7 @@ msgid "" "sure to clear all flags before starting the next computation." msgstr "" -#: library/decimal.rst:1573 +#: library/decimal.rst:1655 msgid "" "If the context's trap enabler is set for the signal, then the condition " "causes a Python exception to be raised. For example, if the :class:" @@ -1594,58 +1935,71 @@ msgid "" "raised upon encountering the condition." msgstr "" -#: library/decimal.rst:1581 +#: library/decimal.rst:1663 msgid "Altered an exponent to fit representation constraints." msgstr "" -#: library/decimal.rst:1583 +#: library/decimal.rst:1665 msgid "" "Typically, clamping occurs when an exponent falls outside the context's :" "attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If possible, the " "exponent is reduced to fit by adding zeros to the coefficient." msgstr "" -#: library/decimal.rst:1590 +#: library/decimal.rst:1672 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" -#: library/decimal.rst:1595 +#: library/decimal.rst:1677 msgid "Signals the division of a non-infinite number by zero." msgstr "" -#: library/decimal.rst:1597 +#: library/decimal.rst:1679 msgid "" "Can occur with division, modulo division, or when raising a number to a " "negative power. If this signal is not trapped, returns ``Infinity`` or ``-" "Infinity`` with the sign determined by the inputs to the calculation." msgstr "" -#: library/decimal.rst:1604 +#: library/decimal.rst:1686 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -#: library/decimal.rst:1606 +#: library/decimal.rst:1688 msgid "" "Signals when non-zero digits were discarded during rounding. The rounded " "result is returned. The signal flag or trap is used to detect when results " "are inexact." msgstr "" -#: library/decimal.rst:1613 +#: library/decimal.rst:1695 msgid "An invalid operation was performed." msgstr "" -#: library/decimal.rst:1615 +#: library/decimal.rst:1697 msgid "" "Indicates that an operation was requested that does not make sense. If not " "trapped, returns ``NaN``. Possible causes include::" msgstr "" -#: library/decimal.rst:1631 +#: library/decimal.rst:1700 +msgid "" +"Infinity - Infinity\n" +"0 * Infinity\n" +"Infinity / Infinity\n" +"x % 0\n" +"Infinity % x\n" +"sqrt(-x) and x > 0\n" +"0 ** 0\n" +"x ** (non-integer)\n" +"x ** Infinity" +msgstr "" + +#: library/decimal.rst:1713 msgid "Numerical overflow." msgstr "" -#: library/decimal.rst:1633 +#: library/decimal.rst:1715 msgid "" "Indicates the exponent is larger than :attr:`Context.Emax` after rounding " "has occurred. If not trapped, the result depends on the rounding mode, " @@ -1654,42 +2008,42 @@ msgid "" "`Rounded` are also signaled." msgstr "" -#: library/decimal.rst:1642 +#: library/decimal.rst:1724 msgid "Rounding occurred though possibly no information was lost." msgstr "" -#: library/decimal.rst:1644 +#: library/decimal.rst:1726 msgid "" "Signaled whenever rounding discards digits; even if those digits are zero " "(such as rounding ``5.00`` to ``5.0``). If not trapped, returns the result " "unchanged. This signal is used to detect loss of significant digits." msgstr "" -#: library/decimal.rst:1652 +#: library/decimal.rst:1734 msgid "Exponent was lower than :attr:`~Context.Emin` prior to rounding." msgstr "" -#: library/decimal.rst:1654 +#: library/decimal.rst:1736 msgid "" "Occurs when an operation result is subnormal (the exponent is too small). If " "not trapped, returns the result unchanged." msgstr "" -#: library/decimal.rst:1660 +#: library/decimal.rst:1742 msgid "Numerical underflow with result rounded to zero." msgstr "" -#: library/decimal.rst:1662 +#: library/decimal.rst:1744 msgid "" "Occurs when a subnormal result is pushed to zero by rounding. :class:" "`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -#: library/decimal.rst:1668 +#: library/decimal.rst:1750 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -#: library/decimal.rst:1670 +#: library/decimal.rst:1752 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " "permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." @@ -1700,26 +2054,41 @@ msgid "" "Context.create_decimal_from_float` do not set the flag." msgstr "" -#: library/decimal.rst:1678 +#: library/decimal.rst:1760 msgid "" "Otherwise (the signal is trapped), only equality comparisons and explicit " "conversions are silent. All other mixed operations raise :exc:" "`FloatOperation`." msgstr "" -#: library/decimal.rst:1682 +#: library/decimal.rst:1764 msgid "The following table summarizes the hierarchy of signals::" msgstr "" -#: library/decimal.rst:1703 -msgid "Floating Point Notes" +#: library/decimal.rst:1766 +msgid "" +"exceptions.ArithmeticError(exceptions.Exception)\n" +" DecimalException\n" +" Clamped\n" +" DivisionByZero(DecimalException, exceptions.ZeroDivisionError)\n" +" Inexact\n" +" Overflow(Inexact, Rounded)\n" +" Underflow(Inexact, Rounded, Subnormal)\n" +" InvalidOperation\n" +" Rounded\n" +" Subnormal\n" +" FloatOperation(DecimalException, exceptions.TypeError)" +msgstr "" + +#: library/decimal.rst:1785 +msgid "Floating-point notes" msgstr "" -#: library/decimal.rst:1707 +#: library/decimal.rst:1789 msgid "Mitigating round-off error with increased precision" msgstr "" -#: library/decimal.rst:1709 +#: library/decimal.rst:1791 msgid "" "The use of decimal floating point eliminates decimal representation error " "(making it possible to represent ``0.1`` exactly); however, some operations " @@ -1727,33 +2096,68 @@ msgid "" "precision." msgstr "" -#: library/decimal.rst:1713 +#: library/decimal.rst:1795 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " "significance. Knuth provides two instructive examples where rounded " -"floating point arithmetic with insufficient precision causes the breakdown " +"floating-point arithmetic with insufficient precision causes the breakdown " "of the associative and distributive properties of addition:" msgstr "" -#: library/decimal.rst:1737 +#: library/decimal.rst:1801 +msgid "" +"# Examples from Seminumerical Algorithms, Section 4.2.2.\n" +">>> from decimal import Decimal, getcontext\n" +">>> getcontext().prec = 8\n" +"\n" +">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" +">>> (u + v) + w\n" +"Decimal('9.5111111')\n" +">>> u + (v + w)\n" +"Decimal('10')\n" +"\n" +">>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')\n" +">>> (u*v) + (u*w)\n" +"Decimal('0.01')\n" +">>> u * (v+w)\n" +"Decimal('0.0060000')" +msgstr "" + +#: library/decimal.rst:1819 msgid "" "The :mod:`decimal` module makes it possible to restore the identities by " "expanding the precision sufficiently to avoid loss of significance:" msgstr "" -#: library/decimal.rst:1757 +#: library/decimal.rst:1822 +msgid "" +">>> getcontext().prec = 20\n" +">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" +">>> (u + v) + w\n" +"Decimal('9.51111111')\n" +">>> u + (v + w)\n" +"Decimal('9.51111111')\n" +">>>\n" +">>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')\n" +">>> (u*v) + (u*w)\n" +"Decimal('0.0060000')\n" +">>> u * (v+w)\n" +"Decimal('0.0060000')" +msgstr "" + +#: library/decimal.rst:1839 msgid "Special values" msgstr "" -#: library/decimal.rst:1759 +#: library/decimal.rst:1841 msgid "" "The number system for the :mod:`decimal` module provides special values " "including ``NaN``, ``sNaN``, ``-Infinity``, ``Infinity``, and two zeros, " "``+0`` and ``-0``." msgstr "" -#: library/decimal.rst:1763 +#: library/decimal.rst:1845 msgid "" "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " "they can arise from dividing by zero when the :exc:`DivisionByZero` signal " @@ -1762,14 +2166,14 @@ msgid "" "representable number." msgstr "" -#: library/decimal.rst:1768 +#: library/decimal.rst:1850 msgid "" "The infinities are signed (affine) and can be used in arithmetic operations " "where they get treated as very large, indeterminate numbers. For instance, " "adding a constant to infinity gives another infinite result." msgstr "" -#: library/decimal.rst:1772 +#: library/decimal.rst:1854 msgid "" "Some operations are indeterminate and return ``NaN``, or if the :exc:" "`InvalidOperation` signal is trapped, raise an exception. For example, " @@ -1780,14 +2184,14 @@ msgid "" "the calculation to proceed while flagging specific results as invalid." msgstr "" -#: library/decimal.rst:1780 +#: library/decimal.rst:1862 msgid "" "A variant is ``sNaN`` which signals rather than remaining quiet after every " "operation. This is a useful return value when an invalid result needs to " "interrupt a calculation for special handling." msgstr "" -#: library/decimal.rst:1784 +#: library/decimal.rst:1866 msgid "" "The behavior of Python's comparison operators can be a little surprising " "where a ``NaN`` is involved. A test for equality where one of the operands " @@ -1804,7 +2208,7 @@ msgid "" "compare_signal` methods instead." msgstr "" -#: library/decimal.rst:1797 +#: library/decimal.rst:1879 msgid "" "The signed zeros can result from calculations that underflow. They keep the " "sign that would have resulted if the calculation had been carried out to " @@ -1812,20 +2216,20 @@ msgid "" "negative zeros are treated as equal and their sign is informational." msgstr "" -#: library/decimal.rst:1802 +#: library/decimal.rst:1884 msgid "" "In addition to the two signed zeros which are distinct yet equal, there are " "various representations of zero with differing precisions yet equivalent in " "value. This takes a bit of getting used to. For an eye accustomed to " -"normalized floating point representations, it is not immediately obvious " +"normalized floating-point representations, it is not immediately obvious " "that the following calculation returns a value equal to zero:" msgstr "" -#: library/decimal.rst:1817 +#: library/decimal.rst:1899 msgid "Working with threads" msgstr "" -#: library/decimal.rst:1819 +#: library/decimal.rst:1901 msgid "" "The :func:`getcontext` function accesses a different :class:`Context` object " "for each thread. Having separate thread contexts means that threads may " @@ -1833,107 +2237,282 @@ msgid "" "other threads." msgstr "" -#: library/decimal.rst:1823 +#: library/decimal.rst:1905 msgid "" "Likewise, the :func:`setcontext` function automatically assigns its target " "to the current thread." msgstr "" -#: library/decimal.rst:1826 +#: library/decimal.rst:1908 msgid "" "If :func:`setcontext` has not been called before :func:`getcontext`, then :" "func:`getcontext` will automatically create a new context for use in the " -"current thread." +"current thread. New context objects have default values set from the :data:" +"`decimal.DefaultContext` object." msgstr "" -#: library/decimal.rst:1830 +#: library/decimal.rst:1913 +msgid "" +"The :data:`sys.flags.thread_inherit_context` flag affects the context for " +"new threads. If the flag is false, new threads will start with an empty " +"context. In this case, :func:`getcontext` will create a new context object " +"when called and use the default values from *DefaultContext*. If the flag " +"is true, new threads will start with a copy of context from the caller of :" +"meth:`threading.Thread.start`." +msgstr "" + +#: library/decimal.rst:1920 msgid "" -"The new context is copied from a prototype context called *DefaultContext*. " "To control the defaults so that each thread will use the same values " "throughout the application, directly modify the *DefaultContext* object. " "This should be done *before* any threads are started so that there won't be " "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" -#: library/decimal.rst:1855 +#: library/decimal.rst:1925 +msgid "" +"# Set applicationwide defaults for all threads about to be launched\n" +"DefaultContext.prec = 12\n" +"DefaultContext.rounding = ROUND_DOWN\n" +"DefaultContext.traps = ExtendedContext.traps.copy()\n" +"DefaultContext.traps[InvalidOperation] = 1\n" +"setcontext(DefaultContext)\n" +"\n" +"# Afterwards, the threads can be started\n" +"t1.start()\n" +"t2.start()\n" +"t3.start()\n" +" . . ." +msgstr "" + +#: library/decimal.rst:1944 msgid "Recipes" msgstr "" -#: library/decimal.rst:1857 +#: library/decimal.rst:1946 msgid "" "Here are a few recipes that serve as utility functions and that demonstrate " "ways to work with the :class:`Decimal` class::" msgstr "" -#: library/decimal.rst:2012 +#: library/decimal.rst:1949 +msgid "" +"def moneyfmt(value, places=2, curr='', sep=',', dp='.',\n" +" pos='', neg='-', trailneg=''):\n" +" \"\"\"Convert Decimal to a money formatted string.\n" +"\n" +" places: required number of places after the decimal point\n" +" curr: optional currency symbol before the sign (may be blank)\n" +" sep: optional grouping separator (comma, period, space, or blank)\n" +" dp: decimal point indicator (comma or period)\n" +" only specify as blank when places is zero\n" +" pos: optional sign for positive numbers: '+', space or blank\n" +" neg: optional sign for negative numbers: '-', '(', space or blank\n" +" trailneg:optional trailing minus indicator: '-', ')', space or blank\n" +"\n" +" >>> d = Decimal('-1234567.8901')\n" +" >>> moneyfmt(d, curr='$')\n" +" '-$1,234,567.89'\n" +" >>> moneyfmt(d, places=0, sep='.', dp='', neg='', trailneg='-')\n" +" '1.234.568-'\n" +" >>> moneyfmt(d, curr='$', neg='(', trailneg=')')\n" +" '($1,234,567.89)'\n" +" >>> moneyfmt(Decimal(123456789), sep=' ')\n" +" '123 456 789.00'\n" +" >>> moneyfmt(Decimal('-0.02'), neg='<', trailneg='>')\n" +" '<0.02>'\n" +"\n" +" \"\"\"\n" +" q = Decimal(10) ** -places # 2 places --> '0.01'\n" +" sign, digits, exp = value.quantize(q).as_tuple()\n" +" result = []\n" +" digits = list(map(str, digits))\n" +" build, next = result.append, digits.pop\n" +" if sign:\n" +" build(trailneg)\n" +" for i in range(places):\n" +" build(next() if digits else '0')\n" +" if places:\n" +" build(dp)\n" +" if not digits:\n" +" build('0')\n" +" i = 0\n" +" while digits:\n" +" build(next())\n" +" i += 1\n" +" if i == 3 and digits:\n" +" i = 0\n" +" build(sep)\n" +" build(curr)\n" +" build(neg if sign else pos)\n" +" return ''.join(reversed(result))\n" +"\n" +"def pi():\n" +" \"\"\"Compute Pi to the current precision.\n" +"\n" +" >>> print(pi())\n" +" 3.141592653589793238462643383\n" +"\n" +" \"\"\"\n" +" getcontext().prec += 2 # extra digits for intermediate steps\n" +" three = Decimal(3) # substitute \"three=3.0\" for regular floats\n" +" lasts, t, s, n, na, d, da = 0, three, 3, 1, 0, 0, 24\n" +" while s != lasts:\n" +" lasts = s\n" +" n, na = n+na, na+8\n" +" d, da = d+da, da+32\n" +" t = (t * n) / d\n" +" s += t\n" +" getcontext().prec -= 2\n" +" return +s # unary plus applies the new precision\n" +"\n" +"def exp(x):\n" +" \"\"\"Return e raised to the power of x. Result type matches input " +"type.\n" +"\n" +" >>> print(exp(Decimal(1)))\n" +" 2.718281828459045235360287471\n" +" >>> print(exp(Decimal(2)))\n" +" 7.389056098930650227230427461\n" +" >>> print(exp(2.0))\n" +" 7.38905609893\n" +" >>> print(exp(2+0j))\n" +" (7.38905609893+0j)\n" +"\n" +" \"\"\"\n" +" getcontext().prec += 2\n" +" i, lasts, s, fact, num = 0, 0, 1, 1, 1\n" +" while s != lasts:\n" +" lasts = s\n" +" i += 1\n" +" fact *= i\n" +" num *= x\n" +" s += num / fact\n" +" getcontext().prec -= 2\n" +" return +s\n" +"\n" +"def cos(x):\n" +" \"\"\"Return the cosine of x as measured in radians.\n" +"\n" +" The Taylor series approximation works best for a small value of x.\n" +" For larger values, first compute x = x % (2 * pi).\n" +"\n" +" >>> print(cos(Decimal('0.5')))\n" +" 0.8775825618903727161162815826\n" +" >>> print(cos(0.5))\n" +" 0.87758256189\n" +" >>> print(cos(0.5+0j))\n" +" (0.87758256189+0j)\n" +"\n" +" \"\"\"\n" +" getcontext().prec += 2\n" +" i, lasts, s, fact, num, sign = 0, 0, 1, 1, 1, 1\n" +" while s != lasts:\n" +" lasts = s\n" +" i += 2\n" +" fact *= i * (i-1)\n" +" num *= x * x\n" +" sign *= -1\n" +" s += num / fact * sign\n" +" getcontext().prec -= 2\n" +" return +s\n" +"\n" +"def sin(x):\n" +" \"\"\"Return the sine of x as measured in radians.\n" +"\n" +" The Taylor series approximation works best for a small value of x.\n" +" For larger values, first compute x = x % (2 * pi).\n" +"\n" +" >>> print(sin(Decimal('0.5')))\n" +" 0.4794255386042030002732879352\n" +" >>> print(sin(0.5))\n" +" 0.479425538604\n" +" >>> print(sin(0.5+0j))\n" +" (0.479425538604+0j)\n" +"\n" +" \"\"\"\n" +" getcontext().prec += 2\n" +" i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1\n" +" while s != lasts:\n" +" lasts = s\n" +" i += 2\n" +" fact *= i * (i-1)\n" +" num *= x * x\n" +" sign *= -1\n" +" s += num / fact * sign\n" +" getcontext().prec -= 2\n" +" return +s" +msgstr "" + +#: library/decimal.rst:2101 msgid "Decimal FAQ" msgstr "" -#: library/decimal.rst:2014 +#: library/decimal.rst:2103 msgid "" -"Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " +"Q: It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " "to minimize typing when using the interactive interpreter?" msgstr "" -#: library/decimal.rst:2017 -msgid "A. Some users abbreviate the constructor to just a single letter:" +#: library/decimal.rst:2106 +msgid "A: Some users abbreviate the constructor to just a single letter:" msgstr "" -#: library/decimal.rst:2023 +#: library/decimal.rst:2112 msgid "" -"Q. In a fixed-point application with two decimal places, some inputs have " +"Q: In a fixed-point application with two decimal places, some inputs have " "many places and need to be rounded. Others are not supposed to have excess " "digits and need to be validated. What methods should be used?" msgstr "" -#: library/decimal.rst:2027 +#: library/decimal.rst:2116 msgid "" -"A. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal " +"A: The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal " "places. If the :const:`Inexact` trap is set, it is also useful for " "validation:" msgstr "" -#: library/decimal.rst:2045 +#: library/decimal.rst:2134 msgid "" -"Q. Once I have valid two place inputs, how do I maintain that invariant " +"Q: Once I have valid two place inputs, how do I maintain that invariant " "throughout an application?" msgstr "" -#: library/decimal.rst:2048 +#: library/decimal.rst:2137 msgid "" -"A. Some operations like addition, subtraction, and multiplication by an " +"A: Some operations like addition, subtraction, and multiplication by an " "integer will automatically preserve fixed point. Others operations, like " "division and non-integer multiplication, will change the number of decimal " "places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" -#: library/decimal.rst:2066 +#: library/decimal.rst:2155 msgid "" "In developing fixed-point applications, it is convenient to define functions " "to handle the :meth:`~Decimal.quantize` step:" msgstr "" -#: library/decimal.rst:2080 +#: library/decimal.rst:2169 msgid "" -"Q. There are many ways to express the same value. The numbers ``200``, " +"Q: There are many ways to express the same value. The numbers ``200``, " "``200.000``, ``2E2``, and ``.02E+4`` all have the same value at various " "precisions. Is there a way to transform them to a single recognizable " "canonical value?" msgstr "" -#: library/decimal.rst:2085 +#: library/decimal.rst:2174 msgid "" -"A. The :meth:`~Decimal.normalize` method maps all equivalent values to a " +"A: The :meth:`~Decimal.normalize` method maps all equivalent values to a " "single representative:" msgstr "" -#: library/decimal.rst:2092 -msgid "Q. When does rounding occur in a computation?" +#: library/decimal.rst:2181 +msgid "Q: When does rounding occur in a computation?" msgstr "" -#: library/decimal.rst:2094 +#: library/decimal.rst:2183 msgid "" -"A. It occurs *after* the computation. The philosophy of the decimal " +"A: It occurs *after* the computation. The philosophy of the decimal " "specification is that numbers are considered exact and are created " "independent of the current context. They can even have greater precision " "than current context. Computations process with those exact inputs and then " @@ -1941,90 +2520,126 @@ msgid "" "computation::" msgstr "" -#: library/decimal.rst:2112 +#: library/decimal.rst:2190 msgid "" -"Q. Some decimal values always print with exponential notation. Is there a " +">>> getcontext().prec = 5\n" +">>> pi = Decimal('3.1415926535') # More than 5 digits\n" +">>> pi # All digits are retained\n" +"Decimal('3.1415926535')\n" +">>> pi + 0 # Rounded after an addition\n" +"Decimal('3.1416')\n" +">>> pi - Decimal('0.00005') # Subtract unrounded numbers, then round\n" +"Decimal('3.1415')\n" +">>> pi + 0 - Decimal('0.00005'). # Intermediate values are rounded\n" +"Decimal('3.1416')" +msgstr "" + +#: library/decimal.rst:2201 +msgid "" +"Q: Some decimal values always print with exponential notation. Is there a " "way to get a non-exponential representation?" msgstr "" -#: library/decimal.rst:2115 +#: library/decimal.rst:2204 msgid "" -"A. For some values, exponential notation is the only way to express the " +"A: For some values, exponential notation is the only way to express the " "number of significant places in the coefficient. For example, expressing " "``5.0E+3`` as ``5000`` keeps the value constant but cannot show the " "original's two-place significance." msgstr "" -#: library/decimal.rst:2120 +#: library/decimal.rst:2209 msgid "" "If an application does not care about tracking significance, it is easy to " "remove the exponent and trailing zeroes, losing significance, but keeping " "the value unchanged:" msgstr "" -#: library/decimal.rst:2130 -msgid "Q. Is there a way to convert a regular float to a :class:`Decimal`?" +#: library/decimal.rst:2219 +msgid "Q: Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -#: library/decimal.rst:2132 +#: library/decimal.rst:2221 msgid "" -"A. Yes, any binary floating point number can be exactly expressed as a " +"A: Yes, any binary floating-point number can be exactly expressed as a " "Decimal though an exact conversion may take more precision than intuition " "would suggest:" msgstr "" -#: library/decimal.rst:2141 +#: library/decimal.rst:2225 msgid "" -"Q. Within a complex calculation, how can I make sure that I haven't gotten a " +">>> Decimal(math.pi)\n" +"Decimal('3.141592653589793115997963468544185161590576171875')" +msgstr "" + +#: library/decimal.rst:2230 +msgid "" +"Q: Within a complex calculation, how can I make sure that I haven't gotten a " "spurious result because of insufficient precision or rounding anomalies." msgstr "" -#: library/decimal.rst:2144 +#: library/decimal.rst:2233 msgid "" -"A. The decimal module makes it easy to test results. A best practice is to " +"A: The decimal module makes it easy to test results. A best practice is to " "re-run calculations using greater precision and with various rounding modes. " "Widely differing results indicate insufficient precision, rounding mode " "issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -#: library/decimal.rst:2149 +#: library/decimal.rst:2238 msgid "" -"Q. I noticed that context precision is applied to the results of operations " +"Q: I noticed that context precision is applied to the results of operations " "but not to the inputs. Is there anything to watch out for when mixing " "values of different precisions?" msgstr "" -#: library/decimal.rst:2153 +#: library/decimal.rst:2242 msgid "" -"A. Yes. The principle is that all values are considered to be exact and so " +"A: Yes. The principle is that all values are considered to be exact and so " "is the arithmetic on those values. Only the results are rounded. The " "advantage for inputs is that \"what you type is what you get\". A " "disadvantage is that the results can look odd if you forget that the inputs " "haven't been rounded:" msgstr "" -#: library/decimal.rst:2166 +#: library/decimal.rst:2247 +msgid "" +">>> getcontext().prec = 3\n" +">>> Decimal('3.104') + Decimal('2.104')\n" +"Decimal('5.21')\n" +">>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')\n" +"Decimal('5.20')" +msgstr "" + +#: library/decimal.rst:2255 msgid "" "The solution is either to increase precision or to force rounding of inputs " "using the unary plus operation:" msgstr "" -#: library/decimal.rst:2175 +#: library/decimal.rst:2258 +msgid "" +">>> getcontext().prec = 3\n" +">>> +Decimal('1.23456789') # unary plus triggers rounding\n" +"Decimal('1.23')" +msgstr "" + +#: library/decimal.rst:2264 msgid "" "Alternatively, inputs can be rounded upon creation using the :meth:`Context." "create_decimal` method:" msgstr "" -#: library/decimal.rst:2181 -msgid "Q. Is the CPython implementation fast for large numbers?" +#: library/decimal.rst:2270 +msgid "Q: Is the CPython implementation fast for large numbers?" msgstr "" -#: library/decimal.rst:2183 +#: library/decimal.rst:2272 msgid "" -"A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " +"A: Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " "the decimal module integrate the high speed `libmpdec `_ library for arbitrary precision " -"correctly rounded decimal floating point arithmetic [#]_. ``libmpdec`` uses " +"correctly rounded decimal floating-point arithmetic [#]_. ``libmpdec`` uses " "`Karatsuba multiplication `_ for medium-sized numbers and the `Number Theoretic " "Transform >> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))\n" +">>> x = Decimal(2) ** 256\n" +">>> x / 128\n" +"Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')" +msgstr "" + +#: library/decimal.rst:2295 +msgid "" +"For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms " "and the available memory will be insufficient::" msgstr "" -#: library/decimal.rst:2214 +#: library/decimal.rst:2298 +msgid "" +">>> Decimal(1) / 3\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"MemoryError" +msgstr "" + +#: library/decimal.rst:2303 msgid "" "On systems with overallocation (e.g. Linux), a more sophisticated approach " "is to adjust :attr:`~Context.prec` to the amount of available RAM. Suppose " @@ -2060,14 +2691,38 @@ msgid "" "of 500MB each::" msgstr "" -#: library/decimal.rst:2238 +#: library/decimal.rst:2307 +msgid "" +">>> import sys\n" +">>>\n" +">>> # Maximum number of digits for a single operand using 500MB in 8-byte " +"words\n" +">>> # with 19 digits per word (4-byte and 9 digits for the 32-bit build):\n" +">>> maxdigits = 19 * ((500 * 1024**2) // 8)\n" +">>>\n" +">>> # Check that this works:\n" +">>> c = Context(prec=maxdigits, Emax=MAX_EMAX, Emin=MIN_EMIN)\n" +">>> c.traps[Inexact] = True\n" +">>> setcontext(c)\n" +">>>\n" +">>> # Fill the available precision with nines:\n" +">>> x = Decimal(0).logical_invert() * 9\n" +">>> sys.getsizeof(x)\n" +"524288112\n" +">>> x + 2\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" decimal.Inexact: []" +msgstr "" + +#: library/decimal.rst:2327 msgid "" "In general (and especially on systems without overallocation), it is " "recommended to estimate even tighter bounds and set the :attr:`Inexact` trap " "if all calculations are expected to be exact." msgstr "" -#: library/decimal.rst:2247 +#: library/decimal.rst:2336 msgid "" "This approach now works for all exact results except for non-integer powers." msgstr "" diff --git a/library/development.po b/library/development.po index 5611a7a6..662c6548 100644 --- a/library/development.po +++ b/library/development.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-22 13:10+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/development.rst:5 msgid "Development Tools" -msgstr "" +msgstr "Εργαλεία Ανάπτυξης" #: library/development.rst:7 msgid "" @@ -26,10 +27,15 @@ msgid "" "the :mod:`pydoc` module takes a module and generates documentation based on " "the module's contents. The :mod:`doctest` and :mod:`unittest` modules " "contains frameworks for writing unit tests that automatically exercise code " -"and verify that the expected output is produced. :program:`2to3` can " -"translate Python 2.x source code into valid Python 3.x code." +"and verify that the expected output is produced." msgstr "" +"Τα modules που περιγράφονται σε αυτό το κεφάλαιο σας βοηθούν να γράψετε " +"λογισμικό. Για παράδειγμα, το module :mod:`pydoc` παίρνει ένα module και " +"δημιουργεί τεκμηρίωση βάσει του περιεχομένου του. Τα modules :mod:`doctest` " +"και :mod:`unittest` παρέχουν πλαίσια για τη συγγραφή ελέγχων μονάδας που " +"εκτελούν αυτόματα τον κώδικα και επαληθεύουν ότι παράγεται το αναμενόμενο " +"αποτέλεσμα." -#: library/development.rst:14 +#: library/development.rst:13 msgid "The list of modules described in this chapter is:" -msgstr "" +msgstr "Ο κατάλογος των modules που περιγράφονται σε αυτό το κεφάλαιο είναι:" diff --git a/library/devmode.po b/library/devmode.po index 4e94c793..4f55c37d 100644 --- a/library/devmode.po +++ b/library/devmode.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -48,6 +49,11 @@ msgid "" "but with additional effects described below::" msgstr "" +#: library/devmode.rst:24 +msgid "" +"PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler" +msgstr "" + #: library/devmode.rst:26 msgid "Effects of the Python Development Mode:" msgstr "" @@ -224,29 +230,82 @@ msgid "" "in the command line::" msgstr "" +#: library/devmode.rst:116 +msgid "" +"import sys\n" +"\n" +"def main():\n" +" fp = open(sys.argv[1])\n" +" nlines = len(fp.readlines())\n" +" print(nlines)\n" +" # The file is closed implicitly\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" +msgstr "" + #: library/devmode.rst:127 msgid "" "The script does not close the file explicitly. By default, Python does not " "emit any warning. Example using README.txt, which has 269 lines:" msgstr "" +#: library/devmode.rst:130 +msgid "" +"$ python script.py README.txt\n" +"269" +msgstr "" + #: library/devmode.rst:135 msgid "" "Enabling the Python Development Mode displays a :exc:`ResourceWarning` " "warning:" msgstr "" +#: library/devmode.rst:137 +msgid "" +"$ python -X dev script.py README.txt\n" +"269\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README." +"rst' mode='r' encoding='UTF-8'>\n" +" main()\n" +"ResourceWarning: Enable tracemalloc to get the object allocation traceback" +msgstr "" + #: library/devmode.rst:145 msgid "" "In addition, enabling :mod:`tracemalloc` shows the line where the file was " "opened:" msgstr "" +#: library/devmode.rst:148 +msgid "" +"$ python -X dev -X tracemalloc=5 script.py README.rst\n" +"269\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README." +"rst' mode='r' encoding='UTF-8'>\n" +" main()\n" +"Object allocated at (most recent call last):\n" +" File \"script.py\", lineno 10\n" +" main()\n" +" File \"script.py\", lineno 4\n" +" fp = open(sys.argv[1])" +msgstr "" + #: library/devmode.rst:160 msgid "" "The fix is to close explicitly the file. Example using a context manager::" msgstr "" +#: library/devmode.rst:162 +msgid "" +"def main():\n" +" # Close the file explicitly when exiting the with block\n" +" with open(sys.argv[1]) as fp:\n" +" nlines = len(fp.readlines())\n" +" print(nlines)" +msgstr "" + #: library/devmode.rst:168 msgid "" "Not closing a resource explicitly can leave a resource open for way longer " @@ -263,16 +322,52 @@ msgstr "" msgid "Script displaying the first line of itself::" msgstr "" +#: library/devmode.rst:179 +msgid "" +"import os\n" +"\n" +"def main():\n" +" fp = open(__file__)\n" +" firstline = fp.readline()\n" +" print(firstline.rstrip())\n" +" os.close(fp.fileno())\n" +" # The file is closed implicitly\n" +"\n" +"main()" +msgstr "" + #: library/devmode.rst:190 msgid "By default, Python does not emit any warning:" msgstr "" +#: library/devmode.rst:192 +msgid "" +"$ python script.py\n" +"import os" +msgstr "" + #: library/devmode.rst:197 msgid "" "The Python Development Mode shows a :exc:`ResourceWarning` and logs a \"Bad " "file descriptor\" error when finalizing the file object:" msgstr "" +#: library/devmode.rst:200 +msgid "" +"$ python -X dev script.py\n" +"import os\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='script." +"py' mode='r' encoding='UTF-8'>\n" +" main()\n" +"ResourceWarning: Enable tracemalloc to get the object allocation traceback\n" +"Exception ignored in: <_io.TextIOWrapper name='script.py' mode='r' " +"encoding='UTF-8'>\n" +"Traceback (most recent call last):\n" +" File \"script.py\", line 10, in \n" +" main()\n" +"OSError: [Errno 9] Bad file descriptor" +msgstr "" + #: library/devmode.rst:213 msgid "" "``os.close(fp.fileno())`` closes the file descriptor. When the file object " diff --git a/library/dialog.po b/library/dialog.po index ca40da54..c5d1ebcc 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/difflib.po b/library/difflib.po index 7906fea9..696c5720 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/difflib.rst:2 -msgid ":mod:`difflib` --- Helpers for computing deltas" +msgid ":mod:`!difflib` --- Helpers for computing deltas" msgstr "" #: library/difflib.rst:11 @@ -309,7 +310,7 @@ msgid "" "*linejunk*: A function that accepts a single string argument, and returns " "true if the string is junk, or false if not. The default is ``None``. There " "is also a module-level function :func:`IS_LINE_JUNK`, which filters out " -"lines without visible characters, except for at most one pound character " +"lines without visible characters, except for at most one hash character " "(``'#'``) -- however the underlying :class:`SequenceMatcher` class does a " "dynamic analysis of which lines are so frequent as to constitute noise, and " "this usually works better than using this function." @@ -401,17 +402,16 @@ msgid "" "for parameter *charjunk* in :func:`ndiff`." msgstr "" -#: library/difflib.rst:355 +#: library/difflib.rst:354 msgid "" -"`Pattern Matching: The Gestalt Approach `_" +"`Pattern Matching: The Gestalt Approach `_" msgstr "" #: library/difflib.rst:355 msgid "" "Discussion of a similar algorithm by John W. Ratcliff and D. E. Metzener. " -"This was published in `Dr. Dobb's Journal `_ in " -"July, 1988." +"This was published in Dr. Dobb's Journal in July, 1988." msgstr "" #: library/difflib.rst:362 @@ -431,6 +431,10 @@ msgid "" "ignored. For example, pass::" msgstr "" +#: library/difflib.rst:375 +msgid "lambda x: x in \" \\t\"" +msgstr "" + #: library/difflib.rst:377 msgid "" "if you're comparing lines as sequences of characters, and don't want to " @@ -553,6 +557,13 @@ msgid "" "triples always describe non-adjacent equal blocks." msgstr "" +#: library/difflib.rst:479 +msgid "" +">>> s = SequenceMatcher(None, \"abxcd\", \"abcd\")\n" +">>> s.get_matching_blocks()\n" +"[Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]" +msgstr "" + #: library/difflib.rst:488 msgid "" "Return list of 5-tuples describing how to turn *a* into *b*. Each tuple is " @@ -607,6 +618,21 @@ msgstr "" msgid "For example::" msgstr "" +#: library/difflib.rst:514 +msgid "" +">>> a = \"qabxcd\"\n" +">>> b = \"abycdf\"\n" +">>> s = SequenceMatcher(None, a, b)\n" +">>> for tag, i1, i2, j1, j2 in s.get_opcodes():\n" +"... print('{:7} a[{}:{}] --> b[{}:{}] {!r:>8} --> {!r}'.format(\n" +"... tag, i1, i2, j1, j2, a[i1:i2], b[j1:j2]))\n" +"delete a[0:1] --> b[0:0] 'q' --> ''\n" +"equal a[1:3] --> b[0:2] 'ab' --> 'ab'\n" +"replace a[3:4] --> b[2:3] 'x' --> 'y'\n" +"equal a[4:6] --> b[3:5] 'cd' --> 'cd'\n" +"insert a[6:6] --> b[5:6] '' --> 'f'" +msgstr "" + #: library/difflib.rst:529 msgid "Return a :term:`generator` of groups with up to *n* lines of context." msgstr "" @@ -647,6 +673,14 @@ msgid "" "arguments. For instance::" msgstr "" +#: library/difflib.rst:557 +msgid "" +">>> SequenceMatcher(None, 'tide', 'diet').ratio()\n" +"0.25\n" +">>> SequenceMatcher(None, 'diet', 'tide').ratio()\n" +"0.5" +msgstr "" + #: library/difflib.rst:565 msgid "Return an upper bound on :meth:`ratio` relatively quickly." msgstr "" @@ -707,8 +741,9 @@ msgstr "" #: library/difflib.rst:633 msgid "" -"`Simple version control recipe `_ for a small application built with :class:`SequenceMatcher`." +"`Simple version control recipe `_ for a small application built with :class:" +"`SequenceMatcher`." msgstr "" #: library/difflib.rst:641 @@ -820,6 +855,73 @@ msgid "" "This example shows how to use difflib to create a ``diff``-like utility." msgstr "" +#: library/difflib.rst:761 +msgid "" +"\"\"\" Command line interface to difflib.py providing diffs in four " +"formats:\n" +"\n" +"* ndiff: lists every line and highlights interline changes.\n" +"* context: highlights clusters of changes in a before/after format.\n" +"* unified: highlights clusters of changes in an inline format.\n" +"* html: generates side by side comparison with change highlights.\n" +"\n" +"\"\"\"\n" +"\n" +"import sys, os, difflib, argparse\n" +"from datetime import datetime, timezone\n" +"\n" +"def file_mtime(path):\n" +" t = datetime.fromtimestamp(os.stat(path).st_mtime,\n" +" timezone.utc)\n" +" return t.astimezone().isoformat()\n" +"\n" +"def main():\n" +"\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-c', action='store_true', default=False,\n" +" help='Produce a context format diff (default)')\n" +" parser.add_argument('-u', action='store_true', default=False,\n" +" help='Produce a unified format diff')\n" +" parser.add_argument('-m', action='store_true', default=False,\n" +" help='Produce HTML side by side diff '\n" +" '(can use -c and -l in conjunction)')\n" +" parser.add_argument('-n', action='store_true', default=False,\n" +" help='Produce a ndiff format diff')\n" +" parser.add_argument('-l', '--lines', type=int, default=3,\n" +" help='Set number of context lines (default 3)')\n" +" parser.add_argument('fromfile')\n" +" parser.add_argument('tofile')\n" +" options = parser.parse_args()\n" +"\n" +" n = options.lines\n" +" fromfile = options.fromfile\n" +" tofile = options.tofile\n" +"\n" +" fromdate = file_mtime(fromfile)\n" +" todate = file_mtime(tofile)\n" +" with open(fromfile) as ff:\n" +" fromlines = ff.readlines()\n" +" with open(tofile) as tf:\n" +" tolines = tf.readlines()\n" +"\n" +" if options.u:\n" +" diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, " +"fromdate, todate, n=n)\n" +" elif options.n:\n" +" diff = difflib.ndiff(fromlines, tolines)\n" +" elif options.m:\n" +" diff = difflib.HtmlDiff().make_file(fromlines,tolines,fromfile," +"tofile,context=options.c,numlines=n)\n" +" else:\n" +" diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, " +"fromdate, todate, n=n)\n" +"\n" +" sys.stdout.writelines(diff)\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" +msgstr "" + #: library/difflib.rst:764 msgid "ndiff example" msgstr "" @@ -827,3 +929,120 @@ msgstr "" #: library/difflib.rst:766 msgid "This example shows how to use :func:`difflib.ndiff`." msgstr "" + +#: library/difflib.rst:768 +msgid "" +"\"\"\"ndiff [-q] file1 file2\n" +" or\n" +"ndiff (-r1 | -r2) < ndiff_output > file1_or_file2\n" +"\n" +"Print a human-friendly file difference report to stdout. Both inter-\n" +"and intra-line differences are noted. In the second form, recreate file1\n" +"(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.\n" +"\n" +"In the first form, if -q (\"quiet\") is not specified, the first two lines\n" +"of output are\n" +"\n" +"-: file1\n" +"+: file2\n" +"\n" +"Each remaining line begins with a two-letter code:\n" +"\n" +" \"- \" line unique to file1\n" +" \"+ \" line unique to file2\n" +" \" \" line common to both files\n" +" \"? \" line not present in either input file\n" +"\n" +"Lines beginning with \"? \" attempt to guide the eye to intraline\n" +"differences, and were not present in either input file. These lines can be\n" +"confusing if the source files contain tab characters.\n" +"\n" +"The first file can be recovered by retaining only lines that begin with\n" +"\" \" or \"- \", and deleting those 2-character prefixes; use ndiff with -" +"r1.\n" +"\n" +"The second file can be recovered similarly, but by retaining only \" \" " +"and\n" +"\"+ \" lines; use ndiff with -r2; or, on Unix, the second file can be\n" +"recovered by piping the output through\n" +"\n" +" sed -n '/^[+ ] /s/^..//p'\n" +"\"\"\"\n" +"\n" +"__version__ = 1, 7, 0\n" +"\n" +"import difflib, sys\n" +"\n" +"def fail(msg):\n" +" out = sys.stderr.write\n" +" out(msg + \"\\n\\n\")\n" +" out(__doc__)\n" +" return 0\n" +"\n" +"# open a file & return the file object; gripe and return 0 if it\n" +"# couldn't be opened\n" +"def fopen(fname):\n" +" try:\n" +" return open(fname)\n" +" except IOError as detail:\n" +" return fail(\"couldn't open \" + fname + \": \" + str(detail))\n" +"\n" +"# open two files & spray the diff to stdout; return false iff a problem\n" +"def fcompare(f1name, f2name):\n" +" f1 = fopen(f1name)\n" +" f2 = fopen(f2name)\n" +" if not f1 or not f2:\n" +" return 0\n" +"\n" +" a = f1.readlines(); f1.close()\n" +" b = f2.readlines(); f2.close()\n" +" for line in difflib.ndiff(a, b):\n" +" print(line, end=' ')\n" +"\n" +" return 1\n" +"\n" +"# crack args (sys.argv[1:] is normal) & compare;\n" +"# return false iff a problem\n" +"\n" +"def main(args):\n" +" import getopt\n" +" try:\n" +" opts, args = getopt.getopt(args, \"qr:\")\n" +" except getopt.error as detail:\n" +" return fail(str(detail))\n" +" noisy = 1\n" +" qseen = rseen = 0\n" +" for opt, val in opts:\n" +" if opt == \"-q\":\n" +" qseen = 1\n" +" noisy = 0\n" +" elif opt == \"-r\":\n" +" rseen = 1\n" +" whichfile = val\n" +" if qseen and rseen:\n" +" return fail(\"can't specify both -q and -r\")\n" +" if rseen:\n" +" if args:\n" +" return fail(\"no args allowed with -r option\")\n" +" if whichfile in (\"1\", \"2\"):\n" +" restore(whichfile)\n" +" return 1\n" +" return fail(\"-r value must be 1 or 2\")\n" +" if len(args) != 2:\n" +" return fail(\"need 2 filename args\")\n" +" f1name, f2name = args\n" +" if noisy:\n" +" print('-:', f1name)\n" +" print('+:', f2name)\n" +" return fcompare(f1name, f2name)\n" +"\n" +"# read ndiff output from stdin, and print file1 (which=='1') or\n" +"# file2 (which=='2') to stdout\n" +"\n" +"def restore(which):\n" +" restored = difflib.restore(sys.stdin.readlines(), which)\n" +" sys.stdout.writelines(restored)\n" +"\n" +"if __name__ == '__main__':\n" +" main(sys.argv[1:])\n" +msgstr "" diff --git a/library/dis.po b/library/dis.po index 795f2b72..b0673096 100644 --- a/library/dis.po +++ b/library/dis.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/dis.rst:2 -msgid ":mod:`dis` --- Disassembler for Python bytecode" +msgid ":mod:`!dis` --- Disassembler for Python bytecode" msgstr "" #: library/dis.rst:7 @@ -77,68 +78,122 @@ msgid "" msgstr "" #: library/dis.rst:54 -msgid "Example: Given the function :func:`!myfunc`::" +msgid "" +"The output shows logical labels rather than instruction offsets for jump " +"targets and exception handlers. The ``-O`` command line option and the " +"``show_offsets`` argument were added." msgstr "" #: library/dis.rst:59 msgid "" +"The :option:`-P ` command-line option and the " +"``show_positions`` argument were added." +msgstr "" + +#: library/dis.rst:63 +msgid "The :option:`-S ` command-line option is added." +msgstr "" + +#: library/dis.rst:65 +msgid "Example: Given the function :func:`!myfunc`::" +msgstr "" + +#: library/dis.rst:67 +msgid "" +"def myfunc(alist):\n" +" return len(alist)" +msgstr "" + +#: library/dis.rst:70 +msgid "" "the following command can be used to display the disassembly of :func:`!" "myfunc`:" msgstr "" -#: library/dis.rst:72 +#: library/dis.rst:73 +msgid "" +">>> dis.dis(myfunc)\n" +" 2 RESUME 0\n" +"\n" +" 3 LOAD_GLOBAL 1 (len + NULL)\n" +" LOAD_FAST_BORROW 0 (alist)\n" +" CALL 1\n" +" RETURN_VALUE" +msgstr "" + +#: library/dis.rst:83 msgid "(The \"2\" is a line number)." msgstr "" -#: library/dis.rst:77 +#: library/dis.rst:88 msgid "Command-line interface" msgstr "" -#: library/dis.rst:79 +#: library/dis.rst:90 msgid "The :mod:`dis` module can be invoked as a script from the command line:" msgstr "" -#: library/dis.rst:85 +#: library/dis.rst:92 +msgid "python -m dis [-h] [-C] [-O] [-P] [-S] [infile]" +msgstr "" + +#: library/dis.rst:96 msgid "The following options are accepted:" msgstr "" -#: library/dis.rst:91 +#: library/dis.rst:102 msgid "Display usage and exit." msgstr "" -#: library/dis.rst:93 +#: library/dis.rst:106 +msgid "Show inline caches." +msgstr "" + +#: library/dis.rst:112 +msgid "Show offsets of instructions." +msgstr "" + +#: library/dis.rst:118 +msgid "Show positions of instructions in the source code." +msgstr "" + +#: library/dis.rst:124 +msgid "Show specialized bytecode." +msgstr "" + +#: library/dis.rst:128 msgid "" "If :file:`infile` is specified, its disassembled code will be written to " -"stdout. Otherwise, disassembly is performed on compiled source code recieved " +"stdout. Otherwise, disassembly is performed on compiled source code received " "from stdin." msgstr "" -#: library/dis.rst:97 +#: library/dis.rst:132 msgid "Bytecode analysis" msgstr "" -#: library/dis.rst:101 +#: library/dis.rst:136 msgid "" "The bytecode analysis API allows pieces of Python code to be wrapped in a :" "class:`Bytecode` object that provides easy access to details of the compiled " "code." msgstr "" -#: library/dis.rst:108 +#: library/dis.rst:144 msgid "" "Analyse the bytecode corresponding to a function, generator, asynchronous " "generator, coroutine, method, string of source code, or a code object (as " "returned by :func:`compile`)." msgstr "" -#: library/dis.rst:112 +#: library/dis.rst:148 msgid "" "This is a convenience wrapper around many of the functions listed below, " "most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " "instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -#: library/dis.rst:304 +#: library/dis.rst:373 msgid "" "If *first_line* is not ``None``, it indicates the line number that should be " "reported for the first source line in the disassembled code. Otherwise, the " @@ -146,68 +201,101 @@ msgid "" "code object." msgstr "" -#: library/dis.rst:121 +#: library/dis.rst:157 msgid "" "If *current_offset* is not ``None``, it refers to an instruction offset in " "the disassembled code. Setting this means :meth:`.dis` will display a " "\"current instruction\" marker against the specified opcode." msgstr "" -#: library/dis.rst:125 +#: library/dis.rst:161 msgid "" "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " "used by the interpreter to specialize the bytecode." msgstr "" -#: library/dis.rst:128 +#: library/dis.rst:164 msgid "" "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: library/dis.rst:133 +#: library/dis.rst:167 +msgid "" +"If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " +"in the output." +msgstr "" + +#: library/dis.rst:170 +msgid "" +"If *show_positions* is ``True``, :meth:`.dis` will include instruction " +"source code positions in the output." +msgstr "" + +#: library/dis.rst:175 msgid "" "Construct a :class:`Bytecode` instance from the given traceback, setting " "*current_offset* to the instruction responsible for the exception." msgstr "" -#: library/dis.rst:138 +#: library/dis.rst:180 msgid "The compiled code object." msgstr "" -#: library/dis.rst:142 +#: library/dis.rst:184 msgid "The first source line of the code object (if available)" msgstr "" -#: library/dis.rst:146 +#: library/dis.rst:188 msgid "" "Return a formatted view of the bytecode operations (the same as printed by :" "func:`dis.dis`, but returned as a multi-line string)." msgstr "" -#: library/dis.rst:151 +#: library/dis.rst:193 msgid "" "Return a formatted multi-line string with detailed information about the " "code object, like :func:`code_info`." msgstr "" -#: library/dis.rst:194 library/dis.rst:246 +#: library/dis.rst:242 library/dis.rst:295 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" -#: library/dis.rst:249 library/dis.rst:292 library/dis.rst:313 +#: library/dis.rst:298 library/dis.rst:356 library/dis.rst:382 msgid "Added the *show_caches* and *adaptive* parameters." msgstr "" -#: library/dis.rst:160 +#: library/dis.rst:202 +msgid "Added the *show_offsets* parameter" +msgstr "" + +#: library/dis.rst:304 library/dis.rst:362 +msgid "Added the *show_positions* parameter." +msgstr "" + +#: library/dis.rst:208 msgid "Example:" msgstr "" -#: library/dis.rst:176 +#: library/dis.rst:210 +msgid "" +">>> bytecode = dis.Bytecode(myfunc)\n" +">>> for instr in bytecode:\n" +"... print(instr.opname)\n" +"...\n" +"RESUME\n" +"LOAD_GLOBAL\n" +"LOAD_FAST_BORROW\n" +"CALL\n" +"RETURN_VALUE" +msgstr "" + +#: library/dis.rst:224 msgid "Analysis functions" msgstr "" -#: library/dis.rst:178 +#: library/dis.rst:226 msgid "" "The :mod:`dis` module also defines the following analysis functions that " "convert the input directly to the desired output. They can be useful if only " @@ -215,38 +303,38 @@ msgid "" "isn't useful:" msgstr "" -#: library/dis.rst:184 +#: library/dis.rst:232 msgid "" "Return a formatted multi-line string with detailed code object information " "for the supplied function, generator, asynchronous generator, coroutine, " "method, source code string or code object." msgstr "" -#: library/dis.rst:188 +#: library/dis.rst:236 msgid "" "Note that the exact contents of code info strings are highly implementation " "dependent and they may change arbitrarily across Python VMs or Python " "releases." msgstr "" -#: library/dis.rst:200 +#: library/dis.rst:248 msgid "" "Print detailed code object information for the supplied function, method, " "source code string or code object to *file* (or ``sys.stdout`` if *file* is " "not specified)." msgstr "" -#: library/dis.rst:204 +#: library/dis.rst:252 msgid "" "This is a convenient shorthand for ``print(code_info(x), file=file)``, " "intended for interactive exploration at the interpreter prompt." msgstr "" -#: library/dis.rst:240 library/dis.rst:289 +#: library/dis.rst:289 library/dis.rst:353 msgid "Added *file* parameter." msgstr "" -#: library/dis.rst:215 +#: library/dis.rst:264 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -262,99 +350,113 @@ msgid "" "disassembles the last traceback." msgstr "" -#: library/dis.rst:259 library/dis.rst:286 +#: library/dis.rst:314 library/dis.rst:350 msgid "" "The disassembly is written as text to the supplied *file* argument if " "provided and to ``sys.stdout`` otherwise." msgstr "" -#: library/dis.rst:231 +#: library/dis.rst:280 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" -#: library/dis.rst:234 +#: library/dis.rst:283 msgid "" "If *show_caches* is ``True``, this function will display inline cache " "entries used by the interpreter to specialize the bytecode." msgstr "" -#: library/dis.rst:237 +#: library/dis.rst:286 msgid "" "If *adaptive* is ``True``, this function will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: library/dis.rst:243 +#: library/dis.rst:292 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" -#: library/dis.rst:255 +#: library/dis.rst:323 library/dis.rst:359 +msgid "Added the *show_offsets* parameter." +msgstr "" + +#: library/dis.rst:310 msgid "" "Disassemble the top-of-stack function of a traceback, using the last " "traceback if none was passed. The instruction causing the exception is " "indicated." msgstr "" -#: library/dis.rst:272 +#: library/dis.rst:334 msgid "" "Disassemble a code object, indicating the last instruction if *lasti* was " "provided. The output is divided in the following columns:" msgstr "" -#: library/dis.rst:275 -msgid "the line number, for the first instruction of each line" +#: library/dis.rst:337 +msgid "" +"the source code location of the instruction. Complete location information " +"is shown if *show_positions* is true. Otherwise (the default) only the line " +"number is displayed." msgstr "" -#: library/dis.rst:276 +#: library/dis.rst:340 msgid "the current instruction, indicated as ``-->``," msgstr "" -#: library/dis.rst:277 +#: library/dis.rst:341 msgid "a labelled instruction, indicated with ``>>``," msgstr "" -#: library/dis.rst:278 +#: library/dis.rst:342 msgid "the address of the instruction," msgstr "" -#: library/dis.rst:279 +#: library/dis.rst:343 msgid "the operation code name," msgstr "" -#: library/dis.rst:280 +#: library/dis.rst:344 msgid "operation parameters, and" msgstr "" -#: library/dis.rst:281 +#: library/dis.rst:345 msgid "interpretation of the parameters in parentheses." msgstr "" -#: library/dis.rst:283 +#: library/dis.rst:347 msgid "" "The parameter interpretation recognizes local and global variable names, " "constant values, branch targets, and compare operators." msgstr "" -#: library/dis.rst:298 +#: library/dis.rst:367 msgid "" "Return an iterator over the instructions in the supplied function, method, " "source code string or code object." msgstr "" -#: library/dis.rst:301 +#: library/dis.rst:370 msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -#: library/dis.rst:309 +#: library/dis.rst:378 +msgid "The *adaptive* parameter works as it does in :func:`dis`." +msgstr "" + +#: library/dis.rst:385 msgid "" -"The *show_caches* and *adaptive* parameters work as they do in :func:`dis`." +"The *show_caches* parameter is deprecated and has no effect. The iterator " +"generates the :class:`Instruction` instances with the *cache_info* field " +"populated (regardless of the value of *show_caches*) and it no longer " +"generates separate items for the cache entries." msgstr "" -#: library/dis.rst:319 +#: library/dis.rst:393 msgid "" "This generator function uses the :meth:`~codeobject.co_lines` method of the :" "ref:`code object ` *code* to find the offsets which are starts " @@ -362,28 +464,33 @@ msgid "" "pairs." msgstr "" -#: library/dis.rst:324 +#: library/dis.rst:398 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -#: library/dis.rst:327 +#: library/dis.rst:401 msgid "" "The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :" "attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "attributes of the :ref:`code object `." msgstr "" -#: library/dis.rst:335 +#: library/dis.rst:406 +msgid "" +"Line numbers can be ``None`` for bytecode that does not map to source lines." +msgstr "" + +#: library/dis.rst:412 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" -#: library/dis.rst:341 +#: library/dis.rst:418 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -#: library/dis.rst:343 +#: library/dis.rst:420 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " @@ -391,122 +498,215 @@ msgid "" "it will return the maximal stack effect of both cases." msgstr "" -#: library/dis.rst:350 +#: library/dis.rst:427 msgid "Added *jump* parameter." msgstr "" -#: library/dis.rst:357 +#: library/dis.rst:430 +msgid "" +"If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " +"``oparg=0``. Previously this was an error for opcodes that use their arg. It " +"is also no longer an error to pass an integer ``oparg`` when the ``opcode`` " +"does not use it; the ``oparg`` in this case is ignored." +msgstr "" + +#: library/dis.rst:440 msgid "Python Bytecode Instructions" msgstr "" -#: library/dis.rst:359 +#: library/dis.rst:442 msgid "" "The :func:`get_instructions` function and :class:`Bytecode` class provide " "details of bytecode instructions as :class:`Instruction` instances:" msgstr "" -#: library/dis.rst:364 +#: library/dis.rst:447 msgid "Details for a bytecode operation" msgstr "" -#: library/dis.rst:368 +#: library/dis.rst:451 msgid "" "numeric code for operation, corresponding to the opcode values listed below " "and the bytecode values in the :ref:`opcode_collections`." msgstr "" -#: library/dis.rst:374 +#: library/dis.rst:457 msgid "human readable name for operation" msgstr "" -#: library/dis.rst:379 +#: library/dis.rst:462 +msgid "" +"numeric code for the base operation if operation is specialized; otherwise " +"equal to :data:`opcode`" +msgstr "" + +#: library/dis.rst:468 +msgid "" +"human readable name for the base operation if operation is specialized; " +"otherwise equal to :data:`opname`" +msgstr "" + +#: library/dis.rst:474 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" -#: library/dis.rst:384 +#: library/dis.rst:478 +msgid "alias for :data:`arg`" +msgstr "" + +#: library/dis.rst:482 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -#: library/dis.rst:389 +#: library/dis.rst:487 msgid "" "human readable description of operation argument (if any), otherwise an " "empty string." msgstr "" -#: library/dis.rst:395 +#: library/dis.rst:493 msgid "start index of operation within bytecode sequence" msgstr "" -#: library/dis.rst:400 -msgid "line started by this opcode (if any), otherwise ``None``" +#: library/dis.rst:498 +msgid "" +"start index of operation within bytecode sequence, including prefixed " +"``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" +msgstr "" + +#: library/dis.rst:504 +msgid "start index of the cache entries following the operation" +msgstr "" + +#: library/dis.rst:509 +msgid "end index of the cache entries following the operation" +msgstr "" + +#: library/dis.rst:514 +msgid "``True`` if this opcode starts a source line, otherwise ``False``" +msgstr "" + +#: library/dis.rst:519 +msgid "" +"source line number associated with this opcode (if any), otherwise ``None``" msgstr "" -#: library/dis.rst:405 +#: library/dis.rst:524 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -#: library/dis.rst:410 +#: library/dis.rst:529 +msgid "" +"bytecode index of the jump target if this is a jump operation, otherwise " +"``None``" +msgstr "" + +#: library/dis.rst:535 msgid "" ":class:`dis.Positions` object holding the start and end locations that are " "covered by this instruction." msgstr "" -#: library/dis.rst:417 +#: library/dis.rst:540 +msgid "" +"Information about the cache entries of this instruction, as triplets of the " +"form ``(name, size, data)``, where the ``name`` and ``size`` describe the " +"cache format and data is the contents of the cache. ``cache_info`` is " +"``None`` if the instruction does not have caches." +msgstr "" + +#: library/dis.rst:550 msgid "Field ``positions`` is added." msgstr "" -#: library/dis.rst:422 +#: library/dis.rst:554 +msgid "Changed field ``starts_line``." +msgstr "" + +#: library/dis.rst:556 +msgid "" +"Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " +"``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " +"and ``cache_info``." +msgstr "" + +#: library/dis.rst:563 msgid "" "In case the information is not available, some fields might be ``None``." msgstr "" -#: library/dis.rst:432 +#: library/dis.rst:573 msgid "" "The Python compiler currently generates the following bytecode instructions." msgstr "" -#: library/dis.rst:435 +#: library/dis.rst:576 msgid "**General instructions**" msgstr "" -#: library/dis.rst:437 +#: library/dis.rst:578 msgid "" "In the following, We will refer to the interpreter stack as ``STACK`` and " "describe operations on it as if it was a Python list. The top of the stack " "corresponds to ``STACK[-1]`` in this language." msgstr "" -#: library/dis.rst:443 +#: library/dis.rst:584 msgid "" "Do nothing code. Used as a placeholder by the bytecode optimizer, and to " "generate line tracing events." msgstr "" -#: library/dis.rst:449 +#: library/dis.rst:590 +msgid "" +"Do nothing code. Used by the interpreter to record :monitoring-event:" +"`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events for :mod:`sys." +"monitoring`." +msgstr "" + +#: library/dis.rst:599 +msgid "Removes the iterator from the top of the stack." +msgstr "" + +#: library/dis.rst:606 msgid "Removes the top-of-stack item::" msgstr "" -#: library/dis.rst:456 +#: library/dis.rst:608 +msgid "STACK.pop()" +msgstr "" + +#: library/dis.rst:613 msgid "" -"Removes the top two values from the stack. Equivalent to ``POP_TOP``; " -"``POP_TOP``. Used to clean up at the end of loops, hence the name." +"Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " +"at the end of loops, hence the name." msgstr "" -#: library/dis.rst:465 +#: library/dis.rst:622 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: library/dis.rst:473 +#: library/dis.rst:630 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: library/dis.rst:484 +#: library/dis.rst:633 +msgid "" +"assert i > 0\n" +"STACK.append(STACK[-i])" +msgstr "" + +#: library/dis.rst:641 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: library/dis.rst:493 +#: library/dis.rst:643 +msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" +msgstr "" + +#: library/dis.rst:650 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " @@ -514,87 +714,139 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: library/dis.rst:498 +#: library/dis.rst:655 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" -#: library/dis.rst:502 +#: library/dis.rst:659 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" -#: library/dis.rst:509 +#: library/dis.rst:666 msgid "**Unary operations**" msgstr "" -#: library/dis.rst:511 +#: library/dis.rst:668 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: library/dis.rst:517 +#: library/dis.rst:674 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "" -#: library/dis.rst:522 +#: library/dis.rst:679 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "" -#: library/dis.rst:527 +#: library/dis.rst:1383 library/dis.rst:1399 +msgid "This instruction now requires an exact :class:`bool` operand." +msgstr "" + +#: library/dis.rst:687 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "" -#: library/dis.rst:532 +#: library/dis.rst:692 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: library/dis.rst:537 +#: library/dis.rst:697 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: library/dis.rst:543 +#: library/dis.rst:705 +msgid "Implements ``STACK[-1] = bool(STACK[-1])``." +msgstr "" + +#: library/dis.rst:710 msgid "**Binary and in-place operations**" msgstr "" -#: library/dis.rst:545 +#: library/dis.rst:712 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" -#: library/dis.rst:548 +#: library/dis.rst:715 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" -#: library/dis.rst:555 +#: library/dis.rst:722 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: library/dis.rst:576 library/dis.rst:594 library/dis.rst:694 -#: library/dis.rst:714 library/dis.rst:945 library/dis.rst:1057 -#: library/dis.rst:1069 +#: library/dis.rst:725 +msgid "" +"rhs = STACK.pop()\n" +"lhs = STACK.pop()\n" +"STACK.append(lhs op rhs)" +msgstr "" + +#: library/dis.rst:730 +msgid "" +"With oparg :``NB_SUBSCR``, implements binary subscript (replaces opcode " +"``BINARY_SUBSCR``)" +msgstr "" + +#: library/dis.rst:746 library/dis.rst:766 library/dis.rst:854 +#: library/dis.rst:1070 library/dis.rst:1226 library/dis.rst:1250 msgid "Implements::" msgstr "" -#: library/dis.rst:617 +#: library/dis.rst:738 +msgid "" +"key = STACK.pop()\n" +"container = STACK.pop()\n" +"value = STACK.pop()\n" +"container[key] = value" +msgstr "" + +#: library/dis.rst:748 +msgid "" +"key = STACK.pop()\n" +"container = STACK.pop()\n" +"del container[key]" +msgstr "" + +#: library/dis.rst:756 +msgid "" +"end = STACK.pop()\n" +"start = STACK.pop()\n" +"container = STACK.pop()\n" +"STACK.append(container[start:end])" +msgstr "" + +#: library/dis.rst:768 +msgid "" +"end = STACK.pop()\n" +"start = STACK.pop()\n" +"container = STACK.pop()\n" +"values = STACK.pop()\n" +"container[start:end] = value" +msgstr "" + +#: library/dis.rst:777 msgid "**Coroutine opcodes**" msgstr "" -#: library/dis.rst:621 +#: library/dis.rst:781 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -602,39 +854,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: library/dis.rst:626 +#: library/dis.rst:786 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: library/dis.rst:629 +#: library/dis.rst:789 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: library/dis.rst:630 +#: library/dis.rst:790 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: library/dis.rst:634 +#: library/dis.rst:794 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: library/dis.rst:640 +#: library/dis.rst:800 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: library/dis.rst:643 +#: library/dis.rst:803 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: library/dis.rst:650 +#: library/dis.rst:810 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: library/dis.rst:658 +#: library/dis.rst:818 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " @@ -642,12 +894,12 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: library/dis.rst:770 library/dis.rst:781 +#: library/dis.rst:916 library/dis.rst:927 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: library/dis.rst:671 +#: library/dis.rst:831 msgid "" "Handles an exception raised during a :meth:`~generator.throw` or :meth:" "`~generator.close` call through the current frame. If ``STACK[-1]`` is an " @@ -655,35 +907,48 @@ msgid "" "its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: library/dis.rst:681 -msgid "" -"Resolves ``__aenter__`` and ``__aexit__`` from ``STACK[-1]``. Pushes " -"``__aexit__`` and result of ``__aenter__()`` to the stack::" +#: library/dis.rst:840 +msgid "**Miscellaneous opcodes**" msgstr "" -#: library/dis.rst:690 -msgid "**Miscellaneous opcodes**" +#: library/dis.rst:846 +msgid "" +"item = STACK.pop()\n" +"set.add(STACK[-i], item)" msgstr "" -#: library/dis.rst:699 +#: library/dis.rst:849 msgid "Used to implement set comprehensions." msgstr "" -#: library/dis.rst:709 +#: library/dis.rst:856 +msgid "" +"item = STACK.pop()\n" +"list.append(STACK[-i], item)" +msgstr "" + +#: library/dis.rst:859 msgid "Used to implement list comprehensions." msgstr "" -#: library/dis.rst:720 +#: library/dis.rst:866 +msgid "" +"value = STACK.pop()\n" +"key = STACK.pop()\n" +"dict.__setitem__(STACK[-i], key, value)" +msgstr "" + +#: library/dis.rst:870 msgid "Used to implement dict comprehensions." msgstr "" -#: library/dis.rst:723 +#: library/dis.rst:873 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: library/dis.rst:727 +#: library/dis.rst:877 msgid "" "For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" "`MAP_ADD` instructions, while the added value or key/value pair is popped " @@ -691,29 +956,31 @@ msgid "" "further iterations of the loop." msgstr "" -#: library/dis.rst:735 +#: library/dis.rst:885 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: library/dis.rst:740 -msgid "Returns with ``co_consts[consti]`` to the caller of the function." -msgstr "" - -#: library/dis.rst:747 +#: library/dis.rst:890 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: library/dis.rst:749 +#: library/dis.rst:892 msgid "oparg set to be the stack depth." msgstr "" -#: library/dis.rst:752 +#: library/dis.rst:895 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: library/dis.rst:758 +#: library/dis.rst:898 +msgid "" +"oparg is ``1`` if this instruction is part of a yield-from or await, and " +"``0`` otherwise." +msgstr "" + +#: library/dis.rst:904 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -721,39 +988,39 @@ msgid "" "statically." msgstr "" -#: library/dis.rst:768 +#: library/dis.rst:914 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: library/dis.rst:775 +#: library/dis.rst:921 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " "pops an additional value from the stack which is used to set :attr:`~frame." "f_lasti` of the current frame." msgstr "" -#: library/dis.rst:786 +#: library/dis.rst:932 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" -#: library/dis.rst:794 +#: library/dis.rst:940 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" -#: library/dis.rst:802 +#: library/dis.rst:948 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: library/dis.rst:805 +#: library/dis.rst:951 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " @@ -761,7 +1028,7 @@ msgid "" "``None``." msgstr "" -#: library/dis.rst:814 +#: library/dis.rst:960 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " @@ -769,38 +1036,32 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: library/dis.rst:821 +#: library/dis.rst:967 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: library/dis.rst:828 +#: library/dis.rst:974 msgid "" -"Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` " -"statement." +"Pushes a common constant onto the stack. The interpreter contains a " +"hardcoded list of constants supported by this instruction. Used by the :" +"keyword:`assert` statement to load :exc:`AssertionError`." msgstr "" -#: library/dis.rst:836 +#: library/dis.rst:983 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: library/dis.rst:842 +#: library/dis.rst:988 msgid "" -"This opcode performs several operations before a with block starts. First, " -"it loads :meth:`~object.__exit__` from the context manager and pushes it " -"onto the stack for later use by :opcode:`WITH_EXCEPT_START`. Then, :meth:" -"`~object.__enter__` is called. Finally, the result of calling the " -"``__enter__()`` method is pushed onto the stack." -msgstr "" - -#: library/dis.rst:853 -msgid "Perform ``STACK.append(len(STACK[-1]))``." +"Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " +"statements where comparison with structure of pattern is needed." msgstr "" -#: library/dis.rst:860 +#: library/dis.rst:996 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -808,7 +1069,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: library/dis.rst:870 +#: library/dis.rst:1006 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -817,20 +1078,20 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: library/dis.rst:880 +#: library/dis.rst:1016 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " "subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" "class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" -#: library/dis.rst:1513 +#: library/dis.rst:1768 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: library/dis.rst:893 +#: library/dis.rst:1029 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `." msgstr "" -#: library/dis.rst:906 +#: library/dis.rst:1042 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: library/dis.rst:915 +#: library/dis.rst:1045 +msgid "" +"assert(len(STACK[-1]) == count)\n" +"STACK.extend(STACK.pop()[:-count-1:-1])" +msgstr "" + +#: library/dis.rst:1051 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -858,11 +1125,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: library/dis.rst:920 +#: library/dis.rst:1056 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: library/dis.rst:922 +#: library/dis.rst:1058 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -871,50 +1138,68 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: library/dis.rst:928 +#: library/dis.rst:1064 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: library/dis.rst:940 +#: library/dis.rst:1072 +msgid "" +"obj = STACK.pop()\n" +"value = STACK.pop()\n" +"obj.name = value" +msgstr "" + +#: library/dis.rst:1076 msgid "" "where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: library/dis.rst:950 +#: library/dis.rst:1083 +msgid "" +"obj = STACK.pop()\n" +"del obj.name" +msgstr "" + +#: library/dis.rst:1086 msgid "" "where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: library/dis.rst:956 +#: library/dis.rst:1092 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: library/dis.rst:961 +#: library/dis.rst:1097 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: library/dis.rst:966 +#: library/dis.rst:1102 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: library/dis.rst:971 +#: library/dis.rst:1107 +msgid "" +"Pushes the integer ``i`` onto the stack. ``i`` must be in ``range(256)``" +msgstr "" + +#: library/dis.rst:1115 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: library/dis.rst:977 +#: library/dis.rst:1121 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " "prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" "opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: library/dis.rst:986 +#: library/dis.rst:1130 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -923,133 +1208,225 @@ msgid "" "bodies." msgstr "" -#: library/dis.rst:997 +#: library/dis.rst:1141 +msgid "" +"Constructs a new :class:`~string.templatelib.Template` instance from a tuple " +"of strings and a tuple of interpolations and pushes the resulting object " +"onto the stack::" +msgstr "" + +#: library/dis.rst:1145 +msgid "" +"interpolations = STACK.pop()\n" +"strings = STACK.pop()\n" +"STACK.append(_build_template(strings, interpolations))" +msgstr "" + +#: library/dis.rst:1154 +msgid "" +"Constructs a new :class:`~string.templatelib.Interpolation` instance from a " +"value and its source expression and pushes the resulting object onto the " +"stack." +msgstr "" + +#: library/dis.rst:1158 +msgid "" +"If no conversion or format specification is present, ``format`` is set to " +"``2``." +msgstr "" + +#: library/dis.rst:1161 +msgid "" +"If the low bit of ``format`` is set, it indicates that the interpolation " +"contains a format specification." +msgstr "" + +#: library/dis.rst:1164 +msgid "" +"If ``format >> 2`` is non-zero, it indicates that the interpolation contains " +"a conversion. The value of ``format >> 2`` is the conversion type (``0`` for " +"no conversion, ``1`` for ``!s``, ``2`` for ``!r``, and ``3`` for ``!a``)::" +msgstr "" + +#: library/dis.rst:1169 +msgid "" +"conversion = format >> 2\n" +"if format & 1:\n" +" format_spec = STACK.pop()\n" +"else:\n" +" format_spec = None\n" +"expression = STACK.pop()\n" +"value = STACK.pop()\n" +"STACK.append(_build_interpolation(value, expression, conversion, " +"format_spec))" +msgstr "" + +#: library/dis.rst:1183 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " -"resulting tuple onto the stack.::" +"resulting tuple onto the stack::" +msgstr "" + +#: library/dis.rst:1186 +msgid "" +"if count == 0:\n" +" value = ()\n" +"else:\n" +" value = tuple(STACK[-count:])\n" +" STACK = STACK[:-count]\n" +"\n" +"STACK.append(value)" msgstr "" -#: library/dis.rst:1007 +#: library/dis.rst:1197 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: library/dis.rst:1012 +#: library/dis.rst:1202 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: library/dis.rst:1017 +#: library/dis.rst:1207 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: library/dis.rst:1021 +#: library/dis.rst:1211 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: library/dis.rst:1028 +#: library/dis.rst:1218 msgid "" -"The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " -"top element on the stack which contains a tuple of keys, then starting from " -"``STACK[-2]``, pops *count* values to form values in the built dictionary." +"Concatenates *count* strings from the stack and pushes the resulting string " +"onto the stack." msgstr "" -#: library/dis.rst:1037 +#: library/dis.rst:1228 msgid "" -"Concatenates *count* strings from the stack and pushes the resulting string " -"onto the stack." +"seq = STACK.pop()\n" +"list.extend(STACK[-i], seq)" msgstr "" -#: library/dis.rst:1050 +#: library/dis.rst:1231 msgid "Used to build lists." msgstr "" -#: library/dis.rst:1062 +#: library/dis.rst:1240 +msgid "" +"seq = STACK.pop()\n" +"set.update(STACK[-i], seq)" +msgstr "" + +#: library/dis.rst:1243 msgid "Used to build sets." msgstr "" -#: library/dis.rst:1074 +#: library/dis.rst:1252 +msgid "" +"map = STACK.pop()\n" +"dict.update(STACK[-i], map)" +msgstr "" + +#: library/dis.rst:1255 msgid "Used to build dicts." msgstr "" -#: library/dis.rst:1081 +#: library/dis.rst:1262 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: library/dis.rst:1088 +#: library/dis.rst:1269 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: library/dis.rst:1091 +#: library/dis.rst:1272 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " "popped. This bytecode distinguishes two cases: if ``STACK[-1]`` has a method " "with the correct name, the bytecode pushes the unbound method and " "``STACK[-1]``. ``STACK[-1]`` will be used as the first argument (``self``) " -"by :opcode:`CALL` when calling the unbound method. Otherwise, ``NULL`` and " -"the object returned by the attribute lookup are pushed." +"by :opcode:`CALL` or :opcode:`CALL_KW` when calling the unbound method. " +"Otherwise, ``NULL`` and the object returned by the attribute lookup are " +"pushed." msgstr "" -#: library/dis.rst:1099 +#: library/dis.rst:1281 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: library/dis.rst:1106 +#: library/dis.rst:1288 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: library/dis.rst:1110 -msgid "" -"It pops three values from the stack (from top of stack down): - ``self``: " -"the first argument to the current method - ``cls``: the class within which " -"the current method was defined - the global ``super``" +#: library/dis.rst:1292 +msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: library/dis.rst:1115 +#: library/dis.rst:1294 +msgid "``self``: the first argument to the current method" +msgstr "" + +#: library/dis.rst:1295 +msgid "``cls``: the class within which the current method was defined" +msgstr "" + +#: library/dis.rst:1296 +msgid "the global ``super``" +msgstr "" + +#: library/dis.rst:1298 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: library/dis.rst:1118 +#: library/dis.rst:1301 msgid "" "The low bit of ``namei`` signals to attempt a method load, as with :opcode:" -"`LOAD_ATTR`, which results in pushing ``None`` and the loaded method. When " +"`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " "it is unset a single value is pushed to the stack." msgstr "" -#: library/dis.rst:1122 +#: library/dis.rst:1305 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: library/dis.rst:1130 +#: library/dis.rst:1313 msgid "" "Performs a Boolean operation. The operation name can be found in " -"``cmp_op[opname]``." +"``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " +"(``opname & 16``), the result should be coerced to ``bool``." +msgstr "" + +#: library/dis.rst:1317 +msgid "" +"The fifth-lowest bit of the oparg now indicates a forced conversion to :" +"class:`bool`." msgstr "" -#: library/dis.rst:1136 +#: library/dis.rst:1324 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: library/dis.rst:1143 +#: library/dis.rst:1331 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: library/dis.rst:1150 +#: library/dis.rst:1338 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " "popped and provide the *fromlist* and *level* arguments of :func:" @@ -1058,67 +1435,61 @@ msgid "" "opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: library/dis.rst:1158 +#: library/dis.rst:1346 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: library/dis.rst:1165 +#: library/dis.rst:1353 msgid "Increments bytecode counter by *delta*." msgstr "" -#: library/dis.rst:1170 +#: library/dis.rst:1358 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: library/dis.rst:1177 +#: library/dis.rst:1365 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: library/dis.rst:1184 +#: library/dis.rst:1372 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: library/dis.rst:1200 +#: library/dis.rst:1391 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: library/dis.rst:1205 library/dis.rst:1232 +#: library/dis.rst:1396 library/dis.rst:1420 msgid "This is no longer a pseudo-instruction." msgstr "" -#: library/dis.rst:1197 +#: library/dis.rst:1388 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: library/dis.rst:1210 +#: library/dis.rst:1404 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: library/dis.rst:1227 -msgid "" -"This opcode is a pseudo-instruction, replaced in final bytecode by the " -"directed versions (forward/backward)." -msgstr "" - -#: library/dis.rst:1224 +#: library/dis.rst:1415 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: library/dis.rst:1237 +#: library/dis.rst:1425 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1126,184 +1497,218 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: library/dis.rst:1242 +#: library/dis.rst:1430 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: library/dis.rst:1247 +#: library/dis.rst:1435 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: library/dis.rst:1249 +#: library/dis.rst:1437 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: library/dis.rst:1255 +#: library/dis.rst:1443 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: library/dis.rst:1257 +#: library/dis.rst:1445 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: library/dis.rst:1263 +#: library/dis.rst:1451 +msgid "" +"Pushes a borrowed reference to the local ``co_varnames[var_num]`` onto the " +"stack." +msgstr "" + +#: library/dis.rst:1458 +msgid "" +"Pushes references to ``co_varnames[var_nums >> 4]`` and " +"``co_varnames[var_nums & 15]`` onto the stack." +msgstr "" + +#: library/dis.rst:1466 +msgid "" +"Pushes borrowed references to ``co_varnames[var_nums >> 4]`` and " +"``co_varnames[var_nums & 15]`` onto the stack." +msgstr "" + +#: library/dis.rst:1473 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: library/dis.rst:1271 +#: library/dis.rst:1481 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: library/dis.rst:1279 +#: library/dis.rst:1489 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: library/dis.rst:1284 -msgid "Deletes local ``co_varnames[var_num]``." -msgstr "" - -#: library/dis.rst:1289 +#: library/dis.rst:1493 msgid "" -"Creates a new cell in slot ``i``. If that slot is nonempty then that value " -"is stored into the new cell." +"Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " +"into ``co_varnames[var_nums & 15]``." msgstr "" -#: library/dis.rst:1297 +#: library/dis.rst:1500 msgid "" -"Pushes a reference to the cell contained in slot ``i`` of the \"fast " -"locals\" storage. The name of the variable is ``co_fastlocalnames[i]``." +"Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " +"pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " +"stack." msgstr "" -#: library/dis.rst:1300 -msgid "" -"Note that ``LOAD_CLOSURE`` is effectively an alias for ``LOAD_FAST``. It " -"exists to keep bytecode a little more readable." +#: library/dis.rst:1508 +msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: library/dis.rst:1303 -msgid "``i`` is no longer offset by the length of ``co_varnames``." +#: library/dis.rst:1513 +msgid "" +"Creates a new cell in slot ``i``. If that slot is nonempty then that value " +"is stored into the new cell." msgstr "" -#: library/dis.rst:1309 +#: library/dis.rst:1521 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: library/dis.rst:1334 library/dis.rst:1345 +#: library/dis.rst:1546 library/dis.rst:1557 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: library/dis.rst:1318 +#: library/dis.rst:1530 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " "found there, loads it from the cell contained in slot ``i``, similar to :" -"opcode:`LOAD_DEREF`. This is used for loading free variables in class bodies " -"(which previously used :opcode:`!LOAD_CLASSDEREF`) and in :ref:`annotation " -"scopes ` within class bodies." +"opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " +"` in class bodies (which previously used :opcode:`!" +"LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within " +"class bodies." msgstr "" -#: library/dis.rst:1331 +#: library/dis.rst:1543 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: library/dis.rst:1340 +#: library/dis.rst:1552 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: library/dis.rst:1351 +#: library/dis.rst:1563 msgid "" -"Copies the ``n`` free variables from the closure into the frame. Removes the " -"need for special code on the caller's side when calling closures." +"Copies the ``n`` :term:`free (closure) variables ` from " +"the closure into the frame. Removes the need for special code on the " +"caller's side when calling closures." msgstr "" -#: library/dis.rst:1360 +#: library/dis.rst:1572 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: library/dis.rst:1363 +#: library/dis.rst:1575 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: library/dis.rst:1364 +#: library/dis.rst:1576 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: library/dis.rst:1365 +#: library/dis.rst:1577 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: library/dis.rst:1371 +#: library/dis.rst:1583 msgid "" -"Calls a callable object with the number of arguments specified by ``argc``, " -"including the named arguments specified by the preceding :opcode:`KW_NAMES`, " -"if any. On the stack are (in ascending order), either:" +"Calls a callable object with the number of arguments specified by ``argc``. " +"On the stack are (in ascending order):" +msgstr "" + +#: library/dis.rst:1610 +msgid "The callable" msgstr "" -#: library/dis.rst:1376 -msgid "NULL" +#: library/dis.rst:1611 +msgid "``self`` or ``NULL``" msgstr "" -#: library/dis.rst:1383 -msgid "The callable" +#: library/dis.rst:1612 +msgid "The remaining positional arguments" msgstr "" -#: library/dis.rst:1378 -msgid "The positional arguments" +#: library/dis.rst:1590 +msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: library/dis.rst:1386 -msgid "The named arguments" +#: library/dis.rst:1592 +msgid "" +"``CALL`` pops all arguments and the callable object off the stack, calls the " +"callable object with those arguments, and pushes the return value returned " +"by the callable object." msgstr "" -#: library/dis.rst:1381 -msgid "or:" +#: library/dis.rst:1598 +msgid "The callable now always appears at the same position on the stack." msgstr "" -#: library/dis.rst:1384 -msgid "``self``" +#: library/dis.rst:1601 +msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: library/dis.rst:1385 -msgid "The remaining positional arguments" +#: library/dis.rst:1607 +msgid "" +"Calls a callable object with the number of arguments specified by ``argc``, " +"including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: library/dis.rst:1388 +#: library/dis.rst:1613 +msgid "The named arguments" +msgstr "" + +#: library/dis.rst:1614 +msgid "A :class:`tuple` of keyword argument names" +msgstr "" + +#: library/dis.rst:1616 msgid "" "``argc`` is the total of the positional and named arguments, excluding " -"``self`` when a ``NULL`` is not present." +"``self``. The length of the tuple of keyword argument names is the number of " +"named arguments." msgstr "" -#: library/dis.rst:1391 +#: library/dis.rst:1619 msgid "" -"``CALL`` pops all arguments and the callable object off the stack, calls the " -"callable object with those arguments, and pushes the return value returned " -"by the callable object." +"``CALL_KW`` pops all arguments, the keyword names, and the callable object " +"off the stack, calls the callable object with those arguments, and pushes " +"the return value returned by the callable object." msgstr "" -#: library/dis.rst:1400 +#: library/dis.rst:1628 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1315,70 +1720,97 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: library/dis.rst:1415 +#: library/dis.rst:1643 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " -"``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." +"``NULL`` pushed by :opcode:`!LOAD_METHOD` for non-method calls." msgstr "" -#: library/dis.rst:1424 +#: library/dis.rst:1652 msgid "" -"Prefixes :opcode:`CALL`. Stores a reference to ``co_consts[consti]`` into an " -"internal variable for use by :opcode:`CALL`. ``co_consts[consti]`` must be a " -"tuple of strings." +"Pushes a new function object on the stack built from the code object at " +"``STACK[-1]``." +msgstr "" + +#: library/dis.rst:1654 +msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: library/dis.rst:1433 +#: library/dis.rst:1657 +msgid "Qualified name at ``STACK[-1]`` was removed." +msgstr "" + +#: library/dis.rst:1660 +msgid "" +"Extra function attributes on the stack, signaled by oparg flags, were " +"removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." +msgstr "" + +#: library/dis.rst:1667 msgid "" -"Pushes a new function object on the stack. From bottom to top, the consumed " -"stack must consist of values if the argument carries a specified flag value" +"Sets an attribute on a function object. Expects the function at " +"``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " +"and leaves the function at ``STACK[-1]``. The flag determines which " +"attribute to set:" msgstr "" -#: library/dis.rst:1436 +#: library/dis.rst:1671 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: library/dis.rst:1438 +#: library/dis.rst:1673 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: library/dis.rst:1439 +#: library/dis.rst:1674 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: library/dis.rst:1440 +#: library/dis.rst:1675 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: library/dis.rst:1441 -msgid "the code associated with the function (at ``STACK[-1]``)" -msgstr "" - -#: library/dis.rst:1443 -msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" +#: library/dis.rst:1676 +msgid "``0x10`` the :term:`annotate function` for the function object" msgstr "" -#: library/dis.rst:1446 -msgid "Qualified name at ``STACK[-1]`` was removed." +#: library/dis.rst:1680 +msgid "" +"Added ``0x10`` to indicate the annotate function for the function object." msgstr "" -#: library/dis.rst:1454 +#: library/dis.rst:1688 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: library/dis.rst:1460 +#: library/dis.rst:1690 +msgid "" +"end = STACK.pop()\n" +"start = STACK.pop()\n" +"STACK.append(slice(start, end))" +msgstr "" + +#: library/dis.rst:1694 msgid "if it is 3, implements::" msgstr "" -#: library/dis.rst:1467 +#: library/dis.rst:1696 +msgid "" +"step = STACK.pop()\n" +"end = STACK.pop()\n" +"start = STACK.pop()\n" +"STACK.append(slice(start, end, step))" +msgstr "" + +#: library/dis.rst:1701 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: library/dis.rst:1472 +#: library/dis.rst:1706 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1386,54 +1818,64 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: library/dis.rst:1480 +#: library/dis.rst:1714 +msgid "Convert value to a string, depending on ``oparg``::" +msgstr "" + +#: library/dis.rst:1716 msgid "" -"Used for implementing formatted literal strings (f-strings). Pops an " -"optional *fmt_spec* from the stack, then a required *value*. *flags* is " -"interpreted as follows:" +"value = STACK.pop()\n" +"result = func(value)\n" +"STACK.append(result)" msgstr "" -#: library/dis.rst:1484 -msgid "``(flags & 0x03) == 0x00``: *value* is formatted as-is." +#: library/dis.rst:1720 +msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: library/dis.rst:1485 -msgid "" -"``(flags & 0x03) == 0x01``: call :func:`str` on *value* before formatting it." +#: library/dis.rst:1721 +msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: library/dis.rst:1487 -msgid "" -"``(flags & 0x03) == 0x02``: call :func:`repr` on *value* before formatting " -"it." +#: library/dis.rst:1722 +msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: library/dis.rst:1489 -msgid "" -"``(flags & 0x03) == 0x03``: call :func:`ascii` on *value* before formatting " -"it." +#: library/dis.rst:1737 library/dis.rst:1750 +msgid "Used for implementing formatted string literals (f-strings)." msgstr "" -#: library/dis.rst:1491 +#: library/dis.rst:1731 +msgid "Formats the value on top of stack::" +msgstr "" + +#: library/dis.rst:1733 msgid "" -"``(flags & 0x04) == 0x04``: pop *fmt_spec* from the stack and use it, else " -"use an empty *fmt_spec*." +"value = STACK.pop()\n" +"result = value.__format__(\"\")\n" +"STACK.append(result)" +msgstr "" + +#: library/dis.rst:1743 +msgid "Formats the given value with the given format spec::" msgstr "" -#: library/dis.rst:1494 +#: library/dis.rst:1745 msgid "" -"Formatting is performed using :c:func:`PyObject_Format`. The result is " -"pushed on the stack." +"spec = STACK.pop()\n" +"value = STACK.pop()\n" +"result = value.__format__(spec)\n" +"STACK.append(result)" msgstr "" -#: library/dis.rst:1502 +#: library/dis.rst:1757 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: library/dis.rst:1506 +#: library/dis.rst:1761 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1441,257 +1883,289 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: library/dis.rst:1520 +#: library/dis.rst:1775 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: library/dis.rst:1522 -msgid "The ``where`` operand marks where the ``RESUME`` occurs:" +#: library/dis.rst:1777 +msgid "" +"The ``context`` operand consists of two parts. The lowest two bits indicate " +"where the ``RESUME`` occurs:" msgstr "" -#: library/dis.rst:1524 +#: library/dis.rst:1780 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: library/dis.rst:1526 +#: library/dis.rst:1782 msgid "``1`` After a ``yield`` expression" msgstr "" -#: library/dis.rst:1527 +#: library/dis.rst:1783 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: library/dis.rst:1528 +#: library/dis.rst:1784 msgid "``3`` After an ``await`` expression" msgstr "" -#: library/dis.rst:1535 +#: library/dis.rst:1786 +msgid "" +"The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " +"otherwise." +msgstr "" + +#: library/dis.rst:1791 +msgid "The oparg value changed to include information about except-depth" +msgstr "" + +#: library/dis.rst:1797 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: library/dis.rst:1544 +#: library/dis.rst:1806 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: library/dis.rst:1547 +#: library/dis.rst:1809 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: library/dis.rst:1556 +#: library/dis.rst:1818 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: library/dis.rst:1560 +#: library/dis.rst:1822 msgid "" -"If your application uses pseudo instructions, use the :data:`hasarg` " -"collection instead." +"If your application uses pseudo instructions or specialized instructions, " +"use the :data:`hasarg` collection instead." msgstr "" -#: library/dis.rst:1563 +#: library/dis.rst:1825 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: library/dis.rst:1567 +#: library/dis.rst:1829 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: library/dis.rst:1575 +#: library/dis.rst:1834 +msgid "Use :data:`hasarg` instead." +msgstr "" + +#: library/dis.rst:1839 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: library/dis.rst:1633 +#: library/dis.rst:1897 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: library/dis.rst:1636 +#: library/dis.rst:1900 msgid "Operand" msgstr "" -#: library/dis.rst:1636 +#: library/dis.rst:1900 msgid "Description" msgstr "" -#: library/dis.rst:1584 +#: library/dis.rst:1848 msgid "``INTRINSIC_1_INVALID``" msgstr "" -#: library/dis.rst:1638 +#: library/dis.rst:1902 msgid "Not valid" msgstr "" -#: library/dis.rst:1586 +#: library/dis.rst:1850 msgid "``INTRINSIC_PRINT``" msgstr "" -#: library/dis.rst:1586 +#: library/dis.rst:1850 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: library/dis.rst:1589 +#: library/dis.rst:1853 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "" -#: library/dis.rst:1589 +#: library/dis.rst:1853 msgid "Performs ``import *`` for the named module." msgstr "" -#: library/dis.rst:1592 +#: library/dis.rst:1856 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "" -#: library/dis.rst:1592 +#: library/dis.rst:1856 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: library/dis.rst:1595 +#: library/dis.rst:1859 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "" -#: library/dis.rst:1595 -msgid "Wraps an aync generator value" +#: library/dis.rst:1859 +msgid "Wraps an async generator value" msgstr "" -#: library/dis.rst:1597 +#: library/dis.rst:1861 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "" -#: library/dis.rst:1597 +#: library/dis.rst:1861 msgid "Performs the unary ``+`` operation" msgstr "" -#: library/dis.rst:1600 +#: library/dis.rst:1864 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "" -#: library/dis.rst:1600 +#: library/dis.rst:1864 msgid "Converts a list to a tuple" msgstr "" -#: library/dis.rst:1602 +#: library/dis.rst:1866 msgid "``INTRINSIC_TYPEVAR``" msgstr "" -#: library/dis.rst:1602 +#: library/dis.rst:1866 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: library/dis.rst:1604 +#: library/dis.rst:1868 msgid "``INTRINSIC_PARAMSPEC``" msgstr "" -#: library/dis.rst:1604 +#: library/dis.rst:1868 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: library/dis.rst:1607 +#: library/dis.rst:1871 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "" -#: library/dis.rst:1607 +#: library/dis.rst:1871 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: library/dis.rst:1610 +#: library/dis.rst:1874 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "" -#: library/dis.rst:1610 +#: library/dis.rst:1874 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: library/dis.rst:1613 +#: library/dis.rst:1877 msgid "``INTRINSIC_TYPEALIAS``" msgstr "" -#: library/dis.rst:1613 +#: library/dis.rst:1877 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: library/dis.rst:1625 +#: library/dis.rst:1889 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: library/dis.rst:1638 +#: library/dis.rst:1892 +msgid "" +"arg2 = STACK.pop()\n" +"arg1 = STACK.pop()\n" +"result = intrinsic2(arg1, arg2)\n" +"STACK.append(result)" +msgstr "" + +#: library/dis.rst:1902 msgid "``INTRINSIC_2_INVALID``" msgstr "" -#: library/dis.rst:1640 +#: library/dis.rst:1904 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "" -#: library/dis.rst:1640 +#: library/dis.rst:1904 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: library/dis.rst:1644 +#: library/dis.rst:1908 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "" -#: library/dis.rst:1644 +#: library/dis.rst:1908 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: library/dis.rst:1647 +#: library/dis.rst:1911 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "" -#: library/dis.rst:1647 +#: library/dis.rst:1911 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: library/dis.rst:1651 +#: library/dis.rst:1915 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "" -#: library/dis.rst:1651 +#: library/dis.rst:1915 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: library/dis.rst:1658 +#: library/dis.rst:1924 +msgid "" +"Performs special method lookup on ``STACK[-1]``. If ``type(STACK[-1])." +"__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; STACK[-1]`` on the " +"stack. If ``type(STACK[-1]).__xxx__`` is not a method, leave ``STACK[-1]." +"__xxx__; NULL`` on the stack." +msgstr "" + +#: library/dis.rst:1933 msgid "**Pseudo-instructions**" msgstr "" -#: library/dis.rst:1660 +#: library/dis.rst:1935 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: library/dis.rst:1665 +#: library/dis.rst:1940 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: library/dis.rst:1672 +#: library/dis.rst:1947 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -1700,111 +2174,144 @@ msgid "" "exception handler at ``target``." msgstr "" -#: library/dis.rst:1681 +#: library/dis.rst:1956 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: library/dis.rst:1685 +#: library/dis.rst:1960 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context manager's :meth:" "`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" -#: library/dis.rst:1692 +#: library/dis.rst:1967 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: library/dis.rst:1698 +#: library/dis.rst:1973 +msgid "" +"Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects." +msgstr "" + +#: library/dis.rst:1979 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: library/dis.rst:1703 +#: library/dis.rst:1985 msgid "" -"Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " -"flag set in the arg." +"Conditional jumps which do not impact the stack. Replaced by the sequence " +"``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``." msgstr "" -#: library/dis.rst:1710 +#: library/dis.rst:1990 +msgid "" +"Pushes a reference to the cell contained in slot ``i`` of the \"fast " +"locals\" storage." +msgstr "" + +#: library/dis.rst:1993 +msgid "" +"Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." +msgstr "" + +#: library/dis.rst:1995 +msgid "This opcode is now a pseudo-instruction." +msgstr "" + +#: library/dis.rst:2002 msgid "Opcode collections" msgstr "" -#: library/dis.rst:1712 +#: library/dis.rst:2004 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: library/dis.rst:1715 +#: library/dis.rst:2007 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: library/dis.rst:1722 +#: library/dis.rst:2014 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: library/dis.rst:1727 +#: library/dis.rst:2019 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: library/dis.rst:1732 +#: library/dis.rst:2024 msgid "Sequence of all compare operation names." msgstr "" -#: library/dis.rst:1737 +#: library/dis.rst:2029 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: library/dis.rst:1744 +#: library/dis.rst:2036 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: library/dis.rst:1749 +#: library/dis.rst:2041 msgid "" -"Sequence of bytecodes that access a free variable. 'free' in this context " -"refers to names in the current scope that are referenced by inner scopes or " -"names in outer scopes that are referenced from this scope. It does *not* " -"include references to global or builtin scopes." +"Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " +"are referenced by inner scopes or names in outer scopes that are referenced " +"from this scope. It does *not* include references to global or builtin " +"scopes." msgstr "" -#: library/dis.rst:1757 +#: library/dis.rst:2049 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: library/dis.rst:1762 -msgid "Sequence of bytecodes that have a relative jump target." -msgstr "" - -#: library/dis.rst:1767 -msgid "Sequence of bytecodes that have an absolute jump target." +#: library/dis.rst:2054 +msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: library/dis.rst:1772 +#: library/dis.rst:2061 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: library/dis.rst:1777 +#: library/dis.rst:2066 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: library/dis.rst:1781 +#: library/dis.rst:2070 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: library/dis.rst:1452 +#: library/dis.rst:2077 +msgid "Sequence of bytecodes that have a relative jump target." +msgstr "" + +#: library/dis.rst:2079 +msgid "All jumps are now relative. Use :data:`hasjump`." +msgstr "" + +#: library/dis.rst:2085 +msgid "Sequence of bytecodes that have an absolute jump target." +msgstr "" + +#: library/dis.rst:2087 +msgid "All jumps are now relative. This list is empty." +msgstr "" + +#: library/dis.rst:1686 msgid "built-in function" msgstr "" -#: library/dis.rst:1452 +#: library/dis.rst:1686 msgid "slice" msgstr "" diff --git a/library/distribution.po b/library/distribution.po index bf137b51..ef9701c1 100644 --- a/library/distribution.po +++ b/library/distribution.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/distutils.po b/library/distutils.po new file mode 100644 index 00000000..c50702f6 --- /dev/null +++ b/library/distutils.po @@ -0,0 +1,36 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/distutils.rst:2 +msgid ":mod:`!distutils` --- Building and installing Python modules" +msgstr "" + +#: library/distutils.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being " +"deprecated in Python 3.10. The removal was decided in :pep:`632`, which has " +"`migration advice `_." +msgstr "" + +#: library/distutils.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!distutils` module was " +"`Python 3.11 `_." +msgstr "" diff --git a/library/doctest.po b/library/doctest.po index 9ca1b699..8701a999 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/doctest.rst:2 -msgid ":mod:`doctest` --- Test interactive Python examples" +msgid ":mod:`!doctest` --- Test interactive Python examples" msgstr "" #: library/doctest.rst:12 @@ -55,12 +56,76 @@ msgstr "" msgid "Here's a complete but small example module::" msgstr "" +#: library/doctest.rst:33 +msgid "" +"\"\"\"\n" +"This is the \"example\" module.\n" +"\n" +"The example module supplies one function, factorial(). For example,\n" +"\n" +">>> factorial(5)\n" +"120\n" +"\"\"\"\n" +"\n" +"def factorial(n):\n" +" \"\"\"Return the factorial of n, an exact integer >= 0.\n" +"\n" +" >>> [factorial(n) for n in range(6)]\n" +" [1, 1, 2, 6, 24, 120]\n" +" >>> factorial(30)\n" +" 265252859812191058636308480000000\n" +" >>> factorial(-1)\n" +" Traceback (most recent call last):\n" +" ...\n" +" ValueError: n must be >= 0\n" +"\n" +" Factorials of floats are OK, but the float must be an exact integer:\n" +" >>> factorial(30.1)\n" +" Traceback (most recent call last):\n" +" ...\n" +" ValueError: n must be exact integer\n" +" >>> factorial(30.0)\n" +" 265252859812191058636308480000000\n" +"\n" +" It must also not be ridiculously large:\n" +" >>> factorial(1e100)\n" +" Traceback (most recent call last):\n" +" ...\n" +" OverflowError: n too large\n" +" \"\"\"\n" +"\n" +" import math\n" +" if not n >= 0:\n" +" raise ValueError(\"n must be >= 0\")\n" +" if math.floor(n) != n:\n" +" raise ValueError(\"n must be exact integer\")\n" +" if n+1 == n: # catch a value like 1e300\n" +" raise OverflowError(\"n too large\")\n" +" result = 1\n" +" factor = 2\n" +" while factor <= n:\n" +" result *= factor\n" +" factor += 1\n" +" return result\n" +"\n" +"\n" +"if __name__ == \"__main__\":\n" +" import doctest\n" +" doctest.testmod()" +msgstr "" + #: library/doctest.rst:88 msgid "" "If you run :file:`example.py` directly from the command line, :mod:`doctest` " "works its magic:" msgstr "" +#: library/doctest.rst:91 +msgid "" +"$ python example.py\n" +"$" +msgstr "" + #: library/doctest.rst:96 msgid "" "There's no output! That's normal, and it means all the examples worked. " @@ -68,10 +133,43 @@ msgid "" "it's trying, and prints a summary at the end:" msgstr "" +#: library/doctest.rst:100 +msgid "" +"$ python example.py -v\n" +"Trying:\n" +" factorial(5)\n" +"Expecting:\n" +" 120\n" +"ok\n" +"Trying:\n" +" [factorial(n) for n in range(6)]\n" +"Expecting:\n" +" [1, 1, 2, 6, 24, 120]\n" +"ok" +msgstr "" + #: library/doctest.rst:114 msgid "And so on, eventually ending with:" msgstr "" +#: library/doctest.rst:116 +msgid "" +"Trying:\n" +" factorial(1e100)\n" +"Expecting:\n" +" Traceback (most recent call last):\n" +" ...\n" +" OverflowError: n too large\n" +"ok\n" +"2 items passed all tests:\n" +" 1 test in __main__\n" +" 6 tests in __main__.factorial\n" +"7 tests in 2 items.\n" +"7 passed.\n" +"Test passed.\n" +"$" +msgstr "" + #: library/doctest.rst:133 msgid "" "That's all you need to know to start making productive use of :mod:" @@ -81,27 +179,44 @@ msgid "" "file :file:`Lib/test/test_doctest/test_doctest.py`." msgstr "" -#: library/doctest.rst:143 +#: library/doctest.rst:139 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." +msgstr "" + +#: library/doctest.rst:147 msgid "Simple Usage: Checking Examples in Docstrings" msgstr "" -#: library/doctest.rst:145 +#: library/doctest.rst:149 msgid "" "The simplest way to start using doctest (but not necessarily the way you'll " "continue to do it) is to end each module :mod:`!M` with::" msgstr "" #: library/doctest.rst:152 +msgid "" +"if __name__ == \"__main__\":\n" +" import doctest\n" +" doctest.testmod()" +msgstr "" + +#: library/doctest.rst:156 msgid ":mod:`!doctest` then examines docstrings in module :mod:`!M`." msgstr "" -#: library/doctest.rst:154 +#: library/doctest.rst:158 msgid "" "Running the module as a script causes the examples in the docstrings to get " "executed and verified::" msgstr "" -#: library/doctest.rst:159 +#: library/doctest.rst:161 +msgid "python M.py" +msgstr "" + +#: library/doctest.rst:163 msgid "" "This won't display anything unless an example fails, in which case the " "failing example(s) and the cause(s) of the failure(s) are printed to stdout, " @@ -109,55 +224,57 @@ msgid "" "is the number of examples that failed." msgstr "" -#: library/doctest.rst:164 +#: library/doctest.rst:168 msgid "Run it with the ``-v`` switch instead::" msgstr "" -#: library/doctest.rst:168 +#: library/doctest.rst:170 +msgid "python M.py -v" +msgstr "" + +#: library/doctest.rst:172 msgid "" "and a detailed report of all examples tried is printed to standard output, " "along with assorted summaries at the end." msgstr "" -#: library/doctest.rst:171 +#: library/doctest.rst:175 msgid "" "You can force verbose mode by passing ``verbose=True`` to :func:`testmod`, " -"or prohibit it by passing ``verbose=False``. In either of those cases, " -"``sys.argv`` is not examined by :func:`testmod` (so passing ``-v`` or not " +"or prohibit it by passing ``verbose=False``. In either of those cases, :" +"data:`sys.argv` is not examined by :func:`testmod` (so passing ``-v`` or not " "has no effect)." msgstr "" -#: library/doctest.rst:176 +#: library/doctest.rst:180 msgid "" -"There is also a command line shortcut for running :func:`testmod`. You can " -"instruct the Python interpreter to run the doctest module directly from the " -"standard library and pass the module name(s) on the command line::" -msgstr "" - -#: library/doctest.rst:182 -msgid "" -"This will import :file:`example.py` as a standalone module and run :func:" -"`testmod` on it. Note that this may not work correctly if the file is part " -"of a package and imports other submodules from that package." +"There is also a command line shortcut for running :func:`testmod`, see " +"section :ref:`doctest-cli`." msgstr "" -#: library/doctest.rst:186 +#: library/doctest.rst:183 msgid "" "For more information on :func:`testmod`, see section :ref:`doctest-basic-" "api`." msgstr "" -#: library/doctest.rst:192 +#: library/doctest.rst:189 msgid "Simple Usage: Checking Examples in a Text File" msgstr "" -#: library/doctest.rst:194 +#: library/doctest.rst:191 msgid "" "Another simple application of doctest is testing interactive examples in a " "text file. This can be done with the :func:`testfile` function::" msgstr "" -#: library/doctest.rst:200 +#: library/doctest.rst:194 +msgid "" +"import doctest\n" +"doctest.testfile(\"example.txt\")" +msgstr "" + +#: library/doctest.rst:197 msgid "" "That short script executes and verifies any interactive Python examples " "contained in the file :file:`example.txt`. The file content is treated as " @@ -165,21 +282,51 @@ msgid "" "Python program! For example, perhaps :file:`example.txt` contains this:" msgstr "" -#: library/doctest.rst:223 +#: library/doctest.rst:202 +msgid "" +"The ``example`` module\n" +"======================\n" +"\n" +"Using ``factorial``\n" +"-------------------\n" +"\n" +"This is an example text file in reStructuredText format. First import\n" +"``factorial`` from the ``example`` module:\n" +"\n" +" >>> from example import factorial\n" +"\n" +"Now use it:\n" +"\n" +" >>> factorial(6)\n" +" 120" +msgstr "" + +#: library/doctest.rst:220 msgid "" "Running ``doctest.testfile(\"example.txt\")`` then finds the error in this " "documentation::" msgstr "" -#: library/doctest.rst:234 +#: library/doctest.rst:223 +msgid "" +"File \"./example.txt\", line 14, in example.txt\n" +"Failed example:\n" +" factorial(6)\n" +"Expected:\n" +" 120\n" +"Got:\n" +" 720" +msgstr "" + +#: library/doctest.rst:231 msgid "" "As with :func:`testmod`, :func:`testfile` won't display anything unless an " "example fails. If an example does fail, then the failing example(s) and the " "cause(s) of the failure(s) are printed to stdout, using the same format as :" -"func:`testmod`." +"func:`!testmod`." msgstr "" -#: library/doctest.rst:239 +#: library/doctest.rst:236 msgid "" "By default, :func:`testfile` looks for files in the calling module's " "directory. See section :ref:`doctest-basic-api` for a description of the " @@ -187,36 +334,79 @@ msgid "" "locations." msgstr "" -#: library/doctest.rst:243 +#: library/doctest.rst:240 msgid "" "Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-" "v`` command-line switch or with the optional keyword argument *verbose*." msgstr "" +#: library/doctest.rst:244 +msgid "" +"There is also a command line shortcut for running :func:`testfile`, see " +"section :ref:`doctest-cli`." +msgstr "" + #: library/doctest.rst:247 msgid "" -"There is also a command line shortcut for running :func:`testfile`. You can " -"instruct the Python interpreter to run the doctest module directly from the " -"standard library and pass the file name(s) on the command line::" +"For more information on :func:`testfile`, see section :ref:`doctest-basic-" +"api`." msgstr "" #: library/doctest.rst:253 +msgid "Command-line Usage" +msgstr "" + +#: library/doctest.rst:255 msgid "" -"Because the file name does not end with :file:`.py`, :mod:`doctest` infers " -"that it must be run with :func:`testfile`, not :func:`testmod`." +"The :mod:`doctest` module can be invoked as a script from the command line:" +msgstr "" + +#: library/doctest.rst:257 +msgid "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" msgstr "" -#: library/doctest.rst:256 +#: library/doctest.rst:265 msgid "" -"For more information on :func:`testfile`, see section :ref:`doctest-basic-" -"api`." +"Detailed report of all examples tried is printed to standard output, along " +"with assorted summaries at the end::" +msgstr "" + +#: library/doctest.rst:268 +msgid "python -m doctest -v example.py" msgstr "" -#: library/doctest.rst:262 +#: library/doctest.rst:270 +msgid "" +"This will import :file:`example.py` as a standalone module and run :func:" +"`testmod` on it. Note that this may not work correctly if the file is part " +"of a package and imports other submodules from that package." +msgstr "" + +#: library/doctest.rst:274 +msgid "" +"If the file name does not end with :file:`.py`, :mod:`!doctest` infers that " +"it must be run with :func:`testfile` instead::" +msgstr "" + +#: library/doctest.rst:277 +msgid "python -m doctest -v example.txt" +msgstr "" + +#: library/doctest.rst:281 +msgid "" +"Option flags control various aspects of doctest's behavior, see section :ref:" +"`doctest-options`." +msgstr "" + +#: library/doctest.rst:288 +msgid "This is shorthand for ``-o FAIL_FAST``." +msgstr "" + +#: library/doctest.rst:296 msgid "How It Works" msgstr "" -#: library/doctest.rst:264 +#: library/doctest.rst:298 msgid "" "This section examines in detail how doctest works: which docstrings it looks " "at, how it finds interactive examples, what execution context it uses, how " @@ -226,17 +416,17 @@ msgid "" "see the following sections." msgstr "" -#: library/doctest.rst:275 +#: library/doctest.rst:309 msgid "Which Docstrings Are Examined?" msgstr "" -#: library/doctest.rst:277 +#: library/doctest.rst:311 msgid "" "The module docstring, and all function, class and method docstrings are " "searched. Objects imported into the module are not searched." msgstr "" -#: library/doctest.rst:280 +#: library/doctest.rst:321 msgid "" "In addition, there are cases when you want tests to be part of a module but " "not part of the help text, which requires that the tests not be included in " @@ -249,11 +439,24 @@ msgid "" "__test__.K``." msgstr "" -#: library/doctest.rst:289 +#: library/doctest.rst:330 msgid "For example, place this block of code at the top of :file:`example.py`:" msgstr "" -#: library/doctest.rst:303 +#: library/doctest.rst:332 +msgid "" +"__test__ = {\n" +" 'numbers': \"\"\"\n" +">>> factorial(6)\n" +"720\n" +"\n" +">>> [factorial(n) for n in range(6)]\n" +"[1, 1, 2, 6, 24, 120]\n" +"\"\"\"\n" +"}" +msgstr "" + +#: library/doctest.rst:344 msgid "" "The value of ``example.__test__[\"numbers\"]`` will be treated as a " "docstring and all the tests inside it will be run. It is important to note " @@ -262,35 +465,66 @@ msgid "" "scanned for tests." msgstr "" -#: library/doctest.rst:309 +#: library/doctest.rst:350 msgid "" "Any classes found are recursively searched similarly, to test docstrings in " "their contained methods and nested classes." msgstr "" -#: library/doctest.rst:316 +#: library/doctest.rst:355 +msgid "" +"``doctest`` can only automatically discover classes and functions that are " +"defined at the module level or inside other classes." +msgstr "" + +#: library/doctest.rst:358 +msgid "" +"Since nested classes and functions only exist when an outer function is " +"called, they cannot be discovered. Define them outside to make them visible." +msgstr "" + +#: library/doctest.rst:364 msgid "How are Docstring Examples Recognized?" msgstr "" -#: library/doctest.rst:318 +#: library/doctest.rst:366 msgid "" "In most cases a copy-and-paste of an interactive console session works fine, " "but doctest isn't trying to do an exact emulation of any specific Python " "shell." msgstr "" -#: library/doctest.rst:343 +#: library/doctest.rst:371 +msgid "" +">>> # comments are ignored\n" +">>> x = 12\n" +">>> x\n" +"12\n" +">>> if x == 13:\n" +"... print(\"yes\")\n" +"... else:\n" +"... print(\"no\")\n" +"... print(\"NO\")\n" +"... print(\"NO!!!\")\n" +"...\n" +"no\n" +"NO\n" +"NO!!!\n" +">>>" +msgstr "" + +#: library/doctest.rst:391 msgid "" "Any expected output must immediately follow the final ``'>>> '`` or ``'... " "'`` line containing the code, and the expected output (if any) extends to " "the next ``'>>> '`` or all-whitespace line." msgstr "" -#: library/doctest.rst:347 +#: library/doctest.rst:395 msgid "The fine print:" msgstr "" -#: library/doctest.rst:349 +#: library/doctest.rst:397 msgid "" "Expected output cannot contain an all-whitespace line, since such a line is " "taken to signal the end of expected output. If expected output does contain " @@ -298,7 +532,7 @@ msgid "" "line is expected." msgstr "" -#: library/doctest.rst:354 +#: library/doctest.rst:402 msgid "" "All hard tab characters are expanded to spaces, using 8-column tab stops. " "Tabs in output generated by the tested code are not modified. Because any " @@ -313,20 +547,29 @@ msgid "" "`DocTestParser` class." msgstr "" -#: library/doctest.rst:366 +#: library/doctest.rst:414 msgid "" "Output to stdout is captured, but not output to stderr (exception tracebacks " "are captured via a different means)." msgstr "" -#: library/doctest.rst:369 +#: library/doctest.rst:417 msgid "" "If you continue a line via backslashing in an interactive session, or for " "any other reason use a backslash, you should use a raw docstring, which will " "preserve your backslashes exactly as you type them::" msgstr "" -#: library/doctest.rst:379 +#: library/doctest.rst:421 +msgid "" +">>> def f(x):\n" +"... r'''Backslashes in a raw docstring: m\\n'''\n" +"...\n" +">>> print(f.__doc__)\n" +"Backslashes in a raw docstring: m\\n" +msgstr "" + +#: library/doctest.rst:427 msgid "" "Otherwise, the backslash will be interpreted as part of the string. For " "example, the ``\\n`` above would be interpreted as a newline character. " @@ -334,21 +577,38 @@ msgid "" "use a raw string)::" msgstr "" -#: library/doctest.rst:389 +#: library/doctest.rst:431 +msgid "" +">>> def f(x):\n" +"... '''Backslashes in a raw docstring: m\\\\n'''\n" +"...\n" +">>> print(f.__doc__)\n" +"Backslashes in a raw docstring: m\\n" +msgstr "" + +#: library/doctest.rst:437 msgid "The starting column doesn't matter::" msgstr "" -#: library/doctest.rst:396 +#: library/doctest.rst:439 +msgid "" +">>> assert \"Easy!\"\n" +" >>> import math\n" +" >>> math.floor(1.9)\n" +" 1" +msgstr "" + +#: library/doctest.rst:444 msgid "" "and as many leading whitespace characters are stripped from the expected " "output as appeared in the initial ``'>>> '`` line that started the example." msgstr "" -#: library/doctest.rst:403 +#: library/doctest.rst:451 msgid "What's the Execution Context?" msgstr "" -#: library/doctest.rst:405 +#: library/doctest.rst:453 msgid "" "By default, each time :mod:`doctest` finds a docstring to test, it uses a " "*shallow copy* of :mod:`!M`'s globals, so that running tests doesn't change " @@ -359,17 +619,17 @@ msgid "" "defined in other docstrings." msgstr "" -#: library/doctest.rst:413 +#: library/doctest.rst:461 msgid "" "You can force use of your own dict as the execution context by passing " "``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead." msgstr "" -#: library/doctest.rst:420 +#: library/doctest.rst:468 msgid "What About Exceptions?" msgstr "" -#: library/doctest.rst:422 +#: library/doctest.rst:470 msgid "" "No problem, provided that the traceback is the only output produced by the " "example: just paste in the traceback. [#]_ Since tracebacks contain details " @@ -378,31 +638,45 @@ msgid "" "it accepts." msgstr "" -#: library/doctest.rst:428 +#: library/doctest.rst:476 msgid "Simple example::" msgstr "" -#: library/doctest.rst:435 +#: library/doctest.rst:478 +msgid "" +">>> [1, 2, 3].remove(42)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: list.remove(x): x not in list" +msgstr "" + +#: library/doctest.rst:483 msgid "" "That doctest succeeds if :exc:`ValueError` is raised, with the ``list." "remove(x): x not in list`` detail as shown." msgstr "" -#: library/doctest.rst:438 +#: library/doctest.rst:486 msgid "" "The expected output for an exception must start with a traceback header, " "which may be either of the following two lines, indented the same as the " "first line of the example::" msgstr "" -#: library/doctest.rst:445 +#: library/doctest.rst:490 +msgid "" +"Traceback (most recent call last):\n" +"Traceback (innermost last):" +msgstr "" + +#: library/doctest.rst:493 msgid "" "The traceback header is followed by an optional traceback stack, whose " "contents are ignored by doctest. The traceback stack is typically omitted, " "or copied verbatim from an interactive session." msgstr "" -#: library/doctest.rst:449 +#: library/doctest.rst:497 msgid "" "The traceback stack is followed by the most interesting part: the line(s) " "containing the exception type and detail. This is usually the last line of " @@ -410,20 +684,40 @@ msgid "" "multi-line detail::" msgstr "" -#: library/doctest.rst:461 +#: library/doctest.rst:502 +msgid "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: multi\n" +" line\n" +"detail" +msgstr "" + +#: library/doctest.rst:509 msgid "" "The last three lines (starting with :exc:`ValueError`) are compared against " "the exception's type and detail, and the rest are ignored." msgstr "" -#: library/doctest.rst:464 +#: library/doctest.rst:512 msgid "" "Best practice is to omit the traceback stack, unless it adds significant " "documentation value to the example. So the last example is probably better " "as::" msgstr "" -#: library/doctest.rst:474 +#: library/doctest.rst:515 +msgid "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: multi\n" +" line\n" +"detail" +msgstr "" + +#: library/doctest.rst:522 msgid "" "Note that tracebacks are treated very specially. In particular, in the " "rewritten example, the use of ``...`` is independent of doctest's :const:" @@ -432,11 +726,11 @@ msgid "" "transcript of a Monty Python skit." msgstr "" -#: library/doctest.rst:480 +#: library/doctest.rst:528 msgid "Some details you should read once, but won't need to remember:" msgstr "" -#: library/doctest.rst:482 +#: library/doctest.rst:530 msgid "" "Doctest can't guess whether your expected output came from an exception " "traceback or from ordinary printing. So, e.g., an example that expects " @@ -446,7 +740,7 @@ msgid "" "create real problems." msgstr "" -#: library/doctest.rst:489 +#: library/doctest.rst:537 msgid "" "Each line of the traceback stack (if present) must be indented further than " "the first line of the example, *or* start with a non-alphanumeric character. " @@ -455,29 +749,38 @@ msgid "" "course this does the right thing for genuine tracebacks." msgstr "" -#: library/doctest.rst:495 +#: library/doctest.rst:543 msgid "" "When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, " "everything following the leftmost colon and any module information in the " "exception name is ignored." msgstr "" -#: library/doctest.rst:499 +#: library/doctest.rst:547 msgid "" "The interactive shell omits the traceback header line for some :exc:" "`SyntaxError`\\ s. But doctest uses the traceback header line to " "distinguish exceptions from non-exceptions. So in the rare case where you " -"need to test a :exc:`SyntaxError` that omits the traceback header, you will " +"need to test a :exc:`!SyntaxError` that omits the traceback header, you will " "need to manually add the traceback header line to your test example." msgstr "" -#: library/doctest.rst:507 +#: library/doctest.rst:555 msgid "" "For some exceptions, Python displays the position of the error using ``^`` " "markers and tildes::" msgstr "" -#: library/doctest.rst:516 +#: library/doctest.rst:558 +msgid "" +">>> 1 + None\n" +" File \"\", line 1\n" +" 1 + None\n" +" ~~^~~~~~\n" +"TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" +msgstr "" + +#: library/doctest.rst:564 msgid "" "Since the lines showing the position of the error come before the exception " "type and detail, they are not checked by doctest. For example, the " @@ -485,11 +788,20 @@ msgid "" "location::" msgstr "" -#: library/doctest.rst:531 +#: library/doctest.rst:568 +msgid "" +">>> 1 + None\n" +" File \"\", line 1\n" +" 1 + None\n" +" ^~~~~~~~\n" +"TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" +msgstr "" + +#: library/doctest.rst:579 msgid "Option Flags" msgstr "" -#: library/doctest.rst:533 +#: library/doctest.rst:581 msgid "" "A number of option flags control various aspects of doctest's behavior. " "Symbolic names for the flags are supplied as module constants, which can be :" @@ -499,17 +811,13 @@ msgid "" "option." msgstr "" -#: library/doctest.rst:539 -msgid "The ``-o`` command line option." -msgstr "" - -#: library/doctest.rst:542 +#: library/doctest.rst:587 msgid "" "The first group of options define test semantics, controlling aspects of how " "doctest decides whether actual output matches an example's expected output:" msgstr "" -#: library/doctest.rst:548 +#: library/doctest.rst:593 msgid "" "By default, if an expected output block contains just ``1``, an actual " "output block containing just ``1`` or just ``True`` is considered to be a " @@ -521,7 +829,7 @@ msgid "" "not for several years." msgstr "" -#: library/doctest.rst:560 +#: library/doctest.rst:605 msgid "" "By default, if an expected output block contains a line containing only the " "string ````, then that line will match a blank line in the actual " @@ -530,7 +838,7 @@ msgid "" "`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." msgstr "" -#: library/doctest.rst:569 +#: library/doctest.rst:614 msgid "" "When specified, all sequences of whitespace (blanks and newlines) are " "treated as equal. Any sequence of whitespace within the expected output " @@ -540,7 +848,7 @@ msgid "" "across multiple lines in your source." msgstr "" -#: library/doctest.rst:580 +#: library/doctest.rst:625 msgid "" "When specified, an ellipsis marker (``...``) in the expected output can " "match any substring in the actual output. This includes substrings that " @@ -549,14 +857,14 @@ msgid "" "matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" -#: library/doctest.rst:589 +#: library/doctest.rst:634 msgid "" "When specified, doctests expecting exceptions pass so long as an exception " "of the expected type is raised, even if the details (message and fully " "qualified exception name) don't match." msgstr "" -#: library/doctest.rst:593 +#: library/doctest.rst:638 msgid "" "For example, an example expecting ``ValueError: 42`` will pass if the actual " "exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:" @@ -566,20 +874,35 @@ msgid "" "these variations will work with the flag specified:" msgstr "" -#: library/doctest.rst:615 +#: library/doctest.rst:646 +msgid "" +">>> raise Exception('message')\n" +"Traceback (most recent call last):\n" +"Exception: message\n" +"\n" +">>> raise Exception('message')\n" +"Traceback (most recent call last):\n" +"builtins.Exception: message\n" +"\n" +">>> raise Exception('message')\n" +"Traceback (most recent call last):\n" +"__main__.Exception: message" +msgstr "" + +#: library/doctest.rst:660 msgid "" "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " "exception message, but such a test may still fail based on whether the " "module name is present or matches exactly." msgstr "" -#: library/doctest.rst:619 +#: library/doctest.rst:664 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" -#: library/doctest.rst:626 +#: library/doctest.rst:671 msgid "" "When specified, do not run the example at all. This can be useful in " "contexts where doctest examples serve as both documentation and test cases, " @@ -588,32 +911,32 @@ msgid "" "might depend on resources which would be unavailable to the test driver." msgstr "" -#: library/doctest.rst:632 +#: library/doctest.rst:677 msgid "" "The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" -#: library/doctest.rst:637 +#: library/doctest.rst:682 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" -#: library/doctest.rst:639 +#: library/doctest.rst:684 msgid "The second group of options controls how test failures are reported:" msgstr "" -#: library/doctest.rst:644 +#: library/doctest.rst:689 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "are displayed using a unified diff." msgstr "" -#: library/doctest.rst:650 +#: library/doctest.rst:695 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "will be displayed using a context diff." msgstr "" -#: library/doctest.rst:656 +#: library/doctest.rst:701 msgid "" "When specified, differences are computed by ``difflib.Differ``, using the " "same algorithm as the popular :file:`ndiff.py` utility. This is the only " @@ -623,7 +946,7 @@ msgid "" "mismatching column positions." msgstr "" -#: library/doctest.rst:665 +#: library/doctest.rst:710 msgid "" "When specified, display the first failing example in each doctest, but " "suppress output for all remaining examples. This will prevent doctest from " @@ -634,7 +957,7 @@ msgid "" "of failures reported; only the output is suppressed." msgstr "" -#: library/doctest.rst:676 +#: library/doctest.rst:721 msgid "" "When specified, exit after the first failing example and don't attempt to " "run the remaining examples. Thus, the number of failures reported will be at " @@ -642,23 +965,17 @@ msgid "" "first failure won't even produce debugging output." msgstr "" -#: library/doctest.rst:681 -msgid "" -"The doctest command line accepts the option ``-f`` as a shorthand for ``-o " -"FAIL_FAST``." -msgstr "" - -#: library/doctest.rst:689 +#: library/doctest.rst:729 msgid "A bitmask or'ing together all the reporting flags above." msgstr "" -#: library/doctest.rst:692 +#: library/doctest.rst:732 msgid "" "There is also a way to register new option flag names, though this isn't " "useful unless you intend to extend :mod:`doctest` internals via subclassing:" msgstr "" -#: library/doctest.rst:698 +#: library/doctest.rst:738 msgid "" "Create a new option flag with a given name, and return the new flag's " "integer value. :func:`register_optionflag` can be used when subclassing :" @@ -667,35 +984,46 @@ msgid "" "be called using the following idiom::" msgstr "" -#: library/doctest.rst:714 +#: library/doctest.rst:744 +msgid "MY_FLAG = register_optionflag('MY_FLAG')" +msgstr "" + +#: library/doctest.rst:754 msgid "Directives" msgstr "" -#: library/doctest.rst:716 +#: library/doctest.rst:756 msgid "" "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " "comments following an example's source code:" msgstr "" -#: library/doctest.rst:727 +#: library/doctest.rst:767 msgid "" "Whitespace is not allowed between the ``+`` or ``-`` and the directive " "option name. The directive option name can be any of the option flag names " "explained above." msgstr "" -#: library/doctest.rst:731 +#: library/doctest.rst:771 msgid "" "An example's doctest directives modify doctest's behavior for that single " "example. Use ``+`` to enable the named behavior, or ``-`` to disable it." msgstr "" -#: library/doctest.rst:734 +#: library/doctest.rst:774 msgid "For example, this test passes:" msgstr "" -#: library/doctest.rst:743 +#: library/doctest.rst:776 +msgid "" +">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" +"10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" +msgstr "" + +#: library/doctest.rst:783 msgid "" "Without the directive it would fail, both because the actual output doesn't " "have two blanks before the single-digit list elements, and because the " @@ -703,26 +1031,52 @@ msgid "" "a directive to do so:" msgstr "" -#: library/doctest.rst:754 +#: library/doctest.rst:788 +msgid "" +">>> print(list(range(20))) # doctest: +ELLIPSIS\n" +"[0, 1, ..., 18, 19]" +msgstr "" + +#: library/doctest.rst:794 msgid "" "Multiple directives can be used on a single physical line, separated by " "commas:" msgstr "" -#: library/doctest.rst:763 +#: library/doctest.rst:797 +msgid "" +">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" +"[0, 1, ..., 18, 19]" +msgstr "" + +#: library/doctest.rst:803 msgid "" "If multiple directive comments are used for a single example, then they are " "combined:" msgstr "" -#: library/doctest.rst:773 +#: library/doctest.rst:806 +msgid "" +">>> print(list(range(20))) # doctest: +ELLIPSIS\n" +"... # doctest: +NORMALIZE_WHITESPACE\n" +"[0, 1, ..., 18, 19]" +msgstr "" + +#: library/doctest.rst:813 msgid "" "As the previous example shows, you can add ``...`` lines to your example " "containing only directives. This can be useful when an example is too long " "for a directive to comfortably fit on the same line:" msgstr "" -#: library/doctest.rst:784 +#: library/doctest.rst:817 +msgid "" +">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" +"... # doctest: +ELLIPSIS\n" +"[0, ..., 4, 10, ..., 19, 30, ..., 39]" +msgstr "" + +#: library/doctest.rst:824 msgid "" "Note that since all options are disabled by default, and directives apply " "only to the example they appear in, enabling options (via ``+`` in a " @@ -732,11 +1086,11 @@ msgid "" "be useful." msgstr "" -#: library/doctest.rst:794 +#: library/doctest.rst:834 msgid "Warnings" msgstr "" -#: library/doctest.rst:796 +#: library/doctest.rst:836 msgid "" ":mod:`doctest` is serious about requiring exact matches in expected output. " "If even a single character doesn't match, the test fails. This will " @@ -746,51 +1100,101 @@ msgid "" "test like ::" msgstr "" -#: library/doctest.rst:805 +#: library/doctest.rst:842 +msgid "" +">>> foo()\n" +"{\"spam\", \"eggs\"}" +msgstr "" + +#: library/doctest.rst:845 msgid "is vulnerable! One workaround is to do ::" msgstr "" -#: library/doctest.rst:810 +#: library/doctest.rst:847 +msgid "" +">>> foo() == {\"spam\", \"eggs\"}\n" +"True" +msgstr "" + +#: library/doctest.rst:850 msgid "instead. Another is to do ::" msgstr "" -#: library/doctest.rst:816 +#: library/doctest.rst:852 +msgid "" +">>> d = sorted(foo())\n" +">>> d\n" +"['eggs', 'spam']" +msgstr "" + +#: library/doctest.rst:856 msgid "There are others, but you get the idea." msgstr "" -#: library/doctest.rst:818 +#: library/doctest.rst:858 msgid "Another bad idea is to print things that embed an object address, like" msgstr "" -#: library/doctest.rst:828 +#: library/doctest.rst:860 +msgid "" +">>> id(1.0) # certain to fail some of the time\n" +"7948648\n" +">>> class C: pass\n" +">>> C() # the default repr() for instances embeds an address\n" +"" +msgstr "" + +#: library/doctest.rst:868 msgid "" "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" -#: library/doctest.rst:836 +#: library/doctest.rst:870 +msgid "" +">>> C() # doctest: +ELLIPSIS\n" +"" +msgstr "" + +#: library/doctest.rst:876 msgid "" "Floating-point numbers are also subject to small output variations across " -"platforms, because Python defers to the platform C library for float " -"formatting, and C libraries vary widely in quality here. ::" +"platforms, because Python defers to the platform C library for some floating-" +"point calculations, and C libraries vary widely in quality here. ::" msgstr "" -#: library/doctest.rst:847 +#: library/doctest.rst:880 +msgid "" +">>> 1000**0.1 # risky\n" +"1.9952623149688797\n" +">>> round(1000**0.1, 9) # safer\n" +"1.995262315\n" +">>> print(f'{1000**0.1:.4f}') # much safer\n" +"1.9953" +msgstr "" + +#: library/doctest.rst:887 msgid "" "Numbers of the form ``I/2.**J`` are safe across all platforms, and I often " "contrive doctest examples to produce numbers of that form::" msgstr "" -#: library/doctest.rst:853 +#: library/doctest.rst:890 +msgid "" +">>> 3./4 # utterly safe\n" +"0.75" +msgstr "" + +#: library/doctest.rst:893 msgid "" "Simple fractions are also easier for people to understand, and that makes " "for better documentation." msgstr "" -#: library/doctest.rst:860 +#: library/doctest.rst:900 msgid "Basic API" msgstr "" -#: library/doctest.rst:862 +#: library/doctest.rst:902 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " @@ -798,25 +1202,25 @@ msgid "" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -#: library/doctest.rst:870 +#: library/doctest.rst:910 msgid "" "All arguments except *filename* are optional, and should be specified in " "keyword form." msgstr "" -#: library/doctest.rst:873 +#: library/doctest.rst:913 msgid "" "Test examples in the file named *filename*. Return ``(failure_count, " "test_count)``." msgstr "" -#: library/doctest.rst:876 +#: library/doctest.rst:916 msgid "" "Optional argument *module_relative* specifies how the filename should be " "interpreted:" msgstr "" -#: library/doctest.rst:879 +#: library/doctest.rst:919 msgid "" "If *module_relative* is ``True`` (the default), then *filename* specifies an " "OS-independent module-relative path. By default, this path is relative to " @@ -826,20 +1230,20 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" -#: library/doctest.rst:886 +#: library/doctest.rst:926 msgid "" "If *module_relative* is ``False``, then *filename* specifies an OS-specific " "path. The path may be absolute or relative; relative paths are resolved " "with respect to the current working directory." msgstr "" -#: library/doctest.rst:890 +#: library/doctest.rst:930 msgid "" "Optional argument *name* gives the name of the test; by default, or if " "``None``, ``os.path.basename(filename)`` is used." msgstr "" -#: library/doctest.rst:893 +#: library/doctest.rst:933 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for a module-" @@ -848,7 +1252,7 @@ msgid "" "is an error to specify *package* if *module_relative* is ``False``." msgstr "" -#: library/doctest.rst:899 +#: library/doctest.rst:939 msgid "" "Optional argument *globs* gives a dict to be used as the globals when " "executing examples. A new shallow copy of this dict is created for the " @@ -856,7 +1260,7 @@ msgid "" "``None``, a new empty dict is used." msgstr "" -#: library/doctest.rst:904 +#: library/doctest.rst:944 msgid "" "Optional argument *extraglobs* gives a dict merged into the globals used to " "execute examples. This works like :meth:`dict.update`: if *globs* and " @@ -869,27 +1273,27 @@ msgid "" "tested." msgstr "" -#: library/doctest.rst:913 +#: library/doctest.rst:953 msgid "" "Optional argument *verbose* prints lots of stuff if true, and prints only " "failures if false; by default, or if ``None``, it's true if and only if ``'-" -"v'`` is in ``sys.argv``." +"v'`` is in :data:`sys.argv`." msgstr "" -#: library/doctest.rst:917 +#: library/doctest.rst:957 msgid "" "Optional argument *report* prints a summary at the end when true, else " "prints nothing at the end. In verbose mode, the summary is detailed, else " "the summary is very brief (in fact, empty if all tests passed)." msgstr "" -#: library/doctest.rst:921 +#: library/doctest.rst:961 msgid "" -"Optional argument *optionflags* (default value 0) takes the :ref:`bitwise OR " -"` of option flags. See section :ref:`doctest-options`." +"Optional argument *optionflags* (default value ``0``) takes the :ref:" +"`bitwise OR ` of option flags. See section :ref:`doctest-options`." msgstr "" -#: library/doctest.rst:925 +#: library/doctest.rst:965 msgid "" "Optional argument *raise_on_error* defaults to false. If true, an exception " "is raised upon the first failure or unexpected exception in an example. " @@ -897,33 +1301,33 @@ msgid "" "continue running examples." msgstr "" -#: library/doctest.rst:1071 +#: library/doctest.rst:1113 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" -#: library/doctest.rst:1075 +#: library/doctest.rst:1117 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." msgstr "" -#: library/doctest.rst:940 +#: library/doctest.rst:980 msgid "" "All arguments are optional, and all except for *m* should be specified in " "keyword form." msgstr "" -#: library/doctest.rst:943 +#: library/doctest.rst:983 msgid "" "Test examples in docstrings in functions and classes reachable from module " "*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), " "starting with ``m.__doc__``." msgstr "" -#: library/doctest.rst:947 +#: library/doctest.rst:987 msgid "" "Also test examples reachable from dict ``m.__test__``, if it exists. ``m." "__test__`` maps names (strings) to functions, classes and strings; function " @@ -931,22 +1335,22 @@ msgid "" "directly, as if they were docstrings." msgstr "" -#: library/doctest.rst:952 +#: library/doctest.rst:992 msgid "" "Only docstrings attached to objects belonging to module *m* are searched." msgstr "" -#: library/doctest.rst:954 +#: library/doctest.rst:994 msgid "Return ``(failure_count, test_count)``." msgstr "" -#: library/doctest.rst:956 +#: library/doctest.rst:996 msgid "" "Optional argument *name* gives the name of the module; by default, or if " "``None``, ``m.__name__`` is used." msgstr "" -#: library/doctest.rst:959 +#: library/doctest.rst:999 msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " @@ -957,39 +1361,39 @@ msgid "" "defaults to true." msgstr "" -#: library/doctest.rst:967 +#: library/doctest.rst:1007 msgid "" "Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, " "*raise_on_error*, and *globs* are the same as for function :func:`testfile` " "above, except that *globs* defaults to ``m.__dict__``." msgstr "" -#: library/doctest.rst:974 +#: library/doctest.rst:1014 msgid "" "Test examples associated with object *f*; for example, *f* may be a string, " "a module, a function, or a class object." msgstr "" -#: library/doctest.rst:977 +#: library/doctest.rst:1017 msgid "" "A shallow copy of dictionary argument *globs* is used for the execution " "context." msgstr "" -#: library/doctest.rst:979 +#: library/doctest.rst:1019 msgid "" "Optional argument *name* is used in failure messages, and defaults to " "``\"NoName\"``." msgstr "" -#: library/doctest.rst:982 +#: library/doctest.rst:1022 msgid "" "If optional argument *verbose* is true, output is generated even if there " "are no failures. By default, output is generated only in case of an example " "failure." msgstr "" -#: library/doctest.rst:985 +#: library/doctest.rst:1025 msgid "" "Optional argument *compileflags* gives the set of flags that should be used " "by the Python compiler when running the examples. By default, or if " @@ -997,16 +1401,16 @@ msgid "" "found in *globs*." msgstr "" -#: library/doctest.rst:989 +#: library/doctest.rst:1029 msgid "" "Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" -#: library/doctest.rst:995 +#: library/doctest.rst:1035 msgid "Unittest API" msgstr "" -#: library/doctest.rst:997 +#: library/doctest.rst:1037 msgid "" "As your collection of doctest'ed modules grows, you'll want a way to run all " "their doctests systematically. :mod:`doctest` provides two functions that " @@ -1016,42 +1420,55 @@ msgid "" "your test module::" msgstr "" -#: library/doctest.rst:1011 +#: library/doctest.rst:1043 +msgid "" +"import unittest\n" +"import doctest\n" +"import my_module_with_doctests\n" +"\n" +"def load_tests(loader, tests, ignore):\n" +" tests.addTests(doctest.DocTestSuite(my_module_with_doctests))\n" +" return tests" +msgstr "" + +#: library/doctest.rst:1051 msgid "" "There are two main functions for creating :class:`unittest.TestSuite` " "instances from text files and modules with doctests:" msgstr "" -#: library/doctest.rst:1017 +#: library/doctest.rst:1057 msgid "" "Convert doctest tests from one or more text files to a :class:`unittest." "TestSuite`." msgstr "" -#: library/doctest.rst:1020 +#: library/doctest.rst:1060 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs the interactive examples in each file. If an example in " -"any file fails, then the synthesized unit test fails, and a :exc:" -"`failureException` exception is raised showing the name of the file " -"containing the test and a (sometimes approximate) line number." +"any file fails, then the synthesized unit test fails, and a :exc:`~unittest." +"TestCase.failureException` exception is raised showing the name of the file " +"containing the test and a (sometimes approximate) line number. If all the " +"examples in a file are skipped, then the synthesized unit test is also " +"marked as skipped." msgstr "" -#: library/doctest.rst:1026 +#: library/doctest.rst:1067 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: library/doctest.rst:1028 +#: library/doctest.rst:1069 msgid "Options may be provided as keyword arguments:" msgstr "" -#: library/doctest.rst:1030 +#: library/doctest.rst:1071 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: library/doctest.rst:1033 +#: library/doctest.rst:1074 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1062,14 +1479,14 @@ msgid "" "``)." msgstr "" -#: library/doctest.rst:1041 +#: library/doctest.rst:1082 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -#: library/doctest.rst:1045 +#: library/doctest.rst:1086 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" @@ -1079,30 +1496,31 @@ msgid "" "``False``." msgstr "" -#: library/doctest.rst:1052 +#: library/doctest.rst:1093 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " -"will be passed a :class:`DocTest` object. The setUp function can access the " -"test globals as the *globs* attribute of the test passed." +"will be passed a :class:`DocTest` object. The *setUp* function can access " +"the test globals as the :attr:`~DocTest.globs` attribute of the test passed." msgstr "" -#: library/doctest.rst:1057 +#: library/doctest.rst:1098 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " -"function will be passed a :class:`DocTest` object. The setUp function can " -"access the test globals as the *globs* attribute of the test passed." +"function will be passed a :class:`DocTest` object. The *tearDown* function " +"can access the test globals as the :attr:`~DocTest.globs` attribute of the " +"test passed." msgstr "" -#: library/doctest.rst:1096 +#: library/doctest.rst:1104 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" -#: library/doctest.rst:1066 +#: library/doctest.rst:1108 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" @@ -1110,69 +1528,71 @@ msgid "" "for a better way to set reporting options." msgstr "" -#: library/doctest.rst:1078 +#: library/doctest.rst:1120 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: library/doctest.rst:1084 +#: library/doctest.rst:1126 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: library/doctest.rst:1086 +#: library/doctest.rst:1128 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " -"framework and runs each doctest in the module. If any of the doctests fail, " -"then the synthesized unit test fails, and a :exc:`failureException` " -"exception is raised showing the name of the file containing the test and a " -"(sometimes approximate) line number." +"framework and runs each doctest in the module. Each docstring is run as a " +"separate unit test. If any of the doctests fail, then the synthesized unit " +"test fails, and a :exc:`unittest.TestCase.failureException` exception is " +"raised showing the name of the file containing the test and a (sometimes " +"approximate) line number. If all the examples in a docstring are skipped, " +"then the" msgstr "" -#: library/doctest.rst:1092 +#: library/doctest.rst:1136 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" -#: library/doctest.rst:1100 +#: library/doctest.rst:1140 +msgid "" +"Optional argument *globs* is a dictionary containing the initial global " +"variables for the tests. A new copy of this dictionary is created for each " +"test. By default, *globs* is the module's :attr:`~module.__dict__`." +msgstr "" + +#: library/doctest.rst:1144 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" -#: library/doctest.rst:1103 +#: library/doctest.rst:1147 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -#: library/doctest.rst:1106 +#: library/doctest.rst:1150 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " -"for function :func:`DocFileSuite` above." +"for function :func:`DocFileSuite` above, but they are called for each " +"docstring." msgstr "" -#: library/doctest.rst:1109 +#: library/doctest.rst:1153 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: library/doctest.rst:1111 +#: library/doctest.rst:1155 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: library/doctest.rst:1117 -msgid "" -"When doctests which have been converted to unit tests by :func:" -"`DocFileSuite` or :func:`DocTestSuite` fail, this exception is raised " -"showing the name of the file containing the test and a (sometimes " -"approximate) line number." -msgstr "" - -#: library/doctest.rst:1121 +#: library/doctest.rst:1159 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1181,67 +1601,67 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: library/doctest.rst:1127 +#: library/doctest.rst:1165 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " "subclass of :class:`!DocTestCase`." msgstr "" -#: library/doctest.rst:1131 +#: library/doctest.rst:1169 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`!DocTestCase`. This is important for a subtle reason: when you run :" -"mod:`doctest` functions yourself, you can control the :mod:`doctest` options " -"in use directly, by passing option flags to :mod:`doctest` functions. " -"However, if you're writing a :mod:`unittest` framework, :mod:`unittest` " -"ultimately controls when and how tests get run. The framework author " -"typically wants to control :mod:`doctest` reporting options (perhaps, e.g., " -"specified by command line options), but there's no way to pass options " -"through :mod:`unittest` to :mod:`doctest` test runners." +"mod:`doctest` functions yourself, you can control the :mod:`!doctest` " +"options in use directly, by passing option flags to :mod:`!doctest` " +"functions. However, if you're writing a :mod:`unittest` framework, :mod:`!" +"unittest` ultimately controls when and how tests get run. The framework " +"author typically wants to control :mod:`!doctest` reporting options " +"(perhaps, e.g., specified by command line options), but there's no way to " +"pass options through :mod:`!unittest` to :mod:`!doctest` test runners." msgstr "" -#: library/doctest.rst:1141 +#: library/doctest.rst:1179 msgid "" -"For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` " +"For this reason, :mod:`doctest` also supports a notion of :mod:`!doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" -#: library/doctest.rst:1147 +#: library/doctest.rst:1185 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: library/doctest.rst:1149 +#: library/doctest.rst:1187 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -#: library/doctest.rst:1152 +#: library/doctest.rst:1190 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" "DocTestCase` looks at the option flags specified for the test case when the :" "class:`!DocTestCase` instance was constructed. If no reporting flags were " -"specified (which is the typical and expected case), :mod:`!doctest`'s :mod:" -"`unittest` reporting flags are :ref:`bitwise ORed ` into the option " +"specified (which is the typical and expected case), :mod:`!doctest`'s :mod:`!" +"unittest` reporting flags are :ref:`bitwise ORed ` into the option " "flags, and the option flags so augmented are passed to the :class:" "`DocTestRunner` instance created to run the doctest. If any reporting flags " "were specified when the :class:`!DocTestCase` instance was constructed, :mod:" -"`!doctest`'s :mod:`unittest` reporting flags are ignored." +"`!doctest`'s :mod:`!unittest` reporting flags are ignored." msgstr "" -#: library/doctest.rst:1163 +#: library/doctest.rst:1201 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" -#: library/doctest.rst:1170 +#: library/doctest.rst:1208 msgid "Advanced API" msgstr "" -#: library/doctest.rst:1172 +#: library/doctest.rst:1210 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " @@ -1249,85 +1669,97 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: library/doctest.rst:1177 +#: library/doctest.rst:1215 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" -#: library/doctest.rst:1180 +#: library/doctest.rst:1218 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: library/doctest.rst:1183 +#: library/doctest.rst:1221 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: library/doctest.rst:1186 +#: library/doctest.rst:1224 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: library/doctest.rst:1189 +#: library/doctest.rst:1227 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" -#: library/doctest.rst:1193 +#: library/doctest.rst:1231 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: library/doctest.rst:1196 +#: library/doctest.rst:1234 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: library/doctest.rst:1199 +#: library/doctest.rst:1237 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: library/doctest.rst:1202 +#: library/doctest.rst:1240 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: library/doctest.rst:1218 +#: library/doctest.rst:1243 +msgid "" +" list of:\n" +"+------+ +---------+\n" +"|module| --DocTestFinder-> | DocTest | --DocTestRunner-> results\n" +"+------+ | ^ +---------+ | ^ (printed)\n" +" | | | Example | | |\n" +" v | | ... | v |\n" +" DocTestParser | Example | OutputChecker\n" +" +---------+" +msgstr "" + +#: library/doctest.rst:1256 msgid "DocTest Objects" msgstr "" -#: library/doctest.rst:1223 +#: library/doctest.rst:1261 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" -#: library/doctest.rst:1227 +#: library/doctest.rst:1265 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: library/doctest.rst:1233 +#: library/doctest.rst:1271 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: library/doctest.rst:1239 +#: library/doctest.rst:1277 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " @@ -1335,57 +1767,57 @@ msgid "" "`globs` after the test is run." msgstr "" -#: library/doctest.rst:1247 +#: library/doctest.rst:1285 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" -#: library/doctest.rst:1253 +#: library/doctest.rst:1291 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " -"``None`` if the filename is unknown, or if the :class:`DocTest` was not " +"``None`` if the filename is unknown, or if the :class:`!DocTest` was not " "extracted from a file." msgstr "" -#: library/doctest.rst:1260 +#: library/doctest.rst:1298 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" -#: library/doctest.rst:1267 +#: library/doctest.rst:1305 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" -#: library/doctest.rst:1274 +#: library/doctest.rst:1312 msgid "Example Objects" msgstr "" -#: library/doctest.rst:1279 +#: library/doctest.rst:1317 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" -#: library/doctest.rst:1284 +#: library/doctest.rst:1322 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: library/doctest.rst:1290 +#: library/doctest.rst:1328 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -#: library/doctest.rst:1297 +#: library/doctest.rst:1335 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " @@ -1393,7 +1825,7 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: library/doctest.rst:1305 +#: library/doctest.rst:1343 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " @@ -1402,20 +1834,20 @@ msgid "" "unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: library/doctest.rst:1314 +#: library/doctest.rst:1352 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" -#: library/doctest.rst:1321 +#: library/doctest.rst:1359 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" -#: library/doctest.rst:1327 +#: library/doctest.rst:1365 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -1424,11 +1856,11 @@ msgid "" "default, no options are set." msgstr "" -#: library/doctest.rst:1337 +#: library/doctest.rst:1375 msgid "DocTestFinder objects" msgstr "" -#: library/doctest.rst:1342 +#: library/doctest.rst:1380 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " @@ -1436,48 +1868,48 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: library/doctest.rst:1347 +#: library/doctest.rst:1385 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" -#: library/doctest.rst:1350 +#: library/doctest.rst:1388 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -#: library/doctest.rst:1353 +#: library/doctest.rst:1391 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" -#: library/doctest.rst:1356 +#: library/doctest.rst:1394 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" -#: library/doctest.rst:1360 +#: library/doctest.rst:1398 msgid ":class:`DocTestFinder` defines the following method:" msgstr "" -#: library/doctest.rst:1365 +#: library/doctest.rst:1403 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" -#: library/doctest.rst:1368 +#: library/doctest.rst:1406 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -#: library/doctest.rst:1372 +#: library/doctest.rst:1410 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " @@ -1485,26 +1917,26 @@ msgid "" "module is used:" msgstr "" -#: library/doctest.rst:1376 +#: library/doctest.rst:1414 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: library/doctest.rst:1378 +#: library/doctest.rst:1416 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -#: library/doctest.rst:1382 +#: library/doctest.rst:1420 msgid "To find the name of the file containing the object." msgstr "" -#: library/doctest.rst:1384 +#: library/doctest.rst:1422 msgid "To help find the line number of the object within its file." msgstr "" -#: library/doctest.rst:1386 +#: library/doctest.rst:1424 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -1513,44 +1945,44 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: library/doctest.rst:1392 +#: library/doctest.rst:1430 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " -"shallow copy of the globals dictionary is created for each :class:`DocTest`. " -"If *globs* is not specified, then it defaults to the module's *__dict__*, if " -"specified, or ``{}`` otherwise. If *extraglobs* is not specified, then it " -"defaults to ``{}``." +"shallow copy of the globals dictionary is created for each :class:`!" +"DocTest`. If *globs* is not specified, then it defaults to the module's :" +"attr:`~module.__dict__`, if specified, or ``{}`` otherwise. If *extraglobs* " +"is not specified, then it defaults to ``{}``." msgstr "" -#: library/doctest.rst:1403 +#: library/doctest.rst:1441 msgid "DocTestParser objects" msgstr "" -#: library/doctest.rst:1408 +#: library/doctest.rst:1446 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" -#: library/doctest.rst:1412 +#: library/doctest.rst:1450 msgid ":class:`DocTestParser` defines the following methods:" msgstr "" -#: library/doctest.rst:1417 +#: library/doctest.rst:1455 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" -#: library/doctest.rst:1420 +#: library/doctest.rst:1458 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" -"`DocTest` object. See the documentation for :class:`DocTest` for more " +"`!DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" -#: library/doctest.rst:1427 +#: library/doctest.rst:1465 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " @@ -1558,35 +1990,51 @@ msgid "" "error messages." msgstr "" -#: library/doctest.rst:1434 +#: library/doctest.rst:1472 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " -"the :class:`Example`\\ s are 0-based. The optional argument *name* is a " +"the :class:`!Example`\\ s are 0-based. The optional argument *name* is a " "name identifying this string, and is only used for error messages." msgstr "" -#: library/doctest.rst:1443 +#: library/doctest.rst:1479 +msgid "TestResults objects" +msgstr "" + +#: library/doctest.rst:1486 +msgid "Number of failed tests." +msgstr "" + +#: library/doctest.rst:1490 +msgid "Number of attempted tests." +msgstr "" + +#: library/doctest.rst:1494 +msgid "Number of skipped tests." +msgstr "" + +#: library/doctest.rst:1502 msgid "DocTestRunner objects" msgstr "" -#: library/doctest.rst:1448 +#: library/doctest.rst:1507 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" -#: library/doctest.rst:1451 +#: library/doctest.rst:1510 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " "option flags; see section :ref:`doctest-options` for more information. If " "the option flags are insufficient, then the comparison may also be " -"customized by passing a subclass of :class:`OutputChecker` to the " +"customized by passing a subclass of :class:`!OutputChecker` to the " "constructor." msgstr "" -#: library/doctest.rst:1457 +#: library/doctest.rst:1516 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`run`; this function will be called " @@ -1597,14 +2045,14 @@ msgid "" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" -#: library/doctest.rst:1465 +#: library/doctest.rst:1524 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" -#: library/doctest.rst:1469 +#: library/doctest.rst:1528 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " @@ -1613,60 +2061,68 @@ msgid "" "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" -#: library/doctest.rst:1475 +#: library/doctest.rst:1534 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" -#: library/doctest.rst:1480 +#: library/doctest.rst:1538 +msgid "" +"The test runner accumulates statistics. The aggregated number of attempted, " +"failed and skipped examples is also available via the :attr:`tries`, :attr:" +"`failures` and :attr:`skips` attributes. The :meth:`run` and :meth:" +"`summarize` methods return a :class:`TestResults` instance." +msgstr "" + +#: library/doctest.rst:1543 msgid ":class:`DocTestRunner` defines the following methods:" msgstr "" -#: library/doctest.rst:1485 +#: library/doctest.rst:1548 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -#: library/doctest.rst:1489 +#: library/doctest.rst:1552 msgid "" "*example* is the example about to be processed. *test* is the test " -"*containing example*. *out* is the output function that was passed to :meth:" +"containing *example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" -#: library/doctest.rst:1496 +#: library/doctest.rst:1559 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -#: library/doctest.rst:1511 +#: library/doctest.rst:1574 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: library/doctest.rst:1507 +#: library/doctest.rst:1570 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -#: library/doctest.rst:1518 +#: library/doctest.rst:1581 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" -#: library/doctest.rst:1522 +#: library/doctest.rst:1585 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" @@ -1674,13 +2130,14 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: library/doctest.rst:1530 +#: library/doctest.rst:1593 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " -"results using the writer function *out*." +"results using the writer function *out*. Return a :class:`TestResults` " +"instance." msgstr "" -#: library/doctest.rst:1533 +#: library/doctest.rst:1597 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " @@ -1688,39 +2145,54 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: library/doctest.rst:1538 +#: library/doctest.rst:1602 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" -#: library/doctest.rst:1542 +#: library/doctest.rst:1606 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`!DocTestRunner." "report_\\*` methods." msgstr "" -#: library/doctest.rst:1549 +#: library/doctest.rst:1613 msgid "" "Print a summary of all the test cases that have been run by this " -"DocTestRunner, and return a :term:`named tuple` ``TestResults(failed, " -"attempted)``." +"DocTestRunner, and return a :class:`TestResults` instance." msgstr "" -#: library/doctest.rst:1552 +#: library/doctest.rst:1616 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" -#: library/doctest.rst:1559 +#: library/doctest.rst:1620 +msgid ":class:`DocTestParser` has the following attributes:" +msgstr "" + +#: library/doctest.rst:1624 +msgid "Number of attempted examples." +msgstr "" + +#: library/doctest.rst:1628 +msgid "Number of failed examples." +msgstr "" + +#: library/doctest.rst:1632 +msgid "Number of skipped examples." +msgstr "" + +#: library/doctest.rst:1640 msgid "OutputChecker objects" msgstr "" -#: library/doctest.rst:1564 +#: library/doctest.rst:1645 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" @@ -1729,11 +2201,11 @@ msgid "" "string describing the differences between two outputs." msgstr "" -#: library/doctest.rst:1571 +#: library/doctest.rst:1652 msgid ":class:`OutputChecker` defines the following methods:" msgstr "" -#: library/doctest.rst:1575 +#: library/doctest.rst:1656 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " @@ -1742,28 +2214,28 @@ msgid "" "`doctest-options` for more information about option flags." msgstr "" -#: library/doctest.rst:1584 +#: library/doctest.rst:1665 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" -#: library/doctest.rst:1592 +#: library/doctest.rst:1673 msgid "Debugging" msgstr "" -#: library/doctest.rst:1594 +#: library/doctest.rst:1675 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -#: library/doctest.rst:1596 +#: library/doctest.rst:1677 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: library/doctest.rst:1599 +#: library/doctest.rst:1680 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -1771,13 +2243,13 @@ msgid "" "debugging on the example." msgstr "" -#: library/doctest.rst:1604 +#: library/doctest.rst:1685 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: library/doctest.rst:1607 +#: library/doctest.rst:1688 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " @@ -1785,21 +2257,67 @@ msgid "" "`a.py` contains just this module docstring::" msgstr "" -#: library/doctest.rst:1622 +#: library/doctest.rst:1693 +msgid "" +"\"\"\"\n" +">>> def f(x):\n" +"... g(x*2)\n" +">>> def g(x):\n" +"... print(x+3)\n" +"... import pdb; pdb.set_trace()\n" +">>> f(3)\n" +"9\n" +"\"\"\"" +msgstr "" + +#: library/doctest.rst:1703 msgid "Then an interactive Python session may look like this::" msgstr "" -#: library/doctest.rst:1655 +#: library/doctest.rst:1705 +msgid "" +">>> import a, doctest\n" +">>> doctest.testmod(a)\n" +"--Return--\n" +"> (3)g()->None\n" +"-> import pdb; pdb.set_trace()\n" +"(Pdb) list\n" +" 1 def g(x):\n" +" 2 print(x+3)\n" +" 3 -> import pdb; pdb.set_trace()\n" +"[EOF]\n" +"(Pdb) p x\n" +"6\n" +"(Pdb) step\n" +"--Return--\n" +"> (2)f()->None\n" +"-> g(x*2)\n" +"(Pdb) list\n" +" 1 def f(x):\n" +" 2 -> g(x*2)\n" +"[EOF]\n" +"(Pdb) p x\n" +"3\n" +"(Pdb) step\n" +"--Return--\n" +"> (1)?()->None\n" +"-> f(3)\n" +"(Pdb) cont\n" +"(0, 3)\n" +">>>" +msgstr "" + +#: library/doctest.rst:1736 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: library/doctest.rst:1661 +#: library/doctest.rst:1742 msgid "Convert text with examples to a script." msgstr "" -#: library/doctest.rst:1663 +#: library/doctest.rst:1744 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " @@ -1807,22 +2325,46 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: library/doctest.rst:1678 +#: library/doctest.rst:1749 +msgid "" +"import doctest\n" +"print(doctest.script_from_examples(r\"\"\"\n" +" Set x and y to 1 and 2.\n" +" >>> x, y = 1, 2\n" +"\n" +" Print their sum:\n" +" >>> print(x+y)\n" +" 3\n" +"\"\"\"))" +msgstr "" + +#: library/doctest.rst:1759 msgid "displays::" msgstr "" -#: library/doctest.rst:1688 +#: library/doctest.rst:1761 +msgid "" +"# Set x and y to 1 and 2.\n" +"x, y = 1, 2\n" +"#\n" +"# Print their sum:\n" +"print(x+y)\n" +"# Expected:\n" +"## 3" +msgstr "" + +#: library/doctest.rst:1769 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" -#: library/doctest.rst:1695 +#: library/doctest.rst:1776 msgid "Convert the doctest for an object to a script." msgstr "" -#: library/doctest.rst:1697 +#: library/doctest.rst:1778 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -1832,17 +2374,23 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" -#: library/doctest.rst:1707 +#: library/doctest.rst:1785 +msgid "" +"import a, doctest\n" +"print(doctest.testsource(a, \"a.f\"))" +msgstr "" + +#: library/doctest.rst:1788 msgid "" "prints a script version of function :func:`!f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" -#: library/doctest.rst:1713 +#: library/doctest.rst:1794 msgid "Debug the doctests for an object." msgstr "" -#: library/doctest.rst:1715 +#: library/doctest.rst:1796 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " @@ -1850,13 +2398,13 @@ msgid "" "the control of the Python debugger, :mod:`pdb`." msgstr "" -#: library/doctest.rst:1720 +#: library/doctest.rst:1801 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: library/doctest.rst:1723 +#: library/doctest.rst:1804 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " @@ -1868,30 +2416,30 @@ msgid "" "to :func:`pdb.run`." msgstr "" -#: library/doctest.rst:1734 +#: library/doctest.rst:1815 msgid "Debug the doctests in a string." msgstr "" -#: library/doctest.rst:1736 +#: library/doctest.rst:1817 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" -#: library/doctest.rst:1739 +#: library/doctest.rst:1820 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: library/doctest.rst:1741 +#: library/doctest.rst:1822 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" -#: library/doctest.rst:1746 +#: library/doctest.rst:1827 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " @@ -1899,7 +2447,7 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: library/doctest.rst:1754 +#: library/doctest.rst:1835 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" @@ -1909,89 +2457,89 @@ msgid "" "the actual output." msgstr "" -#: library/doctest.rst:1761 +#: library/doctest.rst:1842 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" -#: library/doctest.rst:1764 +#: library/doctest.rst:1845 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: library/doctest.rst:1769 +#: library/doctest.rst:1850 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -#: library/doctest.rst:1773 +#: library/doctest.rst:1854 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr "" -#: library/doctest.rst:1802 +#: library/doctest.rst:1883 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: library/doctest.rst:1807 +#: library/doctest.rst:1888 msgid "The :class:`Example` that failed." msgstr "" -#: library/doctest.rst:1788 +#: library/doctest.rst:1869 msgid "The example's actual output." msgstr "" -#: library/doctest.rst:1793 +#: library/doctest.rst:1874 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -#: library/doctest.rst:1797 +#: library/doctest.rst:1878 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr "" -#: library/doctest.rst:1812 +#: library/doctest.rst:1893 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: library/doctest.rst:1819 +#: library/doctest.rst:1900 msgid "Soapbox" msgstr "" -#: library/doctest.rst:1821 +#: library/doctest.rst:1902 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: library/doctest.rst:1824 +#: library/doctest.rst:1905 msgid "Checking examples in docstrings." msgstr "" -#: library/doctest.rst:1826 +#: library/doctest.rst:1907 msgid "Regression testing." msgstr "" -#: library/doctest.rst:1828 +#: library/doctest.rst:1909 msgid "Executable documentation / literate testing." msgstr "" -#: library/doctest.rst:1830 +#: library/doctest.rst:1911 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" -#: library/doctest.rst:1834 +#: library/doctest.rst:1915 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " @@ -2003,7 +2551,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: library/doctest.rst:1842 +#: library/doctest.rst:1923 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -2024,13 +2572,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: library/doctest.rst:1860 +#: library/doctest.rst:1941 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: library/doctest.rst:1863 +#: library/doctest.rst:1944 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2038,7 +2586,7 @@ msgid "" "doctest." msgstr "" -#: library/doctest.rst:1868 +#: library/doctest.rst:1949 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2046,13 +2594,13 @@ msgid "" "test file." msgstr "" -#: library/doctest.rst:1872 +#: library/doctest.rst:1953 msgid "" -"Define a ``__test__`` dictionary mapping from regression test topics to " -"docstrings containing test cases." +"Define a :attr:`~module.__test__` dictionary mapping from regression test " +"topics to docstrings containing test cases." msgstr "" -#: library/doctest.rst:1875 +#: library/doctest.rst:1956 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" @@ -2060,53 +2608,71 @@ msgid "" "example of such a test runner::" msgstr "" -#: library/doctest.rst:1897 +#: library/doctest.rst:1961 +msgid "" +"if __name__ == '__main__':\n" +" import doctest\n" +" flags = doctest.REPORT_NDIFF|doctest.FAIL_FAST\n" +" if len(sys.argv) > 1:\n" +" name = sys.argv[1]\n" +" if name in globals():\n" +" obj = globals()[name]\n" +" else:\n" +" obj = __test__[name]\n" +" doctest.run_docstring_examples(obj, globals(), name=name,\n" +" optionflags=flags)\n" +" else:\n" +" fail, total = doctest.testmod(optionflags=flags)\n" +" print(f\"{fail} failures out of {total} tests\")" +msgstr "" + +#: library/doctest.rst:1978 msgid "Footnotes" msgstr "" -#: library/doctest.rst:1898 +#: library/doctest.rst:1979 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " "that also makes for a confusing test." msgstr "" -#: library/doctest.rst:339 +#: library/doctest.rst:387 msgid ">>>" msgstr "" -#: library/doctest.rst:339 +#: library/doctest.rst:387 msgid "interpreter prompt" msgstr "" -#: library/doctest.rst:577 +#: library/doctest.rst:622 msgid "..." msgstr "" -#: library/doctest.rst:505 +#: library/doctest.rst:553 msgid "^ (caret)" msgstr "" -#: library/doctest.rst:505 +#: library/doctest.rst:553 msgid "marker" msgstr "" -#: library/doctest.rst:557 +#: library/doctest.rst:602 msgid "" msgstr "" -#: library/doctest.rst:707 +#: library/doctest.rst:747 msgid "in doctests" msgstr "" -#: library/doctest.rst:707 +#: library/doctest.rst:747 msgid "# (hash)" msgstr "" -#: library/doctest.rst:707 +#: library/doctest.rst:747 msgid "+ (plus)" msgstr "" -#: library/doctest.rst:707 +#: library/doctest.rst:747 msgid "- (minus)" msgstr "" diff --git a/library/email.charset.po b/library/email.charset.po index b09be3ce..3a19f910 100644 --- a/library/email.charset.po +++ b/library/email.charset.po @@ -8,33 +8,37 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-01-27 01:00+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.charset.rst:2 -msgid ":mod:`email.charset`: Representing character sets" -msgstr "" +msgid ":mod:`!email.charset`: Representing character sets" +msgstr ":mod:`!email.charset`: Αναπαράσταση συνόλων χαρακτήρων" #: library/email.charset.rst:7 msgid "**Source code:** :source:`Lib/email/charset.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/email.charset.py`" #: library/email.charset.rst:11 msgid "" "This module is part of the legacy (``Compat32``) email API. In the new API " "only the aliases table is used." msgstr "" +"Αυτό το module αποτελεί μέρος του παλιού API (``Compat32``) του email. Στο " +"νέο API, χρησιμοποιείται μόνο ο πίνακας των ψευδωνύμων." #: library/email.charset.rst:14 msgid "" "The remaining text in this section is the original documentation of the " "module." msgstr "" +"Το υπόλοιπο κείμενο σε αυτή την ενότητα είναι η αρχική τεκμηρίωση του module." #: library/email.charset.rst:16 msgid "" @@ -44,14 +48,19 @@ msgid "" "Instances of :class:`Charset` are used in several other modules within the :" "mod:`email` package." msgstr "" +"Αυτό το module παρέχει την κλάση :class:`Charset` για την αναπαράσταση των " +"συνόλων χαρακτήρων και των μετατροπών τους σε μηνύματα email, καθώς και ένα " +"μητρώο συνόλων χαρακτήρων και διάφορες βοηθητικές μεθόδους για τη διαχείρισή " +"του. Τα στιγμιότυπα της :class:`Charset` χρησιμοποιούνται σε αρκετά άλλα " +"modules εντός του πακέτου :mod:`email`." #: library/email.charset.rst:22 msgid "Import this class from the :mod:`email.charset` module." -msgstr "" +msgstr "Εισάγετε αυτή την κλάση από το module :mod:`email.charset`." #: library/email.charset.rst:27 msgid "Map character sets to their email properties." -msgstr "" +msgstr "Αντιστοίχιση συνόλων χαρακτήρων στις ιδιότητες τους στο email." #: library/email.charset.rst:29 msgid "" @@ -61,6 +70,12 @@ msgid "" "codecs. Given a character set, it will do its best to provide information " "on how to use that character set in an email message in an RFC-compliant way." msgstr "" +"Αυτή η κλάση παρέχει πληροφορίες σχετικά με τις απαιτήσεις που επιβάλλονται " +"σε ένα email για ένα συγκεκριμένο σύνολο χαρακτήρων. Παρέχει επίσης " +"βοηθητικές ρουτίνες για την μετατροπή μεταξύ συνόλων χαρακτήρων, εφόσον " +"είναι διαθέσιμα τα αντίστοιχα codecs. Δεδομένου ενός συνόλου χαρακτήρων, θα " +"προσπαθήσει να παρέχει πληροφορίες σχετικά με τον τρόπο χρήσης του σε ένα " +"email με τρόπο συμβατό με το RFC." #: library/email.charset.rst:35 msgid "" @@ -68,6 +83,9 @@ msgid "" "used in email headers or bodies. Certain character sets must be converted " "outright, and are not allowed in email." msgstr "" +"Ορισμένα σύνολα χαρακτήρων πρέπει να κωδικοποιούνται με quoted-printable ή " +"base64 όταν χρησιμοποιούνται σε κεφαλίδες ή σώματα email. Ορισμένα σύνολα " +"χαρακτήρων πρέπει να μετατραπούν πλήρως και δεν επιτρέπονται στα email." #: library/email.charset.rst:39 msgid "" @@ -81,10 +99,23 @@ msgid "" "with base64, bodies will not be encoded, but output text will be converted " "from the ``euc-jp`` character set to the ``iso-2022-jp`` character set." msgstr "" +"Το προαιρετικό *input_charset* περιγράφεται παρακάτω· μετατρέπεται πάντα σε " +"πεζά. Μετά την κανονικοποίηση ψευδωνύμων, χρησιμοποιείται επίσης ως " +"αναζήτηση στο μητρώο των συνόλων χαρακτήρων για να προσδιορίσει την " +"κωδικοποίηση κεφαλίδας, την κωδικοποίηση σώματος και τον κωδικοποιητή " +"μετατροπής εξόδου που θα χρησιμοποιηθεί για το σύνολο χαρακτήρων. Για " +"παράδειγμα, εάν το *input_charset* είναι ``iso-8859-1``, τότε οι κεφαλίδες " +"και τα σώματα θα κωδικοποιηθούν χρησιμοποιώντας quoted-printable και δεν " +"απαιτείται codec μετατροπής εξόδου. Εάν το *input_charset* είναι ``euc-jp``, " +"τότε οι κεφαλίδες θα κωδικοποιηθούν με base64, τα σώματα δεν θα " +"κωδικοποιηθούν, αλλά το κείμενο εξόδου θα μετατραπεί από το σύνολο " +"χαρακτήρων ``euc-jp`` στο ``iso-2022-jp``." #: library/email.charset.rst:49 msgid ":class:`Charset` instances have the following data attributes:" msgstr "" +"Στιγμιότυπα της κλάσης :class:`Charset` έχουν τα ακόλουθα χαρακτηριστικά " +"δεδομένων:" #: library/email.charset.rst:53 msgid "" @@ -92,6 +123,9 @@ msgid "" "*official* email names (e.g. ``latin_1`` is converted to ``iso-8859-1``). " "Defaults to 7-bit ``us-ascii``." msgstr "" +"Το αρχικό σύνολο χαρακτήρων καθορίζεται. Τα κοινά ψευδώνυμα μετατρέπονται " +"στα *επίσημα* ονόματα τους για το email (π.χ. το ``latin_1`` μετατρέπεται σε " +"``iso-8859-1``). Προεπιλογή είναι το 7-bit ``us-ascii``." #: library/email.charset.rst:60 msgid "" @@ -100,6 +134,11 @@ msgid "" "``charset.BASE64`` (for base64 encoding), or ``charset.SHORTEST`` for the " "shortest of QP or BASE64 encoding. Otherwise, it will be ``None``." msgstr "" +"Εάν το σύνολο χαρακτήρων πρέπει να κωδικοποιηθεί πριν χρησιμοποιηθεί σε " +"κεφαλίδα email, αυτό το χαρακτηριστικό θα οριστεί σε ``charset.QP`` (για " +"quoted-printable), ``charset.BASE64`` (για κωδικοποίηση base64), ή ``charset." +"SHORTEST`` για την πιο σύντομη κωδικοποίηση από QP ή BASE64. Διαφορετικά, θα " +"είναι ``None``." #: library/email.charset.rst:69 msgid "" @@ -107,6 +146,10 @@ msgid "" "body, which indeed may be different than the header encoding. ``charset." "SHORTEST`` is not allowed for *body_encoding*." msgstr "" +"Ίδιο με το *header_encoding*, αλλά περιγράφει την κωδικοποίηση για το σώμα " +"του μηνύματος email, το οποίο μπορεί να είναι διαφορετικό από την " +"κωδικοποίηση της κεφαλίδας. Η τιμή ``charset.SHORTEST`` δεν επιτρέπεται για " +"το *body_encoding*." #: library/email.charset.rst:76 msgid "" @@ -115,6 +158,10 @@ msgid "" "will contain the name of the character set output will be converted to. " "Otherwise, it will be ``None``." msgstr "" +"Ορισμένα σύνολα χαρακτήρων πρέπει να μετατραπούν πριν χρησιμοποιηθούν σε " +"κεφαλίδες ή σώματα email. Αν το *input_charset* είναι ένα από αυτά, αυτό το " +"χαρακτηριστικό θα περιέχει το όνομα του συνόλου χαρακτήρων στο οποίο θα " +"μετατραπεί η έξοδος. Αλλιώς, θα είναι ``None``." #: library/email.charset.rst:84 msgid "" @@ -122,6 +169,9 @@ msgid "" "Unicode. If no conversion codec is necessary, this attribute will be " "``None``." msgstr "" +"Το όνομα του Python codec που χρησιμοποιείται για την μετατροπή του " +"*input_charset* σε Unicode. Αν δεν απαιτείται codec μετατροπής, αυτό το " +"χαρακτηριστικό θα είναι ``None``." #: library/email.charset.rst:91 msgid "" @@ -129,14 +179,20 @@ msgid "" "*output_charset*. If no conversion codec is necessary, this attribute will " "have the same value as the *input_codec*." msgstr "" +"Το όνομα του Python codec που χρησιμοποιείται για την μετατροπή του Unicode " +"στο *output_charset*. Αν δεν απαιτείται codec μετατροπής, αυτό το " +"χαρακτηριστικό θα έχει την ίδια τιμή με το *input_codec*." #: library/email.charset.rst:96 msgid ":class:`Charset` instances also have the following methods:" msgstr "" +"Στιγμιότυπα της κλάσης :class:`Charset` διαθέτουν επίσης τις εξής μεθόδους:" #: library/email.charset.rst:100 msgid "Return the content transfer encoding used for body encoding." msgstr "" +"Επιστρέφει τον κωδικοποιητή μεταφοράς περιεχομένου που χρησιμοποιείται για " +"την κωδικοποίηση του σώματος." #: library/email.charset.rst:102 msgid "" @@ -146,6 +202,11 @@ msgid "" "function should then set the :mailheader:`Content-Transfer-Encoding` header " "itself to whatever is appropriate." msgstr "" +"Αυτή είναι είτε η συμβολοσειρά ``quoted-printable`` ή ``base64``, ανάλογα με " +"την κωδικοποίηση που χρησιμοποιείται, είτε είναι μια συνάρτηση, οπότε πρέπει " +"να καλέσετε τη συνάρτηση με ένα μόνο όρισμα, το αντικείμενο Message που " +"κωδικοποιείται. Η συνάρτηση θα πρέπει στη συνέχεια να ορίσει την κεφαλίδα :" +"mailheader:`Content-Transfer-Encoding` η ίδια, σε ότι είναι κατάλληλο." #: library/email.charset.rst:108 msgid "" @@ -153,30 +214,39 @@ msgid "" "returns the string ``base64`` if *body_encoding* is ``BASE64``, and returns " "the string ``7bit`` otherwise." msgstr "" +"Επιστρέφει την συμβολοσειρά ``quoted-printable`` αν το *body_encoding* είναι " +"``QP``, επιστρέφει την συμβολοσειρά ``base64`` αν το *body_encoding* είναι " +"``BASE64``, και επιστρέφει την συμβολοσειρά ``7bit`` διαφορετικά." #: library/email.charset.rst:115 msgid "Return the output character set." -msgstr "" +msgstr "Επιστρέφει το σύνολο χαρακτήρων εξόδου." #: library/email.charset.rst:117 msgid "" "This is the *output_charset* attribute if that is not ``None``, otherwise it " "is *input_charset*." msgstr "" +"Αυτό είναι το χαρακτηριστικό *output_charset* αν δεν είναι ``None``, " +"διαφορετικά είναι το *input_charset*." #: library/email.charset.rst:123 msgid "Header-encode the string *string*." -msgstr "" +msgstr "Κωδικοποιεί την κεφαλίδα της συμβολοσειράς *string*." #: library/email.charset.rst:125 msgid "" "The type of encoding (base64 or quoted-printable) will be based on the " "*header_encoding* attribute." msgstr "" +"Ο τύπος κωδικοποίησης (base64 ή quoted-printable) θα βασίζεται στο " +"χαρακτηριστικό *header_encoding*." #: library/email.charset.rst:131 msgid "Header-encode a *string* by converting it first to bytes." msgstr "" +"Κωδικοποιεί την κεφαλίδα μιας συμβολοσειράς *string* μετατρέποντας το πρώτα " +"σε bytes." #: library/email.charset.rst:133 msgid "" @@ -185,56 +255,77 @@ msgid "" "iterator: each element returned from this iterator will provide the next " "maximum line length." msgstr "" +"Αυτό είναι παρόμοιο με την μέθοδο :meth:`header_encode`, εκτός από το ότι το " +"string τοποθετείται στις μέγιστες γραμμές μήκους που δίνονται από το όρισμα " +"*maxlengths*, το οποίο πρέπει να είναι ένας iterator: κάθε στοιχείο που " +"επιστρέφεται από αυτόν τον iterator θα παρέχει το επόμενο μέγιστο μήκος " +"γραμμής." #: library/email.charset.rst:141 msgid "Body-encode the string *string*." -msgstr "" +msgstr "Κωδικοποίηση σώματος της συμβολοσειράς *string*." #: library/email.charset.rst:143 msgid "" "The type of encoding (base64 or quoted-printable) will be based on the " "*body_encoding* attribute." msgstr "" +"Ο τύπος κωδικοποίησης (base64 ή quoted-printable) θα βασίζεται στο " +"χαρακτηριστικό *body_encoding*." #: library/email.charset.rst:146 msgid "" "The :class:`Charset` class also provides a number of methods to support " "standard operations and built-in functions." msgstr "" +"Η κλάση :class:`Charset` παρέχει επίσης αρκετές μεθόδους για να υποστηρίξει " +"τις τυπικές λειτουργίες και τις ενσωματωμένες συναρτήσεις." #: library/email.charset.rst:152 msgid "" "Returns *input_charset* as a string coerced to lower case. :meth:`!__repr__` " "is an alias for :meth:`!__str__`." msgstr "" +"Επιστρέφει το *input_charset* ως συμβολοσειρά που έχει μετατραπεί σε πεζά. Η " +"μέθοδος :meth:`!__repr__` είναι ένα ψευδώνυμο για την μέθοδο :meth:`!" +"__str__`." #: library/email.charset.rst:158 msgid "" "This method allows you to compare two :class:`Charset` instances for " "equality." msgstr "" +"Αυτή η μέθοδος σας επιτρέπει να συγκρίνετε δύο στιγμιότυπα της κλάσης :class:" +"`Charset` για ισότητα." #: library/email.charset.rst:164 msgid "" "This method allows you to compare two :class:`Charset` instances for " "inequality." msgstr "" +"Αυτή η μέθοδος σας επιτρέπει να συγκρίνετε δύο στιγμιότυπα της κλάσης :class:" +"`Charset` για ανισότητα." #: library/email.charset.rst:167 msgid "" "The :mod:`email.charset` module also provides the following functions for " "adding new entries to the global character set, alias, and codec registries:" msgstr "" +"Το module :mod:`email.charset` παρέχει επίσης τις εξής συναρτήσεις για " +"προσθήκη νέων καταχωρήσεων στις καθολικά μητρώα συνόλων χαρακτήρων, " +"ψευδωνύμων και κωδικοποιητών:" #: library/email.charset.rst:173 msgid "Add character properties to the global registry." -msgstr "" +msgstr "Προσθέστε ιδιότητες χαρακτήρων στο καθολικό μητρώο." #: library/email.charset.rst:175 msgid "" "*charset* is the input character set, and must be the canonical name of a " "character set." msgstr "" +"Το *charset* είναι το σύνολο χαρακτήρων εισόδου, και πρέπει να είναι το " +"κανονικό όνομα ενός συνόλου χαρακτήρων." #: library/email.charset.rst:178 msgid "" @@ -244,6 +335,12 @@ msgid "" "encoding. ``SHORTEST`` is only valid for *header_enc*. The default is " "``None`` for no encoding." msgstr "" +"Προαιρετικά το *header_enc* και *body_enc* είναι είτε ``charset.QP`` για " +"κωδικοποίηση quoted-printable, ``charset.BASE64`` για κωδικοποίηση base64, " +"``charset.SHORTEST`` για την πιο σύντομη από τις κωδικοποιήσεις quoted-" +"printable ή base64, ή ``None`` για καμία κωδικοποίηση. Το ``SHORTEST`` είναι " +"έγκυρο μόνο για το *header_enc*. Η προεπιλογή είναι ``None`` για καμία " +"κωδικοποίηση." #: library/email.charset.rst:184 msgid "" @@ -252,6 +349,11 @@ msgid "" "charset when the method :meth:`Charset.convert` is called. The default is " "to output in the same character set as the input." msgstr "" +"Προαιρετικό *output_charset* είναι το σύνολο χαρακτήρων στο οποίο θα πρέπει " +"να βρίσκεται η έξοδος. Οι μετατροπές θα γίνονται από το εισερχόμενο σύνολο " +"χαρακτήρων, σε Unicode, και στη συνέχεια στο σύνολο χαρακτήρων εξόδου όταν " +"καλείται η μέθοδος :meth:`Charset.convert`. Η προεπιλογή είναι να εξάγεται " +"το ίδιο σύνολο χαρακτήρων με το εισερχόμενο." #: library/email.charset.rst:189 msgid "" @@ -260,30 +362,44 @@ msgid "" "codecs the module does not know about. See the :mod:`codecs` module's " "documentation for more information." msgstr "" +"Τόσο το *input_charset* όσο και το *output_charset* πρέπει να έχουν " +"καταχωρίσεις Unicode codec στη χαρτογράφηση χαρακτήρων προς codec του " +"module· χρησιμοποιήστε την συνάρτηση :func:`add_codec` για να προσθέσετε " +"codecs που το module δεν γνωρίζει. Δείτε την τεκμηρίωση του module :mod:" +"`codecs` για περισσότερες πληροφορίες." #: library/email.charset.rst:194 msgid "" "The global character set registry is kept in the module global dictionary " "``CHARSETS``." msgstr "" +"Το καθολικό μητρώο συνόλων χαρακτήρων διατηρείται στο καθολικό dictionary " +"του module ``CHARSETS``." #: library/email.charset.rst:200 msgid "" "Add a character set alias. *alias* is the alias name, e.g. ``latin-1``. " "*canonical* is the character set's canonical name, e.g. ``iso-8859-1``." msgstr "" +"Προσθέστε ένα ψευδώνυμο συνόλου χαρακτήρων. Το *alias* είναι το όνομα του " +"ψευδωνύμου, π.χ. ``latin-1``. Το *canonical* είναι το κανονικό όνομα του " +"συνόλου χαρακτήρων, π.χ. ``iso-8859-1``." #: library/email.charset.rst:203 msgid "" "The global charset alias registry is kept in the module global dictionary " "``ALIASES``." msgstr "" +"Το παγκόσμιο μητρώο ψευδωνύμων συνόλων χαρακτήρων διατηρείται στο καθολικό " +"λεξικό του module ``ALIASES``." #: library/email.charset.rst:209 msgid "" "Add a codec that map characters in the given character set to and from " "Unicode." msgstr "" +"Προσθέστε έναν κωδικοποιητή που αντιστοιχεί χαρακτήρες από το δεδομένο " +"σύνολο χαρακτήρων προς και από Unicode." #: library/email.charset.rst:211 msgid "" @@ -291,3 +407,6 @@ msgid "" "of a Python codec, as appropriate for the second argument to the :class:" "`str`'s :meth:`~str.encode` method." msgstr "" +"Το *charset* είναι το κανονικό όνομα ενός συνόλου χαρακτήρων. Το *codecname* " +"είναι το όνομα ενός κωδικοποιητή Python, ως κατάλληλο για το δεύτερο όρισμα " +"της μεθόδου :meth:`~str.encode` της κλάσης :class:`str`." diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index 3ad63734..99fb45f7 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -22,7 +23,7 @@ msgid "" "`~email.policy.compat32` API" msgstr "" -#: library/email.compat32-message.rst:12 +#: library/email.compat32-message.rst:13 msgid "" "The :class:`Message` class is very similar to the :class:`~email.message." "EmailMessage` class, without the methods added by that class, and with the " @@ -32,11 +33,11 @@ msgid "" "legacy code." msgstr "" -#: library/email.compat32-message.rst:19 +#: library/email.compat32-message.rst:20 msgid "The philosophy and structure of the two classes is otherwise the same." msgstr "" -#: library/email.compat32-message.rst:21 +#: library/email.compat32-message.rst:22 msgid "" "This document describes the behavior under the default (for :class:" "`Message`) policy :attr:`~email.policy.Compat32`. If you are going to use " @@ -44,7 +45,7 @@ msgid "" "class instead." msgstr "" -#: library/email.compat32-message.rst:25 +#: library/email.compat32-message.rst:26 msgid "" "An email message consists of *headers* and a *payload*. Headers must be :" "rfc:`5322` style names and values, where the field name and value are " @@ -56,7 +57,7 @@ msgid "" "`message/rfc822`." msgstr "" -#: library/email.compat32-message.rst:34 +#: library/email.compat32-message.rst:35 msgid "" "The conceptual model provided by a :class:`Message` object is that of an " "ordered dictionary of headers with additional methods for accessing both " @@ -66,7 +67,7 @@ msgid "" "methods must be used to access them." msgstr "" -#: library/email.compat32-message.rst:41 +#: library/email.compat32-message.rst:42 msgid "" "The :class:`Message` pseudo-dictionary is indexed by the header names, which " "must be ASCII values. The values of the dictionary are strings that are " @@ -80,11 +81,11 @@ msgid "" "mimetype:`multipart/\\*` and :mimetype:`message/rfc822`)." msgstr "" -#: library/email.compat32-message.rst:52 +#: library/email.compat32-message.rst:53 msgid "Here are the methods of the :class:`Message` class:" msgstr "" -#: library/email.compat32-message.rst:57 +#: library/email.compat32-message.rst:58 msgid "" "If *policy* is specified (it must be an instance of a :mod:`~email.policy` " "class) use the rules it specifies to update and serialize the representation " @@ -94,11 +95,11 @@ msgid "" "`~email.policy` documentation." msgstr "" -#: library/email.compat32-message.rst:64 +#: library/email.compat32-message.rst:65 msgid "The *policy* keyword argument was added." msgstr "" -#: library/email.compat32-message.rst:69 +#: library/email.compat32-message.rst:70 msgid "" "Return the entire message flattened as a string. When optional *unixfrom* " "is true, the envelope header is included in the returned string. *unixfrom* " @@ -111,14 +112,14 @@ msgid "" "*policy* will be passed to the ``Generator``." msgstr "" -#: library/email.compat32-message.rst:79 library/email.compat32-message.rst:121 +#: library/email.compat32-message.rst:80 library/email.compat32-message.rst:122 msgid "" "Flattening the message may trigger changes to the :class:`Message` if " "defaults need to be filled in to complete the transformation to a string " "(for example, MIME boundaries may be generated or modified)." msgstr "" -#: library/email.compat32-message.rst:83 +#: library/email.compat32-message.rst:84 msgid "" "Note that this method is provided as a convenience and may not always format " "the message the way you want. For example, by default it does not do the " @@ -128,7 +129,17 @@ msgid "" "method directly. For example::" msgstr "" -#: library/email.compat32-message.rst:97 +#: library/email.compat32-message.rst:91 +msgid "" +"from io import StringIO\n" +"from email.generator import Generator\n" +"fp = StringIO()\n" +"g = Generator(fp, mangle_from_=True, maxheaderlen=60)\n" +"g.flatten(msg)\n" +"text = fp.getvalue()" +msgstr "" + +#: library/email.compat32-message.rst:98 msgid "" "If the message object contains binary data that is not encoded according to " "RFC standards, the non-compliant data will be replaced by unicode \"unknown " @@ -136,17 +147,17 @@ msgid "" "generator.BytesGenerator`.)" msgstr "" -#: library/email.compat32-message.rst:102 +#: library/email.compat32-message.rst:103 msgid "the *policy* keyword argument was added." msgstr "" -#: library/email.compat32-message.rst:107 +#: library/email.compat32-message.rst:108 msgid "" -"Equivalent to :meth:`.as_string()`. Allows ``str(msg)`` to produce a string " +"Equivalent to :meth:`.as_string`. Allows ``str(msg)`` to produce a string " "containing the formatted message." msgstr "" -#: library/email.compat32-message.rst:113 +#: library/email.compat32-message.rst:114 msgid "" "Return the entire message flattened as a bytes object. When optional " "*unixfrom* is true, the envelope header is included in the returned string. " @@ -156,7 +167,7 @@ msgid "" "specified *policy* will be passed to the ``BytesGenerator``." msgstr "" -#: library/email.compat32-message.rst:125 +#: library/email.compat32-message.rst:126 msgid "" "Note that this method is provided as a convenience and may not always format " "the message the way you want. For example, by default it does not do the " @@ -166,13 +177,23 @@ msgid "" "flatten` method directly. For example::" msgstr "" -#: library/email.compat32-message.rst:145 +#: library/email.compat32-message.rst:134 +msgid "" +"from io import BytesIO\n" +"from email.generator import BytesGenerator\n" +"fp = BytesIO()\n" +"g = BytesGenerator(fp, mangle_from_=True, maxheaderlen=60)\n" +"g.flatten(msg)\n" +"text = fp.getvalue()" +msgstr "" + +#: library/email.compat32-message.rst:146 msgid "" -"Equivalent to :meth:`.as_bytes()`. Allows ``bytes(msg)`` to produce a bytes " +"Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a bytes " "object containing the formatted message." msgstr "" -#: library/email.compat32-message.rst:153 +#: library/email.compat32-message.rst:154 msgid "" "Return ``True`` if the message's payload is a list of sub-\\ :class:" "`Message` objects, otherwise return ``False``. When :meth:`is_multipart` " @@ -183,18 +204,18 @@ msgid "" "return ``True`` when the :class:`Message` is of type ``message/rfc822``.)" msgstr "" -#: library/email.compat32-message.rst:165 +#: library/email.compat32-message.rst:166 msgid "" "Set the message's envelope header to *unixfrom*, which should be a string." msgstr "" -#: library/email.compat32-message.rst:170 +#: library/email.compat32-message.rst:171 msgid "" "Return the message's envelope header. Defaults to ``None`` if the envelope " "header was never set." msgstr "" -#: library/email.compat32-message.rst:176 +#: library/email.compat32-message.rst:177 msgid "" "Add the given *payload* to the current payload, which must be ``None`` or a " "list of :class:`Message` objects before the call. After the call, the " @@ -203,14 +224,14 @@ msgid "" "instead." msgstr "" -#: library/email.compat32-message.rst:182 +#: library/email.compat32-message.rst:183 msgid "" -"This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by :meth:`~email.message.EmailMessage." +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by :meth:`~email.message.EmailMessage." "set_content` and the related ``make`` and ``add`` methods." msgstr "" -#: library/email.compat32-message.rst:190 +#: library/email.compat32-message.rst:191 msgid "" "Return the current payload, which will be a list of :class:`Message` objects " "when :meth:`is_multipart` is ``True``, or a string when :meth:`is_multipart` " @@ -218,7 +239,7 @@ msgid "" "modify the message's payload in place." msgstr "" -#: library/email.compat32-message.rst:195 +#: library/email.compat32-message.rst:196 msgid "" "With optional argument *i*, :meth:`get_payload` will return the *i*-th " "element of the payload, counting from zero, if :meth:`is_multipart` is " @@ -228,7 +249,7 @@ msgid "" "exc:`TypeError` is raised." msgstr "" -#: library/email.compat32-message.rst:202 +#: library/email.compat32-message.rst:203 msgid "" "Optional *decode* is a flag indicating whether the payload should be decoded " "or not, according to the :mailheader:`Content-Transfer-Encoding` header. " @@ -244,7 +265,7 @@ msgid "" "or :class:`~email.errors.InvalidBase64CharactersDefect`, respectively)." msgstr "" -#: library/email.compat32-message.rst:216 +#: library/email.compat32-message.rst:217 msgid "" "When *decode* is ``False`` (the default) the body is returned as a string " "without decoding the :mailheader:`Content-Transfer-Encoding`. However, for " @@ -255,28 +276,28 @@ msgid "" "the email package, the body is decoded using the default ASCII charset." msgstr "" -#: library/email.compat32-message.rst:225 +#: library/email.compat32-message.rst:226 msgid "" -"This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by :meth:`~email.message.EmailMessage." +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by :meth:`~email.message.EmailMessage." "get_content` and :meth:`~email.message.EmailMessage.iter_parts`." msgstr "" -#: library/email.compat32-message.rst:233 +#: library/email.compat32-message.rst:234 msgid "" "Set the entire message object's payload to *payload*. It is the client's " "responsibility to ensure the payload invariants. Optional *charset* sets " "the message's default character set; see :meth:`set_charset` for details." msgstr "" -#: library/email.compat32-message.rst:237 +#: library/email.compat32-message.rst:238 msgid "" -"This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by :meth:`~email.message.EmailMessage." +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by :meth:`~email.message.EmailMessage." "set_content`." msgstr "" -#: library/email.compat32-message.rst:244 +#: library/email.compat32-message.rst:245 msgid "" "Set the character set of the payload to *charset*, which can either be a :" "class:`~email.charset.Charset` instance (see :mod:`email.charset`), a string " @@ -287,7 +308,7 @@ msgid "" "Anything else will generate a :exc:`TypeError`." msgstr "" -#: library/email.compat32-message.rst:252 +#: library/email.compat32-message.rst:253 msgid "" "If there is no existing :mailheader:`MIME-Version` header one will be " "added. If there is no existing :mailheader:`Content-Type` header, one will " @@ -304,26 +325,26 @@ msgid "" "not modified." msgstr "" -#: library/email.compat32-message.rst:266 +#: library/email.compat32-message.rst:267 msgid "" -"This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by the *charset* parameter of the :meth:" -"`email.emailmessage.EmailMessage.set_content` method." +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by the *charset* parameter of the :meth:`email." +"message.EmailMessage.set_content` method." msgstr "" -#: library/email.compat32-message.rst:274 +#: library/email.compat32-message.rst:275 msgid "" "Return the :class:`~email.charset.Charset` instance associated with the " "message's payload." msgstr "" -#: library/email.compat32-message.rst:277 +#: library/email.compat32-message.rst:278 msgid "" -"This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class it always returns ``None``." +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"it always returns ``None``." msgstr "" -#: library/email.compat32-message.rst:282 +#: library/email.compat32-message.rst:283 msgid "" "The following methods implement a mapping-like interface for accessing the " "message's :rfc:`2822` headers. Note that there are some semantic " @@ -336,19 +357,19 @@ msgid "" "deleted and then re-added are always appended to the end of the header list." msgstr "" -#: library/email.compat32-message.rst:292 +#: library/email.compat32-message.rst:293 msgid "" "These semantic differences are intentional and are biased toward maximal " "convenience." msgstr "" -#: library/email.compat32-message.rst:295 +#: library/email.compat32-message.rst:296 msgid "" "Note that in all cases, any envelope header present in the message is not " "included in the mapping interface." msgstr "" -#: library/email.compat32-message.rst:298 +#: library/email.compat32-message.rst:299 msgid "" "In a model generated from bytes, any header values that (in contravention of " "the RFCs) contain non-ASCII bytes will, when retrieved through this " @@ -356,25 +377,31 @@ msgid "" "charset of ``unknown-8bit``." msgstr "" -#: library/email.compat32-message.rst:306 +#: library/email.compat32-message.rst:307 msgid "Return the total number of headers, including duplicates." msgstr "" -#: library/email.compat32-message.rst:311 +#: library/email.compat32-message.rst:312 msgid "" "Return ``True`` if the message object has a field named *name*. Matching is " "done case-insensitively and *name* should not include the trailing colon. " "Used for the ``in`` operator, e.g.::" msgstr "" -#: library/email.compat32-message.rst:321 +#: library/email.compat32-message.rst:316 +msgid "" +"if 'message-id' in myMessage:\n" +" print('Message-ID:', myMessage['message-id'])" +msgstr "" + +#: library/email.compat32-message.rst:322 msgid "" "Return the value of the named header field. *name* should not include the " "colon field separator. If the header is missing, ``None`` is returned; a :" "exc:`KeyError` is never raised." msgstr "" -#: library/email.compat32-message.rst:325 +#: library/email.compat32-message.rst:326 msgid "" "Note that if the named field appears more than once in the message's " "headers, exactly which of those field values will be returned is undefined. " @@ -382,59 +409,65 @@ msgid "" "headers." msgstr "" -#: library/email.compat32-message.rst:333 +#: library/email.compat32-message.rst:334 msgid "" "Add a header to the message with field name *name* and value *val*. The " "field is appended to the end of the message's existing fields." msgstr "" -#: library/email.compat32-message.rst:336 +#: library/email.compat32-message.rst:337 msgid "" "Note that this does *not* overwrite or delete any existing header with the " "same name. If you want to ensure that the new header is the only one " "present in the message with field name *name*, delete the field first, e.g.::" msgstr "" -#: library/email.compat32-message.rst:346 +#: library/email.compat32-message.rst:341 +msgid "" +"del msg['subject']\n" +"msg['subject'] = 'Python roolz!'" +msgstr "" + +#: library/email.compat32-message.rst:347 msgid "" "Delete all occurrences of the field with name *name* from the message's " "headers. No exception is raised if the named field isn't present in the " "headers." msgstr "" -#: library/email.compat32-message.rst:353 +#: library/email.compat32-message.rst:354 msgid "Return a list of all the message's header field names." msgstr "" -#: library/email.compat32-message.rst:358 +#: library/email.compat32-message.rst:359 msgid "Return a list of all the message's field values." msgstr "" -#: library/email.compat32-message.rst:363 +#: library/email.compat32-message.rst:364 msgid "" "Return a list of 2-tuples containing all the message's field headers and " "values." msgstr "" -#: library/email.compat32-message.rst:369 +#: library/email.compat32-message.rst:370 msgid "" "Return the value of the named header field. This is identical to :meth:" "`~object.__getitem__` except that optional *failobj* is returned if the " "named header is missing (defaults to ``None``)." msgstr "" -#: library/email.compat32-message.rst:373 +#: library/email.compat32-message.rst:374 msgid "Here are some additional useful methods:" msgstr "" -#: library/email.compat32-message.rst:378 +#: library/email.compat32-message.rst:379 msgid "" "Return a list of all the values for the field named *name*. If there are no " "such named headers in the message, *failobj* is returned (defaults to " "``None``)." msgstr "" -#: library/email.compat32-message.rst:385 +#: library/email.compat32-message.rst:386 msgid "" "Extended header setting. This method is similar to :meth:`__setitem__` " "except that additional header parameters can be provided as keyword " @@ -442,7 +475,7 @@ msgid "" "value for the header." msgstr "" -#: library/email.compat32-message.rst:390 +#: library/email.compat32-message.rst:391 msgid "" "For each item in the keyword argument dictionary *_params*, the key is taken " "as the parameter name, with underscores converted to dashes (since dashes " @@ -459,30 +492,49 @@ msgid "" "``None``." msgstr "" -#: library/email.compat32-message.rst:404 +#: library/email.compat32-message.rst:405 msgid "Here's an example::" msgstr "" -#: library/email.compat32-message.rst:408 +#: library/email.compat32-message.rst:407 +msgid "msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')" +msgstr "" + +#: library/email.compat32-message.rst:409 msgid "This will add a header that looks like ::" msgstr "" -#: library/email.compat32-message.rst:412 +#: library/email.compat32-message.rst:411 +msgid "Content-Disposition: attachment; filename=\"bud.gif\"" +msgstr "" + +#: library/email.compat32-message.rst:413 msgid "An example with non-ASCII characters::" msgstr "" -#: library/email.compat32-message.rst:417 +#: library/email.compat32-message.rst:415 +msgid "" +"msg.add_header('Content-Disposition', 'attachment',\n" +" filename=('iso-8859-1', '', 'Fußballer.ppt'))" +msgstr "" + +#: library/email.compat32-message.rst:418 msgid "Which produces ::" msgstr "" -#: library/email.compat32-message.rst:424 +#: library/email.compat32-message.rst:420 +msgid "" +"Content-Disposition: attachment; filename*=\"iso-8859-1''Fu%DFballer.ppt\"" +msgstr "" + +#: library/email.compat32-message.rst:425 msgid "" "Replace a header. Replace the first header found in the message that " "matches *_name*, retaining header order and field name case. If no matching " "header was found, a :exc:`KeyError` is raised." msgstr "" -#: library/email.compat32-message.rst:431 +#: library/email.compat32-message.rst:432 msgid "" "Return the message's content type. The returned string is coerced to lower " "case of the form :mimetype:`maintype/subtype`. If there was no :mailheader:" @@ -492,7 +544,7 @@ msgid "" "return a value." msgstr "" -#: library/email.compat32-message.rst:438 +#: library/email.compat32-message.rst:439 msgid "" ":rfc:`2045` defines a message's default type to be :mimetype:`text/plain` " "unless it appears inside a :mimetype:`multipart/digest` container, in which " @@ -501,19 +553,19 @@ msgid "" "the default type be :mimetype:`text/plain`." msgstr "" -#: library/email.compat32-message.rst:447 +#: library/email.compat32-message.rst:448 msgid "" "Return the message's main content type. This is the :mimetype:`maintype` " "part of the string returned by :meth:`get_content_type`." msgstr "" -#: library/email.compat32-message.rst:453 +#: library/email.compat32-message.rst:454 msgid "" "Return the message's sub-content type. This is the :mimetype:`subtype` part " "of the string returned by :meth:`get_content_type`." msgstr "" -#: library/email.compat32-message.rst:459 +#: library/email.compat32-message.rst:460 msgid "" "Return the default content type. Most messages have a default content type " "of :mimetype:`text/plain`, except for messages that are subparts of :" @@ -521,14 +573,14 @@ msgid "" "content type of :mimetype:`message/rfc822`." msgstr "" -#: library/email.compat32-message.rst:467 +#: library/email.compat32-message.rst:468 msgid "" "Set the default content type. *ctype* should either be :mimetype:`text/" "plain` or :mimetype:`message/rfc822`, although this is not enforced. The " "default content type is not stored in the :mailheader:`Content-Type` header." msgstr "" -#: library/email.compat32-message.rst:475 +#: library/email.compat32-message.rst:476 msgid "" "Return the message's :mailheader:`Content-Type` parameters, as a list. The " "elements of the returned list are 2-tuples of key/value pairs, as split on " @@ -538,22 +590,22 @@ msgid "" "`get_param` and is unquoted if optional *unquote* is ``True`` (the default)." msgstr "" -#: library/email.compat32-message.rst:483 +#: library/email.compat32-message.rst:484 msgid "" "Optional *failobj* is the object to return if there is no :mailheader:" "`Content-Type` header. Optional *header* is the header to search instead " "of :mailheader:`Content-Type`." msgstr "" -#: library/email.compat32-message.rst:487 -#: library/email.compat32-message.rst:525 +#: library/email.compat32-message.rst:488 +#: library/email.compat32-message.rst:526 msgid "" -"This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by the *params* property of the " -"individual header objects returned by the header access methods." +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by the *params* property of the individual " +"header objects returned by the header access methods." msgstr "" -#: library/email.compat32-message.rst:495 +#: library/email.compat32-message.rst:496 msgid "" "Return the value of the :mailheader:`Content-Type` header's parameter " "*param* as a string. If the message has no :mailheader:`Content-Type` " @@ -561,13 +613,13 @@ msgid "" "(defaults to ``None``)." msgstr "" -#: library/email.compat32-message.rst:500 +#: library/email.compat32-message.rst:501 msgid "" "Optional *header* if given, specifies the message header to use instead of :" "mailheader:`Content-Type`." msgstr "" -#: library/email.compat32-message.rst:503 +#: library/email.compat32-message.rst:504 msgid "" "Parameter keys are always compared case insensitively. The return value can " "either be a string, or a 3-tuple if the parameter was :rfc:`2231` encoded. " @@ -577,7 +629,7 @@ msgid "" "``us-ascii`` charset. You can usually ignore ``LANGUAGE``." msgstr "" -#: library/email.compat32-message.rst:511 +#: library/email.compat32-message.rst:512 msgid "" "If your application doesn't care whether the parameter was encoded as in :" "rfc:`2231`, you can collapse the parameter value by calling :func:`email." @@ -586,14 +638,20 @@ msgid "" "value is a tuple, or the original string unquoted if it isn't. For example::" msgstr "" -#: library/email.compat32-message.rst:521 +#: library/email.compat32-message.rst:519 +msgid "" +"rawparam = msg.get_param('foo')\n" +"param = email.utils.collapse_rfc2231_value(rawparam)" +msgstr "" + +#: library/email.compat32-message.rst:522 msgid "" "In any case, the parameter value (either the returned string, or the " "``VALUE`` item in the 3-tuple) is always unquoted, unless *unquote* is set " "to ``False``." msgstr "" -#: library/email.compat32-message.rst:534 +#: library/email.compat32-message.rst:535 msgid "" "Set a parameter in the :mailheader:`Content-Type` header. If the parameter " "already exists in the header, its value will be replaced with *value*. If " @@ -602,14 +660,14 @@ msgid "" "value will be appended as per :rfc:`2045`." msgstr "" -#: library/email.compat32-message.rst:540 +#: library/email.compat32-message.rst:541 msgid "" "Optional *header* specifies an alternative header to :mailheader:`Content-" "Type`, and all parameters will be quoted as necessary unless optional " "*requote* is ``False`` (the default is ``True``)." msgstr "" -#: library/email.compat32-message.rst:544 +#: library/email.compat32-message.rst:545 msgid "" "If optional *charset* is specified, the parameter will be encoded according " "to :rfc:`2231`. Optional *language* specifies the RFC 2231 language, " @@ -617,18 +675,18 @@ msgid "" "strings." msgstr "" -#: library/email.compat32-message.rst:549 +#: library/email.compat32-message.rst:550 msgid "" "If *replace* is ``False`` (the default) the header is moved to the end of " "the list of headers. If *replace* is ``True``, the header will be updated " "in place." msgstr "" -#: library/email.compat32-message.rst:553 +#: library/email.compat32-message.rst:554 msgid "``replace`` keyword was added." msgstr "" -#: library/email.compat32-message.rst:558 +#: library/email.compat32-message.rst:559 msgid "" "Remove the given parameter completely from the :mailheader:`Content-Type` " "header. The header will be re-written in place without the parameter or its " @@ -637,14 +695,14 @@ msgid "" "mailheader:`Content-Type`." msgstr "" -#: library/email.compat32-message.rst:567 +#: library/email.compat32-message.rst:568 msgid "" "Set the main type and subtype for the :mailheader:`Content-Type` header. " "*type* must be a string in the form :mimetype:`maintype/subtype`, otherwise " "a :exc:`ValueError` is raised." msgstr "" -#: library/email.compat32-message.rst:571 +#: library/email.compat32-message.rst:572 msgid "" "This method replaces the :mailheader:`Content-Type` header, keeping all the " "parameters in place. If *requote* is ``False``, this leaves the existing " @@ -652,20 +710,20 @@ msgid "" "default)." msgstr "" -#: library/email.compat32-message.rst:576 +#: library/email.compat32-message.rst:577 msgid "" "An alternative header can be specified in the *header* argument. When the :" "mailheader:`Content-Type` header is set a :mailheader:`MIME-Version` header " "is also added." msgstr "" -#: library/email.compat32-message.rst:580 +#: library/email.compat32-message.rst:581 msgid "" -"This is a legacy method. On the :class:`~email.emailmessage.EmailMessage` " -"class its functionality is replaced by the ``make_`` and ``add_`` methods." +"This is a legacy method. On the :class:`~email.message.EmailMessage` class " +"its functionality is replaced by the ``make_`` and ``add_`` methods." msgstr "" -#: library/email.compat32-message.rst:587 +#: library/email.compat32-message.rst:588 msgid "" "Return the value of the ``filename`` parameter of the :mailheader:`Content-" "Disposition` header of the message. If the header does not have a " @@ -675,7 +733,7 @@ msgid "" "always be unquoted as per :func:`email.utils.unquote`." msgstr "" -#: library/email.compat32-message.rst:598 +#: library/email.compat32-message.rst:599 msgid "" "Return the value of the ``boundary`` parameter of the :mailheader:`Content-" "Type` header of the message, or *failobj* if either the header is missing, " @@ -683,7 +741,7 @@ msgid "" "unquoted as per :func:`email.utils.unquote`." msgstr "" -#: library/email.compat32-message.rst:606 +#: library/email.compat32-message.rst:607 msgid "" "Set the ``boundary`` parameter of the :mailheader:`Content-Type` header to " "*boundary*. :meth:`set_boundary` will always quote *boundary* if " @@ -691,7 +749,7 @@ msgid "" "object has no :mailheader:`Content-Type` header." msgstr "" -#: library/email.compat32-message.rst:611 +#: library/email.compat32-message.rst:612 msgid "" "Note that using this method is subtly different than deleting the old :" "mailheader:`Content-Type` header and adding a new one with the new boundary " @@ -701,28 +759,28 @@ msgid "" "the original :mailheader:`Content-Type` header." msgstr "" -#: library/email.compat32-message.rst:621 +#: library/email.compat32-message.rst:622 msgid "" "Return the ``charset`` parameter of the :mailheader:`Content-Type` header, " "coerced to lower case. If there is no :mailheader:`Content-Type` header, or " "if that header has no ``charset`` parameter, *failobj* is returned." msgstr "" -#: library/email.compat32-message.rst:625 +#: library/email.compat32-message.rst:626 msgid "" "Note that this method differs from :meth:`get_charset` which returns the :" "class:`~email.charset.Charset` instance for the default encoding of the " "message body." msgstr "" -#: library/email.compat32-message.rst:631 +#: library/email.compat32-message.rst:632 msgid "" "Return a list containing the character set names in the message. If the " "message is a :mimetype:`multipart`, then the list will contain one element " "for each subpart in the payload, otherwise, it will be a list of length 1." msgstr "" -#: library/email.compat32-message.rst:635 +#: library/email.compat32-message.rst:636 msgid "" "Each item in the list will be a string which is the value of the ``charset`` " "parameter in the :mailheader:`Content-Type` header for the represented " @@ -731,7 +789,7 @@ msgid "" "then that item in the returned list will be *failobj*." msgstr "" -#: library/email.compat32-message.rst:645 +#: library/email.compat32-message.rst:646 msgid "" "Return the lowercased value (without parameters) of the message's :" "mailheader:`Content-Disposition` header if it has one, or ``None``. The " @@ -739,7 +797,7 @@ msgid "" "the message follows :rfc:`2183`." msgstr "" -#: library/email.compat32-message.rst:654 +#: library/email.compat32-message.rst:655 msgid "" "The :meth:`walk` method is an all-purpose generator which can be used to " "iterate over all the parts and subparts of a message object tree, in depth-" @@ -747,13 +805,26 @@ msgid "" "in a ``for`` loop; each iteration returns the next subpart." msgstr "" -#: library/email.compat32-message.rst:659 +#: library/email.compat32-message.rst:660 msgid "" "Here's an example that prints the MIME type of every part of a multipart " "message structure:" msgstr "" -#: library/email.compat32-message.rst:685 +#: library/email.compat32-message.rst:674 +msgid "" +">>> for part in msg.walk():\n" +"... print(part.get_content_type())\n" +"multipart/report\n" +"text/plain\n" +"message/delivery-status\n" +"text/plain\n" +"text/plain\n" +"message/rfc822\n" +"text/plain" +msgstr "" + +#: library/email.compat32-message.rst:686 msgid "" "``walk`` iterates over the subparts of any part where :meth:`is_multipart` " "returns ``True``, even though ``msg.get_content_maintype() == 'multipart'`` " @@ -761,21 +832,43 @@ msgid "" "``_structure`` debug helper function:" msgstr "" -#: library/email.compat32-message.rst:712 +#: library/email.compat32-message.rst:692 +msgid "" +">>> for part in msg.walk():\n" +"... print(part.get_content_maintype() == 'multipart',\n" +"... part.is_multipart())\n" +"True True\n" +"False False\n" +"False True\n" +"False False\n" +"False False\n" +"False True\n" +"False False\n" +">>> _structure(msg)\n" +"multipart/report\n" +" text/plain\n" +" message/delivery-status\n" +" text/plain\n" +" text/plain\n" +" message/rfc822\n" +" text/plain" +msgstr "" + +#: library/email.compat32-message.rst:713 msgid "" "Here the ``message`` parts are not ``multiparts``, but they do contain " "subparts. ``is_multipart()`` returns ``True`` and ``walk`` descends into the " "subparts." msgstr "" -#: library/email.compat32-message.rst:717 +#: library/email.compat32-message.rst:718 msgid "" ":class:`Message` objects can also optionally contain two instance " "attributes, which can be used when generating the plain text of a MIME " "message." msgstr "" -#: library/email.compat32-message.rst:723 +#: library/email.compat32-message.rst:724 msgid "" "The format of a MIME document allows for some text between the blank line " "following the headers, and the first multipart boundary string. Normally, " @@ -785,7 +878,7 @@ msgid "" "can become visible." msgstr "" -#: library/email.compat32-message.rst:730 +#: library/email.compat32-message.rst:731 msgid "" "The *preamble* attribute contains this leading extra-armor text for MIME " "documents. When the :class:`~email.parser.Parser` discovers some text after " @@ -797,26 +890,26 @@ msgid "" "parser` and :mod:`email.generator` for details." msgstr "" -#: library/email.compat32-message.rst:740 +#: library/email.compat32-message.rst:741 msgid "" "Note that if the message object has no preamble, the *preamble* attribute " "will be ``None``." msgstr "" -#: library/email.compat32-message.rst:746 +#: library/email.compat32-message.rst:747 msgid "" "The *epilogue* attribute acts the same way as the *preamble* attribute, " "except that it contains text that appears between the last boundary and the " "end of the message." msgstr "" -#: library/email.compat32-message.rst:750 +#: library/email.compat32-message.rst:751 msgid "" "You do not need to set the epilogue to the empty string in order for the :" "class:`~email.generator.Generator` to print a newline at the end of the file." msgstr "" -#: library/email.compat32-message.rst:757 +#: library/email.compat32-message.rst:758 msgid "" "The *defects* attribute contains a list of all the problems found when " "parsing this message. See :mod:`email.errors` for a detailed description of " diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index b31f9b8d..b5e5e0dc 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.contentmanager.rst:2 -msgid ":mod:`email.contentmanager`: Managing MIME Content" +msgid ":mod:`!email.contentmanager`: Managing MIME Content" msgstr "" #: library/email.contentmanager.rst:10 @@ -96,46 +97,46 @@ msgid "" msgstr "" #: library/email.contentmanager.rst:61 -msgid "the type's qualname (``typ.__qualname__``)" +msgid "the type's :attr:`qualname ` (``typ.__qualname__``)" msgstr "" #: library/email.contentmanager.rst:62 -msgid "the type's name (``typ.__name__``)." +msgid "the type's :attr:`name ` (``typ.__name__``)." msgstr "" #: library/email.contentmanager.rst:64 msgid "" "If none of the above match, repeat all of the checks above for each of the " -"types in the :term:`MRO` (``typ.__mro__``). Finally, if no other key yields " -"a handler, check for a handler for the key ``None``. If there is no handler " -"for ``None``, raise a :exc:`KeyError` for the fully qualified name of the " -"type." +"types in the :term:`MRO` (:attr:`typ.__mro__ `). Finally, if " +"no other key yields a handler, check for a handler for the key ``None``. If " +"there is no handler for ``None``, raise a :exc:`KeyError` for the fully " +"qualified name of the type." msgstr "" -#: library/email.contentmanager.rst:70 +#: library/email.contentmanager.rst:71 msgid "" "Also add a :mailheader:`MIME-Version` header if one is not present (see " "also :class:`.MIMEPart`)." msgstr "" -#: library/email.contentmanager.rst:76 +#: library/email.contentmanager.rst:77 msgid "" "Record the function *handler* as the handler for *key*. For the possible " "values of *key*, see :meth:`get_content`." msgstr "" -#: library/email.contentmanager.rst:82 +#: library/email.contentmanager.rst:83 msgid "" "Record *handler* as the function to call when an object of a type matching " "*typekey* is passed to :meth:`set_content`. For the possible values of " "*typekey*, see :meth:`set_content`." msgstr "" -#: library/email.contentmanager.rst:88 +#: library/email.contentmanager.rst:89 msgid "Content Manager Instances" msgstr "" -#: library/email.contentmanager.rst:90 +#: library/email.contentmanager.rst:91 msgid "" "Currently the email package provides only one concrete content manager, :" "data:`raw_data_manager`, although more may be added in the future. :data:" @@ -143,7 +144,7 @@ msgid "" "provided by :attr:`~email.policy.EmailPolicy` and its derivatives." msgstr "" -#: library/email.contentmanager.rst:99 +#: library/email.contentmanager.rst:100 msgid "" "This content manager provides only a minimum interface beyond that provided " "by :class:`~email.message.Message` itself: it deals only with text, raw " @@ -156,7 +157,7 @@ msgid "" "simplifying the creation of multipart messages." msgstr "" -#: library/email.contentmanager.rst:111 +#: library/email.contentmanager.rst:112 msgid "" "Return the payload of the part as either a string (for ``text`` parts), an :" "class:`~email.message.EmailMessage` object (for ``message/rfc822`` parts), " @@ -166,28 +167,28 @@ msgid "" "to unicode. The default error handler is ``replace``." msgstr "" -#: library/email.contentmanager.rst:130 +#: library/email.contentmanager.rst:131 msgid "Add headers and payload to *msg*:" msgstr "" -#: library/email.contentmanager.rst:132 +#: library/email.contentmanager.rst:133 msgid "" "Add a :mailheader:`Content-Type` header with a ``maintype/subtype`` value." msgstr "" -#: library/email.contentmanager.rst:135 +#: library/email.contentmanager.rst:136 msgid "" "For ``str``, set the MIME ``maintype`` to ``text``, and set the subtype to " "*subtype* if it is specified, or ``plain`` if it is not." msgstr "" -#: library/email.contentmanager.rst:137 +#: library/email.contentmanager.rst:138 msgid "" "For ``bytes``, use the specified *maintype* and *subtype*, or raise a :exc:" "`TypeError` if they are not specified." msgstr "" -#: library/email.contentmanager.rst:139 +#: library/email.contentmanager.rst:140 msgid "" "For :class:`~email.message.EmailMessage` objects, set the maintype to " "``message``, and set the subtype to *subtype* if it is specified or " @@ -195,7 +196,7 @@ msgid "" "(``bytes`` objects must be used to construct ``message/partial`` parts)." msgstr "" -#: library/email.contentmanager.rst:145 +#: library/email.contentmanager.rst:146 msgid "" "If *charset* is provided (which is valid only for ``str``), encode the " "string to bytes using the specified character set. The default is " @@ -203,7 +204,7 @@ msgid "" "charset name, use the standard charset instead." msgstr "" -#: library/email.contentmanager.rst:150 +#: library/email.contentmanager.rst:151 msgid "" "If *cte* is set, encode the payload using the specified content transfer " "encoding, and set the :mailheader:`Content-Transfer-Encoding` header to that " @@ -213,13 +214,22 @@ msgid "" "that contains non-ASCII values), raise a :exc:`ValueError`." msgstr "" -#: library/email.contentmanager.rst:158 +#: library/email.contentmanager.rst:159 msgid "" "For ``str`` objects, if *cte* is not set use heuristics to determine the " -"most compact encoding." +"most compact encoding. Prior to encoding, :meth:`str.splitlines` is used to " +"normalize all line boundaries, ensuring that each line of the payload is " +"terminated by the current policy's :data:`~email.policy.Policy.linesep` " +"property (even if the original string did not end with one)." msgstr "" -#: library/email.contentmanager.rst:160 +#: library/email.contentmanager.rst:165 +msgid "" +"For ``bytes`` objects, *cte* is taken to be base64 if not set, and the " +"aforementioned newline translation is not performed." +msgstr "" + +#: library/email.contentmanager.rst:167 msgid "" "For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if " "a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* " @@ -228,14 +238,14 @@ msgid "" "For all other values of *subtype*, use ``7bit``." msgstr "" -#: library/email.contentmanager.rst:167 +#: library/email.contentmanager.rst:174 msgid "" "A *cte* of ``binary`` does not actually work correctly yet. The " "``EmailMessage`` object as modified by ``set_content`` is correct, but :" "class:`~email.generator.BytesGenerator` does not serialize it correctly." msgstr "" -#: library/email.contentmanager.rst:172 +#: library/email.contentmanager.rst:179 msgid "" "If *disposition* is set, use it as the value of the :mailheader:`Content-" "Disposition` header. If not specified, and *filename* is specified, add the " @@ -244,37 +254,37 @@ msgid "" "values for *disposition* are ``attachment`` and ``inline``." msgstr "" -#: library/email.contentmanager.rst:179 +#: library/email.contentmanager.rst:186 msgid "" "If *filename* is specified, use it as the value of the ``filename`` " "parameter of the :mailheader:`Content-Disposition` header." msgstr "" -#: library/email.contentmanager.rst:182 +#: library/email.contentmanager.rst:189 msgid "" "If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as " "its value." msgstr "" -#: library/email.contentmanager.rst:185 +#: library/email.contentmanager.rst:192 msgid "" "If *params* is specified, iterate its ``items`` method and use the resulting " "``(key, value)`` pairs to set additional parameters on the :mailheader:" "`Content-Type` header." msgstr "" -#: library/email.contentmanager.rst:189 +#: library/email.contentmanager.rst:196 msgid "" "If *headers* is specified and is a list of strings of the form ``headername: " "headervalue`` or a list of ``header`` objects (distinguished from strings by " "having a ``name`` attribute), add the headers to *msg*." msgstr "" -#: library/email.contentmanager.rst:196 +#: library/email.contentmanager.rst:203 msgid "Footnotes" msgstr "" -#: library/email.contentmanager.rst:197 +#: library/email.contentmanager.rst:204 msgid "" "Originally added in 3.4 as a :term:`provisional module `" msgstr "" diff --git a/library/email.encoders.po b/library/email.encoders.po index 59e12aaf..f24afea0 100644 --- a/library/email.encoders.po +++ b/library/email.encoders.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.encoders.rst:2 -msgid ":mod:`email.encoders`: Encoders" +msgid ":mod:`!email.encoders`: Encoders" msgstr "" #: library/email.encoders.rst:7 diff --git a/library/email.errors.po b/library/email.errors.po index 1475af5c..8679c967 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -8,27 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2024-12-14 01:00+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.errors.rst:2 -msgid ":mod:`email.errors`: Exception and Defect classes" -msgstr "" +msgid ":mod:`!email.errors`: Exception and Defect classes" +msgstr ":mod:`!email.errors`: Κλάσεις Εξαιρέσεων και Ελαττωμάτων" #: library/email.errors.rst:7 msgid "**Source code:** :source:`Lib/email/errors.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/email/errors.py`" #: library/email.errors.rst:11 msgid "" "The following exception classes are defined in the :mod:`email.errors` " "module:" -msgstr "" +msgstr "Οι εξής κλάσεις εξαιρέσεων ορίζονται στο module :mod:`email.errors`:" #: library/email.errors.rst:16 msgid "" @@ -36,6 +37,9 @@ msgid "" "raise. It is derived from the standard :exc:`Exception` class and defines " "no additional methods." msgstr "" +"Αυτή είναι η βασική κλάση για όλες τις εξαιρέσεις που μπορεί να κάνει raise " +"το module :mod:`email`. Παράγεται από την τυπική κλάση :exc:`Exception` και " +"δεν ορίζει επιπλέον μεθόδους." #: library/email.errors.rst:23 msgid "" @@ -43,6 +47,10 @@ msgid "" "Parser` class. It is derived from :exc:`MessageError`. This class is also " "used internally by the parser used by :mod:`~email.headerregistry`." msgstr "" +"Αυτή είναι η βασική κλάση για τις εξαιρέσεις που γίνονται raise από την " +"κλάση :class:`~email.parser.Parser`. Κληρονομεί από την :exc:`MessageError`. " +"Αυτή η κλάση χρησιμοποιείται επίσης εσωτερικά από τον αναλυτή που " +"χρησιμοποιείται από το :mod:`~email.headerregistry`." #: library/email.errors.rst:31 msgid "" @@ -55,42 +63,58 @@ msgid "" "header (that is, there is what is supposed to be a continuation line that " "has no leading whitespace and looks like a header)." msgstr "" +"Γίνεται raise κάτω από ορισμένες συνθήκες σφάλματος κατά την ανάλυση των " +"κεφαλίδων :rfc:`5322` ενός μηνύματος, αυτή η κλάση προέρχεται από την :exc:" +"`MessageParseError`. Η μέθοδος :meth:`~email.message.EmailMessage." +"set_boundary` θα κάνει raise αυτό το σφάλμα αν ο τύπος περιεχομένου είναι " +"άγνωστος όταν καλείται η μέθοδος. Η :class:`~email.header.Header` μπορεί να " +"κάνει raise αυτό το σφάλμα για ορισμένα σφάλματα αποκωδικοποίησης base64, " +"καθώς και όταν επιχειρείται η δημιουργία μιας κεφαλίδας που φαίνεται να " +"περιέχει ενσωματωμένη κεφαλίδα (δηλαδή υπάρχει μια γραμμή συνέχειας που δεν " +"έχει προηγούμενο κενό διάστημα και μοιάζει με κεφαλίδα)." #: library/email.errors.rst:43 msgid "Deprecated and no longer used." -msgstr "" +msgstr "Έχει καταργηθεί και δεν χρησιμοποιείται πλέον." #: library/email.errors.rst:48 msgid "" -"Raised when a payload is added to a :class:`~email.message.Message` object " -"using :meth:`add_payload`, but the payload is already a scalar and the " -"message's :mailheader:`Content-Type` main type is not either :mimetype:" -"`multipart` or missing. :exc:`MultipartConversionError` multiply inherits " -"from :exc:`MessageError` and the built-in :exc:`TypeError`." +"Raised if the :meth:`~email.message.Message.attach` method is called on an " +"instance of a class derived from :class:`~email.mime.nonmultipart." +"MIMENonMultipart` (e.g. :class:`~email.mime.image.MIMEImage`). :exc:" +"`MultipartConversionError` multiply inherits from :exc:`MessageError` and " +"the built-in :exc:`TypeError`." msgstr "" +"Γίνεται raise εάν η μέθοδος :meth:`~email.message.Message.attach` καλείται " +"σε ένα στιγμιότυπο μιας κλάσης που προέρχεται από τη :class:`~email.mime." +"nonmultipart.MIMENonMultipart` (π.χ. :class:`~email.mime.image.MIMEImage`). " +"Η :exc:`MultipartConversionError` κληρονομεί ταυτόχρονα από την :exc:" +"`MessageError` και την ενσωματωμένη :exc:`TypeError`." -#: library/email.errors.rst:54 +#: library/email.errors.rst:58 msgid "" -"Since :meth:`Message.add_payload` is deprecated, this exception is rarely " -"raised in practice. However the exception may also be raised if the :meth:" -"`~email.message.Message.attach` method is called on an instance of a class " -"derived from :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g. :class:" -"`~email.mime.image.MIMEImage`)." +"Raised when an error occurs when the :mod:`~email.generator` outputs headers." msgstr "" +"Γίνεται raise όταν παρουσιάζεται σφάλμα όταν το :mod:`~email.generator` " +"εξάγει κεφαλίδες." -#: library/email.errors.rst:63 +#: library/email.errors.rst:64 msgid "" "This is the base class for all defects found when parsing email messages. It " "is derived from :exc:`ValueError`." msgstr "" +"Αυτή είναι η βασική κλάση για όλα τα ελαττώματα που εντοπίζονται κατά την " +"ανάλυση μηνυμάτων email. Είναι παράγωγη της :exc:`ValueError`." -#: library/email.errors.rst:68 +#: library/email.errors.rst:69 msgid "" "This is the base class for all defects found when parsing email headers. It " "is derived from :exc:`MessageDefect`." msgstr "" +"Αυτή είναι η βασική κλάση για όλα τα ελαττώματα που εντοπίζονται κατά την " +"ανάλυση των κεφαλίδων email. Είναι παράγωγο της :exc:`MessageDefect`." -#: library/email.errors.rst:71 +#: library/email.errors.rst:72 msgid "" "Here is the list of the defects that the :class:`~email.parser.FeedParser` " "can find while parsing messages. Note that the defects are added to the " @@ -99,91 +123,136 @@ msgid "" "nested message object would have a defect, but the containing messages would " "not." msgstr "" +"Ακολουθεί η λίστα με τα ελαττώματα που μπορεί να εντοπίσει η :class:`~email." +"parser.FeedParser` κατά την ανάλυση των μηνυμάτων. Σημειώστε ότι τα " +"ελαττώματα προστίθενται στο μήνυμα όπου βρέθηκε το πρόβλημα, οπότε για " +"παράδειγμα, εάν ένα μήνυμα που είναι ένθετο μέσα σε ένα :mimetype:`multipart/" +"alternative` είχε μια παραμορφωμένη κεφαλίδα, αυτό το ένθετο αντικείμενο " +"μηνύματος θα είχε ένα ελάττωμα, αλλά τα μηνύματα που το περιέχουν όχι." -#: library/email.errors.rst:77 +#: library/email.errors.rst:78 msgid "" "All defect classes are subclassed from :class:`email.errors.MessageDefect`." msgstr "" - -#: library/email.errors.rst:79 -msgid "" -":class:`NoBoundaryInMultipartDefect` -- A message claimed to be a multipart, " -"but had no :mimetype:`boundary` parameter." -msgstr "" +"Όλες οι κλάσεις ελαττωμάτων είναι υποκλάσεις της :class:`email.errors." +"MessageDefect`." #: library/email.errors.rst:82 msgid "" -":class:`StartBoundaryNotFoundDefect` -- The start boundary claimed in the :" -"mailheader:`Content-Type` header was never found." +"A message claimed to be a multipart, but had no :mimetype:`boundary` " +"parameter." msgstr "" +"Ένα μήνυμα ισχυριζόταν ότι ήταν πολυμερές, αλλά δεν είχε παράμετρο :mimetype:" +"`boundary`." -#: library/email.errors.rst:85 +#: library/email.errors.rst:87 msgid "" -":class:`CloseBoundaryNotFoundDefect` -- A start boundary was found, but no " -"corresponding close boundary was ever found." +"The start boundary claimed in the :mailheader:`Content-Type` header was " +"never found." msgstr "" +"Το όριο εκκίνησης που αναφέρεται στην κεφαλίδα :mailheader:`Content-Type` " +"δεν βρέθηκε ποτέ." -#: library/email.errors.rst:90 +#: library/email.errors.rst:92 msgid "" -":class:`FirstHeaderLineIsContinuationDefect` -- The message had a " -"continuation line as its first header line." +"A start boundary was found, but no corresponding close boundary was ever " +"found." msgstr "" +"Βρέθηκε ένα όριο εκκίνησης, αλλά δεν βρέθηκε ποτέ αντίστοιχο όριο " +"κλεισίματος." -#: library/email.errors.rst:93 -msgid "" -":class:`MisplacedEnvelopeHeaderDefect` - A \"Unix From\" header was found in " -"the middle of a header block." -msgstr "" +#: library/email.errors.rst:99 +msgid "The message had a continuation line as its first header line." +msgstr "Το μήνυμα είχε μια γραμμή συνέχισης ως την πρώτη γραμμή κεφαλίδας." + +#: library/email.errors.rst:103 +msgid "A \"Unix From\" header was found in the middle of a header block." +msgstr "Βρέθηκε μια κεφαλίδα \"Unix From\" στη μέση ενός μπλοκ κεφαλίδων." -#: library/email.errors.rst:96 +#: library/email.errors.rst:107 msgid "" -":class:`MissingHeaderBodySeparatorDefect` - A line was found while parsing " -"headers that had no leading white space but contained no ':'. Parsing " -"continues assuming that the line represents the first line of the body." +"A line was found while parsing headers that had no leading white space but " +"contained no ':'. Parsing continues assuming that the line represents the " +"first line of the body." msgstr "" +"Βρέθηκε μια γραμμή κατά την ανάλυση των κεφαλίδων που δεν είχε αρχικό κενό " +"αλλά δεν περιείχε ':'. Η ανάλυση συνεχίζεται στην περίπτωση που η γραμμή " +"αντιπροσωπεύει την πρώτη γραμμή του σώματος." -#: library/email.errors.rst:102 +#: library/email.errors.rst:115 msgid "" -":class:`MalformedHeaderDefect` -- A header was found that was missing a " -"colon, or was otherwise malformed." +"A header was found that was missing a colon, or was otherwise malformed." msgstr "" +"Βρέθηκε μια κεφαλίδα που της έλειπε μια άνω τελεία, ή ήταν αλλιώς " +"παραμορφωμένη." -#: library/email.errors.rst:105 +#: library/email.errors.rst:117 msgid "This defect has not been used for several Python versions." msgstr "" +"Αυτό το σφάλμα δεν έχει χρησιμοποιηθεί εδώ και πολλές εκδόσεις της Python." -#: library/email.errors.rst:108 +#: library/email.errors.rst:122 msgid "" -":class:`MultipartInvariantViolationDefect` -- A message claimed to be a :" -"mimetype:`multipart`, but no subparts were found. Note that when a message " -"has this defect, its :meth:`~email.message.Message.is_multipart` method may " -"return ``False`` even though its content type claims to be :mimetype:" -"`multipart`." +"A message claimed to be a :mimetype:`multipart`, but no subparts were found. " +"Note that when a message has this defect, its :meth:`~email.message.Message." +"is_multipart` method may return ``False`` even though its content type " +"claims to be :mimetype:`multipart`." msgstr "" +"Ένα μήνυμα δήλωσε ότι είναι :mimetype:`multipart`, αλλά δεν βρέθηκαν " +"υπομέρη. Σημειώστε ότι όταν ένα μήνυμα έχει αυτό το σφάλμα, η μέθοδος του :" +"meth:`~email.message.Message.is_multipart` μπορεί να επιστρέψει ``False`` " +"ακόμα κι αν ο τύπος περιεχομένου του δηλώνει ότι είναι :mimetype:`multipart`." -#: library/email.errors.rst:113 +#: library/email.errors.rst:129 msgid "" -":class:`InvalidBase64PaddingDefect` -- When decoding a block of base64 " -"encoded bytes, the padding was not correct. Enough padding is added to " -"perform the decode, but the resulting decoded bytes may be invalid." +"When decoding a block of base64 encoded bytes, the padding was not correct. " +"Enough padding is added to perform the decode, but the resulting decoded " +"bytes may be invalid." msgstr "" +"Όταν αποκωδικοποιείται ένα μπλοκ από base64 κωδικοποιημένα bytes, η προσθήκη " +"padding δεν ήταν σωστή. Προστίθεται αρκετό padding για να πραγματοποιηθεί η " +"αποκωδικοποίηση, αλλά τα αποκωδικοποιημένα bytes που προκύπτουν μπορεί να " +"είναι άκυρα." -#: library/email.errors.rst:117 +#: library/email.errors.rst:135 msgid "" -":class:`InvalidBase64CharactersDefect` -- When decoding a block of base64 " -"encoded bytes, characters outside the base64 alphabet were encountered. The " -"characters are ignored, but the resulting decoded bytes may be invalid." +"When decoding a block of base64 encoded bytes, characters outside the base64 " +"alphabet were encountered. The characters are ignored, but the resulting " +"decoded bytes may be invalid." msgstr "" +"Όταν αποκωδικοποιείται ένα μπλοκ από base64 κωδικοποιημένα bytes, " +"συναντήθηκαν χαρακτήρες εκτός του αλφαβήτου base64. Οι χαρακτήρες " +"αγνοούνται, αλλά τα αποκωδικοποιημένα bytes που προκύπτουν μπορεί να είναι " +"άκυρα." -#: library/email.errors.rst:121 +#: library/email.errors.rst:141 msgid "" -":class:`InvalidBase64LengthDefect` -- When decoding a block of base64 " -"encoded bytes, the number of non-padding base64 characters was invalid (1 " -"more than a multiple of 4). The encoded block was kept as-is." +"When decoding a block of base64 encoded bytes, the number of non-padding " +"base64 characters was invalid (1 more than a multiple of 4). The encoded " +"block was kept as-is." msgstr "" +"Όταν αποκωδικοποιείται ένα μπλοκ από base64 κωδικοποιημένα bytes, ο αριθμός " +"των χαρακτήρων base64 χωρίς συμπλήρωμα ήταν άκυρος (1 παραπάνω από ένα " +"πολλαπλάσιο του 4). Το κωδικοποιημένο μπλοκ διατηρήθηκε ως έχει." -#: library/email.errors.rst:125 +#: library/email.errors.rst:147 msgid "" -":class:`InvalidDateDefect` -- When decoding an invalid or unparsable date " -"field. The original value is kept as-is." +"When decoding an invalid or unparsable date field. The original value is " +"kept as-is." msgstr "" +"Όταν αποκωδικοποιείται ένα άκυρο ή μη αναγνώσιμο πεδίο ημερομηνίας. Η αρχική " +"τιμή διατηρείται ως έχει." + +#~ msgid "" +#~ "Since :meth:`Message.add_payload` is deprecated, this exception is rarely " +#~ "raised in practice. However the exception may also be raised if the :" +#~ "meth:`~email.message.Message.attach` method is called on an instance of a " +#~ "class derived from :class:`~email.mime.nonmultipart.MIMENonMultipart` (e." +#~ "g. :class:`~email.mime.image.MIMEImage`)." +#~ msgstr "" +#~ "Επειδή η μέθοδος :meth:`Message.add_payload` έχει ξεπεραστεί, αυτή η " +#~ "εξαίρεση σπάνια εμφανίζεται στην πράξη. Ωστόσο, η εξαίρεση μπορεί επίσης " +#~ "να εμφανιστεί αν κληθεί η μέθοδος :meth:`~email.message.Message.attach` " +#~ "σε ένα στιγμιότυπο μιας κλάσης που κληρονομεί από :class:`~email.mime." +#~ "nonmultipart.MIMENonMultipart` (π.χ. :class:`~email.mime.image." +#~ "MIMEImage`)." diff --git a/library/email.examples.po b/library/email.examples.po index 28139fd6..96153658 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -32,30 +33,261 @@ msgid "" "content and the addresses may contain unicode characters):" msgstr "" +#: library/email.examples.rst:12 +msgid "" +"# Import smtplib for the actual sending function\n" +"import smtplib\n" +"\n" +"# Import the email modules we'll need\n" +"from email.message import EmailMessage\n" +"\n" +"# Open the plain text file whose name is in textfile for reading.\n" +"with open(textfile) as fp:\n" +" # Create a text/plain message\n" +" msg = EmailMessage()\n" +" msg.set_content(fp.read())\n" +"\n" +"# me == the sender's email address\n" +"# you == the recipient's email address\n" +"msg['Subject'] = f'The contents of {textfile}'\n" +"msg['From'] = me\n" +"msg['To'] = you\n" +"\n" +"# Send the message via our own SMTP server.\n" +"s = smtplib.SMTP('localhost')\n" +"s.send_message(msg)\n" +"s.quit()\n" +msgstr "" + #: library/email.examples.rst:15 msgid "" "Parsing :rfc:`822` headers can easily be done by the using the classes from " "the :mod:`~email.parser` module:" msgstr "" +#: library/email.examples.rst:18 +msgid "" +"# Import the email modules we'll need\n" +"#from email.parser import BytesParser\n" +"from email.parser import Parser\n" +"from email.policy import default\n" +"\n" +"# If the e-mail headers are in a file, uncomment these two lines:\n" +"# with open(messagefile, 'rb') as fp:\n" +"# headers = BytesParser(policy=default).parse(fp)\n" +"\n" +"# Or for parsing headers in a string (this is an uncommon operation), use:\n" +"headers = Parser(policy=default).parsestr(\n" +" 'From: Foo Bar \\n'\n" +" 'To: \\n'\n" +" 'Subject: Test message\\n'\n" +" '\\n'\n" +" 'Body would go here\\n')\n" +"\n" +"# Now the header items can be accessed as a dictionary:\n" +"print('To: {}'.format(headers['to']))\n" +"print('From: {}'.format(headers['from']))\n" +"print('Subject: {}'.format(headers['subject']))\n" +"\n" +"# You can also access the parts of the addresses:\n" +"print('Recipient username: {}'.format(headers['to'].addresses[0].username))\n" +"print('Sender name: {}'.format(headers['from'].addresses[0].display_name))\n" +msgstr "" + #: library/email.examples.rst:21 msgid "" "Here's an example of how to send a MIME message containing a bunch of family " "pictures that may be residing in a directory:" msgstr "" +#: library/email.examples.rst:24 +msgid "" +"# Import smtplib for the actual sending function.\n" +"import smtplib\n" +"\n" +"# Here are the email package modules we'll need.\n" +"from email.message import EmailMessage\n" +"\n" +"# Create the container email message.\n" +"msg = EmailMessage()\n" +"msg['Subject'] = 'Our family reunion'\n" +"# me == the sender's email address\n" +"# family = the list of all recipients' email addresses\n" +"msg['From'] = me\n" +"msg['To'] = ', '.join(family)\n" +"msg.preamble = 'You will not see this in a MIME-aware mail reader.\\n'\n" +"\n" +"# Open the files in binary mode. You can also omit the subtype\n" +"# if you want MIMEImage to guess it.\n" +"for file in pngfiles:\n" +" with open(file, 'rb') as fp:\n" +" img_data = fp.read()\n" +" msg.add_attachment(img_data, maintype='image',\n" +" subtype='png')\n" +"\n" +"# Send the email via our own SMTP server.\n" +"with smtplib.SMTP('localhost') as s:\n" +" s.send_message(msg)\n" +msgstr "" + #: library/email.examples.rst:27 msgid "" "Here's an example of how to send the entire contents of a directory as an " "email message: [1]_" msgstr "" +#: library/email.examples.rst:30 +msgid "" +"#!/usr/bin/env python3\n" +"\n" +"\"\"\"Send the contents of a directory as a MIME message.\"\"\"\n" +"\n" +"import os\n" +"import smtplib\n" +"# For guessing MIME type based on file name extension\n" +"import mimetypes\n" +"\n" +"from argparse import ArgumentParser\n" +"\n" +"from email.message import EmailMessage\n" +"from email.policy import SMTP\n" +"\n" +"\n" +"def main():\n" +" parser = ArgumentParser(description=\"\"\"\\\n" +"Send the contents of a directory as a MIME message.\n" +"Unless the -o option is given, the email is sent by forwarding to your " +"local\n" +"SMTP server, which then does the normal delivery process. Your local " +"machine\n" +"must be running an SMTP server.\n" +"\"\"\")\n" +" parser.add_argument('-d', '--directory',\n" +" help=\"\"\"Mail the contents of the specified " +"directory,\n" +" otherwise use the current directory. Only the " +"regular\n" +" files in the directory are sent, and we don't " +"recurse to\n" +" subdirectories.\"\"\")\n" +" parser.add_argument('-o', '--output',\n" +" metavar='FILE',\n" +" help=\"\"\"Print the composed message to FILE " +"instead of\n" +" sending the message to the SMTP server.\"\"\")\n" +" parser.add_argument('-s', '--sender', required=True,\n" +" help='The value of the From: header (required)')\n" +" parser.add_argument('-r', '--recipient', required=True,\n" +" action='append', metavar='RECIPIENT',\n" +" default=[], dest='recipients',\n" +" help='A To: header value (at least one required)')\n" +" args = parser.parse_args()\n" +" directory = args.directory\n" +" if not directory:\n" +" directory = '.'\n" +" # Create the message\n" +" msg = EmailMessage()\n" +" msg['Subject'] = f'Contents of directory {os.path.abspath(directory)}'\n" +" msg['To'] = ', '.join(args.recipients)\n" +" msg['From'] = args.sender\n" +" msg.preamble = 'You will not see this in a MIME-aware mail reader.\\n'\n" +"\n" +" for filename in os.listdir(directory):\n" +" path = os.path.join(directory, filename)\n" +" if not os.path.isfile(path):\n" +" continue\n" +" # Guess the content type based on the file's extension. Encoding\n" +" # will be ignored, although we should check for simple things like\n" +" # gzip'd or compressed files.\n" +" ctype, encoding = mimetypes.guess_file_type(path)\n" +" if ctype is None or encoding is not None:\n" +" # No guess could be made, or the file is encoded (compressed), " +"so\n" +" # use a generic bag-of-bits type.\n" +" ctype = 'application/octet-stream'\n" +" maintype, subtype = ctype.split('/', 1)\n" +" with open(path, 'rb') as fp:\n" +" msg.add_attachment(fp.read(),\n" +" maintype=maintype,\n" +" subtype=subtype,\n" +" filename=filename)\n" +" # Now send or store the message\n" +" if args.output:\n" +" with open(args.output, 'wb') as fp:\n" +" fp.write(msg.as_bytes(policy=SMTP))\n" +" else:\n" +" with smtplib.SMTP('localhost') as s:\n" +" s.send_message(msg)\n" +"\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" +msgstr "" + #: library/email.examples.rst:33 msgid "" "Here's an example of how to unpack a MIME message like the one above, into a " "directory of files:" msgstr "" +#: library/email.examples.rst:36 +msgid "" +"#!/usr/bin/env python3\n" +"\n" +"\"\"\"Unpack a MIME message into a directory of files.\"\"\"\n" +"\n" +"import os\n" +"import email\n" +"import mimetypes\n" +"\n" +"from email.policy import default\n" +"\n" +"from argparse import ArgumentParser\n" +"\n" +"\n" +"def main():\n" +" parser = ArgumentParser(description=\"\"\"\\\n" +"Unpack a MIME message into a directory of files.\n" +"\"\"\")\n" +" parser.add_argument('-d', '--directory', required=True,\n" +" help=\"\"\"Unpack the MIME message into the named\n" +" directory, which will be created if it doesn't " +"already\n" +" exist.\"\"\")\n" +" parser.add_argument('msgfile')\n" +" args = parser.parse_args()\n" +"\n" +" with open(args.msgfile, 'rb') as fp:\n" +" msg = email.message_from_binary_file(fp, policy=default)\n" +"\n" +" try:\n" +" os.mkdir(args.directory)\n" +" except FileExistsError:\n" +" pass\n" +"\n" +" counter = 1\n" +" for part in msg.walk():\n" +" # multipart/* are just containers\n" +" if part.get_content_maintype() == 'multipart':\n" +" continue\n" +" # Applications should really sanitize the given filename so that an\n" +" # email message can't be used to overwrite important files\n" +" filename = part.get_filename()\n" +" if not filename:\n" +" ext = mimetypes.guess_extension(part.get_content_type())\n" +" if not ext:\n" +" # Use a generic bag-of-bits extension\n" +" ext = '.bin'\n" +" filename = f'part-{counter:03d}{ext}'\n" +" counter += 1\n" +" with open(os.path.join(args.directory, filename), 'wb') as fp:\n" +" fp.write(part.get_payload(decode=True))\n" +"\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" +msgstr "" + #: library/email.examples.rst:39 msgid "" "Here's an example of how to create an HTML message with an alternative plain " @@ -64,16 +296,182 @@ msgid "" "disk, as well as sending it." msgstr "" +#: library/email.examples.rst:44 +msgid "" +"#!/usr/bin/env python3\n" +"\n" +"import smtplib\n" +"\n" +"from email.message import EmailMessage\n" +"from email.headerregistry import Address\n" +"from email.utils import make_msgid\n" +"\n" +"# Create the base text message.\n" +"msg = EmailMessage()\n" +"msg['Subject'] = \"Pourquoi pas des asperges pour ce midi ?\"\n" +"msg['From'] = Address(\"Pepé Le Pew\", \"pepe\", \"example.com\")\n" +"msg['To'] = (Address(\"Penelope Pussycat\", \"penelope\", \"example.com\"),\n" +" Address(\"Fabrette Pussycat\", \"fabrette\", \"example.com\"))\n" +"msg.set_content(\"\"\"\\\n" +"Salut!\n" +"\n" +"Cette recette [1] sera sûrement un très bon repas.\n" +"\n" +"[1] http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718\n" +"\n" +"--Pepé\n" +"\"\"\")\n" +"\n" +"# Add the html version. This converts the message into a multipart/" +"alternative\n" +"# container, with the original text message as the first part and the new " +"html\n" +"# message as the second part.\n" +"asparagus_cid = make_msgid()\n" +"msg.add_alternative(\"\"\"\\\n" +"\n" +" \n" +" \n" +"

Salut!

\n" +"

Cette\n" +" \n" +" recette\n" +" sera sûrement un très bon repas.\n" +"

\n" +" \n" +" \n" +"\n" +"\"\"\".format(asparagus_cid=asparagus_cid[1:-1]), subtype='html')\n" +"# note that we needed to peel the <> off the msgid for use in the html.\n" +"\n" +"# Now add the related image to the html part.\n" +"with open(\"roasted-asparagus.jpg\", 'rb') as img:\n" +" msg.get_payload()[1].add_related(img.read(), 'image', 'jpeg',\n" +" cid=asparagus_cid)\n" +"\n" +"# Make a local copy of what we are going to send.\n" +"with open('outgoing.msg', 'wb') as f:\n" +" f.write(bytes(msg))\n" +"\n" +"# Send the message via local SMTP server.\n" +"with smtplib.SMTP('localhost') as s:\n" +" s.send_message(msg)\n" +msgstr "" + #: library/email.examples.rst:47 msgid "" "If we were sent the message from the last example, here is one way we could " "process it:" msgstr "" +#: library/email.examples.rst:50 +msgid "" +"import os\n" +"import sys\n" +"import tempfile\n" +"import mimetypes\n" +"import webbrowser\n" +"\n" +"# Import the email modules we'll need\n" +"from email import policy\n" +"from email.parser import BytesParser\n" +"\n" +"\n" +"def magic_html_parser(html_text, partfiles):\n" +" \"\"\"Return safety-sanitized html linked to partfiles.\n" +"\n" +" Rewrite the href=\"cid:....\" attributes to point to the filenames in " +"partfiles.\n" +" Though not trivial, this should be possible using html.parser.\n" +" \"\"\"\n" +" raise NotImplementedError(\"Add the magic needed\")\n" +"\n" +"\n" +"# In a real program you'd get the filename from the arguments.\n" +"with open('outgoing.msg', 'rb') as fp:\n" +" msg = BytesParser(policy=policy.default).parse(fp)\n" +"\n" +"# Now the header items can be accessed as a dictionary, and any non-ASCII " +"will\n" +"# be converted to unicode:\n" +"print('To:', msg['to'])\n" +"print('From:', msg['from'])\n" +"print('Subject:', msg['subject'])\n" +"\n" +"# If we want to print a preview of the message content, we can extract " +"whatever\n" +"# the least formatted payload is and print the first three lines. Of " +"course,\n" +"# if the message has no plain text part printing the first three lines of " +"html\n" +"# is probably useless, but this is just a conceptual example.\n" +"simplest = msg.get_body(preferencelist=('plain', 'html'))\n" +"print()\n" +"print(''.join(simplest.get_content().splitlines(keepends=True)[:3]))\n" +"\n" +"ans = input(\"View full message?\")\n" +"if ans.lower()[0] == 'n':\n" +" sys.exit()\n" +"\n" +"# We can extract the richest alternative in order to display it:\n" +"richest = msg.get_body()\n" +"partfiles = {}\n" +"if richest['content-type'].maintype == 'text':\n" +" if richest['content-type'].subtype == 'plain':\n" +" for line in richest.get_content().splitlines():\n" +" print(line)\n" +" sys.exit()\n" +" elif richest['content-type'].subtype == 'html':\n" +" body = richest\n" +" else:\n" +" print(\"Don't know how to display {}\".format(richest." +"get_content_type()))\n" +" sys.exit()\n" +"elif richest['content-type'].content_type == 'multipart/related':\n" +" body = richest.get_body(preferencelist=('html'))\n" +" for part in richest.iter_attachments():\n" +" fn = part.get_filename()\n" +" if fn:\n" +" extension = os.path.splitext(part.get_filename())[1]\n" +" else:\n" +" extension = mimetypes.guess_extension(part.get_content_type())\n" +" with tempfile.NamedTemporaryFile(suffix=extension, delete=False) as " +"f:\n" +" f.write(part.get_content())\n" +" # again strip the <> to go from email form of cid to html form.\n" +" partfiles[part['content-id'][1:-1]] = f.name\n" +"else:\n" +" print(\"Don't know how to display {}\".format(richest." +"get_content_type()))\n" +" sys.exit()\n" +"with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:\n" +" f.write(magic_html_parser(body.get_content(), partfiles))\n" +"webbrowser.open(f.name)\n" +"os.remove(f.name)\n" +"for fn in partfiles.values():\n" +" os.remove(fn)\n" +"\n" +"# Of course, there are lots of email messages that could break this simple\n" +"# minded program, but it will handle the most common ones.\n" +msgstr "" + #: library/email.examples.rst:52 msgid "Up to the prompt, the output from the above is:" msgstr "" +#: library/email.examples.rst:54 +msgid "" +"To: Penelope Pussycat , Fabrette Pussycat " +"\n" +"From: Pepé Le Pew \n" +"Subject: Pourquoi pas des asperges pour ce midi ?\n" +"\n" +"Salut!\n" +"\n" +"Cette recette [1] sera sûrement un très bon repas." +msgstr "" + #: library/email.examples.rst:66 msgid "Footnotes" msgstr "" diff --git a/library/email.generator.po b/library/email.generator.po index b655623c..24c86e81 100644 --- a/library/email.generator.po +++ b/library/email.generator.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.generator.rst:2 -msgid ":mod:`email.generator`: Generating MIME documents" +msgid ":mod:`!email.generator`: Generating MIME documents" msgstr "" #: library/email.generator.rst:7 @@ -29,9 +30,9 @@ msgid "" "One of the most common tasks is to generate the flat (serialized) version of " "the email message represented by a message object structure. You will need " "to do this if you want to send your message via :meth:`smtplib.SMTP." -"sendmail` or the :mod:`nntplib` module, or print the message on the " -"console. Taking a message object structure and producing a serialized " -"representation is the job of the generator classes." +"sendmail`, or print the message on the console. Taking a message object " +"structure and producing a serialized representation is the job of the " +"generator classes." msgstr "" #: library/email.generator.rst:18 diff --git a/library/email.header.po b/library/email.header.po index f607a0e3..02027956 100644 --- a/library/email.header.po +++ b/library/email.header.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.header.rst:2 -msgid ":mod:`email.header`: Internationalized headers" +msgid ":mod:`!email.header`: Internationalized headers" msgstr "" #: library/email.header.rst:7 @@ -71,6 +72,17 @@ msgid "" "header` module. For example::" msgstr "" +#: library/email.header.rst:40 +msgid "" +">>> from email.message import Message\n" +">>> from email.header import Header\n" +">>> msg = Message()\n" +">>> h = Header('p\\xf6stal', 'iso-8859-1')\n" +">>> msg['Subject'] = h\n" +">>> msg.as_string()\n" +"'Subject: =?iso-8859-1?q?p=F6stal?=\\n\\n'" +msgstr "" + #: library/email.header.rst:50 msgid "" "Notice here how we wanted the :mailheader:`Subject` field to contain a non-" @@ -114,7 +126,7 @@ msgid "" "The maximum line length can be specified explicitly via *maxlinelen*. For " "splitting the first line to a shorter value (to account for the field header " "which isn't included in *s*, e.g. :mailheader:`Subject`) pass in the name of " -"the field in *header_name*. The default *maxlinelen* is 76, and the default " +"the field in *header_name*. The default *maxlinelen* is 78, and the default " "value for *header_name* is ``None``, meaning it is not taken into account " "for the first line of a long, split header." msgstr "" @@ -254,33 +266,68 @@ msgid "" msgstr "" #: library/email.header.rst:181 +msgid "For historical reasons, this function may return either:" +msgstr "" + +#: library/email.header.rst:183 msgid "" -"This function returns a list of ``(decoded_string, charset)`` pairs " -"containing each of the decoded parts of the header. *charset* is ``None`` " -"for non-encoded parts of the header, otherwise a lower case string " -"containing the name of the character set specified in the encoded string." +"A list of pairs containing each of the decoded parts of the header, " +"``(decoded_bytes, charset)``, where *decoded_bytes* is always an instance " +"of :class:`bytes`, and *charset* is either:" msgstr "" -#: library/email.header.rst:186 -msgid "Here's an example::" +#: library/email.header.rst:187 +msgid "A lower case string containing the name of the character set specified." msgstr "" -#: library/email.header.rst:195 +#: library/email.header.rst:189 +msgid "``None`` for non-encoded parts of the header." +msgstr "" + +#: library/email.header.rst:191 +msgid "" +"A list of length 1 containing a pair ``(string, None)``, where *string* is " +"always an instance of :class:`str`." +msgstr "" + +#: library/email.header.rst:194 +msgid "" +"An :exc:`email.errors.HeaderParseError` may be raised when certain decoding " +"errors occur (e.g. a base64 decoding exception)." +msgstr "" + +#: library/email.header.rst:197 +msgid "Here are examples:" +msgstr "" + +#: library/email.header.rst:209 +msgid "" +"This function exists for backwards compatibility only. For new code, we " +"recommend using :class:`email.headerregistry.HeaderRegistry`." +msgstr "" + +#: library/email.header.rst:215 msgid "" "Create a :class:`Header` instance from a sequence of pairs as returned by :" "func:`decode_header`." msgstr "" -#: library/email.header.rst:198 +#: library/email.header.rst:218 msgid "" ":func:`decode_header` takes a header value string and returns a sequence of " "pairs of the format ``(decoded_string, charset)`` where *charset* is the " "name of the character set." msgstr "" -#: library/email.header.rst:202 +#: library/email.header.rst:222 msgid "" "This function takes one of those sequence of pairs and returns a :class:" "`Header` instance. Optional *maxlinelen*, *header_name*, and " "*continuation_ws* are as in the :class:`Header` constructor." msgstr "" + +#: library/email.header.rst:228 +msgid "" +"This function exists for backwards compatibility only, and is not " +"recommended for use in new code." +msgstr "" diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index 6343fade..4cec118a 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.headerregistry.rst:2 -msgid ":mod:`email.headerregistry`: Custom Header Objects" +msgid ":mod:`!email.headerregistry`: Custom Header Objects" msgstr "" #: library/email.headerregistry.rst:10 @@ -122,6 +123,10 @@ msgid "" "method is called as follows::" msgstr "" +#: library/email.headerregistry.rst:94 +msgid "parse(string, kwds)" +msgstr "" + #: library/email.headerregistry.rst:96 msgid "" "``kwds`` is a dictionary containing one pre-initialized key, ``defects``. " @@ -143,6 +148,13 @@ msgid "" "``BaseHeader`` itself. Such an ``init`` method should look like this::" msgstr "" +#: library/email.headerregistry.rst:110 +msgid "" +"def init(self, /, *args, **kw):\n" +" self._myattr = kw.pop('myattr')\n" +" super().init(*args, **kw)" +msgstr "" + #: library/email.headerregistry.rst:114 msgid "" "That is, anything extra that the specialized class puts in to the ``kwds`` " @@ -205,6 +217,10 @@ msgid "" "``datetime`` according to the :rfc:`5322` rules; that is, it is set to::" msgstr "" +#: library/email.headerregistry.rst:163 +msgid "email.utils.format_datetime(self.datetime)" +msgstr "" + #: library/email.headerregistry.rst:165 msgid "" "When creating a ``DateHeader``, *value* may be :class:`~datetime.datetime` " @@ -212,6 +228,10 @@ msgid "" "does what one would expect::" msgstr "" +#: library/email.headerregistry.rst:169 +msgid "msg['Date'] = datetime(2011, 7, 15, 21)" +msgstr "" + #: library/email.headerregistry.rst:171 msgid "" "Because this is a naive ``datetime`` it will be interpreted as a UTC " @@ -220,6 +240,10 @@ msgid "" "mod:`~email.utils` module::" msgstr "" +#: library/email.headerregistry.rst:176 +msgid "msg['Date'] = utils.localtime()" +msgstr "" + #: library/email.headerregistry.rst:178 msgid "" "This example sets the date header to the current time and date using the " @@ -361,7 +385,7 @@ msgid "" "class. When *use_default_map* is ``True`` (the default), the standard " "mapping of header names to classes is copied in to the registry during " "initialization. *base_class* is always the last class in the generated " -"class's ``__bases__`` list." +"class's :class:`~type.__bases__` list." msgstr "" #: library/email.headerregistry.rst:322 @@ -537,10 +561,18 @@ msgid "" "address is::" msgstr "" +#: library/email.headerregistry.rst:380 +msgid "[display_name] " +msgstr "" + #: library/email.headerregistry.rst:382 msgid "or::" msgstr "" +#: library/email.headerregistry.rst:384 +msgid "username@domain" +msgstr "" + #: library/email.headerregistry.rst:386 msgid "" "where each part must conform to specific syntax rules spelled out in :rfc:" @@ -598,6 +630,10 @@ msgid "" "address group is::" msgstr "" +#: library/email.headerregistry.rst:432 +msgid "display_name: [address-list];" +msgstr "" + #: library/email.headerregistry.rst:434 msgid "" "As a convenience for processing lists of addresses that consist of a mixture " diff --git a/library/email.iterators.po b/library/email.iterators.po index cb4a18d2..80ebefe3 100644 --- a/library/email.iterators.po +++ b/library/email.iterators.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.iterators.rst:2 -msgid ":mod:`email.iterators`: Iterators" +msgid ":mod:`!email.iterators`: Iterators" msgstr "" #: library/email.iterators.rst:7 @@ -79,6 +80,27 @@ msgid "" "structure. For example:" msgstr "" +#: library/email.iterators.rst:57 +msgid "" +">>> msg = email.message_from_file(somefile)\n" +">>> _structure(msg)\n" +"multipart/mixed\n" +" text/plain\n" +" text/plain\n" +" multipart/digest\n" +" message/rfc822\n" +" text/plain\n" +" message/rfc822\n" +" text/plain\n" +" message/rfc822\n" +" text/plain\n" +" message/rfc822\n" +" text/plain\n" +" message/rfc822\n" +" text/plain\n" +" text/plain" +msgstr "" + #: library/email.iterators.rst:81 msgid "" "Optional *fp* is a file-like object to print the output to. It must be " diff --git a/library/email.message.po b/library/email.message.po index 71ab6f44..b1bb0ab9 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.message.rst:2 -msgid ":mod:`email.message`: Representing an email message" +msgid ":mod:`!email.message`: Representing an email message" msgstr "" #: library/email.message.rst:10 @@ -68,7 +69,7 @@ msgid "" "names, which must be ASCII values. The values of the dictionary are strings " "with some extra methods. Headers are stored and returned in case-preserving " "form, but field names are matched case-insensitively. The keys are ordered, " -"but unlike a real dict, there can be duplicates. Addtional methods are " +"but unlike a real dict, there can be duplicates. Additional methods are " "provided for working with headers that have duplicate keys." msgstr "" @@ -163,7 +164,7 @@ msgstr "" #: library/email.message.rst:127 msgid "" -"Equivalent to :meth:`.as_bytes()`. Allows ``bytes(msg)`` to produce a bytes " +"Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a bytes " "object containing the serialized message." msgstr "" @@ -228,6 +229,12 @@ msgid "" "Used for the ``in`` operator. For example::" msgstr "" +#: library/email.message.rst:185 +msgid "" +"if 'message-id' in myMessage:\n" +" print('Message-ID:', myMessage['message-id'])" +msgstr "" + #: library/email.message.rst:191 msgid "" "Return the value of the named header field. *name* does not include the " @@ -262,6 +269,12 @@ msgid "" "present in the message with field name *name*, delete the field first, e.g.::" msgstr "" +#: library/email.message.rst:213 +msgid "" +"del msg['subject']\n" +"msg['subject'] = 'Python roolz!'" +msgstr "" + #: library/email.message.rst:216 msgid "" "If the :mod:`policy ` defines certain headers to be unique (as " @@ -345,14 +358,28 @@ msgstr "" msgid "Here is an example::" msgstr "" +#: library/email.message.rst:289 +msgid "msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')" +msgstr "" + #: library/email.message.rst:291 msgid "This will add a header that looks like ::" msgstr "" +#: library/email.message.rst:293 +msgid "Content-Disposition: attachment; filename=\"bud.gif\"" +msgstr "" + #: library/email.message.rst:295 msgid "An example of the extended interface with non-ASCII characters::" msgstr "" +#: library/email.message.rst:297 +msgid "" +"msg.add_header('Content-Disposition', 'attachment',\n" +" filename=('iso-8859-1', '', 'Fußballer.ppt'))" +msgstr "" + #: library/email.message.rst:303 msgid "" "Replace a header. Replace the first header found in the message that " @@ -558,6 +585,19 @@ msgid "" "message structure:" msgstr "" +#: library/email.message.rst:491 +msgid "" +">>> for part in msg.walk():\n" +"... print(part.get_content_type())\n" +"multipart/report\n" +"text/plain\n" +"message/delivery-status\n" +"text/plain\n" +"text/plain\n" +"message/rfc822\n" +"text/plain" +msgstr "" + #: library/email.message.rst:503 msgid "" "``walk`` iterates over the subparts of any part where :meth:`is_multipart` " @@ -566,6 +606,29 @@ msgid "" "``_structure`` debug helper function:" msgstr "" +#: library/email.message.rst:509 +msgid "" +">>> from email.iterators import _structure\n" +">>> for part in msg.walk():\n" +"... print(part.get_content_maintype() == 'multipart',\n" +"... part.is_multipart())\n" +"True True\n" +"False False\n" +"False True\n" +"False False\n" +"False False\n" +"False True\n" +"False False\n" +">>> _structure(msg)\n" +"multipart/report\n" +" text/plain\n" +" message/delivery-status\n" +" text/plain\n" +" text/plain\n" +" message/rfc822\n" +" text/plain" +msgstr "" + #: library/email.message.rst:531 msgid "" "Here the ``message`` parts are not ``multiparts``, but they do contain " diff --git a/library/email.mime.po b/library/email.mime.po index 1b1e56aa..2d3a4c11 100644 --- a/library/email.mime.po +++ b/library/email.mime.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.mime.rst:2 -msgid ":mod:`email.mime`: Creating email and MIME objects from scratch" +msgid ":mod:`!email.mime`: Creating email and MIME objects from scratch" msgstr "" #: library/email.mime.rst:7 diff --git a/library/email.parser.po b/library/email.parser.po index f728a717..571691e7 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.parser.rst:2 -msgid ":mod:`email.parser`: Parsing email messages" +msgid ":mod:`!email.parser`: Parsing email messages" msgstr "" #: library/email.parser.rst:7 @@ -161,7 +162,7 @@ msgid "" "Works like :class:`BytesFeedParser` except that the input to the :meth:" "`~BytesFeedParser.feed` method must be a string. This is of limited " "utility, since the only way for such a message to be valid is for it to " -"contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " +"contain only ASCII text or, if :attr:`~email.policy.EmailPolicy.utf8` is " "``True``, no binary attachments." msgstr "" @@ -210,11 +211,11 @@ msgstr "" #: library/email.parser.rst:161 msgid "" "The bytes contained in *fp* must be formatted as a block of :rfc:`5322` (or, " -"if :attr:`~email.policy.Policy.utf8` is ``True``, :rfc:`6532`) style headers " -"and header continuation lines, optionally preceded by an envelope header. " -"The header block is terminated either by the end of the data or by a blank " -"line. Following the header block is the body of the message (which may " -"contain MIME-encoded subparts, including subparts with a :mailheader:" +"if :attr:`~email.policy.EmailPolicy.utf8` is ``True``, :rfc:`6532`) style " +"headers and header continuation lines, optionally preceded by an envelope " +"header. The header block is terminated either by the end of the data or by " +"a blank line. Following the header block is the body of the message (which " +"may contain MIME-encoded subparts, including subparts with a :mailheader:" "`Content-Transfer-Encoding` of ``8bit``)." msgstr "" @@ -323,6 +324,12 @@ msgid "" "interactive Python prompt::" msgstr "" +#: library/email.parser.rst:286 +msgid "" +">>> import email\n" +">>> msg = email.message_from_bytes(myBytes)" +msgstr "" + #: library/email.parser.rst:291 msgid "Additional notes" msgstr "" diff --git a/library/email.po b/library/email.po index cefe872b..d1c03dd4 100644 --- a/library/email.po +++ b/library/email.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.rst:2 -msgid ":mod:`email` --- An email and MIME handling package" +msgid ":mod:`!email` --- An email and MIME handling package" msgstr "" #: library/email.rst:11 @@ -29,10 +30,10 @@ msgid "" "The :mod:`email` package is a library for managing email messages. It is " "specifically *not* designed to do any sending of email messages to SMTP (:" "rfc:`2821`), NNTP, or other servers; those are functions of modules such as :" -"mod:`smtplib` and :mod:`nntplib`. The :mod:`email` package attempts to be " -"as RFC-compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as " -"well as such MIME-related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :" -"rfc:`2183`, and :rfc:`2231`." +"mod:`smtplib`. The :mod:`email` package attempts to be as RFC-compliant as " +"possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-" +"related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:" +"`2231`." msgstr "" #: library/email.rst:23 @@ -154,7 +155,7 @@ msgstr "" msgid "Legacy API:" msgstr "" -#: library/email.rst:136 +#: library/email.rst:135 msgid "Module :mod:`smtplib`" msgstr "" @@ -162,7 +163,7 @@ msgstr "" msgid "SMTP (Simple Mail Transport Protocol) client" msgstr "" -#: library/email.rst:139 +#: library/email.rst:138 msgid "Module :mod:`poplib`" msgstr "" @@ -170,7 +171,7 @@ msgstr "" msgid "POP (Post Office Protocol) client" msgstr "" -#: library/email.rst:142 +#: library/email.rst:141 msgid "Module :mod:`imaplib`" msgstr "" @@ -178,19 +179,11 @@ msgstr "" msgid "IMAP (Internet Message Access Protocol) client" msgstr "" -#: library/email.rst:145 -msgid "Module :mod:`nntplib`" -msgstr "" - -#: library/email.rst:145 -msgid "NNTP (Net News Transport Protocol) client" -msgstr "" - -#: library/email.rst:148 +#: library/email.rst:144 msgid "Module :mod:`mailbox`" msgstr "" -#: library/email.rst:148 +#: library/email.rst:145 msgid "" "Tools for creating, reading, and managing collections of messages on disk " "using a variety standard formats." diff --git a/library/email.policy.po b/library/email.policy.po index 1afa593e..f13e9cf8 100644 --- a/library/email.policy.po +++ b/library/email.policy.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.policy.rst:2 -msgid ":mod:`email.policy`: Policy Objects" +msgid ":mod:`!email.policy`: Policy Objects" msgstr "" #: library/email.policy.rst:12 @@ -120,6 +121,22 @@ msgid "" "system:" msgstr "" +#: library/email.policy.rst:92 +msgid "" +">>> from email import message_from_binary_file\n" +">>> from email.generator import BytesGenerator\n" +">>> from email import policy\n" +">>> from subprocess import Popen, PIPE\n" +">>> with open('mymsg.txt', 'rb') as f:\n" +"... msg = message_from_binary_file(f, policy=policy.default)\n" +"...\n" +">>> p = Popen(['sendmail', msg['To'].addresses[0]], stdin=PIPE)\n" +">>> g = BytesGenerator(p.stdin, policy=msg.policy.clone(linesep='\\r\\n'))\n" +">>> g.flatten(msg)\n" +">>> p.stdin.close()\n" +">>> rc = p.wait()" +msgstr "" + #: library/email.policy.rst:114 msgid "" "Here we are telling :class:`~email.generator.BytesGenerator` to use the RFC " @@ -137,6 +154,14 @@ msgid "" "line separators for the platform on which it is running::" msgstr "" +#: library/email.policy.rst:125 +msgid "" +">>> import os\n" +">>> with open('converted.txt', 'wb') as f:\n" +"... f.write(msg.as_bytes(policy=msg.policy.clone(linesep=os.linesep)))\n" +"17" +msgstr "" + #: library/email.policy.rst:130 msgid "" "Policy objects can also be combined using the addition operator, producing a " @@ -144,12 +169,31 @@ msgid "" "the summed objects::" msgstr "" +#: library/email.policy.rst:134 +msgid "" +">>> compat_SMTP = policy.compat32.clone(linesep='\\r\\n')\n" +">>> compat_strict = policy.compat32.clone(raise_on_defect=True)\n" +">>> compat_strict_SMTP = compat_SMTP + compat_strict" +msgstr "" + #: library/email.policy.rst:138 msgid "" "This operation is not commutative; that is, the order in which the objects " "are added matters. To illustrate::" msgstr "" +#: library/email.policy.rst:141 +msgid "" +">>> policy100 = policy.compat32.clone(max_line_length=100)\n" +">>> policy80 = policy.compat32.clone(max_line_length=80)\n" +">>> apolicy = policy100 + policy80\n" +">>> apolicy.max_line_length\n" +"80\n" +">>> apolicy = policy80 + policy100\n" +">>> apolicy.max_line_length\n" +"100" +msgstr "" + #: library/email.policy.rst:153 msgid "" "This is the :term:`abstract base class` for all policy classes. It provides " @@ -245,46 +289,62 @@ msgid "" "`~email.message.Message` is used." msgstr "" -#: library/email.policy.rst:232 +#: library/email.policy.rst:235 +msgid "" +"If ``True`` (the default), the generator will raise :exc:`~email.errors." +"HeaderWriteError` instead of writing a header that is improperly folded or " +"delimited, such that it would be parsed as multiple headers or joined with " +"adjacent data. Such headers can be generated by custom header classes or " +"bugs in the ``email`` module." +msgstr "" + +#: library/email.policy.rst:242 +msgid "" +"As it's a security feature, this defaults to ``True`` even in the :class:" +"`~email.policy.Compat32` policy. For backwards compatible, but unsafe, " +"behavior, it must be set to ``False`` explicitly." +msgstr "" + +#: library/email.policy.rst:250 msgid "" "The following :class:`Policy` method is intended to be called by code using " "the email library to create policy instances with custom settings:" msgstr "" -#: library/email.policy.rst:238 +#: library/email.policy.rst:256 msgid "" "Return a new :class:`Policy` instance whose attributes have the same values " "as the current instance, except where those attributes are given new values " "by the keyword arguments." msgstr "" -#: library/email.policy.rst:243 +#: library/email.policy.rst:261 msgid "" "The remaining :class:`Policy` methods are called by the email package code, " "and are not intended to be called by an application using the email package. " "A custom policy must implement all of these methods." msgstr "" -#: library/email.policy.rst:250 +#: library/email.policy.rst:268 msgid "" "Handle a *defect* found on *obj*. When the email package calls this method, " -"*defect* will always be a subclass of :class:`~email.errors.Defect`." +"*defect* will always be a subclass of :class:`~email.errors.MessageDefect`." msgstr "" -#: library/email.policy.rst:254 +#: library/email.policy.rst:272 msgid "" "The default implementation checks the :attr:`raise_on_defect` flag. If it " "is ``True``, *defect* is raised as an exception. If it is ``False`` (the " "default), *obj* and *defect* are passed to :meth:`register_defect`." msgstr "" -#: library/email.policy.rst:261 +#: library/email.policy.rst:279 msgid "" "Register a *defect* on *obj*. In the email package, *defect* will always be " -"a subclass of :class:`~email.errors.Defect`." +"a subclass of :class:`~email.errors.MessageDefect`." msgstr "" -#: library/email.policy.rst:264 +#: library/email.policy.rst:282 msgid "" "The default implementation calls the ``append`` method of the ``defects`` " "attribute of *obj*. When the email package calls :attr:`handle_defect`, " @@ -294,11 +354,11 @@ msgid "" "defects in parsed messages will raise unexpected errors." msgstr "" -#: library/email.policy.rst:274 +#: library/email.policy.rst:292 msgid "Return the maximum allowed number of headers named *name*." msgstr "" -#: library/email.policy.rst:276 +#: library/email.policy.rst:294 msgid "" "Called when a header is added to an :class:`~email.message.EmailMessage` or :" "class:`~email.message.Message` object. If the returned value is not ``0`` " @@ -306,7 +366,7 @@ msgid "" "greater than or equal to the value returned, a :exc:`ValueError` is raised." msgstr "" -#: library/email.policy.rst:282 +#: library/email.policy.rst:300 msgid "" "Because the default behavior of ``Message.__setitem__`` is to append the " "value to the list of headers, it is easy to create duplicate headers without " @@ -316,11 +376,11 @@ msgid "" "faithfully produce as many headers as exist in the message being parsed.)" msgstr "" -#: library/email.policy.rst:290 +#: library/email.policy.rst:308 msgid "The default implementation returns ``None`` for all header names." msgstr "" -#: library/email.policy.rst:295 +#: library/email.policy.rst:313 msgid "" "The email package calls this method with a list of strings, each string " "ending with the line separation characters found in the source being " @@ -330,7 +390,7 @@ msgid "" "the parsed header." msgstr "" -#: library/email.policy.rst:302 +#: library/email.policy.rst:320 msgid "" "If an implementation wishes to retain compatibility with the existing email " "package policies, *name* should be the case preserved name (all characters " @@ -339,15 +399,15 @@ msgid "" "stripped of leading whitespace." msgstr "" -#: library/email.policy.rst:308 +#: library/email.policy.rst:326 msgid "*sourcelines* may contain surrogateescaped binary data." msgstr "" -#: library/email.policy.rst:326 library/email.policy.rst:342 +#: library/email.policy.rst:344 library/email.policy.rst:360 msgid "There is no default implementation" msgstr "" -#: library/email.policy.rst:315 +#: library/email.policy.rst:333 msgid "" "The email package calls this method with the name and value provided by the " "application program when the application program is modifying a ``Message`` " @@ -356,14 +416,14 @@ msgid "" "``Message`` to represent the header." msgstr "" -#: library/email.policy.rst:321 +#: library/email.policy.rst:339 msgid "" "If an implementation wishes to retain compatibility with the existing email " "package policies, the *name* and *value* should be strings or string " "subclasses that do not change the content of the passed in arguments." msgstr "" -#: library/email.policy.rst:331 +#: library/email.policy.rst:349 msgid "" "The email package calls this method with the *name* and *value* currently " "stored in the ``Message`` when that header is requested by the application " @@ -374,13 +434,13 @@ msgid "" "returned to the application." msgstr "" -#: library/email.policy.rst:339 +#: library/email.policy.rst:357 msgid "" "*value* may contain surrogateescaped binary data. There should be no " "surrogateescaped binary data in the value returned by the method." msgstr "" -#: library/email.policy.rst:347 +#: library/email.policy.rst:365 msgid "" "The email package calls this method with the *name* and *value* currently " "stored in the ``Message`` for a given header. The method should return a " @@ -390,32 +450,32 @@ msgid "" "discussion of the rules for folding email headers." msgstr "" -#: library/email.policy.rst:354 +#: library/email.policy.rst:372 msgid "" "*value* may contain surrogateescaped binary data. There should be no " "surrogateescaped binary data in the string returned by the method." msgstr "" -#: library/email.policy.rst:360 +#: library/email.policy.rst:378 msgid "" "The same as :meth:`fold`, except that the returned value should be a bytes " "object rather than a string." msgstr "" -#: library/email.policy.rst:363 +#: library/email.policy.rst:381 msgid "" "*value* may contain surrogateescaped binary data. These could be converted " "back into binary data in the returned bytes object." msgstr "" -#: library/email.policy.rst:370 +#: library/email.policy.rst:388 msgid "" "This concrete :class:`Policy` provides behavior that is intended to be fully " "compliant with the current email RFCs. These include (but are not limited " "to) :rfc:`5322`, :rfc:`2047`, and the current MIME RFCs." msgstr "" -#: library/email.policy.rst:374 +#: library/email.policy.rst:392 msgid "" "This policy adds new header parsing and folding algorithms. Instead of " "simple strings, headers are ``str`` subclasses with attributes that depend " @@ -423,23 +483,23 @@ msgid "" "implement :rfc:`2047` and :rfc:`5322`." msgstr "" -#: library/email.policy.rst:379 +#: library/email.policy.rst:397 msgid "" "The default value for the :attr:`~email.policy.Policy.message_factory` " "attribute is :class:`~email.message.EmailMessage`." msgstr "" -#: library/email.policy.rst:382 +#: library/email.policy.rst:400 msgid "" "In addition to the settable attributes listed above that apply to all " "policies, this policy adds the following additional attributes:" msgstr "" -#: library/email.policy.rst:385 +#: library/email.policy.rst:403 msgid "[1]_" msgstr "" -#: library/email.policy.rst:390 +#: library/email.policy.rst:408 msgid "" "If ``False``, follow :rfc:`5322`, supporting non-ASCII characters in headers " "by encoding them as \"encoded words\". If ``True``, follow :rfc:`6532` and " @@ -447,7 +507,7 @@ msgid "" "passed to SMTP servers that support the ``SMTPUTF8`` extension (:rfc:`6531`)." msgstr "" -#: library/email.policy.rst:399 +#: library/email.policy.rst:417 msgid "" "If the value for a header in the ``Message`` object originated from a :mod:" "`~email.parser` (as opposed to being set by a program), this attribute " @@ -455,37 +515,37 @@ msgid "" "transforming the message back into serialized form. The possible values are:" msgstr "" -#: library/email.policy.rst:406 +#: library/email.policy.rst:424 msgid "``none``" msgstr "" -#: library/email.policy.rst:406 +#: library/email.policy.rst:424 msgid "all source values use original folding" msgstr "" -#: library/email.policy.rst:408 +#: library/email.policy.rst:426 msgid "``long``" msgstr "" -#: library/email.policy.rst:408 +#: library/email.policy.rst:426 msgid "" "source values that have any line that is longer than ``max_line_length`` " "will be refolded" msgstr "" -#: library/email.policy.rst:411 +#: library/email.policy.rst:429 msgid "``all``" msgstr "" -#: library/email.policy.rst:411 +#: library/email.policy.rst:429 msgid "all values are refolded." msgstr "" -#: library/email.policy.rst:414 +#: library/email.policy.rst:432 msgid "The default is ``long``." msgstr "" -#: library/email.policy.rst:419 +#: library/email.policy.rst:437 msgid "" "A callable that takes two arguments, ``name`` and ``value``, where ``name`` " "is a header field name and ``value`` is an unfolded header field value, and " @@ -496,7 +556,7 @@ msgid "" "custom parsing will be added in the future." msgstr "" -#: library/email.policy.rst:430 +#: library/email.policy.rst:448 msgid "" "An object with at least two methods: get_content and set_content. When the :" "meth:`~email.message.EmailMessage.get_content` or :meth:`~email.message." @@ -507,20 +567,20 @@ msgid "" "``content_manager`` is set to :data:`~email.contentmanager.raw_data_manager`." msgstr "" -#: library/email.policy.rst:600 +#: library/email.policy.rst:618 msgid "" "The class provides the following concrete implementations of the abstract " "methods of :class:`Policy`:" msgstr "" -#: library/email.policy.rst:448 +#: library/email.policy.rst:466 msgid "" "Returns the value of the :attr:`~email.headerregistry.BaseHeader.max_count` " "attribute of the specialized class used to represent the header with the " "given name." msgstr "" -#: library/email.policy.rst:606 +#: library/email.policy.rst:624 msgid "" "The name is parsed as everything up to the '``:``' and returned unmodified. " "The value is determined by stripping leading whitespace off the remainder of " @@ -528,7 +588,7 @@ msgid "" "trailing carriage return or linefeed characters." msgstr "" -#: library/email.policy.rst:464 +#: library/email.policy.rst:482 msgid "" "The name is returned unchanged. If the input value has a ``name`` attribute " "and it matches *name* ignoring case, the value is returned unchanged. " @@ -537,7 +597,7 @@ msgid "" "``ValueError`` is raised if the input value contains CR or LF characters." msgstr "" -#: library/email.policy.rst:474 +#: library/email.policy.rst:492 msgid "" "If the value has a ``name`` attribute, it is returned to unmodified. " "Otherwise the *name*, and the *value* with any CR or LF characters removed, " @@ -546,7 +606,7 @@ msgid "" "character glyph." msgstr "" -#: library/email.policy.rst:483 +#: library/email.policy.rst:501 msgid "" "Header folding is controlled by the :attr:`refold_source` policy setting. A " "value is considered to be a 'source value' if and only if it does not have a " @@ -558,7 +618,7 @@ msgid "" "current policy." msgstr "" -#: library/email.policy.rst:492 +#: library/email.policy.rst:510 msgid "" "Source values are split into lines using :meth:`~str.splitlines`. If the " "value is not to be refolded, the lines are rejoined using the ``linesep`` " @@ -568,13 +628,13 @@ msgid "" "using the ``unknown-8bit`` charset." msgstr "" -#: library/email.policy.rst:502 +#: library/email.policy.rst:520 msgid "" "The same as :meth:`fold` if :attr:`~Policy.cte_type` is ``7bit``, except " "that the returned value is bytes." msgstr "" -#: library/email.policy.rst:505 +#: library/email.policy.rst:523 msgid "" "If :attr:`~Policy.cte_type` is ``8bit``, non-ASCII binary data is converted " "back into bytes. Headers with binary data are not refolded, regardless of " @@ -582,7 +642,7 @@ msgid "" "binary data consists of single byte characters or multibyte characters." msgstr "" -#: library/email.policy.rst:512 +#: library/email.policy.rst:530 msgid "" "The following instances of :class:`EmailPolicy` provide defaults suitable " "for specific application domains. Note that in the future the behavior of " @@ -590,20 +650,20 @@ msgid "" "conform even more closely to the RFCs relevant to their domains." msgstr "" -#: library/email.policy.rst:520 +#: library/email.policy.rst:538 msgid "" "An instance of ``EmailPolicy`` with all defaults unchanged. This policy " "uses the standard Python ``\\n`` line endings rather than the RFC-correct " "``\\r\\n``." msgstr "" -#: library/email.policy.rst:527 +#: library/email.policy.rst:545 msgid "" "Suitable for serializing messages in conformance with the email RFCs. Like " "``default``, but with ``linesep`` set to ``\\r\\n``, which is RFC compliant." msgstr "" -#: library/email.policy.rst:534 +#: library/email.policy.rst:552 msgid "" "The same as ``SMTP`` except that :attr:`~EmailPolicy.utf8` is ``True``. " "Useful for serializing messages to a message store without using encoded " @@ -612,46 +672,50 @@ msgid "" "SMTP.send_message` method handles this automatically)." msgstr "" -#: library/email.policy.rst:543 +#: library/email.policy.rst:561 msgid "" "Suitable for serializing headers with for use in HTTP traffic. Like " "``SMTP`` except that ``max_line_length`` is set to ``None`` (unlimited)." msgstr "" -#: library/email.policy.rst:549 +#: library/email.policy.rst:567 msgid "" "Convenience instance. The same as ``default`` except that " "``raise_on_defect`` is set to ``True``. This allows any policy to be made " "strict by writing::" msgstr "" -#: library/email.policy.rst:556 +#: library/email.policy.rst:571 +msgid "somepolicy + policy.strict" +msgstr "" + +#: library/email.policy.rst:574 msgid "" "With all of these :class:`EmailPolicies <.EmailPolicy>`, the effective API " "of the email package is changed from the Python 3.2 API in the following " "ways:" msgstr "" -#: library/email.policy.rst:559 +#: library/email.policy.rst:577 msgid "" "Setting a header on a :class:`~email.message.Message` results in that header " "being parsed and a header object created." msgstr "" -#: library/email.policy.rst:562 +#: library/email.policy.rst:580 msgid "" "Fetching a header value from a :class:`~email.message.Message` results in " "that header being parsed and a header object created and returned." msgstr "" -#: library/email.policy.rst:566 +#: library/email.policy.rst:584 msgid "" "Any header object, or any header that is refolded due to the policy " "settings, is folded using an algorithm that fully implements the RFC folding " "algorithms, including knowing where encoded words are required and allowed." msgstr "" -#: library/email.policy.rst:571 +#: library/email.policy.rst:589 msgid "" "From the application view, this means that any header obtained through the :" "class:`~email.message.EmailMessage` is a header object with extra " @@ -661,13 +725,13 @@ msgid "" "the unicode string into the correct RFC encoded form." msgstr "" -#: library/email.policy.rst:578 +#: library/email.policy.rst:596 msgid "" "The header objects and their attributes are described in :mod:`~email." "headerregistry`." msgstr "" -#: library/email.policy.rst:585 +#: library/email.policy.rst:603 msgid "" "This concrete :class:`Policy` is the backward compatibility policy. It " "replicates the behavior of the email package in Python 3.2. The :mod:" @@ -676,28 +740,28 @@ msgid "" "of the email package is to maintain compatibility with Python 3.2." msgstr "" -#: library/email.policy.rst:591 +#: library/email.policy.rst:609 msgid "" "The following attributes have values that are different from the :class:" "`Policy` default:" msgstr "" -#: library/email.policy.rst:597 +#: library/email.policy.rst:615 msgid "The default is ``True``." msgstr "" -#: library/email.policy.rst:614 +#: library/email.policy.rst:632 msgid "The name and value are returned unmodified." msgstr "" -#: library/email.policy.rst:619 +#: library/email.policy.rst:637 msgid "" "If the value contains binary data, it is converted into a :class:`~email." "header.Header` object using the ``unknown-8bit`` charset. Otherwise it is " "returned unmodified." msgstr "" -#: library/email.policy.rst:626 +#: library/email.policy.rst:644 msgid "" "Headers are folded using the :class:`~email.header.Header` folding " "algorithm, which preserves existing line breaks in the value, and wraps each " @@ -705,7 +769,7 @@ msgid "" "encoded using the ``unknown-8bit`` charset." msgstr "" -#: library/email.policy.rst:634 +#: library/email.policy.rst:652 msgid "" "Headers are folded using the :class:`~email.header.Header` folding " "algorithm, which preserves existing line breaks in the value, and wraps each " @@ -715,17 +779,17 @@ msgid "" "and any (RFC invalid) binary data it may contain." msgstr "" -#: library/email.policy.rst:644 +#: library/email.policy.rst:662 msgid "" "An instance of :class:`Compat32`, providing backward compatibility with the " "behavior of the email package in Python 3.2." msgstr "" -#: library/email.policy.rst:649 +#: library/email.policy.rst:667 msgid "Footnotes" msgstr "" -#: library/email.policy.rst:650 +#: library/email.policy.rst:668 msgid "" "Originally added in 3.3 as a :term:`provisional feature `." diff --git a/library/email.utils.po b/library/email.utils.po index f5ec04f8..eb759f19 100644 --- a/library/email.utils.po +++ b/library/email.utils.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/email.utils.rst:2 -msgid ":mod:`email.utils`: Miscellaneous utilities" +msgid ":mod:`!email.utils`: Miscellaneous utilities" msgstr "" #: library/email.utils.rst:7 @@ -36,15 +37,14 @@ msgid "" "return current time. Otherwise *dt* argument should be a :class:`~datetime." "datetime` instance, and it is converted to the local time zone according to " "the system time zone database. If *dt* is naive (that is, ``dt.tzinfo`` is " -"``None``), it is assumed to be in local time. The *isdst* parameter is " -"ignored." +"``None``), it is assumed to be in local time." msgstr "" -#: library/email.utils.rst:26 +#: library/email.utils.rst:24 msgid "The *isdst* parameter." msgstr "" -#: library/email.utils.rst:30 +#: library/email.utils.rst:29 msgid "" "Returns a string suitable for an :rfc:`2822`\\ -compliant :mailheader:" "`Message-ID` header. Optional *idstring* if given, is a string used to " @@ -55,11 +55,11 @@ msgid "" "consistent domain name across multiple hosts." msgstr "" -#: library/email.utils.rst:38 +#: library/email.utils.rst:37 msgid "Added the *domain* keyword." msgstr "" -#: library/email.utils.rst:42 +#: library/email.utils.rst:41 msgid "" "The remaining functions are part of the legacy (``Compat32``) email API. " "There is no need to directly use these with the new API, since the parsing " @@ -67,20 +67,20 @@ msgid "" "machinery of the new API." msgstr "" -#: library/email.utils.rst:50 +#: library/email.utils.rst:49 msgid "" "Return a new string with backslashes in *str* replaced by two backslashes, " "and double quotes replaced by backslash-double quote." msgstr "" -#: library/email.utils.rst:56 +#: library/email.utils.rst:55 msgid "" "Return a new string which is an *unquoted* version of *str*. If *str* ends " "and begins with double quotes, they are stripped off. Likewise if *str* " "ends and begins with angle brackets, they are stripped off." msgstr "" -#: library/email.utils.rst:63 +#: library/email.utils.rst:62 msgid "" "Parse address -- which should be the value of some address-containing field " "such as :mailheader:`To` or :mailheader:`Cc` -- into its constituent " @@ -88,7 +88,16 @@ msgid "" "unless the parse fails, in which case a 2-tuple of ``('', '')`` is returned." msgstr "" -#: library/email.utils.rst:71 +#: library/email.utils.rst:95 +msgid "" +"If *strict* is true, use a strict parser which rejects malformed inputs." +msgstr "" + +#: library/email.utils.rst:107 +msgid "Add *strict* optional parameter and reject malformed inputs by default." +msgstr "" + +#: library/email.utils.rst:75 msgid "" "The inverse of :meth:`parseaddr`, this takes a 2-tuple of the form " "``(realname, email_address)`` and returns the string value suitable for a :" @@ -96,7 +105,7 @@ msgid "" "is false, then the second element is returned unmodified." msgstr "" -#: library/email.utils.rst:76 +#: library/email.utils.rst:80 msgid "" "Optional *charset* is the character set that will be used in the :rfc:`2047` " "encoding of the ``realname`` if the ``realname`` contains non-ASCII " @@ -104,19 +113,33 @@ msgid "" "Charset`. Defaults to ``utf-8``." msgstr "" -#: library/email.utils.rst:81 +#: library/email.utils.rst:85 msgid "Added the *charset* option." msgstr "" -#: library/email.utils.rst:87 +#: library/email.utils.rst:91 msgid "" "This method returns a list of 2-tuples of the form returned by " "``parseaddr()``. *fieldvalues* is a sequence of header field values as might " -"be returned by :meth:`Message.get_all `. " -"Here's a simple example that gets all the recipients of a message::" +"be returned by :meth:`Message.get_all `." +msgstr "" + +#: library/email.utils.rst:97 +msgid "Here's a simple example that gets all the recipients of a message::" msgstr "" -#: library/email.utils.rst:103 +#: library/email.utils.rst:99 +msgid "" +"from email.utils import getaddresses\n" +"\n" +"tos = msg.get_all('to', [])\n" +"ccs = msg.get_all('cc', [])\n" +"resent_tos = msg.get_all('resent-to', [])\n" +"resent_ccs = msg.get_all('resent-cc', [])\n" +"all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs)" +msgstr "" + +#: library/email.utils.rst:113 msgid "" "Attempts to parse a date according to the rules in :rfc:`2822`. however, " "some mailers don't follow that format as specified, so :func:`parsedate` " @@ -127,7 +150,7 @@ msgid "" "returned. Note that indexes 6, 7, and 8 of the result tuple are not usable." msgstr "" -#: library/email.utils.rst:114 +#: library/email.utils.rst:124 msgid "" "Performs the same function as :func:`parsedate`, but returns either ``None`` " "or a 10-tuple; the first 9 elements make up a tuple that can be passed " @@ -138,7 +161,7 @@ msgid "" "the result tuple are not usable." msgstr "" -#: library/email.utils.rst:124 +#: library/email.utils.rst:134 msgid "" "The inverse of :func:`format_datetime`. Performs the same function as :func:" "`parsedate`, but on success returns a :mod:`~datetime.datetime`; otherwise " @@ -152,25 +175,29 @@ msgid "" "corresponding a :class:`~datetime.timezone` :class:`~datetime.tzinfo`." msgstr "" -#: library/email.utils.rst:140 +#: library/email.utils.rst:150 msgid "" "Turn a 10-tuple as returned by :func:`parsedate_tz` into a UTC timestamp " "(seconds since the Epoch). If the timezone item in the tuple is ``None``, " "assume local time." msgstr "" -#: library/email.utils.rst:147 +#: library/email.utils.rst:157 msgid "Returns a date string as per :rfc:`2822`, e.g.::" msgstr "" -#: library/email.utils.rst:151 +#: library/email.utils.rst:159 +msgid "Fri, 09 Nov 2001 01:08:47 -0000" +msgstr "" + +#: library/email.utils.rst:161 msgid "" -"Optional *timeval* if given is a floating point time value as accepted by :" +"Optional *timeval* if given is a floating-point time value as accepted by :" "func:`time.gmtime` and :func:`time.localtime`, otherwise the current time is " "used." msgstr "" -#: library/email.utils.rst:155 +#: library/email.utils.rst:165 msgid "" "Optional *localtime* is a flag that when ``True``, interprets *timeval*, and " "returns a date relative to the local timezone instead of UTC, properly " @@ -178,7 +205,7 @@ msgid "" "UTC is used." msgstr "" -#: library/email.utils.rst:160 +#: library/email.utils.rst:170 msgid "" "Optional *usegmt* is a flag that when ``True``, outputs a date string with " "the timezone as an ascii string ``GMT``, rather than a numeric ``-0000``. " @@ -186,7 +213,7 @@ msgid "" "*localtime* is ``False``. The default is ``False``." msgstr "" -#: library/email.utils.rst:168 +#: library/email.utils.rst:178 msgid "" "Like ``formatdate``, but the input is a :mod:`datetime` instance. If it is " "a naive datetime, it is assumed to be \"UTC with no information about the " @@ -198,11 +225,11 @@ msgid "" "date headers." msgstr "" -#: library/email.utils.rst:182 +#: library/email.utils.rst:192 msgid "Decode the string *s* according to :rfc:`2231`." msgstr "" -#: library/email.utils.rst:187 +#: library/email.utils.rst:197 msgid "" "Encode the string *s* according to :rfc:`2231`. Optional *charset* and " "*language*, if given is the character set name and language name to use. If " @@ -211,7 +238,7 @@ msgid "" "*language*." msgstr "" -#: library/email.utils.rst:195 +#: library/email.utils.rst:205 msgid "" "When a header parameter is encoded in :rfc:`2231` format, :meth:`Message." "get_param ` may return a 3-tuple containing " @@ -223,23 +250,23 @@ msgid "" "defaults to ``'us-ascii'``." msgstr "" -#: library/email.utils.rst:204 +#: library/email.utils.rst:214 msgid "" "For convenience, if the *value* passed to :func:`collapse_rfc2231_value` is " "not a tuple, it should be a string and it is returned unquoted." msgstr "" -#: library/email.utils.rst:210 +#: library/email.utils.rst:220 msgid "" "Decode parameters list according to :rfc:`2231`. *params* is a sequence of " "2-tuples containing elements of the form ``(content-type, string-value)``." msgstr "" -#: library/email.utils.rst:215 +#: library/email.utils.rst:225 msgid "Footnotes" msgstr "" -#: library/email.utils.rst:216 +#: library/email.utils.rst:226 msgid "" "Note that the sign of the timezone offset is the opposite of the sign of the " "``time.timezone`` variable for the same timezone; the latter variable " diff --git a/library/ensurepip.po b/library/ensurepip.po index a3308ba3..85bcf10c 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/ensurepip.rst:2 -msgid ":mod:`ensurepip` --- Bootstrapping the ``pip`` installer" +msgid ":mod:`!ensurepip` --- Bootstrapping the ``pip`` installer" msgstr "" #: library/ensurepip.rst:10 @@ -48,47 +49,58 @@ msgid "" "bootstrap ``pip`` are included as internal parts of the package." msgstr "" -#: library/ensurepip.rst:36 +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/ensurepip.rst:37 msgid ":ref:`installing-index`" msgstr "" -#: library/ensurepip.rst:36 +#: library/ensurepip.rst:38 msgid "The end user guide for installing Python packages" msgstr "" -#: library/ensurepip.rst:38 +#: library/ensurepip.rst:40 msgid ":pep:`453`: Explicit bootstrapping of pip in Python installations" msgstr "" -#: library/ensurepip.rst:39 +#: library/ensurepip.rst:41 msgid "The original rationale and specification for this module." msgstr "" -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#: includes/wasm-mobile-notavail.rst:3 +msgid "Availability" msgstr "" -#: includes/wasm-notavail.rst:5 +#: includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -#: library/ensurepip.rst:44 -msgid "Command line interface" +#: library/ensurepip.rst:48 +msgid "Command-line interface" msgstr "" -#: library/ensurepip.rst:46 +#: library/ensurepip.rst:52 msgid "" "The command line interface is invoked using the interpreter's ``-m`` switch." msgstr "" -#: library/ensurepip.rst:48 +#: library/ensurepip.rst:54 msgid "The simplest possible invocation is::" msgstr "" -#: library/ensurepip.rst:52 +#: library/ensurepip.rst:56 +msgid "python -m ensurepip" +msgstr "" + +#: library/ensurepip.rst:58 msgid "" "This invocation will install ``pip`` if it is not already installed, but " "otherwise does nothing. To ensure the installed version of ``pip`` is at " @@ -96,7 +108,11 @@ msgid "" "upgrade`` option::" msgstr "" -#: library/ensurepip.rst:59 +#: library/ensurepip.rst:63 +msgid "python -m ensurepip --upgrade" +msgstr "" + +#: library/ensurepip.rst:65 msgid "" "By default, ``pip`` is installed into the current virtual environment (if " "one is active) or into the system site packages (if there is no active " @@ -104,122 +120,122 @@ msgid "" "two additional command line options:" msgstr "" -#: library/ensurepip.rst:64 +#: library/ensurepip.rst:72 msgid "" -":samp:`--root {dir}`: Installs ``pip`` relative to the given root directory " -"rather than the root of the currently active virtual environment (if any) or " -"the default root for the current Python installation." +"Installs ``pip`` relative to the given root directory rather than the root " +"of the currently active virtual environment (if any) or the default root for " +"the current Python installation." msgstr "" -#: library/ensurepip.rst:67 +#: library/ensurepip.rst:78 msgid "" -"``--user``: Installs ``pip`` into the user site packages directory rather " -"than globally for the current Python installation (this option is not " -"permitted inside an active virtual environment)." +"Installs ``pip`` into the user site packages directory rather than globally " +"for the current Python installation (this option is not permitted inside an " +"active virtual environment)." msgstr "" -#: library/ensurepip.rst:71 +#: library/ensurepip.rst:82 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the version of Python used to invoke ``ensurepip``). The scripts " "installed can be controlled through two additional command line options:" msgstr "" -#: library/ensurepip.rst:76 +#: library/ensurepip.rst:89 msgid "" -"``--altinstall``: if an alternate installation is requested, the ``pipX`` " -"script will *not* be installed." +"If an alternate installation is requested, the ``pipX`` script will *not* be " +"installed." msgstr "" -#: library/ensurepip.rst:79 +#: library/ensurepip.rst:94 msgid "" -"``--default-pip``: if a \"default pip\" installation is requested, the " -"``pip`` script will be installed in addition to the two regular scripts." +"If a \"default pip\" installation is requested, the ``pip`` script will be " +"installed in addition to the two regular scripts." msgstr "" -#: library/ensurepip.rst:82 +#: library/ensurepip.rst:97 msgid "" "Providing both of the script selection options will trigger an exception." msgstr "" -#: library/ensurepip.rst:86 +#: library/ensurepip.rst:100 msgid "Module API" msgstr "" -#: library/ensurepip.rst:88 +#: library/ensurepip.rst:102 msgid ":mod:`ensurepip` exposes two functions for programmatic use:" msgstr "" -#: library/ensurepip.rst:92 +#: library/ensurepip.rst:106 msgid "" "Returns a string specifying the available version of pip that will be " "installed when bootstrapping an environment." msgstr "" -#: library/ensurepip.rst:99 +#: library/ensurepip.rst:113 msgid "Bootstraps ``pip`` into the current or designated environment." msgstr "" -#: library/ensurepip.rst:101 +#: library/ensurepip.rst:115 msgid "" "*root* specifies an alternative root directory to install relative to. If " "*root* is ``None``, then installation uses the default install location for " "the current environment." msgstr "" -#: library/ensurepip.rst:105 +#: library/ensurepip.rst:119 msgid "" "*upgrade* indicates whether or not to upgrade an existing installation of an " "earlier version of ``pip`` to the available version." msgstr "" -#: library/ensurepip.rst:108 +#: library/ensurepip.rst:122 msgid "" "*user* indicates whether to use the user scheme rather than installing " "globally." msgstr "" -#: library/ensurepip.rst:111 +#: library/ensurepip.rst:125 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the current version of Python)." msgstr "" -#: library/ensurepip.rst:114 +#: library/ensurepip.rst:128 msgid "If *altinstall* is set, then ``pipX`` will *not* be installed." msgstr "" -#: library/ensurepip.rst:116 +#: library/ensurepip.rst:130 msgid "" "If *default_pip* is set, then ``pip`` will be installed in addition to the " "two regular scripts." msgstr "" -#: library/ensurepip.rst:119 +#: library/ensurepip.rst:133 msgid "" "Setting both *altinstall* and *default_pip* will trigger :exc:`ValueError`." msgstr "" -#: library/ensurepip.rst:122 +#: library/ensurepip.rst:136 msgid "" "*verbosity* controls the level of output to :data:`sys.stdout` from the " "bootstrapping operation." msgstr "" -#: library/ensurepip.rst:136 +#: library/ensurepip.rst:139 msgid "" "Raises an :ref:`auditing event ` ``ensurepip.bootstrap`` with " "argument ``root``." msgstr "" -#: library/ensurepip.rst:129 +#: library/ensurepip.rst:143 msgid "" "The bootstrapping process has side effects on both ``sys.path`` and ``os." "environ``. Invoking the command line interface in a subprocess instead " "allows these side effects to be avoided." msgstr "" -#: library/ensurepip.rst:135 +#: library/ensurepip.rst:149 msgid "" "The bootstrapping process may install additional modules required by " "``pip``, but other software should not assume those dependencies will always " diff --git a/library/enum.po b/library/enum.po index 54427577..4748796e 100644 --- a/library/enum.po +++ b/library/enum.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/enum.rst:2 -msgid ":mod:`enum` --- Support for enumerations" +msgid ":mod:`!enum` --- Support for enumerations" msgstr "" #: library/enum.rst:14 @@ -70,6 +71,20 @@ msgid "" "using function-call syntax::" msgstr "" +#: library/enum.rst:38 +msgid "" +">>> from enum import Enum\n" +"\n" +">>> # class syntax\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"\n" +">>> # functional syntax\n" +">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" +msgstr "" + #: library/enum.rst:49 msgid "" "Even though we can use :keyword:`class` syntax to create Enums, Enums are " @@ -191,115 +206,133 @@ msgid "" msgstr "" #: library/enum.rst:113 -msgid ":class:`auto`" +msgid ":class:`EnumDict`" msgstr "" #: library/enum.rst:115 +msgid "A subclass of :class:`dict` for use when subclassing :class:`EnumType`." +msgstr "" + +#: library/enum.rst:117 +msgid ":class:`auto`" +msgstr "" + +#: library/enum.rst:119 msgid "" "Instances are replaced with an appropriate value for Enum members. :class:" "`StrEnum` defaults to the lower-cased version of the member name, while " "other Enums default to 1 and increase from there." msgstr "" -#: library/enum.rst:119 +#: library/enum.rst:123 msgid ":func:`~enum.property`" msgstr "" -#: library/enum.rst:121 +#: library/enum.rst:125 msgid "" "Allows :class:`Enum` members to have attributes without conflicting with " "member names. The ``value`` and ``name`` attributes are implemented this " "way." msgstr "" -#: library/enum.rst:125 +#: library/enum.rst:129 msgid ":func:`unique`" msgstr "" -#: library/enum.rst:127 +#: library/enum.rst:131 msgid "" "Enum class decorator that ensures only one name is bound to any one value." msgstr "" -#: library/enum.rst:129 +#: library/enum.rst:133 msgid ":func:`verify`" msgstr "" -#: library/enum.rst:131 +#: library/enum.rst:135 msgid "" "Enum class decorator that checks user-selectable constraints on an " "enumeration." msgstr "" -#: library/enum.rst:134 +#: library/enum.rst:138 msgid ":func:`member`" msgstr "" -#: library/enum.rst:136 +#: library/enum.rst:140 msgid "Make ``obj`` a member. Can be used as a decorator." msgstr "" -#: library/enum.rst:138 +#: library/enum.rst:142 msgid ":func:`nonmember`" msgstr "" -#: library/enum.rst:140 +#: library/enum.rst:144 msgid "Do not make ``obj`` a member. Can be used as a decorator." msgstr "" -#: library/enum.rst:142 +#: library/enum.rst:146 msgid ":func:`global_enum`" msgstr "" -#: library/enum.rst:144 +#: library/enum.rst:148 msgid "" "Modify the :class:`str() ` and :func:`repr` of an enum to show its " "members as belonging to the module instead of its class, and export the enum " "members to the global namespace." msgstr "" -#: library/enum.rst:148 +#: library/enum.rst:152 msgid ":func:`show_flag_values`" msgstr "" -#: library/enum.rst:150 +#: library/enum.rst:154 msgid "Return a list of all power-of-two integers contained in a flag." msgstr "" -#: library/enum.rst:153 +#: library/enum.rst:157 msgid "``Flag``, ``IntFlag``, ``auto``" msgstr "" -#: library/enum.rst:154 +#: library/enum.rst:158 msgid "" "``StrEnum``, ``EnumCheck``, ``ReprEnum``, ``FlagBoundary``, ``property``, " "``member``, ``nonmember``, ``global_enum``, ``show_flag_values``" msgstr "" #: library/enum.rst:159 -msgid "Data Types" +msgid "``EnumDict``" msgstr "" #: library/enum.rst:164 +msgid "Data Types" +msgstr "" + +#: library/enum.rst:169 msgid "" "*EnumType* is the :term:`metaclass` for *enum* enumerations. It is possible " "to subclass *EnumType* -- see :ref:`Subclassing EnumType ` for details." msgstr "" -#: library/enum.rst:168 +#: library/enum.rst:173 +msgid "" +"``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" +"`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " +"final *enum*, as well as creating the enum members, properly handling " +"duplicates, providing iteration over the enum class, etc." +msgstr "" + +#: library/enum.rst:180 msgid "" -"*EnumType* is responsible for setting the correct :meth:`!__repr__`, :meth:`!" -"__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the final " -"*enum*, as well as creating the enum members, properly handling duplicates, " -"providing iteration over the enum class, etc." +"Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " +"as an alias." msgstr "" -#: library/enum.rst:175 +#: library/enum.rst:184 msgid "This method is called in two different ways:" msgstr "" -#: library/enum.rst:177 +#: library/enum.rst:186 msgid "to look up an existing member:" msgstr "" @@ -307,7 +340,7 @@ msgstr "" msgid "cls" msgstr "" -#: library/enum.rst:185 +#: library/enum.rst:194 msgid "The enum class being called." msgstr "" @@ -315,17 +348,17 @@ msgstr "" msgid "value" msgstr "" -#: library/enum.rst:180 +#: library/enum.rst:189 msgid "The value to lookup." msgstr "" -#: library/enum.rst:182 +#: library/enum.rst:191 msgid "" "to use the ``cls`` enum to create a new enum (only if the existing enum does " "not have any members):" msgstr "" -#: library/enum.rst:186 +#: library/enum.rst:195 msgid "The name of the new Enum to create." msgstr "" @@ -333,7 +366,7 @@ msgstr "" msgid "names" msgstr "" -#: library/enum.rst:187 +#: library/enum.rst:196 msgid "The names/values of the members for the new Enum." msgstr "" @@ -341,7 +374,7 @@ msgstr "" msgid "module" msgstr "" -#: library/enum.rst:188 +#: library/enum.rst:197 msgid "The name of the module the new Enum is created in." msgstr "" @@ -349,7 +382,7 @@ msgstr "" msgid "qualname" msgstr "" -#: library/enum.rst:189 +#: library/enum.rst:198 msgid "The actual location in the module where this Enum can be found." msgstr "" @@ -357,7 +390,7 @@ msgstr "" msgid "type" msgstr "" -#: library/enum.rst:190 +#: library/enum.rst:199 msgid "A mix-in type for the new Enum." msgstr "" @@ -365,7 +398,7 @@ msgstr "" msgid "start" msgstr "" -#: library/enum.rst:191 +#: library/enum.rst:200 msgid "The first integer value for the Enum (used by :class:`auto`)." msgstr "" @@ -373,81 +406,130 @@ msgstr "" msgid "boundary" msgstr "" -#: library/enum.rst:192 +#: library/enum.rst:201 msgid "" "How to handle out-of-range values from bit operations (:class:`Flag` only)." msgstr "" -#: library/enum.rst:196 +#: library/enum.rst:205 msgid "Returns ``True`` if member belongs to the ``cls``::" msgstr "" -#: library/enum.rst:206 +#: library/enum.rst:207 +msgid "" +">>> some_var = Color.RED\n" +">>> some_var in Color\n" +"True\n" +">>> Color.RED.value in Color\n" +"True" +msgstr "" + +#: library/enum.rst:215 msgid "" "Before Python 3.12, a ``TypeError`` is raised if a non-Enum-member is used " "in a containment check." msgstr "" -#: library/enum.rst:211 +#: library/enum.rst:220 msgid "" "Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the " "names of the members in *cls*::" msgstr "" -#: library/enum.rst:219 +#: library/enum.rst:223 +msgid "" +">>> dir(Color)\n" +"['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', " +"'__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', " +"'__module__', '__name__', '__qualname__']" +msgstr "" + +#: library/enum.rst:228 msgid "" "Returns the Enum member in *cls* matching *name*, or raises a :exc:" "`KeyError`::" msgstr "" -#: library/enum.rst:226 +#: library/enum.rst:230 +msgid "" +">>> Color['BLUE']\n" +"" +msgstr "" + +#: library/enum.rst:235 msgid "Returns each member in *cls* in definition order::" msgstr "" -#: library/enum.rst:233 +#: library/enum.rst:237 +msgid "" +">>> list(Color)\n" +"[, , ]" +msgstr "" + +#: library/enum.rst:242 msgid "Returns the number of member in *cls*::" msgstr "" -#: library/enum.rst:240 +#: library/enum.rst:244 +msgid "" +">>> len(Color)\n" +"3" +msgstr "" + +#: library/enum.rst:249 msgid "Returns a mapping of every enum name to its member, including aliases" msgstr "" -#: library/enum.rst:244 +#: library/enum.rst:253 msgid "Returns each member in *cls* in reverse definition order::" msgstr "" -#: library/enum.rst:251 -msgid "Before 3.11 ``enum`` used ``EnumMeta`` type, which is kept as an alias." +#: library/enum.rst:255 +msgid "" +">>> list(reversed(Color))\n" +"[, , ]" msgstr "" -#: library/enum.rst:256 +#: library/enum.rst:261 msgid "*Enum* is the base class for all *enum* enumerations." msgstr "" -#: library/enum.rst:260 +#: library/enum.rst:265 msgid "The name used to define the ``Enum`` member::" msgstr "" #: library/enum.rst:267 -msgid "The value given to the ``Enum`` member::" +msgid "" +">>> Color.BLUE.name\n" +"'BLUE'" msgstr "" -#: library/enum.rst:292 -msgid "Value of the member, can be set in :meth:`~object.__new__`." +#: library/enum.rst:272 +msgid "The value given to the ``Enum`` member::" msgstr "" #: library/enum.rst:274 +msgid "" +">>> Color.RED.value\n" +"1" +msgstr "" + +#: library/enum.rst:297 +msgid "Value of the member, can be set in :meth:`~Enum.__new__`." +msgstr "" + +#: library/enum.rst:279 msgid "Enum member values" msgstr "" -#: library/enum.rst:276 +#: library/enum.rst:281 msgid "" "Member values can be anything: :class:`int`, :class:`str`, etc. If the " "exact value is unimportant you may use :class:`auto` instances and an " "appropriate value will be chosen for you. See :class:`auto` for the details." msgstr "" -#: library/enum.rst:281 +#: library/enum.rst:286 msgid "" "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " "mutable :class:`~dataclasses.dataclass`, can be used, they will have a " @@ -455,44 +537,65 @@ msgid "" "mutable/unhashable values in the enum." msgstr "" -#: library/enum.rst:288 +#: library/enum.rst:293 msgid "Name of the member." msgstr "" -#: library/enum.rst:296 +#: library/enum.rst:301 msgid "" "No longer used, kept for backward compatibility. (class attribute, removed " "during class creation)." msgstr "" -#: library/enum.rst:301 +#: library/enum.rst:306 msgid "" "``_ignore_`` is only used during creation and is removed from the " "enumeration once creation is complete." msgstr "" -#: library/enum.rst:304 +#: library/enum.rst:309 msgid "" "``_ignore_`` is a list of names that will not become members, and whose " "names will also be removed from the completed enumeration. See :ref:" "`TimePeriod ` for an example." msgstr "" -#: library/enum.rst:310 +#: library/enum.rst:315 msgid "" "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " "public methods defined on *self.__class__*::" msgstr "" +#: library/enum.rst:318 +msgid "" +">>> from enum import Enum\n" +">>> from datetime import date\n" +">>> class Weekday(Enum):\n" +"... MONDAY = 1\n" +"... TUESDAY = 2\n" +"... WEDNESDAY = 3\n" +"... THURSDAY = 4\n" +"... FRIDAY = 5\n" +"... SATURDAY = 6\n" +"... SUNDAY = 7\n" +"... @classmethod\n" +"... def today(cls):\n" +"... print('today is %s' % cls(date.today().isoweekday()).name)\n" +"...\n" +">>> dir(Weekday.SATURDAY)\n" +"['__class__', '__doc__', '__eq__', '__hash__', '__module__', 'name', " +"'today', 'value']" +msgstr "" + #: library/enum.rst:0 msgid "name" msgstr "" -#: library/enum.rst:331 +#: library/enum.rst:337 msgid "The name of the member being defined (e.g. 'RED')." msgstr "" -#: library/enum.rst:332 +#: library/enum.rst:338 msgid "The start value for the Enum; the default is 1." msgstr "" @@ -500,7 +603,7 @@ msgstr "" msgid "count" msgstr "" -#: library/enum.rst:333 +#: library/enum.rst:339 msgid "The number of members currently defined, not including this one." msgstr "" @@ -508,458 +611,793 @@ msgstr "" msgid "last_values" msgstr "" -#: library/enum.rst:334 +#: library/enum.rst:340 msgid "A list of the previous values." msgstr "" -#: library/enum.rst:336 +#: library/enum.rst:342 msgid "" "A *staticmethod* that is used to determine the next value returned by :class:" "`auto`::" msgstr "" -#: library/enum.rst:352 +#: library/enum.rst:345 +msgid "" +">>> from enum import auto, Enum\n" +">>> class PowersOfThree(Enum):\n" +"... @staticmethod\n" +"... def _generate_next_value_(name, start, count, last_values):\n" +"... return 3 ** (count + 1)\n" +"... FIRST = auto()\n" +"... SECOND = auto()\n" +"...\n" +">>> PowersOfThree.SECOND.value\n" +"9" +msgstr "" + +#: library/enum.rst:358 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." msgstr "" -#: library/enum.rst:359 +#: library/enum.rst:365 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "" -#: library/enum.rst:363 +#: library/enum.rst:369 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "" -#: library/enum.rst:368 +#: library/enum.rst:374 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" msgstr "" -#: library/enum.rst:390 +#: library/enum.rst:377 +msgid "" +">>> from enum import auto, StrEnum\n" +">>> class Build(StrEnum):\n" +"... DEBUG = auto()\n" +"... OPTIMIZED = auto()\n" +"... @classmethod\n" +"... def _missing_(cls, value):\n" +"... value = value.lower()\n" +"... for member in cls:\n" +"... if member.value == value:\n" +"... return member\n" +"... return None\n" +"...\n" +">>> Build.DEBUG.value\n" +"'debug'\n" +">>> Build('deBUG')\n" +"" +msgstr "" + +#: library/enum.rst:396 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " "member assignment will be passed; e.g." msgstr "" -#: library/enum.rst:398 +#: library/enum.rst:404 msgid "" -"results in the call ``int('1a', 16)`` and a value of ``17`` for the member." +"results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "" -#: library/enum.rst:400 +#: library/enum.rst:408 msgid "" -"..note:: When writing a custom ``__new__``, do not use ``super().__new__`` --" +"When writing a custom ``__new__``, do not use ``super().__new__`` -- call " +"the appropriate ``__new__`` instead." msgstr "" -#: library/enum.rst:401 -msgid "call the appropriate ``__new__`` instead." -msgstr "" - -#: library/enum.rst:405 +#: library/enum.rst:413 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" msgstr "" -#: library/enum.rst:421 +#: library/enum.rst:416 +msgid "" +">>> from enum import auto, Enum\n" +">>> class OtherStyle(Enum):\n" +"... ALTERNATE = auto()\n" +"... OTHER = auto()\n" +"... SOMETHING_ELSE = auto()\n" +"... def __repr__(self):\n" +"... cls_name = self.__class__.__name__\n" +"... return f'{cls_name}.{self.name}'\n" +"...\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" +"(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" +msgstr "" + +#: library/enum.rst:430 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" msgstr "" -#: library/enum.rst:436 +#: library/enum.rst:433 +msgid "" +">>> from enum import auto, Enum\n" +">>> class OtherStyle(Enum):\n" +"... ALTERNATE = auto()\n" +"... OTHER = auto()\n" +"... SOMETHING_ELSE = auto()\n" +"... def __str__(self):\n" +"... return f'{self.name}'\n" +"...\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" +"(, 'ALTERNATE', 'ALTERNATE')" +msgstr "" + +#: library/enum.rst:446 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" msgstr "" -#: library/enum.rst:451 +#: library/enum.rst:449 +msgid "" +">>> from enum import auto, Enum\n" +">>> class OtherStyle(Enum):\n" +"... ALTERNATE = auto()\n" +"... OTHER = auto()\n" +"... SOMETHING_ELSE = auto()\n" +"... def __format__(self, spec):\n" +"... return f'{self.name}'\n" +"...\n" +">>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle." +"ALTERNATE}\"\n" +"(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" +msgstr "" + +#: library/enum.rst:462 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr "" -#: library/enum.rst:454 +#: library/enum.rst:465 msgid "Added :ref:`enum-dataclass-support`" msgstr "" -#: library/enum.rst:459 +#: library/enum.rst:469 +msgid "Adds a new name as an alias to an existing member::" +msgstr "" + +#: library/enum.rst:471 msgid "" -"*IntEnum* is the same as *Enum*, but its members are also integers and can " -"be used anywhere that an integer can be used. If any integer operation is " -"performed with an *IntEnum* member, the resulting value loses its " -"enumeration status." +">>> Color.RED._add_alias_(\"ERROR\")\n" +">>> Color.ERROR\n" +"" msgstr "" -#: library/enum.rst:480 +#: library/enum.rst:475 +msgid "" +"Raises a :exc:`NameError` if the name is already assigned to a different " +"member." +msgstr "" + +#: library/enum.rst:481 +msgid "Adds a new value as an alias to an existing member::" +msgstr "" + +#: library/enum.rst:483 +msgid "" +">>> Color.RED._add_value_alias_(42)\n" +">>> Color(42)\n" +"" +msgstr "" + +#: library/enum.rst:487 +msgid "" +"Raises a :exc:`ValueError` if the value is already linked with a different " +"member." +msgstr "" + +#: library/enum.rst:494 +msgid "" +"*IntEnum* is the same as :class:`Enum`, but its members are also integers " +"and can be used anywhere that an integer can be used. If any integer " +"operation is performed with an *IntEnum* member, the resulting value loses " +"its enumeration status." +msgstr "" + +#: library/enum.rst:515 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr "" -#: library/enum.rst:483 +#: library/enum.rst:518 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " "already :meth:`!int.__format__` for that same reason." msgstr "" -#: library/enum.rst:490 +#: library/enum.rst:525 msgid "" -"*StrEnum* is the same as *Enum*, but its members are also strings and can be " -"used in most of the same places that a string can be used. The result of " -"any string operation performed on or with a *StrEnum* member is not part of " -"the enumeration." +"*StrEnum* is the same as :class:`Enum`, but its members are also strings and " +"can be used in most of the same places that a string can be used. The result " +"of any string operation performed on or with a *StrEnum* member is not part " +"of the enumeration." msgstr "" -#: library/enum.rst:496 +#: library/enum.rst:546 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " "``isinstance(unknown, str)``), and in those locations you will need to use " -"``str(StrEnum.member)``." +"``str(MyStrEnum.MY_MEMBER)``." msgstr "" -#: library/enum.rst:503 +#: library/enum.rst:553 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr "" -#: library/enum.rst:508 +#: library/enum.rst:558 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " "likewise :meth:`!str.__format__` for that same reason." msgstr "" -#: library/enum.rst:516 +#: library/enum.rst:566 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " -"the results of those operators are members of the enumeration." +"the results of those operations are (aliases of) members of the enumeration." msgstr "" -#: library/enum.rst:522 +#: library/enum.rst:572 msgid "Returns *True* if value is in self::" msgstr "" -#: library/enum.rst:543 +#: library/enum.rst:574 +msgid "" +">>> from enum import Flag, auto\n" +">>> class Color(Flag):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"...\n" +">>> purple = Color.RED | Color.BLUE\n" +">>> white = Color.RED | Color.GREEN | Color.BLUE\n" +">>> Color.GREEN in purple\n" +"False\n" +">>> Color.GREEN in white\n" +"True\n" +">>> purple in white\n" +"True\n" +">>> white in purple\n" +"False" +msgstr "" + +#: library/enum.rst:593 msgid "Returns all contained non-alias members::" msgstr "" -#: library/enum.rst:554 +#: library/enum.rst:595 +msgid "" +">>> list(Color.RED)\n" +"[]\n" +">>> list(purple)\n" +"[, ]" +msgstr "" + +#: library/enum.rst:604 msgid "Returns number of members in flag::" msgstr "" -#: library/enum.rst:563 +#: library/enum.rst:606 +msgid "" +">>> len(Color.GREEN)\n" +"1\n" +">>> len(white)\n" +"3" +msgstr "" + +#: library/enum.rst:615 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "" -#: library/enum.rst:575 +#: library/enum.rst:617 +msgid "" +">>> bool(Color.GREEN)\n" +"True\n" +">>> bool(white)\n" +"True\n" +">>> black = Color(0)\n" +">>> bool(black)\n" +"False" +msgstr "" + +#: library/enum.rst:627 msgid "Returns current flag binary or'ed with other::" msgstr "" -#: library/enum.rst:582 +#: library/enum.rst:629 +msgid "" +">>> Color.RED | Color.GREEN\n" +"" +msgstr "" + +#: library/enum.rst:634 msgid "Returns current flag binary and'ed with other::" msgstr "" -#: library/enum.rst:591 +#: library/enum.rst:636 +msgid "" +">>> purple & white\n" +"\n" +">>> purple & Color.GREEN\n" +"" +msgstr "" + +#: library/enum.rst:643 msgid "Returns current flag binary xor'ed with other::" msgstr "" -#: library/enum.rst:600 -msgid "Returns all the flags in *type(self)* that are not in self::" +#: library/enum.rst:645 +msgid "" +">>> purple ^ white\n" +"\n" +">>> purple ^ Color.GREEN\n" +"" +msgstr "" + +#: library/enum.rst:652 +msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "" -#: library/enum.rst:611 +#: library/enum.rst:654 +msgid "" +">>> ~white\n" +"\n" +">>> ~purple\n" +"\n" +">>> ~Color.RED\n" +"" +msgstr "" + +#: library/enum.rst:663 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." msgstr "" -#: library/enum.rst:616 +#: library/enum.rst:668 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr "" -#: library/enum.rst:619 -msgid "The *repr()* of zero-valued flags has changed. It is now::" +#: library/enum.rst:671 +msgid "The *repr()* of zero-valued flags has changed. It is now:" msgstr "" -#: library/enum.rst:627 +#: library/enum.rst:679 msgid "" -"*IntFlag* is the same as *Flag*, but its members are also integers and can " -"be used anywhere that an integer can be used." +"``IntFlag`` is the same as :class:`Flag`, but its members are also integers " +"and can be used anywhere that an integer can be used." msgstr "" -#: library/enum.rst:641 +#: library/enum.rst:693 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "" -#: library/enum.rst:647 -msgid "If a *Flag* operation is performed with an *IntFlag* member and:" +#: library/enum.rst:696 +msgid "" +">>> Color.RED + 2\n" +"3" +msgstr "" + +#: library/enum.rst:699 +msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "" -#: library/enum.rst:649 +#: library/enum.rst:701 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "" -#: library/enum.rst:650 +#: library/enum.rst:702 msgid "" -"the result is not a valid *IntFlag*: the result depends on the " -"*FlagBoundary* setting" +"the result is not a valid *IntFlag*: the result depends on the :class:" +"`FlagBoundary` setting" msgstr "" -#: library/enum.rst:652 -msgid "The *repr()* of unnamed zero-valued flags has changed. It is now:" +#: library/enum.rst:704 +msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now::" +msgstr "" + +#: library/enum.rst:706 +msgid "" +">>> Color(0)\n" +"" msgstr "" -#: library/enum.rst:659 +#: library/enum.rst:711 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" -#: library/enum.rst:664 +#: library/enum.rst:716 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " "was already :meth:`!int.__format__` for that same reason." msgstr "" -#: library/enum.rst:668 +#: library/enum.rst:720 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " "matches the existing :class:`Flag` behavior." msgstr "" -#: library/enum.rst:674 +#: library/enum.rst:726 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" msgstr "" -#: library/enum.rst:677 +#: library/enum.rst:729 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "" -#: library/enum.rst:678 +#: library/enum.rst:730 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "" -#: library/enum.rst:680 +#: library/enum.rst:732 msgid "" "Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" "`format` of the mixed-in data type instead of using the :class:`Enum`-" "default :meth:`str() `." msgstr "" -#: library/enum.rst:689 +#: library/enum.rst:741 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." msgstr "" -#: library/enum.rst:694 +#: library/enum.rst:746 msgid "Ensure that each value has only one name::" msgstr "" -#: library/enum.rst:710 +#: library/enum.rst:748 +msgid "" +">>> from enum import Enum, verify, UNIQUE\n" +">>> @verify(UNIQUE)\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"... CRIMSON = 1\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: aliases found in : CRIMSON -> RED" +msgstr "" + +#: library/enum.rst:762 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "" -#: library/enum.rst:725 +#: library/enum.rst:765 +msgid "" +">>> from enum import Enum, verify, CONTINUOUS\n" +">>> @verify(CONTINUOUS)\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 5\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: invalid enum 'Color': missing values 3, 4" +msgstr "" + +#: library/enum.rst:777 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" msgstr "" -#: library/enum.rst:742 +#: library/enum.rst:780 +msgid "" +">>> from enum import Flag, verify, NAMED_FLAGS\n" +">>> @verify(NAMED_FLAGS)\n" +"... class Color(Flag):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 4\n" +"... WHITE = 15\n" +"... NEON = 31\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " +"combined values of 0x18 [use enum.show_flag_values(value) for details]" +msgstr "" + +#: library/enum.rst:794 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "" -#: library/enum.rst:748 +#: library/enum.rst:800 msgid "" -"*FlagBoundary* controls how out-of-range values are handled in *Flag* and " -"its subclasses." +"``FlagBoundary`` controls how out-of-range values are handled in :class:" +"`Flag` and its subclasses." msgstr "" -#: library/enum.rst:753 +#: library/enum.rst:805 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "" -#: library/enum.rst:771 +#: library/enum.rst:808 msgid "" -"Out-of-range values have invalid values removed, leaving a valid *Flag* " -"value::" +">>> from enum import Flag, STRICT, auto\n" +">>> class StrictFlag(Flag, boundary=STRICT):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"...\n" +">>> StrictFlag(2**2 + 2**4)\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: invalid value 20\n" +" given 0b0 10100\n" +" allowed 0b0 00111" msgstr "" -#: library/enum.rst:785 +#: library/enum.rst:823 msgid "" -"Out-of-range values lose their *Flag* membership and revert to :class:`int`." +"Out-of-range values have invalid values removed, leaving a valid :class:" +"`Flag` value::" msgstr "" -#: library/enum.rst:798 +#: library/enum.rst:826 msgid "" -"Out-of-range values are kept, and the *Flag* membership is kept. This is the " -"default for :class:`IntFlag`::" +">>> from enum import Flag, CONFORM, auto\n" +">>> class ConformFlag(Flag, boundary=CONFORM):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"...\n" +">>> ConformFlag(2**2 + 2**4)\n" +"" msgstr "" -#: library/enum.rst:815 +#: library/enum.rst:837 +msgid "" +"Out-of-range values lose their :class:`Flag` membership and revert to :class:" +"`int`." +msgstr "" + +#: library/enum.rst:850 +msgid "" +"Out-of-range values are kept, and the :class:`Flag` membership is kept. This " +"is the default for :class:`IntFlag`::" +msgstr "" + +#: library/enum.rst:853 +msgid "" +">>> from enum import Flag, KEEP, auto\n" +">>> class KeepFlag(Flag, boundary=KEEP):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"...\n" +">>> KeepFlag(2**2 + 2**4)\n" +"" +msgstr "" + +#: library/enum.rst:866 +msgid "" +"*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " +"defining enum classes (see :ref:`prepare`). It is exposed to allow " +"subclasses of :class:`EnumType` with advanced behavior like having multiple " +"values per member. It should be called with the name of the enum class being " +"created, otherwise private names and internal classes will not be handled " +"correctly." +msgstr "" + +#: library/enum.rst:873 +msgid "" +"Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:" +"`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be " +"possible to bypass the checks using other :class:`!dict` operations like :" +"meth:`|= `." +msgstr "" + +#: library/enum.rst:880 +msgid "A list of member names." +msgstr "" + +#: library/enum.rst:887 msgid "Supported ``__dunder__`` names" msgstr "" -#: library/enum.rst:817 +#: library/enum.rst:889 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." msgstr "" -#: library/enum.rst:820 +#: library/enum.rst:892 msgid "" -":meth:`~object.__new__`, if specified, must create and return the enum " +":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " -"appropriately. Once all the members are created it is no longer used." +"appropriately. Once all the members are created it is no longer used." msgstr "" -#: library/enum.rst:826 +#: library/enum.rst:898 msgid "Supported ``_sunder_`` names" msgstr "" -#: library/enum.rst:828 +#: library/enum.rst:900 msgid ":attr:`~Enum._name_` -- name of the member" msgstr "" -#: library/enum.rst:829 +#: library/enum.rst:901 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr "" -#: library/enum.rst:830 +#: library/enum.rst:902 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" -#: library/enum.rst:832 +#: library/enum.rst:904 msgid "" ":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" "class:`str`, that will not be transformed into members, and will be removed " "from the final class" msgstr "" -#: library/enum.rst:835 +#: library/enum.rst:907 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" msgstr "" -#: library/enum.rst:837 +#: library/enum.rst:909 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" -#: library/enum.rst:842 +#: library/enum.rst:914 msgid "" -"For standard :class:`Enum` classes the next value chosen is the last value " -"seen incremented by one." +"For standard :class:`Enum` classes the next value chosen is the highest " +"value seen incremented by one." msgstr "" -#: library/enum.rst:845 +#: library/enum.rst:917 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " -"power-of-two, regardless of the last value seen." +"power-of-two." +msgstr "" + +#: library/enum.rst:920 +msgid "" +":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " +"member." msgstr "" -#: library/enum.rst:848 +#: library/enum.rst:922 +msgid "" +":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " +"existing member." +msgstr "" + +#: library/enum.rst:925 +msgid "" +"While ``_sunder_`` names are generally reserved for the further development " +"of the :class:`Enum` class and can not be used, some are explicitly allowed:" +msgstr "" + +#: library/enum.rst:928 +msgid "" +"``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" +msgstr "" + +#: library/enum.rst:930 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "" -#: library/enum.rst:849 +#: library/enum.rst:931 msgid "``_ignore_``" msgstr "" -#: library/enum.rst:854 +#: library/enum.rst:932 +msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" +msgstr "" + +#: library/enum.rst:938 msgid "Utilities and Decorators" msgstr "" -#: library/enum.rst:858 +#: library/enum.rst:942 msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " -"call an *Enum*'s :meth:`~Enum._generate_next_value_` to get an appropriate " -"value. For *Enum* and *IntEnum* that appropriate value will be the last " -"value plus one; for *Flag* and *IntFlag* it will be the first power-of-two " -"greater than the highest value; for *StrEnum* it will be the lower-cased " -"version of the member's name. Care must be taken if mixing *auto()* with " -"manually specified values." +"call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " +"appropriate value. For :class:`Enum` and :class:`IntEnum` that appropriate " +"value will be the last value plus one; for :class:`Flag` and :class:" +"`IntFlag` it will be the first power-of-two greater than the highest value; " +"for :class:`StrEnum` it will be the lower-cased version of the member's " +"name. Care must be taken if mixing *auto()* with manually specified values." msgstr "" -#: library/enum.rst:866 +#: library/enum.rst:950 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "" -#: library/enum.rst:868 +#: library/enum.rst:952 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "" -#: library/enum.rst:869 +#: library/enum.rst:953 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" msgstr "" -#: library/enum.rst:871 +#: library/enum.rst:955 msgid "" "``THREE = [auto(), -3]`` will *not* work (``, -3`` is used to " "create the ``THREE`` enum member)" msgstr "" -#: library/enum.rst:876 +#: library/enum.rst:960 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "" -#: library/enum.rst:879 +#: library/enum.rst:963 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "" -#: library/enum.rst:882 +#: library/enum.rst:966 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " "incompatible type." msgstr "" -#: library/enum.rst:888 +#: library/enum.rst:972 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " "themselves." msgstr "" -#: library/enum.rst:892 +#: library/enum.rst:976 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -967,29 +1405,44 @@ msgid "" "``name``." msgstr "" -#: library/enum.rst:901 +#: library/enum.rst:985 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " "if any are found :exc:`ValueError` is raised with the details::" msgstr "" -#: library/enum.rst:919 +#: library/enum.rst:989 +msgid "" +">>> from enum import Enum, unique\n" +">>> @unique\n" +"... class Mistake(Enum):\n" +"... ONE = 1\n" +"... TWO = 2\n" +"... THREE = 3\n" +"... FOUR = 3\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: duplicate values found in : FOUR -> THREE" +msgstr "" + +#: library/enum.rst:1003 msgid "" "A :keyword:`class` decorator specifically for enumerations. Members from :" "class:`EnumCheck` are used to specify which constraints should be checked on " "the decorated enumeration." msgstr "" -#: library/enum.rst:927 +#: library/enum.rst:1011 msgid "A decorator for use in enums: its target will become a member." msgstr "" -#: library/enum.rst:933 +#: library/enum.rst:1017 msgid "A decorator for use in enums: its target will not become a member." msgstr "" -#: library/enum.rst:939 +#: library/enum.rst:1023 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -997,40 +1450,54 @@ msgid "" "namespace (see :class:`re.RegexFlag` for an example)." msgstr "" -#: library/enum.rst:949 +#: library/enum.rst:1033 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "" -#: library/enum.rst:956 +#: library/enum.rst:1040 msgid "Notes" msgstr "" -#: library/enum.rst:958 +#: library/enum.rst:1042 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr "" -#: library/enum.rst:960 +#: library/enum.rst:1044 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" msgstr "" -#: library/enum.rst:963 +#: library/enum.rst:1047 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "" -#: library/enum.rst:965 +#: library/enum.rst:1049 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "" -#: library/enum.rst:968 +#: library/enum.rst:1052 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" msgstr "" -#: library/enum.rst:975 +#: library/enum.rst:1055 +msgid "" +">>> from enum import Enum\n" +">>> class MyIntEnum(int, Enum):\n" +"... pass" +msgstr "" + +#: library/enum.rst:1059 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "" + +#: library/enum.rst:1061 +msgid "" +">>> from enum import Enum, IntEnum\n" +">>> class MyIntEnum(IntEnum):\n" +"... __str__ = Enum.__str__" +msgstr "" diff --git a/library/errno.po b/library/errno.po index b1af7cea..4817a9b4 100644 --- a/library/errno.po +++ b/library/errno.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/errno.rst:2 -msgid ":mod:`errno` --- Standard errno system symbols" +msgid ":mod:`!errno` --- Standard errno system symbols" msgstr "" #: library/errno.rst:9 @@ -536,67 +537,175 @@ msgid "No route to host" msgstr "" #: library/errno.rst:618 +msgid "Memory page has hardware error." +msgstr "" + +#: library/errno.rst:625 msgid "" "Operation already in progress. This error is mapped to the exception :exc:" "`BlockingIOError`." msgstr "" -#: library/errno.rst:624 +#: library/errno.rst:631 msgid "" "Operation now in progress. This error is mapped to the exception :exc:" "`BlockingIOError`." msgstr "" -#: library/errno.rst:630 +#: library/errno.rst:637 msgid "Stale NFS file handle" msgstr "" -#: library/errno.rst:635 +#: library/errno.rst:642 msgid "Structure needs cleaning" msgstr "" -#: library/errno.rst:640 +#: library/errno.rst:647 msgid "Not a XENIX named type file" msgstr "" -#: library/errno.rst:645 +#: library/errno.rst:652 msgid "No XENIX semaphores available" msgstr "" -#: library/errno.rst:650 +#: library/errno.rst:657 msgid "Is a named type file" msgstr "" -#: library/errno.rst:655 +#: library/errno.rst:662 msgid "Remote I/O error" msgstr "" -#: library/errno.rst:660 +#: library/errno.rst:667 msgid "Quota exceeded" msgstr "" -#: library/errno.rst:664 +#: library/errno.rst:671 msgid "Interface output queue is full" msgstr "" -#: library/errno.rst:670 +#: library/errno.rst:678 +msgid "No medium found" +msgstr "" + +#: library/errno.rst:683 +msgid "Wrong medium type" +msgstr "" + +#: library/errno.rst:688 +msgid "Required key not available" +msgstr "" + +#: library/errno.rst:693 +msgid "Key has expired" +msgstr "" + +#: library/errno.rst:698 +msgid "Key has been revoked" +msgstr "" + +#: library/errno.rst:703 +msgid "Key was rejected by service" +msgstr "" + +#: library/errno.rst:708 +msgid "Operation not possible due to RF-kill" +msgstr "" + +#: library/errno.rst:713 +msgid "Locked lock was unmapped" +msgstr "" + +#: library/errno.rst:718 +msgid "Facility is not active" +msgstr "" + +#: library/errno.rst:723 +msgid "Authentication error" +msgstr "" + +#: library/errno.rst:730 +msgid "Bad CPU type in executable" +msgstr "" + +#: library/errno.rst:737 +msgid "Bad executable (or shared library)" +msgstr "" + +#: library/errno.rst:744 +msgid "Malformed Mach-o file" +msgstr "" + +#: library/errno.rst:751 +msgid "Device error" +msgstr "" + +#: library/errno.rst:758 +msgid "Inappropriate file type or format" +msgstr "" + +#: library/errno.rst:765 +msgid "Need authenticator" +msgstr "" + +#: library/errno.rst:772 +msgid "Attribute not found" +msgstr "" + +#: library/errno.rst:779 +msgid "Policy not found" +msgstr "" + +#: library/errno.rst:786 +msgid "Too many processes" +msgstr "" + +#: library/errno.rst:793 +msgid "Bad procedure for program" +msgstr "" + +#: library/errno.rst:800 +msgid "Program version wrong" +msgstr "" + +#: library/errno.rst:807 +msgid "RPC prog. not avail" +msgstr "" + +#: library/errno.rst:814 +msgid "Device power is off" +msgstr "" + +#: library/errno.rst:821 +msgid "RPC struct is bad" +msgstr "" + +#: library/errno.rst:828 +msgid "RPC version wrong" +msgstr "" + +#: library/errno.rst:835 +msgid "Shared library version mismatch" +msgstr "" + +#: library/errno.rst:842 msgid "" "Capabilities insufficient. This error is mapped to the exception :exc:" "`PermissionError`." msgstr "" -#: library/errno.rst:673 -msgid ":ref:`Availability `: WASI, FreeBSD" +#: library/errno.rst:845 +msgid "Availability" msgstr "" -#: library/errno.rst:680 +#: library/errno.rst:852 msgid "Operation canceled" msgstr "" -#: library/errno.rst:687 +#: library/errno.rst:859 msgid "Owner died" msgstr "" -#: library/errno.rst:694 +#: library/errno.rst:866 msgid "State not recoverable" msgstr "" diff --git a/library/exceptions.po b/library/exceptions.po index 24081f98..a61cbf72 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -83,6 +84,10 @@ msgid "" "by using :keyword:`!from` with :keyword:`raise`::" msgstr "" +#: library/exceptions.rst:63 +msgid "raise new_exc from original_exc" +msgstr "" + #: library/exceptions.rst:65 msgid "" "The expression following :keyword:`from` must be an exception or " @@ -172,6 +177,15 @@ msgid "" "it to propagate to the caller. ::" msgstr "" +#: library/exceptions.rst:135 +msgid "" +"try:\n" +" ...\n" +"except SomeException:\n" +" tb = sys.exception().__traceback__\n" +" raise OtherException(...).with_traceback(tb)" +msgstr "" + #: library/exceptions.rst:143 msgid "" "A writable field that holds the :ref:`traceback object ` " @@ -238,28 +252,34 @@ msgstr "" #: library/exceptions.rst:207 msgid "" -"The :attr:`name` and :attr:`obj` attributes can be set using keyword-only " -"arguments to the constructor. When set they represent the name of the " -"attribute that was attempted to be accessed and the object that was accessed " -"for said attribute, respectively." +"The optional *name* and *obj* keyword-only arguments set the corresponding " +"attributes:" msgstr "" #: library/exceptions.rst:212 +msgid "The name of the attribute that was attempted to be accessed." +msgstr "" + +#: library/exceptions.rst:216 +msgid "The object that was accessed for the named attribute." +msgstr "" + +#: library/exceptions.rst:218 msgid "Added the :attr:`name` and :attr:`obj` attributes." msgstr "" -#: library/exceptions.rst:217 +#: library/exceptions.rst:223 msgid "" "Raised when the :func:`input` function hits an end-of-file condition (EOF) " -"without reading any data. (N.B.: the :meth:`io.IOBase.read` and :meth:`io." +"without reading any data. (Note: the :meth:`!io.IOBase.read` and :meth:`io." "IOBase.readline` methods return an empty string when they hit EOF.)" msgstr "" -#: library/exceptions.rst:224 +#: library/exceptions.rst:230 msgid "Not currently used." msgstr "" -#: library/exceptions.rst:229 +#: library/exceptions.rst:235 msgid "" "Raised when a :term:`generator` or :term:`coroutine` is closed; see :meth:" "`generator.close` and :meth:`coroutine.close`. It directly inherits from :" @@ -267,52 +287,52 @@ msgid "" "an error." msgstr "" -#: library/exceptions.rst:237 +#: library/exceptions.rst:243 msgid "" "Raised when the :keyword:`import` statement has troubles trying to load a " "module. Also raised when the \"from list\" in ``from ... import`` has a " "name that cannot be found." msgstr "" -#: library/exceptions.rst:241 +#: library/exceptions.rst:247 msgid "" "The optional *name* and *path* keyword-only arguments set the corresponding " "attributes:" msgstr "" -#: library/exceptions.rst:246 +#: library/exceptions.rst:252 msgid "The name of the module that was attempted to be imported." msgstr "" -#: library/exceptions.rst:250 +#: library/exceptions.rst:256 msgid "The path to any file which triggered the exception." msgstr "" -#: library/exceptions.rst:252 +#: library/exceptions.rst:258 msgid "Added the :attr:`name` and :attr:`path` attributes." msgstr "" -#: library/exceptions.rst:257 +#: library/exceptions.rst:263 msgid "" "A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a " "module could not be located. It is also raised when ``None`` is found in :" "data:`sys.modules`." msgstr "" -#: library/exceptions.rst:266 +#: library/exceptions.rst:272 msgid "" "Raised when a sequence subscript is out of range. (Slice indices are " "silently truncated to fall in the allowed range; if an index is not an " "integer, :exc:`TypeError` is raised.)" msgstr "" -#: library/exceptions.rst:275 +#: library/exceptions.rst:281 msgid "" "Raised when a mapping (dictionary) key is not found in the set of existing " "keys." msgstr "" -#: library/exceptions.rst:282 +#: library/exceptions.rst:288 msgid "" "Raised when the user hits the interrupt key (normally :kbd:`Control-C` or :" "kbd:`Delete`). During execution, a check for interrupts is made regularly. " @@ -321,7 +341,7 @@ msgid "" "the interpreter from exiting." msgstr "" -#: library/exceptions.rst:290 +#: library/exceptions.rst:296 msgid "" "Catching a :exc:`KeyboardInterrupt` requires special consideration. Because " "it can be raised at unpredictable points, it may, in some circumstances, " @@ -330,7 +350,7 @@ msgid "" "avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" msgstr "" -#: library/exceptions.rst:300 +#: library/exceptions.rst:306 msgid "" "Raised when an operation runs out of memory but the situation may still be " "rescued (by deleting some objects). The associated value is a string " @@ -341,25 +361,26 @@ msgid "" "stack traceback can be printed, in case a run-away program was the cause." msgstr "" -#: library/exceptions.rst:311 +#: library/exceptions.rst:317 msgid "" "Raised when a local or global name is not found. This applies only to " "unqualified names. The associated value is an error message that includes " "the name that could not be found." msgstr "" -#: library/exceptions.rst:315 -msgid "" -"The :attr:`name` attribute can be set using a keyword-only argument to the " -"constructor. When set it represent the name of the variable that was " -"attempted to be accessed." +#: library/exceptions.rst:321 +msgid "The optional *name* keyword-only argument sets the attribute:" +msgstr "" + +#: library/exceptions.rst:325 +msgid "The name of the variable that was attempted to be accessed." msgstr "" -#: library/exceptions.rst:319 +#: library/exceptions.rst:327 msgid "Added the :attr:`name` attribute." msgstr "" -#: library/exceptions.rst:325 +#: library/exceptions.rst:333 msgid "" "This exception is derived from :exc:`RuntimeError`. In user defined base " "classes, abstract methods should raise this exception when they require " @@ -367,28 +388,28 @@ msgid "" "developed to indicate that the real implementation still needs to be added." msgstr "" -#: library/exceptions.rst:332 +#: library/exceptions.rst:340 msgid "" "It should not be used to indicate that an operator or method is not meant to " "be supported at all -- in that case either leave the operator / method " "undefined or, if a subclass, set it to :data:`None`." msgstr "" -#: library/exceptions.rst:338 +#: library/exceptions.rst:346 msgid "" -"``NotImplementedError`` and :data:`NotImplemented` are not interchangeable, " -"even though they have similar names and purposes. See :data:`!" -"NotImplemented` for details on when to use it." +":exc:`!NotImplementedError` and :data:`!NotImplemented` are not " +"interchangeable. This exception should only be used as described above; see :" +"data:`NotImplemented` for details on correct usage of the built-in constant." msgstr "" -#: library/exceptions.rst:347 +#: library/exceptions.rst:357 msgid "" "This exception is raised when a system function returns a system-related " "error, including I/O failures such as \"file not found\" or \"disk " "full\" (not for illegal argument types or other incidental errors)." msgstr "" -#: library/exceptions.rst:351 +#: library/exceptions.rst:361 msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " @@ -397,7 +418,7 @@ msgid "" "constructor arguments." msgstr "" -#: library/exceptions.rst:357 +#: library/exceptions.rst:367 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " @@ -406,18 +427,18 @@ msgid "" "subclassing." msgstr "" -#: library/exceptions.rst:365 +#: library/exceptions.rst:375 msgid "A numeric error code from the C variable :c:data:`errno`." msgstr "" -#: library/exceptions.rst:369 +#: library/exceptions.rst:379 msgid "" "Under Windows, this gives you the native Windows error code. The :attr:`." "errno` attribute is then an approximate translation, in POSIX terms, of that " "native error code." msgstr "" -#: library/exceptions.rst:373 +#: library/exceptions.rst:383 msgid "" "Under Windows, if the *winerror* constructor argument is an integer, the :" "attr:`.errno` attribute is determined from the Windows error code, and the " @@ -425,14 +446,14 @@ msgid "" "ignored, and the :attr:`winerror` attribute does not exist." msgstr "" -#: library/exceptions.rst:381 +#: library/exceptions.rst:391 msgid "" "The corresponding error message, as provided by the operating system. It is " -"formatted by the C functions :c:func:`perror` under POSIX, and :c:func:" -"`FormatMessage` under Windows." +"formatted by the C functions :c:func:`!perror` under POSIX, and :c:func:`!" +"FormatMessage` under Windows." msgstr "" -#: library/exceptions.rst:389 +#: library/exceptions.rst:399 msgid "" "For exceptions that involve a file system path (such as :func:`open` or :" "func:`os.unlink`), :attr:`filename` is the file name passed to the function. " @@ -441,14 +462,14 @@ msgid "" "the function." msgstr "" -#: library/exceptions.rst:396 +#: library/exceptions.rst:406 msgid "" ":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." -"error`, :exc:`select.error` and :exc:`mmap.error` have been merged into :exc:" -"`OSError`, and the constructor may return a subclass." +"error`, :exc:`select.error` and :exc:`!mmap.error` have been merged into :" +"exc:`OSError`, and the constructor may return a subclass." msgstr "" -#: library/exceptions.rst:402 +#: library/exceptions.rst:412 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " "function, instead of the name encoded to or decoded from the :term:" @@ -456,28 +477,61 @@ msgid "" "argument and attribute was added." msgstr "" -#: library/exceptions.rst:411 +#: library/exceptions.rst:421 msgid "" "Raised when the result of an arithmetic operation is too large to be " "represented. This cannot occur for integers (which would rather raise :exc:" "`MemoryError` than give up). However, for historical reasons, OverflowError " "is sometimes raised for integers that are outside a required range. " -"Because of the lack of standardization of floating point exception handling " -"in C, most floating point operations are not checked." +"Because of the lack of standardization of floating-point exception handling " +"in C, most floating-point operations are not checked." msgstr "" -#: library/exceptions.rst:421 +#: library/exceptions.rst:431 msgid "" -"This exception is derived from :exc:`RuntimeError`. It is raised when the " -"interpreter detects that the maximum recursion depth (see :func:`sys." -"getrecursionlimit`) is exceeded." +"This exception is derived from :exc:`RuntimeError`. It is raised when an " +"operation is blocked during interpreter shutdown also known as :term:`Python " +"finalization `." +msgstr "" + +#: library/exceptions.rst:435 +msgid "" +"Examples of operations which can be blocked with a :exc:" +"`PythonFinalizationError` during the Python finalization:" +msgstr "" + +#: library/exceptions.rst:438 +msgid "Creating a new Python thread." +msgstr "" + +#: library/exceptions.rst:439 +msgid ":meth:`Joining ` a running daemon thread." msgstr "" -#: library/exceptions.rst:425 +#: library/exceptions.rst:440 +msgid ":func:`os.fork`." +msgstr "" + +#: library/exceptions.rst:442 +msgid "See also the :func:`sys.is_finalizing` function." +msgstr "" + +#: library/exceptions.rst:457 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "" -#: library/exceptions.rst:431 +#: library/exceptions.rst:449 +msgid ":meth:`threading.Thread.join` can now raise this exception." +msgstr "" + +#: library/exceptions.rst:453 +msgid "" +"This exception is derived from :exc:`RuntimeError`. It is raised when the " +"interpreter detects that the maximum recursion depth (see :func:`sys." +"getrecursionlimit`) is exceeded." +msgstr "" + +#: library/exceptions.rst:463 msgid "" "This exception is raised when a weak reference proxy, created by the :func:" "`weakref.proxy` function, is used to access an attribute of the referent " @@ -485,66 +539,66 @@ msgid "" "references, see the :mod:`weakref` module." msgstr "" -#: library/exceptions.rst:439 +#: library/exceptions.rst:471 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " "wrong." msgstr "" -#: library/exceptions.rst:446 +#: library/exceptions.rst:478 msgid "" "Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" "`~iterator.__next__` method to signal that there are no further items " "produced by the iterator." msgstr "" -#: library/exceptions.rst:452 +#: library/exceptions.rst:484 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " "as an argument when constructing the exception, and defaults to :const:" "`None`." msgstr "" -#: library/exceptions.rst:456 +#: library/exceptions.rst:488 msgid "" "When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" "`StopIteration` instance is raised, and the value returned by the function " "is used as the :attr:`value` parameter to the constructor of the exception." msgstr "" -#: library/exceptions.rst:461 +#: library/exceptions.rst:493 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " "as the new exception's cause)." msgstr "" -#: library/exceptions.rst:465 +#: library/exceptions.rst:497 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "" -#: library/exceptions.rst:469 +#: library/exceptions.rst:501 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." msgstr "" -#: library/exceptions.rst:473 +#: library/exceptions.rst:505 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." msgstr "" -#: library/exceptions.rst:479 +#: library/exceptions.rst:511 msgid "" "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." msgstr "" -#: library/exceptions.rst:486 +#: library/exceptions.rst:518 msgid "" "Raised when the parser encounters a syntax error. This may occur in an :" "keyword:`import` statement, in a call to the built-in functions :func:" @@ -552,45 +606,45 @@ msgid "" "or standard input (also interactively)." msgstr "" -#: library/exceptions.rst:492 +#: library/exceptions.rst:524 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." msgstr "" -#: library/exceptions.rst:497 +#: library/exceptions.rst:529 msgid "The name of the file the syntax error occurred in." msgstr "" -#: library/exceptions.rst:501 +#: library/exceptions.rst:533 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" -#: library/exceptions.rst:506 +#: library/exceptions.rst:538 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." msgstr "" -#: library/exceptions.rst:511 +#: library/exceptions.rst:543 msgid "The source code text involved in the error." msgstr "" -#: library/exceptions.rst:515 +#: library/exceptions.rst:547 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." msgstr "" -#: library/exceptions.rst:520 +#: library/exceptions.rst:552 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." msgstr "" -#: library/exceptions.rst:523 +#: library/exceptions.rst:555 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -598,39 +652,43 @@ msgid "" "attribute: ('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))." msgstr "" -#: library/exceptions.rst:528 +#: library/exceptions.rst:560 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "" -#: library/exceptions.rst:533 +#: library/exceptions.rst:565 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" -#: library/exceptions.rst:539 +#: library/exceptions.rst:571 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." msgstr "" -#: library/exceptions.rst:545 +#: library/exceptions.rst:577 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " -"a string indicating what went wrong (in low-level terms)." +"a string indicating what went wrong (in low-level terms). In :term:" +"`CPython`, this could be raised by incorrectly using Python's C API, such as " +"returning a ``NULL`` value without an exception set." msgstr "" -#: library/exceptions.rst:549 +#: library/exceptions.rst:583 msgid "" -"You should report this to the author or maintainer of your Python " -"interpreter. Be sure to report the version of the Python interpreter (``sys." -"version``; it is also printed at the start of an interactive Python " -"session), the exact error message (the exception's associated value) and if " -"possible the source of the program that triggered the error." +"If you're confident that this exception wasn't your fault, or the fault of a " +"package you're using, you should report this to the author or maintainer of " +"your Python interpreter. Be sure to report the version of the Python " +"interpreter (``sys.version``; it is also printed at the start of an " +"interactive Python session), the exact error message (the exception's " +"associated value) and if possible the source of the program that triggered " +"the error." msgstr "" -#: library/exceptions.rst:558 +#: library/exceptions.rst:594 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " @@ -639,12 +697,12 @@ msgid "" "it is not handled, the Python interpreter exits; no stack traceback is " "printed. The constructor accepts the same optional argument passed to :func:" "`sys.exit`. If the value is an integer, it specifies the system exit status " -"(passed to C's :c:func:`exit` function); if it is ``None``, the exit status " +"(passed to C's :c:func:`!exit` function); if it is ``None``, the exit status " "is zero; if it has another type (such as a string), the object's value is " "printed and the exit status is one." msgstr "" -#: library/exceptions.rst:569 +#: library/exceptions.rst:605 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -654,20 +712,20 @@ msgid "" "child process after a call to :func:`os.fork`)." msgstr "" -#: library/exceptions.rst:578 +#: library/exceptions.rst:614 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "" -#: library/exceptions.rst:584 +#: library/exceptions.rst:620 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " "the type mismatch." msgstr "" -#: library/exceptions.rst:587 +#: library/exceptions.rst:623 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -675,7 +733,7 @@ msgid "" "implementation, :exc:`NotImplementedError` is the proper exception to raise." msgstr "" -#: library/exceptions.rst:592 +#: library/exceptions.rst:628 msgid "" "Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" "class:`int` is expected) should result in a :exc:`TypeError`, but passing " @@ -683,99 +741,105 @@ msgid "" "should result in a :exc:`ValueError`." msgstr "" -#: library/exceptions.rst:599 +#: library/exceptions.rst:635 msgid "" "Raised when a reference is made to a local variable in a function or method, " "but no value has been bound to that variable. This is a subclass of :exc:" "`NameError`." msgstr "" -#: library/exceptions.rst:606 +#: library/exceptions.rst:642 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." msgstr "" -#: library/exceptions.rst:609 +#: library/exceptions.rst:645 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " "invalid input that the codec failed on." msgstr "" -#: library/exceptions.rst:615 +#: library/exceptions.rst:651 msgid "The name of the encoding that raised the error." msgstr "" -#: library/exceptions.rst:619 +#: library/exceptions.rst:655 msgid "A string describing the specific codec error." msgstr "" -#: library/exceptions.rst:623 +#: library/exceptions.rst:659 msgid "The object the codec was attempting to encode or decode." msgstr "" -#: library/exceptions.rst:627 +#: library/exceptions.rst:663 msgid "The first index of invalid data in :attr:`object`." msgstr "" -#: library/exceptions.rst:631 +#: library/exceptions.rst:672 +msgid "" +"This value should not be negative as it is interpreted as an absolute offset " +"but this constraint is not enforced at runtime." +msgstr "" + +#: library/exceptions.rst:670 msgid "The index after the last invalid data in :attr:`object`." msgstr "" -#: library/exceptions.rst:636 +#: library/exceptions.rst:678 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: library/exceptions.rst:642 +#: library/exceptions.rst:684 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: library/exceptions.rst:648 +#: library/exceptions.rst:690 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." msgstr "" -#: library/exceptions.rst:654 +#: library/exceptions.rst:696 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " "more precise exception such as :exc:`IndexError`." msgstr "" -#: library/exceptions.rst:661 +#: library/exceptions.rst:703 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " "operation." msgstr "" -#: library/exceptions.rst:666 +#: library/exceptions.rst:708 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." msgstr "" -#: library/exceptions.rst:675 +#: library/exceptions.rst:717 msgid "Only available on Windows." msgstr "" -#: library/exceptions.rst:679 +#: library/exceptions.rst:721 msgid "OS exceptions" msgstr "" -#: library/exceptions.rst:681 +#: library/exceptions.rst:723 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "" -#: library/exceptions.rst:686 +#: library/exceptions.rst:728 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" "blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno." @@ -783,36 +847,36 @@ msgid "" "const:`~errno.EINPROGRESS`." msgstr "" -#: library/exceptions.rst:691 +#: library/exceptions.rst:733 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" -#: library/exceptions.rst:696 +#: library/exceptions.rst:738 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " "from the :mod:`io` module." msgstr "" -#: library/exceptions.rst:702 +#: library/exceptions.rst:744 msgid "" "Raised when an operation on a child process failed. Corresponds to :c:data:" "`errno` :py:const:`~errno.ECHILD`." msgstr "" -#: library/exceptions.rst:707 +#: library/exceptions.rst:749 msgid "A base class for connection-related issues." msgstr "" -#: library/exceptions.rst:709 +#: library/exceptions.rst:751 msgid "" "Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" "`ConnectionRefusedError` and :exc:`ConnectionResetError`." msgstr "" -#: library/exceptions.rst:714 +#: library/exceptions.rst:756 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " @@ -820,58 +884,58 @@ msgid "" "`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." msgstr "" -#: library/exceptions.rst:721 +#: library/exceptions.rst:763 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." "ECONNABORTED`." msgstr "" -#: library/exceptions.rst:727 +#: library/exceptions.rst:769 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." "ECONNREFUSED`." msgstr "" -#: library/exceptions.rst:733 +#: library/exceptions.rst:775 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." msgstr "" -#: library/exceptions.rst:739 +#: library/exceptions.rst:781 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." msgstr "" -#: library/exceptions.rst:744 +#: library/exceptions.rst:786 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." msgstr "" -#: library/exceptions.rst:749 +#: library/exceptions.rst:791 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." msgstr "" -#: library/exceptions.rst:752 +#: library/exceptions.rst:794 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " "rationale), instead of raising :exc:`InterruptedError`." msgstr "" -#: library/exceptions.rst:759 +#: library/exceptions.rst:801 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." msgstr "" -#: library/exceptions.rst:765 +#: library/exceptions.rst:807 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " @@ -880,7 +944,7 @@ msgid "" "ENOTDIR`." msgstr "" -#: library/exceptions.rst:773 +#: library/exceptions.rst:815 msgid "" "Raised when trying to run an operation without the adequate access rights - " "for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:" @@ -888,130 +952,136 @@ msgid "" "ENOTCAPABLE`." msgstr "" -#: library/exceptions.rst:778 +#: library/exceptions.rst:820 msgid "" "WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:" "`PermissionError`." msgstr "" -#: library/exceptions.rst:784 +#: library/exceptions.rst:826 msgid "" "Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" "py:const:`~errno.ESRCH`." msgstr "" -#: library/exceptions.rst:789 +#: library/exceptions.rst:831 msgid "" "Raised when a system function timed out at the system level. Corresponds to :" "c:data:`errno` :py:const:`~errno.ETIMEDOUT`." msgstr "" -#: library/exceptions.rst:792 +#: library/exceptions.rst:834 msgid "All the above :exc:`OSError` subclasses were added." msgstr "" -#: library/exceptions.rst:798 +#: library/exceptions.rst:840 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr "" -#: library/exceptions.rst:804 +#: library/exceptions.rst:846 msgid "Warnings" msgstr "" -#: library/exceptions.rst:806 +#: library/exceptions.rst:848 msgid "" "The following exceptions are used as warning categories; see the :ref:" "`warning-categories` documentation for more details." msgstr "" -#: library/exceptions.rst:811 +#: library/exceptions.rst:853 msgid "Base class for warning categories." msgstr "" -#: library/exceptions.rst:816 +#: library/exceptions.rst:858 msgid "Base class for warnings generated by user code." msgstr "" -#: library/exceptions.rst:821 +#: library/exceptions.rst:863 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "" -#: library/exceptions.rst:824 +#: library/exceptions.rst:866 msgid "" "Ignored by the default warning filters, except in the ``__main__`` module (:" "pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " "warning." msgstr "" -#: library/exceptions.rst:844 +#: library/exceptions.rst:886 msgid "The deprecation policy is described in :pep:`387`." msgstr "" -#: library/exceptions.rst:833 +#: library/exceptions.rst:875 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "" -#: library/exceptions.rst:837 +#: library/exceptions.rst:879 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " "already active deprecations." msgstr "" -#: library/exceptions.rst:867 library/exceptions.rst:894 +#: library/exceptions.rst:912 library/exceptions.rst:939 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." msgstr "" -#: library/exceptions.rst:849 +#: library/exceptions.rst:891 msgid "Base class for warnings about dubious syntax." msgstr "" -#: library/exceptions.rst:854 +#: library/exceptions.rst:893 +msgid "" +"This warning is typically emitted when compiling Python source code, and " +"usually won't be reported when running already compiled code." +msgstr "" + +#: library/exceptions.rst:899 msgid "Base class for warnings about dubious runtime behavior." msgstr "" -#: library/exceptions.rst:859 +#: library/exceptions.rst:904 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." msgstr "" -#: library/exceptions.rst:865 +#: library/exceptions.rst:910 msgid "Base class for warnings about probable mistakes in module imports." msgstr "" -#: library/exceptions.rst:873 +#: library/exceptions.rst:918 msgid "Base class for warnings related to Unicode." msgstr "" -#: library/exceptions.rst:878 +#: library/exceptions.rst:923 msgid "Base class for warnings related to encodings." msgstr "" -#: library/exceptions.rst:880 +#: library/exceptions.rst:925 msgid "See :ref:`io-encoding-warning` for details." msgstr "" -#: library/exceptions.rst:887 +#: library/exceptions.rst:932 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr "" -#: library/exceptions.rst:892 +#: library/exceptions.rst:937 msgid "Base class for warnings related to resource usage." msgstr "" -#: library/exceptions.rst:903 +#: library/exceptions.rst:948 msgid "Exception groups" msgstr "" -#: library/exceptions.rst:905 +#: library/exceptions.rst:950 msgid "" "The following are used when it is necessary to raise multiple unrelated " "exceptions. They are part of the exception hierarchy so they can be handled " @@ -1020,7 +1090,7 @@ msgid "" "based on the types of the contained exceptions." msgstr "" -#: library/exceptions.rst:914 +#: library/exceptions.rst:959 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " @@ -1031,7 +1101,7 @@ msgid "" "exc:`BaseExceptionGroup`." msgstr "" -#: library/exceptions.rst:922 +#: library/exceptions.rst:967 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " "rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" @@ -1040,31 +1110,32 @@ msgid "" "`TypeError` if any contained exception is not an :exc:`Exception` subclass." msgstr "" -#: library/exceptions.rst:931 +#: library/exceptions.rst:976 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "" -#: library/exceptions.rst:935 +#: library/exceptions.rst:980 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "" -#: library/exceptions.rst:940 +#: library/exceptions.rst:985 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." msgstr "" -#: library/exceptions.rst:943 +#: library/exceptions.rst:988 msgid "" -"The condition can be either a function that accepts an exception and returns " -"true for those that should be in the subgroup, or it can be an exception " -"type or a tuple of exception types, which is used to check for a match using " -"the same check that is used in an ``except`` clause." +"The condition can be an exception type or tuple of exception types, in which " +"case each exception is checked for a match using the same check that is used " +"in an ``except`` clause. The condition can also be a callable (other than a " +"type object) that accepts an exception as its single argument and returns " +"true for the exceptions that should be in the subgroup." msgstr "" -#: library/exceptions.rst:948 +#: library/exceptions.rst:994 msgid "" "The nesting structure of the current exception is preserved in the result, " "as are the values of its :attr:`message`, :attr:`~BaseException." @@ -1073,34 +1144,39 @@ msgid "" "groups are omitted from the result." msgstr "" -#: library/exceptions.rst:955 +#: library/exceptions.rst:1001 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " "true for such an exception group, it is included in the result in full." msgstr "" -#: library/exceptions.rst:961 +#: library/exceptions.rst:1005 +msgid "``condition`` can be any callable which is not a type object." +msgstr "" + +#: library/exceptions.rst:1010 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" "matching part." msgstr "" -#: library/exceptions.rst:967 +#: library/exceptions.rst:1016 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "" -#: library/exceptions.rst:970 +#: library/exceptions.rst:1019 msgid "" -"This method is used by :meth:`subgroup` and :meth:`split`. A subclass needs " -"to override it in order to make :meth:`subgroup` and :meth:`split` return " +"This method is used by :meth:`subgroup` and :meth:`split`, which are used in " +"various contexts to break up an exception group. A subclass needs to " +"override it in order to make :meth:`subgroup` and :meth:`split` return " "instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" -#: library/exceptions.rst:975 +#: library/exceptions.rst:1025 msgid "" ":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." "__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." @@ -1109,30 +1185,143 @@ msgid "" "not need to be updated by :meth:`derive`." msgstr "" -#: library/exceptions.rst:1008 +#: library/exceptions.rst:1032 +msgid "" +">>> class MyGroup(ExceptionGroup):\n" +"... def derive(self, excs):\n" +"... return MyGroup(self.message, excs)\n" +"...\n" +">>> e = MyGroup(\"eg\", [ValueError(1), TypeError(2)])\n" +">>> e.add_note(\"a note\")\n" +">>> e.__context__ = Exception(\"context\")\n" +">>> e.__cause__ = Exception(\"cause\")\n" +">>> try:\n" +"... raise e\n" +"... except Exception as e:\n" +"... exc = e\n" +"...\n" +">>> match, rest = exc.split(ValueError)\n" +">>> exc, exc.__context__, exc.__cause__, exc.__notes__\n" +"(MyGroup('eg', [ValueError(1), TypeError(2)]), Exception('context'), " +"Exception('cause'), ['a note'])\n" +">>> match, match.__context__, match.__cause__, match.__notes__\n" +"(MyGroup('eg', [ValueError(1)]), Exception('context'), Exception('cause'), " +"['a note'])\n" +">>> rest, rest.__context__, rest.__cause__, rest.__notes__\n" +"(MyGroup('eg', [TypeError(2)]), Exception('context'), Exception('cause'), " +"['a note'])\n" +">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" +"True" +msgstr "" + +#: library/exceptions.rst:1058 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " "rather than :meth:`~object.__init__`. For example, the following defines an " -"exception group subclass which accepts an exit_code and and constructs the " +"exception group subclass which accepts an exit_code and constructs the " "group's message from it. ::" msgstr "" -#: library/exceptions.rst:1023 +#: library/exceptions.rst:1064 +msgid "" +"class Errors(ExceptionGroup):\n" +" def __new__(cls, errors, exit_code):\n" +" self = super().__new__(Errors, f\"exit code: {exit_code}\", errors)\n" +" self.exit_code = exit_code\n" +" return self\n" +"\n" +" def derive(self, excs):\n" +" return Errors(excs, self.exit_code)" +msgstr "" + +#: library/exceptions.rst:1073 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " "is also a subclass of :exc:`Exception` can only wrap instances of :exc:" "`Exception`." msgstr "" -#: library/exceptions.rst:1031 +#: library/exceptions.rst:1081 msgid "Exception hierarchy" msgstr "" -#: library/exceptions.rst:1033 +#: library/exceptions.rst:1083 msgid "The class hierarchy for built-in exceptions is:" msgstr "" +#: library/exceptions.rst:1085 +msgid "" +"BaseException\n" +" ├── BaseExceptionGroup\n" +" ├── GeneratorExit\n" +" ├── KeyboardInterrupt\n" +" ├── SystemExit\n" +" └── Exception\n" +" ├── ArithmeticError\n" +" │ ├── FloatingPointError\n" +" │ ├── OverflowError\n" +" │ └── ZeroDivisionError\n" +" ├── AssertionError\n" +" ├── AttributeError\n" +" ├── BufferError\n" +" ├── EOFError\n" +" ├── ExceptionGroup [BaseExceptionGroup]\n" +" ├── ImportError\n" +" │ └── ModuleNotFoundError\n" +" ├── LookupError\n" +" │ ├── IndexError\n" +" │ └── KeyError\n" +" ├── MemoryError\n" +" ├── NameError\n" +" │ └── UnboundLocalError\n" +" ├── OSError\n" +" │ ├── BlockingIOError\n" +" │ ├── ChildProcessError\n" +" │ ├── ConnectionError\n" +" │ │ ├── BrokenPipeError\n" +" │ │ ├── ConnectionAbortedError\n" +" │ │ ├── ConnectionRefusedError\n" +" │ │ └── ConnectionResetError\n" +" │ ├── FileExistsError\n" +" │ ├── FileNotFoundError\n" +" │ ├── InterruptedError\n" +" │ ├── IsADirectoryError\n" +" │ ├── NotADirectoryError\n" +" │ ├── PermissionError\n" +" │ ├── ProcessLookupError\n" +" │ └── TimeoutError\n" +" ├── ReferenceError\n" +" ├── RuntimeError\n" +" │ ├── NotImplementedError\n" +" │ ├── PythonFinalizationError\n" +" │ └── RecursionError\n" +" ├── StopAsyncIteration\n" +" ├── StopIteration\n" +" ├── SyntaxError\n" +" │ └── IndentationError\n" +" │ └── TabError\n" +" ├── SystemError\n" +" ├── TypeError\n" +" ├── ValueError\n" +" │ └── UnicodeError\n" +" │ ├── UnicodeDecodeError\n" +" │ ├── UnicodeEncodeError\n" +" │ └── UnicodeTranslateError\n" +" └── Warning\n" +" ├── BytesWarning\n" +" ├── DeprecationWarning\n" +" ├── EncodingWarning\n" +" ├── FutureWarning\n" +" ├── ImportWarning\n" +" ├── PendingDeprecationWarning\n" +" ├── ResourceWarning\n" +" ├── RuntimeWarning\n" +" ├── SyntaxWarning\n" +" ├── UnicodeWarning\n" +" └── UserWarning\n" +msgstr "" + #: library/exceptions.rst:17 library/exceptions.rst:196 msgid "statement" msgstr "" @@ -1173,10 +1362,10 @@ msgstr "" msgid "assert" msgstr "" -#: library/exceptions.rst:345 +#: library/exceptions.rst:355 msgid "module" msgstr "" -#: library/exceptions.rst:345 +#: library/exceptions.rst:355 msgid "errno" msgstr "" diff --git a/library/faulthandler.po b/library/faulthandler.po index b004df08..d62aba87 100644 --- a/library/faulthandler.po +++ b/library/faulthandler.po @@ -8,38 +8,39 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/faulthandler.rst:2 -msgid ":mod:`faulthandler` --- Dump the Python traceback" +msgid ":mod:`!faulthandler` --- Dump the Python traceback" msgstr "" #: library/faulthandler.rst:11 msgid "" "This module contains functions to dump Python tracebacks explicitly, on a " "fault, after a timeout, or on a user signal. Call :func:`faulthandler." -"enable` to install fault handlers for the :const:`SIGSEGV`, :const:" -"`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, and :const:`SIGILL` signals. " -"You can also enable them at startup by setting the :envvar:" -"`PYTHONFAULTHANDLER` environment variable or by using the :option:`-X` " -"``faulthandler`` command line option." +"enable` to install fault handlers for the :const:`~signal.SIGSEGV`, :const:" +"`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, and :" +"const:`~signal.SIGILL` signals. You can also enable them at startup by " +"setting the :envvar:`PYTHONFAULTHANDLER` environment variable or by using " +"the :option:`-X` ``faulthandler`` command line option." msgstr "" -#: library/faulthandler.rst:18 +#: library/faulthandler.rst:19 msgid "" "The fault handler is compatible with system fault handlers like Apport or " "the Windows fault handler. The module uses an alternative stack for signal " -"handlers if the :c:func:`sigaltstack` function is available. This allows it " +"handlers if the :c:func:`!sigaltstack` function is available. This allows it " "to dump the traceback even on a stack overflow." msgstr "" -#: library/faulthandler.rst:23 +#: library/faulthandler.rst:24 msgid "" "The fault handler is called on catastrophic cases and therefore can only use " "signal-safe functions (e.g. it cannot allocate memory on the heap). Because " @@ -47,44 +48,44 @@ msgid "" "tracebacks:" msgstr "" -#: library/faulthandler.rst:28 +#: library/faulthandler.rst:29 msgid "" "Only ASCII is supported. The ``backslashreplace`` error handler is used on " "encoding." msgstr "" -#: library/faulthandler.rst:30 +#: library/faulthandler.rst:31 msgid "Each string is limited to 500 characters." msgstr "" -#: library/faulthandler.rst:31 +#: library/faulthandler.rst:32 msgid "" "Only the filename, the function name and the line number are displayed. (no " "source code)" msgstr "" -#: library/faulthandler.rst:33 +#: library/faulthandler.rst:34 msgid "It is limited to 100 frames and 100 threads." msgstr "" -#: library/faulthandler.rst:34 +#: library/faulthandler.rst:35 msgid "The order is reversed: the most recent call is shown first." msgstr "" -#: library/faulthandler.rst:36 +#: library/faulthandler.rst:37 msgid "" "By default, the Python traceback is written to :data:`sys.stderr`. To see " "tracebacks, applications must be run in the terminal. A log file can " "alternatively be passed to :func:`faulthandler.enable`." msgstr "" -#: library/faulthandler.rst:40 +#: library/faulthandler.rst:41 msgid "" "The module is implemented in C, so tracebacks can be dumped on a crash or " "when Python is deadlocked." msgstr "" -#: library/faulthandler.rst:43 +#: library/faulthandler.rst:44 msgid "" "The :ref:`Python Development Mode ` calls :func:`faulthandler." "enable` at Python startup." @@ -94,144 +95,202 @@ msgstr "" msgid "Module :mod:`pdb`" msgstr "" -#: library/faulthandler.rst:49 +#: library/faulthandler.rst:50 msgid "Interactive source code debugger for Python programs." msgstr "" -#: library/faulthandler.rst:51 +#: library/faulthandler.rst:52 msgid "Module :mod:`traceback`" msgstr "" -#: library/faulthandler.rst:52 +#: library/faulthandler.rst:53 msgid "" "Standard interface to extract, format and print stack traces of Python " "programs." msgstr "" -#: library/faulthandler.rst:55 +#: library/faulthandler.rst:56 msgid "Dumping the traceback" msgstr "" -#: library/faulthandler.rst:59 +#: library/faulthandler.rst:60 msgid "" "Dump the tracebacks of all threads into *file*. If *all_threads* is " "``False``, dump only the current thread." msgstr "" -#: library/faulthandler.rst:62 +#: library/faulthandler.rst:63 msgid "" ":func:`traceback.print_tb`, which can be used to print a traceback object." msgstr "" -#: library/faulthandler.rst:82 library/faulthandler.rst:146 +#: library/faulthandler.rst:119 library/faulthandler.rst:190 msgid "Added support for passing file descriptor to this function." msgstr "" -#: library/faulthandler.rst:69 +#: library/faulthandler.rst:70 +msgid "Dumping the C stack" +msgstr "" + +#: library/faulthandler.rst:76 +msgid "Dump the C stack trace of the current thread into *file*." +msgstr "" + +#: library/faulthandler.rst:78 +msgid "" +"If the Python build does not support it or the operating system does not " +"provide a stack trace, then this prints an error in place of a dumped C " +"stack." +msgstr "" + +#: library/faulthandler.rst:85 +msgid "C Stack Compatibility" +msgstr "" + +#: library/faulthandler.rst:87 +msgid "" +"If the system does not support the C-level :manpage:`backtrace(3)` or :" +"manpage:`dladdr1(3)`, then C stack dumps will not work. An error will be " +"printed instead of the stack." +msgstr "" + +#: library/faulthandler.rst:91 +msgid "" +"Additionally, some compilers do not support :term:`CPython's ` " +"implementation of C stack dumps. As a result, a different error may be " +"printed instead of the stack, even if the operating system supports dumping " +"stacks." +msgstr "" + +#: library/faulthandler.rst:97 +msgid "" +"Dumping C stacks can be arbitrarily slow, depending on the DWARF level of " +"the binaries in the call stack." +msgstr "" + +#: library/faulthandler.rst:101 msgid "Fault handler state" msgstr "" -#: library/faulthandler.rst:73 +#: library/faulthandler.rst:105 msgid "" -"Enable the fault handler: install handlers for the :const:`SIGSEGV`, :const:" -"`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS` and :const:`SIGILL` signals to " -"dump the Python traceback. If *all_threads* is ``True``, produce tracebacks " -"for every running thread. Otherwise, dump only the current thread." +"Enable the fault handler: install handlers for the :const:`~signal." +"SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal." +"SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python traceback. If " +"*all_threads* is ``True``, produce tracebacks for every running thread. " +"Otherwise, dump only the current thread." msgstr "" -#: library/faulthandler.rst:79 +#: library/faulthandler.rst:112 msgid "" "The *file* must be kept open until the fault handler is disabled: see :ref:" "`issue with file descriptors `." msgstr "" -#: library/faulthandler.rst:85 +#: library/faulthandler.rst:115 +msgid "" +"If *c_stack* is ``True``, then the C stack trace is printed after the Python " +"traceback, unless the system does not support it. See :func:`dump_c_stack` " +"for more information on compatibility." +msgstr "" + +#: library/faulthandler.rst:122 msgid "On Windows, a handler for Windows exception is also installed." msgstr "" -#: library/faulthandler.rst:88 +#: library/faulthandler.rst:125 msgid "" "The dump now mentions if a garbage collector collection is running if " "*all_threads* is true." msgstr "" -#: library/faulthandler.rst:94 +#: library/faulthandler.rst:129 +msgid "" +"Only the current thread is dumped if the :term:`GIL` is disabled to prevent " +"the risk of data races." +msgstr "" + +#: library/faulthandler.rst:133 +msgid "The dump now displays the C stack trace if *c_stack* is true." +msgstr "" + +#: library/faulthandler.rst:138 msgid "" "Disable the fault handler: uninstall the signal handlers installed by :func:" "`enable`." msgstr "" -#: library/faulthandler.rst:99 +#: library/faulthandler.rst:143 msgid "Check if the fault handler is enabled." msgstr "" -#: library/faulthandler.rst:103 +#: library/faulthandler.rst:147 msgid "Dumping the tracebacks after a timeout" msgstr "" -#: library/faulthandler.rst:107 +#: library/faulthandler.rst:151 msgid "" "Dump the tracebacks of all threads, after a timeout of *timeout* seconds, or " "every *timeout* seconds if *repeat* is ``True``. If *exit* is ``True``, " -"call :c:func:`_exit` with status=1 after dumping the tracebacks. (Note :c:" -"func:`_exit` exits the process immediately, which means it doesn't do any " +"call :c:func:`!_exit` with status=1 after dumping the tracebacks. (Note :c:" +"func:`!_exit` exits the process immediately, which means it doesn't do any " "cleanup like flushing file buffers.) If the function is called twice, the " "new call replaces previous parameters and resets the timeout. The timer has " "a sub-second resolution." msgstr "" -#: library/faulthandler.rst:115 +#: library/faulthandler.rst:159 msgid "" "The *file* must be kept open until the traceback is dumped or :func:" "`cancel_dump_traceback_later` is called: see :ref:`issue with file " "descriptors `." msgstr "" -#: library/faulthandler.rst:119 +#: library/faulthandler.rst:163 msgid "This function is implemented using a watchdog thread." msgstr "" -#: library/faulthandler.rst:124 +#: library/faulthandler.rst:168 msgid "This function is now always available." msgstr "" -#: library/faulthandler.rst:129 +#: library/faulthandler.rst:173 msgid "Cancel the last call to :func:`dump_traceback_later`." msgstr "" -#: library/faulthandler.rst:133 +#: library/faulthandler.rst:177 msgid "Dumping the traceback on a user signal" msgstr "" -#: library/faulthandler.rst:137 +#: library/faulthandler.rst:181 msgid "" "Register a user signal: install a handler for the *signum* signal to dump " "the traceback of all threads, or of the current thread if *all_threads* is " "``False``, into *file*. Call the previous handler if chain is ``True``." msgstr "" -#: library/faulthandler.rst:141 +#: library/faulthandler.rst:185 msgid "" "The *file* must be kept open until the signal is unregistered by :func:" "`unregister`: see :ref:`issue with file descriptors `." msgstr "" -#: library/faulthandler.rst:155 +#: library/faulthandler.rst:199 msgid "Not available on Windows." msgstr "" -#: library/faulthandler.rst:151 +#: library/faulthandler.rst:195 msgid "" "Unregister a user signal: uninstall the handler of the *signum* signal " "installed by :func:`register`. Return ``True`` if the signal was registered, " "``False`` otherwise." msgstr "" -#: library/faulthandler.rst:161 +#: library/faulthandler.rst:205 msgid "Issue with file descriptors" msgstr "" -#: library/faulthandler.rst:163 +#: library/faulthandler.rst:207 msgid "" ":func:`enable`, :func:`dump_traceback_later` and :func:`register` keep the " "file descriptor of their *file* argument. If the file is closed and its file " @@ -240,12 +299,74 @@ msgid "" "Call these functions again each time that the file is replaced." msgstr "" -#: library/faulthandler.rst:171 +#: library/faulthandler.rst:215 msgid "Example" msgstr "" -#: library/faulthandler.rst:173 +#: library/faulthandler.rst:217 msgid "" "Example of a segmentation fault on Linux with and without enabling the fault " "handler:" msgstr "" + +#: library/faulthandler.rst:220 +msgid "" +"$ python -c \"import ctypes; ctypes.string_at(0)\"\n" +"Segmentation fault\n" +"\n" +"$ python -q -X faulthandler\n" +">>> import ctypes\n" +">>> ctypes.string_at(0)\n" +"Fatal Python error: Segmentation fault\n" +"\n" +"Current thread 0x00007fb899f39700 (most recent call first):\n" +" File \"/opt/python/Lib/ctypes/__init__.py\", line 486 in string_at\n" +" File \"\", line 1 in \n" +"\n" +"Current thread's C stack trace (most recent call first):\n" +" Binary file \"/opt/python/python\", at _Py_DumpStack+0x42 " +"[0x5b27f7d7147e]\n" +" Binary file \"/opt/python/python\", at +0x32dcbd [0x5b27f7d85cbd]\n" +" Binary file \"/opt/python/python\", at +0x32df8a [0x5b27f7d85f8a]\n" +" Binary file \"/usr/lib/libc.so.6\", at +0x3def0 [0x77b73226bef0]\n" +" Binary file \"/usr/lib/libc.so.6\", at +0x17ef9c [0x77b7323acf9c]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0xcdf6 [0x77b7315dddf6]\n" +" Binary file \"/usr/lib/libffi.so.8\", at +0x7976 [0x77b73158f976]\n" +" Binary file \"/usr/lib/libffi.so.8\", at +0x413c [0x77b73158c13c]\n" +" Binary file \"/usr/lib/libffi.so.8\", at ffi_call+0x12e [0x77b73158ef0e]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0x15a33 [0x77b7315e6a33]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0x164fa [0x77b7315e74fa]\n" +" Binary file \"/opt/python/build/lib.linux-x86_64-3.14/_ctypes.cpython-314d-" +"x86_64-linux-gnu.so\", at +0xc624 [0x77b7315dd624]\n" +" Binary file \"/opt/python/python\", at _PyObject_MakeTpCall+0xce " +"[0x5b27f7b73883]\n" +" Binary file \"/opt/python/python\", at +0x11bab6 [0x5b27f7b73ab6]\n" +" Binary file \"/opt/python/python\", at PyObject_Vectorcall+0x23 " +"[0x5b27f7b73b04]\n" +" Binary file \"/opt/python/python\", at _PyEval_EvalFrameDefault+0x490c " +"[0x5b27f7cbb302]\n" +" Binary file \"/opt/python/python\", at +0x2818e6 [0x5b27f7cd98e6]\n" +" Binary file \"/opt/python/python\", at +0x281aab [0x5b27f7cd9aab]\n" +" Binary file \"/opt/python/python\", at PyEval_EvalCode+0xc5 " +"[0x5b27f7cd9ba3]\n" +" Binary file \"/opt/python/python\", at +0x255957 [0x5b27f7cad957]\n" +" Binary file \"/opt/python/python\", at +0x255ab4 [0x5b27f7cadab4]\n" +" Binary file \"/opt/python/python\", at _PyEval_EvalFrameDefault+0x6c3e " +"[0x5b27f7cbd634]\n" +" Binary file \"/opt/python/python\", at +0x2818e6 [0x5b27f7cd98e6]\n" +" Binary file \"/opt/python/python\", at +0x281aab [0x5b27f7cd9aab]\n" +" Binary file \"/opt/python/python\", at +0x11b6e1 [0x5b27f7b736e1]\n" +" Binary file \"/opt/python/python\", at +0x11d348 [0x5b27f7b75348]\n" +" Binary file \"/opt/python/python\", at +0x11d626 [0x5b27f7b75626]\n" +" Binary file \"/opt/python/python\", at PyObject_Call+0x20 " +"[0x5b27f7b7565e]\n" +" Binary file \"/opt/python/python\", at +0x32a67a [0x5b27f7d8267a]\n" +" Binary file \"/opt/python/python\", at +0x32a7f8 [0x5b27f7d827f8]\n" +" Binary file \"/opt/python/python\", at +0x32ac1b [0x5b27f7d82c1b]\n" +" Binary file \"/opt/python/python\", at Py_RunMain+0x31 [0x5b27f7d82ebe]\n" +" \n" +"Segmentation fault" +msgstr "" diff --git a/library/fcntl.po b/library/fcntl.po index 49f5aaa4..a10bf646 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/fcntl.rst:2 -msgid ":mod:`fcntl` --- The ``fcntl`` and ``ioctl`` system calls" +msgid ":mod:`!fcntl` --- The ``fcntl`` and ``ioctl`` system calls" msgstr "" #: library/fcntl.rst:16 @@ -29,7 +30,7 @@ msgid "" msgstr "" #: library/fcntl.rst:21 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +msgid "Availability" msgstr "" #: library/fcntl.rst:23 @@ -49,29 +50,30 @@ msgstr "" #: library/fcntl.rst:33 msgid "" -"The fcntl module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " +"The :mod:`!fcntl` module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " "``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file " "descriptors." msgstr "" #: library/fcntl.rst:38 msgid "" -"On macOS, the fcntl module exposes the ``F_GETPATH`` constant, which obtains " -"the path of a file from a file descriptor. On Linux(>=3.15), the fcntl " -"module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and ``F_OFD_SETLKW`` " -"constants, which are used when working with open file description locks." +"On macOS, the :mod:`!fcntl` module exposes the ``F_GETPATH`` constant, which " +"obtains the path of a file from a file descriptor. On Linux(>=3.15), the :" +"mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and " +"``F_OFD_SETLKW`` constants, which are used when working with open file " +"description locks." msgstr "" #: library/fcntl.rst:45 msgid "" -"On Linux >= 2.6.11, the fcntl module exposes the ``F_GETPIPE_SZ`` and " -"``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's size " -"respectively." +"On Linux >= 2.6.11, the :mod:`!fcntl` module exposes the ``F_GETPIPE_SZ`` " +"and ``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's " +"size respectively." msgstr "" #: library/fcntl.rst:50 msgid "" -"On FreeBSD, the fcntl module exposes the ``F_DUP2FD`` and " +"On FreeBSD, the :mod:`!fcntl` module exposes the ``F_DUP2FD`` and " "``F_DUP2FD_CLOEXEC`` constants, which allow to duplicate a file descriptor, " "the latter setting ``FD_CLOEXEC`` flag in addition." msgstr "" @@ -85,106 +87,175 @@ msgid "" msgstr "" #: library/fcntl.rst:61 +msgid "" +"On Linux >= 2.6.32, the :mod:`!fcntl` module exposes the ``F_GETOWN_EX``, " +"``F_SETOWN_EX``, ``F_OWNER_TID``, ``F_OWNER_PID``, ``F_OWNER_PGRP`` " +"constants, which allow to direct I/O availability signals to a specific " +"thread, process, or process group. On Linux >= 4.13, the :mod:`!fcntl` " +"module exposes the ``F_GET_RW_HINT``, ``F_SET_RW_HINT``, " +"``F_GET_FILE_RW_HINT``, ``F_SET_FILE_RW_HINT``, and ``RWH_WRITE_LIFE_*`` " +"constants, which allow to inform the kernel about the relative expected " +"lifetime of writes on a given inode or via a particular open file " +"description. On Linux >= 5.1 and NetBSD, the :mod:`!fcntl` module exposes " +"the ``F_SEAL_FUTURE_WRITE`` constant for use with ``F_ADD_SEALS`` and " +"``F_GET_SEALS`` operations. On FreeBSD, the :mod:`!fcntl` module exposes the " +"``F_READAHEAD``, ``F_ISUNIONSTACK``, and ``F_KINFO`` constants. On macOS and " +"FreeBSD, the :mod:`!fcntl` module exposes the ``F_RDAHEAD`` constant. On " +"NetBSD and AIX, the :mod:`!fcntl` module exposes the ``F_CLOSEM`` constant. " +"On NetBSD, the :mod:`!fcntl` module exposes the ``F_MAXFD`` constant. On " +"macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE`` " +"and ``F_SETNOSIGPIPE`` constant." +msgstr "" + +#: library/fcntl.rst:82 +msgid "" +"On Linux >= 6.1, the :mod:`!fcntl` module exposes the ``F_DUPFD_QUERY`` to " +"query a file descriptor pointing to the same file." +msgstr "" + +#: library/fcntl.rst:86 msgid "The module defines the following functions:" msgstr "" -#: library/fcntl.rst:66 +#: library/fcntl.rst:91 msgid "" "Perform the operation *cmd* on file descriptor *fd* (file objects providing " "a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " "for *cmd* are operating system dependent, and are available as constants in " "the :mod:`fcntl` module, using the same names as used in the relevant C " -"header files. The argument *arg* can either be an integer value, or a :class:" -"`bytes` object. With an integer value, the return value of this function is " -"the integer return value of the C :c:func:`fcntl` call. When the argument " -"is bytes it represents a binary structure, e.g. created by :func:`struct." -"pack`. The binary data is copied to a buffer whose address is passed to the " -"C :c:func:`fcntl` call. The return value after a successful call is the " -"contents of the buffer, converted to a :class:`bytes` object. The length of " -"the returned object will be the same as the length of the *arg* argument. " -"This is limited to 1024 bytes. If the information returned in the buffer by " -"the operating system is larger than 1024 bytes, this is most likely to " -"result in a segmentation violation or a more subtle data corruption." -msgstr "" - -#: library/fcntl.rst:83 +"header files. The argument *arg* can either be an integer value, a :term:" +"`bytes-like object`, or a string. The type and size of *arg* must match the " +"type and size of the argument of the operation as specified in the relevant " +"C documentation." +msgstr "" + +#: library/fcntl.rst:100 +msgid "" +"When *arg* is an integer, the function returns the integer return value of " +"the C :c:func:`fcntl` call." +msgstr "" + +#: library/fcntl.rst:103 +msgid "" +"When the argument is bytes-like object, it represents a binary structure, " +"for example, created by :func:`struct.pack`. A string value is encoded to " +"binary using the UTF-8 encoding. The binary data is copied to a buffer whose " +"address is passed to the C :c:func:`fcntl` call. The return value after a " +"successful call is the contents of the buffer, converted to a :class:`bytes` " +"object. The length of the returned object will be the same as the length of " +"the *arg* argument. This is limited to 1024 bytes." +msgstr "" + +#: library/fcntl.rst:112 msgid "If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised." msgstr "" -#: library/fcntl.rst:85 +#: library/fcntl.rst:115 +msgid "" +"If the type or the size of *arg* does not match the type or size of the " +"argument of the operation (for example, if an integer is passed when a " +"pointer is expected, or the information returned in the buffer by the " +"operating system is larger than 1024 bytes), this is most likely to result " +"in a segmentation violation or a more subtle data corruption." +msgstr "" + +#: library/fcntl.rst:122 msgid "" "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " "``fd``, ``cmd``, ``arg``." msgstr "" -#: library/fcntl.rst:90 +#: library/fcntl.rst:124 msgid "" -"This function is identical to the :func:`~fcntl.fcntl` function, except that " -"the argument handling is even more complicated." +"Add support of arbitrary :term:`bytes-like objects `, not " +"only :class:`bytes`." msgstr "" -#: library/fcntl.rst:93 +#: library/fcntl.rst:131 msgid "" -"The *request* parameter is limited to values that can fit in 32-bits. " -"Additional constants of interest for use as the *request* argument can be " -"found in the :mod:`termios` module, under the same names as used in the " -"relevant C header files." +"This function is identical to the :func:`~fcntl.fcntl` function, except that " +"the argument handling is even more complicated." msgstr "" -#: library/fcntl.rst:98 +#: library/fcntl.rst:134 msgid "" -"The parameter *arg* can be one of an integer, an object supporting the read-" -"only buffer interface (like :class:`bytes`) or an object supporting the read-" -"write buffer interface (like :class:`bytearray`)." +"The *request* parameter is limited to values that can fit in 32-bits or 64-" +"bits, depending on the platform. Additional constants of interest for use as " +"the *request* argument can be found in the :mod:`termios` module, under the " +"same names as used in the relevant C header files." msgstr "" -#: library/fcntl.rst:102 +#: library/fcntl.rst:140 msgid "" -"In all but the last case, behaviour is as for the :func:`~fcntl.fcntl` " -"function." +"The parameter *arg* can be an integer, a :term:`bytes-like object`, or a " +"string. The type and size of *arg* must match the type and size of the " +"argument of the operation as specified in the relevant C documentation." msgstr "" -#: library/fcntl.rst:105 +#: library/fcntl.rst:145 msgid "" -"If a mutable buffer is passed, then the behaviour is determined by the value " -"of the *mutate_flag* parameter." +"If *arg* does not support the read-write buffer interface or the " +"*mutate_flag* is false, behavior is as for the :func:`~fcntl.fcntl` function." msgstr "" -#: library/fcntl.rst:108 +#: library/fcntl.rst:149 msgid "" -"If it is false, the buffer's mutability is ignored and behaviour is as for a " -"read-only buffer, except that the 1024 byte limit mentioned above is avoided " -"-- so long as the buffer you pass is at least as long as what the operating " -"system wants to put there, things should work." +"If *arg* supports the read-write buffer interface (like :class:`bytearray`) " +"and *mutate_flag* is true (the default), then the buffer is (in effect) " +"passed to the underlying :c:func:`!ioctl` system call, the latter's return " +"code is passed back to the calling Python, and the buffer's new contents " +"reflect the action of the :c:func:`ioctl`. This is a slight simplification, " +"because if the supplied buffer is less than 1024 bytes long it is first " +"copied into a static buffer 1024 bytes long which is then passed to :func:" +"`ioctl` and copied back into the supplied buffer." msgstr "" -#: library/fcntl.rst:113 +#: library/fcntl.rst:158 msgid "" -"If *mutate_flag* is true (the default), then the buffer is (in effect) " -"passed to the underlying :func:`ioctl` system call, the latter's return code " -"is passed back to the calling Python, and the buffer's new contents reflect " -"the action of the :func:`ioctl`. This is a slight simplification, because " -"if the supplied buffer is less than 1024 bytes long it is first copied into " -"a static buffer 1024 bytes long which is then passed to :func:`ioctl` and " -"copied back into the supplied buffer." +"If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: library/fcntl.rst:121 +#: library/fcntl.rst:161 msgid "" -"If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." +"If the type or size of *arg* does not match the type or size of the " +"operation's argument (for example, if an integer is passed when a pointer is " +"expected, or the information returned in the buffer by the operating system " +"is larger than 1024 bytes, or the size of the mutable bytes-like object is " +"too small), this is most likely to result in a segmentation violation or a " +"more subtle data corruption." msgstr "" -#: library/fcntl.rst:123 +#: library/fcntl.rst:169 msgid "An example::" msgstr "" -#: library/fcntl.rst:136 +#: library/fcntl.rst:171 +msgid "" +">>> import array, fcntl, struct, termios, os\n" +">>> os.getpgrp()\n" +"13341\n" +">>> struct.unpack('h', fcntl.ioctl(0, termios.TIOCGPGRP, \" \"))[0]\n" +"13341\n" +">>> buf = array.array('h', [0])\n" +">>> fcntl.ioctl(0, termios.TIOCGPGRP, buf, 1)\n" +"0\n" +">>> buf\n" +"array('h', [13341])" +msgstr "" + +#: library/fcntl.rst:182 msgid "" "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " "``fd``, ``request``, ``arg``." msgstr "" -#: library/fcntl.rst:141 +#: library/fcntl.rst:184 +msgid "" +"The GIL is always released during a system call. System calls failing with " +"EINTR are automatically retried." +msgstr "" + +#: library/fcntl.rst:190 msgid "" "Perform the lock operation *operation* on file descriptor *fd* (file objects " "providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the " @@ -192,18 +263,18 @@ msgid "" "function is emulated using :c:func:`fcntl`.)" msgstr "" -#: library/fcntl.rst:146 +#: library/fcntl.rst:195 msgid "" "If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: library/fcntl.rst:148 +#: library/fcntl.rst:197 msgid "" "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " "``fd``, ``operation``." msgstr "" -#: library/fcntl.rst:153 +#: library/fcntl.rst:202 msgid "" "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " "*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase." @@ -211,25 +282,25 @@ msgid "" "*cmd* is one of the following values:" msgstr "" -#: library/fcntl.rst:160 +#: library/fcntl.rst:209 msgid "Release an existing lock." msgstr "" -#: library/fcntl.rst:164 +#: library/fcntl.rst:213 msgid "Acquire a shared lock." msgstr "" -#: library/fcntl.rst:168 +#: library/fcntl.rst:217 msgid "Acquire an exclusive lock." msgstr "" -#: library/fcntl.rst:172 +#: library/fcntl.rst:221 msgid "" "Bitwise OR with any of the other three ``LOCK_*`` constants to make the " "request non-blocking." msgstr "" -#: library/fcntl.rst:175 +#: library/fcntl.rst:224 msgid "" "If :const:`!LOCK_NB` is used and the lock cannot be acquired, an :exc:" "`OSError` will be raised and the exception will have an *errno* attribute " @@ -239,43 +310,54 @@ msgid "" "a file opened for writing." msgstr "" -#: library/fcntl.rst:182 +#: library/fcntl.rst:231 msgid "" "*len* is the number of bytes to lock, *start* is the byte offset at which " "the lock starts, relative to *whence*, and *whence* is as with :func:`io." "IOBase.seek`, specifically:" msgstr "" -#: library/fcntl.rst:186 +#: library/fcntl.rst:235 msgid "``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)" msgstr "" -#: library/fcntl.rst:187 +#: library/fcntl.rst:236 msgid "``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)" msgstr "" -#: library/fcntl.rst:188 +#: library/fcntl.rst:237 msgid "``2`` -- relative to the end of the file (:const:`os.SEEK_END`)" msgstr "" -#: library/fcntl.rst:190 +#: library/fcntl.rst:239 msgid "" "The default for *start* is 0, which means to start at the beginning of the " "file. The default for *len* is 0 which means to lock to the end of the " "file. The default for *whence* is also 0." msgstr "" -#: library/fcntl.rst:194 +#: library/fcntl.rst:243 msgid "" "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " "``fd``, ``cmd``, ``len``, ``start``, ``whence``." msgstr "" -#: library/fcntl.rst:196 +#: library/fcntl.rst:245 msgid "Examples (all on a SVR4 compliant system)::" msgstr "" -#: library/fcntl.rst:206 +#: library/fcntl.rst:247 +msgid "" +"import struct, fcntl, os\n" +"\n" +"f = open(...)\n" +"rv = fcntl.fcntl(f, fcntl.F_SETFL, os.O_NDELAY)\n" +"\n" +"lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)\n" +"rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" +msgstr "" + +#: library/fcntl.rst:255 msgid "" "Note that in the first example the return value variable *rv* will hold an " "integer value; in the second example it will hold a :class:`bytes` object. " @@ -283,11 +365,11 @@ msgid "" "therefore using the :func:`flock` call may be better." msgstr "" -#: library/fcntl.rst:217 +#: library/fcntl.rst:263 msgid "Module :mod:`os`" msgstr "" -#: library/fcntl.rst:215 +#: library/fcntl.rst:264 msgid "" "If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are " "present in the :mod:`os` module (on BSD only), the :func:`os.open` function " diff --git a/library/filecmp.po b/library/filecmp.po index 05263e55..2531cddb 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/filecmp.rst:2 -msgid ":mod:`filecmp` --- File and Directory Comparisons" +msgid ":mod:`!filecmp` --- File and Directory Comparisons" msgstr "" #: library/filecmp.rst:9 @@ -118,119 +119,137 @@ msgstr "" #: library/filecmp.rst:80 msgid "" "The :class:`dircmp` class compares files by doing *shallow* comparisons as " -"described for :func:`filecmp.cmp`." +"described for :func:`filecmp.cmp` by default using the *shallow* parameter." msgstr "" -#: library/filecmp.rst:83 +#: library/filecmp.rst:86 +msgid "Added the *shallow* parameter." +msgstr "" + +#: library/filecmp.rst:88 msgid "The :class:`dircmp` class provides the following methods:" msgstr "" -#: library/filecmp.rst:87 +#: library/filecmp.rst:92 msgid "Print (to :data:`sys.stdout`) a comparison between *a* and *b*." msgstr "" -#: library/filecmp.rst:91 +#: library/filecmp.rst:96 msgid "" "Print a comparison between *a* and *b* and common immediate subdirectories." msgstr "" -#: library/filecmp.rst:96 +#: library/filecmp.rst:101 msgid "" "Print a comparison between *a* and *b* and common subdirectories " "(recursively)." msgstr "" -#: library/filecmp.rst:99 +#: library/filecmp.rst:104 msgid "" "The :class:`dircmp` class offers a number of interesting attributes that may " "be used to get various bits of information about the directory trees being " "compared." msgstr "" -#: library/filecmp.rst:103 +#: library/filecmp.rst:108 msgid "" "Note that via :meth:`~object.__getattr__` hooks, all attributes are computed " "lazily, so there is no speed penalty if only those attributes which are " "lightweight to compute are used." msgstr "" -#: library/filecmp.rst:110 +#: library/filecmp.rst:115 msgid "The directory *a*." msgstr "" -#: library/filecmp.rst:115 +#: library/filecmp.rst:120 msgid "The directory *b*." msgstr "" -#: library/filecmp.rst:120 +#: library/filecmp.rst:125 msgid "Files and subdirectories in *a*, filtered by *hide* and *ignore*." msgstr "" -#: library/filecmp.rst:125 +#: library/filecmp.rst:130 msgid "Files and subdirectories in *b*, filtered by *hide* and *ignore*." msgstr "" -#: library/filecmp.rst:130 +#: library/filecmp.rst:135 msgid "Files and subdirectories in both *a* and *b*." msgstr "" -#: library/filecmp.rst:135 +#: library/filecmp.rst:140 msgid "Files and subdirectories only in *a*." msgstr "" -#: library/filecmp.rst:140 +#: library/filecmp.rst:145 msgid "Files and subdirectories only in *b*." msgstr "" -#: library/filecmp.rst:145 +#: library/filecmp.rst:150 msgid "Subdirectories in both *a* and *b*." msgstr "" -#: library/filecmp.rst:150 +#: library/filecmp.rst:155 msgid "Files in both *a* and *b*." msgstr "" -#: library/filecmp.rst:155 +#: library/filecmp.rst:160 msgid "" "Names in both *a* and *b*, such that the type differs between the " "directories, or names for which :func:`os.stat` reports an error." msgstr "" -#: library/filecmp.rst:161 +#: library/filecmp.rst:166 msgid "" "Files which are identical in both *a* and *b*, using the class's file " "comparison operator." msgstr "" -#: library/filecmp.rst:167 +#: library/filecmp.rst:172 msgid "" "Files which are in both *a* and *b*, whose contents differ according to the " "class's file comparison operator." msgstr "" -#: library/filecmp.rst:173 +#: library/filecmp.rst:178 msgid "Files which are in both *a* and *b*, but could not be compared." msgstr "" -#: library/filecmp.rst:178 +#: library/filecmp.rst:183 msgid "" "A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` " "instances (or MyDirCmp instances if this instance is of type MyDirCmp, a " "subclass of :class:`dircmp`)." msgstr "" -#: library/filecmp.rst:182 +#: library/filecmp.rst:187 msgid "" "Previously entries were always :class:`dircmp` instances. Now entries are " "the same type as *self*, if *self* is a subclass of :class:`dircmp`." msgstr "" -#: library/filecmp.rst:191 +#: library/filecmp.rst:196 msgid "List of directories ignored by :class:`dircmp` by default." msgstr "" -#: library/filecmp.rst:194 +#: library/filecmp.rst:199 msgid "" "Here is a simplified example of using the ``subdirs`` attribute to search " "recursively through two directories to show common different files::" msgstr "" + +#: library/filecmp.rst:202 +msgid "" +">>> from filecmp import dircmp\n" +">>> def print_diff_files(dcmp):\n" +"... for name in dcmp.diff_files:\n" +"... print(\"diff_file %s found in %s and %s\" % (name, dcmp.left,\n" +"... dcmp.right))\n" +"... for sub_dcmp in dcmp.subdirs.values():\n" +"... print_diff_files(sub_dcmp)\n" +"...\n" +">>> dcmp = dircmp('dir1', 'dir2')\n" +">>> print_diff_files(dcmp)" +msgstr "" diff --git a/library/fileformats.po b/library/fileformats.po index 8cf2f58d..3d10ced5 100644 --- a/library/fileformats.po +++ b/library/fileformats.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/fileinput.po b/library/fileinput.po index 2b8d01f3..e947437d 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/fileinput.rst:2 -msgid ":mod:`fileinput` --- Iterate over lines from multiple input streams" +msgid ":mod:`!fileinput` --- Iterate over lines from multiple input streams" msgstr "" #: library/fileinput.rst:10 @@ -35,6 +36,13 @@ msgstr "" msgid "The typical use is::" msgstr "" +#: library/fileinput.rst:20 +msgid "" +"import fileinput\n" +"for line in fileinput.input(encoding=\"utf-8\"):\n" +" process(line)" +msgstr "" + #: library/fileinput.rst:24 msgid "" "This iterates over the lines of all files listed in ``sys.argv[1:]``, " @@ -80,7 +88,7 @@ msgstr "" #: library/fileinput.rst:49 msgid "" "You can control how files are opened by providing an opening hook via the " -"*openhook* parameter to :func:`fileinput.input` or :class:`FileInput()`. The " +"*openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The " "hook must be a function that takes two arguments, *filename* and *mode*, and " "returns an accordingly opened file-like object. If *encoding* and/or " "*errors* are specified, they will be passed to the hook as additional " @@ -107,6 +115,14 @@ msgid "" "keyword:`!with` statement is exited, even if an exception occurs::" msgstr "" +#: library/fileinput.rst:70 +msgid "" +"with fileinput.input(files=('spam.txt', 'eggs.txt'), encoding=\"utf-8\") as " +"f:\n" +" for line in f:\n" +" process(line)" +msgstr "" + #: library/fileinput.rst:170 msgid "Can be used as a context manager." msgstr "" @@ -222,6 +238,12 @@ msgid "" "keyword:`!with` statement is exited, even if an exception occurs::" msgstr "" +#: library/fileinput.rst:167 +msgid "" +"with FileInput(files=('spam.txt', 'eggs.txt')) as input:\n" +" process(input)" +msgstr "" + #: library/fileinput.rst:173 msgid "The keyword parameter *mode* and *openhook* are now keyword-only." msgstr "" diff --git a/library/filesys.po b/library/filesys.po index 9cfcc3a3..94b43656 100644 --- a/library/filesys.po +++ b/library/filesys.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -28,30 +29,30 @@ msgid "" "full list of modules in this chapter is:" msgstr "" -#: library/filesys.rst:31 +#: library/filesys.rst:28 msgid "Module :mod:`os`" msgstr "" -#: library/filesys.rst:30 +#: library/filesys.rst:29 msgid "" "Operating system interfaces, including functions to work with files at a " "lower level than Python :term:`file objects `." msgstr "" -#: library/filesys.rst:35 +#: library/filesys.rst:32 msgid "Module :mod:`io`" msgstr "" -#: library/filesys.rst:34 +#: library/filesys.rst:33 msgid "" "Python's built-in I/O library, including both abstract classes and some " "concrete classes such as file I/O." msgstr "" -#: library/filesys.rst:37 +#: library/filesys.rst:36 msgid "Built-in function :func:`open`" msgstr "" -#: library/filesys.rst:38 +#: library/filesys.rst:37 msgid "The standard way to open files for reading and writing with Python." msgstr "" diff --git a/library/fnmatch.po b/library/fnmatch.po index 5c8984e6..f06b1f4d 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/fnmatch.rst:2 -msgid ":mod:`fnmatch` --- Unix filename pattern matching" +msgid ":mod:`!fnmatch` --- Unix filename pattern matching" msgstr "" #: library/fnmatch.rst:7 @@ -88,12 +89,21 @@ msgstr "" #: library/fnmatch.rst:49 msgid "" -"Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is " -"used to cache the compiled regex patterns in the following functions: :func:" -"`fnmatch`, :func:`fnmatchcase`, :func:`.filter`." +"Unless stated otherwise, \"filename string\" and \"pattern string\" either " +"refer to :class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note " +"that the functions documented below do not allow to mix a :class:`!bytes` " +"pattern with a :class:`!str` filename, and vice-versa." msgstr "" -#: library/fnmatch.rst:55 +#: library/fnmatch.rst:54 +msgid "" +"Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768 is " +"used to cache the (typed) compiled regex patterns in the following " +"functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`, :func:`." +"filterfalse`." +msgstr "" + +#: library/fnmatch.rst:61 msgid "" "Test whether the filename string *name* matches the pattern string *pat*, " "returning ``True`` or ``False``. Both parameters are case-normalized using :" @@ -102,41 +112,59 @@ msgid "" "operating system." msgstr "" -#: library/fnmatch.rst:61 +#: library/fnmatch.rst:67 msgid "" "This example will print all file names in the current directory with the " "extension ``.txt``::" msgstr "" -#: library/fnmatch.rst:74 +#: library/fnmatch.rst:70 +msgid "" +"import fnmatch\n" +"import os\n" +"\n" +"for file in os.listdir('.'):\n" +" if fnmatch.fnmatch(file, '*.txt'):\n" +" print(file)" +msgstr "" + +#: library/fnmatch.rst:80 msgid "" "Test whether the filename string *name* matches the pattern string *pat*, " "returning ``True`` or ``False``; the comparison is case-sensitive and does " "not apply :func:`os.path.normcase`." msgstr "" -#: library/fnmatch.rst:81 +#: library/fnmatch.rst:87 +msgid "" +"Construct a list from those elements of the :term:`iterable` of filename " +"strings *names* that match the pattern string *pat*. It is the same as ``[n " +"for n in names if fnmatch(n, pat)]``, but implemented more efficiently." +msgstr "" + +#: library/fnmatch.rst:95 msgid "" -"Construct a list from those elements of the :term:`iterable` *names* that " -"match pattern *pat*. It is the same as ``[n for n in names if fnmatch(n, " -"pat)]``, but implemented more efficiently." +"Construct a list from those elements of the :term:`iterable` of filename " +"strings *names* that do not match the pattern string *pat*. It is the same " +"as ``[n for n in names if not fnmatch(n, pat)]``, but implemented more " +"efficiently." msgstr "" -#: library/fnmatch.rst:89 +#: library/fnmatch.rst:105 msgid "" "Return the shell-style pattern *pat* converted to a regular expression for " -"using with :func:`re.match`." +"using with :func:`re.match`. The pattern is expected to be a :class:`str`." msgstr "" -#: library/fnmatch.rst:92 +#: library/fnmatch.rst:108 msgid "Example:" msgstr "" -#: library/fnmatch.rst:106 +#: library/fnmatch.rst:122 msgid "Module :mod:`glob`" msgstr "" -#: library/fnmatch.rst:107 +#: library/fnmatch.rst:123 msgid "Unix shell-style path expansion." msgstr "" diff --git a/library/fractions.po b/library/fractions.po index 7ec41c75..918ba7e2 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/fractions.rst:2 -msgid ":mod:`fractions` --- Rational numbers" +msgid ":mod:`!fractions` --- Rational numbers" msgstr "" #: library/fractions.rst:10 @@ -31,30 +32,44 @@ msgstr "" #: library/fractions.rst:17 msgid "" -"A Fraction instance can be constructed from a pair of integers, from another " -"rational number, or from a string." +"A Fraction instance can be constructed from a pair of rational numbers, from " +"a single number, or from a string." msgstr "" #: library/fractions.rst:26 msgid "" "The first version requires that *numerator* and *denominator* are instances " "of :class:`numbers.Rational` and returns a new :class:`Fraction` instance " -"with value ``numerator/denominator``. If *denominator* is ``0``, it raises " -"a :exc:`ZeroDivisionError`. The second version requires that " -"*other_fraction* is an instance of :class:`numbers.Rational` and returns a :" -"class:`Fraction` instance with the same value. The next two versions accept " -"either a :class:`float` or a :class:`decimal.Decimal` instance, and return " -"a :class:`Fraction` instance with exactly the same value. Note that due to " -"the usual issues with binary floating-point (see :ref:`tut-fp-issues`), the " -"argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so " -"``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might " -"expect. (But see the documentation for the :meth:`limit_denominator` method " -"below.) The last version of the constructor expects a string or unicode " -"instance. The usual form for this instance is::" +"with a value equal to ``numerator/denominator``. If *denominator* is zero, " +"it raises a :exc:`ZeroDivisionError`." +msgstr "" + +#: library/fractions.rst:31 +msgid "" +"The second version requires that *number* is an instance of :class:`numbers." +"Rational` or has the :meth:`!as_integer_ratio` method (this includes :class:" +"`float` and :class:`decimal.Decimal`). It returns a :class:`Fraction` " +"instance with exactly the same value. Assumed, that the :meth:`!" +"as_integer_ratio` method returns a pair of coprime integers and last one is " +"positive. Note that due to the usual issues with binary point (see :ref:`tut-" +"fp-issues`), the argument to ``Fraction(1.1)`` is not exactly equal to " +"11/10, and so ``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as " +"one might expect. (But see the documentation for the :meth:" +"`limit_denominator` method below.)" msgstr "" #: library/fractions.rst:43 msgid "" +"The last version of the constructor expects a string. The usual form for " +"this instance is::" +msgstr "" + +#: library/fractions.rst:46 +msgid "[sign] numerator ['/' denominator]" +msgstr "" + +#: library/fractions.rst:48 +msgid "" "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " "``denominator`` (if present) are strings of decimal digits (underscores may " "be used to delimit digits as with integral literals in code). In addition, " @@ -64,7 +79,35 @@ msgid "" "whitespace. Here are some examples::" msgstr "" -#: library/fractions.rst:78 +#: library/fractions.rst:57 +msgid "" +">>> from fractions import Fraction\n" +">>> Fraction(16, -10)\n" +"Fraction(-8, 5)\n" +">>> Fraction(123)\n" +"Fraction(123, 1)\n" +">>> Fraction()\n" +"Fraction(0, 1)\n" +">>> Fraction('3/7')\n" +"Fraction(3, 7)\n" +">>> Fraction(' -3/7 ')\n" +"Fraction(-3, 7)\n" +">>> Fraction('1.414213 \\t\\n')\n" +"Fraction(1414213, 1000000)\n" +">>> Fraction('-.125')\n" +"Fraction(-1, 8)\n" +">>> Fraction('7e-6')\n" +"Fraction(7, 1000000)\n" +">>> Fraction(2.25)\n" +"Fraction(9, 4)\n" +">>> Fraction(1.1)\n" +"Fraction(2476979795053773, 2251799813685248)\n" +">>> from decimal import Decimal\n" +">>> Fraction(Decimal('1.1'))\n" +"Fraction(11, 10)" +msgstr "" + +#: library/fractions.rst:83 msgid "" "The :class:`Fraction` class inherits from the abstract base class :class:" "`numbers.Rational`, and implements all of the methods and operations from " @@ -73,110 +116,130 @@ msgid "" "properties and methods:" msgstr "" -#: library/fractions.rst:84 +#: library/fractions.rst:89 msgid "" "The :class:`Fraction` constructor now accepts :class:`float` and :class:" "`decimal.Decimal` instances." msgstr "" -#: library/fractions.rst:88 +#: library/fractions.rst:93 msgid "" "The :func:`math.gcd` function is now used to normalize the *numerator* and " -"*denominator*. :func:`math.gcd` always return a :class:`int` type. " +"*denominator*. :func:`math.gcd` always returns an :class:`int` type. " "Previously, the GCD type depended on *numerator* and *denominator*." msgstr "" -#: library/fractions.rst:93 +#: library/fractions.rst:98 msgid "" "Underscores are now permitted when creating a :class:`Fraction` instance " "from a string, following :PEP:`515` rules." msgstr "" -#: library/fractions.rst:97 +#: library/fractions.rst:102 msgid "" ":class:`Fraction` implements ``__int__`` now to satisfy ``typing." "SupportsInt`` instance checks." msgstr "" -#: library/fractions.rst:101 +#: library/fractions.rst:106 msgid "" "Space is allowed around the slash for string inputs: ``Fraction('2 / 3')``." msgstr "" -#: library/fractions.rst:104 +#: library/fractions.rst:109 msgid "" ":class:`Fraction` instances now support float-style formatting, with " "presentation types ``\"e\"``, ``\"E\"``, ``\"f\"``, ``\"F\"``, ``\"g\"``, " "``\"G\"`` and ``\"%\"\"``." msgstr "" -#: library/fractions.rst:111 +#: library/fractions.rst:114 +msgid "" +"Formatting of :class:`Fraction` instances without a presentation type now " +"supports fill, alignment, sign handling, minimum width and grouping." +msgstr "" + +#: library/fractions.rst:118 +msgid "" +"The :class:`Fraction` constructor now accepts any objects with the :meth:`!" +"as_integer_ratio` method." +msgstr "" + +#: library/fractions.rst:124 msgid "Numerator of the Fraction in lowest term." msgstr "" -#: library/fractions.rst:115 -msgid "Denominator of the Fraction in lowest term." +#: library/fractions.rst:128 +msgid "Denominator of the Fraction in lowest terms. Guaranteed to be positive." msgstr "" -#: library/fractions.rst:120 +#: library/fractions.rst:134 msgid "" "Return a tuple of two integers, whose ratio is equal to the original " "Fraction. The ratio is in lowest terms and has a positive denominator." msgstr "" -#: library/fractions.rst:128 +#: library/fractions.rst:142 msgid "Return ``True`` if the Fraction is an integer." msgstr "" -#: library/fractions.rst:134 +#: library/fractions.rst:148 msgid "" "Alternative constructor which only accepts instances of :class:`float` or :" "class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " "the same value as ``Fraction(3, 10)``." msgstr "" -#: library/fractions.rst:140 +#: library/fractions.rst:154 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`float`." msgstr "" -#: library/fractions.rst:146 +#: library/fractions.rst:160 msgid "" "Alternative constructor which only accepts instances of :class:`decimal." "Decimal` or :class:`numbers.Integral`." msgstr "" -#: library/fractions.rst:151 +#: library/fractions.rst:165 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`decimal.Decimal` instance." msgstr "" -#: library/fractions.rst:158 +#: library/fractions.rst:172 +msgid "" +"Alternative constructor which only accepts instances of :class:`numbers." +"Integral`, :class:`numbers.Rational`, :class:`float` or :class:`decimal." +"Decimal`, and objects with the :meth:`!as_integer_ratio` method, but not " +"strings." +msgstr "" + +#: library/fractions.rst:182 msgid "" "Finds and returns the closest :class:`Fraction` to ``self`` that has " "denominator at most max_denominator. This method is useful for finding " "rational approximations to a given floating-point number:" msgstr "" -#: library/fractions.rst:166 +#: library/fractions.rst:190 msgid "or for recovering a rational number that's represented as a float:" msgstr "" -#: library/fractions.rst:179 +#: library/fractions.rst:203 msgid "" "Returns the greatest :class:`int` ``<= self``. This method can also be " "accessed through the :func:`math.floor` function:" msgstr "" -#: library/fractions.rst:189 +#: library/fractions.rst:213 msgid "" "Returns the least :class:`int` ``>= self``. This method can also be " "accessed through the :func:`math.ceil` function." msgstr "" -#: library/fractions.rst:196 +#: library/fractions.rst:220 msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " @@ -185,25 +248,67 @@ msgid "" "func:`round` function." msgstr "" -#: library/fractions.rst:204 +#: library/fractions.rst:228 +msgid "" +"Provides support for formatting of :class:`Fraction` instances via the :meth:" +"`str.format` method, the :func:`format` built-in function, or :ref:" +"`Formatted string literals `." +msgstr "" + +#: library/fractions.rst:232 msgid "" -"Provides support for float-style formatting of :class:`Fraction` instances " -"via the :meth:`str.format` method, the :func:`format` built-in function, or :" -"ref:`Formatted string literals `. The presentation types " -"``\"e\"``, ``\"E\"``, ``\"f\"``, ``\"F\"``, ``\"g\"``, ``\"G\"`` and ``\"%" -"\"`` are supported. For these presentation types, formatting for a :class:" -"`Fraction` object ``x`` follows the rules outlined for the :class:`float` " +"If the ``format_spec`` format specification string does not end with one of " +"the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` " +"or ``'%'`` then formatting follows the general rules for fill, alignment, " +"sign handling, minimum width, and grouping as described in the :ref:`format " +"specification mini-language `. The \"alternate form\" flag " +"``'#'`` is supported: if present, it forces the output string to always " +"include an explicit denominator, even when the value being formatted is an " +"exact integer. The zero-fill flag ``'0'`` is not supported." +msgstr "" + +#: library/fractions.rst:242 +msgid "" +"If the ``format_spec`` format specification string ends with one of the " +"presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or " +"``'%'`` then formatting follows the rules outlined for the :class:`float` " "type in the :ref:`formatspec` section." msgstr "" -#: library/fractions.rst:212 +#: library/fractions.rst:247 msgid "Here are some examples::" msgstr "" -#: library/fractions.rst:228 +#: library/fractions.rst:249 +msgid "" +">>> from fractions import Fraction\n" +">>> format(Fraction(103993, 33102), '_')\n" +"'103_993/33_102'\n" +">>> format(Fraction(1, 7), '.^+10')\n" +"'...+1/7...'\n" +">>> format(Fraction(3, 1), '')\n" +"'3'\n" +">>> format(Fraction(3, 1), '#')\n" +"'3/1'\n" +">>> format(Fraction(1, 7), '.40g')\n" +"'0.1428571428571428571428571428571428571429'\n" +">>> format(Fraction('1234567.855'), '_.2f')\n" +"'1_234_567.86'\n" +">>> f\"{Fraction(355, 113):*>20.6e}\"\n" +"'********3.141593e+00'\n" +">>> old_price, new_price = 499, 672\n" +">>> \"{:.2%} price increase\".format(Fraction(new_price, old_price) - 1)\n" +"'34.67% price increase'" +msgstr "" + +#: library/fractions.rst:271 msgid "Module :mod:`numbers`" msgstr "" -#: library/fractions.rst:229 +#: library/fractions.rst:272 msgid "The abstract base classes making up the numeric tower." msgstr "" + +#: library/fractions.rst:20 +msgid "as_integer_ratio()" +msgstr "" diff --git a/library/frameworks.po b/library/frameworks.po index fe12d76d..2dc6cede 100644 --- a/library/frameworks.po +++ b/library/frameworks.po @@ -8,25 +8,33 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: library/frameworks.rst:5 -msgid "Program Frameworks" +#: library/frameworks.rst:7 +msgid "Program frameworks" msgstr "" -#: library/frameworks.rst:7 +#: library/frameworks.rst:9 msgid "" -"The modules described in this chapter are frameworks that will largely " -"dictate the structure of your program. Currently the modules described " -"here are all oriented toward writing command-line interfaces." +"This chapter is no longer maintained, and the modules it contained have been " +"moved to their respective topical documentation." msgstr "" #: library/frameworks.rst:11 -msgid "The full list of modules described in this chapter is:" +msgid ":mod:`cmd` — :doc:`Command Line Interface Libraries <./cmdlinelibs>`" +msgstr "" + +#: library/frameworks.rst:12 +msgid ":mod:`shlex` — :doc:`Unix Specific Services <./unix>`" +msgstr "" + +#: library/frameworks.rst:13 +msgid ":mod:`turtle` — :doc:`Graphical User Interfaces with Tk <./tk>`" msgstr "" diff --git a/library/ftplib.po b/library/ftplib.po index 9ceaefca..a569de27 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/ftplib.rst:2 -msgid ":mod:`ftplib` --- FTP protocol client" +msgid ":mod:`!ftplib` --- FTP protocol client" msgstr "" #: library/ftplib.rst:7 @@ -39,20 +40,41 @@ msgid "The default encoding is UTF-8, following :rfc:`2640`." msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/ftplib.rst:26 msgid "Here's a sample session using the :mod:`ftplib` module::" msgstr "" +#: library/ftplib.rst:28 +msgid "" +">>> from ftplib import FTP\n" +">>> ftp = FTP('ftp.us.debian.org') # connect to host, default port\n" +">>> ftp.login() # user anonymous, passwd anonymous@\n" +"'230 Login successful.'\n" +">>> ftp.cwd('debian') # change into \"debian\" directory\n" +"'250 Directory successfully changed.'\n" +">>> ftp.retrlines('LIST') # list directory contents\n" +"-rw-rw-r-- 1 1176 1176 1063 Jun 15 10:18 README\n" +"...\n" +"drwxr-sr-x 5 1176 1176 4096 Dec 19 2000 pool\n" +"drwxr-sr-x 4 1176 1176 4096 Nov 17 2008 project\n" +"drwxr-xr-x 3 1176 1176 4096 Oct 10 2012 tools\n" +"'226 Directory send OK.'\n" +">>> with open('README', 'wb') as fp:\n" +">>> ftp.retrbinary('RETR README', fp.write)\n" +"'226 Transfer complete.'\n" +">>> ftp.quit()\n" +"'221 Goodbye.'" +msgstr "" + #: library/ftplib.rst:51 msgid "Reference" msgstr "" @@ -182,7 +204,7 @@ msgid "" "timeout setting)." msgstr "" -#: library/ftplib.rst:198 +#: library/ftplib.rst:187 msgid "" "Raises an :ref:`auditing event ` ``ftplib.connect`` with arguments " "``self``, ``host``, ``port``." @@ -219,7 +241,7 @@ msgid "" "Send a simple command string to the server and return the response string." msgstr "" -#: library/ftplib.rst:249 +#: library/ftplib.rst:238 msgid "" "Raises an :ref:`auditing event ` ``ftplib.sendcmd`` with arguments " "``self``, ``cmd``." @@ -236,8 +258,8 @@ msgstr "" msgid "Retrieve a file in binary transfer mode." msgstr "" -#: library/ftplib.rst:289 -msgid "An appropriate ``STOR`` command: :samp:`\"STOR {filename}\"`." +#: library/ftplib.rst:245 +msgid "An appropriate ``RETR`` command: :samp:`\"RETR {filename}\"`." msgstr "" #: library/ftplib.rst:248 @@ -281,6 +303,10 @@ msgstr "" msgid "Store a file in binary transfer mode." msgstr "" +#: library/ftplib.rst:289 +msgid "An appropriate ``STOR`` command: :samp:`\"STOR {filename}\"`." +msgstr "" + #: library/ftplib.rst:292 msgid "" "A file object (opened in binary mode) which is read until EOF, using its :" @@ -476,6 +502,23 @@ msgstr "" msgid "Here's a sample session using the :class:`FTP_TLS` class::" msgstr "" +#: library/ftplib.rst:516 +msgid "" +">>> ftps = FTP_TLS('ftp.pureftpd.org')\n" +">>> ftps.login()\n" +"'230 Anonymous user logged in'\n" +">>> ftps.prot_p()\n" +"'200 Data protection level set to \"private\"'\n" +">>> ftps.nlst()\n" +"['6jack', 'OpenBSD', 'antilink', 'blogbench', 'bsdcam', 'clockspeed', " +"'djbdns-jedi', 'docs', 'eaccelerator-jedi', 'favicon.ico', 'francotone', " +"'fugu', 'ignore', 'libpuzzle', 'metalog', 'minidentd', 'misc', 'mysql-udf-" +"global-user-variables', 'php-jenkins-hash', 'php-skein-hash', 'php-webdav', " +"'phpaudit', 'phpbench', 'pincaster', 'ping', 'posto', 'pub', 'public', " +"'public_keys', 'pure-ftpd', 'qscan', 'qtc', 'sharedance', 'skycache', " +"'sound', 'tmp', 'ucarp']" +msgstr "" + #: library/ftplib.rst:524 msgid "" ":class:`!FTP_TLS` class inherits from :class:`FTP`, defining these " @@ -548,7 +591,7 @@ msgid "" "four exceptions listed above as well as :exc:`OSError` and :exc:`EOFError`." msgstr "" -#: library/ftplib.rst:597 +#: library/ftplib.rst:595 msgid "Module :mod:`netrc`" msgstr "" diff --git a/library/functional.po b/library/functional.po index e9b607d1..b4e6cf93 100644 --- a/library/functional.po +++ b/library/functional.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/functions.po b/library/functions.po index c82c5d4f..9ed65b5e 100644 --- a/library/functions.po +++ b/library/functions.po @@ -8,15 +8,15 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-09-07 18:18+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-12-01 00:09+0200\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 3.5\n" +"X-Generator: Poedit 3.6\n" #: library/functions.rst:11 msgid "Built-in Functions" @@ -398,12 +398,12 @@ msgstr ":func:`__import__`" #: library/functions.rst:59 msgid "" "Return the absolute value of a number. The argument may be an integer, a " -"floating point number, or an object implementing :meth:`~object.__abs__`. If " +"floating-point number, or an object implementing :meth:`~object.__abs__`. If " "the argument is a complex number, its magnitude is returned." msgstr "" "Επιστρέφει την απόλυτη τιμή ενός αριθμού. Το όρισμα μπορεί να είναι ένας " "ακέραιος, ένας αριθμός κινητής υποδιαστολής, ή ένα αντικείμενο που υλοποιεί " -"την :meth:`~object.__abs__`. Εάν το όρισμα είναι ένας περίπλοκος αριθμός " +"την :meth:`~object.__abs__`. Εάν το όρισμα είναι ένας μιγαδικός αριθμός " "επιστρέφεται το μέγεθός του." #: library/functions.rst:67 @@ -428,6 +428,20 @@ msgstr "" "Επιστρέφει ``True`` εάν όλα τα στοιχεία του *iterable* είναι true (ή εάν το " "iterable είναι κενό). Ισοδυναμεί με::" +#: library/functions.rst:79 +msgid "" +"def all(iterable):\n" +" for element in iterable:\n" +" if not element:\n" +" return False\n" +" return True" +msgstr "" +"def all(iterable):\n" +" for element in iterable:\n" +" if not element:\n" +" return False\n" +" return True" + #: library/functions.rst:89 msgid "" "When awaited, return the next item from the given :term:`asynchronous " @@ -465,6 +479,20 @@ msgstr "" "Επιστρέφει ``True`` εάν οποιοδήποτε στοιχείο του *iterable* είναι αληθές. " "Εάν το iterable είναι κενό, επιστρέφει ``False``. Ισοδυναμεί με::" +#: library/functions.rst:107 +msgid "" +"def any(iterable):\n" +" for element in iterable:\n" +" if element:\n" +" return True\n" +" return False" +msgstr "" +"def any(iterable):\n" +" for element in iterable:\n" +" if element:\n" +" return True\n" +" return False" + #: library/functions.rst:116 msgid "" "As :func:`repr`, return a string containing a printable representation of an " @@ -481,14 +509,15 @@ msgstr "" #: library/functions.rst:124 msgid "" "Convert an integer number to a binary string prefixed with \"0b\". The " -"result is a valid Python expression. If *x* is not a Python :class:`int` " -"object, it has to define an :meth:`~object.__index__` method that returns an " -"integer. Some examples:" +"result is a valid Python expression. If *integer* is not a Python :class:" +"`int` object, it has to define an :meth:`~object.__index__` method that " +"returns an integer. Some examples:" msgstr "" "Μετατροπή ενός ακέραιου αριθμού σε μια δυαδική συμβολοσειρά με πρόθεμα " -"\"0b\". Το αποτέλεσμα είναι μια έγκυρη έκφραση Python. Εάν το *x* δεν είναι " -"αντικείμενο της Python :class:`int`, πρέπει να οριστεί μια μέθοδος :meth:" -"`~object.__index__` που επιστρέφει έναν ακέραιο αριθμό. Κάποια παραδείγματα:" +"\"0b\". Το αποτέλεσμα είναι μια έγκυρη έκφραση Python. Εάν το *integer* δεν " +"είναι αντικείμενο της Python :class:`int`, πρέπει να οριστεί μια μέθοδος :" +"meth:`~object.__index__` που επιστρέφει έναν ακέραιο αριθμό. Κάποια " +"παραδείγματα:" #: library/functions.rst:134 msgid "" @@ -498,36 +527,36 @@ msgstr "" "Εάν το πρόθεμα \"0b\" είναι επιθυμητό ή όχι, μπορείτε να χρησιμοποιήσετε " "έναν από τους παρακάτω τρόπους." -#: library/functions.rst:845 library/functions.rst:1163 +#: library/functions.rst:948 library/functions.rst:1332 msgid "See also :func:`format` for more information." msgstr "Δείτε επίσης τη :func:`format` για περισσότερες πληροφορίες." #: library/functions.rst:146 msgid "" -"Return a Boolean value, i.e. one of ``True`` or ``False``. *x* is converted " -"using the standard :ref:`truth testing procedure `. If *x* is false " -"or omitted, this returns ``False``; otherwise, it returns ``True``. The :" -"class:`bool` class is a subclass of :class:`int` (see :ref:`typesnumeric`). " -"It cannot be subclassed further. Its only instances are ``False`` and " -"``True`` (see :ref:`typebool`)." +"Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " +"converted using the standard :ref:`truth testing procedure `. If the " +"argument is false or omitted, this returns ``False``; otherwise, it returns " +"``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:" +"`typesnumeric`). It cannot be subclassed further. Its only instances are " +"``False`` and ``True`` (see :ref:`typebool`)." msgstr "" "Επιστρέφετε μια δυαδική τιμή, π.χ. μία από τις τιμές ``True`` ή ``False``. " -"Το *x* μετατρέπεται χρησιμοποιώντας την τυπική :ref:`truth testing procedure " -"`. Εάν το *x* είναι ψευδές ή παραλειφθεί, αυτό επιστρέφει ``False``∙ " -"διαφορετικά, επιστρέφει ``True``. Η κλάση :class:`bool` είναι μια υποκλάση " -"της :class:`int` (βλ. :ref:`typesnumeric`). Δεν μπορεί να γίνει περαιτέρω " -"υποκλάση. Οι μόνες περιπτώσεις είναι ``False`` και ``True`` (βλ. :ref:" -"`typebool`)." +"Το όρισμα μετατρέπεται χρησιμοποιώντας την τυπική :ref:`truth testing " +"procedure `. Εάν το όρισμα είναι ψευδές ή παραλειφθεί, αυτό " +"επιστρέφει ``False`` ∙ διαφορετικά, επιστρέφει ``True``. Η κλάση :class:" +"`bool` είναι μια υποκλάση της :class:`int` (βλ. :ref:`typesnumeric`). Δεν " +"μπορεί να γίνει περαιτέρω υποκλάση. Οι μόνες περιπτώσεις είναι ``False`` " +"και ``True`` (βλ. :ref:`typebool`)." -#: library/functions.rst:710 library/functions.rst:934 -msgid "*x* is now a positional-only parameter." -msgstr "Το *x* είναι πλέον μόνο παράμετρος θέσης." +#: library/functions.rst:813 +msgid "The parameter is now positional-only." +msgstr "Η παράμετρος είναι πλέον μόνο παράμετρος θέσης." -#: library/functions.rst:160 +#: library/functions.rst:161 msgid "" "This function drops you into the debugger at the call site. Specifically, " "it calls :func:`sys.breakpointhook`, passing ``args`` and ``kws`` straight " -"through. By default, ``sys.breakpointhook()`` calls :func:`pdb.set_trace()` " +"through. By default, ``sys.breakpointhook()`` calls :func:`pdb.set_trace` " "expecting no arguments. In this case, it is purely a convenience function " "so you don't have to explicitly import :mod:`pdb` or type as much code to " "enter the debugger. However, :func:`sys.breakpointhook` can be set to some " @@ -538,7 +567,7 @@ msgstr "" "Αυτή η συνάρτηση μας μεταφέρει στο πρόγραμμα εντοπισμού σφαλμάτων στην " "τοποθεσία της κλήσης. Συγκεκριμένα, καλεί το :func:`sys.breakpointhook`, " "περνώντας απευθείας τα ``args`` και ``kws``. Από προεπιλογή, το ``sys." -"breakpointhook()`` καλεί την :func:`pdb.set_trace()` χωρίς να περιμένει " +"breakpointhook()`` καλεί την :func:`pdb.set_trace` χωρίς να περιμένει " "ορίσματα. Σε αυτήν την περίπτωση, είναι καθαρά μια βολική συνάρτηση, " "επομένως δεν χρειάζεται να εισάγετε ρητά το :mod:`pdb` ή να πληκτρολογήσετε " "τόσο πολύ κώδικα. Ωστόσο η :func:`sys.breakpointhook` μπορεί να ρυθμιστεί " @@ -547,7 +576,7 @@ msgstr "" "σας. Εάν η :func:`sys.breakpointhook` δεν είναι προσβάσιμη, αυτή η συνάρτηση " "θα κάνει raise το :exc:`RuntimeError`." -#: library/functions.rst:172 +#: library/functions.rst:173 msgid "" "By default, the behavior of :func:`breakpoint` can be changed with the :" "envvar:`PYTHONBREAKPOINT` environment variable. See :func:`sys." @@ -557,7 +586,7 @@ msgstr "" "την μεταβλητή περιβάλλοντος :envvar:`PYTHONBREAKPOINT`. Βλ. την :func:`sys." "breakpointhook` για λεπτομέρειες χρήσης." -#: library/functions.rst:176 +#: library/functions.rst:177 msgid "" "Note that this is not guaranteed if :func:`sys.breakpointhook` has been " "replaced." @@ -565,7 +594,7 @@ msgstr "" "Λάβετε υπόψη ότι αυτό δεν είναι εγγυημένο εάν η :func:`sys.breakpointhook` " "έχει αντικατασταθεί." -#: library/functions.rst:179 +#: library/functions.rst:180 msgid "" "Raises an :ref:`auditing event ` ``builtins.breakpoint`` with " "argument ``breakpointhook``." @@ -638,7 +667,7 @@ msgstr "Χωρίς όρισμα δημιουργείται ένας πίνακα msgid "See also :ref:`binaryseq` and :ref:`typebytearray`." msgstr "Βλ. επίσης :ref:`binaryseq` και :ref:`typebytearray`." -#: library/functions.rst:221 +#: library/functions.rst:220 msgid "" "Return a new \"bytes\" object which is an immutable sequence of integers in " "the range ``0 <= x < 256``. :class:`bytes` is an immutable version of :" @@ -650,24 +679,24 @@ msgstr "" "αμετάβλητη έκδοση του :class:`bytearray` -- έχει τις ίδιες μεθόδους χωρίς " "μετάλλαξη και την ίδια συμπεριφορά ευρετηριοποίησης και τεμαχισμού." -#: library/functions.rst:226 +#: library/functions.rst:225 msgid "" "Accordingly, constructor arguments are interpreted as for :func:`bytearray`." msgstr "" "Συνεπώς, τα ορίσματα του constructor ερμηνεύονται ως :func:`bytearray`." -#: library/functions.rst:228 +#: library/functions.rst:227 msgid "Bytes objects can also be created with literals, see :ref:`strings`." msgstr "" "Τα αντικείμενα bytes μπορούν επίσης να δημιουργηθούν με literals, βλέπε :ref:" "`strings`." -#: library/functions.rst:230 +#: library/functions.rst:229 msgid "See also :ref:`binaryseq`, :ref:`typebytes`, and :ref:`bytes-methods`." msgstr "" "Βλέπε επίσης :ref:`binaryseq`, :ref:`typebytes`, και :ref:`bytes-methods`." -#: library/functions.rst:235 +#: library/functions.rst:234 msgid "" "Return :const:`True` if the *object* argument appears callable, :const:" "`False` if not. If this returns ``True``, it is still possible that a call " @@ -682,7 +711,7 @@ msgstr "" "μιας κλάσης επιστρέφει ένα νέο instance). Τα instances μπορούν να κληθούν αν " "η κλάση τους έχει τη μέθοδο :meth:`~object.__call__`." -#: library/functions.rst:241 +#: library/functions.rst:240 msgid "" "This function was first removed in Python 3.0 and then brought back in " "Python 3.2." @@ -690,31 +719,30 @@ msgstr "" "Αυτή η συνάρτηση πρώτα αφαιρέθηκε στην Python 3.0 και στη συνέχεια επανήλθε " "στην Python 3.2." -#: library/functions.rst:248 +#: library/functions.rst:247 msgid "" -"Return the string representing a character whose Unicode code point is the " -"integer *i*. For example, ``chr(97)`` returns the string ``'a'``, while " +"Return the string representing a character with the specified Unicode code " +"point. For example, ``chr(97)`` returns the string ``'a'``, while " "``chr(8364)`` returns the string ``'€'``. This is the inverse of :func:`ord`." msgstr "" -"Επιστρέφει τη συμβολοσειρά που αντιπροσωπεύει έναν χαρακτήρα του οποίου ο " -"κωδικός σημείου Unicode είναι ο ακέραιος *i*. Για παράδειγμα, ``chr(97)`` " -"επιστρέφει τη συμβολοσειρά ``'a'``, ενώ το ``chr(8364)`` επιστρέφει τη " -"συμβολοσειρά ``'€'``. Αυτό είναι το αντίστροφο του :func:`ord`." +"Επιστρέφει τη συμβολοσειρά που αναπαριστά έναν χαρακτήρα με το συγκεκριμένο " +"Unicode code point. Για παράδειγμα, το ``chr(97)`` επιστρέφει τη " +"συμβολοσειρά ``'a'``, ενώ το ``chr(8364)`` επιστρέφει τη συμβολοσειρά " +"``'€'``. Αυτό είναι το αντίστροφο της :func:`ord`." -#: library/functions.rst:252 +#: library/functions.rst:251 msgid "" "The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in " -"base 16). :exc:`ValueError` will be raised if *i* is outside that range." +"base 16). :exc:`ValueError` will be raised if it is outside that range." msgstr "" "Το έγκυρο εύρος για το όρισμα είναι από 0 έως 1,114,111 (0x10FFFF στη βάση " -"16). Το :exc:`ValueError` θα γίνει raise εάν το *i* είναι εκτός αυτού του " -"εύρους." +"16). Το :exc:`ValueError` θα γίνει raise εάν είναι εκτός αυτού του εύρους." -#: library/functions.rst:258 +#: library/functions.rst:257 msgid "Transform a method into a class method." msgstr "Μετατροπή μιας μεθόδου σε μέθοδο κλάσης." -#: library/functions.rst:260 +#: library/functions.rst:259 msgid "" "A class method receives the class as an implicit first argument, just like " "an instance method receives the instance. To declare a class method, use " @@ -724,7 +752,17 @@ msgstr "" "instance μέθοδος λαμβάνει το instance. Για να δηλώσετε μια μέθοδο κλάσης, " "χρησιμοποιήστε αυτό το ιδίωμα::" -#: library/functions.rst:268 +#: library/functions.rst:263 +msgid "" +"class C:\n" +" @classmethod\n" +" def f(cls, arg1, arg2): ..." +msgstr "" +"class C:\n" +" @classmethod\n" +" def f(cls, arg1, arg2): ..." + +#: library/functions.rst:267 msgid "" "The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -732,7 +770,7 @@ msgstr "" "Η φόρμα ``@classmethod`` είναι μια συνάρτηση :term:`decorator` -- βλέπε :ref:" "`function` για λεπτομέρειες." -#: library/functions.rst:271 +#: library/functions.rst:270 msgid "" "A class method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). The instance is ignored except for its " @@ -744,7 +782,7 @@ msgstr "" "της. Εάν μια μέθοδος κλάσης καλείται για μια παραγόμενη κλάση, το " "αντικείμενο παραγόμενης κλάσης μεταβιβάζεται ως το υπονοούμενο πρώτο όρισμα." -#: library/functions.rst:276 +#: library/functions.rst:275 msgid "" "Class methods are different than C++ or Java static methods. If you want " "those, see :func:`staticmethod` in this section. For more information on " @@ -754,7 +792,7 @@ msgstr "" "ανατρέξτε στο :func:`staticmethod` σε αυτήν την ενότητα. Για περισσότερες " "πληροφορίες σχετικά με τις μεθόδους κλάσης, ανατρέξτε στο :ref:`types`." -#: library/functions.rst:280 +#: library/functions.rst:279 msgid "" "Class methods can now wrap other :term:`descriptors ` such as :" "func:`property`." @@ -762,17 +800,19 @@ msgstr "" "Οι μέθοδοι κλάσης μπορούν πλέον να αναδιπλώσουν άλλους :term:`descriptors " "` όπως η :func:`property`." -#: library/functions.rst:284 +#: library/functions.rst:283 msgid "" -"Class methods now inherit the method attributes (``__module__``, " -"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``) and " -"have a new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " +"new ``__wrapped__`` attribute." msgstr "" -"Οι μέθοδοι κλάσης κληρονομούν πλέον τα χαρακτηριστικά της μεθόδους " -"(``__module__``, ``__name__``, ``__qualname__``, ``__doc__`` και " -"``__annotations__``) και έχουν ένα νέο χαρακτηριστικό ``__wrapped__``." +"Οι μέθοδοι κλάσης κληρονομούν πλέον τα χαρακτηριστικά της μεθόδους (:attr:" +"`~function.__module__`, :attr:`~function.__name__`, :attr:`~function." +"__qualname__`, :attr:`~function.__doc__` and :attr:`~function." +"__annotations__`) και έχουν ένα νέο χαρακτηριστικό ``__wrapped__``." -#: library/functions.rst:289 +#: library/functions.rst:290 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." @@ -780,7 +820,7 @@ msgstr "" "Οι μέθοδοι κλάσης δεν μπορούν πλέον να κάνουν wrap άλλους :term:`descriptors " "` όπως :func:`property`." -#: library/functions.rst:296 +#: library/functions.rst:297 msgid "" "Compile the *source* into a code or AST object. Code objects can be " "executed by :func:`exec` or :func:`eval`. *source* can either be a normal " @@ -793,7 +833,7 @@ msgstr "" "συμβολοσειρά AST αντικείμενου. Ανατρέξτε στην τεκμηρίωση του module :mod:" "`ast` για πληροφορίες σχετικά με τον τρόπο εργασίας με αντικείμενα AST." -#: library/functions.rst:301 +#: library/functions.rst:302 msgid "" "The *filename* argument should give the file from which the code was read; " "pass some recognizable value if it wasn't read from a file (``''`` " @@ -803,7 +843,7 @@ msgstr "" "κώδικας∙ να περάσει κάποια αναγνωρίσιμη τιμή εάν δεν διαβαστεί από ένα " "αρχείο (χρησιμοποιείται συνήθως ``''``)." -#: library/functions.rst:305 +#: library/functions.rst:306 msgid "" "The *mode* argument specifies what kind of code must be compiled; it can be " "``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if " @@ -818,7 +858,7 @@ msgstr "" "θα εκτυπωθούν δηλώσεις έκφρασης που αξιολογούνται σε κάτι διαφορετικό από " "``None``)." -#: library/functions.rst:311 +#: library/functions.rst:312 msgid "" "The optional arguments *flags* and *dont_inherit* control which :ref:" "`compiler options ` should be activated and which :ref:" @@ -843,7 +883,7 @@ msgstr "" "ακέραιος, τότε το όρισμα *flags* είναι αυτό -- οι σημαίες (μελλοντικές " "δυνατότητες και επιλογές μεταγλωττιστή) στον περιβάλλοντα κώδικα αγνοούνται." -#: library/functions.rst:322 +#: library/functions.rst:323 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " @@ -856,11 +896,11 @@ msgstr "" "bits που μπορούν να συνδυαστούν κατά bit ORed μαζί για να καθορίσουν πολλές " "επιλογές. Το πεδίο bit που απαιτείται για το καθορισμό ενός δεδομένου " "μελλοντικού χαρακτηριστικού μπορεί να βρεθεί ως το χαρακτηριστικό :attr:" -"`~__future__.Το _Feature.compiler_flag` στο :class:`~__future__._Feature` " +"`~__future__._Feature.compiler_flag` στο :class:`~__future__._Feature` " "instance του module :mod:`__future__`. :ref:`Compiler flags ` μπορούν να βρεθούν στο module :mod:`ast`, με το πρόθεμα ``PyCF_``." -#: library/functions.rst:330 +#: library/functions.rst:331 msgid "" "The argument *optimize* specifies the optimization level of the compiler; " "the default value of ``-1`` selects the optimization level of the " @@ -875,7 +915,7 @@ msgstr "" "ισχυρισμοί καταργήθηκαν, το ``__debug__`` είναι ψευδές) ή ``2`` (οι " "συμβολοσειρές εγγραφών καταργήθηκαν επίσης)." -#: library/functions.rst:336 +#: library/functions.rst:337 msgid "" "This function raises :exc:`SyntaxError` if the compiled source is invalid, " "and :exc:`ValueError` if the source contains null bytes." @@ -884,7 +924,7 @@ msgstr "" "κώδικας είναι άκυρος, και το :exc:`ValueError` εάν ο κώδικας περιλαμβάνει " "null bytes." -#: library/functions.rst:339 +#: library/functions.rst:340 msgid "" "If you want to parse Python code into its AST representation, see :func:`ast." "parse`." @@ -892,15 +932,7 @@ msgstr "" "Εάν θέλετε να αναλύσετε τον κώδικα Python στην αναπαράσταση του AST, δείτε " "το :func:`ast.parse`." -#: library/functions.rst:342 -msgid "" -"Raises an :ref:`auditing event ` ``compile`` with arguments " -"``source``, ``filename``." -msgstr "" -"Εγείρει ένα :ref:`auditing event ` ``compile`` με ορίσματα " -"``source``, ``filename``." - -#: library/functions.rst:344 +#: library/functions.rst:345 msgid "" "Raises an :ref:`auditing event ` ``compile`` with arguments " "``source`` and ``filename``. This event may also be raised by implicit " @@ -910,7 +942,7 @@ msgstr "" "``source`` και ``filename``. Αυτό το συμβάν μπορεί επίσης να προκύψει από " "έμμεση μεταγλώττιση." -#: library/functions.rst:350 +#: library/functions.rst:351 msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " @@ -923,7 +955,7 @@ msgstr "" "εντοπισμός μη ολοκληρωμένων και ολοκληρωμένων δηλώσεων στο module :mod:" "`code`." -#: library/functions.rst:357 +#: library/functions.rst:358 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string when compiling to an AST object due to stack depth " @@ -933,7 +965,7 @@ msgstr "" "σύνθετη συμβολοσειρά κατά τη μεταγλώττιση σε ένα αντικείμενο AST λόγω " "περιορισμών βάθους στοίβας στον μεταγλωττιστή AST της Python." -#: library/functions.rst:361 +#: library/functions.rst:362 msgid "" "Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode " "does not have to end in a newline anymore. Added the *optimize* parameter." @@ -942,7 +974,7 @@ msgstr "" "λειτουργία ``'exec'`` δεν χρειάζεται πλέον να τελειώνει σε νέα γραμμή. " "Προστέθηκε η παράμετρος *optimize*." -#: library/functions.rst:365 +#: library/functions.rst:366 msgid "" "Previously, :exc:`TypeError` was raised when null bytes were encountered in " "*source*." @@ -950,7 +982,7 @@ msgstr "" "Προηγουμένως, το :exc:`TypeError` έγινε raise όταν null bytes συναντήθηκαν " "στο *source*." -#: library/functions.rst:369 +#: library/functions.rst:370 msgid "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable " "support for top-level ``await``, ``async for``, and ``async with``." @@ -959,60 +991,139 @@ msgstr "" "για να ενεργοποιηθεί η υποστήριξη για ``await``, ``async for``, και ``async " "with``." -#: library/functions.rst:377 -msgid "" -"Return a complex number with the value *real* + *imag*\\*1j or convert a " -"string or number to a complex number. If the first parameter is a string, " -"it will be interpreted as a complex number and the function must be called " -"without a second parameter. The second parameter can never be a string. " -"Each argument may be any numeric type (including complex). If *imag* is " -"omitted, it defaults to zero and the constructor serves as a numeric " -"conversion like :class:`int` and :class:`float`. If both arguments are " -"omitted, returns ``0j``." -msgstr "" -"Επιστρέφει έναν μιγαδικό αριθμό με τιμή *real* + *imag*\\*1j ή μετατρέπει " -"μια συμβολοσειρά ή έναν αριθμό σε μιγαδικό αριθμό. Εάν η πρώτη παράμετρος " -"είναι συμβολοσειρά, θα ερμηνευτεί ως μιγαδικός αριθμός και η συνάρτηση θα " -"πρέπει να καλεστεί χωρίς δεύτερη παράμετρος. Η δεύτερη παράμετρος δεν " -"μπορεί ποτέ να είναι μια συμβολοσειρά. Κάθε όρισμα μπορεί να είναι " -"οποιουδήποτε αριθμητικού τύπου (συμπεριλαμβανομένου του μιγαδικού). Εάν το " -"*imag* παραλειφθεί, είναι μηδέν από προεπιλογή, και ο constructor χρησιμεύει " -"ως αριθμητική μετατροπή όπως :class:`int` και :class:`float`. Εάν " -"παραληφθούν και τα δύο ορίσματα, επιστρέφει το ``0j``." - -#: library/functions.rst:386 -msgid "" -"For a general Python object ``x``, ``complex(x)`` delegates to ``x." -"__complex__()``. If :meth:`~object.__complex__` is not defined then it " -"falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " -"defined then it falls back to :meth:`~object.__index__`." -msgstr "" -"Για ένα γενικό αντικείμενο Python ``x``, ``complex(x)`` εκχωρεί στο ``x." -"__complex__()``. Εάν το :meth:`~object.__complex__` δεν έχει οριστεί, τότε " -"επιστρέφει στο :meth:`~object.__float__`. Εάν το :meth:`!__float__` δεν " -"έχει οριστεί , τότε επιστρέφει στο :meth:`~object.__index__`." - -#: library/functions.rst:393 -msgid "" -"When converting from a string, the string must not contain whitespace around " -"the central ``+`` or ``-`` operator. For example, ``complex('1+2j')`` is " -"fine, but ``complex('1 + 2j')`` raises :exc:`ValueError`." -msgstr "" -"Κατά την μετατροπή από μια συμβολοσειρά, η συμβολοσειρά δεν πρέπει να " -"περιέχει κενό διάστημα γύρω από τον κεντρικό τελεστή ``+`` ή ``-``. Για " -"παράδειγμα, ``complex('1+2j')`` είναι εντάξει, αλλά το ``complex('1 + 2j')`` " -"κάνει raise την :exc:`ValueError`." - -#: library/functions.rst:398 +#: library/functions.rst:379 +msgid "" +"Convert a single string or number to a complex number, or create a complex " +"number from real and imaginary parts." +msgstr "" +"Μετατρέπει μια συμβολοσειρά ή έναν αριθμό σε έναν μιγαδικό αριθμό ή " +"δημιουργεί έναν μιγαδικό αριθμός από πραγματικά και φανταστικά μέρη." + +#: library/functions.rst:756 library/functions.rst:1004 +msgid "Examples:" +msgstr "Παραδείγματα:" + +#: library/functions.rst:384 +msgid "" +">>> complex('+1.23')\n" +"(1.23+0j)\n" +">>> complex('-4.5j')\n" +"-4.5j\n" +">>> complex('-1.23+4.5j')\n" +"(-1.23+4.5j)\n" +">>> complex('\\t( -1.23+4.5J )\\n')\n" +"(-1.23+4.5j)\n" +">>> complex('-Infinity+NaNj')\n" +"(-inf+nanj)\n" +">>> complex(1.23)\n" +"(1.23+0j)\n" +">>> complex(imag=-4.5)\n" +"-4.5j\n" +">>> complex(-1.23, 4.5)\n" +"(-1.23+4.5j)" +msgstr "" +">>> complex('+1.23')\n" +"(1.23+0j)\n" +">>> complex('-4.5j')\n" +"-4.5j\n" +">>> complex('-1.23+4.5j')\n" +"(-1.23+4.5j)\n" +">>> complex('\\t( -1.23+4.5J )\\n')\n" +"(-1.23+4.5j)\n" +">>> complex('-Infinity+NaNj')\n" +"(-inf+nanj)\n" +">>> complex(1.23)\n" +"(1.23+0j)\n" +">>> complex(imag=-4.5)\n" +"-4.5j\n" +">>> complex(-1.23, 4.5)\n" +"(-1.23+4.5j)" + +#: library/functions.rst:403 +msgid "" +"If the argument is a string, it must contain either a real part (in the same " +"format as for :func:`float`) or an imaginary part (in the same format but " +"with a ``'j'`` or ``'J'`` suffix), or both real and imaginary parts (the " +"sign of the imaginary part is mandatory in this case). The string can " +"optionally be surrounded by whitespaces and the round parentheses ``'('`` " +"and ``')'``, which are ignored. The string must not contain whitespace " +"between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " +"number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " +"raises :exc:`ValueError`. More precisely, the input must conform to the :" +"token:`~float:complexvalue` production rule in the following grammar, after " +"parentheses and leading and trailing whitespace characters are removed:" +msgstr "" +"Αν το όρισμα είναι συμβολοσειρά, πρέπει να περιέχει είτε ένα πραγματικό " +"μέρος (στην ίδια μορφή όπως για το :func:`float`) είτε ένα φανταστικό μέρος " +"(στην ίδια μορφή αλλά με επίθημα ``'j'`` ή ``'J'``) ή και πραγματικά και " +"φανταστικά μέρη (το πρόσημο του φανταστικού τμήματος είναι υποχρεωτικό σε " +"αυτήν την περίπτωση). Η συμβολοσειρά μπορεί προαιρετικά να περιβάλλεται από " +"κενά διαστήματα και τις στρογγυλές παρενθέσεις ``'('`` και ``')'`` οι οποίες " +"αγνοούνται. Η συμβολοσειρά δεν πρέπει να περιέχει κενό διάστημα μεταξύ των " +"``'+'``, ``'-'`` του επιθέματος ``'j'`` ή ``'J'`` και του δεκαδικού αριθμού. " +"Για παράδειγμα, το ``complex('1+2j')`` είναι εντάξει, αλλά το ``complex('1 + " +"2j')`` κάνει raise μια :exc:`ValueError`. Πιο συγκεκριμένα, η είσοδος πρέπει " +"να συμμορφώνεται με τον κανόνας παραγωγής :token:`~float:complexvalue` στην " +"ακόλουθη γραμματική, αφού αφαιρεθούν οι παρενθέσεις και οι χαρακτήρες του " +"κενών διαστημάτων στο τέλος:" + +#: library/functions.rst:422 +msgid "" +"If the argument is a number, the constructor serves as a numeric conversion " +"like :class:`int` and :class:`float`. For a general Python object ``x``, " +"``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object." +"__complex__` is not defined then it falls back to :meth:`~object.__float__`. " +"If :meth:`!__float__` is not defined then it falls back to :meth:`~object." +"__index__`." +msgstr "" +"Εάν το όρισμα είναι αριθμός, ο κατασκευαστής χρησιμεύει ως αριθμητική " +"μετατροπή όπως :class:`int` και :class:`float`. Για ένα γενικό αντικείμενο " +"Python ``x``, το ``complex(x)`` εκχωρεί στο ``x.__complex__()``. Εάν το :" +"meth:`~object.__complex__` δεν έχει οριστεί, τότε επιστρέφει στο :meth:" +"`~object.__float__`. Εάν το :meth:`!__float__` δεν έχει οριστεί τότε " +"επιστρέφει στο :meth:`~object.__index__`." + +#: library/functions.rst:431 +msgid "" +"If two arguments are provided or keyword arguments are used, each argument " +"may be any numeric type (including complex). If both arguments are real " +"numbers, return a complex number with the real component *real* and the " +"imaginary component *imag*. If both arguments are complex numbers, return a " +"complex number with the real component ``real.real-imag.imag`` and the " +"imaginary component ``real.imag+imag.real``. If one of arguments is a real " +"number, only its real component is used in the above expressions." +msgstr "" +"Εάν παρέχονται δύο ορίσματα ή χρησιμοποιούνται ορίσματα λέξης-κλειδιού, κάθε " +"όρισμα μπορεί να είναι οποιουδήποτε αριθμητικού τύπου (συμπεριλαμβανομένων " +"των μιγαδικών). Εάν και τα δύο ορίσματα είναι πραγματικοί αριθμοί, " +"επιστρέψτε έναν μιγαδικό αριθμό με το πραγματικό στοιχείο *real* και το " +"φανταστικό στοιχείο *imag*. Εάν και τα δύο ορίσματα είναι μιγαδικοί αριθμοί, " +"επιστρέψτε έναν μιγαδικό αριθμό με το πραγματικό στοιχείο ``real.real-imag." +"imag`` και ``real.imag+imag.real``. Αν ένα από τα ορίσματα είναι πραγματικός " +"αριθμός, χρησιμοποιείται μόνο το πραγματικό στοιχείο στις παραπάνω εκφράσεις." + +#: library/functions.rst:441 +msgid "" +"See also :meth:`complex.from_number` which only accepts a single numeric " +"argument." +msgstr "" +"Δείτε επίσης την :meth:`complex.from_number` που δέχεται μόνο ένα αριθμητικό " +"όρισμα." + +#: library/functions.rst:443 +msgid "If all arguments are omitted, returns ``0j``." +msgstr "Εάν παραληφθούν όλα τα ορίσματα, επιστρέφει ``0j``." + +#: library/functions.rst:445 msgid "The complex type is described in :ref:`typesnumeric`." msgstr "Ο μιγαδικός τύπος περιγράφεται στο :ref:`typesnumeric`." -#: library/functions.rst:707 library/functions.rst:931 +#: library/functions.rst:810 library/functions.rst:1052 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "" "Επιτρέπεται η ομαδοποίηση ψηφίων με κάτω παύλες όπως στα literals του κώδικα." -#: library/functions.rst:403 +#: library/functions.rst:450 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" "meth:`~object.__float__` are not defined." @@ -1020,7 +1131,15 @@ msgstr "" "Επιστρέφει πίσω στη :meth:`~object.__index__` εάν η :meth:`~object." "__complex__` και η :meth:`~object.__float__` δεν ορίζονται." -#: library/functions.rst:410 +#: library/functions.rst:454 +msgid "" +"Passing a complex number as the *real* or *imag* argument is now deprecated; " +"it should only be passed as a single positional argument." +msgstr "" +"Η διαβίβαση ενός μιγαδικού αριθμού ως το *real* ή *imag* όρισμα έχει πλέον " +"καταργηθεί∙ θα πρέπει να διαβιβάζεται μόνο ως ένα μοναδικό όρισμα θέσης." + +#: library/functions.rst:461 msgid "" "This is a relative of :func:`setattr`. The arguments are an object and a " "string. The string must be the name of one of the object's attributes. The " @@ -1036,7 +1155,7 @@ msgstr "" "foobar``. Το *name* δεν χρειάζεται να είναι αναγνωριστικό της Python (δείτε :" "func:`setattr`)." -#: library/functions.rst:423 +#: library/functions.rst:474 msgid "" "Create a new dictionary. The :class:`dict` object is the dictionary class. " "See :class:`dict` and :ref:`typesmapping` for documentation about this class." @@ -1045,7 +1164,7 @@ msgstr "" "λεξικού. Δείτε το :class:`dict` και το :ref:`typesmapping` για τεκμηρίωση " "σχετικά με αυτή την κατηγορία." -#: library/functions.rst:426 +#: library/functions.rst:477 msgid "" "For other containers see the built-in :class:`list`, :class:`set`, and :" "class:`tuple` classes, as well as the :mod:`collections` module." @@ -1053,7 +1172,7 @@ msgstr "" "Για άλλα containers, δείτε τις ενσωματωμένες κλάσεις :class:`list`, :class:" "`set`, και :class:`tuple`, καθώς και το module :mod:`collections`." -#: library/functions.rst:433 +#: library/functions.rst:484 msgid "" "Without arguments, return the list of names in the current local scope. " "With an argument, attempt to return a list of valid attributes for that " @@ -1063,7 +1182,7 @@ msgstr "" "ένα όρισμα, προσπαθεί να επιστρέψει μια λίστα έγκυρων χαρακτηριστικών για " "αυτό το αντικείμενο." -#: library/functions.rst:436 +#: library/functions.rst:487 msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " @@ -1077,7 +1196,7 @@ msgstr "" "func:`~object.__getattr__` or :func:`~object.__getattribute__` για την " "προσαρμογή του τρόπου με τον οποίο η :func:`dir` αναφέρει τα χαρακτηριστικά." -#: library/functions.rst:443 +#: library/functions.rst:494 msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " @@ -1092,7 +1211,7 @@ msgstr "" "και μπορεί να είναι ανακριβής όταν το αντικείμενο έχει εξατομικευμένη :func:" "`~object.__getattr__`." -#: library/functions.rst:449 +#: library/functions.rst:500 msgid "" "The default :func:`dir` mechanism behaves differently with different types " "of objects, as it attempts to produce the most relevant, rather than " @@ -1102,7 +1221,7 @@ msgstr "" "διαφορετικούς τύπους αντικειμένων, καθώς προσπαθεί να παράγει τις πιο " "σχετικές και όχι τις πιο ολοκληρωμένες πληροφορίες:" -#: library/functions.rst:453 +#: library/functions.rst:504 msgid "" "If the object is a module object, the list contains the names of the " "module's attributes." @@ -1110,7 +1229,7 @@ msgstr "" "Εάν το αντικείμενο είναι module τύπου αντικειμένου, η λίστα περιέχει τα " "ονόματα των χαρακτηριστικών του module." -#: library/functions.rst:456 +#: library/functions.rst:507 msgid "" "If the object is a type or class object, the list contains the names of its " "attributes, and recursively of the attributes of its bases." @@ -1119,7 +1238,7 @@ msgstr "" "τα ονόματα των χαρακτηριστικών του, και αναδρομικά τα χαρακτηριστικά της " "βάσεώς του." -#: library/functions.rst:459 +#: library/functions.rst:510 msgid "" "Otherwise, the list contains the object's attributes' names, the names of " "its class's attributes, and recursively of the attributes of its class's " @@ -1129,11 +1248,11 @@ msgstr "" "αντικειμένου, τα ονόματα των χαρακτηριστικών της κλάσης, και αναδρομικά τα " "χαρακτηριστικά της κλάσης βάσεως της κλάσης." -#: library/functions.rst:463 +#: library/functions.rst:514 msgid "The resulting list is sorted alphabetically. For example:" msgstr "Η παραγόμενη λίστα είναι ταξινομημένη αλφαβητικά. Για παράδειγμα:" -#: library/functions.rst:483 +#: library/functions.rst:534 msgid "" "Because :func:`dir` is supplied primarily as a convenience for use at an " "interactive prompt, it tries to supply an interesting set of names more than " @@ -1149,12 +1268,12 @@ msgstr "" "μετακλάσης δεν βρίσκονται στη λίστα αποτελεσμάτων όταν το όρισμα είναι μια " "κλάση." -#: library/functions.rst:493 +#: library/functions.rst:544 msgid "" "Take two (non-complex) numbers as arguments and return a pair of numbers " "consisting of their quotient and remainder when using integer division. " "With mixed operand types, the rules for binary arithmetic operators apply. " -"For integers, the result is the same as ``(a // b, a % b)``. For floating " +"For integers, the result is the same as ``(a // b, a % b)``. For floating-" "point numbers the result is ``(q, a % b)``, where *q* is usually ``math." "floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` " "is very close to *a*, if ``a % b`` is non-zero it has the same sign as *b*, " @@ -1171,7 +1290,7 @@ msgstr "" "b`` δεν είναι μηδενικό, έχει το ίδιο πρόσημο όπως το *b*, και ``0 <= abs(a % " "b) < abs(b)``." -#: library/functions.rst:505 +#: library/functions.rst:556 msgid "" "Return an enumerate object. *iterable* must be a sequence, an :term:" "`iterator`, or some other object which supports iteration. The :meth:" @@ -1186,60 +1305,104 @@ msgstr "" "περιέχει μια καταμέτρηση (από το *start* που είναι με προεπιλογή στο 0) και " "τις τιμές που λαμβάνονται από την επανάληψη πάνω στο *iterable*." -#: library/functions.rst:517 +#: library/functions.rst:568 msgid "Equivalent to::" msgstr "Ισοδύναμο με::" -#: library/functions.rst:529 +#: library/functions.rst:570 msgid "" -"The arguments are a string and optional globals and locals. If provided, " -"*globals* must be a dictionary. If provided, *locals* can be any mapping " -"object." +"def enumerate(iterable, start=0):\n" +" n = start\n" +" for elem in iterable:\n" +" yield n, elem\n" +" n += 1" +msgstr "" +"def enumerate(iterable, start=0):\n" +" n = start\n" +" for elem in iterable:\n" +" yield n, elem\n" +" n += 1" + +#: library/functions.rst:0 +msgid "Parameters" +msgstr "Παράμετροι" + +#: library/functions.rst:580 +msgid "A Python expression." +msgstr "Μια έκφραση Python." + +#: library/functions.rst:584 +msgid "The global namespace (default: ``None``)." +msgstr "Το καθολικό namespace (προεπιλογή: ``None``)." + +#: library/functions.rst:588 +msgid "The local namespace (default: ``None``)." +msgstr "Το τοπικό namespace (προεπιλογή: ``None``)." + +#: library/functions.rst:0 +msgid "Returns" +msgstr "Επιστρέφει" + +#: library/functions.rst:592 +msgid "The result of the evaluated expression." +msgstr "Το αποτέλεσμα της αξιολογούμενης έκφρασης." + +#: library/functions.rst:0 +msgid "raises" +msgstr "κάνει raise" + +#: library/functions.rst:593 +msgid "Syntax errors are reported as exceptions." +msgstr "Τα συντακτικά σφάλματα αναφέρονται ως εξαιρέσεις." + +#: library/functions.rst:658 +msgid "" +"This function executes arbitrary code. Calling it with user-supplied input " +"may lead to security vulnerabilities." msgstr "" -"Τα ορίσματα είναι μια συμβολοσειρά (string), και προαιρετικά globals και " -"locals. Εάν παρέχεται το *globals* πρέπει να είναι λεξικό. Εάν παρέχεται " -"το *locals* μπορεί να είναι οποιοδήποτε αντικείμενο χαρτογράφησης." +"Αυτή η συνάρτηση εκτελεί αυθαίρετο κώδικα. Η κλήση της με είσοδο που " +"παρέχεται από το χρήστη μπορεί να οδηγήσει σε ευπάθειες ασφαλείας." -#: library/functions.rst:533 +#: library/functions.rst:600 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " -"dictionaries as global and local namespace. If the *globals* dictionary is " +"mappings as global and local namespace. If the *globals* dictionary is " "present and does not contain a value for the key ``__builtins__``, a " "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " "own ``__builtins__`` dictionary into *globals* before passing it to :func:" -"`eval`. If the *locals* dictionary is omitted it defaults to the *globals* " -"dictionary. If both dictionaries are omitted, the expression is executed " -"with the *globals* and *locals* in the environment where :func:`eval` is " -"called. Note, *eval()* does not have access to the :term:`nested scopes " -"` (non-locals) in the enclosing environment." +"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " +"dictionary. If both mappings are omitted, the expression is executed with " +"the *globals* and *locals* in the environment where :func:`eval` is called. " +"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " +"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" +"`nonlocal` statement)." msgstr "" "Το όρισμα *expression* αναλύεται και αξιολογείται ως μια έκφραση της Python " -"(από τεχνικής άποψης, μια λίστα συνθηκών) χρησιμοποιώντας τα λεξικά " -"(dictionaries) *globals* και *locals* ως global και local namespace. Εάν το " -"λεξικό *globals* υπάρχει και δεν περιέχει μια τιμή για το κλειδί " -"``__builtins__``, μια αναφορά στο λεξικό του ενσωματωμένου module :mod:" -"`builtins` εισάγεται κάτω από αυτό το κλειδί πριν αναλυθεί το *expression*. " -"Με αυτόν τον τρόπο μπορείτε να ελέγξετε ποια από τα ενσωματωμένα στοιχεία " -"είναι διαθέσιμα για τον εκτελέσιμο κώδικα, εισάγοντας το δικό σας λεξικό " -"``__builtins__`` στο *globals* πριν διαβαστεί στη :func:`eval`. Εάν το " -"λεξικό *locals* παραλειφθεί, ορίζεται από προεπιλογή στο λεξικό *globals*. " -"Εάν παραληφθούν και τα δύο λεξικά, η έκφραση εκτελείται με τα *globals* και " -"*locals* στο περιβάλλον όπου καλείται η :func:`eval`. Σημείωση, το *eval()* " -"δεν έχει πρόσβαση στο :term:`nested scopes ` (μη τοπικά) στο " -"περιβάλλον που περικλείει." - -#: library/functions.rst:548 -msgid "" -"The return value is the result of the evaluated expression. Syntax errors " -"are reported as exceptions. Example:" -msgstr "" -"Η τιμή που επιστρέφεται είναι το αποτέλεσμα της αξιολογούμενης έκφρασης. Τα " -"σφάλματα σύνταξης αναφέρονται ως εξαιρέσεις. Παράδειγμα:" - -#: library/functions.rst:555 +"(από τεχνικής άποψης, μια λίστα συνθηκών) χρησιμοποιώντας τις αντιστοιχίσεις " +"*globals* και *locals* ως global και local namespace. Εάν το λεξικό " +"*globals* υπάρχει και δεν περιέχει μια τιμή για το κλειδί ``__builtins__``, " +"μια αναφορά στο λεξικό του ενσωματωμένου module :mod:`builtins` εισάγεται " +"κάτω από αυτό το κλειδί πριν αναλυθεί το *expression*. Με αυτόν τον τρόπο " +"μπορείτε να ελέγξετε ποια από τα ενσωματωμένα στοιχεία είναι διαθέσιμα για " +"τον εκτελέσιμο κώδικα, εισάγοντας το δικό σας λεξικό ``__builtins__`` στο " +"*globals* πριν διαβαστεί στη :func:`eval`. Εάν το λεξικό *locals* " +"παραλειφθεί, ορίζεται από προεπιλογή στο λεξικό *globals*. Εάν παραληφθούν " +"και οι δύο αντιστοιχίσεις, η έκφραση εκτελείται με τα *globals* και *locals* " +"στο περιβάλλον όπου καλείται η :func:`eval`. Σημείωση, το *eval()* θα έχει " +"πρόσβαση στο :term:`nested scopes ` (μη τοπικούς) του " +"περιβάλλοντος που την περικλείει μόνο εάν αυτοί έχουν ήδη αναφερθεί στον " +"χώρο ονομάτων που καλεί τη :func:`eval` (π.χ. μέσω μιας δήλωσης :keyword:" +"`nonlocal`)." + +#: library/functions.rst:616 +msgid "Example:" +msgstr "Παράδειγμα:" + +#: library/functions.rst:622 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1253,7 +1416,7 @@ msgstr "" "ως το όρισμα *mode*, η επιστρεφόμενη τιμή του :func:`eval`\\'s θα είναι " "``None``." -#: library/functions.rst:560 +#: library/functions.rst:627 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1265,7 +1428,7 @@ msgstr "" "τρέχον global και local λεξικό, αντίστοιχα, το οποίο μπορεί να είναι χρήσιμο " "για μεταβίβαση γύρω από τη χρήση από τις :func:`eval` ή :func:`exec`." -#: library/functions.rst:565 +#: library/functions.rst:632 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." @@ -1273,7 +1436,7 @@ msgstr "" "Εάν η δεδομένη πηγή είναι μια συμβολοσειρά, τότε αφαιρούνται τα κενά και τα " "tabs που προηγούνται ή έπονται." -#: library/functions.rst:568 +#: library/functions.rst:635 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1281,15 +1444,7 @@ msgstr "" "Βλ. τη :func:`ast.literal_eval` για μια συνάρτηση που μπορεί με ασφάλεια να " "αξιολογήσει τις συμβολοσειρές με εκφράσεις που περιέχουν μόνο literals." -#: library/functions.rst:612 -msgid "" -"Raises an :ref:`auditing event ` ``exec`` with argument " -"``code_object``." -msgstr "" -"Κάνει raise ένα :ref:`auditing event ` ``exec`` με όρισμα " -"``code_object``." - -#: library/functions.rst:614 +#: library/functions.rst:640 library/functions.rst:702 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1297,9 +1452,23 @@ msgstr "" "Κάνει raise ένα :ref:`auditing event ` ``exec`` με το αντικείμενο " "κώδικα ως όρισμα. Μπορεί επίσης να εμφανιστούν συμβάντα μεταγλώττισης κώδικα." -#: library/functions.rst:580 +#: library/functions.rst:722 +msgid "The *globals* and *locals* arguments can now be passed as keywords." +msgstr "" +"Τα ορίσματα *globals* και *locals* υποστηρίζονται πλέον και ως ορίσματα " +"λέξεων-κλειδιών." + +#: library/functions.rst:726 msgid "" -"This function supports dynamic execution of Python code. *object* must be " +"The semantics of the default *locals* namespace have been adjusted as " +"described for the :func:`locals` builtin." +msgstr "" +"Η σημασιολογία του προεπιλεγμένου ονόματος χώρου *locals* έχει τροποποιηθεί, " +"όπως περιγράφεται για την ενσωματωμένη συνάρτηση :func:`locals`." + +#: library/functions.rst:661 +msgid "" +"This function supports dynamic execution of Python code. *source* must be " "either a string or a code object. If it is a string, the string is parsed " "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " @@ -1309,7 +1478,7 @@ msgid "" "not be used outside of function definitions even within the context of code " "passed to the :func:`exec` function. The return value is ``None``." msgstr "" -"Αυτή η συνάρτηση υποστηρίζει δυναμική εκτέλεση κώδικα Python. Το *object* " +"Αυτή η συνάρτηση υποστηρίζει δυναμική εκτέλεση κώδικα Python. Το *source* " "πρέπει να είναι είτε μια συμβολοσειρά (string) είτε ένα αντικείμενο κώδικα. " "Εάν είναι μια συμβολοσειρά, η συμβολοσειρά αναλύεται ως μια σουίτα δηλώσεων " "Python που στη συνέχεια εκτελείται (εκτός εάν παρουσιαστεί σφάλμα σύνταξης). " @@ -1321,7 +1490,7 @@ msgstr "" "συναρτήσεων, ακόμη και στο πλαίσιο του κώδικα που διαβιβάζεται στη :func:" "`exec`. Η επιστρεφόμενη τιμή είναι ``None``." -#: library/functions.rst:591 +#: library/functions.rst:672 msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " "current scope. If only *globals* is provided, it must be a dictionary (and " @@ -1329,20 +1498,31 @@ msgid "" "the local variables. If *globals* and *locals* are given, they are used for " "the global and local variables, respectively. If provided, *locals* can be " "any mapping object. Remember that at the module level, globals and locals " -"are the same dictionary. If exec gets two separate objects as *globals* and " -"*locals*, the code will be executed as if it were embedded in a class " -"definition." +"are the same dictionary." msgstr "" "Σε όλες τις περιπτώσεις, εάν παραληφθούν τα προαιρετικά μέρη, ο κώδικας " "εκτελείται στο τρέχον εύρος. Εάν παρέχεται μόνο *globals*, πρέπει να είναι " "ένα λεξικό (και όχι μια υποκατηγορία λεξικού), το οποίο θα χρησιμοποιείται " "και για τις δύο μεταβλητές αντίστοιχα. Εάν παρέχονται τα *locals* μπορεί να " "είναι οποιοδήποτε αντικείμενο αντιστοίχισης. Να θυμάστε ότι σε επίπεδο " -"module, τα globals και locals είναι το ίδιο λεξικό. Εάν το exec λάβει δύο " -"ξεχωριστά αντικείμενα ως *globals* και *locals*, ο κώδικας θα εκτελεστεί σαν " -"να ήταν ενσωματωμένος σε έναν ορισμό κλάσης." +"module, τα globals και locals είναι το ίδιο λεξικό." -#: library/functions.rst:601 +#: library/functions.rst:682 +msgid "" +"When ``exec`` gets two separate objects as *globals* and *locals*, the code " +"will be executed as if it were embedded in a class definition. This means " +"functions and classes defined in the executed code will not be able to " +"access variables assigned at the top level (as the \"top level\" variables " +"are treated as class variables in a class definition)." +msgstr "" +"Όταν η ``exec`` λαμβάνει δύο ξεχωριστά αντικείμενα ως *globals* και " +"*locals*, ο κώδικας εκτελείται σαν να ήταν ενσωματωμένος σε ορισμό κλάσης. " +"Αυτό σημαίνει ότι συναρτήσεις και κλάσεις που ορίζονται στον εκτελούμενο " +"κώδικα δεν θα έχουν πρόσβαση σε μεταβλητές που έχουν οριστεί στο ανώτερο " +"επίπεδο (καθώς αυτές οι \"ανωτέρου επιπέδου\" μεταβλητές θεωρούνται ως " +"μεταβλητές κλάσης, όπως συμβαίνει μέσα σε έναν ορισμό κλάσης)." + +#: library/functions.rst:688 msgid "" "If the *globals* dictionary does not contain a value for the key " "``__builtins__``, a reference to the dictionary of the built-in module :mod:" @@ -1357,47 +1537,45 @@ msgstr "" "το δικό σας ``__builtins__`` λεξικό στο *globals* πριν το διαβάσετε στο :" "func:`exec`." -#: library/functions.rst:607 +#: library/functions.rst:694 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " -"valid when the *object* is a code object containing free variables. The " -"length of the tuple must exactly match the number of free variables " -"referenced by the code object." +"valid when the *object* is a code object containing :term:`free (closure) " +"variables `. The length of the tuple must exactly match " +"the length of the code object's :attr:`~codeobject.co_freevars` attribute." msgstr "" "Το όρισμα *closure* καθορίζει ένα clossure--μια πλειάδα από cellvars. Είναι " -"έγκυρο μόνο όταν το *object* είναι ένα αντικείμενο κώδικα που περιέχει " -"ελεύθερες μεταβλητές. Το μήκος της πλειάδας πρέπει να ταιριάζει ακριβώς με " -"τον αριθμό των ελεύθερων μεταβλητών που αναφέρονται από το αντικείμενο " -"κώδικα." +"έγκυρο μόνο όταν το *object* είναι ένα αντικείμενο κώδικα που περιέχει :term:" +"`free (closure) variables `. Το μήκος της πλειάδας πρέπει " +"να ταιριάζει ακριβώς με το μήκος το χαρακτηριστικό :attr:`~codeobject." +"co_freevars` του αντικειμένου κώδικα." -#: library/functions.rst:619 +#: library/functions.rst:707 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " -"global and local dictionary, respectively, which may be useful to pass " -"around for use as the second and third argument to :func:`exec`." +"global and local namespace, respectively, which may be useful to pass around " +"for use as the second and third argument to :func:`exec`." msgstr "" "Οι ενσωματωμένες συναρτήσεις :func:`globals` και :func:`locals` επιστρέφουν " -"το τρέχον global και local λεξικό, αντίστοιχα, που μπορεί να είναι χρήσιμο " -"για χρήση ως δεύτερο και τρίτο όρισμα στο :func:`exec`." +"το τρέχον χώρο ονομάτων global και local, αντίστοιχα, που μπορεί να είναι " +"χρήσιμο για χρήση ως δεύτερο και τρίτο όρισμα στο :func:`exec`." -#: library/functions.rst:625 +#: library/functions.rst:713 msgid "" -"The default *locals* act as described for function :func:`locals` below: " -"modifications to the default *locals* dictionary should not be attempted. " +"The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" "Το προεπιλεγμένο *locals* ενεργεί όπως περιγράφεται για τη συνάρτηση :func:" -"`locals` παρακάτω: δεν πρέπει να επιχειρήσετε τροποποιήσεις στο " -"προεπιλεγμένο *locals* λεξικό. Περνάει ένα ρητό *locals* λεξικό εάν θέλετε " -"να δείτε τα αποτελέσματα του κώδικα στο *locals* με την επιστροφή της " -"συνάρτησης :func:`exec`." +"`locals` παρακάτω. Δώστε ρητά ένα λεξικό *locals* αν χρειάζεται να δείτε τις " +"επιδράσεις του κώδικα *locals* μετά την επιστροφή της συνάρτησης :func:" +"`exec`." -#: library/functions.rst:630 +#: library/functions.rst:717 msgid "Added the *closure* parameter." msgstr "Προστέθηκε η παράμετρος *closure*." -#: library/functions.rst:636 +#: library/functions.rst:732 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1410,7 +1588,7 @@ msgstr "" "*function* είναι ``None``, η συνάρτηση ταυτότητας υποτίθεται, δηλαδή, όλα τα " "στοιχεία του *iterable* που είναι ψευδή αφαιρούνται." -#: library/functions.rst:642 +#: library/functions.rst:738 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1422,7 +1600,7 @@ msgstr "" "η συνάρτηση δεν είναι ``None`` και ``(item for item in iterable if item)`` " "εάν η συνάρτηση είναι ``None``." -#: library/functions.rst:647 +#: library/functions.rst:743 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1430,33 +1608,57 @@ msgstr "" "Βλ. :func:`itertools.filterfalse` για τη συμπληρωματική συνάρτηση που " "επιστρέφει στοιχεία του *iterable* για τα οποία η *function* είναι ψευδής." -#: library/functions.rst:657 -msgid "Return a floating point number constructed from a number or string *x*." +#: library/functions.rst:754 +msgid "Return a floating-point number constructed from a number or a string." msgstr "" "Επιστέφει έναν αριθμό κινητής υποδιαστολής που κατασκευάστηκε από έναν " -"αριθμό ή μια συμβολοσειρά *x*." - -#: library/functions.rst:659 +"αριθμό ή μια συμβολοσειρά." + +#: library/functions.rst:758 +msgid "" +">>> float('+1.23')\n" +"1.23\n" +">>> float(' -12345\\n')\n" +"-12345.0\n" +">>> float('1e-003')\n" +"0.001\n" +">>> float('+1E6')\n" +"1000000.0\n" +">>> float('-Infinity')\n" +"-inf" +msgstr "" +">>> float('+1.23')\n" +"1.23\n" +">>> float(' -12345\\n')\n" +"-12345.0\n" +">>> float('1e-003')\n" +"0.001\n" +">>> float('+1E6')\n" +"1000000.0\n" +">>> float('-Infinity')\n" +"-inf" + +#: library/functions.rst:771 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " "sign may be ``'+'`` or ``'-'``; a ``'+'`` sign has no effect on the value " "produced. The argument may also be a string representing a NaN (not-a-" -"number), or positive or negative infinity. More precisely, the input must " -"conform to the ``floatvalue`` production rule in the following grammar, " -"after leading and trailing whitespace characters are removed:" +"number), or positive or negative infinity. More precisely, the input must " +"conform to the :token:`~float:floatvalue` production rule in the following " +"grammar, after leading and trailing whitespace characters are removed:" msgstr "" "Εάν το όρισμα είναι συμβολοσειρά (string), θα πρέπει να περιέχει έναν " "δεκαδικό αριθμό, προαιρετικά πριν από ένα σύμβολο και προαιρετικά " "ενσωματωμένο σε κενό διάστημα. Το προαιρετικό πρόσημο μπορεί να είναι " -"``'+'`` ή ``'-'``∙ ένα σύμβολο ``'+'`` δεν έχει καμία επίδραση στην τιμή που " -"παράγεται. Το όρισμα μπορεί επίσης να είναι μια συμβολοσειρά που " -"αντιπροσωπεύει ένα NaN (not-a-number), ή θετικό η αρνητικό άπειρο. Πιο " -"συγκεκριμένα, η είσοδος πρέπει να συμμορφώνεται με τον κανόνα παραγωγής " -"``floatvalue`` στην ακόλουθη γραμματική, αφού αφαιρεθούν οι χαρακτήρες κενού " -"διαστήματος που έπονται και προηγούνται:" +"``'+'`` ή ``'-'`` ∙ ένα σύμβολο ``'+'`` δεν έχει καμία επίδραση στην τιμή " +"που παράγεται. Το όρισμα μπορεί επίσης να είναι μια συμβολοσειρά που " +"αντιπροσωπεύει ένα NaN (not-a-number), ή θετικό η αρνητικό άπειρο. Πιο " +"συγκεκριμένα, η είσοδος πρέπει να συμμορφώνεται με τον κανόνα παραγωγής :" +"token:`~float:floatvalue` στην ακόλουθη γραμματική, αφού αφαιρεθούν οι " +"χαρακτήρες κενού διαστήματος που έπονται και προηγούνται:" -#: library/functions.rst:678 +#: library/functions.rst:792 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1465,10 +1667,10 @@ msgstr "" "\"Inf\", \"INFINITY\", και \"iNfINity\" είναι όλες αποδεκτές ορθογραφίες για " "το θετικό άπειρο." -#: library/functions.rst:681 +#: library/functions.rst:795 msgid "" -"Otherwise, if the argument is an integer or a floating point number, a " -"floating point number with the same value (within Python's floating point " +"Otherwise, if the argument is an integer or a floating-point number, a " +"floating-point number with the same value (within Python's floating-point " "precision) is returned. If the argument is outside the range of a Python " "float, an :exc:`OverflowError` will be raised." msgstr "" @@ -1477,7 +1679,7 @@ msgstr "" "ακρίβειας κινητής υποδιαστολής της Python). Εάν το όρισμα βρίσκεται εκτός " "του εύρους ενός float της Python θα γίνει raise ένα :exc:`OverflowError`." -#: library/functions.rst:686 +#: library/functions.rst:800 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1487,19 +1689,21 @@ msgstr "" "__float__()``. Εάν το :meth:`~object.__float__` δεν έχει οριστεί, τότε " "επιστρέφει στο :meth:`~object.__index__`." -#: library/functions.rst:690 +#: library/functions.rst:804 +msgid "" +"See also :meth:`float.from_number` which only accepts a numeric argument." +msgstr "" +"Δείτε επίσης τη :meth:`float.from_number` που δέχεται μόνο αριθμητικό όρισμα." + +#: library/functions.rst:806 msgid "If no argument is given, ``0.0`` is returned." msgstr "Εάν δεν δοθεί όρισμα, επιστρέφεται το ``0.0``." -#: library/functions.rst:692 -msgid "Examples::" -msgstr "Παραδείγματα::" - -#: library/functions.rst:705 +#: library/functions.rst:808 msgid "The float type is described in :ref:`typesnumeric`." msgstr "Ο τύπος float περιγράφεται στο :ref:`typesnumeric`." -#: library/functions.rst:713 +#: library/functions.rst:816 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." @@ -1507,7 +1711,7 @@ msgstr "" "Επιστρέφει στο :meth:`~object.__index__` εάν το :meth:`~object.__float__` " "δεν έχει οριστεί." -#: library/functions.rst:723 +#: library/functions.rst:826 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1520,7 +1724,7 @@ msgstr "" "χρησιμοποιείται από τους περισσότερους ενσωματωμένους τύπους: :ref:" "`formatspec`." -#: library/functions.rst:728 +#: library/functions.rst:831 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1528,7 +1732,7 @@ msgstr "" "Η προεπιλεγμένη *format_spec* είναι μια κενή συμβολοσειρά που συνήθως δίνει " "το ίδιο αποτέλεσμα με την κλήση του :func:`str(value) `." -#: library/functions.rst:731 +#: library/functions.rst:834 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1544,7 +1748,7 @@ msgstr "" "φτάσει στο :mod:`object` και το *format_spec* δεν είναι κενό ή εάν είτε το " "*format_spec* είτε η τιμή επιστροφής δεν είναι συμβολοσειρές." -#: library/functions.rst:738 +#: library/functions.rst:841 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1552,7 +1756,7 @@ msgstr "" "Το ``object().__format__(format_spec)`` κάνει raise το :exc:`TypeError` εάν " "το *format_spec* δεν είναι κενή συμβολοσειρά." -#: library/functions.rst:747 +#: library/functions.rst:850 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1563,7 +1767,7 @@ msgstr "" "κλάση. Δείτε το :class:`frozenset` και το :ref:`types-set` για τεκμηρίωση " "αυτής της κλάσης." -#: library/functions.rst:751 +#: library/functions.rst:854 msgid "" "For other containers see the built-in :class:`set`, :class:`list`, :class:" "`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." @@ -1572,7 +1776,7 @@ msgstr "" "class:`list`, :class:`tuple`, και :class:`dict`, καθώς και το module :mod:" "`collections`." -#: library/functions.rst:759 +#: library/functions.rst:862 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1590,7 +1794,7 @@ msgstr "" "`AttributeError`. Το *name* δεν χρειάζεται να είναι αναγνωριστικό Python " "(δείτε :func:`setattr`)." -#: library/functions.rst:768 +#: library/functions.rst:871 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1602,7 +1806,7 @@ msgstr "" "χειροκίνητα το όνομα ενός ιδιωτικού χαρακτηριστικού (χαρακτηριστικά με δύο " "κορυφαίες υπογραμμίσεις) για να ανακτήσει με :func:`getattr`." -#: library/functions.rst:776 +#: library/functions.rst:879 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1612,7 +1816,7 @@ msgstr "" "κώδικα εντός συναρτήσεων, αυτό ορίζεται όταν ορίζεται η συνάρτηση και " "παραμένει το ίδιο ανεξάρτητη από το που καλείται η συνάρτηση." -#: library/functions.rst:783 +#: library/functions.rst:886 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1625,7 +1829,7 @@ msgstr "" "καλώντας το ``getattr(object, name)`` και να δούμε αν γίνεται raise ένα :exc:" "`AttributeError` ή όχι.)" -#: library/functions.rst:791 +#: library/functions.rst:894 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1638,7 +1842,7 @@ msgstr "" "αριθμητικές τιμές που συγκρίνονται ίσες έχουν την ίδια τιμή κατακερματισμού " "(ακόμα και αν είναι διαφορετικοί τύποι, όπως συμβαίνει για τα 1 και 1.0)." -#: library/functions.rst:798 +#: library/functions.rst:901 msgid "" "For objects with custom :meth:`~object.__hash__` methods, note that :func:" "`hash` truncates the return value based on the bit width of the host machine." @@ -1647,7 +1851,7 @@ msgstr "" "σημειώστε ότι το :func:`hash` περικόπτει την τιμή επιστροφής με βάση το " "πλάτος bit του υπολογιστή." -#: library/functions.rst:805 +#: library/functions.rst:908 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1665,7 +1869,7 @@ msgstr "" "είναι οποιοδήποτε άλλο είδος αντικειμένου, δημιουργείται μια σελίδα βοήθειας " "στο αντικείμενο." -#: library/functions.rst:812 +#: library/functions.rst:915 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1677,14 +1881,14 @@ msgstr "" "την κάθετο είναι μόνο θέσης. Για περισσότερες πληροφορίες, βλέπε :ref:`the " "FAQ entry on positional-only parameters `." -#: library/functions.rst:817 +#: library/functions.rst:920 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "" "Αυτή η συνάρτηση προστίθεται στον ενσωματωμένο χώρο ονομάτων από το module :" "mod:`site`." -#: library/functions.rst:819 +#: library/functions.rst:922 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1692,18 +1896,18 @@ msgstr "" "Οι αλλαγές σε :mod:`pydoc` και :mod:`inspect` σημαίνουν ότι οι αναφερόμενες " "υπογραφές για callables είναι πλέον πιο ολοκληρωμένες και συνεπείς." -#: library/functions.rst:826 +#: library/functions.rst:929 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " -"\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" -"meth:`~object.__index__` method that returns an integer. Some examples:" +"\"0x\". If *integer* is not a Python :class:`int` object, it has to define " +"an :meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" "Μετατροπή ενός ακεραίου αριθμού σε μια πεζή δεκαεξαδική συμβολοσειρά " -"(string) με πρόθεμα το \"0x\". Εάν το *x* δεν είναι αντικείμενο Python :" -"class:`int`, πρέπει να ορίσει μια μέθοδο :meth:`~object.__index__` που " -"επιστρέφει έναν ακέραιο αριθμό. Κάποια παραδείγματα:" +"(string) με πρόθεμα το \"0x\". Εάν το *integer* δεν είναι αντικείμενο " +"Python :class:`int`, πρέπει να ορίσει μια μέθοδο :meth:`~object.__index__` " +"που επιστρέφει έναν ακέραιο αριθμό. Κάποια παραδείγματα:" -#: library/functions.rst:835 +#: library/functions.rst:938 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1713,7 +1917,7 @@ msgstr "" "δεκαεξαδική συμβολοσειρά (string) με πρόθεμα ή όχι, μπορείτε να " "χρησιμοποιήσετε έναν από τους παρακάτω τρόπους:" -#: library/functions.rst:847 +#: library/functions.rst:950 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." @@ -1721,7 +1925,7 @@ msgstr "" "Δείτε επίσης τη :func:`int` για τη μετατροπή μιας δεκαεξαδικής συμβολοσειράς " "σε ακέραιο χρησιμοποιώντας μια βάση του 16." -#: library/functions.rst:852 +#: library/functions.rst:955 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." @@ -1729,7 +1933,7 @@ msgstr "" "Για να αποκτήσετε μια αναπαράσταση δεκαεξαδικής συμβολοσειράς για ένα float, " "χρησιμοποιήστε τη μέθοδο :meth:`float.hex`." -#: library/functions.rst:858 +#: library/functions.rst:961 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1741,11 +1945,11 @@ msgstr "" "αντικείμενο κατά τη διάρκεια της ζωής του. Δύο αντικείμενα με μη " "επικαλυπτόμενες διάρκειες ζωής μπορεί να έχουν την ίδια τιμή :func:`id`." -#: library/functions.rst:863 +#: library/functions.rst:966 msgid "This is the address of the object in memory." msgstr "Αυτό είναι η διεύθυνση του αντικειμένου στην μνήμη." -#: library/functions.rst:865 +#: library/functions.rst:968 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." @@ -1753,7 +1957,7 @@ msgstr "" "Εγείρει ένα :ref:`auditing event ` ``builtins.id`` με όρισμα " "``id``." -#: library/functions.rst:871 +#: library/functions.rst:974 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1766,7 +1970,19 @@ msgstr "" "γραμμής) και την επιστρέφει. Όταν διαβάζεται το EOF, γίνεται raise η :exc:" "`EOFError`. Παράδειγμα::" -#: library/functions.rst:881 +#: library/functions.rst:979 +msgid "" +">>> s = input('--> ')\n" +"--> Monty Python's Flying Circus\n" +">>> s\n" +"\"Monty Python's Flying Circus\"" +msgstr "" +">>> s = input('--> ')\n" +"--> Monty Python's Flying Circus\n" +">>> s\n" +"\"Monty Python's Flying Circus\"" + +#: library/functions.rst:984 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1775,15 +1991,7 @@ msgstr "" "χρησιμοποιήσει για να παρέχει περίπλοκες λειτουργίες επεξεργασίας γραμμής " "και ιστορικού." -#: library/functions.rst:884 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.input`` with argument " -"``prompt``." -msgstr "" -"Κάνει raise ένα :ref:`auditing event ` ``builtins.input`` με " -"όρισμα ``prompt``." - -#: library/functions.rst:886 +#: library/functions.rst:989 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1791,15 +1999,7 @@ msgstr "" "Κάνει raise ένα :ref:`auditing event ` ``builtins.input`` με " "όρισμα ``prompt`` προτού διαβάσει την είσοδο" -#: library/functions.rst:889 -msgid "" -"Raises an :ref:`auditing event ` ``builtins.input/result`` with " -"argument ``result``." -msgstr "" -"Κάνει raise ένα :ref:`auditing event ` ``builtins.input/result`` " -"με όρισμα ``result``." - -#: library/functions.rst:891 +#: library/functions.rst:994 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1807,38 +2007,69 @@ msgstr "" "Κάνει raise ένα :ref:`auditing event ` ``builtins.input/result`` " "με το αποτέλεσμα μετά την επιτυχή ανάγνωση των δεδομένων." -#: library/functions.rst:898 -msgid "" -"Return an integer object constructed from a number or string *x*, or return " -"``0`` if no arguments are given. If *x* defines :meth:`~object.__int__`, " -"``int(x)`` returns ``x.__int__()``. If *x* defines :meth:`~object." -"__index__`, it returns ``x.__index__()``. If *x* defines :meth:`~object." -"__trunc__`, it returns ``x.__trunc__()``. For floating point numbers, this " -"truncates towards zero." -msgstr "" -"Επιστρέφει ένα ακέραιο αντικείμενο που έχει δημιουργηθεί από έναν αριθμό ή " -"συμβολοσειρά *x*, ή επιστρέφει ``0`` εάν δεν δίνονται ορίσματα. Εάν το *x* " -"ορίζει :meth:`~object.__int__`, ``int(x)`` επιστρέφει ``x.__int__()``. Εάν " -"το *x* ορίζει :meth:`~object.__index__`, επιστρέφει``x.__index__()``. Εάν το " -"*x* ορίζει :meth:`~object.__trunc__`, επιστρέφει``x.__trunc__()``. Για " -"αριθμούς κινητής υποδιαστολής, αυτό περικόπτεται προς το μηδέν." - -#: library/functions.rst:905 +#: library/functions.rst:1001 msgid "" -"If *x* is not a number or if *base* is given, then *x* must be a string, :" -"class:`bytes`, or :class:`bytearray` instance representing an integer in " -"radix *base*. Optionally, the string can be preceded by ``+`` or ``-`` " -"(with no space in between), have leading zeros, be surrounded by whitespace, " -"and have single underscores interspersed between digits." +"Return an integer object constructed from a number or a string, or return " +"``0`` if no arguments are given." msgstr "" -"Εάν το *x* δεν είναι ένα αριθμός ή εάν το *base* δίνεται, τότε το *x* πρέπει " -"να είναι μια συμβολοσειρά, η :class:`bytes`, ή :class:`bytearray` instances " -"αντιπροσωπεύουν έναν ακέραιο στην ρίζα του *base*. Προαιρετικά, η " -"συμβολοσειρά μπορεί να προηγηθεί από ``+`` ή ``-`` (χωρίς κενά ενδιάμεσα), " -"προηγούνται από δυναμικά, περιβάλλονται από κενό διάστημα και έχουν μονές " -"κάτω παύλες μεταξύ των ψηφίων." - -#: library/functions.rst:911 +"Επιστέφει έναν αριθμό κινητής υποδιαστολής που κατασκευάστηκε από έναν " +"αριθμό ή μια συμβολοσειρά, ή επιστρέφει ``0`` εάν δεν δίνεται κάποιο όρισμα." + +#: library/functions.rst:1006 +msgid "" +">>> int(123.45)\n" +"123\n" +">>> int('123')\n" +"123\n" +">>> int(' -12_345\\n')\n" +"-12345\n" +">>> int('FACE', 16)\n" +"64206\n" +">>> int('0xface', 0)\n" +"64206\n" +">>> int('01110011', base=2)\n" +"115" +msgstr "" +">>> int(123.45)\n" +"123\n" +">>> int('123')\n" +"123\n" +">>> int(' -12_345\\n')\n" +"-12345\n" +">>> int('FACE', 16)\n" +"64206\n" +">>> int('0xface', 0)\n" +"64206\n" +">>> int('01110011', base=2)\n" +"115" + +#: library/functions.rst:1021 +msgid "" +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." +"__int__()``. If the argument defines :meth:`~object.__index__`, it returns " +"``x.__index__()``. For floating-point numbers, this truncates towards zero." +msgstr "" +"Εάν το όρισμα ορίζει :meth:`~object.__int__`, ``int(x)`` επιστρέφει ``x." +"__int__()``. Εάν το όρισμα ορίζει :meth:`~object.__index__`, επιστρέφει ``x." +"__index__()``. Για αριθμούς κινητής υποδιαστολής, αυτό περικόπτεται προς το " +"μηδέν." + +#: library/functions.rst:1026 +msgid "" +"If the argument is not a number or if *base* is given, then it must be a " +"string, :class:`bytes`, or :class:`bytearray` instance representing an " +"integer in radix *base*. Optionally, the string can be preceded by ``+`` or " +"``-`` (with no space in between), have leading zeros, be surrounded by " +"whitespace, and have single underscores interspersed between digits." +msgstr "" +"Εάν το όρισμα δεν είναι αριθμός ή εάν δίνεται *base*, τότε πρέπει να είναι " +"μια συμβολοσειρά , :class:`bytes`, ή :class:`bytearray` που αντιπροσωπεύει " +"έναν ακέραιο αριθμό στην ρίζα *base*. Προαιρετικά, η συμβολοσειρά μπορεί να " +"προηγείται από ``+`` ή ``-`` (χωρίς κενό ενδιάμεσο), να έχει αρχικά " +"μηδενικά, να περιβάλλεται από κενό διάστημα και να έχει μονές υπογραμμίσεις " +"διάσπαρτες μεταξύ των ψηφίων." + +#: library/functions.rst:1032 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1864,11 +2095,11 @@ msgstr "" "βάση 0 δεν επιτρέπει επίσης τα μηδενικά στην αρχή : ``int('010', 0)`` δεν " "είναι εφικτό, ενώ το ``int('010')`` και ``int('010', 8)`` είναι." -#: library/functions.rst:922 +#: library/functions.rst:1043 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "Ο ακέραιος τύπος περιγράφεται στο :ref:`typesnumeric`." -#: library/functions.rst:924 +#: library/functions.rst:1045 msgid "" "If *base* is not an instance of :class:`int` and the *base* object has a :" "meth:`base.__index__ ` method, that method is called to " @@ -1881,7 +2112,11 @@ msgstr "" "εκδόσεις χρησιμοποιούσαν την :meth:`base.__int__ ` αντί της :" "meth:`base.__index__ `." -#: library/functions.rst:937 +#: library/functions.rst:1055 +msgid "The first parameter is now positional-only." +msgstr "Η πρώτη παράμετρος είναι πλέον μόνο θέσεως." + +#: library/functions.rst:1058 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." @@ -1889,15 +2124,11 @@ msgstr "" "Επιστρέφει πίσω στη :meth:`~object.__index__` αν η :meth:`~object.__int__` " "δεν έχει οριστεί." -#: library/functions.rst:940 -msgid "The delegation to :meth:`~object.__trunc__` is deprecated." -msgstr "Η ανάθεση στη :meth:`~object.__trunc__` έχει καταργηθεί." - -#: library/functions.rst:943 +#: library/functions.rst:1061 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " -"limit is exceeded while converting a string *x* to an :class:`int` or when " +"limit is exceeded while converting a string to an :class:`int` or when " "converting an :class:`int` into a string would exceed the limit. See the :" "ref:`integer string conversion length limitation ` " "documentation." @@ -1905,12 +2136,16 @@ msgstr "" "Οι είσοδοι συμβολοσειράς και οι αναπαραστάσεις συμβολοσειρών :class:`int` " "μπορούν να περιοριστούν για να αποφευχθούν επιθέσεις άρνησης υπηρεσίας. Μια :" "exc:`ValueError` γίνεται raise όταν γίνεται υπέρβαση του ορίου κατά τη " -"μετατροπή μιας συμβολοσειράς *x* σε μια :class:`int` ή κατά τη μετατροπή " -"ενός :class:`int` σε μια συμβολοσειρά θα υπερβεί το όριο. Δείτε την " -"τεκμηρίωση :ref:`integer string conversion length limitation " -"`." +"μετατροπή μιας συμβολοσειράς σε μια :class:`int` ή κατά τη μετατροπή ενός :" +"class:`int` σε μια συμβολοσειρά θα υπερβεί το όριο. Δείτε την τεκμηρίωση :" +"ref:`integer string conversion length limitation `." + +#: library/functions.rst:1069 +msgid "" +":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." +msgstr "Η :func:`int` δεν αναθέτει πλέον στη μέθοδο :meth:`~object.__trunc__`." -#: library/functions.rst:953 +#: library/functions.rst:1074 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1955,40 +2190,40 @@ msgstr "" "καταχώρισης στο *classinfo*. Σε οποιαδήποτε άλλη περίπτωση, γίνεται raise " "μια εξαίρεση :exc:`TypeError`." -#: library/functions.rst:985 +#: library/functions.rst:1106 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " -"second argument, *object* must be a collection object which supports the :" -"term:`iterable` protocol (the :meth:`~object.__iter__` method), or it must " -"support the sequence protocol (the :meth:`~object.__getitem__` method with " -"integer arguments starting at ``0``). If it does not support either of " -"those protocols, :exc:`TypeError` is raised. If the second argument, " -"*sentinel*, is given, then *object* must be a callable object. The iterator " -"created in this case will call *object* with no arguments for each call to " -"its :meth:`~iterator.__next__` method; if the value returned is equal to " -"*sentinel*, :exc:`StopIteration` will be raised, otherwise the value will be " -"returned." +"second argument, the single argument must be a collection object which " +"supports the :term:`iterable` protocol (the :meth:`~object.__iter__` " +"method), or it must support the sequence protocol (the :meth:`~object." +"__getitem__` method with integer arguments starting at ``0``). If it does " +"not support either of those protocols, :exc:`TypeError` is raised. If the " +"second argument, *sentinel*, is given, then the first argument must be a " +"callable object. The iterator created in this case will call *callable* " +"with no arguments for each call to its :meth:`~iterator.__next__` method; if " +"the value returned is equal to *sentinel*, :exc:`StopIteration` will be " +"raised, otherwise the value will be returned." msgstr "" "Επιστρέφετε ένα αντικείμενο :term:`iterator`. Το πρώτο όρισμα ερμηνεύεται " "πολύ διαφορετικά ανάλογα με την παρουσία του δεύτερου ορίσματος. Χωρίς " -"δεύτερο όρισμα, το *object* πρέπει να είναι ένα αντικείμενο συλλογής που να " -"υποστηρίζει το πρωτόκολλο :term:`iterable` (η μέθοδος :meth:`~object." -"__iter__`), ή πρέπει να υποστηρίζει το πρωτόκολλο ακολουθίας (η μέθοδος :" -"meth:`~object.__getitem__` με ακέραια ορίσματα που ξεκινούν από ``0``). Εάν " -"δεν υποστηρίζει κανένα από αυτά τα πρωτόκολλα, γίνεται raise μια :exc:" -"`TypeError`. Εάν δοθεί το δεύτερο όρισμα *sentinel*, τότε το *object* πρέπει " -"να είναι ένα callable αντικείμενο. Ο iterator που δημιουργήθηκε σε αυτή την " -"περίπτωση θα καλέσει το *object* χωρίς ορίσματα για κάθε κλήση στη μέθοδο :" -"meth:`~iterator.__next__`∙ εάν η τιμή που επιστρέφετια είναι ίση με " -"*sentinel*, θα γίνει raise η :exc:`StopIteration`, διαφορετικά θα επιστραφεί " -"η τιμή." - -#: library/functions.rst:999 +"δεύτερο όρισμα, το μόνο όρισμα πρέπει να είναι ένα αντικείμενο συλλογής που " +"υποστηρίζει το πρωτόκολλο :term:`iterable` (τη μέθοδο :meth:`~object." +"__iter__`), ή πρέπει να υποστηρίζει το πρωτόκολλο ακολουθίας (τη μέθοδο :" +"meth:`~object.__getitem__` με ακέραια ορίσματα που ξεκινούν από το ``0``). " +"Εάν δεν υποστηρίζει κανένα από αυτά τα πρωτόκολλα, γίνεται raise μια :exc:" +"`TypeError`. Εάν το δεύτερο όρισμα, *sentinel*, δίνεται, τότε το πρώτο " +"όρισμα πρέπει να είναι ένα callable αντικείμενο. Ο iterator που " +"δημιουργείται σε αυτή την περίπτωση θα καλεί το *callable* χωρίς ορίσματα " +"για κάθε κλήση της μεθόδου :meth:`~iterator.__next__` του; εάν η τιμή που " +"επιστρέφεται είναι ίση με το *sentinel*, θα γίνει raise μια :exc:" +"`StopIteration`, διαφορετικά η τιμή θα επιστραφεί." + +#: library/functions.rst:1120 msgid "See also :ref:`typeiter`." msgstr "Δείτε επίσης :ref:`typeiter`." -#: library/functions.rst:1001 +#: library/functions.rst:1122 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " @@ -1998,7 +2233,19 @@ msgstr "" "ενός block-reader. Για παράδειγμα, η ανάγνωση μπλοκ σταθερού πλάτους από ένα " "δυαδικό αρχείο βάσης δεδομένων μέχρι να φτάσει στο τέλος του αρχείου::" -#: library/functions.rst:1013 +#: library/functions.rst:1126 +msgid "" +"from functools import partial\n" +"with open('mydata.db', 'rb') as f:\n" +" for block in iter(partial(f.read, 64), b''):\n" +" process_block(block)" +msgstr "" +"from functools import partial\n" +"with open('mydata.db', 'rb') as f:\n" +" for block in iter(partial(f.read, 64), b''):\n" +" process_block(block)" + +#: library/functions.rst:1134 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -2009,7 +2256,7 @@ msgstr "" "πλειάδα, λίστα, ή εύρος) ή μια συλλογή (όπως ένα λεξικό, ένα σετ, ή ένα " "παγωμένο σετ)." -#: library/functions.rst:1019 +#: library/functions.rst:1140 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2017,7 +2264,7 @@ msgstr "" "Το ``len`` κάνει raise μια :exc:`OverflowError` σε μήκη τα οποία είναι " "μεγαλύτερα από :data:`sys.maxsize`, όπως :class:`range(2 ** 100) `." -#: library/functions.rst:1028 +#: library/functions.rst:1148 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2026,46 +2273,153 @@ msgstr "" "μεταβλητός τύπος ακολουθίας, όπως τεκμηριώνεται στα :ref:`typesseq-list` " "και :ref:`typesseq`." -#: library/functions.rst:1034 +#: library/functions.rst:1154 msgid "" -"Update and return a dictionary representing the current local symbol table. " -"Free variables are returned by :func:`locals` when it is called in function " -"blocks, but not in class blocks. Note that at the module level, :func:" -"`locals` and :func:`globals` are the same dictionary." +"Return a mapping object representing the current local symbol table, with " +"variable names as the keys, and their currently bound references as the " +"values." msgstr "" -"Ενημέρωση και επιστροφή ενός λεξικού που αντιπροσωπεύει τον τρέχοντα πίνακα " -"τοπικών συμβόλων. Οι ελεύθερες μεταβλητές επιστρέφονται από :func:`locals` " -"όταν καλείται σε μπλοκ συναρτήσεων, αλλά όχι σε μπλοκ κλάσεων. Σημειώστε ότι " -"σε επίπεδο module, οι :func:`locals` και :func:`globals` είναι το ίδιο " -"λεξικό." +"Επιστρέφει ένα αντικείμενο αντιστοίχισης που αναπαριστά τον τρέχοντα τοπικό " +"πίνακα συμβόλων, με τα ονόματα μεταβλητών ως κλειδιά και τις αντίστοιχες " +"τιμές στις οποίες είναι δεσμευμένες ως τιμές." -#: library/functions.rst:1040 +#: library/functions.rst:1158 msgid "" -"The contents of this dictionary should not be modified; changes may not " -"affect the values of local and free variables used by the interpreter." +"At module scope, as well as when using :func:`exec` or :func:`eval` with a " +"single namespace, this function returns the same namespace as :func:" +"`globals`." msgstr "" -"Τα περιεχόμενα αυτού του λεξικού δεν πρέπει να τροποποιηθούν∙ οι αλλαγές " -"ενδέχεται να μην επηρεάσουν τις τιμές των τοπικών και ελεύθερων μεταβλητών " -"που χρησιμοποιούνται από τον διερμηνέα." +"Στο επίπεδο module, καθώς και όταν χρησιμοποιείται η :func:`exec` ή η :func:" +"`eval` με έναν μόνο χώρο ονομάτων, αυτή η συνάρτηση επιστρέφει τον ίδιο χώρο " +"ονομάτων με τη :func:`globals`." -#: library/functions.rst:1045 +#: library/functions.rst:1162 +msgid "" +"At class scope, it returns the namespace that will be passed to the " +"metaclass constructor." +msgstr "" +"Στο πεδίο ορισμού κλάσης, επιστρέφει τον χώρο ονομάτων που θα περαστεί στον " +"κατασκευαστή της μετακλάσης." + +#: library/functions.rst:1165 +msgid "" +"When using ``exec()`` or ``eval()`` with separate local and global " +"arguments, it returns the local namespace passed in to the function call." +msgstr "" +"Όταν χρησιμοποιείται η ``exec()`` ή η ``eval()`` με ξεχωριστά local και " +"global ορίσματα, επιστρέφει στον τοπικό χώρο ονομάτων που περάστηκε στην " +"κλήση της συνάρτησης." + +#: library/functions.rst:1168 +msgid "" +"In all of the above cases, each call to ``locals()`` in a given frame of " +"execution will return the *same* mapping object. Changes made through the " +"mapping object returned from ``locals()`` will be visible as assigned, " +"reassigned, or deleted local variables, and assigning, reassigning, or " +"deleting local variables will immediately affect the contents of the " +"returned mapping object." +msgstr "" +"Σε όλες τις παραπάνω περιπτώσεις, κάθε κλήση της ``locals()`` σε ένα " +"συγκεκριμένο πλαίσιο εκτέλεσης θα επιστρέφει το *ίδιο* αντικείμενο " +"αντιστοίχισης. Οι αλλαγές που γίνονται μέσω του αντικειμένου αντιστοίχισης " +"που επιστρέφεται από την ``locals()`` θα είναι ορατές ως τοπικές μεταβλητές " +"που ανατίθενται, επανακαθορίζονται ή διαγράφονται, και η ανάθεση, " +"επανακαθορισμός ή διαγραφή τοπικών μεταβλητών θα επηρεάζει άμεσα τα " +"περιεχόμενα του επιστρεφόμενου αντικειμένου αντιστοίχισης." + +#: library/functions.rst:1175 +msgid "" +"In an :term:`optimized scope` (including functions, generators, and " +"coroutines), each call to ``locals()`` instead returns a fresh dictionary " +"containing the current bindings of the function's local variables and any " +"nonlocal cell references. In this case, name binding changes made via the " +"returned dict are *not* written back to the corresponding local variables or " +"nonlocal cell references, and assigning, reassigning, or deleting local " +"variables and nonlocal cell references does *not* affect the contents of " +"previously returned dictionaries." +msgstr "" +"Σε ένα :term:`optimized scope` (όπως οι συναρτήσεις, οι γεννήτριες και οι " +"συναρτήσεις συνεργασίας), κάθε κλήση της ``locals()`` επιστρέφει ένα νέο " +"λεξικό που περιέχει τις τρέχουσες δεσμεύσεις των τοπικών μεταβλητών της " +"συνάρτησης καθώς και οποιεσδήποτε αναφορές σε μη τοπικά κελιά. Σε αυτή την " +"περίπτωση, οι αλλαγές στις δεσμεύσεις ονομάτων που γίνονται μέσω του " +"επιστρεφόμενου λεξικού *δεν* εγγράφονται πίσω στις αντίστοιχες τοπικές " +"μεταβλητές ή μη τοπικές αναφορές, και η ανάθεση, επανακαθορισμός ή διαγραφή " +"τοπικών ή μη τοπικών μεταβλητών *δεν* επηρεάζει το περιεχόμενο των λεξικών " +"που είχαν επιστραφεί προηγουμένως." + +#: library/functions.rst:1184 +msgid "" +"Calling ``locals()`` as part of a comprehension in a function, generator, or " +"coroutine is equivalent to calling it in the containing scope, except that " +"the comprehension's initialised iteration variables will be included. In " +"other scopes, it behaves as if the comprehension were running as a nested " +"function." +msgstr "" +"Καλώντας την ``locals()`` ως μέρος μιας σύμπτυξης (comprehension) που " +"βρίσκεται σε μια συνάρτηση, γεννήτρια ή coroutine είναι ισοδύναμη με την " +"κλήση της στο περιβάλλον που περικλείει την την σύμπτυξη, με τη διαφορά ότι " +"οι αρχικοποιημένες μεταβλητές επανάληψης της σύμπτυξης θα περιλαμβάνονται " +"στο αποτέλεσμα. Σε άλλα πεδία ορατότητας, η συμπεριφορά είναι σαν η σύμπτυξη " +"να εκτελείται ως μια εμφωλευμένη συνάρτηση." + +#: library/functions.rst:1190 +msgid "" +"Calling ``locals()`` as part of a generator expression is equivalent to " +"calling it in a nested generator function." +msgstr "" +"Καλώντας την ``locals()`` ως μέρος μιας έκφρασης γεννήτριας είναι ισοδύναμη " +"με την κλήση της μέσα σε μια εμφωλευμένη συνάρτηση γεννήτριας." + +#: library/functions.rst:1193 +msgid "" +"The behaviour of ``locals()`` in a comprehension has been updated as " +"described in :pep:`709`." +msgstr "" +"Η συμπεριφορά της ``locals()`` μέσα σε μια έκφραση σύμπτυξης έχει ενημερωθεί " +"όπως περιγράφεται στην :pep:`709`." + +#: library/functions.rst:1197 +msgid "" +"As part of :pep:`667`, the semantics of mutating the mapping objects " +"returned from this function are now defined. The behavior in :term:" +"`optimized scopes ` is now as described above. Aside from " +"being defined, the behaviour in other scopes remains unchanged from previous " +"versions." +msgstr "" +"Στο πλαίσιο της :pep:`667`, τα σημασιολογικά χαρακτηριστικά της τροποποίησης " +"των αντικειμένων αντιστοιχίσεων που επιστρέφονται από αυτήν τη συνάρτηση " +"έχουν πλέον οριστεί. Η συμπεριφορά σε :term:`optimized scopes ` είναι πλέον όπως περιγράφεται παραπάνω. Πέραν του ότι πλέον είναι " +"ορισμένη, η συμπεριφορά σε άλλα πεδία παραμένει αμετάβλητη σε σχέση με " +"προηγούμενες εκδόσεις." + +#: library/functions.rst:1207 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " "*function* must take that many arguments and is applied to the items from " "all iterables in parallel. With multiple iterables, the iterator stops when " -"the shortest iterable is exhausted. For cases where the function inputs are " -"already arranged into argument tuples, see :func:`itertools.starmap`\\." +"the shortest iterable is exhausted. If *strict* is ``True`` and one of the " +"iterables is exhausted before the others, a :exc:`ValueError` is raised. For " +"cases where the function inputs are already arranged into argument tuples, " +"see :func:`itertools.starmap`." msgstr "" "Επιστρέφει έναν iterator που εφαρμόζει *function* σε κάθε στοιχείο του " "*iterable*, δίνοντας τα αποτελέσματα. Εάν περάσουν επιπλέον ορίσματα " "*iterables*, η *function* πρέπει να λάβει τόσα ορίσματα και να εφαρμόζεται " "στα στοιχεία από όλα τα iterables παράλληλα. Με πολλαπλούς iterables, ο " -"iterator σταματά όταν εξαντληθεί ο συντομότερος iterable. Για περιπτώσεις " -"όπου οι είσοδοι συνάρτησης είναι ήδη διατεταγμένες σε πλειάδες ορισμάτων, " -"βλέπε :func:`itertools.starmap`\\." +"iterator σταματά όταν εξαντληθεί ο συντομότερος iterable. Εάν το *strict* " +"είναι ``True`` και μία από τα iterables εξαντληθεί πριν από τις άλλες, " +"γίνεται raise μια :exc:`ValueError`. Για περιπτώσεις όπου οι είσοδοι " +"συνάρτησης είναι ήδη διατεταγμένες σε πλειάδες ορισμάτων, βλέπε :func:" +"`itertools.starmap`\\." + +#: library/functions.rst:1216 +msgid "Added the *strict* parameter." +msgstr "Προστέθηκε η παράμετρος *strict*." -#: library/functions.rst:1057 +#: library/functions.rst:1224 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." @@ -2073,7 +2427,7 @@ msgstr "" "Επιστρέφει το μεγαλύτερο στοιχείο σε ένα iterable ή το μεγαλύτερο από δύο ή " "περισσότερα ορίσματα." -#: library/functions.rst:1060 +#: library/functions.rst:1227 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -2083,7 +2437,7 @@ msgstr "" "Επιστρέφεται το μεγαλύτερο στοιχείο στο iterable. Εάν παρέχονται δύο ή " "περισσότερα ορίσματα θέσης, επιστρέφεται το μεγαλύτερο από τα ορίσματα θέσης." -#: library/functions.rst:1103 +#: library/functions.rst:1270 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -2098,7 +2452,7 @@ msgstr "" "είναι κενό και το *default* δεν παρέχεται, γίνεται raise μια :exc:" "`ValueError`." -#: library/functions.rst:1071 +#: library/functions.rst:1238 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2110,15 +2464,15 @@ msgstr "" "ταξινόμησης όπως ``sorted(iterable, key=keyfunc, reverse=True)[0]`` και " "``heapq.nlargest(1, iterable, key=keyfunc)``." -#: library/functions.rst:1114 +#: library/functions.rst:1281 msgid "Added the *default* keyword-only parameter." msgstr "Προστέθηκε η παράμετρος μόνο λέξης-κλειδί *default*." -#: library/functions.rst:1117 +#: library/functions.rst:1284 msgid "The *key* can be ``None``." msgstr "Το *key* μπορεί να είναι ``None``." -#: library/functions.rst:1087 +#: library/functions.rst:1254 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2127,7 +2481,7 @@ msgstr "" "συγκεκριμένο όρισμα. Βλέπε :ref:`typememoryview` για περισσότερες " "λεπτομέρειες." -#: library/functions.rst:1095 +#: library/functions.rst:1262 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." @@ -2135,7 +2489,7 @@ msgstr "" "Επιστρέφει το μικρότερο στοιχείο σε έναν iterable ή το μικρότερο από δύο ή " "περισσότερα ορίσματα." -#: library/functions.rst:1098 +#: library/functions.rst:1265 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -2145,7 +2499,7 @@ msgstr "" "Επιστρέφει το μικρότερο στοιχείο στον iterable. Εάν παρέχονται δύο ή " "περισσότερα ορίσματα θέσης, επιστρέφεται το μικρότερο από τα ορίσματα θέσης." -#: library/functions.rst:1109 +#: library/functions.rst:1276 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2157,7 +2511,7 @@ msgstr "" "ταξινόμησης, όπως ``sorted(iterable, key=keyfunc)[0]`` και ``heapq." "nsmallest(1, iterable, key=keyfunc)``." -#: library/functions.rst:1124 +#: library/functions.rst:1291 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -2167,38 +2521,40 @@ msgstr "" "meth:`~iterator.__next__`. Εάν δοθεί *default*, επιστρέφεται εάν ο iterator " "έχει εξαντληθεί, διαφορετικά γίνεται raise μια :exc:`StopIteration`." -#: library/functions.rst:1131 +#: library/functions.rst:1298 msgid "" -"Return a new featureless object. :class:`object` is a base for all classes. " -"It has methods that are common to all instances of Python classes. This " -"function does not accept any arguments." +"This is the ultimate base class of all other classes. It has methods that " +"are common to all instances of Python classes. When the constructor is " +"called, it returns a new featureless object. The constructor does not accept " +"any arguments." msgstr "" -"Επιστρέφει ένα νέο αντικείμενο χωρίς χαρακτηριστικά. Το :class:`object` " -"είναι μια βάση για όλες τις κλάσεις. Έχει μεθόδους που είναι κοινές σε όλες " -"τις περιπτώσεις κλάσεων Python. Αυτή η συνάρτηση δεν δέχεται ορίσματα." +"Αυτή είναι η τελική βασική κλάση όλων των άλλων κλάσεων. Έχει μεθόδους που " +"είναι κοινές σε όλες τις περιπτώσεις κλάσεων Python. Όταν καλείται ο " +"κατασκευαστής, επιστρέφει ένα νέο αντικείμενο χωρίς χαρακτηριστικά. Ο " +"κατασκευαστής δεν δέχεται ορίσματα." -#: library/functions.rst:1137 +#: library/functions.rst:1305 msgid "" -":class:`object` does *not* have a :attr:`~object.__dict__`, so you can't " -"assign arbitrary attributes to an instance of the :class:`object` class." +":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " +"so you can't assign arbitrary attributes to an instance of :class:`object`." msgstr "" -"Το :class:`object` *δεν* έχει :attr:`~object.__dict__` επομένως δεν μπορείτε " -"να εκχωρήσετε αυθαίρετα χαρακτηριστικά σε ένα instance της κλάσης :class:" -"`object`." +"Τα στιγμιότυπα :class:`object` *δεν* έχουν χαρακτηριστικά :attr:`~object." +"__dict__`, επομένως δεν μπορείτε να εκχωρήσετε αυθαίρετα χαρακτηριστικά σε " +"ένα στιγμιότυπο του :class:`object`." -#: library/functions.rst:1143 +#: library/functions.rst:1312 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " -"result is a valid Python expression. If *x* is not a Python :class:`int` " -"object, it has to define an :meth:`~object.__index__` method that returns an " -"integer. For example:" +"result is a valid Python expression. If *integer* is not a Python :class:" +"`int` object, it has to define an :meth:`~object.__index__` method that " +"returns an integer. For example:" msgstr "" "Μετατρέπει έναν ακέραιο αριθμό σε μια οκταδική συμβολοσειρά με πρόθεμα " -"\"0o\". Το αποτέλεσμα είναι μια έγκυρη έκφραση Python. Εάν το *x* δεν είναι " -"ένα αντικείμενο Python :class:`int`, πρέπει να ορίσει μια μέθοδο :meth:" +"\"0o\". Το αποτέλεσμα είναι μια έγκυρη έκφραση Python. Εάν το *integer* δεν " +"είναι ένα αντικείμενο Python :class:`int`, πρέπει να ορίσει μια μέθοδο :meth:" "`~object.__index__` που επιστρέφει έναν ακέραιο αριθμό. Για παράδειγμα:" -#: library/functions.rst:1153 +#: library/functions.rst:1322 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -2207,7 +2563,7 @@ msgstr "" "με το πρόθεμα \"0o\" είτε όχι, μπορείτε να χρησιμοποιήσετε έναν από τους " "παρακάτω τρόπους." -#: library/functions.rst:1170 +#: library/functions.rst:1339 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -2217,7 +2573,7 @@ msgstr "" "αρχείο δεν μπορεί να ανοίξει, γίνεται raise μια :exc:`OSError`. Δείτε το :" "ref:`tut-files` για περισσότερα παραδείγματα χρήσης αυτής της συνάρτησης." -#: library/functions.rst:1174 +#: library/functions.rst:1343 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2232,7 +2588,7 @@ msgstr "" "επιστρεφόμενο αντικείμενο I/O είναι κλειστό εκτός εάν *closefd* έχει οριστεί " "ως ``False``.)" -#: library/functions.rst:1180 +#: library/functions.rst:1349 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -2241,7 +2597,7 @@ msgid "" "(which on *some* Unix systems, means that *all* writes append to the end of " "the file regardless of the current seek position). In text mode, if " "*encoding* is not specified the encoding used is platform-dependent: :func:" -"`locale.getencoding()` is called to get the current locale encoding. (For " +"`locale.getencoding` is called to get the current locale encoding. (For " "reading and writing raw bytes use binary mode and leave *encoding* " "unspecified.) The available modes are:" msgstr "" @@ -2253,78 +2609,78 @@ msgstr "" "συστήματα Unix, σημαίνει ότι *όλες* οι εγγραφές προσαρτώνται στο τέλος του " "αρχείου ανεξάρτητα από την τρέχουσα θέση αναζήτησης). Στη λειτουργία " "κειμένου, εάν δεν έχει καθοριστεί το *encoding*, η κωδικοποίηση που " -"χρησιμοποιείται εξαρτάται από την πλατφόρμα: :func:`locale.getencoding()` " +"χρησιμοποιείται εξαρτάται από την πλατφόρμα: :func:`locale.getencoding` " "καλείται για να ληφθεί η τρέχουσα κωδικοποίηση τοπικών ρυθμίσεων. (Για την " "ανάγνωση και την εγγραφή ακατέργαστων bytes χρησιμοποιείται δυαδική " "λειτουργία και αφήνουν το *encoding* απροσδιόριστο.) Οι διαθέσιμες " "λειτουργίες είναι:" -#: library/functions.rst:1197 +#: library/functions.rst:1366 msgid "Character" msgstr "Χαρακτήρας" -#: library/functions.rst:1197 +#: library/functions.rst:1366 msgid "Meaning" msgstr "Έννοια" -#: library/functions.rst:1199 +#: library/functions.rst:1368 msgid "``'r'``" msgstr "``'r'``" -#: library/functions.rst:1199 +#: library/functions.rst:1368 msgid "open for reading (default)" msgstr "άνοιγμα για ανάγνωση (default)" -#: library/functions.rst:1200 +#: library/functions.rst:1369 msgid "``'w'``" msgstr "``'w'``" -#: library/functions.rst:1200 +#: library/functions.rst:1369 msgid "open for writing, truncating the file first" msgstr "άνοιγμα για εγγραφή, περικόπτοντας πρώτα το αρχείο" -#: library/functions.rst:1201 +#: library/functions.rst:1370 msgid "``'x'``" msgstr "``'x'``" -#: library/functions.rst:1201 +#: library/functions.rst:1370 msgid "open for exclusive creation, failing if the file already exists" msgstr "" "άνοιγμα για αποκλειστική δημιουργία, αποτυγχάνοντας εάν το αρχείο υπάρχει ήδη" -#: library/functions.rst:1202 +#: library/functions.rst:1371 msgid "``'a'``" msgstr "``'a'``" -#: library/functions.rst:1202 +#: library/functions.rst:1371 msgid "open for writing, appending to the end of file if it exists" msgstr "άνοιγμα για εγγραφή, προσαρτάται στο τέλος του αρχείου εάν υπάρχει" -#: library/functions.rst:1203 +#: library/functions.rst:1372 msgid "``'b'``" msgstr "``'b'``" -#: library/functions.rst:1347 +#: library/functions.rst:1516 msgid "binary mode" msgstr "δυαδική (binary) λειτουργία" -#: library/functions.rst:1204 +#: library/functions.rst:1373 msgid "``'t'``" msgstr "``'t'``" -#: library/functions.rst:1204 +#: library/functions.rst:1373 msgid "text mode (default)" msgstr "λειτουργία κειμένου (default)" -#: library/functions.rst:1205 +#: library/functions.rst:1374 msgid "``'+'``" msgstr "``'+'``" -#: library/functions.rst:1205 +#: library/functions.rst:1374 msgid "open for updating (reading and writing)" msgstr "άνοιγμα για ενημέρωση (ανάγνωση και εγγραφή)" -#: library/functions.rst:1208 +#: library/functions.rst:1377 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -2335,7 +2691,7 @@ msgstr "" "περικόβει το αρχείο. Οι λειτουργίες ``'r+'`` and ``'r+b'`` ανοίγουν το " "αρχείο χωρίς περικοπή." -#: library/functions.rst:1212 +#: library/functions.rst:1381 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2354,7 +2710,7 @@ msgstr "" "bytes έχουν πρώτα αποκωδικοποιηθεί χρησιμοποιώντας μια εξαρτώμενη από " "πλατφόρμα κωδικοποίηση ή χρήση της καθορισμένης *κωδικοποίησης* εάν δίνεται." -#: library/functions.rst:1222 +#: library/functions.rst:1391 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " @@ -2364,7 +2720,7 @@ msgstr "" "λειτουργικού συστήματος∙ όλη η επεξεργασία γίνεται από την ίδια την Python " "και επομένως είναι ανεξάρτητη από την πλατφόρμα." -#: library/functions.rst:1226 +#: library/functions.rst:1395 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2391,20 +2747,19 @@ msgstr "" "δίνεται όρισμα *buffering*, η προεπιλεγμένη πολιτική προσωρινής αποθήκευσης " "λειτουργεί ως εξής:" -#: library/functions.rst:1236 +#: library/functions.rst:1405 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " -"chosen using a heuristic trying to determine the underlying device's \"block " -"size\" and falling back on :const:`io.DEFAULT_BUFFER_SIZE`. On many " -"systems, the buffer will typically be 4096 or 8192 bytes long." +"``max(min(blocksize, 8 MiB), DEFAULT_BUFFER_SIZE)`` when the device block " +"size is available. On most systems, the buffer will typically be 128 " +"kilobytes long." msgstr "" "Τα δυαδικά αρχεία αποθηκεύονται στην προσωρινή μνήμη σε κομμάτια σταθερού " -"μεγέθους∙ το μέγεθος του buffer επιλέγεται χρησιμοποιώντας μια ευρετική που " -"προσπαθεί να προσδιορίσει το \"μέγεθος του μπλοκ\" της υποκείμενης συσκευής " -"και επανέρχεται σε :const:`io.DEFAULT_BUFFER_SIZE`. Σε πολλά συστήματα, η " -"προσωρινή μνήμη θα έχει συνήθως μήκος 4096 ή 8192 bytes." +"μεγέθους∙ το μέγεθος του buffer είναι ``max(min(blocksize, 8 MiB), " +"DEFAULT_BUFFER_SIZE)`` όταν το μέγεθος μπλοκ της συσκευής είναι διαθέσιμο. " +"Στα περισσότερα συστήματα, το buffer θα έχει συνήθως μήκος 128 kilobytes." -#: library/functions.rst:1241 +#: library/functions.rst:1410 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2415,7 +2770,7 @@ msgstr "" "κειμένου χρησιμοποιούν την πολιτική που περιγράφεται παραπάνω για δυαδικά " "αρχεία." -#: library/functions.rst:1245 +#: library/functions.rst:1414 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2430,7 +2785,7 @@ msgstr "" "οποιοδήποτε :term:`text encoding` που υποστηρίζεται από την Python. Δείτε το " "module :mod:`codecs` για τη λίστα των υποστηριζόμενων κωδικοποιήσεων." -#: library/functions.rst:1251 +#: library/functions.rst:1420 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2446,7 +2801,7 @@ msgstr "" "το :func:`codecs.register_error` είναι επίσης έγκυρο. Τα τυπικά ονόματα " "περιλαμβάνουν:" -#: library/functions.rst:1259 +#: library/functions.rst:1428 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2455,7 +2810,7 @@ msgstr "" "σφάλμα κωδικοποίησης. Η προεπιλεγμένη τιμή του ``None`` έχει το ίδιο " "αποτέλεσμα." -#: library/functions.rst:1263 +#: library/functions.rst:1432 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." @@ -2463,7 +2818,7 @@ msgstr "" "Το ``'ignore'`` αγνοεί τα σφάλματα. Σημειώστε ότι η παράβλεψη σφαλμάτων " "κωδικοποίησης μπορεί να οδηγήσει σε απώλεια δεδομένων." -#: library/functions.rst:1266 +#: library/functions.rst:1435 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." @@ -2471,7 +2826,7 @@ msgstr "" "Το ``'replace'`` προκαλεί την εισαγωγή ενός δείκτη αντικατάστασης (όπως " "``'?'``) όταν υπάρχουν δεδομένα με λανθασμένη μορφή." -#: library/functions.rst:1269 +#: library/functions.rst:1438 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2486,7 +2841,7 @@ msgstr "" "εγγραφή δεδομένων. Αυτό είναι χρήσιμο για την επεξεργασία αρχείων σε " "άγνωστη κωδικοποίηση." -#: library/functions.rst:1276 +#: library/functions.rst:1445 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2496,7 +2851,7 @@ msgstr "" "χαρακτήρες που δεν υποστηρίζονται από την κωδικοποίηση αντικαθίστανται με " "την κατάλληλη αναφορά χαρακτήρων XML :samp:`&#{nnn};`." -#: library/functions.rst:1280 +#: library/functions.rst:1449 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2504,7 +2859,7 @@ msgstr "" "Το ``'backslashreplace'`` αντικαθιστά δεδομένα με λανθασμένη μορφή από τις " "ακολουθίες διαφυγής με ανάστροφης καθέτου Python." -#: library/functions.rst:1283 +#: library/functions.rst:1452 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2512,7 +2867,7 @@ msgstr "" "Το ``'namereplace'`` (υποστηρίζεται επίσης μόνο κατά τη σύνταξη) αντικαθιστά " "τους μη υποστηριζόμενους χαρακτήρες με ακολουθίες διαφυγής ``\\N{...}``." -#: library/functions.rst:1291 +#: library/functions.rst:1460 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2522,7 +2877,7 @@ msgstr "" "ροή. Μπορεί να είναι και ``None``, ``''``, ``'\\n'``, ``'\\r'``, και " "``'\\r\\n'``. Λειτουργεί ως εξής:" -#: library/functions.rst:1295 +#: library/functions.rst:1464 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2542,7 +2897,7 @@ msgstr "" "δεδομένη συμβολοσειρά και η κατάληξη γραμμής επιστρέφεται στον καλούντα " "αμετάφραστη." -#: library/functions.rst:1303 +#: library/functions.rst:1472 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2557,7 +2912,7 @@ msgstr "" "από τις άλλες νόμιμες τιμές, γράφονται οποιοιδήποτε χαρακτήρες ``'\\n'`` " "μεταφράζονται στη δεδομένη συμβολοσειρά." -#: library/functions.rst:1309 +#: library/functions.rst:1478 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2570,7 +2925,7 @@ msgstr "" "*closefd* πρέπει να είναι ``True`` (η προεπιλογή)∙ διαφορετικά, θα προκύψει " "ένα σφάλμα." -#: library/functions.rst:1314 +#: library/functions.rst:1483 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2585,12 +2940,12 @@ msgstr "" "αρχείου (περνώντας :mod:`os.open` ως *opener* έχει ως αποτέλεσμα " "λειτουργικότητας παρόμοια με το να περάσουμε το ``None``)." -#: library/functions.rst:1320 +#: library/functions.rst:1489 msgid "The newly created file is :ref:`non-inheritable `." msgstr "" "Το νέο δημιουργημένο αρχείο είναι :ref:`non-inheritable `." -#: library/functions.rst:1322 +#: library/functions.rst:1491 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2599,7 +2954,29 @@ msgstr "" "συνάρτησης :func:`os.open` για να ανοίξει ένα αρχείο σε σχέση με έναν " "δεδομένο κατάλογο::" -#: library/functions.rst:1335 +#: library/functions.rst:1494 +msgid "" +">>> import os\n" +">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" +">>> def opener(path, flags):\n" +"... return os.open(path, flags, dir_fd=dir_fd)\n" +"...\n" +">>> with open('spamspam.txt', 'w', opener=opener) as f:\n" +"... print('This will be written to somedir/spamspam.txt', file=f)\n" +"...\n" +">>> os.close(dir_fd) # don't leak a file descriptor" +msgstr "" +">>> import os\n" +">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" +">>> def opener(path, flags):\n" +"... return os.open(path, flags, dir_fd=dir_fd)\n" +"...\n" +">>> with open('spamspam.txt', 'w', opener=opener) as f:\n" +"... print('This will be written to somedir/spamspam.txt', file=f)\n" +"...\n" +">>> os.close(dir_fd) # don't leak a file descriptor" + +#: library/functions.rst:1504 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2627,7 +3004,7 @@ msgstr "" "προσωρινή αποθήκευση είναι απενεργοποιημένη, επιστρέφεται, η ακατέργαστη " "ροή , μια υποκλάση :class:`io.RawIOBase`, :class:`io.FileIO`." -#: library/functions.rst:1356 +#: library/functions.rst:1525 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2637,15 +3014,15 @@ msgstr "" "`io` (όπου ορίζεται η :func:`open`), :mod:`os`, :mod:`os.path`, :mod:" "`tempfile`, και :mod:`shutil`." -#: library/functions.rst:1360 +#: library/functions.rst:1529 msgid "" -"Raises an :ref:`auditing event ` ``open`` with arguments ``file``, " +"Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." msgstr "" -"Εγείρει ένα :ref:`auditing event ` ``open`` με ορίσματα ``file``, " -"``mode``, ``flags``." +"Κάνει raise ένα :ref:`auditing event ` ``open`` με ορίσματα " +"``path``, ``mode``, ``flags``." -#: library/functions.rst:1362 +#: library/functions.rst:1531 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." @@ -2653,21 +3030,21 @@ msgstr "" "Τα ορίσματα ``mode`` και ``flags`` μπορεί να έχουν τροποποιηθεί ή να έχουν " "συναχθεί από την αρχική κλήση." -#: library/functions.rst:1367 +#: library/functions.rst:1536 msgid "The *opener* parameter was added." msgstr "Προστέθηκε η παράμετρος *opener*." -#: library/functions.rst:1368 +#: library/functions.rst:1537 msgid "The ``'x'`` mode was added." msgstr "Προστέθηκε η λειτουργία ``'x'``." -#: library/functions.rst:1369 +#: library/functions.rst:1538 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "" "Το :exc:`IOError` γινόταν raise παλιά, τώρα είναι ψευδώνυμο του :exc:" "`OSError`." -#: library/functions.rst:1370 +#: library/functions.rst:1539 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2675,11 +3052,11 @@ msgstr "" "Το :exc:`FileExistsError` γίνεται raise τώρα εάν το αρχείο που ανοίγει σε " "λειτουργία αποκλειστικής δημιουργίας (``'x'``) υπάρχει ήδη." -#: library/functions.rst:1375 +#: library/functions.rst:1544 msgid "The file is now non-inheritable." msgstr "Το αρχείο είναι πλέον μη κληρονομικό." -#: library/functions.rst:1379 +#: library/functions.rst:1548 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" @@ -2690,17 +3067,17 @@ msgstr "" "raise μια εξαίρεση :exc:`InterruptedError` (δείτε το :pep:`475` για το " "σκεπτικό)." -#: library/functions.rst:1382 +#: library/functions.rst:1551 msgid "The ``'namereplace'`` error handler was added." msgstr "Προστέθηκε το πρόγραμμα χειρισμού σφαλμάτων ``'namereplace'``." -#: library/functions.rst:1386 +#: library/functions.rst:1555 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "" "Προστέθηκε υποστήριξη για την αποδοχή αντικειμένων που υλοποιούν :class:`os." "PathLike`." -#: library/functions.rst:1387 +#: library/functions.rst:1556 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2708,24 +3085,37 @@ msgstr "" "Στα Windows, το άνοιγμα μιας προσωρινής μνήμης κονσόλας μπορεί να επιστρέψει " "μια υποκλάση του :class:`io.RawIOBase` εκτός από το :class:`io.FileIO`." -#: library/functions.rst:1390 +#: library/functions.rst:1559 msgid "The ``'U'`` mode has been removed." msgstr "Η λειτουργία ``'U'`` έχει αφαιρεθεί." -#: library/functions.rst:1395 +#: library/functions.rst:1564 +msgid "Return the ordinal value of a character." +msgstr "Επιστρέφει την αριθμητική τιμή (ordinal) ενός χαρακτήρα." + +#: library/functions.rst:1566 msgid "" -"Given a string representing one Unicode character, return an integer " -"representing the Unicode code point of that character. For example, " -"``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign) returns " -"``8364``. This is the inverse of :func:`chr`." +"If the argument is a one-character string, return the Unicode code point of " +"that character. For example, ``ord('a')`` returns the integer ``97`` and " +"``ord('€')`` (Euro sign) returns ``8364``. This is the inverse of :func:" +"`chr`." msgstr "" -"Δεδομένου μιας συμβολοσειράς που αντιπροσωπεύει έναν χαρακτήρα Unicode, " -"επιστρέφει έναν ακέραιο που αντιπροσωπεύει το σημείο κωδικού Unicode αυτού " -"του χαρακτήρα. Για παράδειγμα, το ``ord('a')`` επιστρέφει τον ακέραιο " -"αριθμό ``97`` και ``ord('€')`` (σύμβολο του ευρώ) επιστρέφει ``8364``. Αυτό " -"είναι το αντίστροφο του :func:`chr`." +"Εάν το όρισμα είναι μια συμβολοσειρά ενός χαρακτήρα, επιστρέφει το σημείο " +"κώδικα Unicode αυτού του χαρακτήρα. Για παράδειγμα, το ``ord('a')`` " +"επιστρέφει τον ακέραιο ``97`` και το ``ord('€')`` (σημείο ευρώ) επιστρέφει " +"το ``8364``. Αυτό είναι το αντίστροφο του :func:`chr`." -#: library/functions.rst:1403 +#: library/functions.rst:1571 +msgid "" +"If the argument is a :class:`bytes` or :class:`bytearray` object of length " +"1, return its single byte value. For example, ``ord(b'a')`` returns the " +"integer ``97``." +msgstr "" +"Εάν το όρισμα είναι ένα αντικείμενο :class:`bytes` ή :class:`bytearray` " +"μήκους 1, επιστρέφει την τιμή του μεμονωμένου byte. Για παράδειγμα, το " +"``ord(b'a')`` επιστρέφει τον ακέραιο ``97``." + +#: library/functions.rst:1578 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2737,9 +3127,9 @@ msgstr "" "``pow(base, exp) % mod``). Η φόρμα δύο ορισμάτων ``pow(base, exp)`` " "ισοδυναμεί με τη χρήση του τελεστή δύναμης: ``base**exp``." -#: library/functions.rst:1408 +#: library/functions.rst:1583 msgid "" -"The arguments must have numeric types. With mixed operand types, the " +"When arguments are builtin numeric types with mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " "operands, the result has the same type as the operands (after coercion) " "unless the second argument is negative; in that case, all arguments are " @@ -2747,20 +3137,24 @@ msgid "" "2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " "base of type :class:`int` or :class:`float` and a non-integral exponent, a " "complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``." -msgstr "" -"Τα ορίσματα πρέπει να έχουνε αριθμητικούς τύπους. Με μεικτούς τύπους " -"τελεστών, ισχύουν οι κανόνες εξαναγκασμού για δυαδικούς τελεστές " -"αριθμητικής. Για του τελεστές :class:`int`, το αποτέλεσμα έχει τον ίδιο " -"τύπο με τους τελεστές (μετά τον εξαναγκασμό), εκτός εάν το δεύτερο όρισμα " -"είναι αρνητικό∙ σε αυτή την περίπτωση, όλα τα ορίσματα μετατρέπονται σε " -"float και επιστρέφεται ένα αποτέλεσμα τύπους float. Για παράδειγμα, " -"``pow(10, 2)`` επιστρέφει ``100``, αλλά το ``pow(10, -2)`` επιστρέφει " -"``0.01``. Για μια αρνητική βάση τύπου :class:`int` ή :class:`float` και " -"έναν μη αναπόσπαστο εκθέτη, παραδίδεται ένα μιγαδικό αποτέλεσμα. Για " -"παράδειγμα, ``pow(-9, 0.5)`` επιστρέφει μια τιμή κοντά στο ``3j``." - -#: library/functions.rst:1418 +"close to ``3j``. Whereas, for a negative base of type :class:`int` or :class:" +"`float` with an integral exponent, a float result is delivered. For example, " +"``pow(-9, 2.0)`` returns ``81.0``." +msgstr "" +"Όταν τα ορίσματα είναι ενσωματωμένοι αριθμητικοί τύποι με μεικτούς τύπους " +"ισχύουν οι κανόνες εξαναγκασμού για δυαδικούς τελεστές αριθμητικής. Για του " +"τελεστές :class:`int`, το αποτέλεσμα έχει τον ίδιο τύπο με τους τελεστές " +"(μετά τον εξαναγκασμό), εκτός εάν το δεύτερο όρισμα είναι αρνητικό∙ σε αυτή " +"την περίπτωση, όλα τα ορίσματα μετατρέπονται σε float και επιστρέφεται ένα " +"αποτέλεσμα τύπους float. Για παράδειγμα, ``pow(10, 2)`` επιστρέφει ``100``, " +"αλλά το ``pow(10, -2)`` επιστρέφει ``0.01``. Για μια αρνητική βάση τύπου :" +"class:`int` ή :class:`float` και έναν μη αναπόσπαστο εκθέτη, παραδίδεται ένα " +"μιγαδικό αποτέλεσμα. Για παράδειγμα, ``pow(-9, 0.5)`` επιστρέφει μια τιμή " +"κοντά στο ``3j``. Ενώ, για μια αρνητική βάση τύπου :class:`int` ή :class:" +"`float` με αναπόσπαστο εκθέτη, παραδίδεται ένα αποτέλεσμα float. Για " +"παράδειγμα, το ``pow(-9, 2.0)`` επιστρέφει το ``81.0``." + +#: library/functions.rst:1595 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2775,13 +3169,25 @@ msgstr "" "``pow(inv_base, -exp, mod)``, όπου το *inv_base* είναι αντίστροφο του *base* " "modulo *mod*." -#: library/functions.rst:1424 +#: library/functions.rst:1601 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "" "Ακολουθεί ένα παράδειγμα υπολογισμού ενός αντίστροφου για το ``38`` modulo " "``97``::" -#: library/functions.rst:1431 +#: library/functions.rst:1603 +msgid "" +">>> pow(38, -1, mod=97)\n" +"23\n" +">>> 23 * 38 % 97 == 1\n" +"True" +msgstr "" +">>> pow(38, -1, mod=97)\n" +"23\n" +">>> 23 * 38 % 97 == 1\n" +"True" + +#: library/functions.rst:1608 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2790,14 +3196,14 @@ msgstr "" "τώρα το δεύτερο όρισμα να είναι αρνητικό, επιτρέποντας τον υπολογισμό των " "αρθρωτών αντίστροφων." -#: library/functions.rst:1436 +#: library/functions.rst:1613 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "" "Επιτρέπονται ορίσματα keyword. Παλαιότερα, υποστηρίζονταν μόνο ορίσματα " "θέσης." -#: library/functions.rst:1443 +#: library/functions.rst:1620 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2807,7 +3213,7 @@ msgstr "" "ακολουθούμενα από *end*. Τα *sep*, *end*, *file*, και *flush*, εάν υπάρχουν, " "πρέπει να δίνονται ως ορίσματα keyword." -#: library/functions.rst:1447 +#: library/functions.rst:1624 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2822,21 +3228,21 @@ msgstr "" "προεπιλεγμένες τιμές. Εάν δεν δίνονται *αντικείμενα*, η :func:`print` θα " "γράψει απλά *end*." -#: library/functions.rst:1453 +#: library/functions.rst:1630 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " "arguments are converted to text strings, :func:`print` cannot be used with " "binary mode file objects. For these, use ``file.write(...)`` instead." msgstr "" -"Το όρισμα *file* πρέπει να είναι αντικείμενο με μια μέθοδο " -"``write(string)``∙ εάν δεν υπάρχει ή είναι ``None``, θα χρησιμοποιηθεί το :" -"data:`sys.stdout`. Επειδή τα τυπωμένα ορίσματα μετατρέπονται σε " -"συμβολοσειρές κειμένου, η :func:`print` δεν μπορεί να χρησιμοποιηθεί με " -"αντικείμενα αρχείου δυαδικής λειτουργίας. Για αυτά, χρησιμοποιούμε το " -"``file.write(...)``." +"Το όρισμα *file* πρέπει να είναι αντικείμενο με μια μέθοδο ``write(string)`` " +"∙ εάν δεν υπάρχει ή είναι ``None``, θα χρησιμοποιηθεί το :data:`sys." +"stdout`. Επειδή τα τυπωμένα ορίσματα μετατρέπονται σε συμβολοσειρές " +"κειμένου, η :func:`print` δεν μπορεί να χρησιμοποιηθεί με αντικείμενα " +"αρχείου δυαδικής λειτουργίας. Για αυτά, χρησιμοποιούμε το ``file." +"write(...)``." -#: library/functions.rst:1458 +#: library/functions.rst:1635 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2844,15 +3250,15 @@ msgstr "" "Η προσωρινή αποθήκευση εξόδου καθορίζεται συνήθως από το *αρχείο*. Ωστόσο, " "εάν το *flush* είναι αληθές, η ροή ξεπλένεται αναγκαστικά." -#: library/functions.rst:1462 +#: library/functions.rst:1639 msgid "Added the *flush* keyword argument." msgstr "Προστέθηκε το όρισμα keyword *flush*." -#: library/functions.rst:1468 +#: library/functions.rst:1645 msgid "Return a property attribute." msgstr "Επιστρέφει ένα χαρακτηριστικό ιδιότητας." -#: library/functions.rst:1470 +#: library/functions.rst:1647 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2863,20 +3269,52 @@ msgstr "" "*fdel* είναι μια συνάρτηση για τη διαγραφή μιας τιμής χαρακτηριστικού. Και " "το *doc* δημιουργεί μια συμβολοσειρά εγγράφων για το χαρακτηριστικό." -#: library/functions.rst:1474 +#: library/functions.rst:1651 msgid "A typical use is to define a managed attribute ``x``::" msgstr "" "Μια τυπική χρήση είναι ο ορισμός ενός διαχειριζόμενου χαρακτηριστικού ``x``::" -#: library/functions.rst:1491 +#: library/functions.rst:1653 +msgid "" +"class C:\n" +" def __init__(self):\n" +" self._x = None\n" +"\n" +" def getx(self):\n" +" return self._x\n" +"\n" +" def setx(self, value):\n" +" self._x = value\n" +"\n" +" def delx(self):\n" +" del self._x\n" +"\n" +" x = property(getx, setx, delx, \"I'm the 'x' property.\")" +msgstr "" +"class C:\n" +" def __init__(self):\n" +" self._x = None\n" +"\n" +" def getx(self):\n" +" return self._x\n" +"\n" +" def setx(self, value):\n" +" self._x = value\n" +"\n" +" def delx(self):\n" +" del self._x\n" +"\n" +" x = property(getx, setx, delx, \"I'm the 'x' property.\")" + +#: library/functions.rst:1668 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." msgstr "" "Εάν το *c* είναι ένα instance του *C*, το ``c.x`` θα καλέσει τον λήπτη, το " -"``c.x = value` θα καλέσει τον ρυθμιστή, και το ``del c.x`` τον διαγραφέα." +"``c.x = value`` θα καλέσει τον ρυθμιστή, και το ``del c.x`` τον διαγραφέα." -#: library/functions.rst:1494 +#: library/functions.rst:1671 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2888,7 +3326,27 @@ msgstr "" "υπάρχει). Αυτό καθιστά δυνατή τη δημιουργία ιδιοτήτων μόνο για ανάγνωση, " "εύκολα χρησιμοποιώντας τη :func:`property` ως :term:`decorator`::" -#: library/functions.rst:1507 +#: library/functions.rst:1675 +msgid "" +"class Parrot:\n" +" def __init__(self):\n" +" self._voltage = 100000\n" +"\n" +" @property\n" +" def voltage(self):\n" +" \"\"\"Get the current voltage.\"\"\"\n" +" return self._voltage" +msgstr "" +"class Parrot:\n" +" def __init__(self):\n" +" self._voltage = 100000\n" +"\n" +" @property\n" +" def voltage(self):\n" +" \"\"\"Get the current voltage.\"\"\"\n" +" return self._voltage" + +#: library/functions.rst:1684 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " @@ -2898,7 +3356,7 @@ msgstr "" "\"getter\" για ένα χαρακτηριστικό μόνο για ανάγνωση με το ίδιο όνομα, και " "ορίζει τη συμβολοσειρά εγγράφων για *voltage* σε \"Get the current voltage.\"" -#: library/functions.rst:1515 +#: library/functions.rst:1692 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2910,7 +3368,43 @@ msgstr "" "ένα αντίγραφο της ιδιότητας με την αντίστοιχη συνάρτηση accessor που έχει " "οριστεί στον decorator. Αυτό εξηγείται καλύτερα με ένα παράδειγμα:" -#: library/functions.rst:1539 +#: library/functions.rst:1697 +msgid "" +"class C:\n" +" def __init__(self):\n" +" self._x = None\n" +"\n" +" @property\n" +" def x(self):\n" +" \"\"\"I'm the 'x' property.\"\"\"\n" +" return self._x\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value\n" +"\n" +" @x.deleter\n" +" def x(self):\n" +" del self._x" +msgstr "" +"class C:\n" +" def __init__(self):\n" +" self._x = None\n" +"\n" +" @property\n" +" def x(self):\n" +" \"\"\"I'm the 'x' property.\"\"\"\n" +" return self._x\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value\n" +"\n" +" @x.deleter\n" +" def x(self):\n" +" del self._x" + +#: library/functions.rst:1716 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " @@ -2920,7 +3414,7 @@ msgstr "" "να δώσετε στις πρόσθετες συναρτήσεις το ίδιο όνομα με την αρχική ιδιότητα " "(``x`` σε αυτήν την περίπτωση.)" -#: library/functions.rst:1543 +#: library/functions.rst:1720 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." @@ -2929,11 +3423,19 @@ msgstr "" "``fget``, ``fset``, και ``fdel`` που αντιστοιχούν στα ορίσματα του " "κατασκευαστή." -#: library/functions.rst:1546 +#: library/functions.rst:1723 msgid "The docstrings of property objects are now writeable." msgstr "Τα *docstrings* των αντικειμένων ιδιότητας είναι πλέον εγγράψιμες." -#: library/functions.rst:1555 +#: library/functions.rst:1728 +msgid "" +"Attribute holding the name of the property. The name of the property can be " +"changed at runtime." +msgstr "" +"Χαρακτηριστικό που περιέχει το όνομα της ιδιότητας. Το όνομα της ιδιότητας " +"μπορεί να αλλάξει κατά την εκτέλεση." + +#: library/functions.rst:1739 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." @@ -2942,7 +3444,7 @@ msgstr "" "αμετάβλητος τύπος ακολουθίας, όπως τεκμηριώνεται στα :ref:`typesseq-range` " "και :ref:`typesseq`." -#: library/functions.rst:1561 +#: library/functions.rst:1745 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -2957,7 +3459,7 @@ msgstr "" "Επιστρέφει μια συμβολοσειρά που περιέχει μια εκτυπώσιμη αναπαράσταση ενός " "αντικειμένου. Για πολλούς τύπους, αυτή η συνάρτηση κάνει μια προσπάθεια να " "επιστρέψει μια συμβολοσειρά που θα απέδιδε ένα αντικείμενο με την ίδια τιμή " -"όταν μεταβιβαζόταν στο :func:`eval`∙ διαφορετικά, η αναπαράσταση είναι μια " +"όταν μεταβιβαζόταν στο :func:`eval` ∙ διαφορετικά, η αναπαράσταση είναι μια " "συμβολοσειρά που περικλείεται σε αγκύλες που περιέχει το όνομα του τύπου του " "αντικειμένου μαζί με πρόσθετες πληροφορίες που συχνά περιλαμβάνουν το όνομα " "και τη διεύθυνση του αντικειμένου. Μια κλάση μπορεί να ελέγξει τι " @@ -2965,24 +3467,43 @@ msgstr "" "`~object.__repr__`. Εάν η :func:`sys.displayhook` δεν είναι προσβάσιμη, αυτή " "η συνάρτηση θα κάνει raise το :exc:`RuntimeError`." -#: library/functions.rst:1572 +#: library/functions.rst:1756 msgid "This class has a custom representation that can be evaluated::" msgstr "" "Αυτή η κλάση έχει μια προσαρμοσμένη αναπαράσταση που μπορεί να αξιολογηθεί::" -#: library/functions.rst:1585 +#: library/functions.rst:1758 +msgid "" +"class Person:\n" +" def __init__(self, name, age):\n" +" self.name = name\n" +" self.age = age\n" +"\n" +" def __repr__(self):\n" +" return f\"Person('{self.name}', {self.age})\"" +msgstr "" +"class Person:\n" +" def __init__(self, name, age):\n" +" self.name = name\n" +" self.age = age\n" +"\n" +" def __repr__(self):\n" +" return f\"Person('{self.name}', {self.age})\"" + +#: library/functions.rst:1769 msgid "" -"Return a reverse :term:`iterator`. *seq* must be an object which has a :" -"meth:`~object.__reversed__` method or supports the sequence protocol (the :" -"meth:`~object.__len__` method and the :meth:`~object.__getitem__` method " -"with integer arguments starting at ``0``)." +"Return a reverse :term:`iterator`. The argument must be an object which has " +"a :meth:`~object.__reversed__` method or supports the sequence protocol " +"(the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` " +"method with integer arguments starting at ``0``)." msgstr "" -"Επιστρέφει ένα αντίστροφο :term:`iterator`. Το *seq* πρέπει να είναι ένα " -"αντικείμενο που έχει μια μέθοδο :meth:`~object.__reversed__` ή υποστηρίζει " -"το πρωτόκολλο ακολουθίας (η μέθοδος :meth:`~object.__len__` και η μέθοδος :" -"meth:`~object.__getitem__` με ακέραια ορίσματα που ξεκινούν από ``0``)." +"Επιστρέφει ένα αντίστροφο :term:`iterator`. Το όρισμα πρέπει να είναι ένα " +"αντικείμενο το οποίο έχει μια μέθοδο :meth:`~object.__reversed__` ή " +"υποστηρίζει το πρωτόκολλο ακολουθίας (τη μέθοδο :meth:`~object.__len__` και " +"τη μέθοδο :meth:`~object.__getitem__` με ακέραια ορίσματα που ξεκινούν από " +"το 0)." -#: library/functions.rst:1593 +#: library/functions.rst:1777 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " @@ -2992,7 +3513,7 @@ msgstr "" "υποδιαστολή. Εάν το *ndigits* παραληφθεί ή είναι ``None``, επιστρέφει τον " "πλησιέστερο ακέραιο αριθμό στην είσοδό του." -#: library/functions.rst:1597 +#: library/functions.rst:1781 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -3011,7 +3532,7 @@ msgstr "" "επιστρεφόμενη τιμή είναι ακέραιος εάν το *ndigits* παραλειφθεί ή είναι " "``None``. Διαφορετικά, η τιμή επιστροφής έχει τον ίδιο τύπο με το *number*." -#: library/functions.rst:1606 +#: library/functions.rst:1790 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." @@ -3019,7 +3540,7 @@ msgstr "" "Για ένα γενικό αντικείμενο Python ``number``, ``round`` εκχωρεί στο ``number." "__round__``." -#: library/functions.rst:1611 +#: library/functions.rst:1795 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -3033,7 +3554,7 @@ msgstr "" "περισσότερα δεκαδικά κλάσματα δεν μπορούν να αναπαρασταθούν ακριβώς ως " "float. Δείτε το :ref:`tut-fp-issues` για περισσότερες πληροφορίες." -#: library/functions.rst:1623 +#: library/functions.rst:1806 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" @@ -3043,7 +3564,7 @@ msgstr "" "λαμβάνονται από το *iterable*. Το ``set`` είναι μια ενσωματωμένη κλάση. " "Δείτε :class:`set` και :ref:`types-set` για τεκμηρίωση αυτής της κλάσης." -#: library/functions.rst:1627 +#: library/functions.rst:1810 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " @@ -3053,7 +3574,7 @@ msgstr "" "class:`list`, :class:`tuple`, και :class:`dict`, καθώς και το module :mod:" "`collections`." -#: library/functions.rst:1634 +#: library/functions.rst:1817 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3068,7 +3589,7 @@ msgstr "" "επιτρέπει. Για παράδειγμα ``setattr(x, 'foobar', 123)`` ισοδυναμεί με το " "``x.foobar = 123``." -#: library/functions.rst:1640 +#: library/functions.rst:1823 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a custom :meth:" @@ -3083,7 +3604,7 @@ msgstr "" "αναγνωριστικό δεν θα είναι προσβάσιμο χρησιμοποιώντας τη σημειογραφία, αλλά " "είναι προσβάσιμο μέσω του :func:`getattr` κ.λπ.." -#: library/functions.rst:1648 +#: library/functions.rst:1831 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -3094,7 +3615,7 @@ msgstr "" "μη αυτόματο τρόπο το όνομα ενός ιδιωτικού χαρακτηριστικού (χαρακτηριστικά με " "δύο προπορευόμενες κάτω παύλες) για να το ορίσει με :func:`setattr`." -#: library/functions.rst:1657 +#: library/functions.rst:1840 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " @@ -3104,7 +3625,7 @@ msgstr "" "δεικτών που καθορίζονται από το ``range(start, stop, step)``. Τα ορίσματα " "*start* και *step* είναι από προεπιλογή ``None``." -#: library/functions.rst:1665 +#: library/functions.rst:1844 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3117,7 +3638,7 @@ msgstr "" "λειτουργικότητα∙ ωστόσο, χρησιμοποιούνται από το NumPy και άλλα πακέτα " "τρίτων." -#: library/functions.rst:1670 +#: library/functions.rst:1853 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" @@ -3128,7 +3649,7 @@ msgstr "" "stop, i]``. Δείτε τη :func:`itertools.islice` για μια εναλλακτική έκδοση " "που επιστρέφει ένα :term:`iterator`." -#: library/functions.rst:1675 +#: library/functions.rst:1858 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." @@ -3137,18 +3658,18 @@ msgstr "" "`~slice.start`, :attr:`~slice.stop`, και :attr:`~slice.step` μπορούν να " "κατακερματιστούν)." -#: library/functions.rst:1681 +#: library/functions.rst:1864 msgid "Return a new sorted list from the items in *iterable*." msgstr "Επιστρέφει μια νέα ταξινομημένη λίστα από τα στοιχεία στο *iterable*." -#: library/functions.rst:1683 +#: library/functions.rst:1866 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "" "Έχει δύο προαιρετικά ορίσματα που πρέπει να καθοριστούν ως ορίσματα λέξεων-" "κλειδιών." -#: library/functions.rst:1685 +#: library/functions.rst:1868 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." @@ -3159,7 +3680,7 @@ msgstr "" "παράδειγμα, ``key=str.lower``). Η προεπιλεγμένη τιμή είναι ``None`` " "(συγκρίνει τα στοιχεία απευθείας)." -#: library/functions.rst:1689 +#: library/functions.rst:1872 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." @@ -3167,7 +3688,7 @@ msgstr "" "Το *reverse* είναι μια δυαδική τιμή. Εάν οριστεί σε ``True``, τότε τα " "στοιχεία της λίστας ταξινομούνται σαν να είχε αντιστραφεί κάθε σύγκριση." -#: library/functions.rst:1692 +#: library/functions.rst:1875 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." @@ -3175,7 +3696,7 @@ msgstr "" "Χρησιμοποιήστε το :func:`functools.cmp_to_key` για να μετατρέψετε μια " "συνάρτηση *cmp* παλιού τύπου σε συνάρτηση *key*." -#: library/functions.rst:1695 +#: library/functions.rst:1878 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3188,7 +3709,7 @@ msgstr "" "πολλαπλά περάσματα (για παράδειγμα, ταξινόμηση ανά τμήμα, μετά ανά " "μισθολογικό βαθμό)." -#: library/functions.rst:1700 +#: library/functions.rst:1883 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3196,7 +3717,7 @@ msgid "" "implemented. This will help avoid bugs when using the same data with other " "ordering tools such as :func:`max` that rely on a different underlying " "method. Implementing all six comparisons also helps avoid confusion for " -"mixed type comparisons which can call reflected the :meth:`~object.__gt__` " +"mixed type comparisons which can call the reflected :meth:`~object.__gt__` " "method." msgstr "" "Ο αλγόριθμος ταξινόμησης χρησιμοποιεί μόνο συγκρίσεις ``<`` μεταξύ " @@ -3208,18 +3729,18 @@ msgstr "" "έξι συγκρίσεων βοηθά επίσης στην αποφυγή σύγχυσης για συγκρίσεις μικτού " "τύπου που μπορούν να καλέσουν την ανακλώμενη μέθοδο :meth:`~object.__gt__`." -#: library/functions.rst:1709 +#: library/functions.rst:1892 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" "Για παραδείγματα ταξινόμησης και ένα σύντομο σεμινάριο ταξινόμησης, " "ανατρέξτε στο :ref:`sortinghowto`." -#: library/functions.rst:1713 +#: library/functions.rst:1896 msgid "Transform a method into a static method." msgstr "Μετατροπή μιας μεθόδου σε στατική μέθοδο." -#: library/functions.rst:1715 +#: library/functions.rst:1898 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" @@ -3227,7 +3748,17 @@ msgstr "" "Μια στατική μέθοδος δεν λαμβάνει ένα σιωπηρό πρώτο όρισμα. Για να δηλώσετε " "μια στατική μέθοδο, χρησιμοποιήστε αυτό το ιδίωμα::" -#: library/functions.rst:1722 +#: library/functions.rst:1901 +msgid "" +"class C:\n" +" @staticmethod\n" +" def f(arg1, arg2, argN): ..." +msgstr "" +"class C:\n" +" @staticmethod\n" +" def f(arg1, arg2, argN): ..." + +#: library/functions.rst:1905 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3235,17 +3766,19 @@ msgstr "" "Η φόρμα ``@staticmethod`` είναι μια συνάρτηση :term:`decorator` -- δείτε :" "ref:`function` για λεπτομέρειες." -#: library/functions.rst:1725 +#: library/functions.rst:1908 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, they can be called as regular " -"functions (such as ``f()``)." +"an instance (such as ``C().f()``). Moreover, the static method :term:" +"`descriptor` is also callable, so it can be used in the class definition " +"(such as ``f()``)." msgstr "" "Μια στατική μέθοδος μπορεί να κληθεί είτε στην κλάση (όπως ``C.f()``) είτε " -"σε ένα instance (όπως ``C().f()``). Επιπλέον, μπορούν να κληθούν ως " -"κανονικές συναρτήσεις (όπως ``f()``)." +"σε ένα instance (όπως ``C().f()``). Επιπλέον, η στατική μέθοδος :term:" +"`descriptor` μπορεί επίσης να κληθεί, επομένως μπορεί να χρησιμοποιηθεί στον " +"ορισμός της κλάσης (όπως ``f()``)." -#: library/functions.rst:1729 +#: library/functions.rst:1913 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " @@ -3255,7 +3788,7 @@ msgstr "" "Java ή στη C++. Επίσης, ανατρέξτε στη :func:`classmethod` για μια παραλλαγή " "που είναι χρήσιμη για τη δημιουργία εναλλακτικών κατασκευαστών κλάσεων." -#: library/functions.rst:1733 +#: library/functions.rst:1917 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3270,31 +3803,47 @@ msgstr "" "αυτόματη μετατροπή σε instance μέθοδο. Για αυτές τις περιπτώσεις, " "χρησιμοποιήστε αυτό το ιδίωμα::" -#: library/functions.rst:1745 +#: library/functions.rst:1923 +msgid "" +"def regular_function():\n" +" ...\n" +"\n" +"class C:\n" +" method = staticmethod(regular_function)" +msgstr "" +"def regular_function():\n" +" ...\n" +"\n" +"class C:\n" +" method = staticmethod(regular_function)" + +#: library/functions.rst:1929 msgid "For more information on static methods, see :ref:`types`." msgstr "" "Για περισσότερες πληροφορίες σχετικά με τις στατικές μεθόδους, δείτε το :ref:" "`types`." -#: library/functions.rst:1747 +#: library/functions.rst:1931 msgid "" -"Static methods now inherit the method attributes (``__module__``, " -"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a " -"new ``__wrapped__`` attribute, and are now callable as regular functions." +"Static methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " +"``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" -"Οι στατικές μέθοδοι κληρονομούν πλέον τα χαρακτηριστικά της μεθόδου " -"(``__module__``, ``__name__``, ``__qualname__``, ``__doc__`` και " -"``__annotations__``), έχουν ένα νέο χαρακτηριστικό ``__wrapped__``, και " +"Οι στατικές μέθοδοι κληρονομούν πλέον τα χαρακτηριστικά της μεθόδου (:attr:" +"`~function.__module__`, :attr:`~function.__name__`, :attr:`~function." +"__qualname__`, :attr:`~function.__doc__` και :attr:`~function." +"__annotations__`),, έχουν ένα νέο χαρακτηριστικό ``__wrapped__``, και " "μπορούν πλέον να καλούνται ως κανονικές λειτουργίες." -#: library/functions.rst:1762 +#: library/functions.rst:1949 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" "Επιστρέφει μια έκδοση :class:`str` του *object*. Δείτε :func:`str` για " "λεπτομέρειες." -#: library/functions.rst:1764 +#: library/functions.rst:1951 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." @@ -3302,7 +3851,7 @@ msgstr "" "Το ``str`` είναι η ενσωματωμένη συμβολοσειρά :term:`class`. Για γενικές " "πληροφορίες σχετικά με τις συμβολοσειρές, ανατρέξτε :ref:`textseq`." -#: library/functions.rst:1770 +#: library/functions.rst:1957 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " @@ -3312,11 +3861,11 @@ msgstr "" "και επιστρέφει το σύνολο. Τα στοιχεία του *iterable* είναι συνήθως αριθμοί " "και η τιμή έναρξης δεν επιτρέπεται να είναι συμβολοσειρά." -#: library/functions.rst:1774 +#: library/functions.rst:1961 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." -"join(sequence)``. To add floating point values with extended precision, " +"join(sequence)``. To add floating-point values with extended precision, " "see :func:`math.fsum`\\. To concatenate a series of iterables, consider " "using :func:`itertools.chain`." msgstr "" @@ -3327,19 +3876,27 @@ msgstr "" "να συνδυάσετε μια σειρά iterable, σκεφτείτε να χρησιμοποιήσετε το :func:" "`itertools.chain`." -#: library/functions.rst:1780 +#: library/functions.rst:1967 msgid "The *start* parameter can be specified as a keyword argument." msgstr "Η παράμετρος *start* μπορεί να καθοριστεί ως όρισμα keyword." -#: library/functions.rst:1783 +#: library/functions.rst:1970 msgid "" -"Summation of floats switched to an algorithm that gives higher accuracy on " -"most builds." +"Summation of floats switched to an algorithm that gives higher accuracy and " +"better commutativity on most builds." msgstr "" "Η άθροιση των floats άλλαξε σε έναν αλγόριθμο που δίνει μεγαλύτερη ακρίβεια " -"στις περισσότερες κατασκευές." +"και καλύτερη αντιμεταθετικότητα στις περισσότερες κατασκευές." -#: library/functions.rst:1790 +#: library/functions.rst:1973 +msgid "" +"Added specialization for summation of complexes, using same algorithm as for " +"summation of floats." +msgstr "" +"Προστέθηκε εξειδίκευση για άθροιση συμπλεγμάτων, χρησιμοποιώντας τον ίδιο " +"αλγόριθμο όπως για την άθροιση των float." + +#: library/functions.rst:1981 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " @@ -3349,7 +3906,7 @@ msgstr "" "μεθόδου σε μια γονική ή αδερφή κλάση *type*. Αυτό είναι χρήσιμο για την " "πρόσβαση σε μεταβιβασμένες μεθόδους που έχουν παρακαμφθεί σε μια κλάση." -#: library/functions.rst:1794 +#: library/functions.rst:1985 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." @@ -3357,29 +3914,30 @@ msgstr "" "Το *object_or_type* καθορίζει το :term:`method resolution order` που θα " "αναζητηθεί. Η αναζήτηση ξεκινά από την κλάση αμέσως μετά τον *type*." -#: library/functions.rst:1798 +#: library/functions.rst:1989 msgid "" -"For example, if :attr:`~class.__mro__` of *object_or_type* is ``D -> B -> C -" +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -"Για παράδειγμα, εάν :attr:`~class.__mro__` του *object_or_type* είναι ``D -> " +"Για παράδειγμα, εάν :attr:`~type.__mro__` του *object_or_type* είναι ``D -> " "B -> C -> A -> object`` και η τιμή του *type* είναι ``B``, τότε η :func:" "`super` αναζητά ``C -> A -> object``." -#: library/functions.rst:1802 +#: library/functions.rst:1993 msgid "" -"The :attr:`~class.__mro__` attribute of the *object_or_type* lists the " -"method resolution search order used by both :func:`getattr` and :func:" -"`super`. The attribute is dynamic and can change whenever the inheritance " -"hierarchy is updated." +"The :attr:`~type.__mro__` attribute of the class corresponding to " +"*object_or_type* lists the method resolution search order used by both :func:" +"`getattr` and :func:`super`. The attribute is dynamic and can change " +"whenever the inheritance hierarchy is updated." msgstr "" -"¨Το χαρακτηριστικό :attr:`~class.__mro__` του *object_or_type* παραθέτει τη " -"σειρά αναζήτησης ανάλυσης μεθόδου που χρησιμοποιείται και από τις :func:" -"`getattr` και :func:`super`. Το χαρακτηριστικό είναι δυναμικό και μπορεί να " -"αλλάξει κάθε φορά που ενημερώνεται η ιεραρχία κληρονομικότητας." +"Το χαρακτηριστικό :attr:`~type.__mro__` της κλάσης που αντιστοιχεί σε λίστες " +"του *object_or_type* παραθέτει τη σειρά αναζήτησης ανάλυσης μεθόδου που " +"χρησιμοποιείται και από τις :func:`getattr` και :func:`super`. Το " +"χαρακτηριστικό είναι δυναμικό και μπορεί να αλλάξει κάθε φορά που " +"ενημερώνεται η ιεραρχία κληρονομικότητας." -#: library/functions.rst:1807 +#: library/functions.rst:1998 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3392,7 +3950,24 @@ msgstr "" "είναι ένας τύπος, το ``issubclass(type2, type)`` πρέπει να είναι αληθές " "(αυτό είναι χρήσιμο για μεθόδους κλάσης)." -#: library/functions.rst:1812 +#: library/functions.rst:2003 +msgid "" +"When called directly within an ordinary method of a class, both arguments " +"may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " +"be the enclosing class, and *obj* will be the first argument of the " +"immediately enclosing function (typically ``self``). (This means that zero-" +"argument :func:`!super` will not work as expected within nested functions, " +"including generator expressions, which implicitly create nested functions.)" +msgstr "" +"Όταν καλείται απευθείας μέσα σε μια κανονική μέθοδο μιας κλάσης, και τα δύο " +"ορίσματα μπορούν να παραλειφθούν (\"χωρίς ορίσματα :func:`!super`\"). Σε " +"αυτή την περίπτωση, το *type* είναι η περιβάλλουσα κλάση και το *obj* είναι " +"το πρώτο όρισμα της αμέσως περιβάλλουσας συνάρτησης (συνήθως ``self``). " +"(Αυτό σημαίνει ότι η :func:`!super` χωρίς ορίσματα δεν θα λειτουργήσει όπως " +"αναμένεται μέσα σε φωλιασμένες συναρτήσεις, συμπεριλαμβανομένων και των " +"γεννητριών εκφράσεων, οι οποίες δημιουργούν έμμεσα φωλιασμένες συναρτήσεις.)" + +#: library/functions.rst:2010 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3405,7 +3980,7 @@ msgstr "" "έτσι τον κώδικα πιο διατηρήσιμο. Αυτή η χρήση είναι πολύ παράλληλη με τη " "χρήση του *super* σε άλλες γλώσσες προγραμματισμού." -#: library/functions.rst:1817 +#: library/functions.rst:2015 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3429,13 +4004,25 @@ msgstr "" "διάταξη μπορεί να περιλαμβάνει αδερφικές κλάσεις πριν από τον χρόνο " "εκτέλεσης)." -#: library/functions.rst:1827 +#: library/functions.rst:2025 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" "Και για τις δύο περιπτώσεις χρήσης, μια τυπική κλήση υπερκλάσης μοιάζει με " "αυτό::" -#: library/functions.rst:1834 +#: library/functions.rst:2027 +msgid "" +"class C(B):\n" +" def method(self, arg):\n" +" super().method(arg) # This does the same thing as:\n" +" # super(C, self).method(arg)" +msgstr "" +"class C(B):\n" +" def method(self, arg):\n" +" super().method(arg) # This does the same thing as:\n" +" # super(C, self).method(arg)" + +#: library/functions.rst:2032 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " @@ -3445,7 +4032,7 @@ msgstr "" "αναζητήσεις χαρακτηριστικών. Μια πιθανή περίπτωση χρήσης για αυτό είναι η " "κλήση :term:`descriptors ` σε μια κλάση γονέα ή αδελφού." -#: library/functions.rst:1838 +#: library/functions.rst:2036 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3462,7 +4049,7 @@ msgstr "" "οριστεί για σιωπηρές αναζητήσεις που χρησιμοποιούν δηλώσεις ή τελεστές όπως " "``super()[name]``." -#: library/functions.rst:1846 +#: library/functions.rst:2044 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3479,7 +4066,7 @@ msgstr "" "ανάκτηση της κλάσης που ορίζεται, καθώς και για την πρόσβαση στην τρέχουσα " "παρουσία για συνηθισμένες μεθόδους." -#: library/functions.rst:1853 +#: library/functions.rst:2051 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." -#: library/functions.rst:1863 +#: library/functions.rst:2055 +msgid "" +":class:`super` objects are now :mod:`pickleable ` and :mod:" +"`copyable `." +msgstr "" +"Τα αντικείμενα :class:`super` είναι πλέον :mod:`pickleable ` και :" +"mod:`copyable `." + +#: library/functions.rst:2064 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." @@ -3498,17 +4093,17 @@ msgstr "" "αμετάβλητος τύπος ακολουθίας, όπως τεκμηριώνεται στα :ref:`typesseq-tuple` " "και :ref:`typesseq`." -#: library/functions.rst:1872 +#: library/functions.rst:2073 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." -"__class__ `." +"__class__`." msgstr "" "Με ένα όρισμα, επιστρέψτε τον τύπο ενός *object*. Η τιμή που επιστρέφεται " "είναι ένα αντικείμενο τύπου και γενικά το ίδιο αντικείμενο με αυτό που " -"επιστρέφεται από το :attr:`object.__class__ `." +"επιστρέφεται από το :attr:`object.__class__`." -#: library/functions.rst:1876 +#: library/functions.rst:2077 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." @@ -3516,34 +4111,46 @@ msgstr "" "Η ενσωματωμένη συνάρτηση :func:`isinstance` συνίσταται για τη δοκιμή του " "τύπου ενός αντικειμένου, επειδή λαμβάνει υπόψη τις υποκλάσεις." -#: library/functions.rst:1880 +#: library/functions.rst:2080 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " -"class name and becomes the :attr:`~definition.__name__` attribute. The " -"*bases* tuple contains the base classes and becomes the :attr:`~class." -"__bases__` attribute; if empty, :class:`object`, the ultimate base of all " -"classes, is added. The *dict* dictionary contains attribute and method " -"definitions for the class body; it may be copied or wrapped before becoming " -"the :attr:`~object.__dict__` attribute. The following two statements create " -"identical :class:`type` objects:" +"class name and becomes the :attr:`~type.__name__` attribute. The *bases* " +"tuple contains the base classes and becomes the :attr:`~type.__bases__` " +"attribute; if empty, :class:`object`, the ultimate base of all classes, is " +"added. The *dict* dictionary contains attribute and method definitions for " +"the class body; it may be copied or wrapped before becoming the :attr:`~type." +"__dict__` attribute. The following two statements create identical :class:`!" +"type` objects:" msgstr "" "Με τρία ορίσματα, επιστρέφει ένα αντικείμενο νέου τύπου. Αυτή είναι " "ουσιαστικά μια δυναμική μορφή της δήλωσης :keyword:`class`. Η συμβολοσειρά " -"*name* είναι το όνομα της κλάσης και γίνεται το χαρακτηριστικό :attr:" -"`~definition.__name__`. Η πλειάδα *bases* περιέχει τις βασικές κλάσεις και " -"γίνεται το χαρακτηριστικό :attr:`~class.__bases__` ∙ αν είναι κενό, " -"προστίθεται το :class:`object`, η τελική βάση όλων των κλάσεων. Το λεξικό " -"*dict* περιέχει ορισμούς χαρακτηριστικών και μεθόδων για το σώμα της κλάσης∙ " -"μπορεί να αντιγραφεί ή να προσαρμοστεί πριν γίνει το χαρακτηριστικό :attr:" -"`~object.__dict__`. Οι ακόλουθες δύο προτάσεις δημιουργούν πανομοιότυπα " -"αντικείμενα :class:`type`:" +"*name* είναι το όνομα της κλάσης και γίνεται το χαρακτηριστικό :attr:`~type." +"__name__`. Η πλειάδα *bases* περιέχει τις βασικές κλάσεις και γίνεται το " +"χαρακτηριστικό :attr:`~type.__bases__` ∙ αν είναι κενό, προστίθεται το :" +"class:`object`, η τελική βάση όλων των κλάσεων. Το λεξικό *dict* περιέχει " +"ορισμούς χαρακτηριστικών και μεθόδων για το σώμα της κλάσης∙ μπορεί να " +"αντιγραφεί ή να προσαρμοστεί πριν γίνει το χαρακτηριστικό :attr:`~type." +"__dict__`. Οι ακόλουθες δύο προτάσεις δημιουργούν πανομοιότυπα αντικείμενα :" +"class:`!type`:" + +#: library/functions.rst:2095 +msgid "See also:" +msgstr "Δείτε επίσης:" + +#: library/functions.rst:2097 +msgid "" +":ref:`Documentation on attributes and methods on classes `." +msgstr "" +":ref:`Τεκμηρίωση για χαρακτηριστικά και μεθόδους σε κλάσεις `." -#: library/functions.rst:1895 -msgid "See also :ref:`bltin-type-objects`." -msgstr "Δείτε επίσης :ref:`bltin-type-objects`." +#: library/functions.rst:2098 +msgid ":ref:`bltin-type-objects`" +msgstr ":ref:`bltin-type-objects`" -#: library/functions.rst:1897 +#: library/functions.rst:2100 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3555,52 +4162,46 @@ msgstr "" "__init_subclass__`) με τον ίδιο τρόπο που θα έκαναν οι λέξεις-κλειδιά στον " "ορισμό μιας κλάσης (εκτός από το *metaclass*)." -#: library/functions.rst:1902 +#: library/functions.rst:2105 msgid "See also :ref:`class-customization`." msgstr "Δείτε επίσης :ref:`class-customization`." -#: library/functions.rst:1904 +#: library/functions.rst:2107 msgid "" -"Subclasses of :class:`type` which don't override ``type.__new__`` may no " +"Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -"Οι υποκλάσης της :class:`type` που δεν αντικαθιστούν το ``type.__new__`` δεν " -"μπορούν πλέον να χρησιμοποιούν τη φόρμα ενός επιχειρήματος για να λάβουν τον " -"τύπο ενός αντικειμένου." +"Οι υποκλάσης της :class:`!type` που δεν αντικαθιστούν το ``type.__new__`` " +"δεν μπορούν πλέον να χρησιμοποιούν τη φόρμα ενός επιχειρήματος για να λάβουν " +"τον τύπο ενός αντικειμένου." -#: library/functions.rst:1911 +#: library/functions.rst:2114 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " -"or any other object with a :attr:`~object.__dict__` attribute." +"or any other object with a :attr:`!__dict__` attribute." msgstr "" "Επιστρέφει το χαρακτηριστικό :attr:`~object.__dict__` για ένα module, κλάση, " -"instance, ή οποιοδήποτε άλλο αντικείμενο με ένα χαρακτηριστικό :attr:" -"`~object.__dict__`." +"στιγμιότυπο, ή οποιοδήποτε άλλο αντικείμενο με ένα χαρακτηριστικό :attr:`!" +"__dict__`." -#: library/functions.rst:1914 +#: library/functions.rst:2117 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`~object.__dict__` attributes (for example, classes use a :class:" -"`types.MappingProxyType` to prevent direct dictionary updates)." +"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." +"MappingProxyType` to prevent direct dictionary updates)." msgstr "" "Αντικείμενα όπως modules και instances έχουν ένα χαρακτηριστικό :attr:" "`~object.__dict__` με δυνατότητα ενημέρωσης∙ ωστόσο, άλλα αντικείμενα μπορεί " -"να έχουν περιορισμούς εγγραφής στα χαρακτηριστικά τους :attr:`~object." -"__dict__` (για παράδειγμα, οι κλάσεις χρησιμοποιούν ένα :class:`types." +"να έχουν περιορισμούς εγγραφής στα χαρακτηριστικά τους :attr:`!__dict__` " +"(για παράδειγμα, οι κλάσεις χρησιμοποιούν ένα :class:`types." "MappingProxyType` για την αποτροπή άμεσων ενημερώσεων λεξικού)." -#: library/functions.rst:1919 -msgid "" -"Without an argument, :func:`vars` acts like :func:`locals`. Note, the " -"locals dictionary is only useful for reads since updates to the locals " -"dictionary are ignored." -msgstr "" -"Χωρίς ένα όρισμα, το :func:`vars` λειτουργεί όπως :func:`locals`. " -"Σημειώστε, ότι το λεξικό των τοπικών είναι χρήσιμο μόνο για ανάγνωση, καθώς " -"οι ενημερώσεις στο λεξικό των τοπικών αγνοούνται." +#: library/functions.rst:2122 +msgid "Without an argument, :func:`vars` acts like :func:`locals`." +msgstr "Χωρίς ένα όρισμα, :func:`vars` συμπεριφέρεται όπως :func:`locals`." -#: library/functions.rst:1923 +#: library/functions.rst:2124 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " @@ -3611,7 +4212,15 @@ msgstr "" "παράδειγμα, εάν η κλάση του ορίζει το :attr:`~object.__slots__` " "χαρακτηριστικό)." -#: library/functions.rst:1929 +#: library/functions.rst:2130 +msgid "" +"The result of calling this function without an argument has been updated as " +"described for the :func:`locals` builtin." +msgstr "" +"Το αποτέλεσμα της κλήσης αυτής της συνάρτησης χωρίς ένα όρισμα έχει " +"ενημερωθεί, όπως περιγράφεται για τη ενσωματωμένη :func:`locals`." + +#: library/functions.rst:2136 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." @@ -3619,11 +4228,27 @@ msgstr "" "Επανάληψη σε πολλούς iterables παράλληλα, δημιουργώντας πλειάδες με ένα " "αντικείμενο από το καθένα." -#: library/functions.rst:1932 +#: library/functions.rst:2139 msgid "Example::" msgstr "Παράδειγμα::" -#: library/functions.rst:1941 +#: library/functions.rst:2141 +msgid "" +">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" +"... print(item)\n" +"...\n" +"(1, 'sugar')\n" +"(2, 'spice')\n" +"(3, 'everything nice')" +msgstr "" +">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" +"... print(item)\n" +"...\n" +"(1, 'sugar')\n" +"(2, 'spice')\n" +"(3, 'everything nice')" + +#: library/functions.rst:2148 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." @@ -3632,7 +4257,7 @@ msgstr "" "πλειάδα περιέχει το *i*-ο στοιχείο από κάθε ένα από τους επαναλήψιμους " "ορισμάτων." -#: library/functions.rst:1944 +#: library/functions.rst:2151 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." -#: library/functions.rst:1948 +#: library/functions.rst:2155 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" @@ -3652,7 +4277,7 @@ msgstr "" "μέχρι να επαναληφθεί ο iterable, π.χ. με έναν βρόχο :keyword:`!for` ή με " "αναδίπλωση σε μια :class:`list`." -#: library/functions.rst:1952 +#: library/functions.rst:2159 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3665,7 +4290,7 @@ msgstr "" "κώδικα που προετοίμασε αυτά τα iterables. Η Python προσφέρει τρεις " "διαφορετικές προσεγγίσεις για την αντιμετώπιση αυτού του ζητήματος::" -#: library/functions.rst:1957 +#: library/functions.rst:2164 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " @@ -3675,7 +4300,15 @@ msgstr "" "Αυτό θα αγνοήσει τα υπόλοιπα στοιχεία στους μεγαλύτερους iterables, κόβοντας " "το αποτέλεσμα στο μήκος του συντομότερου iterable::" -#: library/functions.rst:1964 +#: library/functions.rst:2168 +msgid "" +">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" +"[(0, 'fee'), (1, 'fi'), (2, 'fo')]" +msgstr "" +">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" +"[(0, 'fee'), (1, 'fi'), (2, 'fo')]" + +#: library/functions.rst:2171 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " @@ -3686,7 +4319,15 @@ msgstr "" "της επιλογής ``strict=True``. Η έξοδος είναι ίδια με την κανονική :func:" "`zip`::" -#: library/functions.rst:1971 +#: library/functions.rst:2175 +msgid "" +">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" +"[('a', 1), ('b', 2), ('c', 3)]" +msgstr "" +">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" +"[('a', 1), ('b', 2), ('c', 3)]" + +#: library/functions.rst:2178 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" @@ -3694,7 +4335,7 @@ msgstr "" "Σε αντίθεση με την προεπιλεγμένη συμπεριφορά, γίνεται raise ένα :exc:" "`ValueError` εάν ένα iterable εξαντληθεί πριν από τα άλλα:" -#: library/functions.rst:1989 +#: library/functions.rst:2196 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " @@ -3704,7 +4345,7 @@ msgstr "" "μήκη διαφορετικού μήκους θα τεθεί σε σίγαση, πιθανώς να εμφανίζεται ως " "δυσεύρετο σφάλμα σε άλλο μέρος του προγράμματος." -#: library/functions.rst:1993 +#: library/functions.rst:2200 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." @@ -3714,7 +4355,7 @@ msgstr "" "τα iterables να έχουνε το ίδιο μήκος. Αυτό γίνεται από το :func:`itertools." "zip_longest`." -#: library/functions.rst:1997 +#: library/functions.rst:2204 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." @@ -3722,11 +4363,11 @@ msgstr "" "Περιπτώσεις άκρων: Με ένα μόνο επαναληπτικό όρισμα, η :func:`zip` επιστρέφει " "έναν iterator 1-πλειάδων. Χωρίς ορίσματα, επιστρέφει έναν κενό iterator." -#: library/functions.rst:2000 +#: library/functions.rst:2207 msgid "Tips and tricks:" msgstr "Συμβουλές και κόλπα:" -#: library/functions.rst:2002 +#: library/functions.rst:2209 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3742,7 +4383,7 @@ msgstr "" "επαναλήπτη. Αυτό έχει ως αποτέλεσμα τη διαίρεση της εισόδου σε κομμάτια " "μήκους." -#: library/functions.rst:2008 +#: library/functions.rst:2215 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" @@ -3750,11 +4391,29 @@ msgstr "" "Η :func:`zip` σε συνδυασμό με τον τελεστή ``*`` μπορεί να χρησιμοποιηθεί για " "την αποσυμπίεση μιας λίστας::" -#: library/functions.rst:2019 +#: library/functions.rst:2218 +msgid "" +">>> x = [1, 2, 3]\n" +">>> y = [4, 5, 6]\n" +">>> list(zip(x, y))\n" +"[(1, 4), (2, 5), (3, 6)]\n" +">>> x2, y2 = zip(*zip(x, y))\n" +">>> x == list(x2) and y == list(y2)\n" +"True" +msgstr "" +">>> x = [1, 2, 3]\n" +">>> y = [4, 5, 6]\n" +">>> list(zip(x, y))\n" +"[(1, 4), (2, 5), (3, 6)]\n" +">>> x2, y2 = zip(*zip(x, y))\n" +">>> x == list(x2) and y == list(y2)\n" +"True" + +#: library/functions.rst:2226 msgid "Added the ``strict`` argument." msgstr "Προστέθηκε το όρισμα ``strict``." -#: library/functions.rst:2031 +#: library/functions.rst:2238 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." @@ -3762,7 +4421,7 @@ msgstr "" "Αυτή είναι μια προηγμένη συνάρτηση που δεν χρειάζεται στον καθημερινό " "προγραμματισμό της Python, σε αντίθεση με το :func:`importlib.import_module`." -#: library/functions.rst:2034 +#: library/functions.rst:2241 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3783,7 +4442,7 @@ msgstr "" "χρήση του :func:`__import__` επίσης αποθαρρύνεται υπέρ του :func:`importlib." "import_module`." -#: library/functions.rst:2043 +#: library/functions.rst:2250 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3800,7 +4459,7 @@ msgstr "" "χρησιμοποιεί τα *globals* της μόνο για να προσδιορίσει το πλαίσιο του " "πακέτου της δήλωσης :keyword:`import`." -#: library/functions.rst:2050 +#: library/functions.rst:2257 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3814,7 +4473,7 @@ msgstr "" "σε σχέση με τον κατάλογο του module που καλεί την :func:`__import__` (δείτε " "το :pep:`328` για λεπτομέρειες)." -#: library/functions.rst:2056 +#: library/functions.rst:2263 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3826,7 +4485,7 @@ msgstr "" "κουκκίδα), *όχι* το module που ονομάζεται *name*. Ωστόσο, όταν δίνεται ένα " "μη κενό όρισμα *fromlist*, επιστρέφεται το module με το όνομα *name*." -#: library/functions.rst:2061 +#: library/functions.rst:2268 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" @@ -3834,11 +4493,19 @@ msgstr "" "Για παράδειγμα, η δήλωση ``import spam`` καταλήγει σε bytecode που μοιάζει " "με τον ακόλουθο κώδικα::" -#: library/functions.rst:2066 +#: library/functions.rst:2271 +msgid "spam = __import__('spam', globals(), locals(), [], 0)" +msgstr "spam = __import__('spam', globals(), locals(), [], 0)" + +#: library/functions.rst:2273 msgid "The statement ``import spam.ham`` results in this call::" msgstr "Η δήλωση ``import spam.ham`` καταλήγει σε αυτήν την κλήση::" -#: library/functions.rst:2070 +#: library/functions.rst:2275 +msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" +msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" + +#: library/functions.rst:2277 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." @@ -3847,7 +4514,7 @@ msgstr "" "εδώ, επειδή αυτό είναι το αντικείμενο που συνδέεται με ένα όνομα με τη " "δήλωση :keyword:`import`." -#: library/functions.rst:2073 +#: library/functions.rst:2280 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" @@ -3855,7 +4522,17 @@ msgstr "" "Από την άλλη πλευρά, η δήλωση ``from spam.ham import eggs, sausage as saus`` " "καταλήγει σε ::" -#: library/functions.rst:2080 +#: library/functions.rst:2283 +msgid "" +"_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" +"eggs = _temp.eggs\n" +"saus = _temp.sausage" +msgstr "" +"_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" +"eggs = _temp.eggs\n" +"saus = _temp.sausage" + +#: library/functions.rst:2287 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " @@ -3865,7 +4542,7 @@ msgstr "" "αυτό το αντικείμενο, τα ονόματα προς εισαγωγή ανακτώνται και εκχωρούνται στα " "αντίστοιχα ονόματά τους." -#: library/functions.rst:2084 +#: library/functions.rst:2291 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." @@ -3873,7 +4550,7 @@ msgstr "" "Εάν θέλετε απλώς να εισάγετε ένα module (ενδεχομένως μέσα σε ένα πακέτο) με " "το όνομα, χρησιμοποιήστε το :func:`importlib.import_module`." -#: library/functions.rst:2087 +#: library/functions.rst:2294 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." @@ -3881,7 +4558,7 @@ msgstr "" "Αρνητικές τιμές για το *level* δεν υποστηρίζονται πλέον (το οποίο επίσης " "αλλάζει την προεπιλεγμένη τιμή σε 0)." -#: library/functions.rst:2091 +#: library/functions.rst:2298 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." @@ -3890,11 +4567,11 @@ msgstr "" "I`, τότε η μεταβλητή περιβάλλοντος :envvar:`PYTHONCASEOK` δεν λαμβάνεται " "υπόψιν." -#: library/functions.rst:2096 +#: library/functions.rst:2303 msgid "Footnotes" msgstr "Υποσημειώσεις" -#: library/functions.rst:2097 +#: library/functions.rst:2304 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3905,110 +4582,225 @@ msgstr "" "την λειτουργία μετατροπής νέας γραμμής για την μετατροπή νέων γραμμών σε " "στυλ Windows ή Mac." -#: library/functions.rst:153 +#: library/functions.rst:154 msgid "Boolean" msgstr "Boolean" -#: library/functions.rst:1870 +#: library/functions.rst:2071 msgid "type" msgstr "τύπος" -#: library/functions.rst:576 +#: library/functions.rst:652 msgid "built-in function" msgstr "ενσωματωμένη συνάρτηση" -#: library/functions.rst:576 +#: library/functions.rst:652 msgid "exec" msgstr "exec" -#: library/functions.rst:653 +#: library/functions.rst:750 msgid "NaN" msgstr "NaN" -#: library/functions.rst:653 +#: library/functions.rst:750 msgid "Infinity" msgstr "Άπειρο" -#: library/functions.rst:717 +#: library/functions.rst:820 msgid "__format__" msgstr "__format__" -#: library/functions.rst:1754 +#: library/functions.rst:1939 msgid "string" msgstr "string" -#: library/functions.rst:717 +#: library/functions.rst:820 msgid "format() (built-in function)" msgstr "format() (ενσωματωμένη συνάρτηση)" -#: library/functions.rst:1165 +#: library/functions.rst:1334 msgid "file object" msgstr "αντικείμενο αρχείου" -#: library/functions.rst:1286 +#: library/functions.rst:1455 msgid "open() built-in function" msgstr "open() ενσωματωμένη συνάρτηση" -#: library/functions.rst:1193 +#: library/functions.rst:1362 msgid "file" msgstr "αρχείο" -#: library/functions.rst:1193 +#: library/functions.rst:1362 msgid "modes" msgstr "λειτουργίες" -#: library/functions.rst:1286 +#: library/functions.rst:1455 msgid "universal newlines" msgstr "καθολικές νέες γραμμές" -#: library/functions.rst:1347 +#: library/functions.rst:1516 msgid "line-buffered I/O" msgstr "γραμμική προσωρινή μνήμη I/O" -#: library/functions.rst:1347 +#: library/functions.rst:1516 msgid "unbuffered I/O" msgstr "unbuffered I/O" -#: library/functions.rst:1347 +#: library/functions.rst:1516 msgid "buffer size, I/O" msgstr "μέγεθος bugger, I/O" -#: library/functions.rst:1347 +#: library/functions.rst:1516 msgid "I/O control" msgstr "Έλεγχος I/O" -#: library/functions.rst:1347 +#: library/functions.rst:1516 msgid "buffering" msgstr "buffering" -#: library/functions.rst:1347 +#: library/functions.rst:1516 msgid "text mode" msgstr "λειτουργία κειμένου" -#: library/functions.rst:2025 +#: library/functions.rst:2232 msgid "module" msgstr "module" -#: library/functions.rst:1347 +#: library/functions.rst:1516 msgid "sys" msgstr "sys" -#: library/functions.rst:1754 +#: library/functions.rst:1939 msgid "str() (built-in function)" msgstr "str() (ενσωματωμένη συνάρτηση)" -#: library/functions.rst:1870 +#: library/functions.rst:2071 msgid "object" msgstr "αντικείμενο" -#: library/functions.rst:2025 +#: library/functions.rst:2232 msgid "statement" msgstr "δήλωση" -#: library/functions.rst:2025 +#: library/functions.rst:2232 msgid "import" msgstr "import" -#: library/functions.rst:2025 +#: library/functions.rst:2232 msgid "builtins" msgstr "builtins" + +#~ msgid "" +#~ "Most users should just pass a *globals* argument and never *locals*. If " +#~ "exec gets two separate objects as *globals* and *locals*, the code will " +#~ "be executed as if it were embedded in a class definition." +#~ msgstr "" +#~ "Οι περισσότεροι χρήστες θα πρέπει απλώς να περάσουν ένα όρισμα *globals* " +#~ "και ποτέ *locals*. Εάν το exec λάβει δύο ξεχωριστά αντικείμενα ως " +#~ "*globals* και *locals*, ο κώδικας θα εκτελεστεί σαν να ήταν ενσωματωμένος " +#~ "σε έναν ορισμό κλάσης." + +#~ msgid "" +#~ "Update and return a dictionary representing the current local symbol " +#~ "table. Free variables are returned by :func:`locals` when it is called in " +#~ "function blocks, but not in class blocks. Note that at the module level, :" +#~ "func:`locals` and :func:`globals` are the same dictionary." +#~ msgstr "" +#~ "Ενημέρωση και επιστροφή ενός λεξικού που αντιπροσωπεύει τον τρέχοντα " +#~ "πίνακα τοπικών συμβόλων. Οι ελεύθερες μεταβλητές επιστρέφονται από :func:" +#~ "`locals` όταν καλείται σε μπλοκ συναρτήσεων, αλλά όχι σε μπλοκ κλάσεων. " +#~ "Σημειώστε ότι σε επίπεδο module, οι :func:`locals` και :func:`globals` " +#~ "είναι το ίδιο λεξικό." + +#~ msgid "" +#~ "The contents of this dictionary should not be modified; changes may not " +#~ "affect the values of local and free variables used by the interpreter." +#~ msgstr "" +#~ "Τα περιεχόμενα αυτού του λεξικού δεν πρέπει να τροποποιηθούν∙ οι αλλαγές " +#~ "ενδέχεται να μην επηρεάσουν τις τιμές των τοπικών και ελεύθερων " +#~ "μεταβλητών που χρησιμοποιούνται από τον διερμηνέα." + +#~ msgid "" +#~ "Without an argument, :func:`vars` acts like :func:`locals`. Note, the " +#~ "locals dictionary is only useful for reads since updates to the locals " +#~ "dictionary are ignored." +#~ msgstr "" +#~ "Χωρίς ένα όρισμα, το :func:`vars` λειτουργεί όπως :func:`locals`. " +#~ "Σημειώστε, ότι το λεξικό των τοπικών είναι χρήσιμο μόνο για ανάγνωση, " +#~ "καθώς οι ενημερώσεις στο λεξικό των τοπικών αγνοούνται." + +#~ msgid "" +#~ "Raises an :ref:`auditing event ` ``compile`` with arguments " +#~ "``source``, ``filename``." +#~ msgstr "" +#~ "Εγείρει ένα :ref:`auditing event ` ``compile`` με ορίσματα " +#~ "``source``, ``filename``." + +#~ msgid "" +#~ "Return a complex number with the value *real* + *imag*\\*1j or convert a " +#~ "string or number to a complex number. If the first parameter is a " +#~ "string, it will be interpreted as a complex number and the function must " +#~ "be called without a second parameter. The second parameter can never be " +#~ "a string. Each argument may be any numeric type (including complex). If " +#~ "*imag* is omitted, it defaults to zero and the constructor serves as a " +#~ "numeric conversion like :class:`int` and :class:`float`. If both " +#~ "arguments are omitted, returns ``0j``." +#~ msgstr "" +#~ "Επιστρέφει έναν μιγαδικό αριθμό με τιμή *real* + *imag*\\*1j ή μετατρέπει " +#~ "μια συμβολοσειρά ή έναν αριθμό σε μιγαδικό αριθμό. Εάν η πρώτη " +#~ "παράμετρος είναι συμβολοσειρά, θα ερμηνευτεί ως μιγαδικός αριθμός και η " +#~ "συνάρτηση θα πρέπει να καλεστεί χωρίς δεύτερη παράμετρος. Η δεύτερη " +#~ "παράμετρος δεν μπορεί ποτέ να είναι μια συμβολοσειρά. Κάθε όρισμα μπορεί " +#~ "να είναι οποιουδήποτε αριθμητικού τύπου (συμπεριλαμβανομένου του " +#~ "μιγαδικού). Εάν το *imag* παραλειφθεί, είναι μηδέν από προεπιλογή, και ο " +#~ "constructor χρησιμεύει ως αριθμητική μετατροπή όπως :class:`int` και :" +#~ "class:`float`. Εάν παραληφθούν και τα δύο ορίσματα, επιστρέφει το ``0j``." + +#~ msgid "" +#~ "When converting from a string, the string must not contain whitespace " +#~ "around the central ``+`` or ``-`` operator. For example, " +#~ "``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` raises :exc:" +#~ "`ValueError`." +#~ msgstr "" +#~ "Κατά την μετατροπή από μια συμβολοσειρά, η συμβολοσειρά δεν πρέπει να " +#~ "περιέχει κενό διάστημα γύρω από τον κεντρικό τελεστή ``+`` ή ``-``. Για " +#~ "παράδειγμα, ``complex('1+2j')`` είναι εντάξει, αλλά το ``complex('1 + " +#~ "2j')`` κάνει raise την :exc:`ValueError`." + +#~ msgid "" +#~ "The arguments are a string and optional globals and locals. If provided, " +#~ "*globals* must be a dictionary. If provided, *locals* can be any mapping " +#~ "object." +#~ msgstr "" +#~ "Τα ορίσματα είναι μια συμβολοσειρά (string), και προαιρετικά globals και " +#~ "locals. Εάν παρέχεται το *globals* πρέπει να είναι λεξικό. Εάν " +#~ "παρέχεται το *locals* μπορεί να είναι οποιοδήποτε αντικείμενο " +#~ "χαρτογράφησης." + +#~ msgid "" +#~ "The return value is the result of the evaluated expression. Syntax errors " +#~ "are reported as exceptions. Example:" +#~ msgstr "" +#~ "Η τιμή που επιστρέφεται είναι το αποτέλεσμα της αξιολογούμενης έκφρασης. " +#~ "Τα σφάλματα σύνταξης αναφέρονται ως εξαιρέσεις. Παράδειγμα:" + +#~ msgid "" +#~ "Raises an :ref:`auditing event ` ``exec`` with argument " +#~ "``code_object``." +#~ msgstr "" +#~ "Κάνει raise ένα :ref:`auditing event ` ``exec`` με όρισμα " +#~ "``code_object``." + +#~ msgid "" +#~ "Raises an :ref:`auditing event ` ``builtins.input`` with " +#~ "argument ``prompt``." +#~ msgstr "" +#~ "Κάνει raise ένα :ref:`auditing event ` ``builtins.input`` με " +#~ "όρισμα ``prompt``." + +#~ msgid "" +#~ "Raises an :ref:`auditing event ` ``builtins.input/result`` with " +#~ "argument ``result``." +#~ msgstr "" +#~ "Κάνει raise ένα :ref:`auditing event ` ``builtins.input/" +#~ "result`` με όρισμα ``result``." diff --git a/library/functools.po b/library/functools.po index d02b519f..2c4132f6 100644 --- a/library/functools.po +++ b/library/functools.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/functools.rst:2 msgid "" -":mod:`functools` --- Higher-order functions and operations on callable " +":mod:`!functools` --- Higher-order functions and operations on callable " "objects" msgstr "" @@ -47,14 +48,28 @@ msgstr "" msgid "" "Returns the same as ``lru_cache(maxsize=None)``, creating a thin wrapper " "around a dictionary lookup for the function arguments. Because it never " -"needs to evict old values, this is smaller and faster than :func:" -"`lru_cache()` with a size limit." +"needs to evict old values, this is smaller and faster than :func:`lru_cache` " +"with a size limit." msgstr "" -#: library/functools.rst:291 +#: library/functools.rst:297 msgid "For example::" msgstr "" +#: library/functools.rst:41 +msgid "" +"@cache\n" +"def factorial(n):\n" +" return n * factorial(n-1) if n else 1\n" +"\n" +">>> factorial(10) # no previously cached result, makes 11 recursive calls\n" +"3628800\n" +">>> factorial(5) # no new calls, just returns the cached result\n" +"120\n" +">>> factorial(12) # two new recursive calls, factorial(10) is cached\n" +"479001600" +msgstr "" + #: library/functools.rst:158 msgid "" "The cache is threadsafe so that the wrapped function can be used in multiple " @@ -77,10 +92,22 @@ msgid "" "computed properties of instances that are otherwise effectively immutable." msgstr "" -#: library/functools.rst:142 library/functools.rst:383 +#: library/functools.rst:142 library/functools.rst:438 msgid "Example::" msgstr "" +#: library/functools.rst:72 +msgid "" +"class DataSet:\n" +"\n" +" def __init__(self, sequence_of_numbers):\n" +" self._data = tuple(sequence_of_numbers)\n" +"\n" +" @cached_property\n" +" def stdev(self):\n" +" return statistics.stdev(self._data)" +msgstr "" + #: library/functools.rst:81 msgid "" "The mechanics of :func:`cached_property` are somewhat different from :func:" @@ -167,6 +194,11 @@ msgid "" "one argument and returns another value to be used as the sort key." msgstr "" +#: library/functools.rst:144 +msgid "" +"sorted(iterable, key=cmp_to_key(locale.strcoll)) # locale-aware sort order" +msgstr "" + #: library/functools.rst:146 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." @@ -200,6 +232,13 @@ msgid "" "*maxsize* at its default value of 128::" msgstr "" +#: library/functools.rst:178 +msgid "" +"@lru_cache\n" +"def count_vowels(sentence):\n" +" return sum(sentence.count(vowel) for vowel in 'AEIOUaeiou')" +msgstr "" + #: library/functools.rst:182 msgid "" "If *maxsize* is set to ``None``, the LRU feature is disabled and the cache " @@ -231,50 +270,50 @@ msgid "" "has no effect." msgstr "" -#: library/functools.rst:202 +#: library/functools.rst:205 msgid "" "To help measure the effectiveness of the cache and tune the *maxsize* " -"parameter, the wrapped function is instrumented with a :func:`cache_info` " +"parameter, the wrapped function is instrumented with a :func:`!cache_info` " "function that returns a :term:`named tuple` showing *hits*, *misses*, " "*maxsize* and *currsize*." msgstr "" -#: library/functools.rst:207 +#: library/functools.rst:213 msgid "" -"The decorator also provides a :func:`cache_clear` function for clearing or " +"The decorator also provides a :func:`!cache_clear` function for clearing or " "invalidating the cache." msgstr "" -#: library/functools.rst:210 +#: library/functools.rst:216 msgid "" "The original underlying function is accessible through the :attr:" "`__wrapped__` attribute. This is useful for introspection, for bypassing " "the cache, or for rewrapping the function with a different cache." msgstr "" -#: library/functools.rst:214 +#: library/functools.rst:220 msgid "" "The cache keeps references to the arguments and return values until they age " "out of the cache or until the cache is cleared." msgstr "" -#: library/functools.rst:217 +#: library/functools.rst:223 msgid "" "If a method is cached, the ``self`` instance argument is included in the " "cache. See :ref:`faq-cache-method-calls`" msgstr "" -#: library/functools.rst:220 +#: library/functools.rst:226 msgid "" "An `LRU (least recently used) cache `_ works best when the " +"Cache_replacement_policies#Least_Recently_Used_(LRU)>`_ works best when the " "most recent calls are the best predictors of upcoming calls (for example, " "the most popular articles on a news server tend to change each day). The " "cache's size limit assures that the cache does not grow without bound on " "long-running processes such as web servers." msgstr "" -#: library/functools.rst:227 +#: library/functools.rst:233 msgid "" "In general, the LRU cache should only be used when you want to reuse " "previously computed values. Accordingly, it doesn't make sense to cache " @@ -283,44 +322,98 @@ msgid "" "functions such as time() or random()." msgstr "" -#: library/functools.rst:233 +#: library/functools.rst:239 msgid "Example of an LRU cache for static web content::" msgstr "" -#: library/functools.rst:252 +#: library/functools.rst:241 +msgid "" +"@lru_cache(maxsize=32)\n" +"def get_pep(num):\n" +" 'Retrieve text of a Python Enhancement Proposal'\n" +" resource = f'https://peps.python.org/pep-{num:04d}'\n" +" try:\n" +" with urllib.request.urlopen(resource) as s:\n" +" return s.read()\n" +" except urllib.error.HTTPError:\n" +" return 'Not Found'\n" +"\n" +">>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991:\n" +"... pep = get_pep(n)\n" +"... print(n, len(pep))\n" +"\n" +">>> get_pep.cache_info()\n" +"CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)" +msgstr "" + +#: library/functools.rst:258 msgid "" "Example of efficiently computing `Fibonacci numbers `_ using a cache to implement a `dynamic " "programming `_ technique::" msgstr "" -#: library/functools.rst:272 +#: library/functools.rst:264 +msgid "" +"@lru_cache(maxsize=None)\n" +"def fib(n):\n" +" if n < 2:\n" +" return n\n" +" return fib(n-1) + fib(n-2)\n" +"\n" +">>> [fib(n) for n in range(16)]\n" +"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]\n" +"\n" +">>> fib.cache_info()\n" +"CacheInfo(hits=28, misses=16, maxsize=None, currsize=16)" +msgstr "" + +#: library/functools.rst:278 msgid "Added the *typed* option." msgstr "" -#: library/functools.rst:275 +#: library/functools.rst:281 msgid "Added the *user_function* option." msgstr "" -#: library/functools.rst:278 +#: library/functools.rst:284 msgid "Added the function :func:`!cache_parameters`" msgstr "" -#: library/functools.rst:283 +#: library/functools.rst:289 msgid "" "Given a class defining one or more rich comparison ordering methods, this " "class decorator supplies the rest. This simplifies the effort involved in " "specifying all of the possible rich comparison operations:" msgstr "" -#: library/functools.rst:287 +#: library/functools.rst:293 msgid "" -"The class must define one of :meth:`__lt__`, :meth:`__le__`, :meth:`__gt__`, " -"or :meth:`__ge__`. In addition, the class should supply an :meth:`__eq__` " -"method." +"The class must define one of :meth:`~object.__lt__`, :meth:`~object." +"__le__`, :meth:`~object.__gt__`, or :meth:`~object.__ge__`. In addition, the " +"class should supply an :meth:`~object.__eq__` method." msgstr "" -#: library/functools.rst:311 +#: library/functools.rst:299 +msgid "" +"@total_ordering\n" +"class Student:\n" +" def _is_valid_operand(self, other):\n" +" return (hasattr(other, \"lastname\") and\n" +" hasattr(other, \"firstname\"))\n" +" def __eq__(self, other):\n" +" if not self._is_valid_operand(other):\n" +" return NotImplemented\n" +" return ((self.lastname.lower(), self.firstname.lower()) ==\n" +" (other.lastname.lower(), other.firstname.lower()))\n" +" def __lt__(self, other):\n" +" if not self._is_valid_operand(other):\n" +" return NotImplemented\n" +" return ((self.lastname.lower(), self.firstname.lower()) <\n" +" (other.lastname.lower(), other.firstname.lower()))" +msgstr "" + +#: library/functools.rst:317 msgid "" "While this decorator makes it easy to create well behaved totally ordered " "types, it *does* come at the cost of slower execution and more complex stack " @@ -329,7 +422,7 @@ msgid "" "rich comparison methods instead is likely to provide an easy speed boost." msgstr "" -#: library/functools.rst:320 +#: library/functools.rst:326 msgid "" "This decorator makes no attempt to override methods that have been declared " "in the class *or its superclasses*. Meaning that if a superclass defines a " @@ -337,13 +430,19 @@ msgid "" "the original method is abstract." msgstr "" -#: library/functools.rst:327 +#: library/functools.rst:333 msgid "" -"Returning NotImplemented from the underlying comparison function for " +"Returning ``NotImplemented`` from the underlying comparison function for " "unrecognised types is now supported." msgstr "" -#: library/functools.rst:333 +#: library/functools.rst:339 +msgid "" +"A singleton object used as a sentinel to reserve a place for positional " +"arguments when calling :func:`partial` and :func:`partialmethod`." +msgstr "" + +#: library/functools.rst:347 msgid "" "Return a new :ref:`partial object` which when called will " "behave like *func* called with the positional arguments *args* and keyword " @@ -352,38 +451,119 @@ msgid "" "extend and override *keywords*. Roughly equivalent to::" msgstr "" -#: library/functools.rst:349 +#: library/functools.rst:354 msgid "" -"The :func:`partial` is used for partial function application which " +"def partial(func, /, *args, **keywords):\n" +" def newfunc(*more_args, **more_keywords):\n" +" return func(*args, *more_args, **(keywords | more_keywords))\n" +" newfunc.func = func\n" +" newfunc.args = args\n" +" newfunc.keywords = keywords\n" +" return newfunc" +msgstr "" + +#: library/functools.rst:362 +msgid "" +"The :func:`!partial` function is used for partial function application which " "\"freezes\" some portion of a function's arguments and/or keywords resulting " "in a new object with a simplified signature. For example, :func:`partial` " "can be used to create a callable that behaves like the :func:`int` function " -"where the *base* argument defaults to two:" +"where the *base* argument defaults to ``2``:" +msgstr "" + +#: library/functools.rst:368 +msgid "" +">>> basetwo = partial(int, base=2)\n" +">>> basetwo.__doc__ = 'Convert base 2 string to an int.'\n" +">>> basetwo('10010')\n" +"18" +msgstr "" + +#: library/functools.rst:375 +msgid "" +"If :data:`Placeholder` sentinels are present in *args*, they will be filled " +"first when :func:`!partial` is called. This makes it possible to pre-fill " +"any positional argument with a call to :func:`!partial`; without :data:`!" +"Placeholder`, only the chosen number of leading positional arguments can be " +"pre-filled." +msgstr "" + +#: library/functools.rst:380 +msgid "" +"If any :data:`!Placeholder` sentinels are present, all must be filled at " +"call time:" +msgstr "" + +#: library/functools.rst:382 +msgid "" +">>> say_to_world = partial(print, Placeholder, Placeholder, \"world!\")\n" +">>> say_to_world('Hello', 'dear')\n" +"Hello dear world!" msgstr "" -#: library/functools.rst:364 +#: library/functools.rst:388 +msgid "" +"Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only " +"one positional argument is provided, but there are two placeholders that " +"must be filled in." +msgstr "" + +#: library/functools.rst:392 +msgid "" +"If :func:`!partial` is applied to an existing :func:`!partial` object, :data:" +"`!Placeholder` sentinels of the input object are filled in with new " +"positional arguments. A placeholder can be retained by inserting a new :data:" +"`!Placeholder` sentinel to the place held by a previous :data:`!Placeholder`:" +msgstr "" + +#: library/functools.rst:398 +msgid "" +">>> from functools import partial, Placeholder as _\n" +">>> remove = partial(str.replace, _, _, '')\n" +">>> message = 'Hello, dear dear world!'\n" +">>> remove(message, ' dear')\n" +"'Hello, world!'\n" +">>> remove_dear = partial(remove, _, ' dear')\n" +">>> remove_dear(message)\n" +"'Hello, world!'\n" +">>> remove_first_dear = partial(remove_dear, _, 1)\n" +">>> remove_first_dear(message)\n" +"'Hello, dear world!'" +msgstr "" + +#: library/functools.rst:412 +msgid "" +":data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword " +"argument." +msgstr "" + +#: library/functools.rst:414 +msgid "Added support for :data:`Placeholder` in positional arguments." +msgstr "" + +#: library/functools.rst:419 msgid "" "Return a new :class:`partialmethod` descriptor which behaves like :class:" "`partial` except that it is designed to be used as a method definition " "rather than being directly callable." msgstr "" -#: library/functools.rst:368 +#: library/functools.rst:423 msgid "" "*func* must be a :term:`descriptor` or a callable (objects which are both, " "like normal functions, are handled as descriptors)." msgstr "" -#: library/functools.rst:371 +#: library/functools.rst:426 msgid "" "When *func* is a descriptor (such as a normal Python function, :func:" -"`classmethod`, :func:`staticmethod`, :func:`abstractmethod` or another " +"`classmethod`, :func:`staticmethod`, :func:`~abc.abstractmethod` or another " "instance of :class:`partialmethod`), calls to ``__get__`` are delegated to " "the underlying descriptor, and an appropriate :ref:`partial object` returned as the result." msgstr "" -#: library/functools.rst:377 +#: library/functools.rst:432 msgid "" "When *func* is a non-descriptor callable, an appropriate bound method is " "created dynamically. This behaves like a normal Python function when used as " @@ -392,80 +572,242 @@ msgid "" "`partialmethod` constructor." msgstr "" -#: library/functools.rst:408 +#: library/functools.rst:440 +msgid "" +">>> class Cell:\n" +"... def __init__(self):\n" +"... self._alive = False\n" +"... @property\n" +"... def alive(self):\n" +"... return self._alive\n" +"... def set_state(self, state):\n" +"... self._alive = bool(state)\n" +"... set_alive = partialmethod(set_state, True)\n" +"... set_dead = partialmethod(set_state, False)\n" +"...\n" +">>> c = Cell()\n" +">>> c.alive\n" +"False\n" +">>> c.set_alive()\n" +">>> c.alive\n" +"True" +msgstr "" + +#: library/functools.rst:463 msgid "" "Apply *function* of two arguments cumulatively to the items of *iterable*, " "from left to right, so as to reduce the iterable to a single value. For " "example, ``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates " "``((((1+2)+3)+4)+5)``. The left argument, *x*, is the accumulated value and " "the right argument, *y*, is the update value from the *iterable*. If the " -"optional *initializer* is present, it is placed before the items of the " -"iterable in the calculation, and serves as a default when the iterable is " -"empty. If *initializer* is not given and *iterable* contains only one item, " -"the first item is returned." +"optional *initial* is present, it is placed before the items of the iterable " +"in the calculation, and serves as a default when the iterable is empty. If " +"*initial* is not given and *iterable* contains only one item, the first item " +"is returned." msgstr "" -#: library/functools.rst:417 +#: library/functools.rst:472 msgid "Roughly equivalent to::" msgstr "" -#: library/functools.rst:429 +#: library/functools.rst:474 +msgid "" +"initial_missing = object()\n" +"\n" +"def reduce(function, iterable, /, initial=initial_missing):\n" +" it = iter(iterable)\n" +" if initial is initial_missing:\n" +" value = next(it)\n" +" else:\n" +" value = initial\n" +" for element in it:\n" +" value = function(value, element)\n" +" return value" +msgstr "" + +#: library/functools.rst:486 msgid "" "See :func:`itertools.accumulate` for an iterator that yields all " "intermediate values." msgstr "" -#: library/functools.rst:434 +#: library/functools.rst:489 +msgid "*initial* is now supported as a keyword argument." +msgstr "" + +#: library/functools.rst:494 msgid "" "Transform a function into a :term:`single-dispatch ` :term:" "`generic function`." msgstr "" -#: library/functools.rst:437 +#: library/functools.rst:497 msgid "" "To define a generic function, decorate it with the ``@singledispatch`` " "decorator. When defining a function using ``@singledispatch``, note that the " "dispatch happens on the type of the first argument::" msgstr "" -#: library/functools.rst:448 +#: library/functools.rst:501 +msgid "" +">>> from functools import singledispatch\n" +">>> @singledispatch\n" +"... def fun(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Let me just say,\", end=\" \")\n" +"... print(arg)" +msgstr "" + +#: library/functools.rst:511 msgid "" -"To add overloaded implementations to the function, use the :func:`register` " +"To add overloaded implementations to the function, use the :func:`!register` " "attribute of the generic function, which can be used as a decorator. For " "functions annotated with types, the decorator will infer the type of the " "first argument automatically::" msgstr "" -#: library/functools.rst:466 -msgid ":data:`types.UnionType` and :data:`typing.Union` can also be used::" +#: library/functools.rst:516 +msgid "" +">>> @fun.register\n" +"... def _(arg: int, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> @fun.register\n" +"... def _(arg: list, verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" +msgstr "" + +#: library/functools.rst:529 +msgid ":class:`typing.Union` can also be used::" msgstr "" -#: library/functools.rst:483 +#: library/functools.rst:531 +msgid "" +">>> @fun.register\n" +"... def _(arg: int | float, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> from typing import Union\n" +">>> @fun.register\n" +"... def _(arg: Union[list, set], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)\n" +"..." +msgstr "" + +#: library/functools.rst:546 msgid "" "For code which doesn't use type annotations, the appropriate type argument " "can be passed explicitly to the decorator itself::" msgstr "" -#: library/functools.rst:494 +#: library/functools.rst:549 +msgid "" +">>> @fun.register(complex)\n" +"... def _(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Better than complicated.\", end=\" \")\n" +"... print(arg.real, arg.imag)\n" +"..." +msgstr "" + +#: library/functools.rst:556 +msgid "" +"For code that dispatches on a collections type (e.g., ``list``), but wants " +"to typehint the items of the collection (e.g., ``list[int]``), the dispatch " +"type should be passed explicitly to the decorator itself with the typehint " +"going into the function definition::" +msgstr "" + +#: library/functools.rst:561 +msgid "" +">>> @fun.register(list)\n" +"... def _(arg: list[int], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" +msgstr "" + +#: library/functools.rst:570 +msgid "" +"At runtime the function will dispatch on an instance of a list regardless of " +"the type contained within the list i.e. ``[1,2,3]`` will be dispatched the " +"same as ``[\"foo\", \"bar\", \"baz\"]``. The annotation provided in this " +"example is for static type checkers only and has no runtime impact." +msgstr "" + +#: library/functools.rst:576 msgid "" "To enable registering :term:`lambdas` and pre-existing functions, " -"the :func:`register` attribute can also be used in a functional form::" +"the :func:`~singledispatch.register` attribute can also be used in a " +"functional form::" msgstr "" -#: library/functools.rst:502 +#: library/functools.rst:579 msgid "" -"The :func:`register` attribute returns the undecorated function. This " -"enables decorator stacking, :mod:`pickling`, and the creation of " -"unit tests for each variant independently::" +">>> def nothing(arg, verbose=False):\n" +"... print(\"Nothing.\")\n" +"...\n" +">>> fun.register(type(None), nothing)" msgstr "" -#: library/functools.rst:516 +#: library/functools.rst:584 +msgid "" +"The :func:`~singledispatch.register` attribute returns the undecorated " +"function. This enables decorator stacking, :mod:`pickling`, and the " +"creation of unit tests for each variant independently::" +msgstr "" + +#: library/functools.rst:588 +msgid "" +">>> @fun.register(float)\n" +"... @fun.register(Decimal)\n" +"... def fun_num(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Half of your number:\", end=\" \")\n" +"... print(arg / 2)\n" +"...\n" +">>> fun_num is fun\n" +"False" +msgstr "" + +#: library/functools.rst:598 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "" -#: library/functools.rst:536 +#: library/functools.rst:601 +msgid "" +">>> fun(\"Hello, world.\")\n" +"Hello, world.\n" +">>> fun(\"test.\", verbose=True)\n" +"Let me just say, test.\n" +">>> fun(42, verbose=True)\n" +"Strength in numbers, eh? 42\n" +">>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True)\n" +"Enumerate this:\n" +"0 spam\n" +"1 spam\n" +"2 eggs\n" +"3 spam\n" +">>> fun(None)\n" +"Nothing.\n" +">>> fun(1.23)\n" +"0.615" +msgstr "" + +#: library/functools.rst:618 msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " @@ -474,66 +816,136 @@ msgid "" "found." msgstr "" -#: library/functools.rst:542 +#: library/functools.rst:624 msgid "" "If an implementation is registered to an :term:`abstract base class`, " "virtual subclasses of the base class will be dispatched to that " "implementation::" msgstr "" -#: library/functools.rst:557 +#: library/functools.rst:628 +msgid "" +">>> from collections.abc import Mapping\n" +">>> @fun.register\n" +"... def _(arg: Mapping, verbose=False):\n" +"... if verbose:\n" +"... print(\"Keys & Values\")\n" +"... for key, value in arg.items():\n" +"... print(key, \"=>\", value)\n" +"...\n" +">>> fun({\"a\": \"b\"})\n" +"a => b" +msgstr "" + +#: library/functools.rst:639 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" -#: library/functools.rst:565 +#: library/functools.rst:642 +msgid "" +">>> fun.dispatch(float)\n" +"\n" +">>> fun.dispatch(dict) # note: default implementation\n" +"" +msgstr "" + +#: library/functools.rst:647 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "" -#: library/functools.rst:579 -msgid "The :func:`register` attribute now supports using type annotations." +#: library/functools.rst:650 +msgid "" +">>> fun.registry.keys()\n" +"dict_keys([, , ,\n" +" , ,\n" +" ])\n" +">>> fun.registry[float]\n" +"\n" +">>> fun.registry[object]\n" +"" +msgstr "" + +#: library/functools.rst:661 +msgid "" +"The :func:`~singledispatch.register` attribute now supports using type " +"annotations." msgstr "" -#: library/functools.rst:582 +#: library/functools.rst:664 msgid "" -"The :func:`register` attribute now supports :data:`types.UnionType` and :" -"data:`typing.Union` as type annotations." +"The :func:`~singledispatch.register` attribute now supports :class:`typing." +"Union` as a type annotation." msgstr "" -#: library/functools.rst:589 +#: library/functools.rst:671 msgid "" "Transform a method into a :term:`single-dispatch ` :term:" "`generic function`." msgstr "" -#: library/functools.rst:592 +#: library/functools.rst:674 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " -"decorator. When defining a function using ``@singledispatchmethod``, note " -"that the dispatch happens on the type of the first non-*self* or non-*cls* " +"decorator. When defining a method using ``@singledispatchmethod``, note that " +"the dispatch happens on the type of the first non-*self* or non-*cls* " "argument::" msgstr "" -#: library/functools.rst:610 +#: library/functools.rst:679 +msgid "" +"class Negator:\n" +" @singledispatchmethod\n" +" def neg(self, arg):\n" +" raise NotImplementedError(\"Cannot negate a\")\n" +"\n" +" @neg.register\n" +" def _(self, arg: int):\n" +" return -arg\n" +"\n" +" @neg.register\n" +" def _(self, arg: bool):\n" +" return not arg" +msgstr "" + +#: library/functools.rst:692 msgid "" "``@singledispatchmethod`` supports nesting with other decorators such as :" -"func:`@classmethod`. Note that to allow for ``dispatcher." -"register``, ``singledispatchmethod`` must be the *outer most* decorator. " -"Here is the ``Negator`` class with the ``neg`` methods bound to the class, " -"rather than an instance of the class::" +"deco:`classmethod`. Note that to allow for ``dispatcher.register``, " +"``singledispatchmethod`` must be the *outer most* decorator. Here is the " +"``Negator`` class with the ``neg`` methods bound to the class, rather than " +"an instance of the class::" +msgstr "" + +#: library/functools.rst:698 +msgid "" +"class Negator:\n" +" @singledispatchmethod\n" +" @classmethod\n" +" def neg(cls, arg):\n" +" raise NotImplementedError(\"Cannot negate a\")\n" +"\n" +" @neg.register\n" +" @classmethod\n" +" def _(cls, arg: int):\n" +" return -arg\n" +"\n" +" @neg.register\n" +" @classmethod\n" +" def _(cls, arg: bool):\n" +" return not arg" msgstr "" -#: library/functools.rst:632 +#: library/functools.rst:714 msgid "" -"The same pattern can be used for other similar decorators: :func:" -"`@staticmethod`, :func:`@abstractmethod`, " -"and others." +"The same pattern can be used for other similar decorators: :deco:" +"`staticmethod`, :deco:`~abc.abstractmethod`, and others." msgstr "" -#: library/functools.rst:641 +#: library/functools.rst:722 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -541,13 +953,15 @@ msgid "" "function and which attributes of the wrapper function are updated with the " "corresponding attributes from the original function. The default values for " "these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " -"(which assigns to the wrapper function's ``__module__``, ``__name__``, " -"``__qualname__``, ``__annotations__`` and ``__doc__``, the documentation " -"string) and ``WRAPPER_UPDATES`` (which updates the wrapper function's " -"``__dict__``, i.e. the instance dictionary)." +"(which assigns to the wrapper function's :attr:`~function.__module__`, :attr:" +"`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." +"__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function." +"__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates " +"the wrapper function's :attr:`~function.__dict__`, i.e. the instance " +"dictionary)." msgstr "" -#: library/functools.rst:651 +#: library/functools.rst:734 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -555,7 +969,7 @@ msgid "" "that refers to the function being wrapped." msgstr "" -#: library/functools.rst:656 +#: library/functools.rst:739 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -564,7 +978,7 @@ msgid "" "is typically less than helpful." msgstr "" -#: library/functools.rst:662 +#: library/functools.rst:745 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -573,21 +987,26 @@ msgid "" "wrapper function itself is missing any attributes named in *updated*." msgstr "" -#: library/functools.rst:668 +#: library/functools.rst:751 msgid "" -"The ``__wrapped__`` attribute is now automatically added. The " -"``__annotations__`` attribute is now copied by default. Missing attributes " -"no longer trigger an :exc:`AttributeError`." +"The ``__wrapped__`` attribute is now automatically added. The :attr:" +"`~function.__annotations__` attribute is now copied by default. Missing " +"attributes no longer trigger an :exc:`AttributeError`." msgstr "" -#: library/functools.rst:673 +#: library/functools.rst:756 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " "even if that function defined a ``__wrapped__`` attribute. (see :issue:" "`17482`)" msgstr "" -#: library/functools.rst:681 +#: library/functools.rst:761 +msgid "" +"The :attr:`~function.__type_params__` attribute is now copied by default." +msgstr "" + +#: library/functools.rst:767 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -595,47 +1014,70 @@ msgid "" "updated=updated)``. For example::" msgstr "" -#: library/functools.rst:707 +#: library/functools.rst:772 +msgid "" +">>> from functools import wraps\n" +">>> def my_decorator(f):\n" +"... @wraps(f)\n" +"... def wrapper(*args, **kwds):\n" +"... print('Calling decorated function')\n" +"... return f(*args, **kwds)\n" +"... return wrapper\n" +"...\n" +">>> @my_decorator\n" +"... def example():\n" +"... \"\"\"Docstring\"\"\"\n" +"... print('Called example function')\n" +"...\n" +">>> example()\n" +"Calling decorated function\n" +"Called example function\n" +">>> example.__name__\n" +"'example'\n" +">>> example.__doc__\n" +"'Docstring'" +msgstr "" + +#: library/functools.rst:793 msgid "" "Without the use of this decorator factory, the name of the example function " -"would have been ``'wrapper'``, and the docstring of the original :func:" -"`example` would have been lost." +"would have been ``'wrapper'``, and the docstring of the original :func:`!" +"example` would have been lost." msgstr "" -#: library/functools.rst:715 +#: library/functools.rst:801 msgid ":class:`partial` Objects" msgstr "" -#: library/functools.rst:717 +#: library/functools.rst:803 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" msgstr "" -#: library/functools.rst:723 +#: library/functools.rst:809 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." msgstr "" -#: library/functools.rst:729 +#: library/functools.rst:815 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." msgstr "" -#: library/functools.rst:735 +#: library/functools.rst:821 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "" -#: library/functools.rst:738 +#: library/functools.rst:824 msgid "" -":class:`partial` objects are like :class:`function` objects in that they are " -"callable, weak referenceable, and can have attributes. There are some " -"important differences. For instance, the :attr:`~definition.__name__` and :" -"attr:`__doc__` attributes are not created automatically. Also, :class:" -"`partial` objects defined in classes behave like static methods and do not " -"transform into bound methods during instance attribute look-up." +":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " +"attributes. There are some important differences. For instance, the :attr:" +"`~definition.__name__` and :attr:`~definition.__doc__` attributes are not " +"created automatically." msgstr "" diff --git a/library/gc.po b/library/gc.po index 1134f9fb..a9b8aab4 100644 --- a/library/gc.po +++ b/library/gc.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/gc.rst:2 -msgid ":mod:`gc` --- Garbage Collector interface" +msgid ":mod:`!gc` --- Garbage Collector interface" msgstr "" #: library/gc.rst:12 @@ -52,116 +53,180 @@ msgstr "" #: library/gc.rst:43 msgid "" -"With no arguments, run a full collection. The optional argument " -"*generation* may be an integer specifying which generation to collect (from " -"0 to 2). A :exc:`ValueError` is raised if the generation number is " -"invalid. The number of unreachable objects found is returned." +"Perform a collection. The optional argument *generation* may be an integer " +"specifying which generation to collect (from 0 to 2). A :exc:`ValueError` " +"is raised if the generation number is invalid. The sum of collected objects " +"and uncollectable objects is returned." msgstr "" #: library/gc.rst:48 msgid "" +"Calling ``gc.collect(0)`` will perform a GC collection on the young " +"generation." +msgstr "" + +#: library/gc.rst:50 +msgid "" +"Calling ``gc.collect(1)`` will perform a GC collection on the young " +"generation and an increment of the old generation." +msgstr "" + +#: library/gc.rst:53 +msgid "" +"Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" +msgstr "" + +#: library/gc.rst:55 +msgid "" "The free lists maintained for a number of built-in types are cleared " "whenever a full collection or collection of the highest generation (2) is " "run. Not all items in some free lists may be freed due to the particular " "implementation, in particular :class:`float`." msgstr "" -#: library/gc.rst:53 +#: library/gc.rst:60 msgid "" "The effect of calling ``gc.collect()`` while the interpreter is already " "performing a collection is undefined." msgstr "" -#: library/gc.rst:59 +#: library/gc.rst:63 +msgid "``generation=1`` performs an increment of collection." +msgstr "" + +#: library/gc.rst:69 msgid "" "Set the garbage collection debugging flags. Debugging information will be " "written to ``sys.stderr``. See below for a list of debugging flags which " "can be combined using bit operations to control debugging." msgstr "" -#: library/gc.rst:66 +#: library/gc.rst:76 msgid "Return the debugging flags currently set." msgstr "" -#: library/gc.rst:71 +#: library/gc.rst:82 msgid "" "Returns a list of all objects tracked by the collector, excluding the list " -"returned. If *generation* is not None, return only the objects tracked by " -"the collector that are in that generation." +"returned. If *generation* is not ``None``, return only the objects as " +"follows:" +msgstr "" + +#: library/gc.rst:85 +msgid "0: All objects in the young generation" msgstr "" -#: library/gc.rst:75 +#: library/gc.rst:86 +msgid "1: No objects, as there is no generation 1 (as of Python 3.14)" +msgstr "" + +#: library/gc.rst:87 +msgid "2: All objects in the old generation" +msgstr "" + +#: library/gc.rst:89 msgid "New *generation* parameter." msgstr "" -#: library/gc.rst:78 +#: library/gc.rst:92 +msgid "Generation 1 is removed" +msgstr "" + +#: library/gc.rst:95 msgid "" "Raises an :ref:`auditing event ` ``gc.get_objects`` with argument " "``generation``." msgstr "" -#: library/gc.rst:82 +#: library/gc.rst:99 msgid "" "Return a list of three per-generation dictionaries containing collection " "statistics since interpreter start. The number of keys may change in the " "future, but currently each dictionary will contain the following items:" msgstr "" -#: library/gc.rst:87 +#: library/gc.rst:104 msgid "``collections`` is the number of times this generation was collected;" msgstr "" -#: library/gc.rst:89 +#: library/gc.rst:106 msgid "" "``collected`` is the total number of objects collected inside this " "generation;" msgstr "" -#: library/gc.rst:92 +#: library/gc.rst:109 msgid "" "``uncollectable`` is the total number of objects which were found to be " "uncollectable (and were therefore moved to the :data:`garbage` list) inside " "this generation." msgstr "" -#: library/gc.rst:101 +#: library/gc.rst:118 msgid "" "Set the garbage collection thresholds (the collection frequency). Setting " "*threshold0* to zero disables collection." msgstr "" -#: library/gc.rst:104 +#: library/gc.rst:121 msgid "" -"The GC classifies objects into three generations depending on how many " -"collection sweeps they have survived. New objects are placed in the " -"youngest generation (generation ``0``). If an object survives a collection " -"it is moved into the next older generation. Since generation ``2`` is the " -"oldest generation, objects in that generation remain there after a " -"collection. In order to decide when to run, the collector keeps track of " -"the number object allocations and deallocations since the last collection. " -"When the number of allocations minus the number of deallocations exceeds " -"*threshold0*, collection starts. Initially only generation ``0`` is " -"examined. If generation ``0`` has been examined more than *threshold1* " -"times since generation ``1`` has been examined, then generation ``1`` is " -"examined as well. With the third generation, things are a bit more " -"complicated, see `Collecting the oldest generation `_ for more " -"information." +"The GC classifies objects into two generations depending on whether they " +"have survived a collection. New objects are placed in the young generation. " +"If an object survives a collection it is moved into the old generation." msgstr "" -#: library/gc.rst:121 +#: library/gc.rst:125 +msgid "" +"In order to decide when to run, the collector keeps track of the number of " +"object allocations and deallocations since the last collection. When the " +"number of allocations minus the number of deallocations exceeds " +"*threshold0*, collection starts. For each collection, all the objects in the " +"young generation and some fraction of the old generation is collected." +msgstr "" + +#: library/gc.rst:131 +msgid "" +"In the free-threaded build, the increase in process memory usage is also " +"checked before running the collector. If the memory usage has not increased " +"by 10% since the last collection and the net number of object allocations " +"has not exceeded 40 times *threshold0*, the collection is not run." +msgstr "" + +#: library/gc.rst:136 +msgid "" +"The fraction of the old generation that is collected is **inversely** " +"proportional to *threshold1*. The larger *threshold1* is, the slower objects " +"in the old generation are collected. For the default value of 10, 1% of the " +"old generation is scanned during each collection." +msgstr "" + +#: library/gc.rst:141 +msgid "*threshold2* is ignored." +msgstr "" + +#: library/gc.rst:143 +msgid "" +"See `Garbage collector design `_ for more information." +msgstr "" + +#: library/gc.rst:145 +msgid "*threshold2* is ignored" +msgstr "" + +#: library/gc.rst:151 msgid "" "Return the current collection counts as a tuple of ``(count0, count1, " "count2)``." msgstr "" -#: library/gc.rst:127 +#: library/gc.rst:157 msgid "" "Return the current collection thresholds as a tuple of ``(threshold0, " "threshold1, threshold2)``." msgstr "" -#: library/gc.rst:133 +#: library/gc.rst:163 msgid "" "Return the list of objects that directly refer to any of objs. This function " "will only locate those containers which support garbage collection; " @@ -169,7 +234,7 @@ msgid "" "collection will not be found." msgstr "" -#: library/gc.rst:138 +#: library/gc.rst:168 msgid "" "Note that objects which have already been dereferenced, but which live in " "cycles and have not yet been collected by the garbage collector can be " @@ -177,7 +242,7 @@ msgid "" "call :func:`collect` before calling :func:`get_referrers`." msgstr "" -#: library/gc.rst:144 +#: library/gc.rst:174 msgid "" "Care must be taken when using objects returned by :func:`get_referrers` " "because some of them could still be under construction and hence in a " @@ -185,13 +250,13 @@ msgid "" "other than debugging." msgstr "" -#: library/gc.rst:149 +#: library/gc.rst:179 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." msgstr "" -#: library/gc.rst:154 +#: library/gc.rst:184 msgid "" "Return a list of objects directly referred to by any of the arguments. The " "referents returned are those objects visited by the arguments' C-level :c:" @@ -203,13 +268,13 @@ msgid "" "object may or may not appear in the result list." msgstr "" -#: library/gc.rst:162 +#: library/gc.rst:192 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." msgstr "" -#: library/gc.rst:166 +#: library/gc.rst:196 msgid "" "Returns ``True`` if the object is currently tracked by the garbage " "collector, ``False`` otherwise. As a general rule, instances of atomic " @@ -219,19 +284,49 @@ msgid "" "instances (e.g. dicts containing only atomic keys and values)::" msgstr "" -#: library/gc.rst:191 +#: library/gc.rst:203 +msgid "" +">>> gc.is_tracked(0)\n" +"False\n" +">>> gc.is_tracked(\"a\")\n" +"False\n" +">>> gc.is_tracked([])\n" +"True\n" +">>> gc.is_tracked({})\n" +"False\n" +">>> gc.is_tracked({\"a\": 1})\n" +"True" +msgstr "" + +#: library/gc.rst:219 msgid "" "Returns ``True`` if the given object has been finalized by the garbage " "collector, ``False`` otherwise. ::" msgstr "" -#: library/gc.rst:212 +#: library/gc.rst:222 +msgid "" +">>> x = None\n" +">>> class Lazarus:\n" +"... def __del__(self):\n" +"... global x\n" +"... x = self\n" +"...\n" +">>> lazarus = Lazarus()\n" +">>> gc.is_finalized(lazarus)\n" +"False\n" +">>> del lazarus\n" +">>> gc.is_finalized(x)\n" +"True" +msgstr "" + +#: library/gc.rst:240 msgid "" "Freeze all the objects tracked by the garbage collector; move them to a " "permanent generation and ignore them in all the future collections." msgstr "" -#: library/gc.rst:215 +#: library/gc.rst:243 msgid "" "If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-" "on-write in child processes will maximize memory sharing and reduce overall " @@ -243,23 +338,23 @@ msgid "" "``gc.enable()`` early in child processes." msgstr "" -#: library/gc.rst:229 +#: library/gc.rst:257 msgid "" "Unfreeze the objects in the permanent generation, put them back into the " "oldest generation." msgstr "" -#: library/gc.rst:237 +#: library/gc.rst:265 msgid "Return the number of objects in the permanent generation." msgstr "" -#: library/gc.rst:242 +#: library/gc.rst:270 msgid "" "The following variables are provided for read-only access (you can mutate " "the values but should not rebind them):" msgstr "" -#: library/gc.rst:247 +#: library/gc.rst:275 msgid "" "A list of objects which the collector found to be unreachable but could not " "be freed (uncollectable objects). Starting with Python 3.4, this list " @@ -267,13 +362,13 @@ msgid "" "types with a non-``NULL`` ``tp_del`` slot." msgstr "" -#: library/gc.rst:252 +#: library/gc.rst:280 msgid "" "If :const:`DEBUG_SAVEALL` is set, then all unreachable objects will be added " "to this list rather than freed." msgstr "" -#: library/gc.rst:255 +#: library/gc.rst:283 msgid "" "If this list is non-empty at :term:`interpreter shutdown`, a :exc:" "`ResourceWarning` is emitted, which is silent by default. If :const:" @@ -281,105 +376,105 @@ msgid "" "printed." msgstr "" -#: library/gc.rst:261 +#: library/gc.rst:289 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." msgstr "" -#: library/gc.rst:267 +#: library/gc.rst:295 msgid "" "A list of callbacks that will be invoked by the garbage collector before and " "after collection. The callbacks will be called with two arguments, *phase* " "and *info*." msgstr "" -#: library/gc.rst:271 +#: library/gc.rst:299 msgid "*phase* can be one of two values:" msgstr "" -#: library/gc.rst:273 +#: library/gc.rst:301 msgid "\"start\": The garbage collection is about to start." msgstr "" -#: library/gc.rst:275 +#: library/gc.rst:303 msgid "\"stop\": The garbage collection has finished." msgstr "" -#: library/gc.rst:277 +#: library/gc.rst:305 msgid "" "*info* is a dict providing more information for the callback. The following " "keys are currently defined:" msgstr "" -#: library/gc.rst:280 +#: library/gc.rst:308 msgid "\"generation\": The oldest generation being collected." msgstr "" -#: library/gc.rst:282 +#: library/gc.rst:310 msgid "" "\"collected\": When *phase* is \"stop\", the number of objects successfully " "collected." msgstr "" -#: library/gc.rst:285 +#: library/gc.rst:313 msgid "" "\"uncollectable\": When *phase* is \"stop\", the number of objects that " "could not be collected and were put in :data:`garbage`." msgstr "" -#: library/gc.rst:288 +#: library/gc.rst:316 msgid "" "Applications can add their own callbacks to this list. The primary use " "cases are:" msgstr "" -#: library/gc.rst:291 +#: library/gc.rst:319 msgid "" "Gathering statistics about garbage collection, such as how often various " "generations are collected, and how long the collection takes." msgstr "" -#: library/gc.rst:295 +#: library/gc.rst:323 msgid "" "Allowing applications to identify and clear their own uncollectable types " "when they appear in :data:`garbage`." msgstr "" -#: library/gc.rst:301 +#: library/gc.rst:329 msgid "The following constants are provided for use with :func:`set_debug`:" msgstr "" -#: library/gc.rst:306 +#: library/gc.rst:334 msgid "" "Print statistics during collection. This information can be useful when " "tuning the collection frequency." msgstr "" -#: library/gc.rst:312 +#: library/gc.rst:340 msgid "Print information on collectable objects found." msgstr "" -#: library/gc.rst:317 +#: library/gc.rst:345 msgid "" "Print information of uncollectable objects found (objects which are not " "reachable but cannot be freed by the collector). These objects will be " "added to the ``garbage`` list." msgstr "" -#: library/gc.rst:321 +#: library/gc.rst:349 msgid "" "Also print the contents of the :data:`garbage` list at :term:`interpreter " "shutdown`, if it isn't empty." msgstr "" -#: library/gc.rst:327 +#: library/gc.rst:355 msgid "" "When set, all unreachable objects found will be appended to *garbage* rather " "than being freed. This can be useful for debugging a leaking program." msgstr "" -#: library/gc.rst:333 +#: library/gc.rst:361 msgid "" "The debugging flags necessary for the collector to print information about a " "leaking program (equal to ``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | " diff --git a/library/getopt.po b/library/getopt.po index e8335365..d91c72e2 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/getopt.rst:2 -msgid ":mod:`getopt` --- C-style parser for command line options" +msgid ":mod:`!getopt` --- C-style parser for command line options" msgstr "" #: library/getopt.rst:8 @@ -26,58 +27,70 @@ msgstr "" #: library/getopt.rst:12 msgid "" -"The :mod:`getopt` module is a parser for command line options whose API is " -"designed to be familiar to users of the C :c:func:`getopt` function. Users " -"who are unfamiliar with the C :c:func:`getopt` function or who would like to " -"write less code and get better help and error messages should consider using " -"the :mod:`argparse` module instead." +"This module is considered feature complete. A more declarative and " +"extensible alternative to this API is provided in the :mod:`optparse` " +"module. Further functional enhancements for command line parameter " +"processing are provided either as third party modules on PyPI, or else as " +"features in the :mod:`argparse` module." msgstr "" #: library/getopt.rst:20 msgid "" "This module helps scripts to parse the command line arguments in ``sys." -"argv``. It supports the same conventions as the Unix :c:func:`getopt` " +"argv``. It supports the same conventions as the Unix :c:func:`!getopt` " "function (including the special meanings of arguments of the form '``-``' " "and '``--``'). Long options similar to those supported by GNU software may " "be used as well via an optional third argument." msgstr "" #: library/getopt.rst:26 +msgid "" +"Users who are unfamiliar with the Unix :c:func:`!getopt` function should " +"consider using the :mod:`argparse` module instead. Users who are familiar " +"with the Unix :c:func:`!getopt` function, but would like to get equivalent " +"behavior while writing less code and getting better help and error messages " +"should consider using the :mod:`optparse` module. See :ref:`choosing-an-" +"argument-parser` for additional details." +msgstr "" + +#: library/getopt.rst:33 msgid "This module provides two functions and an exception:" msgstr "" -#: library/getopt.rst:32 +#: library/getopt.rst:39 msgid "" "Parses command line options and parameter list. *args* is the argument list " "to be parsed, without the leading reference to the running program. " "Typically, this means ``sys.argv[1:]``. *shortopts* is the string of option " "letters that the script wants to recognize, with options that require an " -"argument followed by a colon (``':'``; i.e., the same format that Unix :c:" -"func:`getopt` uses)." +"argument followed by a colon (``':'``) and options that accept an optional " +"argument followed by two colons (``'::'``); i.e., the same format that Unix :" +"c:func:`!getopt` uses." msgstr "" -#: library/getopt.rst:40 +#: library/getopt.rst:48 msgid "" -"Unlike GNU :c:func:`getopt`, after a non-option argument, all further " +"Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " "arguments are considered also non-options. This is similar to the way non-" "GNU Unix systems work." msgstr "" -#: library/getopt.rst:44 +#: library/getopt.rst:52 msgid "" "*longopts*, if specified, must be a list of strings with the names of the " "long options which should be supported. The leading ``'--'`` characters " "should not be included in the option name. Long options which require an " -"argument should be followed by an equal sign (``'='``). Optional arguments " -"are not supported. To accept only long options, *shortopts* should be an " -"empty string. Long options on the command line can be recognized so long as " -"they provide a prefix of the option name that matches exactly one of the " -"accepted options. For example, if *longopts* is ``['foo', 'frob']``, the " -"option ``--fo`` will match as ``--foo``, but ``--f`` will not match " -"uniquely, so :exc:`GetoptError` will be raised." +"argument should be followed by an equal sign (``'='``). Long options which " +"accept an optional argument should be followed by an equal sign and question " +"mark (``'=?'``). To accept only long options, *shortopts* should be an empty " +"string. Long options on the command line can be recognized so long as they " +"provide a prefix of the option name that matches exactly one of the accepted " +"options. For example, if *longopts* is ``['foo', 'frob']``, the option ``--" +"fo`` will match as ``--foo``, but ``--f`` will not match uniquely, so :exc:" +"`GetoptError` will be raised." msgstr "" -#: library/getopt.rst:55 +#: library/getopt.rst:65 msgid "" "The return value consists of two elements: the first is a list of ``(option, " "value)`` pairs; the second is the list of program arguments left after the " @@ -90,7 +103,11 @@ msgid "" "occurrences. Long and short options may be mixed." msgstr "" -#: library/getopt.rst:68 +#: library/getopt.rst:75 +msgid "Optional arguments are supported." +msgstr "" + +#: library/getopt.rst:81 msgid "" "This function works like :func:`getopt`, except that GNU style scanning mode " "is used by default. This means that option and non-option arguments may be " @@ -98,51 +115,206 @@ msgid "" "a non-option argument is encountered." msgstr "" -#: library/getopt.rst:73 +#: library/getopt.rst:86 msgid "" "If the first character of the option string is ``'+'``, or if the " -"environment variable :envvar:`POSIXLY_CORRECT` is set, then option " +"environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " "processing stops as soon as a non-option argument is encountered." msgstr "" -#: library/getopt.rst:80 +#: library/getopt.rst:90 +msgid "" +"If the first character of the option string is ``'-'``, non-option arguments " +"that are followed by options are added to the list of option-and-value pairs " +"as a pair that has ``None`` as its first element and the list of non-option " +"arguments as its second element. The second element of the :func:`!" +"gnu_getopt` result is a list of program arguments after the last option." +msgstr "" + +#: library/getopt.rst:97 +msgid "" +"Support for returning intermixed options and non-option arguments in order." +msgstr "" + +#: library/getopt.rst:103 msgid "" "This is raised when an unrecognized option is found in the argument list or " "when an option requiring an argument is given none. The argument to the " "exception is a string indicating the cause of the error. For long options, " "an argument given to an option which does not require one will also cause " -"this exception to be raised. The attributes :attr:`msg` and :attr:`opt` " +"this exception to be raised. The attributes :attr:`!msg` and :attr:`!opt` " "give the error message and related option; if there is no specific option to " -"which the exception relates, :attr:`opt` is an empty string." +"which the exception relates, :attr:`!opt` is an empty string." msgstr "" -#: library/getopt.rst:91 +#: library/getopt.rst:114 msgid "Alias for :exc:`GetoptError`; for backward compatibility." msgstr "" -#: library/getopt.rst:93 +#: library/getopt.rst:116 msgid "An example using only Unix style options:" msgstr "" -#: library/getopt.rst:105 +#: library/getopt.rst:118 +msgid "" +">>> import getopt\n" +">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> args\n" +"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +">>> optlist\n" +"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +">>> args\n" +"['a1', 'a2']" +msgstr "" + +#: library/getopt.rst:130 msgid "Using long option names is equally easy:" msgstr "" -#: library/getopt.rst:118 -msgid "In a script, typical usage is something like this::" +#: library/getopt.rst:132 +msgid "" +">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', " +"'a2']\n" +">>> optlist, args = getopt.getopt(args, 'x', [\n" +"... 'condition=', 'output-file=', 'testing'])\n" +">>> optlist\n" +"[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-" +"x', '')]\n" +">>> args\n" +"['a1', 'a2']" +msgstr "" + +#: library/getopt.rst:145 +msgid "Optional arguments should be specified explicitly:" msgstr "" #: library/getopt.rst:147 msgid "" +">>> s = '-Con -C --color=off --color a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['-Con', '-C', '--color=off', '--color', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'C::', ['color=?'])\n" +">>> optlist\n" +"[('-C', 'on'), ('-C', ''), ('--color', 'off'), ('--color', '')]\n" +">>> args\n" +"['a1', 'a2']" +msgstr "" + +#: library/getopt.rst:159 +msgid "The order of options and non-option arguments can be preserved:" +msgstr "" + +#: library/getopt.rst:161 +msgid "" +">>> s = 'a1 -x a2 a3 a4 --long a5 a6'\n" +">>> args = s.split()\n" +">>> args\n" +"['a1', '-x', 'a2', 'a3', 'a4', '--long', 'a5', 'a6']\n" +">>> optlist, args = getopt.gnu_getopt(args, '-x:', ['long='])\n" +">>> optlist\n" +"[(None, ['a1']), ('-x', 'a2'), (None, ['a3', 'a4']), ('--long', 'a5')]\n" +">>> args\n" +"['a6']" +msgstr "" + +#: library/getopt.rst:173 +msgid "In a script, typical usage is something like this:" +msgstr "" + +#: library/getopt.rst:175 +msgid "" +"import getopt, sys\n" +"\n" +"def main():\n" +" try:\n" +" opts, args = getopt.getopt(sys.argv[1:], \"ho:v\", [\"help\", " +"\"output=\"])\n" +" except getopt.GetoptError as err:\n" +" # print help information and exit:\n" +" print(err) # will print something like \"option -a not " +"recognized\"\n" +" usage()\n" +" sys.exit(2)\n" +" output = None\n" +" verbose = False\n" +" for o, a in opts:\n" +" if o == \"-v\":\n" +" verbose = True\n" +" elif o in (\"-h\", \"--help\"):\n" +" usage()\n" +" sys.exit()\n" +" elif o in (\"-o\", \"--output\"):\n" +" output = a\n" +" else:\n" +" assert False, \"unhandled option\"\n" +" process(args, output=output, verbose=verbose)\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" +msgstr "" + +#: library/getopt.rst:204 +msgid "" "Note that an equivalent command line interface could be produced with less " "code and more informative help and error messages by using the :mod:" -"`argparse` module::" +"`optparse` module:" +msgstr "" + +#: library/getopt.rst:207 +msgid "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" +msgstr "" + +#: library/getopt.rst:218 +msgid "" +"A roughly equivalent command line interface for this case can also be " +"produced by using the :mod:`argparse` module:" +msgstr "" + +#: library/getopt.rst:221 +msgid "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" +msgstr "" + +#: library/getopt.rst:233 +msgid "" +"See :ref:`choosing-an-argument-parser` for details on how the ``argparse`` " +"version of this code differs in behaviour from the ``optparse`` (and " +"``getopt``) version." +msgstr "" + +#: library/getopt.rst:239 +msgid "Module :mod:`optparse`" +msgstr "" + +#: library/getopt.rst:240 +msgid "Declarative command line option parsing." msgstr "" -#: library/getopt.rst:162 +#: library/getopt.rst:242 msgid "Module :mod:`argparse`" msgstr "" -#: library/getopt.rst:163 -msgid "Alternative command line option and argument parsing library." +#: library/getopt.rst:243 +msgid "More opinionated command line option and argument parsing library." msgstr "" diff --git a/library/getpass.po b/library/getpass.po index f20bd089..99f910b2 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/getpass.rst:2 -msgid ":mod:`getpass` --- Portable password input" +msgid ":mod:`!getpass` --- Portable password input" msgstr "" #: library/getpass.rst:11 @@ -25,14 +26,13 @@ msgid "**Source code:** :source:`Lib/getpass.py`" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/getpass.rst:17 @@ -51,35 +51,60 @@ msgstr "" #: library/getpass.rst:28 msgid "" +"The *echo_char* argument controls how user input is displayed while typing. " +"If *echo_char* is ``None`` (default), input remains hidden. Otherwise, " +"*echo_char* must be a single printable ASCII character and each typed " +"character is replaced by it. For example, ``echo_char='*'`` will display " +"asterisks instead of the actual input." +msgstr "" + +#: library/getpass.rst:34 +msgid "" "If echo free input is unavailable getpass() falls back to printing a warning " "message to *stream* and reading from ``sys.stdin`` and issuing a :exc:" "`GetPassWarning`." msgstr "" -#: library/getpass.rst:33 +#: library/getpass.rst:39 msgid "" "If you call getpass from within IDLE, the input may be done in the terminal " "you launched IDLE from rather than the idle window itself." msgstr "" -#: library/getpass.rst:38 +#: library/getpass.rst:43 +msgid "" +"On Unix systems, when *echo_char* is set, the terminal will be configured to " +"operate in :manpage:`noncanonical mode " +"`. In particular, this means " +"that line editing shortcuts such as :kbd:`Ctrl+U` will not work and may " +"insert unexpected characters into the input." +msgstr "" + +#: library/getpass.rst:50 +msgid "Added the *echo_char* parameter for keyboard feedback." +msgstr "" + +#: library/getpass.rst:55 msgid "A :exc:`UserWarning` subclass issued when password input may be echoed." msgstr "" -#: library/getpass.rst:43 +#: library/getpass.rst:60 msgid "Return the \"login name\" of the user." msgstr "" -#: library/getpass.rst:45 +#: library/getpass.rst:62 msgid "" "This function checks the environment variables :envvar:`LOGNAME`, :envvar:" "`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and returns the " "value of the first one which is set to a non-empty string. If none are set, " "the login name from the password database is returned on systems which " -"support the :mod:`pwd` module, otherwise, an exception is raised." +"support the :mod:`pwd` module, otherwise, an :exc:`OSError` is raised." msgstr "" -#: library/getpass.rst:52 -msgid "" -"In general, this function should be preferred over :func:`os.getlogin()`." +#: library/getpass.rst:69 +msgid "In general, this function should be preferred over :func:`os.getlogin`." +msgstr "" + +#: library/getpass.rst:71 +msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." msgstr "" diff --git a/library/gettext.po b/library/gettext.po index aaf8b93e..be0f77c5 100644 --- a/library/gettext.po +++ b/library/gettext.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/gettext.rst:2 -msgid ":mod:`gettext` --- Multilingual internationalization services" +msgid ":mod:`!gettext` --- Multilingual internationalization services" msgstr "" #: library/gettext.rst:10 @@ -130,6 +131,16 @@ msgstr "" msgid "Here's an example of typical usage for this API::" msgstr "" +#: library/gettext.rst:106 +msgid "" +"import gettext\n" +"gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')\n" +"gettext.textdomain('myapplication')\n" +"_ = gettext.gettext\n" +"# ...\n" +"print(_('This is a translatable string.'))" +msgstr "" + #: library/gettext.rst:115 msgid "Class-based API" msgstr "" @@ -235,6 +246,10 @@ msgid "" "function, like this::" msgstr "" +#: library/gettext.rst:187 +msgid "print(_('This string will be translated.'))" +msgstr "" + #: library/gettext.rst:189 msgid "" "For convenience, you want the :func:`!_` function to be installed in " @@ -341,6 +356,13 @@ msgid "" "this code to make :func:`!_` available to their module::" msgstr "" +#: library/gettext.rst:285 +msgid "" +"import gettext\n" +"t = gettext.translation('mymodule', ...)\n" +"_ = t.gettext" +msgstr "" + #: library/gettext.rst:289 msgid "" "This puts :func:`!_` only in the module's global namespace and so only " @@ -428,6 +450,16 @@ msgstr "" msgid "Here is an example::" msgstr "" +#: library/gettext.rst:350 +msgid "" +"n = len(os.listdir('.'))\n" +"cat = GNUTranslations(somefile)\n" +"message = cat.ngettext(\n" +" 'There is %(num)d file in this directory',\n" +" 'There are %(num)d files in this directory',\n" +" n) % {'num': n}" +msgstr "" + #: library/gettext.rst:360 msgid "" "Look up the *context* and *message* id in the catalog and return the " @@ -473,6 +505,14 @@ msgid "" "this version has a slightly different API. Its documented usage was::" msgstr "" +#: library/gettext.rst:399 +msgid "" +"import gettext\n" +"cat = gettext.Catalog(domain, localedir)\n" +"_ = cat.gettext\n" +"print(_('hello world'))" +msgstr "" + #: library/gettext.rst:404 msgid "" "For compatibility with this older module, the function :func:`!Catalog` is " @@ -526,6 +566,14 @@ msgid "" "`. For example::" msgstr "" +#: library/gettext.rst:434 +msgid "" +"filename = 'mylog.txt'\n" +"message = _('writing a log message')\n" +"with open(filename, 'w') as fp:\n" +" fp.write(message)" +msgstr "" + #: library/gettext.rst:439 msgid "" "In this example, the string ``'writing a log message'`` is marked as a " @@ -604,6 +652,13 @@ msgid "" "your module::" msgstr "" +#: library/gettext.rst:496 +msgid "" +"import gettext\n" +"t = gettext.translation('spam', '/usr/share/locale')\n" +"_ = t.gettext" +msgstr "" + #: library/gettext.rst:502 msgid "Localizing your application" msgstr "" @@ -622,12 +677,24 @@ msgid "" "main driver file of your application::" msgstr "" +#: library/gettext.rst:512 +msgid "" +"import gettext\n" +"gettext.install('myapplication')" +msgstr "" + #: library/gettext.rst:515 msgid "" "If you need to set the locale directory, you can pass it into the :func:" "`install` function::" msgstr "" +#: library/gettext.rst:518 +msgid "" +"import gettext\n" +"gettext.install('myapplication', '/usr/share/locale')" +msgstr "" + #: library/gettext.rst:523 msgid "Changing languages on the fly" msgstr "" @@ -639,6 +706,24 @@ msgid "" "explicitly, like so::" msgstr "" +#: library/gettext.rst:529 +msgid "" +"import gettext\n" +"\n" +"lang1 = gettext.translation('myapplication', languages=['en'])\n" +"lang2 = gettext.translation('myapplication', languages=['fr'])\n" +"lang3 = gettext.translation('myapplication', languages=['de'])\n" +"\n" +"# start by using language1\n" +"lang1.install()\n" +"\n" +"# ... time goes by, user selects language 2\n" +"lang2.install()\n" +"\n" +"# ... more time goes by, user selects language 3\n" +"lang3.install()" +msgstr "" + #: library/gettext.rst:546 msgid "Deferred translations" msgstr "" @@ -650,6 +735,18 @@ msgid "" "actual translation until later. A classic example is::" msgstr "" +#: library/gettext.rst:552 +msgid "" +"animals = ['mollusk',\n" +" 'albatross',\n" +" 'rat',\n" +" 'penguin',\n" +" 'python', ]\n" +"# ...\n" +"for a in animals:\n" +" print(a)" +msgstr "" + #: library/gettext.rst:561 msgid "" "Here, you want to mark the strings in the ``animals`` list as being " @@ -661,6 +758,23 @@ msgstr "" msgid "Here is one way you can handle this situation::" msgstr "" +#: library/gettext.rst:567 +msgid "" +"def _(message): return message\n" +"\n" +"animals = [_('mollusk'),\n" +" _('albatross'),\n" +" _('rat'),\n" +" _('penguin'),\n" +" _('python'), ]\n" +"\n" +"del _\n" +"\n" +"# ...\n" +"for a in animals:\n" +" print(_(a))" +msgstr "" + #: library/gettext.rst:581 msgid "" "This works because the dummy definition of :func:`!_` simply returns the " @@ -681,6 +795,21 @@ msgstr "" msgid "Another way to handle this is with the following example::" msgstr "" +#: library/gettext.rst:593 +msgid "" +"def N_(message): return message\n" +"\n" +"animals = [N_('mollusk'),\n" +" N_('albatross'),\n" +" N_('rat'),\n" +" N_('penguin'),\n" +" N_('python'), ]\n" +"\n" +"# ...\n" +"for a in animals:\n" +" print(_(a))" +msgstr "" + #: library/gettext.rst:605 msgid "" "In this case, you are marking translatable strings with the function :func:`!" diff --git a/library/glob.po b/library/glob.po index 7f6de48a..f9cd6f44 100644 --- a/library/glob.po +++ b/library/glob.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/glob.rst:2 -msgid ":mod:`glob` --- Unix style pathname pattern expansion" +msgid ":mod:`!glob` --- Unix style pathname pattern expansion" msgstr "" #: library/glob.rst:7 @@ -26,33 +27,38 @@ msgstr "" #: library/glob.rst:21 msgid "" -"The :mod:`glob` module finds all the pathnames matching a specified pattern " -"according to the rules used by the Unix shell, although results are returned " -"in arbitrary order. No tilde expansion is done, but ``*``, ``?``, and " +"The :mod:`!glob` module finds pathnames using pattern matching rules similar " +"to the Unix shell. No tilde expansion is done, but ``*``, ``?``, and " "character ranges expressed with ``[]`` will be correctly matched. This is " "done by using the :func:`os.scandir` and :func:`fnmatch.fnmatch` functions " "in concert, and not by actually invoking a subshell." msgstr "" -#: library/glob.rst:28 +#: library/glob.rst:29 msgid "" -"Note that files beginning with a dot (``.``) can only be matched by patterns " -"that also start with a dot, unlike :func:`fnmatch.fnmatch` or :func:`pathlib." -"Path.glob`. (For tilde and shell variable expansion, use :func:`os.path." -"expanduser` and :func:`os.path.expandvars`.)" +"The pathnames are returned in no particular order. If you need a specific " +"order, sort the results." msgstr "" -#: library/glob.rst:34 +#: library/glob.rst:32 +msgid "" +"Files beginning with a dot (``.``) can only be matched by patterns that also " +"start with a dot, unlike :func:`fnmatch.fnmatch` or :func:`pathlib.Path." +"glob`. For tilde and shell variable expansion, use :func:`os.path." +"expanduser` and :func:`os.path.expandvars`." +msgstr "" + +#: library/glob.rst:38 msgid "" "For a literal match, wrap the meta-characters in brackets. For example, " "``'[?]'`` matches the character ``'?'``." msgstr "" -#: library/glob.rst:39 -msgid "The :mod:`pathlib` module offers high-level path objects." +#: library/glob.rst:41 +msgid "The :mod:`!glob` module defines the following functions:" msgstr "" -#: library/glob.rst:45 +#: library/glob.rst:47 msgid "" "Return a possibly empty list of path names that match *pathname*, which must " "be a string containing a path specification. *pathname* can be either " @@ -64,21 +70,21 @@ msgid "" "path name for that file will be included is unspecified." msgstr "" -#: library/glob.rst:54 +#: library/glob.rst:56 msgid "" "If *root_dir* is not ``None``, it should be a :term:`path-like object` " "specifying the root directory for searching. It has the same effect on :" -"func:`glob` as changing the current directory before calling it. If " +"func:`!glob` as changing the current directory before calling it. If " "*pathname* is relative, the result will contain paths relative to *root_dir*." msgstr "" -#: library/glob.rst:60 +#: library/glob.rst:62 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: library/glob.rst:66 +#: library/glob.rst:68 msgid "" "If *recursive* is true, the pattern \"``**``\" will match any files and zero " "or more directories, subdirectories and symbolic links to directories. If " @@ -86,49 +92,55 @@ msgid "" "will not match." msgstr "" -#: library/glob.rst:71 +#: library/glob.rst:73 msgid "" "If *include_hidden* is true, \"``**``\" pattern will match hidden " "directories." msgstr "" -#: library/glob.rst:96 +#: library/glob.rst:102 msgid "" "Raises an :ref:`auditing event ` ``glob.glob`` with arguments " "``pathname``, ``recursive``." msgstr "" -#: library/glob.rst:97 +#: library/glob.rst:103 msgid "" "Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments " "``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." msgstr "" -#: library/glob.rst:77 +#: library/glob.rst:79 msgid "" "Using the \"``**``\" pattern in large directory trees may consume an " "inordinate amount of time." msgstr "" -#: library/glob.rst:99 +#: library/glob.rst:106 +msgid "" +"This function may return duplicate path names if *pathname* contains " +"multiple \"``**``\" patterns and *recursive* is true." +msgstr "" + +#: library/glob.rst:109 msgid "Support for recursive globs using \"``**``\"." msgstr "" -#: library/glob.rst:102 +#: library/glob.rst:112 msgid "Added the *root_dir* and *dir_fd* parameters." msgstr "" -#: library/glob.rst:105 +#: library/glob.rst:115 msgid "Added the *include_hidden* parameter." msgstr "" -#: library/glob.rst:93 +#: library/glob.rst:99 msgid "" "Return an :term:`iterator` which yields the same values as :func:`glob` " "without actually storing them all simultaneously." msgstr "" -#: library/glob.rst:111 +#: library/glob.rst:121 msgid "" "Escape all special characters (``'?'``, ``'*'`` and ``'['``). This is useful " "if you want to match an arbitrary literal string that may have special " @@ -137,28 +149,97 @@ msgid "" "c:/Quo vadis[?].txt'``." msgstr "" -#: library/glob.rst:120 +#: library/glob.rst:132 msgid "" -"For example, consider a directory containing the following files: :file:`1." -"gif`, :file:`2.txt`, :file:`card.gif` and a subdirectory :file:`sub` which " -"contains only the file :file:`3.txt`. :func:`glob` will produce the " -"following results. Notice how any leading components of the path are " -"preserved. ::" +"Convert the given path specification to a regular expression for use with :" +"func:`re.match`. The path specification can contain shell-style wildcards." msgstr "" -#: library/glob.rst:138 +#: library/glob.rst:135 +msgid "For example:" +msgstr "" + +#: library/glob.rst:146 +msgid "" +"Path separators and segments are meaningful to this function, unlike :func:" +"`fnmatch.translate`. By default wildcards do not match path separators, and " +"``*`` pattern segments match precisely one path segment." +msgstr "" + +#: library/glob.rst:150 +msgid "" +"If *recursive* is true, the pattern segment \"``**``\" will match any number " +"of path segments." +msgstr "" + +#: library/glob.rst:153 +msgid "" +"If *include_hidden* is true, wildcards can match path segments that start " +"with a dot (``.``)." +msgstr "" + +#: library/glob.rst:156 +msgid "" +"A sequence of path separators may be supplied to the *seps* argument. If not " +"given, :data:`os.sep` and :data:`~os.altsep` (if available) are used." +msgstr "" + +#: library/glob.rst:161 +msgid "" +":meth:`pathlib.PurePath.full_match` and :meth:`pathlib.Path.glob` methods, " +"which call this function to implement pattern matching and globbing." +msgstr "" + +#: library/glob.rst:169 +msgid "Examples" +msgstr "" + +#: library/glob.rst:171 +msgid "" +"Consider a directory containing the following files: :file:`1.gif`, :file:`2." +"txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only " +"the file :file:`3.txt`. :func:`glob` will produce the following results. " +"Notice how any leading components of the path are preserved. ::" +msgstr "" + +#: library/glob.rst:177 +msgid "" +">>> import glob\n" +">>> glob.glob('./[0-9].*')\n" +"['./1.gif', './2.txt']\n" +">>> glob.glob('*.gif')\n" +"['1.gif', 'card.gif']\n" +">>> glob.glob('?.gif')\n" +"['1.gif']\n" +">>> glob.glob('**/*.txt', recursive=True)\n" +"['2.txt', 'sub/3.txt']\n" +">>> glob.glob('./**/', recursive=True)\n" +"['./', './sub/']" +msgstr "" + +#: library/glob.rst:189 msgid "" "If the directory contains files starting with ``.`` they won't be matched by " "default. For example, consider a directory containing :file:`card.gif` and :" "file:`.card.gif`::" msgstr "" -#: library/glob.rst:150 -msgid "Module :mod:`fnmatch`" +#: library/glob.rst:193 +msgid "" +">>> import glob\n" +">>> glob.glob('*.gif')\n" +"['card.gif']\n" +">>> glob.glob('.c*')\n" +"['.card.gif']" msgstr "" -#: library/glob.rst:151 -msgid "Shell-style filename (not path) expansion" +#: library/glob.rst:200 +msgid "" +"The :mod:`fnmatch` module offers shell-style filename (not path) expansion." +msgstr "" + +#: library/glob.rst:203 +msgid "The :mod:`pathlib` module offers high-level path objects." msgstr "" #: library/glob.rst:9 @@ -173,7 +254,7 @@ msgstr "" msgid "* (asterisk)" msgstr "" -#: library/glob.rst:63 +#: library/glob.rst:65 msgid "in glob-style wildcards" msgstr "" @@ -197,6 +278,6 @@ msgstr "" msgid ". (dot)" msgstr "" -#: library/glob.rst:63 +#: library/glob.rst:65 msgid "**" msgstr "" diff --git a/library/graphlib.po b/library/graphlib.po index 02e8fc59..0879453b 100644 --- a/library/graphlib.po +++ b/library/graphlib.po @@ -8,16 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/graphlib.rst:2 -msgid ":mod:`graphlib` --- Functionality to operate with graph-like structures" +msgid "" +":mod:`!graphlib` --- Functionality to operate with graph-like structures" msgstr "" #: library/graphlib.rst:8 @@ -85,12 +87,45 @@ msgid "" "static_order` can be used directly:" msgstr "" +#: library/graphlib.rst:53 +msgid "" +">>> graph = {\"D\": {\"B\", \"C\"}, \"C\": {\"A\"}, \"B\": {\"A\"}}\n" +">>> ts = TopologicalSorter(graph)\n" +">>> tuple(ts.static_order())\n" +"('A', 'C', 'B', 'D')" +msgstr "" + #: library/graphlib.rst:60 msgid "" "The class is designed to easily support parallel processing of the nodes as " "they become ready. For instance::" msgstr "" +#: library/graphlib.rst:63 +msgid "" +"topological_sorter = TopologicalSorter()\n" +"\n" +"# Add nodes to 'topological_sorter'...\n" +"\n" +"topological_sorter.prepare()\n" +"while topological_sorter.is_active():\n" +" for node in topological_sorter.get_ready():\n" +" # Worker threads or processes take nodes to work on off the\n" +" # 'task_queue' queue.\n" +" task_queue.put(node)\n" +"\n" +" # When the work for a node is done, workers put the node in\n" +" # 'finalized_tasks_queue' so we can get more nodes to work on.\n" +" # The definition of 'is_active()' guarantees that, at this point, at\n" +" # least one node has been placed on 'task_queue' that hasn't yet\n" +" # been passed to 'done()', so this blocking 'get()' must (eventually)\n" +" # succeed. After calling 'done()', we loop back to call 'get_ready()'\n" +" # again, so put newly freed nodes on 'task_queue' as soon as\n" +" # logically possible.\n" +" node = finalized_tasks_queue.get()\n" +" topological_sorter.done(node)" +msgstr "" + #: library/graphlib.rst:87 msgid "" "Add a new node and its predecessors to the graph. Both the *node* and all " @@ -126,7 +161,19 @@ msgid "" "`~TopologicalSorter.add`." msgstr "" -#: library/graphlib.rst:111 +#: library/graphlib.rst:109 +msgid "" +"A :exc:`ValueError` will be raised if the sort has been started by :meth:`~." +"static_order` or :meth:`~.get_ready`." +msgstr "" + +#: library/graphlib.rst:114 +msgid "" +"``prepare()`` can now be called more than once as long as the sort has not " +"started. Previously this raised :exc:`ValueError`." +msgstr "" + +#: library/graphlib.rst:119 msgid "" "Returns ``True`` if more progress can be made and ``False`` otherwise. " "Progress can be made if cycles do not block the resolution and either there " @@ -136,30 +183,42 @@ msgid "" "meth:`TopologicalSorter.get_ready`." msgstr "" -#: library/graphlib.rst:118 +#: library/graphlib.rst:126 msgid "" "The :meth:`~object.__bool__` method of this class defers to this function, " "so instead of::" msgstr "" -#: library/graphlib.rst:124 +#: library/graphlib.rst:129 +msgid "" +"if ts.is_active():\n" +" ..." +msgstr "" + +#: library/graphlib.rst:132 msgid "it is possible to simply do::" msgstr "" -#: library/graphlib.rst:152 +#: library/graphlib.rst:134 +msgid "" +"if ts:\n" +" ..." +msgstr "" + +#: library/graphlib.rst:160 msgid "" "Raises :exc:`ValueError` if called without calling :meth:`~TopologicalSorter." "prepare` previously." msgstr "" -#: library/graphlib.rst:134 +#: library/graphlib.rst:142 msgid "" "Marks a set of nodes returned by :meth:`TopologicalSorter.get_ready` as " "processed, unblocking any successor of each node in *nodes* for being " "returned in the future by a call to :meth:`TopologicalSorter.get_ready`." msgstr "" -#: library/graphlib.rst:138 +#: library/graphlib.rst:146 msgid "" "Raises :exc:`ValueError` if any node in *nodes* has already been marked as " "processed by a previous call to this method or if a node was not added to " @@ -168,7 +227,7 @@ msgid "" "meth:`~TopologicalSorter.get_ready`." msgstr "" -#: library/graphlib.rst:146 +#: library/graphlib.rst:154 msgid "" "Returns a ``tuple`` with all the nodes that are ready. Initially it returns " "all nodes with no predecessors, and once those are marked as processed by " @@ -177,7 +236,7 @@ msgid "" "progress can be made, empty tuples are returned." msgstr "" -#: library/graphlib.rst:157 +#: library/graphlib.rst:165 msgid "" "Returns an iterator object which will iterate over nodes in a topological " "order. When using this method, :meth:`~TopologicalSorter.prepare` and :meth:" @@ -185,13 +244,38 @@ msgid "" "to::" msgstr "" -#: library/graphlib.rst:169 +#: library/graphlib.rst:170 +msgid "" +"def static_order(self):\n" +" self.prepare()\n" +" while self.is_active():\n" +" node_group = self.get_ready()\n" +" yield from node_group\n" +" self.done(*node_group)" +msgstr "" + +#: library/graphlib.rst:177 msgid "" "The particular order that is returned may depend on the specific order in " "which the items were inserted in the graph. For example:" msgstr "" -#: library/graphlib.rst:186 +#: library/graphlib.rst:180 +msgid "" +">>> ts = TopologicalSorter()\n" +">>> ts.add(3, 2, 1)\n" +">>> ts.add(1, 0)\n" +">>> print([*ts.static_order()])\n" +"[2, 0, 1, 3]\n" +"\n" +">>> ts2 = TopologicalSorter()\n" +">>> ts2.add(1, 0)\n" +">>> ts2.add(3, 2, 1)\n" +">>> print([*ts2.static_order()])\n" +"[0, 2, 1, 3]" +msgstr "" + +#: library/graphlib.rst:194 msgid "" "This is due to the fact that \"0\" and \"2\" are in the same level in the " "graph (they would have been returned in the same call to :meth:" @@ -199,26 +283,26 @@ msgid "" "the order of insertion." msgstr "" -#: library/graphlib.rst:192 +#: library/graphlib.rst:200 msgid "If any cycle is detected, :exc:`CycleError` will be raised." msgstr "" -#: library/graphlib.rst:198 +#: library/graphlib.rst:206 msgid "Exceptions" msgstr "" -#: library/graphlib.rst:199 +#: library/graphlib.rst:207 msgid "The :mod:`graphlib` module defines the following exception classes:" msgstr "" -#: library/graphlib.rst:203 +#: library/graphlib.rst:211 msgid "" "Subclass of :exc:`ValueError` raised by :meth:`TopologicalSorter.prepare` if " "cycles exist in the working graph. If multiple cycles exist, only one " "undefined choice among them will be reported and included in the exception." msgstr "" -#: library/graphlib.rst:207 +#: library/graphlib.rst:215 msgid "" "The detected cycle can be accessed via the second element in the :attr:" "`~BaseException.args` attribute of the exception instance and consists in a " diff --git a/library/grp.po b/library/grp.po index 4949bd14..b909715d 100644 --- a/library/grp.po +++ b/library/grp.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/grp.rst:2 -msgid ":mod:`grp` --- The group database" +msgid ":mod:`!grp` --- The group database" msgstr "" #: library/grp.rst:10 @@ -27,7 +28,7 @@ msgid "" msgstr "" #: library/grp.rst:13 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +msgid "Availability" msgstr "" #: library/grp.rst:15 @@ -133,18 +134,10 @@ msgstr "" msgid "Return a list of all available group entries, in arbitrary order." msgstr "" -#: library/grp.rst:65 +#: library/grp.rst:64 msgid "Module :mod:`pwd`" msgstr "" #: library/grp.rst:65 msgid "An interface to the user database, similar to this." msgstr "" - -#: library/grp.rst:67 -msgid "Module :mod:`spwd`" -msgstr "" - -#: library/grp.rst:68 -msgid "An interface to the shadow password database, similar to this." -msgstr "" diff --git a/library/gzip.po b/library/gzip.po index 5d5476ee..2401f34a 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -8,33 +8,49 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/gzip.rst:2 -msgid ":mod:`gzip` --- Support for :program:`gzip` files" -msgstr "" +msgid ":mod:`!gzip` --- Support for :program:`gzip` files" +msgstr ":mod:`!gzip` --- Υποστήριξη για αρχεία :program:`gzip`" #: library/gzip.rst:7 msgid "**Source code:** :source:`Lib/gzip.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/gzip.py`" #: library/gzip.rst:11 msgid "" "This module provides a simple interface to compress and decompress files " "just like the GNU programs :program:`gzip` and :program:`gunzip` would." msgstr "" +"Αυτό το module παρέχει μια απλή διεπαφή για τη συμπίεση και αποσυμπίεση " +"αρχείων όπως ακριβώς θα έκαναν τα προγράμματα της GNU :program:`gzip` και :" +"program:`gunzip`." -#: library/gzip.rst:14 -msgid "The data compression is provided by the :mod:`zlib` module." +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." msgstr "" +"Αυτό είναι ένα :term:`optional module`. Εάν λείπει από το αντίγραφο του " +"CPython σας, αναζητήστε την τεκμηρίωση από τον διανομέα σας (δηλαδή, όποιος " +"σας παρείχε την Python). Εάν είστε ο διανομέας, δείτε :ref:`optional-module-" +"requirements`." #: library/gzip.rst:16 +msgid "The data compression is provided by the :mod:`zlib` module." +msgstr "Η συμπίεση δεδομένων παρέχεται από το :mod:`zlib` module." + +#: library/gzip.rst:18 msgid "" "The :mod:`gzip` module provides the :class:`GzipFile` class, as well as the :" "func:`.open`, :func:`compress` and :func:`decompress` convenience functions. " @@ -42,95 +58,139 @@ msgid "" "files, automatically compressing or decompressing the data so that it looks " "like an ordinary :term:`file object`." msgstr "" +"Το :mod:`gzip` module παρέχει την κλάση :class:`GzipFile`, καθώς και τις " +"συναρτήσεις διευκόλυνσης :func:`.open`, :func:`compress` και :func:" +"`decompress`. Η κλάση :class:`GzipFile` διαβάζει και γράφει αρχεία μορφής :" +"program:`gzip`, συμπιέζοντας ή αποσυμπιέζοντας αυτόματα τα δεδομένα, ώστε να " +"φαίνεται σαν ένα συνηθισμένο :term:`file object`." -#: library/gzip.rst:22 +#: library/gzip.rst:24 msgid "" "Note that additional file formats which can be decompressed by the :program:" "`gzip` and :program:`gunzip` programs, such as those produced by :program:" "`compress` and :program:`pack`, are not supported by this module." msgstr "" +"Σημειώστε ότι πρόσθετες μορφές αρχείων που μπορούν να αποσυμπιεστούν από τα " +"προγράμματα :program:`gzip` και :program:`gunzip`, όπως αυτές που παράγονται " +"από τα :program:`compress` και :program:`pack`, δεν υποστηρίζονται από αυτό " +"το module." -#: library/gzip.rst:26 +#: library/gzip.rst:28 msgid "The module defines the following items:" -msgstr "" +msgstr "Το module ορίζει τα ακόλουθα στοιχεία:" -#: library/gzip.rst:31 +#: library/gzip.rst:33 msgid "" "Open a gzip-compressed file in binary or text mode, returning a :term:`file " "object`." msgstr "" +"Ανοίγει ένα gzip-συμπιεσμένο αρχείο σε δυαδική ή σε λειτουργία κειμένου, " +"επιστρέφοντας ένα :term:`file object`." -#: library/gzip.rst:34 +#: library/gzip.rst:36 msgid "" "The *filename* argument can be an actual filename (a :class:`str` or :class:" "`bytes` object), or an existing file object to read from or write to." msgstr "" +"Η παράμετρος *filename* μπορεί να είναι ένα πραγματικό όνομα αρχείου (ένα " +"αντικείμενο :class:`str` ή :class:`bytes`), ή ένα υπάρχον αντικείμενο " +"αρχείου για ανάγνωση και εγγραφή." -#: library/gzip.rst:37 +#: library/gzip.rst:39 msgid "" "The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, " "``'w'``, ``'wb'``, ``'x'`` or ``'xb'`` for binary mode, or ``'rt'``, " "``'at'``, ``'wt'``, or ``'xt'`` for text mode. The default is ``'rb'``." msgstr "" +"Η παράμετρος *mode* μπορεί να είναι οποιαδήποτε από τις ``'r'``. ``'rb'``, " +"``'a'``, ``'ab'``, ``'w'``, ``'wb'``, ``'x'`` ή ``'xb'`` για δυαδική " +"λειτουργία, ή ``'rt'``, ``'at'``, ``'wt'`` ή ``'xt'`` για λειτουργία " +"κειμένου. Η προεπιλογή είναι το ``'rb'``." -#: library/gzip.rst:41 +#: library/gzip.rst:43 msgid "" "The *compresslevel* argument is an integer from 0 to 9, as for the :class:" "`GzipFile` constructor." msgstr "" +"Η παράμετρος *compresslevel* είναι ένας ακέραιος από 0 έως 9, όπως και για " +"τον constructor της κλάσης :class:`GzipFile`." -#: library/gzip.rst:44 +#: library/gzip.rst:46 msgid "" "For binary mode, this function is equivalent to the :class:`GzipFile` " "constructor: ``GzipFile(filename, mode, compresslevel)``. In this case, the " "*encoding*, *errors* and *newline* arguments must not be provided." msgstr "" +"Για δυαδική λειτουργία, αυτή η συνάρτηση είναι ισοδύναμη με τον constructor " +"της κλάσης :class:`GzipFile`: ``GzipFile(filename, mode, compresslevel)``. " +"Σε αυτή την περίπτωση, οι παράμετροι *encoding*, *errors* και *newline* δεν " +"πρέπει να παρέχονται." -#: library/gzip.rst:48 +#: library/gzip.rst:50 msgid "" "For text mode, a :class:`GzipFile` object is created, and wrapped in an :" "class:`io.TextIOWrapper` instance with the specified encoding, error " "handling behavior, and line ending(s)." msgstr "" +"Για τη λειτουργία κειμένου, δημιουργείται ένα αντικείμενο :class:`GzipFile` " +"και γίνεται wrap σε ένα στιγμιότυπο της κλάσης :class:`io.TextIOWrapper` με " +"την καθορισμένη κωδικοποίηση, τη συμπεριφορά διαχείρισης σφαλμάτων και το(α) " +"τέλος(η) γραμμής." -#: library/gzip.rst:52 +#: library/gzip.rst:54 msgid "" "Added support for *filename* being a file object, support for text mode, and " "the *encoding*, *errors* and *newline* arguments." msgstr "" +"Προστέθηκε υποστήριξη για την παράμετρο *filename* ως αντικείμενο αρχείου, " +"υποστήριξη για τη λειτουργία κειμένου, καθώς και οι παράμετροι *encoding*, " +"*errors* και *newline*." -#: library/gzip.rst:56 +#: library/gzip.rst:58 msgid "Added support for the ``'x'``, ``'xb'`` and ``'xt'`` modes." msgstr "" +"Προστέθηκε υποστήριξη για τις λειτουργίες ``'x'``, ``'xb'`` και ``'xt'``." -#: library/gzip.rst:171 +#: library/gzip.rst:175 msgid "Accepts a :term:`path-like object`." -msgstr "" +msgstr "Δέχεται ένα :term:`path-like object`." -#: library/gzip.rst:64 +#: library/gzip.rst:66 msgid "" "An exception raised for invalid gzip files. It inherits from :exc:" "`OSError`. :exc:`EOFError` and :exc:`zlib.error` can also be raised for " "invalid gzip files." msgstr "" +"Μια εξαίρεση γίνεται raise για μη έγκυρα αρχεία gzip. Κληρονομεί από την :" +"exc:`OSError`. Οι εξαιρέσεις :exc:`EOFError` και :exc:`zlib.error` μπορούν " +"επίσης να γίνουν raise για μη έγκυρα αρχεία gzip." -#: library/gzip.rst:72 +#: library/gzip.rst:74 msgid "" "Constructor for the :class:`GzipFile` class, which simulates most of the " "methods of a :term:`file object`, with the exception of the :meth:`~io." "IOBase.truncate` method. At least one of *fileobj* and *filename* must be " "given a non-trivial value." msgstr "" +"Ο constructor της κλάσης :class:`GzipFile`, η οποία προσομοιώνει τις " +"περισσότερες μεθόδους ενός :term:`file object`, με εξαίρεση τη μέθοδο :meth:" +"`~io.IOBase.truncate`. Τουλάχιστον μια από τις παραμέτρους *fileobj* και " +"*filename* πρέπει να έχει μια μη τετριμμένη τιμή." -#: library/gzip.rst:77 +#: library/gzip.rst:79 msgid "" "The new class instance is based on *fileobj*, which can be a regular file, " "an :class:`io.BytesIO` object, or any other object which simulates a file. " "It defaults to ``None``, in which case *filename* is opened to provide a " "file object." msgstr "" +"Το νέο στιγμιότυπο της κλάσης βασίζεται στο *fileobj*, το οποίο μπορεί να " +"είναι ένα κανονικό αρχείο, ένα αντικείμενο :class:`io.BytesIO`, ή " +"οποιοδήποτε άλλο αντικείμενο που προσομοιώνει αρχείο. Η προεπιλογή είναι " +"``None``, οπότε στην περίπτωση αυτή το *filename* ανοίγεται για να παρέχει " +"ένα αντικείμενο αρχείου." -#: library/gzip.rst:82 +#: library/gzip.rst:84 msgid "" "When *fileobj* is not ``None``, the *filename* argument is only used to be " "included in the :program:`gzip` file header, which may include the original " @@ -138,8 +198,15 @@ msgid "" "*fileobj*, if discernible; otherwise, it defaults to the empty string, and " "in this case the original filename is not included in the header." msgstr "" +"Όταν το *fileobj* δεν είναι ``None``, η παράμετρος *filename* " +"χρησιμοποιείται μόνο για να συμπεριληφθεί στην επικεφαλίδα του αρχείου :" +"program:`gzip`, η οποία μπορεί να περιέχει το αρχικό όνομα του μη " +"συμπιεσμένου αρχείου. Η προεπιλογή είναι το όνομα αρχείου του *fileobj*, αν " +"αυτό μπορεί να προσδιοριστεί· διαφορετικά, η προεπιλογή είναι η κενή " +"συμβολοσειρά, και σε αυτή την περίπτωση το αρχικό όνομα αρχείου δεν " +"περιλαμβάνεται στην επικεφαλίδα." -#: library/gzip.rst:88 +#: library/gzip.rst:90 msgid "" "The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, " "``'w'``, ``'wb'``, ``'x'``, or ``'xb'``, depending on whether the file will " @@ -148,31 +215,58 @@ msgid "" "*fileobj* will not be used. It is better to always specify *mode* for " "writing." msgstr "" +"Η παράμετρος *mode* μπορεί να είναι οποιαδήποτε από τις ``'r'``, ``'rb'``, " +"``'a'``, ``'ab'``, ``'w'``, ``'wb'``, ``'x'`` ή ``'xb'``, ανάλογα με το αν " +"το αρχείο θα διαβαστεί ή θα γραφτεί. Η προεπιλογή είναι η λειτουργία του " +"*fileobj*, αν αυτό μπορεί να προσδιοριστεί· διαφορετικά, η προεπιλογή είναι " +"``'rb'``. Σε μελλοντικές εκδόσεις της Python, η λειτουργία του *fileobj* δεν " +"θα χρησιμοποιείται. Είναι καλύτερο να καθορίζεται πάντα η παράμετρος *mode* " +"κατά την εγγραφή." -#: library/gzip.rst:94 +#: library/gzip.rst:96 msgid "" "Note that the file is always opened in binary mode. To open a compressed " "file in text mode, use :func:`.open` (or wrap your :class:`GzipFile` with " "an :class:`io.TextIOWrapper`)." msgstr "" +"Σημειώστε ότι το αρχείο ανοίγει πάντα σε δυαδική λειτουργία. Για να ανοίξετε " +"ένα συμπιεσμένο αρχείο σε λειτουργία κειμένου, χρησιμοποιήστε τη συνάρτηση :" +"func:`.open` (ή κάντε wrap το :class:`GzipFile` με ένα :class:`io." +"TextIOWrapper`)." -#: library/gzip.rst:98 +#: library/gzip.rst:100 msgid "" "The *compresslevel* argument is an integer from ``0`` to ``9`` controlling " "the level of compression; ``1`` is fastest and produces the least " "compression, and ``9`` is slowest and produces the most compression. ``0`` " "is no compression. The default is ``9``." msgstr "" +"Η παράμετρος *compresslevel* είναι ένας ακέραιος από ``0`` έως ``9`` που " +"ελέγχει το επίπεδο συμπίεσης· το ``1`` είναι το ταχύτερο και παράγει τη " +"μικρότερη συμπίεση, ενώ το ``9`` είναι το πιο αργό και παράγει τη μεγαλύτερη " +"συμπίεση. Το ``0`` σημαίνει καθόλου συμπίεση. Η προεπιλογή είναι το ``9``." -#: library/gzip.rst:103 +#: library/gzip.rst:105 msgid "" -"The *mtime* argument is an optional numeric timestamp to be written to the " -"last modification time field in the stream when compressing. It should only " -"be provided in compression mode. If omitted or ``None``, the current time " -"is used. See the :attr:`mtime` attribute for more details." +"The optional *mtime* argument is the timestamp requested by gzip. The time " +"is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. If " +"*mtime* is omitted or ``None``, the current time is used. Use *mtime* = 0 to " +"generate a compressed stream that does not depend on creation time." msgstr "" +"Το προαιρετικό όρισμα *mtime* είναι η χρονική σήμανση που ζητείται από το " +"gzip. Η ώρα είναι σε μορφή Unix, δηλαδή δευτερόλεπτα από τις 00:00:00 UTC, " +"1η Ιανουαρίου 1970. Εάν παραληφθεί το *mtime* ή ``None``, χρησιμοποιείται η " +"τρέχουσα ώρα. Χρησιμοποιήστε *mtime* = 0 για να δημιουργήσετε μια " +"συμπιεσμένη ροή που δεν εξαρτάται από το χρόνο δημιουργίας." -#: library/gzip.rst:108 +#: library/gzip.rst:110 +msgid "" +"See below for the :attr:`mtime` attribute that is set when decompressing." +msgstr "" +"Δείτε παρακάτω για το χαρακτηριστικό :attr:`mtime` που ορίζεται κατά την " +"αποσυμπίεση." + +#: library/gzip.rst:112 msgid "" "Calling a :class:`GzipFile` object's :meth:`!close` method does not close " "*fileobj*, since you might wish to append more material after the compressed " @@ -180,113 +274,176 @@ msgid "" "writing as *fileobj*, and retrieve the resulting memory buffer using the :" "class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." msgstr "" +"Η κλήση της μεθόδου :meth:`!close` ενός αντικειμένου :class:`GzipFile` δεν " +"κλείνει το *fileobj*, καθώς μπορεί να θέλετε να προσθέσετε επιπλέον δεδομένα " +"μετά τη συμπιεσμένη πληροφορία. Αυτό επιτρέπει επίσης να περάσετε ένα " +"αντικείμενο :class:`io.BytesIO` ανοιγμένο για εγγραφή ως *fileobj* και να " +"ανακτήσετε τον τελικό buffer μνήμης χρησιμοποιώντας τη μέθοδο :meth:`~io." +"BytesIO.getvalue` του αντικειμένου :class:`io.BytesIO`." -#: library/gzip.rst:114 +#: library/gzip.rst:118 msgid "" ":class:`GzipFile` supports the :class:`io.BufferedIOBase` interface, " "including iteration and the :keyword:`with` statement. Only the :meth:`~io." "IOBase.truncate` method isn't implemented." msgstr "" +"Η κλάση :class:`GzipFile` υποστηρίζει τη διεπαφή :class:`io.BufferedIOBase`, " +"συμπεριλαμβανομένης της δυνατότητας επανάληψης και της χρήσης με τη δήλωση :" +"keyword:`with`. Μόνο η μέθοδος :meth:`~io.IOBase.truncate` δεν είναι " +"υλοποιημένη." -#: library/gzip.rst:118 +#: library/gzip.rst:122 msgid ":class:`GzipFile` also provides the following method and attribute:" -msgstr "" +msgstr "Η :class:`GzipFile` παρέχει επίσης την ακόλουθη μέθοδο και ιδιότητα:" -#: library/gzip.rst:122 +#: library/gzip.rst:126 msgid "" -"Read *n* uncompressed bytes without advancing the file position. At most one " -"single read on the compressed stream is done to satisfy the call. The " -"number of bytes returned may be more or less than requested." +"Read *n* uncompressed bytes without advancing the file position. The number " +"of bytes returned may be more or less than requested." msgstr "" +"Διαβάζει *n* μη συμπιεσμένα bytes χωρίς να μετακινεί τη θέση του αρχείου. Ο " +"αριθμός των bytes που επιστρέφονται μπορεί να είναι περισσότερα ή λιγότερα " +"από τα ζητούμενα." -#: library/gzip.rst:127 +#: library/gzip.rst:129 msgid "" "While calling :meth:`peek` does not change the file position of the :class:" "`GzipFile`, it may change the position of the underlying file object (e.g. " "if the :class:`GzipFile` was constructed with the *fileobj* parameter)." msgstr "" +"Αν και η κλήση της μεθόδου :meth:`peek` δεν αλλάζει τη θέση του αρχείου του " +"αντικειμένου :class:`GzipFile`, μπορεί να αλλάξει τη θέση του υποκείμενου " +"αντικειμένου αρχείου (π.χ. αν το :class:`GzipFile` δημιουργήθηκε με την " +"παράμετρο *fileobj*)." -#: library/gzip.rst:136 -msgid "" -"When decompressing, the value of the last modification time field in the " -"most recently read header may be read from this attribute, as an integer. " -"The initial value before reading any headers is ``None``." -msgstr "" +#: library/gzip.rst:138 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "``'rb'`` για ανάγνωση και ``'wb'`` για εγγραφή." #: library/gzip.rst:140 +msgid "In previous versions it was an integer ``1`` or ``2``." +msgstr "Σε προηγούμενες εκδόσεις αυτό ήταν ένα ακέραιος ``1`` ή ``2``." + +#: library/gzip.rst:145 msgid "" -"All :program:`gzip` compressed streams are required to contain this " -"timestamp field. Some programs, such as :program:`gunzip`\\ , make use of " -"the timestamp. The format is the same as the return value of :func:`time." -"time` and the :attr:`~os.stat_result.st_mtime` attribute of the object " -"returned by :func:`os.stat`." +"When decompressing, this attribute is set to the last timestamp in the most " +"recently read header. It is an integer, holding the number of seconds since " +"the Unix epoch (00:00:00 UTC, January 1, 1970). The initial value before " +"reading any headers is ``None``." msgstr "" +"Κατά την αποσυμπίεση, αυτό το χαρακτηριστικό ορίζεται στην τελευταία σήμανση " +"στην πιο πρόσφατα αναγνωσμένη κεφαλίδα. Είναι ένας ακέραιος αριθμός, που " +"κρατά τον αριθμό των δευτερολέπτων από την εποχή του Unix (00:00:00 UTC, 1 " +"Ιανουαρίου, 1970). Η αρχική τιμή πριν από την ανάγνωση οποιωνδήποτε " +"κεφαλίδων είναι ``None``." -#: library/gzip.rst:148 +#: library/gzip.rst:152 msgid "" "The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. " "Equivalent to the output of :func:`os.fspath` on the original input path, " "with no other normalization, resolution or expansion." msgstr "" +"Η διαδρομή προς το αρχείο gzip στο δίσκο, ως :class:`str` ή :class:`bytes`. " +"Ισοδυναμεί με την έξοδο της συνάρτησης :func:`os.fspath` για την αρχική " +"διαδρομή εισόδου, χωρίς καμία άλλη κανονικοποίηση, επίλυση ή επέκταση." -#: library/gzip.rst:152 +#: library/gzip.rst:156 msgid "" "Support for the :keyword:`with` statement was added, along with the *mtime* " "constructor argument and :attr:`mtime` attribute." msgstr "" +"Προστέθηκε η υποστήριξη για τη δήλωση :keyword:`with`, μαζί με την παράμετρο " +"*mtime* στον κατασκευαστή και την ιδιότητα :attr:`mtime`." -#: library/gzip.rst:156 +#: library/gzip.rst:160 msgid "Support for zero-padded and unseekable files was added." msgstr "" +"Προστέθηκε υποστήριξη για αρχεία με μηδενική συμπλήρωση και μη αναζητήσιμα " +"αρχεία." -#: library/gzip.rst:159 +#: library/gzip.rst:163 msgid "The :meth:`io.BufferedIOBase.read1` method is now implemented." -msgstr "" +msgstr "Η μέθοδος :meth:`io.BufferedIOBase.read1` έχει πλέον υλοποιηθεί." -#: library/gzip.rst:162 +#: library/gzip.rst:166 msgid "Added support for the ``'x'`` and ``'xb'`` modes." -msgstr "" +msgstr "Προστέθηκε υποστήριξη για τις λειτουργίες ``'x'`` και ``'xb'``." -#: library/gzip.rst:165 +#: library/gzip.rst:169 msgid "" "Added support for writing arbitrary :term:`bytes-like objects `. The :meth:`~io.BufferedIOBase.read` method now accepts an argument " "of ``None``." msgstr "" - -#: library/gzip.rst:174 -msgid "" -"Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " -"instead." -msgstr "" +"Προστέθηκε υποστήριξη για εγγραφή αυθαίρετων :term:`bytes-like objects " +"`. Η μέθοδος :meth:`~io.BufferedIOBase.read` δέχεται " +"πλέον ένα όρισμα ``None``." #: library/gzip.rst:178 msgid "" "Opening :class:`GzipFile` for writing without specifying the *mode* argument " "is deprecated." msgstr "" +"Το άνοιγμα ενός :class:`GzipFile` για εγγραφή χωρίς να καθοριστεί η " +"παράμετρος *mode* έχει καταργηθεί." -#: library/gzip.rst:185 +#: library/gzip.rst:182 +msgid "" +"Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " +"instead." +msgstr "" +"Καταργήθηκε το χαρακτηριστικό ``filename``, χρησιμοποιήστε το " +"χαρακτηριστικό :attr:`~GzipFile.name` αντ' αυτού." + +#: library/gzip.rst:189 msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " -"the :class:`GzipFile` constructor above. When *mtime* is set to ``0``, this " -"function is equivalent to :func:`zlib.compress` with *wbits* set to ``31``. " -"The zlib function is faster." +"the :class:`GzipFile` constructor above, but *mtime* defaults to 0 for " +"reproducible output." msgstr "" +"Συμπιέζει τα *data* και επιστρέφει ένα αντικείμενο :class:`bytes` που " +"περιέχει τα συμπιεσμένα δεδομένα. Οι παράμετροι *compresslevel* και *mtime* " +"έχουν την ίδια σημασία όπως στον κατασκευαστή της κλάσης :class:`GzipFile`, " +"αλλά το *mtime* έχει προεπιλεγμένη τιμή 0 για αναπαραγώγιμη έξοδο." -#: library/gzip.rst:192 +#: library/gzip.rst:195 msgid "Added the *mtime* parameter for reproducible output." -msgstr "" +msgstr "Προστέθηκε η παράμετρος *mtime* για αναπαραγώγιμη έξοδο." -#: library/gzip.rst:194 +#: library/gzip.rst:197 msgid "" "Speed is improved by compressing all data at once instead of in a streamed " "fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." -"compress` for better speed." +"compress` for better speed. In this situation the output may contain a gzip " +"header \"OS\" byte value other than 255 \"unknown\" as supplied by the " +"underlying zlib implementation." +msgstr "" +"Η ταχύτητα βελτιώνεται με τη συμπίεση όλων των δεδομένων ταυτόχρονα αντί για " +"ροή. Κλήσεις με *mtime* ρυθμισμένο σε ``0`` ανακατευθύνονται στη συνάρτηση :" +"func:`zlib.compress` για καλύτερη απόδοση. Σε αυτή την περίπτωση, η έξοδος " +"μπορεί να περιέχει μια τιμή byte \"OS\" στην κεφαλίδα gzip διαφορετική από " +"255 \"unknown\", όπως καθορίζεται από την υποκείμενη υλοποίηση της zlib." + +#: library/gzip.rst:204 +msgid "" +"The gzip header OS byte is guaranteed to be set to 255 when this function is " +"used as was the case in 3.10 and earlier." +msgstr "" +"Το byte του λειτουργικού συστήματος κεφαλίδα gzip είναι εγγυημένο ότι θα " +"ρυθμιστεί στο 255 όταν χρησιμοποιείται αυτή η συνάρτηση, όπως συνέβαινε στην " +"έκδοση 3.10 και παλαιότερα." + +#: library/gzip.rst:207 +msgid "" +"The *mtime* parameter now defaults to 0 for reproducible output. For the " +"previous behaviour of using the current time, pass ``None`` to *mtime*." msgstr "" +"Η παράμετρος *mtime* έχει πλέον την προεπιλεγμένη τιμή 0 για αναπαραγώγιμη " +"έξοδο. Για την προηγούμενη συμπεριφορά χρήστης της τρέχουσας ώρας, " +"μεταβιβάστε στην παράμετρο *mtime* την τιμή ``None``." -#: library/gzip.rst:201 +#: library/gzip.rst:214 msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " @@ -294,83 +451,179 @@ msgid "" "certain to contain only one member the :func:`zlib.decompress` function with " "*wbits* set to 31 is faster." msgstr "" +"Αποσυμπιέζει τα *data* και επιστρέφει ένα αντικείμενο :class:`bytes` που " +"περιέχει τα αποσυμπιεσμένα δεδομένα. Αυτή η συνάρτηση μπορεί να αποσυμπιέσει " +"δεδομένα gzip πολλαπλών μελών (πολλαπλά μπλοκ gzip που έχουν ενωθεί μεταξύ " +"τους). Όταν τα δεδομένα είναι βέβαιο ότι περιέχουν μόνο ένα μέλος, η " +"συνάρτηση :func:`zlib.decompress` με *wbits* ρυθμισμένο σε 31 είναι ταχύτερη." -#: library/gzip.rst:208 +#: library/gzip.rst:221 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" +"Η ταχύτητα βελτιώνεται αποσυμπιέζοντας τα μέλη απευθείας στην μνήμη αντί να " +"γίνεται αποσυμπίεση σε ροή." -#: library/gzip.rst:215 +#: library/gzip.rst:228 msgid "Examples of usage" -msgstr "" +msgstr "Παραδείγματα χρήσης" -#: library/gzip.rst:217 +#: library/gzip.rst:230 msgid "Example of how to read a compressed file::" +msgstr "Παράδειγμα ανάγνωσης ενός συμπιεσμένου αρχείου::" + +#: library/gzip.rst:232 +msgid "" +"import gzip\n" +"with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" +" file_content = f.read()" msgstr "" +"import gzip\n" +"with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" +" file_content = f.read()" -#: library/gzip.rst:223 +#: library/gzip.rst:236 msgid "Example of how to create a compressed GZIP file::" +msgstr "Παράδειγμα δημιουργίας ενός συμπιεσμένου αρχείου GZIP::" + +#: library/gzip.rst:238 +msgid "" +"import gzip\n" +"content = b\"Lots of content here\"\n" +"with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" +" f.write(content)" msgstr "" +"import gzip\n" +"content = b\"Lots of content here\"\n" +"with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" +" f.write(content)" -#: library/gzip.rst:230 +#: library/gzip.rst:243 msgid "Example of how to GZIP compress an existing file::" +msgstr "Παράδειγμα συμπίεσης ενός υπάρχοντος αρχείου σε μορφή GZIP::" + +#: library/gzip.rst:245 +msgid "" +"import gzip\n" +"import shutil\n" +"with open('/home/joe/file.txt', 'rb') as f_in:\n" +" with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" +" shutil.copyfileobj(f_in, f_out)" msgstr "" +"import gzip\n" +"import shutil\n" +"with open('/home/joe/file.txt', 'rb') as f_in:\n" +" with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" +" shutil.copyfileobj(f_in, f_out)" -#: library/gzip.rst:238 +#: library/gzip.rst:251 msgid "Example of how to GZIP compress a binary string::" +msgstr "Παράδειγμα συμπίεσης μιας δυαδικής συμβολοσειράς σε μορφή GZIP::" + +#: library/gzip.rst:253 +msgid "" +"import gzip\n" +"s_in = b\"Lots of content here\"\n" +"s_out = gzip.compress(s_in)" msgstr "" +"import gzip\n" +"s_in = b\"Lots of content here\"\n" +"s_out = gzip.compress(s_in)" -#: library/gzip.rst:247 +#: library/gzip.rst:259 msgid "Module :mod:`zlib`" -msgstr "" +msgstr "Module :mod:`zlib`" -#: library/gzip.rst:247 +#: library/gzip.rst:260 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" +"Το βασικό module συμπίεσης δεδομένων που απαιτείται για την υποστήριξη της " +"μορφής αρχείου :program:`gzip`." -#: library/gzip.rst:256 -msgid "Command Line Interface" +#: library/gzip.rst:263 +msgid "" +"In case gzip (de)compression is a bottleneck, the `python-isal`_ package " +"speeds up (de)compression with a mostly compatible API." msgstr "" +"Σε περίπτωση που η (από)συμπίεση gzip είναι ένα σημείο συμφόρησης, το πακέτο " +"`python-isal`_ επιταχύνει την (από)συμπίεση με ένα ως επί το πλείστον " +"συμβατό API." -#: library/gzip.rst:258 +#: library/gzip.rst:273 +msgid "Command-line interface" +msgstr "Διεπαφή Γραμμής Εντολών" + +#: library/gzip.rst:275 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" +"Το module :mod:`gzip` παρέχει μια απλή διεπαφή γραμμής εντολών για τη " +"συμπίεση ή αποσυμπίεση αρχείων." -#: library/gzip.rst:261 +#: library/gzip.rst:278 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" +"Μόλις εκτελεστεί, το module :mod:`gzip` διατηρεί το(α) αρχείο(α) εισόδου." -#: library/gzip.rst:265 +#: library/gzip.rst:282 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" +"Προστέθηκε νέα διεπαφή γραμμής εντολών με οδηγίες χρήσης. Από προεπιλογή, " +"όταν εκτελείτε την CLI, το προεπιλεγμένο επίπεδο συμπίεσης είναι 6." -#: library/gzip.rst:269 -msgid "Command line options" -msgstr "" +#: library/gzip.rst:286 +msgid "Command-line options" +msgstr "Επιλογές γραμμής εντολών" -#: library/gzip.rst:273 +#: library/gzip.rst:290 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "" +"Εάν δεν καθοριστεί το *file*, η ανάγνωση γίνεται από το :data:`sys.stdin`." -#: library/gzip.rst:277 +#: library/gzip.rst:294 msgid "Indicates the fastest compression method (less compression)." -msgstr "" +msgstr "Δηλώνει τη γρηγορότερη μέθοδο συμπίεσης (λιγότερη συμπίεση)." -#: library/gzip.rst:281 +#: library/gzip.rst:298 msgid "Indicates the slowest compression method (best compression)." -msgstr "" +msgstr "Δηλώνει την βραδύτερη μέθοδο συμπίεσης (καλύτερη συμπίεση)." -#: library/gzip.rst:285 +#: library/gzip.rst:302 msgid "Decompress the given file." -msgstr "" +msgstr "Αποσυμπιέζει το δοσμένο αρχείο." -#: library/gzip.rst:289 +#: library/gzip.rst:306 msgid "Show the help message." -msgstr "" +msgstr "Εμφανίζει το μήνυμα βοήθειας." + +#~ msgid "" +#~ "The *mtime* argument is an optional numeric timestamp to be written to " +#~ "the last modification time field in the stream when compressing. It " +#~ "should only be provided in compression mode. If omitted or ``None``, the " +#~ "current time is used. See the :attr:`mtime` attribute for more details." +#~ msgstr "" +#~ "Η παράμετρος *mtime* είναι ένας προαιρετικός αριθμητικός χρονικός δείκτης " +#~ "που γράφεται στο πεδίο τελευταίας τροποποίησης στη ροή κατά τη συμπίεση. " +#~ "Πρέπει να παράγεται μόνο σε λειτουργία συμπίεσης. Αν παραλειφθεί ή είναι " +#~ "``None``, χρησιμοποιείται η τρέχουσα χρονική στιγμή. Δείτε το " +#~ "χαρακτηριστικό :attr:`mtime` για περισσότερες λεπτομέρειες." + +#~ msgid "" +#~ "All :program:`gzip` compressed streams are required to contain this " +#~ "timestamp field. Some programs, such as :program:`gunzip`\\ , make use " +#~ "of the timestamp. The format is the same as the return value of :func:" +#~ "`time.time` and the :attr:`~os.stat_result.st_mtime` attribute of the " +#~ "object returned by :func:`os.stat`." +#~ msgstr "" +#~ "Όλες οι συμπιεσμένες ροές :program:`gzip` απαιτείται να περιέχουν αυτό το " +#~ "πεδίο χρονικής σήμανσης. Ορισμένα προγράμματα, όπως το :program:`gunzip`, " +#~ "χρησιμοποιούν αυτήν τη χρονική σήμανση. Η μορφή της είναι ίδια με την " +#~ "τιμή που επιστρέφει η συνάρτηση :func:`time.time` και το χαρακτηριστικό :" +#~ "attr:`~os.stat_result.st_mtime` του αντικειμένου που επιστρέφει η " +#~ "συνάρτηση :func:`os.stat`." diff --git a/library/hashlib.po b/library/hashlib.po index 9ccfd38f..1f903844 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/hashlib.rst:2 -msgid ":mod:`hashlib` --- Secure hashes and message digests" +msgid ":mod:`!hashlib` --- Secure hashes and message digests" msgstr "" #: library/hashlib.rst:10 @@ -26,26 +27,24 @@ msgstr "" #: library/hashlib.rst:23 msgid "" -"This module implements a common interface to many different secure hash and " -"message digest algorithms. Included are the FIPS secure hash algorithms " -"SHA1, SHA224, SHA256, SHA384, SHA512, (defined in `the FIPS 180-4 " -"standard`_), the SHA-3 series (defined in `the FIPS 202 standard`_) as well " -"as RSA's MD5 algorithm (defined in internet :rfc:`1321`). The terms " -"\"secure hash\" and \"message digest\" are interchangeable. Older " -"algorithms were called message digests. The modern term is secure hash." +"This module implements a common interface to many different hash algorithms. " +"Included are the FIPS secure hash algorithms SHA224, SHA256, SHA384, SHA512, " +"(defined in `the FIPS 180-4 standard`_), the SHA-3 series (defined in `the " +"FIPS 202 standard`_) as well as the legacy algorithms SHA1 (`formerly part " +"of FIPS`_) and the MD5 algorithm (defined in internet :rfc:`1321`)." msgstr "" -#: library/hashlib.rst:33 +#: library/hashlib.rst:31 msgid "" "If you want the adler32 or crc32 hash functions, they are available in the :" "mod:`zlib` module." msgstr "" -#: library/hashlib.rst:40 +#: library/hashlib.rst:38 msgid "Hash algorithms" msgstr "" -#: library/hashlib.rst:42 +#: library/hashlib.rst:40 msgid "" "There is one constructor method named for each type of :dfn:`hash`. All " "return a hash object with the same simple interface. For example: use :func:" @@ -57,14 +56,14 @@ msgid "" "hexdigest>` methods." msgstr "" -#: library/hashlib.rst:50 +#: library/hashlib.rst:48 msgid "" "To allow multithreading, the Python :term:`GIL` is released while computing " "a hash supplied more than 2047 bytes of data at once in its constructor or :" "meth:`.update` method." msgstr "" -#: library/hashlib.rst:57 +#: library/hashlib.rst:55 msgid "" "Constructors for hash algorithms that are always present in this module are :" "func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:" @@ -75,7 +74,7 @@ msgid "" "Python. These correspond to :data:`algorithms_guaranteed`." msgstr "" -#: library/hashlib.rst:65 +#: library/hashlib.rst:63 msgid "" "Additional algorithms may also be available if your Python distribution's :" "mod:`hashlib` was linked against a build of OpenSSL that provides others. " @@ -83,21 +82,21 @@ msgid "" "accessible by name via :func:`new`. See :data:`algorithms_available`." msgstr "" -#: library/hashlib.rst:72 +#: library/hashlib.rst:70 msgid "" "Some algorithms have known hash collision weaknesses (including MD5 and " "SHA1). Refer to `Attacks on cryptographic hash algorithms`_ and the `hashlib-" "seealso`_ section at the end of this document." msgstr "" -#: library/hashlib.rst:76 +#: library/hashlib.rst:74 msgid "" "SHA3 (Keccak) and SHAKE constructors :func:`sha3_224`, :func:`sha3_256`, :" "func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` were " "added. :func:`blake2b` and :func:`blake2s` were added." msgstr "" -#: library/hashlib.rst:84 +#: library/hashlib.rst:82 msgid "" "All hashlib constructors take a keyword-only argument *usedforsecurity* with " "default value ``True``. A false value allows the use of insecure and blocked " @@ -106,36 +105,50 @@ msgid "" "cryptographic one-way compression function." msgstr "" -#: library/hashlib.rst:91 +#: library/hashlib.rst:89 msgid "Hashlib now uses SHA3 and SHAKE from OpenSSL if it provides it." msgstr "" -#: library/hashlib.rst:94 +#: library/hashlib.rst:92 msgid "" "For any of the MD5, SHA1, SHA2, or SHA3 algorithms that the linked OpenSSL " "does not provide we fall back to a verified implementation from the `HACL\\* " "project`_." msgstr "" -#: library/hashlib.rst:100 +#: library/hashlib.rst:98 msgid "Usage" msgstr "" -#: library/hashlib.rst:102 +#: library/hashlib.rst:100 msgid "" "To obtain the digest of the byte string ``b\"Nobody inspects the spammish " "repetition\"``::" msgstr "" -#: library/hashlib.rst:114 +#: library/hashlib.rst:103 +msgid "" +">>> import hashlib\n" +">>> m = hashlib.sha256()\n" +">>> m.update(b\"Nobody inspects\")\n" +">>> m.update(b\" the spammish repetition\")\n" +">>> m.digest()\n" +"b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" +"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +">>> m.hexdigest()\n" +"'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" +msgstr "" + +#: library/hashlib.rst:112 msgid "More condensed:" msgstr "" -#: library/hashlib.rst:120 +#: library/hashlib.rst:118 msgid "Constructors" msgstr "" -#: library/hashlib.rst:124 +#: library/hashlib.rst:122 msgid "" "Is a generic constructor that takes the string *name* of the desired " "algorithm as its first parameter. It also exists to allow access to the " @@ -143,25 +156,25 @@ msgid "" "library may offer." msgstr "" -#: library/hashlib.rst:129 +#: library/hashlib.rst:127 msgid "Using :func:`new` with an algorithm name:" msgstr "" -#: library/hashlib.rst:148 +#: library/hashlib.rst:146 msgid "" "Named constructors such as these are faster than passing an algorithm name " "to :func:`new`." msgstr "" -#: library/hashlib.rst:152 +#: library/hashlib.rst:150 msgid "Attributes" msgstr "" -#: library/hashlib.rst:154 +#: library/hashlib.rst:152 msgid "Hashlib provides the following constant module attributes:" msgstr "" -#: library/hashlib.rst:158 +#: library/hashlib.rst:156 msgid "" "A set containing the names of the hash algorithms guaranteed to be supported " "by this module on all platforms. Note that 'md5' is in this list despite " @@ -169,7 +182,7 @@ msgid "" "excludes it." msgstr "" -#: library/hashlib.rst:167 +#: library/hashlib.rst:165 msgid "" "A set containing the names of the hash algorithms that are available in the " "running Python interpreter. These names will be recognized when passed to :" @@ -178,77 +191,77 @@ msgid "" "(thanks to OpenSSL)." msgstr "" -#: library/hashlib.rst:176 +#: library/hashlib.rst:174 msgid "Hash Objects" msgstr "" -#: library/hashlib.rst:178 +#: library/hashlib.rst:176 msgid "" "The following values are provided as constant attributes of the hash objects " "returned by the constructors:" msgstr "" -#: library/hashlib.rst:183 +#: library/hashlib.rst:181 msgid "The size of the resulting hash in bytes." msgstr "" -#: library/hashlib.rst:187 +#: library/hashlib.rst:185 msgid "The internal block size of the hash algorithm in bytes." msgstr "" -#: library/hashlib.rst:189 +#: library/hashlib.rst:187 msgid "A hash object has the following attributes:" msgstr "" -#: library/hashlib.rst:193 +#: library/hashlib.rst:191 msgid "" "The canonical name of this hash, always lowercase and always suitable as a " "parameter to :func:`new` to create another hash of this type." msgstr "" -#: library/hashlib.rst:196 +#: library/hashlib.rst:194 msgid "" "The name attribute has been present in CPython since its inception, but " "until Python 3.4 was not formally specified, so may not exist on some " "platforms." msgstr "" -#: library/hashlib.rst:201 +#: library/hashlib.rst:199 msgid "A hash object has the following methods:" msgstr "" -#: library/hashlib.rst:206 +#: library/hashlib.rst:204 msgid "" "Update the hash object with the :term:`bytes-like object`. Repeated calls " "are equivalent to a single call with the concatenation of all the arguments: " "``m.update(a); m.update(b)`` is equivalent to ``m.update(a+b)``." msgstr "" -#: library/hashlib.rst:214 +#: library/hashlib.rst:212 msgid "" "Return the digest of the data passed to the :meth:`update` method so far. " "This is a bytes object of size :attr:`digest_size` which may contain bytes " "in the whole range from 0 to 255." msgstr "" -#: library/hashlib.rst:221 +#: library/hashlib.rst:219 msgid "" "Like :meth:`digest` except the digest is returned as a string object of " "double length, containing only hexadecimal digits. This may be used to " "exchange the value safely in email or other non-binary environments." msgstr "" -#: library/hashlib.rst:228 +#: library/hashlib.rst:226 msgid "" "Return a copy (\"clone\") of the hash object. This can be used to " "efficiently compute the digests of data sharing a common initial substring." msgstr "" -#: library/hashlib.rst:233 +#: library/hashlib.rst:231 msgid "SHAKE variable length digests" msgstr "" -#: library/hashlib.rst:238 +#: library/hashlib.rst:236 msgid "" "The :func:`shake_128` and :func:`shake_256` algorithms provide variable " "length digests with length_in_bits//2 up to 128 or 256 bits of security. As " @@ -256,65 +269,77 @@ msgid "" "by the SHAKE algorithm." msgstr "" -#: library/hashlib.rst:245 +#: library/hashlib.rst:243 msgid "" "Return the digest of the data passed to the :meth:`~hash.update` method so " "far. This is a bytes object of size *length* which may contain bytes in the " "whole range from 0 to 255." msgstr "" -#: library/hashlib.rst:252 +#: library/hashlib.rst:250 msgid "" "Like :meth:`digest` except the digest is returned as a string object of " "double length, containing only hexadecimal digits. This may be used to " "exchange the value in email or other non-binary environments." msgstr "" -#: library/hashlib.rst:256 +#: library/hashlib.rst:254 msgid "Example use:" msgstr "" -#: library/hashlib.rst:263 +#: library/hashlib.rst:261 msgid "File hashing" msgstr "" -#: library/hashlib.rst:265 +#: library/hashlib.rst:263 msgid "" "The hashlib module provides a helper function for efficient hashing of a " "file or file-like object." msgstr "" -#: library/hashlib.rst:270 +#: library/hashlib.rst:268 msgid "" "Return a digest object that has been updated with contents of file object." msgstr "" -#: library/hashlib.rst:272 +#: library/hashlib.rst:270 msgid "" "*fileobj* must be a file-like object opened for reading in binary mode. It " "accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` " "instances, SocketIO objects from :meth:`socket.socket.makefile`, and " -"similar. The function may bypass Python's I/O and use the file descriptor " -"from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in " -"an unknown state after this function returns or raises. It is up to the " -"caller to close *fileobj*." +"similar. *fileobj* must be opened in blocking mode, otherwise a :exc:" +"`BlockingIOError` may be raised." msgstr "" -#: library/hashlib.rst:280 +#: library/hashlib.rst:276 +msgid "" +"The function may bypass Python's I/O and use the file descriptor from :meth:" +"`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in an unknown " +"state after this function returns or raises. It is up to the caller to close " +"*fileobj*." +msgstr "" + +#: library/hashlib.rst:281 msgid "" "*digest* must either be a hash algorithm name as a *str*, a hash " "constructor, or a callable that returns a hash object." msgstr "" -#: library/hashlib.rst:283 +#: library/hashlib.rst:284 msgid "Example:" msgstr "" -#: library/hashlib.rst:306 +#: library/hashlib.rst:305 +msgid "" +"Now raises a :exc:`BlockingIOError` if the file is opened in non-blocking " +"mode. Previously, spurious null bytes were added to the digest." +msgstr "" + +#: library/hashlib.rst:311 msgid "Key derivation" msgstr "" -#: library/hashlib.rst:308 +#: library/hashlib.rst:313 msgid "" "Key derivation and key stretching algorithms are designed for secure " "password hashing. Naive algorithms such as ``sha1(password)`` are not " @@ -323,13 +348,13 @@ msgid "" "Salt_%28cryptography%29>`_." msgstr "" -#: library/hashlib.rst:316 +#: library/hashlib.rst:321 msgid "" "The function provides PKCS#5 password-based key derivation function 2. It " "uses HMAC as pseudorandom function." msgstr "" -#: library/hashlib.rst:319 +#: library/hashlib.rst:324 msgid "" "The string *hash_name* is the desired name of the hash digest algorithm for " "HMAC, e.g. 'sha1' or 'sha256'. *password* and *salt* are interpreted as " @@ -338,7 +363,7 @@ msgid "" "proper source, e.g. :func:`os.urandom`." msgstr "" -#: library/hashlib.rst:325 +#: library/hashlib.rst:330 msgid "" "The number of *iterations* should be chosen based on the hash algorithm and " "computing power. As of 2022, hundreds of thousands of iterations of SHA-256 " @@ -347,29 +372,30 @@ msgid "" "the `stackexchange pbkdf2 iterations question`_ explain in detail." msgstr "" -#: library/hashlib.rst:331 +#: library/hashlib.rst:336 msgid "" -"*dklen* is the length of the derived key. If *dklen* is ``None`` then the " -"digest size of the hash algorithm *hash_name* is used, e.g. 64 for SHA-512." +"*dklen* is the length of the derived key in bytes. If *dklen* is ``None`` " +"then the digest size of the hash algorithm *hash_name* is used, e.g. 64 for " +"SHA-512." msgstr "" -#: library/hashlib.rst:340 +#: library/hashlib.rst:345 msgid "Function only available when Python is compiled with OpenSSL." msgstr "" -#: library/hashlib.rst:344 +#: library/hashlib.rst:349 msgid "" "Function now only available when Python is built with OpenSSL. The slow pure " "Python implementation has been removed." msgstr "" -#: library/hashlib.rst:350 +#: library/hashlib.rst:355 msgid "" "The function provides scrypt password-based key derivation function as " "defined in :rfc:`7914`." msgstr "" -#: library/hashlib.rst:353 +#: library/hashlib.rst:358 msgid "" "*password* and *salt* must be :term:`bytes-like objects `. Applications and libraries should limit *password* to a sensible " @@ -377,138 +403,138 @@ msgid "" "source, e.g. :func:`os.urandom`." msgstr "" -#: library/hashlib.rst:358 +#: library/hashlib.rst:363 msgid "" "*n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization " "factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB). " -"*dklen* is the length of the derived key." +"*dklen* is the length of the derived key in bytes." msgstr "" -#: library/hashlib.rst:366 +#: library/hashlib.rst:373 msgid "BLAKE2" msgstr "" -#: library/hashlib.rst:373 +#: library/hashlib.rst:380 msgid "" "BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes " "in two flavors:" msgstr "" -#: library/hashlib.rst:376 +#: library/hashlib.rst:383 msgid "" "**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size " "between 1 and 64 bytes," msgstr "" -#: library/hashlib.rst:379 +#: library/hashlib.rst:386 msgid "" "**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of " "any size between 1 and 32 bytes." msgstr "" -#: library/hashlib.rst:382 +#: library/hashlib.rst:389 msgid "" "BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), " "**salted hashing**, **personalization**, and **tree hashing**." msgstr "" -#: library/hashlib.rst:385 +#: library/hashlib.rst:392 msgid "" "Hash objects from this module follow the API of standard library's :mod:" "`hashlib` objects." msgstr "" -#: library/hashlib.rst:390 +#: library/hashlib.rst:397 msgid "Creating hash objects" msgstr "" -#: library/hashlib.rst:392 +#: library/hashlib.rst:399 msgid "New hash objects are created by calling constructor functions:" msgstr "" -#: library/hashlib.rst:406 +#: library/hashlib.rst:413 msgid "" "These functions return the corresponding hash objects for calculating " "BLAKE2b or BLAKE2s. They optionally take these general parameters:" msgstr "" -#: library/hashlib.rst:409 +#: library/hashlib.rst:416 msgid "" "*data*: initial chunk of data to hash, which must be :term:`bytes-like " "object`. It can be passed only as positional argument." msgstr "" -#: library/hashlib.rst:412 +#: library/hashlib.rst:419 msgid "*digest_size*: size of output digest in bytes." msgstr "" -#: library/hashlib.rst:414 +#: library/hashlib.rst:421 msgid "" "*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for " "BLAKE2s)." msgstr "" -#: library/hashlib.rst:417 +#: library/hashlib.rst:424 msgid "" "*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 " "bytes for BLAKE2s)." msgstr "" -#: library/hashlib.rst:420 +#: library/hashlib.rst:427 msgid "" "*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes " "for BLAKE2s)." msgstr "" -#: library/hashlib.rst:423 +#: library/hashlib.rst:430 msgid "The following table shows limits for general parameters (in bytes):" msgstr "" -#: library/hashlib.rst:426 +#: library/hashlib.rst:433 msgid "Hash" msgstr "" -#: library/hashlib.rst:426 +#: library/hashlib.rst:433 msgid "digest_size" msgstr "" -#: library/hashlib.rst:426 +#: library/hashlib.rst:433 msgid "len(key)" msgstr "" -#: library/hashlib.rst:426 +#: library/hashlib.rst:433 msgid "len(salt)" msgstr "" -#: library/hashlib.rst:426 +#: library/hashlib.rst:433 msgid "len(person)" msgstr "" -#: library/hashlib.rst:428 +#: library/hashlib.rst:435 msgid "BLAKE2b" msgstr "" -#: library/hashlib.rst:428 +#: library/hashlib.rst:435 msgid "64" msgstr "" -#: library/hashlib.rst:428 +#: library/hashlib.rst:435 msgid "16" msgstr "" -#: library/hashlib.rst:429 +#: library/hashlib.rst:436 msgid "BLAKE2s" msgstr "" -#: library/hashlib.rst:429 +#: library/hashlib.rst:436 msgid "32" msgstr "" -#: library/hashlib.rst:429 +#: library/hashlib.rst:436 msgid "8" msgstr "" -#: library/hashlib.rst:434 +#: library/hashlib.rst:441 msgid "" "BLAKE2 specification defines constant lengths for salt and personalization " "parameters, however, for convenience, this implementation accepts byte " @@ -518,94 +544,94 @@ msgid "" "the case for *key*.)" msgstr "" -#: library/hashlib.rst:441 +#: library/hashlib.rst:448 msgid "These sizes are available as module `constants`_ described below." msgstr "" -#: library/hashlib.rst:443 +#: library/hashlib.rst:450 msgid "" "Constructor functions also accept the following tree hashing parameters:" msgstr "" -#: library/hashlib.rst:445 +#: library/hashlib.rst:452 msgid "*fanout*: fanout (0 to 255, 0 if unlimited, 1 in sequential mode)." msgstr "" -#: library/hashlib.rst:447 +#: library/hashlib.rst:454 msgid "" "*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential " "mode)." msgstr "" -#: library/hashlib.rst:450 +#: library/hashlib.rst:457 msgid "" "*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited " "or in sequential mode)." msgstr "" -#: library/hashlib.rst:453 +#: library/hashlib.rst:460 msgid "" "*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` " "for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." msgstr "" -#: library/hashlib.rst:456 +#: library/hashlib.rst:463 msgid "" "*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." msgstr "" -#: library/hashlib.rst:458 +#: library/hashlib.rst:465 msgid "" "*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 " "in sequential mode)." msgstr "" -#: library/hashlib.rst:461 +#: library/hashlib.rst:468 msgid "" "*last_node*: boolean indicating whether the processed node is the last one " "(``False`` for sequential mode)." msgstr "" -#: library/hashlib.rst:-1 +#: library/hashlib.rst:471 msgid "Explanation of tree mode parameters." msgstr "" -#: library/hashlib.rst:468 +#: library/hashlib.rst:475 msgid "" "See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." msgstr "" -#: library/hashlib.rst:474 +#: library/hashlib.rst:481 msgid "Constants" msgstr "" -#: library/hashlib.rst:479 +#: library/hashlib.rst:486 msgid "Salt length (maximum length accepted by constructors)." msgstr "" -#: library/hashlib.rst:485 +#: library/hashlib.rst:492 msgid "" "Personalization string length (maximum length accepted by constructors)." msgstr "" -#: library/hashlib.rst:491 +#: library/hashlib.rst:498 msgid "Maximum key size." msgstr "" -#: library/hashlib.rst:497 +#: library/hashlib.rst:504 msgid "Maximum digest size that the hash function can output." msgstr "" -#: library/hashlib.rst:501 +#: library/hashlib.rst:508 msgid "Examples" msgstr "" -#: library/hashlib.rst:504 +#: library/hashlib.rst:511 msgid "Simple hashing" msgstr "" -#: library/hashlib.rst:506 +#: library/hashlib.rst:513 msgid "" "To calculate hash of some data, you should first construct a hash object by " "calling the appropriate constructor function (:func:`blake2b` or :func:" @@ -614,41 +640,41 @@ msgid "" "`~hash.digest` (or :meth:`~hash.hexdigest` for hex-encoded string)." msgstr "" -#: library/hashlib.rst:519 +#: library/hashlib.rst:526 msgid "" "As a shortcut, you can pass the first chunk of data to update directly to " "the constructor as the positional argument:" msgstr "" -#: library/hashlib.rst:526 +#: library/hashlib.rst:533 msgid "" "You can call :meth:`hash.update` as many times as you need to iteratively " "update the hash:" msgstr "" -#: library/hashlib.rst:540 +#: library/hashlib.rst:547 msgid "Using different digest sizes" msgstr "" -#: library/hashlib.rst:542 +#: library/hashlib.rst:549 msgid "" "BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to " "32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without " "changing the size of output, we can tell BLAKE2b to produce 20-byte digests:" msgstr "" -#: library/hashlib.rst:556 +#: library/hashlib.rst:563 msgid "" "Hash objects with different digest sizes have completely different outputs " "(shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s " "produce different outputs even if the output length is the same:" msgstr "" -#: library/hashlib.rst:572 +#: library/hashlib.rst:579 msgid "Keyed hashing" msgstr "" -#: library/hashlib.rst:574 +#: library/hashlib.rst:581 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " "replacement for `Hash-based message authentication code >> from hashlib import blake2b\n" +">>> h = blake2b(key=b'pseudorandom key', digest_size=16)\n" +">>> h.update(b'message data')\n" +">>> h.hexdigest()\n" +"'3d363ff7401e02026f4a4687d4863ced'" +msgstr "" + +#: library/hashlib.rst:597 +msgid "" "As a practical example, a web application can symmetrically sign cookies " "sent to users and later verify them to make sure they weren't tampered with::" msgstr "" -#: library/hashlib.rst:619 +#: library/hashlib.rst:600 +msgid "" +">>> from hashlib import blake2b\n" +">>> from hmac import compare_digest\n" +">>>\n" +">>> SECRET_KEY = b'pseudorandomly generated server secret key'\n" +">>> AUTH_SIZE = 16\n" +">>>\n" +">>> def sign(cookie):\n" +"... h = blake2b(digest_size=AUTH_SIZE, key=SECRET_KEY)\n" +"... h.update(cookie)\n" +"... return h.hexdigest().encode('utf-8')\n" +">>>\n" +">>> def verify(cookie, sig):\n" +"... good_sig = sign(cookie)\n" +"... return compare_digest(good_sig, sig)\n" +">>>\n" +">>> cookie = b'user-alice'\n" +">>> sig = sign(cookie)\n" +">>> print(\"{0},{1}\".format(cookie.decode('utf-8'), sig))\n" +"user-alice,b'43b3c982cf697e0c5ab22172d1ca7421'\n" +">>> verify(cookie, sig)\n" +"True\n" +">>> verify(b'user-bob', sig)\n" +"False\n" +">>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')\n" +"False" +msgstr "" + +#: library/hashlib.rst:626 msgid "" "Even though there's a native keyed hashing mode, BLAKE2 can, of course, be " "used in HMAC construction with :mod:`hmac` module::" msgstr "" -#: library/hashlib.rst:630 +#: library/hashlib.rst:629 +msgid "" +">>> import hmac, hashlib\n" +">>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n" +">>> m.update(b'message')\n" +">>> m.hexdigest()\n" +"'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'" +msgstr "" + +#: library/hashlib.rst:637 msgid "Randomized hashing" msgstr "" -#: library/hashlib.rst:632 +#: library/hashlib.rst:639 msgid "" "By setting *salt* parameter users can introduce randomization to the hash " "function. Randomized hashing is useful for protecting against collision " "attacks on the hash function used in digital signatures." msgstr "" -#: library/hashlib.rst:636 +#: library/hashlib.rst:643 msgid "" "Randomized hashing is designed for situations where one party, the message " "preparer, generates all or part of a message to be signed by a second party, " @@ -706,19 +779,19 @@ msgid "" "when all portions of the message are prepared by the signer." msgstr "" -#: library/hashlib.rst:655 +#: library/hashlib.rst:662 msgid "" "(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" +"csrc.nist.gov/pubs/sp/800/106/final>`_)" msgstr "" -#: library/hashlib.rst:658 +#: library/hashlib.rst:665 msgid "" "In BLAKE2 the salt is processed as a one-time input to the hash function " "during initialization, rather than as an input to each compression function." msgstr "" -#: library/hashlib.rst:663 +#: library/hashlib.rst:670 msgid "" "*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose " "cryptographic hash function, such as SHA-256, is not suitable for hashing " @@ -726,18 +799,18 @@ msgid "" "information." msgstr "" -#: library/hashlib.rst:686 +#: library/hashlib.rst:693 msgid "Personalization" msgstr "" -#: library/hashlib.rst:688 +#: library/hashlib.rst:695 msgid "" "Sometimes it is useful to force hash function to produce different digests " "for the same input for different purposes. Quoting the authors of the Skein " "hash function:" msgstr "" -#: library/hashlib.rst:692 +#: library/hashlib.rst:699 msgid "" "We recommend that all application designers seriously consider doing this; " "we have seen many protocols where a hash that is computed in one part of the " @@ -747,41 +820,92 @@ msgid "" "hash function used in the protocol summarily stops this type of attack." msgstr "" -#: library/hashlib.rst:699 +#: library/hashlib.rst:706 msgid "" "(`The Skein Hash Function Family `_, p. 21)" msgstr "" -#: library/hashlib.rst:703 +#: library/hashlib.rst:710 msgid "BLAKE2 can be personalized by passing bytes to the *person* argument::" msgstr "" -#: library/hashlib.rst:717 +#: library/hashlib.rst:712 +msgid "" +">>> from hashlib import blake2b\n" +">>> FILES_HASH_PERSON = b'MyApp Files Hash'\n" +">>> BLOCK_HASH_PERSON = b'MyApp Block Hash'\n" +">>> h = blake2b(digest_size=32, person=FILES_HASH_PERSON)\n" +">>> h.update(b'the same content')\n" +">>> h.hexdigest()\n" +"'20d9cd024d4fb086aae819a1432dd2466de12947831b75c5a30cf2676095d3b4'\n" +">>> h = blake2b(digest_size=32, person=BLOCK_HASH_PERSON)\n" +">>> h.update(b'the same content')\n" +">>> h.hexdigest()\n" +"'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'" +msgstr "" + +#: library/hashlib.rst:724 msgid "" "Personalization together with the keyed mode can also be used to derive " "different keys from a single one." msgstr "" -#: library/hashlib.rst:731 +#: library/hashlib.rst:738 msgid "Tree mode" msgstr "" -#: library/hashlib.rst:733 +#: library/hashlib.rst:740 msgid "Here's an example of hashing a minimal tree with two leaf nodes::" msgstr "" -#: library/hashlib.rst:739 +#: library/hashlib.rst:742 +msgid "" +" 10\n" +" / \\\n" +"00 01" +msgstr "" + +#: library/hashlib.rst:746 msgid "" "This example uses 64-byte internal digests, and returns the 32-byte final " "digest::" msgstr "" -#: library/hashlib.rst:769 +#: library/hashlib.rst:749 +msgid "" +">>> from hashlib import blake2b\n" +">>>\n" +">>> FANOUT = 2\n" +">>> DEPTH = 2\n" +">>> LEAF_SIZE = 4096\n" +">>> INNER_SIZE = 64\n" +">>>\n" +">>> buf = bytearray(6000)\n" +">>>\n" +">>> # Left leaf\n" +"... h00 = blake2b(buf[0:LEAF_SIZE], fanout=FANOUT, depth=DEPTH,\n" +"... leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,\n" +"... node_offset=0, node_depth=0, last_node=False)\n" +">>> # Right leaf\n" +"... h01 = blake2b(buf[LEAF_SIZE:], fanout=FANOUT, depth=DEPTH,\n" +"... leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,\n" +"... node_offset=1, node_depth=0, last_node=True)\n" +">>> # Root node\n" +"... h10 = blake2b(digest_size=32, fanout=FANOUT, depth=DEPTH,\n" +"... leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,\n" +"... node_offset=0, node_depth=1, last_node=True)\n" +">>> h10.update(h00.digest())\n" +">>> h10.update(h01.digest())\n" +">>> h10.hexdigest()\n" +"'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'" +msgstr "" + +#: library/hashlib.rst:776 msgid "Credits" msgstr "" -#: library/hashlib.rst:771 +#: library/hashlib.rst:778 msgid "" "BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko " "Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ " @@ -789,118 +913,118 @@ msgid "" "*Raphael C.-W. Phan*." msgstr "" -#: library/hashlib.rst:776 +#: library/hashlib.rst:783 msgid "" "It uses core algorithm from ChaCha_ cipher designed by *Daniel J. " "Bernstein*." msgstr "" -#: library/hashlib.rst:778 +#: library/hashlib.rst:785 msgid "" "The stdlib implementation is based on pyblake2_ module. It was written by " "*Dmitry Chestnykh* based on C implementation written by *Samuel Neves*. The " "documentation was copied from pyblake2_ and written by *Dmitry Chestnykh*." msgstr "" -#: library/hashlib.rst:782 +#: library/hashlib.rst:789 msgid "The C code was partly rewritten for Python by *Christian Heimes*." msgstr "" -#: library/hashlib.rst:784 +#: library/hashlib.rst:791 msgid "" "The following public domain dedication applies for both C hash function " "implementation, extension code, and this documentation:" msgstr "" -#: library/hashlib.rst:787 +#: library/hashlib.rst:794 msgid "" "To the extent possible under law, the author(s) have dedicated all copyright " "and related and neighboring rights to this software to the public domain " "worldwide. This software is distributed without any warranty." msgstr "" -#: library/hashlib.rst:791 +#: library/hashlib.rst:798 msgid "" "You should have received a copy of the CC0 Public Domain Dedication along " "with this software. If not, see https://creativecommons.org/publicdomain/" "zero/1.0/." msgstr "" -#: library/hashlib.rst:795 +#: library/hashlib.rst:802 msgid "" "The following people have helped with development or contributed their " "changes to the project and the public domain according to the Creative " "Commons Public Domain Dedication 1.0 Universal:" msgstr "" -#: library/hashlib.rst:799 +#: library/hashlib.rst:806 msgid "*Alexandr Sokolovskiy*" msgstr "" -#: library/hashlib.rst:820 +#: library/hashlib.rst:827 msgid "Module :mod:`hmac`" msgstr "" -#: library/hashlib.rst:820 +#: library/hashlib.rst:828 msgid "A module to generate message authentication codes using hashes." msgstr "" -#: library/hashlib.rst:823 +#: library/hashlib.rst:830 msgid "Module :mod:`base64`" msgstr "" -#: library/hashlib.rst:823 +#: library/hashlib.rst:831 msgid "Another way to encode binary hashes for non-binary environments." msgstr "" -#: library/hashlib.rst:826 +#: library/hashlib.rst:833 msgid "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" msgstr "" -#: library/hashlib.rst:826 +#: library/hashlib.rst:834 msgid "The FIPS 180-4 publication on Secure Hash Algorithms." msgstr "" -#: library/hashlib.rst:829 -msgid "https://csrc.nist.gov/publications/detail/fips/202/final" +#: library/hashlib.rst:836 +msgid "https://csrc.nist.gov/pubs/fips/202/final" msgstr "" -#: library/hashlib.rst:829 +#: library/hashlib.rst:837 msgid "The FIPS 202 publication on the SHA-3 Standard." msgstr "" -#: library/hashlib.rst:832 +#: library/hashlib.rst:839 msgid "https://www.blake2.net/" msgstr "" -#: library/hashlib.rst:832 +#: library/hashlib.rst:840 msgid "Official BLAKE2 website." msgstr "" -#: library/hashlib.rst:836 +#: library/hashlib.rst:842 msgid "https://en.wikipedia.org/wiki/Cryptographic_hash_function" msgstr "" -#: library/hashlib.rst:835 +#: library/hashlib.rst:843 msgid "" "Wikipedia article with information on which algorithms have known issues and " "what that means regarding their use." msgstr "" -#: library/hashlib.rst:839 +#: library/hashlib.rst:846 msgid "https://www.ietf.org/rfc/rfc8018.txt" msgstr "" -#: library/hashlib.rst:839 +#: library/hashlib.rst:847 msgid "PKCS #5: Password-Based Cryptography Specification Version 2.1" msgstr "" -#: library/hashlib.rst:841 +#: library/hashlib.rst:849 msgid "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" msgstr "" -#: library/hashlib.rst:842 +#: library/hashlib.rst:850 msgid "NIST Recommendation for Password-Based Key Derivation." msgstr "" @@ -914,14 +1038,14 @@ msgid "" "Shake, Blake2" msgstr "" -#: library/hashlib.rst:55 +#: library/hashlib.rst:53 msgid "OpenSSL" msgstr "" -#: library/hashlib.rst:55 +#: library/hashlib.rst:53 msgid "(use in module hashlib)" msgstr "" -#: library/hashlib.rst:370 +#: library/hashlib.rst:377 msgid "blake2b, blake2s" msgstr "" diff --git a/library/heapq.po b/library/heapq.po index e34af524..a865af4e 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/heapq.rst:2 -msgid ":mod:`heapq` --- Heap queue algorithm" +msgid ":mod:`!heapq` --- Heap queue algorithm" msgstr "" #: library/heapq.rst:12 @@ -32,72 +33,103 @@ msgstr "" #: library/heapq.rst:19 msgid "" -"Heaps are binary trees for which every parent node has a value less than or " -"equal to any of its children. This implementation uses arrays for which " -"``heap[k] <= heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k*, " -"counting elements from zero. For the sake of comparison, non-existing " -"elements are considered to be infinite. The interesting property of a heap " -"is that its smallest element is always the root, ``heap[0]``." +"Min-heaps are binary trees for which every parent node has a value less than " +"or equal to any of its children. We refer to this condition as the heap " +"invariant." msgstr "" -#: library/heapq.rst:26 +#: library/heapq.rst:23 msgid "" -"The API below differs from textbook heap algorithms in two aspects: (a) We " -"use zero-based indexing. This makes the relationship between the index for " -"a node and the indexes for its children slightly less obvious, but is more " -"suitable since Python uses zero-based indexing. (b) Our pop method returns " -"the smallest item, not the largest (called a \"min heap\" in textbooks; a " -"\"max heap\" is more common in texts because of its suitability for in-place " -"sorting)." +"For min-heaps, this implementation uses lists for which ``heap[k] <= " +"heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k* for which the " +"compared elements exist. Elements are counted from zero. The interesting " +"property of a min-heap is that its smallest element is always the root, " +"``heap[0]``." msgstr "" -#: library/heapq.rst:33 +#: library/heapq.rst:29 msgid "" -"These two make it possible to view the heap as a regular Python list without " -"surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` maintains " -"the heap invariant!" +"Max-heaps satisfy the reverse invariant: every parent node has a value " +"*greater* than any of its children. These are implemented as lists for " +"which ``maxheap[2*k+1] <= maxheap[k]`` and ``maxheap[2*k+2] <= maxheap[k]`` " +"for all *k* for which the compared elements exist. The root, ``maxheap[0]``, " +"contains the *largest* element; ``heap.sort(reverse=True)`` maintains the " +"max-heap invariant." msgstr "" -#: library/heapq.rst:37 +#: library/heapq.rst:36 msgid "" -"To create a heap, use a list initialized to ``[]``, or you can transform a " -"populated list into a heap via function :func:`heapify`." +"The :mod:`!heapq` API differs from textbook heap algorithms in two aspects: " +"(a) We use zero-based indexing. This makes the relationship between the " +"index for a node and the indexes for its children slightly less obvious, but " +"is more suitable since Python uses zero-based indexing. (b) Textbooks often " +"focus on max-heaps, due to their suitability for in-place sorting. Our " +"implementation favors min-heaps as they better correspond to Python :class:" +"`lists `." msgstr "" -#: library/heapq.rst:40 -msgid "The following functions are provided:" +#: library/heapq.rst:43 +msgid "" +"These two aspects make it possible to view the heap as a regular Python list " +"without surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` " +"maintains the heap invariant!" msgstr "" -#: library/heapq.rst:45 -msgid "Push the value *item* onto the *heap*, maintaining the heap invariant." +#: library/heapq.rst:47 +msgid "" +"Like :meth:`list.sort`, this implementation uses only the ``<`` operator for " +"comparisons, for both min-heaps and max-heaps." msgstr "" #: library/heapq.rst:50 msgid "" -"Pop and return the smallest item from the *heap*, maintaining the heap " +"In the API below, and in this documentation, the unqualified term *heap* " +"generally refers to a min-heap. The API for max-heaps is named using a " +"``_max`` suffix." +msgstr "" + +#: library/heapq.rst:54 +msgid "" +"To create a heap, use a list initialized as ``[]``, or transform an existing " +"list into a min-heap or max-heap using the :func:`heapify` or :func:" +"`heapify_max` functions, respectively." +msgstr "" + +#: library/heapq.rst:58 +msgid "The following functions are provided for min-heaps:" +msgstr "" + +#: library/heapq.rst:63 +msgid "Transform list *x* into a min-heap, in-place, in linear time." +msgstr "" + +#: library/heapq.rst:68 +msgid "" +"Push the value *item* onto the *heap*, maintaining the min-heap invariant." +msgstr "" + +#: library/heapq.rst:73 +msgid "" +"Pop and return the smallest item from the *heap*, maintaining the min-heap " "invariant. If the heap is empty, :exc:`IndexError` is raised. To access " "the smallest item without popping it, use ``heap[0]``." msgstr "" -#: library/heapq.rst:57 +#: library/heapq.rst:80 msgid "" "Push *item* on the heap, then pop and return the smallest item from the " "*heap*. The combined action runs more efficiently than :func:`heappush` " "followed by a separate call to :func:`heappop`." msgstr "" -#: library/heapq.rst:64 -msgid "Transform list *x* into a heap, in-place, in linear time." -msgstr "" - -#: library/heapq.rst:69 +#: library/heapq.rst:87 msgid "" "Pop and return the smallest item from the *heap*, and also push the new " "*item*. The heap size doesn't change. If the heap is empty, :exc:" "`IndexError` is raised." msgstr "" -#: library/heapq.rst:72 +#: library/heapq.rst:90 msgid "" "This one step operation is more efficient than a :func:`heappop` followed " "by :func:`heappush` and can be more appropriate when using a fixed-size " @@ -105,7 +137,7 @@ msgid "" "replaces it with *item*." msgstr "" -#: library/heapq.rst:77 +#: library/heapq.rst:95 msgid "" "The value returned may be larger than the *item* added. If that isn't " "desired, consider using :func:`heappushpop` instead. Its push/pop " @@ -113,37 +145,78 @@ msgid "" "on the heap." msgstr "" -#: library/heapq.rst:83 +#: library/heapq.rst:101 +msgid "For max-heaps, the following functions are provided:" +msgstr "" + +#: library/heapq.rst:106 +msgid "Transform list *x* into a max-heap, in-place, in linear time." +msgstr "" + +#: library/heapq.rst:113 +msgid "" +"Push the value *item* onto the max-heap *heap*, maintaining the max-heap " +"invariant." +msgstr "" + +#: library/heapq.rst:121 +msgid "" +"Pop and return the largest item from the max-heap *heap*, maintaining the " +"max-heap invariant. If the max-heap is empty, :exc:`IndexError` is raised. " +"To access the largest item without popping it, use ``maxheap[0]``." +msgstr "" + +#: library/heapq.rst:130 +msgid "" +"Push *item* on the max-heap *heap*, then pop and return the largest item " +"from *heap*. The combined action runs more efficiently than :func:" +"`heappush_max` followed by a separate call to :func:`heappop_max`." +msgstr "" + +#: library/heapq.rst:140 +msgid "" +"Pop and return the largest item from the max-heap *heap* and also push the " +"new *item*. The max-heap size doesn't change. If the max-heap is empty, :exc:" +"`IndexError` is raised." +msgstr "" + +#: library/heapq.rst:145 +msgid "" +"The value returned may be smaller than the *item* added. Refer to the " +"analogous function :func:`heapreplace` for detailed usage notes." +msgstr "" + +#: library/heapq.rst:151 msgid "The module also offers three general purpose functions based on heaps." msgstr "" -#: library/heapq.rst:88 +#: library/heapq.rst:156 msgid "" "Merge multiple sorted inputs into a single sorted output (for example, merge " "timestamped entries from multiple log files). Returns an :term:`iterator` " "over the sorted values." msgstr "" -#: library/heapq.rst:92 +#: library/heapq.rst:160 msgid "" "Similar to ``sorted(itertools.chain(*iterables))`` but returns an iterable, " "does not pull the data into memory all at once, and assumes that each of the " "input streams is already sorted (smallest to largest)." msgstr "" -#: library/heapq.rst:96 +#: library/heapq.rst:164 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "" -#: library/heapq.rst:98 +#: library/heapq.rst:166 msgid "" "*key* specifies a :term:`key function` of one argument that is used to " "extract a comparison key from each input element. The default value is " "``None`` (compare the elements directly)." msgstr "" -#: library/heapq.rst:102 +#: library/heapq.rst:170 msgid "" "*reverse* is a boolean value. If set to ``True``, then the input elements " "are merged as if each comparison were reversed. To achieve behavior similar " @@ -151,11 +224,11 @@ msgid "" "be sorted from largest to smallest." msgstr "" -#: library/heapq.rst:107 +#: library/heapq.rst:175 msgid "Added the optional *key* and *reverse* parameters." msgstr "" -#: library/heapq.rst:113 +#: library/heapq.rst:181 msgid "" "Return a list with the *n* largest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " @@ -164,7 +237,7 @@ msgid "" "reverse=True)[:n]``." msgstr "" -#: library/heapq.rst:122 +#: library/heapq.rst:190 msgid "" "Return a list with the *n* smallest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " @@ -173,7 +246,7 @@ msgid "" "n]``." msgstr "" -#: library/heapq.rst:128 +#: library/heapq.rst:196 msgid "" "The latter two functions perform best for smaller values of *n*. For larger " "values, it is more efficient to use the :func:`sorted` function. Also, when " @@ -182,64 +255,87 @@ msgid "" "turning the iterable into an actual heap." msgstr "" -#: library/heapq.rst:136 +#: library/heapq.rst:204 msgid "Basic Examples" msgstr "" -#: library/heapq.rst:138 +#: library/heapq.rst:206 msgid "" "A `heapsort `_ can be implemented by " "pushing all values onto a heap and then popping off the smallest values one " "at a time::" msgstr "" -#: library/heapq.rst:151 +#: library/heapq.rst:210 +msgid "" +">>> def heapsort(iterable):\n" +"... h = []\n" +"... for value in iterable:\n" +"... heappush(h, value)\n" +"... return [heappop(h) for i in range(len(h))]\n" +"...\n" +">>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]" +msgstr "" + +#: library/heapq.rst:219 msgid "" "This is similar to ``sorted(iterable)``, but unlike :func:`sorted`, this " "implementation is not stable." msgstr "" -#: library/heapq.rst:154 +#: library/heapq.rst:222 msgid "" "Heap elements can be tuples. This is useful for assigning comparison values " "(such as task priorities) alongside the main record being tracked::" msgstr "" -#: library/heapq.rst:167 +#: library/heapq.rst:225 +msgid "" +">>> h = []\n" +">>> heappush(h, (5, 'write code'))\n" +">>> heappush(h, (7, 'release product'))\n" +">>> heappush(h, (1, 'write spec'))\n" +">>> heappush(h, (3, 'create tests'))\n" +">>> heappop(h)\n" +"(1, 'write spec')" +msgstr "" + +#: library/heapq.rst:235 msgid "Priority Queue Implementation Notes" msgstr "" -#: library/heapq.rst:169 +#: library/heapq.rst:237 msgid "" "A `priority queue `_ is common " "use for a heap, and it presents several implementation challenges:" msgstr "" -#: library/heapq.rst:172 +#: library/heapq.rst:240 msgid "" "Sort stability: how do you get two tasks with equal priorities to be " "returned in the order they were originally added?" msgstr "" -#: library/heapq.rst:175 +#: library/heapq.rst:243 msgid "" "Tuple comparison breaks for (priority, task) pairs if the priorities are " "equal and the tasks do not have a default comparison order." msgstr "" -#: library/heapq.rst:178 +#: library/heapq.rst:246 msgid "" "If the priority of a task changes, how do you move it to a new position in " "the heap?" msgstr "" -#: library/heapq.rst:181 +#: library/heapq.rst:249 msgid "" "Or if a pending task needs to be deleted, how do you find it and remove it " "from the queue?" msgstr "" -#: library/heapq.rst:184 +#: library/heapq.rst:252 msgid "" "A solution to the first two challenges is to store entries as 3-element list " "including the priority, an entry count, and the task. The entry count " @@ -248,32 +344,74 @@ msgid "" "same, the tuple comparison will never attempt to directly compare two tasks." msgstr "" -#: library/heapq.rst:190 +#: library/heapq.rst:258 msgid "" "Another solution to the problem of non-comparable tasks is to create a " "wrapper class that ignores the task item and only compares the priority " "field::" msgstr "" -#: library/heapq.rst:201 +#: library/heapq.rst:261 +msgid "" +"from dataclasses import dataclass, field\n" +"from typing import Any\n" +"\n" +"@dataclass(order=True)\n" +"class PrioritizedItem:\n" +" priority: int\n" +" item: Any=field(compare=False)" +msgstr "" + +#: library/heapq.rst:269 msgid "" "The remaining challenges revolve around finding a pending task and making " "changes to its priority or removing it entirely. Finding a task can be done " "with a dictionary pointing to an entry in the queue." msgstr "" -#: library/heapq.rst:205 +#: library/heapq.rst:273 msgid "" "Removing the entry or changing its priority is more difficult because it " "would break the heap structure invariants. So, a possible solution is to " "mark the entry as removed and add a new entry with the revised priority::" msgstr "" -#: library/heapq.rst:239 +#: library/heapq.rst:277 +msgid "" +"pq = [] # list of entries arranged in a heap\n" +"entry_finder = {} # mapping of tasks to entries\n" +"REMOVED = '' # placeholder for a removed task\n" +"counter = itertools.count() # unique sequence count\n" +"\n" +"def add_task(task, priority=0):\n" +" 'Add a new task or update the priority of an existing task'\n" +" if task in entry_finder:\n" +" remove_task(task)\n" +" count = next(counter)\n" +" entry = [priority, count, task]\n" +" entry_finder[task] = entry\n" +" heappush(pq, entry)\n" +"\n" +"def remove_task(task):\n" +" 'Mark an existing task as REMOVED. Raise KeyError if not found.'\n" +" entry = entry_finder.pop(task)\n" +" entry[-1] = REMOVED\n" +"\n" +"def pop_task():\n" +" 'Remove and return the lowest priority task. Raise KeyError if empty.'\n" +" while pq:\n" +" priority, count, task = heappop(pq)\n" +" if task is not REMOVED:\n" +" del entry_finder[task]\n" +" return task\n" +" raise KeyError('pop from an empty priority queue')" +msgstr "" + +#: library/heapq.rst:307 msgid "Theory" msgstr "" -#: library/heapq.rst:241 +#: library/heapq.rst:309 msgid "" "Heaps are arrays for which ``a[k] <= a[2*k+1]`` and ``a[k] <= a[2*k+2]`` for " "all *k*, counting elements from 0. For the sake of comparison, non-existing " @@ -281,13 +419,26 @@ msgid "" "is that ``a[0]`` is always its smallest element." msgstr "" -#: library/heapq.rst:246 +#: library/heapq.rst:314 msgid "" "The strange invariant above is meant to be an efficient memory " "representation for a tournament. The numbers below are *k*, not ``a[k]``::" msgstr "" -#: library/heapq.rst:259 +#: library/heapq.rst:317 +msgid "" +" 0\n" +"\n" +" 1 2\n" +"\n" +" 3 4 5 6\n" +"\n" +" 7 8 9 10 11 12 13 14\n" +"\n" +"15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30" +msgstr "" + +#: library/heapq.rst:327 msgid "" "In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In a " "usual binary tournament we see in sports, each cell is the winner over the " @@ -300,7 +451,7 @@ msgid "" "over the two topped cells." msgstr "" -#: library/heapq.rst:268 +#: library/heapq.rst:336 msgid "" "If this heap invariant is protected at all time, index 0 is clearly the " "overall winner. The simplest algorithmic way to remove it and find the " @@ -311,7 +462,7 @@ msgid "" "items, you get an *O*\\ (*n* log *n*) sort." msgstr "" -#: library/heapq.rst:275 +#: library/heapq.rst:343 msgid "" "A nice feature of this sort is that you can efficiently insert new items " "while the sort is going on, provided that the inserted items are not " @@ -323,7 +474,7 @@ msgid "" "implementing schedulers (this is what I used for my MIDI sequencer :-)." msgstr "" -#: library/heapq.rst:284 +#: library/heapq.rst:352 msgid "" "Various structures for implementing schedulers have been extensively " "studied, and heaps are good for this, as they are reasonably speedy, the " @@ -332,7 +483,7 @@ msgid "" "efficient overall, yet the worst cases might be terrible." msgstr "" -#: library/heapq.rst:290 +#: library/heapq.rst:358 msgid "" "Heaps are also very useful in big disk sorts. You most probably all know " "that a big sort implies producing \"runs\" (which are pre-sorted sequences, " @@ -346,7 +497,7 @@ msgid "" "input fuzzily ordered." msgstr "" -#: library/heapq.rst:300 +#: library/heapq.rst:368 msgid "" "Moreover, if you output the 0'th item on disk and get an input which may not " "fit in the current tournament (because the value \"wins\" over the last " @@ -357,17 +508,17 @@ msgid "" "switch heaps and start a new run. Clever and quite effective!" msgstr "" -#: library/heapq.rst:308 +#: library/heapq.rst:376 msgid "" "In a word, heaps are useful memory structures to know. I use them in a few " "applications, and I think it is good to keep a 'heap' module around. :-)" msgstr "" -#: library/heapq.rst:312 +#: library/heapq.rst:380 msgid "Footnotes" msgstr "" -#: library/heapq.rst:313 +#: library/heapq.rst:381 msgid "" "The disk balancing algorithms which are current, nowadays, are more annoying " "than clever, and this is a consequence of the seeking capabilities of the " diff --git a/library/hmac.po b/library/hmac.po index 23034bfc..5d7139a6 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/hmac.rst:2 -msgid ":mod:`hmac` --- Keyed-Hashing for Message Authentication" +msgid ":mod:`!hmac` --- Keyed-Hashing for Message Authentication" msgstr "" #: library/hmac.rst:10 @@ -25,10 +26,14 @@ msgid "**Source code:** :source:`Lib/hmac.py`" msgstr "" #: library/hmac.rst:14 -msgid "This module implements the HMAC algorithm as described by :rfc:`2104`." +msgid "" +"This module implements the HMAC algorithm as described by :rfc:`2104`. The " +"interface allows to use any hash function with a *fixed* digest size. In " +"particular, extendable output functions such as SHAKE-128 or SHAKE-256 " +"cannot be used with HMAC." msgstr "" -#: library/hmac.rst:19 +#: library/hmac.rst:22 msgid "" "Return a new hmac object. *key* is a bytes or bytearray object giving the " "secret key. If *msg* is present, the method call ``update(msg)`` is made. " @@ -37,20 +42,20 @@ msgid "" "its argument position, it is required." msgstr "" -#: library/hmac.rst:25 +#: library/hmac.rst:28 msgid "" "Parameter *key* can be a bytes or bytearray object. Parameter *msg* can be " "of any type supported by :mod:`hashlib`. Parameter *digestmod* can be the " "name of a hash algorithm." msgstr "" -#: library/hmac.rst:30 +#: library/hmac.rst:33 msgid "" "The *digestmod* argument is now required. Pass it as a keyword argument to " "avoid awkwardness when you do not have an initial *msg*." msgstr "" -#: library/hmac.rst:37 +#: library/hmac.rst:40 msgid "" "Return digest of *msg* for given secret *key* and *digest*. The function is " "equivalent to ``HMAC(key, msg, digest).digest()``, but uses an optimized C " @@ -59,29 +64,29 @@ msgid "" "`~hmac.new`." msgstr "" -#: library/hmac.rst:43 +#: library/hmac.rst:46 msgid "" "CPython implementation detail, the optimized C implementation is only used " "when *digest* is a string and name of a digest algorithm, which is supported " "by OpenSSL." msgstr "" -#: library/hmac.rst:50 +#: library/hmac.rst:55 msgid "An HMAC object has the following methods:" msgstr "" -#: library/hmac.rst:54 +#: library/hmac.rst:59 msgid "" "Update the hmac object with *msg*. Repeated calls are equivalent to a " "single call with the concatenation of all the arguments: ``m.update(a); m." "update(b)`` is equivalent to ``m.update(a + b)``." msgstr "" -#: library/hmac.rst:58 +#: library/hmac.rst:63 msgid "Parameter *msg* can be of any type supported by :mod:`hashlib`." msgstr "" -#: library/hmac.rst:64 +#: library/hmac.rst:69 msgid "" "Return the digest of the bytes passed to the :meth:`update` method so far. " "This bytes object will be the same length as the *digest_size* of the digest " @@ -89,7 +94,7 @@ msgid "" "bytes." msgstr "" -#: library/hmac.rst:71 +#: library/hmac.rst:76 msgid "" "When comparing the output of :meth:`digest` to an externally supplied digest " "during a verification routine, it is recommended to use the :func:" @@ -97,14 +102,14 @@ msgid "" "vulnerability to timing attacks." msgstr "" -#: library/hmac.rst:79 +#: library/hmac.rst:84 msgid "" "Like :meth:`digest` except the digest is returned as a string twice the " "length containing only hexadecimal digits. This may be used to exchange the " "value safely in email or other non-binary environments." msgstr "" -#: library/hmac.rst:85 +#: library/hmac.rst:90 msgid "" "When comparing the output of :meth:`hexdigest` to an externally supplied " "digest during a verification routine, it is recommended to use the :func:" @@ -112,40 +117,40 @@ msgid "" "vulnerability to timing attacks." msgstr "" -#: library/hmac.rst:93 +#: library/hmac.rst:98 msgid "" "Return a copy (\"clone\") of the hmac object. This can be used to " "efficiently compute the digests of strings that share a common initial " "substring." msgstr "" -#: library/hmac.rst:97 +#: library/hmac.rst:102 msgid "A hash object has the following attributes:" msgstr "" -#: library/hmac.rst:101 +#: library/hmac.rst:106 msgid "The size of the resulting HMAC digest in bytes." msgstr "" -#: library/hmac.rst:105 +#: library/hmac.rst:110 msgid "The internal block size of the hash algorithm in bytes." msgstr "" -#: library/hmac.rst:111 +#: library/hmac.rst:116 msgid "The canonical name of this HMAC, always lowercase, e.g. ``hmac-md5``." msgstr "" -#: library/hmac.rst:116 +#: library/hmac.rst:121 msgid "" "Removed the undocumented attributes ``HMAC.digest_cons``, ``HMAC.inner``, " "and ``HMAC.outer``." msgstr "" -#: library/hmac.rst:120 +#: library/hmac.rst:125 msgid "This module also provides the following helper function:" msgstr "" -#: library/hmac.rst:124 +#: library/hmac.rst:129 msgid "" "Return ``a == b``. This function uses an approach designed to prevent " "timing analysis by avoiding content-based short circuiting behaviour, making " @@ -154,22 +159,22 @@ msgid "" "hexdigest`), or a :term:`bytes-like object`." msgstr "" -#: library/hmac.rst:132 +#: library/hmac.rst:137 msgid "" "If *a* and *b* are of different lengths, or if an error occurs, a timing " "attack could theoretically reveal information about the types and lengths of " "*a* and *b*—but not their values." msgstr "" -#: library/hmac.rst:140 +#: library/hmac.rst:145 msgid "" "The function uses OpenSSL's ``CRYPTO_memcmp()`` internally when available." msgstr "" -#: library/hmac.rst:146 +#: library/hmac.rst:151 msgid "Module :mod:`hashlib`" msgstr "" -#: library/hmac.rst:147 +#: library/hmac.rst:152 msgid "The Python module providing secure hash functions." msgstr "" diff --git a/library/html.entities.po b/library/html.entities.po index 086f2d79..658e4724 100644 --- a/library/html.entities.po +++ b/library/html.entities.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/html.entities.rst:2 -msgid ":mod:`html.entities` --- Definitions of HTML general entities" +msgid ":mod:`!html.entities` --- Definitions of HTML general entities" msgstr "" #: library/html.entities.rst:9 diff --git a/library/html.parser.po b/library/html.parser.po index 5ba8339a..b833bbc2 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/html.parser.rst:2 -msgid ":mod:`html.parser` --- Simple HTML and XHTML parser" +msgid ":mod:`!html.parser` --- Simple HTML and XHTML parser" msgstr "" #: library/html.parser.rst:7 @@ -37,65 +38,111 @@ msgstr "" #: library/html.parser.rst:22 msgid "" -"If *convert_charrefs* is ``True`` (the default), all character references " -"(except the ones in ``script``/``style`` elements) are automatically " -"converted to the corresponding Unicode characters." +"If *convert_charrefs* is true (the default), all character references " +"(except the ones in elements like ``script`` and ``style``) are " +"automatically converted to the corresponding Unicode characters." msgstr "" #: library/html.parser.rst:26 msgid "" +"If *scripting* is false (the default), the content of the ``noscript`` " +"element is parsed normally; if it's true, it's returned as is without being " +"parsed." +msgstr "" + +#: library/html.parser.rst:30 +msgid "" "An :class:`.HTMLParser` instance is fed HTML data and calls handler methods " "when start tags, end tags, text, comments, and other markup elements are " "encountered. The user should subclass :class:`.HTMLParser` and override its " "methods to implement the desired behavior." msgstr "" -#: library/html.parser.rst:31 +#: library/html.parser.rst:35 msgid "" "This parser does not check that end tags match start tags or call the end-" "tag handler for elements which are closed implicitly by closing an outer " "element." msgstr "" -#: library/html.parser.rst:34 +#: library/html.parser.rst:38 msgid "*convert_charrefs* keyword argument added." msgstr "" -#: library/html.parser.rst:37 +#: library/html.parser.rst:41 msgid "The default value for argument *convert_charrefs* is now ``True``." msgstr "" -#: library/html.parser.rst:42 +#: library/html.parser.rst:44 +msgid "Added the *scripting* parameter." +msgstr "" + +#: library/html.parser.rst:49 msgid "Example HTML Parser Application" msgstr "" -#: library/html.parser.rst:44 +#: library/html.parser.rst:51 msgid "" "As a basic example, below is a simple HTML parser that uses the :class:" "`HTMLParser` class to print out start tags, end tags, and data as they are " -"encountered::" +"encountered:" +msgstr "" + +#: library/html.parser.rst:55 +msgid "" +"from html.parser import HTMLParser\n" +"\n" +"class MyHTMLParser(HTMLParser):\n" +" def handle_starttag(self, tag, attrs):\n" +" print(\"Encountered a start tag:\", tag)\n" +"\n" +" def handle_endtag(self, tag):\n" +" print(\"Encountered an end tag :\", tag)\n" +"\n" +" def handle_data(self, data):\n" +" print(\"Encountered some data :\", data)\n" +"\n" +"parser = MyHTMLParser()\n" +"parser.feed('Test'\n" +" '

Parse me!

')" msgstr "" -#: library/html.parser.rst:64 +#: library/html.parser.rst:73 msgid "The output will then be:" msgstr "" -#: library/html.parser.rst:83 +#: library/html.parser.rst:75 +msgid "" +"Encountered a start tag: html\n" +"Encountered a start tag: head\n" +"Encountered a start tag: title\n" +"Encountered some data : Test\n" +"Encountered an end tag : title\n" +"Encountered an end tag : head\n" +"Encountered a start tag: body\n" +"Encountered a start tag: h1\n" +"Encountered some data : Parse me!\n" +"Encountered an end tag : h1\n" +"Encountered an end tag : body\n" +"Encountered an end tag : html" +msgstr "" + +#: library/html.parser.rst:92 msgid ":class:`.HTMLParser` Methods" msgstr "" -#: library/html.parser.rst:85 +#: library/html.parser.rst:94 msgid ":class:`HTMLParser` instances have the following methods:" msgstr "" -#: library/html.parser.rst:90 +#: library/html.parser.rst:99 msgid "" "Feed some text to the parser. It is processed insofar as it consists of " "complete elements; incomplete data is buffered until more data is fed or :" "meth:`close` is called. *data* must be :class:`str`." msgstr "" -#: library/html.parser.rst:97 +#: library/html.parser.rst:106 msgid "" "Force processing of all buffered data as if it were followed by an end-of-" "file mark. This method may be redefined by a derived class to define " @@ -103,17 +150,17 @@ msgid "" "should always call the :class:`HTMLParser` base class method :meth:`close`." msgstr "" -#: library/html.parser.rst:105 +#: library/html.parser.rst:114 msgid "" "Reset the instance. Loses all unprocessed data. This is called implicitly " "at instantiation time." msgstr "" -#: library/html.parser.rst:111 +#: library/html.parser.rst:120 msgid "Return current line number and offset." msgstr "" -#: library/html.parser.rst:116 +#: library/html.parser.rst:125 msgid "" "Return the text of the most recently opened start tag. This should not " "normally be needed for structured processing, but may be useful in dealing " @@ -121,7 +168,7 @@ msgid "" "(whitespace between attributes can be preserved, etc.)." msgstr "" -#: library/html.parser.rst:122 +#: library/html.parser.rst:131 msgid "" "The following methods are called when data or markup elements are " "encountered and they are meant to be overridden in a subclass. The base " @@ -129,13 +176,13 @@ msgid "" "handle_startendtag`):" msgstr "" -#: library/html.parser.rst:129 +#: library/html.parser.rst:138 msgid "" "This method is called to handle the start tag of an element (e.g. ``
``)." msgstr "" -#: library/html.parser.rst:131 +#: library/html.parser.rst:140 msgid "" "The *tag* argument is the name of the tag converted to lower case. The " "*attrs* argument is a list of ``(name, value)`` pairs containing the " @@ -144,29 +191,29 @@ msgid "" "character and entity references have been replaced." msgstr "" -#: library/html.parser.rst:137 +#: library/html.parser.rst:146 msgid "" "For instance, for the tag ````, this method " "would be called as ``handle_starttag('a', [('href', 'https://www.cwi." "nl/')])``." msgstr "" -#: library/html.parser.rst:140 +#: library/html.parser.rst:149 msgid "" "All entity references from :mod:`html.entities` are replaced in the " "attribute values." msgstr "" -#: library/html.parser.rst:146 +#: library/html.parser.rst:155 msgid "" "This method is called to handle the end tag of an element (e.g. ``
``)." msgstr "" -#: library/html.parser.rst:148 +#: library/html.parser.rst:157 msgid "The *tag* argument is the name of the tag converted to lower case." msgstr "" -#: library/html.parser.rst:153 +#: library/html.parser.rst:162 msgid "" "Similar to :meth:`handle_starttag`, but called when the parser encounters an " "XHTML-style empty tag (````). This method may be overridden by " @@ -175,41 +222,41 @@ msgid "" "`handle_endtag`." msgstr "" -#: library/html.parser.rst:161 +#: library/html.parser.rst:170 msgid "" "This method is called to process arbitrary data (e.g. text nodes and the " -"content of ```` and ````)." +"content of elements like ``script`` and ``style``)." msgstr "" -#: library/html.parser.rst:167 +#: library/html.parser.rst:176 msgid "" "This method is called to process a named character reference of the form " "``&name;`` (e.g. ``>``), where *name* is a general entity reference (e.g. " -"``'gt'``). This method is never called if *convert_charrefs* is ``True``." +"``'gt'``). This method is only called if *convert_charrefs* is false." msgstr "" -#: library/html.parser.rst:175 +#: library/html.parser.rst:184 msgid "" "This method is called to process decimal and hexadecimal numeric character " "references of the form :samp:`&#{NNN};` and :samp:`&#x{NNN};`. For example, " "the decimal equivalent for ``>`` is ``>``, whereas the hexadecimal is " -"``>``; in this case the method will receive ``'62'`` or ``'x3E'``. " -"This method is never called if *convert_charrefs* is ``True``." +"``>``; in this case the method will receive ``'62'`` or ``'x3E'``. This " +"method is only called if *convert_charrefs* is false." msgstr "" -#: library/html.parser.rst:184 +#: library/html.parser.rst:193 msgid "" "This method is called when a comment is encountered (e.g. ```` will cause this method to be " "called with the argument ``' comment '``." msgstr "" -#: library/html.parser.rst:189 +#: library/html.parser.rst:198 msgid "" "The content of Internet Explorer conditional comments (condcoms) will also " "be sent to this method, so, for ``'\n" +"... '')\n" +"Comment : a comment\n" +"Comment : [if IE 9]>IE-specific content'``)::" +"correct char (note: these 3 references are all equivalent to ``'>'``):" +msgstr "" + +#: library/html.parser.rst:332 +msgid "" +">>> parser = MyHTMLParser()\n" +">>> parser.feed('>>>')\n" +"Data : >>>\n" +"\n" +">>> parser = MyHTMLParser(convert_charrefs=False)\n" +">>> parser.feed('>>>')\n" +"Named ent: >\n" +"Num ent : >\n" +"Num ent : >" msgstr "" -#: library/html.parser.rst:318 +#: library/html.parser.rst:344 msgid "" "Feeding incomplete chunks to :meth:`~HTMLParser.feed` works, but :meth:" -"`~HTMLParser.handle_data` might be called more than once (unless " -"*convert_charrefs* is set to ``True``)::" +"`~HTMLParser.handle_data` might be called more than once if " +"*convert_charrefs* is false:" msgstr "" -#: library/html.parser.rst:331 -msgid "Parsing invalid HTML (e.g. unquoted attributes) also works::" +#: library/html.parser.rst:348 +msgid "" +">>> for chunk in ['buff', 'ered', ' text']:\n" +"... parser.feed(chunk)\n" +"...\n" +"Start tag: span\n" +"Data : buff\n" +"Data : ered\n" +"Data : text\n" +"End tag : span" +msgstr "" + +#: library/html.parser.rst:359 +msgid "Parsing invalid HTML (e.g. unquoted attributes) also works:" +msgstr "" + +#: library/html.parser.rst:361 +msgid "" +">>> parser.feed('

tag soup

')\n" +"Start tag: p\n" +"Start tag: a\n" +" attr: ('class', 'link')\n" +" attr: ('href', '#main')\n" +"Data : tag soup\n" +"End tag : p\n" +"End tag : a" msgstr "" #: library/html.parser.rst:9 diff --git a/library/html.po b/library/html.po index 9b94ba2d..ea91e297 100644 --- a/library/html.po +++ b/library/html.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/html.rst:2 -msgid ":mod:`html` --- HyperText Markup Language support" +msgid ":mod:`!html` --- HyperText Markup Language support" msgstr "" #: library/html.rst:7 @@ -32,12 +33,14 @@ msgstr "" msgid "" "Convert the characters ``&``, ``<`` and ``>`` in string *s* to HTML-safe " "sequences. Use this if you need to display text that might contain such " -"characters in HTML. If the optional flag *quote* is true, the characters " -"(``\"``) and (``'``) are also translated; this helps for inclusion in an " -"HTML attribute value delimited by quotes, as in ````." +"characters in HTML. If the optional flag *quote* is true (the default), the " +"characters (``\"``) and (``'``) are also translated; this helps for " +"inclusion in an HTML attribute value delimited by quotes, as in ````. If *quote* is set to false, the characters (``\"``) and " +"(``'``) are not translated." msgstr "" -#: library/html.rst:26 +#: library/html.rst:29 msgid "" "Convert all named and numeric character references (e.g. ``>``, ``>" "``, ``>``) in the string *s* to the corresponding Unicode characters. " @@ -46,14 +49,14 @@ msgid "" "character references `." msgstr "" -#: library/html.rst:36 +#: library/html.rst:39 msgid "Submodules in the ``html`` package are:" msgstr "" -#: library/html.rst:38 +#: library/html.rst:41 msgid ":mod:`html.parser` -- HTML/XHTML parser with lenient parsing mode" msgstr "" -#: library/html.rst:39 +#: library/html.rst:42 msgid ":mod:`html.entities` -- HTML entity definitions" msgstr "" diff --git a/library/http.client.po b/library/http.client.po index 2c8a4683..8a64f8b0 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/http.client.rst:2 -msgid ":mod:`http.client` --- HTTP protocol client" +msgid ":mod:`!http.client` --- HTTP protocol client" msgstr "" #: library/http.client.rst:7 @@ -44,14 +45,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/http.client.rst:33 @@ -78,6 +78,14 @@ msgid "" "server at the same host and port::" msgstr "" +#: library/http.client.rst:54 +msgid "" +">>> h1 = http.client.HTTPConnection('www.python.org')\n" +">>> h2 = http.client.HTTPConnection('www.python.org:80')\n" +">>> h3 = http.client.HTTPConnection('www.python.org', 80)\n" +">>> h4 = http.client.HTTPConnection('www.python.org', 80, timeout=10)" +msgstr "" + #: library/http.client.rst:59 msgid "*source_address* was added." msgstr "" @@ -167,7 +175,7 @@ msgstr "" msgid "" "Parse the headers from a file pointer *fp* representing a HTTP request/" "response. The file has to be a :class:`~io.BufferedIOBase` reader (i.e. not " -"text) and must provide a valid :rfc:`2822` style header." +"text) and must provide a valid :rfc:`5322` style header." msgstr "" #: library/http.client.rst:130 @@ -329,6 +337,17 @@ msgid "" "For example, to perform a ``GET`` request to ``https://docs.python.org/3/``::" msgstr "" +#: library/http.client.rst:299 +msgid "" +">>> import http.client\n" +">>> host = \"docs.python.org\"\n" +">>> conn = http.client.HTTPSConnection(host)\n" +">>> conn.request(\"GET\", \"/3/\", headers={\"Host\": host})\n" +">>> response = conn.getresponse()\n" +">>> print(response.status, response.reason)\n" +"200 OK" +msgstr "" + #: library/http.client.rst:308 msgid "" "Chunked transfer encoding has been added to the HTTP protocol version 1.1. " @@ -413,6 +432,14 @@ msgid "" "the :meth:`~HTTPConnection.set_tunnel` method::" msgstr "" +#: library/http.client.rst:374 +msgid "" +">>> import http.client\n" +">>> conn = http.client.HTTPSConnection(\"localhost\", 8080)\n" +">>> conn.set_tunnel(\"www.python.org\")\n" +">>> conn.request(\"HEAD\",\"/index.html\")" +msgstr "" + #: library/http.client.rst:381 msgid "" "HTTP CONNECT tunnelling requests use protocol HTTP/1.1, upgraded from " @@ -438,7 +465,7 @@ msgid "" "already have a connection." msgstr "" -#: library/http.client.rst:415 +#: library/http.client.rst:404 msgid "" "Raises an :ref:`auditing event ` ``http.client.connect`` with " "arguments ``self``, ``host``, ``port``." @@ -515,7 +542,7 @@ msgid "" "`endheaders` method has been called and before :meth:`getresponse` is called." msgstr "" -#: library/http.client.rst:485 +#: library/http.client.rst:474 msgid "" "Raises an :ref:`auditing event ` ``http.client.send`` with " "arguments ``self``, ``data``." @@ -626,16 +653,76 @@ msgstr "" msgid "Here is an example session that uses the ``GET`` method::" msgstr "" +#: library/http.client.rst:573 +msgid "" +">>> import http.client\n" +">>> conn = http.client.HTTPSConnection(\"www.python.org\")\n" +">>> conn.request(\"GET\", \"/\")\n" +">>> r1 = conn.getresponse()\n" +">>> print(r1.status, r1.reason)\n" +"200 OK\n" +">>> data1 = r1.read() # This will return entire content.\n" +">>> # The following example demonstrates reading data in chunks.\n" +">>> conn.request(\"GET\", \"/\")\n" +">>> r1 = conn.getresponse()\n" +">>> while chunk := r1.read(200):\n" +"... print(repr(chunk))\n" +"b'\\n 10 11 12 13 14 ...``" +#: library/itertools.rst:39 +msgid "``count(10) → 10 11 12 13 14 ...``" msgstr "" -#: library/itertools.rst:45 +#: library/itertools.rst:40 msgid ":func:`cycle`" msgstr "" -#: library/itertools.rst:45 +#: library/itertools.rst:40 msgid "p" msgstr "" -#: library/itertools.rst:45 +#: library/itertools.rst:40 msgid "p0, p1, ... plast, p0, p1, ..." msgstr "" -#: library/itertools.rst:45 -msgid "``cycle('ABCD') --> A B C D A B C D ...``" +#: library/itertools.rst:40 +msgid "``cycle('ABCD') → A B C D A B C D ...``" msgstr "" -#: library/itertools.rst:46 +#: library/itertools.rst:41 msgid ":func:`repeat`" msgstr "" -#: library/itertools.rst:46 +#: library/itertools.rst:41 msgid "elem [,n]" msgstr "" -#: library/itertools.rst:46 +#: library/itertools.rst:41 msgid "elem, elem, elem, ... endlessly or up to n times" msgstr "" -#: library/itertools.rst:46 -msgid "``repeat(10, 3) --> 10 10 10``" +#: library/itertools.rst:41 +msgid "``repeat(10, 3) → 10 10 10``" msgstr "" -#: library/itertools.rst:49 +#: library/itertools.rst:44 msgid "**Iterators terminating on the shortest input sequence:**" msgstr "" -#: library/itertools.rst:54 +#: library/itertools.rst:49 msgid ":func:`accumulate`" msgstr "" -#: library/itertools.rst:54 +#: library/itertools.rst:49 msgid "p [,func]" msgstr "" -#: library/itertools.rst:54 +#: library/itertools.rst:49 msgid "p0, p0+p1, p0+p1+p2, ..." msgstr "" -#: library/itertools.rst:54 -msgid "``accumulate([1,2,3,4,5]) --> 1 3 6 10 15``" +#: library/itertools.rst:49 +msgid "``accumulate([1,2,3,4,5]) → 1 3 6 10 15``" msgstr "" -#: library/itertools.rst:55 +#: library/itertools.rst:50 msgid ":func:`batched`" msgstr "" -#: library/itertools.rst:55 +#: library/itertools.rst:50 msgid "p, n" msgstr "" -#: library/itertools.rst:55 +#: library/itertools.rst:50 msgid "(p0, p1, ..., p_n-1), ..." msgstr "" -#: library/itertools.rst:55 -msgid "``batched('ABCDEFG', n=3) --> ABC DEF G``" +#: library/itertools.rst:50 +msgid "``batched('ABCDEFG', n=2) → AB CD EF G``" msgstr "" -#: library/itertools.rst:56 +#: library/itertools.rst:51 msgid ":func:`chain`" msgstr "" -#: library/itertools.rst:67 +#: library/itertools.rst:62 msgid "p, q, ..." msgstr "" -#: library/itertools.rst:57 +#: library/itertools.rst:52 msgid "p0, p1, ... plast, q0, q1, ..." msgstr "" -#: library/itertools.rst:56 -msgid "``chain('ABC', 'DEF') --> A B C D E F``" +#: library/itertools.rst:51 +msgid "``chain('ABC', 'DEF') → A B C D E F``" msgstr "" -#: library/itertools.rst:57 +#: library/itertools.rst:52 msgid ":func:`chain.from_iterable`" msgstr "" -#: library/itertools.rst:63 +#: library/itertools.rst:58 msgid "iterable" msgstr "" -#: library/itertools.rst:57 -msgid "``chain.from_iterable(['ABC', 'DEF']) --> A B C D E F``" +#: library/itertools.rst:52 +msgid "``chain.from_iterable(['ABC', 'DEF']) → A B C D E F``" msgstr "" -#: library/itertools.rst:58 +#: library/itertools.rst:53 msgid ":func:`compress`" msgstr "" -#: library/itertools.rst:58 +#: library/itertools.rst:53 msgid "data, selectors" msgstr "" -#: library/itertools.rst:58 +#: library/itertools.rst:53 msgid "(d[0] if s[0]), (d[1] if s[1]), ..." msgstr "" -#: library/itertools.rst:58 -msgid "``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F``" +#: library/itertools.rst:53 +msgid "``compress('ABCDEF', [1,0,1,0,1,1]) → A C E F``" msgstr "" -#: library/itertools.rst:59 +#: library/itertools.rst:54 msgid ":func:`dropwhile`" msgstr "" -#: library/itertools.rst:60 library/itertools.rst:65 +#: library/itertools.rst:55 library/itertools.rst:60 msgid "predicate, seq" msgstr "" -#: library/itertools.rst:59 +#: library/itertools.rst:54 msgid "seq[n], seq[n+1], starting when predicate fails" msgstr "" -#: library/itertools.rst:59 -msgid "``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``" +#: library/itertools.rst:54 +msgid "``dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8``" msgstr "" -#: library/itertools.rst:60 +#: library/itertools.rst:55 msgid ":func:`filterfalse`" msgstr "" -#: library/itertools.rst:60 +#: library/itertools.rst:55 msgid "elements of seq where predicate(elem) fails" msgstr "" -#: library/itertools.rst:60 -msgid "``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``" +#: library/itertools.rst:55 +msgid "``filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8``" msgstr "" -#: library/itertools.rst:61 +#: library/itertools.rst:56 msgid ":func:`groupby`" msgstr "" -#: library/itertools.rst:61 +#: library/itertools.rst:56 msgid "iterable[, key]" msgstr "" -#: library/itertools.rst:61 +#: library/itertools.rst:56 msgid "sub-iterators grouped by value of key(v)" msgstr "" -#: library/itertools.rst:62 +#: library/itertools.rst:56 +msgid "``groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)``" +msgstr "" + +#: library/itertools.rst:57 msgid ":func:`islice`" msgstr "" -#: library/itertools.rst:62 +#: library/itertools.rst:57 msgid "seq, [start,] stop [, step]" msgstr "" -#: library/itertools.rst:62 +#: library/itertools.rst:57 msgid "elements from seq[start:stop:step]" msgstr "" -#: library/itertools.rst:62 -msgid "``islice('ABCDEFG', 2, None) --> C D E F G``" +#: library/itertools.rst:57 +msgid "``islice('ABCDEFG', 2, None) → C D E F G``" msgstr "" -#: library/itertools.rst:63 +#: library/itertools.rst:58 msgid ":func:`pairwise`" msgstr "" -#: library/itertools.rst:63 +#: library/itertools.rst:58 msgid "(p[0], p[1]), (p[1], p[2])" msgstr "" -#: library/itertools.rst:63 -msgid "``pairwise('ABCDEFG') --> AB BC CD DE EF FG``" +#: library/itertools.rst:58 +msgid "``pairwise('ABCDEFG') → AB BC CD DE EF FG``" msgstr "" -#: library/itertools.rst:64 +#: library/itertools.rst:59 msgid ":func:`starmap`" msgstr "" -#: library/itertools.rst:64 +#: library/itertools.rst:59 msgid "func, seq" msgstr "" -#: library/itertools.rst:64 +#: library/itertools.rst:59 msgid "func(\\*seq[0]), func(\\*seq[1]), ..." msgstr "" -#: library/itertools.rst:64 -msgid "``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``" +#: library/itertools.rst:59 +msgid "``starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000``" msgstr "" -#: library/itertools.rst:65 +#: library/itertools.rst:60 msgid ":func:`takewhile`" msgstr "" -#: library/itertools.rst:65 +#: library/itertools.rst:60 msgid "seq[0], seq[1], until predicate fails" msgstr "" -#: library/itertools.rst:65 -msgid "``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``" +#: library/itertools.rst:60 +msgid "``takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4``" msgstr "" -#: library/itertools.rst:66 +#: library/itertools.rst:61 msgid ":func:`tee`" msgstr "" -#: library/itertools.rst:66 +#: library/itertools.rst:61 msgid "it, n" msgstr "" -#: library/itertools.rst:66 +#: library/itertools.rst:61 msgid "it1, it2, ... itn splits one iterator into n" msgstr "" -#: library/itertools.rst:67 +#: library/itertools.rst:61 +msgid "``tee('ABC', 2) → A B C, A B C``" +msgstr "" + +#: library/itertools.rst:62 msgid ":func:`zip_longest`" msgstr "" -#: library/itertools.rst:67 +#: library/itertools.rst:62 msgid "(p[0], q[0]), (p[1], q[1]), ..." msgstr "" -#: library/itertools.rst:67 -msgid "``zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``" +#: library/itertools.rst:62 +msgid "``zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-``" msgstr "" -#: library/itertools.rst:70 +#: library/itertools.rst:65 msgid "**Combinatoric iterators:**" msgstr "" -#: library/itertools.rst:75 +#: library/itertools.rst:70 msgid ":func:`product`" msgstr "" -#: library/itertools.rst:75 +#: library/itertools.rst:70 msgid "p, q, ... [repeat=1]" msgstr "" -#: library/itertools.rst:75 +#: library/itertools.rst:70 msgid "cartesian product, equivalent to a nested for-loop" msgstr "" -#: library/itertools.rst:76 +#: library/itertools.rst:71 msgid ":func:`permutations`" msgstr "" -#: library/itertools.rst:76 +#: library/itertools.rst:71 msgid "p[, r]" msgstr "" -#: library/itertools.rst:76 +#: library/itertools.rst:71 msgid "r-length tuples, all possible orderings, no repeated elements" msgstr "" -#: library/itertools.rst:77 +#: library/itertools.rst:72 msgid ":func:`combinations`" msgstr "" -#: library/itertools.rst:78 +#: library/itertools.rst:73 msgid "p, r" msgstr "" -#: library/itertools.rst:77 +#: library/itertools.rst:72 msgid "r-length tuples, in sorted order, no repeated elements" msgstr "" -#: library/itertools.rst:78 +#: library/itertools.rst:73 msgid ":func:`combinations_with_replacement`" msgstr "" -#: library/itertools.rst:78 +#: library/itertools.rst:73 msgid "r-length tuples, in sorted order, with repeated elements" msgstr "" -#: library/itertools.rst:82 +#: library/itertools.rst:77 msgid "Examples" msgstr "" -#: library/itertools.rst:84 +#: library/itertools.rst:79 msgid "``product('ABCD', repeat=2)``" msgstr "" -#: library/itertools.rst:84 +#: library/itertools.rst:79 msgid "``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``" msgstr "" -#: library/itertools.rst:85 +#: library/itertools.rst:80 msgid "``permutations('ABCD', 2)``" msgstr "" -#: library/itertools.rst:85 +#: library/itertools.rst:80 msgid "``AB AC AD BA BC BD CA CB CD DA DB DC``" msgstr "" -#: library/itertools.rst:86 +#: library/itertools.rst:81 msgid "``combinations('ABCD', 2)``" msgstr "" -#: library/itertools.rst:86 +#: library/itertools.rst:81 msgid "``AB AC AD BC BD CD``" msgstr "" -#: library/itertools.rst:87 -msgid "``combinations_with_replacement('ABCD', 2)``" +#: library/itertools.rst:82 +msgid "``combinations_with_replacement('ABCD', 2)``" msgstr "" -#: library/itertools.rst:87 +#: library/itertools.rst:82 msgid "``AA AB AC AD BB BC BD CC CD DD``" msgstr "" -#: library/itertools.rst:94 +#: library/itertools.rst:89 msgid "Itertool Functions" msgstr "" -#: library/itertools.rst:96 +#: library/itertools.rst:91 msgid "" -"The following module functions all construct and return iterators. Some " -"provide streams of infinite length, so they should only be accessed by " -"functions or loops that truncate the stream." +"The following functions all construct and return iterators. Some provide " +"streams of infinite length, so they should only be accessed by functions or " +"loops that truncate the stream." msgstr "" -#: library/itertools.rst:102 +#: library/itertools.rst:98 msgid "" -"Make an iterator that returns accumulated sums, or accumulated results of " -"other binary functions (specified via the optional *func* argument)." +"Make an iterator that returns accumulated sums or accumulated results from " +"other binary functions." msgstr "" -#: library/itertools.rst:106 +#: library/itertools.rst:101 msgid "" -"If *func* is supplied, it should be a function of two arguments. Elements of " -"the input *iterable* may be any type that can be accepted as arguments to " -"*func*. (For example, with the default operation of addition, elements may " -"be any addable type including :class:`~decimal.Decimal` or :class:" -"`~fractions.Fraction`.)" +"The *function* defaults to addition. The *function* should accept two " +"arguments, an accumulated total and a value from the *iterable*." msgstr "" -#: library/itertools.rst:113 +#: library/itertools.rst:104 msgid "" -"Usually, the number of elements output matches the input iterable. However, " -"if the keyword argument *initial* is provided, the accumulation leads off " -"with the *initial* value so that the output has one more element than the " -"input iterable." +"If an *initial* value is provided, the accumulation will start with that " +"value and the output will have one more element than the input iterable." msgstr "" -#: library/itertools.rst:191 library/itertools.rst:291 -#: library/itertools.rst:527 library/itertools.rst:634 +#: library/itertools.rst:181 library/itertools.rst:283 +#: library/itertools.rst:519 library/itertools.rst:632 +#: library/itertools.rst:774 msgid "Roughly equivalent to::" msgstr "" -#: library/itertools.rst:137 +#: library/itertools.rst:110 +msgid "" +"def accumulate(iterable, function=operator.add, *, initial=None):\n" +" 'Return running totals'\n" +" # accumulate([1,2,3,4,5]) → 1 3 6 10 15\n" +" # accumulate([1,2,3,4,5], initial=100) → 100 101 103 106 110 115\n" +" # accumulate([1,2,3,4,5], operator.mul) → 1 2 6 24 120\n" +"\n" +" iterator = iter(iterable)\n" +" total = initial\n" +" if initial is None:\n" +" try:\n" +" total = next(iterator)\n" +" except StopIteration:\n" +" return\n" +"\n" +" yield total\n" +" for element in iterator:\n" +" total = function(total, element)\n" +" yield total" +msgstr "" + +#: library/itertools.rst:129 +msgid "" +"To compute a running minimum, set *function* to :func:`min`. For a running " +"maximum, set *function* to :func:`max`. Or for a running product, set " +"*function* to :func:`operator.mul`. To build an `amortization table `_, accumulate the " +"interest and apply payments:" +msgstr "" + +#: library/itertools.rst:136 msgid "" -"There are a number of uses for the *func* argument. It can be set to :func:" -"`min` for a running minimum, :func:`max` for a running maximum, or :func:" -"`operator.mul` for a running product. Amortization tables can be built by " -"accumulating interest and applying payments:" +">>> data = [3, 4, 6, 2, 1, 9, 0, 7, 5, 8]\n" +">>> list(accumulate(data, max)) # running maximum\n" +"[3, 4, 6, 6, 6, 9, 9, 9, 9, 9]\n" +">>> list(accumulate(data, operator.mul)) # running product\n" +"[3, 12, 72, 144, 144, 1296, 0, 0, 0, 0]\n" +"\n" +"# Amortize a 5% loan of 1000 with 10 annual payments of 90\n" +">>> update = lambda balance, payment: round(balance * 1.05) - payment\n" +">>> list(accumulate(repeat(90, 10), update, initial=1_000))\n" +"[1000, 960, 918, 874, 828, 779, 728, 674, 618, 559, 497]" msgstr "" -#: library/itertools.rst:155 +#: library/itertools.rst:149 msgid "" "See :func:`functools.reduce` for a similar function that returns only the " "final accumulated value." msgstr "" -#: library/itertools.rst:160 -msgid "Added the optional *func* parameter." +#: library/itertools.rst:154 +msgid "Added the optional *function* parameter." msgstr "" -#: library/itertools.rst:163 +#: library/itertools.rst:157 msgid "Added the optional *initial* parameter." msgstr "" -#: library/itertools.rst:169 +#: library/itertools.rst:163 msgid "" "Batch data from the *iterable* into tuples of length *n*. The last batch may " "be shorter than *n*." msgstr "" -#: library/itertools.rst:172 +#: library/itertools.rst:166 +msgid "" +"If *strict* is true, will raise a :exc:`ValueError` if the final batch is " +"shorter than *n*." +msgstr "" + +#: library/itertools.rst:169 msgid "" "Loops over the input iterable and accumulates data into tuples up to size " "*n*. The input is consumed lazily, just enough to fill a batch. The result " @@ -478,132 +518,282 @@ msgid "" "exhausted:" msgstr "" -#: library/itertools.rst:206 +#: library/itertools.rst:174 +msgid "" +">>> flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']\n" +">>> unflattened = list(batched(flattened_data, 2))\n" +">>> unflattened\n" +"[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]" +msgstr "" + +#: library/itertools.rst:183 +msgid "" +"def batched(iterable, n, *, strict=False):\n" +" # batched('ABCDEFG', 2) → AB CD EF G\n" +" if n < 1:\n" +" raise ValueError('n must be at least one')\n" +" iterator = iter(iterable)\n" +" while batch := tuple(islice(iterator, n)):\n" +" if strict and len(batch) != n:\n" +" raise ValueError('batched(): incomplete batch')\n" +" yield batch" +msgstr "" + +#: library/itertools.rst:195 +msgid "Added the *strict* option." +msgstr "" + +#: library/itertools.rst:201 msgid "" "Make an iterator that returns elements from the first iterable until it is " "exhausted, then proceeds to the next iterable, until all of the iterables " -"are exhausted. Used for treating consecutive sequences as a single " -"sequence. Roughly equivalent to::" +"are exhausted. This combines multiple data sources into a single iterator. " +"Roughly equivalent to::" +msgstr "" + +#: library/itertools.rst:206 +msgid "" +"def chain(*iterables):\n" +" # chain('ABC', 'DEF') → A B C D E F\n" +" for iterable in iterables:\n" +" yield from iterable" msgstr "" -#: library/itertools.rst:220 +#: library/itertools.rst:214 msgid "" "Alternate constructor for :func:`chain`. Gets chained inputs from a single " "iterable argument that is evaluated lazily. Roughly equivalent to::" msgstr "" -#: library/itertools.rst:232 +#: library/itertools.rst:217 +msgid "" +"def from_iterable(iterables):\n" +" # chain.from_iterable(['ABC', 'DEF']) → A B C D E F\n" +" for iterable in iterables:\n" +" yield from iterable" +msgstr "" + +#: library/itertools.rst:225 msgid "Return *r* length subsequences of elements from the input *iterable*." msgstr "" -#: library/itertools.rst:283 +#: library/itertools.rst:227 +msgid "" +"The output is a subsequence of :func:`product` keeping only entries that are " +"subsequences of the *iterable*. The length of the output is given by :func:" +"`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero " +"when ``r > n``." +msgstr "" + +#: library/itertools.rst:232 msgid "" -"The combination tuples are emitted in lexicographic ordering according to " -"the order of the input *iterable*. So, if the input *iterable* is sorted, " -"the output tuples will be produced in sorted order." +"The combination tuples are emitted in lexicographic order according to the " +"order of the input *iterable*. If the input *iterable* is sorted, the output " +"tuples will be produced in sorted order." msgstr "" -#: library/itertools.rst:238 +#: library/itertools.rst:236 msgid "" "Elements are treated as unique based on their position, not on their value. " -"So if the input elements are unique, there will be no repeated values in " +"If the input elements are unique, there will be no repeated values within " "each combination." msgstr "" -#: library/itertools.rst:264 +#: library/itertools.rst:242 +msgid "" +"def combinations(iterable, r):\n" +" # combinations('ABCD', 2) → AB AC AD BC BD CD\n" +" # combinations(range(4), 3) → 012 013 023 123\n" +"\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" if r > n:\n" +" return\n" +" indices = list(range(r))\n" +"\n" +" yield tuple(pool[i] for i in indices)\n" +" while True:\n" +" for i in reversed(range(r)):\n" +" if indices[i] != i + n - r:\n" +" break\n" +" else:\n" +" return\n" +" indices[i] += 1\n" +" for j in range(i+1, r):\n" +" indices[j] = indices[j-1] + 1\n" +" yield tuple(pool[i] for i in indices)" +msgstr "" + +#: library/itertools.rst:267 msgid "" -"The code for :func:`combinations` can be also expressed as a subsequence of :" -"func:`permutations` after filtering entries where the elements are not in " -"sorted order (according to their position in the input pool)::" +"Return *r* length subsequences of elements from the input *iterable* " +"allowing individual elements to be repeated more than once." msgstr "" -#: library/itertools.rst:275 +#: library/itertools.rst:270 msgid "" -"The number of items returned is ``n! / r! / (n-r)!`` when ``0 <= r <= n`` or " -"zero when ``r > n``." +"The output is a subsequence of :func:`product` that keeps only entries that " +"are subsequences (with possible repeated elements) of the *iterable*. The " +"number of subsequence returned is ``(n + r - 1)! / r! / (n - 1)!`` when ``n " +"> 0``." msgstr "" -#: library/itertools.rst:280 +#: library/itertools.rst:275 msgid "" -"Return *r* length subsequences of elements from the input *iterable* " -"allowing individual elements to be repeated more than once." +"The combination tuples are emitted in lexicographic order according to the " +"order of the input *iterable*. if the input *iterable* is sorted, the output " +"tuples will be produced in sorted order." msgstr "" -#: library/itertools.rst:287 +#: library/itertools.rst:279 msgid "" "Elements are treated as unique based on their position, not on their value. " -"So if the input elements are unique, the generated combinations will also be " +"If the input elements are unique, the generated combinations will also be " "unique." msgstr "" -#: library/itertools.rst:310 +#: library/itertools.rst:285 msgid "" -"The code for :func:`combinations_with_replacement` can be also expressed as " -"a subsequence of :func:`product` after filtering entries where the elements " -"are not in sorted order (according to their position in the input pool)::" +"def combinations_with_replacement(iterable, r):\n" +" # combinations_with_replacement('ABC', 2) → AA AB AC BB BC CC\n" +"\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" if not n and r:\n" +" return\n" +" indices = [0] * r\n" +"\n" +" yield tuple(pool[i] for i in indices)\n" +" while True:\n" +" for i in reversed(range(r)):\n" +" if indices[i] != n - 1:\n" +" break\n" +" else:\n" +" return\n" +" indices[i:] = [indices[i] + 1] * (r - i)\n" +" yield tuple(pool[i] for i in indices)" msgstr "" -#: library/itertools.rst:321 +#: library/itertools.rst:309 msgid "" -"The number of items returned is ``(n+r-1)! / r! / (n-1)!`` when ``n > 0``." +"Make an iterator that returns elements from *data* where the corresponding " +"element in *selectors* is true. Stops when either the *data* or *selectors* " +"iterables have been exhausted. Roughly equivalent to::" msgstr "" -#: library/itertools.rst:328 +#: library/itertools.rst:314 msgid "" -"Make an iterator that filters elements from *data* returning only those that " -"have a corresponding element in *selectors* that evaluates to ``True``. " -"Stops when either the *data* or *selectors* iterables has been exhausted. " -"Roughly equivalent to::" +"def compress(data, selectors):\n" +" # compress('ABCDEF', [1,0,1,0,1,1]) → A C E F\n" +" return (datum for datum, selector in zip(data, selectors) if selector)" msgstr "" -#: library/itertools.rst:342 +#: library/itertools.rst:323 msgid "" -"Make an iterator that returns evenly spaced values starting with number " -"*start*. Often used as an argument to :func:`map` to generate consecutive " -"data points. Also, used with :func:`zip` to add sequence numbers. Roughly " -"equivalent to::" +"Make an iterator that returns evenly spaced values beginning with *start*. " +"Can be used with :func:`map` to generate consecutive data points or with :" +"func:`zip` to add sequence numbers. Roughly equivalent to::" +msgstr "" + +#: library/itertools.rst:328 +msgid "" +"def count(start=0, step=1):\n" +" # count(10) → 10 11 12 13 14 ...\n" +" # count(2.5, 0.5) → 2.5 3.0 3.5 ...\n" +" n = start\n" +" while True:\n" +" yield n\n" +" n += step" msgstr "" -#: library/itertools.rst:354 +#: library/itertools.rst:336 msgid "" -"When counting with floating point numbers, better accuracy can sometimes be " +"When counting with floating-point numbers, better accuracy can sometimes be " "achieved by substituting multiplicative code such as: ``(start + step * i " "for i in count())``." msgstr "" -#: library/itertools.rst:358 +#: library/itertools.rst:340 msgid "Added *step* argument and allowed non-integer arguments." msgstr "" -#: library/itertools.rst:363 +#: library/itertools.rst:346 msgid "" -"Make an iterator returning elements from the iterable and saving a copy of " -"each. When the iterable is exhausted, return elements from the saved copy. " +"Make an iterator returning elements from the *iterable* and saving a copy of " +"each. When the iterable is exhausted, return elements from the saved copy. " "Repeats indefinitely. Roughly equivalent to::" msgstr "" -#: library/itertools.rst:377 +#: library/itertools.rst:350 msgid "" -"Note, this member of the toolkit may require significant auxiliary storage " -"(depending on the length of the iterable)." +"def cycle(iterable):\n" +" # cycle('ABCD') → A B C D A B C D A B C D ...\n" +"\n" +" saved = []\n" +" for element in iterable:\n" +" yield element\n" +" saved.append(element)\n" +"\n" +" while saved:\n" +" for element in saved:\n" +" yield element" +msgstr "" + +#: library/itertools.rst:362 +msgid "" +"This itertool may require significant auxiliary storage (depending on the " +"length of the iterable)." +msgstr "" + +#: library/itertools.rst:368 +msgid "" +"Make an iterator that drops elements from the *iterable* while the " +"*predicate* is true and afterwards returns every element. Roughly " +"equivalent to::" msgstr "" -#: library/itertools.rst:383 +#: library/itertools.rst:372 msgid "" -"Make an iterator that drops elements from the iterable as long as the " -"predicate is true; afterwards, returns every element. Note, the iterator " -"does not produce *any* output until the predicate first becomes false, so it " -"may have a lengthy start-up time. Roughly equivalent to::" +"def dropwhile(predicate, iterable):\n" +" # dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8\n" +"\n" +" iterator = iter(iterable)\n" +" for x in iterator:\n" +" if not predicate(x):\n" +" yield x\n" +" break\n" +"\n" +" for x in iterator:\n" +" yield x" msgstr "" -#: library/itertools.rst:400 +#: library/itertools.rst:384 msgid "" -"Make an iterator that filters elements from iterable returning only those " -"for which the predicate is false. If *predicate* is ``None``, return the " -"items that are false. Roughly equivalent to::" +"Note this does not produce *any* output until the predicate first becomes " +"false, so this itertool may have a lengthy start-up time." msgstr "" -#: library/itertools.rst:415 +#: library/itertools.rst:390 +msgid "" +"Make an iterator that filters elements from the *iterable* returning only " +"those for which the *predicate* returns a false value. If *predicate* is " +"``None``, returns the items that are false. Roughly equivalent to::" +msgstr "" + +#: library/itertools.rst:395 +msgid "" +"def filterfalse(predicate, iterable):\n" +" # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8\n" +"\n" +" if predicate is None:\n" +" predicate = bool\n" +"\n" +" for x in iterable:\n" +" if not predicate(x):\n" +" yield x" +msgstr "" + +#: library/itertools.rst:408 msgid "" "Make an iterator that returns consecutive keys and groups from the " "*iterable*. The *key* is a function computing a key value for each element. " @@ -612,7 +802,7 @@ msgid "" "sorted on the same key function." msgstr "" -#: library/itertools.rst:421 +#: library/itertools.rst:414 msgid "" "The operation of :func:`groupby` is similar to the ``uniq`` filter in Unix. " "It generates a break or new group every time the value of the key function " @@ -621,7 +811,7 @@ msgid "" "aggregates common elements regardless of their input order." msgstr "" -#: library/itertools.rst:427 +#: library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " "with :func:`groupby`. Because the source is shared, when the :func:" @@ -629,95 +819,213 @@ msgid "" "if that data is needed later, it should be stored as a list::" msgstr "" -#: library/itertools.rst:439 +#: library/itertools.rst:425 +msgid "" +"groups = []\n" +"uniquekeys = []\n" +"data = sorted(data, key=keyfunc)\n" +"for k, g in groupby(data, keyfunc):\n" +" groups.append(list(g)) # Store group iterator as a list\n" +" uniquekeys.append(k)" +msgstr "" + +#: library/itertools.rst:432 msgid ":func:`groupby` is roughly equivalent to::" msgstr "" -#: library/itertools.rst:476 +#: library/itertools.rst:434 msgid "" -"Make an iterator that returns selected elements from the iterable. If " -"*start* is non-zero, then elements from the iterable are skipped until start " -"is reached. Afterward, elements are returned consecutively unless *step* is " -"set higher than one which results in items being skipped. If *stop* is " -"``None``, then iteration continues until the iterator is exhausted, if at " -"all; otherwise, it stops at the specified position." +"def groupby(iterable, key=None):\n" +" # [k for k, g in groupby('AAAABBBCCDAABBB')] → A B C D A B\n" +" # [list(g) for k, g in groupby('AAAABBBCCD')] → AAAA BBB CC D\n" +"\n" +" keyfunc = (lambda x: x) if key is None else key\n" +" iterator = iter(iterable)\n" +" exhausted = False\n" +"\n" +" def _grouper(target_key):\n" +" nonlocal curr_value, curr_key, exhausted\n" +" yield curr_value\n" +" for curr_value in iterator:\n" +" curr_key = keyfunc(curr_value)\n" +" if curr_key != target_key:\n" +" return\n" +" yield curr_value\n" +" exhausted = True\n" +"\n" +" try:\n" +" curr_value = next(iterator)\n" +" except StopIteration:\n" +" return\n" +" curr_key = keyfunc(curr_value)\n" +"\n" +" while not exhausted:\n" +" target_key = curr_key\n" +" curr_group = _grouper(target_key)\n" +" yield curr_key, curr_group\n" +" if curr_key == target_key:\n" +" for _ in curr_group:\n" +" pass" msgstr "" -#: library/itertools.rst:483 +#: library/itertools.rst:470 msgid "" -"If *start* is ``None``, then iteration starts at zero. If *step* is " -"``None``, then the step defaults to one." +"Make an iterator that returns selected elements from the iterable. Works " +"like sequence slicing but does not support negative values for *start*, " +"*stop*, or *step*." msgstr "" -#: library/itertools.rst:486 +#: library/itertools.rst:474 msgid "" -"Unlike regular slicing, :func:`islice` does not support negative values for " -"*start*, *stop*, or *step*. Can be used to extract related fields from data " -"where the internal structure has been flattened (for example, a multi-line " -"report may list a name field on every third line)." +"If *start* is zero or ``None``, iteration starts at zero. Otherwise, " +"elements from the iterable are skipped until *start* is reached." msgstr "" -#: library/itertools.rst:521 -msgid "Return successive overlapping pairs taken from the input *iterable*." +#: library/itertools.rst:477 +msgid "" +"If *stop* is ``None``, iteration continues until the input is exhausted, if " +"at all. Otherwise, it stops at the specified position." msgstr "" -#: library/itertools.rst:523 +#: library/itertools.rst:480 msgid "" -"The number of 2-tuples in the output iterator will be one fewer than the " -"number of inputs. It will be empty if the input iterable has fewer than two " -"values." +"If *step* is ``None``, the step defaults to one. Elements are returned " +"consecutively unless *step* is set higher than one which results in items " +"being skipped." msgstr "" -#: library/itertools.rst:540 +#: library/itertools.rst:486 msgid "" -"Return successive *r* length permutations of elements in the *iterable*." +"def islice(iterable, *args):\n" +" # islice('ABCDEFG', 2) → A B\n" +" # islice('ABCDEFG', 2, 4) → C D\n" +" # islice('ABCDEFG', 2, None) → C D E F G\n" +" # islice('ABCDEFG', 0, None, 2) → A C E G\n" +"\n" +" s = slice(*args)\n" +" start = 0 if s.start is None else s.start\n" +" stop = s.stop\n" +" step = 1 if s.step is None else s.step\n" +" if start < 0 or (stop is not None and stop < 0) or step <= 0:\n" +" raise ValueError\n" +"\n" +" indices = count() if stop is None else range(max(start, stop))\n" +" next_i = start\n" +" for i, element in zip(indices, iterable):\n" +" if i == next_i:\n" +" yield element\n" +" next_i += step" +msgstr "" + +#: library/itertools.rst:506 +msgid "" +"If the input is an iterator, then fully consuming the *islice* advances the " +"input iterator by ``max(start, stop)`` steps regardless of the *step* value." +msgstr "" + +#: library/itertools.rst:513 +msgid "Return successive overlapping pairs taken from the input *iterable*." msgstr "" -#: library/itertools.rst:542 +#: library/itertools.rst:515 msgid "" -"If *r* is not specified or is ``None``, then *r* defaults to the length of " -"the *iterable* and all possible full-length permutations are generated." +"The number of 2-tuples in the output iterator will be one fewer than the " +"number of inputs. It will be empty if the input iterable has fewer than two " +"values." msgstr "" -#: library/itertools.rst:546 +#: library/itertools.rst:521 msgid "" -"The permutation tuples are emitted in lexicographic order according to the " -"order of the input *iterable*. So, if the input *iterable* is sorted, the " -"output tuples will be produced in sorted order." +"def pairwise(iterable):\n" +" # pairwise('ABCDEFG') → AB BC CD DE EF FG\n" +"\n" +" iterator = iter(iterable)\n" +" a = next(iterator, None)\n" +"\n" +" for b in iterator:\n" +" yield a, b\n" +" a = b" msgstr "" -#: library/itertools.rst:550 +#: library/itertools.rst:536 msgid "" -"Elements are treated as unique based on their position, not on their value. " -"So if the input elements are unique, there will be no repeated values within " -"a permutation." +"Return successive *r* length `permutations of elements `_ from the *iterable*." msgstr "" -#: library/itertools.rst:581 +#: library/itertools.rst:539 msgid "" -"The code for :func:`permutations` can be also expressed as a subsequence of :" -"func:`product`, filtered to exclude entries with repeated elements (those " -"from the same position in the input pool)::" +"If *r* is not specified or is ``None``, then *r* defaults to the length of " +"the *iterable* and all possible full-length permutations are generated." msgstr "" -#: library/itertools.rst:593 +#: library/itertools.rst:543 msgid "" -"The number of items returned is ``n! / (n-r)!`` when ``0 <= r <= n`` or zero " -"when ``r > n``." +"The output is a subsequence of :func:`product` where entries with repeated " +"elements have been filtered out. The length of the output is given by :func:" +"`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when " +"``r > n``." msgstr "" -#: library/itertools.rst:598 -msgid "Cartesian product of input iterables." +#: library/itertools.rst:548 +msgid "" +"The permutation tuples are emitted in lexicographic order according to the " +"order of the input *iterable*. If the input *iterable* is sorted, the " +"output tuples will be produced in sorted order." msgstr "" -#: library/itertools.rst:600 +#: library/itertools.rst:552 +msgid "" +"Elements are treated as unique based on their position, not on their value. " +"If the input elements are unique, there will be no repeated values within a " +"permutation." +msgstr "" + +#: library/itertools.rst:558 +msgid "" +"def permutations(iterable, r=None):\n" +" # permutations('ABCD', 2) → AB AC AD BA BC BD CA CB CD DA DB DC\n" +" # permutations(range(3)) → 012 021 102 120 201 210\n" +"\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" r = n if r is None else r\n" +" if r > n:\n" +" return\n" +"\n" +" indices = list(range(n))\n" +" cycles = list(range(n, n-r, -1))\n" +" yield tuple(pool[i] for i in indices[:r])\n" +"\n" +" while n:\n" +" for i in reversed(range(r)):\n" +" cycles[i] -= 1\n" +" if cycles[i] == 0:\n" +" indices[i:] = indices[i+1:] + indices[i:i+1]\n" +" cycles[i] = n - i\n" +" else:\n" +" j = cycles[i]\n" +" indices[i], indices[-j] = indices[-j], indices[i]\n" +" yield tuple(pool[i] for i in indices[:r])\n" +" break\n" +" else:\n" +" return" +msgstr "" + +#: library/itertools.rst:589 +msgid "" +"`Cartesian product `_ of " +"the input iterables." +msgstr "" + +#: library/itertools.rst:592 msgid "" "Roughly equivalent to nested for-loops in a generator expression. For " "example, ``product(A, B)`` returns the same as ``((x,y) for x in A for y in " "B)``." msgstr "" -#: library/itertools.rst:603 +#: library/itertools.rst:595 msgid "" "The nested loops cycle like an odometer with the rightmost element advancing " "on every iteration. This pattern creates a lexicographic ordering so that " @@ -725,95 +1033,203 @@ msgid "" "sorted order." msgstr "" -#: library/itertools.rst:608 +#: library/itertools.rst:600 msgid "" "To compute the product of an iterable with itself, specify the number of " "repetitions with the optional *repeat* keyword argument. For example, " "``product(A, repeat=4)`` means the same as ``product(A, A, A, A)``." msgstr "" -#: library/itertools.rst:612 +#: library/itertools.rst:604 msgid "" "This function is roughly equivalent to the following code, except that the " "actual implementation does not build up intermediate results in memory::" msgstr "" -#: library/itertools.rst:625 +#: library/itertools.rst:607 +msgid "" +"def product(*iterables, repeat=1):\n" +" # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy\n" +" # product(range(2), repeat=3) → 000 001 010 011 100 101 110 111\n" +"\n" +" if repeat < 0:\n" +" raise ValueError('repeat argument cannot be negative')\n" +" pools = [tuple(pool) for pool in iterables] * repeat\n" +"\n" +" result = [[]]\n" +" for pool in pools:\n" +" result = [x+[y] for x in result for y in pool]\n" +"\n" +" for prod in result:\n" +" yield tuple(prod)" +msgstr "" + +#: library/itertools.rst:622 msgid "" "Before :func:`product` runs, it completely consumes the input iterables, " "keeping pools of values in memory to generate the products. Accordingly, it " "is only useful with finite inputs." msgstr "" -#: library/itertools.rst:631 +#: library/itertools.rst:629 msgid "" "Make an iterator that returns *object* over and over again. Runs " "indefinitely unless the *times* argument is specified." msgstr "" -#: library/itertools.rst:645 +#: library/itertools.rst:634 +msgid "" +"def repeat(object, times=None):\n" +" # repeat(10, 3) → 10 10 10\n" +" if times is None:\n" +" while True:\n" +" yield object\n" +" else:\n" +" for i in range(times):\n" +" yield object" +msgstr "" + +#: library/itertools.rst:643 msgid "" "A common use for *repeat* is to supply a stream of constant values to *map* " "or *zip*:" msgstr "" -#: library/itertools.rst:655 +#: library/itertools.rst:646 msgid "" -"Make an iterator that computes the function using arguments obtained from " -"the iterable. Used instead of :func:`map` when argument parameters are " -"already grouped in tuples from a single iterable (when the data has been " -"\"pre-zipped\")." +">>> list(map(pow, range(10), repeat(2)))\n" +"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" msgstr "" -#: library/itertools.rst:660 +#: library/itertools.rst:654 +msgid "" +"Make an iterator that computes the *function* using arguments obtained from " +"the *iterable*. Used instead of :func:`map` when argument parameters have " +"already been \"pre-zipped\" into tuples." +msgstr "" + +#: library/itertools.rst:658 msgid "" "The difference between :func:`map` and :func:`starmap` parallels the " "distinction between ``function(a,b)`` and ``function(*c)``. Roughly " "equivalent to::" msgstr "" -#: library/itertools.rst:672 +#: library/itertools.rst:662 msgid "" -"Make an iterator that returns elements from the iterable as long as the " -"predicate is true. Roughly equivalent to::" +"def starmap(function, iterable):\n" +" # starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000\n" +" for args in iterable:\n" +" yield function(*args)" msgstr "" -#: library/itertools.rst:683 +#: library/itertools.rst:670 msgid "" -"Note, the element that first fails the predicate condition is consumed from " -"the input iterator and there is no way to access it. This could be an issue " -"if an application wants to further consume the input iterator after " -"takewhile has been run to exhaustion. To work around this problem, consider " -"using `more-iterools before_and_after() `_ instead." +"Make an iterator that returns elements from the *iterable* as long as the " +"*predicate* is true. Roughly equivalent to::" msgstr "" -#: library/itertools.rst:694 -msgid "Return *n* independent iterators from a single iterable." +#: library/itertools.rst:673 +msgid "" +"def takewhile(predicate, iterable):\n" +" # takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4\n" +" for x in iterable:\n" +" if not predicate(x):\n" +" break\n" +" yield x" msgstr "" -#: library/itertools.rst:696 +#: library/itertools.rst:680 msgid "" -"The following Python code helps explain what *tee* does (although the actual " -"implementation is more complex and uses only a single underlying :abbr:`FIFO " -"(first-in, first-out)` queue)::" +"Note, the element that first fails the predicate condition is consumed from " +"the input iterator and there is no way to access it. This could be an issue " +"if an application wants to further consume the input iterator after " +"*takewhile* has been run to exhaustion. To work around this problem, " +"consider using `more-itertools before_and_after() `_ instead." msgstr "" -#: library/itertools.rst:715 -msgid "" -"Once a :func:`tee` has been created, the original *iterable* should not be " -"used anywhere else; otherwise, the *iterable* could get advanced without the " -"tee objects being informed." +#: library/itertools.rst:691 +msgid "Return *n* independent iterators from a single iterable." msgstr "" -#: library/itertools.rst:719 +#: library/itertools.rst:695 +msgid "" +"def tee(iterable, n=2):\n" +" if n < 0:\n" +" raise ValueError\n" +" if n == 0:\n" +" return ()\n" +" iterator = _tee(iterable)\n" +" result = [iterator]\n" +" for _ in range(n - 1):\n" +" result.append(_tee(iterator))\n" +" return tuple(result)\n" +"\n" +"class _tee:\n" +"\n" +" def __init__(self, iterable):\n" +" it = iter(iterable)\n" +" if isinstance(it, _tee):\n" +" self.iterator = it.iterator\n" +" self.link = it.link\n" +" else:\n" +" self.iterator = it\n" +" self.link = [None, None]\n" +"\n" +" def __iter__(self):\n" +" return self\n" +"\n" +" def __next__(self):\n" +" link = self.link\n" +" if link[1] is None:\n" +" link[0] = next(self.iterator)\n" +" link[1] = [None, None]\n" +" value, self.link = link\n" +" return value" +msgstr "" + +#: library/itertools.rst:728 +msgid "" +"When the input *iterable* is already a tee iterator object, all members of " +"the return tuple are constructed as if they had been produced by the " +"upstream :func:`tee` call. This \"flattening step\" allows nested :func:" +"`tee` calls to share the same underlying data chain and to have a single " +"update step rather than a chain of calls." +msgstr "" + +#: library/itertools.rst:734 +msgid "The flattening property makes tee iterators efficiently peekable:" +msgstr "" + +#: library/itertools.rst:736 +msgid "" +"def lookahead(tee_iterator):\n" +" \"Return the next value without moving the input forward\"\n" +" [forked_iterator] = tee(tee_iterator, 1)\n" +" return next(forked_iterator)" +msgstr "" + +#: library/itertools.rst:743 +msgid "" +">>> iterator = iter('abcdef')\n" +">>> [iterator] = tee(iterator, 1) # Make the input peekable\n" +">>> next(iterator) # Move the iterator forward\n" +"'a'\n" +">>> lookahead(iterator) # Check next value\n" +"'b'\n" +">>> next(iterator) # Continue moving forward\n" +"'b'" +msgstr "" + +#: library/itertools.rst:754 msgid "" "``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be raised " "when simultaneously using iterators returned by the same :func:`tee` call, " "even if the original *iterable* is threadsafe." msgstr "" -#: library/itertools.rst:723 +#: library/itertools.rst:758 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " @@ -821,33 +1237,63 @@ msgid "" "func:`list` instead of :func:`tee`." msgstr "" -#: library/itertools.rst:731 +#: library/itertools.rst:766 +msgid "Make an iterator that aggregates elements from each of the *iterables*." +msgstr "" + +#: library/itertools.rst:769 msgid "" -"Make an iterator that aggregates elements from each of the iterables. If the " -"iterables are of uneven length, missing values are filled-in with " -"*fillvalue*. Iteration continues until the longest iterable is exhausted. " -"Roughly equivalent to::" +"If the iterables are of uneven length, missing values are filled-in with " +"*fillvalue*. If not specified, *fillvalue* defaults to ``None``." +msgstr "" + +#: library/itertools.rst:772 +msgid "Iteration continues until the longest iterable is exhausted." +msgstr "" + +#: library/itertools.rst:776 +msgid "" +"def zip_longest(*iterables, fillvalue=None):\n" +" # zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-\n" +"\n" +" iterators = list(map(iter, iterables))\n" +" num_active = len(iterators)\n" +" if not num_active:\n" +" return\n" +"\n" +" while True:\n" +" values = []\n" +" for i, iterator in enumerate(iterators):\n" +" try:\n" +" value = next(iterator)\n" +" except StopIteration:\n" +" num_active -= 1\n" +" if not num_active:\n" +" return\n" +" iterators[i] = repeat(fillvalue)\n" +" value = fillvalue\n" +" values.append(value)\n" +" yield tuple(values)" msgstr "" -#: library/itertools.rst:755 +#: library/itertools.rst:798 msgid "" "If one of the iterables is potentially infinite, then the :func:" "`zip_longest` function should be wrapped with something that limits the " -"number of calls (for example :func:`islice` or :func:`takewhile`). If not " -"specified, *fillvalue* defaults to ``None``." +"number of calls (for example :func:`islice` or :func:`takewhile`)." msgstr "" -#: library/itertools.rst:764 +#: library/itertools.rst:806 msgid "Itertools Recipes" msgstr "" -#: library/itertools.rst:766 +#: library/itertools.rst:808 msgid "" "This section shows recipes for creating an extended toolset using the " "existing itertools as building blocks." msgstr "" -#: library/itertools.rst:769 +#: library/itertools.rst:811 msgid "" "The primary purpose of the itertools recipes is educational. The recipes " "show various ways of thinking about individual tools — for example, that " @@ -859,7 +1305,7 @@ msgid "" "``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." msgstr "" -#: library/itertools.rst:778 +#: library/itertools.rst:820 msgid "" "A secondary purpose of the recipes is to serve as an incubator. The " "``accumulate()``, ``compress()``, and ``pairwise()`` itertools started out " @@ -867,14 +1313,17 @@ msgid "" "``sieve()`` recipes are being tested to see whether they prove their worth." msgstr "" -#: library/itertools.rst:783 +#: library/itertools.rst:825 msgid "" "Substantially all of these recipes and many, many others can be installed " -"from the `more-itertools project `_ found on the Python Package Index::" +"from the :pypi:`more-itertools` project found on the Python Package Index::" msgstr "" -#: library/itertools.rst:789 +#: library/itertools.rst:829 +msgid "python -m pip install more-itertools" +msgstr "" + +#: library/itertools.rst:831 msgid "" "Many of the recipes offer the same high performance as the underlying " "toolset. Superior memory performance is kept by processing elements one at a " @@ -886,6 +1335,306 @@ msgid "" "overhead." msgstr "" -#: library/itertools.rst:977 +#: library/itertools.rst:839 +msgid "" +"from collections import Counter, deque\n" +"from contextlib import suppress\n" +"from functools import reduce\n" +"from math import comb, prod, sumprod, isqrt\n" +"from operator import itemgetter, getitem, mul, neg\n" +"\n" +"def take(n, iterable):\n" +" \"Return first n items of the iterable as a list.\"\n" +" return list(islice(iterable, n))\n" +"\n" +"def prepend(value, iterable):\n" +" \"Prepend a single value in front of an iterable.\"\n" +" # prepend(1, [2, 3, 4]) → 1 2 3 4\n" +" return chain([value], iterable)\n" +"\n" +"def tabulate(function, start=0):\n" +" \"Return function(0), function(1), ...\"\n" +" return map(function, count(start))\n" +"\n" +"def repeatfunc(function, times=None, *args):\n" +" \"Repeat calls to a function with specified arguments.\"\n" +" if times is None:\n" +" return starmap(function, repeat(args))\n" +" return starmap(function, repeat(args, times))\n" +"\n" +"def flatten(list_of_lists):\n" +" \"Flatten one level of nesting.\"\n" +" return chain.from_iterable(list_of_lists)\n" +"\n" +"def ncycles(iterable, n):\n" +" \"Returns the sequence elements n times.\"\n" +" return chain.from_iterable(repeat(tuple(iterable), n))\n" +"\n" +"def loops(n):\n" +" \"Loop n times. Like range(n) but without creating integers.\"\n" +" # for _ in loops(100): ...\n" +" return repeat(None, n)\n" +"\n" +"def tail(n, iterable):\n" +" \"Return an iterator over the last n items.\"\n" +" # tail(3, 'ABCDEFG') → E F G\n" +" return iter(deque(iterable, maxlen=n))\n" +"\n" +"def consume(iterator, n=None):\n" +" \"Advance the iterator n-steps ahead. If n is None, consume entirely.\"\n" +" # Use functions that consume iterators at C speed.\n" +" if n is None:\n" +" deque(iterator, maxlen=0)\n" +" else:\n" +" next(islice(iterator, n, n), None)\n" +"\n" +"def nth(iterable, n, default=None):\n" +" \"Returns the nth item or a default value.\"\n" +" return next(islice(iterable, n, None), default)\n" +"\n" +"def quantify(iterable, predicate=bool):\n" +" \"Given a predicate that returns True or False, count the True results." +"\"\n" +" return sum(map(predicate, iterable))\n" +"\n" +"def first_true(iterable, default=False, predicate=None):\n" +" \"Returns the first true value or the *default* if there is no true " +"value.\"\n" +" # first_true([a,b,c], x) → a or b or c or x\n" +" # first_true([a,b], x, f) → a if f(a) else b if f(b) else x\n" +" return next(filter(predicate, iterable), default)\n" +"\n" +"def all_equal(iterable, key=None):\n" +" \"Returns True if all the elements are equal to each other.\"\n" +" # all_equal('4٤௪౪໔', key=int) → True\n" +" return len(take(2, groupby(iterable, key))) <= 1\n" +"\n" +"def unique_justseen(iterable, key=None):\n" +" \"Yield unique elements, preserving order. Remember only the element " +"just seen.\"\n" +" # unique_justseen('AAAABBBCCDAABBB') → A B C D A B\n" +" # unique_justseen('ABBcCAD', str.casefold) → A B c A D\n" +" if key is None:\n" +" return map(itemgetter(0), groupby(iterable))\n" +" return map(next, map(itemgetter(1), groupby(iterable, key)))\n" +"\n" +"def unique_everseen(iterable, key=None):\n" +" \"Yield unique elements, preserving order. Remember all elements ever " +"seen.\"\n" +" # unique_everseen('AAAABBBCCDAABBB') → A B C D\n" +" # unique_everseen('ABBcCAD', str.casefold) → A B c D\n" +" seen = set()\n" +" if key is None:\n" +" for element in filterfalse(seen.__contains__, iterable):\n" +" seen.add(element)\n" +" yield element\n" +" else:\n" +" for element in iterable:\n" +" k = key(element)\n" +" if k not in seen:\n" +" seen.add(k)\n" +" yield element\n" +"\n" +"def unique(iterable, key=None, reverse=False):\n" +" \"Yield unique elements in sorted order. Supports unhashable inputs.\"\n" +" # unique([[1, 2], [3, 4], [1, 2]]) → [1, 2] [3, 4]\n" +" sequenced = sorted(iterable, key=key, reverse=reverse)\n" +" return unique_justseen(sequenced, key=key)\n" +"\n" +"def sliding_window(iterable, n):\n" +" \"Collect data into overlapping fixed-length chunks or blocks.\"\n" +" # sliding_window('ABCDEFG', 4) → ABCD BCDE CDEF DEFG\n" +" iterator = iter(iterable)\n" +" window = deque(islice(iterator, n - 1), maxlen=n)\n" +" for x in iterator:\n" +" window.append(x)\n" +" yield tuple(window)\n" +"\n" +"def grouper(iterable, n, *, incomplete='fill', fillvalue=None):\n" +" \"Collect data into non-overlapping fixed-length chunks or blocks.\"\n" +" # grouper('ABCDEFG', 3, fillvalue='x') → ABC DEF Gxx\n" +" # grouper('ABCDEFG', 3, incomplete='strict') → ABC DEF ValueError\n" +" # grouper('ABCDEFG', 3, incomplete='ignore') → ABC DEF\n" +" iterators = [iter(iterable)] * n\n" +" match incomplete:\n" +" case 'fill':\n" +" return zip_longest(*iterators, fillvalue=fillvalue)\n" +" case 'strict':\n" +" return zip(*iterators, strict=True)\n" +" case 'ignore':\n" +" return zip(*iterators)\n" +" case _:\n" +" raise ValueError('Expected fill, strict, or ignore')\n" +"\n" +"def roundrobin(*iterables):\n" +" \"Visit input iterables in a cycle until each is exhausted.\"\n" +" # roundrobin('ABC', 'D', 'EF') → A D E B F C\n" +" # Algorithm credited to George Sakkis\n" +" iterators = map(iter, iterables)\n" +" for num_active in range(len(iterables), 0, -1):\n" +" iterators = cycle(islice(iterators, num_active))\n" +" yield from map(next, iterators)\n" +"\n" +"def subslices(seq):\n" +" \"Return all contiguous non-empty subslices of a sequence.\"\n" +" # subslices('ABCD') → A AB ABC ABCD B BC BCD C CD D\n" +" slices = starmap(slice, combinations(range(len(seq) + 1), 2))\n" +" return map(getitem, repeat(seq), slices)\n" +"\n" +"def iter_index(iterable, value, start=0, stop=None):\n" +" \"Return indices where a value occurs in a sequence or iterable.\"\n" +" # iter_index('AABCADEAF', 'A') → 0 1 4 7\n" +" seq_index = getattr(iterable, 'index', None)\n" +" if seq_index is None:\n" +" iterator = islice(iterable, start, stop)\n" +" for i, element in enumerate(iterator, start):\n" +" if element is value or element == value:\n" +" yield i\n" +" else:\n" +" stop = len(iterable) if stop is None else stop\n" +" i = start\n" +" with suppress(ValueError):\n" +" while True:\n" +" yield (i := seq_index(value, i, stop))\n" +" i += 1\n" +"\n" +"def iter_except(function, exception, first=None):\n" +" \"Convert a call-until-exception interface to an iterator interface.\"\n" +" # iter_except(d.popitem, KeyError) → non-blocking dictionary iterator\n" +" with suppress(exception):\n" +" if first is not None:\n" +" yield first()\n" +" while True:\n" +" yield function()" +msgstr "" + +#: library/itertools.rst:1008 msgid "The following recipes have a more mathematical flavor:" msgstr "" + +#: library/itertools.rst:1010 +msgid "" +"def multinomial(*counts):\n" +" \"Number of distinct arrangements of a multiset.\"\n" +" # Counter('abracadabra').values() → 5 2 2 1 1\n" +" # multinomial(5, 2, 2, 1, 1) → 83160\n" +" return prod(map(comb, accumulate(counts), counts))\n" +"\n" +"def powerset(iterable):\n" +" \"Subsequences of the iterable from shortest to longest.\"\n" +" # powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\n" +" s = list(iterable)\n" +" return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))\n" +"\n" +"def sum_of_squares(iterable):\n" +" \"Add up the squares of the input values.\"\n" +" # sum_of_squares([10, 20, 30]) → 1400\n" +" return sumprod(*tee(iterable))\n" +"\n" +"def reshape(matrix, columns):\n" +" \"Reshape a 2-D matrix to have a given number of columns.\"\n" +" # reshape([(0, 1), (2, 3), (4, 5)], 3) → (0, 1, 2), (3, 4, 5)\n" +" return batched(chain.from_iterable(matrix), columns, strict=True)\n" +"\n" +"def transpose(matrix):\n" +" \"Swap the rows and columns of a 2-D matrix.\"\n" +" # transpose([(1, 2, 3), (11, 22, 33)]) → (1, 11) (2, 22) (3, 33)\n" +" return zip(*matrix, strict=True)\n" +"\n" +"def matmul(m1, m2):\n" +" \"Multiply two matrices.\"\n" +" # matmul([(7, 5), (3, 5)], [(2, 5), (7, 9)]) → (49, 80), (41, 60)\n" +" n = len(m2[0])\n" +" return batched(starmap(sumprod, product(m1, transpose(m2))), n)\n" +"\n" +"def convolve(signal, kernel):\n" +" \"\"\"Discrete linear convolution of two iterables.\n" +" Equivalent to polynomial multiplication.\n" +"\n" +" Convolutions are mathematically commutative; however, the inputs are\n" +" evaluated differently. The signal is consumed lazily and can be\n" +" infinite. The kernel is fully consumed before the calculations begin.\n" +"\n" +" Article: https://betterexplained.com/articles/intuitive-convolution/\n" +" Video: https://www.youtube.com/watch?v=KuXjwB4LzSA\n" +" \"\"\"\n" +" # convolve([1, -1, -20], [1, -3]) → 1 -4 -17 60\n" +" # convolve(data, [0.25, 0.25, 0.25, 0.25]) → Moving average (blur)\n" +" # convolve(data, [1/2, 0, -1/2]) → 1st derivative estimate\n" +" # convolve(data, [1, -2, 1]) → 2nd derivative estimate\n" +" kernel = tuple(kernel)[::-1]\n" +" n = len(kernel)\n" +" padded_signal = chain(repeat(0, n-1), signal, repeat(0, n-1))\n" +" windowed_signal = sliding_window(padded_signal, n)\n" +" return map(sumprod, repeat(kernel), windowed_signal)\n" +"\n" +"def polynomial_from_roots(roots):\n" +" \"\"\"Compute a polynomial's coefficients from its roots.\n" +"\n" +" (x - 5) (x + 4) (x - 3) expands to: x³ -4x² -17x + 60\n" +" \"\"\"\n" +" # polynomial_from_roots([5, -4, 3]) → [1, -4, -17, 60]\n" +" factors = zip(repeat(1), map(neg, roots))\n" +" return list(reduce(convolve, factors, [1]))\n" +"\n" +"def polynomial_eval(coefficients, x):\n" +" \"\"\"Evaluate a polynomial at a specific value.\n" +"\n" +" Computes with better numeric stability than Horner's method.\n" +" \"\"\"\n" +" # Evaluate x³ -4x² -17x + 60 at x = 5\n" +" # polynomial_eval([1, -4, -17, 60], x=5) → 0\n" +" n = len(coefficients)\n" +" if not n:\n" +" return type(x)(0)\n" +" powers = map(pow, repeat(x), reversed(range(n)))\n" +" return sumprod(coefficients, powers)\n" +"\n" +"def polynomial_derivative(coefficients):\n" +" \"\"\"Compute the first derivative of a polynomial.\n" +"\n" +" f(x) = x³ -4x² -17x + 60\n" +" f'(x) = 3x² -8x -17\n" +" \"\"\"\n" +" # polynomial_derivative([1, -4, -17, 60]) → [3, -8, -17]\n" +" n = len(coefficients)\n" +" powers = reversed(range(1, n))\n" +" return list(map(mul, coefficients, powers))\n" +"\n" +"def sieve(n):\n" +" \"Primes less than n.\"\n" +" # sieve(30) → 2 3 5 7 11 13 17 19 23 29\n" +" if n > 2:\n" +" yield 2\n" +" data = bytearray((0, 1)) * (n // 2)\n" +" for p in iter_index(data, 1, start=3, stop=isqrt(n) + 1):\n" +" data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))\n" +" yield from iter_index(data, 1, start=3)\n" +"\n" +"def factor(n):\n" +" \"Prime factors of n.\"\n" +" # factor(99) → 3 3 11\n" +" # factor(1_000_000_000_000_007) → 47 59 360620266859\n" +" # factor(1_000_000_000_000_403) → 1000000000000403\n" +" for prime in sieve(isqrt(n) + 1):\n" +" while not n % prime:\n" +" yield prime\n" +" n //= prime\n" +" if n == 1:\n" +" return\n" +" if n > 1:\n" +" yield n\n" +"\n" +"def is_prime(n):\n" +" \"Return True if n is prime.\"\n" +" # is_prime(1_000_000_000_000_403) → True\n" +" return n > 1 and next(factor(n)) == n\n" +"\n" +"def totient(n):\n" +" \"Count of natural numbers up to n that are coprime to n.\"\n" +" # https://mathworld.wolfram.com/TotientFunction.html\n" +" # totient(12) → 4 because len([1, 5, 7, 11]) == 4\n" +" for prime in set(factor(n)):\n" +" n -= n // prime\n" +" return n" +msgstr "" diff --git a/library/json.po b/library/json.po index 68d6cb53..972d221b 100644 --- a/library/json.po +++ b/library/json.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/json.rst:2 -msgid ":mod:`json` --- JSON encoder and decoder" +msgid ":mod:`!json` --- JSON encoder and decoder" msgstr "" #: library/json.rst:10 @@ -27,7 +28,7 @@ msgstr "" #: library/json.rst:14 msgid "" "`JSON (JavaScript Object Notation) `_, specified by :rfc:" -"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, is a " "lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is not a " @@ -36,50 +37,168 @@ msgstr "" #: library/json.rst:22 msgid "" +"The term \"object\" in the context of JSON processing in Python can be " +"ambiguous. All values in Python are objects. In JSON, an object refers to " +"any data wrapped in curly braces, similar to a Python dictionary." +msgstr "" + +#: library/json.rst:27 +msgid "" "Be cautious when parsing JSON data from untrusted sources. A malicious JSON " "string may cause the decoder to consume considerable CPU and memory " "resources. Limiting the size of data to be parsed is recommended." msgstr "" -#: library/json.rst:26 +#: library/json.rst:31 msgid "" -":mod:`json` exposes an API familiar to users of the standard library :mod:" +"This module exposes an API familiar to users of the standard library :mod:" "`marshal` and :mod:`pickle` modules." msgstr "" -#: library/json.rst:29 +#: library/json.rst:34 msgid "Encoding basic Python object hierarchies::" msgstr "" -#: library/json.rst:48 +#: library/json.rst:36 +msgid "" +">>> import json\n" +">>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])\n" +"'[\"foo\", {\"bar\": [\"baz\", null, 1.0, 2]}]'\n" +">>> print(json.dumps(\"\\\"foo\\bar\"))\n" +"\"\\\"foo\\bar\"\n" +">>> print(json.dumps('\\u1234'))\n" +"\"\\u1234\"\n" +">>> print(json.dumps('\\\\'))\n" +"\"\\\\\"\n" +">>> print(json.dumps({\"c\": 0, \"b\": 0, \"a\": 0}, sort_keys=True))\n" +"{\"a\": 0, \"b\": 0, \"c\": 0}\n" +">>> from io import StringIO\n" +">>> io = StringIO()\n" +">>> json.dump(['streaming API'], io)\n" +">>> io.getvalue()\n" +"'[\"streaming API\"]'" +msgstr "" + +#: library/json.rst:53 msgid "Compact encoding::" msgstr "" -#: library/json.rst:54 +#: library/json.rst:55 +msgid "" +">>> import json\n" +">>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))\n" +"'[1,2,3,{\"4\":5,\"6\":7}]'" +msgstr "" + +#: library/json.rst:59 msgid "Pretty printing::" msgstr "" -#: library/json.rst:63 +#: library/json.rst:61 +msgid "" +">>> import json\n" +">>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))\n" +"{\n" +" \"4\": 5,\n" +" \"6\": 7\n" +"}" +msgstr "" + +#: library/json.rst:68 +msgid "Customizing JSON object encoding::" +msgstr "" + +#: library/json.rst:70 +msgid "" +">>> import json\n" +">>> def custom_json(obj):\n" +"... if isinstance(obj, complex):\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': obj." +"imag}\n" +"... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" +"...\n" +">>> json.dumps(1 + 2j, default=custom_json)\n" +"'{\"__complex__\": true, \"real\": 1.0, \"imag\": 2.0}'" +msgstr "" + +#: library/json.rst:79 msgid "Decoding JSON::" msgstr "" -#: library/json.rst:75 -msgid "Specializing JSON object decoding::" +#: library/json.rst:81 +msgid "" +">>> import json\n" +">>> json.loads('[\"foo\", {\"bar\":[\"baz\", null, 1.0, 2]}]')\n" +"['foo', {'bar': ['baz', None, 1.0, 2]}]\n" +">>> json.loads('\"\\\\\"foo\\\\bar\"')\n" +"'\"foo\\x08ar'\n" +">>> from io import StringIO\n" +">>> io = StringIO('[\"streaming API\"]')\n" +">>> json.load(io)\n" +"['streaming API']" msgstr "" -#: library/json.rst:90 +#: library/json.rst:91 +msgid "Customizing JSON object decoding::" +msgstr "" + +#: library/json.rst:93 +msgid "" +">>> import json\n" +">>> def as_complex(dct):\n" +"... if '__complex__' in dct:\n" +"... return complex(dct['real'], dct['imag'])\n" +"... return dct\n" +"...\n" +">>> json.loads('{\"__complex__\": true, \"real\": 1, \"imag\": 2}',\n" +"... object_hook=as_complex)\n" +"(1+2j)\n" +">>> import decimal\n" +">>> json.loads('1.1', parse_float=decimal.Decimal)\n" +"Decimal('1.1')" +msgstr "" + +#: library/json.rst:106 msgid "Extending :class:`JSONEncoder`::" msgstr "" #: library/json.rst:108 -msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" +msgid "" +">>> import json\n" +">>> class ComplexEncoder(json.JSONEncoder):\n" +"... def default(self, obj):\n" +"... if isinstance(obj, complex):\n" +"... return [obj.real, obj.imag]\n" +"... # Let the base class default method raise the TypeError\n" +"... return super().default(obj)\n" +"...\n" +">>> json.dumps(2 + 1j, cls=ComplexEncoder)\n" +"'[2.0, 1.0]'\n" +">>> ComplexEncoder().encode(2 + 1j)\n" +"'[2.0, 1.0]'\n" +">>> list(ComplexEncoder().iterencode(2 + 1j))\n" +"['[2.0', ', 1.0', ']']" msgstr "" -#: library/json.rst:119 +#: library/json.rst:124 +msgid "Using :mod:`json` from the shell to validate and pretty-print:" +msgstr "" + +#: library/json.rst:126 +msgid "" +"$ echo '{\"json\":\"obj\"}' | python -m json\n" +"{\n" +" \"json\": \"obj\"\n" +"}\n" +"$ echo '{1.2:3.4}' | python -m json\n" +"Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" +msgstr "" + +#: library/json.rst:135 msgid "See :ref:`json-commandline` for detailed documentation." msgstr "" -#: library/json.rst:123 +#: library/json.rst:139 msgid "" "JSON is a subset of `YAML `_ 1.2. The JSON produced by " "this module's default settings (in particular, the default *separators* " @@ -87,126 +206,133 @@ msgid "" "used as a YAML serializer." msgstr "" -#: library/json.rst:130 +#: library/json.rst:146 msgid "" "This module's encoders and decoders preserve input and output order by " "default. Order is only lost if the underlying containers are unordered." msgstr "" -#: library/json.rst:135 +#: library/json.rst:151 msgid "Basic Usage" msgstr "" -#: library/json.rst:142 +#: library/json.rst:158 msgid "" "Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-" -"supporting :term:`file-like object`) using this :ref:`conversion table `." +"supporting :term:`file-like object`) using this :ref:`Python-to-JSON " +"conversion table `." msgstr "" -#: library/json.rst:146 +#: library/json.rst:164 msgid "" -"If *skipkeys* is true (default: ``False``), then dict keys that are not of a " -"basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, " -"``None``) will be skipped instead of raising a :exc:`TypeError`." +"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " +"trying to serialize multiple objects with repeated calls to :func:`dump` " +"using the same *fp* will result in an invalid JSON file." msgstr "" -#: library/json.rst:150 -msgid "" -"The :mod:`json` module always produces :class:`str` objects, not :class:" -"`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input." +#: library/json.rst:0 +msgid "Parameters" msgstr "" -#: library/json.rst:433 -msgid "" -"If *ensure_ascii* is true (the default), the output is guaranteed to have " -"all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " -"these characters will be output as-is." +#: library/json.rst:168 +msgid "The Python object to be serialized." msgstr "" -#: library/json.rst:158 +#: library/json.rst:171 msgid "" -"If *check_circular* is false (default: ``True``), then the circular " -"reference check for container types will be skipped and a circular reference " -"will result in a :exc:`RecursionError` (or worse)." +"The file-like object *obj* will be serialized to. The :mod:`!json` module " +"always produces :class:`str` objects, not :class:`bytes` objects, therefore " +"``fp.write()`` must support :class:`str` input." msgstr "" -#: library/json.rst:162 +#: library/json.rst:178 msgid "" -"If *allow_nan* is false (default: ``True``), then it will be a :exc:" -"`ValueError` to serialize out of range :class:`float` values (``nan``, " -"``inf``, ``-inf``) in strict compliance of the JSON specification. If " -"*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-" -"Infinity``) will be used." +"If ``True``, keys that are not of a basic type (:class:`str`, :class:`int`, :" +"class:`float`, :class:`bool`, ``None``) will be skipped instead of raising " +"a :exc:`TypeError`. Default ``False``." msgstr "" -#: library/json.rst:452 +#: library/json.rst:184 msgid "" -"If *indent* is a non-negative integer or string, then JSON array elements " -"and object members will be pretty-printed with that indent level. An indent " -"level of 0, negative, or ``\"\"`` will only insert newlines. ``None`` (the " -"default) selects the most compact representation. Using a positive integer " -"indent indents that many spaces per level. If *indent* is a string (such as " -"``\"\\t\"``), that string is used to indent each level." +"If ``True`` (the default), the output is guaranteed to have all incoming non-" +"ASCII and non-printable characters escaped. If ``False``, all characters " +"will be outputted as-is, except for the characters that must be escaped: " +"quotation mark, reverse solidus, and the control characters U+0000 through " +"U+001F." msgstr "" -#: library/json.rst:459 -msgid "Allow strings for *indent* in addition to integers." +#: library/json.rst:191 +msgid "" +"If ``False``, the circular reference check for container types is skipped " +"and a circular reference will result in a :exc:`RecursionError` (or worse). " +"Default ``True``." msgstr "" -#: library/json.rst:462 +#: library/json.rst:196 msgid "" -"If specified, *separators* should be an ``(item_separator, key_separator)`` " -"tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " -"': ')`` otherwise. To get the most compact JSON representation, you should " -"specify ``(',', ':')`` to eliminate whitespace." +"If ``False``, serialization of out-of-range :class:`float` values (``nan``, " +"``inf``, ``-inf``) will result in a :exc:`ValueError`, in strict compliance " +"with the JSON specification. If ``True`` (the default), their JavaScript " +"equivalents (``NaN``, ``Infinity``, ``-Infinity``) are used." msgstr "" -#: library/json.rst:467 -msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." +#: library/json.rst:203 +msgid "" +"If set, a custom JSON encoder with the :meth:`~JSONEncoder.default` method " +"overridden, for serializing into custom datatypes. If ``None`` (the " +"default), :class:`!JSONEncoder` is used." msgstr "" -#: library/json.rst:470 +#: library/json.rst:210 msgid "" -"If specified, *default* should be a function that gets called for objects " -"that can't otherwise be serialized. It should return a JSON encodable " -"version of the object or raise a :exc:`TypeError`. If not specified, :exc:" -"`TypeError` is raised." +"If a positive integer or string, JSON array elements and object members will " +"be pretty-printed with that indent level. A positive integer indents that " +"many spaces per level; a string (such as ``\"\\t\"``) is used to indent each " +"level. If zero, negative, or ``\"\"`` (the empty string), only newlines are " +"inserted. If ``None`` (the default), the most compact representation is used." msgstr "" -#: library/json.rst:191 +#: library/json.rst:220 msgid "" -"If *sort_keys* is true (default: ``False``), then the output of dictionaries " -"will be sorted by key." +"A two-tuple: ``(item_separator, key_separator)``. If ``None`` (the default), " +"*separators* defaults to ``(', ', ': ')`` if *indent* is ``None``, and " +"``(',', ': ')`` otherwise. For the most compact JSON, specify ``(',', ':')`` " +"to eliminate whitespace." msgstr "" -#: library/json.rst:194 +#: library/json.rst:229 msgid "" -"To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :" -"meth:`~JSONEncoder.default` method to serialize additional types), specify " -"it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." +"A function that is called for objects that can't otherwise be serialized. It " +"should return a JSON encodable version of the object or raise a :exc:" +"`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." msgstr "" -#: library/json.rst:277 +#: library/json.rst:236 msgid "" -"All optional parameters are now :ref:`keyword-only `." +"If ``True``, dictionaries will be outputted sorted by key. Default ``False``." msgstr "" -#: library/json.rst:203 +#: library/json.rst:527 +msgid "Allow strings for *indent* in addition to integers." +msgstr "" + +#: library/json.rst:535 +msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." +msgstr "" + +#: library/json.rst:345 msgid "" -"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " -"trying to serialize multiple objects with repeated calls to :func:`dump` " -"using the same *fp* will result in an invalid JSON file." +"All optional parameters are now :ref:`keyword-only `." msgstr "" -#: library/json.rst:212 +#: library/json.rst:255 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " "table `. The arguments have the same meaning as in :func:" "`dump`." msgstr "" -#: library/json.rst:218 +#: library/json.rst:261 msgid "" "Keys in key/value pairs of JSON are always of the type :class:`str`. When a " "dictionary is converted into JSON, all the keys of the dictionary are " @@ -215,217 +341,254 @@ msgid "" "original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys." msgstr "" -#: library/json.rst:227 +#: library/json.rst:272 msgid "" -"Deserialize *fp* (a ``.read()``-supporting :term:`text file` or :term:" -"`binary file` containing a JSON document) to a Python object using this :ref:" -"`conversion table `." +"Deserialize *fp* to a Python object using the :ref:`JSON-to-Python " +"conversion table `." msgstr "" -#: library/json.rst:231 +#: library/json.rst:275 msgid "" -"*object_hook* is an optional function that will be called with the result of " -"any object literal decoded (a :class:`dict`). The return value of " -"*object_hook* will be used instead of the :class:`dict`. This feature can " -"be used to implement custom decoders (e.g. `JSON-RPC `_ class hinting)." +"A ``.read()``-supporting :term:`text file` or :term:`binary file` containing " +"the JSON document to be deserialized." msgstr "" -#: library/json.rst:237 +#: library/json.rst:280 msgid "" -"*object_pairs_hook* is an optional function that will be called with the " -"result of any object literal decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of the :class:" -"`dict`. This feature can be used to implement custom decoders. If " -"*object_hook* is also defined, the *object_pairs_hook* takes priority." +"If set, a custom JSON decoder. Additional keyword arguments to :func:`!load` " +"will be passed to the constructor of *cls*. If ``None`` (the default), :" +"class:`!JSONDecoder` is used." msgstr "" -#: library/json.rst:348 -msgid "Added support for *object_pairs_hook*." +#: library/json.rst:287 +msgid "" +"If set, a function that is called with the result of any JSON object literal " +"decoded (a :class:`dict`). The return value of this function will be used " +"instead of the :class:`dict`. This feature can be used to implement custom " +"decoders, for example `JSON-RPC `_ class hinting. " +"Default ``None``." msgstr "" -#: library/json.rst:351 +#: library/json.rst:297 msgid "" -"*parse_float*, if specified, will be called with the string of every JSON " -"float to be decoded. By default, this is equivalent to ``float(num_str)``. " -"This can be used to use another datatype or parser for JSON floats (e.g. :" -"class:`decimal.Decimal`)." +"If set, a function that is called with the result of any JSON object literal " +"decoded with an ordered list of pairs. The return value of this function " +"will be used instead of the :class:`dict`. This feature can be used to " +"implement custom decoders. If *object_hook* is also set, *object_pairs_hook* " +"takes priority. Default ``None``." msgstr "" -#: library/json.rst:356 +#: library/json.rst:307 msgid "" -"*parse_int*, if specified, will be called with the string of every JSON int " -"to be decoded. By default, this is equivalent to ``int(num_str)``. This " -"can be used to use another datatype or parser for JSON integers (e.g. :class:" -"`float`)." +"If set, a function that is called with the string of every JSON float to be " +"decoded. If ``None`` (the default), it is equivalent to ``float(num_str)``. " +"This can be used to parse JSON floats into custom datatypes, for example :" +"class:`decimal.Decimal`." msgstr "" -#: library/json.rst:256 +#: library/json.rst:315 msgid "" -"The default *parse_int* of :func:`int` now limits the maximum length of the " -"integer string via the interpreter's :ref:`integer string conversion length " -"limitation ` to help avoid denial of service attacks." +"If set, a function that is called with the string of every JSON int to be " +"decoded. If ``None`` (the default), it is equivalent to ``int(num_str)``. " +"This can be used to parse JSON integers into custom datatypes, for example :" +"class:`float`." msgstr "" -#: library/json.rst:361 +#: library/json.rst:323 msgid "" -"*parse_constant*, if specified, will be called with one of the following " -"strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be used to " -"raise an exception if invalid JSON numbers are encountered." +"If set, a function that is called with one of the following strings: ``'-" +"Infinity'``, ``'Infinity'``, or ``'NaN'``. This can be used to raise an " +"exception if invalid JSON numbers are encountered. Default ``None``." msgstr "" -#: library/json.rst:267 -msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." +#: library/json.rst:0 +msgid "Raises" msgstr "" -#: library/json.rst:270 -msgid "" -"To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls`` " -"kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " -"will be passed to the constructor of the class." +#: library/json.rst:331 +msgid "When the data being deserialized is not a valid JSON document." msgstr "" -#: library/json.rst:292 library/json.rst:371 +#: library/json.rst:334 msgid "" -"If the data being deserialized is not a valid JSON document, a :exc:" -"`JSONDecodeError` will be raised." +"When the data being deserialized does not contain UTF-8, UTF-16 or UTF-32 " +"encoded data." msgstr "" -#: library/json.rst:280 +#: library/json.rst:340 +msgid "Added the optional *object_pairs_hook* parameter." +msgstr "" + +#: library/json.rst:341 +msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." +msgstr "" + +#: library/json.rst:346 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." msgstr "" -#: library/json.rst:286 +#: library/json.rst:349 msgid "" -"Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray` " -"instance containing a JSON document) to a Python object using this :ref:" -"`conversion table `." +"The default *parse_int* of :func:`int` now limits the maximum length of the " +"integer string via the interpreter's :ref:`integer string conversion length " +"limitation ` to help avoid denial of service attacks." msgstr "" -#: library/json.rst:290 -msgid "The other arguments have the same meaning as in :func:`load`." +#: library/json.rst:357 +msgid "" +"Identical to :func:`load`, but instead of a file-like object, deserialize " +"*s* (a :class:`str`, :class:`bytes` or :class:`bytearray` instance " +"containing a JSON document) to a Python object using this :ref:`conversion " +"table `." msgstr "" -#: library/json.rst:295 +#: library/json.rst:362 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." msgstr "" -#: library/json.rst:299 +#: library/json.rst:366 msgid "The keyword argument *encoding* has been removed." msgstr "" -#: library/json.rst:304 +#: library/json.rst:371 msgid "Encoders and Decoders" msgstr "" -#: library/json.rst:308 +#: library/json.rst:375 msgid "Simple JSON decoder." msgstr "" -#: library/json.rst:310 +#: library/json.rst:377 msgid "Performs the following translations in decoding by default:" msgstr "" -#: library/json.rst:404 +#: library/json.rst:470 msgid "JSON" msgstr "" -#: library/json.rst:404 +#: library/json.rst:470 msgid "Python" msgstr "" -#: library/json.rst:406 +#: library/json.rst:472 msgid "object" msgstr "" -#: library/json.rst:406 +#: library/json.rst:472 msgid "dict" msgstr "" -#: library/json.rst:408 +#: library/json.rst:474 msgid "array" msgstr "" -#: library/json.rst:319 +#: library/json.rst:386 msgid "list" msgstr "" -#: library/json.rst:410 +#: library/json.rst:476 msgid "string" msgstr "" -#: library/json.rst:410 +#: library/json.rst:476 msgid "str" msgstr "" -#: library/json.rst:323 +#: library/json.rst:390 msgid "number (int)" msgstr "" -#: library/json.rst:323 +#: library/json.rst:390 msgid "int" msgstr "" -#: library/json.rst:325 +#: library/json.rst:392 msgid "number (real)" msgstr "" -#: library/json.rst:325 +#: library/json.rst:392 msgid "float" msgstr "" -#: library/json.rst:414 +#: library/json.rst:480 msgid "true" msgstr "" -#: library/json.rst:414 +#: library/json.rst:480 msgid "True" msgstr "" -#: library/json.rst:416 +#: library/json.rst:482 msgid "false" msgstr "" -#: library/json.rst:416 +#: library/json.rst:482 msgid "False" msgstr "" -#: library/json.rst:418 +#: library/json.rst:484 msgid "null" msgstr "" -#: library/json.rst:418 +#: library/json.rst:484 msgid "None" msgstr "" -#: library/json.rst:334 +#: library/json.rst:401 msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." msgstr "" -#: library/json.rst:337 +#: library/json.rst:404 msgid "" -"*object_hook*, if specified, will be called with the result of every JSON " -"object decoded and its return value will be used in place of the given :" -"class:`dict`. This can be used to provide custom deserializations (e.g. to " -"support `JSON-RPC `_ class hinting)." +"*object_hook* is an optional function that will be called with the result of " +"every JSON object decoded and its return value will be used in place of the " +"given :class:`dict`. This can be used to provide custom deserializations (e." +"g. to support `JSON-RPC `_ class hinting)." msgstr "" -#: library/json.rst:342 +#: library/json.rst:409 msgid "" -"*object_pairs_hook*, if specified will be called with the result of every " -"JSON object decoded with an ordered list of pairs. The return value of " -"*object_pairs_hook* will be used instead of the :class:`dict`. This feature " -"can be used to implement custom decoders. If *object_hook* is also defined, " -"the *object_pairs_hook* takes priority." +"*object_pairs_hook* is an optional function that will be called with the " +"result of every JSON object decoded with an ordered list of pairs. The " +"return value of *object_pairs_hook* will be used instead of the :class:" +"`dict`. This feature can be used to implement custom decoders. If " +"*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -#: library/json.rst:366 +#: library/json.rst:415 +msgid "Added support for *object_pairs_hook*." +msgstr "" + +#: library/json.rst:418 +msgid "" +"*parse_float* is an optional function that will be called with the string of " +"every JSON float to be decoded. By default, this is equivalent to " +"``float(num_str)``. This can be used to use another datatype or parser for " +"JSON floats (e.g. :class:`decimal.Decimal`)." +msgstr "" + +#: library/json.rst:423 +msgid "" +"*parse_int* is an optional function that will be called with the string of " +"every JSON int to be decoded. By default, this is equivalent to " +"``int(num_str)``. This can be used to use another datatype or parser for " +"JSON integers (e.g. :class:`float`)." +msgstr "" + +#: library/json.rst:428 +msgid "" +"*parse_constant* is an optional function that will be called with one of the " +"following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " +"used to raise an exception if invalid JSON numbers are encountered." +msgstr "" + +#: library/json.rst:432 msgid "" "If *strict* is false (``True`` is the default), then control characters will " "be allowed inside strings. Control characters in this context are those " @@ -433,60 +596,66 @@ msgid "" "``'\\n'``, ``'\\r'`` and ``'\\0'``." msgstr "" -#: library/json.rst:475 +#: library/json.rst:437 +msgid "" +"If the data being deserialized is not a valid JSON document, a :exc:" +"`JSONDecodeError` will be raised." +msgstr "" + +#: library/json.rst:543 msgid "All parameters are now :ref:`keyword-only `." msgstr "" -#: library/json.rst:379 +#: library/json.rst:445 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" -#: library/json.rst:382 +#: library/json.rst:448 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." msgstr "" -#: library/json.rst:387 +#: library/json.rst:453 msgid "" "Decode a JSON document from *s* (a :class:`str` beginning with a JSON " "document) and return a 2-tuple of the Python representation and the index in " "*s* where the document ended." msgstr "" -#: library/json.rst:391 +#: library/json.rst:457 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "" -#: library/json.rst:397 +#: library/json.rst:463 msgid "Extensible JSON encoder for Python data structures." msgstr "" -#: library/json.rst:399 +#: library/json.rst:465 msgid "Supports the following objects and types by default:" msgstr "" -#: library/json.rst:408 +#: library/json.rst:474 msgid "list, tuple" msgstr "" -#: library/json.rst:412 +#: library/json.rst:478 msgid "int, float, int- & float-derived Enums" msgstr "" -#: library/json.rst:412 +#: library/json.rst:478 msgid "number" msgstr "" -#: library/json.rst:421 +#: library/json.rst:487 msgid "Added support for int- and float-derived Enum classes." msgstr "" -#: library/json.rst:424 +#: library/json.rst:490 msgid "" "To extend this to recognize other objects, subclass and implement a :meth:" "`~JSONEncoder.default` method with another method that returns a " @@ -494,14 +663,24 @@ msgid "" "superclass implementation (to raise :exc:`TypeError`)." msgstr "" -#: library/json.rst:429 +#: library/json.rst:495 msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " "trying to encode keys that are not :class:`str`, :class:`int`, :class:" -"`float` or ``None``. If *skipkeys* is true, such items are simply skipped." +"`float`, :class:`bool` or ``None``. If *skipkeys* is true, such items are " +"simply skipped." msgstr "" -#: library/json.rst:437 +#: library/json.rst:499 +msgid "" +"If *ensure_ascii* is true (the default), the output is guaranteed to have " +"all incoming non-ASCII and non-printable characters escaped. If " +"*ensure_ascii* is false, all characters will be output as-is, except for the " +"characters that must be escaped: quotation mark, reverse solidus, and the " +"control characters U+0000 through U+001F." +msgstr "" + +#: library/json.rst:505 msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " @@ -509,7 +688,7 @@ msgid "" "Otherwise, no such check takes place." msgstr "" -#: library/json.rst:442 +#: library/json.rst:510 msgid "" "If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-" "Infinity`` will be encoded as such. This behavior is not JSON specification " @@ -517,121 +696,172 @@ msgid "" "decoders. Otherwise, it will be a :exc:`ValueError` to encode such floats." msgstr "" -#: library/json.rst:448 +#: library/json.rst:516 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key; this is useful for regression tests to ensure that " "JSON serializations can be compared on a day-to-day basis." msgstr "" -#: library/json.rst:481 +#: library/json.rst:520 +msgid "" +"If *indent* is a non-negative integer or string, then JSON array elements " +"and object members will be pretty-printed with that indent level. An indent " +"level of 0, negative, or ``\"\"`` will only insert newlines. ``None`` (the " +"default) selects the most compact representation. Using a positive integer " +"indent indents that many spaces per level. If *indent* is a string (such as " +"``\"\\t\"``), that string is used to indent each level." +msgstr "" + +#: library/json.rst:530 +msgid "" +"If specified, *separators* should be an ``(item_separator, key_separator)`` " +"tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " +"': ')`` otherwise. To get the most compact JSON representation, you should " +"specify ``(',', ':')`` to eliminate whitespace." +msgstr "" + +#: library/json.rst:538 +msgid "" +"If specified, *default* should be a function that gets called for objects " +"that can't otherwise be serialized. It should return a JSON encodable " +"version of the object or raise a :exc:`TypeError`. If not specified, :exc:" +"`TypeError` is raised." +msgstr "" + +#: library/json.rst:549 msgid "" "Implement this method in a subclass such that it returns a serializable " "object for *o*, or calls the base implementation (to raise a :exc:" "`TypeError`)." msgstr "" -#: library/json.rst:485 +#: library/json.rst:553 msgid "" "For example, to support arbitrary iterators, you could implement :meth:" "`~JSONEncoder.default` like this::" msgstr "" -#: library/json.rst:501 +#: library/json.rst:556 +msgid "" +"def default(self, o):\n" +" try:\n" +" iterable = iter(o)\n" +" except TypeError:\n" +" pass\n" +" else:\n" +" return list(iterable)\n" +" # Let the base class default method raise the TypeError\n" +" return super().default(o)" +msgstr "" + +#: library/json.rst:569 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" msgstr "" -#: library/json.rst:510 +#: library/json.rst:572 +msgid "" +">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" +"'{\"foo\": [\"bar\", \"baz\"]}'" +msgstr "" + +#: library/json.rst:578 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" msgstr "" -#: library/json.rst:518 +#: library/json.rst:581 +msgid "" +"for chunk in json.JSONEncoder().iterencode(bigobject):\n" +" mysocket.write(chunk)" +msgstr "" + +#: library/json.rst:586 msgid "Exceptions" msgstr "" -#: library/json.rst:522 +#: library/json.rst:590 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr "" -#: library/json.rst:526 +#: library/json.rst:594 msgid "The unformatted error message." msgstr "" -#: library/json.rst:530 +#: library/json.rst:598 msgid "The JSON document being parsed." msgstr "" -#: library/json.rst:534 +#: library/json.rst:602 msgid "The start index of *doc* where parsing failed." msgstr "" -#: library/json.rst:538 +#: library/json.rst:606 msgid "The line corresponding to *pos*." msgstr "" -#: library/json.rst:542 +#: library/json.rst:610 msgid "The column corresponding to *pos*." msgstr "" -#: library/json.rst:548 +#: library/json.rst:616 msgid "Standard Compliance and Interoperability" msgstr "" -#: library/json.rst:550 +#: library/json.rst:618 msgid "" -"The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. " -"This section details this module's level of compliance with the RFC. For " +"The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. This " +"section details this module's level of compliance with the RFC. For " "simplicity, :class:`JSONEncoder` and :class:`JSONDecoder` subclasses, and " "parameters other than those explicitly mentioned, are not considered." msgstr "" -#: library/json.rst:556 +#: library/json.rst:624 msgid "" "This module does not comply with the RFC in a strict fashion, implementing " "some extensions that are valid JavaScript but not valid JSON. In particular:" msgstr "" -#: library/json.rst:559 +#: library/json.rst:627 msgid "Infinite and NaN number values are accepted and output;" msgstr "" -#: library/json.rst:560 +#: library/json.rst:628 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." msgstr "" -#: library/json.rst:563 +#: library/json.rst:631 msgid "" "Since the RFC permits RFC-compliant parsers to accept input texts that are " "not RFC-compliant, this module's deserializer is technically RFC-compliant " "under default settings." msgstr "" -#: library/json.rst:568 +#: library/json.rst:636 msgid "Character Encodings" msgstr "" -#: library/json.rst:570 +#: library/json.rst:638 msgid "" "The RFC requires that JSON be represented using either UTF-8, UTF-16, or " "UTF-32, with UTF-8 being the recommended default for maximum " "interoperability." msgstr "" -#: library/json.rst:573 +#: library/json.rst:641 msgid "" "As permitted, though not required, by the RFC, this module's serializer sets " "*ensure_ascii=True* by default, thus escaping the output so that the " -"resulting strings only contain ASCII characters." +"resulting strings only contain printable ASCII characters." msgstr "" -#: library/json.rst:577 +#: library/json.rst:645 msgid "" "Other than the *ensure_ascii* parameter, this module is defined strictly in " "terms of conversion between Python objects and :class:`Unicode strings " @@ -639,7 +869,7 @@ msgid "" "encodings." msgstr "" -#: library/json.rst:582 +#: library/json.rst:650 msgid "" "The RFC prohibits adding a byte order mark (BOM) to the start of a JSON " "text, and this module's serializer does not add a BOM to its output. The RFC " @@ -648,7 +878,7 @@ msgid "" "an initial BOM is present." msgstr "" -#: library/json.rst:588 +#: library/json.rst:656 msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " @@ -657,29 +887,44 @@ msgid "" "class:`str`) code points for such sequences." msgstr "" -#: library/json.rst:596 +#: library/json.rst:664 msgid "Infinite and NaN Number Values" msgstr "" -#: library/json.rst:598 +#: library/json.rst:666 msgid "" "The RFC does not permit the representation of infinite or NaN number values. " "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" "Infinity``, and ``NaN`` as if they were valid JSON number literal values::" msgstr "" -#: library/json.rst:613 +#: library/json.rst:670 +msgid "" +">>> # Neither of these calls raises an exception, but the results are not " +"valid JSON\n" +">>> json.dumps(float('-inf'))\n" +"'-Infinity'\n" +">>> json.dumps(float('nan'))\n" +"'NaN'\n" +">>> # Same when deserializing\n" +">>> json.loads('-Infinity')\n" +"-inf\n" +">>> json.loads('NaN')\n" +"nan" +msgstr "" + +#: library/json.rst:681 msgid "" "In the serializer, the *allow_nan* parameter can be used to alter this " "behavior. In the deserializer, the *parse_constant* parameter can be used " "to alter this behavior." msgstr "" -#: library/json.rst:619 +#: library/json.rst:687 msgid "Repeated Names Within an Object" msgstr "" -#: library/json.rst:621 +#: library/json.rst:689 msgid "" "The RFC specifies that the names within a JSON object should be unique, but " "does not mandate how repeated names in JSON objects should be handled. By " @@ -687,15 +932,22 @@ msgid "" "but the last name-value pair for a given name::" msgstr "" -#: library/json.rst:630 +#: library/json.rst:694 +msgid "" +">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" +">>> json.loads(weird_json)\n" +"{'x': 3}" +msgstr "" + +#: library/json.rst:698 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." msgstr "" -#: library/json.rst:634 +#: library/json.rst:702 msgid "Top-level Non-Object, Non-Array Values" msgstr "" -#: library/json.rst:636 +#: library/json.rst:704 msgid "" "The old version of JSON specified by the obsolete :rfc:`4627` required that " "the top-level value of a JSON text must be either a JSON object or array " @@ -705,43 +957,43 @@ msgid "" "its serializer or its deserializer." msgstr "" -#: library/json.rst:643 +#: library/json.rst:711 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." msgstr "" -#: library/json.rst:648 +#: library/json.rst:716 msgid "Implementation Limitations" msgstr "" -#: library/json.rst:650 +#: library/json.rst:718 msgid "Some JSON deserializer implementations may set limits on:" msgstr "" -#: library/json.rst:652 +#: library/json.rst:720 msgid "the size of accepted JSON texts" msgstr "" -#: library/json.rst:653 +#: library/json.rst:721 msgid "the maximum level of nesting of JSON objects and arrays" msgstr "" -#: library/json.rst:654 +#: library/json.rst:722 msgid "the range and precision of JSON numbers" msgstr "" -#: library/json.rst:655 +#: library/json.rst:723 msgid "the content and maximum length of JSON strings" msgstr "" -#: library/json.rst:657 +#: library/json.rst:725 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." msgstr "" -#: library/json.rst:660 +#: library/json.rst:728 msgid "" "When serializing to JSON, beware any such limitations in applications that " "may consume your JSON. In particular, it is common for JSON numbers to be " @@ -752,77 +1004,110 @@ msgid "" "as :class:`decimal.Decimal`." msgstr "" -#: library/json.rst:673 -msgid "Command Line Interface" +#: library/json.rst:741 +msgid "Command-line interface" msgstr "" -#: library/json.rst:678 +#: library/json.rst:746 msgid "**Source code:** :source:`Lib/json/tool.py`" msgstr "" -#: library/json.rst:682 +#: library/json.rst:750 msgid "" -"The :mod:`json.tool` module provides a simple command line interface to " -"validate and pretty-print JSON objects." +"The :mod:`json` module can be invoked as a script via ``python -m json`` to " +"validate and pretty-print JSON objects. The :mod:`json.tool` submodule " +"implements this interface." msgstr "" -#: library/json.rst:685 +#: library/json.rst:754 msgid "" "If the optional ``infile`` and ``outfile`` arguments are not specified, :" "data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" msgstr "" -#: library/json.rst:697 +#: library/json.rst:757 +msgid "" +"$ echo '{\"json\": \"obj\"}' | python -m json\n" +"{\n" +" \"json\": \"obj\"\n" +"}\n" +"$ echo '{1.2:3.4}' | python -m json\n" +"Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" +msgstr "" + +#: library/json.rst:766 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." msgstr "" -#: library/json.rst:704 -msgid "Command line options" +#: library/json.rst:771 +msgid "" +"The :mod:`json` module may now be directly executed as ``python -m json``. " +"For backwards compatibility, invoking the CLI as ``python -m json.tool`` " +"remains supported." msgstr "" -#: library/json.rst:708 +#: library/json.rst:778 +msgid "Command-line options" +msgstr "" + +#: library/json.rst:782 msgid "The JSON file to be validated or pretty-printed:" msgstr "" -#: library/json.rst:724 +#: library/json.rst:784 +msgid "" +"$ python -m json mp_films.json\n" +"[\n" +" {\n" +" \"title\": \"And Now for Something Completely Different\",\n" +" \"year\": 1971\n" +" },\n" +" {\n" +" \"title\": \"Monty Python and the Holy Grail\",\n" +" \"year\": 1975\n" +" }\n" +"]" +msgstr "" + +#: library/json.rst:798 msgid "If *infile* is not specified, read from :data:`sys.stdin`." msgstr "" -#: library/json.rst:728 +#: library/json.rst:802 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" -#: library/json.rst:733 +#: library/json.rst:807 msgid "Sort the output of dictionaries alphabetically by key." msgstr "" -#: library/json.rst:739 +#: library/json.rst:813 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "" -#: library/json.rst:745 +#: library/json.rst:819 msgid "Parse every input line as separate JSON object." msgstr "" -#: library/json.rst:751 +#: library/json.rst:825 msgid "Mutually exclusive options for whitespace control." msgstr "" -#: library/json.rst:757 +#: library/json.rst:831 msgid "Show the help message." msgstr "" -#: library/json.rst:761 +#: library/json.rst:835 msgid "Footnotes" msgstr "" -#: library/json.rst:762 +#: library/json.rst:836 msgid "" "As noted in `the errata for RFC 7159 `_, JSON permits literal U+2028 (LINE SEPARATOR) " diff --git a/library/keyword.po b/library/keyword.po index 57237be0..73fff2db 100644 --- a/library/keyword.po +++ b/library/keyword.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/keyword.rst:2 -msgid ":mod:`keyword` --- Testing for Python keywords" +msgid ":mod:`!keyword` --- Testing for Python keywords" msgstr "" #: library/keyword.rst:7 diff --git a/library/language.po b/library/language.po index 187f3380..91eabfaa 100644 --- a/library/language.po +++ b/library/language.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/linecache.po b/library/linecache.po index 0486c2aa..7eac175a 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/linecache.rst:2 -msgid ":mod:`linecache` --- Random access to text lines" +msgid ":mod:`!linecache` --- Random access to text lines" msgstr "" #: library/linecache.rst:9 @@ -53,6 +54,13 @@ msgstr "" #: library/linecache.rst:33 msgid "" +"If *filename* indicates a frozen module (starting with ``'>> import linecache\n" +">>> linecache.getline(linecache.__file__, 8)\n" +"'import sys\\n'" +msgstr "" + #: library/linecache.rst:31 msgid "module" msgstr "" diff --git a/library/locale.po b/library/locale.po index aec58e5a..36351f2b 100644 --- a/library/locale.po +++ b/library/locale.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/locale.rst:2 -msgid ":mod:`locale` --- Internationalization services" +msgid ":mod:`!locale` --- Internationalization services" msgstr "" #: library/locale.rst:10 @@ -52,27 +53,39 @@ msgstr "" msgid "" "If *locale* is given and not ``None``, :func:`setlocale` modifies the locale " "setting for the *category*. The available categories are listed in the data " -"description below. *locale* may be a string, or an iterable of two strings " -"(language code and encoding). If it's an iterable, it's converted to a " -"locale name using the locale aliasing engine. An empty string specifies the " -"user's default settings. If the modification of the locale fails, the " -"exception :exc:`Error` is raised. If successful, the new locale setting is " -"returned." +"description below. *locale* may be a :ref:`string `, or a pair, " +"language code and encoding. An empty string specifies the user's default " +"settings. If the modification of the locale fails, the exception :exc:" +"`Error` is raised. If successful, the new locale setting is returned." +msgstr "" + +#: library/locale.rst:42 +msgid "" +"If *locale* is a pair, it is converted to a locale name using the locale " +"aliasing engine. The language code has the same format as a :ref:`locale " +"name `, but without encoding and ``@``-modifier. The language " +"code and encoding can be ``None``." msgstr "" -#: library/locale.rst:43 +#: library/locale.rst:48 msgid "" "If *locale* is omitted or ``None``, the current setting for *category* is " "returned." msgstr "" -#: library/locale.rst:46 +#: library/locale.rst:51 msgid "" ":func:`setlocale` is not thread-safe on most systems. Applications typically " "start with a call of ::" msgstr "" -#: library/locale.rst:52 +#: library/locale.rst:54 +msgid "" +"import locale\n" +"locale.setlocale(locale.LC_ALL, '')" +msgstr "" + +#: library/locale.rst:57 msgid "" "This sets the locale for all categories to the user's default setting " "(typically specified in the :envvar:`LANG` environment variable). If the " @@ -80,41 +93,41 @@ msgid "" "problems." msgstr "" -#: library/locale.rst:59 +#: library/locale.rst:64 msgid "" "Returns the database of the local conventions as a dictionary. This " "dictionary has the following strings as keys:" msgstr "" -#: library/locale.rst:65 +#: library/locale.rst:70 msgid "Category" msgstr "" -#: library/locale.rst:65 +#: library/locale.rst:70 msgid "Key" msgstr "" -#: library/locale.rst:65 +#: library/locale.rst:70 msgid "Meaning" msgstr "" -#: library/locale.rst:67 +#: library/locale.rst:72 msgid ":const:`LC_NUMERIC`" msgstr "" -#: library/locale.rst:67 +#: library/locale.rst:72 msgid "``'decimal_point'``" msgstr "" -#: library/locale.rst:67 +#: library/locale.rst:72 msgid "Decimal point character." msgstr "" -#: library/locale.rst:69 +#: library/locale.rst:74 msgid "``'grouping'``" msgstr "" -#: library/locale.rst:69 +#: library/locale.rst:74 msgid "" "Sequence of numbers specifying which relative positions the " "``'thousands_sep'`` is expected. If the sequence is terminated with :const:" @@ -122,204 +135,204 @@ msgid "" "with a ``0``, the last group size is repeatedly used." msgstr "" -#: library/locale.rst:80 +#: library/locale.rst:85 msgid "``'thousands_sep'``" msgstr "" -#: library/locale.rst:80 +#: library/locale.rst:85 msgid "Character used between groups." msgstr "" -#: library/locale.rst:82 +#: library/locale.rst:87 msgid ":const:`LC_MONETARY`" msgstr "" -#: library/locale.rst:82 +#: library/locale.rst:87 msgid "``'int_curr_symbol'``" msgstr "" -#: library/locale.rst:82 +#: library/locale.rst:87 msgid "International currency symbol." msgstr "" -#: library/locale.rst:84 +#: library/locale.rst:89 msgid "``'currency_symbol'``" msgstr "" -#: library/locale.rst:84 +#: library/locale.rst:89 msgid "Local currency symbol." msgstr "" -#: library/locale.rst:86 +#: library/locale.rst:91 msgid "``'p_cs_precedes/n_cs_precedes'``" msgstr "" -#: library/locale.rst:86 +#: library/locale.rst:91 msgid "" "Whether the currency symbol precedes the value (for positive resp. negative " "values)." msgstr "" -#: library/locale.rst:91 +#: library/locale.rst:96 msgid "``'p_sep_by_space/n_sep_by_space'``" msgstr "" -#: library/locale.rst:91 +#: library/locale.rst:96 msgid "" "Whether the currency symbol is separated from the value by a space (for " "positive resp. negative values)." msgstr "" -#: library/locale.rst:96 +#: library/locale.rst:101 msgid "``'mon_decimal_point'``" msgstr "" -#: library/locale.rst:96 +#: library/locale.rst:101 msgid "Decimal point used for monetary values." msgstr "" -#: library/locale.rst:99 +#: library/locale.rst:104 msgid "``'frac_digits'``" msgstr "" -#: library/locale.rst:99 +#: library/locale.rst:104 msgid "" "Number of fractional digits used in local formatting of monetary values." msgstr "" -#: library/locale.rst:103 +#: library/locale.rst:108 msgid "``'int_frac_digits'``" msgstr "" -#: library/locale.rst:103 +#: library/locale.rst:108 msgid "" "Number of fractional digits used in international formatting of monetary " "values." msgstr "" -#: library/locale.rst:107 +#: library/locale.rst:112 msgid "``'mon_thousands_sep'``" msgstr "" -#: library/locale.rst:107 +#: library/locale.rst:112 msgid "Group separator used for monetary values." msgstr "" -#: library/locale.rst:110 +#: library/locale.rst:115 msgid "``'mon_grouping'``" msgstr "" -#: library/locale.rst:110 +#: library/locale.rst:115 msgid "Equivalent to ``'grouping'``, used for monetary values." msgstr "" -#: library/locale.rst:113 +#: library/locale.rst:118 msgid "``'positive_sign'``" msgstr "" -#: library/locale.rst:113 +#: library/locale.rst:118 msgid "Symbol used to annotate a positive monetary value." msgstr "" -#: library/locale.rst:116 +#: library/locale.rst:121 msgid "``'negative_sign'``" msgstr "" -#: library/locale.rst:116 +#: library/locale.rst:121 msgid "Symbol used to annotate a negative monetary value." msgstr "" -#: library/locale.rst:119 +#: library/locale.rst:124 msgid "``'p_sign_posn/n_sign_posn'``" msgstr "" -#: library/locale.rst:119 +#: library/locale.rst:124 msgid "" "The position of the sign (for positive resp. negative values), see below." msgstr "" -#: library/locale.rst:124 +#: library/locale.rst:129 msgid "" "All numeric values can be set to :const:`CHAR_MAX` to indicate that there is " "no value specified in this locale." msgstr "" -#: library/locale.rst:127 +#: library/locale.rst:132 msgid "" "The possible values for ``'p_sign_posn'`` and ``'n_sign_posn'`` are given " "below." msgstr "" -#: library/locale.rst:130 +#: library/locale.rst:135 msgid "Value" msgstr "" -#: library/locale.rst:130 +#: library/locale.rst:135 msgid "Explanation" msgstr "" -#: library/locale.rst:132 +#: library/locale.rst:137 msgid "``0``" msgstr "" -#: library/locale.rst:132 +#: library/locale.rst:137 msgid "Currency and value are surrounded by parentheses." msgstr "" -#: library/locale.rst:135 +#: library/locale.rst:140 msgid "``1``" msgstr "" -#: library/locale.rst:135 +#: library/locale.rst:140 msgid "The sign should precede the value and currency symbol." msgstr "" -#: library/locale.rst:138 +#: library/locale.rst:143 msgid "``2``" msgstr "" -#: library/locale.rst:138 +#: library/locale.rst:143 msgid "The sign should follow the value and currency symbol." msgstr "" -#: library/locale.rst:141 +#: library/locale.rst:146 msgid "``3``" msgstr "" -#: library/locale.rst:141 +#: library/locale.rst:146 msgid "The sign should immediately precede the value." msgstr "" -#: library/locale.rst:144 +#: library/locale.rst:149 msgid "``4``" msgstr "" -#: library/locale.rst:144 +#: library/locale.rst:149 msgid "The sign should immediately follow the value." msgstr "" -#: library/locale.rst:147 +#: library/locale.rst:152 msgid "``CHAR_MAX``" msgstr "" -#: library/locale.rst:147 +#: library/locale.rst:152 msgid "Nothing is specified in this locale." msgstr "" -#: library/locale.rst:150 +#: library/locale.rst:155 msgid "" "The function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " "locale or the ``LC_MONETARY`` locale if locales are different and numeric or " "monetary strings are non-ASCII. This temporary change affects other threads." msgstr "" -#: library/locale.rst:154 +#: library/locale.rst:159 msgid "" "The function now temporarily sets the ``LC_CTYPE`` locale to the " "``LC_NUMERIC`` locale in some cases." msgstr "" -#: library/locale.rst:161 +#: library/locale.rst:166 msgid "" "Return some locale-specific information as a string. This function is not " "available on all systems, and the set of possible options might also vary " @@ -327,104 +340,106 @@ msgid "" "symbolic constants are available in the locale module." msgstr "" -#: library/locale.rst:166 +#: library/locale.rst:171 msgid "" "The :func:`nl_langinfo` function accepts one of the following keys. Most " "descriptions are taken from the corresponding description in the GNU C " "library." msgstr "" -#: library/locale.rst:172 +#: library/locale.rst:177 msgid "" "Get a string with the name of the character encoding used in the selected " "locale." msgstr "" -#: library/locale.rst:177 +#: library/locale.rst:182 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent date and time in a locale-specific way." msgstr "" -#: library/locale.rst:182 +#: library/locale.rst:187 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a date in a locale-specific way." msgstr "" -#: library/locale.rst:187 +#: library/locale.rst:192 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a time in a locale-specific way." msgstr "" -#: library/locale.rst:192 +#: library/locale.rst:197 msgid "" "Get a format string for :func:`time.strftime` to represent time in the am/pm " "format." msgstr "" -#: library/locale.rst:203 +#: library/locale.rst:208 msgid "Get the name of the n-th day of the week." msgstr "" -#: library/locale.rst:207 +#: library/locale.rst:212 msgid "" "This follows the US convention of :const:`DAY_1` being Sunday, not the " "international convention (ISO 8601) that Monday is the first day of the week." msgstr "" -#: library/locale.rst:219 +#: library/locale.rst:224 msgid "Get the abbreviated name of the n-th day of the week." msgstr "" -#: library/locale.rst:234 +#: library/locale.rst:239 msgid "Get the name of the n-th month." msgstr "" -#: library/locale.rst:249 +#: library/locale.rst:254 msgid "Get the abbreviated name of the n-th month." msgstr "" -#: library/locale.rst:253 +#: library/locale.rst:258 msgid "Get the radix character (decimal dot, decimal comma, etc.)." msgstr "" -#: library/locale.rst:257 +#: library/locale.rst:262 msgid "Get the separator character for thousands (groups of three digits)." msgstr "" -#: library/locale.rst:261 +#: library/locale.rst:266 msgid "" "Get a regular expression that can be used with the regex function to " "recognize a positive response to a yes/no question." msgstr "" -#: library/locale.rst:266 +#: library/locale.rst:271 msgid "" "Get a regular expression that can be used with the ``regex(3)`` function to " "recognize a negative response to a yes/no question." msgstr "" -#: library/locale.rst:271 +#: library/locale.rst:276 msgid "" "The regular expressions for :const:`YESEXPR` and :const:`NOEXPR` use syntax " "suitable for the ``regex`` function from the C library, which might differ " "from the syntax used in :mod:`re`." msgstr "" -#: library/locale.rst:278 +#: library/locale.rst:283 msgid "" "Get the currency symbol, preceded by \"-\" if the symbol should appear " "before the value, \"+\" if the symbol should appear after the value, or \"." "\" if the symbol should replace the radix character." msgstr "" -#: library/locale.rst:284 -msgid "Get a string that represents the era used in the current locale." +#: library/locale.rst:289 +msgid "" +"Get a string which describes how years are counted and displayed for each " +"era in a locale." msgstr "" -#: library/locale.rst:286 +#: library/locale.rst:292 msgid "" "Most locales do not define this value. An example of a locale which does " "define this value is the Japanese one. In Japan, the traditional " @@ -432,46 +447,61 @@ msgid "" "then-emperor's reign." msgstr "" -#: library/locale.rst:291 +#: library/locale.rst:297 msgid "" "Normally it should not be necessary to use this value directly. Specifying " "the ``E`` modifier in their format strings causes the :func:`time.strftime` " -"function to use this information. The format of the returned string is not " -"specified, and therefore you should not assume knowledge of it on different " -"systems." +"function to use this information. The format of the returned string is " +"specified in *The Open Group Base Specifications Issue 8*, paragraph " +"`7.3.5.2 LC_TIME C-Language Access `_." msgstr "" -#: library/locale.rst:299 +#: library/locale.rst:306 msgid "" "Get a format string for :func:`time.strftime` to represent date and time in " "a locale-specific era-based way." msgstr "" -#: library/locale.rst:304 +#: library/locale.rst:311 msgid "" "Get a format string for :func:`time.strftime` to represent a date in a " "locale-specific era-based way." msgstr "" -#: library/locale.rst:309 +#: library/locale.rst:316 msgid "" "Get a format string for :func:`time.strftime` to represent a time in a " "locale-specific era-based way." msgstr "" -#: library/locale.rst:314 +#: library/locale.rst:321 +msgid "" +"Get a string consisting of up to 100 semicolon-separated symbols used to " +"represent the values 0 to 99 in a locale-specific way. In most locales this " +"is an empty string." +msgstr "" + +#: library/locale.rst:325 +msgid "" +"The function temporarily sets the ``LC_CTYPE`` locale to the locale of the " +"category that determines the requested value (``LC_TIME``, ``LC_NUMERIC``, " +"``LC_MONETARY`` or ``LC_MESSAGES``) if locales are different and the " +"resulting string is non-ASCII. This temporary change affects other threads." +msgstr "" + +#: library/locale.rst:331 msgid "" -"Get a representation of up to 100 values used to represent the values 0 to " -"99." +"The function now temporarily sets the ``LC_CTYPE`` locale in some cases." msgstr "" -#: library/locale.rst:320 +#: library/locale.rst:337 msgid "" "Tries to determine the default locale settings and returns them as a tuple " "of the form ``(language code, encoding)``." msgstr "" -#: library/locale.rst:323 +#: library/locale.rst:340 msgid "" "According to POSIX, a program which has not called ``setlocale(LC_ALL, '')`` " "runs using the portable ``'C'`` locale. Calling ``setlocale(LC_ALL, '')`` " @@ -480,7 +510,7 @@ msgid "" "emulate the behavior in the way described above." msgstr "" -#: library/locale.rst:329 +#: library/locale.rst:346 msgid "" "To maintain compatibility with other platforms, not only the :envvar:`LANG` " "variable is tested, but a list of variables given as envvars parameter. The " @@ -490,21 +520,23 @@ msgid "" "``'LC_CTYPE'``, ``'LANG'`` and ``'LANGUAGE'``, in that order." msgstr "" -#: library/locale.rst:349 +#: library/locale.rst:368 msgid "" -"Except for the code ``'C'``, the language code corresponds to :rfc:`1766`. " -"*language code* and *encoding* may be ``None`` if their values cannot be " -"determined." +"The language code has the same format as a :ref:`locale name `, " +"but without encoding and ``@``-modifier. The language code and encoding may " +"be ``None`` if their values cannot be determined. The \"C\" locale is " +"represented as ``(None, None)``." msgstr "" -#: library/locale.rst:345 +#: library/locale.rst:364 msgid "" -"Returns the current setting for the given locale category as sequence " -"containing *language code*, *encoding*. *category* may be one of the :const:" -"`!LC_\\*` values except :const:`LC_ALL`. It defaults to :const:`LC_CTYPE`." +"Returns the current setting for the given locale category as a tuple " +"containing the language code and encoding. *category* may be one of the :" +"const:`!LC_\\*` values except :const:`LC_ALL`. It defaults to :const:" +"`LC_CTYPE`." msgstr "" -#: library/locale.rst:356 +#: library/locale.rst:377 msgid "" "Return the :term:`locale encoding` used for text data, according to user " "preferences. User preferences are expressed differently on different " @@ -512,82 +544,72 @@ msgid "" "this function only returns a guess." msgstr "" -#: library/locale.rst:361 +#: library/locale.rst:382 msgid "" "On some systems, it is necessary to invoke :func:`setlocale` to obtain the " "user preferences, so this function is not thread-safe. If invoking setlocale " "is not necessary or desired, *do_setlocale* should be set to ``False``." msgstr "" -#: library/locale.rst:365 +#: library/locale.rst:386 msgid "" "On Android or if the :ref:`Python UTF-8 Mode ` is enabled, always " "return ``'utf-8'``, the :term:`locale encoding` and the *do_setlocale* " "argument are ignored." msgstr "" -#: library/locale.rst:387 +#: library/locale.rst:408 msgid "" "The :ref:`Python preinitialization ` configures the LC_CTYPE " "locale. See also the :term:`filesystem encoding and error handler`." msgstr "" -#: library/locale.rst:372 +#: library/locale.rst:393 msgid "" "The function now always returns ``\"utf-8\"`` on Android or if the :ref:" "`Python UTF-8 Mode ` is enabled." msgstr "" -#: library/locale.rst:379 +#: library/locale.rst:400 msgid "Get the current :term:`locale encoding`:" msgstr "" -#: library/locale.rst:381 +#: library/locale.rst:402 msgid "On Android and VxWorks, return ``\"utf-8\"``." msgstr "" -#: library/locale.rst:382 +#: library/locale.rst:403 msgid "" "On Unix, return the encoding of the current :data:`LC_CTYPE` locale. Return " "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string: for " "example, if the current LC_CTYPE locale is not supported." msgstr "" -#: library/locale.rst:385 +#: library/locale.rst:406 msgid "On Windows, return the ANSI code page." msgstr "" -#: library/locale.rst:390 +#: library/locale.rst:411 msgid "" "This function is similar to :func:`getpreferredencoding(False) " "` except this function ignores the :ref:`Python UTF-8 " "Mode `." msgstr "" -#: library/locale.rst:399 +#: library/locale.rst:420 msgid "" "Returns a normalized locale code for the given locale name. The returned " "locale code is formatted for use with :func:`setlocale`. If normalization " "fails, the original name is returned unchanged." msgstr "" -#: library/locale.rst:403 +#: library/locale.rst:424 msgid "" "If the given encoding is not known, the function defaults to the default " "encoding for the locale code just like :func:`setlocale`." msgstr "" -#: library/locale.rst:409 -msgid "Sets the locale for *category* to the default setting." -msgstr "" - -#: library/locale.rst:411 -msgid "" -"The default setting is determined by calling :func:`getdefaultlocale`. " -"*category* defaults to :const:`LC_ALL`." -msgstr "" - -#: library/locale.rst:419 +#: library/locale.rst:430 msgid "" "Compares two strings according to the current :const:`LC_COLLATE` setting. " "As any other compare function, returns a negative, or a positive value, or " @@ -595,7 +617,7 @@ msgid "" "is equal to it." msgstr "" -#: library/locale.rst:427 +#: library/locale.rst:438 msgid "" "Transforms a string to one that can be used in locale-aware comparisons. " "For example, ``strxfrm(s1) < strxfrm(s2)`` is equivalent to ``strcoll(s1, " @@ -603,37 +625,37 @@ msgid "" "repeatedly, e.g. when collating a sequence of strings." msgstr "" -#: library/locale.rst:436 +#: library/locale.rst:447 msgid "" "Formats a number *val* according to the current :const:`LC_NUMERIC` setting. " -"The format follows the conventions of the ``%`` operator. For floating " +"The format follows the conventions of the ``%`` operator. For floating-" "point values, the decimal point is modified if appropriate. If *grouping* " "is ``True``, also takes the grouping into account." msgstr "" -#: library/locale.rst:441 +#: library/locale.rst:452 msgid "" "If *monetary* is true, the conversion uses monetary thousands separator and " "grouping strings." msgstr "" -#: library/locale.rst:444 +#: library/locale.rst:455 msgid "" "Processes formatting specifiers as in ``format % val``, but takes the " "current locale settings into account." msgstr "" -#: library/locale.rst:447 +#: library/locale.rst:458 msgid "The *monetary* keyword parameter was added." msgstr "" -#: library/locale.rst:453 +#: library/locale.rst:464 msgid "" "Formats a number *val* according to the current :const:`LC_MONETARY` " "settings." msgstr "" -#: library/locale.rst:455 +#: library/locale.rst:466 msgid "" "The returned string includes the currency symbol if *symbol* is true, which " "is the default. If *grouping* is ``True`` (which is not the default), " @@ -641,43 +663,43 @@ msgid "" "not the default), the international currency symbol is used." msgstr "" -#: library/locale.rst:462 +#: library/locale.rst:473 msgid "" "This function will not work with the 'C' locale, so you have to set a locale " "via :func:`setlocale` first." msgstr "" -#: library/locale.rst:468 +#: library/locale.rst:479 msgid "" -"Formats a floating point number using the same format as the built-in " +"Formats a floating-point number using the same format as the built-in " "function ``str(float)``, but takes the decimal point into account." msgstr "" -#: library/locale.rst:474 +#: library/locale.rst:485 msgid "" "Converts a string into a normalized number string, following the :const:" "`LC_NUMERIC` settings." msgstr "" -#: library/locale.rst:482 +#: library/locale.rst:493 msgid "" "Converts a normalized number string into a formatted string following the :" "const:`LC_NUMERIC` settings." msgstr "" -#: library/locale.rst:490 +#: library/locale.rst:501 msgid "" "Converts a string to a number, following the :const:`LC_NUMERIC` settings, " "by calling *func* on the result of calling :func:`delocalize` on *string*." msgstr "" -#: library/locale.rst:496 +#: library/locale.rst:507 msgid "" "Converts a string to an integer, following the :const:`LC_NUMERIC` " "conventions." msgstr "" -#: library/locale.rst:501 +#: library/locale.rst:512 msgid "" "Locale category for the character type functions. Most importantly, this " "category defines the text encoding, i.e. how bytes are interpreted as " @@ -687,32 +709,32 @@ msgid "" "SSH connections." msgstr "" -#: library/locale.rst:508 +#: library/locale.rst:519 msgid "" "Python doesn't internally use locale-dependent character transformation " -"functions from ``ctype.h``. Instead, an internal ``pyctype.h`` provides " -"locale-independent equivalents like :c:macro:`!Py_TOLOWER`." +"functions from ``ctype.h``. Instead, ``pyctype.h`` provides locale-" +"independent equivalents like :c:macro:`Py_TOLOWER`." msgstr "" -#: library/locale.rst:515 +#: library/locale.rst:526 msgid "" "Locale category for sorting strings. The functions :func:`strcoll` and :" "func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" -#: library/locale.rst:521 +#: library/locale.rst:532 msgid "" "Locale category for the formatting of time. The function :func:`time." "strftime` follows these conventions." msgstr "" -#: library/locale.rst:527 +#: library/locale.rst:538 msgid "" "Locale category for formatting of monetary values. The available options " "are available from the :func:`localeconv` function." msgstr "" -#: library/locale.rst:533 +#: library/locale.rst:544 msgid "" "Locale category for message display. Python currently does not support " "application specific locale-aware messages. Messages displayed by the " @@ -720,13 +742,13 @@ msgid "" "affected by this category." msgstr "" -#: library/locale.rst:538 +#: library/locale.rst:549 msgid "" "This value may not be available on operating systems not conforming to the " "POSIX standard, most notably Windows." msgstr "" -#: library/locale.rst:544 +#: library/locale.rst:555 msgid "" "Locale category for formatting numbers. The functions :func:" "`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` of the :mod:" @@ -734,7 +756,7 @@ msgid "" "operations are not affected." msgstr "" -#: library/locale.rst:552 +#: library/locale.rst:563 msgid "" "Combination of all locale settings. If this flag is used when the locale is " "changed, setting the locale for all categories is attempted. If that fails " @@ -744,21 +766,34 @@ msgid "" "settings." msgstr "" -#: library/locale.rst:561 +#: library/locale.rst:572 msgid "" "This is a symbolic constant used for different values returned by :func:" "`localeconv`." msgstr "" -#: library/locale.rst:565 +#: library/locale.rst:576 msgid "Example::" msgstr "" #: library/locale.rst:578 +msgid "" +">>> import locale\n" +">>> loc = locale.getlocale() # get current locale\n" +"# use German locale; name might vary with platform\n" +">>> locale.setlocale(locale.LC_ALL, 'de_DE')\n" +">>> locale.strcoll('f\\xe4n', 'foo') # compare a string containing an " +"umlaut\n" +">>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale\n" +">>> locale.setlocale(locale.LC_ALL, 'C') # use default (C) locale\n" +">>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale" +msgstr "" + +#: library/locale.rst:589 msgid "Background, details, hints, tips and caveats" msgstr "" -#: library/locale.rst:580 +#: library/locale.rst:591 msgid "" "The C standard defines the locale as a program-wide property that may be " "relatively expensive to change. On top of that, some implementations are " @@ -766,7 +801,7 @@ msgid "" "This makes the locale somewhat painful to use correctly." msgstr "" -#: library/locale.rst:585 +#: library/locale.rst:596 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " "matter what the user's preferred locale is. There is one exception: the :" @@ -776,7 +811,7 @@ msgid "" "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" -#: library/locale.rst:592 +#: library/locale.rst:603 msgid "" "It is generally a bad idea to call :func:`setlocale` in some library " "routine, since as a side effect it affects the entire program. Saving and " @@ -784,7 +819,7 @@ msgid "" "that happen to run before the settings have been restored." msgstr "" -#: library/locale.rst:597 +#: library/locale.rst:608 msgid "" "If, when coding a module for general use, you need a locale independent " "version of an operation that is affected by the locale (such as certain " @@ -795,14 +830,14 @@ msgid "" "settings." msgstr "" -#: library/locale.rst:604 +#: library/locale.rst:615 msgid "" "The only way to perform numeric operations according to the locale is to use " "the special functions defined by this module: :func:`atof`, :func:`atoi`, :" "func:`format_string`, :func:`.str`." msgstr "" -#: library/locale.rst:608 +#: library/locale.rst:619 msgid "" "There is no way to perform case conversions and character classifications " "according to the locale. For (Unicode) text strings these are done " @@ -813,11 +848,85 @@ msgid "" "whitespace." msgstr "" -#: library/locale.rst:619 +#: library/locale.rst:630 +msgid "Locale names" +msgstr "" + +#: library/locale.rst:632 +msgid "" +"The format of the locale name is platform dependent, and the set of " +"supported locales can depend on the system configuration." +msgstr "" + +#: library/locale.rst:635 +msgid "On Posix platforms, it usually has the format [1]_:" +msgstr "" + +#: library/locale.rst:640 +msgid "" +"where *language* is a two- or three-letter language code from `ISO 639`_, " +"*territory* is a two-letter country or region code from `ISO 3166`_, " +"*charset* is a locale encoding, and *modifier* is a script name, a language " +"subtag, a sort order identifier, or other locale modifier (for example, " +"\"latin\", \"valencia\", \"stroke\" and \"euro\")." +msgstr "" + +#: library/locale.rst:646 +msgid "" +"On Windows, several formats are supported. [2]_ [3]_ A subset of `IETF BCP " +"47`_ tags:" +msgstr "" + +#: library/locale.rst:653 +msgid "" +"where *language* and *territory* have the same meaning as in Posix, *script* " +"is a four-letter script code from `ISO 15924`_, and *modifier* is a language " +"subtag, a sort order identifier or custom modifier (for example, " +"\"valencia\", \"stroke\" or \"x-python\"). Both hyphen (``'-'``) and " +"underscore (``'_'``) separators are supported. Only UTF-8 encoding is " +"allowed for BCP 47 tags." +msgstr "" + +#: library/locale.rst:660 +msgid "Windows also supports locale names in the format:" +msgstr "" + +#: library/locale.rst:665 +msgid "" +"where *language* and *territory* are full names, such as \"English\" and " +"\"United States\", and *charset* is either a code page number (for example, " +"\"1252\") or UTF-8. Only the underscore separator is supported in this " +"format." +msgstr "" + +#: library/locale.rst:670 +msgid "The \"C\" locale is supported on all platforms." +msgstr "" + +#: library/locale.rst:677 +msgid "" +"`IEEE Std 1003.1-2024; 8.2 Internationalization Variables `_" +msgstr "" + +#: library/locale.rst:678 +msgid "" +"`UCRT Locale names, Languages, and Country/Region strings `_" +msgstr "" + +#: library/locale.rst:679 +msgid "" +"`Locale Names `_" +msgstr "" + +#: library/locale.rst:685 msgid "For extension writers and programs that embed Python" msgstr "" -#: library/locale.rst:621 +#: library/locale.rst:687 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -825,7 +934,7 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: library/locale.rst:626 +#: library/locale.rst:692 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " @@ -835,11 +944,11 @@ msgid "" "accessible as a shared library." msgstr "" -#: library/locale.rst:637 +#: library/locale.rst:703 msgid "Access to message catalogs" msgstr "" -#: library/locale.rst:646 +#: library/locale.rst:712 msgid "" "The locale module exposes the C library's gettext interface on systems that " "provide this interface. It consists of the functions :func:`gettext`, :func:" @@ -850,7 +959,7 @@ msgid "" "locating message catalogs." msgstr "" -#: library/locale.rst:653 +#: library/locale.rst:719 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/logging.config.po b/library/logging.config.po index bd215cf0..26cbe39f 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/logging.config.rst:2 -msgid ":mod:`logging.config` --- Logging configuration" +msgid ":mod:`!logging.config` --- Logging configuration" msgstr "" #: library/logging.config.rst:10 @@ -115,10 +116,16 @@ msgid "" "object to put the configuration into effect::" msgstr "" +#: library/logging.config.rst:68 +msgid "" +"def dictConfig(config):\n" +" dictConfigClass(config).configure()" +msgstr "" + #: library/logging.config.rst:71 msgid "" "For example, a subclass of :class:`DictConfigurator` could call " -"``DictConfigurator.__init__()`` in its own :meth:`__init__()`, then set up " +"``DictConfigurator.__init__()`` in its own :meth:`__init__`, then set up " "custom prefixes which would be usable in the subsequent :meth:`configure` " "call. :attr:`dictConfigClass` would be bound to this new subclass, and then :" "func:`dictConfig` could be called exactly as in the default, uncustomized " @@ -434,6 +441,23 @@ msgid "" "constructor. For example, given the snippet:" msgstr "" +#: library/logging.config.rst:306 +msgid "" +"handlers:\n" +" console:\n" +" class : logging.StreamHandler\n" +" formatter: brief\n" +" level : INFO\n" +" filters: [allow_foo]\n" +" stream : ext://sys.stdout\n" +" file:\n" +" class : logging.handlers.RotatingFileHandler\n" +" formatter: precise\n" +" filename: logconfig.log\n" +" maxBytes: 1024\n" +" backupCount: 3" +msgstr "" + #: library/logging.config.rst:322 msgid "" "the handler with id ``console`` is instantiated as a :class:`logging." @@ -567,6 +591,26 @@ msgstr "" msgid "So, for example, consider the following YAML snippet:" msgstr "" +#: library/logging.config.rst:420 +msgid "" +"formatters:\n" +" brief:\n" +" # configuration for formatter with id 'brief' goes here\n" +" precise:\n" +" # configuration for formatter with id 'precise' goes here\n" +"handlers:\n" +" h1: #This is an id\n" +" # configuration of handler with id 'h1' goes here\n" +" formatter: brief\n" +" h2: #This is another id\n" +" # configuration of handler with id 'h2' goes here\n" +" formatter: precise\n" +"loggers:\n" +" foo.bar.baz:\n" +" # other configuration for logger 'foo.bar.baz'\n" +" handlers: [h1, h2]" +msgstr "" + #: library/logging.config.rst:439 msgid "" "(Note: YAML used here because it's a little more readable than the " @@ -617,6 +661,21 @@ msgid "" "made available under the special key ``'()'``. Here's a concrete example:" msgstr "" +#: library/logging.config.rst:479 +msgid "" +"formatters:\n" +" brief:\n" +" format: '%(message)s'\n" +" default:\n" +" format: '%(asctime)s %(levelname)-8s %(name)-15s %(message)s'\n" +" datefmt: '%Y-%m-%d %H:%M:%S'\n" +" custom:\n" +" (): my.package.customFormatterFactory\n" +" bar: baz\n" +" spam: 99.9\n" +" answer: 42" +msgstr "" + #: library/logging.config.rst:493 msgid "" "The above YAML snippet defines three formatters. The first, with id " @@ -628,10 +687,25 @@ msgid "" "configuration sub-dictionaries::" msgstr "" +#: library/logging.config.rst:501 +msgid "" +"{\n" +" 'format' : '%(message)s'\n" +"}" +msgstr "" + #: library/logging.config.rst:505 msgid "and::" msgstr "" +#: library/logging.config.rst:507 +msgid "" +"{\n" +" 'format' : '%(asctime)s %(levelname)-8s %(name)-15s %(message)s',\n" +" 'datefmt' : '%Y-%m-%d %H:%M:%S'\n" +"}" +msgstr "" + #: library/logging.config.rst:512 msgid "" "respectively, and as these dictionaries do not contain the special key " @@ -641,6 +715,16 @@ msgid "" "is::" msgstr "" +#: library/logging.config.rst:518 +msgid "" +"{\n" +" '()' : 'my.package.customFormatterFactory',\n" +" 'bar' : 'baz',\n" +" 'spam' : 99.9,\n" +" 'answer' : 42\n" +"}" +msgstr "" + #: library/logging.config.rst:525 msgid "" "and this contains the special key ``'()'``, which means that user-defined " @@ -653,6 +737,10 @@ msgid "" "assumed to be returned by the call::" msgstr "" +#: library/logging.config.rst:535 +msgid "my.package.customFormatterFactory(bar='baz', spam=99.9, answer=42)" +msgstr "" + #: library/logging.config.rst:537 msgid "" "The values for keys such as ``bar``, ``spam`` and ``answer`` in the above " @@ -677,10 +765,24 @@ msgstr "" #: library/logging.config.rst:551 msgid "" -"You can also specify a special key ``'.'`` whose value is a dictionary is a " -"mapping of attribute names to values. If found, the specified attributes " -"will be set on the user-defined object before it is returned. Thus, with the " -"following configuration::" +"You can also specify a special key ``'.'`` whose value is a mapping of " +"attribute names to values. If found, the specified attributes will be set on " +"the user-defined object before it is returned. Thus, with the following " +"configuration::" +msgstr "" + +#: library/logging.config.rst:556 +msgid "" +"{\n" +" '()' : 'my.package.customFormatterFactory',\n" +" 'bar' : 'baz',\n" +" 'spam' : 99.9,\n" +" 'answer' : 42,\n" +" '.' {\n" +" 'foo': 'bar',\n" +" 'baz': 'bozz'\n" +" }\n" +"}" msgstr "" #: library/logging.config.rst:567 @@ -711,7 +813,7 @@ msgid "" "handler has been configured) it points to the configured handler instance. " "Thus, ``cfg://handlers.foo`` could resolve to either a dictionary or a " "handler instance. In general, it is wise to name handlers in a way such that " -"dependent handlers are configured _after_ any handlers they depend on; that " +"dependent handlers are configured *after* any handlers they depend on; that " "allows something like ``cfg://handlers.foo`` to be used in configuring a " "handler that depends on handler ``foo``. If that dependent handler were " "named ``bar``, problems would result, because the configuration of ``bar`` " @@ -780,6 +882,17 @@ msgid "" "resolution system allows the user to specify:" msgstr "" +#: library/logging.config.rst:651 +msgid "" +"handlers:\n" +" file:\n" +" # configuration of file handler goes here\n" +"\n" +" custom:\n" +" (): my.package.MyHandler\n" +" alternate: cfg://handlers.file" +msgstr "" + #: library/logging.config.rst:661 msgid "" "The literal string ``'cfg://handlers.file'`` will be resolved in an " @@ -789,6 +902,19 @@ msgid "" "format``. Thus, given the following snippet:" msgstr "" +#: library/logging.config.rst:667 +msgid "" +"handlers:\n" +" email:\n" +" class: logging.handlers.SMTPHandler\n" +" mailhost: localhost\n" +" fromaddr: my_app@domain.tld\n" +" toaddrs:\n" +" - support_team@domain.tld\n" +" - dev_team@domain.tld\n" +" subject: Houston, we have a problem." +msgstr "" + #: library/logging.config.rst:679 msgid "" "in the configuration, the string ``'cfg://handlers'`` would resolve to the " @@ -800,12 +926,13 @@ msgid "" "``subject`` value could be accessed using either ``'cfg://handlers.email." "subject'`` or, equivalently, ``'cfg://handlers.email[subject]'``. The " "latter form only needs to be used if the key contains spaces or non-" -"alphanumeric characters. If an index value consists only of decimal digits, " +"alphanumeric characters. Please note that the characters ``[`` and ``]`` are " +"not allowed in the keys. If an index value consists only of decimal digits, " "access will be attempted using the corresponding integer value, falling back " "to the string value if needed." msgstr "" -#: library/logging.config.rst:693 +#: library/logging.config.rst:694 msgid "" "Given a string ``cfg://handlers.myhandler.mykey.123``, this will resolve to " "``config_dict['handlers']['myhandler']['mykey']['123']``. If the string is " @@ -815,11 +942,11 @@ msgid "" "['mykey']['123']`` if that fails." msgstr "" -#: library/logging.config.rst:705 +#: library/logging.config.rst:706 msgid "Import resolution and custom importers" msgstr "" -#: library/logging.config.rst:707 +#: library/logging.config.rst:708 msgid "" "Import resolution, by default, uses the builtin :func:`__import__` function " "to do its importing. You may want to replace this with your own importing " @@ -831,17 +958,25 @@ msgid "" "instance level, you need to wrap it with :func:`staticmethod`. For example::" msgstr "" -#: library/logging.config.rst:722 +#: library/logging.config.rst:718 +msgid "" +"from importlib import import_module\n" +"from logging.config import BaseConfigurator\n" +"\n" +"BaseConfigurator.importer = staticmethod(import_module)" +msgstr "" + +#: library/logging.config.rst:723 msgid "" "You don't need to wrap with :func:`staticmethod` if you're setting the " "import callable on a configurator *instance*." msgstr "" -#: library/logging.config.rst:728 +#: library/logging.config.rst:729 msgid "Configuring QueueHandler and QueueListener" msgstr "" -#: library/logging.config.rst:730 +#: library/logging.config.rst:731 msgid "" "If you want to configure a :class:`~logging.handlers.QueueHandler`, noting " "that this is normally used in conjunction with a :class:`~logging.handlers." @@ -854,64 +989,84 @@ msgid "" "the example YAML snippet below." msgstr "" -#: library/logging.config.rst:751 +#: library/logging.config.rst:740 +msgid "" +"handlers:\n" +" qhand:\n" +" class: logging.handlers.QueueHandler\n" +" queue: my.module.queue_factory\n" +" listener: my.package.CustomListener\n" +" handlers:\n" +" - hand_name_1\n" +" - hand_name_2\n" +" ..." +msgstr "" + +#: library/logging.config.rst:752 msgid "The ``queue`` and ``listener`` keys are optional." msgstr "" -#: library/logging.config.rst:753 +#: library/logging.config.rst:754 msgid "" "If the ``queue`` key is present, the corresponding value can be one of the " "following:" msgstr "" -#: library/logging.config.rst:755 +#: library/logging.config.rst:756 msgid "" -"An actual instance of :class:`queue.Queue` or a subclass thereof. This is of " -"course only possible if you are constructing or modifying the configuration " -"dictionary in code." +"An object implementing the :meth:`Queue.put_nowait ` " +"and :meth:`Queue.get ` public API. For instance, this may " +"be an actual instance of :class:`queue.Queue` or a subclass thereof, or a " +"proxy obtained by :meth:`multiprocessing.managers.SyncManager.Queue`." msgstr "" -#: library/logging.config.rst:759 +#: library/logging.config.rst:761 msgid "" -"A string that resolves to a callable which, when called with no arguments, " -"returns the :class:`queue.Queue` instance to use. That callable could be a :" -"class:`queue.Queue` subclass or a function which returns a suitable queue " -"instance, such as ``my.module.queue_factory()``." +"This is of course only possible if you are constructing or modifying the " +"configuration dictionary in code." msgstr "" #: library/logging.config.rst:764 msgid "" +"A string that resolves to a callable which, when called with no arguments, " +"returns the queue instance to use. That callable could be a :class:`queue." +"Queue` subclass or a function which returns a suitable queue instance, such " +"as ``my.module.queue_factory()``." +msgstr "" + +#: library/logging.config.rst:769 +msgid "" "A dict with a ``'()'`` key which is constructed in the usual way as " "discussed in :ref:`logging-config-dict-userdef`. The result of this " "construction should be a :class:`queue.Queue` instance." msgstr "" -#: library/logging.config.rst:768 +#: library/logging.config.rst:773 msgid "" "If the ``queue`` key is absent, a standard unbounded :class:`queue.Queue` " "instance is created and used." msgstr "" -#: library/logging.config.rst:771 +#: library/logging.config.rst:776 msgid "" "If the ``listener`` key is present, the corresponding value can be one of " "the following:" msgstr "" -#: library/logging.config.rst:773 +#: library/logging.config.rst:778 msgid "" "A subclass of :class:`logging.handlers.QueueListener`. This is of course " "only possible if you are constructing or modifying the configuration " "dictionary in code." msgstr "" -#: library/logging.config.rst:777 +#: library/logging.config.rst:782 msgid "" "A string which resolves to a class which is a subclass of ``QueueListener``, " "such as ``'my.package.CustomListener'``." msgstr "" -#: library/logging.config.rst:780 +#: library/logging.config.rst:785 msgid "" "A dict with a ``'()'`` key which is constructed in the usual way as " "discussed in :ref:`logging-config-dict-userdef`. The result of this " @@ -919,31 +1074,31 @@ msgid "" "``QueueListener`` initializer." msgstr "" -#: library/logging.config.rst:784 +#: library/logging.config.rst:789 msgid "" "If the ``listener`` key is absent, :class:`logging.handlers.QueueListener` " "is used." msgstr "" -#: library/logging.config.rst:786 +#: library/logging.config.rst:791 msgid "" "The values under the ``handlers`` key are the names of other handlers in the " "configuration (not shown in the above snippet) which will be passed to the " "queue listener." msgstr "" -#: library/logging.config.rst:790 +#: library/logging.config.rst:795 msgid "" "Any custom queue handler and listener classes will need to be defined with " "the same initialization signatures as :class:`~logging.handlers." "QueueHandler` and :class:`~logging.handlers.QueueListener`." msgstr "" -#: library/logging.config.rst:799 +#: library/logging.config.rst:804 msgid "Configuration file format" msgstr "" -#: library/logging.config.rst:801 +#: library/logging.config.rst:806 msgid "" "The configuration file format understood by :func:`fileConfig` is based on :" "mod:`configparser` functionality. The file must contain sections called " @@ -960,7 +1115,7 @@ msgid "" "specified in a section called ``[logger_root]``." msgstr "" -#: library/logging.config.rst:816 +#: library/logging.config.rst:821 msgid "" "The :func:`fileConfig` API is older than the :func:`dictConfig` API and does " "not provide functionality to cover certain aspects of logging. For example, " @@ -973,17 +1128,36 @@ msgid "" "when it's convenient to do so." msgstr "" -#: library/logging.config.rst:826 +#: library/logging.config.rst:831 msgid "Examples of these sections in the file are given below." msgstr "" -#: library/logging.config.rst:839 +#: library/logging.config.rst:833 +msgid "" +"[loggers]\n" +"keys=root,log02,log03,log04,log05,log06,log07\n" +"\n" +"[handlers]\n" +"keys=hand01,hand02,hand03,hand04,hand05,hand06,hand07,hand08,hand09\n" +"\n" +"[formatters]\n" +"keys=form01,form02,form03,form04,form05,form06,form07,form08,form09" +msgstr "" + +#: library/logging.config.rst:844 msgid "" "The root logger must specify a level and a list of handlers. An example of a " "root logger section is given below." msgstr "" -#: library/logging.config.rst:848 +#: library/logging.config.rst:847 +msgid "" +"[logger_root]\n" +"level=NOTSET\n" +"handlers=hand01" +msgstr "" + +#: library/logging.config.rst:853 msgid "" "The ``level`` entry can be one of ``DEBUG, INFO, WARNING, ERROR, CRITICAL`` " "or ``NOTSET``. For the root logger only, ``NOTSET`` means that all messages " @@ -991,7 +1165,7 @@ msgid "" "of the ``logging`` package's namespace." msgstr "" -#: library/logging.config.rst:853 +#: library/logging.config.rst:858 msgid "" "The ``handlers`` entry is a comma-separated list of handler names, which " "must appear in the ``[handlers]`` section. These names must appear in the " @@ -999,13 +1173,22 @@ msgid "" "file." msgstr "" -#: library/logging.config.rst:858 +#: library/logging.config.rst:863 msgid "" "For loggers other than the root logger, some additional information is " "required. This is illustrated by the following example." msgstr "" -#: library/logging.config.rst:869 +#: library/logging.config.rst:866 +msgid "" +"[logger_parser]\n" +"level=DEBUG\n" +"handlers=hand01\n" +"propagate=1\n" +"qualname=compiler.parser" +msgstr "" + +#: library/logging.config.rst:874 msgid "" "The ``level`` and ``handlers`` entries are interpreted as for the root " "logger, except that if a non-root logger's level is specified as ``NOTSET``, " @@ -1018,20 +1201,29 @@ msgid "" "application to get the logger." msgstr "" -#: library/logging.config.rst:878 +#: library/logging.config.rst:883 msgid "" "Sections which specify handler configuration are exemplified by the " "following." msgstr "" -#: library/logging.config.rst:888 +#: library/logging.config.rst:885 +msgid "" +"[handler_hand01]\n" +"class=StreamHandler\n" +"level=NOTSET\n" +"formatter=form01\n" +"args=(sys.stdout,)" +msgstr "" + +#: library/logging.config.rst:893 msgid "" "The ``class`` entry indicates the handler's class (as determined by :func:" "`eval` in the ``logging`` package's namespace). The ``level`` is interpreted " "as for loggers, and ``NOTSET`` is taken to mean 'log everything'." msgstr "" -#: library/logging.config.rst:892 +#: library/logging.config.rst:897 msgid "" "The ``formatter`` entry indicates the key name of the formatter for this " "handler. If blank, a default formatter (``logging._defaultFormatter``) is " @@ -1039,7 +1231,7 @@ msgid "" "and have a corresponding section in the configuration file." msgstr "" -#: library/logging.config.rst:897 +#: library/logging.config.rst:902 msgid "" "The ``args`` entry, when :ref:`evaluated ` in the context of the " "``logging`` package's namespace, is the list of arguments to the constructor " @@ -1048,7 +1240,7 @@ msgid "" "provided, it defaults to ``()``." msgstr "" -#: library/logging.config.rst:903 +#: library/logging.config.rst:908 msgid "" "The optional ``kwargs`` entry, when :ref:`evaluated ` in the " "context of the ``logging`` package's namespace, is the keyword argument dict " @@ -1056,26 +1248,93 @@ msgid "" "``{}``." msgstr "" -#: library/logging.config.rst:960 +#: library/logging.config.rst:912 +msgid "" +"[handler_hand02]\n" +"class=FileHandler\n" +"level=DEBUG\n" +"formatter=form02\n" +"args=('python.log', 'w')\n" +"\n" +"[handler_hand03]\n" +"class=handlers.SocketHandler\n" +"level=INFO\n" +"formatter=form03\n" +"args=('localhost', handlers.DEFAULT_TCP_LOGGING_PORT)\n" +"\n" +"[handler_hand04]\n" +"class=handlers.DatagramHandler\n" +"level=WARN\n" +"formatter=form04\n" +"args=('localhost', handlers.DEFAULT_UDP_LOGGING_PORT)\n" +"\n" +"[handler_hand05]\n" +"class=handlers.SysLogHandler\n" +"level=ERROR\n" +"formatter=form05\n" +"args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler." +"LOG_USER)\n" +"\n" +"[handler_hand06]\n" +"class=handlers.NTEventLogHandler\n" +"level=CRITICAL\n" +"formatter=form06\n" +"args=('Python Application', '', 'Application')\n" +"\n" +"[handler_hand07]\n" +"class=handlers.SMTPHandler\n" +"level=WARN\n" +"formatter=form07\n" +"args=('localhost', 'from@abc', ['user1@abc', 'user2@xyz'], 'Logger " +"Subject')\n" +"kwargs={'timeout': 10.0}\n" +"\n" +"[handler_hand08]\n" +"class=handlers.MemoryHandler\n" +"level=NOTSET\n" +"formatter=form08\n" +"target=\n" +"args=(10, ERROR)\n" +"\n" +"[handler_hand09]\n" +"class=handlers.HTTPHandler\n" +"level=NOTSET\n" +"formatter=form09\n" +"args=('localhost:9022', '/log', 'GET')\n" +"kwargs={'secure': True}" +msgstr "" + +#: library/logging.config.rst:965 msgid "" "Sections which specify formatter configuration are typified by the following." msgstr "" -#: library/logging.config.rst:972 +#: library/logging.config.rst:967 +msgid "" +"[formatter_form01]\n" +"format=F1 %(asctime)s %(levelname)s %(message)s %(customfield)s\n" +"datefmt=\n" +"style=%\n" +"validate=True\n" +"defaults={'customfield': 'defaultvalue'}\n" +"class=logging.Formatter" +msgstr "" + +#: library/logging.config.rst:977 msgid "" "The arguments for the formatter configuration are the same as the keys in " "the dictionary schema :ref:`formatters section `." msgstr "" -#: library/logging.config.rst:976 +#: library/logging.config.rst:981 msgid "" "The ``defaults`` entry, when :ref:`evaluated ` in the context of " "the ``logging`` package's namespace, is a dictionary of default values for " "custom formatting fields. If not provided, it defaults to ``None``." msgstr "" -#: library/logging.config.rst:983 +#: library/logging.config.rst:988 msgid "" "Due to the use of :func:`eval` as described above, there are potential " "security risks which result from using the :func:`listen` to send and " @@ -1084,18 +1343,18 @@ msgid "" "`listen` documentation for more information." msgstr "" -#: library/logging.config.rst:992 +#: library/logging.config.rst:996 msgid "Module :mod:`logging`" msgstr "" -#: library/logging.config.rst:992 +#: library/logging.config.rst:997 msgid "API reference for the logging module." msgstr "" -#: library/logging.config.rst:994 +#: library/logging.config.rst:999 msgid "Module :mod:`logging.handlers`" msgstr "" -#: library/logging.config.rst:995 +#: library/logging.config.rst:1000 msgid "Useful handlers included with the logging module." msgstr "" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index 91fd66ed..558397b0 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/logging.handlers.rst:2 -msgid ":mod:`logging.handlers` --- Logging handlers" +msgid ":mod:`!logging.handlers` --- Logging handlers" msgstr "" #: library/logging.handlers.rst:10 @@ -102,7 +103,7 @@ msgid "Returns" msgstr "" #: library/logging.handlers.rst:69 -msgid "the old stream, if the stream was changed, or *None* if it wasn't." +msgid "the old stream, if the stream was changed, or ``None`` if it wasn't." msgstr "" #: library/logging.handlers.rst:75 @@ -144,14 +145,14 @@ msgid "" msgstr "" #: library/logging.handlers.rst:105 library/logging.handlers.rst:190 -#: library/logging.handlers.rst:338 library/logging.handlers.rst:444 +#: library/logging.handlers.rst:338 library/logging.handlers.rst:448 msgid "" "As well as string values, :class:`~pathlib.Path` objects are also accepted " "for the *filename* argument." msgstr "" #: library/logging.handlers.rst:109 library/logging.handlers.rst:194 -#: library/logging.handlers.rst:342 library/logging.handlers.rst:448 +#: library/logging.handlers.rst:342 library/logging.handlers.rst:452 msgid "The *errors* parameter was added." msgstr "" @@ -412,7 +413,7 @@ msgid "" "they are renamed to :file:`app.log.2`, :file:`app.log.3` etc. respectively." msgstr "" -#: library/logging.handlers.rst:347 library/logging.handlers.rst:453 +#: library/logging.handlers.rst:347 library/logging.handlers.rst:457 msgid "Does a rollover, as described above." msgstr "" @@ -422,18 +423,24 @@ msgid "" "previously." msgstr "" -#: library/logging.handlers.rst:358 +#: library/logging.handlers.rst:357 +msgid "" +"See if the supplied record would cause the file to exceed the configured " +"size limit." +msgstr "" + +#: library/logging.handlers.rst:362 msgid "TimedRotatingFileHandler" msgstr "" -#: library/logging.handlers.rst:360 +#: library/logging.handlers.rst:364 msgid "" "The :class:`TimedRotatingFileHandler` class, located in the :mod:`logging." "handlers` module, supports rotation of disk log files at certain timed " "intervals." msgstr "" -#: library/logging.handlers.rst:367 +#: library/logging.handlers.rst:371 msgid "" "Returns a new instance of the :class:`TimedRotatingFileHandler` class. The " "specified file is opened and used as the stream for logging. On rotating it " @@ -441,89 +448,89 @@ msgid "" "*when* and *interval*." msgstr "" -#: library/logging.handlers.rst:372 +#: library/logging.handlers.rst:376 msgid "" "You can use the *when* to specify the type of *interval*. The list of " "possible values is below. Note that they are not case sensitive." msgstr "" -#: library/logging.handlers.rst:376 +#: library/logging.handlers.rst:380 msgid "Value" msgstr "" -#: library/logging.handlers.rst:376 +#: library/logging.handlers.rst:380 msgid "Type of interval" msgstr "" -#: library/logging.handlers.rst:376 +#: library/logging.handlers.rst:380 msgid "If/how *atTime* is used" msgstr "" -#: library/logging.handlers.rst:378 +#: library/logging.handlers.rst:382 msgid "``'S'``" msgstr "" -#: library/logging.handlers.rst:378 +#: library/logging.handlers.rst:382 msgid "Seconds" msgstr "" -#: library/logging.handlers.rst:378 library/logging.handlers.rst:380 #: library/logging.handlers.rst:382 library/logging.handlers.rst:384 +#: library/logging.handlers.rst:386 library/logging.handlers.rst:388 msgid "Ignored" msgstr "" -#: library/logging.handlers.rst:380 +#: library/logging.handlers.rst:384 msgid "``'M'``" msgstr "" -#: library/logging.handlers.rst:380 +#: library/logging.handlers.rst:384 msgid "Minutes" msgstr "" -#: library/logging.handlers.rst:382 +#: library/logging.handlers.rst:386 msgid "``'H'``" msgstr "" -#: library/logging.handlers.rst:382 +#: library/logging.handlers.rst:386 msgid "Hours" msgstr "" -#: library/logging.handlers.rst:384 +#: library/logging.handlers.rst:388 msgid "``'D'``" msgstr "" -#: library/logging.handlers.rst:384 +#: library/logging.handlers.rst:388 msgid "Days" msgstr "" -#: library/logging.handlers.rst:386 +#: library/logging.handlers.rst:390 msgid "``'W0'-'W6'``" msgstr "" -#: library/logging.handlers.rst:386 +#: library/logging.handlers.rst:390 msgid "Weekday (0=Monday)" msgstr "" -#: library/logging.handlers.rst:386 library/logging.handlers.rst:389 +#: library/logging.handlers.rst:390 library/logging.handlers.rst:393 msgid "Used to compute initial rollover time" msgstr "" -#: library/logging.handlers.rst:389 +#: library/logging.handlers.rst:393 msgid "``'midnight'``" msgstr "" -#: library/logging.handlers.rst:389 +#: library/logging.handlers.rst:393 msgid "Roll over at midnight, if *atTime* not specified, else at time *atTime*" msgstr "" -#: library/logging.handlers.rst:394 +#: library/logging.handlers.rst:398 msgid "" "When using weekday-based rotation, specify 'W0' for Monday, 'W1' for " "Tuesday, and so on up to 'W6' for Sunday. In this case, the value passed for " "*interval* isn't used." msgstr "" -#: library/logging.handlers.rst:398 +#: library/logging.handlers.rst:402 msgid "" "The system will save old log files by appending extensions to the filename. " "The extensions are date-and-time based, using the strftime format ``%Y-%m-" @@ -531,20 +538,20 @@ msgid "" "interval." msgstr "" -#: library/logging.handlers.rst:403 +#: library/logging.handlers.rst:407 msgid "" "When computing the next rollover time for the first time (when the handler " "is created), the last modification time of an existing log file, or else the " "current time, is used to compute when the next rotation will occur." msgstr "" -#: library/logging.handlers.rst:407 +#: library/logging.handlers.rst:411 msgid "" "If the *utc* argument is true, times in UTC will be used; otherwise local " "time is used." msgstr "" -#: library/logging.handlers.rst:410 +#: library/logging.handlers.rst:414 msgid "" "If *backupCount* is nonzero, at most *backupCount* files will be kept, and " "if more would be created when rollover occurs, the oldest one is deleted. " @@ -552,13 +559,13 @@ msgid "" "changing the interval may leave old files lying around." msgstr "" -#: library/logging.handlers.rst:415 +#: library/logging.handlers.rst:419 msgid "" "If *delay* is true, then file opening is deferred until the first call to :" "meth:`emit`." msgstr "" -#: library/logging.handlers.rst:418 +#: library/logging.handlers.rst:422 msgid "" "If *atTime* is not ``None``, it must be a ``datetime.time`` instance which " "specifies the time of day when rollover occurs, for the cases where rollover " @@ -568,13 +575,13 @@ msgid "" "normal interval calculation." msgstr "" -#: library/logging.handlers.rst:425 +#: library/logging.handlers.rst:429 msgid "" "If *errors* is specified, it's used to determine how encoding errors are " "handled." msgstr "" -#: library/logging.handlers.rst:428 +#: library/logging.handlers.rst:432 msgid "" "Calculation of the initial rollover time is done when the handler is " "initialised. Calculation of subsequent rollover times is done only when " @@ -589,51 +596,57 @@ msgid "" "to the minutes where no output (and hence no rollover) occurred." msgstr "" -#: library/logging.handlers.rst:441 +#: library/logging.handlers.rst:445 msgid "*atTime* parameter was added." msgstr "" -#: library/logging.handlers.rst:457 +#: library/logging.handlers.rst:461 msgid "" "Outputs the record to the file, catering for rollover as described above." msgstr "" -#: library/logging.handlers.rst:461 +#: library/logging.handlers.rst:465 msgid "" "Returns a list of filenames which should be deleted as part of rollover. " "These are the absolute paths of the oldest backup log files written by the " "handler." msgstr "" -#: library/logging.handlers.rst:467 +#: library/logging.handlers.rst:470 +msgid "" +"See if enough time has passed for a rollover to occur and if it has, compute " +"the next rollover time." +msgstr "" + +#: library/logging.handlers.rst:476 msgid "SocketHandler" msgstr "" -#: library/logging.handlers.rst:469 +#: library/logging.handlers.rst:478 msgid "" "The :class:`SocketHandler` class, located in the :mod:`logging.handlers` " "module, sends logging output to a network socket. The base class uses a TCP " "socket." msgstr "" -#: library/logging.handlers.rst:475 +#: library/logging.handlers.rst:484 msgid "" "Returns a new instance of the :class:`SocketHandler` class intended to " "communicate with a remote machine whose address is given by *host* and " "*port*." msgstr "" -#: library/logging.handlers.rst:478 +#: library/logging.handlers.rst:487 msgid "" "If ``port`` is specified as ``None``, a Unix domain socket is created using " "the value in ``host`` - otherwise, a TCP socket is created." msgstr "" -#: library/logging.handlers.rst:484 +#: library/logging.handlers.rst:493 msgid "Closes the socket." msgstr "" -#: library/logging.handlers.rst:489 +#: library/logging.handlers.rst:498 msgid "" "Pickles the record's attribute dictionary and writes it to the socket in " "binary format. If there is an error with the socket, silently drops the " @@ -642,28 +655,35 @@ msgid "" "`~logging.LogRecord`, use the :func:`~logging.makeLogRecord` function." msgstr "" -#: library/logging.handlers.rst:499 +#: library/logging.handlers.rst:508 msgid "" "Handles an error which has occurred during :meth:`emit`. The most likely " "cause is a lost connection. Closes the socket so that we can retry on the " "next event." msgstr "" -#: library/logging.handlers.rst:506 +#: library/logging.handlers.rst:515 msgid "" "This is a factory method which allows subclasses to define the precise type " "of socket they want. The default implementation creates a TCP socket (:const:" "`socket.SOCK_STREAM`)." msgstr "" -#: library/logging.handlers.rst:513 +#: library/logging.handlers.rst:522 msgid "" "Pickles the record's attribute dictionary in binary format with a length " "prefix, and returns it ready for transmission across the socket. The details " "of this operation are equivalent to::" msgstr "" -#: library/logging.handlers.rst:521 +#: library/logging.handlers.rst:526 +msgid "" +"data = pickle.dumps(record_attr_dict, 1)\n" +"datalen = struct.pack('>L', len(data))\n" +"return datalen + data" +msgstr "" + +#: library/logging.handlers.rst:530 msgid "" "Note that pickles aren't completely secure. If you are concerned about " "security, you may want to override this method to implement a more secure " @@ -672,20 +692,20 @@ msgid "" "objects on the receiving end." msgstr "" -#: library/logging.handlers.rst:530 +#: library/logging.handlers.rst:539 msgid "" "Send a pickled byte-string *packet* to the socket. The format of the sent " "byte-string is as described in the documentation for :meth:`~SocketHandler." "makePickle`." msgstr "" -#: library/logging.handlers.rst:534 +#: library/logging.handlers.rst:543 msgid "" "This function allows for partial sends, which can happen when the network is " "busy." msgstr "" -#: library/logging.handlers.rst:540 +#: library/logging.handlers.rst:549 msgid "" "Tries to create a socket; on failure, uses an exponential back-off " "algorithm. On initial failure, the handler will drop the message it was " @@ -696,23 +716,23 @@ msgid "" "each time up to a maximum of 30 seconds." msgstr "" -#: library/logging.handlers.rst:548 +#: library/logging.handlers.rst:557 msgid "This behaviour is controlled by the following handler attributes:" msgstr "" -#: library/logging.handlers.rst:550 +#: library/logging.handlers.rst:559 msgid "``retryStart`` (initial delay, defaulting to 1.0 seconds)." msgstr "" -#: library/logging.handlers.rst:551 +#: library/logging.handlers.rst:560 msgid "``retryFactor`` (multiplier, defaulting to 2.0)." msgstr "" -#: library/logging.handlers.rst:552 +#: library/logging.handlers.rst:561 msgid "``retryMax`` (maximum delay, defaulting to 30.0 seconds)." msgstr "" -#: library/logging.handlers.rst:554 +#: library/logging.handlers.rst:563 msgid "" "This means that if the remote listener starts up *after* the handler has " "been used, you could lose messages (since the handler won't even attempt a " @@ -720,25 +740,25 @@ msgid "" "during the delay period)." msgstr "" -#: library/logging.handlers.rst:563 +#: library/logging.handlers.rst:572 msgid "DatagramHandler" msgstr "" -#: library/logging.handlers.rst:565 +#: library/logging.handlers.rst:574 msgid "" "The :class:`DatagramHandler` class, located in the :mod:`logging.handlers` " "module, inherits from :class:`SocketHandler` to support sending logging " "messages over UDP sockets." msgstr "" -#: library/logging.handlers.rst:572 +#: library/logging.handlers.rst:581 msgid "" "Returns a new instance of the :class:`DatagramHandler` class intended to " "communicate with a remote machine whose address is given by *host* and " "*port*." msgstr "" -#: library/logging.handlers.rst:575 +#: library/logging.handlers.rst:584 msgid "" "As UDP is not a streaming protocol, there is no persistent connection " "between an instance of this handler and *host*. For this reason, when using " @@ -748,13 +768,13 @@ msgid "" "looked-up IP address rather than the hostname." msgstr "" -#: library/logging.handlers.rst:582 +#: library/logging.handlers.rst:591 msgid "" "If ``port`` is specified as ``None``, a Unix domain socket is created using " "the value in ``host`` - otherwise, a UDP socket is created." msgstr "" -#: library/logging.handlers.rst:588 +#: library/logging.handlers.rst:597 msgid "" "Pickles the record's attribute dictionary and writes it to the socket in " "binary format. If there is an error with the socket, silently drops the " @@ -762,29 +782,29 @@ msgid "" "LogRecord`, use the :func:`~logging.makeLogRecord` function." msgstr "" -#: library/logging.handlers.rst:597 +#: library/logging.handlers.rst:606 msgid "" "The factory method of :class:`SocketHandler` is here overridden to create a " "UDP socket (:const:`socket.SOCK_DGRAM`)." msgstr "" -#: library/logging.handlers.rst:603 +#: library/logging.handlers.rst:612 msgid "" "Send a pickled byte-string to a socket. The format of the sent byte-string " "is as described in the documentation for :meth:`SocketHandler.makePickle`." msgstr "" -#: library/logging.handlers.rst:610 +#: library/logging.handlers.rst:619 msgid "SysLogHandler" msgstr "" -#: library/logging.handlers.rst:612 +#: library/logging.handlers.rst:621 msgid "" "The :class:`SysLogHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a remote or local Unix syslog." msgstr "" -#: library/logging.handlers.rst:618 +#: library/logging.handlers.rst:627 msgid "" "Returns a new instance of the :class:`SysLogHandler` class intended to " "communicate with a remote Unix machine whose address is given by *address* " @@ -796,10 +816,14 @@ msgid "" "`LOG_USER` is used. The type of socket opened depends on the *socktype* " "argument, which defaults to :const:`socket.SOCK_DGRAM` and thus opens a UDP " "socket. To open a TCP socket (for use with the newer syslog daemons such as " -"rsyslog), specify a value of :const:`socket.SOCK_STREAM`." +"rsyslog), specify a value of :const:`socket.SOCK_STREAM`. If *timeout* is " +"specified, it sets a timeout (in seconds) for the socket operations. This " +"can help prevent the program from hanging indefinitely if the syslog server " +"is unreachable. By default, *timeout* is ``None``, meaning no timeout is " +"applied." msgstr "" -#: library/logging.handlers.rst:630 +#: library/logging.handlers.rst:644 msgid "" "Note that if your server is not listening on UDP port 514, :class:" "`SysLogHandler` may appear not to work. In that case, check what address you " @@ -810,26 +834,30 @@ msgid "" "platforms). On Windows, you pretty much have to use the UDP option." msgstr "" -#: library/logging.handlers.rst:639 +#: library/logging.handlers.rst:653 msgid "" "On macOS 12.x (Monterey), Apple has changed the behaviour of their syslog " "daemon - it no longer listens on a domain socket. Therefore, you cannot " "expect :class:`SysLogHandler` to work on this system." msgstr "" -#: library/logging.handlers.rst:643 +#: library/logging.handlers.rst:657 msgid "See :gh:`91070` for more information." msgstr "" -#: library/logging.handlers.rst:645 +#: library/logging.handlers.rst:659 msgid "*socktype* was added." msgstr "" -#: library/logging.handlers.rst:651 +#: library/logging.handlers.rst:662 +msgid "*timeout* was added." +msgstr "" + +#: library/logging.handlers.rst:667 msgid "Closes the socket to the remote host." msgstr "" -#: library/logging.handlers.rst:655 +#: library/logging.handlers.rst:671 msgid "" "Tries to create a socket and, if it's not a datagram socket, connect it to " "the other end. This method is called during handler initialization, but it's " @@ -838,13 +866,13 @@ msgid "" "socket at that point." msgstr "" -#: library/logging.handlers.rst:665 +#: library/logging.handlers.rst:681 msgid "" "The record is formatted, and then sent to the syslog server. If exception " "information is present, it is *not* sent to the server." msgstr "" -#: library/logging.handlers.rst:668 +#: library/logging.handlers.rst:684 msgid "" "(See: :issue:`12168`.) In earlier versions, the message sent to the syslog " "daemons was always terminated with a NUL byte, because early versions of " @@ -855,7 +883,7 @@ msgid "" "byte on as part of the message." msgstr "" -#: library/logging.handlers.rst:677 +#: library/logging.handlers.rst:693 msgid "" "To enable easier handling of syslog messages in the face of all these " "differing daemon behaviours, the appending of the NUL byte has been made " @@ -865,7 +893,7 @@ msgid "" "*not* append the NUL terminator." msgstr "" -#: library/logging.handlers.rst:684 +#: library/logging.handlers.rst:700 msgid "" "(See: :issue:`12419`.) In earlier versions, there was no facility for an " "\"ident\" or \"tag\" prefix to identify the source of the message. This can " @@ -876,260 +904,260 @@ msgid "" "bytes, and is prepended to the message exactly as is." msgstr "" -#: library/logging.handlers.rst:695 +#: library/logging.handlers.rst:711 msgid "" "Encodes the facility and priority into an integer. You can pass in strings " "or integers - if strings are passed, internal mapping dictionaries are used " "to convert them to integers." msgstr "" -#: library/logging.handlers.rst:699 +#: library/logging.handlers.rst:715 msgid "" "The symbolic ``LOG_`` values are defined in :class:`SysLogHandler` and " "mirror the values defined in the ``sys/syslog.h`` header file." msgstr "" -#: library/logging.handlers.rst:702 +#: library/logging.handlers.rst:718 msgid "**Priorities**" msgstr "" -#: library/logging.handlers.rst:705 library/logging.handlers.rst:727 +#: library/logging.handlers.rst:721 library/logging.handlers.rst:743 msgid "Name (string)" msgstr "" -#: library/logging.handlers.rst:705 library/logging.handlers.rst:727 +#: library/logging.handlers.rst:721 library/logging.handlers.rst:743 msgid "Symbolic value" msgstr "" -#: library/logging.handlers.rst:707 +#: library/logging.handlers.rst:723 msgid "``alert``" msgstr "" -#: library/logging.handlers.rst:707 +#: library/logging.handlers.rst:723 msgid "LOG_ALERT" msgstr "" -#: library/logging.handlers.rst:709 +#: library/logging.handlers.rst:725 msgid "``crit`` or ``critical``" msgstr "" -#: library/logging.handlers.rst:709 +#: library/logging.handlers.rst:725 msgid "LOG_CRIT" msgstr "" -#: library/logging.handlers.rst:711 +#: library/logging.handlers.rst:727 msgid "``debug``" msgstr "" -#: library/logging.handlers.rst:711 +#: library/logging.handlers.rst:727 msgid "LOG_DEBUG" msgstr "" -#: library/logging.handlers.rst:713 +#: library/logging.handlers.rst:729 msgid "``emerg`` or ``panic``" msgstr "" -#: library/logging.handlers.rst:713 +#: library/logging.handlers.rst:729 msgid "LOG_EMERG" msgstr "" -#: library/logging.handlers.rst:715 +#: library/logging.handlers.rst:731 msgid "``err`` or ``error``" msgstr "" -#: library/logging.handlers.rst:715 +#: library/logging.handlers.rst:731 msgid "LOG_ERR" msgstr "" -#: library/logging.handlers.rst:717 +#: library/logging.handlers.rst:733 msgid "``info``" msgstr "" -#: library/logging.handlers.rst:717 +#: library/logging.handlers.rst:733 msgid "LOG_INFO" msgstr "" -#: library/logging.handlers.rst:719 +#: library/logging.handlers.rst:735 msgid "``notice``" msgstr "" -#: library/logging.handlers.rst:719 +#: library/logging.handlers.rst:735 msgid "LOG_NOTICE" msgstr "" -#: library/logging.handlers.rst:721 +#: library/logging.handlers.rst:737 msgid "``warn`` or ``warning``" msgstr "" -#: library/logging.handlers.rst:721 +#: library/logging.handlers.rst:737 msgid "LOG_WARNING" msgstr "" -#: library/logging.handlers.rst:724 +#: library/logging.handlers.rst:740 msgid "**Facilities**" msgstr "" -#: library/logging.handlers.rst:729 +#: library/logging.handlers.rst:745 msgid "``auth``" msgstr "" -#: library/logging.handlers.rst:729 +#: library/logging.handlers.rst:745 msgid "LOG_AUTH" msgstr "" -#: library/logging.handlers.rst:731 +#: library/logging.handlers.rst:747 msgid "``authpriv``" msgstr "" -#: library/logging.handlers.rst:731 +#: library/logging.handlers.rst:747 msgid "LOG_AUTHPRIV" msgstr "" -#: library/logging.handlers.rst:733 +#: library/logging.handlers.rst:749 msgid "``cron``" msgstr "" -#: library/logging.handlers.rst:733 +#: library/logging.handlers.rst:749 msgid "LOG_CRON" msgstr "" -#: library/logging.handlers.rst:735 +#: library/logging.handlers.rst:751 msgid "``daemon``" msgstr "" -#: library/logging.handlers.rst:735 +#: library/logging.handlers.rst:751 msgid "LOG_DAEMON" msgstr "" -#: library/logging.handlers.rst:737 +#: library/logging.handlers.rst:753 msgid "``ftp``" msgstr "" -#: library/logging.handlers.rst:737 +#: library/logging.handlers.rst:753 msgid "LOG_FTP" msgstr "" -#: library/logging.handlers.rst:739 +#: library/logging.handlers.rst:755 msgid "``kern``" msgstr "" -#: library/logging.handlers.rst:739 +#: library/logging.handlers.rst:755 msgid "LOG_KERN" msgstr "" -#: library/logging.handlers.rst:741 +#: library/logging.handlers.rst:757 msgid "``lpr``" msgstr "" -#: library/logging.handlers.rst:741 +#: library/logging.handlers.rst:757 msgid "LOG_LPR" msgstr "" -#: library/logging.handlers.rst:743 +#: library/logging.handlers.rst:759 msgid "``mail``" msgstr "" -#: library/logging.handlers.rst:743 +#: library/logging.handlers.rst:759 msgid "LOG_MAIL" msgstr "" -#: library/logging.handlers.rst:745 +#: library/logging.handlers.rst:761 msgid "``news``" msgstr "" -#: library/logging.handlers.rst:745 +#: library/logging.handlers.rst:761 msgid "LOG_NEWS" msgstr "" -#: library/logging.handlers.rst:747 +#: library/logging.handlers.rst:763 msgid "``syslog``" msgstr "" -#: library/logging.handlers.rst:747 +#: library/logging.handlers.rst:763 msgid "LOG_SYSLOG" msgstr "" -#: library/logging.handlers.rst:749 +#: library/logging.handlers.rst:765 msgid "``user``" msgstr "" -#: library/logging.handlers.rst:749 +#: library/logging.handlers.rst:765 msgid "LOG_USER" msgstr "" -#: library/logging.handlers.rst:751 +#: library/logging.handlers.rst:767 msgid "``uucp``" msgstr "" -#: library/logging.handlers.rst:751 +#: library/logging.handlers.rst:767 msgid "LOG_UUCP" msgstr "" -#: library/logging.handlers.rst:753 +#: library/logging.handlers.rst:769 msgid "``local0``" msgstr "" -#: library/logging.handlers.rst:753 +#: library/logging.handlers.rst:769 msgid "LOG_LOCAL0" msgstr "" -#: library/logging.handlers.rst:755 +#: library/logging.handlers.rst:771 msgid "``local1``" msgstr "" -#: library/logging.handlers.rst:755 +#: library/logging.handlers.rst:771 msgid "LOG_LOCAL1" msgstr "" -#: library/logging.handlers.rst:757 +#: library/logging.handlers.rst:773 msgid "``local2``" msgstr "" -#: library/logging.handlers.rst:757 +#: library/logging.handlers.rst:773 msgid "LOG_LOCAL2" msgstr "" -#: library/logging.handlers.rst:759 +#: library/logging.handlers.rst:775 msgid "``local3``" msgstr "" -#: library/logging.handlers.rst:759 +#: library/logging.handlers.rst:775 msgid "LOG_LOCAL3" msgstr "" -#: library/logging.handlers.rst:761 +#: library/logging.handlers.rst:777 msgid "``local4``" msgstr "" -#: library/logging.handlers.rst:761 +#: library/logging.handlers.rst:777 msgid "LOG_LOCAL4" msgstr "" -#: library/logging.handlers.rst:763 +#: library/logging.handlers.rst:779 msgid "``local5``" msgstr "" -#: library/logging.handlers.rst:763 +#: library/logging.handlers.rst:779 msgid "LOG_LOCAL5" msgstr "" -#: library/logging.handlers.rst:765 +#: library/logging.handlers.rst:781 msgid "``local6``" msgstr "" -#: library/logging.handlers.rst:765 +#: library/logging.handlers.rst:781 msgid "LOG_LOCAL6" msgstr "" -#: library/logging.handlers.rst:767 +#: library/logging.handlers.rst:783 msgid "``local7``" msgstr "" -#: library/logging.handlers.rst:767 +#: library/logging.handlers.rst:783 msgid "LOG_LOCAL7" msgstr "" -#: library/logging.handlers.rst:772 +#: library/logging.handlers.rst:788 msgid "" "Maps a logging level name to a syslog priority name. You may need to " "override this if you are using custom levels, or if the default algorithm is " @@ -1138,11 +1166,11 @@ msgid "" "all other level names to 'warning'." msgstr "" -#: library/logging.handlers.rst:782 +#: library/logging.handlers.rst:798 msgid "NTEventLogHandler" msgstr "" -#: library/logging.handlers.rst:784 +#: library/logging.handlers.rst:800 msgid "" "The :class:`NTEventLogHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a local Windows NT, Windows " @@ -1150,7 +1178,7 @@ msgid "" "Win32 extensions for Python installed." msgstr "" -#: library/logging.handlers.rst:792 +#: library/logging.handlers.rst:808 msgid "" "Returns a new instance of the :class:`NTEventLogHandler` class. The " "*appname* is used to define the application name as it appears in the event " @@ -1166,7 +1194,7 @@ msgid "" "or ``'Security'``, and defaults to ``'Application'``." msgstr "" -#: library/logging.handlers.rst:808 +#: library/logging.handlers.rst:824 msgid "" "At this point, you can remove the application name from the registry as a " "source of event log entries. However, if you do this, you will not be able " @@ -1175,19 +1203,19 @@ msgid "" "not do this." msgstr "" -#: library/logging.handlers.rst:817 +#: library/logging.handlers.rst:833 msgid "" "Determines the message ID, event category and event type, and then logs the " "message in the NT event log." msgstr "" -#: library/logging.handlers.rst:823 +#: library/logging.handlers.rst:839 msgid "" "Returns the event category for the record. Override this if you want to " "specify your own categories. This version returns 0." msgstr "" -#: library/logging.handlers.rst:829 +#: library/logging.handlers.rst:845 msgid "" "Returns the event type for the record. Override this if you want to specify " "your own types. This version does a mapping using the handler's typemap " @@ -1198,7 +1226,7 @@ msgid "" "the handler's *typemap* attribute." msgstr "" -#: library/logging.handlers.rst:840 +#: library/logging.handlers.rst:856 msgid "" "Returns the message ID for the record. If you are using your own messages, " "you could do this by having the *msg* passed to the logger being an ID " @@ -1207,17 +1235,17 @@ msgid "" "message ID in :file:`win32service.pyd`." msgstr "" -#: library/logging.handlers.rst:849 +#: library/logging.handlers.rst:865 msgid "SMTPHandler" msgstr "" -#: library/logging.handlers.rst:851 +#: library/logging.handlers.rst:867 msgid "" "The :class:`SMTPHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to an email address via SMTP." msgstr "" -#: library/logging.handlers.rst:857 +#: library/logging.handlers.rst:873 msgid "" "Returns a new instance of the :class:`SMTPHandler` class. The instance is " "initialized with the from and to addresses and subject line of the email. " @@ -1228,7 +1256,7 @@ msgid "" "*credentials* argument." msgstr "" -#: library/logging.handlers.rst:864 +#: library/logging.handlers.rst:880 msgid "" "To specify the use of a secure protocol (TLS), pass in a tuple to the " "*secure* argument. This will only be used when authentication credentials " @@ -1238,31 +1266,31 @@ msgid "" "SMTP.starttls` method.)" msgstr "" -#: library/logging.handlers.rst:871 +#: library/logging.handlers.rst:887 msgid "" "A timeout can be specified for communication with the SMTP server using the " "*timeout* argument." msgstr "" -#: library/logging.handlers.rst:874 +#: library/logging.handlers.rst:890 msgid "Added the *timeout* parameter." msgstr "" -#: library/logging.handlers.rst:879 +#: library/logging.handlers.rst:895 msgid "Formats the record and sends it to the specified addressees." msgstr "" -#: library/logging.handlers.rst:884 +#: library/logging.handlers.rst:900 msgid "" "If you want to specify a subject line which is record-dependent, override " "this method." msgstr "" -#: library/logging.handlers.rst:890 +#: library/logging.handlers.rst:906 msgid "MemoryHandler" msgstr "" -#: library/logging.handlers.rst:892 +#: library/logging.handlers.rst:908 msgid "" "The :class:`MemoryHandler` class, located in the :mod:`logging.handlers` " "module, supports buffering of logging records in memory, periodically " @@ -1270,7 +1298,7 @@ msgid "" "buffer is full, or when an event of a certain severity or greater is seen." msgstr "" -#: library/logging.handlers.rst:897 +#: library/logging.handlers.rst:913 msgid "" ":class:`MemoryHandler` is a subclass of the more general :class:" "`BufferingHandler`, which is an abstract class. This buffers logging records " @@ -1279,32 +1307,32 @@ msgid "" "should, then :meth:`flush` is expected to do the flushing." msgstr "" -#: library/logging.handlers.rst:906 +#: library/logging.handlers.rst:922 msgid "" "Initializes the handler with a buffer of the specified capacity. Here, " "*capacity* means the number of logging records buffered." msgstr "" -#: library/logging.handlers.rst:912 +#: library/logging.handlers.rst:928 msgid "" "Append the record to the buffer. If :meth:`shouldFlush` returns true, call :" "meth:`flush` to process the buffer." msgstr "" -#: library/logging.handlers.rst:918 +#: library/logging.handlers.rst:934 msgid "" "For a :class:`BufferingHandler` instance, flushing means that it sets the " "buffer to an empty list. This method can be overwritten to implement more " "useful flushing behavior." msgstr "" -#: library/logging.handlers.rst:925 +#: library/logging.handlers.rst:941 msgid "" "Return ``True`` if the buffer is up to capacity. This method can be " "overridden to implement custom flushing strategies." msgstr "" -#: library/logging.handlers.rst:931 +#: library/logging.handlers.rst:947 msgid "" "Returns a new instance of the :class:`MemoryHandler` class. The instance is " "initialized with a buffer size of *capacity* (number of records buffered). " @@ -1316,15 +1344,15 @@ msgid "" "the buffer will occur when the handler is closed." msgstr "" -#: library/logging.handlers.rst:940 +#: library/logging.handlers.rst:956 msgid "The *flushOnClose* parameter was added." msgstr "" -#: library/logging.handlers.rst:946 +#: library/logging.handlers.rst:962 msgid "Calls :meth:`flush`, sets the target to ``None`` and clears the buffer." msgstr "" -#: library/logging.handlers.rst:952 +#: library/logging.handlers.rst:968 msgid "" "For a :class:`MemoryHandler` instance, flushing means just sending the " "buffered records to the target, if there is one. The buffer is also cleared " @@ -1332,26 +1360,26 @@ msgid "" "behavior." msgstr "" -#: library/logging.handlers.rst:959 +#: library/logging.handlers.rst:975 msgid "Sets the target handler for this handler." msgstr "" -#: library/logging.handlers.rst:964 +#: library/logging.handlers.rst:980 msgid "Checks for buffer full or a record at the *flushLevel* or higher." msgstr "" -#: library/logging.handlers.rst:970 +#: library/logging.handlers.rst:986 msgid "HTTPHandler" msgstr "" -#: library/logging.handlers.rst:972 +#: library/logging.handlers.rst:988 msgid "" "The :class:`HTTPHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a web server, using either " "``GET`` or ``POST`` semantics." msgstr "" -#: library/logging.handlers.rst:979 +#: library/logging.handlers.rst:995 msgid "" "Returns a new instance of the :class:`HTTPHandler` class. The *host* can be " "of the form ``host:port``, should you need to use a specific port number. " @@ -1365,11 +1393,11 @@ msgid "" "cleartext across the wire." msgstr "" -#: library/logging.handlers.rst:990 +#: library/logging.handlers.rst:1006 msgid "The *context* parameter was added." msgstr "" -#: library/logging.handlers.rst:995 +#: library/logging.handlers.rst:1011 msgid "" "Provides a dictionary, based on ``record``, which is to be URL-encoded and " "sent to the web server. The default implementation just returns ``record." @@ -1378,14 +1406,14 @@ msgid "" "customization of what's sent to the server is required." msgstr "" -#: library/logging.handlers.rst:1003 +#: library/logging.handlers.rst:1019 msgid "" "Sends the record to the web server as a URL-encoded dictionary. The :meth:" "`mapLogRecord` method is used to convert the record to the dictionary to be " "sent." msgstr "" -#: library/logging.handlers.rst:1007 +#: library/logging.handlers.rst:1023 msgid "" "Since preparing a record for sending it to a web server is not the same as a " "generic formatting operation, using :meth:`~logging.Handler.setFormatter` to " @@ -1395,18 +1423,18 @@ msgid "" "the dictionary in a form suitable for sending to a web server." msgstr "" -#: library/logging.handlers.rst:1020 +#: library/logging.handlers.rst:1036 msgid "QueueHandler" msgstr "" -#: library/logging.handlers.rst:1024 +#: library/logging.handlers.rst:1040 msgid "" "The :class:`QueueHandler` class, located in the :mod:`logging.handlers` " "module, supports sending logging messages to a queue, such as those " "implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -#: library/logging.handlers.rst:1028 +#: library/logging.handlers.rst:1044 msgid "" "Along with the :class:`QueueListener` class, :class:`QueueHandler` can be " "used to let handlers do their work on a separate thread from the one which " @@ -1416,7 +1444,7 @@ msgid "" "an email via :class:`SMTPHandler`) are done on a separate thread." msgstr "" -#: library/logging.handlers.rst:1037 +#: library/logging.handlers.rst:1053 msgid "" "Returns a new instance of the :class:`QueueHandler` class. The instance is " "initialized with the queue to send messages to. The *queue* can be any queue-" @@ -1426,13 +1454,23 @@ msgid "" "instances for *queue*." msgstr "" -#: library/logging.handlers.rst:1044 library/logging.handlers.rst:1133 +#: library/logging.handlers.rst:1060 library/logging.handlers.rst:1158 msgid "" "If you are using :mod:`multiprocessing`, you should avoid using :class:" "`~queue.SimpleQueue` and instead use :class:`multiprocessing.Queue`." msgstr "" -#: library/logging.handlers.rst:1049 +#: library/logging.handlers.rst:1065 +msgid "" +"The :mod:`multiprocessing` module uses an internal logger created and " +"accessed via :meth:`~multiprocessing.get_logger`. :class:`multiprocessing." +"Queue` will log ``DEBUG`` level messages upon items being queued. If those " +"log messages are processed by a :class:`QueueHandler` using the same :class:" +"`multiprocessing.Queue` instance, it will cause a deadlock or infinite " +"recursion." +msgstr "" + +#: library/logging.handlers.rst:1074 msgid "" "Enqueues the result of preparing the LogRecord. Should an exception occur (e." "g. because a bounded queue has filled up), the :meth:`~logging.Handler." @@ -1442,13 +1480,13 @@ msgid "" "raiseExceptions` is ``True``)." msgstr "" -#: library/logging.handlers.rst:1058 +#: library/logging.handlers.rst:1083 msgid "" "Prepares a record for queuing. The object returned by this method is " "enqueued." msgstr "" -#: library/logging.handlers.rst:1061 +#: library/logging.handlers.rst:1086 msgid "" "The base implementation formats the record to merge the message, arguments, " "exception and stack information, if present. It also removes unpickleable " @@ -1458,14 +1496,14 @@ msgid "" "attr:`exc_info` and :attr:`exc_text` attributes to ``None``." msgstr "" -#: library/logging.handlers.rst:1069 +#: library/logging.handlers.rst:1094 msgid "" "You might want to override this method if you want to convert the record to " "a dict or JSON string, or send a modified copy of the record while leaving " "the original intact." msgstr "" -#: library/logging.handlers.rst:1073 +#: library/logging.handlers.rst:1098 msgid "" "The base implementation formats the message with arguments, sets the " "``message`` and ``msg`` attributes to the formatted message and sets the " @@ -1481,25 +1519,25 @@ msgid "" "libraries that you use.)" msgstr "" -#: library/logging.handlers.rst:1089 +#: library/logging.handlers.rst:1114 msgid "" "Enqueues the record on the queue using ``put_nowait()``; you may want to " "override this if you want to use blocking behaviour, or a timeout, or a " "customized queue implementation." msgstr "" -#: library/logging.handlers.rst:1095 +#: library/logging.handlers.rst:1120 msgid "" "When created via configuration using :func:`~logging.config.dictConfig`, " "this attribute will contain a :class:`QueueListener` instance for use with " "this handler. Otherwise, it will be ``None``." msgstr "" -#: library/logging.handlers.rst:1104 +#: library/logging.handlers.rst:1129 msgid "QueueListener" msgstr "" -#: library/logging.handlers.rst:1108 +#: library/logging.handlers.rst:1133 msgid "" "The :class:`QueueListener` class, located in the :mod:`logging.handlers` " "module, supports receiving logging messages from a queue, such as those " @@ -1510,7 +1548,7 @@ msgid "" "works hand-in-hand with :class:`QueueHandler`." msgstr "" -#: library/logging.handlers.rst:1116 +#: library/logging.handlers.rst:1141 msgid "" "Along with the :class:`QueueHandler` class, :class:`QueueListener` can be " "used to let handlers do their work on a separate thread from the one which " @@ -1520,7 +1558,7 @@ msgid "" "an email via :class:`SMTPHandler`) are done on a separate thread." msgstr "" -#: library/logging.handlers.rst:1125 +#: library/logging.handlers.rst:1150 msgid "" "Returns a new instance of the :class:`QueueListener` class. The instance is " "initialized with the queue to send messages to and a list of handlers which " @@ -1531,7 +1569,7 @@ msgid "" "class:`~queue.SimpleQueue` instances for *queue*." msgstr "" -#: library/logging.handlers.rst:1136 +#: library/logging.handlers.rst:1161 msgid "" "If ``respect_handler_level`` is ``True``, a handler's level is respected " "(compared with the level for the message) when deciding whether to pass " @@ -1539,82 +1577,95 @@ msgid "" "versions - to always pass each message to each handler." msgstr "" -#: library/logging.handlers.rst:1141 +#: library/logging.handlers.rst:1166 msgid "The ``respect_handler_level`` argument was added." msgstr "" -#: library/logging.handlers.rst:1146 +#: library/logging.handlers.rst:1169 +msgid "" +":class:`QueueListener` can now be used as a context manager via :keyword:" +"`with`. When entering the context, the listener is started. When exiting the " +"context, the listener is stopped. :meth:`~contextmanager.__enter__` returns " +"the :class:`QueueListener` object." +msgstr "" + +#: library/logging.handlers.rst:1178 msgid "Dequeues a record and return it, optionally blocking." msgstr "" -#: library/logging.handlers.rst:1148 +#: library/logging.handlers.rst:1180 msgid "" "The base implementation uses ``get()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: library/logging.handlers.rst:1154 +#: library/logging.handlers.rst:1186 msgid "Prepare a record for handling." msgstr "" -#: library/logging.handlers.rst:1156 +#: library/logging.handlers.rst:1188 msgid "" "This implementation just returns the passed-in record. You may want to " "override this method if you need to do any custom marshalling or " "manipulation of the record before passing it to the handlers." msgstr "" -#: library/logging.handlers.rst:1162 +#: library/logging.handlers.rst:1194 msgid "Handle a record." msgstr "" -#: library/logging.handlers.rst:1164 +#: library/logging.handlers.rst:1196 msgid "" "This just loops through the handlers offering them the record to handle. The " "actual object passed to the handlers is that which is returned from :meth:" "`prepare`." msgstr "" -#: library/logging.handlers.rst:1170 +#: library/logging.handlers.rst:1202 msgid "Starts the listener." msgstr "" -#: library/logging.handlers.rst:1172 +#: library/logging.handlers.rst:1204 msgid "" "This starts up a background thread to monitor the queue for LogRecords to " "process." msgstr "" -#: library/logging.handlers.rst:1177 +#: library/logging.handlers.rst:1207 +msgid "" +"Raises :exc:`RuntimeError` if called and the listener is already running." +msgstr "" + +#: library/logging.handlers.rst:1213 msgid "Stops the listener." msgstr "" -#: library/logging.handlers.rst:1179 +#: library/logging.handlers.rst:1215 msgid "" "This asks the thread to terminate, and then waits for it to do so. Note that " "if you don't call this before your application exits, there may be some " "records still left on the queue, which won't be processed." msgstr "" -#: library/logging.handlers.rst:1185 +#: library/logging.handlers.rst:1221 msgid "" "Writes a sentinel to the queue to tell the listener to quit. This " "implementation uses ``put_nowait()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: library/logging.handlers.rst:1196 +#: library/logging.handlers.rst:1231 msgid "Module :mod:`logging`" msgstr "" -#: library/logging.handlers.rst:1196 +#: library/logging.handlers.rst:1232 msgid "API reference for the logging module." msgstr "" -#: library/logging.handlers.rst:1198 +#: library/logging.handlers.rst:1234 msgid "Module :mod:`logging.config`" msgstr "" -#: library/logging.handlers.rst:1199 +#: library/logging.handlers.rst:1235 msgid "Configuration API for the logging module." msgstr "" diff --git a/library/logging.po b/library/logging.po index c3ebf195..59dba5d6 100644 --- a/library/logging.po +++ b/library/logging.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/logging.rst:2 -msgid ":mod:`logging` --- Logging facility for Python" +msgid ":mod:`!logging` --- Logging facility for Python" msgstr "" #: library/logging.rst:10 @@ -60,22 +61,56 @@ msgstr "" msgid "Here's a simple example of idiomatic usage: ::" msgstr "" +#: library/logging.rst:35 +msgid "" +"# myapp.py\n" +"import logging\n" +"import mylib\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def main():\n" +" logging.basicConfig(filename='myapp.log', level=logging.INFO)\n" +" logger.info('Started')\n" +" mylib.do_something()\n" +" logger.info('Finished')\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: library/logging.rst:51 +msgid "" +"# mylib.py\n" +"import logging\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def do_something():\n" +" logger.info('Doing something')" +msgstr "" + #: library/logging.rst:58 msgid "If you run *myapp.py*, you should see this in *myapp.log*:" msgstr "" +#: library/logging.rst:60 +msgid "" +"INFO:__main__:Started\n" +"INFO:mylib:Doing something\n" +"INFO:__main__:Finished" +msgstr "" + #: library/logging.rst:66 msgid "" -"The key features of this idiomatic usage is that the majority of code is " +"The key feature of this idiomatic usage is that the majority of code is " "simply creating a module level logger with ``getLogger(__name__)``, and " -"using that logger to do any needed logging. This is concise while allowing " -"downstream code fine grained control if needed. Logged messages to the " -"module-level logger get forwarded up to handlers of loggers in higher-level " -"modules, all the way up to the root logger; for this reason this approach is " -"known as hierarchical logging." +"using that logger to do any needed logging. This is concise, while allowing " +"downstream code fine-grained control if needed. Logged messages to the " +"module-level logger get forwarded to handlers of loggers in higher-level " +"modules, all the way up to the highest-level logger known as the root " +"logger; this approach is known as hierarchical logging." msgstr "" -#: library/logging.rst:73 +#: library/logging.rst:74 msgid "" "For logging to be useful, it needs to be configured: setting the levels and " "destinations for each logger, potentially changing how specific modules log, " @@ -86,44 +121,44 @@ msgid "" "to configure the root logger that handles many use cases." msgstr "" -#: library/logging.rst:81 +#: library/logging.rst:82 msgid "" "The module provides a lot of functionality and flexibility. If you are " "unfamiliar with logging, the best way to get to grips with it is to view the " "tutorials (**see the links above and on the right**)." msgstr "" -#: library/logging.rst:85 +#: library/logging.rst:86 msgid "" -"The basic classes defined by the module, together with their functions, are " -"listed below." +"The basic classes defined by the module, together with their attributes and " +"methods, are listed in the sections below." msgstr "" -#: library/logging.rst:88 +#: library/logging.rst:89 msgid "Loggers expose the interface that application code directly uses." msgstr "" -#: library/logging.rst:89 +#: library/logging.rst:90 msgid "" "Handlers send the log records (created by loggers) to the appropriate " "destination." msgstr "" -#: library/logging.rst:91 +#: library/logging.rst:92 msgid "" "Filters provide a finer grained facility for determining which log records " "to output." msgstr "" -#: library/logging.rst:93 +#: library/logging.rst:94 msgid "Formatters specify the layout of log records in the final output." msgstr "" -#: library/logging.rst:99 +#: library/logging.rst:100 msgid "Logger Objects" msgstr "" -#: library/logging.rst:101 +#: library/logging.rst:102 msgid "" "Loggers have the following attributes and methods. Note that Loggers should " "*NEVER* be instantiated directly, but always through the module-level " @@ -131,51 +166,52 @@ msgid "" "with the same name will always return a reference to the same Logger object." msgstr "" -#: library/logging.rst:106 +#: library/logging.rst:107 msgid "" "The ``name`` is potentially a period-separated hierarchical value, like " "``foo.bar.baz`` (though it could also be just plain ``foo``, for example). " "Loggers that are further down in the hierarchical list are children of " "loggers higher up in the list. For example, given a logger with a name of " "``foo``, loggers with names of ``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` " -"are all descendants of ``foo``. The logger name hierarchy is analogous to " -"the Python package hierarchy, and identical to it if you organise your " -"loggers on a per-module basis using the recommended construction ``logging." +"are all descendants of ``foo``. In addition, all loggers are descendants of " +"the root logger. The logger name hierarchy is analogous to the Python " +"package hierarchy, and identical to it if you organise your loggers on a per-" +"module basis using the recommended construction ``logging." "getLogger(__name__)``. That's because in a module, ``__name__`` is the " "module's name in the Python package namespace." msgstr "" -#: library/logging.rst:122 +#: library/logging.rst:123 msgid "" "This is the logger's name, and is the value that was passed to :func:" "`getLogger` to obtain the logger." msgstr "" -#: library/logging.rst:185 +#: library/logging.rst:186 msgid "This attribute should be treated as read-only." msgstr "" -#: library/logging.rst:129 +#: library/logging.rst:130 msgid "The threshold of this logger, as set by the :meth:`setLevel` method." msgstr "" -#: library/logging.rst:131 +#: library/logging.rst:132 msgid "" "Do not set this attribute directly - always use :meth:`setLevel`, which has " "checks for the level passed to it." msgstr "" -#: library/logging.rst:136 +#: library/logging.rst:137 msgid "" "The parent logger of this logger. It may change based on later instantiation " "of loggers which are higher up in the namespace hierarchy." msgstr "" -#: library/logging.rst:139 +#: library/logging.rst:140 msgid "This value should be treated as read-only." msgstr "" -#: library/logging.rst:143 +#: library/logging.rst:144 msgid "" "If this attribute evaluates to true, events logged to this logger will be " "passed to the handlers of higher level (ancestor) loggers, in addition to " @@ -184,13 +220,13 @@ msgid "" "loggers in question are considered." msgstr "" -#: library/logging.rst:149 +#: library/logging.rst:150 msgid "" "If this evaluates to false, logging messages are not passed to the handlers " "of ancestor loggers." msgstr "" -#: library/logging.rst:152 +#: library/logging.rst:153 msgid "" "Spelling it out with an example: If the propagate attribute of the logger " "named ``A.B.C`` evaluates to true, any event logged to ``A.B.C`` via a " @@ -203,11 +239,11 @@ msgid "" "handle, and propagation stops at that point." msgstr "" -#: library/logging.rst:161 +#: library/logging.rst:162 msgid "The constructor sets this attribute to ``True``." msgstr "" -#: library/logging.rst:163 +#: library/logging.rst:164 msgid "" "If you attach a handler to a logger *and* one or more of its ancestors, it " "may emit the same record multiple times. In general, you should not need to " @@ -219,24 +255,24 @@ msgid "" "rest." msgstr "" -#: library/logging.rst:174 +#: library/logging.rst:175 msgid "The list of handlers directly attached to this logger instance." msgstr "" -#: library/logging.rst:176 +#: library/logging.rst:177 msgid "" "This attribute should be treated as read-only; it is normally changed via " "the :meth:`addHandler` and :meth:`removeHandler` methods, which use locks to " "ensure thread-safe operation." msgstr "" -#: library/logging.rst:182 +#: library/logging.rst:183 msgid "" "This attribute disables handling of any events. It is set to ``False`` in " "the initializer, and only changed by logging configuration code." msgstr "" -#: library/logging.rst:189 +#: library/logging.rst:190 msgid "" "Sets the threshold for this logger to *level*. Logging messages which are " "less severe than *level* will be ignored; logging messages which have " @@ -245,7 +281,7 @@ msgid "" "severity level than *level*." msgstr "" -#: library/logging.rst:194 +#: library/logging.rst:195 msgid "" "When a logger is created, the level is set to :const:`NOTSET` (which causes " "all messages to be processed when the logger is the root logger, or " @@ -253,32 +289,32 @@ msgid "" "the root logger is created with level :const:`WARNING`." msgstr "" -#: library/logging.rst:199 +#: library/logging.rst:200 msgid "" "The term 'delegation to the parent' means that if a logger has a level of " "NOTSET, its chain of ancestor loggers is traversed until either an ancestor " "with a level other than NOTSET is found, or the root is reached." msgstr "" -#: library/logging.rst:203 +#: library/logging.rst:204 msgid "" "If an ancestor is found with a level other than NOTSET, then that ancestor's " "level is treated as the effective level of the logger where the ancestor " "search began, and is used to determine how a logging event is handled." msgstr "" -#: library/logging.rst:207 +#: library/logging.rst:208 msgid "" "If the root is reached, and it has a level of NOTSET, then all messages will " "be processed. Otherwise, the root's level will be used as the effective " "level." msgstr "" -#: library/logging.rst:553 +#: library/logging.rst:555 msgid "See :ref:`levels` for a list of levels." msgstr "" -#: library/logging.rst:212 +#: library/logging.rst:213 msgid "" "The *level* parameter now accepts a string representation of the level such " "as 'INFO' as an alternative to the integer constants such as :const:`INFO`. " @@ -287,7 +323,7 @@ msgid "" "expect to be passed integers." msgstr "" -#: library/logging.rst:222 +#: library/logging.rst:223 msgid "" "Indicates if a message of severity *level* would be processed by this " "logger. This method checks first the module-level level set by ``logging." @@ -295,7 +331,7 @@ msgid "" "meth:`getEffectiveLevel`." msgstr "" -#: library/logging.rst:230 +#: library/logging.rst:231 msgid "" "Indicates the effective level for this logger. If a value other than :const:" "`NOTSET` has been set using :meth:`setLevel`, it is returned. Otherwise, the " @@ -304,7 +340,7 @@ msgid "" "integer, typically one of :const:`logging.DEBUG`, :const:`logging.INFO` etc." msgstr "" -#: library/logging.rst:240 +#: library/logging.rst:241 msgid "" "Returns a logger which is a descendant to this logger, as determined by the " "suffix. Thus, ``logging.getLogger('abc').getChild('def.ghi')`` would return " @@ -313,7 +349,7 @@ msgid "" "named using e.g. ``__name__`` rather than a literal string." msgstr "" -#: library/logging.rst:251 +#: library/logging.rst:252 msgid "" "Returns a set of loggers which are immediate children of this logger. So for " "example ``logging.getLogger().getChildren()`` might return a set containing " @@ -323,7 +359,7 @@ msgid "" "include one named ``foo.bar.baz``." msgstr "" -#: library/logging.rst:263 +#: library/logging.rst:264 msgid "" "Logs a message with level :const:`DEBUG` on this logger. The *msg* is the " "message format string, and the *args* are the arguments which are merged " @@ -333,13 +369,13 @@ msgid "" "are supplied." msgstr "" -#: library/logging.rst:269 +#: library/logging.rst:270 msgid "" "There are four keyword arguments in *kwargs* which are inspected: " "*exc_info*, *stack_info*, *stacklevel* and *extra*." msgstr "" -#: library/logging.rst:272 +#: library/logging.rst:273 msgid "" "If *exc_info* does not evaluate as false, it causes exception information to " "be added to the logging message. If an exception tuple (in the format " @@ -348,7 +384,7 @@ msgid "" "information." msgstr "" -#: library/logging.rst:277 +#: library/logging.rst:278 msgid "" "The second optional keyword argument is *stack_info*, which defaults to " "``False``. If true, stack information is added to the logging message, " @@ -360,20 +396,24 @@ msgid "" "handlers." msgstr "" -#: library/logging.rst:286 +#: library/logging.rst:287 msgid "" "You can specify *stack_info* independently of *exc_info*, e.g. to just show " "how you got to a certain point in your code, even when no exceptions were " "raised. The stack frames are printed following a header line which says:" msgstr "" -#: library/logging.rst:294 +#: library/logging.rst:291 +msgid "Stack (most recent call last):" +msgstr "" + +#: library/logging.rst:295 msgid "" "This mimics the ``Traceback (most recent call last):`` which is used when " "displaying exception frames." msgstr "" -#: library/logging.rst:297 +#: library/logging.rst:298 msgid "" "The third optional keyword argument is *stacklevel*, which defaults to " "``1``. If greater than 1, the corresponding number of stack frames are " @@ -385,27 +425,42 @@ msgid "" "module." msgstr "" -#: library/logging.rst:305 +#: library/logging.rst:306 msgid "" "The fourth keyword argument is *extra* which can be used to pass a " -"dictionary which is used to populate the __dict__ of the :class:`LogRecord` " -"created for the logging event with user-defined attributes. These custom " -"attributes can then be used as you like. For example, they could be " -"incorporated into logged messages. For example::" +"dictionary which is used to populate the :attr:`~object.__dict__` of the :" +"class:`LogRecord` created for the logging event with user-defined " +"attributes. These custom attributes can then be used as you like. For " +"example, they could be incorporated into logged messages. For example::" msgstr "" -#: library/logging.rst:317 +#: library/logging.rst:313 +msgid "" +"FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'\n" +"logging.basicConfig(format=FORMAT)\n" +"d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}\n" +"logger = logging.getLogger('tcpserver')\n" +"logger.warning('Protocol problem: %s', 'connection reset', extra=d)" +msgstr "" + +#: library/logging.rst:319 msgid "would print something like" msgstr "" -#: library/logging.rst:323 +#: library/logging.rst:321 +msgid "" +"2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection " +"reset" +msgstr "" + +#: library/logging.rst:325 msgid "" "The keys in the dictionary passed in *extra* should not clash with the keys " "used by the logging system. (See the section on :ref:`logrecord-attributes` " "for more information on which keys are used by the logging system.)" msgstr "" -#: library/logging.rst:327 +#: library/logging.rst:329 msgid "" "If you choose to use these attributes in logged messages, you need to " "exercise some care. In the above example, for instance, the :class:" @@ -416,7 +471,7 @@ msgid "" "dictionary with these keys." msgstr "" -#: library/logging.rst:334 +#: library/logging.rst:336 msgid "" "While this might be annoying, this feature is intended for use in " "specialized circumstances, such as multi-threaded servers where the same " @@ -427,78 +482,78 @@ msgid "" "particular :class:`Handler`\\ s." msgstr "" -#: library/logging.rst:341 +#: library/logging.rst:343 msgid "" "If no handler is attached to this logger (or any of its ancestors, taking " "into account the relevant :attr:`Logger.propagate` attributes), the message " -"will be sent to the handler set on :attr:`lastResort`." +"will be sent to the handler set on :data:`lastResort`." msgstr "" -#: library/logging.rst:345 +#: library/logging.rst:347 msgid "The *stack_info* parameter was added." msgstr "" -#: library/logging.rst:348 +#: library/logging.rst:350 msgid "The *exc_info* parameter can now accept exception instances." msgstr "" -#: library/logging.rst:351 +#: library/logging.rst:353 msgid "The *stacklevel* parameter was added." msgstr "" -#: library/logging.rst:357 +#: library/logging.rst:359 msgid "" "Logs a message with level :const:`INFO` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: library/logging.rst:363 +#: library/logging.rst:365 msgid "" "Logs a message with level :const:`WARNING` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: library/logging.rst:366 +#: library/logging.rst:368 msgid "" "There is an obsolete method ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: library/logging.rst:372 +#: library/logging.rst:374 msgid "" "Logs a message with level :const:`ERROR` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: library/logging.rst:378 +#: library/logging.rst:380 msgid "" "Logs a message with level :const:`CRITICAL` on this logger. The arguments " "are interpreted as for :meth:`debug`." msgstr "" -#: library/logging.rst:384 +#: library/logging.rst:386 msgid "" "Logs a message with integer level *level* on this logger. The other " "arguments are interpreted as for :meth:`debug`." msgstr "" -#: library/logging.rst:390 +#: library/logging.rst:392 msgid "" "Logs a message with level :const:`ERROR` on this logger. The arguments are " "interpreted as for :meth:`debug`. Exception info is added to the logging " "message. This method should only be called from an exception handler." msgstr "" -#: library/logging.rst:397 +#: library/logging.rst:399 msgid "Adds the specified filter *filter* to this logger." msgstr "" -#: library/logging.rst:402 +#: library/logging.rst:404 msgid "Removes the specified filter *filter* from this logger." msgstr "" -#: library/logging.rst:407 +#: library/logging.rst:409 msgid "" "Apply this logger's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -507,22 +562,22 @@ msgid "" "processing of the record occurs." msgstr "" -#: library/logging.rst:416 +#: library/logging.rst:418 msgid "Adds the specified handler *hdlr* to this logger." msgstr "" -#: library/logging.rst:421 +#: library/logging.rst:423 msgid "Removes the specified handler *hdlr* from this logger." msgstr "" -#: library/logging.rst:426 +#: library/logging.rst:428 msgid "" "Finds the caller's source filename and line number. Returns the filename, " "line number, function name and stack information as a 4-element tuple. The " "stack information is returned as ``None`` unless *stack_info* is ``True``." msgstr "" -#: library/logging.rst:430 +#: library/logging.rst:432 msgid "" "The *stacklevel* parameter is passed from code calling the :meth:`debug` and " "other APIs. If greater than 1, the excess is used to skip stack frames " @@ -532,7 +587,7 @@ msgid "" "calls it." msgstr "" -#: library/logging.rst:440 +#: library/logging.rst:442 msgid "" "Handles a record by passing it to all handlers associated with this logger " "and its ancestors (until a false value of *propagate* is found). This method " @@ -541,13 +596,13 @@ msgid "" "filter`." msgstr "" -#: library/logging.rst:448 +#: library/logging.rst:450 msgid "" "This is a factory method which can be overridden in subclasses to create " "specialized :class:`LogRecord` instances." msgstr "" -#: library/logging.rst:453 +#: library/logging.rst:455 msgid "" "Checks to see if this logger has any handlers configured. This is done by " "looking for handlers in this logger and its parents in the logger hierarchy. " @@ -557,15 +612,15 @@ msgid "" "the existence of handlers." msgstr "" -#: library/logging.rst:462 +#: library/logging.rst:464 msgid "Loggers can now be pickled and unpickled." msgstr "" -#: library/logging.rst:468 +#: library/logging.rst:470 msgid "Logging Levels" msgstr "" -#: library/logging.rst:470 +#: library/logging.rst:472 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -574,83 +629,83 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: library/logging.rst:477 +#: library/logging.rst:479 msgid "Level" msgstr "" -#: library/logging.rst:477 +#: library/logging.rst:479 msgid "Numeric value" msgstr "" -#: library/logging.rst:477 +#: library/logging.rst:479 msgid "What it means / When to use it" msgstr "" -#: library/logging.rst:479 +#: library/logging.rst:481 msgid "0" msgstr "" -#: library/logging.rst:479 +#: library/logging.rst:481 msgid "" "When set on a logger, indicates that ancestor loggers are to be consulted to " "determine the effective level. If that still resolves to :const:`!NOTSET`, " "then all events are logged. When set on a handler, all events are handled." msgstr "" -#: library/logging.rst:487 +#: library/logging.rst:489 msgid "10" msgstr "" -#: library/logging.rst:487 +#: library/logging.rst:489 msgid "" "Detailed information, typically only of interest to a developer trying to " "diagnose a problem." msgstr "" -#: library/logging.rst:491 +#: library/logging.rst:493 msgid "20" msgstr "" -#: library/logging.rst:491 +#: library/logging.rst:493 msgid "Confirmation that things are working as expected." msgstr "" -#: library/logging.rst:494 +#: library/logging.rst:496 msgid "30" msgstr "" -#: library/logging.rst:494 +#: library/logging.rst:496 msgid "" "An indication that something unexpected happened, or that a problem might " "occur in the near future (e.g. 'disk space low'). The software is still " "working as expected." msgstr "" -#: library/logging.rst:501 +#: library/logging.rst:503 msgid "40" msgstr "" -#: library/logging.rst:501 +#: library/logging.rst:503 msgid "" "Due to a more serious problem, the software has not been able to perform " "some function." msgstr "" -#: library/logging.rst:505 +#: library/logging.rst:507 msgid "50" msgstr "" -#: library/logging.rst:505 +#: library/logging.rst:507 msgid "" "A serious error, indicating that the program itself may be unable to " "continue running." msgstr "" -#: library/logging.rst:514 +#: library/logging.rst:516 msgid "Handler Objects" msgstr "" -#: library/logging.rst:516 +#: library/logging.rst:518 msgid "" "Handlers have the following attributes and methods. Note that :class:" "`Handler` is never instantiated directly; this class acts as a base for more " @@ -658,53 +713,55 @@ msgid "" "to call :meth:`Handler.__init__`." msgstr "" -#: library/logging.rst:525 +#: library/logging.rst:527 msgid "" "Initializes the :class:`Handler` instance by setting its level, setting the " "list of filters to the empty list and creating a lock (using :meth:" "`createLock`) for serializing access to an I/O mechanism." msgstr "" -#: library/logging.rst:532 +#: library/logging.rst:534 msgid "" "Initializes a thread lock which can be used to serialize access to " "underlying I/O functionality which may not be threadsafe." msgstr "" -#: library/logging.rst:538 +#: library/logging.rst:540 msgid "Acquires the thread lock created with :meth:`createLock`." msgstr "" -#: library/logging.rst:543 +#: library/logging.rst:545 msgid "Releases the thread lock acquired with :meth:`acquire`." msgstr "" -#: library/logging.rst:548 +#: library/logging.rst:550 msgid "" "Sets the threshold for this handler to *level*. Logging messages which are " "less severe than *level* will be ignored. When a handler is created, the " "level is set to :const:`NOTSET` (which causes all messages to be processed)." msgstr "" -#: library/logging.rst:555 +#: library/logging.rst:557 msgid "" "The *level* parameter now accepts a string representation of the level such " "as 'INFO' as an alternative to the integer constants such as :const:`INFO`." msgstr "" -#: library/logging.rst:563 -msgid "Sets the :class:`Formatter` for this handler to *fmt*." +#: library/logging.rst:565 +msgid "" +"Sets the formatter for this handler to *fmt*. The *fmt* argument must be a :" +"class:`Formatter` instance or ``None``." msgstr "" -#: library/logging.rst:568 +#: library/logging.rst:571 msgid "Adds the specified filter *filter* to this handler." msgstr "" -#: library/logging.rst:573 +#: library/logging.rst:576 msgid "Removes the specified filter *filter* from this handler." msgstr "" -#: library/logging.rst:578 +#: library/logging.rst:581 msgid "" "Apply this handler's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -713,28 +770,33 @@ msgid "" "record." msgstr "" -#: library/logging.rst:587 +#: library/logging.rst:590 msgid "" "Ensure all logging output has been flushed. This version does nothing and is " "intended to be implemented by subclasses." msgstr "" -#: library/logging.rst:593 +#: library/logging.rst:596 msgid "" "Tidy up any resources used by the handler. This version does no output but " -"removes the handler from an internal list of handlers which is closed when :" -"func:`shutdown` is called. Subclasses should ensure that this gets called " -"from overridden :meth:`close` methods." +"removes the handler from an internal map of handlers, which is used for " +"handler lookup by name." msgstr "" -#: library/logging.rst:601 +#: library/logging.rst:600 +msgid "" +"Subclasses should ensure that this gets called from overridden :meth:`close` " +"methods." +msgstr "" + +#: library/logging.rst:606 msgid "" "Conditionally emits the specified logging record, depending on filters which " "may have been added to the handler. Wraps the actual emission of the record " "with acquisition/release of the I/O thread lock." msgstr "" -#: library/logging.rst:608 +#: library/logging.rst:613 msgid "" "This method should be called from handlers when an exception is encountered " "during an :meth:`emit` call. If the module-level attribute :data:" @@ -747,20 +809,20 @@ msgid "" "is more useful during development)." msgstr "" -#: library/logging.rst:621 +#: library/logging.rst:626 msgid "" "Do formatting for a record - if a formatter is set, use it. Otherwise, use " "the default formatter for the module." msgstr "" -#: library/logging.rst:627 +#: library/logging.rst:632 msgid "" "Do whatever it takes to actually log the specified logging record. This " "version is intended to be implemented by subclasses and so raises a :exc:" "`NotImplementedError`." msgstr "" -#: library/logging.rst:631 +#: library/logging.rst:636 msgid "" "This method is called after a handler-level lock is acquired, which is " "released after this method returns. When you override this method, note that " @@ -769,13 +831,13 @@ msgid "" "Specifically:" msgstr "" -#: library/logging.rst:637 +#: library/logging.rst:642 msgid "" "Logging configuration APIs acquire the module-level lock, and then " "individual handler-level locks as those handlers are configured." msgstr "" -#: library/logging.rst:640 +#: library/logging.rst:645 msgid "" "Many logging APIs lock the module-level lock. If such an API is called from " "this method, it could cause a deadlock if a configuration call is made on " @@ -785,16 +847,16 @@ msgid "" "method, the handler-level lock has already been acquired)." msgstr "" -#: library/logging.rst:647 +#: library/logging.rst:652 msgid "" "For a list of handlers included as standard, see :mod:`logging.handlers`." msgstr "" -#: library/logging.rst:652 +#: library/logging.rst:657 msgid "Formatter Objects" msgstr "" -#: library/logging.rst:658 +#: library/logging.rst:663 msgid "" "Responsible for converting a :class:`LogRecord` to an output string to be " "interpreted by a human or external system." @@ -804,7 +866,7 @@ msgstr "" msgid "Parameters" msgstr "" -#: library/logging.rst:661 +#: library/logging.rst:666 msgid "" "A format string in the given *style* for the logged output as a whole. The " "possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" @@ -812,50 +874,49 @@ msgid "" "is just the logged message." msgstr "" -#: library/logging.rst:669 +#: library/logging.rst:674 msgid "" -"A format string in the given *style* for the date/time portion of the logged " -"output. If not specified, the default described in :meth:`formatTime` is " -"used." +"A format string for the date/time portion of the logged output. If not " +"specified, the default described in :meth:`formatTime` is used." msgstr "" -#: library/logging.rst:674 +#: library/logging.rst:678 msgid "" "Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines how the format " "string will be merged with its data: using one of :ref:`old-string-" "formatting` (``%``), :meth:`str.format` (``{``) or :class:`string.Template` " -"(``$``). This only applies to *fmt* and *datefmt* (e.g. ``'%(message)s'`` " -"versus ``'{message}'``), not to the actual log messages passed to the " -"logging methods. However, there are :ref:`other ways ` to " -"use ``{``- and ``$``-formatting for log messages." +"(``$``). This only applies to *fmt* (e.g. ``'%(message)s'`` versus " +"``'{message}'``), not to the actual log messages passed to the logging " +"methods. However, there are :ref:`other ways ` to use " +"``{``- and ``$``-formatting for log messages." msgstr "" -#: library/logging.rst:684 +#: library/logging.rst:688 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " "raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " "%(message)s', style='{')``." msgstr "" -#: library/logging.rst:689 +#: library/logging.rst:693 msgid "" "A dictionary with default values to use in custom fields. For example, " "``logging.Formatter('%(ip)s %(message)s', defaults={\"ip\": None})``" msgstr "" -#: library/logging.rst:694 +#: library/logging.rst:698 msgid "Added the *style* parameter." msgstr "" -#: library/logging.rst:697 +#: library/logging.rst:701 msgid "Added the *validate* parameter." msgstr "" -#: library/logging.rst:700 +#: library/logging.rst:704 msgid "Added the *defaults* parameter." msgstr "" -#: library/logging.rst:706 +#: library/logging.rst:710 msgid "" "The record's attribute dictionary is used as the operand to a string " "formatting operation. Returns the resulting string. Before formatting the " @@ -874,13 +935,13 @@ msgid "" "recalculates it afresh." msgstr "" -#: library/logging.rst:722 +#: library/logging.rst:726 msgid "" "If stack information is available, it's appended after the exception " "information, using :meth:`formatStack` to transform it if necessary." msgstr "" -#: library/logging.rst:728 +#: library/logging.rst:732 msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " @@ -893,7 +954,7 @@ msgid "" "resulting string is returned." msgstr "" -#: library/logging.rst:738 +#: library/logging.rst:742 msgid "" "This function uses a user-configurable function to convert the creation time " "to a tuple. By default, :func:`time.localtime` is used; to change this for a " @@ -903,7 +964,7 @@ msgid "" "be shown in GMT, set the ``converter`` attribute in the ``Formatter`` class." msgstr "" -#: library/logging.rst:746 +#: library/logging.rst:750 msgid "" "Previously, the default format was hard-coded as in this example: " "``2010-09-06 22:38:15,292`` where the part before the comma is handled by a " @@ -918,11 +979,11 @@ msgid "" "the millisecond value)." msgstr "" -#: library/logging.rst:759 +#: library/logging.rst:763 msgid "The ``default_msec_format`` can be ``None``." msgstr "" -#: library/logging.rst:764 +#: library/logging.rst:768 msgid "" "Formats the specified exception information (a standard exception tuple as " "returned by :func:`sys.exc_info`) as a string. This default implementation " @@ -930,14 +991,14 @@ msgid "" "returned." msgstr "" -#: library/logging.rst:771 +#: library/logging.rst:775 msgid "" "Formats the specified stack information (a string as returned by :func:" "`traceback.print_stack`, but with the last newline removed) as a string. " "This default implementation just returns the input value." msgstr "" -#: library/logging.rst:777 +#: library/logging.rst:781 msgid "" "A base formatter class suitable for subclassing when you want to format a " "number of records. You can pass a :class:`Formatter` instance which you want " @@ -946,7 +1007,7 @@ msgid "" "used as the line formatter." msgstr "" -#: library/logging.rst:785 +#: library/logging.rst:789 msgid "" "Return a header for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " @@ -954,14 +1015,14 @@ msgid "" "separator line." msgstr "" -#: library/logging.rst:792 +#: library/logging.rst:796 msgid "" "Return a footer for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " "specific behaviour, e.g. to show the count of records or a separator line." msgstr "" -#: library/logging.rst:799 +#: library/logging.rst:803 msgid "" "Return formatted text for a list of *records*. The base implementation just " "returns the empty string if there are no records; otherwise, it returns the " @@ -969,11 +1030,11 @@ msgid "" "and the footer." msgstr "" -#: library/logging.rst:807 +#: library/logging.rst:811 msgid "Filter Objects" msgstr "" -#: library/logging.rst:809 +#: library/logging.rst:813 msgid "" "``Filters`` can be used by ``Handlers`` and ``Loggers`` for more " "sophisticated filtering than is provided by levels. The base filter class " @@ -983,7 +1044,7 @@ msgid "" "If initialized with the empty string, all events are passed." msgstr "" -#: library/logging.rst:819 +#: library/logging.rst:823 msgid "" "Returns an instance of the :class:`Filter` class. If *name* is specified, it " "names a logger which, together with its children, will have its events " @@ -991,7 +1052,7 @@ msgid "" "event." msgstr "" -#: library/logging.rst:826 +#: library/logging.rst:830 msgid "" "Is the specified record to be logged? Returns false for no, true for yes. " "Filters can either modify log records in-place or return a completely " @@ -999,7 +1060,7 @@ msgid "" "future processing of the event." msgstr "" -#: library/logging.rst:831 +#: library/logging.rst:835 msgid "" "Note that filters attached to handlers are consulted before an event is " "emitted by the handler, whereas filters attached to loggers are consulted " @@ -1009,13 +1070,13 @@ msgid "" "setting, unless the filter has also been applied to those descendant loggers." msgstr "" -#: library/logging.rst:838 +#: library/logging.rst:842 msgid "" "You don't actually need to subclass ``Filter``: you can pass any instance " "which has a ``filter`` method with the same semantics." msgstr "" -#: library/logging.rst:841 +#: library/logging.rst:845 msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " @@ -1026,7 +1087,7 @@ msgid "" "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" -#: library/logging.rst:851 +#: library/logging.rst:855 msgid "" "You can now return a :class:`LogRecord` instance from filters to replace the " "log record rather than modifying it in place. This allows filters attached " @@ -1034,7 +1095,7 @@ msgid "" "having side effects on other handlers." msgstr "" -#: library/logging.rst:857 +#: library/logging.rst:861 msgid "" "Although filters are used primarily to filter records based on more " "sophisticated criteria than levels, they get to see every record which is " @@ -1046,11 +1107,11 @@ msgid "" "contextual information into logs (see :ref:`filters-contextual`)." msgstr "" -#: library/logging.rst:870 +#: library/logging.rst:874 msgid "LogRecord Objects" msgstr "" -#: library/logging.rst:872 +#: library/logging.rst:876 msgid "" ":class:`LogRecord` instances are created automatically by the :class:" "`Logger` every time something is logged, and can be created manually via :" @@ -1058,17 +1119,17 @@ msgid "" "wire)." msgstr "" -#: library/logging.rst:880 +#: library/logging.rst:884 msgid "Contains all the information pertinent to the event being logged." msgstr "" -#: library/logging.rst:882 +#: library/logging.rst:886 msgid "" "The primary information is passed in *msg* and *args*, which are combined " "using ``msg % args`` to create the :attr:`!message` attribute of the record." msgstr "" -#: library/logging.rst:886 +#: library/logging.rst:890 msgid "" "The name of the logger used to log the event represented by this :class:`!" "LogRecord`. Note that the logger name in the :class:`!LogRecord` will always " @@ -1076,7 +1137,7 @@ msgid "" "different (ancestor) logger." msgstr "" -#: library/logging.rst:894 +#: library/logging.rst:898 msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " @@ -1084,46 +1145,46 @@ msgid "" "attr:`!levelname` for the corresponding level name." msgstr "" -#: library/logging.rst:901 +#: library/logging.rst:905 msgid "" "The full string path of the source file where the logging call was made." msgstr "" -#: library/logging.rst:905 +#: library/logging.rst:909 msgid "The line number in the source file where the logging call was made." msgstr "" -#: library/logging.rst:909 +#: library/logging.rst:913 msgid "" "The event description message, which can be a %-format string with " "placeholders for variable data, or an arbitrary object (see :ref:`arbitrary-" "object-messages`)." msgstr "" -#: library/logging.rst:914 +#: library/logging.rst:918 msgid "" "Variable data to merge into the *msg* argument to obtain the event " "description." msgstr "" -#: library/logging.rst:918 +#: library/logging.rst:922 msgid "" "An exception tuple with the current exception information, as returned by :" "func:`sys.exc_info`, or ``None`` if no exception information is available." msgstr "" -#: library/logging.rst:923 +#: library/logging.rst:927 msgid "" "The name of the function or method from which the logging call was invoked." msgstr "" -#: library/logging.rst:927 +#: library/logging.rst:931 msgid "" "A text string representing stack information from the base of the stack in " "the current thread, up to the logging call." msgstr "" -#: library/logging.rst:934 +#: library/logging.rst:938 msgid "" "Returns the message for this :class:`LogRecord` instance after merging any " "user-supplied arguments with the message. If the user-supplied message " @@ -1132,7 +1193,7 @@ msgid "" "whose ``__str__`` method can return the actual format string to be used." msgstr "" -#: library/logging.rst:941 +#: library/logging.rst:945 msgid "" "The creation of a :class:`LogRecord` has been made more configurable by " "providing a factory which is used to create the record. The factory can be " @@ -1140,24 +1201,36 @@ msgid "" "this for the factory's signature)." msgstr "" -#: library/logging.rst:947 +#: library/logging.rst:951 msgid "" "This functionality can be used to inject your own values into a :class:" "`LogRecord` at creation time. You can use the following pattern::" msgstr "" -#: library/logging.rst:959 +#: library/logging.rst:954 +msgid "" +"old_factory = logging.getLogRecordFactory()\n" +"\n" +"def record_factory(*args, **kwargs):\n" +" record = old_factory(*args, **kwargs)\n" +" record.custom_attribute = 0xdecafbad\n" +" return record\n" +"\n" +"logging.setLogRecordFactory(record_factory)" +msgstr "" + +#: library/logging.rst:963 msgid "" "With this pattern, multiple factories could be chained, and as long as they " "don't overwrite each other's attributes or unintentionally overwrite the " "standard attributes listed above, there should be no surprises." msgstr "" -#: library/logging.rst:968 +#: library/logging.rst:972 msgid "LogRecord attributes" msgstr "" -#: library/logging.rst:970 +#: library/logging.rst:974 msgid "" "The LogRecord has a number of attributes, most of which are derived from the " "parameters to the constructor. (Note that the names do not always correspond " @@ -1168,7 +1241,7 @@ msgid "" "style format string." msgstr "" -#: library/logging.rst:978 +#: library/logging.rst:982 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" "`` as the placeholder in the format string. If you are using $-formatting (:" @@ -1176,7 +1249,7 @@ msgid "" "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" -#: library/logging.rst:984 +#: library/logging.rst:988 msgid "" "In the case of {}-formatting, you can specify formatting flags by placing " "them after the attribute name, separated from it with a colon. For example: " @@ -1185,323 +1258,328 @@ msgid "" "on the options available to you." msgstr "" -#: library/logging.rst:991 +#: library/logging.rst:995 msgid "Attribute name" msgstr "" -#: library/logging.rst:1351 +#: library/logging.rst:1370 msgid "Format" msgstr "" -#: library/logging.rst:1351 +#: library/logging.rst:1370 msgid "Description" msgstr "" -#: library/logging.rst:993 +#: library/logging.rst:997 msgid "args" msgstr "" -#: library/logging.rst:1007 library/logging.rst:1053 +#: library/logging.rst:1011 library/logging.rst:1057 msgid "You shouldn't need to format this yourself." msgstr "" -#: library/logging.rst:993 +#: library/logging.rst:997 msgid "" "The tuple of arguments merged into ``msg`` to produce ``message``, or a dict " "whose values are used for the merge (when there is only one argument, and it " "is a dictionary)." msgstr "" -#: library/logging.rst:998 +#: library/logging.rst:1002 msgid "asctime" msgstr "" -#: library/logging.rst:998 +#: library/logging.rst:1002 msgid "``%(asctime)s``" msgstr "" -#: library/logging.rst:998 +#: library/logging.rst:1002 msgid "" "Human-readable time when the :class:`LogRecord` was created. By default " "this is of the form '2003-07-08 16:49:45,896' (the numbers after the comma " "are millisecond portion of the time)." msgstr "" -#: library/logging.rst:1004 +#: library/logging.rst:1008 msgid "created" msgstr "" -#: library/logging.rst:1004 +#: library/logging.rst:1008 msgid "``%(created)f``" msgstr "" -#: library/logging.rst:1004 +#: library/logging.rst:1008 msgid "" "Time when the :class:`LogRecord` was created (as returned by :func:`time." -"time`)." +"time_ns` / 1e9)." msgstr "" -#: library/logging.rst:1007 +#: library/logging.rst:1011 msgid "exc_info" msgstr "" -#: library/logging.rst:1007 +#: library/logging.rst:1011 msgid "" "Exception tuple (à la ``sys.exc_info``) or, if no exception has occurred, " "``None``." msgstr "" -#: library/logging.rst:1010 +#: library/logging.rst:1014 msgid "filename" msgstr "" -#: library/logging.rst:1010 +#: library/logging.rst:1014 msgid "``%(filename)s``" msgstr "" -#: library/logging.rst:1010 +#: library/logging.rst:1014 msgid "Filename portion of ``pathname``." msgstr "" -#: library/logging.rst:1012 +#: library/logging.rst:1016 msgid "funcName" msgstr "" -#: library/logging.rst:1012 +#: library/logging.rst:1016 msgid "``%(funcName)s``" msgstr "" -#: library/logging.rst:1012 +#: library/logging.rst:1016 msgid "Name of function containing the logging call." msgstr "" -#: library/logging.rst:1014 +#: library/logging.rst:1018 msgid "levelname" msgstr "" -#: library/logging.rst:1014 +#: library/logging.rst:1018 msgid "``%(levelname)s``" msgstr "" -#: library/logging.rst:1014 +#: library/logging.rst:1018 msgid "" "Text logging level for the message (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, " "``'ERROR'``, ``'CRITICAL'``)." msgstr "" -#: library/logging.rst:1018 +#: library/logging.rst:1022 msgid "levelno" msgstr "" -#: library/logging.rst:1018 +#: library/logging.rst:1022 msgid "``%(levelno)s``" msgstr "" -#: library/logging.rst:1018 +#: library/logging.rst:1022 msgid "" "Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" "`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" -#: library/logging.rst:1023 +#: library/logging.rst:1027 msgid "lineno" msgstr "" -#: library/logging.rst:1023 +#: library/logging.rst:1027 msgid "``%(lineno)d``" msgstr "" -#: library/logging.rst:1023 +#: library/logging.rst:1027 msgid "Source line number where the logging call was issued (if available)." msgstr "" -#: library/logging.rst:1026 +#: library/logging.rst:1030 msgid "message" msgstr "" -#: library/logging.rst:1026 +#: library/logging.rst:1030 msgid "``%(message)s``" msgstr "" -#: library/logging.rst:1026 +#: library/logging.rst:1030 msgid "" "The logged message, computed as ``msg % args``. This is set when :meth:" "`Formatter.format` is invoked." msgstr "" -#: library/logging.rst:1030 +#: library/logging.rst:1034 msgid "module" msgstr "" -#: library/logging.rst:1030 +#: library/logging.rst:1034 msgid "``%(module)s``" msgstr "" -#: library/logging.rst:1030 +#: library/logging.rst:1034 msgid "Module (name portion of ``filename``)." msgstr "" -#: library/logging.rst:1032 +#: library/logging.rst:1036 msgid "msecs" msgstr "" -#: library/logging.rst:1032 +#: library/logging.rst:1036 msgid "``%(msecs)d``" msgstr "" -#: library/logging.rst:1032 +#: library/logging.rst:1036 msgid "" "Millisecond portion of the time when the :class:`LogRecord` was created." msgstr "" -#: library/logging.rst:1035 +#: library/logging.rst:1039 msgid "msg" msgstr "" -#: library/logging.rst:1035 +#: library/logging.rst:1039 msgid "" "The format string passed in the original logging call. Merged with ``args`` " "to produce ``message``, or an arbitrary object (see :ref:`arbitrary-object-" "messages`)." msgstr "" -#: library/logging.rst:1040 +#: library/logging.rst:1044 msgid "name" msgstr "" -#: library/logging.rst:1040 +#: library/logging.rst:1044 msgid "``%(name)s``" msgstr "" -#: library/logging.rst:1040 +#: library/logging.rst:1044 msgid "Name of the logger used to log the call." msgstr "" -#: library/logging.rst:1042 +#: library/logging.rst:1046 msgid "pathname" msgstr "" -#: library/logging.rst:1042 +#: library/logging.rst:1046 msgid "``%(pathname)s``" msgstr "" -#: library/logging.rst:1042 +#: library/logging.rst:1046 msgid "" "Full pathname of the source file where the logging call was issued (if " "available)." msgstr "" -#: library/logging.rst:1045 +#: library/logging.rst:1049 msgid "process" msgstr "" -#: library/logging.rst:1045 +#: library/logging.rst:1049 msgid "``%(process)d``" msgstr "" -#: library/logging.rst:1045 +#: library/logging.rst:1049 msgid "Process ID (if available)." msgstr "" -#: library/logging.rst:1047 +#: library/logging.rst:1051 msgid "processName" msgstr "" -#: library/logging.rst:1047 +#: library/logging.rst:1051 msgid "``%(processName)s``" msgstr "" -#: library/logging.rst:1047 +#: library/logging.rst:1051 msgid "Process name (if available)." msgstr "" -#: library/logging.rst:1049 +#: library/logging.rst:1053 msgid "relativeCreated" msgstr "" -#: library/logging.rst:1049 +#: library/logging.rst:1053 msgid "``%(relativeCreated)d``" msgstr "" -#: library/logging.rst:1049 +#: library/logging.rst:1053 msgid "" "Time in milliseconds when the LogRecord was created, relative to the time " "the logging module was loaded." msgstr "" -#: library/logging.rst:1053 +#: library/logging.rst:1057 msgid "stack_info" msgstr "" -#: library/logging.rst:1053 +#: library/logging.rst:1057 msgid "" "Stack frame information (where available) from the bottom of the stack in " "the current thread, up to and including the stack frame of the logging call " "which resulted in the creation of this record." msgstr "" -#: library/logging.rst:1059 +#: library/logging.rst:1063 msgid "thread" msgstr "" -#: library/logging.rst:1059 +#: library/logging.rst:1063 msgid "``%(thread)d``" msgstr "" -#: library/logging.rst:1059 +#: library/logging.rst:1063 msgid "Thread ID (if available)." msgstr "" -#: library/logging.rst:1061 +#: library/logging.rst:1065 msgid "threadName" msgstr "" -#: library/logging.rst:1061 +#: library/logging.rst:1065 msgid "``%(threadName)s``" msgstr "" -#: library/logging.rst:1061 +#: library/logging.rst:1065 msgid "Thread name (if available)." msgstr "" -#: library/logging.rst:1063 +#: library/logging.rst:1067 msgid "taskName" msgstr "" -#: library/logging.rst:1063 +#: library/logging.rst:1067 msgid "``%(taskName)s``" msgstr "" -#: library/logging.rst:1063 +#: library/logging.rst:1067 msgid ":class:`asyncio.Task` name (if available)." msgstr "" -#: library/logging.rst:1066 +#: library/logging.rst:1070 msgid "*processName* was added." msgstr "" -#: library/logging.rst:1069 +#: library/logging.rst:1073 msgid "*taskName* was added." msgstr "" -#: library/logging.rst:1075 +#: library/logging.rst:1079 msgid "LoggerAdapter Objects" msgstr "" -#: library/logging.rst:1077 +#: library/logging.rst:1081 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " "information into logging calls. For a usage example, see the section on :ref:" "`adding contextual information to your logging output `." msgstr "" -#: library/logging.rst:1083 +#: library/logging.rst:1087 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " -"underlying :class:`Logger` instance and a dict-like object." +"underlying :class:`Logger` instance, an optional dict-like object (*extra*), " +"and an optional boolean (*merge_extra*) indicating whether or not the " +"*extra* argument of individual log calls should be merged with the :class:" +"`LoggerAdapter` extra. The default behavior is to ignore the *extra* " +"argument of individual log calls and only use the one of the :class:" +"`LoggerAdapter` instance" msgstr "" -#: library/logging.rst:1088 +#: library/logging.rst:1097 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1510,15 +1588,15 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: library/logging.rst:1096 -msgid "Delegates to the underlying :attr:`!manager`` on *logger*." +#: library/logging.rst:1105 +msgid "Delegates to the underlying :attr:`!manager` on *logger*." msgstr "" -#: library/logging.rst:1100 -msgid "Delegates to the underlying :meth:`!_log`` method on *logger*." +#: library/logging.rst:1109 +msgid "Delegates to the underlying :meth:`!_log` method on *logger*." msgstr "" -#: library/logging.rst:1102 +#: library/logging.rst:1111 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " "methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" @@ -1530,33 +1608,41 @@ msgid "" "interchangeably." msgstr "" -#: library/logging.rst:1113 +#: library/logging.rst:1122 msgid "" "The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" "`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" "class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: library/logging.rst:1119 +#: library/logging.rst:1128 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: library/logging.rst:1124 +#: library/logging.rst:1133 +msgid "The *extra* argument is now optional." +msgstr "" + +#: library/logging.rst:1137 +msgid "The *merge_extra* parameter was added." +msgstr "" + +#: library/logging.rst:1141 msgid "Thread Safety" msgstr "" -#: library/logging.rst:1126 +#: library/logging.rst:1143 msgid "" "The logging module is intended to be thread-safe without any special work " -"needing to be done by its clients. It achieves this though using threading " +"needing to be done by its clients. It achieves this through using threading " "locks; there is one lock to serialize access to the module's shared data, " "and each handler also creates a lock to serialize access to its underlying I/" "O." msgstr "" -#: library/logging.rst:1131 +#: library/logging.rst:1148 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1564,33 +1650,34 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: library/logging.rst:1138 +#: library/logging.rst:1155 msgid "Module-Level Functions" msgstr "" -#: library/logging.rst:1140 +#: library/logging.rst:1157 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: library/logging.rst:1146 +#: library/logging.rst:1163 msgid "" -"Return a logger with the specified name or, if name is ``None``, return a " -"logger which is the root logger of the hierarchy. If specified, the name is " -"typically a dot-separated hierarchical name like *'a'*, *'a.b'* or *'a.b.c." -"d'*. Choice of these names is entirely up to the developer who is using " -"logging." +"Return a logger with the specified name or, if name is ``None``, return the " +"root logger of the hierarchy. If specified, the name is typically a dot-" +"separated hierarchical name like *'a'*, *'a.b'* or *'a.b.c.d'*. Choice of " +"these names is entirely up to the developer who is using logging, though it " +"is recommended that ``__name__`` be used unless you have a specific reason " +"for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: library/logging.rst:1151 +#: library/logging.rst:1170 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: library/logging.rst:1158 +#: library/logging.rst:1177 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1599,78 +1686,84 @@ msgid "" "example::" msgstr "" -#: library/logging.rst:1169 +#: library/logging.rst:1182 +msgid "" +"class MyLogger(logging.getLoggerClass()):\n" +" # ... override behaviour here" +msgstr "" + +#: library/logging.rst:1188 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: library/logging.rst:1171 +#: library/logging.rst:1190 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: library/logging.rst:1176 +#: library/logging.rst:1195 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: library/logging.rst:1181 +#: library/logging.rst:1200 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: library/logging.rst:1185 +#: library/logging.rst:1204 msgid "" "The only difference is that if the root logger has no handlers, then :func:" "`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: library/logging.rst:1188 +#: library/logging.rst:1207 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " "most programs will want to carefully and explicitly control the logging " "configuration, and should therefore prefer creating a module-level logger " "and calling :meth:`Logger.debug` (or other level-specific methods) on it, as " -"described at the beginnning of this documentation." +"described at the beginning of this documentation." msgstr "" -#: library/logging.rst:1198 +#: library/logging.rst:1217 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: library/logging.rst:1204 +#: library/logging.rst:1223 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: library/logging.rst:1207 +#: library/logging.rst:1226 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: library/logging.rst:1214 +#: library/logging.rst:1233 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: library/logging.rst:1220 +#: library/logging.rst:1239 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: library/logging.rst:1226 +#: library/logging.rst:1245 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1678,13 +1771,13 @@ msgid "" "exception handler." msgstr "" -#: library/logging.rst:1232 +#: library/logging.rst:1251 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: library/logging.rst:1237 +#: library/logging.rst:1256 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1698,7 +1791,7 @@ msgid "" "individual loggers." msgstr "" -#: library/logging.rst:1248 +#: library/logging.rst:1267 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1706,13 +1799,13 @@ msgid "" "a suitable value." msgstr "" -#: library/logging.rst:1253 +#: library/logging.rst:1272 msgid "" "The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" "`28524` for more information about this change." msgstr "" -#: library/logging.rst:1259 +#: library/logging.rst:1278 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1722,24 +1815,24 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: library/logging.rst:1266 +#: library/logging.rst:1285 msgid "" "If you are thinking of defining your own levels, please see the section on :" "ref:`custom-levels`." msgstr "" -#: library/logging.rst:1271 +#: library/logging.rst:1290 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: library/logging.rst:1279 +#: library/logging.rst:1298 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: library/logging.rst:1281 +#: library/logging.rst:1300 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1749,20 +1842,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: library/logging.rst:1288 +#: library/logging.rst:1307 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: library/logging.rst:1292 +#: library/logging.rst:1311 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: library/logging.rst:1295 +#: library/logging.rst:1314 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1771,7 +1864,7 @@ msgid "" "vice versa." msgstr "" -#: library/logging.rst:1301 +#: library/logging.rst:1320 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1779,17 +1872,17 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: library/logging.rst:1309 +#: library/logging.rst:1328 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: library/logging.rst:1316 +#: library/logging.rst:1335 msgid "Returns an immutable set of all known handler names." msgstr "" -#: library/logging.rst:1322 +#: library/logging.rst:1341 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1797,7 +1890,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: library/logging.rst:1330 +#: library/logging.rst:1349 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1806,13 +1899,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: library/logging.rst:1336 +#: library/logging.rst:1355 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: library/logging.rst:1339 +#: library/logging.rst:1358 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1821,54 +1914,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: library/logging.rst:1346 +#: library/logging.rst:1365 msgid "The following keyword arguments are supported." msgstr "" -#: library/logging.rst:1353 +#: library/logging.rst:1372 msgid "*filename*" msgstr "" -#: library/logging.rst:1353 +#: library/logging.rst:1372 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: library/logging.rst:1357 +#: library/logging.rst:1376 msgid "*filemode*" msgstr "" -#: library/logging.rst:1357 +#: library/logging.rst:1376 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: library/logging.rst:1361 +#: library/logging.rst:1380 msgid "*format*" msgstr "" -#: library/logging.rst:1361 +#: library/logging.rst:1380 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: library/logging.rst:1366 +#: library/logging.rst:1385 msgid "*datefmt*" msgstr "" -#: library/logging.rst:1366 +#: library/logging.rst:1385 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: library/logging.rst:1369 +#: library/logging.rst:1388 msgid "*style*" msgstr "" -#: library/logging.rst:1369 +#: library/logging.rst:1388 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: library/logging.rst:1380 +#: library/logging.rst:1399 msgid "*stream*" msgstr "" -#: library/logging.rst:1380 +#: library/logging.rst:1399 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: library/logging.rst:1386 +#: library/logging.rst:1405 msgid "*handlers*" msgstr "" -#: library/logging.rst:1386 +#: library/logging.rst:1405 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -1908,33 +2001,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: library/logging.rst:1395 +#: library/logging.rst:1414 msgid "*force*" msgstr "" -#: library/logging.rst:1395 +#: library/logging.rst:1414 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: library/logging.rst:1401 +#: library/logging.rst:1420 msgid "*encoding*" msgstr "" -#: library/logging.rst:1401 +#: library/logging.rst:1420 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: library/logging.rst:1406 +#: library/logging.rst:1425 msgid "*errors*" msgstr "" -#: library/logging.rst:1406 +#: library/logging.rst:1425 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -1943,39 +2036,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: library/logging.rst:1417 +#: library/logging.rst:1436 msgid "The *style* argument was added." msgstr "" -#: library/logging.rst:1420 +#: library/logging.rst:1439 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: library/logging.rst:1426 +#: library/logging.rst:1445 msgid "The *force* argument was added." msgstr "" -#: library/logging.rst:1429 +#: library/logging.rst:1448 msgid "The *encoding* and *errors* arguments were added." msgstr "" -#: library/logging.rst:1434 +#: library/logging.rst:1453 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: library/logging.rst:1438 +#: library/logging.rst:1457 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: library/logging.rst:1445 +#: library/logging.rst:1464 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " @@ -1987,32 +2080,32 @@ msgid "" "loggers." msgstr "" -#: library/logging.rst:1456 +#: library/logging.rst:1475 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: library/logging.rst:1458 +#: library/logging.rst:1477 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: library/logging.rst:1460 +#: library/logging.rst:1479 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: library/logging.rst:1465 +#: library/logging.rst:1484 msgid "The factory has the following signature:" msgstr "" -#: library/logging.rst:1467 +#: library/logging.rst:1486 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: library/logging.rst:1469 +#: library/logging.rst:1488 msgid "The logger name." msgstr "" @@ -2020,7 +2113,7 @@ msgstr "" msgid "level" msgstr "" -#: library/logging.rst:1470 +#: library/logging.rst:1489 msgid "The logging level (numeric)." msgstr "" @@ -2028,7 +2121,7 @@ msgstr "" msgid "fn" msgstr "" -#: library/logging.rst:1471 +#: library/logging.rst:1490 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2036,19 +2129,19 @@ msgstr "" msgid "lno" msgstr "" -#: library/logging.rst:1472 +#: library/logging.rst:1491 msgid "The line number in the file where the logging call was made." msgstr "" -#: library/logging.rst:1473 +#: library/logging.rst:1492 msgid "The logging message." msgstr "" -#: library/logging.rst:1474 +#: library/logging.rst:1493 msgid "The arguments for the logging message." msgstr "" -#: library/logging.rst:1475 +#: library/logging.rst:1494 msgid "An exception tuple, or ``None``." msgstr "" @@ -2056,7 +2149,7 @@ msgstr "" msgid "func" msgstr "" -#: library/logging.rst:1476 +#: library/logging.rst:1495 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2064,7 +2157,7 @@ msgstr "" msgid "sinfo" msgstr "" -#: library/logging.rst:1478 +#: library/logging.rst:1497 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2074,15 +2167,15 @@ msgstr "" msgid "kwargs" msgstr "" -#: library/logging.rst:1480 +#: library/logging.rst:1499 msgid "Additional keyword arguments." msgstr "" -#: library/logging.rst:1484 +#: library/logging.rst:1503 msgid "Module-Level Attributes" msgstr "" -#: library/logging.rst:1488 +#: library/logging.rst:1507 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -2093,15 +2186,15 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: library/logging.rst:1500 +#: library/logging.rst:1519 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: library/logging.rst:1502 +#: library/logging.rst:1521 msgid "Default: ``True``." msgstr "" -#: library/logging.rst:1504 +#: library/logging.rst:1523 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2109,22 +2202,22 @@ msgid "" "application errors." msgstr "" -#: library/logging.rst:1511 +#: library/logging.rst:1530 msgid "Integration with the warnings module" msgstr "" -#: library/logging.rst:1513 +#: library/logging.rst:1532 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: library/logging.rst:1518 +#: library/logging.rst:1537 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: library/logging.rst:1521 +#: library/logging.rst:1540 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2133,46 +2226,46 @@ msgid "" "`WARNING`." msgstr "" -#: library/logging.rst:1526 +#: library/logging.rst:1545 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: library/logging.rst:1534 +#: library/logging.rst:1552 msgid "Module :mod:`logging.config`" msgstr "" -#: library/logging.rst:1534 +#: library/logging.rst:1553 msgid "Configuration API for the logging module." msgstr "" -#: library/logging.rst:1537 +#: library/logging.rst:1555 msgid "Module :mod:`logging.handlers`" msgstr "" -#: library/logging.rst:1537 +#: library/logging.rst:1556 msgid "Useful handlers included with the logging module." msgstr "" -#: library/logging.rst:1541 +#: library/logging.rst:1558 msgid ":pep:`282` - A Logging System" msgstr "" -#: library/logging.rst:1540 +#: library/logging.rst:1559 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: library/logging.rst:1546 +#: library/logging.rst:1562 msgid "" "`Original Python logging package `_" msgstr "" -#: library/logging.rst:1544 +#: library/logging.rst:1563 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " diff --git a/library/lzma.po b/library/lzma.po index 558a7801..ad78d7ea 100644 --- a/library/lzma.po +++ b/library/lzma.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/lzma.rst:2 -msgid ":mod:`lzma` --- Compression using the LZMA algorithm" +msgid ":mod:`!lzma` --- Compression using the LZMA algorithm" msgstr "" #: library/lzma.rst:12 @@ -40,23 +41,31 @@ msgid "" "multiple threads, it is necessary to protect it with a lock." msgstr "" -#: library/lzma.rst:29 +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/lzma.rst:31 msgid "" "This exception is raised when an error occurs during compression or " "decompression, or while initializing the compressor/decompressor state." msgstr "" -#: library/lzma.rst:34 +#: library/lzma.rst:36 msgid "Reading and writing compressed files" msgstr "" -#: library/lzma.rst:38 +#: library/lzma.rst:40 msgid "" "Open an LZMA-compressed file in binary or text mode, returning a :term:`file " "object`." msgstr "" -#: library/lzma.rst:41 +#: library/lzma.rst:43 msgid "" "The *filename* argument can be either an actual file name (given as a :class:" "`str`, :class:`bytes` or :term:`path-like ` object), in " @@ -64,7 +73,7 @@ msgid "" "read from or write to." msgstr "" -#: library/lzma.rst:46 +#: library/lzma.rst:48 msgid "" "The *mode* argument can be any of ``\"r\"``, ``\"rb\"``, ``\"w\"``, " "``\"wb\"``, ``\"x\"``, ``\"xb\"``, ``\"a\"`` or ``\"ab\"`` for binary mode, " @@ -72,46 +81,46 @@ msgid "" "default is ``\"rb\"``." msgstr "" -#: library/lzma.rst:95 +#: library/lzma.rst:97 msgid "" "When opening a file for reading, the *format* and *filters* arguments have " "the same meanings as for :class:`LZMADecompressor`. In this case, the " "*check* and *preset* arguments should not be used." msgstr "" -#: library/lzma.rst:99 +#: library/lzma.rst:101 msgid "" "When opening a file for writing, the *format*, *check*, *preset* and " "*filters* arguments have the same meanings as for :class:`LZMACompressor`." msgstr "" -#: library/lzma.rst:57 +#: library/lzma.rst:59 msgid "" "For binary mode, this function is equivalent to the :class:`LZMAFile` " "constructor: ``LZMAFile(filename, mode, ...)``. In this case, the " "*encoding*, *errors* and *newline* arguments must not be provided." msgstr "" -#: library/lzma.rst:61 +#: library/lzma.rst:63 msgid "" "For text mode, a :class:`LZMAFile` object is created, and wrapped in an :" "class:`io.TextIOWrapper` instance with the specified encoding, error " "handling behavior, and line ending(s)." msgstr "" -#: library/lzma.rst:65 +#: library/lzma.rst:67 msgid "Added support for the ``\"x\"``, ``\"xb\"`` and ``\"xt\"`` modes." msgstr "" -#: library/lzma.rst:127 +#: library/lzma.rst:143 msgid "Accepts a :term:`path-like object`." msgstr "" -#: library/lzma.rst:74 +#: library/lzma.rst:76 msgid "Open an LZMA-compressed file in binary mode." msgstr "" -#: library/lzma.rst:76 +#: library/lzma.rst:78 msgid "" "An :class:`LZMAFile` can wrap an already-open :term:`file object`, or " "operate directly on a named file. The *filename* argument specifies either " @@ -121,7 +130,7 @@ msgid "" "the :class:`LZMAFile` is closed." msgstr "" -#: library/lzma.rst:83 +#: library/lzma.rst:85 msgid "" "The *mode* argument can be either ``\"r\"`` for reading (default), ``\"w\"`` " "for overwriting, ``\"x\"`` for exclusive creation, or ``\"a\"`` for " @@ -129,38 +138,38 @@ msgid "" "``\"xb\"`` and ``\"ab\"`` respectively." msgstr "" -#: library/lzma.rst:88 +#: library/lzma.rst:90 msgid "" "If *filename* is a file object (rather than an actual file name), a mode of " "``\"w\"`` does not truncate the file, and is instead equivalent to ``\"a\"``." msgstr "" -#: library/lzma.rst:91 +#: library/lzma.rst:93 msgid "" "When opening a file for reading, the input file may be the concatenation of " "multiple separate compressed streams. These are transparently decoded as a " "single logical stream." msgstr "" -#: library/lzma.rst:102 +#: library/lzma.rst:104 msgid "" ":class:`LZMAFile` supports all the members specified by :class:`io." "BufferedIOBase`, except for :meth:`~io.BufferedIOBase.detach` and :meth:`~io." "IOBase.truncate`. Iteration and the :keyword:`with` statement are supported." msgstr "" -#: library/lzma.rst:107 -msgid "The following method is also provided:" +#: library/lzma.rst:109 +msgid "The following method and attributes are also provided:" msgstr "" -#: library/lzma.rst:111 +#: library/lzma.rst:113 msgid "" "Return buffered data without advancing the file position. At least one byte " "of data will be returned, unless EOF has been reached. The exact number of " "bytes returned is unspecified (the *size* argument is ignored)." msgstr "" -#: library/lzma.rst:115 +#: library/lzma.rst:117 msgid "" "While calling :meth:`peek` does not change the file position of the :class:" "`LZMAFile`, it may change the position of the underlying file object (e.g. " @@ -168,60 +177,70 @@ msgid "" "*filename*)." msgstr "" -#: library/lzma.rst:120 +#: library/lzma.rst:124 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "" + +#: library/lzma.rst:130 +msgid "" +"The lzma file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " +"the underlying :term:`file object`." +msgstr "" + +#: library/lzma.rst:136 msgid "Added support for the ``\"x\"`` and ``\"xb\"`` modes." msgstr "" -#: library/lzma.rst:123 +#: library/lzma.rst:139 msgid "" "The :meth:`~io.BufferedIOBase.read` method now accepts an argument of " "``None``." msgstr "" -#: library/lzma.rst:132 +#: library/lzma.rst:148 msgid "Compressing and decompressing data in memory" msgstr "" -#: library/lzma.rst:136 +#: library/lzma.rst:152 msgid "" "Create a compressor object, which can be used to compress data incrementally." msgstr "" -#: library/lzma.rst:138 +#: library/lzma.rst:154 msgid "" "For a more convenient way of compressing a single chunk of data, see :func:" "`compress`." msgstr "" -#: library/lzma.rst:141 +#: library/lzma.rst:157 msgid "" "The *format* argument specifies what container format should be used. " "Possible values are:" msgstr "" -#: library/lzma.rst:145 +#: library/lzma.rst:160 msgid ":const:`FORMAT_XZ`: The ``.xz`` container format." msgstr "" -#: library/lzma.rst:145 +#: library/lzma.rst:161 msgid "This is the default format." msgstr "" -#: library/lzma.rst:149 +#: library/lzma.rst:163 msgid ":const:`FORMAT_ALONE`: The legacy ``.lzma`` container format." msgstr "" -#: library/lzma.rst:148 +#: library/lzma.rst:164 msgid "" "This format is more limited than ``.xz`` -- it does not support integrity " "checks or multiple filters." msgstr "" -#: library/lzma.rst:155 +#: library/lzma.rst:167 msgid ":const:`FORMAT_RAW`: A raw data stream, not using any container format." msgstr "" -#: library/lzma.rst:152 +#: library/lzma.rst:168 msgid "" "This format specifier does not support integrity checks, and requires that " "you always specify a custom filter chain (for both compression and " @@ -229,46 +248,46 @@ msgid "" "decompressed using :const:`FORMAT_AUTO` (see :class:`LZMADecompressor`)." msgstr "" -#: library/lzma.rst:157 +#: library/lzma.rst:173 msgid "" "The *check* argument specifies the type of integrity check to include in the " "compressed data. This check is used when decompressing, to ensure that the " "data has not been corrupted. Possible values are:" msgstr "" -#: library/lzma.rst:161 +#: library/lzma.rst:177 msgid "" ":const:`CHECK_NONE`: No integrity check. This is the default (and the only " "acceptable value) for :const:`FORMAT_ALONE` and :const:`FORMAT_RAW`." msgstr "" -#: library/lzma.rst:165 +#: library/lzma.rst:181 msgid ":const:`CHECK_CRC32`: 32-bit Cyclic Redundancy Check." msgstr "" -#: library/lzma.rst:167 +#: library/lzma.rst:183 msgid "" ":const:`CHECK_CRC64`: 64-bit Cyclic Redundancy Check. This is the default " "for :const:`FORMAT_XZ`." msgstr "" -#: library/lzma.rst:170 +#: library/lzma.rst:186 msgid ":const:`CHECK_SHA256`: 256-bit Secure Hash Algorithm." msgstr "" -#: library/lzma.rst:172 +#: library/lzma.rst:188 msgid "" "If the specified check is not supported, an :class:`LZMAError` is raised." msgstr "" -#: library/lzma.rst:174 +#: library/lzma.rst:190 msgid "" "The compression settings can be specified either as a preset compression " "level (with the *preset* argument), or in detail as a custom filter chain " "(with the *filters* argument)." msgstr "" -#: library/lzma.rst:178 +#: library/lzma.rst:194 msgid "" "The *preset* argument (if provided) should be an integer between ``0`` and " "``9`` (inclusive), optionally OR-ed with the constant :const:" @@ -277,7 +296,7 @@ msgid "" "presets produce smaller output, but make the compression process slower." msgstr "" -#: library/lzma.rst:187 +#: library/lzma.rst:203 msgid "" "In addition to being more CPU-intensive, compression with higher presets " "also requires much more memory (and produces output that needs more memory " @@ -286,13 +305,13 @@ msgid "" "generally best to stick with the default preset." msgstr "" -#: library/lzma.rst:193 +#: library/lzma.rst:209 msgid "" "The *filters* argument (if provided) should be a filter chain specifier. " "See :ref:`filter-chain-specs` for details." msgstr "" -#: library/lzma.rst:198 +#: library/lzma.rst:214 msgid "" "Compress *data* (a :class:`bytes` object), returning a :class:`bytes` object " "containing compressed data for at least part of the input. Some of *data* " @@ -301,29 +320,29 @@ msgid "" "any previous calls to :meth:`compress`." msgstr "" -#: library/lzma.rst:206 +#: library/lzma.rst:222 msgid "" "Finish the compression process, returning a :class:`bytes` object containing " "any data stored in the compressor's internal buffers." msgstr "" -#: library/lzma.rst:209 +#: library/lzma.rst:225 msgid "The compressor cannot be used after this method has been called." msgstr "" -#: library/lzma.rst:214 +#: library/lzma.rst:230 msgid "" "Create a decompressor object, which can be used to decompress data " "incrementally." msgstr "" -#: library/lzma.rst:217 +#: library/lzma.rst:233 msgid "" "For a more convenient way of decompressing an entire compressed stream at " "once, see :func:`decompress`." msgstr "" -#: library/lzma.rst:220 +#: library/lzma.rst:236 msgid "" "The *format* argument specifies the container format that should be used. " "The default is :const:`FORMAT_AUTO`, which can decompress both ``.xz`` and " @@ -331,7 +350,7 @@ msgid "" "`FORMAT_ALONE`, and :const:`FORMAT_RAW`." msgstr "" -#: library/lzma.rst:225 +#: library/lzma.rst:241 msgid "" "The *memlimit* argument specifies a limit (in bytes) on the amount of memory " "that the decompressor can use. When this argument is used, decompression " @@ -339,7 +358,7 @@ msgid "" "input within the given memory limit." msgstr "" -#: library/lzma.rst:230 +#: library/lzma.rst:246 msgid "" "The *filters* argument specifies the filter chain that was used to create " "the stream being decompressed. This argument is required if *format* is :" @@ -347,7 +366,7 @@ msgid "" "`filter-chain-specs` for more information about filter chains." msgstr "" -#: library/lzma.rst:236 +#: library/lzma.rst:252 msgid "" "This class does not transparently handle inputs containing multiple " "compressed streams, unlike :func:`decompress` and :class:`LZMAFile`. To " @@ -355,7 +374,7 @@ msgid "" "create a new decompressor for each stream." msgstr "" -#: library/lzma.rst:243 +#: library/lzma.rst:259 msgid "" "Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " "as bytes. Some of *data* may be buffered internally, for use in later calls " @@ -363,7 +382,7 @@ msgid "" "output of any previous calls to :meth:`decompress`." msgstr "" -#: library/lzma.rst:249 +#: library/lzma.rst:265 msgid "" "If *max_length* is nonnegative, returns at most *max_length* bytes of " "decompressed data. If this limit is reached and further output can be " @@ -372,100 +391,100 @@ msgid "" "``b''`` to obtain more of the output." msgstr "" -#: library/lzma.rst:256 +#: library/lzma.rst:272 msgid "" "If all of the input data was decompressed and returned (either because this " "was less than *max_length* bytes, or because *max_length* was negative), " "the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -#: library/lzma.rst:261 +#: library/lzma.rst:277 msgid "" "Attempting to decompress data after the end of stream is reached raises an :" "exc:`EOFError`. Any data found after the end of the stream is ignored and " "saved in the :attr:`~.unused_data` attribute." msgstr "" -#: library/lzma.rst:265 +#: library/lzma.rst:281 msgid "Added the *max_length* parameter." msgstr "" -#: library/lzma.rst:270 +#: library/lzma.rst:286 msgid "" "The ID of the integrity check used by the input stream. This may be :const:" "`CHECK_UNKNOWN` until enough of the input has been decoded to determine what " "integrity check it uses." msgstr "" -#: library/lzma.rst:276 +#: library/lzma.rst:292 msgid "``True`` if the end-of-stream marker has been reached." msgstr "" -#: library/lzma.rst:280 +#: library/lzma.rst:296 msgid "Data found after the end of the compressed stream." msgstr "" -#: library/lzma.rst:282 +#: library/lzma.rst:298 msgid "Before the end of the stream is reached, this will be ``b\"\"``." msgstr "" -#: library/lzma.rst:286 +#: library/lzma.rst:302 msgid "" "``False`` if the :meth:`.decompress` method can provide more decompressed " "data before requiring new uncompressed input." msgstr "" -#: library/lzma.rst:293 +#: library/lzma.rst:309 msgid "" "Compress *data* (a :class:`bytes` object), returning the compressed data as " "a :class:`bytes` object." msgstr "" -#: library/lzma.rst:296 +#: library/lzma.rst:312 msgid "" "See :class:`LZMACompressor` above for a description of the *format*, " "*check*, *preset* and *filters* arguments." msgstr "" -#: library/lzma.rst:302 +#: library/lzma.rst:318 msgid "" "Decompress *data* (a :class:`bytes` object), returning the uncompressed data " "as a :class:`bytes` object." msgstr "" -#: library/lzma.rst:305 +#: library/lzma.rst:321 msgid "" "If *data* is the concatenation of multiple distinct compressed streams, " "decompress all of these streams, and return the concatenation of the results." msgstr "" -#: library/lzma.rst:308 +#: library/lzma.rst:324 msgid "" "See :class:`LZMADecompressor` above for a description of the *format*, " "*memlimit* and *filters* arguments." msgstr "" -#: library/lzma.rst:313 +#: library/lzma.rst:329 msgid "Miscellaneous" msgstr "" -#: library/lzma.rst:317 +#: library/lzma.rst:333 msgid "" "Return ``True`` if the given integrity check is supported on this system." msgstr "" -#: library/lzma.rst:319 +#: library/lzma.rst:335 msgid "" ":const:`CHECK_NONE` and :const:`CHECK_CRC32` are always supported. :const:" "`CHECK_CRC64` and :const:`CHECK_SHA256` may be unavailable if you are using " "a version of :program:`liblzma` that was compiled with a limited feature set." msgstr "" -#: library/lzma.rst:328 +#: library/lzma.rst:344 msgid "Specifying custom filter chains" msgstr "" -#: library/lzma.rst:330 +#: library/lzma.rst:346 msgid "" "A filter chain specifier is a sequence of dictionaries, where each " "dictionary contains the ID and options for a single filter. Each dictionary " @@ -473,118 +492,118 @@ msgid "" "filter-dependent options. Valid filter IDs are as follows:" msgstr "" -#: library/lzma.rst:335 +#: library/lzma.rst:351 msgid "Compression filters:" msgstr "" -#: library/lzma.rst:337 +#: library/lzma.rst:353 msgid ":const:`FILTER_LZMA1` (for use with :const:`FORMAT_ALONE`)" msgstr "" -#: library/lzma.rst:338 +#: library/lzma.rst:354 msgid "" ":const:`FILTER_LZMA2` (for use with :const:`FORMAT_XZ` and :const:" "`FORMAT_RAW`)" msgstr "" -#: library/lzma.rst:340 +#: library/lzma.rst:356 msgid "Delta filter:" msgstr "" -#: library/lzma.rst:342 +#: library/lzma.rst:358 msgid ":const:`FILTER_DELTA`" msgstr "" -#: library/lzma.rst:344 +#: library/lzma.rst:360 msgid "Branch-Call-Jump (BCJ) filters:" msgstr "" -#: library/lzma.rst:346 +#: library/lzma.rst:362 msgid ":const:`FILTER_X86`" msgstr "" -#: library/lzma.rst:347 +#: library/lzma.rst:363 msgid ":const:`FILTER_IA64`" msgstr "" -#: library/lzma.rst:348 +#: library/lzma.rst:364 msgid ":const:`FILTER_ARM`" msgstr "" -#: library/lzma.rst:349 +#: library/lzma.rst:365 msgid ":const:`FILTER_ARMTHUMB`" msgstr "" -#: library/lzma.rst:350 +#: library/lzma.rst:366 msgid ":const:`FILTER_POWERPC`" msgstr "" -#: library/lzma.rst:351 +#: library/lzma.rst:367 msgid ":const:`FILTER_SPARC`" msgstr "" -#: library/lzma.rst:353 +#: library/lzma.rst:369 msgid "" "A filter chain can consist of up to 4 filters, and cannot be empty. The last " "filter in the chain must be a compression filter, and any other filters must " "be delta or BCJ filters." msgstr "" -#: library/lzma.rst:357 +#: library/lzma.rst:373 msgid "" "Compression filters support the following options (specified as additional " "entries in the dictionary representing the filter):" msgstr "" -#: library/lzma.rst:360 +#: library/lzma.rst:376 msgid "" "``preset``: A compression preset to use as a source of default values for " "options that are not specified explicitly." msgstr "" -#: library/lzma.rst:362 +#: library/lzma.rst:378 msgid "" "``dict_size``: Dictionary size in bytes. This should be between 4 KiB and " "1.5 GiB (inclusive)." msgstr "" -#: library/lzma.rst:364 +#: library/lzma.rst:380 msgid "``lc``: Number of literal context bits." msgstr "" -#: library/lzma.rst:365 +#: library/lzma.rst:381 msgid "" "``lp``: Number of literal position bits. The sum ``lc + lp`` must be at most " "4." msgstr "" -#: library/lzma.rst:367 +#: library/lzma.rst:383 msgid "``pb``: Number of position bits; must be at most 4." msgstr "" -#: library/lzma.rst:368 +#: library/lzma.rst:384 msgid "``mode``: :const:`MODE_FAST` or :const:`MODE_NORMAL`." msgstr "" -#: library/lzma.rst:369 +#: library/lzma.rst:385 msgid "" "``nice_len``: What should be considered a \"nice length\" for a match. This " "should be 273 or less." msgstr "" -#: library/lzma.rst:371 +#: library/lzma.rst:387 msgid "" "``mf``: What match finder to use -- :const:`MF_HC3`, :const:`MF_HC4`, :const:" "`MF_BT2`, :const:`MF_BT3`, or :const:`MF_BT4`." msgstr "" -#: library/lzma.rst:373 +#: library/lzma.rst:389 msgid "" "``depth``: Maximum search depth used by match finder. 0 (default) means to " "select automatically based on other filter options." msgstr "" -#: library/lzma.rst:376 +#: library/lzma.rst:392 msgid "" "The delta filter stores the differences between bytes, producing more " "repetitive input for the compressor in certain circumstances. It supports " @@ -593,7 +612,7 @@ msgid "" "bytes." msgstr "" -#: library/lzma.rst:381 +#: library/lzma.rst:397 msgid "" "The BCJ filters are intended to be applied to machine code. They convert " "relative branches, calls and jumps in the code to use absolute addressing, " @@ -603,30 +622,85 @@ msgid "" "data. The default is 0." msgstr "" -#: library/lzma.rst:389 +#: library/lzma.rst:405 msgid "Examples" msgstr "" -#: library/lzma.rst:391 +#: library/lzma.rst:407 msgid "Reading in a compressed file::" msgstr "" -#: library/lzma.rst:397 +#: library/lzma.rst:409 +msgid "" +"import lzma\n" +"with lzma.open(\"file.xz\") as f:\n" +" file_content = f.read()" +msgstr "" + +#: library/lzma.rst:413 msgid "Creating a compressed file::" msgstr "" -#: library/lzma.rst:404 +#: library/lzma.rst:415 +msgid "" +"import lzma\n" +"data = b\"Insert Data Here\"\n" +"with lzma.open(\"file.xz\", \"w\") as f:\n" +" f.write(data)" +msgstr "" + +#: library/lzma.rst:420 msgid "Compressing data in memory::" msgstr "" -#: library/lzma.rst:410 +#: library/lzma.rst:422 +msgid "" +"import lzma\n" +"data_in = b\"Insert Data Here\"\n" +"data_out = lzma.compress(data_in)" +msgstr "" + +#: library/lzma.rst:426 msgid "Incremental compression::" msgstr "" -#: library/lzma.rst:421 +#: library/lzma.rst:428 +msgid "" +"import lzma\n" +"lzc = lzma.LZMACompressor()\n" +"out1 = lzc.compress(b\"Some data\\n\")\n" +"out2 = lzc.compress(b\"Another piece of data\\n\")\n" +"out3 = lzc.compress(b\"Even more data\\n\")\n" +"out4 = lzc.flush()\n" +"# Concatenate all the partial results:\n" +"result = b\"\".join([out1, out2, out3, out4])" +msgstr "" + +#: library/lzma.rst:437 msgid "Writing compressed data to an already-open file::" msgstr "" -#: library/lzma.rst:430 +#: library/lzma.rst:439 +msgid "" +"import lzma\n" +"with open(\"file.xz\", \"wb\") as f:\n" +" f.write(b\"This data will not be compressed\\n\")\n" +" with lzma.open(f, \"w\") as lzf:\n" +" lzf.write(b\"This *will* be compressed\\n\")\n" +" f.write(b\"Not compressed\\n\")" +msgstr "" + +#: library/lzma.rst:446 msgid "Creating a compressed file using a custom filter chain::" msgstr "" + +#: library/lzma.rst:448 +msgid "" +"import lzma\n" +"my_filters = [\n" +" {\"id\": lzma.FILTER_DELTA, \"dist\": 5},\n" +" {\"id\": lzma.FILTER_LZMA2, \"preset\": 7 | lzma.PRESET_EXTREME},\n" +"]\n" +"with lzma.open(\"file.xz\", \"w\", filters=my_filters) as f:\n" +" f.write(b\"blah blah blah\")" +msgstr "" diff --git a/library/mailbox.po b/library/mailbox.po index 85f38981..6b0d27c5 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/mailbox.rst:2 -msgid ":mod:`mailbox` --- Manipulate mailboxes in various formats" +msgid ":mod:`!mailbox` --- Manipulate mailboxes in various formats" msgstr "" #: library/mailbox.rst:10 @@ -403,54 +404,172 @@ msgid "" "exclamation point (``'!'``) is a popular choice. For example::" msgstr "" +#: library/mailbox.rst:362 +msgid "" +"import mailbox\n" +"mailbox.Maildir.colon = '!'" +msgstr "" + #: library/mailbox.rst:365 msgid "The :attr:`!colon` attribute may also be set on a per-instance basis." msgstr "" #: library/mailbox.rst:367 +msgid ":class:`Maildir` now ignores files with a leading dot." +msgstr "" + +#: library/mailbox.rst:370 msgid "" ":class:`!Maildir` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: library/mailbox.rst:545 +#: library/mailbox.rst:669 msgid "Return a list of the names of all folders." msgstr "" -#: library/mailbox.rst:378 +#: library/mailbox.rst:381 msgid "" "Return a :class:`!Maildir` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: library/mailbox.rst:385 +#: library/mailbox.rst:388 msgid "" "Create a folder whose name is *folder* and return a :class:`!Maildir` " "instance representing it." msgstr "" -#: library/mailbox.rst:563 +#: library/mailbox.rst:687 msgid "" "Delete the folder whose name is *folder*. If the folder contains any " "messages, a :exc:`NotEmptyError` exception will be raised and the folder " "will not be deleted." msgstr "" -#: library/mailbox.rst:398 +#: library/mailbox.rst:401 msgid "" "Delete temporary files from the mailbox that have not been accessed in the " "last 36 hours. The Maildir specification says that mail-reading programs " "should do this occasionally." msgstr "" -#: library/mailbox.rst:402 +#: library/mailbox.rst:408 +msgid "" +"Return as a string the flags that are set on the message corresponding to " +"*key*. This is the same as ``get_message(key).get_flags()`` but much faster, " +"because it does not open the message file. Use this method when iterating " +"over the keys to determine which messages are interesting to get." +msgstr "" + +#: library/mailbox.rst:415 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.get_flags` method instead, because changes made by the " +"message's :meth:`~MaildirMessage.set_flags`, :meth:`~MaildirMessage." +"add_flag` and :meth:`~MaildirMessage.remove_flag` methods are not reflected " +"here until the mailbox's :meth:`__setitem__` method is called." +msgstr "" + +#: library/mailbox.rst:427 +msgid "" +"On the message corresponding to *key*, set the flags specified by *flags* " +"and unset all others. Calling ``some_mailbox.set_flags(key, flags)`` is " +"similar to ::" +msgstr "" + +#: library/mailbox.rst:431 +msgid "" +"one_message = some_mailbox.get_message(key)\n" +"one_message.set_flags(flags)\n" +"some_mailbox[key] = one_message" +msgstr "" + +#: library/mailbox.rst:498 +msgid "but faster, because it does not open the message file." +msgstr "" + +#: library/mailbox.rst:437 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.set_flags` method instead, because changes made with this " +"mailbox method will not be visible to the message object's method, :meth:" +"`~MaildirMessage.get_flags`." +msgstr "" + +#: library/mailbox.rst:447 +msgid "" +"On the message corresponding to *key*, set the flags specified by *flag* " +"without changing other flags. To add more than one flag at a time, *flag* " +"may be a string of more than one character." +msgstr "" + +#: library/mailbox.rst:451 +msgid "" +"Considerations for using this method versus the message object's :meth:" +"`~MaildirMessage.add_flag` method are similar to those for :meth:" +"`set_flags`; see the discussion there." +msgstr "" + +#: library/mailbox.rst:460 +msgid "" +"On the message corresponding to *key*, unset the flags specified by *flag* " +"without changing other flags. To remove more than one flag at a time, *flag* " +"may be a string of more than one character." +msgstr "" + +#: library/mailbox.rst:464 +msgid "" +"Considerations for using this method versus the message object's :meth:" +"`~MaildirMessage.remove_flag` method are similar to those for :meth:" +"`set_flags`; see the discussion there." +msgstr "" + +#: library/mailbox.rst:473 +msgid "" +"Return a string containing the info for the message corresponding to *key*. " +"This is the same as ``get_message(key).get_info()`` but much faster, because " +"it does not open the message file. Use this method when iterating over the " +"keys to determine which messages are interesting to get." +msgstr "" + +#: library/mailbox.rst:480 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.get_info` method instead, because changes made by the " +"message's :meth:`~MaildirMessage.set_info` method are not reflected here " +"until the mailbox's :meth:`__setitem__` method is called." +msgstr "" + +#: library/mailbox.rst:491 +msgid "" +"Set the info of the message corresponding to *key* to *info*. Calling " +"``some_mailbox.set_info(key, flags)`` is similar to ::" +msgstr "" + +#: library/mailbox.rst:494 +msgid "" +"one_message = some_mailbox.get_message(key)\n" +"one_message.set_info(info)\n" +"some_mailbox[key] = one_message" +msgstr "" + +#: library/mailbox.rst:500 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.set_info` method instead, because changes made with this " +"mailbox method will not be visible to the message object's method, :meth:" +"`~MaildirMessage.get_info`." +msgstr "" + +#: library/mailbox.rst:507 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Maildir` deserve " "special remarks:" msgstr "" -#: library/mailbox.rst:412 +#: library/mailbox.rst:517 msgid "" "These methods generate unique file names based upon the current process ID. " "When using multiple threads, undetected name clashes may occur and cause " @@ -458,56 +577,56 @@ msgid "" "these methods to manipulate the same mailbox simultaneously." msgstr "" -#: library/mailbox.rst:420 +#: library/mailbox.rst:525 msgid "" "All changes to Maildir mailboxes are immediately applied, so this method " "does nothing." msgstr "" -#: library/mailbox.rst:427 +#: library/mailbox.rst:532 msgid "" "Maildir mailboxes do not support (or require) locking, so these methods do " "nothing." msgstr "" -#: library/mailbox.rst:433 +#: library/mailbox.rst:538 msgid "" ":class:`!Maildir` instances do not keep any open files and the underlying " "mailboxes do not support locking, so this method does nothing." msgstr "" -#: library/mailbox.rst:439 +#: library/mailbox.rst:544 msgid "" "Depending upon the host platform, it may not be possible to modify or remove " "the underlying message while the returned file remains open." msgstr "" -#: library/mailbox.rst:447 +#: library/mailbox.rst:550 msgid "" "`maildir man page from Courier `_" msgstr "" -#: library/mailbox.rst:446 +#: library/mailbox.rst:551 msgid "" "A specification of the format. Describes a common extension for supporting " "folders." msgstr "" -#: library/mailbox.rst:450 +#: library/mailbox.rst:554 msgid "`Using maildir format `_" msgstr "" -#: library/mailbox.rst:450 +#: library/mailbox.rst:555 msgid "" "Notes on Maildir by its inventor. Includes an updated name-creation scheme " "and details on \"info\" semantics." msgstr "" -#: library/mailbox.rst:457 +#: library/mailbox.rst:562 msgid ":class:`!mbox` objects" msgstr "" -#: library/mailbox.rst:462 +#: library/mailbox.rst:567 msgid "" "A subclass of :class:`Mailbox` for mailboxes in mbox format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -517,7 +636,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: library/mailbox.rst:469 +#: library/mailbox.rst:574 msgid "" "The mbox format is the classic format for storing mail on Unix systems. All " "messages in an mbox mailbox are stored in a single file with the beginning " @@ -525,7 +644,7 @@ msgid "" "\"." msgstr "" -#: library/mailbox.rst:473 +#: library/mailbox.rst:578 msgid "" "Several variations of the mbox format exist to address perceived " "shortcomings in the original. In the interest of compatibility, :class:`!" @@ -537,60 +656,67 @@ msgid "" "when reading the message." msgstr "" -#: library/mailbox.rst:481 +#: library/mailbox.rst:586 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!mbox` deserve special " "remarks:" msgstr "" -#: library/mailbox.rst:487 +#: library/mailbox.rst:602 library/mailbox.rst:871 library/mailbox.rst:881 +msgid "" +"Note: This method has an extra parameter (*from_*) compared with other " +"classes. The first line of an mbox file entry is the Unix \"From \" line. If " +"*from_* is False, the first line of the file is dropped." +msgstr "" + +#: library/mailbox.rst:598 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!mbox` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: library/mailbox.rst:704 library/mailbox.rst:755 +#: library/mailbox.rst:828 library/mailbox.rst:889 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls." msgstr "" -#: library/mailbox.rst:502 +#: library/mailbox.rst:621 msgid "" "`mbox man page from tin `_" msgstr "" -#: library/mailbox.rst:502 +#: library/mailbox.rst:622 msgid "A specification of the format, with details on locking." msgstr "" -#: library/mailbox.rst:505 +#: library/mailbox.rst:624 msgid "" "`Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad " "`_" msgstr "" -#: library/mailbox.rst:505 +#: library/mailbox.rst:625 msgid "An argument for using the original mbox format rather than a variation." msgstr "" -#: library/mailbox.rst:507 +#: library/mailbox.rst:627 msgid "" "`\"mbox\" is a family of several mutually incompatible mailbox formats " "`_" msgstr "" -#: library/mailbox.rst:508 +#: library/mailbox.rst:628 msgid "A history of mbox variations." msgstr "" -#: library/mailbox.rst:514 +#: library/mailbox.rst:634 msgid ":class:`!MH` objects" msgstr "" -#: library/mailbox.rst:519 +#: library/mailbox.rst:639 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -600,7 +726,7 @@ msgid "" "is created if it does not exist." msgstr "" -#: library/mailbox.rst:526 +#: library/mailbox.rst:646 msgid "" "MH is a directory-based mailbox format invented for the MH Message Handling " "System, a mail user agent. Each message in an MH mailbox resides in its own " @@ -611,7 +737,7 @@ msgid "" "called :file:`.mh_sequences` in each folder." msgstr "" -#: library/mailbox.rst:534 +#: library/mailbox.rst:654 msgid "" "The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to " "emulate all of :program:`mh`'s behaviors. In particular, it does not modify " @@ -619,63 +745,67 @@ msgid "" "are used by :program:`mh` to store its state and configuration." msgstr "" -#: library/mailbox.rst:539 +#: library/mailbox.rst:659 msgid "" ":class:`!MH` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: library/mailbox.rst:550 +#: library/mailbox.rst:664 +msgid "Supported folders that don't contain a :file:`.mh_sequences` file." +msgstr "" + +#: library/mailbox.rst:674 msgid "" "Return an :class:`!MH` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: library/mailbox.rst:557 +#: library/mailbox.rst:681 msgid "" "Create a folder whose name is *folder* and return an :class:`!MH` instance " "representing it." msgstr "" -#: library/mailbox.rst:570 +#: library/mailbox.rst:694 msgid "" "Return a dictionary of sequence names mapped to key lists. If there are no " "sequences, the empty dictionary is returned." msgstr "" -#: library/mailbox.rst:576 +#: library/mailbox.rst:700 msgid "" "Re-define the sequences that exist in the mailbox based upon *sequences*, a " "dictionary of names mapped to key lists, like returned by :meth:" "`get_sequences`." msgstr "" -#: library/mailbox.rst:583 +#: library/mailbox.rst:707 msgid "" "Rename messages in the mailbox as necessary to eliminate gaps in numbering. " "Entries in the sequences list are updated correspondingly." msgstr "" -#: library/mailbox.rst:588 +#: library/mailbox.rst:712 msgid "" "Already-issued keys are invalidated by this operation and should not be " "subsequently used." msgstr "" -#: library/mailbox.rst:591 +#: library/mailbox.rst:715 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MH` deserve special " "remarks:" msgstr "" -#: library/mailbox.rst:599 +#: library/mailbox.rst:723 msgid "" "These methods immediately delete the message. The MH convention of marking a " "message for deletion by prepending a comma to its name is not used." msgstr "" -#: library/mailbox.rst:606 +#: library/mailbox.rst:730 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls. For MH mailboxes, locking " @@ -684,51 +814,51 @@ msgid "" "files." msgstr "" -#: library/mailbox.rst:615 +#: library/mailbox.rst:739 msgid "" "Depending upon the host platform, it may not be possible to remove the " "underlying message while the returned file remains open." msgstr "" -#: library/mailbox.rst:621 +#: library/mailbox.rst:745 msgid "" "All changes to MH mailboxes are immediately applied, so this method does " "nothing." msgstr "" -#: library/mailbox.rst:627 +#: library/mailbox.rst:751 msgid "" ":class:`!MH` instances do not keep any open files, so this method is " "equivalent to :meth:`unlock`." msgstr "" -#: library/mailbox.rst:634 +#: library/mailbox.rst:757 msgid "`nmh - Message Handling System `_" msgstr "" -#: library/mailbox.rst:634 +#: library/mailbox.rst:758 msgid "" "Home page of :program:`nmh`, an updated version of the original :program:" "`mh`." msgstr "" -#: library/mailbox.rst:637 +#: library/mailbox.rst:760 msgid "" "`MH & nmh: Email for Users & Programmers `_" msgstr "" -#: library/mailbox.rst:637 +#: library/mailbox.rst:761 msgid "" "A GPL-licensed book on :program:`mh` and :program:`nmh`, with some " "information on the mailbox format." msgstr "" -#: library/mailbox.rst:644 +#: library/mailbox.rst:768 msgid ":class:`!Babyl` objects" msgstr "" -#: library/mailbox.rst:649 +#: library/mailbox.rst:773 msgid "" "A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -738,7 +868,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: library/mailbox.rst:656 +#: library/mailbox.rst:780 msgid "" "Babyl is a single-file mailbox format used by the Rmail mail user agent " "included with Emacs. The beginning of a message is indicated by a line " @@ -748,7 +878,7 @@ msgid "" "Underscore (``'\\037'``) character." msgstr "" -#: library/mailbox.rst:663 +#: library/mailbox.rst:787 msgid "" "Messages in a Babyl mailbox have two sets of headers, original headers and " "so-called visible headers. Visible headers are typically a subset of the " @@ -759,31 +889,31 @@ msgid "" "in the Babyl options section." msgstr "" -#: library/mailbox.rst:671 +#: library/mailbox.rst:795 msgid "" ":class:`!Babyl` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: library/mailbox.rst:677 +#: library/mailbox.rst:801 msgid "" "Return a list of the names of all user-defined labels used in the mailbox." msgstr "" -#: library/mailbox.rst:681 +#: library/mailbox.rst:805 msgid "" "The actual messages are inspected to determine which labels exist in the " "mailbox rather than consulting the list of labels in the Babyl options " "section, but the Babyl section is updated whenever the mailbox is modified." msgstr "" -#: library/mailbox.rst:686 +#: library/mailbox.rst:810 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Babyl` deserve special " "remarks:" msgstr "" -#: library/mailbox.rst:692 +#: library/mailbox.rst:816 msgid "" "In Babyl mailboxes, the headers of a message are not stored contiguously " "with the body of the message. To generate a file-like representation, the " @@ -793,30 +923,30 @@ msgid "" "memory compared to a string representation." msgstr "" -#: library/mailbox.rst:711 +#: library/mailbox.rst:834 msgid "" "`Format of Version 5 Babyl Files `_" msgstr "" -#: library/mailbox.rst:711 +#: library/mailbox.rst:835 msgid "A specification of the Babyl format." msgstr "" -#: library/mailbox.rst:713 +#: library/mailbox.rst:837 msgid "" "`Reading Mail with Rmail `_" msgstr "" -#: library/mailbox.rst:714 +#: library/mailbox.rst:838 msgid "The Rmail manual, with some information on Babyl semantics." msgstr "" -#: library/mailbox.rst:720 +#: library/mailbox.rst:844 msgid ":class:`!MMDF` objects" msgstr "" -#: library/mailbox.rst:725 +#: library/mailbox.rst:849 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -826,7 +956,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: library/mailbox.rst:732 +#: library/mailbox.rst:856 msgid "" "MMDF is a single-file mailbox format invented for the Multichannel " "Memorandum Distribution Facility, a mail transfer agent. Each message is in " @@ -839,64 +969,64 @@ msgid "" "subsequent messages." msgstr "" -#: library/mailbox.rst:741 +#: library/mailbox.rst:865 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MMDF` deserve special " "remarks:" msgstr "" -#: library/mailbox.rst:747 +#: library/mailbox.rst:877 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!MMDF` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: library/mailbox.rst:762 +#: library/mailbox.rst:895 msgid "" "`mmdf man page from tin `_" msgstr "" -#: library/mailbox.rst:762 +#: library/mailbox.rst:896 msgid "" "A specification of MMDF format from the documentation of tin, a newsreader." msgstr "" -#: library/mailbox.rst:765 +#: library/mailbox.rst:898 msgid "`MMDF `_" msgstr "" -#: library/mailbox.rst:765 +#: library/mailbox.rst:899 msgid "" "A Wikipedia article describing the Multichannel Memorandum Distribution " "Facility." msgstr "" -#: library/mailbox.rst:772 +#: library/mailbox.rst:906 msgid ":class:`!Message` objects" msgstr "" -#: library/mailbox.rst:777 +#: library/mailbox.rst:911 msgid "" "A subclass of the :mod:`email.message` module's :class:`~email.message." "Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-" "specific state and behavior." msgstr "" -#: library/mailbox.rst:781 +#: library/mailbox.rst:915 msgid "" "If *message* is omitted, the new instance is created in a default, empty " "state. If *message* is an :class:`email.message.Message` instance, its " "contents are copied; furthermore, any format-specific information is " "converted insofar as possible if *message* is a :class:`!Message` instance. " "If *message* is a string, a byte string, or a file, it should contain an :" -"rfc:`2822`\\ -compliant message, which is read and parsed. Files should be " +"rfc:`5322`\\ -compliant message, which is read and parsed. Files should be " "open in binary mode, but text mode files are accepted for backward " "compatibility." msgstr "" -#: library/mailbox.rst:790 +#: library/mailbox.rst:924 msgid "" "The format-specific state and behaviors offered by subclasses vary, but in " "general it is only the properties that are not specific to a particular " @@ -908,7 +1038,7 @@ msgid "" "important is retained, because it applies to the message itself." msgstr "" -#: library/mailbox.rst:799 +#: library/mailbox.rst:933 msgid "" "There is no requirement that :class:`!Message` instances be used to " "represent messages retrieved using :class:`Mailbox` instances. In some " @@ -919,17 +1049,17 @@ msgid "" "initialized." msgstr "" -#: library/mailbox.rst:810 +#: library/mailbox.rst:944 msgid ":class:`!MaildirMessage` objects" msgstr "" -#: library/mailbox.rst:815 +#: library/mailbox.rst:949 msgid "" "A message with Maildir-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: library/mailbox.rst:818 +#: library/mailbox.rst:952 msgid "" "Typically, a mail user agent application moves all of the messages in the :" "file:`new` subdirectory to the :file:`cur` subdirectory after the first time " @@ -943,115 +1073,115 @@ msgid "" "flags for Maildir messages are as follows:" msgstr "" -#: library/mailbox.rst:997 library/mailbox.rst:1368 +#: library/mailbox.rst:1131 library/mailbox.rst:1502 msgid "Flag" msgstr "" -#: library/mailbox.rst:997 library/mailbox.rst:1368 +#: library/mailbox.rst:1131 library/mailbox.rst:1502 msgid "Meaning" msgstr "" -#: library/mailbox.rst:997 library/mailbox.rst:1235 library/mailbox.rst:1368 +#: library/mailbox.rst:1131 library/mailbox.rst:1369 library/mailbox.rst:1502 msgid "Explanation" msgstr "" -#: library/mailbox.rst:1003 library/mailbox.rst:1374 +#: library/mailbox.rst:1137 library/mailbox.rst:1508 msgid "D" msgstr "" -#: library/mailbox.rst:832 +#: library/mailbox.rst:966 msgid "Draft" msgstr "" -#: library/mailbox.rst:832 +#: library/mailbox.rst:966 msgid "Under composition" msgstr "" -#: library/mailbox.rst:1005 library/mailbox.rst:1376 +#: library/mailbox.rst:1139 library/mailbox.rst:1510 msgid "F" msgstr "" -#: library/mailbox.rst:1005 library/mailbox.rst:1376 +#: library/mailbox.rst:1139 library/mailbox.rst:1510 msgid "Flagged" msgstr "" -#: library/mailbox.rst:1005 library/mailbox.rst:1376 +#: library/mailbox.rst:1139 library/mailbox.rst:1510 msgid "Marked as important" msgstr "" -#: library/mailbox.rst:836 +#: library/mailbox.rst:970 msgid "P" msgstr "" -#: library/mailbox.rst:836 +#: library/mailbox.rst:970 msgid "Passed" msgstr "" -#: library/mailbox.rst:836 +#: library/mailbox.rst:970 msgid "Forwarded, resent, or bounced" msgstr "" -#: library/mailbox.rst:999 library/mailbox.rst:1370 +#: library/mailbox.rst:1133 library/mailbox.rst:1504 msgid "R" msgstr "" -#: library/mailbox.rst:838 +#: library/mailbox.rst:972 msgid "Replied" msgstr "" -#: library/mailbox.rst:1007 library/mailbox.rst:1243 library/mailbox.rst:1378 +#: library/mailbox.rst:1141 library/mailbox.rst:1377 library/mailbox.rst:1512 msgid "Replied to" msgstr "" -#: library/mailbox.rst:840 +#: library/mailbox.rst:974 msgid "S" msgstr "" -#: library/mailbox.rst:840 +#: library/mailbox.rst:974 msgid "Seen" msgstr "" -#: library/mailbox.rst:999 library/mailbox.rst:1370 +#: library/mailbox.rst:1133 library/mailbox.rst:1504 msgid "Read" msgstr "" -#: library/mailbox.rst:842 +#: library/mailbox.rst:976 msgid "T" msgstr "" -#: library/mailbox.rst:842 +#: library/mailbox.rst:976 msgid "Trashed" msgstr "" -#: library/mailbox.rst:1003 library/mailbox.rst:1374 +#: library/mailbox.rst:1137 library/mailbox.rst:1508 msgid "Marked for subsequent deletion" msgstr "" -#: library/mailbox.rst:845 +#: library/mailbox.rst:979 msgid ":class:`!MaildirMessage` instances offer the following methods:" msgstr "" -#: library/mailbox.rst:850 +#: library/mailbox.rst:984 msgid "" "Return either \"new\" (if the message should be stored in the :file:`new` " "subdirectory) or \"cur\" (if the message should be stored in the :file:`cur` " "subdirectory)." msgstr "" -#: library/mailbox.rst:856 +#: library/mailbox.rst:990 msgid "" "A message is typically moved from :file:`new` to :file:`cur` after its " -"mailbox has been accessed, whether or not the message is has been read. A " +"mailbox has been accessed, whether or not the message has been read. A " "message ``msg`` has been read if ``\"S\" in msg.get_flags()`` is ``True``." msgstr "" -#: library/mailbox.rst:864 +#: library/mailbox.rst:998 msgid "" "Set the subdirectory the message should be stored in. Parameter *subdir* " "must be either \"new\" or \"cur\"." msgstr "" -#: library/mailbox.rst:870 +#: library/mailbox.rst:1004 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the standard Maildir format, the result is the concatenation " @@ -1060,11 +1190,11 @@ msgid "" "flags are set or if \"info\" contains experimental semantics." msgstr "" -#: library/mailbox.rst:880 +#: library/mailbox.rst:1014 msgid "Set the flags specified by *flags* and unset all others." msgstr "" -#: library/mailbox.rst:885 +#: library/mailbox.rst:1019 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " @@ -1072,7 +1202,7 @@ msgid "" "experimental information rather than flags." msgstr "" -#: library/mailbox.rst:893 +#: library/mailbox.rst:1027 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " @@ -1080,30 +1210,30 @@ msgid "" "the current \"info\" is not modified." msgstr "" -#: library/mailbox.rst:901 +#: library/mailbox.rst:1035 msgid "" "Return the delivery date of the message as a floating-point number " "representing seconds since the epoch." msgstr "" -#: library/mailbox.rst:907 +#: library/mailbox.rst:1041 msgid "" "Set the delivery date of the message to *date*, a floating-point number " "representing seconds since the epoch." msgstr "" -#: library/mailbox.rst:913 +#: library/mailbox.rst:1047 msgid "" "Return a string containing the \"info\" for a message. This is useful for " "accessing and modifying \"info\" that is experimental (i.e., not a list of " "flags)." msgstr "" -#: library/mailbox.rst:920 +#: library/mailbox.rst:1054 msgid "Set \"info\" to *info*, which should be a string." msgstr "" -#: library/mailbox.rst:922 +#: library/mailbox.rst:1056 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1111,132 +1241,132 @@ msgid "" "take place:" msgstr "" -#: library/mailbox.rst:946 library/mailbox.rst:1068 library/mailbox.rst:1100 -#: library/mailbox.rst:1183 library/mailbox.rst:1212 library/mailbox.rst:1326 -#: library/mailbox.rst:1440 library/mailbox.rst:1472 library/mailbox.rst:1488 +#: library/mailbox.rst:1080 library/mailbox.rst:1202 library/mailbox.rst:1234 +#: library/mailbox.rst:1317 library/mailbox.rst:1346 library/mailbox.rst:1460 +#: library/mailbox.rst:1574 library/mailbox.rst:1606 library/mailbox.rst:1622 msgid "Resulting state" msgstr "" -#: library/mailbox.rst:1198 library/mailbox.rst:1326 +#: library/mailbox.rst:1332 library/mailbox.rst:1460 msgid ":class:`mboxMessage` or :class:`MMDFMessage` state" msgstr "" -#: library/mailbox.rst:948 library/mailbox.rst:1072 library/mailbox.rst:1444 +#: library/mailbox.rst:1082 library/mailbox.rst:1206 library/mailbox.rst:1578 msgid "\"cur\" subdirectory" msgstr "" -#: library/mailbox.rst:1072 library/mailbox.rst:1104 library/mailbox.rst:1444 -#: library/mailbox.rst:1476 library/mailbox.rst:1492 +#: library/mailbox.rst:1206 library/mailbox.rst:1238 library/mailbox.rst:1578 +#: library/mailbox.rst:1610 library/mailbox.rst:1626 msgid "O flag" msgstr "" -#: library/mailbox.rst:952 library/mailbox.rst:1091 library/mailbox.rst:1189 -#: library/mailbox.rst:1448 library/mailbox.rst:1496 +#: library/mailbox.rst:1086 library/mailbox.rst:1225 library/mailbox.rst:1323 +#: library/mailbox.rst:1582 library/mailbox.rst:1630 msgid "F flag" msgstr "" -#: library/mailbox.rst:937 library/mailbox.rst:969 library/mailbox.rst:1078 -#: library/mailbox.rst:1187 library/mailbox.rst:1442 library/mailbox.rst:1490 +#: library/mailbox.rst:1071 library/mailbox.rst:1103 library/mailbox.rst:1212 +#: library/mailbox.rst:1321 library/mailbox.rst:1576 library/mailbox.rst:1624 msgid "R flag" msgstr "" -#: library/mailbox.rst:1078 library/mailbox.rst:1108 library/mailbox.rst:1203 -#: library/mailbox.rst:1450 library/mailbox.rst:1480 library/mailbox.rst:1498 +#: library/mailbox.rst:1212 library/mailbox.rst:1242 library/mailbox.rst:1337 +#: library/mailbox.rst:1584 library/mailbox.rst:1614 library/mailbox.rst:1632 msgid "A flag" msgstr "" -#: library/mailbox.rst:1070 library/mailbox.rst:1442 +#: library/mailbox.rst:1204 library/mailbox.rst:1576 msgid "S flag" msgstr "" -#: library/mailbox.rst:971 library/mailbox.rst:1313 library/mailbox.rst:1446 +#: library/mailbox.rst:1105 library/mailbox.rst:1447 library/mailbox.rst:1580 msgid "T flag" msgstr "" -#: library/mailbox.rst:1074 library/mailbox.rst:1122 library/mailbox.rst:1446 -#: library/mailbox.rst:1494 +#: library/mailbox.rst:1208 library/mailbox.rst:1256 library/mailbox.rst:1580 +#: library/mailbox.rst:1628 msgid "D flag" msgstr "" -#: library/mailbox.rst:942 +#: library/mailbox.rst:1076 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1085 library/mailbox.rst:1457 +#: library/mailbox.rst:1219 library/mailbox.rst:1591 msgid ":class:`MHMessage` state" msgstr "" -#: library/mailbox.rst:1089 library/mailbox.rst:1201 library/mailbox.rst:1342 -#: library/mailbox.rst:1461 +#: library/mailbox.rst:1223 library/mailbox.rst:1335 library/mailbox.rst:1476 +#: library/mailbox.rst:1595 msgid "\"unseen\" sequence" msgstr "" -#: library/mailbox.rst:965 +#: library/mailbox.rst:1099 msgid "\"cur\" subdirectory and S flag" msgstr "" -#: library/mailbox.rst:1087 library/mailbox.rst:1459 +#: library/mailbox.rst:1221 library/mailbox.rst:1593 msgid "no \"unseen\" sequence" msgstr "" -#: library/mailbox.rst:1091 library/mailbox.rst:1205 library/mailbox.rst:1463 +#: library/mailbox.rst:1225 library/mailbox.rst:1339 library/mailbox.rst:1597 msgid "\"flagged\" sequence" msgstr "" -#: library/mailbox.rst:1093 library/mailbox.rst:1203 library/mailbox.rst:1344 -#: library/mailbox.rst:1465 +#: library/mailbox.rst:1227 library/mailbox.rst:1337 library/mailbox.rst:1478 +#: library/mailbox.rst:1599 msgid "\"replied\" sequence" msgstr "" -#: library/mailbox.rst:957 +#: library/mailbox.rst:1091 msgid "" "When a :class:`!MaildirMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1100 library/mailbox.rst:1472 +#: library/mailbox.rst:1234 library/mailbox.rst:1606 msgid ":class:`BabylMessage` state" msgstr "" -#: library/mailbox.rst:1104 library/mailbox.rst:1311 library/mailbox.rst:1342 -#: library/mailbox.rst:1476 +#: library/mailbox.rst:1238 library/mailbox.rst:1445 library/mailbox.rst:1476 +#: library/mailbox.rst:1610 msgid "\"unseen\" label" msgstr "" -#: library/mailbox.rst:1102 library/mailbox.rst:1474 +#: library/mailbox.rst:1236 library/mailbox.rst:1608 msgid "no \"unseen\" label" msgstr "" -#: library/mailbox.rst:1317 +#: library/mailbox.rst:1451 msgid "P flag" msgstr "" -#: library/mailbox.rst:967 +#: library/mailbox.rst:1101 msgid "\"forwarded\" or \"resent\" label" msgstr "" -#: library/mailbox.rst:1108 library/mailbox.rst:1315 library/mailbox.rst:1344 -#: library/mailbox.rst:1480 +#: library/mailbox.rst:1242 library/mailbox.rst:1449 library/mailbox.rst:1478 +#: library/mailbox.rst:1614 msgid "\"answered\" label" msgstr "" -#: library/mailbox.rst:1106 library/mailbox.rst:1331 library/mailbox.rst:1478 +#: library/mailbox.rst:1240 library/mailbox.rst:1465 library/mailbox.rst:1612 msgid "\"deleted\" label" msgstr "" -#: library/mailbox.rst:978 +#: library/mailbox.rst:1112 msgid ":class:`!mboxMessage` objects" msgstr "" -#: library/mailbox.rst:983 +#: library/mailbox.rst:1117 msgid "" "A message with mbox-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: library/mailbox.rst:986 +#: library/mailbox.rst:1120 msgid "" "Messages in an mbox mailbox are stored together in a single file. The " "sender's envelope address and the time of delivery are typically stored in a " @@ -1247,53 +1377,53 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: library/mailbox.rst:994 +#: library/mailbox.rst:1128 msgid "Conventional flags for mbox messages are as follows:" msgstr "" -#: library/mailbox.rst:1372 +#: library/mailbox.rst:1506 msgid "O" msgstr "" -#: library/mailbox.rst:1372 +#: library/mailbox.rst:1506 msgid "Old" msgstr "" -#: library/mailbox.rst:1372 +#: library/mailbox.rst:1506 msgid "Previously detected by MUA" msgstr "" -#: library/mailbox.rst:1374 +#: library/mailbox.rst:1508 msgid "Deleted" msgstr "" -#: library/mailbox.rst:1378 +#: library/mailbox.rst:1512 msgid "A" msgstr "" -#: library/mailbox.rst:1378 +#: library/mailbox.rst:1512 msgid "Answered" msgstr "" -#: library/mailbox.rst:1381 +#: library/mailbox.rst:1515 msgid "" "The \"R\" and \"O\" flags are stored in the :mailheader:`Status` header, and " "the \"D\", \"F\", and \"A\" flags are stored in the :mailheader:`X-Status` " "header. The flags and headers typically appear in the order mentioned." msgstr "" -#: library/mailbox.rst:1014 +#: library/mailbox.rst:1148 msgid ":class:`!mboxMessage` instances offer the following methods:" msgstr "" -#: library/mailbox.rst:1391 +#: library/mailbox.rst:1525 msgid "" "Return a string representing the \"From \" line that marks the start of the " "message in an mbox mailbox. The leading \"From \" and the trailing newline " "are excluded." msgstr "" -#: library/mailbox.rst:1398 +#: library/mailbox.rst:1532 msgid "" "Set the \"From \" line to *from_*, which should be specified without a " "leading \"From \" or trailing newline. For convenience, *time_* may be " @@ -1303,7 +1433,7 @@ msgid "" "func:`time.gmtime`)." msgstr "" -#: library/mailbox.rst:1408 +#: library/mailbox.rst:1542 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the conventional format, the result is the concatenation in " @@ -1311,28 +1441,28 @@ msgid "" "``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: library/mailbox.rst:1416 +#: library/mailbox.rst:1550 msgid "" "Set the flags specified by *flags* and unset all others. Parameter *flags* " "should be the concatenation in any order of zero or more occurrences of each " "of ``'R'``, ``'O'``, ``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: library/mailbox.rst:1423 +#: library/mailbox.rst:1557 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " "character." msgstr "" -#: library/mailbox.rst:1430 +#: library/mailbox.rst:1564 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " "character." msgstr "" -#: library/mailbox.rst:1062 +#: library/mailbox.rst:1196 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1340,48 +1470,48 @@ msgid "" "conversions take place:" msgstr "" -#: library/mailbox.rst:1183 library/mailbox.rst:1440 +#: library/mailbox.rst:1317 library/mailbox.rst:1574 msgid ":class:`MaildirMessage` state" msgstr "" -#: library/mailbox.rst:1081 +#: library/mailbox.rst:1215 msgid "" "When an :class:`!mboxMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1102 library/mailbox.rst:1474 +#: library/mailbox.rst:1236 library/mailbox.rst:1608 msgid "R flag and O flag" msgstr "" -#: library/mailbox.rst:1096 +#: library/mailbox.rst:1230 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1111 +#: library/mailbox.rst:1245 msgid "" "When a :class:`!mboxMessage` instance is created based upon an :class:" "`MMDFMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: library/mailbox.rst:1116 +#: library/mailbox.rst:1250 msgid ":class:`MMDFMessage` state" msgstr "" -#: library/mailbox.rst:1133 +#: library/mailbox.rst:1267 msgid ":class:`!MHMessage` objects" msgstr "" -#: library/mailbox.rst:1138 +#: library/mailbox.rst:1272 msgid "" "A message with MH-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: library/mailbox.rst:1141 +#: library/mailbox.rst:1275 msgid "" "MH messages do not support marks or flags in the traditional sense, but they " "do support sequences, which are logical groupings of arbitrary messages. " @@ -1390,57 +1520,57 @@ msgid "" "formats, as follows:" msgstr "" -#: library/mailbox.rst:1148 +#: library/mailbox.rst:1282 msgid "Sequence" msgstr "" -#: library/mailbox.rst:1237 +#: library/mailbox.rst:1371 msgid "unseen" msgstr "" -#: library/mailbox.rst:1237 +#: library/mailbox.rst:1371 msgid "Not read, but previously detected by MUA" msgstr "" -#: library/mailbox.rst:1152 +#: library/mailbox.rst:1286 msgid "replied" msgstr "" -#: library/mailbox.rst:1154 +#: library/mailbox.rst:1288 msgid "flagged" msgstr "" -#: library/mailbox.rst:1157 +#: library/mailbox.rst:1291 msgid ":class:`!MHMessage` instances offer the following methods:" msgstr "" -#: library/mailbox.rst:1162 +#: library/mailbox.rst:1296 msgid "Return a list of the names of sequences that include this message." msgstr "" -#: library/mailbox.rst:1167 +#: library/mailbox.rst:1301 msgid "Set the list of sequences that include this message." msgstr "" -#: library/mailbox.rst:1172 +#: library/mailbox.rst:1306 msgid "Add *sequence* to the list of sequences that include this message." msgstr "" -#: library/mailbox.rst:1177 +#: library/mailbox.rst:1311 msgid "Remove *sequence* from the list of sequences that include this message." msgstr "" -#: library/mailbox.rst:1179 +#: library/mailbox.rst:1313 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1311 +#: library/mailbox.rst:1445 msgid "no S flag" msgstr "" -#: library/mailbox.rst:1192 +#: library/mailbox.rst:1326 msgid "" "When an :class:`!MHMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1448,110 +1578,110 @@ msgid "" "take place:" msgstr "" -#: library/mailbox.rst:1329 +#: library/mailbox.rst:1463 msgid "no R flag" msgstr "" -#: library/mailbox.rst:1208 +#: library/mailbox.rst:1342 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1223 +#: library/mailbox.rst:1357 msgid ":class:`!BabylMessage` objects" msgstr "" -#: library/mailbox.rst:1228 +#: library/mailbox.rst:1362 msgid "" "A message with Babyl-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: library/mailbox.rst:1231 +#: library/mailbox.rst:1365 msgid "" "Certain message labels, called :dfn:`attributes`, are defined by convention " "to have special meanings. The attributes are as follows:" msgstr "" -#: library/mailbox.rst:1235 +#: library/mailbox.rst:1369 msgid "Label" msgstr "" -#: library/mailbox.rst:1239 +#: library/mailbox.rst:1373 msgid "deleted" msgstr "" -#: library/mailbox.rst:1241 +#: library/mailbox.rst:1375 msgid "filed" msgstr "" -#: library/mailbox.rst:1241 +#: library/mailbox.rst:1375 msgid "Copied to another file or mailbox" msgstr "" -#: library/mailbox.rst:1243 +#: library/mailbox.rst:1377 msgid "answered" msgstr "" -#: library/mailbox.rst:1245 +#: library/mailbox.rst:1379 msgid "forwarded" msgstr "" -#: library/mailbox.rst:1245 +#: library/mailbox.rst:1379 msgid "Forwarded" msgstr "" -#: library/mailbox.rst:1247 +#: library/mailbox.rst:1381 msgid "edited" msgstr "" -#: library/mailbox.rst:1247 +#: library/mailbox.rst:1381 msgid "Modified by the user" msgstr "" -#: library/mailbox.rst:1249 +#: library/mailbox.rst:1383 msgid "resent" msgstr "" -#: library/mailbox.rst:1249 +#: library/mailbox.rst:1383 msgid "Resent" msgstr "" -#: library/mailbox.rst:1252 +#: library/mailbox.rst:1386 msgid "" "By default, Rmail displays only visible headers. The :class:`!BabylMessage` " "class, though, uses the original headers because they are more complete. " "Visible headers may be accessed explicitly if desired." msgstr "" -#: library/mailbox.rst:1256 +#: library/mailbox.rst:1390 msgid ":class:`!BabylMessage` instances offer the following methods:" msgstr "" -#: library/mailbox.rst:1261 +#: library/mailbox.rst:1395 msgid "Return a list of labels on the message." msgstr "" -#: library/mailbox.rst:1266 +#: library/mailbox.rst:1400 msgid "Set the list of labels on the message to *labels*." msgstr "" -#: library/mailbox.rst:1271 +#: library/mailbox.rst:1405 msgid "Add *label* to the list of labels on the message." msgstr "" -#: library/mailbox.rst:1276 +#: library/mailbox.rst:1410 msgid "Remove *label* from the list of labels on the message." msgstr "" -#: library/mailbox.rst:1281 +#: library/mailbox.rst:1415 msgid "" -"Return an :class:`Message` instance whose headers are the message's visible " +"Return a :class:`Message` instance whose headers are the message's visible " "headers and whose body is empty." msgstr "" -#: library/mailbox.rst:1287 +#: library/mailbox.rst:1421 msgid "" "Set the message's visible headers to be the same as the headers in " "*message*. Parameter *visible* should be a :class:`Message` instance, an :" @@ -1559,7 +1689,7 @@ msgid "" "(which should be open in text mode)." msgstr "" -#: library/mailbox.rst:1295 +#: library/mailbox.rst:1429 msgid "" "When a :class:`!BabylMessage` instance's original headers are modified, the " "visible headers are not automatically modified to correspond. This method " @@ -1572,17 +1702,17 @@ msgid "" "visible headers." msgstr "" -#: library/mailbox.rst:1305 +#: library/mailbox.rst:1439 msgid "" "When a :class:`!BabylMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1317 +#: library/mailbox.rst:1451 msgid "\"forwarded\" label" msgstr "" -#: library/mailbox.rst:1320 +#: library/mailbox.rst:1454 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1590,23 +1720,23 @@ msgid "" "take place:" msgstr "" -#: library/mailbox.rst:1336 +#: library/mailbox.rst:1470 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1351 +#: library/mailbox.rst:1485 msgid ":class:`!MMDFMessage` objects" msgstr "" -#: library/mailbox.rst:1356 +#: library/mailbox.rst:1490 msgid "" "A message with MMDF-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: library/mailbox.rst:1359 +#: library/mailbox.rst:1493 msgid "" "As with message in an mbox mailbox, MMDF messages are stored with the " "sender's address and the delivery date in an initial line beginning with " @@ -1614,19 +1744,19 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: library/mailbox.rst:1364 +#: library/mailbox.rst:1498 msgid "" "Conventional flags for MMDF messages are identical to those of mbox message " "and are as follows:" msgstr "" -#: library/mailbox.rst:1385 +#: library/mailbox.rst:1519 msgid "" ":class:`!MMDFMessage` instances offer the following methods, which are " "identical to those offered by :class:`mboxMessage`:" msgstr "" -#: library/mailbox.rst:1434 +#: library/mailbox.rst:1568 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1634,43 +1764,43 @@ msgid "" "conversions take place:" msgstr "" -#: library/mailbox.rst:1453 +#: library/mailbox.rst:1587 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1468 +#: library/mailbox.rst:1602 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: library/mailbox.rst:1483 +#: library/mailbox.rst:1617 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`mboxMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: library/mailbox.rst:1488 +#: library/mailbox.rst:1622 msgid ":class:`mboxMessage` state" msgstr "" -#: library/mailbox.rst:1503 +#: library/mailbox.rst:1637 msgid "Exceptions" msgstr "" -#: library/mailbox.rst:1505 +#: library/mailbox.rst:1639 msgid "" "The following exception classes are defined in the :mod:`!mailbox` module:" msgstr "" -#: library/mailbox.rst:1510 +#: library/mailbox.rst:1644 msgid "The based class for all other module-specific exceptions." msgstr "" -#: library/mailbox.rst:1515 +#: library/mailbox.rst:1649 msgid "" "Raised when a mailbox is expected but is not found, such as when " "instantiating a :class:`Mailbox` subclass with a path that does not exist " @@ -1678,13 +1808,13 @@ msgid "" "that does not exist." msgstr "" -#: library/mailbox.rst:1522 +#: library/mailbox.rst:1656 msgid "" "Raised when a mailbox is not empty but is expected to be, such as when " "deleting a folder that contains messages." msgstr "" -#: library/mailbox.rst:1528 +#: library/mailbox.rst:1662 msgid "" "Raised when some mailbox-related condition beyond the control of the program " "causes it to be unable to proceed, such as when failing to acquire a lock " @@ -1692,32 +1822,93 @@ msgid "" "name already exists." msgstr "" -#: library/mailbox.rst:1536 +#: library/mailbox.rst:1670 msgid "" "Raised when the data in a file cannot be parsed, such as when an :class:`MH` " "instance attempts to read a corrupted :file:`.mh_sequences` file." msgstr "" -#: library/mailbox.rst:1543 +#: library/mailbox.rst:1677 msgid "Examples" msgstr "" -#: library/mailbox.rst:1545 +#: library/mailbox.rst:1679 msgid "" "A simple example of printing the subjects of all messages in a mailbox that " "seem interesting::" msgstr "" -#: library/mailbox.rst:1554 +#: library/mailbox.rst:1682 +msgid "" +"import mailbox\n" +"for message in mailbox.mbox('~/mbox'):\n" +" subject = message['subject'] # Could possibly be None.\n" +" if subject and 'python' in subject.lower():\n" +" print(subject)" +msgstr "" + +#: library/mailbox.rst:1688 msgid "" "To copy all mail from a Babyl mailbox to an MH mailbox, converting all of " "the format-specific information that can be converted::" msgstr "" -#: library/mailbox.rst:1565 +#: library/mailbox.rst:1691 +msgid "" +"import mailbox\n" +"destination = mailbox.MH('~/Mail')\n" +"destination.lock()\n" +"for message in mailbox.Babyl('~/RMAIL'):\n" +" destination.add(mailbox.MHMessage(message))\n" +"destination.flush()\n" +"destination.unlock()" +msgstr "" + +#: library/mailbox.rst:1699 msgid "" "This example sorts mail from several mailing lists into different mailboxes, " "being careful to avoid mail corruption due to concurrent modification by " "other programs, mail loss due to interruption of the program, or premature " "termination due to malformed messages in the mailbox::" msgstr "" + +#: library/mailbox.rst:1704 +msgid "" +"import mailbox\n" +"import email.errors\n" +"\n" +"list_names = ('python-list', 'python-dev', 'python-bugs')\n" +"\n" +"boxes = {name: mailbox.mbox('~/email/%s' % name) for name in list_names}\n" +"inbox = mailbox.Maildir('~/Maildir', factory=None)\n" +"\n" +"for key in inbox.iterkeys():\n" +" try:\n" +" message = inbox[key]\n" +" except email.errors.MessageParseError:\n" +" continue # The message is malformed. Just leave it.\n" +"\n" +" for name in list_names:\n" +" list_id = message['list-id']\n" +" if list_id and name in list_id:\n" +" # Get mailbox to use\n" +" box = boxes[name]\n" +"\n" +" # Write copy to disk before removing original.\n" +" # If there's a crash, you might duplicate a message, but\n" +" # that's better than losing a message completely.\n" +" box.lock()\n" +" box.add(message)\n" +" box.flush()\n" +" box.unlock()\n" +"\n" +" # Remove original message\n" +" inbox.lock()\n" +" inbox.discard(key)\n" +" inbox.flush()\n" +" inbox.unlock()\n" +" break # Found destination, so stop looking.\n" +"\n" +"for box in boxes.itervalues():\n" +" box.close()" +msgstr "" diff --git a/library/mailcap.po b/library/mailcap.po index 0aa121d9..659296f8 100644 --- a/library/mailcap.po +++ b/library/mailcap.po @@ -8,127 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/mailcap.rst:2 -msgid ":mod:`mailcap` --- Mailcap file handling" +msgid ":mod:`!mailcap` --- Mailcap file handling" msgstr "" -#: library/mailcap.rst:8 -msgid "**Source code:** :source:`Lib/mailcap.py`" -msgstr "" - -#: library/mailcap.rst:14 -msgid "" -"The :mod:`mailcap` module is deprecated (see :pep:`PEP 594 <594#mailcap>` " -"for details). The :mod:`mimetypes` module provides an alternative." -msgstr "" - -#: library/mailcap.rst:17 -msgid "" -"Mailcap files are used to configure how MIME-aware applications such as mail " -"readers and web browsers react to files with different MIME types. (The name " -"\"mailcap\" is derived from the phrase \"mail capability\".) For example, a " -"mailcap file might contain a line like ``video/mpeg; xmpeg %s``. Then, if " -"the user encounters an email message or web document with the MIME type :" -"mimetype:`video/mpeg`, ``%s`` will be replaced by a filename (usually one " -"belonging to a temporary file) and the :program:`xmpeg` program can be " -"automatically started to view the file." -msgstr "" - -#: library/mailcap.rst:26 -msgid "" -"The mailcap format is documented in :rfc:`1524`, \"A User Agent " -"Configuration Mechanism For Multimedia Mail Format Information\", but is not " -"an internet standard. However, mailcap files are supported on most Unix " -"systems." -msgstr "" - -#: library/mailcap.rst:33 -msgid "" -"Return a 2-tuple; the first element is a string containing the command line " -"to be executed (which can be passed to :func:`os.system`), and the second " -"element is the mailcap entry for a given MIME type. If no matching MIME " -"type can be found, ``(None, None)`` is returned." -msgstr "" - -#: library/mailcap.rst:38 -msgid "" -"*key* is the name of the field desired, which represents the type of " -"activity to be performed; the default value is 'view', since in the most " -"common case you simply want to view the body of the MIME-typed data. Other " -"possible values might be 'compose' and 'edit', if you wanted to create a new " -"body of the given MIME type or alter the existing body data. See :rfc:" -"`1524` for a complete list of these fields." -msgstr "" - -#: library/mailcap.rst:45 +#: library/mailcap.rst:10 msgid "" -"*filename* is the filename to be substituted for ``%s`` in the command line; " -"the default value is ``'/dev/null'`` which is almost certainly not what you " -"want, so usually you'll override it by specifying a filename." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/mailcap.rst:49 -msgid "" -"*plist* can be a list containing named parameters; the default value is " -"simply an empty list. Each entry in the list must be a string containing " -"the parameter name, an equals sign (``'='``), and the parameter's value. " -"Mailcap entries can contain named parameters like ``%{foo}``, which will be " -"replaced by the value of the parameter named 'foo'. For example, if the " -"command line ``showpartial %{id} %{number} %{total}`` was in a mailcap file, " -"and *plist* was set to ``['id=1', 'number=2', 'total=3']``, the resulting " -"command line would be ``'showpartial 1 2 3'``." -msgstr "" - -#: library/mailcap.rst:58 -msgid "" -"In a mailcap file, the \"test\" field can optionally be specified to test " -"some external condition (such as the machine architecture, or the window " -"system in use) to determine whether or not the mailcap line applies. :func:" -"`findmatch` will automatically check such conditions and skip the entry if " -"the check fails." -msgstr "" - -#: library/mailcap.rst:65 -msgid "" -"To prevent security issues with shell metacharacters (symbols that have " -"special effects in a shell command line), ``findmatch`` will refuse to " -"inject ASCII characters other than alphanumerics and ``@+=:,./-_`` into the " -"returned command line." -msgstr "" - -#: library/mailcap.rst:70 -msgid "" -"If a disallowed character appears in *filename*, ``findmatch`` will always " -"return ``(None, None)`` as if no entry was found. If such a character " -"appears elsewhere (a value in *plist* or in *MIMEtype*), ``findmatch`` will " -"ignore all mailcap entries which use that value. A :mod:`warning ` " -"will be raised in either case." -msgstr "" - -#: library/mailcap.rst:78 -msgid "" -"Returns a dictionary mapping MIME types to a list of mailcap file entries. " -"This dictionary must be passed to the :func:`findmatch` function. An entry " -"is stored as a list of dictionaries, but it shouldn't be necessary to know " -"the details of this representation." -msgstr "" - -#: library/mailcap.rst:83 +#: library/mailcap.rst:14 msgid "" -"The information is derived from all of the mailcap files found on the " -"system. Settings in the user's mailcap file :file:`$HOME/.mailcap` will " -"override settings in the system mailcap files :file:`/etc/mailcap`, :file:`/" -"usr/etc/mailcap`, and :file:`/usr/local/etc/mailcap`." -msgstr "" - -#: library/mailcap.rst:88 -msgid "An example usage::" +"The last version of Python that provided the :mod:`!mailcap` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/markup.po b/library/markup.po index 38c8304a..ba3ae204 100644 --- a/library/markup.po +++ b/library/markup.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/marshal.po b/library/marshal.po index 4661a985..69aaae60 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/marshal.rst:2 -msgid ":mod:`marshal` --- Internal Python object serialization" +msgid ":mod:`!marshal` --- Internal Python object serialization" msgstr "" #: library/marshal.rst:10 @@ -25,7 +26,7 @@ msgid "" "This module contains functions that can read and write Python values in a " "binary format. The format is specific to Python, but independent of machine " "architecture issues (e.g., you can write a Python value to a file on a PC, " -"transport the file to a Sun, and read it back there). Details of the format " +"transport the file to a Mac, and read it back there). Details of the format " "are undocumented on purpose; it may change between Python versions (although " "it rarely does). [#]_" msgstr "" @@ -37,146 +38,262 @@ msgid "" "and :mod:`shelve`. The :mod:`marshal` module exists mainly to support " "reading and writing the \"pseudo-compiled\" code for Python modules of :file:" "`.pyc` files. Therefore, the Python maintainers reserve the right to modify " -"the marshal format in backward incompatible ways should the need arise. If " -"you're serializing and de-serializing Python objects, use the :mod:`pickle` " -"module instead -- the performance is comparable, version independence is " -"guaranteed, and pickle supports a substantially wider range of objects than " -"marshal." +"the marshal format in backward incompatible ways should the need arise. The " +"format of code objects is not compatible between Python versions, even if " +"the version of the format is the same. De-serializing a code object in the " +"incorrect Python version has undefined behavior. If you're serializing and " +"de-serializing Python objects, use the :mod:`pickle` module instead -- the " +"performance is comparable, version independence is guaranteed, and pickle " +"supports a substantially wider range of objects than marshal." msgstr "" -#: library/marshal.rst:33 +#: library/marshal.rst:37 msgid "" "The :mod:`marshal` module is not intended to be secure against erroneous or " "maliciously constructed data. Never unmarshal data received from an " "untrusted or unauthenticated source." msgstr "" -#: library/marshal.rst:39 +#: library/marshal.rst:41 +msgid "" +"There are functions that read/write files as well as functions operating on " +"bytes-like objects." +msgstr "" + +#: library/marshal.rst:46 msgid "" "Not all Python object types are supported; in general, only objects whose " "value is independent from a particular invocation of Python can be written " -"and read by this module. The following types are supported: booleans, " -"integers, floating point numbers, complex numbers, strings, bytes, " -"bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects, " -"where it should be understood that tuples, lists, sets, frozensets and " -"dictionaries are only supported as long as the values contained therein are " -"themselves supported. The singletons :const:`None`, :const:`Ellipsis` and :" -"exc:`StopIteration` can also be marshalled and unmarshalled. For format " -"*version* lower than 3, recursive lists, sets and dictionaries cannot be " -"written (see below)." +"and read by this module. The following types are supported:" +msgstr "" + +#: library/marshal.rst:50 +msgid "" +"Numeric types: :class:`int`, :class:`bool`, :class:`float`, :class:`complex`." msgstr "" #: library/marshal.rst:51 msgid "" -"There are functions that read/write files as well as functions operating on " -"bytes-like objects." +"Strings (:class:`str`) and :class:`bytes`. :term:`Bytes-like objects ` like :class:`bytearray` are marshalled as :class:`!bytes`." msgstr "" #: library/marshal.rst:54 -msgid "The module defines these functions:" +msgid "" +"Containers: :class:`tuple`, :class:`list`, :class:`set`, :class:`frozenset`, " +"and (since :data:`version` 5), :class:`slice`. It should be understood that " +"these are supported only if the values contained therein are themselves " +"supported. Recursive containers are supported since :data:`version` 3." msgstr "" #: library/marshal.rst:59 msgid "" +"The singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration`." +msgstr "" + +#: library/marshal.rst:60 +msgid "" +":class:`code` objects, if *allow_code* is true. See note above about version " +"dependence." +msgstr "" + +#: library/marshal.rst:65 +msgid "" +"Added format version 3, which supports marshalling recursive lists, sets and " +"dictionaries." +msgstr "" + +#: library/marshal.rst:67 +msgid "" +"Added format version 4, which supports efficient representations of short " +"strings." +msgstr "" + +#: library/marshal.rst:72 +msgid "Added format version 5, which allows marshalling slices." +msgstr "" + +#: library/marshal.rst:75 +msgid "The module defines these functions:" +msgstr "" + +#: library/marshal.rst:80 +msgid "" "Write the value on the open file. The value must be a supported type. The " "file must be a writeable :term:`binary file`." msgstr "" -#: library/marshal.rst:62 +#: library/marshal.rst:83 msgid "" "If the value has (or contains an object that has) an unsupported type, a :" "exc:`ValueError` exception is raised --- but garbage data will also be " "written to the file. The object will not be properly read back by :func:" -"`load`." +"`load`. :ref:`Code objects ` are only supported if " +"*allow_code* is true." msgstr "" -#: library/marshal.rst:66 +#: library/marshal.rst:88 msgid "" "The *version* argument indicates the data format that ``dump`` should use " "(see below)." msgstr "" -#: library/marshal.rst:101 +#: library/marshal.rst:131 msgid "" "Raises an :ref:`auditing event ` ``marshal.dumps`` with arguments " "``value``, ``version``." msgstr "" -#: library/marshal.rst:74 +#: library/marshal.rst:117 library/marshal.rst:151 +msgid "Added the *allow_code* parameter." +msgstr "" + +#: library/marshal.rst:99 msgid "" "Read one value from the open file and return it. If no valid value is read " "(e.g. because the data has a different Python version's incompatible marshal " -"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. The " -"file must be a readable :term:`binary file`." +"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" +"`Code objects ` are only supported if *allow_code* is true. " +"The file must be a readable :term:`binary file`." msgstr "" -#: library/marshal.rst:79 +#: library/marshal.rst:105 msgid "" "Raises an :ref:`auditing event ` ``marshal.load`` with no " "arguments." msgstr "" -#: library/marshal.rst:83 +#: library/marshal.rst:109 msgid "" "If an object containing an unsupported type was marshalled with :func:" "`dump`, :func:`load` will substitute ``None`` for the unmarshallable type." msgstr "" -#: library/marshal.rst:88 +#: library/marshal.rst:114 msgid "" "This call used to raise a ``code.__new__`` audit event for each code object. " "Now it raises a single ``marshal.load`` event for the entire load operation." msgstr "" -#: library/marshal.rst:94 +#: library/marshal.rst:123 msgid "" "Return the bytes object that would be written to a file by ``dump(value, " "file)``. The value must be a supported type. Raise a :exc:`ValueError` " -"exception if value has (or contains an object that has) an unsupported type." +"exception if value has (or contains an object that has) an unsupported " +"type. :ref:`Code objects ` are only supported if *allow_code* " +"is true." msgstr "" -#: library/marshal.rst:98 +#: library/marshal.rst:128 msgid "" "The *version* argument indicates the data format that ``dumps`` should use " "(see below)." msgstr "" -#: library/marshal.rst:106 +#: library/marshal.rst:139 msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " -"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. Extra " -"bytes in the input are ignored." +"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" +"`Code objects ` are only supported if *allow_code* is true. " +"Extra bytes in the input are ignored." msgstr "" -#: library/marshal.rst:110 +#: library/marshal.rst:144 msgid "" "Raises an :ref:`auditing event ` ``marshal.loads`` with argument " "``bytes``." msgstr "" -#: library/marshal.rst:114 +#: library/marshal.rst:148 msgid "" "This call used to raise a ``code.__new__`` audit event for each code object. " "Now it raises a single ``marshal.loads`` event for the entire load operation." msgstr "" -#: library/marshal.rst:118 +#: library/marshal.rst:155 msgid "In addition, the following constants are defined:" msgstr "" -#: library/marshal.rst:122 +#: library/marshal.rst:159 msgid "" -"Indicates the format that the module uses. Version 0 is the historical " -"format, version 1 shares interned strings and version 2 uses a binary format " -"for floating point numbers. Version 3 adds support for object instancing and " -"recursion. The current version is 4." +"Indicates the format that the module uses. Version 0 is the historical first " +"version; subsequent versions add new features. Generally, a new version " +"becomes the default when it is introduced." msgstr "" -#: library/marshal.rst:130 +#: library/marshal.rst:165 +msgid "Version" +msgstr "" + +#: library/marshal.rst:165 +msgid "Available since" +msgstr "" + +#: library/marshal.rst:165 +msgid "New features" +msgstr "" + +#: library/marshal.rst:167 +msgid "1" +msgstr "" + +#: library/marshal.rst:167 +msgid "Python 2.4" +msgstr "" + +#: library/marshal.rst:167 +msgid "Sharing interned strings" +msgstr "" + +#: library/marshal.rst:169 +msgid "2" +msgstr "" + +#: library/marshal.rst:169 +msgid "Python 2.5" +msgstr "" + +#: library/marshal.rst:169 +msgid "Binary representation of floats" +msgstr "" + +#: library/marshal.rst:171 +msgid "3" +msgstr "" + +#: library/marshal.rst:173 +msgid "Python 3.4" +msgstr "" + +#: library/marshal.rst:171 +msgid "Support for object instancing and recursion" +msgstr "" + +#: library/marshal.rst:173 +msgid "4" +msgstr "" + +#: library/marshal.rst:173 +msgid "Efficient representation of short strings" +msgstr "" + +#: library/marshal.rst:175 +msgid "5" +msgstr "" + +#: library/marshal.rst:175 +msgid "Python 3.14" +msgstr "" + +#: library/marshal.rst:175 +msgid "Support for :class:`slice` objects" +msgstr "" + +#: library/marshal.rst:180 msgid "Footnotes" msgstr "" -#: library/marshal.rst:131 +#: library/marshal.rst:181 msgid "" "The name of this module stems from a bit of terminology used by the " "designers of Modula-3 (amongst others), who use the term \"marshalling\" for " @@ -197,14 +314,14 @@ msgstr "" msgid "shelve" msgstr "" -#: library/marshal.rst:37 +#: library/marshal.rst:44 msgid "object" msgstr "" -#: library/marshal.rst:37 +#: library/marshal.rst:44 msgid "code" msgstr "" -#: library/marshal.rst:37 +#: library/marshal.rst:44 msgid "code object" msgstr "" diff --git a/library/math.po b/library/math.po index 51ec5ab5..d7345950 100644 --- a/library/math.po +++ b/library/math.po @@ -8,22 +8,23 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/math.rst:2 -msgid ":mod:`math` --- Mathematical functions" +msgid ":mod:`!math` --- Mathematical functions" msgstr "" #: library/math.rst:13 msgid "" -"This module provides access to the mathematical functions defined by the C " -"standard." +"This module provides access to common mathematical functions and constants, " +"including those defined by the C standard." msgstr "" #: library/math.rst:16 @@ -45,163 +46,815 @@ msgid "" msgstr "" #: library/math.rst:30 -msgid "Number-theoretic and representation functions" +msgid "**Number-theoretic functions**" +msgstr "" + +#: library/math.rst:32 +msgid ":func:`comb(n, k) `" +msgstr "" + +#: library/math.rst:32 +msgid "" +"Number of ways to choose *k* items from *n* items without repetition and " +"without order" +msgstr "" + +#: library/math.rst:33 +msgid ":func:`factorial(n) `" +msgstr "" + +#: library/math.rst:33 +msgid "*n* factorial" +msgstr "" + +#: library/math.rst:34 +msgid ":func:`gcd(*integers) `" msgstr "" #: library/math.rst:34 +msgid "Greatest common divisor of the integer arguments" +msgstr "" + +#: library/math.rst:35 +msgid ":func:`isqrt(n) `" +msgstr "" + +#: library/math.rst:35 +msgid "Integer square root of a nonnegative integer *n*" +msgstr "" + +#: library/math.rst:36 +msgid ":func:`lcm(*integers) `" +msgstr "" + +#: library/math.rst:36 +msgid "Least common multiple of the integer arguments" +msgstr "" + +#: library/math.rst:37 +msgid ":func:`perm(n, k) `" +msgstr "" + +#: library/math.rst:37 msgid "" -"Return the ceiling of *x*, the smallest integer greater than or equal to " -"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `, which should return an :class:`~numbers.Integral` value." +"Number of ways to choose *k* items from *n* items without repetition and " +"with order" +msgstr "" + +#: library/math.rst:39 +msgid "**Floating point arithmetic**" +msgstr "" + +#: library/math.rst:41 +msgid ":func:`ceil(x) `" msgstr "" #: library/math.rst:41 +msgid "Ceiling of *x*, the smallest integer greater than or equal to *x*" +msgstr "" + +#: library/math.rst:42 +msgid ":func:`fabs(x) `" +msgstr "" + +#: library/math.rst:42 +msgid "Absolute value of *x*" +msgstr "" + +#: library/math.rst:43 +msgid ":func:`floor(x) `" +msgstr "" + +#: library/math.rst:43 +msgid "Floor of *x*, the largest integer less than or equal to *x*" +msgstr "" + +#: library/math.rst:44 +msgid ":func:`fma(x, y, z) `" +msgstr "" + +#: library/math.rst:44 +msgid "Fused multiply-add operation: ``(x * y) + z``" +msgstr "" + +#: library/math.rst:45 +msgid ":func:`fmod(x, y) `" +msgstr "" + +#: library/math.rst:45 +msgid "Remainder of division ``x / y``" +msgstr "" + +#: library/math.rst:46 +msgid ":func:`modf(x) `" +msgstr "" + +#: library/math.rst:46 +msgid "Fractional and integer parts of *x*" +msgstr "" + +#: library/math.rst:47 +msgid ":func:`remainder(x, y) `" +msgstr "" + +#: library/math.rst:47 +msgid "Remainder of *x* with respect to *y*" +msgstr "" + +#: library/math.rst:48 +msgid ":func:`trunc(x) `" +msgstr "" + +#: library/math.rst:48 +msgid "Integer part of *x*" +msgstr "" + +#: library/math.rst:50 +msgid "**Floating point manipulation functions**" +msgstr "" + +#: library/math.rst:52 +msgid ":func:`copysign(x, y) `" +msgstr "" + +#: library/math.rst:52 +msgid "Magnitude (absolute value) of *x* with the sign of *y*" +msgstr "" + +#: library/math.rst:53 +msgid ":func:`frexp(x) `" +msgstr "" + +#: library/math.rst:53 +msgid "Mantissa and exponent of *x*" +msgstr "" + +#: library/math.rst:54 +msgid ":func:`isclose(a, b, rel_tol, abs_tol) `" +msgstr "" + +#: library/math.rst:54 +msgid "Check if the values *a* and *b* are close to each other" +msgstr "" + +#: library/math.rst:55 +msgid ":func:`isfinite(x) `" +msgstr "" + +#: library/math.rst:55 +msgid "Check if *x* is neither an infinity nor a NaN" +msgstr "" + +#: library/math.rst:56 +msgid ":func:`isinf(x) `" +msgstr "" + +#: library/math.rst:56 +msgid "Check if *x* is a positive or negative infinity" +msgstr "" + +#: library/math.rst:57 +msgid ":func:`isnan(x) `" +msgstr "" + +#: library/math.rst:57 +msgid "Check if *x* is a NaN (not a number)" +msgstr "" + +#: library/math.rst:58 +msgid ":func:`ldexp(x, i) `" +msgstr "" + +#: library/math.rst:58 +msgid "``x * (2**i)``, inverse of function :func:`frexp`" +msgstr "" + +#: library/math.rst:59 +msgid ":func:`nextafter(x, y, steps) `" +msgstr "" + +#: library/math.rst:59 +msgid "Floating-point value *steps* steps after *x* towards *y*" +msgstr "" + +#: library/math.rst:60 +msgid ":func:`ulp(x) `" +msgstr "" + +#: library/math.rst:60 +msgid "Value of the least significant bit of *x*" +msgstr "" + +#: library/math.rst:62 +msgid "**Power, exponential and logarithmic functions**" +msgstr "" + +#: library/math.rst:64 +msgid ":func:`cbrt(x) `" +msgstr "" + +#: library/math.rst:64 +msgid "Cube root of *x*" +msgstr "" + +#: library/math.rst:65 +msgid ":func:`exp(x) `" +msgstr "" + +#: library/math.rst:65 +msgid "*e* raised to the power *x*" +msgstr "" + +#: library/math.rst:66 +msgid ":func:`exp2(x) `" +msgstr "" + +#: library/math.rst:66 +msgid "*2* raised to the power *x*" +msgstr "" + +#: library/math.rst:67 +msgid ":func:`expm1(x) `" +msgstr "" + +#: library/math.rst:67 +msgid "*e* raised to the power *x*, minus 1" +msgstr "" + +#: library/math.rst:68 +msgid ":func:`log(x, base) `" +msgstr "" + +#: library/math.rst:68 +msgid "Logarithm of *x* to the given base (*e* by default)" +msgstr "" + +#: library/math.rst:69 +msgid ":func:`log1p(x) `" +msgstr "" + +#: library/math.rst:69 +msgid "Natural logarithm of *1+x* (base *e*)" +msgstr "" + +#: library/math.rst:70 +msgid ":func:`log2(x) `" +msgstr "" + +#: library/math.rst:70 +msgid "Base-2 logarithm of *x*" +msgstr "" + +#: library/math.rst:71 +msgid ":func:`log10(x) `" +msgstr "" + +#: library/math.rst:71 +msgid "Base-10 logarithm of *x*" +msgstr "" + +#: library/math.rst:72 +msgid ":func:`pow(x, y) `" +msgstr "" + +#: library/math.rst:72 +msgid "*x* raised to the power *y*" +msgstr "" + +#: library/math.rst:73 +msgid ":func:`sqrt(x) `" +msgstr "" + +#: library/math.rst:73 +msgid "Square root of *x*" +msgstr "" + +#: library/math.rst:75 +msgid "**Summation and product functions**" +msgstr "" + +#: library/math.rst:77 +msgid ":func:`dist(p, q) `" +msgstr "" + +#: library/math.rst:77 +msgid "" +"Euclidean distance between two points *p* and *q* given as an iterable of " +"coordinates" +msgstr "" + +#: library/math.rst:78 +msgid ":func:`fsum(iterable) `" +msgstr "" + +#: library/math.rst:78 +msgid "Sum of values in the input *iterable*" +msgstr "" + +#: library/math.rst:79 +msgid ":func:`hypot(*coordinates) `" +msgstr "" + +#: library/math.rst:79 +msgid "Euclidean norm of an iterable of coordinates" +msgstr "" + +#: library/math.rst:80 +msgid ":func:`prod(iterable, start) `" +msgstr "" + +#: library/math.rst:80 +msgid "Product of elements in the input *iterable* with a *start* value" +msgstr "" + +#: library/math.rst:81 +msgid ":func:`sumprod(p, q) `" +msgstr "" + +#: library/math.rst:81 +msgid "Sum of products from two iterables *p* and *q*" +msgstr "" + +#: library/math.rst:83 +msgid "**Angular conversion**" +msgstr "" + +#: library/math.rst:85 +msgid ":func:`degrees(x) `" +msgstr "" + +#: library/math.rst:85 +msgid "Convert angle *x* from radians to degrees" +msgstr "" + +#: library/math.rst:86 +msgid ":func:`radians(x) `" +msgstr "" + +#: library/math.rst:86 +msgid "Convert angle *x* from degrees to radians" +msgstr "" + +#: library/math.rst:88 +msgid "**Trigonometric functions**" +msgstr "" + +#: library/math.rst:90 +msgid ":func:`acos(x) `" +msgstr "" + +#: library/math.rst:90 +msgid "Arc cosine of *x*" +msgstr "" + +#: library/math.rst:91 +msgid ":func:`asin(x) `" +msgstr "" + +#: library/math.rst:91 +msgid "Arc sine of *x*" +msgstr "" + +#: library/math.rst:92 +msgid ":func:`atan(x) `" +msgstr "" + +#: library/math.rst:92 +msgid "Arc tangent of *x*" +msgstr "" + +#: library/math.rst:93 +msgid ":func:`atan2(y, x) `" +msgstr "" + +#: library/math.rst:93 +msgid "``atan(y / x)``" +msgstr "" + +#: library/math.rst:94 +msgid ":func:`cos(x) `" +msgstr "" + +#: library/math.rst:94 +msgid "Cosine of *x*" +msgstr "" + +#: library/math.rst:95 +msgid ":func:`sin(x) `" +msgstr "" + +#: library/math.rst:95 +msgid "Sine of *x*" +msgstr "" + +#: library/math.rst:96 +msgid ":func:`tan(x) `" +msgstr "" + +#: library/math.rst:96 +msgid "Tangent of *x*" +msgstr "" + +#: library/math.rst:98 +msgid "**Hyperbolic functions**" +msgstr "" + +#: library/math.rst:100 +msgid ":func:`acosh(x) `" +msgstr "" + +#: library/math.rst:100 +msgid "Inverse hyperbolic cosine of *x*" +msgstr "" + +#: library/math.rst:101 +msgid ":func:`asinh(x) `" +msgstr "" + +#: library/math.rst:101 +msgid "Inverse hyperbolic sine of *x*" +msgstr "" + +#: library/math.rst:102 +msgid ":func:`atanh(x) `" +msgstr "" + +#: library/math.rst:102 +msgid "Inverse hyperbolic tangent of *x*" +msgstr "" + +#: library/math.rst:103 +msgid ":func:`cosh(x) `" +msgstr "" + +#: library/math.rst:103 +msgid "Hyperbolic cosine of *x*" +msgstr "" + +#: library/math.rst:104 +msgid ":func:`sinh(x) `" +msgstr "" + +#: library/math.rst:104 +msgid "Hyperbolic sine of *x*" +msgstr "" + +#: library/math.rst:105 +msgid ":func:`tanh(x) `" +msgstr "" + +#: library/math.rst:105 +msgid "Hyperbolic tangent of *x*" +msgstr "" + +#: library/math.rst:107 +msgid "**Special functions**" +msgstr "" + +#: library/math.rst:109 +msgid ":func:`erf(x) `" +msgstr "" + +#: library/math.rst:109 +msgid "`Error function `_ at *x*" +msgstr "" + +#: library/math.rst:110 +msgid ":func:`erfc(x) `" +msgstr "" + +#: library/math.rst:110 +msgid "" +"`Complementary error function `_ at *x*" +msgstr "" + +#: library/math.rst:111 +msgid ":func:`gamma(x) `" +msgstr "" + +#: library/math.rst:111 +msgid "`Gamma function `_ at *x*" +msgstr "" + +#: library/math.rst:112 +msgid ":func:`lgamma(x) `" +msgstr "" + +#: library/math.rst:112 +msgid "" +"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" +msgstr "" + +#: library/math.rst:114 +msgid "**Constants**" +msgstr "" + +#: library/math.rst:116 +msgid ":data:`pi`" +msgstr "" + +#: library/math.rst:116 +msgid "*π* = 3.141592..." +msgstr "" + +#: library/math.rst:117 +msgid ":data:`e`" +msgstr "" + +#: library/math.rst:117 +msgid "*e* = 2.718281..." +msgstr "" + +#: library/math.rst:118 +msgid ":data:`tau`" +msgstr "" + +#: library/math.rst:118 +msgid "*τ* = 2\\ *π* = 6.283185..." +msgstr "" + +#: library/math.rst:119 +msgid ":data:`inf`" +msgstr "" + +#: library/math.rst:119 +msgid "Positive infinity" +msgstr "" + +#: library/math.rst:120 +msgid ":data:`nan`" +msgstr "" + +#: library/math.rst:120 +msgid "\"Not a number\" (NaN)" +msgstr "" + +#: library/math.rst:125 +msgid "Number-theoretic functions" +msgstr "" + +#: library/math.rst:129 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and without order." msgstr "" -#: library/math.rst:44 +#: library/math.rst:132 msgid "" "Evaluates to ``n! / (k! * (n - k)!)`` when ``k <= n`` and evaluates to zero " "when ``k > n``." msgstr "" -#: library/math.rst:47 +#: library/math.rst:135 msgid "" "Also called the binomial coefficient because it is equivalent to the " "coefficient of k-th term in polynomial expansion of ``(1 + x)ⁿ``." msgstr "" -#: library/math.rst:258 +#: library/math.rst:204 msgid "" "Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" "exc:`ValueError` if either of the arguments are negative." msgstr "" -#: library/math.rst:59 +#: library/math.rst:147 +msgid "Return factorial of the nonnegative integer *n*." +msgstr "" + +#: library/math.rst:149 +msgid "Floats with integral values (like ``5.0``) are no longer accepted." +msgstr "" + +#: library/math.rst:155 msgid "" -"Return a float with the magnitude (absolute value) of *x* but the sign of " -"*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " -"returns *-1.0*." +"Return the greatest common divisor of the specified integer arguments. If " +"any of the arguments is nonzero, then the returned value is the largest " +"positive integer that is a divisor of all arguments. If all arguments are " +"zero, then the returned value is ``0``. ``gcd()`` without arguments returns " +"``0``." msgstr "" -#: library/math.rst:66 -msgid "Return the absolute value of *x*." +#: library/math.rst:163 +msgid "" +"Added support for an arbitrary number of arguments. Formerly, only two " +"arguments were supported." msgstr "" -#: library/math.rst:71 +#: library/math.rst:170 msgid "" -"Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not " -"integral or is negative." +"Return the integer square root of the nonnegative integer *n*. This is the " +"floor of the exact square root of *n*, or equivalently the greatest integer " +"*a* such that *a*\\ ² |nbsp| ≤ |nbsp| *n*." msgstr "" -#: library/math.rst:74 -msgid "Accepting floats with integral values (like ``5.0``) is deprecated." +#: library/math.rst:174 +msgid "" +"For some applications, it may be more convenient to have the least integer " +"*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " +"the exact square root of *n*. For positive *n*, this can be computed using " +"``a = 1 + isqrt(n - 1)``." msgstr "" -#: library/math.rst:80 +#: library/math.rst:184 +msgid "" +"Return the least common multiple of the specified integer arguments. If all " +"arguments are nonzero, then the returned value is the smallest positive " +"integer that is a multiple of all arguments. If any of the arguments is " +"zero, then the returned value is ``0``. ``lcm()`` without arguments returns " +"``1``." +msgstr "" + +#: library/math.rst:195 +msgid "" +"Return the number of ways to choose *k* items from *n* items without " +"repetition and with order." +msgstr "" + +#: library/math.rst:198 +msgid "" +"Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " +"``k > n``." +msgstr "" + +#: library/math.rst:201 +msgid "" +"If *k* is not specified or is ``None``, then *k* defaults to *n* and the " +"function returns ``n!``." +msgstr "" + +#: library/math.rst:211 +msgid "Floating point arithmetic" +msgstr "" + +#: library/math.rst:215 +msgid "" +"Return the ceiling of *x*, the smallest integer greater than or equal to " +"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `, which should return an :class:`~numbers.Integral` value." +msgstr "" + +#: library/math.rst:222 +msgid "Return the absolute value of *x*." +msgstr "" + +#: library/math.rst:227 msgid "" "Return the floor of *x*, the largest integer less than or equal to *x*. If " "*x* is not a float, delegates to :meth:`x.__floor__ `, " "which should return an :class:`~numbers.Integral` value." msgstr "" -#: library/math.rst:87 +#: library/math.rst:234 msgid "" -"Return ``fmod(x, y)``, as defined by the platform C library. Note that the " -"Python expression ``x % y`` may not return the same result. The intent of " -"the C standard is that ``fmod(x, y)`` be exactly (mathematically; to " -"infinite precision) equal to ``x - n*y`` for some integer *n* such that the " -"result has the same sign as *x* and magnitude less than ``abs(y)``. " -"Python's ``x % y`` returns a result with the sign of *y* instead, and may " -"not be exactly computable for float arguments. For example, ``fmod(-1e-100, " -"1e100)`` is ``-1e-100``, but the result of Python's ``-1e-100 % 1e100`` is " -"``1e100-1e-100``, which cannot be represented exactly as a float, and rounds " -"to the surprising ``1e100``. For this reason, function :func:`fmod` is " -"generally preferred when working with floats, while Python's ``x % y`` is " -"preferred when working with integers." +"Fused multiply-add operation. Return ``(x * y) + z``, computed as though " +"with infinite precision and range followed by a single round to the " +"``float`` format. This operation often provides better accuracy than the " +"direct expression ``(x * y) + z``." msgstr "" -#: library/math.rst:102 +#: library/math.rst:239 msgid "" -"Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " -"float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " -"zero, returns ``(0.0, 0)``, otherwise ``0.5 <= abs(m) < 1``. This is used " -"to \"pick apart\" the internal representation of a float in a portable way." +"This function follows the specification of the fusedMultiplyAdd operation " +"described in the IEEE 754 standard. The standard leaves one case " +"implementation-defined, namely the result of ``fma(0, inf, nan)`` and " +"``fma(inf, 0, nan)``. In these cases, ``math.fma`` returns a NaN, and does " +"not raise any exception." +msgstr "" + +#: library/math.rst:250 +msgid "" +"Return the floating-point remainder of ``x / y``, as defined by the platform " +"C library function ``fmod(x, y)``. Note that the Python expression ``x % y`` " +"may not return the same result. The intent of the C standard is that " +"``fmod(x, y)`` be exactly (mathematically; to infinite precision) equal to " +"``x - n*y`` for some integer *n* such that the result has the same sign as " +"*x* and magnitude less than ``abs(y)``. Python's ``x % y`` returns a result " +"with the sign of *y* instead, and may not be exactly computable for float " +"arguments. For example, ``fmod(-1e-100, 1e100)`` is ``-1e-100``, but the " +"result of Python's ``-1e-100 % 1e100`` is ``1e100-1e-100``, which cannot be " +"represented exactly as a float, and rounds to the surprising ``1e100``. For " +"this reason, function :func:`fmod` is generally preferred when working with " +"floats, while Python's ``x % y`` is preferred when working with integers." +msgstr "" + +#: library/math.rst:266 +msgid "" +"Return the fractional and integer parts of *x*. Both results carry the sign " +"of *x* and are floats." +msgstr "" + +#: library/math.rst:269 +msgid "" +"Note that :func:`modf` has a different call/return pattern than its C " +"equivalents: it takes a single argument and return a pair of values, rather " +"than returning its second return value through an 'output parameter' (there " +"is no such thing in Python)." +msgstr "" + +#: library/math.rst:277 +msgid "" +"Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " +"*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " +"is the closest integer to the exact value of the quotient ``x / y``. If " +"``x / y`` is exactly halfway between two consecutive integers, the nearest " +"*even* integer is used for ``n``. The remainder ``r = remainder(x, y)`` " +"thus always satisfies ``abs(r) <= 0.5 * abs(y)``." +msgstr "" + +#: library/math.rst:284 +msgid "" +"Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " +"*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " +"x)`` raise :exc:`ValueError` for any non-NaN *x*. If the result of the " +"remainder operation is zero, that zero will have the same sign as *x*." +msgstr "" + +#: library/math.rst:290 +msgid "" +"On platforms using IEEE 754 binary floating point, the result of this " +"operation is always exactly representable: no rounding error is introduced." msgstr "" -#: library/math.rst:110 +#: library/math.rst:298 msgid "" -"Return an accurate floating point sum of values in the iterable. Avoids " -"loss of precision by tracking multiple intermediate partial sums." +"Return *x* with the fractional part removed, leaving the integer part. This " +"rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " +"*x*, and equivalent to :func:`ceil` for negative *x*. If *x* is not a float, " +"delegates to :meth:`x.__trunc__ `, which should return an :" +"class:`~numbers.Integral` value." msgstr "" -#: library/math.rst:113 +#: library/math.rst:305 msgid "" -"The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " -"typical case where the rounding mode is half-even. On some non-Windows " -"builds, the underlying C library uses extended precision addition and may " -"occasionally double-round an intermediate sum causing it to be off in its " -"least significant bit." +"For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " +"*all* floating-point numbers of sufficiently large magnitude are exact " +"integers. Python floats typically carry no more than 53 bits of precision " +"(the same as the platform C double type), in which case any float *x* with " +"``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: library/math.rst:119 +#: library/math.rst:313 +msgid "Floating point manipulation functions" +msgstr "" + +#: library/math.rst:317 msgid "" -"For further discussion and two alternative approaches, see the `ASPN " -"cookbook recipes for accurate floating point summation `_\\." +"Return a float with the magnitude (absolute value) of *x* but the sign of " +"*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " +"returns *-1.0*." msgstr "" -#: library/math.rst:126 +#: library/math.rst:324 msgid "" -"Return the greatest common divisor of the specified integer arguments. If " -"any of the arguments is nonzero, then the returned value is the largest " -"positive integer that is a divisor of all arguments. If all arguments are " -"zero, then the returned value is ``0``. ``gcd()`` without arguments returns " -"``0``." +"Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " +"float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " +"zero, returns ``(0.0, 0)``, otherwise ``0.5 <= abs(m) < 1``. This is used " +"to \"pick apart\" the internal representation of a float in a portable way." msgstr "" -#: library/math.rst:134 +#: library/math.rst:329 msgid "" -"Added support for an arbitrary number of arguments. Formerly, only two " -"arguments were supported." +"Note that :func:`frexp` has a different call/return pattern than its C " +"equivalents: it takes a single argument and return a pair of values, rather " +"than returning its second return value through an 'output parameter' (there " +"is no such thing in Python)." msgstr "" -#: library/math.rst:141 +#: library/math.rst:336 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "" -#: library/math.rst:144 +#: library/math.rst:339 msgid "" "Whether or not two values are considered close is determined according to " -"given absolute and relative tolerances." +"given absolute and relative tolerances. If no errors occur, the result will " +"be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." msgstr "" -#: library/math.rst:147 +#: library/math.rst:343 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " "For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default " "tolerance is ``1e-09``, which assures that the two values are the same " -"within about 9 decimal digits. *rel_tol* must be greater than zero." -msgstr "" - -#: library/math.rst:153 -msgid "" -"*abs_tol* is the minimum absolute tolerance -- useful for comparisons near " -"zero. *abs_tol* must be at least zero." +"within about 9 decimal digits. *rel_tol* must be nonnegative and less than " +"``1.0``." msgstr "" -#: library/math.rst:156 +#: library/math.rst:350 msgid "" -"If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * " -"max(abs(a), abs(b)), abs_tol)``." +"*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " +"nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any nonzero ``x`` " +"and *rel_tol* less than ``1.0``. So add an appropriate positive *abs_tol* " +"argument to the call." msgstr "" -#: library/math.rst:159 +#: library/math.rst:356 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -209,265 +862,136 @@ msgid "" "considered close to themselves." msgstr "" -#: library/math.rst:168 +#: library/math.rst:365 msgid ":pep:`485` -- A function for testing approximate equality" msgstr "" -#: library/math.rst:173 +#: library/math.rst:370 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" msgstr "" -#: library/math.rst:181 +#: library/math.rst:378 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "" -#: library/math.rst:187 +#: library/math.rst:384 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" -#: library/math.rst:192 -msgid "" -"Return the integer square root of the nonnegative integer *n*. This is the " -"floor of the exact square root of *n*, or equivalently the greatest integer " -"*a* such that *a*\\ ² |nbsp| ≤ |nbsp| *n*." -msgstr "" - -#: library/math.rst:196 -msgid "" -"For some applications, it may be more convenient to have the least integer " -"*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " -"the exact square root of *n*. For positive *n*, this can be computed using " -"``a = 1 + isqrt(n - 1)``." -msgstr "" - -#: library/math.rst:206 -msgid "" -"Return the least common multiple of the specified integer arguments. If all " -"arguments are nonzero, then the returned value is the smallest positive " -"integer that is a multiple of all arguments. If any of the arguments is " -"zero, then the returned value is ``0``. ``lcm()`` without arguments returns " -"``1``." -msgstr "" - -#: library/math.rst:217 +#: library/math.rst:389 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "" -#: library/math.rst:223 -msgid "" -"Return the fractional and integer parts of *x*. Both results carry the sign " -"of *x* and are floats." -msgstr "" - -#: library/math.rst:229 +#: library/math.rst:395 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: library/math.rst:231 +#: library/math.rst:397 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: library/math.rst:233 +#: library/math.rst:399 msgid "Examples:" msgstr "" -#: library/math.rst:235 +#: library/math.rst:401 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: library/math.rst:236 +#: library/math.rst:402 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: library/math.rst:237 +#: library/math.rst:403 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: library/math.rst:238 +#: library/math.rst:404 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: library/math.rst:240 +#: library/math.rst:406 msgid "See also :func:`math.ulp`." msgstr "" -#: library/math.rst:244 +#: library/math.rst:410 msgid "Added the *steps* argument." msgstr "" -#: library/math.rst:249 -msgid "" -"Return the number of ways to choose *k* items from *n* items without " -"repetition and with order." -msgstr "" - -#: library/math.rst:252 -msgid "" -"Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " -"``k > n``." -msgstr "" - -#: library/math.rst:255 -msgid "" -"If *k* is not specified or is None, then *k* defaults to *n* and the " -"function returns ``n!``." -msgstr "" - -#: library/math.rst:266 -msgid "" -"Calculate the product of all the elements in the input *iterable*. The " -"default *start* value for the product is ``1``." -msgstr "" - -#: library/math.rst:269 -msgid "" -"When the iterable is empty, return the start value. This function is " -"intended specifically for use with numeric values and may reject non-numeric " -"types." -msgstr "" - -#: library/math.rst:278 -msgid "" -"Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " -"*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " -"is the closest integer to the exact value of the quotient ``x / y``. If " -"``x / y`` is exactly halfway between two consecutive integers, the nearest " -"*even* integer is used for ``n``. The remainder ``r = remainder(x, y)`` " -"thus always satisfies ``abs(r) <= 0.5 * abs(y)``." -msgstr "" - -#: library/math.rst:285 -msgid "" -"Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " -"*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " -"x)`` raise :exc:`ValueError` for any non-NaN *x*. If the result of the " -"remainder operation is zero, that zero will have the same sign as *x*." -msgstr "" - -#: library/math.rst:291 -msgid "" -"On platforms using IEEE 754 binary floating-point, the result of this " -"operation is always exactly representable: no rounding error is introduced." -msgstr "" - -#: library/math.rst:299 -msgid "Return the sum of products of values from two iterables *p* and *q*." -msgstr "" - -#: library/math.rst:301 -msgid "Raises :exc:`ValueError` if the inputs do not have the same length." -msgstr "" - -#: library/math.rst:498 -msgid "Roughly equivalent to::" -msgstr "" - -#: library/math.rst:307 -msgid "" -"For float and mixed int/float inputs, the intermediate products and sums are " -"computed with extended precision." -msgstr "" - -#: library/math.rst:315 -msgid "" -"Return *x* with the fractional part removed, leaving the integer part. This " -"rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " -"*x*, and equivalent to :func:`ceil` for negative *x*. If *x* is not a float, " -"delegates to :meth:`x.__trunc__ `, which should return an :" -"class:`~numbers.Integral` value." -msgstr "" - -#: library/math.rst:323 +#: library/math.rst:416 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: library/math.rst:325 +#: library/math.rst:418 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: library/math.rst:326 +#: library/math.rst:419 msgid "If *x* is negative, return ``ulp(-x)``." msgstr "" -#: library/math.rst:327 +#: library/math.rst:420 msgid "If *x* is a positive infinity, return *x*." msgstr "" -#: library/math.rst:328 +#: library/math.rst:421 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: library/math.rst:331 +#: library/math.rst:424 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: library/math.rst:334 +#: library/math.rst:427 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: library/math.rst:338 +#: library/math.rst:431 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: library/math.rst:340 +#: library/math.rst:433 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: library/math.rst:346 -msgid "" -"Note that :func:`frexp` and :func:`modf` have a different call/return " -"pattern than their C equivalents: they take a single argument and return a " -"pair of values, rather than returning their second return value through an " -"'output parameter' (there is no such thing in Python)." -msgstr "" - -#: library/math.rst:351 -msgid "" -"For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " -"*all* floating-point numbers of sufficiently large magnitude are exact " -"integers. Python floats typically carry no more than 53 bits of precision " -"(the same as the platform C double type), in which case any float *x* with " -"``abs(x) >= 2**52`` necessarily has no fractional bits." -msgstr "" - -#: library/math.rst:359 -msgid "Power and logarithmic functions" +#: library/math.rst:440 +msgid "Power, exponential and logarithmic functions" msgstr "" -#: library/math.rst:363 +#: library/math.rst:444 msgid "Return the cube root of *x*." msgstr "" -#: library/math.rst:370 +#: library/math.rst:451 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: library/math.rst:377 +#: library/math.rst:458 msgid "Return *2* raised to the power *x*." msgstr "" -#: library/math.rst:384 +#: library/math.rst:465 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -476,210 +1000,283 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: library/math.rst:401 +#: library/math.rst:482 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: library/math.rst:403 +#: library/math.rst:484 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: library/math.rst:409 +#: library/math.rst:490 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: library/math.rst:415 +#: library/math.rst:496 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: library/math.rst:422 +#: library/math.rst:503 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: library/math.rst:428 +#: library/math.rst:509 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: library/math.rst:434 +#: library/math.rst:515 msgid "" -"Return ``x`` raised to the power ``y``. Exceptional cases follow the IEEE " -"754 standard as far as possible. In particular, ``pow(1.0, x)`` and " -"``pow(x, 0.0)`` always return ``1.0``, even when ``x`` is a zero or a NaN. " -"If both ``x`` and ``y`` are finite, ``x`` is negative, and ``y`` is not an " -"integer then ``pow(x, y)`` is undefined, and raises :exc:`ValueError`." +"Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 " +"standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, " +"0.0)`` always return ``1.0``, even when *x* is a zero or a NaN. If both *x* " +"and *y* are finite, *x* is negative, and *y* is not an integer then ``pow(x, " +"y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: library/math.rst:441 +#: library/math.rst:522 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: library/math.rst:445 +#: library/math.rst:526 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: library/math.rst:453 +#: library/math.rst:534 msgid "Return the square root of *x*." msgstr "" -#: library/math.rst:457 -msgid "Trigonometric functions" +#: library/math.rst:538 +msgid "Summation and product functions" msgstr "" -#: library/math.rst:461 +#: library/math.rst:542 msgid "" -"Return the arc cosine of *x*, in radians. The result is between ``0`` and " -"``pi``." +"Return the Euclidean distance between two points *p* and *q*, each given as " +"a sequence (or iterable) of coordinates. The two points must have the same " +"dimension." msgstr "" -#: library/math.rst:467 -msgid "" -"Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " -"``pi/2``." +#: library/math.rst:607 +msgid "Roughly equivalent to::" msgstr "" -#: library/math.rst:473 -msgid "" -"Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " -"and ``pi/2``." +#: library/math.rst:548 +msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "" -#: library/math.rst:479 +#: library/math.rst:555 msgid "" -"Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " -"``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " -"this angle with the positive X axis. The point of :func:`atan2` is that the " -"signs of both inputs are known to it, so it can compute the correct quadrant " -"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both " -"``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." +"Return an accurate floating-point sum of values in the iterable. Avoids " +"loss of precision by tracking multiple intermediate partial sums." msgstr "" -#: library/math.rst:489 -msgid "Return the cosine of *x* radians." +#: library/math.rst:558 +msgid "" +"The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " +"typical case where the rounding mode is half-even. On some non-Windows " +"builds, the underlying C library uses extended precision addition and may " +"occasionally double-round an intermediate sum causing it to be off in its " +"least significant bit." msgstr "" -#: library/math.rst:494 +#: library/math.rst:564 msgid "" -"Return the Euclidean distance between two points *p* and *q*, each given as " -"a sequence (or iterable) of coordinates. The two points must have the same " -"dimension." +"For further discussion and two alternative approaches, see the `ASPN " +"cookbook recipes for accurate floating-point summation `_\\." msgstr "" -#: library/math.rst:507 +#: library/math.rst:571 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: library/math.rst:511 +#: library/math.rst:575 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: library/math.rst:515 +#: library/math.rst:579 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: library/math.rst:519 +#: library/math.rst:583 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: library/math.rst:527 -msgid "Return the sine of *x* radians." +#: library/math.rst:591 +msgid "" +"Calculate the product of all the elements in the input *iterable*. The " +"default *start* value for the product is ``1``." msgstr "" -#: library/math.rst:532 -msgid "Return the tangent of *x* radians." +#: library/math.rst:594 +msgid "" +"When the iterable is empty, return the start value. This function is " +"intended specifically for use with numeric values and may reject non-numeric " +"types." +msgstr "" + +#: library/math.rst:603 +msgid "Return the sum of products of values from two iterables *p* and *q*." +msgstr "" + +#: library/math.rst:605 +msgid "Raises :exc:`ValueError` if the inputs do not have the same length." +msgstr "" + +#: library/math.rst:609 +msgid "sum(map(operator.mul, p, q, strict=True))" +msgstr "" + +#: library/math.rst:611 +msgid "" +"For float and mixed int/float inputs, the intermediate products and sums are " +"computed with extended precision." msgstr "" -#: library/math.rst:536 +#: library/math.rst:618 msgid "Angular conversion" msgstr "" -#: library/math.rst:540 +#: library/math.rst:622 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: library/math.rst:545 +#: library/math.rst:627 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: library/math.rst:549 +#: library/math.rst:631 +msgid "Trigonometric functions" +msgstr "" + +#: library/math.rst:635 +msgid "" +"Return the arc cosine of *x*, in radians. The result is between ``0`` and " +"``pi``." +msgstr "" + +#: library/math.rst:641 +msgid "" +"Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " +"``pi/2``." +msgstr "" + +#: library/math.rst:647 +msgid "" +"Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " +"and ``pi/2``." +msgstr "" + +#: library/math.rst:653 +msgid "" +"Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " +"``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " +"this angle with the positive X axis. The point of :func:`atan2` is that the " +"signs of both inputs are known to it, so it can compute the correct quadrant " +"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both " +"``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." +msgstr "" + +#: library/math.rst:663 +msgid "Return the cosine of *x* radians." +msgstr "" + +#: library/math.rst:668 +msgid "Return the sine of *x* radians." +msgstr "" + +#: library/math.rst:673 +msgid "Return the tangent of *x* radians." +msgstr "" + +#: library/math.rst:677 msgid "Hyperbolic functions" msgstr "" -#: library/math.rst:551 +#: library/math.rst:679 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: library/math.rst:557 +#: library/math.rst:685 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: library/math.rst:562 +#: library/math.rst:690 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: library/math.rst:567 +#: library/math.rst:695 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: library/math.rst:572 +#: library/math.rst:700 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: library/math.rst:577 +#: library/math.rst:705 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: library/math.rst:582 +#: library/math.rst:710 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: library/math.rst:586 +#: library/math.rst:714 msgid "Special functions" msgstr "" -#: library/math.rst:590 +#: library/math.rst:718 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: library/math.rst:593 +#: library/math.rst:721 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: library/math.rst:606 +#: library/math.rst:725 +msgid "" +"def phi(x):\n" +" 'Cumulative distribution function for the standard normal distribution'\n" +" return (1.0 + erf(x / sqrt(2.0))) / 2.0" +msgstr "" + +#: library/math.rst:734 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -688,46 +1285,46 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: library/math.rst:617 +#: library/math.rst:745 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: library/math.rst:625 +#: library/math.rst:753 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: library/math.rst:632 +#: library/math.rst:760 msgid "Constants" msgstr "" -#: library/math.rst:636 +#: library/math.rst:764 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: library/math.rst:641 +#: library/math.rst:769 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: library/math.rst:646 +#: library/math.rst:774 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " "its radius. To learn more about Tau, check out Vi Hart's video `Pi is " -"(still) Wrong `_, and start " -"celebrating `Tau day `_ by eating twice as much pie!" +"(still) Wrong `_, and start celebrating `Tau " +"day `_ by eating twice as much pie!" msgstr "" -#: library/math.rst:657 +#: library/math.rst:785 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: library/math.rst:665 +#: library/math.rst:793 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/mimetypes.rst:2 -msgid ":mod:`mimetypes` --- Map filenames to MIME types" +msgid ":mod:`!mimetypes` --- Map filenames to MIME types" msgstr "" #: library/mimetypes.rst:9 @@ -73,48 +74,64 @@ msgstr "" msgid "" "The optional *strict* argument is a flag specifying whether the list of " "known MIME types is limited to only the official types `registered with IANA " -"`_. When " -"*strict* is ``True`` (the default), only the IANA types are supported; when " -"*strict* is ``False``, some additional non-standard but commonly used MIME " -"types are also recognized." +"`_. However, " +"the behavior of this module also depends on the underlying operating system. " +"Only file types recognized by the OS or explicitly registered with Python's " +"internal database can be identified. When *strict* is ``True`` (the " +"default), only the IANA types are supported; when *strict* is ``False``, " +"some additional non-standard but commonly used MIME types are also " +"recognized." msgstr "" -#: library/mimetypes.rst:54 -msgid "Added support for url being a :term:`path-like object`." +#: library/mimetypes.rst:56 +msgid "Added support for *url* being a :term:`path-like object`." msgstr "" -#: library/mimetypes.rst:60 +#: library/mimetypes.rst:59 +msgid "" +"Passing a file path instead of URL is :term:`soft deprecated`. Use :func:" +"`guess_file_type` for this." +msgstr "" + +#: library/mimetypes.rst:68 +msgid "" +"Guess the type of a file based on its path, given by *path*. Similar to the :" +"func:`guess_type` function, but accepts a path instead of URL. Path can be a " +"string, a bytes object or a :term:`path-like object`." +msgstr "" + +#: library/mimetypes.rst:77 msgid "" "Guess the extensions for a file based on its MIME type, given by *type*. The " "return value is a list of strings giving all possible filename extensions, " "including the leading dot (``'.'``). The extensions are not guaranteed to " "have been associated with any particular data stream, but would be mapped to " -"the MIME type *type* by :func:`guess_type`." +"the MIME type *type* by :func:`guess_type` and :func:`guess_file_type`." msgstr "" -#: library/mimetypes.rst:78 +#: library/mimetypes.rst:95 msgid "" "The optional *strict* argument has the same meaning as with the :func:" "`guess_type` function." msgstr "" -#: library/mimetypes.rst:71 +#: library/mimetypes.rst:88 msgid "" "Guess the extension for a file based on its MIME type, given by *type*. The " "return value is a string giving a filename extension, including the leading " "dot (``'.'``). The extension is not guaranteed to have been associated with " "any particular data stream, but would be mapped to the MIME type *type* by :" -"func:`guess_type`. If no extension can be guessed for *type*, ``None`` is " -"returned." +"func:`guess_type` and :func:`guess_file_type`. If no extension can be " +"guessed for *type*, ``None`` is returned." msgstr "" -#: library/mimetypes.rst:80 +#: library/mimetypes.rst:97 msgid "" "Some additional functions and data items are available for controlling the " "behavior of the module." msgstr "" -#: library/mimetypes.rst:86 +#: library/mimetypes.rst:103 msgid "" "Initialize the internal data structures. If given, *files* must be a " "sequence of file names which should be used to augment the default type " @@ -124,25 +141,25 @@ msgid "" "Calling :func:`init` repeatedly is allowed." msgstr "" -#: library/mimetypes.rst:93 +#: library/mimetypes.rst:110 msgid "" "Specifying an empty list for *files* will prevent the system defaults from " "being applied: only the well-known values will be present from a built-in " "list." msgstr "" -#: library/mimetypes.rst:96 +#: library/mimetypes.rst:113 msgid "" "If *files* is ``None`` the internal data structure is completely rebuilt to " "its initial default value. This is a stable operation and will produce the " "same results when called multiple times." msgstr "" -#: library/mimetypes.rst:100 +#: library/mimetypes.rst:117 msgid "Previously, Windows registry settings were ignored." msgstr "" -#: library/mimetypes.rst:106 +#: library/mimetypes.rst:123 msgid "" "Load the type map given in the file *filename*, if it exists. The type map " "is returned as a dictionary mapping filename extensions, including the " @@ -150,7 +167,7 @@ msgid "" "file *filename* does not exist or cannot be read, ``None`` is returned." msgstr "" -#: library/mimetypes.rst:114 +#: library/mimetypes.rst:131 msgid "" "Add a mapping from the MIME type *type* to the extension *ext*. When the " "extension is already known, the new type will replace the old one. When the " @@ -158,26 +175,26 @@ msgid "" "extensions." msgstr "" -#: library/mimetypes.rst:118 +#: library/mimetypes.rst:309 msgid "" "When *strict* is ``True`` (the default), the mapping will be added to the " "official MIME types, otherwise to the non-standard ones." msgstr "" -#: library/mimetypes.rst:124 +#: library/mimetypes.rst:141 msgid "" "Flag indicating whether or not the global data structures have been " "initialized. This is set to ``True`` by :func:`init`." msgstr "" -#: library/mimetypes.rst:132 +#: library/mimetypes.rst:149 msgid "" "List of type map file names commonly installed. These files are typically " "named :file:`mime.types` and are installed in different locations by " "different packages." msgstr "" -#: library/mimetypes.rst:139 +#: library/mimetypes.rst:156 msgid "" "Dictionary mapping suffixes to suffixes. This is used to allow recognition " "of encoded files for which the encoding and the type are indicated by the " @@ -185,36 +202,50 @@ msgid "" "`.tar.gz` to allow the encoding and type to be recognized separately." msgstr "" -#: library/mimetypes.rst:147 +#: library/mimetypes.rst:164 msgid "Dictionary mapping filename extensions to encoding types." msgstr "" -#: library/mimetypes.rst:152 +#: library/mimetypes.rst:169 msgid "Dictionary mapping filename extensions to MIME types." msgstr "" -#: library/mimetypes.rst:157 +#: library/mimetypes.rst:174 msgid "" "Dictionary mapping filename extensions to non-standard, but commonly found " "MIME types." msgstr "" -#: library/mimetypes.rst:161 +#: library/mimetypes.rst:178 msgid "An example usage of the module::" msgstr "" -#: library/mimetypes.rst:178 -msgid "MimeTypes Objects" +#: library/mimetypes.rst:180 +msgid "" +">>> import mimetypes\n" +">>> mimetypes.init()\n" +">>> mimetypes.knownfiles\n" +"['/etc/mime.types', '/etc/httpd/mime.types', ... ]\n" +">>> mimetypes.suffix_map['.tgz']\n" +"'.tar.gz'\n" +">>> mimetypes.encodings_map['.gz']\n" +"'gzip'\n" +">>> mimetypes.types_map['.tgz']\n" +"'application/x-tar-gz'" msgstr "" -#: library/mimetypes.rst:180 +#: library/mimetypes.rst:195 +msgid "MimeTypes objects" +msgstr "" + +#: library/mimetypes.rst:197 msgid "" "The :class:`MimeTypes` class may be useful for applications which may want " "more than one MIME-type database; it provides an interface similar to the " "one of the :mod:`mimetypes` module." msgstr "" -#: library/mimetypes.rst:187 +#: library/mimetypes.rst:204 msgid "" "This class represents a MIME-types database. By default, it provides access " "to the same database as the rest of this module. The initial database is a " @@ -224,13 +255,13 @@ msgid "" "cleared before loading additional data if the default data is not desired." msgstr "" -#: library/mimetypes.rst:194 +#: library/mimetypes.rst:211 msgid "" "The optional *filenames* parameter can be used to cause additional files to " "be loaded \"on top\" of the default database." msgstr "" -#: library/mimetypes.rst:200 +#: library/mimetypes.rst:217 msgid "" "Dictionary mapping suffixes to suffixes. This is used to allow recognition " "of encoded files for which the encoding and the type are indicated by the " @@ -239,13 +270,13 @@ msgid "" "is initially a copy of the global :data:`suffix_map` defined in the module." msgstr "" -#: library/mimetypes.rst:209 +#: library/mimetypes.rst:226 msgid "" "Dictionary mapping filename extensions to encoding types. This is initially " "a copy of the global :data:`encodings_map` defined in the module." msgstr "" -#: library/mimetypes.rst:215 +#: library/mimetypes.rst:232 msgid "" "Tuple containing two dictionaries, mapping filename extensions to MIME " "types: the first dictionary is for the non-standards types and the second " @@ -253,7 +284,7 @@ msgid "" "and :data:`types_map`." msgstr "" -#: library/mimetypes.rst:223 +#: library/mimetypes.rst:240 msgid "" "Tuple containing two dictionaries, mapping MIME types to a list of filename " "extensions: the first dictionary is for the non-standards types and the " @@ -261,57 +292,177 @@ msgid "" "`common_types` and :data:`types_map`." msgstr "" -#: library/mimetypes.rst:231 +#: library/mimetypes.rst:248 msgid "" "Similar to the :func:`guess_extension` function, using the tables stored as " "part of the object." msgstr "" -#: library/mimetypes.rst:237 +#: library/mimetypes.rst:254 msgid "" "Similar to the :func:`guess_type` function, using the tables stored as part " "of the object." msgstr "" -#: library/mimetypes.rst:243 +#: library/mimetypes.rst:260 +msgid "" +"Similar to the :func:`guess_file_type` function, using the tables stored as " +"part of the object." +msgstr "" + +#: library/mimetypes.rst:268 msgid "" "Similar to the :func:`guess_all_extensions` function, using the tables " "stored as part of the object." msgstr "" -#: library/mimetypes.rst:249 +#: library/mimetypes.rst:274 msgid "" "Load MIME information from a file named *filename*. This uses :meth:" "`readfp` to parse the file." msgstr "" -#: library/mimetypes.rst:252 +#: library/mimetypes.rst:277 msgid "" "If *strict* is ``True``, information will be added to list of standard " "types, else to the list of non-standard types." msgstr "" -#: library/mimetypes.rst:258 +#: library/mimetypes.rst:283 msgid "" "Load MIME type information from an open file *fp*. The file must have the " "format of the standard :file:`mime.types` files." msgstr "" -#: library/mimetypes.rst:271 +#: library/mimetypes.rst:296 msgid "" "If *strict* is ``True``, information will be added to the list of standard " "types, else to the list of non-standard types." msgstr "" -#: library/mimetypes.rst:267 +#: library/mimetypes.rst:292 msgid "Load MIME type information from the Windows registry." msgstr "" -#: library/mimetypes.rst:269 -msgid ":ref:`Availability `: Windows." +#: library/mimetypes.rst:294 +msgid "Availability" +msgstr "" + +#: library/mimetypes.rst:304 +msgid "" +"Add a mapping from the MIME type *type* to the extension *ext*. Valid " +"extensions start with a '.' or are empty. When the extension is already " +"known, the new type will replace the old one. When the type is already known " +"the extension will be added to the list of known extensions." +msgstr "" + +#: library/mimetypes.rst:312 +msgid "" +"Invalid, undotted extensions will raise a :exc:`ValueError` in Python 3.16." msgstr "" -#: library/mimetypes.rst:31 +#: library/mimetypes.rst:320 +msgid "Command-line usage" +msgstr "" + +#: library/mimetypes.rst:322 +msgid "" +"The :mod:`!mimetypes` module can be executed as a script from the command " +"line." +msgstr "" + +#: library/mimetypes.rst:324 +msgid "python -m mimetypes [-h] [-e] [-l] type [type ...]" +msgstr "" + +#: library/mimetypes.rst:328 +msgid "The following options are accepted:" +msgstr "" + +#: library/mimetypes.rst:335 +msgid "Show the help message and exit." +msgstr "" + +#: library/mimetypes.rst:340 +msgid "Guess extension instead of type." +msgstr "" + +#: library/mimetypes.rst:345 +msgid "Additionally search for some common, but non-standard types." +msgstr "" + +#: library/mimetypes.rst:347 +msgid "" +"By default the script converts MIME types to file extensions. However, if " +"``--extension`` is specified, it converts file extensions to MIME types." +msgstr "" + +#: library/mimetypes.rst:351 +msgid "" +"For each ``type`` entry, the script writes a line into the standard output " +"stream. If an unknown type occurs, it writes an error message into the " +"standard error stream and exits with the return code ``1``." +msgstr "" + +#: library/mimetypes.rst:359 +msgid "Command-line example" +msgstr "" + +#: library/mimetypes.rst:361 +msgid "" +"Here are some examples of typical usage of the :mod:`!mimetypes` command-" +"line interface:" +msgstr "" + +#: library/mimetypes.rst:364 +msgid "" +"$ # get a MIME type by a file name\n" +"$ python -m mimetypes filename.png\n" +"type: image/png encoding: None\n" +"\n" +"$ # get a MIME type by a URL\n" +"$ python -m mimetypes https://example.com/filename.txt\n" +"type: text/plain encoding: None\n" +"\n" +"$ # get a complex MIME type\n" +"$ python -m mimetypes filename.tar.gz\n" +"type: application/x-tar encoding: gzip\n" +"\n" +"$ # get a MIME type for a rare file extension\n" +"$ python -m mimetypes filename.pict\n" +"error: unknown extension of filename.pict\n" +"\n" +"$ # now look in the extended database built into Python\n" +"$ python -m mimetypes --lenient filename.pict\n" +"type: image/pict encoding: None\n" +"\n" +"$ # get a file extension by a MIME type\n" +"$ python -m mimetypes --extension text/javascript\n" +".js\n" +"\n" +"$ # get a file extension by a rare MIME type\n" +"$ python -m mimetypes --extension text/xul\n" +"error: unknown type text/xul\n" +"\n" +"$ # now look in the extended database again\n" +"$ python -m mimetypes --extension --lenient text/xul\n" +".xul\n" +"\n" +"$ # try to feed an unknown file extension\n" +"$ python -m mimetypes filename.sh filename.nc filename.xxx filename.txt\n" +"type: application/x-sh encoding: None\n" +"type: application/x-netcdf encoding: None\n" +"error: unknown extension of filename.xxx\n" +"\n" +"$ # try to feed an unknown MIME type\n" +"$ python -m mimetypes --extension audio/aac audio/opus audio/future audio/x-" +"wav\n" +".aac\n" +".opus\n" +"error: unknown type audio/future" +msgstr "" + +#: library/mimetypes.rst:31 library/mimetypes.rst:66 msgid "MIME" msgstr "" @@ -319,14 +470,14 @@ msgstr "" msgid "content type" msgstr "" -#: library/mimetypes.rst:31 +#: library/mimetypes.rst:66 msgid "headers" msgstr "" -#: library/mimetypes.rst:130 +#: library/mimetypes.rst:147 msgid "file" msgstr "" -#: library/mimetypes.rst:130 +#: library/mimetypes.rst:147 msgid "mime.types" msgstr "" diff --git a/library/mm.po b/library/mm.po index 57a58421..3256e2b5 100644 --- a/library/mm.po +++ b/library/mm.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/mmap.po b/library/mmap.po index e74e8def..3b56d7c4 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -8,27 +8,27 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/mmap.rst:2 -msgid ":mod:`mmap` --- Memory-mapped file support" +msgid ":mod:`!mmap` --- Memory-mapped file support" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/mmap.rst:11 @@ -123,7 +123,7 @@ msgid "" "``fileno``, ``length``, ``access``, ``offset``." msgstr "" -#: library/mmap.rst:77 +#: library/mmap.rst:78 msgid "" "**(Unix version)** Maps *length* bytes from the file specified by the file " "descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the " @@ -131,7 +131,7 @@ msgid "" "`~mmap.mmap` is called." msgstr "" -#: library/mmap.rst:82 +#: library/mmap.rst:83 msgid "" "*flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a " "private copy-on-write mapping, so changes to the contents of the mmap object " @@ -142,7 +142,7 @@ msgid "" "constants>`." msgstr "" -#: library/mmap.rst:90 +#: library/mmap.rst:91 msgid "" "*prot*, if specified, gives the desired memory protection; the two most " "useful values are :const:`PROT_READ` and :const:`PROT_WRITE`, to specify " @@ -150,7 +150,7 @@ msgid "" "\\| PROT_WRITE`." msgstr "" -#: library/mmap.rst:95 +#: library/mmap.rst:96 msgid "" "*access* may be specified in lieu of *flags* and *prot* as an optional " "keyword parameter. It is an error to specify both *flags*, *prot* and " @@ -158,7 +158,7 @@ msgid "" "use this parameter." msgstr "" -#: library/mmap.rst:100 +#: library/mmap.rst:101 msgid "" "*offset* may be specified as a non-negative integer offset. mmap references " "will be relative to the offset from the beginning of the file. *offset* " @@ -166,48 +166,111 @@ msgid "" "which is equal to :const:`PAGESIZE` on Unix systems." msgstr "" -#: library/mmap.rst:105 +#: library/mmap.rst:106 +msgid "" +"If *trackfd* is ``False``, the file descriptor specified by *fileno* will " +"not be duplicated, and the resulting :class:`!mmap` object will not be " +"associated with the map's underlying file. This means that the :meth:`~mmap." +"mmap.size` and :meth:`~mmap.mmap.resize` methods will fail. This mode is " +"useful to limit the number of open file descriptors." +msgstr "" + +#: library/mmap.rst:113 msgid "" "To ensure validity of the created memory mapping the file specified by the " "descriptor *fileno* is internally automatically synchronized with the " "physical backing store on macOS." msgstr "" -#: library/mmap.rst:109 +#: library/mmap.rst:117 +msgid "The *trackfd* parameter was added." +msgstr "" + +#: library/mmap.rst:120 msgid "This example shows a simple way of using :class:`~mmap.mmap`::" msgstr "" -#: library/mmap.rst:134 +#: library/mmap.rst:122 +msgid "" +"import mmap\n" +"\n" +"# write a simple example file\n" +"with open(\"hello.txt\", \"wb\") as f:\n" +" f.write(b\"Hello Python!\\n\")\n" +"\n" +"with open(\"hello.txt\", \"r+b\") as f:\n" +" # memory-map the file, size 0 means whole file\n" +" mm = mmap.mmap(f.fileno(), 0)\n" +" # read content via standard file methods\n" +" print(mm.readline()) # prints b\"Hello Python!\\n\"\n" +" # read content via slice notation\n" +" print(mm[:5]) # prints b\"Hello\"\n" +" # update content using slice notation;\n" +" # note that new content must have same size\n" +" mm[6:] = b\" world!\\n\"\n" +" # ... and read again using standard file methods\n" +" mm.seek(0)\n" +" print(mm.readline()) # prints b\"Hello world!\\n\"\n" +" # close the map\n" +" mm.close()" +msgstr "" + +#: library/mmap.rst:145 msgid "" ":class:`~mmap.mmap` can also be used as a context manager in a :keyword:" "`with` statement::" msgstr "" -#: library/mmap.rst:142 +#: library/mmap.rst:148 +msgid "" +"import mmap\n" +"\n" +"with mmap.mmap(-1, 13) as mm:\n" +" mm.write(b\"Hello world!\")" +msgstr "" + +#: library/mmap.rst:153 msgid "Context manager support." msgstr "" -#: library/mmap.rst:146 +#: library/mmap.rst:157 msgid "" "The next example demonstrates how to create an anonymous map and exchange " "data between the parent and child processes::" msgstr "" -#: library/mmap.rst:165 +#: library/mmap.rst:160 +msgid "" +"import mmap\n" +"import os\n" +"\n" +"mm = mmap.mmap(-1, 13)\n" +"mm.write(b\"Hello world!\")\n" +"\n" +"pid = os.fork()\n" +"\n" +"if pid == 0: # In a child process\n" +" mm.seek(0)\n" +" print(mm.readline())\n" +"\n" +" mm.close()" +msgstr "" + +#: library/mmap.rst:176 msgid "Memory-mapped file objects support the following methods:" msgstr "" -#: library/mmap.rst:169 +#: library/mmap.rst:180 msgid "" "Closes the mmap. Subsequent calls to other methods of the object will result " "in a ValueError exception being raised. This will not close the open file." msgstr "" -#: library/mmap.rst:176 +#: library/mmap.rst:187 msgid "``True`` if the file is closed." msgstr "" -#: library/mmap.rst:183 +#: library/mmap.rst:194 msgid "" "Returns the lowest index in the object where the subsequence *sub* is found, " "such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -215,11 +278,11 @@ msgid "" "``-1`` on failure." msgstr "" -#: library/mmap.rst:277 library/mmap.rst:309 +#: library/mmap.rst:292 library/mmap.rst:332 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" -#: library/mmap.rst:194 +#: library/mmap.rst:206 msgid "" "Flushes changes made to the in-memory copy of a file back to disk. Without " "use of this call there is no guarantee that changes are written back before " @@ -229,20 +292,20 @@ msgid "" "`PAGESIZE` or :const:`ALLOCATIONGRANULARITY`." msgstr "" -#: library/mmap.rst:201 +#: library/mmap.rst:213 msgid "" "``None`` is returned to indicate success. An exception is raised when the " "call failed." msgstr "" -#: library/mmap.rst:204 +#: library/mmap.rst:216 msgid "" "Previously, a nonzero value was returned on success; zero was returned on " "error under Windows. A zero value was returned on success; an exception was " "raised on error under Unix." msgstr "" -#: library/mmap.rst:212 +#: library/mmap.rst:224 msgid "" "Send advice *option* to the kernel about the memory region beginning at " "*start* and extending *length* bytes. *option* must be one of the :ref:" @@ -251,18 +314,18 @@ msgid "" "(including Linux), *start* must be a multiple of the :const:`PAGESIZE`." msgstr "" -#: library/mmap.rst:219 +#: library/mmap.rst:231 msgid "Availability: Systems with the ``madvise()`` system call." msgstr "" -#: library/mmap.rst:226 +#: library/mmap.rst:238 msgid "" "Copy the *count* bytes starting at offset *src* to the destination index " "*dest*. If the mmap was created with :const:`ACCESS_READ`, then calls to " "move will raise a :exc:`TypeError` exception." msgstr "" -#: library/mmap.rst:233 +#: library/mmap.rst:245 msgid "" "Return a :class:`bytes` containing up to *n* bytes starting from the current " "file position. If the argument is omitted, ``None`` or negative, return all " @@ -270,31 +333,36 @@ msgid "" "position is updated to point after the bytes that were returned." msgstr "" -#: library/mmap.rst:239 +#: library/mmap.rst:251 msgid "Argument can be omitted or ``None``." msgstr "" -#: library/mmap.rst:244 +#: library/mmap.rst:256 msgid "" "Returns a byte at the current file position as an integer, and advances the " "file position by 1." msgstr "" -#: library/mmap.rst:250 +#: library/mmap.rst:262 msgid "" "Returns a single line, starting at the current file position and up to the " "next newline. The file position is updated to point after the bytes that " "were returned." msgstr "" -#: library/mmap.rst:257 +#: library/mmap.rst:269 +msgid "Resizes the map and the underlying file, if any." +msgstr "" + +#: library/mmap.rst:271 msgid "" -"Resizes the map and the underlying file, if any. If the mmap was created " -"with :const:`ACCESS_READ` or :const:`ACCESS_COPY`, resizing the map will " -"raise a :exc:`TypeError` exception." +"Resizing a map created with *access* of :const:`ACCESS_READ` or :const:" +"`ACCESS_COPY`, will raise a :exc:`TypeError` exception. Resizing a map " +"created with *trackfd* set to ``False``, will raise a :exc:`ValueError` " +"exception." msgstr "" -#: library/mmap.rst:261 +#: library/mmap.rst:276 msgid "" "**On Windows**: Resizing the map will raise an :exc:`OSError` if there are " "other maps against the same named file. Resizing an anonymous map (ie " @@ -302,13 +370,13 @@ msgid "" "copied over up to the length of the new size." msgstr "" -#: library/mmap.rst:266 +#: library/mmap.rst:281 msgid "" "Correctly fails if attempting to resize when another map is held Allows " "resize against an anonymous map on Windows" msgstr "" -#: library/mmap.rst:272 +#: library/mmap.rst:287 msgid "" "Returns the highest index in the object where the subsequence *sub* is " "found, such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -316,7 +384,7 @@ msgid "" "``-1`` on failure." msgstr "" -#: library/mmap.rst:283 +#: library/mmap.rst:298 msgid "" "Set the file's current position. *whence* argument is optional and defaults " "to ``os.SEEK_SET`` or ``0`` (absolute file positioning); other values are " @@ -324,17 +392,27 @@ msgid "" "SEEK_END`` or ``2`` (seek relative to the file's end)." msgstr "" -#: library/mmap.rst:291 +#: library/mmap.rst:303 +msgid "Return the new absolute position instead of ``None``." +msgstr "" + +#: library/mmap.rst:308 +msgid "" +"Return whether the file supports seeking, and the return value is always " +"``True``." +msgstr "" + +#: library/mmap.rst:314 msgid "" "Return the length of the file, which can be larger than the size of the " "memory-mapped area." msgstr "" -#: library/mmap.rst:297 +#: library/mmap.rst:320 msgid "Returns the current position of the file pointer." msgstr "" -#: library/mmap.rst:302 +#: library/mmap.rst:325 msgid "" "Write the bytes in *bytes* into memory at the current position of the file " "pointer and return the number of bytes written (never less than " @@ -344,11 +422,11 @@ msgid "" "it will raise a :exc:`TypeError` exception." msgstr "" -#: library/mmap.rst:312 +#: library/mmap.rst:335 msgid "The number of bytes written is now returned." msgstr "" -#: library/mmap.rst:318 +#: library/mmap.rst:341 msgid "" "Write the integer *byte* into memory at the current position of the file " "pointer; the file position is advanced by ``1``. If the mmap was created " @@ -356,25 +434,25 @@ msgid "" "exception." msgstr "" -#: library/mmap.rst:326 +#: library/mmap.rst:349 msgid "MADV_* Constants" msgstr "" -#: library/mmap.rst:353 +#: library/mmap.rst:376 msgid "" "These options can be passed to :meth:`mmap.madvise`. Not every option will " "be present on every system." msgstr "" -#: library/mmap.rst:356 +#: library/mmap.rst:379 msgid "Availability: Systems with the madvise() system call." msgstr "" -#: library/mmap.rst:363 +#: library/mmap.rst:386 msgid "MAP_* Constants" msgstr "" -#: library/mmap.rst:376 +#: library/mmap.rst:410 msgid "" "These are the various flags that can be passed to :meth:`mmap.mmap`. :data:" "`MAP_ALIGNED_SUPER` is only available at FreeBSD and :data:`MAP_CONCEAL` is " @@ -382,15 +460,22 @@ msgid "" "some systems." msgstr "" -#: library/mmap.rst:380 +#: library/mmap.rst:414 msgid "Added :data:`MAP_POPULATE` constant." msgstr "" -#: library/mmap.rst:383 +#: library/mmap.rst:417 msgid "Added :data:`MAP_STACK` constant." msgstr "" -#: library/mmap.rst:386 +#: library/mmap.rst:420 +msgid "Added :data:`MAP_ALIGNED_SUPER` and :data:`MAP_CONCEAL` constants." +msgstr "" + +#: library/mmap.rst:423 msgid "" -"Added :data:`MAP_ALIGNED_SUPER` constant. Added :data:`MAP_CONCEAL` constant." +"Added :data:`MAP_32BIT`, :data:`MAP_HASSEMAPHORE`, :data:`MAP_JIT`, :data:" +"`MAP_NOCACHE`, :data:`MAP_NOEXTEND`, :data:`MAP_NORESERVE`, :data:" +"`MAP_RESILIENT_CODESIGN`, :data:`MAP_RESILIENT_MEDIA`, :data:`MAP_TPRO`, :" +"data:`MAP_TRANSLATED_ALLOW_EXECUTE`, and :data:`MAP_UNIX03` constants." msgstr "" diff --git a/library/modulefinder.po b/library/modulefinder.po index d5426a66..5b4cf933 100644 --- a/library/modulefinder.po +++ b/library/modulefinder.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/modulefinder.rst:2 -msgid ":mod:`modulefinder` --- Find modules used by a script" +msgid ":mod:`!modulefinder` --- Find modules used by a script" msgstr "" #: library/modulefinder.rst:9 @@ -81,10 +82,63 @@ msgstr "" msgid "The script that is going to get analyzed later on (bacon.py)::" msgstr "" +#: library/modulefinder.rst:65 +msgid "" +"import re, itertools\n" +"\n" +"try:\n" +" import baconhameggs\n" +"except ImportError:\n" +" pass\n" +"\n" +"try:\n" +" import guido.python.ham\n" +"except ImportError:\n" +" pass" +msgstr "" + #: library/modulefinder.rst:78 msgid "The script that will output the report of bacon.py::" msgstr "" +#: library/modulefinder.rst:80 +msgid "" +"from modulefinder import ModuleFinder\n" +"\n" +"finder = ModuleFinder()\n" +"finder.run_script('bacon.py')\n" +"\n" +"print('Loaded modules:')\n" +"for name, mod in finder.modules.items():\n" +" print('%s: ' % name, end='')\n" +" print(','.join(list(mod.globalnames.keys())[:3]))\n" +"\n" +"print('-'*50)\n" +"print('Modules not imported:')\n" +"print('\\n'.join(finder.badmodules.keys()))" +msgstr "" + #: library/modulefinder.rst:94 msgid "Sample output (may vary depending on the architecture)::" msgstr "" + +#: library/modulefinder.rst:96 +msgid "" +"Loaded modules:\n" +"_types:\n" +"copyreg: _inverted_registry,_slotnames,__all__\n" +"re._compiler: isstring,_sre,_optimize_unicode\n" +"_sre:\n" +"re._constants: REPEAT_ONE,makedict,AT_END_LINE\n" +"sys:\n" +"re: __module__,finditer,_expand\n" +"itertools:\n" +"__main__: re,itertools,baconhameggs\n" +"re._parser: _PATTERNENDERS,SRE_FLAG_UNICODE\n" +"array:\n" +"types: __module__,IntType,TypeType\n" +"---------------------------------------------------\n" +"Modules not imported:\n" +"guido.python.ham\n" +"baconhameggs" +msgstr "" diff --git a/library/modules.po b/library/modules.po index df650031..3786884d 100644 --- a/library/modules.po +++ b/library/modules.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/msilib.po b/library/msilib.po index bdf401c7..dcfcd438 100644 --- a/library/msilib.po +++ b/library/msilib.po @@ -8,612 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/msilib.rst:2 -msgid ":mod:`msilib` --- Read and write Microsoft Installer files" +msgid ":mod:`!msilib` --- Read and write Microsoft Installer files" msgstr "" -#: library/msilib.rst:12 -msgid "**Source code:** :source:`Lib/msilib/__init__.py`" -msgstr "" - -#: library/msilib.rst:19 -msgid "" -"The :mod:`msilib` module is deprecated (see :pep:`PEP 594 <594#msilib>` for " -"details)." -msgstr "" - -#: library/msilib.rst:22 -msgid "" -"The :mod:`msilib` supports the creation of Microsoft Installer (``.msi``) " -"files. Because these files often contain an embedded \"cabinet\" file (``." -"cab``), it also exposes an API to create CAB files. Support for reading ``." -"cab`` files is currently not implemented; read support for the ``.msi`` " -"database is possible." -msgstr "" - -#: library/msilib.rst:27 -msgid "" -"This package aims to provide complete access to all tables in an ``.msi`` " -"file, therefore, it is a fairly low-level API. One primary application of " -"this package is the creation of Python installer package itself (although " -"that currently uses a different version of ``msilib``)." -msgstr "" - -#: library/msilib.rst:32 -msgid "" -"The package contents can be roughly split into four parts: low-level CAB " -"routines, low-level MSI routines, higher-level MSI routines, and standard " -"table structures." -msgstr "" - -#: library/msilib.rst:39 -msgid "" -"Create a new CAB file named *cabname*. *files* must be a list of tuples, " -"each containing the name of the file on disk, and the name of the file " -"inside the CAB file." -msgstr "" - -#: library/msilib.rst:43 -msgid "" -"The files are added to the CAB file in the order they appear in the list. " -"All files are added into a single CAB file, using the MSZIP compression " -"algorithm." -msgstr "" - -#: library/msilib.rst:46 -msgid "" -"Callbacks to Python for the various steps of MSI creation are currently not " -"exposed." -msgstr "" - -#: library/msilib.rst:52 -msgid "" -"Return the string representation of a new unique identifier. This wraps the " -"Windows API functions :c:func:`UuidCreate` and :c:func:`UuidToString`." -msgstr "" - -#: library/msilib.rst:58 -msgid "" -"Return a new database object by calling MsiOpenDatabase. *path* is the " -"file name of the MSI file; *persist* can be one of the constants " -"``MSIDBOPEN_CREATEDIRECT``, ``MSIDBOPEN_CREATE``, ``MSIDBOPEN_DIRECT``, " -"``MSIDBOPEN_READONLY``, or ``MSIDBOPEN_TRANSACT``, and may include the flag " -"``MSIDBOPEN_PATCHFILE``. See the Microsoft documentation for the meaning of " -"these flags; depending on the flags, an existing database is opened, or a " -"new one created." -msgstr "" - -#: library/msilib.rst:69 -msgid "" -"Return a new record object by calling :c:func:`MSICreateRecord`. *count* is " -"the number of fields of the record." -msgstr "" - -#: library/msilib.rst:75 -msgid "" -"Create and return a new database *name*, initialize it with *schema*, and " -"set the properties *ProductName*, *ProductCode*, *ProductVersion*, and " -"*Manufacturer*." -msgstr "" - -#: library/msilib.rst:79 -msgid "" -"*schema* must be a module object containing ``tables`` and " -"``_Validation_records`` attributes; typically, :mod:`msilib.schema` should " -"be used." -msgstr "" - -#: library/msilib.rst:83 -msgid "" -"The database will contain just the schema and the validation records when " -"this function returns." -msgstr "" - -#: library/msilib.rst:89 -msgid "Add all *records* to the table named *table* in *database*." -msgstr "" - -#: library/msilib.rst:91 -msgid "" -"The *table* argument must be one of the predefined tables in the MSI schema, " -"e.g. ``'Feature'``, ``'File'``, ``'Component'``, ``'Dialog'``, " -"``'Control'``, etc." -msgstr "" - -#: library/msilib.rst:95 -msgid "" -"*records* should be a list of tuples, each one containing all fields of a " -"record according to the schema of the table. For optional fields, ``None`` " -"can be passed." -msgstr "" - -#: library/msilib.rst:99 -msgid "Field values can be ints, strings, or instances of the Binary class." -msgstr "" - -#: library/msilib.rst:104 -msgid "" -"Represents entries in the Binary table; inserting such an object using :func:" -"`add_data` reads the file named *filename* into the table." -msgstr "" - -#: library/msilib.rst:110 -msgid "" -"Add all table content from *module* to *database*. *module* must contain an " -"attribute *tables* listing all tables for which content should be added, and " -"one attribute per table that has the actual content." -msgstr "" - -#: library/msilib.rst:114 -msgid "This is typically used to install the sequence tables." -msgstr "" - -#: library/msilib.rst:119 -msgid "" -"Add the file *path* into the ``_Stream`` table of *database*, with the " -"stream name *name*." -msgstr "" - -#: library/msilib.rst:125 -msgid "" -"Return a new UUID, in the format that MSI typically requires (i.e. in curly " -"braces, and with all hexdigits in uppercase)." -msgstr "" - -#: library/msilib.rst:131 -msgid "" -"`FCICreate `_ " -"`UuidCreate `_ `UuidToString `_" -msgstr "" - -#: library/msilib.rst:138 -msgid "Database Objects" -msgstr "" - -#: library/msilib.rst:143 -msgid "" -"Return a view object, by calling :c:func:`MSIDatabaseOpenView`. *sql* is the " -"SQL statement to execute." -msgstr "" - -#: library/msilib.rst:149 -msgid "" -"Commit the changes pending in the current transaction, by calling :c:func:" -"`MSIDatabaseCommit`." -msgstr "" - -#: library/msilib.rst:155 -msgid "" -"Return a new summary information object, by calling :c:func:" -"`MsiGetSummaryInformation`. *count* is the maximum number of updated values." -msgstr "" - -#: library/msilib.rst:161 -msgid "Close the database object, through :c:func:`MsiCloseHandle`." -msgstr "" - -#: library/msilib.rst:167 -msgid "" -"`MSIDatabaseOpenView `_ `MSIDatabaseCommit `_ `MSIGetSummaryInformation " -"`_ " -"`MsiCloseHandle `_" -msgstr "" - -#: library/msilib.rst:175 -msgid "View Objects" -msgstr "" - -#: library/msilib.rst:180 -msgid "" -"Execute the SQL query of the view, through :c:func:`MSIViewExecute`. If " -"*params* is not ``None``, it is a record describing actual values of the " -"parameter tokens in the query." -msgstr "" - -#: library/msilib.rst:187 -msgid "" -"Return a record describing the columns of the view, through calling :c:func:" -"`MsiViewGetColumnInfo`. *kind* can be either ``MSICOLINFO_NAMES`` or " -"``MSICOLINFO_TYPES``." -msgstr "" - -#: library/msilib.rst:194 -msgid "" -"Return a result record of the query, through calling :c:func:`MsiViewFetch`." -msgstr "" - -#: library/msilib.rst:199 -msgid "" -"Modify the view, by calling :c:func:`MsiViewModify`. *kind* can be one of " -"``MSIMODIFY_SEEK``, ``MSIMODIFY_REFRESH``, ``MSIMODIFY_INSERT``, " -"``MSIMODIFY_UPDATE``, ``MSIMODIFY_ASSIGN``, ``MSIMODIFY_REPLACE``, " -"``MSIMODIFY_MERGE``, ``MSIMODIFY_DELETE``, ``MSIMODIFY_INSERT_TEMPORARY``, " -"``MSIMODIFY_VALIDATE``, ``MSIMODIFY_VALIDATE_NEW``, " -"``MSIMODIFY_VALIDATE_FIELD``, or ``MSIMODIFY_VALIDATE_DELETE``." -msgstr "" - -#: library/msilib.rst:206 -msgid "*data* must be a record describing the new data." -msgstr "" - -#: library/msilib.rst:211 -msgid "Close the view, through :c:func:`MsiViewClose`." -msgstr "" - -#: library/msilib.rst:216 -msgid "" -"`MsiViewExecute `_ `MSIViewGetColumnInfo `_ `MsiViewFetch `_ `MsiViewModify " -"`_ " -"`MsiViewClose `_" -msgstr "" - -#: library/msilib.rst:225 -msgid "Summary Information Objects" -msgstr "" - -#: library/msilib.rst:230 -msgid "" -"Return a property of the summary, through :c:func:" -"`MsiSummaryInfoGetProperty`. *field* is the name of the property, and can be " -"one of the constants ``PID_CODEPAGE``, ``PID_TITLE``, ``PID_SUBJECT``, " -"``PID_AUTHOR``, ``PID_KEYWORDS``, ``PID_COMMENTS``, ``PID_TEMPLATE``, " -"``PID_LASTAUTHOR``, ``PID_REVNUMBER``, ``PID_LASTPRINTED``, " -"``PID_CREATE_DTM``, ``PID_LASTSAVE_DTM``, ``PID_PAGECOUNT``, " -"``PID_WORDCOUNT``, ``PID_CHARCOUNT``, ``PID_APPNAME``, or ``PID_SECURITY``." -msgstr "" - -#: library/msilib.rst:241 -msgid "" -"Return the number of summary properties, through :c:func:" -"`MsiSummaryInfoGetPropertyCount`." -msgstr "" - -#: library/msilib.rst:247 -msgid "" -"Set a property through :c:func:`MsiSummaryInfoSetProperty`. *field* can have " -"the same values as in :meth:`GetProperty`, *value* is the new value of the " -"property. Possible value types are integer and string." -msgstr "" - -#: library/msilib.rst:254 -msgid "" -"Write the modified properties to the summary information stream, using :c:" -"func:`MsiSummaryInfoPersist`." -msgstr "" - -#: library/msilib.rst:260 -msgid "" -"`MsiSummaryInfoGetProperty `_ `MsiSummaryInfoGetPropertyCount `_ " -"`MsiSummaryInfoSetProperty `_ `MsiSummaryInfoPersist `_" -msgstr "" - -#: library/msilib.rst:268 -msgid "Record Objects" -msgstr "" - -#: library/msilib.rst:273 +#: library/msilib.rst:10 msgid "" -"Return the number of fields of the record, through :c:func:" -"`MsiRecordGetFieldCount`." -msgstr "" - -#: library/msilib.rst:279 -msgid "" -"Return the value of *field* as an integer where possible. *field* must be " -"an integer." -msgstr "" - -#: library/msilib.rst:285 -msgid "" -"Return the value of *field* as a string where possible. *field* must be an " -"integer." -msgstr "" - -#: library/msilib.rst:291 -msgid "" -"Set *field* to *value* through :c:func:`MsiRecordSetString`. *field* must be " -"an integer; *value* a string." -msgstr "" - -#: library/msilib.rst:297 -msgid "" -"Set *field* to the contents of the file named *value*, through :c:func:" -"`MsiRecordSetStream`. *field* must be an integer; *value* a string." -msgstr "" - -#: library/msilib.rst:303 -msgid "" -"Set *field* to *value* through :c:func:`MsiRecordSetInteger`. Both *field* " -"and *value* must be an integer." -msgstr "" - -#: library/msilib.rst:309 -msgid "" -"Set all fields of the record to 0, through :c:func:`MsiRecordClearData`." -msgstr "" - -#: library/msilib.rst:314 -msgid "" -"`MsiRecordGetFieldCount `_ `MsiRecordSetString `_ `MsiRecordSetStream `_ " -"`MsiRecordSetInteger `_ `MsiRecordClearData `_" -msgstr "" - -#: library/msilib.rst:323 -msgid "Errors" -msgstr "" - -#: library/msilib.rst:325 -msgid "" -"All wrappers around MSI functions raise :exc:`MSIError`; the string inside " -"the exception will contain more detail." -msgstr "" - -#: library/msilib.rst:332 -msgid "CAB Objects" -msgstr "" - -#: library/msilib.rst:337 -msgid "" -"The class :class:`CAB` represents a CAB file. During MSI construction, files " -"will be added simultaneously to the ``Files`` table, and to a CAB file. " -"Then, when all files have been added, the CAB file can be written, then " -"added to the MSI file." -msgstr "" - -#: library/msilib.rst:342 -msgid "*name* is the name of the CAB file in the MSI file." -msgstr "" - -#: library/msilib.rst:347 -msgid "" -"Add the file with the pathname *full* to the CAB file, under the name " -"*logical*. If there is already a file named *logical*, a new file name is " -"created." -msgstr "" - -#: library/msilib.rst:351 -msgid "" -"Return the index of the file in the CAB file, and the new name of the file " -"inside the CAB file." -msgstr "" - -#: library/msilib.rst:357 -msgid "" -"Generate a CAB file, add it as a stream to the MSI file, put it into the " -"``Media`` table, and remove the generated file from the disk." -msgstr "" - -#: library/msilib.rst:364 -msgid "Directory Objects" -msgstr "" - -#: library/msilib.rst:369 -msgid "" -"Create a new directory in the Directory table. There is a current component " -"at each point in time for the directory, which is either explicitly created " -"through :meth:`start_component`, or implicitly when files are added for the " -"first time. Files are added into the current component, and into the cab " -"file. To create a directory, a base directory object needs to be specified " -"(can be ``None``), the path to the physical directory, and a logical " -"directory name. *default* specifies the DefaultDir slot in the directory " -"table. *componentflags* specifies the default flags that new components get." -msgstr "" - -#: library/msilib.rst:381 -msgid "" -"Add an entry to the Component table, and make this component the current " -"component for this directory. If no component name is given, the directory " -"name is used. If no *feature* is given, the current feature is used. If no " -"*flags* are given, the directory's default flags are used. If no *keyfile* " -"is given, the KeyPath is left null in the Component table." -msgstr "" - -#: library/msilib.rst:390 -msgid "" -"Add a file to the current component of the directory, starting a new one if " -"there is no current component. By default, the file name in the source and " -"the file table will be identical. If the *src* file is specified, it is " -"interpreted relative to the current directory. Optionally, a *version* and a " -"*language* can be specified for the entry in the File table." -msgstr "" - -#: library/msilib.rst:399 -msgid "" -"Add a list of files to the current component as specified in the glob " -"pattern. Individual files can be excluded in the *exclude* list." -msgstr "" - -#: library/msilib.rst:405 -msgid "Remove ``.pyc`` files on uninstall." -msgstr "" - -#: library/msilib.rst:410 -msgid "" -"`Directory Table `_ `File Table `_ `Component Table `_ `FeatureComponents Table " -"`_" -msgstr "" - -#: library/msilib.rst:418 -msgid "Features" -msgstr "" - -#: library/msilib.rst:423 -msgid "" -"Add a new record to the ``Feature`` table, using the values *id*, *parent." -"id*, *title*, *desc*, *display*, *level*, *directory*, and *attributes*. The " -"resulting feature object can be passed to the :meth:`start_component` method " -"of :class:`Directory`." -msgstr "" - -#: library/msilib.rst:431 -msgid "" -"Make this feature the current feature of :mod:`msilib`. New components are " -"automatically added to the default feature, unless a feature is explicitly " -"specified." -msgstr "" - -#: library/msilib.rst:438 -msgid "" -"`Feature Table `_" -msgstr "" - -#: library/msilib.rst:443 -msgid "GUI classes" -msgstr "" - -#: library/msilib.rst:445 -msgid "" -":mod:`msilib` provides several classes that wrap the GUI tables in an MSI " -"database. However, no standard user interface is provided." -msgstr "" - -#: library/msilib.rst:451 -msgid "" -"Base class of the dialog controls. *dlg* is the dialog object the control " -"belongs to, and *name* is the control's name." -msgstr "" - -#: library/msilib.rst:457 -msgid "Make an entry into the ``ControlEvent`` table for this control." -msgstr "" - -#: library/msilib.rst:462 -msgid "Make an entry into the ``EventMapping`` table for this control." -msgstr "" - -#: library/msilib.rst:467 -msgid "Make an entry into the ``ControlCondition`` table for this control." -msgstr "" - -#: library/msilib.rst:472 -msgid "" -"Create a radio button control named *name*. *property* is the installer " -"property that gets set when a radio button is selected." -msgstr "" - -#: library/msilib.rst:478 -msgid "" -"Add a radio button named *name* to the group, at the coordinates *x*, *y*, " -"*width*, *height*, and with the label *text*. If *value* is ``None``, it " -"defaults to *name*." -msgstr "" - -#: library/msilib.rst:485 -msgid "" -"Return a new :class:`Dialog` object. An entry in the ``Dialog`` table is " -"made, with the specified coordinates, dialog attributes, title, name of the " -"first, default, and cancel controls." -msgstr "" - -#: library/msilib.rst:492 -msgid "" -"Return a new :class:`Control` object. An entry in the ``Control`` table is " -"made with the specified parameters." -msgstr "" - -#: library/msilib.rst:495 -msgid "" -"This is a generic method; for specific types, specialized methods are " -"provided." -msgstr "" - -#: library/msilib.rst:501 -msgid "Add and return a ``Text`` control." -msgstr "" - -#: library/msilib.rst:506 -msgid "Add and return a ``Bitmap`` control." -msgstr "" - -#: library/msilib.rst:511 -msgid "Add and return a ``Line`` control." -msgstr "" - -#: library/msilib.rst:516 -msgid "Add and return a ``PushButton`` control." -msgstr "" - -#: library/msilib.rst:521 -msgid "Add and return a ``RadioButtonGroup`` control." -msgstr "" - -#: library/msilib.rst:526 -msgid "Add and return a ``CheckBox`` control." -msgstr "" - -#: library/msilib.rst:531 -msgid "" -"`Dialog Table `_ `Control Table `_ `Control Types `_ `ControlCondition Table " -"`_ " -"`ControlEvent Table `_ `EventMapping Table `_ `RadioButton Table `_" -msgstr "" - -#: library/msilib.rst:542 -msgid "Precomputed tables" -msgstr "" - -#: library/msilib.rst:544 -msgid "" -":mod:`msilib` provides a few subpackages that contain only schema and table " -"definitions. Currently, these definitions are based on MSI version 2.0." -msgstr "" - -#: library/msilib.rst:550 -msgid "" -"This is the standard MSI schema for MSI 2.0, with the *tables* variable " -"providing a list of table definitions, and *_Validation_records* providing " -"the data for MSI validation." -msgstr "" - -#: library/msilib.rst:557 -msgid "" -"This module contains table contents for the standard sequence tables: " -"*AdminExecuteSequence*, *AdminUISequence*, *AdvtExecuteSequence*, " -"*InstallExecuteSequence*, and *InstallUISequence*." -msgstr "" - -#: library/msilib.rst:564 -msgid "" -"This module contains definitions for the UIText and ActionText tables, for " -"the standard installer actions." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" #: library/msilib.rst:14 -msgid "msi" +msgid "" +"The last version of Python that provided the :mod:`!msilib` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/msvcrt.po b/library/msvcrt.po index f6a0afd8..34fcb4b3 100644 --- a/library/msvcrt.po +++ b/library/msvcrt.po @@ -8,23 +8,24 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/msvcrt.rst:2 -msgid ":mod:`msvcrt` --- Useful routines from the MS VC++ runtime" +msgid ":mod:`!msvcrt` --- Useful routines from the MS VC++ runtime" msgstr "" #: library/msvcrt.rst:12 msgid "" "These functions provide access to some useful capabilities on Windows " -"platforms. Some higher-level modules use these functions to build the " -"Windows implementations of their services. For example, the :mod:`getpass` " +"platforms. Some higher-level modules use these functions to build the " +"Windows implementations of their services. For example, the :mod:`getpass` " "module uses this in the implementation of the :func:`getpass` function." msgstr "" @@ -43,152 +44,251 @@ msgid "" msgstr "" #: library/msvcrt.rst:25 +msgid "Availability" +msgstr "" + +#: library/msvcrt.rst:27 msgid "" "Operations in this module now raise :exc:`OSError` where :exc:`IOError` was " "raised." msgstr "" -#: library/msvcrt.rst:33 +#: library/msvcrt.rst:35 msgid "File Operations" msgstr "" -#: library/msvcrt.rst:38 +#: library/msvcrt.rst:40 msgid "" -"Lock part of a file based on file descriptor *fd* from the C runtime. " -"Raises :exc:`OSError` on failure. The locked region of the file extends " -"from the current file position for *nbytes* bytes, and may continue beyond " -"the end of the file. *mode* must be one of the :const:`!LK_\\*` constants " -"listed below. Multiple regions in a file may be locked at the same time, but " -"may not overlap. Adjacent regions are not merged; they must be unlocked " +"Lock part of a file based on file descriptor *fd* from the C runtime. " +"Raises :exc:`OSError` on failure. The locked region of the file extends from " +"the current file position for *nbytes* bytes, and may continue beyond the " +"end of the file. *mode* must be one of the :const:`!LK_\\*` constants listed " +"below. Multiple regions in a file may be locked at the same time, but may " +"not overlap. Adjacent regions are not merged; they must be unlocked " "individually." msgstr "" -#: library/msvcrt.rst:45 +#: library/msvcrt.rst:47 msgid "" "Raises an :ref:`auditing event ` ``msvcrt.locking`` with arguments " "``fd``, ``mode``, ``nbytes``." msgstr "" -#: library/msvcrt.rst:51 +#: library/msvcrt.rst:53 msgid "" "Locks the specified bytes. If the bytes cannot be locked, the program " -"immediately tries again after 1 second. If, after 10 attempts, the bytes " +"immediately tries again after 1 second. If, after 10 attempts, the bytes " "cannot be locked, :exc:`OSError` is raised." msgstr "" -#: library/msvcrt.rst:59 +#: library/msvcrt.rst:61 msgid "" "Locks the specified bytes. If the bytes cannot be locked, :exc:`OSError` is " "raised." msgstr "" -#: library/msvcrt.rst:65 +#: library/msvcrt.rst:67 msgid "Unlocks the specified bytes, which must have been previously locked." msgstr "" -#: library/msvcrt.rst:70 +#: library/msvcrt.rst:72 msgid "" "Set the line-end translation mode for the file descriptor *fd*. To set it to " "text mode, *flags* should be :const:`os.O_TEXT`; for binary, it should be :" "const:`os.O_BINARY`." msgstr "" -#: library/msvcrt.rst:77 +#: library/msvcrt.rst:79 msgid "" -"Create a C runtime file descriptor from the file handle *handle*. The " +"Create a C runtime file descriptor from the file handle *handle*. The " "*flags* parameter should be a bitwise OR of :const:`os.O_APPEND`, :const:`os." -"O_RDONLY`, and :const:`os.O_TEXT`. The returned file descriptor may be used " -"as a parameter to :func:`os.fdopen` to create a file object." +"O_RDONLY`, :const:`os.O_TEXT` and :const:`os.O_NOINHERIT`. The returned file " +"descriptor may be used as a parameter to :func:`os.fdopen` to create a file " +"object." +msgstr "" + +#: library/msvcrt.rst:85 +msgid "" +"The file descriptor is inheritable by default. Pass :const:`os.O_NOINHERIT` " +"flag to make it non inheritable." msgstr "" -#: library/msvcrt.rst:82 +#: library/msvcrt.rst:88 msgid "" "Raises an :ref:`auditing event ` ``msvcrt.open_osfhandle`` with " "arguments ``handle``, ``flags``." msgstr "" -#: library/msvcrt.rst:87 +#: library/msvcrt.rst:93 msgid "" -"Return the file handle for the file descriptor *fd*. Raises :exc:`OSError` " +"Return the file handle for the file descriptor *fd*. Raises :exc:`OSError` " "if *fd* is not recognized." msgstr "" -#: library/msvcrt.rst:90 +#: library/msvcrt.rst:96 msgid "" "Raises an :ref:`auditing event ` ``msvcrt.get_osfhandle`` with " "argument ``fd``." msgstr "" -#: library/msvcrt.rst:96 +#: library/msvcrt.rst:102 msgid "Console I/O" msgstr "" -#: library/msvcrt.rst:101 -msgid "Return ``True`` if a keypress is waiting to be read." +#: library/msvcrt.rst:107 +msgid "" +"Returns a nonzero value if a keypress is waiting to be read. Otherwise, " +"return 0." msgstr "" -#: library/msvcrt.rst:106 +#: library/msvcrt.rst:113 msgid "" "Read a keypress and return the resulting character as a byte string. Nothing " -"is echoed to the console. This call will block if a keypress is not already " +"is echoed to the console. This call will block if a keypress is not already " "available, but will not wait for :kbd:`Enter` to be pressed. If the pressed " "key was a special function key, this will return ``'\\000'`` or ``'\\xe0'``; " "the next call will return the keycode. The :kbd:`Control-C` keypress cannot " "be read with this function." msgstr "" -#: library/msvcrt.rst:116 +#: library/msvcrt.rst:123 msgid "Wide char variant of :func:`getch`, returning a Unicode value." msgstr "" -#: library/msvcrt.rst:121 +#: library/msvcrt.rst:128 msgid "" -"Similar to :func:`getch`, but the keypress will be echoed if it represents " -"a printable character." +"Similar to :func:`getch`, but the keypress will be echoed if it represents a " +"printable character." msgstr "" -#: library/msvcrt.rst:127 +#: library/msvcrt.rst:134 msgid "Wide char variant of :func:`getche`, returning a Unicode value." msgstr "" -#: library/msvcrt.rst:132 +#: library/msvcrt.rst:139 msgid "Print the byte string *char* to the console without buffering." msgstr "" -#: library/msvcrt.rst:137 +#: library/msvcrt.rst:144 msgid "Wide char variant of :func:`putch`, accepting a Unicode value." msgstr "" -#: library/msvcrt.rst:142 +#: library/msvcrt.rst:149 msgid "" "Cause the byte string *char* to be \"pushed back\" into the console buffer; " "it will be the next character read by :func:`getch` or :func:`getche`." msgstr "" -#: library/msvcrt.rst:148 +#: library/msvcrt.rst:155 msgid "Wide char variant of :func:`ungetch`, accepting a Unicode value." msgstr "" -#: library/msvcrt.rst:154 +#: library/msvcrt.rst:161 msgid "Other Functions" msgstr "" -#: library/msvcrt.rst:159 +#: library/msvcrt.rst:166 msgid "" "Force the :c:func:`malloc` heap to clean itself up and return unused blocks " "to the operating system. On failure, this raises :exc:`OSError`." msgstr "" -#: library/msvcrt.rst:164 +#: library/msvcrt.rst:172 +msgid "" +"Changes the location where the C runtime writes an error message for an " +"error that might end the program. *mode* must be one of the :const:`!" +"OUT_\\*` constants listed below or :const:`REPORT_ERRMODE`. Returns the old " +"setting or -1 if an error occurs. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: library/msvcrt.rst:181 +msgid "" +"Error sink is determined by the app's type. Only available in :ref:`debug " +"build of Python `." +msgstr "" + +#: library/msvcrt.rst:187 +msgid "" +"Error sink is a standard error. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: library/msvcrt.rst:193 +msgid "" +"Error sink is a message box. Only available in :ref:`debug build of Python " +"`." +msgstr "" + +#: library/msvcrt.rst:199 +msgid "" +"Report the current error mode value. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: library/msvcrt.rst:205 +msgid "" +"Specifies the destination or destinations for a specific report type " +"generated by :c:func:`!_CrtDbgReport` in the MS VC++ runtime. *type* must be " +"one of the :const:`!CRT_\\*` constants listed below. *mode* must be one of " +"the :const:`!CRTDBG_\\*` constants listed below. Only available in :ref:" +"`debug build of Python `." +msgstr "" + +#: library/msvcrt.rst:214 +msgid "" +"After you use :func:`CrtSetReportMode` to specify :const:`CRTDBG_MODE_FILE`, " +"you can specify the file handle to receive the message text. *type* must be " +"one of the :const:`!CRT_\\*` constants listed below. *file* should be the " +"file handle your want specified. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: library/msvcrt.rst:223 +msgid "" +"Warnings, messages, and information that doesn't need immediate attention." +msgstr "" + +#: library/msvcrt.rst:228 +msgid "" +"Errors, unrecoverable problems, and issues that require immediate attention." +msgstr "" + +#: library/msvcrt.rst:233 +msgid "Assertion failures." +msgstr "" + +#: library/msvcrt.rst:238 +msgid "Writes the message to the debugger's output window." +msgstr "" + +#: library/msvcrt.rst:243 +msgid "" +"Writes the message to a user-supplied file handle. :func:`CrtSetReportFile` " +"should be called to define the specific file or stream to use as the " +"destination." +msgstr "" + +#: library/msvcrt.rst:250 +msgid "" +"Creates a message box to display the message along with the ``Abort``, " +"``Retry``, and ``Ignore`` buttons." +msgstr "" + +#: library/msvcrt.rst:256 +msgid "Returns current *mode* for the specified *type*." +msgstr "" + +#: library/msvcrt.rst:261 msgid "The CRT Assembly version, from the :file:`crtassem.h` header file." msgstr "" -#: library/msvcrt.rst:169 +#: library/msvcrt.rst:266 msgid "" "The VC Assembly public key token, from the :file:`crtassem.h` header file." msgstr "" -#: library/msvcrt.rst:174 +#: library/msvcrt.rst:271 msgid "" "The Libraries Assembly name prefix, from the :file:`crtassem.h` header file." msgstr "" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index d933cac2..a5fd8b4c 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -8,31 +8,31 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/multiprocessing.rst:2 -msgid ":mod:`multiprocessing` --- Process-based parallelism" +msgid ":mod:`!multiprocessing` --- Process-based parallelism" msgstr "" #: library/multiprocessing.rst:7 msgid "**Source code:** :source:`Lib/multiprocessing/`" msgstr "" -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#: includes/wasm-mobile-notavail.rst:3 +msgid "Availability" msgstr "" -#: includes/wasm-notavail.rst:5 +#: includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" #: library/multiprocessing.rst:14 @@ -52,9 +52,8 @@ msgstr "" #: library/multiprocessing.rst:25 msgid "" -"The :mod:`multiprocessing` module also introduces APIs which do not have " -"analogs in the :mod:`threading` module. A prime example of this is the :" -"class:`~multiprocessing.pool.Pool` object which offers a convenient means of " +"The :mod:`multiprocessing` module also introduces the :class:" +"`~multiprocessing.pool.Pool` object which offers a convenient means of " "parallelizing the execution of a function across multiple input values, " "distributing the input data across processes (data parallelism). The " "following example demonstrates the common practice of defining such " @@ -63,11 +62,35 @@ msgid "" "`~multiprocessing.pool.Pool`, ::" msgstr "" -#: library/multiprocessing.rst:43 +#: library/multiprocessing.rst:33 +msgid "" +"from multiprocessing import Pool\n" +"\n" +"def f(x):\n" +" return x*x\n" +"\n" +"if __name__ == '__main__':\n" +" with Pool(5) as p:\n" +" print(p.map(f, [1, 2, 3]))" +msgstr "" + +#: library/multiprocessing.rst:42 msgid "will print to standard output ::" msgstr "" -#: library/multiprocessing.rst:50 +#: library/multiprocessing.rst:44 +msgid "[1, 4, 9]" +msgstr "" + +#: library/multiprocessing.rst:46 +msgid "" +"The :mod:`multiprocessing` module also introduces APIs which do not have " +"analogs in the :mod:`threading` module, like the ability to :meth:`terminate " +"`, :meth:`interrupt ` or :meth:`kill " +"` a running process." +msgstr "" + +#: library/multiprocessing.rst:53 msgid "" ":class:`concurrent.futures.ProcessPoolExecutor` offers a higher level " "interface to push tasks to a background process without blocking execution " @@ -77,11 +100,11 @@ msgid "" "from waiting for the results." msgstr "" -#: library/multiprocessing.rst:59 +#: library/multiprocessing.rst:62 msgid "The :class:`Process` class" msgstr "" -#: library/multiprocessing.rst:61 +#: library/multiprocessing.rst:64 msgid "" "In :mod:`multiprocessing`, processes are spawned by creating a :class:" "`Process` object and then calling its :meth:`~Process.start` method. :class:" @@ -89,32 +112,75 @@ msgid "" "of a multiprocess program is ::" msgstr "" -#: library/multiprocessing.rst:76 +#: library/multiprocessing.rst:69 +msgid "" +"from multiprocessing import Process\n" +"\n" +"def f(name):\n" +" print('hello', name)\n" +"\n" +"if __name__ == '__main__':\n" +" p = Process(target=f, args=('bob',))\n" +" p.start()\n" +" p.join()" +msgstr "" + +#: library/multiprocessing.rst:79 msgid "" "To show the individual process IDs involved, here is an expanded example::" msgstr "" -#: library/multiprocessing.rst:97 +#: library/multiprocessing.rst:81 +msgid "" +"from multiprocessing import Process\n" +"import os\n" +"\n" +"def info(title):\n" +" print(title)\n" +" print('module name:', __name__)\n" +" print('parent process:', os.getppid())\n" +" print('process id:', os.getpid())\n" +"\n" +"def f(name):\n" +" info('function f')\n" +" print('hello', name)\n" +"\n" +"if __name__ == '__main__':\n" +" info('main line')\n" +" p = Process(target=f, args=('bob',))\n" +" p.start()\n" +" p.join()" +msgstr "" + +#: library/multiprocessing.rst:100 msgid "" "For an explanation of why the ``if __name__ == '__main__'`` part is " "necessary, see :ref:`multiprocessing-programming`." msgstr "" -#: library/multiprocessing.rst:105 +#: library/multiprocessing.rst:103 +msgid "" +"The arguments to :class:`Process` usually need to be unpickleable from " +"within the child process. If you tried typing the above example directly " +"into a REPL it could lead to an :exc:`AttributeError` in the child process " +"trying to locate the *f* function in the ``__main__`` module." +msgstr "" + +#: library/multiprocessing.rst:112 msgid "Contexts and start methods" msgstr "" -#: library/multiprocessing.rst:107 +#: library/multiprocessing.rst:114 msgid "" "Depending on the platform, :mod:`multiprocessing` supports three ways to " "start a process. These *start methods* are" msgstr "" -#: library/multiprocessing.rst:118 +#: library/multiprocessing.rst:119 msgid "*spawn*" msgstr "" -#: library/multiprocessing.rst:111 +#: library/multiprocessing.rst:120 msgid "" "The parent process starts a fresh Python interpreter process. The child " "process will only inherit those resources necessary to run the process " @@ -124,16 +190,16 @@ msgid "" "or *forkserver*." msgstr "" -#: library/multiprocessing.rst:118 +#: library/multiprocessing.rst:127 msgid "" "Available on POSIX and Windows platforms. The default on Windows and macOS." msgstr "" -#: library/multiprocessing.rst:138 +#: library/multiprocessing.rst:131 msgid "*fork*" msgstr "" -#: library/multiprocessing.rst:121 +#: library/multiprocessing.rst:132 msgid "" "The parent process uses :func:`os.fork` to fork the Python interpreter. The " "child process, when it begins, is effectively identical to the parent " @@ -141,19 +207,18 @@ msgid "" "Note that safely forking a multithreaded process is problematic." msgstr "" -#: library/multiprocessing.rst:127 -msgid "" -"Available on POSIX systems. Currently the default on POSIX except macOS." +#: library/multiprocessing.rst:138 +msgid "Available on POSIX systems." msgstr "" -#: library/multiprocessing.rst:130 +#: library/multiprocessing.rst:140 msgid "" -"The default start method will change away from *fork* in Python 3.14. Code " -"that requires *fork* should explicitly specify that via :func:`get_context` " -"or :func:`set_start_method`." +"This is no longer the default start method on any platform. Code that " +"requires *fork* must explicitly specify that via :func:`get_context` or :" +"func:`set_start_method`." msgstr "" -#: library/multiprocessing.rst:134 +#: library/multiprocessing.rst:145 msgid "" "If Python is able to detect that your process has multiple threads, the :" "func:`os.fork` function that this start method calls internally will raise " @@ -161,11 +226,11 @@ msgid "" "fork` documentation for further explanation." msgstr "" -#: library/multiprocessing.rst:151 +#: library/multiprocessing.rst:153 msgid "*forkserver*" msgstr "" -#: library/multiprocessing.rst:141 +#: library/multiprocessing.rst:154 msgid "" "When the program starts and selects the *forkserver* start method, a server " "process is spawned. From then on, whenever a new process is needed, the " @@ -175,27 +240,38 @@ msgid "" "for it to use :func:`os.fork`. No unnecessary resources are inherited." msgstr "" -#: library/multiprocessing.rst:149 +#: library/multiprocessing.rst:162 msgid "" "Available on POSIX platforms which support passing file descriptors over " -"Unix pipes such as Linux." +"Unix pipes such as Linux. The default on those." msgstr "" -#: library/multiprocessing.rst:153 +#: library/multiprocessing.rst:165 +msgid "This became the default start method on POSIX platforms." +msgstr "" + +#: library/multiprocessing.rst:168 msgid "" "*spawn* added on all POSIX platforms, and *forkserver* added for some POSIX " "platforms. Child processes no longer inherit all of the parents inheritable " "handles on Windows." msgstr "" -#: library/multiprocessing.rst:161 +#: library/multiprocessing.rst:176 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess as macOS system libraries may start threads. See :issue:`33725`." msgstr "" -#: library/multiprocessing.rst:165 +#: library/multiprocessing.rst:182 +msgid "" +"On POSIX platforms the default start method was changed from *fork* to " +"*forkserver* to retain the performance but avoid common multithreaded " +"process incompatibilities. See :gh:`84559`." +msgstr "" + +#: library/multiprocessing.rst:187 msgid "" "On POSIX using the *spawn* or *forkserver* start methods will also start a " "*resource tracker* process which tracks the unlinked named system resources " @@ -210,25 +286,57 @@ msgid "" "space in the main memory.)" msgstr "" -#: library/multiprocessing.rst:178 +#: library/multiprocessing.rst:200 msgid "" "To select a start method you use the :func:`set_start_method` in the ``if " "__name__ == '__main__'`` clause of the main module. For example::" msgstr "" -#: library/multiprocessing.rst:195 +#: library/multiprocessing.rst:204 +msgid "" +"import multiprocessing as mp\n" +"\n" +"def foo(q):\n" +" q.put('hello')\n" +"\n" +"if __name__ == '__main__':\n" +" mp.set_start_method('spawn')\n" +" q = mp.Queue()\n" +" p = mp.Process(target=foo, args=(q,))\n" +" p.start()\n" +" print(q.get())\n" +" p.join()" +msgstr "" + +#: library/multiprocessing.rst:217 msgid "" ":func:`set_start_method` should not be used more than once in the program." msgstr "" -#: library/multiprocessing.rst:198 +#: library/multiprocessing.rst:220 msgid "" "Alternatively, you can use :func:`get_context` to obtain a context object. " "Context objects have the same API as the multiprocessing module, and allow " "one to use multiple start methods in the same program. ::" msgstr "" -#: library/multiprocessing.rst:216 +#: library/multiprocessing.rst:225 +msgid "" +"import multiprocessing as mp\n" +"\n" +"def foo(q):\n" +" q.put('hello')\n" +"\n" +"if __name__ == '__main__':\n" +" ctx = mp.get_context('spawn')\n" +" q = ctx.Queue()\n" +" p = ctx.Process(target=foo, args=(q,))\n" +" p.start()\n" +" print(q.get())\n" +" p.join()" +msgstr "" + +#: library/multiprocessing.rst:238 msgid "" "Note that objects related to one context may not be compatible with " "processes for a different context. In particular, locks created using the " @@ -236,13 +344,17 @@ msgid "" "*forkserver* start methods." msgstr "" -#: library/multiprocessing.rst:221 +#: library/multiprocessing.rst:243 msgid "" -"A library which wants to use a particular start method should probably use :" -"func:`get_context` to avoid interfering with the choice of the library user." +"Libraries using :mod:`multiprocessing` or :class:`~concurrent.futures." +"ProcessPoolExecutor` should be designed to allow their users to provide " +"their own multiprocessing context. Using a specific context of your own " +"within a library can lead to incompatibilities with the rest of the library " +"user's application. Always document if your library requires a specific " +"start method." msgstr "" -#: library/multiprocessing.rst:227 +#: library/multiprocessing.rst:252 msgid "" "The ``'spawn'`` and ``'forkserver'`` start methods generally cannot be used " "with \"frozen\" executables (i.e., binaries produced by packages like " @@ -250,41 +362,74 @@ msgid "" "method may work if code does not use threads." msgstr "" -#: library/multiprocessing.rst:234 +#: library/multiprocessing.rst:259 msgid "Exchanging objects between processes" msgstr "" -#: library/multiprocessing.rst:236 +#: library/multiprocessing.rst:261 msgid "" ":mod:`multiprocessing` supports two types of communication channel between " "processes:" msgstr "" -#: library/multiprocessing.rst:239 +#: library/multiprocessing.rst:264 msgid "**Queues**" msgstr "" -#: library/multiprocessing.rst:241 +#: library/multiprocessing.rst:266 msgid "" "The :class:`Queue` class is a near clone of :class:`queue.Queue`. For " "example::" msgstr "" -#: library/multiprocessing.rst:256 -msgid "Queues are thread and process safe." +#: library/multiprocessing.rst:269 +msgid "" +"from multiprocessing import Process, Queue\n" +"\n" +"def f(q):\n" +" q.put([42, None, 'hello'])\n" +"\n" +"if __name__ == '__main__':\n" +" q = Queue()\n" +" p = Process(target=f, args=(q,))\n" +" p.start()\n" +" print(q.get()) # prints \"[42, None, 'hello']\"\n" +" p.join()" msgstr "" -#: library/multiprocessing.rst:258 +#: library/multiprocessing.rst:281 +msgid "" +"Queues are thread and process safe. Any object put into a :mod:" +"`~multiprocessing` queue will be serialized." +msgstr "" + +#: library/multiprocessing.rst:284 msgid "**Pipes**" msgstr "" -#: library/multiprocessing.rst:260 +#: library/multiprocessing.rst:286 msgid "" "The :func:`Pipe` function returns a pair of connection objects connected by " "a pipe which by default is duplex (two-way). For example::" msgstr "" -#: library/multiprocessing.rst:276 +#: library/multiprocessing.rst:289 +msgid "" +"from multiprocessing import Process, Pipe\n" +"\n" +"def f(conn):\n" +" conn.send([42, None, 'hello'])\n" +" conn.close()\n" +"\n" +"if __name__ == '__main__':\n" +" parent_conn, child_conn = Pipe()\n" +" p = Process(target=f, args=(child_conn,))\n" +" p.start()\n" +" print(parent_conn.recv()) # prints \"[42, None, 'hello']\"\n" +" p.join()" +msgstr "" + +#: library/multiprocessing.rst:302 msgid "" "The two connection objects returned by :func:`Pipe` represent the two ends " "of the pipe. Each connection object has :meth:`~Connection.send` and :meth:" @@ -294,55 +439,106 @@ msgid "" "corruption from processes using different ends of the pipe at the same time." msgstr "" -#: library/multiprocessing.rst:286 +#: library/multiprocessing.rst:310 +msgid "" +"The :meth:`~Connection.send` method serializes the object and :meth:" +"`~Connection.recv` re-creates the object." +msgstr "" + +#: library/multiprocessing.rst:314 msgid "Synchronization between processes" msgstr "" -#: library/multiprocessing.rst:288 +#: library/multiprocessing.rst:316 msgid "" ":mod:`multiprocessing` contains equivalents of all the synchronization " "primitives from :mod:`threading`. For instance one can use a lock to ensure " "that only one process prints to standard output at a time::" msgstr "" -#: library/multiprocessing.rst:307 +#: library/multiprocessing.rst:320 +msgid "" +"from multiprocessing import Process, Lock\n" +"\n" +"def f(l, i):\n" +" l.acquire()\n" +" try:\n" +" print('hello world', i)\n" +" finally:\n" +" l.release()\n" +"\n" +"if __name__ == '__main__':\n" +" lock = Lock()\n" +"\n" +" for num in range(10):\n" +" Process(target=f, args=(lock, num)).start()" +msgstr "" + +#: library/multiprocessing.rst:335 msgid "" "Without using the lock output from the different processes is liable to get " "all mixed up." msgstr "" -#: library/multiprocessing.rst:312 +#: library/multiprocessing.rst:340 msgid "Sharing state between processes" msgstr "" -#: library/multiprocessing.rst:314 +#: library/multiprocessing.rst:342 msgid "" "As mentioned above, when doing concurrent programming it is usually best to " "avoid using shared state as far as possible. This is particularly true when " "using multiple processes." msgstr "" -#: library/multiprocessing.rst:318 +#: library/multiprocessing.rst:346 msgid "" "However, if you really do need to use some shared data then :mod:" "`multiprocessing` provides a couple of ways of doing so." msgstr "" -#: library/multiprocessing.rst:321 +#: library/multiprocessing.rst:349 msgid "**Shared memory**" msgstr "" -#: library/multiprocessing.rst:323 +#: library/multiprocessing.rst:351 msgid "" "Data can be stored in a shared memory map using :class:`Value` or :class:" "`Array`. For example, the following code ::" msgstr "" -#: library/multiprocessing.rst:344 library/multiprocessing.rst:390 +#: library/multiprocessing.rst:354 +msgid "" +"from multiprocessing import Process, Value, Array\n" +"\n" +"def f(n, a):\n" +" n.value = 3.1415927\n" +" for i in range(len(a)):\n" +" a[i] = -a[i]\n" +"\n" +"if __name__ == '__main__':\n" +" num = Value('d', 0.0)\n" +" arr = Array('i', range(10))\n" +"\n" +" p = Process(target=f, args=(num, arr))\n" +" p.start()\n" +" p.join()\n" +"\n" +" print(num.value)\n" +" print(arr[:])" +msgstr "" + +#: library/multiprocessing.rst:372 library/multiprocessing.rst:422 msgid "will print ::" msgstr "" -#: library/multiprocessing.rst:349 +#: library/multiprocessing.rst:374 +msgid "" +"3.1415927\n" +"[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]" +msgstr "" + +#: library/multiprocessing.rst:377 msgid "" "The ``'d'`` and ``'i'`` arguments used when creating ``num`` and ``arr`` are " "typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a " @@ -350,34 +546,68 @@ msgid "" "objects will be process and thread-safe." msgstr "" -#: library/multiprocessing.rst:354 +#: library/multiprocessing.rst:382 msgid "" "For more flexibility in using shared memory one can use the :mod:" "`multiprocessing.sharedctypes` module which supports the creation of " "arbitrary ctypes objects allocated from shared memory." msgstr "" -#: library/multiprocessing.rst:358 +#: library/multiprocessing.rst:386 msgid "**Server process**" msgstr "" -#: library/multiprocessing.rst:360 +#: library/multiprocessing.rst:388 msgid "" "A manager object returned by :func:`Manager` controls a server process which " "holds Python objects and allows other processes to manipulate them using " "proxies." msgstr "" -#: library/multiprocessing.rst:364 +#: library/multiprocessing.rst:392 msgid "" "A manager returned by :func:`Manager` will support types :class:`list`, :" -"class:`dict`, :class:`~managers.Namespace`, :class:`Lock`, :class:`RLock`, :" -"class:`Semaphore`, :class:`BoundedSemaphore`, :class:`Condition`, :class:" -"`Event`, :class:`Barrier`, :class:`Queue`, :class:`Value` and :class:" -"`Array`. For example, ::" -msgstr "" - -#: library/multiprocessing.rst:395 +"class:`dict`, :class:`set`, :class:`~managers.Namespace`, :class:`Lock`, :" +"class:`RLock`, :class:`Semaphore`, :class:`BoundedSemaphore`, :class:" +"`Condition`, :class:`Event`, :class:`Barrier`, :class:`Queue`, :class:" +"`Value` and :class:`Array`. For example, ::" +msgstr "" + +#: library/multiprocessing.rst:398 +msgid "" +"from multiprocessing import Process, Manager\n" +"\n" +"def f(d, l, s):\n" +" d[1] = '1'\n" +" d['2'] = 2\n" +" d[0.25] = None\n" +" l.reverse()\n" +" s.add('a')\n" +" s.add('b')\n" +"\n" +"if __name__ == '__main__':\n" +" with Manager() as manager:\n" +" d = manager.dict()\n" +" l = manager.list(range(10))\n" +" s = manager.set()\n" +"\n" +" p = Process(target=f, args=(d, l, s))\n" +" p.start()\n" +" p.join()\n" +"\n" +" print(d)\n" +" print(l)\n" +" print(s)" +msgstr "" + +#: library/multiprocessing.rst:424 +msgid "" +"{0.25: None, 1: '1', '2': 2}\n" +"[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n" +"{'a', 'b'}" +msgstr "" + +#: library/multiprocessing.rst:428 msgid "" "Server process managers are more flexible than using shared memory objects " "because they can be made to support arbitrary object types. Also, a single " @@ -385,28 +615,77 @@ msgid "" "They are, however, slower than using shared memory." msgstr "" -#: library/multiprocessing.rst:402 +#: library/multiprocessing.rst:435 msgid "Using a pool of workers" msgstr "" -#: library/multiprocessing.rst:404 +#: library/multiprocessing.rst:437 msgid "" "The :class:`~multiprocessing.pool.Pool` class represents a pool of worker " "processes. It has methods which allows tasks to be offloaded to the worker " "processes in a few different ways." msgstr "" -#: library/multiprocessing.rst:408 +#: library/multiprocessing.rst:441 msgid "For example::" msgstr "" -#: library/multiprocessing.rst:452 +#: library/multiprocessing.rst:443 +msgid "" +"from multiprocessing import Pool, TimeoutError\n" +"import time\n" +"import os\n" +"\n" +"def f(x):\n" +" return x*x\n" +"\n" +"if __name__ == '__main__':\n" +" # start 4 worker processes\n" +" with Pool(processes=4) as pool:\n" +"\n" +" # print \"[0, 1, 4,..., 81]\"\n" +" print(pool.map(f, range(10)))\n" +"\n" +" # print same numbers in arbitrary order\n" +" for i in pool.imap_unordered(f, range(10)):\n" +" print(i)\n" +"\n" +" # evaluate \"f(20)\" asynchronously\n" +" res = pool.apply_async(f, (20,)) # runs in *only* one process\n" +" print(res.get(timeout=1)) # prints \"400\"\n" +"\n" +" # evaluate \"os.getpid()\" asynchronously\n" +" res = pool.apply_async(os.getpid, ()) # runs in *only* one process\n" +" print(res.get(timeout=1)) # prints the PID of that " +"process\n" +"\n" +" # launching multiple evaluations asynchronously *may* use more " +"processes\n" +" multiple_results = [pool.apply_async(os.getpid, ()) for i in " +"range(4)]\n" +" print([res.get(timeout=1) for res in multiple_results])\n" +"\n" +" # make a single worker sleep for 10 seconds\n" +" res = pool.apply_async(time.sleep, (10,))\n" +" try:\n" +" print(res.get(timeout=1))\n" +" except TimeoutError:\n" +" print(\"We lacked patience and got a multiprocessing." +"TimeoutError\")\n" +"\n" +" print(\"For the moment, the pool remains available for more work\")\n" +"\n" +" # exiting the 'with'-block has stopped the pool\n" +" print(\"Now the pool is closed and no longer available\")" +msgstr "" + +#: library/multiprocessing.rst:485 msgid "" "Note that the methods of a pool should only ever be used by the process " "which created it." msgstr "" -#: library/multiprocessing.rst:457 +#: library/multiprocessing.rst:490 msgid "" "Functionality within this package requires that the ``__main__`` module be " "importable by the children. This is covered in :ref:`multiprocessing-" @@ -415,40 +694,63 @@ msgid "" "work in the interactive interpreter. For example::" msgstr "" -#: library/multiprocessing.rst:480 +#: library/multiprocessing.rst:496 +msgid "" +">>> from multiprocessing import Pool\n" +">>> p = Pool(5)\n" +">>> def f(x):\n" +"... return x*x\n" +"...\n" +">>> with p:\n" +"... p.map(f, [1,2,3])\n" +"Process PoolWorker-1:\n" +"Process PoolWorker-2:\n" +"Process PoolWorker-3:\n" +"Traceback (most recent call last):\n" +"Traceback (most recent call last):\n" +"Traceback (most recent call last):\n" +"AttributeError: Can't get attribute 'f' on )>\n" +"AttributeError: Can't get attribute 'f' on )>\n" +"AttributeError: Can't get attribute 'f' on )>" +msgstr "" + +#: library/multiprocessing.rst:513 msgid "" "(If you try this it will actually output three full tracebacks interleaved " "in a semi-random fashion, and then you may have to stop the parent process " "somehow.)" msgstr "" -#: library/multiprocessing.rst:486 +#: library/multiprocessing.rst:519 msgid "Reference" msgstr "" -#: library/multiprocessing.rst:488 +#: library/multiprocessing.rst:521 msgid "" "The :mod:`multiprocessing` package mostly replicates the API of the :mod:" "`threading` module." msgstr "" -#: library/multiprocessing.rst:493 +#: library/multiprocessing.rst:526 msgid ":class:`Process` and exceptions" msgstr "" -#: library/multiprocessing.rst:498 +#: library/multiprocessing.rst:531 msgid "" "Process objects represent activity that is run in a separate process. The :" "class:`Process` class has equivalents of all the methods of :class:" "`threading.Thread`." msgstr "" -#: library/multiprocessing.rst:502 +#: library/multiprocessing.rst:535 msgid "" "The constructor should always be called with keyword arguments. *group* " "should always be ``None``; it exists solely for compatibility with :class:" "`threading.Thread`. *target* is the callable object to be invoked by the :" -"meth:`run()` method. It defaults to ``None``, meaning nothing is called. " +"meth:`run` method. It defaults to ``None``, meaning nothing is called. " "*name* is the process name (see :attr:`name` for more details). *args* is " "the argument tuple for the target invocation. *kwargs* is a dictionary of " "keyword arguments for the target invocation. If provided, the keyword-only " @@ -457,29 +759,74 @@ msgid "" "creating process." msgstr "" -#: library/multiprocessing.rst:513 +#: library/multiprocessing.rst:546 msgid "" "By default, no arguments are passed to *target*. The *args* argument, which " "defaults to ``()``, can be used to specify a list or tuple of the arguments " "to pass to *target*." msgstr "" -#: library/multiprocessing.rst:517 +#: library/multiprocessing.rst:550 msgid "" "If a subclass overrides the constructor, it must make sure it invokes the " -"base class constructor (:meth:`Process.__init__`) before doing anything else " +"base class constructor (``super().__init__()``) before doing anything else " "to the process." msgstr "" -#: library/multiprocessing.rst:521 +#: library/multiprocessing.rst:556 +msgid "" +"In general, all arguments to :class:`Process` must be picklable. This is " +"frequently observed when trying to create a :class:`Process` or use a :class:" +"`concurrent.futures.ProcessPoolExecutor` from a REPL with a locally defined " +"*target* function." +msgstr "" + +#: library/multiprocessing.rst:561 +msgid "" +"Passing a callable object defined in the current REPL session causes the " +"child process to die via an uncaught :exc:`AttributeError` exception when " +"starting as *target* must have been defined within an importable module in " +"order to be loaded during unpickling." +msgstr "" + +#: library/multiprocessing.rst:566 +msgid "Example of this uncatchable error from the child::" +msgstr "" + +#: library/multiprocessing.rst:568 +msgid "" +">>> import multiprocessing as mp\n" +">>> def knigit():\n" +"... print(\"Ni!\")\n" +"...\n" +">>> process = mp.Process(target=knigit)\n" +">>> process.start()\n" +">>> Traceback (most recent call last):\n" +" File \".../multiprocessing/spawn.py\", line ..., in spawn_main\n" +" File \".../multiprocessing/spawn.py\", line ..., in _main\n" +"AttributeError: module '__main__' has no attribute 'knigit'\n" +">>> process\n" +"" +msgstr "" + +#: library/multiprocessing.rst:581 +msgid "" +"See :ref:`multiprocessing-programming-spawn`. While this restriction is not " +"true if using the ``\"fork\"`` start method, as of Python ``3.14`` that is " +"no longer the default on any platform. See :ref:`multiprocessing-start-" +"methods`. See also :gh:`132898`." +msgstr "" + +#: library/multiprocessing.rst:587 msgid "Added the *daemon* parameter." msgstr "" -#: library/multiprocessing.rst:526 +#: library/multiprocessing.rst:592 msgid "Method representing the process's activity." msgstr "" -#: library/multiprocessing.rst:528 +#: library/multiprocessing.rst:594 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the target " @@ -487,27 +834,38 @@ msgid "" "*args* and *kwargs* arguments, respectively." msgstr "" -#: library/multiprocessing.rst:533 +#: library/multiprocessing.rst:599 msgid "" "Using a list or tuple as the *args* argument passed to :class:`Process` " "achieves the same effect." msgstr "" -#: library/multiprocessing.rst:536 +#: library/multiprocessing.rst:602 msgid "Example::" msgstr "" -#: library/multiprocessing.rst:548 +#: library/multiprocessing.rst:604 +msgid "" +">>> from multiprocessing import Process\n" +">>> p = Process(target=print, args=[1])\n" +">>> p.run()\n" +"1\n" +">>> p = Process(target=print, args=(1,))\n" +">>> p.run()\n" +"1" +msgstr "" + +#: library/multiprocessing.rst:614 msgid "Start the process's activity." msgstr "" -#: library/multiprocessing.rst:550 +#: library/multiprocessing.rst:616 msgid "" "This must be called at most once per process object. It arranges for the " "object's :meth:`run` method to be invoked in a separate process." msgstr "" -#: library/multiprocessing.rst:555 +#: library/multiprocessing.rst:621 msgid "" "If the optional argument *timeout* is ``None`` (the default), the method " "blocks until the process whose :meth:`join` method is called terminates. If " @@ -517,23 +875,23 @@ msgid "" "terminated." msgstr "" -#: library/multiprocessing.rst:562 +#: library/multiprocessing.rst:628 msgid "A process can be joined many times." msgstr "" -#: library/multiprocessing.rst:564 +#: library/multiprocessing.rst:630 msgid "" "A process cannot join itself because this would cause a deadlock. It is an " "error to attempt to join a process before it has been started." msgstr "" -#: library/multiprocessing.rst:569 +#: library/multiprocessing.rst:635 msgid "" "The process's name. The name is a string used for identification purposes " "only. It has no semantics. Multiple processes may be given the same name." msgstr "" -#: library/multiprocessing.rst:573 +#: library/multiprocessing.rst:639 msgid "" "The initial name is set by the constructor. If no explicit name is provided " "to the constructor, a name of the form 'Process-N\\ :sub:`1`:N\\ :sub:" @@ -541,33 +899,33 @@ msgid "" "child of its parent." msgstr "" -#: library/multiprocessing.rst:580 +#: library/multiprocessing.rst:646 msgid "Return whether the process is alive." msgstr "" -#: library/multiprocessing.rst:582 +#: library/multiprocessing.rst:648 msgid "" "Roughly, a process object is alive from the moment the :meth:`start` method " "returns until the child process terminates." msgstr "" -#: library/multiprocessing.rst:587 +#: library/multiprocessing.rst:653 msgid "" "The process's daemon flag, a Boolean value. This must be set before :meth:" "`start` is called." msgstr "" -#: library/multiprocessing.rst:590 +#: library/multiprocessing.rst:656 msgid "The initial value is inherited from the creating process." msgstr "" -#: library/multiprocessing.rst:592 +#: library/multiprocessing.rst:658 msgid "" "When a process exits, it attempts to terminate all of its daemonic child " "processes." msgstr "" -#: library/multiprocessing.rst:595 +#: library/multiprocessing.rst:661 msgid "" "Note that a daemonic process is not allowed to create child processes. " "Otherwise a daemonic process would leave its children orphaned if it gets " @@ -576,92 +934,120 @@ msgid "" "(and not joined) if non-daemonic processes have exited." msgstr "" -#: library/multiprocessing.rst:601 +#: library/multiprocessing.rst:667 msgid "" "In addition to the :class:`threading.Thread` API, :class:`Process` objects " "also support the following attributes and methods:" msgstr "" -#: library/multiprocessing.rst:606 +#: library/multiprocessing.rst:672 msgid "" "Return the process ID. Before the process is spawned, this will be ``None``." msgstr "" -#: library/multiprocessing.rst:611 +#: library/multiprocessing.rst:677 msgid "" "The child's exit code. This will be ``None`` if the process has not yet " "terminated." msgstr "" -#: library/multiprocessing.rst:614 +#: library/multiprocessing.rst:680 msgid "" "If the child's :meth:`run` method returned normally, the exit code will be " "0. If it terminated via :func:`sys.exit` with an integer argument *N*, the " "exit code will be *N*." msgstr "" -#: library/multiprocessing.rst:618 +#: library/multiprocessing.rst:684 msgid "" "If the child terminated due to an exception not caught within :meth:`run`, " "the exit code will be 1. If it was terminated by signal *N*, the exit code " "will be the negative value *-N*." msgstr "" -#: library/multiprocessing.rst:624 +#: library/multiprocessing.rst:690 msgid "The process's authentication key (a byte string)." msgstr "" -#: library/multiprocessing.rst:626 +#: library/multiprocessing.rst:692 msgid "" "When :mod:`multiprocessing` is initialized the main process is assigned a " "random string using :func:`os.urandom`." msgstr "" -#: library/multiprocessing.rst:629 +#: library/multiprocessing.rst:695 msgid "" "When a :class:`Process` object is created, it will inherit the " "authentication key of its parent process, although this may be changed by " "setting :attr:`authkey` to another byte string." msgstr "" -#: library/multiprocessing.rst:633 +#: library/multiprocessing.rst:699 msgid "See :ref:`multiprocessing-auth-keys`." msgstr "" -#: library/multiprocessing.rst:637 +#: library/multiprocessing.rst:703 msgid "" "A numeric handle of a system object which will become \"ready\" when the " "process ends." msgstr "" -#: library/multiprocessing.rst:640 +#: library/multiprocessing.rst:706 msgid "" "You can use this value if you want to wait on several events at once using :" -"func:`multiprocessing.connection.wait`. Otherwise calling :meth:`join()` is " +"func:`multiprocessing.connection.wait`. Otherwise calling :meth:`join` is " "simpler." msgstr "" -#: library/multiprocessing.rst:644 +#: library/multiprocessing.rst:710 msgid "" "On Windows, this is an OS handle usable with the ``WaitForSingleObject`` and " "``WaitForMultipleObjects`` family of API calls. On POSIX, this is a file " "descriptor usable with primitives from the :mod:`select` module." msgstr "" -#: library/multiprocessing.rst:652 +#: library/multiprocessing.rst:718 +msgid "" +"Terminate the process. Works on POSIX using the :py:const:`~signal.SIGINT` " +"signal. Behavior on Windows is undefined." +msgstr "" + +#: library/multiprocessing.rst:721 +msgid "" +"By default, this terminates the child process by raising :exc:" +"`KeyboardInterrupt`. This behavior can be altered by setting the respective " +"signal handler in the child process :func:`signal.signal` for :py:const:" +"`~signal.SIGINT`." +msgstr "" + +#: library/multiprocessing.rst:725 +msgid "" +"Note: if the child process catches and discards :exc:`KeyboardInterrupt`, " +"the process will not be terminated." +msgstr "" + +#: library/multiprocessing.rst:728 +msgid "" +"Note: the default behavior will also set :attr:`exitcode` to ``1`` as if an " +"uncaught exception was raised in the child process. To have a different :" +"attr:`exitcode` you may simply catch :exc:`KeyboardInterrupt` and call " +"``exit(your_code)``." +msgstr "" + +#: library/multiprocessing.rst:737 msgid "" "Terminate the process. On POSIX this is done using the :py:const:`~signal." "SIGTERM` signal; on Windows :c:func:`!TerminateProcess` is used. Note that " "exit handlers and finally clauses, etc., will not be executed." msgstr "" -#: library/multiprocessing.rst:656 +#: library/multiprocessing.rst:741 msgid "" "Note that descendant processes of the process will *not* be terminated -- " "they will simply become orphaned." msgstr "" -#: library/multiprocessing.rst:661 +#: library/multiprocessing.rst:746 msgid "" "If this method is used when the associated process is using a pipe or queue " "then the pipe or queue is liable to become corrupted and may become unusable " @@ -670,11 +1056,11 @@ msgid "" "deadlock." msgstr "" -#: library/multiprocessing.rst:669 -msgid "Same as :meth:`terminate()` but using the ``SIGKILL`` signal on POSIX." +#: library/multiprocessing.rst:754 +msgid "Same as :meth:`terminate` but using the ``SIGKILL`` signal on POSIX." msgstr "" -#: library/multiprocessing.rst:675 +#: library/multiprocessing.rst:760 msgid "" "Close the :class:`Process` object, releasing all resources associated with " "it. :exc:`ValueError` is raised if the underlying process is still " @@ -682,59 +1068,77 @@ msgid "" "attributes of the :class:`Process` object will raise :exc:`ValueError`." msgstr "" -#: library/multiprocessing.rst:683 +#: library/multiprocessing.rst:768 msgid "" "Note that the :meth:`start`, :meth:`join`, :meth:`is_alive`, :meth:" "`terminate` and :attr:`exitcode` methods should only be called by the " "process that created the process object." msgstr "" -#: library/multiprocessing.rst:687 +#: library/multiprocessing.rst:772 msgid "Example usage of some of the methods of :class:`Process`:" msgstr "" -#: library/multiprocessing.rst:708 +#: library/multiprocessing.rst:774 +msgid "" +">>> import multiprocessing, time, signal\n" +">>> mp_context = multiprocessing.get_context('spawn')\n" +">>> p = mp_context.Process(target=time.sleep, args=(1000,))\n" +">>> print(p, p.is_alive())\n" +"<...Process ... initial> False\n" +">>> p.start()\n" +">>> print(p, p.is_alive())\n" +"<...Process ... started> True\n" +">>> p.terminate()\n" +">>> time.sleep(0.1)\n" +">>> print(p, p.is_alive())\n" +"<...Process ... stopped exitcode=-SIGTERM> False\n" +">>> p.exitcode == -signal.SIGTERM\n" +"True" +msgstr "" + +#: library/multiprocessing.rst:793 msgid "The base class of all :mod:`multiprocessing` exceptions." msgstr "" -#: library/multiprocessing.rst:712 +#: library/multiprocessing.rst:797 msgid "" -"Exception raised by :meth:`Connection.recv_bytes_into()` when the supplied " +"Exception raised by :meth:`Connection.recv_bytes_into` when the supplied " "buffer object is too small for the message read." msgstr "" -#: library/multiprocessing.rst:715 +#: library/multiprocessing.rst:800 msgid "" "If ``e`` is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will " "give the message as a byte string." msgstr "" -#: library/multiprocessing.rst:720 +#: library/multiprocessing.rst:805 msgid "Raised when there is an authentication error." msgstr "" -#: library/multiprocessing.rst:724 +#: library/multiprocessing.rst:809 msgid "Raised by methods with a timeout when the timeout expires." msgstr "" -#: library/multiprocessing.rst:727 +#: library/multiprocessing.rst:812 msgid "Pipes and Queues" msgstr "" -#: library/multiprocessing.rst:729 +#: library/multiprocessing.rst:814 msgid "" "When using multiple processes, one generally uses message passing for " "communication between processes and avoids having to use any synchronization " "primitives like locks." msgstr "" -#: library/multiprocessing.rst:733 +#: library/multiprocessing.rst:818 msgid "" "For passing messages one can use :func:`Pipe` (for a connection between two " "processes) or a queue (which allows multiple producers and consumers)." msgstr "" -#: library/multiprocessing.rst:736 +#: library/multiprocessing.rst:821 msgid "" "The :class:`Queue`, :class:`SimpleQueue` and :class:`JoinableQueue` types " "are multi-producer, multi-consumer :abbr:`FIFO (first-in, first-out)` queues " @@ -744,7 +1148,7 @@ msgid "" "Queue` class." msgstr "" -#: library/multiprocessing.rst:743 +#: library/multiprocessing.rst:828 msgid "" "If you use :class:`JoinableQueue` then you **must** call :meth:" "`JoinableQueue.task_done` for each task removed from the queue or else the " @@ -752,20 +1156,28 @@ msgid "" "overflow, raising an exception." msgstr "" -#: library/multiprocessing.rst:748 +#: library/multiprocessing.rst:833 +msgid "" +"One difference from other Python queue implementations, is that :mod:" +"`multiprocessing` queues serializes all objects that are put into them " +"using :mod:`pickle`. The object returned by the get method is a re-created " +"object that does not share memory with the original object." +msgstr "" + +#: library/multiprocessing.rst:838 msgid "" "Note that one can also create a shared queue by using a manager object -- " "see :ref:`multiprocessing-managers`." msgstr "" -#: library/multiprocessing.rst:753 +#: library/multiprocessing.rst:843 msgid "" ":mod:`multiprocessing` uses the usual :exc:`queue.Empty` and :exc:`queue." "Full` exceptions to signal a timeout. They are not available in the :mod:" "`multiprocessing` namespace so you need to import them from :mod:`queue`." msgstr "" -#: library/multiprocessing.rst:760 +#: library/multiprocessing.rst:850 msgid "" "When an object is put on a queue, the object is pickled and a background " "thread later flushes the pickled data to an underlying pipe. This has some " @@ -774,14 +1186,14 @@ msgid "" "a queue created with a :ref:`manager `." msgstr "" -#: library/multiprocessing.rst:767 +#: library/multiprocessing.rst:857 msgid "" "After putting an object on an empty queue there may be an infinitesimal " "delay before the queue's :meth:`~Queue.empty` method returns :const:`False` " "and :meth:`~Queue.get_nowait` can return without raising :exc:`queue.Empty`." msgstr "" -#: library/multiprocessing.rst:772 +#: library/multiprocessing.rst:862 msgid "" "If multiple processes are enqueuing objects, it is possible for the objects " "to be received at the other end out-of-order. However, objects enqueued by " @@ -789,7 +1201,7 @@ msgid "" "other." msgstr "" -#: library/multiprocessing.rst:779 +#: library/multiprocessing.rst:869 msgid "" "If a process is killed using :meth:`Process.terminate` or :func:`os.kill` " "while it is trying to use a :class:`Queue`, then the data in the queue is " @@ -797,7 +1209,7 @@ msgid "" "exception when it tries to use the queue later on." msgstr "" -#: library/multiprocessing.rst:786 +#: library/multiprocessing.rst:876 msgid "" "As mentioned above, if a child process has put items on a queue (and it has " "not used :meth:`JoinableQueue.cancel_join_thread ` flag or :envvar:`PYTHON_CPU_COUNT` as this is merely a wrapper around " +"the :mod:`os` cpu count APIs." msgstr "" -#: library/multiprocessing.rst:1009 +#: library/multiprocessing.rst:1117 msgid "" "Return the :class:`Process` object corresponding to the current process." msgstr "" -#: library/multiprocessing.rst:1011 +#: library/multiprocessing.rst:1119 msgid "An analogue of :func:`threading.current_thread`." msgstr "" -#: library/multiprocessing.rst:1015 +#: library/multiprocessing.rst:1123 msgid "" "Return the :class:`Process` object corresponding to the parent process of " "the :func:`current_process`. For the main process, ``parent_process`` will " "be ``None``." msgstr "" -#: library/multiprocessing.rst:1023 +#: library/multiprocessing.rst:1131 msgid "" "Add support for when a program which uses :mod:`multiprocessing` has been " -"frozen to produce a Windows executable. (Has been tested with **py2exe**, " +"frozen to produce an executable. (Has been tested with **py2exe**, " "**PyInstaller** and **cx_Freeze**.)" msgstr "" -#: library/multiprocessing.rst:1027 +#: library/multiprocessing.rst:1135 msgid "" "One needs to call this function straight after the ``if __name__ == " "'__main__'`` line of the main module. For example::" msgstr "" -#: library/multiprocessing.rst:1039 +#: library/multiprocessing.rst:1138 +msgid "" +"from multiprocessing import Process, freeze_support\n" +"\n" +"def f():\n" +" print('hello world!')\n" +"\n" +"if __name__ == '__main__':\n" +" freeze_support()\n" +" Process(target=f).start()" +msgstr "" + +#: library/multiprocessing.rst:1147 msgid "" "If the ``freeze_support()`` line is omitted then trying to run the frozen " "executable will raise :exc:`RuntimeError`." msgstr "" -#: library/multiprocessing.rst:1042 +#: library/multiprocessing.rst:1150 msgid "" -"Calling ``freeze_support()`` has no effect when invoked on any operating " -"system other than Windows. In addition, if the module is being run normally " -"by the Python interpreter on Windows (the program has not been frozen), then " -"``freeze_support()`` has no effect." +"Calling ``freeze_support()`` has no effect when the start method is not " +"*spawn*. In addition, if the module is being run normally by the Python " +"interpreter (the program has not been frozen), then ``freeze_support()`` has " +"no effect." msgstr "" -#: library/multiprocessing.rst:1049 +#: library/multiprocessing.rst:1157 msgid "" "Returns a list of the supported start methods, the first of which is the " "default. The possible start methods are ``'fork'``, ``'spawn'`` and " @@ -1132,64 +1583,70 @@ msgid "" "`multiprocessing-start-methods`." msgstr "" -#: library/multiprocessing.rst:1058 +#: library/multiprocessing.rst:1166 msgid "" "Return a context object which has the same attributes as the :mod:" "`multiprocessing` module." msgstr "" -#: library/multiprocessing.rst:1061 +#: library/multiprocessing.rst:1169 msgid "" -"If *method* is ``None`` then the default context is returned. Otherwise " -"*method* should be ``'fork'``, ``'spawn'``, ``'forkserver'``. :exc:" -"`ValueError` is raised if the specified start method is not available. See :" -"ref:`multiprocessing-start-methods`." +"If *method* is ``None`` then the default context is returned. Note that if " +"the global start method has not been set, this will set it to the default " +"method. Otherwise *method* should be ``'fork'``, ``'spawn'``, " +"``'forkserver'``. :exc:`ValueError` is raised if the specified start method " +"is not available. See :ref:`multiprocessing-start-methods`." msgstr "" -#: library/multiprocessing.rst:1070 +#: library/multiprocessing.rst:1180 msgid "Return the name of start method used for starting processes." msgstr "" -#: library/multiprocessing.rst:1072 +#: library/multiprocessing.rst:1182 msgid "" -"If the start method has not been fixed and *allow_none* is false, then the " -"start method is fixed to the default and the name is returned. If the start " -"method has not been fixed and *allow_none* is true then ``None`` is returned." +"If the global start method has not been set and *allow_none* is ``False``, " +"then the start method is set to the default and the name is returned. If the " +"start method has not been set and *allow_none* is ``True`` then ``None`` is " +"returned." msgstr "" -#: library/multiprocessing.rst:1077 +#: library/multiprocessing.rst:1187 msgid "" "The return value can be ``'fork'``, ``'spawn'``, ``'forkserver'`` or " "``None``. See :ref:`multiprocessing-start-methods`." msgstr "" -#: library/multiprocessing.rst:1084 +#: library/multiprocessing.rst:1194 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess. See :issue:`33725`." msgstr "" -#: library/multiprocessing.rst:1090 +#: library/multiprocessing.rst:1200 msgid "" "Set the path of the Python interpreter to use when starting a child process. " "(By default :data:`sys.executable` is used). Embedders will probably need " "to do some thing like ::" msgstr "" -#: library/multiprocessing.rst:1096 +#: library/multiprocessing.rst:1204 +msgid "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" +msgstr "" + +#: library/multiprocessing.rst:1206 msgid "before they can create child processes." msgstr "" -#: library/multiprocessing.rst:1098 +#: library/multiprocessing.rst:1208 msgid "Now supported on POSIX when the ``'spawn'`` start method is used." msgstr "" -#: library/multiprocessing.rst:1101 +#: library/multiprocessing.rst:1211 msgid "Accepts a :term:`path-like object`." msgstr "" -#: library/multiprocessing.rst:1106 +#: library/multiprocessing.rst:1216 msgid "" "Set a list of module names for the forkserver main process to attempt to " "import so that their already imported state is inherited by forked " @@ -1198,19 +1655,19 @@ msgid "" "process." msgstr "" -#: library/multiprocessing.rst:1112 +#: library/multiprocessing.rst:1222 msgid "" "For this to work, it must be called before the forkserver process has been " "launched (before creating a :class:`Pool` or starting a :class:`Process`)." msgstr "" -#: library/multiprocessing.rst:1115 +#: library/multiprocessing.rst:1225 msgid "" "Only meaningful when using the ``'forkserver'`` start method. See :ref:" "`multiprocessing-start-methods`." msgstr "" -#: library/multiprocessing.rst:1122 +#: library/multiprocessing.rst:1232 msgid "" "Set the method which should be used to start child processes. The *method* " "argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. Raises :exc:" @@ -1220,17 +1677,17 @@ msgid "" "then the context is set to the default context." msgstr "" -#: library/multiprocessing.rst:1129 +#: library/multiprocessing.rst:1239 msgid "" "Note that this should be called at most once, and it should be protected " "inside the ``if __name__ == '__main__'`` clause of the main module." msgstr "" -#: library/multiprocessing.rst:1133 +#: library/multiprocessing.rst:1243 msgid "See :ref:`multiprocessing-start-methods`." msgstr "" -#: library/multiprocessing.rst:1139 +#: library/multiprocessing.rst:1249 msgid "" ":mod:`multiprocessing` contains no analogues of :func:`threading." "active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :" @@ -1238,75 +1695,75 @@ msgid "" "local`." msgstr "" -#: library/multiprocessing.rst:1146 +#: library/multiprocessing.rst:1256 msgid "Connection Objects" msgstr "" -#: library/multiprocessing.rst:1150 +#: library/multiprocessing.rst:1260 msgid "" "Connection objects allow the sending and receiving of picklable objects or " "strings. They can be thought of as message oriented connected sockets." msgstr "" -#: library/multiprocessing.rst:1153 +#: library/multiprocessing.rst:1263 msgid "" "Connection objects are usually created using :func:`Pipe ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: library/multiprocessing.rst:1161 +#: library/multiprocessing.rst:1271 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: library/multiprocessing.rst:1164 +#: library/multiprocessing.rst:1274 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: library/multiprocessing.rst:1169 +#: library/multiprocessing.rst:1279 msgid "" "Return an object sent from the other end of the connection using :meth:" "`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " "if there is nothing left to receive and the other end was closed." msgstr "" -#: library/multiprocessing.rst:1176 +#: library/multiprocessing.rst:1286 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: library/multiprocessing.rst:1180 +#: library/multiprocessing.rst:1290 msgid "Close the connection." msgstr "" -#: library/multiprocessing.rst:1182 +#: library/multiprocessing.rst:1292 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: library/multiprocessing.rst:1186 +#: library/multiprocessing.rst:1296 msgid "Return whether there is any data available to be read." msgstr "" -#: library/multiprocessing.rst:1188 +#: library/multiprocessing.rst:1298 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: library/multiprocessing.rst:1192 +#: library/multiprocessing.rst:1302 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: library/multiprocessing.rst:1197 +#: library/multiprocessing.rst:1307 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: library/multiprocessing.rst:1199 +#: library/multiprocessing.rst:1309 msgid "" "If *offset* is given then data is read from that position in *buffer*. If " "*size* is given then that many bytes will be read from buffer. Very large " @@ -1314,7 +1771,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: library/multiprocessing.rst:1206 +#: library/multiprocessing.rst:1316 msgid "" "Return a complete message of byte data sent from the other end of the " "connection as a string. Blocks until there is something to receive. Raises :" @@ -1322,19 +1779,19 @@ msgid "" "closed." msgstr "" -#: library/multiprocessing.rst:1211 +#: library/multiprocessing.rst:1321 msgid "" "If *maxlength* is specified and the message is longer than *maxlength* then :" "exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: library/multiprocessing.rst:1215 +#: library/multiprocessing.rst:1325 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: library/multiprocessing.rst:1222 +#: library/multiprocessing.rst:1332 msgid "" "Read into *buffer* a complete message of byte data sent from the other end " "of the connection and return the number of bytes in the message. Blocks " @@ -1342,45 +1799,65 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: library/multiprocessing.rst:1228 +#: library/multiprocessing.rst:1338 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: library/multiprocessing.rst:1233 +#: library/multiprocessing.rst:1343 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: library/multiprocessing.rst:1237 +#: library/multiprocessing.rst:1347 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: library/multiprocessing.rst:1241 +#: library/multiprocessing.rst:1351 msgid "" "Connection objects also now support the context management protocol -- see :" "ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: library/multiprocessing.rst:1245 +#: library/multiprocessing.rst:1355 msgid "For example:" msgstr "" -#: library/multiprocessing.rst:1270 +#: library/multiprocessing.rst:1357 +msgid "" +">>> from multiprocessing import Pipe\n" +">>> a, b = Pipe()\n" +">>> a.send([1, 'hello', None])\n" +">>> b.recv()\n" +"[1, 'hello', None]\n" +">>> b.send_bytes(b'thank you')\n" +">>> a.recv_bytes()\n" +"b'thank you'\n" +">>> import array\n" +">>> arr1 = array.array('i', range(5))\n" +">>> arr2 = array.array('i', [0] * 10)\n" +">>> a.send_bytes(arr1)\n" +">>> count = b.recv_bytes_into(arr2)\n" +">>> assert count == len(arr1) * arr1.itemsize\n" +">>> arr2\n" +"array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])" +msgstr "" + +#: library/multiprocessing.rst:1380 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: library/multiprocessing.rst:1274 +#: library/multiprocessing.rst:1384 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -1388,71 +1865,76 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: library/multiprocessing.rst:1281 +#: library/multiprocessing.rst:1391 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: library/multiprocessing.rst:1287 +#: library/multiprocessing.rst:1397 msgid "Synchronization primitives" msgstr "" -#: library/multiprocessing.rst:1291 +#: library/multiprocessing.rst:1401 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " "program as they are in a multithreaded program. See the documentation for :" "mod:`threading` module." msgstr "" -#: library/multiprocessing.rst:1295 +#: library/multiprocessing.rst:1405 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: library/multiprocessing.rst:1300 +#: library/multiprocessing.rst:1410 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: library/multiprocessing.rst:1306 +#: library/multiprocessing.rst:1416 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: library/multiprocessing.rst:1309 library/multiprocessing.rst:1447 +#: library/multiprocessing.rst:1419 library/multiprocessing.rst:1577 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: library/multiprocessing.rst:1313 +#: library/multiprocessing.rst:1424 library/multiprocessing.rst:1501 +#: library/multiprocessing.rst:1568 library/multiprocessing.rst:1591 +msgid "Return a boolean indicating whether this object is locked right now." +msgstr "" + +#: library/multiprocessing.rst:1429 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: library/multiprocessing.rst:1318 +#: library/multiprocessing.rst:1434 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: library/multiprocessing.rst:1320 +#: library/multiprocessing.rst:1436 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: library/multiprocessing.rst:1323 library/multiprocessing.rst:1872 +#: library/multiprocessing.rst:1439 library/multiprocessing.rst:2007 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: library/multiprocessing.rst:1328 +#: library/multiprocessing.rst:1444 msgid "A clone of :class:`threading.Event`." msgstr "" -#: library/multiprocessing.rst:1333 +#: library/multiprocessing.rst:1449 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " @@ -1463,24 +1945,24 @@ msgid "" "as noted." msgstr "" -#: library/multiprocessing.rst:1341 +#: library/multiprocessing.rst:1457 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: library/multiprocessing.rst:1345 +#: library/multiprocessing.rst:1461 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: library/multiprocessing.rst:1350 library/multiprocessing.rst:1401 +#: library/multiprocessing.rst:1466 library/multiprocessing.rst:1524 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: library/multiprocessing.rst:1352 +#: library/multiprocessing.rst:1468 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -1488,14 +1970,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: library/multiprocessing.rst:1357 +#: library/multiprocessing.rst:1473 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: library/multiprocessing.rst:1361 +#: library/multiprocessing.rst:1477 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -1509,19 +1991,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: library/multiprocessing.rst:1376 +#: library/multiprocessing.rst:1492 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: library/multiprocessing.rst:1379 +#: library/multiprocessing.rst:1495 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: library/multiprocessing.rst:1385 +#: library/multiprocessing.rst:1508 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -1530,20 +2012,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: library/multiprocessing.rst:1391 +#: library/multiprocessing.rst:1514 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: library/multiprocessing.rst:1395 +#: library/multiprocessing.rst:1518 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: library/multiprocessing.rst:1403 +#: library/multiprocessing.rst:1526 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -1556,7 +2038,7 @@ msgid "" "itself." msgstr "" -#: library/multiprocessing.rst:1413 +#: library/multiprocessing.rst:1536 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -1567,14 +2049,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: library/multiprocessing.rst:1421 +#: library/multiprocessing.rst:1544 msgid "" "Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." "acquire`. Note that some of these behaviors of *timeout* differ from the " "implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: library/multiprocessing.rst:1428 +#: library/multiprocessing.rst:1551 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -1584,7 +2066,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: library/multiprocessing.rst:1436 +#: library/multiprocessing.rst:1559 msgid "" "Only call this method when the calling process or thread owns the lock. An :" "exc:`AssertionError` is raised if this method is called by a process or " @@ -1593,32 +2075,21 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: library/multiprocessing.rst:1445 +#: library/multiprocessing.rst:1575 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: library/multiprocessing.rst:1452 -msgid "" -"On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " -"timeout will emulate that function's behavior using a sleeping loop." -msgstr "" - -#: library/multiprocessing.rst:1457 -msgid "" -"If the SIGINT signal generated by :kbd:`Ctrl-C` arrives while the main " -"thread is blocked by a call to :meth:`BoundedSemaphore.acquire`, :meth:`Lock." -"acquire`, :meth:`RLock.acquire`, :meth:`Semaphore.acquire`, :meth:`Condition." -"acquire` or :meth:`Condition.wait` then the call will be immediately " -"interrupted and :exc:`KeyboardInterrupt` will be raised." +#: library/multiprocessing.rst:1583 +msgid "Return the current value of semaphore." msgstr "" -#: library/multiprocessing.rst:1463 +#: library/multiprocessing.rst:1598 msgid "" -"This differs from the behaviour of :mod:`threading` where SIGINT will be " -"ignored while the equivalent blocking calls are in progress." +"On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " +"timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: library/multiprocessing.rst:1468 +#: library/multiprocessing.rst:1603 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -1627,31 +2098,31 @@ msgid "" "additional information." msgstr "" -#: library/multiprocessing.rst:1476 +#: library/multiprocessing.rst:1611 msgid "Shared :mod:`ctypes` Objects" msgstr "" -#: library/multiprocessing.rst:1478 +#: library/multiprocessing.rst:1613 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: library/multiprocessing.rst:1483 +#: library/multiprocessing.rst:1618 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: library/multiprocessing.rst:1487 library/multiprocessing.rst:1574 +#: library/multiprocessing.rst:1622 library/multiprocessing.rst:1709 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " "a ctypes type or a one character typecode of the kind used by the :mod:" "`array` module. *\\*args* is passed on to the constructor for the type." msgstr "" -#: library/multiprocessing.rst:1491 +#: library/multiprocessing.rst:1626 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -1661,31 +2132,41 @@ msgid "" "\"process-safe\"." msgstr "" -#: library/multiprocessing.rst:1498 +#: library/multiprocessing.rst:1633 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: library/multiprocessing.rst:1504 +#: library/multiprocessing.rst:1637 +msgid "counter.value += 1" +msgstr "" + +#: library/multiprocessing.rst:1639 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: library/multiprocessing.rst:1510 library/multiprocessing.rst:1600 -#: library/multiprocessing.rst:1615 +#: library/multiprocessing.rst:1642 +msgid "" +"with counter.get_lock():\n" +" counter.value += 1" +msgstr "" + +#: library/multiprocessing.rst:1645 library/multiprocessing.rst:1735 +#: library/multiprocessing.rst:1750 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: library/multiprocessing.rst:1514 +#: library/multiprocessing.rst:1649 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: library/multiprocessing.rst:1517 +#: library/multiprocessing.rst:1652 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -1695,7 +2176,7 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: library/multiprocessing.rst:1524 +#: library/multiprocessing.rst:1659 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`Lock` or :class:" @@ -1705,28 +2186,28 @@ msgid "" "safe\"." msgstr "" -#: library/multiprocessing.rst:1531 +#: library/multiprocessing.rst:1666 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: library/multiprocessing.rst:1533 +#: library/multiprocessing.rst:1668 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: library/multiprocessing.rst:1538 +#: library/multiprocessing.rst:1673 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr "" -#: library/multiprocessing.rst:1543 +#: library/multiprocessing.rst:1678 msgid "" "The :mod:`multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: library/multiprocessing.rst:1549 +#: library/multiprocessing.rst:1684 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -1735,11 +2216,11 @@ msgid "" "may cause a crash." msgstr "" -#: library/multiprocessing.rst:1557 +#: library/multiprocessing.rst:1692 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: library/multiprocessing.rst:1559 +#: library/multiprocessing.rst:1694 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -1749,39 +2230,39 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: library/multiprocessing.rst:1566 +#: library/multiprocessing.rst:1701 msgid "" "Note that setting and getting an element is potentially non-atomic -- use :" "func:`Array` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: library/multiprocessing.rst:1572 +#: library/multiprocessing.rst:1707 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: library/multiprocessing.rst:1578 +#: library/multiprocessing.rst:1713 msgid "" "Note that setting and getting the value is potentially non-atomic -- use :" "func:`Value` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: library/multiprocessing.rst:1582 +#: library/multiprocessing.rst:1717 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: library/multiprocessing.rst:1588 +#: library/multiprocessing.rst:1723 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: library/multiprocessing.rst:1592 library/multiprocessing.rst:1608 +#: library/multiprocessing.rst:1727 library/multiprocessing.rst:1743 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`~multiprocessing." @@ -1791,121 +2272,164 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: library/multiprocessing.rst:1604 +#: library/multiprocessing.rst:1739 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: library/multiprocessing.rst:1619 +#: library/multiprocessing.rst:1754 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: library/multiprocessing.rst:1624 +#: library/multiprocessing.rst:1759 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " "to synchronize access. If *lock* is ``None`` (the default) then a :class:" "`multiprocessing.RLock` object is created automatically." msgstr "" -#: library/multiprocessing.rst:1628 +#: library/multiprocessing.rst:1763 msgid "" "A synchronized wrapper will have two methods in addition to those of the " "object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" "`get_lock` returns the lock object used for synchronization." msgstr "" -#: library/multiprocessing.rst:1632 +#: library/multiprocessing.rst:1767 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: library/multiprocessing.rst:1635 +#: library/multiprocessing.rst:1770 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: library/multiprocessing.rst:1639 +#: library/multiprocessing.rst:1774 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: library/multiprocessing.rst:1644 +#: library/multiprocessing.rst:1779 msgid "ctypes" msgstr "" -#: library/multiprocessing.rst:1644 +#: library/multiprocessing.rst:1779 msgid "sharedctypes using type" msgstr "" -#: library/multiprocessing.rst:1644 +#: library/multiprocessing.rst:1779 msgid "sharedctypes using typecode" msgstr "" -#: library/multiprocessing.rst:1646 +#: library/multiprocessing.rst:1781 msgid "c_double(2.4)" msgstr "" -#: library/multiprocessing.rst:1646 +#: library/multiprocessing.rst:1781 msgid "RawValue(c_double, 2.4)" msgstr "" -#: library/multiprocessing.rst:1646 +#: library/multiprocessing.rst:1781 msgid "RawValue('d', 2.4)" msgstr "" -#: library/multiprocessing.rst:1647 +#: library/multiprocessing.rst:1782 msgid "MyStruct(4, 6)" msgstr "" -#: library/multiprocessing.rst:1647 +#: library/multiprocessing.rst:1782 msgid "RawValue(MyStruct, 4, 6)" msgstr "" -#: library/multiprocessing.rst:1648 +#: library/multiprocessing.rst:1783 msgid "(c_short * 7)()" msgstr "" -#: library/multiprocessing.rst:1648 +#: library/multiprocessing.rst:1783 msgid "RawArray(c_short, 7)" msgstr "" -#: library/multiprocessing.rst:1648 +#: library/multiprocessing.rst:1783 msgid "RawArray('h', 7)" msgstr "" -#: library/multiprocessing.rst:1649 +#: library/multiprocessing.rst:1784 msgid "(c_int * 3)(9, 2, 8)" msgstr "" -#: library/multiprocessing.rst:1649 +#: library/multiprocessing.rst:1784 msgid "RawArray(c_int, (9, 2, 8))" msgstr "" -#: library/multiprocessing.rst:1649 +#: library/multiprocessing.rst:1784 msgid "RawArray('i', (9, 2, 8))" msgstr "" -#: library/multiprocessing.rst:1653 +#: library/multiprocessing.rst:1788 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: library/multiprocessing.rst:1691 +#: library/multiprocessing.rst:1791 +msgid "" +"from multiprocessing import Process, Lock\n" +"from multiprocessing.sharedctypes import Value, Array\n" +"from ctypes import Structure, c_double\n" +"\n" +"class Point(Structure):\n" +" _fields_ = [('x', c_double), ('y', c_double)]\n" +"\n" +"def modify(n, x, s, A):\n" +" n.value **= 2\n" +" x.value **= 2\n" +" s.value = s.value.upper()\n" +" for a in A:\n" +" a.x **= 2\n" +" a.y **= 2\n" +"\n" +"if __name__ == '__main__':\n" +" lock = Lock()\n" +"\n" +" n = Value('i', 7)\n" +" x = Value(c_double, 1.0/3.0, lock=False)\n" +" s = Array('c', b'hello world', lock=lock)\n" +" A = Array(Point, [(1.875,-6.25), (-5.75,2.0), (2.375,9.5)], lock=lock)\n" +"\n" +" p = Process(target=modify, args=(n, x, s, A))\n" +" p.start()\n" +" p.join()\n" +"\n" +" print(n.value)\n" +" print(x.value)\n" +" print(s.value)\n" +" print([(a.x, a.y) for a in A])" +msgstr "" + +#: library/multiprocessing.rst:1826 msgid "The results printed are ::" msgstr "" -#: library/multiprocessing.rst:1704 +#: library/multiprocessing.rst:1828 +msgid "" +"49\n" +"0.1111111111111111\n" +"HELLO WORLD\n" +"[(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]" +msgstr "" + +#: library/multiprocessing.rst:1839 msgid "Managers" msgstr "" -#: library/multiprocessing.rst:1706 +#: library/multiprocessing.rst:1841 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -1914,7 +2438,7 @@ msgid "" "proxies." msgstr "" -#: library/multiprocessing.rst:1715 +#: library/multiprocessing.rst:1850 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -1922,31 +2446,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: library/multiprocessing.rst:1723 +#: library/multiprocessing.rst:1858 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " "their parent process exits. The manager classes are defined in the :mod:" "`multiprocessing.managers` module:" msgstr "" -#: library/multiprocessing.rst:1729 +#: library/multiprocessing.rst:1864 msgid "Create a BaseManager object." msgstr "" -#: library/multiprocessing.rst:1731 +#: library/multiprocessing.rst:1866 msgid "" "Once created one should call :meth:`start` or ``get_server()." "serve_forever()`` to ensure that the manager object refers to a started " "manager process." msgstr "" -#: library/multiprocessing.rst:1734 +#: library/multiprocessing.rst:1869 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: library/multiprocessing.rst:1737 +#: library/multiprocessing.rst:1872 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -1954,19 +2478,19 @@ msgid "" "it must be a byte string." msgstr "" -#: library/multiprocessing.rst:1742 +#: library/multiprocessing.rst:1877 msgid "" "*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " "``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." msgstr "" -#: library/multiprocessing.rst:1745 +#: library/multiprocessing.rst:1880 msgid "" "*ctx* is a context object, or ``None`` (use the current context). See the :" "func:`get_context` function." msgstr "" -#: library/multiprocessing.rst:1748 +#: library/multiprocessing.rst:1883 msgid "" "*shutdown_timeout* is a timeout in seconds used to wait until the process " "used by the manager completes in the :meth:`shutdown` method. If the " @@ -1974,54 +2498,69 @@ msgid "" "also times out, the process is killed." msgstr "" -#: library/multiprocessing.rst:1753 +#: library/multiprocessing.rst:1888 msgid "Added the *shutdown_timeout* parameter." msgstr "" -#: library/multiprocessing.rst:1758 +#: library/multiprocessing.rst:1893 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: library/multiprocessing.rst:1763 +#: library/multiprocessing.rst:1898 msgid "" "Returns a :class:`Server` object which represents the actual server under " "the control of the Manager. The :class:`Server` object supports the :meth:" "`serve_forever` method::" msgstr "" -#: library/multiprocessing.rst:1772 +#: library/multiprocessing.rst:1902 +msgid "" +">>> from multiprocessing.managers import BaseManager\n" +">>> manager = BaseManager(address=('', 50000), authkey=b'abc')\n" +">>> server = manager.get_server()\n" +">>> server.serve_forever()" +msgstr "" + +#: library/multiprocessing.rst:1907 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: library/multiprocessing.rst:1776 +#: library/multiprocessing.rst:1911 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: library/multiprocessing.rst:1784 +#: library/multiprocessing.rst:1913 +msgid "" +">>> from multiprocessing.managers import BaseManager\n" +">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" +">>> m.connect()" +msgstr "" + +#: library/multiprocessing.rst:1919 msgid "" "Stop the process used by the manager. This is only available if :meth:" "`start` has been used to start the server process." msgstr "" -#: library/multiprocessing.rst:1787 +#: library/multiprocessing.rst:1922 msgid "This can be called multiple times." msgstr "" -#: library/multiprocessing.rst:1791 +#: library/multiprocessing.rst:1926 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: library/multiprocessing.rst:1794 +#: library/multiprocessing.rst:1929 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: library/multiprocessing.rst:1797 +#: library/multiprocessing.rst:1932 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -2029,14 +2568,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: library/multiprocessing.rst:1803 +#: library/multiprocessing.rst:1938 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: library/multiprocessing.rst:1807 +#: library/multiprocessing.rst:1942 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -2047,7 +2586,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: library/multiprocessing.rst:1816 +#: library/multiprocessing.rst:1951 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " @@ -2057,22 +2596,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: library/multiprocessing.rst:1823 +#: library/multiprocessing.rst:1958 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: library/multiprocessing.rst:1827 +#: library/multiprocessing.rst:1962 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: library/multiprocessing.rst:1831 +#: library/multiprocessing.rst:1966 msgid "The address used by the manager." msgstr "" -#: library/multiprocessing.rst:1833 +#: library/multiprocessing.rst:1968 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -2080,173 +2619,274 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: library/multiprocessing.rst:1839 +#: library/multiprocessing.rst:1974 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: library/multiprocessing.rst:1844 +#: library/multiprocessing.rst:1979 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " "of processes. Objects of this type are returned by :func:`multiprocessing." "Manager`." msgstr "" -#: library/multiprocessing.rst:1848 +#: library/multiprocessing.rst:1983 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: library/multiprocessing.rst:1854 +#: library/multiprocessing.rst:1989 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1861 +#: library/multiprocessing.rst:1996 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: library/multiprocessing.rst:1866 +#: library/multiprocessing.rst:2001 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: library/multiprocessing.rst:1869 +#: library/multiprocessing.rst:2004 msgid "" "If *lock* is supplied then it should be a proxy for a :class:`threading." "Lock` or :class:`threading.RLock` object." msgstr "" -#: library/multiprocessing.rst:1877 +#: library/multiprocessing.rst:2012 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1881 +#: library/multiprocessing.rst:2016 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1885 +#: library/multiprocessing.rst:2020 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1889 +#: library/multiprocessing.rst:2024 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1893 +#: library/multiprocessing.rst:2028 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1897 +#: library/multiprocessing.rst:2032 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: library/multiprocessing.rst:1902 +#: library/multiprocessing.rst:2037 msgid "Create an array and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1906 +#: library/multiprocessing.rst:2041 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: library/multiprocessing.rst:1913 +#: library/multiprocessing.rst:2048 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1918 +#: library/multiprocessing.rst:2053 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: library/multiprocessing.rst:1920 +#: library/multiprocessing.rst:2059 +msgid "Create a shared :class:`set` object and return a proxy for it." +msgstr "" + +#: library/multiprocessing.rst:2061 +msgid ":class:`set` support was added." +msgstr "" + +#: library/multiprocessing.rst:2064 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: library/multiprocessing.rst:1927 +#: library/multiprocessing.rst:2071 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: library/multiprocessing.rst:1929 +#: library/multiprocessing.rst:2073 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: library/multiprocessing.rst:1932 +#: library/multiprocessing.rst:2076 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: library/multiprocessing.rst:1949 +#: library/multiprocessing.rst:2080 +msgid "" +">>> mp_context = multiprocessing.get_context('spawn')\n" +">>> manager = mp_context.Manager()\n" +">>> Global = manager.Namespace()\n" +">>> Global.x = 10\n" +">>> Global.y = 'hello'\n" +">>> Global._z = 12.3 # this is an attribute of the proxy\n" +">>> print(Global)\n" +"Namespace(x=10, y='hello')" +msgstr "" + +#: library/multiprocessing.rst:2093 msgid "Customized managers" msgstr "" -#: library/multiprocessing.rst:1951 +#: library/multiprocessing.rst:2095 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: library/multiprocessing.rst:1976 +#: library/multiprocessing.rst:2099 +msgid "" +"from multiprocessing.managers import BaseManager\n" +"\n" +"class MathsClass:\n" +" def add(self, x, y):\n" +" return x + y\n" +" def mul(self, x, y):\n" +" return x * y\n" +"\n" +"class MyManager(BaseManager):\n" +" pass\n" +"\n" +"MyManager.register('Maths', MathsClass)\n" +"\n" +"if __name__ == '__main__':\n" +" with MyManager() as manager:\n" +" maths = manager.Maths()\n" +" print(maths.add(4, 3)) # prints 7\n" +" print(maths.mul(7, 8)) # prints 56" +msgstr "" + +#: library/multiprocessing.rst:2120 msgid "Using a remote manager" msgstr "" -#: library/multiprocessing.rst:1978 +#: library/multiprocessing.rst:2122 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: library/multiprocessing.rst:1981 +#: library/multiprocessing.rst:2125 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: library/multiprocessing.rst:1993 +#: library/multiprocessing.rst:2128 +msgid "" +">>> from multiprocessing.managers import BaseManager\n" +">>> from queue import Queue\n" +">>> queue = Queue()\n" +">>> class QueueManager(BaseManager): pass\n" +">>> QueueManager.register('get_queue', callable=lambda:queue)\n" +">>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')\n" +">>> s = m.get_server()\n" +">>> s.serve_forever()" +msgstr "" + +#: library/multiprocessing.rst:2137 msgid "One client can access the server as follows::" msgstr "" -#: library/multiprocessing.rst:2003 +#: library/multiprocessing.rst:2139 +msgid "" +">>> from multiprocessing.managers import BaseManager\n" +">>> class QueueManager(BaseManager): pass\n" +">>> QueueManager.register('get_queue')\n" +">>> m = QueueManager(address=('foo.bar.org', 50000), " +"authkey=b'abracadabra')\n" +">>> m.connect()\n" +">>> queue = m.get_queue()\n" +">>> queue.put('hello')" +msgstr "" + +#: library/multiprocessing.rst:2147 msgid "Another client can also use it::" msgstr "" -#: library/multiprocessing.rst:2014 +#: library/multiprocessing.rst:2149 +msgid "" +">>> from multiprocessing.managers import BaseManager\n" +">>> class QueueManager(BaseManager): pass\n" +">>> QueueManager.register('get_queue')\n" +">>> m = QueueManager(address=('foo.bar.org', 50000), " +"authkey=b'abracadabra')\n" +">>> m.connect()\n" +">>> queue = m.get_queue()\n" +">>> queue.get()\n" +"'hello'" +msgstr "" + +#: library/multiprocessing.rst:2158 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: library/multiprocessing.rst:2039 +#: library/multiprocessing.rst:2161 +msgid "" +">>> from multiprocessing import Process, Queue\n" +">>> from multiprocessing.managers import BaseManager\n" +">>> class Worker(Process):\n" +"... def __init__(self, q):\n" +"... self.q = q\n" +"... super().__init__()\n" +"... def run(self):\n" +"... self.q.put('local hello')\n" +"...\n" +">>> queue = Queue()\n" +">>> w = Worker(queue)\n" +">>> w.start()\n" +">>> class QueueManager(BaseManager): pass\n" +"...\n" +">>> QueueManager.register('get_queue', callable=lambda: queue)\n" +">>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')\n" +">>> s = m.get_server()\n" +">>> s.serve_forever()" +msgstr "" + +#: library/multiprocessing.rst:2183 msgid "Proxy Objects" msgstr "" -#: library/multiprocessing.rst:2041 +#: library/multiprocessing.rst:2185 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: library/multiprocessing.rst:2045 +#: library/multiprocessing.rst:2189 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -2254,14 +2894,29 @@ msgid "" "its referent can:" msgstr "" -#: library/multiprocessing.rst:2063 +#: library/multiprocessing.rst:2193 +msgid "" +">>> mp_context = multiprocessing.get_context('spawn')\n" +">>> manager = mp_context.Manager()\n" +">>> l = manager.list([i*i for i in range(10)])\n" +">>> print(l)\n" +"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n" +">>> print(repr(l))\n" +"\n" +">>> l[4]\n" +"16\n" +">>> l[2:5]\n" +"[4, 9, 16]" +msgstr "" + +#: library/multiprocessing.rst:2207 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: library/multiprocessing.rst:2067 +#: library/multiprocessing.rst:2211 msgid "" "An important feature of proxy objects is that they are picklable so they can " "be passed between processes. As such, a referent can contain :ref:" @@ -2269,11 +2924,37 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: library/multiprocessing.rst:2083 +#: library/multiprocessing.rst:2216 +msgid "" +">>> a = manager.list()\n" +">>> b = manager.list()\n" +">>> a.append(b) # referent of a now contains referent of b\n" +">>> print(a, b)\n" +"[] []\n" +">>> b.append('hello')\n" +">>> print(a[0], b)\n" +"['hello'] ['hello']" +msgstr "" + +#: library/multiprocessing.rst:2227 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: library/multiprocessing.rst:2096 +#: library/multiprocessing.rst:2229 +msgid "" +">>> l_outer = manager.list([ manager.dict() for i in range(2) ])\n" +">>> d_first_inner = l_outer[0]\n" +">>> d_first_inner['a'] = 1\n" +">>> d_first_inner['b'] = 2\n" +">>> l_outer[1]['c'] = 3\n" +">>> l_outer[1]['z'] = 26\n" +">>> print(l_outer[0])\n" +"{'a': 1, 'b': 2}\n" +">>> print(l_outer[1])\n" +"{'c': 3, 'z': 26}" +msgstr "" + +#: library/multiprocessing.rst:2240 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -2284,53 +2965,81 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: library/multiprocessing.rst:2115 +#: library/multiprocessing.rst:2248 +msgid "" +"# create a list proxy and append a mutable object (a dictionary)\n" +"lproxy = manager.list()\n" +"lproxy.append({})\n" +"# now mutate the dictionary\n" +"d = lproxy[0]\n" +"d['a'] = 1\n" +"d['b'] = 2\n" +"# at this point, the changes to d are not yet synced, but by\n" +"# updating the dictionary, the proxy is notified of the change\n" +"lproxy[0] = d" +msgstr "" + +#: library/multiprocessing.rst:2259 msgid "" "This approach is perhaps less convenient than employing nested :ref:" "`multiprocessing-proxy_objects` for most use cases but also demonstrates a " "level of control over the synchronization." msgstr "" -#: library/multiprocessing.rst:2121 +#: library/multiprocessing.rst:2265 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: library/multiprocessing.rst:2129 +#: library/multiprocessing.rst:2268 +msgid "" +">>> manager.list([1,2,3]) == [1,2,3]\n" +"False" +msgstr "" + +#: library/multiprocessing.rst:2273 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: library/multiprocessing.rst:2133 +#: library/multiprocessing.rst:2277 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: library/multiprocessing.rst:2137 +#: library/multiprocessing.rst:2281 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: library/multiprocessing.rst:2139 +#: library/multiprocessing.rst:2283 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: library/multiprocessing.rst:2143 +#: library/multiprocessing.rst:2285 +msgid "proxy._callmethod(methodname, args, kwds)" +msgstr "" + +#: library/multiprocessing.rst:2287 msgid "will evaluate the expression ::" msgstr "" -#: library/multiprocessing.rst:2147 +#: library/multiprocessing.rst:2289 +msgid "getattr(obj, methodname)(*args, **kwds)" +msgstr "" + +#: library/multiprocessing.rst:2291 msgid "in the manager's process." msgstr "" -#: library/multiprocessing.rst:2149 +#: library/multiprocessing.rst:2293 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: library/multiprocessing.rst:2153 +#: library/multiprocessing.rst:2297 msgid "" "If an exception is raised by the call, then is re-raised by :meth:" "`_callmethod`. If some other exception is raised in the manager's process " @@ -2338,78 +3047,91 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: library/multiprocessing.rst:2158 +#: library/multiprocessing.rst:2302 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: library/multiprocessing.rst:2161 +#: library/multiprocessing.rst:2305 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: library/multiprocessing.rst:2177 +#: library/multiprocessing.rst:2307 +msgid "" +">>> l = manager.list(range(10))\n" +">>> l._callmethod('__len__')\n" +"10\n" +">>> l._callmethod('__getitem__', (slice(2, 7),)) # equivalent to l[2:7]\n" +"[2, 3, 4, 5, 6]\n" +">>> l._callmethod('__getitem__', (20,)) # equivalent to l[20]\n" +"Traceback (most recent call last):\n" +"...\n" +"IndexError: list index out of range" +msgstr "" + +#: library/multiprocessing.rst:2321 msgid "Return a copy of the referent." msgstr "" -#: library/multiprocessing.rst:2179 +#: library/multiprocessing.rst:2323 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: library/multiprocessing.rst:2183 +#: library/multiprocessing.rst:2327 msgid "Return a representation of the proxy object." msgstr "" -#: library/multiprocessing.rst:2187 +#: library/multiprocessing.rst:2331 msgid "Return the representation of the referent." msgstr "" -#: library/multiprocessing.rst:2191 +#: library/multiprocessing.rst:2335 msgid "Cleanup" msgstr "" -#: library/multiprocessing.rst:2193 +#: library/multiprocessing.rst:2337 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: library/multiprocessing.rst:2196 +#: library/multiprocessing.rst:2340 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: library/multiprocessing.rst:2201 +#: library/multiprocessing.rst:2345 msgid "Process Pools" msgstr "" -#: library/multiprocessing.rst:2206 +#: library/multiprocessing.rst:2350 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: library/multiprocessing.rst:2211 +#: library/multiprocessing.rst:2355 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: library/multiprocessing.rst:2215 +#: library/multiprocessing.rst:2359 msgid "" "*processes* is the number of worker processes to use. If *processes* is " -"``None`` then the number returned by :func:`os.cpu_count` is used." +"``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: library/multiprocessing.rst:2218 library/multiprocessing.rst:2779 +#: library/multiprocessing.rst:2362 library/multiprocessing.rst:2926 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: library/multiprocessing.rst:2221 +#: library/multiprocessing.rst:2365 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -2417,7 +3139,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: library/multiprocessing.rst:2226 +#: library/multiprocessing.rst:2370 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -2425,13 +3147,13 @@ msgid "" "both cases *context* is set appropriately." msgstr "" -#: library/multiprocessing.rst:2232 +#: library/multiprocessing.rst:2376 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: library/multiprocessing.rst:2236 +#: library/multiprocessing.rst:2380 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -2439,22 +3161,28 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: library/multiprocessing.rst:2241 +#: library/multiprocessing.rst:2385 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: library/multiprocessing.rst:2245 +#: library/multiprocessing.rst:2389 msgid "Added the *maxtasksperchild* parameter." msgstr "" -#: library/multiprocessing.rst:2248 +#: library/multiprocessing.rst:2392 msgid "Added the *context* parameter." msgstr "" -#: library/multiprocessing.rst:2253 +#: library/multiprocessing.rst:2395 +msgid "" +"*processes* uses :func:`os.process_cpu_count` by default, instead of :func:" +"`os.cpu_count`." +msgstr "" + +#: library/multiprocessing.rst:2401 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -2465,7 +3193,7 @@ msgid "" "ability to the end user." msgstr "" -#: library/multiprocessing.rst:2263 +#: library/multiprocessing.rst:2411 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -2473,13 +3201,13 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: library/multiprocessing.rst:2270 +#: library/multiprocessing.rst:2418 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: library/multiprocessing.rst:2273 library/multiprocessing.rst:2304 +#: library/multiprocessing.rst:2421 library/multiprocessing.rst:2452 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -2487,58 +3215,58 @@ msgid "" "applied instead." msgstr "" -#: library/multiprocessing.rst:2278 library/multiprocessing.rst:2309 +#: library/multiprocessing.rst:2426 library/multiprocessing.rst:2457 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: library/multiprocessing.rst:2282 library/multiprocessing.rst:2313 +#: library/multiprocessing.rst:2430 library/multiprocessing.rst:2461 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: library/multiprocessing.rst:2287 +#: library/multiprocessing.rst:2435 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: library/multiprocessing.rst:2291 +#: library/multiprocessing.rst:2439 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: library/multiprocessing.rst:2295 +#: library/multiprocessing.rst:2443 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: library/multiprocessing.rst:2301 +#: library/multiprocessing.rst:2449 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: library/multiprocessing.rst:2318 +#: library/multiprocessing.rst:2466 msgid "A lazier version of :meth:`.map`." msgstr "" -#: library/multiprocessing.rst:2320 +#: library/multiprocessing.rst:2468 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: library/multiprocessing.rst:2325 +#: library/multiprocessing.rst:2473 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -2546,65 +3274,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: library/multiprocessing.rst:2332 +#: library/multiprocessing.rst:2480 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: library/multiprocessing.rst:2338 +#: library/multiprocessing.rst:2486 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: library/multiprocessing.rst:2342 +#: library/multiprocessing.rst:2490 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: library/multiprocessing.rst:2349 +#: library/multiprocessing.rst:2497 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: library/multiprocessing.rst:2357 +#: library/multiprocessing.rst:2505 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: library/multiprocessing.rst:2362 +#: library/multiprocessing.rst:2510 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: library/multiprocessing.rst:2368 +#: library/multiprocessing.rst:2516 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: library/multiprocessing.rst:2371 +#: library/multiprocessing.rst:2519 msgid "" "Pool objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " "object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." msgstr "" -#: library/multiprocessing.rst:2379 +#: library/multiprocessing.rst:2527 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: library/multiprocessing.rst:2384 +#: library/multiprocessing.rst:2532 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -2612,41 +3340,69 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: library/multiprocessing.rst:2391 +#: library/multiprocessing.rst:2539 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: library/multiprocessing.rst:2395 +#: library/multiprocessing.rst:2543 msgid "Return whether the call has completed." msgstr "" -#: library/multiprocessing.rst:2399 +#: library/multiprocessing.rst:2547 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: library/multiprocessing.rst:2402 +#: library/multiprocessing.rst:2550 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: library/multiprocessing.rst:2406 +#: library/multiprocessing.rst:2554 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: library/multiprocessing.rst:2433 +#: library/multiprocessing.rst:2556 +msgid "" +"from multiprocessing import Pool\n" +"import time\n" +"\n" +"def f(x):\n" +" return x*x\n" +"\n" +"if __name__ == '__main__':\n" +" with Pool(processes=4) as pool: # start 4 worker processes\n" +" result = pool.apply_async(f, (10,)) # evaluate \"f(10)\" " +"asynchronously in a single process\n" +" print(result.get(timeout=1)) # prints \"100\" unless your " +"computer is *very* slow\n" +"\n" +" print(pool.map(f, range(10))) # prints \"[0, 1, 4,..., 81]\"\n" +"\n" +" it = pool.imap(f, range(10))\n" +" print(next(it)) # prints \"0\"\n" +" print(next(it)) # prints \"1\"\n" +" print(it.next(timeout=1)) # prints \"4\" unless your " +"computer is *very* slow\n" +"\n" +" result = pool.apply_async(time.sleep, (10,))\n" +" print(result.get(timeout=1)) # raises multiprocessing." +"TimeoutError" +msgstr "" + +#: library/multiprocessing.rst:2581 msgid "Listeners and Clients" msgstr "" -#: library/multiprocessing.rst:2438 +#: library/multiprocessing.rst:2586 msgid "" "Usually message passing between processes is done using queues or by using :" "class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: library/multiprocessing.rst:2442 +#: library/multiprocessing.rst:2590 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -2655,73 +3411,73 @@ msgid "" "multiple connections at the same time." msgstr "" -#: library/multiprocessing.rst:2451 +#: library/multiprocessing.rst:2599 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: library/multiprocessing.rst:2454 +#: library/multiprocessing.rst:2602 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: library/multiprocessing.rst:2460 +#: library/multiprocessing.rst:2608 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: library/multiprocessing.rst:2463 +#: library/multiprocessing.rst:2611 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: library/multiprocessing.rst:2468 +#: library/multiprocessing.rst:2616 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: library/multiprocessing.rst:2471 +#: library/multiprocessing.rst:2619 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: library/multiprocessing.rst:2475 library/multiprocessing.rst:2510 +#: library/multiprocessing.rst:2623 library/multiprocessing.rst:2658 msgid "" -"If *authkey* is given and not None, it should be a byte string and will be " -"used as the secret key for an HMAC-based authentication challenge. No " -"authentication is done if *authkey* is None. :exc:`~multiprocessing." +"If *authkey* is given and not ``None``, it should be a byte string and will " +"be used as the secret key for an HMAC-based authentication challenge. No " +"authentication is done if *authkey* is ``None``. :exc:`~multiprocessing." "AuthenticationError` is raised if authentication fails. See :ref:" "`multiprocessing-auth-keys`." msgstr "" -#: library/multiprocessing.rst:2483 +#: library/multiprocessing.rst:2631 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: library/multiprocessing.rst:2486 +#: library/multiprocessing.rst:2634 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: library/multiprocessing.rst:2491 +#: library/multiprocessing.rst:2639 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: library/multiprocessing.rst:2495 +#: library/multiprocessing.rst:2643 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -2735,49 +3491,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: library/multiprocessing.rst:2506 +#: library/multiprocessing.rst:2654 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: library/multiprocessing.rst:2518 +#: library/multiprocessing.rst:2666 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: library/multiprocessing.rst:2525 +#: library/multiprocessing.rst:2673 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: library/multiprocessing.rst:2529 +#: library/multiprocessing.rst:2677 msgid "Listener objects have the following read-only properties:" msgstr "" -#: library/multiprocessing.rst:2533 +#: library/multiprocessing.rst:2681 msgid "The address which is being used by the Listener object." msgstr "" -#: library/multiprocessing.rst:2537 +#: library/multiprocessing.rst:2685 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: library/multiprocessing.rst:2540 +#: library/multiprocessing.rst:2688 msgid "" "Listener objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: library/multiprocessing.rst:2547 +#: library/multiprocessing.rst:2695 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -2786,32 +3542,32 @@ msgid "" "zero timeout." msgstr "" -#: library/multiprocessing.rst:2553 +#: library/multiprocessing.rst:2701 msgid "" "For both POSIX and Windows, an object can appear in *object_list* if it is" msgstr "" -#: library/multiprocessing.rst:2556 +#: library/multiprocessing.rst:2704 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: library/multiprocessing.rst:2557 +#: library/multiprocessing.rst:2705 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: library/multiprocessing.rst:2558 +#: library/multiprocessing.rst:2706 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: library/multiprocessing.rst:2561 +#: library/multiprocessing.rst:2709 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: library/multiprocessing.rst:2564 +#: library/multiprocessing.rst:2712 msgid "" "**POSIX**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -2819,7 +3575,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: library/multiprocessing.rst:2570 +#: library/multiprocessing.rst:2718 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " @@ -2829,46 +3585,115 @@ msgid "" "handles.)" msgstr "" -#: library/multiprocessing.rst:2580 +#: library/multiprocessing.rst:2728 msgid "**Examples**" msgstr "" -#: library/multiprocessing.rst:2582 +#: library/multiprocessing.rst:2730 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: library/multiprocessing.rst:2601 +#: library/multiprocessing.rst:2734 +msgid "" +"from multiprocessing.connection import Listener\n" +"from array import array\n" +"\n" +"address = ('localhost', 6000) # family is deduced to be 'AF_INET'\n" +"\n" +"with Listener(address, authkey=b'secret password') as listener:\n" +" with listener.accept() as conn:\n" +" print('connection accepted from', listener.last_accepted)\n" +"\n" +" conn.send([2.25, None, 'junk', float])\n" +"\n" +" conn.send_bytes(b'hello')\n" +"\n" +" conn.send_bytes(array('i', [42, 1729]))" +msgstr "" + +#: library/multiprocessing.rst:2749 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: library/multiprocessing.rst:2618 +#: library/multiprocessing.rst:2752 +msgid "" +"from multiprocessing.connection import Client\n" +"from array import array\n" +"\n" +"address = ('localhost', 6000)\n" +"\n" +"with Client(address, authkey=b'secret password') as conn:\n" +" print(conn.recv()) # => [2.25, None, 'junk', float]\n" +"\n" +" print(conn.recv_bytes()) # => 'hello'\n" +"\n" +" arr = array('i', [0, 0, 0, 0, 0])\n" +" print(conn.recv_bytes_into(arr)) # => 8\n" +" print(arr) # => array('i', [42, 1729, 0, 0, 0])" +msgstr "" + +#: library/multiprocessing.rst:2766 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: library/multiprocessing.rst:2657 +#: library/multiprocessing.rst:2769 +msgid "" +"from multiprocessing import Process, Pipe, current_process\n" +"from multiprocessing.connection import wait\n" +"\n" +"def foo(w):\n" +" for i in range(10):\n" +" w.send((i, current_process().name))\n" +" w.close()\n" +"\n" +"if __name__ == '__main__':\n" +" readers = []\n" +"\n" +" for i in range(4):\n" +" r, w = Pipe(duplex=False)\n" +" readers.append(r)\n" +" p = Process(target=foo, args=(w,))\n" +" p.start()\n" +" # We close the writable end of the pipe now to be sure that\n" +" # p is the only process which owns a handle for it. This\n" +" # ensures that when p closes its handle for the writable end,\n" +" # wait() will promptly report the readable end as being ready.\n" +" w.close()\n" +"\n" +" while readers:\n" +" for r in wait(readers):\n" +" try:\n" +" msg = r.recv()\n" +" except EOFError:\n" +" readers.remove(r)\n" +" else:\n" +" print(msg)" +msgstr "" + +#: library/multiprocessing.rst:2804 msgid "Address Formats" msgstr "" -#: library/multiprocessing.rst:2659 +#: library/multiprocessing.rst:2806 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: library/multiprocessing.rst:2662 +#: library/multiprocessing.rst:2809 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: library/multiprocessing.rst:2665 +#: library/multiprocessing.rst:2812 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -2877,17 +3702,17 @@ msgid "" "instead." msgstr "" -#: library/multiprocessing.rst:2670 +#: library/multiprocessing.rst:2817 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: library/multiprocessing.rst:2677 +#: library/multiprocessing.rst:2824 msgid "Authentication keys" msgstr "" -#: library/multiprocessing.rst:2679 +#: library/multiprocessing.rst:2826 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -2895,7 +3720,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: library/multiprocessing.rst:2685 +#: library/multiprocessing.rst:2832 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -2903,7 +3728,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: library/multiprocessing.rst:2691 +#: library/multiprocessing.rst:2838 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -2914,17 +3739,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: library/multiprocessing.rst:2699 +#: library/multiprocessing.rst:2846 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: library/multiprocessing.rst:2703 +#: library/multiprocessing.rst:2850 msgid "Logging" msgstr "" -#: library/multiprocessing.rst:2705 +#: library/multiprocessing.rst:2852 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -2932,27 +3757,27 @@ msgid "" "mixed up." msgstr "" -#: library/multiprocessing.rst:2712 +#: library/multiprocessing.rst:2859 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: library/multiprocessing.rst:2715 +#: library/multiprocessing.rst:2862 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: library/multiprocessing.rst:2719 +#: library/multiprocessing.rst:2866 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: library/multiprocessing.rst:2726 +#: library/multiprocessing.rst:2873 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -2961,25 +3786,41 @@ msgid "" "``level`` argument." msgstr "" -#: library/multiprocessing.rst:2732 +#: library/multiprocessing.rst:2879 msgid "Below is an example session with logging turned on::" msgstr "" -#: library/multiprocessing.rst:2747 +#: library/multiprocessing.rst:2881 +msgid "" +">>> import multiprocessing, logging\n" +">>> logger = multiprocessing.log_to_stderr()\n" +">>> logger.setLevel(logging.INFO)\n" +">>> logger.warning('doomed')\n" +"[WARNING/MainProcess] doomed\n" +">>> m = multiprocessing.Manager()\n" +"[INFO/SyncManager-...] child process calling self.run()\n" +"[INFO/SyncManager-...] created temp directory /.../pymp-...\n" +"[INFO/SyncManager-...] manager serving at '/.../listener-...'\n" +">>> del m\n" +"[INFO/MainProcess] sending shutdown message to manager\n" +"[INFO/SyncManager-...] manager exiting with exitcode 0" +msgstr "" + +#: library/multiprocessing.rst:2894 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: library/multiprocessing.rst:2751 +#: library/multiprocessing.rst:2898 msgid "The :mod:`multiprocessing.dummy` module" msgstr "" -#: library/multiprocessing.rst:2756 +#: library/multiprocessing.rst:2903 msgid "" ":mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: library/multiprocessing.rst:2761 +#: library/multiprocessing.rst:2908 msgid "" "In particular, the ``Pool`` function provided by :mod:`multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -2987,7 +3828,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: library/multiprocessing.rst:2769 +#: library/multiprocessing.rst:2916 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -2997,18 +3838,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: library/multiprocessing.rst:2776 +#: library/multiprocessing.rst:2923 msgid "" "*processes* is the number of worker threads to use. If *processes* is " -"``None`` then the number returned by :func:`os.cpu_count` is used." +"``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: library/multiprocessing.rst:2782 +#: library/multiprocessing.rst:2929 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: library/multiprocessing.rst:2786 +#: library/multiprocessing.rst:2933 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -3018,7 +3859,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: library/multiprocessing.rst:2793 +#: library/multiprocessing.rst:2940 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -3027,69 +3868,69 @@ msgid "" "`asyncio`." msgstr "" -#: library/multiprocessing.rst:2803 +#: library/multiprocessing.rst:2950 msgid "Programming guidelines" msgstr "" -#: library/multiprocessing.rst:2805 +#: library/multiprocessing.rst:2952 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: library/multiprocessing.rst:2810 +#: library/multiprocessing.rst:2957 msgid "All start methods" msgstr "" -#: library/multiprocessing.rst:2812 +#: library/multiprocessing.rst:2959 msgid "The following applies to all start methods." msgstr "" -#: library/multiprocessing.rst:2814 +#: library/multiprocessing.rst:2961 msgid "Avoid shared state" msgstr "" -#: library/multiprocessing.rst:2816 +#: library/multiprocessing.rst:2963 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: library/multiprocessing.rst:2819 +#: library/multiprocessing.rst:2966 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: library/multiprocessing.rst:2823 +#: library/multiprocessing.rst:2970 msgid "Picklability" msgstr "" -#: library/multiprocessing.rst:2825 +#: library/multiprocessing.rst:2972 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: library/multiprocessing.rst:2827 +#: library/multiprocessing.rst:2974 msgid "Thread safety of proxies" msgstr "" -#: library/multiprocessing.rst:2829 +#: library/multiprocessing.rst:2976 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: library/multiprocessing.rst:2832 +#: library/multiprocessing.rst:2979 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: library/multiprocessing.rst:2834 +#: library/multiprocessing.rst:2981 msgid "Joining zombie processes" msgstr "" -#: library/multiprocessing.rst:2836 +#: library/multiprocessing.rst:2983 msgid "" "On POSIX when a process finishes but has not been joined it becomes a " "zombie. There should never be very many because each time a new process " @@ -3100,11 +3941,11 @@ msgid "" "explicitly join all the processes that you start." msgstr "" -#: library/multiprocessing.rst:2844 +#: library/multiprocessing.rst:2991 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: library/multiprocessing.rst:2846 +#: library/multiprocessing.rst:2993 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:" "`multiprocessing` need to be picklable so that child processes can use " @@ -3114,11 +3955,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: library/multiprocessing.rst:2854 +#: library/multiprocessing.rst:3001 msgid "Avoid terminating processes" msgstr "" -#: library/multiprocessing.rst:2856 +#: library/multiprocessing.rst:3003 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -3126,18 +3967,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: library/multiprocessing.rst:2862 +#: library/multiprocessing.rst:3009 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: library/multiprocessing.rst:2866 +#: library/multiprocessing.rst:3013 msgid "Joining processes that use queues" msgstr "" -#: library/multiprocessing.rst:2868 +#: library/multiprocessing.rst:3015 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -3146,7 +3987,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: library/multiprocessing.rst:2874 +#: library/multiprocessing.rst:3021 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -3155,21 +3996,36 @@ msgid "" "processes will be joined automatically." msgstr "" -#: library/multiprocessing.rst:2880 +#: library/multiprocessing.rst:3027 msgid "An example which will deadlock is the following::" msgstr "" -#: library/multiprocessing.rst:2894 +#: library/multiprocessing.rst:3029 +msgid "" +"from multiprocessing import Process, Queue\n" +"\n" +"def f(q):\n" +" q.put('X' * 1000000)\n" +"\n" +"if __name__ == '__main__':\n" +" queue = Queue()\n" +" p = Process(target=f, args=(queue,))\n" +" p.start()\n" +" p.join() # this deadlocks\n" +" obj = queue.get()" +msgstr "" + +#: library/multiprocessing.rst:3041 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: library/multiprocessing.rst:2897 +#: library/multiprocessing.rst:3044 msgid "Explicitly pass resources to child processes" msgstr "" -#: library/multiprocessing.rst:2899 +#: library/multiprocessing.rst:3046 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -3177,7 +4033,7 @@ msgid "" "for the child process." msgstr "" -#: library/multiprocessing.rst:2904 +#: library/multiprocessing.rst:3051 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -3186,77 +4042,124 @@ msgid "" "collected in the parent process." msgstr "" -#: library/multiprocessing.rst:2911 +#: library/multiprocessing.rst:3058 msgid "So for instance ::" msgstr "" -#: library/multiprocessing.rst:2923 +#: library/multiprocessing.rst:3060 +msgid "" +"from multiprocessing import Process, Lock\n" +"\n" +"def f():\n" +" ... do something using \"lock\" ...\n" +"\n" +"if __name__ == '__main__':\n" +" lock = Lock()\n" +" for i in range(10):\n" +" Process(target=f).start()" +msgstr "" + +#: library/multiprocessing.rst:3070 msgid "should be rewritten as ::" msgstr "" -#: library/multiprocessing.rst:2935 +#: library/multiprocessing.rst:3072 +msgid "" +"from multiprocessing import Process, Lock\n" +"\n" +"def f(l):\n" +" ... do something using \"l\" ...\n" +"\n" +"if __name__ == '__main__':\n" +" lock = Lock()\n" +" for i in range(10):\n" +" Process(target=f, args=(lock,)).start()" +msgstr "" + +#: library/multiprocessing.rst:3082 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: library/multiprocessing.rst:2937 +#: library/multiprocessing.rst:3084 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: library/multiprocessing.rst:2941 +#: library/multiprocessing.rst:3086 +msgid "os.close(sys.stdin.fileno())" +msgstr "" + +#: library/multiprocessing.rst:3088 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: library/multiprocessing.rst:2947 +#: library/multiprocessing.rst:3091 +msgid "" +"sys.stdin.close()\n" +"sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" +msgstr "" + +#: library/multiprocessing.rst:3094 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " "to applications which replace :func:`sys.stdin` with a \"file-like object\" " "with output buffering. This danger is that if multiple processes call :meth:" -"`~io.IOBase.close()` on this file-like object, it could result in the same " +"`~io.IOBase.close` on this file-like object, it could result in the same " "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: library/multiprocessing.rst:2954 +#: library/multiprocessing.rst:3101 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: library/multiprocessing.rst:2966 +#: library/multiprocessing.rst:3105 +msgid "" +"@property\n" +"def cache(self):\n" +" pid = os.getpid()\n" +" if pid != self._pid:\n" +" self._pid = pid\n" +" self._cache = []\n" +" return self._cache" +msgstr "" + +#: library/multiprocessing.rst:3113 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: library/multiprocessing.rst:2969 +#: library/multiprocessing.rst:3119 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: library/multiprocessing.rst:2971 +#: library/multiprocessing.rst:3121 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: library/multiprocessing.rst:2974 +#: library/multiprocessing.rst:3124 msgid "More picklability" msgstr "" -#: library/multiprocessing.rst:2976 +#: library/multiprocessing.rst:3126 msgid "" -"Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, " -"if you subclass :class:`~multiprocessing.Process` then make sure that " -"instances will be picklable when the :meth:`Process.start ` method is called." +"Ensure that all arguments to :class:`~multiprocessing.Process` are " +"picklable. Also, if you subclass ``Process.__init__``, you must make sure " +"that instances will be picklable when the :meth:`Process.start " +"` method is called." msgstr "" -#: library/multiprocessing.rst:2981 +#: library/multiprocessing.rst:3131 msgid "Global variables" msgstr "" -#: library/multiprocessing.rst:2983 +#: library/multiprocessing.rst:3133 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -3264,67 +4167,427 @@ msgid "" "Process.start>` was called." msgstr "" -#: library/multiprocessing.rst:2988 +#: library/multiprocessing.rst:3138 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: library/multiprocessing.rst:2993 +#: library/multiprocessing.rst:3143 msgid "Safe importing of main module" msgstr "" -#: library/multiprocessing.rst:2995 +#: library/multiprocessing.rst:3145 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: library/multiprocessing.rst:2999 +#: library/multiprocessing.rst:3149 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: library/multiprocessing.rst:3011 +#: library/multiprocessing.rst:3153 +msgid "" +"from multiprocessing import Process\n" +"\n" +"def foo():\n" +" print('hello')\n" +"\n" +"p = Process(target=foo)\n" +"p.start()" +msgstr "" + +#: library/multiprocessing.rst:3161 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: library/multiprocessing.rst:3025 +#: library/multiprocessing.rst:3164 +msgid "" +"from multiprocessing import Process, freeze_support, set_start_method\n" +"\n" +"def foo():\n" +" print('hello')\n" +"\n" +"if __name__ == '__main__':\n" +" freeze_support()\n" +" set_start_method('spawn')\n" +" p = Process(target=foo)\n" +" p.start()" +msgstr "" + +#: library/multiprocessing.rst:3175 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: library/multiprocessing.rst:3028 +#: library/multiprocessing.rst:3178 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: library/multiprocessing.rst:3031 +#: library/multiprocessing.rst:3181 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: library/multiprocessing.rst:3038 +#: library/multiprocessing.rst:3188 msgid "Examples" msgstr "" -#: library/multiprocessing.rst:3040 +#: library/multiprocessing.rst:3190 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: library/multiprocessing.rst:3046 +#: library/multiprocessing.rst:3192 +msgid "" +"from multiprocessing import freeze_support\n" +"from multiprocessing.managers import BaseManager, BaseProxy\n" +"import operator\n" +"\n" +"##\n" +"\n" +"class Foo:\n" +" def f(self):\n" +" print('you called Foo.f()')\n" +" def g(self):\n" +" print('you called Foo.g()')\n" +" def _h(self):\n" +" print('you called Foo._h()')\n" +"\n" +"# A simple generator function\n" +"def baz():\n" +" for i in range(10):\n" +" yield i*i\n" +"\n" +"# Proxy type for generator objects\n" +"class GeneratorProxy(BaseProxy):\n" +" _exposed_ = ['__next__']\n" +" def __iter__(self):\n" +" return self\n" +" def __next__(self):\n" +" return self._callmethod('__next__')\n" +"\n" +"# Function to return the operator module\n" +"def get_operator_module():\n" +" return operator\n" +"\n" +"##\n" +"\n" +"class MyManager(BaseManager):\n" +" pass\n" +"\n" +"# register the Foo class; make `f()` and `g()` accessible via proxy\n" +"MyManager.register('Foo1', Foo)\n" +"\n" +"# register the Foo class; make `g()` and `_h()` accessible via proxy\n" +"MyManager.register('Foo2', Foo, exposed=('g', '_h'))\n" +"\n" +"# register the generator function baz; use `GeneratorProxy` to make proxies\n" +"MyManager.register('baz', baz, proxytype=GeneratorProxy)\n" +"\n" +"# register get_operator_module(); make public functions accessible via " +"proxy\n" +"MyManager.register('operator', get_operator_module)\n" +"\n" +"##\n" +"\n" +"def test():\n" +" manager = MyManager()\n" +" manager.start()\n" +"\n" +" print('-' * 20)\n" +"\n" +" f1 = manager.Foo1()\n" +" f1.f()\n" +" f1.g()\n" +" assert not hasattr(f1, '_h')\n" +" assert sorted(f1._exposed_) == sorted(['f', 'g'])\n" +"\n" +" print('-' * 20)\n" +"\n" +" f2 = manager.Foo2()\n" +" f2.g()\n" +" f2._h()\n" +" assert not hasattr(f2, 'f')\n" +" assert sorted(f2._exposed_) == sorted(['g', '_h'])\n" +"\n" +" print('-' * 20)\n" +"\n" +" it = manager.baz()\n" +" for i in it:\n" +" print('<%d>' % i, end=' ')\n" +" print()\n" +"\n" +" print('-' * 20)\n" +"\n" +" op = manager.operator()\n" +" print('op.add(23, 45) =', op.add(23, 45))\n" +" print('op.pow(2, 94) =', op.pow(2, 94))\n" +" print('op._exposed_ =', op._exposed_)\n" +"\n" +"##\n" +"\n" +"if __name__ == '__main__':\n" +" freeze_support()\n" +" test()\n" +msgstr "" + +#: library/multiprocessing.rst:3196 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "" -#: library/multiprocessing.rst:3052 +#: library/multiprocessing.rst:3198 +msgid "" +"import multiprocessing\n" +"import time\n" +"import random\n" +"import sys\n" +"\n" +"#\n" +"# Functions used by test code\n" +"#\n" +"\n" +"def calculate(func, args):\n" +" result = func(*args)\n" +" return '%s says that %s%s = %s' % (\n" +" multiprocessing.current_process().name,\n" +" func.__name__, args, result\n" +" )\n" +"\n" +"def calculatestar(args):\n" +" return calculate(*args)\n" +"\n" +"def mul(a, b):\n" +" time.sleep(0.5 * random.random())\n" +" return a * b\n" +"\n" +"def plus(a, b):\n" +" time.sleep(0.5 * random.random())\n" +" return a + b\n" +"\n" +"def f(x):\n" +" return 1.0 / (x - 5.0)\n" +"\n" +"def pow3(x):\n" +" return x ** 3\n" +"\n" +"def noop(x):\n" +" pass\n" +"\n" +"#\n" +"# Test code\n" +"#\n" +"\n" +"def test():\n" +" PROCESSES = 4\n" +" print('Creating pool with %d processes\\n' % PROCESSES)\n" +"\n" +" with multiprocessing.Pool(PROCESSES) as pool:\n" +" #\n" +" # Tests\n" +" #\n" +"\n" +" TASKS = [(mul, (i, 7)) for i in range(10)] + \\\n" +" [(plus, (i, 8)) for i in range(10)]\n" +"\n" +" results = [pool.apply_async(calculate, t) for t in TASKS]\n" +" imap_it = pool.imap(calculatestar, TASKS)\n" +" imap_unordered_it = pool.imap_unordered(calculatestar, TASKS)\n" +"\n" +" print('Ordered results using pool.apply_async():')\n" +" for r in results:\n" +" print('\\t', r.get())\n" +" print()\n" +"\n" +" print('Ordered results using pool.imap():')\n" +" for x in imap_it:\n" +" print('\\t', x)\n" +" print()\n" +"\n" +" print('Unordered results using pool.imap_unordered():')\n" +" for x in imap_unordered_it:\n" +" print('\\t', x)\n" +" print()\n" +"\n" +" print('Ordered results using pool.map() --- will block till " +"complete:')\n" +" for x in pool.map(calculatestar, TASKS):\n" +" print('\\t', x)\n" +" print()\n" +"\n" +" #\n" +" # Test error handling\n" +" #\n" +"\n" +" print('Testing error handling:')\n" +"\n" +" try:\n" +" print(pool.apply(f, (5,)))\n" +" except ZeroDivisionError:\n" +" print('\\tGot ZeroDivisionError as expected from pool.apply()')\n" +" else:\n" +" raise AssertionError('expected ZeroDivisionError')\n" +"\n" +" try:\n" +" print(pool.map(f, list(range(10))))\n" +" except ZeroDivisionError:\n" +" print('\\tGot ZeroDivisionError as expected from pool.map()')\n" +" else:\n" +" raise AssertionError('expected ZeroDivisionError')\n" +"\n" +" try:\n" +" print(list(pool.imap(f, list(range(10)))))\n" +" except ZeroDivisionError:\n" +" print('\\tGot ZeroDivisionError as expected from list(pool." +"imap())')\n" +" else:\n" +" raise AssertionError('expected ZeroDivisionError')\n" +"\n" +" it = pool.imap(f, list(range(10)))\n" +" for i in range(10):\n" +" try:\n" +" x = next(it)\n" +" except ZeroDivisionError:\n" +" if i == 5:\n" +" pass\n" +" except StopIteration:\n" +" break\n" +" else:\n" +" if i == 5:\n" +" raise AssertionError('expected ZeroDivisionError')\n" +"\n" +" assert i == 9\n" +" print('\\tGot ZeroDivisionError as expected from IMapIterator." +"next()')\n" +" print()\n" +"\n" +" #\n" +" # Testing timeouts\n" +" #\n" +"\n" +" print('Testing ApplyResult.get() with timeout:', end=' ')\n" +" res = pool.apply_async(calculate, TASKS[0])\n" +" while 1:\n" +" sys.stdout.flush()\n" +" try:\n" +" sys.stdout.write('\\n\\t%s' % res.get(0.02))\n" +" break\n" +" except multiprocessing.TimeoutError:\n" +" sys.stdout.write('.')\n" +" print()\n" +" print()\n" +"\n" +" print('Testing IMapIterator.next() with timeout:', end=' ')\n" +" it = pool.imap(calculatestar, TASKS)\n" +" while 1:\n" +" sys.stdout.flush()\n" +" try:\n" +" sys.stdout.write('\\n\\t%s' % it.next(0.02))\n" +" except StopIteration:\n" +" break\n" +" except multiprocessing.TimeoutError:\n" +" sys.stdout.write('.')\n" +" print()\n" +" print()\n" +"\n" +"\n" +"if __name__ == '__main__':\n" +" multiprocessing.freeze_support()\n" +" test()\n" +msgstr "" + +#: library/multiprocessing.rst:3202 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" msgstr "" + +#: library/multiprocessing.rst:3205 +msgid "" +"import time\n" +"import random\n" +"\n" +"from multiprocessing import Process, Queue, current_process, freeze_support\n" +"\n" +"#\n" +"# Function run by worker processes\n" +"#\n" +"\n" +"def worker(input, output):\n" +" for func, args in iter(input.get, 'STOP'):\n" +" result = calculate(func, args)\n" +" output.put(result)\n" +"\n" +"#\n" +"# Function used to calculate result\n" +"#\n" +"\n" +"def calculate(func, args):\n" +" result = func(*args)\n" +" return '%s says that %s%s = %s' % \\\n" +" (current_process().name, func.__name__, args, result)\n" +"\n" +"#\n" +"# Functions referenced by tasks\n" +"#\n" +"\n" +"def mul(a, b):\n" +" time.sleep(0.5*random.random())\n" +" return a * b\n" +"\n" +"def plus(a, b):\n" +" time.sleep(0.5*random.random())\n" +" return a + b\n" +"\n" +"#\n" +"#\n" +"#\n" +"\n" +"def test():\n" +" NUMBER_OF_PROCESSES = 4\n" +" TASKS1 = [(mul, (i, 7)) for i in range(20)]\n" +" TASKS2 = [(plus, (i, 8)) for i in range(10)]\n" +"\n" +" # Create queues\n" +" task_queue = Queue()\n" +" done_queue = Queue()\n" +"\n" +" # Submit tasks\n" +" for task in TASKS1:\n" +" task_queue.put(task)\n" +"\n" +" # Start worker processes\n" +" for i in range(NUMBER_OF_PROCESSES):\n" +" Process(target=worker, args=(task_queue, done_queue)).start()\n" +"\n" +" # Get and print results\n" +" print('Unordered results:')\n" +" for i in range(len(TASKS1)):\n" +" print('\\t', done_queue.get())\n" +"\n" +" # Add more tasks using `put()`\n" +" for task in TASKS2:\n" +" task_queue.put(task)\n" +"\n" +" # Get and print some more results\n" +" for i in range(len(TASKS2)):\n" +" print('\\t', done_queue.get())\n" +"\n" +" # Tell child processes to stop\n" +" for i in range(NUMBER_OF_PROCESSES):\n" +" task_queue.put('STOP')\n" +"\n" +"\n" +"if __name__ == '__main__':\n" +" freeze_support()\n" +" test()\n" +msgstr "" diff --git a/library/multiprocessing.shared_memory.po b/library/multiprocessing.shared_memory.po index 9c1da920..6fde378e 100644 --- a/library/multiprocessing.shared_memory.po +++ b/library/multiprocessing.shared_memory.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/multiprocessing.shared_memory.rst:2 msgid "" -":mod:`multiprocessing.shared_memory` --- Shared memory for direct access " +":mod:`!multiprocessing.shared_memory` --- Shared memory for direct access " "across processes" msgstr "" @@ -97,59 +98,156 @@ msgid "" "shared memory block, the *size* parameter is ignored." msgstr "" -#: library/multiprocessing.shared_memory.rst:75 +#: library/multiprocessing.shared_memory.rst:73 msgid "" -"Close access to the shared memory from this instance. In order to ensure " -"proper cleanup of resources, all instances should call :meth:`close` once " -"the instance is no longer needed. Note that calling :meth:`!close` does not " -"cause the shared memory block itself to be destroyed." +"When ``True``, register the shared memory block with a resource tracker " +"process on platforms where the OS does not do this automatically. The " +"resource tracker ensures proper cleanup of the shared memory even if all " +"other processes with access to the memory exit without doing so. Python " +"processes created from a common ancestor using :mod:`multiprocessing` " +"facilities share a single resource tracker process, and the lifetime of " +"shared memory segments is handled automatically among these processes. " +"Python processes created in any other way will receive their own resource " +"tracker when accessing shared memory with *track* enabled. This will cause " +"the shared memory to be deleted by the resource tracker of the first process " +"that terminates. To avoid this issue, users of :mod:`subprocess` or " +"standalone Python processes should set *track* to ``False`` when there is " +"already another process in place that does the bookkeeping. *track* is " +"ignored on Windows, which has its own tracking and automatically deletes " +"shared memory when all handles to it have been closed." msgstr "" -#: library/multiprocessing.shared_memory.rst:83 -msgid "" -"Request that the underlying shared memory block be destroyed. In order to " -"ensure proper cleanup of resources, :meth:`unlink` should be called once " -"(and only once) across all processes which have need for the shared memory " -"block. After requesting its destruction, a shared memory block may or may " -"not be immediately destroyed and this behavior may differ across platforms. " -"Attempts to access data inside the shared memory block after :meth:`!unlink` " -"has been called may result in memory access errors. Note: the last process " -"relinquishing its hold on a shared memory block may call :meth:`!unlink` " -"and :meth:`close` in either order." +#: library/multiprocessing.shared_memory.rst:91 +msgid "Added the *track* parameter." msgstr "" #: library/multiprocessing.shared_memory.rst:96 +msgid "" +"Close the file descriptor/handle to the shared memory from this instance. :" +"meth:`close` should be called once access to the shared memory block from " +"this instance is no longer needed. Depending on operating system, the " +"underlying memory may or may not be freed even if all handles to it have " +"been closed. To ensure proper cleanup, use the :meth:`unlink` method." +msgstr "" + +#: library/multiprocessing.shared_memory.rst:105 +msgid "" +"Delete the underlying shared memory block. This should be called only once " +"per shared memory block regardless of the number of handles to it, even in " +"other processes. :meth:`unlink` and :meth:`close` can be called in any " +"order, but trying to access data inside a shared memory block after :meth:" +"`unlink` may result in memory access errors, depending on platform." +msgstr "" + +#: library/multiprocessing.shared_memory.rst:112 +msgid "" +"This method has no effect on Windows, where the only way to delete a shared " +"memory block is to close all handles." +msgstr "" + +#: library/multiprocessing.shared_memory.rst:117 msgid "A memoryview of contents of the shared memory block." msgstr "" -#: library/multiprocessing.shared_memory.rst:100 +#: library/multiprocessing.shared_memory.rst:121 msgid "Read-only access to the unique name of the shared memory block." msgstr "" -#: library/multiprocessing.shared_memory.rst:104 +#: library/multiprocessing.shared_memory.rst:125 msgid "Read-only access to size in bytes of the shared memory block." msgstr "" -#: library/multiprocessing.shared_memory.rst:107 +#: library/multiprocessing.shared_memory.rst:128 msgid "" "The following example demonstrates low-level use of :class:`SharedMemory` " "instances::" msgstr "" -#: library/multiprocessing.shared_memory.rst:133 +#: library/multiprocessing.shared_memory.rst:131 +msgid "" +">>> from multiprocessing import shared_memory\n" +">>> shm_a = shared_memory.SharedMemory(create=True, size=10)\n" +">>> type(shm_a.buf)\n" +"\n" +">>> buffer = shm_a.buf\n" +">>> len(buffer)\n" +"10\n" +">>> buffer[:4] = bytearray([22, 33, 44, 55]) # Modify multiple at once\n" +">>> buffer[4] = 100 # Modify single byte at a " +"time\n" +">>> # Attach to an existing shared memory block\n" +">>> shm_b = shared_memory.SharedMemory(shm_a.name)\n" +">>> import array\n" +">>> array.array('b', shm_b.buf[:5]) # Copy the data into a new array.array\n" +"array('b', [22, 33, 44, 55, 100])\n" +">>> shm_b.buf[:5] = b'howdy' # Modify via shm_b using bytes\n" +">>> bytes(shm_a.buf[:5]) # Access via shm_a\n" +"b'howdy'\n" +">>> shm_b.close() # Close each SharedMemory instance\n" +">>> shm_a.close()\n" +">>> shm_a.unlink() # Call unlink only once to release the shared memory" +msgstr "" + +#: library/multiprocessing.shared_memory.rst:154 msgid "" "The following example demonstrates a practical use of the :class:" "`SharedMemory` class with `NumPy arrays `_, accessing " "the same :class:`!numpy.ndarray` from two distinct Python shells:" msgstr "" -#: library/multiprocessing.shared_memory.rst:187 +#: library/multiprocessing.shared_memory.rst:158 +msgid "" +">>> # In the first Python interactive shell\n" +">>> import numpy as np\n" +">>> a = np.array([1, 1, 2, 3, 5, 8]) # Start with an existing NumPy array\n" +">>> from multiprocessing import shared_memory\n" +">>> shm = shared_memory.SharedMemory(create=True, size=a.nbytes)\n" +">>> # Now create a NumPy array backed by shared memory\n" +">>> b = np.ndarray(a.shape, dtype=a.dtype, buffer=shm.buf)\n" +">>> b[:] = a[:] # Copy the original data into shared memory\n" +">>> b\n" +"array([1, 1, 2, 3, 5, 8])\n" +">>> type(b)\n" +"\n" +">>> type(a)\n" +"\n" +">>> shm.name # We did not specify a name so one was chosen for us\n" +"'psm_21467_46075'\n" +"\n" +">>> # In either the same shell or a new Python shell on the same machine\n" +">>> import numpy as np\n" +">>> from multiprocessing import shared_memory\n" +">>> # Attach to the existing shared memory block\n" +">>> existing_shm = shared_memory.SharedMemory(name='psm_21467_46075')\n" +">>> # Note that a.shape is (6,) and a.dtype is np.int64 in this example\n" +">>> c = np.ndarray((6,), dtype=np.int64, buffer=existing_shm.buf)\n" +">>> c\n" +"array([1, 1, 2, 3, 5, 8])\n" +">>> c[-1] = 888\n" +">>> c\n" +"array([ 1, 1, 2, 3, 5, 888])\n" +"\n" +">>> # Back in the first Python interactive shell, b reflects this change\n" +">>> b\n" +"array([ 1, 1, 2, 3, 5, 888])\n" +"\n" +">>> # Clean up from within the second Python shell\n" +">>> del c # Unnecessary; merely emphasizing the array is no longer used\n" +">>> existing_shm.close()\n" +"\n" +">>> # Clean up from within the first Python shell\n" +">>> del b # Unnecessary; merely emphasizing the array is no longer used\n" +">>> shm.close()\n" +">>> shm.unlink() # Free and release the shared memory block at the very end" +msgstr "" + +#: library/multiprocessing.shared_memory.rst:208 msgid "" "A subclass of :class:`multiprocessing.managers.BaseManager` which can be " "used for the management of shared memory blocks across processes." msgstr "" -#: library/multiprocessing.shared_memory.rst:190 +#: library/multiprocessing.shared_memory.rst:211 msgid "" "A call to :meth:`~multiprocessing.managers.BaseManager.start` on a :class:`!" "SharedMemoryManager` instance causes a new process to be started. This new " @@ -164,14 +262,14 @@ msgid "" "trigger the freeing of shared memory resources." msgstr "" -#: library/multiprocessing.shared_memory.rst:202 +#: library/multiprocessing.shared_memory.rst:223 msgid "" "This class provides methods for creating and returning :class:`SharedMemory` " "instances and for creating a list-like object (:class:`ShareableList`) " "backed by shared memory." msgstr "" -#: library/multiprocessing.shared_memory.rst:206 +#: library/multiprocessing.shared_memory.rst:227 msgid "" "Refer to :class:`~multiprocessing.managers.BaseManager` for a description of " "the inherited *address* and *authkey* optional input arguments and how they " @@ -179,25 +277,40 @@ msgid "" "from other processes." msgstr "" -#: library/multiprocessing.shared_memory.rst:213 +#: library/multiprocessing.shared_memory.rst:234 msgid "" "Create and return a new :class:`SharedMemory` object with the specified " "*size* in bytes." msgstr "" -#: library/multiprocessing.shared_memory.rst:218 +#: library/multiprocessing.shared_memory.rst:239 msgid "" "Create and return a new :class:`ShareableList` object, initialized by the " "values from the input *sequence*." msgstr "" -#: library/multiprocessing.shared_memory.rst:222 +#: library/multiprocessing.shared_memory.rst:243 msgid "" "The following example demonstrates the basic mechanisms of a :class:" "`~multiprocessing.managers.SharedMemoryManager`:" msgstr "" -#: library/multiprocessing.shared_memory.rst:240 +#: library/multiprocessing.shared_memory.rst:246 +msgid "" +">>> from multiprocessing.managers import SharedMemoryManager\n" +">>> smm = SharedMemoryManager()\n" +">>> smm.start() # Start the process that manages the shared memory blocks\n" +">>> sl = smm.ShareableList(range(4))\n" +">>> sl\n" +"ShareableList([0, 1, 2, 3], name='psm_6572_7512')\n" +">>> raw_shm = smm.SharedMemory(size=128)\n" +">>> another_sl = smm.ShareableList('alpha')\n" +">>> another_sl\n" +"ShareableList(['a', 'l', 'p', 'h', 'a'], name='psm_6572_12221')\n" +">>> smm.shutdown() # Calls unlink() on sl, raw_shm, and another_sl" +msgstr "" + +#: library/multiprocessing.shared_memory.rst:261 msgid "" "The following example depicts a potentially more convenient pattern for " "using :class:`~multiprocessing.managers.SharedMemoryManager` objects via " @@ -205,7 +318,22 @@ msgid "" "released after they are no longer needed:" msgstr "" -#: library/multiprocessing.shared_memory.rst:259 +#: library/multiprocessing.shared_memory.rst:266 +msgid "" +">>> with SharedMemoryManager() as smm:\n" +"... sl = smm.ShareableList(range(2000))\n" +"... # Divide the work among two processes, storing partial results in " +"sl\n" +"... p1 = Process(target=do_work, args=(sl, 0, 1000))\n" +"... p2 = Process(target=do_work, args=(sl, 1000, 2000))\n" +"... p1.start()\n" +"... p2.start() # A multiprocessing.Pool might be more efficient\n" +"... p1.join()\n" +"... p2.join() # Wait for all work to complete in both processes\n" +"... total_result = sum(sl) # Consolidate the partial results now in sl" +msgstr "" + +#: library/multiprocessing.shared_memory.rst:280 msgid "" "When using a :class:`~multiprocessing.managers.SharedMemoryManager` in a :" "keyword:`with` statement, the shared memory blocks created using that " @@ -213,38 +341,38 @@ msgid "" "finishes execution." msgstr "" -#: library/multiprocessing.shared_memory.rst:267 +#: library/multiprocessing.shared_memory.rst:288 msgid "" "Provide a mutable list-like object where all values stored within are stored " "in a shared memory block. This constrains storable values to the following " "built-in data types:" msgstr "" -#: library/multiprocessing.shared_memory.rst:271 +#: library/multiprocessing.shared_memory.rst:292 msgid ":class:`int` (signed 64-bit)" msgstr "" -#: library/multiprocessing.shared_memory.rst:272 +#: library/multiprocessing.shared_memory.rst:293 msgid ":class:`float`" msgstr "" -#: library/multiprocessing.shared_memory.rst:273 +#: library/multiprocessing.shared_memory.rst:294 msgid ":class:`bool`" msgstr "" -#: library/multiprocessing.shared_memory.rst:274 +#: library/multiprocessing.shared_memory.rst:295 msgid ":class:`str` (less than 10M bytes each when encoded as UTF-8)" msgstr "" -#: library/multiprocessing.shared_memory.rst:275 +#: library/multiprocessing.shared_memory.rst:296 msgid ":class:`bytes` (less than 10M bytes each)" msgstr "" -#: library/multiprocessing.shared_memory.rst:276 +#: library/multiprocessing.shared_memory.rst:297 msgid "``None``" msgstr "" -#: library/multiprocessing.shared_memory.rst:278 +#: library/multiprocessing.shared_memory.rst:299 msgid "" "It also notably differs from the built-in :class:`list` type in that these " "lists can not change their overall length (i.e. no :meth:`!append`, :meth:`!" @@ -252,14 +380,14 @@ msgid "" "ShareableList` instances via slicing." msgstr "" -#: library/multiprocessing.shared_memory.rst:284 +#: library/multiprocessing.shared_memory.rst:305 msgid "" "*sequence* is used in populating a new :class:`!ShareableList` full of " "values. Set to ``None`` to instead attach to an already existing :class:`!" "ShareableList` by its unique shared memory name." msgstr "" -#: library/multiprocessing.shared_memory.rst:288 +#: library/multiprocessing.shared_memory.rst:309 msgid "" "*name* is the unique name for the requested shared memory, as described in " "the definition for :class:`SharedMemory`. When attaching to an existing :" @@ -267,7 +395,7 @@ msgid "" "leaving *sequence* set to ``None``." msgstr "" -#: library/multiprocessing.shared_memory.rst:295 +#: library/multiprocessing.shared_memory.rst:316 msgid "" "A known issue exists for :class:`bytes` and :class:`str` values. If they end " "with ``\\x00`` nul bytes or characters, those may be *silently stripped* " @@ -276,47 +404,66 @@ msgid "" "future. See :gh:`106939`." msgstr "" -#: library/multiprocessing.shared_memory.rst:301 +#: library/multiprocessing.shared_memory.rst:322 msgid "" "For applications where rstripping of trailing nulls is a problem, work " "around it by always unconditionally appending an extra non-0 byte to the end " "of such values when storing and unconditionally removing it when fetching:" msgstr "" -#: library/multiprocessing.shared_memory.rst:324 +#: library/multiprocessing.shared_memory.rst:327 +msgid "" +">>> from multiprocessing import shared_memory\n" +">>> nul_bug_demo = shared_memory.ShareableList(['?\\x00', " +"b'\\x03\\x02\\x01\\x00\\x00\\x00'])\n" +">>> nul_bug_demo[0]\n" +"'?'\n" +">>> nul_bug_demo[1]\n" +"b'\\x03\\x02\\x01'\n" +">>> nul_bug_demo.shm.unlink()\n" +">>> padded = shared_memory.ShareableList(['?\\x00\\x07', " +"b'\\x03\\x02\\x01\\x00\\x00\\x00\\x07'])\n" +">>> padded[0][:-1]\n" +"'?\\x00'\n" +">>> padded[1][:-1]\n" +"b'\\x03\\x02\\x01\\x00\\x00\\x00'\n" +">>> padded.shm.unlink()" +msgstr "" + +#: library/multiprocessing.shared_memory.rst:345 msgid "Return the number of occurrences of *value*." msgstr "" -#: library/multiprocessing.shared_memory.rst:328 +#: library/multiprocessing.shared_memory.rst:349 msgid "" "Return first index position of *value*. Raise :exc:`ValueError` if *value* " "is not present." msgstr "" -#: library/multiprocessing.shared_memory.rst:333 +#: library/multiprocessing.shared_memory.rst:354 msgid "" "Read-only attribute containing the :mod:`struct` packing format used by all " "currently stored values." msgstr "" -#: library/multiprocessing.shared_memory.rst:338 +#: library/multiprocessing.shared_memory.rst:359 msgid "The :class:`SharedMemory` instance where the values are stored." msgstr "" -#: library/multiprocessing.shared_memory.rst:341 +#: library/multiprocessing.shared_memory.rst:362 msgid "" "The following example demonstrates basic use of a :class:`ShareableList` " "instance:" msgstr "" -#: library/multiprocessing.shared_memory.rst:374 +#: library/multiprocessing.shared_memory.rst:395 msgid "" "The following example depicts how one, two, or many processes may access the " "same :class:`ShareableList` by supplying the name of the shared memory block " "behind it:" msgstr "" -#: library/multiprocessing.shared_memory.rst:389 +#: library/multiprocessing.shared_memory.rst:410 msgid "" "The following examples demonstrates that :class:`ShareableList` (and " "underlying :class:`SharedMemory`) objects can be pickled and unpickled if " diff --git a/library/netdata.po b/library/netdata.po index f0719ec3..944983e1 100644 --- a/library/netdata.po +++ b/library/netdata.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/netrc.po b/library/netrc.po index bc2295c1..6244e958 100644 --- a/library/netrc.po +++ b/library/netrc.po @@ -8,29 +8,30 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: library/netrc.rst:3 -msgid ":mod:`netrc` --- netrc file processing" +#: library/netrc.rst:2 +msgid ":mod:`!netrc` --- netrc file processing" msgstr "" -#: library/netrc.rst:11 +#: library/netrc.rst:10 msgid "**Source code:** :source:`Lib/netrc.py`" msgstr "" -#: library/netrc.rst:15 +#: library/netrc.rst:14 msgid "" "The :class:`~netrc.netrc` class parses and encapsulates the netrc file " "format used by the Unix :program:`ftp` program and other FTP clients." msgstr "" -#: library/netrc.rst:21 +#: library/netrc.rst:20 msgid "" "A :class:`~netrc.netrc` instance or subclass instance encapsulates data " "from a netrc file. The initialization argument, if present, specifies the " @@ -38,26 +39,31 @@ msgid "" "user's home directory -- as determined by :func:`os.path.expanduser` -- will " "be read. Otherwise, a :exc:`FileNotFoundError` exception will be raised. " "Parse errors will raise :exc:`NetrcParseError` with diagnostic information " -"including the file name, line number, and terminating token. If no argument " -"is specified on a POSIX system, the presence of passwords in the :file:`." -"netrc` file will raise a :exc:`NetrcParseError` if the file ownership or " -"permissions are insecure (owned by a user other than the user running the " -"process, or accessible for read or write by any other user). This implements " -"security behavior equivalent to that of ftp and other programs that use :" -"file:`.netrc`." +"including the file name, line number, and terminating token." msgstr "" -#: library/netrc.rst:35 +#: library/netrc.rst:28 +msgid "" +"If no argument is specified on a POSIX system, the presence of passwords in " +"the :file:`.netrc` file will raise a :exc:`NetrcParseError` if the file " +"ownership or permissions are insecure (owned by a user other than the user " +"running the process, or accessible for read or write by any other user). " +"This implements security behavior equivalent to that of ftp and other " +"programs that use :file:`.netrc`. Such security checks are not available on " +"platforms that do not support :func:`os.getuid`." +msgstr "" + +#: library/netrc.rst:36 msgid "Added the POSIX permission check." msgstr "" -#: library/netrc.rst:37 +#: library/netrc.rst:38 msgid "" ":func:`os.path.expanduser` is used to find the location of the :file:`." "netrc` file when *file* is not passed as argument." msgstr "" -#: library/netrc.rst:41 +#: library/netrc.rst:42 msgid "" ":class:`netrc` try UTF-8 encoding before using locale specific encoding. The " "entry in the netrc file no longer needs to contain all tokens. The missing " @@ -67,34 +73,34 @@ msgid "" "check." msgstr "" -#: library/netrc.rst:52 +#: library/netrc.rst:53 msgid "" "Exception raised by the :class:`~netrc.netrc` class when syntactical errors " "are encountered in source text. Instances of this exception provide three " "interesting attributes:" msgstr "" -#: library/netrc.rst:58 +#: library/netrc.rst:59 msgid "Textual explanation of the error." msgstr "" -#: library/netrc.rst:62 +#: library/netrc.rst:63 msgid "The name of the source file." msgstr "" -#: library/netrc.rst:66 +#: library/netrc.rst:67 msgid "The line number on which the error was found." msgstr "" -#: library/netrc.rst:72 +#: library/netrc.rst:73 msgid "netrc Objects" msgstr "" -#: library/netrc.rst:74 +#: library/netrc.rst:75 msgid "A :class:`~netrc.netrc` instance has the following methods:" msgstr "" -#: library/netrc.rst:79 +#: library/netrc.rst:80 msgid "" "Return a 3-tuple ``(login, account, password)`` of authenticators for " "*host*. If the netrc file did not contain an entry for the given host, " @@ -102,22 +108,22 @@ msgid "" "host nor default entry is available, return ``None``." msgstr "" -#: library/netrc.rst:87 +#: library/netrc.rst:88 msgid "" "Dump the class data as a string in the format of a netrc file. (This " "discards comments and may reorder the entries.)" msgstr "" -#: library/netrc.rst:90 +#: library/netrc.rst:91 msgid "Instances of :class:`~netrc.netrc` have public instance variables:" msgstr "" -#: library/netrc.rst:95 +#: library/netrc.rst:96 msgid "" "Dictionary mapping host names to ``(login, account, password)`` tuples. The " "'default' entry, if any, is represented as a pseudo-host by that name." msgstr "" -#: library/netrc.rst:101 +#: library/netrc.rst:102 msgid "Dictionary mapping macro names to string lists." msgstr "" diff --git a/library/nis.po b/library/nis.po index 285e8f04..3da30877 100644 --- a/library/nis.po +++ b/library/nis.po @@ -8,88 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: library/nis.rst:3 -msgid ":mod:`nis` --- Interface to Sun's NIS (Yellow Pages)" +#: library/nis.rst:2 +msgid ":mod:`!nis` --- Interface to Sun’s NIS (Yellow Pages)" msgstr "" -#: library/nis.rst:16 +#: library/nis.rst:10 msgid "" -"The :mod:`nis` module is deprecated (see :pep:`PEP 594 <594#nis>` for " -"details)." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/nis.rst:19 +#: library/nis.rst:14 msgid "" -"The :mod:`nis` module gives a thin wrapper around the NIS library, useful " -"for central administration of several hosts." -msgstr "" - -#: library/nis.rst:22 -msgid "" -"Because NIS exists only on Unix systems, this module is only available for " -"Unix." -msgstr "" - -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" - -#: library/nis.rst:26 -msgid "The :mod:`nis` module defines the following functions:" -msgstr "" - -#: library/nis.rst:31 -msgid "" -"Return the match for *key* in map *mapname*, or raise an error (:exc:`nis." -"error`) if there is none. Both should be strings, *key* is 8-bit clean. " -"Return value is an arbitrary array of bytes (may contain ``NULL`` and other " -"joys)." -msgstr "" - -#: library/nis.rst:48 -msgid "Note that *mapname* is first checked if it is an alias to another name." -msgstr "" - -#: library/nis.rst:50 library/nis.rst:58 -msgid "" -"The *domain* argument allows overriding the NIS domain used for the lookup. " -"If unspecified, lookup is in the default NIS domain." -msgstr "" - -#: library/nis.rst:44 -msgid "" -"Return a dictionary mapping *key* to *value* such that ``match(key, " -"mapname)==value``. Note that both keys and values of the dictionary are " -"arbitrary arrays of bytes." -msgstr "" - -#: library/nis.rst:56 -msgid "Return a list of all valid maps." -msgstr "" - -#: library/nis.rst:64 -msgid "Return the system default NIS domain." -msgstr "" - -#: library/nis.rst:67 -msgid "The :mod:`nis` module defines the following exception:" -msgstr "" - -#: library/nis.rst:71 -msgid "An error raised when a NIS function returns an error code." +"The last version of Python that provided the :mod:`!nis` module was `Python " +"3.12 `_." msgstr "" diff --git a/library/nntplib.po b/library/nntplib.po index eb15c000..1b6e8477 100644 --- a/library/nntplib.po +++ b/library/nntplib.po @@ -8,575 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/nntplib.rst:2 -msgid ":mod:`nntplib` --- NNTP protocol client" +msgid ":mod:`!nntplib` --- NNTP protocol client" msgstr "" -#: library/nntplib.rst:8 -msgid "**Source code:** :source:`Lib/nntplib.py`" -msgstr "" - -#: library/nntplib.rst:14 -msgid "The :mod:`nntplib` module is deprecated (see :pep:`594` for details)." -msgstr "" - -#: library/nntplib.rst:36 -msgid "" -"This module defines the class :class:`NNTP` which implements the client side " -"of the Network News Transfer Protocol. It can be used to implement a news " -"reader or poster, or automated news processors. It is compatible with :rfc:" -"`3977` as well as the older :rfc:`977` and :rfc:`2980`." -msgstr "" - -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" - -#: library/nntplib.rst:43 -msgid "" -"Here are two small examples of how it can be used. To list some statistics " -"about a newsgroup and print the subjects of the last 10 articles::" -msgstr "" - -#: library/nntplib.rst:67 -msgid "" -"To post an article from a binary file (this assumes that the article has " -"valid headers, and that you have right to post on the particular newsgroup)::" -msgstr "" - -#: library/nntplib.rst:77 -msgid "The module itself defines the following classes:" -msgstr "" - -#: library/nntplib.rst:82 -msgid "" -"Return a new :class:`NNTP` object, representing a connection to the NNTP " -"server running on host *host*, listening at port *port*. An optional " -"*timeout* can be specified for the socket connection. If the optional *user* " -"and *password* are provided, or if suitable credentials are present in :file:" -"`/.netrc` and the optional flag *usenetrc* is true, the ``AUTHINFO USER`` " -"and ``AUTHINFO PASS`` commands are used to identify and authenticate the " -"user to the server. If the optional flag *readermode* is true, then a " -"``mode reader`` command is sent before authentication is performed. Reader " -"mode is sometimes necessary if you are connecting to an NNTP server on the " -"local machine and intend to call reader-specific commands, such as " -"``group``. If you get unexpected :exc:`NNTPPermanentError`\\ s, you might " -"need to set *readermode*. The :class:`NNTP` class supports the :keyword:" -"`with` statement to unconditionally consume :exc:`OSError` exceptions and to " -"close the NNTP connection when done, e.g.:" -msgstr "" - -#: library/nntplib.rst:148 -msgid "" -"Raises an :ref:`auditing event ` ``nntplib.connect`` with " -"arguments ``self``, ``host``, ``port``." -msgstr "" - -#: library/nntplib.rst:150 -msgid "" -"Raises an :ref:`auditing event ` ``nntplib.putline`` with " -"arguments ``self``, ``line``." -msgstr "" - -#: library/nntplib.rst:141 -msgid "" -"All commands will raise an :ref:`auditing event ` ``nntplib." -"putline`` with arguments ``self`` and ``line``, where ``line`` is the bytes " -"about to be sent to the remote host." -msgstr "" - -#: library/nntplib.rst:113 -msgid "*usenetrc* is now ``False`` by default." -msgstr "" - -#: library/nntplib.rst:116 -msgid "Support for the :keyword:`with` statement was added." -msgstr "" - -#: library/nntplib.rst:152 -msgid "" -"If the *timeout* parameter is set to be zero, it will raise a :class:" -"`ValueError` to prevent the creation of a non-blocking socket." -msgstr "" - -#: library/nntplib.rst:125 -msgid "" -"Return a new :class:`NNTP_SSL` object, representing an encrypted connection " -"to the NNTP server running on host *host*, listening at port *port*. :class:" -"`NNTP_SSL` objects have the same methods as :class:`NNTP` objects. If " -"*port* is omitted, port 563 (NNTPS) is used. *ssl_context* is also optional, " -"and is a :class:`~ssl.SSLContext` object. Please read :ref:`ssl-security` " -"for best practices. All other parameters behave the same as for :class:" -"`NNTP`." -msgstr "" - -#: library/nntplib.rst:133 -msgid "" -"Note that SSL-on-563 is discouraged per :rfc:`4642`, in favor of STARTTLS as " -"described below. However, some servers only support the former." -msgstr "" - -#: library/nntplib.rst:147 -msgid "" -"The class now supports hostname check with :attr:`ssl.SSLContext." -"check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." -msgstr "" - -#: library/nntplib.rst:158 -msgid "" -"Derived from the standard exception :exc:`Exception`, this is the base class " -"for all exceptions raised by the :mod:`nntplib` module. Instances of this " -"class have the following attribute:" -msgstr "" - -#: library/nntplib.rst:164 -msgid "The response of the server if available, as a :class:`str` object." -msgstr "" - -#: library/nntplib.rst:169 -msgid "Exception raised when an unexpected reply is received from the server." -msgstr "" - -#: library/nntplib.rst:174 -msgid "" -"Exception raised when a response code in the range 400--499 is received." -msgstr "" - -#: library/nntplib.rst:179 -msgid "" -"Exception raised when a response code in the range 500--599 is received." -msgstr "" - -#: library/nntplib.rst:184 -msgid "" -"Exception raised when a reply is received from the server that does not " -"begin with a digit in the range 1--5." -msgstr "" - -#: library/nntplib.rst:190 -msgid "Exception raised when there is some error in the response data." -msgstr "" - -#: library/nntplib.rst:196 -msgid "NNTP Objects" -msgstr "" - -#: library/nntplib.rst:198 -msgid "" -"When connected, :class:`NNTP` and :class:`NNTP_SSL` objects support the " -"following methods and attributes." -msgstr "" - -#: library/nntplib.rst:202 -msgid "Attributes" -msgstr "" - -#: library/nntplib.rst:206 -msgid "" -"An integer representing the version of the NNTP protocol supported by the " -"server. In practice, this should be ``2`` for servers advertising :rfc:" -"`3977` compliance and ``1`` for others." -msgstr "" - -#: library/nntplib.rst:214 -msgid "" -"A string describing the software name and version of the NNTP server, or :" -"const:`None` if not advertised by the server." -msgstr "" - -#: library/nntplib.rst:220 -msgid "Methods" -msgstr "" - -#: library/nntplib.rst:222 -msgid "" -"The *response* that is returned as the first item in the return tuple of " -"almost all methods is the server's response: a string beginning with a three-" -"digit code. If the server's response indicates an error, the method raises " -"one of the above exceptions." -msgstr "" - -#: library/nntplib.rst:227 -msgid "" -"Many of the following methods take an optional keyword-only argument *file*. " -"When the *file* argument is supplied, it must be either a :term:`file " -"object` opened for binary writing, or the name of an on-disk file to be " -"written to. The method will then write any data returned by the server " -"(except for the response line and the terminating dot) to the file; any list " -"of lines, tuples or objects that the method normally returns will be empty." -msgstr "" - -#: library/nntplib.rst:234 -msgid "" -"Many of the following methods have been reworked and fixed, which makes them " -"incompatible with their 3.1 counterparts." -msgstr "" - -#: library/nntplib.rst:241 -msgid "" -"Send a ``QUIT`` command and close the connection. Once this method has been " -"called, no other methods of the NNTP object should be called." -msgstr "" - -#: library/nntplib.rst:247 -msgid "" -"Return the welcome message sent by the server in reply to the initial " -"connection. (This message sometimes contains disclaimers or help " -"information that may be relevant to the user.)" -msgstr "" - -#: library/nntplib.rst:254 -msgid "" -"Return the :rfc:`3977` capabilities advertised by the server, as a :class:" -"`dict` instance mapping capability names to (possibly empty) lists of " -"values. On legacy servers which don't understand the ``CAPABILITIES`` " -"command, an empty dictionary is returned instead." -msgstr "" - -#: library/nntplib.rst:268 -msgid "" -"Send ``AUTHINFO`` commands with the user name and password. If *user* and " -"*password* are ``None`` and *usenetrc* is true, credentials from ``~/." -"netrc`` will be used if possible." -msgstr "" - -#: library/nntplib.rst:272 -msgid "" -"Unless intentionally delayed, login is normally performed during the :class:" -"`NNTP` object initialization and separately calling this function is " -"unnecessary. To force authentication to be delayed, you must not set *user* " -"or *password* when creating the object, and must set *usenetrc* to False." -msgstr "" - -#: library/nntplib.rst:283 -msgid "" -"Send a ``STARTTLS`` command. This will enable encryption on the NNTP " -"connection. The *context* argument is optional and should be a :class:`ssl." -"SSLContext` object. Please read :ref:`ssl-security` for best practices." -msgstr "" - -#: library/nntplib.rst:288 -msgid "" -"Note that this may not be done after authentication information has been " -"transmitted, and authentication occurs by default if possible during a :" -"class:`NNTP` object initialization. See :meth:`NNTP.login` for information " -"on suppressing this behavior." -msgstr "" - -#: library/nntplib.rst:295 -msgid "" -"The method now supports hostname check with :attr:`ssl.SSLContext." -"check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." -msgstr "" - -#: library/nntplib.rst:302 -msgid "" -"Send a ``NEWGROUPS`` command. The *date* argument should be a :class:" -"`datetime.date` or :class:`datetime.datetime` object. Return a pair " -"``(response, groups)`` where *groups* is a list representing the groups that " -"are new since the given *date*. If *file* is supplied, though, then *groups* " -"will be empty." -msgstr "" - -#: library/nntplib.rst:318 -msgid "" -"Send a ``NEWNEWS`` command. Here, *group* is a group name or ``'*'``, and " -"*date* has the same meaning as for :meth:`newgroups`. Return a pair " -"``(response, articles)`` where *articles* is a list of message ids." -msgstr "" - -#: library/nntplib.rst:322 -msgid "This command is frequently disabled by NNTP server administrators." -msgstr "" - -#: library/nntplib.rst:327 -msgid "" -"Send a ``LIST`` or ``LIST ACTIVE`` command. Return a pair ``(response, " -"list)`` where *list* is a list of tuples representing all the groups " -"available from this NNTP server, optionally matching the pattern string " -"*group_pattern*. Each tuple has the form ``(group, last, first, flag)``, " -"where *group* is a group name, *last* and *first* are the last and first " -"article numbers, and *flag* usually takes one of these values:" -msgstr "" - -#: library/nntplib.rst:335 -msgid "``y``: Local postings and articles from peers are allowed." -msgstr "" - -#: library/nntplib.rst:336 -msgid "``m``: The group is moderated and all postings must be approved." -msgstr "" - -#: library/nntplib.rst:337 -msgid "``n``: No local postings are allowed, only articles from peers." -msgstr "" - -#: library/nntplib.rst:338 -msgid "``j``: Articles from peers are filed in the junk group instead." -msgstr "" - -#: library/nntplib.rst:339 -msgid "``x``: No local postings, and articles from peers are ignored." -msgstr "" - -#: library/nntplib.rst:340 -msgid "``=foo.bar``: Articles are filed in the ``foo.bar`` group instead." -msgstr "" - -#: library/nntplib.rst:342 -msgid "" -"If *flag* has another value, then the status of the newsgroup should be " -"considered unknown." -msgstr "" - -#: library/nntplib.rst:345 -msgid "" -"This command can return very large results, especially if *group_pattern* is " -"not specified. It is best to cache the results offline unless you really " -"need to refresh them." -msgstr "" - -#: library/nntplib.rst:349 -msgid "*group_pattern* was added." -msgstr "" - -#: library/nntplib.rst:355 -msgid "" -"Send a ``LIST NEWSGROUPS`` command, where *grouppattern* is a wildmat string " -"as specified in :rfc:`3977` (it's essentially the same as DOS or UNIX shell " -"wildcard strings). Return a pair ``(response, descriptions)``, where " -"*descriptions* is a dictionary mapping group names to textual descriptions." -msgstr "" - -#: library/nntplib.rst:369 -msgid "" -"Get a description for a single group *group*. If more than one group " -"matches (if 'group' is a real wildmat string), return the first match. If " -"no group matches, return an empty string." -msgstr "" - -#: library/nntplib.rst:373 -msgid "" -"This elides the response code from the server. If the response code is " -"needed, use :meth:`descriptions`." -msgstr "" - -#: library/nntplib.rst:379 -msgid "" -"Send a ``GROUP`` command, where *name* is the group name. The group is " -"selected as the current group, if it exists. Return a tuple ``(response, " -"count, first, last, name)`` where *count* is the (estimated) number of " -"articles in the group, *first* is the first article number in the group, " -"*last* is the last article number in the group, and *name* is the group name." -msgstr "" - -#: library/nntplib.rst:389 -msgid "" -"Send an ``OVER`` command, or an ``XOVER`` command on legacy servers. " -"*message_spec* can be either a string representing a message id, or a " -"``(first, last)`` tuple of numbers indicating a range of articles in the " -"current group, or a ``(first, None)`` tuple indicating a range of articles " -"starting from *first* to the last article in the current group, or :const:" -"`None` to select the current article in the current group." -msgstr "" - -#: library/nntplib.rst:396 -msgid "" -"Return a pair ``(response, overviews)``. *overviews* is a list of " -"``(article_number, overview)`` tuples, one for each article selected by " -"*message_spec*. Each *overview* is a dictionary with the same number of " -"items, but this number depends on the server. These items are either " -"message headers (the key is then the lower-cased header name) or metadata " -"items (the key is then the metadata name prepended with ``\":\"``). The " -"following items are guaranteed to be present by the NNTP specification:" -msgstr "" - -#: library/nntplib.rst:404 -msgid "" -"the ``subject``, ``from``, ``date``, ``message-id`` and ``references`` " -"headers" -msgstr "" - -#: library/nntplib.rst:406 -msgid "" -"the ``:bytes`` metadata: the number of bytes in the entire raw article " -"(including headers and body)" -msgstr "" - -#: library/nntplib.rst:408 -msgid "the ``:lines`` metadata: the number of lines in the article body" -msgstr "" - -#: library/nntplib.rst:410 -msgid "" -"The value of each item is either a string, or :const:`None` if not present." -msgstr "" - -#: library/nntplib.rst:412 -msgid "" -"It is advisable to use the :func:`decode_header` function on header values " -"when they may contain non-ASCII characters::" -msgstr "" - -#: library/nntplib.rst:432 -msgid "" -"Send a ``HELP`` command. Return a pair ``(response, list)`` where *list* is " -"a list of help strings." -msgstr "" - -#: library/nntplib.rst:438 -msgid "" -"Send a ``STAT`` command, where *message_spec* is either a message id " -"(enclosed in ``'<'`` and ``'>'``) or an article number in the current group. " -"If *message_spec* is omitted or :const:`None`, the current article in the " -"current group is considered. Return a triple ``(response, number, id)`` " -"where *number* is the article number and *id* is the message id." -msgstr "" - -#: library/nntplib.rst:452 -msgid "Send a ``NEXT`` command. Return as for :meth:`.stat`." -msgstr "" - -#: library/nntplib.rst:457 -msgid "Send a ``LAST`` command. Return as for :meth:`.stat`." -msgstr "" - -#: library/nntplib.rst:462 -msgid "" -"Send an ``ARTICLE`` command, where *message_spec* has the same meaning as " -"for :meth:`.stat`. Return a tuple ``(response, info)`` where *info* is a :" -"class:`~collections.namedtuple` with three attributes *number*, *message_id* " -"and *lines* (in that order). *number* is the article number in the group " -"(or 0 if the information is not available), *message_id* the message id as a " -"string, and *lines* a list of lines (without terminating newlines) " -"comprising the raw message including headers and body." -msgstr "" - -#: library/nntplib.rst:487 -msgid "" -"Same as :meth:`article()`, but sends a ``HEAD`` command. The *lines* " -"returned (or written to *file*) will only contain the message headers, not " -"the body." -msgstr "" - -#: library/nntplib.rst:494 -msgid "" -"Same as :meth:`article()`, but sends a ``BODY`` command. The *lines* " -"returned (or written to *file*) will only contain the message body, not the " -"headers." -msgstr "" - -#: library/nntplib.rst:501 -msgid "" -"Post an article using the ``POST`` command. The *data* argument is either " -"a :term:`file object` opened for binary reading, or any iterable of bytes " -"objects (representing raw lines of the article to be posted). It should " -"represent a well-formed news article, including the required headers. The :" -"meth:`post` method automatically escapes lines beginning with ``.`` and " -"appends the termination line." -msgstr "" - -#: library/nntplib.rst:508 -msgid "" -"If the method succeeds, the server's response is returned. If the server " -"refuses posting, a :class:`NNTPReplyError` is raised." -msgstr "" - -#: library/nntplib.rst:514 -msgid "" -"Send an ``IHAVE`` command. *message_id* is the id of the message to send to " -"the server (enclosed in ``'<'`` and ``'>'``). The *data* parameter and the " -"return value are the same as for :meth:`post()`." -msgstr "" - -#: library/nntplib.rst:521 -msgid "" -"Return a pair ``(response, date)``. *date* is a :class:`~datetime.datetime` " -"object containing the current date and time of the server." -msgstr "" - -#: library/nntplib.rst:527 -msgid "Send a ``SLAVE`` command. Return the server's *response*." -msgstr "" - -#: library/nntplib.rst:532 -msgid "" -"Set the instance's debugging level. This controls the amount of debugging " -"output printed. The default, ``0``, produces no debugging output. A value " -"of ``1`` produces a moderate amount of debugging output, generally a single " -"line per request or response. A value of ``2`` or higher produces the " -"maximum amount of debugging output, logging each line sent and received on " -"the connection (including message text)." -msgstr "" - -#: library/nntplib.rst:540 -msgid "" -"The following are optional NNTP extensions defined in :rfc:`2980`. Some of " -"them have been superseded by newer commands in :rfc:`3977`." -msgstr "" - -#: library/nntplib.rst:546 -msgid "" -"Send an ``XHDR`` command. The *hdr* argument is a header keyword, e.g. " -"``'subject'``. The *str* argument should have the form ``'first-last'`` " -"where *first* and *last* are the first and last article numbers to search. " -"Return a pair ``(response, list)``, where *list* is a list of pairs ``(id, " -"text)``, where *id* is an article number (as a string) and *text* is the " -"text of the requested header for that article. If the *file* parameter is " -"supplied, then the output of the ``XHDR`` command is stored in a file. If " -"*file* is a string, then the method will open a file with that name, write " -"to it then close it. If *file* is a :term:`file object`, then it will start " -"calling :meth:`write` on it to store the lines of the command output. If " -"*file* is supplied, then the returned *list* is an empty list." -msgstr "" - -#: library/nntplib.rst:561 +#: library/nntplib.rst:10 msgid "" -"Send an ``XOVER`` command. *start* and *end* are article numbers delimiting " -"the range of articles to select. The return value is the same of for :meth:" -"`over()`. It is recommended to use :meth:`over()` instead, since it will " -"automatically use the newer ``OVER`` command if available." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/nntplib.rst:569 -msgid "Utility functions" -msgstr "" - -#: library/nntplib.rst:571 -msgid "The module also defines the following utility function:" -msgstr "" - -#: library/nntplib.rst:576 +#: library/nntplib.rst:14 msgid "" -"Decode a header value, un-escaping any escaped non-ASCII characters. " -"*header_str* must be a :class:`str` object. The unescaped value is " -"returned. Using this function is recommended to display some headers in a " -"human readable form::" -msgstr "" - -#: library/nntplib.rst:10 -msgid "NNTP" -msgstr "" - -#: library/nntplib.rst:10 -msgid "protocol" -msgstr "" - -#: library/nntplib.rst:10 -msgid "Network News Transfer Protocol" +"The last version of Python that provided the :mod:`!nntplib` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/numbers.po b/library/numbers.po index d34c3014..6dee3252 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/numbers.rst:2 -msgid ":mod:`numbers` --- Numeric abstract base classes" +msgid ":mod:`!numbers` --- Numeric abstract base classes" msgstr "" #: library/numbers.rst:7 @@ -59,50 +60,54 @@ msgstr "" msgid "Abstract. Retrieves the imaginary component of this number." msgstr "" -#: library/numbers.rst:43 +#: library/numbers.rst:44 msgid "" "Abstract. Returns the complex conjugate. For example, ``(1+3j).conjugate() " "== (1-3j)``." msgstr "" -#: library/numbers.rst:48 +#: library/numbers.rst:49 msgid "" "To :class:`Complex`, :class:`!Real` adds the operations that work on real " "numbers." msgstr "" -#: library/numbers.rst:51 +#: library/numbers.rst:52 msgid "" "In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :" "func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, " "``%``, ``<``, ``<=``, ``>``, and ``>=``." msgstr "" -#: library/numbers.rst:55 +#: library/numbers.rst:56 msgid "" "Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :" "attr:`~Complex.imag`, and :meth:`~Complex.conjugate`." msgstr "" -#: library/numbers.rst:61 +#: library/numbers.rst:62 msgid "" "Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" "`~Rational.denominator` properties. It also provides a default for :func:" "`float`." msgstr "" -#: library/numbers.rst:65 +#: library/numbers.rst:66 msgid "" "The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values " "should be instances of :class:`Integral` and should be in lowest terms with :" "attr:`~Rational.denominator` positive." msgstr "" -#: library/numbers.rst:75 -msgid "Abstract." +#: library/numbers.rst:72 +msgid "Abstract. The numerator of this rational number." msgstr "" -#: library/numbers.rst:80 +#: library/numbers.rst:76 +msgid "Abstract. The denominator of this rational number." +msgstr "" + +#: library/numbers.rst:81 msgid "" "Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides " "defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" @@ -110,34 +115,55 @@ msgid "" "and bit-string operations: ``<<``, ``>>``, ``&``, ``^``, ``|``, ``~``." msgstr "" -#: library/numbers.rst:88 -msgid "Notes for type implementors" +#: library/numbers.rst:89 +msgid "Notes for type implementers" msgstr "" -#: library/numbers.rst:90 +#: library/numbers.rst:91 msgid "" -"Implementors should be careful to make equal numbers equal and hash them to " +"Implementers should be careful to make equal numbers equal and hash them to " "the same values. This may be subtle if there are two different extensions of " "the real numbers. For example, :class:`fractions.Fraction` implements :func:" "`hash` as follows::" msgstr "" -#: library/numbers.rst:109 +#: library/numbers.rst:96 +msgid "" +"def __hash__(self):\n" +" if self.denominator == 1:\n" +" # Get integers right.\n" +" return hash(self.numerator)\n" +" # Expensive check, but definitely correct.\n" +" if self == float(self):\n" +" return hash(float(self))\n" +" else:\n" +" # Use tuple's hash to avoid a high collision rate on\n" +" # simple fractions.\n" +" return hash((self.numerator, self.denominator))" +msgstr "" + +#: library/numbers.rst:110 msgid "Adding More Numeric ABCs" msgstr "" -#: library/numbers.rst:111 +#: library/numbers.rst:112 msgid "" "There are, of course, more possible ABCs for numbers, and this would be a " "poor hierarchy if it precluded the possibility of adding those. You can add " "``MyFoo`` between :class:`Complex` and :class:`Real` with::" msgstr "" -#: library/numbers.rst:123 +#: library/numbers.rst:117 +msgid "" +"class MyFoo(Complex): ...\n" +"MyFoo.register(Real)" +msgstr "" + +#: library/numbers.rst:124 msgid "Implementing the arithmetic operations" msgstr "" -#: library/numbers.rst:125 +#: library/numbers.rst:126 msgid "" "We want to implement the arithmetic operations so that mixed-mode operations " "either call an implementation whose author knew about the types of both " @@ -146,7 +172,34 @@ msgid "" "__add__` and :meth:`~object.__radd__` should be defined as::" msgstr "" -#: library/numbers.rst:157 +#: library/numbers.rst:133 +msgid "" +"class MyIntegral(Integral):\n" +"\n" +" def __add__(self, other):\n" +" if isinstance(other, MyIntegral):\n" +" return do_my_adding_stuff(self, other)\n" +" elif isinstance(other, OtherTypeIKnowAbout):\n" +" return do_my_other_adding_stuff(self, other)\n" +" else:\n" +" return NotImplemented\n" +"\n" +" def __radd__(self, other):\n" +" if isinstance(other, MyIntegral):\n" +" return do_my_adding_stuff(other, self)\n" +" elif isinstance(other, OtherTypeIKnowAbout):\n" +" return do_my_other_adding_stuff(other, self)\n" +" elif isinstance(other, Integral):\n" +" return int(other) + int(self)\n" +" elif isinstance(other, Real):\n" +" return float(other) + float(self)\n" +" elif isinstance(other, Complex):\n" +" return complex(other) + complex(self)\n" +" else:\n" +" return NotImplemented" +msgstr "" + +#: library/numbers.rst:158 msgid "" "There are 5 different cases for a mixed-type operation on subclasses of :" "class:`Complex`. I'll refer to all of the above code that doesn't refer to " @@ -155,12 +208,12 @@ msgid "" "Complex``), and ``b : B <: Complex``. I'll consider ``a + b``:" msgstr "" -#: library/numbers.rst:164 +#: library/numbers.rst:165 msgid "" "If ``A`` defines an :meth:`~object.__add__` which accepts ``b``, all is well." msgstr "" -#: library/numbers.rst:166 +#: library/numbers.rst:167 msgid "" "If ``A`` falls back to the boilerplate code, and it were to return a value " "from :meth:`~object.__add__`, we'd miss the possibility that ``B`` defines a " @@ -169,26 +222,26 @@ msgid "" "meth:`!__add__` at all.)" msgstr "" -#: library/numbers.rst:172 +#: library/numbers.rst:173 msgid "" "Then ``B``'s :meth:`~object.__radd__` gets a chance. If it accepts ``a``, " "all is well." msgstr "" -#: library/numbers.rst:174 +#: library/numbers.rst:175 msgid "" "If it falls back to the boilerplate, there are no more possible methods to " "try, so this is where the default implementation should live." msgstr "" -#: library/numbers.rst:177 +#: library/numbers.rst:178 msgid "" "If ``B <: A``, Python tries ``B.__radd__`` before ``A.__add__``. This is ok, " "because it was implemented with knowledge of ``A``, so it can handle those " "instances before delegating to :class:`Complex`." msgstr "" -#: library/numbers.rst:182 +#: library/numbers.rst:183 msgid "" "If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, " "then the appropriate shared operation is the one involving the built in :" @@ -196,10 +249,51 @@ msgid "" "b+a``." msgstr "" -#: library/numbers.rst:187 +#: library/numbers.rst:188 msgid "" "Because most of the operations on any given type will be very similar, it " "can be useful to define a helper function which generates the forward and " "reverse instances of any given operator. For example, :class:`fractions." "Fraction` uses::" msgstr "" + +#: library/numbers.rst:193 +msgid "" +"def _operator_fallbacks(monomorphic_operator, fallback_operator):\n" +" def forward(a, b):\n" +" if isinstance(b, (int, Fraction)):\n" +" return monomorphic_operator(a, b)\n" +" elif isinstance(b, float):\n" +" return fallback_operator(float(a), b)\n" +" elif isinstance(b, complex):\n" +" return fallback_operator(complex(a), b)\n" +" else:\n" +" return NotImplemented\n" +" forward.__name__ = '__' + fallback_operator.__name__ + '__'\n" +" forward.__doc__ = monomorphic_operator.__doc__\n" +"\n" +" def reverse(b, a):\n" +" if isinstance(a, Rational):\n" +" # Includes ints.\n" +" return monomorphic_operator(a, b)\n" +" elif isinstance(a, Real):\n" +" return fallback_operator(float(a), float(b))\n" +" elif isinstance(a, Complex):\n" +" return fallback_operator(complex(a), complex(b))\n" +" else:\n" +" return NotImplemented\n" +" reverse.__name__ = '__r' + fallback_operator.__name__ + '__'\n" +" reverse.__doc__ = monomorphic_operator.__doc__\n" +"\n" +" return forward, reverse\n" +"\n" +"def _add(a, b):\n" +" \"\"\"a + b\"\"\"\n" +" return Fraction(a.numerator * b.denominator +\n" +" b.numerator * a.denominator,\n" +" a.denominator * b.denominator)\n" +"\n" +"__add__, __radd__ = _operator_fallbacks(_add, operator.add)\n" +"\n" +"# ..." +msgstr "" diff --git a/library/numeric.po b/library/numeric.po index 85b31db1..5e29f50e 100644 --- a/library/numeric.po +++ b/library/numeric.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Last-Translator: Loukas Sakellaridis \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/numeric.rst:6 msgid "Numeric and Mathematical Modules" -msgstr "" +msgstr "Αριθμητικά και Μαθηματικά Modules" #: library/numeric.rst:8 msgid "" @@ -29,7 +30,14 @@ msgid "" "mod:`decimal` module supports exact representations of decimal numbers, " "using arbitrary precision arithmetic." msgstr "" +"Τα modules που περιγράφονται σε αυτό το κεφάλαιο παρέχουν αριθμητικές και " +"μαθηματικές συναρτήσεις και τύπους δεδομένων. Το πακέτο :mod:`numbers` " +"ορίζει μια αφηρημένη ιεραρχία τύπων δεδομένων. Τα modules :mod:`math` και :" +"mod:`cmath` περιέχουν διάφορες μαθηματικές συναρτήσεις για αριθμούς κινητής " +"υποδιαστολής και μιγαδικούς αριθμούς. Το module :mod:`decimal` υποστηρίζει " +"ακριβείς αναπαραστάσεις δεκαδικών αριθμών χρησιμοποιώντας αριθμητική " +"αυθαίρετης ακρίβειας." #: library/numeric.rst:15 msgid "The following modules are documented in this chapter:" -msgstr "" +msgstr "Τα ακόλουθα modules αναλύονται σε αυτό το κεφάλαιο" diff --git a/library/operator.po b/library/operator.po index 2d367662..b5292ce6 100644 --- a/library/operator.po +++ b/library/operator.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/operator.rst:2 -msgid ":mod:`operator` --- Standard operators as functions" +msgid ":mod:`!operator` --- Standard operators as functions" msgstr "" #: library/operator.rst:9 @@ -86,142 +87,150 @@ msgstr "" msgid "Return ``a is not b``. Tests object identity." msgstr "" -#: library/operator.rst:83 +#: library/operator.rst:85 +msgid "Return ``a is None``. Tests object identity." +msgstr "" + +#: library/operator.rst:92 +msgid "Return ``a is not None``. Tests object identity." +msgstr "" + +#: library/operator.rst:97 msgid "The mathematical and bitwise operations are the most numerous:" msgstr "" -#: library/operator.rst:89 +#: library/operator.rst:103 msgid "Return the absolute value of *obj*." msgstr "" -#: library/operator.rst:95 +#: library/operator.rst:109 msgid "Return ``a + b``, for *a* and *b* numbers." msgstr "" -#: library/operator.rst:101 +#: library/operator.rst:115 msgid "Return the bitwise and of *a* and *b*." msgstr "" -#: library/operator.rst:107 +#: library/operator.rst:121 msgid "Return ``a // b``." msgstr "" -#: library/operator.rst:113 +#: library/operator.rst:127 msgid "Return *a* converted to an integer. Equivalent to ``a.__index__()``." msgstr "" -#: library/operator.rst:115 +#: library/operator.rst:129 msgid "" "The result always has exact type :class:`int`. Previously, the result could " "have been an instance of a subclass of ``int``." msgstr "" -#: library/operator.rst:125 +#: library/operator.rst:139 msgid "" "Return the bitwise inverse of the number *obj*. This is equivalent to " "``~obj``." msgstr "" -#: library/operator.rst:131 +#: library/operator.rst:145 msgid "Return *a* shifted left by *b*." msgstr "" -#: library/operator.rst:137 +#: library/operator.rst:151 msgid "Return ``a % b``." msgstr "" -#: library/operator.rst:143 +#: library/operator.rst:157 msgid "Return ``a * b``, for *a* and *b* numbers." msgstr "" -#: library/operator.rst:149 +#: library/operator.rst:163 msgid "Return ``a @ b``." msgstr "" -#: library/operator.rst:157 +#: library/operator.rst:171 msgid "Return *obj* negated (``-obj``)." msgstr "" -#: library/operator.rst:163 +#: library/operator.rst:177 msgid "Return the bitwise or of *a* and *b*." msgstr "" -#: library/operator.rst:169 +#: library/operator.rst:183 msgid "Return *obj* positive (``+obj``)." msgstr "" -#: library/operator.rst:175 +#: library/operator.rst:189 msgid "Return ``a ** b``, for *a* and *b* numbers." msgstr "" -#: library/operator.rst:181 +#: library/operator.rst:195 msgid "Return *a* shifted right by *b*." msgstr "" -#: library/operator.rst:187 +#: library/operator.rst:201 msgid "Return ``a - b``." msgstr "" -#: library/operator.rst:193 +#: library/operator.rst:207 msgid "" "Return ``a / b`` where 2/3 is .66 rather than 0. This is also known as " "\"true\" division." msgstr "" -#: library/operator.rst:200 +#: library/operator.rst:214 msgid "Return the bitwise exclusive or of *a* and *b*." msgstr "" -#: library/operator.rst:203 +#: library/operator.rst:217 msgid "" "Operations which work with sequences (some of them with mappings too) " "include:" msgstr "" -#: library/operator.rst:208 +#: library/operator.rst:222 msgid "Return ``a + b`` for *a* and *b* sequences." msgstr "" -#: library/operator.rst:214 +#: library/operator.rst:228 msgid "Return the outcome of the test ``b in a``. Note the reversed operands." msgstr "" -#: library/operator.rst:219 +#: library/operator.rst:233 msgid "Return the number of occurrences of *b* in *a*." msgstr "" -#: library/operator.rst:225 +#: library/operator.rst:239 msgid "Remove the value of *a* at index *b*." msgstr "" -#: library/operator.rst:231 +#: library/operator.rst:245 msgid "Return the value of *a* at index *b*." msgstr "" -#: library/operator.rst:236 +#: library/operator.rst:250 msgid "Return the index of the first of occurrence of *b* in *a*." msgstr "" -#: library/operator.rst:242 +#: library/operator.rst:256 msgid "Set the value of *a* at index *b* to *c*." msgstr "" -#: library/operator.rst:247 +#: library/operator.rst:261 msgid "" "Return an estimated length for the object *obj*. First try to return its " "actual length, then an estimate using :meth:`object.__length_hint__`, and " "finally return the default value." msgstr "" -#: library/operator.rst:254 +#: library/operator.rst:268 msgid "The following operation works with callables:" msgstr "" -#: library/operator.rst:259 +#: library/operator.rst:273 msgid "Return ``obj(*args, **kwargs)``." msgstr "" -#: library/operator.rst:264 +#: library/operator.rst:278 msgid "" "The :mod:`operator` module also defines tools for generalized attribute and " "item lookups. These are useful for making fast field extractors as " @@ -229,508 +238,565 @@ msgid "" "other functions that expect a function argument." msgstr "" -#: library/operator.rst:273 +#: library/operator.rst:287 msgid "" "Return a callable object that fetches *attr* from its operand. If more than " "one attribute is requested, returns a tuple of attributes. The attribute " "names can also contain dots. For example:" msgstr "" -#: library/operator.rst:277 +#: library/operator.rst:291 msgid "After ``f = attrgetter('name')``, the call ``f(b)`` returns ``b.name``." msgstr "" -#: library/operator.rst:279 +#: library/operator.rst:293 msgid "" "After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns ``(b." "name, b.date)``." msgstr "" -#: library/operator.rst:282 +#: library/operator.rst:296 msgid "" "After ``f = attrgetter('name.first', 'name.last')``, the call ``f(b)`` " "returns ``(b.name.first, b.name.last)``." msgstr "" -#: library/operator.rst:317 library/operator.rst:365 +#: library/operator.rst:331 library/operator.rst:379 msgid "Equivalent to::" msgstr "" -#: library/operator.rst:308 +#: library/operator.rst:301 +msgid "" +"def attrgetter(*items):\n" +" if any(not isinstance(item, str) for item in items):\n" +" raise TypeError('attribute name must be a string')\n" +" if len(items) == 1:\n" +" attr = items[0]\n" +" def g(obj):\n" +" return resolve_attr(obj, attr)\n" +" else:\n" +" def g(obj):\n" +" return tuple(resolve_attr(obj, attr) for attr in items)\n" +" return g\n" +"\n" +"def resolve_attr(obj, attr):\n" +" for name in attr.split(\".\"):\n" +" obj = getattr(obj, name)\n" +" return obj" +msgstr "" + +#: library/operator.rst:322 msgid "" "Return a callable object that fetches *item* from its operand using the " "operand's :meth:`~object.__getitem__` method. If multiple items are " "specified, returns a tuple of lookup values. For example:" msgstr "" -#: library/operator.rst:312 +#: library/operator.rst:326 msgid "After ``f = itemgetter(2)``, the call ``f(r)`` returns ``r[2]``." msgstr "" -#: library/operator.rst:314 +#: library/operator.rst:328 msgid "" "After ``g = itemgetter(2, 5, 3)``, the call ``g(r)`` returns ``(r[2], r[5], " "r[3])``." msgstr "" -#: library/operator.rst:329 +#: library/operator.rst:333 +msgid "" +"def itemgetter(*items):\n" +" if len(items) == 1:\n" +" item = items[0]\n" +" def g(obj):\n" +" return obj[item]\n" +" else:\n" +" def g(obj):\n" +" return tuple(obj[item] for item in items)\n" +" return g" +msgstr "" + +#: library/operator.rst:343 msgid "" "The items can be any type accepted by the operand's :meth:`~object." "__getitem__` method. Dictionaries accept any :term:`hashable` value. " "Lists, tuples, and strings accept an index or a slice:" msgstr "" -#: library/operator.rst:343 +#: library/operator.rst:357 msgid "" "Example of using :func:`itemgetter` to retrieve specific fields from a tuple " "record:" msgstr "" -#: library/operator.rst:356 +#: library/operator.rst:370 msgid "" "Return a callable object that calls the method *name* on its operand. If " "additional arguments and/or keyword arguments are given, they will be given " "to the method as well. For example:" msgstr "" -#: library/operator.rst:360 +#: library/operator.rst:374 msgid "" "After ``f = methodcaller('name')``, the call ``f(b)`` returns ``b.name()``." msgstr "" -#: library/operator.rst:362 +#: library/operator.rst:376 msgid "" "After ``f = methodcaller('name', 'foo', bar=1)``, the call ``f(b)`` returns " "``b.name('foo', bar=1)``." msgstr "" -#: library/operator.rst:376 +#: library/operator.rst:381 +msgid "" +"def methodcaller(name, /, *args, **kwargs):\n" +" def caller(obj):\n" +" return getattr(obj, name)(*args, **kwargs)\n" +" return caller" +msgstr "" + +#: library/operator.rst:390 msgid "Mapping Operators to Functions" msgstr "" -#: library/operator.rst:378 +#: library/operator.rst:392 msgid "" "This table shows how abstract operations correspond to operator symbols in " "the Python syntax and the functions in the :mod:`operator` module." msgstr "" -#: library/operator.rst:382 +#: library/operator.rst:396 msgid "Operation" msgstr "" -#: library/operator.rst:382 +#: library/operator.rst:396 msgid "Syntax" msgstr "" -#: library/operator.rst:382 +#: library/operator.rst:396 msgid "Function" msgstr "" -#: library/operator.rst:384 +#: library/operator.rst:398 msgid "Addition" msgstr "" -#: library/operator.rst:384 +#: library/operator.rst:398 msgid "``a + b``" msgstr "" -#: library/operator.rst:384 +#: library/operator.rst:398 msgid "``add(a, b)``" msgstr "" -#: library/operator.rst:386 +#: library/operator.rst:400 msgid "Concatenation" msgstr "" -#: library/operator.rst:386 +#: library/operator.rst:400 msgid "``seq1 + seq2``" msgstr "" -#: library/operator.rst:386 +#: library/operator.rst:400 msgid "``concat(seq1, seq2)``" msgstr "" -#: library/operator.rst:388 +#: library/operator.rst:402 msgid "Containment Test" msgstr "" -#: library/operator.rst:388 +#: library/operator.rst:402 msgid "``obj in seq``" msgstr "" -#: library/operator.rst:388 +#: library/operator.rst:402 msgid "``contains(seq, obj)``" msgstr "" -#: library/operator.rst:392 +#: library/operator.rst:406 msgid "Division" msgstr "" -#: library/operator.rst:390 +#: library/operator.rst:404 msgid "``a / b``" msgstr "" -#: library/operator.rst:390 +#: library/operator.rst:404 msgid "``truediv(a, b)``" msgstr "" -#: library/operator.rst:392 +#: library/operator.rst:406 msgid "``a // b``" msgstr "" -#: library/operator.rst:392 +#: library/operator.rst:406 msgid "``floordiv(a, b)``" msgstr "" -#: library/operator.rst:394 +#: library/operator.rst:408 msgid "Bitwise And" msgstr "" -#: library/operator.rst:394 +#: library/operator.rst:408 msgid "``a & b``" msgstr "" -#: library/operator.rst:394 +#: library/operator.rst:408 msgid "``and_(a, b)``" msgstr "" -#: library/operator.rst:396 +#: library/operator.rst:410 msgid "Bitwise Exclusive Or" msgstr "" -#: library/operator.rst:396 +#: library/operator.rst:410 msgid "``a ^ b``" msgstr "" -#: library/operator.rst:396 +#: library/operator.rst:410 msgid "``xor(a, b)``" msgstr "" -#: library/operator.rst:398 +#: library/operator.rst:412 msgid "Bitwise Inversion" msgstr "" -#: library/operator.rst:398 +#: library/operator.rst:412 msgid "``~ a``" msgstr "" -#: library/operator.rst:398 +#: library/operator.rst:412 msgid "``invert(a)``" msgstr "" -#: library/operator.rst:400 +#: library/operator.rst:414 msgid "Bitwise Or" msgstr "" -#: library/operator.rst:400 +#: library/operator.rst:414 msgid "``a | b``" msgstr "" -#: library/operator.rst:400 +#: library/operator.rst:414 msgid "``or_(a, b)``" msgstr "" -#: library/operator.rst:402 +#: library/operator.rst:416 msgid "Exponentiation" msgstr "" -#: library/operator.rst:402 +#: library/operator.rst:416 msgid "``a ** b``" msgstr "" -#: library/operator.rst:402 +#: library/operator.rst:416 msgid "``pow(a, b)``" msgstr "" -#: library/operator.rst:406 +#: library/operator.rst:420 library/operator.rst:424 msgid "Identity" msgstr "" -#: library/operator.rst:404 +#: library/operator.rst:418 msgid "``a is b``" msgstr "" -#: library/operator.rst:404 +#: library/operator.rst:418 msgid "``is_(a, b)``" msgstr "" -#: library/operator.rst:406 +#: library/operator.rst:420 msgid "``a is not b``" msgstr "" -#: library/operator.rst:406 +#: library/operator.rst:420 msgid "``is_not(a, b)``" msgstr "" -#: library/operator.rst:408 +#: library/operator.rst:422 +msgid "``a is None``" +msgstr "" + +#: library/operator.rst:422 +msgid "``is_none(a)``" +msgstr "" + +#: library/operator.rst:424 +msgid "``a is not None``" +msgstr "" + +#: library/operator.rst:424 +msgid "``is_not_none(a)``" +msgstr "" + +#: library/operator.rst:426 msgid "Indexed Assignment" msgstr "" -#: library/operator.rst:408 +#: library/operator.rst:426 msgid "``obj[k] = v``" msgstr "" -#: library/operator.rst:408 +#: library/operator.rst:426 msgid "``setitem(obj, k, v)``" msgstr "" -#: library/operator.rst:410 +#: library/operator.rst:428 msgid "Indexed Deletion" msgstr "" -#: library/operator.rst:410 +#: library/operator.rst:428 msgid "``del obj[k]``" msgstr "" -#: library/operator.rst:410 +#: library/operator.rst:428 msgid "``delitem(obj, k)``" msgstr "" -#: library/operator.rst:412 +#: library/operator.rst:430 msgid "Indexing" msgstr "" -#: library/operator.rst:412 +#: library/operator.rst:430 msgid "``obj[k]``" msgstr "" -#: library/operator.rst:412 +#: library/operator.rst:430 msgid "``getitem(obj, k)``" msgstr "" -#: library/operator.rst:414 +#: library/operator.rst:432 msgid "Left Shift" msgstr "" -#: library/operator.rst:414 +#: library/operator.rst:432 msgid "``a << b``" msgstr "" -#: library/operator.rst:414 +#: library/operator.rst:432 msgid "``lshift(a, b)``" msgstr "" -#: library/operator.rst:416 +#: library/operator.rst:434 msgid "Modulo" msgstr "" -#: library/operator.rst:416 +#: library/operator.rst:434 msgid "``a % b``" msgstr "" -#: library/operator.rst:416 +#: library/operator.rst:434 msgid "``mod(a, b)``" msgstr "" -#: library/operator.rst:418 +#: library/operator.rst:436 msgid "Multiplication" msgstr "" -#: library/operator.rst:418 +#: library/operator.rst:436 msgid "``a * b``" msgstr "" -#: library/operator.rst:418 +#: library/operator.rst:436 msgid "``mul(a, b)``" msgstr "" -#: library/operator.rst:420 +#: library/operator.rst:438 msgid "Matrix Multiplication" msgstr "" -#: library/operator.rst:420 +#: library/operator.rst:438 msgid "``a @ b``" msgstr "" -#: library/operator.rst:420 +#: library/operator.rst:438 msgid "``matmul(a, b)``" msgstr "" -#: library/operator.rst:422 +#: library/operator.rst:440 msgid "Negation (Arithmetic)" msgstr "" -#: library/operator.rst:422 +#: library/operator.rst:440 msgid "``- a``" msgstr "" -#: library/operator.rst:422 +#: library/operator.rst:440 msgid "``neg(a)``" msgstr "" -#: library/operator.rst:424 +#: library/operator.rst:442 msgid "Negation (Logical)" msgstr "" -#: library/operator.rst:424 +#: library/operator.rst:442 msgid "``not a``" msgstr "" -#: library/operator.rst:424 +#: library/operator.rst:442 msgid "``not_(a)``" msgstr "" -#: library/operator.rst:426 +#: library/operator.rst:444 msgid "Positive" msgstr "" -#: library/operator.rst:426 +#: library/operator.rst:444 msgid "``+ a``" msgstr "" -#: library/operator.rst:426 +#: library/operator.rst:444 msgid "``pos(a)``" msgstr "" -#: library/operator.rst:428 +#: library/operator.rst:446 msgid "Right Shift" msgstr "" -#: library/operator.rst:428 +#: library/operator.rst:446 msgid "``a >> b``" msgstr "" -#: library/operator.rst:428 +#: library/operator.rst:446 msgid "``rshift(a, b)``" msgstr "" -#: library/operator.rst:430 +#: library/operator.rst:448 msgid "Slice Assignment" msgstr "" -#: library/operator.rst:430 +#: library/operator.rst:448 msgid "``seq[i:j] = values``" msgstr "" -#: library/operator.rst:430 +#: library/operator.rst:448 msgid "``setitem(seq, slice(i, j), values)``" msgstr "" -#: library/operator.rst:432 +#: library/operator.rst:450 msgid "Slice Deletion" msgstr "" -#: library/operator.rst:432 +#: library/operator.rst:450 msgid "``del seq[i:j]``" msgstr "" -#: library/operator.rst:432 +#: library/operator.rst:450 msgid "``delitem(seq, slice(i, j))``" msgstr "" -#: library/operator.rst:434 +#: library/operator.rst:452 msgid "Slicing" msgstr "" -#: library/operator.rst:434 +#: library/operator.rst:452 msgid "``seq[i:j]``" msgstr "" -#: library/operator.rst:434 +#: library/operator.rst:452 msgid "``getitem(seq, slice(i, j))``" msgstr "" -#: library/operator.rst:436 +#: library/operator.rst:454 msgid "String Formatting" msgstr "" -#: library/operator.rst:436 +#: library/operator.rst:454 msgid "``s % obj``" msgstr "" -#: library/operator.rst:436 +#: library/operator.rst:454 msgid "``mod(s, obj)``" msgstr "" -#: library/operator.rst:438 +#: library/operator.rst:456 msgid "Subtraction" msgstr "" -#: library/operator.rst:438 +#: library/operator.rst:456 msgid "``a - b``" msgstr "" -#: library/operator.rst:438 +#: library/operator.rst:456 msgid "``sub(a, b)``" msgstr "" -#: library/operator.rst:440 +#: library/operator.rst:458 msgid "Truth Test" msgstr "" -#: library/operator.rst:440 +#: library/operator.rst:458 msgid "``obj``" msgstr "" -#: library/operator.rst:440 +#: library/operator.rst:458 msgid "``truth(obj)``" msgstr "" -#: library/operator.rst:444 library/operator.rst:452 +#: library/operator.rst:462 library/operator.rst:470 msgid "Ordering" msgstr "" -#: library/operator.rst:442 +#: library/operator.rst:460 msgid "``a < b``" msgstr "" -#: library/operator.rst:442 +#: library/operator.rst:460 msgid "``lt(a, b)``" msgstr "" -#: library/operator.rst:444 +#: library/operator.rst:462 msgid "``a <= b``" msgstr "" -#: library/operator.rst:444 +#: library/operator.rst:462 msgid "``le(a, b)``" msgstr "" -#: library/operator.rst:446 +#: library/operator.rst:464 msgid "Equality" msgstr "" -#: library/operator.rst:446 +#: library/operator.rst:464 msgid "``a == b``" msgstr "" -#: library/operator.rst:446 +#: library/operator.rst:464 msgid "``eq(a, b)``" msgstr "" -#: library/operator.rst:448 +#: library/operator.rst:466 msgid "Difference" msgstr "" -#: library/operator.rst:448 +#: library/operator.rst:466 msgid "``a != b``" msgstr "" -#: library/operator.rst:448 +#: library/operator.rst:466 msgid "``ne(a, b)``" msgstr "" -#: library/operator.rst:450 +#: library/operator.rst:468 msgid "``a >= b``" msgstr "" -#: library/operator.rst:450 +#: library/operator.rst:468 msgid "``ge(a, b)``" msgstr "" -#: library/operator.rst:452 +#: library/operator.rst:470 msgid "``a > b``" msgstr "" -#: library/operator.rst:452 +#: library/operator.rst:470 msgid "``gt(a, b)``" msgstr "" -#: library/operator.rst:456 +#: library/operator.rst:474 msgid "In-place Operators" msgstr "" -#: library/operator.rst:458 +#: library/operator.rst:476 msgid "" "Many operations have an \"in-place\" version. Listed below are functions " "providing a more primitive access to in-place operators than the usual " @@ -740,7 +806,7 @@ msgid "" "y``." msgstr "" -#: library/operator.rst:465 +#: library/operator.rst:483 msgid "" "In those examples, note that when an in-place method is called, the " "computation and assignment are performed in two separate steps. The in-" @@ -748,71 +814,71 @@ msgid "" "method. The second step, assignment, is not handled." msgstr "" -#: library/operator.rst:470 +#: library/operator.rst:488 msgid "" "For immutable targets such as strings, numbers, and tuples, the updated " "value is computed, but not assigned back to the input variable:" msgstr "" -#: library/operator.rst:479 +#: library/operator.rst:497 msgid "" "For mutable targets such as lists and dictionaries, the in-place method will " "perform the update, so no subsequent assignment is necessary:" msgstr "" -#: library/operator.rst:491 +#: library/operator.rst:509 msgid "``a = iadd(a, b)`` is equivalent to ``a += b``." msgstr "" -#: library/operator.rst:497 +#: library/operator.rst:515 msgid "``a = iand(a, b)`` is equivalent to ``a &= b``." msgstr "" -#: library/operator.rst:503 +#: library/operator.rst:521 msgid "" "``a = iconcat(a, b)`` is equivalent to ``a += b`` for *a* and *b* sequences." msgstr "" -#: library/operator.rst:509 +#: library/operator.rst:527 msgid "``a = ifloordiv(a, b)`` is equivalent to ``a //= b``." msgstr "" -#: library/operator.rst:515 +#: library/operator.rst:533 msgid "``a = ilshift(a, b)`` is equivalent to ``a <<= b``." msgstr "" -#: library/operator.rst:521 +#: library/operator.rst:539 msgid "``a = imod(a, b)`` is equivalent to ``a %= b``." msgstr "" -#: library/operator.rst:527 +#: library/operator.rst:545 msgid "``a = imul(a, b)`` is equivalent to ``a *= b``." msgstr "" -#: library/operator.rst:533 +#: library/operator.rst:551 msgid "``a = imatmul(a, b)`` is equivalent to ``a @= b``." msgstr "" -#: library/operator.rst:541 +#: library/operator.rst:559 msgid "``a = ior(a, b)`` is equivalent to ``a |= b``." msgstr "" -#: library/operator.rst:547 +#: library/operator.rst:565 msgid "``a = ipow(a, b)`` is equivalent to ``a **= b``." msgstr "" -#: library/operator.rst:553 +#: library/operator.rst:571 msgid "``a = irshift(a, b)`` is equivalent to ``a >>= b``." msgstr "" -#: library/operator.rst:559 +#: library/operator.rst:577 msgid "``a = isub(a, b)`` is equivalent to ``a -= b``." msgstr "" -#: library/operator.rst:565 +#: library/operator.rst:583 msgid "``a = itruediv(a, b)`` is equivalent to ``a /= b``." msgstr "" -#: library/operator.rst:571 +#: library/operator.rst:589 msgid "``a = ixor(a, b)`` is equivalent to ``a ^= b``." msgstr "" diff --git a/library/optparse.po b/library/optparse.po index f483ad6e..c5c35d36 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -8,32 +8,218 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/optparse.rst:2 -msgid ":mod:`optparse` --- Parser for command line options" +msgid ":mod:`!optparse` --- Parser for command line options" msgstr "" -#: library/optparse.rst:11 +#: library/optparse.rst:10 msgid "**Source code:** :source:`Lib/optparse.py`" msgstr "" -#: library/optparse.rst:13 -msgid "" -"The :mod:`optparse` module is deprecated and will not be developed further; " -"development will continue with the :mod:`argparse` module." +#: library/optparse.rst:17 +msgid "Choosing an argument parsing library" msgstr "" #: library/optparse.rst:19 +msgid "The standard library includes three argument parsing libraries:" +msgstr "" + +#: library/optparse.rst:21 +msgid "" +":mod:`getopt`: a module that closely mirrors the procedural C ``getopt`` " +"API. Included in the standard library since before the initial Python 1.0 " +"release." +msgstr "" + +#: library/optparse.rst:23 +msgid "" +":mod:`optparse`: a declarative replacement for ``getopt`` that provides " +"equivalent functionality without requiring each application to implement its " +"own procedural option parsing logic. Included in the standard library since " +"the Python 2.3 release." +msgstr "" + +#: library/optparse.rst:27 +msgid "" +":mod:`argparse`: a more opinionated alternative to ``optparse`` that " +"provides more functionality by default, at the expense of reduced " +"application flexibility in controlling exactly how arguments are processed. " +"Included in the standard library since the Python 2.7 and Python 3.2 " +"releases." +msgstr "" + +#: library/optparse.rst:32 +msgid "" +"In the absence of more specific argument parsing design constraints, :mod:" +"`argparse` is the recommended choice for implementing command line " +"applications, as it offers the highest level of baseline functionality with " +"the least application level code." +msgstr "" + +#: library/optparse.rst:36 +msgid "" +":mod:`getopt` is retained almost entirely for backwards compatibility " +"reasons. However, it also serves a niche use case as a tool for prototyping " +"and testing command line argument handling in ``getopt``-based C " +"applications." +msgstr "" + +#: library/optparse.rst:40 +msgid "" +":mod:`optparse` should be considered as an alternative to :mod:`argparse` in " +"the following cases:" +msgstr "" + +#: library/optparse.rst:43 +msgid "" +"an application is already using :mod:`optparse` and doesn't want to risk the " +"subtle behavioural changes that may arise when migrating to :mod:`argparse`" +msgstr "" + +#: library/optparse.rst:45 +msgid "" +"the application requires additional control over the way options and " +"positional parameters are interleaved on the command line (including the " +"ability to disable the interleaving feature completely)" +msgstr "" + +#: library/optparse.rst:48 +msgid "" +"the application requires additional control over the incremental parsing of " +"command line elements (while ``argparse`` does support this, the exact way " +"it works in practice is undesirable for some use cases)" +msgstr "" + +#: library/optparse.rst:51 +msgid "" +"the application requires additional control over the handling of options " +"which accept parameter values that may start with ``-`` (such as delegated " +"options to be passed to invoked subprocesses)" +msgstr "" + +#: library/optparse.rst:54 +msgid "" +"the application requires some other command line parameter processing " +"behavior which ``argparse`` does not support, but which can be implemented " +"in terms of the lower level interface offered by ``optparse``" +msgstr "" + +#: library/optparse.rst:58 +msgid "" +"These considerations also mean that :mod:`optparse` is likely to provide a " +"better foundation for library authors writing third party command line " +"argument processing libraries." +msgstr "" + +#: library/optparse.rst:62 +msgid "" +"As a concrete example, consider the following two command line argument " +"parsing configurations, the first using ``optparse``, and the second using " +"``argparse``:" +msgstr "" + +#: library/optparse.rst:66 +msgid "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" +msgstr "" + +#: library/optparse.rst:77 +msgid "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" +msgstr "" + +#: library/optparse.rst:89 +msgid "" +"The most obvious difference is that in the ``optparse`` version, the non-" +"option arguments are processed separately by the application after the " +"option processing is complete. In the ``argparse`` version, positional " +"arguments are declared and processed in the same way as the named options." +msgstr "" + +#: library/optparse.rst:94 +msgid "" +"However, the ``argparse`` version will also handle some parameter " +"combination differently from the way the ``optparse`` version would handle " +"them. For example (amongst other differences):" +msgstr "" + +#: library/optparse.rst:98 +msgid "" +"supplying ``-o -v`` gives ``output=\"-v\"`` and ``verbose=False`` when using " +"``optparse``, but a usage error with ``argparse`` (complaining that no value " +"has been supplied for ``-o/--output``, since ``-v`` is interpreted as " +"meaning the verbosity flag)" +msgstr "" + +#: library/optparse.rst:102 +msgid "" +"similarly, supplying ``-o --`` gives ``output=\"--\"`` and ``args=()`` when " +"using ``optparse``, but a usage error with ``argparse`` (also complaining " +"that no value has been supplied for ``-o/--output``, since ``--`` is " +"interpreted as terminating the option processing and treating all remaining " +"values as positional arguments)" +msgstr "" + +#: library/optparse.rst:107 +msgid "" +"supplying ``-o=foo`` gives ``output=\"=foo\"`` when using ``optparse``, but " +"gives ``output=\"foo\"`` with ``argparse`` (since ``=`` is special cased as " +"an alternative separator for option parameter values)" +msgstr "" + +#: library/optparse.rst:111 +msgid "" +"Whether these differing behaviors in the ``argparse`` version are considered " +"desirable or a problem will depend on the specific command line application " +"use case." +msgstr "" + +#: library/optparse.rst:117 +msgid "" +":pypi:`click` is a third party argument processing library (originally based " +"on ``optparse``), which allows command line applications to be developed as " +"a set of decorated command implementation functions." +msgstr "" + +#: library/optparse.rst:121 +msgid "" +"Other third party libraries, such as :pypi:`typer` or :pypi:`msgspec-click`, " +"allow command line interfaces to be specified in ways that more effectively " +"integrate with static checking of Python type annotations." +msgstr "" + +#: library/optparse.rst:127 +msgid "Introduction" +msgstr "" + +#: library/optparse.rst:129 msgid "" ":mod:`optparse` is a more convenient, flexible, and powerful library for " -"parsing command-line options than the old :mod:`getopt` module. :mod:" +"parsing command-line options than the minimalist :mod:`getopt` module. :mod:" "`optparse` uses a more declarative style of command-line parsing: you create " "an instance of :class:`OptionParser`, populate it with options, and parse " "the command line. :mod:`optparse` allows users to specify options in the " @@ -41,17 +227,35 @@ msgid "" "messages for you." msgstr "" -#: library/optparse.rst:26 +#: library/optparse.rst:137 msgid "Here's an example of using :mod:`optparse` in a simple script::" msgstr "" -#: library/optparse.rst:39 +#: library/optparse.rst:139 +msgid "" +"from optparse import OptionParser\n" +"...\n" +"parser = OptionParser()\n" +"parser.add_option(\"-f\", \"--file\", dest=\"filename\",\n" +" help=\"write report to FILE\", metavar=\"FILE\")\n" +"parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\", default=True,\n" +" help=\"don't print status messages to stdout\")\n" +"\n" +"(options, args) = parser.parse_args()" +msgstr "" + +#: library/optparse.rst:150 msgid "" "With these few lines of code, users of your script can now do the \"usual " "thing\" on the command-line, for example::" msgstr "" -#: library/optparse.rst:44 +#: library/optparse.rst:153 +msgid " --file=outfile -q" +msgstr "" + +#: library/optparse.rst:155 msgid "" "As it parses the command line, :mod:`optparse` sets attributes of the " "``options`` object returned by :meth:`~OptionParser.parse_args` based on " @@ -64,43 +268,69 @@ msgid "" "the above example::" msgstr "" -#: library/optparse.rst:58 +#: library/optparse.rst:164 +msgid "" +" -f outfile --quiet\n" +" --quiet --file outfile\n" +" -q -foutfile\n" +" -qfoutfile" +msgstr "" + +#: library/optparse.rst:169 msgid "Additionally, users can run one of the following ::" msgstr "" -#: library/optparse.rst:63 +#: library/optparse.rst:171 +msgid "" +" -h\n" +" --help" +msgstr "" + +#: library/optparse.rst:174 msgid "" "and :mod:`optparse` will print out a brief summary of your script's options:" msgstr "" -#: library/optparse.rst:74 +#: library/optparse.rst:176 +msgid "" +"Usage: [options]\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -f FILE, --file=FILE write report to FILE\n" +" -q, --quiet don't print status messages to stdout" +msgstr "" + +#: library/optparse.rst:185 msgid "" "where the value of *yourscript* is determined at runtime (normally from " "``sys.argv[0]``)." msgstr "" -#: library/optparse.rst:81 +#: library/optparse.rst:192 msgid "Background" msgstr "" -#: library/optparse.rst:83 +#: library/optparse.rst:194 msgid "" ":mod:`optparse` was explicitly designed to encourage the creation of " -"programs with straightforward, conventional command-line interfaces. To " -"that end, it supports only the most common command-line syntax and semantics " -"conventionally used under Unix. If you are unfamiliar with these " -"conventions, read this section to acquaint yourself with them." +"programs with straightforward command-line interfaces that follow the " +"conventions established by the :c:func:`!getopt` family of functions " +"available to C developers. To that end, it supports only the most common " +"command-line syntax and semantics conventionally used under Unix. If you " +"are unfamiliar with these conventions, reading this section will allow you " +"to acquaint yourself with them." msgstr "" -#: library/optparse.rst:93 +#: library/optparse.rst:205 msgid "Terminology" msgstr "" -#: library/optparse.rst:104 +#: library/optparse.rst:207 msgid "argument" msgstr "" -#: library/optparse.rst:96 +#: library/optparse.rst:208 msgid "" "a string entered on the command-line, and passed by the shell to ``execl()`` " "or ``execv()``. In Python, arguments are elements of ``sys.argv[1:]`` " @@ -108,7 +338,7 @@ msgid "" "also use the term \"word\"." msgstr "" -#: library/optparse.rst:101 +#: library/optparse.rst:213 msgid "" "It is occasionally desirable to substitute an argument list other than ``sys." "argv[1:]``, so you should read \"argument\" as \"an element of ``sys." @@ -116,11 +346,11 @@ msgid "" "argv[1:]``\"." msgstr "" -#: library/optparse.rst:134 +#: library/optparse.rst:218 msgid "option" msgstr "" -#: library/optparse.rst:107 +#: library/optparse.rst:219 msgid "" "an argument used to supply extra information to guide or customize the " "execution of a program. There are many different syntaxes for options; the " @@ -132,36 +362,36 @@ msgid "" "option syntaxes provided by :mod:`optparse`." msgstr "" -#: library/optparse.rst:116 +#: library/optparse.rst:228 msgid "Some other option syntaxes that the world has seen include:" msgstr "" -#: library/optparse.rst:118 +#: library/optparse.rst:230 msgid "" "a hyphen followed by a few letters, e.g. ``-pf`` (this is *not* the same as " "multiple options merged into a single argument)" msgstr "" -#: library/optparse.rst:121 +#: library/optparse.rst:233 msgid "" "a hyphen followed by a whole word, e.g. ``-file`` (this is technically " "equivalent to the previous syntax, but they aren't usually seen in the same " "program)" msgstr "" -#: library/optparse.rst:125 +#: library/optparse.rst:237 msgid "" "a plus sign followed by a single letter, or a few letters, or a word, e.g. " "``+f``, ``+rgb``" msgstr "" -#: library/optparse.rst:128 +#: library/optparse.rst:240 msgid "" "a slash followed by a letter, or a few letters, or a word, e.g. ``/f``, ``/" "file``" msgstr "" -#: library/optparse.rst:131 +#: library/optparse.rst:243 msgid "" "These option syntaxes are not supported by :mod:`optparse`, and they never " "will be. This is deliberate: the first three are non-standard on any " @@ -169,11 +399,11 @@ msgid "" "Windows or certain legacy platforms (e.g. VMS, MS-DOS)." msgstr "" -#: library/optparse.rst:160 +#: library/optparse.rst:248 msgid "option argument" msgstr "" -#: library/optparse.rst:137 +#: library/optparse.rst:249 msgid "" "an argument that follows an option, is closely associated with that option, " "and is consumed from the argument list when that option is. With :mod:" @@ -181,11 +411,23 @@ msgid "" "option:" msgstr "" -#: library/optparse.rst:147 +#: library/optparse.rst:254 +msgid "" +"-f foo\n" +"--file foo" +msgstr "" + +#: library/optparse.rst:259 msgid "or included in the same argument:" msgstr "" -#: library/optparse.rst:154 +#: library/optparse.rst:261 +msgid "" +"-ffoo\n" +"--file=foo" +msgstr "" + +#: library/optparse.rst:266 msgid "" "Typically, a given option either takes an argument or it doesn't. Lots of " "people want an \"optional option arguments\" feature, meaning that some " @@ -196,22 +438,22 @@ msgid "" "support this feature." msgstr "" -#: library/optparse.rst:165 +#: library/optparse.rst:274 msgid "positional argument" msgstr "" -#: library/optparse.rst:163 +#: library/optparse.rst:275 msgid "" "something leftover in the argument list after options have been parsed, i.e. " "after options and their arguments have been parsed and removed from the " "argument list." msgstr "" -#: library/optparse.rst:171 +#: library/optparse.rst:279 msgid "required option" msgstr "" -#: library/optparse.rst:168 +#: library/optparse.rst:280 msgid "" "an option that must be supplied on the command-line; note that the phrase " "\"required option\" is self-contradictory in English. :mod:`optparse` " @@ -219,22 +461,26 @@ msgid "" "much help at it either." msgstr "" -#: library/optparse.rst:173 +#: library/optparse.rst:285 msgid "For example, consider this hypothetical command-line::" msgstr "" -#: library/optparse.rst:177 +#: library/optparse.rst:287 +msgid "prog -v --report report.txt foo bar" +msgstr "" + +#: library/optparse.rst:289 msgid "" "``-v`` and ``--report`` are both options. Assuming that ``--report`` takes " "one argument, ``report.txt`` is an option argument. ``foo`` and ``bar`` are " "positional arguments." msgstr "" -#: library/optparse.rst:185 +#: library/optparse.rst:297 msgid "What are options for?" msgstr "" -#: library/optparse.rst:187 +#: library/optparse.rst:299 msgid "" "Options are used to provide extra information to tune or customize the " "execution of a program. In case it wasn't clear, options are usually " @@ -246,7 +492,7 @@ msgid "" "interfaces.)" msgstr "" -#: library/optparse.rst:195 +#: library/optparse.rst:307 msgid "" "Lots of people want their programs to have \"required options\". Think " "about it. If it's required, then it's *not optional*! If there is a piece " @@ -254,7 +500,7 @@ msgid "" "successfully, that's what positional arguments are for." msgstr "" -#: library/optparse.rst:200 +#: library/optparse.rst:312 msgid "" "As an example of good command-line interface design, consider the humble " "``cp`` utility, for copying files. It doesn't make much sense to try to " @@ -263,7 +509,13 @@ msgid "" "useful syntax that does not require any options at all::" msgstr "" -#: library/optparse.rst:209 +#: library/optparse.rst:318 +msgid "" +"cp SOURCE DEST\n" +"cp SOURCE ... DEST-DIR" +msgstr "" + +#: library/optparse.rst:321 msgid "" "You can get pretty far with just that. Most ``cp`` implementations provide " "a bunch of options to tweak exactly how the files are copied: you can " @@ -273,17 +525,17 @@ msgid "" "files to another directory." msgstr "" -#: library/optparse.rst:220 +#: library/optparse.rst:332 msgid "What are positional arguments for?" msgstr "" -#: library/optparse.rst:222 +#: library/optparse.rst:334 msgid "" "Positional arguments are for those pieces of information that your program " "absolutely, positively requires to run." msgstr "" -#: library/optparse.rst:225 +#: library/optparse.rst:337 msgid "" "A good user interface should have as few absolute requirements as possible. " "If your program requires 17 distinct pieces of information in order to run " @@ -294,7 +546,7 @@ msgid "" "most of them will simply give up." msgstr "" -#: library/optparse.rst:233 +#: library/optparse.rst:345 msgid "" "In short, try to minimize the amount of information that users are " "absolutely required to supply---use sensible defaults whenever possible. Of " @@ -307,48 +559,65 @@ msgid "" "make your code much harder to maintain." msgstr "" -#: library/optparse.rst:246 +#: library/optparse.rst:358 msgid "Tutorial" msgstr "" -#: library/optparse.rst:248 +#: library/optparse.rst:360 msgid "" "While :mod:`optparse` is quite flexible and powerful, it's also " "straightforward to use in most cases. This section covers the code patterns " "that are common to any :mod:`optparse`\\ -based program." msgstr "" -#: library/optparse.rst:252 +#: library/optparse.rst:364 msgid "" "First, you need to import the OptionParser class; then, early in the main " "program, create an OptionParser instance::" msgstr "" -#: library/optparse.rst:259 +#: library/optparse.rst:367 +msgid "" +"from optparse import OptionParser\n" +"...\n" +"parser = OptionParser()" +msgstr "" + +#: library/optparse.rst:371 msgid "Then you can start defining options. The basic syntax is::" msgstr "" -#: library/optparse.rst:264 +#: library/optparse.rst:373 +msgid "" +"parser.add_option(opt_str, ...,\n" +" attr=value, ...)" +msgstr "" + +#: library/optparse.rst:376 msgid "" "Each option has one or more option strings, such as ``-f`` or ``--file``, " "and several option attributes that tell :mod:`optparse` what to expect and " "what to do when it encounters that option on the command line." msgstr "" -#: library/optparse.rst:268 +#: library/optparse.rst:380 msgid "" "Typically, each option will have one short option string and one long option " "string, e.g.::" msgstr "" -#: library/optparse.rst:273 +#: library/optparse.rst:383 +msgid "parser.add_option(\"-f\", \"--file\", ...)" +msgstr "" + +#: library/optparse.rst:385 msgid "" "You're free to define as many short option strings and as many long option " "strings as you like (including zero), as long as there is at least one " "option string overall." msgstr "" -#: library/optparse.rst:277 +#: library/optparse.rst:389 msgid "" "The option strings passed to :meth:`OptionParser.add_option` are effectively " "labels for the option defined by that call. For brevity, we will frequently " @@ -356,24 +625,28 @@ msgid "" "`optparse` encounters *option strings* and looks up options from them." msgstr "" -#: library/optparse.rst:283 +#: library/optparse.rst:395 msgid "" "Once all of your options are defined, instruct :mod:`optparse` to parse your " "program's command line::" msgstr "" -#: library/optparse.rst:288 +#: library/optparse.rst:398 +msgid "(options, args) = parser.parse_args()" +msgstr "" + +#: library/optparse.rst:400 msgid "" "(If you like, you can pass a custom argument list to :meth:`~OptionParser." "parse_args`, but that's rarely necessary: by default it uses ``sys." "argv[1:]``.)" msgstr "" -#: library/optparse.rst:291 +#: library/optparse.rst:403 msgid ":meth:`~OptionParser.parse_args` returns two values:" msgstr "" -#: library/optparse.rst:293 +#: library/optparse.rst:405 msgid "" "``options``, an object containing values for all of your options---e.g. if " "``--file`` takes a single string argument, then ``options.file`` will be the " @@ -381,12 +654,12 @@ msgid "" "option" msgstr "" -#: library/optparse.rst:298 +#: library/optparse.rst:410 msgid "" "``args``, the list of positional arguments leftover after parsing options" msgstr "" -#: library/optparse.rst:300 +#: library/optparse.rst:412 msgid "" "This tutorial section only covers the four most important option " "attributes: :attr:`~Option.action`, :attr:`~Option.type`, :attr:`~Option." @@ -394,11 +667,11 @@ msgid "" "action` is the most fundamental." msgstr "" -#: library/optparse.rst:309 +#: library/optparse.rst:421 msgid "Understanding option actions" msgstr "" -#: library/optparse.rst:311 +#: library/optparse.rst:423 msgid "" "Actions tell :mod:`optparse` what to do when it encounters an option on the " "command line. There is a fixed set of actions hard-coded into :mod:" @@ -408,32 +681,44 @@ msgid "" "and store it in an attribute of ``options``." msgstr "" -#: library/optparse.rst:318 +#: library/optparse.rst:430 msgid "" "If you don't specify an option action, :mod:`optparse` defaults to ``store``." msgstr "" -#: library/optparse.rst:324 +#: library/optparse.rst:436 msgid "The store action" msgstr "" -#: library/optparse.rst:326 +#: library/optparse.rst:438 msgid "" "The most common option action is ``store``, which tells :mod:`optparse` to " "take the next argument (or the remainder of the current argument), ensure " "that it is of the correct type, and store it to your chosen destination." msgstr "" -#: library/optparse.rst:330 +#: library/optparse.rst:442 msgid "For example::" msgstr "" -#: library/optparse.rst:335 +#: library/optparse.rst:444 +msgid "" +"parser.add_option(\"-f\", \"--file\",\n" +" action=\"store\", type=\"string\", dest=\"filename\")" +msgstr "" + +#: library/optparse.rst:447 msgid "" "Now let's make up a fake command line and ask :mod:`optparse` to parse it::" msgstr "" -#: library/optparse.rst:340 +#: library/optparse.rst:449 +msgid "" +"args = [\"-f\", \"foo.txt\"]\n" +"(options, args) = parser.parse_args(args)" +msgstr "" + +#: library/optparse.rst:452 msgid "" "When :mod:`optparse` sees the option string ``-f``, it consumes the next " "argument, ``foo.txt``, and stores it in ``options.filename``. So, after " @@ -441,37 +726,51 @@ msgid "" "``\"foo.txt\"``." msgstr "" -#: library/optparse.rst:344 +#: library/optparse.rst:456 msgid "" "Some other option types supported by :mod:`optparse` are ``int`` and " "``float``. Here's an option that expects an integer argument::" msgstr "" -#: library/optparse.rst:349 +#: library/optparse.rst:459 +msgid "parser.add_option(\"-n\", type=\"int\", dest=\"num\")" +msgstr "" + +#: library/optparse.rst:461 msgid "" "Note that this option has no long option string, which is perfectly " "acceptable. Also, there's no explicit action, since the default is ``store``." msgstr "" -#: library/optparse.rst:352 +#: library/optparse.rst:464 msgid "" "Let's parse another fake command-line. This time, we'll jam the option " "argument right up against the option: since ``-n42`` (one argument) is " "equivalent to ``-n 42`` (two arguments), the code ::" msgstr "" -#: library/optparse.rst:359 +#: library/optparse.rst:468 +msgid "" +"(options, args) = parser.parse_args([\"-n42\"])\n" +"print(options.num)" +msgstr "" + +#: library/optparse.rst:471 msgid "will print ``42``." msgstr "" -#: library/optparse.rst:361 +#: library/optparse.rst:473 msgid "" "If you don't specify a type, :mod:`optparse` assumes ``string``. Combined " "with the fact that the default action is ``store``, that means our first " "example can be a lot shorter::" msgstr "" -#: library/optparse.rst:367 +#: library/optparse.rst:477 +msgid "parser.add_option(\"-f\", \"--file\", dest=\"filename\")" +msgstr "" + +#: library/optparse.rst:479 msgid "" "If you don't supply a destination, :mod:`optparse` figures out a sensible " "default from the option strings: if the first long option string is ``--foo-" @@ -480,17 +779,17 @@ msgid "" "default destination for ``-f`` is ``f``." msgstr "" -#: library/optparse.rst:373 +#: library/optparse.rst:485 msgid "" ":mod:`optparse` also includes the built-in ``complex`` type. Adding types " "is covered in section :ref:`optparse-extending-optparse`." msgstr "" -#: library/optparse.rst:380 +#: library/optparse.rst:492 msgid "Handling boolean (flag) options" msgstr "" -#: library/optparse.rst:382 +#: library/optparse.rst:494 msgid "" "Flag options---set a variable to true or false when a particular option is " "seen---are quite common. :mod:`optparse` supports them with two separate " @@ -498,71 +797,77 @@ msgid "" "``verbose`` flag that is turned on with ``-v`` and off with ``-q``::" msgstr "" -#: library/optparse.rst:390 +#: library/optparse.rst:499 +msgid "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" +msgstr "" + +#: library/optparse.rst:502 msgid "" "Here we have two different options with the same destination, which is " "perfectly OK. (It just means you have to be a bit careful when setting " "default values---see below.)" msgstr "" -#: library/optparse.rst:394 +#: library/optparse.rst:506 msgid "" "When :mod:`optparse` encounters ``-v`` on the command line, it sets " "``options.verbose`` to ``True``; when it encounters ``-q``, ``options." "verbose`` is set to ``False``." msgstr "" -#: library/optparse.rst:402 +#: library/optparse.rst:514 msgid "Other actions" msgstr "" -#: library/optparse.rst:404 +#: library/optparse.rst:516 msgid "Some other actions supported by :mod:`optparse` are:" msgstr "" -#: library/optparse.rst:929 +#: library/optparse.rst:1040 msgid "``\"store_const\"``" msgstr "" -#: library/optparse.rst:929 +#: library/optparse.rst:1041 msgid "store a constant value, pre-set via :attr:`Option.const`" msgstr "" -#: library/optparse.rst:938 +#: library/optparse.rst:1049 msgid "``\"append\"``" msgstr "" -#: library/optparse.rst:938 +#: library/optparse.rst:1050 msgid "append this option's argument to a list" msgstr "" -#: library/optparse.rst:944 +#: library/optparse.rst:1055 msgid "``\"count\"``" msgstr "" -#: library/optparse.rst:944 +#: library/optparse.rst:1056 msgid "increment a counter by one" msgstr "" -#: library/optparse.rst:947 +#: library/optparse.rst:1058 msgid "``\"callback\"``" msgstr "" -#: library/optparse.rst:947 +#: library/optparse.rst:1059 msgid "call a specified function" msgstr "" -#: library/optparse.rst:418 +#: library/optparse.rst:530 msgid "" "These are covered in section :ref:`optparse-reference-guide`, and section :" "ref:`optparse-option-callbacks`." msgstr "" -#: library/optparse.rst:425 +#: library/optparse.rst:537 msgid "Default values" msgstr "" -#: library/optparse.rst:427 +#: library/optparse.rst:539 msgid "" "All of the above examples involve setting some variable (the " "\"destination\") when certain command-line options are seen. What happens " @@ -572,48 +877,77 @@ msgid "" "destination, which is assigned before the command line is parsed." msgstr "" -#: library/optparse.rst:434 +#: library/optparse.rst:546 msgid "" "First, consider the verbose/quiet example. If we want :mod:`optparse` to " "set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::" msgstr "" -#: library/optparse.rst:440 +#: library/optparse.rst:549 +msgid "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " +"default=True)\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" +msgstr "" + +#: library/optparse.rst:552 msgid "" "Since default values apply to the *destination* rather than to any " "particular option, and these two options happen to have the same " "destination, this is exactly equivalent::" msgstr "" -#: library/optparse.rst:447 +#: library/optparse.rst:556 +msgid "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " +"default=True)" +msgstr "" + +#: library/optparse.rst:559 msgid "Consider this::" msgstr "" -#: library/optparse.rst:452 +#: library/optparse.rst:561 +msgid "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " +"default=False)\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " +"default=True)" +msgstr "" + +#: library/optparse.rst:564 msgid "" "Again, the default value for ``verbose`` will be ``True``: the last default " "value supplied for any particular destination is the one that counts." msgstr "" -#: library/optparse.rst:455 +#: library/optparse.rst:567 msgid "" "A clearer way to specify default values is the :meth:`set_defaults` method " "of OptionParser, which you can call at any time before calling :meth:" "`~OptionParser.parse_args`::" msgstr "" -#: library/optparse.rst:463 +#: library/optparse.rst:571 +msgid "" +"parser.set_defaults(verbose=True)\n" +"parser.add_option(...)\n" +"(options, args) = parser.parse_args()" +msgstr "" + +#: library/optparse.rst:575 msgid "" "As before, the last value specified for a given option destination is the " "one that counts. For clarity, try to use one method or the other of setting " "default values, not both." msgstr "" -#: library/optparse.rst:471 +#: library/optparse.rst:583 msgid "Generating help" msgstr "" -#: library/optparse.rst:473 +#: library/optparse.rst:585 msgid "" ":mod:`optparse`'s ability to generate help and usage text automatically is " "useful for creating user-friendly command-line interfaces. All you have to " @@ -622,57 +956,97 @@ msgid "" "populated with user-friendly (documented) options::" msgstr "" -#: library/optparse.rst:494 +#: library/optparse.rst:591 +msgid "" +"usage = \"usage: %prog [options] arg1 arg2\"\n" +"parser = OptionParser(usage=usage)\n" +"parser.add_option(\"-v\", \"--verbose\",\n" +" action=\"store_true\", dest=\"verbose\", default=True,\n" +" help=\"make lots of noise [default]\")\n" +"parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\",\n" +" help=\"be vewwy quiet (I'm hunting wabbits)\")\n" +"parser.add_option(\"-f\", \"--filename\",\n" +" metavar=\"FILE\", help=\"write output to FILE\")\n" +"parser.add_option(\"-m\", \"--mode\",\n" +" default=\"intermediate\",\n" +" help=\"interaction mode: novice, intermediate, \"\n" +" \"or expert [default: %default]\")" +msgstr "" + +#: library/optparse.rst:606 msgid "" "If :mod:`optparse` encounters either ``-h`` or ``--help`` on the command-" "line, or if you just call :meth:`parser.print_help`, it prints the following " "to standard output:" msgstr "" -#: library/optparse.rst:511 +#: library/optparse.rst:610 +msgid "" +"Usage: [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or\n" +" expert [default: intermediate]" +msgstr "" + +#: library/optparse.rst:623 msgid "" "(If the help output is triggered by a help option, :mod:`optparse` exits " "after printing the help text.)" msgstr "" -#: library/optparse.rst:514 +#: library/optparse.rst:626 msgid "" "There's a lot going on here to help :mod:`optparse` generate the best " "possible help message:" msgstr "" -#: library/optparse.rst:517 +#: library/optparse.rst:629 msgid "the script defines its own usage message::" msgstr "" -#: library/optparse.rst:521 +#: library/optparse.rst:631 +msgid "usage = \"usage: %prog [options] arg1 arg2\"" +msgstr "" + +#: library/optparse.rst:633 msgid "" ":mod:`optparse` expands ``%prog`` in the usage string to the name of the " "current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded " "string is then printed before the detailed option help." msgstr "" -#: library/optparse.rst:525 +#: library/optparse.rst:637 msgid "" "If you don't supply a usage string, :mod:`optparse` uses a bland but " "sensible default: ``\"Usage: %prog [options]\"``, which is fine if your " "script doesn't take any positional arguments." msgstr "" -#: library/optparse.rst:529 +#: library/optparse.rst:641 msgid "" "every option defines a help string, and doesn't worry about line-wrapping---" "\\ :mod:`optparse` takes care of wrapping lines and making the help output " "look good." msgstr "" -#: library/optparse.rst:533 +#: library/optparse.rst:645 msgid "" "options that take a value indicate this fact in their automatically " "generated help message, e.g. for the \"mode\" option::" msgstr "" -#: library/optparse.rst:538 +#: library/optparse.rst:648 +msgid "-m MODE, --mode=MODE" +msgstr "" + +#: library/optparse.rst:650 msgid "" "Here, \"MODE\" is called the meta-variable: it stands for the argument that " "the user is expected to supply to ``-m``/``--mode``. By default, :mod:" @@ -682,7 +1056,11 @@ msgid "" "this automatically generated option description::" msgstr "" -#: library/optparse.rst:547 +#: library/optparse.rst:657 +msgid "-f FILE, --filename=FILE" +msgstr "" + +#: library/optparse.rst:659 msgid "" "This is important for more than just saving space, though: the manually " "written help text uses the meta-variable ``FILE`` to clue the user in that " @@ -692,7 +1070,7 @@ msgid "" "users." msgstr "" -#: library/optparse.rst:553 +#: library/optparse.rst:665 msgid "" "options that have a default value can include ``%default`` in the help " "string---\\ :mod:`optparse` will replace it with :func:`str` of the option's " @@ -700,96 +1078,172 @@ msgid "" "``None``), ``%default`` expands to ``none``." msgstr "" -#: library/optparse.rst:559 +#: library/optparse.rst:671 msgid "Grouping Options" msgstr "" -#: library/optparse.rst:561 +#: library/optparse.rst:673 msgid "" "When dealing with many options, it is convenient to group these options for " "better help output. An :class:`OptionParser` can contain several option " "groups, each of which can contain several options." msgstr "" -#: library/optparse.rst:565 +#: library/optparse.rst:677 msgid "An option group is obtained using the class :class:`OptionGroup`:" msgstr "" -#: library/optparse.rst:1640 +#: library/optparse.rst:1752 msgid "where" msgstr "" -#: library/optparse.rst:571 +#: library/optparse.rst:683 msgid "" "parser is the :class:`OptionParser` instance the group will be inserted in to" msgstr "" -#: library/optparse.rst:573 +#: library/optparse.rst:685 msgid "title is the group title" msgstr "" -#: library/optparse.rst:574 +#: library/optparse.rst:686 msgid "description, optional, is a long description of the group" msgstr "" -#: library/optparse.rst:576 +#: library/optparse.rst:688 msgid "" ":class:`OptionGroup` inherits from :class:`OptionContainer` (like :class:" "`OptionParser`) and so the :meth:`add_option` method can be used to add an " "option to the group." msgstr "" -#: library/optparse.rst:580 +#: library/optparse.rst:692 msgid "" "Once all the options are declared, using the :class:`OptionParser` method :" "meth:`add_option_group` the group is added to the previously defined parser." msgstr "" -#: library/optparse.rst:583 +#: library/optparse.rst:695 msgid "" "Continuing with the parser defined in the previous section, adding an :class:" "`OptionGroup` to a parser is easy::" msgstr "" -#: library/optparse.rst:592 +#: library/optparse.rst:698 +msgid "" +"group = OptionGroup(parser, \"Dangerous Options\",\n" +" \"Caution: use these options at your own risk. \"\n" +" \"It is believed that some of them bite.\")\n" +"group.add_option(\"-g\", action=\"store_true\", help=\"Group option.\")\n" +"parser.add_option_group(group)" +msgstr "" + +#: library/optparse.rst:704 msgid "This would result in the following help output:" msgstr "" -#: library/optparse.rst:613 +#: library/optparse.rst:706 +msgid "" +"Usage: [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or\n" +" expert [default: intermediate]\n" +"\n" +" Dangerous Options:\n" +" Caution: use these options at your own risk. It is believed that some\n" +" of them bite.\n" +"\n" +" -g Group option." +msgstr "" + +#: library/optparse.rst:725 msgid "" "A bit more complete example might involve using more than one group: still " "extending the previous example::" msgstr "" -#: library/optparse.rst:630 +#: library/optparse.rst:728 +msgid "" +"group = OptionGroup(parser, \"Dangerous Options\",\n" +" \"Caution: use these options at your own risk. \"\n" +" \"It is believed that some of them bite.\")\n" +"group.add_option(\"-g\", action=\"store_true\", help=\"Group option.\")\n" +"parser.add_option_group(group)\n" +"\n" +"group = OptionGroup(parser, \"Debug Options\")\n" +"group.add_option(\"-d\", \"--debug\", action=\"store_true\",\n" +" help=\"Print debug information\")\n" +"group.add_option(\"-s\", \"--sql\", action=\"store_true\",\n" +" help=\"Print all SQL statements executed\")\n" +"group.add_option(\"-e\", action=\"store_true\", help=\"Print every action " +"done\")\n" +"parser.add_option_group(group)" +msgstr "" + +#: library/optparse.rst:742 msgid "that results in the following output:" msgstr "" -#: library/optparse.rst:656 +#: library/optparse.rst:744 +msgid "" +"Usage: [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or expert\n" +" [default: intermediate]\n" +"\n" +" Dangerous Options:\n" +" Caution: use these options at your own risk. It is believed that some\n" +" of them bite.\n" +"\n" +" -g Group option.\n" +"\n" +" Debug Options:\n" +" -d, --debug Print debug information\n" +" -s, --sql Print all SQL statements executed\n" +" -e Print every action done" +msgstr "" + +#: library/optparse.rst:768 msgid "" "Another interesting method, in particular when working programmatically with " "option groups is:" msgstr "" -#: library/optparse.rst:661 +#: library/optparse.rst:773 msgid "" "Return the :class:`OptionGroup` to which the short or long option string " "*opt_str* (e.g. ``'-o'`` or ``'--option'``) belongs. If there's no such :" "class:`OptionGroup`, return ``None``." msgstr "" -#: library/optparse.rst:668 +#: library/optparse.rst:780 msgid "Printing a version string" msgstr "" -#: library/optparse.rst:670 +#: library/optparse.rst:782 msgid "" "Similar to the brief usage string, :mod:`optparse` can also print a version " "string for your program. You have to supply the string as the ``version`` " "argument to OptionParser::" msgstr "" -#: library/optparse.rst:676 +#: library/optparse.rst:786 +msgid "parser = OptionParser(usage=\"%prog [-f] [-q]\", version=\"%prog 1.0\")" +msgstr "" + +#: library/optparse.rst:788 msgid "" "``%prog`` is expanded just like it is in ``usage``. Apart from that, " "``version`` can contain anything you like. When you supply it, :mod:" @@ -798,17 +1252,23 @@ msgid "" "string (by replacing ``%prog``), prints it to stdout, and exits." msgstr "" -#: library/optparse.rst:682 +#: library/optparse.rst:794 msgid "For example, if your script is called ``/usr/bin/foo``:" msgstr "" -#: library/optparse.rst:689 +#: library/optparse.rst:796 +msgid "" +"$ /usr/bin/foo --version\n" +"foo 1.0" +msgstr "" + +#: library/optparse.rst:801 msgid "" "The following two methods can be used to print and get the ``version`` " "string:" msgstr "" -#: library/optparse.rst:693 +#: library/optparse.rst:805 msgid "" "Print the version message for the current program (``self.version``) to " "*file* (default stdout). As with :meth:`print_usage`, any occurrence of " @@ -816,17 +1276,17 @@ msgid "" "program. Does nothing if ``self.version`` is empty or undefined." msgstr "" -#: library/optparse.rst:700 +#: library/optparse.rst:812 msgid "" "Same as :meth:`print_version` but returns the version string instead of " "printing it." msgstr "" -#: library/optparse.rst:707 +#: library/optparse.rst:819 msgid "How :mod:`optparse` handles errors" msgstr "" -#: library/optparse.rst:709 +#: library/optparse.rst:821 msgid "" "There are two broad classes of errors that :mod:`optparse` has to worry " "about: programmer errors and user errors. Programmer errors are usually " @@ -836,7 +1296,7 @@ msgid "" "OptionError` or :exc:`TypeError`) and let the program crash." msgstr "" -#: library/optparse.rst:716 +#: library/optparse.rst:828 msgid "" "Handling user errors is much more important, since they are guaranteed to " "happen no matter how stable your code is. :mod:`optparse` can automatically " @@ -847,71 +1307,120 @@ msgid "" "error condition::" msgstr "" -#: library/optparse.rst:729 +#: library/optparse.rst:836 +msgid "" +"(options, args) = parser.parse_args()\n" +"...\n" +"if options.a and options.b:\n" +" parser.error(\"options -a and -b are mutually exclusive\")" +msgstr "" + +#: library/optparse.rst:841 msgid "" "In either case, :mod:`optparse` handles the error the same way: it prints " "the program's usage message and an error message to standard error and exits " "with error status 2." msgstr "" -#: library/optparse.rst:733 +#: library/optparse.rst:845 msgid "" "Consider the first example above, where the user passes ``4x`` to an option " "that takes an integer:" msgstr "" -#: library/optparse.rst:743 +#: library/optparse.rst:848 +msgid "" +"$ /usr/bin/foo -n 4x\n" +"Usage: foo [options]\n" +"\n" +"foo: error: option -n: invalid integer value: '4x'" +msgstr "" + +#: library/optparse.rst:855 msgid "Or, where the user fails to pass a value at all:" msgstr "" -#: library/optparse.rst:752 +#: library/optparse.rst:857 +msgid "" +"$ /usr/bin/foo -n\n" +"Usage: foo [options]\n" +"\n" +"foo: error: -n option requires an argument" +msgstr "" + +#: library/optparse.rst:864 msgid "" ":mod:`optparse`\\ -generated error messages take care always to mention the " "option involved in the error; be sure to do the same when calling :func:" "`OptionParser.error` from your application code." msgstr "" -#: library/optparse.rst:756 +#: library/optparse.rst:868 msgid "" "If :mod:`optparse`'s default error-handling behaviour does not suit your " "needs, you'll need to subclass OptionParser and override its :meth:" "`~OptionParser.exit` and/or :meth:`~OptionParser.error` methods." msgstr "" -#: library/optparse.rst:764 +#: library/optparse.rst:876 msgid "Putting it all together" msgstr "" -#: library/optparse.rst:766 +#: library/optparse.rst:878 msgid "Here's what :mod:`optparse`\\ -based scripts usually look like::" msgstr "" -#: library/optparse.rst:794 +#: library/optparse.rst:880 +msgid "" +"from optparse import OptionParser\n" +"...\n" +"def main():\n" +" usage = \"usage: %prog [options] arg\"\n" +" parser = OptionParser(usage)\n" +" parser.add_option(\"-f\", \"--file\", dest=\"filename\",\n" +" help=\"read data from FILENAME\")\n" +" parser.add_option(\"-v\", \"--verbose\",\n" +" action=\"store_true\", dest=\"verbose\")\n" +" parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\")\n" +" ...\n" +" (options, args) = parser.parse_args()\n" +" if len(args) != 1:\n" +" parser.error(\"incorrect number of arguments\")\n" +" if options.verbose:\n" +" print(\"reading %s...\" % options.filename)\n" +" ...\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" +msgstr "" + +#: library/optparse.rst:906 msgid "Reference Guide" msgstr "" -#: library/optparse.rst:800 +#: library/optparse.rst:912 msgid "Creating the parser" msgstr "" -#: library/optparse.rst:802 +#: library/optparse.rst:914 msgid "" "The first step in using :mod:`optparse` is to create an OptionParser " "instance." msgstr "" -#: library/optparse.rst:806 +#: library/optparse.rst:918 msgid "" "The OptionParser constructor has no required arguments, but a number of " "optional keyword arguments. You should always pass them as keyword " "arguments, i.e. do not rely on the order in which the arguments are declared." msgstr "" -#: library/optparse.rst:815 +#: library/optparse.rst:922 msgid "``usage`` (default: ``\"%prog [options]\"``)" msgstr "" -#: library/optparse.rst:811 +#: library/optparse.rst:923 msgid "" "The usage summary to print when your program is run incorrectly or with a " "help option. When :mod:`optparse` prints the usage string, it expands " @@ -920,11 +1429,11 @@ msgid "" "value :const:`optparse.SUPPRESS_USAGE`." msgstr "" -#: library/optparse.rst:822 +#: library/optparse.rst:929 msgid "``option_list`` (default: ``[]``)" msgstr "" -#: library/optparse.rst:818 +#: library/optparse.rst:930 msgid "" "A list of Option objects to populate the parser with. The options in " "``option_list`` are added after any options in ``standard_option_list`` (a " @@ -933,19 +1442,19 @@ msgid "" "the parser instead." msgstr "" -#: library/optparse.rst:825 +#: library/optparse.rst:936 msgid "``option_class`` (default: optparse.Option)" msgstr "" -#: library/optparse.rst:825 +#: library/optparse.rst:937 msgid "Class to use when adding options to the parser in :meth:`add_option`." msgstr "" -#: library/optparse.rst:831 +#: library/optparse.rst:939 msgid "``version`` (default: ``None``)" msgstr "" -#: library/optparse.rst:828 +#: library/optparse.rst:940 msgid "" "A version string to print when the user supplies a version option. If you " "supply a true value for ``version``, :mod:`optparse` automatically adds a " @@ -953,21 +1462,21 @@ msgid "" "``%prog`` is expanded the same as for ``usage``." msgstr "" -#: library/optparse.rst:836 +#: library/optparse.rst:945 msgid "``conflict_handler`` (default: ``\"error\"``)" msgstr "" -#: library/optparse.rst:834 +#: library/optparse.rst:946 msgid "" "Specifies what to do when options with conflicting option strings are added " "to the parser; see section :ref:`optparse-conflicts-between-options`." msgstr "" -#: library/optparse.rst:842 +#: library/optparse.rst:950 msgid "``description`` (default: ``None``)" msgstr "" -#: library/optparse.rst:839 +#: library/optparse.rst:951 msgid "" "A paragraph of text giving a brief overview of your program. :mod:`optparse` " "reformats this paragraph to fit the current terminal width and prints it " @@ -975,74 +1484,85 @@ msgid "" "options)." msgstr "" -#: library/optparse.rst:847 +#: library/optparse.rst:956 msgid "``formatter`` (default: a new :class:`IndentedHelpFormatter`)" msgstr "" -#: library/optparse.rst:845 +#: library/optparse.rst:957 msgid "" "An instance of optparse.HelpFormatter that will be used for printing help " "text. :mod:`optparse` provides two concrete classes for this purpose: " "IndentedHelpFormatter and TitledHelpFormatter." msgstr "" -#: library/optparse.rst:851 +#: library/optparse.rst:961 msgid "``add_help_option`` (default: ``True``)" msgstr "" -#: library/optparse.rst:850 +#: library/optparse.rst:962 msgid "" "If true, :mod:`optparse` will add a help option (with option strings ``-h`` " "and ``--help``) to the parser." msgstr "" -#: library/optparse.rst:855 +#: library/optparse.rst:965 msgid "``prog``" msgstr "" -#: library/optparse.rst:854 +#: library/optparse.rst:966 msgid "" "The string to use when expanding ``%prog`` in ``usage`` and ``version`` " "instead of ``os.path.basename(sys.argv[0])``." msgstr "" -#: library/optparse.rst:857 +#: library/optparse.rst:969 msgid "``epilog`` (default: ``None``)" msgstr "" -#: library/optparse.rst:858 +#: library/optparse.rst:970 msgid "A paragraph of help text to print after the option help." msgstr "" -#: library/optparse.rst:863 +#: library/optparse.rst:975 msgid "Populating the parser" msgstr "" -#: library/optparse.rst:865 +#: library/optparse.rst:977 msgid "" "There are several ways to populate the parser with options. The preferred " "way is by using :meth:`OptionParser.add_option`, as shown in section :ref:" "`optparse-tutorial`. :meth:`add_option` can be called in one of two ways:" msgstr "" -#: library/optparse.rst:869 +#: library/optparse.rst:981 msgid "pass it an Option instance (as returned by :func:`make_option`)" msgstr "" -#: library/optparse.rst:871 +#: library/optparse.rst:983 msgid "" "pass it any combination of positional and keyword arguments that are " "acceptable to :func:`make_option` (i.e., to the Option constructor), and it " "will create the Option instance for you" msgstr "" -#: library/optparse.rst:875 +#: library/optparse.rst:987 msgid "" "The other alternative is to pass a list of pre-constructed Option instances " "to the OptionParser constructor, as in::" msgstr "" -#: library/optparse.rst:886 +#: library/optparse.rst:990 +msgid "" +"option_list = [\n" +" make_option(\"-f\", \"--filename\",\n" +" action=\"store\", type=\"string\", dest=\"filename\"),\n" +" make_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\"),\n" +" ]\n" +"parser = OptionParser(option_list=option_list)" +msgstr "" + +#: library/optparse.rst:998 msgid "" "(:func:`make_option` is a factory function for creating Option instances; " "currently it is an alias for the Option constructor. A future version of :" @@ -1051,32 +1571,40 @@ msgid "" "Option directly.)" msgstr "" -#: library/optparse.rst:895 +#: library/optparse.rst:1007 msgid "Defining options" msgstr "" -#: library/optparse.rst:897 +#: library/optparse.rst:1009 msgid "" "Each Option instance represents a set of synonymous command-line option " "strings, e.g. ``-f`` and ``--file``. You can specify any number of short or " "long option strings, but you must specify at least one overall option string." msgstr "" -#: library/optparse.rst:901 +#: library/optparse.rst:1013 msgid "" "The canonical way to create an :class:`Option` instance is with the :meth:" "`add_option` method of :class:`OptionParser`." msgstr "" -#: library/optparse.rst:907 +#: library/optparse.rst:1019 msgid "To define an option with only a short option string::" msgstr "" -#: library/optparse.rst:911 +#: library/optparse.rst:1021 +msgid "parser.add_option(\"-f\", attr=value, ...)" +msgstr "" + +#: library/optparse.rst:1023 msgid "And to define an option with only a long option string::" msgstr "" -#: library/optparse.rst:915 +#: library/optparse.rst:1025 +msgid "parser.add_option(\"--foo\", attr=value, ...)" +msgstr "" + +#: library/optparse.rst:1027 msgid "" "The keyword arguments define attributes of the new Option object. The most " "important option attribute is :attr:`~Option.action`, and it largely " @@ -1085,69 +1613,69 @@ msgid "" "raises an :exc:`OptionError` exception explaining your mistake." msgstr "" -#: library/optparse.rst:921 +#: library/optparse.rst:1033 msgid "" "An option's *action* determines what :mod:`optparse` does when it encounters " "this option on the command-line. The standard option actions hard-coded " "into :mod:`optparse` are:" msgstr "" -#: library/optparse.rst:926 +#: library/optparse.rst:1037 msgid "``\"store\"``" msgstr "" -#: library/optparse.rst:926 +#: library/optparse.rst:1038 msgid "store this option's argument (default)" msgstr "" -#: library/optparse.rst:932 +#: library/optparse.rst:1043 msgid "``\"store_true\"``" msgstr "" -#: library/optparse.rst:932 +#: library/optparse.rst:1044 msgid "store ``True``" msgstr "" -#: library/optparse.rst:935 +#: library/optparse.rst:1046 msgid "``\"store_false\"``" msgstr "" -#: library/optparse.rst:935 +#: library/optparse.rst:1047 msgid "store ``False``" msgstr "" -#: library/optparse.rst:941 +#: library/optparse.rst:1052 msgid "``\"append_const\"``" msgstr "" -#: library/optparse.rst:941 +#: library/optparse.rst:1053 msgid "append a constant value to a list, pre-set via :attr:`Option.const`" msgstr "" -#: library/optparse.rst:1244 +#: library/optparse.rst:1356 msgid "``\"help\"``" msgstr "" -#: library/optparse.rst:950 +#: library/optparse.rst:1062 msgid "" "print a usage message including all options and the documentation for them" msgstr "" -#: library/optparse.rst:952 +#: library/optparse.rst:1064 msgid "" "(If you don't supply an action, the default is ``\"store\"``. For this " "action, you may also supply :attr:`~Option.type` and :attr:`~Option.dest` " "option attributes; see :ref:`optparse-standard-option-actions`.)" msgstr "" -#: library/optparse.rst:956 +#: library/optparse.rst:1068 msgid "" "As you can see, most actions involve storing or updating a value somewhere. :" "mod:`optparse` always creates a special object for this, conventionally " "called ``options``, which is an instance of :class:`optparse.Values`." msgstr "" -#: library/optparse.rst:962 +#: library/optparse.rst:1074 msgid "" "An object holding parsed argument names and values as attributes. Normally " "created by calling when calling :meth:`OptionParser.parse_args`, and can be " @@ -1156,47 +1684,73 @@ msgid "" "arguments`)." msgstr "" -#: library/optparse.rst:967 +#: library/optparse.rst:1079 msgid "" "Option arguments (and various other values) are stored as attributes of this " "object, according to the :attr:`~Option.dest` (destination) option attribute." msgstr "" -#: library/optparse.rst:971 +#: library/optparse.rst:1083 msgid "For example, when you call ::" msgstr "" -#: library/optparse.rst:975 +#: library/optparse.rst:1085 +msgid "parser.parse_args()" +msgstr "" + +#: library/optparse.rst:1087 msgid "" "one of the first things :mod:`optparse` does is create the ``options`` " "object::" msgstr "" -#: library/optparse.rst:979 +#: library/optparse.rst:1089 +msgid "options = Values()" +msgstr "" + +#: library/optparse.rst:1091 msgid "If one of the options in this parser is defined with ::" msgstr "" -#: library/optparse.rst:983 +#: library/optparse.rst:1093 +msgid "" +"parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " +"dest=\"filename\")" +msgstr "" + +#: library/optparse.rst:1095 msgid "and the command-line being parsed includes any of the following::" msgstr "" -#: library/optparse.rst:990 +#: library/optparse.rst:1097 +msgid "" +"-ffoo\n" +"-f foo\n" +"--file=foo\n" +"--file foo" +msgstr "" + +#: library/optparse.rst:1102 msgid "" "then :mod:`optparse`, on seeing this option, will do the equivalent of ::" msgstr "" -#: library/optparse.rst:994 +#: library/optparse.rst:1104 +msgid "options.filename = \"foo\"" +msgstr "" + +#: library/optparse.rst:1106 msgid "" "The :attr:`~Option.type` and :attr:`~Option.dest` option attributes are " "almost as important as :attr:`~Option.action`, but :attr:`~Option.action` is " "the only one that makes sense for *all* options." msgstr "" -#: library/optparse.rst:1002 +#: library/optparse.rst:1114 msgid "Option attributes" msgstr "" -#: library/optparse.rst:1006 +#: library/optparse.rst:1118 msgid "" "A single command line argument, with various attributes passed by keyword to " "the constructor. Normally created with :meth:`OptionParser.add_option` " @@ -1204,7 +1758,7 @@ msgid "" "*option_class* argument to :class:`OptionParser`." msgstr "" -#: library/optparse.rst:1012 +#: library/optparse.rst:1124 msgid "" "The following option attributes may be passed as keyword arguments to :meth:" "`OptionParser.add_option`. If you pass an option attribute that is not " @@ -1212,33 +1766,33 @@ msgid "" "attribute, :mod:`optparse` raises :exc:`OptionError`." msgstr "" -#: library/optparse.rst:1019 +#: library/optparse.rst:1131 msgid "(default: ``\"store\"``)" msgstr "" -#: library/optparse.rst:1021 +#: library/optparse.rst:1133 msgid "" "Determines :mod:`optparse`'s behaviour when this option is seen on the " "command line; the available options are documented :ref:`here `." msgstr "" -#: library/optparse.rst:1027 +#: library/optparse.rst:1139 msgid "(default: ``\"string\"``)" msgstr "" -#: library/optparse.rst:1029 +#: library/optparse.rst:1141 msgid "" "The argument type expected by this option (e.g., ``\"string\"`` or " "``\"int\"``); the available option types are documented :ref:`here `." msgstr "" -#: library/optparse.rst:1085 +#: library/optparse.rst:1197 msgid "(default: derived from option strings)" msgstr "" -#: library/optparse.rst:1037 +#: library/optparse.rst:1149 msgid "" "If the option's action implies writing or modifying a value somewhere, this " "tells :mod:`optparse` where to write it: :attr:`~Option.dest` names an " @@ -1246,47 +1800,47 @@ msgid "" "the command line." msgstr "" -#: library/optparse.rst:1044 +#: library/optparse.rst:1156 msgid "" "The value to use for this option's destination if the option is not seen on " "the command line. See also :meth:`OptionParser.set_defaults`." msgstr "" -#: library/optparse.rst:1049 +#: library/optparse.rst:1161 msgid "(default: 1)" msgstr "" -#: library/optparse.rst:1051 +#: library/optparse.rst:1163 msgid "" "How many arguments of type :attr:`~Option.type` should be consumed when this " "option is seen. If > 1, :mod:`optparse` will store a tuple of values to :" "attr:`~Option.dest`." msgstr "" -#: library/optparse.rst:1057 +#: library/optparse.rst:1169 msgid "For actions that store a constant value, the constant value to store." msgstr "" -#: library/optparse.rst:1061 +#: library/optparse.rst:1173 msgid "" "For options of type ``\"choice\"``, the list of strings the user may choose " "from." msgstr "" -#: library/optparse.rst:1066 +#: library/optparse.rst:1178 msgid "" "For options with action ``\"callback\"``, the callable to call when this " "option is seen. See section :ref:`optparse-option-callbacks` for detail on " "the arguments passed to the callable." msgstr "" -#: library/optparse.rst:1073 +#: library/optparse.rst:1185 msgid "" "Additional positional and keyword arguments to pass to ``callback`` after " "the four standard callback arguments." msgstr "" -#: library/optparse.rst:1078 +#: library/optparse.rst:1190 msgid "" "Help text to print for this option when listing all available options after " "the user supplies a :attr:`~Option.help` option (such as ``--help``). If no " @@ -1294,17 +1848,17 @@ msgid "" "this option, use the special value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: library/optparse.rst:1087 +#: library/optparse.rst:1199 msgid "" "Stand-in for the option argument(s) to use when printing help text. See " "section :ref:`optparse-tutorial` for an example." msgstr "" -#: library/optparse.rst:1094 +#: library/optparse.rst:1206 msgid "Standard option actions" msgstr "" -#: library/optparse.rst:1096 +#: library/optparse.rst:1208 msgid "" "The various option actions all have slightly different requirements and " "effects. Most actions have several relevant option attributes which you may " @@ -1312,13 +1866,13 @@ msgid "" "attributes, which you must specify for any option using that action." msgstr "" -#: library/optparse.rst:1101 +#: library/optparse.rst:1213 msgid "" "``\"store\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: library/optparse.rst:1104 +#: library/optparse.rst:1216 msgid "" "The option must be followed by an argument, which is converted to a value " "according to :attr:`~Option.type` and stored in :attr:`~Option.dest`. If :" @@ -1328,17 +1882,17 @@ msgid "" "option-types` section." msgstr "" -#: library/optparse.rst:1111 +#: library/optparse.rst:1223 msgid "" "If :attr:`~Option.choices` is supplied (a list or tuple of strings), the " "type defaults to ``\"choice\"``." msgstr "" -#: library/optparse.rst:1114 +#: library/optparse.rst:1226 msgid "If :attr:`~Option.type` is not supplied, it defaults to ``\"string\"``." msgstr "" -#: library/optparse.rst:1116 +#: library/optparse.rst:1228 msgid "" "If :attr:`~Option.dest` is not supplied, :mod:`optparse` derives a " "destination from the first long option string (e.g., ``--foo-bar`` implies " @@ -1346,58 +1900,95 @@ msgid "" "destination from the first short option string (e.g., ``-f`` implies ``f``)." msgstr "" -#: library/optparse.rst:1141 library/optparse.rst:1181 -#: library/optparse.rst:1258 +#: library/optparse.rst:1253 library/optparse.rst:1293 +#: library/optparse.rst:1370 msgid "Example::" msgstr "" -#: library/optparse.rst:1126 +#: library/optparse.rst:1235 +msgid "" +"parser.add_option(\"-f\")\n" +"parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" +msgstr "" + +#: library/optparse.rst:1238 msgid "As it parses the command line ::" msgstr "" -#: library/optparse.rst:1130 +#: library/optparse.rst:1240 +msgid "-f foo.txt -p 1 -3.5 4 -fbar.txt" +msgstr "" + +#: library/optparse.rst:1242 msgid ":mod:`optparse` will set ::" msgstr "" -#: library/optparse.rst:1136 +#: library/optparse.rst:1244 +msgid "" +"options.f = \"foo.txt\"\n" +"options.point = (1.0, -3.5, 4.0)\n" +"options.f = \"bar.txt\"" +msgstr "" + +#: library/optparse.rst:1248 msgid "" "``\"store_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: library/optparse.rst:1139 +#: library/optparse.rst:1251 msgid "The value :attr:`~Option.const` is stored in :attr:`~Option.dest`." msgstr "" -#: library/optparse.rst:1150 +#: library/optparse.rst:1255 +msgid "" +"parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_const\", const=0, dest=\"verbose\")\n" +"parser.add_option(\"-v\", \"--verbose\",\n" +" action=\"store_const\", const=1, dest=\"verbose\")\n" +"parser.add_option(\"--noisy\",\n" +" action=\"store_const\", const=2, dest=\"verbose\")" +msgstr "" + +#: library/optparse.rst:1262 msgid "If ``--noisy`` is seen, :mod:`optparse` will set ::" msgstr "" -#: library/optparse.rst:1154 +#: library/optparse.rst:1264 +msgid "options.verbose = 2" +msgstr "" + +#: library/optparse.rst:1266 msgid "``\"store_true\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: library/optparse.rst:1156 +#: library/optparse.rst:1268 msgid "" "A special case of ``\"store_const\"`` that stores ``True`` to :attr:`~Option." "dest`." msgstr "" -#: library/optparse.rst:1159 +#: library/optparse.rst:1271 msgid "``\"store_false\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: library/optparse.rst:1161 +#: library/optparse.rst:1273 msgid "Like ``\"store_true\"``, but stores ``False``." msgstr "" -#: library/optparse.rst:1168 +#: library/optparse.rst:1277 +msgid "" +"parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" +"parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" +msgstr "" + +#: library/optparse.rst:1280 msgid "" "``\"append\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: library/optparse.rst:1171 +#: library/optparse.rst:1283 msgid "" "The option must be followed by an argument, which is appended to the list " "in :attr:`~Option.dest`. If no default value for :attr:`~Option.dest` is " @@ -1407,23 +1998,38 @@ msgid "" "is appended to :attr:`~Option.dest`." msgstr "" -#: library/optparse.rst:1178 +#: library/optparse.rst:1290 msgid "" "The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same " "as for the ``\"store\"`` action." msgstr "" -#: library/optparse.rst:1185 +#: library/optparse.rst:1295 +msgid "" +"parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" +msgstr "" + +#: library/optparse.rst:1297 msgid "" "If ``-t3`` is seen on the command-line, :mod:`optparse` does the equivalent " "of::" msgstr "" -#: library/optparse.rst:1191 +#: library/optparse.rst:1300 +msgid "" +"options.tracks = []\n" +"options.tracks.append(int(\"3\"))" +msgstr "" + +#: library/optparse.rst:1303 msgid "If, a little later on, ``--tracks=4`` is seen, it does::" msgstr "" -#: library/optparse.rst:1195 +#: library/optparse.rst:1305 +msgid "options.tracks.append(int(\"4\"))" +msgstr "" + +#: library/optparse.rst:1307 msgid "" "The ``append`` action calls the ``append`` method on the current value of " "the option. This means that any default value specified must have an " @@ -1432,13 +2038,22 @@ msgid "" "with any values from the command line appended after those default values::" msgstr "" -#: library/optparse.rst:1206 +#: library/optparse.rst:1313 +msgid "" +">>> parser.add_option(\"--files\", action=\"append\", default=['~/.mypkg/" +"defaults'])\n" +">>> opts, args = parser.parse_args(['--files', 'overrides.mypkg'])\n" +">>> opts.files\n" +"['~/.mypkg/defaults', 'overrides.mypkg']" +msgstr "" + +#: library/optparse.rst:1318 msgid "" "``\"append_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: library/optparse.rst:1209 +#: library/optparse.rst:1321 msgid "" "Like ``\"store_const\"``, but the value :attr:`~Option.const` is appended " "to :attr:`~Option.dest`; as with ``\"append\"``, :attr:`~Option.dest` " @@ -1446,45 +2061,63 @@ msgid "" "time the option is encountered." msgstr "" -#: library/optparse.rst:1214 +#: library/optparse.rst:1326 msgid "``\"count\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: library/optparse.rst:1216 +#: library/optparse.rst:1328 msgid "" "Increment the integer stored at :attr:`~Option.dest`. If no default value " "is supplied, :attr:`~Option.dest` is set to zero before being incremented " "the first time." msgstr "" -#: library/optparse.rst:1224 +#: library/optparse.rst:1334 +msgid "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" +msgstr "" + +#: library/optparse.rst:1336 msgid "" "The first time ``-v`` is seen on the command line, :mod:`optparse` does the " "equivalent of::" msgstr "" -#: library/optparse.rst:1230 +#: library/optparse.rst:1339 +msgid "" +"options.verbosity = 0\n" +"options.verbosity += 1" +msgstr "" + +#: library/optparse.rst:1342 msgid "Every subsequent occurrence of ``-v`` results in ::" msgstr "" -#: library/optparse.rst:1234 +#: library/optparse.rst:1344 +msgid "options.verbosity += 1" +msgstr "" + +#: library/optparse.rst:1346 msgid "" "``\"callback\"`` [required: :attr:`~Option.callback`; relevant: :attr:" "`~Option.type`, :attr:`~Option.nargs`, :attr:`~Option.callback_args`, :attr:" "`~Option.callback_kwargs`]" msgstr "" -#: library/optparse.rst:1238 +#: library/optparse.rst:1350 msgid "" "Call the function specified by :attr:`~Option.callback`, which is called " "as ::" msgstr "" -#: library/optparse.rst:1242 +#: library/optparse.rst:1750 +msgid "func(option, opt_str, value, parser, *args, **kwargs)" +msgstr "" + +#: library/optparse.rst:1354 msgid "See section :ref:`optparse-option-callbacks` for more detail." msgstr "" -#: library/optparse.rst:1246 +#: library/optparse.rst:1358 msgid "" "Prints a complete help message for all the options in the current option " "parser. The help message is constructed from the ``usage`` string passed to " @@ -1492,37 +2125,63 @@ msgid "" "every option." msgstr "" -#: library/optparse.rst:1251 +#: library/optparse.rst:1363 msgid "" "If no :attr:`~Option.help` string is supplied for an option, it will still " "be listed in the help message. To omit an option entirely, use the special " "value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: library/optparse.rst:1255 +#: library/optparse.rst:1367 msgid "" ":mod:`optparse` automatically adds a :attr:`~Option.help` option to all " "OptionParsers, so you do not normally need to create one." msgstr "" -#: library/optparse.rst:1273 +#: library/optparse.rst:1372 +msgid "" +"from optparse import OptionParser, SUPPRESS_HELP\n" +"\n" +"# usually, a help option is added automatically, but that can\n" +"# be suppressed using the add_help_option argument\n" +"parser = OptionParser(add_help_option=False)\n" +"\n" +"parser.add_option(\"-h\", \"--help\", action=\"help\")\n" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\",\n" +" help=\"Be moderately verbose\")\n" +"parser.add_option(\"--file\", dest=\"filename\",\n" +" help=\"Input file to read data from\")\n" +"parser.add_option(\"--secret\", help=SUPPRESS_HELP)" +msgstr "" + +#: library/optparse.rst:1385 msgid "" "If :mod:`optparse` sees either ``-h`` or ``--help`` on the command line, it " "will print something like the following help message to stdout (assuming " "``sys.argv[0]`` is ``\"foo.py\"``):" msgstr "" -#: library/optparse.rst:1286 +#: library/optparse.rst:1389 +msgid "" +"Usage: foo.py [options]\n" +"\n" +"Options:\n" +" -h, --help Show this help message and exit\n" +" -v Be moderately verbose\n" +" --file=FILENAME Input file to read data from" +msgstr "" + +#: library/optparse.rst:1398 msgid "" "After printing the help message, :mod:`optparse` terminates your process " "with ``sys.exit(0)``." msgstr "" -#: library/optparse.rst:1289 +#: library/optparse.rst:1401 msgid "``\"version\"``" msgstr "" -#: library/optparse.rst:1291 +#: library/optparse.rst:1403 msgid "" "Prints the version number supplied to the OptionParser to stdout and exits. " "The version number is actually formatted and printed by the " @@ -1532,58 +2191,58 @@ msgid "" "since :mod:`optparse` automatically adds them when needed." msgstr "" -#: library/optparse.rst:1302 +#: library/optparse.rst:1414 msgid "Standard option types" msgstr "" -#: library/optparse.rst:1304 +#: library/optparse.rst:1416 msgid "" ":mod:`optparse` has five built-in option types: ``\"string\"``, ``\"int\"``, " "``\"choice\"``, ``\"float\"`` and ``\"complex\"``. If you need to add new " "option types, see section :ref:`optparse-extending-optparse`." msgstr "" -#: library/optparse.rst:1308 +#: library/optparse.rst:1420 msgid "" "Arguments to string options are not checked or converted in any way: the " "text on the command line is stored in the destination (or passed to the " "callback) as-is." msgstr "" -#: library/optparse.rst:1311 +#: library/optparse.rst:1423 msgid "Integer arguments (type ``\"int\"``) are parsed as follows:" msgstr "" -#: library/optparse.rst:1313 +#: library/optparse.rst:1425 msgid "if the number starts with ``0x``, it is parsed as a hexadecimal number" msgstr "" -#: library/optparse.rst:1315 +#: library/optparse.rst:1427 msgid "if the number starts with ``0``, it is parsed as an octal number" msgstr "" -#: library/optparse.rst:1317 +#: library/optparse.rst:1429 msgid "if the number starts with ``0b``, it is parsed as a binary number" msgstr "" -#: library/optparse.rst:1319 +#: library/optparse.rst:1431 msgid "otherwise, the number is parsed as a decimal number" msgstr "" -#: library/optparse.rst:1322 +#: library/optparse.rst:1434 msgid "" "The conversion is done by calling :func:`int` with the appropriate base (2, " "8, 10, or 16). If this fails, so will :mod:`optparse`, although with a more " "useful error message." msgstr "" -#: library/optparse.rst:1326 +#: library/optparse.rst:1438 msgid "" "``\"float\"`` and ``\"complex\"`` option arguments are converted directly " "with :func:`float` and :func:`complex`, with similar error-handling." msgstr "" -#: library/optparse.rst:1329 +#: library/optparse.rst:1441 msgid "" "``\"choice\"`` options are a subtype of ``\"string\"`` options. The :attr:" "`~Option.choices` option attribute (a sequence of strings) defines the set " @@ -1592,62 +2251,62 @@ msgid "" "`OptionValueError` if an invalid string is given." msgstr "" -#: library/optparse.rst:1339 +#: library/optparse.rst:1451 msgid "Parsing arguments" msgstr "" -#: library/optparse.rst:1341 +#: library/optparse.rst:1453 msgid "" "The whole point of creating and populating an OptionParser is to call its :" "meth:`~OptionParser.parse_args` method." msgstr "" -#: library/optparse.rst:1346 +#: library/optparse.rst:1458 msgid "Parse the command-line options found in *args*." msgstr "" -#: library/optparse.rst:1348 +#: library/optparse.rst:1460 msgid "The input parameters are" msgstr "" -#: library/optparse.rst:1364 library/optparse.rst:1684 +#: library/optparse.rst:1476 library/optparse.rst:1794 msgid "``args``" msgstr "" -#: library/optparse.rst:1351 +#: library/optparse.rst:1463 msgid "the list of arguments to process (default: ``sys.argv[1:]``)" msgstr "" -#: library/optparse.rst:1356 +#: library/optparse.rst:1465 msgid "``values``" msgstr "" -#: library/optparse.rst:1354 +#: library/optparse.rst:1466 msgid "" -"an :class:`Values` object to store option arguments in (default: a new " +"a :class:`Values` object to store option arguments in (default: a new " "instance of :class:`Values`) -- if you give an existing object, the option " "defaults will not be initialized on it" msgstr "" -#: library/optparse.rst:1358 +#: library/optparse.rst:1470 msgid "and the return value is a pair ``(options, args)`` where" msgstr "" -#: library/optparse.rst:1362 +#: library/optparse.rst:1472 msgid "``options``" msgstr "" -#: library/optparse.rst:1361 +#: library/optparse.rst:1473 msgid "" "the same object that was passed in as *values*, or the ``optparse.Values`` " "instance created by :mod:`optparse`" msgstr "" -#: library/optparse.rst:1365 +#: library/optparse.rst:1477 msgid "the leftover positional arguments after all options have been processed" msgstr "" -#: library/optparse.rst:1367 +#: library/optparse.rst:1479 msgid "" "The most common usage is to supply neither keyword argument. If you supply " "``values``, it will be modified with repeated :func:`setattr` calls (roughly " @@ -1655,7 +2314,7 @@ msgid "" "by :meth:`~OptionParser.parse_args`." msgstr "" -#: library/optparse.rst:1372 +#: library/optparse.rst:1484 msgid "" "If :meth:`~OptionParser.parse_args` encounters any errors in the argument " "list, it calls the OptionParser's :meth:`error` method with an appropriate " @@ -1663,61 +2322,69 @@ msgid "" "status of 2 (the traditional Unix exit status for command-line errors)." msgstr "" -#: library/optparse.rst:1381 +#: library/optparse.rst:1493 msgid "Querying and manipulating your option parser" msgstr "" -#: library/optparse.rst:1383 +#: library/optparse.rst:1495 msgid "" "The default behavior of the option parser can be customized slightly, and " "you can also poke around your option parser and see what's there. " "OptionParser provides several methods to help you out:" msgstr "" -#: library/optparse.rst:1389 +#: library/optparse.rst:1501 msgid "" "Set parsing to stop on the first non-option. For example, if ``-a`` and ``-" "b`` are both simple options that take no arguments, :mod:`optparse` normally " "accepts this syntax::" msgstr "" -#: library/optparse.rst:1395 +#: library/optparse.rst:1505 +msgid "prog -a arg1 -b arg2" +msgstr "" + +#: library/optparse.rst:1507 msgid "and treats it as equivalent to ::" msgstr "" -#: library/optparse.rst:1399 +#: library/optparse.rst:1509 +msgid "prog -a -b arg1 arg2" +msgstr "" + +#: library/optparse.rst:1511 msgid "" "To disable this feature, call :meth:`disable_interspersed_args`. This " "restores traditional Unix syntax, where option parsing stops with the first " "non-option argument." msgstr "" -#: library/optparse.rst:1403 +#: library/optparse.rst:1515 msgid "" "Use this if you have a command processor which runs another command which " "has options of its own and you want to make sure these options don't get " "confused. For example, each command might have a different set of options." msgstr "" -#: library/optparse.rst:1409 +#: library/optparse.rst:1521 msgid "" "Set parsing to not stop on the first non-option, allowing interspersing " "switches with command arguments. This is the default behavior." msgstr "" -#: library/optparse.rst:1414 +#: library/optparse.rst:1526 msgid "" "Returns the Option instance with the option string *opt_str*, or ``None`` if " "no options have that option string." msgstr "" -#: library/optparse.rst:1419 +#: library/optparse.rst:1531 msgid "" "Return ``True`` if the OptionParser has an option with option string " "*opt_str* (e.g., ``-q`` or ``--verbose``)." msgstr "" -#: library/optparse.rst:1424 +#: library/optparse.rst:1536 msgid "" "If the :class:`OptionParser` has an option corresponding to *opt_str*, that " "option is removed. If that option provided any other option strings, all of " @@ -1725,23 +2392,30 @@ msgid "" "option belonging to this :class:`OptionParser`, raises :exc:`ValueError`." msgstr "" -#: library/optparse.rst:1433 +#: library/optparse.rst:1545 msgid "Conflicts between options" msgstr "" -#: library/optparse.rst:1435 +#: library/optparse.rst:1547 msgid "" "If you're not careful, it's easy to define options with conflicting option " "strings::" msgstr "" -#: library/optparse.rst:1442 +#: library/optparse.rst:1550 +msgid "" +"parser.add_option(\"-n\", \"--dry-run\", ...)\n" +"...\n" +"parser.add_option(\"-n\", \"--noisy\", ...)" +msgstr "" + +#: library/optparse.rst:1554 msgid "" "(This is particularly true if you've defined your own OptionParser subclass " "with some standard options.)" msgstr "" -#: library/optparse.rst:1445 +#: library/optparse.rst:1557 msgid "" "Every time you add an option, :mod:`optparse` checks for conflicts with " "existing options. If it finds any, it invokes the current conflict-handling " @@ -1749,39 +2423,54 @@ msgid "" "constructor::" msgstr "" -#: library/optparse.rst:1451 +#: library/optparse.rst:1561 +msgid "parser = OptionParser(..., conflict_handler=handler)" +msgstr "" + +#: library/optparse.rst:1563 msgid "or with a separate call::" msgstr "" -#: library/optparse.rst:1455 +#: library/optparse.rst:1565 +msgid "parser.set_conflict_handler(handler)" +msgstr "" + +#: library/optparse.rst:1567 msgid "The available conflict handlers are:" msgstr "" -#: library/optparse.rst:1459 +#: library/optparse.rst:1569 msgid "``\"error\"`` (default)" msgstr "" -#: library/optparse.rst:1458 +#: library/optparse.rst:1570 msgid "" "assume option conflicts are a programming error and raise :exc:" "`OptionConflictError`" msgstr "" -#: library/optparse.rst:1463 +#: library/optparse.rst:1573 msgid "``\"resolve\"``" msgstr "" -#: library/optparse.rst:1462 +#: library/optparse.rst:1574 msgid "resolve option conflicts intelligently (see below)" msgstr "" -#: library/optparse.rst:1465 +#: library/optparse.rst:1577 msgid "" "As an example, let's define an :class:`OptionParser` that resolves conflicts " "intelligently and add conflicting options to it::" msgstr "" -#: library/optparse.rst:1472 +#: library/optparse.rst:1580 +msgid "" +"parser = OptionParser(conflict_handler=\"resolve\")\n" +"parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" +"parser.add_option(\"-n\", \"--noisy\", ..., help=\"be noisy\")" +msgstr "" + +#: library/optparse.rst:1584 msgid "" "At this point, :mod:`optparse` detects that a previously added option is " "already using the ``-n`` option string. Since ``conflict_handler`` is " @@ -1791,7 +2480,15 @@ msgid "" "message will reflect that::" msgstr "" -#: library/optparse.rst:1483 +#: library/optparse.rst:1590 +msgid "" +"Options:\n" +" --dry-run do no harm\n" +" ...\n" +" -n, --noisy be noisy" +msgstr "" + +#: library/optparse.rst:1595 msgid "" "It's possible to whittle away the option strings for a previously added " "option until there are none left, and the user has no way of invoking that " @@ -1800,17 +2497,29 @@ msgid "" "Carrying on with our existing OptionParser::" msgstr "" -#: library/optparse.rst:1491 +#: library/optparse.rst:1601 +msgid "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" +msgstr "" + +#: library/optparse.rst:1603 msgid "" "At this point, the original ``-n``/``--dry-run`` option is no longer " "accessible, so :mod:`optparse` removes it, leaving this help text::" msgstr "" -#: library/optparse.rst:1503 +#: library/optparse.rst:1606 +msgid "" +"Options:\n" +" ...\n" +" -n, --noisy be noisy\n" +" --dry-run new dry-run option" +msgstr "" + +#: library/optparse.rst:1615 msgid "Cleanup" msgstr "" -#: library/optparse.rst:1505 +#: library/optparse.rst:1617 msgid "" "OptionParser instances have several cyclic references. This should not be a " "problem for Python's garbage collector, but you may wish to break the cyclic " @@ -1820,15 +2529,15 @@ msgid "" "OptionParser." msgstr "" -#: library/optparse.rst:1516 +#: library/optparse.rst:1628 msgid "Other methods" msgstr "" -#: library/optparse.rst:1518 +#: library/optparse.rst:1630 msgid "OptionParser supports several other public methods:" msgstr "" -#: library/optparse.rst:1522 +#: library/optparse.rst:1634 msgid "" "Set the usage string according to the rules described above for the " "``usage`` constructor keyword argument. Passing ``None`` sets the default " @@ -1836,7 +2545,7 @@ msgid "" "message." msgstr "" -#: library/optparse.rst:1528 +#: library/optparse.rst:1640 msgid "" "Print the usage message for the current program (``self.usage``) to *file* " "(default stdout). Any occurrence of the string ``%prog`` in ``self.usage`` " @@ -1844,13 +2553,13 @@ msgid "" "usage`` is empty or not defined." msgstr "" -#: library/optparse.rst:1535 +#: library/optparse.rst:1647 msgid "" "Same as :meth:`print_usage` but returns the usage string instead of printing " "it." msgstr "" -#: library/optparse.rst:1540 +#: library/optparse.rst:1652 msgid "" "Set default values for several option destinations at once. Using :meth:" "`set_defaults` is the preferred way to set default values for options, since " @@ -1859,15 +2568,34 @@ msgid "" "default, and the last one wins::" msgstr "" -#: library/optparse.rst:1553 +#: library/optparse.rst:1658 +msgid "" +"parser.add_option(\"--advanced\", action=\"store_const\",\n" +" dest=\"mode\", const=\"advanced\",\n" +" default=\"novice\") # overridden below\n" +"parser.add_option(\"--novice\", action=\"store_const\",\n" +" dest=\"mode\", const=\"novice\",\n" +" default=\"advanced\") # overrides above setting" +msgstr "" + +#: library/optparse.rst:1665 msgid "To avoid this confusion, use :meth:`set_defaults`::" msgstr "" -#: library/optparse.rst:1565 +#: library/optparse.rst:1667 +msgid "" +"parser.set_defaults(mode=\"advanced\")\n" +"parser.add_option(\"--advanced\", action=\"store_const\",\n" +" dest=\"mode\", const=\"advanced\")\n" +"parser.add_option(\"--novice\", action=\"store_const\",\n" +" dest=\"mode\", const=\"novice\")" +msgstr "" + +#: library/optparse.rst:1677 msgid "Option Callbacks" msgstr "" -#: library/optparse.rst:1567 +#: library/optparse.rst:1679 msgid "" "When :mod:`optparse`'s built-in actions and types aren't quite enough for " "your needs, you have two choices: extend :mod:`optparse` or define a " @@ -1875,25 +2603,25 @@ msgid "" "a lot of simple cases. Quite often a simple callback is all you need." msgstr "" -#: library/optparse.rst:1572 +#: library/optparse.rst:1684 msgid "There are two steps to defining a callback option:" msgstr "" -#: library/optparse.rst:1574 +#: library/optparse.rst:1686 msgid "define the option itself using the ``\"callback\"`` action" msgstr "" -#: library/optparse.rst:1576 +#: library/optparse.rst:1688 msgid "" "write the callback; this is a function (or method) that takes at least four " "arguments, as described below" msgstr "" -#: library/optparse.rst:1583 +#: library/optparse.rst:1695 msgid "Defining a callback option" msgstr "" -#: library/optparse.rst:1585 +#: library/optparse.rst:1697 msgid "" "As always, the easiest way to define a callback option is by using the :meth:" "`OptionParser.add_option` method. Apart from :attr:`~Option.action`, the " @@ -1901,7 +2629,11 @@ msgid "" "call::" msgstr "" -#: library/optparse.rst:1591 +#: library/optparse.rst:1701 +msgid "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" +msgstr "" + +#: library/optparse.rst:1703 msgid "" "``callback`` is a function (or other callable object), so you must have " "already defined ``my_callback()`` when you create this callback option. In " @@ -1913,7 +2645,7 @@ msgid "" "tricky; it's covered later in this section." msgstr "" -#: library/optparse.rst:1600 +#: library/optparse.rst:1712 msgid "" ":mod:`optparse` always passes four particular arguments to your callback, " "and it will only pass additional arguments if you specify them via :attr:" @@ -1921,21 +2653,25 @@ msgid "" "minimal callback function signature is::" msgstr "" -#: library/optparse.rst:1607 +#: library/optparse.rst:1717 +msgid "def my_callback(option, opt, value, parser):" +msgstr "" + +#: library/optparse.rst:1719 msgid "The four arguments to a callback are described below." msgstr "" -#: library/optparse.rst:1609 +#: library/optparse.rst:1721 msgid "" "There are several other option attributes that you can supply when you " "define a callback option:" msgstr "" -#: library/optparse.rst:1616 +#: library/optparse.rst:1724 msgid ":attr:`~Option.type`" msgstr "" -#: library/optparse.rst:1613 +#: library/optparse.rst:1725 msgid "" "has its usual meaning: as with the ``\"store\"`` or ``\"append\"`` actions, " "it instructs :mod:`optparse` to consume one argument and convert it to :attr:" @@ -1943,11 +2679,11 @@ msgid "" "though, :mod:`optparse` passes it to your callback function." msgstr "" -#: library/optparse.rst:1622 +#: library/optparse.rst:1730 msgid ":attr:`~Option.nargs`" msgstr "" -#: library/optparse.rst:1619 +#: library/optparse.rst:1731 msgid "" "also has its usual meaning: if it is supplied and > 1, :mod:`optparse` will " "consume :attr:`~Option.nargs` arguments, each of which must be convertible " @@ -1955,43 +2691,43 @@ msgid "" "callback." msgstr "" -#: library/optparse.rst:1625 +#: library/optparse.rst:1736 msgid ":attr:`~Option.callback_args`" msgstr "" -#: library/optparse.rst:1625 +#: library/optparse.rst:1737 msgid "a tuple of extra positional arguments to pass to the callback" msgstr "" -#: library/optparse.rst:1629 +#: library/optparse.rst:1739 msgid ":attr:`~Option.callback_kwargs`" msgstr "" -#: library/optparse.rst:1628 +#: library/optparse.rst:1740 msgid "a dictionary of extra keyword arguments to pass to the callback" msgstr "" -#: library/optparse.rst:1634 +#: library/optparse.rst:1746 msgid "How callbacks are called" msgstr "" -#: library/optparse.rst:1636 +#: library/optparse.rst:1748 msgid "All callbacks are called as follows::" msgstr "" -#: library/optparse.rst:1643 +#: library/optparse.rst:1754 msgid "``option``" msgstr "" -#: library/optparse.rst:1643 +#: library/optparse.rst:1755 msgid "is the Option instance that's calling the callback" msgstr "" -#: library/optparse.rst:1650 +#: library/optparse.rst:1757 msgid "``opt_str``" msgstr "" -#: library/optparse.rst:1646 +#: library/optparse.rst:1758 msgid "" "is the option string seen on the command-line that's triggering the " "callback. (If an abbreviated long option was used, ``opt_str`` will be the " @@ -2000,11 +2736,11 @@ msgid "" "``\"--foobar\"``.)" msgstr "" -#: library/optparse.rst:1657 +#: library/optparse.rst:1764 msgid "``value``" msgstr "" -#: library/optparse.rst:1653 +#: library/optparse.rst:1765 msgid "" "is the argument to this option seen on the command-line. :mod:`optparse` " "will only expect an argument if :attr:`~Option.type` is set; the type of " @@ -2014,21 +2750,21 @@ msgid "" "of values of the appropriate type." msgstr "" -#: library/optparse.rst:1680 +#: library/optparse.rst:1771 msgid "``parser``" msgstr "" -#: library/optparse.rst:1660 +#: library/optparse.rst:1772 msgid "" "is the OptionParser instance driving the whole thing, mainly useful because " "you can access some other interesting data through its instance attributes:" msgstr "" -#: library/optparse.rst:1667 +#: library/optparse.rst:1775 msgid "``parser.largs``" msgstr "" -#: library/optparse.rst:1664 +#: library/optparse.rst:1776 msgid "" "the current list of leftover arguments, ie. arguments that have been " "consumed but are neither options nor option arguments. Feel free to modify " @@ -2037,22 +2773,22 @@ msgid "" "parse_args`.)" msgstr "" -#: library/optparse.rst:1673 +#: library/optparse.rst:1781 msgid "``parser.rargs``" msgstr "" -#: library/optparse.rst:1670 +#: library/optparse.rst:1782 msgid "" "the current list of remaining arguments, ie. with ``opt_str`` and ``value`` " "(if applicable) removed, and only the arguments following them still there. " "Feel free to modify ``parser.rargs``, e.g. by consuming more arguments." msgstr "" -#: library/optparse.rst:1680 +#: library/optparse.rst:1787 msgid "``parser.values``" msgstr "" -#: library/optparse.rst:1676 +#: library/optparse.rst:1788 msgid "" "the object where option values are by default stored (an instance of " "optparse.OptionValues). This lets callbacks use the same mechanism as the " @@ -2061,27 +2797,27 @@ msgid "" "of any options already encountered on the command-line." msgstr "" -#: library/optparse.rst:1683 +#: library/optparse.rst:1795 msgid "" "is a tuple of arbitrary positional arguments supplied via the :attr:`~Option." "callback_args` option attribute." msgstr "" -#: library/optparse.rst:1689 +#: library/optparse.rst:1798 msgid "``kwargs``" msgstr "" -#: library/optparse.rst:1687 +#: library/optparse.rst:1799 msgid "" "is a dictionary of arbitrary keyword arguments supplied via :attr:`~Option." "callback_kwargs`." msgstr "" -#: library/optparse.rst:1694 +#: library/optparse.rst:1806 msgid "Raising errors in a callback" msgstr "" -#: library/optparse.rst:1696 +#: library/optparse.rst:1808 msgid "" "The callback function should raise :exc:`OptionValueError` if there are any " "problems with the option or its argument(s). :mod:`optparse` catches this " @@ -2091,46 +2827,79 @@ msgid "" "they did wrong." msgstr "" -#: library/optparse.rst:1706 +#: library/optparse.rst:1818 msgid "Callback example 1: trivial callback" msgstr "" -#: library/optparse.rst:1708 +#: library/optparse.rst:1820 msgid "" "Here's an example of a callback option that takes no arguments, and simply " "records that the option was seen::" msgstr "" -#: library/optparse.rst:1716 +#: library/optparse.rst:1823 +msgid "" +"def record_foo_seen(option, opt_str, value, parser):\n" +" parser.values.saw_foo = True\n" +"\n" +"parser.add_option(\"--foo\", action=\"callback\", callback=record_foo_seen)" +msgstr "" + +#: library/optparse.rst:1828 msgid "Of course, you could do that with the ``\"store_true\"`` action." msgstr "" -#: library/optparse.rst:1722 +#: library/optparse.rst:1834 msgid "Callback example 2: check option order" msgstr "" -#: library/optparse.rst:1724 +#: library/optparse.rst:1836 msgid "" "Here's a slightly more interesting example: record the fact that ``-a`` is " "seen, but blow up if it comes after ``-b`` in the command-line. ::" msgstr "" -#: library/optparse.rst:1739 +#: library/optparse.rst:1839 +msgid "" +"def check_order(option, opt_str, value, parser):\n" +" if parser.values.b:\n" +" raise OptionValueError(\"can't use -a after -b\")\n" +" parser.values.a = 1\n" +"...\n" +"parser.add_option(\"-a\", action=\"callback\", callback=check_order)\n" +"parser.add_option(\"-b\", action=\"store_true\", dest=\"b\")" +msgstr "" + +#: library/optparse.rst:1851 msgid "Callback example 3: check option order (generalized)" msgstr "" -#: library/optparse.rst:1741 +#: library/optparse.rst:1853 msgid "" -"If you want to re-use this callback for several similar options (set a flag, " +"If you want to reuse this callback for several similar options (set a flag, " "but blow up if ``-b`` has already been seen), it needs a bit of work: the " "error message and the flag that it sets must be generalized. ::" msgstr "" -#: library/optparse.rst:1758 +#: library/optparse.rst:1857 +msgid "" +"def check_order(option, opt_str, value, parser):\n" +" if parser.values.b:\n" +" raise OptionValueError(\"can't use %s after -b\" % opt_str)\n" +" setattr(parser.values, option.dest, 1)\n" +"...\n" +"parser.add_option(\"-a\", action=\"callback\", callback=check_order, " +"dest='a')\n" +"parser.add_option(\"-b\", action=\"store_true\", dest=\"b\")\n" +"parser.add_option(\"-c\", action=\"callback\", callback=check_order, " +"dest='c')" +msgstr "" + +#: library/optparse.rst:1870 msgid "Callback example 4: check arbitrary condition" msgstr "" -#: library/optparse.rst:1760 +#: library/optparse.rst:1872 msgid "" "Of course, you could put any condition in there---you're not limited to " "checking the values of already-defined options. For example, if you have " @@ -2138,16 +2907,28 @@ msgid "" "is this::" msgstr "" -#: library/optparse.rst:1773 +#: library/optparse.rst:1876 +msgid "" +"def check_moon(option, opt_str, value, parser):\n" +" if is_moon_full():\n" +" raise OptionValueError(\"%s option invalid when moon is full\"\n" +" % opt_str)\n" +" setattr(parser.values, option.dest, 1)\n" +"...\n" +"parser.add_option(\"--foo\",\n" +" action=\"callback\", callback=check_moon, dest=\"foo\")" +msgstr "" + +#: library/optparse.rst:1885 msgid "" "(The definition of ``is_moon_full()`` is left as an exercise for the reader.)" msgstr "" -#: library/optparse.rst:1779 +#: library/optparse.rst:1891 msgid "Callback example 5: fixed arguments" msgstr "" -#: library/optparse.rst:1781 +#: library/optparse.rst:1893 msgid "" "Things get slightly more interesting when you define callback options that " "take a fixed number of arguments. Specifying that a callback option takes " @@ -2157,23 +2938,33 @@ msgid "" "nargs`, then the option takes :attr:`~Option.nargs` arguments." msgstr "" -#: library/optparse.rst:1788 +#: library/optparse.rst:1900 msgid "" "Here's an example that just emulates the standard ``\"store\"`` action::" msgstr "" -#: library/optparse.rst:1797 +#: library/optparse.rst:1902 +msgid "" +"def store_value(option, opt_str, value, parser):\n" +" setattr(parser.values, option.dest, value)\n" +"...\n" +"parser.add_option(\"--foo\",\n" +" action=\"callback\", callback=store_value,\n" +" type=\"int\", nargs=3, dest=\"foo\")" +msgstr "" + +#: library/optparse.rst:1909 msgid "" "Note that :mod:`optparse` takes care of consuming 3 arguments and converting " "them to integers for you; all you have to do is store them. (Or whatever; " "obviously you don't need a callback for this example.)" msgstr "" -#: library/optparse.rst:1805 +#: library/optparse.rst:1917 msgid "Callback example 6: variable arguments" msgstr "" -#: library/optparse.rst:1807 +#: library/optparse.rst:1919 msgid "" "Things get hairy when you want an option to take a variable number of " "arguments. For this case, you must write a callback, as :mod:`optparse` " @@ -2183,23 +2974,23 @@ msgid "" "implement the conventional rules for bare ``--`` and ``-`` arguments:" msgstr "" -#: library/optparse.rst:1814 +#: library/optparse.rst:1926 msgid "either ``--`` or ``-`` can be option arguments" msgstr "" -#: library/optparse.rst:1816 +#: library/optparse.rst:1928 msgid "" "bare ``--`` (if not the argument to some option): halt command-line " "processing and discard the ``--``" msgstr "" -#: library/optparse.rst:1819 +#: library/optparse.rst:1931 msgid "" "bare ``-`` (if not the argument to some option): halt command-line " "processing but keep the ``-`` (append it to ``parser.largs``)" msgstr "" -#: library/optparse.rst:1822 +#: library/optparse.rst:1934 msgid "" "If you want an option that takes a variable number of arguments, there are " "several subtle, tricky issues to worry about. The exact implementation you " @@ -2208,28 +2999,58 @@ msgid "" "directly)." msgstr "" -#: library/optparse.rst:1828 +#: library/optparse.rst:1940 msgid "" "Nevertheless, here's a stab at a callback for an option with variable " "arguments::" msgstr "" -#: library/optparse.rst:1862 +#: library/optparse.rst:1943 +msgid "" +"def vararg_callback(option, opt_str, value, parser):\n" +" assert value is None\n" +" value = []\n" +"\n" +" def floatable(str):\n" +" try:\n" +" float(str)\n" +" return True\n" +" except ValueError:\n" +" return False\n" +"\n" +" for arg in parser.rargs:\n" +" # stop on --foo like options\n" +" if arg[:2] == \"--\" and len(arg) > 2:\n" +" break\n" +" # stop on -a, but not on -3 or -3.0\n" +" if arg[:1] == \"-\" and len(arg) > 1 and not floatable(arg):\n" +" break\n" +" value.append(arg)\n" +"\n" +" del parser.rargs[:len(value)]\n" +" setattr(parser.values, option.dest, value)\n" +"\n" +"...\n" +"parser.add_option(\"-c\", \"--callback\", dest=\"vararg_attr\",\n" +" action=\"callback\", callback=vararg_callback)" +msgstr "" + +#: library/optparse.rst:1974 msgid "Extending :mod:`optparse`" msgstr "" -#: library/optparse.rst:1864 +#: library/optparse.rst:1976 msgid "" "Since the two major controlling factors in how :mod:`optparse` interprets " "command-line options are the action and type of each option, the most likely " "direction of extension is to add new actions and new types." msgstr "" -#: library/optparse.rst:1872 +#: library/optparse.rst:1984 msgid "Adding new types" msgstr "" -#: library/optparse.rst:1874 +#: library/optparse.rst:1986 msgid "" "To add new types, you need to define your own subclass of :mod:`optparse`'s :" "class:`Option` class. This class has a couple of attributes that define :" @@ -2237,19 +3058,23 @@ msgid "" "TYPE_CHECKER`." msgstr "" -#: library/optparse.rst:1880 +#: library/optparse.rst:1992 msgid "" "A tuple of type names; in your subclass, simply define a new tuple :attr:" "`TYPES` that builds on the standard one." msgstr "" -#: library/optparse.rst:1885 +#: library/optparse.rst:1997 msgid "" "A dictionary mapping type names to type-checking functions. A type-checking " "function has the following signature::" msgstr "" -#: library/optparse.rst:1890 +#: library/optparse.rst:2000 +msgid "def check_mytype(option, opt, value)" +msgstr "" + +#: library/optparse.rst:2002 msgid "" "where ``option`` is an :class:`Option` instance, ``opt`` is an option string " "(e.g., ``-f``), and ``value`` is the string from the command line that must " @@ -2260,7 +3085,7 @@ msgid "" "``value`` parameter." msgstr "" -#: library/optparse.rst:1898 +#: library/optparse.rst:2010 msgid "" "Your type-checking function should raise :exc:`OptionValueError` if it " "encounters any problems. :exc:`OptionValueError` takes a single string " @@ -2269,7 +3094,7 @@ msgid "" "\"`` and prints everything to stderr before terminating the process." msgstr "" -#: library/optparse.rst:1904 +#: library/optparse.rst:2016 msgid "" "Here's a silly example that demonstrates adding a ``\"complex\"`` option " "type to parse Python-style complex numbers on the command line. (This is " @@ -2277,21 +3102,45 @@ msgid "" "support for complex numbers, but never mind.)" msgstr "" -#: library/optparse.rst:1909 +#: library/optparse.rst:2021 msgid "First, the necessary imports::" msgstr "" -#: library/optparse.rst:1914 +#: library/optparse.rst:2023 +msgid "" +"from copy import copy\n" +"from optparse import Option, OptionValueError" +msgstr "" + +#: library/optparse.rst:2026 msgid "" "You need to define your type-checker first, since it's referred to later (in " "the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::" msgstr "" -#: library/optparse.rst:1924 +#: library/optparse.rst:2029 +msgid "" +"def check_complex(option, opt, value):\n" +" try:\n" +" return complex(value)\n" +" except ValueError:\n" +" raise OptionValueError(\n" +" \"option %s: invalid complex value: %r\" % (opt, value))" +msgstr "" + +#: library/optparse.rst:2036 msgid "Finally, the Option subclass::" msgstr "" -#: library/optparse.rst:1931 +#: library/optparse.rst:2038 +msgid "" +"class MyOption (Option):\n" +" TYPES = Option.TYPES + (\"complex\",)\n" +" TYPE_CHECKER = copy(Option.TYPE_CHECKER)\n" +" TYPE_CHECKER[\"complex\"] = check_complex" +msgstr "" + +#: library/optparse.rst:2043 msgid "" "(If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would " "end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:" @@ -2299,46 +3148,59 @@ msgid "" "that except good manners and common sense.)" msgstr "" -#: library/optparse.rst:1936 +#: library/optparse.rst:2048 msgid "" "That's it! Now you can write a script that uses the new option type just " "like any other :mod:`optparse`\\ -based script, except you have to instruct " "your OptionParser to use MyOption instead of Option::" msgstr "" -#: library/optparse.rst:1943 +#: library/optparse.rst:2052 +msgid "" +"parser = OptionParser(option_class=MyOption)\n" +"parser.add_option(\"-c\", type=\"complex\")" +msgstr "" + +#: library/optparse.rst:2055 msgid "" "Alternately, you can build your own option list and pass it to OptionParser; " "if you don't use :meth:`add_option` in the above way, you don't need to tell " "OptionParser which option class to use::" msgstr "" -#: library/optparse.rst:1954 +#: library/optparse.rst:2059 +msgid "" +"option_list = [MyOption(\"-c\", action=\"store\", type=\"complex\", " +"dest=\"c\")]\n" +"parser = OptionParser(option_list=option_list)" +msgstr "" + +#: library/optparse.rst:2066 msgid "Adding new actions" msgstr "" -#: library/optparse.rst:1956 +#: library/optparse.rst:2068 msgid "" "Adding new actions is a bit trickier, because you have to understand that :" "mod:`optparse` has a couple of classifications for actions:" msgstr "" -#: library/optparse.rst:1962 +#: library/optparse.rst:2071 msgid "\"store\" actions" msgstr "" -#: library/optparse.rst:1960 +#: library/optparse.rst:2072 msgid "" "actions that result in :mod:`optparse` storing a value to an attribute of " "the current OptionValues instance; these options require a :attr:`~Option." "dest` attribute to be supplied to the Option constructor." msgstr "" -#: library/optparse.rst:1968 +#: library/optparse.rst:2076 msgid "\"typed\" actions" msgstr "" -#: library/optparse.rst:1965 +#: library/optparse.rst:2077 msgid "" "actions that take a value from the command line and expect it to be of a " "certain type; or rather, a string that can be converted to a certain type. " @@ -2346,7 +3208,7 @@ msgid "" "constructor." msgstr "" -#: library/optparse.rst:1970 +#: library/optparse.rst:2082 msgid "" "These are overlapping sets: some default \"store\" actions are " "``\"store\"``, ``\"store_const\"``, ``\"append\"``, and ``\"count\"``, while " @@ -2354,25 +3216,25 @@ msgid "" "``\"callback\"``." msgstr "" -#: library/optparse.rst:1974 +#: library/optparse.rst:2086 msgid "" "When you add an action, you need to categorize it by listing it in at least " "one of the following class attributes of Option (all are lists of strings):" msgstr "" -#: library/optparse.rst:1979 +#: library/optparse.rst:2091 msgid "All actions must be listed in ACTIONS." msgstr "" -#: library/optparse.rst:1983 +#: library/optparse.rst:2095 msgid "\"store\" actions are additionally listed here." msgstr "" -#: library/optparse.rst:1987 +#: library/optparse.rst:2099 msgid "\"typed\" actions are additionally listed here." msgstr "" -#: library/optparse.rst:1991 +#: library/optparse.rst:2103 msgid "" "Actions that always take a type (i.e. whose options always take a value) are " "additionally listed here. The only effect of this is that :mod:`optparse` " @@ -2380,13 +3242,13 @@ msgid "" "whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`." msgstr "" -#: library/optparse.rst:1996 +#: library/optparse.rst:2108 msgid "" "In order to actually implement your new action, you must override Option's :" "meth:`take_action` method and add a case that recognizes your action." msgstr "" -#: library/optparse.rst:1999 +#: library/optparse.rst:2111 msgid "" "For example, let's add an ``\"extend\"`` action. This is similar to the " "standard ``\"append\"`` action, but instead of taking a single value from " @@ -2396,47 +3258,77 @@ msgid "" "option of type ``\"string\"``, the command line ::" msgstr "" -#: library/optparse.rst:2008 +#: library/optparse.rst:2118 +msgid "--names=foo,bar --names blah --names ding,dong" +msgstr "" + +#: library/optparse.rst:2120 msgid "would result in a list ::" msgstr "" -#: library/optparse.rst:2012 +#: library/optparse.rst:2122 +msgid "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" +msgstr "" + +#: library/optparse.rst:2124 msgid "Again we define a subclass of Option::" msgstr "" -#: library/optparse.rst:2029 +#: library/optparse.rst:2126 +msgid "" +"class MyOption(Option):\n" +"\n" +" ACTIONS = Option.ACTIONS + (\"extend\",)\n" +" STORE_ACTIONS = Option.STORE_ACTIONS + (\"extend\",)\n" +" TYPED_ACTIONS = Option.TYPED_ACTIONS + (\"extend\",)\n" +" ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + (\"extend\",)\n" +"\n" +" def take_action(self, action, dest, opt, value, values, parser):\n" +" if action == \"extend\":\n" +" lvalue = value.split(\",\")\n" +" values.ensure_value(dest, []).extend(lvalue)\n" +" else:\n" +" Option.take_action(\n" +" self, action, dest, opt, value, values, parser)" +msgstr "" + +#: library/optparse.rst:2141 msgid "Features of note:" msgstr "" -#: library/optparse.rst:2031 +#: library/optparse.rst:2143 msgid "" "``\"extend\"`` both expects a value on the command-line and stores that " "value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:" "`~Option.TYPED_ACTIONS`." msgstr "" -#: library/optparse.rst:2035 +#: library/optparse.rst:2147 msgid "" "to ensure that :mod:`optparse` assigns the default type of ``\"string\"`` to " "``\"extend\"`` actions, we put the ``\"extend\"`` action in :attr:`~Option." "ALWAYS_TYPED_ACTIONS` as well." msgstr "" -#: library/optparse.rst:2039 +#: library/optparse.rst:2151 msgid "" ":meth:`MyOption.take_action` implements just this one new action, and passes " "control back to :meth:`Option.take_action` for the standard :mod:`optparse` " "actions." msgstr "" -#: library/optparse.rst:2043 +#: library/optparse.rst:2155 msgid "" "``values`` is an instance of the optparse_parser.Values class, which " "provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` " "is essentially :func:`getattr` with a safety valve; it is called as ::" msgstr "" -#: library/optparse.rst:2049 +#: library/optparse.rst:2159 +msgid "values.ensure_value(attr, value)" +msgstr "" + +#: library/optparse.rst:2161 msgid "" "If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then " "ensure_value() first sets it to ``value``, and then returns ``value``. This " @@ -2449,28 +3341,28 @@ msgid "" "meth:`ensure_value` will take care of getting it right when it's needed." msgstr "" -#: library/optparse.rst:2060 +#: library/optparse.rst:2172 msgid "Exceptions" msgstr "" -#: library/optparse.rst:2064 +#: library/optparse.rst:2176 msgid "" "Raised if an :class:`Option` instance is created with invalid or " "inconsistent arguments." msgstr "" -#: library/optparse.rst:2069 +#: library/optparse.rst:2181 msgid "Raised if conflicting options are added to an :class:`OptionParser`." msgstr "" -#: library/optparse.rst:2073 +#: library/optparse.rst:2185 msgid "Raised if an invalid option value is encountered on the command line." msgstr "" -#: library/optparse.rst:2077 +#: library/optparse.rst:2189 msgid "Raised if an invalid option is passed on the command line." msgstr "" -#: library/optparse.rst:2081 +#: library/optparse.rst:2193 msgid "Raised if an ambiguous option is passed on the command line." msgstr "" diff --git a/library/os.path.po b/library/os.path.po index aeed1e2d..58b1ee3f 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -8,22 +8,23 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/os.path.rst:2 -msgid ":mod:`os.path` --- Common pathname manipulations" +msgid ":mod:`!os.path` --- Common pathname manipulations" msgstr "" #: library/os.path.rst:7 msgid "" -"**Source code:** :source:`Lib/posixpath.py` (for POSIX) and :source:`Lib/" -"ntpath.py` (for Windows)." +"**Source code:** :source:`Lib/genericpath.py`, :source:`Lib/posixpath.py` " +"(for POSIX) and :source:`Lib/ntpath.py` (for Windows)." msgstr "" #: library/os.path.rst:14 @@ -65,11 +66,11 @@ msgid "" msgstr "" #: library/os.path.rst:45 -msgid ":mod:`posixpath` for UNIX-style paths" +msgid ":mod:`!posixpath` for UNIX-style paths" msgstr "" #: library/os.path.rst:46 -msgid ":mod:`ntpath` for Windows paths" +msgid ":mod:`!ntpath` for Windows paths" msgstr "" #: library/os.path.rst:51 @@ -87,11 +88,11 @@ msgid "" "follows: ``normpath(join(os.getcwd(), path))``." msgstr "" -#: library/os.path.rst:76 library/os.path.rst:125 library/os.path.rst:151 -#: library/os.path.rst:197 library/os.path.rst:226 library/os.path.rst:245 -#: library/os.path.rst:265 library/os.path.rst:303 library/os.path.rst:372 -#: library/os.path.rst:417 library/os.path.rst:448 library/os.path.rst:480 -#: library/os.path.rst:569 +#: library/os.path.rst:76 library/os.path.rst:126 library/os.path.rst:152 +#: library/os.path.rst:198 library/os.path.rst:227 library/os.path.rst:246 +#: library/os.path.rst:270 library/os.path.rst:309 library/os.path.rst:401 +#: library/os.path.rst:470 library/os.path.rst:497 library/os.path.rst:549 +#: library/os.path.rst:613 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -106,40 +107,49 @@ msgstr "" #: library/os.path.rst:82 msgid "" -"Return the longest common sub-path of each pathname in the sequence " +"Return the longest common sub-path of each pathname in the iterable " "*paths*. Raise :exc:`ValueError` if *paths* contain both absolute and " -"relative pathnames, the *paths* are on the different drives or if *paths* is " +"relative pathnames, if *paths* are on different drives, or if *paths* is " "empty. Unlike :func:`commonprefix`, this returns a valid path." msgstr "" -#: library/os.path.rst:415 library/os.path.rst:443 library/os.path.rst:459 -msgid ":ref:`Availability `: Unix, Windows." +#: library/os.path.rst:90 +msgid "Accepts a sequence of :term:`path-like objects `." msgstr "" -#: library/os.path.rst:92 -msgid "Accepts a sequence of :term:`path-like objects `." +#: library/os.path.rst:93 +msgid "Any iterable can now be passed, rather than just sequences." msgstr "" -#: library/os.path.rst:98 +#: library/os.path.rst:99 msgid "" "Return the longest path prefix (taken character-by-character) that is a " "prefix of all paths in *list*. If *list* is empty, return the empty string " "(``''``)." msgstr "" -#: library/os.path.rst:104 +#: library/os.path.rst:105 msgid "" "This function may return invalid paths because it works a character at a " "time. To obtain a valid path, see :func:`commonpath`." msgstr "" -#: library/os.path.rst:122 +#: library/os.path.rst:111 +msgid "" +">>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n" +"'/usr/l'\n" +"\n" +">>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n" +"'/usr'" +msgstr "" + +#: library/os.path.rst:123 msgid "" "Return the directory name of pathname *path*. This is the first element of " "the pair returned by passing *path* to the function :func:`split`." msgstr "" -#: library/os.path.rst:131 +#: library/os.path.rst:132 msgid "" "Return ``True`` if *path* refers to an existing path or an open file " "descriptor. Returns ``False`` for broken symbolic links. On some " @@ -148,26 +158,26 @@ msgid "" "physically exists." msgstr "" -#: library/os.path.rst:137 +#: library/os.path.rst:138 msgid "" "*path* can now be an integer: ``True`` is returned if it is an open file " "descriptor, ``False`` otherwise." msgstr "" -#: library/os.path.rst:147 +#: library/os.path.rst:148 msgid "" -"Return ``True`` if *path* refers to an existing path. Returns ``True`` for " -"broken symbolic links. Equivalent to :func:`exists` on platforms lacking :" -"func:`os.lstat`." +"Return ``True`` if *path* refers to an existing path, including broken " +"symbolic links. Equivalent to :func:`exists` on platforms lacking :func:" +"`os.lstat`." msgstr "" -#: library/os.path.rst:159 +#: library/os.path.rst:160 msgid "" "On Unix and Windows, return the argument with an initial component of ``~`` " "or ``~user`` replaced by that *user*'s home directory." msgstr "" -#: library/os.path.rst:164 +#: library/os.path.rst:165 msgid "" "On Unix, an initial ``~`` is replaced by the environment variable :envvar:" "`HOME` if it is set; otherwise the current user's home directory is looked " @@ -175,7 +185,7 @@ msgid "" "initial ``~user`` is looked up directly in the password directory." msgstr "" -#: library/os.path.rst:169 +#: library/os.path.rst:170 msgid "" "On Windows, :envvar:`USERPROFILE` will be used if set, otherwise a " "combination of :envvar:`HOMEPATH` and :envvar:`HOMEDRIVE` will be used. An " @@ -184,17 +194,17 @@ msgid "" "replacing it if so." msgstr "" -#: library/os.path.rst:174 +#: library/os.path.rst:175 msgid "" "If the expansion fails or if the path does not begin with a tilde, the path " "is returned unchanged." msgstr "" -#: library/os.path.rst:180 +#: library/os.path.rst:181 msgid "No longer uses :envvar:`HOME` on Windows." msgstr "" -#: library/os.path.rst:189 +#: library/os.path.rst:190 msgid "" "Return the argument with environment variables expanded. Substrings of the " "form ``$name`` or ``${name}`` are replaced by the value of environment " @@ -202,29 +212,29 @@ msgid "" "variables are left unchanged." msgstr "" -#: library/os.path.rst:194 +#: library/os.path.rst:195 msgid "" "On Windows, ``%name%`` expansions are supported in addition to ``$name`` and " "``${name}``." msgstr "" -#: library/os.path.rst:203 +#: library/os.path.rst:204 msgid "" -"Return the time of last access of *path*. The return value is a floating " +"Return the time of last access of *path*. The return value is a floating-" "point number giving the number of seconds since the epoch (see the :mod:" "`time` module). Raise :exc:`OSError` if the file does not exist or is " "inaccessible." msgstr "" -#: library/os.path.rst:210 +#: library/os.path.rst:211 msgid "" "Return the time of last modification of *path*. The return value is a " -"floating point number giving the number of seconds since the epoch (see " +"floating-point number giving the number of seconds since the epoch (see " "the :mod:`time` module). Raise :exc:`OSError` if the file does not exist or " "is inaccessible." msgstr "" -#: library/os.path.rst:220 +#: library/os.path.rst:221 msgid "" "Return the system's ctime which, on some systems (like Unix) is the time of " "the last metadata change, and, on others (like Windows), is the creation " @@ -233,48 +243,54 @@ msgid "" "file does not exist or is inaccessible." msgstr "" -#: library/os.path.rst:232 +#: library/os.path.rst:233 msgid "" "Return the size, in bytes, of *path*. Raise :exc:`OSError` if the file does " "not exist or is inaccessible." msgstr "" -#: library/os.path.rst:241 +#: library/os.path.rst:242 msgid "" "Return ``True`` if *path* is an absolute pathname. On Unix, that means it " -"begins with a slash, on Windows that it begins with a (back)slash after " -"chopping off a potential drive letter." +"begins with a slash, on Windows that it begins with two (back)slashes, or a " +"drive letter, colon, and (back)slash together." msgstr "" -#: library/os.path.rst:251 +#: library/os.path.rst:249 +msgid "" +"On Windows, returns ``False`` if the given path starts with exactly one " +"(back)slash." +msgstr "" + +#: library/os.path.rst:256 msgid "" "Return ``True`` if *path* is an :func:`existing ` regular file. This " "follows symbolic links, so both :func:`islink` and :func:`isfile` can be " "true for the same path." msgstr "" -#: library/os.path.rst:261 +#: library/os.path.rst:266 msgid "" "Return ``True`` if *path* is an :func:`existing ` directory. This " "follows symbolic links, so both :func:`islink` and :func:`isdir` can be true " "for the same path." msgstr "" -#: library/os.path.rst:271 +#: library/os.path.rst:276 msgid "" "Return ``True`` if *path* refers to an :func:`existing ` directory " "entry that is a junction. Always return ``False`` if junctions are not " "supported on the current platform." msgstr "" -#: library/os.path.rst:280 +#: library/os.path.rst:285 msgid "" "Return ``True`` if *path* refers to an :func:`existing ` directory " "entry that is a symbolic link. Always ``False`` if symbolic links are not " "supported by the Python runtime." msgstr "" -#: library/os.path.rst:290 +#: library/os.path.rst:295 msgid "" "Return ``True`` if pathname *path* is a :dfn:`mount point`: a point in a " "file system where a different file system has been mounted. On POSIX, the " @@ -282,16 +298,18 @@ msgid "" "different device than *path*, or whether :file:`{path}/..` and *path* point " "to the same i-node on the same device --- this should detect mount points " "for all Unix and POSIX variants. It is not able to reliably detect bind " -"mounts on the same filesystem. On Windows, a drive letter root and a share " -"UNC are always mount points, and for any other path ``GetVolumePathName`` is " -"called to see if it is different from the input path." +"mounts on the same filesystem. On Linux systems, it will always return " +"``True`` for btrfs subvolumes, even if they aren't mount points. On Windows, " +"a drive letter root and a share UNC are always mount points, and for any " +"other path ``GetVolumePathName`` is called to see if it is different from " +"the input path." msgstr "" -#: library/os.path.rst:300 -msgid "Support for detecting non-root mount points on Windows." +#: library/os.path.rst:306 +msgid "Added support for detecting non-root mount points on Windows." msgstr "" -#: library/os.path.rst:309 +#: library/os.path.rst:315 msgid "" "Return ``True`` if pathname *path* is located on a Windows Dev Drive. A Dev " "Drive is optimized for developer scenarios, and offers faster performance " @@ -300,7 +318,7 @@ msgid "" "operations." msgstr "" -#: library/os.path.rst:315 +#: library/os.path.rst:321 msgid "" "May raise an error for an invalid path, for example, one without a " "recognizable drive, but returns ``False`` on platforms that do not support " @@ -308,11 +326,38 @@ msgid "" "windows/dev-drive/>`_ for information on enabling and creating Dev Drives." msgstr "" -#: library/os.path.rst:320 -msgid ":ref:`Availability `: Windows." +#: library/os.path.rst:328 +msgid "" +"The function is now available on all platforms, and will always return " +"``False`` on those that have no support for Dev Drives" +msgstr "" + +#: library/os.path.rst:334 +msgid "Return ``True`` if *path* is a reserved pathname on the current system." +msgstr "" + +#: library/os.path.rst:336 +msgid "" +"On Windows, reserved filenames include those that end with a space or dot; " +"those that contain colons (i.e. file streams such as \"name:stream\"), " +"wildcard characters (i.e. ``'*?\"<>'``), pipe, or ASCII control characters; " +"as well as DOS device names such as \"NUL\", \"CON\", \"CONIN$\", \"CONOUT$" +"\", \"AUX\", \"PRN\", \"COM1\", and \"LPT1\"." +msgstr "" + +#: library/os.path.rst:344 +msgid "" +"This function approximates rules for reserved paths on most Windows systems. " +"These rules change over time in various Windows releases. This function may " +"be updated in future Python releases as changes to the rules become broadly " +"available." msgstr "" -#: library/os.path.rst:327 +#: library/os.path.rst:349 +msgid "Availability" +msgstr "" + +#: library/os.path.rst:356 msgid "" "Join one or more path segments intelligently. The return value is the " "concatenation of *path* and all members of *\\*paths*, with exactly one " @@ -323,7 +368,7 @@ msgid "" "and joining continues from the absolute path segment." msgstr "" -#: library/os.path.rst:335 +#: library/os.path.rst:364 msgid "" "On Windows, the drive is not reset when a rooted path segment (e.g., " "``r'\\foo'``) is encountered. If a segment is on a different drive or is an " @@ -333,18 +378,18 @@ msgid "" "on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." msgstr "" -#: library/os.path.rst:342 +#: library/os.path.rst:371 msgid "Accepts a :term:`path-like object` for *path* and *paths*." msgstr "" -#: library/os.path.rst:348 +#: library/os.path.rst:377 msgid "" "Normalize the case of a pathname. On Windows, convert all characters in the " "pathname to lowercase, and also convert forward slashes to backward slashes. " "On other operating systems, return the path unchanged." msgstr "" -#: library/os.path.rst:358 +#: library/os.path.rst:387 msgid "" "Normalize a pathname by collapsing redundant separators and up-level " "references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all " @@ -353,7 +398,7 @@ msgid "" "backward slashes. To normalize case, use :func:`normcase`." msgstr "" -#: library/os.path.rst:365 +#: library/os.path.rst:394 msgid "" "On POSIX systems, in accordance with `IEEE Std 1003.1 2013 Edition; 4.13 " "Pathname Resolution >> splitdrive(\"c:/dir\")\n" +"(\"c:\", \"/dir\")" +msgstr "" + +#: library/os.path.rst:543 msgid "" "If the path contains a UNC path, drive will contain the host name and share::" msgstr "" -#: library/os.path.rst:511 +#: library/os.path.rst:546 +msgid "" +">>> splitdrive(\"//host/computer/dir\")\n" +"(\"//host/computer\", \"/dir\")" +msgstr "" + +#: library/os.path.rst:555 msgid "" "Split the pathname *path* into a 3-item tuple ``(drive, root, tail)`` where " "*drive* is a device name or mount point, *root* is a string of separators " @@ -487,7 +583,7 @@ msgid "" "same as *path*." msgstr "" -#: library/os.path.rst:517 +#: library/os.path.rst:561 msgid "" "On POSIX systems, *drive* is always empty. The *root* may be empty (if " "*path* is relative), a single forward slash (if *path* is absolute), or two " @@ -496,37 +592,77 @@ msgid "" "basedefs/V1_chap04.html#tag_04_13>`_.) For example::" msgstr "" -#: library/os.path.rst:530 +#: library/os.path.rst:567 +msgid "" +">>> splitroot('/home/sam')\n" +"('', '/', 'home/sam')\n" +">>> splitroot('//home/sam')\n" +"('', '//', 'home/sam')\n" +">>> splitroot('///home/sam')\n" +"('', '/', '//home/sam')" +msgstr "" + +#: library/os.path.rst:574 msgid "" "On Windows, *drive* may be empty, a drive-letter name, a UNC share, or a " "device name. The *root* may be empty, a forward slash, or a backward slash. " "For example::" msgstr "" -#: library/os.path.rst:544 +#: library/os.path.rst:578 +msgid "" +">>> splitroot('C:/Users/Sam')\n" +"('C:', '/', 'Users/Sam')\n" +">>> splitroot('//Server/Share/Users/Sam')\n" +"('//Server/Share', '/', 'Users/Sam')" +msgstr "" + +#: library/os.path.rst:588 msgid "" "Split the pathname *path* into a pair ``(root, ext)`` such that ``root + " "ext == path``, and the extension, *ext*, is empty or begins with a period " "and contains at most one period." msgstr "" -#: library/os.path.rst:548 +#: library/os.path.rst:592 msgid "If the path contains no extension, *ext* will be ``''``::" msgstr "" -#: library/os.path.rst:553 +#: library/os.path.rst:594 +msgid "" +">>> splitext('bar')\n" +"('bar', '')" +msgstr "" + +#: library/os.path.rst:597 msgid "" "If the path contains an extension, then *ext* will be set to this extension, " "including the leading period. Note that previous periods will be ignored::" msgstr "" -#: library/os.path.rst:561 +#: library/os.path.rst:600 +msgid "" +">>> splitext('foo.bar.exe')\n" +"('foo.bar', '.exe')\n" +">>> splitext('/foo/bar.exe')\n" +"('/foo/bar', '.exe')" +msgstr "" + +#: library/os.path.rst:605 msgid "" "Leading periods of the last component of the path are considered to be part " "of the root::" msgstr "" -#: library/os.path.rst:575 +#: library/os.path.rst:608 +msgid "" +">>> splitext('.cshrc')\n" +"('.cshrc', '')\n" +">>> splitext('/foo/....jpg')\n" +"('/foo/....jpg', '')" +msgstr "" + +#: library/os.path.rst:619 msgid "" "``True`` if arbitrary Unicode strings can be used as file names (within " "limitations imposed by the file system)." @@ -540,34 +676,34 @@ msgstr "" msgid "operations" msgstr "" -#: library/os.path.rst:155 +#: library/os.path.rst:156 msgid "~ (tilde)" msgstr "" -#: library/os.path.rst:155 +#: library/os.path.rst:156 msgid "home directory expansion" msgstr "" -#: library/os.path.rst:162 +#: library/os.path.rst:163 msgid "module" msgstr "" -#: library/os.path.rst:162 +#: library/os.path.rst:163 msgid "pwd" msgstr "" -#: library/os.path.rst:183 +#: library/os.path.rst:184 msgid "$ (dollar)" msgstr "" -#: library/os.path.rst:183 +#: library/os.path.rst:184 msgid "environment variables expansion" msgstr "" -#: library/os.path.rst:183 +#: library/os.path.rst:184 msgid "% (percent)" msgstr "" -#: library/os.path.rst:183 +#: library/os.path.rst:184 msgid "environment variables expansion (Windows)" msgstr "" diff --git a/library/os.po b/library/os.po index 1f039788..624da6cf 100644 --- a/library/os.po +++ b/library/os.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/os.rst:2 -msgid ":mod:`os` --- Miscellaneous operating system interfaces" +msgid ":mod:`!os` --- Miscellaneous operating system interfaces" msgstr "" #: library/os.rst:7 @@ -69,12 +70,12 @@ msgstr "" #: library/os.rst:37 msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, large " -"parts of the :mod:`os` module are not available or behave differently. API " -"related to processes (e.g. :func:`~os.fork`, :func:`~os.execve`), signals (e." -"g. :func:`~os.kill`, :func:`~os.wait`), and resources (e.g. :func:`~os." +"On WebAssembly platforms, Android and iOS, large parts of the :mod:`os` " +"module are not available or behave differently. APIs related to processes (e." +"g. :func:`~os.fork`, :func:`~os.execve`) and resources (e.g. :func:`~os." "nice`) are not available. Others like :func:`~os.getuid` and :func:`~os." -"getpid` are emulated or stubs." +"getpid` are emulated or stubs. WebAssembly platforms also lack support for " +"signals (e.g. :func:`~os.kill`, :func:`~os.wait`)." msgstr "" #: library/os.rst:47 @@ -169,13 +170,13 @@ msgid "" msgstr "" #: library/os.rst:116 -msgid ":func:`sys.getfilesystemencoding()` returns ``'utf-8'``." +msgid ":func:`sys.getfilesystemencoding` returns ``'utf-8'``." msgstr "" #: library/os.rst:117 msgid "" -":func:`locale.getpreferredencoding()` returns ``'utf-8'`` (the " -"*do_setlocale* argument has no effect)." +":func:`locale.getpreferredencoding` returns ``'utf-8'`` (the *do_setlocale* " +"argument has no effect)." msgstr "" #: library/os.rst:119 @@ -213,12 +214,12 @@ msgid "" msgstr "" #: library/os.rst:136 -msgid ":func:`os.fsdecode()` and :func:`os.fsencode()` use the UTF-8 encoding." +msgid ":func:`os.fsdecode` and :func:`os.fsencode` use the UTF-8 encoding." msgstr "" #: library/os.rst:137 msgid "" -":func:`open()`, :func:`io.open()`, and :func:`codecs.open()` use the UTF-8 " +":func:`open`, :func:`io.open`, and :func:`codecs.open` use the UTF-8 " "encoding by default. However, they still use the strict error handler by " "default so that attempting to open a binary file in text mode is likely to " "raise an exception rather than producing nonsense data." @@ -282,20 +283,37 @@ msgid "" "Return the filename corresponding to the controlling terminal of the process." msgstr "" -#: library/os.rst:358 library/os.rst:389 library/os.rst:434 library/os.rst:480 -#: library/os.rst:512 library/os.rst:545 library/os.rst:586 library/os.rst:602 -#: library/os.rst:661 library/os.rst:687 library/os.rst:703 library/os.rst:719 -#: library/os.rst:735 library/os.rst:1345 library/os.rst:1608 -#: library/os.rst:1637 library/os.rst:2110 library/os.rst:2433 -#: library/os.rst:4036 library/os.rst:4050 library/os.rst:4064 -#: library/os.rst:4078 library/os.rst:4094 library/os.rst:4108 -#: library/os.rst:4125 library/os.rst:4140 library/os.rst:4223 -#: library/os.rst:4270 library/os.rst:4427 library/os.rst:4713 -#: library/os.rst:4808 library/os.rst:4839 library/os.rst:4865 -#: library/os.rst:4890 library/os.rst:4909 library/os.rst:4973 -#: library/os.rst:4996 library/os.rst:5012 library/os.rst:5030 -#: library/os.rst:5039 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#: library/os.rst:345 library/os.rst:381 library/os.rst:399 library/os.rst:421 +#: library/os.rst:457 library/os.rst:485 library/os.rst:514 library/os.rst:535 +#: library/os.rst:556 library/os.rst:604 library/os.rst:618 library/os.rst:664 +#: library/os.rst:686 library/os.rst:712 library/os.rst:728 library/os.rst:744 +#: library/os.rst:760 library/os.rst:858 library/os.rst:1006 +#: library/os.rst:1036 library/os.rst:1065 library/os.rst:1109 +#: library/os.rst:1132 library/os.rst:1166 library/os.rst:1199 +#: library/os.rst:1271 library/os.rst:1406 library/os.rst:1430 +#: library/os.rst:1460 library/os.rst:1490 library/os.rst:1533 +#: library/os.rst:1562 library/os.rst:1601 library/os.rst:1623 +#: library/os.rst:1716 library/os.rst:1745 library/os.rst:1811 +#: library/os.rst:1845 library/os.rst:1862 library/os.rst:1910 +#: library/os.rst:1988 library/os.rst:2160 library/os.rst:2254 +#: library/os.rst:2294 library/os.rst:2328 library/os.rst:2408 +#: library/os.rst:2452 library/os.rst:2610 library/os.rst:2666 +#: library/os.rst:3396 library/os.rst:3556 library/os.rst:3790 +#: library/os.rst:3840 library/os.rst:3903 library/os.rst:3920 +#: library/os.rst:3938 library/os.rst:4073 library/os.rst:4101 +#: library/os.rst:4120 library/os.rst:4140 library/os.rst:4296 +#: library/os.rst:4400 library/os.rst:4415 library/os.rst:4429 +#: library/os.rst:4443 library/os.rst:4458 library/os.rst:4473 +#: library/os.rst:4489 library/os.rst:4505 library/os.rst:4519 +#: library/os.rst:4595 library/os.rst:4634 library/os.rst:4652 +#: library/os.rst:4671 library/os.rst:4815 library/os.rst:4864 +#: library/os.rst:4956 library/os.rst:4979 library/os.rst:5061 +#: library/os.rst:5105 library/os.rst:5180 library/os.rst:5214 +#: library/os.rst:5246 library/os.rst:5269 library/os.rst:5291 +#: library/os.rst:5314 library/os.rst:5365 library/os.rst:5388 +#: library/os.rst:5404 library/os.rst:5422 library/os.rst:5595 +#: library/os.rst:5628 library/os.rst:5664 library/os.rst:5787 +msgid "Availability" msgstr "" #: library/os.rst:186 @@ -356,12 +374,16 @@ msgid "" "called." msgstr "" -#: library/os.rst:241 +#: library/os.rst:227 +msgid "The :func:`os.reload_environ` function." +msgstr "" + +#: library/os.rst:245 msgid "" "Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators." msgstr "" -#: library/os.rst:231 +#: library/os.rst:235 msgid "" "Bytes version of :data:`environ`: a :term:`mapping` object where both keys " "and values are :class:`bytes` objects representing the process environment. :" @@ -369,47 +391,65 @@ msgid "" "`environb` updates :data:`environ`, and vice versa)." msgstr "" -#: library/os.rst:236 +#: library/os.rst:240 msgid "" ":data:`environb` is only available if :const:`supports_bytes_environ` is " "``True``." msgstr "" -#: library/os.rst:250 +#: library/os.rst:251 +msgid "" +"The :data:`os.environ` and :data:`os.environb` mappings are a cache of " +"environment variables at the time that Python started. As such, changes to " +"the current process environment are not reflected if made outside Python, or " +"by :func:`os.putenv` or :func:`os.unsetenv`. Use :func:`!os.reload_environ` " +"to update :data:`os.environ` and :data:`os.environb` with any such changes " +"to the current process environment." +msgstr "" + +#: library/os.rst:259 +msgid "" +"This function is not thread-safe. Calling it while the environment is being " +"modified in an other thread is an undefined behavior. Reading from :data:`os." +"environ` or :data:`os.environb`, or calling :func:`os.getenv` while " +"reloading, may return an empty result." +msgstr "" + +#: library/os.rst:272 msgid "These functions are described in :ref:`os-file-dir`." msgstr "" -#: library/os.rst:255 +#: library/os.rst:277 msgid "" "Encode :term:`path-like ` *filename* to the :term:" "`filesystem encoding and error handler`; return :class:`bytes` unchanged." msgstr "" -#: library/os.rst:259 +#: library/os.rst:281 msgid ":func:`fsdecode` is the reverse function." msgstr "" -#: library/os.rst:278 +#: library/os.rst:300 msgid "" "Support added to accept objects implementing the :class:`os.PathLike` " "interface." msgstr "" -#: library/os.rst:270 +#: library/os.rst:292 msgid "" "Decode the :term:`path-like ` *filename* from the :term:" "`filesystem encoding and error handler`; return :class:`str` unchanged." msgstr "" -#: library/os.rst:274 +#: library/os.rst:296 msgid ":func:`fsencode` is the reverse function." msgstr "" -#: library/os.rst:285 +#: library/os.rst:307 msgid "Return the file system representation of the path." msgstr "" -#: library/os.rst:287 +#: library/os.rst:309 msgid "" "If :class:`str` or :class:`bytes` is passed in, it is returned unchanged. " "Otherwise :meth:`~os.PathLike.__fspath__` is called and its value is " @@ -417,23 +457,23 @@ msgid "" "other cases, :exc:`TypeError` is raised." msgstr "" -#: library/os.rst:297 +#: library/os.rst:319 msgid "" "An :term:`abstract base class` for objects representing a file system path, " "e.g. :class:`pathlib.PurePath`." msgstr "" -#: library/os.rst:304 +#: library/os.rst:327 msgid "Return the file system path representation of the object." msgstr "" -#: library/os.rst:306 +#: library/os.rst:329 msgid "" "The method should only return a :class:`str` or :class:`bytes` object, with " "the preference being for :class:`str`." msgstr "" -#: library/os.rst:312 +#: library/os.rst:335 msgid "" "Return the value of the environment variable *key* as a string if it exists, " "or *default* if it doesn't. *key* is a string. Note that since :func:" @@ -442,20 +482,14 @@ msgid "" "changes." msgstr "" -#: library/os.rst:318 +#: library/os.rst:341 msgid "" "On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` " "and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you would " "like to use a different encoding." msgstr "" -#: library/os.rst:1086 library/os.rst:1110 library/os.rst:1649 -#: library/os.rst:2533 library/os.rst:3412 library/os.rst:4564 -#: library/os.rst:4692 -msgid ":ref:`Availability `: Unix, Windows." -msgstr "" - -#: library/os.rst:327 +#: library/os.rst:350 msgid "" "Return the value of the environment variable *key* as bytes if it exists, or " "*default* if it doesn't. *key* must be bytes. Note that since :func:" @@ -464,22 +498,13 @@ msgid "" "environment changes." msgstr "" -#: library/os.rst:334 +#: library/os.rst:357 msgid "" ":func:`getenvb` is only available if :const:`supports_bytes_environ` is " "``True``." msgstr "" -#: library/os.rst:376 library/os.rst:787 library/os.rst:1019 -#: library/os.rst:1053 library/os.rst:1138 library/os.rst:1396 -#: library/os.rst:1424 library/os.rst:1708 library/os.rst:1770 -#: library/os.rst:2124 library/os.rst:2499 library/os.rst:3241 -#: library/os.rst:3631 library/os.rst:5196 library/os.rst:5227 -#: library/os.rst:5236 -msgid ":ref:`Availability `: Unix." -msgstr "" - -#: library/os.rst:344 +#: library/os.rst:367 msgid "" "Returns the list of directories that will be searched for a named " "executable, similar to a shell, when launching a process. *env*, when " @@ -487,27 +512,27 @@ msgid "" "in. By default, when *env* is ``None``, :data:`environ` is used." msgstr "" -#: library/os.rst:355 +#: library/os.rst:378 msgid "" "Return the effective group id of the current process. This corresponds to " "the \"set id\" bit on the file being executed in the current process." msgstr "" -#: library/os.rst:365 +#: library/os.rst:388 msgid "Return the current process's effective user id." msgstr "" -#: library/os.rst:374 +#: library/os.rst:397 msgid "Return the real group id of the current process." msgstr "" -#: library/os.rst:451 library/os.rst:758 +#: library/os.rst:474 library/os.rst:783 msgid "" -"The function is a stub on Emscripten and WASI, see :ref:`wasm-availability` " -"for more information." +"The function is a stub on WASI, see :ref:`wasm-availability` for more " +"information." msgstr "" -#: library/os.rst:384 +#: library/os.rst:407 msgid "" "Return list of group ids that *user* belongs to. If *group* is not in the " "list, it is included; typically, *group* is specified as the group ID field " @@ -515,12 +540,12 @@ msgid "" "potentially omitted." msgstr "" -#: library/os.rst:396 +#: library/os.rst:419 msgid "" "Return list of supplemental group ids associated with the current process." msgstr "" -#: library/os.rst:402 +#: library/os.rst:425 msgid "" "On macOS, :func:`getgroups` behavior differs somewhat from other Unix " "platforms. If the Python interpreter was built with a deployment target of " @@ -537,7 +562,7 @@ msgid "" "get_config_var`." msgstr "" -#: library/os.rst:419 +#: library/os.rst:442 msgid "" "Return the name of the user logged in on the controlling terminal of the " "process. For most purposes, it is more useful to use :func:`getpass." @@ -546,38 +571,32 @@ msgid "" "getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" -#: library/os.rst:462 library/os.rst:4247 library/os.rst:4669 -#: library/os.rst:4957 -msgid "" -":ref:`Availability `: Unix, Windows, not Emscripten, not WASI." -msgstr "" - -#: library/os.rst:431 +#: library/os.rst:454 msgid "" "Return the process group id of the process with process id *pid*. If *pid* " "is 0, the process group id of the current process is returned." msgstr "" -#: library/os.rst:440 +#: library/os.rst:463 msgid "Return the id of the current process group." msgstr "" -#: library/os.rst:449 +#: library/os.rst:472 msgid "Return the current process id." msgstr "" -#: library/os.rst:458 +#: library/os.rst:481 msgid "" "Return the parent's process id. When the parent process has exited, on Unix " "the id returned is the one of the init process (1), on Windows it is still " "the same id, which may be already reused by another process." msgstr "" -#: library/os.rst:464 +#: library/os.rst:487 msgid "Added support for Windows." msgstr "" -#: library/os.rst:472 +#: library/os.rst:495 msgid "" "Get program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -588,46 +607,42 @@ msgid "" "user ID of the calling process." msgstr "" -#: library/os.rst:501 +#: library/os.rst:524 msgid "" "Parameters for the :func:`getpriority` and :func:`setpriority` functions." msgstr "" -#: library/os.rst:503 -msgid ":ref:`Availability `: macOS" -msgstr "" - -#: library/os.rst:509 +#: library/os.rst:532 msgid "" "Return a tuple (ruid, euid, suid) denoting the current process's real, " "effective, and saved user ids." msgstr "" -#: library/os.rst:519 +#: library/os.rst:542 msgid "" "Return a tuple (rgid, egid, sgid) denoting the current process's real, " "effective, and saved group ids." msgstr "" -#: library/os.rst:531 +#: library/os.rst:554 msgid "Return the current process's real user id." msgstr "" -#: library/os.rst:541 +#: library/os.rst:564 msgid "" -"Call the system initgroups() to initialize the group access list with all of " -"the groups of which the specified username is a member, plus the specified " -"group id." +"Call the system ``initgroups()`` to initialize the group access list with " +"all of the groups of which the specified username is a member, plus the " +"specified group id." msgstr "" -#: library/os.rst:554 +#: library/os.rst:577 msgid "" "Set the environment variable named *key* to the string *value*. Such " "changes to the environment affect subprocesses started with :func:`os." "system`, :func:`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: library/os.rst:558 +#: library/os.rst:581 msgid "" "Assignments to items in :data:`os.environ` are automatically translated into " "corresponding calls to :func:`putenv`; however, calls to :func:`putenv` " @@ -637,35 +652,39 @@ msgid "" "in their implementations." msgstr "" -#: library/os.rst:566 +#: library/os.rst:837 +msgid "See also the :func:`os.reload_environ` function." +msgstr "" + +#: library/os.rst:591 msgid "" "On some platforms, including FreeBSD and macOS, setting ``environ`` may " "cause memory leaks. Refer to the system documentation for :c:func:`!putenv`." msgstr "" -#: library/os.rst:569 +#: library/os.rst:594 msgid "" "Raises an :ref:`auditing event ` ``os.putenv`` with arguments " "``key``, ``value``." msgstr "" -#: library/os.rst:571 +#: library/os.rst:596 msgid "The function is now always available." msgstr "" -#: library/os.rst:577 +#: library/os.rst:602 msgid "Set the current process's effective group id." msgstr "" -#: library/os.rst:584 +#: library/os.rst:609 msgid "Set the current process's effective user id." msgstr "" -#: library/os.rst:591 +#: library/os.rst:616 msgid "Set the current process' group id." msgstr "" -#: library/os.rst:598 +#: library/os.rst:623 msgid "" "Set the list of supplemental group ids associated with the current process " "to *groups*. *groups* must be a sequence, and each element must be an " @@ -673,7 +692,7 @@ msgid "" "the superuser." msgstr "" -#: library/os.rst:604 +#: library/os.rst:629 msgid "" "On macOS, the length of *groups* may not exceed the system-defined maximum " "number of effective group ids, typically 16. See the documentation for :func:" @@ -681,13 +700,13 @@ msgid "" "calling setgroups()." msgstr "" -#: library/os.rst:611 +#: library/os.rst:636 msgid "" "Reassociate the current thread with a Linux namespace. See the :manpage:" "`setns(2)` and :manpage:`namespaces(7)` man pages for more details." msgstr "" -#: library/os.rst:615 +#: library/os.rst:640 msgid "" "If *fd* refers to a :file:`/proc/{pid}/ns/` link, ``setns()`` reassociates " "the calling thread with the namespace associated with that link, and " @@ -696,7 +715,7 @@ msgid "" "constraints)." msgstr "" -#: library/os.rst:622 +#: library/os.rst:647 msgid "" "Since Linux 5.8, *fd* may refer to a PID file descriptor obtained from :func:" "`~os.pidfd_open`. In this case, ``setns()`` reassociates the calling thread " @@ -707,41 +726,44 @@ msgid "" "memberships in unspecified namespaces are left unchanged." msgstr "" -#: library/os.rst:631 +#: library/os.rst:656 msgid "" "*fd* can be any object with a :meth:`~io.IOBase.fileno` method, or a raw " "file descriptor." msgstr "" -#: library/os.rst:633 +#: library/os.rst:658 msgid "" "This example reassociates the thread with the ``init`` process's network " "namespace::" msgstr "" -#: library/os.rst:639 -msgid ":ref:`Availability `: Linux >= 3.0 with glibc >= 2.14." +#: library/os.rst:660 +msgid "" +"fd = os.open(\"/proc/1/ns/net\", os.O_RDONLY)\n" +"os.setns(fd, os.CLONE_NEWNET)\n" +"os.close(fd)" msgstr "" -#: library/os.rst:645 +#: library/os.rst:670 msgid "The :func:`~os.unshare` function." msgstr "" -#: library/os.rst:649 +#: library/os.rst:674 msgid "" "Call the system call :c:func:`!setpgrp` or ``setpgrp(0, 0)`` depending on " "which version is implemented (if any). See the Unix manual for the " "semantics." msgstr "" -#: library/os.rst:657 +#: library/os.rst:682 msgid "" "Call the system call :c:func:`!setpgid` to set the process group id of the " "process with id *pid* to the process group with id *pgrp*. See the Unix " "manual for the semantics." msgstr "" -#: library/os.rst:668 +#: library/os.rst:693 msgid "" "Set program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -754,109 +776,117 @@ msgid "" "scheduling." msgstr "" -#: library/os.rst:685 +#: library/os.rst:710 msgid "Set the current process's real and effective group ids." msgstr "" -#: library/os.rst:692 +#: library/os.rst:717 msgid "Set the current process's real, effective, and saved group ids." msgstr "" -#: library/os.rst:701 +#: library/os.rst:726 msgid "Set the current process's real, effective, and saved user ids." msgstr "" -#: library/os.rst:710 +#: library/os.rst:735 msgid "Set the current process's real and effective user ids." msgstr "" -#: library/os.rst:717 +#: library/os.rst:742 msgid "" "Call the system call :c:func:`!getsid`. See the Unix manual for the " "semantics." msgstr "" -#: library/os.rst:724 +#: library/os.rst:749 msgid "" "Call the system call :c:func:`!setsid`. See the Unix manual for the " "semantics." msgstr "" -#: library/os.rst:733 +#: library/os.rst:758 msgid "Set the current process's user id." msgstr "" -#: library/os.rst:741 +#: library/os.rst:766 msgid "" "Return the error message corresponding to the error code in *code*. On " "platforms where :c:func:`!strerror` returns ``NULL`` when given an unknown " "error number, :exc:`ValueError` is raised." msgstr "" -#: library/os.rst:748 +#: library/os.rst:773 msgid "" "``True`` if the native OS type of the environment is bytes (eg. ``False`` on " "Windows)." msgstr "" -#: library/os.rst:756 +#: library/os.rst:781 msgid "Set the current numeric umask and return the previous umask." msgstr "" -#: library/os.rst:768 +#: library/os.rst:793 msgid "" "Returns information identifying the current operating system. The return " "value is an object with five attributes:" msgstr "" -#: library/os.rst:771 +#: library/os.rst:796 msgid ":attr:`sysname` - operating system name" msgstr "" -#: library/os.rst:772 +#: library/os.rst:797 msgid ":attr:`nodename` - name of machine on network (implementation-defined)" msgstr "" -#: library/os.rst:773 +#: library/os.rst:798 msgid ":attr:`release` - operating system release" msgstr "" -#: library/os.rst:774 +#: library/os.rst:799 msgid ":attr:`version` - operating system version" msgstr "" -#: library/os.rst:775 +#: library/os.rst:800 msgid ":attr:`machine` - hardware identifier" msgstr "" -#: library/os.rst:777 +#: library/os.rst:802 msgid "" "For backwards compatibility, this object is also iterable, behaving like a " "five-tuple containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :" "attr:`version`, and :attr:`machine` in that order." msgstr "" -#: library/os.rst:782 +#: library/os.rst:807 msgid "" "Some systems truncate :attr:`nodename` to 8 characters or to the leading " "component; a better way to get the hostname is :func:`socket.gethostname` " "or even ``socket.gethostbyaddr(socket.gethostname())``." msgstr "" -#: library/os.rst:4694 +#: library/os.rst:812 +msgid "" +"On macOS, iOS and Android, this returns the *kernel* name and version (i.e., " +"``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform." +"uname` can be used to get the user-facing operating system name and version " +"on iOS and Android." +msgstr "" + +#: library/os.rst:5086 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." msgstr "" -#: library/os.rst:798 +#: library/os.rst:828 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " "environment affect subprocesses started with :func:`os.system`, :func:" "`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: library/os.rst:802 +#: library/os.rst:832 msgid "" "Deletion of items in :data:`os.environ` is automatically translated into a " "corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv` " @@ -864,17 +894,17 @@ msgid "" "items of :data:`os.environ`." msgstr "" -#: library/os.rst:807 +#: library/os.rst:839 msgid "" "Raises an :ref:`auditing event ` ``os.unsetenv`` with argument " "``key``." msgstr "" -#: library/os.rst:809 +#: library/os.rst:841 msgid "The function is now always available and is also available on Windows." msgstr "" -#: library/os.rst:815 +#: library/os.rst:847 msgid "" "Disassociate parts of the process execution context, and move them into a " "newly created namespace. See the :manpage:`unshare(2)` man page for more " @@ -885,32 +915,28 @@ msgid "" "are made to the calling process's execution context." msgstr "" -#: library/os.rst:826 -msgid ":ref:`Availability `: Linux >= 2.6.16." -msgstr "" - -#: library/os.rst:832 +#: library/os.rst:864 msgid "The :func:`~os.setns` function." msgstr "" -#: library/os.rst:836 +#: library/os.rst:868 msgid "" "Flags to the :func:`unshare` function, if the implementation supports them. " "See :manpage:`unshare(2)` in the Linux manual for their exact effect and " "availability." msgstr "" -#: library/os.rst:859 +#: library/os.rst:891 msgid "File Object Creation" msgstr "" -#: library/os.rst:861 +#: library/os.rst:893 msgid "" "These functions create new :term:`file objects `. (See also :" "func:`~os.open` for opening file descriptors.)" msgstr "" -#: library/os.rst:867 +#: library/os.rst:899 msgid "" "Return an open file object connected to the file descriptor *fd*. This is " "an alias of the :func:`open` built-in function and accepts the same " @@ -918,16 +944,16 @@ msgid "" "must always be an integer." msgstr "" -#: library/os.rst:876 +#: library/os.rst:908 msgid "File Descriptor Operations" msgstr "" -#: library/os.rst:878 +#: library/os.rst:910 msgid "" "These functions operate on I/O streams referenced using file descriptors." msgstr "" -#: library/os.rst:880 +#: library/os.rst:912 msgid "" "File descriptors are small integers corresponding to a file that has been " "opened by the current process. For example, standard input is usually file " @@ -937,7 +963,7 @@ msgid "" "pipes are also referenced by file descriptors." msgstr "" -#: library/os.rst:887 +#: library/os.rst:919 msgid "" "The :meth:`~io.IOBase.fileno` method can be used to obtain the file " "descriptor associated with a :term:`file object` when required. Note that " @@ -945,11 +971,11 @@ msgid "" "ignoring aspects such as internal buffering of data." msgstr "" -#: library/os.rst:895 +#: library/os.rst:927 msgid "Close file descriptor *fd*." msgstr "" -#: library/os.rst:899 +#: library/os.rst:931 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " @@ -957,28 +983,37 @@ msgid "" "`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" -#: library/os.rst:907 +#: library/os.rst:939 msgid "" "Close all file descriptors from *fd_low* (inclusive) to *fd_high* " "(exclusive), ignoring errors. Equivalent to (but much faster than)::" msgstr "" -#: library/os.rst:919 +#: library/os.rst:942 +msgid "" +"for fd in range(fd_low, fd_high):\n" +" try:\n" +" os.close(fd)\n" +" except OSError:\n" +" pass" +msgstr "" + +#: library/os.rst:951 msgid "" "Copy *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " -"If *offset_src* is None, then *src* is read from the current position; " +"If *offset_src* is ``None``, then *src* is read from the current position; " "respectively for *offset_dst*." msgstr "" -#: library/os.rst:924 +#: library/os.rst:956 msgid "" -"In Linux kernel older than 5.3, the files pointed by *src* and *dst* must " +"In Linux kernel older than 5.3, the files pointed to by *src* and *dst* must " "reside in the same filesystem, otherwise an :exc:`OSError` is raised with :" "attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: library/os.rst:928 +#: library/os.rst:960 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -988,19 +1023,19 @@ msgid "" "(in the case of NFS)." msgstr "" -#: library/os.rst:935 +#: library/os.rst:967 msgid "" "The function copies bytes between two file descriptors. Text options, like " "the encoding and the line ending, are ignored." msgstr "" -#: library/os.rst:938 +#: library/os.rst:970 msgid "" "The return value is the amount of bytes copied. This could be less than the " "amount requested." msgstr "" -#: library/os.rst:943 +#: library/os.rst:975 msgid "" "On Linux, :func:`os.copy_file_range` should not be used for copying a range " "of a pseudo file from a special filesystem like procfs and sysfs. It will " @@ -1008,47 +1043,39 @@ msgid "" "known Linux kernel issue." msgstr "" -#: library/os.rst:948 -msgid ":ref:`Availability `: Linux >= 4.5 with glibc >= 2.27." -msgstr "" - -#: library/os.rst:955 +#: library/os.rst:987 msgid "" "Return a string describing the encoding of the device associated with *fd* " "if it is connected to a terminal; else return :const:`None`." msgstr "" -#: library/os.rst:958 +#: library/os.rst:990 msgid "" "On Unix, if the :ref:`Python UTF-8 Mode ` is enabled, return " "``'UTF-8'`` rather than the device encoding." msgstr "" -#: library/os.rst:961 +#: library/os.rst:993 msgid "On Unix, the function now implements the Python UTF-8 Mode." msgstr "" -#: library/os.rst:967 +#: library/os.rst:999 msgid "" "Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" "`non-inheritable `." msgstr "" -#: library/os.rst:970 +#: library/os.rst:1002 msgid "" "On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: " "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: library/os.rst:987 -msgid ":ref:`Availability `: not WASI." -msgstr "" - -#: library/os.rst:1244 +#: library/os.rst:1293 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: library/os.rst:982 +#: library/os.rst:1014 msgid "" "Duplicate file descriptor *fd* to *fd2*, closing the latter first if " "necessary. Return *fd2*. The new file descriptor is :ref:`inheritable " @@ -1056,58 +1083,62 @@ msgid "" "``False``." msgstr "" -#: library/os.rst:989 +#: library/os.rst:1021 msgid "Add the optional *inheritable* parameter." msgstr "" -#: library/os.rst:992 +#: library/os.rst:1024 msgid "Return *fd2* on success. Previously, ``None`` was always returned." msgstr "" -#: library/os.rst:998 +#: library/os.rst:1030 msgid "" "Change the mode of the file given by *fd* to the numeric *mode*. See the " "docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, " "this is equivalent to ``os.chmod(fd, mode)``." msgstr "" -#: library/os.rst:2069 library/os.rst:2166 +#: library/os.rst:2209 library/os.rst:2310 msgid "" "Raises an :ref:`auditing event ` ``os.chmod`` with arguments " "``path``, ``mode``, ``dir_fd``." msgstr "" -#: library/os.rst:1021 library/os.rst:1651 library/os.rst:2095 -#: library/os.rst:3377 +#: library/os.rst:1056 library/os.rst:1759 library/os.rst:2239 +#: library/os.rst:3535 msgid "" -"The function is limited on Emscripten and WASI, see :ref:`wasm-availability` " -"for more information." +"The function is limited on WASI, see :ref:`wasm-availability` for more " +"information." +msgstr "" + +#: library/os.rst:2317 +msgid "Added support on Windows." msgstr "" -#: library/os.rst:1012 +#: library/os.rst:1047 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " "and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" "`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." msgstr "" -#: library/os.rst:2091 library/os.rst:2179 +#: library/os.rst:2235 library/os.rst:2326 msgid "" "Raises an :ref:`auditing event ` ``os.chown`` with arguments " "``path``, ``uid``, ``gid``, ``dir_fd``." msgstr "" -#: library/os.rst:1027 +#: library/os.rst:1062 msgid "" "Force write of file with filedescriptor *fd* to disk. Does not force update " "of metadata." msgstr "" -#: library/os.rst:1033 +#: library/os.rst:1068 msgid "This function is not available on MacOS." msgstr "" -#: library/os.rst:1038 +#: library/os.rst:1073 msgid "" "Return system configuration information relevant to an open file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -1118,7 +1149,7 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: library/os.rst:2491 +#: library/os.rst:2646 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -1126,87 +1157,98 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: library/os.rst:1051 +#: library/os.rst:1086 msgid "As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``." msgstr "" -#: library/os.rst:1058 +#: library/os.rst:1093 msgid "" "Get the status of the file descriptor *fd*. Return a :class:`stat_result` " "object." msgstr "" -#: library/os.rst:1061 +#: library/os.rst:1096 msgid "As of Python 3.3, this is equivalent to ``os.stat(fd)``." msgstr "" -#: library/os.rst:2326 +#: library/os.rst:2474 msgid "The :func:`.stat` function." msgstr "" -#: library/os.rst:1070 +#: library/os.rst:1105 msgid "" "Return information about the filesystem containing the file associated with " "file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is " "equivalent to ``os.statvfs(fd)``." msgstr "" -#: library/os.rst:1079 +#: library/os.rst:1114 msgid "" "Force write of file with filedescriptor *fd* to disk. On Unix, this calls " "the native :c:func:`!fsync` function; on Windows, the MS :c:func:`!_commit` " "function." msgstr "" -#: library/os.rst:1082 +#: library/os.rst:1117 msgid "" "If you're starting with a buffered Python :term:`file object` *f*, first do " "``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all " "internal buffers associated with *f* are written to disk." msgstr "" -#: library/os.rst:1091 +#: library/os.rst:1126 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " "most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." "truncate(fd, length)``." msgstr "" -#: library/os.rst:1095 +#: library/os.rst:1130 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." msgstr "" -#: library/os.rst:3416 +#: library/os.rst:3574 msgid "Added support for Windows" msgstr "" -#: library/os.rst:1105 +#: library/os.rst:1140 msgid "" "Get the blocking mode of the file descriptor: ``False`` if the :data:" "`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" -#: library/os.rst:1108 +#: library/os.rst:1143 msgid "See also :func:`set_blocking` and :meth:`socket.socket.setblocking`." msgstr "" -#: library/os.rst:1654 +#: library/os.rst:1762 msgid "On Windows, this function is limited to pipes." msgstr "" -#: library/os.rst:1658 +#: library/os.rst:1766 msgid "Added support for pipes on Windows." msgstr "" -#: library/os.rst:1124 +#: library/os.rst:1160 +msgid "" +"Grant access to the slave pseudo-terminal device associated with the master " +"pseudo-terminal device to which the file descriptor *fd* refers. The file " +"descriptor *fd* is not closed upon failure." +msgstr "" + +#: library/os.rst:1164 +msgid "Calls the C standard library function :c:func:`grantpt`." +msgstr "" + +#: library/os.rst:1173 msgid "" "Return ``True`` if the file descriptor *fd* is open and connected to a tty(-" "like) device, else ``False``." msgstr "" -#: library/os.rst:1130 +#: library/os.rst:1179 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " "open file descriptor. *cmd* specifies the command to use - one of :data:" @@ -1214,129 +1256,125 @@ msgid "" "specifies the section of the file to lock." msgstr "" -#: library/os.rst:1136 +#: library/os.rst:1185 msgid "" "Raises an :ref:`auditing event ` ``os.lockf`` with arguments " "``fd``, ``cmd``, ``len``." msgstr "" -#: library/os.rst:1148 +#: library/os.rst:1197 msgid "Flags that specify what action :func:`lockf` will take." msgstr "" -#: library/os.rst:1157 +#: library/os.rst:1206 msgid "" "Prepare the tty of which fd is a file descriptor for a new login session. " "Make the calling process a session leader; make the tty the controlling tty, " "the stdin, the stdout, and the stderr of the calling process; close fd." msgstr "" -#: library/os.rst:1168 +#: library/os.rst:1217 msgid "" "Set the current position of file descriptor *fd* to position *pos*, modified " "by *whence*, and return the new position in bytes relative to the start of " "the file. Valid values for *whence* are:" msgstr "" -#: library/os.rst:1173 +#: library/os.rst:1222 msgid "" ":const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file" msgstr "" -#: library/os.rst:1174 +#: library/os.rst:1223 msgid "" ":const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position" msgstr "" -#: library/os.rst:1175 +#: library/os.rst:1224 msgid ":const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file" msgstr "" -#: library/os.rst:1176 +#: library/os.rst:1225 msgid "" ":const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*" msgstr "" -#: library/os.rst:1177 +#: library/os.rst:1226 msgid "" ":const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*" msgstr "" -#: library/os.rst:1181 +#: library/os.rst:1230 msgid "Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`." msgstr "" -#: library/os.rst:1188 +#: library/os.rst:1237 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for whence to adjust the " "file position indicator." msgstr "" -#: library/os.rst:1192 +#: library/os.rst:1241 msgid ":const:`SEEK_SET`" msgstr "" -#: library/os.rst:1193 +#: library/os.rst:1242 msgid "Adjust the file position relative to the beginning of the file." msgstr "" -#: library/os.rst:1194 +#: library/os.rst:1243 msgid ":const:`SEEK_CUR`" msgstr "" -#: library/os.rst:1195 +#: library/os.rst:1244 msgid "Adjust the file position relative to the current file position." msgstr "" -#: library/os.rst:1197 +#: library/os.rst:1245 msgid ":const:`SEEK_END`" msgstr "" -#: library/os.rst:1197 +#: library/os.rst:1246 msgid "Adjust the file position relative to the end of the file." msgstr "" -#: library/os.rst:1199 +#: library/os.rst:1248 msgid "Their values are 0, 1, and 2, respectively." msgstr "" -#: library/os.rst:1205 +#: library/os.rst:1254 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for seeking file data and " "holes on sparsely allocated files." msgstr "" -#: library/os.rst:1211 +#: library/os.rst:1258 msgid ":data:`!SEEK_DATA`" msgstr "" -#: library/os.rst:1210 +#: library/os.rst:1259 msgid "" "Adjust the file offset to the next location containing data, relative to the " "seek position." msgstr "" -#: library/os.rst:1216 +#: library/os.rst:1262 msgid ":data:`!SEEK_HOLE`" msgstr "" -#: library/os.rst:1214 +#: library/os.rst:1263 msgid "" "Adjust the file offset to the next location containing a hole, relative to " "the seek position. A hole is defined as a sequence of zeros." msgstr "" -#: library/os.rst:1220 +#: library/os.rst:1269 msgid "These operations only make sense for filesystems that support them." msgstr "" -#: library/os.rst:1222 -msgid ":ref:`Availability `: Linux >= 3.1, macOS, Unix" -msgstr "" - -#: library/os.rst:1229 +#: library/os.rst:1278 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " "its mode according to *mode*. When computing *mode*, the current umask " @@ -1344,7 +1382,7 @@ msgid "" "file. The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: library/os.rst:1234 +#: library/os.rst:1283 msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " @@ -1352,19 +1390,19 @@ msgid "" "const:`O_BINARY` is needed to open files in binary mode." msgstr "" -#: library/os.rst:1239 +#: library/os.rst:1288 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: library/os.rst:1242 +#: library/os.rst:1291 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." msgstr "" -#: library/os.rst:1249 +#: library/os.rst:1298 msgid "" "This function is intended for low-level I/O. For normal usage, use the " "built-in function :func:`open`, which returns a :term:`file object` with :" @@ -1372,27 +1410,27 @@ msgid "" "a file descriptor in a file object, use :func:`fdopen`." msgstr "" -#: library/os.rst:2331 library/os.rst:2435 library/os.rst:2538 -#: library/os.rst:2675 library/os.rst:3432 +#: library/os.rst:2479 library/os.rst:2590 library/os.rst:2693 +#: library/os.rst:2830 library/os.rst:3590 msgid "Added the *dir_fd* parameter." msgstr "" -#: library/os.rst:1576 library/os.rst:4790 +#: library/os.rst:1657 library/os.rst:5182 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" "exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: library/os.rst:1963 library/os.rst:2026 library/os.rst:2112 -#: library/os.rst:2170 library/os.rst:2242 library/os.rst:2370 -#: library/os.rst:2438 library/os.rst:2501 library/os.rst:2590 -#: library/os.rst:2968 library/os.rst:3419 library/os.rst:3475 -#: library/os.rst:3635 library/os.rst:3999 library/os.rst:4552 +#: library/os.rst:2102 library/os.rst:2165 library/os.rst:2256 +#: library/os.rst:2314 library/os.rst:2390 library/os.rst:2522 +#: library/os.rst:2593 library/os.rst:2656 library/os.rst:2745 +#: library/os.rst:3123 library/os.rst:3577 library/os.rst:3633 +#: library/os.rst:3794 library/os.rst:4371 library/os.rst:4940 msgid "Accepts a :term:`path-like object`." msgstr "" -#: library/os.rst:1265 +#: library/os.rst:1314 msgid "" "The following constants are options for the *flags* parameter to the :func:" "`~os.open` function. They can be combined using the bitwise OR operator ``|" @@ -1402,45 +1440,45 @@ msgid "" "on Windows." msgstr "" -#: library/os.rst:1280 +#: library/os.rst:1329 msgid "The above constants are available on Unix and Windows." msgstr "" -#: library/os.rst:1291 +#: library/os.rst:1340 msgid "The above constants are only available on Unix." msgstr "" -#: library/os.rst:1293 +#: library/os.rst:1342 msgid "Add :data:`O_CLOEXEC` constant." msgstr "" -#: library/os.rst:1304 +#: library/os.rst:1353 msgid "The above constants are only available on Windows." msgstr "" -#: library/os.rst:1311 +#: library/os.rst:1360 msgid "The above constants are only available on macOS." msgstr "" -#: library/os.rst:1313 +#: library/os.rst:1362 msgid "" "Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" "`O_NOFOLLOW_ANY` constants." msgstr "" -#: library/os.rst:1327 +#: library/os.rst:1376 msgid "" "The above constants are extensions and not present if they are not defined " "by the C library." msgstr "" -#: library/os.rst:1330 +#: library/os.rst:1379 msgid "" "Add :data:`O_PATH` on systems that support it. Add :data:`O_TMPFILE`, only " "available on Linux Kernel 3.11 or newer." msgstr "" -#: library/os.rst:1340 +#: library/os.rst:1389 msgid "" "Open a new pseudo-terminal pair. Return a pair of file descriptors " "``(master, slave)`` for the pty and the tty, respectively. The new file " @@ -1448,18 +1486,18 @@ msgid "" "more portable approach, use the :mod:`pty` module." msgstr "" -#: library/os.rst:1359 +#: library/os.rst:1408 msgid "The new file descriptors are now non-inheritable." msgstr "" -#: library/os.rst:1353 +#: library/os.rst:1402 msgid "" "Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for " "reading and writing, respectively. The new file descriptor is :ref:`non-" "inheritable `." msgstr "" -#: library/os.rst:1365 +#: library/os.rst:1414 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " "ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" @@ -1467,17 +1505,13 @@ msgid "" "and writing, respectively." msgstr "" -#: library/os.rst:1378 +#: library/os.rst:1427 msgid "" "Ensures that enough disk space is allocated for the file specified by *fd* " "starting from *offset* and continuing for *len* bytes." msgstr "" -#: library/os.rst:1381 -msgid ":ref:`Availability `: Unix, not Emscripten." -msgstr "" - -#: library/os.rst:1388 +#: library/os.rst:1437 msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " @@ -1488,25 +1522,43 @@ msgid "" "`POSIX_FADV_DONTNEED`." msgstr "" -#: library/os.rst:1408 +#: library/os.rst:1457 msgid "" "Flags that can be used in *advice* in :func:`posix_fadvise` that specify the " "access pattern that is likely to be used." msgstr "" -#: library/os.rst:1418 +#: library/os.rst:1467 msgid "" "Read at most *n* bytes from file descriptor *fd* at a position of *offset*, " "leaving the file offset unchanged." msgstr "" -#: library/os.rst:1565 +#: library/os.rst:1646 msgid "" "Return a bytestring containing the bytes read. If the end of the file " "referred to by *fd* has been reached, an empty bytes object is returned." msgstr "" -#: library/os.rst:1431 +#: library/os.rst:1480 +msgid "Open and return a file descriptor for a master pseudo-terminal device." +msgstr "" + +#: library/os.rst:1482 +msgid "" +"Calls the C standard library function :c:func:`posix_openpt`. The *oflag* " +"argument is used to set file status flags and file access modes as specified " +"in the manual page of :c:func:`posix_openpt` of your system." +msgstr "" + +#: library/os.rst:1486 +msgid "" +"The returned file descriptor is :ref:`non-inheritable `. If " +"the value :data:`O_CLOEXEC` is available on the system, it is added to " +"*oflag*." +msgstr "" + +#: library/os.rst:1497 msgid "" "Read from a file descriptor *fd* at a position of *offset* into mutable :" "term:`bytes-like objects ` *buffers*, leaving the file " @@ -1514,136 +1566,132 @@ msgid "" "move on to the next buffer in the sequence to hold the rest of the data." msgstr "" -#: library/os.rst:1506 +#: library/os.rst:1587 msgid "" "The flags argument contains a bitwise OR of zero or more of the following " "flags:" msgstr "" -#: library/os.rst:1439 +#: library/os.rst:1505 msgid ":data:`RWF_HIPRI`" msgstr "" -#: library/os.rst:1440 +#: library/os.rst:1506 msgid ":data:`RWF_NOWAIT`" msgstr "" -#: library/os.rst:1702 +#: library/os.rst:1829 msgid "" "Return the total number of bytes actually read which can be less than the " "total capacity of all the objects." msgstr "" -#: library/os.rst:1515 library/os.rst:1767 +#: library/os.rst:1596 library/os.rst:1907 msgid "" "The operating system may set a limit (:func:`sysconf` value " "``'SC_IOV_MAX'``) on the number of buffers that can be used." msgstr "" -#: library/os.rst:1448 +#: library/os.rst:1514 msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: library/os.rst:1520 -msgid "" -":ref:`Availability `: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD " -">= 2.7, AIX >= 7.1." -msgstr "" - -#: library/os.rst:1522 +#: library/os.rst:1603 msgid "Using flags requires Linux >= 4.6." msgstr "" -#: library/os.rst:1459 +#: library/os.rst:1525 msgid "" "Do not wait for data which is not immediately available. If this flag is " "specified, the system call will return instantly if it would have to read " "data from the backing storage or wait for a lock." msgstr "" -#: library/os.rst:1463 +#: library/os.rst:1529 msgid "" "If some data was successfully read, it will return the number of bytes read. " "If no bytes were read, it will return ``-1`` and set errno to :const:`errno." "EAGAIN`." msgstr "" -#: library/os.rst:1467 -msgid ":ref:`Availability `: Linux >= 4.14." -msgstr "" - -#: library/os.rst:1474 +#: library/os.rst:1540 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " "the device, which provides lower latency, but may use additional resources." msgstr "" -#: library/os.rst:1478 +#: library/os.rst:1544 msgid "" "Currently, on Linux, this feature is usable only on a file descriptor opened " "using the :data:`O_DIRECT` flag." msgstr "" -#: library/os.rst:1481 -msgid ":ref:`Availability `: Linux >= 4.6." +#: library/os.rst:1554 +msgid "" +"Return the name of the slave pseudo-terminal device associated with the " +"master pseudo-terminal device to which the file descriptor *fd* refers. The " +"file descriptor *fd* is not closed upon failure." +msgstr "" + +#: library/os.rst:1558 +msgid "" +"Calls the reentrant C standard library function :c:func:`ptsname_r` if it is " +"available; otherwise, the C standard library function :c:func:`ptsname`, " +"which is not guaranteed to be thread-safe, is called." msgstr "" -#: library/os.rst:1488 +#: library/os.rst:1569 msgid "" "Write the bytestring in *str* to file descriptor *fd* at position of " "*offset*, leaving the file offset unchanged." msgstr "" -#: library/os.rst:1742 +#: library/os.rst:1882 msgid "Return the number of bytes actually written." msgstr "" -#: library/os.rst:1500 +#: library/os.rst:1581 msgid "" -"Write the *buffers* contents to file descriptor *fd* at a offset *offset*, " +"Write the *buffers* contents to file descriptor *fd* at an offset *offset*, " "leaving the file offset unchanged. *buffers* must be a sequence of :term:" "`bytes-like objects `. Buffers are processed in array " "order. Entire contents of the first buffer is written before proceeding to " "the second, and so on." msgstr "" -#: library/os.rst:1509 +#: library/os.rst:1590 msgid ":data:`RWF_DSYNC`" msgstr "" -#: library/os.rst:1510 +#: library/os.rst:1591 msgid ":data:`RWF_SYNC`" msgstr "" -#: library/os.rst:1511 +#: library/os.rst:1592 msgid ":data:`RWF_APPEND`" msgstr "" -#: library/os.rst:1513 +#: library/os.rst:1594 msgid "Return the total number of bytes actually written." msgstr "" -#: library/os.rst:1518 +#: library/os.rst:1599 msgid "Combine the functionality of :func:`os.writev` and :func:`os.pwrite`." msgstr "" -#: library/os.rst:1529 +#: library/os.rst:1610 msgid "" "Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: library/os.rst:1542 -msgid ":ref:`Availability `: Linux >= 4.7." -msgstr "" - -#: library/os.rst:1539 +#: library/os.rst:1620 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: library/os.rst:1549 +#: library/os.rst:1630 msgid "" "Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open` flag. " "This flag is meaningful only for :func:`os.pwritev`, and its effect applies " @@ -1653,15 +1701,11 @@ msgid "" "*offset* is updated." msgstr "" -#: library/os.rst:1556 -msgid ":ref:`Availability `: Linux >= 4.16." -msgstr "" - -#: library/os.rst:1563 +#: library/os.rst:1644 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" -#: library/os.rst:1570 +#: library/os.rst:1651 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " @@ -1670,26 +1714,57 @@ msgid "" "`~file.readline` methods." msgstr "" -#: library/os.rst:1585 +#: library/os.rst:1665 +msgid "" +"Read from a file descriptor *fd* into a mutable :ref:`buffer object " +"` *buffer*." +msgstr "" + +#: library/os.rst:1668 +msgid "" +"The *buffer* should be mutable and :term:`bytes-like `. " +"On success, returns the number of bytes read. Less bytes may be read than " +"the size of the buffer. The underlying system call will be retried when " +"interrupted by a signal, unless the signal handler raises an exception. " +"Other errors will not be retried and an error will be raised." +msgstr "" + +#: library/os.rst:1674 +msgid "" +"Returns 0 if *fd* is at end of file or if the provided *buffer* has length 0 " +"(which can be used to check for errors without reading data). Never returns " +"negative." +msgstr "" + +#: library/os.rst:1680 +msgid "" +"This function is intended for low-level I/O and must be applied to a file " +"descriptor as returned by :func:`os.open` or :func:`os.pipe`. To read a " +"\"file object\" returned by the built-in function :func:`open`, or :data:" +"`sys.stdin`, use its member functions, for example :meth:`io.BufferedIOBase." +"readinto`, :meth:`io.BufferedIOBase.read`, or :meth:`io.TextIOBase.read`" +msgstr "" + +#: library/os.rst:1693 msgid "" "Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd* " "starting at *offset*. Return the number of bytes sent. When EOF is reached " "return ``0``." msgstr "" -#: library/os.rst:1589 +#: library/os.rst:1697 msgid "" "The first function notation is supported by all platforms that define :func:" "`sendfile`." msgstr "" -#: library/os.rst:1592 +#: library/os.rst:1700 msgid "" "On Linux, if *offset* is given as ``None``, the bytes are read from the " "current position of *in_fd* and the position of *in_fd* is updated." msgstr "" -#: library/os.rst:1595 +#: library/os.rst:1703 msgid "" "The second case may be used on macOS and FreeBSD where *headers* and " "*trailers* are arbitrary sequences of buffers that are written before and " @@ -1697,70 +1772,101 @@ msgid "" "case." msgstr "" -#: library/os.rst:1599 +#: library/os.rst:1707 msgid "" "On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until " "the end of *in_fd* is reached." msgstr "" -#: library/os.rst:1602 +#: library/os.rst:1710 msgid "" "All platforms support sockets as *out_fd* file descriptor, and some " "platforms allow other types (e.g. regular file, pipe) as well." msgstr "" -#: library/os.rst:1605 +#: library/os.rst:1713 msgid "" "Cross-platform applications should not use *headers*, *trailers* and *flags* " "arguments." msgstr "" -#: library/os.rst:1612 +#: library/os.rst:1720 msgid "" "For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." "sendfile`." msgstr "" -#: library/os.rst:1617 +#: library/os.rst:1725 msgid "Parameters *out* and *in* was renamed to *out_fd* and *in_fd*." msgstr "" -#: library/os.rst:1625 +#: library/os.rst:1733 msgid "" "Parameters to the :func:`sendfile` function, if the implementation supports " "them." msgstr "" -#: library/os.rst:1634 +#: library/os.rst:1742 msgid "" "Parameter to the :func:`sendfile` function, if the implementation supports " "it. The data won't be cached in the virtual memory and will be freed " "afterwards." msgstr "" -#: library/os.rst:1644 +#: library/os.rst:1752 msgid "" "Set the blocking mode of the specified file descriptor. Set the :data:" "`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." msgstr "" -#: library/os.rst:1647 +#: library/os.rst:1755 msgid "See also :func:`get_blocking` and :meth:`socket.socket.setblocking`." msgstr "" -#: library/os.rst:1664 +#: library/os.rst:1772 msgid "" "Transfer *count* bytes from file descriptor *src*, starting from offset " -"*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " +"*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*." +msgstr "" + +#: library/os.rst:1775 +msgid "" +"The splicing behaviour can be modified by specifying a *flags* value. Any of " +"the following variables may used, combined using bitwise OR (the ``|`` " +"operator):" +msgstr "" + +#: library/os.rst:1779 +msgid "" +"If :const:`SPLICE_F_MOVE` is specified, the kernel is asked to move pages " +"instead of copying, but pages may still be copied if the kernel cannot move " +"the pages from the pipe." +msgstr "" + +#: library/os.rst:1783 +msgid "" +"If :const:`SPLICE_F_NONBLOCK` is specified, the kernel is asked to not block " +"on I/O. This makes the splice pipe operations nonblocking, but splice may " +"nevertheless block because the spliced file descriptors may block." +msgstr "" + +#: library/os.rst:1788 +msgid "" +"If :const:`SPLICE_F_MORE` is specified, it hints to the kernel that more " +"data will be coming in a subsequent splice." +msgstr "" + +#: library/os.rst:1791 +msgid "" "At least one of the file descriptors must refer to a pipe. If *offset_src* " -"is None, then *src* is read from the current position; respectively for " +"is ``None``, then *src* is read from the current position; respectively for " "*offset_dst*. The offset associated to the file descriptor that refers to a " -"pipe must be ``None``. The files pointed by *src* and *dst* must reside in " -"the same filesystem, otherwise an :exc:`OSError` is raised with :attr:" +"pipe must be ``None``. The files pointed to by *src* and *dst* must reside " +"in the same filesystem, otherwise an :exc:`OSError` is raised with :attr:" "`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: library/os.rst:1673 +#: library/os.rst:1798 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1768,7 +1874,7 @@ msgid "" "files are opened as binary." msgstr "" -#: library/os.rst:1678 +#: library/os.rst:1803 msgid "" "Upon successful completion, returns the number of bytes spliced to or from " "the pipe. A return value of 0 means end of input. If *src* refers to a pipe, " @@ -1777,11 +1883,11 @@ msgid "" "the pipe." msgstr "" -#: library/os.rst:1684 -msgid ":ref:`Availability `: Linux >= 2.6.17 with glibc >= 2.5" +#: library/os.rst:1809 +msgid "The :manpage:`splice(2)` man page." msgstr "" -#: library/os.rst:1697 +#: library/os.rst:1824 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " "objects ` *buffers*. Transfer data into each buffer until " @@ -1789,34 +1895,41 @@ msgid "" "rest of the data." msgstr "" -#: library/os.rst:1715 +#: library/os.rst:1842 msgid "" "Return the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`)." msgstr "" -#: library/os.rst:1726 -msgid ":ref:`Availability `: Unix, not WASI." -msgstr "" - -#: library/os.rst:1723 +#: library/os.rst:1850 msgid "" "Set the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`) to *pg*." msgstr "" -#: library/os.rst:1731 +#: library/os.rst:1858 msgid "" "Return a string which specifies the terminal device associated with file " "descriptor *fd*. If *fd* is not associated with a terminal device, an " "exception is raised." msgstr "" -#: library/os.rst:1740 +#: library/os.rst:1867 +msgid "" +"Unlock the slave pseudo-terminal device associated with the master pseudo-" +"terminal device to which the file descriptor *fd* refers. The file " +"descriptor *fd* is not closed upon failure." +msgstr "" + +#: library/os.rst:1871 +msgid "Calls the C standard library function :c:func:`unlockpt`." +msgstr "" + +#: library/os.rst:1880 msgid "Write the bytestring in *str* to file descriptor *fd*." msgstr "" -#: library/os.rst:1746 +#: library/os.rst:1886 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " @@ -1825,7 +1938,7 @@ msgid "" "its :meth:`~file.write` method." msgstr "" -#: library/os.rst:1760 +#: library/os.rst:1900 msgid "" "Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a " "sequence of :term:`bytes-like objects `. Buffers are " @@ -1833,70 +1946,70 @@ msgid "" "before proceeding to the second, and so on." msgstr "" -#: library/os.rst:1765 +#: library/os.rst:1905 msgid "Returns the total number of bytes actually written." msgstr "" -#: library/os.rst:1778 +#: library/os.rst:1918 msgid "Querying the size of a terminal" msgstr "" -#: library/os.rst:1784 +#: library/os.rst:1924 msgid "" "Return the size of the terminal window as ``(columns, lines)``, tuple of " "type :class:`terminal_size`." msgstr "" -#: library/os.rst:1787 +#: library/os.rst:1927 msgid "" "The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard output) " "specifies which file descriptor should be queried." msgstr "" -#: library/os.rst:1790 +#: library/os.rst:1930 msgid "" "If the file descriptor is not connected to a terminal, an :exc:`OSError` is " "raised." msgstr "" -#: library/os.rst:1793 +#: library/os.rst:1933 msgid "" ":func:`shutil.get_terminal_size` is the high-level function which should " "normally be used, ``os.get_terminal_size`` is the low-level implementation." msgstr "" -#: library/os.rst:1801 +#: library/os.rst:1941 msgid "" "A subclass of tuple, holding ``(columns, lines)`` of the terminal window " "size." msgstr "" -#: library/os.rst:1805 +#: library/os.rst:1945 msgid "Width of the terminal window in characters." msgstr "" -#: library/os.rst:1809 +#: library/os.rst:1949 msgid "Height of the terminal window in characters." msgstr "" -#: library/os.rst:1815 +#: library/os.rst:1955 msgid "Inheritance of File Descriptors" msgstr "" -#: library/os.rst:1819 +#: library/os.rst:1959 msgid "" "A file descriptor has an \"inheritable\" flag which indicates if the file " "descriptor can be inherited by child processes. Since Python 3.4, file " "descriptors created by Python are non-inheritable by default." msgstr "" -#: library/os.rst:1823 +#: library/os.rst:1963 msgid "" "On UNIX, non-inheritable file descriptors are closed in child processes at " "the execution of a new program, other file descriptors are inherited." msgstr "" -#: library/os.rst:1826 +#: library/os.rst:1966 msgid "" "On Windows, non-inheritable handles and file descriptors are closed in child " "processes, except for standard streams (file descriptors 0, 1 and 2: stdin, " @@ -1907,55 +2020,48 @@ msgid "" "only inherited if the *close_fds* parameter is ``False``." msgstr "" -#: library/os.rst:1834 -msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, the file " -"descriptor cannot be modified." +#: library/os.rst:1974 +msgid "On WebAssembly platforms, the file descriptor cannot be modified." msgstr "" -#: library/os.rst:1839 +#: library/os.rst:1978 msgid "" "Get the \"inheritable\" flag of the specified file descriptor (a boolean)." msgstr "" -#: library/os.rst:1843 +#: library/os.rst:1982 msgid "Set the \"inheritable\" flag of the specified file descriptor." msgstr "" -#: library/os.rst:1847 +#: library/os.rst:1986 msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: library/os.rst:1855 library/os.rst:4587 library/os.rst:4632 -msgid ":ref:`Availability `: Windows." -msgstr "" - -#: library/os.rst:1853 +#: library/os.rst:1992 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" -#: library/os.rst:1861 +#: library/os.rst:2000 msgid "Files and Directories" msgstr "" -#: library/os.rst:1863 +#: library/os.rst:2002 msgid "" "On some Unix platforms, many of these functions support one or more of these " "features:" msgstr "" -#: library/os.rst:1868 +#: library/os.rst:2007 msgid "" "**specifying a file descriptor:** Normally the *path* argument provided to " "functions in the :mod:`os` module must be a string specifying a file path. " "However, some functions now alternatively accept an open file descriptor for " "their *path* argument. The function will then operate on the file referred " -"to by the descriptor. (For POSIX systems, Python will call the variant of " -"the function prefixed with ``f`` (e.g. call ``fchdir`` instead of " -"``chdir``).)" +"to by the descriptor. For POSIX systems, Python will call the variant of the " +"function prefixed with ``f`` (e.g. call ``fchdir`` instead of ``chdir``)." msgstr "" -#: library/os.rst:1876 +#: library/os.rst:2015 msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " @@ -1963,47 +2069,47 @@ msgid "" "`NotImplementedError`." msgstr "" -#: library/os.rst:1881 +#: library/os.rst:2020 msgid "" "If the function also supports *dir_fd* or *follow_symlinks* arguments, it's " "an error to specify one of those when supplying *path* as a file descriptor." msgstr "" -#: library/os.rst:1886 +#: library/os.rst:2025 msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " "operate on should be relative; path will then be relative to that " -"directory. If the path is absolute, *dir_fd* is ignored. (For POSIX " +"directory. If the path is absolute, *dir_fd* is ignored. For POSIX " "systems, Python will call the variant of the function with an ``at`` suffix " "and possibly prefixed with ``f`` (e.g. call ``faccessat`` instead of " "``access``)." msgstr "" -#: library/os.rst:1893 +#: library/os.rst:2032 msgid "" "You can check whether or not *dir_fd* is supported for a particular function " "on your platform using :data:`os.supports_dir_fd`. If it's unavailable, " "using it will raise a :exc:`NotImplementedError`." msgstr "" -#: library/os.rst:1899 +#: library/os.rst:2038 msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " "operate on the symbolic link itself rather than the file pointed to by the " -"link. (For POSIX systems, Python will call the ``l...`` variant of the " -"function.)" +"link. For POSIX systems, Python will call the ``l...`` variant of the " +"function." msgstr "" -#: library/os.rst:1905 +#: library/os.rst:2044 msgid "" "You can check whether or not *follow_symlinks* is supported for a particular " "function on your platform using :data:`os.supports_follow_symlinks`. If it's " "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: library/os.rst:1913 +#: library/os.rst:2052 msgid "" "Use the real uid/gid to test for access to *path*. Note that most " "operations will use the effective uid/gid, therefore this routine can be " @@ -2015,13 +2121,13 @@ msgid "" "manpage:`access(2)` for more information." msgstr "" -#: library/os.rst:1922 +#: library/os.rst:2061 msgid "" "This function can support specifying :ref:`paths relative to directory " "descriptors ` and :ref:`not following symlinks `." msgstr "" -#: library/os.rst:1925 +#: library/os.rst:2064 msgid "" "If *effective_ids* is ``True``, :func:`access` will perform its access " "checks using the effective uid/gid instead of the real uid/gid. " @@ -2030,7 +2136,7 @@ msgid "" "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: library/os.rst:1933 +#: library/os.rst:2072 msgid "" "Using :func:`access` to check if a user is authorized to e.g. open a file " "before actually doing so using :func:`open` creates a security hole, because " @@ -2039,278 +2145,304 @@ msgid "" "For example::" msgstr "" -#: library/os.rst:1944 +#: library/os.rst:2078 +msgid "" +"if os.access(\"myfile\", os.R_OK):\n" +" with open(\"myfile\") as fp:\n" +" return fp.read()\n" +"return \"some default data\"" +msgstr "" + +#: library/os.rst:2083 msgid "is better written as::" msgstr "" -#: library/os.rst:1956 +#: library/os.rst:2085 +msgid "" +"try:\n" +" fp = open(\"myfile\")\n" +"except PermissionError:\n" +" return \"some default data\"\n" +"else:\n" +" with fp:\n" +" return fp.read()" +msgstr "" + +#: library/os.rst:2095 msgid "" "I/O operations may fail even when :func:`access` indicates that they would " "succeed, particularly for operations on network filesystems which may have " "permissions semantics beyond the usual POSIX permission-bit model." msgstr "" -#: library/os.rst:1960 +#: library/os.rst:2099 msgid "Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters." msgstr "" -#: library/os.rst:1972 +#: library/os.rst:2111 msgid "" "Values to pass as the *mode* parameter of :func:`access` to test the " "existence, readability, writability and executability of *path*, " "respectively." msgstr "" -#: library/os.rst:1981 +#: library/os.rst:2120 msgid "Change the current working directory to *path*." msgstr "" -#: library/os.rst:1983 +#: library/os.rst:2122 msgid "" "This function can support :ref:`specifying a file descriptor `. " "The descriptor must refer to an opened directory, not an open file." msgstr "" -#: library/os.rst:1986 +#: library/os.rst:2125 msgid "" "This function can raise :exc:`OSError` and subclasses such as :exc:" "`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." msgstr "" -#: library/os.rst:2122 +#: library/os.rst:2266 msgid "" "Raises an :ref:`auditing event ` ``os.chdir`` with argument " "``path``." msgstr "" -#: library/os.rst:1991 +#: library/os.rst:2130 msgid "" "Added support for specifying *path* as a file descriptor on some platforms." msgstr "" -#: library/os.rst:2001 +#: library/os.rst:2140 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " "combination (bitwise OR) of the following values (as defined in the :mod:" "`stat` module):" msgstr "" -#: library/os.rst:2004 +#: library/os.rst:2143 msgid ":const:`stat.UF_NODUMP`" msgstr "" -#: library/os.rst:2005 +#: library/os.rst:2144 msgid ":const:`stat.UF_IMMUTABLE`" msgstr "" -#: library/os.rst:2006 +#: library/os.rst:2145 msgid ":const:`stat.UF_APPEND`" msgstr "" -#: library/os.rst:2007 +#: library/os.rst:2146 msgid ":const:`stat.UF_OPAQUE`" msgstr "" -#: library/os.rst:2008 +#: library/os.rst:2147 msgid ":const:`stat.UF_NOUNLINK`" msgstr "" -#: library/os.rst:2009 +#: library/os.rst:2148 msgid ":const:`stat.UF_COMPRESSED`" msgstr "" -#: library/os.rst:2010 +#: library/os.rst:2149 msgid ":const:`stat.UF_HIDDEN`" msgstr "" -#: library/os.rst:2011 +#: library/os.rst:2150 msgid ":const:`stat.SF_ARCHIVED`" msgstr "" -#: library/os.rst:2012 +#: library/os.rst:2151 msgid ":const:`stat.SF_IMMUTABLE`" msgstr "" -#: library/os.rst:2013 +#: library/os.rst:2152 msgid ":const:`stat.SF_APPEND`" msgstr "" -#: library/os.rst:2014 +#: library/os.rst:2153 msgid ":const:`stat.SF_NOUNLINK`" msgstr "" -#: library/os.rst:2015 +#: library/os.rst:2154 msgid ":const:`stat.SF_SNAPSHOT`" msgstr "" -#: library/os.rst:2017 +#: library/os.rst:2156 msgid "" "This function can support :ref:`not following symlinks `." msgstr "" -#: library/os.rst:2148 +#: library/os.rst:2292 msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." msgstr "" -#: library/os.rst:2023 +#: library/os.rst:2162 msgid "Added the *follow_symlinks* parameter." msgstr "" -#: library/os.rst:2032 +#: library/os.rst:2171 msgid "" "Change the mode of *path* to the numeric *mode*. *mode* may take one of the " "following values (as defined in the :mod:`stat` module) or bitwise ORed " "combinations of them:" msgstr "" -#: library/os.rst:2036 +#: library/os.rst:2175 msgid ":const:`stat.S_ISUID`" msgstr "" -#: library/os.rst:2037 +#: library/os.rst:2176 msgid ":const:`stat.S_ISGID`" msgstr "" -#: library/os.rst:2038 +#: library/os.rst:2177 msgid ":const:`stat.S_ENFMT`" msgstr "" -#: library/os.rst:2039 +#: library/os.rst:2178 msgid ":const:`stat.S_ISVTX`" msgstr "" -#: library/os.rst:2040 +#: library/os.rst:2179 msgid ":const:`stat.S_IREAD`" msgstr "" -#: library/os.rst:2041 +#: library/os.rst:2180 msgid ":const:`stat.S_IWRITE`" msgstr "" -#: library/os.rst:2042 +#: library/os.rst:2181 msgid ":const:`stat.S_IEXEC`" msgstr "" -#: library/os.rst:2043 +#: library/os.rst:2182 msgid ":const:`stat.S_IRWXU`" msgstr "" -#: library/os.rst:2044 +#: library/os.rst:2183 msgid ":const:`stat.S_IRUSR`" msgstr "" -#: library/os.rst:2045 +#: library/os.rst:2184 msgid ":const:`stat.S_IWUSR`" msgstr "" -#: library/os.rst:2046 +#: library/os.rst:2185 msgid ":const:`stat.S_IXUSR`" msgstr "" -#: library/os.rst:2047 +#: library/os.rst:2186 msgid ":const:`stat.S_IRWXG`" msgstr "" -#: library/os.rst:2048 +#: library/os.rst:2187 msgid ":const:`stat.S_IRGRP`" msgstr "" -#: library/os.rst:2049 +#: library/os.rst:2188 msgid ":const:`stat.S_IWGRP`" msgstr "" -#: library/os.rst:2050 +#: library/os.rst:2189 msgid ":const:`stat.S_IXGRP`" msgstr "" -#: library/os.rst:2051 +#: library/os.rst:2190 msgid ":const:`stat.S_IRWXO`" msgstr "" -#: library/os.rst:2052 +#: library/os.rst:2191 msgid ":const:`stat.S_IROTH`" msgstr "" -#: library/os.rst:2053 +#: library/os.rst:2192 msgid ":const:`stat.S_IWOTH`" msgstr "" -#: library/os.rst:2054 +#: library/os.rst:2193 msgid ":const:`stat.S_IXOTH`" msgstr "" -#: library/os.rst:2084 library/os.rst:3465 +#: library/os.rst:2228 library/os.rst:3623 msgid "" "This function can support :ref:`specifying a file descriptor `, :" "ref:`paths relative to directory descriptors ` and :ref:`not " "following symlinks `." msgstr "" -#: library/os.rst:2062 +#: library/os.rst:2201 msgid "" "Although Windows supports :func:`chmod`, you can only set the file's read-" "only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD`` constants " -"or a corresponding integer value). All other bits are ignored." +"or a corresponding integer value). All other bits are ignored. The default " +"value of *follow_symlinks* is ``False`` on Windows." msgstr "" -#: library/os.rst:2098 +#: library/os.rst:2242 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd* and *follow_symlinks* arguments." msgstr "" -#: library/os.rst:2081 +#: library/os.rst:2218 +msgid "" +"Added support for a file descriptor and the *follow_symlinks* argument on " +"Windows." +msgstr "" + +#: library/os.rst:2225 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. To " "leave one of the ids unchanged, set it to -1." msgstr "" -#: library/os.rst:2088 +#: library/os.rst:2232 msgid "" "See :func:`shutil.chown` for a higher-level function that accepts names in " "addition to numeric ids." msgstr "" -#: library/os.rst:2102 +#: library/os.rst:2246 msgid "Supports a :term:`path-like object`." msgstr "" -#: library/os.rst:2108 +#: library/os.rst:2252 msgid "Change the root directory of the current process to *path*." msgstr "" -#: library/os.rst:2118 +#: library/os.rst:2262 msgid "" "Change the current working directory to the directory represented by the " "file descriptor *fd*. The descriptor must refer to an opened directory, not " "an open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``." msgstr "" -#: library/os.rst:2129 +#: library/os.rst:2273 msgid "Return a string representing the current working directory." msgstr "" -#: library/os.rst:2134 +#: library/os.rst:2278 msgid "Return a bytestring representing the current working directory." msgstr "" -#: library/os.rst:2136 +#: library/os.rst:2280 msgid "" "The function now uses the UTF-8 encoding on Windows, rather than the ANSI " "code page: see :pep:`529` for the rationale. The function is no longer " "deprecated on Windows." msgstr "" -#: library/os.rst:2144 +#: library/os.rst:2288 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " "not follow symbolic links. As of Python 3.3, this is equivalent to ``os." "chflags(path, flags, follow_symlinks=False)``." msgstr "" -#: library/os.rst:2158 +#: library/os.rst:2302 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " @@ -2318,59 +2450,50 @@ msgid "" "chmod(path, mode, follow_symlinks=False)``." msgstr "" -#: library/os.rst:2163 +#: library/os.rst:2307 msgid "" "``lchmod()`` is not part of POSIX, but Unix implementations may have it if " "changing the mode of symbolic links is supported." msgstr "" -#: library/os.rst:2168 -msgid "" -":ref:`Availability `: Unix, not Linux, FreeBSD >= 1.3, NetBSD " -">= 1.3, not OpenBSD" -msgstr "" - -#: library/os.rst:2175 +#: library/os.rst:2322 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " "This function will not follow symbolic links. As of Python 3.3, this is " "equivalent to ``os.chown(path, uid, gid, follow_symlinks=False)``." msgstr "" -#: library/os.rst:2189 +#: library/os.rst:2336 msgid "Create a hard link pointing to *src* named *dst*." msgstr "" -#: library/os.rst:2191 +#: library/os.rst:2338 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `, and :ref:" -"`not following symlinks `." +"`not following symlinks `. The default value of " +"*follow_symlinks* is ``False`` on Windows." msgstr "" -#: library/os.rst:2195 +#: library/os.rst:2343 msgid "" "Raises an :ref:`auditing event ` ``os.link`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." msgstr "" -#: library/os.rst:2197 -msgid ":ref:`Availability `: Unix, Windows, not Emscripten." -msgstr "" - -#: library/os.rst:4249 +#: library/os.rst:4620 msgid "Added Windows support." msgstr "" -#: library/os.rst:2202 +#: library/os.rst:2350 msgid "Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* parameters." msgstr "" -#: library/os.rst:2622 library/os.rst:3387 +#: library/os.rst:2777 library/os.rst:3545 msgid "Accepts a :term:`path-like object` for *src* and *dst*." msgstr "" -#: library/os.rst:2211 +#: library/os.rst:2359 msgid "" "Return a list containing the names of the entries in the directory given by " "*path*. The list is in arbitrary order, and does not include the special " @@ -2379,7 +2502,7 @@ msgid "" "function, whether a name for that file be included is unspecified." msgstr "" -#: library/os.rst:2217 +#: library/os.rst:2365 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the " @@ -2387,41 +2510,41 @@ msgid "" "circumstances, they will be of type ``str``." msgstr "" -#: library/os.rst:2707 +#: library/os.rst:2862 msgid "" "This function can also support :ref:`specifying a file descriptor " "`; the file descriptor must refer to a directory." msgstr "" -#: library/os.rst:2225 +#: library/os.rst:2373 msgid "" "Raises an :ref:`auditing event ` ``os.listdir`` with argument " "``path``." msgstr "" -#: library/os.rst:2228 +#: library/os.rst:2376 msgid "To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`." msgstr "" -#: library/os.rst:2232 +#: library/os.rst:2380 msgid "" "The :func:`scandir` function returns directory entries along with file " "attribute information, giving better performance for many common use cases." msgstr "" -#: library/os.rst:2236 +#: library/os.rst:2384 msgid "The *path* parameter became optional." msgstr "" -#: library/os.rst:3246 +#: library/os.rst:3401 msgid "Added support for specifying *path* as an open file descriptor." msgstr "" -#: library/os.rst:2248 +#: library/os.rst:2396 msgid "Return a list containing the names of drives on a Windows system." msgstr "" -#: library/os.rst:2250 +#: library/os.rst:2398 msgid "" "A drive name typically looks like ``'C:\\\\'``. Not every drive name will be " "associated with a volume, and some may be inaccessible for a variety of " @@ -2429,26 +2552,22 @@ msgid "" "function does not test for access." msgstr "" -#: library/os.rst:2255 +#: library/os.rst:2403 msgid "May raise :exc:`OSError` if an error occurs collecting the drive names." msgstr "" -#: library/os.rst:2258 +#: library/os.rst:2406 msgid "" "Raises an :ref:`auditing event ` ``os.listdrives`` with no " "arguments." msgstr "" -#: library/os.rst:2284 library/os.rst:2304 -msgid ":ref:`Availability `: Windows" -msgstr "" - -#: library/os.rst:2267 +#: library/os.rst:2415 msgid "" "Return a list containing the mount points for a volume on a Windows system." msgstr "" -#: library/os.rst:2270 +#: library/os.rst:2418 msgid "" "*volume* must be represented as a GUID path, like those returned by :func:" "`os.listvolumes`. Volumes may be mounted in multiple locations or not at " @@ -2456,29 +2575,29 @@ msgid "" "associated with a volume will not be returned by this function." msgstr "" -#: library/os.rst:2276 +#: library/os.rst:2424 msgid "" "The mount points return by this function will be absolute paths, and may be " "longer than the drive name." msgstr "" -#: library/os.rst:2279 +#: library/os.rst:2427 msgid "" "Raises :exc:`OSError` if the volume is not recognized or if an error occurs " "collecting the paths." msgstr "" -#: library/os.rst:2282 +#: library/os.rst:2430 msgid "" "Raises an :ref:`auditing event ` ``os.listmounts`` with argument " "``volume``." msgstr "" -#: library/os.rst:2291 +#: library/os.rst:2439 msgid "Return a list containing the volumes in the system." msgstr "" -#: library/os.rst:2293 +#: library/os.rst:2441 msgid "" "Volumes are typically represented as a GUID path that looks like ``\\\\?" "\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\``. Files can usually be " @@ -2487,46 +2606,46 @@ msgid "" "function is to retrieve mount points using :func:`os.listmounts`." msgstr "" -#: library/os.rst:2300 +#: library/os.rst:2448 msgid "May raise :exc:`OSError` if an error occurs collecting the volumes." msgstr "" -#: library/os.rst:2302 +#: library/os.rst:2450 msgid "" "Raises an :ref:`auditing event ` ``os.listvolumes`` with no " "arguments." msgstr "" -#: library/os.rst:2311 +#: library/os.rst:2459 msgid "" "Perform the equivalent of an :c:func:`!lstat` system call on the given path. " "Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" "class:`stat_result` object." msgstr "" -#: library/os.rst:2315 +#: library/os.rst:2463 msgid "" "On platforms that do not support symbolic links, this is an alias for :func:" "`~os.stat`." msgstr "" -#: library/os.rst:2318 +#: library/os.rst:2466 msgid "" "As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd, " "follow_symlinks=False)``." msgstr "" -#: library/os.rst:2359 library/os.rst:2452 library/os.rst:2526 +#: library/os.rst:2511 library/os.rst:2607 library/os.rst:2681 msgid "" "This function can also support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: library/os.rst:2535 library/os.rst:3380 +#: library/os.rst:2690 library/os.rst:3538 msgid "Added support for Windows 6.0 (Vista) symbolic links." msgstr "" -#: library/os.rst:2337 +#: library/os.rst:2485 msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " @@ -2534,18 +2653,18 @@ msgid "" "stat`." msgstr "" -#: library/os.rst:2346 +#: library/os.rst:2494 msgid "Create a directory named *path* with numeric mode *mode*." msgstr "" -#: library/os.rst:2348 +#: library/os.rst:2496 msgid "" "If the directory already exists, :exc:`FileExistsError` is raised. If a " "parent directory in the path does not exist, :exc:`FileNotFoundError` is " "raised." msgstr "" -#: library/os.rst:2353 +#: library/os.rst:2501 msgid "" "On some systems, *mode* is ignored. Where it is used, the current umask " "value is first masked out. If bits other than the last 9 (i.e. the last 3 " @@ -2554,25 +2673,36 @@ msgid "" "call :func:`chmod` explicitly to set them." msgstr "" -#: library/os.rst:2362 +#: library/os.rst:2507 +msgid "" +"On Windows, a *mode* of ``0o700`` is specifically handled to apply access " +"control to the new directory such that only the current user and " +"administrators have access. Other values of *mode* are ignored." +msgstr "" + +#: library/os.rst:2514 msgid "" "It is also possible to create temporary directories; see the :mod:`tempfile` " "module's :func:`tempfile.mkdtemp` function." msgstr "" -#: library/os.rst:2399 +#: library/os.rst:2554 msgid "" "Raises an :ref:`auditing event ` ``os.mkdir`` with arguments " "``path``, ``mode``, ``dir_fd``." msgstr "" -#: library/os.rst:2380 +#: library/os.rst:2525 +msgid "Windows now handles a *mode* of ``0o700``." +msgstr "" + +#: library/os.rst:2535 msgid "" "Recursive directory creation function. Like :func:`mkdir`, but makes all " "intermediate-level directories needed to contain the leaf directory." msgstr "" -#: library/os.rst:2383 +#: library/os.rst:2538 msgid "" "The *mode* parameter is passed to :func:`mkdir` for creating the leaf " "directory; see :ref:`the mkdir() description ` for how it is " @@ -2581,27 +2711,27 @@ msgid "" "file permission bits of existing parent directories are not changed." msgstr "" -#: library/os.rst:2389 +#: library/os.rst:2544 msgid "" "If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is raised " "if the target directory already exists." msgstr "" -#: library/os.rst:2394 +#: library/os.rst:2549 msgid "" ":func:`makedirs` will become confused if the path elements to create " "include :data:`pardir` (eg. \"..\" on UNIX systems)." msgstr "" -#: library/os.rst:2397 +#: library/os.rst:2552 msgid "This function handles UNC paths correctly." msgstr "" -#: library/os.rst:2401 +#: library/os.rst:2556 msgid "Added the *exist_ok* parameter." msgstr "" -#: library/os.rst:2406 +#: library/os.rst:2561 msgid "" "Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" "func:`makedirs` would still raise an error if *mode* did not match the mode " @@ -2609,19 +2739,19 @@ msgid "" "safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" -#: library/os.rst:2414 +#: library/os.rst:2569 msgid "" "The *mode* argument no longer affects the file permission bits of newly " "created intermediate-level directories." msgstr "" -#: library/os.rst:2421 +#: library/os.rst:2576 msgid "" "Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The " "current umask value is first masked out from the mode." msgstr "" -#: library/os.rst:2427 +#: library/os.rst:2582 msgid "" "FIFOs are pipes that can be accessed like regular files. FIFOs exist until " "they are deleted (for example with :func:`os.unlink`). Generally, FIFOs are " @@ -2631,7 +2761,7 @@ msgid "" "rendezvous point." msgstr "" -#: library/os.rst:2444 +#: library/os.rst:2599 msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " @@ -2642,23 +2772,23 @@ msgid "" "`os.makedev`), otherwise it is ignored." msgstr "" -#: library/os.rst:2466 +#: library/os.rst:2621 msgid "" "Extract the device major number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: library/os.rst:2472 +#: library/os.rst:2627 msgid "" "Extract the device minor number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: library/os.rst:2478 +#: library/os.rst:2633 msgid "Compose a raw device number from the major and minor device numbers." msgstr "" -#: library/os.rst:2483 +#: library/os.rst:2638 msgid "" "Return system configuration information relevant to a named file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -2669,19 +2799,19 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: library/os.rst:3239 library/os.rst:3408 +#: library/os.rst:3394 library/os.rst:3566 msgid "" "This function can support :ref:`specifying a file descriptor `." msgstr "" -#: library/os.rst:2507 +#: library/os.rst:2662 msgid "" "Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` " "to the integer values defined for those names by the host operating system. " "This can be used to determine the set of names known to the system." msgstr "" -#: library/os.rst:2516 +#: library/os.rst:2671 msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " @@ -2689,7 +2819,7 @@ msgid "" "join(os.path.dirname(path), result)``." msgstr "" -#: library/os.rst:2521 +#: library/os.rst:2676 msgid "" "If the *path* is a string object (directly or indirectly through a :class:" "`PathLike` interface), the result will also be a string object, and the call " @@ -2697,41 +2827,41 @@ msgid "" "indirectly), the result will be a bytes object." msgstr "" -#: library/os.rst:2529 +#: library/os.rst:2684 msgid "" "When trying to resolve a path that may contain links, use :func:`~os.path." "realpath` to properly handle recursion and platform differences." msgstr "" -#: library/os.rst:2541 +#: library/os.rst:2696 msgid "Accepts a :term:`path-like object` on Unix." msgstr "" -#: library/os.rst:2544 +#: library/os.rst:2699 msgid "Accepts a :term:`path-like object` and a bytes object on Windows." msgstr "" -#: library/os.rst:2547 +#: library/os.rst:2702 msgid "" "Added support for directory junctions, and changed to return the " "substitution path (which typically includes ``\\\\?\\`` prefix) rather than " "the optional \"print name\" field that was previously returned." msgstr "" -#: library/os.rst:2553 +#: library/os.rst:2708 msgid "" "Remove (delete) the file *path*. If *path* is a directory, an :exc:" "`OSError` is raised. Use :func:`rmdir` to remove directories. If the file " "does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" -#: library/os.rst:2670 library/os.rst:3359 +#: library/os.rst:2825 library/os.rst:3517 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: library/os.rst:2560 +#: library/os.rst:2715 msgid "" "On Windows, attempting to remove a file that is in use causes an exception " "to be raised; on Unix, the directory entry is removed but the storage " @@ -2739,17 +2869,17 @@ msgid "" "longer in use." msgstr "" -#: library/os.rst:2564 +#: library/os.rst:2719 msgid "This function is semantically identical to :func:`unlink`." msgstr "" -#: library/os.rst:2588 library/os.rst:3430 +#: library/os.rst:2743 library/os.rst:3588 msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." msgstr "" -#: library/os.rst:2579 +#: library/os.rst:2734 msgid "" "Remove directories recursively. Works like :func:`rmdir` except that, if " "the leaf directory is successfully removed, :func:`removedirs` tries to " @@ -2761,20 +2891,20 @@ msgid "" "could not be successfully removed." msgstr "" -#: library/os.rst:2596 +#: library/os.rst:2751 msgid "" "Rename the file or directory *src* to *dst*. If *dst* exists, the operation " "will fail with an :exc:`OSError` subclass in a number of cases:" msgstr "" -#: library/os.rst:2599 +#: library/os.rst:2754 msgid "" "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. The " "operation may fail if *src* and *dst* are on different filesystems. Use :" "func:`shutil.move` to support moves to a different filesystem." msgstr "" -#: library/os.rst:2603 +#: library/os.rst:2758 msgid "" "On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" "`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " @@ -2786,29 +2916,29 @@ msgid "" "operation (this is a POSIX requirement)." msgstr "" -#: library/os.rst:2652 +#: library/os.rst:2807 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `." msgstr "" -#: library/os.rst:2615 +#: library/os.rst:2770 msgid "" "If you want cross-platform overwriting of the destination, use :func:" "`replace`." msgstr "" -#: library/os.rst:2638 library/os.rst:2655 +#: library/os.rst:2793 library/os.rst:2810 msgid "" "Raises an :ref:`auditing event ` ``os.rename`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." msgstr "" -#: library/os.rst:2619 +#: library/os.rst:2774 msgid "Added the *src_dir_fd* and *dst_dir_fd* parameters." msgstr "" -#: library/os.rst:2628 +#: library/os.rst:2783 msgid "" "Recursive directory or file renaming function. Works like :func:`rename`, " "except creation of any intermediate directories needed to make the new " @@ -2817,17 +2947,17 @@ msgid "" "using :func:`removedirs`." msgstr "" -#: library/os.rst:2635 +#: library/os.rst:2790 msgid "" "This function can fail with the new directory structure made if you lack " "permissions needed to remove the leaf directory or file." msgstr "" -#: library/os.rst:2640 +#: library/os.rst:2795 msgid "Accepts a :term:`path-like object` for *old* and *new*." msgstr "" -#: library/os.rst:2646 +#: library/os.rst:2801 msgid "" "Rename the file or directory *src* to *dst*. If *dst* is a non-empty " "directory, :exc:`OSError` will be raised. If *dst* exists and is a file, it " @@ -2836,7 +2966,7 @@ msgid "" "renaming will be an atomic operation (this is a POSIX requirement)." msgstr "" -#: library/os.rst:2665 +#: library/os.rst:2820 msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " "not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " @@ -2844,13 +2974,13 @@ msgid "" "rmtree` can be used." msgstr "" -#: library/os.rst:2673 +#: library/os.rst:2828 msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." msgstr "" -#: library/os.rst:2684 +#: library/os.rst:2839 msgid "" "Return an iterator of :class:`os.DirEntry` objects corresponding to the " "entries in the directory given by *path*. The entries are yielded in " @@ -2860,7 +2990,7 @@ msgid "" "unspecified." msgstr "" -#: library/os.rst:2691 +#: library/os.rst:2846 msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " @@ -2872,7 +3002,7 @@ msgid "" "Unix but only requires one for symbolic links on Windows." msgstr "" -#: library/os.rst:2701 +#: library/os.rst:2856 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the type " @@ -2881,30 +3011,30 @@ msgid "" "they will be of type ``str``." msgstr "" -#: library/os.rst:2710 +#: library/os.rst:2865 msgid "" "Raises an :ref:`auditing event ` ``os.scandir`` with argument " "``path``." msgstr "" -#: library/os.rst:2712 +#: library/os.rst:2867 msgid "" "The :func:`scandir` iterator supports the :term:`context manager` protocol " "and has the following method:" msgstr "" -#: library/os.rst:2717 +#: library/os.rst:2872 msgid "Close the iterator and free acquired resources." msgstr "" -#: library/os.rst:2719 +#: library/os.rst:2874 msgid "" "This is called automatically when the iterator is exhausted or garbage " "collected, or when an error happens during iterating. However it is " "advisable to call it explicitly or use the :keyword:`with` statement." msgstr "" -#: library/os.rst:2726 +#: library/os.rst:2881 msgid "" "The following example shows a simple use of :func:`scandir` to display all " "the files (excluding directories) in the given *path* that don't start with " @@ -2912,7 +3042,15 @@ msgid "" "system call::" msgstr "" -#: library/os.rst:2738 +#: library/os.rst:2886 +msgid "" +"with os.scandir(path) as it:\n" +" for entry in it:\n" +" if not entry.name.startswith('.') and entry.is_file():\n" +" print(entry.name)" +msgstr "" + +#: library/os.rst:2893 msgid "" "On Unix-based systems, :func:`scandir` uses the system's `opendir() `_ and " @@ -2923,36 +3061,36 @@ msgid "" "desktop/aa364428(v=vs.85).aspx>`_ functions." msgstr "" -#: library/os.rst:2750 +#: library/os.rst:2905 msgid "" "Added support for the :term:`context manager` protocol and the :func:" -"`~scandir.close()` method. If a :func:`scandir` iterator is neither " -"exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " -"its destructor." +"`~scandir.close` method. If a :func:`scandir` iterator is neither exhausted " +"nor explicitly closed a :exc:`ResourceWarning` will be emitted in its " +"destructor." msgstr "" -#: library/os.rst:2756 +#: library/os.rst:2911 msgid "The function accepts a :term:`path-like object`." msgstr "" -#: library/os.rst:2758 +#: library/os.rst:2913 msgid "Added support for :ref:`file descriptors ` on Unix." msgstr "" -#: library/os.rst:2764 +#: library/os.rst:2919 msgid "" "Object yielded by :func:`scandir` to expose the file path and other file " "attributes of a directory entry." msgstr "" -#: library/os.rst:2767 +#: library/os.rst:2922 msgid "" ":func:`scandir` will provide as much of this information as possible without " "making additional system calls. When a ``stat()`` or ``lstat()`` system call " "is made, the ``os.DirEntry`` object will cache the result." msgstr "" -#: library/os.rst:2771 +#: library/os.rst:2926 msgid "" "``os.DirEntry`` instances are not intended to be stored in long-lived data " "structures; if you know the file metadata has changed or if a long time has " @@ -2960,7 +3098,7 @@ msgid "" "up-to-date information." msgstr "" -#: library/os.rst:2776 +#: library/os.rst:2931 msgid "" "Because the ``os.DirEntry`` methods can make operating system calls, they " "may also raise :exc:`OSError`. If you need very fine-grained control over " @@ -2968,29 +3106,29 @@ msgid "" "methods and handle as appropriate." msgstr "" -#: library/os.rst:2781 +#: library/os.rst:2936 msgid "" "To be directly usable as a :term:`path-like object`, ``os.DirEntry`` " "implements the :class:`PathLike` interface." msgstr "" -#: library/os.rst:2784 +#: library/os.rst:2939 msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:" msgstr "" -#: library/os.rst:2788 +#: library/os.rst:2943 msgid "" "The entry's base filename, relative to the :func:`scandir` *path* argument." msgstr "" -#: library/os.rst:2791 +#: library/os.rst:2946 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: library/os.rst:2797 +#: library/os.rst:2952 msgid "" "The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." "name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " @@ -3000,51 +3138,51 @@ msgid "" "attribute." msgstr "" -#: library/os.rst:2804 +#: library/os.rst:2959 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: library/os.rst:2810 +#: library/os.rst:2965 msgid "Return the inode number of the entry." msgstr "" -#: library/os.rst:2812 +#: library/os.rst:2967 msgid "" "The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." "path, follow_symlinks=False).st_ino`` to fetch up-to-date information." msgstr "" -#: library/os.rst:2816 +#: library/os.rst:2971 msgid "" "On the first, uncached call, a system call is required on Windows but not on " "Unix." msgstr "" -#: library/os.rst:2821 +#: library/os.rst:2976 msgid "" "Return ``True`` if this entry is a directory or a symbolic link pointing to " "a directory; return ``False`` if the entry is or points to any other kind of " "file, or if it doesn't exist anymore." msgstr "" -#: library/os.rst:2825 +#: library/os.rst:2980 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "directory (without following symlinks); return ``False`` if the entry is any " "other kind of file or if it doesn't exist anymore." msgstr "" -#: library/os.rst:2829 +#: library/os.rst:2984 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along " "with :func:`stat.S_ISDIR` to fetch up-to-date information." msgstr "" -#: library/os.rst:2833 +#: library/os.rst:2988 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, for non-symlinks, neither Windows or Unix require a system " @@ -3054,46 +3192,46 @@ msgid "" "is ``False``." msgstr "" -#: library/os.rst:2870 +#: library/os.rst:3025 msgid "" "This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" "exc:`FileNotFoundError` is caught and not raised." msgstr "" -#: library/os.rst:2845 +#: library/os.rst:3000 msgid "" "Return ``True`` if this entry is a file or a symbolic link pointing to a " "file; return ``False`` if the entry is or points to a directory or other non-" "file entry, or if it doesn't exist anymore." msgstr "" -#: library/os.rst:2849 +#: library/os.rst:3004 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "file (without following symlinks); return ``False`` if the entry is a " "directory or other non-file entry, or if it doesn't exist anymore." msgstr "" -#: library/os.rst:2853 +#: library/os.rst:3008 msgid "" "The result is cached on the ``os.DirEntry`` object. Caching, system calls " "made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`." msgstr "" -#: library/os.rst:2858 +#: library/os.rst:3013 msgid "" "Return ``True`` if this entry is a symbolic link (even if broken); return " "``False`` if the entry points to a directory or any kind of file, or if it " "doesn't exist anymore." msgstr "" -#: library/os.rst:2862 +#: library/os.rst:3017 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "islink` to fetch up-to-date information." msgstr "" -#: library/os.rst:2865 +#: library/os.rst:3020 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, neither Windows or Unix require a system call, except on " @@ -3101,48 +3239,48 @@ msgid "" "``dirent.d_type == DT_UNKNOWN``." msgstr "" -#: library/os.rst:2875 +#: library/os.rst:3030 msgid "" "Return ``True`` if this entry is a junction (even if broken); return " "``False`` if the entry points to a regular directory, any kind of file, a " "symlink, or if it doesn't exist anymore." msgstr "" -#: library/os.rst:2879 +#: library/os.rst:3034 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "isjunction` to fetch up-to-date information." msgstr "" -#: library/os.rst:2886 +#: library/os.rst:3041 msgid "" "Return a :class:`stat_result` object for this entry. This method follows " "symbolic links by default; to stat a symbolic link add the " "``follow_symlinks=False`` argument." msgstr "" -#: library/os.rst:2890 +#: library/os.rst:3045 msgid "" "On Unix, this method always requires a system call. On Windows, it only " "requires a system call if *follow_symlinks* is ``True`` and the entry is a " "reparse point (for example, a symbolic link or directory junction)." msgstr "" -#: library/os.rst:2895 +#: library/os.rst:3050 msgid "" "On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" "class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" -#: library/os.rst:2899 +#: library/os.rst:3054 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch " "up-to-date information." msgstr "" -#: library/os.rst:2903 +#: library/os.rst:3058 msgid "" "Note that there is a nice correspondence between several attributes and " "methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the " @@ -3150,13 +3288,13 @@ msgid "" "``is_file()``, ``is_symlink()``, ``is_junction()``, and ``stat()`` methods." msgstr "" -#: library/os.rst:2911 +#: library/os.rst:3066 msgid "" "Added support for the :class:`~os.PathLike` interface. Added support for :" "class:`bytes` paths on Windows." msgstr "" -#: library/os.rst:2915 +#: library/os.rst:3070 msgid "" "The ``st_ctime`` attribute of a stat result is deprecated on Windows. The " "file creation time is properly available as ``st_birthtime``, and in the " @@ -3164,7 +3302,7 @@ msgid "" "time, if available." msgstr "" -#: library/os.rst:2924 +#: library/os.rst:3079 msgid "" "Get the status of a file or a file descriptor. Perform the equivalent of a :" "c:func:`stat` system call on the given path. *path* may be specified as " @@ -3173,19 +3311,19 @@ msgid "" "`stat_result` object." msgstr "" -#: library/os.rst:2930 +#: library/os.rst:3085 msgid "" "This function normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: library/os.rst:3798 library/os.rst:3830 library/os.rst:3850 +#: library/os.rst:4170 library/os.rst:4202 library/os.rst:4222 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." msgstr "" -#: library/os.rst:2936 +#: library/os.rst:3091 msgid "" "On Windows, passing ``follow_symlinks=False`` will disable following all " "name-surrogate reparse points, which includes symlinks and directory " @@ -3199,21 +3337,33 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: library/os.rst:3718 +#: library/os.rst:3877 msgid "Example::" msgstr "" -#: library/os.rst:2962 +#: library/os.rst:3106 +msgid "" +">>> import os\n" +">>> statinfo = os.stat('somefile.txt')\n" +">>> statinfo\n" +"os.stat_result(st_mode=33188, st_ino=7876932, st_dev=234881026,\n" +"st_nlink=1, st_uid=501, st_gid=501, st_size=264, st_atime=1297230295,\n" +"st_mtime=1297230027, st_ctime=1297230027)\n" +">>> statinfo.st_size\n" +"264" +msgstr "" + +#: library/os.rst:3117 msgid ":func:`fstat` and :func:`lstat` functions." msgstr "" -#: library/os.rst:2964 +#: library/os.rst:3119 msgid "" "Added the *dir_fd* and *follow_symlinks* parameters, specifying a file " "descriptor instead of a path." msgstr "" -#: library/os.rst:2971 +#: library/os.rst:3126 msgid "" "On Windows, all reparse points that can be resolved by the operating system " "are now followed, and passing ``follow_symlinks=False`` disables following " @@ -3223,122 +3373,122 @@ msgid "" "of raising an error." msgstr "" -#: library/os.rst:2982 +#: library/os.rst:3137 msgid "" "Object whose attributes correspond roughly to the members of the :c:struct:" "`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." "fstat` and :func:`os.lstat`." msgstr "" -#: library/os.rst:2986 +#: library/os.rst:3141 msgid "Attributes:" msgstr "" -#: library/os.rst:2990 +#: library/os.rst:3145 msgid "File mode: file type and file mode bits (permissions)." msgstr "" -#: library/os.rst:2994 +#: library/os.rst:3149 msgid "" "Platform dependent, but if non-zero, uniquely identifies the file for a " "given value of ``st_dev``. Typically:" msgstr "" -#: library/os.rst:2997 +#: library/os.rst:3152 msgid "the inode number on Unix," msgstr "" -#: library/os.rst:2998 +#: library/os.rst:3153 msgid "" "the `file index `_ on " "Windows" msgstr "" -#: library/os.rst:3004 +#: library/os.rst:3159 msgid "Identifier of the device on which this file resides." msgstr "" -#: library/os.rst:3008 +#: library/os.rst:3163 msgid "Number of hard links." msgstr "" -#: library/os.rst:3012 +#: library/os.rst:3167 msgid "User identifier of the file owner." msgstr "" -#: library/os.rst:3016 +#: library/os.rst:3171 msgid "Group identifier of the file owner." msgstr "" -#: library/os.rst:3020 +#: library/os.rst:3175 msgid "" "Size of the file in bytes, if it is a regular file or a symbolic link. The " "size of a symbolic link is the length of the pathname it contains, without a " "terminating null byte." msgstr "" -#: library/os.rst:3024 +#: library/os.rst:3179 msgid "Timestamps:" msgstr "" -#: library/os.rst:3028 +#: library/os.rst:3183 msgid "Time of most recent access expressed in seconds." msgstr "" -#: library/os.rst:3032 +#: library/os.rst:3187 msgid "Time of most recent content modification expressed in seconds." msgstr "" -#: library/os.rst:3036 +#: library/os.rst:3191 msgid "Time of most recent metadata change expressed in seconds." msgstr "" -#: library/os.rst:3038 +#: library/os.rst:3193 msgid "" "``st_ctime`` is deprecated on Windows. Use ``st_birthtime`` for the file " "creation time. In the future, ``st_ctime`` will contain the time of the most " "recent metadata change, as for other platforms." msgstr "" -#: library/os.rst:3045 +#: library/os.rst:3200 msgid "Time of most recent access expressed in nanoseconds as an integer." msgstr "" -#: library/os.rst:3051 +#: library/os.rst:3206 msgid "" "Time of most recent content modification expressed in nanoseconds as an " "integer." msgstr "" -#: library/os.rst:3058 +#: library/os.rst:3213 msgid "" "Time of most recent metadata change expressed in nanoseconds as an integer." msgstr "" -#: library/os.rst:3063 +#: library/os.rst:3218 msgid "" "``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns`` for the " "file creation time. In the future, ``st_ctime`` will contain the time of the " "most recent metadata change, as for other platforms." msgstr "" -#: library/os.rst:3070 +#: library/os.rst:3225 msgid "" "Time of file creation expressed in seconds. This attribute is not always " "available, and may raise :exc:`AttributeError`." msgstr "" -#: library/os.rst:3073 +#: library/os.rst:3228 msgid "``st_birthtime`` is now available on Windows." msgstr "" -#: library/os.rst:3078 +#: library/os.rst:3233 msgid "" "Time of file creation expressed in nanoseconds as an integer. This attribute " "is not always available, and may raise :exc:`AttributeError`." msgstr "" -#: library/os.rst:3086 +#: library/os.rst:3241 msgid "" "The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, :" "attr:`st_ctime` and :attr:`st_birthtime` attributes depend on the operating " @@ -3348,7 +3498,7 @@ msgid "" "details." msgstr "" -#: library/os.rst:3093 +#: library/os.rst:3248 msgid "" "Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:" "`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in " @@ -3361,74 +3511,74 @@ msgid "" "`st_birthtime_ns`." msgstr "" -#: library/os.rst:3103 +#: library/os.rst:3258 msgid "" "On some Unix systems (such as Linux), the following attributes may also be " "available:" msgstr "" -#: library/os.rst:3108 +#: library/os.rst:3263 msgid "" "Number of 512-byte blocks allocated for file. This may be smaller than :attr:" "`st_size`/512 when the file has holes." msgstr "" -#: library/os.rst:3113 +#: library/os.rst:3268 msgid "" "\"Preferred\" blocksize for efficient file system I/O. Writing to a file in " "smaller chunks may cause an inefficient read-modify-rewrite." msgstr "" -#: library/os.rst:3118 +#: library/os.rst:3273 msgid "Type of device if an inode device." msgstr "" -#: library/os.rst:3122 +#: library/os.rst:3277 msgid "User defined flags for file." msgstr "" -#: library/os.rst:3124 +#: library/os.rst:3279 msgid "" "On other Unix systems (such as FreeBSD), the following attributes may be " "available (but may be only filled out if root tries to use them):" msgstr "" -#: library/os.rst:3129 +#: library/os.rst:3284 msgid "File generation number." msgstr "" -#: library/os.rst:3131 +#: library/os.rst:3286 msgid "" "On Solaris and derivatives, the following attributes may also be available:" msgstr "" -#: library/os.rst:3136 +#: library/os.rst:3291 msgid "" "String that uniquely identifies the type of the filesystem that contains the " "file." msgstr "" -#: library/os.rst:3139 +#: library/os.rst:3294 msgid "On macOS systems, the following attributes may also be available:" msgstr "" -#: library/os.rst:3143 +#: library/os.rst:3298 msgid "Real size of the file." msgstr "" -#: library/os.rst:3147 +#: library/os.rst:3302 msgid "Creator of the file." msgstr "" -#: library/os.rst:3151 +#: library/os.rst:3306 msgid "File type." msgstr "" -#: library/os.rst:3153 +#: library/os.rst:3308 msgid "On Windows systems, the following attributes are also available:" msgstr "" -#: library/os.rst:3157 +#: library/os.rst:3312 msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:`!" @@ -3436,7 +3586,7 @@ msgid "" "FILE_ATTRIBUTE_ARCHIVE>` constants in the :mod:`stat` module." msgstr "" -#: library/os.rst:3167 +#: library/os.rst:3322 msgid "" "When :attr:`st_file_attributes` has the :const:`~stat." "FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the tag identifying " @@ -3444,14 +3594,14 @@ msgid "" "IO_REPARSE_TAG_SYMLINK>` constants in the :mod:`stat` module." msgstr "" -#: library/os.rst:3172 +#: library/os.rst:3327 msgid "" "The standard module :mod:`stat` defines functions and constants that are " "useful for extracting information from a :c:struct:`stat` structure. (On " "Windows, some items are filled with dummy values.)" msgstr "" -#: library/os.rst:3176 +#: library/os.rst:3331 msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " @@ -3463,49 +3613,49 @@ msgid "" "class:`stat_result` as a tuple always returns integers." msgstr "" -#: library/os.rst:3185 +#: library/os.rst:3340 msgid "Windows now returns the file index as :attr:`st_ino` when available." msgstr "" -#: library/os.rst:3189 +#: library/os.rst:3344 msgid "Added the :attr:`st_fstype` member to Solaris/derivatives." msgstr "" -#: library/os.rst:3192 +#: library/os.rst:3347 msgid "Added the :attr:`st_reparse_tag` member on Windows." msgstr "" -#: library/os.rst:3195 +#: library/os.rst:3350 msgid "" "On Windows, the :attr:`st_mode` member now identifies special files as :" "const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" -#: library/os.rst:3200 +#: library/os.rst:3355 msgid "" "On Windows, :attr:`st_ctime` is deprecated. Eventually, it will contain the " "last metadata change time, for consistency with other platforms, but for now " "still contains creation time. Use :attr:`st_birthtime` for the creation time." msgstr "" -#: library/os.rst:3206 +#: library/os.rst:3361 msgid "" "On Windows, :attr:`st_ino` may now be up to 128 bits, depending on the file " "system. Previously it would not be above 64 bits, and larger file " "identifiers would be arbitrarily packed." msgstr "" -#: library/os.rst:3210 +#: library/os.rst:3365 msgid "" "On Windows, :attr:`st_rdev` no longer returns a value. Previously it would " "contain the same as :attr:`st_dev`, which was incorrect." msgstr "" -#: library/os.rst:3213 +#: library/os.rst:3368 msgid "Added the :attr:`st_birthtime` member on Windows." msgstr "" -#: library/os.rst:3218 +#: library/os.rst:3373 msgid "" "Perform a :c:func:`!statvfs` system call on the given path. The return " "value is an object whose attributes describe the filesystem on the given " @@ -3515,7 +3665,7 @@ msgid "" "`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" -#: library/os.rst:3225 +#: library/os.rst:3380 msgid "" "Two module-level constants are defined for the :attr:`f_flag` attribute's " "bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted read-" @@ -3523,7 +3673,7 @@ msgid "" "are disabled or not supported." msgstr "" -#: library/os.rst:3230 +#: library/os.rst:3385 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " "These are :const:`ST_NODEV` (disallow access to device special files), :" @@ -3536,11 +3686,11 @@ msgid "" "relative to mtime/ctime)." msgstr "" -#: library/os.rst:3243 +#: library/os.rst:3398 msgid "The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added." msgstr "" -#: library/os.rst:3249 +#: library/os.rst:3404 msgid "" "The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" "`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" @@ -3548,11 +3698,11 @@ msgid "" "`ST_RELATIME` constants were added." msgstr "" -#: library/os.rst:3258 +#: library/os.rst:3413 msgid "Added the :attr:`f_fsid` attribute." msgstr "" -#: library/os.rst:3264 +#: library/os.rst:3419 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept an open file descriptor for their *dir_fd* parameter. Different " @@ -3564,7 +3714,7 @@ msgid "" "(Specifying ``None`` for *dir_fd* is always supported on all platforms.)" msgstr "" -#: library/os.rst:3274 +#: library/os.rst:3429 msgid "" "To check whether a particular function accepts an open file descriptor for " "its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``. As " @@ -3572,13 +3722,17 @@ msgid "" "open file descriptors for *dir_fd* on the local platform::" msgstr "" -#: library/os.rst:3281 +#: library/os.rst:3434 +msgid "os.stat in os.supports_dir_fd" +msgstr "" + +#: library/os.rst:3436 msgid "" "Currently *dir_fd* parameters only work on Unix platforms; none of them work " "on Windows." msgstr "" -#: library/os.rst:3289 +#: library/os.rst:3444 msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " @@ -3587,19 +3741,23 @@ msgid "" "func:`os.access`; otherwise it will be empty." msgstr "" -#: library/os.rst:3295 +#: library/os.rst:3450 msgid "" "This expression evaluates to ``True`` if :func:`os.access` supports " "``effective_ids=True`` on the local platform::" msgstr "" -#: library/os.rst:3300 +#: library/os.rst:3453 +msgid "os.access in os.supports_effective_ids" +msgstr "" + +#: library/os.rst:3455 msgid "" "Currently *effective_ids* is only supported on Unix platforms; it does not " "work on Windows." msgstr "" -#: library/os.rst:3308 +#: library/os.rst:3463 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "permit specifying their *path* parameter as an open file descriptor on the " @@ -3608,7 +3766,7 @@ msgid "" "*path* arguments is not available on all platforms Python supports." msgstr "" -#: library/os.rst:3315 +#: library/os.rst:3470 msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " @@ -3617,7 +3775,11 @@ msgid "" "platform::" msgstr "" -#: library/os.rst:3328 +#: library/os.rst:3476 +msgid "os.chdir in os.supports_fd" +msgstr "" + +#: library/os.rst:3483 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept ``False`` for their *follow_symlinks* parameter on the local " @@ -3630,7 +3792,7 @@ msgid "" "on all platforms.)" msgstr "" -#: library/os.rst:3338 +#: library/os.rst:3493 msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " @@ -3639,11 +3801,21 @@ msgid "" "stat` on the local platform::" msgstr "" -#: library/os.rst:3351 +#: library/os.rst:3499 +msgid "os.stat in os.supports_follow_symlinks" +msgstr "" + +#: library/os.rst:3506 msgid "Create a symbolic link pointing to *src* named *dst*." msgstr "" -#: library/os.rst:3353 +#: library/os.rst:3508 +msgid "" +"The *src* parameter refers to the target of the link (the file or directory " +"being linked to), and *dst* is the name of the link being created." +msgstr "" + +#: library/os.rst:3511 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -3653,7 +3825,7 @@ msgid "" "ignored." msgstr "" -#: library/os.rst:3364 +#: library/os.rst:3522 msgid "" "On newer versions of Windows 10, unprivileged accounts can create symlinks " "if Developer Mode is enabled. When Developer Mode is not available/enabled, " @@ -3661,83 +3833,83 @@ msgid "" "must be run as an administrator." msgstr "" -#: library/os.rst:3370 +#: library/os.rst:3528 msgid "" ":exc:`OSError` is raised when the function is called by an unprivileged user." msgstr "" -#: library/os.rst:3373 +#: library/os.rst:3531 msgid "" "Raises an :ref:`auditing event ` ``os.symlink`` with arguments " "``src``, ``dst``, ``dir_fd``." msgstr "" -#: library/os.rst:3383 +#: library/os.rst:3541 msgid "" "Added the *dir_fd* parameter, and now allow *target_is_directory* on non-" "Windows platforms." msgstr "" -#: library/os.rst:3390 +#: library/os.rst:3548 msgid "Added support for unelevated symlinks on Windows with Developer Mode." msgstr "" -#: library/os.rst:3396 +#: library/os.rst:3554 msgid "Force write of everything to disk." msgstr "" -#: library/os.rst:3405 +#: library/os.rst:3563 msgid "" "Truncate the file corresponding to *path*, so that it is at most *length* " "bytes in size." msgstr "" -#: library/os.rst:3410 +#: library/os.rst:3568 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." msgstr "" -#: library/os.rst:3425 +#: library/os.rst:3583 msgid "" "Remove (delete) the file *path*. This function is semantically identical " "to :func:`remove`; the ``unlink`` name is its traditional Unix name. Please " "see the documentation for :func:`remove` for further information." msgstr "" -#: library/os.rst:3441 +#: library/os.rst:3599 msgid "Set the access and modified times of the file specified by *path*." msgstr "" -#: library/os.rst:3443 +#: library/os.rst:3601 msgid "" ":func:`utime` takes two optional parameters, *times* and *ns*. These specify " "the times set on *path* and are used as follows:" msgstr "" -#: library/os.rst:3446 +#: library/os.rst:3604 msgid "" "If *ns* is specified, it must be a 2-tuple of the form ``(atime_ns, " "mtime_ns)`` where each member is an int expressing nanoseconds." msgstr "" -#: library/os.rst:3449 +#: library/os.rst:3607 msgid "" "If *times* is not ``None``, it must be a 2-tuple of the form ``(atime, " "mtime)`` where each member is an int or float expressing seconds." msgstr "" -#: library/os.rst:3452 +#: library/os.rst:3610 msgid "" "If *times* is ``None`` and *ns* is unspecified, this is equivalent to " "specifying ``ns=(atime_ns, mtime_ns)`` where both times are the current time." msgstr "" -#: library/os.rst:3456 +#: library/os.rst:3614 msgid "It is an error to specify tuples for both *times* and *ns*." msgstr "" -#: library/os.rst:3458 +#: library/os.rst:3616 msgid "" "Note that the exact times you set here may not be returned by a subsequent :" "func:`~os.stat` call, depending on the resolution with which your operating " @@ -3747,19 +3919,19 @@ msgid "" "func:`utime`." msgstr "" -#: library/os.rst:3469 +#: library/os.rst:3627 msgid "" "Raises an :ref:`auditing event ` ``os.utime`` with arguments " "``path``, ``times``, ``ns``, ``dir_fd``." msgstr "" -#: library/os.rst:3471 +#: library/os.rst:3629 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd*, *follow_symlinks*, and *ns* parameters." msgstr "" -#: library/os.rst:3485 +#: library/os.rst:3643 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up. For each directory in the tree rooted at directory *top* " @@ -3767,7 +3939,7 @@ msgid "" "filenames)``." msgstr "" -#: library/os.rst:3490 +#: library/os.rst:3648 msgid "" "*dirpath* is a string, the path to the directory. *dirnames* is a list of " "the names of the subdirectories in *dirpath* (including symlinks to " @@ -3781,7 +3953,7 @@ msgid "" "unspecified." msgstr "" -#: library/os.rst:3501 +#: library/os.rst:3659 msgid "" "If optional argument *topdown* is ``True`` or not specified, the triple for " "a directory is generated before the triples for any of its subdirectories " @@ -3792,7 +3964,7 @@ msgid "" "its subdirectories are generated." msgstr "" -#: library/os.rst:3509 +#: library/os.rst:3667 msgid "" "When *topdown* is ``True``, the caller can modify the *dirnames* list in-" "place (perhaps using :keyword:`del` or slice assignment), and :func:`walk` " @@ -3805,7 +3977,7 @@ msgid "" "itself is generated." msgstr "" -#: library/os.rst:3518 +#: library/os.rst:3676 msgid "" "By default, errors from the :func:`scandir` call are ignored. If optional " "argument *onerror* is specified, it should be a function; it will be called " @@ -3815,66 +3987,93 @@ msgid "" "object." msgstr "" -#: library/os.rst:3524 +#: library/os.rst:3682 msgid "" "By default, :func:`walk` will not walk down into symbolic links that resolve " "to directories. Set *followlinks* to ``True`` to visit directories pointed " "to by symlinks, on systems that support them." msgstr "" -#: library/os.rst:3530 +#: library/os.rst:3688 msgid "" "Be aware that setting *followlinks* to ``True`` can lead to infinite " "recursion if a link points to a parent directory of itself. :func:`walk` " "does not keep track of the directories it visited already." msgstr "" -#: library/os.rst:3536 +#: library/os.rst:3694 msgid "" "If you pass a relative pathname, don't change the current working directory " "between resumptions of :func:`walk`. :func:`walk` never changes the current " "directory, and assumes that its caller doesn't either." msgstr "" -#: library/os.rst:3601 +#: library/os.rst:3760 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " -"under any CVS subdirectory::" +"under any ``__pycache__`` subdirectory::" +msgstr "" + +#: library/os.rst:3702 +msgid "" +"import os\n" +"from os.path import join, getsize\n" +"for root, dirs, files in os.walk('python/Lib/xml'):\n" +" print(root, \"consumes\", end=\" \")\n" +" print(sum(getsize(join(root, name)) for name in files), end=\" \")\n" +" print(\"bytes in\", len(files), \"non-directory files\")\n" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: library/os.rst:3553 +#: library/os.rst:3711 msgid "" "In the next example (simple implementation of :func:`shutil.rmtree`), " "walking the tree bottom-up is essential, :func:`rmdir` doesn't allow " "deleting a directory before the directory is empty::" msgstr "" -#: library/os.rst:3568 +#: library/os.rst:3715 +msgid "" +"# Delete everything reachable from the directory named in \"top\",\n" +"# assuming there are no symbolic links.\n" +"# CAUTION: This is dangerous! For example, if top == '/', it\n" +"# could delete all your disk files.\n" +"import os\n" +"for root, dirs, files in os.walk(top, topdown=False):\n" +" for name in files:\n" +" os.remove(os.path.join(root, name))\n" +" for name in dirs:\n" +" os.rmdir(os.path.join(root, name))\n" +"os.rmdir(top)" +msgstr "" + +#: library/os.rst:3727 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." msgstr "" -#: library/os.rst:3570 +#: library/os.rst:3729 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: library/os.rst:3584 +#: library/os.rst:3743 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: library/os.rst:3587 +#: library/os.rst:3746 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: library/os.rst:3590 +#: library/os.rst:3749 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -3882,30 +4081,56 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: library/os.rst:3597 +#: library/os.rst:3756 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: library/os.rst:3614 +#: library/os.rst:3764 +msgid "" +"import os\n" +"for root, dirs, files, rootfd in os.fwalk('python/Lib/xml'):\n" +" print(root, \"consumes\", end=\" \")\n" +" print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),\n" +" end=\" \")\n" +" print(\"bytes in\", len(files), \"non-directory files\")\n" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__') # don't visit __pycache__ directories" +msgstr "" + +#: library/os.rst:3773 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: library/os.rst:3629 +#: library/os.rst:3777 +msgid "" +"# Delete everything reachable from the directory named in \"top\",\n" +"# assuming there are no symbolic links.\n" +"# CAUTION: This is dangerous! For example, if top == '/', it\n" +"# could delete all your disk files.\n" +"import os\n" +"for root, dirs, files, rootfd in os.fwalk(top, topdown=False):\n" +" for name in files:\n" +" os.unlink(name, dir_fd=rootfd)\n" +" for name in dirs:\n" +" os.rmdir(name, dir_fd=rootfd)" +msgstr "" + +#: library/os.rst:3788 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." msgstr "" -#: library/os.rst:3638 +#: library/os.rst:3797 msgid "Added support for :class:`bytes` paths." msgstr "" -#: library/os.rst:3644 +#: library/os.rst:3803 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -3913,7 +4138,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: library/os.rst:3649 +#: library/os.rst:3808 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -3923,23 +4148,15 @@ msgid "" "side effects." msgstr "" -#: library/os.rst:3656 -msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27." -msgstr "" - -#: library/os.rst:3679 +#: library/os.rst:3838 msgid "These flags can be passed to :func:`memfd_create`." msgstr "" -#: library/os.rst:3681 -msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27" -msgstr "" - -#: library/os.rst:3683 +#: library/os.rst:3842 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "" -#: library/os.rst:3690 +#: library/os.rst:3849 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -3948,94 +4165,380 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: library/os.rst:3696 +#: library/os.rst:3855 msgid "" "*initval* is the initial value of the event counter. The initial value must " -"be an 32 bit unsigned integer. Please note that the initial value is limited " +"be a 32 bit unsigned integer. Please note that the initial value is limited " "to a 32 bit unsigned int although the event counter is an unsigned 64 bit " "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: library/os.rst:3701 +#: library/os.rst:3860 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: library/os.rst:3704 +#: library/os.rst:3863 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: library/os.rst:3707 +#: library/os.rst:3866 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: library/os.rst:3711 +#: library/os.rst:3870 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: library/os.rst:3714 +#: library/os.rst:3873 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: library/os.rst:3735 -msgid ":ref:`Availability `: Linux >= 2.6.27 with glibc >= 2.8" +#: library/os.rst:3879 +msgid "" +"import os\n" +"\n" +"# semaphore with start value '1'\n" +"fd = os.eventfd(1, os.EFD_SEMAPHORE | os.EFC_CLOEXEC)\n" +"try:\n" +" # acquire semaphore\n" +" v = os.eventfd_read(fd)\n" +" try:\n" +" do_work()\n" +" finally:\n" +" # release semaphore\n" +" os.eventfd_write(fd, v)\n" +"finally:\n" +" os.close(fd)" msgstr "" -#: library/os.rst:3741 +#: library/os.rst:3900 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: library/os.rst:3753 library/os.rst:3770 -msgid ":ref:`Availability `: Linux >= 2.6.27" -msgstr "" - -#: library/os.rst:3750 +#: library/os.rst:3909 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: library/os.rst:3759 +#: library/os.rst:3918 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: library/os.rst:3767 +#: library/os.rst:3926 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "" -#: library/os.rst:3776 +#: library/os.rst:3935 msgid "" -"Provide semaphore-like semantics for reads from a :func:`eventfd` file " +"Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: library/os.rst:3779 -msgid ":ref:`Availability `: Linux >= 2.6.30" +#: library/os.rst:3946 +msgid "Timer File Descriptors" +msgstr "" + +#: library/os.rst:3950 +msgid "" +"These functions provide support for Linux's *timer file descriptor* API. " +"Naturally, they are all only available on Linux." +msgstr "" + +#: library/os.rst:3955 +msgid "Create and return a timer file descriptor (*timerfd*)." +msgstr "" + +#: library/os.rst:3957 +msgid "The file descriptor returned by :func:`timerfd_create` supports:" +msgstr "" + +#: library/os.rst:3959 +msgid ":func:`read`" +msgstr "" + +#: library/os.rst:3960 +msgid ":func:`~select.select`" +msgstr "" + +#: library/os.rst:3961 +msgid ":func:`~select.poll`" +msgstr "" + +#: library/os.rst:3963 +msgid "" +"The file descriptor's :func:`read` method can be called with a buffer size " +"of 8. If the timer has already expired one or more times, :func:`read` " +"returns the number of expirations with the host's endianness, which may be " +"converted to an :class:`int` by ``int.from_bytes(x, byteorder=sys." +"byteorder)``." +msgstr "" + +#: library/os.rst:3968 +msgid "" +":func:`~select.select` and :func:`~select.poll` can be used to wait until " +"timer expires and the file descriptor is readable." +msgstr "" + +#: library/os.rst:3971 +msgid "" +"*clockid* must be a valid :ref:`clock ID `, as " +"defined in the :py:mod:`time` module:" +msgstr "" + +#: library/os.rst:3974 +msgid ":const:`time.CLOCK_REALTIME`" +msgstr "" + +#: library/os.rst:3975 +msgid ":const:`time.CLOCK_MONOTONIC`" +msgstr "" + +#: library/os.rst:3976 +msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" +msgstr "" + +#: library/os.rst:3978 +msgid "" +"If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" +"time clock is used. If system clock is changed, timer setting need to be " +"updated. To cancel timer when system clock is changed, see :const:" +"`TFD_TIMER_CANCEL_ON_SET`." msgstr "" -#: library/os.rst:3785 +#: library/os.rst:3983 +msgid "" +"If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " +"increasing clock is used. Even if the system clock is changed, the timer " +"setting will not be affected." +msgstr "" + +#: library/os.rst:3987 +msgid "" +"If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." +"CLOCK_MONOTONIC` except it includes any time that the system is suspended." +msgstr "" + +#: library/os.rst:3990 +msgid "" +"The file descriptor's behaviour can be modified by specifying a *flags* " +"value. Any of the following variables may used, combined using bitwise OR " +"(the ``|`` operator):" +msgstr "" + +#: library/os.rst:3994 +msgid ":const:`TFD_NONBLOCK`" +msgstr "" + +#: library/os.rst:3995 +msgid ":const:`TFD_CLOEXEC`" +msgstr "" + +#: library/os.rst:3997 +msgid "" +"If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " +"timer expires. If it is set as a flag, :func:`read` doesn't block, but If " +"there hasn't been an expiration since the last call to read, :func:`read` " +"raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." +msgstr "" + +#: library/os.rst:4003 +msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." +msgstr "" + +#: library/os.rst:4005 +msgid "" +"The file descriptor must be closed with :func:`os.close` when it is no " +"longer needed, or else the file descriptor will be leaked." +msgstr "" + +#: library/os.rst:4008 +msgid "The :manpage:`timerfd_create(2)` man page." +msgstr "" + +#: library/os.rst:4017 +msgid "" +"Alter a timer file descriptor's internal timer. This function operates the " +"same interval timer as :func:`timerfd_settime_ns`." +msgstr "" + +#: library/os.rst:4020 +msgid "*fd* must be a valid timer file descriptor." +msgstr "" + +#: library/os.rst:4022 +msgid "" +"The timer's behaviour can be modified by specifying a *flags* value. Any of " +"the following variables may used, combined using bitwise OR (the ``|`` " +"operator):" +msgstr "" + +#: library/os.rst:4026 +msgid ":const:`TFD_TIMER_ABSTIME`" +msgstr "" + +#: library/os.rst:4027 +msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" +msgstr "" + +#: library/os.rst:4029 +msgid "" +"The timer is disabled by setting *initial* to zero (``0``). If *initial* is " +"equal to or greater than zero, the timer is enabled. If *initial* is less " +"than zero, it raises an :class:`OSError` exception with ``errno`` set to :" +"const:`errno.EINVAL`" +msgstr "" + +#: library/os.rst:4034 +msgid "" +"By default the timer will fire when *initial* seconds have elapsed. (If " +"*initial* is zero, timer will fire immediately.)" +msgstr "" + +#: library/os.rst:4037 +msgid "" +"However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " +"when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " +"*initial* seconds." +msgstr "" + +#: library/os.rst:4041 +msgid "" +"The timer's interval is set by the *interval* :py:class:`float`. If " +"*interval* is zero, the timer only fires once, on the initial expiration. If " +"*interval* is greater than zero, the timer fires every time *interval* " +"seconds have elapsed since the previous expiration. If *interval* is less " +"than zero, it raises :class:`OSError` with ``errno`` set to :const:`errno." +"EINVAL`" +msgstr "" + +#: library/os.rst:4048 +msgid "" +"If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" +"`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." +"CLOCK_REALTIME`, the timer is marked as cancelable if the real-time clock is " +"changed discontinuously. Reading the descriptor is aborted with the error " +"ECANCELED." +msgstr "" + +#: library/os.rst:4054 +msgid "" +"Linux manages system clock as UTC. A daylight-savings time transition is " +"done by changing time offset only and doesn't cause discontinuous system " +"clock change." +msgstr "" + +#: library/os.rst:4058 +msgid "" +"Discontinuous system clock change will be caused by the following events:" +msgstr "" + +#: library/os.rst:4060 +msgid "``settimeofday``" +msgstr "" + +#: library/os.rst:4061 +msgid "``clock_settime``" +msgstr "" + +#: library/os.rst:4062 +msgid "set the system date and time by ``date`` command" +msgstr "" + +#: library/os.rst:4064 +msgid "" +"Return a two-item tuple of (``next_expiration``, ``interval``) from the " +"previous timer state, before this function executed." +msgstr "" + +#: library/os.rst:4069 +msgid "" +":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" +"`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." +msgstr "" + +#: library/os.rst:4080 +msgid "" +"Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " +"function operates the same interval timer as :func:`timerfd_settime`." +msgstr "" + +#: library/os.rst:4090 +msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." +msgstr "" + +#: library/os.rst:4092 +msgid "" +"``next_expiration`` denotes the relative time until next the timer next " +"fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." +msgstr "" + +#: library/os.rst:4095 +msgid "" +"``interval`` denotes the timer's interval. If zero, the timer will only fire " +"once, after ``next_expiration`` seconds have elapsed." +msgstr "" + +#: library/os.rst:4099 +msgid ":manpage:`timerfd_gettime(2)`" +msgstr "" + +#: library/os.rst:4108 +msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." +msgstr "" + +#: library/os.rst:4116 +msgid "" +"A flag for the :func:`timerfd_create` function, which sets the :const:" +"`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" +"`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." +msgstr "" + +#: library/os.rst:4126 +msgid "" +"A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " +"set as a flag, set close-on-exec flag for new file descriptor." +msgstr "" + +#: library/os.rst:4136 +msgid "" +"A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " +"functions. If this flag is set, *initial* is interpreted as an absolute " +"value on the timer's clock (in UTC seconds or nanoseconds since the Unix " +"Epoch)." +msgstr "" + +#: library/os.rst:4146 +msgid "" +"A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " +"functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " +"the time of the underlying clock changes discontinuously." +msgstr "" + +#: library/os.rst:4157 msgid "Linux extended attributes" msgstr "" -#: library/os.rst:3789 +#: library/os.rst:4161 msgid "These functions are all available on Linux only." msgstr "" -#: library/os.rst:3793 +#: library/os.rst:4165 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -4043,17 +4546,17 @@ msgid "" "encoding." msgstr "" -#: library/os.rst:3801 +#: library/os.rst:4173 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." msgstr "" -#: library/os.rst:3835 library/os.rst:3860 +#: library/os.rst:4207 library/os.rst:4232 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: library/os.rst:3809 +#: library/os.rst:4181 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4061,13 +4564,13 @@ msgid "" "the current directory." msgstr "" -#: library/os.rst:3817 +#: library/os.rst:4189 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" -#: library/os.rst:3825 +#: library/os.rst:4197 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -4075,13 +4578,13 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: library/os.rst:3833 +#: library/os.rst:4205 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." msgstr "" -#: library/os.rst:3841 +#: library/os.rst:4213 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -4093,45 +4596,45 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: library/os.rst:3855 +#: library/os.rst:4227 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: library/os.rst:3858 +#: library/os.rst:4230 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." msgstr "" -#: library/os.rst:3866 +#: library/os.rst:4238 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: library/os.rst:3872 +#: library/os.rst:4244 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: library/os.rst:3878 +#: library/os.rst:4250 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: library/os.rst:3885 +#: library/os.rst:4257 msgid "Process Management" msgstr "" -#: library/os.rst:3887 +#: library/os.rst:4259 msgid "These functions may be used to create and manage processes." msgstr "" -#: library/os.rst:3889 +#: library/os.rst:4261 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4142,7 +4645,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: library/os.rst:3900 +#: library/os.rst:4272 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -4151,37 +4654,37 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: library/os.rst:3909 +#: library/os.rst:4281 msgid "Add a path to the DLL search path." msgstr "" -#: library/os.rst:3911 +#: library/os.rst:4283 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: library/os.rst:3915 +#: library/os.rst:4287 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: library/os.rst:3918 +#: library/os.rst:4290 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: library/os.rst:3922 +#: library/os.rst:4294 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." msgstr "" -#: library/os.rst:3926 +#: library/os.rst:4298 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4189,14 +4692,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: library/os.rst:3933 +#: library/os.rst:4305 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: library/os.rst:3948 +#: library/os.rst:4320 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4204,7 +4707,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: library/os.rst:3953 +#: library/os.rst:4325 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -4212,7 +4715,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: library/os.rst:3959 +#: library/os.rst:4331 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4225,7 +4728,7 @@ msgid "" "is not enforced." msgstr "" -#: library/os.rst:3968 +#: library/os.rst:4340 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -4239,7 +4742,7 @@ msgid "" "even on Windows, as plain names will not be resolved." msgstr "" -#: library/os.rst:3979 +#: library/os.rst:4351 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4249,7 +4752,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: library/os.rst:3986 +#: library/os.rst:4358 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -4258,31 +4761,31 @@ msgid "" "`NotImplementedError`." msgstr "" -#: library/os.rst:3991 +#: library/os.rst:4363 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." msgstr "" -#: library/os.rst:3995 +#: library/os.rst:4367 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: library/os.rst:4004 +#: library/os.rst:4376 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: library/os.rst:4009 +#: library/os.rst:4381 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: library/os.rst:4012 +#: library/os.rst:4384 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4290,139 +4793,139 @@ msgid "" "delivery program." msgstr "" -#: library/os.rst:4018 +#: library/os.rst:4390 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: library/os.rst:4025 +#: library/os.rst:4397 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: library/os.rst:4033 +#: library/os.rst:4405 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: library/os.rst:4041 +#: library/os.rst:4413 msgid "Exit code that means the input data was incorrect." msgstr "" -#: library/os.rst:4048 +#: library/os.rst:4420 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: library/os.rst:4055 +#: library/os.rst:4427 msgid "Exit code that means a specified user did not exist." msgstr "" -#: library/os.rst:4062 +#: library/os.rst:4434 msgid "Exit code that means a specified host did not exist." msgstr "" -#: library/os.rst:4069 +#: library/os.rst:4441 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: library/os.rst:4076 +#: library/os.rst:4448 msgid "Exit code that means an internal software error was detected." msgstr "" -#: library/os.rst:4083 +#: library/os.rst:4455 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: library/os.rst:4091 +#: library/os.rst:4463 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: library/os.rst:4099 +#: library/os.rst:4471 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: library/os.rst:4106 +#: library/os.rst:4478 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: library/os.rst:4113 +#: library/os.rst:4485 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: library/os.rst:4122 +#: library/os.rst:4494 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: library/os.rst:4130 +#: library/os.rst:4502 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: library/os.rst:4138 +#: library/os.rst:4510 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: library/os.rst:4145 +#: library/os.rst:4517 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: library/os.rst:4152 +#: library/os.rst:4524 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: library/os.rst:4155 +#: library/os.rst:4527 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: library/os.rst:4158 +#: library/os.rst:4530 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "" -#: library/os.rst:4162 +#: library/os.rst:4534 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: library/os.rst:4211 +#: library/os.rst:4583 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: library/os.rst:4170 +#: library/os.rst:4542 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: library/os.rst:4174 +#: library/os.rst:4546 msgid "" "If Python is able to detect that your process has multiple threads, :func:" "`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: library/os.rst:4178 +#: library/os.rst:4550 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -4433,25 +4936,21 @@ msgid "" "``free``)." msgstr "" -#: library/os.rst:4187 +#: library/os.rst:4559 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: library/os.rst:4191 +#: library/os.rst:4563 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: library/os.rst:4443 -msgid ":ref:`Availability `: POSIX, not Emscripten, not WASI." -msgstr "" - -#: library/os.rst:4201 +#: library/os.rst:4573 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -4460,82 +4959,77 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: library/os.rst:4207 +#: library/os.rst:4579 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "" -#: library/os.rst:4214 +#: library/os.rst:4586 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: library/os.rst:4218 +#: library/os.rst:4590 msgid "" "If Python is able to detect that your process has multiple threads, this now " "raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." "fork`." msgstr "" -#: library/os.rst:4232 +#: library/os.rst:4604 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: library/os.rst:4235 +#: library/os.rst:4607 msgid "" "Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." "CTRL_BREAK_EVENT` signals are special signals which can only be sent to " "console processes which share a common console window, e.g., some " "subprocesses. Any other value for *sig* will cause the process to be " "unconditionally killed by the TerminateProcess API, and the exit code will " -"be set to *sig*. The Windows version of :func:`kill` additionally takes " -"process handles to be killed." +"be set to *sig*." msgstr "" -#: library/os.rst:4243 +#: library/os.rst:4614 msgid "See also :func:`signal.pthread_kill`." msgstr "" -#: library/os.rst:4245 +#: library/os.rst:4616 msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." msgstr "" -#: library/os.rst:4259 +#: library/os.rst:4630 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" -#: library/os.rst:4261 +#: library/os.rst:4632 msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." msgstr "" -#: library/os.rst:4268 +#: library/os.rst:4639 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." msgstr "" -#: library/os.rst:4275 +#: library/os.rst:4646 msgid "" "Return a file descriptor referring to the process *pid* with *flags* set. " "This descriptor can be used to perform process management without races and " "signals." msgstr "" -#: library/os.rst:4279 +#: library/os.rst:4650 msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "" -#: library/os.rst:4281 -msgid ":ref:`Availability `: Linux >= 5.3" -msgstr "" - -#: library/os.rst:4286 +#: library/os.rst:4657 msgid "" "This flag indicates that the file descriptor will be non-blocking. If the " "process referred to by the file descriptor has not yet terminated, then an " @@ -4543,17 +5037,13 @@ msgid "" "immediately return the error :const:`~errno.EAGAIN` rather than blocking." msgstr "" -#: library/os.rst:4291 -msgid ":ref:`Availability `: Linux >= 5.10" -msgstr "" - -#: library/os.rst:4297 +#: library/os.rst:4668 msgid "" "Lock program segments into memory. The value of *op* (defined in ````) determines which segments are locked." msgstr "" -#: library/os.rst:4305 +#: library/os.rst:4676 msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " @@ -4563,7 +5053,7 @@ msgid "" "rather than bytes." msgstr "" -#: library/os.rst:4313 +#: library/os.rst:4684 msgid "" "The ``close`` method returns :const:`None` if the subprocess exited " "successfully, or the subprocess's return code if there was an error. On " @@ -4575,60 +5065,63 @@ msgid "" "contains the signed integer return code from the child process." msgstr "" -#: library/os.rst:4323 +#: library/os.rst:4694 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close`` " "method result (exit status) into an exit code if it is not ``None``. On " "Windows, the ``close`` method result is directly the exit code (or ``None``)." msgstr "" -#: library/os.rst:4328 +#: library/os.rst:4699 msgid "" "This is implemented using :class:`subprocess.Popen`; see that class's " "documentation for more powerful ways to manage and communicate with " "subprocesses." msgstr "" -#: library/os.rst:4332 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: library/os.rst:4335 +#: library/os.rst:4706 msgid "" "The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " "and pipe contents." msgstr "" -#: library/os.rst:4338 +#: library/os.rst:4709 msgid "" ":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" "class:`subprocess.Popen` or :func:`subprocess.run` to control options like " "encodings." msgstr "" -#: library/os.rst:4347 +#: library/os.rst:4713 +msgid "" +"The function is :term:`soft deprecated` and should no longer be used to " +"write new code. The :mod:`subprocess` module is recommended instead." +msgstr "" + +#: library/os.rst:4722 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: library/os.rst:4349 +#: library/os.rst:4724 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: library/os.rst:4351 +#: library/os.rst:4726 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" -"`execve`." +"`execve`. *env* is allowed to be ``None``, in which case current process' " +"environment is used." msgstr "" -#: library/os.rst:4354 +#: library/os.rst:4730 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: library/os.rst:4358 +#: library/os.rst:4734 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -4637,40 +5130,49 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: library/os.rst:4366 +#: library/os.rst:4742 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "" -#: library/os.rst:4368 +#: library/os.rst:4744 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: library/os.rst:4372 +#: library/os.rst:4748 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "" -#: library/os.rst:4374 +#: library/os.rst:4750 msgid "Performs ``os.close(fd)``." msgstr "" -#: library/os.rst:4378 +#: library/os.rst:4754 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "" -#: library/os.rst:4380 +#: library/os.rst:4756 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: library/os.rst:4382 +#: library/os.rst:4760 +msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" +msgstr "" + +#: library/os.rst:4762 +msgid "Performs ``os.closerange(fd, INF)``." +msgstr "" + +#: library/os.rst:4764 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" -"posix_spawn_file_actions_addclose`, and :c:func:`!" -"posix_spawn_file_actions_adddup2` API calls used to prepare for the :c:func:" -"`!posix_spawn` call itself." +"posix_spawn_file_actions_addclose`, :c:func:`!" +"posix_spawn_file_actions_adddup2`, and :c:func:`!" +"posix_spawn_file_actions_addclosefrom_np` API calls used to prepare for the :" +"c:func:`!posix_spawn` call itself." msgstr "" -#: library/os.rst:4388 +#: library/os.rst:4771 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -4679,7 +5181,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: library/os.rst:4394 +#: library/os.rst:4777 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -4690,7 +5192,7 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: library/os.rst:4402 +#: library/os.rst:4785 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " "``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" @@ -4698,7 +5200,7 @@ msgid "" "is raised." msgstr "" -#: library/os.rst:4407 +#: library/os.rst:4790 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -4706,14 +5208,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: library/os.rst:4412 +#: library/os.rst:4795 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:macro:`!" "POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: library/os.rst:4416 +#: library/os.rst:4799 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -4723,78 +5225,85 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: library/os.rst:4439 +#: library/os.rst:4827 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." msgstr "" -#: library/os.rst:4433 +#: library/os.rst:4810 +msgid "" +"*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " +"on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " +"exists." +msgstr "" + +#: library/os.rst:4821 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: library/os.rst:4435 +#: library/os.rst:4823 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: library/os.rst:4445 +#: library/os.rst:4833 msgid "See :func:`posix_spawn` documentation." msgstr "" -#: library/os.rst:4451 +#: library/os.rst:4839 msgid "" "Register callables to be executed when a new child process is forked using :" "func:`os.fork` or similar process cloning APIs. The parameters are optional " "and keyword-only. Each specifies a different call point." msgstr "" -#: library/os.rst:4456 +#: library/os.rst:4844 msgid "*before* is a function called before forking a child process." msgstr "" -#: library/os.rst:4457 +#: library/os.rst:4845 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: library/os.rst:4459 +#: library/os.rst:4847 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: library/os.rst:4461 +#: library/os.rst:4849 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: library/os.rst:4465 +#: library/os.rst:4853 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: library/os.rst:4470 +#: library/os.rst:4858 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " "functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" "`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: library/os.rst:4474 +#: library/os.rst:4862 msgid "There is no way to unregister a function." msgstr "" -#: library/os.rst:4490 +#: library/os.rst:4878 msgid "Execute the program *path* in a new process." msgstr "" -#: library/os.rst:4492 +#: library/os.rst:4880 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -4802,7 +5311,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: library/os.rst:4497 +#: library/os.rst:4885 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -4811,13 +5320,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: library/os.rst:4503 +#: library/os.rst:4891 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: library/os.rst:4506 +#: library/os.rst:4894 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -4829,7 +5338,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: library/os.rst:4515 +#: library/os.rst:4903 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -4842,7 +5351,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: library/os.rst:4525 +#: library/os.rst:4913 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4854,19 +5363,28 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: library/os.rst:4534 +#: library/os.rst:4922 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: library/os.rst:4543 +#: library/os.rst:4925 +msgid "" +"import os\n" +"os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" +"\n" +"L = ['cp', 'index.html', '/dev/null']\n" +"os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" +msgstr "" + +#: library/os.rst:4931 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." msgstr "" -#: library/os.rst:4547 +#: library/os.rst:4935 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -4874,7 +5392,13 @@ msgid "" "instead." msgstr "" -#: library/os.rst:4559 +#: library/os.rst:4943 +msgid "" +"These functions are :term:`soft deprecated` and should no longer be used to " +"write new code. The :mod:`subprocess` module is recommended instead." +msgstr "" + +#: library/os.rst:4951 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:" @@ -4882,7 +5406,7 @@ msgid "" "been created, with the process id as the return value." msgstr "" -#: library/os.rst:4569 +#: library/os.rst:4961 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -4891,7 +5415,7 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: library/os.rst:4581 +#: library/os.rst:4973 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -4901,11 +5425,11 @@ msgid "" "function will not return." msgstr "" -#: library/os.rst:4592 +#: library/os.rst:4984 msgid "Start a file with its associated application." msgstr "" -#: library/os.rst:4594 +#: library/os.rst:4986 msgid "" "When *operation* is not specified, this acts like double-clicking the file " "in Windows Explorer, or giving the file name as an argument to the :program:" @@ -4913,7 +5437,7 @@ msgid "" "whatever application (if any) its extension is associated." msgstr "" -#: library/os.rst:4599 +#: library/os.rst:4991 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -4921,28 +5445,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: library/os.rst:4604 +#: library/os.rst:4996 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: library/os.rst:4608 +#: library/os.rst:5000 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: library/os.rst:4612 +#: library/os.rst:5004 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`!ShellExecute` function." msgstr "" -#: library/os.rst:4616 +#: library/os.rst:5008 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -4953,32 +5477,32 @@ msgid "" "encoded for Win32." msgstr "" -#: library/os.rst:4624 +#: library/os.rst:5016 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: library/os.rst:4628 +#: library/os.rst:5020 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." msgstr "" -#: library/os.rst:4630 +#: library/os.rst:5022 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." msgstr "" -#: library/os.rst:4634 +#: library/os.rst:5026 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: library/os.rst:4641 +#: library/os.rst:5033 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -4989,13 +5513,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: library/os.rst:4649 +#: library/os.rst:5041 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: library/os.rst:4652 +#: library/os.rst:5044 msgid "" "On Windows, the return value is that returned by the system shell after " "running *command*. The shell is given by the Windows environment variable :" @@ -5004,61 +5528,61 @@ msgid "" "shell documentation." msgstr "" -#: library/os.rst:4658 +#: library/os.rst:5050 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " -"new processes and retrieving their results; using that module is preferable " +"new processes and retrieving their results; using that module is recommended " "to using this function. See the :ref:`subprocess-replacements` section in " "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: library/os.rst:4663 +#: library/os.rst:5055 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: library/os.rst:4667 +#: library/os.rst:5059 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" -#: library/os.rst:4674 +#: library/os.rst:5066 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: library/os.rst:4677 +#: library/os.rst:5069 msgid ":attr:`!user` - user time" msgstr "" -#: library/os.rst:4678 +#: library/os.rst:5070 msgid ":attr:`!system` - system time" msgstr "" -#: library/os.rst:4679 +#: library/os.rst:5071 msgid ":attr:`!children_user` - user time of all child processes" msgstr "" -#: library/os.rst:4680 +#: library/os.rst:5072 msgid ":attr:`!children_system` - system time of all child processes" msgstr "" -#: library/os.rst:4681 +#: library/os.rst:5073 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: library/os.rst:4683 +#: library/os.rst:5075 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: library/os.rst:4687 +#: library/os.rst:5079 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -5068,7 +5592,7 @@ msgid "" "attributes are zero." msgstr "" -#: library/os.rst:4701 +#: library/os.rst:5093 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -5077,87 +5601,87 @@ msgid "" "if a core file was produced." msgstr "" -#: library/os.rst:4707 +#: library/os.rst:5099 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: library/os.rst:4785 +#: library/os.rst:5177 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: library/os.rst:4717 +#: library/os.rst:5109 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " "the completion of a specific child process and have more options. :func:" "`waitpid` is the only one also available on Windows." msgstr "" -#: library/os.rst:4724 +#: library/os.rst:5116 msgid "Wait for the completion of a child process." msgstr "" -#: library/os.rst:4726 +#: library/os.rst:5118 msgid "" "*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" "data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" -#: library/os.rst:4729 +#: library/os.rst:5121 msgid "" "*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" "data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" "`WNOWAIT` are additional optional flags." msgstr "" -#: library/os.rst:4733 +#: library/os.rst:5125 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure with the following attributes:" msgstr "" -#: library/os.rst:4736 +#: library/os.rst:5128 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: library/os.rst:4737 +#: library/os.rst:5129 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: library/os.rst:4738 +#: library/os.rst:5130 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: library/os.rst:4739 +#: library/os.rst:5131 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: library/os.rst:4740 +#: library/os.rst:5132 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: library/os.rst:4742 +#: library/os.rst:5134 msgid "" "If :data:`WNOHANG` is specified and there are no matching children in the " "requested state, ``None`` is returned. Otherwise, if there are no matching " "children that could be waited for, :exc:`ChildProcessError` is raised." msgstr "" -#: library/os.rst:4750 -msgid "This function is not available on macOS." +#: library/os.rst:5143 +msgid "This function is now available on macOS as well." msgstr "" -#: library/os.rst:4757 +#: library/os.rst:5149 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: library/os.rst:4759 +#: library/os.rst:5151 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -5166,7 +5690,7 @@ msgid "" "operation." msgstr "" -#: library/os.rst:4764 +#: library/os.rst:5156 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -5176,7 +5700,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: library/os.rst:4771 +#: library/os.rst:5163 msgid "" "*options* is an OR combination of flags. If it contains :data:`WNOHANG` and " "there are no matching children in the requested state, ``(0, 0)`` is " @@ -5185,7 +5709,7 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: library/os.rst:4777 +#: library/os.rst:5169 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " @@ -5197,7 +5721,7 @@ msgid "" "process handles." msgstr "" -#: library/os.rst:4798 +#: library/os.rst:5190 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -5206,13 +5730,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: library/os.rst:4819 +#: library/os.rst:5211 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: library/os.rst:4813 +#: library/os.rst:5205 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5221,118 +5745,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: library/os.rst:4830 +#: library/os.rst:5222 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: library/os.rst:4833 +#: library/os.rst:5225 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: library/os.rst:4834 +#: library/os.rst:5226 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: library/os.rst:4835 +#: library/os.rst:5227 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: library/os.rst:4836 +#: library/os.rst:5228 msgid "" ":data:`!P_PIDFD` - wait for the child identified by the file descriptor *id* " "(a process file descriptor created with :func:`pidfd_open`)." msgstr "" -#: library/os.rst:4841 +#: library/os.rst:5233 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: library/os.rst:4844 +#: library/os.rst:5236 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: library/os.rst:4850 +#: library/os.rst:5242 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" "func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" -#: library/os.rst:4859 +#: library/os.rst:5251 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: library/os.rst:4862 +#: library/os.rst:5254 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: library/os.rst:4872 +#: library/os.rst:5264 msgid "" "This *options* flag for :func:`waitid` causes child processes that have been " "stopped by the delivery of a signal to be reported." msgstr "" -#: library/os.rst:4907 +#: library/os.rst:5299 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: library/os.rst:4884 +#: library/os.rst:5276 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` " "causes child processes to also be reported if they have been stopped but " "their current state has not been reported since they were stopped." msgstr "" -#: library/os.rst:4888 +#: library/os.rst:5280 msgid "This option is not available for :func:`waitid`." msgstr "" -#: library/os.rst:4895 +#: library/os.rst:5287 msgid "" "This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, " "and :func:`waitid` to return right away if no child process status is " "available immediately." msgstr "" -#: library/os.rst:4904 +#: library/os.rst:5296 msgid "" "This *options* flag causes :func:`waitid` to leave the child in a waitable " "state, so that a later :func:`!wait*` call can be used to retrieve the child " "status information again." msgstr "" -#: library/os.rst:4919 +#: library/os.rst:5311 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: library/os.rst:4926 +#: library/os.rst:5318 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "" -#: library/os.rst:4932 +#: library/os.rst:5324 msgid "Convert a wait status to an exit code." msgstr "" -#: library/os.rst:4934 +#: library/os.rst:5326 msgid "On Unix:" msgstr "" -#: library/os.rst:4936 +#: library/os.rst:5328 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: library/os.rst:4939 +#: library/os.rst:5331 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -5340,15 +5864,15 @@ msgid "" "than 0." msgstr "" -#: library/os.rst:4943 +#: library/os.rst:5335 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "" -#: library/os.rst:4945 +#: library/os.rst:5337 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: library/os.rst:4947 +#: library/os.rst:5339 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -5356,221 +5880,234 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: library/os.rst:4954 +#: library/os.rst:5346 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: library/os.rst:4962 +#: library/os.rst:5354 msgid "" "The following functions take a process status code as returned by :func:" "`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " "to determine the disposition of a process." msgstr "" -#: library/os.rst:4968 +#: library/os.rst:5360 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: library/os.rst:5037 +#: library/os.rst:5429 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: library/os.rst:4978 +#: library/os.rst:5370 msgid "" "Return ``True`` if a stopped child has been resumed by delivery of :const:" "`~signal.SIGCONT` (if the process has been continued from a job control " "stop), otherwise return ``False``." msgstr "" -#: library/os.rst:4982 +#: library/os.rst:5374 msgid "See :data:`WCONTINUED` option." msgstr "" -#: library/os.rst:4989 +#: library/os.rst:5381 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: library/os.rst:4992 +#: library/os.rst:5384 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: library/os.rst:5000 +#: library/os.rst:5392 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: library/os.rst:5008 +#: library/os.rst:5400 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: library/os.rst:5017 +#: library/os.rst:5409 msgid "Return the process exit status." msgstr "" -#: library/os.rst:5019 +#: library/os.rst:5411 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: library/os.rst:5026 +#: library/os.rst:5418 msgid "Return the signal which caused the process to stop." msgstr "" -#: library/os.rst:5028 +#: library/os.rst:5420 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: library/os.rst:5035 +#: library/os.rst:5427 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: library/os.rst:5043 +#: library/os.rst:5435 msgid "Interface to the scheduler" msgstr "" -#: library/os.rst:5045 +#: library/os.rst:5437 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: library/os.rst:5051 +#: library/os.rst:5443 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: library/os.rst:5056 +#: library/os.rst:5450 msgid "The default scheduling policy." msgstr "" -#: library/os.rst:5060 +#: library/os.rst:5454 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: library/os.rst:5065 +#: library/os.rst:5459 +msgid "Scheduling policy for tasks with deadline constraints." +msgstr "" + +#: library/os.rst:5465 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: library/os.rst:5069 +#: library/os.rst:5469 +msgid "Alias for :data:`SCHED_OTHER`." +msgstr "" + +#: library/os.rst:5475 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: library/os.rst:5073 +#: library/os.rst:5479 msgid "A First In First Out scheduling policy." msgstr "" -#: library/os.rst:5077 +#: library/os.rst:5483 msgid "A round-robin scheduling policy." msgstr "" -#: library/os.rst:5081 +#: library/os.rst:5487 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: library/os.rst:5088 +#: library/os.rst:5494 msgid "" "This class represents tunable scheduling parameters used in :func:" "`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " "is immutable." msgstr "" -#: library/os.rst:5092 +#: library/os.rst:5498 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: library/os.rst:5096 +#: library/os.rst:5502 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: library/os.rst:5101 +#: library/os.rst:5507 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: library/os.rst:5107 +#: library/os.rst:5513 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: library/os.rst:5113 +#: library/os.rst:5519 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: library/os.rst:5120 +#: library/os.rst:5526 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: library/os.rst:5127 +#: library/os.rst:5533 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: library/os.rst:5133 +#: library/os.rst:5539 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: library/os.rst:5139 +#: library/os.rst:5545 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: library/os.rst:5145 -msgid "Voluntarily relinquish the CPU." +#: library/os.rst:5551 +msgid "" +"Voluntarily relinquish the CPU. See :manpage:`sched_yield(2)` for details." msgstr "" -#: library/os.rst:5150 +#: library/os.rst:5556 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: library/os.rst:5157 +#: library/os.rst:5563 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: library/os.rst:5159 +#: library/os.rst:5565 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: library/os.rst:5166 +#: library/os.rst:5568 +msgid "See also the :func:`process_cpu_count` function." +msgstr "" + +#: library/os.rst:5574 msgid "Miscellaneous System Information" msgstr "" -#: library/os.rst:5171 +#: library/os.rst:5579 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -5581,13 +6118,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: library/os.rst:5179 +#: library/os.rst:5587 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: library/os.rst:5182 +#: library/os.rst:5590 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -5595,34 +6132,62 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: library/os.rst:5192 +#: library/os.rst:5600 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: library/os.rst:5201 +#: library/os.rst:5609 msgid "" -"Return the number of logical CPUs in the system. Returns ``None`` if " +"Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: library/os.rst:5204 +#: library/os.rst:5612 +msgid "" +"The :func:`process_cpu_count` function can be used to get the number of " +"logical CPUs usable by the calling thread of the **current process**." +msgstr "" + +#: library/os.rst:5617 msgid "" -"This number is not equivalent to the number of logical CPUs the current " -"process can use. ``len(os.sched_getaffinity(0))`` gets the number of logical " -"CPUs the calling thread of the current process is restricted to" +"If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " +"set, :func:`cpu_count` returns the overridden value *n*." msgstr "" -#: library/os.rst:5213 +#: library/os.rst:5624 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: library/os.rst:5222 +#: library/os.rst:5633 +msgid "" +"Get the number of logical CPUs usable by the calling thread of the **current " +"process**. Returns ``None`` if undetermined. It can be less than :func:" +"`cpu_count` depending on the CPU affinity." +msgstr "" + +#: library/os.rst:5637 +msgid "" +"The :func:`cpu_count` function can be used to get the number of logical CPUs " +"in the **system**." +msgstr "" + +#: library/os.rst:5640 +msgid "" +"If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " +"set, :func:`process_cpu_count` returns the overridden value *n*." +msgstr "" + +#: library/os.rst:5643 +msgid "See also the :func:`sched_getaffinity` function." +msgstr "" + +#: library/os.rst:5650 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -5631,44 +6196,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: library/os.rst:5232 +#: library/os.rst:5660 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: library/os.rst:5238 +#: library/os.rst:5666 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "" -#: library/os.rst:5241 +#: library/os.rst:5669 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: library/os.rst:5244 +#: library/os.rst:5672 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: library/os.rst:5250 +#: library/os.rst:5678 msgid "" "The constant string used by the operating system to refer to the current " "directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: library/os.rst:5258 +#: library/os.rst:5686 msgid "" "The constant string used by the operating system to refer to the parent " "directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: library/os.rst:5267 +#: library/os.rst:5695 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -5677,7 +6242,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: library/os.rst:5277 +#: library/os.rst:5705 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -5685,27 +6250,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: library/os.rst:5286 +#: library/os.rst:5714 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: library/os.rst:5294 +#: library/os.rst:5722 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: library/os.rst:5301 +#: library/os.rst:5729 msgid "" "The default search path used by :func:`exec\\*p\\* ` and :func:" "`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " "Also available via :mod:`os.path`." msgstr "" -#: library/os.rst:5308 +#: library/os.rst:5736 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " @@ -5714,36 +6279,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: library/os.rst:5317 +#: library/os.rst:5745 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: library/os.rst:5328 +#: library/os.rst:5756 msgid "" "Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." "getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " "for what the different flags mean." msgstr "" -#: library/os.rst:5336 +#: library/os.rst:5764 msgid "Random numbers" msgstr "" -#: library/os.rst:5341 +#: library/os.rst:5769 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: library/os.rst:5344 +#: library/os.rst:5772 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: library/os.rst:5347 +#: library/os.rst:5775 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -5751,36 +6316,32 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: library/os.rst:5352 +#: library/os.rst:5780 msgid "" "The flags argument is a bit mask that can contain zero or more of the " "following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" "`GRND_NONBLOCK`." msgstr "" -#: library/os.rst:5356 +#: library/os.rst:5784 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: library/os.rst:5359 -msgid ":ref:`Availability `: Linux >= 3.17." -msgstr "" - -#: library/os.rst:5365 +#: library/os.rst:5793 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: library/os.rst:5367 +#: library/os.rst:5795 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: library/os.rst:5371 +#: library/os.rst:5799 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -5790,200 +6351,200 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: library/os.rst:5378 +#: library/os.rst:5806 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: library/os.rst:5382 +#: library/os.rst:5810 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: library/os.rst:5385 +#: library/os.rst:5813 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: library/os.rst:5389 +#: library/os.rst:5817 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: library/os.rst:5395 +#: library/os.rst:5823 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: library/os.rst:5399 +#: library/os.rst:5827 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: library/os.rst:5403 +#: library/os.rst:5831 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: library/os.rst:5409 +#: library/os.rst:5837 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: library/os.rst:5413 +#: library/os.rst:5841 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: library/os.rst:5420 +#: library/os.rst:5848 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." msgstr "" -#: library/os.rst:529 library/os.rst:731 +#: library/os.rst:552 library/os.rst:756 msgid "user" msgstr "" -#: library/os.rst:363 +#: library/os.rst:386 msgid "effective id" msgstr "" -#: library/os.rst:438 library/os.rst:456 library/os.rst:666 library/os.rst:4255 +#: library/os.rst:461 library/os.rst:479 library/os.rst:691 library/os.rst:4626 msgid "process" msgstr "" -#: library/os.rst:438 +#: library/os.rst:461 msgid "group" msgstr "" -#: library/os.rst:529 +#: library/os.rst:552 msgid "id" msgstr "" -#: library/os.rst:456 +#: library/os.rst:479 msgid "id of parent" msgstr "" -#: library/os.rst:666 +#: library/os.rst:691 msgid "scheduling priority" msgstr "" -#: library/os.rst:796 +#: library/os.rst:826 msgid "environment variables" msgstr "" -#: library/os.rst:552 +#: library/os.rst:575 msgid "setting" msgstr "" -#: library/os.rst:731 +#: library/os.rst:756 msgid "id, setting" msgstr "" -#: library/os.rst:764 +#: library/os.rst:789 msgid "gethostname() (in module socket)" msgstr "" -#: library/os.rst:764 +#: library/os.rst:789 msgid "gethostbyaddr() (in module socket)" msgstr "" -#: library/os.rst:2577 +#: library/os.rst:2732 msgid "deleting" msgstr "" -#: library/os.rst:2947 +#: library/os.rst:3102 msgid "module" msgstr "" -#: library/os.rst:1338 +#: library/os.rst:1387 msgid "pty" msgstr "" -#: library/os.rst:2376 library/os.rst:3481 library/os.rst:3580 +#: library/os.rst:2531 library/os.rst:3639 library/os.rst:3739 msgid "directory" msgstr "" -#: library/os.rst:1979 +#: library/os.rst:2118 msgid "changing" msgstr "" -#: library/os.rst:2376 +#: library/os.rst:2531 msgid "creating" msgstr "" -#: library/os.rst:2376 +#: library/os.rst:2531 msgid "UNC paths" msgstr "" -#: library/os.rst:2376 +#: library/os.rst:2531 msgid "and os.makedirs()" msgstr "" -#: library/os.rst:2947 +#: library/os.rst:3102 msgid "stat" msgstr "" -#: library/os.rst:3580 +#: library/os.rst:3739 msgid "walking" msgstr "" -#: library/os.rst:3580 +#: library/os.rst:3739 msgid "traversal" msgstr "" -#: library/os.rst:4255 +#: library/os.rst:4626 msgid "killing" msgstr "" -#: library/os.rst:4255 +#: library/os.rst:4626 msgid "signalling" msgstr "" -#: library/os.rst:5283 +#: library/os.rst:5711 msgid ". (dot)" msgstr "" -#: library/os.rst:5255 library/os.rst:5274 library/os.rst:5283 +#: library/os.rst:5683 library/os.rst:5702 library/os.rst:5711 msgid "in pathnames" msgstr "" -#: library/os.rst:5255 +#: library/os.rst:5683 msgid ".." msgstr "" -#: library/os.rst:5274 +#: library/os.rst:5702 msgid "/ (slash)" msgstr "" -#: library/os.rst:5264 +#: library/os.rst:5692 msgid "\\ (backslash)" msgstr "" -#: library/os.rst:5264 +#: library/os.rst:5692 msgid "in pathnames (Windows)" msgstr "" -#: library/os.rst:5290 +#: library/os.rst:5718 msgid ": (colon)" msgstr "" -#: library/os.rst:5290 +#: library/os.rst:5718 msgid "path separator (POSIX)" msgstr "" -#: library/os.rst:5290 +#: library/os.rst:5718 msgid "; (semicolon)" msgstr "" diff --git a/library/ossaudiodev.po b/library/ossaudiodev.po index a45afdc9..953a9449 100644 --- a/library/ossaudiodev.po +++ b/library/ossaudiodev.po @@ -8,565 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/ossaudiodev.rst:2 -msgid ":mod:`ossaudiodev` --- Access to OSS-compatible audio devices" +msgid ":mod:`!ossaudiodev` --- Access to OSS-compatible audio devices" msgstr "" -#: library/ossaudiodev.rst:12 +#: library/ossaudiodev.rst:10 msgid "" -"The :mod:`ossaudiodev` module is deprecated (see :pep:`PEP 594 " -"<594#ossaudiodev>` for details)." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/ossaudiodev.rst:15 +#: library/ossaudiodev.rst:14 msgid "" -"This module allows you to access the OSS (Open Sound System) audio " -"interface. OSS is available for a wide range of open-source and commercial " -"Unices, and is the standard audio interface for Linux and recent versions of " -"FreeBSD." -msgstr "" - -#: library/ossaudiodev.rst:47 -msgid "" -"Operations in this module now raise :exc:`OSError` where :exc:`IOError` was " -"raised." -msgstr "" - -#: library/ossaudiodev.rst:55 -msgid "" -"`Open Sound System Programmer's Guide `_" -msgstr "" - -#: library/ossaudiodev.rst:55 -msgid "the official documentation for the OSS C API" -msgstr "" - -#: library/ossaudiodev.rst:57 -msgid "" -"The module defines a large number of constants supplied by the OSS device " -"driver; see ```` on either Linux or FreeBSD for a listing." -msgstr "" - -#: library/ossaudiodev.rst:60 -msgid ":mod:`ossaudiodev` defines the following variables and functions:" -msgstr "" - -#: library/ossaudiodev.rst:65 -msgid "" -"This exception is raised on certain errors. The argument is a string " -"describing what went wrong." -msgstr "" - -#: library/ossaudiodev.rst:68 -msgid "" -"(If :mod:`ossaudiodev` receives an error from a system call such as :c:func:" -"`open`, :c:func:`write`, or :c:func:`ioctl`, it raises :exc:`OSError`. " -"Errors detected directly by :mod:`ossaudiodev` result in :exc:" -"`OSSAudioError`.)" -msgstr "" - -#: library/ossaudiodev.rst:72 -msgid "" -"(For backwards compatibility, the exception class is also available as " -"``ossaudiodev.error``.)" -msgstr "" - -#: library/ossaudiodev.rst:79 -msgid "" -"Open an audio device and return an OSS audio device object. This object " -"supports many file-like methods, such as :meth:`read`, :meth:`write`, and :" -"meth:`fileno` (although there are subtle differences between conventional " -"Unix read/write semantics and those of OSS audio devices). It also supports " -"a number of audio-specific methods; see below for the complete list of " -"methods." -msgstr "" - -#: library/ossaudiodev.rst:85 -msgid "" -"*device* is the audio device filename to use. If it is not specified, this " -"module first looks in the environment variable :envvar:`AUDIODEV` for a " -"device to use. If not found, it falls back to :file:`/dev/dsp`." -msgstr "" - -#: library/ossaudiodev.rst:89 -msgid "" -"*mode* is one of ``'r'`` for read-only (record) access, ``'w'`` for write-" -"only (playback) access and ``'rw'`` for both. Since many sound cards only " -"allow one process to have the recorder or player open at a time, it is a " -"good idea to open the device only for the activity needed. Further, some " -"sound cards are half-duplex: they can be opened for reading or writing, but " -"not both at once." -msgstr "" - -#: library/ossaudiodev.rst:96 -msgid "" -"Note the unusual calling syntax: the *first* argument is optional, and the " -"second is required. This is a historical artifact for compatibility with " -"the older :mod:`linuxaudiodev` module which :mod:`ossaudiodev` supersedes." -msgstr "" - -#: library/ossaudiodev.rst:107 -msgid "" -"Open a mixer device and return an OSS mixer device object. *device* is the " -"mixer device filename to use. If it is not specified, this module first " -"looks in the environment variable :envvar:`MIXERDEV` for a device to use. " -"If not found, it falls back to :file:`/dev/mixer`." -msgstr "" - -#: library/ossaudiodev.rst:116 -msgid "Audio Device Objects" -msgstr "" - -#: library/ossaudiodev.rst:118 -msgid "" -"Before you can write to or read from an audio device, you must call three " -"methods in the correct order:" -msgstr "" - -#: library/ossaudiodev.rst:121 -msgid ":meth:`setfmt` to set the output format" -msgstr "" - -#: library/ossaudiodev.rst:123 -msgid ":meth:`channels` to set the number of channels" -msgstr "" - -#: library/ossaudiodev.rst:125 -msgid ":meth:`speed` to set the sample rate" -msgstr "" - -#: library/ossaudiodev.rst:127 -msgid "" -"Alternately, you can use the :meth:`setparameters` method to set all three " -"audio parameters at once. This is more convenient, but may not be as " -"flexible in all cases." -msgstr "" - -#: library/ossaudiodev.rst:131 -msgid "" -"The audio device objects returned by :func:`.open` define the following " -"methods and (read-only) attributes:" -msgstr "" - -#: library/ossaudiodev.rst:137 -msgid "" -"Explicitly close the audio device. When you are done writing to or reading " -"from an audio device, you should explicitly close it. A closed device " -"cannot be used again." -msgstr "" - -#: library/ossaudiodev.rst:144 -msgid "Return the file descriptor associated with the device." -msgstr "" - -#: library/ossaudiodev.rst:149 -msgid "" -"Read *size* bytes from the audio input and return them as a Python string. " -"Unlike most Unix device drivers, OSS audio devices in blocking mode (the " -"default) will block :func:`read` until the entire requested amount of data " -"is available." -msgstr "" - -#: library/ossaudiodev.rst:157 -msgid "" -"Write a :term:`bytes-like object` *data* to the audio device and return the " -"number of bytes written. If the audio device is in blocking mode (the " -"default), the entire data is always written (again, this is different from " -"usual Unix device semantics). If the device is in non-blocking mode, some " -"data may not be written---see :meth:`writeall`." -msgstr "" - -#: library/ossaudiodev.rst:177 -msgid "Writable :term:`bytes-like object` is now accepted." -msgstr "" - -#: library/ossaudiodev.rst:169 -msgid "" -"Write a :term:`bytes-like object` *data* to the audio device: waits until " -"the audio device is able to accept data, writes as much data as it will " -"accept, and repeats until *data* has been completely written. If the device " -"is in blocking mode (the default), this has the same effect as :meth:" -"`write`; :meth:`writeall` is only useful in non-blocking mode. Has no " -"return value, since the amount of data written is always equal to the amount " -"of data supplied." -msgstr "" - -#: library/ossaudiodev.rst:181 -msgid "" -"Audio device objects also support the context management protocol, i.e. they " -"can be used in a :keyword:`with` statement." -msgstr "" - -#: library/ossaudiodev.rst:186 -msgid "" -"The following methods each map to exactly one :c:func:`ioctl` system call. " -"The correspondence is obvious: for example, :meth:`setfmt` corresponds to " -"the ``SNDCTL_DSP_SETFMT`` ioctl, and :meth:`sync` to ``SNDCTL_DSP_SYNC`` " -"(this can be useful when consulting the OSS documentation). If the " -"underlying :c:func:`ioctl` fails, they all raise :exc:`OSError`." -msgstr "" - -#: library/ossaudiodev.rst:195 -msgid "" -"Put the device into non-blocking mode. Once in non-blocking mode, there is " -"no way to return it to blocking mode." -msgstr "" - -#: library/ossaudiodev.rst:201 -msgid "" -"Return a bitmask of the audio output formats supported by the soundcard. " -"Some of the formats supported by OSS are:" -msgstr "" - -#: library/ossaudiodev.rst:205 -msgid "Format" -msgstr "" - -#: library/ossaudiodev.rst:259 -msgid "Description" -msgstr "" - -#: library/ossaudiodev.rst:207 -msgid ":const:`AFMT_MU_LAW`" -msgstr "" - -#: library/ossaudiodev.rst:207 -msgid "" -"a logarithmic encoding (used by Sun ``.au`` files and :file:`/dev/audio`)" -msgstr "" - -#: library/ossaudiodev.rst:210 -msgid ":const:`AFMT_A_LAW`" -msgstr "" - -#: library/ossaudiodev.rst:210 -msgid "a logarithmic encoding" -msgstr "" - -#: library/ossaudiodev.rst:212 -msgid ":const:`AFMT_IMA_ADPCM`" -msgstr "" - -#: library/ossaudiodev.rst:212 -msgid "" -"a 4:1 compressed format defined by the Interactive Multimedia Association" -msgstr "" - -#: library/ossaudiodev.rst:215 -msgid ":const:`AFMT_U8`" -msgstr "" - -#: library/ossaudiodev.rst:215 -msgid "Unsigned, 8-bit audio" -msgstr "" - -#: library/ossaudiodev.rst:217 -msgid ":const:`AFMT_S16_LE`" -msgstr "" - -#: library/ossaudiodev.rst:217 -msgid "" -"Signed, 16-bit audio, little-endian byte order (as used by Intel processors)" -msgstr "" - -#: library/ossaudiodev.rst:220 -msgid ":const:`AFMT_S16_BE`" -msgstr "" - -#: library/ossaudiodev.rst:220 -msgid "" -"Signed, 16-bit audio, big-endian byte order (as used by 68k, PowerPC, Sparc)" -msgstr "" - -#: library/ossaudiodev.rst:223 -msgid ":const:`AFMT_S8`" -msgstr "" - -#: library/ossaudiodev.rst:223 -msgid "Signed, 8 bit audio" -msgstr "" - -#: library/ossaudiodev.rst:225 -msgid ":const:`AFMT_U16_LE`" -msgstr "" - -#: library/ossaudiodev.rst:225 -msgid "Unsigned, 16-bit little-endian audio" -msgstr "" - -#: library/ossaudiodev.rst:227 -msgid ":const:`AFMT_U16_BE`" -msgstr "" - -#: library/ossaudiodev.rst:227 -msgid "Unsigned, 16-bit big-endian audio" -msgstr "" - -#: library/ossaudiodev.rst:230 -msgid "" -"Consult the OSS documentation for a full list of audio formats, and note " -"that most devices support only a subset of these formats. Some older " -"devices only support :const:`AFMT_U8`; the most common format used today is :" -"const:`AFMT_S16_LE`." -msgstr "" - -#: library/ossaudiodev.rst:238 -msgid "" -"Try to set the current audio format to *format*---see :meth:`getfmts` for a " -"list. Returns the audio format that the device was set to, which may not be " -"the requested format. May also be used to return the current audio format---" -"do this by passing an \"audio format\" of :const:`AFMT_QUERY`." -msgstr "" - -#: library/ossaudiodev.rst:246 -msgid "" -"Set the number of output channels to *nchannels*. A value of 1 indicates " -"monophonic sound, 2 stereophonic. Some devices may have more than 2 " -"channels, and some high-end devices may not support mono. Returns the number " -"of channels the device was set to." -msgstr "" - -#: library/ossaudiodev.rst:254 -msgid "" -"Try to set the audio sampling rate to *samplerate* samples per second. " -"Returns the rate actually set. Most sound devices don't support arbitrary " -"sampling rates. Common rates are:" -msgstr "" - -#: library/ossaudiodev.rst:259 -msgid "Rate" -msgstr "" - -#: library/ossaudiodev.rst:261 -msgid "8000" -msgstr "" - -#: library/ossaudiodev.rst:261 -msgid "default rate for :file:`/dev/audio`" -msgstr "" - -#: library/ossaudiodev.rst:263 -msgid "11025" -msgstr "" - -#: library/ossaudiodev.rst:263 -msgid "speech recording" -msgstr "" - -#: library/ossaudiodev.rst:265 -msgid "22050" -msgstr "" - -#: library/ossaudiodev.rst:267 -msgid "44100" -msgstr "" - -#: library/ossaudiodev.rst:267 -msgid "CD quality audio (at 16 bits/sample and 2 channels)" -msgstr "" - -#: library/ossaudiodev.rst:270 -msgid "96000" -msgstr "" - -#: library/ossaudiodev.rst:270 -msgid "DVD quality audio (at 24 bits/sample)" -msgstr "" - -#: library/ossaudiodev.rst:276 -msgid "" -"Wait until the sound device has played every byte in its buffer. (This " -"happens implicitly when the device is closed.) The OSS documentation " -"recommends closing and re-opening the device rather than using :meth:`sync`." -msgstr "" - -#: library/ossaudiodev.rst:283 -msgid "" -"Immediately stop playing or recording and return the device to a state where " -"it can accept commands. The OSS documentation recommends closing and re-" -"opening the device after calling :meth:`reset`." -msgstr "" - -#: library/ossaudiodev.rst:290 -msgid "" -"Tell the driver that there is likely to be a pause in the output, making it " -"possible for the device to handle the pause more intelligently. You might " -"use this after playing a spot sound effect, before waiting for user input, " -"or before doing disk I/O." -msgstr "" - -#: library/ossaudiodev.rst:295 -msgid "" -"The following convenience methods combine several ioctls, or one ioctl and " -"some simple calculations." -msgstr "" - -#: library/ossaudiodev.rst:301 -msgid "" -"Set the key audio sampling parameters---sample format, number of channels, " -"and sampling rate---in one method call. *format*, *nchannels*, and " -"*samplerate* should be as specified in the :meth:`setfmt`, :meth:`channels`, " -"and :meth:`speed` methods. If *strict* is true, :meth:`setparameters` " -"checks to see if each parameter was actually set to the requested value, and " -"raises :exc:`OSSAudioError` if not. Returns a tuple (*format*, *nchannels*, " -"*samplerate*) indicating the parameter values that were actually set by the " -"device driver (i.e., the same as the return values of :meth:`setfmt`, :meth:" -"`channels`, and :meth:`speed`)." -msgstr "" - -#: library/ossaudiodev.rst:311 -msgid "For example, ::" -msgstr "" - -#: library/ossaudiodev.rst:315 -msgid "is equivalent to ::" -msgstr "" - -#: library/ossaudiodev.rst:324 -msgid "Returns the size of the hardware buffer, in samples." -msgstr "" - -#: library/ossaudiodev.rst:329 -msgid "" -"Returns the number of samples that are in the hardware buffer yet to be " -"played." -msgstr "" - -#: library/ossaudiodev.rst:334 -msgid "" -"Returns the number of samples that could be queued into the hardware buffer " -"to be played without blocking." -msgstr "" - -#: library/ossaudiodev.rst:337 -msgid "Audio device objects also support several read-only attributes:" -msgstr "" - -#: library/ossaudiodev.rst:342 -msgid "Boolean indicating whether the device has been closed." -msgstr "" - -#: library/ossaudiodev.rst:347 -msgid "String containing the name of the device file." -msgstr "" - -#: library/ossaudiodev.rst:352 -msgid "The I/O mode for the file, either ``\"r\"``, ``\"rw\"``, or ``\"w\"``." -msgstr "" - -#: library/ossaudiodev.rst:358 -msgid "Mixer Device Objects" -msgstr "" - -#: library/ossaudiodev.rst:360 -msgid "The mixer object provides two file-like methods:" -msgstr "" - -#: library/ossaudiodev.rst:365 -msgid "" -"This method closes the open mixer device file. Any further attempts to use " -"the mixer after this file is closed will raise an :exc:`OSError`." -msgstr "" - -#: library/ossaudiodev.rst:371 -msgid "Returns the file handle number of the open mixer device file." -msgstr "" - -#: library/ossaudiodev.rst:373 -msgid "Mixer objects also support the context management protocol." -msgstr "" - -#: library/ossaudiodev.rst:377 -msgid "The remaining methods are specific to audio mixing:" -msgstr "" - -#: library/ossaudiodev.rst:382 -msgid "" -"This method returns a bitmask specifying the available mixer controls " -"(\"Control\" being a specific mixable \"channel\", such as :const:" -"`SOUND_MIXER_PCM` or :const:`SOUND_MIXER_SYNTH`). This bitmask indicates a " -"subset of all available mixer controls---the :const:`SOUND_MIXER_\\*` " -"constants defined at module level. To determine if, for example, the current " -"mixer object supports a PCM mixer, use the following Python code::" -msgstr "" - -#: library/ossaudiodev.rst:394 -msgid "" -"For most purposes, the :const:`SOUND_MIXER_VOLUME` (master volume) and :" -"const:`SOUND_MIXER_PCM` controls should suffice---but code that uses the " -"mixer should be flexible when it comes to choosing mixer controls. On the " -"Gravis Ultrasound, for example, :const:`SOUND_MIXER_VOLUME` does not exist." -msgstr "" - -#: library/ossaudiodev.rst:402 -msgid "" -"Returns a bitmask indicating stereo mixer controls. If a bit is set, the " -"corresponding control is stereo; if it is unset, the control is either " -"monophonic or not supported by the mixer (use in combination with :meth:" -"`controls` to determine which)." -msgstr "" - -#: library/ossaudiodev.rst:407 -msgid "" -"See the code example for the :meth:`controls` function for an example of " -"getting data from a bitmask." -msgstr "" - -#: library/ossaudiodev.rst:413 -msgid "" -"Returns a bitmask specifying the mixer controls that may be used to record. " -"See the code example for :meth:`controls` for an example of reading from a " -"bitmask." -msgstr "" - -#: library/ossaudiodev.rst:419 -msgid "" -"Returns the volume of a given mixer control. The returned volume is a 2-" -"tuple ``(left_volume,right_volume)``. Volumes are specified as numbers from " -"0 (silent) to 100 (full volume). If the control is monophonic, a 2-tuple is " -"still returned, but both volumes are the same." -msgstr "" - -#: library/ossaudiodev.rst:424 -msgid "" -"Raises :exc:`OSSAudioError` if an invalid control is specified, or :exc:" -"`OSError` if an unsupported control is specified." -msgstr "" - -#: library/ossaudiodev.rst:430 -msgid "" -"Sets the volume for a given mixer control to ``(left,right)``. ``left`` and " -"``right`` must be ints and between 0 (silent) and 100 (full volume). On " -"success, the new volume is returned as a 2-tuple. Note that this may not be " -"exactly the same as the volume specified, because of the limited resolution " -"of some soundcard's mixers." -msgstr "" - -#: library/ossaudiodev.rst:436 -msgid "" -"Raises :exc:`OSSAudioError` if an invalid mixer control was specified, or if " -"the specified volumes were out-of-range." -msgstr "" - -#: library/ossaudiodev.rst:442 -msgid "" -"This method returns a bitmask indicating which control(s) are currently " -"being used as a recording source." -msgstr "" - -#: library/ossaudiodev.rst:448 -msgid "" -"Call this function to specify a recording source. Returns a bitmask " -"indicating the new recording source (or sources) if successful; raises :exc:" -"`OSError` if an invalid source was specified. To set the current recording " -"source to the microphone input::" +"The last version of Python that provided the :mod:`!ossaudiodev` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/pathlib.po b/library/pathlib.po index aa7e6109..fe7ace79 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -8,23 +8,24 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: library/pathlib.rst:3 -msgid ":mod:`pathlib` --- Object-oriented filesystem paths" +#: library/pathlib.rst:2 +msgid ":mod:`!pathlib` --- Object-oriented filesystem paths" msgstr "" -#: library/pathlib.rst:10 -msgid "**Source code:** :source:`Lib/pathlib.py`" +#: library/pathlib.rst:9 +msgid "**Source code:** :source:`Lib/pathlib/`" msgstr "" -#: library/pathlib.rst:16 +#: library/pathlib.rst:15 msgid "" "This module offers classes representing filesystem paths with semantics " "appropriate for different operating systems. Path classes are divided " @@ -33,7 +34,17 @@ msgid "" "inherit from pure paths but also provide I/O operations." msgstr "" -#: library/pathlib.rst:26 +#: library/pathlib.rst:21 +msgid "" +"Inheritance diagram showing the classes available in pathlib. The\n" +"most basic class is PurePath, which has three direct subclasses:\n" +"PurePosixPath, PureWindowsPath, and Path. Further to these four\n" +"classes, there are two classes that use multiple inheritance:\n" +"PosixPath subclasses PurePosixPath and Path, and WindowsPath\n" +"subclasses PureWindowsPath and Path." +msgstr "" + +#: library/pathlib.rst:31 msgid "" "If you've never used this module before or just aren't sure which class is " "right for your task, :class:`Path` is most likely what you need. It " @@ -41,80 +52,141 @@ msgid "" "code is running on." msgstr "" -#: library/pathlib.rst:30 +#: library/pathlib.rst:35 msgid "Pure paths are useful in some special cases; for example:" msgstr "" -#: library/pathlib.rst:32 +#: library/pathlib.rst:37 msgid "" "If you want to manipulate Windows paths on a Unix machine (or vice versa). " "You cannot instantiate a :class:`WindowsPath` when running on Unix, but you " "can instantiate :class:`PureWindowsPath`." msgstr "" -#: library/pathlib.rst:35 +#: library/pathlib.rst:40 msgid "" "You want to make sure that your code only manipulates paths without actually " "accessing the OS. In this case, instantiating one of the pure classes may be " "useful since those simply don't have any OS-accessing operations." msgstr "" -#: library/pathlib.rst:40 +#: library/pathlib.rst:45 msgid ":pep:`428`: The pathlib module -- object-oriented filesystem paths." msgstr "" -#: library/pathlib.rst:43 +#: library/pathlib.rst:48 msgid "" "For low-level path manipulation on strings, you can also use the :mod:`os." "path` module." msgstr "" -#: library/pathlib.rst:48 +#: library/pathlib.rst:53 msgid "Basic use" msgstr "" -#: library/pathlib.rst:50 +#: library/pathlib.rst:55 msgid "Importing the main class::" msgstr "" -#: library/pathlib.rst:54 +#: library/pathlib.rst:57 +msgid ">>> from pathlib import Path" +msgstr "" + +#: library/pathlib.rst:59 msgid "Listing subdirectories::" msgstr "" #: library/pathlib.rst:61 +msgid "" +">>> p = Path('.')\n" +">>> [x for x in p.iterdir() if x.is_dir()]\n" +"[PosixPath('.hg'), PosixPath('docs'), PosixPath('dist'),\n" +" PosixPath('__pycache__'), PosixPath('build')]" +msgstr "" + +#: library/pathlib.rst:66 msgid "Listing Python source files in this directory tree::" msgstr "" #: library/pathlib.rst:68 +msgid "" +">>> list(p.glob('**/*.py'))\n" +"[PosixPath('test_pathlib.py'), PosixPath('setup.py'),\n" +" PosixPath('pathlib.py'), PosixPath('docs/conf.py'),\n" +" PosixPath('build/lib/pathlib.py')]" +msgstr "" + +#: library/pathlib.rst:73 msgid "Navigating inside a directory tree::" msgstr "" -#: library/pathlib.rst:77 +#: library/pathlib.rst:75 +msgid "" +">>> p = Path('/etc')\n" +">>> q = p / 'init.d' / 'reboot'\n" +">>> q\n" +"PosixPath('/etc/init.d/reboot')\n" +">>> q.resolve()\n" +"PosixPath('/etc/rc.d/init.d/halt')" +msgstr "" + +#: library/pathlib.rst:82 msgid "Querying path properties::" msgstr "" #: library/pathlib.rst:84 +msgid "" +">>> q.exists()\n" +"True\n" +">>> q.is_dir()\n" +"False" +msgstr "" + +#: library/pathlib.rst:89 msgid "Opening a file::" msgstr "" -#: library/pathlib.rst:94 +#: library/pathlib.rst:91 +msgid "" +">>> with q.open() as f: f.readline()\n" +"...\n" +"'#!/bin/bash\\n'" +msgstr "" + +#: library/pathlib.rst:97 +msgid "Exceptions" +msgstr "" + +#: library/pathlib.rst:101 +msgid "" +"An exception inheriting :exc:`NotImplementedError` that is raised when an " +"unsupported operation is called on a path object." +msgstr "" + +#: library/pathlib.rst:110 msgid "Pure paths" msgstr "" -#: library/pathlib.rst:96 +#: library/pathlib.rst:112 msgid "" "Pure path objects provide path-handling operations which don't actually " "access a filesystem. There are three ways to access these classes, which we " "also call *flavours*:" msgstr "" -#: library/pathlib.rst:102 +#: library/pathlib.rst:118 msgid "" "A generic class that represents the system's path flavour (instantiating it " "creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::" msgstr "" -#: library/pathlib.rst:108 +#: library/pathlib.rst:121 +msgid "" +">>> PurePath('setup.py') # Running on a Unix machine\n" +"PurePosixPath('setup.py')" +msgstr "" + +#: library/pathlib.rst:124 msgid "" "Each element of *pathsegments* can be either a string representing a path " "segment, or an object implementing the :class:`os.PathLike` interface where " @@ -122,88 +194,165 @@ msgid "" "path object::" msgstr "" -#: library/pathlib.rst:118 +#: library/pathlib.rst:129 +msgid "" +">>> PurePath('foo', 'some/path', 'bar')\n" +"PurePosixPath('foo/some/path/bar')\n" +">>> PurePath(Path('foo'), Path('bar'))\n" +"PurePosixPath('foo/bar')" +msgstr "" + +#: library/pathlib.rst:134 msgid "When *pathsegments* is empty, the current directory is assumed::" msgstr "" -#: library/pathlib.rst:123 +#: library/pathlib.rst:136 +msgid "" +">>> PurePath()\n" +"PurePosixPath('.')" +msgstr "" + +#: library/pathlib.rst:139 msgid "" "If a segment is an absolute path, all previous segments are ignored (like :" "func:`os.path.join`)::" msgstr "" -#: library/pathlib.rst:131 +#: library/pathlib.rst:142 +msgid "" +">>> PurePath('/etc', '/usr', 'lib64')\n" +"PurePosixPath('/usr/lib64')\n" +">>> PureWindowsPath('c:/Windows', 'd:bar')\n" +"PureWindowsPath('d:bar')" +msgstr "" + +#: library/pathlib.rst:147 msgid "" "On Windows, the drive is not reset when a rooted relative path segment (e." "g., ``r'\\foo'``) is encountered::" msgstr "" -#: library/pathlib.rst:137 +#: library/pathlib.rst:150 +msgid "" +">>> PureWindowsPath('c:/Windows', '/Program Files')\n" +"PureWindowsPath('c:/Program Files')" +msgstr "" + +#: library/pathlib.rst:153 msgid "" "Spurious slashes and single dots are collapsed, but double dots (``'..'``) " "and leading double slashes (``'//'``) are not, since this would change the " "meaning of a path for various reasons (e.g. symbolic links, UNC paths)::" msgstr "" -#: library/pathlib.rst:150 +#: library/pathlib.rst:157 +msgid "" +">>> PurePath('foo//bar')\n" +"PurePosixPath('foo/bar')\n" +">>> PurePath('//foo/bar')\n" +"PurePosixPath('//foo/bar')\n" +">>> PurePath('foo/./bar')\n" +"PurePosixPath('foo/bar')\n" +">>> PurePath('foo/../bar')\n" +"PurePosixPath('foo/../bar')" +msgstr "" + +#: library/pathlib.rst:166 msgid "" "(a naïve approach would make ``PurePosixPath('foo/../bar')`` equivalent to " "``PurePosixPath('bar')``, which is wrong if ``foo`` is a symbolic link to " "another directory)" msgstr "" -#: library/pathlib.rst:154 +#: library/pathlib.rst:170 msgid "" "Pure path objects implement the :class:`os.PathLike` interface, allowing " "them to be used anywhere the interface is accepted." msgstr "" -#: library/pathlib.rst:157 +#: library/pathlib.rst:173 msgid "Added support for the :class:`os.PathLike` interface." msgstr "" -#: library/pathlib.rst:162 +#: library/pathlib.rst:178 msgid "" "A subclass of :class:`PurePath`, this path flavour represents non-Windows " "filesystem paths::" msgstr "" -#: library/pathlib.rst:180 library/pathlib.rst:759 library/pathlib.rst:769 +#: library/pathlib.rst:181 +msgid "" +">>> PurePosixPath('/etc/hosts')\n" +"PurePosixPath('/etc/hosts')" +msgstr "" + +#: library/pathlib.rst:196 library/pathlib.rst:789 library/pathlib.rst:804 msgid "*pathsegments* is specified similarly to :class:`PurePath`." msgstr "" -#: library/pathlib.rst:172 +#: library/pathlib.rst:188 msgid "" "A subclass of :class:`PurePath`, this path flavour represents Windows " "filesystem paths, including `UNC paths`_::" msgstr "" -#: library/pathlib.rst:184 +#: library/pathlib.rst:191 +msgid "" +">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" +"PureWindowsPath('c:/Users/Ximénez')\n" +">>> PureWindowsPath('//server/share/file')\n" +"PureWindowsPath('//server/share/file')" +msgstr "" + +#: library/pathlib.rst:200 msgid "" "Regardless of the system you're running on, you can instantiate all of these " "classes, since they don't provide any operation that does system calls." msgstr "" -#: library/pathlib.rst:189 +#: library/pathlib.rst:205 msgid "General properties" msgstr "" -#: library/pathlib.rst:191 +#: library/pathlib.rst:207 msgid "" "Paths are immutable and :term:`hashable`. Paths of a same flavour are " "comparable and orderable. These properties respect the flavour's case-" "folding semantics::" msgstr "" -#: library/pathlib.rst:204 +#: library/pathlib.rst:211 +msgid "" +">>> PurePosixPath('foo') == PurePosixPath('FOO')\n" +"False\n" +">>> PureWindowsPath('foo') == PureWindowsPath('FOO')\n" +"True\n" +">>> PureWindowsPath('FOO') in { PureWindowsPath('foo') }\n" +"True\n" +">>> PureWindowsPath('C:') < PureWindowsPath('d:')\n" +"True" +msgstr "" + +#: library/pathlib.rst:220 msgid "Paths of a different flavour compare unequal and cannot be ordered::" msgstr "" -#: library/pathlib.rst:215 +#: library/pathlib.rst:222 +msgid "" +">>> PureWindowsPath('foo') == PurePosixPath('foo')\n" +"False\n" +">>> PureWindowsPath('foo') < PurePosixPath('foo')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: '<' not supported between instances of 'PureWindowsPath' and " +"'PurePosixPath'" +msgstr "" + +#: library/pathlib.rst:231 msgid "Operators" msgstr "" -#: library/pathlib.rst:217 +#: library/pathlib.rst:233 msgid "" "The slash operator helps create child paths, like :func:`os.path.join`. If " "the argument is an absolute path, the previous path is ignored. On Windows, " @@ -211,257 +360,552 @@ msgid "" "``r'\\foo'``)::" msgstr "" -#: library/pathlib.rst:235 +#: library/pathlib.rst:238 +msgid "" +">>> p = PurePath('/etc')\n" +">>> p\n" +"PurePosixPath('/etc')\n" +">>> p / 'init.d' / 'apache2'\n" +"PurePosixPath('/etc/init.d/apache2')\n" +">>> q = PurePath('bin')\n" +">>> '/usr' / q\n" +"PurePosixPath('/usr/bin')\n" +">>> p / '/an_absolute_path'\n" +"PurePosixPath('/an_absolute_path')\n" +">>> PureWindowsPath('c:/Windows', '/Program Files')\n" +"PureWindowsPath('c:/Program Files')" +msgstr "" + +#: library/pathlib.rst:251 msgid "" "A path object can be used anywhere an object implementing :class:`os." "PathLike` is accepted::" msgstr "" -#: library/pathlib.rst:243 +#: library/pathlib.rst:254 +msgid "" +">>> import os\n" +">>> p = PurePath('/etc')\n" +">>> os.fspath(p)\n" +"'/etc'" +msgstr "" + +#: library/pathlib.rst:259 msgid "" "The string representation of a path is the raw filesystem path itself (in " "native form, e.g. with backslashes under Windows), which you can pass to any " "function taking a file path as a string::" msgstr "" -#: library/pathlib.rst:254 +#: library/pathlib.rst:263 +msgid "" +">>> p = PurePath('/etc')\n" +">>> str(p)\n" +"'/etc'\n" +">>> p = PureWindowsPath('c:/Program Files')\n" +">>> str(p)\n" +"'c:\\\\Program Files'" +msgstr "" + +#: library/pathlib.rst:270 msgid "" "Similarly, calling :class:`bytes` on a path gives the raw filesystem path as " "a bytes object, as encoded by :func:`os.fsencode`::" msgstr "" -#: library/pathlib.rst:261 +#: library/pathlib.rst:273 +msgid "" +">>> bytes(p)\n" +"b'/etc'" +msgstr "" + +#: library/pathlib.rst:277 msgid "" "Calling :class:`bytes` is only recommended under Unix. Under Windows, the " "unicode form is the canonical representation of filesystem paths." msgstr "" -#: library/pathlib.rst:266 +#: library/pathlib.rst:282 msgid "Accessing individual parts" msgstr "" -#: library/pathlib.rst:268 +#: library/pathlib.rst:284 msgid "" "To access the individual \"parts\" (components) of a path, use the following " "property:" msgstr "" -#: library/pathlib.rst:273 +#: library/pathlib.rst:289 msgid "A tuple giving access to the path's various components::" msgstr "" -#: library/pathlib.rst:283 +#: library/pathlib.rst:291 +msgid "" +">>> p = PurePath('/usr/bin/python3')\n" +">>> p.parts\n" +"('/', 'usr', 'bin', 'python3')\n" +"\n" +">>> p = PureWindowsPath('c:/Program Files/PSF')\n" +">>> p.parts\n" +"('c:\\\\', 'Program Files', 'PSF')" +msgstr "" + +#: library/pathlib.rst:299 msgid "(note how the drive and local root are regrouped in a single part)" msgstr "" -#: library/pathlib.rst:287 +#: library/pathlib.rst:303 msgid "Methods and properties" msgstr "" -#: library/pathlib.rst:293 +#: library/pathlib.rst:309 msgid "Pure paths provide the following methods and properties:" msgstr "" -#: library/pathlib.rst:297 +#: library/pathlib.rst:313 +msgid "" +"The implementation of the :mod:`os.path` module used for low-level path " +"parsing and joining: either :mod:`!posixpath` or :mod:`!ntpath`." +msgstr "" + +#: library/pathlib.rst:320 msgid "A string representing the drive letter or name, if any::" msgstr "" -#: library/pathlib.rst:306 +#: library/pathlib.rst:322 +msgid "" +">>> PureWindowsPath('c:/Program Files/').drive\n" +"'c:'\n" +">>> PureWindowsPath('/Program Files/').drive\n" +"''\n" +">>> PurePosixPath('/etc').drive\n" +"''" +msgstr "" + +#: library/pathlib.rst:329 msgid "UNC shares are also considered drives::" msgstr "" -#: library/pathlib.rst:313 +#: library/pathlib.rst:331 +msgid "" +">>> PureWindowsPath('//host/share/foo.txt').drive\n" +"'\\\\\\\\host\\\\share'" +msgstr "" + +#: library/pathlib.rst:336 msgid "A string representing the (local or global) root, if any::" msgstr "" -#: library/pathlib.rst:322 +#: library/pathlib.rst:338 +msgid "" +">>> PureWindowsPath('c:/Program Files/').root\n" +"'\\\\'\n" +">>> PureWindowsPath('c:Program Files/').root\n" +"''\n" +">>> PurePosixPath('/etc').root\n" +"'/'" +msgstr "" + +#: library/pathlib.rst:345 msgid "UNC shares always have a root::" msgstr "" -#: library/pathlib.rst:327 +#: library/pathlib.rst:347 +msgid "" +">>> PureWindowsPath('//host/share').root\n" +"'\\\\'" +msgstr "" + +#: library/pathlib.rst:350 msgid "" "If the path starts with more than two successive slashes, :class:`~pathlib." "PurePosixPath` collapses them::" msgstr "" -#: library/pathlib.rst:339 +#: library/pathlib.rst:353 +msgid "" +">>> PurePosixPath('//etc').root\n" +"'//'\n" +">>> PurePosixPath('///etc').root\n" +"'/'\n" +">>> PurePosixPath('////etc').root\n" +"'/'" +msgstr "" + +#: library/pathlib.rst:362 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " "paragraph `4.11 Pathname Resolution `_:" msgstr "" -#: library/pathlib.rst:343 +#: library/pathlib.rst:366 msgid "" "*\"A pathname that begins with two successive slashes may be interpreted in " "an implementation-defined manner, although more than two leading slashes " "shall be treated as a single slash.\"*" msgstr "" -#: library/pathlib.rst:349 +#: library/pathlib.rst:372 msgid "The concatenation of the drive and root::" msgstr "" -#: library/pathlib.rst:363 +#: library/pathlib.rst:374 +msgid "" +">>> PureWindowsPath('c:/Program Files/').anchor\n" +"'c:\\\\'\n" +">>> PureWindowsPath('c:Program Files/').anchor\n" +"'c:'\n" +">>> PurePosixPath('/etc').anchor\n" +"'/'\n" +">>> PureWindowsPath('//host/share').anchor\n" +"'\\\\\\\\host\\\\share\\\\'" +msgstr "" + +#: library/pathlib.rst:386 msgid "" "An immutable sequence providing access to the logical ancestors of the path::" msgstr "" -#: library/pathlib.rst:374 +#: library/pathlib.rst:389 +msgid "" +">>> p = PureWindowsPath('c:/foo/bar/setup.py')\n" +">>> p.parents[0]\n" +"PureWindowsPath('c:/foo/bar')\n" +">>> p.parents[1]\n" +"PureWindowsPath('c:/foo')\n" +">>> p.parents[2]\n" +"PureWindowsPath('c:/')" +msgstr "" + +#: library/pathlib.rst:397 msgid "" "The parents sequence now supports :term:`slices ` and negative index " "values." msgstr "" -#: library/pathlib.rst:379 +#: library/pathlib.rst:402 msgid "The logical parent of the path::" msgstr "" -#: library/pathlib.rst:385 +#: library/pathlib.rst:404 +msgid "" +">>> p = PurePosixPath('/a/b/c/d')\n" +">>> p.parent\n" +"PurePosixPath('/a/b/c')" +msgstr "" + +#: library/pathlib.rst:408 msgid "You cannot go past an anchor, or empty path::" msgstr "" -#: library/pathlib.rst:395 +#: library/pathlib.rst:410 +msgid "" +">>> p = PurePosixPath('/')\n" +">>> p.parent\n" +"PurePosixPath('/')\n" +">>> p = PurePosixPath('.')\n" +">>> p.parent\n" +"PurePosixPath('.')" +msgstr "" + +#: library/pathlib.rst:418 msgid "This is a purely lexical operation, hence the following behaviour::" msgstr "" -#: library/pathlib.rst:401 +#: library/pathlib.rst:420 +msgid "" +">>> p = PurePosixPath('foo/..')\n" +">>> p.parent\n" +"PurePosixPath('foo')" +msgstr "" + +#: library/pathlib.rst:424 msgid "" "If you want to walk an arbitrary filesystem path upwards, it is recommended " "to first call :meth:`Path.resolve` so as to resolve symlinks and eliminate " "``\"..\"`` components." msgstr "" -#: library/pathlib.rst:408 +#: library/pathlib.rst:431 msgid "" "A string representing the final path component, excluding the drive and " "root, if any::" msgstr "" -#: library/pathlib.rst:414 +#: library/pathlib.rst:434 +msgid "" +">>> PurePosixPath('my/library/setup.py').name\n" +"'setup.py'" +msgstr "" + +#: library/pathlib.rst:437 msgid "UNC drive names are not considered::" msgstr "" -#: library/pathlib.rst:424 -msgid "The file extension of the final component, if any::" +#: library/pathlib.rst:439 +msgid "" +">>> PureWindowsPath('//some/share/setup.py').name\n" +"'setup.py'\n" +">>> PureWindowsPath('//some/share').name\n" +"''" +msgstr "" + +#: library/pathlib.rst:447 +msgid "The last dot-separated portion of the final component, if any::" +msgstr "" + +#: library/pathlib.rst:449 +msgid "" +">>> PurePosixPath('my/library/setup.py').suffix\n" +"'.py'\n" +">>> PurePosixPath('my/library.tar.gz').suffix\n" +"'.gz'\n" +">>> PurePosixPath('my/library').suffix\n" +"''" +msgstr "" + +#: library/pathlib.rst:456 +msgid "This is commonly called the file extension." +msgstr "" + +#: library/pathlib.rst:475 +msgid "A single dot (\"``.``\") is considered a valid suffix." msgstr "" -#: library/pathlib.rst:436 -msgid "A list of the path's file extensions::" +#: library/pathlib.rst:464 +msgid "A list of the path's suffixes, often called file extensions::" msgstr "" -#: library/pathlib.rst:448 +#: library/pathlib.rst:466 +msgid "" +">>> PurePosixPath('my/library.tar.gar').suffixes\n" +"['.tar', '.gar']\n" +">>> PurePosixPath('my/library.tar.gz').suffixes\n" +"['.tar', '.gz']\n" +">>> PurePosixPath('my/library').suffixes\n" +"[]" +msgstr "" + +#: library/pathlib.rst:480 msgid "The final path component, without its suffix::" msgstr "" -#: library/pathlib.rst:460 +#: library/pathlib.rst:482 +msgid "" +">>> PurePosixPath('my/library.tar.gz').stem\n" +"'library.tar'\n" +">>> PurePosixPath('my/library.tar').stem\n" +"'library'\n" +">>> PurePosixPath('my/library').stem\n" +"'library'" +msgstr "" + +#: library/pathlib.rst:492 msgid "" "Return a string representation of the path with forward slashes (``/``)::" msgstr "" -#: library/pathlib.rst:471 +#: library/pathlib.rst:494 msgid "" -"Represent the path as a ``file`` URI. :exc:`ValueError` is raised if the " -"path isn't absolute." +">>> p = PureWindowsPath('c:\\\\windows')\n" +">>> str(p)\n" +"'c:\\\\windows'\n" +">>> p.as_posix()\n" +"'c:/windows'" msgstr "" -#: library/pathlib.rst:484 +#: library/pathlib.rst:503 msgid "" "Return whether the path is absolute or not. A path is considered absolute " "if it has both a root and (if the flavour allows) a drive::" msgstr "" -#: library/pathlib.rst:504 +#: library/pathlib.rst:506 +msgid "" +">>> PurePosixPath('/a/b').is_absolute()\n" +"True\n" +">>> PurePosixPath('a/b').is_absolute()\n" +"False\n" +"\n" +">>> PureWindowsPath('c:/a/b').is_absolute()\n" +"True\n" +">>> PureWindowsPath('/a/b').is_absolute()\n" +"False\n" +">>> PureWindowsPath('c:').is_absolute()\n" +"False\n" +">>> PureWindowsPath('//some/share').is_absolute()\n" +"True" +msgstr "" + +#: library/pathlib.rst:523 msgid "Return whether or not this path is relative to the *other* path." msgstr "" -#: library/pathlib.rst:512 +#: library/pathlib.rst:531 msgid "" "This method is string-based; it neither accesses the filesystem nor treats " "\"``..``\" segments specially. The following code is equivalent:" msgstr "" -#: library/pathlib.rst:523 +#: library/pathlib.rst:542 msgid "" "Passing additional arguments is deprecated; if supplied, they are joined " "with *other*." msgstr "" -#: library/pathlib.rst:528 +#: library/pathlib.rst:547 msgid "" "With :class:`PureWindowsPath`, return ``True`` if the path is considered " "reserved under Windows, ``False`` otherwise. With :class:`PurePosixPath`, " "``False`` is always returned." msgstr "" -#: library/pathlib.rst:537 +#: library/pathlib.rst:551 msgid "" -"File system calls on reserved paths can fail mysteriously or have unintended " -"effects." +"Windows path names that contain a colon, or end with a dot or a space, are " +"considered reserved. UNC paths may be reserved." msgstr "" -#: library/pathlib.rst:543 +#: library/pathlib.rst:555 msgid "" -"Calling this method is equivalent to combining the path with each of the " -"given *pathsegments* in turn::" +"This method is deprecated; use :func:`os.path.isreserved` to detect reserved " +"paths on Windows." msgstr "" -#: library/pathlib.rst:558 +#: library/pathlib.rst:561 msgid "" -"Match this path against the provided glob-style pattern. Return ``True`` if " -"matching is successful, ``False`` otherwise." +"Calling this method is equivalent to combining the path with each of the " +"given *pathsegments* in turn::" msgstr "" -#: library/pathlib.rst:561 +#: library/pathlib.rst:564 msgid "" -"If *pattern* is relative, the path can be either relative or absolute, and " -"matching is done from the right::" +">>> PurePosixPath('/etc').joinpath('passwd')\n" +"PurePosixPath('/etc/passwd')\n" +">>> PurePosixPath('/etc').joinpath(PurePosixPath('passwd'))\n" +"PurePosixPath('/etc/passwd')\n" +">>> PurePosixPath('/etc').joinpath('init.d', 'apache2')\n" +"PurePosixPath('/etc/init.d/apache2')\n" +">>> PureWindowsPath('c:').joinpath('/Program Files')\n" +"PureWindowsPath('c:/Program Files')" msgstr "" -#: library/pathlib.rst:571 +#: library/pathlib.rst:576 msgid "" -"If *pattern* is absolute, the path must be absolute, and the whole path must " -"match::" +"Match this path against the provided glob-style pattern. Return ``True`` if " +"matching is successful, ``False`` otherwise. For example::" msgstr "" #: library/pathlib.rst:579 msgid "" -"The *pattern* may be another path object; this speeds up matching the same " -"pattern against multiple files::" +">>> PurePath('a/b.py').full_match('a/*.py')\n" +"True\n" +">>> PurePath('a/b.py').full_match('*.py')\n" +"False\n" +">>> PurePath('/a/b/c.py').full_match('/a/**')\n" +"True\n" +">>> PurePath('/a/b/c.py').full_match('**/*.py')\n" +"True" msgstr "" -#: library/pathlib.rst:586 -msgid "Accepts an object implementing the :class:`os.PathLike` interface." +#: library/pathlib.rst:1349 +msgid ":ref:`pathlib-pattern-language` documentation." msgstr "" -#: library/pathlib.rst:589 +#: library/pathlib.rst:591 msgid "As with other methods, case-sensitivity follows platform defaults::" msgstr "" -#: library/pathlib.rst:596 +#: library/pathlib.rst:593 +msgid "" +">>> PurePosixPath('b.py').full_match('*.PY')\n" +"False\n" +">>> PureWindowsPath('b.py').full_match('*.PY')\n" +"True" +msgstr "" + +#: library/pathlib.rst:598 msgid "" "Set *case_sensitive* to ``True`` or ``False`` to override this behaviour." msgstr "" -#: library/pathlib.rst:945 library/pathlib.rst:1358 +#: library/pathlib.rst:605 +msgid "" +"Match this path against the provided non-recursive glob-style pattern. " +"Return ``True`` if matching is successful, ``False`` otherwise." +msgstr "" + +#: library/pathlib.rst:608 +msgid "" +"This method is similar to :meth:`~PurePath.full_match`, but empty patterns " +"aren't allowed (:exc:`ValueError` is raised), the recursive wildcard " +"\"``**``\" isn't supported (it acts like non-recursive \"``*``\"), and if a " +"relative pattern is provided, then matching is done from the right::" +msgstr "" + +#: library/pathlib.rst:613 +msgid "" +">>> PurePath('a/b.py').match('*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('b/*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('a/*.py')\n" +"False" +msgstr "" + +#: library/pathlib.rst:1368 library/pathlib.rst:1393 +msgid "The *pattern* parameter accepts a :term:`path-like object`." +msgstr "" + +#: library/pathlib.rst:1362 library/pathlib.rst:1387 msgid "The *case_sensitive* parameter was added." msgstr "" -#: library/pathlib.rst:604 +#: library/pathlib.rst:629 msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" msgstr "" -#: library/pathlib.rst:619 +#: library/pathlib.rst:632 +msgid "" +">>> p = PurePosixPath('/etc/passwd')\n" +">>> p.relative_to('/')\n" +"PurePosixPath('etc/passwd')\n" +">>> p.relative_to('/etc')\n" +"PurePosixPath('passwd')\n" +">>> p.relative_to('/usr')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"pathlib.py\", line 941, in relative_to\n" +" raise ValueError(error_message.format(str(self), str(formatted)))\n" +"ValueError: '/etc/passwd' is not in the subpath of '/usr' OR one path is " +"relative and the other is absolute." +msgstr "" + +#: library/pathlib.rst:644 msgid "" -"When *walk_up* is False (the default), the path must start with *other*. " -"When the argument is True, ``..`` entries may be added to form the relative " +"When *walk_up* is false (the default), the path must start with *other*. " +"When the argument is true, ``..`` entries may be added to form the relative " "path. In all other cases, such as the paths referencing different drives, :" "exc:`ValueError` is raised.::" msgstr "" -#: library/pathlib.rst:634 +#: library/pathlib.rst:649 +msgid "" +">>> p.relative_to('/usr', walk_up=True)\n" +"PurePosixPath('../etc/passwd')\n" +">>> p.relative_to('foo', walk_up=True)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"pathlib.py\", line 941, in relative_to\n" +" raise ValueError(error_message.format(str(self), str(formatted)))\n" +"ValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is " +"relative and the other is absolute." +msgstr "" + +#: library/pathlib.rst:659 msgid "" "This function is part of :class:`PurePath` and works with strings. It does " "not check or access the underlying file structure. This can impact the " @@ -469,38 +913,93 @@ msgid "" "call :meth:`~Path.resolve` first if necessary to resolve symlinks." msgstr "" -#: library/pathlib.rst:640 +#: library/pathlib.rst:665 msgid "" "The *walk_up* parameter was added (old behavior is the same as " "``walk_up=False``)." msgstr "" -#: library/pathlib.rst:645 +#: library/pathlib.rst:670 msgid "" "Passing additional positional arguments is deprecated; if supplied, they are " "joined with *other*." msgstr "" -#: library/pathlib.rst:650 +#: library/pathlib.rst:675 msgid "" "Return a new path with the :attr:`name` changed. If the original path " "doesn't have a name, ValueError is raised::" msgstr "" -#: library/pathlib.rst:667 +#: library/pathlib.rst:678 +msgid "" +">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" +">>> p.with_name('setup.py')\n" +"PureWindowsPath('c:/Downloads/setup.py')\n" +">>> p = PureWindowsPath('c:/')\n" +">>> p.with_name('setup.py')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"/home/antoine/cpython/default/Lib/pathlib.py\", line 751, in " +"with_name\n" +" raise ValueError(\"%r has an empty name\" % (self,))\n" +"ValueError: PureWindowsPath('c:/') has an empty name" +msgstr "" + +#: library/pathlib.rst:692 msgid "" "Return a new path with the :attr:`stem` changed. If the original path " "doesn't have a name, ValueError is raised::" msgstr "" -#: library/pathlib.rst:691 +#: library/pathlib.rst:695 +msgid "" +">>> p = PureWindowsPath('c:/Downloads/draft.txt')\n" +">>> p.with_stem('final')\n" +"PureWindowsPath('c:/Downloads/final.txt')\n" +">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" +">>> p.with_stem('lib')\n" +"PureWindowsPath('c:/Downloads/lib.gz')\n" +">>> p = PureWindowsPath('c:/')\n" +">>> p.with_stem('')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"/home/antoine/cpython/default/Lib/pathlib.py\", line 861, in " +"with_stem\n" +" return self.with_name(stem + self.suffix)\n" +" File \"/home/antoine/cpython/default/Lib/pathlib.py\", line 851, in " +"with_name\n" +" raise ValueError(\"%r has an empty name\" % (self,))\n" +"ValueError: PureWindowsPath('c:/') has an empty name" +msgstr "" + +#: library/pathlib.rst:716 msgid "" "Return a new path with the :attr:`suffix` changed. If the original path " "doesn't have a suffix, the new *suffix* is appended instead. If the " "*suffix* is an empty string, the original suffix is removed::" msgstr "" -#: library/pathlib.rst:708 +#: library/pathlib.rst:720 +msgid "" +">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" +">>> p.with_suffix('.bz2')\n" +"PureWindowsPath('c:/Downloads/pathlib.tar.bz2')\n" +">>> p = PureWindowsPath('README')\n" +">>> p.with_suffix('.txt')\n" +"PureWindowsPath('README.txt')\n" +">>> p = PureWindowsPath('README.txt')\n" +">>> p.with_suffix('')\n" +"PureWindowsPath('README')" +msgstr "" + +#: library/pathlib.rst:732 +msgid "" +"A single dot (\"``.``\") is considered a valid suffix. In previous " +"versions, :exc:`ValueError` is raised if a single dot is supplied." +msgstr "" + +#: library/pathlib.rst:738 msgid "" "Create a new path object of the same type by combining the given " "*pathsegments*. This method is called whenever a derivative path is created, " @@ -508,199 +1007,452 @@ msgid "" "this method to pass information to derivative paths, for example::" msgstr "" -#: library/pathlib.rst:734 +#: library/pathlib.rst:743 +msgid "" +"from pathlib import PurePosixPath\n" +"\n" +"class MyPath(PurePosixPath):\n" +" def __init__(self, *pathsegments, session_id):\n" +" super().__init__(*pathsegments)\n" +" self.session_id = session_id\n" +"\n" +" def with_segments(self, *pathsegments):\n" +" return type(self)(*pathsegments, session_id=self.session_id)\n" +"\n" +"etc = MyPath('/etc', session_id=42)\n" +"hosts = etc / 'hosts'\n" +"print(hosts.session_id) # 42" +msgstr "" + +#: library/pathlib.rst:764 msgid "Concrete paths" msgstr "" -#: library/pathlib.rst:736 +#: library/pathlib.rst:766 msgid "" "Concrete paths are subclasses of the pure path classes. In addition to " "operations provided by the latter, they also provide methods to do system " "calls on path objects. There are three ways to instantiate concrete paths:" msgstr "" -#: library/pathlib.rst:742 +#: library/pathlib.rst:772 msgid "" "A subclass of :class:`PurePath`, this class represents concrete paths of the " "system's path flavour (instantiating it creates either a :class:`PosixPath` " "or a :class:`WindowsPath`)::" msgstr "" -#: library/pathlib.rst:753 +#: library/pathlib.rst:776 +msgid "" +">>> Path('setup.py')\n" +"PosixPath('setup.py')" +msgstr "" + +#: library/pathlib.rst:783 msgid "" "A subclass of :class:`Path` and :class:`PurePosixPath`, this class " "represents concrete non-Windows filesystem paths::" msgstr "" -#: library/pathlib.rst:763 +#: library/pathlib.rst:786 +msgid "" +">>> PosixPath('/etc/hosts')\n" +"PosixPath('/etc/hosts')" +msgstr "" + +#: library/pathlib.rst:791 +msgid "" +"Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" +"`NotImplementedError` was raised instead." +msgstr "" + +#: library/pathlib.rst:798 msgid "" "A subclass of :class:`Path` and :class:`PureWindowsPath`, this class " "represents concrete Windows filesystem paths::" msgstr "" -#: library/pathlib.rst:771 +#: library/pathlib.rst:801 +msgid "" +">>> WindowsPath('c:/', 'Users', 'Ximénez')\n" +"WindowsPath('c:/Users/Ximénez')" +msgstr "" + +#: library/pathlib.rst:806 +msgid "" +"Raises :exc:`UnsupportedOperation` on non-Windows platforms. In previous " +"versions, :exc:`NotImplementedError` was raised instead." +msgstr "" + +#: library/pathlib.rst:811 msgid "" "You can only instantiate the class flavour that corresponds to your system " "(allowing system calls on non-compatible path flavours could lead to bugs or " "failures in your application)::" msgstr "" -#: library/pathlib.rst:791 -msgid "Methods" +#: library/pathlib.rst:815 +msgid "" +">>> import os\n" +">>> os.name\n" +"'posix'\n" +">>> Path('setup.py')\n" +"PosixPath('setup.py')\n" +">>> PosixPath('setup.py')\n" +"PosixPath('setup.py')\n" +">>> WindowsPath('setup.py')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"pathlib.py\", line 798, in __new__\n" +" % (cls.__name__,))\n" +"UnsupportedOperation: cannot instantiate 'WindowsPath' on your system" msgstr "" -#: library/pathlib.rst:793 +#: library/pathlib.rst:829 msgid "" -"Concrete paths provide the following methods in addition to pure paths " -"methods. Many of these methods can raise an :exc:`OSError` if a system call " +"Some concrete path methods can raise an :exc:`OSError` if a system call " "fails (for example because the path doesn't exist)." msgstr "" -#: library/pathlib.rst:799 -msgid "" -":meth:`~Path.exists()`, :meth:`~Path.is_dir()`, :meth:`~Path.is_file()`, :" -"meth:`~Path.is_mount()`, :meth:`~Path.is_symlink()`, :meth:`~Path." -"is_block_device()`, :meth:`~Path.is_char_device()`, :meth:`~Path." -"is_fifo()`, :meth:`~Path.is_socket()` now return ``False`` instead of " -"raising an exception for paths that contain characters unrepresentable at " -"the OS level." +#: library/pathlib.rst:834 +msgid "Parsing and generating URIs" msgstr "" -#: library/pathlib.rst:809 +#: library/pathlib.rst:836 msgid "" -"Return a new path object representing the current directory (as returned by :" -"func:`os.getcwd`)::" +"Concrete path objects can be created from, and represented as, 'file' URIs " +"conforming to :rfc:`8089`." msgstr "" -#: library/pathlib.rst:818 +#: library/pathlib.rst:841 msgid "" -"Return a new path object representing the user's home directory (as returned " -"by :func:`os.path.expanduser` with ``~`` construct). If the home directory " -"can't be resolved, :exc:`RuntimeError` is raised." +"File URIs are not portable across machines with different :ref:`filesystem " +"encodings `." msgstr "" -#: library/pathlib.rst:832 -msgid "" -"Return a :class:`os.stat_result` object containing information about this " -"path, like :func:`os.stat`. The result is looked up at each call to this " -"method." +#: library/pathlib.rst:846 +msgid "Return a new path object from parsing a 'file' URI. For example::" msgstr "" -#: library/pathlib.rst:835 +#: library/pathlib.rst:848 msgid "" -"This method normally follows symlinks; to stat a symlink add the argument " -"``follow_symlinks=False``, or use :meth:`~Path.lstat`." -msgstr "" - -#: library/pathlib.rst:866 library/pathlib.rst:887 -msgid "The *follow_symlinks* parameter was added." +">>> p = Path.from_uri('file:///etc/hosts')\n" +"PosixPath('/etc/hosts')" msgstr "" #: library/pathlib.rst:851 -msgid "Change the file mode and permissions, like :func:`os.chmod`." +msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" msgstr "" #: library/pathlib.rst:853 msgid "" -"This method normally follows symlinks. Some Unix flavours support changing " -"permissions on the symlink itself; on these platforms you may add the " -"argument ``follow_symlinks=False``, or use :meth:`~Path.lchmod`." +">>> p = Path.from_uri('file:///c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file://server/share')\n" +"WindowsPath('//server/share')" msgstr "" -#: library/pathlib.rst:871 -msgid "Return ``True`` if the path points to an existing file or directory." +#: library/pathlib.rst:858 +msgid "Several variant forms are supported::" msgstr "" -#: library/pathlib.rst:873 +#: library/pathlib.rst:860 msgid "" -"This method normally follows symlinks; to check if a symlink exists, add the " -"argument ``follow_symlinks=False``." +">>> p = Path.from_uri('file:////server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file://///server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file:c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file:/c|/windows')\n" +"WindowsPath('c:/windows')" msgstr "" -#: library/pathlib.rst:892 +#: library/pathlib.rst:869 msgid "" -"Return a new path with expanded ``~`` and ``~user`` constructs, as returned " -"by :meth:`os.path.expanduser`. If a home directory can't be resolved, :exc:" -"`RuntimeError` is raised." +":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " +"parsed path isn't absolute." msgstr "" -#: library/pathlib.rst:907 +#: library/pathlib.rst:874 msgid "" -"Glob the given relative *pattern* in the directory represented by this path, " -"yielding all matching files (of any kind)::" +"The URL authority is discarded if it matches the local hostname. Otherwise, " +"if the authority isn't empty or ``localhost``, then on Windows a UNC path is " +"returned (as before), and on other platforms a :exc:`ValueError` is raised." msgstr "" -#: library/pathlib.rst:915 +#: library/pathlib.rst:883 msgid "" -"Patterns are the same as for :mod:`fnmatch`, with the addition of \"``**``\" " -"which means \"this directory and all subdirectories, recursively\". In " -"other words, it enables recursive globbing::" +"Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " +"isn't absolute." msgstr "" -#: library/pathlib.rst:926 +#: library/pathlib.rst:886 msgid "" -"This method calls :meth:`Path.is_dir` on the top-level directory and " -"propagates any :exc:`OSError` exception that is raised. Subsequent :exc:" -"`OSError` exceptions from scanning directories are suppressed." +">>> p = PosixPath('/etc/passwd')\n" +">>> p.as_uri()\n" +"'file:///etc/passwd'\n" +">>> p = WindowsPath('c:/Windows')\n" +">>> p.as_uri()\n" +"'file:///c:/Windows'" msgstr "" -#: library/pathlib.rst:1347 +#: library/pathlib.rst:897 msgid "" -"By default, or when the *case_sensitive* keyword-only argument is set to " -"``None``, this method matches paths using platform-specific casing rules: " -"typically, case-sensitive on POSIX, and case-insensitive on Windows. Set " -"*case_sensitive* to ``True`` or ``False`` to override this behaviour." +"Calling this method from :class:`PurePath` rather than :class:`Path` is " +"possible but deprecated. The method's use of :func:`os.fsencode` makes it " +"strictly impure." msgstr "" -#: library/pathlib.rst:936 -msgid "" -"Using the \"``**``\" pattern in large directory trees may consume an " -"inordinate amount of time." +#: library/pathlib.rst:903 +msgid "Expanding and resolving paths" msgstr "" -#: library/pathlib.rst:939 +#: library/pathlib.rst:907 msgid "" -"Raises an :ref:`auditing event ` ``pathlib.Path.glob`` with " -"arguments ``self``, ``pattern``." +"Return a new path object representing the user's home directory (as returned " +"by :func:`os.path.expanduser` with ``~`` construct). If the home directory " +"can't be resolved, :exc:`RuntimeError` is raised." msgstr "" -#: library/pathlib.rst:1354 +#: library/pathlib.rst:913 msgid "" -"Return only directories if *pattern* ends with a pathname components " -"separator (:data:`~os.sep` or :data:`~os.altsep`)." +">>> Path.home()\n" +"PosixPath('/home/antoine')" msgstr "" -#: library/pathlib.rst:951 +#: library/pathlib.rst:921 msgid "" -"Return the name of the group owning the file. :exc:`KeyError` is raised if " -"the file's gid isn't found in the system database." -msgstr "" +"Return a new path with expanded ``~`` and ``~user`` constructs, as returned " +"by :meth:`os.path.expanduser`. If a home directory can't be resolved, :exc:" +"`RuntimeError` is raised." +msgstr "" + +#: library/pathlib.rst:927 +msgid "" +">>> p = PosixPath('~/films/Monty Python')\n" +">>> p.expanduser()\n" +"PosixPath('/home/eric/films/Monty Python')" +msgstr "" + +#: library/pathlib.rst:936 +msgid "" +"Return a new path object representing the current directory (as returned by :" +"func:`os.getcwd`)::" +msgstr "" + +#: library/pathlib.rst:939 +msgid "" +">>> Path.cwd()\n" +"PosixPath('/home/antoine/pathlib')" +msgstr "" + +#: library/pathlib.rst:945 +msgid "" +"Make the path absolute, without normalization or resolving symlinks. Returns " +"a new path object::" +msgstr "" + +#: library/pathlib.rst:948 +msgid "" +">>> p = Path('tests')\n" +">>> p\n" +"PosixPath('tests')\n" +">>> p.absolute()\n" +"PosixPath('/home/antoine/pathlib/tests')" +msgstr "" #: library/pathlib.rst:957 msgid "" -"Return ``True`` if the path points to a directory (or a symbolic link " -"pointing to a directory), ``False`` if it points to another kind of file." +"Make the path absolute, resolving any symlinks. A new path object is " +"returned::" msgstr "" -#: library/pathlib.rst:969 library/pathlib.rst:1020 library/pathlib.rst:1038 +#: library/pathlib.rst:960 msgid "" -"``False`` is also returned if the path doesn't exist or is a broken symlink; " -"other errors (such as permission errors) are propagated." +">>> p = Path()\n" +">>> p\n" +"PosixPath('.')\n" +">>> p.resolve()\n" +"PosixPath('/home/antoine/pathlib')" msgstr "" #: library/pathlib.rst:966 msgid "" -"Return ``True`` if the path points to a regular file (or a symbolic link " -"pointing to a regular file), ``False`` if it points to another kind of file." +"\"``..``\" components are also eliminated (this is the only method to do " +"so)::" +msgstr "" + +#: library/pathlib.rst:968 +msgid "" +">>> p = Path('docs/../setup.py')\n" +">>> p.resolve()\n" +"PosixPath('/home/antoine/pathlib/setup.py')" +msgstr "" + +#: library/pathlib.rst:972 +msgid "" +"If a path doesn't exist or a symlink loop is encountered, and *strict* is " +"``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is " +"resolved as far as possible and any remainder is appended without checking " +"whether it exists." +msgstr "" + +#: library/pathlib.rst:977 +msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." +msgstr "" + +#: library/pathlib.rst:980 +msgid "" +"Symlink loops are treated like other errors: :exc:`OSError` is raised in " +"strict mode, and no exception is raised in non-strict mode. In previous " +"versions, :exc:`RuntimeError` is raised no matter the value of *strict*." +msgstr "" + +#: library/pathlib.rst:988 +msgid "" +"Return the path to which the symbolic link points (as returned by :func:`os." +"readlink`)::" +msgstr "" + +#: library/pathlib.rst:991 +msgid "" +">>> p = Path('mylink')\n" +">>> p.symlink_to('setup.py')\n" +">>> p.readlink()\n" +"PosixPath('setup.py')" msgstr "" -#: library/pathlib.rst:975 +#: library/pathlib.rst:998 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.readlink` is not available. " +"In previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: library/pathlib.rst:1004 +msgid "Querying file type and status" +msgstr "" + +#: library/pathlib.rst:1008 +msgid "" +":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:" +"`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :" +"meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " +"now return ``False`` instead of raising an exception for paths that contain " +"characters unrepresentable at the OS level." +msgstr "" + +#: library/pathlib.rst:1017 +msgid "" +"The methods given above now return ``False`` instead of raising any :exc:" +"`OSError` exception from the operating system. In previous versions, some " +"kinds of :exc:`OSError` exception are raised, and others suppressed. The new " +"behaviour is consistent with :func:`os.path.exists`, :func:`os.path.isdir`, " +"etc. Use :meth:`~Path.stat` to retrieve the file status without suppressing " +"exceptions." +msgstr "" + +#: library/pathlib.rst:1027 +msgid "" +"Return an :class:`os.stat_result` object containing information about this " +"path, like :func:`os.stat`. The result is looked up at each call to this " +"method." +msgstr "" + +#: library/pathlib.rst:1030 +msgid "" +"This method normally follows symlinks; to stat a symlink add the argument " +"``follow_symlinks=False``, or use :meth:`~Path.lstat`." +msgstr "" + +#: library/pathlib.rst:1035 +msgid "" +">>> p = Path('setup.py')\n" +">>> p.stat().st_size\n" +"956\n" +">>> p.stat().st_mtime\n" +"1327883547.852554" +msgstr "" + +#: library/pathlib.rst:1071 library/pathlib.rst:1099 library/pathlib.rst:1736 +#: library/pathlib.rst:1757 +msgid "The *follow_symlinks* parameter was added." +msgstr "" + +#: library/pathlib.rst:1047 +msgid "" +"Like :meth:`Path.stat` but, if the path points to a symbolic link, return " +"the symbolic link's information rather than its target's." +msgstr "" + +#: library/pathlib.rst:1053 +msgid "" +"Return ``True`` if the path points to an existing file or directory. " +"``False`` will be returned if the path is invalid, inaccessible or missing. " +"Use :meth:`Path.stat` to distinguish between these cases." +msgstr "" + +#: library/pathlib.rst:1057 +msgid "" +"This method normally follows symlinks; to check if a symlink exists, add the " +"argument ``follow_symlinks=False``." +msgstr "" + +#: library/pathlib.rst:1062 +msgid "" +">>> Path('.').exists()\n" +"True\n" +">>> Path('setup.py').exists()\n" +"True\n" +">>> Path('/etc').exists()\n" +"True\n" +">>> Path('nonexistentfile').exists()\n" +"False" +msgstr "" + +#: library/pathlib.rst:1077 +msgid "" +"Return ``True`` if the path points to a regular file. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a regular file. Use :meth:`Path.stat` to distinguish " +"between these cases." +msgstr "" + +#: library/pathlib.rst:1082 +msgid "" +"This method normally follows symlinks; to exclude symlinks, add the argument " +"``follow_symlinks=False``." +msgstr "" + +#: library/pathlib.rst:1091 +msgid "" +"Return ``True`` if the path points to a directory. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a directory. Use :meth:`Path.stat` to distinguish " +"between these cases." +msgstr "" + +#: library/pathlib.rst:1096 +msgid "" +"This method normally follows symlinks; to exclude symlinks to directories, " +"add the argument ``follow_symlinks=False``." +msgstr "" + +#: library/pathlib.rst:1105 +msgid "" +"Return ``True`` if the path points to a symbolic link, even if that symlink " +"is broken. ``False`` will be returned if the path is invalid, inaccessible " +"or missing, or if it points to something other than a symbolic link. Use :" +"meth:`Path.stat` to distinguish between these cases." +msgstr "" + +#: library/pathlib.rst:1113 msgid "" "Return ``True`` if the path points to a junction, and ``False`` for any " "other type of file. Currently only Windows supports junctions." msgstr "" -#: library/pathlib.rst:983 +#: library/pathlib.rst:1121 msgid "" "Return ``True`` if the path is a :dfn:`mount point`: a point in a file " "system where a different file system has been mounted. On POSIX, the " @@ -712,74 +1464,301 @@ msgid "" "mounted filesystem directory." msgstr "" -#: library/pathlib.rst:994 +#: library/pathlib.rst:1132 msgid "Windows support was added." msgstr "" -#: library/pathlib.rst:1000 +#: library/pathlib.rst:1137 msgid "" -"Return ``True`` if the path points to a symbolic link, ``False`` otherwise." +"Return ``True`` if the path points to a Unix socket. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a Unix socket. Use :meth:`Path.stat` to distinguish " +"between these cases." msgstr "" -#: library/pathlib.rst:1002 +#: library/pathlib.rst:1145 msgid "" -"``False`` is also returned if the path doesn't exist; other errors (such as " -"permission errors) are propagated." +"Return ``True`` if the path points to a FIFO. ``False`` will be returned if " +"the path is invalid, inaccessible or missing, or if it points to something " +"other than a FIFO. Use :meth:`Path.stat` to distinguish between these cases." msgstr "" -#: library/pathlib.rst:1008 +#: library/pathlib.rst:1153 msgid "" -"Return ``True`` if the path points to a Unix socket (or a symbolic link " -"pointing to a Unix socket), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a block device. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a block device. Use :meth:`Path.stat` to distinguish " +"between these cases." msgstr "" -#: library/pathlib.rst:1017 +#: library/pathlib.rst:1161 msgid "" -"Return ``True`` if the path points to a FIFO (or a symbolic link pointing to " -"a FIFO), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a character device. ``False`` will be " +"returned if the path is invalid, inaccessible or missing, or if it points to " +"something other than a character device. Use :meth:`Path.stat` to " +"distinguish between these cases." msgstr "" -#: library/pathlib.rst:1026 +#: library/pathlib.rst:1169 msgid "" -"Return ``True`` if the path points to a block device (or a symbolic link " -"pointing to a block device), ``False`` if it points to another kind of file." +"Return whether this path points to the same file as *other_path*, which can " +"be either a Path object, or a string. The semantics are similar to :func:" +"`os.path.samefile` and :func:`os.path.samestat`." msgstr "" -#: library/pathlib.rst:1035 +#: library/pathlib.rst:1173 msgid "" -"Return ``True`` if the path points to a character device (or a symbolic link " -"pointing to a character device), ``False`` if it points to another kind of " -"file." +"An :exc:`OSError` can be raised if either file cannot be accessed for some " +"reason." msgstr "" -#: library/pathlib.rst:1044 +#: library/pathlib.rst:1178 +msgid "" +">>> p = Path('spam')\n" +">>> q = Path('eggs')\n" +">>> p.samefile(q)\n" +"False\n" +">>> p.samefile('spam')\n" +"True" +msgstr "" + +#: library/pathlib.rst:1190 +msgid "" +"A :class:`~pathlib.types.PathInfo` object that supports querying file type " +"information. The object exposes methods that cache their results, which can " +"help reduce the number of system calls needed when switching on file type. " +"For example::" +msgstr "" + +#: library/pathlib.rst:1195 +msgid "" +">>> p = Path('src')\n" +">>> if p.info.is_symlink():\n" +"... print('symlink')\n" +"... elif p.info.is_dir():\n" +"... print('directory')\n" +"... elif p.info.exists():\n" +"... print('something else')\n" +"... else:\n" +"... print('not found')\n" +"...\n" +"directory" +msgstr "" + +#: library/pathlib.rst:1207 +msgid "" +"If the path was generated from :meth:`Path.iterdir` then this attribute is " +"initialized with some information about the file type gleaned from scanning " +"the parent directory. Merely accessing :attr:`Path.info` does not perform " +"any filesystem queries." +msgstr "" + +#: library/pathlib.rst:1212 +msgid "" +"To fetch up-to-date information, it's best to call :meth:`Path.is_dir`, :" +"meth:`~Path.is_file` and :meth:`~Path.is_symlink` rather than methods of " +"this attribute. There is no way to reset the cache; instead you can create a " +"new path object with an empty info cache via ``p = Path(p)``." +msgstr "" + +#: library/pathlib.rst:1221 +msgid "Reading and writing files" +msgstr "" + +#: library/pathlib.rst:1226 +msgid "" +"Open the file pointed to by the path, like the built-in :func:`open` " +"function does::" +msgstr "" + +#: library/pathlib.rst:1229 +msgid "" +">>> p = Path('setup.py')\n" +">>> with p.open() as f:\n" +"... f.readline()\n" +"...\n" +"'#!/usr/bin/env python3\\n'" +msgstr "" + +#: library/pathlib.rst:1238 +msgid "Return the decoded contents of the pointed-to file as a string::" +msgstr "" + +#: library/pathlib.rst:1273 +msgid "" +">>> p = Path('my_text_file')\n" +">>> p.write_text('Text file contents')\n" +"18\n" +">>> p.read_text()\n" +"'Text file contents'" +msgstr "" + +#: library/pathlib.rst:1246 +msgid "" +"The file is opened and then closed. The optional parameters have the same " +"meaning as in :func:`open`." +msgstr "" + +#: library/pathlib.rst:1284 +msgid "The *newline* parameter was added." +msgstr "" + +#: library/pathlib.rst:1257 +msgid "Return the binary contents of the pointed-to file as a bytes object::" +msgstr "" + +#: library/pathlib.rst:1293 +msgid "" +">>> p = Path('my_binary_file')\n" +">>> p.write_bytes(b'Binary file contents')\n" +"20\n" +">>> p.read_bytes()\n" +"b'Binary file contents'" +msgstr "" + +#: library/pathlib.rst:1270 +msgid "" +"Open the file pointed to in text mode, write *data* to it, and close the " +"file::" +msgstr "" + +#: library/pathlib.rst:1279 +msgid "" +"An existing file of the same name is overwritten. The optional parameters " +"have the same meaning as in :func:`open`." +msgstr "" + +#: library/pathlib.rst:1290 +msgid "" +"Open the file pointed to in bytes mode, write *data* to it, and close the " +"file::" +msgstr "" + +#: library/pathlib.rst:1299 +msgid "An existing file of the same name is overwritten." +msgstr "" + +#: library/pathlib.rst:1305 +msgid "Reading directories" +msgstr "" + +#: library/pathlib.rst:1309 msgid "" "When the path points to a directory, yield path objects of the directory " "contents::" msgstr "" -#: library/pathlib.rst:1058 +#: library/pathlib.rst:1312 +msgid "" +">>> p = Path('docs')\n" +">>> for child in p.iterdir(): child\n" +"...\n" +"PosixPath('docs/conf.py')\n" +"PosixPath('docs/_templates')\n" +"PosixPath('docs/make.bat')\n" +"PosixPath('docs/index.rst')\n" +"PosixPath('docs/_build')\n" +"PosixPath('docs/_static')\n" +"PosixPath('docs/Makefile')" +msgstr "" + +#: library/pathlib.rst:1323 msgid "" "The children are yielded in arbitrary order, and the special entries ``'.'`` " "and ``'..'`` are not included. If a file is removed from or added to the " -"directory after creating the iterator, whether a path object for that file " -"be included is unspecified." +"directory after creating the iterator, it is unspecified whether a path " +"object for that file is included." +msgstr "" + +#: library/pathlib.rst:1328 +msgid "" +"If the path is not a directory or otherwise inaccessible, :exc:`OSError` is " +"raised." +msgstr "" + +#: library/pathlib.rst:1334 +msgid "" +"Glob the given relative *pattern* in the directory represented by this path, " +"yielding all matching files (of any kind)::" +msgstr "" + +#: library/pathlib.rst:1337 +msgid "" +">>> sorted(Path('.').glob('*.py'))\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +"py')]\n" +">>> sorted(Path('.').glob('*/*.py'))\n" +"[PosixPath('docs/conf.py')]\n" +">>> sorted(Path('.').glob('**/*.py'))\n" +"[PosixPath('build/lib/pathlib.py'),\n" +" PosixPath('docs/conf.py'),\n" +" PosixPath('pathlib.py'),\n" +" PosixPath('setup.py'),\n" +" PosixPath('test_pathlib.py')]" msgstr "" -#: library/pathlib.rst:1065 +#: library/pathlib.rst:1351 +msgid "" +"By default, or when the *case_sensitive* keyword-only argument is set to " +"``None``, this method matches paths using platform-specific casing rules: " +"typically, case-sensitive on POSIX, and case-insensitive on Windows. Set " +"*case_sensitive* to ``True`` or ``False`` to override this behaviour." +msgstr "" + +#: library/pathlib.rst:1356 +msgid "" +"By default, or when the *recurse_symlinks* keyword-only argument is set to " +"``False``, this method follows symlinks except when expanding \"``**``\" " +"wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks." +msgstr "" + +#: library/pathlib.rst:1360 +msgid "" +"Raises an :ref:`auditing event ` ``pathlib.Path.glob`` with " +"arguments ``self``, ``pattern``." +msgstr "" + +#: library/pathlib.rst:1390 +msgid "The *recurse_symlinks* parameter was added." +msgstr "" + +#: library/pathlib.rst:1371 +msgid "" +"Any :exc:`OSError` exceptions raised from scanning the filesystem are " +"suppressed. In previous versions, such exceptions are suppressed in many " +"cases, but not all." +msgstr "" + +#: library/pathlib.rst:1379 +msgid "" +"Glob the given relative *pattern* recursively. This is like calling :func:" +"`Path.glob` with \"``**/``\" added in front of the *pattern*." +msgstr "" + +#: library/pathlib.rst:1383 +msgid ":ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation." +msgstr "" + +#: library/pathlib.rst:1385 +msgid "" +"Raises an :ref:`auditing event ` ``pathlib.Path.rglob`` with " +"arguments ``self``, ``pattern``." +msgstr "" + +#: library/pathlib.rst:1399 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up." msgstr "" -#: library/pathlib.rst:1068 +#: library/pathlib.rst:1402 msgid "" "For each directory in the directory tree rooted at *self* (including *self* " "but excluding '.' and '..'), the method yields a 3-tuple of ``(dirpath, " "dirnames, filenames)``." msgstr "" -#: library/pathlib.rst:1072 +#: library/pathlib.rst:1406 msgid "" "*dirpath* is a :class:`Path` to the directory currently being walked, " "*dirnames* is a list of strings for the names of subdirectories in *dirpath* " @@ -789,7 +1768,7 @@ msgid "" "name``. Whether or not the lists are sorted is file system-dependent." msgstr "" -#: library/pathlib.rst:1080 +#: library/pathlib.rst:1414 msgid "" "If the optional argument *top_down* is true (which is the default), the " "triple for a directory is generated before the triples for any of its " @@ -800,7 +1779,7 @@ msgid "" "the directory and its subdirectories are walked." msgstr "" -#: library/pathlib.rst:1088 +#: library/pathlib.rst:1422 msgid "" "When *top_down* is true, the caller can modify the *dirnames* list in-place " "(for example, using :keyword:`del` or slice assignment), and :meth:`Path." @@ -809,589 +1788,1027 @@ msgid "" "order of visiting, or even to inform :meth:`Path.walk` about directories the " "caller creates or renames before it resumes :meth:`Path.walk` again. " "Modifying *dirnames* when *top_down* is false has no effect on the behavior " -"of :meth:`Path.walk()` since the directories in *dirnames* have already been " +"of :meth:`Path.walk` since the directories in *dirnames* have already been " "generated by the time *dirnames* is yielded to the caller." msgstr "" -#: library/pathlib.rst:1098 -msgid "" -"By default, errors from :func:`os.scandir` are ignored. If the optional " -"argument *on_error* is specified, it should be a callable; it will be called " -"with one argument, an :exc:`OSError` instance. The callable can handle the " -"error to continue the walk or re-raise it to stop the walk. Note that the " -"filename is available as the ``filename`` attribute of the exception object." +#: library/pathlib.rst:1432 +msgid "" +"By default, errors from :func:`os.scandir` are ignored. If the optional " +"argument *on_error* is specified, it should be a callable; it will be called " +"with one argument, an :exc:`OSError` instance. The callable can handle the " +"error to continue the walk or re-raise it to stop the walk. Note that the " +"filename is available as the ``filename`` attribute of the exception object." +msgstr "" + +#: library/pathlib.rst:1438 +msgid "" +"By default, :meth:`Path.walk` does not follow symbolic links, and instead " +"adds them to the *filenames* list. Set *follow_symlinks* to true to resolve " +"symlinks and place them in *dirnames* and *filenames* as appropriate for " +"their targets, and consequently visit directories pointed to by symlinks " +"(where supported)." +msgstr "" + +#: library/pathlib.rst:1445 +msgid "" +"Be aware that setting *follow_symlinks* to true can lead to infinite " +"recursion if a link points to a parent directory of itself. :meth:`Path." +"walk` does not keep track of the directories it has already visited." +msgstr "" + +#: library/pathlib.rst:1450 +msgid "" +":meth:`Path.walk` assumes the directories it walks are not modified during " +"execution. For example, if a directory from *dirnames* has been replaced " +"with a symlink and *follow_symlinks* is false, :meth:`Path.walk` will still " +"try to descend into it. To prevent such behavior, remove directories from " +"*dirnames* as appropriate." +msgstr "" + +#: library/pathlib.rst:1458 +msgid "" +"Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " +"*filenames* if *follow_symlinks* is false." +msgstr "" + +#: library/pathlib.rst:1461 +msgid "" +"This example displays the number of bytes used by all files in each " +"directory, while ignoring ``__pycache__`` directories::" +msgstr "" + +#: library/pathlib.rst:1464 +msgid "" +"from pathlib import Path\n" +"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." +"walk(on_error=print):\n" +" print(\n" +" root,\n" +" \"consumes\",\n" +" sum((root / file).stat().st_size for file in files),\n" +" \"bytes in\",\n" +" len(files),\n" +" \"non-directory files\"\n" +" )\n" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__')" +msgstr "" + +#: library/pathlib.rst:1477 +msgid "" +"This next example is a simple implementation of :func:`shutil.rmtree`. " +"Walking the tree bottom-up is essential as :func:`rmdir` doesn't allow " +"deleting a directory before it is empty::" +msgstr "" + +#: library/pathlib.rst:1481 +msgid "" +"# Delete everything reachable from the directory \"top\".\n" +"# CAUTION: This is dangerous! For example, if top == Path('/'),\n" +"# it could delete all of your files.\n" +"for root, dirs, files in top.walk(top_down=False):\n" +" for name in files:\n" +" (root / name).unlink()\n" +" for name in dirs:\n" +" (root / name).rmdir()" +msgstr "" + +#: library/pathlib.rst:1494 +msgid "Creating files and directories" +msgstr "" + +#: library/pathlib.rst:1498 +msgid "" +"Create a file at this given path. If *mode* is given, it is combined with " +"the process's ``umask`` value to determine the file mode and access flags. " +"If the file already exists, the function succeeds when *exist_ok* is true " +"(and its modification time is updated to the current time), otherwise :exc:" +"`FileExistsError` is raised." +msgstr "" + +#: library/pathlib.rst:1505 +msgid "" +"The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." +"write_bytes` methods are often used to create files." +msgstr "" + +#: library/pathlib.rst:1511 +msgid "" +"Create a new directory at this given path. If *mode* is given, it is " +"combined with the process's ``umask`` value to determine the file mode and " +"access flags. If the path already exists, :exc:`FileExistsError` is raised." +msgstr "" + +#: library/pathlib.rst:1516 +msgid "" +"If *parents* is true, any missing parents of this path are created as " +"needed; they are created with the default permissions without taking *mode* " +"into account (mimicking the POSIX ``mkdir -p`` command)." +msgstr "" + +#: library/pathlib.rst:1520 +msgid "" +"If *parents* is false (the default), a missing parent raises :exc:" +"`FileNotFoundError`." +msgstr "" + +#: library/pathlib.rst:1523 +msgid "" +"If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " +"the target directory already exists." +msgstr "" + +#: library/pathlib.rst:1526 +msgid "" +"If *exist_ok* is true, :exc:`FileExistsError` will not be raised unless the " +"given path already exists in the file system and is not a directory (same " +"behavior as the POSIX ``mkdir -p`` command)." +msgstr "" + +#: library/pathlib.rst:1530 +msgid "The *exist_ok* parameter was added." +msgstr "" + +#: library/pathlib.rst:1536 +msgid "Make this path a symbolic link pointing to *target*." +msgstr "" + +#: library/pathlib.rst:1538 +msgid "" +"On Windows, a symlink represents either a file or a directory, and does not " +"morph to the target dynamically. If the target is present, the type of the " +"symlink will be created to match. Otherwise, the symlink will be created as " +"a directory if *target_is_directory* is true or a file symlink (the default) " +"otherwise. On non-Windows platforms, *target_is_directory* is ignored." +msgstr "" + +#: library/pathlib.rst:1546 +msgid "" +">>> p = Path('mylink')\n" +">>> p.symlink_to('setup.py')\n" +">>> p.resolve()\n" +"PosixPath('/home/antoine/pathlib/setup.py')\n" +">>> p.stat().st_size\n" +"956\n" +">>> p.lstat().st_size\n" +"8" +msgstr "" + +#: library/pathlib.rst:1556 +msgid "" +"The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." +msgstr "" + +#: library/pathlib.rst:1559 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.symlink` is not available. " +"In previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: library/pathlib.rst:1566 +msgid "Make this path a hard link to the same file as *target*." +msgstr "" + +#: library/pathlib.rst:1569 +msgid "" +"The order of arguments (link, target) is the reverse of :func:`os.link`'s." +msgstr "" + +#: library/pathlib.rst:1574 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.link` is not available. In " +"previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: library/pathlib.rst:1580 +msgid "Copying, moving and deleting" +msgstr "" + +#: library/pathlib.rst:1584 +msgid "" +"Copy this file or directory tree to the given *target*, and return a new :" +"class:`!Path` instance pointing to *target*." +msgstr "" + +#: library/pathlib.rst:1587 +msgid "" +"If the source is a file, the target will be replaced if it is an existing " +"file. If the source is a symlink and *follow_symlinks* is true (the " +"default), the symlink's target is copied. Otherwise, the symlink is " +"recreated at the destination." +msgstr "" + +#: library/pathlib.rst:1592 +msgid "" +"If *preserve_metadata* is false (the default), only directory structures and " +"file data are guaranteed to be copied. Set *preserve_metadata* to true to " +"ensure that file and directory permissions, flags, last access and " +"modification times, and extended attributes are copied where supported. This " +"argument has no effect when copying files on Windows (where metadata is " +"always preserved)." +msgstr "" + +#: library/pathlib.rst:1600 +msgid "" +"Where supported by the operating system and file system, this method " +"performs a lightweight copy, where data blocks are only copied when " +"modified. This is known as copy-on-write." +msgstr "" + +#: library/pathlib.rst:1610 +msgid "" +"Copy this file or directory tree into the given *target_dir*, which should " +"be an existing directory. Other arguments are handled identically to :meth:" +"`Path.copy`. Returns a new :class:`!Path` instance pointing to the copy." +msgstr "" + +#: library/pathlib.rst:1620 +msgid "" +"Rename this file or directory to the given *target*, and return a new :class:" +"`!Path` instance pointing to *target*. On Unix, if *target* exists and is a " +"file, it will be replaced silently if the user has permission. On Windows, " +"if *target* exists, :exc:`FileExistsError` will be raised. *target* can be " +"either a string or another path object::" +msgstr "" + +#: library/pathlib.rst:1626 +msgid "" +">>> p = Path('foo')\n" +">>> p.open('w').write('some text')\n" +"9\n" +">>> target = Path('bar')\n" +">>> p.rename(target)\n" +"PosixPath('bar')\n" +">>> target.open().read()\n" +"'some text'" +msgstr "" + +#: library/pathlib.rst:1651 +msgid "" +"The target path may be absolute or relative. Relative paths are interpreted " +"relative to the current working directory, *not* the directory of the :class:" +"`!Path` object." +msgstr "" + +#: library/pathlib.rst:1639 +msgid "" +"It is implemented in terms of :func:`os.rename` and gives the same " +"guarantees." +msgstr "" + +#: library/pathlib.rst:1655 +msgid "Added return value, return the new :class:`!Path` instance." +msgstr "" + +#: library/pathlib.rst:1647 +msgid "" +"Rename this file or directory to the given *target*, and return a new :class:" +"`!Path` instance pointing to *target*. If *target* points to an existing " +"file or empty directory, it will be unconditionally replaced." +msgstr "" + +#: library/pathlib.rst:1661 +msgid "" +"Move this file or directory tree to the given *target*, and return a new :" +"class:`!Path` instance pointing to *target*." +msgstr "" + +#: library/pathlib.rst:1664 +msgid "" +"If the *target* doesn't exist it will be created. If both this path and the " +"*target* are existing files, then the target is overwritten. If both paths " +"point to the same file or directory, or the *target* is a non-empty " +"directory, then :exc:`OSError` is raised." +msgstr "" + +#: library/pathlib.rst:1669 +msgid "" +"If both paths are on the same filesystem, the move is performed with :func:" +"`os.replace`. Otherwise, this path is copied (preserving metadata and " +"symlinks) and then deleted." +msgstr "" + +#: library/pathlib.rst:1678 +msgid "" +"Move this file or directory tree into the given *target_dir*, which should " +"be an existing directory. Returns a new :class:`!Path` instance pointing to " +"the moved path." +msgstr "" + +#: library/pathlib.rst:1687 +msgid "" +"Remove this file or symbolic link. If the path points to a directory, use :" +"func:`Path.rmdir` instead." +msgstr "" + +#: library/pathlib.rst:1690 +msgid "" +"If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " +"if the path does not exist." +msgstr "" + +#: library/pathlib.rst:1693 +msgid "" +"If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " +"(same behavior as the POSIX ``rm -f`` command)." +msgstr "" + +#: library/pathlib.rst:1696 +msgid "The *missing_ok* parameter was added." +msgstr "" + +#: library/pathlib.rst:1702 +msgid "Remove this directory. The directory must be empty." +msgstr "" + +#: library/pathlib.rst:1706 +msgid "Permissions and ownership" +msgstr "" + +#: library/pathlib.rst:1710 +msgid "" +"Return the name of the user owning the file. :exc:`KeyError` is raised if " +"the file's user identifier (UID) isn't found in the system database." +msgstr "" + +#: library/pathlib.rst:1713 +msgid "" +"This method normally follows symlinks; to get the owner of the symlink, add " +"the argument ``follow_symlinks=False``." +msgstr "" + +#: library/pathlib.rst:1716 +msgid "" +"Raises :exc:`UnsupportedOperation` if the :mod:`pwd` module is not " +"available. In earlier versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: library/pathlib.rst:1726 +msgid "" +"Return the name of the group owning the file. :exc:`KeyError` is raised if " +"the file's group identifier (GID) isn't found in the system database." +msgstr "" + +#: library/pathlib.rst:1729 +msgid "" +"This method normally follows symlinks; to get the group of the symlink, add " +"the argument ``follow_symlinks=False``." +msgstr "" + +#: library/pathlib.rst:1732 +msgid "" +"Raises :exc:`UnsupportedOperation` if the :mod:`grp` module is not " +"available. In earlier versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: library/pathlib.rst:1742 +msgid "Change the file mode and permissions, like :func:`os.chmod`." +msgstr "" + +#: library/pathlib.rst:1744 +msgid "" +"This method normally follows symlinks. Some Unix flavours support changing " +"permissions on the symlink itself; on these platforms you may add the " +"argument ``follow_symlinks=False``, or use :meth:`~Path.lchmod`." +msgstr "" + +#: library/pathlib.rst:1750 +msgid "" +">>> p = Path('setup.py')\n" +">>> p.stat().st_mode\n" +"33277\n" +">>> p.chmod(0o444)\n" +">>> p.stat().st_mode\n" +"33060" +msgstr "" + +#: library/pathlib.rst:1763 +msgid "" +"Like :meth:`Path.chmod` but, if the path points to a symbolic link, the " +"symbolic link's mode is changed rather than its target's." +msgstr "" + +#: library/pathlib.rst:1770 +msgid "Pattern language" +msgstr "" + +#: library/pathlib.rst:1772 +msgid "" +"The following wildcards are supported in patterns for :meth:`~PurePath." +"full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" +msgstr "" + +#: library/pathlib.rst:1775 +msgid "``**`` (entire segment)" +msgstr "" + +#: library/pathlib.rst:1776 +msgid "Matches any number of file or directory segments, including zero." msgstr "" -#: library/pathlib.rst:1104 -msgid "" -"By default, :meth:`Path.walk` does not follow symbolic links, and instead " -"adds them to the *filenames* list. Set *follow_symlinks* to true to resolve " -"symlinks and place them in *dirnames* and *filenames* as appropriate for " -"their targets, and consequently visit directories pointed to by symlinks " -"(where supported)." +#: library/pathlib.rst:1777 +msgid "``*`` (entire segment)" msgstr "" -#: library/pathlib.rst:1111 -msgid "" -"Be aware that setting *follow_symlinks* to true can lead to infinite " -"recursion if a link points to a parent directory of itself. :meth:`Path." -"walk` does not keep track of the directories it has already visited." +#: library/pathlib.rst:1778 +msgid "Matches one file or directory segment." msgstr "" -#: library/pathlib.rst:1116 -msgid "" -":meth:`Path.walk` assumes the directories it walks are not modified during " -"execution. For example, if a directory from *dirnames* has been replaced " -"with a symlink and *follow_symlinks* is false, :meth:`Path.walk` will still " -"try to descend into it. To prevent such behavior, remove directories from " -"*dirnames* as appropriate." +#: library/pathlib.rst:1779 +msgid "``*`` (part of a segment)" msgstr "" -#: library/pathlib.rst:1124 -msgid "" -"Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " -"*filenames* if *follow_symlinks* is false." +#: library/pathlib.rst:1780 +msgid "Matches any number of non-separator characters, including zero." msgstr "" -#: library/pathlib.rst:1127 -msgid "" -"This example displays the number of bytes used by all files in each " -"directory, while ignoring ``__pycache__`` directories::" +#: library/pathlib.rst:1781 +msgid "``?``" msgstr "" -#: library/pathlib.rst:1143 -msgid "" -"This next example is a simple implementation of :func:`shutil.rmtree`. " -"Walking the tree bottom-up is essential as :func:`rmdir` doesn't allow " -"deleting a directory before it is empty::" +#: library/pathlib.rst:1782 +msgid "Matches one non-separator character." msgstr "" -#: library/pathlib.rst:1160 -msgid "" -"Like :meth:`Path.chmod` but, if the path points to a symbolic link, the " -"symbolic link's mode is changed rather than its target's." +#: library/pathlib.rst:1783 +msgid "``[seq]``" msgstr "" -#: library/pathlib.rst:1166 +#: library/pathlib.rst:1784 msgid "" -"Like :meth:`Path.stat` but, if the path points to a symbolic link, return " -"the symbolic link's information rather than its target's." +"Matches one character in *seq*, where *seq* is a sequence of characters. " +"Range expressions are supported; for example, ``[a-z]`` matches any " +"lowercase ASCII letter. Multiple ranges can be combined: ``[a-zA-Z0-9_]`` " +"matches any ASCII letter, digit, or underscore." msgstr "" -#: library/pathlib.rst:1172 -msgid "" -"Create a new directory at this given path. If *mode* is given, it is " -"combined with the process' ``umask`` value to determine the file mode and " -"access flags. If the path already exists, :exc:`FileExistsError` is raised." +#: library/pathlib.rst:1788 +msgid "``[!seq]``" msgstr "" -#: library/pathlib.rst:1177 +#: library/pathlib.rst:1789 msgid "" -"If *parents* is true, any missing parents of this path are created as " -"needed; they are created with the default permissions without taking *mode* " -"into account (mimicking the POSIX ``mkdir -p`` command)." +"Matches one character not in *seq*, where *seq* follows the same rules as " +"above." msgstr "" -#: library/pathlib.rst:1181 +#: library/pathlib.rst:1791 msgid "" -"If *parents* is false (the default), a missing parent raises :exc:" -"`FileNotFoundError`." +"For a literal match, wrap the meta-characters in brackets. For example, " +"``\"[?]\"`` matches the character ``\"?\"``." msgstr "" -#: library/pathlib.rst:1184 -msgid "" -"If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " -"the target directory already exists." +#: library/pathlib.rst:1794 +msgid "The \"``**``\" wildcard enables recursive globbing. A few examples:" msgstr "" -#: library/pathlib.rst:1187 -msgid "" -"If *exist_ok* is true, :exc:`FileExistsError` will not be raised unless the " -"given path already exists in the file system and is not a directory (same " -"behavior as the POSIX ``mkdir -p`` command)." +#: library/pathlib.rst:1797 +msgid "Pattern" msgstr "" -#: library/pathlib.rst:1191 -msgid "The *exist_ok* parameter was added." +#: library/pathlib.rst:1797 +msgid "Meaning" msgstr "" -#: library/pathlib.rst:1197 -msgid "" -"Open the file pointed to by the path, like the built-in :func:`open` " -"function does::" +#: library/pathlib.rst:1799 +msgid "\"``**/*``\"" msgstr "" -#: library/pathlib.rst:1209 -msgid "" -"Return the name of the user owning the file. :exc:`KeyError` is raised if " -"the file's uid isn't found in the system database." +#: library/pathlib.rst:1799 +msgid "Any path with at least one segment." msgstr "" -#: library/pathlib.rst:1215 -msgid "Return the binary contents of the pointed-to file as a bytes object::" +#: library/pathlib.rst:1800 +msgid "\"``**/*.py``\"" msgstr "" -#: library/pathlib.rst:1228 -msgid "Return the decoded contents of the pointed-to file as a string::" +#: library/pathlib.rst:1800 +msgid "Any path with a final segment ending \"``.py``\"." msgstr "" -#: library/pathlib.rst:1236 -msgid "" -"The file is opened and then closed. The optional parameters have the same " -"meaning as in :func:`open`." +#: library/pathlib.rst:1801 +msgid "\"``assets/**``\"" msgstr "" -#: library/pathlib.rst:1244 -msgid "" -"Return the path to which the symbolic link points (as returned by :func:`os." -"readlink`)::" +#: library/pathlib.rst:1801 +msgid "Any path starting with \"``assets/``\"." msgstr "" -#: library/pathlib.rst:1257 +#: library/pathlib.rst:1802 +msgid "\"``assets/**/*``\"" +msgstr "" + +#: library/pathlib.rst:1802 msgid "" -"Rename this file or directory to the given *target*, and return a new Path " -"instance pointing to *target*. On Unix, if *target* exists and is a file, " -"it will be replaced silently if the user has permission. On Windows, if " -"*target* exists, :exc:`FileExistsError` will be raised. *target* can be " -"either a string or another path object::" +"Any path starting with \"``assets/``\", excluding \"``assets/``\" itself." msgstr "" -#: library/pathlib.rst:1288 +#: library/pathlib.rst:1806 msgid "" -"The target path may be absolute or relative. Relative paths are interpreted " -"relative to the current working directory, *not* the directory of the Path " -"object." +"Globbing with the \"``**``\" wildcard visits every directory in the tree. " +"Large directory trees may take a long time to search." msgstr "" -#: library/pathlib.rst:1276 +#: library/pathlib.rst:1809 msgid "" -"It is implemented in terms of :func:`os.rename` and gives the same " -"guarantees." +"Globbing with a pattern that ends with \"``**``\" returns both files and " +"directories. In previous versions, only directories were returned." msgstr "" -#: library/pathlib.rst:1292 -msgid "Added return value, return the new Path instance." +#: library/pathlib.rst:1813 +msgid "" +"In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added " +"to the pattern to match only directories." msgstr "" -#: library/pathlib.rst:1284 +#: library/pathlib.rst:1816 msgid "" -"Rename this file or directory to the given *target*, and return a new Path " -"instance pointing to *target*. If *target* points to an existing file or " -"empty directory, it will be unconditionally replaced." +"Globbing with a pattern that ends with a pathname components separator (:" +"data:`~os.sep` or :data:`~os.altsep`) returns only directories." +msgstr "" + +#: library/pathlib.rst:1822 +msgid "Comparison to the :mod:`glob` module" msgstr "" -#: library/pathlib.rst:1298 +#: library/pathlib.rst:1824 msgid "" -"Make the path absolute, without normalization or resolving symlinks. Returns " -"a new path object::" +"The patterns accepted and results generated by :meth:`Path.glob` and :meth:" +"`Path.rglob` differ slightly from those by the :mod:`glob` module:" msgstr "" -#: library/pathlib.rst:1310 +#: library/pathlib.rst:1827 msgid "" -"Make the path absolute, resolving any symlinks. A new path object is " -"returned::" +"Files beginning with a dot are not special in pathlib. This is like passing " +"``include_hidden=True`` to :func:`glob.glob`." msgstr "" -#: library/pathlib.rst:1319 +#: library/pathlib.rst:1829 msgid "" -"\"``..``\" components are also eliminated (this is the only method to do " -"so)::" +"\"``**``\" pattern components are always recursive in pathlib. This is like " +"passing ``recursive=True`` to :func:`glob.glob`." msgstr "" -#: library/pathlib.rst:1325 +#: library/pathlib.rst:1831 msgid "" -"If the path doesn't exist and *strict* is ``True``, :exc:`FileNotFoundError` " -"is raised. If *strict* is ``False``, the path is resolved as far as " -"possible and any remainder is appended without checking whether it exists. " -"If an infinite loop is encountered along the resolution path, :exc:" -"`RuntimeError` is raised." +"\"``**``\" pattern components do not follow symlinks by default in pathlib. " +"This behaviour has no equivalent in :func:`glob.glob`, but you can pass " +"``recurse_symlinks=True`` to :meth:`Path.glob` for compatible behaviour." msgstr "" -#: library/pathlib.rst:1331 -msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." +#: library/pathlib.rst:1834 +msgid "" +"Like all :class:`PurePath` and :class:`Path` objects, the values returned " +"from :meth:`Path.glob` and :meth:`Path.rglob` don't include trailing slashes." msgstr "" -#: library/pathlib.rst:1336 +#: library/pathlib.rst:1837 msgid "" -"Glob the given relative *pattern* recursively. This is like calling :func:" -"`Path.glob` with \"``**/``\" added in front of the *pattern*, where " -"*patterns* are the same as for :mod:`fnmatch`::" +"The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` " +"include the *path* as a prefix, unlike the results of ``glob." +"glob(root_dir=path)``." msgstr "" -#: library/pathlib.rst:1352 +#: library/pathlib.rst:1840 msgid "" -"Raises an :ref:`auditing event ` ``pathlib.Path.rglob`` with " -"arguments ``self``, ``pattern``." +"The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` may " +"include *path* itself, for example when globbing \"``**``\", whereas the " +"results of ``glob.glob(root_dir=path)`` never include an empty string that " +"would correspond to *path*." msgstr "" -#: library/pathlib.rst:1364 -msgid "Remove this directory. The directory must be empty." +#: library/pathlib.rst:1847 +msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" msgstr "" -#: library/pathlib.rst:1369 +#: library/pathlib.rst:1849 msgid "" -"Return whether this path points to the same file as *other_path*, which can " -"be either a Path object, or a string. The semantics are similar to :func:" -"`os.path.samefile` and :func:`os.path.samestat`." +"pathlib implements path operations using :class:`PurePath` and :class:`Path` " +"objects, and so it's said to be *object-oriented*. On the other hand, the :" +"mod:`os` and :mod:`os.path` modules supply functions that work with low-" +"level ``str`` and ``bytes`` objects, which is a more *procedural* approach. " +"Some users consider the object-oriented style to be more readable." msgstr "" -#: library/pathlib.rst:1373 +#: library/pathlib.rst:1855 msgid "" -"An :exc:`OSError` can be raised if either file cannot be accessed for some " -"reason." +"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :" +"ref:`paths relative to directory descriptors `. These features " +"aren't available in pathlib." msgstr "" -#: library/pathlib.rst:1390 -msgid "Make this path a symbolic link pointing to *target*." +#: library/pathlib.rst:1859 +msgid "" +"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and :mod:" +"`os.path` modules, are written in C and are very speedy. pathlib is written " +"in pure Python and is often slower, but rarely slow enough to matter." msgstr "" -#: library/pathlib.rst:1392 +#: library/pathlib.rst:1863 msgid "" -"On Windows, a symlink represents either a file or a directory, and does not " -"morph to the target dynamically. If the target is present, the type of the " -"symlink will be created to match. Otherwise, the symlink will be created as " -"a directory if *target_is_directory* is ``True`` or a file symlink (the " -"default) otherwise. On non-Windows platforms, *target_is_directory* is " -"ignored." +"pathlib's path normalization is slightly more opinionated and consistent " +"than :mod:`os.path`. For example, whereas :func:`os.path.abspath` eliminates " +"\"``..``\" segments from a path, which may change its meaning if symlinks " +"are involved, :meth:`Path.absolute` preserves these segments for greater " +"safety." msgstr "" -#: library/pathlib.rst:1410 +#: library/pathlib.rst:1868 msgid "" -"The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." +"pathlib's path normalization may render it unsuitable for some applications:" msgstr "" -#: library/pathlib.rst:1415 -msgid "Make this path a hard link to the same file as *target*." +#: library/pathlib.rst:1870 +msgid "" +"pathlib normalizes ``Path(\"my_folder/\")`` to ``Path(\"my_folder\")``, " +"which changes a path's meaning when supplied to various operating system " +"APIs and command-line utilities. Specifically, the absence of a trailing " +"separator may allow the path to be resolved as either a file or directory, " +"rather than a directory only." msgstr "" -#: library/pathlib.rst:1418 +#: library/pathlib.rst:1875 msgid "" -"The order of arguments (link, target) is the reverse of :func:`os.link`'s." +"pathlib normalizes ``Path(\"./my_program\")`` to ``Path(\"my_program\")``, " +"which changes a path's meaning when used as an executable search path, such " +"as in a shell or when spawning a child process. Specifically, the absence of " +"a separator in the path may force it to be looked up in :envvar:`PATH` " +"rather than the current directory." msgstr "" -#: library/pathlib.rst:1426 +#: library/pathlib.rst:1881 msgid "" -"Create a file at this given path. If *mode* is given, it is combined with " -"the process' ``umask`` value to determine the file mode and access flags. " -"If the file already exists, the function succeeds if *exist_ok* is true (and " -"its modification time is updated to the current time), otherwise :exc:" -"`FileExistsError` is raised." +"As a consequence of these differences, pathlib is not a drop-in replacement " +"for :mod:`os.path`." msgstr "" -#: library/pathlib.rst:1435 -msgid "" -"Remove this file or symbolic link. If the path points to a directory, use :" -"func:`Path.rmdir` instead." +#: library/pathlib.rst:1886 +msgid "Corresponding tools" msgstr "" -#: library/pathlib.rst:1438 +#: library/pathlib.rst:1888 msgid "" -"If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " -"if the path does not exist." +"Below is a table mapping various :mod:`os` functions to their corresponding :" +"class:`PurePath`/:class:`Path` equivalent." msgstr "" -#: library/pathlib.rst:1441 -msgid "" -"If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " -"(same behavior as the POSIX ``rm -f`` command)." +#: library/pathlib.rst:1892 +msgid ":mod:`os` and :mod:`os.path`" msgstr "" -#: library/pathlib.rst:1444 -msgid "The *missing_ok* parameter was added." +#: library/pathlib.rst:1892 +msgid ":mod:`pathlib`" msgstr "" -#: library/pathlib.rst:1450 -msgid "" -"Open the file pointed to in bytes mode, write *data* to it, and close the " -"file::" +#: library/pathlib.rst:1894 +msgid ":func:`os.path.dirname`" msgstr "" -#: library/pathlib.rst:1459 -msgid "An existing file of the same name is overwritten." +#: library/pathlib.rst:1894 +msgid ":attr:`PurePath.parent`" msgstr "" -#: library/pathlib.rst:1466 -msgid "" -"Open the file pointed to in text mode, write *data* to it, and close the " -"file::" +#: library/pathlib.rst:1895 +msgid ":func:`os.path.basename`" msgstr "" -#: library/pathlib.rst:1475 -msgid "" -"An existing file of the same name is overwritten. The optional parameters " -"have the same meaning as in :func:`open`." +#: library/pathlib.rst:1895 +msgid ":attr:`PurePath.name`" msgstr "" -#: library/pathlib.rst:1480 -msgid "The *newline* parameter was added." +#: library/pathlib.rst:1896 +msgid ":func:`os.path.splitext`" msgstr "" -#: library/pathlib.rst:1484 -msgid "Correspondence to tools in the :mod:`os` module" +#: library/pathlib.rst:1896 +msgid ":attr:`PurePath.stem`, :attr:`PurePath.suffix`" msgstr "" -#: library/pathlib.rst:1486 -msgid "" -"Below is a table mapping various :mod:`os` functions to their corresponding :" -"class:`PurePath`/:class:`Path` equivalent." +#: library/pathlib.rst:1897 +msgid ":func:`os.path.join`" msgstr "" -#: library/pathlib.rst:1491 -msgid "" -"Not all pairs of functions/methods below are equivalent. Some of them, " -"despite having some overlapping use-cases, have different semantics. They " -"include :func:`os.path.abspath` and :meth:`Path.absolute`, :func:`os.path." -"relpath` and :meth:`PurePath.relative_to`." +#: library/pathlib.rst:1897 +msgid ":meth:`PurePath.joinpath`" msgstr "" -#: library/pathlib.rst:1497 -msgid ":mod:`os` and :mod:`os.path`" +#: library/pathlib.rst:1898 +msgid ":func:`os.path.isabs`" msgstr "" -#: library/pathlib.rst:1497 -msgid ":mod:`pathlib`" +#: library/pathlib.rst:1898 +msgid ":meth:`PurePath.is_absolute`" msgstr "" -#: library/pathlib.rst:1499 -msgid ":func:`os.path.abspath`" +#: library/pathlib.rst:1899 +msgid ":func:`os.path.relpath`" msgstr "" -#: library/pathlib.rst:1499 -msgid ":meth:`Path.absolute` [#]_" +#: library/pathlib.rst:1899 +msgid ":meth:`PurePath.relative_to` [1]_" msgstr "" -#: library/pathlib.rst:1500 -msgid ":func:`os.path.realpath`" +#: library/pathlib.rst:1900 +msgid ":func:`os.path.expanduser`" msgstr "" -#: library/pathlib.rst:1500 -msgid ":meth:`Path.resolve`" +#: library/pathlib.rst:1900 +msgid ":meth:`Path.expanduser` [2]_" msgstr "" -#: library/pathlib.rst:1501 -msgid ":func:`os.chmod`" +#: library/pathlib.rst:1901 +msgid ":func:`os.path.realpath`" msgstr "" -#: library/pathlib.rst:1501 -msgid ":meth:`Path.chmod`" +#: library/pathlib.rst:1901 +msgid ":meth:`Path.resolve`" msgstr "" -#: library/pathlib.rst:1502 -msgid ":func:`os.mkdir`" +#: library/pathlib.rst:1902 +msgid ":func:`os.path.abspath`" msgstr "" -#: library/pathlib.rst:1503 -msgid ":meth:`Path.mkdir`" +#: library/pathlib.rst:1902 +msgid ":meth:`Path.absolute` [3]_" msgstr "" -#: library/pathlib.rst:1503 -msgid ":func:`os.makedirs`" +#: library/pathlib.rst:1903 +msgid ":func:`os.path.exists`" msgstr "" -#: library/pathlib.rst:1504 -msgid ":func:`os.rename`" +#: library/pathlib.rst:1903 +msgid ":meth:`Path.exists`" msgstr "" -#: library/pathlib.rst:1504 -msgid ":meth:`Path.rename`" +#: library/pathlib.rst:1904 +msgid ":func:`os.path.isfile`" msgstr "" -#: library/pathlib.rst:1505 -msgid ":func:`os.replace`" +#: library/pathlib.rst:1904 +msgid ":meth:`Path.is_file`" msgstr "" -#: library/pathlib.rst:1505 -msgid ":meth:`Path.replace`" +#: library/pathlib.rst:1905 +msgid ":func:`os.path.isdir`" msgstr "" -#: library/pathlib.rst:1506 -msgid ":func:`os.rmdir`" +#: library/pathlib.rst:1905 +msgid ":meth:`Path.is_dir`" msgstr "" -#: library/pathlib.rst:1506 -msgid ":meth:`Path.rmdir`" +#: library/pathlib.rst:1906 +msgid ":func:`os.path.islink`" msgstr "" -#: library/pathlib.rst:1507 -msgid ":func:`os.remove`, :func:`os.unlink`" +#: library/pathlib.rst:1906 +msgid ":meth:`Path.is_symlink`" msgstr "" -#: library/pathlib.rst:1507 -msgid ":meth:`Path.unlink`" +#: library/pathlib.rst:1907 +msgid ":func:`os.path.isjunction`" msgstr "" -#: library/pathlib.rst:1508 -msgid ":func:`os.getcwd`" +#: library/pathlib.rst:1907 +msgid ":meth:`Path.is_junction`" msgstr "" -#: library/pathlib.rst:1508 -msgid ":func:`Path.cwd`" +#: library/pathlib.rst:1908 +msgid ":func:`os.path.ismount`" msgstr "" -#: library/pathlib.rst:1509 -msgid ":func:`os.path.exists`" +#: library/pathlib.rst:1908 +msgid ":meth:`Path.is_mount`" msgstr "" -#: library/pathlib.rst:1509 -msgid ":meth:`Path.exists`" +#: library/pathlib.rst:1909 +msgid ":func:`os.path.samefile`" msgstr "" -#: library/pathlib.rst:1510 -msgid ":func:`os.path.expanduser`" +#: library/pathlib.rst:1909 +msgid ":meth:`Path.samefile`" msgstr "" -#: library/pathlib.rst:1510 -msgid ":meth:`Path.expanduser` and :meth:`Path.home`" +#: library/pathlib.rst:1910 +msgid ":func:`os.getcwd`" msgstr "" -#: library/pathlib.rst:1512 -msgid ":func:`os.listdir`" +#: library/pathlib.rst:1910 +msgid ":meth:`Path.cwd`" msgstr "" -#: library/pathlib.rst:1512 -msgid ":meth:`Path.iterdir`" +#: library/pathlib.rst:1911 +msgid ":func:`os.stat`" msgstr "" -#: library/pathlib.rst:1513 -msgid ":func:`os.walk`" +#: library/pathlib.rst:1911 +msgid ":meth:`Path.stat`" msgstr "" -#: library/pathlib.rst:1513 -msgid ":meth:`Path.walk`" +#: library/pathlib.rst:1912 +msgid ":func:`os.lstat`" msgstr "" -#: library/pathlib.rst:1514 -msgid ":func:`os.path.isdir`" +#: library/pathlib.rst:1912 +msgid ":meth:`Path.lstat`" msgstr "" -#: library/pathlib.rst:1514 -msgid ":meth:`Path.is_dir`" +#: library/pathlib.rst:1913 +msgid ":func:`os.listdir`" msgstr "" -#: library/pathlib.rst:1515 -msgid ":func:`os.path.isfile`" +#: library/pathlib.rst:1913 +msgid ":meth:`Path.iterdir`" msgstr "" -#: library/pathlib.rst:1515 -msgid ":meth:`Path.is_file`" +#: library/pathlib.rst:1914 +msgid ":func:`os.walk`" msgstr "" -#: library/pathlib.rst:1516 -msgid ":func:`os.path.islink`" +#: library/pathlib.rst:1914 +msgid ":meth:`Path.walk` [4]_" msgstr "" -#: library/pathlib.rst:1516 -msgid ":meth:`Path.is_symlink`" +#: library/pathlib.rst:1915 +msgid ":func:`os.mkdir`, :func:`os.makedirs`" +msgstr "" + +#: library/pathlib.rst:1915 +msgid ":meth:`Path.mkdir`" msgstr "" -#: library/pathlib.rst:1517 +#: library/pathlib.rst:1916 msgid ":func:`os.link`" msgstr "" -#: library/pathlib.rst:1517 +#: library/pathlib.rst:1916 msgid ":meth:`Path.hardlink_to`" msgstr "" -#: library/pathlib.rst:1518 +#: library/pathlib.rst:1917 msgid ":func:`os.symlink`" msgstr "" -#: library/pathlib.rst:1518 +#: library/pathlib.rst:1917 msgid ":meth:`Path.symlink_to`" msgstr "" -#: library/pathlib.rst:1519 +#: library/pathlib.rst:1918 msgid ":func:`os.readlink`" msgstr "" -#: library/pathlib.rst:1519 +#: library/pathlib.rst:1918 msgid ":meth:`Path.readlink`" msgstr "" -#: library/pathlib.rst:1520 -msgid ":func:`os.path.relpath`" +#: library/pathlib.rst:1919 +msgid ":func:`os.rename`" msgstr "" -#: library/pathlib.rst:1520 -msgid ":meth:`PurePath.relative_to` [#]_" +#: library/pathlib.rst:1919 +msgid ":meth:`Path.rename`" msgstr "" -#: library/pathlib.rst:1521 -msgid ":func:`os.stat`" +#: library/pathlib.rst:1920 +msgid ":func:`os.replace`" msgstr "" -#: library/pathlib.rst:1521 -msgid ":meth:`Path.stat`, :meth:`Path.owner`, :meth:`Path.group`" +#: library/pathlib.rst:1920 +msgid ":meth:`Path.replace`" msgstr "" -#: library/pathlib.rst:1524 -msgid ":func:`os.path.isabs`" +#: library/pathlib.rst:1921 +msgid ":func:`os.remove`, :func:`os.unlink`" msgstr "" -#: library/pathlib.rst:1524 -msgid ":meth:`PurePath.is_absolute`" +#: library/pathlib.rst:1921 +msgid ":meth:`Path.unlink`" msgstr "" -#: library/pathlib.rst:1525 -msgid ":func:`os.path.join`" +#: library/pathlib.rst:1922 +msgid ":func:`os.rmdir`" msgstr "" -#: library/pathlib.rst:1525 -msgid ":func:`PurePath.joinpath`" +#: library/pathlib.rst:1922 +msgid ":meth:`Path.rmdir`" msgstr "" -#: library/pathlib.rst:1526 -msgid ":func:`os.path.basename`" +#: library/pathlib.rst:1923 +msgid ":func:`os.chmod`" msgstr "" -#: library/pathlib.rst:1526 -msgid ":attr:`PurePath.name`" +#: library/pathlib.rst:1923 +msgid ":meth:`Path.chmod`" msgstr "" -#: library/pathlib.rst:1527 -msgid ":func:`os.path.dirname`" +#: library/pathlib.rst:1924 +msgid ":func:`os.lchmod`" msgstr "" -#: library/pathlib.rst:1527 -msgid ":attr:`PurePath.parent`" +#: library/pathlib.rst:1924 +msgid ":meth:`Path.lchmod`" msgstr "" -#: library/pathlib.rst:1528 -msgid ":func:`os.path.samefile`" +#: library/pathlib.rst:1928 +msgid "Footnotes" msgstr "" -#: library/pathlib.rst:1528 -msgid ":meth:`Path.samefile`" +#: library/pathlib.rst:1929 +msgid "" +":func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths " +"absolute and remove \"``..``\" parts, whereas :meth:`PurePath.relative_to` " +"is a lexical operation that raises :exc:`ValueError` when its inputs' " +"anchors differ (e.g. if one path is absolute and the other relative.)" msgstr "" -#: library/pathlib.rst:1529 -msgid ":func:`os.path.splitext`" +#: library/pathlib.rst:1933 +msgid "" +":func:`os.path.expanduser` returns the path unchanged if the home directory " +"can't be resolved, whereas :meth:`Path.expanduser` raises :exc:" +"`RuntimeError`." msgstr "" -#: library/pathlib.rst:1529 -msgid ":attr:`PurePath.stem` and :attr:`PurePath.suffix`" +#: library/pathlib.rst:1936 +msgid "" +":func:`os.path.abspath` removes \"``..``\" components without resolving " +"symlinks, which may change the meaning of the path, whereas :meth:`Path." +"absolute` leaves any \"``..``\" components in the path." msgstr "" -#: library/pathlib.rst:1534 -msgid "Footnotes" +#: library/pathlib.rst:1939 +msgid "" +":func:`os.walk` always follows symlinks when categorizing paths into " +"*dirnames* and *filenames*, whereas :meth:`Path.walk` categorizes all " +"symlinks into *filenames* when *follow_symlinks* is false (the default.)" msgstr "" -#: library/pathlib.rst:1535 +#: library/pathlib.rst:1945 +msgid "Protocols" +msgstr "" + +#: library/pathlib.rst:1951 msgid "" -":func:`os.path.abspath` normalizes the resulting path, which may change its " -"meaning in the presence of symlinks, while :meth:`Path.absolute` does not." +"The :mod:`pathlib.types` module provides types for static type checking." msgstr "" -#: library/pathlib.rst:1536 +#: library/pathlib.rst:1958 +msgid "" +"A :class:`typing.Protocol` describing the :attr:`Path.info ` attribute. Implementations may return cached results from their " +"methods." +msgstr "" + +#: library/pathlib.rst:1964 +msgid "" +"Return ``True`` if the path is an existing file or directory, or any other " +"kind of file; return ``False`` if the path doesn't exist." +msgstr "" + +#: library/pathlib.rst:1967 +msgid "" +"If *follow_symlinks* is ``False``, return ``True`` for symlinks without " +"checking if their targets exist." +msgstr "" + +#: library/pathlib.rst:1972 +msgid "" +"Return ``True`` if the path is a directory, or a symbolic link pointing to a " +"directory; return ``False`` if the path is (or points to) any other kind of " +"file, or if it doesn't exist." +msgstr "" + +#: library/pathlib.rst:1976 +msgid "" +"If *follow_symlinks* is ``False``, return ``True`` only if the path is a " +"directory (without following symlinks); return ``False`` if the path is any " +"other kind of file, or if it doesn't exist." +msgstr "" + +#: library/pathlib.rst:1982 +msgid "" +"Return ``True`` if the path is a file, or a symbolic link pointing to a " +"file; return ``False`` if the path is (or points to) a directory or other " +"non-file, or if it doesn't exist." +msgstr "" + +#: library/pathlib.rst:1986 +msgid "" +"If *follow_symlinks* is ``False``, return ``True`` only if the path is a " +"file (without following symlinks); return ``False`` if the path is a " +"directory or other non-file, or if it doesn't exist." +msgstr "" + +#: library/pathlib.rst:1992 msgid "" -":meth:`PurePath.relative_to` requires ``self`` to be the subpath of the " -"argument, but :func:`os.path.relpath` does not." +"Return ``True`` if the path is a symbolic link (even if broken); return " +"``False`` if the path is a directory or any kind of file, or if it doesn't " +"exist." msgstr "" -#: library/pathlib.rst:12 +#: library/pathlib.rst:11 msgid "path" msgstr "" -#: library/pathlib.rst:12 +#: library/pathlib.rst:11 msgid "operations" msgstr "" diff --git a/library/pdb.po b/library/pdb.po index e2708244..e6fe95b6 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -41,7 +42,7 @@ msgid "" "source. The extension interface uses the modules :mod:`bdb` and :mod:`cmd`." msgstr "" -#: library/pdb.rst:34 +#: library/pdb.rst:32 msgid "Module :mod:`faulthandler`" msgstr "" @@ -65,10 +66,18 @@ msgstr "" msgid "The typical usage to break into the debugger is to insert::" msgstr "" +#: library/pdb.rst:41 +msgid "import pdb; pdb.set_trace()" +msgstr "" + #: library/pdb.rst:43 msgid "Or::" msgstr "" +#: library/pdb.rst:45 +msgid "breakpoint()" +msgstr "" + #: library/pdb.rst:47 msgid "" "at the location you want to break into the debugger, and then run the " @@ -78,16 +87,35 @@ msgstr "" #: library/pdb.rst:51 msgid "" -"The built-in :func:`breakpoint()`, when called with defaults, can be used " +"The built-in :func:`breakpoint`, when called with defaults, can be used " "instead of ``import pdb; pdb.set_trace()``." msgstr "" +#: library/pdb.rst:57 +msgid "" +"def double(x):\n" +" breakpoint()\n" +" return x * 2\n" +"val = 3\n" +"print(f\"{val} * 2 is {double(val)}\")" +msgstr "" + #: library/pdb.rst:63 msgid "" "The debugger's prompt is ``(Pdb)``, which is the indicator that you are in " "debug mode::" msgstr "" +#: library/pdb.rst:65 +msgid "" +"> ...(2)double()\n" +"-> breakpoint()\n" +"(Pdb) p x\n" +"3\n" +"(Pdb) continue\n" +"3 * 2 is 6" +msgstr "" + #: library/pdb.rst:72 msgid "" "Tab-completion via the :mod:`readline` module is available for commands and " @@ -95,13 +123,21 @@ msgid "" "arguments of the ``p`` command." msgstr "" -#: library/pdb.rst:78 +#: library/pdb.rst:81 +msgid "Command-line interface" +msgstr "" + +#: library/pdb.rst:85 msgid "" "You can also invoke :mod:`pdb` from the command line to debug other " "scripts. For example::" msgstr "" -#: library/pdb.rst:83 +#: library/pdb.rst:88 +msgid "python -m pdb [-c command] (-m module | -p pid | pyfile) [args ...]" +msgstr "" + +#: library/pdb.rst:90 msgid "" "When invoked as a module, pdb will automatically enter post-mortem debugging " "if the program being debugged exits abnormally. After post-mortem debugging " @@ -110,34 +146,99 @@ msgid "" "cases is more useful than quitting the debugger upon program's exit." msgstr "" -#: library/pdb.rst:89 +#: library/pdb.rst:98 msgid "" -"Added the ``-c`` option to execute commands as if given in a :file:`.pdbrc` " -"file; see :ref:`debugger-commands`." +"To execute commands as if given in a :file:`.pdbrc` file; see :ref:`debugger-" +"commands`." +msgstr "" + +#: library/pdb.rst:101 +msgid "Added the ``-c`` option." msgstr "" -#: library/pdb.rst:93 +#: library/pdb.rst:106 msgid "" -"Added the ``-m`` option to execute modules similar to the way ``python -m`` " -"does. As with a script, the debugger will pause execution just before the " -"first line of the module." +"To execute modules similar to the way ``python -m`` does. As with a script, " +"the debugger will pause execution just before the first line of the module." msgstr "" -#: library/pdb.rst:98 +#: library/pdb.rst:109 +msgid "Added the ``-m`` option." +msgstr "" + +#: library/pdb.rst:114 +msgid "Attach to the process with the specified PID." +msgstr "" + +#: library/pdb.rst:119 +msgid "" +"To attach to a running Python process for remote debugging, use the ``-p`` " +"or ``--pid`` option with the target process's PID::" +msgstr "" + +#: library/pdb.rst:122 +msgid "python -m pdb -p 1234" +msgstr "" + +#: library/pdb.rst:126 +msgid "" +"Attaching to a process that is blocked in a system call or waiting for I/O " +"will only work once the next bytecode instruction is executed or when the " +"process receives a signal." +msgstr "" + +#: library/pdb.rst:130 msgid "Typical usage to execute a statement under control of the debugger is::" msgstr "" -#: library/pdb.rst:109 +#: library/pdb.rst:132 +msgid "" +">>> import pdb\n" +">>> def f(x):\n" +"... print(1 / x)\n" +">>> pdb.run(\"f(2)\")\n" +"> (1)()\n" +"(Pdb) continue\n" +"0.5\n" +">>>" +msgstr "" + +#: library/pdb.rst:141 msgid "The typical usage to inspect a crashed program is::" msgstr "" -#: library/pdb.rst:127 +#: library/pdb.rst:143 +msgid "" +">>> import pdb\n" +">>> def f(x):\n" +"... print(1 / x)\n" +"...\n" +">>> f(0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 2, in f\n" +"ZeroDivisionError: division by zero\n" +">>> pdb.pm()\n" +"> (2)f()\n" +"(Pdb) p x\n" +"0\n" +"(Pdb)" +msgstr "" + +#: library/pdb.rst:158 +msgid "" +"The implementation of :pep:`667` means that name assignments made via " +"``pdb`` will immediately affect the active scope, even when running inside " +"an :term:`optimized scope`." +msgstr "" + +#: library/pdb.rst:164 msgid "" "The module defines the following functions; each enters the debugger in a " "slightly different way:" msgstr "" -#: library/pdb.rst:132 +#: library/pdb.rst:169 msgid "" "Execute the *statement* (given as a string or a code object) under debugger " "control. The debugger prompt appears before any code is executed; you can " @@ -149,14 +250,14 @@ msgid "" "`exec` or :func:`eval` functions.)" msgstr "" -#: library/pdb.rst:144 +#: library/pdb.rst:181 msgid "" "Evaluate the *expression* (given as a string or a code object) under " "debugger control. When :func:`runeval` returns, it returns the value of the " "*expression*. Otherwise this function is similar to :func:`run`." msgstr "" -#: library/pdb.rst:151 +#: library/pdb.rst:188 msgid "" "Call the *function* (a function or method object, not a string) with the " "given arguments. When :func:`runcall` returns, it returns whatever the " @@ -164,57 +265,107 @@ msgid "" "is entered." msgstr "" -#: library/pdb.rst:159 +#: library/pdb.rst:196 msgid "" "Enter the debugger at the calling stack frame. This is useful to hard-code " "a breakpoint at a given point in a program, even if the code is not " "otherwise being debugged (e.g. when an assertion fails). If given, *header* " -"is printed to the console just before debugging begins." +"is printed to the console just before debugging begins. The *commands* " +"argument, if given, is a list of commands to execute when the debugger " +"starts." msgstr "" -#: library/pdb.rst:164 +#: library/pdb.rst:204 msgid "The keyword-only argument *header*." msgstr "" -#: library/pdb.rst:170 +#: library/pdb.rst:207 +msgid "" +":func:`set_trace` will enter the debugger immediately, rather than on the " +"next line of code to be executed." +msgstr "" + +#: library/pdb.rst:211 +msgid "The *commands* argument." +msgstr "" + +#: library/pdb.rst:217 +msgid "" +"async version of :func:`set_trace`. This function should be used inside an " +"async function with :keyword:`await`." +msgstr "" + +#: library/pdb.rst:220 msgid "" -"Enter post-mortem debugging of the given *traceback* object. If no " -"*traceback* is given, it uses the one of the exception that is currently " -"being handled (an exception must be being handled if the default is to be " -"used)." +"async def f():\n" +" await pdb.set_trace_async()" msgstr "" -#: library/pdb.rst:178 +#: library/pdb.rst:225 msgid "" -"Enter post-mortem debugging of the traceback found in :data:`sys." -"last_traceback`." +":keyword:`await` statements are supported if the debugger is invoked by this " +"function." msgstr "" -#: library/pdb.rst:182 +#: library/pdb.rst:231 +msgid "" +"Enter post-mortem debugging of the given exception or :ref:`traceback object " +"`. If no value is given, it uses the exception that is " +"currently being handled, or raises ``ValueError`` if there isn’t one." +msgstr "" + +#: library/pdb.rst:236 +msgid "Support for exception objects was added." +msgstr "" + +#: library/pdb.rst:241 +msgid "" +"Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." +msgstr "" + +#: library/pdb.rst:246 +msgid "" +"There are two supported backends for pdb: ``'settrace'`` and " +"``'monitoring'``. See :class:`bdb.Bdb` for details. The user can set the " +"default backend to use if none is specified when instantiating :class:`Pdb`. " +"If no backend is specified, the default is ``'settrace'``." +msgstr "" + +#: library/pdb.rst:253 +msgid "" +":func:`breakpoint` and :func:`set_trace` will not be affected by this " +"function. They always use ``'monitoring'`` backend." +msgstr "" + +#: library/pdb.rst:260 +msgid "Returns the default backend for pdb." +msgstr "" + +#: library/pdb.rst:264 msgid "" "The ``run*`` functions and :func:`set_trace` are aliases for instantiating " "the :class:`Pdb` class and calling the method of the same name. If you want " "to access further features, you have to do this yourself:" msgstr "" -#: library/pdb.rst:189 +#: library/pdb.rst:271 msgid ":class:`Pdb` is the debugger class." msgstr "" -#: library/pdb.rst:191 +#: library/pdb.rst:273 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." msgstr "" -#: library/pdb.rst:194 +#: library/pdb.rst:276 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " "that matches one of these patterns. [1]_" msgstr "" -#: library/pdb.rst:198 +#: library/pdb.rst:280 msgid "" "By default, Pdb sets a handler for the SIGINT signal (which is sent when the " "user presses :kbd:`Ctrl-C` on the console) when you give a :pdbcmd:" @@ -223,44 +374,91 @@ msgid "" "set *nosigint* to true." msgstr "" -#: library/pdb.rst:203 +#: library/pdb.rst:285 msgid "" "The *readrc* argument defaults to true and controls whether Pdb will load ." "pdbrc files from the filesystem." msgstr "" -#: library/pdb.rst:206 +#: library/pdb.rst:288 +msgid "" +"The *mode* argument specifies how the debugger was invoked. It impacts the " +"workings of some debugger commands. Valid values are ``'inline'`` (used by " +"the breakpoint() builtin), ``'cli'`` (used by the command line invocation) " +"or ``None`` (for backwards compatible behaviour, as before the *mode* " +"argument was added)." +msgstr "" + +#: library/pdb.rst:295 +msgid "" +"The *backend* argument specifies the backend to use for the debugger. If " +"``None`` is passed, the default backend will be used. See :func:" +"`set_default_backend`. Otherwise the supported backends are ``'settrace'`` " +"and ``'monitoring'``." +msgstr "" + +#: library/pdb.rst:299 +msgid "" +"The *colorize* argument, if set to ``True``, will enable colorized output in " +"the debugger, if color is supported. This will highlight source code " +"displayed in pdb." +msgstr "" + +#: library/pdb.rst:302 msgid "Example call to enable tracing with *skip*::" msgstr "" -#: library/pdb.rst:210 +#: library/pdb.rst:304 +msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" +msgstr "" + +#: library/pdb.rst:306 msgid "" "Raises an :ref:`auditing event ` ``pdb.Pdb`` with no arguments." msgstr "" -#: library/pdb.rst:212 +#: library/pdb.rst:308 msgid "Added the *skip* parameter." msgstr "" -#: library/pdb.rst:215 +#: library/pdb.rst:311 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." msgstr "" -#: library/pdb.rst:219 +#: library/pdb.rst:315 msgid "The *readrc* argument." msgstr "" -#: library/pdb.rst:227 +#: library/pdb.rst:318 +msgid "Added the *mode* argument." +msgstr "" + +#: library/pdb.rst:321 +msgid "Added the *backend* argument." +msgstr "" + +#: library/pdb.rst:324 +msgid "Added the *colorize* argument." +msgstr "" + +#: library/pdb.rst:327 +msgid "" +"Inline breakpoints like :func:`breakpoint` or :func:`pdb.set_trace` will " +"always stop the program at calling frame, ignoring the *skip* pattern (if " +"any)." +msgstr "" + +#: library/pdb.rst:336 msgid "See the documentation for the functions explained above." msgstr "" -#: library/pdb.rst:233 -msgid "Debugger Commands" +#: library/pdb.rst:342 +msgid "Debugger commands" msgstr "" -#: library/pdb.rst:235 +#: library/pdb.rst:344 msgid "" "The commands recognized by the debugger are listed below. Most commands can " "be abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means " @@ -272,13 +470,13 @@ msgid "" "are separated by a vertical bar (``|``)." msgstr "" -#: library/pdb.rst:244 +#: library/pdb.rst:353 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." msgstr "" -#: library/pdb.rst:247 +#: library/pdb.rst:356 msgid "" "Commands that the debugger doesn't recognize are assumed to be Python " "statements and are executed in the context of the program being debugged. " @@ -289,14 +487,20 @@ msgid "" "is not changed." msgstr "" -#: library/pdb.rst:255 +#: library/pdb.rst:364 +msgid "" +"Expressions/Statements whose prefix is a pdb command are now correctly " +"identified and executed." +msgstr "" + +#: library/pdb.rst:368 msgid "" "The debugger supports :ref:`aliases `. Aliases can have " "parameters which allows one a certain level of adaptability to the context " "under examination." msgstr "" -#: library/pdb.rst:259 +#: library/pdb.rst:372 msgid "" "Multiple commands may be entered on a single line, separated by ``;;``. (A " "single ``;`` is not used as it is the separator for multiple commands in a " @@ -307,7 +511,7 @@ msgid "" "\"\";\"``." msgstr "" -#: library/pdb.rst:266 +#: library/pdb.rst:379 msgid "" "To set a temporary global variable, use a *convenience variable*. A " "*convenience variable* is a variable whose name starts with ``$``. For " @@ -317,45 +521,58 @@ msgid "" "compared to using normal variables like ``foo = 1``." msgstr "" -#: library/pdb.rst:273 -msgid "There are three preset *convenience variables*:" +#: library/pdb.rst:386 +msgid "There are four preset *convenience variables*:" msgstr "" -#: library/pdb.rst:275 +#: library/pdb.rst:388 msgid "``$_frame``: the current frame you are debugging" msgstr "" -#: library/pdb.rst:276 +#: library/pdb.rst:389 msgid "``$_retval``: the return value if the frame is returning" msgstr "" -#: library/pdb.rst:277 +#: library/pdb.rst:390 msgid "``$_exception``: the exception if the frame is raising an exception" msgstr "" -#: library/pdb.rst:285 +#: library/pdb.rst:391 +msgid "``$_asynctask``: the asyncio task if pdb stops in an async function" +msgstr "" + +#: library/pdb.rst:395 +msgid "Added the *convenience variable* feature." +msgstr "" + +#: library/pdb.rst:397 +msgid "Added the ``$_asynctask`` convenience variable." +msgstr "" + +#: library/pdb.rst:404 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " "current directory, it is read with ``'utf-8'`` encoding and executed as if " -"it had been typed at the debugger prompt. This is particularly useful for " -"aliases. If both files exist, the one in the home directory is read first " -"and aliases defined there can be overridden by the local file." +"it had been typed at the debugger prompt, with the exception that empty " +"lines and lines starting with ``#`` are ignored. This is particularly " +"useful for aliases. If both files exist, the one in the home directory is " +"read first and aliases defined there can be overridden by the local file." msgstr "" -#: library/pdb.rst:291 +#: library/pdb.rst:411 msgid "" ":file:`.pdbrc` can now contain commands that continue debugging, such as :" "pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " "effect." msgstr "" -#: library/pdb.rst:296 +#: library/pdb.rst:416 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." msgstr "" -#: library/pdb.rst:303 +#: library/pdb.rst:423 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -364,63 +581,80 @@ msgid "" "the ``!`` command." msgstr "" -#: library/pdb.rst:311 +#: library/pdb.rst:431 msgid "" -"Print a stack trace, with the most recent frame at the bottom. An arrow " -"(``>``) indicates the current frame, which determines the context of most " -"commands." +"Print a stack trace, with the most recent frame at the bottom. if *count* " +"is 0, print the current frame entry. If *count* is negative, print the least " +"recent - *count* frames. If *count* is positive, print the most recent " +"*count* frames. An arrow (``>``) indicates the current frame, which " +"determines the context of most commands." +msgstr "" + +#: library/pdb.rst:437 +msgid "*count* argument is added." msgstr "" -#: library/pdb.rst:316 +#: library/pdb.rst:442 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." msgstr "" -#: library/pdb.rst:321 +#: library/pdb.rst:447 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." msgstr "" -#: library/pdb.rst:326 +#: library/pdb.rst:452 msgid "" -"With a *lineno* argument, set a break there in the current file. With a " -"*function* argument, set a break at the first executable statement within " -"that function. The line number may be prefixed with a filename and a colon, " -"to specify a breakpoint in another file (probably one that hasn't been " -"loaded yet). The file is searched on :data:`sys.path`. Note that each " -"breakpoint is assigned a number to which all the other breakpoint commands " -"refer." +"With a *lineno* argument, set a break at line *lineno* in the current file. " +"The line number may be prefixed with a *filename* and a colon, to specify a " +"breakpoint in another file (possibly one that hasn't been loaded yet). The " +"file is searched on :data:`sys.path`. Acceptable forms of *filename* are ``/" +"abspath/to/file.py``, ``relpath/file.py``, ``module`` and ``package.module``." msgstr "" -#: library/pdb.rst:333 +#: library/pdb.rst:459 +msgid "" +"With a *function* argument, set a break at the first executable statement " +"within that function. *function* can be any expression that evaluates to a " +"function in the current namespace." +msgstr "" + +#: library/pdb.rst:463 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "" -#: library/pdb.rst:336 +#: library/pdb.rst:466 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " "associated condition if any." msgstr "" -#: library/pdb.rst:342 +#: library/pdb.rst:470 +msgid "" +"Each breakpoint is assigned a number to which all the other breakpoint " +"commands refer." +msgstr "" + +#: library/pdb.rst:475 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" -#: library/pdb.rst:347 +#: library/pdb.rst:480 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " "Without argument, clear all breaks (but first ask confirmation)." msgstr "" -#: library/pdb.rst:353 +#: library/pdb.rst:486 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -428,11 +662,11 @@ msgid "" "breakpoints and can be (re-)enabled." msgstr "" -#: library/pdb.rst:360 +#: library/pdb.rst:493 msgid "Enable the breakpoints specified." msgstr "" -#: library/pdb.rst:364 +#: library/pdb.rst:497 msgid "" "Set the ignore count for the given breakpoint number. If *count* is " "omitted, the ignore count is set to 0. A breakpoint becomes active when the " @@ -441,65 +675,77 @@ msgid "" "associated condition evaluates to true." msgstr "" -#: library/pdb.rst:372 +#: library/pdb.rst:505 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " "existing condition is removed; i.e., the breakpoint is made unconditional." msgstr "" -#: library/pdb.rst:378 +#: library/pdb.rst:511 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " "``end`` to terminate the commands. An example::" msgstr "" -#: library/pdb.rst:387 +#: library/pdb.rst:515 +msgid "" +"(Pdb) commands 1\n" +"(com) p some_variable\n" +"(com) end\n" +"(Pdb)" +msgstr "" + +#: library/pdb.rst:520 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." msgstr "" -#: library/pdb.rst:390 +#: library/pdb.rst:523 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "" -#: library/pdb.rst:392 +#: library/pdb.rst:525 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" -#: library/pdb.rst:396 +#: library/pdb.rst:529 msgid "" "Specifying any command resuming execution (currently :pdbcmd:`continue`, :" -"pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:" -"`quit` and their abbreviations) terminates the command list (as if that " -"command was immediately followed by end). This is because any time you " -"resume execution (even with a simple next or step), you may encounter " -"another breakpoint—which could have its own command list, leading to " -"ambiguities about which list to execute." +"pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`until`, :pdbcmd:" +"`jump`, :pdbcmd:`quit` and their abbreviations) terminates the command list " +"(as if that command was immediately followed by end). This is because any " +"time you resume execution (even with a simple next or step), you may " +"encounter another breakpoint—which could have its own command list, leading " +"to ambiguities about which list to execute." msgstr "" -#: library/pdb.rst:405 +#: library/pdb.rst:538 msgid "" -"If you use the ``silent`` command in the command list, the usual message " -"about stopping at a breakpoint is not printed. This may be desirable for " -"breakpoints that are to print a specific message and then continue. If none " -"of the other commands print anything, you see no sign that the breakpoint " -"was reached." +"If the list of commands contains the ``silent`` command, or a command that " +"resumes execution, then the breakpoint message containing information about " +"the frame is not displayed." msgstr "" -#: library/pdb.rst:412 +#: library/pdb.rst:542 +msgid "" +"Frame information will not be displayed if a command that resumes execution " +"is present in the command list." +msgstr "" + +#: library/pdb.rst:548 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." msgstr "" -#: library/pdb.rst:417 +#: library/pdb.rst:553 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -508,46 +754,46 @@ msgid "" "line in the current function.)" msgstr "" -#: library/pdb.rst:425 +#: library/pdb.rst:561 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." msgstr "" -#: library/pdb.rst:428 +#: library/pdb.rst:564 msgid "" "With *lineno*, continue execution until a line with a number greater or " "equal to *lineno* is reached. In both cases, also stop when the current " "frame returns." msgstr "" -#: library/pdb.rst:432 +#: library/pdb.rst:568 msgid "Allow giving an explicit line number." msgstr "" -#: library/pdb.rst:437 +#: library/pdb.rst:573 msgid "Continue execution until the current function returns." msgstr "" -#: library/pdb.rst:441 +#: library/pdb.rst:577 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "" -#: library/pdb.rst:445 +#: library/pdb.rst:581 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " "skip code that you don't want to run." msgstr "" -#: library/pdb.rst:449 +#: library/pdb.rst:585 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " "possible to jump into the middle of a :keyword:`for` loop or out of a :" "keyword:`finally` clause." msgstr "" -#: library/pdb.rst:455 +#: library/pdb.rst:591 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -556,7 +802,7 @@ msgid "" "second argument is less than the first, it is interpreted as a count." msgstr "" -#: library/pdb.rst:461 +#: library/pdb.rst:597 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " @@ -564,99 +810,159 @@ msgid "" "line." msgstr "" -#: library/pdb.rst:466 +#: library/pdb.rst:602 msgid "Added the ``>>`` marker." msgstr "" -#: library/pdb.rst:471 +#: library/pdb.rst:607 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" -#: library/pdb.rst:478 +#: library/pdb.rst:614 msgid "Print the arguments of the current function and their current values." msgstr "" -#: library/pdb.rst:482 +#: library/pdb.rst:618 msgid "Evaluate *expression* in the current context and print its value." msgstr "" -#: library/pdb.rst:486 +#: library/pdb.rst:622 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" -#: library/pdb.rst:492 +#: library/pdb.rst:628 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." msgstr "" -#: library/pdb.rst:497 +#: library/pdb.rst:633 msgid "Print the type of *expression*." msgstr "" -#: library/pdb.rst:501 +#: library/pdb.rst:637 msgid "Try to get source code of *expression* and display it." msgstr "" -#: library/pdb.rst:507 +#: library/pdb.rst:643 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." msgstr "" -#: library/pdb.rst:510 +#: library/pdb.rst:646 msgid "" "Without *expression*, list all display expressions for the current frame." msgstr "" -#: library/pdb.rst:514 +#: library/pdb.rst:650 msgid "" "Display evaluates *expression* and compares to the result of the previous " "evaluation of *expression*, so when the result is mutable, display may not " "be able to pick up the changes." msgstr "" -#: library/pdb.rst:518 +#: library/pdb.rst:819 msgid "Example::" msgstr "" -#: library/pdb.rst:526 +#: library/pdb.rst:656 +msgid "" +"lst = []\n" +"breakpoint()\n" +"pass\n" +"lst.append(1)\n" +"print(lst)" +msgstr "" + +#: library/pdb.rst:662 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" msgstr "" -#: library/pdb.rst:541 +#: library/pdb.rst:665 +msgid "" +"> example.py(3)()\n" +"-> pass\n" +"(Pdb) display lst\n" +"display lst: []\n" +"(Pdb) n\n" +"> example.py(4)()\n" +"-> lst.append(1)\n" +"(Pdb) n\n" +"> example.py(5)()\n" +"-> print(lst)\n" +"(Pdb)" +msgstr "" + +#: library/pdb.rst:677 msgid "You can do some tricks with copy mechanism to make it work::" msgstr "" -#: library/pdb.rst:560 +#: library/pdb.rst:679 +msgid "" +"> example.py(3)()\n" +"-> pass\n" +"(Pdb) display lst[:]\n" +"display lst[:]: []\n" +"(Pdb) n\n" +"> example.py(4)()\n" +"-> lst.append(1)\n" +"(Pdb) n\n" +"> example.py(5)()\n" +"-> print(lst)\n" +"display lst[:]: [1] [old: []]\n" +"(Pdb)" +msgstr "" + +#: library/pdb.rst:696 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." msgstr "" -#: library/pdb.rst:567 +#: library/pdb.rst:703 msgid "" -"Start an interactive interpreter (using the :mod:`code` module) whose global " -"namespace contains all the (global and local) names found in the current " -"scope." +"Start an interactive interpreter (using the :mod:`code` module) in a new " +"global namespace initialised from the local and global namespaces for the " +"current scope. Use ``exit()`` or ``quit()`` to exit the interpreter and " +"return to the debugger." msgstr "" -#: library/pdb.rst:577 +#: library/pdb.rst:710 +msgid "" +"As ``interact`` creates a new dedicated namespace for code execution, " +"assignments to variables will not affect the original namespaces. However, " +"modifications to any referenced mutable objects will be reflected in the " +"original namespaces as usual." +msgstr "" + +#: library/pdb.rst:717 +msgid "" +"``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." +msgstr "" + +#: library/pdb.rst:721 +msgid "" +":pdbcmd:`interact` directs its output to the debugger's output channel " +"rather than :data:`sys.stderr`." +msgstr "" + +#: library/pdb.rst:729 msgid "" "Create an alias called *name* that executes *command*. The *command* must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by " -"``%1``, ``%2``, and so on, while ``%*`` is replaced by all the parameters. " -"If *command* is omitted, the current alias for *name* is shown. If no " -"arguments are given, all aliases are listed." +"``%1``, ``%2``, ... and ``%9``, while ``%*`` is replaced by all the " +"parameters. If *command* is omitted, the current alias for *name* is shown. " +"If no arguments are given, all aliases are listed." msgstr "" -#: library/pdb.rst:583 +#: library/pdb.rst:735 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -665,30 +971,50 @@ msgid "" "other words in the line are left alone." msgstr "" -#: library/pdb.rst:589 +#: library/pdb.rst:741 msgid "" "As an example, here are two useful aliases (especially when placed in the :" "file:`.pdbrc` file)::" msgstr "" -#: library/pdb.rst:599 +#: library/pdb.rst:744 +msgid "" +"# Print instance variables (usage \"pi classInst\")\n" +"alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" +"# Print instance variables in self\n" +"alias ps pi self" +msgstr "" + +#: library/pdb.rst:751 msgid "Delete the specified alias *name*." msgstr "" -#: library/pdb.rst:603 +#: library/pdb.rst:755 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " "statement resembles a debugger command, e.g.:" msgstr "" -#: library/pdb.rst:612 +#: library/pdb.rst:759 +msgid "" +"(Pdb) ! n=42\n" +"(Pdb)" +msgstr "" + +#: library/pdb.rst:764 msgid "" "To set a global variable, you can prefix the assignment command with a :" "keyword:`global` statement on the same line, e.g.:" msgstr "" -#: library/pdb.rst:623 +#: library/pdb.rst:767 +msgid "" +"(Pdb) global list_options; list_options = ['-l']\n" +"(Pdb)" +msgstr "" + +#: library/pdb.rst:775 msgid "" "Restart the debugged Python program. If *args* is supplied, it is split " "with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " @@ -696,25 +1022,103 @@ msgid "" "`restart` is an alias for :pdbcmd:`run`." msgstr "" -#: library/pdb.rst:630 -msgid "Quit from the debugger. The program being executed is aborted." +#: library/pdb.rst:780 +msgid "" +":pdbcmd:`run` and :pdbcmd:`restart` commands are disabled when the debugger " +"is invoked in ``'inline'`` mode." +msgstr "" + +#: library/pdb.rst:786 +msgid "" +"Quit from the debugger. The program being executed is aborted. An end-of-" +"file input is equivalent to :pdbcmd:`quit`." +msgstr "" + +#: library/pdb.rst:789 +msgid "" +"A confirmation prompt will be shown if the debugger is invoked in " +"``'inline'`` mode. Either ``y``, ``Y``, ```` or ``EOF`` will confirm " +"the quit." +msgstr "" + +#: library/pdb.rst:793 +msgid "" +"A confirmation prompt will be shown if the debugger is invoked in " +"``'inline'`` mode. After the confirmation, the debugger will call :func:`sys." +"exit` immediately, instead of raising :exc:`bdb.BdbQuit` in the next trace " +"event." msgstr "" -#: library/pdb.rst:634 +#: library/pdb.rst:801 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." msgstr "" -#: library/pdb.rst:640 +#: library/pdb.rst:807 msgid "Print the return value for the last return of the current function." msgstr "" -#: library/pdb.rst:643 +#: library/pdb.rst:811 +msgid "List or jump between chained exceptions." +msgstr "" + +#: library/pdb.rst:813 +msgid "" +"When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained " +"exception instead of a traceback, it allows the user to move between the " +"chained exceptions using ``exceptions`` command to list exceptions, and " +"``exceptions `` to switch to that exception." +msgstr "" + +#: library/pdb.rst:821 +msgid "" +"def out():\n" +" try:\n" +" middle()\n" +" except Exception as e:\n" +" raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"def middle():\n" +" try:\n" +" return inner(0)\n" +" except Exception as e:\n" +" raise ValueError(\"Middle fail\")\n" +"\n" +"def inner(x):\n" +" 1 / x\n" +"\n" +" out()" +msgstr "" + +#: library/pdb.rst:838 +msgid "calling ``pdb.pm()`` will allow to move between exceptions::" +msgstr "" + +#: library/pdb.rst:840 +msgid "" +"> example.py(5)out()\n" +"-> raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"(Pdb) exceptions\n" +" 0 ZeroDivisionError('division by zero')\n" +" 1 ValueError('Middle fail')\n" +"> 2 ValueError('reraise middle() error')\n" +"\n" +"(Pdb) exceptions 0\n" +"> example.py(16)inner()\n" +"-> 1 / x\n" +"\n" +"(Pdb) up\n" +"> example.py(10)middle()\n" +"-> return inner(0)" +msgstr "" + +#: library/pdb.rst:859 msgid "Footnotes" msgstr "" -#: library/pdb.rst:644 +#: library/pdb.rst:860 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." @@ -740,18 +1144,18 @@ msgstr "" msgid "cmd" msgstr "" -#: library/pdb.rst:281 +#: library/pdb.rst:400 msgid ".pdbrc" msgstr "" -#: library/pdb.rst:281 +#: library/pdb.rst:400 msgid "file" msgstr "" -#: library/pdb.rst:281 +#: library/pdb.rst:400 msgid "debugger" msgstr "" -#: library/pdb.rst:281 +#: library/pdb.rst:400 msgid "configuration" msgstr "" diff --git a/library/persistence.po b/library/persistence.po index ad7bbdfa..1c71d4f0 100644 --- a/library/persistence.po +++ b/library/persistence.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/pickle.po b/library/pickle.po index fb0d1322..b7da2fce 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pickle.rst:2 -msgid ":mod:`pickle` --- Python object serialization" +msgid ":mod:`!pickle` --- Python object serialization" msgstr "" #: library/pickle.rst:10 @@ -178,9 +179,8 @@ msgstr "" msgid "" "The data format used by :mod:`pickle` is Python-specific. This has the " "advantage that there are no restrictions imposed by external standards such " -"as JSON or XDR (which can't represent pointer sharing); however it means " -"that non-Python programs may not be able to reconstruct pickled Python " -"objects." +"as JSON (which can't represent pointer sharing); however it means that non-" +"Python programs may not be able to reconstruct pickled Python objects." msgstr "" #: library/pickle.rst:131 @@ -234,18 +234,19 @@ msgstr "" msgid "" "Protocol version 4 was added in Python 3.4. It adds support for very large " "objects, pickling more kinds of objects, and some data format " -"optimizations. It is the default protocol starting with Python 3.8. Refer " -"to :pep:`3154` for information about improvements brought by protocol 4." +"optimizations. This was the default protocol in Python 3.8--3.13. Refer to :" +"pep:`3154` for information about improvements brought by protocol 4." msgstr "" #: library/pickle.rst:163 msgid "" "Protocol version 5 was added in Python 3.8. It adds support for out-of-band " -"data and speedup for in-band data. Refer to :pep:`574` for information " -"about improvements brought by protocol 5." +"data and speedup for in-band data. It is the default protocol starting with " +"Python 3.14. Refer to :pep:`574` for information about improvements brought " +"by protocol 5." msgstr "" -#: library/pickle.rst:168 +#: library/pickle.rst:169 msgid "" "Serialization is a more primitive notion than persistence; although :mod:" "`pickle` reads and writes file objects, it does not handle the issue of " @@ -259,11 +260,11 @@ msgid "" "and unpickle objects on DBM-style database files." msgstr "" -#: library/pickle.rst:181 +#: library/pickle.rst:182 msgid "Module Interface" msgstr "" -#: library/pickle.rst:183 +#: library/pickle.rst:184 msgid "" "To serialize an object hierarchy, you simply call the :func:`dumps` " "function. Similarly, to de-serialize a data stream, you call the :func:" @@ -272,149 +273,155 @@ msgid "" "object, respectively." msgstr "" -#: library/pickle.rst:188 +#: library/pickle.rst:189 msgid "The :mod:`pickle` module provides the following constants:" msgstr "" -#: library/pickle.rst:193 +#: library/pickle.rst:194 msgid "" "An integer, the highest :ref:`protocol version ` " "available. This value can be passed as a *protocol* value to functions :" "func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." msgstr "" -#: library/pickle.rst:200 +#: library/pickle.rst:201 msgid "" "An integer, the default :ref:`protocol version ` used for " "pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default " -"protocol is 4, first introduced in Python 3.4 and incompatible with previous " -"versions." +"protocol is 5, introduced in Python 3.8 and incompatible with previous " +"versions. This version introduces support for out-of-band buffers, where :" +"pep:`3118`-compatible data can be transmitted separately from the main " +"pickle stream." msgstr "" -#: library/pickle.rst:207 +#: library/pickle.rst:210 msgid "The default protocol is 3." msgstr "" -#: library/pickle.rst:211 +#: library/pickle.rst:214 msgid "The default protocol is 4." msgstr "" -#: library/pickle.rst:213 +#: library/pickle.rst:218 +msgid "The default protocol is 5." +msgstr "" + +#: library/pickle.rst:220 msgid "" "The :mod:`pickle` module provides the following functions to make the " "pickling process more convenient:" msgstr "" -#: library/pickle.rst:218 +#: library/pickle.rst:225 msgid "" "Write the pickled representation of the object *obj* to the open :term:`file " "object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``." msgstr "" -#: library/pickle.rst:222 +#: library/pickle.rst:229 msgid "" "Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " "same meaning as in the :class:`Pickler` constructor." msgstr "" -#: library/pickle.rst:236 library/pickle.rst:328 +#: library/pickle.rst:243 library/pickle.rst:335 msgid "The *buffer_callback* argument was added." msgstr "" -#: library/pickle.rst:230 +#: library/pickle.rst:237 msgid "" "Return the pickled representation of the object *obj* as a :class:`bytes` " "object, instead of writing it to a file." msgstr "" -#: library/pickle.rst:233 +#: library/pickle.rst:240 msgid "" "Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " "meaning as in the :class:`Pickler` constructor." msgstr "" -#: library/pickle.rst:241 +#: library/pickle.rst:248 msgid "" "Read the pickled representation of an object from the open :term:`file " "object` *file* and return the reconstituted object hierarchy specified " "therein. This is equivalent to ``Unpickler(file).load()``." msgstr "" -#: library/pickle.rst:260 +#: library/pickle.rst:267 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed. Bytes past the pickled representation of the object are " "ignored." msgstr "" -#: library/pickle.rst:249 +#: library/pickle.rst:256 msgid "" "Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and " "*buffers* have the same meaning as in the :class:`Unpickler` constructor." msgstr "" -#: library/pickle.rst:267 library/pickle.rst:429 +#: library/pickle.rst:274 library/pickle.rst:449 msgid "The *buffers* argument was added." msgstr "" -#: library/pickle.rst:257 +#: library/pickle.rst:264 msgid "" "Return the reconstituted object hierarchy of the pickled representation " "*data* of an object. *data* must be a :term:`bytes-like object`." msgstr "" -#: library/pickle.rst:264 +#: library/pickle.rst:271 msgid "" "Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " "the same meaning as in the :class:`Unpickler` constructor." msgstr "" -#: library/pickle.rst:271 +#: library/pickle.rst:278 msgid "The :mod:`pickle` module defines three exceptions:" msgstr "" -#: library/pickle.rst:275 +#: library/pickle.rst:282 msgid "" "Common base class for the other pickling exceptions. It inherits from :exc:" "`Exception`." msgstr "" -#: library/pickle.rst:280 +#: library/pickle.rst:287 msgid "" "Error raised when an unpicklable object is encountered by :class:`Pickler`. " "It inherits from :exc:`PickleError`." msgstr "" -#: library/pickle.rst:283 +#: library/pickle.rst:290 msgid "" "Refer to :ref:`pickle-picklable` to learn what kinds of objects can be " "pickled." msgstr "" -#: library/pickle.rst:288 +#: library/pickle.rst:295 msgid "" "Error raised when there is a problem unpickling an object, such as a data " "corruption or a security violation. It inherits from :exc:`PickleError`." msgstr "" -#: library/pickle.rst:291 +#: library/pickle.rst:298 msgid "" "Note that other exceptions may also be raised during unpickling, including " "(but not necessarily limited to) AttributeError, EOFError, ImportError, and " "IndexError." msgstr "" -#: library/pickle.rst:296 +#: library/pickle.rst:303 msgid "" "The :mod:`pickle` module exports three classes, :class:`Pickler`, :class:" "`Unpickler` and :class:`PickleBuffer`:" msgstr "" -#: library/pickle.rst:301 +#: library/pickle.rst:308 msgid "This takes a binary file for writing a pickle data stream." msgstr "" -#: library/pickle.rst:303 +#: library/pickle.rst:310 msgid "" "The optional *protocol* argument, an integer, tells the pickler to use the " "given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`. If " @@ -422,7 +429,7 @@ msgid "" "number is specified, :data:`HIGHEST_PROTOCOL` is selected." msgstr "" -#: library/pickle.rst:308 +#: library/pickle.rst:315 msgid "" "The *file* argument must have a write() method that accepts a single bytes " "argument. It can thus be an on-disk file opened for binary writing, an :" @@ -430,44 +437,44 @@ msgid "" "interface." msgstr "" -#: library/pickle.rst:313 +#: library/pickle.rst:320 msgid "" "If *fix_imports* is true and *protocol* is less than 3, pickle will try to " "map the new Python 3 names to the old module names used in Python 2, so that " "the pickle data stream is readable with Python 2." msgstr "" -#: library/pickle.rst:317 +#: library/pickle.rst:324 msgid "" -"If *buffer_callback* is None (the default), buffer views are serialized into " -"*file* as part of the pickle stream." +"If *buffer_callback* is ``None`` (the default), buffer views are serialized " +"into *file* as part of the pickle stream." msgstr "" -#: library/pickle.rst:320 +#: library/pickle.rst:327 msgid "" -"If *buffer_callback* is not None, then it can be called any number of times " -"with a buffer view. If the callback returns a false value (such as None), " -"the given buffer is :ref:`out-of-band `; otherwise the buffer is " -"serialized in-band, i.e. inside the pickle stream." +"If *buffer_callback* is not ``None``, then it can be called any number of " +"times with a buffer view. If the callback returns a false value (such as " +"``None``), the given buffer is :ref:`out-of-band `; otherwise " +"the buffer is serialized in-band, i.e. inside the pickle stream." msgstr "" -#: library/pickle.rst:325 +#: library/pickle.rst:332 msgid "" -"It is an error if *buffer_callback* is not None and *protocol* is None or " -"smaller than 5." +"It is an error if *buffer_callback* is not ``None`` and *protocol* is " +"``None`` or smaller than 5." msgstr "" -#: library/pickle.rst:333 +#: library/pickle.rst:340 msgid "" "Write the pickled representation of *obj* to the open file object given in " "the constructor." msgstr "" -#: library/pickle.rst:338 +#: library/pickle.rst:345 msgid "Do nothing by default. This exists so a subclass can override it." msgstr "" -#: library/pickle.rst:340 +#: library/pickle.rst:347 msgid "" "If :meth:`persistent_id` returns ``None``, *obj* is pickled as usual. Any " "other value causes :class:`Pickler` to emit the returned value as a " @@ -476,11 +483,17 @@ msgid "" "by :meth:`persistent_id` cannot itself have a persistent ID." msgstr "" -#: library/pickle.rst:447 +#: library/pickle.rst:467 msgid "See :ref:`pickle-persistent` for details and examples of uses." msgstr "" -#: library/pickle.rst:350 +#: library/pickle.rst:355 +msgid "" +"Add the default implementation of this method in the C implementation of :" +"class:`!Pickler`." +msgstr "" + +#: library/pickle.rst:361 msgid "" "A pickler object's dispatch table is a registry of *reduction functions* of " "the kind which can be declared using :func:`copyreg.pickle`. It is a " @@ -489,7 +502,7 @@ msgid "" "should conform to the same interface as a :meth:`~object.__reduce__` method." msgstr "" -#: library/pickle.rst:358 +#: library/pickle.rst:369 msgid "" "By default, a pickler object will not have a :attr:`dispatch_table` " "attribute, and it will instead use the global dispatch table managed by the :" @@ -500,11 +513,11 @@ msgid "" "table for instances of that class." msgstr "" -#: library/pickle.rst:367 +#: library/pickle.rst:378 msgid "See :ref:`pickle-dispatch` for usage examples." msgstr "" -#: library/pickle.rst:373 +#: library/pickle.rst:384 msgid "" "Special reducer that can be defined in :class:`Pickler` subclasses. This " "method has priority over any reducer in the :attr:`dispatch_table`. It " @@ -513,11 +526,11 @@ msgid "" "`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" -#: library/pickle.rst:379 +#: library/pickle.rst:390 msgid "For a detailed example, see :ref:`reducer_override`." msgstr "" -#: library/pickle.rst:385 +#: library/pickle.rst:396 msgid "" "Deprecated. Enable fast mode if set to a true value. The fast mode disables " "the usage of memo, therefore speeding the pickling process by not generating " @@ -525,21 +538,32 @@ msgid "" "objects, doing otherwise will cause :class:`Pickler` to recurse infinitely." msgstr "" -#: library/pickle.rst:391 +#: library/pickle.rst:402 msgid "Use :func:`pickletools.optimize` if you need more compact pickles." msgstr "" -#: library/pickle.rst:396 +#: library/pickle.rst:406 +msgid "Clears the pickler's \"memo\"." +msgstr "" + +#: library/pickle.rst:408 +msgid "" +"The memo is the data structure that remembers which objects the pickler has " +"already seen, so that shared or recursive objects are pickled by reference " +"and not by value. This method is useful when re-using picklers." +msgstr "" + +#: library/pickle.rst:416 msgid "This takes a binary file for reading a pickle data stream." msgstr "" -#: library/pickle.rst:398 +#: library/pickle.rst:418 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed." msgstr "" -#: library/pickle.rst:401 +#: library/pickle.rst:421 msgid "" "The argument *file* must have three methods, a read() method that takes an " "integer argument, a readinto() method that takes a buffer argument and a " @@ -549,7 +573,7 @@ msgid "" "that meets this interface." msgstr "" -#: library/pickle.rst:408 +#: library/pickle.rst:428 msgid "" "The optional arguments *fix_imports*, *encoding* and *errors* are used to " "control compatibility support for pickle stream generated by Python 2. If " @@ -563,41 +587,47 @@ msgid "" "Python 2." msgstr "" -#: library/pickle.rst:419 +#: library/pickle.rst:439 msgid "" -"If *buffers* is None (the default), then all data necessary for " +"If *buffers* is ``None`` (the default), then all data necessary for " "deserialization must be contained in the pickle stream. This means that the " -"*buffer_callback* argument was None when a :class:`Pickler` was instantiated " -"(or when :func:`dump` or :func:`dumps` was called)." +"*buffer_callback* argument was ``None`` when a :class:`Pickler` was " +"instantiated (or when :func:`dump` or :func:`dumps` was called)." msgstr "" -#: library/pickle.rst:424 +#: library/pickle.rst:444 msgid "" -"If *buffers* is not None, it should be an iterable of buffer-enabled objects " -"that is consumed each time the pickle stream references an :ref:`out-of-band " -"` buffer view. Such buffers have been given in order to the " -"*buffer_callback* of a Pickler object." +"If *buffers* is not ``None``, it should be an iterable of buffer-enabled " +"objects that is consumed each time the pickle stream references an :ref:`out-" +"of-band ` buffer view. Such buffers have been given in order to " +"the *buffer_callback* of a Pickler object." msgstr "" -#: library/pickle.rst:434 +#: library/pickle.rst:454 msgid "" "Read the pickled representation of an object from the open file object given " "in the constructor, and return the reconstituted object hierarchy specified " "therein. Bytes past the pickled representation of the object are ignored." msgstr "" -#: library/pickle.rst:441 +#: library/pickle.rst:461 msgid "Raise an :exc:`UnpicklingError` by default." msgstr "" -#: library/pickle.rst:443 +#: library/pickle.rst:463 msgid "" "If defined, :meth:`persistent_load` should return the object specified by " "the persistent ID *pid*. If an invalid persistent ID is encountered, an :" "exc:`UnpicklingError` should be raised." msgstr "" -#: library/pickle.rst:451 +#: library/pickle.rst:469 +msgid "" +"Add the default implementation of this method in the C implementation of :" +"class:`!Unpickler`." +msgstr "" + +#: library/pickle.rst:475 msgid "" "Import *module* if necessary and return the object called *name* from it, " "where the *module* and *name* arguments are :class:`str` objects. Note, " @@ -605,41 +635,41 @@ msgid "" "functions." msgstr "" -#: library/pickle.rst:456 +#: library/pickle.rst:480 msgid "" "Subclasses may override this to gain control over what type of objects and " "how they can be loaded, potentially reducing security risks. Refer to :ref:" "`pickle-restrict` for details." msgstr "" -#: library/pickle.rst:460 +#: library/pickle.rst:484 msgid "" "Raises an :ref:`auditing event ` ``pickle.find_class`` with " "arguments ``module``, ``name``." msgstr "" -#: library/pickle.rst:464 +#: library/pickle.rst:488 msgid "" "A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" "`buffer-providing ` object, such as a :term:`bytes-like " "object` or a N-dimensional array." msgstr "" -#: library/pickle.rst:468 +#: library/pickle.rst:492 msgid "" ":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " "to pass it to other APIs expecting a buffer-providing object, such as :class:" "`memoryview`." msgstr "" -#: library/pickle.rst:472 +#: library/pickle.rst:496 msgid "" ":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 " "or higher. They are eligible for :ref:`out-of-band serialization `." msgstr "" -#: library/pickle.rst:480 +#: library/pickle.rst:504 msgid "" "Return a :class:`memoryview` of the memory area underlying this buffer. The " "returned object is a one-dimensional, C-contiguous memoryview with format " @@ -647,54 +677,54 @@ msgid "" "neither C- nor Fortran-contiguous." msgstr "" -#: library/pickle.rst:487 +#: library/pickle.rst:511 msgid "Release the underlying buffer exposed by the PickleBuffer object." msgstr "" -#: library/pickle.rst:493 +#: library/pickle.rst:517 msgid "What can be pickled and unpickled?" msgstr "" -#: library/pickle.rst:495 +#: library/pickle.rst:519 msgid "The following types can be pickled:" msgstr "" -#: library/pickle.rst:497 +#: library/pickle.rst:521 msgid "" "built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" "`NotImplemented`);" msgstr "" -#: library/pickle.rst:500 +#: library/pickle.rst:524 msgid "integers, floating-point numbers, complex numbers;" msgstr "" -#: library/pickle.rst:502 +#: library/pickle.rst:526 msgid "strings, bytes, bytearrays;" msgstr "" -#: library/pickle.rst:504 +#: library/pickle.rst:528 msgid "" "tuples, lists, sets, and dictionaries containing only picklable objects;" msgstr "" -#: library/pickle.rst:506 +#: library/pickle.rst:530 msgid "" "functions (built-in and user-defined) accessible from the top level of a " "module (using :keyword:`def`, not :keyword:`lambda`);" msgstr "" -#: library/pickle.rst:509 +#: library/pickle.rst:533 msgid "classes accessible from the top level of a module;" msgstr "" -#: library/pickle.rst:511 +#: library/pickle.rst:535 msgid "" "instances of such classes whose the result of calling :meth:`~object." "__getstate__` is picklable (see section :ref:`pickle-inst` for details)." msgstr "" -#: library/pickle.rst:514 +#: library/pickle.rst:538 msgid "" "Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " "exception; when this happens, an unspecified number of bytes may have " @@ -704,7 +734,7 @@ msgid "" "limit with :func:`sys.setrecursionlimit`." msgstr "" -#: library/pickle.rst:521 +#: library/pickle.rst:545 msgid "" "Note that functions (built-in and user-defined) are pickled by fully :term:" "`qualified name`, not by value. [#]_ This means that only the function name " @@ -715,7 +745,7 @@ msgid "" "exception will be raised. [#]_" msgstr "" -#: library/pickle.rst:528 +#: library/pickle.rst:552 msgid "" "Similarly, classes are pickled by fully qualified name, so the same " "restrictions in the unpickling environment apply. Note that none of the " @@ -723,13 +753,21 @@ msgid "" "attribute ``attr`` is not restored in the unpickling environment::" msgstr "" -#: library/pickle.rst:538 +#: library/pickle.rst:557 +msgid "" +"class Foo:\n" +" attr = 'A class attribute'\n" +"\n" +"picklestring = pickle.dumps(Foo)" +msgstr "" + +#: library/pickle.rst:562 msgid "" "These restrictions are why picklable functions and classes must be defined " "at the top level of a module." msgstr "" -#: library/pickle.rst:541 +#: library/pickle.rst:565 msgid "" "Similarly, when class instances are pickled, their class's code and data are " "not pickled along with them. Only the instance data are pickled. This is " @@ -741,17 +779,17 @@ msgid "" "__setstate__` method." msgstr "" -#: library/pickle.rst:553 +#: library/pickle.rst:577 msgid "Pickling Class Instances" msgstr "" -#: library/pickle.rst:557 +#: library/pickle.rst:581 msgid "" "In this section, we describe the general mechanisms available to you to " "define, customize, and control how class instances are pickled and unpickled." msgstr "" -#: library/pickle.rst:560 +#: library/pickle.rst:584 msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " @@ -761,13 +799,24 @@ msgid "" "The following code shows an implementation of this behaviour::" msgstr "" -#: library/pickle.rst:575 +#: library/pickle.rst:591 +msgid "" +"def save(obj):\n" +" return (obj.__class__, obj.__dict__)\n" +"\n" +"def restore(cls, attributes):\n" +" obj = cls.__new__(cls)\n" +" obj.__dict__.update(attributes)\n" +" return obj" +msgstr "" + +#: library/pickle.rst:599 msgid "" "Classes can alter the default behaviour by providing one or several special " "methods:" msgstr "" -#: library/pickle.rst:580 +#: library/pickle.rst:604 msgid "" "In protocols 2 and newer, classes that implements the :meth:" "`__getnewargs_ex__` method can dictate the values passed to the :meth:" @@ -777,37 +826,37 @@ msgid "" "passed to the :meth:`__new__` method upon unpickling." msgstr "" -#: library/pickle.rst:588 +#: library/pickle.rst:612 msgid "" "You should implement this method if the :meth:`__new__` method of your class " "requires keyword-only arguments. Otherwise, it is recommended for " "compatibility to implement :meth:`__getnewargs__`." msgstr "" -#: library/pickle.rst:592 +#: library/pickle.rst:616 msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." msgstr "" -#: library/pickle.rst:598 +#: library/pickle.rst:622 msgid "" "This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " "supports only positional arguments. It must return a tuple of arguments " "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" -#: library/pickle.rst:602 +#: library/pickle.rst:626 msgid "" ":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " "defined." msgstr "" -#: library/pickle.rst:605 +#: library/pickle.rst:629 msgid "" "Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" "`__getnewargs_ex__` in protocols 2 and 3." msgstr "" -#: library/pickle.rst:612 +#: library/pickle.rst:636 msgid "" "Classes can further influence how their instances are pickled by overriding " "the method :meth:`__getstate__`. It is called and the returned object is " @@ -815,19 +864,19 @@ msgid "" "are several cases:" msgstr "" -#: library/pickle.rst:617 +#: library/pickle.rst:641 msgid "" "For a class that has no instance :attr:`~object.__dict__` and no :attr:" "`~object.__slots__`, the default state is ``None``." msgstr "" -#: library/pickle.rst:620 +#: library/pickle.rst:644 msgid "" "For a class that has an instance :attr:`~object.__dict__` and no :attr:" "`~object.__slots__`, the default state is ``self.__dict__``." msgstr "" -#: library/pickle.rst:623 +#: library/pickle.rst:647 msgid "" "For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." "__slots__`, the default state is a tuple consisting of two dictionaries: " @@ -835,7 +884,7 @@ msgid "" "slots that have a value are included in the latter." msgstr "" -#: library/pickle.rst:629 +#: library/pickle.rst:653 msgid "" "For a class that has :attr:`~object.__slots__` and no instance :attr:" "`~object.__dict__`, the default state is a tuple whose first item is " @@ -843,13 +892,13 @@ msgid "" "values described in the previous bullet." msgstr "" -#: library/pickle.rst:634 +#: library/pickle.rst:658 msgid "" "Added the default implementation of the ``__getstate__()`` method in the :" "class:`object` class." msgstr "" -#: library/pickle.rst:641 +#: library/pickle.rst:665 msgid "" "Upon unpickling, if the class defines :meth:`__setstate__`, it is called " "with the unpickled state. In that case, there is no requirement for the " @@ -857,20 +906,20 @@ msgid "" "dictionary and its items are assigned to the new instance's dictionary." msgstr "" -#: library/pickle.rst:648 +#: library/pickle.rst:672 msgid "" "If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" "meth:`__setstate__` method will not be called upon unpickling." msgstr "" -#: library/pickle.rst:652 +#: library/pickle.rst:676 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " "use the methods :meth:`~object.__getstate__` and :meth:`~object." "__setstate__`." msgstr "" -#: library/pickle.rst:657 +#: library/pickle.rst:681 msgid "" "At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" "`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " @@ -880,7 +929,7 @@ msgid "" "an instance." msgstr "" -#: library/pickle.rst:666 +#: library/pickle.rst:690 msgid "" "As we shall see, pickle does not use directly the methods described above. " "In fact, these methods are part of the copy protocol which implements the :" @@ -889,7 +938,7 @@ msgid "" "objects. [#]_" msgstr "" -#: library/pickle.rst:672 +#: library/pickle.rst:696 msgid "" "Although powerful, implementing :meth:`~object.__reduce__` directly in your " "classes is error prone. For this reason, class designers should use the " @@ -899,14 +948,14 @@ msgid "" "option or leads to more efficient pickling or both." msgstr "" -#: library/pickle.rst:681 +#: library/pickle.rst:705 msgid "" "The interface is currently defined as follows. The :meth:`__reduce__` " "method takes no argument and shall return either a string or preferably a " "tuple (the returned object is often referred to as the \"reduce value\")." msgstr "" -#: library/pickle.rst:685 +#: library/pickle.rst:709 msgid "" "If a string is returned, the string should be interpreted as the name of a " "global variable. It should be the object's local name relative to its " @@ -914,26 +963,26 @@ msgid "" "object's module. This behaviour is typically useful for singletons." msgstr "" -#: library/pickle.rst:690 +#: library/pickle.rst:714 msgid "" "When a tuple is returned, it must be between two and six items long. " "Optional items can either be omitted, or ``None`` can be provided as their " "value. The semantics of each item are in order:" msgstr "" -#: library/pickle.rst:696 +#: library/pickle.rst:720 msgid "" "A callable object that will be called to create the initial version of the " "object." msgstr "" -#: library/pickle.rst:699 +#: library/pickle.rst:723 msgid "" "A tuple of arguments for the callable object. An empty tuple must be given " "if the callable does not accept any argument." msgstr "" -#: library/pickle.rst:702 +#: library/pickle.rst:726 msgid "" "Optionally, the object's state, which will be passed to the object's :meth:" "`__setstate__` method as previously described. If the object has no such " @@ -941,19 +990,19 @@ msgid "" "object's :attr:`~object.__dict__` attribute." msgstr "" -#: library/pickle.rst:707 +#: library/pickle.rst:731 msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " "or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " "for list subclasses, but may be used by other classes as long as they have :" -"ref:`append and extend methods ` with the appropriate " -"signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " -"which pickle protocol version is used as well as the number of items to " -"append, so both must be supported.)" +"meth:`~sequence.append` and :meth:`~sequence.extend` methods with the " +"appropriate signature. (Whether :meth:`!append` or :meth:`!extend` is used " +"depends on which pickle protocol version is used as well as the number of " +"items to append, so both must be supported.)" msgstr "" -#: library/pickle.rst:717 +#: library/pickle.rst:741 msgid "" "Optionally, an iterator (not a sequence) yielding successive key-value " "pairs. These items will be stored to the object using ``obj[key] = " @@ -961,7 +1010,7 @@ msgid "" "by other classes as long as they implement :meth:`__setitem__`." msgstr "" -#: library/pickle.rst:722 +#: library/pickle.rst:746 msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " @@ -970,11 +1019,11 @@ msgid "" "meth:`__setstate__`." msgstr "" -#: library/pickle.rst:728 +#: library/pickle.rst:752 msgid "The optional sixth tuple item, ``(obj, state)``, was added." msgstr "" -#: library/pickle.rst:734 +#: library/pickle.rst:758 msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " @@ -984,11 +1033,11 @@ msgid "" "provide backwards-compatible reduce values for older Python releases." msgstr "" -#: library/pickle.rst:746 +#: library/pickle.rst:770 msgid "Persistence of External Objects" msgstr "" -#: library/pickle.rst:752 +#: library/pickle.rst:776 msgid "" "For the benefit of object persistence, the :mod:`pickle` module supports the " "notion of a reference to an object outside the pickled data stream. Such " @@ -997,7 +1046,7 @@ msgid "" "(for any newer protocol)." msgstr "" -#: library/pickle.rst:758 +#: library/pickle.rst:782 msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " @@ -1005,7 +1054,7 @@ msgid "" "persistent_load` respectively." msgstr "" -#: library/pickle.rst:763 +#: library/pickle.rst:787 msgid "" "To pickle objects that have an external persistent ID, the pickler must have " "a custom :meth:`~Pickler.persistent_id` method that takes an object as an " @@ -1016,64 +1065,186 @@ msgid "" "persistent ID." msgstr "" -#: library/pickle.rst:770 +#: library/pickle.rst:794 msgid "" "To unpickle external objects, the unpickler must have a custom :meth:" "`~Unpickler.persistent_load` method that takes a persistent ID object and " "returns the referenced object." msgstr "" -#: library/pickle.rst:774 +#: library/pickle.rst:798 msgid "" "Here is a comprehensive example presenting how persistent ID can be used to " "pickle external objects by reference." msgstr "" -#: library/pickle.rst:782 +#: library/pickle.rst:801 +msgid "" +"# Simple example presenting how persistent ID can be used to pickle\n" +"# external objects by reference.\n" +"\n" +"import pickle\n" +"import sqlite3\n" +"from collections import namedtuple\n" +"\n" +"# Simple class representing a record in our database.\n" +"MemoRecord = namedtuple(\"MemoRecord\", \"key, task\")\n" +"\n" +"class DBPickler(pickle.Pickler):\n" +"\n" +" def persistent_id(self, obj):\n" +" # Instead of pickling MemoRecord as a regular class instance, we " +"emit a\n" +" # persistent ID.\n" +" if isinstance(obj, MemoRecord):\n" +" # Here, our persistent ID is simply a tuple, containing a tag " +"and a\n" +" # key, which refers to a specific record in the database.\n" +" return (\"MemoRecord\", obj.key)\n" +" else:\n" +" # If obj does not have a persistent ID, return None. This means " +"obj\n" +" # needs to be pickled as usual.\n" +" return None\n" +"\n" +"\n" +"class DBUnpickler(pickle.Unpickler):\n" +"\n" +" def __init__(self, file, connection):\n" +" super().__init__(file)\n" +" self.connection = connection\n" +"\n" +" def persistent_load(self, pid):\n" +" # This method is invoked whenever a persistent ID is encountered.\n" +" # Here, pid is the tuple returned by DBPickler.\n" +" cursor = self.connection.cursor()\n" +" type_tag, key_id = pid\n" +" if type_tag == \"MemoRecord\":\n" +" # Fetch the referenced record from the database and return it.\n" +" cursor.execute(\"SELECT * FROM memos WHERE key=?\", " +"(str(key_id),))\n" +" key, task = cursor.fetchone()\n" +" return MemoRecord(key, task)\n" +" else:\n" +" # Always raises an error if you cannot return the correct " +"object.\n" +" # Otherwise, the unpickler will think None is the object " +"referenced\n" +" # by the persistent ID.\n" +" raise pickle.UnpicklingError(\"unsupported persistent object\")\n" +"\n" +"\n" +"def main():\n" +" import io\n" +" import pprint\n" +"\n" +" # Initialize and populate our database.\n" +" conn = sqlite3.connect(\":memory:\")\n" +" cursor = conn.cursor()\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " +"TEXT)\")\n" +" tasks = (\n" +" 'give food to fish',\n" +" 'prepare group meeting',\n" +" 'fight with a zebra',\n" +" )\n" +" for task in tasks:\n" +" cursor.execute(\"INSERT INTO memos VALUES(NULL, ?)\", (task,))\n" +"\n" +" # Fetch the records to be pickled.\n" +" cursor.execute(\"SELECT * FROM memos\")\n" +" memos = [MemoRecord(key, task) for key, task in cursor]\n" +" # Save the records using our custom DBPickler.\n" +" file = io.BytesIO()\n" +" DBPickler(file).dump(memos)\n" +"\n" +" print(\"Pickled records:\")\n" +" pprint.pprint(memos)\n" +"\n" +" # Update a record, just for good measure.\n" +" cursor.execute(\"UPDATE memos SET task='learn italian' WHERE key=1\")\n" +"\n" +" # Load the records from the pickle data stream.\n" +" file.seek(0)\n" +" memos = DBUnpickler(file, conn).load()\n" +"\n" +" print(\"Unpickled records:\")\n" +" pprint.pprint(memos)\n" +"\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" +msgstr "" + +#: library/pickle.rst:806 msgid "Dispatch Tables" msgstr "" -#: library/pickle.rst:784 +#: library/pickle.rst:808 msgid "" "If one wants to customize pickling of some classes without disturbing any " "other code which depends on pickling, then one can create a pickler with a " "private dispatch table." msgstr "" -#: library/pickle.rst:788 +#: library/pickle.rst:812 msgid "" "The global dispatch table managed by the :mod:`copyreg` module is available " "as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " "modified copy of :data:`!copyreg.dispatch_table` as a private dispatch table." msgstr "" -#: library/pickle.rst:793 +#: library/pickle.rst:817 msgid "For example ::" msgstr "" -#: library/pickle.rst:800 +#: library/pickle.rst:819 +msgid "" +"f = io.BytesIO()\n" +"p = pickle.Pickler(f)\n" +"p.dispatch_table = copyreg.dispatch_table.copy()\n" +"p.dispatch_table[SomeClass] = reduce_SomeClass" +msgstr "" + +#: library/pickle.rst:824 msgid "" "creates an instance of :class:`pickle.Pickler` with a private dispatch table " "which handles the ``SomeClass`` class specially. Alternatively, the code ::" msgstr "" -#: library/pickle.rst:810 +#: library/pickle.rst:828 +msgid "" +"class MyPickler(pickle.Pickler):\n" +" dispatch_table = copyreg.dispatch_table.copy()\n" +" dispatch_table[SomeClass] = reduce_SomeClass\n" +"f = io.BytesIO()\n" +"p = MyPickler(f)" +msgstr "" + +#: library/pickle.rst:834 msgid "" "does the same but all instances of ``MyPickler`` will by default share the " "private dispatch table. On the other hand, the code ::" msgstr "" -#: library/pickle.rst:817 +#: library/pickle.rst:837 +msgid "" +"copyreg.pickle(SomeClass, reduce_SomeClass)\n" +"f = io.BytesIO()\n" +"p = pickle.Pickler(f)" +msgstr "" + +#: library/pickle.rst:841 msgid "" "modifies the global dispatch table shared by all users of the :mod:`copyreg` " "module." msgstr "" -#: library/pickle.rst:822 +#: library/pickle.rst:846 msgid "Handling Stateful Objects" msgstr "" -#: library/pickle.rst:828 +#: library/pickle.rst:852 msgid "" "Here's an example that shows how to modify pickling behavior for a class. " "The :class:`!TextReader` class below opens a text file, and returns the line " @@ -1085,15 +1256,67 @@ msgid "" "behavior. ::" msgstr "" -#: library/pickle.rst:874 +#: library/pickle.rst:860 +msgid "" +"class TextReader:\n" +" \"\"\"Print and number lines in a text file.\"\"\"\n" +"\n" +" def __init__(self, filename):\n" +" self.filename = filename\n" +" self.file = open(filename)\n" +" self.lineno = 0\n" +"\n" +" def readline(self):\n" +" self.lineno += 1\n" +" line = self.file.readline()\n" +" if not line:\n" +" return None\n" +" if line.endswith('\\n'):\n" +" line = line[:-1]\n" +" return \"%i: %s\" % (self.lineno, line)\n" +"\n" +" def __getstate__(self):\n" +" # Copy the object's state from self.__dict__ which contains\n" +" # all our instance attributes. Always use the dict.copy()\n" +" # method to avoid modifying the original state.\n" +" state = self.__dict__.copy()\n" +" # Remove the unpicklable entries.\n" +" del state['file']\n" +" return state\n" +"\n" +" def __setstate__(self, state):\n" +" # Restore instance attributes (i.e., filename and lineno).\n" +" self.__dict__.update(state)\n" +" # Restore the previously opened file's state. To do so, we need to\n" +" # reopen it and read from it until the line count is restored.\n" +" file = open(self.filename)\n" +" for _ in range(self.lineno):\n" +" file.readline()\n" +" # Finally, save the file.\n" +" self.file = file" +msgstr "" + +#: library/pickle.rst:898 msgid "A sample usage might be something like this::" msgstr "" -#: library/pickle.rst:888 +#: library/pickle.rst:900 +msgid "" +">>> reader = TextReader(\"hello.txt\")\n" +">>> reader.readline()\n" +"'1: Hello world!'\n" +">>> reader.readline()\n" +"'2: I am line number two.'\n" +">>> new_reader = pickle.loads(pickle.dumps(reader))\n" +">>> new_reader.readline()\n" +"'3: Goodbye!'" +msgstr "" + +#: library/pickle.rst:912 msgid "Custom Reduction for Types, Functions, and Other Objects" msgstr "" -#: library/pickle.rst:892 +#: library/pickle.rst:916 msgid "" "Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " "particular we may want to customize pickling based on another criterion than " @@ -1101,7 +1324,7 @@ msgid "" "classes." msgstr "" -#: library/pickle.rst:897 +#: library/pickle.rst:921 msgid "" "For those cases, it is possible to subclass from the :class:`Pickler` class " "and implement a :meth:`~Pickler.reducer_override` method. This method can " @@ -1110,14 +1333,14 @@ msgid "" "behavior." msgstr "" -#: library/pickle.rst:902 +#: library/pickle.rst:926 msgid "" "If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." "reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " "takes priority." msgstr "" -#: library/pickle.rst:907 +#: library/pickle.rst:931 msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " @@ -1126,17 +1349,48 @@ msgid "" "`tuple`." msgstr "" -#: library/pickle.rst:913 +#: library/pickle.rst:937 msgid "" "Here is a simple example where we allow pickling and reconstructing a given " "class::" msgstr "" -#: library/pickle.rst:948 +#: library/pickle.rst:940 +msgid "" +"import io\n" +"import pickle\n" +"\n" +"class MyClass:\n" +" my_attribute = 1\n" +"\n" +"class MyPickler(pickle.Pickler):\n" +" def reducer_override(self, obj):\n" +" \"\"\"Custom reducer for MyClass.\"\"\"\n" +" if getattr(obj, \"__name__\", None) == \"MyClass\":\n" +" return type, (obj.__name__, obj.__bases__,\n" +" {'my_attribute': obj.my_attribute})\n" +" else:\n" +" # For any other object, fallback to usual reduction\n" +" return NotImplemented\n" +"\n" +"f = io.BytesIO()\n" +"p = MyPickler(f)\n" +"p.dump(MyClass)\n" +"\n" +"del MyClass\n" +"\n" +"unpickled_class = pickle.loads(f.getvalue())\n" +"\n" +"assert isinstance(unpickled_class, type)\n" +"assert unpickled_class.__name__ == \"MyClass\"\n" +"assert unpickled_class.my_attribute == 1" +msgstr "" + +#: library/pickle.rst:972 msgid "Out-of-band Buffers" msgstr "" -#: library/pickle.rst:952 +#: library/pickle.rst:976 msgid "" "In some contexts, the :mod:`pickle` module is used to transfer massive " "amounts of data. Therefore, it can be important to minimize the number of " @@ -1146,7 +1400,7 @@ msgid "" "involves copying data to and from the pickle stream." msgstr "" -#: library/pickle.rst:959 +#: library/pickle.rst:983 msgid "" "This constraint can be eschewed if both the *provider* (the implementation " "of the object types to be transferred) and the *consumer* (the " @@ -1154,11 +1408,11 @@ msgid "" "transfer facilities provided by pickle protocol 5 and higher." msgstr "" -#: library/pickle.rst:965 +#: library/pickle.rst:989 msgid "Provider API" msgstr "" -#: library/pickle.rst:967 +#: library/pickle.rst:991 msgid "" "The large data objects to be pickled must implement a :meth:`~object." "__reduce_ex__` method specialized for protocol 5 and higher, which returns " @@ -1166,7 +1420,7 @@ msgid "" "for any large data." msgstr "" -#: library/pickle.rst:972 +#: library/pickle.rst:996 msgid "" "A :class:`PickleBuffer` object *signals* that the underlying buffer is " "eligible for out-of-band data transfer. Those objects remain compatible " @@ -1175,17 +1429,17 @@ msgid "" "themselves." msgstr "" -#: library/pickle.rst:979 +#: library/pickle.rst:1003 msgid "Consumer API" msgstr "" -#: library/pickle.rst:981 +#: library/pickle.rst:1005 msgid "" "A communications system can enable custom handling of the :class:" "`PickleBuffer` objects generated when serializing an object graph." msgstr "" -#: library/pickle.rst:984 +#: library/pickle.rst:1008 msgid "" "On the sending side, it needs to pass a *buffer_callback* argument to :class:" "`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " @@ -1194,7 +1448,7 @@ msgid "" "copied into the pickle stream, only a cheap marker will be inserted." msgstr "" -#: library/pickle.rst:991 +#: library/pickle.rst:1015 msgid "" "On the receiving side, it needs to pass a *buffers* argument to :class:" "`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " @@ -1205,7 +1459,7 @@ msgid "" "`PickleBuffer` objects." msgstr "" -#: library/pickle.rst:999 +#: library/pickle.rst:1023 msgid "" "Between the sending side and the receiving side, the communications system " "is free to implement its own transfer mechanism for out-of-band buffers. " @@ -1213,36 +1467,79 @@ msgid "" "dependent compression." msgstr "" -#: library/pickle.rst:1005 +#: library/pickle.rst:1029 msgid "Example" msgstr "" -#: library/pickle.rst:1007 +#: library/pickle.rst:1031 msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" -#: library/pickle.rst:1031 +#: library/pickle.rst:1034 +msgid "" +"class ZeroCopyByteArray(bytearray):\n" +"\n" +" def __reduce_ex__(self, protocol):\n" +" if protocol >= 5:\n" +" return type(self)._reconstruct, (PickleBuffer(self),), None\n" +" else:\n" +" # PickleBuffer is forbidden with pickle protocols <= 4.\n" +" return type(self)._reconstruct, (bytearray(self),)\n" +"\n" +" @classmethod\n" +" def _reconstruct(cls, obj):\n" +" with memoryview(obj) as m:\n" +" # Get a handle over the original buffer object\n" +" obj = m.obj\n" +" if type(obj) is cls:\n" +" # Original buffer object is a ZeroCopyByteArray, return it\n" +" # as-is.\n" +" return obj\n" +" else:\n" +" return cls(obj)" +msgstr "" + +#: library/pickle.rst:1055 msgid "" "The reconstructor (the ``_reconstruct`` class method) returns the buffer's " "providing object if it has the right type. This is an easy way to simulate " "zero-copy behaviour on this toy example." msgstr "" -#: library/pickle.rst:1035 +#: library/pickle.rst:1059 msgid "" "On the consumer side, we can pickle those objects the usual way, which when " "unserialized will give us a copy of the original object::" msgstr "" -#: library/pickle.rst:1044 +#: library/pickle.rst:1062 +msgid "" +"b = ZeroCopyByteArray(b\"abc\")\n" +"data = pickle.dumps(b, protocol=5)\n" +"new_b = pickle.loads(data)\n" +"print(b == new_b) # True\n" +"print(b is new_b) # False: a copy was made" +msgstr "" + +#: library/pickle.rst:1068 msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" msgstr "" -#: library/pickle.rst:1054 +#: library/pickle.rst:1071 +msgid "" +"b = ZeroCopyByteArray(b\"abc\")\n" +"buffers = []\n" +"data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append)\n" +"new_b = pickle.loads(data, buffers=buffers)\n" +"print(b == new_b) # True\n" +"print(b is new_b) # True: no copy was made" +msgstr "" + +#: library/pickle.rst:1078 msgid "" "This example is limited by the fact that :class:`bytearray` allocates its " "own memory: you cannot create a :class:`bytearray` instance that is backed " @@ -1252,15 +1549,15 @@ msgid "" "processes or systems." msgstr "" -#: library/pickle.rst:1061 +#: library/pickle.rst:1085 msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" msgstr "" -#: library/pickle.rst:1067 +#: library/pickle.rst:1091 msgid "Restricting Globals" msgstr "" -#: library/pickle.rst:1072 +#: library/pickle.rst:1096 msgid "" "By default, unpickling will import any class or function that it finds in " "the pickle data. For many applications, this behaviour is unacceptable as " @@ -1268,7 +1565,15 @@ msgid "" "what this hand-crafted pickle data stream does when loaded::" msgstr "" -#: library/pickle.rst:1082 +#: library/pickle.rst:1101 +msgid "" +">>> import pickle\n" +">>> pickle.loads(b\"cos\\nsystem\\n(S'echo hello world'\\ntR.\")\n" +"hello world\n" +"0" +msgstr "" + +#: library/pickle.rst:1106 msgid "" "In this example, the unpickler imports the :func:`os.system` function and " "then apply the string argument \"echo hello world\". Although this example " @@ -1276,7 +1581,7 @@ msgid "" "system." msgstr "" -#: library/pickle.rst:1086 +#: library/pickle.rst:1110 msgid "" "For this reason, you may want to control what gets unpickled by customizing :" "meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." @@ -1285,17 +1590,62 @@ msgid "" "restrict them to a safe subset." msgstr "" -#: library/pickle.rst:1092 +#: library/pickle.rst:1116 msgid "" "Here is an example of an unpickler allowing only few safe classes from the :" "mod:`builtins` module to be loaded::" msgstr "" -#: library/pickle.rst:1121 +#: library/pickle.rst:1119 +msgid "" +"import builtins\n" +"import io\n" +"import pickle\n" +"\n" +"safe_builtins = {\n" +" 'range',\n" +" 'complex',\n" +" 'set',\n" +" 'frozenset',\n" +" 'slice',\n" +"}\n" +"\n" +"class RestrictedUnpickler(pickle.Unpickler):\n" +"\n" +" def find_class(self, module, name):\n" +" # Only allow safe classes from builtins.\n" +" if module == \"builtins\" and name in safe_builtins:\n" +" return getattr(builtins, name)\n" +" # Forbid everything else.\n" +" raise pickle.UnpicklingError(\"global '%s.%s' is forbidden\" %\n" +" (module, name))\n" +"\n" +"def restricted_loads(s):\n" +" \"\"\"Helper function analogous to pickle.loads().\"\"\"\n" +" return RestrictedUnpickler(io.BytesIO(s)).load()" +msgstr "" + +#: library/pickle.rst:1145 msgid "A sample usage of our unpickler working as intended::" msgstr "" -#: library/pickle.rst:1140 +#: library/pickle.rst:1147 +msgid "" +">>> restricted_loads(pickle.dumps([1, 2, range(15)]))\n" +"[1, 2, range(0, 15)]\n" +">>> restricted_loads(b\"cos\\nsystem\\n(S'echo hello world'\\ntR.\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"pickle.UnpicklingError: global 'os.system' is forbidden\n" +">>> restricted_loads(b'cbuiltins\\neval\\n'\n" +"... b'(S\\'getattr(__import__(\"os\"), \"system\")'\n" +"... b'(\"echo hello world\")\\'\\ntR.')\n" +"Traceback (most recent call last):\n" +" ...\n" +"pickle.UnpicklingError: global 'builtins.eval' is forbidden" +msgstr "" + +#: library/pickle.rst:1164 msgid "" "As our examples shows, you have to be careful with what you allow to be " "unpickled. Therefore if security is a concern, you may want to consider " @@ -1303,97 +1653,149 @@ msgid "" "party solutions." msgstr "" -#: library/pickle.rst:1147 +#: library/pickle.rst:1171 msgid "Performance" msgstr "" -#: library/pickle.rst:1149 +#: library/pickle.rst:1173 msgid "" "Recent versions of the pickle protocol (from protocol 2 and upwards) feature " "efficient binary encodings for several common features and built-in types. " "Also, the :mod:`pickle` module has a transparent optimizer written in C." msgstr "" -#: library/pickle.rst:1157 +#: library/pickle.rst:1181 msgid "Examples" msgstr "" -#: library/pickle.rst:1159 +#: library/pickle.rst:1183 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" msgstr "" -#: library/pickle.rst:1175 +#: library/pickle.rst:1185 +msgid "" +"import pickle\n" +"\n" +"# An arbitrary collection of objects supported by pickle.\n" +"data = {\n" +" 'a': [1, 2.0, 3+4j],\n" +" 'b': (\"character string\", b\"byte string\"),\n" +" 'c': {None, True, False}\n" +"}\n" +"\n" +"with open('data.pickle', 'wb') as f:\n" +" # Pickle the 'data' dictionary using the highest protocol available.\n" +" pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)" +msgstr "" + +#: library/pickle.rst:1199 msgid "The following example reads the resulting pickled data. ::" msgstr "" -#: library/pickle.rst:1192 +#: library/pickle.rst:1201 +msgid "" +"import pickle\n" +"\n" +"with open('data.pickle', 'rb') as f:\n" +" # The protocol version used is detected automatically, so we do not\n" +" # have to specify it.\n" +" data = pickle.load(f)" +msgstr "" + +#: library/pickle.rst:1216 +msgid "Command-line interface" +msgstr "" + +#: library/pickle.rst:1218 +msgid "" +"The :mod:`pickle` module can be invoked as a script from the command line, " +"it will display contents of the pickle files. However, when the pickle file " +"that you want to examine comes from an untrusted source, ``-m pickletools`` " +"is a safer option because it does not execute pickle bytecode, see :ref:" +"`pickletools CLI usage `." +msgstr "" + +#: library/pickle.rst:1224 +msgid "python -m pickle pickle_file [pickle_file ...]" +msgstr "" + +#: library/pickle.rst:1228 +msgid "The following option is accepted:" +msgstr "" + +#: library/pickle.rst:1234 +msgid "" +"A pickle file to read, or ``-`` to indicate reading from standard input." +msgstr "" + +#: library/pickle.rst:1239 msgid "Module :mod:`copyreg`" msgstr "" -#: library/pickle.rst:1192 +#: library/pickle.rst:1240 msgid "Pickle interface constructor registration for extension types." msgstr "" -#: library/pickle.rst:1195 +#: library/pickle.rst:1242 msgid "Module :mod:`pickletools`" msgstr "" -#: library/pickle.rst:1195 +#: library/pickle.rst:1243 msgid "Tools for working with and analyzing pickled data." msgstr "" -#: library/pickle.rst:1198 +#: library/pickle.rst:1245 msgid "Module :mod:`shelve`" msgstr "" -#: library/pickle.rst:1198 +#: library/pickle.rst:1246 msgid "Indexed databases of objects; uses :mod:`pickle`." msgstr "" -#: library/pickle.rst:1201 +#: library/pickle.rst:1248 msgid "Module :mod:`copy`" msgstr "" -#: library/pickle.rst:1201 +#: library/pickle.rst:1249 msgid "Shallow and deep object copying." msgstr "" -#: library/pickle.rst:1203 +#: library/pickle.rst:1251 msgid "Module :mod:`marshal`" msgstr "" -#: library/pickle.rst:1204 +#: library/pickle.rst:1252 msgid "High-performance serialization of built-in types." msgstr "" -#: library/pickle.rst:1208 +#: library/pickle.rst:1256 msgid "Footnotes" msgstr "" -#: library/pickle.rst:1209 +#: library/pickle.rst:1257 msgid "Don't confuse this with the :mod:`marshal` module" msgstr "" -#: library/pickle.rst:1211 +#: library/pickle.rst:1259 msgid "" "This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" "lambda` functions share the same name: ````." msgstr "" -#: library/pickle.rst:1214 +#: library/pickle.rst:1262 msgid "" "The exception raised will likely be an :exc:`ImportError` or an :exc:" "`AttributeError` but it could be something else." msgstr "" -#: library/pickle.rst:1217 +#: library/pickle.rst:1265 msgid "" "The :mod:`copy` module uses this protocol for shallow and deep copying " "operations." msgstr "" -#: library/pickle.rst:1220 +#: library/pickle.rst:1268 msgid "" "The limitation on alphanumeric characters is due to the fact that persistent " "IDs in protocol 0 are delimited by the newline character. Therefore if any " @@ -1433,30 +1835,30 @@ msgstr "" msgid "External Data Representation" msgstr "" -#: library/pickle.rst:664 +#: library/pickle.rst:688 msgid "copy" msgstr "" -#: library/pickle.rst:664 +#: library/pickle.rst:688 msgid "protocol" msgstr "" -#: library/pickle.rst:748 +#: library/pickle.rst:772 msgid "persistent_id (pickle protocol)" msgstr "" -#: library/pickle.rst:748 +#: library/pickle.rst:772 msgid "persistent_load (pickle protocol)" msgstr "" -#: library/pickle.rst:824 +#: library/pickle.rst:848 msgid "__getstate__() (copy protocol)" msgstr "" -#: library/pickle.rst:824 +#: library/pickle.rst:848 msgid "__setstate__() (copy protocol)" msgstr "" -#: library/pickle.rst:1069 +#: library/pickle.rst:1093 msgid "find_class() (pickle protocol)" msgstr "" diff --git a/library/pickletools.po b/library/pickletools.po index dbaa5bc1..e7f83256 100644 --- a/library/pickletools.po +++ b/library/pickletools.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pickletools.rst:2 -msgid ":mod:`pickletools` --- Tools for pickle developers" +msgid ":mod:`!pickletools` --- Tools for pickle developers" msgstr "" #: library/pickletools.rst:8 @@ -35,7 +36,7 @@ msgid "" msgstr "" #: library/pickletools.rst:23 -msgid "Command line usage" +msgid "Command-line usage" msgstr "" #: library/pickletools.rst:27 @@ -52,8 +53,23 @@ msgstr "" msgid "For example, with a tuple ``(1, 2)`` pickled in file ``x.pickle``:" msgstr "" +#: library/pickletools.rst:37 +msgid "" +"$ python -m pickle x.pickle\n" +"(1, 2)\n" +"\n" +"$ python -m pickletools x.pickle\n" +" 0: \\x80 PROTO 3\n" +" 2: K BININT1 1\n" +" 4: K BININT1 2\n" +" 6: \\x86 TUPLE2\n" +" 7: q BINPUT 0\n" +" 9: . STOP\n" +"highest protocol among opcodes = 2" +msgstr "" + #: library/pickletools.rst:52 -msgid "Command line options" +msgid "Command-line options" msgstr "" #: library/pickletools.rst:58 @@ -75,15 +91,20 @@ msgstr "" #: library/pickletools.rst:75 msgid "" -"When more than one pickle file are specified, print given preamble before " +"When more than one pickle file is specified, print given preamble before " "each disassembly." msgstr "" -#: library/pickletools.rst:81 -msgid "Programmatic Interface" +#: library/pickletools.rst:80 +msgid "" +"A pickle file to read, or ``-`` to indicate reading from standard input." +msgstr "" + +#: library/pickletools.rst:85 +msgid "Programmatic interface" msgstr "" -#: library/pickletools.rst:86 +#: library/pickletools.rst:90 msgid "" "Outputs a symbolic disassembly of the pickle to the file-like object *out*, " "defaulting to ``sys.stdout``. *pickle* can be a string or a file-like " @@ -96,11 +117,11 @@ msgid "" "where annotation should start." msgstr "" -#: library/pickletools.rst:97 +#: library/pickletools.rst:101 msgid "Added the *annotate* parameter." msgstr "" -#: library/pickletools.rst:102 +#: library/pickletools.rst:106 msgid "" "Provides an :term:`iterator` over all of the opcodes in a pickle, returning " "a sequence of ``(opcode, arg, pos)`` triples. *opcode* is an instance of " @@ -109,7 +130,7 @@ msgid "" "is located. *pickle* can be a string or a file-like object." msgstr "" -#: library/pickletools.rst:110 +#: library/pickletools.rst:114 msgid "" "Returns a new equivalent pickle string after eliminating unused ``PUT`` " "opcodes. The optimized pickle is shorter, takes less transmission time, " diff --git a/library/pipes.po b/library/pipes.po index fe5b15fd..7fc99b82 100644 --- a/library/pipes.po +++ b/library/pipes.po @@ -8,113 +8,32 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pipes.rst:2 -msgid ":mod:`pipes` --- Interface to shell pipelines" +msgid ":mod:`!pipes` --- Interface to shell pipelines" msgstr "" -#: library/pipes.rst:11 -msgid "**Source code:** :source:`Lib/pipes.py`" -msgstr "" - -#: library/pipes.rst:17 +#: library/pipes.rst:10 msgid "" -"The :mod:`pipes` module is deprecated (see :pep:`PEP 594 <594#pipes>` for " -"details). Please use the :mod:`subprocess` module instead." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/pipes.rst:20 -msgid "" -"The :mod:`pipes` module defines a class to abstract the concept of a " -"*pipeline* --- a sequence of converters from one file to another." +#: library/pipes.rst:14 +msgid "Applications should use the :mod:`subprocess` module instead." msgstr "" -#: library/pipes.rst:23 +#: library/pipes.rst:16 msgid "" -"Because the module uses :program:`/bin/sh` command lines, a POSIX or " -"compatible shell for :func:`os.system` and :func:`os.popen` is required." -msgstr "" - -#: library/pipes.rst:26 -msgid ":ref:`Availability `: Unix, not VxWorks." -msgstr "" - -#: library/pipes.rst:28 -msgid "The :mod:`pipes` module defines the following class:" -msgstr "" - -#: library/pipes.rst:33 -msgid "An abstraction of a pipeline." -msgstr "" - -#: library/pipes.rst:35 -msgid "Example::" -msgstr "" - -#: library/pipes.rst:50 -msgid "Template Objects" -msgstr "" - -#: library/pipes.rst:52 -msgid "Template objects following methods:" -msgstr "" - -#: library/pipes.rst:57 -msgid "Restore a pipeline template to its initial state." -msgstr "" - -#: library/pipes.rst:62 -msgid "Return a new, equivalent, pipeline template." -msgstr "" - -#: library/pipes.rst:67 -msgid "" -"If *flag* is true, turn debugging on. Otherwise, turn debugging off. When " -"debugging is on, commands to be executed are printed, and the shell is given " -"``set -x`` command to be more verbose." -msgstr "" - -#: library/pipes.rst:74 -msgid "" -"Append a new action at the end. The *cmd* variable must be a valid bourne " -"shell command. The *kind* variable consists of two letters." -msgstr "" - -#: library/pipes.rst:77 -msgid "" -"The first letter can be either of ``'-'`` (which means the command reads its " -"standard input), ``'f'`` (which means the commands reads a given file on the " -"command line) or ``'.'`` (which means the commands reads no input, and hence " -"must be first.)" -msgstr "" - -#: library/pipes.rst:82 -msgid "" -"Similarly, the second letter can be either of ``'-'`` (which means the " -"command writes to standard output), ``'f'`` (which means the command writes " -"a file on the command line) or ``'.'`` (which means the command does not " -"write anything, and hence must be last.)" -msgstr "" - -#: library/pipes.rst:90 -msgid "" -"Add a new action at the beginning. See :meth:`append` for explanations of " -"the arguments." -msgstr "" - -#: library/pipes.rst:96 -msgid "" -"Return a file-like object, open to *file*, but read from or written to by " -"the pipeline. Note that only one of ``'r'``, ``'w'`` may be given." -msgstr "" - -#: library/pipes.rst:102 -msgid "Copy *infile* to *outfile* through the pipe." +"The last version of Python that provided the :mod:`!pipes` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/pkgutil.po b/library/pkgutil.po index d485c3d1..74589952 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pkgutil.rst:2 -msgid ":mod:`pkgutil` --- Package extension utility" +msgid ":mod:`!pkgutil` --- Package extension utility" msgstr "" #: library/pkgutil.rst:7 @@ -40,33 +41,39 @@ msgid "" "use is to place the following code in a package's :file:`__init__.py`::" msgstr "" +#: library/pkgutil.rst:25 +msgid "" +"from pkgutil import extend_path\n" +"__path__ = extend_path(__path__, __name__)" +msgstr "" + #: library/pkgutil.rst:28 msgid "" "For each directory on :data:`sys.path` that has a subdirectory that matches " -"the package name, add the subdirectory to the package's :attr:`__path__`. " -"This is useful if one wants to distribute different parts of a single " -"logical package as multiple directories." +"the package name, add the subdirectory to the package's :attr:`~module." +"__path__`. This is useful if one wants to distribute different parts of a " +"single logical package as multiple directories." msgstr "" -#: library/pkgutil.rst:33 +#: library/pkgutil.rst:34 msgid "" "It also looks for :file:`\\*.pkg` files beginning where ``*`` matches the " "*name* argument. This feature is similar to :file:`\\*.pth` files (see the :" "mod:`site` module for more information), except that it doesn't special-case " "lines starting with ``import``. A :file:`\\*.pkg` file is trusted at face " -"value: apart from checking for duplicates, all entries found in a :file:`\\*." -"pkg` file are added to the path, regardless of whether they exist on the " -"filesystem. (This is a feature.)" +"value: apart from skipping blank lines and ignoring comments, all entries " +"found in a :file:`\\*.pkg` file are added to the path, regardless of whether " +"they exist on the filesystem (this is a feature)." msgstr "" -#: library/pkgutil.rst:41 +#: library/pkgutil.rst:42 msgid "" "If the input path is not a list (as is the case for frozen packages) it is " "returned unchanged. The input path is not modified; an extended copy is " "returned. Items are only appended to the copy at the end." msgstr "" -#: library/pkgutil.rst:45 +#: library/pkgutil.rst:46 msgid "" "It is assumed that :data:`sys.path` is a sequence. Items of :data:`sys." "path` that are not strings referring to existing directories are ignored. " @@ -75,99 +82,67 @@ msgid "" "isdir` behavior)." msgstr "" -#: library/pkgutil.rst:53 -msgid "Retrieve a module :term:`loader` for the given *fullname*." -msgstr "" - #: library/pkgutil.rst:55 -msgid "" -"This is a backwards compatibility wrapper around :func:`importlib.util." -"find_spec` that converts most failures to :exc:`ImportError` and only " -"returns the loader rather than the full :class:`importlib.machinery." -"ModuleSpec`." -msgstr "" - -#: library/pkgutil.rst:81 library/pkgutil.rst:120 library/pkgutil.rst:180 -msgid "" -"Updated to be based directly on :mod:`importlib` rather than relying on the " -"package internal :pep:`302` import emulation." -msgstr "" - -#: library/pkgutil.rst:100 -msgid "Updated to be based on :pep:`451`" -msgstr "" - -#: library/pkgutil.rst:104 -msgid "Use :func:`importlib.util.find_spec` instead." -msgstr "" - -#: library/pkgutil.rst:73 msgid "Retrieve a :term:`finder` for the given *path_item*." msgstr "" -#: library/pkgutil.rst:75 +#: library/pkgutil.rst:57 msgid "" "The returned finder is cached in :data:`sys.path_importer_cache` if it was " "newly created by a path hook." msgstr "" -#: library/pkgutil.rst:78 +#: library/pkgutil.rst:60 msgid "" "The cache (or part of it) can be cleared manually if a rescan of :data:`sys." "path_hooks` is necessary." msgstr "" -#: library/pkgutil.rst:88 -msgid "Get a :term:`loader` object for *module_or_name*." -msgstr "" - -#: library/pkgutil.rst:90 +#: library/pkgutil.rst:81 library/pkgutil.rst:141 msgid "" -"If the module or package is accessible via the normal import mechanism, a " -"wrapper around the relevant part of that machinery is returned. Returns " -"``None`` if the module cannot be found or imported. If the named module is " -"not already imported, its containing package (if any) is imported, in order " -"to establish the package ``__path__``." +"Updated to be based directly on :mod:`importlib` rather than relying on the " +"package internal :pep:`302` import emulation." msgstr "" -#: library/pkgutil.rst:109 +#: library/pkgutil.rst:70 msgid "Yield :term:`finder` objects for the given module name." msgstr "" -#: library/pkgutil.rst:111 +#: library/pkgutil.rst:72 msgid "" -"If fullname contains a ``'.'``, the finders will be for the package " -"containing fullname, otherwise they will be all registered top level finders " -"(i.e. those on both :data:`sys.meta_path` and :data:`sys.path_hooks`)." +"If *fullname* contains a ``'.'``, the finders will be for the package " +"containing *fullname*, otherwise they will be all registered top level " +"finders (i.e. those on both :data:`sys.meta_path` and :data:`sys." +"path_hooks`)." msgstr "" -#: library/pkgutil.rst:115 +#: library/pkgutil.rst:76 msgid "" "If the named module is in a package, that package is imported as a side " "effect of invoking this function." msgstr "" -#: library/pkgutil.rst:118 +#: library/pkgutil.rst:79 msgid "If no module name is specified, all top level finders are produced." msgstr "" -#: library/pkgutil.rst:127 +#: library/pkgutil.rst:88 msgid "" "Yields :class:`ModuleInfo` for all submodules on *path*, or, if *path* is " "``None``, all top-level modules on :data:`sys.path`." msgstr "" -#: library/pkgutil.rst:151 +#: library/pkgutil.rst:112 msgid "" "*path* should be either ``None`` or a list of paths to look for modules in." msgstr "" -#: library/pkgutil.rst:153 +#: library/pkgutil.rst:114 msgid "" "*prefix* is a string to output on the front of every module name on output." msgstr "" -#: library/pkgutil.rst:175 +#: library/pkgutil.rst:136 msgid "" "Only works for a :term:`finder` which defines an ``iter_modules()`` method. " "This interface is non-standard, so the module also provides implementations " @@ -175,20 +150,20 @@ msgid "" "zipimporter`." msgstr "" -#: library/pkgutil.rst:148 +#: library/pkgutil.rst:109 msgid "" "Yields :class:`ModuleInfo` for all modules recursively on *path*, or, if " "*path* is ``None``, all accessible modules." msgstr "" -#: library/pkgutil.rst:155 +#: library/pkgutil.rst:116 msgid "" "Note that this function must import all *packages* (*not* all modules!) on " "the given *path*, in order to access the ``__path__`` attribute to find " "submodules." msgstr "" -#: library/pkgutil.rst:159 +#: library/pkgutil.rst:120 msgid "" "*onerror* is a function which gets called with one argument (the name of the " "package which was being imported) if any exception occurs while trying to " @@ -197,15 +172,24 @@ msgid "" "propagated, terminating the search." msgstr "" -#: library/pkgutil.rst:165 +#: library/pkgutil.rst:126 msgid "Examples::" msgstr "" -#: library/pkgutil.rst:187 +#: library/pkgutil.rst:128 +msgid "" +"# list all modules python can access\n" +"walk_packages()\n" +"\n" +"# list all submodules of ctypes\n" +"walk_packages(ctypes.__path__, ctypes.__name__ + '.')" +msgstr "" + +#: library/pkgutil.rst:148 msgid "Get a resource from a package." msgstr "" -#: library/pkgutil.rst:189 +#: library/pkgutil.rst:150 msgid "" "This is a wrapper for the :term:`loader` :meth:`get_data ` API. The *package* argument should be the name of " @@ -215,19 +199,25 @@ msgid "" "rooted name (starting with a ``/``)." msgstr "" -#: library/pkgutil.rst:196 +#: library/pkgutil.rst:157 msgid "" "The function returns a binary string that is the contents of the specified " "resource." msgstr "" -#: library/pkgutil.rst:199 +#: library/pkgutil.rst:160 msgid "" "For packages located in the filesystem, which have already been imported, " "this is the rough equivalent of::" msgstr "" -#: library/pkgutil.rst:205 +#: library/pkgutil.rst:163 +msgid "" +"d = os.path.dirname(sys.modules[package].__file__)\n" +"data = open(os.path.join(d, resource), 'rb').read()" +msgstr "" + +#: library/pkgutil.rst:166 msgid "" "If the package cannot be located or loaded, or it uses a :term:`loader` " "which does not support :meth:`get_data `." msgstr "" -#: library/pkgutil.rst:214 +#: library/pkgutil.rst:175 msgid "Resolve a name to an object." msgstr "" -#: library/pkgutil.rst:216 +#: library/pkgutil.rst:177 msgid "" "This functionality is used in numerous places in the standard library (see :" "issue:`12915`) - and equivalent functionality is also in widely used third-" "party packages such as setuptools, Django and Pyramid." msgstr "" -#: library/pkgutil.rst:220 +#: library/pkgutil.rst:181 msgid "" "It is expected that *name* will be a string in one of the following formats, " "where W is shorthand for a valid Python identifier and dot stands for a " "literal period in these pseudo-regexes:" msgstr "" -#: library/pkgutil.rst:224 +#: library/pkgutil.rst:185 msgid "``W(.W)*``" msgstr "" -#: library/pkgutil.rst:225 +#: library/pkgutil.rst:186 msgid "``W(.W)*:(W(.W)*)?``" msgstr "" -#: library/pkgutil.rst:227 +#: library/pkgutil.rst:188 msgid "" "The first form is intended for backward compatibility only. It assumes that " "some part of the dotted name is a package, and the rest is an object " @@ -272,7 +262,7 @@ msgid "" "form." msgstr "" -#: library/pkgutil.rst:234 +#: library/pkgutil.rst:195 msgid "" "In the second form, the caller makes the division point clear through the " "provision of a single colon: the dotted name to the left of the colon is a " @@ -281,21 +271,21 @@ msgid "" "ends with the colon, then a module object is returned." msgstr "" -#: library/pkgutil.rst:240 +#: library/pkgutil.rst:201 msgid "" "The function will return an object (which might be a module), or raise one " "of the following exceptions:" msgstr "" -#: library/pkgutil.rst:243 +#: library/pkgutil.rst:204 msgid ":exc:`ValueError` -- if *name* isn't in a recognised format." msgstr "" -#: library/pkgutil.rst:245 +#: library/pkgutil.rst:206 msgid ":exc:`ImportError` -- if an import failed when it shouldn't have." msgstr "" -#: library/pkgutil.rst:247 +#: library/pkgutil.rst:208 msgid "" ":exc:`AttributeError` -- If a failure occurred when traversing the object " "hierarchy within the imported package to get to the desired object." diff --git a/library/platform.po b/library/platform.po index a6095216..da0f0e47 100644 --- a/library/platform.po +++ b/library/platform.po @@ -8,37 +8,46 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-12-01 00:05+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.6\n" #: library/platform.rst:2 -msgid ":mod:`platform` --- Access to underlying platform's identifying data" +msgid ":mod:`!platform` --- Access to underlying platform's identifying data" msgstr "" +":mod:`platform` --- Πρόσβαση στα αναγνωριστικά δεδομένα της υποκείμενης " +"πλατφόρμας" #: library/platform.rst:10 msgid "**Source code:** :source:`Lib/platform.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/platform.py`" #: library/platform.rst:16 msgid "" "Specific platforms listed alphabetically, with Linux included in the Unix " "section." msgstr "" +"Συγκεκριμένες πλατφόρμες καταγεγραμμένες αλφαβητικά, με το Linux να " +"περιλαμβάνεται στην ενότητα Unix." #: library/platform.rst:21 -msgid "Cross Platform" -msgstr "" +msgid "Cross platform" +msgstr "Cross Platform" #: library/platform.rst:26 msgid "" "Queries the given executable (defaults to the Python interpreter binary) for " "various architecture information." msgstr "" +"Υποβάλλει ερώτημα στο δεδομένο εκτελέσιμο αρχείο (προεπιλογή είναι το " +"εκτελέσιμο του δυαδικού διερμηνέα Python) για διάφορες πληροφορίες " +"αρχιτεκτονικής." #: library/platform.rst:29 msgid "" @@ -46,6 +55,9 @@ msgid "" "architecture and the linkage format used for the executable. Both values are " "returned as strings." msgstr "" +"Επιστρέφει μια πλειάδα ``(bits, linkage)`` που περιέχει πληροφορίες για την " +"αρχιτεκτονική των bit και την μορφή σύνδεσης που χρησιμοποιείται για το " +"εκτελέσιμο αρχείο. Και οι δύο τιμές επιστρέφονται ως συμβολοσειρές." #: library/platform.rst:33 msgid "" @@ -54,6 +66,10 @@ msgid "" "``sizeof(long)`` on Python version < 1.5.2) is used as indicator for the " "supported pointer size." msgstr "" +"Οι τιμές που δεν μπορούν να προσδιοριστούν επιστρέφονται όπως δίνονται από " +"τις προκαθορισμένες παραμέτρους. Αν η τιμή του bits δοθεί ως ``''``, τότε " +"χρησιμοποιείται το ``sizeof(pointer)`` (ή το ``sizeof(long)`` στην έκδοση " +"Python < 1.5.2) ως δείκτης για το υποστηριζόμενο μέγεθος δεικτών." #: library/platform.rst:38 msgid "" @@ -62,195 +78,319 @@ msgid "" "platforms and then only if the executable points to the Python interpreter. " "Reasonable defaults are used when the above needs are not met." msgstr "" +"Η συνάρτηση βασίζεται στην εντολή του συστήματος :file:`file` για την " +"εκτέλεση της πραγματικής εργασίας. Αυτή είναι διαθέσιμη στα περισσότερα αν " +"όχι σε όλα τα συστήματα Unix και σε ορισμένα μη-Unix συστήματα, και μόνο αν " +"το εκτελέσιμο δείχνει στον διερμηνέα της Python. Χρησιμοποιούνται εύλογες " +"προεπιλεγμένες τιμές όταν οι παραπάνω προϋποθέσεις δεν πληρούνται." #: library/platform.rst:45 msgid "" "On macOS (and perhaps other platforms), executable files may be universal " "files containing multiple architectures." msgstr "" +"Στο macOS (και ίσως και σε άλλες πλατφόρμες), τα εκτελέσιμα αρχεία μπορεί να " +"είναι καθολικά αρχεία που περιέχουν μέσα πολλαπλές αρχιτεκτονικές." #: library/platform.rst:48 msgid "" "To get at the \"64-bitness\" of the current interpreter, it is more reliable " "to query the :data:`sys.maxsize` attribute::" msgstr "" +"Για να προσδιορίσετε αν ο τρέχων διερμηνέας είναι 64-bit, είναι πιο " +"αξιόπιστο να ελέγξετε το χαρακτηριστικό :data:`sys.maxsize`::" + +#: library/platform.rst:51 +msgid "is_64bits = sys.maxsize > 2**32" +msgstr "is_64bits = sys.maxsize > 2**32" #: library/platform.rst:56 msgid "" "Returns the machine type, e.g. ``'AMD64'``. An empty string is returned if " "the value cannot be determined." msgstr "" +"Επιστρέφει τον τύπο του μηχανήματος, π.χ. ``'AMD64'``. Επιστρέφει μια κενή " +"συμβολοσειρά αν η τιμή δεν μπορεί να προσδιοριστεί." + +#: library/platform.rst:59 +msgid "" +"The output is platform-dependent and may differ in casing and naming " +"conventions." +msgstr "" +"Η έξοδος εξαρτάται από την πλατφόρμα και μπορεί να διαφέρει ως προς τα " +"κεφαλαία/πεζά και τις συμβάσεις ονοματοδοσίας." -#: library/platform.rst:62 +#: library/platform.rst:64 msgid "" "Returns the computer's network name (may not be fully qualified!). An empty " "string is returned if the value cannot be determined." msgstr "" +"Επιστρέφει το όνομα δικτύου του υπολογιστή (ενδέχεται να μην είναι πλήρως " +"καθορισμένο!). Επιστρέφει μια κενή συμβολοσειρά, αν η τιμή δεν μπορεί να " +"προσδιοριστεί." -#: library/platform.rst:68 +#: library/platform.rst:70 msgid "" "Returns a single string identifying the underlying platform with as much " "useful information as possible." msgstr "" +"Επιστρέφει μια συμβολοσειρά που προσδιορίζει την υποκείμενη πλατφόρμα με όσο " +"το δυνατόν περισσότερες χρήσιμες πληροφορίες." -#: library/platform.rst:71 +#: library/platform.rst:73 msgid "" "The output is intended to be *human readable* rather than machine parseable. " "It may look different on different platforms and this is intended." msgstr "" +"Η έξοδος προορίζεται να είναι *φιλική - ευανάγνωστη από τον άνθρωπο* και όχι " +"αναγνώσιμη από μηχανή. Μπορεί να φαίνεται διαφορετική σε διαφορετικές " +"πλατφόρμες και αυτό είναι σκόπιμο." -#: library/platform.rst:74 +#: library/platform.rst:76 msgid "" "If *aliased* is true, the function will use aliases for various platforms " "that report system names which differ from their common names, for example " "SunOS will be reported as Solaris. The :func:`system_alias` function is " "used to implement this." msgstr "" +"Αν το *aliased* είναι αληθές, η συνάρτηση θα χρησιμοποιήσει ψευδώνυμα για " +"διάφορες πλατφόρμες που αναφέρουν ονόματα συστημάτων διαφορετικά από τα " +"κοινά τους ονόματα, για παράδειγμα το SunOS θα αναφέρεται ως Solaris. Η " +"συνάρτηση :func:`system_alias` χρησιμοποιείται για την υλοποίηση αυτού." -#: library/platform.rst:79 +#: library/platform.rst:81 msgid "" "Setting *terse* to true causes the function to return only the absolute " "minimum information needed to identify the platform." msgstr "" +"Αν το *terse* οριστεί σε αληθές, η συνάρτηση επιστρέφει μόνο τις απολύτως " +"απαραίτητες πληροφορίες για την αναγνώριση της πλατφόρμας." -#: library/platform.rst:82 +#: library/platform.rst:84 msgid "" "On macOS, the function now uses :func:`mac_ver`, if it returns a non-empty " "release string, to get the macOS version rather than the darwin version." msgstr "" +"Στο macOS, η συνάρτηση χρησιμοποιεί τώρα την :func:`mac_ver`, αν αυτή " +"επιστρέψει μη κενή συμβολοσειρά έκδοσης, για να λάβει την έκδοση του macOS " +"αντί για την έκδοση Darwin." -#: library/platform.rst:90 +#: library/platform.rst:92 msgid "Returns the (real) processor name, e.g. ``'amdk6'``." -msgstr "" +msgstr "Επιστρέφει το (πραγματικό) όνομα του επεξεργαστή, π.χ. ``'amdk6'``." -#: library/platform.rst:92 +#: library/platform.rst:94 msgid "" "An empty string is returned if the value cannot be determined. Note that " "many platforms do not provide this information or simply return the same " "value as for :func:`machine`. NetBSD does this." msgstr "" +"Επιστρέφεται μια κενή συμβολοσειρά εάν η τιμή δεν μπορεί να προσδιοριστεί. " +"Σημειώστε ότι πολλές πλατφόρμες δεν παρέχουν αυτή την πληροφορία ή απλώς " +"επιστρέφουν την ίδια τιμή με αυτή της :func:`machine`. Το NetBSD το κάνει " +"αυτό." -#: library/platform.rst:99 +#: library/platform.rst:101 msgid "" "Returns a tuple ``(buildno, builddate)`` stating the Python build number and " "date as strings." msgstr "" +"Επιστρέφει μια πλειάδα ``(buildno, builddate)`` που δηλώνει τον αριθμό " +"κατασκευής και την ημερομηνία κατασκευής της Python ως συμβολοσειρές." -#: library/platform.rst:105 +#: library/platform.rst:107 msgid "Returns a string identifying the compiler used for compiling Python." msgstr "" +"Επιστρέφει μια συμβολοσειρά που προσδιορίζει τον μεταγλωττιστή που " +"χρησιμοποιήθηκε για την μεταγλώττιση της Python." -#: library/platform.rst:110 +#: library/platform.rst:112 msgid "Returns a string identifying the Python implementation SCM branch." msgstr "" +"Επιστρέφει μια συμβολοσειρά που προσδιορίζει το branch του συστήματος " +"ελέγχου εκδόσεων (SCM) της υλοποίησης της Python." -#: library/platform.rst:115 +#: library/platform.rst:117 msgid "" "Returns a string identifying the Python implementation. Possible return " "values are: 'CPython', 'IronPython', 'Jython', 'PyPy'." msgstr "" +"Επιστρέφει μια συμβολοσειρά που προσδιορίζει την υλοποίηση της Python. " +"Πιθανές τιμές είναι: 'CPython', 'IronPython', 'Jython', 'PyPy'." -#: library/platform.rst:121 +#: library/platform.rst:123 msgid "Returns a string identifying the Python implementation SCM revision." msgstr "" +"Επιστρέφει μια συμβολοσειρά που προσδιορίζει την αναθεώρηση SCM της " +"υλοποίησης της Python." -#: library/platform.rst:126 +#: library/platform.rst:128 msgid "Returns the Python version as string ``'major.minor.patchlevel'``." msgstr "" +"Επιστρέφει την έκδοση της Python ως συμβολοσειρά ``'major.minor." +"patchlevel'``." -#: library/platform.rst:128 +#: library/platform.rst:130 msgid "" "Note that unlike the Python ``sys.version``, the returned value will always " "include the patchlevel (it defaults to 0)." msgstr "" +"Σημειώστε ότι σε αντίθεση με το ``sys.version`` της Python, η επιστρεφόμενη " +"τιμή θα περιλαμβάνει πάντα το επίπεδο διόρθωσης (το οποίο προεπιλεγμένα " +"είναι 0)." -#: library/platform.rst:134 +#: library/platform.rst:136 msgid "" "Returns the Python version as tuple ``(major, minor, patchlevel)`` of " "strings." msgstr "" +"Επιστρέφει την έκδοση της Python ως πλειάδα ``(major, minor, patchlevel)`` " +"από συμβολοσειρές." -#: library/platform.rst:136 +#: library/platform.rst:138 msgid "" "Note that unlike the Python ``sys.version``, the returned value will always " "include the patchlevel (it defaults to ``'0'``)." msgstr "" +"Σημειώστε ότι, σε αντίθεση με την ``sys.version`` της Python, η " +"επιστρεφόμενη τιμή θα περιλαμβάνει πάντα το επίπεδο ενημέρωσης (με " +"προεπιλογή το ``'0'``)." -#: library/platform.rst:142 +#: library/platform.rst:144 msgid "" "Returns the system's release, e.g. ``'2.2.0'`` or ``'NT'``. An empty string " "is returned if the value cannot be determined." msgstr "" +"Επιστρέφει την έκδοση του συστήματος, π.χ. ``'2.2.0'`` ή ``'NT'``. " +"Επιστρέφεται μια κενή συμβολοσειρά αν η τιμή δεν μπορεί να καθοριστεί." -#: library/platform.rst:148 +#: library/platform.rst:150 msgid "" "Returns the system/OS name, such as ``'Linux'``, ``'Darwin'``, ``'Java'``, " "``'Windows'``. An empty string is returned if the value cannot be determined." msgstr "" +"Επιστρέφει το όνομα του συστήματος/λειτουργικού, όπως ``'Linux'``, " +"``'Darwin'``, ``'Java'``, ``'Windows'``. Επιστρέφεται μια κενή συμβολοσειρά " +"αν η τιμή δεν μπορεί να καθοριστεί." + +#: library/platform.rst:153 +msgid "" +"On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, " +"``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or " +"``'Linux'``), use :func:`os.uname`." +msgstr "" +"Στο iOS και το Android, αυτό επιστρέφει το όνομα του λειτουργικό συστήματος " +"που βλέπει ο χρήστης δηλαδή, ``'iOS``, ``'iPadOS'`` ή ``'Android'``). Για να " +"λάβετε το όνομα του πυρήνα (``'Darwin'`` ή ``'Linux'``), χρησιμοποιήστε τη :" +"func:`os.uname`." -#: library/platform.rst:154 +#: library/platform.rst:159 msgid "" "Returns ``(system, release, version)`` aliased to common marketing names " "used for some systems. It also does some reordering of the information in " "some cases where it would otherwise cause confusion." msgstr "" +"Επιστρέφει μια πλειάδα ``(system, release, version)`` με ονόματα εμπορικής " +"χρήσης που χρησιμοποιούνται για ορισμένα συστήματα. Επίσης, αναδιατάσσει " +"ορισμένες πληροφορίες σε περιπτώσεις που διαφορετικά θα προκαλούσαν σύγχυση." -#: library/platform.rst:161 +#: library/platform.rst:166 msgid "" "Returns the system's release version, e.g. ``'#3 on degas'``. An empty " "string is returned if the value cannot be determined." msgstr "" +"Επιστρέφει την έκδοση κυκλοφορίας του συστήματος, π.χ. ``'#3 on degas'``. " +"Επιστρέφεται μια κενή συμβολοσειρά εάν η τιμή δεν μπορεί να προσδιοριστεί." + +#: library/platform.rst:169 +msgid "" +"On iOS and Android, this is the user-facing OS version. To obtain the Darwin " +"or Linux kernel version, use :func:`os.uname`." +msgstr "" +"Στο iOS και το Android, αυτή είναι η έκδοση του λειτουργικό συστήματος που " +"βλέπει ο χρήστης. Για να λάβετε την έκδοση του πυρήνα Darwin ή Linux, " +"χρησιμοποιήστε τη :func:`os.uname`." -#: library/platform.rst:167 +#: library/platform.rst:174 msgid "" "Fairly portable uname interface. Returns a :func:`~collections.namedtuple` " "containing six attributes: :attr:`system`, :attr:`node`, :attr:`release`, :" "attr:`version`, :attr:`machine`, and :attr:`processor`." msgstr "" +"Αρκετά φορητή διεπαφή uname. Επιστρέφει ένα :func:`~collections.namedtuple` " +"που περιέχει έξι ιδιότητες: :attr:`system`, :attr:`node`, :attr:`release`, :" +"attr:`version`, :attr:`machine` και :attr:`processor`." -#: library/platform.rst:171 +#: library/platform.rst:178 msgid ":attr:`processor` is resolved late, on demand." -msgstr "" +msgstr "Το :attr:`processor` επιλύεται αργά, κατόπιν αιτήματος." -#: library/platform.rst:173 +#: library/platform.rst:180 msgid "" "Note: the first two attribute names differ from the names presented by :func:" -"`os.uname`, where they are named :attr:`sysname` and :attr:`nodename`." +"`os.uname`, where they are named :attr:`!sysname` and :attr:`!nodename`." msgstr "" +"Σημείωση: τα ονόματα των πρώτων δύο ιδιοτήτων διαφέρουν από αυτά που " +"παρουσιάζονται από την συνάρτηση :func:`os.uname`, όπου ονομάζονται :attr:`!" +"sysname` και :attr:`!nodename`." -#: library/platform.rst:177 +#: library/platform.rst:184 msgid "Entries which cannot be determined are set to ``''``." -msgstr "" +msgstr "Οι τιμές που δεν μπορούν να προσδιοριστούν ορίζονται σε ``''``." -#: library/platform.rst:179 +#: library/platform.rst:186 msgid "Result changed from a tuple to a :func:`~collections.namedtuple`." msgstr "" +"Το αποτέλεσμα άλλαξε από μια πλειάδα σε :func:`~collections.namedtuple`." -#: library/platform.rst:182 +#: library/platform.rst:189 msgid ":attr:`processor` is resolved late instead of immediately." -msgstr "" +msgstr "Το :attr:`processor` αναλύεται καθυστερημένα αντί άμεσα." -#: library/platform.rst:187 -msgid "Java Platform" +#: library/platform.rst:194 +msgid "" +"Clear out the internal cache of information, such as the :func:`uname`. This " +"is typically useful when the platform's :func:`node` is changed by an " +"external process and one needs to retrieve the updated value." msgstr "" +"Καθαρίστε την εσωτερική μνήμη από πληροφορίες όπως τη :func:`uname`. Αυτό " +"είναι συνήθως χρήσιμο όταν η :func:`node` της πλατφόρμας αλλάζει από μια " +"εξωτερική διεργασία και κάποιος πρέπει να ανακτήσει την ενημερωμένη τιμή." -#: library/platform.rst:192 +#: library/platform.rst:202 +msgid "Java platform" +msgstr "Πλατφόρμα Java" + +#: library/platform.rst:207 msgid "Version interface for Jython." -msgstr "" +msgstr "Διεπαφή έκδοσης για Jython." -#: library/platform.rst:194 +#: library/platform.rst:209 msgid "" "Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a " "tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple " "``(os_name, os_version, os_arch)``. Values which cannot be determined are " "set to the defaults given as parameters (which all default to ``''``)." msgstr "" +"Επιστρέφει μια πλειάδα ``(release, vendor, vminfo, osinfo)`` όπου το " +"*vminfo* είναι μια πλειάδα ``(vm_name, vm_release, vm_vendor)`` και το " +"*osinfo* είναι μια πλειάδα ``(os_name, os_version, os_arch)``. Τιμές που δεν " +"μπορούν να προσδιοριστούν ορίζονται στα προεπιλεγμένα που δίνονται ως " +"παράμετροι (τα οποία προεπιλεγμένα είναι όλα ``''``)." -#: library/platform.rst:201 -msgid "Windows Platform" +#: library/platform.rst:214 +msgid "" +"It was largely untested, had a confusing API, and was only useful for Jython " +"support." msgstr "" +"Ήταν σε μεγάλο βαθμό ακατάλληλο για δοκιμές, είχε μια μπερδεμένη διεπαφή API " +"και ήταν χρήσιμο μόνο για την υποστήριξη του Jython." + +#: library/platform.rst:220 +msgid "Windows platform" +msgstr "Πλατφόρμα Windows" -#: library/platform.rst:206 +#: library/platform.rst:225 msgid "" "Get additional version information from the Windows Registry and return a " "tuple ``(release, version, csd, ptype)`` referring to OS release, version " @@ -258,75 +398,158 @@ msgid "" "Values which cannot be determined are set to the defaults given as " "parameters (which all default to an empty string)." msgstr "" +"Λαμβάνει επιπλέον πληροφορίες έκδοσης από το Μητρώο των Windows και " +"επιστρέφει μια πλειάδα ``(release, version, csd, ptype)`` που αναφέρεται " +"στην έκδοση του λειτουργικού συστήματος, τον αριθμό έκδοσης, το επίπεδο CSD " +"(service pack) και τον τύπο λειτουργικού συστήματος (πολυεπεξεργαστικό/" +"μονοεπεξεργαστικό). Τιμές που δεν μπορούν να προσδιοριστούν ορίζονται στα " +"προεπιλεγμένα που δίνονται ως παράμετροι (όλα προεπιλέγονται σε κενές " +"συμβολοσειρές)." -#: library/platform.rst:212 +#: library/platform.rst:231 msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " -"*'Free'* refers to the OS version being free of debugging code. It could " -"also state *'Checked'* which means the OS version uses debugging code, i.e. " -"code that checks arguments, ranges, etc." +"``'Free'`` refers to the OS version being free of debugging code. It could " +"also state ``'Checked'`` which means the OS version uses debugging code, i." +"e. code that checks arguments, ranges, etc." msgstr "" +"Ως υπόδειξη: το *ptype* είναι ``'Uniprocessor Free'`` σε μηχανές NT με έναν " +"επεξεργαστή και ``'Multiprocessor Free'`` σε μηχανές με πολλαπλούς " +"επεξεργαστές. Ο όρος *'Free'* αναφέρεται σε έκδοση του λειτουργικού " +"συστήματος χωρίς κώδικα αποσφαλμάτωσης. Θα μπορούσε επίσης να αναφέρει " +"*'Checked'* που σημαίνει ότι η έκδοση του λειτουργικού συστήματος " +"χρησιμοποιεί κώδικα αποσφαλμάτωσης, δηλαδή κώδικα που ελέγχει ορίσματα, εύρη " +"κ.λπ." -#: library/platform.rst:220 +#: library/platform.rst:239 msgid "" "Returns a string representing the current Windows edition, or ``None`` if " "the value cannot be determined. Possible values include but are not limited " "to ``'Enterprise'``, ``'IoTUAP'``, ``'ServerStandard'``, and " "``'nanoserver'``." msgstr "" +"Επιστρέφει μια συμβολοσειρά που αναπαριστά την τρέχουσα έκδοση των Windows ή " +"``None`` αν δεν μπορεί να καθοριστεί η τιμή. Πιθανές τιμές περιλαμβάνουν, " +"αλλά δεν περιορίζονται σε ``'Enterprise'``, ``'IoTUAP'``, " +"``'ServerStandard'`` και ``'nanoserver'``." -#: library/platform.rst:228 +#: library/platform.rst:247 msgid "" "Return ``True`` if the Windows edition returned by :func:`win32_edition` is " "recognized as an IoT edition." msgstr "" +"Επιστρέφει ``True`` αν η έκδοση των Windows που επιστρέφεται από την :func:" +"`win32_edition` αναγνωρίζεται ως έκδοση IoT." -#: library/platform.rst:235 -msgid "macOS Platform" -msgstr "" +#: library/platform.rst:254 +msgid "macOS platform" +msgstr "Πλατφόρμα macOS" -#: library/platform.rst:240 +#: library/platform.rst:258 msgid "" "Get macOS version information and return it as tuple ``(release, " "versioninfo, machine)`` with *versioninfo* being a tuple ``(version, " "dev_stage, non_release_version)``." msgstr "" +"Λαμβάνει πληροφορίες έκδοσης macOS και τις επιστρέφει ως πλειάδα ``(release, " +"versioninfo, machine)`` όπου το *versioninfo* είναι μια πλειάδα ``(version, " +"dev_stage, non_release_version)``." -#: library/platform.rst:244 +#: library/platform.rst:262 msgid "" "Entries which cannot be determined are set to ``''``. All tuple entries are " "strings." msgstr "" +"Οι τιμές που δεν μπορούν να προσδιοριστούν ορίζονται ως ``''``. Όλα τα " +"στοιχεία της πλειάδας είναι συμβολοσειρές." + +#: library/platform.rst:266 +msgid "iOS platform" +msgstr "Πλατφόρμα iOS" + +#: library/platform.rst:270 +msgid "" +"Get iOS version information and return it as a :func:`~collections." +"namedtuple` with the following attributes:" +msgstr "" +"Λάβετε πληροφορίες για την έκδοση του iOS και επιστρέψτε τις ως μια :func:" +"`~collections.namedtuple` με τα εξής χαρακτηριστικά:" + +#: library/platform.rst:273 +msgid "``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``." +msgstr "" +"``system`` είναι το όνομα του λειτουργικού συστήματος; είτε ``'iOS'`` ή " +"``'iPadOS'``." + +#: library/platform.rst:274 +msgid "``release`` is the iOS version number as a string (e.g., ``'17.2'``)." +msgstr "" +"``release`` είναι ο αριθμός έκδοσης iOS ως μια συμβολοσειρά (π.χ., " +"``'17.2'``)." + +#: library/platform.rst:275 +msgid "" +"``model`` is the device model identifier; this will be a string like " +"``'iPhone13,2'`` for a physical device, or ``'iPhone'`` on a simulator." +msgstr "" +"Το ``model`` είναι ο αναγνωριστικό αριθμός μοντέλου της συσκευής. Αυτό θα " +"είναι μια συμβολοσειρά όπως ``'iPhone13,2'`` για μια φυσική συσκευή, ή " +"``'iPhone'`` για έναν εξομοιωτή." -#: library/platform.rst:249 -msgid "Unix Platforms" +#: library/platform.rst:277 +msgid "" +"``is_simulator`` is a boolean describing if the app is running on a " +"simulator or a physical device." msgstr "" +"Το ``is_simulator`` είναι μια δυαδική τιμή που περιγράφει αν η εφαρμογή " +"εκτελείται σε εξομοιωτή ή σε φυσική συσκευή." -#: library/platform.rst:253 +#: library/platform.rst:280 +msgid "" +"Entries which cannot be determined are set to the defaults given as " +"parameters." +msgstr "" +"Οι καταχωρήσεις που δεν μπορούν να προσδιοριστούν ορίζονται στις " +"προεπιλεγμένες τιμές που δίνονται ως παράμετροι." + +#: library/platform.rst:285 +msgid "Unix platforms" +msgstr "Πλατφόρμες Unix" + +#: library/platform.rst:289 msgid "" "Tries to determine the libc version against which the file executable " "(defaults to the Python interpreter) is linked. Returns a tuple of strings " "``(lib, version)`` which default to the given parameters in case the lookup " "fails." msgstr "" +"Προσπαθεί να προσδιορίσει την έκδοση της libc με την οποία είναι συνδεδεμένο " +"το εκτελέσιμο αρχείο (προεπιλογή είναι ο διερμηνέας της Python). Επιστρέφει " +"μια πλειάδα συμβολοσειρών ``(lib, version)``, η οποία ορίζεται στις δοθείσες " +"παραμέτρους σε περίπτωση αποτυχίας της αναζήτησης." -#: library/platform.rst:257 +#: library/platform.rst:293 msgid "" "Note that this function has intimate knowledge of how different libc " "versions add symbols to the executable is probably only usable for " "executables compiled using :program:`gcc`." msgstr "" +"Σημειώστε ότι αυτή η συνάρτηση έχει λεπτομερή γνώση του τρόπου με τον οποίο " +"οι διάφορες εκδόσεις της libc προσθέτουν σύμβολα στο εκτελέσιμο και πιθανώς " +"μπορεί να χρησιμοποιηθεί μόνο για εκτελέσιμα που έχουν μεταγλωττιστεί με το :" +"program:`gcc`." -#: library/platform.rst:261 +#: library/platform.rst:297 msgid "The file is read and scanned in chunks of *chunksize* bytes." msgstr "" +"Το αρχείο διαβάζεται και σαρώνονται τμήματά του μεγέθους *chunksize* bytes." -#: library/platform.rst:265 -msgid "Linux Platforms" -msgstr "" +#: library/platform.rst:301 +msgid "Linux platforms" +msgstr "Πλατφόρμες Linux" -#: library/platform.rst:269 +#: library/platform.rst:305 msgid "" "Get operating system identification from ``os-release`` file and return it " "as a dict. The ``os-release`` file is a `freedesktop.org standard `_ και είναι διαθέσιμο στις περισσότερες διανομές Linux. " +"Μια αξιοσημείωτη εξαίρεση είναι το Android και οι διανομές που βασίζονται σε " +"Android." -#: library/platform.rst:275 +#: library/platform.rst:311 msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." msgstr "" +"Κάνει raise εξαίρεση :exc:`OSError` ή την υποκλάση όταν δεν είναι δυνατή η " +"ανάγνωση ούτε του ``/etc/os-release`` ούτε του ``/usr/lib/os-release``." -#: library/platform.rst:278 +#: library/platform.rst:314 msgid "" "On success, the function returns a dictionary where keys and values are " "strings. Values have their special characters like ``\"`` and ``$`` " @@ -349,15 +580,163 @@ msgid "" "defined according to the standard. All other fields are optional. Vendors " "may include additional fields." msgstr "" +"Σε περίπτωση επιτυχίας, η συνάρτηση επιστρέφει ένα λεξικό όπου τα κλειδιά " +"και οι τιμές είναι συμβολοσειρές. Οι τιμές έχουν τους ειδικούς χαρακτήρες " +"του, όπως ``\"`` και ``$``, χωρίς εισαγωγικά. Τα πεδία ``NAME``, ``ID`` και " +"``PRETTY_NAME`` ορίζονται πάντα σύμφωνα με το πρότυπο. Όλα τα άλλα πεδία " +"είναι προαιρετικά. Οι προμηθευτές μπορεί να περιλαμβάνουν πρόσθετα πεδία." -#: library/platform.rst:284 +#: library/platform.rst:320 msgid "" "Note that fields like ``NAME``, ``VERSION``, and ``VARIANT`` are strings " "suitable for presentation to users. Programs should use fields like ``ID``, " "``ID_LIKE``, ``VERSION_ID``, or ``VARIANT_ID`` to identify Linux " "distributions." msgstr "" +"Σημειώστε ότι πεδία όπως τα ``NAME``, ``VERSION`` και ``VARIANT`` είναι " +"συμβολοσειρές κατάλληλες για παρουσίαση στους χρήστες. Τα προγράμματα θα " +"πρέπει να χρησιμοποιούν πεδία όπως τα ``ID``, ``ID_LIKE``, ``VERSION_ID`` ή " +"``VARIANT_ID`` για την αναγνώριση διανομών Linux." -#: library/platform.rst:289 +#: library/platform.rst:325 msgid "Example::" +msgstr "Παράδειγμα::" + +#: library/platform.rst:327 +msgid "" +"def get_like_distro():\n" +" info = platform.freedesktop_os_release()\n" +" ids = [info[\"ID\"]]\n" +" if \"ID_LIKE\" in info:\n" +" # ids are space separated and ordered by precedence\n" +" ids.extend(info[\"ID_LIKE\"].split())\n" +" return ids" +msgstr "" +"def get_like_distro():\n" +" info = platform.freedesktop_os_release()\n" +" ids = [info[\"ID\"]]\n" +" if \"ID_LIKE\" in info:\n" +" # ids are space separated and ordered by precedence\n" +" ids.extend(info[\"ID_LIKE\"].split())\n" +" return ids" + +#: library/platform.rst:339 +msgid "Android platform" +msgstr "Πλατφόρμα Android" + +#: library/platform.rst:344 +msgid "" +"Get Android device information. Returns a :func:`~collections.namedtuple` " +"with the following attributes. Values which cannot be determined are set to " +"the defaults given as parameters." msgstr "" +"Λάβετε πληροφορίες για τη συσκευή Android. Επιστρέφει μια :func:" +"`~collections.namedtuple` με τα εξής χαρακτηριστικά. Οι τιμές που δεν " +"μπορούν να προσδιοριστούν ορίζονται στις προεπιλεγμένες τιμές που δίνονται " +"ως παράμετροι." + +#: library/platform.rst:348 +msgid "``release`` - Android version, as a string (e.g. ``\"14\"``)." +msgstr "``release`` - Η έκδοση του Android, ως συμβολοσειρά (π.χ. ``\"14\"``)." + +#: library/platform.rst:350 +msgid "" +"``api_level`` - API level of the running device, as an integer (e.g. ``34`` " +"for Android 14). To get the API level which Python was built against, see :" +"func:`sys.getandroidapilevel`." +msgstr "" +"``api_level`` - Το επίπεδο API της εκτελούμενης συσκευής, ως ακέραιος " +"αριθμός (π.χ. ``34`` για Android 14). Για να λάβετε το επίπεδο API με το " +"οποίο έχει κατασκευαστεί η Python, δείτε τη :func:`sys.getandroidapilevel`." + +#: library/platform.rst:354 +msgid "" +"``manufacturer`` - `Manufacturer name `__." +msgstr "" +"``manufacturer`` - `Το όνομα του κατασκευαστή `__." + +#: library/platform.rst:357 +msgid "" +"``model`` - `Model name `__ – typically the marketing name or model number." +msgstr "" +"``model`` - `Το όνομα του μοντέλου `__ – συνήθως το εμπορικό όνομα ή ο αριθμός μοντέλου." + +#: library/platform.rst:361 +msgid "" +"``device`` - `Device name `__ – typically the model number or a codename." +msgstr "" +"``device`` - `Το όνομα της συσκευής `__ – συνήθως ο αριθμός μοντέλου ή ένα κωδικό όνομα." + +#: library/platform.rst:365 +msgid "" +"``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's a " +"physical device." +msgstr "" +"``is_emulator`` - ``True`` αν η συσκευή είναι εξομοιωτής; ``False`` αν είναι " +"φυσική συσκευή." + +#: library/platform.rst:368 +msgid "" +"Google maintains a `list of known model and device names `__." +msgstr "" +"Η Google διατηρεί μια `λίστα με γνωστά ονόματα μοντέλων συσκευών `__." + +#: library/platform.rst:376 +msgid "Command-line usage" +msgstr "Χρήση από γραμμή εντολών" + +#: library/platform.rst:378 +msgid "" +":mod:`platform` can also be invoked directly using the :option:`-m` switch " +"of the interpreter::" +msgstr "" +"Το :mod:`platform` μπορεί επίσης να κληθεί απευθείας χρησιμοποιώντας την " +"επιλογή :option:`-m` του διερμηνέα::" + +#: library/platform.rst:381 +msgid "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" +msgstr "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" + +#: library/platform.rst:383 +msgid "The following options are accepted:" +msgstr "Οι εξής επιλογές γίνονται αποδεκτές:" + +#: library/platform.rst:389 +msgid "" +"Print terse information about the platform. This is equivalent to calling :" +"func:`platform.platform` with the *terse* argument set to ``True``." +msgstr "" +"Εκτυπώνει συνοπτικές πληροφορίες για την πλατφόρμα. Αυτό είναι ισοδύναμο με " +"την κλήση :func:`platform.platform` με το όρισμα *terse* ορισμένο σε " +"``True``." + +#: library/platform.rst:394 +msgid "" +"Print platform information without system/OS name aliasing. This is " +"equivalent to calling :func:`platform.platform` with the *aliased* argument " +"set to ``True``." +msgstr "" +"Εκτυπώνει πληροφορίες για την πλατφόρμα χωρίς την αντικατάσταση του ονόματος " +"του συστήματος/ λειτουργικού. Αυτό είναι ισοδύναμο με την κλήση της :func:" +"`platform.platform` με το όρισμα *aliased* ορισμένο σε ``True``." + +#: library/platform.rst:398 +msgid "" +"You can also pass one or more positional arguments (``terse``, " +"``nonaliased``) to explicitly control the output format. These behave " +"similarly to their corresponding options." +msgstr "" +"Μπορείτε επίσης να περάσετε ένα ή περισσότερα ορίσματα θέσης (``terse``, " +"``nonaliased``) για να ελέγξετε ρητά τη μορφή της εξόδου. Αυτά " +"συμπεριφέρονται όπως οι αντίστοιχες επιλογές τους." + +#~ msgid "Miscellaneous" +#~ msgstr "Ανάμικτος" diff --git a/library/plistlib.po b/library/plistlib.po index 5f4a2e2a..fcd0763f 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/plistlib.rst:2 -msgid ":mod:`plistlib` --- Generate and parse Apple ``.plist`` files" +msgid ":mod:`!plistlib` --- Generate and parse Apple ``.plist`` files" msgstr "" #: library/plistlib.rst:11 @@ -46,8 +47,8 @@ msgstr "" #: library/plistlib.rst:30 msgid "" -"To work with plist data in bytes objects, use :func:`dumps` and :func:" -"`loads`." +"To work with plist data in bytes or string objects, use :func:`dumps` and :" +"func:`loads`." msgstr "" #: library/plistlib.rst:33 @@ -115,114 +116,178 @@ msgstr "" #: library/plistlib.rst:72 msgid "" +"When *aware_datetime* is true, fields with type ``datetime.datetime`` will " +"be created as :ref:`aware object `, with :attr:`!" +"tzinfo` as :const:`datetime.UTC`." +msgstr "" + +#: library/plistlib.rst:76 +msgid "" "XML data for the :data:`FMT_XML` format is parsed using the Expat parser " "from :mod:`xml.parsers.expat` -- see its documentation for possible " "exceptions on ill-formed XML. Unknown elements will simply be ignored by " "the plist parser." msgstr "" -#: library/plistlib.rst:77 +#: library/plistlib.rst:81 msgid "" -"The parser for the binary format raises :exc:`InvalidFileException` when the " -"file cannot be parsed." +"The parser raises :exc:`InvalidFileException` when the file cannot be parsed." msgstr "" -#: library/plistlib.rst:85 -msgid "" -"Load a plist from a bytes object. See :func:`load` for an explanation of the " -"keyword arguments." +#: library/plistlib.rst:130 +msgid "The keyword-only parameter *aware_datetime* has been added." msgstr "" -#: library/plistlib.rst:93 +#: library/plistlib.rst:91 msgid "" -"Write *value* to a plist file. *Fp* should be a writable, binary file object." +"Load a plist from a bytes or string object. See :func:`load` for an " +"explanation of the keyword arguments." msgstr "" #: library/plistlib.rst:96 +msgid "*data* can be a string when *fmt* equals :data:`FMT_XML`." +msgstr "" + +#: library/plistlib.rst:101 +msgid "" +"Write *value* to a plist file. *fp* should be a writable, binary file object." +msgstr "" + +#: library/plistlib.rst:104 msgid "" "The *fmt* argument specifies the format of the plist file and can be one of " "the following values:" msgstr "" -#: library/plistlib.rst:99 +#: library/plistlib.rst:107 msgid ":data:`FMT_XML`: XML formatted plist file" msgstr "" -#: library/plistlib.rst:101 +#: library/plistlib.rst:109 msgid ":data:`FMT_BINARY`: Binary formatted plist file" msgstr "" -#: library/plistlib.rst:103 +#: library/plistlib.rst:111 msgid "" "When *sort_keys* is true (the default) the keys for dictionaries will be " "written to the plist in sorted order, otherwise they will be written in the " "iteration order of the dictionary." msgstr "" -#: library/plistlib.rst:107 +#: library/plistlib.rst:115 msgid "" "When *skipkeys* is false (the default) the function raises :exc:`TypeError` " "when a key of a dictionary is not a string, otherwise such keys are skipped." msgstr "" -#: library/plistlib.rst:110 +#: library/plistlib.rst:118 +msgid "" +"When *aware_datetime* is true and any field with type ``datetime.datetime`` " +"is set as an :ref:`aware object `, it will convert to " +"UTC timezone before writing it." +msgstr "" + +#: library/plistlib.rst:122 msgid "" "A :exc:`TypeError` will be raised if the object is of an unsupported type or " "a container that contains objects of unsupported types." msgstr "" -#: library/plistlib.rst:113 +#: library/plistlib.rst:125 msgid "" "An :exc:`OverflowError` will be raised for integer values that cannot be " "represented in (binary) plist files." msgstr "" -#: library/plistlib.rst:121 +#: library/plistlib.rst:136 msgid "" "Return *value* as a plist-formatted bytes object. See the documentation for :" "func:`dump` for an explanation of the keyword arguments of this function." msgstr "" -#: library/plistlib.rst:128 +#: library/plistlib.rst:143 msgid "The following classes are available:" msgstr "" -#: library/plistlib.rst:132 +#: library/plistlib.rst:147 msgid "" "Wraps an :class:`int`. This is used when reading or writing NSKeyedArchiver " "encoded data, which contains UID (see PList manual)." msgstr "" -#: library/plistlib.rst:135 -msgid "" -"It has one attribute, :attr:`data`, which can be used to retrieve the int " -"value of the UID. :attr:`data` must be in the range ``0 <= data < 2**64``." +#: library/plistlib.rst:152 +msgid "Int value of the UID. It must be in the range ``0 <= data < 2**64``." msgstr "" -#: library/plistlib.rst:141 +#: library/plistlib.rst:157 msgid "The following constants are available:" msgstr "" -#: library/plistlib.rst:145 +#: library/plistlib.rst:161 msgid "The XML format for plist files." msgstr "" -#: library/plistlib.rst:152 +#: library/plistlib.rst:168 msgid "The binary format for plist files" msgstr "" -#: library/plistlib.rst:158 +#: library/plistlib.rst:173 +msgid "The module defines the following exceptions:" +msgstr "" + +#: library/plistlib.rst:177 +msgid "Raised when a file cannot be parsed." +msgstr "" + +#: library/plistlib.rst:183 msgid "Examples" msgstr "" -#: library/plistlib.rst:160 +#: library/plistlib.rst:185 msgid "Generating a plist::" msgstr "" -#: library/plistlib.rst:182 +#: library/plistlib.rst:187 +msgid "" +"import datetime\n" +"import plistlib\n" +"\n" +"pl = dict(\n" +" aString = \"Doodah\",\n" +" aList = [\"A\", \"B\", 12, 32.1, [1, 2, 3]],\n" +" aFloat = 0.1,\n" +" anInt = 728,\n" +" aDict = dict(\n" +" anotherString = \"\",\n" +" aThirdString = \"M\\xe4ssig, Ma\\xdf\",\n" +" aTrueValue = True,\n" +" aFalseValue = False,\n" +" ),\n" +" someData = b\"\",\n" +" someMoreData = b\"\" * 10,\n" +" aDate = datetime.datetime.now()\n" +")\n" +"print(plistlib.dumps(pl).decode())" +msgstr "" + +#: library/plistlib.rst:207 msgid "Parsing a plist::" msgstr "" +#: library/plistlib.rst:209 +msgid "" +"import plistlib\n" +"\n" +"plist = b\"\"\"\n" +"\n" +" foo\n" +" bar\n" +"\n" +"\"\"\"\n" +"pl = plistlib.loads(plist)\n" +"print(pl[\"foo\"])" +msgstr "" + #: library/plistlib.rst:13 msgid "plist" msgstr "" diff --git a/library/poplib.po b/library/poplib.po index 6008fd1c..e44992a2 100644 --- a/library/poplib.po +++ b/library/poplib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/poplib.rst:2 -msgid ":mod:`poplib` --- POP3 protocol client" +msgid ":mod:`!poplib` --- POP3 protocol client" msgstr "" #: library/poplib.rst:10 @@ -50,14 +51,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/poplib.rst:33 @@ -73,19 +73,13 @@ msgid "" "timeout setting will be used)." msgstr "" -#: library/poplib.rst:77 +#: library/poplib.rst:66 msgid "" "Raises an :ref:`auditing event ` ``poplib.connect`` with arguments " "``self``, ``host``, ``port``." msgstr "" -#: library/poplib.rst:79 -msgid "" -"Raises an :ref:`auditing event ` ``poplib.putline`` with arguments " -"``self``, ``line``." -msgstr "" - -#: library/poplib.rst:70 +#: library/poplib.rst:48 library/poplib.rst:70 msgid "" "All commands will raise an :ref:`auditing event ` ``poplib." "putline`` with arguments ``self`` and ``line``, where ``line`` is the bytes " @@ -134,7 +128,7 @@ msgid "" "constructor as a string." msgstr "" -#: library/poplib.rst:102 +#: library/poplib.rst:101 msgid "Module :mod:`imaplib`" msgstr "" @@ -142,7 +136,7 @@ msgstr "" msgid "The standard Python IMAP module." msgstr "" -#: library/poplib.rst:106 +#: library/poplib.rst:104 msgid "" "`Frequently Asked Questions About Fetchmail `_" @@ -310,6 +304,19 @@ msgid "" "retrieves and prints all messages::" msgstr "" +#: library/poplib.rst:260 +msgid "" +"import getpass, poplib\n" +"\n" +"M = poplib.POP3('localhost')\n" +"M.user(getpass.getuser())\n" +"M.pass_(getpass.getpass())\n" +"numMessages = len(M.list()[1])\n" +"for i in range(numMessages):\n" +" for j in M.retr(i+1)[1]:\n" +" print(j)" +msgstr "" + #: library/poplib.rst:270 msgid "" "At the end of the module, there is a test section that contains a more " diff --git a/library/posix.po b/library/posix.po index b2a4d427..06c4f03a 100644 --- a/library/posix.po +++ b/library/posix.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/posix.rst:2 -msgid ":mod:`posix` --- The most common POSIX system calls" +msgid ":mod:`!posix` --- The most common POSIX system calls" msgstr "" #: library/posix.rst:10 @@ -28,7 +29,7 @@ msgid "" msgstr "" #: library/posix.rst:14 -msgid ":ref:`Availability `: Unix." +msgid "Availability" msgstr "" #: library/posix.rst:18 @@ -72,10 +73,23 @@ msgid "" "Solaris 2.6 and 2.7 you need to do something like::" msgstr "" +#: library/posix.rst:55 +msgid "" +"CFLAGS=\"`getconf LFS_CFLAGS`\" OPT=\"-g -O2 $CFLAGS\" \\\n" +" ./configure" +msgstr "" + #: library/posix.rst:58 msgid "On large-file-capable Linux systems, this might work::" msgstr "" +#: library/posix.rst:60 +msgid "" +"CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' OPT=\"-g -O2 $CFLAGS\" " +"\\\n" +" ./configure" +msgstr "" + #: library/posix.rst:67 msgid "Notable Module Contents" msgstr "" diff --git a/library/pprint.po b/library/pprint.po index c505c8ca..54434017 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pprint.rst:2 -msgid ":mod:`pprint` --- Data pretty printer" +msgid ":mod:`!pprint` --- Data pretty printer" msgstr "" #: library/pprint.rst:10 @@ -37,188 +38,169 @@ msgstr "" #: library/pprint.rst:21 msgid "" "The formatted representation keeps objects on a single line if it can, and " -"breaks them onto multiple lines if they don't fit within the allowed width. " -"Construct :class:`PrettyPrinter` objects explicitly if you need to adjust " -"the width constraint." +"breaks them onto multiple lines if they don't fit within the allowed width, " +"adjustable by the *width* parameter defaulting to 80 characters." msgstr "" -#: library/pprint.rst:26 -msgid "Dictionaries are sorted by key before the display is computed." -msgstr "" - -#: library/pprint.rst:28 +#: library/pprint.rst:25 msgid "Added support for pretty-printing :class:`types.SimpleNamespace`." msgstr "" -#: library/pprint.rst:31 +#: library/pprint.rst:28 msgid "Added support for pretty-printing :class:`dataclasses.dataclass`." msgstr "" -#: library/pprint.rst:37 +#: library/pprint.rst:34 msgid "Functions" msgstr "" -#: library/pprint.rst:41 +#: library/pprint.rst:39 msgid "" -"Prints the formatted representation of *object* followed by a newline. If " -"*sort_dicts* is false (the default), dictionaries will be displayed with " -"their keys in insertion order, otherwise the dict keys will be sorted. " -"*args* and *kwargs* will be passed to :func:`~pprint.pprint` as formatting " -"parameters." +"Prints the formatted representation of *object*, followed by a newline. This " +"function may be used in the interactive interpreter instead of the :func:" +"`print` function for inspecting values. Tip: you can reassign ``print = " +"pprint.pp`` for use within a scope." msgstr "" -#: library/pprint.rst:53 -msgid "" -"Prints the formatted representation of *object* on *stream*, followed by a " -"newline. If *stream* is ``None``, :data:`sys.stdout` is used. This may be " -"used in the interactive interpreter instead of the :func:`print` function " -"for inspecting values (you can even reassign ``print = pprint.pprint`` for " -"use within a scope)." +#: library/pprint.rst:0 +msgid "Parameters" msgstr "" -#: library/pprint.rst:59 -msgid "" -"The configuration parameters *stream*, *indent*, *width*, *depth*, " -"*compact*, *sort_dicts* and *underscore_numbers* are passed to the :class:" -"`PrettyPrinter` constructor and their meanings are as described in its " -"documentation below." +#: library/pprint.rst:44 +msgid "The object to be printed." msgstr "" -#: library/pprint.rst:78 +#: library/pprint.rst:47 msgid "" -"Return the formatted representation of *object* as a string. *indent*, " -"*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are " -"passed to the :class:`PrettyPrinter` constructor as formatting parameters " -"and their meanings are as described in its documentation below." +"A file-like object to which the output will be written by calling its :meth:" +"`!write` method. If ``None`` (the default), :data:`sys.stdout` is used." msgstr "" -#: library/pprint.rst:88 -msgid "" -"Determine if the formatted representation of *object* is \"readable\", or " -"can be used to reconstruct the value using :func:`eval`. This always " -"returns ``False`` for recursive objects." +#: library/pprint.rst:53 +msgid "The amount of indentation added for each nesting level." msgstr "" -#: library/pprint.rst:98 +#: library/pprint.rst:56 msgid "" -"Determine if *object* requires a recursive representation. This function is " -"subject to the same limitations as noted in :func:`saferepr` below and may " -"raise an :exc:`RecursionError` if it fails to detect a recursive object." +"The desired maximum number of characters per line in the output. If a " +"structure cannot be formatted within the width constraint, a best effort " +"will be made." msgstr "" -#: library/pprint.rst:105 +#: library/pprint.rst:61 msgid "" -"Return a string representation of *object*, protected against recursion in " -"some common data structures, namely instances of :class:`dict`, :class:" -"`list` and :class:`tuple` or subclasses whose ``__repr__`` has not been " -"overridden. If the representation of object exposes a recursive entry, the " -"recursive reference will be represented as ````. The representation is not otherwise formatted." +"The number of nesting levels which may be printed. If the data structure " +"being printed is too deep, the next contained level is replaced by ``...``. " +"If ``None`` (the default), there is no constraint on the depth of the " +"objects being formatted." msgstr "" -#: library/pprint.rst:118 -msgid "PrettyPrinter Objects" +#: library/pprint.rst:69 +msgid "" +"Control the way long :term:`sequences ` are formatted. If " +"``False`` (the default), each item of a sequence will be formatted on a " +"separate line, otherwise as many items as will fit within the *width* will " +"be formatted on each output line." msgstr "" -#: library/pprint.rst:120 -msgid "This module defines one class:" +#: library/pprint.rst:76 +msgid "" +"If ``True``, dictionaries will be formatted with their keys sorted, " +"otherwise they will be displayed in insertion order (the default)." msgstr "" -#: library/pprint.rst:130 +#: library/pprint.rst:81 msgid "" -"Construct a :class:`PrettyPrinter` instance. This constructor understands " -"several keyword parameters." +"If ``True``, integers will be formatted with the ``_`` character for a " +"thousands separator, otherwise underscores are not displayed (the default)." msgstr "" -#: library/pprint.rst:133 +#: library/pprint.rst:103 msgid "" -"*stream* (default :data:`!sys.stdout`) is a :term:`file-like object` to " -"which the output will be written by calling its :meth:`!write` method. If " -"both *stream* and :data:`!sys.stdout` are ``None``, then :meth:" -"`~PrettyPrinter.pprint` silently returns." +"Alias for :func:`~pprint.pp` with *sort_dicts* set to ``True`` by default, " +"which would automatically sort the dictionaries' keys, you might want to " +"use :func:`~pprint.pp` instead where it is ``False`` by default." msgstr "" -#: library/pprint.rst:138 +#: library/pprint.rst:111 msgid "" -"Other values configure the manner in which nesting of complex data " -"structures is displayed." +"Return the formatted representation of *object* as a string. *indent*, " +"*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are " +"passed to the :class:`PrettyPrinter` constructor as formatting parameters " +"and their meanings are as described in the documentation above." msgstr "" -#: library/pprint.rst:141 +#: library/pprint.rst:121 msgid "" -"*indent* (default 1) specifies the amount of indentation added for each " -"nesting level." +"Determine if the formatted representation of *object* is \"readable\", or " +"can be used to reconstruct the value using :func:`eval`. This always " +"returns ``False`` for recursive objects." msgstr "" -#: library/pprint.rst:144 +#: library/pprint.rst:131 msgid "" -"*depth* controls the number of nesting levels which may be printed; if the " -"data structure being printed is too deep, the next contained level is " -"replaced by ``...``. By default, there is no constraint on the depth of the " -"objects being formatted." +"Determine if *object* requires a recursive representation. This function is " +"subject to the same limitations as noted in :func:`saferepr` below and may " +"raise an :exc:`RecursionError` if it fails to detect a recursive object." msgstr "" -#: library/pprint.rst:149 +#: library/pprint.rst:138 msgid "" -"*width* (default 80) specifies the desired maximum number of characters per " -"line in the output. If a structure cannot be formatted within the width " -"constraint, a best effort will be made." +"Return a string representation of *object*, protected against recursion in " +"some common data structures, namely instances of :class:`dict`, :class:" +"`list` and :class:`tuple` or subclasses whose ``__repr__`` has not been " +"overridden. If the representation of object exposes a recursive entry, the " +"recursive reference will be represented as ````. The representation is not otherwise formatted." msgstr "" -#: library/pprint.rst:153 -msgid "" -"*compact* impacts the way that long sequences (lists, tuples, sets, etc) are " -"formatted. If *compact* is false (the default) then each item of a sequence " -"will be formatted on a separate line. If *compact* is true, as many items " -"as will fit within the *width* will be formatted on each output line." +#: library/pprint.rst:151 +msgid "PrettyPrinter Objects" msgstr "" -#: library/pprint.rst:159 -msgid "" -"If *sort_dicts* is true (the default), dictionaries will be formatted with " -"their keys sorted, otherwise they will display in insertion order." +#: library/pprint.rst:158 +msgid "Construct a :class:`PrettyPrinter` instance." msgstr "" -#: library/pprint.rst:162 +#: library/pprint.rst:160 msgid "" -"If *underscore_numbers* is true, integers will be formatted with the ``_`` " -"character for a thousands separator, otherwise underscores are not displayed " -"(the default)." +"Arguments have the same meaning as for :func:`~pprint.pp`. Note that they " +"are in a different order, and that *sort_dicts* defaults to ``True``." msgstr "" -#: library/pprint.rst:166 +#: library/pprint.rst:187 msgid "Added the *compact* parameter." msgstr "" -#: library/pprint.rst:169 +#: library/pprint.rst:190 msgid "Added the *sort_dicts* parameter." msgstr "" -#: library/pprint.rst:172 +#: library/pprint.rst:193 msgid "Added the *underscore_numbers* parameter." msgstr "" -#: library/pprint.rst:175 +#: library/pprint.rst:196 msgid "No longer attempts to write to :data:`!sys.stdout` if it is ``None``." msgstr "" -#: library/pprint.rst:202 +#: library/pprint.rst:200 msgid ":class:`PrettyPrinter` instances have the following methods:" msgstr "" -#: library/pprint.rst:207 +#: library/pprint.rst:205 msgid "" "Return the formatted representation of *object*. This takes into account " "the options passed to the :class:`PrettyPrinter` constructor." msgstr "" -#: library/pprint.rst:213 +#: library/pprint.rst:211 msgid "" "Print the formatted representation of *object* on the configured stream, " "followed by a newline." msgstr "" -#: library/pprint.rst:216 +#: library/pprint.rst:214 msgid "" "The following methods provide the implementations for the corresponding " "functions of the same names. Using these methods on an instance is slightly " @@ -226,7 +208,7 @@ msgid "" "created." msgstr "" -#: library/pprint.rst:226 +#: library/pprint.rst:224 msgid "" "Determine if the formatted representation of the object is \"readable,\" or " "can be used to reconstruct the value using :func:`eval`. Note that this " @@ -235,18 +217,18 @@ msgid "" "returns ``False``." msgstr "" -#: library/pprint.rst:235 +#: library/pprint.rst:233 msgid "Determine if the object requires a recursive representation." msgstr "" -#: library/pprint.rst:237 +#: library/pprint.rst:235 msgid "" "This method is provided as a hook to allow subclasses to modify the way " "objects are converted to strings. The default implementation uses the " "internals of the :func:`saferepr` implementation." msgstr "" -#: library/pprint.rst:244 +#: library/pprint.rst:242 msgid "" "Returns three values: the formatted version of *object* as a string, a flag " "indicating whether the result is readable, and a flag indicating whether " @@ -264,45 +246,212 @@ msgid "" "of the current call." msgstr "" -#: library/pprint.rst:262 +#: library/pprint.rst:260 msgid "Example" msgstr "" -#: library/pprint.rst:264 +#: library/pprint.rst:262 msgid "" -"To demonstrate several uses of the :func:`~pprint.pprint` function and its " +"To demonstrate several uses of the :func:`~pprint.pp` function and its " "parameters, let's fetch information about a project from `PyPI `_::" msgstr "" -#: library/pprint.rst:273 -msgid "In its basic form, :func:`~pprint.pprint` shows the whole object::" +#: library/pprint.rst:265 +msgid "" +">>> import json\n" +">>> import pprint\n" +">>> from urllib.request import urlopen\n" +">>> with urlopen('https://pypi.org/pypi/sampleproject/1.2.0/json') as resp:\n" +"... project_info = json.load(resp)['info']" +msgstr "" + +#: library/pprint.rst:271 +msgid "In its basic form, :func:`~pprint.pp` shows the whole object::" msgstr "" -#: library/pprint.rst:329 +#: library/pprint.rst:273 +msgid "" +">>> pprint.pp(project_info)\n" +"{'author': 'The Python Packaging Authority',\n" +" 'author_email': 'pypa-dev@googlegroups.com',\n" +" 'bugtrack_url': None,\n" +" 'classifiers': ['Development Status :: 3 - Alpha',\n" +" 'Intended Audience :: Developers',\n" +" 'License :: OSI Approved :: MIT License',\n" +" 'Programming Language :: Python :: 2',\n" +" 'Programming Language :: Python :: 2.6',\n" +" 'Programming Language :: Python :: 2.7',\n" +" 'Programming Language :: Python :: 3',\n" +" 'Programming Language :: Python :: 3.2',\n" +" 'Programming Language :: Python :: 3.3',\n" +" 'Programming Language :: Python :: 3.4',\n" +" 'Topic :: Software Development :: Build Tools'],\n" +" 'description': 'A sample Python project\\n'\n" +" '=======================\\n'\n" +" '\\n'\n" +" 'This is the description file for the project.\\n'\n" +" '\\n'\n" +" 'The file should use UTF-8 encoding and be written using '\n" +" 'ReStructured Text. It\\n'\n" +" 'will be used to generate the project webpage on PyPI, and " +"'\n" +" 'should be written for\\n'\n" +" 'that purpose.\\n'\n" +" '\\n'\n" +" 'Typical contents for this file would include an overview of " +"'\n" +" 'the project, basic\\n'\n" +" 'usage examples, etc. Generally, including the project '\n" +" 'changelog in here is not\\n'\n" +" 'a good idea, although a simple \"What\\'s New\" section for " +"the '\n" +" 'most recent version\\n'\n" +" 'may be appropriate.',\n" +" 'description_content_type': None,\n" +" 'docs_url': None,\n" +" 'download_url': 'UNKNOWN',\n" +" 'downloads': {'last_day': -1, 'last_month': -1, 'last_week': -1},\n" +" 'home_page': 'https://github.com/pypa/sampleproject',\n" +" 'keywords': 'sample setuptools development',\n" +" 'license': 'MIT',\n" +" 'maintainer': None,\n" +" 'maintainer_email': None,\n" +" 'name': 'sampleproject',\n" +" 'package_url': 'https://pypi.org/project/sampleproject/',\n" +" 'platform': 'UNKNOWN',\n" +" 'project_url': 'https://pypi.org/project/sampleproject/',\n" +" 'project_urls': {'Download': 'UNKNOWN',\n" +" 'Homepage': 'https://github.com/pypa/sampleproject'},\n" +" 'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',\n" +" 'requires_dist': None,\n" +" 'requires_python': None,\n" +" 'summary': 'A sample Python project',\n" +" 'version': '1.2.0'}" +msgstr "" + +#: library/pprint.rst:327 msgid "" "The result can be limited to a certain *depth* (ellipsis is used for deeper " "contents)::" msgstr "" -#: library/pprint.rst:375 +#: library/pprint.rst:330 +msgid "" +">>> pprint.pp(project_info, depth=1)\n" +"{'author': 'The Python Packaging Authority',\n" +" 'author_email': 'pypa-dev@googlegroups.com',\n" +" 'bugtrack_url': None,\n" +" 'classifiers': [...],\n" +" 'description': 'A sample Python project\\n'\n" +" '=======================\\n'\n" +" '\\n'\n" +" 'This is the description file for the project.\\n'\n" +" '\\n'\n" +" 'The file should use UTF-8 encoding and be written using '\n" +" 'ReStructured Text. It\\n'\n" +" 'will be used to generate the project webpage on PyPI, and " +"'\n" +" 'should be written for\\n'\n" +" 'that purpose.\\n'\n" +" '\\n'\n" +" 'Typical contents for this file would include an overview of " +"'\n" +" 'the project, basic\\n'\n" +" 'usage examples, etc. Generally, including the project '\n" +" 'changelog in here is not\\n'\n" +" 'a good idea, although a simple \"What\\'s New\" section for " +"the '\n" +" 'most recent version\\n'\n" +" 'may be appropriate.',\n" +" 'description_content_type': None,\n" +" 'docs_url': None,\n" +" 'download_url': 'UNKNOWN',\n" +" 'downloads': {...},\n" +" 'home_page': 'https://github.com/pypa/sampleproject',\n" +" 'keywords': 'sample setuptools development',\n" +" 'license': 'MIT',\n" +" 'maintainer': None,\n" +" 'maintainer_email': None,\n" +" 'name': 'sampleproject',\n" +" 'package_url': 'https://pypi.org/project/sampleproject/',\n" +" 'platform': 'UNKNOWN',\n" +" 'project_url': 'https://pypi.org/project/sampleproject/',\n" +" 'project_urls': {...},\n" +" 'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',\n" +" 'requires_dist': None,\n" +" 'requires_python': None,\n" +" 'summary': 'A sample Python project',\n" +" 'version': '1.2.0'}" +msgstr "" + +#: library/pprint.rst:373 msgid "" "Additionally, maximum character *width* can be suggested. If a long object " "cannot be split, the specified width will be exceeded::" msgstr "" -#: library/pprint.rst:224 +#: library/pprint.rst:376 +msgid "" +">>> pprint.pp(project_info, depth=1, width=60)\n" +"{'author': 'The Python Packaging Authority',\n" +" 'author_email': 'pypa-dev@googlegroups.com',\n" +" 'bugtrack_url': None,\n" +" 'classifiers': [...],\n" +" 'description': 'A sample Python project\\n'\n" +" '=======================\\n'\n" +" '\\n'\n" +" 'This is the description file for the '\n" +" 'project.\\n'\n" +" '\\n'\n" +" 'The file should use UTF-8 encoding and be '\n" +" 'written using ReStructured Text. It\\n'\n" +" 'will be used to generate the project '\n" +" 'webpage on PyPI, and should be written '\n" +" 'for\\n'\n" +" 'that purpose.\\n'\n" +" '\\n'\n" +" 'Typical contents for this file would '\n" +" 'include an overview of the project, '\n" +" 'basic\\n'\n" +" 'usage examples, etc. Generally, including '\n" +" 'the project changelog in here is not\\n'\n" +" 'a good idea, although a simple \"What\\'s '\n" +" 'New\" section for the most recent version\\n'\n" +" 'may be appropriate.',\n" +" 'description_content_type': None,\n" +" 'docs_url': None,\n" +" 'download_url': 'UNKNOWN',\n" +" 'downloads': {...},\n" +" 'home_page': 'https://github.com/pypa/sampleproject',\n" +" 'keywords': 'sample setuptools development',\n" +" 'license': 'MIT',\n" +" 'maintainer': None,\n" +" 'maintainer_email': None,\n" +" 'name': 'sampleproject',\n" +" 'package_url': 'https://pypi.org/project/sampleproject/',\n" +" 'platform': 'UNKNOWN',\n" +" 'project_url': 'https://pypi.org/project/sampleproject/',\n" +" 'project_urls': {...},\n" +" 'release_url': 'https://pypi.org/project/sampleproject/1.2.0/',\n" +" 'requires_dist': None,\n" +" 'requires_python': None,\n" +" 'summary': 'A sample Python project',\n" +" 'version': '1.2.0'}" +msgstr "" + +#: library/pprint.rst:222 msgid "built-in function" msgstr "" -#: library/pprint.rst:224 +#: library/pprint.rst:222 msgid "eval" msgstr "" -#: library/pprint.rst:125 +#: library/pprint.rst:153 msgid "..." msgstr "" -#: library/pprint.rst:125 +#: library/pprint.rst:153 msgid "placeholder" msgstr "" diff --git a/library/profile.po b/library/profile.po index 964fdae1..0ab3ac5d 100644 --- a/library/profile.po +++ b/library/profile.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -83,6 +84,13 @@ msgstr "" msgid "To profile a function that takes a single argument, you can do::" msgstr "" +#: library/profile.rst:59 +msgid "" +"import cProfile\n" +"import re\n" +"cProfile.run('re.compile(\"foo|bar\")')" +msgstr "" + #: library/profile.rst:63 msgid "" "(Use :mod:`profile` instead of :mod:`cProfile` if the latter is not " @@ -95,6 +103,23 @@ msgid "" "the following::" msgstr "" +#: library/profile.rst:69 +msgid "" +" 214 function calls (207 primitive calls) in 0.002 seconds\n" +"\n" +"Ordered by: cumulative time\n" +"\n" +"ncalls tottime percall cumtime percall filename:lineno(function)\n" +" 1 0.000 0.000 0.002 0.002 {built-in method builtins.exec}\n" +" 1 0.000 0.000 0.001 0.001 :1()\n" +" 1 0.000 0.000 0.001 0.001 __init__.py:250(compile)\n" +" 1 0.000 0.000 0.001 0.001 __init__.py:289(_compile)\n" +" 1 0.000 0.000 0.000 0.000 _compiler.py:759(compile)\n" +" 1 0.000 0.000 0.000 0.000 _parser.py:937(parse)\n" +" 1 0.000 0.000 0.000 0.000 _compiler.py:598(_code)\n" +" 1 0.000 0.000 0.000 0.000 _parser.py:435(_parse_sub)" +msgstr "" + #: library/profile.rst:83 msgid "" "The first line indicates that 214 calls were monitored. Of those calls, 207 " @@ -103,7 +128,7 @@ msgid "" "sorted by the ``cumtime`` values. The column headings include:" msgstr "" -#: library/profile.rst:89 +#: library/profile.rst:88 msgid "ncalls" msgstr "" @@ -111,7 +136,7 @@ msgstr "" msgid "for the number of calls." msgstr "" -#: library/profile.rst:93 +#: library/profile.rst:91 msgid "tottime" msgstr "" @@ -121,7 +146,7 @@ msgid "" "calls to sub-functions)" msgstr "" -#: library/profile.rst:103 +#: library/profile.rst:102 msgid "percall" msgstr "" @@ -129,7 +154,7 @@ msgstr "" msgid "is the quotient of ``tottime`` divided by ``ncalls``" msgstr "" -#: library/profile.rst:100 +#: library/profile.rst:98 msgid "cumtime" msgstr "" @@ -143,7 +168,7 @@ msgstr "" msgid "is the quotient of ``cumtime`` divided by primitive calls" msgstr "" -#: library/profile.rst:106 +#: library/profile.rst:105 msgid "filename:lineno(function)" msgstr "" @@ -166,48 +191,69 @@ msgid "" "the results to a file by specifying a filename to the :func:`run` function::" msgstr "" +#: library/profile.rst:117 +msgid "" +"import cProfile\n" +"import re\n" +"cProfile.run('re.compile(\"foo|bar\")', 'restats')" +msgstr "" + #: library/profile.rst:121 msgid "" "The :class:`pstats.Stats` class reads profile results from a file and " "formats them in various ways." msgstr "" -#: library/profile.rst:126 +#: library/profile.rst:128 msgid "" "The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script " "to profile another script. For example::" msgstr "" #: library/profile.rst:131 -msgid "``-o`` writes the profile results to a file instead of to stdout" +msgid "" +"python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)" msgstr "" -#: library/profile.rst:133 +#: library/profile.rst:135 +msgid "Writes the profile results to a file instead of to stdout." +msgstr "" + +#: library/profile.rst:139 msgid "" -"``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to " -"sort the output by. This only applies when ``-o`` is not supplied." +"Specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort " +"the output by. This only applies when :option:`-o ` is not " +"supplied." msgstr "" -#: library/profile.rst:136 -msgid "``-m`` specifies that a module is being profiled instead of a script." +#: library/profile.rst:145 +msgid "Specifies that a module is being profiled instead of a script." msgstr "" -#: library/profile.rst:138 +#: library/profile.rst:147 msgid "Added the ``-m`` option to :mod:`cProfile`." msgstr "" -#: library/profile.rst:141 +#: library/profile.rst:150 msgid "Added the ``-m`` option to :mod:`profile`." msgstr "" -#: library/profile.rst:144 +#: library/profile.rst:153 msgid "" "The :mod:`pstats` module's :class:`~pstats.Stats` class has a variety of " "methods for manipulating and printing the data saved into a profile results " "file::" msgstr "" -#: library/profile.rst:152 +#: library/profile.rst:156 +msgid "" +"import pstats\n" +"from pstats import SortKey\n" +"p = pstats.Stats('restats')\n" +"p.strip_dirs().sort_stats(-1).print_stats()" +msgstr "" + +#: library/profile.rst:161 msgid "" "The :meth:`~pstats.Stats.strip_dirs` method removed the extraneous path from " "all the module names. The :meth:`~pstats.Stats.sort_stats` method sorted all " @@ -216,44 +262,66 @@ msgid "" "statistics. You might try the following sort calls::" msgstr "" -#: library/profile.rst:161 +#: library/profile.rst:167 +msgid "" +"p.sort_stats(SortKey.NAME)\n" +"p.print_stats()" +msgstr "" + +#: library/profile.rst:170 msgid "" "The first call will actually sort the list by function name, and the second " "call will print out the statistics. The following are some interesting " "calls to experiment with::" msgstr "" -#: library/profile.rst:167 +#: library/profile.rst:174 +msgid "p.sort_stats(SortKey.CUMULATIVE).print_stats(10)" +msgstr "" + +#: library/profile.rst:176 msgid "" "This sorts the profile by cumulative time in a function, and then only " "prints the ten most significant lines. If you want to understand what " "algorithms are taking time, the above line is what you would use." msgstr "" -#: library/profile.rst:171 +#: library/profile.rst:180 msgid "" "If you were looking to see what functions were looping a lot, and taking a " "lot of time, you would do::" msgstr "" -#: library/profile.rst:176 +#: library/profile.rst:183 +msgid "p.sort_stats(SortKey.TIME).print_stats(10)" +msgstr "" + +#: library/profile.rst:185 msgid "" "to sort according to time spent within each function, and then print the " "statistics for the top ten functions." msgstr "" -#: library/profile.rst:179 +#: library/profile.rst:188 msgid "You might also try::" msgstr "" -#: library/profile.rst:183 +#: library/profile.rst:190 +msgid "p.sort_stats(SortKey.FILENAME).print_stats('__init__')" +msgstr "" + +#: library/profile.rst:192 msgid "" "This will sort all the statistics by file name, and then print out " "statistics for only the class init methods (since they are spelled with " "``__init__`` in them). As one final example, you could try::" msgstr "" -#: library/profile.rst:189 +#: library/profile.rst:196 +msgid "p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')" +msgstr "" + +#: library/profile.rst:198 msgid "" "This line sorts statistics with a primary key of time, and a secondary key " "of cumulative time, and then prints out some of the statistics. To be " @@ -262,46 +330,60 @@ msgid "" "list is printed." msgstr "" -#: library/profile.rst:194 +#: library/profile.rst:203 msgid "" "If you wondered what functions called the above functions, you could now " "(``p`` is still sorted according to the last criteria) do::" msgstr "" -#: library/profile.rst:199 +#: library/profile.rst:206 +msgid "p.print_callers(.5, 'init')" +msgstr "" + +#: library/profile.rst:208 msgid "and you would get a list of callers for each of the listed functions." msgstr "" -#: library/profile.rst:201 +#: library/profile.rst:210 msgid "" "If you want more functionality, you're going to have to read the manual, or " "guess what the following functions do::" msgstr "" -#: library/profile.rst:207 +#: library/profile.rst:213 +msgid "" +"p.print_callees()\n" +"p.add('restats')" +msgstr "" + +#: library/profile.rst:216 msgid "" "Invoked as a script, the :mod:`pstats` module is a statistics browser for " "reading and examining profile dumps. It has a simple line-oriented " "interface (implemented using :mod:`cmd`) and interactive help." msgstr "" -#: library/profile.rst:212 +#: library/profile.rst:221 msgid ":mod:`profile` and :mod:`cProfile` Module Reference" msgstr "" -#: library/profile.rst:218 +#: library/profile.rst:227 msgid "" "Both the :mod:`profile` and :mod:`cProfile` modules provide the following " "functions:" msgstr "" -#: library/profile.rst:223 +#: library/profile.rst:232 msgid "" "This function takes a single argument that can be passed to the :func:`exec` " "function, and an optional file name. In all cases this routine executes::" msgstr "" -#: library/profile.rst:228 +#: library/profile.rst:235 +msgid "exec(command, __main__.__dict__, __main__.__dict__)" +msgstr "" + +#: library/profile.rst:237 msgid "" "and gathers profiling statistics from the execution. If no file name is " "present, then this function automatically creates a :class:`~pstats.Stats` " @@ -310,24 +392,27 @@ msgid "" "how the results are sorted." msgstr "" -#: library/profile.rst:236 +#: library/profile.rst:245 msgid "" "This function is similar to :func:`run`, with added arguments to supply the " -"globals and locals dictionaries for the *command* string. This routine " -"executes::" +"globals and locals mappings for the *command* string. This routine executes::" +msgstr "" + +#: library/profile.rst:249 +msgid "exec(command, globals, locals)" msgstr "" -#: library/profile.rst:242 +#: library/profile.rst:251 msgid "and gathers profiling statistics as in the :func:`run` function above." msgstr "" -#: library/profile.rst:246 +#: library/profile.rst:255 msgid "" "This class is normally only used if more precise control over profiling is " "needed than what the :func:`cProfile.run` function provides." msgstr "" -#: library/profile.rst:249 +#: library/profile.rst:258 msgid "" "A custom timer can be supplied for measuring how long code takes to run via " "the *timer* argument. This must be a function that returns a single number " @@ -337,61 +422,97 @@ msgid "" "time unit would be ``.001``." msgstr "" -#: library/profile.rst:256 +#: library/profile.rst:265 msgid "" "Directly using the :class:`Profile` class allows formatting profile results " "without writing the profile data to a file::" msgstr "" -#: library/profile.rst:271 +#: library/profile.rst:268 +msgid "" +"import cProfile, pstats, io\n" +"from pstats import SortKey\n" +"pr = cProfile.Profile()\n" +"pr.enable()\n" +"# ... do something ...\n" +"pr.disable()\n" +"s = io.StringIO()\n" +"sortby = SortKey.CUMULATIVE\n" +"ps = pstats.Stats(pr, stream=s).sort_stats(sortby)\n" +"ps.print_stats()\n" +"print(s.getvalue())" +msgstr "" + +#: library/profile.rst:280 msgid "" "The :class:`Profile` class can also be used as a context manager (supported " "only in :mod:`cProfile` module. see :ref:`typecontextmanager`)::" msgstr "" -#: library/profile.rst:281 +#: library/profile.rst:283 +msgid "" +"import cProfile\n" +"\n" +"with cProfile.Profile() as pr:\n" +" # ... do something ...\n" +"\n" +" pr.print_stats()" +msgstr "" + +#: library/profile.rst:290 msgid "Added context manager support." msgstr "" -#: library/profile.rst:286 +#: library/profile.rst:295 msgid "Start collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: library/profile.rst:290 +#: library/profile.rst:299 msgid "Stop collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: library/profile.rst:294 +#: library/profile.rst:303 msgid "" "Stop collecting profiling data and record the results internally as the " "current profile." msgstr "" -#: library/profile.rst:299 +#: library/profile.rst:308 msgid "" "Create a :class:`~pstats.Stats` object based on the current profile and " "print the results to stdout." msgstr "" -#: library/profile.rst:304 +#: library/profile.rst:311 +msgid "" +"The *sort* parameter specifies the sorting order of the displayed " +"statistics. It accepts a single key or a tuple of keys to enable multi-level " +"sorting, as in :func:`Stats.sort_stats `." +msgstr "" + +#: library/profile.rst:315 +msgid ":meth:`~Profile.print_stats` now accepts a tuple of keys." +msgstr "" + +#: library/profile.rst:320 msgid "Write the results of the current profile to *filename*." msgstr "" -#: library/profile.rst:308 +#: library/profile.rst:324 msgid "Profile the cmd via :func:`exec`." msgstr "" -#: library/profile.rst:312 +#: library/profile.rst:328 msgid "" "Profile the cmd via :func:`exec` with the specified global and local " "environment." msgstr "" -#: library/profile.rst:317 +#: library/profile.rst:333 msgid "Profile ``func(*args, **kwargs)``" msgstr "" -#: library/profile.rst:319 +#: library/profile.rst:335 msgid "" "Note that profiling will only work if the called command/function actually " "returns. If the interpreter is terminated (e.g. via a :func:`sys.exit` call " @@ -399,23 +520,23 @@ msgid "" "printed." msgstr "" -#: library/profile.rst:327 +#: library/profile.rst:343 msgid "The :class:`Stats` Class" msgstr "" -#: library/profile.rst:329 +#: library/profile.rst:345 msgid "" "Analysis of the profiler data is done using the :class:`~pstats.Stats` class." msgstr "" -#: library/profile.rst:336 +#: library/profile.rst:352 msgid "" "This class constructor creates an instance of a \"statistics object\" from a " "*filename* (or list of filenames) or from a :class:`Profile` instance. " "Output will be printed to the stream specified by *stream*." msgstr "" -#: library/profile.rst:340 +#: library/profile.rst:356 msgid "" "The file selected by the above constructor must have been created by the " "corresponding version of :mod:`profile` or :mod:`cProfile`. To be specific, " @@ -429,17 +550,17 @@ msgid "" "can be used." msgstr "" -#: library/profile.rst:351 +#: library/profile.rst:367 msgid "" "Instead of reading the profile data from a file, a :class:`cProfile.Profile` " "or :class:`profile.Profile` object can be used as the profile data source." msgstr "" -#: library/profile.rst:354 +#: library/profile.rst:370 msgid ":class:`Stats` objects have the following methods:" msgstr "" -#: library/profile.rst:358 +#: library/profile.rst:374 msgid "" "This method for the :class:`Stats` class removes all leading path " "information from file names. It is very useful in reducing the size of the " @@ -453,7 +574,7 @@ msgid "" "single entry." msgstr "" -#: library/profile.rst:372 +#: library/profile.rst:388 msgid "" "This method of the :class:`Stats` class accumulates additional profiling " "information into the current profiling object. Its arguments should refer " @@ -462,7 +583,7 @@ msgid "" "functions are automatically accumulated into single function statistics." msgstr "" -#: library/profile.rst:382 +#: library/profile.rst:398 msgid "" "Save the data loaded into the :class:`Stats` object to a file named " "*filename*. The file is created if it does not exist, and is overwritten if " @@ -470,7 +591,7 @@ msgid "" "the :class:`profile.Profile` and :class:`cProfile.Profile` classes." msgstr "" -#: library/profile.rst:390 +#: library/profile.rst:406 msgid "" "This method modifies the :class:`Stats` object by sorting it according to " "the supplied criteria. The argument can be either a string or a SortKey " @@ -480,7 +601,7 @@ msgid "" "prone." msgstr "" -#: library/profile.rst:397 +#: library/profile.rst:413 msgid "" "When more than one key is provided, then additional keys are used as " "secondary criteria when there is equality in all keys selected before them. " @@ -489,161 +610,161 @@ msgid "" "function names) by sorting by file name." msgstr "" -#: library/profile.rst:403 +#: library/profile.rst:419 msgid "" "For the string argument, abbreviations can be used for any key names, as " "long as the abbreviation is unambiguous." msgstr "" -#: library/profile.rst:406 +#: library/profile.rst:422 msgid "The following are the valid string and SortKey:" msgstr "" -#: library/profile.rst:409 +#: library/profile.rst:425 msgid "Valid String Arg" msgstr "" -#: library/profile.rst:409 +#: library/profile.rst:425 msgid "Valid enum Arg" msgstr "" -#: library/profile.rst:409 +#: library/profile.rst:425 msgid "Meaning" msgstr "" -#: library/profile.rst:411 +#: library/profile.rst:427 msgid "``'calls'``" msgstr "" -#: library/profile.rst:411 +#: library/profile.rst:427 msgid "SortKey.CALLS" msgstr "" -#: library/profile.rst:423 +#: library/profile.rst:439 msgid "call count" msgstr "" -#: library/profile.rst:413 +#: library/profile.rst:429 msgid "``'cumulative'``" msgstr "" -#: library/profile.rst:413 +#: library/profile.rst:429 msgid "SortKey.CUMULATIVE" msgstr "" -#: library/profile.rst:415 +#: library/profile.rst:431 msgid "cumulative time" msgstr "" -#: library/profile.rst:415 +#: library/profile.rst:431 msgid "``'cumtime'``" msgstr "" -#: library/profile.rst:417 library/profile.rst:423 library/profile.rst:437 +#: library/profile.rst:433 library/profile.rst:439 library/profile.rst:453 msgid "N/A" msgstr "" -#: library/profile.rst:417 +#: library/profile.rst:433 msgid "``'file'``" msgstr "" -#: library/profile.rst:419 library/profile.rst:421 +#: library/profile.rst:435 library/profile.rst:437 msgid "file name" msgstr "" -#: library/profile.rst:419 +#: library/profile.rst:435 msgid "``'filename'``" msgstr "" -#: library/profile.rst:419 +#: library/profile.rst:435 msgid "SortKey.FILENAME" msgstr "" -#: library/profile.rst:421 +#: library/profile.rst:437 msgid "``'module'``" msgstr "" -#: library/profile.rst:423 +#: library/profile.rst:439 msgid "``'ncalls'``" msgstr "" -#: library/profile.rst:425 +#: library/profile.rst:441 msgid "``'pcalls'``" msgstr "" -#: library/profile.rst:425 +#: library/profile.rst:441 msgid "SortKey.PCALLS" msgstr "" -#: library/profile.rst:425 +#: library/profile.rst:441 msgid "primitive call count" msgstr "" -#: library/profile.rst:427 +#: library/profile.rst:443 msgid "``'line'``" msgstr "" -#: library/profile.rst:427 +#: library/profile.rst:443 msgid "SortKey.LINE" msgstr "" -#: library/profile.rst:427 +#: library/profile.rst:443 msgid "line number" msgstr "" -#: library/profile.rst:429 +#: library/profile.rst:445 msgid "``'name'``" msgstr "" -#: library/profile.rst:429 +#: library/profile.rst:445 msgid "SortKey.NAME" msgstr "" -#: library/profile.rst:429 +#: library/profile.rst:445 msgid "function name" msgstr "" -#: library/profile.rst:431 +#: library/profile.rst:447 msgid "``'nfl'``" msgstr "" -#: library/profile.rst:431 +#: library/profile.rst:447 msgid "SortKey.NFL" msgstr "" -#: library/profile.rst:431 +#: library/profile.rst:447 msgid "name/file/line" msgstr "" -#: library/profile.rst:433 +#: library/profile.rst:449 msgid "``'stdname'``" msgstr "" -#: library/profile.rst:433 +#: library/profile.rst:449 msgid "SortKey.STDNAME" msgstr "" -#: library/profile.rst:433 +#: library/profile.rst:449 msgid "standard name" msgstr "" -#: library/profile.rst:435 +#: library/profile.rst:451 msgid "``'time'``" msgstr "" -#: library/profile.rst:435 +#: library/profile.rst:451 msgid "SortKey.TIME" msgstr "" -#: library/profile.rst:437 +#: library/profile.rst:453 msgid "internal time" msgstr "" -#: library/profile.rst:437 +#: library/profile.rst:453 msgid "``'tottime'``" msgstr "" -#: library/profile.rst:440 +#: library/profile.rst:456 msgid "" "Note that all sorts on statistics are in descending order (placing most time " "consuming items first), where as name, file, and line number searches are in " @@ -657,7 +778,7 @@ msgid "" "SortKey.FILENAME, SortKey.LINE)``." msgstr "" -#: library/profile.rst:451 +#: library/profile.rst:467 msgid "" "For backward-compatibility reasons, the numeric arguments ``-1``, ``0``, " "``1``, and ``2`` are permitted. They are interpreted as ``'stdname'``, " @@ -666,56 +787,64 @@ msgid "" "used, and additional arguments will be silently ignored." msgstr "" -#: library/profile.rst:459 +#: library/profile.rst:475 msgid "Added the SortKey enum." msgstr "" -#: library/profile.rst:464 +#: library/profile.rst:480 msgid "" "This method for the :class:`Stats` class reverses the ordering of the basic " "list within the object. Note that by default ascending vs descending order " "is properly selected based on the sort key of choice." msgstr "" -#: library/profile.rst:474 +#: library/profile.rst:490 msgid "" "This method for the :class:`Stats` class prints out a report as described in " "the :func:`profile.run` definition." msgstr "" -#: library/profile.rst:477 +#: library/profile.rst:493 msgid "" "The order of the printing is based on the last :meth:`~pstats.Stats." "sort_stats` operation done on the object (subject to caveats in :meth:" "`~pstats.Stats.add` and :meth:`~pstats.Stats.strip_dirs`)." msgstr "" -#: library/profile.rst:482 +#: library/profile.rst:498 msgid "" "The arguments provided (if any) can be used to limit the list down to the " "significant entries. Initially, the list is taken to be the complete set of " "profiled functions. Each restriction is either an integer (to select a " "count of lines), or a decimal fraction between 0.0 and 1.0 inclusive (to " -"select a percentage of lines), or a string that will interpreted as a " +"select a percentage of lines), or a string that will be interpreted as a " "regular expression (to pattern match the standard name that is printed). If " "several restrictions are provided, then they are applied sequentially. For " "example::" msgstr "" -#: library/profile.rst:493 +#: library/profile.rst:507 +msgid "print_stats(.1, 'foo:')" +msgstr "" + +#: library/profile.rst:509 msgid "" "would first limit the printing to first 10% of list, and then only print " "functions that were part of filename :file:`.\\*foo:`. In contrast, the " "command::" msgstr "" -#: library/profile.rst:499 +#: library/profile.rst:513 +msgid "print_stats('foo:', .1)" +msgstr "" + +#: library/profile.rst:515 msgid "" "would limit the list to all functions having file names :file:`.\\*foo:`, " "and then proceed to only print the first 10% of them." msgstr "" -#: library/profile.rst:505 +#: library/profile.rst:521 msgid "" "This method for the :class:`Stats` class prints a list of all functions that " "called each function in the profiled database. The ordering is identical to " @@ -725,7 +854,7 @@ msgid "" "produced the stats:" msgstr "" -#: library/profile.rst:512 +#: library/profile.rst:528 msgid "" "With :mod:`profile`, a number is shown in parentheses after each caller to " "show how many times this specific call was made. For convenience, a second " @@ -733,14 +862,14 @@ msgid "" "at the right." msgstr "" -#: library/profile.rst:517 +#: library/profile.rst:533 msgid "" "With :mod:`cProfile`, each caller is preceded by three numbers: the number " "of times this specific call was made, and the total and cumulative times " "spent in the current function while it was invoked by this specific caller." msgstr "" -#: library/profile.rst:525 +#: library/profile.rst:541 msgid "" "This method for the :class:`Stats` class prints a list of all function that " "were called by the indicated function. Aside from this reversal of " @@ -748,7 +877,7 @@ msgid "" "are identical to the :meth:`~pstats.Stats.print_callers` method." msgstr "" -#: library/profile.rst:533 +#: library/profile.rst:549 msgid "" "This method returns an instance of StatsProfile, which contains a mapping of " "function names to instances of FunctionProfile. Each FunctionProfile " @@ -756,17 +885,17 @@ msgid "" "long the function took to run, how many times it was called, etc..." msgstr "" -#: library/profile.rst:538 +#: library/profile.rst:554 msgid "" "Added the following dataclasses: StatsProfile, FunctionProfile. Added the " "following function: get_stats_profile." msgstr "" -#: library/profile.rst:545 +#: library/profile.rst:561 msgid "What Is Deterministic Profiling?" msgstr "" -#: library/profile.rst:547 +#: library/profile.rst:563 msgid "" ":dfn:`Deterministic profiling` is meant to reflect the fact that all " "*function call*, *function return*, and *exception* events are monitored, " @@ -779,7 +908,7 @@ msgid "" "being spent." msgstr "" -#: library/profile.rst:556 +#: library/profile.rst:572 msgid "" "In Python, since there is an interpreter active during execution, the " "presence of instrumented code is not required in order to do deterministic " @@ -791,7 +920,7 @@ msgid "" "time statistics about the execution of a Python program." msgstr "" -#: library/profile.rst:565 +#: library/profile.rst:581 msgid "" "Call count statistics can be used to identify bugs in code (surprising " "counts), and to identify possible inline-expansion points (high call " @@ -803,11 +932,11 @@ msgid "" "compared to iterative implementations." msgstr "" -#: library/profile.rst:578 +#: library/profile.rst:594 msgid "Limitations" msgstr "" -#: library/profile.rst:580 +#: library/profile.rst:596 msgid "" "One limitation has to do with accuracy of timing information. There is a " "fundamental problem with deterministic profilers involving accuracy. The " @@ -818,7 +947,7 @@ msgid "" "first error induces a second source of error." msgstr "" -#: library/profile.rst:588 +#: library/profile.rst:604 msgid "" "The second problem is that it \"takes a while\" from when an event is " "dispatched until the profiler's call to get the time actually *gets* the " @@ -831,7 +960,7 @@ msgid "" "clock tick), but it *can* accumulate and become very significant." msgstr "" -#: library/profile.rst:598 +#: library/profile.rst:614 msgid "" "The problem is more important with :mod:`profile` than with the lower-" "overhead :mod:`cProfile`. For this reason, :mod:`profile` provides a means " @@ -845,11 +974,11 @@ msgid "" "calibration." msgstr "" -#: library/profile.rst:612 +#: library/profile.rst:628 msgid "Calibration" msgstr "" -#: library/profile.rst:614 +#: library/profile.rst:630 msgid "" "The profiler of the :mod:`profile` module subtracts a constant from each " "event handling time to compensate for the overhead of calling the time " @@ -858,7 +987,15 @@ msgid "" "platform (see :ref:`profile-limitations`). ::" msgstr "" -#: library/profile.rst:625 +#: library/profile.rst:636 +msgid "" +"import profile\n" +"pr = profile.Profile()\n" +"for i in range(5):\n" +" print(pr.calibrate(10000))" +msgstr "" + +#: library/profile.rst:641 msgid "" "The method executes the number of Python calls given by the argument, " "directly and again under the profiler, measuring the time for both. It then " @@ -868,48 +1005,67 @@ msgid "" "4.04e-6." msgstr "" -#: library/profile.rst:631 +#: library/profile.rst:647 msgid "" "The object of this exercise is to get a fairly consistent result. If your " "computer is *very* fast, or your timer function has poor resolution, you " "might have to pass 100000, or even 1000000, to get consistent results." msgstr "" -#: library/profile.rst:635 +#: library/profile.rst:651 msgid "" "When you have a consistent answer, there are three ways you can use it::" msgstr "" -#: library/profile.rst:649 +#: library/profile.rst:653 +msgid "" +"import profile\n" +"\n" +"# 1. Apply computed bias to all Profile instances created hereafter.\n" +"profile.Profile.bias = your_computed_bias\n" +"\n" +"# 2. Apply computed bias to a specific Profile instance.\n" +"pr = profile.Profile()\n" +"pr.bias = your_computed_bias\n" +"\n" +"# 3. Specify computed bias in instance constructor.\n" +"pr = profile.Profile(bias=your_computed_bias)" +msgstr "" + +#: library/profile.rst:665 msgid "" "If you have a choice, you are better off choosing a smaller constant, and " "then your results will \"less often\" show up as negative in profile " "statistics." msgstr "" -#: library/profile.rst:655 +#: library/profile.rst:671 msgid "Using a custom timer" msgstr "" -#: library/profile.rst:657 +#: library/profile.rst:673 msgid "" "If you want to change how current time is determined (for example, to force " "use of wall-clock time or elapsed process time), pass the timing function " "you want to the :class:`Profile` class constructor::" msgstr "" -#: library/profile.rst:663 +#: library/profile.rst:677 +msgid "pr = profile.Profile(your_time_func)" +msgstr "" + +#: library/profile.rst:679 msgid "" "The resulting profiler will then call ``your_time_func``. Depending on " "whether you are using :class:`profile.Profile` or :class:`cProfile.Profile`, " "``your_time_func``'s return value will be interpreted differently:" msgstr "" -#: library/profile.rst:681 +#: library/profile.rst:683 msgid ":class:`profile.Profile`" msgstr "" -#: library/profile.rst:668 +#: library/profile.rst:684 msgid "" "``your_time_func`` should return a single number, or a list of numbers whose " "sum is the current time (like what :func:`os.times` returns). If the " @@ -918,23 +1074,23 @@ msgid "" "routine." msgstr "" -#: library/profile.rst:674 +#: library/profile.rst:690 msgid "" "Be warned that you should calibrate the profiler class for the timer " "function that you choose (see :ref:`profile-calibration`). For most " "machines, a timer that returns a lone integer value will provide the best " "results in terms of low overhead during profiling. (:func:`os.times` is " -"*pretty* bad, as it returns a tuple of floating point values). If you want " +"*pretty* bad, as it returns a tuple of floating-point values). If you want " "to substitute a better timer in the cleanest fashion, derive a class and " "hardwire a replacement dispatch method that best handles your timer call, " "along with the appropriate calibration constant." msgstr "" -#: library/profile.rst:695 +#: library/profile.rst:699 msgid ":class:`cProfile.Profile`" msgstr "" -#: library/profile.rst:684 +#: library/profile.rst:700 msgid "" "``your_time_func`` should return a single number. If it returns integers, " "you can also invoke the class constructor with a second argument specifying " @@ -943,15 +1099,19 @@ msgid "" "you would construct the :class:`Profile` instance as follows::" msgstr "" -#: library/profile.rst:692 +#: library/profile.rst:706 +msgid "pr = cProfile.Profile(your_integer_time_func, 0.001)" +msgstr "" + +#: library/profile.rst:708 msgid "" "As the :class:`cProfile.Profile` class cannot be calibrated, custom timer " "functions should be used with care and should be as fast as possible. For " "the best results with a custom timer, it might be necessary to hard-code it " -"in the C source of the internal :mod:`_lsprof` module." +"in the C source of the internal :mod:`!_lsprof` module." msgstr "" -#: library/profile.rst:697 +#: library/profile.rst:713 msgid "" "Python 3.3 adds several new functions in :mod:`time` that can be used to " "make precise measurements of process or wall-clock time. For example, see :" diff --git a/library/pty.po b/library/pty.po index a32b8bbd..c004bf36 100644 --- a/library/pty.po +++ b/library/pty.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2026-01-11 15:57+0300\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pty.rst:2 -msgid ":mod:`pty` --- Pseudo-terminal utilities" -msgstr "" +msgid ":mod:`!pty` --- Pseudo-terminal utilities" +msgstr ":mod:`!pty` --- Βοηθητικά προγράμματα ψευδοτερματικού" #: library/pty.rst:11 msgid "**Source code:** :source:`Lib/pty.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/pty.py`" #: library/pty.rst:15 msgid "" @@ -30,10 +31,14 @@ msgid "" "concept: starting another process and being able to write to and read from " "its controlling terminal programmatically." msgstr "" +"Το :mod:`pty` module ορίζει λειτουργίες για τη διαχείριση της έννοιας του " +"ψευδοτερματικού: την εκκίνηση μιας άλλης διαδικασίας και την ικανότητα να " +"γράφει και να διαβάζει από το τερματικό πρόγραμμα ελέγχου της " +"προγραμματιστικά." #: library/pty.rst:19 -msgid ":ref:`Availability `: Unix." -msgstr "" +msgid "Availability" +msgstr "Διαθεσιμότητα" #: library/pty.rst:21 msgid "" @@ -41,10 +46,14 @@ msgid "" "tested on Linux, FreeBSD, and macOS (it is supposed to work on other POSIX " "platforms but it's not been thoroughly tested)." msgstr "" +"Η διαχείριση ψευδοτερματικού είναι εξαιρετικά εξαρτώμενη από την πλατφόρμα. " +"Αυτός ο κώδικας έχει δοκιμαστεί κυρίως σε Linux, FreeBSD και macOS " +"(υποτίθεται ότι λειτουργεί σε άλλες πλατφόρμες POSIX αλλά δεν έχει " +"δοκιμαστεί διεξοδώς)." #: library/pty.rst:25 msgid "The :mod:`pty` module defines the following functions:" -msgstr "" +msgstr "Το :mod:`pty` module ορίζει τις ακόλουθες λειτουργίες:" #: library/pty.rst:30 msgid "" @@ -54,12 +63,21 @@ msgid "" "a file descriptor connected to the child's controlling terminal (and also to " "the child's standard input and output)." msgstr "" +"Αντιγραφή. Συνδέστε το τερματικό ελέγχου του παιδιού σε ένα ψευδοτερματικό. " +"Η επιστρεφόμενη τιμή είναι ``(pid, fd)``. Σημειώστε ότι το παιδί λαμβάνει " +"*pid* 0, και το *fd* είναι *invalid*. Η επιστρεφόμενη τιμή του γονέα είναι " +"το *pid* του παιδιού, και το *fd* είναι ένας περιγραφέας αρχείου " +"συνδεδεμένος με το τερματικό ελέγχου του παιδιού (και επίσης με την τυπική " +"είσοδο και έξοδο του παιδιού)." #: library/pty.rst:36 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" +"Σε macOS η χρήση αυτής της λειτουργίας είναι μη ασφαλής όταν αναμιγνύεται με " +"τη χρήση ανώτερων συστημικών APIs, και αυτό περιλαμβάνει τη χρήση :mod:" +"`urllib.request`." #: library/pty.rst:42 msgid "" @@ -67,6 +85,10 @@ msgid "" "emulation code for generic Unix systems. Return a pair of file descriptors " "``(master, slave)``, for the master and the slave end, respectively." msgstr "" +"Ανοίξτε ένα νέο ζεύγος ψευδοτερματικών, χρησιμοποιώντας :func:`os.openpty` " +"αν είναι δυνατόν, ή κώδικα προσομοίωσης για γενικά συστήματα Unix. " +"Επιστρέφει ένα ζεύγος περιγραφέων αρχείων ``(master, slave)``, για το κύριο " +"και το δευτερεύον άκρο, αντίστοιχα." #: library/pty.rst:49 msgid "" @@ -76,6 +98,11 @@ msgid "" "spawned behind the pty will eventually terminate, and when it does *spawn* " "will return." msgstr "" +"Δημιουργήστε μια διαδικασία, και συνδέστε το τερματικό ελέγχου της με την " +"τυπική είσοδο/έξοδο της τρέχουσας διαδικασίας. Αυτό χρησιμοποιείται συχνά " +"για να αποπροσανατολίσει προγράμματα που επιμένουν να διαβάζουν από το " +"τερματικό ελέγχου. Αναμένεται ότι η διαδικασία που ξεκίνησε πίσω από το pty " +"θα τερματιστεί τελικά, και όταν το κάνει *spawn* θα επιστρέψει." #: library/pty.rst:55 msgid "" @@ -83,6 +110,9 @@ msgid "" "from the child to STDOUT of the current process. It is not signaled to the " "child if STDIN of the current process closes down." msgstr "" +"Ένας βρόχος αντιγράφει την STDIN της τρέχουσας διαδικασίας στο παιδί και τα " +"δεδομένα που λαμβάνονται από το παιδί στην STDOUT της τρέχουσας διαδικασίας. " +"Δεν ειδοποιείται το παιδί εάν η STDIN της τρέχουσας διαδικασίας κλείσει." #: library/pty.rst:59 msgid "" @@ -91,6 +121,11 @@ msgid "" "order to force spawn to return before the child process exits an empty byte " "array should be returned to signal end of file." msgstr "" +"Οι συναρτήσεις *master_read* και *stdin_read* λαμβάνουν έναν περιγραφέα " +"αρχείου από τον οποίο πρέπει να διαβάσουν, και θα πρέπει πάντα να " +"επιστρέφουν ένα byte string. Για να αναγκάσετε το spawn να επιστρέψει πριν " +"τερματιστεί η διαδικασία παιδί, θα πρέπει να επιστραφεί ένας κενός πίνακας " +"byte για να σηματοδοτήσει το τέλος του αρχείου." #: library/pty.rst:64 msgid "" @@ -100,6 +135,12 @@ msgid "" "child process, and *stdin_read* is passed file descriptor 0, to read from " "the parent process's standard input." msgstr "" +"Η προεπιλεγμένη υλοποίηση και για τις δύο συναρτήσεις θα διαβάσει και θα " +"επιστρέψει έως και 1024 bytes κάθε φορά που καλείται η συνάρτηση. Στην κλήση " +"*master_read* περνάει ο περιγραφέας αρχείου του κύριου ψευδοτερματικού για " +"να διαβάσει την έξοδο από τη διαδικασία παιδί, και στην *stdin_read* περνάει " +"ο περιγραφέας αρχείου 0, για να διαβάσει από την τυπική είσοδο της " +"διαδικασίας γονέα." #: library/pty.rst:70 msgid "" @@ -110,33 +151,48 @@ msgid "" "quit without any input, *spawn* will then loop forever. If *master_read* " "signals EOF the same behavior results (on linux at least)." msgstr "" +"Επιστροφή ενός κενό πίνακα byte από οποιαδήποτε κλήση ερμηνεύεται ως " +"κατάσταση τέλους-αρχείου (EOF), και αυτή η κλήση δεν θα κληθεί μετά από " +"αυτό. Εάν η *stdin_read* σηματοδοτήσει EOF, το τερματικό ελέγχου δεν μπορεί " +"πλέον να επικοινωνήσει με τη διαδικασία γονέα ή τη διαδικασία παιδί. Εκτός " +"εάν η διαδικασία παιδί θα τερματιστεί χωρίς καμία είσοδο, το *spawn* θα " +"συνεχίσει να εκτελείται επ' άπειρον. Εάν η *master_read* σηματοδοτήσει EOF, " +"προκύπτει η ίδια συμπεριφορά (τουλάχιστον στο linux)." #: library/pty.rst:77 msgid "" "Return the exit status value from :func:`os.waitpid` on the child process." msgstr "" +"Επιστρέφει την τιμή κατάστασης εξόδου από :func:`os.waitpid` στη διαδικασία " +"παιδί." #: library/pty.rst:79 msgid "" ":func:`os.waitstatus_to_exitcode` can be used to convert the exit status " "into an exit code." msgstr "" +"Η συνάρτηση :func:`os.waitstatus_to_exitcode` μπορεί να χρησιμοποιηθεί για " +"να μετατρέψει την κατάσταση εξόδου σε κωδικό εξόδου." #: library/pty.rst:82 msgid "" "Raises an :ref:`auditing event ` ``pty.spawn`` with argument " "``argv``." msgstr "" +"Κάνει raise ένα :ref:`auditing event ` ``pty.spawn`` με όρισμα " +"``argv``." #: library/pty.rst:84 msgid "" ":func:`spawn` now returns the status value from :func:`os.waitpid` on the " "child process." msgstr "" +"Η συνάρτηση :func:`spawn` τώρα επιστρέφει την τιμή κατάστασης από :func:`os." +"waitpid` στη διαδικασία παιδί." #: library/pty.rst:89 msgid "Example" -msgstr "" +msgstr "Παράδειγμα" #: library/pty.rst:93 msgid "" @@ -144,3 +200,70 @@ msgid "" "a pseudo-terminal to record all input and output of a terminal session in a " "\"typescript\". ::" msgstr "" +"Το ακόλουθο πρόγραμμα λειτουργεί όπως η εντολή Unix :manpage:`script(1)`, " +"χρησιμοποιώντας ένα ψευδοτερματικό για να καταγράψει όλη την είσοδο και " +"έξοδο μιας συνεδρίας τερματικού σε ένα \"typescript\". ::" + +#: library/pty.rst:97 +msgid "" +"import argparse\n" +"import os\n" +"import pty\n" +"import sys\n" +"import time\n" +"\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument('-a', dest='append', action='store_true')\n" +"parser.add_argument('-p', dest='use_python', action='store_true')\n" +"parser.add_argument('filename', nargs='?', default='typescript')\n" +"options = parser.parse_args()\n" +"\n" +"shell = sys.executable if options.use_python else os.environ.get('SHELL', " +"'sh')\n" +"filename = options.filename\n" +"mode = 'ab' if options.append else 'wb'\n" +"\n" +"with open(filename, mode) as script:\n" +" def read(fd):\n" +" data = os.read(fd, 1024)\n" +" script.write(data)\n" +" return data\n" +"\n" +" print('Script started, file is', filename)\n" +" script.write(('Script started on %s\\n' % time.asctime()).encode())\n" +"\n" +" pty.spawn(shell, read)\n" +"\n" +" script.write(('Script done on %s\\n' % time.asctime()).encode())\n" +" print('Script done, file is', filename)" +msgstr "" +"import argparse\n" +"import os\n" +"import pty\n" +"import sys\n" +"import time\n" +"\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument('-a', dest='append', action='store_true')\n" +"parser.add_argument('-p', dest='use_python', action='store_true')\n" +"parser.add_argument('filename', nargs='?', default='typescript')\n" +"options = parser.parse_args()\n" +"\n" +"shell = sys.executable if options.use_python else os.environ.get('SHELL', " +"'sh')\n" +"filename = options.filename\n" +"mode = 'ab' if options.append else 'wb'\n" +"\n" +"with open(filename, mode) as script:\n" +" def read(fd):\n" +" data = os.read(fd, 1024)\n" +" script.write(data)\n" +" return data\n" +"\n" +" print('Script started, file is', filename)\n" +" script.write(('Script started on %s\\n' % time.asctime()).encode())\n" +"\n" +" pty.spawn(shell, read)\n" +"\n" +" script.write(('Script done on %s\\n' % time.asctime()).encode())\n" +" print('Script done, file is', filename)" diff --git a/library/pwd.po b/library/pwd.po index 819e9a67..d0ef8d9e 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -8,27 +8,30 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-06-19 17:36+0300\n" +"PO-Revision-Date: 2025-12-07 12:23+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pwd.rst:2 -msgid ":mod:`pwd` --- The password database" -msgstr "" +msgid ":mod:`!pwd` --- The password database" +msgstr ":mod:`!pwd` --- Η βάση δεδομένων κωδικών πρόσβασης" #: library/pwd.rst:10 msgid "" "This module provides access to the Unix user account and password database. " "It is available on all Unix versions." msgstr "" +"Αυτό το module παρέχει πρόσβαση στη βάση δεδομένων λογαριασμών χρηστών και " +"κωδικών πρόσβασης του Unix. Είναι διαθέσιμο σε όλες τις εκδόσεις του Unix." #: library/pwd.rst:13 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -msgstr "" +msgid "Availability" +msgstr "Διαθεσιμότητα" #: library/pwd.rst:15 msgid "" @@ -36,158 +39,161 @@ msgid "" "attributes correspond to the members of the ``passwd`` structure (Attribute " "field below, see ````):" msgstr "" +"Οι εγγραφές της βάσης δεδομένων κωδικών πρόσβασης αναφέρονται ως ένα " +"αντικείμενο παρόμοιο με πλειάδα, του οποίου τα χαρακτηριστικά αντιστοιχούν " +"στα μέλη της δομής ``passwd`` (Πεδίο χαρακτηριστικού παρακάτω, δείτε ````):" #: library/pwd.rst:20 msgid "Index" -msgstr "" +msgstr "Δείκτης" #: library/pwd.rst:20 msgid "Attribute" -msgstr "" +msgstr "Χαρακτηριστικό" #: library/pwd.rst:20 msgid "Meaning" -msgstr "" +msgstr "Σημασία" #: library/pwd.rst:22 msgid "0" -msgstr "" +msgstr "0" #: library/pwd.rst:22 msgid "``pw_name``" -msgstr "" +msgstr "``pw_name``" #: library/pwd.rst:22 msgid "Login name" -msgstr "" +msgstr "Όνομα σύνδεσης" #: library/pwd.rst:24 msgid "1" -msgstr "" +msgstr "1" #: library/pwd.rst:24 msgid "``pw_passwd``" -msgstr "" +msgstr "``pw_passwd``" #: library/pwd.rst:24 msgid "Optional encrypted password" -msgstr "" +msgstr "Προαιρετικός κρυπτογραφημένος κωδικός πρόσβασης" #: library/pwd.rst:26 msgid "2" -msgstr "" +msgstr "2" #: library/pwd.rst:26 msgid "``pw_uid``" -msgstr "" +msgstr "``pw_uid``" #: library/pwd.rst:26 msgid "Numerical user ID" -msgstr "" +msgstr "Αριθμητικό αναγνωριστικό χρήστη" #: library/pwd.rst:28 msgid "3" -msgstr "" +msgstr "3" #: library/pwd.rst:28 msgid "``pw_gid``" -msgstr "" +msgstr "``pw_gid``" #: library/pwd.rst:28 msgid "Numerical group ID" -msgstr "" +msgstr "Αριθμητικό αναγνωριστικό γκρουπ" #: library/pwd.rst:30 msgid "4" -msgstr "" +msgstr "4" #: library/pwd.rst:30 msgid "``pw_gecos``" -msgstr "" +msgstr "``pw_gecos``" #: library/pwd.rst:30 msgid "User name or comment field" -msgstr "" +msgstr "Όνομα χρήστη ή πεδίο σχολίου" #: library/pwd.rst:32 msgid "5" -msgstr "" +msgstr "5" #: library/pwd.rst:32 msgid "``pw_dir``" -msgstr "" +msgstr "``pw_dir``" #: library/pwd.rst:32 msgid "User home directory" -msgstr "" +msgstr "Κατάλογος αρχικού καταλόγου χρήστη" #: library/pwd.rst:34 msgid "6" -msgstr "" +msgstr "6" #: library/pwd.rst:34 msgid "``pw_shell``" -msgstr "" +msgstr "``pw_shell``" #: library/pwd.rst:34 msgid "User command interpreter" -msgstr "" +msgstr "Διερμηνέας εντολών χρήστη" #: library/pwd.rst:37 msgid "" "The uid and gid items are integers, all others are strings. :exc:`KeyError` " "is raised if the entry asked for cannot be found." msgstr "" +"Τα στοιχεία uid και gid είναι ακέραιοι, όλα τα άλλα είναι συμβολοσειρές. :" +"exc:`KeyError` γίνεται raise εάν η ζητούμενη εγγραφή δεν μπορεί να βρεθεί." -#: library/pwd.rst:44 +#: library/pwd.rst:42 msgid "" "In traditional Unix the field ``pw_passwd`` usually contains a password " -"encrypted with a DES derived algorithm (see module :mod:`crypt`). However " -"most modern unices use a so-called *shadow password* system. On those " -"unices the *pw_passwd* field only contains an asterisk (``'*'``) or the " -"letter ``'x'`` where the encrypted password is stored in a file :file:`/etc/" -"shadow` which is not world readable. Whether the *pw_passwd* field contains " -"anything useful is system-dependent. If available, the :mod:`spwd` module " -"should be used where access to the encrypted password is required." -msgstr "" - -#: library/pwd.rst:53 +"encrypted with a DES derived algorithm. However most modern unices use a " +"so-called *shadow password* system. On those unices the *pw_passwd* field " +"only contains an asterisk (``'*'``) or the letter ``'x'`` where the " +"encrypted password is stored in a file :file:`/etc/shadow` which is not " +"world readable. Whether the *pw_passwd* field contains anything useful is " +"system-dependent." +msgstr "" +"Στο παραδοσιακό Unix, το πεδίο ``pw_passwd`` συνήθως περιέχει έναν κωδικό " +"πρόσβασης κρυπτογραφημένο με έναν αλγόριθμο που προέρχεται από το DES. " +"Ωστόσο, τα περισσότερα σύγχρονα unices χρησιμοποιούν ένα λεγόμενο σύστημα " +"*shadow password*. Σε αυτά τα unices, το πεδίο *pw_passwd* περιέχει μόνο " +"έναν αστερίσκο (``'*'``) ή το γράμμα ``'x'`` όπου ο κρυπτογραφημένος κωδικός " +"πρόσβασης αποθηκεύεται σε ένα αρχείο :file:`/etc/shadow` που δεν είναι " +"αναγνώσιμο από όλους. Το αν το πεδίο *pw_passwd* περιέχει κάτι χρήσιμο " +"εξαρτάται από το σύστημα." + +#: library/pwd.rst:50 msgid "It defines the following items:" -msgstr "" +msgstr "Ορίζει τα ακόλουθα στοιχεία:" -#: library/pwd.rst:58 +#: library/pwd.rst:55 msgid "Return the password database entry for the given numeric user ID." msgstr "" +"Επιστρέφει την εγγραφή της βάσης δεδομένων κωδικών πρόσβασης για το δεδομένο " +"αριθμητικό αναγνωριστικό χρήστη." -#: library/pwd.rst:63 +#: library/pwd.rst:60 msgid "Return the password database entry for the given user name." msgstr "" +"Επιστρέφει την εγγραφή της βάσης δεδομένων κωδικών πρόσβασης για το δεδομένο " +"όνομα χρήστη." -#: library/pwd.rst:68 +#: library/pwd.rst:65 msgid "" "Return a list of all available password database entries, in arbitrary order." msgstr "" +"Επιστρέφει μια λίστα με όλες τις διαθέσιμες εγγραφές της βάσης δεδομένων " +"κωδικών πρόσβασης, σε τυχαία σειρά." -#: library/pwd.rst:74 +#: library/pwd.rst:70 msgid "Module :mod:`grp`" -msgstr "" +msgstr "Module :mod:`grp`" -#: library/pwd.rst:74 +#: library/pwd.rst:71 msgid "An interface to the group database, similar to this." -msgstr "" - -#: library/pwd.rst:76 -msgid "Module :mod:`spwd`" -msgstr "" - -#: library/pwd.rst:77 -msgid "An interface to the shadow password database, similar to this." -msgstr "" - -#: library/pwd.rst:42 -msgid "module" -msgstr "" - -#: library/pwd.rst:42 -msgid "crypt" -msgstr "" +msgstr "Μια διεπαφή στη βάση δεδομένων ομάδων, παρόμοια με αυτή." diff --git a/library/py_compile.po b/library/py_compile.po index 99798ac6..8bdfe8a1 100644 --- a/library/py_compile.po +++ b/library/py_compile.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/py_compile.rst:2 -msgid ":mod:`py_compile` --- Compile Python source files" +msgid ":mod:`!py_compile` --- Compile Python source files" msgstr "" #: library/py_compile.rst:10 @@ -132,7 +133,7 @@ msgstr "" #: library/py_compile.rst:99 msgid "" -"A enumeration of possible methods the interpreter can use to determine " +"An enumeration of possible methods the interpreter can use to determine " "whether a bytecode file is up to date with a source file. The ``.pyc`` file " "indicates the desired invalidation mode in its header. See :ref:`pyc-" "invalidation` for more information on how Python invalidates ``.pyc`` files " diff --git a/library/pyclbr.po b/library/pyclbr.po index 43d70743..59fcee90 100644 --- a/library/pyclbr.po +++ b/library/pyclbr.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pyclbr.rst:2 -msgid ":mod:`pyclbr` --- Python module browser support" +msgid ":mod:`!pyclbr` --- Python module browser support" msgstr "" #: library/pyclbr.rst:9 @@ -141,7 +142,7 @@ msgid "The name of the class." msgstr "" #: library/pyclbr.rst:145 -msgid "For top-level classes, None. For nested classes, the parent." +msgid "For top-level classes, ``None``. For nested classes, the parent." msgstr "" #: library/pyclbr.rst:152 diff --git a/library/pydoc.po b/library/pydoc.po index f787c076..fda45c89 100644 --- a/library/pydoc.po +++ b/library/pydoc.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pydoc.rst:2 -msgid ":mod:`pydoc` --- Documentation generator and online help system" +msgid ":mod:`!pydoc` --- Documentation generator and online help system" msgstr "" #: library/pydoc.rst:10 @@ -26,7 +27,7 @@ msgstr "" #: library/pydoc.rst:19 msgid "" -"The :mod:`pydoc` module automatically generates documentation from Python " +"The :mod:`!pydoc` module automatically generates documentation from Python " "modules. The documentation can be presented as pages of text on the " "console, served to a web browser, or saved to HTML files." msgstr "" @@ -34,9 +35,9 @@ msgstr "" #: library/pydoc.rst:23 msgid "" "For modules, classes, functions and methods, the displayed documentation is " -"derived from the docstring (i.e. the :attr:`__doc__` attribute) of the " -"object, and recursively of its documentable members. If there is no " -"docstring, :mod:`pydoc` tries to obtain a description from the block of " +"derived from the docstring (i.e. the :attr:`~definition.__doc__` attribute) " +"of the object, and recursively of its documentable members. If there is no " +"docstring, :mod:`!pydoc` tries to obtain a description from the block of " "comment lines just above the definition of the class, function or method in " "the source file, or at the top of the module (see :func:`inspect." "getcomments`)." @@ -45,12 +46,16 @@ msgstr "" #: library/pydoc.rst:30 msgid "" "The built-in function :func:`help` invokes the online help system in the " -"interactive interpreter, which uses :mod:`pydoc` to generate its " +"interactive interpreter, which uses :mod:`!pydoc` to generate its " "documentation as text on the console. The same text documentation can also " "be viewed from outside the Python interpreter by running :program:`pydoc` as " "a script at the operating system's command prompt. For example, running ::" msgstr "" +#: library/pydoc.rst:36 +msgid "python -m pydoc sys" +msgstr "" + #: library/pydoc.rst:38 msgid "" "at a shell prompt will display documentation on the :mod:`sys` module, in a " @@ -65,7 +70,7 @@ msgstr "" #: library/pydoc.rst:49 msgid "" -"In order to find objects and their documentation, :mod:`pydoc` imports the " +"In order to find objects and their documentation, :mod:`!pydoc` imports the " "module(s) to be documented. Therefore, any code on module level will be " "executed on that occasion. Use an ``if __name__ == '__main__':`` guard to " "only execute code when a file is invoked as a script and not just imported." @@ -74,18 +79,19 @@ msgstr "" #: library/pydoc.rst:54 msgid "" "When printing output to the console, :program:`pydoc` attempts to paginate " -"the output for easier reading. If the :envvar:`PAGER` environment variable " -"is set, :program:`pydoc` will use its value as a pagination program." +"the output for easier reading. If either the :envvar:`MANPAGER` or the :" +"envvar:`PAGER` environment variable is set, :program:`pydoc` will use its " +"value as a pagination program. When both are set, :envvar:`MANPAGER` is used." msgstr "" -#: library/pydoc.rst:58 +#: library/pydoc.rst:59 msgid "" "Specifying a ``-w`` flag before the argument will cause HTML documentation " "to be written out to a file in the current directory, instead of displaying " "text on the console." msgstr "" -#: library/pydoc.rst:62 +#: library/pydoc.rst:63 msgid "" "Specifying a ``-k`` flag before the argument will search the synopsis lines " "of all available modules for the keyword given as the argument, again in a " @@ -93,7 +99,7 @@ msgid "" "module is the first line of its documentation string." msgstr "" -#: library/pydoc.rst:67 +#: library/pydoc.rst:68 msgid "" "You can also use :program:`pydoc` to start an HTTP server on the local " "machine that will serve documentation to visiting web browsers. :program:" @@ -103,7 +109,7 @@ msgid "" "arbitrary unused port." msgstr "" -#: library/pydoc.rst:73 +#: library/pydoc.rst:74 msgid "" ":program:`python -m pydoc -n ` will start the server listening at " "the given hostname. By default the hostname is 'localhost' but if you want " @@ -112,7 +118,7 @@ msgid "" "especially useful if you want to run pydoc from within a container." msgstr "" -#: library/pydoc.rst:79 +#: library/pydoc.rst:80 msgid "" ":program:`python -m pydoc -b` will start the server and additionally open a " "web browser to a module index page. Each served page has a navigation bar " @@ -121,7 +127,7 @@ msgid "" "*Topics* and *Keywords* pages." msgstr "" -#: library/pydoc.rst:85 +#: library/pydoc.rst:86 msgid "" "When :program:`pydoc` generates documentation, it uses the current " "environment and path to locate modules. Thus, invoking :program:`pydoc " @@ -129,30 +135,30 @@ msgid "" "started the Python interpreter and typed ``import spam``." msgstr "" -#: library/pydoc.rst:90 +#: library/pydoc.rst:91 msgid "" "Module docs for core modules are assumed to reside in ``https://docs.python." "org/X.Y/library/`` where ``X`` and ``Y`` are the major and minor version " "numbers of the Python interpreter. This can be overridden by setting the :" -"envvar:`PYTHONDOCS` environment variable to a different URL or to a local " +"envvar:`!PYTHONDOCS` environment variable to a different URL or to a local " "directory containing the Library Reference Manual pages." msgstr "" -#: library/pydoc.rst:97 +#: library/pydoc.rst:98 msgid "Added the ``-b`` option." msgstr "" -#: library/pydoc.rst:100 +#: library/pydoc.rst:101 msgid "The ``-g`` command line option was removed." msgstr "" -#: library/pydoc.rst:103 +#: library/pydoc.rst:104 msgid "" -":mod:`pydoc` now uses :func:`inspect.signature` rather than :func:`inspect." +":mod:`!pydoc` now uses :func:`inspect.signature` rather than :func:`inspect." "getfullargspec` to extract signature information from callables." msgstr "" -#: library/pydoc.rst:108 +#: library/pydoc.rst:109 msgid "Added the ``-n`` option." msgstr "" diff --git a/library/pyexpat.po b/library/pyexpat.po index 25f973b5..07fedc1b 100644 --- a/library/pyexpat.po +++ b/library/pyexpat.po @@ -8,26 +8,26 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/pyexpat.rst:2 -msgid ":mod:`xml.parsers.expat` --- Fast XML parsing using Expat" +msgid ":mod:`!xml.parsers.expat` --- Fast XML parsing using Expat" msgstr "" #: library/pyexpat.rst:21 msgid "" -"The :mod:`pyexpat` module is not secure against maliciously constructed " -"data. If you need to parse untrusted or unauthenticated data see :ref:`xml-" -"vulnerabilities`." +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." msgstr "" -#: library/pyexpat.rst:28 +#: library/pyexpat.rst:27 msgid "" "The :mod:`xml.parsers.expat` module is a Python interface to the Expat non-" "validating XML parser. The module provides a single extension type, :class:" @@ -38,39 +38,39 @@ msgid "" "in the XML document." msgstr "" -#: library/pyexpat.rst:38 +#: library/pyexpat.rst:37 msgid "" "This module uses the :mod:`pyexpat` module to provide access to the Expat " "parser. Direct use of the :mod:`pyexpat` module is deprecated." msgstr "" -#: library/pyexpat.rst:41 +#: library/pyexpat.rst:40 msgid "This module provides one exception and one type object:" msgstr "" -#: library/pyexpat.rst:46 +#: library/pyexpat.rst:45 msgid "" "The exception raised when Expat reports an error. See section :ref:" "`expaterror-objects` for more information on interpreting Expat errors." msgstr "" -#: library/pyexpat.rst:52 +#: library/pyexpat.rst:51 msgid "Alias for :exc:`ExpatError`." msgstr "" -#: library/pyexpat.rst:57 +#: library/pyexpat.rst:56 msgid "The type of the return values from the :func:`ParserCreate` function." msgstr "" -#: library/pyexpat.rst:59 +#: library/pyexpat.rst:58 msgid "The :mod:`xml.parsers.expat` module contains two functions:" msgstr "" -#: library/pyexpat.rst:64 +#: library/pyexpat.rst:63 msgid "Returns an explanatory string for a given error number *errno*." msgstr "" -#: library/pyexpat.rst:69 +#: library/pyexpat.rst:68 msgid "" "Creates and returns a new :class:`xmlparser` object. *encoding*, if " "specified, must be a string naming the encoding used by the XML data. " @@ -80,7 +80,15 @@ msgid "" "implicit or explicit encoding of the document." msgstr "" -#: library/pyexpat.rst:76 +#: library/pyexpat.rst:77 +msgid "" +"Parsers created through :func:`!ParserCreate` are called \"root\" parsers, " +"in the sense that they do not have any parent parser attached. Non-root " +"parsers are created by :meth:`parser.ExternalEntityParserCreate `." +msgstr "" + +#: library/pyexpat.rst:82 msgid "" "Expat can optionally do XML namespace processing for you, enabled by " "providing a value for *namespace_separator*. The value must be a one-" @@ -95,19 +103,36 @@ msgid "" "concatenated without any separator." msgstr "" -#: library/pyexpat.rst:88 +#: library/pyexpat.rst:94 msgid "" "For example, if *namespace_separator* is set to a space character (``' '``) " "and the following document is parsed:" msgstr "" -#: library/pyexpat.rst:100 +#: library/pyexpat.rst:97 +msgid "" +"\n" +"\n" +" \n" +" \n" +"" +msgstr "" + +#: library/pyexpat.rst:106 msgid "" ":attr:`StartElementHandler` will receive the following strings for each " "element::" msgstr "" -#: library/pyexpat.rst:107 +#: library/pyexpat.rst:109 +msgid "" +"http://default-namespace.org/ root\n" +"http://www.python.org/ns/ elem1\n" +"elem2" +msgstr "" + +#: library/pyexpat.rst:113 msgid "" "Due to limitations in the ``Expat`` library used by :mod:`pyexpat`, the :" "class:`xmlparser` instance returned can only be used to parse a single XML " @@ -115,23 +140,23 @@ msgid "" "instances." msgstr "" -#: library/pyexpat.rst:115 +#: library/pyexpat.rst:121 msgid "`The Expat XML Parser `_" msgstr "" -#: library/pyexpat.rst:116 +#: library/pyexpat.rst:122 msgid "Home page of the Expat project." msgstr "" -#: library/pyexpat.rst:122 +#: library/pyexpat.rst:128 msgid "XMLParser Objects" msgstr "" -#: library/pyexpat.rst:124 +#: library/pyexpat.rst:130 msgid ":class:`xmlparser` objects have the following methods:" msgstr "" -#: library/pyexpat.rst:129 +#: library/pyexpat.rst:135 msgid "" "Parses the contents of the string *data*, calling the appropriate handler " "functions to process the parsed data. *isfinal* must be true on the final " @@ -140,14 +165,14 @@ msgid "" "time." msgstr "" -#: library/pyexpat.rst:138 +#: library/pyexpat.rst:144 msgid "" "Parse XML data reading from the object *file*. *file* only needs to provide " "the ``read(nbytes)`` method, returning the empty string when there's no more " "data." msgstr "" -#: library/pyexpat.rst:145 +#: library/pyexpat.rst:151 msgid "" "Sets the base to be used for resolving relative URIs in system identifiers " "in declarations. Resolving relative identifiers is left to the application: " @@ -156,20 +181,20 @@ msgid "" "`UnparsedEntityDeclHandler` functions." msgstr "" -#: library/pyexpat.rst:154 +#: library/pyexpat.rst:160 msgid "" "Returns a string containing the base set by a previous call to :meth:" "`SetBase`, or ``None`` if :meth:`SetBase` hasn't been called." msgstr "" -#: library/pyexpat.rst:160 +#: library/pyexpat.rst:166 msgid "" "Returns the input data that generated the current event as a string. The " "data is in the encoding of the entity which contains the text. When called " "while an event handler is not active, the return value is ``None``." msgstr "" -#: library/pyexpat.rst:167 +#: library/pyexpat.rst:173 msgid "" "Create a \"child\" parser which can be used to parse an external parsed " "entity referred to by content parsed by the parent parser. The *context* " @@ -179,7 +204,7 @@ msgid "" "`specified_attributes` set to the values of this parser." msgstr "" -#: library/pyexpat.rst:176 +#: library/pyexpat.rst:182 msgid "" "Control parsing of parameter entities (including the external DTD subset). " "Possible *flag* values are :const:`XML_PARAM_ENTITY_PARSING_NEVER`, :const:" @@ -188,7 +213,7 @@ msgid "" "successful." msgstr "" -#: library/pyexpat.rst:184 +#: library/pyexpat.rst:190 msgid "" "Calling this with a true value for *flag* (the default) will cause Expat to " "call the :attr:`ExternalEntityRefHandler` with :const:`None` for all " @@ -198,13 +223,13 @@ msgid "" "`EndDoctypeDeclHandler` will not be called." msgstr "" -#: library/pyexpat.rst:191 +#: library/pyexpat.rst:197 msgid "" "Passing a false value for *flag* will cancel a previous call that passed a " "true value, but otherwise has no effect." msgstr "" -#: library/pyexpat.rst:194 +#: library/pyexpat.rst:200 msgid "" "This method can only be called before the :meth:`Parse` or :meth:`ParseFile` " "methods are called; calling it after either of those have been called " @@ -212,14 +237,14 @@ msgid "" "``errors.codes[errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING]``." msgstr "" -#: library/pyexpat.rst:203 +#: library/pyexpat.rst:209 msgid "" "Calling ``SetReparseDeferralEnabled(False)`` has security implications, as " "detailed below; please make sure to understand these consequences prior to " "using the ``SetReparseDeferralEnabled`` method." msgstr "" -#: library/pyexpat.rst:207 +#: library/pyexpat.rst:213 msgid "" "Expat 2.6.0 introduced a security mechanism called \"reparse deferral\" " "where instead of causing denial of service through quadratic runtime from " @@ -227,14 +252,14 @@ msgid "" "default until a sufficient amount of input is reached. Due to this delay, " "registered handlers may — depending of the sizing of input chunks pushed to " "Expat — no longer be called right after pushing new input to the parser. " -"Where immediate feedback and taking over responsiblity of protecting against " -"denial of service from large tokens are both wanted, calling " +"Where immediate feedback and taking over responsibility of protecting " +"against denial of service from large tokens are both wanted, calling " "``SetReparseDeferralEnabled(False)`` disables reparse deferral for the " "current Expat parser instance, temporarily or altogether. Calling " "``SetReparseDeferralEnabled(True)`` allows re-enabling reparse deferral." msgstr "" -#: library/pyexpat.rst:220 +#: library/pyexpat.rst:226 msgid "" "Note that :meth:`SetReparseDeferralEnabled` has been backported to some " "prior releases of CPython as a security fix. Check for availability of :" @@ -242,24 +267,90 @@ msgid "" "running across a variety of Python versions." msgstr "" -#: library/pyexpat.rst:229 +#: library/pyexpat.rst:235 msgid "" "Returns whether reparse deferral is currently enabled for the given Expat " "parser instance." msgstr "" -#: library/pyexpat.rst:235 +#: library/pyexpat.rst:241 +msgid "" +":class:`!xmlparser` objects have the following methods to mitigate some " +"common XML vulnerabilities." +msgstr "" + +#: library/pyexpat.rst:246 +msgid "" +"Sets the number of allocated bytes of dynamic memory needed to activate " +"protection against disproportionate use of RAM." +msgstr "" + +#: library/pyexpat.rst:249 +msgid "" +"By default, parser objects have an allocation activation threshold of 64 " +"MiB, or equivalently 67,108,864 bytes." +msgstr "" + +#: library/pyexpat.rst:252 +msgid "" +"An :exc:`ExpatError` is raised if this method is called on a |xml-non-root-" +"parser| parser. The corresponding :attr:`~ExpatError.lineno` and :attr:" +"`~ExpatError.offset` should not be used as they may have no special meaning." +msgstr "" + +#: library/pyexpat.rst:261 +msgid "" +"Sets the maximum amplification factor between direct input and bytes of " +"dynamic memory allocated." +msgstr "" + +#: library/pyexpat.rst:264 +msgid "" +"The amplification factor is calculated as ``allocated / direct`` while " +"parsing, where ``direct`` is the number of bytes read from the primary " +"document in parsing and ``allocated`` is the number of bytes of dynamic " +"memory allocated in the parser hierarchy." +msgstr "" + +#: library/pyexpat.rst:269 +msgid "" +"The *max_factor* value must be a non-NaN :class:`float` value greater than " +"or equal to 1.0. Amplification factors greater than 100.0 can be observed " +"near the start of parsing even with benign files in practice. In particular, " +"the activation threshold should be carefully chosen to avoid false positives." +msgstr "" + +#: library/pyexpat.rst:274 +msgid "" +"By default, parser objects have a maximum amplification factor of 100.0." +msgstr "" + +#: library/pyexpat.rst:276 +msgid "" +"An :exc:`ExpatError` is raised if this method is called on a |xml-non-root-" +"parser| parser or if *max_factor* is outside the valid range. The " +"corresponding :attr:`~ExpatError.lineno` and :attr:`~ExpatError.offset` " +"should not be used as they may have no special meaning." +msgstr "" + +#: library/pyexpat.rst:283 +msgid "" +"The maximum amplification factor is only considered if the threshold that " +"can be adjusted by :meth:`.SetAllocTrackerActivationThreshold` is exceeded." +msgstr "" + +#: library/pyexpat.rst:290 msgid ":class:`xmlparser` objects have the following attributes:" msgstr "" -#: library/pyexpat.rst:240 +#: library/pyexpat.rst:295 msgid "" "The size of the buffer used when :attr:`buffer_text` is true. A new buffer " "size can be set by assigning a new integer value to this attribute. When the " "size is changed, the buffer will be flushed." msgstr "" -#: library/pyexpat.rst:248 +#: library/pyexpat.rst:303 msgid "" "Setting this to true causes the :class:`xmlparser` object to buffer textual " "content returned by Expat to avoid multiple calls to the :meth:" @@ -270,14 +361,14 @@ msgid "" "newlines may be chunked too." msgstr "" -#: library/pyexpat.rst:259 +#: library/pyexpat.rst:314 msgid "" "If :attr:`buffer_text` is enabled, the number of bytes stored in the buffer. " "These bytes represent UTF-8 encoded text. This attribute has no meaningful " "interpretation when :attr:`buffer_text` is false." msgstr "" -#: library/pyexpat.rst:266 +#: library/pyexpat.rst:321 msgid "" "Setting this attribute to a non-zero integer causes the attributes to be " "reported as a list rather than a dictionary. The attributes are presented " @@ -287,7 +378,7 @@ msgid "" "is false; it may be changed at any time." msgstr "" -#: library/pyexpat.rst:276 +#: library/pyexpat.rst:331 msgid "" "If set to a non-zero integer, the parser will report only those attributes " "which were specified in the document instance and not those which were " @@ -298,7 +389,7 @@ msgid "" "time." msgstr "" -#: library/pyexpat.rst:284 +#: library/pyexpat.rst:339 msgid "" "The following attributes contain values relating to the most recent error " "encountered by an :class:`xmlparser` object, and will only have correct " @@ -306,26 +397,26 @@ msgid "" "`xml.parsers.expat.ExpatError` exception." msgstr "" -#: library/pyexpat.rst:292 +#: library/pyexpat.rst:347 msgid "Byte index at which an error occurred." msgstr "" -#: library/pyexpat.rst:297 +#: library/pyexpat.rst:352 msgid "" "Numeric code specifying the problem. This value can be passed to the :func:" "`ErrorString` function, or compared to one of the constants defined in the " "``errors`` object." msgstr "" -#: library/pyexpat.rst:304 +#: library/pyexpat.rst:359 msgid "Column number at which an error occurred." msgstr "" -#: library/pyexpat.rst:309 +#: library/pyexpat.rst:364 msgid "Line number at which an error occurred." msgstr "" -#: library/pyexpat.rst:311 +#: library/pyexpat.rst:366 msgid "" "The following attributes contain values relating to the current parse " "location in an :class:`xmlparser` object. During a callback reporting a " @@ -335,19 +426,19 @@ msgid "" "whether there was an associated callback)." msgstr "" -#: library/pyexpat.rst:321 +#: library/pyexpat.rst:376 msgid "Current byte index in the parser input." msgstr "" -#: library/pyexpat.rst:326 +#: library/pyexpat.rst:381 msgid "Current column number in the parser input." msgstr "" -#: library/pyexpat.rst:331 +#: library/pyexpat.rst:386 msgid "Current line number in the parser input." msgstr "" -#: library/pyexpat.rst:333 +#: library/pyexpat.rst:388 msgid "" "Here is the list of handlers that can be set. To set a handler on an :class:" "`xmlparser` object *o*, use ``o.handlername = func``. *handlername* must be " @@ -356,7 +447,7 @@ msgid "" "unless otherwise stated." msgstr "" -#: library/pyexpat.rst:342 +#: library/pyexpat.rst:397 msgid "" "Called when the XML declaration is parsed. The XML declaration is the " "(optional) declaration of the applicable version of the XML recommendation, " @@ -367,7 +458,7 @@ msgid "" "only available with Expat version 1.95.0 or newer." msgstr "" -#: library/pyexpat.rst:353 +#: library/pyexpat.rst:408 msgid "" "Called when Expat begins parsing the document type declaration (``'``." msgstr "" -#: library/pyexpat.rst:470 +#: library/pyexpat.rst:525 msgid "" "Called at the start of a CDATA section. This and :attr:" "`EndCdataSectionHandler` are needed to be able to identify the syntactical " "start and end for CDATA sections." msgstr "" -#: library/pyexpat.rst:477 +#: library/pyexpat.rst:532 msgid "Called at the end of a CDATA section." msgstr "" -#: library/pyexpat.rst:482 +#: library/pyexpat.rst:537 msgid "" "Called for any characters in the XML document for which no applicable " "handler has been specified. This means characters that are part of a " @@ -501,14 +592,14 @@ msgid "" "supplied." msgstr "" -#: library/pyexpat.rst:489 +#: library/pyexpat.rst:544 msgid "" "This is the same as the :func:`DefaultHandler`, but doesn't inhibit " "expansion of internal entities. The entity reference will not be passed to " "the default handler." msgstr "" -#: library/pyexpat.rst:496 +#: library/pyexpat.rst:551 msgid "" "Called if the XML document hasn't been declared as being a standalone " "document. This happens when there is an external subset or a reference to a " @@ -518,7 +609,16 @@ msgid "" "set, no exception is raised by the parser for this condition." msgstr "" -#: library/pyexpat.rst:506 +#: library/pyexpat.rst:563 +msgid "" +"Implementing a handler that accesses local files and/or the network may " +"create a vulnerability to `external entity attacks `_ if :class:`xmlparser` is used with user-" +"provided XML content. Please reflect on your `threat model `_ before implementing this handler." +msgstr "" + +#: library/pyexpat.rst:570 msgid "" "Called for references to external entities. *base* is the current base, as " "set by a previous call to :meth:`SetBase`. The public and system " @@ -527,7 +627,7 @@ msgid "" "is opaque and should only be used as described below." msgstr "" -#: library/pyexpat.rst:512 +#: library/pyexpat.rst:576 msgid "" "For external entities to be parsed, this handler must be implemented. It is " "responsible for creating the sub-parser using " @@ -537,130 +637,179 @@ msgid "" "`XML_ERROR_EXTERNAL_ENTITY_HANDLING` error, otherwise parsing will continue." msgstr "" -#: library/pyexpat.rst:520 +#: library/pyexpat.rst:584 msgid "" "If this handler is not provided, external entities are reported by the :attr:" "`DefaultHandler` callback, if provided." msgstr "" -#: library/pyexpat.rst:527 +#: library/pyexpat.rst:591 msgid "ExpatError Exceptions" msgstr "" -#: library/pyexpat.rst:532 +#: library/pyexpat.rst:596 msgid ":exc:`ExpatError` exceptions have a number of interesting attributes:" msgstr "" -#: library/pyexpat.rst:537 +#: library/pyexpat.rst:601 msgid "" "Expat's internal error number for the specific error. The :data:`errors." "messages ` dictionary maps these error " "numbers to Expat's error messages. For example::" msgstr "" -#: library/pyexpat.rst:549 +#: library/pyexpat.rst:605 +msgid "" +"from xml.parsers.expat import ParserCreate, ExpatError, errors\n" +"\n" +"p = ParserCreate()\n" +"try:\n" +" p.Parse(some_xml_document)\n" +"except ExpatError as err:\n" +" print(\"Error:\", errors.messages[err.code])" +msgstr "" + +#: library/pyexpat.rst:613 msgid "" "The :mod:`~xml.parsers.expat.errors` module also provides error message " "constants and a dictionary :data:`~xml.parsers.expat.errors.codes` mapping " "these messages back to the error codes, see below." msgstr "" -#: library/pyexpat.rst:556 +#: library/pyexpat.rst:620 msgid "" "Line number on which the error was detected. The first line is numbered " "``1``." msgstr "" -#: library/pyexpat.rst:561 +#: library/pyexpat.rst:625 msgid "" "Character offset into the line where the error occurred. The first column " "is numbered ``0``." msgstr "" -#: library/pyexpat.rst:568 +#: library/pyexpat.rst:632 msgid "Example" msgstr "" -#: library/pyexpat.rst:570 +#: library/pyexpat.rst:634 msgid "" "The following program defines three handlers that just print out their " "arguments. ::" msgstr "" -#: library/pyexpat.rst:594 +#: library/pyexpat.rst:637 +msgid "" +"import xml.parsers.expat\n" +"\n" +"# 3 handler functions\n" +"def start_element(name, attrs):\n" +" print('Start element:', name, attrs)\n" +"def end_element(name):\n" +" print('End element:', name)\n" +"def char_data(data):\n" +" print('Character data:', repr(data))\n" +"\n" +"p = xml.parsers.expat.ParserCreate()\n" +"\n" +"p.StartElementHandler = start_element\n" +"p.EndElementHandler = end_element\n" +"p.CharacterDataHandler = char_data\n" +"\n" +"p.Parse(\"\"\"\n" +"Text goes here\n" +"More text\n" +"\"\"\", 1)" +msgstr "" + +#: library/pyexpat.rst:658 msgid "The output from this program is::" msgstr "" -#: library/pyexpat.rst:611 +#: library/pyexpat.rst:660 +msgid "" +"Start element: parent {'id': 'top'}\n" +"Start element: child1 {'name': 'paul'}\n" +"Character data: 'Text goes here'\n" +"End element: child1\n" +"Character data: '\\n'\n" +"Start element: child2 {'name': 'fred'}\n" +"Character data: 'More text'\n" +"End element: child2\n" +"Character data: '\\n'\n" +"End element: parent" +msgstr "" + +#: library/pyexpat.rst:675 msgid "Content Model Descriptions" msgstr "" -#: library/pyexpat.rst:617 +#: library/pyexpat.rst:681 msgid "" "Content models are described using nested tuples. Each tuple contains four " "values: the type, the quantifier, the name, and a tuple of children. " "Children are simply additional content model descriptions." msgstr "" -#: library/pyexpat.rst:621 +#: library/pyexpat.rst:685 msgid "" "The values of the first two fields are constants defined in the :mod:`xml." "parsers.expat.model` module. These constants can be collected in two " "groups: the model type group and the quantifier group." msgstr "" -#: library/pyexpat.rst:625 +#: library/pyexpat.rst:689 msgid "The constants in the model type group are:" msgstr "" -#: library/pyexpat.rst:631 +#: library/pyexpat.rst:695 msgid "" "The element named by the model name was declared to have a content model of " "``ANY``." msgstr "" -#: library/pyexpat.rst:638 +#: library/pyexpat.rst:702 msgid "" "The named element allows a choice from a number of options; this is used for " "content models such as ``(A | B | C)``." msgstr "" -#: library/pyexpat.rst:645 +#: library/pyexpat.rst:709 msgid "Elements which are declared to be ``EMPTY`` have this model type." msgstr "" -#: library/pyexpat.rst:659 +#: library/pyexpat.rst:723 msgid "" "Models which represent a series of models which follow one after the other " "are indicated with this model type. This is used for models such as ``(A, " "B, C)``." msgstr "" -#: library/pyexpat.rst:662 +#: library/pyexpat.rst:726 msgid "The constants in the quantifier group are:" msgstr "" -#: library/pyexpat.rst:668 +#: library/pyexpat.rst:732 msgid "No modifier is given, so it can appear exactly once, as for ``A``." msgstr "" -#: library/pyexpat.rst:674 +#: library/pyexpat.rst:738 msgid "The model is optional: it can appear once or not at all, as for ``A?``." msgstr "" -#: library/pyexpat.rst:680 +#: library/pyexpat.rst:744 msgid "The model must occur one or more times (like ``A+``)." msgstr "" -#: library/pyexpat.rst:686 +#: library/pyexpat.rst:750 msgid "The model must occur zero or more times, as for ``A*``." msgstr "" -#: library/pyexpat.rst:692 +#: library/pyexpat.rst:756 msgid "Expat error constants" msgstr "" -#: library/pyexpat.rst:696 +#: library/pyexpat.rst:760 msgid "" "The following constants are provided in the :mod:`xml.parsers.expat.errors` " "module. These constants are useful in interpreting some of the attributes " @@ -671,205 +820,209 @@ msgid "" "XML_ERROR_{CONSTANT_NAME}]`." msgstr "" -#: library/pyexpat.rst:704 +#: library/pyexpat.rst:768 msgid "The ``errors`` module has the following attributes:" msgstr "" -#: library/pyexpat.rst:708 +#: library/pyexpat.rst:772 msgid "A dictionary mapping string descriptions to their error codes." msgstr "" -#: library/pyexpat.rst:715 +#: library/pyexpat.rst:779 msgid "A dictionary mapping numeric error codes to their string descriptions." msgstr "" -#: library/pyexpat.rst:725 +#: library/pyexpat.rst:789 msgid "" "An entity reference in an attribute value referred to an external entity " "instead of an internal entity." msgstr "" -#: library/pyexpat.rst:731 +#: library/pyexpat.rst:795 msgid "" "A character reference referred to a character which is illegal in XML (for " "example, character ``0``, or '``�``')." msgstr "" -#: library/pyexpat.rst:737 +#: library/pyexpat.rst:801 msgid "" "An entity reference referred to an entity which was declared with a " "notation, so cannot be parsed." msgstr "" -#: library/pyexpat.rst:743 +#: library/pyexpat.rst:807 msgid "An attribute was used more than once in a start tag." msgstr "" -#: library/pyexpat.rst:751 +#: library/pyexpat.rst:815 msgid "" "Raised when an input byte could not properly be assigned to a character; for " "example, a NUL byte (value ``0``) in a UTF-8 input stream." msgstr "" -#: library/pyexpat.rst:757 +#: library/pyexpat.rst:821 msgid "Something other than whitespace occurred after the document element." msgstr "" -#: library/pyexpat.rst:762 +#: library/pyexpat.rst:826 msgid "" "An XML declaration was found somewhere other than the start of the input " "data." msgstr "" -#: library/pyexpat.rst:767 +#: library/pyexpat.rst:831 msgid "" "The document contains no elements (XML requires all documents to contain " "exactly one top-level element).." msgstr "" -#: library/pyexpat.rst:773 +#: library/pyexpat.rst:837 msgid "Expat was not able to allocate memory internally." msgstr "" -#: library/pyexpat.rst:778 +#: library/pyexpat.rst:842 msgid "A parameter entity reference was found where it was not allowed." msgstr "" -#: library/pyexpat.rst:783 +#: library/pyexpat.rst:847 msgid "An incomplete character was found in the input." msgstr "" -#: library/pyexpat.rst:788 +#: library/pyexpat.rst:852 msgid "" "An entity reference contained another reference to the same entity; possibly " "via a different name, and possibly indirectly." msgstr "" -#: library/pyexpat.rst:794 +#: library/pyexpat.rst:858 msgid "Some unspecified syntax error was encountered." msgstr "" -#: library/pyexpat.rst:799 +#: library/pyexpat.rst:863 msgid "An end tag did not match the innermost open start tag." msgstr "" -#: library/pyexpat.rst:804 +#: library/pyexpat.rst:868 msgid "" "Some token (such as a start tag) was not closed before the end of the stream " "or the next token was encountered." msgstr "" -#: library/pyexpat.rst:810 +#: library/pyexpat.rst:874 msgid "A reference was made to an entity which was not defined." msgstr "" -#: library/pyexpat.rst:815 +#: library/pyexpat.rst:879 msgid "The document encoding is not supported by Expat." msgstr "" -#: library/pyexpat.rst:820 +#: library/pyexpat.rst:884 msgid "A CDATA marked section was not closed." msgstr "" -#: library/pyexpat.rst:828 +#: library/pyexpat.rst:892 msgid "" "The parser determined that the document was not \"standalone\" though it " "declared itself to be in the XML declaration, and the :attr:" "`NotStandaloneHandler` was set and returned ``0``." msgstr "" -#: library/pyexpat.rst:841 +#: library/pyexpat.rst:905 msgid "" "An operation was requested that requires DTD support to be compiled in, but " "Expat was configured without DTD support. This should never be reported by " "a standard build of the :mod:`xml.parsers.expat` module." msgstr "" -#: library/pyexpat.rst:848 +#: library/pyexpat.rst:912 msgid "" "A behavioral change was requested after parsing started that can only be " "changed before parsing has started. This is (currently) only raised by :" "meth:`UseForeignDTD`." msgstr "" -#: library/pyexpat.rst:855 +#: library/pyexpat.rst:919 msgid "An undeclared prefix was found when namespace processing was enabled." msgstr "" -#: library/pyexpat.rst:860 +#: library/pyexpat.rst:924 msgid "" "The document attempted to remove the namespace declaration associated with a " "prefix." msgstr "" -#: library/pyexpat.rst:866 +#: library/pyexpat.rst:930 msgid "A parameter entity contained incomplete markup." msgstr "" -#: library/pyexpat.rst:871 +#: library/pyexpat.rst:935 msgid "The document contained no document element at all." msgstr "" -#: library/pyexpat.rst:876 +#: library/pyexpat.rst:940 msgid "There was an error parsing a text declaration in an external entity." msgstr "" -#: library/pyexpat.rst:881 +#: library/pyexpat.rst:945 msgid "Characters were found in the public id that are not allowed." msgstr "" -#: library/pyexpat.rst:886 +#: library/pyexpat.rst:950 msgid "" "The requested operation was made on a suspended parser, but isn't allowed. " "This includes attempts to provide additional input or to stop the parser." msgstr "" -#: library/pyexpat.rst:892 +#: library/pyexpat.rst:956 msgid "" "An attempt to resume the parser was made when the parser had not been " "suspended." msgstr "" -#: library/pyexpat.rst:930 library/pyexpat.rst:935 +#: library/pyexpat.rst:994 library/pyexpat.rst:999 msgid "This should not be reported to Python applications." msgstr "" -#: library/pyexpat.rst:902 +#: library/pyexpat.rst:966 msgid "" "The requested operation was made on a parser which was finished parsing " "input, but isn't allowed. This includes attempts to provide additional " "input or to stop the parser." msgstr "" -#: library/pyexpat.rst:912 +#: library/pyexpat.rst:976 msgid "" "An attempt was made to undeclare reserved namespace prefix ``xml`` or to " "bind it to another namespace URI." msgstr "" -#: library/pyexpat.rst:919 +#: library/pyexpat.rst:983 msgid "" "An attempt was made to declare or undeclare reserved namespace prefix " "``xmlns``." msgstr "" -#: library/pyexpat.rst:924 +#: library/pyexpat.rst:988 msgid "" "An attempt was made to bind the URI of one the reserved namespace prefixes " "``xml`` and ``xmlns`` to another namespace prefix." msgstr "" -#: library/pyexpat.rst:940 +#: library/pyexpat.rst:1004 msgid "" "The limit on input amplification factor (from DTD and entities) has been " "breached." msgstr "" -#: library/pyexpat.rst:945 +#: library/pyexpat.rst:1010 +msgid "The parser was tried to be stopped or suspended before it started." +msgstr "" + +#: library/pyexpat.rst:1016 msgid "Footnotes" msgstr "" -#: library/pyexpat.rst:946 +#: library/pyexpat.rst:1017 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See https://" @@ -877,14 +1030,14 @@ msgid "" "org/assignments/character-sets/character-sets.xhtml." msgstr "" -#: library/pyexpat.rst:26 +#: library/pyexpat.rst:25 msgid "Expat" msgstr "" -#: library/pyexpat.rst:36 +#: library/pyexpat.rst:35 msgid "module" msgstr "" -#: library/pyexpat.rst:36 +#: library/pyexpat.rst:35 msgid "pyexpat" msgstr "" diff --git a/library/python.po b/library/python.po index 435d40be..a4109e9d 100644 --- a/library/python.po +++ b/library/python.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -26,3 +27,9 @@ msgid "" "related to the Python interpreter and its interaction with its environment. " "Here's an overview:" msgstr "" + +#: library/python.rst:33 +msgid "" +"See the :mod:`concurrent.interpreters` module, which similarly exposes core " +"runtime functionality." +msgstr "" diff --git a/library/queue.po b/library/queue.po index a3010335..cecd2e2c 100644 --- a/library/queue.po +++ b/library/queue.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/queue.rst:2 -msgid ":mod:`queue` --- A synchronized queue class" +msgid ":mod:`!queue` --- A synchronized queue class" msgstr "" #: library/queue.rst:7 @@ -101,6 +102,17 @@ msgid "" "class that ignores the data item and only compares the priority number::" msgstr "" +#: library/queue.rst:66 +msgid "" +"from dataclasses import dataclass, field\n" +"from typing import Any\n" +"\n" +"@dataclass(order=True)\n" +"class PrioritizedItem:\n" +" priority: int\n" +" item: Any=field(compare=False)" +msgstr "" + #: library/queue.rst:76 msgid "" "Constructor for an unbounded :abbr:`FIFO (first-in, first-out)` queue. " @@ -119,24 +131,30 @@ msgid "" "put_nowait`) is called on a :class:`Queue` object which is full." msgstr "" -#: library/queue.rst:99 +#: library/queue.rst:98 +msgid "" +"Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " +"a :class:`Queue` object which has been shut down." +msgstr "" + +#: library/queue.rst:107 msgid "Queue Objects" msgstr "" -#: library/queue.rst:101 +#: library/queue.rst:109 msgid "" "Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:" "`PriorityQueue`) provide the public methods described below." msgstr "" -#: library/queue.rst:107 +#: library/queue.rst:115 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block, nor will qsize() < maxsize " "guarantee that put() will not block." msgstr "" -#: library/queue.rst:114 +#: library/queue.rst:122 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``True`` it doesn't guarantee that a subsequent call to put() will " @@ -144,7 +162,7 @@ msgid "" "that a subsequent call to get() will not block." msgstr "" -#: library/queue.rst:122 +#: library/queue.rst:130 msgid "" "Return ``True`` if the queue is full, ``False`` otherwise. If full() " "returns ``True`` it doesn't guarantee that a subsequent call to get() will " @@ -152,7 +170,7 @@ msgid "" "a subsequent call to put() will not block." msgstr "" -#: library/queue.rst:130 +#: library/queue.rst:138 msgid "" "Put *item* into the queue. If optional args *block* is true and *timeout* " "is ``None`` (the default), block if necessary until a free slot is " @@ -163,11 +181,15 @@ msgid "" "(*timeout* is ignored in that case)." msgstr "" -#: library/queue.rst:141 +#: library/queue.rst:146 +msgid "Raises :exc:`ShutDown` if the queue has been shut down." +msgstr "" + +#: library/queue.rst:151 msgid "Equivalent to ``put(item, block=False)``." msgstr "" -#: library/queue.rst:258 +#: library/queue.rst:314 msgid "" "Remove and return an item from the queue. If optional args *block* is true " "and *timeout* is ``None`` (the default), block if necessary until an item is " @@ -178,7 +200,7 @@ msgid "" "ignored in that case)." msgstr "" -#: library/queue.rst:153 +#: library/queue.rst:163 msgid "" "Prior to 3.0 on POSIX systems, and for all versions on Windows, if *block* " "is true and *timeout* is ``None``, this operation goes into an " @@ -187,41 +209,47 @@ msgid "" "`KeyboardInterrupt`." msgstr "" -#: library/queue.rst:268 +#: library/queue.rst:168 +msgid "" +"Raises :exc:`ShutDown` if the queue has been shut down and is empty, or if " +"the queue has been shut down immediately." +msgstr "" + +#: library/queue.rst:324 msgid "Equivalent to ``get(False)``." msgstr "" -#: library/queue.rst:163 +#: library/queue.rst:176 msgid "" "Two methods are offered to support tracking whether enqueued tasks have been " "fully processed by daemon consumer threads." msgstr "" -#: library/queue.rst:169 +#: library/queue.rst:182 msgid "" "Indicate that a formerly enqueued task is complete. Used by queue consumer " "threads. For each :meth:`get` used to fetch a task, a subsequent call to :" "meth:`task_done` tells the queue that the processing on the task is complete." msgstr "" -#: library/queue.rst:173 +#: library/queue.rst:186 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " "item that had been :meth:`put` into the queue)." msgstr "" -#: library/queue.rst:177 +#: library/queue.rst:190 msgid "" "Raises a :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "" -#: library/queue.rst:183 +#: library/queue.rst:196 msgid "Blocks until all items in the queue have been gotten and processed." msgstr "" -#: library/queue.rst:185 +#: library/queue.rst:198 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer thread calls :meth:" @@ -230,33 +258,118 @@ msgid "" "unblocks." msgstr "" -#: library/queue.rst:191 +#: library/queue.rst:205 +msgid "Waiting for task completion" +msgstr "" + +#: library/queue.rst:207 msgid "Example of how to wait for enqueued tasks to be completed::" msgstr "" -#: library/queue.rst:218 +#: library/queue.rst:209 +msgid "" +"import threading\n" +"import queue\n" +"\n" +"q = queue.Queue()\n" +"\n" +"def worker():\n" +" while True:\n" +" item = q.get()\n" +" print(f'Working on {item}')\n" +" print(f'Finished {item}')\n" +" q.task_done()\n" +"\n" +"# Turn-on the worker thread.\n" +"threading.Thread(target=worker, daemon=True).start()\n" +"\n" +"# Send thirty task requests to the worker.\n" +"for item in range(30):\n" +" q.put(item)\n" +"\n" +"# Block until all tasks are done.\n" +"q.join()\n" +"print('All work completed')" +msgstr "" + +#: library/queue.rst:234 +msgid "Terminating queues" +msgstr "" + +#: library/queue.rst:236 +msgid "" +"When no longer needed, :class:`Queue` objects can be wound down until empty " +"or terminated immediately with a hard shutdown." +msgstr "" + +#: library/queue.rst:241 +msgid "Put a :class:`Queue` instance into a shutdown mode." +msgstr "" + +#: library/queue.rst:243 +msgid "" +"The queue can no longer grow. Future calls to :meth:`~Queue.put` raise :exc:" +"`ShutDown`. Currently blocked callers of :meth:`~Queue.put` will be " +"unblocked and will raise :exc:`ShutDown` in the formerly blocked thread." +msgstr "" + +#: library/queue.rst:248 +msgid "" +"If *immediate* is false (the default), the queue can be wound down normally " +"with :meth:`~Queue.get` calls to extract tasks that have already been loaded." +msgstr "" + +#: library/queue.rst:252 +msgid "" +"And if :meth:`~Queue.task_done` is called for each remaining task, a " +"pending :meth:`~Queue.join` will be unblocked normally." +msgstr "" + +#: library/queue.rst:255 +msgid "" +"Once the queue is empty, future calls to :meth:`~Queue.get` will raise :exc:" +"`ShutDown`." +msgstr "" + +#: library/queue.rst:258 +msgid "" +"If *immediate* is true, the queue is terminated immediately. The queue is " +"drained to be completely empty and the count of unfinished tasks is reduced " +"by the number of tasks drained. If unfinished tasks is zero, callers of :" +"meth:`~Queue.join` are unblocked. Also, blocked callers of :meth:`~Queue." +"get` are unblocked and will raise :exc:`ShutDown` because the queue is empty." +msgstr "" + +#: library/queue.rst:266 +msgid "" +"Use caution when using :meth:`~Queue.join` with *immediate* set to true. " +"This unblocks the join even when no work has been done on the tasks, " +"violating the usual invariant for joining a queue." +msgstr "" + +#: library/queue.rst:274 msgid "SimpleQueue Objects" msgstr "" -#: library/queue.rst:220 +#: library/queue.rst:276 msgid "" ":class:`SimpleQueue` objects provide the public methods described below." msgstr "" -#: library/queue.rst:224 +#: library/queue.rst:280 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block." msgstr "" -#: library/queue.rst:230 +#: library/queue.rst:286 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``False`` it doesn't guarantee that a subsequent call to get() will " "not block." msgstr "" -#: library/queue.rst:237 +#: library/queue.rst:293 msgid "" "Put *item* into the queue. The method never blocks and always succeeds " "(except for potential low-level errors such as failure to allocate memory). " @@ -264,7 +377,7 @@ msgid "" "compatibility with :meth:`Queue.put`." msgstr "" -#: library/queue.rst:243 +#: library/queue.rst:299 msgid "" "This method has a C implementation which is reentrant. That is, a ``put()`` " "or ``get()`` call can be interrupted by another ``put()`` call in the same " @@ -273,23 +386,23 @@ msgid "" "or :mod:`weakref` callbacks." msgstr "" -#: library/queue.rst:252 +#: library/queue.rst:308 msgid "" "Equivalent to ``put(item, block=False)``, provided for compatibility with :" "meth:`Queue.put_nowait`." msgstr "" -#: library/queue.rst:275 +#: library/queue.rst:329 msgid "Class :class:`multiprocessing.Queue`" msgstr "" -#: library/queue.rst:274 +#: library/queue.rst:330 msgid "" "A queue class for use in a multi-processing (rather than multi-threading) " "context." msgstr "" -#: library/queue.rst:277 +#: library/queue.rst:333 msgid "" ":class:`collections.deque` is an alternative implementation of unbounded " "queues with fast atomic :meth:`~collections.deque.append` and :meth:" diff --git a/library/quopri.po b/library/quopri.po index 721b5502..6d0dab10 100644 --- a/library/quopri.po +++ b/library/quopri.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/quopri.rst:2 -msgid ":mod:`quopri` --- Encode and decode MIME quoted-printable data" +msgid ":mod:`!quopri` --- Encode and decode MIME quoted-printable data" msgstr "" #: library/quopri.rst:7 diff --git a/library/random.po b/library/random.po index e8c28872..d07319df 100644 --- a/library/random.po +++ b/library/random.po @@ -8,27 +8,30 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/random.rst:2 -msgid ":mod:`random` --- Generate pseudo-random numbers" -msgstr "" +msgid ":mod:`!random` --- Generate pseudo-random numbers" +msgstr ":mod:`!random` --- Δημιουργία ψευδοτυχαίων αριθμών" #: library/random.rst:7 msgid "**Source code:** :source:`Lib/random.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/random.py`" #: library/random.rst:11 msgid "" "This module implements pseudo-random number generators for various " "distributions." msgstr "" +"Αυτό το module υλοποιεί ψευδοτυχαίες γεννήτριες αριθμών για διάφορες " +"κατανομές." #: library/random.rst:14 msgid "" @@ -37,6 +40,10 @@ msgid "" "permutation of a list in-place, and a function for random sampling without " "replacement." msgstr "" +"Για ακέραιους, υπάρχει ομοιόμορφη επιλογή από ένα εύρος. Για ακολουθίες, " +"υπάρχει ομοιόμορφη επιλογή ενός τυχαίου στοιχείου, μια συνάρτηση για την " +"δημιουργία μιας τυχαίας παραλλαγής μιας λίστας στη θέση της, και μια " +"συνάρτηση για τυχαία δειγματοληψία χωρίς αντικατάσταση." #: library/random.rst:19 msgid "" @@ -44,6 +51,10 @@ msgid "" "lognormal, negative exponential, gamma, and beta distributions. For " "generating distributions of angles, the von Mises distribution is available." msgstr "" +"Στην πραγματική γραμμή, υπάρχουν συναρτήσεις για τον υπολογισμό ομοιόμορφων, " +"κανονικών (Gaussian), lognormal, αρνητικών εκθετικών, gamma και beta " +"κατανομών. Για τη δημιουργία κατανομών γωνιών, διατίθεται η κατανομή von " +"Mises." #: library/random.rst:23 msgid "" @@ -56,6 +67,15 @@ msgid "" "However, being completely deterministic, it is not suitable for all " "purposes, and is completely unsuitable for cryptographic purposes." msgstr "" +"Σχεδόν όλες οι συναρτήσεις του module εξαρτώνται από τη βασική συνάρτηση :" +"func:`.random`, η οποία παράγει έναν τυχαίο float ομοιόμορφα στο ημι-ανοιχτό " +"εύρος ``0.0 <= X < 1.0``. Η Python χρησιμοποιεί το Mersenne Twister ως " +"βασική γεννήτρια. Παράγει floats με ακρίβεια 53-bit και έχει περίοδο " +"2\\*\\*19937-1. Η υποκείμενη υλοποίηση σε C είναι τόσο γρήγορη όσο και " +"ασφαλής για νήματα. Το Mersenne Twister είναι μια από τις πιο εκτενώς " +"δοκιμασμένες γεννήτριες τυχαίων αριθμών που υπάρχουν. Ωστόσο, είναι εντελώς " +"ντετερμινιστική, δεν είναι κατάλληλη για όλους τους σκοπούς και είναι " +"εντελώς ακατάλληλη για κρυπτογραφικούς σκοπούς." #: library/random.rst:32 msgid "" @@ -63,6 +83,10 @@ msgid "" "instance of the :class:`random.Random` class. You can instantiate your own " "instances of :class:`Random` to get generators that don't share state." msgstr "" +"Οι συναρτήσεις που παρέχονται από αυτό το module είναι στην πραγματικότητα " +"δεσμευμένες μέθοδοι ενός κρυφού στιγμιοτύπου της κλάσης :class:`random." +"Random`. Μπορείτε να δημιουργήσετε τα δικά σας στιγμιότυπα της :class:" +"`Random` για να λάβετε γεννήτριες που δεν μοιράζονται κατάσταση." #: library/random.rst:36 msgid "" @@ -70,6 +94,9 @@ msgid "" "basic generator of your own devising: see the documentation on that class " "for more details." msgstr "" +"Η κλάση :class:`Random` μπορεί επίσης να υποκλαστεί αν θέλετε να " +"χρησιμοποιήσετε μια διαφορετική βασική γεννήτρια της δικής σας επινόησης: " +"δείτε την τεκμηρίωση για αυτή την κλάση για περισσότερες λεπτομέρειες." #: library/random.rst:40 msgid "" @@ -77,12 +104,19 @@ msgid "" "uses the system function :func:`os.urandom` to generate random numbers from " "sources provided by the operating system." msgstr "" +"Το module :mod:`random` παρέχει επίσης την κλάση :class:`SystemRandom` η " +"οποία χρησιμοποιεί τη λειτουργία του συστήματος :func:`os.urandom` για να " +"δημιουργήσει τυχαίους αριθμούς από πηγές που παρέχονται από το λειτουργικό " +"σύστημα." #: library/random.rst:46 msgid "" "The pseudo-random generators of this module should not be used for security " "purposes. For security or cryptographic uses, see the :mod:`secrets` module." msgstr "" +"Οι ψευδοτυχαίες γεννήτριες αυτού του module δεν πρέπει να χρησιμοποιούνται " +"για σκοπούς ασφαλείας. Για ασφαλείς ή κρυπτογραφικούς σκοπούς, δείτε το " +"module :mod:`secrets`." #: library/random.rst:52 msgid "" @@ -90,160 +124,231 @@ msgid "" "equidistributed uniform pseudorandom number generator\", ACM Transactions on " "Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998." msgstr "" +"M. Matsumoto και T. Nishimura, \"Mersenne Twister: A 623-dimensionally " +"equidistributed uniform pseudorandom number generator\", ACM Transactions on " +"Modeling and Computer Simulation Vol. 8, No. 1, January pp.3--30 1998." #: library/random.rst:57 msgid "" "`Complementary-Multiply-with-Carry recipe `_ for a compatible alternative random number generator with " -"a long period and comparatively simple update operations." +"recipes/576707-long-period-random-number-generator/>`_ for a compatible " +"alternative random number generator with a long period and comparatively " +"simple update operations." msgstr "" +"`Complementary-Multiply-with-Carry recipe `_ για μια συμβατή " +"εναλλακτική γεννήτρια τυχαίων αριθμών με μεγάλη περίοδο και συγκριτικά απλές " +"λειτουργίες ενημέρωσης." -#: library/random.rst:64 -msgid "Bookkeeping functions" +#: library/random.rst:63 +msgid "" +"The global random number generator and instances of :class:`Random` are " +"thread-safe. However, in the free-threaded build, concurrent calls to the " +"global generator or to the same instance of :class:`Random` may encounter " +"contention and poor performance. Consider using separate instances of :class:" +"`Random` per thread instead." msgstr "" +"Η παγκόσμια γεννήτρια τυχαίων αριθμών και τα στιγμιότυπα της κλάσης :class:" +"`Random` είναι ασφαλή για νήματα. Ωστόσο, στην ελεύθερη κατασκευή νημάτων, " +"οι ταυτόχρονες κλήσεις στην παγκόσμια γεννήτρια ή στο ίδιο στιγμιότυπο της " +"κλάσης :class:`Random` μπορεί να συναντήσουν ανταγωνισμό και κακή απόδοση. " +"Σκεφτείτε να χρησιμοποιήσετε ξεχωριστά στιγμιότυπα της κλάσης :class:" +"`Random` ανά νήμα αντίθετα." + +#: library/random.rst:70 +msgid "Bookkeeping functions" +msgstr "Συναρτήσεις καταγραφής" -#: library/random.rst:68 +#: library/random.rst:74 msgid "Initialize the random number generator." -msgstr "" +msgstr "Αρχικοποίηση της γεννήτριας τυχαίων αριθμών." -#: library/random.rst:70 +#: library/random.rst:76 msgid "" "If *a* is omitted or ``None``, the current system time is used. If " "randomness sources are provided by the operating system, they are used " "instead of the system time (see the :func:`os.urandom` function for details " "on availability)." msgstr "" +"Αν το *a* παραλειφθεί ή είναι ``None``, χρησιμοποιείται η τρέχουσα ώρα του " +"συστήματος. Αν οι πηγές τυχαιότητας παρέχονται από το λειτουργικό σύστημα, " +"χρησιμοποιούνται αντί της ώρας του συστήματος (δείτε τη λειτουργία :func:`os." +"urandom` για λεπτομέρειες σχετικά με τη διαθεσιμότητα)." -#: library/random.rst:75 +#: library/random.rst:81 msgid "If *a* is an int, it is used directly." -msgstr "" +msgstr "Αν το *a* είναι ακέραιος, χρησιμοποιείται απευθείας." -#: library/random.rst:77 +#: library/random.rst:83 msgid "" "With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:" "`bytearray` object gets converted to an :class:`int` and all of its bits are " "used." msgstr "" +"Με την έκδοση 2 (η προεπιλεγμένη), ένα αντικείμενο :class:`str`, :class:" +"`bytes`, ή :class:`bytearray` μετατρέπεται σε :class:`int` και " +"χρησιμοποιούνται όλα τα bits του." -#: library/random.rst:80 +#: library/random.rst:86 msgid "" "With version 1 (provided for reproducing random sequences from older " "versions of Python), the algorithm for :class:`str` and :class:`bytes` " "generates a narrower range of seeds." msgstr "" +"Με την έκδοση 1 (παρέχεται για την αναπαραγωγή τυχαίων ακολουθιών από " +"παλαιότερες εκδόσεις της Python), ο αλγόριθμος για :class:`str` και :class:" +"`bytes` παράγει ένα στενότερο εύρος seeds." -#: library/random.rst:84 +#: library/random.rst:90 msgid "" "Moved to the version 2 scheme which uses all of the bits in a string seed." msgstr "" +"Μεταφέρθηκε στο σχήμα έκδοσης 2 που χρησιμοποιεί όλα τα bits σε ένα seed " +"τύπου string." -#: library/random.rst:87 +#: library/random.rst:93 msgid "" "The *seed* must be one of the following types: ``None``, :class:`int`, :" "class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`." msgstr "" +"Το *seed* πρέπει να είναι ένας από τους ακόλουθους τύπους: ``None``, :class:" +"`int`, :class:`float`, :class:`str`, :class:`bytes`, ή :class:`bytearray`." -#: library/random.rst:94 +#: library/random.rst:100 msgid "" "Return an object capturing the current internal state of the generator. " "This object can be passed to :func:`setstate` to restore the state." msgstr "" +"Επιστρέφει ένα αντικείμενο που καταγράφει την τρέχουσα εσωτερική κατάσταση " +"της γεννήτριας. Αυτό το αντικείμενο μπορεί να περαστεί στη :func:`setstate` " +"για να αποκαταστήσει την κατάσταση." -#: library/random.rst:100 +#: library/random.rst:106 msgid "" "*state* should have been obtained from a previous call to :func:`getstate`, " "and :func:`setstate` restores the internal state of the generator to what it " "was at the time :func:`getstate` was called." msgstr "" +"Το *state* θα πρέπει να έχει αποκτηθεί από μια προηγούμενη κλήση στη :func:" +"`getstate`, και η :func:`setstate` αποκαθιστά την εσωτερική κατάσταση της " +"γεννήτριας σε αυτή που ήταν τη στιγμή που κλήθηκε η :func:`getstate`." -#: library/random.rst:106 +#: library/random.rst:112 msgid "Functions for bytes" -msgstr "" +msgstr "Συναρτήσεις για bytes" -#: library/random.rst:110 +#: library/random.rst:116 msgid "Generate *n* random bytes." -msgstr "" +msgstr "Δημιουργεί *n* τυχαία bytes." -#: library/random.rst:112 +#: library/random.rst:118 msgid "" "This method should not be used for generating security tokens. Use :func:" "`secrets.token_bytes` instead." msgstr "" +"Αυτή η μέθοδος δεν πρέπει να χρησιμοποιείται για τη δημιουργία ασφαλών " +"tokens. Χρησιμοποιήστε αντί αυτού τη :func:`secrets.token_bytes`." -#: library/random.rst:119 +#: library/random.rst:125 msgid "Functions for integers" -msgstr "" +msgstr "Συναρτήσεις για ακέραιους" -#: library/random.rst:124 +#: library/random.rst:130 msgid "Return a randomly selected element from ``range(start, stop, step)``." msgstr "" +"Επιστρέφει ένα τυχαία επιλεγμένο στοιχείο από ``range(start, stop, step)``." -#: library/random.rst:126 +#: library/random.rst:132 msgid "" "This is roughly equivalent to ``choice(range(start, stop, step))`` but " "supports arbitrarily large ranges and is optimized for common cases." msgstr "" +"Αυτό είναι περίπου ισοδύναμο με το ``choice(range(start, stop, step))`` αλλά " +"υποστηρίζει αυθαίρετα μεγάλα εύρη και είναι βελτιστοποιημένο για κοινές " +"περιπτώσεις." -#: library/random.rst:129 +#: library/random.rst:135 msgid "The positional argument pattern matches the :func:`range` function." msgstr "" +"Το μοτίβο των θέσεων παραμέτρων ταιριάζει με τη συνάρτηση :func:`range`." -#: library/random.rst:131 +#: library/random.rst:137 msgid "" "Keyword arguments should not be used because they can be interpreted in " "unexpected ways. For example ``randrange(start=100)`` is interpreted as " "``randrange(0, 100, 1)``." msgstr "" +"Οι παράμετροι λέξεων-κλειδιών δεν πρέπει να χρησιμοποιούνται επειδή μπορούν " +"να ερμηνευτούν με απροσδόκητους τρόπους. Για παράδειγμα, το " +"``randrange(start=100)`` ερμηνεύεται ως ``randrange(0, 100, 1)``." -#: library/random.rst:135 +#: library/random.rst:141 msgid "" ":meth:`randrange` is more sophisticated about producing equally distributed " "values. Formerly it used a style like ``int(random()*n)`` which could " "produce slightly uneven distributions." msgstr "" +"Η μέθοδος :meth:`randrange` είναι πιο εξελιγμένη όσον αφορά την παραγωγή " +"ομοιόμορφα κατανεμημένων τιμών. Προηγουμένως χρησιμοποιούσε ένα στυλ όπως " +"``int(random()*n)`` το οποίο μπορούσε να παράγει ελαφρώς άνισες κατανομές." -#: library/random.rst:140 +#: library/random.rst:146 msgid "" "Automatic conversion of non-integer types is no longer supported. Calls such " "as ``randrange(10.0)`` and ``randrange(Fraction(10, 1))`` now raise a :exc:" "`TypeError`." msgstr "" +"Η αυτόματη μετατροπή μη ακέραιων τύπων δεν υποστηρίζεται πλέον. Κλήσεις όπως " +"``randrange(10.0)`` και ``randrange(Fraction(10, 1))`` τώρα κάνουν raise " +"μια :exc:`TypeError`." -#: library/random.rst:147 +#: library/random.rst:153 msgid "" "Return a random integer *N* such that ``a <= N <= b``. Alias for " "``randrange(a, b+1)``." msgstr "" +"Επιστρέφει έναν τυχαίο ακέραιο *N* τέτοιο ώστε ``a <= N <= b``. Ψευδώνυμο " +"για ``randrange(a, b+1)``." -#: library/random.rst:152 +#: library/random.rst:158 msgid "" "Returns a non-negative Python integer with *k* random bits. This method is " "supplied with the Mersenne Twister generator and some other generators may " "also provide it as an optional part of the API. When available, :meth:" "`getrandbits` enables :meth:`randrange` to handle arbitrarily large ranges." msgstr "" +"Επιστρέφει έναν μη αρνητικό ακέραιο Python με *k* τυχαία bits. Αυτή η " +"μέθοδος παρέχεται με την γεννήτρια Mersenne Twister και μερικές άλλες " +"γεννήτριες μπορεί επίσης να την παρέχουν ως προαιρετικό μέρος του API. Όταν " +"είναι διαθέσιμη, η :meth:`getrandbits` επιτρέπει στην :meth:`randrange` να " +"χειρίζεται αυθαίρετα μεγάλα εύρη." -#: library/random.rst:158 +#: library/random.rst:164 msgid "This method now accepts zero for *k*." -msgstr "" +msgstr "Αυτή η μέθοδος τώρα δέχεται το μηδέν για *k*." -#: library/random.rst:163 +#: library/random.rst:169 msgid "Functions for sequences" -msgstr "" +msgstr "Συναρτήσεις για ακολουθίες" -#: library/random.rst:167 +#: library/random.rst:173 msgid "" "Return a random element from the non-empty sequence *seq*. If *seq* is " "empty, raises :exc:`IndexError`." msgstr "" +"Επιστρέφει ένα τυχαίο στοιχείο από την μη κενή ακολουθία *seq*. Αν το *seq* " +"είναι κενό, κάνει raise μια :exc:`IndexError`." -#: library/random.rst:172 +#: library/random.rst:178 msgid "" "Return a *k* sized list of elements chosen from the *population* with " "replacement. If the *population* is empty, raises :exc:`IndexError`." msgstr "" +"Επιστρέφει μια λίστα μεγέθους *k* από στοιχεία επιλεγμένα από τον *πληθυσμό* " +"με αντικατάσταση. Αν το *population* είναι κενό, κάνει raise μια :exc:" +"`IndexError`." -#: library/random.rst:175 +#: library/random.rst:181 msgid "" "If a *weights* sequence is specified, selections are made according to the " "relative weights. Alternatively, if a *cum_weights* sequence is given, the " @@ -253,16 +358,27 @@ msgid "" "50]``. Internally, the relative weights are converted to cumulative weights " "before making selections, so supplying the cumulative weights saves work." msgstr "" +"Αν μια ακολουθία *weights* καθοριστεί, οι επιλογές γίνονται σύμφωνα με τα " +"σχετικά βάρη. Εναλλακτικά, αν μια ακολουθία *cum_weights* δοθεί, οι επιλογές " +"γίνονται σύμφωνα με τα σωρευτικά βάρη (ίσως υπολογισμένα χρησιμοποιώντας :" +"func:`itertools.accumulate`). Για παράδειγμα, τα σχετικά βάρη ``[10, 5, 30, " +"5]`` είναι ισοδύναμα με τα σωρευτικά βάρη ``[10, 15, 45, 50]``. Εσωτερικά, " +"τα σχετικά βάρη μετατρέπονται σε σωρευτικά βάρη πριν από τις επιλογές, οπότε " +"η παροχή των σωρευτικών βαρών εξοικονομεί εργασία." -#: library/random.rst:184 +#: library/random.rst:190 msgid "" "If neither *weights* nor *cum_weights* are specified, selections are made " "with equal probability. If a weights sequence is supplied, it must be the " "same length as the *population* sequence. It is a :exc:`TypeError` to " "specify both *weights* and *cum_weights*." msgstr "" +"Αν ούτε τα *weights* ούτε τα *cum_weights* καθοριστούν, οι επιλογές γίνονται " +"με ίση πιθανότητα. Αν μια ακολουθία βαρών καθοριστεί, πρέπει να είναι του " +"ίδιου μήκους με την ακολουθία του *πληθυσμού*. Είναι μια :exc:`TypeError` να " +"καθορίσετε και τα δύο *weights* και *cum_weights*." -#: library/random.rst:189 +#: library/random.rst:195 msgid "" "The *weights* or *cum_weights* can use any numeric type that interoperates " "with the :class:`float` values returned by :func:`random` (that includes " @@ -270,32 +386,47 @@ msgid "" "to be non-negative and finite. A :exc:`ValueError` is raised if all weights " "are zero." msgstr "" +"Τα *weights* ή *cum_weights* μπορούν να χρησιμοποιούν οποιονδήποτε " +"αριθμητικό τύπο που συνεργάζεται με τις τιμές :class:`float` που " +"επιστρέφονται από τη :func:`random` (αυτό περιλαμβάνει ακέραιους, floats και " +"κλάσματα αλλά εξαιρεί τα δεκαδικά). Τα βάρη θεωρούνται μη αρνητικά και " +"πεπερασμένα. Μια :exc:`ValueError` γίνεται raise αν όλα τα βάρη είναι " +"μηδενικά." -#: library/random.rst:195 +#: library/random.rst:201 msgid "" "For a given seed, the :func:`choices` function with equal weighting " "typically produces a different sequence than repeated calls to :func:" -"`choice`. The algorithm used by :func:`choices` uses floating point " +"`choice`. The algorithm used by :func:`choices` uses floating-point " "arithmetic for internal consistency and speed. The algorithm used by :func:" "`choice` defaults to integer arithmetic with repeated selections to avoid " "small biases from round-off error." msgstr "" +"Για ένα δεδομένο seed, η συνάρτηση :func:`choices` με ίσα βάρη παράγει " +"συνήθως μια διαφορετική ακολουθία από τις επαναλαμβανόμενες κλήσεις :func:" +"`choice`. Ο αλγόριθμος που χρησιμοποιείται από τη :func:`choices` " +"χρησιμοποιεί αριθμητική κινητής υποδιαστολής για εσωτερική συνέπεια και " +"ταχύτητα. Ο αλγόριθμος που χρησιμοποιείται από τη :func:`choice` προεπιλέγει " +"την ακέραια αριθμητική με επαναλαμβανόμενες επιλογές για να αποφύγει μικρές " +"προκαταλήψεις από σφάλματα στρογγυλοποίησης." -#: library/random.rst:204 +#: library/random.rst:210 msgid "Raises a :exc:`ValueError` if all weights are zero." -msgstr "" +msgstr "Κάνει raise μια :exc:`ValueError` αν όλα τα βάρη είναι μηδενικά." -#: library/random.rst:210 +#: library/random.rst:216 msgid "Shuffle the sequence *x* in place." -msgstr "" +msgstr "Ανακατεύει την ακολουθία *x* στη θέση της." -#: library/random.rst:212 +#: library/random.rst:218 msgid "" "To shuffle an immutable sequence and return a new shuffled list, use " "``sample(x, k=len(x))`` instead." msgstr "" +"Για να ανακατέψετε μια αμετάβλητη ακολουθία και να επιστρέψετε μια νέα " +"ανακατεμένη λίστα, χρησιμοποιήστε ``sample(x, k=len(x))`` αντί αυτού." -#: library/random.rst:215 +#: library/random.rst:221 msgid "" "Note that even for small ``len(x)``, the total number of permutations of *x* " "can quickly grow larger than the period of most random number generators. " @@ -303,18 +434,28 @@ msgid "" "generated. For example, a sequence of length 2080 is the largest that can " "fit within the period of the Mersenne Twister random number generator." msgstr "" +"Σημειώστε ότι ακόμη και για μικρό ``len(x)``, ο συνολικός αριθμός " +"επαναλήψεων του *x* μπορεί να αυξηθεί γρήγορα μεγαλύτερα από την περίοδο των " +"περισσότερων γεννητριών τυχαίων αριθμών. Αυτό υποδηλώνει ότι οι περισσότερες " +"επαναλήψεις μιας μεγάλης ακολουθίας δεν μπορούν ποτέ να παραχθούν. Για " +"παράδειγμα, μια ακολουθία μήκους 2080 είναι η μεγαλύτερη που μπορεί να " +"χωρέσει εντός της περιόδου της γεννήτριας τυχαίων αριθμών του Mersenne " +"Twister." -#: library/random.rst:221 +#: library/random.rst:227 msgid "Removed the optional parameter *random*." -msgstr "" +msgstr "Αφαιρέθηκε η προαιρετική παράμετρος *random*." -#: library/random.rst:227 +#: library/random.rst:233 msgid "" "Return a *k* length list of unique elements chosen from the population " "sequence. Used for random sampling without replacement." msgstr "" +"Επιστρέφει μια λίστα μήκους *k* από μοναδικά στοιχεία επιλεγμένα από την " +"ακολουθία του πληθυσμού. Χρησιμοποιείται για τυχαία δειγματοληψία χωρίς " +"αντικατάσταση." -#: library/random.rst:230 +#: library/random.rst:236 msgid "" "Returns a new list containing elements from the population while leaving the " "original population unchanged. The resulting list is in selection order so " @@ -322,115 +463,165 @@ msgid "" "winners (the sample) to be partitioned into grand prize and second place " "winners (the subslices)." msgstr "" +"Επιστρέφει μια νέα λίστα που περιέχει στοιχεία από τον πληθυσμό αφήνοντας " +"την αρχική ακολουθία του πληθυσμού αμετάβλητη. Η προκύπτουσα λίστα είναι σε " +"σειρά επιλογής έτσι ώστε όλα τα υπο-κομμάτια να είναι επίσης έγκυρα τυχαία " +"δείγματα. Αυτό επιτρέπει στους νικητές της κλήρωσης (το δείγμα) να " +"διαχωριστούν σε νικητές του μεγάλου βραβείου και δεύτερης θέσης (τα υπο-" +"κομμάτια)." -#: library/random.rst:236 +#: library/random.rst:242 msgid "" "Members of the population need not be :term:`hashable` or unique. If the " "population contains repeats, then each occurrence is a possible selection in " "the sample." msgstr "" +"Τα μέλη του πληθυσμού δεν χρειάζεται να είναι :term:`hashable` ή μοναδικά. " +"Αν ο πληθυσμός περιέχει επαναλήψεις, τότε κάθε εμφάνιση είναι μια δυνατή " +"επιλογή στο δείγμα." -#: library/random.rst:239 +#: library/random.rst:245 msgid "" "Repeated elements can be specified one at a time or with the optional " "keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], " "counts=[4, 2], k=5)`` is equivalent to ``sample(['red', 'red', 'red', 'red', " "'blue', 'blue'], k=5)``." msgstr "" +"Τα επαναλαμβανόμενα στοιχεία μπορούν να καθοριστούν ένα-ένα ή με την " +"προαιρετική παράμετρο μόνο-για-λέξεις-κλειδιά *counts*. Για παράδειγμα, " +"``sample(['red', 'blue'], counts=[4, 2], k=5)`` είναι ισοδύναμο με " +"``sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)``." -#: library/random.rst:244 +#: library/random.rst:250 msgid "" "To choose a sample from a range of integers, use a :func:`range` object as " "an argument. This is especially fast and space efficient for sampling from " "a large population: ``sample(range(10000000), k=60)``." msgstr "" +"Για να επιλέξετε ένα δείγμα από ένα εύρος ακέραιων, χρησιμοποιήστε ένα :func:" +"`range` αντικείμενο ως παράμετρο. Αυτό είναι ιδιαίτερα γρήγορο και αποδοτικό " +"σε χώρο για δειγματοληψία από έναν μεγάλο πληθυσμό: " +"``sample(range(10000000), k=60)``." -#: library/random.rst:248 +#: library/random.rst:254 msgid "" "If the sample size is larger than the population size, a :exc:`ValueError` " "is raised." msgstr "" +"Αν το μέγεθος του δείγματος είναι μεγαλύτερο από το μέγεθος του πληθυσμού, " +"γίνεται raise μια :exc:`ValueError`." -#: library/random.rst:251 +#: library/random.rst:257 msgid "Added the *counts* parameter." -msgstr "" +msgstr "Προστέθηκε η παράμετρος *counts*." -#: library/random.rst:256 +#: library/random.rst:262 msgid "" "The *population* must be a sequence. Automatic conversion of sets to lists " "is no longer supported." msgstr "" +"Ο *πληθυσμός* πρέπει να είναι μια ακολουθία. Η αυτόματη μετατροπή συνόλων σε " +"λίστες δεν υποστηρίζεται πλέον." -#: library/random.rst:260 +#: library/random.rst:266 msgid "Discrete distributions" -msgstr "" +msgstr "Διακριτές κατανομές" -#: library/random.rst:262 +#: library/random.rst:268 msgid "The following function generates a discrete distribution." -msgstr "" +msgstr "Η ακόλουθη συνάρτηση δημιουργεί μια διακριτή κατανομή." -#: library/random.rst:266 +#: library/random.rst:272 msgid "" "`Binomial distribution `_. Return the number of successes for *n* independent trials with the " "probability of success in each trial being *p*:" msgstr "" +"`Binomial distribution `_. Επιστρέφει τον αριθμό των επιτυχιών για *n* ανεξάρτητες δοκιμές με " +"την πιθανότητα επιτυχίας σε κάθε δοκιμή να είναι *p*:" -#: library/random.rst:271 +#: library/random.rst:277 msgid "Mathematically equivalent to::" -msgstr "" +msgstr "Μαθηματικά ισοδύναμο με::" + +#: library/random.rst:279 +msgid "sum(random() < p for i in range(n))" +msgstr "sum(random() < p for i in range(n))" -#: library/random.rst:275 +#: library/random.rst:281 msgid "" "The number of trials *n* should be a non-negative integer. The probability " "of success *p* should be between ``0.0 <= p <= 1.0``. The result is an " "integer in the range ``0 <= X <= n``." msgstr "" +"Ο αριθμός των δοκιμών *n* πρέπει να είναι ένας μη αρνητικός ακέραιος. Η " +"πιθανότητα επιτυχίας *p* πρέπει να είναι μεταξύ ``0.0 <= p <= 1.0``. Το " +"αποτέλεσμα είναι ένας ακέραιος στο εύρος ``0 <= X <= n``." -#: library/random.rst:285 +#: library/random.rst:291 msgid "Real-valued distributions" -msgstr "" +msgstr "Πραγματικές κατανομές" -#: library/random.rst:287 +#: library/random.rst:293 msgid "" "The following functions generate specific real-valued distributions. " "Function parameters are named after the corresponding variables in the " "distribution's equation, as used in common mathematical practice; most of " "these equations can be found in any statistics text." msgstr "" +"Οι ακόλουθες συναρτήσεις δημιουργούν συγκεκριμένες πραγματικές κατανομές. Οι " +"παράμετροι των συναρτήσεων ονομάζονται όπως οι αντίστοιχες μεταβλητές στην " +"εξίσωση της κατανομής, όπως χρησιμοποιείται στην κοινή μαθηματική πρακτική. " +"Οι περισσότερες από αυτές τις εξισώσεις μπορούν να βρεθούν σε οποιοδήποτε " +"εγχειρίδιο στατιστικής." -#: library/random.rst:295 +#: library/random.rst:301 msgid "" -"Return the next random floating point number in the range ``0.0 <= X < 1.0``" +"Return the next random floating-point number in the range ``0.0 <= X < 1.0``" msgstr "" +"Επιστρέφει τον επόμενο τυχαίο αριθμό κινητής υποδιαστολής στο εύρος ``0.0 <= " +"X < 1.0``" -#: library/random.rst:300 +#: library/random.rst:306 msgid "" -"Return a random floating point number *N* such that ``a <= N <= b`` for ``a " +"Return a random floating-point number *N* such that ``a <= N <= b`` for ``a " "<= b`` and ``b <= N <= a`` for ``b < a``." msgstr "" +"Επιστρέφει έναν τυχαίο αριθμό κινητής υποδιαστολής *N* τέτοιο ώστε ``a <= N " +"<= b`` για ``a <= b`` και ``b <= N <= a`` για ``b < a``." -#: library/random.rst:303 +#: library/random.rst:309 msgid "" "The end-point value ``b`` may or may not be included in the range depending " "on floating-point rounding in the expression ``a + (b-a) * random()``." msgstr "" +"Η τιμή του τελικού σημείου ``b`` μπορεί να περιλαμβάνεται ή όχι στο εύρος " +"ανάλογα με τη στρογγυλοποίηση κινητής υποδιαστολής στην έκφραση ``a + (b-a) " +"* random()``." -#: library/random.rst:310 +#: library/random.rst:316 msgid "" -"Return a random floating point number *N* such that ``low <= N <= high`` and " +"Return a random floating-point number *N* such that ``low <= N <= high`` and " "with the specified *mode* between those bounds. The *low* and *high* bounds " "default to zero and one. The *mode* argument defaults to the midpoint " "between the bounds, giving a symmetric distribution." msgstr "" +"Επιστρέφει έναν τυχαίο αριθμό κινητής υποδιαστολής *N* τέτοιο ώστε ``low <= " +"N <= high`` και με το καθορισμένο *mode* μεταξύ αυτών των ορίων. Τα όρια " +"*low* και *high* προεπιλέγονται στο μηδέν και το ένα. Η παράμετρος *mode* " +"προεπιλέγεται στο μέσο όρο μεταξύ των ορίων, δίνοντας μια συμμετρική " +"κατανομή." -#: library/random.rst:318 +#: library/random.rst:324 msgid "" "Beta distribution. Conditions on the parameters are ``alpha > 0`` and " "``beta > 0``. Returned values range between 0 and 1." msgstr "" +"Κατανομή Beta. Οι συνθήκες για τις παραμέτρους είναι ``alpha > 0`` και " +"``beta > 0``. Οι επιστρεφόμενες τιμές κυμαίνονται μεταξύ 0 και 1." -#: library/random.rst:324 +#: library/random.rst:330 msgid "" "Exponential distribution. *lambd* is 1.0 divided by the desired mean. It " "should be nonzero. (The parameter would be called \"lambda\", but that is a " @@ -438,30 +629,52 @@ msgid "" "if *lambd* is positive, and from negative infinity to 0 if *lambd* is " "negative." msgstr "" +"Εκθετική κατανομή. Το *lambd* είναι 1.0 διαιρεμένο με τον επιθυμητό μέσο " +"όρο. Πρέπει να είναι μη μηδενικό. (Η παράμετρος θα ονομαζόταν \"lambda\", " +"αλλά αυτό είναι μια δεσμευμένη λέξη στην Python.) Οι επιστρεφόμενες τιμές " +"κυμαίνονται από 0 έως θετικό άπειρο αν το *lambd* είναι θετικό, και από " +"αρνητικό άπειρο έως 0 αν το *lambd* είναι αρνητικό." -#: library/random.rst:330 +#: library/random.rst:336 msgid "Added the default value for ``lambd``." -msgstr "" +msgstr "Προστέθηκε η προεπιλεγμένη τιμή για το ``lambd``." -#: library/random.rst:336 +#: library/random.rst:342 msgid "" "Gamma distribution. (*Not* the gamma function!) The shape and scale " "parameters, *alpha* and *beta*, must have positive values. (Calling " "conventions vary and some sources define 'beta' as the inverse of the scale)." msgstr "" +"Κατανομή Gamma. (*Όχι* η συνάρτηση gamma!) Οι παράμετροι σχήματος και " +"κλίμακας, *alpha* και *beta*, πρέπει να έχουν θετικές τιμές. (Οι συμβάσεις " +"κλήσης διαφέρουν και μερικές πηγές ορίζουν το 'beta' ως το αντίστροφο της " +"κλίμακας)." -#: library/random.rst:341 +#: library/random.rst:347 msgid "The probability distribution function is::" +msgstr "Η συνάρτηση κατανομής πιθανότητας είναι::" + +#: library/random.rst:349 +msgid "" +" x ** (alpha - 1) * math.exp(-x / beta)\n" +"pdf(x) = --------------------------------------\n" +" math.gamma(alpha) * beta ** alpha" msgstr "" +" x ** (alpha - 1) * math.exp(-x / beta)\n" +"pdf(x) = --------------------------------------\n" +" math.gamma(alpha) * beta ** alpha" -#: library/random.rst:350 +#: library/random.rst:356 msgid "" "Normal distribution, also called the Gaussian distribution. *mu* is the " "mean, and *sigma* is the standard deviation. This is slightly faster than " "the :func:`normalvariate` function defined below." msgstr "" +"Κανονική κατανομή, επίσης γνωστή ως κατανομή Gaussian. Το *mu* είναι ο μέσος " +"όρος, και το *sigma* είναι η τυπική απόκλιση. Αυτό είναι ελαφρώς ταχύτερο " +"από τη συνάρτηση :func:`normalvariate` που ορίζεται παρακάτω." -#: library/random.rst:355 +#: library/random.rst:361 msgid "" "Multithreading note: When two threads call this function simultaneously, it " "is possible that they will receive the same return value. This can be " @@ -469,102 +682,148 @@ msgid "" "random number generator. 2) Put locks around all calls. 3) Use the slower, " "but thread-safe :func:`normalvariate` function instead." msgstr "" +"Σημείωση πολυνημάτωσης: Όταν δύο νήματα καλούν αυτή τη συνάρτηση ταυτόχρονα, " +"είναι πιθανό να λάβουν την ίδια τιμή επιστροφής. Αυτό μπορεί να αποφευχθεί " +"με τρεις τρόπους. 1) Κάθε νήμα να χρησιμοποιεί μια διαφορετική παρουσία της " +"γεννήτριας τυχαίων αριθμών. 2) Να τοποθετήσετε κλειδώματα γύρω από όλες τις " +"κλήσεις. 3) Να χρησιμοποιήσετε τη πιο αργή, αλλά ασφαλή για νήματα, " +"συνάρτηση :func:`normalvariate` αντί αυτού." -#: library/random.rst:378 +#: library/random.rst:384 msgid "*mu* and *sigma* now have default arguments." -msgstr "" +msgstr "Το *mu* και το *sigma* έχουν τώρα προεπιλεγμένες παραμέτρους." -#: library/random.rst:368 +#: library/random.rst:374 msgid "" "Log normal distribution. If you take the natural logarithm of this " "distribution, you'll get a normal distribution with mean *mu* and standard " "deviation *sigma*. *mu* can have any value, and *sigma* must be greater " "than zero." msgstr "" +"Κατανομή log normal. Αν πάρετε τον φυσικό λογάριθμο αυτής της κατανομής, θα " +"πάρετε μια κανονική κατανομή με μέσο όρο *mu* και τυπική απόκλιση *sigma*. " +"Το *mu* μπορεί να έχει οποιαδήποτε τιμή, και το *sigma* πρέπει να είναι " +"μεγαλύτερο από το μηδέν." -#: library/random.rst:376 +#: library/random.rst:382 msgid "" "Normal distribution. *mu* is the mean, and *sigma* is the standard " "deviation." msgstr "" +"Κανονική κατανομή. Το *mu* είναι ο μέσος όρος, και το *sigma* είναι η τυπική " +"απόκλιση." -#: library/random.rst:384 +#: library/random.rst:390 msgid "" "*mu* is the mean angle, expressed in radians between 0 and 2\\*\\ *pi*, and " "*kappa* is the concentration parameter, which must be greater than or equal " "to zero. If *kappa* is equal to zero, this distribution reduces to a " "uniform random angle over the range 0 to 2\\*\\ *pi*." msgstr "" +"Το *mu* είναι η μέση γωνία, εκφρασμένη σε ακτίνια μεταξύ 0 και 2\\*\\ *pi*, " +"και *kappa* είναι η παράμετρος συγκέντρωσης, η οποία πρέπει να είναι " +"μεγαλύτερη ή ίση με το μηδέν. Αν το *kappa* είναι ίσο με το μηδέν, αυτή η " +"κατανομή μειώνεται σε μια ομοιόμορφη τυχαία γωνία στο εύρος 0 έως 2\\*\\ " +"*pi*." -#: library/random.rst:392 +#: library/random.rst:398 msgid "Pareto distribution. *alpha* is the shape parameter." -msgstr "" +msgstr "Κατανομή Pareto. Το *alpha* είναι η παράμετρος σχήματος." -#: library/random.rst:397 +#: library/random.rst:403 msgid "" "Weibull distribution. *alpha* is the scale parameter and *beta* is the " "shape parameter." msgstr "" +"Κατανομή Weibull. Το *alpha* είναι η παράμετρος κλίμακας και το *beta* είναι " +"η παράμετρος σχήματος." -#: library/random.rst:402 +#: library/random.rst:408 msgid "Alternative Generator" -msgstr "" +msgstr "Εναλλακτική Γεννήτρια" -#: library/random.rst:406 +#: library/random.rst:412 msgid "" "Class that implements the default pseudo-random number generator used by " "the :mod:`random` module." msgstr "" +"Κλάση που υλοποιεί την προεπιλεγμένη γεννήτρια τυχαίων αριθμών που " +"χρησιμοποιείται από το :mod:`random` module." -#: library/random.rst:409 +#: library/random.rst:415 msgid "" "Formerly the *seed* could be any hashable object. Now it is limited to: " "``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :" "class:`bytearray`." msgstr "" +"Προηγουμένως το *seed* μπορούσε να είναι οποιοδήποτε hashable αντικείμενο. " +"Τώρα περιορίζεται σε: ``None``, :class:`int`, :class:`float`, :class:`str`, :" +"class:`bytes`, ή :class:`bytearray`." -#: library/random.rst:414 +#: library/random.rst:420 msgid "" "Subclasses of :class:`!Random` should override the following methods if they " "wish to make use of a different basic generator:" msgstr "" +"Οι υποκλάσεις της :class:`!Random` θα πρέπει να αντικαταστήσουν τις παρακάτω " +"μεθόδους αν επιθυμούν να χρησιμοποιήσουν μια διαφορετική βασική γεννήτρια:" -#: library/random.rst:419 +#: library/random.rst:425 msgid "" "Override this method in subclasses to customise the :meth:`~random.seed` " "behaviour of :class:`!Random` instances." msgstr "" +"Αντικαταστήστε αυτή τη μέθοδο στις υποκλάσεις για να προσαρμόσετε τη :meth:" +"`~random.seed` συμπεριφορά των :class:`!Random` στιγμιότυπων." -#: library/random.rst:424 +#: library/random.rst:430 msgid "" "Override this method in subclasses to customise the :meth:`~random.getstate` " "behaviour of :class:`!Random` instances." msgstr "" +"Αντικαταστήστε αυτή τη μέθοδο στις υποκλάσεις για να προσαρμόσετε τη :meth:" +"`~random.getstate` συμπεριφορά των :class:`!Random` στιγμιότυπων." -#: library/random.rst:429 +#: library/random.rst:435 msgid "" "Override this method in subclasses to customise the :meth:`~random.setstate` " "behaviour of :class:`!Random` instances." msgstr "" +"Αντικαταστήστε αυτή τη μέθοδο στις υποκλάσεις για να προσαρμόσετε τη :meth:" +"`~random.setstate` συμπεριφορά των :class:`!Random` στιγμιότυπων." -#: library/random.rst:434 +#: library/random.rst:440 msgid "" "Override this method in subclasses to customise the :meth:`~random.random` " "behaviour of :class:`!Random` instances." msgstr "" +"Αντικαταστήστε αυτή τη μέθοδο στις υποκλάσεις για να προσαρμόσετε τη :meth:" +"`~random.random` συμπεριφορά των :class:`!Random` στιγμιότυπων." -#: library/random.rst:437 +#: library/random.rst:443 msgid "" "Optionally, a custom generator subclass can also supply the following method:" msgstr "" +"Μια προαιρετική υποκλάση γεννήτριας μπορεί επίσης να παρέχει την ακόλουθη " +"μέθοδο:" -#: library/random.rst:441 +#: library/random.rst:447 msgid "" "Override this method in subclasses to customise the :meth:`~random." "getrandbits` behaviour of :class:`!Random` instances." msgstr "" +"Αντικαταστήστε αυτή τη μέθοδο στις υποκλάσεις για να προσαρμόσετε τη :meth:" +"`~random.getrandbits` συμπεριφορά των :class:`!Random` στιγμιότυπων." -#: library/random.rst:447 +#: library/random.rst:452 +msgid "" +"Override this method in subclasses to customise the :meth:`~random." +"randbytes` behaviour of :class:`!Random` instances." +msgstr "" +"Αντικαταστήστε αυτή τη μέθοδο στις υποκλάσεις για να προσαρμόσετε τη :meth:" +"`~random.randbytes` συμπεριφορά των :class:`!Random` στιγμιότυπων." + +#: library/random.rst:458 msgid "" "Class that uses the :func:`os.urandom` function for generating random " "numbers from sources provided by the operating system. Not available on all " @@ -573,78 +832,345 @@ msgid "" "ignored. The :meth:`getstate` and :meth:`setstate` methods raise :exc:" "`NotImplementedError` if called." msgstr "" +"Κλάση που χρησιμοποιεί τη συνάρτηση :func:`os.urandom` για τη δημιουργία " +"τυχαίων αριθμών από πηγές που παρέχονται από το λειτουργικό σύστημα. Δεν " +"είναι διαθέσιμη σε όλα τα συστήματα. Δεν βασίζεται σε λογισμικό κατάσταση, " +"και οι ακολουθίες δεν είναι αναπαραγωγίσιμες. Σύμφωνα με αυτό, η μέθοδος :" +"meth:`seed` δεν έχει καμία επίδραση και αγνοείται. Οι μέθοδοι :meth:" +"`getstate` και :meth:`setstate` προκαλούν :exc:`NotImplementedError` αν " +"κληθούν." -#: library/random.rst:456 +#: library/random.rst:467 msgid "Notes on Reproducibility" -msgstr "" +msgstr "Σημειώσεις για την Αναπαραγωγιμότητα" -#: library/random.rst:458 +#: library/random.rst:469 msgid "" "Sometimes it is useful to be able to reproduce the sequences given by a " "pseudo-random number generator. By reusing a seed value, the same sequence " "should be reproducible from run to run as long as multiple threads are not " "running." msgstr "" +"Μερικές φορές είναι χρήσιμο να είναι δυνατή η αναπαραγωγή των ακολουθιών που " +"παρέχονται από μια ψευδοτυχαία γεννήτρια αριθμών. Επαναχρησιμοποιώντας μια " +"τιμή seed, η ίδια ακολουθία θα πρέπει να είναι αναπαραγωγίσιμη από εκτέλεση " +"σε εκτέλεση, εφόσον δεν τρέχουν πολλαπλά νήματα ταυτόχρονα." -#: library/random.rst:462 +#: library/random.rst:473 msgid "" "Most of the random module's algorithms and seeding functions are subject to " "change across Python versions, but two aspects are guaranteed not to change:" msgstr "" +"Οι περισσότεροι αλγόριθμοι και συναρτήσεις σποράς του module random " +"υπόκεινται σε αλλαγές μεταξύ εκδόσεων της Python, αλλά δύο πτυχές εγγυώνται " +"ότι δεν θα αλλάξουν:" -#: library/random.rst:465 +#: library/random.rst:476 msgid "" "If a new seeding method is added, then a backward compatible seeder will be " "offered." msgstr "" +"Εάν προστεθεί μια νέα μέθοδος σποράς, τότε θα προσφέρεται ένας σπορέας " +"συμβατός με παλαιότερες εκδόσεις." -#: library/random.rst:468 +#: library/random.rst:479 msgid "" "The generator's :meth:`~Random.random` method will continue to produce the " "same sequence when the compatible seeder is given the same seed." msgstr "" +"Η μέθοδος :meth:`~Random.random` της γεννήτριας θα συνεχίσει να παράγει την " +"ίδια ακολουθία όταν ο συμβατός σπορέας δίνεται την ίδια τιμή seed." -#: library/random.rst:474 +#: library/random.rst:485 msgid "Examples" -msgstr "" +msgstr "Παραδείγματα" -#: library/random.rst:476 +#: library/random.rst:487 msgid "Basic examples::" -msgstr "" - -#: library/random.rst:504 +msgstr "Βασικά παραδείγματα::" + +#: library/random.rst:489 +msgid "" +">>> random() # Random float: 0.0 <= x < 1.0\n" +"0.37444887175646646\n" +"\n" +">>> uniform(2.5, 10.0) # Random float: 2.5 <= x <= 10.0\n" +"3.1800146073117523\n" +"\n" +">>> expovariate(1 / 5) # Interval between arrivals averaging " +"5 seconds\n" +"5.148957571865031\n" +"\n" +">>> randrange(10) # Integer from 0 to 9 inclusive\n" +"7\n" +"\n" +">>> randrange(0, 101, 2) # Even integer from 0 to 100 " +"inclusive\n" +"26\n" +"\n" +">>> choice(['win', 'lose', 'draw']) # Single random element from a " +"sequence\n" +"'draw'\n" +"\n" +">>> deck = 'ace two three four'.split()\n" +">>> shuffle(deck) # Shuffle a list\n" +">>> deck\n" +"['four', 'two', 'ace', 'three']\n" +"\n" +">>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement\n" +"[40, 10, 50, 30]" +msgstr "" +">>> random() # Random float: 0.0 <= x < 1.0\n" +"0.37444887175646646\n" +"\n" +">>> uniform(2.5, 10.0) # Random float: 2.5 <= x <= 10.0\n" +"3.1800146073117523\n" +"\n" +">>> expovariate(1 / 5) # Interval between arrivals averaging " +"5 seconds\n" +"5.148957571865031\n" +"\n" +">>> randrange(10) # Integer from 0 to 9 inclusive\n" +"7\n" +"\n" +">>> randrange(0, 101, 2) # Even integer from 0 to 100 " +"inclusive\n" +"26\n" +"\n" +">>> choice(['win', 'lose', 'draw']) # Single random element from a " +"sequence\n" +"'draw'\n" +"\n" +">>> deck = 'ace two three four'.split()\n" +">>> shuffle(deck) # Shuffle a list\n" +">>> deck\n" +"['four', 'two', 'ace', 'three']\n" +"\n" +">>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement\n" +"[40, 10, 50, 30]" + +#: library/random.rst:515 msgid "Simulations::" -msgstr "" - -#: library/random.rst:529 +msgstr "Προσομοιώσεις::" + +#: library/random.rst:517 +msgid "" +">>> # Six roulette wheel spins (weighted sampling with replacement)\n" +">>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)\n" +"['red', 'green', 'black', 'black', 'red', 'black']\n" +"\n" +">>> # Deal 20 cards without replacement from a deck\n" +">>> # of 52 playing cards, and determine the proportion of cards\n" +">>> # with a ten-value: ten, jack, queen, or king.\n" +">>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20)\n" +">>> deal.count('tens') / 20\n" +"0.15\n" +"\n" +">>> # Estimate the probability of getting 5 or more heads from 7 spins\n" +">>> # of a biased coin that settles on heads 60% of the time.\n" +">>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10_000)) / 10_000\n" +"0.4169\n" +"\n" +">>> # Probability of the median of 5 samples being in middle two quartiles\n" +">>> def trial():\n" +"... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500\n" +"...\n" +">>> sum(trial() for i in range(10_000)) / 10_000\n" +"0.7958" +msgstr "" +">>> # Six roulette wheel spins (weighted sampling with replacement)\n" +">>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)\n" +"['red', 'green', 'black', 'black', 'red', 'black']\n" +"\n" +">>> # Deal 20 cards without replacement from a deck\n" +">>> # of 52 playing cards, and determine the proportion of cards\n" +">>> # with a ten-value: ten, jack, queen, or king.\n" +">>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20)\n" +">>> deal.count('tens') / 20\n" +"0.15\n" +"\n" +">>> # Estimate the probability of getting 5 or more heads from 7 spins\n" +">>> # of a biased coin that settles on heads 60% of the time.\n" +">>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10_000)) / 10_000\n" +"0.4169\n" +"\n" +">>> # Probability of the median of 5 samples being in middle two quartiles\n" +">>> def trial():\n" +"... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500\n" +"...\n" +">>> sum(trial() for i in range(10_000)) / 10_000\n" +"0.7958" + +#: library/random.rst:540 msgid "" "Example of `statistical bootstrapping `_ using resampling with replacement to estimate " "a confidence interval for the mean of a sample::" msgstr "" +"Παράδειγμα του `statistical bootstrapping `_ χρησιμοποιώντας δειγματοληψία με αντικατάσταση " +"για να εκτιμήσει ένα διάστημα εμπιστοσύνης για τον μέσο όρο ενός δείγματος::" + +#: library/random.rst:544 +msgid "" +"# https://www.thoughtco.com/example-of-bootstrapping-3126155\n" +"from statistics import fmean as mean\n" +"from random import choices\n" +"\n" +"data = [41, 50, 29, 37, 81, 30, 73, 63, 20, 35, 68, 22, 60, 31, 95]\n" +"means = sorted(mean(choices(data, k=len(data))) for i in range(100))\n" +"print(f'The sample mean of {mean(data):.1f} has a 90% confidence '\n" +" f'interval from {means[5]:.1f} to {means[94]:.1f}')" +msgstr "" +"# https://www.thoughtco.com/example-of-bootstrapping-3126155\n" +"from statistics import fmean as mean\n" +"from random import choices\n" +"\n" +"data = [41, 50, 29, 37, 81, 30, 73, 63, 20, 35, 68, 22, 60, 31, 95]\n" +"means = sorted(mean(choices(data, k=len(data))) for i in range(100))\n" +"print(f'The sample mean of {mean(data):.1f} has a 90% confidence '\n" +" f'interval from {means[5]:.1f} to {means[94]:.1f}')" -#: library/random.rst:542 +#: library/random.rst:553 msgid "" "Example of a `resampling permutation test `_ to determine the statistical " "significance or `p-value `_ of an " "observed difference between the effects of a drug versus a placebo::" msgstr "" - -#: library/random.rst:569 +"Παράδειγμα ενός `resampling permutation test `_ για να προσδιορίσει τη " +"στατιστική σημασία ή την `p-value `_ " +"μιας παρατηρούμενης διαφοράς μεταξύ των επιδράσεων ενός φαρμάκου σε σύγκριση " +"με ένα εικονικό φάρμακο::" + +#: library/random.rst:559 +msgid "" +"# Example from \"Statistics is Easy\" by Dennis Shasha and Manda Wilson\n" +"from statistics import fmean as mean\n" +"from random import shuffle\n" +"\n" +"drug = [54, 73, 53, 70, 73, 68, 52, 65, 65]\n" +"placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46]\n" +"observed_diff = mean(drug) - mean(placebo)\n" +"\n" +"n = 10_000\n" +"count = 0\n" +"combined = drug + placebo\n" +"for i in range(n):\n" +" shuffle(combined)\n" +" new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):])\n" +" count += (new_diff >= observed_diff)\n" +"\n" +"print(f'{n} label reshufflings produced only {count} instances with a " +"difference')\n" +"print(f'at least as extreme as the observed difference of " +"{observed_diff:.1f}.')\n" +"print(f'The one-sided p-value of {count / n:.4f} leads us to reject the " +"null')\n" +"print(f'hypothesis that there is no difference between the drug and the " +"placebo.')" +msgstr "" +"# Example from \"Statistics is Easy\" by Dennis Shasha and Manda Wilson\n" +"from statistics import fmean as mean\n" +"from random import shuffle\n" +"\n" +"drug = [54, 73, 53, 70, 73, 68, 52, 65, 65]\n" +"placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46]\n" +"observed_diff = mean(drug) - mean(placebo)\n" +"\n" +"n = 10_000\n" +"count = 0\n" +"combined = drug + placebo\n" +"for i in range(n):\n" +" shuffle(combined)\n" +" new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):])\n" +" count += (new_diff >= observed_diff)\n" +"\n" +"print(f'{n} label reshufflings produced only {count} instances with a " +"difference')\n" +"print(f'at least as extreme as the observed difference of " +"{observed_diff:.1f}.')\n" +"print(f'The one-sided p-value of {count / n:.4f} leads us to reject the " +"null')\n" +"print(f'hypothesis that there is no difference between the drug and the " +"placebo.')" + +#: library/random.rst:580 msgid "" "Simulation of arrival times and service deliveries for a multiserver queue::" msgstr "" - -#: library/random.rst:598 +"Προσομοίωση χρόνων άφιξης και παραδόσεων υπηρεσιών για μια ουρά πολλαπλών " +"διακομιστών::" + +#: library/random.rst:582 +msgid "" +"from heapq import heapify, heapreplace\n" +"from random import expovariate, gauss\n" +"from statistics import mean, quantiles\n" +"\n" +"average_arrival_interval = 5.6\n" +"average_service_time = 15.0\n" +"stdev_service_time = 3.5\n" +"num_servers = 3\n" +"\n" +"waits = []\n" +"arrival_time = 0.0\n" +"servers = [0.0] * num_servers # time when each server becomes available\n" +"heapify(servers)\n" +"for i in range(1_000_000):\n" +" arrival_time += expovariate(1.0 / average_arrival_interval)\n" +" next_server_available = servers[0]\n" +" wait = max(0.0, next_server_available - arrival_time)\n" +" waits.append(wait)\n" +" service_duration = max(0.0, gauss(average_service_time, " +"stdev_service_time))\n" +" service_completed = arrival_time + wait + service_duration\n" +" heapreplace(servers, service_completed)\n" +"\n" +"print(f'Mean wait: {mean(waits):.1f} Max wait: {max(waits):.1f}')\n" +"print('Quartiles:', [round(q, 1) for q in quantiles(waits)])" +msgstr "" +"from heapq import heapify, heapreplace\n" +"from random import expovariate, gauss\n" +"from statistics import mean, quantiles\n" +"\n" +"average_arrival_interval = 5.6\n" +"average_service_time = 15.0\n" +"stdev_service_time = 3.5\n" +"num_servers = 3\n" +"\n" +"waits = []\n" +"arrival_time = 0.0\n" +"servers = [0.0] * num_servers # time when each server becomes available\n" +"heapify(servers)\n" +"for i in range(1_000_000):\n" +" arrival_time += expovariate(1.0 / average_arrival_interval)\n" +" next_server_available = servers[0]\n" +" wait = max(0.0, next_server_available - arrival_time)\n" +" waits.append(wait)\n" +" service_duration = max(0.0, gauss(average_service_time, " +"stdev_service_time))\n" +" service_completed = arrival_time + wait + service_duration\n" +" heapreplace(servers, service_completed)\n" +"\n" +"print(f'Mean wait: {mean(waits):.1f} Max wait: {max(waits):.1f}')\n" +"print('Quartiles:', [round(q, 1) for q in quantiles(waits)])" + +#: library/random.rst:609 msgid "" "`Statistics for Hackers `_ a " "video tutorial by `Jake Vanderplas `_ on statistical analysis using just a few fundamental " "concepts including simulation, sampling, shuffling, and cross-validation." msgstr "" +"`Statistics for Hackers `_ ένα " +"βίντεο σεμινάριο από τον `Jake Vanderplas `_ για στατιστική ανάλυση χρησιμοποιώντας μόνο μερικές " +"θεμελιώδεις έννοιες όπως η προσομοίωση, η δειγματοληψία, η αναδιάταξη και η " +"διασταύρωση επικύρωσης." -#: library/random.rst:604 +#: library/random.rst:615 msgid "" "`Economics Simulation `_ a simulation of a marketplace by `Peter Norvig `_ μια προσομοίωση μιας αγοράς από τον `Peter Norvig `_ που δείχνει αποτελεσματική χρήση πολλών από τα εργαλεία και " +"τις κατανομές που παρέχονται από αυτό το module (gauss, uniform, sample, " +"betavariate, choice, triangular, και randrange)." -#: library/random.rst:611 +#: library/random.rst:622 msgid "" "`A Concrete Introduction to Probability (using Python) `_ a tutorial by `Peter Norvig " "`_ covering the basics of probability theory, " "how to write simulations, and how to perform data analysis using Python." msgstr "" +"`A Concrete Introduction to Probability (using Python) `_ ένα σεμινάριο από τον `Peter " +"Norvig `_ που καλύπτει τα βασικά της θεωρίας " +"πιθανοτήτων, πώς να γράψετε προσομοιώσεις, και πώς να εκτελέσετε ανάλυση " +"δεδομένων χρησιμοποιώντας Python." -#: library/random.rst:619 +#: library/random.rst:630 msgid "Recipes" -msgstr "" +msgstr "Συνταγές" -#: library/random.rst:621 +#: library/random.rst:632 msgid "" "These recipes show how to efficiently make random selections from the " "combinatoric iterators in the :mod:`itertools` module:" msgstr "" - -#: library/random.rst:653 +"Αυτές οι συνταγές δείχνουν πώς να κάνετε αποτελεσματικές τυχαίες επιλογές " +"από τους συνδυαστικούς επαναληπτές στο module :mod:`itertools` :" + +#: library/random.rst:635 +msgid "" +"def random_product(*args, repeat=1):\n" +" \"Random selection from itertools.product(*args, **kwds)\"\n" +" pools = [tuple(pool) for pool in args] * repeat\n" +" return tuple(map(random.choice, pools))\n" +"\n" +"def random_permutation(iterable, r=None):\n" +" \"Random selection from itertools.permutations(iterable, r)\"\n" +" pool = tuple(iterable)\n" +" r = len(pool) if r is None else r\n" +" return tuple(random.sample(pool, r))\n" +"\n" +"def random_combination(iterable, r):\n" +" \"Random selection from itertools.combinations(iterable, r)\"\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" indices = sorted(random.sample(range(n), r))\n" +" return tuple(pool[i] for i in indices)\n" +"\n" +"def random_combination_with_replacement(iterable, r):\n" +" \"Choose r elements with replacement. Order the result to match the " +"iterable.\"\n" +" # Result will be in set(itertools." +"combinations_with_replacement(iterable, r)).\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" indices = sorted(random.choices(range(n), k=r))\n" +" return tuple(pool[i] for i in indices)" +msgstr "" +"def random_product(*args, repeat=1):\n" +" \"Random selection from itertools.product(*args, **kwds)\"\n" +" pools = [tuple(pool) for pool in args] * repeat\n" +" return tuple(map(random.choice, pools))\n" +"\n" +"def random_permutation(iterable, r=None):\n" +" \"Random selection from itertools.permutations(iterable, r)\"\n" +" pool = tuple(iterable)\n" +" r = len(pool) if r is None else r\n" +" return tuple(random.sample(pool, r))\n" +"\n" +"def random_combination(iterable, r):\n" +" \"Random selection from itertools.combinations(iterable, r)\"\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" indices = sorted(random.sample(range(n), r))\n" +" return tuple(pool[i] for i in indices)\n" +"\n" +"def random_combination_with_replacement(iterable, r):\n" +" \"Choose r elements with replacement. Order the result to match the " +"iterable.\"\n" +" # Result will be in set(itertools." +"combinations_with_replacement(iterable, r)).\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" indices = sorted(random.choices(range(n), k=r))\n" +" return tuple(pool[i] for i in indices)" + +#: library/random.rst:664 msgid "" "The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 ≤ x " "< 1.0*. All such numbers are evenly spaced and are exactly representable as " @@ -679,8 +1275,13 @@ msgid "" "are not possible selections. For example, ``0.05954861408025609`` isn't an " "integer multiple of 2⁻⁵³." msgstr "" +"Η προεπιλεγμένη :func:`.random` επιστρέφει πολλαπλάσια του 2⁻⁵³ στο διάστημα " +"*0.0 ≤ x < 1.0*. Όλοι αυτοί οι αριθμοί είναι ομοιόμορφα κατανεμημένοι και " +"είναι ακριβώς αναπαραστάσιμοι ως Python floats. Ωστόσο, πολλά άλλα " +"αναπαραστάσιμα floats σε αυτό το διάστημα δεν είναι δυνατές επιλογές. Για " +"παράδειγμα, ``0.05954861408025609`` δεν είναι πολλαπλάσιο του 2⁻⁵³." -#: library/random.rst:659 +#: library/random.rst:670 msgid "" "The following recipe takes a different approach. All floats in the interval " "are possible selections. The mantissa comes from a uniform distribution of " @@ -688,14 +1289,65 @@ msgid "" "geometric distribution where exponents smaller than *-53* occur half as " "often as the next larger exponent." msgstr "" - -#: library/random.rst:681 +"Η παρακάτω συνταγή ακολουθεί μια διαφορετική προσέγγιση. Όλα τα floats στο " +"διάστημα είναι δυνατές επιλογές. Η mantissa προέρχεται από μια ομοιόμορφη " +"κατανομή ακεραίων στο διάστημα *2⁵² ≤ mantissa < 2⁵³*. Ο εκθέτης προέρχεται " +"από μια γεωμετρική κατανομή όπου οι εκθέτες μικρότεροι από *−53* " +"εμφανίζονται μισή φορά συχνότερα από τον επόμενο μεγαλύτερο εκθέτη." + +#: library/random.rst:678 +msgid "" +"from random import Random\n" +"from math import ldexp\n" +"\n" +"class FullRandom(Random):\n" +"\n" +" def random(self):\n" +" mantissa = 0x10_0000_0000_0000 | self.getrandbits(52)\n" +" exponent = -53\n" +" x = 0\n" +" while not x:\n" +" x = self.getrandbits(32)\n" +" exponent += x.bit_length() - 32\n" +" return ldexp(mantissa, exponent)" +msgstr "" +"from random import Random\n" +"from math import ldexp\n" +"\n" +"class FullRandom(Random):\n" +"\n" +" def random(self):\n" +" mantissa = 0x10_0000_0000_0000 | self.getrandbits(52)\n" +" exponent = -53\n" +" x = 0\n" +" while not x:\n" +" x = self.getrandbits(32)\n" +" exponent += x.bit_length() - 32\n" +" return ldexp(mantissa, exponent)" + +#: library/random.rst:692 msgid "" "All :ref:`real valued distributions ` in the " "class will use the new method::" msgstr "" +"Όλες οι :ref:`πραγματικές κατανομές ` στην κλάση " +"θα χρησιμοποιούν τη νέα μέθοδο::" + +#: library/random.rst:695 +msgid "" +">>> fr = FullRandom()\n" +">>> fr.random()\n" +"0.05954861408025609\n" +">>> fr.expovariate(0.25)\n" +"8.87925541791544" +msgstr "" +">>> fr = FullRandom()\n" +">>> fr.random()\n" +"0.05954861408025609\n" +">>> fr.expovariate(0.25)\n" +"8.87925541791544" -#: library/random.rst:690 +#: library/random.rst:701 msgid "" "The recipe is conceptually equivalent to an algorithm that chooses from all " "the multiples of 2⁻¹⁰⁷⁴ in the range *0.0 ≤ x < 1.0*. All such numbers are " @@ -703,11 +1355,150 @@ msgid "" "Python float. (The value 2⁻¹⁰⁷⁴ is the smallest positive unnormalized float " "and is equal to ``math.ulp(0.0)``.)" msgstr "" +"Η συνταγή είναι εννοιολογικά ισοδύναμη με έναν αλγόριθμο που επιλέγει από " +"όλα τα πολλαπλάσια του 2⁻¹⁰⁷⁴ στο διάστημα *0.0 ≤ x < 1.0*. Όλοι αυτοί οι " +"αριθμοί είναι ομοιόμορφα κατανεμημένοι, αλλά οι περισσότεροι πρέπει να " +"στρογγυλοποιηθούν προς τα κάτω στο πλησιέστερο αναπαραστάσιμο Python float. " +"(Η τιμή 2⁻¹⁰⁷⁴ είναι το μικρότερο θετικό μη κανονικοποιημένο float και " +"ισούται με ``math.ulp(0.0)``.)" -#: library/random.rst:699 +#: library/random.rst:710 msgid "" "`Generating Pseudo-random Floating-Point Values `_ a paper by Allen B. Downey describing " "ways to generate more fine-grained floats than normally generated by :func:`." "random`." msgstr "" +"`Generating Pseudo-random Floating-Point Values `_ ένα άρθρο του Allen B. Downey που " +"περιγράφει τρόπους δημιουργίας πιο λεπτομερών floats από ό,τι παράγονται " +"συνήθως από :func:`.random`." + +#: library/random.rst:718 +msgid "Command-line usage" +msgstr "Χρήση από τη γραμμή εντολών" + +#: library/random.rst:722 +msgid "The :mod:`!random` module can be executed from the command line." +msgstr "Το module :mod:`!random` μπορεί να εκτελεστεί από τη γραμμή εντολών." + +#: library/random.rst:724 +msgid "" +"python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" +msgstr "" +"python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" + +#: library/random.rst:728 +msgid "The following options are accepted:" +msgstr "Αποδέχεται τις παρακάτω επιλογές:" + +#: library/random.rst:734 +msgid "Show the help message and exit." +msgstr "Εμφανίζει το μήνυμα βοήθειας και εξέρχεται." + +#: library/random.rst:739 +msgid "Print a random choice, using :meth:`choice`." +msgstr "Εκτυπώνει μια τυχαία επιλογή, χρησιμοποιώντας τη :meth:`choice`." + +#: library/random.rst:744 +msgid "" +"Print a random integer between 1 and N inclusive, using :meth:`randint`." +msgstr "" +"Εκτυπώνει έναν τυχαίο ακέραιο μεταξύ 1 και N συμπεριλαμβανομένου, " +"χρησιμοποιώντας τη :meth:`randint`." + +#: library/random.rst:749 +msgid "" +"Print a random floating-point number between 0 and N inclusive, using :meth:" +"`uniform`." +msgstr "" +"Εκτυπώνει έναν τυχαίο αριθμό κινητής υποδιαστολής μεταξύ 0 και N " +"συμπεριλαμβανομένου, χρησιμοποιώντας τη :meth:`uniform`." + +#: library/random.rst:752 +msgid "If no options are given, the output depends on the input:" +msgstr "Εάν δεν δοθούν επιλογές, η έξοδος εξαρτάται από την είσοδο:" + +#: library/random.rst:754 +msgid "String or multiple: same as :option:`--choice`." +msgstr "Συμβολοσειρά ή πολλαπλά: ίδια με την :option:`--choice`." + +#: library/random.rst:755 +msgid "Integer: same as :option:`--integer`." +msgstr "Ακέραιος: ίδια με την :option:`--integer`." + +#: library/random.rst:756 +msgid "Float: same as :option:`--float`." +msgstr "Αριθμός κινητής υποδιαστολής: ίδια με την :option:`--float`." + +#: library/random.rst:761 +msgid "Command-line example" +msgstr "Παράδειγμα από τη γραμμή εντολών" + +#: library/random.rst:763 +msgid "Here are some examples of the :mod:`!random` command-line interface:" +msgstr "" +"Εδώ είναι μερικά παραδείγματα της διεπαφής γραμμής εντολών του :mod:`!" +"random`:" + +#: library/random.rst:765 +msgid "" +"$ # Choose one at random\n" +"$ python -m random egg bacon sausage spam \"Lobster Thermidor aux crevettes " +"with a Mornay sauce\"\n" +"Lobster Thermidor aux crevettes with a Mornay sauce\n" +"\n" +"$ # Random integer\n" +"$ python -m random 6\n" +"6\n" +"\n" +"$ # Random floating-point number\n" +"$ python -m random 1.8\n" +"1.7080016272295635\n" +"\n" +"$ # With explicit arguments\n" +"$ python -m random --choice egg bacon sausage spam \"Lobster Thermidor aux " +"crevettes with a Mornay sauce\"\n" +"egg\n" +"\n" +"$ python -m random --integer 6\n" +"3\n" +"\n" +"$ python -m random --float 1.8\n" +"1.5666339105010318\n" +"\n" +"$ python -m random --integer 6\n" +"5\n" +"\n" +"$ python -m random --float 6\n" +"3.1942323316565915" +msgstr "" +"$ # Choose one at random\n" +"$ python -m random egg bacon sausage spam \"Lobster Thermidor aux crevettes " +"with a Mornay sauce\"\n" +"Lobster Thermidor aux crevettes with a Mornay sauce\n" +"\n" +"$ # Random integer\n" +"$ python -m random 6\n" +"6\n" +"\n" +"$ # Random floating-point number\n" +"$ python -m random 1.8\n" +"1.7080016272295635\n" +"\n" +"$ # With explicit arguments\n" +"$ python -m random --choice egg bacon sausage spam \"Lobster Thermidor aux " +"crevettes with a Mornay sauce\"\n" +"egg\n" +"\n" +"$ python -m random --integer 6\n" +"3\n" +"\n" +"$ python -m random --float 1.8\n" +"1.5666339105010318\n" +"\n" +"$ python -m random --integer 6\n" +"5\n" +"\n" +"$ python -m random --float 6\n" +"3.1942323316565915" diff --git a/library/re.po b/library/re.po index 9fc7a605..05af6c17 100644 --- a/library/re.po +++ b/library/re.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/re.rst:2 -msgid ":mod:`re` --- Regular expression operations" +msgid ":mod:`!re` --- Regular expression operations" msgstr "" #: library/re.rst:10 @@ -75,9 +76,9 @@ msgstr "" #: library/re.rst:51 msgid "" -"The third-party `regex `_ module, which has " -"an API compatible with the standard library :mod:`re` module, but offers " -"additional functionality and a more thorough Unicode support." +"The third-party :pypi:`regex` module, which has an API compatible with the " +"standard library :mod:`re` module, but offers additional functionality and a " +"more thorough Unicode support." msgstr "" #: library/re.rst:59 @@ -144,7 +145,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: library/re.rst:1606 +#: library/re.rst:1663 msgid "``.``" msgstr "" @@ -152,10 +153,10 @@ msgstr "" msgid "" "(Dot.) In the default mode, this matches any character except a newline. " "If the :const:`DOTALL` flag has been specified, this matches any character " -"including a newline." +"including a newline. ``(?s:.)`` matches any character regardless of flags." msgstr "" -#: library/re.rst:110 +#: library/re.rst:108 msgid "``^``" msgstr "" @@ -165,7 +166,7 @@ msgid "" "also matches immediately after each newline." msgstr "" -#: library/re.rst:121 +#: library/re.rst:114 msgid "``$``" msgstr "" @@ -181,7 +182,7 @@ msgid "" "string." msgstr "" -#: library/re.rst:128 +#: library/re.rst:125 msgid "``*``" msgstr "" @@ -192,7 +193,7 @@ msgid "" "followed by any number of 'b's." msgstr "" -#: library/re.rst:135 +#: library/re.rst:132 msgid "``+``" msgstr "" @@ -203,7 +204,7 @@ msgid "" "match just 'a'." msgstr "" -#: library/re.rst:141 +#: library/re.rst:139 msgid "``?``" msgstr "" @@ -213,7 +214,7 @@ msgid "" "``ab?`` will match either 'a' or 'ab'." msgstr "" -#: library/re.rst:155 +#: library/re.rst:148 msgid "``*?``, ``+?``, ``??``" msgstr "" @@ -228,7 +229,7 @@ msgid "" "only ``''``." msgstr "" -#: library/re.rst:179 +#: library/re.rst:162 msgid "``*+``, ``++``, ``?+``" msgstr "" @@ -249,7 +250,7 @@ msgid "" "``(?>x?)`` correspondingly." msgstr "" -#: library/re.rst:187 +#: library/re.rst:184 msgid "``{m}``" msgstr "" @@ -260,7 +261,7 @@ msgid "" "match exactly six ``'a'`` characters, but not five." msgstr "" -#: library/re.rst:196 +#: library/re.rst:189 msgid "``{m,n}``" msgstr "" @@ -276,7 +277,7 @@ msgid "" "described form." msgstr "" -#: library/re.rst:203 +#: library/re.rst:198 msgid "``{m,n}?``" msgstr "" @@ -289,7 +290,7 @@ msgid "" "while ``a{3,5}?`` will only match 3 characters." msgstr "" -#: library/re.rst:218 +#: library/re.rst:205 msgid "``{m,n}+``" msgstr "" @@ -306,7 +307,7 @@ msgid "" "``aa`` in the pattern. ``x{m,n}+`` is equivalent to ``(?>x{m,n})``." msgstr "" -#: library/re.rst:233 +#: library/re.rst:222 msgid "``\\``" msgstr "" @@ -328,7 +329,7 @@ msgid "" "recommended that you use raw strings for all but the simplest expressions." msgstr "" -#: library/re.rst:293 +#: library/re.rst:238 msgid "``[]``" msgstr "" @@ -354,19 +355,24 @@ msgstr "" #: library/re.rst:253 msgid "" -"Special characters lose their special meaning inside sets. For example, " -"``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, " -"``'*'``, or ``')'``." +"Special characters except backslash lose their special meaning inside sets. " +"For example, ``[(+*)]`` will match any of the literal characters ``'('``, " +"``'+'``, ``'*'``, or ``')'``." msgstr "" -#: library/re.rst:259 +#: library/re.rst:260 msgid "" -"Character classes such as ``\\w`` or ``\\S`` (defined below) are also " -"accepted inside a set, although the characters they match depend on the " -"flags_ used." +"Backslash either escapes characters which have special meaning in a set such " +"as ``'-'``, ``']'``, ``'^'`` and ``'\\\\'`` itself or signals a special " +"sequence which represents a single character such as ``\\xa0`` or ``\\n`` or " +"a character class such as ``\\w`` or ``\\S`` (defined below). Note that " +"``\\b`` represents a single \"backspace\" character, not a word boundary as " +"outside a set, and numeric escapes such as ``\\1`` are always octal escapes, " +"not group references. Special sequences which do not match a single " +"character such as ``\\A`` and ``\\z`` are not allowed." msgstr "" -#: library/re.rst:264 +#: library/re.rst:273 msgid "" "Characters that are not within a range can be matched by :dfn:" "`complementing` the set. If the first character of the set is ``'^'``, all " @@ -376,7 +382,7 @@ msgid "" "first character in the set." msgstr "" -#: library/re.rst:271 +#: library/re.rst:280 msgid "" "To match a literal ``']'`` inside a set, precede it with a backslash, or " "place it at the beginning of the set. For example, both ``[()[\\]{}]`` and " @@ -384,7 +390,7 @@ msgid "" "and parentheses." msgstr "" -#: library/re.rst:281 +#: library/re.rst:290 msgid "" "Support of nested sets and set operations as in `Unicode Technical Standard " "#18`_ might be added in the future. This would change the syntax, so to " @@ -394,7 +400,7 @@ msgid "" "``'||'``. To avoid a warning escape them with a backslash." msgstr "" -#: library/re.rst:291 +#: library/re.rst:300 msgid "" ":exc:`FutureWarning` is raised if a character set contains constructs that " "will change semantically in the future." @@ -404,7 +410,7 @@ msgstr "" msgid "``|``" msgstr "" -#: library/re.rst:298 +#: library/re.rst:307 msgid "" "``A|B``, where *A* and *B* can be arbitrary REs, creates a regular " "expression that will match either *A* or *B*. An arbitrary number of REs " @@ -417,11 +423,11 @@ msgid "" "use ``\\|``, or enclose it inside a character class, as in ``[|]``." msgstr "" -#: library/re.rst:316 +#: library/re.rst:320 msgid "``(...)``" msgstr "" -#: library/re.rst:312 +#: library/re.rst:321 msgid "" "Matches whatever regular expression is inside the parentheses, and indicates " "the start and end of a group; the contents of a group can be retrieved after " @@ -431,11 +437,11 @@ msgid "" "character class: ``[(]``, ``[)]``." msgstr "" -#: library/re.rst:325 +#: library/re.rst:329 msgid "``(?...)``" msgstr "" -#: library/re.rst:321 +#: library/re.rst:330 msgid "" "This is an extension notation (a ``'?'`` following a ``'('`` is not " "meaningful otherwise). The first character after the ``'?'`` determines " @@ -444,46 +450,46 @@ msgid "" "rule. Following are the currently supported extensions." msgstr "" -#: library/re.rst:348 +#: library/re.rst:336 msgid "``(?aiLmsux)``" msgstr "" -#: library/re.rst:328 +#: library/re.rst:337 msgid "" "(One or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``.) The group matches the empty string; the letters " "set the corresponding flags for the entire regular expression:" msgstr "" -#: library/re.rst:365 +#: library/re.rst:374 msgid ":const:`re.A` (ASCII-only matching)" msgstr "" -#: library/re.rst:366 +#: library/re.rst:375 msgid ":const:`re.I` (ignore case)" msgstr "" -#: library/re.rst:367 +#: library/re.rst:376 msgid ":const:`re.L` (locale dependent)" msgstr "" -#: library/re.rst:368 +#: library/re.rst:377 msgid ":const:`re.M` (multi-line)" msgstr "" -#: library/re.rst:369 +#: library/re.rst:378 msgid ":const:`re.S` (dot matches all)" msgstr "" -#: library/re.rst:370 +#: library/re.rst:379 msgid ":const:`re.U` (Unicode matching)" msgstr "" -#: library/re.rst:371 +#: library/re.rst:380 msgid ":const:`re.X` (verbose)" msgstr "" -#: library/re.rst:341 +#: library/re.rst:350 msgid "" "(The flags are described in :ref:`contents-of-module-re`.) This is useful if " "you wish to include the flags as part of the regular expression, instead of " @@ -491,15 +497,15 @@ msgid "" "be used first in the expression string." msgstr "" -#: library/re.rst:347 +#: library/re.rst:356 msgid "This construction can only be used at the start of the expression." msgstr "" -#: library/re.rst:356 +#: library/re.rst:361 msgid "``(?:...)``" msgstr "" -#: library/re.rst:353 +#: library/re.rst:362 msgid "" "A non-capturing version of regular parentheses. Matches whatever regular " "expression is inside the parentheses, but the substring matched by the group " @@ -507,11 +513,11 @@ msgid "" "pattern." msgstr "" -#: library/re.rst:388 +#: library/re.rst:367 msgid "``(?aiLmsux-imsx:...)``" msgstr "" -#: library/re.rst:359 +#: library/re.rst:368 msgid "" "(Zero or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``, optionally followed by ``'-'`` followed by one or " @@ -519,11 +525,11 @@ msgid "" "or remove the corresponding flags for the part of the expression:" msgstr "" -#: library/re.rst:373 +#: library/re.rst:382 msgid "(The flags are described in :ref:`contents-of-module-re`.)" msgstr "" -#: library/re.rst:375 +#: library/re.rst:384 msgid "" "The letters ``'a'``, ``'L'`` and ``'u'`` are mutually exclusive when used as " "inline flags, so they can't be combined or follow ``'-'``. Instead, when " @@ -536,15 +542,15 @@ msgid "" "restored outside of the group." msgstr "" -#: library/re.rst:387 +#: library/re.rst:396 msgid "The letters ``'a'``, ``'L'`` and ``'u'`` also can be used in a group." msgstr "" -#: library/re.rst:403 +#: library/re.rst:399 msgid "``(?>...)``" msgstr "" -#: library/re.rst:391 +#: library/re.rst:400 msgid "" "Attempts to match ``...`` as if it was a separate regular expression, and if " "successful, continues to match the rest of the pattern following it. If the " @@ -558,11 +564,11 @@ msgid "" "thus fail to match." msgstr "" -#: library/re.rst:435 +#: library/re.rst:416 msgid "``(?P...)``" msgstr "" -#: library/re.rst:408 +#: library/re.rst:417 msgid "" "Similar to regular parentheses, but the substring matched by the group is " "accessible via the symbolic group name *name*. Group names must be valid " @@ -572,108 +578,108 @@ msgid "" "the group were not named." msgstr "" -#: library/re.rst:415 +#: library/re.rst:424 msgid "" "Named groups can be referenced in three contexts. If the pattern is ``(?" "P['\"]).*?(?P=quote)`` (i.e. matching a string quoted with either " "single or double quotes):" msgstr "" -#: library/re.rst:420 +#: library/re.rst:429 msgid "Context of reference to group \"quote\"" msgstr "" -#: library/re.rst:420 +#: library/re.rst:429 msgid "Ways to reference it" msgstr "" -#: library/re.rst:422 +#: library/re.rst:431 msgid "in the same pattern itself" msgstr "" -#: library/re.rst:422 +#: library/re.rst:431 msgid "``(?P=quote)`` (as shown)" msgstr "" -#: library/re.rst:430 +#: library/re.rst:439 msgid "``\\1``" msgstr "" -#: library/re.rst:425 +#: library/re.rst:434 msgid "when processing match object *m*" msgstr "" -#: library/re.rst:425 +#: library/re.rst:434 msgid "``m.group('quote')``" msgstr "" -#: library/re.rst:426 +#: library/re.rst:435 msgid "``m.end('quote')`` (etc.)" msgstr "" -#: library/re.rst:428 +#: library/re.rst:437 msgid "in a string passed to the *repl* argument of ``re.sub()``" msgstr "" -#: library/re.rst:428 +#: library/re.rst:437 msgid "``\\g``" msgstr "" -#: library/re.rst:429 +#: library/re.rst:438 msgid "``\\g<1>``" msgstr "" -#: library/re.rst:433 +#: library/re.rst:442 msgid "" "In :class:`bytes` patterns, group *name* can only contain bytes in the ASCII " "range (``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: library/re.rst:441 +#: library/re.rst:448 msgid "``(?P=name)``" msgstr "" -#: library/re.rst:440 +#: library/re.rst:449 msgid "" "A backreference to a named group; it matches whatever text was matched by " "the earlier group named *name*." msgstr "" -#: library/re.rst:446 +#: library/re.rst:454 msgid "``(?#...)``" msgstr "" -#: library/re.rst:446 +#: library/re.rst:455 msgid "A comment; the contents of the parentheses are simply ignored." msgstr "" -#: library/re.rst:453 +#: library/re.rst:459 msgid "``(?=...)``" msgstr "" -#: library/re.rst:451 +#: library/re.rst:460 msgid "" "Matches if ``...`` matches next, but doesn't consume any of the string. " "This is called a :dfn:`lookahead assertion`. For example, ``Isaac (?" "=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``." msgstr "" -#: library/re.rst:460 +#: library/re.rst:466 msgid "``(?!...)``" msgstr "" -#: library/re.rst:458 +#: library/re.rst:467 msgid "" "Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead " "assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only " "if it's *not* followed by ``'Asimov'``." msgstr "" -#: library/re.rst:487 +#: library/re.rst:473 msgid "``(?<=...)``" msgstr "" -#: library/re.rst:465 +#: library/re.rst:474 msgid "" "Matches if the current position in the string is preceded by a match for " "``...`` that ends at the current position. This is called a :dfn:`positive " @@ -687,19 +693,19 @@ msgid "" "func:`match` function:" msgstr "" -#: library/re.rst:480 +#: library/re.rst:489 msgid "This example looks for a word following a hyphen:" msgstr "" -#: library/re.rst:486 +#: library/re.rst:495 msgid "Added support for group references of fixed length." msgstr "" -#: library/re.rst:496 +#: library/re.rst:500 msgid "``(?'``." msgstr "" -#: library/re.rst:509 +#: library/re.rst:518 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` patterns, group " "*name* can only contain bytes in the ASCII range (``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: library/re.rst:517 +#: library/re.rst:526 msgid "" "The special sequences consist of ``'\\'`` and a character from the list " "below. If the ordinary character is not an ASCII digit or an ASCII letter, " @@ -736,11 +742,11 @@ msgid "" "matches the character ``'$'``." msgstr "" -#: library/re.rst:532 +#: library/re.rst:533 msgid "``\\number``" msgstr "" -#: library/re.rst:525 +#: library/re.rst:534 msgid "" "Matches the contents of the group of the same number. Groups are numbered " "starting from 1. For example, ``(.+) \\1`` matches ``'the the'`` or ``'55 " @@ -752,19 +758,19 @@ msgid "" "escapes are treated as characters." msgstr "" -#: library/re.rst:537 +#: library/re.rst:545 msgid "``\\A``" msgstr "" -#: library/re.rst:537 +#: library/re.rst:546 msgid "Matches only at the start of the string." msgstr "" -#: library/re.rst:559 +#: library/re.rst:550 msgid "``\\b``" msgstr "" -#: library/re.rst:542 +#: library/re.rst:551 msgid "" "Matches the empty string, but only at the beginning or end of a word. A word " "is defined as a sequence of word characters. Note that formally, ``\\b`` is " @@ -774,7 +780,7 @@ msgid "" "``'as at ay'`` but not ``'attempt'`` or ``'atlas'``." msgstr "" -#: library/re.rst:550 +#: library/re.rst:559 msgid "" "The default word characters in Unicode (str) patterns are Unicode " "alphanumerics and the underscore, but this can be changed by using the :py:" @@ -782,17 +788,17 @@ msgid "" "if the :py:const:`~re.LOCALE` flag is used." msgstr "" -#: library/re.rst:558 +#: library/re.rst:567 msgid "" "Inside a character range, ``\\b`` represents the backspace character, for " "compatibility with Python's string literals." msgstr "" -#: library/re.rst:573 +#: library/re.rst:572 msgid "``\\B``" msgstr "" -#: library/re.rst:564 +#: library/re.rst:573 msgid "" "Matches the empty string, but only when it is *not* at the beginning or end " "of a word. This means that ``r'at\\B'`` matches ``'athens'``, ``'atom'``, " @@ -803,102 +809,107 @@ msgid "" "current locale if the :py:const:`~re.LOCALE` flag is used." msgstr "" +#: library/re.rst:584 +msgid "``\\B`` now matches empty input string." +msgstr "" + #: library/re.rst:589 msgid "``\\d``" msgstr "" -#: library/re.rst:608 library/re.rst:631 +#: library/re.rst:614 library/re.rst:636 msgid "For Unicode (str) patterns:" msgstr "" -#: library/re.rst:579 +#: library/re.rst:591 msgid "" "Matches any Unicode decimal digit (that is, any character in Unicode " "character category `[Nd]`__). This includes ``[0-9]``, and also many other " "digit characters." msgstr "" -#: library/re.rst:583 +#: library/re.rst:595 msgid "Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: library/re.rst:612 library/re.rst:637 +#: library/re.rst:621 library/re.rst:644 msgid "For 8-bit (bytes) patterns:" msgstr "" -#: library/re.rst:588 +#: library/re.rst:600 msgid "" "Matches any decimal digit in the ASCII character set; this is equivalent to " "``[0-9]``." msgstr "" -#: library/re.rst:597 +#: library/re.rst:605 msgid "``\\D``" msgstr "" -#: library/re.rst:594 +#: library/re.rst:606 msgid "" "Matches any character which is not a decimal digit. This is the opposite of " "``\\d``." msgstr "" -#: library/re.rst:597 +#: library/re.rst:609 msgid "Matches ``[^0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: library/re.rst:612 +#: library/re.rst:613 msgid "``\\s``" msgstr "" -#: library/re.rst:603 +#: library/re.rst:615 msgid "" -"Matches Unicode whitespace characters (which includes " -"``[ \\t\\n\\r\\f\\v]``, and also many other characters, for example the non-" -"breaking spaces mandated by typography rules in many languages)." +"Matches Unicode whitespace characters (as defined by :py:meth:`str." +"isspace`). This includes ``[ \\t\\n\\r\\f\\v]``, and also many other " +"characters, for example the non-breaking spaces mandated by typography rules " +"in many languages." msgstr "" -#: library/re.rst:608 +#: library/re.rst:619 msgid "" "Matches ``[ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: library/re.rst:611 +#: library/re.rst:622 msgid "" "Matches characters considered whitespace in the ASCII character set; this is " "equivalent to ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: library/re.rst:620 +#: library/re.rst:627 msgid "``\\S``" msgstr "" -#: library/re.rst:617 +#: library/re.rst:628 msgid "" "Matches any character which is not a whitespace character. This is the " "opposite of ``\\s``." msgstr "" -#: library/re.rst:620 +#: library/re.rst:631 msgid "" "Matches ``[^ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: library/re.rst:637 +#: library/re.rst:635 msgid "``\\w``" msgstr "" -#: library/re.rst:626 +#: library/re.rst:637 msgid "" "Matches Unicode word characters; this includes all Unicode alphanumeric " "characters (as defined by :py:meth:`str.isalnum`), as well as the underscore " "(``_``)." msgstr "" -#: library/re.rst:631 +#: library/re.rst:642 msgid "Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: library/re.rst:634 +#: library/re.rst:645 msgid "" "Matches characters considered alphanumeric in the ASCII character set; this " "is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is " @@ -906,55 +917,70 @@ msgid "" "the underscore." msgstr "" -#: library/re.rst:651 +#: library/re.rst:652 msgid "``\\W``" msgstr "" -#: library/re.rst:642 +#: library/re.rst:653 msgid "" "Matches any character which is not a word character. This is the opposite of " "``\\w``. By default, matches non-underscore (``_``) characters for which :py:" "meth:`str.isalnum` returns ``False``." msgstr "" -#: library/re.rst:647 +#: library/re.rst:658 msgid "Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: library/re.rst:649 +#: library/re.rst:660 msgid "" "If the :py:const:`~re.LOCALE` flag is used, matches characters which are " "neither alphanumeric in the current locale nor the underscore." msgstr "" -#: library/re.rst:656 -msgid "``\\Z``" +#: library/re.rst:667 +msgid "``\\z``" msgstr "" -#: library/re.rst:656 +#: library/re.rst:668 msgid "Matches only at the end of the string." msgstr "" #: library/re.rst:672 +msgid "``\\Z``" +msgstr "" + +#: library/re.rst:673 +msgid "The same as ``\\z``. For compatibility with old Python versions." +msgstr "" + +#: library/re.rst:689 msgid "" "Most of the :ref:`escape sequences ` supported by Python " "string literals are also accepted by the regular expression parser::" msgstr "" -#: library/re.rst:679 +#: library/re.rst:692 +msgid "" +"\\a \\b \\f \\n\n" +"\\N \\r \\t \\u\n" +"\\U \\v \\x \\\\" +msgstr "" + +#: library/re.rst:696 msgid "" "(Note that ``\\b`` is used to represent word boundaries, and means " "\"backspace\" only inside character classes.)" msgstr "" -#: library/re.rst:682 +#: library/re.rst:699 msgid "" "``'\\u'``, ``'\\U'``, and ``'\\N'`` escape sequences are only recognized in " "Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes " "of ASCII letters are reserved for future use and treated as errors." msgstr "" -#: library/re.rst:688 +#: library/re.rst:705 msgid "" "Octal escapes are included in a limited form. If the first digit is a 0, or " "if there are three octal digits, it is considered an octal escape. " @@ -962,27 +988,27 @@ msgid "" "are always at most three digits in length." msgstr "" -#: library/re.rst:693 +#: library/re.rst:710 msgid "The ``'\\u'`` and ``'\\U'`` escape sequences have been added." msgstr "" -#: library/re.rst:696 +#: library/re.rst:713 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter now are errors." msgstr "" -#: library/re.rst:699 +#: library/re.rst:716 msgid "" "The :samp:`'\\\\N\\\\{{name}\\\\}'` escape sequence has been added. As in " "string literals, it expands to the named Unicode character (e.g. ``'\\N{EM " "DASH}'``)." msgstr "" -#: library/re.rst:707 +#: library/re.rst:724 msgid "Module Contents" msgstr "" -#: library/re.rst:709 +#: library/re.rst:726 msgid "" "The module defines several functions, constants, and an exception. Some of " "the functions are simplified versions of the full featured methods for " @@ -990,26 +1016,26 @@ msgid "" "compiled form." msgstr "" -#: library/re.rst:716 +#: library/re.rst:733 msgid "Flags" msgstr "" -#: library/re.rst:718 +#: library/re.rst:735 msgid "" "Flag constants are now instances of :class:`RegexFlag`, which is a subclass " "of :class:`enum.IntFlag`." msgstr "" -#: library/re.rst:725 +#: library/re.rst:742 msgid "" "An :class:`enum.IntFlag` class containing the regex options listed below." msgstr "" -#: library/re.rst:727 +#: library/re.rst:744 msgid "- added to ``__all__``" msgstr "" -#: library/re.rst:732 +#: library/re.rst:749 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\d``, ``\\D``, ``\\s`` and " "``\\S`` perform ASCII-only matching instead of full Unicode matching. This " @@ -1017,11 +1043,11 @@ msgid "" "patterns." msgstr "" -#: library/re.rst:736 +#: library/re.rst:753 msgid "Corresponds to the inline flag ``(?a)``." msgstr "" -#: library/re.rst:740 +#: library/re.rst:757 msgid "" "The :py:const:`~re.U` flag still exists for backward compatibility, but is " "redundant in Python 3 since matches are Unicode by default for ``str`` " @@ -1029,15 +1055,15 @@ msgid "" "`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant." msgstr "" -#: library/re.rst:749 +#: library/re.rst:766 msgid "Display debug information about compiled expression." msgstr "" -#: library/re.rst:751 +#: library/re.rst:768 msgid "No corresponding inline flag." msgstr "" -#: library/re.rst:757 +#: library/re.rst:774 msgid "" "Perform case-insensitive matching; expressions like ``[A-Z]`` will also " "match lowercase letters. Full Unicode matching (such as ``Ü`` matching " @@ -1046,11 +1072,11 @@ msgid "" "flag unless the :py:const:`~re.LOCALE` flag is also used." msgstr "" -#: library/re.rst:765 +#: library/re.rst:782 msgid "Corresponds to the inline flag ``(?i)``." msgstr "" -#: library/re.rst:767 +#: library/re.rst:784 msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " @@ -1061,18 +1087,18 @@ msgid "" "'Z' are matched." msgstr "" -#: library/re.rst:778 +#: library/re.rst:795 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " "dependent on the current locale. This flag can be used only with bytes " "patterns." msgstr "" -#: library/re.rst:782 +#: library/re.rst:799 msgid "Corresponds to the inline flag ``(?L)``." msgstr "" -#: library/re.rst:786 +#: library/re.rst:803 msgid "" "This flag is discouraged; consider Unicode matching instead. The locale " "mechanism is very unreliable as it only handles one \"culture\" at a time " @@ -1081,20 +1107,20 @@ msgid "" "languages." msgstr "" -#: library/re.rst:793 +#: library/re.rst:810 msgid "" ":py:const:`~re.LOCALE` can be used only with bytes patterns and is not " "compatible with :py:const:`~re.ASCII`." msgstr "" -#: library/re.rst:797 +#: library/re.rst:814 msgid "" "Compiled regular expression objects with the :py:const:`~re.LOCALE` flag no " "longer depend on the locale at compile time. Only the locale at matching " "time affects the result of matching." msgstr "" -#: library/re.rst:806 +#: library/re.rst:823 msgid "" "When specified, the pattern character ``'^'`` matches at the beginning of " "the string and at the beginning of each line (immediately following each " @@ -1105,11 +1131,11 @@ msgid "" "the end of the string." msgstr "" -#: library/re.rst:813 +#: library/re.rst:830 msgid "Corresponds to the inline flag ``(?m)``." msgstr "" -#: library/re.rst:817 +#: library/re.rst:834 msgid "" "Indicates no flag being applied, the value is ``0``. This flag may be used " "as a default value for a function keyword argument or as a base value that " @@ -1117,29 +1143,35 @@ msgid "" "value::" msgstr "" -#: library/re.rst:830 +#: library/re.rst:839 +msgid "" +"def myfunc(text, flag=re.NOFLAG):\n" +" return re.match(text, flag)" +msgstr "" + +#: library/re.rst:847 msgid "" "Make the ``'.'`` special character match any character at all, including a " "newline; without this flag, ``'.'`` will match anything *except* a newline." msgstr "" -#: library/re.rst:833 +#: library/re.rst:850 msgid "Corresponds to the inline flag ``(?s)``." msgstr "" -#: library/re.rst:839 +#: library/re.rst:856 msgid "" "In Python 3, Unicode characters are matched by default for ``str`` patterns. " "This flag is therefore redundant with **no effect** and is only kept for " "backward compatibility." msgstr "" -#: library/re.rst:844 +#: library/re.rst:861 msgid "" "See :py:const:`~re.ASCII` to restrict matching to ASCII characters instead." msgstr "" -#: library/re.rst:851 +#: library/re.rst:868 msgid "" "This flag allows you to write regular expressions that look nicer and are " "more readable by allowing you to visually separate logical sections of the " @@ -1152,50 +1184,69 @@ msgid "" "ignored." msgstr "" -#: library/re.rst:861 +#: library/re.rst:878 msgid "" "This means that the two following regular expression objects that match a " "decimal number are functionally equal::" msgstr "" -#: library/re.rst:869 +#: library/re.rst:881 +msgid "" +"a = re.compile(r\"\"\"\\d + # the integral part\n" +" \\. # the decimal point\n" +" \\d * # some fractional digits\"\"\", re.X)\n" +"b = re.compile(r\"\\d+\\.\\d*\")" +msgstr "" + +#: library/re.rst:886 msgid "Corresponds to the inline flag ``(?x)``." msgstr "" -#: library/re.rst:873 +#: library/re.rst:890 msgid "Functions" msgstr "" -#: library/re.rst:877 +#: library/re.rst:894 msgid "" "Compile a regular expression pattern into a :ref:`regular expression object " "`, which can be used for matching using its :func:`~Pattern." "match`, :func:`~Pattern.search` and other methods, described below." msgstr "" -#: library/re.rst:882 +#: library/re.rst:931 library/re.rst:960 library/re.rst:1040 +#: library/re.rst:1117 library/re.rst:1152 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " "``|`` operator)." msgstr "" -#: library/re.rst:886 +#: library/re.rst:903 msgid "The sequence ::" msgstr "" -#: library/re.rst:891 +#: library/re.rst:905 +msgid "" +"prog = re.compile(pattern)\n" +"result = prog.match(string)" +msgstr "" + +#: library/re.rst:908 msgid "is equivalent to ::" msgstr "" -#: library/re.rst:895 +#: library/re.rst:910 +msgid "result = re.match(pattern, string)" +msgstr "" + +#: library/re.rst:912 msgid "" "but using :func:`re.compile` and saving the resulting regular expression " "object for reuse is more efficient when the expression will be used several " "times in a single program." msgstr "" -#: library/re.rst:901 +#: library/re.rst:918 msgid "" "The compiled versions of the most recent patterns passed to :func:`re." "compile` and the module-level matching functions are cached, so programs " @@ -1203,7 +1254,7 @@ msgid "" "compiling regular expressions." msgstr "" -#: library/re.rst:909 +#: library/re.rst:926 msgid "" "Scan through *string* looking for the first location where the regular " "expression *pattern* produces a match, and return a corresponding :class:" @@ -1212,7 +1263,7 @@ msgid "" "some point in the string." msgstr "" -#: library/re.rst:917 +#: library/re.rst:938 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :class:`~re.Match`. Return " @@ -1220,26 +1271,26 @@ msgid "" "different from a zero-length match." msgstr "" -#: library/re.rst:922 +#: library/re.rst:943 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." msgstr "" -#: library/re.rst:925 +#: library/re.rst:946 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." msgstr "" -#: library/re.rst:931 +#: library/re.rst:956 msgid "" "If the whole *string* matches the regular expression *pattern*, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: library/re.rst:940 +#: library/re.rst:969 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1248,42 +1299,78 @@ msgid "" "final element of the list. ::" msgstr "" -#: library/re.rst:955 +#: library/re.rst:975 +msgid "" +">>> re.split(r'\\W+', 'Words, words, words.')\n" +"['Words', 'words', 'words', '']\n" +">>> re.split(r'(\\W+)', 'Words, words, words.')\n" +"['Words', ', ', 'words', ', ', 'words', '.', '']\n" +">>> re.split(r'\\W+', 'Words, words, words.', maxsplit=1)\n" +"['Words', 'words, words.']\n" +">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" +"['0', '3', '9']" +msgstr "" + +#: library/re.rst:984 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " "for the end of the string::" msgstr "" -#: library/re.rst:962 +#: library/re.rst:988 +msgid "" +">>> re.split(r'(\\W+)', '...words, words...')\n" +"['', '...', 'words', ', ', 'words', '...', '']" +msgstr "" + +#: library/re.rst:991 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." msgstr "" -#: library/re.rst:965 +#: library/re.rst:994 +msgid "" +"Adjacent empty matches are not possible, but an empty match can occur " +"immediately after a non-empty match." +msgstr "" + +#: library/re.rst:997 msgid "" -"Empty matches for the pattern split the string only when not adjacent to a " -"previous empty match." +">>> re.split(r'\\b', 'Words, words, words.')\n" +"['', 'Words', ', ', 'words', ', ', 'words', '.']\n" +">>> re.split(r'\\W*', '...words...')\n" +"['', '', 'w', 'o', 'r', 'd', 's', '', '']\n" +">>> re.split(r'(\\W*)', '...words...')\n" +"['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " +"'']" msgstr "" -#: library/re.rst:1068 library/re.rst:1097 +#: library/re.rst:1121 msgid "Added the optional flags argument." msgstr "" -#: library/re.rst:980 +#: library/re.rst:1013 msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "" -#: library/re.rst:986 +#: library/re.rst:1016 +msgid "" +"Passing *maxsplit* and *flags* as positional arguments is deprecated. In " +"future Python versions they will be :ref:`keyword-only parameters `." +msgstr "" + +#: library/re.rst:1024 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " "returned in the order found. Empty matches are included in the result." msgstr "" -#: library/re.rst:990 +#: library/re.rst:1028 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1293,11 +1380,11 @@ msgid "" "result." msgstr "" -#: library/re.rst:1013 +#: library/re.rst:1059 msgid "Non-empty matches can now start just after a previous empty match." msgstr "" -#: library/re.rst:1008 +#: library/re.rst:1050 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " @@ -1305,7 +1392,7 @@ msgid "" "matches are included in the result." msgstr "" -#: library/re.rst:1019 +#: library/re.rst:1065 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1319,27 +1406,53 @@ msgid "" "For example::" msgstr "" -#: library/re.rst:1035 +#: library/re.rst:1076 +msgid "" +">>> re.sub(r'def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):',\n" +"... r'static PyObject*\\npy_\\1(void)\\n{',\n" +"... 'def myfunc():')\n" +"'static PyObject*\\npy_myfunc(void)\\n{'" +msgstr "" + +#: library/re.rst:1081 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " "returns the replacement string. For example::" msgstr "" -#: library/re.rst:1048 +#: library/re.rst:1085 +msgid "" +">>> def dashrepl(matchobj):\n" +"... if matchobj.group(0) == '-': return ' '\n" +"... else: return '-'\n" +"...\n" +">>> re.sub('-{1,2}', dashrepl, 'pro----gram-files')\n" +"'pro--gram files'\n" +">>> re.sub(r'\\sAND\\s', ' & ', 'Baked Beans And Spam', flags=re." +"IGNORECASE)\n" +"'Baked Beans & Spam'" +msgstr "" + +#: library/re.rst:1094 msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "" -#: library/re.rst:1050 +#: library/re.rst:1096 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " -"all occurrences will be replaced. Empty matches for the pattern are replaced " -"only when not adjacent to a previous empty match, so ``sub('x*', '-', " -"'abxd')`` returns ``'-a-b--d-'``." +"all occurrences will be replaced." +msgstr "" + +#: library/re.rst:1100 +msgid "" +"Adjacent empty matches are not possible, but an empty match can occur " +"immediately after a non-empty match. As a result, ``sub('x*', '-', 'abxd')`` " +"returns ``'-a-b--d-'`` instead of ``'-a-b-d-'``." msgstr "" -#: library/re.rst:1058 +#: library/re.rst:1107 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1352,59 +1465,83 @@ msgid "" "RE." msgstr "" -#: library/re.rst:1100 library/re.rst:1344 +#: library/re.rst:1401 msgid "Unmatched groups are replaced with an empty string." msgstr "" -#: library/re.rst:1074 +#: library/re.rst:1127 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" -#: library/re.rst:1078 +#: library/re.rst:1131 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " -"errors." +"errors. An empty match can occur immediately after a non-empty match." msgstr "" -#: library/re.rst:1082 -msgid "" -"Empty matches for the pattern are replaced when adjacent to a previous non-" -"empty match." -msgstr "" - -#: library/re.rst:1086 +#: library/re.rst:1136 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " "(``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: library/re.rst:1094 +#: library/re.rst:1141 +msgid "" +"Passing *count* and *flags* as positional arguments is deprecated. In future " +"Python versions they will be :ref:`keyword-only parameters `." +msgstr "" + +#: library/re.rst:1149 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" -#: library/re.rst:1106 +#: library/re.rst:1159 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " "in it. For example::" msgstr "" -#: library/re.rst:1121 +#: library/re.rst:1163 +msgid "" +">>> print(re.escape('https://www.python.org'))\n" +"https://www\\.python\\.org\n" +"\n" +">>> legal_chars = string.ascii_lowercase + string.digits + \"!#$%&'*+-.^_`|~:" +"\"\n" +">>> print('[%s]+' % re.escape(legal_chars))\n" +"[abcdefghijklmnopqrstuvwxyz0123456789!\\#\\$%\\&'\\*\\+\\-\\.\\^_`\\|\\~:]+\n" +"\n" +">>> operators = ['+', '-', '*', '/', '**']\n" +">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" +"/|\\-|\\+|\\*\\*|\\*" +msgstr "" + +#: library/re.rst:1174 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" msgstr "" -#: library/re.rst:1129 +#: library/re.rst:1177 +msgid "" +">>> digits_re = r'\\d+'\n" +">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" +">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" +"/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" +msgstr "" + +#: library/re.rst:1182 msgid "The ``'_'`` character is no longer escaped." msgstr "" -#: library/re.rst:1132 +#: library/re.rst:1185 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1412,62 +1549,69 @@ msgid "" "are no longer escaped." msgstr "" -#: library/re.rst:1141 +#: library/re.rst:1194 msgid "Clear the regular expression cache." msgstr "" -#: library/re.rst:1145 +#: library/re.rst:1198 msgid "Exceptions" msgstr "" -#: library/re.rst:1149 +#: library/re.rst:1202 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " "parentheses) or when some other error occurs during compilation or " "matching. It is never an error if a string contains no match for a " -"pattern. The error instance has the following additional attributes:" +"pattern. The ``PatternError`` instance has the following additional " +"attributes:" msgstr "" -#: library/re.rst:1157 +#: library/re.rst:1210 msgid "The unformatted error message." msgstr "" -#: library/re.rst:1161 +#: library/re.rst:1214 msgid "The regular expression pattern." msgstr "" -#: library/re.rst:1165 +#: library/re.rst:1218 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "" -#: library/re.rst:1169 +#: library/re.rst:1222 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "" -#: library/re.rst:1173 +#: library/re.rst:1226 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "" -#: library/re.rst:1175 +#: library/re.rst:1228 msgid "Added additional attributes." msgstr "" -#: library/re.rst:1181 +#: library/re.rst:1231 +msgid "" +"``PatternError`` was originally named ``error``; the latter is kept as an " +"alias for backward compatibility." +msgstr "" + +#: library/re.rst:1238 msgid "Regular Expression Objects" msgstr "" -#: library/re.rst:1185 +#: library/re.rst:1242 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: library/re.rst:1187 +#: library/re.rst:1244 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: library/re.rst:1193 +#: library/re.rst:1250 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1476,7 +1620,7 @@ msgid "" "string." msgstr "" -#: library/re.rst:1198 +#: library/re.rst:1255 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1485,7 +1629,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: library/re.rst:1204 +#: library/re.rst:1261 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1495,7 +1639,15 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: library/re.rst:1219 +#: library/re.rst:1268 +msgid "" +">>> pattern = re.compile(\"d\")\n" +">>> pattern.search(\"dog\") # Match at index 0\n" +"\n" +">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" +msgstr "" + +#: library/re.rst:1276 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1503,101 +1655,129 @@ msgid "" "zero-length match." msgstr "" -#: library/re.rst:1242 +#: library/re.rst:1299 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: library/re.rst:1232 +#: library/re.rst:1284 +msgid "" +">>> pattern = re.compile(\"o\")\n" +">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " +"\"dog\".\n" +">>> pattern.match(\"dog\", 1) # Match as \"o\" is the 2nd character of " +"\"dog\".\n" +"" +msgstr "" + +#: library/re.rst:1289 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: library/re.rst:1238 +#: library/re.rst:1295 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: library/re.rst:1256 +#: library/re.rst:1302 +msgid "" +">>> pattern = re.compile(\"o[gh]\")\n" +">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " +"of \"dog\".\n" +">>> pattern.fullmatch(\"ogre\") # No match as not the full string " +"matches.\n" +">>> pattern.fullmatch(\"doggie\", 1, 3) # Matches within given limits.\n" +"" +msgstr "" + +#: library/re.rst:1313 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: library/re.rst:1261 +#: library/re.rst:1318 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: library/re.rst:1268 +#: library/re.rst:1325 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: library/re.rst:1275 +#: library/re.rst:1332 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: library/re.rst:1280 +#: library/re.rst:1337 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: library/re.rst:1285 +#: library/re.rst:1342 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." msgstr "" -#: library/re.rst:1292 +#: library/re.rst:1349 msgid "The number of capturing groups in the pattern." msgstr "" -#: library/re.rst:1297 +#: library/re.rst:1354 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: library/re.rst:1304 +#: library/re.rst:1361 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: library/re.rst:1307 +#: library/re.rst:1364 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: library/re.rst:1315 +#: library/re.rst:1372 msgid "Match Objects" msgstr "" -#: library/re.rst:1317 +#: library/re.rst:1374 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: library/re.rst:1328 +#: library/re.rst:1379 +msgid "" +"match = re.search(pattern, string)\n" +"if match:\n" +" process(match)" +msgstr "" + +#: library/re.rst:1385 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: library/re.rst:1330 +#: library/re.rst:1387 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: library/re.rst:1336 +#: library/re.rst:1393 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1607,7 +1787,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: library/re.rst:1349 +#: library/re.rst:1406 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1622,7 +1802,20 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: library/re.rst:1371 +#: library/re.rst:1418 +msgid "" +">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" +">>> m.group(0) # The entire match\n" +"'Isaac Newton'\n" +">>> m.group(1) # The first parenthesized subgroup.\n" +"'Isaac'\n" +">>> m.group(2) # The second parenthesized subgroup.\n" +"'Newton'\n" +">>> m.group(1, 2) # Multiple arguments give us a tuple.\n" +"('Isaac', 'Newton')" +msgstr "" + +#: library/re.rst:1428 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1630,54 +1823,124 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: library/re.rst:1376 +#: library/re.rst:1433 msgid "A moderately complicated example::" msgstr "" -#: library/re.rst:1384 +#: library/re.rst:1435 +msgid "" +">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " +"Reynolds\")\n" +">>> m.group('first_name')\n" +"'Malcolm'\n" +">>> m.group('last_name')\n" +"'Reynolds'" +msgstr "" + +#: library/re.rst:1441 msgid "Named groups can also be referred to by their index::" msgstr "" -#: library/re.rst:1391 +#: library/re.rst:1443 +msgid "" +">>> m.group(1)\n" +"'Malcolm'\n" +">>> m.group(2)\n" +"'Reynolds'" +msgstr "" + +#: library/re.rst:1448 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: library/re.rst:1400 +#: library/re.rst:1450 +msgid "" +">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" +">>> m.group(1) # Returns only the last match.\n" +"'c3'" +msgstr "" + +#: library/re.rst:1457 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: library/re.rst:1411 +#: library/re.rst:1460 +msgid "" +">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" +">>> m[0] # The entire match\n" +"'Isaac Newton'\n" +">>> m[1] # The first parenthesized subgroup.\n" +"'Isaac'\n" +">>> m[2] # The second parenthesized subgroup.\n" +"'Newton'" +msgstr "" + +#: library/re.rst:1468 msgid "Named groups are supported as well::" msgstr "" -#: library/re.rst:1424 +#: library/re.rst:1470 +msgid "" +">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " +"Newton\")\n" +">>> m['first_name']\n" +"'Isaac'\n" +">>> m['last_name']\n" +"'Newton'" +msgstr "" + +#: library/re.rst:1481 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: library/re.rst:1653 +#: library/re.rst:1710 msgid "For example::" msgstr "" -#: library/re.rst:1434 +#: library/re.rst:1487 +msgid "" +">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" +">>> m.groups()\n" +"('24', '1632')" +msgstr "" + +#: library/re.rst:1491 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: library/re.rst:1447 +#: library/re.rst:1495 +msgid "" +">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" +">>> m.groups() # Second group defaults to None.\n" +"('24', None)\n" +">>> m.groups('0') # Now, the second group defaults to '0'.\n" +"('24', '0')" +msgstr "" + +#: library/re.rst:1504 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: library/re.rst:1459 +#: library/re.rst:1508 +msgid "" +">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " +"Reynolds\")\n" +">>> m.groupdict()\n" +"{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" +msgstr "" + +#: library/re.rst:1516 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -1686,7 +1949,11 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: library/re.rst:1467 +#: library/re.rst:1522 +msgid "m.string[m.start(g):m.end(g)]" +msgstr "" + +#: library/re.rst:1524 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -1694,32 +1961,40 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: library/re.rst:1472 +#: library/re.rst:1529 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: library/re.rst:1482 +#: library/re.rst:1531 +msgid "" +">>> email = \"tony@tiremove_thisger.net\"\n" +">>> m = re.search(\"remove_this\", email)\n" +">>> email[:m.start()] + email[m.end():]\n" +"'tony@tiger.net'" +msgstr "" + +#: library/re.rst:1539 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: library/re.rst:1489 +#: library/re.rst:1546 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: library/re.rst:1496 +#: library/re.rst:1553 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: library/re.rst:1503 +#: library/re.rst:1560 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -1728,43 +2003,51 @@ msgid "" "applied to the same string." msgstr "" -#: library/re.rst:1512 +#: library/re.rst:1569 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: library/re.rst:1518 +#: library/re.rst:1575 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: library/re.rst:1524 +#: library/re.rst:1581 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: library/re.rst:1527 +#: library/re.rst:1584 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: library/re.rst:1535 +#: library/re.rst:1592 msgid "Regular Expression Examples" msgstr "" -#: library/re.rst:1539 +#: library/re.rst:1596 msgid "Checking for a Pair" msgstr "" -#: library/re.rst:1541 +#: library/re.rst:1598 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: library/re.rst:1549 +#: library/re.rst:1601 +msgid "" +"def displaymatch(match):\n" +" if match is None:\n" +" return None\n" +" return '' % (match.group(), match.groups())" +msgstr "" + +#: library/re.rst:1606 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -1772,28 +2055,67 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: library/re.rst:1554 +#: library/re.rst:1611 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: library/re.rst:1564 +#: library/re.rst:1613 +msgid "" +">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" +">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" +"\"\"\n" +">>> displaymatch(valid.match(\"akt5e\")) # Invalid.\n" +">>> displaymatch(valid.match(\"akt\")) # Invalid.\n" +">>> displaymatch(valid.match(\"727ak\")) # Valid.\n" +"\"\"" +msgstr "" + +#: library/re.rst:1621 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: library/re.rst:1574 +#: library/re.rst:1624 +msgid "" +">>> pair = re.compile(r\".*(.).*\\1\")\n" +">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" +"\"\"\n" +">>> displaymatch(pair.match(\"718ak\")) # No pairs.\n" +">>> displaymatch(pair.match(\"354aa\")) # Pair of aces.\n" +"\"\"" +msgstr "" + +#: library/re.rst:1631 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: library/re.rst:1593 +#: library/re.rst:1634 +msgid "" +">>> pair = re.compile(r\".*(.).*\\1\")\n" +">>> pair.match(\"717ak\").group(1)\n" +"'7'\n" +"\n" +"# Error because re.match() returns None, which doesn't have a group() " +"method:\n" +">>> pair.match(\"718ak\").group(1)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" re.match(r\".*(.).*\\1\", \"718ak\").group(1)\n" +"AttributeError: 'NoneType' object has no attribute 'group'\n" +"\n" +">>> pair.match(\"354aa\").group(1)\n" +"'a'" +msgstr "" + +#: library/re.rst:1650 msgid "Simulating scanf()" msgstr "" -#: library/re.rst:1597 +#: library/re.rst:1654 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -1802,124 +2124,154 @@ msgid "" "expressions." msgstr "" -#: library/re.rst:1604 +#: library/re.rst:1661 msgid ":c:func:`!scanf` Token" msgstr "" -#: library/re.rst:1604 +#: library/re.rst:1661 msgid "Regular Expression" msgstr "" -#: library/re.rst:1606 +#: library/re.rst:1663 msgid "``%c``" msgstr "" -#: library/re.rst:1608 +#: library/re.rst:1665 msgid "``%5c``" msgstr "" -#: library/re.rst:1608 +#: library/re.rst:1665 msgid "``.{5}``" msgstr "" -#: library/re.rst:1610 +#: library/re.rst:1667 msgid "``%d``" msgstr "" -#: library/re.rst:1610 +#: library/re.rst:1667 msgid "``[-+]?\\d+``" msgstr "" -#: library/re.rst:1612 +#: library/re.rst:1669 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "" -#: library/re.rst:1612 +#: library/re.rst:1669 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "" -#: library/re.rst:1614 +#: library/re.rst:1671 msgid "``%i``" msgstr "" -#: library/re.rst:1614 +#: library/re.rst:1671 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "" -#: library/re.rst:1616 +#: library/re.rst:1673 msgid "``%o``" msgstr "" -#: library/re.rst:1616 +#: library/re.rst:1673 msgid "``[-+]?[0-7]+``" msgstr "" -#: library/re.rst:1618 +#: library/re.rst:1675 msgid "``%s``" msgstr "" -#: library/re.rst:1618 +#: library/re.rst:1675 msgid "``\\S+``" msgstr "" -#: library/re.rst:1620 +#: library/re.rst:1677 msgid "``%u``" msgstr "" -#: library/re.rst:1620 +#: library/re.rst:1677 msgid "``\\d+``" msgstr "" -#: library/re.rst:1622 +#: library/re.rst:1679 msgid "``%x``, ``%X``" msgstr "" -#: library/re.rst:1622 +#: library/re.rst:1679 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "" -#: library/re.rst:1625 +#: library/re.rst:1682 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: library/re.rst:1629 +#: library/re.rst:1684 +msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" +msgstr "" + +#: library/re.rst:1686 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: library/re.rst:1633 +#: library/re.rst:1688 +msgid "%s - %d errors, %d warnings" +msgstr "" + +#: library/re.rst:1690 msgid "The equivalent regular expression would be ::" msgstr "" -#: library/re.rst:1641 +#: library/re.rst:1692 +msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" +msgstr "" + +#: library/re.rst:1698 msgid "search() vs. match()" msgstr "" -#: library/re.rst:1645 +#: library/re.rst:1702 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: library/re.rst:1647 +#: library/re.rst:1704 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: library/re.rst:1648 +#: library/re.rst:1705 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: library/re.rst:1650 +#: library/re.rst:1707 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: library/re.rst:1662 +#: library/re.rst:1712 +msgid "" +">>> re.match(\"c\", \"abcdef\") # No match\n" +">>> re.search(\"c\", \"abcdef\") # Match\n" +"\n" +">>> re.fullmatch(\"p.*n\", \"python\") # Match\n" +"\n" +">>> re.fullmatch(\"r.*n\", \"python\") # No match" +msgstr "" + +#: library/re.rst:1719 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: library/re.rst:1670 +#: library/re.rst:1722 +msgid "" +">>> re.match(\"c\", \"abcdef\") # No match\n" +">>> re.search(\"^c\", \"abcdef\") # No match\n" +">>> re.search(\"^a\", \"abcdef\") # Match\n" +"" +msgstr "" + +#: library/re.rst:1727 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -1927,11 +2279,18 @@ msgid "" "line. ::" msgstr "" -#: library/re.rst:1680 +#: library/re.rst:1731 +msgid "" +">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" +">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" +"" +msgstr "" + +#: library/re.rst:1737 msgid "Making a Phonebook" msgstr "" -#: library/re.rst:1682 +#: library/re.rst:1739 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -1939,37 +2298,76 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: library/re.rst:1687 +#: library/re.rst:1744 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: library/re.rst:1700 +#: library/re.rst:1747 +msgid "" +">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" +"...\n" +"... Ronald Heathmore: 892.345.3428 436 Finley Avenue\n" +"... Frank Burger: 925.541.7625 662 South Dogwood Way\n" +"...\n" +"...\n" +"... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" +msgstr "" + +#: library/re.rst:1757 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: library/re.rst:1713 +#: library/re.rst:1760 +msgid "" +">>> entries = re.split(\"\\n+\", text)\n" +">>> entries\n" +"['Ross McFluff: 834.345.1254 155 Elm Street',\n" +"'Ronald Heathmore: 892.345.3428 436 Finley Avenue',\n" +"'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" +"'Heather Albrecht: 548.326.4584 919 Park Place']" +msgstr "" + +#: library/re.rst:1770 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: library/re.rst:1726 +#: library/re.rst:1774 +msgid "" +">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" +"[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" +"['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],\n" +"['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" +"['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" +msgstr "" + +#: library/re.rst:1783 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: library/re.rst:1741 +#: library/re.rst:1787 +msgid "" +">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" +"[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" +"['Ronald', 'Heathmore', '892.345.3428', '436', 'Finley Avenue'],\n" +"['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" +"['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" +msgstr "" + +#: library/re.rst:1798 msgid "Text Munging" msgstr "" -#: library/re.rst:1743 +#: library/re.rst:1800 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -1977,11 +2375,25 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: library/re.rst:1761 +#: library/re.rst:1805 +msgid "" +">>> def repl(m):\n" +"... inner_word = list(m.group(2))\n" +"... random.shuffle(inner_word)\n" +"... return m.group(1) + \"\".join(inner_word) + m.group(3)\n" +"...\n" +">>> text = \"Professor Abdolmalek, please report your absences promptly.\"\n" +">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" +"'Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.'\n" +">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" +"'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" +msgstr "" + +#: library/re.rst:1818 msgid "Finding all Adverbs" msgstr "" -#: library/re.rst:1763 +#: library/re.rst:1820 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -1989,11 +2401,18 @@ msgid "" "manner::" msgstr "" -#: library/re.rst:1774 +#: library/re.rst:1825 +msgid "" +">>> text = \"He was carefully disguised but captured quickly by police.\"\n" +">>> re.findall(r\"\\w+ly\\b\", text)\n" +"['carefully', 'quickly']" +msgstr "" + +#: library/re.rst:1831 msgid "Finding all Adverbs and their Positions" msgstr "" -#: library/re.rst:1776 +#: library/re.rst:1833 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2002,11 +2421,20 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: library/re.rst:1790 +#: library/re.rst:1839 +msgid "" +">>> text = \"He was carefully disguised but captured quickly by police.\"\n" +">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" +"... print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0)))\n" +"07-16: carefully\n" +"40-47: quickly" +msgstr "" + +#: library/re.rst:1847 msgid "Raw String Notation" msgstr "" -#: library/re.rst:1792 +#: library/re.rst:1849 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2014,7 +2442,15 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: library/re.rst:1802 +#: library/re.rst:1854 +msgid "" +">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" +"\n" +">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" +"" +msgstr "" + +#: library/re.rst:1859 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2022,29 +2458,116 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: library/re.rst:1814 +#: library/re.rst:1864 +msgid "" +">>> re.match(r\"\\\\\", r\"\\\\\")\n" +"\n" +">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" +"" +msgstr "" + +#: library/re.rst:1871 msgid "Writing a Tokenizer" msgstr "" -#: library/re.rst:1816 +#: library/re.rst:1873 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: library/re.rst:1820 +#: library/re.rst:1877 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: library/re.rst:1876 +#: library/re.rst:1881 +msgid "" +"from typing import NamedTuple\n" +"import re\n" +"\n" +"class Token(NamedTuple):\n" +" type: str\n" +" value: str\n" +" line: int\n" +" column: int\n" +"\n" +"def tokenize(code):\n" +" keywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}\n" +" token_specification = [\n" +" ('NUMBER', r'\\d+(\\.\\d*)?'), # Integer or decimal number\n" +" ('ASSIGN', r':='), # Assignment operator\n" +" ('END', r';'), # Statement terminator\n" +" ('ID', r'[A-Za-z]+'), # Identifiers\n" +" ('OP', r'[+\\-*/]'), # Arithmetic operators\n" +" ('NEWLINE', r'\\n'), # Line endings\n" +" ('SKIP', r'[ \\t]+'), # Skip over spaces and tabs\n" +" ('MISMATCH', r'.'), # Any other character\n" +" ]\n" +" tok_regex = '|'.join('(?P<%s>%s)' % pair for pair in " +"token_specification)\n" +" line_num = 1\n" +" line_start = 0\n" +" for mo in re.finditer(tok_regex, code):\n" +" kind = mo.lastgroup\n" +" value = mo.group()\n" +" column = mo.start() - line_start\n" +" if kind == 'NUMBER':\n" +" value = float(value) if '.' in value else int(value)\n" +" elif kind == 'ID' and value in keywords:\n" +" kind = value\n" +" elif kind == 'NEWLINE':\n" +" line_start = mo.end()\n" +" line_num += 1\n" +" continue\n" +" elif kind == 'SKIP':\n" +" continue\n" +" elif kind == 'MISMATCH':\n" +" raise RuntimeError(f'{value!r} unexpected on line {line_num}')\n" +" yield Token(kind, value, line_num, column)\n" +"\n" +"statements = '''\n" +" IF quantity THEN\n" +" total := total + price * quantity;\n" +" tax := price * 0.05;\n" +" ENDIF;\n" +"'''\n" +"\n" +"for token in tokenize(statements):\n" +" print(token)" +msgstr "" + +#: library/re.rst:1933 msgid "The tokenizer produces the following output::" msgstr "" -#: library/re.rst:1899 +#: library/re.rst:1935 +msgid "" +"Token(type='IF', value='IF', line=2, column=4)\n" +"Token(type='ID', value='quantity', line=2, column=7)\n" +"Token(type='THEN', value='THEN', line=2, column=16)\n" +"Token(type='ID', value='total', line=3, column=8)\n" +"Token(type='ASSIGN', value=':=', line=3, column=14)\n" +"Token(type='ID', value='total', line=3, column=17)\n" +"Token(type='OP', value='+', line=3, column=23)\n" +"Token(type='ID', value='price', line=3, column=25)\n" +"Token(type='OP', value='*', line=3, column=31)\n" +"Token(type='ID', value='quantity', line=3, column=33)\n" +"Token(type='END', value=';', line=3, column=41)\n" +"Token(type='ID', value='tax', line=4, column=8)\n" +"Token(type='ASSIGN', value=':=', line=4, column=12)\n" +"Token(type='ID', value='price', line=4, column=15)\n" +"Token(type='OP', value='*', line=4, column=21)\n" +"Token(type='NUMBER', value=0.05, line=4, column=23)\n" +"Token(type='END', value=';', line=4, column=27)\n" +"Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" +"Token(type='END', value=';', line=5, column=9)" +msgstr "" + +#: library/re.rst:1956 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2057,14 +2580,14 @@ msgid ". (dot)" msgstr "" #: library/re.rst:112 library/re.rst:130 library/re.rst:143 library/re.rst:181 -#: library/re.rst:235 library/re.rst:257 library/re.rst:295 library/re.rst:318 -#: library/re.rst:405 library/re.rst:443 library/re.rst:455 library/re.rst:489 -#: library/re.rst:522 library/re.rst:539 library/re.rst:575 library/re.rst:599 -#: library/re.rst:622 library/re.rst:653 library/re.rst:849 library/re.rst:1056 +#: library/re.rst:235 library/re.rst:258 library/re.rst:304 library/re.rst:327 +#: library/re.rst:414 library/re.rst:452 library/re.rst:464 library/re.rst:498 +#: library/re.rst:531 library/re.rst:548 library/re.rst:587 library/re.rst:611 +#: library/re.rst:633 library/re.rst:664 library/re.rst:866 library/re.rst:1105 msgid "in regular expressions" msgstr "" -#: library/re.rst:262 +#: library/re.rst:271 msgid "^ (caret)" msgstr "" @@ -2112,7 +2635,7 @@ msgstr "" msgid "{} (curly brackets)" msgstr "" -#: library/re.rst:257 library/re.rst:522 +#: library/re.rst:258 library/re.rst:531 msgid "\\ (backslash)" msgstr "" @@ -2124,146 +2647,150 @@ msgstr "" msgid "- (minus)" msgstr "" -#: library/re.rst:295 +#: library/re.rst:304 msgid "| (vertical bar)" msgstr "" -#: library/re.rst:308 +#: library/re.rst:317 msgid "() (parentheses)" msgstr "" -#: library/re.rst:318 +#: library/re.rst:327 msgid "(?" msgstr "" -#: library/re.rst:350 +#: library/re.rst:359 msgid "(?:" msgstr "" -#: library/re.rst:405 +#: library/re.rst:414 msgid "(?P<" msgstr "" -#: library/re.rst:437 +#: library/re.rst:446 msgid "(?P=" msgstr "" -#: library/re.rst:443 +#: library/re.rst:452 msgid "(?#" msgstr "" -#: library/re.rst:448 +#: library/re.rst:457 msgid "(?=" msgstr "" -#: library/re.rst:455 +#: library/re.rst:464 msgid "(?!" msgstr "" -#: library/re.rst:462 +#: library/re.rst:471 msgid "(?<=" msgstr "" -#: library/re.rst:489 +#: library/re.rst:498 msgid "(?\n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/readline.rst:2 -msgid ":mod:`readline` --- GNU readline interface" +msgid ":mod:`!readline` --- GNU readline interface" msgstr "" #: library/readline.rst:12 @@ -41,191 +42,238 @@ msgid "" "general." msgstr "" -#: library/readline.rst:29 +#: includes/wasm-mobile-notavail.rst:3 +msgid "Availability" +msgstr "" + +#: includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +msgstr "" + +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/readline.rst:33 msgid "" -"The underlying Readline library API may be implemented by the ``libedit`` " -"library instead of GNU readline. On macOS the :mod:`readline` module detects " -"which library is being used at run time." +"The underlying Readline library API may be implemented by the ``editline`` " +"(``libedit``) library instead of GNU readline. On macOS the :mod:`readline` " +"module detects which library is being used at run time." msgstr "" -#: library/readline.rst:34 +#: library/readline.rst:38 msgid "" -"The configuration file for ``libedit`` is different from that of GNU " -"readline. If you programmatically load configuration strings you can check " -"for the text \"libedit\" in :const:`readline.__doc__` to differentiate " -"between GNU readline and libedit." +"The configuration file for ``editline`` is different from that of GNU " +"readline. If you programmatically load configuration strings you can use :" +"data:`backend` to determine which library is being used." msgstr "" -#: library/readline.rst:39 +#: library/readline.rst:42 msgid "" -"If you use *editline*/``libedit`` readline emulation on macOS, the " +"If you use ``editline``/``libedit`` readline emulation on macOS, the " "initialization file located in your home directory is named ``.editrc``. For " "example, the following content in ``~/.editrc`` will turn ON *vi* " "keybindings and TAB completion::" msgstr "" -#: library/readline.rst:49 +#: library/readline.rst:47 +msgid "" +"python:bind -v\n" +"python:bind ^I rl_complete" +msgstr "" + +#: library/readline.rst:50 +msgid "" +"Also note that different libraries may use different history file formats. " +"When switching the underlying library, existing history files may become " +"unusable." +msgstr "" + +#: library/readline.rst:56 +msgid "" +"The name of the underlying Readline library being used, either " +"``\"readline\"`` or ``\"editline\"``." +msgstr "" + +#: library/readline.rst:62 msgid "Init file" msgstr "" -#: library/readline.rst:51 +#: library/readline.rst:64 msgid "The following functions relate to the init file and user configuration:" msgstr "" -#: library/readline.rst:56 +#: library/readline.rst:69 msgid "" "Execute the init line provided in the *string* argument. This calls :c:func:" -"`rl_parse_and_bind` in the underlying library." +"`!rl_parse_and_bind` in the underlying library." msgstr "" -#: library/readline.rst:62 +#: library/readline.rst:75 msgid "" "Execute a readline initialization file. The default filename is the last " -"filename used. This calls :c:func:`rl_read_init_file` in the underlying " -"library." +"filename used. This calls :c:func:`!rl_read_init_file` in the underlying " +"library. It raises an :ref:`auditing event ` ``open`` with the " +"file name if given, and :code:`\"\"` otherwise, " +"regardless of which file the library resolves." +msgstr "" + +#: library/readline.rst:124 library/readline.rst:151 +msgid "The auditing event was added." msgstr "" -#: library/readline.rst:67 +#: library/readline.rst:86 msgid "Line buffer" msgstr "" -#: library/readline.rst:69 +#: library/readline.rst:88 msgid "The following functions operate on the line buffer:" msgstr "" -#: library/readline.rst:74 +#: library/readline.rst:93 msgid "" -"Return the current contents of the line buffer (:c:data:`rl_line_buffer` in " +"Return the current contents of the line buffer (:c:data:`!rl_line_buffer` in " "the underlying library)." msgstr "" -#: library/readline.rst:80 +#: library/readline.rst:99 msgid "" "Insert text into the line buffer at the cursor position. This calls :c:func:" -"`rl_insert_text` in the underlying library, but ignores the return value." +"`!rl_insert_text` in the underlying library, but ignores the return value." msgstr "" -#: library/readline.rst:87 +#: library/readline.rst:106 msgid "" "Change what's displayed on the screen to reflect the current contents of the " -"line buffer. This calls :c:func:`rl_redisplay` in the underlying library." +"line buffer. This calls :c:func:`!rl_redisplay` in the underlying library." msgstr "" -#: library/readline.rst:92 +#: library/readline.rst:111 msgid "History file" msgstr "" -#: library/readline.rst:94 +#: library/readline.rst:113 msgid "The following functions operate on a history file:" msgstr "" -#: library/readline.rst:99 +#: library/readline.rst:118 msgid "" "Load a readline history file, and append it to the history list. The default " -"filename is :file:`~/.history`. This calls :c:func:`read_history` in the " -"underlying library." +"filename is :file:`~/.history`. This calls :c:func:`!read_history` in the " +"underlying library and raises an :ref:`auditing event ` ``open`` " +"with the file name if given and :code:`\"~/.history\"` otherwise." msgstr "" -#: library/readline.rst:106 +#: library/readline.rst:130 msgid "" "Save the history list to a readline history file, overwriting any existing " -"file. The default filename is :file:`~/.history`. This calls :c:func:" -"`write_history` in the underlying library." +"file. The default filename is :file:`~/.history`. This calls :c:func:`!" +"write_history` in the underlying library and raises an :ref:`auditing event " +"` ``open`` with the file name if given and :code:`\"~/.history\"` " +"otherwise." msgstr "" -#: library/readline.rst:113 +#: library/readline.rst:142 msgid "" "Append the last *nelements* items of history to a file. The default " "filename is :file:`~/.history`. The file must already exist. This calls :c:" -"func:`append_history` in the underlying library. This function only exists " -"if Python was compiled for a version of the library that supports it." +"func:`!append_history` in the underlying library. This function only exists " +"if Python was compiled for a version of the library that supports it. It " +"raises an :ref:`auditing event ` ``open`` with the file name if " +"given and :code:`\"~/.history\"` otherwise." msgstr "" -#: library/readline.rst:125 +#: library/readline.rst:158 msgid "" "Set or return the desired number of lines to save in the history file. The :" "func:`write_history_file` function uses this value to truncate the history " -"file, by calling :c:func:`history_truncate_file` in the underlying library. " -"Negative values imply unlimited history file size." +"file, by calling :c:func:`!history_truncate_file` in the underlying " +"library. Negative values imply unlimited history file size." msgstr "" -#: library/readline.rst:133 +#: library/readline.rst:166 msgid "History list" msgstr "" -#: library/readline.rst:135 +#: library/readline.rst:168 msgid "The following functions operate on a global history list:" msgstr "" -#: library/readline.rst:140 +#: library/readline.rst:173 msgid "" -"Clear the current history. This calls :c:func:`clear_history` in the " +"Clear the current history. This calls :c:func:`!clear_history` in the " "underlying library. The Python function only exists if Python was compiled " "for a version of the library that supports it." msgstr "" -#: library/readline.rst:147 +#: library/readline.rst:180 msgid "" "Return the number of items currently in the history. (This is different " "from :func:`get_history_length`, which returns the maximum number of lines " "that will be written to a history file.)" msgstr "" -#: library/readline.rst:154 +#: library/readline.rst:187 msgid "" "Return the current contents of history item at *index*. The item index is " -"one-based. This calls :c:func:`history_get` in the underlying library." +"one-based. This calls :c:func:`!history_get` in the underlying library." msgstr "" -#: library/readline.rst:160 +#: library/readline.rst:193 msgid "" "Remove history item specified by its position from the history. The position " -"is zero-based. This calls :c:func:`remove_history` in the underlying " +"is zero-based. This calls :c:func:`!remove_history` in the underlying " "library." msgstr "" -#: library/readline.rst:167 +#: library/readline.rst:200 msgid "" "Replace history item specified by its position with *line*. The position is " -"zero-based. This calls :c:func:`replace_history_entry` in the underlying " +"zero-based. This calls :c:func:`!replace_history_entry` in the underlying " "library." msgstr "" -#: library/readline.rst:174 +#: library/readline.rst:207 msgid "" "Append *line* to the history buffer, as if it was the last line typed. This " -"calls :c:func:`add_history` in the underlying library." +"calls :c:func:`!add_history` in the underlying library." msgstr "" -#: library/readline.rst:180 +#: library/readline.rst:213 msgid "" -"Enable or disable automatic calls to :c:func:`add_history` when reading " +"Enable or disable automatic calls to :c:func:`!add_history` when reading " "input via readline. The *enabled* argument should be a Boolean value that " "when true, enables auto history, and that when false, disables auto history." msgstr "" -#: library/readline.rst:188 +#: library/readline.rst:221 msgid "" "Auto history is enabled by default, and changes to this do not persist " "across multiple sessions." msgstr "" -#: library/readline.rst:193 +#: library/readline.rst:226 msgid "Startup hooks" msgstr "" -#: library/readline.rst:198 +#: library/readline.rst:231 msgid "" -"Set or remove the function invoked by the :c:data:`rl_startup_hook` callback " -"of the underlying library. If *function* is specified, it will be used as " -"the new hook function; if omitted or ``None``, any function already " +"Set or remove the function invoked by the :c:data:`!rl_startup_hook` " +"callback of the underlying library. If *function* is specified, it will be " +"used as the new hook function; if omitted or ``None``, any function already " "installed is removed. The hook is called with no arguments just before " "readline prints the first prompt." msgstr "" -#: library/readline.rst:207 +#: library/readline.rst:240 msgid "" -"Set or remove the function invoked by the :c:data:`rl_pre_input_hook` " +"Set or remove the function invoked by the :c:data:`!rl_pre_input_hook` " "callback of the underlying library. If *function* is specified, it will be " "used as the new hook function; if omitted or ``None``, any function already " "installed is removed. The hook is called with no arguments after the first " @@ -234,11 +282,11 @@ msgid "" "of the library that supports it." msgstr "" -#: library/readline.rst:219 +#: library/readline.rst:252 msgid "Completion" msgstr "" -#: library/readline.rst:221 +#: library/readline.rst:254 msgid "" "The following functions relate to implementing a custom word completion " "function. This is typically operated by the Tab key, and can suggest and " @@ -248,7 +296,7 @@ msgid "" "custom completer, a different set of word delimiters should be set." msgstr "" -#: library/readline.rst:231 +#: library/readline.rst:264 msgid "" "Set or remove the completer function. If *function* is specified, it will " "be used as the new completer function; if omitted or ``None``, any completer " @@ -258,60 +306,60 @@ msgid "" "starting with *text*." msgstr "" -#: library/readline.rst:238 +#: library/readline.rst:271 msgid "" "The installed completer function is invoked by the *entry_func* callback " -"passed to :c:func:`rl_completion_matches` in the underlying library. The " -"*text* string comes from the first parameter to the :c:data:" -"`rl_attempted_completion_function` callback of the underlying library." +"passed to :c:func:`!rl_completion_matches` in the underlying library. The " +"*text* string comes from the first parameter to the :c:data:`!" +"rl_attempted_completion_function` callback of the underlying library." msgstr "" -#: library/readline.rst:247 +#: library/readline.rst:280 msgid "" "Get the completer function, or ``None`` if no completer function has been " "set." msgstr "" -#: library/readline.rst:252 +#: library/readline.rst:285 msgid "" -"Get the type of completion being attempted. This returns the :c:data:" -"`rl_completion_type` variable in the underlying library as an integer." +"Get the type of completion being attempted. This returns the :c:data:`!" +"rl_completion_type` variable in the underlying library as an integer." msgstr "" -#: library/readline.rst:260 +#: library/readline.rst:293 msgid "" "Get the beginning or ending index of the completion scope. These indexes are " -"the *start* and *end* arguments passed to the :c:data:" -"`rl_attempted_completion_function` callback of the underlying library. The " +"the *start* and *end* arguments passed to the :c:data:`!" +"rl_attempted_completion_function` callback of the underlying library. The " "values may be different in the same input editing scenario based on the " "underlying C readline implementation. Ex: libedit is known to behave " "differently than libreadline." msgstr "" -#: library/readline.rst:271 +#: library/readline.rst:304 msgid "" "Set or get the word delimiters for completion. These determine the start of " "the word to be considered for completion (the completion scope). These " -"functions access the :c:data:`rl_completer_word_break_characters` variable " +"functions access the :c:data:`!rl_completer_word_break_characters` variable " "in the underlying library." msgstr "" -#: library/readline.rst:279 +#: library/readline.rst:312 msgid "" "Set or remove the completion display function. If *function* is specified, " "it will be used as the new completion display function; if omitted or " "``None``, any completion display function already installed is removed. " -"This sets or clears the :c:data:`rl_completion_display_matches_hook` " +"This sets or clears the :c:data:`!rl_completion_display_matches_hook` " "callback in the underlying library. The completion display function is " "called as ``function(substitution, [matches], longest_match_length)`` once " "each time matches need to be displayed." msgstr "" -#: library/readline.rst:292 +#: library/readline.rst:325 msgid "Example" msgstr "" -#: library/readline.rst:294 +#: library/readline.rst:327 msgid "" "The following example demonstrates how to use the :mod:`readline` module's " "history reading and writing functions to automatically load and save a " @@ -320,20 +368,85 @@ msgid "" "sessions from the user's :envvar:`PYTHONSTARTUP` file. ::" msgstr "" -#: library/readline.rst:314 +#: library/readline.rst:333 +msgid "" +"import atexit\n" +"import os\n" +"import readline\n" +"\n" +"histfile = os.path.join(os.path.expanduser(\"~\"), \".python_history\")\n" +"try:\n" +" readline.read_history_file(histfile)\n" +" # default history len is -1 (infinite), which may grow unruly\n" +" readline.set_history_length(1000)\n" +"except FileNotFoundError:\n" +" pass\n" +"\n" +"atexit.register(readline.write_history_file, histfile)" +msgstr "" + +#: library/readline.rst:347 msgid "" "This code is actually automatically run when Python is run in :ref:" "`interactive mode ` (see :ref:`rlcompleter-config`)." msgstr "" -#: library/readline.rst:317 +#: library/readline.rst:350 msgid "" "The following example achieves the same goal but supports concurrent " "interactive sessions, by only appending the new history. ::" msgstr "" -#: library/readline.rst:338 +#: library/readline.rst:353 +msgid "" +"import atexit\n" +"import os\n" +"import readline\n" +"histfile = os.path.join(os.path.expanduser(\"~\"), \".python_history\")\n" +"\n" +"try:\n" +" readline.read_history_file(histfile)\n" +" h_len = readline.get_current_history_length()\n" +"except FileNotFoundError:\n" +" open(histfile, 'wb').close()\n" +" h_len = 0\n" +"\n" +"def save(prev_h_len, histfile):\n" +" new_h_len = readline.get_current_history_length()\n" +" readline.set_history_length(1000)\n" +" readline.append_history_file(new_h_len - prev_h_len, histfile)\n" +"atexit.register(save, h_len, histfile)" +msgstr "" + +#: library/readline.rst:371 msgid "" "The following example extends the :class:`code.InteractiveConsole` class to " "support history save/restore. ::" msgstr "" + +#: library/readline.rst:374 +msgid "" +"import atexit\n" +"import code\n" +"import os\n" +"import readline\n" +"\n" +"class HistoryConsole(code.InteractiveConsole):\n" +" def __init__(self, locals=None, filename=\"\",\n" +" histfile=os.path.expanduser(\"~/.console-history\")):\n" +" code.InteractiveConsole.__init__(self, locals, filename)\n" +" self.init_history(histfile)\n" +"\n" +" def init_history(self, histfile):\n" +" readline.parse_and_bind(\"tab: complete\")\n" +" if hasattr(readline, \"read_history_file\"):\n" +" try:\n" +" readline.read_history_file(histfile)\n" +" except FileNotFoundError:\n" +" pass\n" +" atexit.register(self.save_history, histfile)\n" +"\n" +" def save_history(self, histfile):\n" +" readline.set_history_length(1000)\n" +" readline.write_history_file(histfile)" +msgstr "" diff --git a/library/removed.po b/library/removed.po new file mode 100644 index 00000000..67b7eba7 --- /dev/null +++ b/library/removed.po @@ -0,0 +1,28 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/removed.rst:7 +msgid "Removed Modules" +msgstr "" + +#: library/removed.rst:9 +msgid "" +"The modules described in this chapter have been removed from the Python " +"standard library. They are documented here to help people find replacements." +msgstr "" diff --git a/library/reprlib.po b/library/reprlib.po index 8cc92851..a7a60154 100644 --- a/library/reprlib.po +++ b/library/reprlib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/reprlib.rst:2 -msgid ":mod:`reprlib` --- Alternate :func:`repr` implementation" +msgid ":mod:`!reprlib` --- Alternate :func:`repr` implementation" msgstr "" #: library/reprlib.rst:9 @@ -50,10 +51,20 @@ msgid "" "initialization::" msgstr "" +#: library/reprlib.rst:32 +msgid "aRepr = reprlib.Repr(maxlevel=3)" +msgstr "" + #: library/reprlib.rst:34 msgid "Is equivalent to::" msgstr "" +#: library/reprlib.rst:36 +msgid "" +"aRepr = reprlib.Repr()\n" +"aRepr.maxlevel = 3" +msgstr "" + #: library/reprlib.rst:39 msgid "" "See section `Repr Objects`_ for more information about :class:`Repr` " @@ -92,6 +103,21 @@ msgid "" "returned, otherwise, the usual :meth:`!__repr__` call is made. For example:" msgstr "" +#: library/reprlib.rst:73 +msgid "" +">>> from reprlib import recursive_repr\n" +">>> class MyList(list):\n" +"... @recursive_repr()\n" +"... def __repr__(self):\n" +"... return '<' + '|'.join(map(repr, self)) + '>'\n" +"...\n" +">>> m = MyList('abc')\n" +">>> m.append(m)\n" +">>> m.append('x')\n" +">>> print(m)\n" +"<'a'|'b'|'c'|...|'x'>" +msgstr "" + #: library/reprlib.rst:93 msgid "Repr Objects" msgstr "" @@ -149,18 +175,66 @@ msgid "" "example:" msgstr "" +#: library/reprlib.rst:153 +msgid "" +">>> example = [\n" +"... 1, 'spam', {'a': 2, 'b': 'spam eggs', 'c': {3: 4.5, 6: []}}, 'ham']\n" +">>> import reprlib\n" +">>> aRepr = reprlib.Repr()\n" +">>> print(aRepr.repr(example))\n" +"[1, 'spam', {'a': 2, 'b': 'spam eggs', 'c': {3: 4.5, 6: []}}, 'ham']" +msgstr "" + #: library/reprlib.rst:162 msgid "" "If :attr:`~Repr.indent` is set to a string, each recursion level is placed " "on its own line, indented by that string:" msgstr "" +#: library/reprlib.rst:165 +msgid "" +">>> aRepr.indent = '-->'\n" +">>> print(aRepr.repr(example))\n" +"[\n" +"-->1,\n" +"-->'spam',\n" +"-->{\n" +"-->-->'a': 2,\n" +"-->-->'b': 'spam eggs',\n" +"-->-->'c': {\n" +"-->-->-->3: 4.5,\n" +"-->-->-->6: [],\n" +"-->-->},\n" +"-->},\n" +"-->'ham',\n" +"]" +msgstr "" + #: library/reprlib.rst:183 msgid "" "Setting :attr:`~Repr.indent` to a positive integer value behaves as if it " "was set to a string with that number of spaces:" msgstr "" +#: library/reprlib.rst:186 +msgid "" +">>> aRepr.indent = 4\n" +">>> print(aRepr.repr(example))\n" +"[\n" +" 1,\n" +" 'spam',\n" +" {\n" +" 'a': 2,\n" +" 'b': 'spam eggs',\n" +" 'c': {\n" +" 3: 4.5,\n" +" 6: [],\n" +" },\n" +" },\n" +" 'ham',\n" +"]" +msgstr "" + #: library/reprlib.rst:209 msgid "" "The equivalent to the built-in :func:`repr` that uses the formatting imposed " @@ -197,6 +271,26 @@ msgid "" "special support for file objects could be added:" msgstr "" +#: library/reprlib.rst:241 +msgid "" +"import reprlib\n" +"import sys\n" +"\n" +"class MyRepr(reprlib.Repr):\n" +"\n" +" def repr_TextIOWrapper(self, obj, level):\n" +" if obj.name in {'', '', ''}:\n" +" return obj.name\n" +" return repr(obj)\n" +"\n" +"aRepr = MyRepr()\n" +"print(aRepr.repr(sys.stdin)) # prints ''" +msgstr "" + +#: library/reprlib.rst:256 +msgid "" +msgstr "" + #: library/reprlib.rst:65 msgid "..." msgstr "" diff --git a/library/resource.po b/library/resource.po index 0da83b66..342dcef6 100644 --- a/library/resource.po +++ b/library/resource.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/resource.rst:2 -msgid ":mod:`resource` --- Resource usage information" +msgid ":mod:`!resource` --- Resource usage information" msgstr "" #: library/resource.rst:13 @@ -26,8 +27,9 @@ msgid "" "resources utilized by a program." msgstr "" -#: library/resource.rst:16 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#: library/resource.rst:104 library/resource.rst:193 library/resource.rst:211 +#: library/resource.rst:230 library/resource.rst:255 library/resource.rst:273 +msgid "Availability" msgstr "" #: library/resource.rst:18 @@ -87,7 +89,7 @@ msgstr "" msgid "" "Sets new limits of consumption of *resource*. The *limits* argument must be " "a tuple ``(soft, hard)`` of two integers describing the new limits. A value " -"of :data:`~resource.RLIM_INFINITY` can be used to request a limit that is " +"of :const:`~resource.RLIM_INFINITY` can be used to request a limit that is " "unlimited." msgstr "" @@ -95,7 +97,7 @@ msgstr "" msgid "" "Raises :exc:`ValueError` if an invalid resource is specified, if the new " "soft limit exceeds the hard limit, or if a process tries to raise its hard " -"limit. Specifying a limit of :data:`~resource.RLIM_INFINITY` when the hard " +"limit. Specifying a limit of :const:`~resource.RLIM_INFINITY` when the hard " "or system limit for that resource is not unlimited will result in a :exc:" "`ValueError`. A process with the effective UID of super-user can request " "any valid limit value, including unlimited, but :exc:`ValueError` will still " @@ -109,7 +111,7 @@ msgid "" msgstr "" #: library/resource.rst:81 -msgid "VxWorks only supports setting :data:`RLIMIT_NOFILE`." +msgid "VxWorks only supports setting :const:`RLIMIT_NOFILE`." msgstr "" #: library/resource.rst:83 @@ -147,10 +149,6 @@ msgid "" "arguments ``pid``, ``resource``, ``limits``." msgstr "" -#: library/resource.rst:104 -msgid ":ref:`Availability `: Linux >= 2.6.36 with glibc >= 2.13." -msgstr "" - #: library/resource.rst:109 msgid "" "These symbols define resources whose consumption can be controlled using " @@ -177,9 +175,10 @@ msgstr "" #: library/resource.rst:129 msgid "" "The maximum amount of processor time (in seconds) that a process can use. If " -"this limit is exceeded, a :const:`SIGXCPU` signal is sent to the process. " -"(See the :mod:`signal` module documentation for information about how to " -"catch this signal and do something useful, e.g. flush open files to disk.)" +"this limit is exceeded, a :const:`~signal.SIGXCPU` signal is sent to the " +"process. (See the :mod:`signal` module documentation for information about " +"how to catch this signal and do something useful, e.g. flush open files to " +"disk.)" msgstr "" #: library/resource.rst:137 @@ -218,65 +217,47 @@ msgid "The maximum address space which may be locked in memory." msgstr "" #: library/resource.rst:178 -msgid "The largest area of mapped memory which the process may occupy." -msgstr "" - -#: library/resource.rst:268 -msgid ":ref:`Availability `: FreeBSD >= 11." +msgid "" +"The largest area of mapped memory which the process may occupy. Usually an " +"alias of :const:`RLIMIT_AS`." msgstr "" -#: library/resource.rst:185 +#: library/resource.rst:186 msgid "" "The maximum area (in bytes) of address space which may be taken by the " "process." msgstr "" -#: library/resource.rst:190 +#: library/resource.rst:191 msgid "The number of bytes that can be allocated for POSIX message queues." msgstr "" -#: library/resource.rst:229 -msgid ":ref:`Availability `: Linux >= 2.6.8." -msgstr "" - -#: library/resource.rst:199 +#: library/resource.rst:200 msgid "The ceiling for the process's nice level (calculated as 20 - rlim_cur)." msgstr "" -#: library/resource.rst:210 -msgid ":ref:`Availability `: Linux >= 2.6.12." -msgstr "" - -#: library/resource.rst:208 +#: library/resource.rst:209 msgid "The ceiling of the real-time priority." msgstr "" -#: library/resource.rst:217 +#: library/resource.rst:218 msgid "" "The time limit (in microseconds) on CPU time that a process can spend under " "real-time scheduling without making a blocking syscall." msgstr "" -#: library/resource.rst:220 -msgid ":ref:`Availability `: Linux >= 2.6.25." -msgstr "" - -#: library/resource.rst:227 +#: library/resource.rst:228 msgid "The number of signals which the process may queue." msgstr "" -#: library/resource.rst:235 +#: library/resource.rst:237 msgid "" "The maximum size (in bytes) of socket buffer usage for this user. This " "limits the amount of network memory, and hence the amount of mbufs, that " "this user may hold at any time." msgstr "" -#: library/resource.rst:252 library/resource.rst:260 -msgid ":ref:`Availability `: FreeBSD." -msgstr "" - -#: library/resource.rst:245 +#: library/resource.rst:248 msgid "" "The maximum size (in bytes) of the swap space that may be reserved or used " "by all of this user id's processes. This limit is enforced only if bit 1 of " @@ -285,23 +266,23 @@ msgid "" "this sysctl." msgstr "" -#: library/resource.rst:258 +#: library/resource.rst:262 msgid "The maximum number of pseudo-terminals created by this user id." msgstr "" -#: library/resource.rst:266 +#: library/resource.rst:271 msgid "The maximum number of kqueues this user id is allowed to create." msgstr "" -#: library/resource.rst:273 +#: library/resource.rst:279 msgid "Resource Usage" msgstr "" -#: library/resource.rst:275 +#: library/resource.rst:281 msgid "These functions are used to retrieve resource usage information:" msgstr "" -#: library/resource.rst:280 +#: library/resource.rst:286 msgid "" "This function returns an object that describes the resources consumed by " "either the current process or its children, as specified by the *who* " @@ -309,11 +290,26 @@ msgid "" "`!RUSAGE_\\*` constants described below." msgstr "" -#: library/resource.rst:285 +#: library/resource.rst:291 msgid "A simple example::" msgstr "" -#: library/resource.rst:299 +#: library/resource.rst:293 +msgid "" +"from resource import *\n" +"import time\n" +"\n" +"# a non CPU-bound task\n" +"time.sleep(3)\n" +"print(getrusage(RUSAGE_SELF))\n" +"\n" +"# a CPU-bound task\n" +"for i in range(10 ** 8):\n" +" _ = 1 + 1\n" +"print(getrusage(RUSAGE_SELF))" +msgstr "" + +#: library/resource.rst:305 msgid "" "The fields of the return value each describe how a particular system " "resource has been used, e.g. amount of time spent running is user mode or " @@ -322,265 +318,265 @@ msgid "" "is using." msgstr "" -#: library/resource.rst:304 +#: library/resource.rst:310 msgid "" "For backward compatibility, the return value is also accessible as a tuple " "of 16 elements." msgstr "" -#: library/resource.rst:307 +#: library/resource.rst:313 msgid "" -"The fields :attr:`ru_utime` and :attr:`ru_stime` of the return value are " -"floating point values representing the amount of time spent executing in " +"The fields :attr:`!ru_utime` and :attr:`!ru_stime` of the return value are " +"floating-point values representing the amount of time spent executing in " "user mode and the amount of time spent executing in system mode, " "respectively. The remaining values are integers. Consult the :manpage:" "`getrusage(2)` man page for detailed information about these values. A brief " "summary is presented here:" msgstr "" -#: library/resource.rst:314 +#: library/resource.rst:320 msgid "Index" msgstr "" -#: library/resource.rst:314 +#: library/resource.rst:320 msgid "Field" msgstr "" -#: library/resource.rst:314 +#: library/resource.rst:320 msgid "Resource" msgstr "" -#: library/resource.rst:316 +#: library/resource.rst:322 msgid "``0``" msgstr "" -#: library/resource.rst:316 -msgid ":attr:`ru_utime`" +#: library/resource.rst:322 +msgid ":attr:`!ru_utime`" msgstr "" -#: library/resource.rst:316 +#: library/resource.rst:322 msgid "time in user mode (float seconds)" msgstr "" -#: library/resource.rst:318 +#: library/resource.rst:324 msgid "``1``" msgstr "" -#: library/resource.rst:318 -msgid ":attr:`ru_stime`" +#: library/resource.rst:324 +msgid ":attr:`!ru_stime`" msgstr "" -#: library/resource.rst:318 +#: library/resource.rst:324 msgid "time in system mode (float seconds)" msgstr "" -#: library/resource.rst:320 +#: library/resource.rst:326 msgid "``2``" msgstr "" -#: library/resource.rst:320 -msgid ":attr:`ru_maxrss`" +#: library/resource.rst:326 +msgid ":attr:`!ru_maxrss`" msgstr "" -#: library/resource.rst:320 +#: library/resource.rst:326 msgid "maximum resident set size" msgstr "" -#: library/resource.rst:322 +#: library/resource.rst:328 msgid "``3``" msgstr "" -#: library/resource.rst:322 -msgid ":attr:`ru_ixrss`" +#: library/resource.rst:328 +msgid ":attr:`!ru_ixrss`" msgstr "" -#: library/resource.rst:322 +#: library/resource.rst:328 msgid "shared memory size" msgstr "" -#: library/resource.rst:324 +#: library/resource.rst:330 msgid "``4``" msgstr "" -#: library/resource.rst:324 -msgid ":attr:`ru_idrss`" +#: library/resource.rst:330 +msgid ":attr:`!ru_idrss`" msgstr "" -#: library/resource.rst:324 +#: library/resource.rst:330 msgid "unshared memory size" msgstr "" -#: library/resource.rst:326 +#: library/resource.rst:332 msgid "``5``" msgstr "" -#: library/resource.rst:326 -msgid ":attr:`ru_isrss`" +#: library/resource.rst:332 +msgid ":attr:`!ru_isrss`" msgstr "" -#: library/resource.rst:326 +#: library/resource.rst:332 msgid "unshared stack size" msgstr "" -#: library/resource.rst:328 +#: library/resource.rst:334 msgid "``6``" msgstr "" -#: library/resource.rst:328 -msgid ":attr:`ru_minflt`" +#: library/resource.rst:334 +msgid ":attr:`!ru_minflt`" msgstr "" -#: library/resource.rst:328 +#: library/resource.rst:334 msgid "page faults not requiring I/O" msgstr "" -#: library/resource.rst:330 +#: library/resource.rst:336 msgid "``7``" msgstr "" -#: library/resource.rst:330 -msgid ":attr:`ru_majflt`" +#: library/resource.rst:336 +msgid ":attr:`!ru_majflt`" msgstr "" -#: library/resource.rst:330 +#: library/resource.rst:336 msgid "page faults requiring I/O" msgstr "" -#: library/resource.rst:332 +#: library/resource.rst:338 msgid "``8``" msgstr "" -#: library/resource.rst:332 -msgid ":attr:`ru_nswap`" +#: library/resource.rst:338 +msgid ":attr:`!ru_nswap`" msgstr "" -#: library/resource.rst:332 +#: library/resource.rst:338 msgid "number of swap outs" msgstr "" -#: library/resource.rst:334 +#: library/resource.rst:340 msgid "``9``" msgstr "" -#: library/resource.rst:334 -msgid ":attr:`ru_inblock`" +#: library/resource.rst:340 +msgid ":attr:`!ru_inblock`" msgstr "" -#: library/resource.rst:334 +#: library/resource.rst:340 msgid "block input operations" msgstr "" -#: library/resource.rst:336 +#: library/resource.rst:342 msgid "``10``" msgstr "" -#: library/resource.rst:336 -msgid ":attr:`ru_oublock`" +#: library/resource.rst:342 +msgid ":attr:`!ru_oublock`" msgstr "" -#: library/resource.rst:336 +#: library/resource.rst:342 msgid "block output operations" msgstr "" -#: library/resource.rst:338 +#: library/resource.rst:344 msgid "``11``" msgstr "" -#: library/resource.rst:338 -msgid ":attr:`ru_msgsnd`" +#: library/resource.rst:344 +msgid ":attr:`!ru_msgsnd`" msgstr "" -#: library/resource.rst:338 +#: library/resource.rst:344 msgid "messages sent" msgstr "" -#: library/resource.rst:340 +#: library/resource.rst:346 msgid "``12``" msgstr "" -#: library/resource.rst:340 -msgid ":attr:`ru_msgrcv`" +#: library/resource.rst:346 +msgid ":attr:`!ru_msgrcv`" msgstr "" -#: library/resource.rst:340 +#: library/resource.rst:346 msgid "messages received" msgstr "" -#: library/resource.rst:342 +#: library/resource.rst:348 msgid "``13``" msgstr "" -#: library/resource.rst:342 -msgid ":attr:`ru_nsignals`" +#: library/resource.rst:348 +msgid ":attr:`!ru_nsignals`" msgstr "" -#: library/resource.rst:342 +#: library/resource.rst:348 msgid "signals received" msgstr "" -#: library/resource.rst:344 +#: library/resource.rst:350 msgid "``14``" msgstr "" -#: library/resource.rst:344 -msgid ":attr:`ru_nvcsw`" +#: library/resource.rst:350 +msgid ":attr:`!ru_nvcsw`" msgstr "" -#: library/resource.rst:344 +#: library/resource.rst:350 msgid "voluntary context switches" msgstr "" -#: library/resource.rst:346 +#: library/resource.rst:352 msgid "``15``" msgstr "" -#: library/resource.rst:346 -msgid ":attr:`ru_nivcsw`" +#: library/resource.rst:352 +msgid ":attr:`!ru_nivcsw`" msgstr "" -#: library/resource.rst:346 +#: library/resource.rst:352 msgid "involuntary context switches" msgstr "" -#: library/resource.rst:349 +#: library/resource.rst:355 msgid "" "This function will raise a :exc:`ValueError` if an invalid *who* parameter " "is specified. It may also raise :exc:`error` exception in unusual " "circumstances." msgstr "" -#: library/resource.rst:355 +#: library/resource.rst:361 msgid "" "Returns the number of bytes in a system page. (This need not be the same as " "the hardware page size.)" msgstr "" -#: library/resource.rst:358 +#: library/resource.rst:364 msgid "" "The following :const:`!RUSAGE_\\*` symbols are passed to the :func:" "`getrusage` function to specify which processes information should be " "provided for." msgstr "" -#: library/resource.rst:364 +#: library/resource.rst:370 msgid "" "Pass to :func:`getrusage` to request resources consumed by the calling " "process, which is the sum of resources used by all threads in the process." msgstr "" -#: library/resource.rst:370 +#: library/resource.rst:376 msgid "" "Pass to :func:`getrusage` to request resources consumed by child processes " "of the calling process which have been terminated and waited for." msgstr "" -#: library/resource.rst:376 +#: library/resource.rst:382 msgid "" "Pass to :func:`getrusage` to request resources consumed by both the current " "process and child processes. May not be available on all systems." msgstr "" -#: library/resource.rst:382 +#: library/resource.rst:388 msgid "" "Pass to :func:`getrusage` to request resources consumed by the current " "thread. May not be available on all systems." diff --git a/library/rlcompleter.po b/library/rlcompleter.po index b683c460..3292a8fb 100644 --- a/library/rlcompleter.po +++ b/library/rlcompleter.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/rlcompleter.rst:2 -msgid ":mod:`rlcompleter` --- Completion function for GNU readline" +msgid ":mod:`!rlcompleter` --- Completion function for GNU readline" msgstr "" #: library/rlcompleter.rst:9 @@ -43,6 +44,20 @@ msgstr "" msgid "Example::" msgstr "" +#: library/rlcompleter.rst:24 +msgid "" +">>> import rlcompleter\n" +">>> import readline\n" +">>> readline.parse_and_bind(\"tab: complete\")\n" +">>> readline. \n" +"readline.__doc__ readline.get_line_buffer( readline." +"read_init_file(\n" +"readline.__file__ readline.insert_text( readline." +"set_completer(\n" +"readline.__name__ readline.parse_and_bind(\n" +">>> readline." +msgstr "" + #: library/rlcompleter.rst:33 msgid "" "The :mod:`!rlcompleter` module is designed for use with Python's :ref:" diff --git a/library/runpy.po b/library/runpy.po index e982faa1..05fabd9d 100644 --- a/library/runpy.po +++ b/library/runpy.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/runpy.rst:2 -msgid ":mod:`runpy` --- Locating and executing Python modules" +msgid ":mod:`!runpy` --- Locating and executing Python modules" msgstr "" #: library/runpy.rst:9 @@ -53,7 +54,7 @@ msgstr "" #: library/runpy.rst:35 msgid "" -"Execute the code of the specified module and return the resulting module " +"Execute the code of the specified module and return the resulting module's " "globals dictionary. The module's code is first located using the standard " "import mechanism (refer to :pep:`302` for details) and then executed in a " "fresh module namespace." @@ -70,19 +71,19 @@ msgstr "" #: library/runpy.rst:46 msgid "" "The optional dictionary argument *init_globals* may be used to pre-populate " -"the module's globals dictionary before the code is executed. The supplied " -"dictionary will not be modified. If any of the special global variables " -"below are defined in the supplied dictionary, those definitions are " -"overridden by :func:`run_module`." +"the module's globals dictionary before the code is executed. *init_globals* " +"will not be modified. If any of the special global variables below are " +"defined in *init_globals*, those definitions are overridden by :func:" +"`run_module`." msgstr "" #: library/runpy.rst:127 msgid "" "The special global variables ``__name__``, ``__spec__``, ``__file__``, " "``__cached__``, ``__loader__`` and ``__package__`` are set in the globals " -"dictionary before the module code is executed (Note that this is a minimal " +"dictionary before the module code is executed. (Note that this is a minimal " "set of variables - other variables may be set implicitly as an interpreter " -"implementation detail)." +"implementation detail.)" msgstr "" #: library/runpy.rst:58 @@ -96,7 +97,7 @@ msgstr "" msgid "" "``__spec__`` will be set appropriately for the *actually* imported module " "(that is, ``__spec__.name`` will always be *mod_name* or ``mod_name + '." -"__main__``, never *run_name*)." +"__main__'``, never *run_name*)." msgstr "" #: library/runpy.rst:66 @@ -154,11 +155,10 @@ msgstr "" #: library/runpy.rst:106 msgid "" "Execute the code at the named filesystem location and return the resulting " -"module globals dictionary. As with a script name supplied to the CPython " -"command line, the supplied path may refer to a Python source file, a " -"compiled bytecode file or a valid :data:`sys.path` entry containing a :mod:" -"`__main__` module (e.g. a zipfile containing a top-level ``__main__.py`` " -"file)." +"module's globals dictionary. As with a script name supplied to the CPython " +"command line, *file_path* may refer to a Python source file, a compiled " +"bytecode file or a valid :data:`sys.path` entry containing a :mod:`__main__` " +"module (e.g. a zipfile containing a top-level :file:`__main__.py` file)." msgstr "" #: library/runpy.rst:113 @@ -175,10 +175,10 @@ msgstr "" #: library/runpy.rst:121 msgid "" "The optional dictionary argument *init_globals* may be used to pre-populate " -"the module's globals dictionary before the code is executed. The supplied " -"dictionary will not be modified. If any of the special global variables " -"below are defined in the supplied dictionary, those definitions are " -"overridden by :func:`run_path`." +"the module's globals dictionary before the code is executed. *init_globals* " +"will not be modified. If any of the special global variables below are " +"defined in *init_globals*, those definitions are overridden by :func:" +"`run_path`." msgstr "" #: library/runpy.rst:133 @@ -189,15 +189,15 @@ msgstr "" #: library/runpy.rst:136 msgid "" -"If the supplied path directly references a script file (whether as source or " -"as precompiled byte code), then ``__file__`` will be set to the supplied " -"path, and ``__spec__``, ``__cached__``, ``__loader__`` and ``__package__`` " -"will all be set to :const:`None`." +"If *file_path* directly references a script file (whether as source or as " +"precompiled byte code), then ``__file__`` will be set to *file_path*, and " +"``__spec__``, ``__cached__``, ``__loader__`` and ``__package__`` will all be " +"set to :const:`None`." msgstr "" #: library/runpy.rst:141 msgid "" -"If the supplied path is a reference to a valid :data:`sys.path` entry, then " +"If *file_path* is a reference to a valid :data:`sys.path` entry, then " "``__spec__`` will be set appropriately for the imported :mod:`__main__` " "module (that is, ``__spec__.name`` will always be ``__main__``). " "``__file__``, ``__cached__``, ``__loader__`` and ``__package__`` will be :" @@ -208,7 +208,7 @@ msgstr "" msgid "" "A number of alterations are also made to the :mod:`sys` module. Firstly, :" "data:`sys.path` may be altered as described above. ``sys.argv[0]`` is " -"updated with the value of ``path_name`` and ``sys.modules[__name__]`` is " +"updated with the value of *file_path* and ``sys.modules[__name__]`` is " "updated with a temporary module object for the module being executed. All " "modifications to items in :mod:`sys` are reverted before the function " "returns." @@ -243,7 +243,7 @@ msgid "" "deprecated." msgstr "" -#: library/runpy.rst:179 +#: library/runpy.rst:178 msgid ":pep:`338` -- Executing modules as scripts" msgstr "" @@ -251,11 +251,11 @@ msgstr "" msgid "PEP written and implemented by Nick Coghlan." msgstr "" -#: library/runpy.rst:182 +#: library/runpy.rst:181 msgid ":pep:`366` -- Main module explicit relative imports" msgstr "" -#: library/runpy.rst:185 +#: library/runpy.rst:184 msgid ":pep:`451` -- A ModuleSpec Type for the Import System" msgstr "" diff --git a/library/sched.po b/library/sched.po index 7672c9ab..cbb762de 100644 --- a/library/sched.po +++ b/library/sched.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/sched.rst:2 -msgid ":mod:`sched` --- Event scheduler" +msgid ":mod:`!sched` --- Event scheduler" msgstr "" #: library/sched.rst:9 @@ -55,6 +56,37 @@ msgstr "" msgid "Example::" msgstr "" +#: library/sched.rst:38 +msgid "" +">>> import sched, time\n" +">>> s = sched.scheduler(time.time, time.sleep)\n" +">>> def print_time(a='default'):\n" +"... print(\"From print_time\", time.time(), a)\n" +"...\n" +">>> def print_some_times():\n" +"... print(time.time())\n" +"... s.enter(10, 1, print_time)\n" +"... s.enter(5, 2, print_time, argument=('positional',))\n" +"... # despite having higher priority, 'keyword' runs after 'positional' " +"as enter() is relative\n" +"... s.enter(5, 1, print_time, kwargs={'a': 'keyword'})\n" +"... s.enterabs(1_650_000_000, 10, print_time, argument=(\"first " +"enterabs\",))\n" +"... s.enterabs(1_650_000_000, 5, print_time, argument=(\"second " +"enterabs\",))\n" +"... s.run()\n" +"... print(time.time())\n" +"...\n" +">>> print_some_times()\n" +"1652342830.3640375\n" +"From print_time 1652342830.3642538 second enterabs\n" +"From print_time 1652342830.3643398 first enterabs\n" +"From print_time 1652342835.3694863 positional\n" +"From print_time 1652342835.3696074 keyword\n" +"From print_time 1652342840.369612 default\n" +"1652342840.3697174" +msgstr "" + #: library/sched.rst:67 msgid "Scheduler Objects" msgstr "" diff --git a/library/secrets.po b/library/secrets.po index e24d03d8..3171f94c 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/secrets.rst:2 -msgid ":mod:`secrets` --- Generate secure random numbers for managing secrets" +msgid ":mod:`!secrets` --- Generate secure random numbers for managing secrets" msgstr "" #: library/secrets.rst:16 @@ -64,11 +65,11 @@ msgid "Return a randomly chosen element from a non-empty sequence." msgstr "" #: library/secrets.rst:51 -msgid "Return a random int in the range [0, *n*)." +msgid "Return a random int in the range [0, *exclusive_upper_bound*)." msgstr "" #: library/secrets.rst:55 -msgid "Return an int with *k* random bits." +msgid "Return a non-negative int with *k* random bits." msgstr "" #: library/secrets.rst:59 @@ -88,6 +89,12 @@ msgid "" "is ``None`` or not supplied, a reasonable default is used." msgstr "" +#: library/secrets.rst:71 +msgid "" +">>> token_bytes(16)\n" +"b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" +msgstr "" + #: library/secrets.rst:79 msgid "" "Return a random text string, in hexadecimal. The string has *nbytes* random " @@ -95,6 +102,12 @@ msgid "" "not supplied, a reasonable default is used." msgstr "" +#: library/secrets.rst:83 +msgid "" +">>> token_hex(16)\n" +"'f9bf78b9a18ce6d46a0cd2b0b86df9da'" +msgstr "" + #: library/secrets.rst:90 msgid "" "Return a random URL-safe text string, containing *nbytes* random bytes. The " @@ -103,6 +116,12 @@ msgid "" "is used." msgstr "" +#: library/secrets.rst:95 +msgid "" +">>> token_urlsafe(16)\n" +"'Drmhze6EPcv0fN_81Bj-nA'" +msgstr "" + #: library/secrets.rst:102 msgid "How many bytes should tokens use?" msgstr "" @@ -165,12 +184,19 @@ msgstr "" msgid "Generate an eight-character alphanumeric password:" msgstr "" +#: library/secrets.rst:147 +msgid "" +"import string\n" +"import secrets\n" +"alphabet = string.ascii_letters + string.digits\n" +"password = ''.join(secrets.choice(alphabet) for i in range(8))" +msgstr "" + #: library/secrets.rst:157 msgid "" -"Applications should not `store passwords in a recoverable format `_, whether plain text or " -"encrypted. They should be salted and hashed using a cryptographically " -"strong one-way (irreversible) hash function." +"Applications should not :cwe:`store passwords in a recoverable format " +"<257>`, whether plain text or encrypted. They should be salted and hashed " +"using a cryptographically strong one-way (irreversible) hash function." msgstr "" #: library/secrets.rst:163 @@ -179,12 +205,41 @@ msgid "" "character, at least one uppercase character, and at least three digits:" msgstr "" +#: library/secrets.rst:167 +msgid "" +"import string\n" +"import secrets\n" +"alphabet = string.ascii_letters + string.digits\n" +"while True:\n" +" password = ''.join(secrets.choice(alphabet) for i in range(10))\n" +" if (any(c.islower() for c in password)\n" +" and any(c.isupper() for c in password)\n" +" and sum(c.isdigit() for c in password) >= 3):\n" +" break" +msgstr "" + #: library/secrets.rst:180 msgid "Generate an `XKCD-style passphrase `_:" msgstr "" +#: library/secrets.rst:182 +msgid "" +"import secrets\n" +"# On standard Linux systems, use a convenient dictionary file.\n" +"# Other platforms may need to provide their own word-list.\n" +"with open('/usr/share/dict/words') as f:\n" +" words = [word.strip() for word in f]\n" +" password = ' '.join(secrets.choice(words) for i in range(4))" +msgstr "" + #: library/secrets.rst:192 msgid "" "Generate a hard-to-guess temporary URL containing a security token suitable " "for password recovery applications:" msgstr "" + +#: library/secrets.rst:195 +msgid "" +"import secrets\n" +"url = 'https://example.com/reset=' + secrets.token_urlsafe()" +msgstr "" diff --git a/library/security_warnings.po b/library/security_warnings.po index f47c4d71..98f32b30 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,78 +32,74 @@ msgid "" msgstr "" #: library/security_warnings.rst:12 -msgid ":mod:`cgi`: :ref:`CGI security considerations `" -msgstr "" - -#: library/security_warnings.rst:13 msgid "" ":mod:`hashlib`: :ref:`all constructors take a \"usedforsecurity\" keyword-" "only argument disabling known insecure and blocked algorithms `" msgstr "" -#: library/security_warnings.rst:16 +#: library/security_warnings.rst:15 msgid "" ":mod:`http.server` is not suitable for production use, only implementing " "basic security checks. See the :ref:`security considerations `." msgstr "" -#: library/security_warnings.rst:18 +#: library/security_warnings.rst:17 msgid "" ":mod:`logging`: :ref:`Logging configuration uses eval() `" msgstr "" -#: library/security_warnings.rst:20 +#: library/security_warnings.rst:19 msgid "" ":mod:`multiprocessing`: :ref:`Connection.recv() uses pickle `" msgstr "" -#: library/security_warnings.rst:22 +#: library/security_warnings.rst:21 msgid ":mod:`pickle`: :ref:`Restricting globals in pickle `" msgstr "" -#: library/security_warnings.rst:23 +#: library/security_warnings.rst:22 msgid "" ":mod:`random` shouldn't be used for security purposes, use :mod:`secrets` " "instead" msgstr "" -#: library/security_warnings.rst:25 +#: library/security_warnings.rst:24 msgid "" ":mod:`shelve`: :ref:`shelve is based on pickle and thus unsuitable for " "dealing with untrusted sources `" msgstr "" -#: library/security_warnings.rst:27 +#: library/security_warnings.rst:26 msgid ":mod:`ssl`: :ref:`SSL/TLS security considerations `" msgstr "" -#: library/security_warnings.rst:28 +#: library/security_warnings.rst:27 msgid "" ":mod:`subprocess`: :ref:`Subprocess security considerations `" msgstr "" -#: library/security_warnings.rst:30 +#: library/security_warnings.rst:29 msgid "" ":mod:`tempfile`: :ref:`mktemp is deprecated due to vulnerability to race " "conditions `" msgstr "" -#: library/security_warnings.rst:32 -msgid ":mod:`xml`: :ref:`XML vulnerabilities `" +#: library/security_warnings.rst:31 +msgid ":mod:`xml`: :ref:`XML security `" msgstr "" -#: library/security_warnings.rst:33 +#: library/security_warnings.rst:32 msgid "" ":mod:`zipfile`: :ref:`maliciously prepared .zip files can cause disk volume " "exhaustion `" msgstr "" -#: library/security_warnings.rst:36 +#: library/security_warnings.rst:35 msgid "" "The :option:`-I` command line option can be used to run Python in isolated " "mode. When it cannot be used, the :option:`-P` option or the :envvar:" diff --git a/library/select.po b/library/select.po index 8157f2b7..54d2aeac 100644 --- a/library/select.po +++ b/library/select.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/select.rst:2 -msgid ":mod:`select` --- Waiting for I/O completion" +msgid ":mod:`!select` --- Waiting for I/O completion" msgstr "" #: library/select.rst:9 @@ -40,14 +41,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/select.rst:27 @@ -181,20 +181,20 @@ msgstr "" msgid "" "Empty iterables are allowed, but acceptance of three empty iterables is " "platform-dependent. (It is known to work on Unix but not on Windows.) The " -"optional *timeout* argument specifies a time-out as a floating point number " -"in seconds. When the *timeout* argument is omitted the function blocks " -"until at least one file descriptor is ready. A time-out value of zero " -"specifies a poll and never blocks." +"optional *timeout* argument specifies a time-out as a floating-point number " +"in seconds. When the *timeout* argument is omitted or ``None``, the function " +"blocks until at least one file descriptor is ready. A time-out value of " +"zero specifies a poll and never blocks." msgstr "" -#: library/select.rst:137 +#: library/select.rst:138 msgid "" "The return value is a triple of lists of objects that are ready: subsets of " "the first three arguments. When the time-out is reached without a file " "descriptor becoming ready, three empty lists are returned." msgstr "" -#: library/select.rst:145 +#: library/select.rst:146 msgid "" "Among the acceptable object types in the iterables are Python :term:`file " "objects ` (e.g. ``sys.stdin``, or objects returned by :func:" @@ -204,7 +204,7 @@ msgid "" "file descriptor, not just a random integer)." msgstr "" -#: library/select.rst:156 +#: library/select.rst:157 msgid "" "File objects on Windows are not acceptable, but sockets are. On Windows, " "the underlying :c:func:`!select` function is provided by the WinSock " @@ -212,14 +212,14 @@ msgid "" "WinSock." msgstr "" -#: library/select.rst:267 library/select.rst:455 library/select.rst:496 +#: library/select.rst:268 library/select.rst:462 library/select.rst:503 msgid "" "The function is now retried with a recomputed timeout when interrupted by a " "signal, except if the signal handler raises an exception (see :pep:`475` for " "the rationale), instead of raising :exc:`InterruptedError`." msgstr "" -#: library/select.rst:170 +#: library/select.rst:171 msgid "" "The minimum number of bytes which can be written without blocking to a pipe " "when the pipe has been reported as ready for writing by :func:`~select." @@ -227,43 +227,39 @@ msgid "" "apply to other kind of file-like objects such as sockets." msgstr "" -#: library/select.rst:175 +#: library/select.rst:176 msgid "This value is guaranteed by POSIX to be at least 512." msgstr "" -#: library/select.rst:177 -msgid ":ref:`Availability `: Unix" -msgstr "" - -#: library/select.rst:185 +#: library/select.rst:186 msgid "``/dev/poll`` Polling Objects" msgstr "" -#: library/select.rst:187 +#: library/select.rst:188 msgid "" "Solaris and derivatives have ``/dev/poll``. While :c:func:`!select` is *O*\\ " "(*highest file descriptor*) and :c:func:`!poll` is *O*\\ (*number of file " "descriptors*), ``/dev/poll`` is *O*\\ (*active file descriptors*)." msgstr "" -#: library/select.rst:191 +#: library/select.rst:192 msgid "" "``/dev/poll`` behaviour is very close to the standard :c:func:`!poll` object." msgstr "" -#: library/select.rst:197 +#: library/select.rst:198 msgid "Close the file descriptor of the polling object." msgstr "" -#: library/select.rst:204 +#: library/select.rst:205 msgid "``True`` if the polling object is closed." msgstr "" -#: library/select.rst:211 +#: library/select.rst:212 msgid "Return the file descriptor number of the polling object." msgstr "" -#: library/select.rst:390 +#: library/select.rst:397 msgid "" "Register a file descriptor with the polling object. Future calls to the :" "meth:`poll` method will then check whether the file descriptor has any " @@ -272,7 +268,7 @@ msgid "" "implement :meth:`!fileno`, so they can also be used as the argument." msgstr "" -#: library/select.rst:224 +#: library/select.rst:225 msgid "" "*eventmask* is an optional bitmask describing the type of events you want to " "check for. The constants are the same that with :c:func:`!poll` object. The " @@ -280,33 +276,33 @@ msgid "" "`POLLPRI`, and :const:`POLLOUT`." msgstr "" -#: library/select.rst:231 +#: library/select.rst:232 msgid "" "Registering a file descriptor that's already registered is not an error, but " "the result is undefined. The appropriate action is to unregister or modify " "it first. This is an important difference compared with :c:func:`!poll`." msgstr "" -#: library/select.rst:239 +#: library/select.rst:240 msgid "" "This method does an :meth:`unregister` followed by a :meth:`register`. It is " "(a bit) more efficient that doing the same explicitly." msgstr "" -#: library/select.rst:434 +#: library/select.rst:441 msgid "" "Remove a file descriptor being tracked by a polling object. Just like the :" "meth:`register` method, *fd* can be an integer or an object with a :meth:" "`~io.IOBase.fileno` method that returns an integer." msgstr "" -#: library/select.rst:250 +#: library/select.rst:251 msgid "" "Attempting to remove a file descriptor that was never registered is safely " "ignored." msgstr "" -#: library/select.rst:256 +#: library/select.rst:257 msgid "" "Polls the set of registered file descriptors, and returns a possibly empty " "list containing ``(fd, event)`` 2-tuples for the descriptors that have " @@ -320,192 +316,206 @@ msgid "" "the call will block until there is an event for this poll object." msgstr "" -#: library/select.rst:277 +#: library/select.rst:278 msgid "Edge and Level Trigger Polling (epoll) Objects" msgstr "" -#: library/select.rst:279 +#: library/select.rst:280 msgid "https://linux.die.net/man/4/epoll" msgstr "" -#: library/select.rst:281 +#: library/select.rst:282 msgid "*eventmask*" msgstr "" -#: library/select.rst:402 library/select.rst:551 library/select.rst:590 -#: library/select.rst:633 +#: library/select.rst:409 library/select.rst:558 library/select.rst:597 +#: library/select.rst:640 msgid "Constant" msgstr "" -#: library/select.rst:402 library/select.rst:551 library/select.rst:590 -#: library/select.rst:633 +#: library/select.rst:409 library/select.rst:558 library/select.rst:597 +#: library/select.rst:640 msgid "Meaning" msgstr "" -#: library/select.rst:286 +#: library/select.rst:287 msgid ":const:`EPOLLIN`" msgstr "" -#: library/select.rst:286 +#: library/select.rst:287 msgid "Available for read" msgstr "" -#: library/select.rst:288 +#: library/select.rst:289 msgid ":const:`EPOLLOUT`" msgstr "" -#: library/select.rst:288 +#: library/select.rst:289 msgid "Available for write" msgstr "" -#: library/select.rst:290 +#: library/select.rst:291 msgid ":const:`EPOLLPRI`" msgstr "" -#: library/select.rst:290 +#: library/select.rst:291 msgid "Urgent data for read" msgstr "" -#: library/select.rst:292 +#: library/select.rst:293 msgid ":const:`EPOLLERR`" msgstr "" -#: library/select.rst:292 +#: library/select.rst:293 msgid "Error condition happened on the assoc. fd" msgstr "" -#: library/select.rst:294 +#: library/select.rst:295 msgid ":const:`EPOLLHUP`" msgstr "" -#: library/select.rst:294 +#: library/select.rst:295 msgid "Hang up happened on the assoc. fd" msgstr "" -#: library/select.rst:296 +#: library/select.rst:297 msgid ":const:`EPOLLET`" msgstr "" -#: library/select.rst:296 +#: library/select.rst:297 msgid "Set Edge Trigger behavior, the default is Level Trigger behavior" msgstr "" -#: library/select.rst:299 +#: library/select.rst:300 msgid ":const:`EPOLLONESHOT`" msgstr "" -#: library/select.rst:299 +#: library/select.rst:300 msgid "" "Set one-shot behavior. After one event is pulled out, the fd is internally " "disabled" msgstr "" -#: library/select.rst:302 +#: library/select.rst:303 msgid ":const:`EPOLLEXCLUSIVE`" msgstr "" -#: library/select.rst:302 +#: library/select.rst:303 msgid "" "Wake only one epoll object when the associated fd has an event. The default " "(if this flag is not set) is to wake all epoll objects polling on a fd." msgstr "" -#: library/select.rst:307 +#: library/select.rst:308 msgid ":const:`EPOLLRDHUP`" msgstr "" -#: library/select.rst:307 +#: library/select.rst:308 msgid "" "Stream socket peer closed connection or shut down writing half of connection." msgstr "" -#: library/select.rst:310 +#: library/select.rst:311 msgid ":const:`EPOLLRDNORM`" msgstr "" -#: library/select.rst:310 +#: library/select.rst:311 msgid "Equivalent to :const:`EPOLLIN`" msgstr "" -#: library/select.rst:312 +#: library/select.rst:313 msgid ":const:`EPOLLRDBAND`" msgstr "" -#: library/select.rst:312 +#: library/select.rst:313 msgid "Priority data band can be read." msgstr "" -#: library/select.rst:314 +#: library/select.rst:315 msgid ":const:`EPOLLWRNORM`" msgstr "" -#: library/select.rst:314 +#: library/select.rst:315 msgid "Equivalent to :const:`EPOLLOUT`" msgstr "" -#: library/select.rst:316 +#: library/select.rst:317 msgid ":const:`EPOLLWRBAND`" msgstr "" -#: library/select.rst:316 +#: library/select.rst:317 msgid "Priority data may be written." msgstr "" -#: library/select.rst:318 +#: library/select.rst:319 msgid ":const:`EPOLLMSG`" msgstr "" -#: library/select.rst:318 +#: library/select.rst:319 msgid "Ignored." msgstr "" #: library/select.rst:321 +msgid ":const:`EPOLLWAKEUP`" +msgstr "" + +#: library/select.rst:321 +msgid "Prevents sleep during event waiting." +msgstr "" + +#: library/select.rst:324 msgid "" ":const:`EPOLLEXCLUSIVE` was added. It's only supported by Linux Kernel 4.5 " "or later." msgstr "" -#: library/select.rst:327 +#: library/select.rst:328 +msgid "" +":const:`EPOLLWAKEUP` was added. It's only supported by Linux Kernel 3.5 or " +"later." +msgstr "" + +#: library/select.rst:334 msgid "Close the control file descriptor of the epoll object." msgstr "" -#: library/select.rst:332 +#: library/select.rst:339 msgid "``True`` if the epoll object is closed." msgstr "" -#: library/select.rst:479 +#: library/select.rst:486 msgid "Return the file descriptor number of the control fd." msgstr "" -#: library/select.rst:342 +#: library/select.rst:349 msgid "Create an epoll object from a given file descriptor." msgstr "" -#: library/select.rst:347 +#: library/select.rst:354 msgid "Register a fd descriptor with the epoll object." msgstr "" -#: library/select.rst:352 +#: library/select.rst:359 msgid "Modify a registered file descriptor." msgstr "" -#: library/select.rst:357 +#: library/select.rst:364 msgid "Remove a registered file descriptor from the epoll object." msgstr "" -#: library/select.rst:359 +#: library/select.rst:366 msgid "The method no longer ignores the :data:`~errno.EBADF` error." msgstr "" -#: library/select.rst:365 +#: library/select.rst:372 msgid "Wait for events. timeout in seconds (float)" msgstr "" -#: library/select.rst:377 +#: library/select.rst:384 msgid "Polling Objects" msgstr "" -#: library/select.rst:379 +#: library/select.rst:386 msgid "" "The :c:func:`!poll` system call, supported on most Unix systems, provides " "better scalability for network servers that service many, many clients at " @@ -517,7 +527,7 @@ msgid "" "of file descriptors*)." msgstr "" -#: library/select.rst:396 +#: library/select.rst:403 msgid "" "*eventmask* is an optional bitmask describing the type of events you want to " "check for, and can be a combination of the constants :const:`POLLIN`, :const:" @@ -525,70 +535,70 @@ msgid "" "specified, the default value used will check for all 3 types of events." msgstr "" -#: library/select.rst:404 +#: library/select.rst:411 msgid ":const:`POLLIN`" msgstr "" -#: library/select.rst:404 +#: library/select.rst:411 msgid "There is data to read" msgstr "" -#: library/select.rst:406 +#: library/select.rst:413 msgid ":const:`POLLPRI`" msgstr "" -#: library/select.rst:406 +#: library/select.rst:413 msgid "There is urgent data to read" msgstr "" -#: library/select.rst:408 +#: library/select.rst:415 msgid ":const:`POLLOUT`" msgstr "" -#: library/select.rst:408 +#: library/select.rst:415 msgid "Ready for output: writing will not block" msgstr "" -#: library/select.rst:410 +#: library/select.rst:417 msgid ":const:`POLLERR`" msgstr "" -#: library/select.rst:410 +#: library/select.rst:417 msgid "Error condition of some sort" msgstr "" -#: library/select.rst:412 +#: library/select.rst:419 msgid ":const:`POLLHUP`" msgstr "" -#: library/select.rst:412 +#: library/select.rst:419 msgid "Hung up" msgstr "" -#: library/select.rst:414 +#: library/select.rst:421 msgid ":const:`POLLRDHUP`" msgstr "" -#: library/select.rst:414 +#: library/select.rst:421 msgid "" "Stream socket peer closed connection, or shut down writing half of connection" msgstr "" -#: library/select.rst:417 +#: library/select.rst:424 msgid ":const:`POLLNVAL`" msgstr "" -#: library/select.rst:417 +#: library/select.rst:424 msgid "Invalid request: descriptor not open" msgstr "" -#: library/select.rst:420 +#: library/select.rst:427 msgid "" "Registering a file descriptor that's already registered is not an error, and " "has the same effect as registering the descriptor exactly once." msgstr "" -#: library/select.rst:426 +#: library/select.rst:433 msgid "" "Modifies an already registered fd. This has the same effect as " "``register(fd, eventmask)``. Attempting to modify a file descriptor that " @@ -596,13 +606,13 @@ msgid "" "`ENOENT` to be raised." msgstr "" -#: library/select.rst:438 +#: library/select.rst:445 msgid "" "Attempting to remove a file descriptor that was never registered causes a :" "exc:`KeyError` exception to be raised." msgstr "" -#: library/select.rst:444 +#: library/select.rst:451 msgid "" "Polls the set of registered file descriptors, and returns a possibly empty " "list containing ``(fd, event)`` 2-tuples for the descriptors that have " @@ -616,49 +626,49 @@ msgid "" "`None`, the call will block until there is an event for this poll object." msgstr "" -#: library/select.rst:465 +#: library/select.rst:472 msgid "Kqueue Objects" msgstr "" -#: library/select.rst:469 +#: library/select.rst:476 msgid "Close the control file descriptor of the kqueue object." msgstr "" -#: library/select.rst:474 +#: library/select.rst:481 msgid "``True`` if the kqueue object is closed." msgstr "" -#: library/select.rst:484 +#: library/select.rst:491 msgid "Create a kqueue object from a given file descriptor." msgstr "" -#: library/select.rst:489 +#: library/select.rst:496 msgid "Low level interface to kevent" msgstr "" -#: library/select.rst:491 +#: library/select.rst:498 msgid "changelist must be an iterable of kevent objects or ``None``" msgstr "" -#: library/select.rst:492 +#: library/select.rst:499 msgid "max_events must be 0 or a positive integer" msgstr "" -#: library/select.rst:493 +#: library/select.rst:500 msgid "" "timeout in seconds (floats possible); the default is ``None``, to wait " "forever" msgstr "" -#: library/select.rst:506 +#: library/select.rst:513 msgid "Kevent Objects" msgstr "" -#: library/select.rst:508 +#: library/select.rst:515 msgid "https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2" msgstr "" -#: library/select.rst:512 +#: library/select.rst:519 msgid "" "Value used to identify the event. The interpretation depends on the filter " "but it's usually the file descriptor. In the constructor ident can either be " @@ -666,340 +676,340 @@ msgid "" "the integer internally." msgstr "" -#: library/select.rst:519 +#: library/select.rst:526 msgid "Name of the kernel filter." msgstr "" -#: library/select.rst:524 +#: library/select.rst:531 msgid ":const:`KQ_FILTER_READ`" msgstr "" -#: library/select.rst:524 +#: library/select.rst:531 msgid "Takes a descriptor and returns whenever there is data available to read" msgstr "" -#: library/select.rst:527 +#: library/select.rst:534 msgid ":const:`KQ_FILTER_WRITE`" msgstr "" -#: library/select.rst:527 +#: library/select.rst:534 msgid "" "Takes a descriptor and returns whenever there is data available to write" msgstr "" -#: library/select.rst:530 +#: library/select.rst:537 msgid ":const:`KQ_FILTER_AIO`" msgstr "" -#: library/select.rst:530 +#: library/select.rst:537 msgid "AIO requests" msgstr "" -#: library/select.rst:532 +#: library/select.rst:539 msgid ":const:`KQ_FILTER_VNODE`" msgstr "" -#: library/select.rst:532 +#: library/select.rst:539 msgid "" "Returns when one or more of the requested events watched in *fflag* occurs" msgstr "" -#: library/select.rst:535 +#: library/select.rst:542 msgid ":const:`KQ_FILTER_PROC`" msgstr "" -#: library/select.rst:535 +#: library/select.rst:542 msgid "Watch for events on a process id" msgstr "" -#: library/select.rst:537 +#: library/select.rst:544 msgid ":const:`KQ_FILTER_NETDEV`" msgstr "" -#: library/select.rst:537 +#: library/select.rst:544 msgid "Watch for events on a network device [not available on macOS]" msgstr "" -#: library/select.rst:540 +#: library/select.rst:547 msgid ":const:`KQ_FILTER_SIGNAL`" msgstr "" -#: library/select.rst:540 +#: library/select.rst:547 msgid "Returns whenever the watched signal is delivered to the process" msgstr "" -#: library/select.rst:543 +#: library/select.rst:550 msgid ":const:`KQ_FILTER_TIMER`" msgstr "" -#: library/select.rst:543 +#: library/select.rst:550 msgid "Establishes an arbitrary timer" msgstr "" -#: library/select.rst:548 +#: library/select.rst:555 msgid "Filter action." msgstr "" -#: library/select.rst:553 +#: library/select.rst:560 msgid ":const:`KQ_EV_ADD`" msgstr "" -#: library/select.rst:553 +#: library/select.rst:560 msgid "Adds or modifies an event" msgstr "" -#: library/select.rst:555 +#: library/select.rst:562 msgid ":const:`KQ_EV_DELETE`" msgstr "" -#: library/select.rst:555 +#: library/select.rst:562 msgid "Removes an event from the queue" msgstr "" -#: library/select.rst:557 +#: library/select.rst:564 msgid ":const:`KQ_EV_ENABLE`" msgstr "" -#: library/select.rst:557 +#: library/select.rst:564 msgid "Permitscontrol() to returns the event" msgstr "" -#: library/select.rst:559 +#: library/select.rst:566 msgid ":const:`KQ_EV_DISABLE`" msgstr "" -#: library/select.rst:559 +#: library/select.rst:566 msgid "Disablesevent" msgstr "" -#: library/select.rst:561 +#: library/select.rst:568 msgid ":const:`KQ_EV_ONESHOT`" msgstr "" -#: library/select.rst:561 +#: library/select.rst:568 msgid "Removes event after first occurrence" msgstr "" -#: library/select.rst:563 +#: library/select.rst:570 msgid ":const:`KQ_EV_CLEAR`" msgstr "" -#: library/select.rst:563 +#: library/select.rst:570 msgid "Reset the state after an event is retrieved" msgstr "" -#: library/select.rst:565 +#: library/select.rst:572 msgid ":const:`KQ_EV_SYSFLAGS`" msgstr "" -#: library/select.rst:567 +#: library/select.rst:574 msgid "internal event" msgstr "" -#: library/select.rst:567 +#: library/select.rst:574 msgid ":const:`KQ_EV_FLAG1`" msgstr "" -#: library/select.rst:569 +#: library/select.rst:576 msgid ":const:`KQ_EV_EOF`" msgstr "" -#: library/select.rst:569 +#: library/select.rst:576 msgid "Filter specific EOF condition" msgstr "" -#: library/select.rst:571 +#: library/select.rst:578 msgid ":const:`KQ_EV_ERROR`" msgstr "" -#: library/select.rst:571 +#: library/select.rst:578 msgid "See return values" msgstr "" -#: library/select.rst:577 +#: library/select.rst:584 msgid "Filter specific flags." msgstr "" -#: library/select.rst:579 +#: library/select.rst:586 msgid ":const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags:" msgstr "" -#: library/select.rst:584 +#: library/select.rst:591 msgid ":const:`KQ_NOTE_LOWAT`" msgstr "" -#: library/select.rst:584 +#: library/select.rst:591 msgid "low water mark of a socket buffer" msgstr "" -#: library/select.rst:587 +#: library/select.rst:594 msgid ":const:`KQ_FILTER_VNODE` filter flags:" msgstr "" -#: library/select.rst:592 +#: library/select.rst:599 msgid ":const:`KQ_NOTE_DELETE`" msgstr "" -#: library/select.rst:592 +#: library/select.rst:599 msgid "*unlink()* was called" msgstr "" -#: library/select.rst:594 +#: library/select.rst:601 msgid ":const:`KQ_NOTE_WRITE`" msgstr "" -#: library/select.rst:594 +#: library/select.rst:601 msgid "a write occurred" msgstr "" -#: library/select.rst:596 +#: library/select.rst:603 msgid ":const:`KQ_NOTE_EXTEND`" msgstr "" -#: library/select.rst:596 +#: library/select.rst:603 msgid "the file was extended" msgstr "" -#: library/select.rst:598 +#: library/select.rst:605 msgid ":const:`KQ_NOTE_ATTRIB`" msgstr "" -#: library/select.rst:598 +#: library/select.rst:605 msgid "an attribute was changed" msgstr "" -#: library/select.rst:600 +#: library/select.rst:607 msgid ":const:`KQ_NOTE_LINK`" msgstr "" -#: library/select.rst:600 +#: library/select.rst:607 msgid "the link count has changed" msgstr "" -#: library/select.rst:602 +#: library/select.rst:609 msgid ":const:`KQ_NOTE_RENAME`" msgstr "" -#: library/select.rst:602 +#: library/select.rst:609 msgid "the file was renamed" msgstr "" -#: library/select.rst:604 +#: library/select.rst:611 msgid ":const:`KQ_NOTE_REVOKE`" msgstr "" -#: library/select.rst:604 +#: library/select.rst:611 msgid "access to the file was revoked" msgstr "" -#: library/select.rst:607 +#: library/select.rst:614 msgid ":const:`KQ_FILTER_PROC` filter flags:" msgstr "" -#: library/select.rst:612 +#: library/select.rst:619 msgid ":const:`KQ_NOTE_EXIT`" msgstr "" -#: library/select.rst:612 +#: library/select.rst:619 msgid "the process has exited" msgstr "" -#: library/select.rst:614 +#: library/select.rst:621 msgid ":const:`KQ_NOTE_FORK`" msgstr "" -#: library/select.rst:614 +#: library/select.rst:621 msgid "the process has called *fork()*" msgstr "" -#: library/select.rst:616 +#: library/select.rst:623 msgid ":const:`KQ_NOTE_EXEC`" msgstr "" -#: library/select.rst:616 +#: library/select.rst:623 msgid "the process has executed a new process" msgstr "" -#: library/select.rst:618 +#: library/select.rst:625 msgid ":const:`KQ_NOTE_PCTRLMASK`" msgstr "" -#: library/select.rst:620 +#: library/select.rst:627 msgid "internal filter flag" msgstr "" -#: library/select.rst:620 +#: library/select.rst:627 msgid ":const:`KQ_NOTE_PDATAMASK`" msgstr "" -#: library/select.rst:622 +#: library/select.rst:629 msgid ":const:`KQ_NOTE_TRACK`" msgstr "" -#: library/select.rst:622 +#: library/select.rst:629 msgid "follow a process across *fork()*" msgstr "" -#: library/select.rst:624 +#: library/select.rst:631 msgid ":const:`KQ_NOTE_CHILD`" msgstr "" -#: library/select.rst:624 +#: library/select.rst:631 msgid "returned on the child process for *NOTE_TRACK*" msgstr "" -#: library/select.rst:627 +#: library/select.rst:634 msgid ":const:`KQ_NOTE_TRACKERR`" msgstr "" -#: library/select.rst:627 +#: library/select.rst:634 msgid "unable to attach to a child" msgstr "" -#: library/select.rst:630 +#: library/select.rst:637 msgid ":const:`KQ_FILTER_NETDEV` filter flags (not available on macOS):" msgstr "" -#: library/select.rst:635 +#: library/select.rst:642 msgid ":const:`KQ_NOTE_LINKUP`" msgstr "" -#: library/select.rst:635 +#: library/select.rst:642 msgid "link is up" msgstr "" -#: library/select.rst:637 +#: library/select.rst:644 msgid ":const:`KQ_NOTE_LINKDOWN`" msgstr "" -#: library/select.rst:637 +#: library/select.rst:644 msgid "link is down" msgstr "" -#: library/select.rst:639 +#: library/select.rst:646 msgid ":const:`KQ_NOTE_LINKINV`" msgstr "" -#: library/select.rst:639 +#: library/select.rst:646 msgid "link state is invalid" msgstr "" -#: library/select.rst:645 +#: library/select.rst:652 msgid "Filter specific data." msgstr "" -#: library/select.rst:650 +#: library/select.rst:657 msgid "User defined value." msgstr "" -#: library/select.rst:141 +#: library/select.rst:142 msgid "socket() (in module socket)" msgstr "" -#: library/select.rst:141 +#: library/select.rst:142 msgid "popen() (in module os)" msgstr "" -#: library/select.rst:154 +#: library/select.rst:155 msgid "WinSock" msgstr "" diff --git a/library/selectors.po b/library/selectors.po index f64c245a..e38600ac 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/selectors.rst:2 -msgid ":mod:`selectors` --- High-level I/O multiplexing" +msgid ":mod:`!selectors` --- High-level I/O multiplexing" msgstr "" #: library/selectors.rst:9 @@ -69,14 +70,13 @@ msgid "Low-level I/O multiplexing module." msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/selectors.rst:44 @@ -87,6 +87,16 @@ msgstr "" msgid "Classes hierarchy::" msgstr "" +#: library/selectors.rst:48 +msgid "" +"BaseSelector\n" +"+-- SelectSelector\n" +"+-- PollSelector\n" +"+-- EpollSelector\n" +"+-- DevpollSelector\n" +"+-- KqueueSelector" +msgstr "" + #: library/selectors.rst:56 msgid "" "In the following, *events* is a bitwise mask indicating which I/O events " @@ -148,35 +158,35 @@ msgid "" "implementations support the :term:`context manager` protocol." msgstr "" -#: library/selectors.rst:108 +#: library/selectors.rst:109 msgid "Register a file object for selection, monitoring it for I/O events." msgstr "" -#: library/selectors.rst:110 +#: library/selectors.rst:111 msgid "" "*fileobj* is the file object to monitor. It may either be an integer file " "descriptor or an object with a ``fileno()`` method. *events* is a bitwise " "mask of events to monitor. *data* is an opaque object." msgstr "" -#: library/selectors.rst:115 +#: library/selectors.rst:116 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is already registered." msgstr "" -#: library/selectors.rst:121 +#: library/selectors.rst:123 msgid "" "Unregister a file object from selection, removing it from monitoring. A file " "object shall be unregistered prior to being closed." msgstr "" -#: library/selectors.rst:124 +#: library/selectors.rst:126 msgid "*fileobj* must be a file object previously registered." msgstr "" -#: library/selectors.rst:126 +#: library/selectors.rst:128 msgid "" "This returns the associated :class:`SelectorKey` instance, or raises a :exc:" "`KeyError` if *fileobj* is not registered. It will raise :exc:`ValueError` " @@ -184,30 +194,30 @@ msgid "" "``fileno()`` method has an invalid return value)." msgstr "" -#: library/selectors.rst:133 +#: library/selectors.rst:135 msgid "Change a registered file object's monitored events or attached data." msgstr "" -#: library/selectors.rst:135 +#: library/selectors.rst:137 msgid "" "This is equivalent to ``BaseSelector.unregister(fileobj)`` followed by " "``BaseSelector.register(fileobj, events, data)``, except that it can be " "implemented more efficiently." msgstr "" -#: library/selectors.rst:139 +#: library/selectors.rst:141 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is not registered." msgstr "" -#: library/selectors.rst:145 +#: library/selectors.rst:148 msgid "" "Wait until some registered file objects become ready, or the timeout expires." msgstr "" -#: library/selectors.rst:148 +#: library/selectors.rst:151 msgid "" "If ``timeout > 0``, this specifies the maximum wait time, in seconds. If " "``timeout <= 0``, the call won't block, and will report the currently ready " @@ -215,26 +225,26 @@ msgid "" "monitored file object becomes ready." msgstr "" -#: library/selectors.rst:154 +#: library/selectors.rst:157 msgid "" "This returns a list of ``(key, events)`` tuples, one for each ready file " "object." msgstr "" -#: library/selectors.rst:157 +#: library/selectors.rst:160 msgid "" "*key* is the :class:`SelectorKey` instance corresponding to a ready file " "object. *events* is a bitmask of events ready on this file object." msgstr "" -#: library/selectors.rst:162 +#: library/selectors.rst:165 msgid "" "This method can return before any file object becomes ready or the timeout " "has elapsed if the current process receives a signal: in this case, an empty " "list will be returned." msgstr "" -#: library/selectors.rst:166 +#: library/selectors.rst:169 msgid "" "The selector is now retried with a recomputed timeout when interrupted by a " "signal if the signal handler did not raise an exception (see :pep:`475` for " @@ -242,85 +252,121 @@ msgid "" "timeout." msgstr "" -#: library/selectors.rst:174 +#: library/selectors.rst:177 msgid "Close the selector." msgstr "" -#: library/selectors.rst:176 +#: library/selectors.rst:179 msgid "" "This must be called to make sure that any underlying resource is freed. The " "selector shall not be used once it has been closed." msgstr "" -#: library/selectors.rst:181 +#: library/selectors.rst:184 msgid "Return the key associated with a registered file object." msgstr "" -#: library/selectors.rst:183 +#: library/selectors.rst:186 msgid "" "This returns the :class:`SelectorKey` instance associated to this file " "object, or raises :exc:`KeyError` if the file object is not registered." msgstr "" -#: library/selectors.rst:188 +#: library/selectors.rst:192 msgid "Return a mapping of file objects to selector keys." msgstr "" -#: library/selectors.rst:190 +#: library/selectors.rst:194 msgid "" "This returns a :class:`~collections.abc.Mapping` instance mapping registered " "file objects to their associated :class:`SelectorKey` instance." msgstr "" -#: library/selectors.rst:197 +#: library/selectors.rst:201 msgid "" "The default selector class, using the most efficient implementation " "available on the current platform. This should be the default choice for " "most users." msgstr "" -#: library/selectors.rst:204 +#: library/selectors.rst:208 msgid ":func:`select.select`-based selector." msgstr "" -#: library/selectors.rst:209 +#: library/selectors.rst:213 msgid ":func:`select.poll`-based selector." msgstr "" -#: library/selectors.rst:214 +#: library/selectors.rst:218 msgid ":func:`select.epoll`-based selector." msgstr "" -#: library/selectors.rst:218 +#: library/selectors.rst:222 msgid "" "This returns the file descriptor used by the underlying :func:`select.epoll` " "object." msgstr "" -#: library/selectors.rst:223 +#: library/selectors.rst:227 msgid ":func:`select.devpoll`-based selector." msgstr "" -#: library/selectors.rst:227 +#: library/selectors.rst:231 msgid "" "This returns the file descriptor used by the underlying :func:`select." "devpoll` object." msgstr "" -#: library/selectors.rst:234 +#: library/selectors.rst:238 msgid ":func:`select.kqueue`-based selector." msgstr "" -#: library/selectors.rst:238 +#: library/selectors.rst:242 msgid "" "This returns the file descriptor used by the underlying :func:`select." "kqueue` object." msgstr "" -#: library/selectors.rst:243 +#: library/selectors.rst:247 msgid "Examples" msgstr "" -#: library/selectors.rst:245 +#: library/selectors.rst:249 msgid "Here is a simple echo server implementation::" msgstr "" + +#: library/selectors.rst:251 +msgid "" +"import selectors\n" +"import socket\n" +"\n" +"sel = selectors.DefaultSelector()\n" +"\n" +"def accept(sock, mask):\n" +" conn, addr = sock.accept() # Should be ready\n" +" print('accepted', conn, 'from', addr)\n" +" conn.setblocking(False)\n" +" sel.register(conn, selectors.EVENT_READ, read)\n" +"\n" +"def read(conn, mask):\n" +" data = conn.recv(1000) # Should be ready\n" +" if data:\n" +" print('echoing', repr(data), 'to', conn)\n" +" conn.send(data) # Hope it won't block\n" +" else:\n" +" print('closing', conn)\n" +" sel.unregister(conn)\n" +" conn.close()\n" +"\n" +"sock = socket.socket()\n" +"sock.bind(('localhost', 1234))\n" +"sock.listen(100)\n" +"sock.setblocking(False)\n" +"sel.register(sock, selectors.EVENT_READ, accept)\n" +"\n" +"while True:\n" +" events = sel.select()\n" +" for key, mask in events:\n" +" callback = key.data\n" +" callback(key.fileobj, mask)" +msgstr "" diff --git a/library/shelve.po b/library/shelve.po index 4c2da693..dd3923cf 100644 --- a/library/shelve.po +++ b/library/shelve.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/shelve.rst:2 -msgid ":mod:`shelve` --- Python object persistence" +msgid ":mod:`!shelve` --- Python object persistence" msgstr "" #: library/shelve.rst:7 @@ -82,6 +83,12 @@ msgid "" "`shelve.open` as a context manager::" msgstr "" +#: library/shelve.rst:57 +msgid "" +"with shelve.open('spam') as db:\n" +" db['eggs'] = 'eggs'" +msgstr "" + #: library/shelve.rst:64 msgid "" "Because the :mod:`shelve` module is backed by :mod:`pickle`, it is insecure " @@ -117,9 +124,9 @@ msgstr "" #: library/shelve.rst:89 msgid "" -"`Persistent dictionary recipe `_ with widely supported storage formats and having the speed of native " -"dictionaries." +"`Persistent dictionary recipe `_ with widely supported " +"storage formats and having the speed of native dictionaries." msgstr "" #: library/shelve.rst:95 @@ -230,7 +237,40 @@ msgid "" "object)::" msgstr "" -#: library/shelve.rst:219 +#: library/shelve.rst:185 +msgid "" +"import shelve\n" +"\n" +"d = shelve.open(filename) # open -- file may get suffix added by low-level\n" +" # library\n" +"\n" +"d[key] = data # store data at key (overwrites old data if\n" +" # using an existing key)\n" +"data = d[key] # retrieve a COPY of data at key (raise KeyError\n" +" # if no such key)\n" +"del d[key] # delete data stored at key (raises KeyError\n" +" # if no such key)\n" +"\n" +"flag = key in d # true if the key exists\n" +"klist = list(d.keys()) # a list of all existing keys (slow!)\n" +"\n" +"# as d was opened WITHOUT writeback=True, beware:\n" +"d['xx'] = [0, 1, 2] # this works as expected, but...\n" +"d['xx'].append(3) # *this doesn't!* -- d['xx'] is STILL [0, 1, 2]!\n" +"\n" +"# having opened d without writeback=True, you need to code carefully:\n" +"temp = d['xx'] # extracts the copy\n" +"temp.append(5) # mutates the copy\n" +"d['xx'] = temp # stores the copy right back, to persist it\n" +"\n" +"# or, d=shelve.open(filename,writeback=True) would let you just code\n" +"# d['xx'].append(5) and have it work as expected, BUT it would also\n" +"# consume more memory and make the d.close() operation slower.\n" +"\n" +"d.close() # close it" +msgstr "" + +#: library/shelve.rst:218 msgid "Module :mod:`dbm`" msgstr "" diff --git a/library/shlex.po b/library/shlex.po index 0957c307..809393e7 100644 --- a/library/shlex.po +++ b/library/shlex.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/shlex.rst:2 -msgid ":mod:`shlex` --- Simple lexical analysis" +msgid ":mod:`!shlex` --- Simple lexical analysis" msgstr "" #: library/shlex.rst:12 @@ -476,6 +477,21 @@ msgid "" "following snippet:" msgstr "" +#: library/shlex.rst:412 +msgid "" +">>> import shlex\n" +">>> text = \"a && b; c && d || e; f >'abc'; (def \\\"ghi\\\")\"\n" +">>> s = shlex.shlex(text, posix=True)\n" +">>> s.whitespace_split = True\n" +">>> list(s)\n" +"['a', '&&', 'b;', 'c', '&&', 'd', '||', 'e;', 'f', '>abc;', '(def', 'ghi)']\n" +">>> s = shlex.shlex(text, posix=True, punctuation_chars=True)\n" +">>> s.whitespace_split = True\n" +">>> list(s)\n" +"['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',\n" +"'(', 'def', 'ghi', ')']" +msgstr "" + #: library/shlex.rst:427 msgid "" "Of course, tokens will be returned which are not valid for shells, and " @@ -489,6 +505,14 @@ msgid "" "used to determine which characters constitute punctuation. For example::" msgstr "" +#: library/shlex.rst:434 +msgid "" +">>> import shlex\n" +">>> s = shlex.shlex(\"a && b || c\", punctuation_chars=\"|\")\n" +">>> list(s)\n" +"['a', '&', '&', 'b', '||', 'c']" +msgstr "" + #: library/shlex.rst:439 msgid "" "When ``punctuation_chars`` is specified, the :attr:`~shlex.wordchars` " @@ -497,6 +521,15 @@ msgid "" "line arguments (e.g. ``--color=auto``). Hence::" msgstr "" +#: library/shlex.rst:444 +msgid "" +">>> import shlex\n" +">>> s = shlex.shlex('~/a && b-c --color=auto || d *.py?',\n" +"... punctuation_chars=True)\n" +">>> list(s)\n" +"['~/a', '&&', 'b-c', '--color=auto', '||', 'd', '*.py?']" +msgstr "" + #: library/shlex.rst:450 msgid "" "However, to match the shell as closely as possible, it is recommended to " diff --git a/library/shutil.po b/library/shutil.po index 1133fb96..9a6ed6b7 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/shutil.rst:2 -msgid ":mod:`shutil` --- High-level file operations" +msgid ":mod:`!shutil` --- High-level file operations" msgstr "" #: library/shutil.rst:10 @@ -62,7 +63,18 @@ msgid "" "current file position to the end of the file will be copied." msgstr "" -#: library/shutil.rst:53 +#: library/shutil.rst:50 +msgid "" +":func:`copyfileobj` will *not* guarantee that the destination stream has " +"been flushed on completion of the copy. If you want to read from the " +"destination at the completion of the copy operation (for example, reading " +"the contents of a temporary file that has been copied from a HTTP stream), " +"you must ensure that you have called :func:`~io.IOBase.flush` or :func:`~io." +"IOBase.close` on the file-like object before attempting to read the " +"destination file." +msgstr "" + +#: library/shutil.rst:60 msgid "" "Copy the contents (no metadata) of the file named *src* to a file named " "*dst* and return *dst* in the most efficient way possible. *src* and *dst* " @@ -70,14 +82,14 @@ msgid "" "strings." msgstr "" -#: library/shutil.rst:57 +#: library/shutil.rst:64 msgid "" "*dst* must be the complete target file name; look at :func:`~shutil.copy` " "for a copy that accepts a target directory path. If *src* and *dst* specify " "the same file, :exc:`SameFileError` is raised." msgstr "" -#: library/shutil.rst:61 +#: library/shutil.rst:68 msgid "" "The destination location must be writable; otherwise, an :exc:`OSError` " "exception will be raised. If *dst* already exists, it will be replaced. " @@ -85,44 +97,50 @@ msgid "" "with this function." msgstr "" -#: library/shutil.rst:66 +#: library/shutil.rst:73 msgid "" "If *follow_symlinks* is false and *src* is a symbolic link, a new symbolic " "link will be created instead of copying the file *src* points to." msgstr "" -#: library/shutil.rst:177 library/shutil.rst:208 +#: library/shutil.rst:191 library/shutil.rst:222 msgid "" "Raises an :ref:`auditing event ` ``shutil.copyfile`` with " "arguments ``src``, ``dst``." msgstr "" -#: library/shutil.rst:72 +#: library/shutil.rst:79 msgid "" ":exc:`IOError` used to be raised instead of :exc:`OSError`. Added " "*follow_symlinks* argument. Now returns *dst*." msgstr "" -#: library/shutil.rst:77 +#: library/shutil.rst:84 msgid "" "Raise :exc:`SameFileError` instead of :exc:`Error`. Since the former is a " "subclass of the latter, this change is backward compatible." msgstr "" -#: library/shutil.rst:185 library/shutil.rst:287 library/shutil.rst:390 +#: library/shutil.rst:199 library/shutil.rst:301 library/shutil.rst:414 msgid "" "Platform-specific fast-copy syscalls may be used internally in order to copy " "the file more efficiently. See :ref:`shutil-platform-dependent-efficient-" "copy-operations` section." msgstr "" -#: library/shutil.rst:88 +#: library/shutil.rst:95 +msgid "" +"This exception is raised when :func:`copyfile` or :func:`copytree` attempt " +"to copy a named pipe." +msgstr "" + +#: library/shutil.rst:102 msgid "" "This exception is raised if source and destination in :func:`copyfile` are " "the same file." msgstr "" -#: library/shutil.rst:96 +#: library/shutil.rst:110 msgid "" "Copy the permission bits from *src* to *dst*. The file contents, owner, and " "group are unaffected. *src* and *dst* are :term:`path-like objects ` ``shutil.copymode`` with " "arguments ``src``, ``dst``." msgstr "" -#: library/shutil.rst:108 +#: library/shutil.rst:122 msgid "Added *follow_symlinks* argument." msgstr "" -#: library/shutil.rst:113 +#: library/shutil.rst:127 msgid "" "Copy the permission bits, last access time, last modification time, and " "flags from *src* to *dst*. On Linux, :func:`copystat` also copies the " @@ -154,7 +172,7 @@ msgid "" "object>` or path names given as strings." msgstr "" -#: library/shutil.rst:119 +#: library/shutil.rst:133 msgid "" "If *follow_symlinks* is false, and *src* and *dst* both refer to symbolic " "links, :func:`copystat` will operate on the symbolic links themselves rather " @@ -162,54 +180,54 @@ msgid "" "*src* symbolic link, and writing the information to the *dst* symbolic link." msgstr "" -#: library/shutil.rst:128 +#: library/shutil.rst:142 msgid "" "Not all platforms provide the ability to examine and modify symbolic links. " "Python itself can tell you what functionality is locally available." msgstr "" -#: library/shutil.rst:132 +#: library/shutil.rst:146 msgid "" "If ``os.chmod in os.supports_follow_symlinks`` is ``True``, :func:`copystat` " "can modify the permission bits of a symbolic link." msgstr "" -#: library/shutil.rst:136 +#: library/shutil.rst:150 msgid "" "If ``os.utime in os.supports_follow_symlinks`` is ``True``, :func:`copystat` " "can modify the last access and modification times of a symbolic link." msgstr "" -#: library/shutil.rst:140 +#: library/shutil.rst:154 msgid "" "If ``os.chflags in os.supports_follow_symlinks`` is ``True``, :func:" "`copystat` can modify the flags of a symbolic link. (``os.chflags`` is not " "available on all platforms.)" msgstr "" -#: library/shutil.rst:145 +#: library/shutil.rst:159 msgid "" "On platforms where some or all of this functionality is unavailable, when " "asked to modify a symbolic link, :func:`copystat` will copy everything it " "can. :func:`copystat` never returns failure." msgstr "" -#: library/shutil.rst:150 +#: library/shutil.rst:164 msgid "Please see :data:`os.supports_follow_symlinks` for more information." msgstr "" -#: library/shutil.rst:210 +#: library/shutil.rst:224 msgid "" "Raises an :ref:`auditing event ` ``shutil.copystat`` with " "arguments ``src``, ``dst``." msgstr "" -#: library/shutil.rst:155 +#: library/shutil.rst:169 msgid "" "Added *follow_symlinks* argument and support for Linux extended attributes." msgstr "" -#: library/shutil.rst:160 +#: library/shutil.rst:174 msgid "" "Copies the file *src* to the file or directory *dst*. *src* and *dst* " "should be :term:`path-like objects ` or strings. If *dst* " @@ -218,14 +236,14 @@ msgid "" "be replaced. Returns the path to the newly created file." msgstr "" -#: library/shutil.rst:166 +#: library/shutil.rst:180 msgid "" "If *follow_symlinks* is false, and *src* is a symbolic link, *dst* will be " "created as a symbolic link. If *follow_symlinks* is true and *src* is a " "symbolic link, *dst* will be a copy of the file *src* refers to." msgstr "" -#: library/shutil.rst:171 +#: library/shutil.rst:185 msgid "" ":func:`~shutil.copy` copies the file data and the file's permission mode " "(see :func:`os.chmod`). Other metadata, like the file's creation and " @@ -233,18 +251,18 @@ msgid "" "original, use :func:`~shutil.copy2` instead." msgstr "" -#: library/shutil.rst:181 +#: library/shutil.rst:195 msgid "" "Added *follow_symlinks* argument. Now returns path to the newly created file." msgstr "" -#: library/shutil.rst:192 +#: library/shutil.rst:206 msgid "" "Identical to :func:`~shutil.copy` except that :func:`copy2` also attempts to " "preserve file metadata." msgstr "" -#: library/shutil.rst:195 +#: library/shutil.rst:209 msgid "" "When *follow_symlinks* is false, and *src* is a symbolic link, :func:`copy2` " "attempts to copy all metadata from the *src* symbolic link to the newly " @@ -254,41 +272,41 @@ msgid "" "`copy2` never raises an exception because it cannot preserve file metadata." msgstr "" -#: library/shutil.rst:204 +#: library/shutil.rst:218 msgid "" ":func:`copy2` uses :func:`copystat` to copy the file metadata. Please see :" "func:`copystat` for more information about platform support for modifying " "symbolic link metadata." msgstr "" -#: library/shutil.rst:212 +#: library/shutil.rst:226 msgid "" "Added *follow_symlinks* argument, try to copy extended file system " "attributes too (currently Linux only). Now returns path to the newly created " "file." msgstr "" -#: library/shutil.rst:224 +#: library/shutil.rst:238 msgid "" "This factory function creates a function that can be used as a callable for :" "func:`copytree`\\'s *ignore* argument, ignoring files and directories that " "match one of the glob-style *patterns* provided. See the example below." msgstr "" -#: library/shutil.rst:233 +#: library/shutil.rst:247 msgid "" "Recursively copy an entire directory tree rooted at *src* to a directory " "named *dst* and return the destination directory. All intermediate " "directories needed to contain *dst* will also be created by default." msgstr "" -#: library/shutil.rst:237 +#: library/shutil.rst:251 msgid "" "Permissions and times of directories are copied with :func:`copystat`, " "individual files are copied using :func:`~shutil.copy2`." msgstr "" -#: library/shutil.rst:240 +#: library/shutil.rst:254 msgid "" "If *symlinks* is true, symbolic links in the source tree are represented as " "symbolic links in the new tree and the metadata of the original links will " @@ -296,17 +314,17 @@ msgid "" "and metadata of the linked files are copied to the new tree." msgstr "" -#: library/shutil.rst:245 +#: library/shutil.rst:259 msgid "" -"When *symlinks* is false, if the file pointed by the symlink doesn't exist, " -"an exception will be added in the list of errors raised in an :exc:`Error` " -"exception at the end of the copy process. You can set the optional " +"When *symlinks* is false, if the file pointed to by the symlink doesn't " +"exist, an exception will be added in the list of errors raised in an :exc:" +"`Error` exception at the end of the copy process. You can set the optional " "*ignore_dangling_symlinks* flag to true if you want to silence this " "exception. Notice that this option has no effect on platforms that don't " "support :func:`os.symlink`." msgstr "" -#: library/shutil.rst:252 +#: library/shutil.rst:266 msgid "" "If *ignore* is given, it must be a callable that will receive as its " "arguments the directory being visited by :func:`copytree`, and a list of its " @@ -319,12 +337,12 @@ msgid "" "ignores names based on glob-style patterns." msgstr "" -#: library/shutil.rst:262 +#: library/shutil.rst:276 msgid "" "If exception(s) occur, an :exc:`Error` is raised with a list of reasons." msgstr "" -#: library/shutil.rst:264 +#: library/shutil.rst:278 msgid "" "If *copy_function* is given, it must be a callable that will be used to copy " "each file. It will be called with the source path and the destination path " @@ -332,7 +350,7 @@ msgid "" "that supports the same signature (like :func:`~shutil.copy`) can be used." msgstr "" -#: library/shutil.rst:269 +#: library/shutil.rst:283 msgid "" "If *dirs_exist_ok* is false (the default) and *dst* already exists, a :exc:" "`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " @@ -341,28 +359,28 @@ msgid "" "*src* tree." msgstr "" -#: library/shutil.rst:275 +#: library/shutil.rst:289 msgid "" "Raises an :ref:`auditing event ` ``shutil.copytree`` with " "arguments ``src``, ``dst``." msgstr "" -#: library/shutil.rst:277 +#: library/shutil.rst:291 msgid "" "Added the *copy_function* argument to be able to provide a custom copy " "function. Added the *ignore_dangling_symlinks* argument to silence dangling " "symlinks errors when *symlinks* is false." msgstr "" -#: library/shutil.rst:283 +#: library/shutil.rst:297 msgid "Copy metadata when *symlinks* is false. Now returns *dst*." msgstr "" -#: library/shutil.rst:292 +#: library/shutil.rst:306 msgid "Added the *dirs_exist_ok* parameter." msgstr "" -#: library/shutil.rst:299 +#: library/shutil.rst:313 msgid "" "Delete an entire directory tree; *path* must point to a directory (but not a " "symbolic link to a directory). If *ignore_errors* is true, errors resulting " @@ -371,13 +389,13 @@ msgid "" "are omitted, exceptions are propagated to the caller." msgstr "" -#: library/shutil.rst:305 +#: library/shutil.rst:319 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: library/shutil.rst:310 +#: library/shutil.rst:324 msgid "" "On platforms that support the necessary fd-based functions a symlink attack " "resistant version of :func:`rmtree` is used by default. On other platforms, " @@ -388,13 +406,13 @@ msgid "" "attribute to determine which case applies." msgstr "" -#: library/shutil.rst:318 +#: library/shutil.rst:332 msgid "" "If *onexc* is provided, it must be a callable that accepts three parameters: " "*function*, *path*, and *excinfo*." msgstr "" -#: library/shutil.rst:321 +#: library/shutil.rst:335 msgid "" "The first parameter, *function*, is the function which raised the exception; " "it depends on the platform and implementation. The second parameter, " @@ -403,65 +421,78 @@ msgid "" "will not be caught." msgstr "" -#: library/shutil.rst:327 +#: library/shutil.rst:341 msgid "" "The deprecated *onerror* is similar to *onexc*, except that the third " "parameter it receives is the tuple returned from :func:`sys.exc_info`." msgstr "" -#: library/shutil.rst:330 +#: library/shutil.rst:345 +msgid "" +":ref:`shutil-rmtree-example` for an example of handling the removal of a " +"directory tree that contains read-only files." +msgstr "" + +#: library/shutil.rst:348 msgid "" "Raises an :ref:`auditing event ` ``shutil.rmtree`` with arguments " "``path``, ``dir_fd``." msgstr "" -#: library/shutil.rst:332 +#: library/shutil.rst:350 msgid "" "Added a symlink attack resistant version that is used automatically if " "platform supports fd-based functions." msgstr "" -#: library/shutil.rst:336 +#: library/shutil.rst:354 msgid "" "On Windows, will no longer delete the contents of a directory junction " "before removing the junction." msgstr "" -#: library/shutil.rst:340 -msgid "The *dir_fd* parameter." +#: library/shutil.rst:358 +msgid "Added the *dir_fd* parameter." msgstr "" -#: library/shutil.rst:343 +#: library/shutil.rst:361 msgid "Added the *onexc* parameter, deprecated *onerror*." msgstr "" -#: library/shutil.rst:348 +#: library/shutil.rst:364 +msgid "" +":func:`!rmtree` now ignores :exc:`FileNotFoundError` exceptions for all but " +"the top-level path. Exceptions other than :exc:`OSError` and subclasses of :" +"exc:`!OSError` are now always propagated to the caller." +msgstr "" + +#: library/shutil.rst:372 msgid "" "Indicates whether the current platform and implementation provides a symlink " "attack resistant version of :func:`rmtree`. Currently this is only true for " "platforms supporting fd-based directory access functions." msgstr "" -#: library/shutil.rst:357 +#: library/shutil.rst:381 msgid "" "Recursively move a file or directory (*src*) to another location and return " "the destination." msgstr "" -#: library/shutil.rst:360 +#: library/shutil.rst:384 msgid "" "If *dst* is an existing directory or a symlink to a directory, then *src* is " "moved inside that directory. The destination path in that directory must not " "already exist." msgstr "" -#: library/shutil.rst:364 +#: library/shutil.rst:388 msgid "" "If *dst* already exists but is not a directory, it may be overwritten " "depending on :func:`os.rename` semantics." msgstr "" -#: library/shutil.rst:367 +#: library/shutil.rst:391 msgid "" "If the destination is on the current filesystem, then :func:`os.rename` is " "used. Otherwise, *src* is copied to the destination using *copy_function* " @@ -469,7 +500,7 @@ msgid "" "of *src* will be created as the destination and *src* will be removed." msgstr "" -#: library/shutil.rst:372 +#: library/shutil.rst:396 msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " @@ -480,91 +511,100 @@ msgid "" "copy the metadata, at the expense of not copying any of the metadata." msgstr "" -#: library/shutil.rst:380 +#: library/shutil.rst:404 msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." msgstr "" -#: library/shutil.rst:382 +#: library/shutil.rst:406 msgid "" "Added explicit symlink handling for foreign filesystems, thus adapting it to " "the behavior of GNU's :program:`mv`. Now returns *dst*." msgstr "" -#: library/shutil.rst:387 +#: library/shutil.rst:411 msgid "Added the *copy_function* keyword argument." msgstr "" -#: library/shutil.rst:395 +#: library/shutil.rst:419 msgid "Accepts a :term:`path-like object` for both *src* and *dst*." msgstr "" -#: library/shutil.rst:400 +#: library/shutil.rst:424 msgid "" "Return disk usage statistics about the given path as a :term:`named tuple` " "with the attributes *total*, *used* and *free*, which are the amount of " "total, used and free space, in bytes. *path* may be a file or a directory." msgstr "" -#: library/shutil.rst:407 +#: library/shutil.rst:431 msgid "" "On Unix filesystems, *path* must point to a path within a **mounted** " "filesystem partition. On those platforms, CPython doesn't attempt to " "retrieve disk usage information from non-mounted filesystems." msgstr "" -#: library/shutil.rst:413 +#: library/shutil.rst:437 msgid "On Windows, *path* can now be a file or directory." msgstr "" -#: library/shutil.rst:416 -msgid ":ref:`Availability `: Unix, Windows." +#: library/shutil.rst:454 +msgid "Availability" msgstr "" -#: library/shutil.rst:420 +#: library/shutil.rst:445 msgid "Change owner *user* and/or *group* of the given *path*." msgstr "" -#: library/shutil.rst:422 +#: library/shutil.rst:447 msgid "" "*user* can be a system user name or a uid; the same applies to *group*. At " "least one argument is required." msgstr "" -#: library/shutil.rst:425 +#: library/shutil.rst:450 msgid "See also :func:`os.chown`, the underlying function." msgstr "" -#: library/shutil.rst:427 +#: library/shutil.rst:452 msgid "" "Raises an :ref:`auditing event ` ``shutil.chown`` with arguments " "``path``, ``user``, ``group``." msgstr "" -#: library/shutil.rst:429 -msgid ":ref:`Availability `: Unix." +#: library/shutil.rst:458 +msgid "Added *dir_fd* and *follow_symlinks* parameters." msgstr "" -#: library/shutil.rst:436 +#: library/shutil.rst:464 msgid "" "Return the path to an executable which would be run if the given *cmd* was " "called. If no *cmd* would be called, return ``None``." msgstr "" -#: library/shutil.rst:439 +#: library/shutil.rst:467 msgid "" "*mode* is a permission mask passed to :func:`os.access`, by default " -"determining if the file exists and executable." +"determining if the file exists and is executable." msgstr "" -#: library/shutil.rst:442 +#: library/shutil.rst:470 msgid "" -"When no *path* is specified, the results of :func:`os.environ` are used, " -"returning either the \"PATH\" value or a fallback of :data:`os.defpath`." +"*path* is a \"``PATH`` string\" specifying the directories to look in, " +"delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" +"`PATH` environment variable is read from :data:`os.environ`, falling back " +"to :data:`os.defpath` if it is not set." msgstr "" -#: library/shutil.rst:445 +#: library/shutil.rst:475 +msgid "" +"If *cmd* contains a directory component, :func:`!which` only checks the " +"specified path directly and does not search the directories listed in *path* " +"or in the system's :envvar:`PATH` environment variable." +msgstr "" + +#: library/shutil.rst:479 msgid "" "On Windows, the current directory is prepended to the *path* if *mode* does " "not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the " @@ -574,28 +614,40 @@ msgid "" "environment variable ``NoDefaultCurrentDirectoryInExePath``." msgstr "" -#: library/shutil.rst:452 +#: library/shutil.rst:486 msgid "" -"Also on Windows, the ``PATHEXT`` variable is used to resolve commands that " -"may not already include an extension. For example, if you call ``shutil." -"which(\"python\")``, :func:`which` will search ``PATHEXT`` to know that it " -"should look for ``python.exe`` within the *path* directories. For example, " -"on Windows::" +"Also on Windows, the :envvar:`PATHEXT` environment variable is used to " +"resolve commands that may not already include an extension. For example, if " +"you call ``shutil.which(\"python\")``, :func:`which` will search ``PATHEXT`` " +"to know that it should look for ``python.exe`` within the *path* " +"directories. For example, on Windows::" msgstr "" -#: library/shutil.rst:461 +#: library/shutil.rst:492 +msgid "" +">>> shutil.which(\"python\")\n" +"'C:\\\\Python33\\\\python.EXE'" +msgstr "" + +#: library/shutil.rst:495 msgid "" "This is also applied when *cmd* is a path that contains a directory " "component::" msgstr "" -#: library/shutil.rst:469 +#: library/shutil.rst:498 +msgid "" +">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" +"'C:\\\\Python33\\\\python.EXE'" +msgstr "" + +#: library/shutil.rst:503 msgid "" "The :class:`bytes` type is now accepted. If *cmd* type is :class:`bytes`, " "the result type is also :class:`bytes`." msgstr "" -#: library/shutil.rst:473 +#: library/shutil.rst:507 msgid "" "On Windows, the current directory is no longer prepended to the search path " "if *mode* includes ``os.X_OK`` and WinAPI " @@ -606,25 +658,18 @@ msgid "" "now be found." msgstr "" -#: library/shutil.rst:482 -msgid "" -"On Windows, if *mode* includes ``os.X_OK``, executables with an extension in " -"``PATHEXT`` will be preferred over executables without a matching extension. " -"This brings behavior closer to that of Python 3.11." -msgstr "" - -#: library/shutil.rst:490 +#: library/shutil.rst:518 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: library/shutil.rst:497 +#: library/shutil.rst:525 msgid "Platform-dependent efficient copy operations" msgstr "" -#: library/shutil.rst:499 +#: library/shutil.rst:527 msgid "" "Starting from Python 3.8, all functions involving a file copy (:func:" "`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" @@ -634,51 +679,84 @@ msgid "" "buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: library/shutil.rst:507 +#: library/shutil.rst:535 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: library/shutil.rst:509 -msgid "On Linux :func:`os.sendfile` is used." +#: library/shutil.rst:537 +msgid "On Linux :func:`os.copy_file_range` or :func:`os.sendfile` is used." +msgstr "" + +#: library/shutil.rst:539 +msgid "On Solaris :func:`os.sendfile` is used." msgstr "" -#: library/shutil.rst:511 +#: library/shutil.rst:541 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " "instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." "copyfileobj` is used." msgstr "" -#: library/shutil.rst:515 +#: library/shutil.rst:545 msgid "" "If the fast-copy operation fails and no data was written in the destination " "file then shutil will silently fallback on using less efficient :func:" "`copyfileobj` function internally." msgstr "" -#: library/shutil.rst:524 +#: library/shutil.rst:551 +msgid "Solaris now uses :func:`os.sendfile`." +msgstr "" + +#: library/shutil.rst:554 +msgid "" +"Copy-on-write or server-side copy may be used internally via :func:`os." +"copy_file_range` on supported Linux filesystems." +msgstr "" + +#: library/shutil.rst:561 msgid "copytree example" msgstr "" -#: library/shutil.rst:526 +#: library/shutil.rst:563 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: library/shutil.rst:532 +#: library/shutil.rst:565 +msgid "" +"from shutil import copytree, ignore_patterns\n" +"\n" +"copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" +msgstr "" + +#: library/shutil.rst:569 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: library/shutil.rst:535 +#: library/shutil.rst:572 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: library/shutil.rst:550 +#: library/shutil.rst:574 +msgid "" +"from shutil import copytree\n" +"import logging\n" +"\n" +"def _logpath(path, names):\n" +" logging.info('Working in %s', path)\n" +" return [] # nothing will be ignored\n" +"\n" +"copytree(source, destination, ignore=_logpath)" +msgstr "" + +#: library/shutil.rst:587 msgid "rmtree example" msgstr "" -#: library/shutil.rst:552 +#: library/shutil.rst:589 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " @@ -686,46 +764,60 @@ msgid "" "propagate. ::" msgstr "" -#: library/shutil.rst:570 +#: library/shutil.rst:594 +msgid "" +"import os, stat\n" +"import shutil\n" +"\n" +"def remove_readonly(func, path, _):\n" +" \"Clear the readonly bit and reattempt the removal\"\n" +" os.chmod(path, stat.S_IWRITE)\n" +" func(path)\n" +"\n" +"shutil.rmtree(directory, onexc=remove_readonly)" +msgstr "" + +#: library/shutil.rst:607 msgid "Archiving operations" msgstr "" -#: library/shutil.rst:574 +#: library/shutil.rst:611 msgid "Added support for the *xztar* format." msgstr "" -#: library/shutil.rst:578 +#: library/shutil.rst:615 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: library/shutil.rst:583 +#: library/shutil.rst:620 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: library/shutil.rst:585 +#: library/shutil.rst:622 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension." msgstr "" -#: library/shutil.rst:588 +#: library/shutil.rst:625 msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " -"\"bztar\" (if the :mod:`bz2` module is available), or \"xztar\" (if the :mod:" -"`lzma` module is available)." +"\"bztar\" (if the :mod:`bz2` module is available), \"xztar\" (if the :mod:" +"`lzma` module is available), or \"zstdtar\" (if the :mod:`compression.zstd` " +"module is available)." msgstr "" -#: library/shutil.rst:593 +#: library/shutil.rst:631 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: library/shutil.rst:597 +#: library/shutil.rst:635 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -733,39 +825,39 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: library/shutil.rst:603 +#: library/shutil.rst:641 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: library/shutil.rst:605 +#: library/shutil.rst:643 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: library/shutil.rst:608 +#: library/shutil.rst:646 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: library/shutil.rst:611 +#: library/shutil.rst:649 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." msgstr "" -#: library/shutil.rst:614 +#: library/shutil.rst:652 msgid "The *verbose* argument is unused and deprecated." msgstr "" -#: library/shutil.rst:616 +#: library/shutil.rst:654 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." msgstr "" -#: library/shutil.rst:620 +#: library/shutil.rst:658 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` do not support the *root_dir* argument. In this " @@ -773,60 +865,66 @@ msgid "" "*root_dir* to perform archiving." msgstr "" -#: library/shutil.rst:626 +#: library/shutil.rst:664 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: library/shutil.rst:630 +#: library/shutil.rst:668 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: library/shutil.rst:636 +#: library/shutil.rst:674 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: library/shutil.rst:750 +#: library/shutil.rst:794 msgid "By default :mod:`shutil` provides these formats:" msgstr "" -#: library/shutil.rst:641 +#: library/shutil.rst:679 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: library/shutil.rst:642 +#: library/shutil.rst:680 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: library/shutil.rst:755 +#: library/shutil.rst:799 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: library/shutil.rst:756 +#: library/shutil.rst:800 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: library/shutil.rst:757 +#: library/shutil.rst:801 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: library/shutil.rst:647 +#: library/shutil.rst:802 +msgid "" +"*zstdtar*: Zstandard compressed tar-file (if the :mod:`compression.zstd` " +"module is available)." +msgstr "" + +#: library/shutil.rst:687 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: library/shutil.rst:653 +#: library/shutil.rst:693 msgid "Register an archiver for the format *name*." msgstr "" -#: library/shutil.rst:655 +#: library/shutil.rst:695 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -835,7 +933,7 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: library/shutil.rst:661 +#: library/shutil.rst:701 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -844,62 +942,61 @@ msgid "" "not thread-safe." msgstr "" -#: library/shutil.rst:667 +#: library/shutil.rst:707 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: library/shutil.rst:670 +#: library/shutil.rst:710 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: library/shutil.rst:673 +#: library/shutil.rst:713 msgid "Added support for functions supporting the *root_dir* argument." msgstr "" -#: library/shutil.rst:679 +#: library/shutil.rst:719 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: library/shutil.rst:684 +#: library/shutil.rst:724 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: library/shutil.rst:686 +#: library/shutil.rst:726 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: library/shutil.rst:689 +#: library/shutil.rst:729 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " -"\"bztar\", or \"xztar\". Or any other format registered with :func:" -"`register_unpack_format`. If not provided, :func:`unpack_archive` will use " -"the archive file name extension and see if an unpacker was registered for " -"that extension. In case none is found, a :exc:`ValueError` is raised." +"\"bztar\", \"xztar\", or \"zstdtar\". Or any other format registered with :" +"func:`register_unpack_format`. If not provided, :func:`unpack_archive` will " +"use the archive file name extension and see if an unpacker was registered " +"for that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" -#: library/shutil.rst:696 +#: library/shutil.rst:736 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " -"recommended to set it to ``'data'``, unless using features specific to tar " -"and UNIX-like filesystems. (See :ref:`tarfile-extraction-filter` for " -"details.) The ``'data'`` filter will become the default for tar files in " -"Python 3.14." +"recommended to use ``'data'`` (default since Python 3.14), unless using " +"features specific to tar and UNIX-like filesystems. (See :ref:`tarfile-" +"extraction-filter` for details.)" msgstr "" -#: library/shutil.rst:704 +#: library/shutil.rst:742 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." msgstr "" -#: library/shutil.rst:708 +#: library/shutil.rst:746 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -907,138 +1004,201 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: library/shutil.rst:713 +#: library/shutil.rst:751 +msgid "" +"Since Python 3.14, the defaults for both built-in formats (zip and tar " +"files) will prevent the most dangerous of such security issues, but will not " +"prevent *all* unintended behavior. Read the :ref:`tarfile-further-" +"verification` section for tar-specific details." +msgstr "" + +#: library/shutil.rst:757 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: library/shutil.rst:716 +#: library/shutil.rst:760 msgid "Added the *filter* argument." msgstr "" -#: library/shutil.rst:721 +#: library/shutil.rst:765 msgid "" "Registers an unpack format. *name* is the name of the format and " "*extensions* is a list of extensions corresponding to the format, like ``." "zip`` for Zip files." msgstr "" -#: library/shutil.rst:725 +#: library/shutil.rst:769 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" -#: library/shutil.rst:728 +#: library/shutil.rst:772 msgid "the path of the archive, as a positional argument;" msgstr "" -#: library/shutil.rst:729 +#: library/shutil.rst:773 msgid "" "the directory the archive must be extracted to, as a positional argument;" msgstr "" -#: library/shutil.rst:730 +#: library/shutil.rst:774 msgid "" "possibly a *filter* keyword argument, if it was given to :func:" "`unpack_archive`;" msgstr "" -#: library/shutil.rst:732 +#: library/shutil.rst:776 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" -#: library/shutil.rst:735 +#: library/shutil.rst:779 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: library/shutil.rst:741 +#: library/shutil.rst:785 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: library/shutil.rst:746 +#: library/shutil.rst:790 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: library/shutil.rst:752 +#: library/shutil.rst:796 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: library/shutil.rst:754 +#: library/shutil.rst:798 msgid "*tar*: uncompressed tar file." msgstr "" -#: library/shutil.rst:759 +#: library/shutil.rst:805 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: library/shutil.rst:766 +#: library/shutil.rst:812 msgid "Archiving example" msgstr "" -#: library/shutil.rst:768 +#: library/shutil.rst:814 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: library/shutil.rst:778 +#: library/shutil.rst:817 +msgid "" +">>> from shutil import make_archive\n" +">>> import os\n" +">>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))\n" +">>> root_dir = os.path.expanduser(os.path.join('~', '.ssh'))\n" +">>> make_archive(archive_name, 'gztar', root_dir)\n" +"'/Users/tarek/myarchive.tar.gz'" +msgstr "" + +#: library/shutil.rst:824 msgid "The resulting archive contains:" msgstr "" -#: library/shutil.rst:796 +#: library/shutil.rst:826 +msgid "" +"$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" +"drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" +"-rw-r--r-- tarek/staff 609 2008-06-09 13:26:54 ./authorized_keys\n" +"-rwxr-xr-x tarek/staff 65 2008-06-09 13:26:54 ./config\n" +"-rwx------ tarek/staff 668 2008-06-09 13:26:54 ./id_dsa\n" +"-rwxr-xr-x tarek/staff 609 2008-06-09 13:26:54 ./id_dsa.pub\n" +"-rw------- tarek/staff 1675 2008-06-09 13:26:54 ./id_rsa\n" +"-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" +"-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" +msgstr "" + +#: library/shutil.rst:842 msgid "Archiving example with *base_dir*" msgstr "" -#: library/shutil.rst:798 +#: library/shutil.rst:844 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: library/shutil.rst:812 +#: library/shutil.rst:848 +msgid "" +"$ tree tmp\n" +"tmp\n" +"└── root\n" +" └── structure\n" +" ├── content\n" +" └── please_add.txt\n" +" └── do_not_add.txt" +msgstr "" + +#: library/shutil.rst:858 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: library/shutil.rst:826 +#: library/shutil.rst:861 +msgid "" +">>> from shutil import make_archive\n" +">>> import os\n" +">>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))\n" +">>> make_archive(\n" +"... archive_name,\n" +"... 'tar',\n" +"... root_dir='tmp/root',\n" +"... base_dir='structure/content',\n" +"... )\n" +"'/Users/tarek/myarchive.tar'" +msgstr "" + +#: library/shutil.rst:872 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: library/shutil.rst:836 +#: library/shutil.rst:874 +msgid "" +"$ python -m tarfile -l /Users/tarek/myarchive.tar\n" +"structure/content/\n" +"structure/content/please_add.txt" +msgstr "" + +#: library/shutil.rst:882 msgid "Querying the size of the output terminal" msgstr "" -#: library/shutil.rst:840 +#: library/shutil.rst:886 msgid "Get the size of the terminal window." msgstr "" -#: library/shutil.rst:842 +#: library/shutil.rst:888 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: library/shutil.rst:846 +#: library/shutil.rst:892 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " "terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" "`os.get_terminal_size`." msgstr "" -#: library/shutil.rst:850 +#: library/shutil.rst:896 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -1047,17 +1207,17 @@ msgid "" "emulators." msgstr "" -#: library/shutil.rst:856 +#: library/shutil.rst:902 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: library/shutil.rst:858 +#: library/shutil.rst:904 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" -#: library/shutil.rst:863 +#: library/shutil.rst:909 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes." @@ -1075,10 +1235,10 @@ msgstr "" msgid "copying files" msgstr "" -#: library/shutil.rst:297 +#: library/shutil.rst:311 msgid "directory" msgstr "" -#: library/shutil.rst:297 +#: library/shutil.rst:311 msgid "deleting" msgstr "" diff --git a/library/signal.po b/library/signal.po index 32cf4761..87ea72a1 100644 --- a/library/signal.po +++ b/library/signal.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/signal.rst:2 -msgid ":mod:`signal` --- Set handlers for asynchronous events" +msgid ":mod:`!signal` --- Set handlers for asynchronous events" msgstr "" #: library/signal.rst:7 @@ -52,9 +53,9 @@ msgstr "" #: library/signal.rst:29 msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, signals " -"are emulated and therefore behave differently. Several functions and signals " -"are not available on these platforms." +"On WebAssembly platforms, signals are emulated and therefore behave " +"differently. Several functions and signals are not available on these " +"platforms." msgstr "" #: library/signal.rst:34 @@ -150,14 +151,16 @@ msgid "" "`SIG_UNBLOCK` and :const:`SIG_SETMASK`." msgstr "" -#: library/signal.rst:136 library/signal.rst:154 library/signal.rst:180 -#: library/signal.rst:206 library/signal.rst:238 library/signal.rst:351 -#: library/signal.rst:437 library/signal.rst:501 library/signal.rst:561 -#: library/signal.rst:618 library/signal.rst:664 -msgid ":ref:`Availability `: Unix." +#: library/signal.rst:136 library/signal.rst:148 library/signal.rst:160 +#: library/signal.rst:180 library/signal.rst:206 library/signal.rst:218 +#: library/signal.rst:248 library/signal.rst:260 library/signal.rst:272 +#: library/signal.rst:300 library/signal.rst:418 library/signal.rst:465 +#: library/signal.rst:529 library/signal.rst:591 library/signal.rst:648 +#: library/signal.rst:693 +msgid "Availability" msgstr "" -#: library/signal.rst:473 +#: library/signal.rst:501 msgid "" "See the man page :manpage:`sigprocmask(2)` and :manpage:`pthread_sigmask(3)` " "for further information." @@ -193,10 +196,6 @@ msgstr "" msgid "Interrupt from keyboard (CTRL + BREAK)." msgstr "" -#: library/signal.rst:262 library/signal.rst:272 -msgid ":ref:`Availability `: Windows." -msgstr "" - #: library/signal.rst:146 msgid "Bus error (bad memory access)." msgstr "" @@ -209,10 +208,6 @@ msgstr "" msgid "Alias to :data:`SIGCHLD`." msgstr "" -#: library/signal.rst:160 -msgid ":ref:`Availability `: not macOS." -msgstr "" - #: library/signal.rst:164 msgid "Continue the process if it is currently stopped" msgstr "" @@ -261,83 +256,99 @@ msgid "Default action is to ignore the signal." msgstr "" #: library/signal.rst:210 +msgid "Profiling timer expired." +msgstr "" + +#: library/signal.rst:216 +msgid "Terminal quit signal." +msgstr "" + +#: library/signal.rst:222 msgid "Segmentation fault: invalid memory reference." msgstr "" -#: library/signal.rst:214 +#: library/signal.rst:226 +msgid "Stop executing (cannot be caught or ignored)." +msgstr "" + +#: library/signal.rst:230 msgid "" "Stack fault on coprocessor. The Linux kernel does not raise this signal: it " "can only be raised in user space." msgstr "" -#: library/signal.rst:217 -msgid ":ref:`Availability `: Linux." -msgstr "" - -#: library/signal.rst:219 +#: library/signal.rst:235 msgid "" "On architectures where the signal is available. See the man page :manpage:" "`signal(7)` for further information." msgstr "" -#: library/signal.rst:226 +#: library/signal.rst:242 msgid "Termination signal." msgstr "" -#: library/signal.rst:230 +#: library/signal.rst:246 msgid "User-defined signal 1." msgstr "" -#: library/signal.rst:236 +#: library/signal.rst:252 msgid "User-defined signal 2." msgstr "" -#: library/signal.rst:242 +#: library/signal.rst:258 +msgid "Virtual timer expired." +msgstr "" + +#: library/signal.rst:264 msgid "Window resize signal." msgstr "" -#: library/signal.rst:248 +#: library/signal.rst:270 +msgid "CPU time limit exceeded." +msgstr "" + +#: library/signal.rst:276 msgid "" "All the signal numbers are defined symbolically. For example, the hangup " "signal is defined as :const:`signal.SIGHUP`; the variable names are " "identical to the names used in C programs, as found in ````. The " -"Unix man page for ':c:func:`signal`' lists the existing signals (on some " -"systems this is :manpage:`signal(2)`, on others the list is in :manpage:" +"Unix man page for '``signal``' lists the existing signals (on some systems " +"this is :manpage:`signal(2)`, on others the list is in :manpage:" "`signal(7)`). Note that not all systems define the same set of signal names; " "only those names defined by the system are defined by this module." msgstr "" -#: library/signal.rst:259 +#: library/signal.rst:287 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" -#: library/signal.rst:269 +#: library/signal.rst:297 msgid "" "The signal corresponding to the :kbd:`Ctrl+Break` keystroke event. This " "signal can only be used with :func:`os.kill`." msgstr "" -#: library/signal.rst:279 +#: library/signal.rst:307 msgid "" "One more than the number of the highest signal number. Use :func:" "`valid_signals` to get valid signal numbers." msgstr "" -#: library/signal.rst:285 +#: library/signal.rst:313 msgid "" "Decrements interval timer in real time, and delivers :const:`SIGALRM` upon " "expiration." msgstr "" -#: library/signal.rst:291 +#: library/signal.rst:319 msgid "" "Decrements interval timer only when the process is executing, and delivers " "SIGVTALRM upon expiration." msgstr "" -#: library/signal.rst:297 +#: library/signal.rst:325 msgid "" "Decrements interval timer both when the process executes and when the system " "is executing on behalf of the process. Coupled with ITIMER_VIRTUAL, this " @@ -345,29 +356,29 @@ msgid "" "and kernel space. SIGPROF is delivered upon expiration." msgstr "" -#: library/signal.rst:305 +#: library/signal.rst:333 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be blocked." msgstr "" -#: library/signal.rst:312 +#: library/signal.rst:340 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be unblocked." msgstr "" -#: library/signal.rst:319 +#: library/signal.rst:347 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that the signal mask is to be replaced." msgstr "" -#: library/signal.rst:325 +#: library/signal.rst:353 msgid "The :mod:`signal` module defines one exception:" msgstr "" -#: library/signal.rst:329 +#: library/signal.rst:357 msgid "" "Raised to signal an error from the underlying :func:`setitimer` or :func:" "`getitimer` implementation. Expect this error if an invalid interval timer " @@ -375,17 +386,17 @@ msgid "" "of :exc:`OSError`." msgstr "" -#: library/signal.rst:334 +#: library/signal.rst:362 msgid "" "This error used to be a subtype of :exc:`IOError`, which is now an alias of :" "exc:`OSError`." msgstr "" -#: library/signal.rst:339 +#: library/signal.rst:367 msgid "The :mod:`signal` module defines the following functions:" msgstr "" -#: library/signal.rst:344 +#: library/signal.rst:372 msgid "" "If *time* is non-zero, this function requests that a :const:`SIGALRM` signal " "be sent to the process in *time* seconds. Any previously scheduled alarm is " @@ -396,11 +407,11 @@ msgid "" "scheduled." msgstr "" -#: library/signal.rst:353 +#: library/signal.rst:381 msgid "See the man page :manpage:`alarm(2)` for further information." msgstr "" -#: library/signal.rst:358 +#: library/signal.rst:386 msgid "" "Return the current signal handler for the signal *signalnum*. The returned " "value may be a callable Python object, or one of the special values :const:" @@ -411,41 +422,41 @@ msgid "" "not installed from Python." msgstr "" -#: library/signal.rst:369 +#: library/signal.rst:397 msgid "" "Returns the description of signal *signalnum*, such as \"Interrupt\" for :" "const:`SIGINT`. Returns :const:`None` if *signalnum* has no description. " "Raises :exc:`ValueError` if *signalnum* is invalid." msgstr "" -#: library/signal.rst:378 +#: library/signal.rst:406 msgid "" "Return the set of valid signal numbers on this platform. This can be less " "than ``range(1, NSIG)`` if some signals are reserved by the system for " "internal use." msgstr "" -#: library/signal.rst:387 +#: library/signal.rst:415 msgid "" "Cause the process to sleep until a signal is received; the appropriate " "handler will then be called. Returns nothing." msgstr "" -#: library/signal.rst:392 +#: library/signal.rst:420 msgid "See the man page :manpage:`signal(2)` for further information." msgstr "" -#: library/signal.rst:394 +#: library/signal.rst:422 msgid "" "See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" "func:`sigpending`." msgstr "" -#: library/signal.rst:400 +#: library/signal.rst:428 msgid "Sends a signal to the calling process. Returns nothing." msgstr "" -#: library/signal.rst:407 +#: library/signal.rst:435 msgid "" "Send signal *sig* to the process referred to by file descriptor *pidfd*. " "Python does not currently support the *siginfo* parameter; it must be " @@ -453,15 +464,11 @@ msgid "" "values are currently defined." msgstr "" -#: library/signal.rst:412 +#: library/signal.rst:440 msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "" -#: library/signal.rst:414 -msgid ":ref:`Availability `: Linux >= 5.1" -msgstr "" - -#: library/signal.rst:420 +#: library/signal.rst:448 msgid "" "Send the signal *signalnum* to the thread *thread_id*, another thread in the " "same process as the caller. The target thread can be executing any code " @@ -472,86 +479,86 @@ msgid "" "running system call to fail with :exc:`InterruptedError`." msgstr "" -#: library/signal.rst:428 +#: library/signal.rst:456 msgid "" -"Use :func:`threading.get_ident()` or the :attr:`~threading.Thread.ident` " +"Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -#: library/signal.rst:432 +#: library/signal.rst:460 msgid "" "If *signalnum* is 0, then no signal is sent, but error checking is still " "performed; this can be used to check if the target thread is still running." msgstr "" -#: library/signal.rst:435 +#: library/signal.rst:463 msgid "" "Raises an :ref:`auditing event ` ``signal.pthread_kill`` with " "arguments ``thread_id``, ``signalnum``." msgstr "" -#: library/signal.rst:439 +#: library/signal.rst:467 msgid "See the man page :manpage:`pthread_kill(3)` for further information." msgstr "" -#: library/signal.rst:441 +#: library/signal.rst:469 msgid "See also :func:`os.kill`." msgstr "" -#: library/signal.rst:448 +#: library/signal.rst:476 msgid "" "Fetch and/or change the signal mask of the calling thread. The signal mask " "is the set of signals whose delivery is currently blocked for the caller. " "Return the old signal mask as a set of signals." msgstr "" -#: library/signal.rst:452 +#: library/signal.rst:480 msgid "" "The behavior of the call is dependent on the value of *how*, as follows." msgstr "" -#: library/signal.rst:454 +#: library/signal.rst:482 msgid "" ":data:`SIG_BLOCK`: The set of blocked signals is the union of the current " "set and the *mask* argument." msgstr "" -#: library/signal.rst:456 +#: library/signal.rst:484 msgid "" ":data:`SIG_UNBLOCK`: The signals in *mask* are removed from the current set " "of blocked signals. It is permissible to attempt to unblock a signal which " "is not blocked." msgstr "" -#: library/signal.rst:459 +#: library/signal.rst:487 msgid "" ":data:`SIG_SETMASK`: The set of blocked signals is set to the *mask* " "argument." msgstr "" -#: library/signal.rst:462 +#: library/signal.rst:490 msgid "" "*mask* is a set of signal numbers (e.g. {:const:`signal.SIGINT`, :const:" "`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " "including all signals." msgstr "" -#: library/signal.rst:466 +#: library/signal.rst:494 msgid "" "For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the " "signal mask of the calling thread." msgstr "" -#: library/signal.rst:469 +#: library/signal.rst:497 msgid ":data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked." msgstr "" -#: library/signal.rst:476 +#: library/signal.rst:504 msgid "See also :func:`pause`, :func:`sigpending` and :func:`sigwait`." msgstr "" -#: library/signal.rst:483 +#: library/signal.rst:511 msgid "" "Sets given interval timer (one of :const:`signal.ITIMER_REAL`, :const:" "`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified by *which* " @@ -561,7 +568,7 @@ msgid "" "zero." msgstr "" -#: library/signal.rst:490 +#: library/signal.rst:518 msgid "" "When an interval timer fires, a signal is sent to the process. The signal " "sent is dependent on the timer being used; :const:`signal.ITIMER_REAL` will " @@ -569,29 +576,31 @@ msgid "" "`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." msgstr "" -#: library/signal.rst:496 +#: library/signal.rst:524 msgid "The old values are returned as a tuple: (delay, interval)." msgstr "" -#: library/signal.rst:498 +#: library/signal.rst:526 msgid "" "Attempting to pass an invalid interval timer will cause an :exc:" "`ItimerError`." msgstr "" -#: library/signal.rst:506 +#: library/signal.rst:534 msgid "Returns current value of a given interval timer specified by *which*." msgstr "" -#: library/signal.rst:513 +#: library/signal.rst:541 msgid "" -"Set the wakeup file descriptor to *fd*. When a signal is received, the " -"signal number is written as a single byte into the fd. This can be used by " -"a library to wakeup a poll or select call, allowing the signal to be fully " -"processed." +"Set the wakeup file descriptor to *fd*. When a signal your program has " +"registered a signal handler for is received, the signal number is written as " +"a single byte into the fd. If you haven't registered a signal handler for " +"the signals you care about, then nothing will be written to the wakeup fd. " +"This can be used by a library to wakeup a poll or select call, allowing the " +"signal to be fully processed." msgstr "" -#: library/signal.rst:518 +#: library/signal.rst:548 msgid "" "The old wakeup fd is returned (or -1 if file descriptor wakeup was not " "enabled). If *fd* is -1, file descriptor wakeup is disabled. If not -1, " @@ -599,7 +608,7 @@ msgid "" "*fd* before calling poll or select again." msgstr "" -#: library/signal.rst:578 +#: library/signal.rst:608 msgid "" "When threads are enabled, this function can only be called from :ref:`the " "main thread of the main interpreter `; attempting to " @@ -607,14 +616,14 @@ msgid "" "raised." msgstr "" -#: library/signal.rst:528 +#: library/signal.rst:558 msgid "" "There are two common ways to use this function. In both approaches, you use " "the fd to wake up when a signal arrives, but then they differ in how they " "determine *which* signal or signals have arrived." msgstr "" -#: library/signal.rst:533 +#: library/signal.rst:563 msgid "" "In the first approach, we read the data out of the fd's buffer, and the byte " "values give you the signal numbers. This is simple, but in rare cases it can " @@ -625,7 +634,7 @@ msgid "" "warning to be printed to stderr when signals are lost." msgstr "" -#: library/signal.rst:542 +#: library/signal.rst:572 msgid "" "In the second approach, we use the wakeup fd *only* for wakeups, and ignore " "the actual byte values. In this case, all we care about is whether the fd's " @@ -635,33 +644,33 @@ msgid "" "spurious warning messages." msgstr "" -#: library/signal.rst:549 +#: library/signal.rst:579 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: library/signal.rst:552 +#: library/signal.rst:582 msgid "Added ``warn_on_full_buffer`` parameter." msgstr "" -#: library/signal.rst:557 +#: library/signal.rst:587 msgid "" "Change system call restart behaviour: if *flag* is :const:`False`, system " "calls will be restarted when interrupted by signal *signalnum*, otherwise " "system calls will be interrupted. Returns nothing." msgstr "" -#: library/signal.rst:563 +#: library/signal.rst:593 msgid "See the man page :manpage:`siginterrupt(3)` for further information." msgstr "" -#: library/signal.rst:565 +#: library/signal.rst:595 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:`!" "siginterrupt` with a true *flag* value for the given signal." msgstr "" -#: library/signal.rst:572 +#: library/signal.rst:602 msgid "" "Set the handler for signal *signalnum* to the function *handler*. *handler* " "can be a callable Python object taking two arguments (see below), or one of " @@ -671,7 +680,7 @@ msgid "" "information.)" msgstr "" -#: library/signal.rst:583 +#: library/signal.rst:613 msgid "" "The *handler* is called with two arguments: the signal number and the " "current stack frame (``None`` or a frame object; for a description of frame " @@ -679,7 +688,7 @@ msgid "" "see the attribute descriptions in the :mod:`inspect` module)." msgstr "" -#: library/signal.rst:588 +#: library/signal.rst:618 msgid "" "On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" "`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" @@ -689,22 +698,22 @@ msgid "" "``SIG*`` module level constant." msgstr "" -#: library/signal.rst:599 +#: library/signal.rst:629 msgid "" "Examine the set of signals that are pending for delivery to the calling " "thread (i.e., the signals which have been raised while blocked). Return the " "set of the pending signals." msgstr "" -#: library/signal.rst:605 +#: library/signal.rst:635 msgid "See the man page :manpage:`sigpending(2)` for further information." msgstr "" -#: library/signal.rst:607 +#: library/signal.rst:637 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." msgstr "" -#: library/signal.rst:614 +#: library/signal.rst:644 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -712,17 +721,17 @@ msgid "" "number." msgstr "" -#: library/signal.rst:620 +#: library/signal.rst:650 msgid "See the man page :manpage:`sigwait(3)` for further information." msgstr "" -#: library/signal.rst:622 +#: library/signal.rst:652 msgid "" "See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" "`sigwaitinfo` and :func:`sigtimedwait`." msgstr "" -#: library/signal.rst:630 +#: library/signal.rst:660 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -733,56 +742,55 @@ msgid "" "`InterruptedError` if it is interrupted by a signal that is not in *sigset*." msgstr "" -#: library/signal.rst:639 +#: library/signal.rst:669 msgid "" -"The return value is an object representing the data contained in the :c:type:" -"`siginfo_t` structure, namely: :attr:`si_signo`, :attr:`si_code`, :attr:" -"`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:" -"`si_band`." +"The return value is an object representing the data contained in the " +"``siginfo_t`` structure, namely: ``si_signo``, ``si_code``, ``si_errno``, " +"``si_pid``, ``si_uid``, ``si_status``, ``si_band``." msgstr "" -#: library/signal.rst:646 +#: library/signal.rst:675 msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." msgstr "" -#: library/signal.rst:648 +#: library/signal.rst:677 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." msgstr "" -#: library/signal.rst:652 +#: library/signal.rst:681 msgid "" "The function is now retried if interrupted by a signal not in *sigset* and " "the signal handler does not raise an exception (see :pep:`475` for the " "rationale)." msgstr "" -#: library/signal.rst:660 +#: library/signal.rst:689 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as ``0``, a poll is " "performed. Returns :const:`None` if a timeout occurs." msgstr "" -#: library/signal.rst:666 +#: library/signal.rst:695 msgid "See the man page :manpage:`sigtimedwait(2)` for further information." msgstr "" -#: library/signal.rst:668 +#: library/signal.rst:697 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr "" -#: library/signal.rst:672 +#: library/signal.rst:701 msgid "" "The function is now retried with the recomputed *timeout* if interrupted by " "a signal not in *sigset* and the signal handler does not raise an exception " "(see :pep:`475` for the rationale)." msgstr "" -#: library/signal.rst:681 +#: library/signal.rst:710 msgid "Examples" msgstr "" -#: library/signal.rst:683 +#: library/signal.rst:712 msgid "" "Here is a minimal example program. It uses the :func:`alarm` function to " "limit the time spent waiting to open a file; this is useful if the file is " @@ -792,11 +800,30 @@ msgid "" "signal will be sent, and the handler raises an exception. ::" msgstr "" -#: library/signal.rst:707 +#: library/signal.rst:719 +msgid "" +"import signal, os\n" +"\n" +"def handler(signum, frame):\n" +" signame = signal.Signals(signum).name\n" +" print(f'Signal handler called with signal {signame} ({signum})')\n" +" raise OSError(\"Couldn't open device!\")\n" +"\n" +"# Set the signal handler and a 5-second alarm\n" +"signal.signal(signal.SIGALRM, handler)\n" +"signal.alarm(5)\n" +"\n" +"# This open() may hang indefinitely\n" +"fd = os.open('/dev/ttyS0', os.O_RDWR)\n" +"\n" +"signal.alarm(0) # Disable the alarm" +msgstr "" + +#: library/signal.rst:736 msgid "Note on SIGPIPE" msgstr "" -#: library/signal.rst:709 +#: library/signal.rst:738 msgid "" "Piping output of your program to tools like :manpage:`head(1)` will cause a :" "const:`SIGPIPE` signal to be sent to your process when the receiver of its " @@ -805,7 +832,32 @@ msgid "" "entry point to catch this exception as follows::" msgstr "" -#: library/signal.rst:736 +#: library/signal.rst:744 +msgid "" +"import os\n" +"import sys\n" +"\n" +"def main():\n" +" try:\n" +" # simulate large output (your code replaces this loop)\n" +" for x in range(10000):\n" +" print(\"y\")\n" +" # flush output here to force SIGPIPE to be triggered\n" +" # while inside this try block.\n" +" sys.stdout.flush()\n" +" except BrokenPipeError:\n" +" # Python flushes standard streams on exit; redirect remaining " +"output\n" +" # to devnull to avoid another BrokenPipeError at shutdown\n" +" devnull = os.open(os.devnull, os.O_WRONLY)\n" +" os.dup2(devnull, sys.stdout.fileno())\n" +" sys.exit(1) # Python exits with error code 1 on EPIPE\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" + +#: library/signal.rst:765 msgid "" "Do not set :const:`SIGPIPE`'s disposition to :const:`SIG_DFL` in order to " "avoid :exc:`BrokenPipeError`. Doing that would cause your program to exit " @@ -813,11 +865,11 @@ msgid "" "program is still writing to it." msgstr "" -#: library/signal.rst:745 +#: library/signal.rst:774 msgid "Note on Signal Handlers and Exceptions" msgstr "" -#: library/signal.rst:747 +#: library/signal.rst:776 msgid "" "If a signal handler raises an exception, the exception will be propagated to " "the main thread and may be raised after any :term:`bytecode` instruction. " @@ -828,11 +880,29 @@ msgid "" "program in an unexpected state." msgstr "" -#: library/signal.rst:754 +#: library/signal.rst:783 msgid "To illustrate this issue, consider the following code::" msgstr "" -#: library/signal.rst:771 +#: library/signal.rst:785 +msgid "" +"class SpamContext:\n" +" def __init__(self):\n" +" self.lock = threading.Lock()\n" +"\n" +" def __enter__(self):\n" +" # If KeyboardInterrupt occurs here, everything is fine\n" +" self.lock.acquire()\n" +" # If KeyboardInterrupt occurs here, __exit__ will not be called\n" +" ...\n" +" # KeyboardInterrupt could occur just before the function returns\n" +"\n" +" def __exit__(self, exc_type, exc_val, exc_tb):\n" +" ...\n" +" self.lock.release()" +msgstr "" + +#: library/signal.rst:800 msgid "" "For many programs, especially those that merely want to exit on :exc:" "`KeyboardInterrupt`, this is not a problem, but applications that are " @@ -842,3 +912,36 @@ msgid "" "own :const:`SIGINT` handler. Below is an example of an HTTP server that " "avoids :exc:`KeyboardInterrupt`::" msgstr "" + +#: library/signal.rst:808 +msgid "" +"import signal\n" +"import socket\n" +"from selectors import DefaultSelector, EVENT_READ\n" +"from http.server import HTTPServer, SimpleHTTPRequestHandler\n" +"\n" +"interrupt_read, interrupt_write = socket.socketpair()\n" +"\n" +"def handler(signum, frame):\n" +" print('Signal handler called with signal', signum)\n" +" interrupt_write.send(b'\\0')\n" +"signal.signal(signal.SIGINT, handler)\n" +"\n" +"def serve_forever(httpd):\n" +" sel = DefaultSelector()\n" +" sel.register(interrupt_read, EVENT_READ)\n" +" sel.register(httpd, EVENT_READ)\n" +"\n" +" while True:\n" +" for key, _ in sel.select():\n" +" if key.fileobj == interrupt_read:\n" +" interrupt_read.recv(1)\n" +" return\n" +" if key.fileobj == httpd:\n" +" httpd.handle_request()\n" +"\n" +"print(\"Serving on port 8000\")\n" +"httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler)\n" +"serve_forever(httpd)\n" +"print(\"Shutdown...\")" +msgstr "" diff --git a/library/site.po b/library/site.po index 733cbb44..c992ba51 100644 --- a/library/site.po +++ b/library/site.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/site.rst:2 -msgid ":mod:`site` --- Site-specific configuration hook" +msgid ":mod:`!site` --- Site-specific configuration hook" msgstr "" #: library/site.rst:7 @@ -33,48 +34,66 @@ msgstr "" #: library/site.rst:18 msgid "" -"Importing this module will append site-specific paths to the module search " -"path and add a few builtins, unless :option:`-S` was used. In that case, " -"this module can be safely imported with no automatic modifications to the " -"module search path or additions to the builtins. To explicitly trigger the " -"usual site-specific additions, call the :func:`main` function." +"Importing this module normally appends site-specific paths to the module " +"search path and adds :ref:`callables `, including :func:`help` " +"to the built-in namespace. However, Python startup option :option:`-S` " +"blocks this and this module can be safely imported with no automatic " +"modifications to the module search path or additions to the builtins. To " +"explicitly trigger the usual site-specific additions, call the :func:`main` " +"function." msgstr "" -#: library/site.rst:24 +#: library/site.rst:25 msgid "" "Importing the module used to trigger paths manipulation even when using :" "option:`-S`." msgstr "" -#: library/site.rst:31 +#: library/site.rst:32 msgid "" "It starts by constructing up to four directories from a head and a tail " "part. For the head part, it uses ``sys.prefix`` and ``sys.exec_prefix``; " "empty heads are skipped. For the tail part, it uses the empty string and " -"then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y}/site-" -"packages` (on Unix and macOS). For each of the distinct head-tail " +"then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y[t]}/" +"site-packages` (on Unix and macOS). (The optional suffix \"t\" indicates " +"the :term:`free threading` build, and is appended if ``\"t\"`` is present in " +"the :data:`sys.abiflags` constant.) For each of the distinct head-tail " "combinations, it sees if it refers to an existing directory, and if so, adds " "it to ``sys.path`` and also inspects the newly added path for configuration " "files." msgstr "" -#: library/site.rst:40 +#: library/site.rst:44 msgid "Support for the \"site-python\" directory has been removed." msgstr "" -#: library/site.rst:43 +#: library/site.rst:47 msgid "" -"If a file named \"pyvenv.cfg\" exists one directory above sys.executable, " -"sys.prefix and sys.exec_prefix are set to that directory and it is also " -"checked for site-packages (sys.base_prefix and sys.base_exec_prefix will " -"always be the \"real\" prefixes of the Python installation). If \"pyvenv." -"cfg\" (a bootstrap configuration file) contains the key \"include-system-" -"site-packages\" set to anything other than \"true\" (case-insensitive), the " -"system-level prefixes will not be searched for site-packages; otherwise they " -"will." +"On Unix, :term:`Free threading ` Python installations are " +"identified by the \"t\" suffix in the version-specific directory name, such " +"as :file:`lib/python3.13t/`." msgstr "" -#: library/site.rst:56 +#: library/site.rst:54 +msgid "" +":mod:`site` is no longer responsible for updating :data:`sys.prefix` and :" +"data:`sys.exec_prefix` on :ref:`sys-path-init-virtual-environments`. This is " +"now done during the :ref:`path initialization `. As a result, " +"under :ref:`sys-path-init-virtual-environments`, :data:`sys.prefix` and :" +"data:`sys.exec_prefix` no longer depend on the :mod:`site` initialization, " +"and are therefore unaffected by :option:`-S`." +msgstr "" + +#: library/site.rst:63 +msgid "" +"When running under a :ref:`virtual environment `, the ``pyvenv.cfg`` file in :data:`sys.prefix` is checked for " +"site-specific configurations. If the ``include-system-site-packages`` key " +"exists and is set to ``true`` (case-insensitive), the system-level prefixes " +"will be searched for site-packages, otherwise they won't." +msgstr "" + +#: library/site.rst:73 msgid "" "A path configuration file is a file whose name has the form :file:`{name}." "pth` and exists in one of the four directories mentioned above; its contents " @@ -86,7 +105,7 @@ msgid "" "executed." msgstr "" -#: library/site.rst:66 +#: library/site.rst:83 msgid "" "An executable line in a :file:`.pth` file is run at every Python startup, " "regardless of whether a particular module is actually going to be used. Its " @@ -98,7 +117,13 @@ msgid "" "putting anything more complex here." msgstr "" -#: library/site.rst:81 +#: library/site.rst:94 +msgid "" +"The :file:`.pth` files are now decoded by UTF-8 at first and then by the :" +"term:`locale encoding` if it fails." +msgstr "" + +#: library/site.rst:102 msgid "" "For example, suppose ``sys.prefix`` and ``sys.exec_prefix`` are set to :file:" "`/usr/local`. The Python X.Y library is then installed in :file:`/usr/local/" @@ -108,17 +133,39 @@ msgid "" "and :file:`bar.pth`. Assume :file:`foo.pth` contains the following::" msgstr "" -#: library/site.rst:95 +#: library/site.rst:110 +msgid "" +"# foo package configuration\n" +"\n" +"foo\n" +"bar\n" +"bletch" +msgstr "" + +#: library/site.rst:116 msgid "and :file:`bar.pth` contains::" msgstr "" -#: library/site.rst:101 +#: library/site.rst:118 +msgid "" +"# bar package configuration\n" +"\n" +"bar" +msgstr "" + +#: library/site.rst:122 msgid "" "Then the following version-specific directories are added to ``sys.path``, " "in this order::" msgstr "" -#: library/site.rst:107 +#: library/site.rst:125 +msgid "" +"/usr/local/lib/pythonX.Y/site-packages/bar\n" +"/usr/local/lib/pythonX.Y/site-packages/foo" +msgstr "" + +#: library/site.rst:128 msgid "" "Note that :file:`bletch` is omitted because it doesn't exist; the :file:" "`bar` directory precedes the :file:`foo` directory because :file:`bar.pth` " @@ -126,11 +173,11 @@ msgid "" "because it is not mentioned in either path configuration file." msgstr "" -#: library/site.rst:113 +#: library/site.rst:134 msgid ":mod:`sitecustomize`" msgstr "" -#: library/site.rst:117 +#: library/site.rst:138 msgid "" "After these path manipulations, an attempt is made to import a module named :" "mod:`sitecustomize`, which can perform arbitrary site-specific " @@ -144,11 +191,11 @@ msgid "" "mysterious failure of the process." msgstr "" -#: library/site.rst:129 +#: library/site.rst:150 msgid ":mod:`usercustomize`" msgstr "" -#: library/site.rst:133 +#: library/site.rst:154 msgid "" "After this, an attempt is made to import a module named :mod:" "`usercustomize`, which can perform arbitrary user-specific customizations, " @@ -160,18 +207,18 @@ msgid "" "ignored." msgstr "" -#: library/site.rst:141 +#: library/site.rst:162 msgid "" "Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` " "are empty, and the path manipulations are skipped; however the import of :" "mod:`sitecustomize` and :mod:`usercustomize` is still attempted." msgstr "" -#: library/site.rst:150 +#: library/site.rst:171 msgid "Readline configuration" msgstr "" -#: library/site.rst:152 +#: library/site.rst:173 msgid "" "On systems that support :mod:`readline`, this module will also import and " "configure the :mod:`rlcompleter` module, if Python is started in :ref:" @@ -183,19 +230,19 @@ msgid "" "`PYTHONSTARTUP` file." msgstr "" -#: library/site.rst:161 +#: library/site.rst:182 msgid "Activation of rlcompleter and history was made automatic." msgstr "" -#: library/site.rst:166 +#: library/site.rst:187 msgid "Module contents" msgstr "" -#: library/site.rst:170 +#: library/site.rst:191 msgid "A list of prefixes for site-packages directories." msgstr "" -#: library/site.rst:175 +#: library/site.rst:196 msgid "" "Flag showing the status of the user site-packages directory. ``True`` means " "that it is enabled and was added to ``sys.path``. ``False`` means that it " @@ -204,18 +251,19 @@ msgid "" "(mismatch between user or group id and effective id) or by an administrator." msgstr "" -#: library/site.rst:185 +#: library/site.rst:206 msgid "" "Path to the user site-packages for the running Python. Can be ``None`` if :" "func:`getusersitepackages` hasn't been called yet. Default value is :file:" -"`~/.local/lib/python{X.Y}/site-packages` for UNIX and non-framework macOS " +"`~/.local/lib/python{X.Y}[t]/site-packages` for UNIX and non-framework macOS " "builds, :file:`~/Library/Python/{X.Y}/lib/python/site-packages` for macOS " "framework builds, and :file:`{%APPDATA%}\\\\Python\\\\Python{XY}\\\\site-" -"packages` on Windows. This directory is a site directory, which means that :" -"file:`.pth` files in it will be processed." +"packages` on Windows. The optional \"t\" indicates the free-threaded " +"build. This directory is a site directory, which means that :file:`.pth` " +"files in it will be processed." msgstr "" -#: library/site.rst:196 +#: library/site.rst:218 msgid "" "Path to the base directory for the user site-packages. Can be ``None`` if :" "func:`getuserbase` hasn't been called yet. Default value is :file:`~/." @@ -226,35 +274,35 @@ msgid "" "scheme `. See also :envvar:`PYTHONUSERBASE`." msgstr "" -#: library/site.rst:208 +#: library/site.rst:230 msgid "" "Adds all the standard site-specific directories to the module search path. " "This function is called automatically when this module is imported, unless " "the Python interpreter was started with the :option:`-S` flag." msgstr "" -#: library/site.rst:212 +#: library/site.rst:234 msgid "This function used to be called unconditionally." msgstr "" -#: library/site.rst:218 +#: library/site.rst:240 msgid "" "Add a directory to sys.path and process its :file:`.pth` files. Typically " "used in :mod:`sitecustomize` or :mod:`usercustomize` (see above)." msgstr "" -#: library/site.rst:224 +#: library/site.rst:246 msgid "Return a list containing all global site-packages directories." msgstr "" -#: library/site.rst:231 +#: library/site.rst:253 msgid "" "Return the path of the user base directory, :data:`USER_BASE`. If it is not " "initialized yet, this function will also set it, respecting :envvar:" "`PYTHONUSERBASE`." msgstr "" -#: library/site.rst:240 +#: library/site.rst:262 msgid "" "Return the path of the user-specific site-packages directory, :data:" "`USER_SITE`. If it is not initialized yet, this function will also set it, " @@ -262,17 +310,23 @@ msgid "" "packages was added to ``sys.path`` :data:`ENABLE_USER_SITE` should be used." msgstr "" -#: library/site.rst:252 -msgid "Command Line Interface" +#: library/site.rst:274 +msgid "Command-line interface" msgstr "" -#: library/site.rst:256 +#: library/site.rst:278 msgid "" "The :mod:`site` module also provides a way to get the user directories from " "the command line:" msgstr "" -#: library/site.rst:264 +#: library/site.rst:281 +msgid "" +"$ python -m site --user-site\n" +"/home/user/.local/lib/python3.11/site-packages" +msgstr "" + +#: library/site.rst:286 msgid "" "If it is called without arguments, it will print the contents of :data:`sys." "path` on the standard output, followed by the value of :data:`USER_BASE` and " @@ -280,21 +334,21 @@ msgid "" "finally the value of :data:`ENABLE_USER_SITE`." msgstr "" -#: library/site.rst:271 +#: library/site.rst:293 msgid "Print the path to the user base directory." msgstr "" -#: library/site.rst:275 +#: library/site.rst:297 msgid "Print the path to the user site-packages directory." msgstr "" -#: library/site.rst:277 +#: library/site.rst:299 msgid "" "If both options are given, user base and user site will be printed (always " "in this order), separated by :data:`os.pathsep`." msgstr "" -#: library/site.rst:280 +#: library/site.rst:302 msgid "" "If any option is given, the script will exit with one of these values: ``0`` " "if the user site-packages directory is enabled, ``1`` if it was disabled by " @@ -302,11 +356,11 @@ msgid "" "administrator, and a value greater than 2 if there is an error." msgstr "" -#: library/site.rst:287 +#: library/site.rst:309 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: library/site.rst:288 +#: library/site.rst:310 msgid ":ref:`sys-path-init` -- The initialization of :data:`sys.path`." msgstr "" @@ -318,42 +372,42 @@ msgstr "" msgid "search" msgstr "" -#: library/site.rst:77 +#: library/site.rst:98 msgid "path" msgstr "" -#: library/site.rst:28 +#: library/site.rst:29 msgid "site-packages" msgstr "" -#: library/site.rst:28 +#: library/site.rst:29 msgid "directory" msgstr "" -#: library/site.rst:52 +#: library/site.rst:69 msgid "# (hash)" msgstr "" -#: library/site.rst:52 +#: library/site.rst:69 msgid "comment" msgstr "" -#: library/site.rst:52 +#: library/site.rst:69 msgid "statement" msgstr "" -#: library/site.rst:52 +#: library/site.rst:69 msgid "import" msgstr "" -#: library/site.rst:77 +#: library/site.rst:98 msgid "package" msgstr "" -#: library/site.rst:77 +#: library/site.rst:98 msgid "configuration" msgstr "" -#: library/site.rst:77 +#: library/site.rst:98 msgid "file" msgstr "" diff --git a/library/smtpd.po b/library/smtpd.po new file mode 100644 index 00000000..0d7abca3 --- /dev/null +++ b/library/smtpd.po @@ -0,0 +1,41 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/smtpd.rst:2 +msgid ":mod:`!smtpd` --- SMTP Server" +msgstr "" + +#: library/smtpd.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being deprecated in " +"Python 3.6. The removal was decided in :pep:`594`." +msgstr "" + +#: library/smtpd.rst:14 +msgid "" +"A possible replacement is the third-party :pypi:`aiosmtpd` library. This " +"library is not maintained or supported by the Python core team." +msgstr "" + +#: library/smtpd.rst:17 +msgid "" +"The last version of Python that provided the :mod:`!smtpd` module was " +"`Python 3.11 `_." +msgstr "" diff --git a/library/smtplib.po b/library/smtplib.po index a263d8bd..41a44c12 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/smtplib.rst:2 -msgid ":mod:`smtplib` --- SMTP protocol client" +msgid ":mod:`!smtplib` --- SMTP protocol client" msgstr "" #: library/smtplib.rst:9 @@ -33,14 +34,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/smtplib.rst:26 @@ -76,10 +76,14 @@ msgid "" "keyword:`!with` statement exits. E.g.::" msgstr "" -#: library/smtplib.rst:70 +#: library/smtplib.rst:52 msgid "" -"Raises an :ref:`auditing event ` ``smtplib.send`` with arguments " -"``self``, ``data``." +">>> from smtplib import SMTP\n" +">>> with SMTP(\"domain.org\") as smtp:\n" +"... smtp.noop()\n" +"...\n" +"(250, b'Ok')\n" +">>>" msgstr "" #: library/smtplib.rst:61 @@ -111,17 +115,17 @@ msgstr "" msgid "" "An :class:`SMTP_SSL` instance behaves exactly the same as instances of :" "class:`SMTP`. :class:`SMTP_SSL` should be used for situations where SSL is " -"required from the beginning of the connection and using :meth:`starttls` is " -"not appropriate. If *host* is not specified, the local host is used. If " -"*port* is zero, the standard SMTP-over-SSL port (465) is used. The optional " -"arguments *local_hostname*, *timeout* and *source_address* have the same " -"meaning as they do in the :class:`SMTP` class. *context*, also optional, " -"can contain a :class:`~ssl.SSLContext` and allows configuring various " -"aspects of the secure connection. Please read :ref:`ssl-security` for best " -"practices." +"required from the beginning of the connection and using :meth:`~SMTP." +"starttls` is not appropriate. If *host* is not specified, the local host is " +"used. If *port* is zero, the standard SMTP-over-SSL port (465) is used. The " +"optional arguments *local_hostname*, *timeout* and *source_address* have the " +"same meaning as they do in the :class:`SMTP` class. *context*, also " +"optional, can contain a :class:`~ssl.SSLContext` and allows configuring " +"various aspects of the secure connection. Please read :ref:`ssl-security` " +"for best practices." msgstr "" -#: library/smtplib.rst:415 +#: library/smtplib.rst:424 msgid "*context* was added." msgstr "" @@ -141,7 +145,7 @@ msgid "" "`ValueError` to prevent the creation of a non-blocking socket" msgstr "" -#: library/smtplib.rst:403 +#: library/smtplib.rst:412 msgid "The deprecated *keyfile* and *certfile* parameters have been removed." msgstr "" @@ -149,10 +153,10 @@ msgstr "" msgid "" "The LMTP protocol, which is very similar to ESMTP, is heavily based on the " "standard SMTP client. It's common to use Unix sockets for LMTP, so our :meth:" -"`connect` method must support that as well as a regular host:port server. " -"The optional arguments *local_hostname* and *source_address* have the same " -"meaning as they do in the :class:`SMTP` class. To specify a Unix socket, you " -"must use an absolute path for *host*, starting with a '/'." +"`~SMTP.connect` method must support that as well as a regular host:port " +"server. The optional arguments *local_hostname* and *source_address* have " +"the same meaning as they do in the :class:`SMTP` class. To specify a Unix " +"socket, you must use an absolute path for *host*, starting with a '/'." msgstr "" #: library/smtplib.rst:120 @@ -191,76 +195,86 @@ msgstr "" msgid "" "Base class for all exceptions that include an SMTP error code. These " "exceptions are generated in some instances when the SMTP server returns an " -"error code. The error code is stored in the :attr:`smtp_code` attribute of " -"the error, and the :attr:`smtp_error` attribute is set to the error message." +"error code." msgstr "" -#: library/smtplib.rst:157 +#: library/smtplib.rst:154 +msgid "The error code." +msgstr "" + +#: library/smtplib.rst:158 +msgid "The error message." +msgstr "" + +#: library/smtplib.rst:163 msgid "" "Sender address refused. In addition to the attributes set by on all :exc:" "`SMTPResponseException` exceptions, this sets 'sender' to the string that " "the SMTP server refused." msgstr "" -#: library/smtplib.rst:164 +#: library/smtplib.rst:170 +msgid "All recipient addresses refused." +msgstr "" + +#: library/smtplib.rst:174 msgid "" -"All recipient addresses refused. The errors for each recipient are " -"accessible through the attribute :attr:`recipients`, which is a dictionary " -"of exactly the same sort as :meth:`SMTP.sendmail` returns." +"A dictionary of exactly the same sort as returned by :meth:`SMTP.sendmail` " +"containing the errors for each recipient." msgstr "" -#: library/smtplib.rst:171 +#: library/smtplib.rst:181 msgid "The SMTP server refused to accept the message data." msgstr "" -#: library/smtplib.rst:176 +#: library/smtplib.rst:186 msgid "Error occurred during establishment of a connection with the server." msgstr "" -#: library/smtplib.rst:181 +#: library/smtplib.rst:191 msgid "The server refused our ``HELO`` message." msgstr "" -#: library/smtplib.rst:186 +#: library/smtplib.rst:196 msgid "The command or option attempted is not supported by the server." msgstr "" -#: library/smtplib.rst:193 +#: library/smtplib.rst:203 msgid "" "SMTP authentication went wrong. Most probably the server didn't accept the " "username/password combination provided." msgstr "" -#: library/smtplib.rst:201 +#: library/smtplib.rst:209 msgid ":rfc:`821` - Simple Mail Transfer Protocol" msgstr "" -#: library/smtplib.rst:200 +#: library/smtplib.rst:210 msgid "" "Protocol definition for SMTP. This document covers the model, operating " "procedure, and protocol details for SMTP." msgstr "" -#: library/smtplib.rst:205 +#: library/smtplib.rst:213 msgid ":rfc:`1869` - SMTP Service Extensions" msgstr "" -#: library/smtplib.rst:204 +#: library/smtplib.rst:214 msgid "" "Definition of the ESMTP extensions for SMTP. This describes a framework for " "extending SMTP with new commands, supporting dynamic discovery of the " "commands provided by the server, and defines a few additional commands." msgstr "" -#: library/smtplib.rst:212 +#: library/smtplib.rst:222 msgid "SMTP Objects" msgstr "" -#: library/smtplib.rst:214 +#: library/smtplib.rst:224 msgid "An :class:`SMTP` instance has the following methods:" msgstr "" -#: library/smtplib.rst:219 +#: library/smtplib.rst:228 msgid "" "Set the debug output level. A value of 1 or ``True`` for *level* results in " "debug messages for connection and for all messages sent to and received from " @@ -268,36 +282,36 @@ msgid "" "timestamped." msgstr "" -#: library/smtplib.rst:224 +#: library/smtplib.rst:233 msgid "Added debuglevel 2." msgstr "" -#: library/smtplib.rst:229 +#: library/smtplib.rst:238 msgid "" "Send a command *cmd* to the server. The optional argument *args* is simply " "concatenated to the command, separated by a space." msgstr "" -#: library/smtplib.rst:232 +#: library/smtplib.rst:241 msgid "" "This returns a 2-tuple composed of a numeric response code and the actual " "response line (multiline responses are joined into one long line.)" msgstr "" -#: library/smtplib.rst:235 +#: library/smtplib.rst:244 msgid "" "In normal operation it should not be necessary to call this method " "explicitly. It is used to implement other methods and may be useful for " "testing private extensions." msgstr "" -#: library/smtplib.rst:239 +#: library/smtplib.rst:248 msgid "" "If the connection to the server is lost while waiting for the reply, :exc:" "`SMTPServerDisconnected` will be raised." msgstr "" -#: library/smtplib.rst:245 +#: library/smtplib.rst:254 msgid "" "Connect to a host on a given port. The defaults are to connect to the local " "host at the standard SMTP port (25). If the hostname ends with a colon " @@ -308,13 +322,13 @@ msgid "" "connection response." msgstr "" -#: library/smtplib.rst:264 +#: library/smtplib.rst:262 msgid "" "Raises an :ref:`auditing event ` ``smtplib.connect`` with " "arguments ``self``, ``host``, ``port``." msgstr "" -#: library/smtplib.rst:258 +#: library/smtplib.rst:267 msgid "" "Identify yourself to the SMTP server using ``HELO``. The hostname argument " "defaults to the fully qualified domain name of the local host. The message " @@ -322,14 +336,14 @@ msgid "" "object." msgstr "" -#: library/smtplib.rst:263 +#: library/smtplib.rst:272 msgid "" "In normal operation it should not be necessary to call this method " "explicitly. It will be implicitly called by the :meth:`sendmail` when " "necessary." msgstr "" -#: library/smtplib.rst:269 +#: library/smtplib.rst:278 msgid "" "Identify yourself to an ESMTP server using ``EHLO``. The hostname argument " "defaults to the fully qualified domain name of the local host. Examine the " @@ -341,35 +355,35 @@ msgid "" "service extensions this server supports, and their parameters (if any)." msgstr "" -#: library/smtplib.rst:279 +#: library/smtplib.rst:288 msgid "" "Unless you wish to use :meth:`has_extn` before sending mail, it should not " "be necessary to call this method explicitly. It will be implicitly called " "by :meth:`sendmail` when necessary." msgstr "" -#: library/smtplib.rst:285 +#: library/smtplib.rst:294 msgid "" "This method calls :meth:`ehlo` and/or :meth:`helo` if there has been no " "previous ``EHLO`` or ``HELO`` command this session. It tries ESMTP ``EHLO`` " "first." msgstr "" -#: library/smtplib.rst:319 library/smtplib.rst:476 +#: library/smtplib.rst:327 library/smtplib.rst:481 msgid ":exc:`SMTPHeloError`" msgstr "" -#: library/smtplib.rst:319 library/smtplib.rst:476 +#: library/smtplib.rst:328 library/smtplib.rst:482 msgid "The server didn't reply properly to the ``HELO`` greeting." msgstr "" -#: library/smtplib.rst:294 +#: library/smtplib.rst:303 msgid "" "Return :const:`True` if *name* is in the set of SMTP service extensions " "returned by the server, :const:`False` otherwise. Case is ignored." msgstr "" -#: library/smtplib.rst:300 +#: library/smtplib.rst:309 msgid "" "Check the validity of an address on this server using SMTP ``VRFY``. Returns " "a tuple consisting of code 250 and a full :rfc:`822` address (including " @@ -377,11 +391,11 @@ msgid "" "code of 400 or greater and an error string." msgstr "" -#: library/smtplib.rst:307 +#: library/smtplib.rst:316 msgid "Many sites disable SMTP ``VRFY`` in order to foil spammers." msgstr "" -#: library/smtplib.rst:312 +#: library/smtplib.rst:321 msgid "" "Log in on an SMTP server that requires authentication. The arguments are the " "username and the password to authenticate with. If there has been no " @@ -390,31 +404,31 @@ msgid "" "successful, or may raise the following exceptions:" msgstr "" -#: library/smtplib.rst:322 +#: library/smtplib.rst:330 msgid ":exc:`SMTPAuthenticationError`" msgstr "" -#: library/smtplib.rst:322 +#: library/smtplib.rst:331 msgid "The server didn't accept the username/password combination." msgstr "" -#: library/smtplib.rst:410 library/smtplib.rst:487 +#: library/smtplib.rst:418 library/smtplib.rst:491 msgid ":exc:`SMTPNotSupportedError`" msgstr "" -#: library/smtplib.rst:325 +#: library/smtplib.rst:334 msgid "The ``AUTH`` command is not supported by the server." msgstr "" -#: library/smtplib.rst:328 +#: library/smtplib.rst:336 msgid ":exc:`SMTPException`" msgstr "" -#: library/smtplib.rst:328 +#: library/smtplib.rst:337 msgid "No suitable authentication method was found." msgstr "" -#: library/smtplib.rst:330 +#: library/smtplib.rst:339 msgid "" "Each of the authentication methods supported by :mod:`smtplib` are tried in " "turn if they are advertised as supported by the server. See :meth:`auth` " @@ -422,7 +436,7 @@ msgid "" "passed through to :meth:`auth`." msgstr "" -#: library/smtplib.rst:335 +#: library/smtplib.rst:344 msgid "" "Optional keyword argument *initial_response_ok* specifies whether, for " "authentication methods that support it, an \"initial response\" as specified " @@ -430,31 +444,35 @@ msgid "" "requiring a challenge/response." msgstr "" -#: library/smtplib.rst:340 +#: library/smtplib.rst:349 msgid "" ":exc:`SMTPNotSupportedError` may be raised, and the *initial_response_ok* " "parameter was added." msgstr "" -#: library/smtplib.rst:347 +#: library/smtplib.rst:356 msgid "" "Issue an ``SMTP`` ``AUTH`` command for the specified authentication " "*mechanism*, and handle the challenge response via *authobject*." msgstr "" -#: library/smtplib.rst:350 +#: library/smtplib.rst:359 msgid "" "*mechanism* specifies which authentication mechanism is to be used as " "argument to the ``AUTH`` command; the valid values are those listed in the " "``auth`` element of :attr:`esmtp_features`." msgstr "" -#: library/smtplib.rst:354 +#: library/smtplib.rst:363 msgid "" "*authobject* must be a callable object taking an optional single argument::" msgstr "" -#: library/smtplib.rst:358 +#: library/smtplib.rst:365 +msgid "data = authobject(challenge=None)" +msgstr "" + +#: library/smtplib.rst:367 msgid "" "If optional keyword argument *initial_response_ok* is true, ``authobject()`` " "will be called first with no argument. It can return the :rfc:`4954` " @@ -465,7 +483,7 @@ msgid "" "false, then ``authobject()`` will not be called first with ``None``." msgstr "" -#: library/smtplib.rst:366 +#: library/smtplib.rst:375 msgid "" "If the initial response check returns ``None``, or if *initial_response_ok* " "is false, ``authobject()`` will be called to process the server's challenge " @@ -474,7 +492,7 @@ msgid "" "the server." msgstr "" -#: library/smtplib.rst:372 +#: library/smtplib.rst:381 msgid "" "The ``SMTP`` class provides ``authobjects`` for the ``CRAM-MD5``, ``PLAIN``, " "and ``LOGIN`` mechanisms; they are named ``SMTP.auth_cram_md5``, ``SMTP." @@ -483,7 +501,7 @@ msgid "" "appropriate values." msgstr "" -#: library/smtplib.rst:378 +#: library/smtplib.rst:387 msgid "" "User code does not normally need to call ``auth`` directly, but can instead " "call the :meth:`login` method, which will try each of the above mechanisms " @@ -492,57 +510,57 @@ msgid "" "by :mod:`smtplib`." msgstr "" -#: library/smtplib.rst:389 +#: library/smtplib.rst:398 msgid "" "Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP " "commands that follow will be encrypted. You should then call :meth:`ehlo` " "again." msgstr "" -#: library/smtplib.rst:393 +#: library/smtplib.rst:402 msgid "" "If *keyfile* and *certfile* are provided, they are used to create an :class:" "`ssl.SSLContext`." msgstr "" -#: library/smtplib.rst:396 +#: library/smtplib.rst:405 msgid "" "Optional *context* parameter is an :class:`ssl.SSLContext` object; This is " "an alternative to using a keyfile and a certfile and if specified both " "*keyfile* and *certfile* should be ``None``." msgstr "" -#: library/smtplib.rst:400 +#: library/smtplib.rst:409 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first." msgstr "" -#: library/smtplib.rst:410 +#: library/smtplib.rst:419 msgid "The server does not support the STARTTLS extension." msgstr "" -#: library/smtplib.rst:413 +#: library/smtplib.rst:421 msgid ":exc:`RuntimeError`" msgstr "" -#: library/smtplib.rst:413 +#: library/smtplib.rst:422 msgid "SSL/TLS support is not available to your Python interpreter." msgstr "" -#: library/smtplib.rst:418 +#: library/smtplib.rst:427 msgid "" -"The method now supports hostname check with :attr:`SSLContext." +"The method now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indicator* (see :const:`~ssl.HAS_SNI`)." msgstr "" -#: library/smtplib.rst:423 +#: library/smtplib.rst:432 msgid "" "The error raised for lack of STARTTLS support is now the :exc:" "`SMTPNotSupportedError` subclass instead of the base :exc:`SMTPException`." msgstr "" -#: library/smtplib.rst:431 +#: library/smtplib.rst:440 msgid "" "Send mail. The required arguments are an :rfc:`822` from-address string, a " "list of :rfc:`822` to-address strings (a bare string will be treated as a " @@ -551,18 +569,18 @@ msgid "" "*mail_options*. ESMTP options (such as ``DSN`` commands) that should be used " "with all ``RCPT`` commands can be passed as *rcpt_options*. (If you need to " "use different ESMTP options to different recipients you have to use the low-" -"level methods such as :meth:`mail`, :meth:`rcpt` and :meth:`data` to send " +"level methods such as :meth:`!mail`, :meth:`!rcpt` and :meth:`!data` to send " "the message.)" msgstr "" -#: library/smtplib.rst:442 +#: library/smtplib.rst:451 msgid "" "The *from_addr* and *to_addrs* parameters are used to construct the message " "envelope used by the transport agents. ``sendmail`` does not modify the " "message headers in any way." msgstr "" -#: library/smtplib.rst:446 +#: library/smtplib.rst:455 msgid "" "*msg* may be a string containing characters in the ASCII range, or a byte " "string. A string is encoded to bytes using the ascii codec, and lone " @@ -570,7 +588,7 @@ msgid "" "byte string is not modified." msgstr "" -#: library/smtplib.rst:451 +#: library/smtplib.rst:460 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first. If the server does ESMTP, message " @@ -579,7 +597,7 @@ msgid "" "will be tried and ESMTP options suppressed." msgstr "" -#: library/smtplib.rst:457 +#: library/smtplib.rst:466 msgid "" "This method will return normally if the mail is accepted for at least one " "recipient. Otherwise it will raise an exception. That is, if this method " @@ -589,69 +607,65 @@ msgid "" "SMTP error code and the accompanying error message sent by the server." msgstr "" -#: library/smtplib.rst:464 +#: library/smtplib.rst:473 msgid "" "If ``SMTPUTF8`` is included in *mail_options*, and the server supports it, " "*from_addr* and *to_addrs* may contain non-ASCII characters." msgstr "" -#: library/smtplib.rst:467 +#: library/smtplib.rst:476 msgid "This method may raise the following exceptions:" msgstr "" -#: library/smtplib.rst:473 +#: library/smtplib.rst:478 msgid ":exc:`SMTPRecipientsRefused`" msgstr "" -#: library/smtplib.rst:470 -msgid "" -"All recipients were refused. Nobody got the mail. The :attr:`recipients` " -"attribute of the exception object is a dictionary with information about the " -"refused recipients (like the one returned when at least one recipient was " -"accepted)." +#: library/smtplib.rst:479 +msgid "All recipients were refused. Nobody got the mail." msgstr "" -#: library/smtplib.rst:479 +#: library/smtplib.rst:484 msgid ":exc:`SMTPSenderRefused`" msgstr "" -#: library/smtplib.rst:479 +#: library/smtplib.rst:485 msgid "The server didn't accept the *from_addr*." msgstr "" -#: library/smtplib.rst:483 +#: library/smtplib.rst:487 msgid ":exc:`SMTPDataError`" msgstr "" -#: library/smtplib.rst:482 +#: library/smtplib.rst:488 msgid "" "The server replied with an unexpected error code (other than a refusal of a " "recipient)." msgstr "" -#: library/smtplib.rst:486 +#: library/smtplib.rst:492 msgid "" "``SMTPUTF8`` was given in the *mail_options* but is not supported by the " "server." msgstr "" -#: library/smtplib.rst:489 +#: library/smtplib.rst:495 msgid "" "Unless otherwise noted, the connection will be open even after an exception " "is raised." msgstr "" -#: library/smtplib.rst:492 +#: library/smtplib.rst:498 msgid "*msg* may be a byte string." msgstr "" -#: library/smtplib.rst:495 +#: library/smtplib.rst:501 msgid "" "``SMTPUTF8`` support added, and :exc:`SMTPNotSupportedError` may be raised " "if ``SMTPUTF8`` is specified but the server does not support it." msgstr "" -#: library/smtplib.rst:503 +#: library/smtplib.rst:509 msgid "" "This is a convenience method for calling :meth:`sendmail` with the message " "represented by an :class:`email.message.Message` object. The arguments have " @@ -659,7 +673,7 @@ msgid "" "object." msgstr "" -#: library/smtplib.rst:508 +#: library/smtplib.rst:514 msgid "" "If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills " "those arguments with addresses extracted from the headers of *msg* as " @@ -674,7 +688,7 @@ msgid "" "most recent set of :mailheader:`Resent-` headers." msgstr "" -#: library/smtplib.rst:520 +#: library/smtplib.rst:526 msgid "" "``send_message`` serializes *msg* using :class:`~email.generator." "BytesGenerator` with ``\\r\\n`` as the *linesep*, and calls :meth:`sendmail` " @@ -682,24 +696,24 @@ msgid "" "and *to_addrs*, ``send_message`` does not transmit any :mailheader:`Bcc` or :" "mailheader:`Resent-Bcc` headers that may appear in *msg*. If any of the " "addresses in *from_addr* and *to_addrs* contain non-ASCII characters and the " -"server does not advertise ``SMTPUTF8`` support, an :exc:`SMTPNotSupported` " -"error is raised. Otherwise the ``Message`` is serialized with a clone of " -"its :mod:`~email.policy` with the :attr:`~email.policy.EmailPolicy.utf8` " -"attribute set to ``True``, and ``SMTPUTF8`` and ``BODY=8BITMIME`` are added " -"to *mail_options*." +"server does not advertise ``SMTPUTF8`` support, an :exc:" +"`SMTPNotSupportedError` is raised. Otherwise the ``Message`` is serialized " +"with a clone of its :mod:`~email.policy` with the :attr:`~email.policy." +"EmailPolicy.utf8` attribute set to ``True``, and ``SMTPUTF8`` and " +"``BODY=8BITMIME`` are added to *mail_options*." msgstr "" -#: library/smtplib.rst:534 +#: library/smtplib.rst:540 msgid "Support for internationalized addresses (``SMTPUTF8``)." msgstr "" -#: library/smtplib.rst:540 +#: library/smtplib.rst:546 msgid "" "Terminate the SMTP session and close the connection. Return the result of " "the SMTP ``QUIT`` command." msgstr "" -#: library/smtplib.rst:544 +#: library/smtplib.rst:550 msgid "" "Low-level methods corresponding to the standard SMTP/ESMTP commands " "``HELP``, ``RSET``, ``NOOP``, ``MAIL``, ``RCPT``, and ``DATA`` are also " @@ -707,22 +721,76 @@ msgid "" "documented here. For details, consult the module code." msgstr "" -#: library/smtplib.rst:553 +#: library/smtplib.rst:555 +msgid "Additionally, an SMTP instance has the following attributes:" +msgstr "" + +#: library/smtplib.rst:560 +msgid "The response to the ``HELO`` command, see :meth:`helo`." +msgstr "" + +#: library/smtplib.rst:565 +msgid "The response to the ``EHLO`` command, see :meth:`ehlo`." +msgstr "" + +#: library/smtplib.rst:570 +msgid "" +"A boolean value indicating whether the server supports ESMTP, see :meth:" +"`ehlo`." +msgstr "" + +#: library/smtplib.rst:576 +msgid "" +"A dictionary of the names of SMTP service extensions supported by the " +"server, see :meth:`ehlo`." +msgstr "" + +#: library/smtplib.rst:583 msgid "SMTP Example" msgstr "" -#: library/smtplib.rst:555 +#: library/smtplib.rst:585 msgid "" "This example prompts the user for addresses needed in the message envelope " "('To' and 'From' addresses), and the message to be delivered. Note that the " "headers to be included with the message must be included in the message as " "entered; this example doesn't do any processing of the :rfc:`822` headers. " "In particular, the 'To' and 'From' addresses must be included in the message " -"headers explicitly. ::" +"headers explicitly::" msgstr "" #: library/smtplib.rst:591 msgid "" +"import smtplib\n" +"\n" +"def prompt(title):\n" +" return input(title).strip()\n" +"\n" +"from_addr = prompt(\"From: \")\n" +"to_addrs = prompt(\"To: \").split()\n" +"print(\"Enter message, end with ^D (Unix) or ^Z (Windows):\")\n" +"\n" +"# Add the From: and To: headers at the start!\n" +"lines = [f\"From: {from_addr}\", f\"To: {', '.join(to_addrs)}\", \"\"]\n" +"while True:\n" +" try:\n" +" line = input()\n" +" except EOFError:\n" +" break\n" +" else:\n" +" lines.append(line)\n" +"\n" +"msg = \"\\r\\n\".join(lines)\n" +"print(\"Message length is\", len(msg))\n" +"\n" +"server = smtplib.SMTP(\"localhost\")\n" +"server.set_debuglevel(1)\n" +"server.sendmail(from_addr, to_addrs, msg)\n" +"server.quit()" +msgstr "" + +#: library/smtplib.rst:620 +msgid "" "In general, you will want to use the :mod:`email` package's features to " "construct an email message, which you can then send via :meth:`~smtplib.SMTP." "send_message`; see :ref:`email-examples`." diff --git a/library/sndhdr.po b/library/sndhdr.po index 45c09f5f..fe155117 100644 --- a/library/sndhdr.po +++ b/library/sndhdr.po @@ -8,187 +8,35 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/sndhdr.rst:2 -msgid ":mod:`sndhdr` --- Determine type of sound file" +msgid ":mod:`!sndhdr` --- Determine type of sound file" msgstr "" -#: library/sndhdr.rst:11 -msgid "**Source code:** :source:`Lib/sndhdr.py`" -msgstr "" - -#: library/sndhdr.rst:20 -msgid "" -"The :mod:`sndhdr` module is deprecated (see :pep:`PEP 594 <594#sndhdr>` for " -"details and alternatives)." -msgstr "" - -#: library/sndhdr.rst:23 -msgid "" -"The :mod:`sndhdr` provides utility functions which attempt to determine the " -"type of sound data which is in a file. When these functions are able to " -"determine what type of sound data is stored in a file, they return a :func:" -"`~collections.namedtuple`, containing five attributes: (``filetype``, " -"``framerate``, ``nchannels``, ``nframes``, ``sampwidth``). The value for " -"*type* indicates the data type and will be one of the strings ``'aifc'``, " -"``'aiff'``, ``'au'``, ``'hcom'``, ``'sndr'``, ``'sndt'``, ``'voc'``, " -"``'wav'``, ``'8svx'``, ``'sb'``, ``'ub'``, or ``'ul'``. The *sampling_rate* " -"will be either the actual value or ``0`` if unknown or difficult to decode. " -"Similarly, *channels* will be either the number of channels or ``0`` if it " -"cannot be determined or if the value is difficult to decode. The value for " -"*frames* will be either the number of frames or ``-1``. The last item in " -"the tuple, *bits_per_sample*, will either be the sample size in bits or " -"``'A'`` for A-LAW or ``'U'`` for u-LAW." -msgstr "" - -#: library/sndhdr.rst:40 -msgid "" -"Determines the type of sound data stored in the file *filename* using :func:" -"`whathdr`. If it succeeds, returns a namedtuple as described above, " -"otherwise ``None`` is returned." -msgstr "" - -#: library/sndhdr.rst:54 -msgid "Result changed from a tuple to a namedtuple." -msgstr "" - -#: library/sndhdr.rst:50 +#: library/sndhdr.rst:10 msgid "" -"Determines the type of sound data stored in a file based on the file " -"header. The name of the file is given by *filename*. This function returns " -"a namedtuple as described above on success, or ``None``." -msgstr "" - -#: library/sndhdr.rst:57 -msgid "" -"The following sound header types are recognized, as listed below with the " -"return value from :func:`whathdr`: and :func:`what`:" -msgstr "" - -#: library/sndhdr.rst:61 -msgid "Value" -msgstr "" - -#: library/sndhdr.rst:61 -msgid "Sound header format" -msgstr "" - -#: library/sndhdr.rst:63 -msgid "``'aifc'``" -msgstr "" - -#: library/sndhdr.rst:63 -msgid "Compressed Audio Interchange Files" -msgstr "" - -#: library/sndhdr.rst:65 -msgid "``'aiff'``" -msgstr "" - -#: library/sndhdr.rst:65 -msgid "Audio Interchange Files" -msgstr "" - -#: library/sndhdr.rst:67 -msgid "``'au'``" -msgstr "" - -#: library/sndhdr.rst:67 -msgid "Au Files" -msgstr "" - -#: library/sndhdr.rst:69 -msgid "``'hcom'``" -msgstr "" - -#: library/sndhdr.rst:69 -msgid "HCOM Files" -msgstr "" - -#: library/sndhdr.rst:71 -msgid "``'sndt'``" -msgstr "" - -#: library/sndhdr.rst:71 -msgid "Sndtool Sound Files" -msgstr "" - -#: library/sndhdr.rst:73 -msgid "``'voc'``" -msgstr "" - -#: library/sndhdr.rst:73 -msgid "Creative Labs Audio Files" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/sndhdr.rst:75 -msgid "``'wav'``" -msgstr "" - -#: library/sndhdr.rst:75 -msgid "Waveform Audio File Format Files" -msgstr "" - -#: library/sndhdr.rst:77 -msgid "``'8svx'``" -msgstr "" - -#: library/sndhdr.rst:77 -msgid "8-Bit Sampled Voice Files" -msgstr "" - -#: library/sndhdr.rst:79 -msgid "``'sb'``" -msgstr "" - -#: library/sndhdr.rst:79 -msgid "Signed Byte Audio Data Files" -msgstr "" - -#: library/sndhdr.rst:81 -msgid "``'ub'``" -msgstr "" - -#: library/sndhdr.rst:81 -msgid "UB Files" -msgstr "" - -#: library/sndhdr.rst:83 -msgid "``'ul'``" -msgstr "" - -#: library/sndhdr.rst:83 -msgid "uLAW Audio Files" -msgstr "" - -#: library/sndhdr.rst:88 +#: library/sndhdr.rst:14 msgid "" -"A list of functions performing the individual tests. Each function takes " -"two arguments: the byte-stream and an open file-like object. When :func:" -"`what` is called with a byte-stream, the file-like object will be ``None``." +"Possible replacements are third-party modules from PyPI: :pypi:`filetype`, :" +"pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or " +"maintained by the Python core team." msgstr "" -#: library/sndhdr.rst:92 +#: library/sndhdr.rst:18 msgid "" -"The test function should return a string describing the image type if the " -"test succeeded, or ``None`` if it failed." -msgstr "" - -#: library/sndhdr.rst:95 -msgid "Example:" -msgstr "" - -#: library/sndhdr.rst:13 -msgid "A-LAW" -msgstr "" - -#: library/sndhdr.rst:13 -msgid "u-LAW" +"The last version of Python that provided the :mod:`!sndhdr` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/socket.po b/library/socket.po index 7858cde5..2e93ecac 100644 --- a/library/socket.po +++ b/library/socket.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/socket.rst:2 -msgid ":mod:`socket` --- Low-level networking interface" +msgid ":mod:`!socket` --- Low-level networking interface" msgstr "" #: library/socket.rst:7 @@ -37,15 +38,24 @@ msgid "" "operating system socket APIs." msgstr "" -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#: library/socket.rst:206 library/socket.rst:241 library/socket.rst:408 +#: library/socket.rst:511 library/socket.rst:537 library/socket.rst:555 +#: library/socket.rst:578 library/socket.rst:602 library/socket.rst:642 +#: library/socket.rst:680 library/socket.rst:745 library/socket.rst:769 +#: library/socket.rst:786 library/socket.rst:818 library/socket.rst:1017 +#: library/socket.rst:1158 library/socket.rst:1186 library/socket.rst:1214 +#: library/socket.rst:1236 library/socket.rst:1345 library/socket.rst:1394 +#: library/socket.rst:1434 library/socket.rst:1478 library/socket.rst:1509 +#: library/socket.rst:1607 library/socket.rst:1641 library/socket.rst:1721 +#: library/socket.rst:1859 library/socket.rst:2011 library/socket.rst:2110 +#: library/socket.rst:2132 includes/wasm-notavail.rst:3 +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/socket.rst:24 @@ -59,7 +69,7 @@ msgid "" "operations is automatic, and buffer length is implicit on send operations." msgstr "" -#: library/socket.rst:36 +#: library/socket.rst:35 msgid "Module :mod:`socketserver`" msgstr "" @@ -109,7 +119,7 @@ msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: library/socket.rst:1148 library/socket.rst:1950 +#: library/socket.rst:1308 library/socket.rst:2104 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -231,143 +241,175 @@ msgstr "" #: library/socket.rst:140 msgid "" -":const:`BTPROTO_L2CAP` accepts ``(bdaddr, psm)`` where ``bdaddr`` is the " -"Bluetooth address as a string and ``psm`` is an integer." +":const:`BTPROTO_L2CAP` accepts a tuple ``(bdaddr, psm[, cid[, " +"bdaddr_type]])`` where:" msgstr "" #: library/socket.rst:143 +msgid "``bdaddr`` is a string specifying the Bluetooth address." +msgstr "" + +#: library/socket.rst:144 +msgid "``psm`` is an integer specifying the Protocol/Service Multiplexer." +msgstr "" + +#: library/socket.rst:145 msgid "" -":const:`BTPROTO_RFCOMM` accepts ``(bdaddr, channel)`` where ``bdaddr`` is " -"the Bluetooth address as a string and ``channel`` is an integer." +"``cid`` is an optional integer specifying the Channel Identifier. If not " +"given, defaults to zero." msgstr "" -#: library/socket.rst:146 +#: library/socket.rst:147 msgid "" -":const:`BTPROTO_HCI` accepts ``(device_id,)`` where ``device_id`` is either " -"an integer or a string with the Bluetooth address of the interface. (This " -"depends on your OS; NetBSD and DragonFlyBSD expect a Bluetooth address while " -"everything else expects an integer.)" +"``bdaddr_type`` is an optional integer specifying the address type; one of :" +"const:`BDADDR_BREDR` (default), :const:`BDADDR_LE_PUBLIC`, :const:" +"`BDADDR_LE_RANDOM`." msgstr "" #: library/socket.rst:151 -msgid "NetBSD and DragonFlyBSD support added." +msgid "Added ``cid`` and ``bdaddr_type`` fields." msgstr "" #: library/socket.rst:154 msgid "" -":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is a :class:`bytes` " -"object containing the Bluetooth address in a string format. (ex. " -"``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." +":const:`BTPROTO_RFCOMM` accepts ``(bdaddr, channel)`` where ``bdaddr`` is " +"the Bluetooth address as a string and ``channel`` is an integer." +msgstr "" + +#: library/socket.rst:157 +msgid ":const:`BTPROTO_HCI` accepts a format that depends on your OS." msgstr "" #: library/socket.rst:159 msgid "" +"On Linux it accepts an integer ``device_id`` or a tuple ``(device_id, " +"[channel])`` where ``device_id`` specifies the number of the Bluetooth " +"device, and ``channel`` is an optional integer specifying the HCI channel (:" +"const:`HCI_CHANNEL_RAW` by default)." +msgstr "" + +#: library/socket.rst:164 +msgid "" +"On FreeBSD, NetBSD and DragonFly BSD it accepts ``bdaddr`` where ``bdaddr`` " +"is the Bluetooth address as a string." +msgstr "" + +#: library/socket.rst:167 +msgid "NetBSD and DragonFlyBSD support added." +msgstr "" + +#: library/socket.rst:181 +msgid "FreeBSD support added." +msgstr "" + +#: library/socket.rst:173 +msgid "" +"Added ``channel`` field. ``device_id`` not packed in a tuple is now accepted." +msgstr "" + +#: library/socket.rst:177 +msgid "" +":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is the Bluetooth " +"address as a string or a :class:`bytes` object. (ex. ``'12:23:34:45:56:67'`` " +"or ``b'12:23:34:45:56:67'``)" +msgstr "" + +#: library/socket.rst:184 +msgid "" ":const:`AF_ALG` is a Linux-only socket based interface to Kernel " "cryptography. An algorithm socket is configured with a tuple of two to four " "elements ``(type, name [, feat [, mask]])``, where:" msgstr "" -#: library/socket.rst:163 +#: library/socket.rst:188 msgid "" "*type* is the algorithm type as string, e.g. ``aead``, ``hash``, " "``skcipher`` or ``rng``." msgstr "" -#: library/socket.rst:166 +#: library/socket.rst:191 msgid "" "*name* is the algorithm name and operation mode as string, e.g. ``sha256``, " "``hmac(sha256)``, ``cbc(aes)`` or ``drbg_nopr_ctr_aes256``." msgstr "" -#: library/socket.rst:169 +#: library/socket.rst:194 msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: library/socket.rst:589 library/socket.rst:1872 -msgid ":ref:`Availability `: Linux >= 2.6.38." -msgstr "" - -#: library/socket.rst:173 +#: library/socket.rst:198 msgid "Some algorithm types require more recent Kernels." msgstr "" -#: library/socket.rst:177 +#: library/socket.rst:202 msgid "" ":const:`AF_VSOCK` allows communication between virtual machines and their " "hosts. The sockets are represented as a ``(CID, port)`` tuple where the " "context ID or CID and port are integers." msgstr "" -#: library/socket.rst:662 -msgid ":ref:`Availability `: Linux >= 3.9" -msgstr "" - -#: library/socket.rst:183 +#: library/socket.rst:208 msgid "See :manpage:`vsock(7)`" msgstr "" -#: library/socket.rst:187 +#: library/socket.rst:212 msgid "" ":const:`AF_PACKET` is a low-level interface directly to network devices. The " "addresses are represented by the tuple ``(ifname, proto[, pkttype[, hatype[, " "addr]]])`` where:" msgstr "" -#: library/socket.rst:191 +#: library/socket.rst:216 msgid "*ifname* - String specifying the device name." msgstr "" -#: library/socket.rst:192 +#: library/socket.rst:217 msgid "" "*proto* - The Ethernet protocol number. May be :data:`ETH_P_ALL` to capture " "all protocols, one of the :ref:`ETHERTYPE_* constants ` or any other Ethernet protocol number." msgstr "" -#: library/socket.rst:196 +#: library/socket.rst:221 msgid "*pkttype* - Optional integer specifying the packet type:" msgstr "" -#: library/socket.rst:198 +#: library/socket.rst:223 msgid "``PACKET_HOST`` (the default) - Packet addressed to the local host." msgstr "" -#: library/socket.rst:199 +#: library/socket.rst:224 msgid "``PACKET_BROADCAST`` - Physical-layer broadcast packet." msgstr "" -#: library/socket.rst:200 +#: library/socket.rst:225 msgid "" "``PACKET_MULTICAST`` - Packet sent to a physical-layer multicast address." msgstr "" -#: library/socket.rst:201 +#: library/socket.rst:226 msgid "" "``PACKET_OTHERHOST`` - Packet to some other host that has been caught by a " "device driver in promiscuous mode." msgstr "" -#: library/socket.rst:203 +#: library/socket.rst:228 msgid "" "``PACKET_OUTGOING`` - Packet originating from the local host that is looped " "back to a packet socket." msgstr "" -#: library/socket.rst:205 +#: library/socket.rst:230 msgid "*hatype* - Optional integer specifying the ARP hardware address type." msgstr "" -#: library/socket.rst:206 +#: library/socket.rst:231 msgid "" "*addr* - Optional bytes-like object specifying the hardware physical " "address, whose interpretation depends on the device." msgstr "" -#: library/socket.rst:537 -msgid ":ref:`Availability `: Linux >= 2.2." -msgstr "" - -#: library/socket.rst:211 +#: library/socket.rst:236 msgid "" ":const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating " "with services running on co-processors in Qualcomm platforms. The address " @@ -375,11 +417,7 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: library/socket.rst:638 -msgid ":ref:`Availability `: Linux >= 4.7." -msgstr "" - -#: library/socket.rst:220 +#: library/socket.rst:245 msgid "" ":const:`IPPROTO_UDPLITE` is a variant of UDP which allows you to specify " "what portion of a packet is covered with the checksum. It adds two socket " @@ -390,18 +428,14 @@ msgid "" "of their data. In both cases ``length`` should be in ``range(8, 2**16, 8)``." msgstr "" -#: library/socket.rst:229 +#: library/socket.rst:254 msgid "" "Such a socket should be constructed with ``socket(AF_INET, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv4 or ``socket(AF_INET6, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv6." msgstr "" -#: library/socket.rst:233 -msgid ":ref:`Availability `: Linux >= 2.6.20, FreeBSD >= 10.1" -msgstr "" - -#: library/socket.rst:237 +#: library/socket.rst:262 msgid "" ":const:`AF_HYPERV` is a Windows-only socket based interface for " "communicating with Hyper-V hosts and guests. The address family is " @@ -409,49 +443,49 @@ msgid "" "``service_id`` are UUID strings." msgstr "" -#: library/socket.rst:242 +#: library/socket.rst:267 msgid "" "The ``vm_id`` is the virtual machine identifier or a set of known VMID " "values if the target is not a specific virtual machine. Known VMID constants " "defined on ``socket`` are:" msgstr "" -#: library/socket.rst:246 +#: library/socket.rst:271 msgid "``HV_GUID_ZERO``" msgstr "" -#: library/socket.rst:247 +#: library/socket.rst:272 msgid "``HV_GUID_BROADCAST``" msgstr "" -#: library/socket.rst:248 +#: library/socket.rst:273 msgid "" "``HV_GUID_WILDCARD`` - Used to bind on itself and accept connections from " "all partitions." msgstr "" -#: library/socket.rst:250 +#: library/socket.rst:275 msgid "" "``HV_GUID_CHILDREN`` - Used to bind on itself and accept connection from " "child partitions." msgstr "" -#: library/socket.rst:252 +#: library/socket.rst:277 msgid "``HV_GUID_LOOPBACK`` - Used as a target to itself." msgstr "" -#: library/socket.rst:253 +#: library/socket.rst:278 msgid "" "``HV_GUID_PARENT`` - When used as a bind accepts connection from the parent " "partition. When used as an address target it will connect to the parent " "partition." msgstr "" -#: library/socket.rst:256 +#: library/socket.rst:281 msgid "The ``service_id`` is the service identifier of the registered service." msgstr "" -#: library/socket.rst:260 +#: library/socket.rst:285 msgid "" "If you use a hostname in the *host* portion of IPv4/v6 socket address, the " "program may show a nondeterministic behavior, as Python uses the first " @@ -461,41 +495,41 @@ msgid "" "deterministic behavior use a numeric address in *host* portion." msgstr "" -#: library/socket.rst:267 +#: library/socket.rst:292 msgid "" "All errors raise exceptions. The normal exceptions for invalid argument " "types and out-of-memory conditions can be raised. Errors related to socket " "or address semantics raise :exc:`OSError` or one of its subclasses." msgstr "" -#: library/socket.rst:272 +#: library/socket.rst:297 msgid "" "Non-blocking mode is supported through :meth:`~socket.setblocking`. A " "generalization of this based on timeouts is supported through :meth:`~socket." "settimeout`." msgstr "" -#: library/socket.rst:278 +#: library/socket.rst:303 msgid "Module contents" msgstr "" -#: library/socket.rst:280 +#: library/socket.rst:305 msgid "The module :mod:`socket` exports the following elements." msgstr "" -#: library/socket.rst:284 +#: library/socket.rst:309 msgid "Exceptions" msgstr "" -#: library/socket.rst:288 +#: library/socket.rst:313 msgid "A deprecated alias of :exc:`OSError`." msgstr "" -#: library/socket.rst:290 +#: library/socket.rst:315 msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`." msgstr "" -#: library/socket.rst:296 +#: library/socket.rst:321 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors, i.e. for functions that use *h_errno* in the POSIX C API, including :" @@ -505,11 +539,11 @@ msgid "" "description of *h_errno*, as returned by the :c:func:`hstrerror` C function." msgstr "" -#: library/socket.rst:317 library/socket.rst:330 +#: library/socket.rst:342 library/socket.rst:355 msgid "This class was made a subclass of :exc:`OSError`." msgstr "" -#: library/socket.rst:309 +#: library/socket.rst:334 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors by :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying " @@ -519,11 +553,11 @@ msgid "" "match one of the :const:`!EAI_\\*` constants defined in this module." msgstr "" -#: library/socket.rst:322 +#: library/socket.rst:347 msgid "A deprecated alias of :exc:`TimeoutError`." msgstr "" -#: library/socket.rst:324 +#: library/socket.rst:349 msgid "" "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs " "on a socket which has had timeouts enabled via a prior call to :meth:" @@ -532,21 +566,21 @@ msgid "" "currently always \"timed out\"." msgstr "" -#: library/socket.rst:333 +#: library/socket.rst:358 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" -#: library/socket.rst:338 +#: library/socket.rst:363 msgid "Constants" msgstr "" -#: library/socket.rst:340 +#: library/socket.rst:365 msgid "" "The AF_* and SOCK_* constants are now :class:`AddressFamily` and :class:" "`SocketKind` :class:`.IntEnum` collections." msgstr "" -#: library/socket.rst:349 +#: library/socket.rst:374 msgid "" "These constants represent the address (and protocol) families, used for the " "first argument to :func:`~socket.socket`. If the :const:`AF_UNIX` constant " @@ -554,14 +588,14 @@ msgid "" "available depending on the system." msgstr "" -#: library/socket.rst:356 +#: library/socket.rst:381 msgid "" ":const:`AF_UNSPEC` means that :func:`getaddrinfo` should return socket " "addresses for any address family (either IPv4, IPv6, or any other) that can " "be used." msgstr "" -#: library/socket.rst:366 +#: library/socket.rst:391 msgid "" "These constants represent the socket types, used for the second argument to :" "func:`~socket.socket`. More constants may be available depending on the " @@ -569,24 +603,20 @@ msgid "" "generally useful.)" msgstr "" -#: library/socket.rst:374 +#: library/socket.rst:399 msgid "" "These two constants, if defined, can be combined with the socket types and " "allow you to set some flags atomically (thus avoiding possible race " "conditions and the need for separate calls)." msgstr "" -#: library/socket.rst:380 +#: library/socket.rst:405 msgid "" "`Secure File Descriptor Handling `_ for a more thorough explanation." msgstr "" -#: library/socket.rst:383 -msgid ":ref:`Availability `: Linux >= 2.6.27." -msgstr "" - -#: library/socket.rst:404 +#: library/socket.rst:429 msgid "" "Many constants of these forms, documented in the Unix documentation on " "sockets and/or the IP protocol, are also defined in the socket module. They " @@ -596,41 +626,41 @@ msgid "" "symbols, default values are provided." msgstr "" -#: library/socket.rst:411 +#: library/socket.rst:436 msgid "" "``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``, " "``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` were added." msgstr "" -#: library/socket.rst:415 +#: library/socket.rst:440 msgid "" -"On Windows, ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` appear if run-time Windows " -"supports." +"Added support for ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` on Windows platforms " +"when available." msgstr "" -#: library/socket.rst:419 +#: library/socket.rst:444 msgid "``TCP_NOTSENT_LOWAT`` was added." msgstr "" -#: library/socket.rst:422 +#: library/socket.rst:447 msgid "" -"On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows " -"supports." +"Added support for ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` on Windows platforms " +"when available." msgstr "" -#: library/socket.rst:425 +#: library/socket.rst:450 msgid "" "``IP_RECVTOS`` was added. Added ``TCP_KEEPALIVE``. On MacOS this constant " "can be used in the same way that ``TCP_KEEPIDLE`` is used on Linux." msgstr "" -#: library/socket.rst:430 +#: library/socket.rst:455 msgid "" "Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the " "same way that ``TCP_INFO`` is used on Linux and BSD." msgstr "" -#: library/socket.rst:434 +#: library/socket.rst:459 msgid "" "Added ``SO_RTABLE`` and ``SO_USER_COOKIE``. On OpenBSD and FreeBSD " "respectively those constants can be used in the same way that ``SO_MARK`` is " @@ -646,165 +676,198 @@ msgid "" "``IP_DROP_SOURCE_MEMBERSHIP``." msgstr "" -#: library/socket.rst:534 library/socket.rst:558 +#: library/socket.rst:473 +msgid "" +"Added ``SO_BINDTOIFINDEX``. On Linux this constant can be used in the same " +"way that ``SO_BINDTODEVICE`` is used, but with the index of a network " +"interface instead of its name." +msgstr "" + +#: library/socket.rst:478 +msgid "" +"Added missing ``IP_FREEBIND``, ``IP_RECVERR``, ``IPV6_RECVERR``, " +"``IP_RECVTTL``, and ``IP_RECVORIGDSTADDR`` on Linux." +msgstr "" + +#: library/socket.rst:482 +msgid "Added support for ``TCP_QUICKACK`` on Windows platforms when available." +msgstr "" + +#: library/socket.rst:575 library/socket.rst:599 msgid "" "Many constants of these forms, documented in the Linux documentation, are " "also defined in the socket module." msgstr "" -#: library/socket.rst:456 -msgid ":ref:`Availability `: Linux >= 2.6.25, NetBSD >= 8." +#: library/socket.rst:498 +msgid "NetBSD support was added." msgstr "" -#: library/socket.rst:460 -msgid "NetBSD support was added." +#: library/socket.rst:501 +msgid "Restored missing ``CAN_RAW_ERR_FILTER`` on Linux." msgstr "" -#: library/socket.rst:466 +#: library/socket.rst:507 msgid "" "CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) " "protocol. Broadcast manager constants, documented in the Linux " "documentation, are also defined in the socket module." msgstr "" -#: library/socket.rst:505 -msgid ":ref:`Availability `: Linux >= 2.6.25." -msgstr "" - -#: library/socket.rst:473 +#: library/socket.rst:514 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" -#: library/socket.rst:479 +#: library/socket.rst:520 msgid "" "Enables CAN FD support in a CAN_RAW socket. This is disabled by default. " "This allows your application to send both CAN and CAN FD frames; however, " "you must accept both CAN and CAN FD frames when reading from the socket." msgstr "" -#: library/socket.rst:494 +#: library/socket.rst:535 msgid "This constant is documented in the Linux documentation." msgstr "" -#: library/socket.rst:485 -msgid ":ref:`Availability `: Linux >= 3.6." -msgstr "" - -#: library/socket.rst:491 +#: library/socket.rst:532 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: library/socket.rst:496 -msgid ":ref:`Availability `: Linux >= 4.1." -msgstr "" - -#: library/socket.rst:502 +#: library/socket.rst:543 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" -#: library/socket.rst:511 +#: library/socket.rst:552 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" -#: library/socket.rst:514 -msgid ":ref:`Availability `: Linux >= 5.4." -msgstr "" - -#: library/socket.rst:522 +#: library/socket.rst:563 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" -#: library/socket.rst:525 -msgid ":ref:`Availability `: FreeBSD >= 14.0." -msgstr "" - -#: library/socket.rst:542 +#: library/socket.rst:583 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " "*proto* for the :const:`AF_PACKET` family in order to capture every packet, " "regardless of protocol." msgstr "" -#: library/socket.rst:546 +#: library/socket.rst:587 msgid "For more information, see the :manpage:`packet(7)` manpage." msgstr "" -#: library/socket.rst:548 -msgid ":ref:`Availability `: Linux." -msgstr "" - -#: library/socket.rst:561 -msgid ":ref:`Availability `: Linux >= 2.6.30." -msgstr "" - -#: library/socket.rst:571 +#: library/socket.rst:612 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: library/socket.rst:1563 +#: library/socket.rst:1723 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "" -#: library/socket.rst:580 +#: library/socket.rst:621 msgid "" "TIPC related constants, matching the ones exported by the C socket API. See " "the TIPC documentation for more information." msgstr "" -#: library/socket.rst:587 +#: library/socket.rst:628 msgid "Constants for Linux Kernel cryptography." msgstr "" -#: library/socket.rst:599 +#: library/socket.rst:640 msgid "Constants for Linux host/guest communication." msgstr "" -#: library/socket.rst:601 -msgid ":ref:`Availability `: Linux >= 4.8." -msgstr "" - -#: library/socket.rst:607 -msgid ":ref:`Availability `: BSD, macOS." -msgstr "" - -#: library/socket.rst:613 +#: library/socket.rst:654 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " "on this platform." msgstr "" -#: library/socket.rst:619 +#: library/socket.rst:663 +msgid "Integer constants for use with Bluetooth addresses." +msgstr "" + +#: library/socket.rst:668 msgid "" "These are string constants containing Bluetooth addresses with special " "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -#: library/socket.rst:628 +#: library/socket.rst:677 msgid "" -"For use with :const:`BTPROTO_HCI`. :const:`HCI_FILTER` is not available for " -"NetBSD or DragonFlyBSD. :const:`HCI_TIME_STAMP` and :const:`HCI_DATA_DIR` " -"are not available for FreeBSD, NetBSD, or DragonFlyBSD." +"These constants describe the Bluetooth address type when binding or " +"connecting a :const:`BTPROTO_L2CAP` socket." msgstr "" -#: library/socket.rst:635 +#: library/socket.rst:690 +msgid "" +"Used in the level argument to the :meth:`~socket.setsockopt` and :meth:" +"`~socket.getsockopt` methods of Bluetooth socket objects." +msgstr "" + +#: library/socket.rst:693 +msgid "" +":const:`SOL_BLUETOOTH` is only available on Linux. Other constants are " +"available if the corresponding protocol is supported." +msgstr "" + +#: library/socket.rst:705 +msgid "" +"Used in the option name and value argument to the :meth:`~socket.setsockopt` " +"and :meth:`~socket.getsockopt` methods of Bluetooth socket objects." +msgstr "" + +#: library/socket.rst:708 +msgid "" +":const:`!BT_*` and :const:`L2CAP_LM` are only available on Linux. :const:`!" +"SO_BTH_*` are only available on Windows. Other constants may be available on " +"Linux and various BSD platforms." +msgstr "" + +#: library/socket.rst:720 +msgid "" +"Option names for use with :const:`BTPROTO_HCI`. Availability and format of " +"the option values depend on platform." +msgstr "" + +#: library/socket.rst:723 +msgid "" +"Added :const:`!SO_HCI_EVT_FILTER` and :const:`!SO_HCI_PKT_FILTER` on NetBSD " +"and DragonFly BSD. Added :const:`!HCI_DATA_DIR` on FreeBSD, NetBSD and " +"DragonFly BSD." +msgstr "" + +#: library/socket.rst:730 +msgid "" +"The ``device_id`` value used to create an HCI socket that isn't specific to " +"a single Bluetooth adapter." +msgstr "" + +#: library/socket.rst:743 +msgid "" +"Possible values for ``channel`` field in the :const:`BTPROTO_HCI` address." +msgstr "" + +#: library/socket.rst:751 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" -#: library/socket.rst:644 +#: library/socket.rst:760 msgid "" "LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " "SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " @@ -813,48 +876,47 @@ msgid "" "message type." msgstr "" -#: library/socket.rst:653 -msgid ":ref:`Availability `: FreeBSD." -msgstr "" - -#: library/socket.rst:657 +#: library/socket.rst:773 msgid "" "Constant to optimize CPU locality, to be used in conjunction with :data:" "`SO_REUSEPORT`." msgstr "" -#: library/socket.rst:677 -msgid "Constants for Windows Hyper-V sockets for host/guest communications." +#: library/socket.rst:782 +msgid "" +"Constant to enable duplicate address and port bindings with load balancing." msgstr "" -#: library/socket.rst:886 library/socket.rst:1978 -msgid ":ref:`Availability `: Windows." +#: library/socket.rst:801 +msgid "Constants for Windows Hyper-V sockets for host/guest communications." msgstr "" -#: library/socket.rst:690 +#: library/socket.rst:814 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" -#: library/socket.rst:694 -msgid ":ref:`Availability `: Linux, FreeBSD, macOS." +#: library/socket.rst:826 +msgid "" +"These constants are used by the :meth:`~socket.socket.shutdown` method of " +"socket objects." msgstr "" -#: library/socket.rst:700 +#: library/socket.rst:831 msgid "Functions" msgstr "" -#: library/socket.rst:703 +#: library/socket.rst:834 msgid "Creating sockets" msgstr "" -#: library/socket.rst:705 +#: library/socket.rst:836 msgid "" "The following functions all create :ref:`socket objects `." msgstr "" -#: library/socket.rst:710 +#: library/socket.rst:841 msgid "" "Create a new socket using the given address family, socket type and protocol " "number. The address family should be :const:`AF_INET` (the default), :const:" @@ -867,7 +929,7 @@ msgid "" "`CAN_J1939`." msgstr "" -#: library/socket.rst:720 +#: library/socket.rst:851 msgid "" "If *fileno* is specified, the values for *family*, *type*, and *proto* are " "auto-detected from the specified file descriptor. Auto-detection can be " @@ -875,57 +937,64 @@ msgid "" "arguments. This only affects how Python represents e.g. the return value " "of :meth:`socket.getpeername` but not the actual OS resource. Unlike :func:" "`socket.fromfd`, *fileno* will return the same socket and not a duplicate. " -"This may help close a detached socket using :meth:`socket.close()`." +"This may help close a detached socket using :meth:`socket.close`." msgstr "" -#: library/socket.rst:875 library/socket.rst:1476 +#: library/socket.rst:1006 library/socket.rst:1636 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" -#: library/socket.rst:742 +#: library/socket.rst:862 msgid "" "Raises an :ref:`auditing event ` ``socket.__new__`` with arguments " "``self``, ``family``, ``type``, ``protocol``." msgstr "" -#: library/socket.rst:733 +#: library/socket.rst:864 msgid "The AF_CAN family was added. The AF_RDS family was added." msgstr "" -#: library/socket.rst:737 +#: library/socket.rst:868 msgid "The CAN_BCM protocol was added." msgstr "" -#: library/socket.rst:877 +#: library/socket.rst:1008 msgid "The returned socket is now non-inheritable." msgstr "" -#: library/socket.rst:743 +#: library/socket.rst:874 msgid "The CAN_ISOTP protocol was added." msgstr "" -#: library/socket.rst:746 +#: library/socket.rst:877 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system ``socket()`` call. Therefore," msgstr "" -#: library/socket.rst:758 +#: library/socket.rst:885 +msgid "" +"sock = socket.socket(\n" +" socket.AF_INET,\n" +" socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" +msgstr "" + +#: library/socket.rst:889 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" -#: library/socket.rst:762 +#: library/socket.rst:893 msgid "The CAN_J1939 protocol was added." msgstr "" -#: library/socket.rst:765 +#: library/socket.rst:896 msgid "The IPPROTO_MPTCP protocol was added." msgstr "" -#: library/socket.rst:770 +#: library/socket.rst:901 msgid "" "Build a pair of connected socket objects using the given address family, " "socket type, and protocol number. Address family, socket type, and protocol " @@ -934,25 +1003,25 @@ msgid "" "default is :const:`AF_INET`." msgstr "" -#: library/socket.rst:775 +#: library/socket.rst:906 msgid "The newly created sockets are :ref:`non-inheritable `." msgstr "" -#: library/socket.rst:777 +#: library/socket.rst:908 msgid "" "The returned socket objects now support the whole socket API, rather than a " "subset." msgstr "" -#: library/socket.rst:781 +#: library/socket.rst:912 msgid "The returned sockets are now non-inheritable." msgstr "" -#: library/socket.rst:784 +#: library/socket.rst:915 msgid "Windows support added." msgstr "" -#: library/socket.rst:790 +#: library/socket.rst:921 msgid "" "Connect to a TCP service listening on the internet *address* (a 2-tuple " "``(host, port)``), and return the socket object. This is a higher-level " @@ -963,21 +1032,21 @@ msgid "" "IPv4 and IPv6." msgstr "" -#: library/socket.rst:798 +#: library/socket.rst:929 msgid "" "Passing the optional *timeout* parameter will set the timeout on the socket " "instance before attempting to connect. If no *timeout* is supplied, the " "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" -#: library/socket.rst:803 +#: library/socket.rst:934 msgid "" "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the " "socket to bind to as its source address before connecting. If host or port " "are '' or 0 respectively the OS default behavior will be used." msgstr "" -#: library/socket.rst:807 +#: library/socket.rst:938 msgid "" "When a connection cannot be created, an exception is raised. By default, it " "is the exception from the last address in the list. If *all_errors* is " @@ -985,21 +1054,21 @@ msgid "" "attempts." msgstr "" -#: library/socket.rst:812 +#: library/socket.rst:943 msgid "*source_address* was added." msgstr "" -#: library/socket.rst:815 +#: library/socket.rst:946 msgid "*all_errors* was added." msgstr "" -#: library/socket.rst:821 +#: library/socket.rst:952 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and returns the socket object." msgstr "" -#: library/socket.rst:824 +#: library/socket.rst:955 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " @@ -1007,33 +1076,45 @@ msgid "" "`SO_REUSEPORT` socket option." msgstr "" -#: library/socket.rst:829 +#: library/socket.rst:960 msgid "" -"If *dualstack_ipv6* is true and the platform supports it the socket will be " -"able to accept both IPv4 and IPv6 connections, else it will raise :exc:" -"`ValueError`. Most POSIX platforms and Windows are supposed to support this " -"functionality. When this functionality is enabled the address returned by :" -"meth:`socket.getpeername` when an IPv4 connection occurs will be an IPv6 " -"address represented as an IPv4-mapped IPv6 address. If *dualstack_ipv6* is " -"false it will explicitly disable this functionality on platforms that enable " -"it by default (e.g. Linux). This parameter can be used in conjunction with :" -"func:`has_dualstack_ipv6`:" +"If *dualstack_ipv6* is true, *family* is :data:`AF_INET6` and the platform " +"supports it the socket will be able to accept both IPv4 and IPv6 " +"connections, else it will raise :exc:`ValueError`. Most POSIX platforms and " +"Windows are supposed to support this functionality. When this functionality " +"is enabled the address returned by :meth:`socket.getpeername` when an IPv4 " +"connection occurs will be an IPv6 address represented as an IPv4-mapped IPv6 " +"address. If *dualstack_ipv6* is false it will explicitly disable this " +"functionality on platforms that enable it by default (e.g. Linux). This " +"parameter can be used in conjunction with :func:`has_dualstack_ipv6`:" msgstr "" -#: library/socket.rst:851 +#: library/socket.rst:973 +msgid "" +"import socket\n" +"\n" +"addr = (\"\", 8080) # all interfaces, port 8080\n" +"if socket.has_dualstack_ipv6():\n" +" s = socket.create_server(addr, family=socket.AF_INET6, " +"dualstack_ipv6=True)\n" +"else:\n" +" s = socket.create_server(addr)" +msgstr "" + +#: library/socket.rst:982 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" -#: library/socket.rst:859 +#: library/socket.rst:990 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" -#: library/socket.rst:866 +#: library/socket.rst:997 msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " @@ -1046,34 +1127,39 @@ msgid "" "daemon). The socket is assumed to be in blocking mode." msgstr "" -#: library/socket.rst:883 +#: library/socket.rst:1014 msgid "" "Instantiate a socket from data obtained from the :meth:`socket.share` " "method. The socket is assumed to be in blocking mode." msgstr "" -#: library/socket.rst:893 +#: library/socket.rst:1024 msgid "" "This is a Python type object that represents the socket object type. It is " "the same as ``type(socket(...))``." msgstr "" -#: library/socket.rst:898 +#: library/socket.rst:1029 msgid "Other functions" msgstr "" -#: library/socket.rst:900 +#: library/socket.rst:1031 msgid "The :mod:`socket` module also offers various network-related services:" msgstr "" -#: library/socket.rst:905 +#: library/socket.rst:1036 msgid "" "Close a socket file descriptor. This is like :func:`os.close`, but for " "sockets. On some platforms (most noticeable Windows) :func:`os.close` does " "not work for socket file descriptors." msgstr "" -#: library/socket.rst:913 +#: library/socket.rst:1044 +msgid "" +"This function wraps the C function ``getaddrinfo`` of the underlying system." +msgstr "" + +#: library/socket.rst:1046 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -1083,26 +1169,31 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: library/socket.rst:920 +#: library/socket.rst:1053 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " -"order to narrow the list of addresses returned. Passing zero as a value for " -"each of these arguments selects the full range of results. The *flags* " -"argument can be one or several of the ``AI_*`` constants, and will influence " -"how results are computed and returned. For example, :const:`AI_NUMERICHOST` " -"will disable domain name resolution and will raise an error if *host* is a " -"domain name." +"order to provide options and limit the list of addresses returned. Pass " +"their default values (:data:`AF_UNSPEC`, 0, and 0, respectively) to not " +"limit the results. See the note below for details." +msgstr "" + +#: library/socket.rst:1058 +msgid "" +"The *flags* argument can be one or several of the ``AI_*`` constants, and " +"will influence how results are computed and returned. For example, :const:" +"`AI_NUMERICHOST` will disable domain name resolution and will raise an error " +"if *host* is a domain name." msgstr "" -#: library/socket.rst:928 +#: library/socket.rst:1063 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: library/socket.rst:930 +#: library/socket.rst:1065 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "" -#: library/socket.rst:932 +#: library/socket.rst:1067 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " @@ -1114,30 +1205,71 @@ msgid "" "`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." msgstr "" -#: library/socket.rst:953 +#: library/socket.rst:1079 +msgid "" +"If you intend to use results from :func:`!getaddrinfo` to create a socket " +"(rather than, for example, retrieve *canonname*), consider limiting the " +"results by *type* (e.g. :data:`SOCK_STREAM` or :data:`SOCK_DGRAM`) and/or " +"*proto* (e.g. :data:`IPPROTO_TCP` or :data:`IPPROTO_UDP`) that your " +"application can handle." +msgstr "" + +#: library/socket.rst:1085 +msgid "" +"The behavior with default values of *family*, *type*, *proto* and *flags* is " +"system-specific." +msgstr "" + +#: library/socket.rst:1088 +msgid "" +"Many systems (for example, most Linux configurations) will return a sorted " +"list of all matching addresses. These addresses should generally be tried in " +"order until a connection succeeds (possibly tried in parallel, for example, " +"using a `Happy Eyeballs`_ algorithm). In these cases, limiting the *type* " +"and/or *proto* can help eliminate unsuccessful or unusable connection " +"attempts." +msgstr "" + +#: library/socket.rst:1095 +msgid "" +"Some systems will, however, only return a single address. (For example, this " +"was reported on Solaris and AIX configurations.) On these systems, limiting " +"the *type* and/or *proto* helps ensure that this address is usable." +msgstr "" + +#: library/socket.rst:1100 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." msgstr "" -#: library/socket.rst:944 +#: library/socket.rst:1102 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: library/socket.rst:954 +#: library/socket.rst:1106 +msgid "" +">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" +"[(socket.AF_INET6, socket.SOCK_STREAM,\n" +" 6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)),\n" +" (socket.AF_INET, socket.SOCK_STREAM,\n" +" 6, '', ('93.184.216.34', 80))]" +msgstr "" + +#: library/socket.rst:1112 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: library/socket.rst:957 +#: library/socket.rst:1115 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: library/socket.rst:963 +#: library/socket.rst:1123 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1148,7 +1280,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: library/socket.rst:974 +#: library/socket.rst:1134 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -1158,19 +1290,13 @@ msgid "" "stack support." msgstr "" -#: library/socket.rst:1007 +#: library/socket.rst:1156 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." msgstr "" -#: library/socket.rst:998 library/socket.rst:1026 library/socket.rst:1054 -#: library/socket.rst:1076 library/socket.rst:1447 library/socket.rst:1481 -#: library/socket.rst:1573 library/socket.rst:1966 -msgid ":ref:`Availability `: not WASI." -msgstr "" - -#: library/socket.rst:987 +#: library/socket.rst:1147 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1182,25 +1308,25 @@ msgid "" "stack support." msgstr "" -#: library/socket.rst:1003 +#: library/socket.rst:1163 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: library/socket.rst:1017 +#: library/socket.rst:1166 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" -#: library/socket.rst:1008 +#: library/socket.rst:1168 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: library/socket.rst:1016 +#: library/socket.rst:1176 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " @@ -1211,13 +1337,13 @@ msgid "" "`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: library/socket.rst:1035 +#: library/socket.rst:1184 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." msgstr "" -#: library/socket.rst:1031 +#: library/socket.rst:1191 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1225,24 +1351,24 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: library/socket.rst:1036 +#: library/socket.rst:1196 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: library/socket.rst:1039 +#: library/socket.rst:1199 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: library/socket.rst:1052 +#: library/socket.rst:1201 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." msgstr "" -#: library/socket.rst:1048 +#: library/socket.rst:1208 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " "suitable for passing as the (optional) third argument to the :func:`~socket." @@ -1251,66 +1377,66 @@ msgid "" "is chosen automatically if the protocol is omitted or zero." msgstr "" -#: library/socket.rst:1059 +#: library/socket.rst:1219 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: library/socket.rst:1074 +#: library/socket.rst:1223 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." msgstr "" -#: library/socket.rst:1070 +#: library/socket.rst:1230 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: library/socket.rst:1085 +#: library/socket.rst:1234 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." msgstr "" -#: library/socket.rst:1081 +#: library/socket.rst:1241 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: library/socket.rst:1088 +#: library/socket.rst:1248 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: library/socket.rst:1110 +#: library/socket.rst:1270 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: library/socket.rst:1099 +#: library/socket.rst:1259 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: library/socket.rst:1106 +#: library/socket.rst:1266 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: library/socket.rst:1117 +#: library/socket.rst:1277 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1319,26 +1445,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: library/socket.rst:1123 +#: library/socket.rst:1283 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: library/socket.rst:1126 +#: library/socket.rst:1286 msgid "" "If the IPv4 address string passed to this function is invalid, :exc:" "`OSError` will be raised. Note that exactly what is valid depends on the " "underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: library/socket.rst:1130 +#: library/socket.rst:1290 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: library/socket.rst:1136 +#: library/socket.rst:1296 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1348,7 +1474,7 @@ msgid "" "argument." msgstr "" -#: library/socket.rst:1143 +#: library/socket.rst:1303 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1356,7 +1482,7 @@ msgid "" "support." msgstr "" -#: library/socket.rst:1154 +#: library/socket.rst:1314 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " @@ -1364,7 +1490,7 @@ msgid "" "`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: library/socket.rst:1159 +#: library/socket.rst:1319 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" @@ -1373,15 +1499,11 @@ msgid "" "`inet_pton`." msgstr "" -#: library/socket.rst:1185 -msgid ":ref:`Availability `: Unix, Windows." -msgstr "" - -#: library/socket.rst:1187 +#: library/socket.rst:1347 msgid "Windows support added" msgstr "" -#: library/socket.rst:1173 +#: library/socket.rst:1333 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1390,7 +1512,7 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: library/socket.rst:1180 +#: library/socket.rst:1340 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " @@ -1398,7 +1520,7 @@ msgid "" "`OSError` is raised for errors from the call to :func:`inet_ntop`." msgstr "" -#: library/socket.rst:1202 +#: library/socket.rst:1362 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " @@ -1409,15 +1531,11 @@ msgid "" "the permissible range of values." msgstr "" -#: library/socket.rst:1234 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -msgstr "" - -#: library/socket.rst:1704 library/socket.rst:1856 +#: library/socket.rst:1861 library/socket.rst:2013 msgid "Most Unix platforms." msgstr "" -#: library/socket.rst:1220 +#: library/socket.rst:1380 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1427,7 +1545,7 @@ msgid "" "values." msgstr "" -#: library/socket.rst:1228 +#: library/socket.rst:1388 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1435,140 +1553,137 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: library/socket.rst:1236 +#: library/socket.rst:1396 msgid "most Unix platforms." msgstr "" -#: library/socket.rst:1243 +#: library/socket.rst:1403 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: library/socket.rst:1250 +#: library/socket.rst:1410 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " "socket module is first imported, the default is ``None``. See :meth:" "`~socket.settimeout` for possible values and their respective meanings." msgstr "" -#: library/socket.rst:1258 +#: library/socket.rst:1418 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: library/socket.rst:1272 +#: library/socket.rst:1421 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." msgstr "" -#: library/socket.rst:1702 library/socket.rst:1746 -msgid ":ref:`Availability `: Unix." -msgstr "" - -#: library/socket.rst:1270 +#: library/socket.rst:1430 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: library/socket.rst:1301 library/socket.rst:1335 library/socket.rst:1349 -msgid "" -":ref:`Availability `: Unix, Windows, not Emscripten, not WASI." -msgstr "" - -#: library/socket.rst:1305 library/socket.rst:1322 +#: library/socket.rst:1465 library/socket.rst:1482 msgid "Windows support was added." msgstr "" -#: library/socket.rst:1283 +#: library/socket.rst:1443 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: library/socket.rst:1286 +#: library/socket.rst:1446 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "" -#: library/socket.rst:1287 +#: library/socket.rst:1447 msgid "name: ``ethernet_32770``" msgstr "" -#: library/socket.rst:1288 +#: library/socket.rst:1448 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: library/socket.rst:1289 +#: library/socket.rst:1449 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: library/socket.rst:1291 +#: library/socket.rst:1451 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: library/socket.rst:1297 +#: library/socket.rst:1457 msgid "" "Return a network interface index number corresponding to an interface name. :" "exc:`OSError` if no interface with the given name exists." msgstr "" -#: library/socket.rst:1326 +#: library/socket.rst:1486 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: library/socket.rst:1314 +#: library/socket.rst:1474 msgid "" "Return a network interface name corresponding to an interface index number. :" "exc:`OSError` if no interface with the given index exists." msgstr "" -#: library/socket.rst:1331 +#: library/socket.rst:1491 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " "*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" "`~socket.sendmsg` for the documentation of these parameters." msgstr "" -#: library/socket.rst:1351 +#: library/socket.rst:1497 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: library/socket.rst:1345 +#: library/socket.rst:1505 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " "*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." "recvmsg` for the documentation of these parameters." msgstr "" -#: library/socket.rst:1358 +#: library/socket.rst:1511 +msgid "" +"Unix platforms supporting :meth:`~socket.recvmsg` and :const:`SCM_RIGHTS` " +"mechanism." +msgstr "" + +#: library/socket.rst:1518 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: library/socket.rst:1364 +#: library/socket.rst:1524 msgid "Socket Objects" msgstr "" -#: library/socket.rst:1366 +#: library/socket.rst:1526 msgid "" "Socket objects have the following methods. Except for :meth:`~socket." "makefile`, these correspond to Unix system calls applicable to sockets." msgstr "" -#: library/socket.rst:1370 +#: library/socket.rst:1530 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: library/socket.rst:1377 +#: library/socket.rst:1537 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1577,67 +1692,66 @@ msgid "" "connection." msgstr "" -#: library/socket.rst:1478 +#: library/socket.rst:1638 msgid "The socket is now non-inheritable." msgstr "" -#: library/socket.rst:1617 library/socket.rst:1708 library/socket.rst:1800 -#: library/socket.rst:1862 +#: library/socket.rst:1774 library/socket.rst:1865 library/socket.rst:1957 +#: library/socket.rst:2019 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the method now retries the system call instead of raising an :exc:" "`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: library/socket.rst:1395 +#: library/socket.rst:1555 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: library/socket.rst:1409 +#: library/socket.rst:1558 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." msgstr "" -#: library/socket.rst:1405 +#: library/socket.rst:1565 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " -"descriptor) is also closed when all file objects from :meth:`makefile()` are " +"descriptor) is also closed when all file objects from :meth:`makefile` are " "closed. Once that happens, all future operations on the socket object will " "fail. The remote end will receive no more data (after queued data is " "flushed)." msgstr "" -#: library/socket.rst:1411 +#: library/socket.rst:1571 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: library/socket.rst:1415 +#: library/socket.rst:1575 msgid "" ":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" "`close` call is made." msgstr "" -#: library/socket.rst:1421 +#: library/socket.rst:1581 msgid "" -":meth:`close()` releases the resource associated with a connection but does " +":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " -"connection in a timely fashion, call :meth:`shutdown()` before :meth:" -"`close()`." +"connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" -#: library/socket.rst:1429 +#: library/socket.rst:1589 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: library/socket.rst:1432 +#: library/socket.rst:1592 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " @@ -1647,13 +1761,13 @@ msgid "" "(or the exception raised by the signal handler)." msgstr "" -#: library/socket.rst:1470 +#: library/socket.rst:1619 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." msgstr "" -#: library/socket.rst:1441 +#: library/socket.rst:1601 msgid "" "The method now waits until the connection completes instead of raising an :" "exc:`InterruptedError` exception if the connection is interrupted by a " @@ -1661,7 +1775,7 @@ msgid "" "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: library/socket.rst:1452 +#: library/socket.rst:1612 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1671,38 +1785,38 @@ msgid "" "asynchronous connects." msgstr "" -#: library/socket.rst:1465 +#: library/socket.rst:1625 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: library/socket.rst:1474 +#: library/socket.rst:1634 msgid "Duplicate the socket." msgstr "" -#: library/socket.rst:1486 +#: library/socket.rst:1646 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: library/socket.rst:1489 +#: library/socket.rst:1649 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: library/socket.rst:1495 +#: library/socket.rst:1655 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: library/socket.rst:1504 +#: library/socket.rst:1664 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1710,14 +1824,14 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: library/socket.rst:1512 +#: library/socket.rst:1672 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: library/socket.rst:1519 +#: library/socket.rst:1679 msgid "" "Return the value of the given socket option (see the Unix man page :manpage:" "`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. `_ for more information." msgstr "" -#: library/socket.rst:1557 +#: library/socket.rst:1715 msgid "" "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` " "functions may be used; they accept a socket object as their first argument." msgstr "" -#: library/socket.rst:1560 +#: library/socket.rst:1718 msgid "" "Currently only the following control codes are supported: ``SIO_RCVALL``, " "``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``." msgstr "" -#: library/socket.rst:1568 +#: library/socket.rst:1729 msgid "" "Enable a server to accept connections. If *backlog* is specified, it must " "be at least 0 (if it is lower, it is set to 0); it specifies the number of " @@ -1781,41 +1887,41 @@ msgid "" "connections. If not specified, a default reasonable value is chosen." msgstr "" -#: library/socket.rst:1575 +#: library/socket.rst:1736 msgid "The *backlog* parameter is now optional." msgstr "" -#: library/socket.rst:1584 +#: library/socket.rst:1745 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " "are interpreted the same way as by the built-in :func:`open` function, " -"except the only supported *mode* values are ``'r'`` (default), ``'w'`` and " -"``'b'``." +"except the only supported *mode* values are ``'r'`` (default), ``'w'``, " +"``'b'``, or a combination of those." msgstr "" -#: library/socket.rst:1589 +#: library/socket.rst:1751 msgid "" "The socket must be in blocking mode; it can have a timeout, but the file " "object's internal buffer may end up in an inconsistent state if a timeout " "occurs." msgstr "" -#: library/socket.rst:1593 +#: library/socket.rst:1755 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " "original socket unless all other file objects have been closed and :meth:" "`socket.close` has been called on the socket object." msgstr "" -#: library/socket.rst:1599 +#: library/socket.rst:1761 msgid "" "On Windows, the file-like object created by :meth:`makefile` cannot be used " "where a file object with a file descriptor is expected, such as the stream " "arguments of :meth:`subprocess.Popen`." msgstr "" -#: library/socket.rst:1606 +#: library/socket.rst:1768 msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " @@ -1825,13 +1931,7 @@ msgid "" "zero." msgstr "" -#: library/socket.rst:1614 -msgid "" -"For best match with hardware and network realities, the value of *bufsize* " -"should be a relatively small power of 2, for example, 4096." -msgstr "" - -#: library/socket.rst:1625 +#: library/socket.rst:1782 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1841,14 +1941,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: library/socket.rst:1636 +#: library/socket.rst:1793 msgid "" "For multicast IPv6 address, first item of *address* does not contain " "``%scope_id`` part anymore. In order to get full IPv6 address use :func:" "`getnameinfo`." msgstr "" -#: library/socket.rst:1643 +#: library/socket.rst:1800 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1859,7 +1959,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: library/socket.rst:1653 +#: library/socket.rst:1810 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1874,7 +1974,7 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: library/socket.rst:1667 +#: library/socket.rst:1824 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " @@ -1887,7 +1987,7 @@ msgid "" "descriptors received via this mechanism." msgstr "" -#: library/socket.rst:1678 +#: library/socket.rst:1835 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " @@ -1896,7 +1996,7 @@ msgid "" "provided it has not been truncated before the start of its associated data." msgstr "" -#: library/socket.rst:1685 +#: library/socket.rst:1842 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " @@ -1905,7 +2005,24 @@ msgid "" "meth:`sendmsg`. ::" msgstr "" -#: library/socket.rst:1716 +#: library/socket.rst:1848 +msgid "" +"import socket, array\n" +"\n" +"def recv_fds(sock, msglen, maxfds):\n" +" fds = array.array(\"i\") # Array of ints\n" +" msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds " +"* fds.itemsize))\n" +" for cmsg_level, cmsg_type, cmsg_data in ancdata:\n" +" if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket." +"SCM_RIGHTS:\n" +" # Append data, ignoring any truncated integers at the end.\n" +" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds." +"itemsize)])\n" +" return msg, list(fds)" +msgstr "" + +#: library/socket.rst:1873 msgid "" "Receive normal data and ancillary data from the socket, behaving as :meth:" "`recvmsg` would, but scatter the non-ancillary data into a series of buffers " @@ -1918,7 +2035,7 @@ msgid "" "arguments have the same meaning as for :meth:`recvmsg`." msgstr "" -#: library/socket.rst:1727 +#: library/socket.rst:1884 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -1926,11 +2043,26 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: library/socket.rst:1732 +#: library/socket.rst:1889 msgid "Example::" msgstr "" -#: library/socket.rst:1755 +#: library/socket.rst:1891 +msgid "" +">>> import socket\n" +">>> s1, s2 = socket.socketpair()\n" +">>> b1 = bytearray(b'----')\n" +">>> b2 = bytearray(b'0123456789')\n" +">>> b3 = bytearray(b'--------------')\n" +">>> s1.send(b'Mary had a little lamb')\n" +"22\n" +">>> s2.recvmsg_into([b1, memoryview(b2)[2:9], b3])\n" +"(22, [], 0, None)\n" +">>> [b1, b2, b3]\n" +"[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" +msgstr "" + +#: library/socket.rst:1912 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -1940,7 +2072,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: library/socket.rst:1765 +#: library/socket.rst:1922 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -1949,7 +2081,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: library/socket.rst:1774 +#: library/socket.rst:1931 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -1959,7 +2091,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: library/socket.rst:1789 +#: library/socket.rst:1946 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -1969,13 +2101,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: library/socket.rst:1796 +#: library/socket.rst:1953 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: library/socket.rst:1809 +#: library/socket.rst:1966 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -1984,13 +2116,13 @@ msgid "" "address family --- see above.)" msgstr "" -#: library/socket.rst:1826 +#: library/socket.rst:1972 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." msgstr "" -#: library/socket.rst:1825 +#: library/socket.rst:1982 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " @@ -2010,31 +2142,36 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: library/socket.rst:1845 +#: library/socket.rst:2002 msgid "" "The following function sends the list of file descriptors *fds* over an :" "const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: library/socket.rst:1854 -msgid ":ref:`Availability `: Unix, not WASI." +#: library/socket.rst:2006 +msgid "" +"import socket, array\n" +"\n" +"def send_fds(sock, msg, fds):\n" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." +"array(\"i\", fds))])" msgstr "" -#: library/socket.rst:1869 +#: library/socket.rst:2015 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." msgstr "" -#: library/socket.rst:1869 +#: library/socket.rst:2026 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: library/socket.rst:1878 +#: library/socket.rst:2035 msgid "" "Send a file until EOF is reached by using high-performance :mod:`os." "sendfile` and return the total number of bytes which were sent. *file* must " @@ -2048,60 +2185,60 @@ msgid "" "be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." msgstr "" -#: library/socket.rst:1894 +#: library/socket.rst:2051 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: library/socket.rst:1902 +#: library/socket.rst:2059 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: library/socket.rst:1905 +#: library/socket.rst:2062 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: library/socket.rst:1907 +#: library/socket.rst:2064 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "" -#: library/socket.rst:1909 +#: library/socket.rst:2066 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "" -#: library/socket.rst:1911 +#: library/socket.rst:2068 msgid "" "The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: library/socket.rst:1918 +#: library/socket.rst:2075 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " -"nonnegative floating point number expressing seconds, or ``None``. If a non-" +"nonnegative floating-point number expressing seconds, or ``None``. If a non-" "zero value is given, subsequent socket operations will raise a :exc:" "`timeout` exception if the timeout period *value* has elapsed before the " "operation has completed. If zero is given, the socket is put in non-" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: library/socket.rst:1925 +#: library/socket.rst:2082 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: library/socket.rst:1927 +#: library/socket.rst:2084 msgid "" "The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: library/socket.rst:1940 +#: library/socket.rst:2094 msgid "" "Set the value of the given socket option (see the Unix manual page :manpage:" "`setsockopt(2)`). The needed symbolic constants are defined in this module " @@ -2114,11 +2251,11 @@ msgid "" "C function with ``optval=NULL`` and ``optlen=optlen``." msgstr "" -#: library/socket.rst:1953 +#: library/socket.rst:2107 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: library/socket.rst:1961 +#: library/socket.rst:2115 msgid "" "Shut down one or both halves of the connection. If *how* is :const:" "`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " @@ -2126,7 +2263,7 @@ msgid "" "and receives are disallowed." msgstr "" -#: library/socket.rst:1971 +#: library/socket.rst:2125 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " @@ -2137,48 +2274,48 @@ msgid "" "process." msgstr "" -#: library/socket.rst:1983 +#: library/socket.rst:2137 msgid "" "Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" "`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." msgstr "" -#: library/socket.rst:1986 +#: library/socket.rst:2140 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: library/socket.rst:1992 +#: library/socket.rst:2146 msgid "The socket family." msgstr "" -#: library/socket.rst:1997 +#: library/socket.rst:2151 msgid "The socket type." msgstr "" -#: library/socket.rst:2002 +#: library/socket.rst:2156 msgid "The socket protocol." msgstr "" -#: library/socket.rst:2009 +#: library/socket.rst:2163 msgid "Notes on socket timeouts" msgstr "" -#: library/socket.rst:2011 +#: library/socket.rst:2165 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: library/socket.rst:2015 +#: library/socket.rst:2169 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: library/socket.rst:2018 +#: library/socket.rst:2172 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2186,27 +2323,27 @@ msgid "" "available for reading or writing." msgstr "" -#: library/socket.rst:2023 +#: library/socket.rst:2177 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: library/socket.rst:2028 +#: library/socket.rst:2182 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " "between file descriptors and socket objects that refer to the same network " "endpoint. This implementation detail can have visible consequences if e.g. " -"you decide to use the :meth:`~socket.fileno()` of a socket." +"you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: library/socket.rst:2035 +#: library/socket.rst:2189 msgid "Timeouts and the ``connect`` method" msgstr "" -#: library/socket.rst:2037 +#: library/socket.rst:2191 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " @@ -2216,24 +2353,24 @@ msgid "" "setting." msgstr "" -#: library/socket.rst:2045 +#: library/socket.rst:2199 msgid "Timeouts and the ``accept`` method" msgstr "" -#: library/socket.rst:2047 +#: library/socket.rst:2201 msgid "" "If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" "meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " "depends on settings of the listening socket:" msgstr "" -#: library/socket.rst:2051 +#: library/socket.rst:2205 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: library/socket.rst:2054 +#: library/socket.rst:2208 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2241,11 +2378,11 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: library/socket.rst:2063 +#: library/socket.rst:2217 msgid "Example" msgstr "" -#: library/socket.rst:2065 +#: library/socket.rst:2219 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " @@ -2258,11 +2395,44 @@ msgid "" "on the new socket returned by :meth:`~socket.accept`." msgstr "" -#: library/socket.rst:2075 +#: library/socket.rst:2229 msgid "The first two examples support IPv4 only. ::" msgstr "" -#: library/socket.rst:2106 +#: library/socket.rst:2231 +msgid "" +"# Echo server program\n" +"import socket\n" +"\n" +"HOST = '' # Symbolic name meaning all available interfaces\n" +"PORT = 50007 # Arbitrary non-privileged port\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n" +" s.bind((HOST, PORT))\n" +" s.listen(1)\n" +" conn, addr = s.accept()\n" +" with conn:\n" +" print('Connected by', addr)\n" +" while True:\n" +" data = conn.recv(1024)\n" +" if not data: break\n" +" conn.sendall(data)" +msgstr "" + +#: library/socket.rst:2249 +msgid "" +"# Echo client program\n" +"import socket\n" +"\n" +"HOST = 'daring.cwi.nl' # The remote host\n" +"PORT = 50007 # The same port as used by the server\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n" +" s.connect((HOST, PORT))\n" +" s.sendall(b'Hello, world')\n" +" data = s.recv(1024)\n" +"print('Received', repr(data))" +msgstr "" + +#: library/socket.rst:2260 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2272,73 +2442,224 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: library/socket.rst:2178 +#: library/socket.rst:2267 +msgid "" +"# Echo server program\n" +"import socket\n" +"import sys\n" +"\n" +"HOST = None # Symbolic name meaning all available interfaces\n" +"PORT = 50007 # Arbitrary non-privileged port\n" +"s = None\n" +"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,\n" +" socket.SOCK_STREAM, 0, socket.AI_PASSIVE):\n" +" af, socktype, proto, canonname, sa = res\n" +" try:\n" +" s = socket.socket(af, socktype, proto)\n" +" except OSError as msg:\n" +" s = None\n" +" continue\n" +" try:\n" +" s.bind(sa)\n" +" s.listen(1)\n" +" except OSError as msg:\n" +" s.close()\n" +" s = None\n" +" continue\n" +" break\n" +"if s is None:\n" +" print('could not open socket')\n" +" sys.exit(1)\n" +"conn, addr = s.accept()\n" +"with conn:\n" +" print('Connected by', addr)\n" +" while True:\n" +" data = conn.recv(1024)\n" +" if not data: break\n" +" conn.send(data)" +msgstr "" + +#: library/socket.rst:2303 +msgid "" +"# Echo client program\n" +"import socket\n" +"import sys\n" +"\n" +"HOST = 'daring.cwi.nl' # The remote host\n" +"PORT = 50007 # The same port as used by the server\n" +"s = None\n" +"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket." +"SOCK_STREAM):\n" +" af, socktype, proto, canonname, sa = res\n" +" try:\n" +" s = socket.socket(af, socktype, proto)\n" +" except OSError as msg:\n" +" s = None\n" +" continue\n" +" try:\n" +" s.connect(sa)\n" +" except OSError as msg:\n" +" s.close()\n" +" s = None\n" +" continue\n" +" break\n" +"if s is None:\n" +" print('could not open socket')\n" +" sys.exit(1)\n" +"with s:\n" +" s.sendall(b'Hello, world')\n" +" data = s.recv(1024)\n" +"print('Received', repr(data))" +msgstr "" + +#: library/socket.rst:2332 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: library/socket.rst:2203 +#: library/socket.rst:2336 +msgid "" +"import socket\n" +"\n" +"# the public network interface\n" +"HOST = socket.gethostbyname(socket.gethostname())\n" +"\n" +"# create a raw socket and bind it to the public interface\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)\n" +"s.bind((HOST, 0))\n" +"\n" +"# Include IP headers\n" +"s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)\n" +"\n" +"# receive all packets\n" +"s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)\n" +"\n" +"# receive a packet\n" +"print(s.recvfrom(65565))\n" +"\n" +"# disabled promiscuous mode\n" +"s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" +msgstr "" + +#: library/socket.rst:2357 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: library/socket.rst:2209 +#: library/socket.rst:2361 +msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" +msgstr "" + +#: library/socket.rst:2363 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: library/socket.rst:2213 +#: library/socket.rst:2367 msgid "This last example might require special privileges::" msgstr "" -#: library/socket.rst:2253 +#: library/socket.rst:2369 +msgid "" +"import socket\n" +"import struct\n" +"\n" +"\n" +"# CAN frame packing/unpacking (see 'struct can_frame' in )\n" +"\n" +"can_frame_fmt = \"=IB3x8s\"\n" +"can_frame_size = struct.calcsize(can_frame_fmt)\n" +"\n" +"def build_can_frame(can_id, data):\n" +" can_dlc = len(data)\n" +" data = data.ljust(8, b'\\x00')\n" +" return struct.pack(can_frame_fmt, can_id, can_dlc, data)\n" +"\n" +"def dissect_can_frame(frame):\n" +" can_id, can_dlc, data = struct.unpack(can_frame_fmt, frame)\n" +" return (can_id, can_dlc, data[:can_dlc])\n" +"\n" +"\n" +"# create a raw socket and bind it to the 'vcan0' interface\n" +"s = socket.socket(socket.AF_CAN, socket.SOCK_RAW, socket.CAN_RAW)\n" +"s.bind(('vcan0',))\n" +"\n" +"while True:\n" +" cf, addr = s.recvfrom(can_frame_size)\n" +"\n" +" print('Received: can_id=%x, can_dlc=%x, data=%s' % " +"dissect_can_frame(cf))\n" +"\n" +" try:\n" +" s.send(cf)\n" +" except OSError:\n" +" print('Error sending CAN frame')\n" +"\n" +" try:\n" +" s.send(build_can_frame(0x01, b'\\x01\\x02\\x03'))\n" +" except OSError:\n" +" print('Error sending CAN frame')" +msgstr "" + +#: library/socket.rst:2407 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: library/socket.rst:2258 +#: library/socket.rst:2410 +msgid "OSError: [Errno 98] Address already in use" +msgstr "" + +#: library/socket.rst:2412 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: library/socket.rst:2261 +#: library/socket.rst:2415 msgid "" "There is a :mod:`socket` flag to set, in order to prevent this, :const:" "`socket.SO_REUSEADDR`::" msgstr "" -#: library/socket.rst:2268 +#: library/socket.rst:2418 +msgid "" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" +"s.bind((HOST, PORT))" +msgstr "" + +#: library/socket.rst:2422 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: library/socket.rst:2274 +#: library/socket.rst:2428 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: library/socket.rst:2276 +#: library/socket.rst:2430 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: library/socket.rst:2278 +#: library/socket.rst:2432 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: library/socket.rst:2281 +#: library/socket.rst:2435 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2357,18 +2678,18 @@ msgstr "" msgid "socket" msgstr "" -#: library/socket.rst:1582 +#: library/socket.rst:1743 msgid "I/O control" msgstr "" -#: library/socket.rst:1582 +#: library/socket.rst:1743 msgid "buffering" msgstr "" -#: library/socket.rst:1938 +#: library/socket.rst:2092 msgid "module" msgstr "" -#: library/socket.rst:1938 +#: library/socket.rst:2092 msgid "struct" msgstr "" diff --git a/library/socketserver.po b/library/socketserver.po index e9407e89..d5715ab7 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/socketserver.rst:2 -msgid ":mod:`socketserver` --- A framework for network servers" +msgid ":mod:`!socketserver` --- A framework for network servers" msgstr "" #: library/socketserver.rst:7 @@ -31,14 +32,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/socketserver.rst:15 @@ -121,6 +121,23 @@ msgid "" "synchronous servers of four types::" msgstr "" +#: library/socketserver.rst:83 +msgid "" +"+------------+\n" +"| BaseServer |\n" +"+------------+\n" +" |\n" +" v\n" +"+-----------+ +------------------+\n" +"| TCPServer |------->| UnixStreamServer |\n" +"+-----------+ +------------------+\n" +" |\n" +" v\n" +"+-----------+ +--------------------+\n" +"| UDPServer |------->| UnixDatagramServer |\n" +"+-----------+ +--------------------+" +msgstr "" + #: library/socketserver.rst:97 msgid "" "Note that :class:`UnixDatagramServer` derives from :class:`UDPServer`, not " @@ -135,6 +152,12 @@ msgid "" "as follows::" msgstr "" +#: library/socketserver.rst:109 +msgid "" +"class ThreadingUDPServer(ThreadingMixIn, UDPServer):\n" +" pass" +msgstr "" + #: library/socketserver.rst:112 msgid "" "The mix-in class comes first, since it overrides a method defined in :class:" @@ -164,12 +187,19 @@ msgstr "" #: library/socketserver.rst:131 msgid "" +"Specify how many child processes will exist to handle requests at a time " +"for :class:`ForkingMixIn`. If the limit is reached, new requests will wait " +"until one child process has finished." +msgstr "" + +#: library/socketserver.rst:137 +msgid "" "For :class:`ThreadingMixIn` use daemonic threads by setting :data:" "`ThreadingMixIn.daemon_threads ` to ``True`` to not wait " "until threads complete." msgstr "" -#: library/socketserver.rst:137 +#: library/socketserver.rst:143 msgid "" ":meth:`ForkingMixIn.server_close ` and :meth:" "`ThreadingMixIn.server_close ` now waits until all " @@ -178,17 +208,17 @@ msgid "" "the pre-3.7 behaviour." msgstr "" -#: library/socketserver.rst:153 +#: library/socketserver.rst:159 msgid "These classes are pre-defined using the mix-in classes." msgstr "" -#: library/socketserver.rst:155 +#: library/socketserver.rst:161 msgid "" "The ``ForkingUnixStreamServer`` and ``ForkingUnixDatagramServer`` classes " "were added." msgstr "" -#: library/socketserver.rst:159 +#: library/socketserver.rst:165 msgid "" "To implement a service, you must derive a class from :class:" "`BaseRequestHandler` and redefine its :meth:`~BaseRequestHandler.handle` " @@ -199,7 +229,7 @@ msgid "" "`DatagramRequestHandler`." msgstr "" -#: library/socketserver.rst:167 +#: library/socketserver.rst:173 msgid "" "Of course, you still have to use your head! For instance, it makes no sense " "to use a forking server if the service contains state in memory that can be " @@ -209,7 +239,7 @@ msgid "" "probably have to use locks to protect the integrity of the shared data." msgstr "" -#: library/socketserver.rst:174 +#: library/socketserver.rst:180 msgid "" "On the other hand, if you are building an HTTP server where all data is " "stored externally (for instance, in the file system), a synchronous class " @@ -219,7 +249,7 @@ msgid "" "appropriate." msgstr "" -#: library/socketserver.rst:180 +#: library/socketserver.rst:186 msgid "" "In some cases, it may be appropriate to process part of a request " "synchronously, but to finish processing in a forked child depending on the " @@ -228,7 +258,7 @@ msgid "" "`~BaseRequestHandler.handle` method." msgstr "" -#: library/socketserver.rst:185 +#: library/socketserver.rst:191 msgid "" "Another approach to handling multiple simultaneous requests in an " "environment that supports neither threads nor :func:`~os.fork` (or where " @@ -240,11 +270,11 @@ msgid "" "subprocesses cannot be used)." msgstr "" -#: library/socketserver.rst:198 +#: library/socketserver.rst:204 msgid "Server Objects" msgstr "" -#: library/socketserver.rst:202 +#: library/socketserver.rst:208 msgid "" "This is the superclass of all Server objects in the module. It defines the " "interface, given below, but does not implement most of the methods, which is " @@ -252,14 +282,14 @@ msgid "" "`server_address` and :attr:`RequestHandlerClass` attributes." msgstr "" -#: library/socketserver.rst:210 +#: library/socketserver.rst:216 msgid "" "Return an integer file descriptor for the socket on which the server is " "listening. This function is most commonly passed to :mod:`selectors`, to " "allow monitoring multiple servers in the same process." msgstr "" -#: library/socketserver.rst:217 +#: library/socketserver.rst:223 msgid "" "Process a single request. This function calls the following methods in " "order: :meth:`get_request`, :meth:`verify_request`, and :meth:" @@ -270,7 +300,7 @@ msgid "" "`handle_request` will return." msgstr "" -#: library/socketserver.rst:229 +#: library/socketserver.rst:235 msgid "" "Handle requests until an explicit :meth:`shutdown` request. Poll for " "shutdown every *poll_interval* seconds. Ignores the :attr:`timeout` " @@ -280,41 +310,44 @@ msgid "" "clean up zombie child processes." msgstr "" -#: library/socketserver.rst:237 +#: library/socketserver.rst:243 msgid "Added ``service_actions`` call to the ``serve_forever`` method." msgstr "" -#: library/socketserver.rst:243 +#: library/socketserver.rst:249 msgid "" "This is called in the :meth:`serve_forever` loop. This method can be " "overridden by subclasses or mixin classes to perform actions specific to a " "given service, such as cleanup actions." msgstr "" -#: library/socketserver.rst:251 +#: library/socketserver.rst:257 msgid "" "Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:" "`shutdown` must be called while :meth:`serve_forever` is running in a " "different thread otherwise it will deadlock." msgstr "" -#: library/socketserver.rst:258 +#: library/socketserver.rst:264 msgid "Clean up the server. May be overridden." msgstr "" -#: library/socketserver.rst:263 +#: library/socketserver.rst:269 msgid "" -"The family of protocols to which the server's socket belongs. Common " -"examples are :const:`socket.AF_INET` and :const:`socket.AF_UNIX`." +"The family of protocols to which the server's socket belongs. Common " +"examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and :const:" +"`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this module " +"with class attribute ``address_family = AF_INET6`` set if you want IPv6 " +"server classes." msgstr "" -#: library/socketserver.rst:269 +#: library/socketserver.rst:278 msgid "" "The user-provided request handler class; an instance of this class is " "created for each request." msgstr "" -#: library/socketserver.rst:275 +#: library/socketserver.rst:284 msgid "" "The address on which the server is listening. The format of addresses " "varies depending on the protocol family; see the documentation for the :mod:" @@ -323,22 +356,22 @@ msgid "" "``('127.0.0.1', 80)``, for example." msgstr "" -#: library/socketserver.rst:284 +#: library/socketserver.rst:293 msgid "" "The socket object on which the server will listen for incoming requests." msgstr "" -#: library/socketserver.rst:287 +#: library/socketserver.rst:296 msgid "The server classes support the following class variables:" msgstr "" -#: library/socketserver.rst:293 +#: library/socketserver.rst:302 msgid "" "Whether the server will allow the reuse of an address. This defaults to :" "const:`False`, and can be set in subclasses to change the policy." msgstr "" -#: library/socketserver.rst:299 +#: library/socketserver.rst:308 msgid "" "The size of the request queue. If it takes a long time to process a single " "request, any requests that arrive while the server is busy are placed into a " @@ -347,40 +380,40 @@ msgid "" "default value is usually 5, but this can be overridden by subclasses." msgstr "" -#: library/socketserver.rst:308 +#: library/socketserver.rst:317 msgid "" "The type of socket used by the server; :const:`socket.SOCK_STREAM` and :" "const:`socket.SOCK_DGRAM` are two common values." msgstr "" -#: library/socketserver.rst:314 +#: library/socketserver.rst:323 msgid "" "Timeout duration, measured in seconds, or :const:`None` if no timeout is " "desired. If :meth:`handle_request` receives no incoming requests within the " "timeout period, the :meth:`handle_timeout` method is called." msgstr "" -#: library/socketserver.rst:319 +#: library/socketserver.rst:328 msgid "" "There are various server methods that can be overridden by subclasses of " "base server classes like :class:`TCPServer`; these methods aren't useful to " "external users of the server object." msgstr "" -#: library/socketserver.rst:328 +#: library/socketserver.rst:337 msgid "" "Actually processes the request by instantiating :attr:`RequestHandlerClass` " "and calling its :meth:`~BaseRequestHandler.handle` method." msgstr "" -#: library/socketserver.rst:334 +#: library/socketserver.rst:343 msgid "" "Must accept a request from the socket, and return a 2-tuple containing the " "*new* socket object to be used to communicate with the client, and the " "client's address." msgstr "" -#: library/socketserver.rst:341 +#: library/socketserver.rst:350 msgid "" "This function is called if the :meth:`~BaseRequestHandler.handle` method of " "a :attr:`RequestHandlerClass` instance raises an exception. The default " @@ -388,11 +421,11 @@ msgid "" "further requests." msgstr "" -#: library/socketserver.rst:346 +#: library/socketserver.rst:355 msgid "Now only called for exceptions derived from the :exc:`Exception` class." msgstr "" -#: library/socketserver.rst:353 +#: library/socketserver.rst:362 msgid "" "This function is called when the :attr:`timeout` attribute has been set to a " "value other than :const:`None` and the timeout period has passed with no " @@ -401,7 +434,7 @@ msgid "" "threading servers this method does nothing." msgstr "" -#: library/socketserver.rst:362 +#: library/socketserver.rst:371 msgid "" "Calls :meth:`finish_request` to create an instance of the :attr:" "`RequestHandlerClass`. If desired, this function can create a new process " @@ -409,20 +442,20 @@ msgid "" "`ThreadingMixIn` classes do this." msgstr "" -#: library/socketserver.rst:374 +#: library/socketserver.rst:383 msgid "" "Called by the server's constructor to activate the server. The default " "behavior for a TCP server just invokes :meth:`~socket.socket.listen` on the " "server's socket. May be overridden." msgstr "" -#: library/socketserver.rst:381 +#: library/socketserver.rst:390 msgid "" "Called by the server's constructor to bind the socket to the desired " "address. May be overridden." msgstr "" -#: library/socketserver.rst:387 +#: library/socketserver.rst:396 msgid "" "Must return a Boolean value; if the value is :const:`True`, the request will " "be processed, and if it's :const:`False`, the request will be denied. This " @@ -430,17 +463,17 @@ msgid "" "default implementation always returns :const:`True`." msgstr "" -#: library/socketserver.rst:393 +#: library/socketserver.rst:402 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`server_close`." msgstr "" -#: library/socketserver.rst:399 +#: library/socketserver.rst:408 msgid "Request Handler Objects" msgstr "" -#: library/socketserver.rst:403 +#: library/socketserver.rst:412 msgid "" "This is the superclass of all request handler objects. It defines the " "interface, given below. A concrete request handler subclass must define a " @@ -448,13 +481,13 @@ msgid "" "instance of the subclass is created for each request." msgstr "" -#: library/socketserver.rst:412 +#: library/socketserver.rst:421 msgid "" "Called before the :meth:`handle` method to perform any initialization " "actions required. The default implementation does nothing." msgstr "" -#: library/socketserver.rst:418 +#: library/socketserver.rst:427 msgid "" "This function must do all the work required to service a request. The " "default implementation does nothing. Several instance attributes are " @@ -463,128 +496,327 @@ msgid "" "`server`, in case it needs access to per-server information." msgstr "" -#: library/socketserver.rst:424 +#: library/socketserver.rst:433 msgid "" "The type of :attr:`request` is different for datagram or stream services. " "For stream services, :attr:`request` is a socket object; for datagram " "services, :attr:`request` is a pair of string and socket." msgstr "" -#: library/socketserver.rst:431 +#: library/socketserver.rst:440 msgid "" "Called after the :meth:`handle` method to perform any clean-up actions " "required. The default implementation does nothing. If :meth:`setup` raises " "an exception, this function will not be called." msgstr "" -#: library/socketserver.rst:438 +#: library/socketserver.rst:447 msgid "" "The *new* :class:`socket.socket` object to be used to communicate with the " "client." msgstr "" -#: library/socketserver.rst:444 +#: library/socketserver.rst:453 msgid "Client address returned by :meth:`BaseServer.get_request`." msgstr "" -#: library/socketserver.rst:449 +#: library/socketserver.rst:458 msgid ":class:`BaseServer` object used for handling the request." msgstr "" -#: library/socketserver.rst:455 +#: library/socketserver.rst:464 msgid "" "These :class:`BaseRequestHandler` subclasses override the :meth:" "`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` methods, " "and provide :attr:`rfile` and :attr:`wfile` attributes." msgstr "" -#: library/socketserver.rst:461 +#: library/socketserver.rst:470 msgid "" "A file object from which receives the request is read. Support the :class:" "`io.BufferedIOBase` readable interface." msgstr "" -#: library/socketserver.rst:466 +#: library/socketserver.rst:475 msgid "" "A file object to which the reply is written. Support the :class:`io." "BufferedIOBase` writable interface" msgstr "" -#: library/socketserver.rst:470 +#: library/socketserver.rst:479 msgid "" ":attr:`wfile` also supports the :class:`io.BufferedIOBase` writable " "interface." msgstr "" -#: library/socketserver.rst:476 +#: library/socketserver.rst:485 msgid "Examples" msgstr "" -#: library/socketserver.rst:479 +#: library/socketserver.rst:488 msgid ":class:`socketserver.TCPServer` Example" msgstr "" -#: library/socketserver.rst:581 +#: library/socketserver.rst:601 msgid "This is the server side::" msgstr "" -#: library/socketserver.rst:511 +#: library/socketserver.rst:492 +msgid "" +"import socketserver\n" +"\n" +"class MyTCPHandler(socketserver.BaseRequestHandler):\n" +" \"\"\"\n" +" The request handler class for our server.\n" +"\n" +" It is instantiated once per connection to the server, and must\n" +" override the handle() method to implement communication to the\n" +" client.\n" +" \"\"\"\n" +"\n" +" def handle(self):\n" +" # self.request is the TCP socket connected to the client\n" +" pieces = [b'']\n" +" total = 0\n" +" while b'\\n' not in pieces[-1] and total < 10_000:\n" +" pieces.append(self.request.recv(2000))\n" +" total += len(pieces[-1])\n" +" self.data = b''.join(pieces)\n" +" print(f\"Received from {self.client_address[0]}:\")\n" +" print(self.data.decode(\"utf-8\"))\n" +" # just send back the same data, but upper-cased\n" +" self.request.sendall(self.data.upper())\n" +" # after we return, the socket will be closed.\n" +"\n" +"if __name__ == \"__main__\":\n" +" HOST, PORT = \"localhost\", 9999\n" +"\n" +" # Create the server, binding to localhost on port 9999\n" +" with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:\n" +" # Activate the server; this will keep running until you\n" +" # interrupt the program with Ctrl-C\n" +" server.serve_forever()" +msgstr "" + +#: library/socketserver.rst:526 msgid "" "An alternative request handler class that makes use of streams (file-like " "objects that simplify communication by providing the standard file " "interface)::" msgstr "" -#: library/socketserver.rst:526 +#: library/socketserver.rst:529 +msgid "" +"class MyTCPHandler(socketserver.StreamRequestHandler):\n" +"\n" +" def handle(self):\n" +" # self.rfile is a file-like object created by the handler.\n" +" # We can now use e.g. readline() instead of raw recv() calls.\n" +" # We limit ourselves to 10000 bytes to avoid abuse by the sender.\n" +" self.data = self.rfile.readline(10000).rstrip()\n" +" print(f\"{self.client_address[0]} wrote:\")\n" +" print(self.data.decode(\"utf-8\"))\n" +" # Likewise, self.wfile is a file-like object used to write back\n" +" # to the client\n" +" self.wfile.write(self.data.upper())" +msgstr "" + +#: library/socketserver.rst:542 msgid "" "The difference is that the ``readline()`` call in the second handler will " "call ``recv()`` multiple times until it encounters a newline character, " -"while the single ``recv()`` call in the first handler will just return what " -"has been received so far from the client's ``sendall()`` call (typically all " -"of it, but this is not guaranteed by the TCP protocol)." +"while the first handler had to use a ``recv()`` loop to accumulate data " +"until a newline itself. If it had just used a single ``recv()`` without the " +"loop it would just have returned what has been received so far from the " +"client. TCP is stream based: data arrives in the order it was sent, but " +"there is no correlation between client ``send()`` or ``sendall()`` calls and " +"the number of ``recv()`` calls on the server required to receive it." msgstr "" -#: library/socketserver.rst:605 +#: library/socketserver.rst:625 msgid "This is the client side::" msgstr "" -#: library/socketserver.rst:680 +#: library/socketserver.rst:554 +msgid "" +"import socket\n" +"import sys\n" +"\n" +"HOST, PORT = \"localhost\", 9999\n" +"data = \" \".join(sys.argv[1:])\n" +"\n" +"# Create a socket (SOCK_STREAM means a TCP socket)\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:\n" +" # Connect to server and send data\n" +" sock.connect((HOST, PORT))\n" +" sock.sendall(bytes(data, \"utf-8\"))\n" +" sock.sendall(b\"\\n\")\n" +"\n" +" # Receive data from the server and shut down\n" +" received = str(sock.recv(1024), \"utf-8\")\n" +"\n" +"print(\"Sent: \", data)\n" +"print(\"Received:\", received)" +msgstr "" + +#: library/socketserver.rst:700 msgid "The output of the example should look something like this:" msgstr "" -#: library/socketserver.rst:556 +#: library/socketserver.rst:576 msgid "Server:" msgstr "" -#: library/socketserver.rst:566 +#: library/socketserver.rst:578 +msgid "" +"$ python TCPServer.py\n" +"127.0.0.1 wrote:\n" +"b'hello world with TCP'\n" +"127.0.0.1 wrote:\n" +"b'python is nice'" +msgstr "" + +#: library/socketserver.rst:586 msgid "Client:" msgstr "" -#: library/socketserver.rst:579 +#: library/socketserver.rst:588 +msgid "" +"$ python TCPClient.py hello world with TCP\n" +"Sent: hello world with TCP\n" +"Received: HELLO WORLD WITH TCP\n" +"$ python TCPClient.py python is nice\n" +"Sent: python is nice\n" +"Received: PYTHON IS NICE" +msgstr "" + +#: library/socketserver.rst:599 msgid ":class:`socketserver.UDPServer` Example" msgstr "" -#: library/socketserver.rst:624 +#: library/socketserver.rst:603 +msgid "" +"import socketserver\n" +"\n" +"class MyUDPHandler(socketserver.BaseRequestHandler):\n" +" \"\"\"\n" +" This class works similar to the TCP handler class, except that\n" +" self.request consists of a pair of data and client socket, and since\n" +" there is no connection the client address must be given explicitly\n" +" when sending data back via sendto().\n" +" \"\"\"\n" +"\n" +" def handle(self):\n" +" data = self.request[0].strip()\n" +" socket = self.request[1]\n" +" print(f\"{self.client_address[0]} wrote:\")\n" +" print(data)\n" +" socket.sendto(data.upper(), self.client_address)\n" +"\n" +"if __name__ == \"__main__\":\n" +" HOST, PORT = \"localhost\", 9999\n" +" with socketserver.UDPServer((HOST, PORT), MyUDPHandler) as server:\n" +" server.serve_forever()" +msgstr "" + +#: library/socketserver.rst:627 +msgid "" +"import socket\n" +"import sys\n" +"\n" +"HOST, PORT = \"localhost\", 9999\n" +"data = \" \".join(sys.argv[1:])\n" +"\n" +"# SOCK_DGRAM is the socket type to use for UDP sockets\n" +"sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n" +"\n" +"# As you can see, there is no connect() call; UDP has no connections.\n" +"# Instead, data is directly sent to the recipient via sendto().\n" +"sock.sendto(bytes(data + \"\\n\", \"utf-8\"), (HOST, PORT))\n" +"received = str(sock.recv(1024), \"utf-8\")\n" +"\n" +"print(\"Sent: \", data)\n" +"print(\"Received:\", received)" +msgstr "" + +#: library/socketserver.rst:644 msgid "" "The output of the example should look exactly like for the TCP server " "example." msgstr "" -#: library/socketserver.rst:628 +#: library/socketserver.rst:648 msgid "Asynchronous Mixins" msgstr "" -#: library/socketserver.rst:630 +#: library/socketserver.rst:650 msgid "" "To build asynchronous handlers, use the :class:`ThreadingMixIn` and :class:" "`ForkingMixIn` classes." msgstr "" -#: library/socketserver.rst:633 +#: library/socketserver.rst:653 msgid "An example for the :class:`ThreadingMixIn` class::" msgstr "" -#: library/socketserver.rst:691 +#: library/socketserver.rst:655 +msgid "" +"import socket\n" +"import threading\n" +"import socketserver\n" +"\n" +"class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):\n" +"\n" +" def handle(self):\n" +" data = str(self.request.recv(1024), 'ascii')\n" +" cur_thread = threading.current_thread()\n" +" response = bytes(\"{}: {}\".format(cur_thread.name, data), 'ascii')\n" +" self.request.sendall(response)\n" +"\n" +"class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver." +"TCPServer):\n" +" pass\n" +"\n" +"def client(ip, port, message):\n" +" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:\n" +" sock.connect((ip, port))\n" +" sock.sendall(bytes(message, 'ascii'))\n" +" response = str(sock.recv(1024), 'ascii')\n" +" print(\"Received: {}\".format(response))\n" +"\n" +"if __name__ == \"__main__\":\n" +" # Port 0 means to select an arbitrary unused port\n" +" HOST, PORT = \"localhost\", 0\n" +"\n" +" server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)\n" +" with server:\n" +" ip, port = server.server_address\n" +"\n" +" # Start a thread with the server -- that thread will then start one\n" +" # more thread for each request\n" +" server_thread = threading.Thread(target=server.serve_forever)\n" +" # Exit the server thread when the main thread terminates\n" +" server_thread.daemon = True\n" +" server_thread.start()\n" +" print(\"Server loop running in thread:\", server_thread.name)\n" +"\n" +" client(ip, port, \"Hello World 1\")\n" +" client(ip, port, \"Hello World 2\")\n" +" client(ip, port, \"Hello World 3\")\n" +"\n" +" server.shutdown()" +msgstr "" + +#: library/socketserver.rst:702 +msgid "" +"$ python ThreadedTCPServer.py\n" +"Server loop running in thread: Thread-1\n" +"Received: Thread-2: Hello World 1\n" +"Received: Thread-3: Hello World 2\n" +"Received: Thread-4: Hello World 3" +msgstr "" + +#: library/socketserver.rst:711 msgid "" "The :class:`ForkingMixIn` class is used in the same way, except that the " "server will spawn a new process for each request. Available only on POSIX " diff --git a/library/spwd.po b/library/spwd.po index 6a7c1dc3..23d04e4f 100644 --- a/library/spwd.po +++ b/library/spwd.po @@ -8,212 +8,34 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/spwd.rst:2 -msgid ":mod:`spwd` --- The shadow password database" +msgid ":mod:`!spwd` --- The shadow password database" msgstr "" -#: library/spwd.rst:12 +#: library/spwd.rst:10 msgid "" -"The :mod:`spwd` module is deprecated (see :pep:`PEP 594 <594#spwd>` for " -"details and alternatives)." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/spwd.rst:15 +#: library/spwd.rst:14 msgid "" -"This module provides access to the Unix shadow password database. It is " -"available on various Unix versions." +"A possible replacement is the third-party library :pypi:`python-pam`. This " +"library is not supported or maintained by the Python core team." msgstr "" -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" - -#: library/spwd.rst:20 -msgid "" -"You must have enough privileges to access the shadow password database (this " -"usually means you have to be root)." -msgstr "" - -#: library/spwd.rst:23 +#: library/spwd.rst:17 msgid "" -"Shadow password database entries are reported as a tuple-like object, whose " -"attributes correspond to the members of the ``spwd`` structure (Attribute " -"field below, see ````):" -msgstr "" - -#: library/spwd.rst:28 -msgid "Index" -msgstr "" - -#: library/spwd.rst:28 -msgid "Attribute" -msgstr "" - -#: library/spwd.rst:28 -msgid "Meaning" -msgstr "" - -#: library/spwd.rst:30 -msgid "0" -msgstr "" - -#: library/spwd.rst:30 -msgid "``sp_namp``" -msgstr "" - -#: library/spwd.rst:30 -msgid "Login name" -msgstr "" - -#: library/spwd.rst:32 -msgid "1" -msgstr "" - -#: library/spwd.rst:32 -msgid "``sp_pwdp``" -msgstr "" - -#: library/spwd.rst:32 -msgid "Encrypted password" -msgstr "" - -#: library/spwd.rst:34 -msgid "2" -msgstr "" - -#: library/spwd.rst:34 -msgid "``sp_lstchg``" -msgstr "" - -#: library/spwd.rst:34 -msgid "Date of last change" -msgstr "" - -#: library/spwd.rst:36 -msgid "3" -msgstr "" - -#: library/spwd.rst:36 -msgid "``sp_min``" -msgstr "" - -#: library/spwd.rst:36 -msgid "Minimal number of days between changes" -msgstr "" - -#: library/spwd.rst:39 -msgid "4" -msgstr "" - -#: library/spwd.rst:39 -msgid "``sp_max``" -msgstr "" - -#: library/spwd.rst:39 -msgid "Maximum number of days between changes" -msgstr "" - -#: library/spwd.rst:42 -msgid "5" -msgstr "" - -#: library/spwd.rst:42 -msgid "``sp_warn``" -msgstr "" - -#: library/spwd.rst:42 -msgid "Number of days before password expires to warn user about it" -msgstr "" - -#: library/spwd.rst:45 -msgid "6" -msgstr "" - -#: library/spwd.rst:45 -msgid "``sp_inact``" -msgstr "" - -#: library/spwd.rst:45 -msgid "Number of days after password expires until account is disabled" -msgstr "" - -#: library/spwd.rst:49 -msgid "7" -msgstr "" - -#: library/spwd.rst:49 -msgid "``sp_expire``" -msgstr "" - -#: library/spwd.rst:49 -msgid "Number of days since 1970-01-01 when account expires" -msgstr "" - -#: library/spwd.rst:52 -msgid "8" -msgstr "" - -#: library/spwd.rst:52 -msgid "``sp_flag``" -msgstr "" - -#: library/spwd.rst:52 -msgid "Reserved" -msgstr "" - -#: library/spwd.rst:55 -msgid "" -"The sp_namp and sp_pwdp items are strings, all others are integers. :exc:" -"`KeyError` is raised if the entry asked for cannot be found." -msgstr "" - -#: library/spwd.rst:58 -msgid "The following functions are defined:" -msgstr "" - -#: library/spwd.rst:63 -msgid "Return the shadow password database entry for the given user name." -msgstr "" - -#: library/spwd.rst:65 -msgid "" -"Raises a :exc:`PermissionError` instead of :exc:`KeyError` if the user " -"doesn't have privileges." -msgstr "" - -#: library/spwd.rst:71 -msgid "" -"Return a list of all available shadow password database entries, in " -"arbitrary order." -msgstr "" - -#: library/spwd.rst:78 -msgid "Module :mod:`grp`" -msgstr "" - -#: library/spwd.rst:78 -msgid "An interface to the group database, similar to this." -msgstr "" - -#: library/spwd.rst:80 -msgid "Module :mod:`pwd`" -msgstr "" - -#: library/spwd.rst:81 -msgid "An interface to the normal password database, similar to this." +"The last version of Python that provided the :mod:`!spwd` module was `Python " +"3.12 `_." msgstr "" diff --git a/library/sqlite3.po b/library/sqlite3.po index ee0a4ab7..f3f340cd 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -8,23 +8,24 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/sqlite3.rst:2 -msgid ":mod:`sqlite3` --- DB-API 2.0 interface for SQLite databases" +msgid ":mod:`!sqlite3` --- DB-API 2.0 interface for SQLite databases" msgstr "" #: library/sqlite3.rst:9 msgid "**Source code:** :source:`Lib/sqlite3/`" msgstr "" -#: library/sqlite3.rst:23 +#: library/sqlite3.rst:25 msgid "" "SQLite is a C library that provides a lightweight disk-based database that " "doesn't require a separate server process and allows accessing the database " @@ -34,75 +35,83 @@ msgid "" "PostgreSQL or Oracle." msgstr "" -#: library/sqlite3.rst:30 +#: library/sqlite3.rst:32 msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " "SQL interface compliant with the DB-API 2.0 specification described by :pep:" -"`249`, and requires SQLite 3.7.15 or newer." +"`249`, and requires the third-party `SQLite `_ library." msgstr "" -#: library/sqlite3.rst:34 +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/sqlite3.rst:38 msgid "This document includes four main sections:" msgstr "" -#: library/sqlite3.rst:36 +#: library/sqlite3.rst:40 msgid ":ref:`sqlite3-tutorial` teaches how to use the :mod:`!sqlite3` module." msgstr "" -#: library/sqlite3.rst:37 +#: library/sqlite3.rst:41 msgid "" ":ref:`sqlite3-reference` describes the classes and functions this module " "defines." msgstr "" -#: library/sqlite3.rst:39 +#: library/sqlite3.rst:43 msgid ":ref:`sqlite3-howtos` details how to handle specific tasks." msgstr "" -#: library/sqlite3.rst:40 +#: library/sqlite3.rst:44 msgid "" ":ref:`sqlite3-explanation` provides in-depth background on transaction " "control." msgstr "" -#: library/sqlite3.rst:47 +#: library/sqlite3.rst:49 msgid "https://www.sqlite.org" msgstr "" -#: library/sqlite3.rst:46 +#: library/sqlite3.rst:50 msgid "" "The SQLite web page; the documentation describes the syntax and the " "available data types for the supported SQL dialect." msgstr "" -#: library/sqlite3.rst:50 +#: library/sqlite3.rst:53 msgid "https://www.w3schools.com/sql/" msgstr "" -#: library/sqlite3.rst:50 +#: library/sqlite3.rst:54 msgid "Tutorial, reference and examples for learning SQL syntax." msgstr "" -#: library/sqlite3.rst:52 +#: library/sqlite3.rst:56 msgid ":pep:`249` - Database API Specification 2.0" msgstr "" -#: library/sqlite3.rst:53 +#: library/sqlite3.rst:57 msgid "PEP written by Marc-André Lemburg." msgstr "" -#: library/sqlite3.rst:66 +#: library/sqlite3.rst:70 msgid "Tutorial" msgstr "" -#: library/sqlite3.rst:68 +#: library/sqlite3.rst:72 msgid "" "In this tutorial, you will create a database of Monty Python movies using " "basic :mod:`!sqlite3` functionality. It assumes a fundamental understanding " "of database concepts, including `cursors`_ and `transactions`_." msgstr "" -#: library/sqlite3.rst:73 +#: library/sqlite3.rst:77 msgid "" "First, we need to create a new database and open a database connection to " "allow :mod:`!sqlite3` to work with it. Call :func:`sqlite3.connect` to " @@ -110,13 +119,19 @@ msgid "" "working directory, implicitly creating it if it does not exist:" msgstr "" -#: library/sqlite3.rst:84 +#: library/sqlite3.rst:83 +msgid "" +"import sqlite3\n" +"con = sqlite3.connect(\"tutorial.db\")" +msgstr "" + +#: library/sqlite3.rst:88 msgid "" "The returned :class:`Connection` object ``con`` represents the connection to " "the on-disk database." msgstr "" -#: library/sqlite3.rst:87 +#: library/sqlite3.rst:91 msgid "" "In order to execute SQL statements and fetch results from SQL queries, we " "will need to use a database cursor. Call :meth:`con.cursor() `:" msgstr "" -#: library/sqlite3.rst:111 +#: library/sqlite3.rst:108 +msgid "cur.execute(\"CREATE TABLE movie(title, year, score)\")" +msgstr "" + +#: library/sqlite3.rst:115 msgid "" "We can verify that the new table has been created by querying the " "``sqlite_master`` table built-in to SQLite, which should now contain an " @@ -143,21 +166,44 @@ msgid "" "` to fetch the resulting row:" msgstr "" -#: library/sqlite3.rst:125 +#: library/sqlite3.rst:123 +msgid "" +">>> res = cur.execute(\"SELECT name FROM sqlite_master\")\n" +">>> res.fetchone()\n" +"('movie',)" +msgstr "" + +#: library/sqlite3.rst:129 msgid "" "We can see that the table has been created, as the query returns a :class:" "`tuple` containing the table's name. If we query ``sqlite_master`` for a non-" -"existent table ``spam``, :meth:`!res.fetchone()` will return ``None``:" +"existent table ``spam``, :meth:`!res.fetchone` will return ``None``:" msgstr "" -#: library/sqlite3.rst:136 +#: library/sqlite3.rst:134 +msgid "" +">>> res = cur.execute(\"SELECT name FROM sqlite_master WHERE name='spam'\")\n" +">>> res.fetchone() is None\n" +"True" +msgstr "" + +#: library/sqlite3.rst:140 msgid "" "Now, add two rows of data supplied as SQL literals by executing an " "``INSERT`` statement, once again by calling :meth:`cur.execute(...) `:" msgstr "" -#: library/sqlite3.rst:148 +#: library/sqlite3.rst:144 +msgid "" +"cur.execute(\"\"\"\n" +" INSERT INTO movie VALUES\n" +" ('Monty Python and the Holy Grail', 1975, 8.2),\n" +" ('And Now for Something Completely Different', 1971, 7.5)\n" +"\"\"\")" +msgstr "" + +#: library/sqlite3.rst:152 msgid "" "The ``INSERT`` statement implicitly opens a transaction, which needs to be " "committed before changes are saved in the database (see :ref:`sqlite3-" @@ -166,6 +212,10 @@ msgid "" msgstr "" #: library/sqlite3.rst:158 +msgid "con.commit()" +msgstr "" + +#: library/sqlite3.rst:162 msgid "" "We can verify that the data was inserted correctly by executing a ``SELECT`` " "query. Use the now-familiar :meth:`cur.execute(...) ` to " @@ -173,19 +223,37 @@ msgid "" "fetchall>` to return all resulting rows:" msgstr "" -#: library/sqlite3.rst:170 +#: library/sqlite3.rst:168 +msgid "" +">>> res = cur.execute(\"SELECT score FROM movie\")\n" +">>> res.fetchall()\n" +"[(8.2,), (7.5,)]" +msgstr "" + +#: library/sqlite3.rst:174 msgid "" "The result is a :class:`list` of two :class:`!tuple`\\s, one per row, each " "containing that row's ``score`` value." msgstr "" -#: library/sqlite3.rst:173 +#: library/sqlite3.rst:177 msgid "" "Now, insert three more rows by calling :meth:`cur.executemany(...) `:" msgstr "" -#: library/sqlite3.rst:186 +#: library/sqlite3.rst:180 +msgid "" +"data = [\n" +" (\"Monty Python Live at the Hollywood Bowl\", 1982, 7.9),\n" +" (\"Monty Python's The Meaning of Life\", 1983, 7.5),\n" +" (\"Monty Python's Life of Brian\", 1979, 8.0),\n" +"]\n" +"cur.executemany(\"INSERT INTO movie VALUES(?, ?, ?)\", data)\n" +"con.commit() # Remember to commit the transaction after executing INSERT." +msgstr "" + +#: library/sqlite3.rst:190 msgid "" "Notice that ``?`` placeholders are used to bind ``data`` to the query. " "Always use placeholders instead of :ref:`string formatting ` " @@ -193,69 +261,96 @@ msgid "" "(see :ref:`sqlite3-placeholders` for more details)." msgstr "" -#: library/sqlite3.rst:192 +#: library/sqlite3.rst:196 msgid "" "We can verify that the new rows were inserted by executing a ``SELECT`` " "query, this time iterating over the results of the query:" msgstr "" -#: library/sqlite3.rst:206 +#: library/sqlite3.rst:200 +msgid "" +">>> for row in cur.execute(\"SELECT year, title FROM movie ORDER BY " +"year\"):\n" +"... print(row)\n" +"(1971, 'And Now for Something Completely Different')\n" +"(1975, 'Monty Python and the Holy Grail')\n" +"(1979, \"Monty Python's Life of Brian\")\n" +"(1982, 'Monty Python Live at the Hollywood Bowl')\n" +"(1983, \"Monty Python's The Meaning of Life\")" +msgstr "" + +#: library/sqlite3.rst:210 msgid "" "Each row is a two-item :class:`tuple` of ``(year, title)``, matching the " "columns selected in the query." msgstr "" -#: library/sqlite3.rst:209 +#: library/sqlite3.rst:213 msgid "" "Finally, verify that the database has been written to disk by calling :meth:" "`con.close() ` to close the existing connection, opening a " "new one, creating a new cursor, then querying the database:" msgstr "" -#: library/sqlite3.rst:224 +#: library/sqlite3.rst:218 +msgid "" +">>> con.close()\n" +">>> new_con = sqlite3.connect(\"tutorial.db\")\n" +">>> new_cur = new_con.cursor()\n" +">>> res = new_cur.execute(\"SELECT title, year FROM movie ORDER BY score " +"DESC\")\n" +">>> title, year = res.fetchone()\n" +">>> print(f'The highest scoring Monty Python movie is {title!r}, released in " +"{year}')\n" +"The highest scoring Monty Python movie is 'Monty Python and the Holy Grail', " +"released in 1975\n" +">>> new_con.close()" +msgstr "" + +#: library/sqlite3.rst:229 msgid "" "You've now created an SQLite database using the :mod:`!sqlite3` module, " "inserted data and retrieved values from it in multiple ways." msgstr "" -#: library/sqlite3.rst:236 +#: library/sqlite3.rst:241 msgid ":ref:`sqlite3-howtos` for further reading:" msgstr "" -#: library/sqlite3.rst:238 +#: library/sqlite3.rst:243 msgid ":ref:`sqlite3-placeholders`" msgstr "" -#: library/sqlite3.rst:239 +#: library/sqlite3.rst:244 msgid ":ref:`sqlite3-adapters`" msgstr "" -#: library/sqlite3.rst:240 +#: library/sqlite3.rst:245 msgid ":ref:`sqlite3-converters`" msgstr "" -#: library/sqlite3.rst:625 +#: library/sqlite3.rst:602 msgid ":ref:`sqlite3-connection-context-manager`" msgstr "" -#: library/sqlite3.rst:242 +#: library/sqlite3.rst:247 msgid ":ref:`sqlite3-howto-row-factory`" msgstr "" -#: library/sqlite3.rst:244 +#: library/sqlite3.rst:249 msgid "" ":ref:`sqlite3-explanation` for in-depth background on transaction control." msgstr "" -#: library/sqlite3.rst:249 +#: library/sqlite3.rst:254 msgid "Reference" msgstr "" -#: library/sqlite3.rst:257 +#: library/sqlite3.rst:262 msgid "Module functions" msgstr "" -#: library/sqlite3.rst:265 +#: library/sqlite3.rst:270 msgid "Open a connection to an SQLite database." msgstr "" @@ -263,14 +358,14 @@ msgstr "" msgid "Parameters" msgstr "" -#: library/sqlite3.rst:267 +#: library/sqlite3.rst:272 msgid "" "The path to the database file to be opened. You can pass ``\":memory:\"`` to " "create an `SQLite database existing only in memory `_, and open a connection to it." msgstr "" -#: library/sqlite3.rst:274 +#: library/sqlite3.rst:279 msgid "" "How many seconds the connection should wait before raising an :exc:" "`OperationalError` when a table is locked. If another connection opens a " @@ -278,20 +373,17 @@ msgid "" "transaction is committed. Default five seconds." msgstr "" -#: library/sqlite3.rst:281 +#: library/sqlite3.rst:286 msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " "converters registered with :func:`register_converter`. Set it to any " "combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:" "`PARSE_COLNAMES` to enable this. Column names takes precedence over declared " -"types if both flags are set. Types cannot be detected for generated fields " -"(for example ``max(data)``), even when the *detect_types* parameter is set; :" -"class:`str` will be returned instead. By default (``0``), type detection is " -"disabled." +"types if both flags are set. By default (``0``), type detection is disabled." msgstr "" -#: library/sqlite3.rst:295 +#: library/sqlite3.rst:297 msgid "" "Control legacy transaction handling behaviour. See :attr:`Connection." "isolation_level` and :ref:`sqlite3-transaction-control-isolation-level` for " @@ -301,7 +393,7 @@ msgid "" "`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." msgstr "" -#: library/sqlite3.rst:305 +#: library/sqlite3.rst:307 msgid "" "If ``True`` (default), :exc:`ProgrammingError` will be raised if the " "database connection is used by a thread other than the one that created it. " @@ -310,19 +402,19 @@ msgid "" "See :attr:`threadsafety` for more information." msgstr "" -#: library/sqlite3.rst:314 +#: library/sqlite3.rst:316 msgid "" "A custom subclass of :class:`Connection` to create the connection with, if " "not the default :class:`Connection` class." msgstr "" -#: library/sqlite3.rst:318 +#: library/sqlite3.rst:320 msgid "" "The number of statements that :mod:`!sqlite3` should internally cache for " "this connection, to avoid parsing overhead. By default, 128 statements." msgstr "" -#: library/sqlite3.rst:323 +#: library/sqlite3.rst:325 msgid "" "If set to ``True``, *database* is interpreted as a :abbr:`URI (Uniform " "Resource Identifier)` with a file path and an optional query string. The " @@ -331,7 +423,7 @@ msgid "" "various :ref:`sqlite3-uri-tricks`." msgstr "" -#: library/sqlite3.rst:332 +#: library/sqlite3.rst:334 msgid "" "Control :pep:`249` transaction handling behaviour. See :attr:`Connection." "autocommit` and :ref:`sqlite3-transaction-control-autocommit` for more " @@ -344,61 +436,76 @@ msgstr "" msgid "Return type" msgstr "" -#: library/sqlite3.rst:343 +#: library/sqlite3.rst:345 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -#: library/sqlite3.rst:344 +#: library/sqlite3.rst:346 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." msgstr "" -#: library/sqlite3.rst:346 +#: library/sqlite3.rst:348 msgid "Added the *uri* parameter." msgstr "" -#: library/sqlite3.rst:349 +#: library/sqlite3.rst:351 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: library/sqlite3.rst:352 +#: library/sqlite3.rst:354 msgid "Added the ``sqlite3.connect/handle`` auditing event." msgstr "" -#: library/sqlite3.rst:355 +#: library/sqlite3.rst:357 msgid "Added the *autocommit* parameter." msgstr "" #: library/sqlite3.rst:360 msgid "" +"Positional use of the parameters *timeout*, *detect_types*, " +"*isolation_level*, *check_same_thread*, *factory*, *cached_statements*, and " +"*uri* is deprecated. They will become keyword-only parameters in Python 3.15." +msgstr "" + +#: library/sqlite3.rst:368 +msgid "" "Return ``True`` if the string *statement* appears to contain one or more " "complete SQL statements. No syntactic verification or parsing of any kind is " "performed, other than checking that there are no unclosed string literals " "and the statement is terminated by a semicolon." msgstr "" -#: library/sqlite3.rst:366 +#: library/sqlite3.rst:374 msgid "For example:" msgstr "" -#: library/sqlite3.rst:375 +#: library/sqlite3.rst:376 +msgid "" +">>> sqlite3.complete_statement(\"SELECT foo FROM bar;\")\n" +"True\n" +">>> sqlite3.complete_statement(\"SELECT foo\")\n" +"False" +msgstr "" + +#: library/sqlite3.rst:383 msgid "" "This function may be useful during command-line input to determine if the " "entered text seems to form a complete SQL statement, or if additional input " "is needed before calling :meth:`~Cursor.execute`." msgstr "" -#: library/sqlite3.rst:379 +#: library/sqlite3.rst:387 msgid "" "See :func:`!runsource` in :source:`Lib/sqlite3/__main__.py` for real-world " "use." msgstr "" -#: library/sqlite3.rst:384 +#: library/sqlite3.rst:392 msgid "" "Enable or disable callback tracebacks. By default you will not get any " "tracebacks in user-defined functions, aggregates, converters, authorizer " @@ -407,13 +514,14 @@ msgid "" "on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -#: library/sqlite3.rst:391 +#: library/sqlite3.rst:401 msgid "" -"Register an :func:`unraisable hook handler ` for an " -"improved debug experience:" +"Errors in user-defined function callbacks are logged as unraisable " +"exceptions. Use an :func:`unraisable hook handler ` for " +"introspection of the failed callback." msgstr "" -#: library/sqlite3.rst:417 +#: library/sqlite3.rst:407 msgid "" "Register an *adapter* :term:`callable` to adapt the Python type *type* into " "an SQLite type. The adapter is called with a Python object of type *type* as " @@ -421,7 +529,7 @@ msgid "" "natively understands `." msgstr "" -#: library/sqlite3.rst:425 +#: library/sqlite3.rst:415 msgid "" "Register the *converter* :term:`callable` to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -431,101 +539,122 @@ msgid "" "type detection works." msgstr "" -#: library/sqlite3.rst:433 +#: library/sqlite3.rst:423 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: library/sqlite3.rst:440 +#: library/sqlite3.rst:430 msgid "Module constants" msgstr "" -#: library/sqlite3.rst:444 +#: library/sqlite3.rst:434 msgid "" "Set :attr:`~Connection.autocommit` to this constant to select old style (pre-" "Python 3.12) transaction control behaviour. See :ref:`sqlite3-transaction-" "control-isolation-level` for more information." msgstr "" -#: library/sqlite3.rst:450 +#: library/sqlite3.rst:440 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " -"look up a converter function by using the type name, parsed from the query " -"column name, as the converter dictionary key. The type name must be wrapped " -"in square brackets (``[]``)." +"look up a converter function using the declared types for each column. The " +"types are declared when the database table is created. :mod:`!sqlite3` will " +"look up a converter function using the first word of the declared type as " +"the converter dictionary key. For example:" msgstr "" -#: library/sqlite3.rst:460 +#: library/sqlite3.rst:448 msgid "" -"This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " +"CREATE TABLE test(\n" +" i integer primary key, ! will look up a converter named \"integer\"\n" +" p point, ! will look up a converter named \"point\"\n" +" n number(10) ! will look up a converter named \"number\"\n" +" )" +msgstr "" + +#: library/sqlite3.rst:456 +msgid "" +"This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: library/sqlite3.rst:465 +#: library/sqlite3.rst:461 +msgid "" +"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. Use :" +"const:`!PARSE_COLNAMES` to enforce types for such queries." +msgstr "" + +#: library/sqlite3.rst:466 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " -"look up a converter function using the declared types for each column. The " -"types are declared when the database table is created. :mod:`!sqlite3` will " -"look up a converter function using the first word of the declared type as " -"the converter dictionary key. For example:" +"look up a converter function by using the type name, parsed from the query " +"column name, as the converter dictionary key. The query column name must be " +"wrapped in double quotes (``\"``) and the type name must be wrapped in " +"square brackets (``[]``)." msgstr "" -#: library/sqlite3.rst:481 +#: library/sqlite3.rst:473 msgid "" -"This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " +"SELECT MAX(p) as \"p [point]\" FROM test; ! will look up converter \"point\"" +msgstr "" + +#: library/sqlite3.rst:477 +msgid "" +"This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: library/sqlite3.rst:488 +#: library/sqlite3.rst:484 msgid "" "Flags that should be returned by the *authorizer_callback* :term:`callable` " "passed to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" -#: library/sqlite3.rst:491 +#: library/sqlite3.rst:487 msgid "Access is allowed (:const:`!SQLITE_OK`)," msgstr "" -#: library/sqlite3.rst:492 +#: library/sqlite3.rst:488 msgid "" "The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`)" msgstr "" -#: library/sqlite3.rst:493 +#: library/sqlite3.rst:489 msgid "" "The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`)" msgstr "" -#: library/sqlite3.rst:497 +#: library/sqlite3.rst:493 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: library/sqlite3.rst:502 +#: library/sqlite3.rst:498 msgid "" "String constant stating the type of parameter marker formatting expected by " "the :mod:`!sqlite3` module. Required by the DB-API. Hard-coded to " "``\"qmark\"``." msgstr "" -#: library/sqlite3.rst:508 +#: library/sqlite3.rst:504 msgid "The ``named`` DB-API parameter style is also supported." msgstr "" -#: library/sqlite3.rst:512 +#: library/sqlite3.rst:508 msgid "" "Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: library/sqlite3.rst:516 +#: library/sqlite3.rst:512 msgid "" "Version number of the runtime SQLite library as a :class:`tuple` of :class:" "`integers `." msgstr "" -#: library/sqlite3.rst:521 +#: library/sqlite3.rst:517 msgid "" "Integer constant required by the DB-API 2.0, stating the level of thread " "safety the :mod:`!sqlite3` module supports. This attribute is set based on " @@ -533,181 +662,172 @@ msgid "" "underlying SQLite library is compiled with. The SQLite threading modes are:" msgstr "" -#: library/sqlite3.rst:526 +#: library/sqlite3.rst:522 msgid "" "**Single-thread**: In this mode, all mutexes are disabled and SQLite is " "unsafe to use in more than a single thread at once." msgstr "" -#: library/sqlite3.rst:528 +#: library/sqlite3.rst:524 msgid "" "**Multi-thread**: In this mode, SQLite can be safely used by multiple " "threads provided that no single database connection is used simultaneously " "in two or more threads." msgstr "" -#: library/sqlite3.rst:531 +#: library/sqlite3.rst:527 msgid "" "**Serialized**: In serialized mode, SQLite can be safely used by multiple " "threads with no restriction." msgstr "" -#: library/sqlite3.rst:534 +#: library/sqlite3.rst:530 msgid "" "The mappings from SQLite threading modes to DB-API 2.0 threadsafety levels " "are as follows:" msgstr "" -#: library/sqlite3.rst:538 +#: library/sqlite3.rst:534 msgid "SQLite threading mode" msgstr "" -#: library/sqlite3.rst:538 -msgid "`threadsafety`_" +#: library/sqlite3.rst:534 +msgid ":pep:`threadsafety <0249#threadsafety>`" msgstr "" -#: library/sqlite3.rst:538 +#: library/sqlite3.rst:534 msgid "`SQLITE_THREADSAFE`_" msgstr "" -#: library/sqlite3.rst:538 +#: library/sqlite3.rst:534 msgid "DB-API 2.0 meaning" msgstr "" -#: library/sqlite3.rst:541 +#: library/sqlite3.rst:537 msgid "single-thread" msgstr "" -#: library/sqlite3.rst:541 +#: library/sqlite3.rst:537 msgid "0" msgstr "" -#: library/sqlite3.rst:541 +#: library/sqlite3.rst:537 msgid "Threads may not share the module" msgstr "" -#: library/sqlite3.rst:544 +#: library/sqlite3.rst:540 msgid "multi-thread" msgstr "" -#: library/sqlite3.rst:547 +#: library/sqlite3.rst:543 msgid "1" msgstr "" -#: library/sqlite3.rst:544 +#: library/sqlite3.rst:540 msgid "2" msgstr "" -#: library/sqlite3.rst:544 +#: library/sqlite3.rst:540 msgid "Threads may share the module, but not connections" msgstr "" -#: library/sqlite3.rst:547 +#: library/sqlite3.rst:543 msgid "serialized" msgstr "" -#: library/sqlite3.rst:547 +#: library/sqlite3.rst:543 msgid "3" msgstr "" -#: library/sqlite3.rst:547 +#: library/sqlite3.rst:543 msgid "Threads may share the module, connections and cursors" msgstr "" -#: library/sqlite3.rst:554 +#: library/sqlite3.rst:549 msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: library/sqlite3.rst:559 -msgid "" -"Version number of this module as a :class:`string `. This is not the " -"version of the SQLite library." -msgstr "" - -#: library/sqlite3.rst:575 -msgid "" -"This constant used to reflect the version number of the ``pysqlite`` " -"package, a third-party library which used to upstream changes to :mod:`!" -"sqlite3`. Today, it carries no meaning or practical value." -msgstr "" - -#: library/sqlite3.rst:569 -msgid "" -"Version number of this module as a :class:`tuple` of :class:`integers " -"`. This is not the version of the SQLite library." -msgstr "" - -#: library/sqlite3.rst:596 +#: library/sqlite3.rst:571 msgid "" "These constants are used for the :meth:`Connection.setconfig` and :meth:" "`~Connection.getconfig` methods." msgstr "" -#: library/sqlite3.rst:599 +#: library/sqlite3.rst:574 msgid "" "The availability of these constants varies depending on the version of " "SQLite Python was compiled with." msgstr "" -#: library/sqlite3.rst:606 +#: library/sqlite3.rst:581 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" msgstr "" -#: library/sqlite3.rst:607 +#: library/sqlite3.rst:582 msgid "SQLite docs: Database Connection Configuration Options" msgstr "" -#: library/sqlite3.rst:613 +#: library/sqlite3.rst:584 +msgid "The :data:`!version` and :data:`!version_info` constants." +msgstr "" + +#: library/sqlite3.rst:590 msgid "Connection objects" msgstr "" -#: library/sqlite3.rst:617 +#: library/sqlite3.rst:594 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " "is created using :func:`sqlite3.connect`. Their main purpose is creating :" "class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." msgstr "" -#: library/sqlite3.rst:624 +#: library/sqlite3.rst:601 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr "" -#: library/sqlite3.rst:627 +#: library/sqlite3.rst:607 +msgid "" +"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" +"class:`!Connection` object is deleted." +msgstr "" + +#: library/sqlite3.rst:610 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: library/sqlite3.rst:631 +#: library/sqlite3.rst:614 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " "single optional parameter *factory*. If supplied, this must be a :term:" "`callable` returning an instance of :class:`Cursor` or its subclasses." msgstr "" -#: library/sqlite3.rst:638 +#: library/sqlite3.rst:621 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: library/sqlite3.rst:641 +#: library/sqlite3.rst:624 msgid "The name of the table where the blob is located." msgstr "" -#: library/sqlite3.rst:644 +#: library/sqlite3.rst:627 msgid "The name of the column where the blob is located." msgstr "" -#: library/sqlite3.rst:647 -msgid "The name of the row where the blob is located." +#: library/sqlite3.rst:630 +msgid "The row id where the blob is located." msgstr "" -#: library/sqlite3.rst:650 +#: library/sqlite3.rst:633 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: library/sqlite3.rst:655 +#: library/sqlite3.rst:638 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -716,17 +836,17 @@ msgstr "" msgid "Raises" msgstr "" -#: library/sqlite3.rst:659 +#: library/sqlite3.rst:642 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: library/sqlite3.rst:666 +#: library/sqlite3.rst:649 msgid "" "The blob size cannot be changed using the :class:`Blob` class. Use the SQL " "function ``zeroblob`` to create a blob with a fixed size." msgstr "" -#: library/sqlite3.rst:673 +#: library/sqlite3.rst:656 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -734,7 +854,7 @@ msgid "" "pending transaction was committed by this method." msgstr "" -#: library/sqlite3.rst:681 +#: library/sqlite3.rst:664 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -742,7 +862,7 @@ msgid "" "pending transaction was rolled back by this method." msgstr "" -#: library/sqlite3.rst:689 +#: library/sqlite3.rst:672 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -751,79 +871,94 @@ msgid "" "losing pending changes." msgstr "" -#: library/sqlite3.rst:699 +#: library/sqlite3.rst:682 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: library/sqlite3.rst:705 +#: library/sqlite3.rst:688 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: library/sqlite3.rst:711 +#: library/sqlite3.rst:694 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: library/sqlite3.rst:717 +#: library/sqlite3.rst:700 msgid "Create or remove a user-defined SQL function." msgstr "" -#: library/sqlite3.rst:719 +#: library/sqlite3.rst:702 msgid "The name of the SQL function." msgstr "" -#: library/sqlite3.rst:722 +#: library/sqlite3.rst:705 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: library/sqlite3.rst:726 +#: library/sqlite3.rst:709 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -#: library/sqlite3.rst:733 +#: library/sqlite3.rst:716 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: library/sqlite3.rst:738 -msgid "If *deterministic* is used with SQLite versions older than 3.8.3." -msgstr "" - -#: library/sqlite3.rst:741 +#: library/sqlite3.rst:721 msgid "Added the *deterministic* parameter." msgstr "" -#: library/sqlite3.rst:782 library/sqlite3.rst:1115 library/sqlite3.rst:1568 +#: library/sqlite3.rst:768 library/sqlite3.rst:1115 library/sqlite3.rst:1580 msgid "Example:" msgstr "" -#: library/sqlite3.rst:760 +#: library/sqlite3.rst:726 +msgid "" +">>> import hashlib\n" +">>> def md5sum(t):\n" +"... return hashlib.md5(t).hexdigest()\n" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> con.create_function(\"md5\", 1, md5sum)\n" +">>> for row in con.execute(\"SELECT md5(?)\", (b\"foo\",)):\n" +"... print(row)\n" +"('acbd18db4cc2f85cedef654fccc4a4d8',)\n" +">>> con.close()" +msgstr "" + +#: library/sqlite3.rst:740 +msgid "" +"Passing *name*, *narg*, and *func* as keyword arguments is deprecated. These " +"parameters will become positional-only in Python 3.15." +msgstr "" + +#: library/sqlite3.rst:746 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: library/sqlite3.rst:762 +#: library/sqlite3.rst:748 msgid "The name of the SQL aggregate function." msgstr "" -#: library/sqlite3.rst:765 +#: library/sqlite3.rst:751 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: library/sqlite3.rst:769 +#: library/sqlite3.rst:755 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -832,45 +967,74 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: library/sqlite3.rst:770 +#: library/sqlite3.rst:756 msgid "A class must implement the following methods:" msgstr "" -#: library/sqlite3.rst:772 +#: library/sqlite3.rst:758 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: library/sqlite3.rst:829 +#: library/sqlite3.rst:820 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: library/sqlite3.rst:776 +#: library/sqlite3.rst:762 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: library/sqlite3.rst:779 +#: library/sqlite3.rst:765 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: library/sqlite3.rst:814 +#: library/sqlite3.rst:770 +msgid "" +"class MySum:\n" +" def __init__(self):\n" +" self.count = 0\n" +"\n" +" def step(self, value):\n" +" self.count += value\n" +"\n" +" def finalize(self):\n" +" return self.count\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"con.create_aggregate(\"mysum\", 1, MySum)\n" +"cur = con.execute(\"CREATE TABLE test(i)\")\n" +"cur.execute(\"INSERT INTO test(i) VALUES(1)\")\n" +"cur.execute(\"INSERT INTO test(i) VALUES(2)\")\n" +"cur.execute(\"SELECT mysum(i) FROM test\")\n" +"print(cur.fetchone()[0])\n" +"\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:799 +msgid "" +"Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is " +"deprecated. These parameters will become positional-only in Python 3.15." +msgstr "" + +#: library/sqlite3.rst:805 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: library/sqlite3.rst:816 +#: library/sqlite3.rst:807 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: library/sqlite3.rst:819 +#: library/sqlite3.rst:810 msgid "" "The number of arguments the SQL aggregate window function can accept. If " "``-1``, it may take any number of arguments." msgstr "" -#: library/sqlite3.rst:823 +#: library/sqlite3.rst:814 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -882,79 +1046,148 @@ msgid "" "function." msgstr "" -#: library/sqlite3.rst:824 +#: library/sqlite3.rst:815 msgid "A class that must implement the following methods:" msgstr "" -#: library/sqlite3.rst:826 +#: library/sqlite3.rst:817 msgid "``step()``: Add a row to the current window." msgstr "" -#: library/sqlite3.rst:827 +#: library/sqlite3.rst:818 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: library/sqlite3.rst:828 +#: library/sqlite3.rst:819 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: library/sqlite3.rst:832 +#: library/sqlite3.rst:823 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: library/sqlite3.rst:835 +#: library/sqlite3.rst:826 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: library/sqlite3.rst:837 +#: library/sqlite3.rst:828 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: library/sqlite3.rst:900 +#: library/sqlite3.rst:838 +msgid "" +"# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" +"class WindowSumInt:\n" +" def __init__(self):\n" +" self.count = 0\n" +"\n" +" def step(self, value):\n" +" \"\"\"Add a row to the current window.\"\"\"\n" +" self.count += value\n" +"\n" +" def value(self):\n" +" \"\"\"Return the current value of the aggregate.\"\"\"\n" +" return self.count\n" +"\n" +" def inverse(self, value):\n" +" \"\"\"Remove a row from the current window.\"\"\"\n" +" self.count -= value\n" +"\n" +" def finalize(self):\n" +" \"\"\"Return the final value of the aggregate.\n" +"\n" +" Any clean-up actions should be placed here.\n" +" \"\"\"\n" +" return self.count\n" +"\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"cur = con.execute(\"CREATE TABLE test(x, y)\")\n" +"values = [\n" +" (\"a\", 4),\n" +" (\"b\", 5),\n" +" (\"c\", 3),\n" +" (\"d\", 8),\n" +" (\"e\", 1),\n" +"]\n" +"cur.executemany(\"INSERT INTO test VALUES(?, ?)\", values)\n" +"con.create_window_function(\"sumint\", 1, WindowSumInt)\n" +"cur.execute(\"\"\"\n" +" SELECT x, sumint(y) OVER (\n" +" ORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING\n" +" ) AS sum_y\n" +" FROM test ORDER BY x\n" +"\"\"\")\n" +"print(cur.fetchall())\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:892 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: library/sqlite3.rst:904 +#: library/sqlite3.rst:896 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: library/sqlite3.rst:905 +#: library/sqlite3.rst:897 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: library/sqlite3.rst:906 +#: library/sqlite3.rst:898 msgid "``0`` if they are ordered equal" msgstr "" -#: library/sqlite3.rst:908 +#: library/sqlite3.rst:900 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: library/sqlite3.rst:936 +#: library/sqlite3.rst:902 +msgid "" +"def collate_reverse(string1, string2):\n" +" if string1 == string2:\n" +" return 0\n" +" elif string1 < string2:\n" +" return 1\n" +" else:\n" +" return -1\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"con.create_collation(\"reverse\", collate_reverse)\n" +"\n" +"cur = con.execute(\"CREATE TABLE test(x)\")\n" +"cur.executemany(\"INSERT INTO test(x) VALUES(?)\", [(\"a\",), (\"b\",)])\n" +"cur.execute(\"SELECT x FROM test ORDER BY x COLLATE reverse\")\n" +"for row in cur:\n" +" print(row)\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:928 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: library/sqlite3.rst:938 +#: library/sqlite3.rst:930 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: library/sqlite3.rst:945 +#: library/sqlite3.rst:937 msgid "" "Call this method from a different thread to abort any queries that might be " "executing on the connection. Aborted queries will raise an :exc:" "`OperationalError`." msgstr "" -#: library/sqlite3.rst:952 +#: library/sqlite3.rst:944 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " @@ -963,7 +1196,7 @@ msgid "" "underlying SQLite library." msgstr "" -#: library/sqlite3.rst:959 +#: library/sqlite3.rst:951 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -973,7 +1206,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: library/sqlite3.rst:966 +#: library/sqlite3.rst:958 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -981,15 +1214,21 @@ msgid "" "module." msgstr "" -#: library/sqlite3.rst:970 +#: library/sqlite3.rst:962 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: library/sqlite3.rst:972 +#: library/sqlite3.rst:964 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: library/sqlite3.rst:978 +#: library/sqlite3.rst:967 +msgid "" +"Passing *authorizer_callback* as a keyword argument is deprecated. The " +"parameter will become positional-only in Python 3.15." +msgstr "" + +#: library/sqlite3.rst:974 msgid "" "Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -997,19 +1236,25 @@ msgid "" "a GUI." msgstr "" -#: library/sqlite3.rst:983 +#: library/sqlite3.rst:979 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: library/sqlite3.rst:986 +#: library/sqlite3.rst:982 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise a :exc:`DatabaseError` " "exception." msgstr "" +#: library/sqlite3.rst:986 +msgid "" +"Passing *progress_handler* as a keyword argument is deprecated. The " +"parameter will become positional-only in Python 3.15." +msgstr "" + #: library/sqlite3.rst:993 msgid "" "Register :term:`callable` *trace_callback* to be invoked for each SQL " @@ -1037,7 +1282,13 @@ msgid "" "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: library/sqlite3.rst:1017 +#: library/sqlite3.rst:1014 +msgid "" +"Passing *trace_callback* as a keyword argument is deprecated. The parameter " +"will become positional-only in Python 3.15." +msgstr "" + +#: library/sqlite3.rst:1021 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -1046,7 +1297,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: library/sqlite3.rst:1026 +#: library/sqlite3.rst:1030 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -1055,79 +1306,130 @@ msgid "" "program:`configure`." msgstr "" -#: library/sqlite3.rst:1033 +#: library/sqlite3.rst:1037 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." msgstr "" -#: library/sqlite3.rst:1037 +#: library/sqlite3.rst:1041 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "" -#: library/sqlite3.rst:1080 +#: library/sqlite3.rst:1047 +msgid "" +"con.enable_load_extension(True)\n" +"\n" +"# Load the fulltext search extension\n" +"con.execute(\"select load_extension('./fts3.so')\")\n" +"\n" +"# alternatively you can load the extension using an API call:\n" +"# con.load_extension(\"./fts3.so\")\n" +"\n" +"# disable extension loading again\n" +"con.enable_load_extension(False)\n" +"\n" +"# example from SQLite wiki\n" +"con.execute(\"CREATE VIRTUAL TABLE recipe USING fts3(name, ingredients)\")\n" +"con.executescript(\"\"\"\n" +" INSERT INTO recipe (name, ingredients) VALUES('broccoli stew', 'broccoli " +"peppers cheese tomatoes');\n" +" INSERT INTO recipe (name, ingredients) VALUES('pumpkin stew', 'pumpkin " +"onions garlic celery');\n" +" INSERT INTO recipe (name, ingredients) VALUES('broccoli pie', 'broccoli " +"cheese onions flour');\n" +" INSERT INTO recipe (name, ingredients) VALUES('pumpkin pie', 'pumpkin " +"sugar flour butter');\n" +" \"\"\")\n" +"for row in con.execute(\"SELECT rowid, name, ingredients FROM recipe WHERE " +"name MATCH 'pie'\"):\n" +" print(row)" +msgstr "" + +#: library/sqlite3.rst:1073 msgid "" "Load an SQLite extension from a shared library. Enable extension loading " "with :meth:`enable_load_extension` before calling this method." msgstr "" -#: library/sqlite3.rst:1084 +#: library/sqlite3.rst:1077 msgid "The path to the SQLite extension." msgstr "" -#: library/sqlite3.rst:1088 +#: library/sqlite3.rst:1081 msgid "" "Entry point name. If ``None`` (the default), SQLite will come up with an " "entry point name of its own; see the SQLite docs `Loading an Extension`_ for " "details." msgstr "" -#: library/sqlite3.rst:1097 +#: library/sqlite3.rst:1090 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." msgstr "" -#: library/sqlite3.rst:1101 +#: library/sqlite3.rst:1094 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "" -#: library/sqlite3.rst:1104 +#: library/sqlite3.rst:1097 msgid "Added the *entrypoint* parameter." msgstr "" -#: library/sqlite3.rst:1111 +#: library/sqlite3.rst:1104 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " "when saving an in-memory database for later restoration. Similar to the ``." "dump`` command in the :program:`sqlite3` shell." msgstr "" -#: library/sqlite3.rst:1198 +#: library/sqlite3.rst:1108 +msgid "" +"An optional ``LIKE`` pattern for database objects to dump, e.g. " +"``prefix_%``. If ``None`` (the default), all database objects will be " +"included." +msgstr "" + +#: library/sqlite3.rst:1117 +msgid "" +"# Convert file example.db to SQL dump file dump.sql\n" +"con = sqlite3.connect('example.db')\n" +"with open('dump.sql', 'w') as f:\n" +" for line in con.iterdump():\n" +" f.write('%s\\n' % line)\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:1202 msgid ":ref:`sqlite3-howto-encoding`" msgstr "" -#: library/sqlite3.rst:1133 -msgid "Create a backup of an SQLite database." +#: library/sqlite3.rst:1130 +msgid "Added the *filter* parameter." msgstr "" #: library/sqlite3.rst:1135 +msgid "Create a backup of an SQLite database." +msgstr "" + +#: library/sqlite3.rst:1137 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: library/sqlite3.rst:1138 +#: library/sqlite3.rst:1140 msgid "The database connection to save the backup to." msgstr "" -#: library/sqlite3.rst:1141 +#: library/sqlite3.rst:1143 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: library/sqlite3.rst:1147 +#: library/sqlite3.rst:1149 msgid "" "If set to a :term:`callable`, it is invoked with three integer arguments for " "every backup iteration: the *status* of the last iteration, the *remaining* " @@ -1135,46 +1437,74 @@ msgid "" "Defaults to ``None``." msgstr "" -#: library/sqlite3.rst:1156 +#: library/sqlite3.rst:1158 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: library/sqlite3.rst:1163 +#: library/sqlite3.rst:1165 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: library/sqlite3.rst:1167 +#: library/sqlite3.rst:1169 msgid "Example 1, copy an existing database into another:" msgstr "" -#: library/sqlite3.rst:1186 +#: library/sqlite3.rst:1171 +msgid "" +"def progress(status, remaining, total):\n" +" print(f'Copied {total-remaining} of {total} pages...')\n" +"\n" +"src = sqlite3.connect('example.db')\n" +"dst = sqlite3.connect('backup.db')\n" +"with dst:\n" +" src.backup(dst, pages=1, progress=progress)\n" +"dst.close()\n" +"src.close()" +msgstr "" + +#: library/sqlite3.rst:1188 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: library/sqlite3.rst:1202 +#: library/sqlite3.rst:1190 +msgid "" +"src = sqlite3.connect('example.db')\n" +"dst = sqlite3.connect(':memory:')\n" +"src.backup(dst)\n" +"dst.close()\n" +"src.close()" +msgstr "" + +#: library/sqlite3.rst:1206 msgid "Get a connection runtime limit." msgstr "" -#: library/sqlite3.rst:1204 +#: library/sqlite3.rst:1208 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: library/sqlite3.rst:1246 +#: library/sqlite3.rst:1250 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: library/sqlite3.rst:1212 +#: library/sqlite3.rst:1216 msgid "" "Example, query the maximum length of an SQL statement for :class:" "`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: library/sqlite3.rst:1232 +#: library/sqlite3.rst:1226 +msgid "" +">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" +"1000000000" +msgstr "" + +#: library/sqlite3.rst:1236 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1182,40 +1512,48 @@ msgid "" "returned." msgstr "" -#: library/sqlite3.rst:1237 +#: library/sqlite3.rst:1241 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: library/sqlite3.rst:1240 +#: library/sqlite3.rst:1244 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: library/sqlite3.rst:1249 +#: library/sqlite3.rst:1253 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: library/sqlite3.rst:1266 +#: library/sqlite3.rst:1256 +msgid "" +">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" +"10\n" +">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" +"1" +msgstr "" + +#: library/sqlite3.rst:1274 msgid "Query a boolean connection configuration option." msgstr "" -#: library/sqlite3.rst:1279 +#: library/sqlite3.rst:1287 msgid "A :ref:`SQLITE_DBCONFIG code `." msgstr "" -#: library/sqlite3.rst:1277 +#: library/sqlite3.rst:1285 msgid "Set a boolean connection configuration option." msgstr "" -#: library/sqlite3.rst:1282 +#: library/sqlite3.rst:1290 msgid "" "``True`` if the configuration option should be enabled (default); ``False`` " "if it should be disabled." msgstr "" -#: library/sqlite3.rst:1290 +#: library/sqlite3.rst:1298 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1224,17 +1562,17 @@ msgid "" "backed up to disk." msgstr "" -#: library/sqlite3.rst:1296 +#: library/sqlite3.rst:1304 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: library/sqlite3.rst:1304 +#: library/sqlite3.rst:1312 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: library/sqlite3.rst:1312 +#: library/sqlite3.rst:1320 msgid "" "Deserialize a :meth:`serialized ` database into a :class:" "`Connection`. This method causes the database connection to disconnect from " @@ -1242,96 +1580,96 @@ msgid "" "serialization contained in *data*." msgstr "" -#: library/sqlite3.rst:1318 +#: library/sqlite3.rst:1326 msgid "A serialized database." msgstr "" -#: library/sqlite3.rst:1321 +#: library/sqlite3.rst:1329 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: library/sqlite3.rst:1325 +#: library/sqlite3.rst:1333 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: library/sqlite3.rst:1329 +#: library/sqlite3.rst:1337 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: library/sqlite3.rst:1332 +#: library/sqlite3.rst:1340 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: library/sqlite3.rst:1337 +#: library/sqlite3.rst:1345 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: library/sqlite3.rst:1344 +#: library/sqlite3.rst:1352 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -#: library/sqlite3.rst:1347 +#: library/sqlite3.rst:1355 msgid "" "``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" "mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" "meth:`rollback` to close transactions." msgstr "" -#: library/sqlite3.rst:1351 +#: library/sqlite3.rst:1359 msgid "This is the recommended value of :attr:`!autocommit`." msgstr "" -#: library/sqlite3.rst:1353 +#: library/sqlite3.rst:1361 msgid "" "``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" "`rollback` have no effect in this mode." msgstr "" -#: library/sqlite3.rst:1356 +#: library/sqlite3.rst:1364 msgid "" ":data:`LEGACY_TRANSACTION_CONTROL`: Pre-Python 3.12 (non-:pep:`249`-" "compliant) transaction control. See :attr:`isolation_level` for more details." msgstr "" -#: library/sqlite3.rst:1360 +#: library/sqlite3.rst:1368 msgid "This is currently the default value of :attr:`!autocommit`." msgstr "" -#: library/sqlite3.rst:1362 +#: library/sqlite3.rst:1370 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -#: library/sqlite3.rst:1365 +#: library/sqlite3.rst:1373 msgid "See :ref:`sqlite3-transaction-control-autocommit` for more details." msgstr "" -#: library/sqlite3.rst:1369 +#: library/sqlite3.rst:1377 msgid "" "The :attr:`isolation_level` attribute has no effect unless :attr:" "`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -#: library/sqlite3.rst:1376 +#: library/sqlite3.rst:1384 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: library/sqlite3.rst:1379 +#: library/sqlite3.rst:1387 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: library/sqlite3.rst:1386 +#: library/sqlite3.rst:1394 msgid "" "Controls the :ref:`legacy transaction handling mode ` of :mod:`!sqlite3`. If set to ``None``, " @@ -1341,13 +1679,13 @@ msgid "" "` is performed." msgstr "" -#: library/sqlite3.rst:1394 +#: library/sqlite3.rst:1402 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: library/sqlite3.rst:1399 +#: library/sqlite3.rst:1407 msgid "" "Using :attr:`autocommit` to control transaction handling is recommended over " "using :attr:`!isolation_level`. :attr:`!isolation_level` has no effect " @@ -1355,7 +1693,7 @@ msgid "" "default)." msgstr "" -#: library/sqlite3.rst:1406 +#: library/sqlite3.rst:1414 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " "from this connection. Assigning to this attribute does not affect the :attr:" @@ -1364,32 +1702,32 @@ msgid "" "`tuple`." msgstr "" -#: library/sqlite3.rst:1694 library/sqlite3.rst:1717 +#: library/sqlite3.rst:1713 library/sqlite3.rst:1736 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "" -#: library/sqlite3.rst:1417 +#: library/sqlite3.rst:1425 msgid "" "A :term:`callable` that accepts a :class:`bytes` parameter and returns a " "text representation of it. The callable is invoked for SQLite values with " "the ``TEXT`` data type. By default, this attribute is set to :class:`str`." msgstr "" -#: library/sqlite3.rst:1422 +#: library/sqlite3.rst:1430 msgid "See :ref:`sqlite3-howto-encoding` for more details." msgstr "" -#: library/sqlite3.rst:1426 +#: library/sqlite3.rst:1434 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: library/sqlite3.rst:1433 +#: library/sqlite3.rst:1441 msgid "Cursor objects" msgstr "" -#: library/sqlite3.rst:1435 +#: library/sqlite3.rst:1443 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " @@ -1397,39 +1735,48 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: library/sqlite3.rst:1442 +#: library/sqlite3.rst:1450 msgid "" "Cursor objects are :term:`iterators `, meaning that if you :meth:" "`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " "to fetch the resulting rows:" msgstr "" -#: library/sqlite3.rst:1467 +#: library/sqlite3.rst:1461 +msgid "" +"for row in cur.execute(\"SELECT t FROM data\"):\n" +" print(row)" +msgstr "" + +#: library/sqlite3.rst:1475 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: library/sqlite3.rst:1474 +#: library/sqlite3.rst:1482 msgid "" "Execute a single SQL statement, optionally binding Python values using :ref:" "`placeholders `." msgstr "" -#: library/sqlite3.rst:1478 +#: library/sqlite3.rst:1486 msgid "A single SQL statement." msgstr "" -#: library/sqlite3.rst:1481 +#: library/sqlite3.rst:1489 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: library/sqlite3.rst:1488 -msgid "If *sql* contains more than one SQL statement." +#: library/sqlite3.rst:1496 +msgid "" +"When *sql* contains more than one SQL statement. When :ref:`named " +"placeholders ` are used and *parameters* is a sequence " +"instead of a :class:`dict`." msgstr "" -#: library/sqlite3.rst:1491 +#: library/sqlite3.rst:1501 msgid "" "If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" "attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " @@ -1437,59 +1784,69 @@ msgid "" "transaction, a transaction is implicitly opened before executing *sql*." msgstr "" -#: library/sqlite3.rst:1500 +#: library/sqlite3.rst:1510 msgid "" -":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" -"`dict`. Starting with Python 3.14, :exc:`ProgrammingError` will be raised " -"instead." +"`dict`." msgstr "" -#: library/sqlite3.rst:1506 +#: library/sqlite3.rst:1514 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: library/sqlite3.rst:1510 +#: library/sqlite3.rst:1518 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: library/sqlite3.rst:1514 +#: library/sqlite3.rst:1522 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: library/sqlite3.rst:1516 +#: library/sqlite3.rst:1524 msgid "A single SQL DML statement." msgstr "" -#: library/sqlite3.rst:1519 +#: library/sqlite3.rst:1527 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: library/sqlite3.rst:1525 +#: library/sqlite3.rst:1533 msgid "" -"If *sql* contains more than one SQL statement, or is not a DML statement." +"When *sql* contains more than one SQL statement or is not a DML statement, " +"When :ref:`named placeholders ` are used and the items " +"in *parameters* are sequences instead of :class:`dict`\\s." msgstr "" -#: library/sqlite3.rst:1542 +#: library/sqlite3.rst:1541 +msgid "" +"rows = [\n" +" (\"row1\",),\n" +" (\"row2\",),\n" +"]\n" +"# cur is an sqlite3.Cursor object\n" +"cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" +msgstr "" + +#: library/sqlite3.rst:1556 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: library/sqlite3.rst:1549 +#: library/sqlite3.rst:1563 msgid "" -":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and the items in *parameters* are sequences instead " -"of :class:`dict`\\s. Starting with Python 3.14, :exc:`ProgrammingError` will " -"be raised instead." +"of :class:`dict`\\s." msgstr "" -#: library/sqlite3.rst:1558 +#: library/sqlite3.rst:1570 msgid "" "Execute the SQL statements in *sql_script*. If the :attr:`~Connection." "autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " @@ -1498,24 +1855,36 @@ msgid "" "added to *sql_script*." msgstr "" -#: library/sqlite3.rst:1566 +#: library/sqlite3.rst:1578 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: library/sqlite3.rst:1583 +#: library/sqlite3.rst:1582 +msgid "" +"# cur is an sqlite3.Cursor object\n" +"cur.executescript(\"\"\"\n" +" BEGIN;\n" +" CREATE TABLE person(firstname, lastname, age);\n" +" CREATE TABLE book(title, author, published);\n" +" CREATE TABLE publisher(name, address);\n" +" COMMIT;\n" +"\"\"\")" +msgstr "" + +#: library/sqlite3.rst:1595 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: library/sqlite3.rst:1591 +#: library/sqlite3.rst:1603 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: library/sqlite3.rst:1594 +#: library/sqlite3.rst:1606 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -1523,7 +1892,7 @@ msgid "" "available are returned." msgstr "" -#: library/sqlite3.rst:1600 +#: library/sqlite3.rst:1612 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -1531,36 +1900,44 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: library/sqlite3.rst:1607 +#: library/sqlite3.rst:1617 +msgid "Negative *size* values are rejected by raising :exc:`ValueError`." +msgstr "" + +#: library/sqlite3.rst:1622 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: library/sqlite3.rst:1614 +#: library/sqlite3.rst:1629 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: library/sqlite3.rst:1616 +#: library/sqlite3.rst:1631 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: library/sqlite3.rst:1625 +#: library/sqlite3.rst:1640 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: library/sqlite3.rst:1629 +#: library/sqlite3.rst:1644 msgid "" "Read/write attribute that controls the number of rows returned by :meth:" "`fetchmany`. The default value is 1 which means a single row would be " "fetched per call." msgstr "" -#: library/sqlite3.rst:1634 +#: library/sqlite3.rst:1647 +msgid "Negative values are rejected by raising :exc:`ValueError`." +msgstr "" + +#: library/sqlite3.rst:1652 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " "belonging to the cursor. A :class:`Cursor` object created by calling :meth:" @@ -1568,18 +1945,27 @@ msgid "" "that refers to *con*:" msgstr "" -#: library/sqlite3.rst:1648 +#: library/sqlite3.rst:1657 +msgid "" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> cur = con.cursor()\n" +">>> cur.connection == con\n" +"True\n" +">>> con.close()" +msgstr "" + +#: library/sqlite3.rst:1667 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: library/sqlite3.rst:1652 +#: library/sqlite3.rst:1671 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: library/sqlite3.rst:1656 +#: library/sqlite3.rst:1675 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -1589,15 +1975,15 @@ msgid "" "``None``." msgstr "" -#: library/sqlite3.rst:1664 +#: library/sqlite3.rst:1683 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: library/sqlite3.rst:1666 +#: library/sqlite3.rst:1685 msgid "Added support for the ``REPLACE`` statement." msgstr "" -#: library/sqlite3.rst:1671 +#: library/sqlite3.rst:1690 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -1607,7 +1993,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: library/sqlite3.rst:1682 +#: library/sqlite3.rst:1701 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -1616,18 +2002,18 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: library/sqlite3.rst:1689 +#: library/sqlite3.rst:1708 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" "Cursor` was created. Assigning to this attribute does not affect :attr:" "`Connection.row_factory` of the parent connection." msgstr "" -#: library/sqlite3.rst:1705 +#: library/sqlite3.rst:1724 msgid "Row objects" msgstr "" -#: library/sqlite3.rst:1709 +#: library/sqlite3.rst:1728 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -1635,28 +2021,28 @@ msgid "" "index." msgstr "" -#: library/sqlite3.rst:1714 +#: library/sqlite3.rst:1733 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: library/sqlite3.rst:1721 +#: library/sqlite3.rst:1740 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -#: library/sqlite3.rst:1725 +#: library/sqlite3.rst:1744 msgid "Added support of slicing." msgstr "" -#: library/sqlite3.rst:1732 +#: library/sqlite3.rst:1751 msgid "Blob objects" msgstr "" -#: library/sqlite3.rst:1738 +#: library/sqlite3.rst:1757 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " "write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" @@ -1664,24 +2050,46 @@ msgid "" "and :term:`slices ` for direct access to the blob data." msgstr "" -#: library/sqlite3.rst:1743 +#: library/sqlite3.rst:1762 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: library/sqlite3.rst:1773 +#: library/sqlite3.rst:1765 +msgid "" +"con = sqlite3.connect(\":memory:\")\n" +"con.execute(\"CREATE TABLE test(blob_col blob)\")\n" +"con.execute(\"INSERT INTO test(blob_col) VALUES(zeroblob(13))\")\n" +"\n" +"# Write to our blob, using two write operations:\n" +"with con.blobopen(\"test\", \"blob_col\", 1) as blob:\n" +" blob.write(b\"hello, \")\n" +" blob.write(b\"world.\")\n" +" # Modify the first and last bytes of our blob\n" +" blob[0] = ord(\"H\")\n" +" blob[-1] = ord(\"!\")\n" +"\n" +"# Read the contents of our blob\n" +"with con.blobopen(\"test\", \"blob_col\", 1) as blob:\n" +" greeting = blob.read()\n" +"\n" +"print(greeting) # outputs \"b'Hello, world!'\"\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:1793 msgid "Close the blob." msgstr "" -#: library/sqlite3.rst:1775 +#: library/sqlite3.rst:1795 msgid "" "The blob will be unusable from this point onward. An :class:`~sqlite3." "Error` (or subclass) exception will be raised if any further operation is " "attempted with the blob." msgstr "" -#: library/sqlite3.rst:1781 +#: library/sqlite3.rst:1801 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " @@ -1689,18 +2097,18 @@ msgid "" "`~Blob.read` will read until the end of the blob." msgstr "" -#: library/sqlite3.rst:1789 +#: library/sqlite3.rst:1809 msgid "" "Write *data* to the blob at the current offset. This function cannot change " "the blob length. Writing beyond the end of the blob will raise :exc:" "`ValueError`." msgstr "" -#: library/sqlite3.rst:1795 +#: library/sqlite3.rst:1815 msgid "Return the current access position of the blob." msgstr "" -#: library/sqlite3.rst:1799 +#: library/sqlite3.rst:1819 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -1708,26 +2116,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: library/sqlite3.rst:1807 +#: library/sqlite3.rst:1827 msgid "PrepareProtocol objects" msgstr "" -#: library/sqlite3.rst:1811 +#: library/sqlite3.rst:1831 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: library/sqlite3.rst:1819 +#: library/sqlite3.rst:1839 msgid "Exceptions" msgstr "" -#: library/sqlite3.rst:1821 +#: library/sqlite3.rst:1841 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: library/sqlite3.rst:1825 +#: library/sqlite3.rst:1845 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -1735,39 +2143,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: library/sqlite3.rst:1832 +#: library/sqlite3.rst:1852 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: library/sqlite3.rst:1836 +#: library/sqlite3.rst:1856 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: library/sqlite3.rst:1841 +#: library/sqlite3.rst:1861 msgid "" "The numeric error code from the `SQLite API `_" msgstr "" -#: library/sqlite3.rst:1848 +#: library/sqlite3.rst:1868 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: library/sqlite3.rst:1855 +#: library/sqlite3.rst:1875 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: library/sqlite3.rst:1862 +#: library/sqlite3.rst:1882 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -1775,14 +2183,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: library/sqlite3.rst:1869 +#: library/sqlite3.rst:1889 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: library/sqlite3.rst:1875 +#: library/sqlite3.rst:1895 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -1790,20 +2198,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: library/sqlite3.rst:1883 +#: library/sqlite3.rst:1903 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: library/sqlite3.rst:1888 +#: library/sqlite3.rst:1908 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: library/sqlite3.rst:1895 +#: library/sqlite3.rst:1915 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " @@ -1811,7 +2219,7 @@ msgid "" "`DatabaseError`." msgstr "" -#: library/sqlite3.rst:1902 +#: library/sqlite3.rst:1922 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -1820,78 +2228,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: library/sqlite3.rst:1912 +#: library/sqlite3.rst:1932 msgid "SQLite and Python types" msgstr "" -#: library/sqlite3.rst:1914 +#: library/sqlite3.rst:1934 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: library/sqlite3.rst:1917 +#: library/sqlite3.rst:1937 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: library/sqlite3.rst:1937 +#: library/sqlite3.rst:1957 msgid "Python type" msgstr "" -#: library/sqlite3.rst:1937 +#: library/sqlite3.rst:1957 msgid "SQLite type" msgstr "" -#: library/sqlite3.rst:1939 +#: library/sqlite3.rst:1959 msgid "``None``" msgstr "" -#: library/sqlite3.rst:1939 +#: library/sqlite3.rst:1959 msgid "``NULL``" msgstr "" -#: library/sqlite3.rst:1941 +#: library/sqlite3.rst:1961 msgid ":class:`int`" msgstr "" -#: library/sqlite3.rst:1941 +#: library/sqlite3.rst:1961 msgid "``INTEGER``" msgstr "" -#: library/sqlite3.rst:1943 +#: library/sqlite3.rst:1963 msgid ":class:`float`" msgstr "" -#: library/sqlite3.rst:1943 +#: library/sqlite3.rst:1963 msgid "``REAL``" msgstr "" -#: library/sqlite3.rst:1928 +#: library/sqlite3.rst:1948 msgid ":class:`str`" msgstr "" -#: library/sqlite3.rst:1945 +#: library/sqlite3.rst:1965 msgid "``TEXT``" msgstr "" -#: library/sqlite3.rst:1948 +#: library/sqlite3.rst:1968 msgid ":class:`bytes`" msgstr "" -#: library/sqlite3.rst:1948 +#: library/sqlite3.rst:1968 msgid "``BLOB``" msgstr "" -#: library/sqlite3.rst:1934 +#: library/sqlite3.rst:1954 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: library/sqlite3.rst:1945 +#: library/sqlite3.rst:1965 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: library/sqlite3.rst:1951 +#: library/sqlite3.rst:1971 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -1900,47 +2308,47 @@ msgid "" "converters>`." msgstr "" -#: library/sqlite3.rst:1961 +#: library/sqlite3.rst:1981 msgid "Default adapters and converters (deprecated)" msgstr "" -#: library/sqlite3.rst:1965 +#: library/sqlite3.rst:1985 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: library/sqlite3.rst:1969 +#: library/sqlite3.rst:1989 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: library/sqlite3.rst:1971 +#: library/sqlite3.rst:1991 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: library/sqlite3.rst:1973 +#: library/sqlite3.rst:1993 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: library/sqlite3.rst:1975 +#: library/sqlite3.rst:1995 msgid "" "A converter for :ref:`declared ` \"date\" types to :" "class:`datetime.date` objects." msgstr "" -#: library/sqlite3.rst:1977 +#: library/sqlite3.rst:1997 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: library/sqlite3.rst:1983 +#: library/sqlite3.rst:2003 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -1948,38 +2356,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: library/sqlite3.rst:1996 +#: library/sqlite3.rst:2016 msgid "Command-line interface" msgstr "" -#: library/sqlite3.rst:1998 +#: library/sqlite3.rst:2018 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: library/sqlite3.rst:2005 +#: library/sqlite3.rst:2023 +msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" +msgstr "" + +#: library/sqlite3.rst:2025 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: library/sqlite3.rst:2011 +#: library/sqlite3.rst:2031 msgid "Print CLI help." msgstr "" -#: library/sqlite3.rst:2015 +#: library/sqlite3.rst:2035 msgid "Print underlying SQLite library version." msgstr "" -#: library/sqlite3.rst:2023 +#: library/sqlite3.rst:2043 msgid "How-to guides" msgstr "" -#: library/sqlite3.rst:2028 +#: library/sqlite3.rst:2048 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: library/sqlite3.rst:2030 +#: library/sqlite3.rst:2050 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -1987,7 +2399,18 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: library/sqlite3.rst:2043 +#: library/sqlite3.rst:2055 +msgid "" +">>> # Never do this -- insecure!\n" +">>> symbol = input()\n" +"' OR TRUE; --\n" +">>> sql = \"SELECT * FROM stocks WHERE symbol = '%s'\" % symbol\n" +">>> print(sql)\n" +"SELECT * FROM stocks WHERE symbol = '' OR TRUE; --'\n" +">>> cur.execute(sql)" +msgstr "" + +#: library/sqlite3.rst:2063 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -1995,7 +2418,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: library/sqlite3.rst:2048 +#: library/sqlite3.rst:2068 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2006,24 +2429,45 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: library/sqlite3.rst:2085 +#: library/sqlite3.rst:2079 +msgid "" +"con = sqlite3.connect(\":memory:\")\n" +"cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" +"\n" +"# This is the named style used with executemany():\n" +"data = (\n" +" {\"name\": \"C\", \"year\": 1972},\n" +" {\"name\": \"Fortran\", \"year\": 1957},\n" +" {\"name\": \"Python\", \"year\": 1991},\n" +" {\"name\": \"Go\", \"year\": 2009},\n" +")\n" +"cur.executemany(\"INSERT INTO lang VALUES(:name, :year)\", data)\n" +"\n" +"# This is the qmark style used in a SELECT query:\n" +"params = (1972,)\n" +"cur.execute(\"SELECT * FROM lang WHERE first_appeared = ?\", params)\n" +"print(cur.fetchall())\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:2106 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: library/sqlite3.rst:2092 +#: library/sqlite3.rst:2113 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: library/sqlite3.rst:2094 +#: library/sqlite3.rst:2115 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: library/sqlite3.rst:2098 +#: library/sqlite3.rst:2119 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2033,11 +2477,11 @@ msgid "" "custom adapter functions." msgstr "" -#: library/sqlite3.rst:2110 +#: library/sqlite3.rst:2131 msgid "How to write adaptable objects" msgstr "" -#: library/sqlite3.rst:2112 +#: library/sqlite3.rst:2133 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2047,84 +2491,208 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: library/sqlite3.rst:2143 +#: library/sqlite3.rst:2141 +msgid "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x, self.y = x, y\n" +"\n" +" def __conform__(self, protocol):\n" +" if protocol is sqlite3.PrepareProtocol:\n" +" return f\"{self.x};{self.y}\"\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"cur = con.cursor()\n" +"\n" +"cur.execute(\"SELECT ?\", (Point(4.0, -3.2),))\n" +"print(cur.fetchone()[0])\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:2165 msgid "How to register adapter callables" msgstr "" -#: library/sqlite3.rst:2145 +#: library/sqlite3.rst:2167 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: library/sqlite3.rst:2175 +#: library/sqlite3.rst:2171 +msgid "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x, self.y = x, y\n" +"\n" +"def adapt_point(point):\n" +" return f\"{point.x};{point.y}\"\n" +"\n" +"sqlite3.register_adapter(Point, adapt_point)\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"cur = con.cursor()\n" +"\n" +"cur.execute(\"SELECT ?\", (Point(1.0, 2.5),))\n" +"print(cur.fetchone()[0])\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:2198 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: library/sqlite3.rst:2177 +#: library/sqlite3.rst:2200 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: library/sqlite3.rst:2182 +#: library/sqlite3.rst:2205 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: library/sqlite3.rst:2185 +#: library/sqlite3.rst:2208 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: library/sqlite3.rst:2190 +#: library/sqlite3.rst:2213 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: library/sqlite3.rst:2199 +#: library/sqlite3.rst:2216 +msgid "" +"def convert_point(s):\n" +" x, y = map(float, s.split(b\";\"))\n" +" return Point(x, y)" +msgstr "" + +#: library/sqlite3.rst:2222 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: library/sqlite3.rst:2203 +#: library/sqlite3.rst:2226 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: library/sqlite3.rst:2204 +#: library/sqlite3.rst:2227 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: library/sqlite3.rst:2205 +#: library/sqlite3.rst:2228 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: library/sqlite3.rst:2209 +#: library/sqlite3.rst:2232 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: library/sqlite3.rst:2260 +#: library/sqlite3.rst:2234 +msgid "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x, self.y = x, y\n" +"\n" +" def __repr__(self):\n" +" return f\"Point({self.x}, {self.y})\"\n" +"\n" +"def adapt_point(point):\n" +" return f\"{point.x};{point.y}\"\n" +"\n" +"def convert_point(s):\n" +" x, y = list(map(float, s.split(b\";\")))\n" +" return Point(x, y)\n" +"\n" +"# Register the adapter and converter\n" +"sqlite3.register_adapter(Point, adapt_point)\n" +"sqlite3.register_converter(\"point\", convert_point)\n" +"\n" +"# 1) Parse using declared types\n" +"p = Point(4.0, -3.2)\n" +"con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_DECLTYPES)\n" +"cur = con.execute(\"CREATE TABLE test(p point)\")\n" +"\n" +"cur.execute(\"INSERT INTO test(p) VALUES(?)\", (p,))\n" +"cur.execute(\"SELECT p FROM test\")\n" +"print(\"with declared types:\", cur.fetchone()[0])\n" +"cur.close()\n" +"con.close()\n" +"\n" +"# 2) Parse using column names\n" +"con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)\n" +"cur = con.execute(\"CREATE TABLE test(p)\")\n" +"\n" +"cur.execute(\"INSERT INTO test(p) VALUES(?)\", (p,))\n" +"cur.execute('SELECT p AS \"p [point]\" FROM test')\n" +"print(\"with column names:\", cur.fetchone()[0])\n" +"cur.close()\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:2285 msgid "Adapter and converter recipes" msgstr "" -#: library/sqlite3.rst:2262 +#: library/sqlite3.rst:2287 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: library/sqlite3.rst:2324 +#: library/sqlite3.rst:2289 +msgid "" +"import datetime\n" +"import sqlite3\n" +"\n" +"def adapt_date_iso(val):\n" +" \"\"\"Adapt datetime.date to ISO 8601 date.\"\"\"\n" +" return val.isoformat()\n" +"\n" +"def adapt_datetime_iso(val):\n" +" \"\"\"Adapt datetime.datetime to timezone-naive ISO 8601 date.\"\"\"\n" +" return val.replace(tzinfo=None).isoformat()\n" +"\n" +"def adapt_datetime_epoch(val):\n" +" \"\"\"Adapt datetime.datetime to Unix timestamp.\"\"\"\n" +" return int(val.timestamp())\n" +"\n" +"sqlite3.register_adapter(datetime.date, adapt_date_iso)\n" +"sqlite3.register_adapter(datetime.datetime, adapt_datetime_iso)\n" +"sqlite3.register_adapter(datetime.datetime, adapt_datetime_epoch)\n" +"\n" +"def convert_date(val):\n" +" \"\"\"Convert ISO 8601 date to datetime.date object.\"\"\"\n" +" return datetime.date.fromisoformat(val.decode())\n" +"\n" +"def convert_datetime(val):\n" +" \"\"\"Convert ISO 8601 datetime to datetime.datetime object.\"\"\"\n" +" return datetime.datetime.fromisoformat(val.decode())\n" +"\n" +"def convert_timestamp(val):\n" +" \"\"\"Convert Unix epoch timestamp to datetime.datetime object.\"\"\"\n" +" return datetime.datetime.fromtimestamp(int(val))\n" +"\n" +"sqlite3.register_converter(\"date\", convert_date)\n" +"sqlite3.register_converter(\"datetime\", convert_datetime)\n" +"sqlite3.register_converter(\"timestamp\", convert_timestamp)" +msgstr "" + +#: library/sqlite3.rst:2349 msgid "How to use connection shortcut methods" msgstr "" -#: library/sqlite3.rst:2326 +#: library/sqlite3.rst:2351 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -2136,11 +2704,35 @@ msgid "" "object." msgstr "" -#: library/sqlite3.rst:2367 +#: library/sqlite3.rst:2360 +msgid "" +"# Create and fill the table.\n" +"con = sqlite3.connect(\":memory:\")\n" +"con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" +"data = [\n" +" (\"C++\", 1985),\n" +" (\"Objective-C\", 1984),\n" +"]\n" +"con.executemany(\"INSERT INTO lang(name, first_appeared) VALUES(?, ?)\", " +"data)\n" +"\n" +"# Print the table contents\n" +"for row in con.execute(\"SELECT name, first_appeared FROM lang\"):\n" +" print(row)\n" +"\n" +"print(\"I just deleted\", con.execute(\"DELETE FROM lang\").rowcount, " +"\"rows\")\n" +"\n" +"# close() is not a shortcut method and it's not called automatically;\n" +"# the connection object should be closed manually\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:2392 msgid "How to use the connection context manager" msgstr "" -#: library/sqlite3.rst:2369 +#: library/sqlite3.rst:2394 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2152,60 +2744,115 @@ msgid "" "rolling back." msgstr "" -#: library/sqlite3.rst:2380 +#: library/sqlite3.rst:2405 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: library/sqlite3.rst:2385 +#: library/sqlite3.rst:2410 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection. If you need a closing context manager, consider using :meth:" "`contextlib.closing`." msgstr "" -#: library/sqlite3.rst:2419 +#: library/sqlite3.rst:2414 +msgid "" +"con = sqlite3.connect(\":memory:\")\n" +"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " +"UNIQUE)\")\n" +"\n" +"# Successful, con.commit() is called automatically afterwards\n" +"with con:\n" +" con.execute(\"INSERT INTO lang(name) VALUES(?)\", (\"Python\",))\n" +"\n" +"# con.rollback() is called after the with block finishes with an exception,\n" +"# the exception is still raised and must be caught\n" +"try:\n" +" with con:\n" +" con.execute(\"INSERT INTO lang(name) VALUES(?)\", (\"Python\",))\n" +"except sqlite3.IntegrityError:\n" +" print(\"couldn't add Python twice\")\n" +"\n" +"# Connection object used as context manager only commits or rollbacks " +"transactions,\n" +"# so the connection object should be closed manually\n" +"con.close()" +msgstr "" + +#: library/sqlite3.rst:2444 msgid "How to work with SQLite URIs" msgstr "" -#: library/sqlite3.rst:2421 +#: library/sqlite3.rst:2446 msgid "Some useful URI tricks include:" msgstr "" -#: library/sqlite3.rst:2423 +#: library/sqlite3.rst:2448 msgid "Open a database in read-only mode:" msgstr "" -#: library/sqlite3.rst:2432 +#: library/sqlite3.rst:2450 +msgid "" +">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" +">>> con.execute(\"CREATE TABLE readonly(data)\")\n" +"Traceback (most recent call last):\n" +"OperationalError: attempt to write a readonly database\n" +">>> con.close()" +msgstr "" + +#: library/sqlite3.rst:2458 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: library/sqlite3.rst:2442 +#: library/sqlite3.rst:2461 +msgid "" +">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" +"Traceback (most recent call last):\n" +"OperationalError: unable to open database file" +msgstr "" + +#: library/sqlite3.rst:2468 msgid "Create a shared named in-memory database:" msgstr "" -#: library/sqlite3.rst:2456 +#: library/sqlite3.rst:2470 +msgid "" +"db = \"file:mem1?mode=memory&cache=shared\"\n" +"con1 = sqlite3.connect(db, uri=True)\n" +"con2 = sqlite3.connect(db, uri=True)\n" +"with con1:\n" +" con1.execute(\"CREATE TABLE shared(data)\")\n" +" con1.execute(\"INSERT INTO shared VALUES(28)\")\n" +"res = con2.execute(\"SELECT data FROM shared\")\n" +"assert res.fetchone() == (28,)\n" +"\n" +"con1.close()\n" +"con2.close()" +msgstr "" + +#: library/sqlite3.rst:2484 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: library/sqlite3.rst:2465 +#: library/sqlite3.rst:2493 msgid "How to create and use row factories" msgstr "" -#: library/sqlite3.rst:2467 +#: library/sqlite3.rst:2495 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: library/sqlite3.rst:2472 +#: library/sqlite3.rst:2500 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -2213,7 +2860,7 @@ msgid "" "use the same row factory." msgstr "" -#: library/sqlite3.rst:2477 +#: library/sqlite3.rst:2505 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -2221,11 +2868,32 @@ msgid "" "attribute:" msgstr "" -#: library/sqlite3.rst:2487 +#: library/sqlite3.rst:2510 +msgid "" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> con.row_factory = sqlite3.Row" +msgstr "" + +#: library/sqlite3.rst:2515 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: library/sqlite3.rst:2504 +#: library/sqlite3.rst:2517 +msgid "" +">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" +">>> row = res.fetchone()\n" +">>> row.keys()\n" +"['name', 'radius']\n" +">>> row[0] # Access by index.\n" +"'Earth'\n" +">>> row[\"name\"] # Access by name.\n" +"'Earth'\n" +">>> row[\"RADIUS\"] # Column names are case-insensitive.\n" +"6378\n" +">>> con.close()" +msgstr "" + +#: library/sqlite3.rst:2533 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -2233,37 +2901,79 @@ msgid "" "alias``." msgstr "" -#: library/sqlite3.rst:2509 +#: library/sqlite3.rst:2538 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: library/sqlite3.rst:2518 +#: library/sqlite3.rst:2541 +msgid "" +"def dict_factory(cursor, row):\n" +" fields = [column[0] for column in cursor.description]\n" +" return {key: value for key, value in zip(fields, row)}" +msgstr "" + +#: library/sqlite3.rst:2547 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: library/sqlite3.rst:2528 +#: library/sqlite3.rst:2549 +msgid "" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> con.row_factory = dict_factory\n" +">>> for row in con.execute(\"SELECT 1 AS a, 2 AS b\"):\n" +"... print(row)\n" +"{'a': 1, 'b': 2}\n" +">>> con.close()" +msgstr "" + +#: library/sqlite3.rst:2558 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: library/sqlite3.rst:2539 +#: library/sqlite3.rst:2560 +msgid "" +"from collections import namedtuple\n" +"\n" +"def namedtuple_factory(cursor, row):\n" +" fields = [column[0] for column in cursor.description]\n" +" cls = namedtuple(\"Row\", fields)\n" +" return cls._make(row)" +msgstr "" + +#: library/sqlite3.rst:2569 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: library/sqlite3.rst:2554 +#: library/sqlite3.rst:2571 +msgid "" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> con.row_factory = namedtuple_factory\n" +">>> cur = con.execute(\"SELECT 1 AS a, 2 AS b\")\n" +">>> row = cur.fetchone()\n" +">>> row\n" +"Row(a=1, b=2)\n" +">>> row[0] # Indexed access.\n" +"1\n" +">>> row.b # Attribute access.\n" +"2\n" +">>> con.close()" +msgstr "" + +#: library/sqlite3.rst:2585 msgid "" "With some adjustments, the above recipe can be adapted to use a :class:" "`~dataclasses.dataclass`, or any other custom class, instead of a :class:" "`~collections.namedtuple`." msgstr "" -#: library/sqlite3.rst:2562 +#: library/sqlite3.rst:2593 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: library/sqlite3.rst:2564 +#: library/sqlite3.rst:2595 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " @@ -2271,7 +2981,7 @@ msgid "" "`~Connection.text_factory` to handle such cases." msgstr "" -#: library/sqlite3.rst:2570 +#: library/sqlite3.rst:2601 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " @@ -2282,31 +2992,39 @@ msgid "" "text using this :attr:`~Connection.text_factory`:" msgstr "" -#: library/sqlite3.rst:2583 +#: library/sqlite3.rst:2610 +msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" +msgstr "" + +#: library/sqlite3.rst:2614 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: library/sqlite3.rst:2592 +#: library/sqlite3.rst:2617 +msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" +msgstr "" + +#: library/sqlite3.rst:2623 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: library/sqlite3.rst:2597 +#: library/sqlite3.rst:2628 msgid ":ref:`unicode-howto`" msgstr "" -#: library/sqlite3.rst:2603 +#: library/sqlite3.rst:2634 msgid "Explanation" msgstr "" -#: library/sqlite3.rst:2609 +#: library/sqlite3.rst:2640 msgid "Transaction control" msgstr "" -#: library/sqlite3.rst:2611 +#: library/sqlite3.rst:2642 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -2314,24 +3032,24 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: library/sqlite3.rst:2620 +#: library/sqlite3.rst:2651 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: library/sqlite3.rst:2622 +#: library/sqlite3.rst:2653 msgid "" "The recommended way of controlling transaction behaviour is through the :" "attr:`Connection.autocommit` attribute, which should preferably be set using " "the *autocommit* parameter of :func:`connect`." msgstr "" -#: library/sqlite3.rst:2627 +#: library/sqlite3.rst:2658 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: library/sqlite3.rst:2631 +#: library/sqlite3.rst:2662 msgid "" ":mod:`!sqlite3` ensures that a transaction is always open, so :func:" "`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " @@ -2340,21 +3058,21 @@ msgid "" "when opening transactions." msgstr "" -#: library/sqlite3.rst:2636 +#: library/sqlite3.rst:2667 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: library/sqlite3.rst:2637 +#: library/sqlite3.rst:2668 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: library/sqlite3.rst:2638 +#: library/sqlite3.rst:2669 msgid "" "An implicit rollback is performed if the database is :meth:`~Connection." "close`-ed with pending changes." msgstr "" -#: library/sqlite3.rst:2641 +#: library/sqlite3.rst:2672 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " @@ -2363,25 +3081,25 @@ msgid "" "in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: library/sqlite3.rst:2649 +#: library/sqlite3.rst:2680 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " "control behaviour to the :attr:`Connection.isolation_level` attribute. See :" "ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: library/sqlite3.rst:2658 +#: library/sqlite3.rst:2689 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: library/sqlite3.rst:2662 +#: library/sqlite3.rst:2693 msgid "" "The recommended way of controlling transactions is via the :attr:" "`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" "autocommit`." msgstr "" -#: library/sqlite3.rst:2666 +#: library/sqlite3.rst:2697 msgid "" "If :attr:`Connection.autocommit` is set to :data:" "`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " @@ -2389,7 +3107,7 @@ msgid "" "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: library/sqlite3.rst:2672 +#: library/sqlite3.rst:2703 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -2403,7 +3121,7 @@ msgid "" "attribute." msgstr "" -#: library/sqlite3.rst:2685 +#: library/sqlite3.rst:2716 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -2413,33 +3131,33 @@ msgid "" "in_transaction` attribute." msgstr "" -#: library/sqlite3.rst:2693 +#: library/sqlite3.rst:2724 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: library/sqlite3.rst:2697 +#: library/sqlite3.rst:2728 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: library/sqlite3.rst:2701 +#: library/sqlite3.rst:2732 msgid "" "The recommended way of controlling transactions is now via the :attr:" "`~Connection.autocommit` attribute." msgstr "" -#: library/sqlite3.rst:1469 +#: library/sqlite3.rst:1477 msgid "? (question mark)" msgstr "" -#: library/sqlite3.rst:1470 +#: library/sqlite3.rst:1478 msgid "in SQL statements" msgstr "" -#: library/sqlite3.rst:1470 +#: library/sqlite3.rst:1478 msgid ": (colon)" msgstr "" diff --git a/library/ssl.po b/library/ssl.po index 497da27c..7c3c0e39 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/ssl.rst:2 -msgid ":mod:`ssl` --- TLS/SSL wrapper for socket objects" +msgid ":mod:`!ssl` --- TLS/SSL wrapper for socket objects" msgstr "" #: library/ssl.rst:10 @@ -29,12 +30,18 @@ msgid "" "This module provides access to Transport Layer Security (often known as " "\"Secure Sockets Layer\") encryption and peer authentication facilities for " "network sockets, both client-side and server-side. This module uses the " -"OpenSSL library. It is available on all modern Unix systems, Windows, macOS, " -"and probably additional platforms, as long as OpenSSL is installed on that " -"platform." +"OpenSSL library." msgstr "" -#: library/ssl.rst:26 +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/ssl.rst:27 msgid "" "Some behavior may be platform dependent, since calls are made to the " "operating system socket APIs. The installed version of OpenSSL may also " @@ -42,107 +49,146 @@ msgid "" "version 1.1.1." msgstr "" -#: library/ssl.rst:32 +#: library/ssl.rst:33 msgid "" "Don't use this module without reading the :ref:`ssl-security`. Doing so may " "lead to a false sense of security, as the default settings of the ssl module " "are not necessarily appropriate for your application." msgstr "" -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#: library/ssl.rst:471 includes/wasm-notavail.rst:3 +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -#: library/ssl.rst:38 +#: library/ssl.rst:39 msgid "" "This section documents the objects and functions in the ``ssl`` module; for " "more general information about TLS, SSL, and certificates, the reader is " "referred to the documents in the \"See Also\" section at the bottom." msgstr "" -#: library/ssl.rst:42 +#: library/ssl.rst:43 msgid "" "This module provides a class, :class:`ssl.SSLSocket`, which is derived from " "the :class:`socket.socket` type, and provides a socket-like wrapper that " "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " -"certificate of the other side of the connection, and :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection." +"certificate of the other side of the connection, :meth:`cipher`, which " +"retrieves the cipher being used for the secure connection or :meth:" +"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"certificate chain." msgstr "" -#: library/ssl.rst:49 +#: library/ssl.rst:52 msgid "" "For more sophisticated applications, the :class:`ssl.SSLContext` class helps " "manage settings and certificates, which can then be inherited by SSL sockets " "created through the :meth:`SSLContext.wrap_socket` method." msgstr "" -#: library/ssl.rst:53 +#: library/ssl.rst:56 msgid "Updated to support linking with OpenSSL 1.1.0" msgstr "" -#: library/ssl.rst:58 +#: library/ssl.rst:61 msgid "" "OpenSSL 0.9.8, 1.0.0 and 1.0.1 are deprecated and no longer supported. In " "the future the ssl module will require at least OpenSSL 1.0.2 or 1.1.0." msgstr "" -#: library/ssl.rst:64 +#: library/ssl.rst:67 msgid "" ":pep:`644` has been implemented. The ssl module requires OpenSSL 1.1.1 or " "newer." msgstr "" -#: library/ssl.rst:67 +#: library/ssl.rst:70 msgid "" "Use of deprecated constants and functions result in deprecation warnings." msgstr "" -#: library/ssl.rst:71 +#: library/ssl.rst:74 msgid "Functions, Constants, and Exceptions" msgstr "" -#: library/ssl.rst:75 +#: library/ssl.rst:78 msgid "Socket creation" msgstr "" -#: library/ssl.rst:77 +#: library/ssl.rst:80 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method. The helper function :func:`create_default_context` " "returns a new context with secure default settings." msgstr "" -#: library/ssl.rst:82 +#: library/ssl.rst:85 msgid "Client socket example with default context and IPv4/IPv6 dual stack::" msgstr "" -#: library/ssl.rst:95 +#: library/ssl.rst:87 +msgid "" +"import socket\n" +"import ssl\n" +"\n" +"hostname = 'www.python.org'\n" +"context = ssl.create_default_context()\n" +"\n" +"with socket.create_connection((hostname, 443)) as sock:\n" +" with context.wrap_socket(sock, server_hostname=hostname) as ssock:\n" +" print(ssock.version())" +msgstr "" + +#: library/ssl.rst:98 msgid "Client socket example with custom context and IPv4::" msgstr "" -#: library/ssl.rst:107 +#: library/ssl.rst:100 +msgid "" +"hostname = 'www.python.org'\n" +"# PROTOCOL_TLS_CLIENT requires valid cert chain and hostname\n" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" +"context.load_verify_locations('path/to/cabundle.pem')\n" +"\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:\n" +" with context.wrap_socket(sock, server_hostname=hostname) as ssock:\n" +" print(ssock.version())" +msgstr "" + +#: library/ssl.rst:110 msgid "Server socket example listening on localhost IPv4::" msgstr "" -#: library/ssl.rst:121 +#: library/ssl.rst:112 +msgid "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" +"context.load_cert_chain('/path/to/certchain.pem', '/path/to/private.key')\n" +"\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:\n" +" sock.bind(('127.0.0.1', 8443))\n" +" sock.listen(5)\n" +" with context.wrap_socket(sock, server_side=True) as ssock:\n" +" conn, addr = ssock.accept()\n" +" ..." +msgstr "" + +#: library/ssl.rst:124 msgid "Context creation" msgstr "" -#: library/ssl.rst:123 +#: library/ssl.rst:126 msgid "" "A convenience function helps create :class:`SSLContext` objects for common " "purposes." msgstr "" -#: library/ssl.rst:128 +#: library/ssl.rst:132 msgid "" "Return a new :class:`SSLContext` object with default settings for the given " "*purpose*. The settings are chosen by the :mod:`ssl` module, and usually " @@ -150,7 +196,7 @@ msgid "" "constructor directly." msgstr "" -#: library/ssl.rst:133 +#: library/ssl.rst:137 msgid "" "*cafile*, *capath*, *cadata* represent optional CA certificates to trust for " "certificate verification, as in :meth:`SSLContext.load_verify_locations`. " @@ -158,7 +204,7 @@ msgid "" "system's default CA certificates instead." msgstr "" -#: library/ssl.rst:139 +#: library/ssl.rst:143 msgid "" "The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " @@ -170,27 +216,36 @@ msgid "" "certificates." msgstr "" -#: library/ssl.rst:148 +#: library/ssl.rst:152 msgid "" "When :attr:`~SSLContext.keylog_filename` is supported and the environment " "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " "enables key logging." msgstr "" -#: library/ssl.rst:153 +#: library/ssl.rst:156 +msgid "" +"The default settings for this context include :data:" +"`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " +"underlying OpenSSL implementation behave more like a conforming " +"implementation of :rfc:`5280`, in exchange for a small amount of " +"incompatibility with older X.509 certificates." +msgstr "" + +#: library/ssl.rst:163 msgid "" "The protocol, options, cipher and other settings may change to more " "restrictive values anytime without prior deprecation. The values represent " "a fair balance between compatibility and security." msgstr "" -#: library/ssl.rst:157 +#: library/ssl.rst:167 msgid "" "If your application needs specific settings, you should create a :class:" "`SSLContext` and apply the settings yourself." msgstr "" -#: library/ssl.rst:161 +#: library/ssl.rst:171 msgid "" "If you find that when certain older clients or servers attempt to connect " "with a :class:`SSLContext` created by this function that they get an error " @@ -201,33 +256,59 @@ msgid "" "still allow SSL 3.0 connections you can re-enable them using::" msgstr "" -#: library/ssl.rst:177 +#: library/ssl.rst:180 +msgid "" +"ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" +"ctx.options &= ~ssl.OP_NO_SSLv3" +msgstr "" + +#: library/ssl.rst:184 +msgid "" +"This context enables :data:`VERIFY_X509_STRICT` by default, which may reject " +"pre-:rfc:`5280` or malformed certificates that the underlying OpenSSL " +"implementation otherwise would accept. While disabling this is not " +"recommended, you can do so using::" +msgstr "" + +#: library/ssl.rst:189 +msgid "" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" +msgstr "" + +#: library/ssl.rst:196 msgid "RC4 was dropped from the default cipher string." msgstr "" -#: library/ssl.rst:181 +#: library/ssl.rst:200 msgid "ChaCha20/Poly1305 was added to the default cipher string." msgstr "" -#: library/ssl.rst:183 +#: library/ssl.rst:202 msgid "3DES was dropped from the default cipher string." msgstr "" -#: library/ssl.rst:187 +#: library/ssl.rst:206 msgid "Support for key logging to :envvar:`SSLKEYLOGFILE` was added." msgstr "" -#: library/ssl.rst:191 +#: library/ssl.rst:210 msgid "" "The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." msgstr "" -#: library/ssl.rst:197 +#: library/ssl.rst:216 +msgid "" +"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" +"`VERIFY_X509_STRICT` in its default verify flags." +msgstr "" + +#: library/ssl.rst:221 msgid "Exceptions" msgstr "" -#: library/ssl.rst:201 +#: library/ssl.rst:225 msgid "" "Raised to signal an error from the underlying SSL implementation (currently " "provided by the OpenSSL library). This signifies some problem in the higher-" @@ -237,85 +318,85 @@ msgid "" "OpenSSL library." msgstr "" -#: library/ssl.rst:208 +#: library/ssl.rst:232 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." msgstr "" -#: library/ssl.rst:213 +#: library/ssl.rst:237 msgid "" "A string mnemonic designating the OpenSSL submodule in which the error " "occurred, such as ``SSL``, ``PEM`` or ``X509``. The range of possible " "values depends on the OpenSSL version." msgstr "" -#: library/ssl.rst:221 +#: library/ssl.rst:245 msgid "" "A string mnemonic designating the reason this error occurred, for example " "``CERTIFICATE_VERIFY_FAILED``. The range of possible values depends on the " "OpenSSL version." msgstr "" -#: library/ssl.rst:229 +#: library/ssl.rst:253 msgid "" "A subclass of :exc:`SSLError` raised when trying to read or write and the " "SSL connection has been closed cleanly. Note that this doesn't mean that " "the underlying transport (read TCP) has been closed." msgstr "" -#: library/ssl.rst:237 +#: library/ssl.rst:261 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " "received on the underlying TCP transport before the request can be fulfilled." msgstr "" -#: library/ssl.rst:246 +#: library/ssl.rst:270 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " "sent on the underlying TCP transport before the request can be fulfilled." msgstr "" -#: library/ssl.rst:255 +#: library/ssl.rst:279 msgid "" "A subclass of :exc:`SSLError` raised when a system error was encountered " "while trying to fulfill an operation on a SSL socket. Unfortunately, there " "is no easy way to inspect the original errno number." msgstr "" -#: library/ssl.rst:263 +#: library/ssl.rst:287 msgid "" "A subclass of :exc:`SSLError` raised when the SSL connection has been " "terminated abruptly. Generally, you shouldn't try to reuse the underlying " "transport when this error is encountered." msgstr "" -#: library/ssl.rst:271 +#: library/ssl.rst:295 msgid "" "A subclass of :exc:`SSLError` raised when certificate validation has failed." msgstr "" -#: library/ssl.rst:278 +#: library/ssl.rst:302 msgid "A numeric error number that denotes the verification error." msgstr "" -#: library/ssl.rst:282 +#: library/ssl.rst:306 msgid "A human readable string of the verification error." msgstr "" -#: library/ssl.rst:286 +#: library/ssl.rst:310 msgid "An alias for :exc:`SSLCertVerificationError`." msgstr "" -#: library/ssl.rst:288 +#: library/ssl.rst:312 msgid "The exception is now an alias for :exc:`SSLCertVerificationError`." msgstr "" -#: library/ssl.rst:293 +#: library/ssl.rst:317 msgid "Random generation" msgstr "" -#: library/ssl.rst:297 +#: library/ssl.rst:321 msgid "" "Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" "`SSLError` if the PRNG has not been seeded with enough data or if the " @@ -324,11 +405,11 @@ msgid "" "to seed the PRNG." msgstr "" -#: library/ssl.rst:303 +#: library/ssl.rst:327 msgid "For almost all applications :func:`os.urandom` is preferable." msgstr "" -#: library/ssl.rst:305 +#: library/ssl.rst:329 msgid "" "Read the Wikipedia article, `Cryptographically secure pseudorandom number " "generator (CSPRNG) >> import ssl\n" +">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" +">>> timestamp\n" +"1515144883\n" +">>> from datetime import datetime\n" +">>> print(datetime.utcfromtimestamp(timestamp))\n" +"2018-01-05 09:34:43" +msgstr "" + +#: library/ssl.rst:379 msgid "\"notBefore\" or \"notAfter\" dates must use GMT (:rfc:`5280`)." msgstr "" -#: library/ssl.rst:357 +#: library/ssl.rst:381 msgid "" "Interpret the input time as a time in UTC as specified by 'GMT' timezone in " "the input string. Local timezone was used previously. Return an integer (no " "fractions of a second in the input format)" msgstr "" -#: library/ssl.rst:366 +#: library/ssl.rst:390 msgid "" "Given the address ``addr`` of an SSL-protected server, as a (*hostname*, " "*port-number*) pair, fetches the server's certificate, and returns it as a " @@ -396,79 +488,79 @@ msgid "" "parameter." msgstr "" -#: library/ssl.rst:377 +#: library/ssl.rst:401 msgid "This function is now IPv6-compatible." msgstr "" -#: library/ssl.rst:380 +#: library/ssl.rst:404 msgid "" "The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" "`PROTOCOL_TLS` for maximum compatibility with modern servers." msgstr "" -#: library/ssl.rst:384 +#: library/ssl.rst:408 msgid "The *timeout* parameter was added." msgstr "" -#: library/ssl.rst:389 +#: library/ssl.rst:413 msgid "" "Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded " "string version of the same certificate." msgstr "" -#: library/ssl.rst:394 +#: library/ssl.rst:418 msgid "" "Given a certificate as an ASCII PEM string, returns a DER-encoded sequence " "of bytes for that same certificate." msgstr "" -#: library/ssl.rst:399 +#: library/ssl.rst:423 msgid "" "Returns a named tuple with paths to OpenSSL's default cafile and capath. The " "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " "The return value is a :term:`named tuple` ``DefaultVerifyPaths``:" msgstr "" -#: library/ssl.rst:404 +#: library/ssl.rst:428 msgid "" ":attr:`cafile` - resolved path to cafile or ``None`` if the file doesn't " "exist," msgstr "" -#: library/ssl.rst:405 +#: library/ssl.rst:429 msgid "" ":attr:`capath` - resolved path to capath or ``None`` if the directory " "doesn't exist," msgstr "" -#: library/ssl.rst:406 +#: library/ssl.rst:430 msgid "" ":attr:`openssl_cafile_env` - OpenSSL's environment key that points to a " "cafile," msgstr "" -#: library/ssl.rst:407 +#: library/ssl.rst:431 msgid ":attr:`openssl_cafile` - hard coded path to a cafile," msgstr "" -#: library/ssl.rst:408 +#: library/ssl.rst:432 msgid "" ":attr:`openssl_capath_env` - OpenSSL's environment key that points to a " "capath," msgstr "" -#: library/ssl.rst:409 +#: library/ssl.rst:433 msgid ":attr:`openssl_capath` - hard coded path to a capath directory" msgstr "" -#: library/ssl.rst:415 +#: library/ssl.rst:439 msgid "" "Retrieve certificates from Windows' system cert store. *store_name* may be " "one of ``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert " "stores, too." msgstr "" -#: library/ssl.rst:419 +#: library/ssl.rst:443 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" @@ -477,38 +569,41 @@ msgid "" "exactly ``True`` if the certificate is trustworthy for all purposes." msgstr "" -#: library/ssl.rst:1542 library/ssl.rst:1840 +#: library/ssl.rst:1610 library/ssl.rst:1910 msgid "Example::" msgstr "" -#: library/ssl.rst:447 -msgid ":ref:`Availability `: Windows." +#: library/ssl.rst:452 +msgid "" +">>> ssl.enum_certificates(\"CA\")\n" +"[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" +" (b'data...', 'x509_asn', True)]" msgstr "" -#: library/ssl.rst:438 +#: library/ssl.rst:462 msgid "" "Retrieve CRLs from Windows' system cert store. *store_name* may be one of " "``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert stores, too." msgstr "" -#: library/ssl.rst:442 +#: library/ssl.rst:466 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" "`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 data." msgstr "" -#: library/ssl.rst:453 +#: library/ssl.rst:477 msgid "Constants" msgstr "" -#: library/ssl.rst:455 +#: library/ssl.rst:479 msgid "" "All constants are now :class:`enum.IntEnum` or :class:`enum.IntFlag` " "collections." msgstr "" -#: library/ssl.rst:461 +#: library/ssl.rst:485 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" "`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " @@ -516,24 +611,24 @@ msgid "" "expired cert, are ignored and do not abort the TLS/SSL handshake." msgstr "" -#: library/ssl.rst:467 +#: library/ssl.rst:491 msgid "" "In server mode, no certificate is requested from the client, so the client " "does not send any for client cert authentication." msgstr "" -#: library/ssl.rst:2248 +#: library/ssl.rst:2412 msgid "See the discussion of :ref:`ssl-security` below." msgstr "" -#: library/ssl.rst:474 +#: library/ssl.rst:498 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" "`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " "recommended to use :const:`CERT_REQUIRED` for client-side sockets instead." msgstr "" -#: library/ssl.rst:479 +#: library/ssl.rst:503 msgid "" "In server mode, a client certificate request is sent to the client. The " "client may either ignore the request or send a certificate in order perform " @@ -542,13 +637,13 @@ msgid "" "TLS handshake." msgstr "" -#: library/ssl.rst:504 +#: library/ssl.rst:528 msgid "" "Use of this setting requires a valid set of CA certificates to be passed to :" "meth:`SSLContext.load_verify_locations`." msgstr "" -#: library/ssl.rst:490 +#: library/ssl.rst:514 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " "certificates are required from the other side of the socket connection; an :" @@ -560,25 +655,25 @@ msgid "" "attr:`~SSLContext.check_hostname` by default." msgstr "" -#: library/ssl.rst:500 +#: library/ssl.rst:524 msgid "" "With server socket, this mode provides mandatory TLS client cert " "authentication. A client certificate request is sent to the client and the " "client must provide a valid and trusted certificate." msgstr "" -#: library/ssl.rst:509 +#: library/ssl.rst:533 msgid ":class:`enum.IntEnum` collection of CERT_* constants." msgstr "" -#: library/ssl.rst:515 +#: library/ssl.rst:539 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, " "certificate revocation lists (CRLs) are not checked. By default OpenSSL does " "neither require nor verify CRLs." msgstr "" -#: library/ssl.rst:523 +#: library/ssl.rst:547 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " @@ -587,32 +682,32 @@ msgid "" "load_verify_locations`, validation will fail." msgstr "" -#: library/ssl.rst:533 +#: library/ssl.rst:557 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, CRLs of " "all certificates in the peer cert chain are checked." msgstr "" -#: library/ssl.rst:540 +#: library/ssl.rst:564 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to disable workarounds " "for broken X.509 certificates." msgstr "" -#: library/ssl.rst:547 +#: library/ssl.rst:571 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to enables proxy " "certificate verification." msgstr "" -#: library/ssl.rst:554 +#: library/ssl.rst:578 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "prefer trusted certificates when building the trust chain to validate a " "certificate. This flag is enabled by default." msgstr "" -#: library/ssl.rst:562 +#: library/ssl.rst:586 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "accept intermediate CAs in the trust store to be treated as trust-anchors, " @@ -621,25 +716,25 @@ msgid "" "to trust its ancestor root CA." msgstr "" -#: library/ssl.rst:573 +#: library/ssl.rst:597 msgid ":class:`enum.IntFlag` collection of VERIFY_* constants." msgstr "" -#: library/ssl.rst:579 +#: library/ssl.rst:603 msgid "" "Selects the highest protocol version that both the client and server " "support. Despite the name, this option can select both \"SSL\" and \"TLS\" " "protocols." msgstr "" -#: library/ssl.rst:586 +#: library/ssl.rst:610 msgid "" "TLS clients and servers require different default settings for secure " "communication. The generic TLS protocol constant is deprecated in favor of :" "data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." msgstr "" -#: library/ssl.rst:592 +#: library/ssl.rst:616 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context client-side connections. The protocol " @@ -647,35 +742,35 @@ msgid "" "default." msgstr "" -#: library/ssl.rst:601 +#: library/ssl.rst:625 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context server-side connections." msgstr "" -#: library/ssl.rst:608 +#: library/ssl.rst:632 msgid "Alias for :data:`PROTOCOL_TLS`." msgstr "" -#: library/ssl.rst:612 +#: library/ssl.rst:636 msgid "Use :data:`PROTOCOL_TLS` instead." msgstr "" -#: library/ssl.rst:616 +#: library/ssl.rst:640 msgid "Selects SSL version 3 as the channel encryption protocol." msgstr "" -#: library/ssl.rst:618 +#: library/ssl.rst:642 msgid "" "This protocol is not available if OpenSSL is compiled with the ``no-ssl3`` " "option." msgstr "" -#: library/ssl.rst:623 +#: library/ssl.rst:647 msgid "SSL version 3 is insecure. Its use is highly discouraged." msgstr "" -#: library/ssl.rst:627 +#: library/ssl.rst:651 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " "protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" @@ -683,87 +778,87 @@ msgid "" "instead." msgstr "" -#: library/ssl.rst:635 +#: library/ssl.rst:659 msgid "Selects TLS version 1.0 as the channel encryption protocol." msgstr "" -#: library/ssl.rst:650 library/ssl.rst:661 +#: library/ssl.rst:674 library/ssl.rst:685 msgid "OpenSSL has deprecated all version specific protocols." msgstr "" -#: library/ssl.rst:643 +#: library/ssl.rst:667 msgid "" "Selects TLS version 1.1 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." msgstr "" -#: library/ssl.rst:654 +#: library/ssl.rst:678 msgid "" "Selects TLS version 1.2 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." msgstr "" -#: library/ssl.rst:665 +#: library/ssl.rst:689 msgid "" "Enables workarounds for various bugs present in other SSL implementations. " "This option is set by default. It does not necessarily set the same flags " "as OpenSSL's ``SSL_OP_ALL`` constant." msgstr "" -#: library/ssl.rst:673 +#: library/ssl.rst:697 msgid "" "Prevents an SSLv2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv2 as " "the protocol version." msgstr "" -#: library/ssl.rst:681 +#: library/ssl.rst:705 msgid "SSLv2 is deprecated" msgstr "" -#: library/ssl.rst:685 +#: library/ssl.rst:709 msgid "" "Prevents an SSLv3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv3 as " "the protocol version." msgstr "" -#: library/ssl.rst:693 +#: library/ssl.rst:717 msgid "SSLv3 is deprecated" msgstr "" -#: library/ssl.rst:697 +#: library/ssl.rst:721 msgid "" "Prevents a TLSv1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1 as " "the protocol version." msgstr "" -#: library/ssl.rst:703 +#: library/ssl.rst:727 msgid "" "The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." "minimum_version` and :attr:`SSLContext.maximum_version` instead." msgstr "" -#: library/ssl.rst:710 +#: library/ssl.rst:734 msgid "" "Prevents a TLSv1.1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.1 as " "the protocol version. Available only with openssl version 1.0.1+." msgstr "" -#: library/ssl.rst:727 +#: library/ssl.rst:751 msgid "The option is deprecated since OpenSSL 1.1.0." msgstr "" -#: library/ssl.rst:721 +#: library/ssl.rst:745 msgid "" "Prevents a TLSv1.2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.2 as " "the protocol version. Available only with openssl version 1.0.1+." msgstr "" -#: library/ssl.rst:732 +#: library/ssl.rst:756 msgid "" "Prevents a TLSv1.3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as " @@ -772,75 +867,75 @@ msgid "" "defaults to *0*." msgstr "" -#: library/ssl.rst:740 +#: library/ssl.rst:764 msgid "" "The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15 and " "3.6.3 for backwards compatibility with OpenSSL 1.0.2." msgstr "" -#: library/ssl.rst:746 +#: library/ssl.rst:770 msgid "" "Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest " "messages, and ignore renegotiation requests via ClientHello." msgstr "" -#: library/ssl.rst:749 +#: library/ssl.rst:773 msgid "This option is only available with OpenSSL 1.1.0h and later." msgstr "" -#: library/ssl.rst:755 +#: library/ssl.rst:779 msgid "" "Use the server's cipher ordering preference, rather than the client's. This " "option has no effect on client sockets and SSLv2 server sockets." msgstr "" -#: library/ssl.rst:762 +#: library/ssl.rst:786 msgid "" -"Prevents re-use of the same DH key for distinct SSL sessions. This improves " +"Prevents reuse of the same DH key for distinct SSL sessions. This improves " "forward secrecy but requires more computational resources. This option only " "applies to server sockets." msgstr "" -#: library/ssl.rst:770 +#: library/ssl.rst:794 msgid "" -"Prevents re-use of the same ECDH key for distinct SSL sessions. This " +"Prevents reuse of the same ECDH key for distinct SSL sessions. This " "improves forward secrecy but requires more computational resources. This " "option only applies to server sockets." msgstr "" -#: library/ssl.rst:778 +#: library/ssl.rst:802 msgid "" "Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake to make a " "TLS 1.3 connection look more like a TLS 1.2 connection." msgstr "" -#: library/ssl.rst:781 +#: library/ssl.rst:805 msgid "This option is only available with OpenSSL 1.1.1 and later." msgstr "" -#: library/ssl.rst:787 +#: library/ssl.rst:811 msgid "" "Disable compression on the SSL channel. This is useful if the application " "protocol supports its own compression scheme." msgstr "" -#: library/ssl.rst:794 +#: library/ssl.rst:818 msgid ":class:`enum.IntFlag` collection of OP_* constants." msgstr "" -#: library/ssl.rst:798 +#: library/ssl.rst:822 msgid "Prevent client side from requesting a session ticket." msgstr "" -#: library/ssl.rst:804 +#: library/ssl.rst:828 msgid "Ignore unexpected shutdown of TLS connections." msgstr "" -#: library/ssl.rst:822 +#: library/ssl.rst:846 msgid "This option is only available with OpenSSL 3.0.0 and later." msgstr "" -#: library/ssl.rst:812 +#: library/ssl.rst:836 msgid "" "Enable the use of the kernel TLS. To benefit from the feature, OpenSSL must " "have been compiled with support for it, and the negotiated cipher suites and " @@ -848,7 +943,7 @@ msgid "" "platform and kernel version)." msgstr "" -#: library/ssl.rst:817 +#: library/ssl.rst:841 msgid "" "Note that with enabled kernel TLS some cryptographic operations are " "performed by the kernel directly and not via any available OpenSSL " @@ -856,38 +951,38 @@ msgid "" "requires all cryptographic operations to be performed by the FIPS provider." msgstr "" -#: library/ssl.rst:828 +#: library/ssl.rst:852 msgid "" "Allow legacy insecure renegotiation between OpenSSL and unpatched servers " "only." msgstr "" -#: library/ssl.rst:835 +#: library/ssl.rst:859 msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." msgstr "" -#: library/ssl.rst:842 +#: library/ssl.rst:866 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." msgstr "" -#: library/ssl.rst:850 +#: library/ssl.rst:874 msgid "" "Whether the OpenSSL library has built-in support for the Elliptic Curve-" "based Diffie-Hellman key exchange. This should be true unless the feature " "was explicitly disabled by the distributor." msgstr "" -#: library/ssl.rst:858 +#: library/ssl.rst:882 msgid "" "Whether the OpenSSL library has built-in support for the *Server Name " "Indication* extension (as defined in :rfc:`6066`)." msgstr "" -#: library/ssl.rst:865 +#: library/ssl.rst:889 msgid "" "Whether the OpenSSL library has built-in support for the *Next Protocol " "Negotiation* as described in the `Application Layer Protocol Negotiation " @@ -896,57 +991,85 @@ msgid "" "advertise which protocols you want to support." msgstr "" -#: library/ssl.rst:875 +#: library/ssl.rst:899 msgid "" "Whether the OpenSSL library has built-in support for the SSL 2.0 protocol." msgstr "" -#: library/ssl.rst:881 +#: library/ssl.rst:905 msgid "" "Whether the OpenSSL library has built-in support for the SSL 3.0 protocol." msgstr "" -#: library/ssl.rst:887 +#: library/ssl.rst:911 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.0 protocol." msgstr "" -#: library/ssl.rst:893 +#: library/ssl.rst:917 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.1 protocol." msgstr "" -#: library/ssl.rst:899 +#: library/ssl.rst:923 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.2 protocol." msgstr "" -#: library/ssl.rst:905 +#: library/ssl.rst:929 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.3 protocol." msgstr "" -#: library/ssl.rst:911 +#: library/ssl.rst:935 +msgid "Whether the OpenSSL library has built-in support for TLS-PSK." +msgstr "" + +#: library/ssl.rst:941 +msgid "Whether the OpenSSL library has built-in support for TLS-PHA." +msgstr "" + +#: library/ssl.rst:947 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." msgstr "" -#: library/ssl.rst:918 +#: library/ssl.rst:954 msgid "The version string of the OpenSSL library loaded by the interpreter::" msgstr "" -#: library/ssl.rst:927 +#: library/ssl.rst:956 +msgid "" +">>> ssl.OPENSSL_VERSION\n" +"'OpenSSL 1.0.2k 26 Jan 2017'" +msgstr "" + +#: library/ssl.rst:963 msgid "" "A tuple of five integers representing version information about the OpenSSL " "library::" msgstr "" -#: library/ssl.rst:937 +#: library/ssl.rst:966 +msgid "" +">>> ssl.OPENSSL_VERSION_INFO\n" +"(1, 0, 2, 11, 15)" +msgstr "" + +#: library/ssl.rst:973 msgid "The raw version number of the OpenSSL library, as a single integer::" msgstr "" -#: library/ssl.rst:950 +#: library/ssl.rst:975 +msgid "" +">>> ssl.OPENSSL_VERSION_NUMBER\n" +"268443839\n" +">>> hex(ssl.OPENSSL_VERSION_NUMBER)\n" +"'0x100020bf'" +msgstr "" + +#: library/ssl.rst:986 msgid "" "Alert Descriptions from :rfc:`5246` and others. The `IANA TLS Alert Registry " "`." msgstr "" -#: library/ssl.rst:1049 +#: library/ssl.rst:1085 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method." msgstr "" -#: library/ssl.rst:1052 +#: library/ssl.rst:1088 msgid "The :meth:`sendfile` method was added." msgstr "" -#: library/ssl.rst:1055 +#: library/ssl.rst:1091 msgid "" "The :meth:`shutdown` does not reset the socket timeout each time bytes are " "received or sent. The socket timeout is now the maximum total duration of " "the shutdown." msgstr "" -#: library/ssl.rst:1060 +#: library/ssl.rst:1096 msgid "" "It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" "`SSLContext.wrap_socket` to wrap a socket." msgstr "" -#: library/ssl.rst:1064 +#: library/ssl.rst:1100 msgid "" ":class:`SSLSocket` instances must to created with :meth:`~SSLContext." "wrap_socket`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" -#: library/ssl.rst:1070 +#: library/ssl.rst:1106 msgid "" "Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The " "functions support reading and writing of data larger than 2 GB. Writing zero-" "length data no longer fails with a protocol violation error." msgstr "" -#: library/ssl.rst:1075 +#: library/ssl.rst:1111 msgid "SSL sockets also have the following additional methods and attributes:" msgstr "" -#: library/ssl.rst:1079 +#: library/ssl.rst:1115 msgid "" "Read up to *len* bytes of data from the SSL socket and return the result as " "a ``bytes`` instance. If *buffer* is specified, then read into the buffer " "instead, and return the number of bytes read." msgstr "" -#: library/ssl.rst:1083 +#: library/ssl.rst:1119 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the read would block." msgstr "" -#: library/ssl.rst:1086 +#: library/ssl.rst:1122 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`read` can also " "cause write operations." msgstr "" -#: library/ssl.rst:1089 +#: library/ssl.rst:1125 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to read up to *len* " "bytes." msgstr "" -#: library/ssl.rst:1094 +#: library/ssl.rst:1130 msgid "Use :meth:`~SSLSocket.recv` instead of :meth:`~SSLSocket.read`." msgstr "" -#: library/ssl.rst:1099 +#: library/ssl.rst:1135 msgid "" -"Write *buf* to the SSL socket and return the number of bytes written. The " -"*buf* argument must be an object supporting the buffer interface." +"Write *data* to the SSL socket and return the number of bytes written. The " +"*data* argument must be an object supporting the buffer interface." msgstr "" -#: library/ssl.rst:1102 +#: library/ssl.rst:1138 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the write would block." msgstr "" -#: library/ssl.rst:1105 +#: library/ssl.rst:1141 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`write` can " "also cause read operations." msgstr "" -#: library/ssl.rst:1108 +#: library/ssl.rst:1144 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " -"The socket timeout is now the maximum total duration to write *buf*." +"The socket timeout is now the maximum total duration to write *data*." msgstr "" -#: library/ssl.rst:1112 +#: library/ssl.rst:1148 msgid "Use :meth:`~SSLSocket.send` instead of :meth:`~SSLSocket.write`." msgstr "" -#: library/ssl.rst:1117 +#: library/ssl.rst:1153 msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " @@ -1201,45 +1322,52 @@ msgid "" "unwrap` was not called." msgstr "" -#: library/ssl.rst:1123 +#: library/ssl.rst:1159 msgid "" "Normally you should use the socket API methods like :meth:`~socket.socket." "recv` and :meth:`~socket.socket.send` instead of these methods." msgstr "" -#: library/ssl.rst:1129 +#: library/ssl.rst:1165 msgid "Perform the SSL setup handshake." msgstr "" -#: library/ssl.rst:1131 +#: library/ssl.rst:1167 +msgid "" +"If *block* is true and the timeout obtained by :meth:`~socket.socket." +"gettimeout` is zero, the socket is set in blocking mode until the handshake " +"is performed." +msgstr "" + +#: library/ssl.rst:1170 msgid "" -"The handshake method also performs :func:`match_hostname` when the :attr:" +"The handshake method also performs :func:`!match_hostname` when the :attr:" "`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." "context` is true." msgstr "" -#: library/ssl.rst:1136 +#: library/ssl.rst:1175 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration of the handshake." msgstr "" -#: library/ssl.rst:1140 +#: library/ssl.rst:1179 msgid "" "Hostname or IP address is matched by OpenSSL during handshake. The function :" -"func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " +"func:`!match_hostname` is no longer used. In case OpenSSL refuses a hostname " "or IP address, the handshake is aborted early and a TLS alert message is " "sent to the peer." msgstr "" -#: library/ssl.rst:1148 +#: library/ssl.rst:1187 msgid "" "If there is no certificate for the peer on the other end of the connection, " "return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" "`ValueError`." msgstr "" -#: library/ssl.rst:1152 +#: library/ssl.rst:1191 msgid "" "If the ``binary_form`` parameter is :const:`False`, and a certificate was " "received from the peer, this method returns a :class:`dict` instance. If " @@ -1251,7 +1379,7 @@ msgid "" "also be a ``subjectAltName`` key in the dictionary." msgstr "" -#: library/ssl.rst:1161 +#: library/ssl.rst:1200 msgid "" "The ``subject`` and ``issuer`` fields are tuples containing the sequence of " "relative distinguished names (RDNs) given in the certificate's data " @@ -1259,7 +1387,30 @@ msgid "" "value pairs. Here is a real-world example::" msgstr "" -#: library/ssl.rst:1185 +#: library/ssl.rst:1205 +msgid "" +"{'issuer': ((('countryName', 'IL'),),\n" +" (('organizationName', 'StartCom Ltd.'),),\n" +" (('organizationalUnitName',\n" +" 'Secure Digital Certificate Signing'),),\n" +" (('commonName',\n" +" 'StartCom Class 2 Primary Intermediate Server CA'),)),\n" +" 'notAfter': 'Nov 22 08:15:19 2013 GMT',\n" +" 'notBefore': 'Nov 21 03:09:52 2011 GMT',\n" +" 'serialNumber': '95F0',\n" +" 'subject': ((('description', '571208-SLe257oHY9fVQ07Z'),),\n" +" (('countryName', 'US'),),\n" +" (('stateOrProvinceName', 'California'),),\n" +" (('localityName', 'San Francisco'),),\n" +" (('organizationName', 'Electronic Frontier Foundation, " +"Inc.'),),\n" +" (('commonName', '*.eff.org'),),\n" +" (('emailAddress', 'hostmaster@eff.org'),)),\n" +" 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n" +" 'version': 3}" +msgstr "" + +#: library/ssl.rst:1224 msgid "" "If the ``binary_form`` parameter is :const:`True`, and a certificate was " "provided, this method returns the DER-encoded form of the entire certificate " @@ -1268,13 +1419,13 @@ msgid "" "socket's role:" msgstr "" -#: library/ssl.rst:1191 +#: library/ssl.rst:1230 msgid "" "for a client SSL socket, the server will always provide a certificate, " "regardless of whether validation was required;" msgstr "" -#: library/ssl.rst:1194 +#: library/ssl.rst:1233 msgid "" "for a server SSL socket, the client will only provide a certificate when " "requested by the server; therefore :meth:`getpeercert` will return :const:" @@ -1282,28 +1433,41 @@ msgid "" "or :const:`CERT_REQUIRED`)." msgstr "" -#: library/ssl.rst:1199 +#: library/ssl.rst:1238 msgid "See also :attr:`SSLContext.check_hostname`." msgstr "" -#: library/ssl.rst:1201 +#: library/ssl.rst:1240 msgid "" "The returned dictionary includes additional items such as ``issuer`` and " "``notBefore``." msgstr "" -#: library/ssl.rst:1205 +#: library/ssl.rst:1244 msgid "" ":exc:`ValueError` is raised when the handshake isn't done. The returned " "dictionary includes additional X509v3 extension items such as " "``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs." msgstr "" -#: library/ssl.rst:1210 +#: library/ssl.rst:1249 msgid "IPv6 address strings no longer have a trailing new line." msgstr "" -#: library/ssl.rst:1215 +#: library/ssl.rst:1254 +msgid "" +"Returns verified certificate chain provided by the other end of the SSL " +"channel as a list of DER-encoded bytes. If certificate verification was " +"disabled method acts the same as :meth:`~SSLSocket.get_unverified_chain`." +msgstr "" + +#: library/ssl.rst:1263 +msgid "" +"Returns raw certificate chain provided by the other end of the SSL channel " +"as a list of DER-encoded bytes." +msgstr "" + +#: library/ssl.rst:1270 msgid "" "Returns a three-value tuple containing the name of the cipher being used, " "the version of the SSL protocol that defines its use, and the number of " @@ -1311,7 +1475,7 @@ msgid "" "``None``." msgstr "" -#: library/ssl.rst:1221 +#: library/ssl.rst:1276 msgid "" "Return the list of ciphers available in both the client and server. Each " "entry of the returned list is a three-value tuple containing the name of the " @@ -1321,25 +1485,25 @@ msgid "" "socket." msgstr "" -#: library/ssl.rst:1232 +#: library/ssl.rst:1287 msgid "" "Return the compression algorithm being used as a string, or ``None`` if the " "connection isn't compressed." msgstr "" -#: library/ssl.rst:1235 +#: library/ssl.rst:1290 msgid "" "If the higher-level protocol supports its own compression mechanism, you can " "use :data:`OP_NO_COMPRESSION` to disable SSL-level compression." msgstr "" -#: library/ssl.rst:1242 +#: library/ssl.rst:1297 msgid "" "Get channel binding data for current connection, as a bytes object. Returns " "``None`` if not connected or the handshake has not been completed." msgstr "" -#: library/ssl.rst:1245 +#: library/ssl.rst:1300 msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " @@ -1348,7 +1512,7 @@ msgid "" "channel binding type is requested." msgstr "" -#: library/ssl.rst:1255 +#: library/ssl.rst:1310 msgid "" "Return the protocol that was selected during the TLS handshake. If :meth:" "`SSLContext.set_alpn_protocols` was not called, if the other party does not " @@ -1356,7 +1520,7 @@ msgid "" "protocols, or if the handshake has not happened yet, ``None`` is returned." msgstr "" -#: library/ssl.rst:1265 +#: library/ssl.rst:1320 msgid "" "Return the higher-level protocol that was selected during the TLS/SSL " "handshake. If :meth:`SSLContext.set_npn_protocols` was not called, or if the " @@ -1364,11 +1528,11 @@ msgid "" "this will return ``None``." msgstr "" -#: library/ssl.rst:1630 +#: library/ssl.rst:1698 msgid "NPN has been superseded by ALPN" msgstr "" -#: library/ssl.rst:1278 +#: library/ssl.rst:1333 msgid "" "Performs the SSL shutdown handshake, which removes the TLS layer from the " "underlying socket, and returns the underlying socket object. This can be " @@ -1377,7 +1541,7 @@ msgid "" "other side of the connection, rather than the original socket." msgstr "" -#: library/ssl.rst:1286 +#: library/ssl.rst:1341 msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " @@ -1385,26 +1549,26 @@ msgid "" "`SSLContext.post_handshake_auth`." msgstr "" -#: library/ssl.rst:1291 +#: library/ssl.rst:1346 msgid "" "The method does not perform a cert exchange immediately. The server-side " "sends a CertificateRequest during the next write event and expects the " "client to respond with a certificate on the next read event." msgstr "" -#: library/ssl.rst:1295 +#: library/ssl.rst:1350 msgid "" "If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" "`SSLError` is raised." msgstr "" -#: library/ssl.rst:1299 +#: library/ssl.rst:1354 msgid "" "Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 " "support, the method raises :exc:`NotImplementedError`." msgstr "" -#: library/ssl.rst:1306 +#: library/ssl.rst:1361 msgid "" "Return the actual SSL protocol version negotiated by the connection as a " "string, or ``None`` if no secure connection is established. As of this " @@ -1413,29 +1577,29 @@ msgid "" "may define more return values." msgstr "" -#: library/ssl.rst:1316 +#: library/ssl.rst:1371 msgid "" "Returns the number of already decrypted bytes available for read, pending on " "the connection." msgstr "" -#: library/ssl.rst:1321 +#: library/ssl.rst:1376 msgid "The :class:`SSLContext` object this SSL socket is tied to." msgstr "" -#: library/ssl.rst:1327 +#: library/ssl.rst:1382 msgid "" "A boolean which is ``True`` for server-side sockets and ``False`` for client-" "side sockets." msgstr "" -#: library/ssl.rst:1334 +#: library/ssl.rst:1389 msgid "" "Hostname of the server: :class:`str` type, or ``None`` for server-side " "socket or if the hostname was not specified in the constructor." msgstr "" -#: library/ssl.rst:1339 +#: library/ssl.rst:1394 msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " @@ -1443,7 +1607,7 @@ msgid "" "org\"``)." msgstr "" -#: library/ssl.rst:1347 +#: library/ssl.rst:1402 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " @@ -1451,11 +1615,11 @@ msgid "" "`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" -#: library/ssl.rst:1360 +#: library/ssl.rst:1415 msgid "SSL Contexts" msgstr "" -#: library/ssl.rst:1364 +#: library/ssl.rst:1419 msgid "" "An SSL context holds various data longer-lived than single SSL connections, " "such as SSL configuration options, certificate(s) and private key(s). It " @@ -1463,7 +1627,7 @@ msgid "" "speed up repeated connections from the same clients." msgstr "" -#: library/ssl.rst:1371 +#: library/ssl.rst:1426 msgid "" "Create a new SSL context. You may pass *protocol* which must be one of the " "``PROTOCOL_*`` constants defined in this module. The parameter specifies " @@ -1474,105 +1638,105 @@ msgid "" "provides the most compatibility with other versions." msgstr "" -#: library/ssl.rst:1380 +#: library/ssl.rst:1435 msgid "" "Here's a table showing which versions in a client (down the side) can " "connect to which versions in a server (along the top):" msgstr "" -#: library/ssl.rst:1386 +#: library/ssl.rst:1441 msgid "*client* / **server**" msgstr "" -#: library/ssl.rst:1386 +#: library/ssl.rst:1441 msgid "**SSLv2**" msgstr "" -#: library/ssl.rst:1386 +#: library/ssl.rst:1441 msgid "**SSLv3**" msgstr "" -#: library/ssl.rst:1386 +#: library/ssl.rst:1441 msgid "**TLS** [3]_" msgstr "" -#: library/ssl.rst:1386 +#: library/ssl.rst:1441 msgid "**TLSv1**" msgstr "" -#: library/ssl.rst:1386 +#: library/ssl.rst:1441 msgid "**TLSv1.1**" msgstr "" -#: library/ssl.rst:1386 +#: library/ssl.rst:1441 msgid "**TLSv1.2**" msgstr "" -#: library/ssl.rst:1388 +#: library/ssl.rst:1443 msgid "*SSLv2*" msgstr "" -#: library/ssl.rst:1389 library/ssl.rst:1391 library/ssl.rst:1393 +#: library/ssl.rst:1444 library/ssl.rst:1446 library/ssl.rst:1448 msgid "yes" msgstr "" -#: library/ssl.rst:1389 library/ssl.rst:1392 library/ssl.rst:1393 +#: library/ssl.rst:1444 library/ssl.rst:1447 library/ssl.rst:1448 msgid "no" msgstr "" -#: library/ssl.rst:1390 +#: library/ssl.rst:1445 msgid "no [1]_" msgstr "" -#: library/ssl.rst:1389 +#: library/ssl.rst:1444 msgid "*SSLv3*" msgstr "" -#: library/ssl.rst:1390 +#: library/ssl.rst:1445 msgid "no [2]_" msgstr "" -#: library/ssl.rst:1390 +#: library/ssl.rst:1445 msgid "*TLS* (*SSLv23*) [3]_" msgstr "" -#: library/ssl.rst:1391 +#: library/ssl.rst:1446 msgid "*TLSv1*" msgstr "" -#: library/ssl.rst:1392 +#: library/ssl.rst:1447 msgid "*TLSv1.1*" msgstr "" -#: library/ssl.rst:1393 +#: library/ssl.rst:1448 msgid "*TLSv1.2*" msgstr "" -#: library/ssl.rst:1396 +#: library/ssl.rst:1451 msgid "Footnotes" msgstr "" -#: library/ssl.rst:1397 +#: library/ssl.rst:1452 msgid ":class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default." msgstr "" -#: library/ssl.rst:1398 +#: library/ssl.rst:1453 msgid ":class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default." msgstr "" -#: library/ssl.rst:1399 +#: library/ssl.rst:1454 msgid "" "TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in OpenSSL >= " "1.1.1. There is no dedicated PROTOCOL constant for just TLS 1.3." msgstr "" -#: library/ssl.rst:1404 +#: library/ssl.rst:1459 msgid "" ":func:`create_default_context` lets the :mod:`ssl` module choose security " "settings for a given purpose." msgstr "" -#: library/ssl.rst:1409 +#: library/ssl.rst:1464 msgid "" "The context is created with secure default values. The options :data:" "`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" @@ -1582,14 +1746,14 @@ msgid "" "ciphers and no ``MD5`` ciphers." msgstr "" -#: library/ssl.rst:1419 +#: library/ssl.rst:1474 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " "class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" -#: library/ssl.rst:1425 +#: library/ssl.rst:1480 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " @@ -1598,22 +1762,43 @@ msgid "" "use TLS 1.2 as minimum TLS version." msgstr "" -#: library/ssl.rst:1432 +#: library/ssl.rst:1488 +msgid "" +":class:`SSLContext` only supports limited mutation once it has been used by " +"a connection. Adding new certificates to the internal trust store is " +"allowed, but changing ciphers, verification settings, or mTLS certificates " +"may result in surprising behavior." +msgstr "" + +#: library/ssl.rst:1495 +msgid "" +":class:`SSLContext` is designed to be shared and used by multiple " +"connections. Thus, it is thread-safe as long as it is not reconfigured after " +"being used by a connection." +msgstr "" + +#: library/ssl.rst:1500 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr "" -#: library/ssl.rst:1436 +#: library/ssl.rst:1504 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -#: library/ssl.rst:1440 +#: library/ssl.rst:1508 msgid "Example for a context with one CA cert and one other cert::" msgstr "" -#: library/ssl.rst:1450 +#: library/ssl.rst:1510 +msgid "" +">>> context.cert_store_stats()\n" +"{'crl': 0, 'x509_ca': 1, 'x509': 2}" +msgstr "" + +#: library/ssl.rst:1518 msgid "" "Load a private key and the corresponding certificate. The *certfile* string " "must be the path to a single file in PEM format containing the certificate " @@ -1624,7 +1809,7 @@ msgid "" "more information on how the certificate is stored in the *certfile*." msgstr "" -#: library/ssl.rst:1459 +#: library/ssl.rst:1527 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -1636,24 +1821,24 @@ msgid "" "encrypted and no password is needed." msgstr "" -#: library/ssl.rst:1468 +#: library/ssl.rst:1536 msgid "" "If the *password* argument is not specified and a password is required, " "OpenSSL's built-in password prompting mechanism will be used to " "interactively prompt the user for a password." msgstr "" -#: library/ssl.rst:1472 +#: library/ssl.rst:1540 msgid "" "An :class:`SSLError` is raised if the private key doesn't match with the " "certificate." msgstr "" -#: library/ssl.rst:1475 +#: library/ssl.rst:1543 msgid "New optional argument *password*." msgstr "" -#: library/ssl.rst:1480 +#: library/ssl.rst:1548 msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " @@ -1662,7 +1847,7 @@ msgid "" "from other locations, too." msgstr "" -#: library/ssl.rst:1486 +#: library/ssl.rst:1554 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :const:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -1671,36 +1856,35 @@ msgid "" "certificate verification on the server side." msgstr "" -#: library/ssl.rst:1496 +#: library/ssl.rst:1564 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " "other peers' certificates when :data:`verify_mode` is other than :data:" "`CERT_NONE`. At least one of *cafile* or *capath* must be specified." msgstr "" -#: library/ssl.rst:1500 +#: library/ssl.rst:1568 msgid "" "This method can also load certification revocation lists (CRLs) in PEM or " "DER format. In order to make use of CRLs, :attr:`SSLContext.verify_flags` " "must be configured properly." msgstr "" -#: library/ssl.rst:1504 +#: library/ssl.rst:1572 msgid "" "The *cafile* string, if present, is the path to a file of concatenated CA " "certificates in PEM format. See the discussion of :ref:`ssl-certificates` " "for more information about how to arrange the certificates in this file." msgstr "" -#: library/ssl.rst:1509 +#: library/ssl.rst:1577 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " -"`_." +"`_." msgstr "" -#: library/ssl.rst:1514 +#: library/ssl.rst:1582 msgid "" "The *cadata* object, if present, is either an ASCII string of one or more " "PEM-encoded certificates or a :term:`bytes-like object` of DER-encoded " @@ -1708,11 +1892,11 @@ msgid "" "are ignored but at least one certificate must be present." msgstr "" -#: library/ssl.rst:1519 +#: library/ssl.rst:1587 msgid "New optional argument *cadata*" msgstr "" -#: library/ssl.rst:1524 +#: library/ssl.rst:1592 msgid "" "Get a list of loaded \"certification authority\" (CA) certificates. If the " "``binary_form`` parameter is :const:`False` each list entry is a dict like " @@ -1722,19 +1906,50 @@ msgid "" "a SSL connection." msgstr "" -#: library/ssl.rst:1532 +#: library/ssl.rst:1600 msgid "" "Certificates in a capath directory aren't loaded unless they have been used " "at least once." msgstr "" -#: library/ssl.rst:1539 +#: library/ssl.rst:1607 msgid "" "Get a list of enabled ciphers. The list is in order of cipher priority. See :" "meth:`SSLContext.set_ciphers`." msgstr "" -#: library/ssl.rst:1576 +#: library/ssl.rst:1612 +msgid "" +">>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\n" +">>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA')\n" +">>> ctx.get_ciphers()\n" +"[{'aead': True,\n" +" 'alg_bits': 256,\n" +" 'auth': 'auth-rsa',\n" +" 'description': 'ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA '\n" +" 'Enc=AESGCM(256) Mac=AEAD',\n" +" 'digest': None,\n" +" 'id': 50380848,\n" +" 'kea': 'kx-ecdhe',\n" +" 'name': 'ECDHE-RSA-AES256-GCM-SHA384',\n" +" 'protocol': 'TLSv1.2',\n" +" 'strength_bits': 256,\n" +" 'symmetric': 'aes-256-gcm'},\n" +" {'aead': True,\n" +" 'alg_bits': 128,\n" +" 'auth': 'auth-rsa',\n" +" 'description': 'ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH Au=RSA '\n" +" 'Enc=AESGCM(128) Mac=AEAD',\n" +" 'digest': None,\n" +" 'id': 50380847,\n" +" 'kea': 'kx-ecdhe',\n" +" 'name': 'ECDHE-RSA-AES128-GCM-SHA256',\n" +" 'protocol': 'TLSv1.2',\n" +" 'strength_bits': 128,\n" +" 'symmetric': 'aes-128-gcm'}]" +msgstr "" + +#: library/ssl.rst:1644 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -1744,28 +1959,28 @@ msgid "" "configured properly." msgstr "" -#: library/ssl.rst:1585 +#: library/ssl.rst:1653 msgid "" "Set the available ciphers for sockets created with this context. It should " -"be a string in the `OpenSSL cipher list format `_. If no cipher can be selected (because " -"compile-time options or other configuration forbids use of all the specified " -"ciphers), an :class:`SSLError` will be raised." +"be a string in the `OpenSSL cipher list format `_. If no cipher can be selected (because compile-time " +"options or other configuration forbids use of all the specified ciphers), " +"an :class:`SSLError` will be raised." msgstr "" -#: library/ssl.rst:1593 +#: library/ssl.rst:1661 msgid "" "when connected, the :meth:`SSLSocket.cipher` method of SSL sockets will give " "the currently selected cipher." msgstr "" -#: library/ssl.rst:1596 +#: library/ssl.rst:1664 msgid "" "TLS 1.3 cipher suites cannot be disabled with :meth:`~SSLContext." "set_ciphers`." msgstr "" -#: library/ssl.rst:1601 +#: library/ssl.rst:1669 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " "handshake. It should be a list of ASCII strings, like ``['http/1.1', " @@ -1775,13 +1990,13 @@ msgid "" "will return the agreed-upon protocol." msgstr "" -#: library/ssl.rst:1608 +#: library/ssl.rst:1676 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is " "``False``." msgstr "" -#: library/ssl.rst:1615 +#: library/ssl.rst:1683 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " "handshake. It should be a list of strings, like ``['http/1.1', 'spdy/2']``, " @@ -1793,13 +2008,13 @@ msgid "" "protocol." msgstr "" -#: library/ssl.rst:1623 +#: library/ssl.rst:1691 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_NPN` is " "``False``." msgstr "" -#: library/ssl.rst:1634 +#: library/ssl.rst:1702 msgid "" "Register a callback function that will be called after the TLS Client Hello " "handshake message has been received by the SSL/TLS server when the TLS " @@ -1807,14 +2022,14 @@ msgid "" "mechanism is specified in :rfc:`6066` section 3 - Server Name Indication." msgstr "" -#: library/ssl.rst:1639 +#: library/ssl.rst:1707 msgid "" "Only one callback can be set per ``SSLContext``. If *sni_callback* is set " "to ``None`` then the callback is disabled. Calling this function a " "subsequent time will disable the previously registered callback." msgstr "" -#: library/ssl.rst:1643 +#: library/ssl.rst:1711 msgid "" "The callback function will be called with three arguments; the first being " "the :class:`ssl.SSLSocket`, the second is a string that represents the " @@ -1825,25 +2040,26 @@ msgid "" "pythn-mua.org\"``)." msgstr "" -#: library/ssl.rst:1651 +#: library/ssl.rst:1719 msgid "" "A typical use of this callback is to change the :class:`ssl.SSLSocket`'s :" "attr:`SSLSocket.context` attribute to a new object of type :class:" "`SSLContext` representing a certificate chain that matches the server name." msgstr "" -#: library/ssl.rst:1656 +#: library/ssl.rst:1724 msgid "" "Due to the early negotiation phase of the TLS connection, only limited " "methods and attributes are usable like :meth:`SSLSocket." "selected_alpn_protocol` and :attr:`SSLSocket.context`. The :meth:`SSLSocket." -"getpeercert`, :meth:`SSLSocket.cipher` and :meth:`SSLSocket.compression` " -"methods require that the TLS connection has progressed beyond the TLS Client " -"Hello and therefore will not return meaningful values nor can they be called " -"safely." +"getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket." +"get_unverified_chain` :meth:`SSLSocket.cipher` and :meth:`SSLSocket." +"compression` methods require that the TLS connection has progressed beyond " +"the TLS Client Hello and therefore will not return meaningful values nor can " +"they be called safely." msgstr "" -#: library/ssl.rst:1664 +#: library/ssl.rst:1733 msgid "" "The *sni_callback* function must return ``None`` to allow the TLS " "negotiation to continue. If a TLS failure is required, a constant :const:" @@ -1852,20 +2068,20 @@ msgid "" "`ALERT_DESCRIPTION_INTERNAL_ERROR`." msgstr "" -#: library/ssl.rst:1670 +#: library/ssl.rst:1739 msgid "" "If an exception is raised from the *sni_callback* function the TLS " "connection will terminate with a fatal TLS alert message :const:" "`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." msgstr "" -#: library/ssl.rst:1674 +#: library/ssl.rst:1743 msgid "" "This method will raise :exc:`NotImplementedError` if the OpenSSL library had " "OPENSSL_NO_TLSEXT defined when it was built." msgstr "" -#: library/ssl.rst:1681 +#: library/ssl.rst:1750 msgid "" "This is a legacy API retained for backwards compatibility. When possible, " "you should use :attr:`sni_callback` instead. The given " @@ -1874,14 +2090,14 @@ msgid "" "*server_name_callback* receives a decoded U-label (``\"pythön.org\"``)." msgstr "" -#: library/ssl.rst:1687 +#: library/ssl.rst:1756 msgid "" -"If there is an decoding error on the server name, the TLS connection will " +"If there is a decoding error on the server name, the TLS connection will " "terminate with an :const:`ALERT_DESCRIPTION_INTERNAL_ERROR` fatal TLS alert " "message to the client." msgstr "" -#: library/ssl.rst:1695 +#: library/ssl.rst:1764 msgid "" "Load the key generation parameters for Diffie-Hellman (DH) key exchange. " "Using DH key exchange improves forward secrecy at the expense of " @@ -1890,13 +2106,13 @@ msgid "" "format." msgstr "" -#: library/ssl.rst:1701 +#: library/ssl.rst:1770 msgid "" "This setting doesn't apply to client sockets. You can also use the :data:" "`OP_SINGLE_DH_USE` option to further improve security." msgstr "" -#: library/ssl.rst:1708 +#: library/ssl.rst:1777 msgid "" "Set the curve name for Elliptic Curve-based Diffie-Hellman (ECDH) key " "exchange. ECDH is significantly faster than regular DH while arguably as " @@ -1905,27 +2121,27 @@ msgid "" "curve." msgstr "" -#: library/ssl.rst:1714 +#: library/ssl.rst:1783 msgid "" "This setting doesn't apply to client sockets. You can also use the :data:" "`OP_SINGLE_ECDH_USE` option to further improve security." msgstr "" -#: library/ssl.rst:1717 +#: library/ssl.rst:1786 msgid "This method is not available if :data:`HAS_ECDH` is ``False``." msgstr "" -#: library/ssl.rst:1722 +#: library/ssl.rst:1791 msgid "" "`SSL/TLS & Perfect Forward Secrecy `_" msgstr "" -#: library/ssl.rst:1723 +#: library/ssl.rst:1792 msgid "Vincent Bernat." msgstr "" -#: library/ssl.rst:1729 +#: library/ssl.rst:1798 msgid "" "Wrap an existing Python socket *sock* and return an instance of :attr:" "`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " @@ -1933,13 +2149,13 @@ msgid "" "a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" -#: library/ssl.rst:1735 +#: library/ssl.rst:1804 msgid "" "The parameter ``server_side`` is a boolean which identifies whether server-" "side or client-side behavior is desired from this socket." msgstr "" -#: library/ssl.rst:1738 +#: library/ssl.rst:1807 msgid "" "For client-side sockets, the context construction is lazy; if the underlying " "socket isn't connected yet, the context construction will be performed " @@ -1950,7 +2166,7 @@ msgid "" "exc:`SSLError`." msgstr "" -#: library/ssl.rst:1746 +#: library/ssl.rst:1815 msgid "" "On client connections, the optional parameter *server_hostname* specifies " "the hostname of the service which we are connecting to. This allows a " @@ -1959,7 +2175,7 @@ msgid "" "*server_hostname* will raise a :exc:`ValueError` if *server_side* is true." msgstr "" -#: library/ssl.rst:1752 +#: library/ssl.rst:1821 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " @@ -1969,7 +2185,7 @@ msgid "" "socket I/O involved in the handshake." msgstr "" -#: library/ssl.rst:1759 +#: library/ssl.rst:1828 msgid "" "The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." "recv` method should signal unexpected EOF from the other end of the " @@ -1979,40 +2195,40 @@ msgid "" "exceptions back to the caller." msgstr "" -#: library/ssl.rst:1766 +#: library/ssl.rst:1835 msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "" -#: library/ssl.rst:1768 +#: library/ssl.rst:1837 msgid "" "To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" "`SSLContext.wrap_bio`." msgstr "" -#: library/ssl.rst:1771 +#: library/ssl.rst:1840 msgid "" "Always allow a server_hostname to be passed, even if OpenSSL does not have " "SNI." msgstr "" -#: library/ssl.rst:1801 +#: library/ssl.rst:1871 msgid "*session* argument was added." msgstr "" -#: library/ssl.rst:1778 +#: library/ssl.rst:1847 msgid "" "The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" -#: library/ssl.rst:1784 +#: library/ssl.rst:1853 msgid "" "The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" -"`SSLSocket`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLSocket`." +"`SSLSocket`. The attribute can be assigned to on instances of :class:" +"`SSLContext` in order to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: library/ssl.rst:1793 +#: library/ssl.rst:1863 msgid "" "Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" "attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " @@ -2020,35 +2236,42 @@ msgid "" "outgoing BIO." msgstr "" -#: library/ssl.rst:1798 +#: library/ssl.rst:1868 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: library/ssl.rst:1804 +#: library/ssl.rst:1874 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: library/ssl.rst:1810 +#: library/ssl.rst:1880 msgid "" "The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" "`SSLObject`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLObject`." msgstr "" -#: library/ssl.rst:1818 +#: library/ssl.rst:1888 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " -"`_ to " -"their numeric values. For example, here is the total number of hits and " -"misses in the session cache since the context was created::" +"`_ to their " +"numeric values. For example, here is the total number of hits and misses in " +"the session cache since the context was created::" msgstr "" -#: library/ssl.rst:1829 +#: library/ssl.rst:1893 +msgid "" +">>> stats = context.session_stats()\n" +">>> stats['hits'], stats['misses']\n" +"(0, 0)" +msgstr "" + +#: library/ssl.rst:1899 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " "The context's :attr:`~SSLContext.verify_mode` must be set to :data:" @@ -2061,7 +2284,21 @@ msgid "" "With other protocols, hostname checking must be enabled explicitly." msgstr "" -#: library/ssl.rst:1857 +#: library/ssl.rst:1912 +msgid "" +"import socket, ssl\n" +"\n" +"context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)\n" +"context.verify_mode = ssl.CERT_REQUIRED\n" +"context.check_hostname = True\n" +"context.load_default_certs()\n" +"\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" +"ssl_sock.connect(('www.verisign.com', 443))" +msgstr "" + +#: library/ssl.rst:1927 msgid "" ":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" "`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." @@ -2069,7 +2306,7 @@ msgid "" "failed with a :exc:`ValueError`." msgstr "" -#: library/ssl.rst:1864 +#: library/ssl.rst:1934 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2078,15 +2315,15 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: library/ssl.rst:1874 +#: library/ssl.rst:1944 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " -"attribute is read-only for protocols other than :attr:`PROTOCOL_TLS`, :attr:" -"`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`." +"attribute is read-only for protocols other than :const:`PROTOCOL_TLS`, :" +"const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." msgstr "" -#: library/ssl.rst:1879 +#: library/ssl.rst:1949 msgid "" "The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." "minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " @@ -2096,38 +2333,38 @@ msgid "" "`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: library/ssl.rst:1892 +#: library/ssl.rst:1962 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: library/ssl.rst:1899 +#: library/ssl.rst:1969 msgid "" -"Control the number of TLS 1.3 session tickets of a :attr:" +"Control the number of TLS 1.3 session tickets of a :const:" "`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " "connections." msgstr "" -#: library/ssl.rst:1907 +#: library/ssl.rst:1977 msgid "" "An integer representing the set of SSL options enabled on this context. The " "default value is :data:`OP_ALL`, but you can specify other options such as :" "data:`OP_NO_SSLv2` by ORing them together." msgstr "" -#: library/ssl.rst:1911 +#: library/ssl.rst:1981 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr "" -#: library/ssl.rst:1919 +#: library/ssl.rst:1989 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " "Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." "maximum_version` instead." msgstr "" -#: library/ssl.rst:1925 +#: library/ssl.rst:1995 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2135,13 +2372,13 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: library/ssl.rst:1930 +#: library/ssl.rst:2000 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: library/ssl.rst:1933 +#: library/ssl.rst:2003 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " @@ -2149,59 +2386,175 @@ msgid "" "verify_client_post_handshake` is called and some I/O is performed." msgstr "" -#: library/ssl.rst:1943 +#: library/ssl.rst:2013 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: library/ssl.rst:1948 +#: library/ssl.rst:2018 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: library/ssl.rst:1956 +#: library/ssl.rst:2026 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: library/ssl.rst:1961 +#: library/ssl.rst:2031 msgid "" -"An integer representing the `security level `_ for the context. This " -"attribute is read-only." +"An integer representing the `security level `_ for the context. This attribute is read-" +"only." msgstr "" -#: library/ssl.rst:1969 +#: library/ssl.rst:2039 msgid "" "The flags for certificate verification operations. You can set flags like :" "data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " "neither require nor verify certificate revocation lists (CRLs)." msgstr "" -#: library/ssl.rst:1975 +#: library/ssl.rst:2045 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" msgstr "" -#: library/ssl.rst:1983 +#: library/ssl.rst:2053 msgid "" "Whether to try to verify other peers' certificates and how to behave if " "verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" "`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" -#: library/ssl.rst:1987 +#: library/ssl.rst:2057 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr "" -#: library/ssl.rst:2000 +#: library/ssl.rst:2065 +msgid "" +"Enables TLS-PSK (pre-shared key) authentication on a client-side connection." +msgstr "" + +#: library/ssl.rst:2116 +msgid "" +"In general, certificate based authentication should be preferred over this " +"method." +msgstr "" + +#: library/ssl.rst:2069 +msgid "" +"The parameter ``callback`` is a callable object with the signature: ``def " +"callback(hint: str | None) -> tuple[str | None, bytes]``. The ``hint`` " +"parameter is an optional identity hint sent by the server. The return value " +"is a tuple in the form (client-identity, psk). Client-identity is an " +"optional string which may be used by the server to select a corresponding " +"PSK for the client. The string must be less than or equal to ``256`` octets " +"when UTF-8 encoded. PSK is a :term:`bytes-like object` representing the pre-" +"shared key. Return a zero length PSK to reject the connection." +msgstr "" + +#: library/ssl.rst:2125 +msgid "Setting ``callback`` to :const:`None` removes any existing callback." +msgstr "" + +#: library/ssl.rst:2082 +msgid "When using TLS 1.3:" +msgstr "" + +#: library/ssl.rst:2084 +msgid "the ``hint`` parameter is always :const:`None`." +msgstr "" + +#: library/ssl.rst:2085 +msgid "client-identity must be a non-empty string." +msgstr "" + +#: library/ssl.rst:2134 +msgid "Example usage::" +msgstr "" + +#: library/ssl.rst:2089 +msgid "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" +"context.check_hostname = False\n" +"context.verify_mode = ssl.CERT_NONE\n" +"context.maximum_version = ssl.TLSVersion.TLSv1_2\n" +"context.set_ciphers('PSK')\n" +"\n" +"# A simple lambda:\n" +"psk = bytes.fromhex('c0ffee')\n" +"context.set_psk_client_callback(lambda hint: (None, psk))\n" +"\n" +"# A table using the hint from the server:\n" +"psk_table = { 'ServerId_1': bytes.fromhex('c0ffee'),\n" +" 'ServerId_2': bytes.fromhex('facade')\n" +"}\n" +"def callback(hint):\n" +" return 'ClientId_1', psk_table.get(hint, b'')\n" +"context.set_psk_client_callback(callback)" +msgstr "" + +#: library/ssl.rst:2152 +msgid "" +"This method will raise :exc:`NotImplementedError` if :data:`HAS_PSK` is " +"``False``." +msgstr "" + +#: library/ssl.rst:2114 +msgid "" +"Enables TLS-PSK (pre-shared key) authentication on a server-side connection." +msgstr "" + +#: library/ssl.rst:2118 +msgid "" +"The parameter ``callback`` is a callable object with the signature: ``def " +"callback(identity: str | None) -> bytes``. The ``identity`` parameter is an " +"optional identity sent by the client which can be used to select a " +"corresponding PSK. The return value is a :term:`bytes-like object` " +"representing the pre-shared key. Return a zero length PSK to reject the " +"connection." +msgstr "" + +#: library/ssl.rst:2127 +msgid "" +"The parameter ``identity_hint`` is an optional identity hint string sent to " +"the client. The string must be less than or equal to ``256`` octets when " +"UTF-8 encoded." +msgstr "" + +#: library/ssl.rst:2132 +msgid "" +"When using TLS 1.3 the ``identity_hint`` parameter is not sent to the client." +msgstr "" + +#: library/ssl.rst:2136 +msgid "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" +"context.maximum_version = ssl.TLSVersion.TLSv1_2\n" +"context.set_ciphers('PSK')\n" +"\n" +"# A simple lambda:\n" +"psk = bytes.fromhex('c0ffee')\n" +"context.set_psk_server_callback(lambda identity: psk)\n" +"\n" +"# A table using the identity of the client:\n" +"psk_table = { 'ClientId_1': bytes.fromhex('c0ffee'),\n" +" 'ClientId_2': bytes.fromhex('facade')\n" +"}\n" +"def callback(identity):\n" +" return psk_table.get(identity, b'')\n" +"context.set_psk_server_callback(callback, 'ServerId_1')" +msgstr "" + +#: library/ssl.rst:2164 msgid "Certificates" msgstr "" -#: library/ssl.rst:2002 +#: library/ssl.rst:2166 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2212,7 +2565,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: library/ssl.rst:2010 +#: library/ssl.rst:2174 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2226,7 +2579,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: library/ssl.rst:2020 +#: library/ssl.rst:2184 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -2239,18 +2592,25 @@ msgid "" "take place." msgstr "" -#: library/ssl.rst:2030 +#: library/ssl.rst:2194 msgid "" "Python uses files to contain certificates. They should be formatted as " "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -#: library/ssl.rst:2039 +#: library/ssl.rst:2198 +msgid "" +"-----BEGIN CERTIFICATE-----\n" +"... (certificate in base64 PEM encoding) ...\n" +"-----END CERTIFICATE-----" +msgstr "" + +#: library/ssl.rst:2203 msgid "Certificate chains" msgstr "" -#: library/ssl.rst:2041 +#: library/ssl.rst:2205 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -2266,11 +2626,24 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: library/ssl.rst:2065 +#: library/ssl.rst:2218 +msgid "" +"-----BEGIN CERTIFICATE-----\n" +"... (certificate for your server)...\n" +"-----END CERTIFICATE-----\n" +"-----BEGIN CERTIFICATE-----\n" +"... (the certificate for the CA)...\n" +"-----END CERTIFICATE-----\n" +"-----BEGIN CERTIFICATE-----\n" +"... (the root certificate for the CA's issuer)...\n" +"-----END CERTIFICATE-----" +msgstr "" + +#: library/ssl.rst:2229 msgid "CA certificates" msgstr "" -#: library/ssl.rst:2067 +#: library/ssl.rst:2231 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " @@ -2282,11 +2655,11 @@ msgid "" "create_default_context`." msgstr "" -#: library/ssl.rst:2076 +#: library/ssl.rst:2240 msgid "Combined key and certificate" msgstr "" -#: library/ssl.rst:2078 +#: library/ssl.rst:2242 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -2294,11 +2667,21 @@ msgid "" "should come before the first certificate in the certificate chain::" msgstr "" -#: library/ssl.rst:2092 +#: library/ssl.rst:2248 +msgid "" +"-----BEGIN RSA PRIVATE KEY-----\n" +"... (private key in base64 encoding) ...\n" +"-----END RSA PRIVATE KEY-----\n" +"-----BEGIN CERTIFICATE-----\n" +"... (certificate in base64 PEM encoding) ...\n" +"-----END CERTIFICATE-----" +msgstr "" + +#: library/ssl.rst:2256 msgid "Self-signed certificates" msgstr "" -#: library/ssl.rst:2094 +#: library/ssl.rst:2258 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -2308,51 +2691,97 @@ msgid "" "package, using something like the following::" msgstr "" -#: library/ssl.rst:2123 +#: library/ssl.rst:2265 +msgid "" +"% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" +"Generating a 1024 bit RSA private key\n" +".......++++++\n" +".............................++++++\n" +"writing new private key to 'cert.pem'\n" +"-----\n" +"You are about to be asked to enter information that will be incorporated\n" +"into your certificate request.\n" +"What you are about to enter is what is called a Distinguished Name or a DN.\n" +"There are quite a few fields but you can leave some blank\n" +"For some fields there will be a default value,\n" +"If you enter '.', the field will be left blank.\n" +"-----\n" +"Country Name (2 letter code) [AU]:US\n" +"State or Province Name (full name) [Some-State]:MyState\n" +"Locality Name (eg, city) []:Some City\n" +"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, " +"Inc.\n" +"Organizational Unit Name (eg, section) []:My Group\n" +"Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com\n" +"Email Address []:ops@myserver.mygroup.myorganization.com\n" +"%" +msgstr "" + +#: library/ssl.rst:2287 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: library/ssl.rst:2129 +#: library/ssl.rst:2293 msgid "Examples" msgstr "" -#: library/ssl.rst:2132 +#: library/ssl.rst:2296 msgid "Testing for SSL support" msgstr "" -#: library/ssl.rst:2134 +#: library/ssl.rst:2298 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: library/ssl.rst:2145 +#: library/ssl.rst:2301 +msgid "" +"try:\n" +" import ssl\n" +"except ImportError:\n" +" pass\n" +"else:\n" +" ... # do something that requires SSL support" +msgstr "" + +#: library/ssl.rst:2309 msgid "Client-side operation" msgstr "" -#: library/ssl.rst:2147 +#: library/ssl.rst:2311 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: library/ssl.rst:2152 +#: library/ssl.rst:2314 +msgid ">>> context = ssl.create_default_context()" +msgstr "" + +#: library/ssl.rst:2316 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: library/ssl.rst:2159 +#: library/ssl.rst:2320 +msgid "" +">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" +">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" +msgstr "" + +#: library/ssl.rst:2323 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: library/ssl.rst:2163 +#: library/ssl.rst:2327 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -2360,7 +2789,7 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: library/ssl.rst:2168 +#: library/ssl.rst:2332 msgid "" "When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" "attr:`~SSLContext.check_hostname` validate the server certificate: it " @@ -2369,27 +2798,108 @@ msgid "" "properties like validity and identity of the hostname::" msgstr "" -#: library/ssl.rst:2178 +#: library/ssl.rst:2338 +msgid "" +">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" +"... server_hostname=\"www.python.org\")\n" +">>> conn.connect((\"www.python.org\", 443))" +msgstr "" + +#: library/ssl.rst:2342 msgid "You may then fetch the certificate::" msgstr "" -#: library/ssl.rst:2182 +#: library/ssl.rst:2344 +msgid ">>> cert = conn.getpeercert()" +msgstr "" + +#: library/ssl.rst:2346 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: library/ssl.rst:2225 +#: library/ssl.rst:2349 +msgid "" +">>> pprint.pprint(cert)\n" +"{'OCSP': ('http://ocsp.digicert.com',),\n" +" 'caIssuers': ('http://cacerts.digicert.com/" +"DigiCertSHA2ExtendedValidationServerCA.crt',),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." +"crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-g1." +"crl'),\n" +" 'issuer': ((('countryName', 'US'),),\n" +" (('organizationName', 'DigiCert Inc'),),\n" +" (('organizationalUnitName', 'www.digicert.com'),),\n" +" (('commonName', 'DigiCert SHA2 Extended Validation Server " +"CA'),)),\n" +" 'notAfter': 'Sep 9 12:00:00 2016 GMT',\n" +" 'notBefore': 'Sep 5 00:00:00 2014 GMT',\n" +" 'serialNumber': '01BB6F00122B177F36CAB49CEA8B6B26',\n" +" 'subject': ((('businessCategory', 'Private Organization'),),\n" +" (('1.3.6.1.4.1.311.60.2.1.3', 'US'),),\n" +" (('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),),\n" +" (('serialNumber', '3359300'),),\n" +" (('streetAddress', '16 Allen Rd'),),\n" +" (('postalCode', '03894-4801'),),\n" +" (('countryName', 'US'),),\n" +" (('stateOrProvinceName', 'NH'),),\n" +" (('localityName', 'Wolfeboro'),),\n" +" (('organizationName', 'Python Software Foundation'),),\n" +" (('commonName', 'www.python.org'),)),\n" +" 'subjectAltName': (('DNS', 'www.python.org'),\n" +" ('DNS', 'python.org'),\n" +" ('DNS', 'pypi.org'),\n" +" ('DNS', 'docs.python.org'),\n" +" ('DNS', 'testpypi.org'),\n" +" ('DNS', 'bugs.python.org'),\n" +" ('DNS', 'wiki.python.org'),\n" +" ('DNS', 'hg.python.org'),\n" +" ('DNS', 'mail.python.org'),\n" +" ('DNS', 'packaging.python.org'),\n" +" ('DNS', 'pythonhosted.org'),\n" +" ('DNS', 'www.pythonhosted.org'),\n" +" ('DNS', 'test.pythonhosted.org'),\n" +" ('DNS', 'us.pycon.org'),\n" +" ('DNS', 'id.python.org')),\n" +" 'version': 3}" +msgstr "" + +#: library/ssl.rst:2389 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: library/ssl.rst:2252 +#: library/ssl.rst:2392 +msgid "" +">>> conn.sendall(b\"HEAD / HTTP/1.0\\r\\nHost: linuxfr.org\\r\\n\\r\\n\")\n" +">>> pprint.pprint(conn.recv(1024).split(b\"\\r\\n\"))\n" +"[b'HTTP/1.1 200 OK',\n" +" b'Date: Sat, 18 Oct 2014 18:27:20 GMT',\n" +" b'Server: nginx',\n" +" b'Content-Type: text/html; charset=utf-8',\n" +" b'X-Frame-Options: SAMEORIGIN',\n" +" b'Content-Length: 45679',\n" +" b'Accept-Ranges: bytes',\n" +" b'Via: 1.1 varnish',\n" +" b'Age: 2188',\n" +" b'X-Served-By: cache-lcy1134-LCY',\n" +" b'X-Cache: HIT',\n" +" b'X-Cache-Hits: 11',\n" +" b'Vary: Cookie',\n" +" b'Strict-Transport-Security: max-age=63072000; includeSubDomains',\n" +" b'Connection: close',\n" +" b'',\n" +" b'']" +msgstr "" + +#: library/ssl.rst:2416 msgid "Server-side operation" msgstr "" -#: library/ssl.rst:2254 +#: library/ssl.rst:2418 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -2398,20 +2908,58 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: library/ssl.rst:2269 +#: library/ssl.rst:2424 +msgid "" +"import socket, ssl\n" +"\n" +"context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)\n" +"context.load_cert_chain(certfile=\"mycertfile\", keyfile=\"mykeyfile\")\n" +"\n" +"bindsocket = socket.socket()\n" +"bindsocket.bind(('myaddr.example.com', 10023))\n" +"bindsocket.listen(5)" +msgstr "" + +#: library/ssl.rst:2433 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " "new socket from the other end, and use the context's :meth:`SSLContext." "wrap_socket` method to create a server-side SSL socket for the connection::" msgstr "" -#: library/ssl.rst:2282 +#: library/ssl.rst:2437 +msgid "" +"while True:\n" +" newsocket, fromaddr = bindsocket.accept()\n" +" connstream = context.wrap_socket(newsocket, server_side=True)\n" +" try:\n" +" deal_with_client(connstream)\n" +" finally:\n" +" connstream.shutdown(socket.SHUT_RDWR)\n" +" connstream.close()" +msgstr "" + +#: library/ssl.rst:2446 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: library/ssl.rst:2296 +#: library/ssl.rst:2449 +msgid "" +"def deal_with_client(connstream):\n" +" data = connstream.recv(1024)\n" +" # empty data means the client is finished with us\n" +" while data:\n" +" if not do_something(connstream, data):\n" +" # we'll assume do_something returns False\n" +" # when we're finished with client\n" +" break\n" +" data = connstream.recv(1024)\n" +" # finished with client" +msgstr "" + +#: library/ssl.rst:2460 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -2419,18 +2967,18 @@ msgid "" "event loop)." msgstr "" -#: library/ssl.rst:2304 +#: library/ssl.rst:2468 msgid "Notes on non-blocking sockets" msgstr "" -#: library/ssl.rst:2306 +#: library/ssl.rst:2470 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: library/ssl.rst:2310 +#: library/ssl.rst:2474 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " @@ -2442,13 +2990,13 @@ msgid "" "require a prior *write* to the underlying socket." msgstr "" -#: library/ssl.rst:2322 +#: library/ssl.rst:2486 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: library/ssl.rst:2326 +#: library/ssl.rst:2490 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " @@ -2458,7 +3006,7 @@ msgid "" "`~select.select`." msgstr "" -#: library/ssl.rst:2333 +#: library/ssl.rst:2497 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -2467,13 +3015,13 @@ msgid "" "call if still necessary." msgstr "" -#: library/ssl.rst:2339 +#: library/ssl.rst:2503 msgid "" "(of course, similar provisions apply when using other primitives such as :" "func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -#: library/ssl.rst:2342 +#: library/ssl.rst:2506 msgid "" "The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." "do_handshake` method has to be retried until it returns successfully. Here " @@ -2481,35 +3029,48 @@ msgid "" "readiness::" msgstr "" -#: library/ssl.rst:2358 +#: library/ssl.rst:2511 +msgid "" +"while True:\n" +" try:\n" +" sock.do_handshake()\n" +" break\n" +" except ssl.SSLWantReadError:\n" +" select.select([sock], [], [])\n" +" except ssl.SSLWantWriteError:\n" +" select.select([], [sock], [])" +msgstr "" + +#: library/ssl.rst:2522 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level API. It polls for events using " -"the :mod:`selectors` module and handles :exc:`SSLWantWriteError`, :exc:" -"`SSLWantReadError` and :exc:`BlockingIOError` exceptions. It runs the SSL " -"handshake asynchronously as well." +"nonblocking>` and provides a higher level :ref:`Streams API `. It polls for events using the :mod:`selectors` module and " +"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` and :exc:" +"`BlockingIOError` exceptions. It runs the SSL handshake asynchronously as " +"well." msgstr "" -#: library/ssl.rst:2367 +#: library/ssl.rst:2531 msgid "Memory BIO Support" msgstr "" -#: library/ssl.rst:2371 +#: library/ssl.rst:2535 msgid "" "Ever since the SSL module was introduced in Python 2.6, the :class:" "`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" -#: library/ssl.rst:2374 +#: library/ssl.rst:2538 msgid "SSL protocol handling" msgstr "" -#: library/ssl.rst:2375 +#: library/ssl.rst:2539 msgid "Network IO" msgstr "" -#: library/ssl.rst:2377 +#: library/ssl.rst:2541 msgid "" "The network IO API is identical to that provided by :class:`socket.socket`, " "from which :class:`SSLSocket` also inherits. This allows an SSL socket to be " @@ -2517,7 +3078,7 @@ msgid "" "add SSL support to an existing application." msgstr "" -#: library/ssl.rst:2382 +#: library/ssl.rst:2546 msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " @@ -2529,7 +3090,7 @@ msgid "" "`SSLObject` is provided." msgstr "" -#: library/ssl.rst:2393 +#: library/ssl.rst:2557 msgid "" "A reduced-scope variant of :class:`SSLSocket` representing an SSL protocol " "instance that does not contain any network IO methods. This class is " @@ -2537,7 +3098,7 @@ msgid "" "for SSL through memory buffers." msgstr "" -#: library/ssl.rst:2398 +#: library/ssl.rst:2562 msgid "" "This class implements an interface on top of a low-level SSL object as " "implemented by OpenSSL. This object captures the state of an SSL connection " @@ -2545,7 +3106,7 @@ msgid "" "separate \"BIO\" objects which are OpenSSL's IO abstraction layer." msgstr "" -#: library/ssl.rst:2403 +#: library/ssl.rst:2567 msgid "" "This class has no public constructor. An :class:`SSLObject` instance must " "be created using the :meth:`~SSLContext.wrap_bio` method. This method will " @@ -2554,207 +3115,215 @@ msgid "" "instance, while the *outgoing* BIO is used to pass data the other way around." msgstr "" -#: library/ssl.rst:2410 +#: library/ssl.rst:2574 msgid "The following methods are available:" msgstr "" -#: library/ssl.rst:2412 +#: library/ssl.rst:2576 msgid ":attr:`~SSLSocket.context`" msgstr "" -#: library/ssl.rst:2413 +#: library/ssl.rst:2577 msgid ":attr:`~SSLSocket.server_side`" msgstr "" -#: library/ssl.rst:2414 +#: library/ssl.rst:2578 msgid ":attr:`~SSLSocket.server_hostname`" msgstr "" -#: library/ssl.rst:2415 +#: library/ssl.rst:2579 msgid ":attr:`~SSLSocket.session`" msgstr "" -#: library/ssl.rst:2416 +#: library/ssl.rst:2580 msgid ":attr:`~SSLSocket.session_reused`" msgstr "" -#: library/ssl.rst:2417 +#: library/ssl.rst:2581 msgid ":meth:`~SSLSocket.read`" msgstr "" -#: library/ssl.rst:2418 +#: library/ssl.rst:2582 msgid ":meth:`~SSLSocket.write`" msgstr "" -#: library/ssl.rst:2419 +#: library/ssl.rst:2583 msgid ":meth:`~SSLSocket.getpeercert`" msgstr "" -#: library/ssl.rst:2420 +#: library/ssl.rst:2584 +msgid ":meth:`~SSLSocket.get_verified_chain`" +msgstr "" + +#: library/ssl.rst:2585 +msgid ":meth:`~SSLSocket.get_unverified_chain`" +msgstr "" + +#: library/ssl.rst:2586 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" msgstr "" -#: library/ssl.rst:2421 +#: library/ssl.rst:2587 msgid ":meth:`~SSLSocket.selected_npn_protocol`" msgstr "" -#: library/ssl.rst:2422 +#: library/ssl.rst:2588 msgid ":meth:`~SSLSocket.cipher`" msgstr "" -#: library/ssl.rst:2423 +#: library/ssl.rst:2589 msgid ":meth:`~SSLSocket.shared_ciphers`" msgstr "" -#: library/ssl.rst:2424 +#: library/ssl.rst:2590 msgid ":meth:`~SSLSocket.compression`" msgstr "" -#: library/ssl.rst:2425 +#: library/ssl.rst:2591 msgid ":meth:`~SSLSocket.pending`" msgstr "" -#: library/ssl.rst:2426 +#: library/ssl.rst:2592 msgid ":meth:`~SSLSocket.do_handshake`" msgstr "" -#: library/ssl.rst:2427 +#: library/ssl.rst:2593 msgid ":meth:`~SSLSocket.verify_client_post_handshake`" msgstr "" -#: library/ssl.rst:2428 +#: library/ssl.rst:2594 msgid ":meth:`~SSLSocket.unwrap`" msgstr "" -#: library/ssl.rst:2429 +#: library/ssl.rst:2595 msgid ":meth:`~SSLSocket.get_channel_binding`" msgstr "" -#: library/ssl.rst:2430 +#: library/ssl.rst:2596 msgid ":meth:`~SSLSocket.version`" msgstr "" -#: library/ssl.rst:2432 +#: library/ssl.rst:2598 msgid "" "When compared to :class:`SSLSocket`, this object lacks the following " "features:" msgstr "" -#: library/ssl.rst:2435 +#: library/ssl.rst:2601 msgid "" "Any form of network IO; ``recv()`` and ``send()`` read and write only to the " "underlying :class:`MemoryBIO` buffers." msgstr "" -#: library/ssl.rst:2438 +#: library/ssl.rst:2604 msgid "" "There is no *do_handshake_on_connect* machinery. You must always manually " "call :meth:`~SSLSocket.do_handshake` to start the handshake." msgstr "" -#: library/ssl.rst:2441 +#: library/ssl.rst:2607 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " "that are in violation of the protocol are reported via the :exc:" "`SSLEOFError` exception." msgstr "" -#: library/ssl.rst:2445 +#: library/ssl.rst:2611 msgid "" "The method :meth:`~SSLSocket.unwrap` call does not return anything, unlike " "for an SSL socket where it returns the underlying socket." msgstr "" -#: library/ssl.rst:2448 +#: library/ssl.rst:2614 msgid "" "The *server_name_callback* callback passed to :meth:`SSLContext." "set_servername_callback` will get an :class:`SSLObject` instance instead of " "a :class:`SSLSocket` instance as its first parameter." msgstr "" -#: library/ssl.rst:2452 +#: library/ssl.rst:2618 msgid "Some notes related to the use of :class:`SSLObject`:" msgstr "" -#: library/ssl.rst:2454 +#: library/ssl.rst:2620 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " "This means that for example :meth:`~SSLSocket.read` will raise an :exc:" "`SSLWantReadError` if it needs more data than the incoming BIO has available." msgstr "" -#: library/ssl.rst:2459 +#: library/ssl.rst:2625 msgid "" ":class:`SSLObject` instances must be created with :meth:`~SSLContext." "wrap_bio`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" -#: library/ssl.rst:2465 +#: library/ssl.rst:2631 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: library/ssl.rst:2471 +#: library/ssl.rst:2637 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: library/ssl.rst:2476 +#: library/ssl.rst:2642 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: library/ssl.rst:2480 +#: library/ssl.rst:2646 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: library/ssl.rst:2485 +#: library/ssl.rst:2651 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: library/ssl.rst:2490 +#: library/ssl.rst:2656 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: library/ssl.rst:2493 +#: library/ssl.rst:2659 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: library/ssl.rst:2498 +#: library/ssl.rst:2664 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: library/ssl.rst:2504 +#: library/ssl.rst:2670 msgid "SSL session" msgstr "" -#: library/ssl.rst:2510 +#: library/ssl.rst:2676 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: library/ssl.rst:2522 +#: library/ssl.rst:2688 msgid "Security considerations" msgstr "" -#: library/ssl.rst:2525 +#: library/ssl.rst:2691 msgid "Best defaults" msgstr "" -#: library/ssl.rst:2527 +#: library/ssl.rst:2693 msgid "" "For **client use**, if you don't have any special requirements for your " "security policy, it is highly recommended that you use the :func:" @@ -2764,19 +3333,28 @@ msgid "" "settings." msgstr "" -#: library/ssl.rst:2534 +#: library/ssl.rst:2700 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: library/ssl.rst:2543 +#: library/ssl.rst:2703 +msgid "" +">>> import ssl, smtplib\n" +">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" +">>> context = ssl.create_default_context()\n" +">>> smtp.starttls(context=context)\n" +"(220, b'2.0.0 Ready to start TLS')" +msgstr "" + +#: library/ssl.rst:2709 msgid "" "If a client certificate is needed for the connection, it can be added with :" "meth:`SSLContext.load_cert_chain`." msgstr "" -#: library/ssl.rst:2546 +#: library/ssl.rst:2712 msgid "" "By contrast, if you create the SSL context by calling the :class:" "`SSLContext` constructor yourself, it will not have certificate validation " @@ -2784,21 +3362,21 @@ msgid "" "paragraphs below to achieve a good security level." msgstr "" -#: library/ssl.rst:2552 +#: library/ssl.rst:2718 msgid "Manual settings" msgstr "" -#: library/ssl.rst:2555 +#: library/ssl.rst:2721 msgid "Verifying certificates" msgstr "" -#: library/ssl.rst:2557 +#: library/ssl.rst:2723 msgid "" "When calling the :class:`SSLContext` constructor directly, :const:" "`CERT_NONE` is the default. Since it does not authenticate the other peer, " -"it can be insecure, especially in client mode where most of time you would " -"like to ensure the authenticity of the server you're talking to. Therefore, " -"when in client mode, it is highly recommended to use :const:" +"it can be insecure, especially in client mode where most of the time you " +"would like to ensure the authenticity of the server you're talking to. " +"Therefore, when in client mode, it is highly recommended to use :const:" "`CERT_REQUIRED`. However, it is in itself not sufficient; you also have to " "check that the server certificate, which can be obtained by calling :meth:" "`SSLSocket.getpeercert`, matches the desired service. For many protocols " @@ -2807,13 +3385,13 @@ msgid "" "enabled." msgstr "" -#: library/ssl.rst:2569 +#: library/ssl.rst:2735 msgid "" "Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" -"`match_hostname`." +"`!match_hostname`." msgstr "" -#: library/ssl.rst:2573 +#: library/ssl.rst:2739 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -2821,11 +3399,11 @@ msgid "" "certificate." msgstr "" -#: library/ssl.rst:2579 +#: library/ssl.rst:2745 msgid "Protocol versions" msgstr "" -#: library/ssl.rst:2581 +#: library/ssl.rst:2747 msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " @@ -2834,7 +3412,14 @@ msgid "" "by default." msgstr "" -#: library/ssl.rst:2594 +#: library/ssl.rst:2755 +msgid "" +">>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" +">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" +">>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3" +msgstr "" + +#: library/ssl.rst:2760 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " "supported by your system) connections to a server. :const:" @@ -2842,28 +3427,28 @@ msgid "" "default. You have to load certificates into the context." msgstr "" -#: library/ssl.rst:2601 +#: library/ssl.rst:2767 msgid "Cipher selection" msgstr "" -#: library/ssl.rst:2603 +#: library/ssl.rst:2769 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " "enabled when negotiating a SSL session is possible through the :meth:" "`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " "disables certain weak ciphers by default, but you may want to further " "restrict the cipher choice. Be sure to read OpenSSL's documentation about " -"the `cipher list format `_. If you want to check which ciphers are enabled " -"by a given cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl " -"ciphers`` command on your system." +"the `cipher list format `_. If you want to check which ciphers are enabled by a given " +"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " +"command on your system." msgstr "" -#: library/ssl.rst:2614 +#: library/ssl.rst:2780 msgid "Multi-processing" msgstr "" -#: library/ssl.rst:2616 +#: library/ssl.rst:2782 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -2874,17 +3459,17 @@ msgid "" "sufficient." msgstr "" -#: library/ssl.rst:2628 +#: library/ssl.rst:2794 msgid "TLS 1.3" msgstr "" -#: library/ssl.rst:2632 +#: library/ssl.rst:2798 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: library/ssl.rst:2635 +#: library/ssl.rst:2801 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " "cipher suites are enabled by default. The method :meth:`SSLContext." @@ -2892,14 +3477,14 @@ msgid "" "`SSLContext.get_ciphers` returns them." msgstr "" -#: library/ssl.rst:2639 +#: library/ssl.rst:2805 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: library/ssl.rst:2642 +#: library/ssl.rst:2808 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -2907,103 +3492,103 @@ msgid "" "server." msgstr "" -#: library/ssl.rst:2646 +#: library/ssl.rst:2812 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: library/ssl.rst:2653 +#: library/ssl.rst:2818 msgid "Class :class:`socket.socket`" msgstr "" -#: library/ssl.rst:2653 +#: library/ssl.rst:2819 msgid "Documentation of underlying :mod:`socket` class" msgstr "" -#: library/ssl.rst:2656 +#: library/ssl.rst:2821 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" msgstr "" -#: library/ssl.rst:2656 +#: library/ssl.rst:2822 msgid "Intro from the Apache HTTP Server documentation" msgstr "" -#: library/ssl.rst:2659 +#: library/ssl.rst:2824 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" msgstr "" -#: library/ssl.rst:2659 +#: library/ssl.rst:2825 msgid "Steve Kent" msgstr "" -#: library/ssl.rst:2662 +#: library/ssl.rst:2827 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr "" -#: library/ssl.rst:2662 -msgid "Donald E., Jeffrey I. Schiller" +#: library/ssl.rst:2828 +msgid "Donald E. Eastlake, Jeffrey I. Schiller, Steve Crocker" msgstr "" -#: library/ssl.rst:2665 +#: library/ssl.rst:2830 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" msgstr "" -#: library/ssl.rst:2665 -msgid "D. Cooper" +#: library/ssl.rst:2831 +msgid "David Cooper et al." msgstr "" -#: library/ssl.rst:2668 +#: library/ssl.rst:2833 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" msgstr "" -#: library/ssl.rst:2668 -msgid "T. Dierks et. al." +#: library/ssl.rst:2834 +msgid "Tim Dierks and Eric Rescorla." msgstr "" -#: library/ssl.rst:2671 +#: library/ssl.rst:2836 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr "" -#: library/ssl.rst:2671 -msgid "D. Eastlake" +#: library/ssl.rst:2837 +msgid "Donald E. Eastlake" msgstr "" -#: library/ssl.rst:2674 +#: library/ssl.rst:2839 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" msgstr "" -#: library/ssl.rst:2674 +#: library/ssl.rst:2840 msgid "IANA" msgstr "" -#: library/ssl.rst:2677 +#: library/ssl.rst:2842 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" msgstr "" -#: library/ssl.rst:2677 +#: library/ssl.rst:2843 msgid "IETF" msgstr "" -#: library/ssl.rst:2679 +#: library/ssl.rst:2845 msgid "" "`Mozilla's Server Side TLS recommendations `_" msgstr "" -#: library/ssl.rst:2680 +#: library/ssl.rst:2846 msgid "Mozilla" msgstr "" @@ -3031,10 +3616,10 @@ msgstr "" msgid "Secure Sockets Layer" msgstr "" -#: library/ssl.rst:1993 +#: library/ssl.rst:2157 msgid "certificates" msgstr "" -#: library/ssl.rst:1995 +#: library/ssl.rst:2159 msgid "X509 certificate" msgstr "" diff --git a/library/stat.po b/library/stat.po index 178b2a17..911131f3 100644 --- a/library/stat.po +++ b/library/stat.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/stat.rst:2 -msgid ":mod:`stat` --- Interpreting :func:`~os.stat` results" +msgid ":mod:`!stat` --- Interpreting :func:`~os.stat` results" msgstr "" #: library/stat.rst:10 @@ -115,6 +116,35 @@ msgstr "" msgid "Example::" msgstr "" +#: library/stat.rst:103 +msgid "" +"import os, sys\n" +"from stat import *\n" +"\n" +"def walktree(top, callback):\n" +" '''recursively descend the directory tree rooted at top,\n" +" calling the callback function for each regular file'''\n" +"\n" +" for f in os.listdir(top):\n" +" pathname = os.path.join(top, f)\n" +" mode = os.lstat(pathname).st_mode\n" +" if S_ISDIR(mode):\n" +" # It's a directory, recurse into it\n" +" walktree(pathname, callback)\n" +" elif S_ISREG(mode):\n" +" # It's a file, call the callback function\n" +" callback(pathname)\n" +" else:\n" +" # Unknown file type, print a message\n" +" print('Skipping %s' % pathname)\n" +"\n" +"def visitfile(file):\n" +" print('visiting', file)\n" +"\n" +"if __name__ == '__main__':\n" +" walktree(sys.argv[1], visitfile)" +msgstr "" + #: library/stat.rst:129 msgid "" "An additional utility function is provided to convert a file's mode in a " @@ -350,48 +380,88 @@ msgid "" msgstr "" #: library/stat.rst:355 +msgid "All user settable flags." +msgstr "" + +#: library/stat.rst:361 msgid "Do not dump the file." msgstr "" -#: library/stat.rst:387 +#: library/stat.rst:427 msgid "The file may not be changed." msgstr "" -#: library/stat.rst:391 +#: library/stat.rst:431 msgid "The file may only be appended to." msgstr "" -#: library/stat.rst:367 +#: library/stat.rst:373 msgid "The directory is opaque when viewed through a union stack." msgstr "" -#: library/stat.rst:395 +#: library/stat.rst:441 msgid "The file may not be renamed or deleted." msgstr "" -#: library/stat.rst:375 +#: library/stat.rst:381 msgid "The file is stored compressed (macOS 10.6+)." msgstr "" -#: library/stat.rst:379 +#: library/stat.rst:385 +msgid "Used for handling document IDs (macOS)" +msgstr "" + +#: library/stat.rst:391 +msgid "The file needs an entitlement for reading or writing (macOS 10.13+)" +msgstr "" + +#: library/stat.rst:397 msgid "The file should not be displayed in a GUI (macOS 10.5+)." msgstr "" -#: library/stat.rst:383 +#: library/stat.rst:401 +msgid "All super-user changeable flags" +msgstr "" + +#: library/stat.rst:407 +msgid "All super-user supported flags" +msgstr "" + +#: library/stat.rst:417 +msgid "Availability" +msgstr "" + +#: library/stat.rst:415 +msgid "All super-user read-only synthetic flags" +msgstr "" + +#: library/stat.rst:423 msgid "The file may be archived." msgstr "" -#: library/stat.rst:399 +#: library/stat.rst:435 +msgid "The file needs an entitlement to write to (macOS 10.13+)" +msgstr "" + +#: library/stat.rst:445 msgid "The file is a snapshot file." msgstr "" -#: library/stat.rst:401 +#: library/stat.rst:449 +msgid "The file is a firmlink (macOS 10.15+)" +msgstr "" + +#: library/stat.rst:455 +msgid "The file is a dataless object (macOS 10.15+)" +msgstr "" + +#: library/stat.rst:459 msgid "" "See the \\*BSD or macOS systems man page :manpage:`chflags(2)` for more " "information." msgstr "" -#: library/stat.rst:403 +#: library/stat.rst:461 msgid "" "On Windows, the following file attribute constants are available for use " "when testing bits in the ``st_file_attributes`` member returned by :func:`os." @@ -400,7 +470,7 @@ msgid "" "these constants." msgstr "" -#: library/stat.rst:429 +#: library/stat.rst:487 msgid "" "On Windows, the following constants are available for comparing against the " "``st_reparse_tag`` member returned by :func:`os.lstat`. These are well-known " diff --git a/library/statistics.po b/library/statistics.po index fb56d90e..fb351da1 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/statistics.rst:2 -msgid ":mod:`statistics` --- Mathematical statistics functions" +msgid ":mod:`!statistics` --- Mathematical statistics functions" msgstr "" #: library/statistics.rst:12 @@ -61,6 +62,29 @@ msgid "" "functions::" msgstr "" +#: library/statistics.rst:47 +msgid "" +">>> from statistics import median\n" +">>> from math import isnan\n" +">>> from itertools import filterfalse\n" +"\n" +">>> data = [20.7, float('NaN'),19.2, 18.3, float('NaN'), 14.4]\n" +">>> sorted(data) # This has surprising behavior\n" +"[20.7, nan, 14.4, 18.3, 19.2, nan]\n" +">>> median(data) # This result is unexpected\n" +"16.35\n" +"\n" +">>> sum(map(isnan, data)) # Number of missing values\n" +"2\n" +">>> clean = list(filterfalse(isnan, data)) # Strip NaN values\n" +">>> clean\n" +"[20.7, 19.2, 18.3, 14.4]\n" +">>> sorted(clean) # Sorting now works as expected\n" +"[14.4, 18.3, 19.2, 20.7]\n" +">>> median(clean) # This result is now well defined\n" +"18.75" +msgstr "" + #: library/statistics.rst:69 msgid "Averages and measures of central location" msgstr "" @@ -84,7 +108,7 @@ msgid ":func:`fmean`" msgstr "" #: library/statistics.rst:76 -msgid "Fast, floating point arithmetic mean, with optional weighting." +msgid "Fast, floating-point arithmetic mean, with optional weighting." msgstr "" #: library/statistics.rst:77 @@ -104,153 +128,169 @@ msgid "Harmonic mean of data." msgstr "" #: library/statistics.rst:79 -msgid ":func:`median`" +msgid ":func:`kde`" msgstr "" #: library/statistics.rst:79 -msgid "Median (middle value) of data." +msgid "Estimate the probability density distribution of the data." msgstr "" #: library/statistics.rst:80 -msgid ":func:`median_low`" +msgid ":func:`kde_random`" msgstr "" #: library/statistics.rst:80 -msgid "Low median of data." +msgid "Random sampling from the PDF generated by kde()." msgstr "" #: library/statistics.rst:81 -msgid ":func:`median_high`" +msgid ":func:`median`" msgstr "" #: library/statistics.rst:81 -msgid "High median of data." +msgid "Median (middle value) of data." msgstr "" #: library/statistics.rst:82 -msgid ":func:`median_grouped`" +msgid ":func:`median_low`" msgstr "" #: library/statistics.rst:82 -msgid "Median, or 50th percentile, of grouped data." +msgid "Low median of data." msgstr "" #: library/statistics.rst:83 -msgid ":func:`mode`" +msgid ":func:`median_high`" msgstr "" #: library/statistics.rst:83 -msgid "Single mode (most common value) of discrete or nominal data." +msgid "High median of data." msgstr "" #: library/statistics.rst:84 -msgid ":func:`multimode`" +msgid ":func:`median_grouped`" msgstr "" #: library/statistics.rst:84 -msgid "List of modes (most common values) of discrete or nominal data." +msgid "Median (50th percentile) of grouped data." msgstr "" #: library/statistics.rst:85 -msgid ":func:`quantiles`" +msgid ":func:`mode`" msgstr "" #: library/statistics.rst:85 +msgid "Single mode (most common value) of discrete or nominal data." +msgstr "" + +#: library/statistics.rst:86 +msgid ":func:`multimode`" +msgstr "" + +#: library/statistics.rst:86 +msgid "List of modes (most common values) of discrete or nominal data." +msgstr "" + +#: library/statistics.rst:87 +msgid ":func:`quantiles`" +msgstr "" + +#: library/statistics.rst:87 msgid "Divide data into intervals with equal probability." msgstr "" -#: library/statistics.rst:89 +#: library/statistics.rst:91 msgid "Measures of spread" msgstr "" -#: library/statistics.rst:91 +#: library/statistics.rst:93 msgid "" "These functions calculate a measure of how much the population or sample " "tends to deviate from the typical or average values." msgstr "" -#: library/statistics.rst:95 +#: library/statistics.rst:97 msgid ":func:`pstdev`" msgstr "" -#: library/statistics.rst:95 +#: library/statistics.rst:97 msgid "Population standard deviation of data." msgstr "" -#: library/statistics.rst:96 +#: library/statistics.rst:98 msgid ":func:`pvariance`" msgstr "" -#: library/statistics.rst:96 +#: library/statistics.rst:98 msgid "Population variance of data." msgstr "" -#: library/statistics.rst:97 +#: library/statistics.rst:99 msgid ":func:`stdev`" msgstr "" -#: library/statistics.rst:97 +#: library/statistics.rst:99 msgid "Sample standard deviation of data." msgstr "" -#: library/statistics.rst:98 +#: library/statistics.rst:100 msgid ":func:`variance`" msgstr "" -#: library/statistics.rst:98 +#: library/statistics.rst:100 msgid "Sample variance of data." msgstr "" -#: library/statistics.rst:102 +#: library/statistics.rst:104 msgid "Statistics for relations between two inputs" msgstr "" -#: library/statistics.rst:104 +#: library/statistics.rst:106 msgid "" "These functions calculate statistics regarding relations between two inputs." msgstr "" -#: library/statistics.rst:107 +#: library/statistics.rst:109 msgid ":func:`covariance`" msgstr "" -#: library/statistics.rst:107 +#: library/statistics.rst:109 msgid "Sample covariance for two variables." msgstr "" -#: library/statistics.rst:108 +#: library/statistics.rst:110 msgid ":func:`correlation`" msgstr "" -#: library/statistics.rst:108 +#: library/statistics.rst:110 msgid "Pearson and Spearman's correlation coefficients." msgstr "" -#: library/statistics.rst:109 +#: library/statistics.rst:111 msgid ":func:`linear_regression`" msgstr "" -#: library/statistics.rst:109 +#: library/statistics.rst:111 msgid "Slope and intercept for simple linear regression." msgstr "" -#: library/statistics.rst:114 +#: library/statistics.rst:116 msgid "Function details" msgstr "" -#: library/statistics.rst:116 +#: library/statistics.rst:118 msgid "" "Note: The functions do not require the data given to them to be sorted. " "However, for reading convenience, most of the examples show sorted sequences." msgstr "" -#: library/statistics.rst:121 +#: library/statistics.rst:123 msgid "" "Return the sample arithmetic mean of *data* which can be a sequence or " "iterable." msgstr "" -#: library/statistics.rst:123 +#: library/statistics.rst:125 msgid "" "The arithmetic mean is the sum of the data divided by the number of data " "points. It is commonly called \"the average\", although it is only one of " @@ -258,15 +298,31 @@ msgid "" "location of the data." msgstr "" -#: library/statistics.rst:128 +#: library/statistics.rst:130 msgid "If *data* is empty, :exc:`StatisticsError` will be raised." msgstr "" -#: library/statistics.rst:130 +#: library/statistics.rst:132 msgid "Some examples of use:" msgstr "" -#: library/statistics.rst:149 +#: library/statistics.rst:134 +msgid "" +">>> mean([1, 2, 3, 4, 4])\n" +"2.8\n" +">>> mean([-1.0, 2.5, 3.25, 5.75])\n" +"2.625\n" +"\n" +">>> from fractions import Fraction as F\n" +">>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])\n" +"Fraction(13, 21)\n" +"\n" +">>> from decimal import Decimal as D\n" +">>> mean([D(\"0.5\"), D(\"0.75\"), D(\"0.625\"), D(\"0.375\")])\n" +"Decimal('0.5625')" +msgstr "" + +#: library/statistics.rst:151 msgid "" "The mean is strongly affected by `outliers `_ and is not necessarily a typical example of the data points. For " @@ -274,7 +330,7 @@ msgid "" "`_, see :func:`median`." msgstr "" -#: library/statistics.rst:155 +#: library/statistics.rst:157 msgid "" "The sample mean gives an unbiased estimate of the true population mean, so " "that when taken on average over all the possible samples, ``mean(sample)`` " @@ -283,65 +339,86 @@ msgid "" "equivalent to calculating the true population mean μ." msgstr "" -#: library/statistics.rst:164 +#: library/statistics.rst:166 msgid "Convert *data* to floats and compute the arithmetic mean." msgstr "" -#: library/statistics.rst:166 +#: library/statistics.rst:168 msgid "" "This runs faster than the :func:`mean` function and it always returns a :" "class:`float`. The *data* may be a sequence or iterable. If the input " "dataset is empty, raises a :exc:`StatisticsError`." msgstr "" -#: library/statistics.rst:175 +#: library/statistics.rst:172 +msgid "" +">>> fmean([3.5, 4.0, 5.25])\n" +"4.25" +msgstr "" + +#: library/statistics.rst:177 msgid "" "Optional weighting is supported. For example, a professor assigns a grade " "for a course by weighting quizzes at 20%, homework at 20%, a midterm exam at " "30%, and a final exam at 30%:" msgstr "" -#: library/statistics.rst:186 +#: library/statistics.rst:181 +msgid "" +">>> grades = [85, 92, 83, 91]\n" +">>> weights = [0.20, 0.20, 0.30, 0.30]\n" +">>> fmean(grades, weights)\n" +"87.6" +msgstr "" + +#: library/statistics.rst:188 msgid "" "If *weights* is supplied, it must be the same length as the *data* or a :exc:" "`ValueError` will be raised." msgstr "" -#: library/statistics.rst:259 +#: library/statistics.rst:261 msgid "Added support for *weights*." msgstr "" -#: library/statistics.rst:197 +#: library/statistics.rst:199 msgid "Convert *data* to floats and compute the geometric mean." msgstr "" -#: library/statistics.rst:199 +#: library/statistics.rst:201 msgid "" "The geometric mean indicates the central tendency or typical value of the " "*data* using the product of the values (as opposed to the arithmetic mean " "which uses their sum)." msgstr "" -#: library/statistics.rst:203 +#: library/statistics.rst:205 msgid "" "Raises a :exc:`StatisticsError` if the input dataset is empty, if it " "contains a zero, or if it contains a negative value. The *data* may be a " "sequence or iterable." msgstr "" -#: library/statistics.rst:207 +#: library/statistics.rst:209 msgid "" "No special efforts are made to achieve exact results. (However, this may " "change in the future.)" msgstr "" -#: library/statistics.rst:220 +#: library/statistics.rst:212 +msgid "" +">>> round(geometric_mean([54, 24, 36]), 1)\n" +"36.0" +msgstr "" + +#: library/statistics.rst:222 msgid "" "Return the harmonic mean of *data*, a sequence or iterable of real-valued " -"numbers. If *weights* is omitted or *None*, then equal weighting is assumed." +"numbers. If *weights* is omitted or ``None``, then equal weighting is " +"assumed." msgstr "" -#: library/statistics.rst:224 +#: library/statistics.rst:226 msgid "" "The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the " "reciprocals of the data. For example, the harmonic mean of three values *a*, " @@ -349,166 +426,327 @@ msgid "" "values is zero, the result will be zero." msgstr "" -#: library/statistics.rst:229 +#: library/statistics.rst:231 msgid "" "The harmonic mean is a type of average, a measure of the central location of " "the data. It is often appropriate when averaging ratios or rates, for " "example speeds." msgstr "" -#: library/statistics.rst:233 +#: library/statistics.rst:235 msgid "" "Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. " "What is the average speed?" msgstr "" -#: library/statistics.rst:241 +#: library/statistics.rst:238 +msgid "" +">>> harmonic_mean([40, 60])\n" +"48.0" +msgstr "" + +#: library/statistics.rst:243 msgid "" "Suppose a car travels 40 km/hr for 5 km, and when traffic clears, speeds-up " "to 60 km/hr for the remaining 30 km of the journey. What is the average " "speed?" msgstr "" -#: library/statistics.rst:250 +#: library/statistics.rst:247 +msgid "" +">>> harmonic_mean([40, 60], weights=[5, 30])\n" +"56.0" +msgstr "" + +#: library/statistics.rst:252 msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." msgstr "" -#: library/statistics.rst:253 +#: library/statistics.rst:255 msgid "" "The current algorithm has an early-out when it encounters a zero in the " "input. This means that the subsequent inputs are not tested for validity. " "(This behavior may change in the future.)" msgstr "" -#: library/statistics.rst:264 +#: library/statistics.rst:267 +msgid "" +"`Kernel Density Estimation (KDE) `_: Create a continuous " +"probability density function or cumulative distribution function from " +"discrete samples." +msgstr "" + +#: library/statistics.rst:272 +msgid "" +"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about a " +"population from a sample." +msgstr "" + +#: library/statistics.rst:276 +msgid "" +"The degree of smoothing is controlled by the scaling parameter *h* which is " +"called the bandwidth. Smaller values emphasize local features while larger " +"values give smoother results." +msgstr "" + +#: library/statistics.rst:280 +msgid "" +"The *kernel* determines the relative weights of the sample data points. " +"Generally, the choice of kernel shape does not matter as much as the more " +"influential bandwidth smoothing parameter." +msgstr "" + +#: library/statistics.rst:284 +msgid "" +"Kernels that give some weight to every sample point include *normal* " +"(*gauss*), *logistic*, and *sigmoid*." +msgstr "" + +#: library/statistics.rst:287 +msgid "" +"Kernels that only give weight to sample points within the bandwidth include " +"*rectangular* (*uniform*), *triangular*, *parabolic* (*epanechnikov*), " +"*quartic* (*biweight*), *triweight*, and *cosine*." +msgstr "" + +#: library/statistics.rst:291 +msgid "" +"If *cumulative* is true, will return a cumulative distribution function." +msgstr "" + +#: library/statistics.rst:324 +msgid "" +"A :exc:`StatisticsError` will be raised if the *data* sequence is empty." +msgstr "" + +#: library/statistics.rst:295 +msgid "" +"`Wikipedia has an example `_ where we can use :func:`kde` to " +"generate and plot a probability density function estimated from a small " +"sample:" +msgstr "" + +#: library/statistics.rst:300 +msgid "" +">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" +">>> f_hat = kde(sample, h=1.5)\n" +">>> xarr = [i/100 for i in range(-750, 1100)]\n" +">>> yarr = [f_hat(x) for x in xarr]" +msgstr "" + +#: library/statistics.rst:307 +msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" +msgstr "" + +#: library/statistics.rst:309 +msgid "Scatter plot of the estimated probability density function." +msgstr "" + +#: library/statistics.rst:317 +msgid "" +"Return a function that makes a random selection from the estimated " +"probability density function produced by ``kde(data, h, kernel)``." +msgstr "" + +#: library/statistics.rst:320 +msgid "" +"Providing a *seed* allows reproducible selections. In the future, the values " +"may change slightly as more accurate kernel inverse CDF estimates are " +"implemented. The seed may be an integer, float, str, or bytes." +msgstr "" + +#: library/statistics.rst:326 +msgid "" +"Continuing the example for :func:`kde`, we can use :func:`kde_random` to " +"generate new random selections from an estimated probability density " +"function:" +msgstr "" + +#: library/statistics.rst:341 msgid "" "Return the median (middle value) of numeric data, using the common \"mean of " "middle two\" method. If *data* is empty, :exc:`StatisticsError` is raised. " "*data* can be a sequence or iterable." msgstr "" -#: library/statistics.rst:268 +#: library/statistics.rst:345 msgid "" "The median is a robust measure of central location and is less affected by " "the presence of outliers. When the number of data points is odd, the middle " "data point is returned:" msgstr "" -#: library/statistics.rst:277 +#: library/statistics.rst:349 +msgid "" +">>> median([1, 3, 5])\n" +"3" +msgstr "" + +#: library/statistics.rst:354 msgid "" "When the number of data points is even, the median is interpolated by taking " "the average of the two middle values:" msgstr "" -#: library/statistics.rst:285 +#: library/statistics.rst:357 +msgid "" +">>> median([1, 3, 5, 7])\n" +"4.0" +msgstr "" + +#: library/statistics.rst:362 msgid "" "This is suited for when your data is discrete, and you don't mind that the " "median may not be an actual data point." msgstr "" -#: library/statistics.rst:288 +#: library/statistics.rst:365 msgid "" "If the data is ordinal (supports order operations) but not numeric (doesn't " "support addition), consider using :func:`median_low` or :func:`median_high` " "instead." msgstr "" -#: library/statistics.rst:294 +#: library/statistics.rst:371 msgid "" "Return the low median of numeric data. If *data* is empty, :exc:" "`StatisticsError` is raised. *data* can be a sequence or iterable." msgstr "" -#: library/statistics.rst:297 +#: library/statistics.rst:374 msgid "" "The low median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the smaller " "of the two middle values is returned." msgstr "" -#: library/statistics.rst:308 +#: library/statistics.rst:378 +msgid "" +">>> median_low([1, 3, 5])\n" +"3\n" +">>> median_low([1, 3, 5, 7])\n" +"3" +msgstr "" + +#: library/statistics.rst:385 msgid "" "Use the low median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." msgstr "" -#: library/statistics.rst:314 +#: library/statistics.rst:391 msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -#: library/statistics.rst:317 +#: library/statistics.rst:394 msgid "" "The high median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the larger of " "the two middle values is returned." msgstr "" -#: library/statistics.rst:328 +#: library/statistics.rst:398 +msgid "" +">>> median_high([1, 3, 5])\n" +"3\n" +">>> median_high([1, 3, 5, 7])\n" +"5" +msgstr "" + +#: library/statistics.rst:405 msgid "" "Use the high median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." msgstr "" -#: library/statistics.rst:334 +#: library/statistics.rst:411 msgid "" -"Return the median of grouped continuous data, calculated as the 50th " -"percentile, using interpolation. If *data* is empty, :exc:`StatisticsError` " -"is raised. *data* can be a sequence or iterable." +"Estimates the median for numeric data that has been `grouped or binned " +"`_ around the midpoints of " +"consecutive, fixed-width intervals." msgstr "" -#: library/statistics.rst:343 +#: library/statistics.rst:415 msgid "" -"In the following example, the data are rounded, so that each value " -"represents the midpoint of data classes, e.g. 1 is the midpoint of the class " -"0.5--1.5, 2 is the midpoint of 1.5--2.5, 3 is the midpoint of 2.5--3.5, " -"etc. With the data given, the middle value falls somewhere in the class " -"3.5--4.5, and interpolation is used to estimate it:" +"The *data* can be any iterable of numeric data with each value being exactly " +"the midpoint of a bin. At least one value must be present." msgstr "" -#: library/statistics.rst:354 +#: library/statistics.rst:418 +msgid "The *interval* is the width of each bin." +msgstr "" + +#: library/statistics.rst:420 msgid "" -"Optional argument *interval* represents the class interval, and defaults to " -"1. Changing the class interval naturally will change the interpolation:" +"For example, demographic information may have been summarized into " +"consecutive ten-year age groups with each group being represented by the 5-" +"year midpoints of the intervals:" msgstr "" -#: library/statistics.rst:364 +#: library/statistics.rst:424 msgid "" -"This function does not check whether the data points are at least *interval* " -"apart." +">>> from collections import Counter\n" +">>> demographics = Counter({\n" +"... 25: 172, # 20 to 30 years old\n" +"... 35: 484, # 30 to 40 years old\n" +"... 45: 387, # 40 to 50 years old\n" +"... 55: 22, # 50 to 60 years old\n" +"... 65: 6, # 60 to 70 years old\n" +"... })\n" +"..." msgstr "" -#: library/statistics.rst:369 +#: library/statistics.rst:436 msgid "" -"Under some circumstances, :func:`median_grouped` may coerce data points to " -"floats. This behaviour is likely to change in the future." +"The 50th percentile (median) is the 536th person out of the 1071 member " +"cohort. That person is in the 30 to 40 year old age group." msgstr "" -#: library/statistics.rst:374 +#: library/statistics.rst:439 msgid "" -"\"Statistics for the Behavioral Sciences\", Frederick J Gravetter and Larry " -"B Wallnau (8th Edition)." +"The regular :func:`median` function would assume that everyone in the " +"tricenarian age group was exactly 35 years old. A more tenable assumption " +"is that the 484 members of that age group are evenly distributed between 30 " +"and 40. For that, we use :func:`median_grouped`:" msgstr "" -#: library/statistics.rst:377 +#: library/statistics.rst:445 msgid "" -"The `SSMEDIAN `_ function in the Gnome Gnumeric " -"spreadsheet, including `this discussion `_." +">>> data = list(demographics.elements())\n" +">>> median(data)\n" +"35\n" +">>> round(median_grouped(data, interval=10), 1)\n" +"37.5" msgstr "" -#: library/statistics.rst:385 +#: library/statistics.rst:453 +msgid "" +"The caller is responsible for making sure the data points are separated by " +"exact multiples of *interval*. This is essential for getting a correct " +"result. The function does not check this precondition." +msgstr "" + +#: library/statistics.rst:457 +msgid "" +"Inputs may be any numeric type that can be coerced to a float during the " +"interpolation step." +msgstr "" + +#: library/statistics.rst:463 msgid "" "Return the single most common data point from discrete or nominal *data*. " "The mode (when it exists) is the most typical value and serves as a measure " "of central location." msgstr "" -#: library/statistics.rst:389 +#: library/statistics.rst:467 msgid "" "If there are multiple modes with the same frequency, returns the first one " "encountered in the *data*. If the smallest or largest of those is desired " @@ -516,38 +754,74 @@ msgid "" "input *data* is empty, :exc:`StatisticsError` is raised." msgstr "" -#: library/statistics.rst:394 +#: library/statistics.rst:472 msgid "" "``mode`` assumes discrete data and returns a single value. This is the " "standard treatment of the mode as commonly taught in schools:" msgstr "" -#: library/statistics.rst:402 +#: library/statistics.rst:475 +msgid "" +">>> mode([1, 1, 2, 3, 3, 3, 3, 4])\n" +"3" +msgstr "" + +#: library/statistics.rst:480 msgid "" "The mode is unique in that it is the only statistic in this package that " "also applies to nominal (non-numeric) data:" msgstr "" -#: library/statistics.rst:410 +#: library/statistics.rst:483 +msgid "" +">>> mode([\"red\", \"blue\", \"blue\", \"red\", \"green\", \"red\", " +"\"red\"])\n" +"'red'" +msgstr "" + +#: library/statistics.rst:488 +msgid "" +"Only hashable inputs are supported. To handle type :class:`set`, consider " +"casting to :class:`frozenset`. To handle type :class:`list`, consider " +"casting to :class:`tuple`. For mixed or nested inputs, consider using this " +"slower quadratic algorithm that only depends on equality tests: ``max(data, " +"key=data.count)``." +msgstr "" + +#: library/statistics.rst:494 msgid "" "Now handles multimodal datasets by returning the first mode encountered. " "Formerly, it raised :exc:`StatisticsError` when more than one mode was found." msgstr "" -#: library/statistics.rst:418 +#: library/statistics.rst:502 msgid "" "Return a list of the most frequently occurring values in the order they were " "first encountered in the *data*. Will return more than one result if there " "are multiple modes or an empty list if the *data* is empty:" msgstr "" -#: library/statistics.rst:434 +#: library/statistics.rst:506 +msgid "" +">>> multimode('aabbbbccddddeeffffgg')\n" +"['b', 'd', 'f']\n" +">>> multimode('')\n" +"[]" +msgstr "" + +#: library/statistics.rst:518 msgid "" "Return the population standard deviation (the square root of the population " "variance). See :func:`pvariance` for arguments and other details." msgstr "" -#: library/statistics.rst:445 +#: library/statistics.rst:521 +msgid "" +">>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" +"0.986893273527251" +msgstr "" + +#: library/statistics.rst:529 msgid "" "Return the population variance of *data*, a non-empty sequence or iterable " "of real-valued numbers. Variance, or second moment about the mean, is a " @@ -556,47 +830,73 @@ msgid "" "clustered closely around the mean." msgstr "" -#: library/statistics.rst:451 +#: library/statistics.rst:535 msgid "" -"If the optional second argument *mu* is given, it is typically the mean of " -"the *data*. It can also be used to compute the second moment around a point " -"that is not the mean. If it is missing or ``None`` (the default), the " -"arithmetic mean is automatically calculated." +"If the optional second argument *mu* is given, it should be the *population* " +"mean of the *data*. It can also be used to compute the second moment around " +"a point that is not the mean. If it is missing or ``None`` (the default), " +"the arithmetic mean is automatically calculated." msgstr "" -#: library/statistics.rst:456 +#: library/statistics.rst:540 msgid "" "Use this function to calculate the variance from the entire population. To " "estimate the variance from a sample, the :func:`variance` function is " "usually a better choice." msgstr "" -#: library/statistics.rst:460 +#: library/statistics.rst:544 msgid "Raises :exc:`StatisticsError` if *data* is empty." msgstr "" -#: library/statistics.rst:532 library/statistics.rst:636 +#: library/statistics.rst:616 library/statistics.rst:725 msgid "Examples:" msgstr "" -#: library/statistics.rst:470 +#: library/statistics.rst:548 +msgid "" +">>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]\n" +">>> pvariance(data)\n" +"1.25" +msgstr "" + +#: library/statistics.rst:554 msgid "" "If you have already calculated the mean of your data, you can pass it as the " "optional second argument *mu* to avoid recalculation:" msgstr "" -#: library/statistics.rst:479 +#: library/statistics.rst:557 +msgid "" +">>> mu = mean(data)\n" +">>> pvariance(data, mu)\n" +"1.25" +msgstr "" + +#: library/statistics.rst:563 msgid "Decimals and Fractions are supported:" msgstr "" -#: library/statistics.rst:493 +#: library/statistics.rst:565 +msgid "" +">>> from decimal import Decimal as D\n" +">>> pvariance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " +"D(\"41.75\")])\n" +"Decimal('24.815')\n" +"\n" +">>> from fractions import Fraction as F\n" +">>> pvariance([F(1, 4), F(5, 4), F(1, 2)])\n" +"Fraction(13, 72)" +msgstr "" + +#: library/statistics.rst:577 msgid "" "When called with the entire population, this gives the population variance " "σ². When called on a sample instead, this is the biased sample variance s², " "also known as variance with N degrees of freedom." msgstr "" -#: library/statistics.rst:497 +#: library/statistics.rst:581 msgid "" "If you somehow know the true population mean μ, you may use this function to " "calculate the variance of a sample, giving the known population mean as the " @@ -605,13 +905,19 @@ msgid "" "variance." msgstr "" -#: library/statistics.rst:506 +#: library/statistics.rst:590 msgid "" "Return the sample standard deviation (the square root of the sample " "variance). See :func:`variance` for arguments and other details." msgstr "" -#: library/statistics.rst:517 +#: library/statistics.rst:593 +msgid "" +">>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" +"1.0810874155219827" +msgstr "" + +#: library/statistics.rst:601 msgid "" "Return the sample variance of *data*, an iterable of at least two real-" "valued numbers. Variance, or second moment about the mean, is a measure of " @@ -620,41 +926,67 @@ msgid "" "closely around the mean." msgstr "" -#: library/statistics.rst:523 +#: library/statistics.rst:607 msgid "" -"If the optional second argument *xbar* is given, it should be the mean of " -"*data*. If it is missing or ``None`` (the default), the mean is " +"If the optional second argument *xbar* is given, it should be the *sample* " +"mean of *data*. If it is missing or ``None`` (the default), the mean is " "automatically calculated." msgstr "" -#: library/statistics.rst:527 +#: library/statistics.rst:611 msgid "" "Use this function when your data is a sample from a population. To calculate " "the variance from the entire population, see :func:`pvariance`." msgstr "" -#: library/statistics.rst:530 +#: library/statistics.rst:614 msgid "Raises :exc:`StatisticsError` if *data* has fewer than two values." msgstr "" -#: library/statistics.rst:540 +#: library/statistics.rst:618 msgid "" -"If you have already calculated the mean of your data, you can pass it as the " -"optional second argument *xbar* to avoid recalculation:" +">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" +">>> variance(data)\n" +"1.3720238095238095" +msgstr "" + +#: library/statistics.rst:624 +msgid "" +"If you have already calculated the sample mean of your data, you can pass it " +"as the optional second argument *xbar* to avoid recalculation:" msgstr "" -#: library/statistics.rst:549 +#: library/statistics.rst:627 +msgid "" +">>> m = mean(data)\n" +">>> variance(data, m)\n" +"1.3720238095238095" +msgstr "" + +#: library/statistics.rst:633 msgid "" "This function does not attempt to verify that you have passed the actual " "mean as *xbar*. Using arbitrary values for *xbar* can lead to invalid or " "impossible results." msgstr "" -#: library/statistics.rst:553 +#: library/statistics.rst:637 msgid "Decimal and Fraction values are supported:" msgstr "" -#: library/statistics.rst:567 +#: library/statistics.rst:639 +msgid "" +">>> from decimal import Decimal as D\n" +">>> variance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " +"D(\"41.75\")])\n" +"Decimal('31.01875')\n" +"\n" +">>> from fractions import Fraction as F\n" +">>> variance([F(1, 6), F(1, 2), F(5, 3)])\n" +"Fraction(67, 108)" +msgstr "" + +#: library/statistics.rst:651 msgid "" "This is the sample variance s² with Bessel's correction, also known as " "variance with N-1 degrees of freedom. Provided that the data points are " @@ -662,20 +994,20 @@ msgid "" "should be an unbiased estimate of the true population variance." msgstr "" -#: library/statistics.rst:572 +#: library/statistics.rst:656 msgid "" "If you somehow know the actual population mean μ you should pass it to the :" "func:`pvariance` function as the *mu* parameter to get the variance of a " "sample." msgstr "" -#: library/statistics.rst:578 +#: library/statistics.rst:662 msgid "" "Divide *data* into *n* continuous intervals with equal probability. Returns " "a list of ``n - 1`` cut points separating the intervals." msgstr "" -#: library/statistics.rst:581 +#: library/statistics.rst:665 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate " @@ -683,28 +1015,28 @@ msgid "" "not least 1." msgstr "" -#: library/statistics.rst:586 +#: library/statistics.rst:670 msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " -"Raises :exc:`StatisticsError` if there are not at least two data points." +"Raises :exc:`StatisticsError` if there is not at least one data point." msgstr "" -#: library/statistics.rst:590 +#: library/statistics.rst:674 msgid "" "The cut points are linearly interpolated from the two nearest data points. " "For example, if a cut point falls one-third of the distance between two " "sample values, ``100`` and ``112``, the cut-point will evaluate to ``104``." msgstr "" -#: library/statistics.rst:595 +#: library/statistics.rst:679 msgid "" "The *method* for computing quantiles can be varied depending on whether the " "*data* includes or excludes the lowest and highest possible values from the " "population." msgstr "" -#: library/statistics.rst:599 +#: library/statistics.rst:683 msgid "" "The default *method* is \"exclusive\" and is used for data sampled from a " "population that can have more extreme values than found in the samples. The " @@ -714,7 +1046,7 @@ msgid "" "70%, 80%, 90%." msgstr "" -#: library/statistics.rst:606 +#: library/statistics.rst:690 msgid "" "Setting the *method* to \"inclusive\" is used for describing population data " "or for samples that are known to include the most extreme values from the " @@ -726,19 +1058,51 @@ msgid "" "80%, 90%, 100%." msgstr "" -#: library/statistics.rst:630 +#: library/statistics.rst:699 +msgid "" +"# Decile cut points for empirically sampled data\n" +">>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,\n" +"... 100, 75, 105, 103, 109, 76, 119, 99, 91, 103, 129,\n" +"... 106, 101, 84, 111, 74, 87, 86, 103, 103, 106, 86,\n" +"... 111, 75, 87, 102, 121, 111, 88, 89, 101, 106, 95,\n" +"... 103, 107, 101, 81, 109, 104]\n" +">>> [round(q, 1) for q in quantiles(data, n=10)]\n" +"[81.0, 86.2, 89.0, 99.4, 102.5, 103.6, 106.0, 109.8, 111.0]" +msgstr "" + +#: library/statistics.rst:712 +msgid "" +"No longer raises an exception for an input with only a single data point. " +"This allows quantile estimates to be built up one sample point at a time " +"becoming gradually more refined with each new data point." +msgstr "" + +#: library/statistics.rst:719 msgid "" "Return the sample covariance of two inputs *x* and *y*. Covariance is a " "measure of the joint variability of two inputs." msgstr "" -#: library/statistics.rst:633 +#: library/statistics.rst:722 msgid "" "Both inputs must be of the same length (no less than two), otherwise :exc:" "`StatisticsError` is raised." msgstr "" -#: library/statistics.rst:654 +#: library/statistics.rst:727 +msgid "" +">>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" +">>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]\n" +">>> covariance(x, y)\n" +"0.75\n" +">>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]\n" +">>> covariance(x, z)\n" +"-7.5\n" +">>> covariance(z, x)\n" +"-7.5" +msgstr "" + +#: library/statistics.rst:743 msgid "" "Return the `Pearson's correlation coefficient `_ for two inputs. Pearson's correlation " @@ -746,7 +1110,7 @@ msgid "" "direction of a linear relationship." msgstr "" -#: library/statistics.rst:660 +#: library/statistics.rst:749 msgid "" "If *method* is \"ranked\", computes `Spearman's rank correlation coefficient " "`_ " @@ -755,30 +1119,55 @@ msgid "" "strength of a monotonic relationship." msgstr "" -#: library/statistics.rst:666 +#: library/statistics.rst:755 msgid "" "Spearman's correlation coefficient is appropriate for ordinal data or for " "continuous data that doesn't meet the linear proportion requirement for " "Pearson's correlation coefficient." msgstr "" -#: library/statistics.rst:670 +#: library/statistics.rst:759 msgid "" "Both inputs must be of the same length (no less than two), and need not to " "be constant, otherwise :exc:`StatisticsError` is raised." msgstr "" -#: library/statistics.rst:673 +#: library/statistics.rst:762 msgid "" "Example with `Kepler's laws of planetary motion `_:" msgstr "" -#: library/statistics.rst:700 +#: library/statistics.rst:765 +msgid "" +">>> # Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune\n" +">>> orbital_period = [88, 225, 365, 687, 4331, 10_756, 30_687, 60_190] # " +"days\n" +">>> dist_from_sun = [58, 108, 150, 228, 778, 1_400, 2_900, 4_500] # million " +"km\n" +"\n" +">>> # Show that a perfect monotonic relationship exists\n" +">>> correlation(orbital_period, dist_from_sun, method='ranked')\n" +"1.0\n" +"\n" +">>> # Observe that a linear relationship is imperfect\n" +">>> round(correlation(orbital_period, dist_from_sun), 4)\n" +"0.9882\n" +"\n" +">>> # Demonstrate Kepler's third law: There is a linear correlation\n" +">>> # between the square of the orbital period and the cube of the\n" +">>> # distance from the sun.\n" +">>> period_squared = [p * p for p in orbital_period]\n" +">>> dist_cubed = [d * d * d for d in dist_from_sun]\n" +">>> round(correlation(period_squared, dist_cubed), 4)\n" +"1.0" +msgstr "" + +#: library/statistics.rst:789 msgid "Added support for Spearman's rank correlation coefficient." msgstr "" -#: library/statistics.rst:705 +#: library/statistics.rst:794 msgid "" "Return the slope and intercept of `simple linear regression `_ parameters estimated using " @@ -787,11 +1176,11 @@ msgid "" "this linear function:" msgstr "" -#: library/statistics.rst:711 +#: library/statistics.rst:800 msgid "*y = slope \\* x + intercept + noise*" msgstr "" -#: library/statistics.rst:713 +#: library/statistics.rst:802 msgid "" "where ``slope`` and ``intercept`` are the regression parameters that are " "estimated, and ``noise`` represents the variability of the data that was not " @@ -799,14 +1188,14 @@ msgid "" "predicted and actual values of the dependent variable)." msgstr "" -#: library/statistics.rst:719 +#: library/statistics.rst:808 msgid "" "Both inputs must be of the same length (no less than two), and the " "independent variable *x* cannot be constant; otherwise a :exc:" "`StatisticsError` is raised." msgstr "" -#: library/statistics.rst:723 +#: library/statistics.rst:812 msgid "" "For example, we can use the `release dates of the Monty Python films " "`_ to predict the " @@ -814,7 +1203,16 @@ msgid "" "2019 assuming that they had kept the pace." msgstr "" -#: library/statistics.rst:737 +#: library/statistics.rst:818 +msgid "" +">>> year = [1971, 1975, 1979, 1982, 1983]\n" +">>> films_total = [1, 2, 3, 4, 5]\n" +">>> slope, intercept = linear_regression(year, films_total)\n" +">>> round(slope * 2019 + intercept)\n" +"16" +msgstr "" + +#: library/statistics.rst:826 msgid "" "If *proportional* is true, the independent variable *x* and the dependent " "variable *y* are assumed to be directly proportional. The data is fit to a " @@ -822,38 +1220,54 @@ msgid "" "the underlying linear function simplifies to:" msgstr "" -#: library/statistics.rst:743 +#: library/statistics.rst:832 msgid "*y = slope \\* x + noise*" msgstr "" -#: library/statistics.rst:745 +#: library/statistics.rst:834 msgid "" "Continuing the example from :func:`correlation`, we look to see how well a " "model based on major planets can predict the orbital distances for dwarf " "planets:" msgstr "" -#: library/statistics.rst:765 +#: library/statistics.rst:838 +msgid "" +">>> model = linear_regression(period_squared, dist_cubed, " +"proportional=True)\n" +">>> slope = model.slope\n" +"\n" +">>> # Dwarf planets: Pluto, Eris, Makemake, Haumea, Ceres\n" +">>> orbital_periods = [90_560, 204_199, 111_845, 103_410, 1_680] # days\n" +">>> predicted_dist = [math.cbrt(slope * (p * p)) for p in orbital_periods]\n" +">>> list(map(round, predicted_dist))\n" +"[5912, 10166, 6806, 6459, 414]\n" +"\n" +">>> [5_906, 10_152, 6_796, 6_450, 414] # actual distance in million km\n" +"[5906, 10152, 6796, 6450, 414]" +msgstr "" + +#: library/statistics.rst:854 msgid "Added support for *proportional*." msgstr "" -#: library/statistics.rst:769 +#: library/statistics.rst:858 msgid "Exceptions" msgstr "" -#: library/statistics.rst:771 +#: library/statistics.rst:860 msgid "A single exception is defined:" msgstr "" -#: library/statistics.rst:775 +#: library/statistics.rst:864 msgid "Subclass of :exc:`ValueError` for statistics-related exceptions." msgstr "" -#: library/statistics.rst:779 +#: library/statistics.rst:868 msgid ":class:`NormalDist` objects" msgstr "" -#: library/statistics.rst:781 +#: library/statistics.rst:870 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " "distributions of a `random variable `_ and have a wide range of " "applications in statistics." msgstr "" -#: library/statistics.rst:793 +#: library/statistics.rst:882 msgid "" "Returns a new *NormalDist* object where *mu* represents the `arithmetic mean " "`_ and *sigma* represents the " "`standard deviation `_." msgstr "" -#: library/statistics.rst:798 +#: library/statistics.rst:887 msgid "If *sigma* is negative, raises :exc:`StatisticsError`." msgstr "" -#: library/statistics.rst:802 +#: library/statistics.rst:891 msgid "" "A read-only property for the `arithmetic mean `_ of a normal distribution." msgstr "" -#: library/statistics.rst:808 +#: library/statistics.rst:897 msgid "" "A read-only property for the `median `_ of a normal distribution." msgstr "" -#: library/statistics.rst:814 +#: library/statistics.rst:903 msgid "" "A read-only property for the `mode `_ of a normal distribution." msgstr "" -#: library/statistics.rst:820 +#: library/statistics.rst:909 msgid "" "A read-only property for the `standard deviation `_ of a normal distribution." msgstr "" -#: library/statistics.rst:826 +#: library/statistics.rst:915 msgid "" "A read-only property for the `variance `_ of a normal distribution. Equal to the square of the standard " "deviation." msgstr "" -#: library/statistics.rst:832 +#: library/statistics.rst:921 msgid "" "Makes a normal distribution instance with *mu* and *sigma* parameters " "estimated from the *data* using :func:`fmean` and :func:`stdev`." msgstr "" -#: library/statistics.rst:835 +#: library/statistics.rst:924 msgid "" "The *data* can be any :term:`iterable` and should consist of values that can " "be converted to type :class:`float`. If *data* does not contain at least " @@ -925,20 +1339,26 @@ msgid "" "dispersion." msgstr "" -#: library/statistics.rst:843 +#: library/statistics.rst:932 msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." msgstr "" -#: library/statistics.rst:846 +#: library/statistics.rst:935 msgid "" "If *seed* is given, creates a new instance of the underlying random number " "generator. This is useful for creating reproducible results, even in a " "multi-threading context." msgstr "" -#: library/statistics.rst:852 +#: library/statistics.rst:941 +msgid "" +"Switched to a faster algorithm. To reproduce samples from previous " +"versions, use :func:`random.seed` and :func:`random.gauss`." +msgstr "" + +#: library/statistics.rst:946 msgid "" "Using a `probability density function (pdf) `_, compute the relative likelihood that a " @@ -946,7 +1366,7 @@ msgid "" "the limit of the ratio ``P(x <= X < x+dx) / dx`` as *dx* approaches zero." msgstr "" -#: library/statistics.rst:858 +#: library/statistics.rst:952 msgid "" "The relative likelihood is computed as the probability of a sample occurring " "in a narrow range divided by the width of the range (hence the word " @@ -954,7 +1374,7 @@ msgid "" "can be greater than ``1.0``." msgstr "" -#: library/statistics.rst:865 +#: library/statistics.rst:959 msgid "" "Using a `cumulative distribution function (cdf) `_, compute the probability that a " @@ -962,7 +1382,7 @@ msgid "" "is written ``P(X <= x)``." msgstr "" -#: library/statistics.rst:872 +#: library/statistics.rst:966 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " @@ -971,34 +1391,34 @@ msgid "" "function. Mathematically, it is written ``x : P(X <= x) = p``." msgstr "" -#: library/statistics.rst:878 +#: library/statistics.rst:972 msgid "" "Finds the value *x* of the random variable *X* such that the probability of " "the variable being less than or equal to that value equals the given " "probability *p*." msgstr "" -#: library/statistics.rst:884 +#: library/statistics.rst:978 msgid "" "Measures the agreement between two normal probability distributions. Returns " "a value between 0.0 and 1.0 giving `the overlapping area for the two " "probability density functions `_." msgstr "" -#: library/statistics.rst:891 +#: library/statistics.rst:985 msgid "" "Divide the normal distribution into *n* continuous intervals with equal " "probability. Returns a list of (n - 1) cut points separating the intervals." msgstr "" -#: library/statistics.rst:895 +#: library/statistics.rst:989 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate the " "normal distribution into 100 equal sized groups." msgstr "" -#: library/statistics.rst:901 +#: library/statistics.rst:995 msgid "" "Compute the `Standard Score `_ describing *x* in terms of the number of standard " @@ -1006,20 +1426,27 @@ msgid "" "mean) / stdev``." msgstr "" -#: library/statistics.rst:909 +#: library/statistics.rst:1003 msgid "" "Instances of :class:`NormalDist` support addition, subtraction, " "multiplication and division by a constant. These operations are used for " "translation and scaling. For example:" msgstr "" -#: library/statistics.rst:919 +#: library/statistics.rst:1007 +msgid "" +">>> temperature_february = NormalDist(5, 2.5) # Celsius\n" +">>> temperature_february * (9/5) + 32 # Fahrenheit\n" +"NormalDist(mu=41.0, sigma=4.5)" +msgstr "" + +#: library/statistics.rst:1013 msgid "" "Dividing a constant by an instance of :class:`NormalDist` is not supported " "because the result wouldn't be normally distributed." msgstr "" -#: library/statistics.rst:922 +#: library/statistics.rst:1016 msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " @@ -1028,19 +1455,30 @@ msgid "" "class:`NormalDist`. For example:" msgstr "" -#: library/statistics.rst:942 -msgid ":class:`NormalDist` Examples and Recipes" +#: library/statistics.rst:1022 +msgid "" +">>> birth_weights = NormalDist.from_samples([2.5, 3.1, 2.1, 2.4, 2.7, 3.5])\n" +">>> drug_effects = NormalDist(0.4, 0.15)\n" +">>> combined = birth_weights + drug_effects\n" +">>> round(combined.mean, 1)\n" +"3.1\n" +">>> round(combined.stdev, 1)\n" +"0.5" msgstr "" -#: library/statistics.rst:946 +#: library/statistics.rst:1036 +msgid "Examples and Recipes" +msgstr "" + +#: library/statistics.rst:1040 msgid "Classic probability problems" msgstr "" -#: library/statistics.rst:948 +#: library/statistics.rst:1042 msgid ":class:`NormalDist` readily solves classic probability problems." msgstr "" -#: library/statistics.rst:950 +#: library/statistics.rst:1044 msgid "" "For example, given `historical data for SAT exams `_ showing that scores are " @@ -1049,35 +1487,64 @@ msgid "" "after rounding to the nearest whole number:" msgstr "" -#: library/statistics.rst:963 +#: library/statistics.rst:1050 +msgid "" +">>> sat = NormalDist(1060, 195)\n" +">>> fraction = sat.cdf(1200 + 0.5) - sat.cdf(1100 - 0.5)\n" +">>> round(fraction * 100.0, 1)\n" +"18.4" +msgstr "" + +#: library/statistics.rst:1057 msgid "" "Find the `quartiles `_ and `deciles " "`_ for the SAT scores:" msgstr "" -#: library/statistics.rst:975 +#: library/statistics.rst:1060 +msgid "" +">>> list(map(round, sat.quantiles()))\n" +"[928, 1060, 1192]\n" +">>> list(map(round, sat.quantiles(n=10)))\n" +"[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]" +msgstr "" + +#: library/statistics.rst:1069 msgid "Monte Carlo inputs for simulations" msgstr "" -#: library/statistics.rst:977 +#: library/statistics.rst:1071 msgid "" -"To estimate the distribution for a model than isn't easy to solve " +"To estimate the distribution for a model that isn't easy to solve " "analytically, :class:`NormalDist` can generate input samples for a `Monte " "Carlo simulation `_:" msgstr "" -#: library/statistics.rst:994 +#: library/statistics.rst:1075 +msgid "" +">>> def model(x, y, z):\n" +"... return (3*x + 7*x*y - 5*y) / (11 * z)\n" +"...\n" +">>> n = 100_000\n" +">>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n" +">>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n" +">>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n" +">>> quantiles(map(model, X, Y, Z))\n" +"[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" +msgstr "" + +#: library/statistics.rst:1088 msgid "Approximating binomial distributions" msgstr "" -#: library/statistics.rst:996 +#: library/statistics.rst:1090 msgid "" "Normal distributions can be used to approximate `Binomial distributions " "`_ when the sample " "size is large and when the probability of a successful trial is near 50%." msgstr "" -#: library/statistics.rst:1001 +#: library/statistics.rst:1095 msgid "" "For example, an open source conference has 750 attendees and two rooms with " "a 500 person capacity. There is a talk about Python and another about Ruby. " @@ -1086,15 +1553,39 @@ msgid "" "probability that the Python room will stay within its capacity limits?" msgstr "" -#: library/statistics.rst:1032 +#: library/statistics.rst:1101 +msgid "" +">>> n = 750 # Sample size\n" +">>> p = 0.65 # Preference for Python\n" +">>> q = 1.0 - p # Preference for Ruby\n" +">>> k = 500 # Room capacity\n" +"\n" +">>> # Approximation using the cumulative normal distribution\n" +">>> from math import sqrt\n" +">>> round(NormalDist(mu=n*p, sigma=sqrt(n*p*q)).cdf(k + 0.5), 4)\n" +"0.8402\n" +"\n" +">>> # Exact solution using the cumulative binomial distribution\n" +">>> from math import comb, fsum\n" +">>> round(fsum(comb(n, r) * p**r * q**(n-r) for r in range(k+1)), 4)\n" +"0.8402\n" +"\n" +">>> # Approximation using a simulation\n" +">>> from random import seed, binomialvariate\n" +">>> seed(8675309)\n" +">>> mean(binomialvariate(n, p) <= k for i in range(10_000))\n" +"0.8406" +msgstr "" + +#: library/statistics.rst:1126 msgid "Naive bayesian classifier" msgstr "" -#: library/statistics.rst:1034 +#: library/statistics.rst:1128 msgid "Normal distributions commonly arise in machine learning problems." msgstr "" -#: library/statistics.rst:1036 +#: library/statistics.rst:1130 msgid "" "Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " @@ -1102,20 +1593,37 @@ msgid "" "distributed features including height, weight, and foot size." msgstr "" -#: library/statistics.rst:1041 +#: library/statistics.rst:1135 msgid "" "We're given a training dataset with measurements for eight people. The " "measurements are assumed to be normally distributed, so we summarize the " "data with :class:`NormalDist`:" msgstr "" -#: library/statistics.rst:1054 +#: library/statistics.rst:1139 +msgid "" +">>> height_male = NormalDist.from_samples([6, 5.92, 5.58, 5.92])\n" +">>> height_female = NormalDist.from_samples([5, 5.5, 5.42, 5.75])\n" +">>> weight_male = NormalDist.from_samples([180, 190, 170, 165])\n" +">>> weight_female = NormalDist.from_samples([100, 150, 130, 150])\n" +">>> foot_size_male = NormalDist.from_samples([12, 11, 12, 10])\n" +">>> foot_size_female = NormalDist.from_samples([6, 8, 7, 9])" +msgstr "" + +#: library/statistics.rst:1148 msgid "" "Next, we encounter a new person whose feature measurements are known but " "whose gender is unknown:" msgstr "" -#: library/statistics.rst:1063 +#: library/statistics.rst:1151 +msgid "" +">>> ht = 6.0 # height\n" +">>> wt = 130 # weight\n" +">>> fs = 8 # foot size" +msgstr "" + +#: library/statistics.rst:1157 msgid "" "Starting with a 50% `prior probability `_ of being male or female, we compute the posterior as " @@ -1123,45 +1631,26 @@ msgid "" "given the gender:" msgstr "" -#: library/statistics.rst:1078 +#: library/statistics.rst:1162 msgid "" -"The final prediction goes to the largest posterior. This is known as the " -"`maximum a posteriori `_ or MAP:" -msgstr "" - -#: library/statistics.rst:1089 -msgid "Kernel density estimation" +">>> prior_male = 0.5\n" +">>> prior_female = 0.5\n" +">>> posterior_male = (prior_male * height_male.pdf(ht) *\n" +"... weight_male.pdf(wt) * foot_size_male.pdf(fs))\n" +"\n" +">>> posterior_female = (prior_female * height_female.pdf(ht) *\n" +"... weight_female.pdf(wt) * foot_size_female.pdf(fs))" msgstr "" -#: library/statistics.rst:1091 +#: library/statistics.rst:1172 msgid "" -"It is possible to estimate a continuous probability density function from a " -"fixed number of discrete samples." -msgstr "" - -#: library/statistics.rst:1094 -msgid "" -"The basic idea is to smooth the data using `a kernel function such as a " -"normal distribution, triangular distribution, or uniform distribution " -"`_. The degree of " -"smoothing is controlled by a scaling parameter, ``h``, which is called the " -"*bandwidth*." +"The final prediction goes to the largest posterior. This is known as the " +"`maximum a posteriori `_ or MAP:" msgstr "" -#: library/statistics.rst:1111 +#: library/statistics.rst:1176 msgid "" -"`Wikipedia has an example `_ where we can use the ``kde_normal()`` " -"recipe to generate and plot a probability density function estimated from a " -"small sample:" -msgstr "" - -#: library/statistics.rst:1123 -msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" -msgstr "" - -#: library/statistics.rst:-1 -msgid "Scatter plot of the estimated probability density function." +">>> 'male' if posterior_male > posterior_female else 'female'\n" +"'female'" msgstr "" diff --git a/library/stdtypes.po b/library/stdtypes.po index f2ab7003..887cc04f 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -8,29 +8,35 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Theofanis Petkos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.6\n" #: library/stdtypes.rst:8 msgid "Built-in Types" -msgstr "" +msgstr "Τύποι Built-in" #: library/stdtypes.rst:10 msgid "" "The following sections describe the standard types that are built into the " "interpreter." msgstr "" +"Οι παρακάτω κατηγορίες περιγράφουν τους standard τύπους που είναι " +"ενσωματωμένοι (built) μέσα στον interpreter." #: library/stdtypes.rst:15 msgid "" "The principal built-in types are numerics, sequences, mappings, classes, " "instances and exceptions." msgstr "" +"Οι κύριοι ενσωματωμένοι (built) τύποι είναι αριθμοί, ακολουθίες, " +"αντιστοιχίσεις (mappings), κλάσεις, instances και exceptions." #: library/stdtypes.rst:18 msgid "" @@ -38,6 +44,10 @@ msgid "" "rearrange their members in place, and don't return a specific item, never " "return the collection instance itself but ``None``." msgstr "" +"Ορισμένες collection κλάσεις είναι μεταβλητές (mutable). Οι μέθοδοι που " +"προσθέτουν, αφαιρούν ή αναδιατάσσουν τα μέλη τους και δεν επιστρέφουν ένα " +"συγκεκριμένο αντικείμενο, ποτέ δεν επιστρέφουν το ίδιο collection instance " +"αλλά ``None``." #: library/stdtypes.rst:22 msgid "" @@ -47,16 +57,25 @@ msgid "" "slightly different :func:`str` function). The latter function is implicitly " "used when an object is written by the :func:`print` function." msgstr "" +"Ορισμένες λειτουργίες υποστηρίζονται από διάφορους τύπους αντικειμένων· " +"ειδικότερα, σχεδόν όλα τα αντικείμενα μπορούν να συγκριθούν ως προς την " +"ισότητα, να ελεγχθούν για την έγκυρη τιμή και να μετατραπούν σε συμβολοσειρά " +"(string) (με τη συνάρτηση :func:`repr` ή την ελαφρώς διαφορετική συνάρτηση :" +"func:`str`). Η τελευταία συνάρτηση χρησιμοποιείται έμμεσα όταν ένα " +"αντικείμενο γράφεται από τη συνάρτηση :func:`print`." #: library/stdtypes.rst:32 msgid "Truth Value Testing" -msgstr "" +msgstr "Έλεγχος Έγκυρης Τιμής" #: library/stdtypes.rst:41 msgid "" "Any object can be tested for truth value, for use in an :keyword:`if` or :" "keyword:`while` condition or as operand of the Boolean operations below." msgstr "" +"Οποιοδήποτε αντικείμενο μπορεί να ελεγχθεί ως προς την εγκυρότητα της τιμής " +"του, για χρήση σε :keyword:`if` ή :keyword:`while` συνθήκη ή ως τελεστής των " +"λογικών πράξεων παρακάτω." #: library/stdtypes.rst:46 msgid "" @@ -65,22 +84,31 @@ msgid "" "__len__` method that returns zero, when called with the object. [1]_ Here " "are most of the built-in objects considered false:" msgstr "" +"Ως προεπιλογή, ένα αντικείμενο θεωρείται true εκτός εάν η κλάση του ορίζει " +"μία :meth:`~object.__bool__` μέθοδο που επιστρέφει ``False`` ή μία :meth:" +"`~object.__len__` μέθοδο που επιστρέφει μηδέν, όταν καλείται με το " +"αντικείμενο. [1]_ Εδώ τα περισσότερα από τα ενσωματωμένα (built-in) " +"αντικείμενα θεωρούνται false:" #: library/stdtypes.rst:56 msgid "constants defined to be false: ``None`` and ``False``" -msgstr "" +msgstr "σταθερές που έχουν οριστεί ως false: ``None`` και ``False``" #: library/stdtypes.rst:58 msgid "" "zero of any numeric type: ``0``, ``0.0``, ``0j``, ``Decimal(0)``, " "``Fraction(0, 1)``" msgstr "" +"μηδέν οποιουδήποτε αριθμητικού τύπου: ``0``, ``0,0``, ``0j``, " +"``Decimanl(0)``, ``Fraction(0, 1)``" #: library/stdtypes.rst:61 msgid "" "empty sequences and collections: ``''``, ``()``, ``[]``, ``{}``, ``set()``, " "``range(0)``" msgstr "" +"κενές ακολουθίες και collections: ``''``, ``()``, ``[]``, ``{}``, ``set()``, " +"``range(0)``" #: library/stdtypes.rst:70 msgid "" @@ -89,94 +117,110 @@ msgid "" "otherwise stated. (Important exception: the Boolean operations ``or`` and " "``and`` always return one of their operands.)" msgstr "" +"Οι πράξεις και οι ενσωματωμένες (built-in) συναρτήσεις που έχουν αποτέλεσμα " +"Boolean πάντα επιστρέφουν ``0`` ή ``False`` για false και ``1`` ή ``True`` " +"για true, εκτός εάν δηλώνεται διαφορετικά. (Σημαντική εξαίρεση: οι λογικές " +"(Boolean) πράξεις ``or`` και ``and`` επιστρέφουν πάντα έναν από τους " +"τελεστές τους.)" #: library/stdtypes.rst:79 msgid "Boolean Operations --- :keyword:`!and`, :keyword:`!or`, :keyword:`!not`" msgstr "" +"Λογικές (Boolean) Πράξεις --- :keyword:`!and`, :keyword:`!or`, :keyword:`!" +"not`" #: library/stdtypes.rst:83 msgid "These are the Boolean operations, ordered by ascending priority:" msgstr "" +"Αυτές είναι οι λογικές (Boolean) πράξεις, ταξινομημένες βάσει προτεραιότητας:" -#: library/stdtypes.rst:144 library/stdtypes.rst:366 library/stdtypes.rst:965 -#: library/stdtypes.rst:1170 +#: library/stdtypes.rst:144 library/stdtypes.rst:372 library/stdtypes.rst:1005 +#: library/stdtypes.rst:1224 msgid "Operation" -msgstr "" +msgstr "Πράξη" -#: library/stdtypes.rst:276 library/stdtypes.rst:416 library/stdtypes.rst:1170 +#: library/stdtypes.rst:282 library/stdtypes.rst:422 library/stdtypes.rst:1224 msgid "Result" -msgstr "" +msgstr "Αποτέλεσμα" -#: library/stdtypes.rst:276 library/stdtypes.rst:965 library/stdtypes.rst:2419 -#: library/stdtypes.rst:3637 +#: library/stdtypes.rst:282 library/stdtypes.rst:1005 library/stdtypes.rst:2901 +#: library/stdtypes.rst:4161 msgid "Notes" -msgstr "" +msgstr "Σημειώσεις" #: library/stdtypes.rst:88 msgid "``x or y``" -msgstr "" +msgstr "``x or y``" #: library/stdtypes.rst:88 msgid "if *x* is true, then *x*, else *y*" -msgstr "" +msgstr "αν το *x* είναι true, τότε *x*, αλλιώς *y*" -#: library/stdtypes.rst:967 library/stdtypes.rst:1181 library/stdtypes.rst:3643 +#: library/stdtypes.rst:1007 library/stdtypes.rst:1239 +#: library/stdtypes.rst:4167 msgid "\\(1)" -msgstr "" +msgstr "\\(1)" #: library/stdtypes.rst:91 msgid "``x and y``" -msgstr "" +msgstr "``x and y``" #: library/stdtypes.rst:91 msgid "if *x* is false, then *x*, else *y*" -msgstr "" +msgstr "αν το *x* είναι false, τότε *x*, αλλιώς *y*" -#: library/stdtypes.rst:289 library/stdtypes.rst:1209 library/stdtypes.rst:2431 -#: library/stdtypes.rst:3649 +#: library/stdtypes.rst:295 library/stdtypes.rst:1250 library/stdtypes.rst:2913 +#: library/stdtypes.rst:4173 msgid "\\(2)" -msgstr "" +msgstr "\\(2)" #: library/stdtypes.rst:94 msgid "``not x``" -msgstr "" +msgstr "``not x``" #: library/stdtypes.rst:94 msgid "if *x* is false, then ``True``, else ``False``" -msgstr "" +msgstr "if *x* είναι false, τότε ``True``, αλλιώς ``False``" -#: library/stdtypes.rst:979 library/stdtypes.rst:2433 library/stdtypes.rst:2437 -#: library/stdtypes.rst:3651 library/stdtypes.rst:3655 -#: library/stdtypes.rst:3657 +#: library/stdtypes.rst:2915 library/stdtypes.rst:2919 +#: library/stdtypes.rst:4175 library/stdtypes.rst:4179 +#: library/stdtypes.rst:4181 msgid "\\(3)" -msgstr "" +msgstr "\\(3)" -#: library/stdtypes.rst:320 library/stdtypes.rst:1016 library/stdtypes.rst:2465 -#: library/stdtypes.rst:3687 +#: library/stdtypes.rst:326 library/stdtypes.rst:1049 library/stdtypes.rst:2947 +#: library/stdtypes.rst:4211 msgid "Notes:" -msgstr "" +msgstr "Σημειώσεις:" #: library/stdtypes.rst:106 msgid "" "This is a short-circuit operator, so it only evaluates the second argument " "if the first one is false." msgstr "" +"Αυτός είναι ένας τελεστής μικρού κυκλώματος, επομένως αξιολογεί μόνο το " +"δεύτερο όρισμα αν το πρώτο είναι false." #: library/stdtypes.rst:110 msgid "" "This is a short-circuit operator, so it only evaluates the second argument " "if the first one is true." msgstr "" +"Αυτός είναι ένας τελεστής μικρού κυκλώματος, επομένως αξιολογεί μόνο το " +"δεύτερο όρισμα αν το πρώτο είναι true." #: library/stdtypes.rst:114 msgid "" "``not`` has a lower priority than non-Boolean operators, so ``not a == b`` " "is interpreted as ``not (a == b)``, and ``a == not b`` is a syntax error." msgstr "" +"To ``not`` έχει χαμηλότερη προτεραιότητα από τους μη λογικούς (non-Boolean) " +"τελεστές, οπότε το ``not a == b`` μεταφράζεται σαν ``not (a==b)``, και το " +"``a == not b`` είναι συντακτικό σφάλμα." #: library/stdtypes.rst:121 msgid "Comparisons" -msgstr "" +msgstr "Συγκρίσεις" #: library/stdtypes.rst:135 msgid "" @@ -186,79 +230,85 @@ msgid "" "< y and y <= z``, except that *y* is evaluated only once (but in both cases " "*z* is not evaluated at all when ``x < y`` is found to be false)." msgstr "" +"Υπάρχουν οκτώ πράξεις σύγκρισης στην Python. Όλες έχουν την ίδια " +"προτεραιότητα (η οποία είναι υψηλότερη από αυτή των λογικών (Boolean) " +"πράξεων). Οι συγκρίσεις μπορεί να αλυσοδεθούν αυθαίρετα· για παράδειγμα, το " +"``x < y <= z`` ισοδυναμεί με ``x < y και y <= z``, εκτός από το ότι το *y* " +"αξιολογείται μόνο μία φορά (αλλά και στις δύο περιπτώσεις το *z* δεν " +"αξιολογείται καθόλου όταν το ``x < y`` είναι false)." #: library/stdtypes.rst:141 msgid "This table summarizes the comparison operations:" -msgstr "" +msgstr "Αυτός ο πίνακας συνοψίζει τις πράξεις σύγκρισης:" -#: library/stdtypes.rst:2396 library/stdtypes.rst:3614 -#: library/stdtypes.rst:3637 +#: library/stdtypes.rst:2732 library/stdtypes.rst:2901 +#: library/stdtypes.rst:4161 msgid "Meaning" -msgstr "" +msgstr "Έννοια" #: library/stdtypes.rst:146 msgid "``<``" -msgstr "" +msgstr "``<``" #: library/stdtypes.rst:146 msgid "strictly less than" -msgstr "" +msgstr "αυστηρά μικρότερο από" #: library/stdtypes.rst:148 msgid "``<=``" -msgstr "" +msgstr "``<=``" #: library/stdtypes.rst:148 msgid "less than or equal" -msgstr "" +msgstr "μικρότερο από ή ίσο" #: library/stdtypes.rst:150 msgid "``>``" -msgstr "" +msgstr "``>``" #: library/stdtypes.rst:150 msgid "strictly greater than" -msgstr "" +msgstr "αυστηρά μεγαλύτερο από" #: library/stdtypes.rst:152 msgid "``>=``" -msgstr "" +msgstr "``>=``" #: library/stdtypes.rst:152 msgid "greater than or equal" -msgstr "" +msgstr "μεγαλύτερο από ή ίσο" #: library/stdtypes.rst:154 msgid "``==``" -msgstr "" +msgstr "``==``" #: library/stdtypes.rst:154 msgid "equal" -msgstr "" +msgstr "ίσο" #: library/stdtypes.rst:156 msgid "``!=``" -msgstr "" +msgstr "``!=``" #: library/stdtypes.rst:156 msgid "not equal" -msgstr "" +msgstr "διάφορο" #: library/stdtypes.rst:158 msgid "``is``" -msgstr "" +msgstr "``is``" #: library/stdtypes.rst:158 msgid "object identity" -msgstr "" +msgstr "ταυτότητα αντικειμένου" #: library/stdtypes.rst:160 msgid "``is not``" -msgstr "" +msgstr "``is not``" #: library/stdtypes.rst:160 msgid "negated object identity" -msgstr "" +msgstr "αρνητική ταυτότητα αντικειμένου" #: library/stdtypes.rst:167 msgid "" @@ -269,12 +319,20 @@ msgid "" "example, they raise a :exc:`TypeError` exception when one of the arguments " "is a complex number." msgstr "" +"Αντικείμενα διαφορετικών τύπων, εκτός από διαφορετικούς αριθμητικούς τύπους, " +"δεν συγκρίνονται ποτέ ως ίσα. Ο τελεστής ``==`` ορίζεται πάντα αλλά για " +"ορισμένους τύπους αντικειμένων (για παράδειγμα, αντικείμενα κλάσης) " +"ισοδυναμεί με :keyword:`is`. Οι τελεστές ``<``, ``<=``, ``>`` και ``>=`` " +"ορίζονται μόνο όπου έχουν νόημα· για παράδειγμα, δημιουργούν μια εξαίρεση :" +"exc:`TypeError` όταν ένα από τα ορίσματα είναι μιγαδικός αριθμός." #: library/stdtypes.rst:181 msgid "" "Non-identical instances of a class normally compare as non-equal unless the " "class defines the :meth:`~object.__eq__` method." msgstr "" +"Μη πανομοιότυπα instances μιας κλάσης συνήθως συγκρίνονται ως μη ίσα εκτός " +"εάν το η κλάση ορίζει τη μέθοδο :meth:`~object.__eq__`." #: library/stdtypes.rst:184 msgid "" @@ -285,6 +343,12 @@ msgid "" "meth:`~object.__eq__` are sufficient, if you want the conventional meanings " "of the comparison operators)." msgstr "" +"Τα instances μιας κλάσης δεν μπορούν να ταξινομηθούν σε σχέση με άλλα " +"instances της ίδιας κλάσης, ή άλλους τύπους του αντικειμένου, εκτός εάν η " +"κλάση ορίζει αρκετές από τις μεθόδους :meth:`~object.__lt__`, :meth:`~object." +"__le__`, :meth:`~object.__gt__`, και :meth:`~object.__ge__` (γενικά, :meth:" +"`~object.__lt__` και :meth:`~object.__eq__` είναι αρκετά, αν θέλετε τις " +"συμβατικές έννοιες των τελεστών σύγκρισης)." #: library/stdtypes.rst:191 msgid "" @@ -292,6 +356,9 @@ msgid "" "customized; also they can be applied to any two objects and never raise an " "exception." msgstr "" +"Η συμπεριφορά των τελεστών :keyword:`is` και :keyword:`is not` δεν μπορεί να " +"είναι προσαρμοσμένη· επίσης, μπορούν να εφαρμοστούν σε οποιαδήποτε δύο " +"αντικείμενα και ποτέ να μην δημιουργήσουν μία εξαίρεση." #: library/stdtypes.rst:199 msgid "" @@ -299,235 +366,288 @@ msgid "" "keyword:`not in`, are supported by types that are :term:`iterable` or " "implement the :meth:`~object.__contains__` method." msgstr "" +"Δύο ακόμη πράξεις με την ίδια συντακτική προτεραιότητα, :keyword:`in` και :" +"keyword:`not in`, υποστηρίζονται από τύπους που είναι :term:`iterable` ή " +"υλοποιούν τη μέθοδο :meth:`~object.__contains__`." #: library/stdtypes.rst:206 msgid "Numeric Types --- :class:`int`, :class:`float`, :class:`complex`" -msgstr "" +msgstr "Αριμθητικοί Τύποι --- :class:`int`, :class:`float`, :class:`complex`" #: library/stdtypes.rst:216 msgid "" -"There are three distinct numeric types: :dfn:`integers`, :dfn:`floating " +"There are three distinct numeric types: :dfn:`integers`, :dfn:`floating-" "point numbers`, and :dfn:`complex numbers`. In addition, Booleans are a " -"subtype of integers. Integers have unlimited precision. Floating point " +"subtype of integers. Integers have unlimited precision. Floating-point " "numbers are usually implemented using :c:expr:`double` in C; information " -"about the precision and internal representation of floating point numbers " +"about the precision and internal representation of floating-point numbers " "for the machine on which your program is running is available in :data:`sys." "float_info`. Complex numbers have a real and imaginary part, which are each " -"a floating point number. To extract these parts from a complex number *z*, " +"a floating-point number. To extract these parts from a complex number *z*, " "use ``z.real`` and ``z.imag``. (The standard library includes the additional " "numeric types :mod:`fractions.Fraction`, for rationals, and :mod:`decimal." "Decimal`, for floating-point numbers with user-definable precision.)" msgstr "" +"Υπάρχουν τρεις διαφορετικοί αριθμητικοί τύποι: :dfn:`integers`, :dfn:" +"`floating point numbers` και :dfn:`complex numbers`. Επιπλέον, τα Booleans " +"είναι υπό-τύπος ακεραίων (integers). Οι ακέραιοι αριθμοί έχουν απεριόριστη " +"ακρίβεια. Οι Αριθμοί κινητής υποδιαστολής (floating point numbers) συνήθως " +"υλοποιούνται χρησιμοποιώντας το :c:expr:`double` στη C· πληροφορίες σχετικά " +"με την ακρίβεια και την εσωτερική αναπαράσταση αριθμών κινητής υποδιαστολής " +"για το μηχάνημα στο οποίο εκτελείται το πρόγραμμά σας είναι διαθέσιμο στο :" +"data:`sys.float_info`. Οι μιγαδικοί αριθμοί (complex numbers) έχουν ένα " +"πραγματικό και φανταστικό μέρος, κάθε ένα από τα οποία ένας αριθμός κινητής " +"υποδιαστολής. Για να εξαγάγετε αυτά τα μέρη από έναν μιγαδικό αριθμό *z*, " +"χρησιμοποιήστε ``z.real`` και ``z.imag``. (Η standard βιβλιοθήκη " +"περιλαμβάνει τους πρόσθετους αριθμητικούς τύπους :mod:`fractions.Fraction`, " +"για ορθολογικούς, και :mod:`decimal.Decimal`, για αριθμούς κινητής " +"υποδιαστολής με ακρίβεια που ορίζει ο χρήστης.)" #: library/stdtypes.rst:238 msgid "" "Numbers are created by numeric literals or as the result of built-in " "functions and operators. Unadorned integer literals (including hex, octal " "and binary numbers) yield integers. Numeric literals containing a decimal " -"point or an exponent sign yield floating point numbers. Appending ``'j'`` " +"point or an exponent sign yield floating-point numbers. Appending ``'j'`` " "or ``'J'`` to a numeric literal yields an imaginary number (a complex number " "with a zero real part) which you can add to an integer or float to get a " "complex number with real and imaginary parts." msgstr "" +"Οι αριθμοί δημιουργούνται με αριθμητικά γράμματα ή ως αποτέλεσμα " +"ενσωματωμένων (built-in) συναρτήσεων και τελεστών. Ακέραιοι αριθμοί " +"(συμπεριλαμβανομένων του εξαδικού, του οκταδικού και των δυαδικοί αριθμών) " +"αποδίδουν ακέραιους αριθμούς. Αριθμητικά που περιέχουν δεκαδικό ή εκθέτη " +"παράγουν αριθμούς κινητής υποδιαστολής. Η προσάρτηση του ``'j'`` ή του " +"``'J'`` σε ένα αριθμητικό παράγει έναν φανταστικό αριθμό (έναν μιγαδικό " +"αριθμό με μηδενικό πραγματικό μέρος) το οποίο μπορείτε να προσθέσετε σε έναν " +"ακέραιο ή κινητής υποδιαστολής για να πάρετε έναν μιγαδικό αριθμό με " +"πραγματικό και φανταστικό μέρος." + +#: library/stdtypes.rst:246 +msgid "" +"The constructors :func:`int`, :func:`float`, and :func:`complex` can be used " +"to produce numbers of a specific type." +msgstr "" +"Μπορούν να χρησιμοποιηθούν οι κατασκευαστές :func:`int`, :func:`float` και :" +"func:`complex` για να παράγουν αριθμούς συγκεκριμένου τύπου." -#: library/stdtypes.rst:263 +#: library/stdtypes.rst:266 msgid "" "Python fully supports mixed arithmetic: when a binary arithmetic operator " "has operands of different numeric types, the operand with the \"narrower\" " "type is widened to that of the other, where integer is narrower than " -"floating point, which is narrower than complex. A comparison between numbers " -"of different types behaves as though the exact values of those numbers were " -"being compared. [2]_" +"floating point. Arithmetic with complex and real operands is defined by the " +"usual mathematical formula, for example::" msgstr "" +"Η Python υποστηρίζει πλήρως τα μικτά αριθμητικά: όταν ένας δυαδικός " +"αριθμητικός τελεστής έχει τελεστές διαφορετικών αριθμητικών τύπων, ο " +"τελεστής με το \"στενότερο\" τύπο διευρύνεται σε αυτόν του άλλου, όπου ένας " +"ακέραιος αριθμός είναι στενότερος από έναν με κινητή υποδιαστολή. Η " +"αριθμητική με μιγαδικούς και πραγματικούς τελεστές ορίζεται από τον συνήθη " +"μαθηματικό τύπο, για παράδειγμα::" -#: library/stdtypes.rst:269 +#: library/stdtypes.rst:272 msgid "" -"The constructors :func:`int`, :func:`float`, and :func:`complex` can be used " -"to produce numbers of a specific type." +"x + complex(u, v) = complex(x + u, v)\n" +"x * complex(u, v) = complex(x * u, x * v)" msgstr "" +"x + complex(u, v) = complex(x + u, v)\n" +"x * complex(u, v) = complex(x * u, x * v)" -#: library/stdtypes.rst:272 +#: library/stdtypes.rst:275 +msgid "" +"A comparison between numbers of different types behaves as though the exact " +"values of those numbers were being compared. [2]_" +msgstr "" +"Μια σύγκριση μεταξύ αριθμών διαφορετικών τύπων συμπεριφέρεται σαν να " +"συγκρίνονται οι ακριβείς τιμές αυτών των αριθμών. [2]_" + +#: library/stdtypes.rst:278 msgid "" "All numeric types (except complex) support the following operations (for " "priorities of the operations, see :ref:`operator-summary`):" msgstr "" +"Όλοι οι αριθμητικοί τύποι (εκτός των μιγαδικών) υποστηρίζουν τις ακόλουθες " +"πράξεις (για προτεραιότητες των πράξεων, βλέπε :ref:`operator-summary`):" -#: library/stdtypes.rst:276 +#: library/stdtypes.rst:282 msgid "Full documentation" -msgstr "" +msgstr "Ολόκληρη τεκμηρίωση" -#: library/stdtypes.rst:278 +#: library/stdtypes.rst:284 msgid "``x + y``" -msgstr "" +msgstr "``x + y``" -#: library/stdtypes.rst:278 +#: library/stdtypes.rst:284 msgid "sum of *x* and *y*" -msgstr "" +msgstr "άθροισμα του *x* και *y*" -#: library/stdtypes.rst:280 +#: library/stdtypes.rst:286 msgid "``x - y``" -msgstr "" +msgstr "``x - y``" -#: library/stdtypes.rst:280 +#: library/stdtypes.rst:286 msgid "difference of *x* and *y*" -msgstr "" +msgstr "διαφορά του *x* και *y*" -#: library/stdtypes.rst:282 +#: library/stdtypes.rst:288 msgid "``x * y``" -msgstr "" +msgstr "``x * y``" -#: library/stdtypes.rst:282 +#: library/stdtypes.rst:288 msgid "product of *x* and *y*" -msgstr "" +msgstr "γινόμενο των *x* και *y*" -#: library/stdtypes.rst:284 +#: library/stdtypes.rst:290 msgid "``x / y``" -msgstr "" +msgstr "``x / y``" -#: library/stdtypes.rst:284 +#: library/stdtypes.rst:290 msgid "quotient of *x* and *y*" -msgstr "" +msgstr "πηλίκο των *x* και *y*" -#: library/stdtypes.rst:286 +#: library/stdtypes.rst:292 msgid "``x // y``" -msgstr "" +msgstr "``x // y``" -#: library/stdtypes.rst:286 +#: library/stdtypes.rst:292 msgid "floored quotient of *x* and *y*" -msgstr "" +msgstr "ακέραιο μέρος του πηλίκου των *x* και *y*" -#: library/stdtypes.rst:286 +#: library/stdtypes.rst:292 msgid "\\(1)\\(2)" -msgstr "" +msgstr "\\(1)\\(2)" -#: library/stdtypes.rst:289 +#: library/stdtypes.rst:295 msgid "``x % y``" -msgstr "" +msgstr "``x % y``" -#: library/stdtypes.rst:289 +#: library/stdtypes.rst:295 msgid "remainder of ``x / y``" -msgstr "" +msgstr "υπόλοιπο του ``x / y``" -#: library/stdtypes.rst:291 +#: library/stdtypes.rst:297 msgid "``-x``" -msgstr "" +msgstr "``-x``" -#: library/stdtypes.rst:291 +#: library/stdtypes.rst:297 msgid "*x* negated" -msgstr "" +msgstr "*x* αρνητικό" -#: library/stdtypes.rst:293 +#: library/stdtypes.rst:299 msgid "``+x``" -msgstr "" +msgstr "``+x``" -#: library/stdtypes.rst:293 +#: library/stdtypes.rst:299 msgid "*x* unchanged" -msgstr "" +msgstr "*x* αμετάβλητο" -#: library/stdtypes.rst:295 +#: library/stdtypes.rst:301 msgid "``abs(x)``" -msgstr "" +msgstr "``abs(x)``" -#: library/stdtypes.rst:295 +#: library/stdtypes.rst:301 msgid "absolute value or magnitude of *x*" -msgstr "" +msgstr "απόλυτη τιμή ή μέγεθος του *x*" -#: library/stdtypes.rst:295 +#: library/stdtypes.rst:301 msgid ":func:`abs`" -msgstr "" +msgstr ":func:`abs`" -#: library/stdtypes.rst:298 +#: library/stdtypes.rst:304 msgid "``int(x)``" -msgstr "" +msgstr "``int(x)``" -#: library/stdtypes.rst:298 +#: library/stdtypes.rst:304 msgid "*x* converted to integer" -msgstr "" +msgstr "μετατροπή του *x* σε ακέραιο" -#: library/stdtypes.rst:298 +#: library/stdtypes.rst:304 msgid "\\(3)\\(6)" -msgstr "" +msgstr "\\(3)\\(6)" -#: library/stdtypes.rst:298 +#: library/stdtypes.rst:304 msgid ":func:`int`" -msgstr "" +msgstr ":func:`int`" -#: library/stdtypes.rst:300 +#: library/stdtypes.rst:306 msgid "``float(x)``" -msgstr "" +msgstr "``float(x)``" -#: library/stdtypes.rst:300 +#: library/stdtypes.rst:306 msgid "*x* converted to floating point" -msgstr "" +msgstr "μετατροπή του *x* σε κινητής υποδιαστολής" -#: library/stdtypes.rst:300 +#: library/stdtypes.rst:306 msgid "\\(4)\\(6)" -msgstr "" +msgstr "\\(4)\\(6)" -#: library/stdtypes.rst:300 +#: library/stdtypes.rst:306 msgid ":func:`float`" -msgstr "" +msgstr ":func:`float`" -#: library/stdtypes.rst:302 +#: library/stdtypes.rst:308 msgid "``complex(re, im)``" -msgstr "" +msgstr "``complex(re, im)``" -#: library/stdtypes.rst:302 +#: library/stdtypes.rst:308 msgid "" "a complex number with real part *re*, imaginary part *im*. *im* defaults to " "zero." msgstr "" +"ένας μιγαδικός αριθμός με πραγματικό μέρος *re*, φανταστικό μέρος *im*. Το " +"*im* μετατρέπεται αυτόματα σε μηδέν." -#: library/stdtypes.rst:1202 library/stdtypes.rst:3674 +#: library/stdtypes.rst:2909 library/stdtypes.rst:4198 msgid "\\(6)" -msgstr "" +msgstr "\\(6)" -#: library/stdtypes.rst:302 +#: library/stdtypes.rst:308 msgid ":func:`complex`" -msgstr "" +msgstr ":func:`complex`" -#: library/stdtypes.rst:306 +#: library/stdtypes.rst:312 msgid "``c.conjugate()``" -msgstr "" +msgstr "``c.conjugate()``" -#: library/stdtypes.rst:306 +#: library/stdtypes.rst:312 msgid "conjugate of the complex number *c*" -msgstr "" +msgstr "συζυγές του μιγαδικού αριθμού *c*" -#: library/stdtypes.rst:309 +#: library/stdtypes.rst:315 msgid "``divmod(x, y)``" -msgstr "" +msgstr "``divmod(x, y)``" -#: library/stdtypes.rst:309 +#: library/stdtypes.rst:315 msgid "the pair ``(x // y, x % y)``" -msgstr "" +msgstr "το ζευγάρι ``(x // y, x % y)``" -#: library/stdtypes.rst:309 +#: library/stdtypes.rst:315 msgid ":func:`divmod`" -msgstr "" +msgstr ":func:`divmod`" -#: library/stdtypes.rst:311 +#: library/stdtypes.rst:317 msgid "``pow(x, y)``" -msgstr "" +msgstr "``pow(x, y)``" -#: library/stdtypes.rst:313 +#: library/stdtypes.rst:319 msgid "*x* to the power *y*" -msgstr "" +msgstr "*x* σε δύναμη του *y*" -#: library/stdtypes.rst:313 library/stdtypes.rst:1194 library/stdtypes.rst:2455 -#: library/stdtypes.rst:3670 library/stdtypes.rst:3677 +#: library/stdtypes.rst:319 library/stdtypes.rst:2937 library/stdtypes.rst:4194 +#: library/stdtypes.rst:4201 msgid "\\(5)" -msgstr "" +msgstr "\\(5)" -#: library/stdtypes.rst:311 +#: library/stdtypes.rst:317 msgid ":func:`pow`" -msgstr "" +msgstr ":func:`pow`" -#: library/stdtypes.rst:313 +#: library/stdtypes.rst:319 msgid "``x ** y``" -msgstr "" +msgstr "``x ** y``" -#: library/stdtypes.rst:323 +#: library/stdtypes.rst:329 msgid "" "Also referred to as integer division. For operands of type :class:`int`, " "the result has type :class:`int`. For operands of type :class:`float`, the " @@ -536,287 +656,453 @@ msgid "" "always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is " "``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``." msgstr "" +"Αναφέρεται επίσης ως διαίρεση ακέραιου αριθμού. Για τελεστές τύπου :class:" +"`int`, το αποτέλεσμα έχει τύπο :class:`int`. Για τελεστές τύπου :class:" +"`float`, το αποτέλεσμα έχει τύπο :class:`float`. Γενικά, το αποτέλεσμα είναι " +"ένας ολόκληρος ακέραιος αριθμός, αν και ο τύπος του αποτελέσματος δεν είναι " +"απαραίτητα :class:`int`. Το αποτέλεσμα είναι πάντα στρογγυλεμένο προς το " +"μείον άπειρο: ``1//2`` είναι ``0``, ``(-1)//2`` είναι ``-1``, ``1//(-2)`` " +"είναι ``-1``, και ``(-1)//(-2)`` είναι ``0``." -#: library/stdtypes.rst:331 +#: library/stdtypes.rst:337 msgid "" "Not for complex numbers. Instead convert to floats using :func:`abs` if " "appropriate." msgstr "" +"Όχι για μιγαδικούς αριθμούς. Αντίθετα μετατρέψτε σε float χρησιμοποιώντας :" +"func:`abs` εάν είναι εφαρμόσιμο." -#: library/stdtypes.rst:342 +#: library/stdtypes.rst:348 msgid "" "Conversion from :class:`float` to :class:`int` truncates, discarding the " "fractional part. See functions :func:`math.floor` and :func:`math.ceil` for " "alternative conversions." msgstr "" +"Η μετατροπή από :class:`float` σε :class:`int` περικόπτει, απορρίπτοντας το " +"κλασματικό μέρος. Δείτε τις συναρτήσεις :func:`math.floor` και :func:`math." +"ceil` για εναλλακτικές μετατροπές." -#: library/stdtypes.rst:347 +#: library/stdtypes.rst:353 msgid "" "float also accepts the strings \"nan\" and \"inf\" with an optional prefix " "\"+\" or \"-\" for Not a Number (NaN) and positive or negative infinity." msgstr "" +"το float δέχεται επίσης τις συμβολοσειρές (strings) \"nan\" και \"inf\" με " +"ένα προαιρετικό πρόθεμα \"+\" ή \"-\" για το Not a Number (NaN - Όχι " +"αριθμός) και θετικό ή αρνητικό άπειρο." -#: library/stdtypes.rst:351 +#: library/stdtypes.rst:357 msgid "" "Python defines ``pow(0, 0)`` and ``0 ** 0`` to be ``1``, as is common for " "programming languages." msgstr "" +"Η Python ορίζει το ``pow(0, 0)`` και το ``0 ** 0`` ως ``1``, όπως " +"συνηθίζεται για τις γλώσσες προγραμματισμού." -#: library/stdtypes.rst:355 +#: library/stdtypes.rst:361 msgid "" "The numeric literals accepted include the digits ``0`` to ``9`` or any " "Unicode equivalent (code points with the ``Nd`` property)." msgstr "" +"Τα αριθμητικά κυριολεκτικά (numeric literals) που γίνονται δεκτά " +"περιλαμβάνουν τα ψηφία ``0`` έως ``9`` ή οποιοδήποτε ισοδύναμο Unicode " +"(σημεία κώδικα με την ιδιότητα ``Nd``)." -#: library/stdtypes.rst:358 +#: library/stdtypes.rst:364 msgid "" "See `the Unicode Standard `_ for a complete list of code points with the ``Nd`` " "property." msgstr "" +"Δείτε το `Thε Unicode Standard `_ για μια πλήρη λίστα σημείων κώδικα με το ``Nd`` " +"property." -#: library/stdtypes.rst:362 +#: library/stdtypes.rst:368 msgid "" "All :class:`numbers.Real` types (:class:`int` and :class:`float`) also " "include the following operations:" msgstr "" +"Όλοι οι τύποι :class:`numbers.Real` (:class:`int` και :class:`float`) επίσης " +"περιλαμβάνουν τις ακόλουθες λειτουργίες:" -#: library/stdtypes.rst:368 +#: library/stdtypes.rst:374 msgid ":func:`math.trunc(\\ x) `" -msgstr "" +msgstr ":func:`math.trunc(\\ x) `" -#: library/stdtypes.rst:368 +#: library/stdtypes.rst:374 msgid "*x* truncated to :class:`~numbers.Integral`" -msgstr "" +msgstr "*x* μετατρέπεται σε :class:`~numbers.Integral`" -#: library/stdtypes.rst:371 +#: library/stdtypes.rst:377 msgid ":func:`round(x[, n]) `" -msgstr "" +msgstr ":func:`round(x[, n]) `" -#: library/stdtypes.rst:371 +#: library/stdtypes.rst:377 msgid "" "*x* rounded to *n* digits, rounding half to even. If *n* is omitted, it " "defaults to 0." msgstr "" +"*x* στρογγυλοποιημένο σε *n* ψηφία, στρογγυλοποιώντας το μισό σε ζυγό. Εάν " +"το *n* παραλειφθεί, το default του είναι το 0." -#: library/stdtypes.rst:375 +#: library/stdtypes.rst:381 msgid ":func:`math.floor(\\ x) `" -msgstr "" +msgstr ":func:`math.floor(\\ x) `" -#: library/stdtypes.rst:375 +#: library/stdtypes.rst:381 msgid "the greatest :class:`~numbers.Integral` <= *x*" -msgstr "" +msgstr "το μεγαλύτερο :class:`~numbers.Integral` <= *x*" -#: library/stdtypes.rst:378 +#: library/stdtypes.rst:384 msgid ":func:`math.ceil(x) `" -msgstr "" +msgstr ":func:`math.ceil(x) `" -#: library/stdtypes.rst:378 +#: library/stdtypes.rst:384 msgid "the least :class:`~numbers.Integral` >= *x*" -msgstr "" +msgstr "το μικρότερο :class:`~numbers.Integral` >= *x*" -#: library/stdtypes.rst:382 +#: library/stdtypes.rst:388 msgid "" "For additional numeric operations see the :mod:`math` and :mod:`cmath` " "modules." msgstr "" +"Για περαιτέρω αριθμητικές πράξεις δείτε τα modules :mod:`math` και :mod:" +"`cmath`." -#: library/stdtypes.rst:391 +#: library/stdtypes.rst:397 msgid "Bitwise Operations on Integer Types" -msgstr "" +msgstr "Bitwise Πράξεις σε Ακέραιους Τύπους" -#: library/stdtypes.rst:405 +#: library/stdtypes.rst:411 msgid "" "Bitwise operations only make sense for integers. The result of bitwise " "operations is calculated as though carried out in two's complement with an " "infinite number of sign bits." msgstr "" +"Οι πράξεις bitwise έχουν νόημα μόνο για ακέραιους αριθμούς. Το αποτέλεσμα " +"των bitwise πράξεων υπολογίζεται σαν να εκτελείται σε συμπλήρωμα ως προς δύο " +"με άπειρο αριθμό bits πρόσημου." -#: library/stdtypes.rst:409 +#: library/stdtypes.rst:415 msgid "" "The priorities of the binary bitwise operations are all lower than the " "numeric operations and higher than the comparisons; the unary operation " "``~`` has the same priority as the other unary numeric operations (``+`` and " "``-``)." msgstr "" +"Οι προτεραιότητες των δυαδικών πράξεων bitwise είναι όλες χαμηλότερες από " +"τις αριθμητικές πράξεις και υψηλότερες από τις συγκρίσεις· η μοναδιαία πράξη " +"``~`` έχει την ίδια προτεραιότητα με τις άλλες μοναδιαίες αριθμητικές " +"πράξεις (``+`` και ``-``)." -#: library/stdtypes.rst:413 +#: library/stdtypes.rst:419 msgid "This table lists the bitwise operations sorted in ascending priority:" msgstr "" +"Αυτός ο πίνακας παραθέτει όλες τις bitwise πράξεις ταξινομημένες σε αύξουσα " +"σειρά:" -#: library/stdtypes.rst:418 +#: library/stdtypes.rst:424 msgid "``x | y``" -msgstr "" +msgstr "``x | y``" -#: library/stdtypes.rst:418 +#: library/stdtypes.rst:424 msgid "bitwise :dfn:`or` of *x* and *y*" -msgstr "" +msgstr "bitwise :dfn:`or` των *x* και *y*" -#: library/stdtypes.rst:421 library/stdtypes.rst:1215 library/stdtypes.rst:2445 -#: library/stdtypes.rst:3663 +#: library/stdtypes.rst:427 library/stdtypes.rst:2923 library/stdtypes.rst:4183 +#: library/stdtypes.rst:4187 msgid "\\(4)" -msgstr "" +msgstr "\\(4)" -#: library/stdtypes.rst:421 +#: library/stdtypes.rst:427 msgid "``x ^ y``" -msgstr "" +msgstr "``x ^ y``" -#: library/stdtypes.rst:421 +#: library/stdtypes.rst:427 msgid "bitwise :dfn:`exclusive or` of *x* and *y*" -msgstr "" +msgstr "bitwise :dfn:`exclusive or` των *x* και *y*" -#: library/stdtypes.rst:424 +#: library/stdtypes.rst:430 msgid "``x & y``" -msgstr "" +msgstr "``x & y``" -#: library/stdtypes.rst:424 +#: library/stdtypes.rst:430 msgid "bitwise :dfn:`and` of *x* and *y*" -msgstr "" +msgstr "bitwise :dfn:`and` των *x* και *y*" -#: library/stdtypes.rst:427 +#: library/stdtypes.rst:433 msgid "``x << n``" -msgstr "" +msgstr "``x << n``" -#: library/stdtypes.rst:427 +#: library/stdtypes.rst:433 msgid "*x* shifted left by *n* bits" -msgstr "" +msgstr "*x* ολισθημένο (shifted) αριστερά κατά *n* bits" -#: library/stdtypes.rst:427 +#: library/stdtypes.rst:433 msgid "(1)(2)" -msgstr "" +msgstr "(1)(2)" -#: library/stdtypes.rst:429 +#: library/stdtypes.rst:435 msgid "``x >> n``" -msgstr "" +msgstr "``x >> n``" -#: library/stdtypes.rst:429 +#: library/stdtypes.rst:435 msgid "*x* shifted right by *n* bits" -msgstr "" +msgstr "*x* ολισθημένο (shifted) δεξιά κατά *n* bits" -#: library/stdtypes.rst:429 +#: library/stdtypes.rst:435 msgid "(1)(3)" -msgstr "" +msgstr "(1)(3)" -#: library/stdtypes.rst:431 +#: library/stdtypes.rst:437 msgid "``~x``" -msgstr "" +msgstr "``~x``" -#: library/stdtypes.rst:431 +#: library/stdtypes.rst:437 msgid "the bits of *x* inverted" -msgstr "" +msgstr "τα bits του *x* αντιστραμμένα" -#: library/stdtypes.rst:437 +#: library/stdtypes.rst:443 msgid "" "Negative shift counts are illegal and cause a :exc:`ValueError` to be raised." msgstr "" +"Οι μετρήσεις αρνητικών ολισθήσεων (negative shift) είναι άκυρες και κάνουν " +"raise :exc:`ValueError`." -#: library/stdtypes.rst:440 +#: library/stdtypes.rst:446 msgid "" "A left shift by *n* bits is equivalent to multiplication by ``pow(2, n)``." msgstr "" +"Μια αριστερή ολίσθηση (shift) κατά *n* bits ισοδυναμεί με πολλαπλασιασμό με " +"``pow(2, n)``." -#: library/stdtypes.rst:443 +#: library/stdtypes.rst:449 msgid "" "A right shift by *n* bits is equivalent to floor division by ``pow(2, n)``." msgstr "" +"Μια δεξιά ολίσθηση (shift) κατά *n* bits ισοδυναμεί με διαίρεση πατώματος με " +"``pow(2, n)``." -#: library/stdtypes.rst:446 +#: library/stdtypes.rst:452 msgid "" "Performing these calculations with at least one extra sign extension bit in " "a finite two's complement representation (a working bit-width of ``1 + max(x." "bit_length(), y.bit_length())`` or more) is sufficient to get the same " "result as if there were an infinite number of sign bits." msgstr "" +"Η εκτέλεση αυτών των υπολογισμών με τουλάχιστον ένα επιπλέον bit επέκτασης " +"πρόσημου σε μια αναπαράσταση ενός πεπερασμένου συμπληρώματος ως προς δύο " +"(ένα ωφέλιμο bit-width ``1 + max(x.bit_length(), y.bit_length())`` ή " +"περισσότερο) είναι αρκετό για να πάρει το ίδιο αποτέλεσμα σαν να υπήρχε ένας " +"άπειρος αριθμός bits πρόσημου." -#: library/stdtypes.rst:453 +#: library/stdtypes.rst:459 msgid "Additional Methods on Integer Types" -msgstr "" +msgstr "Περαιτέρω Μέθοδοι των Ακέραιων Τύπων" -#: library/stdtypes.rst:455 +#: library/stdtypes.rst:461 msgid "" "The int type implements the :class:`numbers.Integral` :term:`abstract base " "class`. In addition, it provides a few more methods:" msgstr "" +"Ο τύπος int υλοποιεί την :class:`numbers.Integral` :term:`abstract base " +"class`. Επιπλέον, παρέχει μερικές ακόμη μεθόδους:" -#: library/stdtypes.rst:460 +#: library/stdtypes.rst:466 msgid "" "Return the number of bits necessary to represent an integer in binary, " "excluding the sign and leading zeros::" msgstr "" +"Επιστρέφει τον αριθμό των bits που είναι απαραίτητος για να αναπαραστήσει " +"έναν ακέραιο σε δυαδικό, αποκλείοντας το πρόσημο και τα αρχικά μηδέν::" #: library/stdtypes.rst:469 msgid "" +">>> n = -37\n" +">>> bin(n)\n" +"'-0b100101'\n" +">>> n.bit_length()\n" +"6" +msgstr "" +">>> n = -37\n" +">>> bin(n)\n" +"'-0b100101'\n" +">>> n.bit_length()\n" +"6" + +#: library/stdtypes.rst:475 +msgid "" "More precisely, if ``x`` is nonzero, then ``x.bit_length()`` is the unique " "positive integer ``k`` such that ``2**(k-1) <= abs(x) < 2**k``. " "Equivalently, when ``abs(x)`` is small enough to have a correctly rounded " "logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then ``x." "bit_length()`` returns ``0``." msgstr "" +"Πιο συγκεκριμένα, εάν το ``x`` είναι μη μηδενικό, τότε το ``x.bit_length()`` " +"είναι μοναδικός θετικός αριθμός ``k`` έτσι ώστε ``2**(k-1) <= abs(x) < " +"2**k``. Ισοδύναμα, όταν το ``abs(x)`` είναι αρκετά μικρό για να έχει ένα " +"σωστά στρογγυλοποιημένο λογάριθμο, τότε ``k = 1 + int(log(abs(x), 2))``. Εάν " +"το ``x`` είναι μηδέν, τότε το ``x.bit_length()`` επιστρέφει ``0``." -#: library/stdtypes.rst:498 library/stdtypes.rst:587 +#: library/stdtypes.rst:504 library/stdtypes.rst:593 msgid "Equivalent to::" +msgstr "Ισοδύναμο με::" + +#: library/stdtypes.rst:483 +msgid "" +"def bit_length(self):\n" +" s = bin(self) # binary representation: bin(-37) --> '-0b100101'\n" +" s = s.lstrip('-0b') # remove leading zeros and minus sign\n" +" return len(s) # len('100101') --> 6" msgstr "" +"def bit_length(self):\n" +" s = bin(self) # binary representation: bin(-37) --> '-0b100101'\n" +" s = s.lstrip('-0b') # remove leading zeros and minus sign\n" +" return len(s) # len('100101') --> 6" -#: library/stdtypes.rst:486 +#: library/stdtypes.rst:492 msgid "" "Return the number of ones in the binary representation of the absolute value " "of the integer. This is also known as the population count. Example::" msgstr "" +"Επιστρέφει τον αριθμό των μονάδων στην δυαδική αναπαράσταση της απόλυτης " +"τιμής του ακεραίου. Αυτό είναι επίσης γνωστό ως το μέτρημα πληθυσμού " +"(population count). Παράδειγμα::" -#: library/stdtypes.rst:507 -msgid "Return an array of bytes representing an integer." +#: library/stdtypes.rst:496 +msgid "" +">>> n = 19\n" +">>> bin(n)\n" +"'0b10011'\n" +">>> n.bit_count()\n" +"3\n" +">>> (-n).bit_count()\n" +"3" +msgstr "" +">>> n = 19\n" +">>> bin(n)\n" +"'0b10011'\n" +">>> n.bit_count()\n" +"3\n" +">>> (-n).bit_count()\n" +"3" + +#: library/stdtypes.rst:506 +msgid "" +"def bit_count(self):\n" +" return bin(self).count(\"1\")" msgstr "" +"def bit_count(self):\n" +" return bin(self).count(\"1\")" -#: library/stdtypes.rst:519 +#: library/stdtypes.rst:513 +msgid "Return an array of bytes representing an integer." +msgstr "Επιστρέφει ένα πίνακα από bytes που αναπαριστούν έναν ακέραιο." + +#: library/stdtypes.rst:525 msgid "" "The integer is represented using *length* bytes, and defaults to 1. An :exc:" "`OverflowError` is raised if the integer is not representable with the given " "number of bytes." msgstr "" +"Ο ακέραιος αναπαρίσταται χρησιμοποιώντας *length* bytes και η προεπιλεγμένη " +"του τιμή (default) είναι 1. Ένα :exc:`OverflowError` γίνεται raise αν ο " +"ακέραιος αριθμός δεν δύναται να αναπαρασταθεί με τον αριθμό bytes που δόθηκε." -#: library/stdtypes.rst:523 +#: library/stdtypes.rst:529 msgid "" "The *byteorder* argument determines the byte order used to represent the " "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " "most significant byte is at the beginning of the byte array. If *byteorder* " "is ``\"little\"``, the most significant byte is at the end of the byte array." msgstr "" +"Το όρισμα *byteorder* καθορίζει τη σειρά των byte που χρησιμοποιούνται για " +"την αναπαράσταση του ακέραιου αριθμού, και έχουν προεπιλεγμένη τιμή " +"(default) ``\"big\"``. Εάν το *byteorder* είναι ``\"big\"``, το πιο " +"σημαντικό byte βρίσκεται στην αρχή του πίνακα των bytes. Εάν το *byteorder* " +"είναι ``\"little\"``, το πιο σημαντικό byte βρίσκεται στο τέλος του πίνακα " +"των bytes." -#: library/stdtypes.rst:529 +#: library/stdtypes.rst:535 msgid "" "The *signed* argument determines whether two's complement is used to " "represent the integer. If *signed* is ``False`` and a negative integer is " "given, an :exc:`OverflowError` is raised. The default value for *signed* is " "``False``." msgstr "" +"Το όρισμα *signed* καθορίζει εάν το συμπλήρωμα ως προς δύο χρησιμοποιείται " +"για να αντιπροσωπεύσει τον ακέραιο. Εάν το *signed* είναι ``False`` και έχει " +"δοθεί ένας αρνητικός ακέραιος, γίνεται raise ένα :exc:`OverflowError`. Η " +"προεπιλεγμένη τιμή (default) για το *signed* είναι ``False``." -#: library/stdtypes.rst:534 +#: library/stdtypes.rst:540 msgid "" "The default values can be used to conveniently turn an integer into a single " "byte object::" msgstr "" +"Οι προεπιλεγμένες τιμές (defaults) μπορούν να χρησιμοποιηθούν για να " +"μετατρέψουν βολικά έναν ακέραιο σε ένα μόνο byte αντικείμενο::" -#: library/stdtypes.rst:540 +#: library/stdtypes.rst:543 +msgid "" +">>> (65).to_bytes()\n" +"b'A'" +msgstr "" +">>> (65).to_bytes()\n" +"b'A'" + +#: library/stdtypes.rst:546 msgid "" "However, when using the default arguments, don't try to convert a value " "greater than 255 or you'll get an :exc:`OverflowError`." msgstr "" +"Ωστόσο, όταν χρησιμοποιείτε προεπιλεγμένα ορίσματα, μην προσπαθήσετε να " +"μετατρέψετε μια τιμή μεγαλύτερη από 255 ή διαφορετικά θα λάβετε ένα :exc:" +"`OverflowError`." -#: library/stdtypes.rst:556 +#: library/stdtypes.rst:551 +msgid "" +"def to_bytes(n, length=1, byteorder='big', signed=False):\n" +" if byteorder == 'little':\n" +" order = range(length)\n" +" elif byteorder == 'big':\n" +" order = reversed(range(length))\n" +" else:\n" +" raise ValueError(\"byteorder must be either 'little' or 'big'\")\n" +"\n" +" return bytes((n >> i*8) & 0xff for i in order)" +msgstr "" +"def to_bytes(n, length=1, byteorder='big', signed=False):\n" +" if byteorder == 'little':\n" +" order = range(length)\n" +" elif byteorder == 'big':\n" +" order = reversed(range(length))\n" +" else:\n" +" raise ValueError(\"byteorder must be either 'little' or 'big'\")\n" +"\n" +" return bytes((n >> i*8) & 0xff for i in order)" + +#: library/stdtypes.rst:562 msgid "Added default argument values for ``length`` and ``byteorder``." msgstr "" +"Προστιθέμενες προεπιλεγμένες τιμές (defaults) ορίσματος για ``length`` και " +"``byteorder``." -#: library/stdtypes.rst:561 +#: library/stdtypes.rst:567 msgid "Return the integer represented by the given array of bytes." msgstr "" +"Επιστρέφει έναν ακέραιο που αναπαρίσταται από τον δοσμένο πίνακα των bytes." -#: library/stdtypes.rst:574 +#: library/stdtypes.rst:580 msgid "" "The argument *bytes* must either be a :term:`bytes-like object` or an " "iterable producing bytes." msgstr "" +"Το όρισμα *bytes* πρέπει είτε να είναι ένα :term:`bytes-like object` είτε " +"ένα iterable που παράγει bytes." -#: library/stdtypes.rst:577 +#: library/stdtypes.rst:583 msgid "" "The *byteorder* argument determines the byte order used to represent the " "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " @@ -825,54 +1111,150 @@ msgid "" "array. To request the native byte order of the host system, use :data:`sys." "byteorder` as the byte order value." msgstr "" +"Το όρισμα *byteorder* καθορίζει τη σειρά byte που χρησιμοποιείται για την " +"αναπαράσταση του ακέραιου αριθμού, και η προεπιλεγμένη τιμή (default) είναι " +"``\"big\"``. Εάν το *byteorder* είναι ``\"big\"``, το το πιο σημαντικό byte " +"βρίσκεται στην αρχή του πίνακα των bytes. Εάν το *byteorder* είναι " +"``\"little\"``, το πιο σημαντικό byte βρίσκεται στο τέλος του πίνακα των " +"bytes. Για να ζητήσετε την εγγενή σειρά των bytes του host συστήματος, " +"χρησιμοποιήστε το :data:`sys.byteorder` ως τιμή της σειράς byte." -#: library/stdtypes.rst:584 +#: library/stdtypes.rst:590 msgid "" "The *signed* argument indicates whether two's complement is used to " "represent the integer." msgstr "" - -#: library/stdtypes.rst:604 +"Το όρισμα *signed* υποδεικνύει εάν το συμπλήρωμα ως προς δύο χρησιμοποιείται " +"για να αντιπροσωπεύσει τον ακέραιο." + +#: library/stdtypes.rst:595 +msgid "" +"def from_bytes(bytes, byteorder='big', signed=False):\n" +" if byteorder == 'little':\n" +" little_ordered = list(bytes)\n" +" elif byteorder == 'big':\n" +" little_ordered = list(reversed(bytes))\n" +" else:\n" +" raise ValueError(\"byteorder must be either 'little' or 'big'\")\n" +"\n" +" n = sum(b << i*8 for i, b in enumerate(little_ordered))\n" +" if signed and little_ordered and (little_ordered[-1] & 0x80):\n" +" n -= 1 << 8*len(little_ordered)\n" +"\n" +" return n" +msgstr "" +"def from_bytes(bytes, byteorder='big', signed=False):\n" +" if byteorder == 'little':\n" +" little_ordered = list(bytes)\n" +" elif byteorder == 'big':\n" +" little_ordered = list(reversed(bytes))\n" +" else:\n" +" raise ValueError(\"byteorder must be either 'little' or 'big'\")\n" +"\n" +" n = sum(b << i*8 for i, b in enumerate(little_ordered))\n" +" if signed and little_ordered and (little_ordered[-1] & 0x80):\n" +" n -= 1 << 8*len(little_ordered)\n" +"\n" +" return n" + +#: library/stdtypes.rst:610 msgid "Added default argument value for ``byteorder``." msgstr "" +"Προστιθέμενη προεπιλεγμένη τιμή (default) ορίσματος για το ``byteorder``." -#: library/stdtypes.rst:609 +#: library/stdtypes.rst:615 msgid "" "Return a pair of integers whose ratio is equal to the original integer and " "has a positive denominator. The integer ratio of integers (whole numbers) " "is always the integer as the numerator and ``1`` as the denominator." msgstr "" +"Επιστρέφει ένα ζεύγος ακεραίων των οποίων η αναλογία είναι ίση με τον αρχικό " +"ακέραιο και έχει θετικό παρονομαστή. Ο ακέραιος λόγος ακεραίων (ολόκληρων " +"αριθμών) είναι πάντα ο ακέραιος αριθμός ως αριθμητής και το ``1`` ως " +"παρονομαστής." -#: library/stdtypes.rst:618 +#: library/stdtypes.rst:624 msgid "" "Returns ``True``. Exists for duck type compatibility with :meth:`float." "is_integer`." msgstr "" +"Επιστρέφει ``True``. Υπάρχει για συμβατότητα τύπου duck με :meth:`float." +"is_integer`." -#: library/stdtypes.rst:623 +#: library/stdtypes.rst:629 msgid "Additional Methods on Float" -msgstr "" +msgstr "Περαιτέρω Μέθοδοι για Float" -#: library/stdtypes.rst:625 +#: library/stdtypes.rst:631 msgid "" "The float type implements the :class:`numbers.Real` :term:`abstract base " "class`. float also has the following additional methods." msgstr "" +"Ο τύπος float (κινητής υποδιαστολής) υλοποιεί την :class:`numbers.Real` :" +"term:`abstract base class`. Ο float έχει επίσης τις ακόλουθες πρόσθετες " +"μεθόδους." + +#: library/stdtypes.rst:636 +msgid "" +"Class method to return a floating-point number constructed from a number *x*." +msgstr "" +"Μέθοδος κλάσης για την επιστροφή ενός αριθμού κινητής υποδιαστολής που " +"κατασκευάζεται από έναν αριθμό *x*." + +#: library/stdtypes.rst:638 +msgid "" +"If the argument is an integer or a floating-point number, a floating-point " +"number with the same value (within Python's floating-point precision) is " +"returned. If the argument is outside the range of a Python float, an :exc:" +"`OverflowError` will be raised." +msgstr "" +"Εάν το όρισμα είναι ακέραιος ή αριθμός κινητής υποδιαστολής, επιστρέφεται " +"ένας αριθμός κινητής υποδιαστολής με την ίδια τιμή (εντός της ακρίβειας " +"κινητής υποδιαστολής της Python). Εάν το όρισμα βρίσκεται εκτός του εύρους " +"ενός Python float, θα κάνει raise μια :exc:`OverflowError`." + +#: library/stdtypes.rst:643 +msgid "" +"For a general Python object ``x``, ``float.from_number(x)`` delegates to ``x." +"__float__()``. If :meth:`~object.__float__` is not defined then it falls " +"back to :meth:`~object.__index__`." +msgstr "" +"Για ένα γενικό αντικείμενο Python ``x``, ``float.from_number(x)`` ανατίθεται " +"στο ``x.__float__()``. Εάν η :meth:`~object.__float__` δεν έχει οριστεί, " +"τότε επιστρέφει στη :meth:`~object.__index__`." -#: library/stdtypes.rst:630 +#: library/stdtypes.rst:653 msgid "" "Return a pair of integers whose ratio is exactly equal to the original " "float. The ratio is in lowest terms and has a positive denominator. Raises :" "exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." msgstr "" +"Επιστρέφει ένα ζεύγος ακεραίων των οποίων η αναλογία είναι ακριβώς ίση με το " +"αρχικό float. Ο λόγος είναι στο χαμηλότερο επίπεδο και έχει θετικό " +"παρονομαστή. Κάνει raise :exc:`OverflowError` στα άπειρα και ένα :exc:" +"`ValueError` για NaNs." -#: library/stdtypes.rst:637 +#: library/stdtypes.rst:660 msgid "" "Return ``True`` if the float instance is finite with integral value, and " "``False`` otherwise::" msgstr "" +"Επιστρέφει ``True`` εάν το float instance είναι πεπερασμένο με ακέραια τιμή " +"και ``False`` διαφορετικά::" + +#: library/stdtypes.rst:663 +msgid "" +">>> (-2.0).is_integer()\n" +"True\n" +">>> (3.2).is_integer()\n" +"False" +msgstr "" +">>> (-2.0).is_integer()\n" +"True\n" +">>> (3.2).is_integer()\n" +"False" -#: library/stdtypes.rst:645 +#: library/stdtypes.rst:668 msgid "" "Two methods support conversion to and from hexadecimal strings. Since " "Python's floats are stored internally as binary numbers, converting a float " @@ -881,31 +1263,51 @@ msgid "" "of floating-point numbers. This can be useful when debugging, and in " "numerical work." msgstr "" +"Δύο μέθοδοι υποστηρίζουν τη μετατροπή από και προς δεκαεξαδικές " +"συμβολοσειρές (strings). Αφού τα floats της Python αποθηκεύονται εσωτερικά " +"ως δυαδικοί αριθμοί, η μετατροπή ενός float προς ή από μια *δεκαδική* " +"συμβολοσειρά συνήθως περιλαμβάνει ένα μικρό σφάλμα στρογγυλοποίησης. " +"Αντιθέτως, οι δεκαεξαδικές συμβολοσειρές επιτρέπουν ακριβή αναπαράσταση και " +"συγκεκριμενοποίηση των αριθμών κινητής υποδιαστολής. Αυτό μπορεί να είναι " +"χρήσιμο κατά το debugging και στην αριθμητική." -#: library/stdtypes.rst:656 +#: library/stdtypes.rst:679 msgid "" "Return a representation of a floating-point number as a hexadecimal string. " "For finite floating-point numbers, this representation will always include a " "leading ``0x`` and a trailing ``p`` and exponent." msgstr "" +"Επιστρέφει μια αναπαράσταση ενός αριθμού κινητής υποδιαστολής ως δεκαεξαδική " +"συμβολοσειρά (string). Για πεπερασμένους αριθμούς κινητής υποδιαστολής, " +"αυτή η αναπαράσταση θα περιλαμβάνει πάντα ένα προπορευόμενο ``0x`` και ένα " +"τελευταίο ``p`` και εκθέτη." -#: library/stdtypes.rst:664 +#: library/stdtypes.rst:687 msgid "" "Class method to return the float represented by a hexadecimal string *s*. " "The string *s* may have leading and trailing whitespace." msgstr "" +"Μέθοδος κλάσης για την επιστροφή του float που αντιπροσωπεύεται από μια " +"δεκαεξαδική συμβολοσειρά (string) *s*. Η συμβολοσειρά *s* μπορεί να έχει " +"κενό διάστημα που στην αρχή ή το τέλος." -#: library/stdtypes.rst:669 +#: library/stdtypes.rst:692 msgid "" "Note that :meth:`float.hex` is an instance method, while :meth:`float." "fromhex` is a class method." msgstr "" +"Σημειώστε ότι το :meth:`float.hex` είναι ένα instance method, ενώ το :meth:" +"`float.fromhex` είναι μια μέθοδος κλάσης." -#: library/stdtypes.rst:672 +#: library/stdtypes.rst:695 msgid "A hexadecimal string takes the form::" -msgstr "" +msgstr "Μια δεκαεξαδική συμβολοσειρά (string) έχει τη μορφή::" -#: library/stdtypes.rst:676 +#: library/stdtypes.rst:697 +msgid "[sign] ['0x'] integer ['.' fraction] ['p' exponent]" +msgstr "[sign] ['0x'] integer ['.' fraction] ['p' exponent]" + +#: library/stdtypes.rst:699 msgid "" "where the optional ``sign`` may by either ``+`` or ``-``, ``integer`` and " "``fraction`` are strings of hexadecimal digits, and ``exponent`` is a " @@ -918,26 +1320,90 @@ msgid "" "by C's ``%a`` format character or Java's ``Double.toHexString`` are accepted " "by :meth:`float.fromhex`." msgstr "" +"όπου το προαιρετικό ``sign`` μπορεί να είναι είτε ``+`` ή ``-``, ``integer`` " +"και ``fraction`` είναι συμβολοσειρές (strings) δεκαεξαδικών ψηφίων και ο " +"``exponent`` (εκθέτης) είναι ένας δεκαδικός ακέραιος με προαιρετικό πρόσημο. " +"Τα πεζά ή κεφαλαία δεν είναι σημαντικά και πρέπει να υπάρχει τουλάχιστον ένα " +"δεκαεξαδικό ψηφίο είτε στον ακέραιο είτε στο κλάσμα. Αυτή η σύνταξη είναι " +"παρόμοια με τη σύνταξη που καθορίζεται στην ενότητα 6.4.4.2 του προτύπου " +"C99, καθώς και στη σύνταξη που χρησιμοποιείται στην Java 1.5 και μετά. " +"Ιδιαίτερα, η έξοδος του :meth:`float.hex` μπορεί να χρησιμοποιηθεί ως " +"δεκαεξαδικό Κυριολεκτική κινητής υποδιαστολής σε κώδικα C ή Java, και " +"παράχθηκαν δεκαεξαδικές συμβολοσειρές με τον χαρακτήρα μορφής ``%a`` της C ή " +"το `Double.toHexString` της Java είναι αποδεκτά από το :meth:`float.fromhex`." -#: library/stdtypes.rst:689 +#: library/stdtypes.rst:712 msgid "" "Note that the exponent is written in decimal rather than hexadecimal, and " "that it gives the power of 2 by which to multiply the coefficient. For " "example, the hexadecimal string ``0x3.a7p10`` represents the floating-point " "number ``(3 + 10./16 + 7./16**2) * 2.0**10``, or ``3740.0``::" msgstr "" +"Σημειώστε ότι ο εκθέτης είναι γραμμένος με δεκαδικό και όχι δεκαεξαδικό και " +"ότι δίνει τη δύναμη του 2 με την οποία πολλαπλασιάζεται ο συντελεστής. Για " +"παράδειγμα, η δεκαεξαδική συμβολοσειρά (string) ``0x3.a7p10`` αντιπροσωπεύει " +"τον αριθμό κινητής υποδιαστολής ``(3 + 10./16 + 7./16**2) * 2,0**10``, ή " +"``3740,0``::" -#: library/stdtypes.rst:699 +#: library/stdtypes.rst:718 +msgid "" +">>> float.fromhex('0x3.a7p10')\n" +"3740.0" +msgstr "" +">>> float.fromhex('0x3.a7p10')\n" +"3740.0" + +#: library/stdtypes.rst:722 msgid "" "Applying the reverse conversion to ``3740.0`` gives a different hexadecimal " "string representing the same number::" msgstr "" +"Η εφαρμογή της αντίστροφης μετατροπής σε ``3740.0`` δίνει μία διαφορετική " +"δεκαεξαδική συμβολοσειρά (string) που αντιπροσωπεύει τον ίδιο αριθμό::" -#: library/stdtypes.rst:709 -msgid "Hashing of numeric types" +#: library/stdtypes.rst:725 +msgid "" +">>> float.hex(3740.0)\n" +"'0x1.d380000000000p+11'" +msgstr "" +">>> float.hex(3740.0)\n" +"'0x1.d380000000000p+11'" + +#: library/stdtypes.rst:730 +msgid "Additional Methods on Complex" +msgstr "Περαιτέρω Μέθοδοι για Μιγαδικούς" + +#: library/stdtypes.rst:732 +msgid "" +"The :class:`!complex` type implements the :class:`numbers.Complex` :term:" +"`abstract base class`. :class:`!complex` also has the following additional " +"methods." +msgstr "" +"Ο τύπος :class:`!complex` υλοποιεί την :class:`numbers.Complex` :term:" +"`abstract base class`. Η :class:`!complex` έχει επίσης τις ακόλουθες " +"πρόσθετε μεθόδους." + +#: library/stdtypes.rst:738 +msgid "Class method to convert a number to a complex number." +msgstr "Μέθοδος κλάσης για τη μετατροπή ενός αριθμούς σε ένα μιγαδικό αριθμός." + +#: library/stdtypes.rst:740 +msgid "" +"For a general Python object ``x``, ``complex.from_number(x)`` delegates to " +"``x.__complex__()``. If :meth:`~object.__complex__` is not defined then it " +"falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " +"defined then it falls back to :meth:`~object.__index__`." msgstr "" +"Για ένα γενικό αντικείμενο Python ``x``, ``complex.from_number(x)`` " +"ανατίθεται στο ``x.__complex__()``. Εάν η :meth:`~object.__complex__` δεν " +"έχει οριστεί, τότε επιστρέφει :meth:`~object.__float__`. Εάν η :meth:`!" +"__float__` δεν έχει οριστεί, τότε επιστρέφει στη :meth:`~object.__index__`." + +#: library/stdtypes.rst:751 +msgid "Hashing of numeric types" +msgstr "Κατακερματισμός των αριθμητικών τύπων" -#: library/stdtypes.rst:711 +#: library/stdtypes.rst:753 msgid "" "For numbers ``x`` and ``y``, possibly of different types, it's a requirement " "that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object." @@ -952,46 +1418,75 @@ msgid "" "value of ``P`` is made available to Python as the :attr:`~sys.hash_info." "modulus` attribute of :data:`sys.hash_info`." msgstr "" - -#: library/stdtypes.rst:726 +"Για αριθμούς ``x`` και ``y``, πιθανώς διαφορετικών τύπων, είναι " +"προαπαιτούμενο ότι ``hash(x) == hash(y)`` όποτε ``x == y`` (δείτε την " +"τεκμηρίωση για την μέθοδο :meth:`~object.__hash__` για περισσότερες " +"λεπτομέρειες). Για την ευκολότερη εφαρμογή και αποτελεσματικότητα σε ένα " +"εύρος αριθμητικών τύπων (συμπεριλαμβανομένων των :class:`int`, :class:" +"`float`, :class:`decimal.Decimal` και :class:`fractions.Fraction`) o " +"κατακερματισμός της Python για αριθμητικούς τύπους βασίζεται σε μία μόνο " +"μαθηματική συνάρτηση που ορίζεται για οποιονδήποτε ρητό αριθμό, και ως εκ " +"τούτου ισχύει για όλα τα instances :class:`int` και :class:`fractions." +"Fraction` και όλα πεπερασμένα instances :class:`float` και :class:`decimal." +"Decimal`. Ουσιαστικά, αυτή η συνάρτηση δίνεται από το modulo μείωσης ``P`` " +"για ένα σταθερό πρώτο ``P``. Η τιμή του ``P`` διατίθεται στην Python ως " +"χαρακτηριστικό :attr:`~sys.hash_info.modulus` του :data:`sys.hash_info`." + +#: library/stdtypes.rst:768 msgid "" "Currently, the prime used is ``P = 2**31 - 1`` on machines with 32-bit C " "longs and ``P = 2**61 - 1`` on machines with 64-bit C longs." msgstr "" +"Αυτή τη στιγμή, ο πρώτος που χρησιμοποιείται είναι ``P = 2**31 - 1`` σε " +"μηχανήματα με μήκους 32-bit C και ``P = 2**61 - 1`` σε μηχανήματα με μήκους " +"64-bit C." -#: library/stdtypes.rst:729 +#: library/stdtypes.rst:771 msgid "Here are the rules in detail:" -msgstr "" +msgstr "Εδώ οι κανόνες λεπτομερώς:" -#: library/stdtypes.rst:731 +#: library/stdtypes.rst:773 msgid "" "If ``x = m / n`` is a nonnegative rational number and ``n`` is not divisible " "by ``P``, define ``hash(x)`` as ``m * invmod(n, P) % P``, where ``invmod(n, " "P)`` gives the inverse of ``n`` modulo ``P``." msgstr "" +"Αν το ``x = m / n`` είναι ένας μη αρνητικός ρητός αριθμός και το ``n`` δεν " +"διαιρείται από ``P``, ορίστε το ``hash(x)`` ως ``m * invmod(n, P) % P``, " +"όπου το ``invmod(n, P)`` μας δίνει το αντίστροφο του modulo ``n`` ``P``." -#: library/stdtypes.rst:735 +#: library/stdtypes.rst:777 msgid "" "If ``x = m / n`` is a nonnegative rational number and ``n`` is divisible by " "``P`` (but ``m`` is not) then ``n`` has no inverse modulo ``P`` and the rule " "above doesn't apply; in this case define ``hash(x)`` to be the constant " "value ``sys.hash_info.inf``." msgstr "" +"Αν το ``x = m / n`` είναι ένας μη αρνητικός ρητός αριθμός και το ``n`` " +"διαιρείται με το ``P`` (αλλά το ``m`` όχι) τότε το ``n`` δεν έχει αντίστροφο " +"modulo ``P`` και ο κανόνας παραπάνω δεν ισχύει. Σε αυτήν την περίπτωση " +"ορίστε το ``hash(x)`` ως σταθερή τιμή ``sys.hash_info.inf``." -#: library/stdtypes.rst:740 +#: library/stdtypes.rst:782 msgid "" "If ``x = m / n`` is a negative rational number define ``hash(x)`` as ``-" "hash(-x)``. If the resulting hash is ``-1``, replace it with ``-2``." msgstr "" +"Αν ``x = m / n`` είναι ένας αρνητικός ρητός αριθμός τότε το ``hash(x)`` " +"ορίζεται ως ``-hash(-x)``. Αν το hash που προκύπτει είναι ``-1``, " +"αντικαθίσταται με ``-2``." -#: library/stdtypes.rst:744 +#: library/stdtypes.rst:786 msgid "" "The particular values ``sys.hash_info.inf`` and ``-sys.hash_info.inf`` are " "used as hash values for positive infinity or negative infinity " "(respectively)." msgstr "" +"Οι συγκεκριμένες τιμές των ``sys.hash_info.inf`` και ``-sys.hash_info.inf`` " +"χρησιμοποιούνται ως τιμές κατακερματισμού για το θετικό άπειρο ή το αρνητικό " +"άπειρο (αντίστοιχα)." -#: library/stdtypes.rst:748 +#: library/stdtypes.rst:790 msgid "" "For a :class:`complex` number ``z``, the hash values of the real and " "imaginary parts are combined by computing ``hash(z.real) + sys.hash_info." @@ -999,31 +1494,145 @@ msgid "" "lies in ``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - " "1))``. Again, if the result is ``-1``, it's replaced with ``-2``." msgstr "" +"Για έναν :class:`complex` αριθμό ``z``, οι τιμές κατακερματισμού των " +"πραγματικών και φανταστικών μερών συνδυάζονται με τον υπολογισμό ``hash(z." +"real) + sys.hash_info.imag * hash(z.imag)``, μειωμένο modulo ``2**sys." +"hash_info.width`` έτσι ώστε να βρίσκεται στο ``range(-2**(sys.hash_info." +"width - 1), 2**(sys.hash_info.width - 1))``. Και πάλι, αν το αποτέλεσμα " +"είναι ``-1``, αντικαθίσταται με ``-2``." -#: library/stdtypes.rst:756 +#: library/stdtypes.rst:798 msgid "" "To clarify the above rules, here's some example Python code, equivalent to " "the built-in hash, for computing the hash of a rational number, :class:" "`float`, or :class:`complex`::" msgstr "" - -#: library/stdtypes.rst:812 +"Για να αποσαφηνίσουμε τους παραπάνω κανόνες, εδώ είναι ένα παράδειγμα κώδικα " +"της Python, ισοδύναμο με το built-in hash, για τον υπολογισμό του hash ενός " +"ρητού αριθμού, :class:`float`, ή :class:`complex`::" + +#: library/stdtypes.rst:803 +msgid "" +"import sys, math\n" +"\n" +"def hash_fraction(m, n):\n" +" \"\"\"Compute the hash of a rational number m / n.\n" +"\n" +" Assumes m and n are integers, with n positive.\n" +" Equivalent to hash(fractions.Fraction(m, n)).\n" +"\n" +" \"\"\"\n" +" P = sys.hash_info.modulus\n" +" # Remove common factors of P. (Unnecessary if m and n already " +"coprime.)\n" +" while m % P == n % P == 0:\n" +" m, n = m // P, n // P\n" +"\n" +" if n % P == 0:\n" +" hash_value = sys.hash_info.inf\n" +" else:\n" +" # Fermat's Little Theorem: pow(n, P-1, P) is 1, so\n" +" # pow(n, P-2, P) gives the inverse of n modulo P.\n" +" hash_value = (abs(m) % P) * pow(n, P - 2, P) % P\n" +" if m < 0:\n" +" hash_value = -hash_value\n" +" if hash_value == -1:\n" +" hash_value = -2\n" +" return hash_value\n" +"\n" +"def hash_float(x):\n" +" \"\"\"Compute the hash of a float x.\"\"\"\n" +"\n" +" if math.isnan(x):\n" +" return object.__hash__(x)\n" +" elif math.isinf(x):\n" +" return sys.hash_info.inf if x > 0 else -sys.hash_info.inf\n" +" else:\n" +" return hash_fraction(*x.as_integer_ratio())\n" +"\n" +"def hash_complex(z):\n" +" \"\"\"Compute the hash of a complex number z.\"\"\"\n" +"\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." +"imag)\n" +" # do a signed reduction modulo 2**sys.hash_info.width\n" +" M = 2**(sys.hash_info.width - 1)\n" +" hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" +" if hash_value == -1:\n" +" hash_value = -2\n" +" return hash_value" +msgstr "" +"import sys, math\n" +"\n" +"def hash_fraction(m, n):\n" +" \"\"\"Compute the hash of a rational number m / n.\n" +"\n" +" Assumes m and n are integers, with n positive.\n" +" Equivalent to hash(fractions.Fraction(m, n)).\n" +"\n" +" \"\"\"\n" +" P = sys.hash_info.modulus\n" +" # Remove common factors of P. (Unnecessary if m and n already " +"coprime.)\n" +" while m % P == n % P == 0:\n" +" m, n = m // P, n // P\n" +"\n" +" if n % P == 0:\n" +" hash_value = sys.hash_info.inf\n" +" else:\n" +" # Fermat's Little Theorem: pow(n, P-1, P) is 1, so\n" +" # pow(n, P-2, P) gives the inverse of n modulo P.\n" +" hash_value = (abs(m) % P) * pow(n, P - 2, P) % P\n" +" if m < 0:\n" +" hash_value = -hash_value\n" +" if hash_value == -1:\n" +" hash_value = -2\n" +" return hash_value\n" +"\n" +"def hash_float(x):\n" +" \"\"\"Compute the hash of a float x.\"\"\"\n" +"\n" +" if math.isnan(x):\n" +" return object.__hash__(x)\n" +" elif math.isinf(x):\n" +" return sys.hash_info.inf if x > 0 else -sys.hash_info.inf\n" +" else:\n" +" return hash_fraction(*x.as_integer_ratio())\n" +"\n" +"def hash_complex(z):\n" +" \"\"\"Compute the hash of a complex number z.\"\"\"\n" +"\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." +"imag)\n" +" # do a signed reduction modulo 2**sys.hash_info.width\n" +" M = 2**(sys.hash_info.width - 1)\n" +" hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" +" if hash_value == -1:\n" +" hash_value = -2\n" +" return hash_value" + +#: library/stdtypes.rst:854 msgid "Boolean Type - :class:`bool`" -msgstr "" +msgstr "Τύπος Boolean - :class:`bool`" -#: library/stdtypes.rst:814 +#: library/stdtypes.rst:856 msgid "" "Booleans represent truth values. The :class:`bool` type has exactly two " "constant instances: ``True`` and ``False``." msgstr "" +"Οι λογικές τιμές (Booleans) αντιπροσωπεύουν τιμές αλήθειας. Ο τύπος :class:" +"`bool` έχει ακριβώς δύο σταθερές τιμές: ``True`` και ``False``." -#: library/stdtypes.rst:822 +#: library/stdtypes.rst:864 msgid "" "The built-in function :func:`bool` converts any value to a boolean, if the " "value can be interpreted as a truth value (see section :ref:`truth` above)." msgstr "" +"Η ενσωματωμένη συνάρτηση :func:`bool` μετατρέπει οποιαδήποτε τιμή σε λογική " +"(boolean), αν η τιμή μπορεί να ερμηνευτεί ως τιμή αλήθειας (βλέπε παραπάνω " +"ενότητα :ref:`truth`)." -#: library/stdtypes.rst:825 +#: library/stdtypes.rst:867 msgid "" "For logical operations, use the :ref:`boolean operators ` ``and``, " "``or`` and ``not``. When applying the bitwise operators ``&``, ``|``, ``^`` " @@ -1031,40 +1640,60 @@ msgid "" "\"and\", \"or\", \"xor\". However, the logical operators ``and``, ``or`` and " "``!=`` should be preferred over ``&``, ``|`` and ``^``." msgstr "" +"Για λογικές πράξεις, χρησιμοποιήστε τους τελεστές :ref:`boolean ` " +"``and``, ``or`` και ``not``. Κατά την εφαρμογή των bitwise τελεστών ``&``, " +"``|``, ``^`` σε δύο booleans, επιστρέφουν ένα bool ισοδύναμο με τις λογικές " +"πράξεις \"and\", \"or\", \"xor\". Ωστόσο, οι λογικοί τελεστές ``and``, " +"``or`` και ``!=`` θα πρέπει να προτιμώνται έναντι των ``&``, ``|`` και ``^``." -#: library/stdtypes.rst:834 +#: library/stdtypes.rst:876 msgid "" "The use of the bitwise inversion operator ``~`` is deprecated and will raise " -"an error in Python 3.14." +"an error in Python 3.16." msgstr "" +"Η χρήση του bitwise inversion τελεστή ``~`` είναι ξεπερασμένη και κάνει " +"raise ένα σφάλμα στην Python 3.16." -#: library/stdtypes.rst:837 +#: library/stdtypes.rst:879 msgid "" ":class:`bool` is a subclass of :class:`int` (see :ref:`typesnumeric`). In " "many numeric contexts, ``False`` and ``True`` behave like the integers 0 and " "1, respectively. However, relying on this is discouraged; explicitly convert " "using :func:`int` instead." msgstr "" +"Η :class:`bool` είναι υποκλάση της :class:`int` (βλέπε :ref:`typesnumeric`). " +"Σε πολλά αριθμητικά περιβάλλοντα, τα ``False`` και ``True`` συμπεριφέρονται " +"όπως οι ακέραιοι αριθμοί 0 και 1, αντίστοιχα. Ωστόσο, δεν συνιστάται να " +"βασίζεστε σε αυτό· πιο αναλυτικά κάντε μετατροπή χρησιμοποιώντας τη :func:" +"`int` αντ' αυτού." -#: library/stdtypes.rst:845 +#: library/stdtypes.rst:887 msgid "Iterator Types" -msgstr "" +msgstr "Τύποι Iterator" -#: library/stdtypes.rst:853 +#: library/stdtypes.rst:895 msgid "" "Python supports a concept of iteration over containers. This is implemented " "using two distinct methods; these are used to allow user-defined classes to " "support iteration. Sequences, described below in more detail, always " "support the iteration methods." msgstr "" +"Η Python υποστηρίζει την έννοια της επανάληψης σε containers. Αυτό " +"υλοποιείται χρησιμοποιώντας δύο διαφορετικές μεθόδους· αυτές " +"χρησιμοποιούνται για να επιτρέψουν σε κλάσεις που ορίζονται από το χρήστη να " +"να υποστηρίζουν την επανάληψη. Οι ακολουθίες (sequences), που περιγράφονται " +"παρακάτω με περισσότερες λεπτομέρειες, πάντα υποστηρίζουν τις μεθόδους " +"επανάληψης." -#: library/stdtypes.rst:858 +#: library/stdtypes.rst:900 msgid "" "One method needs to be defined for container objects to provide :term:" "`iterable` support:" msgstr "" +"Μια μέθοδος πρέπει να οριστεί για τα container αντικείμενα ώστε να παρέχει :" +"term:`iterable` υποστήριξη:" -#: library/stdtypes.rst:865 +#: library/stdtypes.rst:907 msgid "" "Return an :term:`iterator` object. The object is required to support the " "iterator protocol described below. If a container supports different types " @@ -1075,218 +1704,253 @@ msgid "" "member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects " "in the Python/C API." msgstr "" +"Επιστρέφει ένα αντικείμενο :term:`iterator`. Το αντικείμενο απαιτείται να " +"υποστηρίζει το πρωτόκολλο επαναλήψεων που περιγράφεται παρακάτω. Εάν ένας " +"container υποστηρίζει διαφορετικούς τύπους της επανάληψης, μπορούν να " +"παρασχεθούν πρόσθετες μέθοδοι για να ζητηθούν συγκεκριμένοι iterators για " +"αυτούς τους τύπους επανάληψης. (Ένα παράδειγμα αντικειμένου που υποστηρίζει " +"πολλαπλές μορφές επανάληψης θα ήταν μια δενδρική δομή που υποστηρίζει και " +"αμφότερες τις breadth-first και depth-first μορφές). Αυτή η μέθοδος " +"αντιστοιχεί στη μέθοδο :c:member:`~PyTypeObject.tp_iter` της δομής τύπου για " +"αντικείμενα Python στο API της Python/C." -#: library/stdtypes.rst:874 +#: library/stdtypes.rst:916 msgid "" "The iterator objects themselves are required to support the following two " "methods, which together form the :dfn:`iterator protocol`:" msgstr "" +"Τα ίδια τα αντικείμενα επαναλήψεων απαιτείται να υποστηρίζουν τις ακόλουθες " +"δύο μεθόδους, οι οποίες από κοινού αποτελούν το :dfn:`iterator protocol`:" -#: library/stdtypes.rst:880 +#: library/stdtypes.rst:922 msgid "" "Return the :term:`iterator` object itself. This is required to allow both " "containers and iterators to be used with the :keyword:`for` and :keyword:" "`in` statements. This method corresponds to the :c:member:`~PyTypeObject." "tp_iter` slot of the type structure for Python objects in the Python/C API." msgstr "" +"Επιστρέφει το ίδιο το αντικείμενο :term:`iterator`. Αυτό απαιτείται ώστε να " +"επιτραπεί η χρησιμοποίηση τόσο των containers, όσο και των iterators με τα " +"statements :keyword:`for` και :keyword:`in`. Αυτή η μέθοδος αντιστοιχεί στη " +"δομή :c:member:`~PyTypeObject.tp_iter` των αντικειμένων της Python στο " +"Python/C API." -#: library/stdtypes.rst:889 +#: library/stdtypes.rst:931 msgid "" "Return the next item from the :term:`iterator`. If there are no further " "items, raise the :exc:`StopIteration` exception. This method corresponds to " "the :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for " "Python objects in the Python/C API." msgstr "" +"Επιστρέφει το επόμενο στοιχείο από τον :term:`iterator`. Εάν δεν υπάρχουν " +"άλλα στοιχεία, κάνει raise την εξαίρεση :exc:`StopIteration`. Αυτή η " +"μέθοδος αντιστοιχεί στην δομή :c:member:`~PyTypeObject.tp_iternext` των " +"αντικειμένων της Python στο API της Python/C." -#: library/stdtypes.rst:894 +#: library/stdtypes.rst:936 msgid "" "Python defines several iterator objects to support iteration over general " "and specific sequence types, dictionaries, and other more specialized " "forms. The specific types are not important beyond their implementation of " "the iterator protocol." msgstr "" +"Η Python ορίζει διάφορα αντικείμενα iterator για την υποστήριξη της " +"επανάληψης πάνω σε γενικούς και συγκεκριμένους τύπους ακολουθιών " +"(sequences), λεξικά (dictionaries) και άλλες πιο εξειδικευμένες μορφές. Οι " +"συγκεκριμένοι τύποι δεν είναι σημαντικοί πέρα από την υλοποίησή του iterator " +"πρωτοκόλλου." -#: library/stdtypes.rst:899 +#: library/stdtypes.rst:941 msgid "" "Once an iterator's :meth:`~iterator.__next__` method raises :exc:" "`StopIteration`, it must continue to do so on subsequent calls. " "Implementations that do not obey this property are deemed broken." msgstr "" +"Μόλις η μέθοδος :meth:`~iterator.__next__` ενός iterator κάνει raise ένα :" +"exc:`StopIteration`, πρέπει να συνεχίσει να το κάνει σε επόμενες κλήσεις. " +"Υλοποιήσεις που δεν υπακούν σε αυτή την ιδιότητα θεωρούνται εσφαλμένες." -#: library/stdtypes.rst:907 +#: library/stdtypes.rst:949 msgid "Generator Types" -msgstr "" +msgstr "Τύποι Generator" -#: library/stdtypes.rst:909 +#: library/stdtypes.rst:951 msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " -"iterator protocol. If a container object's :meth:`~iterator.__iter__` " -"method is implemented as a generator, it will automatically return an " -"iterator object (technically, a generator object) supplying the :meth:`!" +"iterator protocol. If a container object's :meth:`~object.__iter__` method " +"is implemented as a generator, it will automatically return an iterator " +"object (technically, a generator object) supplying the :meth:`~iterator." "__iter__` and :meth:`~generator.__next__` methods. More information about " "generators can be found in :ref:`the documentation for the yield expression " "`." msgstr "" +"Οι :term:`generator`\\s της Python παρέχουν έναν βολικό τρόπο για να " +"υλοποιήσετε το iterator πρωτόκολλο. Εάν η μέθοδος :meth:`~object.__iter__` " +"ενός container αντικειμένου είναι υλοποιημένη ως generator, θα επιστρέψει " +"αυτόματα ένα αντικείμενο iterator (τεχνικά, ένα αντικείμενο generator) που " +"παρέχει τις :meth:`~iterator.__iter__` και :meth:`~generator.__next__` " +"μεθόδους. Περισσότερες πληροφορίες σχετικά με τους generators μπορείτε να " +"βρείτε στην :ref:`the documentation for the yield expression `." -#: library/stdtypes.rst:921 +#: library/stdtypes.rst:963 msgid "Sequence Types --- :class:`list`, :class:`tuple`, :class:`range`" msgstr "" +"Τύποι Ακολουθίας (Sequence) --- :class:`list`, :class:`tuple`, :class:`range`" -#: library/stdtypes.rst:923 +#: library/stdtypes.rst:965 msgid "" "There are three basic sequence types: lists, tuples, and range objects. " "Additional sequence types tailored for processing of :ref:`binary data " "` and :ref:`text strings ` are described in dedicated " "sections." msgstr "" +"Υπάρχουν τρεις βασικοί τύποι ακολουθιών: lists (λίστες), tuples (πλειάδες) " +"και range objects (αντικείμενα εύρους). Πρόσθετοι τύποι ακολουθίας " +"προσαρμοσμένοι για την επεξεργασία :ref:`binary data ` και :ref:" +"`text strings ` περιγράφονται σε ειδικές ενότητες." -#: library/stdtypes.rst:932 +#: library/stdtypes.rst:974 msgid "Common Sequence Operations" -msgstr "" +msgstr "Κοινές Λειτουργίες Ακολουθιών (Sequences)" -#: library/stdtypes.rst:936 +#: library/stdtypes.rst:978 msgid "" "The operations in the following table are supported by most sequence types, " "both mutable and immutable. The :class:`collections.abc.Sequence` ABC is " "provided to make it easier to correctly implement these operations on custom " "sequence types." msgstr "" +"Οι λειτουργίες του παρακάτω πίνακα υποστηρίζονται από τους περισσότερους " +"τύπους ακολουθιών, τόσο μεταβλητών (mutable) όσο και αμετάβλητων " +"(immutable). Η :class:`collections.abc.Sequence` ABC παρέχεται για να " +"διευκολύνει τη σωστή υλοποίηση αυτών των πράξεων σε προσαρμοσμένους τύπους " +"ακολουθίας." -#: library/stdtypes.rst:941 +#: library/stdtypes.rst:983 msgid "" "This table lists the sequence operations sorted in ascending priority. In " "the table, *s* and *t* are sequences of the same type, *n*, *i*, *j* and *k* " "are integers and *x* is an arbitrary object that meets any type and value " "restrictions imposed by *s*." msgstr "" +"Αυτός ο πίνακας απαριθμεί τις λειτουργίες ακολουθίας ταξινομημένες κατά " +"αύξουσα προτεραιότητα. Στον πίνακα, τα *s* και *t* είναι ακολουθίες του " +"ίδιου τύπου, τα *n*, *i*, *j* και *k* είναι ακέραιοι αριθμοί και το *x* " +"είναι ένα αυθαίρετο αντικείμενο που πληροί οποιονδήποτε τύπο και " +"περιορισμούς τιμής που επιβάλλονται από το *s*." -#: library/stdtypes.rst:946 +#: library/stdtypes.rst:988 msgid "" "The ``in`` and ``not in`` operations have the same priorities as the " "comparison operations. The ``+`` (concatenation) and ``*`` (repetition) " "operations have the same priority as the corresponding numeric operations. " "[3]_" msgstr "" +"Οι πράξεις ``in`` και ``not in`` έχουν τις ίδιες προτεραιότητες με τις " +"πράξεις σύγκρισης. Οι πράξεις ``+`` (συνένωση) και ``*`` (επανάληψη) έχουν " +"την ίδια προτεραιότητα με τις αντίστοιχες αριθμητικές πράξεις. [3]_" -#: library/stdtypes.rst:967 +#: library/stdtypes.rst:1007 msgid "``x in s``" -msgstr "" +msgstr "``x in s``" -#: library/stdtypes.rst:967 +#: library/stdtypes.rst:1007 msgid "``True`` if an item of *s* is equal to *x*, else ``False``" -msgstr "" +msgstr "``True`` αν ένα στοιχείο του *s* είναι ίσο με το *x*, αλλιώς ``False``" -#: library/stdtypes.rst:970 +#: library/stdtypes.rst:1010 msgid "``x not in s``" -msgstr "" +msgstr "``x not in s``" -#: library/stdtypes.rst:970 +#: library/stdtypes.rst:1010 msgid "``False`` if an item of *s* is equal to *x*, else ``True``" -msgstr "" +msgstr "``False`` αν ένα στοιχείο του *s* είναι ίσο με το *x*, αλλιώς ``True``" -#: library/stdtypes.rst:973 +#: library/stdtypes.rst:1013 msgid "``s + t``" -msgstr "" +msgstr "``s + t``" -#: library/stdtypes.rst:973 +#: library/stdtypes.rst:1013 msgid "the concatenation of *s* and *t*" -msgstr "" +msgstr "η συνένωση του *s* και *t*" -#: library/stdtypes.rst:973 +#: library/stdtypes.rst:1013 msgid "(6)(7)" -msgstr "" +msgstr "(6)(7)" -#: library/stdtypes.rst:976 +#: library/stdtypes.rst:1016 msgid "``s * n`` or ``n * s``" -msgstr "" +msgstr "``s * n`` ή ``n * s``" -#: library/stdtypes.rst:976 +#: library/stdtypes.rst:1016 msgid "equivalent to adding *s* to itself *n* times" -msgstr "" +msgstr "ίσο με την πρόσθεση του *s* στον εαυτό του *n* φορές" -#: library/stdtypes.rst:976 +#: library/stdtypes.rst:1016 msgid "(2)(7)" -msgstr "" +msgstr "(2)(7)" -#: library/stdtypes.rst:979 +#: library/stdtypes.rst:1019 msgid "``s[i]``" -msgstr "" +msgstr "``s[i]``" -#: library/stdtypes.rst:979 +#: library/stdtypes.rst:1019 msgid "*i*\\ th item of *s*, origin 0" -msgstr "" +msgstr "*i*\\ ο στοιχείο του *s*, αρχή το 0" + +#: library/stdtypes.rst:1019 +msgid "(3)(8)" +msgstr "(3)(8)" -#: library/stdtypes.rst:981 +#: library/stdtypes.rst:1021 msgid "``s[i:j]``" -msgstr "" +msgstr "``s[i:j]``" -#: library/stdtypes.rst:981 +#: library/stdtypes.rst:1021 msgid "slice of *s* from *i* to *j*" -msgstr "" +msgstr "slice (υποσύνολο) του *s* από το *i* μέχρι το *j*" -#: library/stdtypes.rst:981 +#: library/stdtypes.rst:1021 msgid "(3)(4)" -msgstr "" +msgstr "(3)(4)" -#: library/stdtypes.rst:983 +#: library/stdtypes.rst:1023 msgid "``s[i:j:k]``" -msgstr "" +msgstr "``s[i:j:k]``" -#: library/stdtypes.rst:983 +#: library/stdtypes.rst:1023 msgid "slice of *s* from *i* to *j* with step *k*" -msgstr "" +msgstr "slice (υποσύνολο) του *s* από το *i* μέχρι το *j* με βήμα *k*" -#: library/stdtypes.rst:983 +#: library/stdtypes.rst:1023 msgid "(3)(5)" -msgstr "" +msgstr "(3)(5)" -#: library/stdtypes.rst:986 +#: library/stdtypes.rst:1026 msgid "``len(s)``" -msgstr "" +msgstr "``len(s)``" -#: library/stdtypes.rst:986 +#: library/stdtypes.rst:1026 msgid "length of *s*" -msgstr "" +msgstr "μήκος του *s*" -#: library/stdtypes.rst:988 +#: library/stdtypes.rst:1028 msgid "``min(s)``" -msgstr "" +msgstr "``min(s)``" -#: library/stdtypes.rst:988 +#: library/stdtypes.rst:1028 msgid "smallest item of *s*" -msgstr "" +msgstr "μικρότερο αντικείμενο του *s*" -#: library/stdtypes.rst:990 +#: library/stdtypes.rst:1030 msgid "``max(s)``" -msgstr "" +msgstr "``max(s)``" -#: library/stdtypes.rst:990 +#: library/stdtypes.rst:1030 msgid "largest item of *s*" -msgstr "" - -#: library/stdtypes.rst:992 -msgid "``s.index(x[, i[, j]])``" -msgstr "" - -#: library/stdtypes.rst:992 -msgid "" -"index of the first occurrence of *x* in *s* (at or after index *i* and " -"before index *j*)" -msgstr "" - -#: library/stdtypes.rst:3645 -msgid "\\(8)" -msgstr "" - -#: library/stdtypes.rst:996 -msgid "``s.count(x)``" -msgstr "" - -#: library/stdtypes.rst:996 -msgid "total number of occurrences of *x* in *s*" -msgstr "" +msgstr "μεγαλύτερο αντικείμενο του *s*" -#: library/stdtypes.rst:1000 +#: library/stdtypes.rst:1033 msgid "" "Sequences of the same type also support comparisons. In particular, tuples " "and lists are compared lexicographically by comparing corresponding " @@ -1294,8 +1958,14 @@ msgid "" "and the two sequences must be of the same type and have the same length. " "(For full details see :ref:`comparisons` in the language reference.)" msgstr "" +"Οι ακολουθίες (sequences) του ίδιου τύπου υποστηρίζουν επίσης συγκρίσεις. " +"Ειδικότερα, τα tuples (πλειάδες) και οι λίστες συγκρίνονται λεξικογραφικά " +"συγκρίνοντας τα αντίστοιχα στοιχεία. Αυτό σημαίνει ότι για να συγκρίνουμε " +"ίσα, κάθε στοιχείο πρέπει να συγκρίνεται ως ίσο με το αντίστοιχό του, οι δύο " +"ακολουθίες πρέπει να είναι του ίδιου τύπου και να έχουν το ίδιο μήκος. (Για " +"πλήρεις λεπτομέρειες δείτε την αναφορά :ref:`comparisons`.)" -#: library/stdtypes.rst:1010 +#: library/stdtypes.rst:1043 msgid "" "Forward and reversed iterators over mutable sequences access values using an " "index. That index will continue to march forward (or backward) even if the " @@ -1303,45 +1973,110 @@ msgid "" "`IndexError` or a :exc:`StopIteration` is encountered (or when the index " "drops below zero)." msgstr "" +"Εμπρόσθιοι και αντίστροφοι iterators πάνω σε μεταβλητές ακολουθίες έχουν " +"πρόσβαση σε τιμές χρησιμοποιώντας ένα δείκτη. Αυτός ο δείκτης θα συνεχίσει " +"να βαδίζει προς τα εμπρός (ή προς τα πίσω) ακόμα και αν η υποκείμενη " +"ακολουθία μεταλλάσσεται. Ο iterator τερματίζει μόνο όταν ένα :exc:" +"`IndexError` ή ένα :exc:`StopIteration` γίνει raise (ή όταν ο δείκτης πέσει " +"κάτω από το μηδέν)." -#: library/stdtypes.rst:1019 +#: library/stdtypes.rst:1052 msgid "" "While the ``in`` and ``not in`` operations are used only for simple " "containment testing in the general case, some specialised sequences (such " "as :class:`str`, :class:`bytes` and :class:`bytearray`) also use them for " "subsequence testing::" msgstr "" +"Ενώ οι πράξεις ``in`` και ``not in`` χρησιμοποιούνται γενικά μόνο για απλό " +"έλεγχο containment (αν στοιχείο περιέχεται σε μια δομή), ορισμένες " +"εξειδικευμένες ακολουθίες (όπως όπως οι :class:`str`, :class:`bytes` και :" +"class:`bytearray`) τις χρησιμοποιούν επίσης για subsequence testing (έλεγχο " +"υποακολουθίας)::" -#: library/stdtypes.rst:1028 +#: library/stdtypes.rst:1057 +msgid "" +">>> \"gg\" in \"eggs\"\n" +"True" +msgstr "" +">>> \"gg\" in \"eggs\"\n" +"True" + +#: library/stdtypes.rst:1061 msgid "" "Values of *n* less than ``0`` are treated as ``0`` (which yields an empty " "sequence of the same type as *s*). Note that items in the sequence *s* are " "not copied; they are referenced multiple times. This often haunts new " "Python programmers; consider::" msgstr "" +"Τιμές του *n* μικρότερες από το ``0`` αντιμετωπίζονται ως ``0`` (που δίνει " +"μια κενή ακολουθία του ίδιου τύπου με *s*). Σημειώστε ότι τα στοιχεία της " +"ακολουθίας *s* δεν αντιγράφονται· αναφέρονται πολλές φορές. Αυτό συχνά " +"στοιχειώνει τα άτομα που ξεκινούν με Python- σκεφτείτε::" + +#: library/stdtypes.rst:1066 +msgid "" +">>> lists = [[]] * 3\n" +">>> lists\n" +"[[], [], []]\n" +">>> lists[0].append(3)\n" +">>> lists\n" +"[[3], [3], [3]]" +msgstr "" +">>> lists = [[]] * 3\n" +">>> lists\n" +"[[], [], []]\n" +">>> lists[0].append(3)\n" +">>> lists\n" +"[[3], [3], [3]]" -#: library/stdtypes.rst:1040 +#: library/stdtypes.rst:1073 msgid "" "What has happened is that ``[[]]`` is a one-element list containing an empty " "list, so all three elements of ``[[]] * 3`` are references to this single " "empty list. Modifying any of the elements of ``lists`` modifies this single " "list. You can create a list of different lists this way::" msgstr "" +"Αυτό που συνέβη είναι ότι το ``[[]]`` είναι μια λίστα ενός στοιχείου που " +"περιέχει μία κενή λίστα, οπότε και τα τρία στοιχεία της ``[[]] * 3`` είναι " +"αναφορές σε αυτή τη μία κενή λίστα. Η τροποποίηση οποιουδήποτε από τα " +"στοιχεία της ``lists`` τροποποιεί αυτή τη μοναδική λίστα. Μπορείτε να " +"δημιουργήσετε μια λίστα από διαφορετικές λίστες με αυτόν τον τρόπο::" -#: library/stdtypes.rst:1052 +#: library/stdtypes.rst:1078 +msgid "" +">>> lists = [[] for i in range(3)]\n" +">>> lists[0].append(3)\n" +">>> lists[1].append(5)\n" +">>> lists[2].append(7)\n" +">>> lists\n" +"[[3], [5], [7]]" +msgstr "" +">>> lists = [[] for i in range(3)]\n" +">>> lists[0].append(3)\n" +">>> lists[1].append(5)\n" +">>> lists[2].append(7)\n" +">>> lists\n" +"[[3], [5], [7]]" + +#: library/stdtypes.rst:1085 msgid "" "Further explanation is available in the FAQ entry :ref:`faq-multidimensional-" "list`." msgstr "" +"Περαιτέρω επεξήγηση είναι διαθέσιμη στο λήμμα FAQ :ref:`faq-multidimensional-" +"list`." -#: library/stdtypes.rst:1056 +#: library/stdtypes.rst:1089 msgid "" "If *i* or *j* is negative, the index is relative to the end of sequence *s*: " "``len(s) + i`` or ``len(s) + j`` is substituted. But note that ``-0`` is " "still ``0``." msgstr "" +"Εάν το *i* ή το *j* είναι αρνητικό, ο δείκτης είναι σχετικός με το τέλος της " +"ακολουθίας *s*: το ``len(s) + i`` ή το ``len(s) + j`` αντικαθίσταται. " +"Σημειώστε όμως ότι το ``-0`` εξακολουθεί να είναι ``0``." -#: library/stdtypes.rst:1061 +#: library/stdtypes.rst:1094 msgid "" "The slice of *s* from *i* to *j* is defined as the sequence of items with " "index *k* such that ``i <= k < j``. If *i* or *j* is greater than " @@ -1349,8 +2084,14 @@ msgid "" "*j* is omitted or ``None``, use ``len(s)``. If *i* is greater than or equal " "to *j*, the slice is empty." msgstr "" +"Το υποσύνολο (slice) του *s* από το *i* έως το *j* ορίζεται ως η ακολουθία " +"στοιχείων με δείκτη *k* τέτοια ώστε ``i <= k < j```. Εάν το *i* ή το *j* " +"είναι μεγαλύτερο από το ``len(s)``, χρησιμοποιήστε το ``len(s)``. Αν το *i* " +"παραλείπεται ή είναι ``None``, χρησιμοποιήστε ``0``. Αν το *j* παραλείπεται " +"ή είναι ``μηδέν``, χρησιμοποιήστε το ``len(s)``. Εάν το *i* είναι " +"μεγαλύτερο από ή ίσο με το *j*, το υποσύνολο (slice) είναι κενό." -#: library/stdtypes.rst:1068 +#: library/stdtypes.rst:1101 msgid "" "The slice of *s* from *i* to *j* with step *k* is defined as the sequence of " "items with index ``x = i + n*k`` such that ``0 <= n < (j-i)/k``. In other " @@ -1362,290 +2103,405 @@ msgid "" "(which end depends on the sign of *k*). Note, *k* cannot be zero. If *k* is " "``None``, it is treated like ``1``." msgstr "" +"Το υποσύνολο (slice) του *s* από *i* έως *j* με βήμα *k* ορίζεται ως η " +"ακολουθία των στοιχείων με δείκτη ``x = i + n*k`` τέτοια ώστε ``0 <= n < (j-" +"i)/k``. Με άλλα λόγια, οι δείκτες είναι ``i``, ``i+k``, ``i+2*k``, " +"``i+3*k`` και ούτω καθεξής, σταματώντας όταν φτάσουμε στο *j* (αλλά ποτέ δεν " +"περιλαμβάνει το *j*). Όταν το *k* είναι θετικό, τα *i* και *j* μειώνονται " +"σε ``len(s)`` αν είναι μεγαλύτερα. Όταν το *k* είναι αρνητικό, τα *i* και " +"*j* μειώνονται σε ``len(s) - 1`` αν είναι μεγαλύτερα. Εάν τα *i* ή *j* " +"παραλείπονται ή είναι ``None``, γίνονται τιμές \"end\" (το τέλος εξαρτάται " +"από το πρόσημο του *k*). Σημειώστε ότι το *k* δεν μπορεί να είναι μηδέν. " +"Εάν το *k* είναι ``None``, αντιμετωπίζεται όπως το ``1``." -#: library/stdtypes.rst:1079 +#: library/stdtypes.rst:1112 msgid "" "Concatenating immutable sequences always results in a new object. This " "means that building up a sequence by repeated concatenation will have a " "quadratic runtime cost in the total sequence length. To get a linear " "runtime cost, you must switch to one of the alternatives below:" msgstr "" +"Η συνένωση αμετάβλητων ακολουθιών (immutable sequences) οδηγεί πάντα σε ένα " +"νέο αντικείμενο. Αυτό σημαίνει ότι η δημιουργία μιας ακολουθίας με " +"επαναλαμβανόμενη συνένωση θα έχει τετραγωνικό κόστος χρόνου εκτέλεσης " +"(runtime cost) στο συνολικό μήκος της ακολουθίας. Για να πάρετε ένα " +"γραμμικό κόστος χρόνου εκτέλεσης (runtime cost), πρέπει να μεταβείτε σε μία " +"από τις παρακάτω εναλλακτικές λύσεις::" -#: library/stdtypes.rst:1084 +#: library/stdtypes.rst:1117 msgid "" "if concatenating :class:`str` objects, you can build a list and use :meth:" "`str.join` at the end or else write to an :class:`io.StringIO` instance and " "retrieve its value when complete" msgstr "" +"αν συνενώνεται αντικείμενα :class:`str`, μπορείτε να δημιουργήσετε μια λίστα " +"και να χρησιμοποιήσετε την :meth:`str.join` στο τέλος ή αλλιώς να γράψετε σε " +"ένα :class:`io.StringIO` instance και ανακτήσετε την τιμή της όταν " +"ολοκληρωθεί" -#: library/stdtypes.rst:1088 +#: library/stdtypes.rst:1121 msgid "" "if concatenating :class:`bytes` objects, you can similarly use :meth:`bytes." "join` or :class:`io.BytesIO`, or you can do in-place concatenation with a :" "class:`bytearray` object. :class:`bytearray` objects are mutable and have " "an efficient overallocation mechanism" msgstr "" +"αν συνενώνεται αντικείμενα :class:`bytes`, μπορείτε να χρησιμοποιήσετε " +"παρόμοια τη μέθοδο :meth:`bytes.join` ή :class:`io.BytesIO`, ή μπορείτε να " +"κάνετε in-place συνένωση (concatenation) με ένα :class:`bytearray` " +"αντικείμενο. Τα αντικείμενα :class:`bytearray` είναι μεταβλητά και έχουν " +"έναν αποτελεσματικό μηχανισμό συνολικής κατανομής (overallocation)" -#: library/stdtypes.rst:1093 +#: library/stdtypes.rst:1126 msgid "if concatenating :class:`tuple` objects, extend a :class:`list` instead" msgstr "" +"αν συνενώνεται αντικείμενα :class:`tuple`, επεκτείνετε μια :class:`list` " +"αντ' αυτού" -#: library/stdtypes.rst:1095 +#: library/stdtypes.rst:1128 msgid "for other types, investigate the relevant class documentation" -msgstr "" +msgstr "για άλλους τύπους, ερευνήστε τη σχετική τεκμηρίωση των κλάσεων" -#: library/stdtypes.rst:1099 +#: library/stdtypes.rst:1132 msgid "" "Some sequence types (such as :class:`range`) only support item sequences " "that follow specific patterns, and hence don't support sequence " "concatenation or repetition." msgstr "" +"Ορισμένοι τύποι ακολουθιών (όπως :class:`range`) υποστηρίζουν μόνο " +"ακολουθίες στοιχείων που ακολουθούν συγκεκριμένα μοτίβα, και ως εκ τούτου " +"δεν υποστηρίζουν ακολουθία συνένωση ή επανάληψη." + +#: library/stdtypes.rst:1137 +msgid "An :exc:`IndexError` is raised if *i* is outside the sequence range." +msgstr "" +"Μια :exc:`IndexError` γίνεται raise εάν το *i* βρίσκεται εκτός του εύρους " +"ακολουθίας." + +#: library/stdtypes.rst:1140 +msgid "Sequence Methods" +msgstr "Μέθοδοι Ακολουθίας" + +#: library/stdtypes.rst:1141 +msgid "Sequence types also support the following methods:" +msgstr "Οι τύποι ακολουθίας υποστηρίζουν επίσης τις ακόλουθες μεθόδους:" + +#: library/stdtypes.rst:1151 +msgid "Return the total number of occurrences of *value* in *sequence*." +msgstr "" +"Επιστρέφει το συνολικό αριθμό των εμφανίσεων του *value* μέσα στην " +"*sequence*." -#: library/stdtypes.rst:1104 +#: library/stdtypes.rst:1161 +msgid "Return the index of the first occurrence of *value* in *sequence*." +msgstr "" +"Επιστρέφει το δείκτη της πρώτης εμφάνισης του *value* μέσα στην *sequence*." + +#: library/stdtypes.rst:1347 +msgid "Raises :exc:`ValueError` if *value* is not found in *sequence*." +msgstr "" +"Κάνει raise μια :exc:`ValueError` αν το *value* δεν μπορεί να βρεθεί μέσα " +"στην *sequence*." + +#: library/stdtypes.rst:1165 msgid "" -"``index`` raises :exc:`ValueError` when *x* is not found in *s*. Not all " -"implementations support passing the additional arguments *i* and *j*. These " -"arguments allow efficient searching of subsections of the sequence. Passing " -"the extra arguments is roughly equivalent to using ``s[i:j].index(x)``, only " -"without copying any data and with the returned index being relative to the " -"start of the sequence rather than the start of the slice." +"The *start* or *stop* arguments allow for efficient searching of subsections " +"of the sequence, beginning at *start* and ending at *stop*. This is roughly " +"equivalent to ``start + sequence[start:stop].index(value)``, only without " +"copying any data." msgstr "" +"Τα ορίσματα *start* ή *stop* επιτρέπουν αποδοτική αναζήτηση υποτμημάτων της " +"ακολουθίας, ξεκινώντας από το *start* και τελειώνοντας στο *stop*. Αυτό " +"είναι περίπου ισοδύναμο με το ``start + sequence[start:stop].index(value)``, " +"μόνο που δεν αντιγράφονται δεδομένα." -#: library/stdtypes.rst:1115 -msgid "Immutable Sequence Types" +#: library/stdtypes.rst:1171 +msgid "" +"Not all sequence types support passing the *start* and *stop* arguments." msgstr "" +"Δεν υποστηρίζουν όλοι οι τύποι ακολουθιών τη χρήση των ορισμάτων *start* και " +"*stop*." + +#: library/stdtypes.rst:1177 +msgid "Immutable Sequence Types" +msgstr "Τύποι Αμετάβλητων Ακολουθιών (Sequences)" -#: library/stdtypes.rst:1122 +#: library/stdtypes.rst:1184 msgid "" "The only operation that immutable sequence types generally implement that is " "not also implemented by mutable sequence types is support for the :func:" "`hash` built-in." msgstr "" +"Η μόνη λειτουργία που υλοποιούν οι αμετάβλητοι γενικοί τύποι ακολουθίας που " +"δεν είναι υλοποιημένοι από μεταβλητούς τύπους ακολουθίας, είναι η υποστήριξη " +"της :func:`hash` built-in." -#: library/stdtypes.rst:1126 +#: library/stdtypes.rst:1188 msgid "" "This support allows immutable sequences, such as :class:`tuple` instances, " "to be used as :class:`dict` keys and stored in :class:`set` and :class:" "`frozenset` instances." msgstr "" +"Αυτή η υποστήριξη επιτρέπει αμετάβλητες ακολουθίες, όπως οι περιπτώσεις των :" +"class:`tuple`, να χρησιμοποιούνται ως κλειδιά :class:`dict` και να " +"αποθηκεύονται σε :class:`set` και :class:`frozenset` instances." -#: library/stdtypes.rst:1130 +#: library/stdtypes.rst:1192 msgid "" "Attempting to hash an immutable sequence that contains unhashable values " "will result in :exc:`TypeError`." msgstr "" +"Η προσπάθεια κατακερματισμού μιας αμετάβλητης ακολουθίας που περιέχει μη " +"κατακερματιστέες (unhashable) τιμές θα οδηγήσει σε :exc:`TypeError`." -#: library/stdtypes.rst:1137 +#: library/stdtypes.rst:1199 msgid "Mutable Sequence Types" -msgstr "" +msgstr "Τύποι Μεταβλητών Ακολουθιών (Sequences)" -#: library/stdtypes.rst:1144 +#: library/stdtypes.rst:1206 msgid "" "The operations in the following table are defined on mutable sequence types. " "The :class:`collections.abc.MutableSequence` ABC is provided to make it " "easier to correctly implement these operations on custom sequence types." msgstr "" +"Οι λειτουργίες του ακόλουθου πίνακα ορίζονται σε μεταβλητούς τύπους " +"ακολουθίας. Η :class:`collections.abc.MutableSequence` ABC παρέχεται για να " +"κάνει ευκολότερη την σωστή υλοποίηση αυτών των λειτουργιών σε " +"προσαρμοσμένους τύπους ακολουθιών." -#: library/stdtypes.rst:1148 +#: library/stdtypes.rst:1210 msgid "" "In the table *s* is an instance of a mutable sequence type, *t* is any " "iterable object and *x* is an arbitrary object that meets any type and value " "restrictions imposed by *s* (for example, :class:`bytearray` only accepts " "integers that meet the value restriction ``0 <= x <= 255``)." msgstr "" +"Στον πίνακα το *s* είναι ένα instance ενός μεταβλητού τύπου ακολουθίας, το " +"*t* είναι οποιοδήποτε iterable αντικείμενο και το *x* είναι ένα αυθαίρετο " +"αντικείμενο που πληροί οποιονδήποτε τύπο και περιορισμούς τιμής που " +"επιβάλλονται από το *s* (για παράδειγμα, το :class:`bytearray` δέχεται μόνο " +"ακέραιους που πληρούν τον περιορισμό ``0 <= x <= 255``)." -#: library/stdtypes.rst:1172 +#: library/stdtypes.rst:1226 msgid "``s[i] = x``" -msgstr "" +msgstr "``s[i] = x``" -#: library/stdtypes.rst:1172 +#: library/stdtypes.rst:1226 msgid "item *i* of *s* is replaced by *x*" -msgstr "" +msgstr "το στοιχείο *i* του *s* αντικαθίσταται από το *x*" -#: library/stdtypes.rst:1175 +#: library/stdtypes.rst:1229 +msgid "``del s[i]``" +msgstr "``del s[i]``" + +#: library/stdtypes.rst:1229 +msgid "removes item *i* of *s*" +msgstr "αφαιρεί το στοιχείο *i* από το *s*" + +#: library/stdtypes.rst:1231 msgid "``s[i:j] = t``" -msgstr "" +msgstr "``s[i:j] = t``" -#: library/stdtypes.rst:1175 +#: library/stdtypes.rst:1231 msgid "" "slice of *s* from *i* to *j* is replaced by the contents of the iterable *t*" msgstr "" +"το υποσύνολο (slice) του *s* από το *i* έως το *j* αντικαθίσταται από τα " +"περιεχόμενα του iterable *t*" -#: library/stdtypes.rst:1179 +#: library/stdtypes.rst:1235 msgid "``del s[i:j]``" -msgstr "" +msgstr "``del s[i:j]``" -#: library/stdtypes.rst:1179 -msgid "same as ``s[i:j] = []``" +#: library/stdtypes.rst:1235 +msgid "" +"removes the elements of ``s[i:j]`` from the list (same as ``s[i:j] = []``)" msgstr "" +"αφαιρεί τα στοιχεία της ``s[i:j]`` από τη λίστα (παρόμοια όπως ``s[i:j] = " +"[]``)" -#: library/stdtypes.rst:1181 +#: library/stdtypes.rst:1239 msgid "``s[i:j:k] = t``" -msgstr "" +msgstr "``s[i:j:k] = t``" -#: library/stdtypes.rst:1181 +#: library/stdtypes.rst:1239 msgid "the elements of ``s[i:j:k]`` are replaced by those of *t*" -msgstr "" +msgstr "τα στοιχεία του ``s[i:j:k]`` αντικαθίστανται από εκείνα του *t*" -#: library/stdtypes.rst:1184 +#: library/stdtypes.rst:1242 msgid "``del s[i:j:k]``" -msgstr "" +msgstr "``del s[i:j:k]``" -#: library/stdtypes.rst:1184 +#: library/stdtypes.rst:1242 msgid "removes the elements of ``s[i:j:k]`` from the list" -msgstr "" - -#: library/stdtypes.rst:1187 -msgid "``s.append(x)``" -msgstr "" - -#: library/stdtypes.rst:1187 -msgid "" -"appends *x* to the end of the sequence (same as ``s[len(s):len(s)] = [x]``)" -msgstr "" - -#: library/stdtypes.rst:1191 -msgid "``s.clear()``" -msgstr "" - -#: library/stdtypes.rst:1191 -msgid "removes all items from *s* (same as ``del s[:]``)" -msgstr "" - -#: library/stdtypes.rst:1194 -msgid "``s.copy()``" -msgstr "" +msgstr "αφαιρεί τα στοιχεία του ``s[i:j:k]`` από τη λίστα" -#: library/stdtypes.rst:1194 -msgid "creates a shallow copy of *s* (same as ``s[:]``)" -msgstr "" - -#: library/stdtypes.rst:1197 -msgid "``s.extend(t)`` or ``s += t``" -msgstr "" +#: library/stdtypes.rst:1245 +msgid "``s += t``" +msgstr "``s += t``" -#: library/stdtypes.rst:1197 +#: library/stdtypes.rst:1245 msgid "" "extends *s* with the contents of *t* (for the most part the same as " "``s[len(s):len(s)] = t``)" msgstr "" +"επεκτείνει το *s* με τα περιεχόμενα του *t* (ως επί το πλείστον το ίδιο με " +"το ``s[len(s):len(s)] = t``)" -#: library/stdtypes.rst:1202 +#: library/stdtypes.rst:1250 msgid "``s *= n``" -msgstr "" +msgstr "``s *= n``" -#: library/stdtypes.rst:1202 +#: library/stdtypes.rst:1250 msgid "updates *s* with its contents repeated *n* times" -msgstr "" - -#: library/stdtypes.rst:1205 -msgid "``s.insert(i, x)``" -msgstr "" +msgstr "ενημερώνει το *s* με το περιεχόμενό του επαναλαμβανόμενο *n* φορές" -#: library/stdtypes.rst:1205 +#: library/stdtypes.rst:1257 msgid "" -"inserts *x* into *s* at the index given by *i* (same as ``s[i:i] = [x]``)" +"If *k* is not equal to ``1``, *t* must have the same length as the slice it " +"is replacing." msgstr "" +"Αν το *k* δεν είναι ίσο με ``1``, το *t* πρέπει να έχει το ίδιο μήκος με το " +"τμήμα που αντικαθιστά." -#: library/stdtypes.rst:1209 -msgid "``s.pop()`` or ``s.pop(i)``" -msgstr "" - -#: library/stdtypes.rst:1209 -msgid "retrieves the item at *i* and also removes it from *s*" +#: library/stdtypes.rst:1260 +msgid "" +"The value *n* is an integer, or an object implementing :meth:`~object." +"__index__`. Zero and negative values of *n* clear the sequence. Items in " +"the sequence are not copied; they are referenced multiple times, as " +"explained for ``s * n`` under :ref:`typesseq-common`." msgstr "" +"Η τιμή *n* είναι ένας ακέραιος αριθμός ή ένα αντικείμενο που υλοποιεί την :" +"meth:`~object.__index__`. Οι μηδενικές και αρνητικές τιμές του *n* " +"καθαρίζουν την ακολουθία. Τα στοιχεία της ακολουθίας δεν αντιγράφονται· " +"αναφέρονται πολλές φορές, όπως εξηγείται για το ``s * n``` στο :ref:" +"`typesseq-common`." -#: library/stdtypes.rst:1212 -msgid "``s.remove(x)``" -msgstr "" +#: library/stdtypes.rst:1266 +msgid "Mutable Sequence Methods" +msgstr "Μέθοδοι Μεταβλητών Ακολουθιών (Sequences)" -#: library/stdtypes.rst:1212 -msgid "remove the first item from *s* where ``s[i]`` is equal to *x*" +#: library/stdtypes.rst:1267 +msgid "Mutable sequence types also support the following methods:" msgstr "" +"Οι τύποι μεταβλητών ακολουθιών υποστηρίζουν επίσης τις ακόλουθες μεθόδους:" -#: library/stdtypes.rst:1215 -msgid "``s.reverse()``" +#: library/stdtypes.rst:1276 +msgid "" +"Append *value* to the end of the sequence This is equivalent to writing " +"``seq[len(seq):len(seq)] = [value]``." msgstr "" +"Εισάγει το *value* στο τέλος της ακολουθίας Αυτό είναι ισοδύναμο με το να " +"γράψουμε ``seq[len(seq):len(seq)] = [value]``." -#: library/stdtypes.rst:1215 -msgid "reverses the items of *s* in place" +#: library/stdtypes.rst:1288 +msgid "" +"Remove all items from *sequence*. This is equivalent to writing ``del " +"sequence[:]``." msgstr "" +"Αφαιρεί όλα τα στοιχεία από την *sequence*. Αυτό είναι ισοδύναμο με το να " +"γράψουμε ``del sequence[:]``." -#: library/stdtypes.rst:1223 -msgid "*t* must have the same length as the slice it is replacing." +#: library/stdtypes.rst:1300 +msgid "" +"Create a shallow copy of *sequence*. This is equivalent to writing " +"``sequence[:]``." msgstr "" +"Δημιουργεί ένα shallow αντίγραφο του *sequence*. Αυτό είναι ισοδύναμο με το " +"να γράψουμε ``sequence[:]``." -#: library/stdtypes.rst:1226 +#: library/stdtypes.rst:1303 msgid "" -"The optional argument *i* defaults to ``-1``, so that by default the last " -"item is removed and returned." +"The :meth:`!copy` method is not part of the :class:`~collections.abc." +"MutableSequence` :class:`~abc.ABC`, but most concrete mutable sequence types " +"provide it." msgstr "" +"Η μέθοδος :meth:`!copy` δεν είναι μέρος της :class:`~collections.abc." +"MutableSequence` :class:`~abc.ABC`, αλλά οι περισσότερους συγκεκριμένοι " +"μεταβλητοί τύποι ακολουθιών την παρέχουν." -#: library/stdtypes.rst:1230 -msgid ":meth:`remove` raises :exc:`ValueError` when *x* is not found in *s*." +#: library/stdtypes.rst:1314 +msgid "" +"Extend *sequence* with the contents of *iterable*. For the most part, this " +"is the same as writing ``seq[len(seq):len(seq)] = iterable``." msgstr "" +"Επεκτείνει το *sequence* με τα περιεχόμενα του *iterable*. Για το μεγαλύτερο " +"μέρος, αυτό είναι το ίδιο με το να γράψουμε ``seq[len(seq):len(seq)] = " +"iterable``." -#: library/stdtypes.rst:1233 +#: library/stdtypes.rst:1325 msgid "" -"The :meth:`reverse` method modifies the sequence in place for economy of " -"space when reversing a large sequence. To remind users that it operates by " -"side effect, it does not return the reversed sequence." +"Insert *value* into *sequence* at the given *index*. This is equivalent to " +"writing ``sequence[index:index] = [value]``." msgstr "" +"Εισάγει το *value* στην *sequence* στη δοθείσα θέση *index*. Αυτό είναι " +"ισοδύναμο με το να γράψουμε ``sequence[index:index] = [value]``." -#: library/stdtypes.rst:1238 +#: library/stdtypes.rst:1335 msgid "" -":meth:`clear` and :meth:`!copy` are included for consistency with the " -"interfaces of mutable containers that don't support slicing operations (such " -"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of the :class:" -"`collections.abc.MutableSequence` ABC, but most concrete mutable sequence " -"classes provide it." +"Retrieve the item at *index* and also removes it from *sequence*. By " +"default, the last item in *sequence* is removed and returned." msgstr "" +"Ανακτά το στοιχείο στη θέση *index* και το αφαιρεί επίσης από την " +"*sequence*. Εξ ορισμού, το τελευταίο στοιχείο στην *sequence* αφαιρείται και " +"επιστρέφεται." -#: library/stdtypes.rst:1244 -msgid ":meth:`clear` and :meth:`!copy` methods." +#: library/stdtypes.rst:1345 +msgid "Remove the first item from *sequence* where ``sequence[i] == value``." msgstr "" +"Αφαιρεί το πρώτο στοιχείο από την *sequence* όπου ``sequence[i] == value``." -#: library/stdtypes.rst:1248 +#: library/stdtypes.rst:1356 msgid "" -"The value *n* is an integer, or an object implementing :meth:`~object." -"__index__`. Zero and negative values of *n* clear the sequence. Items in " -"the sequence are not copied; they are referenced multiple times, as " -"explained for ``s * n`` under :ref:`typesseq-common`." +"Reverse the items of *sequence* in place. This method maintains economy of " +"space when reversing a large sequence. To remind users that it operates by " +"side-effect, it returns ``None``." msgstr "" +"Αντιστρέφει τα στοιχεία της *sequence* στη θέση της. Αυτή η μέθοδος διατηρεί " +"την οικονομία χώρου κατά την αντιστροφή μιας μεγάλης ακολουθίας. Για να " +"θυμίζει στους χρήστες ότι λειτουργεί με παρενέργεια, επιστρέφει το ``None``." -#: library/stdtypes.rst:1257 +#: library/stdtypes.rst:1364 msgid "Lists" -msgstr "" +msgstr "Λίστες" -#: library/stdtypes.rst:1261 +#: library/stdtypes.rst:1368 msgid "" "Lists are mutable sequences, typically used to store collections of " "homogeneous items (where the precise degree of similarity will vary by " "application)." msgstr "" +"Οι λίστες είναι μεταβλητές ακολουθίες, που συνήθως χρησιμοποιούνται για την " +"αποθήκευση συλλογών ομοιογενών στοιχείων (όπου ο ακριβής βαθμός ομοιότητας " +"ποικίλλει ανάλογα με εφαρμογή)." -#: library/stdtypes.rst:1267 +#: library/stdtypes.rst:1374 msgid "Lists may be constructed in several ways:" -msgstr "" +msgstr "Οι λίστες μπορούν να κατασκευαστούν με διάφορους τρόπους:" -#: library/stdtypes.rst:1269 +#: library/stdtypes.rst:1376 msgid "Using a pair of square brackets to denote the empty list: ``[]``" msgstr "" +"Χρησιμοποιείστε ένα ζεύγος αγκυλών για να δηλώσετε την κενή λίστα: ``[]``" -#: library/stdtypes.rst:1270 +#: library/stdtypes.rst:1377 msgid "" "Using square brackets, separating items with commas: ``[a]``, ``[a, b, c]``" msgstr "" +"Χρησιμοποιώντας αγκύλες, διαχωρίζοντας τα στοιχεία με κόμματα: ``[a]``, " +"``[a, b, c]``" -#: library/stdtypes.rst:1271 +#: library/stdtypes.rst:1378 msgid "Using a list comprehension: ``[x for x in iterable]``" -msgstr "" +msgstr "Χρήση ενός list comprehension: ``[x for x in iterable]``" -#: library/stdtypes.rst:1272 +#: library/stdtypes.rst:1379 msgid "Using the type constructor: ``list()`` or ``list(iterable)``" msgstr "" +"Χρήση του κατασκευαστή τύπου (type constructor): ``list()`` ή " +"``list(iterable)``" -#: library/stdtypes.rst:1274 +#: library/stdtypes.rst:1381 msgid "" "The constructor builds a list whose items are the same and in the same order " "as *iterable*'s items. *iterable* may be either a sequence, a container " @@ -1655,35 +2511,54 @@ msgid "" "returns ``[1, 2, 3]``. If no argument is given, the constructor creates a " "new empty list, ``[]``." msgstr "" +"Ο κατασκευαστής (constructor) δημιουργεί μια λίστα της οποίας τα στοιχεία " +"είναι τα ίδια και με την ίδια σειρά όπως τα στοιχεία του *iterable*. Το " +"*iterable* μπορεί να είναι είτε μια ακολουθία, είτε ένας container που " +"υποστηρίζει την επανάληψη, ή ένα αντικείμενο iterator. Εάν το *iterable* " +"είναι ήδη μια λίστα, δημιουργείται ένα αντίγραφο και επιστρέφεται, παρόμοια " +"με την ``iterable[:]``. Για παράδειγμα, η ``list('abc')`` επιστρέφει ``['a', " +"'b', 'c']`` και η ``list( (1, 2, 3) )`` επιστρέφει ``[1, 2, 3]``. Αν δεν " +"δοθεί κανένα όρισμα, ο κατασκευαστής δημιουργεί μία νέα κενή λίστα, ``[]``." -#: library/stdtypes.rst:1283 +#: library/stdtypes.rst:1390 msgid "" "Many other operations also produce lists, including the :func:`sorted` built-" "in." msgstr "" +"Πολλές άλλες λειτουργίες παράγουν επίσης λίστες, συμπεριλαμβανομένης της " +"built-in :func:`sorted`." -#: library/stdtypes.rst:1286 +#: library/stdtypes.rst:1393 msgid "" "Lists implement all of the :ref:`common ` and :ref:`mutable " "` sequence operations. Lists also provide the following " "additional method:" msgstr "" +"Οι λίστες υλοποιούν όλες τις :ref:`common ` και :ref:" +"`mutable ` λειτουργίες ακολουθίας. Οι λίστες παρέχουν " +"επίσης την ακόλουθη πρόσθετη μέθοδο:" -#: library/stdtypes.rst:1292 +#: library/stdtypes.rst:1399 msgid "" "This method sorts the list in place, using only ``<`` comparisons between " "items. Exceptions are not suppressed - if any comparison operations fail, " "the entire sort operation will fail (and the list will likely be left in a " "partially modified state)." msgstr "" +"Αυτή η μέθοδος ταξινομεί τη λίστα, χρησιμοποιώντας μόνο συγκρίσεις ``<`` " +"μεταξύ στοιχείων. Οι εξαιρέσεις δεν καταστέλλονται - αν αποτύχει κάποια " +"πράξη σύγκρισης, ολόκληρη η λειτουργία ταξινόμησης θα αποτύχει (και η λίστα " +"θα παραμείνει πιθανότατα σε μια μερικώς τροποποιημένη κατάσταση)." -#: library/stdtypes.rst:1297 +#: library/stdtypes.rst:1404 msgid "" ":meth:`sort` accepts two arguments that can only be passed by keyword (:ref:" "`keyword-only arguments `):" msgstr "" +"η :meth:`sort` δέχεται δύο ορίσματα που μπορούν να περάσουν μόνο με τη λέξη-" +"κλειδί (:ref:`keyword-only arguments `):" -#: library/stdtypes.rst:1300 +#: library/stdtypes.rst:1407 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each list element (for example, ``key=str.lower``). The " @@ -1691,53 +2566,81 @@ msgid "" "for the entire sorting process. The default value of ``None`` means that " "list items are sorted directly without calculating a separate key value." msgstr "" +"το *key* καθορίζει μια συνάρτηση ενός ορίσματος που χρησιμοποιείται για την " +"εξαγωγή ενός κλειδιού σύγκρισης (comparison key) από κάθε στοιχείο της " +"λίστας (για παράδειγμα, ``key=str.lower``). Το κλειδί που αντιστοιχεί σε " +"κάθε στοιχείο της λίστας υπολογίζεται μία φορά και στη συνέχεια " +"χρησιμοποιείται για ολόκληρη τη διαδικασία ταξινόμησης. Η προεπιλεγμένη τιμή " +"(default) ``None`` σημαίνει ότι τα στοιχεία της λίστας ταξινομούνται " +"απευθείας χωρίς να υπολογίζεται ξεχωριστή τιμή κλειδιού." -#: library/stdtypes.rst:1307 +#: library/stdtypes.rst:1414 msgid "" "The :func:`functools.cmp_to_key` utility is available to convert a 2.x style " "*cmp* function to a *key* function." msgstr "" +"Το utility :func:`functools.cmp_to_key` είναι διαθέσιμο για τη μετατροπή μια " +"συνάρτηση *cmp* στυλ 2.x σε συνάρτηση *key*." -#: library/stdtypes.rst:1310 +#: library/stdtypes.rst:1417 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" +"η *reverse* είναι μια λογική (boolean) τιμή. Αν τεθεί σε ``True``, τότε τα " +"στοιχεία της λίστας ταξινομούνται σαν να ήταν αντίστροφη κάθε σύγκριση." -#: library/stdtypes.rst:1313 +#: library/stdtypes.rst:1420 msgid "" "This method modifies the sequence in place for economy of space when sorting " "a large sequence. To remind users that it operates by side effect, it does " "not return the sorted sequence (use :func:`sorted` to explicitly request a " "new sorted list instance)." msgstr "" +"Αυτή η μέθοδος τροποποιεί την ακολουθία για εξοικονόμηση χώρου κατά την " +"ταξινόμηση μιας μεγάλης ακολουθίας. Nα υπενθυμίσουμε στους χρήστες ότι " +"λειτουργεί με παρενέργεια, δεν επιστρέφει την ταξινομημένη ακολουθία " +"(χρησιμοποιήστε την :func:`sorted` για να ζητήσετε μια νέα περίπτωση " +"ταξινομημένης λίστας)." -#: library/stdtypes.rst:1318 +#: library/stdtypes.rst:1425 msgid "" "The :meth:`sort` method is guaranteed to be stable. A sort is stable if it " "guarantees not to change the relative order of elements that compare equal " "--- this is helpful for sorting in multiple passes (for example, sort by " "department, then by salary grade)." msgstr "" +"Η μέθοδος :meth:`sort` είναι εγγυημένα σταθερή. Μια ταξινόμηση είναι " +"σταθερή αν εγγυάται ότι δεν θα αλλάξει τη σχετική σειρά των στοιχείων που " +"συγκρίνουν ίσα --- αυτό είναι χρήσιμο για την ταξινόμηση σε πολλαπλά " +"περάσματα (για παράδειγμα, ταξινόμηση κατά τμήμα, στη συνέχεια με βάση το " +"μισθολογικό κλιμάκιο κτλ)." -#: library/stdtypes.rst:1323 +#: library/stdtypes.rst:1430 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" +"Για παραδείγματα ταξινόμησης και ένα σύντομο tutorial, δείτε :ref:" +"`sortinghowto`." -#: library/stdtypes.rst:1327 +#: library/stdtypes.rst:1434 msgid "" "While a list is being sorted, the effect of attempting to mutate, or even " "inspect, the list is undefined. The C implementation of Python makes the " "list appear empty for the duration, and raises :exc:`ValueError` if it can " "detect that the list has been mutated during a sort." msgstr "" +"Ενώ μια λίστα ταξινομείται, το αποτέλεσμα της προσπάθειας μετάλλαξης, ή " +"ακόμα και η επιθεώρηση, της λίστας είναι απροσδιόριστη. Η υλοποίηση της " +"Python στη C κάνει την λίστα να εμφανίζεται κενή για όλη τη διάρκεια, και " +"κάνει raise :exc:`ValueError` αν ανιχνεύσει ότι η λίστα έχει μεταλλαχθεί " +"κατά τη διάρκεια μιας ταξινόμησης." -#: library/stdtypes.rst:1336 +#: library/stdtypes.rst:1443 msgid "Tuples" -msgstr "" +msgstr "Πλειάδες (Tuples)" -#: library/stdtypes.rst:1340 +#: library/stdtypes.rst:1447 msgid "" "Tuples are immutable sequences, typically used to store collections of " "heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " @@ -1745,28 +2648,38 @@ msgid "" "homogeneous data is needed (such as allowing storage in a :class:`set` or :" "class:`dict` instance)." msgstr "" +"Οι πλειάδες (tuples) είναι αμετάβλητες ακολουθίες, που συνήθως " +"χρησιμοποιούνται για την αποθήκευση συλλογών ετερογενών δεδομένων (όπως οι 2-" +"tuples που παράγονται από την built-in :func:`enumerate`). Τα tuples " +"χρησιμοποιούνται επίσης για περιπτώσεις όπου μια αμετάβλητη ακολουθία " +"ομοιογενών δεδομένων (όπως για παράδειγμα για να επιτρέπεται η αποθήκευση σε " +"ένα :class:`set` ή σε ένα :class:`dict` instance)." -#: library/stdtypes.rst:1348 +#: library/stdtypes.rst:1455 msgid "Tuples may be constructed in a number of ways:" -msgstr "" +msgstr "Οι πλειάδες (tuples) μπορούν να κατασκευαστούν με διάφορους τρόπους:" -#: library/stdtypes.rst:1350 +#: library/stdtypes.rst:1457 msgid "Using a pair of parentheses to denote the empty tuple: ``()``" msgstr "" +"Χρήση ενός ζεύγους παρενθέσεων για να δηλωθεί το κενό tuple (πλειάδα): ``()``" -#: library/stdtypes.rst:1351 +#: library/stdtypes.rst:1458 msgid "Using a trailing comma for a singleton tuple: ``a,`` or ``(a,)``" msgstr "" +"Χρήση ενός κόμματος στο τέλος για ένα μοναδικό tuple (πλειάδα): ``a,`` ή " +"``(a,)``" -#: library/stdtypes.rst:1352 +#: library/stdtypes.rst:1459 msgid "Separating items with commas: ``a, b, c`` or ``(a, b, c)``" -msgstr "" +msgstr "Διαχωρισμός στοιχείων με κόμμα: ``a, b, c`` ή ``(a, b, c)``" -#: library/stdtypes.rst:1353 +#: library/stdtypes.rst:1460 msgid "Using the :func:`tuple` built-in: ``tuple()`` or ``tuple(iterable)``" msgstr "" +"Χρήση του ενσωματωμένου :func:`tuple`: ``tuple()`` ή ``tuple(iterable)``" -#: library/stdtypes.rst:1355 +#: library/stdtypes.rst:1462 msgid "" "The constructor builds a tuple whose items are the same and in the same " "order as *iterable*'s items. *iterable* may be either a sequence, a " @@ -1776,8 +2689,16 @@ msgid "" "3)``. If no argument is given, the constructor creates a new empty tuple, " "``()``." msgstr "" +"Ο κατασκευαστής (constructor) δημιουργεί μια πλειάδα (tuple) του οποίου τα " +"στοιχεία είναι τα ίδια και στην ίδια σειρά με τα στοιχεία του *iterable*. Η " +"*iterable* μπορεί να είναι είτε μια ακολουθία, είτε έναν container που " +"υποστηρίζει την επανάληψη, ή ένα αντικείμενο iterator. Εάν το *iterable* " +"είναι ήδη ένα tuple, επιστρέφεται αμετάβλητο. Για παράδειγμα, το " +"``tuple('abc')`` επιστρέφει ``('a', 'b', 'c')`` και το ``tuple( [1, 2, " +"3] )`` επιστρέφει ``(1, 2, 3)``. Αν δεν δοθεί κανένα όρισμα, ο κατασκευαστής " +"δημιουργεί μια ένα κενό tuple, ``()``." -#: library/stdtypes.rst:1363 +#: library/stdtypes.rst:1470 msgid "" "Note that it is actually the comma which makes a tuple, not the parentheses. " "The parentheses are optional, except in the empty tuple case, or when they " @@ -1785,31 +2706,46 @@ msgid "" "function call with three arguments, while ``f((a, b, c))`` is a function " "call with a 3-tuple as the sole argument." msgstr "" +"Σημειώστε ότι στην πραγματικότητα το κόμμα είναι αυτό που κάνει ένα tuple " +"(πλειάδα), όχι οι παρενθέσεις. Οι παρενθέσεις είναι προαιρετικές, εκτός από " +"την περίπτωση κενού tuple ή όταν χρειάζονται για την αποφυγή συντακτικής " +"ασάφειας. Για παράδειγμα, η ``f(a, b, c)`` είναι μια κλήση συνάρτησης με " +"τρία ορίσματα, ενώ η ``f((a, b, c))`` είναι μια συνάρτηση κλήση συνάρτησης " +"με ένα 3-tuple ως μοναδικό όρισμα." -#: library/stdtypes.rst:1369 +#: library/stdtypes.rst:1476 msgid "" "Tuples implement all of the :ref:`common ` sequence " "operations." msgstr "" +"Τα Tuples υλοποιούν όλες τις πράξεις ακολουθιών :ref:`common `." -#: library/stdtypes.rst:1372 +#: library/stdtypes.rst:1479 msgid "" "For heterogeneous collections of data where access by name is clearer than " "access by index, :func:`collections.namedtuple` may be a more appropriate " "choice than a simple tuple object." msgstr "" +"Για ετερογενείς συλλογές δεδομένων όπου η πρόσβαση με βάση το όνομα είναι " +"σαφέστερη από την πρόσβαση με βάση το δείκτη, το :func:`collections." +"namedtuple` μπορεί να είναι μια πιο κατάλληλη επιλογή από ένα απλό " +"αντικείμενο tuple (πλειάδα)." -#: library/stdtypes.rst:1380 +#: library/stdtypes.rst:1487 msgid "Ranges" -msgstr "" +msgstr "Εύρη (Ranges)" -#: library/stdtypes.rst:1384 +#: library/stdtypes.rst:1491 msgid "" "The :class:`range` type represents an immutable sequence of numbers and is " "commonly used for looping a specific number of times in :keyword:`for` loops." msgstr "" +"Ο τύπος :class:`range` αναπαριστά μια αμετάβλητη ακολουθία αριθμών και " +"συνήθως χρησιμοποιείται για την επανάληψη ενός συγκεκριμένου αριθμού " +"επαναλήψεων σε βρόχους :keyword:`for`." -#: library/stdtypes.rst:1391 +#: library/stdtypes.rst:1498 msgid "" "The arguments to the range constructor must be integers (either built-in :" "class:`int` or any object that implements the :meth:`~object.__index__` " @@ -1817,63 +2753,118 @@ msgid "" "If the *start* argument is omitted, it defaults to ``0``. If *step* is " "zero, :exc:`ValueError` is raised." msgstr "" +"Τα ορίσματα του κατασκευαστή εύρους (range constructor) πρέπει να είναι " +"ακέραιοι αριθμοί (είτε της built-in :class:`int` ή οποιοδήποτε αντικείμενο " +"που υλοποιεί την ειδική μέθοδο :meth:`~object.__index__`). Εάν το όρισμα " +"*step* παραλείπεται, το προεπιλογή (default) είναι ``1``. Εάν το όρισμα " +"*start* παραλείπεται, το προεπιλογή (default) είναι ``0``. Εάν το *step* " +"είναι μηδέν, γίνεται raise ένα :exc:`ValueError`." -#: library/stdtypes.rst:1397 +#: library/stdtypes.rst:1504 msgid "" "For a positive *step*, the contents of a range ``r`` are determined by the " "formula ``r[i] = start + step*i`` where ``i >= 0`` and ``r[i] < stop``." msgstr "" +"Για ένα θετικό *βήμα*, τα περιεχόμενα του range (εύρους) ``r`` καθορίζονται " +"από τον τύπο ``r[i] = start + step*i`` όπου ``i >= 0`` και ``r[i] < stop``." -#: library/stdtypes.rst:1401 +#: library/stdtypes.rst:1508 msgid "" "For a negative *step*, the contents of the range are still determined by the " "formula ``r[i] = start + step*i``, but the constraints are ``i >= 0`` and " "``r[i] > stop``." msgstr "" +"Για ένα αρνητικό *βήμα*, τα περιεχόμενα του εύρους (range) εξακολουθούν να " +"καθορίζονται από τον τύπο ``r[i] = start + step*i``, αλλά οι περιορισμοί " +"είναι ``i >= 0`` και ``r[i] > stop``." -#: library/stdtypes.rst:1405 +#: library/stdtypes.rst:1512 msgid "" "A range object will be empty if ``r[0]`` does not meet the value constraint. " "Ranges do support negative indices, but these are interpreted as indexing " "from the end of the sequence determined by the positive indices." msgstr "" +"Ένα αντικείμενο range θα είναι άδειο εάν το ``r[0]`` δεν πληροί τον " +"περιορισμό τιμής. Τα ranges υποστηρίζουν αρνητικούς δείκτες, αλλά αυτοί " +"ερμηνεύονται ως δείκτες από το τέλος της ακολουθίας που καθορίζεται από τους " +"θετικούς δείκτες." -#: library/stdtypes.rst:1410 +#: library/stdtypes.rst:1517 msgid "" "Ranges containing absolute values larger than :data:`sys.maxsize` are " "permitted but some features (such as :func:`len`) may raise :exc:" "`OverflowError`." msgstr "" +"Τα ranges που περιέχουν απόλυτες τιμές μεγαλύτερες από :data:`sys.maxsize` " +"είναι επιτρεπτά, αλλά ορισμένα χαρακτηριστικά (όπως :func:`len`) μπορεί να " +"κάνουν raise :exc:`OverflowError`." -#: library/stdtypes.rst:1414 +#: library/stdtypes.rst:1521 msgid "Range examples::" -msgstr "" - -#: library/stdtypes.rst:1431 +msgstr "Παραδείγματα Range::" + +#: library/stdtypes.rst:1523 +msgid "" +">>> list(range(10))\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n" +">>> list(range(1, 11))\n" +"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" +">>> list(range(0, 30, 5))\n" +"[0, 5, 10, 15, 20, 25]\n" +">>> list(range(0, 10, 3))\n" +"[0, 3, 6, 9]\n" +">>> list(range(0, -10, -1))\n" +"[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n" +">>> list(range(0))\n" +"[]\n" +">>> list(range(1, 0))\n" +"[]" +msgstr "" +">>> list(range(10))\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n" +">>> list(range(1, 11))\n" +"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" +">>> list(range(0, 30, 5))\n" +"[0, 5, 10, 15, 20, 25]\n" +">>> list(range(0, 10, 3))\n" +"[0, 3, 6, 9]\n" +">>> list(range(0, -10, -1))\n" +"[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n" +">>> list(range(0))\n" +"[]\n" +">>> list(range(1, 0))\n" +"[]" + +#: library/stdtypes.rst:1538 msgid "" "Ranges implement all of the :ref:`common ` sequence " "operations except concatenation and repetition (due to the fact that range " "objects can only represent sequences that follow a strict pattern and " "repetition and concatenation will usually violate that pattern)." msgstr "" +"Τα ranges υλοποιούν όλες τις ακολουθίες :ref:`common ` " +"εκτός από τη συνένωση και την επανάληψη (λόγω του γεγονότος ότι τα range " +"αντικείμενα μπορούν να αναπαριστούν μόνο ακολουθίες που ακολουθούν ένα " +"αυστηρό μοτίβο και η επανάληψη και η συνένωση συνήθως παραβιάζουν αυτό το " +"πρότυπο)." -#: library/stdtypes.rst:1438 +#: library/stdtypes.rst:1545 msgid "" "The value of the *start* parameter (or ``0`` if the parameter was not " "supplied)" -msgstr "" +msgstr "Η τιμή της παραμέτρου *start* (ή ``0`` αν η παράμετρος δεν παρέχεται)" -#: library/stdtypes.rst:1443 +#: library/stdtypes.rst:1550 msgid "The value of the *stop* parameter" -msgstr "" +msgstr "Η τιμή της παραμέτρου *stop*" -#: library/stdtypes.rst:1447 +#: library/stdtypes.rst:1554 msgid "" "The value of the *step* parameter (or ``1`` if the parameter was not " "supplied)" -msgstr "" +msgstr "Η τιμή της παραμέτρου *step* (ή ``1`` αν η παράμετρος δεν παρέχεται)" -#: library/stdtypes.rst:1450 +#: library/stdtypes.rst:1557 msgid "" "The advantage of the :class:`range` type over a regular :class:`list` or :" "class:`tuple` is that a :class:`range` object will always take the same " @@ -1881,15 +2872,24 @@ msgid "" "it only stores the ``start``, ``stop`` and ``step`` values, calculating " "individual items and subranges as needed)." msgstr "" +"Το πλεονέκτημα του τύπου :class:`range` έναντι ενός κανονικού τύπου :class:" +"`list` ή :class:`tuple` είναι ότι ένα αντικείμενο :class:`range` θα παίρνει " +"πάντα το ίδιο (μικρό) ποσό μνήμης, ανεξάρτητα από το μέγεθος του range που " +"αντιπροσωπεύει (μιας και αποθηκεύει μόνο τις τιμές ``start``, ``stop`` και " +"``step``, υπολογίζοντας τα μεμονωμένα στοιχεία και τις υποπεριοχές όπως " +"απαιτείται)." -#: library/stdtypes.rst:1456 +#: library/stdtypes.rst:1563 msgid "" "Range objects implement the :class:`collections.abc.Sequence` ABC, and " "provide features such as containment tests, element index lookup, slicing " "and support for negative indices (see :ref:`typesseq`):" msgstr "" +"Τα αντικείμενα range υλοποιούν την :class:`collections.abc.Sequence` ABC, " +"και παρέχουν χαρακτηριστικά όπως δοκιμές περιορισμού, αναζήτηση δείκτη " +"στοιχείου, τεμαχισμό και υποστήριξη αρνητικών δεικτών (βλ. :ref:`typesseq`):" -#: library/stdtypes.rst:1476 +#: library/stdtypes.rst:1583 msgid "" "Testing range objects for equality with ``==`` and ``!=`` compares them as " "sequences. That is, two range objects are considered equal if they " @@ -1898,196 +2898,678 @@ msgid "" "and :attr:`~range.step` attributes, for example ``range(0) == range(2, 1, " "3)`` or ``range(0, 3, 2) == range(0, 4, 2)``.)" msgstr "" +"Ο έλεγχος των αντικειμένων range για ισότητα με ``==`` και ``!=`` τα " +"συγκρίνει ως ακολουθίες. Δηλαδή, δύο αντικείμενα range θεωρούνται ίσα αν " +"αντιπροσωπεύουν την ίδια ακολουθία τιμών. (Σημειώστε ότι δύο αντικείμενα " +"range που συγκρίνονται ως ίσα μπορεί να έχουν διαφορετικά :attr:`~range." +"start`, :attr:`~range.stop` και :attr:`~range.step` χαρακτηριστικά, για " +"παράδειγμα ``range(0) == range(2, 1, 3)`` ή ``range(0, 3, 2) == range(0, 4, " +"2)``.)" -#: library/stdtypes.rst:1483 +#: library/stdtypes.rst:1590 msgid "" "Implement the Sequence ABC. Support slicing and negative indices. Test :" "class:`int` objects for membership in constant time instead of iterating " "through all items." msgstr "" +"Υλοποιείστε την ακολουθία ABC. Υποστηρίξτε την τμηματοποίηση και τους " +"αρνητικούς δείκτες. Δοκιμάστε τα :class:`int` αντικείμενα για συμμετοχή σε " +"σταθερό χρόνο αντί της επανάληψης σε όλα τα αντικείμενα." -#: library/stdtypes.rst:1489 +#: library/stdtypes.rst:1596 msgid "" "Define '==' and '!=' to compare range objects based on the sequence of " "values they define (instead of comparing based on object identity)." msgstr "" +"Ορίστε τα '==' και '!=' για να συγκρίνετε αντικείμενα range με βάση την " +"ακολουθία των τιμών που ορίζουν (αντί να συγκρίνουν με βάση την ταυτότητα " +"του αντικειμένου)." -#: library/stdtypes.rst:1494 +#: library/stdtypes.rst:1601 msgid "" "Added the :attr:`~range.start`, :attr:`~range.stop` and :attr:`~range.step` " "attributes." msgstr "" +"Προστέθηκαν τα :attr:`~range.start`, :attr:`~range.stop` και :attr:`~range." +"step` attributes." -#: library/stdtypes.rst:1499 +#: library/stdtypes.rst:1606 msgid "" -"The `linspace recipe `_ shows " -"how to implement a lazy version of range suitable for floating point " -"applications." +"The `linspace recipe `_ shows how to implement a lazy version of range " +"suitable for floating-point applications." msgstr "" +"Η συνταγή `linspace `_ δείχνει πώς να υλοποιήσετε μια lazy έκδοση του " +"range κατάλληλη για εφαρμογές κινητής υποδιαστολής." -#: library/stdtypes.rst:1511 -msgid "Text Sequence Type --- :class:`str`" -msgstr "" +#: library/stdtypes.rst:1618 +msgid "Text and Binary Sequence Type Methods Summary" +msgstr "Σύνοψη μεθόδων τύπου κειμένου και δυαδική ακολουθίας" -#: library/stdtypes.rst:1513 +#: library/stdtypes.rst:1619 msgid "" -"Textual data in Python is handled with :class:`str` objects, or :dfn:" -"`strings`. Strings are immutable :ref:`sequences ` of Unicode code " -"points. String literals are written in a variety of ways:" +"The following table summarizes the text and binary sequence types methods by " +"category." msgstr "" +"Ο παρακάτω πίνακας συνοψίζει τις μεθόδους τύπων κειμένου και δυαδική " +"ακολουθίας ανά κατηγορία." -#: library/stdtypes.rst:1518 -msgid "Single quotes: ``'allows embedded \"double\" quotes'``" -msgstr "" +#: library/stdtypes.rst:1624 +msgid "Category" +msgstr "Κατηγορία" -#: library/stdtypes.rst:1519 -msgid "Double quotes: ``\"allows embedded 'single' quotes\"``" -msgstr "" +#: library/stdtypes.rst:1624 +msgid ":class:`str` methods" +msgstr ":class:`str` methods" -#: library/stdtypes.rst:1520 -msgid "" -"Triple quoted: ``'''Three single quotes'''``, ``\"\"\"Three double " -"quotes\"\"\"``" -msgstr "" +#: library/stdtypes.rst:1624 +msgid ":class:`bytes` and :class:`bytearray` methods" +msgstr "οι μέθοδοι :class:`bytes` και :class:`bytearray`" -#: library/stdtypes.rst:1522 -msgid "" -"Triple quoted strings may span multiple lines - all associated whitespace " -"will be included in the string literal." -msgstr "" +#: library/stdtypes.rst:1626 +msgid "Formatting" +msgstr "Μορφοποίηση" -#: library/stdtypes.rst:1525 -msgid "" -"String literals that are part of a single expression and have only " -"whitespace between them will be implicitly converted to a single string " -"literal. That is, ``(\"spam \" \"eggs\") == \"spam eggs\"``." -msgstr "" +#: library/stdtypes.rst:1626 +msgid ":meth:`str.format`" +msgstr ":meth:`str.format`" -#: library/stdtypes.rst:1529 -msgid "" -"See :ref:`strings` for more about the various forms of string literal, " -"including supported :ref:`escape sequences `, and the " -"``r`` (\"raw\") prefix that disables most escape sequence processing." -msgstr "" +#: library/stdtypes.rst:1628 +msgid ":meth:`str.format_map`" +msgstr ":meth:`str.format_map`" -#: library/stdtypes.rst:1533 -msgid "" -"Strings may also be created from other objects using the :class:`str` " -"constructor." -msgstr "" +#: library/stdtypes.rst:1630 +msgid ":ref:`f-strings`" +msgstr ":ref:`f-strings`" -#: library/stdtypes.rst:1536 -msgid "" -"Since there is no separate \"character\" type, indexing a string produces " -"strings of length 1. That is, for a non-empty string *s*, ``s[0] == s[0:1]``." -msgstr "" +#: library/stdtypes.rst:1632 +msgid ":ref:`old-string-formatting`" +msgstr ":ref:`old-string-formatting`" -#: library/stdtypes.rst:1542 -msgid "" -"There is also no mutable string type, but :meth:`str.join` or :class:`io." -"StringIO` can be used to efficiently construct strings from multiple " -"fragments." -msgstr "" +#: library/stdtypes.rst:1632 +msgid ":ref:`bytes-formatting`" +msgstr ":ref:`bytes-formatting`" -#: library/stdtypes.rst:1546 -msgid "" -"For backwards compatibility with the Python 2 series, the ``u`` prefix is " -"once again permitted on string literals. It has no effect on the meaning of " -"string literals and cannot be combined with the ``r`` prefix." -msgstr "" +#: library/stdtypes.rst:1634 +msgid "Searching and Replacing" +msgstr "Αναζήτηση και Αντικατάσταση" -#: library/stdtypes.rst:1558 -msgid "" -"Return a :ref:`string ` version of *object*. If *object* is not " -"provided, returns the empty string. Otherwise, the behavior of ``str()`` " -"depends on whether *encoding* or *errors* is given, as follows." -msgstr "" +#: library/stdtypes.rst:1634 +msgid ":meth:`str.find`" +msgstr ":meth:`str.find`" -#: library/stdtypes.rst:1562 -msgid "" -"If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" -"`type(object).__str__(object) `, which is the \"informal\" " -"or nicely printable string representation of *object*. For string objects, " -"this is the string itself. If *object* does not have a :meth:`~object." -"__str__` method, then :func:`str` falls back to returning :func:" -"`repr(object) `." -msgstr "" +#: library/stdtypes.rst:1634 +msgid ":meth:`str.rfind`" +msgstr ":meth:`str.rfind`" -#: library/stdtypes.rst:1574 -msgid "" -"If at least one of *encoding* or *errors* is given, *object* should be a :" -"term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " -"this case, if *object* is a :class:`bytes` (or :class:`bytearray`) object, " -"then ``str(bytes, encoding, errors)`` is equivalent to :meth:`bytes." -"decode(encoding, errors) `. Otherwise, the bytes object " -"underlying the buffer object is obtained before calling :meth:`bytes." -"decode`. See :ref:`binaryseq` and :ref:`bufferobjects` for information on " -"buffer objects." -msgstr "" +#: library/stdtypes.rst:1634 +msgid ":meth:`bytes.find`" +msgstr ":meth:`bytes.find`" -#: library/stdtypes.rst:1583 -msgid "" -"Passing a :class:`bytes` object to :func:`str` without the *encoding* or " -"*errors* arguments falls under the first case of returning the informal " -"string representation (see also the :option:`-b` command-line option to " -"Python). For example::" -msgstr "" +#: library/stdtypes.rst:1634 +msgid ":meth:`bytes.rfind`" +msgstr ":meth:`bytes.rfind`" -#: library/stdtypes.rst:1591 -msgid "" -"For more information on the ``str`` class and its methods, see :ref:" -"`textseq` and the :ref:`string-methods` section below. To output formatted " -"strings, see the :ref:`f-strings` and :ref:`formatstrings` sections. In " -"addition, see the :ref:`stringservices` section." -msgstr "" +#: library/stdtypes.rst:1636 +msgid ":meth:`str.index`" +msgstr ":meth:`str.index`" -#: library/stdtypes.rst:1603 -msgid "String Methods" -msgstr "" +#: library/stdtypes.rst:1636 +msgid ":meth:`str.rindex`" +msgstr ":meth:`str.rindex`" -#: library/stdtypes.rst:1608 -msgid "" -"Strings implement all of the :ref:`common ` sequence " -"operations, along with the additional methods described below." -msgstr "" +#: library/stdtypes.rst:1636 +msgid ":meth:`bytes.index`" +msgstr ":meth:`bytes.index`" -#: library/stdtypes.rst:1611 -msgid "" -"Strings also support two styles of string formatting, one providing a large " -"degree of flexibility and customization (see :meth:`str.format`, :ref:" -"`formatstrings` and :ref:`string-formatting`) and the other based on C " -"``printf`` style formatting that handles a narrower range of types and is " -"slightly harder to use correctly, but is often faster for the cases it can " -"handle (:ref:`old-string-formatting`)." -msgstr "" +#: library/stdtypes.rst:1636 +msgid ":meth:`bytes.rindex`" +msgstr ":meth:`bytes.rindex`" -#: library/stdtypes.rst:1618 -msgid "" -"The :ref:`textservices` section of the standard library covers a number of " -"other modules that provide various text related utilities (including regular " +#: library/stdtypes.rst:1638 +msgid ":meth:`str.startswith`" +msgstr ":meth:`str.startswith`" + +#: library/stdtypes.rst:1638 +msgid ":meth:`bytes.startswith`" +msgstr ":meth:`bytes.startswith`" + +#: library/stdtypes.rst:1640 +msgid ":meth:`str.endswith`" +msgstr ":meth:`str.endswith`" + +#: library/stdtypes.rst:1640 +msgid ":meth:`bytes.endswith`" +msgstr ":meth:`bytes.endswith`" + +#: library/stdtypes.rst:1642 +msgid ":meth:`str.count`" +msgstr ":meth:`str.count`" + +#: library/stdtypes.rst:1642 +msgid ":meth:`bytes.count`" +msgstr ":meth:`bytes.count`" + +#: library/stdtypes.rst:1644 +msgid ":meth:`str.replace`" +msgstr ":meth:`str.replace`" + +#: library/stdtypes.rst:1644 +msgid ":meth:`bytes.replace`" +msgstr ":meth:`bytes.replace`" + +#: library/stdtypes.rst:1646 +msgid "Splitting and Joining" +msgstr "Διαχωρισμός και Ένωση" + +#: library/stdtypes.rst:1646 +msgid ":meth:`str.split`" +msgstr ":meth:`str.split`" + +#: library/stdtypes.rst:1646 +msgid ":meth:`str.rsplit`" +msgstr ":meth:`str.rsplit`" + +#: library/stdtypes.rst:1646 +msgid ":meth:`bytes.split`" +msgstr ":meth:`bytes.split`" + +#: library/stdtypes.rst:1646 +msgid ":meth:`bytes.rsplit`" +msgstr ":meth:`bytes.rsplit`" + +#: library/stdtypes.rst:1648 +msgid ":meth:`str.splitlines`" +msgstr ":meth:`str.splitlines`" + +#: library/stdtypes.rst:1648 +msgid ":meth:`bytes.splitlines`" +msgstr ":meth:`bytes.splitlines`" + +#: library/stdtypes.rst:1650 +msgid ":meth:`str.partition`" +msgstr ":meth:`str.partition`" + +#: library/stdtypes.rst:1650 +msgid ":meth:`bytes.partition`" +msgstr ":meth:`bytes.partition`" + +#: library/stdtypes.rst:1652 +msgid ":meth:`str.rpartition`" +msgstr ":meth:`str.rpartition`" + +#: library/stdtypes.rst:1652 +msgid ":meth:`bytes.rpartition`" +msgstr ":meth:`bytes.rpartition`" + +#: library/stdtypes.rst:1654 +msgid ":meth:`str.join`" +msgstr ":meth:`str.join`" + +#: library/stdtypes.rst:1654 +msgid ":meth:`bytes.join`" +msgstr ":meth:`bytes.join`" + +#: library/stdtypes.rst:1656 +msgid "String Classification" +msgstr "Ταξινόμηση Συμβολοσειρών" + +#: library/stdtypes.rst:1656 +msgid ":meth:`str.isalpha`" +msgstr ":meth:`str.isalpha`" + +#: library/stdtypes.rst:1656 +msgid ":meth:`bytes.isalpha`" +msgstr ":meth:`bytes.isalpha`" + +#: library/stdtypes.rst:1658 +msgid ":meth:`str.isdecimal`" +msgstr ":meth:`str.isdecimal`" + +#: library/stdtypes.rst:1660 +msgid ":meth:`str.isdigit`" +msgstr ":meth:`str.isdigit`" + +#: library/stdtypes.rst:1660 +msgid ":meth:`bytes.isdigit`" +msgstr ":meth:`bytes.isdigit`" + +#: library/stdtypes.rst:1662 +msgid ":meth:`str.isnumeric`" +msgstr ":meth:`str.isnumeric`" + +#: library/stdtypes.rst:1664 +msgid ":meth:`str.isalnum`" +msgstr ":meth:`str.isalnum`" + +#: library/stdtypes.rst:1664 +msgid ":meth:`bytes.isalnum`" +msgstr ":meth:`bytes.isalnum`" + +#: library/stdtypes.rst:1666 +msgid ":meth:`str.isidentifier`" +msgstr ":meth:`str.isidentifier`" + +#: library/stdtypes.rst:1668 +msgid ":meth:`str.islower`" +msgstr ":meth:`str.islower`" + +#: library/stdtypes.rst:1668 +msgid ":meth:`bytes.islower`" +msgstr ":meth:`bytes.islower`" + +#: library/stdtypes.rst:1670 +msgid ":meth:`str.isupper`" +msgstr ":meth:`str.isupper`" + +#: library/stdtypes.rst:1670 +msgid ":meth:`bytes.isupper`" +msgstr ":meth:`bytes.isupper`" + +#: library/stdtypes.rst:1672 +msgid ":meth:`str.istitle`" +msgstr ":meth:`str.istitle`" + +#: library/stdtypes.rst:1672 +msgid ":meth:`bytes.istitle`" +msgstr ":meth:`bytes.istitle`" + +#: library/stdtypes.rst:1674 +msgid ":meth:`str.isspace`" +msgstr ":meth:`str.isspace`" + +#: library/stdtypes.rst:1674 +msgid ":meth:`bytes.isspace`" +msgstr ":meth:`bytes.isspace`" + +#: library/stdtypes.rst:1676 +msgid ":meth:`str.isprintable`" +msgstr ":meth:`str.isprintable`" + +#: library/stdtypes.rst:1678 +msgid "Case Manipulation" +msgstr "Χειρισμός υποθέσεων" + +#: library/stdtypes.rst:1678 +msgid ":meth:`str.lower`" +msgstr ":meth:`str.lower`" + +#: library/stdtypes.rst:1678 +msgid ":meth:`bytes.lower`" +msgstr ":meth:`bytes.lower`" + +#: library/stdtypes.rst:1680 +msgid ":meth:`str.upper`" +msgstr ":meth:`str.upper`" + +#: library/stdtypes.rst:1680 +msgid ":meth:`bytes.upper`" +msgstr ":meth:`bytes.upper`" + +#: library/stdtypes.rst:1682 +msgid ":meth:`str.casefold`" +msgstr ":meth:`str.casefold`" + +#: library/stdtypes.rst:1684 +msgid ":meth:`str.capitalize`" +msgstr ":meth:`str.capitalize`" + +#: library/stdtypes.rst:1684 +msgid ":meth:`bytes.capitalize`" +msgstr ":meth:`bytes.capitalize`" + +#: library/stdtypes.rst:1686 +msgid ":meth:`str.title`" +msgstr ":meth:`str.title`" + +#: library/stdtypes.rst:1686 +msgid ":meth:`bytes.title`" +msgstr ":meth:`bytes.title`" + +#: library/stdtypes.rst:1688 +msgid ":meth:`str.swapcase`" +msgstr ":meth:`str.swapcase`" + +#: library/stdtypes.rst:1688 +msgid ":meth:`bytes.swapcase`" +msgstr ":meth:`bytes.swapcase`" + +#: library/stdtypes.rst:1690 +msgid "Padding and Stripping" +msgstr "Συμπλήρωση και Αφαίρεση" + +#: library/stdtypes.rst:1690 +msgid ":meth:`str.ljust`" +msgstr ":meth:`str.ljust`" + +#: library/stdtypes.rst:1690 +msgid ":meth:`str.rjust`" +msgstr ":meth:`str.rjust`" + +#: library/stdtypes.rst:1690 +msgid ":meth:`bytes.ljust`" +msgstr ":meth:`bytes.ljust`" + +#: library/stdtypes.rst:1690 +msgid ":meth:`bytes.rjust`" +msgstr ":meth:`bytes.rjust`" + +#: library/stdtypes.rst:1692 +msgid ":meth:`str.center`" +msgstr ":meth:`str.center`" + +#: library/stdtypes.rst:1692 +msgid ":meth:`bytes.center`" +msgstr ":meth:`bytes.center`" + +#: library/stdtypes.rst:1694 +msgid ":meth:`str.expandtabs`" +msgstr ":meth:`str.expandtabs`" + +#: library/stdtypes.rst:1694 +msgid ":meth:`bytes.expandtabs`" +msgstr ":meth:`bytes.expandtabs`" + +#: library/stdtypes.rst:1696 +msgid ":meth:`str.strip`" +msgstr ":meth:`str.strip`" + +#: library/stdtypes.rst:1696 +msgid ":meth:`bytes.strip`" +msgstr ":meth:`bytes.strip`" + +#: library/stdtypes.rst:1698 +msgid ":meth:`str.lstrip`" +msgstr ":meth:`str.lstrip`" + +#: library/stdtypes.rst:1698 +msgid ":meth:`str.rstrip`" +msgstr ":meth:`str.rstrip`" + +#: library/stdtypes.rst:1698 +msgid ":meth:`bytes.lstrip`" +msgstr ":meth:`bytes.lstrip`" + +#: library/stdtypes.rst:1698 +msgid ":meth:`bytes.rstrip`" +msgstr ":meth:`bytes.rstrip`" + +#: library/stdtypes.rst:1700 +msgid "Translation and Encoding" +msgstr "Μετάφραση και Κωδικοποίηση" + +#: library/stdtypes.rst:1700 +msgid ":meth:`str.translate`" +msgstr ":meth:`str.translate`" + +#: library/stdtypes.rst:1700 +msgid ":meth:`bytes.translate`" +msgstr ":meth:`bytes.translate`" + +#: library/stdtypes.rst:1702 +msgid ":meth:`str.maketrans`" +msgstr ":meth:`str.maketrans`" + +#: library/stdtypes.rst:1702 +msgid ":meth:`bytes.maketrans`" +msgstr ":meth:`bytes.maketrans`" + +#: library/stdtypes.rst:1704 +msgid ":meth:`str.encode`" +msgstr ":meth:`str.encode`" + +#: library/stdtypes.rst:1706 +msgid ":meth:`bytes.decode`" +msgstr ":meth:`bytes.decode`" + +#: library/stdtypes.rst:1712 +msgid "Text Sequence Type --- :class:`str`" +msgstr "Τύπος Ακολουθίας (Sequence) Κειμένου --- :class:`str`" + +#: library/stdtypes.rst:1714 +msgid "" +"Textual data in Python is handled with :class:`str` objects, or :dfn:" +"`strings`. Strings are immutable :ref:`sequences ` of Unicode code " +"points. String literals are written in a variety of ways:" +msgstr "" +"Τα δεδομένα κειμένου στην Python αντιμετωπίζονται με αντικείμενα :class:" +"`str` ή :dfn:`strings`. Τα αλφαριθμητικά (strings) είναι αμετάβλητες :ref:" +"`sequences ` των Unicode points. Τα αλφαριθμητικά γράφονται με " +"διάφορους τρόπους:" + +#: library/stdtypes.rst:1719 +msgid "Single quotes: ``'allows embedded \"double\" quotes'``" +msgstr "Απλά εισαγωγικά: ``'allows embedded \"double\" quotes'``" + +#: library/stdtypes.rst:1720 +msgid "Double quotes: ``\"allows embedded 'single' quotes\"``" +msgstr "Διπλά εισαγωγικά: ``'allows embedded \"double\" quotes'``" + +#: library/stdtypes.rst:1721 +msgid "" +"Triple quoted: ``'''Three single quotes'''``, ``\"\"\"Three double " +"quotes\"\"\"``" +msgstr "" +"Τριπλά εισαγωγικά: ``'''Three single quotes'''``, ``\"\"\"Three double " +"quotes\"\"\"``" + +#: library/stdtypes.rst:1723 +msgid "" +"Triple quoted strings may span multiple lines - all associated whitespace " +"will be included in the string literal." +msgstr "" +"Τα αλφαριθμητικά σε τριπλά εισαγωγικά μπορούν να καλύπτουν πολλές γραμμές - " +"όλα τα σχετικά κενά θα συμπεριληφθούν στο αλφαριθμητικό." + +#: library/stdtypes.rst:1726 +msgid "" +"String literals that are part of a single expression and have only " +"whitespace between them will be implicitly converted to a single string " +"literal. That is, ``(\"spam \" \"eggs\") == \"spam eggs\"``." +msgstr "" +"Τα Αλφαριθμητικά (strings) που αποτελούν μέρος μιας ενιαίας έκφρασης και " +"έχουν μόνο κενά μεταξύ τους, θα μετατραπούν σιωπηρά σε ένα ενιαίο " +"αλφαριθμητικό literal. Δηλαδή, ``(\"spam \" \"eggs\") == \"spam eggs\"``." + +#: library/stdtypes.rst:1730 +msgid "" +"See :ref:`strings` for more about the various forms of string literal, " +"including supported :ref:`escape sequences `, and the " +"``r`` (\"raw\") prefix that disables most escape sequence processing." +msgstr "" +"Δείτε τα :ref:`strings` για περισσότερες πληροφορίες σχετικά με τις διάφορες " +"μορφές των αλφαριθμητικών, συμπεριλαμβανομένων των υποστηριζόμενων " +"ακολουθιών :ref:`escape sequences `, και του ``r`` " +"(\"raw\") πρόθεμα που απενεργοποιεί την επεξεργασία των περισσότερων " +"ακολουθιών διαφυγής." + +#: library/stdtypes.rst:1734 +msgid "" +"Strings may also be created from other objects using the :class:`str` " +"constructor." +msgstr "" +"Τα αλφαριθμητικά (strings) μπορούν επίσης να δημιουργηθούν από άλλα " +"αντικείμενα χρησιμοποιώντας τον constructor :class:`str`." + +#: library/stdtypes.rst:1737 +msgid "" +"Since there is no separate \"character\" type, indexing a string produces " +"strings of length 1. That is, for a non-empty string *s*, ``s[0] == s[0:1]``." +msgstr "" +"Εφόσον δεν υπάρχει ξεχωριστός τύπος \"character\", το indexing μιας " +"συμβολοσειράς (string) παράγει συμβολοσειρές μήκους 1. Δηλαδή, για μια μη " +"κενή συμβολοσειρά *s*, ``s[0] == s[0:1]``." + +#: library/stdtypes.rst:1743 +msgid "" +"There is also no mutable string type, but :meth:`str.join` or :class:`io." +"StringIO` can be used to efficiently construct strings from multiple " +"fragments." +msgstr "" +"Δεν υπάρχει επίσης μεταβλητός τύπος συμβολοσειράς (string), αλλά το :meth:" +"`str.join` ή το :class:`io.StringIO` μπορεί να χρησιμοποιηθεί για την " +"αποτελεσματική κατασκευή συμβολοσειρών από πολλαπλά μέρη." + +#: library/stdtypes.rst:1747 +msgid "" +"For backwards compatibility with the Python 2 series, the ``u`` prefix is " +"once again permitted on string literals. It has no effect on the meaning of " +"string literals and cannot be combined with the ``r`` prefix." +msgstr "" +"Για συμβατότητα προς τα πίσω (backwards compatibility) με τη σειρά Python 2, " +"το πρόθεμα ``u`` είναι επιτρεπτό και πάλι σε αλφαριθμητικά. Δεν έχει καμία " +"επίδραση στη σημασία των αλφαριθμητικών και δεν μπορεί να συνδυαστεί με το " +"πρόθεμα ``r``." + +#: library/stdtypes.rst:1761 +msgid "" +"Return a :ref:`string ` version of *object*. If *object* is not " +"provided, returns the empty string. Otherwise, the behavior of ``str()`` " +"depends on whether *encoding* or *errors* is given, as follows." +msgstr "" +"Επιστρέφει μια έκδοση :ref:`string ` του *object*. Αν το *object* " +"δεν παρέχεται, επιστρέφει κενό αλφαριθμητικό. Διαφορετικά, η συμπεριφορά " +"της ``str()`` εξαρτάται από το αν δίνεται *encoding* ή *errors*, ως εξής." + +#: library/stdtypes.rst:1765 +msgid "" +"If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" +"`type(object).__str__(object) `, which is the \"informal\" " +"or nicely printable string representation of *object*. For string objects, " +"this is the string itself. If *object* does not have a :meth:`~object." +"__str__` method, then :func:`str` falls back to returning :func:" +"`repr(object) `." +msgstr "" +"Αν δεν έχει δοθεί ούτε *encoding* ούτε *errors*, το ``str(object)`` " +"επιστρέφει :meth:`type(object).__str__(object) `, το οποίο " +"είναι το \"informal\" ή ωραία εκτυπώσιμη αναπαράσταση συμβολοσειράς (string) " +"του *object*. Για αντικείμενα συμβολοσειράς, είναι η ίδια η συμβολοσειρά. " +"Εάν το *object* δεν έχει την :meth:`~object.__str__`, τότε η :func:`str` " +"επιστρέφει τη μέθοδο :func:`repr(object) `." + +#: library/stdtypes.rst:1777 +msgid "" +"If at least one of *encoding* or *errors* is given, *object* should be a :" +"term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " +"this case, if *object* is a :class:`bytes` (or :class:`bytearray`) object, " +"then ``str(bytes, encoding, errors)`` is equivalent to :meth:`bytes." +"decode(encoding, errors) `. Otherwise, the bytes object " +"underlying the buffer object is obtained before calling :meth:`bytes." +"decode`. See :ref:`binaryseq` and :ref:`bufferobjects` for information on " +"buffer objects." +msgstr "" +"Εάν δίνεται τουλάχιστον ένα από τα *encoding* ή *errors*, το *object* θα " +"πρέπει να είναι ένα :term:`bytes-like object` (π.χ. :class:`bytes` ή :class:" +"`bytearray`). Σε αυτή την περίπτωση, αν το *object* είναι ένα αντικείμενο :" +"class:`bytes` (ή :class:`bytearray`), τότε το ``str(bytes, encoding, " +"errors)`` είναι ισοδύναμο με το :meth:`bytes.decode(encoding, errors) `. Διαφορετικά, το αντικείμενο bytes που υποκρύπτει το αντικείμενο " +"buffer λαμβάνεται πριν από την κλήση του :meth:`bytes.decode`. Δείτε :ref:" +"`binaryseq` και :ref:`bufferobjects` για πληροφορίες σχετικά με τα " +"αντικείμενα buffer." + +#: library/stdtypes.rst:1786 +msgid "" +"Passing a :class:`bytes` object to :func:`str` without the *encoding* or " +"*errors* arguments falls under the first case of returning the informal " +"string representation (see also the :option:`-b` command-line option to " +"Python). For example::" +msgstr "" +"Πέρασμα ενός αντικειμένου :class:`bytes` στο :func:`str` χωρίς το *encoding* " +"ή το *errors* ορίσματα εμπίπτει στην πρώτη περίπτωση επιστροφής της άτυπης " +"αναπαράστασης συμβολοσειράς (string) (δείτε επίσης την επιλογή :option:`-b` " +"της γραμμής εντολών για Python). Για παράδειγμα::" + +#: library/stdtypes.rst:1791 +msgid "" +">>> str(b'Zoot!')\n" +"\"b'Zoot!'\"" +msgstr "" +">>> str(b'Zoot!')\n" +"\"b'Zoot!'\"" + +#: library/stdtypes.rst:1794 +msgid "" +"For more information on the ``str`` class and its methods, see :ref:" +"`textseq` and the :ref:`string-methods` section below. To output formatted " +"strings, see the :ref:`f-strings` and :ref:`formatstrings` sections. In " +"addition, see the :ref:`stringservices` section." +msgstr "" +"Για περισσότερες πληροφορίες σχετικά με την κλάση ``str`` και τις μεθόδους " +"της, δείτε :ref:`textseq` και την ενότητα :ref:`string-methods` παρακάτω. " +"Για την παραγωγή μορφοποιημένων συμβολοσειρών (string), ανατρέξτε στις " +"ενότητες :ref:`f-strings` και :ref:`formatstrings`. Επιπλέον, δείτε την " +"ενότητα :ref:`stringservices`." + +#: library/stdtypes.rst:1806 +msgid "String Methods" +msgstr "Μέθοδοι Συμβολοσειράς (String)" + +#: library/stdtypes.rst:1811 +msgid "" +"Strings implement all of the :ref:`common ` sequence " +"operations, along with the additional methods described below." +msgstr "" +"Οι συμβολοσειρές (string) υλοποιούν όλες τις λειτουργίες των :ref:`common " +"` ακολουθιών, μαζί με τις πρόσθετες μεθόδους που " +"περιγράφονται παρακάτω." + +#: library/stdtypes.rst:1814 +msgid "" +"Strings also support two styles of string formatting, one providing a large " +"degree of flexibility and customization (see :meth:`str.format`, :ref:" +"`formatstrings` and :ref:`string-formatting`) and the other based on C " +"``printf`` style formatting that handles a narrower range of types and is " +"slightly harder to use correctly, but is often faster for the cases it can " +"handle (:ref:`old-string-formatting`)." +msgstr "" +"Οι συμβολοσειρές (string) υποστηρίζουν επίσης δύο στυλ μορφοποίησης " +"συμβολοσειρών, το ένα παρέχει ένα μεγάλο βαθμό ευελιξίας και προσαρμογής " +"(βλέπε :meth:`str.format`, :ref:`formatstrings` και :ref:`string-" +"formatting`) και το άλλο βασίζεται στο στυλ μορφοποίησης ``printf`` της C " +"που χειρίζεται ένα στενότερο εύρος τύπων και είναι λίγο πιο δύσκολο να " +"χρησιμοποιηθεί σωστά, αλλά είναι συχνά ταχύτερο για τις περιπτώσεις που " +"μπορεί να χειριστεί (:ref:`old-string-formatting`)." + +#: library/stdtypes.rst:1821 +msgid "" +"The :ref:`textservices` section of the standard library covers a number of " +"other modules that provide various text related utilities (including regular " "expression support in the :mod:`re` module)." msgstr "" +"Το τμήμα :ref:`textservices` της πρότυπης βιβλιοθήκης καλύπτει έναν αριθμό " +"από άλλες ενότητες που παρέχουν διάφορες βοηθητικές υπηρεσίες που " +"σχετίζονται με το κείμενο (συμπεριλαμβανομένης της υποστήριξης των κανονικών " +"εκφράσεων στην ενότητα :mod:`re`)." -#: library/stdtypes.rst:1624 +#: library/stdtypes.rst:1827 msgid "" "Return a copy of the string with its first character capitalized and the " "rest lowercased." msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) με τον πρώτο χαρακτήρα " +"κεφαλαίο και τα υπόλοιπα με πεζά γράμματα." -#: library/stdtypes.rst:1627 +#: library/stdtypes.rst:1830 msgid "" "The first character is now put into titlecase rather than uppercase. This " "means that characters like digraphs will only have their first letter " "capitalized, instead of the full character." msgstr "" +"Ο πρώτος χαρακτήρας τίθεται τώρα σε titlecase αντί για uppercase. Αυτό " +"σημαίνει ότι χαρακτήρες όπως οι διγράφοι (digraphs) θα έχουν μόνο το πρώτο " +"γράμμα τους με κεφαλαίο, αντί για όλους τους χαρακτήρες." -#: library/stdtypes.rst:1634 +#: library/stdtypes.rst:1837 msgid "" "Return a casefolded copy of the string. Casefolded strings may be used for " "caseless matching." msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) σε casefolded μορφή. Οι " +"casefolded συμβολοσειρές μπορούν να χρησιμοποιηθούν για caseless matching." -#: library/stdtypes.rst:1637 +#: library/stdtypes.rst:1840 msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " @@ -2095,45 +3577,105 @@ msgid "" "already lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:" "`casefold` converts it to ``\"ss\"``." msgstr "" +"Το casefolding είναι παρόμοιο με το lowercasing αλλά πιο επιθετικό επειδή " +"έχει ως στόχο να αφαιρέσει όλες τις διακρίσεις της πεζότητας σε μια " +"συμβολοσειρά (string). Για παράδειγμα, το γερμανικό πεζό γράμμα ``'ß'`` " +"ισοδυναμεί με ``\"ss\"``. Αφού είναι ήδη πεζό, η :meth:`lower` δεν θα έκανε " +"τίποτα στο ``'ß'``· η :meth:`casefold` το μετατρέπει σε ``\"ss\"``." -#: library/stdtypes.rst:1643 +#: library/stdtypes.rst:1846 msgid "" "The casefolding algorithm is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode16.0.0/core-spec/chapter-3/#G33992>`__." msgstr "" +"Ο αλγόριθμος casefolding `περιγράφεται στην ενότητα 3.13 'Default Case " +"Folding' του προτύπου Unicode `__." -#: library/stdtypes.rst:1652 +#: library/stdtypes.rst:1855 msgid "" "Return centered in a string of length *width*. Padding is done using the " "specified *fillchar* (default is an ASCII space). The original string is " -"returned if *width* is less than or equal to ``len(s)``." +"returned if *width* is less than or equal to ``len(s)``. For example::" msgstr "" +"Επιστρέφει ένα κεντραρισμένο σε μια συμβολοσειρά (string) μήκους *width*. Το " +"padding γίνεται με τη χρήση του καθορισμένου *fillchar* (το default είναι " +"ένα κενό ASCII). Η αρχική συμβολοσειρά επιστρέφεται εάν το *width* είναι " +"μικρότερο ή ίσο με το ``len(s)``. Για παράδειγμα::" -#: library/stdtypes.rst:1660 +#: library/stdtypes.rst:1859 +msgid "" +">>> 'Python'.center(10)\n" +"' Python '\n" +">>> 'Python'.center(10, '-')\n" +"'--Python--'\n" +">>> 'Python'.center(4)\n" +"'Python'" +msgstr "" +">>> 'Python'.center(10)\n" +"' Python '\n" +">>> 'Python'.center(10, '-')\n" +"'--Python--'\n" +">>> 'Python'.center(4)\n" +"'Python'" + +#: library/stdtypes.rst:1869 msgid "" "Return the number of non-overlapping occurrences of substring *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" +"Επιστρέφει τον αριθμό των μη επικαλυπτόμενων (non-overalpping) εμφανίσεων " +"της υποομάδας *sub* στο εύρος [*start*, *end*]. Τα προαιρετικά ορίσματα " +"*start* και *end* ερμηνεύονται όπως στο slice notation." -#: library/stdtypes.rst:1664 +#: library/stdtypes.rst:1873 msgid "" "If *sub* is empty, returns the number of empty strings between characters " -"which is the length of the string plus one." -msgstr "" +"which is the length of the string plus one. For example::" +msgstr "" +"Αν το *sub* είναι κενό, επιστρέφει τον αριθμό των κενών συμβολοσειρών " +"(strings) μεταξύ των χαρακτήρων που είναι το μήκος της συμβολοσειράς συν " +"ένα. Για παράδειγμα::" + +#: library/stdtypes.rst:1876 +msgid "" +">>> 'spam, spam, spam'.count('spam')\n" +"3\n" +">>> 'spam, spam, spam'.count('spam', 5)\n" +"2\n" +">>> 'spam, spam, spam'.count('spam', 5, 10)\n" +"1\n" +">>> 'spam, spam, spam'.count('eggs')\n" +"0\n" +">>> 'spam, spam, spam'.count('')\n" +"17" +msgstr "" +">>> 'spam, spam, spam'.count('spam')\n" +"3\n" +">>> 'spam, spam, spam'.count('spam', 5)\n" +"2\n" +">>> 'spam, spam, spam'.count('spam', 5, 10)\n" +"1\n" +">>> 'spam, spam, spam'.count('eggs')\n" +"0\n" +">>> 'spam, spam, spam'.count('')\n" +"17" -#: library/stdtypes.rst:1670 +#: library/stdtypes.rst:1889 msgid "Return the string encoded to :class:`bytes`." -msgstr "" +msgstr "Επιστρέφει την συμβολοσειρά (string) κωδικοποιημένη σε :class:`bytes`." -#: library/stdtypes.rst:2811 +#: library/stdtypes.rst:3337 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." msgstr "" +"το *encoding* έχει default σε ``'utf-8'``- δείτε :ref:`standard-encodings` " +"για πιθανές τιμές." -#: library/stdtypes.rst:1675 +#: library/stdtypes.rst:1894 msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -2141,33 +3683,90 @@ msgid "" "``'backslashreplace'`` and any other name registered via :func:`codecs." "register_error`. See :ref:`error-handlers` for details." msgstr "" +"το *errors* ελέγχει τον τρόπο χειρισμού των σφαλμάτων κωδικοποίησης. Εάν " +"είναι ``'strict'`` (το default), τότε γίνεται raise μια εξαίρεση :exc:" +"`UnicodeError`. Άλλες πιθανές τιμές είναι τα ``'ignore'``, ``'replace'``, " +"``'xmlcharrefreplace'``, ``'backslashreplace'`` και οποιοδήποτε άλλο όνομα " +"που έχει καταχωρηθεί μέσω του :func:`codecs.register_error`. Δείτε το :ref:" +"`error-handlers` για λεπτομέρειες." -#: library/stdtypes.rst:1682 +#: library/stdtypes.rst:1901 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" -"ref:`debug build ` is used." +"ref:`debug build ` is used. For example::" msgstr "" +"Για λόγους απόδοσης, η τιμή των *errors* δεν ελέγχεται ως προς την " +"εγκυρότητα εκτός αν όντως προκύψει σφάλμα κωδικοποίησης, αν το :ref:" +"`devmode` είναι ενεργοποιημένο ή αν ένα :ref:`debug build ` " +"χρησιμοποιείται. Για παράδειγμα::" -#: library/stdtypes.rst:2830 -msgid "Added support for keyword arguments." +#: library/stdtypes.rst:1907 +msgid "" +">>> encoded_str_to_bytes = 'Python'.encode()\n" +">>> type(encoded_str_to_bytes)\n" +"\n" +">>> encoded_str_to_bytes\n" +"b'Python'" msgstr "" +">>> encoded_str_to_bytes = 'Python'.encode()\n" +">>> type(encoded_str_to_bytes)\n" +"\n" +">>> encoded_str_to_bytes\n" +"b'Python'" -#: library/stdtypes.rst:2833 +#: library/stdtypes.rst:3356 +msgid "Added support for keyword arguments." +msgstr "Επιπρόσθετη υποστήριξη για keyword ορίσματα." + +#: library/stdtypes.rst:3359 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." msgstr "" +"Η τιμή του όρου *errors* ελέγχεται τώρα στο :ref:`devmode` και στο :ref:" +"`debug mode `." -#: library/stdtypes.rst:1697 +#: library/stdtypes.rst:1924 msgid "" "Return ``True`` if the string ends with the specified *suffix*, otherwise " "return ``False``. *suffix* can also be a tuple of suffixes to look for. " "With optional *start*, test beginning at that position. With optional " -"*end*, stop comparing at that position." -msgstr "" - -#: library/stdtypes.rst:1705 +"*end*, stop comparing at that position. Using *start* and *end* is " +"equivalent to ``str[start:end].endswith(suffix)``. For example::" +msgstr "" +"Επιστρέφει ``True`` αν η συμβολοσειρά (string) τελειώνει με το καθορισμένο " +"*suffix*, αλλιώς επιστρέφει ``False``. Το *suffix* μπορεί επίσης να είναι " +"ένα tuple (πλειάδα) από επιθέματα που πρέπει να αναζητηθούν. Με το " +"προαιρετικό *start*, το τεστ αρχίζει από αυτή τη θέση. Με το προαιρετικό " +"*end*, η σύγκριση σταματά σε αυτή τη θέση. Χρησιμοποιώντας *start* και *end* " +"είναι ισοδύναμο με την ``str[start:end].endswith(suffix)``. Για παράδειγμα::" + +#: library/stdtypes.rst:1930 +msgid "" +">>> 'Python'.endswith('on')\n" +"True\n" +">>> 'a tuple of suffixes'.endswith(('at', 'in'))\n" +"False\n" +">>> 'a tuple of suffixes'.endswith(('at', 'es'))\n" +"True\n" +">>> 'Python is amazing'.endswith('is', 0, 9)\n" +"True" +msgstr "" +">>> 'Python'.endswith('on')\n" +"True\n" +">>> 'a tuple of suffixes'.endswith(('at', 'in'))\n" +"False\n" +">>> 'a tuple of suffixes'.endswith(('at', 'es'))\n" +"True\n" +">>> 'Python is amazing'.endswith('is', 0, 9)\n" +"True" + +#: library/stdtypes.rst:1939 +msgid "See also :meth:`startswith` and :meth:`removesuffix`." +msgstr "Δείτε επίσης :meth:`startswith` και :meth:`removesuffix`." + +#: library/stdtypes.rst:1944 msgid "" "Return a copy of the string where all tab characters are replaced by one or " "more spaces, depending on the current column and the given tab size. Tab " @@ -2180,40 +3779,129 @@ msgid "" "(``\\n``) or return (``\\r``), it is copied and the current column is reset " "to zero. Any other character is copied unchanged and the current column is " "incremented by one regardless of how the character is represented when " -"printed." -msgstr "" - -#: library/stdtypes.rst:1726 +"printed. For example::" +msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) όπου όλοι οι χαρακτήρες " +"tab αντικαθίστανται από έναν ή περισσότερα κενά, ανάλογα με την τρέχουσα " +"στήλη και το δεδομένο μέγεθος των tabs. Οι θέσεις tab εμφανίζονται κάθε " +"*tabsize* χαρακτήρες (το default είναι 8, δίνοντας tab θέσεις στις στήλες 0, " +"8, 16 κ.ο.κ.). Για την επέκταση της συμβολοσειράς, η τρέχουσα στήλη " +"μηδενίζεται και η συμβολοσειρά εξετάζεται χαρακτήρας προς χαρακτήρα. Εάν ο " +"χαρακτήρας είναι tab (``\\t``), εισάγονται ένας ή περισσότεροι χαρακτήρες " +"κενών στο αποτέλεσμα μέχρι η τρέχουσα στήλη να είναι ίση με την επόμενη θέση " +"tab. (Ο ίδιος ο χαρακτήρας tab δεν αντιγράφεται.) Εάν ο χαρακτήρας είναι νέα " +"γραμμή (``\\n``) ή return (``\\r``), αντιγράφεται και η τρέχουσα στήλη " +"επαναφέρεται στο μηδέν. Οποιοσδήποτε άλλος χαρακτήρας αντιγράφεται " +"αμετάβλητος και η τρέχουσα στήλη αυξάνεται κατά ένα, ανεξάρτητα από τον " +"τρόπο αναπαράστασης του χαρακτήρα όταν τυπώνεται. Για παράδειγμα::" + +#: library/stdtypes.rst:1957 +msgid "" +">>> '01\\t012\\t0123\\t01234'.expandtabs()\n" +"'01 012 0123 01234'\n" +">>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n" +"'01 012 0123 01234'\n" +">>> print('01\\t012\\n0123\\t01234'.expandtabs(4))\n" +"01 012\n" +"0123 01234" +msgstr "" +">>> '01\\t012\\t0123\\t01234'.expandtabs()\n" +"'01 012 0123 01234'\n" +">>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n" +"'01 012 0123 01234'\n" +">>> print('01\\t012\\n0123\\t01234'.expandtabs(4))\n" +"01 012\n" +"0123 01234" + +#: library/stdtypes.rst:1968 msgid "" "Return the lowest index in the string where substring *sub* is found within " "the slice ``s[start:end]``. Optional arguments *start* and *end* are " -"interpreted as in slice notation. Return ``-1`` if *sub* is not found." +"interpreted as in slice notation. Return ``-1`` if *sub* is not found. For " +"example::" msgstr "" +"Επιστρέφει τον χαμηλότερο δείκτη στη συμβολοσειρά (string) όπου η υπό-" +"συμβολοσειρά *sub* βρίσκεται μέσα στο υποσύνολο (slice) ``s[start:end]``. " +"Τα προαιρετικά ορίσματα *start* και *end* ερμηνεύονται όπως στο notation του " +"υποσυνόλου. Επιστρέφει ``-1`` αν δεν βρεθεί το *sub*. Για παράδειγμα::" -#: library/stdtypes.rst:1732 +#: library/stdtypes.rst:1973 +msgid "" +">>> 'spam, spam, spam'.find('sp')\n" +"0\n" +">>> 'spam, spam, spam'.find('sp', 5)\n" +"6" +msgstr "" +">>> 'spam, spam, spam'.find('sp')\n" +"0\n" +">>> 'spam, spam, spam'.find('sp', 5)\n" +"6" + +#: library/stdtypes.rst:1978 +msgid "See also :meth:`rfind` and :meth:`index`." +msgstr "Δείτε επίσης :meth:`rfind` και :meth:`index`." + +#: library/stdtypes.rst:1982 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" +"Η μέθοδος :meth:`~str.find` θα πρέπει να χρησιμοποιείται μόνο αν πρέπει να " +"γνωρίζετε τη θέση του *sub*. Για να ελέγξετε αν το *sub* είναι υποσύνολο ή " +"όχι, χρησιμοποιήστε τον τελεστή :keyword:`in`::" + +#: library/stdtypes.rst:1986 +msgid "" +">>> 'Py' in 'Python'\n" +"True" +msgstr "" +">>> 'Py' in 'Python'\n" +"True" -#: library/stdtypes.rst:1742 +#: library/stdtypes.rst:1992 msgid "" "Perform a string formatting operation. The string on which this method is " "called can contain literal text or replacement fields delimited by braces " "``{}``. Each replacement field contains either the numeric index of a " "positional argument, or the name of a keyword argument. Returns a copy of " "the string where each replacement field is replaced with the string value of " -"the corresponding argument." -msgstr "" +"the corresponding argument. For example:" +msgstr "" +"Εκτέλεση μιας λειτουργίας μορφοποίησης συμβολοσειράς (string formatting). Η " +"συμβολοσειρά στην οποία αυτή η μέθοδος καλείται μπορεί να περιέχει " +"κυριολεκτικό κείμενο ή πεδία αντικατάστασης που οριοθετούνται από αγκύλες " +"``{}``. Κάθε πεδίο αντικατάστασης περιέχει είτε τον αριθμητικό δείκτη ενός " +"ορίσματος θέσης, είτε το όνομα ενός keyword ορίσματος. Επιστρέφει ένα " +"αντίγραφο της συμβολοσειράς όπου κάθε πεδίο αντικατάστασης αντικαθίσταται με " +"την τιμή της συμβολοσειράς του αντίστοιχου ορίσματος. Για παράδειγμα:" + +#: library/stdtypes.rst:1999 +msgid "" +">>> \"The sum of 1 + 2 is {0}\".format(1+2)\n" +"'The sum of 1 + 2 is 3'\n" +">>> \"The sum of {a} + {b} is {answer}\".format(answer=1+2, a=1, b=2)\n" +"'The sum of 1 + 2 is 3'\n" +">>> \"{1} expects the {0} Inquisition!\".format(\"Spanish\", \"Nobody\")\n" +"'Nobody expects the Spanish Inquisition!'" +msgstr "" +">>> \"The sum of 1 + 2 is {0}\".format(1+2)\n" +"'The sum of 1 + 2 is 3'\n" +">>> \"The sum of {a} + {b} is {answer}\".format(answer=1+2, a=1, b=2)\n" +"'The sum of 1 + 2 is 3'\n" +">>> \"{1} expects the {0} Inquisition!\".format(\"Spanish\", \"Nobody\")\n" +"'Nobody expects the Spanish Inquisition!'" -#: library/stdtypes.rst:1752 +#: library/stdtypes.rst:2008 msgid "" "See :ref:`formatstrings` for a description of the various formatting options " "that can be specified in format strings." msgstr "" +"Δείτε το :ref:`formatstrings` για μια περιγραφή των διαφόρων επιλογών " +"μορφοποίησης που μπορούν να καθοριστούν στην μορφοποίηση συμβολοσειρών " +"(format strings)." -#: library/stdtypes.rst:1756 +#: library/stdtypes.rst:2012 msgid "" "When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" "class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." @@ -2223,35 +3911,56 @@ msgid "" "and the ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. " "This temporary change affects other threads." msgstr "" +"Κατά τη μορφοποίηση ενός αριθμού (:class:`int`, :class:`float`, :class:" +"`complex`, :class:`decimal.Decimal` και υποκλάσεις) με τον τύπο ``n`` (π.χ.: " +"``'{:n}'.format(1234)``, η συνάρτηση θέτει προσωρινά την τοποθεσία " +"``LC_CTYPE`` στην τοποθεσία ``LC_NUMERIC`` για την αποκωδικοποίηση των " +"``decimal_point`` και ``thousands_sep`` πεδίων του :c:func:`localeconv` αν " +"είναι μη ASCII ή μεγαλύτερα από 1 byte, και το locale ``LC_NUMERIC`` είναι " +"διαφορετικό από το locale ``LC_CTYPE``. Αυτή η προσωρινή αλλαγή επηρεάζει " +"και άλλα νήματα (threads)." -#: library/stdtypes.rst:1765 +#: library/stdtypes.rst:2021 msgid "" "When formatting a number with the ``n`` type, the function sets temporarily " "the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` locale in some cases." msgstr "" +"Κατά τη μορφοποίηση ενός αριθμού με τον τύπο ``n``, η συνάρτηση θέτει " +"προσωρινά το locale ``LC_CTYPE`` στο locale ``LC_NUMERIC`` σε κάποιες " +"περιπτώσεις." -#: library/stdtypes.rst:1773 +#: library/stdtypes.rst:2029 msgid "" "Similar to ``str.format(**mapping)``, except that ``mapping`` is used " "directly and not copied to a :class:`dict`. This is useful if for example " "``mapping`` is a dict subclass:" msgstr "" +"Παρόμοιο με το ``str.format(**mapping)``, εκτός από το ότι χρησιμοποιείται " +"το ``mapping`` απευθείας και δεν αντιγράφεται σε μια :class:`dict`. Αυτό " +"είναι χρήσιμο αν για παράδειγμα το ``mapping`` είναι μια υποκλάση του dict:" -#: library/stdtypes.rst:1789 +#: library/stdtypes.rst:2045 msgid "" "Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is " "not found." msgstr "" +"Όπως η :meth:`~str.find`, αλλά κάνει raise :exc:`ValueError` όταν η υπό-" +"συμβολοσειρά (substring) δεν έχει βρεθεί." -#: library/stdtypes.rst:1795 +#: library/stdtypes.rst:2051 msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " "alphanumeric if one of the following returns ``True``: ``c.isalpha()``, ``c." "isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" +"Επιστρέφει ``True`` αν όλοι οι χαρακτήρες στη συμβολοσειρά (string) είναι " +"αλφαριθμητικοί και υπάρχει τουλάχιστον ένας χαρακτήρας, διαφορετικά " +"``False``. Ένας χαρακτήρας ``c`` είναι αλφαριθμητικό εάν ένα από τα " +"ακόλουθα επιστρέφει ``True``: ``c.isalpha()``, ``c.isdecimal()``, ``c." +"isdigit()``, ή ``c.isnumeric()``." -#: library/stdtypes.rst:1803 +#: library/stdtypes.rst:2059 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " @@ -2259,27 +3968,95 @@ msgid "" "e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " -"of the Unicode Standard `_." -msgstr "" - -#: library/stdtypes.rst:1814 +"of the Unicode Standard `_. For example:" +msgstr "" +"Επιστρέφει ``True`` αν όλοι οι χαρακτήρες στη συμβολοσειρά (string) είναι " +"αλφαβητικοί και υπάρχει τουλάχιστον ένας χαρακτήρας, διαφορετικά ``False``. " +"Οι αλφαβητικοί χαρακτήρες είναι χαρακτήρες που ορίζονται στη βάση δεδομένων " +"χαρακτήρων Unicode ως \"Letter\", δηλαδή, εκείνοι με General Category " +"ιδιότητα μία από τα \"Lm\", \"Lt\", \"Lu\", \"Ll\", ή \"Lo\". Σημειώστε ότι " +"αυτό είναι διαφορετικό από το `Αλφαβητικό που ορίζεται στην ενότητα 4.10 " +"'Letters, Alphabetic, and Ideographic' του προτύπου Unicode `_. Για " +"παράδειγμα:" + +#: library/stdtypes.rst:2068 +msgid "" +">>> 'Letters and spaces'.isalpha()\n" +"False\n" +">>> 'LettersOnly'.isalpha()\n" +"True\n" +">>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical " +"too\n" +"True" +msgstr "" +">>> 'Letters and spaces'.isalpha()\n" +"False\n" +">>> 'LettersOnly'.isalpha()\n" +"True\n" +">>> 'µ'.isalpha() # non-ASCII characters can be considered alphabetical " +"too\n" +"True" + +#: library/stdtypes.rst:2077 +msgid "See :ref:`unicode-properties`." +msgstr "Δείτε :ref:`unicode-properties`." + +#: library/stdtypes.rst:2082 msgid "" "Return ``True`` if the string is empty or all characters in the string are " "ASCII, ``False`` otherwise. ASCII characters have code points in the range " -"U+0000-U+007F." +"U+0000-U+007F. For example:" msgstr "" +"Επιστρέφει ``True`` εάν η συμβολοσειρά (string) είναι κενή ή όλοι οι " +"χαρακτήρες της συμβολοσειράς είναι ASCII, αλλιώς ``False``. Οι χαρακτήρες " +"ASCII έχουν σημεία κωδικοποίησης στην περιοχή U+0000-U+007F. Για παράδειγμα:" -#: library/stdtypes.rst:1823 +#: library/stdtypes.rst:2086 msgid "" -"Return ``True`` if all characters in the string are decimal characters and " -"there is at least one character, ``False`` otherwise. Decimal characters are " -"those that can be used to form numbers in base 10, e.g. U+0660, ARABIC-INDIC " -"DIGIT ZERO. Formally a decimal character is a character in the Unicode " -"General Category \"Nd\"." +">>> 'ASCII characters'.isascii()\n" +"True\n" +">>> 'µ'.isascii()\n" +"False" msgstr "" +">>> 'ASCII characters'.isascii()\n" +"True\n" +">>> 'µ'.isascii()\n" +"False" -#: library/stdtypes.rst:1833 +#: library/stdtypes.rst:2098 +msgid "" +"Return ``True`` if all characters in the string are decimal characters and " +"there is at least one character, ``False`` otherwise. Decimal characters are " +"those that can be used to form numbers in base 10, such as U+0660, ARABIC-" +"INDIC DIGIT ZERO. Formally a decimal character is a character in the " +"Unicode General Category \"Nd\". For example:" +msgstr "" +"Επιστρέφει ``True`` αν όλοι οι χαρακτήρες στη συμβολοσειρά (string) είναι " +"δεκαδικοί χαρακτήρες και υπάρχει τουλάχιστον ένας χαρακτήρας, διαφορετικά " +"``False``. Οι δεκαδικοί χαρακτήρες είναι αυτοί που μπορούν να " +"χρησιμοποιηθούν για το σχηματισμό αριθμών στη βάση 10, π.χ. U+0660, ARABIC-" +"INDIC DIGIT ZERO. Επίσημα ένας δεκαδικός χαρακτήρας είναι ένας χαρακτήρας " +"του Unicode General Category \"Nd\". Για παράδειγμα:" + +#: library/stdtypes.rst:2105 +msgid "" +">>> '0123456789'.isdecimal()\n" +"True\n" +">>> '٠١٢٣٤٥٦٧٨٩'.isdecimal() # Arabic-Indic digits zero to nine\n" +"True\n" +">>> 'alphabetic'.isdecimal()\n" +"False" +msgstr "" +">>> '0123456789'.isdecimal()\n" +"True\n" +">>> '٠١٢٣٤٥٦٧٨٩'.isdecimal() # Arabic-Indic digits zero to nine\n" +"True\n" +">>> 'alphabetic'.isdecimal()\n" +"False" + +#: library/stdtypes.rst:2117 msgid "" "Return ``True`` if all characters in the string are digits and there is at " "least one character, ``False`` otherwise. Digits include decimal characters " @@ -2288,30 +4065,60 @@ msgid "" "like the Kharosthi numbers. Formally, a digit is a character that has the " "property value Numeric_Type=Digit or Numeric_Type=Decimal." msgstr "" +"Επιστρέφει ``True`` αν όλοι οι χαρακτήρες στη συμβολοσειρά είναι ψηφία και " +"υπάρχει τουλάχιστον ένας χαρακτήρας, διαφορετικά ``False``. Τα ψηφία " +"περιλαμβάνουν δεκαδικούς χαρακτήρες και ψηφία που χρειάζονται ειδικό " +"χειρισμό, όπως τα compatibility superscript ψηφία. Αυτό καλύπτει τα ψηφία " +"που δεν μπορούν να χρησιμοποιηθούν για το σχηματισμό αριθμών στη βάση 10, " +"όπως οι αριθμοί Kharosthi. Τυπικά, ένα ψηφίο είναι ένας χαρακτήρας που έχει " +"την τιμή της ιδιότητας Numeric_Type=Digit ή Numeric_Type=Decimal." -#: library/stdtypes.rst:1843 +#: library/stdtypes.rst:2127 msgid "" "Return ``True`` if the string is a valid identifier according to the " "language definition, section :ref:`identifiers`." msgstr "" +"Επιστρέφει ``True`` αν η συμβολοσειρά είναι έγκυρο αναγνωριστικό σύμφωνα με " +"το ορισμό της γλώσσας, ενότητα :ref:`identifiers`." -#: library/stdtypes.rst:1846 +#: library/stdtypes.rst:2130 msgid "" ":func:`keyword.iskeyword` can be used to test whether string ``s`` is a " "reserved identifier, such as :keyword:`def` and :keyword:`class`." msgstr "" +"το :func:`keyword.iskeyword` μπορεί να χρησιμοποιηθεί για να ελέγξει αν η " +"συμβολοσειρά ``s`` είναι ένα δεσμευμένο αναγνωριστικό, όπως τα :keyword:" +"`def` και :keyword:`class`." -#: library/stdtypes.rst:1849 +#: library/stdtypes.rst:2133 msgid "Example: ::" +msgstr "Παράδειγμα ::" + +#: library/stdtypes.rst:2136 +msgid "" +">>> from keyword import iskeyword\n" +"\n" +">>> 'hello'.isidentifier(), iskeyword('hello')\n" +"(True, False)\n" +">>> 'def'.isidentifier(), iskeyword('def')\n" +"(True, True)" msgstr "" +">>> from keyword import iskeyword\n" +"\n" +">>> 'hello'.isidentifier(), iskeyword('hello')\n" +"(True, False)\n" +">>> 'def'.isidentifier(), iskeyword('def')\n" +"(True, True)" -#: library/stdtypes.rst:1862 +#: library/stdtypes.rst:2146 msgid "" "Return ``True`` if all cased characters [4]_ in the string are lowercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" +"Επιστρέφει ``True`` αν όλοι οι χαρακτήρες [4]_ στο αλφαριθμητικό (string) " +"είναι πεζοί και υπάρχει τουλάχιστον ένας cased χαρακτήρας, αλλιώς ``False``." -#: library/stdtypes.rst:1868 +#: library/stdtypes.rst:2152 msgid "" "Return ``True`` if all characters in the string are numeric characters, and " "there is at least one character, ``False`` otherwise. Numeric characters " @@ -2320,74 +4127,174 @@ msgid "" "characters are those with the property value Numeric_Type=Digit, " "Numeric_Type=Decimal or Numeric_Type=Numeric." msgstr "" +"Επιστρέφει ``True`` αν όλοι οι χαρακτήρες στη συμβολοσειρά είναι αριθμητικοί " +"(numeric) χαρακτήρες, και υπάρχει τουλάχιστον ένας χαρακτήρας, διαφορετικά " +"``False``. Οι αριθμητικοί χαρακτήρες περιλαμβάνουν ψηφιακούς χαρακτήρες και " +"όλους τους χαρακτήρες που έχουν την αριθμητική τιμή, π.χ. U+2155, VULGAR " +"FRACTION ONE FIFTH. Τυπικά, οι αριθμητικοί χαρακτήρες είναι εκείνοι με την " +"τιμή της ιδιότητας Numeric_Type=Digit, Numeric_Type=Decimal ή " +"Numeric_Type=Numeric." -#: library/stdtypes.rst:1878 +#: library/stdtypes.rst:2162 msgid "" -"Return ``True`` if all characters in the string are printable or the string " -"is empty, ``False`` otherwise. Nonprintable characters are those characters " -"defined in the Unicode character database as \"Other\" or \"Separator\", " -"excepting the ASCII space (0x20) which is considered printable. (Note that " -"printable characters in this context are those which should not be escaped " -"when :func:`repr` is invoked on a string. It has no bearing on the handling " -"of strings written to :data:`sys.stdout` or :data:`sys.stderr`.)" +"Return ``True`` if all characters in the string are printable, ``False`` if " +"it contains at least one non-printable character." msgstr "" +"Επιστρέφει ``True`` αν όλοι οι χαρακτήρες στη συμβολοσειρά μπορούν να " +"εκτυπωθούν, ``False`` εάν περιέχει τουλάχιστον έναν μη εκτυπώσιμο χαρακτήρα." -#: library/stdtypes.rst:1889 +#: library/stdtypes.rst:2165 +msgid "" +"Here \"printable\" means the character is suitable for :func:`repr` to use " +"in its output; \"non-printable\" means that :func:`repr` on built-in types " +"will hex-escape the character. It has no bearing on the handling of strings " +"written to :data:`sys.stdout` or :data:`sys.stderr`." +msgstr "" +"Εδώ \"εκτυπώσιμος\" σημαίνει ότι ο χαρακτήρας είναι κατάλληλος για την :func:" +"`repr` για χρήση στην έξοδο του∙ το \"μη εκτυπώσιμος\" σημαίνει ότι ο " +"χαρακτήρας στη :func:`repr` στους ενσωματωμένους τύπους θα διαφεύγει " +"εξαγωνικά από τον χαρακτήρα. Δεν έχει καμία σχέση με τον χειρισμό " +"συμβολοσειρών που γράφονται σε :data:`sys.stdout` ή :data:`sys.stderr`." + +#: library/stdtypes.rst:2170 +msgid "" +"The printable characters are those which in the Unicode character database " +"(see :mod:`unicodedata`) have a general category in group Letter, Mark, " +"Number, Punctuation, or Symbol (L, M, N, P, or S); plus the ASCII space " +"0x20. Nonprintable characters are those in group Separator or Other (Z or " +"C), except the ASCII space." +msgstr "" +"Οι εκτυπώσιμοι χαρακτήρες είναι αυτοί που στη βάση δεδομένων χαρακτήρων " +"Unicode (βλ. :mod:`unicodedata`) έχουν μια γενική κατηγορία στην ομάδα " +"Γράμμα, Σήμα, Αριθμός, Σημεία στίξης ή Σύμβολο (L, M, N, P ή S), συν το " +"διάστημα ASCII 0x20. Οι μη εκτυπώσιμοι χαρακτήρες είναι αυτοί που βρίσκονται " +"στο χώρο Διαχωρισμού ομάδας ή Άλλο (Z ή CII)." + +#: library/stdtypes.rst:2179 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" +"Επιστρέφει ``True`` αν υπάρχουν μόνο χαρακτήρες κενού (whitespace) στο " +"αλφαριθμητικό (string) και υπάρχει τουλάχιστον ένας χαρακτήρας, διαφορετικά " +"``False``." -#: library/stdtypes.rst:1892 +#: library/stdtypes.rst:2182 msgid "" "A character is *whitespace* if in the Unicode character database (see :mod:" "`unicodedata`), either its general category is ``Zs`` (\"Separator, " "space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." msgstr "" +"Ένας χαρακτήρας είναι *whitespace* εάν στη βάση δεδομένων χαρακτήρων Unicode " +"(βλέπε :mod:`unicodedata`), είτε η γενική κατηγορία του είναι ``Zs`` " +"(\"Separator, space\"), είτε η αμφίδρομη κατηγορία του είναι μία από τις " +"κατηγορίες ``WS``, ``B``, ή ``S``." -#: library/stdtypes.rst:1900 +#: library/stdtypes.rst:2190 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " "characters and lowercase characters only cased ones. Return ``False`` " "otherwise." msgstr "" +"Επιστρέφει ``True`` αν η συμβολοσειρά (string) είναι μια titlecased " +"συμβολοσειρά και υπάρχει τουλάχιστον ένας χαρακτήρας, για παράδειγμα, οι " +"κεφαλαίοι χαρακτήρες μπορούν να ακολουθούν μόνο τους uncased χαρακτήρες και " +"οι πεζοί χαρακτήρες μόνο cased χαρακτήρες. Διαφορετικά, επιστρέφει " +"``False``." -#: library/stdtypes.rst:1907 +#: library/stdtypes.rst:2739 +msgid "For example:" +msgstr "Για παράδειγμα:" + +#: library/stdtypes.rst:2196 +msgid "" +">>> 'Spam, Spam, Spam'.istitle()\n" +"True\n" +">>> 'spam, spam, spam'.istitle()\n" +"False\n" +">>> 'SPAM, SPAM, SPAM'.istitle()\n" +"False" +msgstr "" +">>> 'Spam, Spam, Spam'.istitle()\n" +"True\n" +">>> 'spam, spam, spam'.istitle()\n" +"False\n" +">>> 'SPAM, SPAM, SPAM'.istitle()\n" +"False" + +#: library/stdtypes.rst:2205 +msgid "See also :meth:`title`." +msgstr "Δείτε επίσης :meth:`title`." + +#: library/stdtypes.rst:2210 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" +"Επιστρέφει ``True`` αν όλοι οι χαρακτήρες [4]_ στο αλφαριθμητικό είναι " +"κεφαλαίοι και υπάρχει τουλάχιστον ένας cased χαρακτήρας, διαφορετικά " +"``False``." -#: library/stdtypes.rst:1925 +#: library/stdtypes.rst:2228 msgid "" "Return a string which is the concatenation of the strings in *iterable*. A :" "exc:`TypeError` will be raised if there are any non-string values in " "*iterable*, including :class:`bytes` objects. The separator between " -"elements is the string providing this method." +"elements is the string providing this method. For example:" msgstr "" +"Επιστρέφει μια συμβολοσειρά (string) που είναι η συνένωση των συμβολοσειρών " +"στο *iterable*. Ένα :exc:`TypeError` θα γίνει raise αν υπάρχουν τιμές μη " +"συμβολοσειράς (non-string) στο *iterable*, συμπεριλαμβανομένων των " +"αντικειμένων :class:`bytes`. Το διαχωριστικό μεταξύ των στοιχείων είναι η " +"συμβολοσειρά που παρέχει αυτή η μέθοδος. Για παράδειγμα:" -#: library/stdtypes.rst:1933 +#: library/stdtypes.rst:2233 +msgid "" +">>> ', '.join(['spam', 'spam', 'spam'])\n" +"'spam, spam, spam'\n" +">>> '-'.join('Python')\n" +"'P-y-t-h-o-n'" +msgstr "" +">>> ', '.join(['spam', 'spam', 'spam'])\n" +"'spam, spam, spam'\n" +">>> '-'.join('Python')\n" +"'P-y-t-h-o-n'" + +#: library/stdtypes.rst:2240 +msgid "See also :meth:`split`." +msgstr "Δείτε επίσης :meth:`split`." + +#: library/stdtypes.rst:2245 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" +"Επιστρέφει τη συμβολοσειρά (string) με αριστερή ευθυγράμμιση σε μια " +"συμβολοσειρά μήκους *width*. Το padding γίνεται με τη χρήση του καθορισμένου " +"*fillchar* (το default είναι ένα κενό ASCII). Η αρχική συμβολοσειρά " +"επιστρέφεται εάν το *width* είναι μικρότερο ή ίσο με το ``len(s)``." -#: library/stdtypes.rst:1940 +#: library/stdtypes.rst:2252 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) με όλους τους cased " +"χαρακτήρες [4]_ να έχουν μετατραπεί σε πεζούς." -#: library/stdtypes.rst:1943 +#: library/stdtypes.rst:2255 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode16.0.0/core-spec/chapter-3/#G33992>`__." msgstr "" +"Ο αλγόριθμος που χρησιμοποιείται για την πεζογράμμιση `περιγράφεται στην " +"ενότητα 3.13 'Default Case Folding' του προτύπου Unicode `__." -#: library/stdtypes.rst:1950 +#: library/stdtypes.rst:2262 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -2395,92 +4302,195 @@ msgid "" "The *chars* argument is not a prefix; rather, all combinations of its values " "are stripped::" msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) με την αφαίρεση των " +"αρχικών χαρακτήρων. Τα *chars* είναι μια συμβολοσειρά που καθορίζει το " +"σύνολο των χαρακτήρων που πρέπει να αφαιρεθούν. Εάν παραλειφθεί ή είναι " +"``None``, το όρισμα *chars* έχει ως default την αφαίρεση των κενών " +"χαρακτήρων. Το όρισμα *chars* δεν είναι ένα πρόθεμα· οπότε, όλοι οι " +"συνδυασμοί των τιμών του αφαιρούνται::" -#: library/stdtypes.rst:1960 +#: library/stdtypes.rst:2267 +msgid "" +">>> ' spacious '.lstrip()\n" +"'spacious '\n" +">>> 'www.example.com'.lstrip('cmowz.')\n" +"'example.com'" +msgstr "" +">>> ' spacious '.lstrip()\n" +"'spacious '\n" +">>> 'www.example.com'.lstrip('cmowz.')\n" +"'example.com'" + +#: library/stdtypes.rst:2272 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" +"Δείτε την :meth:`str.removeprefix` για μια μέθοδο που θα αφαιρέσει ένα μόνο " +"πρόθεμα συμβολοσειράς (string) αντί για όλο το σύνολο των χαρακτήρων. Για " +"παράδειγμα::" + +#: library/stdtypes.rst:2275 +msgid "" +">>> 'Arthur: three!'.lstrip('Arthur: ')\n" +"'ee!'\n" +">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" +"'three!'" +msgstr "" +">>> 'Arthur: three!'.lstrip('Arthur: ')\n" +"'ee!'\n" +">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" +"'three!'" -#: library/stdtypes.rst:1971 +#: library/stdtypes.rst:2284 msgid "" "This static method returns a translation table usable for :meth:`str." "translate`." msgstr "" +"Αυτή η στατική μέθοδος επιστρέφει έναν πίνακα μεταφράσεων που μπορεί να " +"χρησιμοποιηθεί για το :meth:`str.translate`." -#: library/stdtypes.rst:1973 +#: library/stdtypes.rst:2286 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " "strings (of arbitrary lengths) or ``None``. Character keys will then be " "converted to ordinals." msgstr "" +"Εάν υπάρχει μόνο ένα όρισμα, πρέπει να είναι ένα λεξικό αντιστοίχισης " +"Unicode ordinals (ακέραιοι αριθμοί) ή χαρακτήρες (συμβολοσειρές - strings " +"μήκους 1) σε ordinals Unicode, συμβολοσειρές (αυθαίρετου μήκους) ή " +"``None``. Τα κλειδιά χαρακτήρων τότε θα μετατραπούν σε κανονικούς αριθμούς." -#: library/stdtypes.rst:1978 +#: library/stdtypes.rst:2291 msgid "" "If there are two arguments, they must be strings of equal length, and in the " -"resulting dictionary, each character in x will be mapped to the character at " -"the same position in y. If there is a third argument, it must be a string, " -"whose characters will be mapped to ``None`` in the result." +"resulting dictionary, each character in *from* will be mapped to the " +"character at the same position in *to*. If there is a third argument, it " +"must be a string, whose characters will be mapped to ``None`` in the result." msgstr "" +"Εάν υπάρχουν δύο ορίσματα, πρέπει να είναι συμβολοσειρές (strings) ίσου " +"μήκους και στο λεξικό (dictionary) που θα προκύψει, κάθε χαρακτήρας στο " +"*from* θα αντιστοιχιστεί στο χαρακτήρα στην ίδια θέση στο *to*. Αν υπάρχει " +"τρίτο όρισμα, πρέπει να είναι συμβολοσειρά, του οποίου οι χαρακτήρες θα " +"αντιστοιχιστούν στο αποτέλεσμα σε ``None``." -#: library/stdtypes.rst:1986 +#: library/stdtypes.rst:2299 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " "after the separator. If the separator is not found, return a 3-tuple " "containing the string itself, followed by two empty strings." msgstr "" +"Διαχωρίστε τη συμβολοσειρά (string) στην πρώτη εμφάνιση του *sep*, και " +"επιστρέφει ένα 3-tuple που περιέχει το μέρος πριν από το διαχωριστικό, το " +"ίδιο το διαχωριστικό και το μέρος μετά το διαχωριστικό. Αν ο διαχωριστής " +"δεν βρεθεί, επιστρέφει ένα 3-σύνολο που περιέχει την ίδια τη συμβολοσειρά, " +"ακολουθούμενη από δύο κενές συμβολοσειρές." -#: library/stdtypes.rst:1994 +#: library/stdtypes.rst:2307 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" +"Εάν η συμβολοσειρά (string) ξεκινά με το *prefix*, επιστρέφει " +"``string[len(prefix):]``. Διαφορετικά, επιστρέφει ένα αντίγραφο της αρχικής " +"συμβολοσειράς::" -#: library/stdtypes.rst:2008 +#: library/stdtypes.rst:2311 +msgid "" +">>> 'TestHook'.removeprefix('Test')\n" +"'Hook'\n" +">>> 'BaseTestCase'.removeprefix('Test')\n" +"'BaseTestCase'" +msgstr "" +">>> 'TestHook'.removeprefix('Test')\n" +"'Hook'\n" +">>> 'BaseTestCase'.removeprefix('Test')\n" +"'BaseTestCase'" + +#: library/stdtypes.rst:2321 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" +"Αν η συμβολοσειρά τελειώνει με το *suffix* και το *suffix* δεν είναι κενό, " +"επιστρέφει ``string[:-len(suffix)]``. Διαφορετικά, επιστρέφει ένα αντίγραφο " +"της αρχικής συμβολοσειράς::" + +#: library/stdtypes.rst:2325 +msgid "" +">>> 'MiscTests'.removesuffix('Tests')\n" +"'Misc'\n" +">>> 'TmpDirMixin'.removesuffix('Tests')\n" +"'TmpDirMixin'" +msgstr "" +">>> 'MiscTests'.removesuffix('Tests')\n" +"'Misc'\n" +">>> 'TmpDirMixin'.removesuffix('Tests')\n" +"'TmpDirMixin'" -#: library/stdtypes.rst:2022 +#: library/stdtypes.rst:2335 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " -"by *new*. If the optional argument *count* is given, only the first *count* " -"occurrences are replaced." +"by *new*. If *count* is given, only the first *count* occurrences are " +"replaced. If *count* is not specified or ``-1``, then all occurrences are " +"replaced." msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) με όλες τις εμφανίσεις " +"της υπό-συμβολοσειράς *old* αντικατεστημένες από την *new*. Εάν δοθεί η " +"παράμετρος *count*, μόνο οι πρώτες *count* εμφανίσεις. Αν δεν έχει οριστεί ή " +"είναι -1, τότε αντικαθίστανται όλες οι εμφανίσεις." -#: library/stdtypes.rst:2029 +#: library/stdtypes.rst:2339 +msgid "*count* is now supported as a keyword argument." +msgstr "Το *count* υποστηρίζεται πλέον ως όρισμα λέξης-κλειδιού." + +#: library/stdtypes.rst:2345 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" +"Επιστρέφει το υψηλότερο index στη συμβολοσειρά (string) όπου βρίσκεται η υπό-" +"συμβολοσειρά *sub*, έτσι ώστε το *sub* περιέχεται στο ``s[start:end]``. Τα " +"προαιρετικά ορίσματα *start* και *end* ερμηνεύονται ως slice notation. " +"Επιστρέφει ``-1`` σε περίπτωση αποτυχίας." -#: library/stdtypes.rst:2036 +#: library/stdtypes.rst:2352 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" +"Όπως η :meth:`rfind`, αλλά κάνει raise :exc:`ValueError` όταν η υπό-" +"συμβολοσειρά (sub-string) *sub* δεν βρέθηκε." -#: library/stdtypes.rst:2042 +#: library/stdtypes.rst:2358 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" +"Επιστρέφει τη συμβολοσειρά (string) με δεξιό προσανατολισμό σε μια " +"συμβολοσειρά μήκους *width*. Το padding γίνεται χρησιμοποιώντας το " +"καθορισμένο *fillchar* (η προεπιλογή είναι ένα διάστημα ASCII). Η αρχική " +"συμβολοσειρά επιστρέφεται εάν το *width* είναι μικρότερο ή ίσο με ``len(s)``." -#: library/stdtypes.rst:2049 +#: library/stdtypes.rst:2365 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " "after the separator. If the separator is not found, return a 3-tuple " "containing two empty strings, followed by the string itself." msgstr "" +"Διαχωρίζει τη συμβολοσειρά (string) στην τελευταία εμφάνιση του *sep* και " +"επιστρέφει ένα 3-tuple που περιέχει το τμήμα πριν από το διαχωριστικό, το " +"ίδιο το διαχωριστικό και το μέρος μετά το διαχωριστικό. Εάν το διαχωριστικό " +"δεν βρεθεί, επιστρέφει ένα 3-tuple που περιέχει δύο κενές συμβολοσειρές, " +"ακολουθούμενες από την ίδια τη συμβολοσειρά." -#: library/stdtypes.rst:2057 +#: library/stdtypes.rst:2373 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -2488,8 +4498,14 @@ msgid "" "string is a separator. Except for splitting from the right, :meth:`rsplit` " "behaves like :meth:`split` which is described in detail below." msgstr "" +"Επιστρέφει μια λίστα με τις λέξεις στη συμβολοσειρά (string), " +"χρησιμοποιώντας το *sep* ως οριοθέτη. Εάν δοθεί το *maxsplit*, θα γίνουν το " +"πολύ *maxsplit* διαχωρισμοί, ξεκινώντας από τα δεξιά. Εάν το *sep* δεν έχει " +"καθοριστεί ή είναι ``None``, οποιοδήποτε κενό διάστημα γίνεται διαχωριστικό. " +"Εκτός από το διαχωρισμό από τα δεξιά, η :meth:`rsplit` συμπεριφέρεται όπως " +"η :meth:`split` που περιγράφεται λεπτομερώς παρακάτω." -#: library/stdtypes.rst:2066 +#: library/stdtypes.rst:2382 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -2497,14 +4513,46 @@ msgid "" "The *chars* argument is not a suffix; rather, all combinations of its values " "are stripped::" msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) με τους χαρακτήρες που " +"έχουν αφαιρεθεί. Τα όρισμα *chars* είναι μια συμβολοσειρά που καθορίζει το " +"σύνολο των χαρακτήρων που πρέπει να αφαιρεθούν. Εάν παραληφθεί ή είναι " +"``None``, το όρισμα *chars* έχει ως προεπιλογή την αφαίρεση των κενών " +"διαστημάτων. Το όρισμα *chars* δεν είναι suffix, αλλά όλοι οι συνδυασμοί " +"των τιμών του αφαιρούνται::" -#: library/stdtypes.rst:2076 +#: library/stdtypes.rst:2387 +msgid "" +">>> ' spacious '.rstrip()\n" +"' spacious'\n" +">>> 'mississippi'.rstrip('ipz')\n" +"'mississ'" +msgstr "" +">>> ' spacious '.rstrip()\n" +"' spacious'\n" +">>> 'mississippi'.rstrip('ipz')\n" +"'mississ'" + +#: library/stdtypes.rst:2392 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" +"Δείτε τη :meth:`str.removesuffix` για μια μέθοδο που θα αφαιρέσει ένα απλό " +"suffix αντί για όλο το σύνολο των χαρακτήρων. Για παράδειγμα::" -#: library/stdtypes.rst:2086 +#: library/stdtypes.rst:2395 +msgid "" +">>> 'Monty Python'.rstrip(' Python')\n" +"'M'\n" +">>> 'Monty Python'.removesuffix(' Python')\n" +"'Monty'" +msgstr "" +">>> 'Monty Python'.rstrip(' Python')\n" +"'M'\n" +">>> 'Monty Python'.removesuffix(' Python')\n" +"'Monty'" + +#: library/stdtypes.rst:2402 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -2512,25 +4560,59 @@ msgid "" "specified or ``-1``, then there is no limit on the number of splits (all " "possible splits are made)." msgstr "" +"Επιστρέφει μια λίστα με τις λέξεις της συμβολοσειράς (string), " +"χρησιμοποιώντας το *sep* ως διαχωριστικό. Αν δοθεί το *maxsplit*, γίνονται " +"το πολύ *maxsplit* διαχωρισμοί (έτσι, η λίστα θα έχει το πολύ ``maxsplit+1`` " +"στοιχεία). Εάν το *maxsplit* δεν καθοριστεί ή είναι ``-1``, τότε δεν " +"υπάρχει όριο στον αριθμό των διαχωρισμών (γίνονται όλες οι πιθανές " +"διασπάσεις)." -#: library/stdtypes.rst:2092 +#: library/stdtypes.rst:2408 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " "``['1', '', '2']``). The *sep* argument may consist of multiple characters " -"(for example, ``'1<>2<>3'.split('<>')`` returns ``['1', '2', '3']``). " -"Splitting an empty string with a specified separator returns ``['']``." -msgstr "" - -#: library/stdtypes.rst:2114 library/stdtypes.rst:2234 -#: library/stdtypes.rst:3149 library/stdtypes.rst:3256 -#: library/stdtypes.rst:3297 library/stdtypes.rst:3339 -#: library/stdtypes.rst:3371 library/stdtypes.rst:3421 -#: library/stdtypes.rst:3490 library/stdtypes.rst:3514 +"as a single delimiter (to split with multiple delimiters, use :func:`re." +"split`). Splitting an empty string with a specified separator returns " +"``['']``." +msgstr "" +"Αν δοθεί το *sep*, οι διαδοχικά οριοθέτες δεν ομαδοποιούνται μαζί και " +"θεωρείται ότι οριοθετούν κενές συμβολοσειρές (strings) (για παράδειγμα, το " +"``'1,,2'.split(',')`` επιστρέφει ``['1', '', '2']``). Το όρισμα *sep* " +"μπορεί να αποτελείται από πολλούς χαρακτήρες ως μεμονωμένο οριοθέτη (για " +"διαχωρισμό με πολλαπλούς οριοθέτες, χρησιμοποιήστε την :func:`re.split`). Ο " +"διαχωρισμός μιας κενής συμβολοσειράς με ένα καθορισμένο διαχωριστικό " +"επιστρέφει το ``['']``." + +#: library/stdtypes.rst:2433 library/stdtypes.rst:2499 +#: library/stdtypes.rst:2637 library/stdtypes.rst:3690 +#: library/stdtypes.rst:3796 library/stdtypes.rst:3835 +#: library/stdtypes.rst:3877 library/stdtypes.rst:3922 +#: library/stdtypes.rst:3972 library/stdtypes.rst:4038 msgid "For example::" -msgstr "" - -#: library/stdtypes.rst:2107 +msgstr "Για παράδειγμα::" + +#: library/stdtypes.rst:2417 +msgid "" +">>> '1,2,3'.split(',')\n" +"['1', '2', '3']\n" +">>> '1,2,3'.split(',', maxsplit=1)\n" +"['1', '2,3']\n" +">>> '1,2,,3,'.split(',')\n" +"['1', '2', '', '3', '']\n" +">>> '1<>2<>3<4'.split('<>')\n" +"['1', '2', '3<4']" +msgstr "" +">>> '1,2,3'.split(',')\n" +"['1', '2', '3']\n" +">>> '1,2,3'.split(',', maxsplit=1)\n" +"['1', '2,3']\n" +">>> '1,2,,3,'.split(',')\n" +"['1', '2', '', '3', '']\n" +">>> '1<>2<>3<4'.split('<>')\n" +"['1', '2', '3<4']" + +#: library/stdtypes.rst:2426 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -2539,140 +4621,241 @@ msgid "" "string or a string consisting of just whitespace with a ``None`` separator " "returns ``[]``." msgstr "" +"Αν το *sep* καθοριστεί ή είναι ``None``, εφαρμόζεται ένας διαφορετικός " +"αλγόριθμος διαχωρισμού: οι εμφανίσεις διαδοχικών κενών θεωρούνται ως ένα " +"ενιαίο διαχωριστικό, και το αποτέλεσμα δεν θα περιέχει κενές συμβολοσειρές " +"(strings) στην αρχή ή στο τέλος, αν η συμβολοσειρά έχει κενό διάστημα στην " +"αρχή ή στο τέλος. Κατά συνέπεια, η διάσπαση μιας κενής συμβολοσειράς ή μιας " +"συμβολοσειράς που αποτελείται μόνο από κενά διαστήματα με ένα ``None`` ως " +"διαχωριστικό επιστρέφει ``[]``." + +#: library/stdtypes.rst:2435 +msgid "" +">>> '1 2 3'.split()\n" +"['1', '2', '3']\n" +">>> '1 2 3'.split(maxsplit=1)\n" +"['1', '2 3']\n" +">>> ' 1 2 3 '.split()\n" +"['1', '2', '3']" +msgstr "" +">>> '1 2 3'.split()\n" +"['1', '2', '3']\n" +">>> '1 2 3'.split(maxsplit=1)\n" +"['1', '2 3']\n" +">>> ' 1 2 3 '.split()\n" +"['1', '2', '3']" + +#: library/stdtypes.rst:2442 +msgid "" +"If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " +"leading runs of consecutive whitespace are considered." +msgstr "" +"Εάν δεν καθοριστεί *sep* ή είναι ``None`` και το *maxsplit* είναι ``0``, " +"λαμβάνοντας υπόψη μόνο οι πρώτες εκτελέσεις διαδοχικού κενού διαστήματος." + +#: library/stdtypes.rst:2447 +msgid "" +">>> \"\".split(None, 0)\n" +"[]\n" +">>> \" \".split(None, 0)\n" +"[]\n" +">>> \" foo \".split(maxsplit=0)\n" +"['foo ']" +msgstr "" +">>> \"\".split(None, 0)\n" +"[]\n" +">>> \" \".split(None, 0)\n" +"[]\n" +">>> \" foo \".split(maxsplit=0)\n" +"['foo ']" + +#: library/stdtypes.rst:2454 +msgid "See also :meth:`join`." +msgstr "Δείτε επίσης :meth:`join`." -#: library/stdtypes.rst:2129 +#: library/stdtypes.rst:2462 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" +"Επιστρέφει μια λίστα με τις γραμμές της συμβολοσειράς (string), " +"διαχωρίζοντας στα όρια των γραμμών. Τα διαχωριστικά των γραμμών δεν " +"περιλαμβάνονται στην νέα λίστα, εκτός αν δοθεί το *keepends* και είναι true." -#: library/stdtypes.rst:2133 +#: library/stdtypes.rst:2466 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" +"Αυτή η μέθοδος διαχωρίζει στα ακόλουθα όρια γραμμών. Πιο συγκεκριμένα, τα " +"όρια είναι ένα υπερσύνολο του :term:`universal newlines`." -#: library/stdtypes.rst:2137 +#: library/stdtypes.rst:2470 msgid "Representation" -msgstr "" +msgstr "Αναπαράσταση" -#: library/stdtypes.rst:2137 +#: library/stdtypes.rst:2470 msgid "Description" -msgstr "" +msgstr "Περιγραφή" -#: library/stdtypes.rst:2139 +#: library/stdtypes.rst:2472 msgid "``\\n``" -msgstr "" +msgstr "``\\n``" -#: library/stdtypes.rst:2139 +#: library/stdtypes.rst:2472 msgid "Line Feed" -msgstr "" +msgstr "Line Feed" -#: library/stdtypes.rst:2141 +#: library/stdtypes.rst:2474 msgid "``\\r``" -msgstr "" +msgstr "``\\r``" -#: library/stdtypes.rst:2141 +#: library/stdtypes.rst:2474 msgid "Carriage Return" -msgstr "" +msgstr "Carriage Return" -#: library/stdtypes.rst:2143 +#: library/stdtypes.rst:2476 msgid "``\\r\\n``" -msgstr "" +msgstr "``\\r\\n``" -#: library/stdtypes.rst:2143 +#: library/stdtypes.rst:2476 msgid "Carriage Return + Line Feed" -msgstr "" +msgstr "Carriage Return + Line Feed" -#: library/stdtypes.rst:2145 +#: library/stdtypes.rst:2478 msgid "``\\v`` or ``\\x0b``" -msgstr "" +msgstr "``\\v`` or ``\\x0b``" -#: library/stdtypes.rst:2145 +#: library/stdtypes.rst:2478 msgid "Line Tabulation" -msgstr "" +msgstr "Line Tabulation" -#: library/stdtypes.rst:2147 +#: library/stdtypes.rst:2480 msgid "``\\f`` or ``\\x0c``" -msgstr "" +msgstr "``\\f`` or ``\\x0c``" -#: library/stdtypes.rst:2147 +#: library/stdtypes.rst:2480 msgid "Form Feed" -msgstr "" +msgstr "Form Feed" -#: library/stdtypes.rst:2149 +#: library/stdtypes.rst:2482 msgid "``\\x1c``" -msgstr "" +msgstr "``\\x1c``" -#: library/stdtypes.rst:2149 +#: library/stdtypes.rst:2482 msgid "File Separator" -msgstr "" +msgstr "Διαχωριστής Αρχείου" -#: library/stdtypes.rst:2151 +#: library/stdtypes.rst:2484 msgid "``\\x1d``" -msgstr "" +msgstr "``\\x1d``" -#: library/stdtypes.rst:2151 +#: library/stdtypes.rst:2484 msgid "Group Separator" -msgstr "" +msgstr "Διαχωριστής Group" -#: library/stdtypes.rst:2153 +#: library/stdtypes.rst:2486 msgid "``\\x1e``" -msgstr "" +msgstr "``\\x1e``" -#: library/stdtypes.rst:2153 +#: library/stdtypes.rst:2486 msgid "Record Separator" -msgstr "" +msgstr "Διαχωριστής Εγγραφών" -#: library/stdtypes.rst:2155 +#: library/stdtypes.rst:2488 msgid "``\\x85``" -msgstr "" +msgstr "``\\x85``" -#: library/stdtypes.rst:2155 +#: library/stdtypes.rst:2488 msgid "Next Line (C1 Control Code)" -msgstr "" +msgstr "Επόμενη Γραμμή (C1 Control Code)" -#: library/stdtypes.rst:2157 +#: library/stdtypes.rst:2490 msgid "``\\u2028``" -msgstr "" +msgstr "``\\u2028``" -#: library/stdtypes.rst:2157 +#: library/stdtypes.rst:2490 msgid "Line Separator" -msgstr "" +msgstr "Διαχωριστής Γραμμής" -#: library/stdtypes.rst:2159 +#: library/stdtypes.rst:2492 msgid "``\\u2029``" -msgstr "" +msgstr "``\\u2029``" -#: library/stdtypes.rst:2159 +#: library/stdtypes.rst:2492 msgid "Paragraph Separator" -msgstr "" +msgstr "Διαχωριστής Παραγράφου" -#: library/stdtypes.rst:2164 +#: library/stdtypes.rst:2497 msgid "``\\v`` and ``\\f`` added to list of line boundaries." +msgstr "Τα ``\\v`` και ``\\f`` προστίθενται στην λίστα ορίων των γραμμών." + +#: library/stdtypes.rst:2501 +msgid "" +">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" +"['ab c', '', 'de fg', 'kl']\n" +">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" +"['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" msgstr "" +">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" +"['ab c', '', 'de fg', 'kl']\n" +">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" +"['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: library/stdtypes.rst:2173 +#: library/stdtypes.rst:2506 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" +"Σε αντίθεση με την :meth:`~str.split` όταν δίνεται μια συμβολοσειρά (string) " +"οριοθέτησης *sep*, αυτή η μέθοδος επιστρέφει μια κενή λίστα για το κενό " +"αλφαριθμητικό, και μια τερματικό break γραμμής δεν οδηγεί σε μια επιπλέον " +"γραμμή::" + +#: library/stdtypes.rst:2510 +msgid "" +">>> \"\".splitlines()\n" +"[]\n" +">>> \"One line\\n\".splitlines()\n" +"['One line']" +msgstr "" +">>> \"\".splitlines()\n" +"[]\n" +">>> \"One line\\n\".splitlines()\n" +"['One line']" -#: library/stdtypes.rst:2182 +#: library/stdtypes.rst:2515 msgid "For comparison, ``split('\\n')`` gives::" +msgstr "Συγκριτικά, η ``split('\\n')`` δίνει::" + +#: library/stdtypes.rst:2517 +msgid "" +">>> ''.split('\\n')\n" +"['']\n" +">>> 'Two lines\\n'.split('\\n')\n" +"['Two lines', '']" msgstr "" +">>> ''.split('\\n')\n" +"['']\n" +">>> 'Two lines\\n'.split('\\n')\n" +"['Two lines', '']" -#: library/stdtypes.rst:2192 +#: library/stdtypes.rst:2525 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " "optional *start*, test string beginning at that position. With optional " "*end*, stop comparing string at that position." msgstr "" +"Επιστρέφει ``True`` αν η συμβολοσειρά (string) αρχίζει με το *prefix*, " +"αλλιώς επιστρέφει ``False``. Το *prefix* μπορεί επίσης να είναι μια πλειάδα " +"(tuple) prefix προς αναζήτηση. Με το προαιρετικό *start*, ελέγχεται το " +"αλφαριθμητικό που αρχίζει από τη συγκεκριμένη θέση. Με το προαιρετικό " +"*end*, σταματά η σύγκριση της συμβολοσειράς σε αυτή τη θέση." -#: library/stdtypes.rst:2200 +#: library/stdtypes.rst:2533 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -2680,49 +4863,135 @@ msgid "" "removing whitespace. The *chars* argument is not a prefix or suffix; rather, " "all combinations of its values are stripped::" msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) με τους πρώτους και τους " +"τελευταίους χαρακτήρες να έχουν αφαιρεθεί. Το όρισμα *chars* είναι μια " +"συμβολοσειρά που καθορίζει το σύνολο των χαρακτήρων που πρέπει να " +"αφαιρεθούν. Εάν παραλειφθεί ή είναι ``None``, το όρισμα *chars* έχει ως " +"default την αφαίρεση των κενών διαστημάτων. Το όρισμα *chars* δεν είναι " +"prefix ή suffix· μάλλον, όλοι οι συνδυασμοί των τιμών του αφαιρούνται::" -#: library/stdtypes.rst:2211 +#: library/stdtypes.rst:2539 +msgid "" +">>> ' spacious '.strip()\n" +"'spacious'\n" +">>> 'www.example.com'.strip('cmowz.')\n" +"'example'" +msgstr "" +">>> ' spacious '.strip()\n" +"'spacious'\n" +">>> 'www.example.com'.strip('cmowz.')\n" +"'example'" + +#: library/stdtypes.rst:2544 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " "string character that is not contained in the set of characters in *chars*. " "A similar action takes place on the trailing end. For example::" msgstr "" +"Οι ακραίες αρχικές και τελικές τιμές του ορίσματος *chars* αφαιρούνται από " +"τη συμβολοσειρά (string). Οι χαρακτήρες αφαιρούνται από το μπροστινό άκρο " +"μέχρι να φτάσουν στο χαρακτήρα της συμβολοσειράς (string) που δεν περιέχεται " +"στο σύνολο χαρακτήρων του *chars*. Μια παρόμοια ενέργεια λαμβάνει χώρα στο " +"τέλος της ουράς. Για παράδειγμα:" -#: library/stdtypes.rst:2224 +#: library/stdtypes.rst:2550 +msgid "" +">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" +">>> comment_string.strip('.#! ')\n" +"'Section 3.2.1 Issue #32'" +msgstr "" +">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" +">>> comment_string.strip('.#! ')\n" +"'Section 3.2.1 Issue #32'" + +#: library/stdtypes.rst:2557 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) με κεφαλαίους χαρακτήρες " +"που έχουν μετατραπεί σε πεζούς και αντίστροφα. Σημειώστε ότι δεν είναι " +"απαραίτητα αληθές ότι ``s.swapcase().swapcase() == s``." -#: library/stdtypes.rst:2231 +#: library/stdtypes.rst:2564 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" +"Επιστρέφει μια titlecased έκδοση της συμβολοσειράς, όπου οι λέξεις ξεκινούν " +"με ένα κεφαλαίο χαρακτήρα και οι υπόλοιποι χαρακτήρες είναι πεζοί." + +#: library/stdtypes.rst:2569 +msgid "" +">>> 'Hello world'.title()\n" +"'Hello World'" +msgstr "" +">>> 'Hello world'.title()\n" +"'Hello World'" -#: library/stdtypes.rst:3458 +#: library/stdtypes.rst:3982 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " "means that apostrophes in contractions and possessives form word boundaries, " "which may not be the desired result::" msgstr "" +"Ο αλγόριθμος χρησιμοποιεί έναν απλό, ανεξάρτητο από τη γλώσσα, ορισμό μιας " +"λέξης ως group διαδοχικών γραμμάτων. Ο ορισμός λειτουργεί σε πολλά " +"contexts, αλλά σημαίνει ότι οι απόστροφοι σε συναιρέσεις και κτητικές λέξεις " +"αποτελούν όρια λέξεων, που μπορεί να μην είναι το επιθυμητό αποτέλεσμα::" + +#: library/stdtypes.rst:2577 +msgid "" +">>> \"they're bill's friends from the UK\".title()\n" +"\"They'Re Bill'S Friends From The Uk\"" +msgstr "" +">>> \"they're bill's friends from the UK\".title()\n" +"\"They'Re Bill'S Friends From The Uk\"" -#: library/stdtypes.rst:2247 +#: library/stdtypes.rst:2580 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" +"Η συνάρτηση :func:`string.capwords` δεν έχει αυτό το πρόβλημα, καθώς χωρίζει " +"τις λέξεις μόνο σε κενά." -#: library/stdtypes.rst:2250 +#: library/stdtypes.rst:2583 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" +"Εναλλακτικά, μπορεί να κατασκευαστεί μια λύση για τις αποστρόφους " +"χρησιμοποιώντας κανονικές εκφράσεις::" + +#: library/stdtypes.rst:2586 +msgid "" +">>> import re\n" +">>> def titlecase(s):\n" +"... return re.sub(r\"[A-Za-z]+('[A-Za-z]+)?\",\n" +"... lambda mo: mo.group(0).capitalize(),\n" +"... s)\n" +"...\n" +">>> titlecase(\"they're bill's friends.\")\n" +"\"They're Bill's Friends.\"" +msgstr "" +">>> import re\n" +">>> def titlecase(s):\n" +"... return re.sub(r\"[A-Za-z]+('[A-Za-z]+)?\",\n" +"... lambda mo: mo.group(0).capitalize(),\n" +"... s)\n" +"...\n" +">>> titlecase(\"they're bill's friends.\")\n" +"\"They're Bill's Friends.\"" + +#: library/stdtypes.rst:2595 +msgid "See also :meth:`istitle`." +msgstr "Δείτε επίσης :meth:`istitle`." -#: library/stdtypes.rst:2265 +#: library/stdtypes.rst:2600 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -2733,20 +5002,36 @@ msgid "" "delete the character from the return string; or raise a :exc:`LookupError` " "exception, to map the character to itself." msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) στο οποίο κάθε " +"χαρακτήρας έχει αντιστοιχιστεί μέσω του πίνακα μετάφρασης. Ο πίνακας πρέπει " +"να είναι ένα αντικείμενο που υλοποιεί ευρετηριοποίηση μέσω της :meth:" +"`~object.__getitem__`, συνήθως ένα :term:`mapping` ή ένα :term:`sequence`. " +"Όταν το indexing γίνεται με ένα Unicode ordinal (ένας ακέραιος), το " +"αντικείμενο του πίνακα μπορεί να κάνει οποιοδήποτε από τα ακόλουθα: να " +"επιστρέψει ένα Unicode ordinal ή μια συμβολοσειρά (string), να αντιστοιχίσει " +"τον χαρακτήρα σε έναν ή περισσότερους άλλους χαρακτήρες· να επιστρέψει " +"``None``, για να διαγράψει τον χαρακτήρα από τη συμβολοσειρά που " +"επιστρέφεται· ή να κάνει raise ένα :exc:`LookupError`, για να αντιστοιχίσει " +"τον χαρακτήρα στον εαυτό του." -#: library/stdtypes.rst:2274 +#: library/stdtypes.rst:2609 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" +"Μπορείτε να χρησιμοποιήσετε το :meth:`str.maketrans` για να δημιουργήσετε " +"ένα χάρτη μετάφρασης αντιστοίχισης από χαρακτήρα-σε-χαρακτήρα σε " +"διαφορετικές μορφές." -#: library/stdtypes.rst:2277 +#: library/stdtypes.rst:2612 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" +"Δείτε επίσης την ενότητα :mod:`codecs` για μια πιο ευέλικτη προσέγγιση σε " +"προσαρμοσμένα mappings χαρακτήρων." -#: library/stdtypes.rst:2283 +#: library/stdtypes.rst:2618 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -2754,438 +5039,845 @@ msgid "" "character(s) is not \"Lu\" (Letter, uppercase), but e.g. \"Lt\" (Letter, " "titlecase)." msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) με όλους τους χαρακτήρες " +"[4]_ που έχουν μετατραπεί σε κεφαλαία. Σημειώστε ότι το ``s.upper()." +"isupper()`` μπορεί να είναι ``False`` αν το ``s`` περιέχει χαρακτήρες χωρίς " +"πεζά γράμματα ή αν η κατηγορία Unicode του προκύπτοντος χαρακτήρα(ων) δεν " +"είναι \"Lu\" (Γράμμα, κεφαλαίο), αλλά π.χ. \"Lt\" (Γράμμα, titlecase)." -#: library/stdtypes.rst:2289 +#: library/stdtypes.rst:2624 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode16.0.0/core-spec/chapter-3/#G33992>`__." msgstr "" +"Ο αλγόριθμος που κάνει τα γράμματα κεφαλαία που χρησιμοποιείται " +"`περιγράφεται στην ενότητα 3.13 'Default Case Folding' του προτύπου Unicode " +"`__." -#: library/stdtypes.rst:2296 +#: library/stdtypes.rst:2631 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " "by inserting the padding *after* the sign character rather than before. The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" +"Επιστρέφει ένα αντίγραφο της συμβολοσειράς (string) που έμεινε γεμάτη με " +"ψηφία ASCII ``'0'``` για να δημιουργήσει μία συμβολοσειρά μήκους *width*. " +"Χειρίζεται ένα leading sign prefix (``'+'``/``'-'``) εισάγοντας την " +"συμπλήρωση *μετά* τον χαρακτήρα sign αντί για πριν. Η αρχική συμβολοσειρά " +"επιστρέφεται εάν το *width* είναι μικρότερο ή ίσο με ``len(s)``." -#: library/stdtypes.rst:2314 -msgid "``printf``-style String Formatting" +#: library/stdtypes.rst:2639 +msgid "" +">>> \"42\".zfill(5)\n" +"'00042'\n" +">>> \"-42\".zfill(5)\n" +"'-0042'" +msgstr "" +">>> \"42\".zfill(5)\n" +"'00042'\n" +">>> \"-42\".zfill(5)\n" +"'-0042'" + +#: library/stdtypes.rst:2660 +msgid "Formatted String Literals (f-strings)" +msgstr "Διαμορφωμένες Κυριολεκτικές Συμβολοσειρές (f-strings)" + +#: library/stdtypes.rst:2663 +msgid "" +"The :keyword:`await` and :keyword:`async for` can be used in expressions " +"within f-strings." +msgstr "" +"Τα :keyword:`await` και :keyword:`async for` μπορούν να χρησιμοποιηθούν σε " +"εκφράσεις μέσα σε f-strings." + +#: library/stdtypes.rst:2666 +msgid "Added the debugging operator (``=``)" +msgstr "Προστέθηκε ο τελεστής αποσφαλμάτωσης (``=``)" + +#: library/stdtypes.rst:2668 +msgid "" +"Many restrictions on expressions within f-strings have been removed. " +"Notably, nested strings, comments, and backslashes are now permitted." +msgstr "" +"Πολλοί περιορισμοί στις εκφράσεις μέσα σε f-strings έχουν αφαιρεθεί. " +"Ιδιαίτερα, πλέον επιτρέπονται οι εμφωλευμένες συμβολοσειρές, τα σχόλια και " +"οι κάθετοι." + +#: library/stdtypes.rst:2672 +msgid "" +"An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " +"literal that is prefixed with ``f`` or ``F``. This type of string literal " +"allows embedding arbitrary Python expressions within *replacement fields*, " +"which are delimited by curly brackets (``{}``). These expressions are " +"evaluated at runtime, similarly to :meth:`str.format`, and are converted " +"into regular :class:`str` objects. For example:" +msgstr "" +"Ένα :dfn:`f-string` (επίσημα ένα :dfn:`formatted string literal`) είναι μια " +"κυριολεκτική συμβολοσειρά που προεξέχει με ``f`` ή ``F``. Αυτός ο τύπος " +"κυριολεκτικής συμβολοσειράς επιτρέπει την ενσωμάτωση αυθαίρετων εκφράσεων " +"Python μέσα σε *πεδία αντικατάστασης*, τα οποία περιβάλλονται από αγκύλες " +"(``{}``). Αυτές οι εκφράσεις αξιολογούνται κατά την εκτέλεση, με παρόμοιο " +"τρόπο όπως η μέθοδος :meth:`str.format`, και μετατρέπονται σε κανονικά " +"αντικείμενα τύπου :class:`str`. Για παράδειγμα:" + +#: library/stdtypes.rst:2680 +msgid "" +">>> who = 'nobody'\n" +">>> nationality = 'Spanish'\n" +">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +"'Nobody expects the Spanish Inquisition!'" +msgstr "" +">>> who = 'nobody'\n" +">>> nationality = 'Spanish'\n" +">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +"'Nobody expects the Spanish Inquisition!'" + +#: library/stdtypes.rst:2687 +msgid "It is also possible to use a multi line f-string:" +msgstr "Είναι επίσης δυνατό να χρησιμοποιηθεί μια f-string πολλών γραμμών:" + +#: library/stdtypes.rst:2689 +msgid "" +">>> f'''This is a string\n" +"... on two lines'''\n" +"'This is a string\\non two lines'" +msgstr "" +">>> f'''This is a string\n" +"... on two lines'''\n" +"'This is a string\\non two lines'" + +#: library/stdtypes.rst:2695 +msgid "" +"A single opening curly bracket, ``'{'``, marks a *replacement field* that " +"can contain any Python expression:" +msgstr "" +"Ένα μόνο άνοιγμα αγκύλης, ``'{'``, δηλώνει ένα *πεδίο αντικατάστασης* που " +"μπορεί να περιέχει οποιαδήποτε έκφραση Python:" + +#: library/stdtypes.rst:2698 +msgid "" +">>> nationality = 'Spanish'\n" +">>> f'The {nationality} Inquisition!'\n" +"'The Spanish Inquisition!'" +msgstr "" +">>> nationality = 'Spanish'\n" +">>> f'The {nationality} Inquisition!'\n" +"'The Spanish Inquisition!'" + +#: library/stdtypes.rst:2704 +msgid "To include a literal ``{`` or ``}``, use a double bracket:" +msgstr "" +"Για να συμπεριλάβετε μια κυριολεξία ``{`` ή ``}``, χρησιμοποιήστε διπλή " +"αγκύλη:" + +#: library/stdtypes.rst:2706 +msgid "" +">>> x = 42\n" +">>> f'{{x}} is {x}'\n" +"'{x} is 42'" +msgstr "" +">>> x = 42\n" +">>> f'{{x}} is {x}'\n" +"'{x} is 42'" + +#: library/stdtypes.rst:2712 +msgid "" +"Functions can also be used, and :ref:`format specifiers `:" +msgstr "" +"Μπορούν επίσης να χρησιμοποιηθούν συναρτήσεις καθώς και :ref:`format " +"specifiers `:" + +#: library/stdtypes.rst:2714 +msgid "" +">>> from math import sqrt\n" +">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" +"'√2 ≈ 1.41421'" msgstr "" +">>> from math import sqrt\n" +">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" +"'√2 ≈ 1.41421'" -#: library/stdtypes.rst:2327 +#: library/stdtypes.rst:2720 +msgid "Any non-string expression is converted using :func:`str`, by default:" +msgstr "" +"Κάθε έκφραση μη-συμβολοσειράς μετατρέπεται χρησιμοποιώντας τη :func:`str`, " +"από προεπιλογή:" + +#: library/stdtypes.rst:2722 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 3)}'\n" +"'1/3'" +msgstr "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 3)}'\n" +"'1/3'" + +#: library/stdtypes.rst:2728 +msgid "" +"To use an explicit conversion, use the ``!`` (exclamation mark) operator, " +"followed by any of the valid formats, which are:" +msgstr "" +"Για να χρησιμοποιήσετε ρητή μετατροπή, χρησιμοποιήστε τον τελεστή ``!`` " +"(θαυμαστικό), ακολουθούμενο από οποιεσδήποτε από τις έγκυρες μορφές, τα " +"οποία είναι:" + +#: library/stdtypes.rst:2901 library/stdtypes.rst:4161 +msgid "Conversion" +msgstr "Μετατροπή" + +#: library/stdtypes.rst:2734 +msgid "``!a``" +msgstr "``!a``" + +#: library/stdtypes.rst:2734 +msgid ":func:`ascii`" +msgstr ":func:`ascii`" + +#: library/stdtypes.rst:2735 +msgid "``!r``" +msgstr "``!r``" + +#: library/stdtypes.rst:2735 +msgid ":func:`repr`" +msgstr ":func:`repr`" + +#: library/stdtypes.rst:2736 +msgid "``!s``" +msgstr "``!s``" + +#: library/stdtypes.rst:2736 +msgid ":func:`str`" +msgstr ":func:`str`" + +#: library/stdtypes.rst:2741 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 3)!s}'\n" +"'1/3'\n" +">>> f'{Fraction(1, 3)!r}'\n" +"'Fraction(1, 3)'\n" +">>> question = '¿Dónde está el Presidente?'\n" +">>> print(f'{question!a}')\n" +"'\\xbfD\\xf3nde est\\xe1 el Presidente?'" +msgstr "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 3)!s}'\n" +"'1/3'\n" +">>> f'{Fraction(1, 3)!r}'\n" +"'Fraction(1, 3)'\n" +">>> question = '¿Dónde está el Presidente?'\n" +">>> print(f'{question!a}')\n" +"'\\xbfD\\xf3nde est\\xe1 el Presidente?'" + +#: library/stdtypes.rst:2752 +msgid "" +"While debugging it may be helpful to see both the expression and its value, " +"by using the equals sign (``=``) after the expression. This preserves spaces " +"within the brackets, and can be used with a converter. By default, the " +"debugging operator uses the :func:`repr` (``!r``) conversion. For example:" +msgstr "" +"Κατά την αποσφαλμάτωση, μπορεί να είναι χρήσιμο να βλέπουμε τόσο την έκφραση " +"όσο και την τιμή της, χρησιμοποιώντας το σύμβολο του ίσου (``=``) μετά την " +"έκφραση. Αυτό διατηρεί τα κενά μέσα στις αγκύλες και μπορείς να " +"χρησιμοποιηθεί με έναν μετατροπέα. Από προεπιλογή, ο χειριστής " +"αποσφαλμάτωσης χρησιμοποιεί τη μετατροπή :func:`repr` (``!r``). Για " +"παράδειγμα:" + +#: library/stdtypes.rst:2758 +msgid "" +">>> from fractions import Fraction\n" +">>> calculation = Fraction(1, 3)\n" +">>> f'{calculation=}'\n" +"'calculation=Fraction(1, 3)'\n" +">>> f'{calculation = }'\n" +"'calculation = Fraction(1, 3)'\n" +">>> f'{calculation = !s}'\n" +"'calculation = 1/3'" +msgstr "" +">>> from fractions import Fraction\n" +">>> calculation = Fraction(1, 3)\n" +">>> f'{calculation=}'\n" +"'calculation=Fraction(1, 3)'\n" +">>> f'{calculation = }'\n" +"'calculation = Fraction(1, 3)'\n" +">>> f'{calculation = !s}'\n" +"'calculation = 1/3'" + +#: library/stdtypes.rst:2769 +msgid "" +"Once the output has been evaluated, it can be formatted using a :ref:`format " +"specifier ` following a colon (``':'``). After the expression " +"has been evaluated, and possibly converted to a string, the :meth:`!" +"__format__` method of the result is called with the format specifier, or the " +"empty string if no format specifier is given. The formatted result is then " +"used as the final value for the replacement field. For example:" +msgstr "" +"Μόλις η έξοδος έχει αξιολογηθεί, μπορεί να μορφοποιηθεί χρησιμοποιώντας ένα :" +"ref:`format specifier ` που ακολουθείται από άνω και κάτω " +"τελεία (``':'``). Αφού η έκφραση έχει αξιολογηθεί και, πιθανώς μετατραπεί σε " +"συμβολοσειρά, καλείται η μέθοδος :meth:`!__format__` του αποτελέσματος με " +"τον καθοριστή μορφοποίησης, ή η κενή συμβολοσειρά αν δεν έχει δοθεί " +"καθοριστής μορφοποίησης. Το μορφοποιημένο αποτέλεσμα χρησιμοποιείται στη " +"συνέχεια ως η τελική τιμή για το πεδίο αντικατάστασης. Για παράδειγμα:" + +#: library/stdtypes.rst:2777 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 7):.6f}'\n" +"'0.142857'\n" +">>> f'{Fraction(1, 7):_^+10}'\n" +"'___+1/7___'" +msgstr "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 7):.6f}'\n" +"'0.142857'\n" +">>> f'{Fraction(1, 7):_^+10}'\n" +"'___+1/7___'" + +#: library/stdtypes.rst:2789 +msgid "``printf``-style String Formatting" +msgstr "``printf``-style String Formatting" + +#: library/stdtypes.rst:2802 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " -"dictionaries correctly). Using the newer :ref:`formatted string literals `, the :meth:`str.format` interface, or :ref:`template strings " -"` may help avoid these errors. Each of these alternatives " -"provides their own trade-offs and benefits of simplicity, flexibility, and/" -"or extensibility." +"dictionaries correctly)." msgstr "" +"Οι λειτουργίες μορφοποίησης που περιγράφονται εδώ παρουσιάζουν μια ποικιλία " +"ιδιορρυθμιών που οδηγούν σε μια σειρά από κοινά σφάλματα (όπως η αποτυχία " +"εμφάνισης των πλειάδων και των λεξικών σωστά)." -#: library/stdtypes.rst:2335 +#: library/stdtypes.rst:2806 +msgid "" +"Using :ref:`formatted string literals `, the :meth:`str.format` " +"interface, or :class:`string.Template` may help avoid these errors. Each of " +"these alternatives provides their own trade-offs and benefits of simplicity, " +"flexibility, and/or extensibility." +msgstr "" +"Η χρήση των :ref:`formatted string literals `, της διεπαφής :meth:" +"`str.format` ή της :class:`string.Template` μπορεί να βοηθήσει στην αποφυγή " +"αυτών των σφαλμάτων. Καθεμία από αυτές τις εναλλακτικές προσφέρει τους " +"δικούς της συμβιβασμούς και πλεονεκτήματα ως προς την απλότητα, την ευελιξία " +"και/ή την επεκτασιμότητα." + +#: library/stdtypes.rst:2811 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " "operator. Given ``format % values`` (where *format* is a string), ``%`` " "conversion specifications in *format* are replaced with zero or more " "elements of *values*. The effect is similar to using the :c:func:`sprintf` " -"in the C language." +"function in the C language. For example:" +msgstr "" +"Τα αντικείμενα string έχουν μια μοναδική ενσωματωμένη λειτουργία: τον " +"τελεστή ``%`` (modulo). Αυτός είναι επίσης γνωστός ως τελεστής *formatting* " +"ή * interpolation*. Δεδομένων των ``format % values`` (όπου *format* είναι " +"μία συμβολοσειρά), ``%`` οι προδιαγραφές μετατροπής στο *format* " +"αντικαθίστανται από μηδέν ή περισσότερα στοιχεία των *values*. Το αποτέλεσμα " +"είναι παρόμοιο με τη χρήση του :c:func:`sprintf` στη γλώσσα C. Για " +"παράδειγμα:" + +#: library/stdtypes.rst:2818 +msgid "" +">>> print('%s has %d quote types.' % ('Python', 2))\n" +"Python has 2 quote types." msgstr "" +">>> print('%s has %d quote types.' % ('Python', 2))\n" +"Python has 2 quote types." -#: library/stdtypes.rst:2341 +#: library/stdtypes.rst:2823 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " "items specified by the format string, or a single mapping object (for " "example, a dictionary)." msgstr "" +"Εάν το *format* απαιτεί ένα μεμονωμένο όρισμα, το *values* μπορεί να είναι " +"ένα μεμονωμένο non-tuple αντικείμενο. [5]_ Διαφορετικά, τα *values* πρέπει " +"να είναι ένα tuple με ακριβώς τον ίδιο αριθμό των στοιχείων που καθορίζονται " +"από το format string ή ένα μεμονωμένο αντικείμενο αντιστοίχισης (για " +"παράδειγμα, ένα λεξικό)." -#: library/stdtypes.rst:3569 +#: library/stdtypes.rst:4093 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" +"Ένας προσδιοριστής μετατροπής περιέχει δύο ή περισσότερους χαρακτήρες και " +"έχει τους εξής components, οι οποίοι πρέπει να εμφανίζονται με αυτή τη σειρά:" -#: library/stdtypes.rst:3572 +#: library/stdtypes.rst:4096 msgid "The ``'%'`` character, which marks the start of the specifier." -msgstr "" +msgstr "Ο χαρακτήρας ```%''``, που σηματοδοτεί την αρχή του προσδιοριστή." -#: library/stdtypes.rst:3574 +#: library/stdtypes.rst:4098 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" +"Κλειδί mapping (προαιρετικό), που αποτελείται από μια ακολουθία χαρακτήρων " +"σε παρένθεση (για παράδειγμα, ``(somename)``)." -#: library/stdtypes.rst:3577 +#: library/stdtypes.rst:4101 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" +"Δείκτες μετατροπής (προαιρετικό), που επηρεάζουν το αποτέλεσμα κάποιων τύπων " +"μετατροπής." -#: library/stdtypes.rst:3580 +#: library/stdtypes.rst:4104 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" +"Ελάχιστο πλάτος πεδίου (προαιρετικό). Εάν ορίζεται ως ``'*'`` (αστερίσκος), " +"το πραγματικό πλάτος διαβάζεται από το επόμενο στοιχείο του tuple στα " +"*values*, και το αντικείμενο προς μετατροπή έρχεται μετά από το ελάχιστο " +"πλάτος πεδίου και το προαιρετικό precision." -#: library/stdtypes.rst:3584 +#: library/stdtypes.rst:4108 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " "next element of the tuple in *values*, and the value to convert comes after " "the precision." msgstr "" +"Ακρίβεια (προαιρετικό), δίνεται ως ``'.'`` (τελεία) ακολουθούμενη από το " +"precision.Εάν ορίζεται ως ``'*'`` (αστερίσκος), το πραγματικό precision " +"διαβάζεται από το επόμενο στοιχείο του tuple στα *values*, και η τιμή προς " +"μετατροπή έρχεται μετά το precision." -#: library/stdtypes.rst:3589 +#: library/stdtypes.rst:4113 msgid "Length modifier (optional)." -msgstr "" +msgstr "Μετατροπέας του length (προαιρετικό)." -#: library/stdtypes.rst:3591 +#: library/stdtypes.rst:4115 msgid "Conversion type." -msgstr "" +msgstr "Τύπος conversion." -#: library/stdtypes.rst:2375 +#: library/stdtypes.rst:2857 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " "dictionary inserted immediately after the ``'%'`` character. The mapping key " "selects the value to be formatted from the mapping. For example:" msgstr "" +"Όταν το σωστό όρισμα είναι ένα λεξικό (ή άλλος τύπος αντιστοίχισης), τότε οι " +"μορφές στη συμβολοσειρά *πρέπει* να περιλαμβάνουν ένα κλειδί αντιστοίχισης " +"σε παρένθεση σε αυτό το λεξικό που εισήχθη αμέσως μετά τον χαρακτήρα " +"``'%'``. Το κλειδί αντιστοίχισης επιλέγει την τιμή που θα μορφοποιηθεί από " +"την αντιστοίχιση. Για παράδειγμα:" -#: library/stdtypes.rst:3602 +#: library/stdtypes.rst:4126 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" +"Σε αυτήν την περίπτωση δεν μπορεί να υπάρχουν προσδιοριστές ``*`` σε μια " +"μορφή (καθώς απαιτούν μια διαδοχική λίστα παραμέτρων)." -#: library/stdtypes.rst:3605 +#: library/stdtypes.rst:4129 msgid "The conversion flag characters are:" -msgstr "" +msgstr "Οι δείκτες μετατροπής είναι:" -#: library/stdtypes.rst:3614 +#: library/stdtypes.rst:4138 msgid "Flag" -msgstr "" +msgstr "Flag" -#: library/stdtypes.rst:3616 +#: library/stdtypes.rst:4140 msgid "``'#'``" -msgstr "" +msgstr "``'#'``" -#: library/stdtypes.rst:3616 +#: library/stdtypes.rst:4140 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" +"Οι μετατροπή τιμής θα χρησιμοποιήσει την \"εναλλακτική φόρμα\" (όπου " +"ορίζεται παρακάτω)." -#: library/stdtypes.rst:3619 +#: library/stdtypes.rst:4143 msgid "``'0'``" -msgstr "" +msgstr "``'0'``" -#: library/stdtypes.rst:3619 +#: library/stdtypes.rst:4143 msgid "The conversion will be zero padded for numeric values." -msgstr "" +msgstr "Η μετατροπή θα έχει μηδενική συμπλήρωση για αριθμητικές τιμές." -#: library/stdtypes.rst:3621 +#: library/stdtypes.rst:4145 msgid "``'-'``" -msgstr "" +msgstr "``'-'``" -#: library/stdtypes.rst:3621 +#: library/stdtypes.rst:4145 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" +"Η τιμή μετατροπής αφήνεται προσαρμοσμένη (παρακάμπτει τη μετατροπή ``'0'`` " +"εάν δίνονται και τα δύο)." -#: library/stdtypes.rst:3624 +#: library/stdtypes.rst:4148 msgid "``' '``" -msgstr "" +msgstr "``' '``" -#: library/stdtypes.rst:3624 +#: library/stdtypes.rst:4148 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" +"(ένα κενό) Πρέπει να προστεθεί ένα κενό πριν από έναν θετικό αριθμό (ή κενή " +"συμβολοσειρά) που παράγεται από μια υπογεγραμμένη μετατροπή." -#: library/stdtypes.rst:3627 +#: library/stdtypes.rst:4151 msgid "``'+'``" -msgstr "" +msgstr "``'+'``" -#: library/stdtypes.rst:3627 +#: library/stdtypes.rst:4151 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" +"Ένα χαρακτήρας προσήμου (``'+'`` ή ``'-'``) θα προηγείται της μετατροπής " +"(παρακάμπτει ένα \"κενό\" δείκτη)." -#: library/stdtypes.rst:3631 +#: library/stdtypes.rst:4155 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" +"Ένας τροποποιητής μήκους (``h``, ``l``, or ``L``) μπορεί να υπάρχει, αλλά " +"αγνοείται καθώς δεν είναι απαραίτητος για την Python -- οπότε π.χ. ``%ld`` " +"είναι πανομοιότυπο σε ``%d``." -#: library/stdtypes.rst:3634 +#: library/stdtypes.rst:4158 msgid "The conversion types are:" -msgstr "" - -#: library/stdtypes.rst:3637 -msgid "Conversion" -msgstr "" +msgstr "Οι τύποι μετατροπής είναι:" -#: library/stdtypes.rst:3639 +#: library/stdtypes.rst:4163 msgid "``'d'``" -msgstr "" +msgstr "``'d'``" -#: library/stdtypes.rst:2423 library/stdtypes.rst:3641 +#: library/stdtypes.rst:2905 library/stdtypes.rst:4165 msgid "Signed integer decimal." -msgstr "" +msgstr "Υπογεγραμμένος δεκαδικός ακέραιος." -#: library/stdtypes.rst:3641 +#: library/stdtypes.rst:4165 msgid "``'i'``" -msgstr "" +msgstr "``'i'``" -#: library/stdtypes.rst:3643 +#: library/stdtypes.rst:4167 msgid "``'o'``" -msgstr "" +msgstr "``'o'``" -#: library/stdtypes.rst:3643 +#: library/stdtypes.rst:4167 msgid "Signed octal value." -msgstr "" +msgstr "Υπογεγραμμένη οκταδική τιμή." -#: library/stdtypes.rst:3645 +#: library/stdtypes.rst:4169 msgid "``'u'``" -msgstr "" +msgstr "``'u'``" -#: library/stdtypes.rst:3645 +#: library/stdtypes.rst:4169 msgid "Obsolete type -- it is identical to ``'d'``." -msgstr "" +msgstr "Απαρχαιωμένος τύπος -- είναι πανομοιότυπος με το ``'d'``." -#: library/stdtypes.rst:3647 +#: library/stdtypes.rst:4171 msgid "``'x'``" -msgstr "" +msgstr "``'x'``" -#: library/stdtypes.rst:3647 +#: library/stdtypes.rst:4171 msgid "Signed hexadecimal (lowercase)." -msgstr "" +msgstr "Υπογεγραμμένο δεκαεξαδικό (πεζά)." -#: library/stdtypes.rst:3649 +#: library/stdtypes.rst:4173 msgid "``'X'``" -msgstr "" +msgstr "``'X'``" -#: library/stdtypes.rst:3649 +#: library/stdtypes.rst:4173 msgid "Signed hexadecimal (uppercase)." -msgstr "" +msgstr "Υπογεγραμμένο δεκαεξαδικό (κεφαλαίο)." -#: library/stdtypes.rst:3651 +#: library/stdtypes.rst:4175 msgid "``'e'``" -msgstr "" +msgstr "``'e'``" -#: library/stdtypes.rst:3651 -msgid "Floating point exponential format (lowercase)." -msgstr "" +#: library/stdtypes.rst:4175 +msgid "Floating-point exponential format (lowercase)." +msgstr "Εκθετική μορφή κινητής υποδιαστολής (πεζά)" -#: library/stdtypes.rst:3653 +#: library/stdtypes.rst:4177 msgid "``'E'``" -msgstr "" +msgstr "``'E'``" -#: library/stdtypes.rst:3653 -msgid "Floating point exponential format (uppercase)." -msgstr "" +#: library/stdtypes.rst:4177 +msgid "Floating-point exponential format (uppercase)." +msgstr "Εκθετική μορφή κινητής υποδιαστολής (κεφαλαία)" -#: library/stdtypes.rst:3655 +#: library/stdtypes.rst:4179 msgid "``'f'``" -msgstr "" +msgstr "``'f'``" -#: library/stdtypes.rst:2439 library/stdtypes.rst:3657 -msgid "Floating point decimal format." -msgstr "" +#: library/stdtypes.rst:2921 library/stdtypes.rst:4181 +msgid "Floating-point decimal format." +msgstr "Δεκαδική μορφή κινητής υποδιαστολής." -#: library/stdtypes.rst:3657 +#: library/stdtypes.rst:4181 msgid "``'F'``" -msgstr "" +msgstr "``'F'``" -#: library/stdtypes.rst:3659 +#: library/stdtypes.rst:4183 msgid "``'g'``" -msgstr "" +msgstr "``'g'``" -#: library/stdtypes.rst:3659 +#: library/stdtypes.rst:4183 msgid "" -"Floating point format. Uses lowercase exponential format if exponent is less " +"Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" +"Μορφή κινητής υποδιαστολής. Χρησιμοποιεί εκθετική μορφή πεζών αν ο εκθέτης " +"είναι μικρότερος από -4 ή όχι μικρότερος από την ακρίβεια, διαφορετικά " +"χρησιμοποιεί δεκαδική μορφή." -#: library/stdtypes.rst:3663 +#: library/stdtypes.rst:4187 msgid "``'G'``" -msgstr "" +msgstr "``'G'``" -#: library/stdtypes.rst:3663 +#: library/stdtypes.rst:4187 msgid "" -"Floating point format. Uses uppercase exponential format if exponent is less " +"Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" +"Μορφή κινητής υποδιαστολής. Χρησιμοποιεί εκθετική μορφή κεφαλαίων εάν ο " +"εκθέτης είναι μικρότερος από -4 ή όχι μικρότερος από την ακρίβεια, " +"διαφορετικά χρησιμοποιεί δεκαδική μορφή." -#: library/stdtypes.rst:3667 +#: library/stdtypes.rst:4191 msgid "``'c'``" -msgstr "" +msgstr "``'c'``" -#: library/stdtypes.rst:2449 +#: library/stdtypes.rst:2931 msgid "Single character (accepts integer or single character string)." msgstr "" +"Μεμονωμένος χαρακτήρας (δέχεται ακέραιο ή μονό χαρακτήρα συμβολοσειράς)." -#: library/stdtypes.rst:3680 +#: library/stdtypes.rst:4204 msgid "``'r'``" -msgstr "" +msgstr "``'r'``" -#: library/stdtypes.rst:2452 +#: library/stdtypes.rst:2934 msgid "String (converts any Python object using :func:`repr`)." msgstr "" +"Συμβολοσειρά (μετατρέπει οποιοδήποτε αντικείμενο Python χρησιμοποιώντας :" +"func:`repr`)." -#: library/stdtypes.rst:3674 +#: library/stdtypes.rst:4198 msgid "``'s'``" -msgstr "" +msgstr "``'s'``" -#: library/stdtypes.rst:2455 +#: library/stdtypes.rst:2937 msgid "String (converts any Python object using :func:`str`)." msgstr "" +"Συμβολοσειρά (μετατρέπει οποιοδήποτε αντικείμενο Python χρησιμοποιώντας :" +"func:`str`)." -#: library/stdtypes.rst:3677 +#: library/stdtypes.rst:4201 msgid "``'a'``" -msgstr "" +msgstr "``'a'``" -#: library/stdtypes.rst:2458 +#: library/stdtypes.rst:2940 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" +"Συμβολοσειρά (μετατρέπει οποιοδήποτε αντικείμενο Python χρησιμοποιώντας :" +"func:`ascii`)." -#: library/stdtypes.rst:3683 +#: library/stdtypes.rst:4207 msgid "``'%'``" -msgstr "" +msgstr "``'%'``" -#: library/stdtypes.rst:3683 +#: library/stdtypes.rst:4207 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" +"Κανένα όρισμα δεν μετατρέπεται, έχει ως αποτέλεσμα έναν χαρακτήρα ``'%'`` το " +"αποτέλεσμα." -#: library/stdtypes.rst:3690 +#: library/stdtypes.rst:4214 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" +"Η εναλλακτική μορφή προκαλεί την εισαγωγή ενός πρώτου οκταδικού προσδιοριστή " +"(``'0o'``) πριν από το πρώτο ψηφίο." -#: library/stdtypes.rst:3694 +#: library/stdtypes.rst:4218 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" +"Η εναλλακτική φόρμα προκαλεί την εισαγωγή ενός αρχικού ``'0x'`` ή ``'0X'`` " +"(ανάλογα με το εάν χρησιμοποιήθηκε η μορφή ``'x'`` ή ``'X'``) πριν το πρώτο " +"ψηφίο." -#: library/stdtypes.rst:3698 +#: library/stdtypes.rst:4222 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" +"Η εναλλακτική μορφή κάνει το αποτέλεσμα να περιέχει πάντα μια υποδιαστολή, " +"ακόμα κι αν δεν ακολουθούν ψηφία." -#: library/stdtypes.rst:3701 +#: library/stdtypes.rst:4225 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" +"Η ακρίβεια καθορίζει τον αριθμό των ψηφίων μετά την υποδιαστολή και ορίζεται " +"από προεπιλογή ως 6." -#: library/stdtypes.rst:3705 +#: library/stdtypes.rst:4229 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" +"Η εναλλακτική μορφή κάνει το αποτέλεσμα να περιέχει πάντα μια υποδιαστολή " +"και τα μηδενικά στο τέλος δεν αφαιρούνται όπως θα ήταν διαφορετικά." -#: library/stdtypes.rst:3708 +#: library/stdtypes.rst:4232 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" +"Η ακρίβεια καθορίζει τον αριθμό των σημαντικών ψηφίων πριν και μετά την " +"υποδιαστολή και ορίζει το 6." -#: library/stdtypes.rst:3712 +#: library/stdtypes.rst:4236 msgid "If precision is ``N``, the output is truncated to ``N`` characters." -msgstr "" +msgstr "Εάν η ακρίβεια είναι ``N``, η έξοδος περικόπτεται σε ``N`` χαρακτήρες." -#: library/stdtypes.rst:3721 +#: library/stdtypes.rst:4245 msgid "See :pep:`237`." -msgstr "" +msgstr "Βλέπε :pep:`237`." -#: library/stdtypes.rst:2495 +#: library/stdtypes.rst:2977 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" +"Δεδομένου ότι οι συμβολοσειρές Python έχουν ρητό μήκος, οι ``%s`` μετατροπές " +"δεν υποθέτουν ότι το ``'\\0'`` είναι το τέλος της συμβολοσειράς." -#: library/stdtypes.rst:2500 +#: library/stdtypes.rst:2982 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" +"Οι μετατροπείς ``%f`` για αριθμούς των οποίων η απόλυτη τιμή είναι " +"μεγαλύτερη από 1e50 δεν αντικαθίστανται πλέον από μετατροπές ``%g``." -#: library/stdtypes.rst:2511 +#: library/stdtypes.rst:2993 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" +"Τύποι δυαδικής ακολουθίας --- :class:`bytes`, :class:`bytearray`, :class:" +"`memoryview`" -#: library/stdtypes.rst:2519 +#: library/stdtypes.rst:3001 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" "ref:`buffer protocol ` to access the memory of other binary " "objects without needing to make a copy." msgstr "" +"Οι βασικοί ενσωματωμένοι (built-in) τύποι για τον χειρισμό δυαδικών " +"δεδομένων είναι :class:`bytes` και :class:`bytearray`. Υποστηρίζονται από " +"τη :class:`memoryview` που χρησιμοποιεί το πρωτόκολλο :ref:`buffer protocol " +"` για την πρόσβαση στη μνήμη άλλων δυαδικών αντικειμένων " +"χωρίς να χρειάζεται η δημιουργία αντιγράφου." -#: library/stdtypes.rst:2524 +#: library/stdtypes.rst:3006 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" +"Το module :mod:`array` υποστηρίζει αποδοτική αποθήκευση για βασικούς τύπους " +"δεδομένων όπως 32-bit ακέραιους και IEEE754 διπλής ακρίβειας κινητής " +"υποδιαστολής τιμές." -#: library/stdtypes.rst:2530 +#: library/stdtypes.rst:3012 msgid "Bytes Objects" -msgstr "" +msgstr "Αντικείμενα Bytes" -#: library/stdtypes.rst:2534 +#: library/stdtypes.rst:3016 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " "several methods that are only valid when working with ASCII compatible data " "and are closely related to string objects in a variety of other ways." msgstr "" +"Τα αντικείμενα bytes είναι αμετάβλητες ακολουθίες μεμονωμένων bytes. " +"Δεδομένου ότι πολλά κύρια δυαδικά πρωτόκολλα βασίζονται στην κωδικοποίηση " +"κειμένου ASCII, τα αντικείμενα bytes προσφέρουν διάφορες μεθόδους που " +"ισχύουν μόνο όταν εργάζονται με δεδομένα συμβατά με ASCII και σχετίζονται " +"στενά με αντικείμενα συμβολοσειρών σε μια ποικιλία διαφόρων τρόπων." -#: library/stdtypes.rst:2541 +#: library/stdtypes.rst:3024 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" +"Πρώτον, η σύνταξη για τα bytes literals είναι σε μεγάλο βαθμό η ίδια με αυτή " +"για τα literals συμβολοσειρών, με τη διαφορά ότι προστίθεται ένα πρόθεμα " +"``b``::" -#: library/stdtypes.rst:2544 +#: library/stdtypes.rst:3027 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" +"Μονά εισαγωγικά: ``b'ακόμα επιτρέπει ενσωματωμένα \"διπλά\" εισαγωγικά'``" -#: library/stdtypes.rst:2545 +#: library/stdtypes.rst:3028 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" +"Διπλά εισαγωγικά: ``b\"εξακολουθεί να επιτρέπει ενσωματωμένα 'μονά' " +"εισαγωγικά\"``" -#: library/stdtypes.rst:2546 +#: library/stdtypes.rst:3029 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" +"Τριπλά εισαγωγικά: ``b'''3 μονά εισαγωγικά'''``, ``b\"\"\"3 διπλά " +"εισαγωγικά\"\"\"``" -#: library/stdtypes.rst:2548 +#: library/stdtypes.rst:3031 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" +"Επιτρέπονται μόνο χαρακτήρες ASCII σε bytes literals (ανεξάρτητα από τη " +"δηλωμένη κωδικοποίηση του πηγαίου κώδικα). Τυχόν δυαδικές τιμές, πάνω από " +"127, πρέπει να εισαχθούν σε bytes literals χρησιμοποιώντας την κατάλληλη " +"ακολουθία διαφυγής χαρακτήρων." -#: library/stdtypes.rst:2552 +#: library/stdtypes.rst:3035 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" +"Όπως και με τα literals συμβολοσειρών, τα bytes literals μπορούν επίσης να " +"χρησιμοποιήσουν ένα πρόθεμα ``r`` για να απενεργοποιήσουν την επεξεργασία " +"των ακολουθιών διαφυγής χαρακτήρων. Βλέπε :ref:`strings` για περισσότερες " +"πληροφορίες σχετικά με τις διάφορες μορφές bytes literal, " +"συμπεριλαμβανομένων των υποστηριζόμενων ακολουθιών διαφυγής χαρακτήρων." -#: library/stdtypes.rst:2556 +#: library/stdtypes.rst:3039 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -3197,63 +5889,99 @@ msgid "" "text processing algorithms to binary data formats that are not ASCII " "compatible will usually lead to data corruption)." msgstr "" +"Ενώ τα bytes literals και οι αναπαραστάσεις βασίζονται σε κείμενο ASCII, τα " +"αντικείμενα bytes συμπεριφέρονται στην πραγματικότητα σαν αμετάβλητες " +"ακολουθίες ακεραίων με κάθε τιμή στην ακολουθία περιορισμένη έτσι ώστε ``0 " +"<= x < 256`` (προσπάθειες παραβίασης αυτού του περιορισμού θα κάνουν raise " +"την :exc:`ValueError`). Αυτό γίνεται σκόπιμα για να τονιστεί ότι, ενώ πολλές " +"δυαδικές μορφές περιλαμβάνουν στοιχεία που βασίζονται σε ASCII και μπορούν " +"να χρησιμοποιηθούν χρήσιμα με ορισμένους αλγορίθμους προσανατολισμένους στο " +"κείμενο, αυτό δεν ισχύει γενικά για αυθαίρετα δυαδικά δεδομένα (τυφλή " +"εφαρμογή αλγορίθμων επεξεργασίας κειμένου σε δυαδικές μορφές δεδομένων που " +"δεν είναι συμβατές με ASCII συνήθως οδηγεί σε καταστροφή δεδομένων)." -#: library/stdtypes.rst:2566 +#: library/stdtypes.rst:3049 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" +"Εκτός από τις literal μορφές, τα αντικείμενα bytes μπορούν να δημιουργηθούν " +"με πολλούς άλλους τρόπους:" -#: library/stdtypes.rst:2569 +#: library/stdtypes.rst:3052 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" -msgstr "" +msgstr "Ένα μηδενικό αντικείμενο bytes με καθορισμένο μήκος: ``bytes(10)``" -#: library/stdtypes.rst:2570 +#: library/stdtypes.rst:3053 msgid "From an iterable of integers: ``bytes(range(20))``" -msgstr "" +msgstr "Από ένα iterable ακεραίων αριθμών: ``bytes(range(20))``" -#: library/stdtypes.rst:2571 +#: library/stdtypes.rst:3054 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" +"Αντιγραφή υπαρχόντων δυαδικών δεδομένων μέσω του πρωτοκόλλου buffer: " +"``bytes(obj)``" -#: library/stdtypes.rst:2573 +#: library/stdtypes.rst:3056 msgid "Also see the :ref:`bytes ` built-in." -msgstr "" +msgstr "Δείτε επίσης το ενσωματωμένο :ref:`bytes `." -#: library/stdtypes.rst:2575 +#: library/stdtypes.rst:3058 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " "Accordingly, the bytes type has an additional class method to read data in " "that format:" msgstr "" +"Δεδομένου ότι 2 δεκαεξαδικά ψηφία αντιστοιχούν ακριβώς σε ένα μόνο byte, οι " +"δεκαεξαδικοί αριθμοί είναι μια συνήθως χρησιμοποιούμενη μορφή για την " +"περιγραφή δυαδικών δεδομένων. Συνεπώς, ο τύπος bytes έχει μια πρόσθετη " +"μέθοδο κλάσης για την ανάγνωση δεδομένων σε αυτήν την μορφή:" -#: library/stdtypes.rst:2581 +#: library/stdtypes.rst:3064 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" +"Αυτή η μέθοδος κλάσης :class:`bytes` επιστρέφει ένα αντικείμενο bytes, " +"αποκωδικοποιώντας το δεδομένο αντικείμενο συμβολοσειράς. Η συμβολοσειρά " +"πρέπει να περιέχει δύο δεκαεξαδικά ψηφία ανά byte, με το κενό διάστημα ASCII " +"να αγνοείται." -#: library/stdtypes.rst:2588 +#: library/stdtypes.rst:3071 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" +"Το :meth:`bytes.fromhex` παρακάμπτει πλέον όλα τα κενά ASCII στη " +"συμβολοσειρά, όχι μόνο τα κενά." + +#: library/stdtypes.rst:3075 +msgid "" +":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " +"objects ` as input." +msgstr "" +"Η :meth:`bytes.fromhex` δέχεται πλέον ASCII :class:`bytes` και :term:`bytes-" +"like objects ` ως είσοδο." -#: library/stdtypes.rst:2592 +#: library/stdtypes.rst:3079 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" +"Υπάρχει μια συνάρτηση αντίστροφης μετατροπής για τη μετατροπή ενός " +"αντικειμένου bytes στην δεκαεξαδική του αναπαράσταση." -#: library/stdtypes.rst:2682 +#: library/stdtypes.rst:3176 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" +"Επιστρέφετε ένα αντικείμενο συμβολοσειράς που περιέχει δύο δεκαεξαδικά ψηφία " +"για κάθε byte στο στιγμιότυπο." -#: library/stdtypes.rst:2603 +#: library/stdtypes.rst:3091 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -3261,127 +5989,220 @@ msgid "" "*bytes_per_sep* parameter controls the spacing. Positive values calculate " "the separator position from the right, negative values from the left." msgstr "" +"Εάν θέλετε να κάνετε τη δεκαεξαδική συμβολοσειρά πιο ευανάγνωστη, μπορείτε " +"να καθορίσετε μια παράμετρο διαχωρισμού χαρακτήρων *sep* που θα " +"συμπεριληφθεί στην έξοδο. Από προεπιλογή, αυτό το διαχωριστικό θα " +"περιλαμβάνεται μεταξύ κάθε byte. Μια δεύτερη προαιρετική παράμετρος " +"*bytes_per_sep* ελέγχει τα διαστήματα. Οι θετικές τιμές υπολογίζουν τη θέση " +"του διαχωριστή από τα δεξιά, οι αρνητικές τιμές από τα αριστερά." -#: library/stdtypes.rst:2620 +#: library/stdtypes.rst:3108 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" +"Η :meth:`bytes.hex` υποστηρίζει πλέον προαιρετικές παραμέτρους *sep* και " +"*bytes_per_sep* για την εισαγωγή διαχωριστικών μεταξύ των byte στην έξοδο " +"δεκαεξαδικού." -#: library/stdtypes.rst:2624 +#: library/stdtypes.rst:3112 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " "object of length 1. (This contrasts with text strings, where both indexing " "and slicing will produce a string of length 1)" msgstr "" +"Δεδομένου ότι τα αντικείμενα bytes είναι ακολουθίες ακεραίων αριθμών (όμοια " +"με μια πλειάδα (tuple)), για ένα αντικείμενο bytes *b*, το ``b[0]`` θα είναι " +"ένας ακέραιος αριθμός, ενώ το ``b[0:1]`` θα είναι ένα αντικείμενο bytes " +"μήκους 1. (Αυτό έρχεται σε αντίθεση με τις συμβολοσειρές κειμένου, όπου τόσο " +"η λειτουργία πρόσβασης ως ευρετήριο όσο και η λειτουργία τμηματοποίησης θα " +"παράγουν μια συμβολοσειρά μήκους 1)" -#: library/stdtypes.rst:2629 +#: library/stdtypes.rst:3117 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" +"Η αναπαράσταση αντικειμένων bytes χρησιμοποιεί την literal μορφή " +"(``b'...'``) , καθώς είναι συχνά πιο χρήσιμη από π.χ. ``bytes([46, 46, " +"46])``. Μπορείτε πάντα να μετατρέψετε ένα αντικείμενο bytes σε μια λίστα " +"ακέραιων αριθμών που χρησιμοποιούν ``list(b)``." -#: library/stdtypes.rst:2637 +#: library/stdtypes.rst:3125 msgid "Bytearray Objects" -msgstr "" +msgstr "Αντικείμενα Bytearray" -#: library/stdtypes.rst:2641 +#: library/stdtypes.rst:3129 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" +"Τα αντικείμενα :class:`bytearray` είναι ένα μεταβλητό, αντίστοιχο, των " +"αντικειμένων :class:`bytes`." -#: library/stdtypes.rst:2646 +#: library/stdtypes.rst:3135 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" +"Δεν υπάρχει αποκλειστική literal σύνταξη για αντικείμενα bytearray, αντίθετα " +"δημιουργούνται πάντα καλώντας τον constructor:" -#: library/stdtypes.rst:2649 +#: library/stdtypes.rst:3138 msgid "Creating an empty instance: ``bytearray()``" -msgstr "" +msgstr "Δημιουργία ενός κενού στιγμιοτύπου: ``bytearray()``" -#: library/stdtypes.rst:2650 +#: library/stdtypes.rst:3139 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" -msgstr "" +msgstr "Δημιουργία μηδενικού στιγμιοτύπου με δεδομένο μήκος: ``bytearray(10)``" -#: library/stdtypes.rst:2651 +#: library/stdtypes.rst:3140 msgid "From an iterable of integers: ``bytearray(range(20))``" -msgstr "" +msgstr "Από έναν iterable αριθμό ακεραίων: ``bytearray(range(20))``" -#: library/stdtypes.rst:2652 +#: library/stdtypes.rst:3141 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" +"Αντιγραφή υπαρχόντων δυαδικών δεδομένων μέσω του πρωτοκόλλου buffer: " +"``bytearray(b'Hi!')``" -#: library/stdtypes.rst:2654 +#: library/stdtypes.rst:3143 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" +"Καθώς τα αντικείμενα του bytearray είναι μεταβλητά, υποστηρίζουν τις " +"λειτουργίες της ακολουθίας :ref:`mutable ` επιπλέον των " +"κοινών λειτουργιών bytes και bytearray που περιγράφονται στο :ref:`bytes-" +"methods`." -#: library/stdtypes.rst:2658 +#: library/stdtypes.rst:3147 msgid "Also see the :ref:`bytearray ` built-in." -msgstr "" +msgstr "Δείτε επίσης το ενσωματωμένο :ref:`bytearray `." -#: library/stdtypes.rst:2660 +#: library/stdtypes.rst:3149 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " "Accordingly, the bytearray type has an additional class method to read data " "in that format:" msgstr "" +"Δεδομένου ότι 2 δεκαεξαδικά ψηφία αντιστοιχούν ακριβώς σε ένα μόνο byte, οι " +"δεκαεξαδικοί αριθμοί είναι συνήθως χρησιμοποιούμενη μορφή για την περιγραφή " +"δυαδικών δεδομένων. Συνεπώς, ο τύπος bytearray έχει μια πρόσθετη μέθοδο " +"κλάσης για την ανάγνωση δεδομένων σε αυτήν την μορφή:" -#: library/stdtypes.rst:2666 +#: library/stdtypes.rst:3155 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" +"Αυτή η μέθοδος κλάσης :class:`bytearray` επιστρέφει αντικείμενο bytearray, " +"αποκωδικοποιώντας το δεδομένο αντικείμενο συμβολοσειράς. Η συμβολοσειρά " +"πρέπει να περιέχει δύο δεκαεξαδικά ψηφία ανά byte, με το κενό διάστημα ASCII " +"να αγνοείται." -#: library/stdtypes.rst:2673 +#: library/stdtypes.rst:3162 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" +"Το :meth:`bytearray.fromhex` παρακάμπτει τώρα όλα τα κενά ASCII στη " +"συμβολοσειρά, όχι μόνο τα κενά." + +#: library/stdtypes.rst:3166 +msgid "" +":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" +"like objects ` as input." +msgstr "" +"Η :meth:`bytearray.fromhex` δέχεται πλέον το ASCII :class:`bytes` και :term:" +"`bytes-like objects ` ως είσοδο." -#: library/stdtypes.rst:2677 +#: library/stdtypes.rst:3170 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" +"Υπάρχει μια συνάρτηση αντίστροφης μετατροπής για να μετατρέψει ένα " +"αντικείμενο bytearray στη δεκαεξαδική αναπαράσταση του." -#: library/stdtypes.rst:2690 +#: library/stdtypes.rst:3184 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" +"Παρόμοια με το :meth:`bytes.hex`, το :meth:`bytearray.hex` υποστηρίζει τώρα " +"προαιρετικές παραμέτρους *sep* και *bytes_per_sep* για την εισαγωγή " +"διαχωριστικών μεταξύ των byte στην δεκαεξαδική έξοδο." -#: library/stdtypes.rst:2695 +#: library/stdtypes.rst:3191 +msgid "" +"Resize the :class:`bytearray` to contain *size* bytes. *size* must be " +"greater than or equal to 0." +msgstr "" +"Αλλάζει το μέγεθος του :class:`bytearray` ώστε αν περιέχει *size* bytes. Το " +"*size* πρέπει να είναι μεγαλύτερο ή ίσο με το 0." + +#: library/stdtypes.rst:3194 +msgid "" +"If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." +msgstr "" +"Εάν η :class:`bytearray` χρειάζεται να συρρικνωθεί, τα bytes πέραν του " +"*size* περικόπτονται." + +#: library/stdtypes.rst:3196 +msgid "" +"If the :class:`bytearray` needs to grow, all new bytes, those beyond *size*, " +"will be set to null bytes." +msgstr "" +"Εάν η :class:`bytearray` χρειάζεται να αυξηθεί, όλα τα νέα bytes, αυτά που " +"είναι πέρα από το *size*, θα οριστούν σε null bytes." + +#: library/stdtypes.rst:3200 +msgid "This is equivalent to:" +msgstr "Ισοδύναμο με:" + +#: library/stdtypes.rst:3208 +msgid "Examples:" +msgstr "Παραδείγματα:" + +#: library/stdtypes.rst:3221 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " "a bytearray object of length 1. (This contrasts with text strings, where " "both indexing and slicing will produce a string of length 1)" msgstr "" +"Δεδομένου ότι τα αντικείμενα bytearray είναι ακολουθίες ακεραίων αριθμών " +"(παρόμοια με μια λίστα), για ένα αντικείμενο bytearray *b*, το ``b[0]`` θα " +"είναι ένας ακέραιος αριθμός, ενώ το ``b[0:1]`` θα είναι ένα αντικείμενο " +"bytearray μήκους 1. (Αυτό έρχεται σε αντίθεση με τις συμβολοσειρές " +"κειμένου, όπου τόσο το indexing και το slicing θα παράγουν μια συμβολοσειρά " +"μήκους 1)" -#: library/stdtypes.rst:2700 +#: library/stdtypes.rst:3226 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " "``bytearray([46, 46, 46])``. You can always convert a bytearray object into " "a list of integers using ``list(b)``." msgstr "" +"Η αναπαράσταση αντικειμένων bytearray χρησιμοποιεί τη μορφή bytes literal " +"(``bytearray(b'...')``), καθώς είναι συχνά πιο χρήσιμη από π.χ. " +"``bytearray([46, 46, 46])``. Μπορείτε πάντα να μετατρέψετε ένα αντικείμενο " +"bytearray σε λίστα ακεραίων χρησιμοποιώντας το ``list(b)``." -#: library/stdtypes.rst:2709 +#: library/stdtypes.rst:3235 msgid "Bytes and Bytearray Operations" -msgstr "" +msgstr "Λειτουργίες Bytes και Bytearray" -#: library/stdtypes.rst:2714 +#: library/stdtypes.rst:3240 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -3389,154 +6210,265 @@ msgid "" "can be freely mixed in operations without causing errors. However, the " "return type of the result may depend on the order of operands." msgstr "" +"Τόσο τα byte όσο και τα αντικείμενα του πίνακα byte υποστηρίζουν τις " +"λειτουργίες της ακολουθίας :ref:`common `. Αλληλεπιδρούν " +"όχι μόνο με τελεστές του ίδιου τύπου, αλλά και με οποιοδήποτε αντικείμενο :" +"term:`bytes-like object`. Λόγω αυτής της ευελιξίας, μπορούν να αναμειχθούν " +"ελεύθερα σε λειτουργίες χωρίς να προκαλούνται σφάλματα. Ωστόσο, ο τύπος " +"επιστροφής του αποτελέσματος μπορεί να εξαρτάται από τη σειρά των τελεστών." -#: library/stdtypes.rst:2722 +#: library/stdtypes.rst:3248 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" +"Οι μέθοδοι στα bytes και τα αντικείμενα bytearray δεν δέχονται συμβολοσειρές " +"ως ορίσματά τους, όπως και οι μέθοδοι σε συμβολοσειρές δεν δέχονται bytes ως " +"ορίσματα. Για παράδειγμα, πρέπει να γράψετε::" + +#: library/stdtypes.rst:3252 +msgid "" +"a = \"abc\"\n" +"b = a.replace(\"a\", \"f\")" +msgstr "" +"a = \"abc\"\n" +"b = a.replace(\"a\", \"f\")" -#: library/stdtypes.rst:2729 +#: library/stdtypes.rst:3255 msgid "and::" +msgstr "και::" + +#: library/stdtypes.rst:3257 +msgid "" +"a = b\"abc\"\n" +"b = a.replace(b\"a\", b\"f\")" msgstr "" +"a = b\"abc\"\n" +"b = a.replace(b\"a\", b\"f\")" -#: library/stdtypes.rst:2734 +#: library/stdtypes.rst:3260 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" +"Ορισμένες λειτουργίες byte και bytearray προϋποθέτουν τη χρήση δυαδικών " +"μορφών συμβατών με ASCII και, ως εκ τούτου, θα πρέπει να αποφεύγονται όταν " +"εργάζεστε με αυθαίρετα δυαδικά δεδομένα. Αυτοί οι περιορισμοί καλύπτονται " +"παρακάτω." -#: library/stdtypes.rst:2739 +#: library/stdtypes.rst:3265 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" +"Η χρήση αυτών των λειτουργιών βασίζονται στο ASCII για τον χειρισμό δυαδικών " +"δεδομένων που δεν είναι αποθηκευμένα σε μορφή που βασίζεται σε ASCII μπορεί " +"να οδηγήσει σε καταστροφή δεδομένων." -#: library/stdtypes.rst:2742 +#: library/stdtypes.rst:3268 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" +"Οι ακόλουθες μέθοδοι σε byte και αντικείμενα bytearray μπορούν να " +"χρησιμοποιηθούν με αυθαίρετα δυαδικά δεδομένα." -#: library/stdtypes.rst:2748 +#: library/stdtypes.rst:3274 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" +"Επιστρέφει τον αριθμό των μη επικαλυπτόμενων εμφανίσεων της δευτερεύουσας " +"ακολουθίας *sub* στο εύρος [*start*, *end*]. Τα προαιρετικά ορίσματα *start* " +"και *end* ερμηνεύονται όπως στη σημειογραφία τμηματοποίησης." -#: library/stdtypes.rst:2857 library/stdtypes.rst:2945 -#: library/stdtypes.rst:2958 +#: library/stdtypes.rst:3383 library/stdtypes.rst:3471 +#: library/stdtypes.rst:3484 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" +"Η υποακολουθία για αναζήτηση μπορεί να είναι οποιοδήποτε :term:`bytes-like " +"object` ή ένας ακέραιος αριθμός στην περιοχή από 0 έως 255." -#: library/stdtypes.rst:2755 +#: library/stdtypes.rst:3281 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" +"Εάν το *sub* είναι κενό, επιστρέφει τον αριθμό των κενών τμημάτων μεταξύ των " +"χαρακτήρων που είναι το μήκος του αντικειμένου bytes συν ένα." -#: library/stdtypes.rst:2869 library/stdtypes.rst:2948 -#: library/stdtypes.rst:2961 +#: library/stdtypes.rst:3395 library/stdtypes.rst:3474 +#: library/stdtypes.rst:3487 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" +"Επίσης αποδέχεται έναν ακέραιο αριθμό στο εύρος 0 έως 255 ως υποακολουθία." -#: library/stdtypes.rst:2765 +#: library/stdtypes.rst:3291 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" +"Εάν τα δυαδικά δεδομένα ξεκινούν με τη συμβολοσειρά *prefix*, επιστρέφει " +"``bytes[len(prefix):]``. Διαφορετικά επιστρέψτε ένα αντίγραφο των αρχικών " +"δυαδικών δεδομένων::" -#: library/stdtypes.rst:2774 -msgid "The *prefix* may be any :term:`bytes-like object`." +#: library/stdtypes.rst:3295 +msgid "" +">>> b'TestHook'.removeprefix(b'Test')\n" +"b'Hook'\n" +">>> b'BaseTestCase'.removeprefix(b'Test')\n" +"b'BaseTestCase'" msgstr "" +">>> b'TestHook'.removeprefix(b'Test')\n" +"b'Hook'\n" +">>> b'BaseTestCase'.removeprefix(b'Test')\n" +"b'BaseTestCase'" -#: library/stdtypes.rst:2800 library/stdtypes.rst:3026 -#: library/stdtypes.rst:3071 library/stdtypes.rst:3127 -#: library/stdtypes.rst:3215 library/stdtypes.rst:3382 -#: library/stdtypes.rst:3480 library/stdtypes.rst:3523 -#: library/stdtypes.rst:3725 +#: library/stdtypes.rst:3300 +msgid "The *prefix* may be any :term:`bytes-like object`." +msgstr "Το *prefix* μπορεί να είναι οποιοδήποτε :term:`bytes-like object`." + +#: library/stdtypes.rst:3326 library/stdtypes.rst:3552 +#: library/stdtypes.rst:3596 library/stdtypes.rst:3651 +#: library/stdtypes.rst:3739 library/stdtypes.rst:3906 +#: library/stdtypes.rst:4004 library/stdtypes.rst:4047 +#: library/stdtypes.rst:4249 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" +"Η έκδοση bytearray αυτής της μεθόδου *δεν* λειτουργεί στη θέση της - παράγει " +"πάντα ένα νέο αντικείμενο, ακόμα και αν δεν έγιναν αλλαγές." -#: library/stdtypes.rst:2787 +#: library/stdtypes.rst:3313 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" +"Εάν τα δυαδικά δεδομένα τελειώνουν με τη συμβολοσειρά *suffix* και αυτό το " +"*suffix* δεν είναι κενό, επιστρέφει ``bytes[:-len(suffix)]``. Διαφορετικά, " +"επιστρέφει ένα αντίγραφο των αρχικών δυαδικών δεδομένων::" -#: library/stdtypes.rst:2796 -msgid "The *suffix* may be any :term:`bytes-like object`." +#: library/stdtypes.rst:3317 +msgid "" +">>> b'MiscTests'.removesuffix(b'Tests')\n" +"b'Misc'\n" +">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" +"b'TmpDirMixin'" msgstr "" +">>> b'MiscTests'.removesuffix(b'Tests')\n" +"b'Misc'\n" +">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" +"b'TmpDirMixin'" + +#: library/stdtypes.rst:3322 +msgid "The *suffix* may be any :term:`bytes-like object`." +msgstr "Το *suffix* μπορεί να είναι οποιοδήποτε :term:`bytes-like object`." -#: library/stdtypes.rst:2809 +#: library/stdtypes.rst:3335 msgid "Return the bytes decoded to a :class:`str`." -msgstr "" +msgstr "Επιστρέφει τα bytes που έχουν αποκωδικοποιηθεί σε μια :class:`str`." -#: library/stdtypes.rst:2814 +#: library/stdtypes.rst:3340 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " "are ``'ignore'``, ``'replace'``, and any other name registered via :func:" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" +"Το *errors* ελέγχει τον τρόπο χειρισμού των σφαλμάτων αποκωδικοποίησης. Εάν " +"``'strict'`` (η προεπιλογή), γίνεται raise μια εξαίρεση :exc:`UnicodeError`. " +"Άλλες πιθανές τιμές είναι το ``'ignore'``, ``'replace'``, και οποιοδήποτε " +"άλλο όνομα που έχει καταχωρηθεί από την :func:`codecs.register_error`. " +"Βλέπε :ref:`error-handlers` για λεπτομέρειες." -#: library/stdtypes.rst:2820 +#: library/stdtypes.rst:3346 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" +"Για λόγους απόδοσης, η τιμή του *errors* δεν ελέγχεται ως προς την " +"εγκυρότητα του, εκτός εάν παρουσιαστεί ένα σφάλμα αποκωδικοποίησης, είναι " +"ενεργοποιημένο το :ref:`devmode` ή χρησιμοποιείται ένα :ref:`debug build " +"`." -#: library/stdtypes.rst:2826 +#: library/stdtypes.rst:3352 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" +"Η μετάδοση του ορίσματος *encoding* στην :class:`str` επιτρέπει την " +"αποκωδικοποίηση οποιουδήποτε :term:`bytes-like object` απευθείας, χωρίς να " +"χρειάζεται να δημιουργήσετε ένα προσωρινό αντικείμενο :class:`!bytes` ή :" +"class:`!bytearray`." -#: library/stdtypes.rst:2841 +#: library/stdtypes.rst:3367 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " "look for. With optional *start*, test beginning at that position. With " "optional *end*, stop comparing at that position." msgstr "" +"Επιστρέφει ``True`` εάν τα δυαδικά δεδομένα τελειώνουν με το καθορισμένο " +"*suffix*, διαφορετικά επιστρέφει ``False``. Το *suffix* μπορεί επίσης να " +"είναι μια πλειάδα από επιθέματα που πρέπει να αναζητήσετε. Με το " +"προαιρετικό *start*, η δοκιμή ξεκινά από αυτή τη θέση. Με το προαιρετικό " +"*end*, σταματήστε να συγκρίνετε σε αυτή τη θέση." -#: library/stdtypes.rst:2846 +#: library/stdtypes.rst:3372 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" +"Το(α) επίθεμα(τα) για αναζήτηση μπορεί να είναι οποιοδήποτε :term:`bytes-" +"like object`." -#: library/stdtypes.rst:2852 +#: library/stdtypes.rst:3378 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " "arguments *start* and *end* are interpreted as in slice notation. Return " "``-1`` if *sub* is not found." msgstr "" +"Επιστρέφει το χαμηλότερο index στα δεδομένα όπου βρίσκεται η υποακολουθία " +"*sub*, έτσι ώστε το *sub* να περιέχεται στο slice ``s[start:end]``. Τα " +"προαιρετικά ορίσματα *start* και *end* ερμηνεύονται ως συμβολισμό " +"τμηματοποίησης. Επιστρέφει ``-1`` εάν το *sub* δεν βρεθεί." -#: library/stdtypes.rst:2862 +#: library/stdtypes.rst:3388 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" +"Η μέθοδος :meth:`~bytes.find` θα πρέπει να χρησιμοποιείται μόνο εάν " +"χρειάζεται να γνωρίζετε τη θέση του *sub*. Για να ελέγξετε εάν το *sub* " +"είναι υποσυμβολοσειρά ή όχι, χρησιμοποιήστε τον τελεστή :keyword:`in`::" + +#: library/stdtypes.rst:3392 +msgid "" +">>> b'Py' in b'Python'\n" +"True" +msgstr "" +">>> b'Py' in b'Python'\n" +"True" -#: library/stdtypes.rst:2876 +#: library/stdtypes.rst:3402 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" +"Όπως η :meth:`~bytes.find`, αλλά κάνει raise μια :exc:`ValueError` όταν δεν " +"βρεθεί η δευτερεύουσα ακολουθία." -#: library/stdtypes.rst:2889 +#: library/stdtypes.rst:3415 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -3545,16 +6477,27 @@ msgid "" "elements is the contents of the bytes or bytearray object providing this " "method." msgstr "" +"Επιστρέφει ένα αντικείμενο bytes ή bytearray που είναι η συνένωση των " +"δυαδικών ακολουθιών δεδομένων στο *iterable*. Μια :exc:`TypeError` θα γίνει " +"raise εάν υπάρχουν τιμές στο *iterable* που δεν είναι σαν :term:`bytes-like " +"objects `, συμπεριλαμβανομένων των αντικειμένων :class:" +"`str`. Το διαχωριστικό μεταξύ των στοιχειών είναι τα περιεχόμενα των byte ή " +"του αντικειμένου bytearray που παρέχει αυτή τη μέθοδο." -#: library/stdtypes.rst:2900 +#: library/stdtypes.rst:3426 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " "same position in *to*; *from* and *to* must both be :term:`bytes-like " "objects ` and have the same length." msgstr "" +"Αυτή η στατική μέθοδος επιστρέφει έναν πίνακα μετάφρασης που μπορεί να " +"χρησιμοποιηθεί για την :meth:`bytes.translate` που θα αντιστοιχίσει κάθε " +"χαρακτήρα στο *from* στον χαρακτήρα στην ίδια θέση στο *to*· τα *from* και " +"*to* πρέπει να είναι και τα δύο :term:`bytes-like objects ` και να έχουν το ίδιο μήκος." -#: library/stdtypes.rst:2911 +#: library/stdtypes.rst:3437 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -3562,39 +6505,58 @@ msgid "" "found, return a 3-tuple containing a copy of the original sequence, followed " "by two empty bytes or bytearray objects." msgstr "" +"Διαχωρίζει την ακολουθία κατά την πρώτη εμφάνιση του *sep*, και επιστρέφει " +"μια 3-πλειάδα που περιέχει το τμήμα πριν από το διαχωριστικό ή το αντίγραφο " +"του bytearray του και το τμήμα μετά το διαχωριστικό. Εάν δεν βρεθεί το " +"διαχωριστικό, επιστρέφει μια 3-πλειάδα που περιέχει ένα αντίγραφο της " +"αρχικής ακολουθίας, ακολουθούμενη από δύο κενά byte ή αντικείμενα bytearray." -#: library/stdtypes.rst:2975 +#: library/stdtypes.rst:3501 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" +"Το διαχωριστικό για αναζήτηση μπορεί να είναι οποιοδήποτε :term:`bytes-like " +"object`." -#: library/stdtypes.rst:2924 +#: library/stdtypes.rst:3450 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας με όλες τις εμφανίσεις της " +"δευτερεύουσας ακολουθίας *old* αντικαθιστούμενη από την *new*. Εάν δοθεί το " +"προαιρετικό όρισμα *count*, αντικαθίστανται μόνο οι πρώτες εμφανίσεις " +"*count*." -#: library/stdtypes.rst:2928 +#: library/stdtypes.rst:3454 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" +"Η ακολουθία για αναζήτηση και αντικατάσταση της μπορεί να είναι οποιοδήποτε :" +"term:`bytes-like object`." -#: library/stdtypes.rst:2940 +#: library/stdtypes.rst:3466 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " "arguments *start* and *end* are interpreted as in slice notation. Return " "``-1`` on failure." msgstr "" +"Επιστρέφει τον υψηλότερο δείκτη στην ακολουθία όπου βρίσκεται η υποακολουθία " +"*sub*, έτσι ώστε το *sub* να περιέχεται στο ``s[start:end]``. Τα " +"προαιρετικά ορίσματα *start* και *end* ερμηνεύονται με συμβολισμό " +"τμηματοποίησης. Επιστρέφει ``-1`` σε περίπτωση αποτυχίας." -#: library/stdtypes.rst:2955 +#: library/stdtypes.rst:3481 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" +"Όπως η :meth:`~bytes.rfind` αλλά κάνει raise μια :exc:`ValueError` όταν δεν " +"βρεθεί η υποακολουθία *sub*." -#: library/stdtypes.rst:2968 +#: library/stdtypes.rst:3494 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -3602,43 +6564,72 @@ msgid "" "found, return a 3-tuple containing two empty bytes or bytearray objects, " "followed by a copy of the original sequence." msgstr "" +"Διαχωρίζει την ακολουθία στην τελευταία εμφάνιση του *sep*, και επιστρέφει " +"μια 3-πλειάδα που περιέχει το τμήμα πριν από το διαχωριστικό, το ίδιο το " +"διαχωριστικό ή το αντίγραφο του bytearray και το τμήμα μετά το διαχωριστικό. " +"Εάν δεν βρεθεί το διαχωριστικό επιστρέφει μια 3-πλειάδα που περιέχει δύο " +"κενά byte ή αντικείμενα bytearray, ακολουθούμενα από ένα αντίγραφο της " +"αρχικής ακολουθίας." -#: library/stdtypes.rst:2981 +#: library/stdtypes.rst:3507 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " "look for. With optional *start*, test beginning at that position. With " "optional *end*, stop comparing at that position." msgstr "" +"Επιστρέφει ``True`` εάν τα δυαδικά δεδομένα ξεκινούν με το καθορισμένο " +"*prefix*, διαφορετικά επιστρέφει ``False``. Το *prefix* μπορεί επίσης να " +"είναι μια πλειάδα από προθέματα προς αναζήτηση. Με το προαιρετικό *start*, " +"η δοκιμή ξεκινά από αυτή τη θέση. Με το προαιρετικό *end*, σταματάει να " +"συγκρίνει σε αυτή τη θέση." -#: library/stdtypes.rst:2986 +#: library/stdtypes.rst:3512 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" +"Το(α) πρόθεμα(τα) για αναζήτηση μπορεί να είναι οποιοδήποτε :term:`bytes-" +"like object`." -#: library/stdtypes.rst:2992 +#: library/stdtypes.rst:3518 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " "been mapped through the given translation table, which must be a bytes " "object of length 256." msgstr "" +"Επιστρέφει ένα αντίγραφο των bytes ή του αντικειμένου bytearray όπου " +"αφαιρούνται όλα τα byte που εμφανίζονται στο προαιρετικό όρισμα *delete* και " +"τα υπόλοιπα byte έχουν αντιστοιχιστεί μέσω του δεδομένου πίνακα μετάφρασης, " +"ο οποίος πρέπει να είναι ένα αντικείμενο bytes μήκους 256." -#: library/stdtypes.rst:2997 +#: library/stdtypes.rst:3523 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" +"Μπορείτε να χρησιμοποιήσετε τη μέθοδο :func:`bytes.maketrans` για να " +"δημιουργήσετε έναν πίνακα μετάφρασης." -#: library/stdtypes.rst:3000 +#: library/stdtypes.rst:3526 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" +"Ορίζει το όρισμα *table* σε ``None`` για μεταφράσεις που διαγράφουν μόνο " +"χαρακτήρες::" -#: library/stdtypes.rst:3006 -msgid "*delete* is now supported as a keyword argument." +#: library/stdtypes.rst:3529 +msgid "" +">>> b'read this short text'.translate(None, b'aeiou')\n" +"b'rd ths shrt txt'" msgstr "" +">>> b'read this short text'.translate(None, b'aeiou')\n" +"b'rd ths shrt txt'" + +#: library/stdtypes.rst:3532 +msgid "*delete* is now supported as a keyword argument." +msgstr "Το *delete* υποστηρίζεται πλέον ως όρισμα λέξης-κλειδιού." -#: library/stdtypes.rst:3010 +#: library/stdtypes.rst:3536 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -3646,49 +6637,102 @@ msgid "" "all of the bytearray methods in this section do *not* operate in place, and " "instead produce new objects." msgstr "" +"Οι ακόλουθες μέθοδοι σε byte και bytearray αντικείμενα έχουν προεπιλεγμένες " +"συμπεριφορές που προϋποθέτουν τη χρήση δυαδικών μορφών συμβατών με ASCII, " +"αλλά μπορούν να χρησιμοποιηθούν με αυθαίρετα δυαδικά δεδομένα περνώντας " +"κατάλληλα ορίσματα. Σημειώστε ότι όλες οι μέθοδοι bytearray σε αυτήν την " +"ενότητα *δεν* λειτουργούν στη θέση τους και όμως παράγουν νέα αντικείμενα." -#: library/stdtypes.rst:3019 +#: library/stdtypes.rst:3545 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " "For :class:`bytes` objects, the original sequence is returned if *width* is " "less than or equal to ``len(s)``." msgstr "" +"Επιστρέφει ένα αντίγραφο του αντικειμένου με κέντρο σε μια ακολουθία μήκους " +"*width*. Η συμπλήρωση πραγματοποιείται χρησιμοποιώντας το καθορισμένο " +"*fillbyte* (η προεπιλογή είναι ένα διάστημα ASCII). Για αντικείμενα :class:" +"`bytes`, η αρχική ακολουθία επιστρέφεται εάν το *width* είναι μικρότερο ή " +"ίσο με ``len(s)``." -#: library/stdtypes.rst:3033 +#: library/stdtypes.rst:3559 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " "For :class:`bytes` objects, the original sequence is returned if *width* is " "less than or equal to ``len(s)``." msgstr "" +"Επιστρέφει ένα αντίγραφο του αντικειμένου αριστερά ευθυγραμμισμένο σε μια " +"ακολουθία μήκους *width*. Η συμπλήρωση πραγματοποιείται χρησιμοποιώντας το " +"καθορισμένο *fillbyte* (η προεπιλογή είναι ένα διάστημα ASCII). Για " +"αντικείμενα :class:`bytes`, η αρχική ακολουθία επιστρέφεται εάν το *width* " +"είναι μικρότερο ή ίσο με ``len(s)``." -#: library/stdtypes.rst:3047 +#: library/stdtypes.rst:3573 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " -"*chars* argument is a binary sequence specifying the set of byte values to " -"be removed - the name refers to the fact this method is usually used with " -"ASCII characters. If omitted or ``None``, the *chars* argument defaults to " -"removing ASCII whitespace. The *chars* argument is not a prefix; rather, " +"*bytes* argument is a binary sequence specifying the set of byte values to " +"be removed. If omitted or ``None``, the *bytes* argument defaults to " +"removing ASCII whitespace. The *bytes* argument is not a prefix; rather, " "all combinations of its values are stripped::" msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας με καθορισμένα βασικά byte που έχουν " +"αφαιρεθεί. Το όρισμα *bytes* είναι μια δυαδική ακολουθία που καθορίζει το " +"σύνολο των τιμών byte που πρέπει να αφαιρεθούν. Εάν παραληφθεί ή είναι " +"``None``, το όρισμα *bytes* έχει ως προεπιλογή την αφαίρεση του κενού " +"διαστήματος ASCII. Το όρισμα *bytes* δεν είναι πρόθεμα∙ αλλά οι συνδυασμοί " +"των τιμών του αφαιρούνται:" + +#: library/stdtypes.rst:3579 +msgid "" +">>> b' spacious '.lstrip()\n" +"b'spacious '\n" +">>> b'www.example.com'.lstrip(b'cmowz.')\n" +"b'example.com'" +msgstr "" +">>> b' spacious '.lstrip()\n" +"b'spacious '\n" +">>> b'www.example.com'.lstrip(b'cmowz.')\n" +"b'example.com'" -#: library/stdtypes.rst:3059 +#: library/stdtypes.rst:3584 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" +"Η δυαδική ακολουθία τιμών byte προς κατάργηση μπορεί να είναι οποιαδήποτε :" +"term:`bytes-like object`. Βλέπε :meth:`~bytes.removeprefix` για μια μέθοδο " +"που θα αφαιρέσει μια μεμονωμένη συμβολοσειρά προθέματος αντί όλο το σύνολο " +"χαρακτήρων. Για παράδειγμα::" + +#: library/stdtypes.rst:3589 +msgid "" +">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" +"b'ee!'\n" +">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" +"b'three!'" +msgstr "" +">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" +"b'ee!'\n" +">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" +"b'three!'" -#: library/stdtypes.rst:3078 +#: library/stdtypes.rst:3603 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " "For :class:`bytes` objects, the original sequence is returned if *width* is " "less than or equal to ``len(s)``." msgstr "" +"Επιστρέφει ένα αντίγραφο του αντικειμένου ευθυγραμμισμένο δεξιά που " +"δικαιολογείται σε μια ακολουθία μήκους *width*. Η συμπλήρωση " +"πραγματοποιείται χρησιμοποιώντας το καθορισμένο *fillbyte* (η προεπιλογή " +"είναι ένα διάστημα ASCII). Για αντικείμενα :class:`bytes`, η αρχική " +"ακολουθία επιστρέφεται εάν το *width* είναι μικρότερο ή ίσο με ``len(s)``." -#: library/stdtypes.rst:3092 +#: library/stdtypes.rst:3617 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -3697,25 +6741,65 @@ msgid "" "splitting from the right, :meth:`rsplit` behaves like :meth:`split` which is " "described in detail below." msgstr "" +"Διαχωρίζει τη δυαδική ακολουθία σε υποακολουθίες του ίδιου τύπου, " +"χρησιμοποιώντας το *sep* ως συμβολοσειρά οριοθέτησης. Εάν δοθεί *maxsplit*, " +"γίνονται το πολύ *maxsplit* διαχωρισμοί, οι *rightmost*. Εάν δεν " +"καθορίζεται *sep* ή ``None``, οποιαδήποτε υποακολουθία που αποτελείται " +"αποκλειστικά από κενό διάστημα ASCII είναι διαχωριστικό, εκτός από το " +"διαχωρισμό από τα δεξιά, η :meth:`rsplit` συμπεριφέρεται όπως :meth:`split` " +"που περιγράφεται λεπτομερώς παρακάτω." -#: library/stdtypes.rst:3103 +#: library/stdtypes.rst:3628 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " -"*chars* argument is a binary sequence specifying the set of byte values to " -"be removed - the name refers to the fact this method is usually used with " -"ASCII characters. If omitted or ``None``, the *chars* argument defaults to " -"removing ASCII whitespace. The *chars* argument is not a suffix; rather, " +"*bytes* argument is a binary sequence specifying the set of byte values to " +"be removed. If omitted or ``None``, the *bytes* argument defaults to " +"removing ASCII whitespace. The *bytes* argument is not a suffix; rather, " "all combinations of its values are stripped::" msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας με τα καθορισμένα δευτερεύοντα bytes " +"που έχουν αφαιρεθεί. Το όρισμα *bytes* είναι μια δυαδική ακολουθία που " +"καθορίζει το σύνολο των τιμών byte που πρέπει να αφαιρεθούν. Εάν παραληφθεί " +"ή είναι ``None``, το όρισμα *bytes* έχει ως προεπιλογή την αφαίρεση του " +"κενού διαστήματος ASCII. Το όρισμα *bytes* δεν είναι επίθημα, αλλά " +"αφαιρούνται όλοι οι συνδυασμοί των τιμών του::" + +#: library/stdtypes.rst:3634 +msgid "" +">>> b' spacious '.rstrip()\n" +"b' spacious'\n" +">>> b'mississippi'.rstrip(b'ipz')\n" +"b'mississ'" +msgstr "" +">>> b' spacious '.rstrip()\n" +"b' spacious'\n" +">>> b'mississippi'.rstrip(b'ipz')\n" +"b'mississ'" -#: library/stdtypes.rst:3115 +#: library/stdtypes.rst:3639 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" +"Η δυαδική ακολουθία τιμών byte προς κατάργηση μπορεί να είναι οποιοδήποτε :" +"term:`bytes-like object`. Βλέπε τη :meth:`~bytes.removesuffix` για μια " +"μέθοδο που θα αφαιρέσει μια συμβολοσειρά επιθέματος και όχι όλο το σύνολο " +"χαρακτήρων. Για παράδειγμα:" + +#: library/stdtypes.rst:3644 +msgid "" +">>> b'Monty Python'.rstrip(b' Python')\n" +"b'M'\n" +">>> b'Monty Python'.removesuffix(b' Python')\n" +"b'Monty'" +msgstr "" +">>> b'Monty Python'.rstrip(b' Python')\n" +"b'M'\n" +">>> b'Monty Python'.removesuffix(b' Python')\n" +"b'Monty'" -#: library/stdtypes.rst:3134 +#: library/stdtypes.rst:3658 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -3723,19 +6807,52 @@ msgid "" "elements). If *maxsplit* is not specified or is ``-1``, then there is no " "limit on the number of splits (all possible splits are made)." msgstr "" +"Διαχωρίζει την δυαδική ακολουθία σε υποακολουθίες του ίδιου τύπου, " +"χρησιμοποιώντας το *sep* ως συμβολοσειρά οριοθέτησης Εάν δοθεί *maxsplit* " +"και μη αρνητικό, γίνονται το πολύ *maxsplit* διαχωρισμοί (άρα, η λίστα θα " +"έχε το πολύ ``maxsplit+1`` στοιχεία). Εάν το *maxsplit* δεν έχει καθοριστεί " +"ή είναι ``-1``, τότε δεν υπάρχει όριο στον αριθμό των διαχωρισμών (όλες οι " +"πιθανές διασπάσεις γίνονται)." -#: library/stdtypes.rst:3140 +#: library/stdtypes.rst:3664 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " "returns ``[b'1', b'', b'2']``). The *sep* argument may consist of a " -"multibyte sequence (for example, ``b'1<>2<>3'.split(b'<>')`` returns " -"``[b'1', b'2', b'3']``). Splitting an empty sequence with a specified " -"separator returns ``[b'']`` or ``[bytearray(b'')]`` depending on the type of " -"object being split. The *sep* argument may be any :term:`bytes-like object`." +"multibyte sequence as a single delimiter. Splitting an empty sequence with a " +"specified separator returns ``[b'']`` or ``[bytearray(b'')]`` depending on " +"the type of object being split. The *sep* argument may be any :term:`bytes-" +"like object`." msgstr "" +"Αν δοθεί το *sep*, οι διαδοχικοί οριοθέτες δεν ομαδοποιούνται και θεωρείται " +"ότι οριοθετούν κενές υποακολουθίες (για παράδειγμα, ``b'1,,2'.split(b',')`` " +"επιστρέφει το ``[b'1', b'', b'2']``). Το όρισμα *sep* μπορεί να αποτελείται " +"από μια ακολουθία πολλών byte ως μεμονωμένο οριοθέτη. Ο διαχωρισμός μιας " +"κενής ακολουθίας με ένα καθορισμένο διαχωριστικό επιστρέφει το ``[b'']`` ή " +"το ``[bytearray(b'')]`` ανάλογα με τον τύπο του αντικειμένου που χωρίζεται. " +"Το όρισμα *sep* μπορεί να είναι οποιοδήποτε :term:`bytes-like object`." + +#: library/stdtypes.rst:3674 +msgid "" +">>> b'1,2,3'.split(b',')\n" +"[b'1', b'2', b'3']\n" +">>> b'1,2,3'.split(b',', maxsplit=1)\n" +"[b'1', b'2,3']\n" +">>> b'1,2,,3,'.split(b',')\n" +"[b'1', b'2', b'', b'3', b'']\n" +">>> b'1<>2<>3<4'.split(b'<>')\n" +"[b'1', b'2', b'3<4']" +msgstr "" +">>> b'1,2,3'.split(b',')\n" +"[b'1', b'2', b'3']\n" +">>> b'1,2,3'.split(b',', maxsplit=1)\n" +"[b'1', b'2,3']\n" +">>> b'1,2,,3,'.split(b',')\n" +"[b'1', b'2', b'', b'3', b'']\n" +">>> b'1<>2<>3<4'.split(b'<>')\n" +"[b'1', b'2', b'3<4']" -#: library/stdtypes.rst:3158 +#: library/stdtypes.rst:3683 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -3744,39 +6861,89 @@ msgid "" "an empty sequence or a sequence consisting solely of ASCII whitespace " "without a specified separator returns ``[]``." msgstr "" +"Εάν το *sep* δεν έχει καθοριστεί ή είναι ``None``, εφαρμόζεται ένας " +"διαφορετικός αλγόριθμος διαχωρισμού: οι εκτελέσεις διαδοχικών κενών " +"διαστημάτων ASCII θεωρούνται ως ένα ενιαίο διαχωριστικό, και το αποτέλεσμα " +"δεν θα περιέχει κενές συμβολοσειρές στην αρχή ή στο τέλος, εάν η ακολουθία " +"έχει κενό που έπεται ή προηγείται. Κατά συνέπεια, ο διαχωρισμός μιας κενής " +"ακολουθίας ή μιας ακολουθίας που αποτελείται αποκλειστικά από κενό διάστημα " +"ASCII χωρίς καθορισμένο διαχωριστικό επιστρέφει το ``[]``." + +#: library/stdtypes.rst:3693 +msgid "" +">>> b'1 2 3'.split()\n" +"[b'1', b'2', b'3']\n" +">>> b'1 2 3'.split(maxsplit=1)\n" +"[b'1', b'2 3']\n" +">>> b' 1 2 3 '.split()\n" +"[b'1', b'2', b'3']" +msgstr "" +">>> b'1 2 3'.split()\n" +"[b'1', b'2', b'3']\n" +">>> b'1 2 3'.split(maxsplit=1)\n" +"[b'1', b'2 3']\n" +">>> b' 1 2 3 '.split()\n" +"[b'1', b'2', b'3']" -#: library/stdtypes.rst:3179 +#: library/stdtypes.rst:3704 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " -"removed. The *chars* argument is a binary sequence specifying the set of " -"byte values to be removed - the name refers to the fact this method is " -"usually used with ASCII characters. If omitted or ``None``, the *chars* " -"argument defaults to removing ASCII whitespace. The *chars* argument is not " -"a prefix or suffix; rather, all combinations of its values are stripped::" +"removed. The *bytes* argument is a binary sequence specifying the set of " +"byte values to be removed. If omitted or ``None``, the *bytes* argument " +"defaults to removing ASCII whitespace. The *bytes* argument is not a prefix " +"or suffix; rather, all combinations of its values are stripped::" +msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας με τα καθορισμένα bytes που " +"προηγούνται και τα bytes που έπονται. Το όρισμα *bytes* είναι μια δυαδική " +"ακολουθία που καθορίζει το σύνολο των τιμών byte που πρέπει να αφαιρεθούν. " +"Εάν παραλείπεται ή είναι ``None``, το όρισμα *bytes* από προεπιλογή αφαιρεί " +"το ASCII λευκό διάστημα. To όρισμα *bytes* δεν είναι πρόθεμα ή επίθημα, αλλά " +"αφαιρούνται όλοι οι συνδυασμοί των τιμών του:" + +#: library/stdtypes.rst:3711 +msgid "" +">>> b' spacious '.strip()\n" +"b'spacious'\n" +">>> b'www.example.com'.strip(b'cmowz.')\n" +"b'example'" msgstr "" +">>> b' spacious '.strip()\n" +"b'spacious'\n" +">>> b'www.example.com'.strip(b'cmowz.')\n" +"b'example'" -#: library/stdtypes.rst:3192 +#: library/stdtypes.rst:3716 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" +"Η δυαδική ακολουθία τιμών byte προς αφαίρεση μπορεί να είναι οποιοδήποτε :" +"term:`bytes-like object`." -#: library/stdtypes.rst:3201 +#: library/stdtypes.rst:3725 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " "data. Note that all of the bytearray methods in this section do *not* " "operate in place, and instead produce new objects." msgstr "" +"Οι ακόλουθες μέθοδοι σε byte και αντικείμενα bytearray προϋποθέτουν τη χρήση " +"δυαδικών μορφών συμβατών με ASCII και δεν πρέπει να εφαρμόζονται σε " +"αυθαίρετα δυαδικά δεδομένα. Σημειώστε ότι όλες οι μέθοδοι bytearray σε αυτήν " +"την ενότητα *δεν* λειτουργούν στη θέση τους και αντ' αυτού παράγουν νέα " +"αντικείμενα." -#: library/stdtypes.rst:3209 +#: library/stdtypes.rst:3733 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας με κάθε byte να ερμηνεύεται ως ένας " +"χαρακτήρας ASCII, και το πρώτο byte γραμμένο με κεφαλαία και το υπόλοιπο με " +"πεζά. Οι τιμές των byte που δεν είναι ASCII μεταβιβάζονται αμετάβλητες." -#: library/stdtypes.rst:3222 +#: library/stdtypes.rst:3746 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -3791,8 +6958,33 @@ msgid "" "other byte value is copied unchanged and the current column is incremented " "by one regardless of how the byte value is represented when printed::" msgstr "" - -#: library/stdtypes.rst:3250 +"Επιστρέφει ένα αντίγραφο της ακολουθίας όπου όλοι οι tab χαρακτήρες ASCII " +"αντικαθίστανται από ένα ή περισσότερα κενά ASCII, ανάλογα με την τρέχουσα " +"στήλη και το δεδομένο μέγεθος tab. Οι θέσεις των tab εμφανίζονται κάθε " +"*tabsize* bytes (η προεπιλογή είναι 8, δίνοντας θέσεις καρτελών στις στήλες " +"0, 8, 16 και ούτω καθεξής). Για την επέκταση της ακολουθίας, η τρέχουσα " +"στήλη ορίζεται στο μηδέν και η ακολουθία εξετάζεται byte προς byte. Εάν το " +"byte είναι tab χαρακτήρας ASCII (``b'\\t'``), ένας ή περισσότεροι χαρακτήρες " +"διαστήματος εισάγονται στο αποτέλεσμα έως ότου η τρέχουσα στήλη ισούται με " +"την επόμενη θέση tab. (Ο ίδιος tab χαρακτήρας δεν αντιγράφεται.) Εάν το " +"τρέχον byte είναι μια νέα γραμμή ASCII (``b'\\n'``), αντιγράφεται και η " +"τρέχουσα στήλη επαναφέρεται στο μηδέν. Οποιαδήποτε άλλη τιμή byte " +"αντιγράφεται αμετάβλητη και η τρέχουσα στήλη προσαυξάνεται κατά ένα, " +"ανεξάρτητα από το πώς αναπαρίσταται η τιμή byte όταν εκτυπώνεται::" + +#: library/stdtypes.rst:3760 +msgid "" +">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" +"b'01 012 0123 01234'\n" +">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" +"b'01 012 0123 01234'" +msgstr "" +">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" +"b'01 012 0123 01234'\n" +">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" +"b'01 012 0123 01234'" + +#: library/stdtypes.rst:3774 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -3800,126 +6992,346 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``. ASCII decimal " "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" +"Επιστρέφει ``True`` εάν όλα τα byte της ακολουθίας είναι αλφαβητικοί " +"χαρακτήρες ASCII ή ASCII δεκαδικά ψηφία και η ακολουθία δεν είναι κενή, " +"``False`` διαφορετικά. Οι αλφαβητικοί χαρακτήρες ASCII είναι εκείνες οι " +"τιμές byte στην ακολουθία " +"``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``. Τα δεκαδικά " +"ψηφία ASCII είναι αυτές οι τιμές byte στην ακολουθία ``b'0123456789'``." + +#: library/stdtypes.rst:3782 +msgid "" +">>> b'ABCabc1'.isalnum()\n" +"True\n" +">>> b'ABC abc1'.isalnum()\n" +"False" +msgstr "" +">>> b'ABCabc1'.isalnum()\n" +"True\n" +">>> b'ABC abc1'.isalnum()\n" +"False" -#: library/stdtypes.rst:3267 +#: library/stdtypes.rst:3791 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " "characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" +"Επιστρέφει ``True`` εάν όλα τα bytes της ακολουθίας είναι αλφαβητικοί " +"χαρακτήρες ASCII και η ακολουθία δεν είναι κενή, ``False`` διαφορετικά. Οι " +"αλφαβητικοί χαρακτήρες ASCII είναι εκείνες οι τιμές bytes στην ακολουθία " +"``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." + +#: library/stdtypes.rst:3798 +msgid "" +">>> b'ABCabc'.isalpha()\n" +"True\n" +">>> b'ABCabc1'.isalpha()\n" +"False" +msgstr "" +">>> b'ABCabc'.isalpha()\n" +"True\n" +">>> b'ABCabc1'.isalpha()\n" +"False" -#: library/stdtypes.rst:3283 +#: library/stdtypes.rst:3807 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" +"Επιστρέφει ``True`` εάν η ακολουθία είναι κενή ή όλα τα byte της ακολουθίας " +"είναι ASCII, ``False`` διαφορετικά. Τα bytes ASCII βρίσκονται στο εύρος " +"0-0x7F." -#: library/stdtypes.rst:3293 +#: library/stdtypes.rst:3817 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" +"Επιστρέφει ``True`` εάν όλα τα bytes στην ακολουθία είναι δεκαδικά ψηφία " +"ASCII και η ακολουθία δεν είναι κενή, ``False`` διαφορετικά. Τα δεκαδικά " +"ψηφία ASCII είναι αυτές οι τιμές byte στην ακολουθία ``b'0123456789'``." + +#: library/stdtypes.rst:3823 +msgid "" +">>> b'1234'.isdigit()\n" +"True\n" +">>> b'1.23'.isdigit()\n" +"False" +msgstr "" +">>> b'1234'.isdigit()\n" +"True\n" +">>> b'1.23'.isdigit()\n" +"False" -#: library/stdtypes.rst:3308 +#: library/stdtypes.rst:3832 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" +"Επιστρέφει ``True`` εάν υπάρχει τουλάχιστον ένας πεζός χαρακτήρας ASCII στην " +"ακολουθία και κανένας κεφαλαίος χαρακτήρας ASCII, ``False`` διαφορετικά." + +#: library/stdtypes.rst:3837 +msgid "" +">>> b'hello world'.islower()\n" +"True\n" +">>> b'Hello world'.islower()\n" +"False" +msgstr "" +">>> b'hello world'.islower()\n" +"True\n" +">>> b'Hello world'.islower()\n" +"False" -#: library/stdtypes.rst:3360 library/stdtypes.rst:3426 -#: library/stdtypes.rst:3495 +#: library/stdtypes.rst:3884 library/stdtypes.rst:3950 +#: library/stdtypes.rst:4019 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" +"Οι πεζοί χαρακτήρες ASCII είναι αυτές οι τιμές byte στην ακολουθία " +"``b'abcdefghijklmnopqrstuvwxyz'``. Οι κεφαλαίοι χαρακτήρες ASCII είναι αυτές " +"οι τιμές byte στην ακολουθία ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." -#: library/stdtypes.rst:3326 +#: library/stdtypes.rst:3850 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " "those byte values in the sequence ``b' \\t\\n\\r\\x0b\\f'`` (space, tab, " "newline, carriage return, vertical tab, form feed)." msgstr "" +"Επιστρέφει ``True`` εάν όλα τα byte στην ακολουθία είναι κενά ASCII και η " +"ακολουθία δεν είναι κενή, ``False`` διαφορετικά. Οι χαρακτήρες κενού " +"διαστήματος ASCII είναι αυτές οι τιμές byte στην ακολουθία ``b' " +"\\t\\n\\r\\x0b\\f'`` (κενό, tab, νέα γραμμή, επιστροφή μεταφοράς, κάθετο " +"tab, μορφή ροής)." -#: library/stdtypes.rst:3335 +#: library/stdtypes.rst:3859 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" +"Επιστρέφει ``True`` εάν η ακολουθία είναι ASCII κεφαλαία τίτλου (δηλαδή τα " +"πρώτα γράμματα των λέξεων κεφαλαία) και η ακολουθία δεν είναι κενή, " +"``False`` διαφορετικά. Δείτε :meth:`bytes.title` για περισσότερες " +"λεπτομέρειες σχετικά με τον ορισμό του \"titlecase\"." + +#: library/stdtypes.rst:3865 +msgid "" +">>> b'Hello World'.istitle()\n" +"True\n" +">>> b'Hello world'.istitle()\n" +"False" +msgstr "" +">>> b'Hello World'.istitle()\n" +"True\n" +">>> b'Hello world'.istitle()\n" +"False" -#: library/stdtypes.rst:3350 +#: library/stdtypes.rst:3874 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" +"Επιστρέφει ``True`` εάν υπάρχει τουλάχιστον ένας κεφαλαίος αλφαβητικός " +"χαρακτήρας ASCII στην ακολουθία και κανένας πεζός χαρακτήρας ASCII, " +"διαφορετικά ``False``." + +#: library/stdtypes.rst:3879 +msgid "" +">>> b'HELLO WORLD'.isupper()\n" +"True\n" +">>> b'Hello world'.isupper()\n" +"False" +msgstr "" +">>> b'HELLO WORLD'.isupper()\n" +"True\n" +">>> b'Hello world'.isupper()\n" +"False" -#: library/stdtypes.rst:3368 +#: library/stdtypes.rst:3892 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας με όλους τους κεφαλαίους χαρακτήρες " +"ASCII να έχουν μετατραπεί στα ισοδύναμα πεζά." + +#: library/stdtypes.rst:3897 +msgid "" +">>> b'Hello World'.lower()\n" +"b'hello world'" +msgstr "" +">>> b'Hello World'.lower()\n" +"b'hello world'" -#: library/stdtypes.rst:3393 +#: library/stdtypes.rst:3917 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " "splitting lines. Line breaks are not included in the resulting list unless " "*keepends* is given and true." msgstr "" +"Επιστρέφει μια λίστα με τις γραμμές στη δυαδική ακολουθία, σπάζοντας τα όρια " +"γραμμής του ASCII. Αυτή η μέθοδος χρησιμοποιεί την προσέγγιση :term:" +"`universal newlines` για τον διαχωρισμό των γραμμών. Οι αλλαγές γραμμής δεν " +"περιλαμβάνονται στη λίστα που προκύπτει εκτός εάν δοθεί *keepends* και είναι " +"αληθής." + +#: library/stdtypes.rst:3924 +msgid "" +">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" +"[b'ab c', b'', b'de fg', b'kl']\n" +">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" +"[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" +msgstr "" +">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" +"[b'ab c', b'', b'de fg', b'kl']\n" +">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" +"[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: library/stdtypes.rst:3405 +#: library/stdtypes.rst:3929 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" +"Σε αντίθεση με το :meth:`~bytes.split` όταν δίνεται μια οριοθετημένη " +"συμβολοσειρά *sep*, αυτή η μέθοδος επιστρέφει μια κενή λίστα για την κενή " +"συμβολοσειρά και μια αλλαγή γραμμής τερματικού δεν οδηγεί σε μια επιπλέον " +"γραμμή::" + +#: library/stdtypes.rst:3933 +msgid "" +">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" +"([b''], [b'Two lines', b''])\n" +">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" +"([], [b'One line'])" +msgstr "" +">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" +"([b''], [b'Two lines', b''])\n" +">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" +"([], [b'One line'])" -#: library/stdtypes.rst:3418 +#: library/stdtypes.rst:3942 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας με όλους τους πεζούς χαρακτήρες " +"ASCII να έχουν μετατραπεί στο αντίστοιχο ισοδύναμο κεφαλαίο και αντίστροφα." -#: library/stdtypes.rst:3430 +#: library/stdtypes.rst:3947 msgid "" -"Unlike :func:`str.swapcase()`, it is always the case that ``bin.swapcase()." +">>> b'Hello World'.swapcase()\n" +"b'hELLO wORLD'" +msgstr "" +">>> b'Hello World'.swapcase()\n" +"b'hELLO wORLD'" + +#: library/stdtypes.rst:3954 +msgid "" +"Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " "symmetrical in ASCII, even though that is not generally true for arbitrary " "Unicode code points." msgstr "" +"Σε αντίθεση με το :func:`str.swapcase`, συμβαίνει πάντα ότι ``bin.swapcase()." +"swapcase() == bin`` για τις δυαδικές εκδόσεις. Οι μετατροπές κεφαλαίων είναι " +"συμμετρικές στο ASCII, παρόλο που αυτό δεν ισχύει γενικά για αυθαίρετα " +"σημεία Unicode κώδικα." -#: library/stdtypes.rst:3444 +#: library/stdtypes.rst:3968 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" +"Επιστρέφει μια έκδοση με κεφαλαία τίτλου (δηλαδή τα πρώτα γράμματα των " +"λέξεων κεφαλαία) της δυαδικής ακολουθίας όπου οι λέξεις ξεκινούν με κεφαλαίο " +"χαρακτήρα ASCII και οι υπόλοιποι χαρακτήρες είναι πεζοί. Οι τιμές byte χωρίς " +"κεφαλαία γράμματα παραμένουν χωρίς τροποποίηση." + +#: library/stdtypes.rst:3974 +msgid "" +">>> b'Hello world'.title()\n" +"b'Hello World'" +msgstr "" +">>> b'Hello world'.title()\n" +"b'Hello World'" -#: library/stdtypes.rst:3453 +#: library/stdtypes.rst:3977 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``. All other byte " "values are uncased." msgstr "" +"Οι πεζοί χαρακτήρες ASCII είναι εκείνες οι τιμές byte στην ακολουθία " +"``b'abcdefghijklmnopqrstuvwxyz'``. Οι κεφαλαίο χαρακτήρες ASCII είναι " +"εκείνες οι τιμές byte στην ακολουθία ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``. Όλες " +"οι άλλες τιμές byte είναι χωρίς κεφαλαία." -#: library/stdtypes.rst:3466 +#: library/stdtypes.rst:3987 msgid "" -"A workaround for apostrophes can be constructed using regular expressions::" +">>> b\"they're bill's friends from the UK\".title()\n" +"b\"They'Re Bill'S Friends From The Uk\"" msgstr "" +">>> b\"they're bill's friends from the UK\".title()\n" +"b\"They'Re Bill'S Friends From The Uk\"" -#: library/stdtypes.rst:3487 +#: library/stdtypes.rst:3990 +msgid "" +"A workaround for apostrophes can be constructed using regular expressions::" +msgstr "" +"Μια λύση για αποστρόφους μπορεί να δημιουργηθεί χρησιμοποιώντας κανονικές " +"εκφράσεις::" + +#: library/stdtypes.rst:3992 +msgid "" +">>> import re\n" +">>> def titlecase(s):\n" +"... return re.sub(rb\"[A-Za-z]+('[A-Za-z]+)?\",\n" +"... lambda mo: mo.group(0)[0:1].upper() +\n" +"... mo.group(0)[1:].lower(),\n" +"... s)\n" +"...\n" +">>> titlecase(b\"they're bill's friends.\")\n" +"b\"They're Bill's Friends.\"" +msgstr "" +">>> import re\n" +">>> def titlecase(s):\n" +"... return re.sub(rb\"[A-Za-z]+('[A-Za-z]+)?\",\n" +"... lambda mo: mo.group(0)[0:1].upper() +\n" +"... mo.group(0)[1:].lower(),\n" +"... s)\n" +"...\n" +">>> titlecase(b\"they're bill's friends.\")\n" +"b\"They're Bill's Friends.\"" + +#: library/stdtypes.rst:4011 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας με όλους τους πεζούς χαρακτήρες " +"ASCII να έχουν μετατραπεί στο αντίστοιχο ισοδύναμο κεφαλαίο." -#: library/stdtypes.rst:3508 +#: library/stdtypes.rst:4016 +msgid "" +">>> b'Hello World'.upper()\n" +"b'HELLO WORLD'" +msgstr "" +">>> b'Hello World'.upper()\n" +"b'HELLO WORLD'" + +#: library/stdtypes.rst:4032 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -3927,20 +7339,42 @@ msgid "" "before. For :class:`bytes` objects, the original sequence is returned if " "*width* is less than or equal to ``len(seq)``." msgstr "" +"Επιστρέφει ένα αντίγραφο της ακολουθίας που έχει απομείνει γεμάτο με ψηφία " +"ASCII ``b'0'`` για να δημιουργήσετε μια ακολουθία μήκους *width*. Ένα " +"πρόθεμα προπορευόμενου σήματος (``b'+'``/ ``b'-'``) αντιμετωπίζεται με την " +"εισαγωγή της συμπλήρωσης του *after* χαρακτήρα προσήμου και όχι πριν. Για " +"αντικείμενα :class:`bytes`, η αρχική ακολουθία επιστρέφεται εάν το *width* " +"είναι μικρότερο ή ίσο με ``len(seq)``." -#: library/stdtypes.rst:3530 -msgid "``printf``-style Bytes Formatting" +#: library/stdtypes.rst:4040 +msgid "" +">>> b\"42\".zfill(5)\n" +"b'00042'\n" +">>> b\"-42\".zfill(5)\n" +"b'-0042'" msgstr "" +">>> b\"42\".zfill(5)\n" +"b'00042'\n" +">>> b\"-42\".zfill(5)\n" +"b'-0042'" + +#: library/stdtypes.rst:4054 +msgid "``printf``-style Bytes Formatting" +msgstr "Μορφοποίηση Bytes τύπου ``printf``" -#: library/stdtypes.rst:3547 +#: library/stdtypes.rst:4071 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " "dictionaries correctly). If the value being printed may be a tuple or " "dictionary, wrap it in a tuple." msgstr "" +"Οι λειτουργίες μορφοποίησης που περιγράφονται εδώ παρουσιάζουν μια ποικιλία " +"ιδιορρυθμιών που οδηγούν σε μια σειρά από κοινά σφάλματα (όπως η αποτυχία " +"εμφάνισης των πλειάδων και των λεξικών σωστά). Εάν η τιμή που εκτυπώνεται " +"μπορεί να είναι πλειάδα ή λεξικό, κάντε το wrap σε μια πλειάδα." -#: library/stdtypes.rst:3552 +#: library/stdtypes.rst:4076 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -3949,123 +7383,200 @@ msgid "" "zero or more elements of *values*. The effect is similar to using the :c:" "func:`sprintf` in the C language." msgstr "" +"Τα αντικείμενα bytes (``bytes``/``bytearray``) έχουν μια μοναδική " +"ενσωματωμένη λειτουργία: τον τελεστή ``%`` (modulo). Αυτό είναι επίσης " +"γνωστό ως τελεστής bytes *formatting* ή *interpolation*. Δεδομένων των " +"``format % values`` (όπου το *format* είναι αντικείμενο bytes), οι " +"προδιαγραφές μετατροπής ``%`` σε *format* αντικαθιστά με μηδέν ή περισσότερα " +"στοιχεία *values*. Το αποτέλεσμα είναι παρόμοιο με τη χρήση του :c:func:" +"`sprintf` στη γλώσσας C." -#: library/stdtypes.rst:3559 +#: library/stdtypes.rst:4083 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " "items specified by the format bytes object, or a single mapping object (for " "example, a dictionary)." msgstr "" +"Εάν το *format* απαιτεί ένα μεμονωμένο όρισμα, το *values* μπορεί να είναι " +"ένα μεμονωμένο μη πολλαπλό αντικείμενο. [5]_ Διαφορετικά, το *values* πρέπει " +"να είναι πλειάδα με ακριβώς τον αριθμό των στοιχείων που καθορίζονται από το " +"αντικείμενο μορφής bytes ή μεμονωμένο mapping αντικείμενο (για παράδειγμα, " +"ένα λεξικό)." -#: library/stdtypes.rst:3593 +#: library/stdtypes.rst:4117 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " "that dictionary inserted immediately after the ``'%'`` character. The " "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" +"Όταν το σωστό όρισμα είναι ένα λεξικό (ή άλλος τύπος αντιστοίχισης), τότε οι " +"μορφές στο αντικείμενο bytes *πρέπει* να περιλαμβάνουν ένα κλειδί " +"αντιστοίχισης σε παρένθεση σε αυτό το λεξικό που έχει εισαχθεί αμέσως μετά " +"τον χαρακτήρα ``'%'``. Το κλειδί αντιστοίχισης επιλέγει την τιμή που θα " +"μορφοποιηθεί από την αντιστοίχιση. Για παράδειγμα:" + +#: library/stdtypes.rst:4169 +msgid "\\(8)" +msgstr "\\(8)" -#: library/stdtypes.rst:3667 +#: library/stdtypes.rst:4191 msgid "Single byte (accepts integer or single byte objects)." -msgstr "" +msgstr "Μονό byte (δέχεται ακέραια ή μεμονωμένα byte αντικείμενα)." -#: library/stdtypes.rst:3670 +#: library/stdtypes.rst:4194 msgid "``'b'``" -msgstr "" +msgstr "``'b'``" -#: library/stdtypes.rst:3670 +#: library/stdtypes.rst:4194 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" +"Bytes (κάθε αντικείμενο που ακολουθεί το :ref:`buffer protocol " +"` ή έχει :meth:`~object.__bytes__`)." -#: library/stdtypes.rst:3674 +#: library/stdtypes.rst:4198 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" +"Το ``'s'`` είναι ένα ψευδώνυμο για το ``'b'`` και θα πρέπει να " +"χρησιμοποιείται μόνο για κώδικα βάσει Python2/3." -#: library/stdtypes.rst:3677 +#: library/stdtypes.rst:4201 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" +"Bytes (μετατρέπει οποιοδήποτε αντικείμενο Python χρησιμοποιώντας ``repr(obj)." +"encode('ascii', 'backslashreplace')``)." -#: library/stdtypes.rst:3680 +#: library/stdtypes.rst:4204 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" +"Το ``'r'`` είναι ένα ψευδώνυμο για ``'a'`` και θα πρέπει να χρησιμοποιείται " +"μόνο για βάσεις κώδικα Python2/3." -#: library/stdtypes.rst:3680 +#: library/stdtypes.rst:4204 msgid "\\(7)" -msgstr "" +msgstr "\\(7)" -#: library/stdtypes.rst:3715 +#: library/stdtypes.rst:4239 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "" +"Το ``b'%s'`` έχει καταργηθεί, αλλά δεν θα αφαιρεθεί κατά τη διάρκεια της " +"σειράς 3.x." -#: library/stdtypes.rst:3718 +#: library/stdtypes.rst:4242 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "" +"Το ``b'%r'`` έχει καταργηθεί, αλλά δεν θα αφαιρεθεί κατά τη διάρκεια της " +"σειράς 3.x." -#: library/stdtypes.rst:3730 +#: library/stdtypes.rst:4254 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" -msgstr "" +msgstr ":pep:`461` - Προσθήκη % για μορφοποίηση σε bytes και bytearray" -#: library/stdtypes.rst:3737 +#: library/stdtypes.rst:4261 msgid "Memory Views" -msgstr "" +msgstr "Όψεις Μνήμης" -#: library/stdtypes.rst:3739 +#: library/stdtypes.rst:4263 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" +"Τα αντικείμενα :class:`memoryview` επιτρέπουν στον κώδικα Python να έχει " +"πρόσβαση στα εσωτερικά δεδομένα ενός αντικειμένου που υποστηρίζει το " +"πρωτόκολλο :ref:`buffer protocol ` χωρίς αντιγραφή." -#: library/stdtypes.rst:3745 +#: library/stdtypes.rst:4269 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" +"Δημιουργεί μια :class:`memoryview` που αναφέρεται στο *object*. Το *object* " +"πρέπει να υποστηρίζει το πρωτόκολλο buffer. Τα ενσωματωμένα αντικείμενα που " +"υποστηρίζουν το πρωτόκολλο buffer περιλαμβάνουν :class:`bytes` και :class:" +"`bytearray`." -#: library/stdtypes.rst:3749 +#: library/stdtypes.rst:4273 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " "as :class:`bytes` and :class:`bytearray`, an element is a single byte, but " "other types such as :class:`array.array` may have bigger elements." msgstr "" +"Μια :class:`memoryview` έχει την έννοια ενός *στοιχείου*, το οποίο είναι η " +"μονάδα ατομικής μνήμης που χειρίζεται το αρχικό *object*. Για πολλούς " +"απλούς τύπους όπως :class:`bytes` και :class:`bytearray`, ένα στοιχείο είναι " +"ένα μεμονωμένο byte, αλλά άλλοι τύποι όπως :class:`array.array` μπορεί να " +"έχουν μεγαλύτερα στοιχεία." -#: library/stdtypes.rst:3754 +#: library/stdtypes.rst:4278 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" +"Το ``len(view)`` ισούται με το μήκος του :class:`~memoryview.tolist`, το " +"οποίο είναι η ένθετη αναπαράσταση κατά την προβολή της λίστας. Εάν ``view." +"ndim = 1``, αυτό ισούται με τον αριθμό των στοιχείων για την προβολή." -#: library/stdtypes.rst:3758 +#: library/stdtypes.rst:4282 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" +"Εάν ``view.ndim == 0``, το ``len(view)`` τώρα κάνει raise μια :exc:" +"`TypeError` αντί να επιστρέψει 1." -#: library/stdtypes.rst:3761 +#: library/stdtypes.rst:4285 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" +"Το χαρακτηριστικό :class:`~memoryview.itemsize` θα σας δώσει τον αριθμό των " +"byte σε ένα μόνο στοιχείο." -#: library/stdtypes.rst:3764 +#: library/stdtypes.rst:4288 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" - -#: library/stdtypes.rst:3777 +"Μια :class:`memoryview` υποστηρίζει λειτουργίες τμηματοποίησης και πρόσβαση " +"μέσω ευρετηρίου στα δεδομένα του. Μια μονοδιάστατη τμηματοποίηση θα έχει ως " +"αποτέλεσμα μια δευτερεύουσα προβολή::" + +#: library/stdtypes.rst:4291 +msgid "" +">>> v = memoryview(b'abcefg')\n" +">>> v[1]\n" +"98\n" +">>> v[-1]\n" +"103\n" +">>> v[1:4]\n" +"\n" +">>> bytes(v[1:4])\n" +"b'bce'" +msgstr "" +">>> v = memoryview(b'abcefg')\n" +">>> v[1]\n" +"98\n" +">>> v[-1]\n" +"103\n" +">>> v[1:4]\n" +"\n" +">>> bytes(v[1:4])\n" +"b'bce'" + +#: library/stdtypes.rst:4301 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -4075,91 +7586,290 @@ msgid "" "*ndim* integers where *ndim* is the number of dimensions. Zero-dimensional " "memoryviews can be indexed with the empty tuple." msgstr "" +"Εάν το :class:`~memoryview.format` είναι ένας από τους προσδιοριστές " +"εγγενούς μορφής από το module :mod:`struct`, η πρόσβαση μέσω ευρετηρίου με " +"έναν ακέραιο ή μια πλειάδα (tuple) ακεραίων υποστηρίζεται επίσης και " +"επιστρέφει ένα μεμονωμένο *στοιχείο* με το σωστό τύπο. Τα μονοδιάστατα " +"memoryviews μπορούν να γίνουν indexed με έναν ακέραιο ή έναν ακέραιο πλειάδα " +"(tuple). Τα πολυδιάστατα memoryviews μπορούν αν γίνουν indexed με πλειάδες " +"(tuples) ακριβώς *ndim* ακεραίων όπου *ndim* είναι ο αριθμός των " +"διαστάσεων. Τα μηδενικών διαστάσεων memoryviews μπορούν να γίνουν indexed " +"με την κενή πλειάδα (tuple)." -#: library/stdtypes.rst:3786 +#: library/stdtypes.rst:4310 msgid "Here is an example with a non-byte format::" -msgstr "" - -#: library/stdtypes.rst:3798 +msgstr "Ακολουθεί ένα παράδειγμα με μη-byte μορφή::" + +#: library/stdtypes.rst:4312 +msgid "" +">>> import array\n" +">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" +">>> m = memoryview(a)\n" +">>> m[0]\n" +"-11111111\n" +">>> m[-1]\n" +"44444444\n" +">>> m[::2].tolist()\n" +"[-11111111, -33333333]" +msgstr "" +">>> import array\n" +">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" +">>> m = memoryview(a)\n" +">>> m[0]\n" +"-11111111\n" +">>> m[-1]\n" +"44444444\n" +">>> m[::2].tolist()\n" +"[-11111111, -33333333]" + +#: library/stdtypes.rst:4322 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" - -#: library/stdtypes.rst:3819 +"Εάν το βασικό αντικείμενο είναι εγγράψιμο, το memoryview υποστηρίζει " +"μονοδιάστατη εκχώρηση τμηματοποίησης. Δεν επιτρέπεται η αλλαγή μεγέθους::" + +#: library/stdtypes.rst:4325 +msgid "" +">>> data = bytearray(b'abcefg')\n" +">>> v = memoryview(data)\n" +">>> v.readonly\n" +"False\n" +">>> v[0] = ord(b'z')\n" +">>> data\n" +"bytearray(b'zbcefg')\n" +">>> v[1:4] = b'123'\n" +">>> data\n" +"bytearray(b'z123fg')\n" +">>> v[2:3] = b'spam'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: memoryview assignment: lvalue and rvalue have different " +"structures\n" +">>> v[2:6] = b'spam'\n" +">>> data\n" +"bytearray(b'z1spam')" +msgstr "" +">>> data = bytearray(b'abcefg')\n" +">>> v = memoryview(data)\n" +">>> v.readonly\n" +"False\n" +">>> v[0] = ord(b'z')\n" +">>> data\n" +"bytearray(b'zbcefg')\n" +">>> v[1:4] = b'123'\n" +">>> data\n" +"bytearray(b'z123fg')\n" +">>> v[2:3] = b'spam'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: memoryview assignment: lvalue and rvalue have different " +"structures\n" +">>> v[2:6] = b'spam'\n" +">>> data\n" +"bytearray(b'z1spam')" + +#: library/stdtypes.rst:4343 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" +"Τα μονοδιάστατα memoryviews των τύπων :term:`hashable` (μόνο για ανάγνωση) " +"με μορφές 'B', 'b' ή 'c' μπορούν επίσης να κατακερματιστούν. Ο " +"κατακερματισμός ορίζεται ως ``hash(m) == hash(m.tobytes())``::" -#: library/stdtypes.rst:3831 +#: library/stdtypes.rst:4347 +msgid "" +">>> v = memoryview(b'abcefg')\n" +">>> hash(v) == hash(b'abcefg')\n" +"True\n" +">>> hash(v[2:4]) == hash(b'ce')\n" +"True\n" +">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" +"True" +msgstr "" +">>> v = memoryview(b'abcefg')\n" +">>> hash(v) == hash(b'abcefg')\n" +"True\n" +">>> hash(v[2:4]) == hash(b'ce')\n" +"True\n" +">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" +"True" + +#: library/stdtypes.rst:4355 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" +"Τα μονοδιάστατα memoryviews μπορούν πλέον να τμηματοποιηθούν. Τα " +"μονοδιάστατα memoryviews με μορφές 'B', 'b' ή 'c' είναι πλέον :term:" +"`hashable`." -#: library/stdtypes.rst:3835 +#: library/stdtypes.rst:4359 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" +"το memoryview εγγράφεται πλέον αυτόματα με :class:`collections.abc.Sequence`" -#: library/stdtypes.rst:3839 +#: library/stdtypes.rst:4363 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" +"τα memoryviews μπορούν τώρα να γίνουν ευρετηριοποίηση με πλειάδα (tuple) " +"ακεραίων." + +#: library/stdtypes.rst:4366 +msgid "memoryview is now a :term:`generic type`." +msgstr "το memoryview είναι πλέον ένα :term:`generic type`." -#: library/stdtypes.rst:3842 +#: library/stdtypes.rst:4369 msgid ":class:`memoryview` has several methods:" -msgstr "" +msgstr "το :class:`memoryview` έχει διάφορες μεθόδους:" -#: library/stdtypes.rst:3846 +#: library/stdtypes.rst:4373 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" +"Ένα memoryview και ένας εξαγωγέας :pep:`3118` είναι ίσοι εάν τα σχήματα τους " +"είναι ισοδύναμα και εάν όλες οι αντίστοιχες τιμές είναι ίσες όταν οι " +"αντίστοιχοι κωδικοί μορφής των τελεστών ερμηνεύονται χρησιμοποιώντας τη " +"σύνταξη :mod:`struct`." -#: library/stdtypes.rst:3850 +#: library/stdtypes.rst:4377 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" +"Για το υποσύνολο του :mod:`struct` οι συμβολοσειρές μορφής που " +"υποστηρίζονται αυτή τη στιγμή από το :meth:`tolist`, ``v`` και ``w`` είναι " +"ίσες εάν ``v.tolist() == w.tolist()``::" -#: library/stdtypes.rst:3869 +#: library/stdtypes.rst:4380 +msgid "" +">>> import array\n" +">>> a = array.array('I', [1, 2, 3, 4, 5])\n" +">>> b = array.array('d', [1.0, 2.0, 3.0, 4.0, 5.0])\n" +">>> c = array.array('b', [5, 3, 1])\n" +">>> x = memoryview(a)\n" +">>> y = memoryview(b)\n" +">>> x == a == y == b\n" +"True\n" +">>> x.tolist() == a.tolist() == y.tolist() == b.tolist()\n" +"True\n" +">>> z = y[::-2]\n" +">>> z == c\n" +"True\n" +">>> z.tolist() == c.tolist()\n" +"True" +msgstr "" +">>> import array\n" +">>> a = array.array('I', [1, 2, 3, 4, 5])\n" +">>> b = array.array('d', [1.0, 2.0, 3.0, 4.0, 5.0])\n" +">>> c = array.array('b', [5, 3, 1])\n" +">>> x = memoryview(a)\n" +">>> y = memoryview(b)\n" +">>> x == a == y == b\n" +"True\n" +">>> x.tolist() == a.tolist() == y.tolist() == b.tolist()\n" +"True\n" +">>> z = y[::-2]\n" +">>> z == c\n" +"True\n" +">>> z.tolist() == c.tolist()\n" +"True" + +#: library/stdtypes.rst:4396 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" - -#: library/stdtypes.rst:3885 -msgid "" -"Note that, as with floating point numbers, ``v is w`` does *not* imply ``v " +"Εάν καμία συμβολοσειρά μορφής δεν υποστηρίζεται από το module :mod:`struct`, " +"τότε τα αντικείμενα θα συγκρίνονται πάντα ως άνισα (ακόμα και αν οι " +"συμβολοσειρές μορφοποίησης και τα περιεχόμενα της προσωρινής μνήμης είναι " +"πανομοιότυπα)::" + +#: library/stdtypes.rst:4400 +msgid "" +">>> from ctypes import BigEndianStructure, c_long\n" +">>> class BEPoint(BigEndianStructure):\n" +"... _fields_ = [(\"x\", c_long), (\"y\", c_long)]\n" +"...\n" +">>> point = BEPoint(100, 200)\n" +">>> a = memoryview(point)\n" +">>> b = memoryview(point)\n" +">>> a == point\n" +"False\n" +">>> a == b\n" +"False" +msgstr "" +">>> from ctypes import BigEndianStructure, c_long\n" +">>> class BEPoint(BigEndianStructure):\n" +"... _fields_ = [(\"x\", c_long), (\"y\", c_long)]\n" +"...\n" +">>> point = BEPoint(100, 200)\n" +">>> a = memoryview(point)\n" +">>> b = memoryview(point)\n" +">>> a == point\n" +"False\n" +">>> a == b\n" +"False" + +#: library/stdtypes.rst:4412 +msgid "" +"Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" +"Λάβετε υπόψη ότι, όπως και με τους αριθμούς κινητής υποδιαστολής, ``v is w`` " +"*δεν* σημαίνει ``v == w`` για αντικείμενα memoryview." -#: library/stdtypes.rst:3888 +#: library/stdtypes.rst:4415 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" +"Οι προηγούμενες εκδόσεις συνέκριναν την ακατέργαστη μνήμη αγνοώντας τη μορφή " +"του στοιχείου και τη δομή του λογικού πίνακα." -#: library/stdtypes.rst:3894 +#: library/stdtypes.rst:4421 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" +"Επιστρέφει τα δεδομένα στο buffer ως ένα bytestring. Αυτό ισοδυναμεί με την " +"κλήση του κατασκευαστή :class:`bytes` στο memoryview. ::" + +#: library/stdtypes.rst:4424 +msgid "" +">>> m = memoryview(b\"abc\")\n" +">>> m.tobytes()\n" +"b'abc'\n" +">>> bytes(m)\n" +"b'abc'" +msgstr "" +">>> m = memoryview(b\"abc\")\n" +">>> m.tobytes()\n" +"b'abc'\n" +">>> bytes(m)\n" +"b'abc'" -#: library/stdtypes.rst:3903 +#: library/stdtypes.rst:4430 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " "supports all format strings, including those that are not in :mod:`struct` " "module syntax." msgstr "" +"Για μη συνεχόμενους πίνακες, το αποτέλεσμα είναι ίσο με την αναπαράσταση της " +"ισοπεδωμένης λίστας με όλα τα στοιχεία να μετατρέπονται σε bytes. Η :meth:" +"`tobytes` υποστηρίζει όλες τις συμβολοσειρές μορφής, συμπεριλαμβανομένων " +"εκείνων που δεν είναι στη σύνταξη του module :mod:`struct`." -#: library/stdtypes.rst:3908 +#: library/stdtypes.rst:4435 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -4167,37 +7877,107 @@ msgid "" "Fortran order is preserved. For non-contiguous views, the data is converted " "to C first. *order=None* is the same as *order='C'*." msgstr "" +"Το *order* μπορεί να είναι {'C', 'F', 'A'}. Όταν το *order* είναι 'C' ή " +"'F', τα δεδομένα του αρχικού πίνακα μετατρέπονται σε C ή σε σειρά Fortran. " +"Για συνεχόμενες όψεις, το 'A' επιστρέφει ένα ακριβές αντίγραφο της φυσικής " +"μνήμης. Συγκεκριμένα, διατηρείται σειρά Fortran στη μνήμη. Για μη " +"συνεχόμενες προβολές, τα δεδομένα μετατρέπονται πρώτα σε C. Το *order=None* " +"είναι το ίδιο με το *order='C'*." -#: library/stdtypes.rst:3917 +#: library/stdtypes.rst:4445 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" +"Επιστρέφει ένα αντικείμενο συμβολοσειράς που περιέχει δύο δεκαεξαδικά ψηφία " +"για κάθε byte στο buffer. ::" + +#: library/stdtypes.rst:4448 +msgid "" +">>> m = memoryview(b\"abc\")\n" +">>> m.hex()\n" +"'616263'" +msgstr "" +">>> m = memoryview(b\"abc\")\n" +">>> m.hex()\n" +"'616263'" -#: library/stdtypes.rst:3926 +#: library/stdtypes.rst:4454 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" +"Παρόμοιο με το :meth:`bytes.hex`, το :meth:`memoryview.hex` τώρα υποστηρίζει " +"προαιρετικές παραμέτρους *sep* και *bytes_per_sep* για να εισάγετε " +"διαχωριστικά μεταξύ των byte στην εξαγωγή δεκαεξαδικού." -#: library/stdtypes.rst:3933 +#: library/stdtypes.rst:4461 msgid "Return the data in the buffer as a list of elements. ::" +msgstr "Επιστρέψτε τα δεδομένα στο buffer ως λίστα στοιχείων. ::" + +#: library/stdtypes.rst:4463 +msgid "" +">>> memoryview(b'abc').tolist()\n" +"[97, 98, 99]\n" +">>> import array\n" +">>> a = array.array('d', [1.1, 2.2, 3.3])\n" +">>> m = memoryview(a)\n" +">>> m.tolist()\n" +"[1.1, 2.2, 3.3]" msgstr "" +">>> memoryview(b'abc').tolist()\n" +"[97, 98, 99]\n" +">>> import array\n" +">>> a = array.array('d', [1.1, 2.2, 3.3])\n" +">>> m = memoryview(a)\n" +">>> m.tolist()\n" +"[1.1, 2.2, 3.3]" -#: library/stdtypes.rst:3943 +#: library/stdtypes.rst:4471 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" +"Η :meth:`tolist` υποστηρίζει πλέον όλες τις εγγενείς μορφές μεμονωμένων " +"χαρακτήρων στη σύνταξη του :mod:`struct`, καθώς και πολυδιάστατες " +"αναπαραστάσεις." -#: library/stdtypes.rst:3950 +#: library/stdtypes.rst:4478 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" +"Επιστρέφει μια έκδοση μόνο για ανάγνωση του αντικειμένου memoryview. Το " +"αρχικό αντικείμενο memoryview είναι αμετάβλητο. ::" + +#: library/stdtypes.rst:4481 +msgid "" +">>> m = memoryview(bytearray(b'abc'))\n" +">>> mm = m.toreadonly()\n" +">>> mm.tolist()\n" +"[97, 98, 99]\n" +">>> mm[0] = 42\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: cannot modify read-only memory\n" +">>> m[0] = 43\n" +">>> mm.tolist()\n" +"[43, 98, 99]" +msgstr "" +">>> m = memoryview(bytearray(b'abc'))\n" +">>> mm = m.toreadonly()\n" +">>> mm.tolist()\n" +"[97, 98, 99]\n" +">>> mm[0] = 42\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: cannot modify read-only memory\n" +">>> m[0] = 43\n" +">>> mm.tolist()\n" +"[43, 98, 99]" -#: library/stdtypes.rst:3969 +#: library/stdtypes.rst:4497 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -4205,21 +7985,68 @@ msgid "" "release() is handy to remove these restrictions (and free any dangling " "resources) as soon as possible." msgstr "" +"Απελευθερώνει το υποκείμενο buffer που εκτίθεται από το αντικείμενο " +"memoryview. Πολλά αντικείμενα πραγματοποιούν ειδικές ενέργειες όταν " +"διατηρείται μια προβολή σε αυτά (για παράδειγμα, μια :class:`bytearray` θα " +"απαγόρευε προσωρινά την αλλαγή μεγέθους)· επομένως, η κλήση της release() " +"είναι βολική για την κατάργηση αυτών των περιορισμών (και απελευθερώνει " +"οποιουσδήποτε αιωρούμενους πόρους) το συντομότερο δυνατό." -#: library/stdtypes.rst:3975 +#: library/stdtypes.rst:4503 msgid "" "After this method has been called, any further operation on the view raises " -"a :class:`ValueError` (except :meth:`release()` itself which can be called " +"a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" +"Μετά την κλήση αυτής της μεθόδου, οποιαδήποτε περαιτέρω λειτουργία στην " +"προβολή δημιουργεί μια :class:`ValueError` (εκτός από την ίδια την :meth:" +"`release` που μπορεί να κληθεί πολλές φορές)::" + +#: library/stdtypes.rst:4507 +msgid "" +">>> m = memoryview(b'abc')\n" +">>> m.release()\n" +">>> m[0]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: operation forbidden on released memoryview object" +msgstr "" +">>> m = memoryview(b'abc')\n" +">>> m.release()\n" +">>> m[0]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: operation forbidden on released memoryview object" -#: library/stdtypes.rst:3986 +#: library/stdtypes.rst:4514 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" +"Το πρωτόκολλο διαχείρισης περιεχομένου μπορεί να χρησιμοποιηθεί για παρόμοιο " +"αποτέλεσμα, χρησιμοποιώντας τη δήλωση ``with``::" + +#: library/stdtypes.rst:4517 +msgid "" +">>> with memoryview(b'abc') as m:\n" +"... m[0]\n" +"...\n" +"97\n" +">>> m[0]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: operation forbidden on released memoryview object" +msgstr "" +">>> with memoryview(b'abc') as m:\n" +"... m[0]\n" +"...\n" +"97\n" +">>> m[0]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: operation forbidden on released memoryview object" -#: library/stdtypes.rst:4002 +#: library/stdtypes.rst:4531 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -4227,119 +8054,393 @@ msgid "" "is not copied. Supported casts are 1D -> C-:term:`contiguous` and C-" "contiguous -> 1D." msgstr "" +"Μορφοποιεί ένα memoryview σε νέα μορφή ή σχήμα. Το *shape* είναι από " +"προεπιλογή ``[byte_length//new_itemsize]``, που σημαίνει ότι η προβολή " +"αποτελέσματος θα είναι μονοδιάστατη. Η επιστρεφόμενη τιμή είναι ένα νέο " +"memoryview, αλλά το ίδιο το buffer δεν αντιγράφεται. Οι υποστηριζόμενες " +"μετατροπές είναι 1D -> C-:term:`contiguous` και C-contiguous -> 1D." -#: library/stdtypes.rst:4008 +#: library/stdtypes.rst:4537 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " "'c'). The byte length of the result must be the same as the original length. " "Note that all byte lengths may depend on the operating system." msgstr "" +"Η μορφή προορισμού περιορίζεται σε μια εγγενή μορφή μεμονωμένου στοιχείου " +"στη σύνταξη :mod:`struct`. Μία από τις μορφές πρέπει να είναι μορφή byte " +"('B', 'b' ή 'c'). Το μήκος byte του αποτελέσματος πρέπει να είναι το ίδιο με " +"το αρχικό μήκος. Σημειώστε ότι όλα τα μήκη byte μπορεί να εξαρτώνται από το " +"λειτουργικό σύστημα." -#: library/stdtypes.rst:4014 +#: library/stdtypes.rst:4543 msgid "Cast 1D/long to 1D/unsigned bytes::" -msgstr "" - -#: library/stdtypes.rst:4037 +msgstr "Μορφοποίηση από 1D/long σε 1D/unsigned bytes::" + +#: library/stdtypes.rst:4545 +msgid "" +">>> import array\n" +">>> a = array.array('l', [1,2,3])\n" +">>> x = memoryview(a)\n" +">>> x.format\n" +"'l'\n" +">>> x.itemsize\n" +"8\n" +">>> len(x)\n" +"3\n" +">>> x.nbytes\n" +"24\n" +">>> y = x.cast('B')\n" +">>> y.format\n" +"'B'\n" +">>> y.itemsize\n" +"1\n" +">>> len(y)\n" +"24\n" +">>> y.nbytes\n" +"24" +msgstr "" +">>> import array\n" +">>> a = array.array('l', [1,2,3])\n" +">>> x = memoryview(a)\n" +">>> x.format\n" +"'l'\n" +">>> x.itemsize\n" +"8\n" +">>> len(x)\n" +"3\n" +">>> x.nbytes\n" +"24\n" +">>> y = x.cast('B')\n" +">>> y.format\n" +"'B'\n" +">>> y.itemsize\n" +"1\n" +">>> len(y)\n" +"24\n" +">>> y.nbytes\n" +"24" + +#: library/stdtypes.rst:4566 msgid "Cast 1D/unsigned bytes to 1D/char::" -msgstr "" - -#: library/stdtypes.rst:4050 +msgstr "Μορφοποίηση από 1D/unsigned bytes σε 1D/char::" + +#: library/stdtypes.rst:4568 +msgid "" +">>> b = bytearray(b'zyz')\n" +">>> x = memoryview(b)\n" +">>> x[0] = b'a'\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: memoryview: invalid type for format 'B'\n" +">>> y = x.cast('c')\n" +">>> y[0] = b'a'\n" +">>> b\n" +"bytearray(b'ayz')" +msgstr "" +">>> b = bytearray(b'zyz')\n" +">>> x = memoryview(b)\n" +">>> x[0] = b'a'\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: memoryview: invalid type for format 'B'\n" +">>> y = x.cast('c')\n" +">>> y[0] = b'a'\n" +">>> b\n" +"bytearray(b'ayz')" + +#: library/stdtypes.rst:4579 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" +msgstr "Μορφοποίηση από 1D/bytes σε 3D/ints σε 1D/signed char::" + +#: library/stdtypes.rst:4581 +msgid "" +">>> import struct\n" +">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('i', shape=[2,2,3])\n" +">>> y.tolist()\n" +"[[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]]\n" +">>> y.format\n" +"'i'\n" +">>> y.itemsize\n" +"4\n" +">>> len(y)\n" +"2\n" +">>> y.nbytes\n" +"48\n" +">>> z = y.cast('b')\n" +">>> z.format\n" +"'b'\n" +">>> z.itemsize\n" +"1\n" +">>> len(z)\n" +"48\n" +">>> z.nbytes\n" +"48" +msgstr "" +">>> import struct\n" +">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('i', shape=[2,2,3])\n" +">>> y.tolist()\n" +"[[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]]\n" +">>> y.format\n" +"'i'\n" +">>> y.itemsize\n" +"4\n" +">>> len(y)\n" +"2\n" +">>> y.nbytes\n" +"48\n" +">>> z = y.cast('b')\n" +">>> z.format\n" +"'b'\n" +">>> z.itemsize\n" +"1\n" +">>> len(z)\n" +"48\n" +">>> z.nbytes\n" +"48" + +#: library/stdtypes.rst:4605 +msgid "Cast 1D/unsigned long to 2D/unsigned long::" +msgstr "Μορφοποίηση από 1D/unsigned long σε 2D/unsigned long::" + +#: library/stdtypes.rst:4607 +msgid "" +">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('L', shape=[2,3])\n" +">>> len(y)\n" +"2\n" +">>> y.nbytes\n" +"48\n" +">>> y.tolist()\n" +"[[0, 1, 2], [3, 4, 5]]" +msgstr "" +">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('L', shape=[2,3])\n" +">>> len(y)\n" +"2\n" +">>> y.nbytes\n" +"48\n" +">>> y.tolist()\n" +"[[0, 1, 2], [3, 4, 5]]" + +#: library/stdtypes.rst:4619 +msgid "The source format is no longer restricted when casting to a byte view." msgstr "" +"Η πηγαία μορφή δεν είναι πλέον περιορισμένη κατά τη μορφοποίηση σε μια όψη " +"byte." -#: library/stdtypes.rst:4076 -msgid "Cast 1D/unsigned long to 2D/unsigned long::" +#: library/stdtypes.rst:4624 +msgid "Count the number of occurrences of *value*." +msgstr "Μετράει τον αριθμό των εμφανίσεων του *value*." + +#: library/stdtypes.rst:4630 +msgid "" +"Return the index of the first occurrence of *value* (at or after index " +"*start* and before index *stop*)." msgstr "" +"Επιστρέφει τον δείκτη της πρώτης εμφάνισης του *value* (στην ή μετά τον " +"δείκτη *start* και πριν από τον δείκτη *stop*)." -#: library/stdtypes.rst:4090 -msgid "The source format is no longer restricted when casting to a byte view." +#: library/stdtypes.rst:4633 +msgid "Raises a :exc:`ValueError` if *value* cannot be found." msgstr "" +"Κάνει raise μια :exc:`ValueError` αν δεν μπορεί να βρεθεί η τιμή *value*." -#: library/stdtypes.rst:4093 +#: library/stdtypes.rst:4637 msgid "There are also several readonly attributes available:" -msgstr "" +msgstr "Υπάρχουν επίσης αρκετά διαθέσιμα χαρακτηριστικά μόνο για ανάγνωση:" -#: library/stdtypes.rst:4097 +#: library/stdtypes.rst:4641 msgid "The underlying object of the memoryview::" +msgstr "Το βασικό αντικείμενο του memoryview::" + +#: library/stdtypes.rst:4643 +msgid "" +">>> b = bytearray(b'xyz')\n" +">>> m = memoryview(b)\n" +">>> m.obj is b\n" +"True" msgstr "" +">>> b = bytearray(b'xyz')\n" +">>> m = memoryview(b)\n" +">>> m.obj is b\n" +"True" -#: library/stdtypes.rst:4108 +#: library/stdtypes.rst:4652 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" +"``nbytes == product(shape) * itemsize == len(m.tobytes())``. Αυτή είναι η " +"ποσότητα χώρου σε byte που θα χρησιμοποιούσε ο πίνακας σε μια συνεχόμενη " +"αναπαράσταση. Δεν ισούται απαραίτητα με ``len(m)``::" -#: library/stdtypes.rst:4127 +#: library/stdtypes.rst:4656 +msgid "" +">>> import array\n" +">>> a = array.array('i', [1,2,3,4,5])\n" +">>> m = memoryview(a)\n" +">>> len(m)\n" +"5\n" +">>> m.nbytes\n" +"20\n" +">>> y = m[::2]\n" +">>> len(y)\n" +"3\n" +">>> y.nbytes\n" +"12\n" +">>> len(y.tobytes())\n" +"12" +msgstr "" +">>> import array\n" +">>> a = array.array('i', [1,2,3,4,5])\n" +">>> m = memoryview(a)\n" +">>> len(m)\n" +"5\n" +">>> m.nbytes\n" +"20\n" +">>> y = m[::2]\n" +">>> len(y)\n" +"3\n" +">>> y.nbytes\n" +"12\n" +">>> len(y.tobytes())\n" +"12" + +#: library/stdtypes.rst:4671 msgid "Multi-dimensional arrays::" -msgstr "" - -#: library/stdtypes.rst:4144 +msgstr "Πολυδιάστατοι πίνακες::" + +#: library/stdtypes.rst:4673 +msgid "" +">>> import struct\n" +">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('d', shape=[3,4])\n" +">>> y.tolist()\n" +"[[0.0, 1.5, 3.0, 4.5], [6.0, 7.5, 9.0, 10.5], [12.0, 13.5, 15.0, 16.5]]\n" +">>> len(y)\n" +"3\n" +">>> y.nbytes\n" +"96" +msgstr "" +">>> import struct\n" +">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('d', shape=[3,4])\n" +">>> y.tolist()\n" +"[[0.0, 1.5, 3.0, 4.5], [6.0, 7.5, 9.0, 10.5], [12.0, 13.5, 15.0, 16.5]]\n" +">>> len(y)\n" +"3\n" +">>> y.nbytes\n" +"96" + +#: library/stdtypes.rst:4688 msgid "A bool indicating whether the memory is read only." -msgstr "" +msgstr "Ένα bool που υποδεικνύει εάν η μνήμη είναι μόνο για ανάγνωση." -#: library/stdtypes.rst:4148 +#: library/stdtypes.rst:4692 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " "arbitrary format strings, but some methods (e.g. :meth:`tolist`) are " "restricted to native single element formats." msgstr "" +"Μια συμβολοσειρά που περιέχει τη μορφή (σε module style :mod:`struct`) για " +"κάθε στοιχείο σε μια όψη. Μπορεί να δημιουργηθεί ένα memoryview από " +"εξαγωγείς με συμβολοσειρές αυθαίρετης μορφής, αλλά ορισμένες μέθοδοι (π.χ. :" +"meth:`tolist`) είναι περιορισμένες σε εγγενείς μορφές ενός στοιχείου." -#: library/stdtypes.rst:4153 +#: library/stdtypes.rst:4697 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" +"η μορφή ``'B'`` αντιμετωπίζεται πλέον σύμφωνα με τη σύνταξη ενός struct " +"module. Αυτό σημαίνει ότι ``memoryview(b'abc')[0] == b'abc'[0] == 97``." -#: library/stdtypes.rst:4159 +#: library/stdtypes.rst:4703 msgid "The size in bytes of each element of the memoryview::" -msgstr "" - -#: library/stdtypes.rst:4172 +msgstr "Το μέγεθος σε bytes κάθε στοιχείου στο memoryview::" + +#: library/stdtypes.rst:4705 +msgid "" +">>> import array, struct\n" +">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" +">>> m.itemsize\n" +"2\n" +">>> m[0]\n" +"32000\n" +">>> struct.calcsize('H') == m.itemsize\n" +"True" +msgstr "" +">>> import array, struct\n" +">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" +">>> m.itemsize\n" +"2\n" +">>> m[0]\n" +"32000\n" +">>> struct.calcsize('H') == m.itemsize\n" +"True" + +#: library/stdtypes.rst:4716 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" +"Ένα ακέραιος αριθμός που δείχνει πόσες διαστάσεις ενός πολυδιάστατου πίνακα " +"αντιπροσωπεύει η μνήμη." -#: library/stdtypes.rst:4177 +#: library/stdtypes.rst:4721 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" +"Μια πλειάδα (tuple) ακεραίων με μήκος :attr:`ndim` δίνοντας το σχήμα της " +"μνήμης ως πίνακα N-διαστάσεων." -#: library/stdtypes.rst:4188 +#: library/stdtypes.rst:4732 msgid "An empty tuple instead of ``None`` when ndim = 0." -msgstr "" +msgstr "Μια κενή πλειάδα (tuple) αντί για ``None`` όταν ndim = 0." -#: library/stdtypes.rst:4185 +#: library/stdtypes.rst:4729 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" +"Μια πλειάδα ακεραίων με μήκος :attr:`ndim` που δίνει το μέγεθος σε bytes για " +"την πρόσβαση σε κάθε στοιχείο για κάθε διάσταση του πίνακα." -#: library/stdtypes.rst:4193 +#: library/stdtypes.rst:4737 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" +"Χρησιμοποιείται εσωτερικά για συστοιχίες τύπου PIL. Η τιμή είναι μόνο " +"ενημερωτική." -#: library/stdtypes.rst:4197 +#: library/stdtypes.rst:4741 msgid "A bool indicating whether the memory is C-:term:`contiguous`." -msgstr "" +msgstr "Ένα bool που υποδεικνύει εάν η μνήμη είναι C-:term:`contiguous`." -#: library/stdtypes.rst:4203 +#: library/stdtypes.rst:4747 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." -msgstr "" +msgstr "Ένα bool που υποδεικνύει εάν η μνήμη είναι Fortran :term:`contiguous`." -#: library/stdtypes.rst:4209 +#: library/stdtypes.rst:4753 msgid "A bool indicating whether the memory is :term:`contiguous`." -msgstr "" +msgstr "Ένα bool που υποδεικνύει εάν η μνήμη είναι :term:`contiguous`." -#: library/stdtypes.rst:4217 +#: library/stdtypes.rst:4761 msgid "Set Types --- :class:`set`, :class:`frozenset`" -msgstr "" +msgstr "Τύποι Συνόλου (Set) --- :class:`set`, :class:`frozenset`" -#: library/stdtypes.rst:4221 +#: library/stdtypes.rst:4765 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -4348,132 +8449,180 @@ msgid "" "in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:" "`collections` module.)" msgstr "" +"Ένα αντικείμενο :dfn:`set` είναι μια μη ταξινομημένη συλλογή από διακριτά " +"αντικείμενα :term:`hashable`. Οι συνήθεις χρήσεις περιλαμβάνουν τη δοκιμή " +"ιδιότητας μέλους, την αφαίρεση διπλότυπων από μια ακολουθία και τον " +"υπολογισμό μαθηματικών πράξεων όπως τομή, ένωση, διαφορά, και συμμετρική " +"διαφορά. (Για άλλα containers, δείτε τις ενσωματωμένες κλάσεις :class:" +"`dict`, :class:`list`, και :class:`tuple` και το module :mod:`collections`)." -#: library/stdtypes.rst:4228 +#: library/stdtypes.rst:4772 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " "position or order of insertion. Accordingly, sets do not support indexing, " "slicing, or other sequence-like behavior." msgstr "" +"Όπως και άλλες συλλογές, τα σύνολα (sets) υποστηρίζουν ``x in set``, " +"``len(set)``, και ``for x in set``. Όντως μια μη ταξινομημένη συλλογή, τα " +"σύνολα δεν καταγράφουν τη θέση του στοιχείου ή τη σειρά εισαγωγής. Συνεπώς, " +"τα σύνολα (sets) δεν υποστηρίζουν λειτουργίες ευρετηριοποίησης, " +"τμηματοποίησης ή άλλη συμπεριφορά ακολουθίας." -#: library/stdtypes.rst:4233 +#: library/stdtypes.rst:4777 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " -"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " -"it is mutable, it has no hash value and cannot be used as either a " -"dictionary key or as an element of another set. The :class:`frozenset` type " -"is immutable and :term:`hashable` --- its contents cannot be altered after " -"it is created; it can therefore be used as a dictionary key or as an element " -"of another set." -msgstr "" - -#: library/stdtypes.rst:4241 +"changed using methods like :meth:`add ` and :meth:`remove " +"`. Since it is mutable, it has no hash value and cannot be " +"used as either a dictionary key or as an element of another set. The :class:" +"`frozenset` type is immutable and :term:`hashable` --- its contents cannot " +"be altered after it is created; it can therefore be used as a dictionary key " +"or as an element of another set." +msgstr "" +"Υπάρχουν αυτή τη στιγμή δύο ενσωματωμένοι τύποι συνόλου, :class:`set` και :" +"class:`frozenset`. Ο τύπος :class:`set` είναι ευμετάβλητος --- τα " +"περιεχόμενα του μπορούν να αλλάξουν χρησιμοποιώντας μεθόδους όπως :meth:`add " +"` και :meth:`remove `. Δεδομένου ότι είναι " +"ευμετάβλητο, δεν έχει τιμή κατακερματισμού και δεν μπορεί να χρησιμοποιηθεί " +"ούτε ως κλειδί λεξικού ούτε ως στοιχείο ενός άλλου συνόλου (set). Ο τύπος :" +"class:`frozenset` είναι αμετάβλητος και :term:`hashable` --- το περιεχόμενό " +"του δεν μπορεί να αλλάξει μετά τη δημιουργία του· μπορεί επομένως να " +"χρησιμοποιηθεί ως κλειδί λεξικού ή ως στοιχείο άλλου συνόλου (set)." + +#: library/stdtypes.rst:4786 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" +"Μπορούν να δημιουργηθούν μη κενά σύνολα (όχι παγωμένα σύνολα (frozensets)) " +"τοποθετώντας μια λίστα στοιχείων διαχωρισμένων με κόμμα μέσα σε αγκύλες, για " +"παράδειγμα: ``{'jack', 'sjoerd'}``, επιπλέον με τη χρήση του constructor " +"του :class:`set`." -#: library/stdtypes.rst:4245 +#: library/stdtypes.rst:4790 msgid "The constructors for both classes work the same:" -msgstr "" +msgstr "Οι constructors και για τις δύο κλάσεις λειτουργούν το ίδιο:" -#: library/stdtypes.rst:4250 +#: library/stdtypes.rst:4795 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " "sets of sets, the inner sets must be :class:`frozenset` objects. If " "*iterable* is not specified, a new empty set is returned." msgstr "" +"Επιστρέφει ένα νέο σύνολο (set) ή ένα παγωμένο σύνολο (frozenset) των οποίων " +"τα στοιχεία έχουν ληφθεί από το *iterable*. Τα στοιχεία ενός συνόλου πρέπει " +"να είναι :term:`hashable`. Για να αναπαραστήσουν σύνολα συνόλων, τα " +"εσωτερικά σύνολα πρέπει να είναι :class:`frozenset` αντικείμενα. Εάν δεν " +"έχει καθοριστεί το *iterable*, επιστρέφεται ένα νέο κενό σύνολο." -#: library/stdtypes.rst:4256 +#: library/stdtypes.rst:4801 msgid "Sets can be created by several means:" -msgstr "" +msgstr "Τα σύνολα μπορούν να δημιουργηθούν με διάφορους τρόπους:" -#: library/stdtypes.rst:4258 +#: library/stdtypes.rst:4803 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" +"Χρησιμοποιώντας μια λίστα στοιχείων διαχωρισμένη με κόμματα: ``{'jack', " +"'sjoerd'}``" -#: library/stdtypes.rst:4259 +#: library/stdtypes.rst:4804 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" +"Χρησιμοποιώντας ένα set comprehension: ``{c for c in 'abracadabra' if c not " +"in 'abc'}``" -#: library/stdtypes.rst:4260 +#: library/stdtypes.rst:4805 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" +"Χρησιμοποιώντας τον τύπο constructor: ``set()``, ``set('foobar')``, " +"``set(['a', 'b', 'foo'])``" -#: library/stdtypes.rst:4262 +#: library/stdtypes.rst:4807 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" +"Τα στιγμιότυπα των :class:`set` και :class:`frozenset` παρέχουν τις " +"ακόλουθες λειτουργίες:" -#: library/stdtypes.rst:4267 +#: library/stdtypes.rst:4812 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" +"Επιστρέφει τον αριθμό των στοιχείων στο σύνολο *s* (πληθικότητα του *s*)." -#: library/stdtypes.rst:4271 +#: library/stdtypes.rst:4816 msgid "Test *x* for membership in *s*." -msgstr "" +msgstr "Ελέγχει αν το *x* είναι μέρος στο *s*." -#: library/stdtypes.rst:4275 +#: library/stdtypes.rst:4820 msgid "Test *x* for non-membership in *s*." -msgstr "" +msgstr "Ελέγχει αν το *x* δεν είναι μέρος στο *s*." -#: library/stdtypes.rst:4279 +#: library/stdtypes.rst:4824 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" +"Επιστρέφει ``True`` εάν το σύνολο δεν έχει κοινά στοιχεία με το *other*. Τα " +"σύνολα είναι ασύνδετα εάν και μόνο εάν η τομή τους είναι το κενό σύνολο." -#: library/stdtypes.rst:4285 +#: library/stdtypes.rst:4830 msgid "Test whether every element in the set is in *other*." -msgstr "" +msgstr "Ελέγχει εάν κάθε στοιχείο στο σύνολο βρίσκεται στο *other*." -#: library/stdtypes.rst:4289 +#: library/stdtypes.rst:4834 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" +"Ελέγχει εάν το σύνολο είναι σωστό υποσύνολο του *other*, δηλαδή, ``set <= " +"other and set != other``." -#: library/stdtypes.rst:4295 +#: library/stdtypes.rst:4840 msgid "Test whether every element in *other* is in the set." -msgstr "" +msgstr "Ελέγχει αν κάθε στοιχείο του *other* είναι στο σύνολο." -#: library/stdtypes.rst:4299 +#: library/stdtypes.rst:4844 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" +"Ελέγχει αν το σύνολο είναι σωστό υπερσύνολο του *other*, δηλαδή, ``set >= " +"other and set != other``." -#: library/stdtypes.rst:4305 +#: library/stdtypes.rst:4850 msgid "Return a new set with elements from the set and all others." -msgstr "" +msgstr "Επιστρέφει ένα νέο σύνολο με στοιχεία από το σύνολο και όλα τα άλλα." -#: library/stdtypes.rst:4310 +#: library/stdtypes.rst:4855 msgid "Return a new set with elements common to the set and all others." msgstr "" +"Επιστρέφει ένα νέο σύνολο με στοιχεία κοινά στο σύνολο και σε όλα τα άλλα." -#: library/stdtypes.rst:4315 +#: library/stdtypes.rst:4860 msgid "Return a new set with elements in the set that are not in the others." msgstr "" +"Επιστρέφει ένα νέο σύνολο με στοιχεία στο σύνολο που δεν υπάρχουν στα άλλα." -#: library/stdtypes.rst:4320 +#: library/stdtypes.rst:4865 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" +"Επιστρέφει ένα νέο σύνολο με στοιχεία είτε στο σύνολο είτε στο *other* αλλά " +"όχι και στα δύο." -#: library/stdtypes.rst:4324 +#: library/stdtypes.rst:4869 msgid "Return a shallow copy of the set." -msgstr "" +msgstr "Επιστρέφει ένα ρηχό αντίγραφο του συνόλου." -#: library/stdtypes.rst:4327 +#: library/stdtypes.rst:4872 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -4482,8 +8631,15 @@ msgid "" "precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " "the more readable ``set('abc').intersection('cbs')``." msgstr "" +"Σημείωση, οι εκδόσεις μη τελεστών των μεθόδων :meth:`union`, :meth:" +"`intersection`, :meth:`difference`, :meth:`symmetric_difference`, :meth:" +"`issubset`, και :meth:`issuperset` θα δεχτούν οποιοδήποτε iterable ως " +"όρισμα. Αντίθετα, οι αντίστοιχοι τελεστές απαιτούν να οριστούν τα ορίσματά " +"τους για να γίνουν σύνολα. Αυτό αποκλείει κατασκευαστές επιρρεπείς σε " +"σφάλματα όπως ``set('abc') & 'cbs'`` υπέρ του πιο ευανάγνωστου ``set('abc')." +"intersection('cbs')``." -#: library/stdtypes.rst:4334 +#: library/stdtypes.rst:4879 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -4492,106 +8648,148 @@ msgid "" "is not equal). A set is greater than another set if and only if the first " "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" +"Τόσο το :class:`set` και :class:`frozenset` υποστηρίζουν τη σύγκριση μεταξύ " +"συνόλων. Δύο σύνολα είναι ίσα εάν και μόνο εάν κάθε στοιχείο κάθε συνόλου " +"περιέχεται στο άλλο (το καθένα είναι υποσύνολο του άλλου). Ένα σύνολο είναι " +"μικρότερο από ένα άλλο σύνολο εάν και μόνο αν το πρώτο σύνολο είναι σωστό " +"υποσύνολο του δεύτερου συνόλου (είναι υποσύνολο, αλλά δεν είναι ίσο), ένα " +"σύνολο είναι μεγαλύτερο από ένα άλλο σύνολο, αν και μόνο αν το πρώτο σύνολο " +"είναι σωστό υπερσύνολο του δεύτερου συνόλου (είναι υπερσύνολο αλλά δεν είναι " +"ίσο)." -#: library/stdtypes.rst:4341 +#: library/stdtypes.rst:4886 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" +"Τα στιγμιότυπα της :class:`set` συγκρίνονται με τα στιγμιότυπα της :class:" +"`frozenset` με βάση τα μέλη τους. Για παράδειγμα, το ``set('abc') == " +"frozenset('abc')`` επιστρέφει ``True`` και το ίδιο συμβαίνει και με το " +"``set('abc') in set([frozenset('abc')])``." -#: library/stdtypes.rst:4345 +#: library/stdtypes.rst:4890 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " "not subsets of each other, so *all* of the following return ``False``: " "``ab``." msgstr "" +"Οι συγκρίσεις υποσυνόλου και ισότητας δεν γενικεύονται σε μια συνάρτηση " +"ολικής ταξινόμησης. Για παράδειγμα, οποιαδήποτε δύο μη κενά συνεχή σύνολα " +"δεν είναι ίσα και δεν είναι υποσύνολα το ένα του άλλου, επομένως *όλα* τα " +"ακόλουθα επιστρέφουν ``False``: ``ab``." -#: library/stdtypes.rst:4350 +#: library/stdtypes.rst:4895 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" +"Δεδομένου ότι τα σύνολα ορίζουν μόνο μερική σειρά (σχέσεις υποσυνόλων), η " +"έξοδος της μεθόδου :meth:`list.sort` δεν έχει οριστεί για λίστες συνόλων." -#: library/stdtypes.rst:4353 +#: library/stdtypes.rst:4898 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" +"Τα στοιχεία συνόλου, όπως τα κλειδιά λεξικού, πρέπει να είναι :term:" +"`hashable`." -#: library/stdtypes.rst:4355 +#: library/stdtypes.rst:4900 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" +"Δυαδικές πράξεις που συνδυάζουν στιγμιότυπα :class:`set` με :class:" +"`frozenset` επιστρέφουν τον τύπο του πρώτου τελεστή. Για παράδειγμα: " +"``frozenset('ab') | set('bc')`` επιστρέφει ένα στιγμιότυπο του :class:" +"`frozenset`." -#: library/stdtypes.rst:4359 +#: library/stdtypes.rst:4904 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" +"Ο παρακάτω πίνακας παραθέτει λειτουργίες που είναι διαθέσιμες για :class:" +"`set` που δεν ισχύουν για αμετάβλητα στιγμιότυπα της :class:`frozenset`:" -#: library/stdtypes.rst:4365 +#: library/stdtypes.rst:4910 msgid "Update the set, adding elements from all others." -msgstr "" +msgstr "Ενημερώνει το σύνολο (set), προσθέτοντας στοιχεία από όλα τα άλλα." -#: library/stdtypes.rst:4370 +#: library/stdtypes.rst:4915 msgid "Update the set, keeping only elements found in it and all others." msgstr "" +"Ενημερώνει το σύνολο, διατηρώντας μόνο τα στοιχεία που βρίσκονται σε αυτό " +"και όλα τα άλλα." -#: library/stdtypes.rst:4375 +#: library/stdtypes.rst:4920 msgid "Update the set, removing elements found in others." -msgstr "" +msgstr "Ενημερώνει το σύνολο, αφαιρώντας στοιχεία που βρίσκονται σε άλλα." -#: library/stdtypes.rst:4380 +#: library/stdtypes.rst:4925 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" +"Ενημερώνει το σύνολο, διατηρώντας μόνο τα στοιχεία που βρίσκονται σε κάθε " +"σύνολο, αλλά όχι και στα δύο." -#: library/stdtypes.rst:4384 +#: library/stdtypes.rst:4929 msgid "Add element *elem* to the set." -msgstr "" +msgstr "Προσθέτει το στοιχείο *elem* στο σύνολο." -#: library/stdtypes.rst:4388 +#: library/stdtypes.rst:4933 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" +"Αφαιρεί το στοιχείο *elem* από το σύνολο. Κάνει raise τη :exc:`KeyError` " +"εάν το *elem* δεν περιέχεται στο σύνολο." -#: library/stdtypes.rst:4393 +#: library/stdtypes.rst:4938 msgid "Remove element *elem* from the set if it is present." -msgstr "" +msgstr "Αφαιρεί το στοιχείο *elem* από το σύνολο εάν υπάρχει." -#: library/stdtypes.rst:4397 +#: library/stdtypes.rst:4942 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" +"Αφαιρεί και επιστρέφει ένα αυθαίρετο στοιχείο από το σύνολο. Κάνει raise " +"μια :exc:`KeyError` εάν το σύνολο είναι κενό." -#: library/stdtypes.rst:4402 +#: library/stdtypes.rst:4947 msgid "Remove all elements from the set." -msgstr "" +msgstr "Αφαιρεί όλα τα στοιχεία από το σύνολο (set)." -#: library/stdtypes.rst:4405 +#: library/stdtypes.rst:4950 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" "`symmetric_difference_update` methods will accept any iterable as an " "argument." msgstr "" +"Σημείωση, οι εκδόσεις μη-τελεστή μεθόδων :meth:`update`, :meth:" +"`intersection_update`, :meth:`difference_update`, και :meth:" +"`symmetric_difference_update` θα δέχονται οποιοδήποτε επαναλαμβανόμενο " +"στοιχείο ως όρισμα." -#: library/stdtypes.rst:4410 +#: library/stdtypes.rst:4955 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" "`remove`, and :meth:`discard` methods may be a set. To support searching " "for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" +"Σημείωση, το όρισμα *elem* για τις μεθόδους :meth:`~object.__contains__`, :" +"meth:`remove`, και :meth:`discard` μπορεί να είναι ένα σύνολο. Για την " +"υποστήριξη της αναζήτησης για ένα ισοδύναμο παγωμένο σύνολο (frozenset), ένα " +"προσωρινό δημιουργείται από το *elem*." -#: library/stdtypes.rst:4419 +#: library/stdtypes.rst:4964 msgid "Mapping Types --- :class:`dict`" -msgstr "" +msgstr "Τύποι αντιστοίχισης --- :class:`dict`" -#: library/stdtypes.rst:4429 +#: library/stdtypes.rst:4974 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -4599,8 +8797,14 @@ msgid "" "`list`, :class:`set`, and :class:`tuple` classes, and the :mod:`collections` " "module.)" msgstr "" +"Ένα αντικείμενο :term:`mapping` αντιστοιχίζει :term:`hashable` τιμές σε " +"αυθαίρετα αντικείμενα. Οι αντιστοιχίσεις είναι μεταβλητά αντικείμενα. " +"Υπάρχει επί του παρόντος μόνο ένα τυπικός τύπο αντιστοίχισης, το :dfn:" +"`dictionary`. (Για άλλα containers δείτε τις ενσωματωμένες (built-in) :" +"class:`list`, :class:`set`, και :class:`tuple` κλάσεις, και το module :mod:" +"`collections`.)" -#: library/stdtypes.rst:4435 +#: library/stdtypes.rst:4980 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -4608,141 +8812,296 @@ msgid "" "may not be used as keys. Values that compare equal (such as ``1``, ``1.0``, " "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" +"Τα κλειδιά ενός λεξικού είναι *σχεδόν* αυθαίρετες τιμές. Οι τιμές που δεν " +"είναι :term:`hashable`, δηλαδή, τιμές που περιέχουν λίστες, λεξικά ή άλλους " +"μεταβλητούς τύπους (που συγκρίνονται βάσει τιμής και όχι βάσει ταυτότητας " +"αντικειμένου) δεν μπορούν να χρησιμοποιηθούν ως κλειδιά. Οι τιμές που " +"συγκρίνονται ίσες (όπως ``1``, ``1.0``, και ``True``) μπορούν να " +"χρησιμοποιηθούν εναλλακτικά για το index της ίδιας καταχώρισης λεξικού." -#: library/stdtypes.rst:4446 +#: library/stdtypes.rst:4991 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" +"Επιστρέφει ένα νέο λεξικό που έχει αρχικοποιηθεί από ένα προαιρετικό όρισμα " +"θέσης και ένα πιθανό κενό σύνολο ορισμάτων λέξεων-κλειδιών." -#: library/stdtypes.rst:4449 +#: library/stdtypes.rst:4994 msgid "Dictionaries can be created by several means:" -msgstr "" +msgstr "Τα λεξικά μπορούν να δημιουργηθούν με διάφορους τρόπους:" -#: library/stdtypes.rst:4451 +#: library/stdtypes.rst:4996 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" +"Χρησιμοποιήστε μια λίστα διαχωρισμένων με κόμματα ζευγών ``key: value`` μέσα " +"σε αγκύλες: ``{'jack': 4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: " +"'sjoerd'}``" -#: library/stdtypes.rst:4453 +#: library/stdtypes.rst:4998 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" +"Χρησιμοποιήστε ένα comprehension λεξικού: ``{}``, ``{x: x ** 2 for x in " +"range(10)}``" -#: library/stdtypes.rst:4454 +#: library/stdtypes.rst:4999 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" +"Χρησιμοποιήστε τον κατασκευαστή τύπου: ``dict()``, ``dict([('foo', 100), " +"('bar', 200)])``, ``dict(foo=100, bar=200)``" -#: library/stdtypes.rst:4457 +#: library/stdtypes.rst:5002 msgid "" "If no positional argument is given, an empty dictionary is created. If a " -"positional argument is given and it is a mapping object, a dictionary is " -"created with the same key-value pairs as the mapping object. Otherwise, the " -"positional argument must be an :term:`iterable` object. Each item in the " -"iterable must itself be an iterable with exactly two objects. The first " -"object of each item becomes a key in the new dictionary, and the second " -"object the corresponding value. If a key occurs more than once, the last " -"value for that key becomes the corresponding value in the new dictionary." -msgstr "" - -#: library/stdtypes.rst:4467 +"positional argument is given and it defines a ``keys()`` method, a " +"dictionary is created by calling :meth:`~object.__getitem__` on the argument " +"with each returned key from the method. Otherwise, the positional argument " +"must be an :term:`iterable` object. Each item in the iterable must itself " +"be an iterable with exactly two elements. The first element of each item " +"becomes a key in the new dictionary, and the second element the " +"corresponding value. If a key occurs more than once, the last value for " +"that key becomes the corresponding value in the new dictionary." +msgstr "" +"Εάν δεν δοθεί όρισμα θέσης, δημιουργείται ένα κενό λεξικό. Εάν δοθεί ένα " +"όρισμα θέσης και ορίζει μια μέθοδο ``keys()``, δημιουργείται ένα λεξικό " +"καλώντας το :meth:`~object.__getitem__` στο όρισμα με κάθε κλειδί που " +"επιστρέφεται από τη μέθοδο. Διαφορετικά, το όρισμα θέσης πρέπει να είναι ένα " +"αντικείμενο :term:`iterable`. Κάθε στοιχείο στο iterable πρέπει από μόνο του " +"να είναι ένας iterable με ακριβώς δύο στοιχεία. Το πρώτο στοιχείο κάθε " +"στοιχείου γίνεται κλειδί στο νέο λεξικό και το δεύτερο στοιχείο η αντίστοιχη " +"τιμή. Εάν ένα κλειδί εμφανίζεται περισσότερες από μία φορές, η τελευταία " +"τιμή για αυτό το κλειδί γίνεται η αντίστοιχη τιμή στο νέο λεξικό." + +#: library/stdtypes.rst:5012 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " "being added is already present, the value from the keyword argument replaces " "the value from the positional argument." msgstr "" +"Εάν δίνονται ορίσματα λέξης-κλειδιού, τα ορίσματα λέξης-κλειδιού και οι " +"τιμές τους προστίθενται στο λεξικό που δημιουργήθηκε από το όρισμα θέσης. " +"Εάν υπάρχει ήδη ένα κλειδί που προστίθεται, η τιμή από το όρισμα λέξης-" +"κλειδιού αντικαθιστά την τιμή από το όρισμα θέσης." + +#: library/stdtypes.rst:5035 +msgid "" +"Providing keyword arguments as in the first example only works for keys that " +"are valid Python identifiers. Otherwise, any valid keys can be used." +msgstr "" +"Η παροχή ορισμάτων λέξεων-κλειδιών όπως στο πρώτο παράδειγμα λειτουργεί μόνο " +"για κλειδιά που είναι έγκυρα αναγνωριστικά Python. Διαφορετικά, μπορούν να " +"χρησιμοποιηθούν οποιαδήποτε έγκυρα κλειδιά." -#: library/stdtypes.rst:4472 +#: library/stdtypes.rst:5020 msgid "" -"To illustrate, the following examples all return a dictionary equal to " +"Dictionaries compare equal if and only if they have the same ``(key, " +"value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " +"'>') raise :exc:`TypeError`. To illustrate dictionary creation and " +"equality, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" +"Τα λεξικά συγκρίνονται ως ίσα εάν και μόνο εάν έχουν τα ίδια ζεύγη ``(key, " +"value)`` (ανεξάρτητα από τη σειρά). Οι συγκρίσεις διάταξης ('<', '<=', '>=', " +"'>') κάνουν raise την :exc:`TypeError`. Για να επεξηγηθεί η δημιουργία " +"λεξικού και η ισότητα, τα ακόλουθα παραδείγματα επιστρέφουν όλα ένα λεξικό " +"ίσο με ``{\"one\": 1, \"two\": 2, \"three\": 3}``::" -#: library/stdtypes.rst:4484 +#: library/stdtypes.rst:5026 msgid "" -"Providing keyword arguments as in the first example only works for keys that " -"are valid Python identifiers. Otherwise, any valid keys can be used." +">>> a = dict(one=1, two=2, three=3)\n" +">>> b = {'one': 1, 'two': 2, 'three': 3}\n" +">>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\n" +">>> d = dict([('two', 2), ('one', 1), ('three', 3)])\n" +">>> e = dict({'three': 3, 'one': 1, 'two': 2})\n" +">>> f = dict({'one': 1, 'three': 3}, two=2)\n" +">>> a == b == c == d == e == f\n" +"True" +msgstr "" +">>> a = dict(one=1, two=2, three=3)\n" +">>> b = {'one': 1, 'two': 2, 'three': 3}\n" +">>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\n" +">>> d = dict([('two', 2), ('one', 1), ('three', 3)])\n" +">>> e = dict({'three': 3, 'one': 1, 'two': 2})\n" +">>> f = dict({'one': 1, 'three': 3}, two=2)\n" +">>> a == b == c == d == e == f\n" +"True" + +#: library/stdtypes.rst:5038 +msgid "" +"Dictionaries preserve insertion order. Note that updating a key does not " +"affect the order. Keys added after deletion are inserted at the end. ::" +msgstr "" +"Τα λεξικά διατηρούν τη σειρά εισαγωγής. Σημειώστε ότι η ενημέρωση ενός " +"κλειδιού δεν επηρεάζει τη σειρά. Τα κλειδιά που προστέθηκαν μετά τη " +"διαγραφή εισάγονται στο τέλος. ::" + +#: library/stdtypes.rst:5041 +msgid "" +">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" +">>> d\n" +"{'one': 1, 'two': 2, 'three': 3, 'four': 4}\n" +">>> list(d)\n" +"['one', 'two', 'three', 'four']\n" +">>> list(d.values())\n" +"[1, 2, 3, 4]\n" +">>> d[\"one\"] = 42\n" +">>> d\n" +"{'one': 42, 'two': 2, 'three': 3, 'four': 4}\n" +">>> del d[\"two\"]\n" +">>> d[\"two\"] = None\n" +">>> d\n" +"{'one': 42, 'three': 3, 'four': 4, 'two': None}" +msgstr "" +">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" +">>> d\n" +"{'one': 1, 'two': 2, 'three': 3, 'four': 4}\n" +">>> list(d)\n" +"['one', 'two', 'three', 'four']\n" +">>> list(d.values())\n" +"[1, 2, 3, 4]\n" +">>> d[\"one\"] = 42\n" +">>> d\n" +"{'one': 42, 'two': 2, 'three': 3, 'four': 4}\n" +">>> del d[\"two\"]\n" +">>> d[\"two\"] = None\n" +">>> d\n" +"{'one': 42, 'three': 3, 'four': 4, 'two': None}" + +#: library/stdtypes.rst:5056 +msgid "" +"Dictionary order is guaranteed to be insertion order. This behavior was an " +"implementation detail of CPython from 3.6." msgstr "" +"Η σειρά λεξικού είναι εγγυημένη ότι είναι η σειρά εισαγωγής. Αυτή η " +"συμπεριφορά ήταν μια λεπτομέρεια υλοποίηση της CPython από την έκδοση 3.6." -#: library/stdtypes.rst:4488 +#: library/stdtypes.rst:5060 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" +"Αυτές είναι οι λειτουργίες που υποστηρίζουν τα λεξικά (και επομένως, θα " +"πρέπει να υποστηρίζουν και προσαρμοσμένους τύπους αντιστοίχισης επίσης):" -#: library/stdtypes.rst:4493 +#: library/stdtypes.rst:5065 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" +"Επιστρέφει μια λίστα με όλα τα κλειδιά που χρησιμοποιούνται στο λεξικό *d*." -#: library/stdtypes.rst:4497 +#: library/stdtypes.rst:5069 msgid "Return the number of items in the dictionary *d*." -msgstr "" +msgstr "Επιστρέφει τον αριθμό των στοιχείων στο λεξικό *d*." -#: library/stdtypes.rst:4501 +#: library/stdtypes.rst:5073 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" +"Επιστρέφει το στοιχείο του *d* με το κλειδί *key*. Κάνει raise μια :exc:" +"`KeyError` εάν το *key* δεν υπάρχει για να αντιστοιχηθεί." -#: library/stdtypes.rst:4506 +#: library/stdtypes.rst:5078 msgid "" -"If a subclass of dict defines a method :meth:`__missing__` and *key* is not " -"present, the ``d[key]`` operation calls that method with the key *key* as " -"argument. The ``d[key]`` operation then returns or raises whatever is " -"returned or raised by the ``__missing__(key)`` call. No other operations or " -"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not defined, :" -"exc:`KeyError` is raised. :meth:`__missing__` must be a method; it cannot be " -"an instance variable::" -msgstr "" +"If a subclass of dict defines a method :meth:`~object.__missing__` and *key* " +"is not present, the ``d[key]`` operation calls that method with the key " +"*key* as argument. The ``d[key]`` operation then returns or raises whatever " +"is returned or raised by the ``__missing__(key)`` call. No other operations " +"or methods invoke :meth:`~object.__missing__`. If :meth:`~object." +"__missing__` is not defined, :exc:`KeyError` is raised. :meth:`~object." +"__missing__` must be a method; it cannot be an instance variable::" +msgstr "" +"Εάν μια υποκλάση ενός λεξικού ορίζει μια μέθοδο :meth:`~object.__missing__` " +"και το *key* δεν υπάρχει, η λειτουργία ``d[key]`` καλεί αυτήν την μέθοδο με " +"το κλειδί *key* ως όρισμα. Στη συνέχεια, η λειτουργία ``d[key]`` επιστρέφει " +"ή κάνει raise ό, τι επιστρέφεται ή γίνεται raise από την κλήση " +"``__missing__(key)``. Καμία άλλη λειτουργία ή μέθοδος δεν επικαλεί την :meth:" +"`~object.__missing__`. Εάν το :meth:`~object.__missing__` δεν έχει οριστεί, " +"γίνεται raise :exc:`KeyError`. To :meth:`~object.__missing__` πρέπει να " +"είναι μέθοδος∙ δεν μπορεί να είναι ένα στιγμιότυπο μεταβλητής::" -#: library/stdtypes.rst:4525 +#: library/stdtypes.rst:5086 +msgid "" +">>> class Counter(dict):\n" +"... def __missing__(self, key):\n" +"... return 0\n" +"...\n" +">>> c = Counter()\n" +">>> c['red']\n" +"0\n" +">>> c['red'] += 1\n" +">>> c['red']\n" +"1" +msgstr "" +">>> class Counter(dict):\n" +"... def __missing__(self, key):\n" +"... return 0\n" +"...\n" +">>> c = Counter()\n" +">>> c['red']\n" +"0\n" +">>> c['red'] += 1\n" +">>> c['red']\n" +"1" + +#: library/stdtypes.rst:5097 msgid "" "The example above shows part of the implementation of :class:`collections." -"Counter`. A different ``__missing__`` method is used by :class:`collections." -"defaultdict`." +"Counter`. A different :meth:`!__missing__` method is used by :class:" +"`collections.defaultdict`." msgstr "" +"Το παραπάνω παράδειγμα δείχνει μέρος της υλοποίησης του :class:`collections." +"Counter`. Μια διαφορετική μέθοδος :meth:`!__missing__` χρησιμοποιείται από " +"την :class:`collections.defaultdict`." -#: library/stdtypes.rst:4531 +#: library/stdtypes.rst:5104 msgid "Set ``d[key]`` to *value*." -msgstr "" +msgstr "Ορίζει το ``d[key]`` στο *value*." -#: library/stdtypes.rst:4535 +#: library/stdtypes.rst:5108 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "" +"Αφαιρεί το ``d[key]`` από το *d*. Κάνει raise ένα :exc:`KeyError` εάν το " +"*key* δεν υπάρχει για αντιστοίχιση." -#: library/stdtypes.rst:4540 +#: library/stdtypes.rst:5113 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "" +"Επιστρέφει ``True`` εάν το *d* έχει ένα κλειδί *key*, διαφορετικά ``False``." -#: library/stdtypes.rst:4544 +#: library/stdtypes.rst:5117 msgid "Equivalent to ``not key in d``." -msgstr "" +msgstr "Ισοδυναμεί με ``not key in d``." -#: library/stdtypes.rst:4548 +#: library/stdtypes.rst:5121 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" +"Επιστρέφει έναν iterator πάνω από τα κλειδιά του λεξικού. Αυτή είναι μια " +"συντόμευση για ``iter(d.keys())``." -#: library/stdtypes.rst:4553 +#: library/stdtypes.rst:5126 msgid "Remove all items from the dictionary." -msgstr "" +msgstr "Αφαιρεί όλα τα στοιχεία από το λεξικό." -#: library/stdtypes.rst:4557 +#: library/stdtypes.rst:5130 msgid "Return a shallow copy of the dictionary." -msgstr "" +msgstr "Επιστρέφει ένα ρηχό αντίγραφο του λεξικού." -#: library/stdtypes.rst:4561 +#: library/stdtypes.rst:5134 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" +"Δημιουργεί ένα νέο λεξικό με κλειδιά από το *iterable* και τιμές ως *value*." -#: library/stdtypes.rst:4563 +#: library/stdtypes.rst:5136 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -4750,207 +9109,296 @@ msgid "" "an empty list. To get distinct values, use a :ref:`dict comprehension " "` instead." msgstr "" +"Το :meth:`fromkeys` είναι μια μέθοδος κλάσης που επιστρέφει ένα νέο λεξικό. " +"Η τιμή *value* ορίζεται από προεπιλογή σε ``None``. Όλες οι τιμές " +"αναφέρονται σε ένα μόνο στιγμιότυπο, επομένως γενικά δεν έχει νόημα για το " +"*value* να είναι μεταβλητό αντικείμενο, όπως μια κενή λίστα. Για να λάβετε " +"διαφορετικές τιμές, χρησιμοποιήστε αντ' αυτού ένα :ref:`dict comprehension " +"`." -#: library/stdtypes.rst:4571 +#: library/stdtypes.rst:5144 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" +"Επιστρέφει την τιμή για το *key* εάν το *key* είναι στο λεξικό, αλλιώς " +"*default*. Εάν το *default* δεν δίνεται, ορίζεται από προεπιλογή σε " +"``None``, έτσι ώστε αυτή η μέθοδος να μην κάνει raise μια :exc:`KeyError`." -#: library/stdtypes.rst:4577 +#: library/stdtypes.rst:5150 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" +"Επιστρέφει μια νέα όψη των στοιχείων του λεξικού (``(key, value)`` ζεύγη). " +"Δείτε την :ref:`documentation of view objects `." -#: library/stdtypes.rst:4582 +#: library/stdtypes.rst:5155 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" +"Επιστρέφει μια νέα όψη των κλειδιών του λεξικού. Δείτε το :ref:" +"`documentation of view objects `." -#: library/stdtypes.rst:4587 +#: library/stdtypes.rst:5161 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" +"Εάν το *key* βρίσκεται στο λεξικό, αφαιρείται και επιστρέφει την τιμή του, " +"διαφορετικά επιστρέφει *default*. Εάν *default* δεν δίνεται και το *key* " +"δεν είναι στο λεξικό, γίνεται raise ένα :exc:`KeyError`." -#: library/stdtypes.rst:4593 +#: library/stdtypes.rst:5167 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" +"Αφαιρεί και επιστρέφει ένα ζεύγος ``(key, value)`` από το λεξικό. Τα ζεύγη " +"επιστρέφονται με τη σειρά :abbr:`LIFO (last-in, first-out)`." -#: library/stdtypes.rst:4596 +#: library/stdtypes.rst:5170 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" +"Η μέθοδος :meth:`popitem` είναι χρήσιμη για καταστροφική επανάληψη σε ένα " +"λεξικό, όπως χρησιμοποιείται συχνά σε αλγόριθμους συνόλου. Εάν το λεξικό " +"είναι κενό, η κλήση της :meth:`popitem` κάνει raise ένα :exc:`KeyError`." -#: library/stdtypes.rst:4600 +#: library/stdtypes.rst:5174 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" +"Η σειρά LIFO είναι πλέον εγγυημένη. Σε προηγούμενες εκδόσεις, η :meth:" +"`popitem` επιστρέφει ένα αυθαίρετο ζεύγος κλειδιού/τιμής." -#: library/stdtypes.rst:4606 +#: library/stdtypes.rst:5180 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" +"Επιστρέφει έναν αντίστροφο iterator πάνω από τα κλειδιά του λεξικού. Αυτή " +"είναι μια συντόμευση για ``reversed(d.keys())``." -#: library/stdtypes.rst:4613 +#: library/stdtypes.rst:5187 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" +"Εάν το *key* βρίσκεται στο λεξικό, επιστρέφει την τιμή του. Εάν όχι, " +"εισάγετε το *key* με τιμή *default* και επιστρέφει *default*. Το *default* " +"από προεπιλογή είναι ``None``." -#: library/stdtypes.rst:4619 +#: library/stdtypes.rst:5195 msgid "" -"Update the dictionary with the key/value pairs from *other*, overwriting " -"existing keys. Return ``None``." +"Update the dictionary with the key/value pairs from *mapping* or *iterable* " +"and *kwargs*, overwriting existing keys. Return ``None``." msgstr "" +"Ενημερώνει το λεξικό με τα ζεύγη κλειδιών/τιμών από το *mapping* ή " +"*iterable* και *kwargs*, αντικαθιστώντας τα υπάρχοντα κλειδιά. Επιστρέφει " +"``None``." -#: library/stdtypes.rst:4622 +#: library/stdtypes.rst:5198 msgid "" -":meth:`update` accepts either another dictionary object or an iterable of " -"key/value pairs (as tuples or other iterables of length two). If keyword " -"arguments are specified, the dictionary is then updated with those key/value " -"pairs: ``d.update(red=1, blue=2)``." +":meth:`update` accepts either another object with a ``keys()`` method (in " +"which case :meth:`~object.__getitem__` is called with every key returned " +"from the method) or an iterable of key/value pairs (as tuples or other " +"iterables of length two). If keyword arguments are specified, the dictionary " +"is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" +"Η :meth:`update` δέχεται είτε ένα άλλο αντικείμενο με τη μέθοδο ``keys()`` " +"(στην περίπτωση αυτή το :meth:`~object.__getitem__` καλείται με κάθε κλειδί " +"που επιστρέφεται από τη μέθοδο) είτε ένα iterable από ζεύγη κλειδιών/τιμών " +"(ως πλειάδες ή άλλα iterables μήκους δύο). Εάν καθορίζονται ορίσματα λέξεων-" +"κλειδιών, το λεξικό ενημερώνεται στη συνέχεια με αυτά τα ζεύγη κλειδιών/" +"τιμών: ``d.update(red=1, blue=2)``." -#: library/stdtypes.rst:4629 +#: library/stdtypes.rst:5206 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" +"Επιστρέφει μια νέα όψη των τιμών του λεξικού. Δείτε την :ref:`documentation " +"of view objects `." -#: library/stdtypes.rst:4632 +#: library/stdtypes.rst:5209 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" +"Μια σύγκριση ισότητας μεταξύ μιας όψης ``dict.values()`` και μιας άλλης θα " +"επιστρέφει πάντα ``False``. Αυτό ισχύει επίσης όταν συγκρίνετε το ``dict." +"values()`` με τον εαυτό της::" -#: library/stdtypes.rst:4642 +#: library/stdtypes.rst:5213 +msgid "" +">>> d = {'a': 1}\n" +">>> d.values() == d.values()\n" +"False" +msgstr "" +">>> d = {'a': 1}\n" +">>> d.values() == d.values()\n" +"False" + +#: library/stdtypes.rst:5219 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" +"Δημιουργεί ένα νέο λεξικό με τα συγχωνευμένα κλειδιά και τις τιμές των *d* " +"και *other*, τα οποία πρέπει να είναι και τα δύο λεξικά. Οι τιμές του " +"*other* έχουν προτεραιότητα όταν τα κλειδιά των *d* και *other* είναι κοινά." -#: library/stdtypes.rst:4650 +#: library/stdtypes.rst:5227 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" +"Ενημερώνει το λεξικό *d* με κλειδιά και τιμές από το *other*, που μπορεί να " +"είναι είτε :term:`mapping` είτε :term:`iterable` ζευγάρι κλειδιών/τιμών. Οι " +"τιμές του *other* έχουν προτεραιότητα όταν τα κλειδιά των το *d* και *other* " +"είναι κοινά." -#: library/stdtypes.rst:4656 -msgid "" -"Dictionaries compare equal if and only if they have the same ``(key, " -"value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " -"'>') raise :exc:`TypeError`." -msgstr "" - -#: library/stdtypes.rst:4660 -msgid "" -"Dictionaries preserve insertion order. Note that updating a key does not " -"affect the order. Keys added after deletion are inserted at the end. ::" -msgstr "" - -#: library/stdtypes.rst:4678 -msgid "" -"Dictionary order is guaranteed to be insertion order. This behavior was an " -"implementation detail of CPython from 3.6." -msgstr "" - -#: library/stdtypes.rst:4682 +#: library/stdtypes.rst:5233 msgid "Dictionaries and dictionary views are reversible. ::" -msgstr "" - -#: library/stdtypes.rst:4694 +msgstr "Τα λεξικά και οι όψεις λεξικών είναι αναστρέψιμες. ::" + +#: library/stdtypes.rst:5235 +msgid "" +">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" +">>> d\n" +"{'one': 1, 'two': 2, 'three': 3, 'four': 4}\n" +">>> list(reversed(d))\n" +"['four', 'three', 'two', 'one']\n" +">>> list(reversed(d.values()))\n" +"[4, 3, 2, 1]\n" +">>> list(reversed(d.items()))\n" +"[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" +msgstr "" +">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" +">>> d\n" +"{'one': 1, 'two': 2, 'three': 3, 'four': 4}\n" +">>> list(reversed(d))\n" +"['four', 'three', 'two', 'one']\n" +">>> list(reversed(d.values()))\n" +"[4, 3, 2, 1]\n" +">>> list(reversed(d.items()))\n" +"[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" + +#: library/stdtypes.rst:5245 msgid "Dictionaries are now reversible." -msgstr "" +msgstr "Τα λεξικά είναι πλέον αναστρέψιμα." -#: library/stdtypes.rst:4699 +#: library/stdtypes.rst:5250 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" +"Η :class:`types.MappingProxyType` μπορεί να χρησιμοποιηθεί για τη δημιουργία " +"μιας όψης μόνο για ανάγνωση μιας :class:`dict`." -#: library/stdtypes.rst:4706 +#: library/stdtypes.rst:5257 msgid "Dictionary view objects" -msgstr "" +msgstr "Αντικείμενα όψης λεξικού" -#: library/stdtypes.rst:4708 +#: library/stdtypes.rst:5259 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " "dictionary's entries, which means that when the dictionary changes, the view " "reflects these changes." msgstr "" +"Τα αντικείμενα που επιστρέφονται από τις :meth:`dict.keys`, :meth:`dict." +"values` and :meth:`dict.items` είναι *όψεις αντικειμένων (view objects)*. " +"Παρέχουν μια δυναμική όψη στις εγγραφές του λεξικού, που σημαίνει ότι όταν " +"αλλάζει το λεξικό, η όψη αντικατοπτρίζει αυτές τις αλλαγές." -#: library/stdtypes.rst:4713 +#: library/stdtypes.rst:5264 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" +"Οι όψεις λεξικού μπορούν να γίνουν iterate για την απόδοση των αντίστοιχων " +"δεδομένων τους και την υποστήριξη ελέγχων για το αν είναι μέρος του:" -#: library/stdtypes.rst:4718 +#: library/stdtypes.rst:5269 msgid "Return the number of entries in the dictionary." -msgstr "" +msgstr "Επιστρέφει τον αριθμό των καταχωρήσεων στο λεξικό." -#: library/stdtypes.rst:4722 +#: library/stdtypes.rst:5273 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" +"Επιστρέφει έναν iterator πάνω στα κλειδιά, τις τιμές ή τα στοιχεία (που " +"αντιπροσωπεύονται ως πλειάδες (tuples) του ``(key, value)`` στο λεξικό." -#: library/stdtypes.rst:4725 +#: library/stdtypes.rst:5276 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." "values(), d.keys())``. Another way to create the same list is ``pairs = " "[(v, k) for (k, v) in d.items()]``." msgstr "" +"Τα κλειδιά και οι τιμές επαναλαμβάνονται με την σειρά εισαγωγής. Αυτό " +"επιτρέπει τη δημιουργία ζευγών ``(value, key)`` χρησιμοποιώντας τη :func:" +"`zip`: ``pairs = zip(d.values(), d.keys())``. Ένας άλλος τρόπος είναι να " +"δημιουργήσετε την ίδια λίστα είναι ``pairs = [(v, k) for (k, v) in d." +"items()]``." -#: library/stdtypes.rst:4730 +#: library/stdtypes.rst:5281 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" +"Το iterate όψεων κατά την προσθήκη ή τη διαγραφή καταχωρήσεων στο λεξικό " +"μπορεί να κάνει raise μια :exc:`RuntimeError` ή να αποτύχει το iterate σε " +"όλες τις καταχωρήσεις." -#: library/stdtypes.rst:4733 +#: library/stdtypes.rst:5284 msgid "Dictionary order is guaranteed to be insertion order." -msgstr "" +msgstr "Η σειρά λεξικού είναι εγγυημένη σειρά εισαγωγής." -#: library/stdtypes.rst:4738 +#: library/stdtypes.rst:5289 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" +"Επιστρέφει ``True`` εάν το *x* βρίσκεται στα κλειδιά του λεξικού, τις τιμές " +"ή τα στοιχεία του υποκείμενου λεξικού (στην τελευταία περίπτωση, το *x* θα " +"πρέπει να είναι μια ``(key, value)`` πλειάδα (tuple))." -#: library/stdtypes.rst:4743 +#: library/stdtypes.rst:5294 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" +"Επιστρέφει έναν αντίστροφο iterator πάνω στα κλειδιά, τις τιμές ή τα " +"στοιχεία του λεξικού. Η όψη θα γίνει iterate με την αντίστροφη σειρά από την " +"εισαγωγή." -#: library/stdtypes.rst:4746 +#: library/stdtypes.rst:5297 msgid "Dictionary views are now reversible." -msgstr "" +msgstr "Οι όψεις λεξικού είναι πλέον αναστρέψιμες." -#: library/stdtypes.rst:4751 +#: library/stdtypes.rst:5302 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" +"Επιστρέφει μια :class:`types.MappingProxyType` που αναδιπλώνει το αρχικό " +"λεξικό στο οποίο αναφέρεται η όψη." -#: library/stdtypes.rst:4756 +#: library/stdtypes.rst:5307 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -4963,39 +9411,143 @@ msgid "" "any iterable as the other operand, unlike sets which only accept sets as the " "input." msgstr "" - -#: library/stdtypes.rst:4768 +"Οι όψεις κλειδιών μοιάζουν με σύνολο καθώς οι καταχωρίσεις τους είναι " +"μοναδικές και :term:`hashable`. Οι όψεις στοιχείων έχουν επίσης λειτουργίες " +"που μοιάζουν με σύνολο, καθώς τα ζεύγη (κλειδί, τιμή) είναι μοναδικά και τα " +"κλειδιά μπορούν να κατακερματιστούν. Εάν όλες οι τιμές σε μία όψη στοιχείων " +"μπορούν επίσης να κατακερματιστούν, τότε η όψη στοιχείων μπορεί να " +"διαλειτουργήσει με άλλα σύνολα. (Οι όψεις τιμών δεν αντιμετωπίζονται ως " +"σύνολο, καθώς οι καταχωρίσεις δεν είναι γενικά μοναδικές.) Για όψεις που " +"μοιάζουν με σύνολο, όλες οι λειτουργίες που ορίζονται για την αφηρημένη " +"βασική κλάση :class:`collections.abc.Set` είναι διαθέσιμες (για παράδειγμα, " +"``==``, ``<``, ή ``^``). Κατά τη χρήση τελεστών συνόλου, οι όψεις που " +"μοιάζουν με σύνολο δέχονται οποιοδήποτε iterable ως άλλο τελεστή, σε " +"αντίθεση με τα σύνολα που δέχονται μόνο σύνολα ως είσοδο." + +#: library/stdtypes.rst:5319 msgid "An example of dictionary view usage::" -msgstr "" - -#: library/stdtypes.rst:4812 +msgstr "Ένα παράδειγμα χρήσης όψης λεξικού::" + +#: library/stdtypes.rst:5321 +msgid "" +">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" +">>> keys = dishes.keys()\n" +">>> values = dishes.values()\n" +"\n" +">>> # iteration\n" +">>> n = 0\n" +">>> for val in values:\n" +"... n += val\n" +"...\n" +">>> print(n)\n" +"504\n" +"\n" +">>> # keys and values are iterated over in the same order (insertion order)\n" +">>> list(keys)\n" +"['eggs', 'sausage', 'bacon', 'spam']\n" +">>> list(values)\n" +"[2, 1, 1, 500]\n" +"\n" +">>> # view objects are dynamic and reflect dict changes\n" +">>> del dishes['eggs']\n" +">>> del dishes['sausage']\n" +">>> list(keys)\n" +"['bacon', 'spam']\n" +"\n" +">>> # set operations\n" +">>> keys & {'eggs', 'bacon', 'salad'}\n" +"{'bacon'}\n" +">>> keys ^ {'sausage', 'juice'} == {'juice', 'sausage', 'bacon', 'spam'}\n" +"True\n" +">>> keys | ['juice', 'juice', 'juice'] == {'bacon', 'spam', 'juice'}\n" +"True\n" +"\n" +">>> # get back a read-only proxy for the original dictionary\n" +">>> values.mapping\n" +"mappingproxy({'bacon': 1, 'spam': 500})\n" +">>> values.mapping['spam']\n" +"500" +msgstr "" +">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" +">>> keys = dishes.keys()\n" +">>> values = dishes.values()\n" +"\n" +">>> # iteration\n" +">>> n = 0\n" +">>> for val in values:\n" +"... n += val\n" +"...\n" +">>> print(n)\n" +"504\n" +"\n" +">>> # keys and values are iterated over in the same order (insertion order)\n" +">>> list(keys)\n" +"['eggs', 'sausage', 'bacon', 'spam']\n" +">>> list(values)\n" +"[2, 1, 1, 500]\n" +"\n" +">>> # view objects are dynamic and reflect dict changes\n" +">>> del dishes['eggs']\n" +">>> del dishes['sausage']\n" +">>> list(keys)\n" +"['bacon', 'spam']\n" +"\n" +">>> # set operations\n" +">>> keys & {'eggs', 'bacon', 'salad'}\n" +"{'bacon'}\n" +">>> keys ^ {'sausage', 'juice'} == {'juice', 'sausage', 'bacon', 'spam'}\n" +"True\n" +">>> keys | ['juice', 'juice', 'juice'] == {'bacon', 'spam', 'juice'}\n" +"True\n" +"\n" +">>> # get back a read-only proxy for the original dictionary\n" +">>> values.mapping\n" +"mappingproxy({'bacon': 1, 'spam': 500})\n" +">>> values.mapping['spam']\n" +"500" + +#: library/stdtypes.rst:5363 msgid "Context Manager Types" -msgstr "" +msgstr "Τύποι Διαχείρισης Περιεχομένου" -#: library/stdtypes.rst:4819 +#: library/stdtypes.rst:5370 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " "that allow user-defined classes to define a runtime context that is entered " "before the statement body is executed and exited when the statement ends:" msgstr "" +"Η δήλωση :keyword:`with` της Python υποστηρίζει την έννοια ενός περιεχομένου " +"χρόνου εκτέλεσης που ορίζεται από έναν διαχειριστή περιεχομένου. Αυτό " +"υλοποιείται χρησιμοποιώντας ένα ζεύγος μεθόδων που επιτρέπουν σε κλάσεις που " +"ορίζονται από το χρήστη να ορίζουν περιεχόμενο χρόνου εκτέλεσης που " +"εισάγεται πριν από την εκτέλεση του σώματος της δήλωσης και να κάνει έξοδο " +"όταν τερματιστεί η δήλωση:" -#: library/stdtypes.rst:4827 +#: library/stdtypes.rst:5378 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " "to the identifier in the :keyword:`!as` clause of :keyword:`with` statements " "using this context manager." msgstr "" +"Εισάγει το περιεχόμενο εκτέλεσης και επιστρέφει είτε αυτό το αντικείμενο " +"είτε ένα άλλο που σχετίζεται με το περιεχόμενο χρόνου εκτέλεσης. Η τιμή που " +"επιστρέφεται από αυτήν την μέθοδο είναι δεσμευμένη στο αναγνωριστικό στην " +"πρόταση :keyword:`!as` των δηλώσεων :keyword:`with` διαχείρισης περιεχομένου." -#: library/stdtypes.rst:4832 +#: library/stdtypes.rst:5383 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" "`open` to be used as the context expression in a :keyword:`with` statement." msgstr "" +"Ένα παράδειγμα ενός διαχειριστή περιεχομένου που επιστρέφει ο ίδιος είναι " +"ένα :term:`file object`. Τα αντικείμενα αρχείου επιστρέφουν μόνα τους από " +"__enter__() για να επιτρέψουν στο :func:`open` να χρησιμοποιηθεί ως έκφραση " +"περιεχομένου σε μια δήλωση :keyword:`with`." -#: library/stdtypes.rst:4836 +#: library/stdtypes.rst:5387 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -5004,8 +9556,15 @@ msgid "" "the body of the :keyword:`with` statement without affecting code outside " "the :keyword:`!with` statement." msgstr "" +"Ένα παράδειγμα διαχείρισης περιεχομένου που επιστρέφει ένα σχετικό " +"αντικείμενο είναι αυτό που επιστρέφεται από το :func:`decimal.localcontext`. " +"Αυτοί οι διαχειριστές ορίζουν το ενεργό δεκαδικό περιεχόμενο σε ένα " +"αντίγραφο του αρχικού δεκαδικού περιεχομένου και στη συνέχεια επιστρέφουν το " +"αντίγραφο. Αυτό επιτρέπει την πραγματοποίηση αλλαγών στο τρέχον δεκαδικό " +"πλαίσιο στο σώμα της δήλωσης :keyword:`with`, χωρίς να επηρεάζεται ο κώδικας " +"εκτός της δήλωσης :keyword:`!with`." -#: library/stdtypes.rst:4846 +#: library/stdtypes.rst:5397 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -5013,8 +9572,14 @@ msgid "" "the exception type, value and traceback information. Otherwise, all three " "arguments are ``None``." msgstr "" +"Τερματίζει από το περιεχόμενο χρόνου εκτέλεσης και επιστρέφει ένα Boolean " +"δείκτη που υποδεικνύει εάν κάποια εξαίρεση που προέκυψε θα πρέπει να " +"καταργηθεί. Εάν προκύψει μια εξαίρεση κατά την εκτέλεση του σώματος της " +"δήλωσης :keyword:`with`, τα ορίσματα περιέχουν τον τύπο εξαίρεσης, την τιμή " +"και τις πληροφορίες ανίχνευσης. Διαφορετικά, και τα τρία ορίσματα είναι " +"``None``." -#: library/stdtypes.rst:4851 +#: library/stdtypes.rst:5402 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -5024,8 +9589,15 @@ msgid "" "replace any exception that occurred in the body of the :keyword:`!with` " "statement." msgstr "" +"Η επιστροφή μιας πραγματικής τιμής από αυτήν την μέθοδο θα έχει ως " +"αποτέλεσμα η δήλωση :keyword:`with` να καταργήσει την εξαίρεση και να " +"συνεχίσει την εκτέλεση με τη δήλωση αμέσως μετά τη δήλωση :keyword:`!with`. " +"Διαφορετικά, η εξαίρεση θα συνεχίσει να διαδίδεται μετά την ολοκλήρωση αυτής " +"της μεθόδου. Οι εξαιρέσεις που προκύπτουν κατά την εκτέλεση αυτής της " +"μεθόδου θα αντικαταστήσουν κάθε εξαίρεση που προέκυψε στο σώμα της δήλωσης :" +"keyword:`!with`." -#: library/stdtypes.rst:4858 +#: library/stdtypes.rst:5409 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -5033,8 +9605,14 @@ msgid "" "context management code to easily detect whether or not an :meth:`~object." "__exit__` method has actually failed." msgstr "" +"Η εξαίρεση που διαβιβάστηκε δεν θα πρέπει ποτέ να επανατοποθετηθεί ρητά - " +"αντίθετα, αυτή η μέθοδος θα πρέπει να επιστρέψει μια ψευδή τιμή για να " +"υποδείξει ότι η μέθοδος ολοκληρώθηκε με επιτυχία και δεν θέλει να αποκρύψει " +"την εξαίρεση που έχει γίνει raise. Αυτό επιτρέπει στον κώδικα διαχείρισης " +"περιεχομένου να εντοπίζει εύκολα εάν μια μέθοδος :meth:`~object.__exit__` " +"έχει πράγματι αποτύχει." -#: library/stdtypes.rst:4864 +#: library/stdtypes.rst:5415 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -5042,8 +9620,14 @@ msgid "" "are not treated specially beyond their implementation of the context " "management protocol. See the :mod:`contextlib` module for some examples." msgstr "" +"Η Python ορίζει αρκετούς διαχειριστές περιεχομένου για να υποστηρίζουν τον " +"εύκολο συγχρονισμό νημάτων, το άμεσο κλείσιμο αρχείων ή άλλων αντικειμένων " +"και τον απλούστερο χειρισμό του ενεργού δεκαδικού αριθμητικού περιεχομένου. " +"Οι συγκεκριμένοι τύποι δεν αντιμετωπίζονται ειδικά πέρα από την εφαρμογή " +"τους πρωτοκόλλου διαχείρισης περιεχομένου. Δείτε το module :mod:`contextlib` " +"για μερικά παραδείγματα." -#: library/stdtypes.rst:4870 +#: library/stdtypes.rst:5421 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -5052,8 +9636,15 @@ msgid "" "`~contextmanager.__enter__` and :meth:`~contextmanager.__exit__` methods, " "rather than the iterator produced by an undecorated generator function." msgstr "" +"Οι decorators της Python :term:`generator`\\s και :class:`contextlib." +"contextmanager` παρέχουν έναν βολικό τρόπο υλοποίησης αυτών των " +"πρωτοκόλλων. Εάν μια συνάρτηση γεννήτριας είναι decorated με τον :class:" +"`contextlib.contextmanager` decorator, θα επιστρέψει έναν διαχειριστή " +"περιεχομένου που εφαρμόζει τις απαραίτητες μεθόδους :meth:`~contextmanager." +"__enter__` και :meth:`~contextmanager.__exit__`, αντί του iterator που " +"παράγεται από μια undecorated συνάρτηση γεννήτριας." -#: library/stdtypes.rst:4877 +#: library/stdtypes.rst:5428 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -5061,24 +9652,35 @@ msgid "" "Compared to the overhead of setting up the runtime context, the overhead of " "a single class dictionary lookup is negligible." msgstr "" +"Λάβετε υπόψη ότι δεν υπάρχει συγκεκριμένη υποδοχή για καμία από αυτές τις " +"μεθόδους στη δομή τύπου για αντικείμενα Python στο Python/C API. Οι τύποι " +"επεκτάσεων που θέλουν να ορίσουν αυτές τις μεθόδους πρέπει να τις παρέχουν " +"ως μια κανονική μέθοδο προσβάσιμη στην Python. Σε σύγκριση με την επιβάρυνση " +"της ρύθμισης στο πλαίσιο του χρόνου εκτέλεσης, η επιβάρυνση μιας απλής " +"αναζήτησης κλάσης λεξικού είναι αμελητέα." -#: library/stdtypes.rst:4885 +#: library/stdtypes.rst:5436 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" msgstr "" +"Τύποι Annotation τύπου --- :ref:`Generic Alias `, :ref:" +"`Union `" -#: library/stdtypes.rst:4890 +#: library/stdtypes.rst:5441 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." msgstr "" +"Οι βασικοί ενσωματωμένοι τύποι για :term:`type annotations ` " +"είναι :ref:`Generic Alias ` και :ref:`Union `." -#: library/stdtypes.rst:4897 +#: library/stdtypes.rst:5448 msgid "Generic Alias Type" -msgstr "" +msgstr "Τύπος Generic Alias" -#: library/stdtypes.rst:4903 +#: library/stdtypes.rst:5454 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -5087,20 +9689,31 @@ msgid "" "the ``list`` class with the argument :class:`int`. ``GenericAlias`` objects " "are intended primarily for use with :term:`type annotations `." msgstr "" +"Τα αντικείμενα ``GenericAlias`` δημιουργούνται γενικά με :ref:`subscripting " +"` κλάση. Χρησιμοποιούνται πιο συχνά με :ref:`container " +"classes `, όπως :class:`list` ή :class:`dict`.Για " +"παράδειγμα, το ``list[int]`` είναι ένα αντικείμενο ``GenericAlias`` που " +"δημιουργήθηκε με την εγγραφή της κλάσης ``list`` με το όρισμα :class:`int`. " +"Τα αντικείμενα ``GenericAlias`` προορίζονται κυρίως για χρήση με :term:`type " +"annotations `." -#: library/stdtypes.rst:4913 +#: library/stdtypes.rst:5464 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." msgstr "" +"Γενικά είναι δυνατή η εγγραφή μιας κλάσης μόνο εάν η κλάση εφαρμόζει την " +"ειδική μέθοδο :meth:`~object.__class_getitem__`." -#: library/stdtypes.rst:4916 +#: library/stdtypes.rst:5467 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." msgstr "" +"Ένα αντικείμενο ``GenericAlias`` λειτουργεί ως διακομιστής μεσολάβησης " +"(proxy) για έναν :term:`generic type`, υλοποιώντας *parameterized generics*." -#: library/stdtypes.rst:4919 +#: library/stdtypes.rst:5470 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -5108,8 +9721,14 @@ msgid "" "to signify a :class:`set` in which all the elements are of type :class:" "`bytes`." msgstr "" +"Για μια κλάση container, το(α) όρισμα(τα) που παρέχει σε μια :ref:" +"`subscription ` της κλάσης μπορεί να υποδεικνύει τον(ους) " +"τύπο(ους) των στοιχείων που περιέχει ένα αντικείμενο. Για παράδειγμα, το " +"``set[bytes]`` μπορεί να χρησιμοποιηθεί σε annotations τύπου για να " +"υποδηλώσει ένα :class:`set` στο οποίο όλα τα στοιχεία είναι τύπου :class:" +"`bytes`." -#: library/stdtypes.rst:4925 +#: library/stdtypes.rst:5476 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -5117,16 +9736,27 @@ msgid "" "object. For example, :mod:`regular expressions ` can be used on both " "the :class:`str` data type and the :class:`bytes` data type:" msgstr "" +"Για μια κλάση που ορίζει :meth:`~object.__class_getitem__` αλλά δεν είναι " +"container, τα ορίσματα που παρέχονται σε μια συνδρομή της κλάσης θα " +"υποδεικνύουν συχνά τον τύπο ή τους τύπους επιστροφής μιας ή περισσότερων " +"μεθόδων που ορίζονται σε ένα αντικείμενο. Για παράδειγμα, το :mod:`regular " +"expressions ` μπορούν να χρησιμοποιηθούν τόσο στον τύπο δεδομένων :class:" +"`str` όσο και στον τύπο δεδομένων :class:`bytes`:" -#: library/stdtypes.rst:4931 +#: library/stdtypes.rst:5482 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " "both be of type :class:`str`. We can represent this kind of object in type " "annotations with the ``GenericAlias`` ``re.Match[str]``." msgstr "" +"Εάν ``x = re.search('foo', 'foo')``, το ``x`` θα είναι ένα αντικείμενο :ref:" +"`re.Match ` όπου επιστρέφονται οι τιμές του το ``x.group(0)`` " +"και το ``x[0]`` θα είναι και τα δύο τύπου :class:`str`. Μπορούμε να " +"αναπαραστήσουμε αυτό το είδος αντικειμένου σε σχολιασμούς τύπου με το " +"``GenericAlias`` ``re.Match[str]``." -#: library/stdtypes.rst:4937 +#: library/stdtypes.rst:5488 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -5134,36 +9764,85 @@ msgid "" "annotations, we would represent this variety of :ref:`re.Match ` objects with ``re.Match[bytes]``." msgstr "" +"Εάν ``y = re.search(b'bar', b'bar')``, (σημειώστε το ``b`` για :class:" +"`bytes`), το ``y`` θα είναι επίσης μια παρουσία του ``re.Match``, αλλά οι " +"επιστρεφόμενες τιμές των ``y.group(0)`` και ``y[0]`` θα είναι και οι δύο " +"τύπου :class:`bytes`. Στους τύπους annotations, θα αντιπροσωπεύαμε αυτήν την " +"ποικιλία αντικειμένων :ref:`re.Match ` με το ``re." +"Match[bytes]``." -#: library/stdtypes.rst:4943 +#: library/stdtypes.rst:5494 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " "directly." msgstr "" +"Τα αντικείμενα ``GenericAlias`` είναι στιγμιότυπα της κλάσης :class:`types." +"GenericAlias`, τα οποία μπορούν επίσης να χρησιμοποιηθούν για την δημιουργία " +"αντικειμένων ``GenericAlias`` απευθείας." -#: library/stdtypes.rst:4949 +#: library/stdtypes.rst:5500 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " "expecting a :class:`list` containing :class:`float` elements::" msgstr "" +"Δημιουργεί ένα ``GenericAlias`` που αντιπροσωπεύει έναν τύπο ``T`` " +"παραμετροποιημένο από τύπους *X*, *Y*, και άλλα ανάλογα με το ``T`` που " +"χρησιμοποιείται. Για παράδειγμα, μια συνάρτηση που αναμένει μια :class:" +"`list` που περιέχει στοιχεία της :class:`float`::" -#: library/stdtypes.rst:4957 +#: library/stdtypes.rst:5505 +msgid "" +"def average(values: list[float]) -> float:\n" +" return sum(values) / len(values)" +msgstr "" +"def average(values: list[float]) -> float:\n" +" return sum(values) / len(values)" + +#: library/stdtypes.rst:5508 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " "the value type. In this example, the function expects a ``dict`` with keys " "of type :class:`str` and values of type :class:`int`::" msgstr "" +"Ένα άλλο παράδειγμα για αντικείμενα :term:`mapping`, χρησιμοποιώντας ένα :" +"class:`dict`,που είναι ένας generic τύπος που αναμένει δύο παραμέτρους τύπου " +"που αντιπροσωπεύουν τον τύπο κλειδιού και τον τύπο τιμής. Σε αυτό το " +"παράδειγμα, η συνάρτηση αναμένει ένα ``dict`` με κλειδιά τύπου :class:`str` " +"και τιμές τύπου :class:`int`::" + +#: library/stdtypes.rst:5513 +msgid "" +"def send_post_request(url: str, body: dict[str, int]) -> None:\n" +" ..." +msgstr "" +"def send_post_request(url: str, body: dict[str, int]) -> None:\n" +" ..." -#: library/stdtypes.rst:4965 +#: library/stdtypes.rst:5516 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" msgstr "" +"Οι ενσωματωμένες συναρτήσεις (built-in) :func:`isinstance` και :func:" +"`issubclass` δεν δέχονται τους τύπους ``GenericAlias`` για το δεύτερο όρισμά " +"τους::" + +#: library/stdtypes.rst:5519 +msgid "" +">>> isinstance([1, 2], list[str])\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: isinstance() argument 2 cannot be a parameterized generic" +msgstr "" +">>> isinstance([1, 2], list[str])\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: library/stdtypes.rst:4973 +#: library/stdtypes.rst:5524 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -5171,349 +9850,509 @@ msgid "" "not checked against their type. For example, the following code is " "discouraged, but will run without errors::" msgstr "" +"Ο χρόνος εκτέλεσης Python δεν επιβάλλει :term:`type annotations " +"`. Αυτό επεκτείνεται σε generic τύπους και στις παραμέτρους " +"τύπου τους. Κατά τη δημιουργία ενός αντικειμένου container από ένα " +"``GenericAlias``, τα στοιχεία στο container δεν ελέγχονται ως προς τον τύπο " +"τους. Για παράδειγμα, ο ακόλουθος κώδικας αποθαρρύνεται, αλλά θα εκτελεστεί " +"χωρίς σφάλματα::" + +#: library/stdtypes.rst:5530 +msgid "" +">>> t = list[str]\n" +">>> t([1, 2, 3])\n" +"[1, 2, 3]" +msgstr "" +">>> t = list[str]\n" +">>> t([1, 2, 3])\n" +"[1, 2, 3]" -#: library/stdtypes.rst:4983 +#: library/stdtypes.rst:5534 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "" +"Επιπλέον, τα παραμετροποιημένα generics διαγράφουν τις παραμέτρους τύπου " +"κατά τη δημιουργία αντικειμένου::" -#: library/stdtypes.rst:4994 +#: library/stdtypes.rst:5537 +msgid "" +">>> t = list[str]\n" +">>> type(t)\n" +"\n" +"\n" +">>> l = t()\n" +">>> type(l)\n" +"" +msgstr "" +">>> t = list[str]\n" +">>> type(t)\n" +"\n" +"\n" +">>> l = t()\n" +">>> type(l)\n" +"" + +#: library/stdtypes.rst:5545 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "" +"Η κλήση :func:`repr` ή :func:`str` σε ένα generic δείχνει τον " +"παραμετροποιημένο τύπο::" -#: library/stdtypes.rst:5002 +#: library/stdtypes.rst:5547 +msgid "" +">>> repr(list[int])\n" +"'list[int]'\n" +"\n" +">>> str(list[int])\n" +"'list[int]'" +msgstr "" +">>> repr(list[int])\n" +"'list[int]'\n" +"\n" +">>> str(list[int])\n" +"'list[int]'" + +#: library/stdtypes.rst:5553 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" +"Η μέθοδος :meth:`~object.__getitem__` των generic containers θα κάνει raise " +"μια εξαίρεση για την απαγόρευση λαθών όπως ``dict[str][str]``::" + +#: library/stdtypes.rst:5556 +msgid "" +">>> dict[str][str]\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: dict[str] is not a generic class" +msgstr "" +">>> dict[str][str]\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: dict[str] is not a generic class" -#: library/stdtypes.rst:5010 +#: library/stdtypes.rst:5561 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " "items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::" msgstr "" +"Ωστόσο, τέτοιες εκφράσεις είναι έγκυρες όταν χρησιμοποιούνται μεταβλητές " +"τύπου :ref:`type variables `. Το ευρετήριο πρέπει να έχει τόσα " +"στοιχεία όσα και τα στοιχεία μεταβλητής τύπου στο αντικείμενο " +"``GenericAlias`` :attr:`~genericalias.__args__`. ::" -#: library/stdtypes.rst:5021 -msgid "Standard Generic Classes" +#: library/stdtypes.rst:5565 +msgid "" +">>> from typing import TypeVar\n" +">>> Y = TypeVar('Y')\n" +">>> dict[str, Y][int]\n" +"dict[str, int]" msgstr "" +">>> from typing import TypeVar\n" +">>> Y = TypeVar('Y')\n" +">>> dict[str, Y][int]\n" +"dict[str, int]" + +#: library/stdtypes.rst:5572 +msgid "Standard Generic Classes" +msgstr "Τυπικές Γενικές Κλάσεις" -#: library/stdtypes.rst:5023 +#: library/stdtypes.rst:5574 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "" +"Οι ακόλουθες τυπικές κλάσεις βιβλιοθήκης υποστηρίζουν γενικά " +"παραμετροποιημένα. Αυτή η λίστα δεν είναι εξαντλητική." -#: library/stdtypes.rst:5026 +#: library/stdtypes.rst:5577 msgid ":class:`tuple`" -msgstr "" +msgstr ":class:`tuple`" -#: library/stdtypes.rst:5027 +#: library/stdtypes.rst:5578 msgid ":class:`list`" -msgstr "" +msgstr ":class:`list`" -#: library/stdtypes.rst:5028 +#: library/stdtypes.rst:5579 msgid ":class:`dict`" -msgstr "" +msgstr ":class:`dict`" -#: library/stdtypes.rst:5029 +#: library/stdtypes.rst:5580 msgid ":class:`set`" -msgstr "" +msgstr ":class:`set`" -#: library/stdtypes.rst:5030 +#: library/stdtypes.rst:5581 msgid ":class:`frozenset`" -msgstr "" +msgstr ":class:`frozenset`" -#: library/stdtypes.rst:5031 +#: library/stdtypes.rst:5582 msgid ":class:`type`" -msgstr "" +msgstr ":class:`type`" + +#: library/stdtypes.rst:5583 +msgid ":class:`asyncio.Future`" +msgstr ":class:`asyncio.Future`" -#: library/stdtypes.rst:5032 +#: library/stdtypes.rst:5584 +msgid ":class:`asyncio.Task`" +msgstr ":class:`asyncio.Task`" + +#: library/stdtypes.rst:5585 msgid ":class:`collections.deque`" -msgstr "" +msgstr ":class:`collections.deque`" -#: library/stdtypes.rst:5033 +#: library/stdtypes.rst:5586 msgid ":class:`collections.defaultdict`" -msgstr "" +msgstr ":class:`collections.defaultdict`" -#: library/stdtypes.rst:5034 +#: library/stdtypes.rst:5587 msgid ":class:`collections.OrderedDict`" -msgstr "" +msgstr ":class:`collections.OrderedDict`" -#: library/stdtypes.rst:5035 +#: library/stdtypes.rst:5588 msgid ":class:`collections.Counter`" -msgstr "" +msgstr ":class:`collections.Counter`" -#: library/stdtypes.rst:5036 +#: library/stdtypes.rst:5589 msgid ":class:`collections.ChainMap`" -msgstr "" +msgstr ":class:`collections.ChainMap`" -#: library/stdtypes.rst:5037 +#: library/stdtypes.rst:5590 msgid ":class:`collections.abc.Awaitable`" -msgstr "" +msgstr ":class:`collections.abc.Awaitable`" -#: library/stdtypes.rst:5038 +#: library/stdtypes.rst:5591 msgid ":class:`collections.abc.Coroutine`" -msgstr "" +msgstr ":class:`collections.abc.Coroutine`" -#: library/stdtypes.rst:5039 +#: library/stdtypes.rst:5592 msgid ":class:`collections.abc.AsyncIterable`" -msgstr "" +msgstr ":class:`collections.abc.AsyncIterable`" -#: library/stdtypes.rst:5040 +#: library/stdtypes.rst:5593 msgid ":class:`collections.abc.AsyncIterator`" -msgstr "" +msgstr ":class:`collections.abc.AsyncIterator`" -#: library/stdtypes.rst:5041 +#: library/stdtypes.rst:5594 msgid ":class:`collections.abc.AsyncGenerator`" -msgstr "" +msgstr ":class:`collections.abc.AsyncGenerator`" -#: library/stdtypes.rst:5042 +#: library/stdtypes.rst:5595 msgid ":class:`collections.abc.Iterable`" -msgstr "" +msgstr ":class:`collections.abc.Iterable`" -#: library/stdtypes.rst:5043 +#: library/stdtypes.rst:5596 msgid ":class:`collections.abc.Iterator`" -msgstr "" +msgstr ":class:`collections.abc.Iterator`" -#: library/stdtypes.rst:5044 +#: library/stdtypes.rst:5597 msgid ":class:`collections.abc.Generator`" -msgstr "" +msgstr ":class:`collections.abc.Generator`" -#: library/stdtypes.rst:5045 +#: library/stdtypes.rst:5598 msgid ":class:`collections.abc.Reversible`" -msgstr "" +msgstr ":class:`collections.abc.Reversible`" -#: library/stdtypes.rst:5046 +#: library/stdtypes.rst:5599 msgid ":class:`collections.abc.Container`" -msgstr "" +msgstr ":class:`collections.abc.Container`" -#: library/stdtypes.rst:5047 +#: library/stdtypes.rst:5600 msgid ":class:`collections.abc.Collection`" -msgstr "" +msgstr ":class:`collections.abc.Collection`" -#: library/stdtypes.rst:5048 +#: library/stdtypes.rst:5601 msgid ":class:`collections.abc.Callable`" -msgstr "" +msgstr ":class:`collections.abc.Callable`" -#: library/stdtypes.rst:5049 +#: library/stdtypes.rst:5602 msgid ":class:`collections.abc.Set`" -msgstr "" +msgstr ":class:`collections.abc.Set`" -#: library/stdtypes.rst:5050 +#: library/stdtypes.rst:5603 msgid ":class:`collections.abc.MutableSet`" -msgstr "" +msgstr ":class:`collections.abc.MutableSet`" -#: library/stdtypes.rst:5051 +#: library/stdtypes.rst:5604 msgid ":class:`collections.abc.Mapping`" -msgstr "" +msgstr ":class:`collections.abc.Mapping`" -#: library/stdtypes.rst:5052 +#: library/stdtypes.rst:5605 msgid ":class:`collections.abc.MutableMapping`" -msgstr "" +msgstr ":class:`collections.abc.MutableMapping`" -#: library/stdtypes.rst:5053 +#: library/stdtypes.rst:5606 msgid ":class:`collections.abc.Sequence`" -msgstr "" +msgstr ":class:`collections.abc.Sequence`" -#: library/stdtypes.rst:5054 +#: library/stdtypes.rst:5607 msgid ":class:`collections.abc.MutableSequence`" -msgstr "" +msgstr ":class:`collections.abc.MutableSequence`" -#: library/stdtypes.rst:5055 +#: library/stdtypes.rst:5608 msgid ":class:`collections.abc.ByteString`" -msgstr "" +msgstr ":class:`collections.abc.ByteString`" -#: library/stdtypes.rst:5056 +#: library/stdtypes.rst:5609 msgid ":class:`collections.abc.MappingView`" -msgstr "" +msgstr ":class:`collections.abc.MappingView`" -#: library/stdtypes.rst:5057 +#: library/stdtypes.rst:5610 msgid ":class:`collections.abc.KeysView`" -msgstr "" +msgstr ":class:`collections.abc.KeysView`" -#: library/stdtypes.rst:5058 +#: library/stdtypes.rst:5611 msgid ":class:`collections.abc.ItemsView`" -msgstr "" +msgstr ":class:`collections.abc.ItemsView`" -#: library/stdtypes.rst:5059 +#: library/stdtypes.rst:5612 msgid ":class:`collections.abc.ValuesView`" -msgstr "" +msgstr ":class:`collections.abc.ValuesView`" -#: library/stdtypes.rst:5060 +#: library/stdtypes.rst:5613 msgid ":class:`contextlib.AbstractContextManager`" -msgstr "" +msgstr ":class:`contextlib.AbstractContextManager`" -#: library/stdtypes.rst:5061 +#: library/stdtypes.rst:5614 msgid ":class:`contextlib.AbstractAsyncContextManager`" -msgstr "" +msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: library/stdtypes.rst:5062 +#: library/stdtypes.rst:5615 msgid ":class:`dataclasses.Field`" -msgstr "" +msgstr ":class:`dataclasses.Field`" -#: library/stdtypes.rst:5063 +#: library/stdtypes.rst:5616 msgid ":class:`functools.cached_property`" -msgstr "" +msgstr ":class:`functools.cached_property`" -#: library/stdtypes.rst:5064 +#: library/stdtypes.rst:5617 msgid ":class:`functools.partialmethod`" -msgstr "" +msgstr ":class:`functools.partialmethod`" -#: library/stdtypes.rst:5065 +#: library/stdtypes.rst:5618 msgid ":class:`os.PathLike`" -msgstr "" +msgstr ":class:`os.PathLike`" -#: library/stdtypes.rst:5066 +#: library/stdtypes.rst:5619 msgid ":class:`queue.LifoQueue`" -msgstr "" +msgstr ":class:`queue.LifoQueue`" -#: library/stdtypes.rst:5067 +#: library/stdtypes.rst:5620 msgid ":class:`queue.Queue`" -msgstr "" +msgstr ":class:`queue.Queue`" -#: library/stdtypes.rst:5068 +#: library/stdtypes.rst:5621 msgid ":class:`queue.PriorityQueue`" -msgstr "" +msgstr ":class:`queue.PriorityQueue`" -#: library/stdtypes.rst:5069 +#: library/stdtypes.rst:5622 msgid ":class:`queue.SimpleQueue`" -msgstr "" +msgstr ":class:`queue.SimpleQueue`" -#: library/stdtypes.rst:5070 +#: library/stdtypes.rst:5623 msgid ":ref:`re.Pattern `" -msgstr "" +msgstr ":ref:`re.Pattern `" -#: library/stdtypes.rst:5071 +#: library/stdtypes.rst:5624 msgid ":ref:`re.Match `" -msgstr "" +msgstr ":ref:`re.Match `" -#: library/stdtypes.rst:5072 +#: library/stdtypes.rst:5625 msgid ":class:`shelve.BsdDbShelf`" -msgstr "" +msgstr ":class:`shelve.BsdDbShelf`" -#: library/stdtypes.rst:5073 +#: library/stdtypes.rst:5626 msgid ":class:`shelve.DbfilenameShelf`" -msgstr "" +msgstr ":class:`shelve.DbfilenameShelf`" -#: library/stdtypes.rst:5074 +#: library/stdtypes.rst:5627 msgid ":class:`shelve.Shelf`" -msgstr "" +msgstr ":class:`shelve.Shelf`" -#: library/stdtypes.rst:5075 +#: library/stdtypes.rst:5628 msgid ":class:`types.MappingProxyType`" -msgstr "" +msgstr ":class:`types.MappingProxyType`" -#: library/stdtypes.rst:5076 +#: library/stdtypes.rst:5629 msgid ":class:`weakref.WeakKeyDictionary`" -msgstr "" +msgstr ":class:`weakref.WeakKeyDictionary`" -#: library/stdtypes.rst:5077 +#: library/stdtypes.rst:5630 msgid ":class:`weakref.WeakMethod`" -msgstr "" +msgstr ":class:`weakref.WeakMethod`" -#: library/stdtypes.rst:5078 +#: library/stdtypes.rst:5631 msgid ":class:`weakref.WeakSet`" -msgstr "" +msgstr ":class:`weakref.WeakSet`" -#: library/stdtypes.rst:5079 +#: library/stdtypes.rst:5632 msgid ":class:`weakref.WeakValueDictionary`" -msgstr "" +msgstr ":class:`weakref.WeakValueDictionary`" -#: library/stdtypes.rst:5084 +#: library/stdtypes.rst:5637 msgid "Special Attributes of ``GenericAlias`` objects" -msgstr "" +msgstr "Ειδικά Χαρακτηριστικά αντικειμένων ``GenericAlias``" -#: library/stdtypes.rst:5086 +#: library/stdtypes.rst:5639 msgid "All parameterized generics implement special read-only attributes." msgstr "" +"Όλα τα παραμετροποιημένα generics εφαρμόζουν ειδικά χαρακτηριστικά μόνο για " +"ανάγνωση." -#: library/stdtypes.rst:5090 +#: library/stdtypes.rst:5643 msgid "This attribute points at the non-parameterized generic class::" +msgstr "Αυτό το χαρακτηριστικό δείχνει στη μη παραμετροποιημένη γενική κλάση::" + +#: library/stdtypes.rst:5645 +msgid "" +">>> list[int].__origin__\n" +"" msgstr "" +">>> list[int].__origin__\n" +"" -#: library/stdtypes.rst:5098 +#: library/stdtypes.rst:5651 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " "class::" msgstr "" +"Αυτό το χαρακτηριστικό είναι μια :class:`tuple` (πιθανώς μήκους 1) generic " +"τύπων που μεταβιβάστηκαν στο αρχικό :meth:`~object.__class_getitem__` της " +"generic κλάσης::" -#: library/stdtypes.rst:5108 +#: library/stdtypes.rst:5655 +msgid "" +">>> dict[str, list[int]].__args__\n" +"(, list[int])" +msgstr "" +">>> dict[str, list[int]].__args__\n" +"(, list[int])" + +#: library/stdtypes.rst:5661 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" msgstr "" +"Αυτό το χαρακτηριστικό είναι μία νωχελικά υπολογισμένη πλειάδα (tuple) " +"(πιθανώς κενή) μεταβλητών μοναδικού τύπου που βρίσκονται στο ``__args__``::" + +#: library/stdtypes.rst:5664 +msgid "" +">>> from typing import TypeVar\n" +"\n" +">>> T = TypeVar('T')\n" +">>> list[T].__parameters__\n" +"(~T,)" +msgstr "" +">>> from typing import TypeVar\n" +"\n" +">>> T = TypeVar('T')\n" +">>> list[T].__parameters__\n" +"(~T,)" -#: library/stdtypes.rst:5119 +#: library/stdtypes.rst:5672 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." "ParamSpec` is intended primarily for static type checking." msgstr "" +"Ένα αντικείμενο ``GenericAlias`` με παραμέτρους :class:`typing.ParamSpec` " +"ενδέχεται να μην έχει σωστές ``__parameters__`` μετά την αντικατάσταση " +"επειδή το :class:`typing.ParamSpec` προορίζεται κυρίως για έλεγχο στατικού " +"τύπου." -#: library/stdtypes.rst:5126 +#: library/stdtypes.rst:5679 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." msgstr "" +"Ένα boolean που ισχύει αν το alias έχει αποσυμπιεστεί χρησιμοποιώντας τον " +"τελεστή ``*`` (δείτε το :data:`~typing.TypeVarTuple`)." -#: library/stdtypes.rst:5135 +#: library/stdtypes.rst:5687 msgid ":pep:`484` - Type Hints" -msgstr "" +msgstr ":pep:`484` - Type Hints" -#: library/stdtypes.rst:5135 +#: library/stdtypes.rst:5688 msgid "Introducing Python's framework for type annotations." -msgstr "" +msgstr "Παρουσιάζοντας το framework της Python για τύπους annotations." -#: library/stdtypes.rst:5140 +#: library/stdtypes.rst:5690 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" -msgstr "" +msgstr ":pep:`585` - Τύπος Generics Συμβουλών στις Τυπικές Συλλογές" -#: library/stdtypes.rst:5138 +#: library/stdtypes.rst:5691 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." "__class_getitem__`." msgstr "" +"Εισαγωγή της δυνατότητας εγγενούς παραμετροποίησης κλάσεων τυπικής " +"βιβλιοθήκης, υπό την προϋπόθεση ότι εφαρμόζουν τη μέθοδο ειδικής κλάσης :" +"meth:`~object.__class_getitem__`." -#: library/stdtypes.rst:5143 +#: library/stdtypes.rst:5695 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" msgstr "" +"Τα :ref:`Generics`, :ref:`user-defined generics ` " +"και :class:`typing.Generic`" -#: library/stdtypes.rst:5143 +#: library/stdtypes.rst:5696 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" +"Τεκμηρίωση για τον τρόπο υλοποίησης generic κλάσεων που μπορούν να " +"παραμετροποιηθούν κατά το χρόνο εκτέλεσης και να κατανοηθούν από στατικούς " +"ελεγκτές τύπων." -#: library/stdtypes.rst:5152 +#: library/stdtypes.rst:5705 msgid "Union Type" -msgstr "" +msgstr "Τύπος Ένωσης" -#: library/stdtypes.rst:5158 +#: library/stdtypes.rst:5711 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " "primarily for :term:`type annotations `. The union type " -"expression enables cleaner type hinting syntax compared to :data:`typing." -"Union`." +"expression enables cleaner type hinting syntax compared to subscripting :" +"class:`typing.Union`." msgstr "" +"Ένα αντικείμενο ένωσης διατηρεί την τιμή της λειτουργίας ``|`` (bitwise or) " +"σε πολλαπλά αντικείμενα :ref:`type objects `. Αυτοί οι " +"τύποι προορίζονται κυρίως για :term:`type annotations `. Η " +"έκφραση τύπου ένωσης επιτρέπει την καθαρότερη σύνταξη υποδείξεων σε σύγκριση " +"με την εγγραφή :class:`typing.Union`." -#: library/stdtypes.rst:5165 +#: library/stdtypes.rst:5718 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " "example, the following function expects an argument of type :class:`int` or :" "class:`float`::" msgstr "" +"Ορίζει ένα αντικείμενο ένωσης που περιέχει τύπους *X*, *Y*, και ούτω " +"καθεξής. Το ``X | Y`` σημαίνει είτε X είτε Y. Είναι ισοδύναμο με το " +"``typing.Union[X, Y]``. Για παράδειγμα, η ακόλουθη συνάρτηση αναμένει ένα " +"όρισμα τύπου :class:`int` or :class:`float`::" -#: library/stdtypes.rst:5175 +#: library/stdtypes.rst:5723 +msgid "" +"def square(number: int | float) -> int | float:\n" +" return number ** 2" +msgstr "" +"def square(number: int | float) -> int | float:\n" +" return number ** 2" + +#: library/stdtypes.rst:5728 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -5521,77 +10360,199 @@ msgid "" "For unions which include forward references, present the whole expression as " "a string, e.g. ``\"int | Foo\"``." msgstr "" +"Ο τελεστής ``|`` δεν μπορεί να χρησιμοποιηθεί κατά το χρόνο εκτέλεσης για να " +"ορίσει ενώσεις όπου ένα ή περισσότερα μέλη είναι μια μπροστινή αναφορά. Για " +"παράδειγμα το ``int | \"Foo\"``, όπου το ``\"Foo\"`` είναι μια αναφορά σε " +"μια κλάση που δεν έχει ακόμη καθοριστεί, θα αποτύχει κατά το χρόνο " +"εκτέλεσης. Για ενώσεις που περιλαμβάνουν μπροστινές αναφορές, παρουσιάζει " +"ολόκληρη την έκφραση ως συμβολοσειρά, π.χ. ``\"int | Foo\"``." -#: library/stdtypes.rst:5183 +#: library/stdtypes.rst:5736 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "" +"Τα αντικείμενα ένωσης μπορούν να ελεγχθούν για ισότητα με άλλα αντικείμενα " +"ένωσης. Λεπτομέρειες:" -#: library/stdtypes.rst:5185 +#: library/stdtypes.rst:5738 msgid "Unions of unions are flattened::" -msgstr "" +msgstr "Οι ενώσεις των ενώσεων ισοπεδώνονται::" -#: library/stdtypes.rst:5189 +#: library/stdtypes.rst:5740 +msgid "(int | str) | float == int | str | float" +msgstr "(int | str) | float == int | str | float" + +#: library/stdtypes.rst:5742 msgid "Redundant types are removed::" -msgstr "" +msgstr "Οι περιττοί τύποι καταργούνται::" -#: library/stdtypes.rst:5193 +#: library/stdtypes.rst:5744 +msgid "int | str | int == int | str" +msgstr "int | str | int == int | str" + +#: library/stdtypes.rst:5746 msgid "When comparing unions, the order is ignored::" -msgstr "" +msgstr "Κατά τη σύγκριση των ενώσεων, η σειρά αγνοείται::" -#: library/stdtypes.rst:5197 -msgid "It is compatible with :data:`typing.Union`::" +#: library/stdtypes.rst:5748 +msgid "int | str == str | int" +msgstr "int | str == str | int" + +#: library/stdtypes.rst:5750 +msgid "It creates instances of :class:`typing.Union`::" +msgstr "Δημιουργεί στιγμιότυπα της :class:`typing.Union`::" + +#: library/stdtypes.rst:5752 +msgid "" +"int | str == typing.Union[int, str]\n" +"type(int | str) is typing.Union" msgstr "" +"int | str == typing.Union[int, str]\n" +"type(int | str) is typing.Union" -#: library/stdtypes.rst:5201 +#: library/stdtypes.rst:5755 msgid "Optional types can be spelled as a union with ``None``::" -msgstr "" +msgstr "Οι προαιρετικοί τύποι μπορούν να γραφτούν ως ένωση με ``None``::" -#: library/stdtypes.rst:5208 +#: library/stdtypes.rst:5757 +msgid "str | None == typing.Optional[str]" +msgstr "str | None == typing.Optional[str]" + +#: library/stdtypes.rst:5762 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "" +"Οι κλήσεις σε :func:`isinstance` και :func:`issubclass` υποστηρίζονται " +"επίσης με ένα αντικείμενο ένωσης::" + +#: library/stdtypes.rst:5765 +msgid "" +">>> isinstance(\"\", int | str)\n" +"True" +msgstr "" +">>> isinstance(\"\", int | str)\n" +"True" -#: library/stdtypes.rst:5214 +#: library/stdtypes.rst:5768 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" +"Ωστόσο, το :ref:`parameterized generics ` σε αντικείμενα " +"ένωσης δεν μπορούν να ελεγχθούν::" + +#: library/stdtypes.rst:5771 +msgid "" +">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" +"True\n" +">>> isinstance([1], int | list[int])\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: isinstance() argument 2 cannot be a parameterized generic" +msgstr "" +">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" +"True\n" +">>> isinstance([1], int | list[int])\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: isinstance() argument 2 cannot be a parameterized generic" + +#: library/stdtypes.rst:5778 +msgid "" +"The user-exposed type for the union object can be accessed from :class:" +"`typing.Union` and used for :func:`isinstance` checks::" +msgstr "" +"Ο τύπος που εκτίθεται από τον χρήστη για το αντικείμενο ένωσης μπορεί να " +"προσπελαστεί από το :data:`typing.Union` και να χρησιμοποιηθεί για ελέγχους :" +"func:`isinstance`::" -#: library/stdtypes.rst:5224 +#: library/stdtypes.rst:5781 msgid "" -"The user-exposed type for the union object can be accessed from :data:`types." -"UnionType` and used for :func:`isinstance` checks. An object cannot be " -"instantiated from the type::" +">>> import typing\n" +">>> isinstance(int | str, typing.Union)\n" +"True\n" +">>> typing.Union()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: cannot create 'typing.Union' instances" msgstr "" +">>> import typing\n" +">>> isinstance(int | str, typing.Union)\n" +"True\n" +">>> typing.Union()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: cannot create 'typing.Union' instances" -#: library/stdtypes.rst:5237 +#: library/stdtypes.rst:5790 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " "override it:" msgstr "" - -#: library/stdtypes.rst:5257 +"Η μέθοδος :meth:`!__or__` για αντικείμενα τύπου προστέθηκε για να " +"υποστηρίξει τη σύνταξη ``X | Y``. Εάν μια μετακλάση υλοποιεί :meth:`!" +"__or__`, η Ένωση μπορεί να την παρακάμψει:" + +#: library/stdtypes.rst:5794 +msgid "" +">>> class M(type):\n" +"... def __or__(self, other):\n" +"... return \"Hello\"\n" +"...\n" +">>> class C(metaclass=M):\n" +"... pass\n" +"...\n" +">>> C | int\n" +"'Hello'\n" +">>> int | C\n" +"int | C" +msgstr "" +">>> class M(type):\n" +"... def __or__(self, other):\n" +"... return \"Hello\"\n" +"...\n" +">>> class C(metaclass=M):\n" +"... pass\n" +"...\n" +">>> C | int\n" +"'Hello'\n" +">>> int | C\n" +"int | C" + +#: library/stdtypes.rst:5810 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr "" +":pep:`604` -- Το PEP προτείνει τη σύνταξη ``X | Y`` και τον τύπο Ένωση." -#: library/stdtypes.rst:5265 -msgid "Other Built-in Types" +#: library/stdtypes.rst:5816 +msgid "" +"Union objects are now instances of :class:`typing.Union`. Previously, they " +"were instances of :class:`types.UnionType`, which remains an alias for :" +"class:`typing.Union`." msgstr "" +"Τα αντικείμενα Union είναι πλέον στιγμιότυπα του :class:`typing.Union`. " +"Προηγουμένως, ήταν στιγμιότυπα της :class:`types.UnionType`, το οποίο " +"παραμείνει ένα ψευδώνυμο για τη :class:`typing.Union`." + +#: library/stdtypes.rst:5823 +msgid "Other Built-in Types" +msgstr "Άλλοι Ενσωματωμένοι (built-in) Τύποι" -#: library/stdtypes.rst:5267 +#: library/stdtypes.rst:5825 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" +"Ο διερμηνέας υποστηρίζει πολλά άλλα είδη αντικειμένων. Τα περισσότερα από " +"αυτά υποστηρίζουν μόνο μία ή δύο λειτουργίες." -#: library/stdtypes.rst:5274 +#: library/stdtypes.rst:5832 msgid "Modules" -msgstr "" +msgstr "Modules" -#: library/stdtypes.rst:5276 +#: library/stdtypes.rst:5834 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -5601,8 +10562,15 @@ msgid "" "exist, rather it requires an (external) *definition* for a module named " "*foo* somewhere.)" msgstr "" +"Η μόνη ειδική λειτουργία σε ένα module είναι η πρόσβαση χαρακτηριστικών: ``m." +"name``, όπου το *m* είναι ένα module και το *name* έχει πρόσβαση σε ένα " +"όνομα που ορίζεται στον πίνακα συμβόλων του *m*. Τα χαρακτηριστικά του " +"module μπορούν να εκχωρηθούν. (Σημειώστε ότι η δήλωση :keyword:`import` δεν " +"είναι, αυστηρά, μια λειτουργία σε ένα αντικείμενο module· το ``import foo`` " +"δεν απαιτεί να υπάρχει ένα αντικείμενο module με το όνομα *foo* αλλά απαιτεί " +"έναν (εξωτερικό) *definition* για ένα module που ονομάζεται *foo* κάπου.)" -#: library/stdtypes.rst:5283 +#: library/stdtypes.rst:5841 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -5612,57 +10580,80 @@ msgid "" "``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not " "recommended." msgstr "" +"Ένα ειδικό χαρακτηριστικό κάθε module είναι :attr:`~object.__dict__`. Αυτό " +"είναι το λεξικό που περιέχει τον πίνακα συμβόλων της ενότητας. Η τροποποίηση " +"αυτού του λεξικού θα αλλάξει στην πραγματικότητα τον πίνακα συμβόλων του " +"module, αλλά η απευθείας εκχώρηση στο χαρακτηριστικό :attr:`~object." +"__dict__` δεν είναι δυνατή (μπορείτε να γράψετε ``m.__dict__['a'] = 1``, που " +"ορίζει το ``m.a`` να είναι ``1``, αλλά δεν μπορείτε να γράψετε ``m.__dict__ " +"= {}``). Δεν συνίσταται η απευθείας τροποποίηση του :attr:`~object." +"__dict__`." -#: library/stdtypes.rst:5291 +#: library/stdtypes.rst:5849 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" +"Τα modules που είναι ενσωματωμένες στον διερμηνέα γράφονται ως εξής: " +"````. Εάν φορτωθούν από ένα αρχείο, γράφονται ως " +"````." -#: library/stdtypes.rst:5299 +#: library/stdtypes.rst:5857 msgid "Classes and Class Instances" -msgstr "" +msgstr "Κλάσεις και Στιγμιότυπα Κλάσης" -#: library/stdtypes.rst:5301 +#: library/stdtypes.rst:5859 msgid "See :ref:`objects` and :ref:`class` for these." -msgstr "" +msgstr "Δείτε :ref:`objects` και :ref:`class` για αυτά." -#: library/stdtypes.rst:5307 +#: library/stdtypes.rst:5865 msgid "Functions" -msgstr "" +msgstr "Συναρτήσεις" -#: library/stdtypes.rst:5309 +#: library/stdtypes.rst:5867 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" +"Τα αντικείμενα συναρτήσεων δημιουργούνται από ορισμούς συναρτήσεων. Η μόνη " +"λειτουργία σε ένα αντικείμενο συνάρτησης είναι να το ονομάσουμε: " +"``func(argument-list)``." -#: library/stdtypes.rst:5312 +#: library/stdtypes.rst:5870 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " "function), but the implementation is different, hence the different object " "types." msgstr "" +"Υπάρχουν πραγματικά δύο είδη αντικειμένων συναρτήσεων: ενσωματωμένες " +"συναρτήσεις και συναρτήσεις που καθορίζονται από τον χρήστη. Και οι δύο " +"υποστηρίζουν την ίδια λειτουργία (για να καλέσετε τη συνάρτηση), αλλά η " +"υλοποίηση είναι διαφορετική, εξ ου και οι διαφορετικοί τύποι αντικειμένων." -#: library/stdtypes.rst:5316 +#: library/stdtypes.rst:5874 msgid "See :ref:`function` for more information." -msgstr "" +msgstr "Δείτε το :ref:`function` για περισσότερες πληροφορίες." -#: library/stdtypes.rst:5322 +#: library/stdtypes.rst:5880 msgid "Methods" -msgstr "" +msgstr "Μέθοδοι" -#: library/stdtypes.rst:5326 +#: library/stdtypes.rst:5884 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" -"`append` on lists) and :ref:`class instance method `. " -"Built-in methods are described with the types that support them." +"`~list.append` on lists) and :ref:`class instance method `. Built-in methods are described with the types that support them." msgstr "" +"Οι μέθοδοι είναι συναρτήσεις που καλούνται χρησιμοποιώντας το notation " +"χαρακτηριστικών. Υπάρχουν δύο είδη: :ref:`built-in methods ` (όπως η :meth:`~list.append` στις λίστες) και :ref:`class instance " +"method `. Οι ενσωματωμένες μέθοδοι περιγράφονται με τους " +"τύπους που τις υποστηρίζουν." -#: library/stdtypes.rst:5331 +#: library/stdtypes.rst:5890 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -5674,8 +10665,18 @@ msgid "" "is completely equivalent to calling ``m.__func__(m.__self__, arg-1, " "arg-2, ..., arg-n)``." msgstr "" +"Εάν αποκτήσετε πρόσβαση σε μια μέθοδο (μια συνάρτηση που ορίζεται μια " +"namespace κλάση) μέσω ενός στιγμιοτύπου, λαμβάνετε ένα ειδικό αντικείμενο: " +"ένα αντικείμενο :dfn:`bound method` (ονομάζεται επίσης :ref:`instance method " +"`). Όταν καλείται, θα προσθέσει το όρισμα ``self`` στη " +"λίστα ορισμάτων. Οι δεσμευμένες μέθοδοι έχουν δύο ειδικά χαρακτηριστικά " +"μόνο για ανάγνωση: :attr:`m.__self__ ` είναι το αντικείμενο " +"στο οποίο λειτουργεί η μέθοδος και :attr:`m.__func__ ` " +"είναι η συνάρτηση που υλοποιεί την μέθοδο. Η κλήση του ``m(arg-1, " +"arg-2, ..., arg-n)`` είναι απολύτως ισοδύναμη με την κλήση του ``m." +"__func__(m.__self__, arg-1, arg-2, ..., arg-n)``." -#: library/stdtypes.rst:5342 +#: library/stdtypes.rst:5901 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -5685,16 +10686,53 @@ msgid "" "In order to set a method attribute, you need to explicitly set it on the " "underlying function object:" msgstr "" - -#: library/stdtypes.rst:5365 +"Όπως τα :ref:`function objects `, τα αντικείμενα " +"δεσμευμένης μεθόδου υποστηρίζουν τη λήψη αυθαίρετων χαρακτηριστικών. Ωστόσο, " +"δεδομένου ότι τα χαρακτηριστικά της μεθόδου αποθηκεύονται στην " +"πραγματικότητα στο υποκείμενο αντικείμενο συνάρτησης (:attr:`method." +"__func__`), ο ορισμός χαρακτηριστικών μεθόδου σε δεσμευμένες μεθόδους δεν " +"επιτρέπεται. Η προσπάθεια ορισμού ενός χαρακτηριστικού σε μια μέθοδο έχει " +"ως αποτέλεσμα να γίνει raise η :exc:`AttributeError`. Για να ορίσετε ένα " +"χαρακτηριστικό μεθόδου πρέπει να το ορίσετε ρητά στο υποκείμενο αντικείμενο " +"συνάρτησης:" + +#: library/stdtypes.rst:5909 +msgid "" +">>> class C:\n" +"... def method(self):\n" +"... pass\n" +"...\n" +">>> c = C()\n" +">>> c.method.whoami = 'my name is method' # can't set on the method\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"AttributeError: 'method' object has no attribute 'whoami'\n" +">>> c.method.__func__.whoami = 'my name is method'\n" +">>> c.method.whoami\n" +"'my name is method'" +msgstr "" +">>> class C:\n" +"... def method(self):\n" +"... pass\n" +"...\n" +">>> c = C()\n" +">>> c.method.whoami = 'my name is method' # can't set on the method\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"AttributeError: 'method' object has no attribute 'whoami'\n" +">>> c.method.__func__.whoami = 'my name is method'\n" +">>> c.method.whoami\n" +"'my name is method'" + +#: library/stdtypes.rst:5924 msgid "See :ref:`instance-methods` for more information." -msgstr "" +msgstr "Δείτε το :ref:`instance-methods` για περισσότερες πληροφορίες." -#: library/stdtypes.rst:5373 +#: library/stdtypes.rst:5932 msgid "Code Objects" -msgstr "" +msgstr "Αντικείμενα Κώδικα" -#: library/stdtypes.rst:5379 +#: library/stdtypes.rst:5938 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -5703,173 +10741,266 @@ msgid "" "function and can be extracted from function objects through their :attr:" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" +"Τα αντικείμενα κώδικα χρησιμοποιούνται από την υλοποίηση για να " +"αναπαραστήσουν τον \"ψευδο-μεταγλωττισμένο\" εκτελέσιμο κώδικα Python, όπως " +"ένα σώμα συνάρτησης. Διαφέρουν από τα αντικείμενα συνάρτησης επειδή δεν " +"περιέχουν αναφορά στο παγκόσμιο (global) περιβάλλον εκτέλεσης τους. Τα " +"αντικείμενα κώδικα επιστρέφονται από την ενσωματωμένη συνάρτηση :func:" +"`compile` και μπορεί να εξαχθεί από τα αντικείμενα συνάρτησης μέσω του " +"χαρακτηριστικού τους :attr:`~function.__code__`. Δείτε επίσης το module :mod:" +"`code`." -#: library/stdtypes.rst:5386 +#: library/stdtypes.rst:5945 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " "``\"__code__\"``." msgstr "" +"Η πρόσβαση στη :attr:`~function.__code__` κάνει raise ένα :ref:`auditing " +"event ` ``object.__getattr__`` με ορίσματα ``obj`` και " +"``\"__code__\"``." -#: library/stdtypes.rst:5393 +#: library/stdtypes.rst:5952 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" +"Ένα αντικείμενο κώδικα μπορεί να εκτελεστεί ή να αξιολογηθεί περνώντας το " +"(αντί για πηγαία συμβολοσειρά) στις ενσωματωμένες συναρτήσεις :func:`exec` " +"ή :func:`eval`." -#: library/stdtypes.rst:5396 +#: library/stdtypes.rst:5955 msgid "See :ref:`types` for more information." -msgstr "" +msgstr "Δείτε :ref:`types` για περισσότερες πληροφορίες." -#: library/stdtypes.rst:5402 +#: library/stdtypes.rst:5961 msgid "Type Objects" -msgstr "" +msgstr "Τύποι Αντικειμένων" -#: library/stdtypes.rst:5408 +#: library/stdtypes.rst:5967 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " "operations on types. The standard module :mod:`types` defines names for all " "standard built-in types." msgstr "" +"Τα αντικείμενα τύπου αντιπροσωπεύουν τους διάφορους τύπους αντικειμένων. Ο " +"τύπος ενός αντικειμένου προσεγγίζεται από την ενσωματωμένη συνάρτηση :func:" +"`type`. Δεν υπάρχουν ειδικές λειτουργίες στους τύπους. Το τυπικό " +"(standard) module :mod:`types` ορίζει ονόματα για όλους τους τυπικούς " +"ενσωματωμένους τύπους." -#: library/stdtypes.rst:5413 +#: library/stdtypes.rst:5972 msgid "Types are written like this: ````." -msgstr "" +msgstr "Οι τύποι γράφονται ως εξής: ````." -#: library/stdtypes.rst:5419 +#: library/stdtypes.rst:5978 msgid "The Null Object" -msgstr "" +msgstr "Το Αντικείμενο Null" -#: library/stdtypes.rst:5421 +#: library/stdtypes.rst:5980 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" +"Αυτό το αντικείμενο επιστρέφεται από συναρτήσεις που δεν επιστρέφουν ρητά " +"μια τιμή. Δεν υποστηρίζει ειδικές λειτουργίες. Υπάρχει ακριβώς ένα " +"μηδενικό αντικείμενο, που ονομάζεται ``None`` (ένα ενσωματωμένο όνομα). Το " +"``type(None)()`` παράγει το ίδιο singleton." -#: library/stdtypes.rst:5425 +#: library/stdtypes.rst:5984 msgid "It is written as ``None``." -msgstr "" +msgstr "Γράφεται ως ``None``." -#: library/stdtypes.rst:5432 +#: library/stdtypes.rst:5991 msgid "The Ellipsis Object" -msgstr "" +msgstr "Το αντικείμενο Ellipsis" -#: library/stdtypes.rst:5434 +#: library/stdtypes.rst:5993 msgid "" -"This object is commonly used by slicing (see :ref:`slicings`). It supports " -"no special operations. There is exactly one ellipsis object, named :const:" -"`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:" -"`Ellipsis` singleton." +"This object is commonly used to indicate that something is omitted. It " +"supports no special operations. There is exactly one ellipsis object, " +"named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " +"the :const:`Ellipsis` singleton." msgstr "" +"Αυτό το αντικείμενο χρησιμοποιείται συχνά για να δηλωθεί ότι κάτι " +"παραλείπεται. Δεν υποστηρίζει καμία ειδική λειτουργία. Υπάρχει ακριβώς ένα " +"αντικείμενο ellipsis, με το όνομα :const:`Ellipsis` (ένα ενσωματωμένο " +"όνομα). Το ``type(Ellipsis)()`` παράγει το μοναδικό αντικείμενο :const:" +"`Ellipsis`." -#: library/stdtypes.rst:5439 +#: library/stdtypes.rst:5998 msgid "It is written as ``Ellipsis`` or ``...``." +msgstr "Γράφεται ως ``Ellipsis`` ή ``...``." + +#: library/stdtypes.rst:6000 +msgid "" +"In typical use, ``...`` as the ``Ellipsis`` object appears in a few " +"different places, for instance:" msgstr "" +"Στην τυπική χρήση, το ``...`` ως αντικείμενο ``Ellipsis`` εμφανίζεται σε " +"μερικές διαφορετικές θέσεις, για παράδειγμα:" -#: library/stdtypes.rst:5445 -msgid "The NotImplemented Object" +#: library/stdtypes.rst:6003 +msgid "" +"In type annotations, such as :ref:`callable arguments ` or :ref:`tuple elements `." +msgstr "" +"Σε υποδείξεις τύπου, όπως :ref:`callable arguments ` " +"ή :ref:`tuple elements `." + +#: library/stdtypes.rst:6006 +msgid "" +"As the body of a function instead of a :ref:`pass statement `." +msgstr "" +"Ως το σώμα μιας συνάρτησης αντί για μια :ref:`pass statement `." + +#: library/stdtypes.rst:6008 +msgid "" +"In third-party libraries, such as `Numpy's slicing and striding `_." +msgstr "" +"Σε βιβλιοθήκες τρίτων, όπως το `Numpy's slicing and striding `_." + +#: library/stdtypes.rst:6011 +msgid "" +"Python also uses three dots in ways that are not ``Ellipsis`` objects, for " +"instance:" +msgstr "" +"Η Python χρησιμοποιεί επίσης τρεις τελείες με τρόπους που δεν είναι " +"αντικείμενα ``Ellipsis``, για παράδειγμα:" + +#: library/stdtypes.rst:6013 +msgid "" +"Doctest's :const:`ELLIPSIS `, as a pattern for missing " +"content." +msgstr "" +"Το :const:`ELLIPSIS ` του doctest, ως ένα μοτίβο για " +"ελλιπές περιεχόμενο." + +#: library/stdtypes.rst:6015 +msgid "" +"The default Python prompt of the :term:`interactive` shell when partial " +"input is incomplete." msgstr "" +"Το προεπιλεγμένο προτρεπτικό της Python στο :term:`interactive` κέλυφος όταν " +"η μερική είσοδος είναι ανολοκλήρωτη." -#: library/stdtypes.rst:5447 +#: library/stdtypes.rst:6017 +msgid "" +"Lastly, the Python documentation often uses three dots in conventional " +"English usage to mean omitted content, even in code examples that also use " +"them as the ``Ellipsis``." +msgstr "" +"Τέλος, η τεκμηρίωση της Python χρησιμοποιεί συχνά τρεις τελείες στην " +"παραδοσιακή αγγλική χρήση για να δηλώσει παραλειπόμενο περιεχόμενο, ακόμα " +"και σε παραδείγματα κώδικα που τις χρησιμοποιούν και ως ``Ellipsis``." + +#: library/stdtypes.rst:6025 +msgid "The NotImplemented Object" +msgstr "Το NotImplemented Αντικείμενο" + +#: library/stdtypes.rst:6027 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " "more information. There is exactly one :data:`NotImplemented` object. :code:" "`type(NotImplemented)()` produces the singleton instance." msgstr "" +"Αυτό το αντικείμενο επιστρέφεται από συγκρίσεις και δυαδικές λειτουργίες " +"όταν τους ζητείται να λειτουργήσουν σε τύπους που δεν υποστηρίζουν. Δείτε " +"το :ref:`comparisons` για περισσότερες πληροφορίες. Υπάρχει ακριβώς ένα " +"αντικείμενο :data:`NotImplemented`. Το :code:`type(NotImplemented)()` " +"παράγει το στιγμιότυπο singleton." -#: library/stdtypes.rst:5452 +#: library/stdtypes.rst:6032 msgid "It is written as :code:`NotImplemented`." -msgstr "" +msgstr "Είναι γραμμένο ως :code:`NotImplemented`." -#: library/stdtypes.rst:5458 +#: library/stdtypes.rst:6038 msgid "Internal Objects" -msgstr "" +msgstr "Εσωτερικά Αντικείμενα" -#: library/stdtypes.rst:5460 +#: library/stdtypes.rst:6040 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" +"Δείτε :ref:`types` για αυτές τις πληροφορίες. Περιγράφει :ref:`stack frame " +"objects `, :ref:`traceback objects `, και " +"αντικείμενα τμηματοποίησης." -#: library/stdtypes.rst:5468 +#: library/stdtypes.rst:6048 msgid "Special Attributes" -msgstr "" +msgstr "Ειδικά Χαρακτηριστικά" -#: library/stdtypes.rst:5470 +#: library/stdtypes.rst:6050 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" +"Η υλοποίηση προσθέτει μερικά ειδικά χαρακτηριστικά μόνο για ανάγνωση σε " +"διάφορους τύπους αντικειμένων, όπου είναι σχετικά. Ορισμένα από αυτά δεν " +"αναφέρονται από την ενσωματωμένη συνάρτηση :func:`dir`." -#: library/stdtypes.rst:5477 -msgid "" -"A dictionary or other mapping object used to store an object's (writable) " -"attributes." -msgstr "" - -#: library/stdtypes.rst:5483 -msgid "The class to which a class instance belongs." -msgstr "" - -#: library/stdtypes.rst:5488 -msgid "The tuple of base classes of a class object." -msgstr "" - -#: library/stdtypes.rst:5493 +#: library/stdtypes.rst:6057 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" +"Το όνομα της κλάσης, της συνάρτησης, της μεθόδου, του descriptor ή του " +"στιγμιοτύπου generator." -#: library/stdtypes.rst:5499 +#: library/stdtypes.rst:6063 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" +"Το :term:`qualified name` της κλάσης, της συνάρτησης, της μεθόδου, του " +"descriptor, ή του στιγμιοτύπου generator." -#: library/stdtypes.rst:5507 -msgid "" -"The :ref:`type parameters ` of generic classes, functions, and :" -"ref:`type aliases `." -msgstr "" - -#: library/stdtypes.rst:5515 -msgid "" -"This attribute is a tuple of classes that are considered when looking for " -"base classes during method resolution." -msgstr "" +#: library/stdtypes.rst:6071 +msgid "The name of the module in which a class or function was defined." +msgstr "Το όνομα του module στο οποίο ορίστηκε μια κλάση ή μια συνάρτηση." -#: library/stdtypes.rst:5521 +#: library/stdtypes.rst:6076 msgid "" -"This method can be overridden by a metaclass to customize the method " -"resolution order for its instances. It is called at class instantiation, " -"and its result is stored in :attr:`~class.__mro__`." +"The documentation string of a class or function, or ``None`` if undefined." msgstr "" +"Η συμβολοσειρά τεκμηρίωσης μιας κλάσης ή συνάρτησης ή ``None`` εάν δεν έχει " +"οριστεί." -#: library/stdtypes.rst:5528 +#: library/stdtypes.rst:6081 msgid "" -"Each class keeps a list of weak references to its immediate subclasses. " -"This method returns a list of all those references still alive. The list is " -"in definition order. Example::" +"The :ref:`type parameters ` of generic classes, functions, and :" +"ref:`type aliases `. For classes and functions that are not " +"generic, this will be an empty tuple." msgstr "" +"Οι παράμετροι :ref:`type parameters ` των γενικών κλάσεων, " +"συναρτήσεων και :ref:`type aliases `. Για κλάσεις και " +"συναρτήσεις που δεν είναι γενικές, αυτή θα είναι μια κενή πλειάδα." -#: library/stdtypes.rst:5539 +#: library/stdtypes.rst:6091 msgid "Integer string conversion length limitation" -msgstr "" +msgstr "Περιορισμός μήκους μετατροπής συμβολοσειράς ακέραιου αριθμού" -#: library/stdtypes.rst:5541 +#: library/stdtypes.rst:6093 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " "decimal or other non-power-of-two number bases. Hexadecimal, octal, and " "binary conversions are unlimited. The limit can be configured." msgstr "" +"Η CPython έχει ένα παγκόσμιο όριο για τη μετατροπή μεταξύ :class:`int` and :" +"class:`str` για τον μετριασμό των επιθέσεων άρνησης υπηρεσίας. Αυτό το όριο " +"ισχύει *μόνο* για δεκαδικές ή άλλες βάσεις αριθμών που δεν έχουν την δύναμη " +"του δύο. Οι δεξαεξαδικές, οκταδικές, και δυαδικές μετατροπές είναι " +"απεριόριστες. Το όριο μπορεί να διαμορφωθεί." -#: library/stdtypes.rst:5546 +#: library/stdtypes.rst:6098 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -5878,121 +11009,213 @@ msgid "" "algorithms for base 10 have sub-quadratic complexity. Converting a large " "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" +"Ο τύπος :class:`int` στην CPython είναι ένας αυθαίρετος αριθμός μήκους που " +"είναι αποθηκευμένος σε δυαδική μορφή (κοινώς γνωστός ως \"bignum\"). Δεν " +"υπάρχει αλγόριθμος που να μπορεί να μετατρέψει μια συμβολοσειρά σε δυαδικό " +"ακέραιο ή δυαδικό ακέραιο σε μια συμβολοσειρά σε γραμμικό χρόνο, *εκτός* εάν " +"η βάση είναι δύναμη του 2. Ακόμη και οι πιο γνωστοί αλγόριθμοι για τη βάση " +"10 έχουν υποτετραγωνική πολυπλοκότητα. Η μετατροπή μιας μεγάλης τιμής όπως " +"``int('1' * 500_000)`` μπορεί να διαρκέσει περισσότερο από ένα δευτερόλεπτο " +"σε μια γρήγορη CPU." -#: library/stdtypes.rst:5553 +#: library/stdtypes.rst:6105 msgid "" -"Limiting conversion size offers a practical way to avoid `CVE-2020-10735 " -"`_." +"Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" +"Ο περιορισμός του μεγέθους μετατροπής προσφέρει έναν πρακτικό τρόπο αποφυγής " +"του :cve:`2020-10735`." -#: library/stdtypes.rst:5556 +#: library/stdtypes.rst:6107 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" +"Το όριο εφαρμόζεται στον αριθμό των ψηφιακών χαρακτήρων στη συμβολοσειρά " +"εισόδου ή εξόδου όταν εμπλέκεται ένας μη γραμμικός αλγόριθμος μετατροπής. " +"Τα underscores και το πρόσημο δεν υπολογίζονται στο όριο." -#: library/stdtypes.rst:5560 +#: library/stdtypes.rst:6111 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" - -#: library/stdtypes.rst:5582 +"Όταν μια λειτουργία υπερβαίνει το όριο, γίνεται raise μια :exc:`ValueError`:" + +#: library/stdtypes.rst:6113 +msgid "" +">>> import sys\n" +">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" +">>> _ = int('2' * 5432)\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Exceeds the limit (4300 digits) for integer string conversion: " +"value has 5432 digits; use sys.set_int_max_str_digits() to increase the " +"limit\n" +">>> i = int('2' * 4300)\n" +">>> len(str(i))\n" +"4300\n" +">>> i_squared = i*i\n" +">>> len(str(i_squared))\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Exceeds the limit (4300 digits) for integer string conversion; " +"use sys.set_int_max_str_digits() to increase the limit\n" +">>> len(hex(i_squared))\n" +"7144\n" +">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." +msgstr "" +">>> import sys\n" +">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" +">>> _ = int('2' * 5432)\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Exceeds the limit (4300 digits) for integer string conversion: " +"value has 5432 digits; use sys.set_int_max_str_digits() to increase the " +"limit\n" +">>> i = int('2' * 4300)\n" +">>> len(str(i))\n" +"4300\n" +">>> i_squared = i*i\n" +">>> len(str(i_squared))\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Exceeds the limit (4300 digits) for integer string conversion; " +"use sys.set_int_max_str_digits() to increase the limit\n" +">>> len(hex(i_squared))\n" +"7144\n" +">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." + +#: library/stdtypes.rst:6133 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " "configured is 640 digits as provided in :data:`sys.int_info." "str_digits_check_threshold `." msgstr "" +"Το προεπιλεγμένο όριο είναι 4300 ψηφία όπως προβλέπεται στο :data:`sys." +"int_info.default_max_str_digits `. Το κατώτατο όριο που μπορεί " +"να διαμορφωθεί είναι 640 ψηφία όπως προβλέπεται στο :data:`sys.int_info." +"str_digits_check_threshold `." -#: library/stdtypes.rst:5587 +#: library/stdtypes.rst:6138 msgid "Verification:" -msgstr "" - -#: library/stdtypes.rst:5602 +msgstr "Επαλήθευση:" + +#: library/stdtypes.rst:6140 +msgid "" +">>> import sys\n" +">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" +">>> assert sys.int_info.str_digits_check_threshold == 640, sys.int_info\n" +">>> msg = int('578966293710682886880994035146873798396722250538762761564'\n" +"... '9252925514383915483333812743580549779436104706260696366600'\n" +"... '571186405732').to_bytes(53, 'big')\n" +"..." +msgstr "" +">>> import sys\n" +">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" +">>> assert sys.int_info.str_digits_check_threshold == 640, sys.int_info\n" +">>> msg = int('578966293710682886880994035146873798396722250538762761564'\n" +"... '9252925514383915483333812743580549779436104706260696366600'\n" +"... '571186405732').to_bytes(53, 'big')\n" +"..." + +#: library/stdtypes.rst:6153 msgid "Affected APIs" -msgstr "" +msgstr "Επηρεασμένα APIs" -#: library/stdtypes.rst:5604 +#: library/stdtypes.rst:6155 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" +"Ο περιορισμός ισχύει μόνο για δυνητικά αργές μετατροπές μεταξύ :class:`int` " +"και :class:`str` ή :class:`bytes`:" -#: library/stdtypes.rst:5607 +#: library/stdtypes.rst:6158 msgid "``int(string)`` with default base 10." -msgstr "" +msgstr "``int(string)`` με default βάση το 10." -#: library/stdtypes.rst:5608 +#: library/stdtypes.rst:6159 msgid "``int(string, base)`` for all bases that are not a power of 2." -msgstr "" +msgstr "``int(string, base)`` για όλες τις βάσεις που δεν είναι δύναμη του 2." -#: library/stdtypes.rst:5609 +#: library/stdtypes.rst:6160 msgid "``str(integer)``." -msgstr "" +msgstr "``str(integer)``." -#: library/stdtypes.rst:5610 +#: library/stdtypes.rst:6161 msgid "``repr(integer)``." -msgstr "" +msgstr "``repr(integer)``." -#: library/stdtypes.rst:5611 +#: library/stdtypes.rst:6162 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" +"οποιαδήποτε άλλη μετατροπή συμβολοσειράς στη βάση 10, για παράδειγμα " +"``f\"{integer}\"``, ``\"{}\".format(integer)``, ή ``b\"%d\" % integer``." -#: library/stdtypes.rst:5614 +#: library/stdtypes.rst:6165 msgid "The limitations do not apply to functions with a linear algorithm:" -msgstr "" +msgstr "Οι περιορισμοί δεν ισχύουν για συναρτήσεις με γραμμικό αλγόριθμο:" -#: library/stdtypes.rst:5616 +#: library/stdtypes.rst:6167 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." -msgstr "" +msgstr "``int(string, base)`` με βάση 2, 4, 8, 16, ή 32." -#: library/stdtypes.rst:5617 +#: library/stdtypes.rst:6168 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." -msgstr "" +msgstr ":func:`int.from_bytes` και :func:`int.to_bytes`." -#: library/stdtypes.rst:5618 +#: library/stdtypes.rst:6169 msgid ":func:`hex`, :func:`oct`, :func:`bin`." -msgstr "" +msgstr ":func:`hex`, :func:`oct`, :func:`bin`." -#: library/stdtypes.rst:5619 +#: library/stdtypes.rst:6170 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" +":ref:`formatspec` για δεκαεξαδικούς, οκταδικούς και δυαδικούς αριθμούς." -#: library/stdtypes.rst:5620 +#: library/stdtypes.rst:6171 msgid ":class:`str` to :class:`float`." -msgstr "" +msgstr ":class:`str` σε :class:`float`." -#: library/stdtypes.rst:5621 +#: library/stdtypes.rst:6172 msgid ":class:`str` to :class:`decimal.Decimal`." -msgstr "" +msgstr ":class:`str` σε :class:`decimal.Decimal`." -#: library/stdtypes.rst:5624 +#: library/stdtypes.rst:6175 msgid "Configuring the limit" -msgstr "" +msgstr "Διαμόρφωση ορίου" -#: library/stdtypes.rst:5626 +#: library/stdtypes.rst:6177 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" +"Πριν από την εκκίνηση της Python, μπορείτε να χρησιμοποιήσετε μια μεταβλητή " +"περιβάλλοντος ή ένα δείκτη γραμμής εντολών διερμηνέα για να διαμορφώσετε το " +"όριο:" -#: library/stdtypes.rst:5629 +#: library/stdtypes.rst:6180 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" +":envvar:`PYTHONINTMAXSTRDIGITS`, π.χ. ``PYTHONINTMAXSTRDIGITS=640 python3`` " +"για να ορίσετε το όριο σε 640 ή ``PYTHONINTMAXSTRDIGITS=0 python3`` για να " +"απενεργοποιήσετε τον περιορισμό." -#: library/stdtypes.rst:5632 +#: library/stdtypes.rst:6183 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" msgstr "" +":option:`-X int_max_str_digits <-X>`, π.χ. ``python3 -X " +"int_max_str_digits=640``" -#: library/stdtypes.rst:5634 +#: library/stdtypes.rst:6185 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -6000,39 +11223,56 @@ msgid "" "value of *-1* indicates that both were unset, thus a value of :data:`sys." "int_info.default_max_str_digits` was used during initialization." msgstr "" +"Το :data:`sys.flags.int_max_str_digits` περιέχει την τιμή :envvar:" +"`PYTHONINTMAXSTRDIGITS` ή :option:`-X int_max_str_digits <-X>`. Εάν και η " +"επιλογή env var και η επιλογή ``-X`` είναι καθορισμένη, η επιλογή ``-X`` " +"έχει προτεραιότητα. Μια τιμή *-1* υποδεικνύει ότι και τα δύο δεν ορίστηκαν, " +"επομένως χρησιμοποιήθηκε μια τιμή :data:`sys.int_info." +"default_max_str_digits` κατά την προετοιμασία." -#: library/stdtypes.rst:5640 +#: library/stdtypes.rst:6191 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" +"Από τον κώδικα, μπορείτε να επιθεωρήσετε το τρέχον όριο και να ορίσετε ένα " +"νέο χρησιμοποιώντας αυτά τα :mod:`sys` APIs:" -#: library/stdtypes.rst:5643 +#: library/stdtypes.rst:6194 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" +"Οι :func:`sys.get_int_max_str_digits` και :func:`sys.set_int_max_str_digits` " +"είναι ένας getter και setter για το όριο σε όλο τον διερμηνέα. Οι " +"δευτερεύοντες διερμηνείς έχουν το δικό τους όριο." -#: library/stdtypes.rst:5647 +#: library/stdtypes.rst:6198 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" +"Πληροφορίες σχετικά με την προεπιλογή και το ελάχιστο μπορούν να βρεθούν " +"στο :data:`sys.int_info`:" -#: library/stdtypes.rst:5649 +#: library/stdtypes.rst:6200 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" +"Το :data:`sys.int_info.default_max_str_digits ` είναι το " +"μεταγλωττισμένο προεπιλεγμένο όριο." -#: library/stdtypes.rst:5651 +#: library/stdtypes.rst:6202 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" +"Το :data:`sys.int_info.str_digits_check_threshold ` είναι η " +"χαμηλότερη αποδεκτή τιμή για το όριο (εκτός από το 0 που το απενεργοποιεί)." -#: library/stdtypes.rst:5658 +#: library/stdtypes.rst:6209 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -6043,777 +11283,1033 @@ msgid "" "exist for the code. A workaround for source that contains such large " "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" +"Ο ορισμός ενός χαμηλού ορίου *μπορεί* να οδηγήσει σε προβλήματα. Αν και " +"σπάνιος, υπάρχει κώδικας που περιέχει ακέραιες σταθερές σε δεκαδικό αριθμό " +"στην πηγή τους που υπερβαίνουν το ελάχιστο όριο. Συνέπεια της ρύθμισης του " +"ορίου είναι ότι ο πηγαίος κώδικας Python που περιέχει δεκαδικούς ακέραιους " +"αριθμούς μεγαλύτερους από το όριο θα αντιμετωπίσει σφάλμα κατά την ανάλυση, " +"συνήθως κατά την εκκίνηση ή την ώρα της εισαγωγής ή ακόμα και κατά την " +"εγκατάσταση - ανά πάσα στιγμή είναι ενημερωμένο ``.pyc`` δεν υπάρχει ήδη για " +"τον κώδικα. Μια λύση για τον πηγαίο που περιέχει τόσο μεγάλες σταθερές είναι " +"να τις μετατρέψετε σε δεκαεξαδική μορφή ``0x`` καθώς δεν έχει όριο." -#: library/stdtypes.rst:5667 +#: library/stdtypes.rst:6218 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " "during startup and even during any installation step that may invoke Python " "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" +"Δοκιμάστε σχολαστικά την εφαρμογή σας εάν χρησιμοποιείτε χαμηλό όριο. " +"Βεβαιωθείτε ότι οι δοκιμές σας εκτελούνται με το όριο που έχει οριστεί νωρίς " +"μέσω του περιβάλλοντος ή του δείκτη, ώστε να ισχύει κατά την εκκίνηση και " +"ακόμη και κατά τη διάρκεια οποιουδήποτε βήματος εγκατάστασης που μπορεί να " +"καλέσει την Python για να μεταγλωττίσει εκ των προτέρων το ``.py`` πηγαίο σε " +"αρχεία ``.pyc``." -#: library/stdtypes.rst:5673 +#: library/stdtypes.rst:6224 msgid "Recommended configuration" -msgstr "" +msgstr "Προτεινόμενη διαμόρφωση" -#: library/stdtypes.rst:5675 +#: library/stdtypes.rst:6226 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " "limit, set it from your main entry point using Python version agnostic code " "as these APIs were added in security patch releases in versions before 3.12." msgstr "" +"Το προεπιλεγμένο :data:`sys.int_info.default_max_str_digits` αναμένεται να " +"είναι λογικό για τις περισσότερες εφαρμογές. Εάν η εφαρμογή σας απαιτεί " +"διαφορετικό όριο, ορίστε το από το κύριο σημείο εισόδου σας χρησιμοποιώντας " +"τον συμβατό με τον κώδικα της έκδοσης Python, καθώς αυτά τα API προστέθηκαν " +"στην ενημερωμένη έκδοση κώδικα ασφαλείας σε εκδόσεις πριν από την 3.12." -#: library/stdtypes.rst:5680 +#: library/stdtypes.rst:6231 msgid "Example::" -msgstr "" - -#: library/stdtypes.rst:5692 +msgstr "Παράδειγμα::" + +#: library/stdtypes.rst:6233 +msgid "" +">>> import sys\n" +">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" +"... upper_bound = 68000\n" +"... lower_bound = 4004\n" +"... current_limit = sys.get_int_max_str_digits()\n" +"... if current_limit == 0 or current_limit > upper_bound:\n" +"... sys.set_int_max_str_digits(upper_bound)\n" +"... elif current_limit < lower_bound:\n" +"... sys.set_int_max_str_digits(lower_bound)" +msgstr "" +">>> import sys\n" +">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" +"... upper_bound = 68000\n" +"... lower_bound = 4004\n" +"... current_limit = sys.get_int_max_str_digits()\n" +"... if current_limit == 0 or current_limit > upper_bound:\n" +"... sys.set_int_max_str_digits(upper_bound)\n" +"... elif current_limit < lower_bound:\n" +"... sys.set_int_max_str_digits(lower_bound)" + +#: library/stdtypes.rst:6243 msgid "If you need to disable it entirely, set it to ``0``." -msgstr "" +msgstr "Εάν πρέπει να το απενεργοποιήσετε εντελώς, ορίστε το σε ``0``." -#: library/stdtypes.rst:5696 +#: library/stdtypes.rst:6247 msgid "Footnotes" -msgstr "" +msgstr "Υποσημειώσεις" -#: library/stdtypes.rst:5697 +#: library/stdtypes.rst:6248 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" +"Πρόσθετε πληροφορίες σχετικά με αυτές τις ειδικές μεθόδους μπορείτε να " +"βρείτε στο Εγχειρίδιο Αναφοράς Python (:ref:`customization`)." -#: library/stdtypes.rst:5700 +#: library/stdtypes.rst:6251 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" +"Σαν συνέπεια, η λίστα ``[1, 2]`` θεωρείται ίση με ``[1.0, 2.0]``, και ομοίως " +"για πλειάδες (tuples)." -#: library/stdtypes.rst:5703 +#: library/stdtypes.rst:6254 msgid "They must have since the parser can't tell the type of the operands." msgstr "" +"Πρέπει να έχουν, αφού ο parser δεν μπορεί να ξεχωρίσει τον τύπο των τελεστών." -#: library/stdtypes.rst:5705 +#: library/stdtypes.rst:6256 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" +"Οι χαρακτήρες με πεζά είναι αυτοί με την ιδιότητα γενικής κατηγορίας να " +"είναι ένας από τους \"Lu\" (Γράμμα, κεφαλαίο), \"Ll\" (Γράμμα, πεζά), ή " +"\"Lt\" (Γράμμα, κεφαλαία)." -#: library/stdtypes.rst:5708 +#: library/stdtypes.rst:6259 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." msgstr "" +"Για να μορφοποιήσετε μόνο μια πλειάδα (tuple) θα πρέπει επομένως να παρέχετε " +"μια πλειάδα singleton της οποίας το μόνο στοιχείο είναι η πλειάδα που " +"πρόκειται να μορφοποιηθεί." #: library/stdtypes.rst:13 msgid "built-in" -msgstr "" +msgstr "ενσωματωμένοι (built-in) τύποι" -#: library/stdtypes.rst:316 library/stdtypes.rst:950 library/stdtypes.rst:1139 -#: library/stdtypes.rst:4421 library/stdtypes.rst:5404 +#: library/stdtypes.rst:322 library/stdtypes.rst:992 library/stdtypes.rst:1201 +#: library/stdtypes.rst:4966 library/stdtypes.rst:5963 msgid "types" -msgstr "" +msgstr "τύποι" -#: library/stdtypes.rst:1154 library/stdtypes.rst:4421 +#: library/stdtypes.rst:1216 library/stdtypes.rst:4966 msgid "statement" -msgstr "" +msgstr "statement" #: library/stdtypes.rst:34 msgid "if" -msgstr "" +msgstr "if" #: library/stdtypes.rst:34 msgid "while" -msgstr "" +msgstr "while" #: library/stdtypes.rst:34 msgid "truth" -msgstr "" +msgstr "αληθές" #: library/stdtypes.rst:34 msgid "value" -msgstr "" +msgstr "τιμή" -#: library/stdtypes.rst:81 library/stdtypes.rst:817 +#: library/stdtypes.rst:81 library/stdtypes.rst:859 msgid "Boolean" -msgstr "" +msgstr "Boolean" -#: library/stdtypes.rst:81 library/stdtypes.rst:393 +#: library/stdtypes.rst:81 library/stdtypes.rst:399 msgid "operations" -msgstr "" +msgstr "λειτουργίες" #: library/stdtypes.rst:34 msgid "false" -msgstr "" +msgstr "false" #: library/stdtypes.rst:44 msgid "true" -msgstr "" +msgstr "true" #: library/stdtypes.rst:52 msgid "None (Built-in object)" -msgstr "" +msgstr "None (Ενσωματωμένο (Built-in) αντικείμενο)" #: library/stdtypes.rst:52 msgid "False (Built-in object)" -msgstr "" +msgstr "False (Ενσωματωμένο (Built-in) αντικείμενο)" -#: library/stdtypes.rst:98 library/stdtypes.rst:195 library/stdtypes.rst:393 -#: library/stdtypes.rst:950 +#: library/stdtypes.rst:98 library/stdtypes.rst:195 library/stdtypes.rst:399 +#: library/stdtypes.rst:992 msgid "operator" -msgstr "" +msgstr "τελεστής" #: library/stdtypes.rst:98 msgid "or" -msgstr "" +msgstr "or" #: library/stdtypes.rst:98 msgid "and" -msgstr "" +msgstr "and" -#: library/stdtypes.rst:817 +#: library/stdtypes.rst:859 msgid "False" -msgstr "" +msgstr "False" -#: library/stdtypes.rst:817 +#: library/stdtypes.rst:859 msgid "True" -msgstr "" +msgstr "True" #: library/stdtypes.rst:98 msgid "not" -msgstr "" +msgstr "not" #: library/stdtypes.rst:123 msgid "chaining" -msgstr "" +msgstr "αλυσίδα" #: library/stdtypes.rst:123 msgid "comparisons" -msgstr "" +msgstr "συγκρίσεις" #: library/stdtypes.rst:123 msgid "comparison" -msgstr "" +msgstr "σύγκριση" #: library/stdtypes.rst:123 msgid "==" -msgstr "" +msgstr "==" #: library/stdtypes.rst:123 msgid "< (less)" -msgstr "" +msgstr "< (μικρότερο)" #: library/stdtypes.rst:123 msgid "<=" -msgstr "" +msgstr "<=" #: library/stdtypes.rst:123 msgid "> (greater)" -msgstr "" +msgstr "> (μεγαλύτερο)" #: library/stdtypes.rst:123 msgid ">=" -msgstr "" +msgstr ">=" #: library/stdtypes.rst:123 msgid "!=" -msgstr "" +msgstr "!=" #: library/stdtypes.rst:123 msgid "is" -msgstr "" +msgstr "is" #: library/stdtypes.rst:123 msgid "is not" -msgstr "" +msgstr "is not" -#: library/stdtypes.rst:208 library/stdtypes.rst:1117 library/stdtypes.rst:1259 -#: library/stdtypes.rst:1382 library/stdtypes.rst:1539 -#: library/stdtypes.rst:2532 library/stdtypes.rst:4219 -#: library/stdtypes.rst:4899 library/stdtypes.rst:5324 -#: library/stdtypes.rst:5368 +#: library/stdtypes.rst:208 library/stdtypes.rst:1179 library/stdtypes.rst:1366 +#: library/stdtypes.rst:1489 library/stdtypes.rst:1740 +#: library/stdtypes.rst:3014 library/stdtypes.rst:4763 +#: library/stdtypes.rst:5450 library/stdtypes.rst:5882 +#: library/stdtypes.rst:5927 msgid "object" -msgstr "" +msgstr "αντικείμενο" -#: library/stdtypes.rst:208 library/stdtypes.rst:316 library/stdtypes.rst:335 +#: library/stdtypes.rst:208 library/stdtypes.rst:322 library/stdtypes.rst:341 msgid "numeric" -msgstr "" +msgstr "αριθμητικό" #: library/stdtypes.rst:163 msgid "objects" -msgstr "" +msgstr "αντικείμενα" #: library/stdtypes.rst:163 msgid "comparing" -msgstr "" +msgstr "συγκρίνοντας" #: library/stdtypes.rst:173 msgid "__eq__() (instance method)" -msgstr "" +msgstr "__eq__() (μέθοδος στιγμιοτύπου)" #: library/stdtypes.rst:173 msgid "__ne__() (instance method)" -msgstr "" +msgstr "__ne__() (μέθοδος στιγμιοτύπου)" #: library/stdtypes.rst:173 msgid "__lt__() (instance method)" -msgstr "" +msgstr "__lt__() (μέθοδος στιγμιοτύπου)" #: library/stdtypes.rst:173 msgid "__le__() (instance method)" -msgstr "" +msgstr "__le__() (μέθοδος στιγμιοτύπου)" #: library/stdtypes.rst:173 msgid "__gt__() (instance method)" -msgstr "" +msgstr "__gt__() (μέθοδος στιγμιοτύπου)" #: library/stdtypes.rst:173 msgid "__ge__() (instance method)" -msgstr "" +msgstr "__ge__() (μέθοδος στιγμιοτύπου)" -#: library/stdtypes.rst:950 +#: library/stdtypes.rst:992 msgid "in" -msgstr "" +msgstr "in" -#: library/stdtypes.rst:950 +#: library/stdtypes.rst:992 msgid "not in" -msgstr "" +msgstr "not in" -#: library/stdtypes.rst:229 library/stdtypes.rst:393 +#: library/stdtypes.rst:229 library/stdtypes.rst:399 msgid "integer" -msgstr "" +msgstr "ακέραιος" #: library/stdtypes.rst:229 -msgid "floating point" -msgstr "" +msgid "floating-point" +msgstr "κινητής υποδιαστολής" #: library/stdtypes.rst:229 msgid "complex number" -msgstr "" +msgstr "μιγαδικός αριθμός" #: library/stdtypes.rst:208 msgid "C" -msgstr "" +msgstr "C" #: library/stdtypes.rst:208 msgid "language" -msgstr "" +msgstr "γλώσσα" #: library/stdtypes.rst:229 msgid "literals" -msgstr "" +msgstr "literals" #: library/stdtypes.rst:229 msgid "hexadecimal" -msgstr "" +msgstr "δεκαεξαδικό" #: library/stdtypes.rst:229 msgid "octal" -msgstr "" +msgstr "οκταδικό" #: library/stdtypes.rst:229 msgid "binary" -msgstr "" +msgstr "δυαδικό" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "arithmetic" -msgstr "" +msgstr "αριθμητικό" -#: library/stdtypes.rst:950 library/stdtypes.rst:4421 library/stdtypes.rst:5389 -#: library/stdtypes.rst:5404 +#: library/stdtypes.rst:992 library/stdtypes.rst:4966 library/stdtypes.rst:5948 +#: library/stdtypes.rst:5963 msgid "built-in function" -msgstr "" +msgstr "ενσωματωμένες (built-in) συναρτήσεις" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "int" -msgstr "" +msgstr "int" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "float" -msgstr "" +msgstr "float" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "complex" -msgstr "" +msgstr "complex" -#: library/stdtypes.rst:2389 library/stdtypes.rst:3607 +#: library/stdtypes.rst:2871 library/stdtypes.rst:4131 msgid "+ (plus)" -msgstr "" +msgstr "+ (συν)" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "unary operator" -msgstr "" +msgstr "τελεστής unary" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "binary operator" -msgstr "" +msgstr "δυαδικός τελεστής" -#: library/stdtypes.rst:2389 library/stdtypes.rst:3607 +#: library/stdtypes.rst:2871 library/stdtypes.rst:4131 msgid "- (minus)" -msgstr "" +msgstr "- (πλην)" -#: library/stdtypes.rst:2346 library/stdtypes.rst:3564 +#: library/stdtypes.rst:2828 library/stdtypes.rst:4088 msgid "* (asterisk)" -msgstr "" +msgstr "* (αστερίσκος)" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "/ (slash)" -msgstr "" +msgstr "/ (κάθετος)" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "//" -msgstr "" +msgstr "//" -#: library/stdtypes.rst:2316 library/stdtypes.rst:3532 +#: library/stdtypes.rst:2791 library/stdtypes.rst:4056 msgid "% (percent)" -msgstr "" +msgstr "% (τοις εκατό)" -#: library/stdtypes.rst:246 +#: library/stdtypes.rst:249 msgid "**" -msgstr "" +msgstr "**" -#: library/stdtypes.rst:393 library/stdtypes.rst:1154 library/stdtypes.rst:4421 +#: library/stdtypes.rst:399 library/stdtypes.rst:1216 library/stdtypes.rst:4966 msgid "operations on" -msgstr "" +msgstr "λειτουργίες on" -#: library/stdtypes.rst:316 +#: library/stdtypes.rst:322 msgid "conjugate() (complex number method)" -msgstr "" +msgstr "conjugate() (μέθοδος μιγαδικών αριθμών)" -#: library/stdtypes.rst:1605 library/stdtypes.rst:5404 +#: library/stdtypes.rst:1808 library/stdtypes.rst:5963 msgid "module" -msgstr "" +msgstr "module" -#: library/stdtypes.rst:335 +#: library/stdtypes.rst:341 msgid "math" -msgstr "" +msgstr "math" -#: library/stdtypes.rst:335 +#: library/stdtypes.rst:341 msgid "floor() (in module math)" -msgstr "" +msgstr "floor() (στο module math)" -#: library/stdtypes.rst:335 +#: library/stdtypes.rst:341 msgid "ceil() (in module math)" -msgstr "" +msgstr "ceil() (στο module math)" -#: library/stdtypes.rst:335 +#: library/stdtypes.rst:341 msgid "trunc() (in module math)" -msgstr "" +msgstr "trunc() (στο module math)" -#: library/stdtypes.rst:335 +#: library/stdtypes.rst:341 msgid "conversions" -msgstr "" +msgstr "μετατροπές" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid "bitwise" -msgstr "" +msgstr "δυαδικά" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid "shifting" -msgstr "" +msgstr "μετατόπιση (shifting)" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid "masking" -msgstr "" +msgstr "συγκάλυψη (masking)" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid "| (vertical bar)" -msgstr "" +msgstr "| (κάθετη μπάρα)" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid "^ (caret)" -msgstr "" +msgstr "^ (caret)" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid "& (ampersand)" -msgstr "" +msgstr "& (ampersand)" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid "<<" -msgstr "" +msgstr "<<" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid ">>" -msgstr "" +msgstr ">>" -#: library/stdtypes.rst:393 +#: library/stdtypes.rst:399 msgid "~ (tilde)" -msgstr "" +msgstr "~ (περισπωμένη)" -#: library/stdtypes.rst:817 +#: library/stdtypes.rst:859 msgid "values" -msgstr "" +msgstr "τιμές" -#: library/stdtypes.rst:847 +#: library/stdtypes.rst:889 msgid "iterator protocol" -msgstr "" +msgstr "πρωτόκολλο iterator" -#: library/stdtypes.rst:4814 +#: library/stdtypes.rst:5365 msgid "protocol" -msgstr "" +msgstr "πρωτόκολλο" -#: library/stdtypes.rst:847 +#: library/stdtypes.rst:889 msgid "iterator" -msgstr "" +msgstr "iterator" -#: library/stdtypes.rst:934 library/stdtypes.rst:1117 library/stdtypes.rst:1154 +#: library/stdtypes.rst:976 library/stdtypes.rst:1179 library/stdtypes.rst:1216 msgid "sequence" -msgstr "" +msgstr "sequence" -#: library/stdtypes.rst:847 +#: library/stdtypes.rst:889 msgid "iteration" -msgstr "" +msgstr "iteration" -#: library/stdtypes.rst:847 +#: library/stdtypes.rst:889 msgid "container" -msgstr "" +msgstr "container" -#: library/stdtypes.rst:847 +#: library/stdtypes.rst:889 msgid "iteration over" -msgstr "" +msgstr "iteration over" -#: library/stdtypes.rst:4421 +#: library/stdtypes.rst:4966 msgid "len" -msgstr "" +msgstr "len" -#: library/stdtypes.rst:950 +#: library/stdtypes.rst:992 msgid "min" -msgstr "" +msgstr "min" -#: library/stdtypes.rst:950 +#: library/stdtypes.rst:992 msgid "max" -msgstr "" +msgstr "max" -#: library/stdtypes.rst:950 +#: library/stdtypes.rst:992 msgid "concatenation" -msgstr "" +msgstr "concatenation" -#: library/stdtypes.rst:950 +#: library/stdtypes.rst:992 msgid "operation" -msgstr "" +msgstr "λειτουργία" -#: library/stdtypes.rst:950 +#: library/stdtypes.rst:992 msgid "repetition" -msgstr "" +msgstr "επανάληψη" -#: library/stdtypes.rst:1154 +#: library/stdtypes.rst:1216 msgid "subscript" -msgstr "" +msgstr "subscript" -#: library/stdtypes.rst:1154 +#: library/stdtypes.rst:1216 msgid "slice" -msgstr "" - -#: library/stdtypes.rst:950 -msgid "count() (sequence method)" -msgstr "" - -#: library/stdtypes.rst:950 -msgid "index() (sequence method)" -msgstr "" +msgstr "slice" -#: library/stdtypes.rst:1006 +#: library/stdtypes.rst:1039 msgid "loop" -msgstr "" +msgstr "loop" -#: library/stdtypes.rst:1006 +#: library/stdtypes.rst:1039 msgid "over mutable sequence" -msgstr "" +msgstr "πάνω από μεταβλητή ακολουθίας" -#: library/stdtypes.rst:1006 +#: library/stdtypes.rst:1039 msgid "mutable sequence" -msgstr "" +msgstr "μεταβλητή ακολουθίας" -#: library/stdtypes.rst:1006 +#: library/stdtypes.rst:1039 msgid "loop over" -msgstr "" +msgstr "loop over" -#: library/stdtypes.rst:1117 +#: library/stdtypes.rst:1179 msgid "immutable" -msgstr "" +msgstr "αμετάβλητο" -#: library/stdtypes.rst:1338 +#: library/stdtypes.rst:1445 msgid "tuple" -msgstr "" +msgstr "πλειάδα (tuple)" -#: library/stdtypes.rst:1117 +#: library/stdtypes.rst:1179 msgid "hash" -msgstr "" +msgstr "hash" -#: library/stdtypes.rst:1139 +#: library/stdtypes.rst:1201 msgid "mutable" -msgstr "" +msgstr "ευμετάβλητο" -#: library/stdtypes.rst:1154 library/stdtypes.rst:1259 +#: library/stdtypes.rst:1216 library/stdtypes.rst:1366 msgid "list" -msgstr "" +msgstr "λίστα" -#: library/stdtypes.rst:2513 library/stdtypes.rst:2711 -#: library/stdtypes.rst:3532 +#: library/stdtypes.rst:2995 library/stdtypes.rst:3237 +#: library/stdtypes.rst:4056 msgid "bytearray" -msgstr "" +msgstr "bytearray" -#: library/stdtypes.rst:4421 library/stdtypes.rst:5404 +#: library/stdtypes.rst:4966 library/stdtypes.rst:5963 msgid "type" -msgstr "" +msgstr "τύπος" -#: library/stdtypes.rst:1154 +#: library/stdtypes.rst:1216 msgid "assignment" -msgstr "" +msgstr "εκχώρηση" -#: library/stdtypes.rst:4421 +#: library/stdtypes.rst:4966 msgid "del" -msgstr "" - -#: library/stdtypes.rst:1154 -msgid "append() (sequence method)" -msgstr "" - -#: library/stdtypes.rst:1154 -msgid "clear() (sequence method)" -msgstr "" - -#: library/stdtypes.rst:1154 -msgid "copy() (sequence method)" -msgstr "" - -#: library/stdtypes.rst:1154 -msgid "extend() (sequence method)" -msgstr "" - -#: library/stdtypes.rst:1154 -msgid "insert() (sequence method)" -msgstr "" - -#: library/stdtypes.rst:1154 -msgid "pop() (sequence method)" -msgstr "" - -#: library/stdtypes.rst:1154 -msgid "remove() (sequence method)" -msgstr "" - -#: library/stdtypes.rst:1154 -msgid "reverse() (sequence method)" -msgstr "" +msgstr "del" -#: library/stdtypes.rst:1382 +#: library/stdtypes.rst:1489 msgid "range" -msgstr "" +msgstr "range" -#: library/stdtypes.rst:1552 library/stdtypes.rst:2316 +#: library/stdtypes.rst:1753 library/stdtypes.rst:2645 +#: library/stdtypes.rst:2791 msgid "string" -msgstr "" +msgstr "string" -#: library/stdtypes.rst:1503 +#: library/stdtypes.rst:1610 msgid "text sequence type" -msgstr "" +msgstr "τύπος ακολουθίας κειμένου" -#: library/stdtypes.rst:1552 library/stdtypes.rst:1570 +#: library/stdtypes.rst:1753 library/stdtypes.rst:1773 msgid "str (built-in class)" -msgstr "" +msgstr "str (ενσωματωμένη (built-in) κλάση)" -#: library/stdtypes.rst:1503 +#: library/stdtypes.rst:1610 msgid "(see also string)" -msgstr "" +msgstr "(βλ. επίσης string)" -#: library/stdtypes.rst:1539 +#: library/stdtypes.rst:1740 msgid "io.StringIO" -msgstr "" +msgstr "io.StringIO" -#: library/stdtypes.rst:2505 +#: library/stdtypes.rst:2987 msgid "buffer protocol" -msgstr "" +msgstr "πρωτόκολλο buffer" -#: library/stdtypes.rst:2513 library/stdtypes.rst:2711 -#: library/stdtypes.rst:3532 +#: library/stdtypes.rst:2995 library/stdtypes.rst:3237 +#: library/stdtypes.rst:4056 msgid "bytes" -msgstr "" +msgstr "bytes" -#: library/stdtypes.rst:2711 +#: library/stdtypes.rst:3237 msgid "methods" -msgstr "" +msgstr "μέθοδοι" -#: library/stdtypes.rst:1605 +#: library/stdtypes.rst:1808 msgid "re" -msgstr "" +msgstr "re" -#: library/stdtypes.rst:3386 +#: library/stdtypes.rst:3910 msgid "universal newlines" -msgstr "" +msgstr "καθολικές νέες γραμμές" -#: library/stdtypes.rst:2124 +#: library/stdtypes.rst:2457 msgid "str.splitlines method" -msgstr "" +msgstr "μέθοδος str.splitlines" + +#: library/stdtypes.rst:2645 +msgid "! formatted string literal" +msgstr "! μορφοποιημένη συμβολοσειρά κυριολεκτικής μορφής" + +#: library/stdtypes.rst:2645 +msgid "formatted string literals" +msgstr "μορφοποιημένες συμβολοσειρές κυριολεξίας" + +#: library/stdtypes.rst:2645 +msgid "! f-string" +msgstr "! f-string" + +#: library/stdtypes.rst:2645 +msgid "f-strings" +msgstr "string" + +#: library/stdtypes.rst:2645 +msgid "fstring" +msgstr "fstring" + +#: library/stdtypes.rst:2645 +msgid "interpolated string literal" +msgstr "συμβολοσειρά κυριολεξίας με παρεμβολή" + +#: library/stdtypes.rst:2645 +msgid "formatted literal" +msgstr "μορφοποιημένη κυριολεξία" -#: library/stdtypes.rst:2316 +#: library/stdtypes.rst:2645 +msgid "interpolated literal" +msgstr "κυριολεκτικό με παρεμβολή" + +#: library/stdtypes.rst:2645 +msgid "{} (curly brackets)" +msgstr "{} (αγκύλες)" + +#: library/stdtypes.rst:2645 +msgid "in formatted string literal" +msgstr "μέσα σε μορφοποιημένη συμβολοσειρά" + +#: library/stdtypes.rst:2645 +msgid "! (exclamation mark)" +msgstr "! (Θαυμαστικό)" + +#: library/stdtypes.rst:2645 +msgid ": (colon)" +msgstr ": (άνω κάτω τελεία)" + +#: library/stdtypes.rst:2645 +msgid "= (equals)" +msgstr "= (ίσο)" + +#: library/stdtypes.rst:2645 +msgid "for help in debugging using string literals" +msgstr "για βοήθεια στην αποσφαλμάτωση μέσω κυριολεκτικών συμβολοσειρών" + +#: library/stdtypes.rst:2791 msgid "formatting, string (%)" -msgstr "" +msgstr "μορφοποίηση, string (%)" -#: library/stdtypes.rst:2316 +#: library/stdtypes.rst:2791 msgid "interpolation, string (%)" -msgstr "" +msgstr "παρεμβολή, string (%)" -#: library/stdtypes.rst:2316 +#: library/stdtypes.rst:2791 msgid "formatting, printf" -msgstr "" +msgstr "μορφοποίηση, printf" -#: library/stdtypes.rst:2316 +#: library/stdtypes.rst:2791 msgid "interpolation, printf" -msgstr "" +msgstr "παρεμβολή, printf" -#: library/stdtypes.rst:3532 +#: library/stdtypes.rst:4056 msgid "printf-style formatting" -msgstr "" +msgstr "μορφοποίηση σε στυλ printf" -#: library/stdtypes.rst:3532 +#: library/stdtypes.rst:4056 msgid "sprintf-style formatting" -msgstr "" +msgstr "μορφοποίηση σε στυλ sprintf" -#: library/stdtypes.rst:3564 +#: library/stdtypes.rst:4088 msgid "() (parentheses)" -msgstr "" +msgstr "() (παρενθέσεις)" -#: library/stdtypes.rst:2389 library/stdtypes.rst:3607 +#: library/stdtypes.rst:2871 library/stdtypes.rst:4131 msgid "in printf-style formatting" -msgstr "" +msgstr "σε μορφοποίηση σε στυλ printf" -#: library/stdtypes.rst:3564 +#: library/stdtypes.rst:4088 msgid ". (dot)" -msgstr "" +msgstr ". (τελεία)" -#: library/stdtypes.rst:3607 +#: library/stdtypes.rst:4131 msgid "# (hash)" -msgstr "" +msgstr "# (δίεση)" -#: library/stdtypes.rst:3607 +#: library/stdtypes.rst:4131 msgid "space" -msgstr "" +msgstr "διάστημα" -#: library/stdtypes.rst:2505 +#: library/stdtypes.rst:2987 msgid "binary sequence types" -msgstr "" +msgstr "τύπος δυαδικών ακολουθιών" -#: library/stdtypes.rst:2513 +#: library/stdtypes.rst:2995 msgid "memoryview" -msgstr "" +msgstr "memoryview" -#: library/stdtypes.rst:2513 +#: library/stdtypes.rst:2995 msgid "array" -msgstr "" +msgstr "πίνακας" -#: library/stdtypes.rst:3386 +#: library/stdtypes.rst:3910 msgid "bytes.splitlines method" -msgstr "" +msgstr "bytes.splitlines μέθοδος" -#: library/stdtypes.rst:3386 +#: library/stdtypes.rst:3910 msgid "bytearray.splitlines method" -msgstr "" +msgstr "bytearray.splitlines μέθοδος" -#: library/stdtypes.rst:3532 +#: library/stdtypes.rst:4056 msgid "formatting" -msgstr "" +msgstr "μορφοποίηση" -#: library/stdtypes.rst:3532 +#: library/stdtypes.rst:4056 msgid "bytes (%)" -msgstr "" +msgstr "bytes (%)" -#: library/stdtypes.rst:3532 +#: library/stdtypes.rst:4056 msgid "bytearray (%)" -msgstr "" +msgstr "bytearray (%)" -#: library/stdtypes.rst:3532 +#: library/stdtypes.rst:4056 msgid "interpolation" -msgstr "" +msgstr "μεταβολή" -#: library/stdtypes.rst:4219 +#: library/stdtypes.rst:4763 msgid "set" -msgstr "" +msgstr "set" -#: library/stdtypes.rst:4421 +#: library/stdtypes.rst:4966 msgid "mapping" -msgstr "" +msgstr "αντιστοίχιση" -#: library/stdtypes.rst:4421 +#: library/stdtypes.rst:4966 msgid "dictionary" -msgstr "" +msgstr "λεξικό" -#: library/stdtypes.rst:4504 +#: library/stdtypes.rst:5076 msgid "__missing__()" -msgstr "" +msgstr "__missing__()" -#: library/stdtypes.rst:4814 +#: library/stdtypes.rst:5365 msgid "context manager" -msgstr "" +msgstr "διαχειριστής περιεχομένου" -#: library/stdtypes.rst:4814 +#: library/stdtypes.rst:5365 msgid "context management protocol" -msgstr "" +msgstr "πρωτόκολλο διαχειριστή περιεχομένου" -#: library/stdtypes.rst:4814 +#: library/stdtypes.rst:5365 msgid "context management" -msgstr "" +msgstr "διαχείριση περιεχομένου" -#: library/stdtypes.rst:4887 +#: library/stdtypes.rst:5438 msgid "annotation" -msgstr "" +msgstr "annotation" -#: library/stdtypes.rst:4887 +#: library/stdtypes.rst:5438 msgid "type annotation; type hint" -msgstr "" +msgstr "type annotation; type hint" -#: library/stdtypes.rst:4899 +#: library/stdtypes.rst:5450 msgid "GenericAlias" -msgstr "" +msgstr "GenericAlias" -#: library/stdtypes.rst:4899 +#: library/stdtypes.rst:5450 msgid "Generic" -msgstr "" +msgstr "Generic" -#: library/stdtypes.rst:4899 +#: library/stdtypes.rst:5450 msgid "Alias" -msgstr "" +msgstr "Alias" -#: library/stdtypes.rst:5154 +#: library/stdtypes.rst:5707 msgid "Union" -msgstr "" +msgstr "Ένωση" -#: library/stdtypes.rst:5154 +#: library/stdtypes.rst:5707 msgid "union" -msgstr "" +msgstr "ένωση" -#: library/stdtypes.rst:5324 +#: library/stdtypes.rst:5882 msgid "method" -msgstr "" +msgstr "μέθοδος" -#: library/stdtypes.rst:5368 +#: library/stdtypes.rst:5927 msgid "code" -msgstr "" +msgstr "κώδικας" -#: library/stdtypes.rst:5368 +#: library/stdtypes.rst:5927 msgid "code object" -msgstr "" +msgstr "αντικείμενο κώδικα" -#: library/stdtypes.rst:5375 +#: library/stdtypes.rst:5934 msgid "compile" -msgstr "" +msgstr "compile" -#: library/stdtypes.rst:5375 +#: library/stdtypes.rst:5934 msgid "__code__ (function object attribute)" -msgstr "" +msgstr "__code__ (χαρακτηριστικό αντικείμενου συνάρτησης)" -#: library/stdtypes.rst:5389 +#: library/stdtypes.rst:5948 msgid "exec" -msgstr "" +msgstr "exec" -#: library/stdtypes.rst:5389 +#: library/stdtypes.rst:5948 msgid "eval" -msgstr "" +msgstr "eval" -#: library/stdtypes.rst:5428 +#: library/stdtypes.rst:5987 msgid "..." -msgstr "" +msgstr "..." -#: library/stdtypes.rst:5428 +#: library/stdtypes.rst:5987 msgid "ellipsis literal" -msgstr "" +msgstr "ellipsis literal" + +#~ msgid "``s.index(x[, i[, j]])``" +#~ msgstr "``s.index(x[, i[, j]])``" + +#~ msgid "" +#~ "index of the first occurrence of *x* in *s* (at or after index *i* and " +#~ "before index *j*)" +#~ msgstr "" +#~ "δείκτης της πρώτης εμφάνισης του *x* στο *s* (μετά από τον ή στον δείκτη " +#~ "*i* και πριν από το δείκτη *j*)" + +#~ msgid "``s.count(x)``" +#~ msgstr "``s.count(x)``" + +#~ msgid "" +#~ "``index`` raises :exc:`ValueError` when *x* is not found in *s*. Not all " +#~ "implementations support passing the additional arguments *i* and *j*. " +#~ "These arguments allow efficient searching of subsections of the sequence. " +#~ "Passing the extra arguments is roughly equivalent to using ``s[i:j]." +#~ "index(x)``, only without copying any data and with the returned index " +#~ "being relative to the start of the sequence rather than the start of the " +#~ "slice." +#~ msgstr "" +#~ "Το ``index`` κάνει raise :exc:`ValueError` όταν το *x* δεν βρίσκεται στο " +#~ "*s*. Όχι όλες οι υλοποιήσεις υποστηρίζουν τη διαβίβαση των πρόσθετων " +#~ "ορίων *i* και *j*. Αυτές οι παράμετροι επιτρέπουν την αποτελεσματική " +#~ "αναζήτηση υποτμημάτων της ακολουθίας. Η διαβίβαση των πρόσθετων ορίων " +#~ "είναι περίπου ισοδύναμη με τη χρήση του ``s[i:j].index(x)``, μόνο χωρίς " +#~ "να αντιγράφονται δεδομένα και με τον επιστρεφόμενο δείκτη να είναι " +#~ "σχετικός με την αρχή της ακολουθίας και όχι στην αρχή του υποσυνόλου " +#~ "(slice)." + +#~ msgid "same as ``s[i:j] = []``" +#~ msgstr "ίδιο με το ``s[i:j] = []``" + +#~ msgid "``s.append(x)``" +#~ msgstr "``s.append(x)``" + +#~ msgid "``s.clear()``" +#~ msgstr "``s.clear()``" + +#~ msgid "``s.copy()``" +#~ msgstr "``s.copy()``" + +#~ msgid "``s.extend(t)`` or ``s += t``" +#~ msgstr "``s.extend(t)`` ή ``s += t``" + +#~ msgid "``s.insert(i, x)``" +#~ msgstr "``s.insert(i, x)``" + +#~ msgid "" +#~ "inserts *x* into *s* at the index given by *i* (same as ``s[i:i] = [x]``)" +#~ msgstr "" +#~ "εισάγει το *x* στο *s* στο δείκτη που δίνεται από το *i* (το ίδιο με το " +#~ "``s[i:i] = [x]``)" + +#~ msgid "``s.pop()`` or ``s.pop(i)``" +#~ msgstr "``s.pop()`` ή ``s.pop(i)``" + +#~ msgid "retrieves the item at *i* and also removes it from *s*" +#~ msgstr "ανακτά το στοιχείο στο *i* και το αφαιρεί επίσης από το *s*" + +#~ msgid "``s.remove(x)``" +#~ msgstr "``s.remove(x)``" + +#~ msgid "``s.reverse()``" +#~ msgstr "``s.reverse()``" + +#~ msgid "reverses the items of *s* in place" +#~ msgstr "αντιστρέφει τα στοιχεία του *s*" + +#~ msgid "" +#~ ":meth:`remove` raises :exc:`ValueError` when *x* is not found in *s*." +#~ msgstr "" +#~ "η :meth:`remove` κάνει raise :exc:`ValueError` όταν το *x* δεν βρίσκεται " +#~ "στο *s*." + +#~ msgid "" +#~ ":meth:`clear` and :meth:`!copy` are included for consistency with the " +#~ "interfaces of mutable containers that don't support slicing operations " +#~ "(such as :class:`dict` and :class:`set`). :meth:`!copy` is not part of " +#~ "the :class:`collections.abc.MutableSequence` ABC, but most concrete " +#~ "mutable sequence classes provide it." +#~ msgstr "" +#~ "η :meth:`clear` και η :meth:`!copy` περιλαμβάνονται για λόγους συνέπειας " +#~ "με τα interfaces των μεταβλητών container που δεν υποστηρίζουν " +#~ "λειτουργίες τμηματοποίησης (όπως τα :class:`dict` και :class:`set`). Η :" +#~ "meth:`!copy` δεν αποτελεί μέρος της :class:`collections.abc." +#~ "MutableSequence` ABC, αλλά οι περισσότερες κλάσεις μεταβλητών ακολουθιών " +#~ "την παρέχουν." + +#~ msgid ":meth:`clear` and :meth:`!copy` methods." +#~ msgstr "μέθοδοι :meth:`clear` και :meth:`!copy`." + +#~ msgid "count() (sequence method)" +#~ msgstr "count() (μέθοδος ακολουθίας)" + +#~ msgid "index() (sequence method)" +#~ msgstr "index() (μέθοδος ακολουθίας)" + +#~ msgid "append() (sequence method)" +#~ msgstr "append() (μέθοδος ακολουθίας)" + +#~ msgid "clear() (sequence method)" +#~ msgstr "clear() (μέθοδος ακολουθίας)" + +#~ msgid "copy() (sequence method)" +#~ msgstr "copy() (μέθοδος ακολουθίας)" + +#~ msgid "extend() (sequence method)" +#~ msgstr "extend() (μέθοδος ακολουθίας)" + +#~ msgid "insert() (sequence method)" +#~ msgstr "insert() (μέθοδος ακολουθίας)" + +#~ msgid "remove() (sequence method)" +#~ msgstr "remove() (μέθοδος ακολουθίας)" + +#~ msgid "reverse() (sequence method)" +#~ msgstr "reverse() (μέθοδος ακολουθίας)" + +#~ msgid "" +#~ "To illustrate, the following examples all return a dictionary equal to " +#~ "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" +#~ msgstr "" +#~ "Για επεξήγηση, τα ακόλουθα παραδείγματα επιστρέφουν όλα ένα λεξικό ίσο με " +#~ "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" + +#~ msgid "" +#~ "Return ``True`` if all characters in the string are printable or the " +#~ "string is empty, ``False`` otherwise. Nonprintable characters are those " +#~ "characters defined in the Unicode character database as \"Other\" or " +#~ "\"Separator\", excepting the ASCII space (0x20) which is considered " +#~ "printable. (Note that printable characters in this context are those " +#~ "which should not be escaped when :func:`repr` is invoked on a string. It " +#~ "has no bearing on the handling of strings written to :data:`sys.stdout` " +#~ "or :data:`sys.stderr`.)" +#~ msgstr "" +#~ "Επιστρέφει ``True`` αν όλοι οι χαρακτήρες της συμβολοσειράς (string) " +#~ "είναι εκτυπώσιμοι ή η συμβολοσειρά είναι κενή, διαφορετικά ``False``. Μη " +#~ "εκτυπώσιμοι χαρακτήρες είναι οι χαρακτήρες που ορίζονται στη βάση " +#~ "δεδομένων χαρακτήρων Unicode ως \"Other\" ή \"Separator\", εκτός από το " +#~ "κενό ASCII (0x20) που θεωρείται εκτυπώσιμος. (Σημειώστε ότι εκτυπώσιμοι " +#~ "χαρακτήρες σε αυτό το πλαίσιο είναι εκείνοι που δεν πρέπει να " +#~ "αποφεύγονται όταν η :func:`repr` καλείται σε ένα αλφαριθμητικό. Δεν έχει " +#~ "καμία σχέση με τον χειρισμό των συμβολοσειρών που γράφονται στα :data:" +#~ "`sys.stdout` ή :data:`sys.stderr`)." + +#~ msgid "" +#~ "A dictionary or other mapping object used to store an object's (writable) " +#~ "attributes." +#~ msgstr "" +#~ "Ένα λεξικό ή άλλο αντικείμενο αντιστοίχισης που χρησιμοποιείται για την " +#~ "αποθήκευση των (εγγράψιμων) χαρακτηριστικών ενός αντικειμένου." + +#~ msgid "The class to which a class instance belongs." +#~ msgstr "Η κλάση στην οποία ανήκει ένα στιγμιότυπο κλάσης." + +#~ msgid "The tuple of base classes of a class object." +#~ msgstr "Η πλειάδα (tuple) των βασικών κλάσεων ενός αντικειμένου κλάσης." + +#~ msgid "" +#~ "This attribute is a tuple of classes that are considered when looking for " +#~ "base classes during method resolution." +#~ msgstr "" +#~ "Αυτό το χαρακτηριστικό είναι μια πλειάδα κλάσεων που λαμβάνονται υπόψη " +#~ "κατά την αναζήτηση βασικών κλάσεων κατά την ανάλυση μεθόδου." + +#~ msgid "" +#~ "This method can be overridden by a metaclass to customize the method " +#~ "resolution order for its instances. It is called at class instantiation, " +#~ "and its result is stored in :attr:`~class.__mro__`." +#~ msgstr "" +#~ "Αυτή η μέθοδος μπορεί να παρακαμφθεί από μια μετακλάση για να προσαρμόσει " +#~ "τη σειρά ανάλυσης της μεθόδου για τα στιγμιότυπα της. Καλείται στην " +#~ "εγκατάσταση κλάσης, και το αποτέλεσμα της αποθηκεύεται σε :attr:`~class." +#~ "__mro__`." + +#~ msgid "" +#~ "Each class keeps a list of weak references to its immediate subclasses. " +#~ "This method returns a list of all those references still alive. The list " +#~ "is in definition order. Example::" +#~ msgstr "" +#~ "Κάθε κλάση διατηρεί μια λίστα αδύναμων αναφορών στις άμεσες υποκλάσεις " +#~ "της. Αυτή η μέθοδος επιστρέφει μια λίστα με όλες αυτές τις αναφορές που " +#~ "είναι ακόμα ζωντανές. Η λίστα είναι με τη σειρά ορισμού. Παράδειγμα::" diff --git a/library/string.po b/library/string.po index 96f2c916..68fcbaec 100644 --- a/library/string.po +++ b/library/string.po @@ -8,20 +8,21 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/string.rst:2 -msgid ":mod:`string` --- Common string operations" +msgid ":mod:`!string` --- Common string operations" msgstr "" #: library/string.rst:7 -msgid "**Source code:** :source:`Lib/string.py`" +msgid "**Source code:** :source:`Lib/string/__init__.py`" msgstr "" #: library/string.rst:14 @@ -77,25 +78,32 @@ msgid "" "the ``C`` locale: ``!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~``." msgstr "" -#: library/string.rst:64 +#: library/string.rst:65 msgid "" -"String of ASCII characters which are considered printable. This is a " -"combination of :const:`digits`, :const:`ascii_letters`, :const:" +"String of ASCII characters which are considered printable by Python. This is " +"a combination of :const:`digits`, :const:`ascii_letters`, :const:" "`punctuation`, and :const:`whitespace`." msgstr "" #: library/string.rst:71 msgid "" +"By design, :meth:`string.printable.isprintable() ` returns :" +"const:`False`. In particular, ``string.printable`` is not printable in the " +"POSIX sense (see :manpage:`LC_CTYPE `)." +msgstr "" + +#: library/string.rst:78 +msgid "" "A string containing all ASCII characters that are considered whitespace. " "This includes the characters space, tab, linefeed, return, formfeed, and " "vertical tab." msgstr "" -#: library/string.rst:79 +#: library/string.rst:86 msgid "Custom String Formatting" msgstr "" -#: library/string.rst:81 +#: library/string.rst:88 msgid "" "The built-in string class provides the ability to do complex variable " "substitutions and value formatting via the :meth:`~str.format` method " @@ -105,24 +113,24 @@ msgid "" "method." msgstr "" -#: library/string.rst:90 +#: library/string.rst:97 msgid "The :class:`Formatter` class has the following public methods:" msgstr "" -#: library/string.rst:94 +#: library/string.rst:101 msgid "" "The primary API method. It takes a format string and an arbitrary set of " "positional and keyword arguments. It is just a wrapper that calls :meth:" "`vformat`." msgstr "" -#: library/string.rst:98 +#: library/string.rst:105 msgid "" "A format string argument is now :ref:`positional-only `." msgstr "" -#: library/string.rst:104 +#: library/string.rst:111 msgid "" "This function does the actual work of formatting. It is exposed as a " "separate function for cases where you want to pass in a predefined " @@ -132,13 +140,13 @@ msgid "" "and replacement fields. It calls the various methods described below." msgstr "" -#: library/string.rst:112 +#: library/string.rst:119 msgid "" "In addition, the :class:`Formatter` defines a number of methods that are " "intended to be replaced by subclasses:" msgstr "" -#: library/string.rst:117 +#: library/string.rst:124 msgid "" "Loop over the format_string and return an iterable of tuples " "(*literal_text*, *field_name*, *format_spec*, *conversion*). This is used " @@ -146,27 +154,29 @@ msgid "" "replacement fields." msgstr "" -#: library/string.rst:122 +#: library/string.rst:129 msgid "" "The values in the tuple conceptually represent a span of literal text " "followed by a single replacement field. If there is no literal text (which " "can happen if two replacement fields occur consecutively), then " "*literal_text* will be a zero-length string. If there is no replacement " "field, then the values of *field_name*, *format_spec* and *conversion* will " -"be ``None``." +"be ``None``. The value of *field_name* is unmodified and auto-numbering of " +"non-numbered positional fields is done by :meth:`vformat`." msgstr "" -#: library/string.rst:131 +#: library/string.rst:139 msgid "" -"Given *field_name* as returned by :meth:`parse` (see above), convert it to " -"an object to be formatted. Returns a tuple (obj, used_key). The default " +"Given *field_name*, convert it to an object to be formatted. Auto-numbering " +"of *field_name* returned from :meth:`parse` is done by :meth:`vformat` " +"before calling this method. Returns a tuple (obj, used_key). The default " "version takes strings of the form defined in :pep:`3101`, such as " -"\"0[name]\" or \"label.title\". *args* and *kwargs* are as passed in to :" -"meth:`vformat`. The return value *used_key* has the same meaning as the " +"\"0[name]\" or \"label.title\". *args* and *kwargs* are as passed in to :" +"meth:`vformat`. The return value *used_key* has the same meaning as the " "*key* parameter to :meth:`get_value`." msgstr "" -#: library/string.rst:140 +#: library/string.rst:149 msgid "" "Retrieve a given field value. The *key* argument will be either an integer " "or a string. If it is an integer, it represents the index of the positional " @@ -174,21 +184,21 @@ msgid "" "in *kwargs*." msgstr "" -#: library/string.rst:145 +#: library/string.rst:154 msgid "" "The *args* parameter is set to the list of positional arguments to :meth:" "`vformat`, and the *kwargs* parameter is set to the dictionary of keyword " "arguments." msgstr "" -#: library/string.rst:149 +#: library/string.rst:158 msgid "" "For compound field names, these functions are only called for the first " "component of the field name; subsequent components are handled through " "normal attribute and indexing operations." msgstr "" -#: library/string.rst:153 +#: library/string.rst:162 msgid "" "So for example, the field expression '0.name' would cause :meth:`get_value` " "to be called with a *key* argument of 0. The ``name`` attribute will be " @@ -196,13 +206,13 @@ msgid "" "`getattr` function." msgstr "" -#: library/string.rst:158 +#: library/string.rst:167 msgid "" "If the index or keyword refers to an item that does not exist, then an :exc:" "`IndexError` or :exc:`KeyError` should be raised." msgstr "" -#: library/string.rst:163 +#: library/string.rst:172 msgid "" "Implement checking for unused arguments if desired. The arguments to this " "function is the set of all argument keys that were actually referred to in " @@ -212,34 +222,34 @@ msgid "" "meth:`check_unused_args` is assumed to raise an exception if the check fails." msgstr "" -#: library/string.rst:173 +#: library/string.rst:182 msgid "" ":meth:`format_field` simply calls the global :func:`format` built-in. The " "method is provided so that subclasses can override it." msgstr "" -#: library/string.rst:178 +#: library/string.rst:187 msgid "" "Converts the value (returned by :meth:`get_field`) given a conversion type " "(as in the tuple returned by the :meth:`parse` method). The default version " "understands 's' (str), 'r' (repr) and 'a' (ascii) conversion types." msgstr "" -#: library/string.rst:187 +#: library/string.rst:196 msgid "Format String Syntax" msgstr "" -#: library/string.rst:189 +#: library/string.rst:198 msgid "" "The :meth:`str.format` method and the :class:`Formatter` class share the " "same syntax for format strings (although in the case of :class:`Formatter`, " "subclasses can define their own format string syntax). The syntax is " -"related to that of :ref:`formatted string literals `, but it is " -"less sophisticated and, in particular, does not support arbitrary " -"expressions." +"related to that of :ref:`formatted string literals ` and :ref:" +"`template string literals `, but it is less sophisticated and, in " +"particular, does not support arbitrary expressions in interpolations." msgstr "" -#: library/string.rst:202 +#: library/string.rst:212 msgid "" "Format strings contain \"replacement fields\" surrounded by curly braces ``{}" "``. Anything that is not contained in braces is considered literal text, " @@ -248,11 +258,11 @@ msgid "" "``." msgstr "" -#: library/string.rst:207 +#: library/string.rst:217 msgid "The grammar for a replacement field is as follows:" msgstr "" -#: library/string.rst:219 +#: library/string.rst:229 msgid "" "In less formal terms, the replacement field can start with a *field_name* " "that specifies the object whose value is to be formatted and inserted into " @@ -262,11 +272,11 @@ msgid "" "specify a non-default format for the replacement value." msgstr "" -#: library/string.rst:226 +#: library/string.rst:236 msgid "See also the :ref:`formatspec` section." msgstr "" -#: library/string.rst:228 +#: library/string.rst:238 msgid "" "The *field_name* itself begins with an *arg_name* that is either a number or " "a keyword. If it's a number, it refers to a positional argument, and if " @@ -283,22 +293,35 @@ msgid "" "lookup using :meth:`~object.__getitem__`." msgstr "" -#: library/string.rst:242 +#: library/string.rst:252 msgid "" "The positional argument specifiers can be omitted for :meth:`str.format`, so " "``'{} {}'.format(a, b)`` is equivalent to ``'{0} {1}'.format(a, b)``." msgstr "" -#: library/string.rst:246 +#: library/string.rst:256 msgid "" "The positional argument specifiers can be omitted for :class:`Formatter`." msgstr "" -#: library/string.rst:249 +#: library/string.rst:259 msgid "Some simple format string examples::" msgstr "" -#: library/string.rst:258 +#: library/string.rst:261 +msgid "" +"\"First, thou shalt count to {0}\" # References first positional argument\n" +"\"Bring me a {}\" # Implicitly references the first " +"positional argument\n" +"\"From {} to {}\" # Same as \"From {0} to {1}\"\n" +"\"My quest is {name}\" # References keyword argument 'name'\n" +"\"Weight in tons {0.weight}\" # 'weight' attribute of first positional " +"arg\n" +"\"Units destroyed: {players[0]}\" # First element of keyword argument " +"'players'." +msgstr "" + +#: library/string.rst:270 msgid "" "The *conversion* field causes a type coercion before formatting. Normally, " "the job of formatting a value is done by the :meth:`~object.__format__` " @@ -308,18 +331,25 @@ msgid "" "`~object.__format__`, the normal formatting logic is bypassed." msgstr "" -#: library/string.rst:265 +#: library/string.rst:277 msgid "" "Three conversion flags are currently supported: ``'!s'`` which calls :func:" "`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` which " "calls :func:`ascii`." msgstr "" -#: library/string.rst:269 +#: library/string.rst:281 msgid "Some examples::" msgstr "" -#: library/string.rst:275 +#: library/string.rst:283 +msgid "" +"\"Harold's a clever {0!s}\" # Calls str() on the argument first\n" +"\"Bring out the holy {name!r}\" # Calls repr() on the argument first\n" +"\"More {!a}\" # Calls ascii() on the argument first" +msgstr "" + +#: library/string.rst:287 msgid "" "The *format_spec* field contains a specification of how the value should be " "presented, including such details as field width, alignment, padding, " @@ -327,13 +357,13 @@ msgid "" "\"formatting mini-language\" or interpretation of the *format_spec*." msgstr "" -#: library/string.rst:280 +#: library/string.rst:292 msgid "" "Most built-in types support a common formatting mini-language, which is " "described in the next section." msgstr "" -#: library/string.rst:283 +#: library/string.rst:295 msgid "" "A *format_spec* field can also include nested replacement fields within it. " "These nested replacement fields may contain a field name, conversion flag " @@ -343,42 +373,43 @@ msgid "" "to be dynamically specified." msgstr "" -#: library/string.rst:290 +#: library/string.rst:302 msgid "See the :ref:`formatexamples` section for some examples." msgstr "" -#: library/string.rst:296 +#: library/string.rst:308 msgid "Format Specification Mini-Language" msgstr "" -#: library/string.rst:298 +#: library/string.rst:310 msgid "" "\"Format specifications\" are used within replacement fields contained " "within a format string to define how individual values are presented (see :" -"ref:`formatstrings` and :ref:`f-strings`). They can also be passed directly " -"to the built-in :func:`format` function. Each formattable type may define " -"how the format specification is to be interpreted." +"ref:`formatstrings`, :ref:`f-strings`, and :ref:`t-strings`). They can also " +"be passed directly to the built-in :func:`format` function. Each " +"formattable type may define how the format specification is to be " +"interpreted." msgstr "" -#: library/string.rst:305 +#: library/string.rst:317 msgid "" "Most built-in types implement the following options for format " "specifications, although some of the formatting options are only supported " "by the numeric types." msgstr "" -#: library/string.rst:308 +#: library/string.rst:320 msgid "" "A general convention is that an empty format specification produces the same " "result as if you had called :func:`str` on the value. A non-empty format " "specification typically modifies the result." msgstr "" -#: library/string.rst:312 +#: library/string.rst:324 msgid "The general form of a *standard format specifier* is:" msgstr "" -#: library/string.rst:324 +#: library/string.rst:341 msgid "" "If a valid *align* value is specified, it can be preceded by a *fill* " "character that can be any character and defaults to a space if omitted. It " @@ -389,113 +420,114 @@ msgid "" "the :func:`format` function." msgstr "" -#: library/string.rst:333 +#: library/string.rst:350 msgid "The meaning of the various alignment options is as follows:" msgstr "" -#: library/string.rst:373 +#: library/string.rst:391 library/string.rst:457 msgid "Option" msgstr "" -#: library/string.rst:373 library/string.rst:467 library/string.rst:502 +#: library/string.rst:391 library/string.rst:491 library/string.rst:537 msgid "Meaning" msgstr "" -#: library/string.rst:344 +#: library/string.rst:361 msgid "``'<'``" msgstr "" -#: library/string.rst:344 +#: library/string.rst:361 msgid "" "Forces the field to be left-aligned within the available space (this is the " "default for most objects)." msgstr "" -#: library/string.rst:347 +#: library/string.rst:364 msgid "``'>'``" msgstr "" -#: library/string.rst:347 +#: library/string.rst:364 msgid "" "Forces the field to be right-aligned within the available space (this is the " "default for numbers)." msgstr "" -#: library/string.rst:350 +#: library/string.rst:367 msgid "``'='``" msgstr "" -#: library/string.rst:350 +#: library/string.rst:367 msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " -"alignment option is only valid for numeric types. It becomes the default " -"for numbers when '0' immediately precedes the field width." +"alignment option is only valid for numeric types, excluding :class:" +"`complex`. It becomes the default for numbers when '0' immediately precedes " +"the field width." msgstr "" -#: library/string.rst:356 +#: library/string.rst:374 msgid "``'^'``" msgstr "" -#: library/string.rst:356 +#: library/string.rst:374 msgid "Forces the field to be centered within the available space." msgstr "" -#: library/string.rst:360 +#: library/string.rst:378 msgid "" "Note that unless a minimum field width is defined, the field width will " "always be the same size as the data to fill it, so that the alignment option " "has no meaning in this case." msgstr "" -#: library/string.rst:364 +#: library/string.rst:382 msgid "" "The *sign* option is only valid for number types, and can be one of the " "following:" msgstr "" -#: library/string.rst:375 +#: library/string.rst:393 msgid "``'+'``" msgstr "" -#: library/string.rst:375 +#: library/string.rst:393 msgid "" -"indicates that a sign should be used for both positive as well as negative " +"Indicates that a sign should be used for both positive as well as negative " "numbers." msgstr "" -#: library/string.rst:378 +#: library/string.rst:396 msgid "``'-'``" msgstr "" -#: library/string.rst:378 +#: library/string.rst:396 msgid "" -"indicates that a sign should be used only for negative numbers (this is the " +"Indicates that a sign should be used only for negative numbers (this is the " "default behavior)." msgstr "" -#: library/string.rst:381 +#: library/string.rst:399 msgid "space" msgstr "" -#: library/string.rst:381 +#: library/string.rst:399 msgid "" -"indicates that a leading space should be used on positive numbers, and a " +"Indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." msgstr "" -#: library/string.rst:388 +#: library/string.rst:406 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -#: library/string.rst:392 +#: library/string.rst:410 msgid "Added the ``'z'`` option (see also :pep:`682`)." msgstr "" -#: library/string.rst:397 +#: library/string.rst:415 msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " @@ -509,51 +541,28 @@ msgid "" "and ``'G'`` conversions, trailing zeros are not removed from the result." msgstr "" -#: library/string.rst:411 -msgid "" -"The ``','`` option signals the use of a comma for a thousands separator. For " -"a locale aware separator, use the ``'n'`` integer presentation type instead." -msgstr "" - -#: library/string.rst:415 -msgid "Added the ``','`` option (see also :pep:`378`)." -msgstr "" - -#: library/string.rst:420 -msgid "" -"The ``'_'`` option signals the use of an underscore for a thousands " -"separator for floating point presentation types and for integer presentation " -"type ``'d'``. For integer presentation types ``'b'``, ``'o'``, ``'x'``, and " -"``'X'``, underscores will be inserted every 4 digits. For other " -"presentation types, specifying this option is an error." -msgstr "" - #: library/string.rst:427 -msgid "Added the ``'_'`` option (see also :pep:`515`)." -msgstr "" - -#: library/string.rst:430 msgid "" -"*width* is a decimal integer defining the minimum total field width, " +"The *width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " "specified, then the field width will be determined by the content." msgstr "" -#: library/string.rst:434 +#: library/string.rst:431 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " -"(``'0'``) character enables sign-aware zero-padding for numeric types. This " -"is equivalent to a *fill* character of ``'0'`` with an *alignment* type of " -"``'='``." +"(``'0'``) character enables sign-aware zero-padding for numeric types, " +"excluding :class:`complex`. This is equivalent to a *fill* character of " +"``'0'`` with an *alignment* type of ``'='``." msgstr "" -#: library/string.rst:439 +#: library/string.rst:436 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "" -#: library/string.rst:443 +#: library/string.rst:440 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -564,126 +573,174 @@ msgid "" "types." msgstr "" -#: library/string.rst:451 +#: library/string.rst:448 +msgid "" +"The *grouping* option after *width* and *precision* fields specifies a digit " +"group separator for the integral and fractional parts of a number " +"respectively. It can be one of the following:" +msgstr "" + +#: library/string.rst:459 +msgid "``','``" +msgstr "" + +#: library/string.rst:459 +msgid "" +"Inserts a comma every 3 digits for integer presentation type ``'d'`` and " +"floating-point presentation types, excluding ``'n'``. For other presentation " +"types, this option is not supported." +msgstr "" + +#: library/string.rst:465 +msgid "``'_'``" +msgstr "" + +#: library/string.rst:465 +msgid "" +"Inserts an underscore every 3 digits for integer presentation type ``'d'`` " +"and floating-point presentation types, excluding ``'n'``. For integer " +"presentation types ``'b'``, ``'o'``, ``'x'``, and ``'X'``, underscores are " +"inserted every 4 digits. For other presentation types, this option is not " +"supported." +msgstr "" + +#: library/string.rst:475 +msgid "" +"For a locale aware separator, use the ``'n'`` presentation type instead." +msgstr "" + +#: library/string.rst:477 +msgid "Added the ``','`` option (see also :pep:`378`)." +msgstr "" + +#: library/string.rst:480 +msgid "Added the ``'_'`` option (see also :pep:`515`)." +msgstr "" + +#: library/string.rst:483 +msgid "Support the *grouping* option for the fractional part." +msgstr "" + +#: library/string.rst:486 msgid "Finally, the *type* determines how the data should be presented." msgstr "" -#: library/string.rst:453 +#: library/string.rst:488 msgid "The available string presentation types are:" msgstr "" -#: library/string.rst:467 library/string.rst:502 +#: library/string.rst:502 library/string.rst:537 msgid "Type" msgstr "" -#: library/string.rst:458 +#: library/string.rst:493 msgid "``'s'``" msgstr "" -#: library/string.rst:458 +#: library/string.rst:493 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: library/string.rst:490 library/string.rst:577 +#: library/string.rst:525 library/string.rst:611 msgid "None" msgstr "" -#: library/string.rst:461 +#: library/string.rst:496 msgid "The same as ``'s'``." msgstr "" -#: library/string.rst:464 +#: library/string.rst:499 msgid "The available integer presentation types are:" msgstr "" -#: library/string.rst:469 +#: library/string.rst:504 msgid "``'b'``" msgstr "" -#: library/string.rst:469 +#: library/string.rst:504 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: library/string.rst:471 +#: library/string.rst:506 msgid "``'c'``" msgstr "" -#: library/string.rst:471 +#: library/string.rst:506 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: library/string.rst:474 +#: library/string.rst:509 msgid "``'d'``" msgstr "" -#: library/string.rst:474 +#: library/string.rst:509 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: library/string.rst:476 +#: library/string.rst:511 msgid "``'o'``" msgstr "" -#: library/string.rst:476 +#: library/string.rst:511 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: library/string.rst:478 +#: library/string.rst:513 msgid "``'x'``" msgstr "" -#: library/string.rst:478 +#: library/string.rst:513 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "" -#: library/string.rst:481 +#: library/string.rst:516 msgid "``'X'``" msgstr "" -#: library/string.rst:481 +#: library/string.rst:516 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " "upper-cased to ``'0X'`` as well." msgstr "" -#: library/string.rst:570 +#: library/string.rst:603 msgid "``'n'``" msgstr "" -#: library/string.rst:486 +#: library/string.rst:521 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " -"setting to insert the appropriate number separator characters." +"setting to insert the appropriate digit group separators." msgstr "" -#: library/string.rst:490 +#: library/string.rst:525 msgid "The same as ``'d'``." msgstr "" -#: library/string.rst:493 +#: library/string.rst:528 msgid "" "In addition to the above presentation types, integers can be formatted with " -"the floating point presentation types listed below (except ``'n'`` and " +"the floating-point presentation types listed below (except ``'n'`` and " "``None``). When doing so, :func:`float` is used to convert the integer to a " -"floating point number before formatting." +"floating-point number before formatting." msgstr "" -#: library/string.rst:498 +#: library/string.rst:533 msgid "" "The available presentation types for :class:`float` and :class:`~decimal." "Decimal` values are:" msgstr "" -#: library/string.rst:504 +#: library/string.rst:539 msgid "``'e'``" msgstr "" -#: library/string.rst:504 +#: library/string.rst:539 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -691,50 +748,49 @@ msgid "" "decimal point, for a total of ``p + 1`` significant digits. With no " "precision given, uses a precision of ``6`` digits after the decimal point " "for :class:`float`, and shows all coefficient digits for :class:`~decimal." -"Decimal`. If no digits follow the decimal point, the decimal point is also " -"removed unless the ``#`` option is used." +"Decimal`. If ``p=0``, the decimal point is omitted unless the ``#`` option " +"is used." msgstr "" -#: library/string.rst:516 +#: library/string.rst:550 msgid "``'E'``" msgstr "" -#: library/string.rst:516 +#: library/string.rst:550 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: library/string.rst:519 +#: library/string.rst:553 msgid "``'f'``" msgstr "" -#: library/string.rst:519 +#: library/string.rst:553 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " "no precision given, uses a precision of ``6`` digits after the decimal point " "for :class:`float`, and uses a precision large enough to show all " -"coefficient digits for :class:`~decimal.Decimal`. If no digits follow the " -"decimal point, the decimal point is also removed unless the ``#`` option is " -"used." +"coefficient digits for :class:`~decimal.Decimal`. If ``p=0``, the decimal " +"point is omitted unless the ``#`` option is used." msgstr "" -#: library/string.rst:529 +#: library/string.rst:562 msgid "``'F'``" msgstr "" -#: library/string.rst:529 +#: library/string.rst:562 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: library/string.rst:532 +#: library/string.rst:565 msgid "``'g'``" msgstr "" -#: library/string.rst:532 +#: library/string.rst:565 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -742,7 +798,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: library/string.rst:539 +#: library/string.rst:572 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -755,7 +811,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: library/string.rst:552 +#: library/string.rst:585 msgid "" "With no precision given, uses a precision of ``6`` significant digits for :" "class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " @@ -765,137 +821,328 @@ msgid "" "notation is used otherwise." msgstr "" -#: library/string.rst:561 +#: library/string.rst:594 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: library/string.rst:566 +#: library/string.rst:599 msgid "``'G'``" msgstr "" -#: library/string.rst:566 +#: library/string.rst:599 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: library/string.rst:570 +#: library/string.rst:603 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " -"setting to insert the appropriate number separator characters." +"setting to insert the appropriate digit group separators for the integral " +"part of a number." msgstr "" -#: library/string.rst:574 +#: library/string.rst:608 msgid "``'%'``" msgstr "" -#: library/string.rst:574 +#: library/string.rst:608 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: library/string.rst:577 +#: library/string.rst:611 msgid "" -"For :class:`float` this is the same as ``'g'``, except that when fixed-point " -"notation is used to format the result, it always includes at least one digit " -"past the decimal point. The precision used is as large as needed to " -"represent the given value faithfully." +"For :class:`float` this is like the ``'g'`` type, except that when fixed-" +"point notation is used to format the result, it always includes at least one " +"digit past the decimal point, and switches to the scientific notation when " +"``exp >= p - 1``. When the precision is not specified, the latter will be " +"as large as needed to represent the given value faithfully." msgstr "" -#: library/string.rst:583 +#: library/string.rst:619 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: library/string.rst:587 +#: library/string.rst:623 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: library/string.rst:595 +#: library/string.rst:627 +msgid "" +"The result should be correctly rounded to a given precision ``p`` of digits " +"after the decimal point. The rounding mode for :class:`float` matches that " +"of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding " +"mode of the current :ref:`context ` will be used." +msgstr "" + +#: library/string.rst:632 +msgid "" +"The available presentation types for :class:`complex` are the same as those " +"for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " +"components of a complex number are formatted as floating-point numbers, " +"according to the specified presentation type. They are separated by the " +"mandatory sign of the imaginary part, the latter being terminated by a ``j`` " +"suffix. If the presentation type is missing, the result will match the " +"output of :func:`str` (complex numbers with a non-zero real part are also " +"surrounded by parentheses), possibly altered by other format modifiers." +msgstr "" + +#: library/string.rst:645 msgid "Format examples" msgstr "" -#: library/string.rst:597 +#: library/string.rst:647 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "" -#: library/string.rst:600 +#: library/string.rst:650 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " "example, ``'%03.2f'`` can be translated to ``'{:03.2f}'``." msgstr "" -#: library/string.rst:604 +#: library/string.rst:654 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "" -#: library/string.rst:607 +#: library/string.rst:657 msgid "Accessing arguments by position::" msgstr "" -#: library/string.rst:620 +#: library/string.rst:659 +msgid "" +">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" +"'a, b, c'\n" +">>> '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only\n" +"'a, b, c'\n" +">>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n" +"'c, b, a'\n" +">>> '{2}, {1}, {0}'.format(*'abc') # unpacking argument sequence\n" +"'c, b, a'\n" +">>> '{0}{1}{0}'.format('abra', 'cad') # arguments' indices can be " +"repeated\n" +"'abracadabra'" +msgstr "" + +#: library/string.rst:670 msgid "Accessing arguments by name::" msgstr "" -#: library/string.rst:628 +#: library/string.rst:672 +msgid "" +">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " +"longitude='-115.81W')\n" +"'Coordinates: 37.24N, -115.81W'\n" +">>> coord = {'latitude': '37.24N', 'longitude': '-115.81W'}\n" +">>> 'Coordinates: {latitude}, {longitude}'.format(**coord)\n" +"'Coordinates: 37.24N, -115.81W'" +msgstr "" + +#: library/string.rst:678 msgid "Accessing arguments' attributes::" msgstr "" -#: library/string.rst:643 +#: library/string.rst:680 +msgid "" +">>> c = 3-5j\n" +">>> ('The complex number {0} is formed from the real part {0.real} '\n" +"... 'and the imaginary part {0.imag}.').format(c)\n" +"'The complex number (3-5j) is formed from the real part 3.0 and the " +"imaginary part -5.0.'\n" +">>> class Point:\n" +"... def __init__(self, x, y):\n" +"... self.x, self.y = x, y\n" +"... def __str__(self):\n" +"... return 'Point({self.x}, {self.y})'.format(self=self)\n" +"...\n" +">>> str(Point(4, 2))\n" +"'Point(4, 2)'" +msgstr "" + +#: library/string.rst:693 msgid "Accessing arguments' items::" msgstr "" -#: library/string.rst:649 +#: library/string.rst:695 +msgid "" +">>> coord = (3, 5)\n" +">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" +"'X: 3; Y: 5'" +msgstr "" + +#: library/string.rst:699 msgid "Replacing ``%s`` and ``%r``::" msgstr "" -#: library/string.rst:654 +#: library/string.rst:701 +msgid "" +">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " +"'test2')\n" +"\"repr() shows quotes: 'test1'; str() doesn't: test2\"" +msgstr "" + +#: library/string.rst:704 msgid "Aligning the text and specifying a width::" msgstr "" -#: library/string.rst:665 +#: library/string.rst:706 +msgid "" +">>> '{:<30}'.format('left aligned')\n" +"'left aligned '\n" +">>> '{:>30}'.format('right aligned')\n" +"' right aligned'\n" +">>> '{:^30}'.format('centered')\n" +"' centered '\n" +">>> '{:*^30}'.format('centered') # use '*' as a fill char\n" +"'***********centered***********'" +msgstr "" + +#: library/string.rst:715 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "" -#: library/string.rst:674 +#: library/string.rst:717 +msgid "" +">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" +"'+3.140000; -3.140000'\n" +">>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers\n" +"' 3.140000; -3.140000'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:" +"f}; {:f}'\n" +"'3.140000; -3.140000'" +msgstr "" + +#: library/string.rst:724 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "" -#: library/string.rst:683 -msgid "Using the comma as a thousands separator::" +#: library/string.rst:726 +msgid "" +">>> # format also supports binary numbers\n" +">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" +"'int: 42; hex: 2a; oct: 52; bin: 101010'\n" +">>> # with 0x, 0o, or 0b as prefix:\n" +">>> \"int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}\".format(42)\n" +"'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" +msgstr "" + +#: library/string.rst:733 +msgid "Using the comma or the underscore as a digit group separator::" msgstr "" -#: library/string.rst:688 +#: library/string.rst:735 +msgid "" +">>> '{:,}'.format(1234567890)\n" +"'1,234,567,890'\n" +">>> '{:_}'.format(1234567890)\n" +"'1_234_567_890'\n" +">>> '{:_b}'.format(1234567890)\n" +"'100_1001_1001_0110_0000_0010_1101_0010'\n" +">>> '{:_x}'.format(1234567890)\n" +"'4996_02d2'\n" +">>> '{:_}'.format(123456789.123456789)\n" +"'123_456_789.12345679'\n" +">>> '{:.,}'.format(123456789.123456789)\n" +"'123456789.123,456,79'\n" +">>> '{:,._}'.format(123456789.123456789)\n" +"'123,456,789.123_456_79'" +msgstr "" + +#: library/string.rst:750 msgid "Expressing a percentage::" msgstr "" -#: library/string.rst:695 +#: library/string.rst:752 +msgid "" +">>> points = 19\n" +">>> total = 22\n" +">>> 'Correct answers: {:.2%}'.format(points/total)\n" +"'Correct answers: 86.36%'" +msgstr "" + +#: library/string.rst:757 msgid "Using type-specific formatting::" msgstr "" -#: library/string.rst:702 +#: library/string.rst:759 +msgid "" +">>> import datetime\n" +">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" +">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" +"'2010-07-04 12:15:58'" +msgstr "" + +#: library/string.rst:764 msgid "Nesting arguments and more complex examples::" msgstr "" -#: library/string.rst:736 -msgid "Template strings" +#: library/string.rst:766 +msgid "" +">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" +"... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" +"...\n" +"'left<<<<<<<<<<<<'\n" +"'^^^^^center^^^^^'\n" +"'>>>>>>>>>>>right'\n" +">>>\n" +">>> octets = [192, 168, 0, 1]\n" +">>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\n" +"'C0A80001'\n" +">>> int(_, 16)\n" +"3232235521\n" +">>>\n" +">>> width = 5\n" +">>> for num in range(5,12):\n" +"... for base in 'dXob':\n" +"... print('{0:{width}{base}}'.format(num, base=base, width=width), " +"end=' ')\n" +"... print()\n" +"...\n" +" 5 5 5 101\n" +" 6 6 6 110\n" +" 7 7 7 111\n" +" 8 8 10 1000\n" +" 9 9 11 1001\n" +" 10 A 12 1010\n" +" 11 B 13 1011" +msgstr "" + +#: library/string.rst:798 +msgid "Template strings ($-strings)" +msgstr "" + +#: library/string.rst:802 +msgid "" +"The feature described here was introduced in Python 2.4; a simple templating " +"method based upon regular expressions. It predates :meth:`str.format`, :ref:" +"`formatted string literals `, and :ref:`template string literals " +"`." msgstr "" -#: library/string.rst:738 +#: library/string.rst:807 +msgid "" +"It is unrelated to template string literals (t-strings), which were " +"introduced in Python 3.14. These evaluate to :class:`string.templatelib." +"Template` objects, found in the :mod:`string.templatelib` module." +msgstr "" + +#: library/string.rst:812 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -905,17 +1152,17 @@ msgid "" "the `flufl.i18n `_ package." msgstr "" -#: library/string.rst:748 +#: library/string.rst:822 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: library/string.rst:750 +#: library/string.rst:824 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: library/string.rst:752 +#: library/string.rst:826 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -925,30 +1172,30 @@ msgid "" "specification." msgstr "" -#: library/string.rst:759 +#: library/string.rst:833 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: library/string.rst:763 +#: library/string.rst:837 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: library/string.rst:766 +#: library/string.rst:840 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: library/string.rst:772 +#: library/string.rst:846 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: library/string.rst:777 +#: library/string.rst:851 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -957,7 +1204,7 @@ msgid "" "there are duplicates, the placeholders from *kwds* take precedence." msgstr "" -#: library/string.rst:786 +#: library/string.rst:860 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -966,7 +1213,7 @@ msgid "" "simply return ``$`` instead of raising :exc:`ValueError`." msgstr "" -#: library/string.rst:792 +#: library/string.rst:866 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -976,33 +1223,52 @@ msgid "" "Python identifiers." msgstr "" -#: library/string.rst:802 +#: library/string.rst:876 msgid "" -"Returns false if the template has invalid placeholders that will cause :meth:" -"`substitute` to raise :exc:`ValueError`." +"Returns ``False`` if the template has invalid placeholders that will cause :" +"meth:`substitute` to raise :exc:`ValueError`." msgstr "" -#: library/string.rst:810 +#: library/string.rst:884 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" -#: library/string.rst:815 +#: library/string.rst:889 msgid ":class:`Template` instances also provide one public data attribute:" msgstr "" -#: library/string.rst:819 +#: library/string.rst:893 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." msgstr "" -#: library/string.rst:822 +#: library/string.rst:896 msgid "Here is an example of how to use a Template::" msgstr "" -#: library/string.rst:840 +#: library/string.rst:898 +msgid "" +">>> from string import Template\n" +">>> s = Template('$who likes $what')\n" +">>> s.substitute(who='tim', what='kung pao')\n" +"'tim likes kung pao'\n" +">>> d = dict(who='tim')\n" +">>> Template('Give $who $100').substitute(d)\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Invalid placeholder in string: line 1, col 11\n" +">>> Template('$who likes $what').substitute(d)\n" +"Traceback (most recent call last):\n" +"...\n" +"KeyError: 'what'\n" +">>> Template('$who likes $what').safe_substitute(d)\n" +"'tim likes $what'" +msgstr "" + +#: library/string.rst:914 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1010,7 +1276,7 @@ msgid "" "these class attributes:" msgstr "" -#: library/string.rst:845 +#: library/string.rst:919 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1020,7 +1286,7 @@ msgid "" "the subclass's class namespace)." msgstr "" -#: library/string.rst:852 +#: library/string.rst:926 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1028,19 +1294,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: library/string.rst:859 +#: library/string.rst:933 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: library/string.rst:863 +#: library/string.rst:937 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: library/string.rst:867 +#: library/string.rst:941 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1049,7 +1315,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: library/string.rst:875 +#: library/string.rst:949 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1058,7 +1324,7 @@ msgid "" "regular expressions." msgstr "" -#: library/string.rst:883 +#: library/string.rst:957 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1067,41 +1333,41 @@ msgid "" "placeholder rule:" msgstr "" -#: library/string.rst:889 +#: library/string.rst:963 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "" -#: library/string.rst:892 +#: library/string.rst:966 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." msgstr "" -#: library/string.rst:895 +#: library/string.rst:969 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." msgstr "" -#: library/string.rst:898 +#: library/string.rst:972 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." msgstr "" -#: library/string.rst:901 +#: library/string.rst:975 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." msgstr "" -#: library/string.rst:906 +#: library/string.rst:980 msgid "Helper functions" msgstr "" -#: library/string.rst:910 +#: library/string.rst:984 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1111,75 +1377,74 @@ msgid "" "the words." msgstr "" -#: library/string.rst:195 +#: library/string.rst:205 msgid "{} (curly brackets)" msgstr "" -#: library/string.rst:335 library/string.rst:386 library/string.rst:409 -#: library/string.rst:418 +#: library/string.rst:352 library/string.rst:404 library/string.rst:452 msgid "in string formatting" msgstr "" -#: library/string.rst:195 +#: library/string.rst:205 msgid ". (dot)" msgstr "" -#: library/string.rst:195 +#: library/string.rst:205 msgid "[] (square brackets)" msgstr "" -#: library/string.rst:195 +#: library/string.rst:205 msgid "! (exclamation)" msgstr "" -#: library/string.rst:195 +#: library/string.rst:205 msgid ": (colon)" msgstr "" -#: library/string.rst:335 +#: library/string.rst:352 msgid "< (less)" msgstr "" -#: library/string.rst:335 +#: library/string.rst:352 msgid "> (greater)" msgstr "" -#: library/string.rst:335 +#: library/string.rst:352 msgid "= (equals)" msgstr "" -#: library/string.rst:335 +#: library/string.rst:352 msgid "^ (caret)" msgstr "" -#: library/string.rst:367 +#: library/string.rst:385 msgid "+ (plus)" msgstr "" -#: library/string.rst:367 +#: library/string.rst:385 msgid "- (minus)" msgstr "" -#: library/string.rst:386 +#: library/string.rst:404 msgid "z" msgstr "" -#: library/string.rst:395 +#: library/string.rst:413 msgid "# (hash)" msgstr "" -#: library/string.rst:409 +#: library/string.rst:452 msgid ", (comma)" msgstr "" -#: library/string.rst:418 +#: library/string.rst:452 msgid "_ (underscore)" msgstr "" -#: library/string.rst:746 +#: library/string.rst:820 msgid "$ (dollar)" msgstr "" -#: library/string.rst:746 +#: library/string.rst:820 msgid "in template strings" msgstr "" diff --git a/library/string.templatelib.po b/library/string.templatelib.po new file mode 100644 index 00000000..2db42c45 --- /dev/null +++ b/library/string.templatelib.po @@ -0,0 +1,324 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: library/string.templatelib.rst:2 +msgid ":mod:`!string.templatelib` --- Support for template string literals" +msgstr "" + +#: library/string.templatelib.rst:7 +msgid "**Source code:** :source:`Lib/string/templatelib.py`" +msgstr "" + +#: library/string.templatelib.rst:13 +msgid ":ref:`Format strings `" +msgstr "" + +#: library/string.templatelib.rst:14 +msgid ":ref:`Template string literal (t-string) syntax `" +msgstr "" + +#: library/string.templatelib.rst:15 +msgid ":pep:`750`" +msgstr "" + +#: library/string.templatelib.rst:20 +msgid "Template strings" +msgstr "" + +#: library/string.templatelib.rst:24 +msgid "" +"Template strings are a mechanism for custom string processing. They have the " +"full flexibility of Python's :ref:`f-strings`, but return a :class:" +"`Template` instance that gives access to the static and interpolated (in " +"curly brackets) parts of a string *before* they are combined." +msgstr "" + +#: library/string.templatelib.rst:30 +msgid "" +"To write a t-string, use a ``'t'`` prefix instead of an ``'f'``, like so:" +msgstr "" + +#: library/string.templatelib.rst:32 +msgid "" +">>> pi = 3.14\n" +">>> t't-strings are new in Python {pi!s}!'\n" +"Template(\n" +" strings=('t-strings are new in Python ', '!'),\n" +" interpolations=(Interpolation(3.14, 'pi', 's', ''),)\n" +")" +msgstr "" + +#: library/string.templatelib.rst:42 +msgid "Types" +msgstr "" + +#: library/string.templatelib.rst:46 +msgid "" +"The :class:`!Template` class describes the contents of a template string. It " +"is immutable, meaning that attributes of a template cannot be reassigned." +msgstr "" + +#: library/string.templatelib.rst:49 +msgid "" +"The most common way to create a :class:`!Template` instance is to use the :" +"ref:`template string literal syntax `. This syntax is identical " +"to that of :ref:`f-strings `, except that it uses a ``t`` prefix " +"in place of an ``f``:" +msgstr "" + +#: library/string.templatelib.rst:59 +msgid "" +"Templates are stored as sequences of literal :attr:`~Template.strings` and " +"dynamic :attr:`~Template.interpolations`. A :attr:`~Template.values` " +"attribute holds the values of the interpolations:" +msgstr "" + +#: library/string.templatelib.rst:72 +msgid "" +"The :attr:`!strings` tuple has one more element than :attr:`!interpolations` " +"and :attr:`!values`; the interpolations “belong” between the strings. This " +"may be easier to understand when tuples are aligned" +msgstr "" + +#: library/string.templatelib.rst:76 +msgid "" +"template.strings: ('Ah! We do have ', '.')\n" +"template.values: ( 'Camembert', )" +msgstr "" + +#: library/string.templatelib.rst:82 library/string.templatelib.rst:249 +msgid "Attributes" +msgstr "" + +#: library/string.templatelib.rst:86 +msgid "A :class:`tuple` of the static strings in the template." +msgstr "" + +#: library/string.templatelib.rst:93 +msgid "Empty strings *are* included in the tuple:" +msgstr "" + +#: library/string.templatelib.rst:101 +msgid "" +"The ``strings`` tuple is never empty, and always contains one more string " +"than the ``interpolations`` and ``values`` tuples:" +msgstr "" + +#: library/string.templatelib.rst:116 +msgid "A :class:`tuple` of the interpolations in the template." +msgstr "" + +#: library/string.templatelib.rst:123 +msgid "" +"The ``interpolations`` tuple may be empty and always contains one fewer " +"values than the ``strings`` tuple:" +msgstr "" + +#: library/string.templatelib.rst:132 +msgid "A tuple of all interpolated values in the template." +msgstr "" + +#: library/string.templatelib.rst:139 +msgid "" +"The ``values`` tuple always has the same length as the ``interpolations`` " +"tuple. It is always equivalent to ``tuple(i.value for i in template." +"interpolations)``." +msgstr "" + +#: library/string.templatelib.rst:144 library/string.templatelib.rst:317 +msgid "Methods" +msgstr "" + +#: library/string.templatelib.rst:147 +msgid "" +"While literal syntax is the most common way to create a :class:`!Template`, " +"it is also possible to create them directly using the constructor:" +msgstr "" + +#: library/string.templatelib.rst:158 +msgid "" +"If multiple strings are passed consecutively, they will be concatenated into " +"a single value in the :attr:`~Template.strings` attribute. For example, the " +"following code creates a :class:`Template` with a single final string:" +msgstr "" + +#: library/string.templatelib.rst:167 +msgid "" +"If multiple interpolations are passed consecutively, they will be treated as " +"separate interpolations and an empty string will be inserted between them. " +"For example, the following code creates a template with empty placeholders " +"in the :attr:`~Template.strings` attribute:" +msgstr "" + +#: library/string.templatelib.rst:182 +msgid "" +"Iterate over the template, yielding each non-empty string and :class:" +"`Interpolation` in the correct order:" +msgstr "" + +#: library/string.templatelib.rst:191 +msgid "Empty strings are **not** included in the iteration:" +msgstr "" + +#: library/string.templatelib.rst:204 +msgid "" +"Concatenate this template with another, returning a new :class:`!Template` " +"instance:" +msgstr "" + +#: library/string.templatelib.rst:211 +msgid "" +"Concatenating a :class:`!Template` and a ``str`` is **not** supported. This " +"is because it is unclear whether the string should be treated as a static " +"string or an interpolation. If you want to concatenate a :class:`!Template` " +"with a string, you should either wrap the string directly in a :class:`!" +"Template` (to treat it as a static string) or use an :class:`!Interpolation` " +"(to treat it as dynamic):" +msgstr "" + +#: library/string.templatelib.rst:232 +msgid "" +"The :class:`!Interpolation` type represents an expression inside a template " +"string. It is immutable, meaning that attributes of an interpolation cannot " +"be reassigned." +msgstr "" + +#: library/string.templatelib.rst:235 +msgid "" +"Interpolations support pattern matching, allowing you to match against their " +"attributes with the :ref:`match statement `:" +msgstr "" + +#: library/string.templatelib.rst:253 +msgid "The evaluated value of the interpolation." +msgstr "" + +#: library/string.templatelib.rst:261 +msgid "" +"For interpolations created by t-string literals, :attr:`!expression` is the " +"expression text found inside the curly brackets (``{`` & ``}``), including " +"any whitespace, excluding the curly brackets themselves, and ending before " +"the first ``!``, ``:``, or ``=`` if any is present. For manually created " +"interpolations, :attr:`!expression` is the arbitrary string provided when " +"constructing the interpolation instance." +msgstr "" + +#: library/string.templatelib.rst:268 +msgid "" +"We recommend using valid Python expressions or the empty string for the " +"``expression`` field of manually created :class:`!Interpolation` instances, " +"although this is not enforced at runtime." +msgstr "" + +#: library/string.templatelib.rst:278 +msgid "The conversion to apply to the value, or ``None``." +msgstr "" + +#: library/string.templatelib.rst:280 +msgid "" +"The :attr:`!conversion` is the optional conversion to apply to the value:" +msgstr "" + +#: library/string.templatelib.rst:288 +msgid "" +"Unlike f-strings, where conversions are applied automatically, the expected " +"behavior with t-strings is that code that *processes* the :class:`!Template` " +"will decide how to interpret and whether to apply the :attr:`!conversion`. " +"For convenience, the :func:`convert` function can be used to mimic f-string " +"conversion semantics." +msgstr "" + +#: library/string.templatelib.rst:298 +msgid "The format specification to apply to the value." +msgstr "" + +#: library/string.templatelib.rst:300 +msgid "" +"The :attr:`!format_spec` is an optional, arbitrary string used as the format " +"specification to present the value:" +msgstr "" + +#: library/string.templatelib.rst:308 +msgid "" +"Unlike f-strings, where format specifications are applied automatically via " +"the :func:`format` protocol, the expected behavior with t-strings is that " +"code that *processes* the interpolation will decide how to interpret and " +"whether to apply the format specification. As a result, :attr:`!format_spec` " +"values in interpolations can be arbitrary strings, including those that do " +"not conform to the :func:`format` protocol." +msgstr "" + +#: library/string.templatelib.rst:323 +msgid "Create a new :class:`!Interpolation` object from component parts." +msgstr "" + +#: library/string.templatelib.rst:0 +msgid "Parameters" +msgstr "" + +#: library/string.templatelib.rst:325 +msgid "The evaluated, in-scope result of the interpolation." +msgstr "" + +#: library/string.templatelib.rst:326 +msgid "The text of a valid Python expression, or an empty string." +msgstr "" + +#: library/string.templatelib.rst:328 +msgid "" +"The :ref:`conversion ` to be used, one of ``None``, ``'a'``, " +"``'r'``, or ``'s'``." +msgstr "" + +#: library/string.templatelib.rst:330 +msgid "" +"An optional, arbitrary string used as the :ref:`format specification " +"` to present the value." +msgstr "" + +#: library/string.templatelib.rst:335 +msgid "Helper functions" +msgstr "" + +#: library/string.templatelib.rst:339 +msgid "" +"Applies formatted string literal :ref:`conversion ` semantics to the given object *obj*. This is frequently useful " +"for custom template string processing logic." +msgstr "" + +#: library/string.templatelib.rst:343 +msgid "Three conversion flags are currently supported:" +msgstr "" + +#: library/string.templatelib.rst:345 +msgid "``'s'`` which calls :func:`str` on the value (like ``!s``)," +msgstr "" + +#: library/string.templatelib.rst:346 +msgid "``'r'`` which calls :func:`repr` (like ``!r``), and" +msgstr "" + +#: library/string.templatelib.rst:347 +msgid "``'a'`` which calls :func:`ascii` (like ``!a``)." +msgstr "" + +#: library/string.templatelib.rst:349 +msgid "If the conversion flag is ``None``, *obj* is returned unchanged." +msgstr "" diff --git a/library/stringprep.po b/library/stringprep.po index f0469669..05821e34 100644 --- a/library/stringprep.po +++ b/library/stringprep.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/stringprep.rst:2 -msgid ":mod:`stringprep` --- Internet String Preparation" +msgid ":mod:`!stringprep` --- Internet String Preparation" msgstr "" #: library/stringprep.rst:10 diff --git a/library/struct.po b/library/struct.po index 0303e071..c424a0bd 100644 --- a/library/struct.po +++ b/library/struct.po @@ -8,23 +8,24 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-10 22:42+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/struct.rst:2 -msgid ":mod:`struct` --- Interpret bytes as packed binary data" -msgstr "" +msgid ":mod:`!struct` --- Interpret bytes as packed binary data" +msgstr ":mod:`!struct` --- Ερμηνεία bytes ως πακετοποιημένα δυαδικά δεδομένα" -#: library/struct.rst:7 +#: library/struct.rst:11 msgid "**Source code:** :source:`Lib/struct.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/struct.py`" -#: library/struct.rst:15 +#: library/struct.rst:19 msgid "" "This module converts between Python values and C structs represented as " "Python :class:`bytes` objects. Compact :ref:`format strings ` περιγράφουν τις προβλεπόμενες " +"μετατροπές από/προς τιμές της Python. Οι συναρτήσεις και τα αντικείμενα του " +"module μπορούν να χρησιμοποιηθούν για δύο κυρίως εφαρμογές: την ανταλλαγή " +"δεδομένων με εξωτερικές πηγές (αρχεία ή συνδέσεις δικτύου) ή τη μεταφορά " +"δεδομένων μεταξύ της εφαρμογής Python και του επιπέδου C." -#: library/struct.rst:25 +#: library/struct.rst:29 msgid "" "When no prefix character is given, native mode is the default. It packs or " "unpacks data based on the platform and compiler on which the Python " @@ -46,8 +54,18 @@ msgid "" "for defining byte ordering and padding between elements. See :ref:`struct-" "alignment` for details." msgstr "" - -#: library/struct.rst:35 +"Όταν δεν δίνεται χαρακτήρας προθέματος, η προεπιλεγμένη λειτουργία είναι η " +"εγγενής (native mode). Πακετάρει ή αποσυμπιέζει δεδομένα με βάση την " +"πλατφόρμα και τον μεταγλωττιστή με τον οποίο κατασκευάστηκε ο διερμηνέας της " +"Python. Το αποτέλεσμα της συσκευασίας μιας δεδομένης δομής C περιλαμβάνει " +"συμπληρωματικά bytes (pad bytes) που διατηρούν τη σωστή στοίχιση για τους " +"εμπλεκόμενους τύπους C· παρομοίως, η στοίχιση λαμβάνεται υπόψη κατά την " +"αποσυσκευασία. Αντίθετα, κατά την επικοινωνία δεδομένων με εξωτερικές πηγές, " +"ο προγραμματιστής είναι υπεύθυνος για τον καθορισμό της σειράς byte και του " +"συμπληρώματος μεταξύ των στοιχείων. Δείτε :ref:`struct-alignment` για " +"λεπτομέρειες." + +#: library/struct.rst:39 msgid "" "Several :mod:`struct` functions (and methods of :class:`Struct`) take a " "*buffer* argument. This refers to objects that implement the :ref:" @@ -57,52 +75,81 @@ msgid "" "implement the buffer protocol, so that they can be read/filled without " "additional copying from a :class:`bytes` object." msgstr "" +"Αρκετές συναρτήσεις του :mod:`struct` (και μέθοδοι της κλάσης :class:" +"`Struct`) δέχονται μια παράμετρο *buffer*. Αυτή αναφέρεται σε αντικείμενα " +"που υλοποιούν τα :ref:`bufferobjects` και παρέχουν είτε ένα αναγνώσιμο είτε " +"έναν αναγνώσιμο-εγγράψιμο buffer. Οι πιο συνηθισμένοι τύποι που " +"χρησιμοποιούνται για αυτόν τον σκοπό είναι οι :class:`bytes` και :class:" +"`bytearray`, αλλά πολλοί άλλοι τύποι που μπορούν να θεωρηθούν ως πίνακες " +"bytes υλοποιούν το πρωτόκολλο buffer, επιτρέποντας την ανάγνωση/τροφοδότηση " +"χωρίς επιπλέον αντιγραφή από ένα αντικείμενο :class:`bytes`." -#: library/struct.rst:44 +#: library/struct.rst:48 msgid "Functions and Exceptions" -msgstr "" +msgstr "Συναρτήσεις και εξαιρέσεις" -#: library/struct.rst:46 +#: library/struct.rst:50 msgid "The module defines the following exception and functions:" -msgstr "" +msgstr "Το module ορίζει την ακόλουθη εξαίρεση και συναρτήσεις:" -#: library/struct.rst:51 +#: library/struct.rst:55 msgid "" "Exception raised on various occasions; argument is a string describing what " "is wrong." msgstr "" +"Εξαίρεση που γίνεται raise σε διάφορες περιπτώσεις· το όρισμα είναι μια " +"συμβολοσειρά που περιγράφει το σφάλμα." -#: library/struct.rst:57 +#: library/struct.rst:61 msgid "" "Return a bytes object containing the values *v1*, *v2*, ... packed according " "to the format string *format*. The arguments must match the values required " "by the format exactly." msgstr "" +"Επιστρέφει ένα αντικείμενο τύπου bytes που περιέχει τις τιμές *v1*, " +"*v2*, ... πακεταρισμένες σύμφωνα με τη συμβολοσειρά μορφοποίησης *format*. " +"Τα ορίσματα πρέπει να ταιριάζουν ακριβώς με τις απαιτούμενες τιμές της " +"μορφοποίησης." -#: library/struct.rst:64 +#: library/struct.rst:68 msgid "" "Pack the values *v1*, *v2*, ... according to the format string *format* and " "write the packed bytes into the writable buffer *buffer* starting at " "position *offset*. Note that *offset* is a required argument." msgstr "" +"Πακετάρει τις τιμές *v1*, *v2*, ... σύμφωνα με τη συμβολοσειρά μορφοποίησης " +"*format* και γράφει τα πακεταρισμένα bytes στον εγγράψιμο buffer *buffer* " +"ξεκινώντας από τη θέση *offset*. Σημειώστε ότι το *offset* είναι υποχρεωτικό " +"όρισμα." -#: library/struct.rst:71 +#: library/struct.rst:75 msgid "" "Unpack from the buffer *buffer* (presumably packed by ``pack(format, ...)``) " "according to the format string *format*. The result is a tuple even if it " "contains exactly one item. The buffer's size in bytes must match the size " "required by the format, as reflected by :func:`calcsize`." msgstr "" +"Αποσυμπιέζει από τον buffer *buffer* (ο οποίος υποτίθεται έχει πακεταριστεί " +"με τη μέθοδο ``pack(format, ...)``) σύμφωνα με την συμβολοσειρά μορφοποίησης " +"*format*. Το αποτέλεσμα είναι μια πλειάδα, ακόμα κι αν περιέχει μόνο ένα " +"στοιχείο. Το μέγεθος του buffer σε bytes πρέπει να ταιριάζει με το " +"απαιτούμενο μέγεθος σύμφωνα με τη μορφή, όπως καθορίζεται από τη συνάρτηση :" +"func:`calcsize`." -#: library/struct.rst:79 +#: library/struct.rst:83 msgid "" "Unpack from *buffer* starting at position *offset*, according to the format " "string *format*. The result is a tuple even if it contains exactly one " "item. The buffer's size in bytes, starting at position *offset*, must be at " "least the size required by the format, as reflected by :func:`calcsize`." msgstr "" +"Αποσυμπιέζει από τον *buffer* ξεκινώντας από τη θέση *offset*, σύμφωνα με τη " +"συμβολοσειρά μορφοποίησης *format*. Το αποτέλεσμα είναι μια πλειάδα, ακόμα " +"κι αν περιέχει μόνο ένα στοιχείο. Το μέγεθος του buffer σε bytes, ξεκινώντας " +"από τη θέση *offset*, πρέπει να είναι τουλάχιστον το μέγεθος που απαιτείται " +"από τη μορφή, όπως καθορίζεται από τη συνάρτηση :func:`calcsize`." -#: library/struct.rst:87 +#: library/struct.rst:91 msgid "" "Iteratively unpack from the buffer *buffer* according to the format string " "*format*. This function returns an iterator which will read equally sized " @@ -110,22 +157,33 @@ msgid "" "buffer's size in bytes must be a multiple of the size required by the " "format, as reflected by :func:`calcsize`." msgstr "" +"Αποσυμπιέζει επαναληπτικά από τον buffer *buffer* σύμφωνα με τη συμβολοσειρά " +"μορφοποίησης *format*. Αυτή η συνάρτηση επιστρέφει έναν iterator ο οποίος θα " +"διαβάσει κομμάτια ίδιου μεγέθους από τον buffer μέχρι να καταναλωθούν όλα τα " +"περιεχόμενά του. Το μέγεθος του buffer σε bytes πρέπει να είναι πολλαπλάσιο " +"του μεγέθους που απαιτείται από τη μορφή, όπως καθορίζεται από τη συνάρτηση :" +"func:`calcsize`." -#: library/struct.rst:93 +#: library/struct.rst:97 msgid "Each iteration yields a tuple as specified by the format string." msgstr "" +"Κάθε επανάληψη επιστρέφει μια πλειάδα σύμφωνα με τη συμβολοσειρά " +"μορφοποίησης." -#: library/struct.rst:100 +#: library/struct.rst:104 msgid "" "Return the size of the struct (and hence of the bytes object produced by " "``pack(format, ...)``) corresponding to the format string *format*." msgstr "" +"Επιστρέφει το μέγεθος της δομής (και κατά συνέπεια του αντικειμένου bytes " +"που παράγεται από το ``pack(format, ...)``) που αντιστοιχεί στη συμβολοσειρά " +"μορφοποίησης *format*." -#: library/struct.rst:107 +#: library/struct.rst:111 msgid "Format Strings" -msgstr "" +msgstr "Συμβολοσειρές μορφοποίησης" -#: library/struct.rst:109 +#: library/struct.rst:113 msgid "" "Format strings describe the data layout when packing and unpacking data. " "They are built up from :ref:`format characters`, which " @@ -135,12 +193,21 @@ msgid "" "which describes the overall properties of the data and one or more format " "characters which describe the actual data values and padding." msgstr "" - -#: library/struct.rst:121 +"Οι συμβολοσειρές μορφοποίησης περιγράφουν τη διάταξη των δεδομένων κατά την " +"συσκευασία και αποσυσκευασία των δεδομένων. Δημιουργούνται από :ref:`format " +"characters`, οι οποίοι καθορίζουν τον τύπο των δεδομένων " +"που συσκευάζονται/αποσυσκευάζονται. Επιπλέον, ειδικοί χαρακτήρες ελέγχουν " +"την :ref:`byte order, size and alignment`. Κάθε " +"συμβολοσειρά μορφοποίησης αποτελείται από έναν προαιρετικό χαρακτήρα πρόθεμα " +"που περιγράφει τις συνολικές ιδιότητες των δεδομένων και έναν ή " +"περισσότερους χαρακτήρες μορφοποίησης που περιγράφουν τις πραγματικές τιμές " +"δεδομένων και το συμπλήρωμα." + +#: library/struct.rst:125 msgid "Byte Order, Size, and Alignment" -msgstr "" +msgstr "Διάταξη Byte, Μέγεθος και Στοίχιση" -#: library/struct.rst:123 +#: library/struct.rst:127 msgid "" "By default, C types are represented in the machine's native format and byte " "order, and properly aligned by skipping pad bytes if necessary (according to " @@ -149,162 +216,199 @@ msgid "" "corresponding C struct. Whether to use native byte ordering and padding or " "standard formats depends on the application." msgstr "" +"Από προεπιλογή, οι τύποι της C αναπαρίστανται στη φυσική μορφή και διάταξη " +"byte της μηχανής και ευθυγραμμίζονται σωστά, παραλείποντας byte γεμίσματος " +"εάν είναι απαραίτητο (σύμφωνα με τους κανόνες που χρησιμοποιεί ο " +"μεταγλωττιστής C). Αυτή η συμπεριφορά επιλέγεται έτσι ώστε τα byte μιας " +"συσκευασμένης δομής να αντιστοιχούν ακριβώς στη διάταξη μνήμης της " +"αντίστοιχης δομής της C. Το αν θα χρησιμοποιηθεί φυσική διάταξη byte και " +"γέμισμα ή τυποποιημένες μορφές εξαρτάται από την εφαρμογή." -#: library/struct.rst:139 +#: library/struct.rst:143 msgid "" "Alternatively, the first character of the format string can be used to " "indicate the byte order, size and alignment of the packed data, according to " "the following table:" msgstr "" +"Εναλλακτικά, ο πρώτος χαρακτήρας της συμβολοσειράς μορφοποίησης μπορεί να " +"χρησιμοποιηθεί για να υποδείξει τη σειρά byte, το μέγεθος και την " +"ευθυγράμμιση των συσκευασμένων δεδομένων, σύμφωνα με το παρακάτω πίνακα:" -#: library/struct.rst:144 +#: library/struct.rst:148 msgid "Character" -msgstr "" +msgstr "Χαρακτήρας" -#: library/struct.rst:144 +#: library/struct.rst:148 msgid "Byte order" -msgstr "" +msgstr "Σειρά bytes" -#: library/struct.rst:144 +#: library/struct.rst:148 msgid "Size" -msgstr "" +msgstr "Μέγεθος" -#: library/struct.rst:144 +#: library/struct.rst:148 msgid "Alignment" -msgstr "" +msgstr "Στοίχιση" -#: library/struct.rst:146 +#: library/struct.rst:150 msgid "``@``" -msgstr "" +msgstr "``@``" -#: library/struct.rst:148 +#: library/struct.rst:152 msgid "native" -msgstr "" +msgstr "native" -#: library/struct.rst:148 +#: library/struct.rst:152 msgid "``=``" -msgstr "" +msgstr "``=``" -#: library/struct.rst:150 library/struct.rst:154 +#: library/struct.rst:154 library/struct.rst:158 msgid "standard" -msgstr "" +msgstr "τυπικό" -#: library/struct.rst:150 library/struct.rst:154 +#: library/struct.rst:154 library/struct.rst:158 msgid "none" -msgstr "" +msgstr "κανένα" -#: library/struct.rst:150 +#: library/struct.rst:154 msgid "``<``" -msgstr "" +msgstr "``<``" -#: library/struct.rst:150 +#: library/struct.rst:154 msgid "little-endian" -msgstr "" +msgstr "little-endian" -#: library/struct.rst:152 +#: library/struct.rst:156 msgid "``>``" -msgstr "" +msgstr "``>``" -#: library/struct.rst:152 +#: library/struct.rst:156 msgid "big-endian" -msgstr "" +msgstr "big-endian" -#: library/struct.rst:154 +#: library/struct.rst:158 msgid "``!``" -msgstr "" +msgstr "``!``" -#: library/struct.rst:154 +#: library/struct.rst:158 msgid "network (= big-endian)" -msgstr "" +msgstr "δίκτυο (= big-endian)" -#: library/struct.rst:157 +#: library/struct.rst:161 msgid "If the first character is not one of these, ``'@'`` is assumed." -msgstr "" +msgstr "Αν ο πρώτος χαρακτήρας δεν είναι ένας από αυτούς, υποτίθεται ``'@'``." -#: library/struct.rst:161 +#: library/struct.rst:165 msgid "" "The number 1023 (``0x3ff`` in hexadecimal) has the following byte " "representations:" msgstr "" +"Ο αριθμός 1023 (``0x3ff`` σε δεκαεξαδική μορφή) έχει τις ακόλουθες " +"αναπαραστάσεις σε byte:" -#: library/struct.rst:163 +#: library/struct.rst:167 msgid "``03 ff`` in big-endian (``>``)" -msgstr "" +msgstr "``03 ff`` σε big-endian (``>``)" -#: library/struct.rst:164 +#: library/struct.rst:168 msgid "``ff 03`` in little-endian (``<``)" -msgstr "" +msgstr "``ff 03`` σε little-endian (``<``)" -#: library/struct.rst:166 +#: library/struct.rst:170 msgid "Python example:" -msgstr "" +msgstr "Παράδειγμα Python:" -#: library/struct.rst:174 +#: library/struct.rst:178 msgid "" "Native byte order is big-endian or little-endian, depending on the host " "system. For example, Intel x86, AMD64 (x86-64), and Apple M1 are little-" "endian; IBM z and many legacy architectures are big-endian. Use :data:`sys." "byteorder` to check the endianness of your system." msgstr "" +"Η native σειρά byte είναι big-endian ή little-endian, ανάλογα με το σύστημα " +"υποδοχής. Για παράδειγμα, οι Intel x86, AMD64 (x86-64) και Apple M1 είναι " +"little-endian, ενώ οι IBM z και πολλές παλαιότερες αρχιτεκτονικές είναι big-" +"endian. Χρησιμοποιήστε τη μεταβλητή :data:`sys.byteorder` για να ελέγξετε το " +"endianness του συστήματος σας." -#: library/struct.rst:179 +#: library/struct.rst:183 msgid "" "Native size and alignment are determined using the C compiler's ``sizeof`` " "expression. This is always combined with native byte order." msgstr "" +"Το native μέγεθος και η στοίχιση καθορίζονται χρησιμοποιώντας την έκφραση " +"``sizeof`` του μεταγλωττιστή C. Αυτό συνδυάζεται πάντα με την native σειρά " +"byte." -#: library/struct.rst:182 +#: library/struct.rst:186 msgid "" "Standard size depends only on the format character; see the table in the :" "ref:`format-characters` section." msgstr "" +"Το τυπικό μέγεθος εξαρτάται μόνο από τον χαρακτήρα μορφοποίησης· δείτε τον " +"πίνακα στην ενότητα :ref:`format-characters`." -#: library/struct.rst:185 +#: library/struct.rst:189 msgid "" "Note the difference between ``'@'`` and ``'='``: both use native byte order, " "but the size and alignment of the latter is standardized." msgstr "" +"Σημειώστε τη διαφορά μεταξύ του ``'@'`` και ``'='``: και τα δύο " +"χρησιμοποιούν τη native σειρά byte, αλλά το μέγεθος και η στοίχιση του " +"τελευταίου είναι τυποποιημένα." -#: library/struct.rst:188 +#: library/struct.rst:192 msgid "" "The form ``'!'`` represents the network byte order which is always big-" "endian as defined in `IETF RFC 1700 `_." msgstr "" +"Η μορφή ``'!'`` αντιπροσωπεύει τη σειρά byte του δικτύου, η οποία είναι " +"πάντα big-endian όπως ορίζεται στο `IETF RFC 1700 `_." -#: library/struct.rst:191 +#: library/struct.rst:195 msgid "" "There is no way to indicate non-native byte order (force byte-swapping); use " "the appropriate choice of ``'<'`` or ``'>'``." msgstr "" +"Δεν υπάρχει τρόπος να δηλωθεί non-native σειρά byte (να επιβληθεί εναλλαγή " +"byte). Χρησιμοποιήστε την κατάλληλη επιλογή ``'<'`` ή ``'>'``." -#: library/struct.rst:273 +#: library/struct.rst:284 msgid "Notes:" -msgstr "" +msgstr "Σημειώσεις:" -#: library/struct.rst:196 +#: library/struct.rst:200 msgid "" "Padding is only automatically added between successive structure members. No " "padding is added at the beginning or the end of the encoded struct." msgstr "" +"Το συμπλήρωμα (padding) προστίθεται αυτόματα μόνο μεταξύ διαδοχικών μελών " +"της δομής. Δεν προστίθεται συμπλήρωμα στην αρχή ή στο τέλος της " +"κωδικοποιημένης δομής." -#: library/struct.rst:199 +#: library/struct.rst:203 msgid "" "No padding is added when using non-native size and alignment, e.g. with '<', " "'>', '=', and '!'." msgstr "" +"Δεν προστίθεται συμπλήρωμα όταν χρησιμοποιείται non-native μέγεθος και " +"στοίχιση, π.χ. με '<','>', '=', και '!'." -#: library/struct.rst:202 +#: library/struct.rst:206 msgid "" "To align the end of a structure to the alignment requirement of a particular " "type, end the format with the code for that type with a repeat count of " "zero. See :ref:`struct-examples`." msgstr "" +"Για να ευθυγραμμίσετε το τέλος μιας δομής με την απαίτηση στοίχισης ενός " +"συγκεκριμένου τύπου, τελειώστε τη μορφή με τον κωδικό για αυτό τον τύπο με " +"πλήθος επαναλήψεων μηδέν. Δείτε :ref:`struct-examples`." -#: library/struct.rst:210 +#: library/struct.rst:214 msgid "Format Characters" -msgstr "" +msgstr "Χαρακτήρες μορφής" -#: library/struct.rst:212 +#: library/struct.rst:216 msgid "" "Format characters have the following meaning; the conversion between C and " "Python values should be obvious given their types. The 'Standard size' " @@ -313,313 +417,368 @@ msgid "" "``'!'`` or ``'='``. When using native size, the size of the packed value is " "platform-dependent." msgstr "" +"Οι χαρακτήρες μορφής έχουν την ακόλουθη σημασία· η μετατροπή μεταξύ τιμών C " +"και Python είναι προφανής, δεδομένων των τύπων τους. Η στήλη 'Τυπικό " +"μέγεθος' αναφέρεται στο μέγεθος της συμπιεσμένης τιμής σε byte όταν " +"χρησιμοποιείται τυπικό μέγεθος· δηλαδή, όταν η συμβολοσειρά μορφής ξεκινά με " +"ένα από τα ``'<'``, ``'>'``, ``'!'`` or ``'='``. Όταν χρησιμοποιείται το " +"native μέγεθος, το μέγεθος της συμπιεσμένης τιμής εξαρτάται από την " +"πλατφόρμα." -#: library/struct.rst:220 +#: library/struct.rst:224 msgid "Format" -msgstr "" +msgstr "Μορφή" -#: library/struct.rst:220 +#: library/struct.rst:224 msgid "C Type" -msgstr "" +msgstr "Τύπος C" -#: library/struct.rst:220 +#: library/struct.rst:224 msgid "Python type" -msgstr "" +msgstr "Τύπος Python" -#: library/struct.rst:220 +#: library/struct.rst:224 msgid "Standard size" -msgstr "" +msgstr "Τυπικό μέγεθος" -#: library/struct.rst:220 +#: library/struct.rst:224 msgid "Notes" -msgstr "" +msgstr "Σημειώσεις" -#: library/struct.rst:222 +#: library/struct.rst:226 msgid "``x``" -msgstr "" +msgstr "``x``" -#: library/struct.rst:222 +#: library/struct.rst:226 msgid "pad byte" -msgstr "" +msgstr "συμπληρωματικό byte" -#: library/struct.rst:222 +#: library/struct.rst:226 msgid "no value" -msgstr "" +msgstr "καμία τιμή" -#: library/struct.rst:222 +#: library/struct.rst:226 msgid "\\(7)" -msgstr "" +msgstr "\\(7)" -#: library/struct.rst:224 +#: library/struct.rst:228 msgid "``c``" -msgstr "" +msgstr "``c``" -#: library/struct.rst:224 +#: library/struct.rst:228 msgid ":c:expr:`char`" -msgstr "" +msgstr ":c:expr:`char`" -#: library/struct.rst:224 +#: library/struct.rst:228 msgid "bytes of length 1" -msgstr "" +msgstr "bytes μήκους 1" -#: library/struct.rst:226 library/struct.rst:230 +#: library/struct.rst:230 library/struct.rst:234 msgid "1" -msgstr "" +msgstr "1" -#: library/struct.rst:226 +#: library/struct.rst:230 msgid "``b``" -msgstr "" +msgstr "``b``" -#: library/struct.rst:226 +#: library/struct.rst:230 msgid ":c:expr:`signed char`" -msgstr "" +msgstr ":c:expr:`signed char`" -#: library/struct.rst:228 library/struct.rst:234 library/struct.rst:238 -#: library/struct.rst:242 library/struct.rst:246 library/struct.rst:251 -#: library/struct.rst:263 +#: library/struct.rst:232 library/struct.rst:238 library/struct.rst:242 +#: library/struct.rst:246 library/struct.rst:250 library/struct.rst:255 +#: library/struct.rst:271 msgid "integer" -msgstr "" +msgstr "integer" -#: library/struct.rst:226 +#: library/struct.rst:230 msgid "\\(1), \\(2)" -msgstr "" +msgstr "\\(1), \\(2)" -#: library/struct.rst:228 +#: library/struct.rst:232 msgid "``B``" -msgstr "" +msgstr "``B``" -#: library/struct.rst:228 +#: library/struct.rst:232 msgid ":c:expr:`unsigned char`" -msgstr "" +msgstr ":c:expr:`unsigned char`" -#: library/struct.rst:232 library/struct.rst:236 library/struct.rst:240 -#: library/struct.rst:244 library/struct.rst:246 +#: library/struct.rst:236 library/struct.rst:240 library/struct.rst:244 +#: library/struct.rst:248 library/struct.rst:250 msgid "\\(2)" -msgstr "" +msgstr "\\(2)" -#: library/struct.rst:230 +#: library/struct.rst:234 msgid "``?``" -msgstr "" +msgstr "``?``" -#: library/struct.rst:230 +#: library/struct.rst:234 msgid ":c:expr:`_Bool`" -msgstr "" +msgstr ":c:expr:`_Bool`" -#: library/struct.rst:230 +#: library/struct.rst:234 msgid "bool" -msgstr "" +msgstr "bool" -#: library/struct.rst:230 +#: library/struct.rst:234 msgid "\\(1)" -msgstr "" +msgstr "\\(1)" -#: library/struct.rst:232 +#: library/struct.rst:236 msgid "``h``" -msgstr "" +msgstr "``h``" -#: library/struct.rst:232 +#: library/struct.rst:236 msgid ":c:expr:`short`" -msgstr "" +msgstr ":c:expr:`short`" -#: library/struct.rst:234 library/struct.rst:253 +#: library/struct.rst:238 library/struct.rst:257 msgid "2" -msgstr "" +msgstr "2" -#: library/struct.rst:234 +#: library/struct.rst:238 msgid "``H``" -msgstr "" +msgstr "``H``" -#: library/struct.rst:234 +#: library/struct.rst:238 msgid ":c:expr:`unsigned short`" -msgstr "" +msgstr ":c:expr:`unsigned short`" -#: library/struct.rst:236 +#: library/struct.rst:240 msgid "``i``" -msgstr "" +msgstr "``i``" -#: library/struct.rst:236 +#: library/struct.rst:240 msgid ":c:expr:`int`" -msgstr "" +msgstr ":c:expr:`int`" -#: library/struct.rst:238 library/struct.rst:242 library/struct.rst:255 +#: library/struct.rst:242 library/struct.rst:246 library/struct.rst:259 msgid "4" -msgstr "" +msgstr "4" -#: library/struct.rst:238 +#: library/struct.rst:242 msgid "``I``" -msgstr "" +msgstr "``I``" -#: library/struct.rst:238 +#: library/struct.rst:242 msgid ":c:expr:`unsigned int`" -msgstr "" +msgstr ":c:expr:`unsigned int`" -#: library/struct.rst:240 +#: library/struct.rst:244 msgid "``l``" -msgstr "" +msgstr "``l``" -#: library/struct.rst:240 +#: library/struct.rst:244 msgid ":c:expr:`long`" -msgstr "" +msgstr ":c:expr:`long`" -#: library/struct.rst:242 +#: library/struct.rst:246 msgid "``L``" -msgstr "" +msgstr "``L``" -#: library/struct.rst:242 +#: library/struct.rst:246 msgid ":c:expr:`unsigned long`" -msgstr "" +msgstr ":c:expr:`unsigned long`" -#: library/struct.rst:244 +#: library/struct.rst:248 msgid "``q``" -msgstr "" +msgstr "``q``" -#: library/struct.rst:244 +#: library/struct.rst:248 msgid ":c:expr:`long long`" -msgstr "" +msgstr ":c:expr:`long long`" -#: library/struct.rst:246 library/struct.rst:257 +#: library/struct.rst:250 library/struct.rst:263 msgid "8" -msgstr "" +msgstr "8" -#: library/struct.rst:246 +#: library/struct.rst:250 msgid "``Q``" -msgstr "" +msgstr "``Q``" -#: library/struct.rst:246 +#: library/struct.rst:250 msgid ":c:expr:`unsigned long long`" -msgstr "" +msgstr ":c:expr:`unsigned long long`" -#: library/struct.rst:249 +#: library/struct.rst:253 msgid "``n``" -msgstr "" +msgstr "``n``" -#: library/struct.rst:249 +#: library/struct.rst:253 msgid ":c:type:`ssize_t`" -msgstr "" +msgstr ":c:type:`ssize_t`" -#: library/struct.rst:251 +#: library/struct.rst:255 msgid "\\(3)" -msgstr "" +msgstr "\\(3)" -#: library/struct.rst:251 +#: library/struct.rst:255 msgid "``N``" -msgstr "" +msgstr "``N``" -#: library/struct.rst:251 +#: library/struct.rst:255 msgid ":c:type:`size_t`" -msgstr "" +msgstr ":c:type:`size_t`" -#: library/struct.rst:253 +#: library/struct.rst:257 msgid "``e``" -msgstr "" +msgstr "``e``" -#: library/struct.rst:253 +#: library/struct.rst:257 msgid "\\(6)" -msgstr "" +msgstr "\\(6)" -#: library/struct.rst:255 library/struct.rst:257 +#: library/struct.rst:259 library/struct.rst:261 msgid "float" -msgstr "" +msgstr "float" -#: library/struct.rst:255 library/struct.rst:257 +#: library/struct.rst:259 library/struct.rst:261 msgid "\\(4)" -msgstr "" +msgstr "\\(4)" -#: library/struct.rst:255 +#: library/struct.rst:259 msgid "``f``" -msgstr "" +msgstr "``f``" -#: library/struct.rst:255 +#: library/struct.rst:259 msgid ":c:expr:`float`" -msgstr "" +msgstr ":c:expr:`float`" -#: library/struct.rst:257 +#: library/struct.rst:261 msgid "``d``" -msgstr "" +msgstr "``d``" -#: library/struct.rst:257 +#: library/struct.rst:261 msgid ":c:expr:`double`" -msgstr "" +msgstr ":c:expr:`double`" -#: library/struct.rst:259 +#: library/struct.rst:263 +msgid "``F``" +msgstr "``F``" + +#: library/struct.rst:263 +msgid ":c:expr:`float complex`" +msgstr ":c:expr:`float complex`" + +#: library/struct.rst:265 +msgid "complex" +msgstr "μιγαδικός" + +#: library/struct.rst:265 +msgid "\\(10)" +msgstr "\\(10)" + +#: library/struct.rst:265 +msgid "``D``" +msgstr "``D``" + +#: library/struct.rst:265 +msgid ":c:expr:`double complex`" +msgstr ":c:expr:`double complex`" + +#: library/struct.rst:265 +msgid "16" +msgstr "16" + +#: library/struct.rst:267 msgid "``s``" -msgstr "" +msgstr "``s``" -#: library/struct.rst:261 +#: library/struct.rst:269 msgid ":c:expr:`char[]`" -msgstr "" +msgstr ":c:expr:`char[]`" -#: library/struct.rst:261 +#: library/struct.rst:269 msgid "bytes" -msgstr "" +msgstr "bytes" -#: library/struct.rst:259 +#: library/struct.rst:267 msgid "\\(9)" -msgstr "" +msgstr "\\(9)" -#: library/struct.rst:261 +#: library/struct.rst:269 msgid "``p``" -msgstr "" +msgstr "``p``" -#: library/struct.rst:261 +#: library/struct.rst:269 msgid "\\(8)" -msgstr "" +msgstr "\\(8)" -#: library/struct.rst:263 +#: library/struct.rst:271 msgid "``P``" -msgstr "" +msgstr "``P``" -#: library/struct.rst:263 +#: library/struct.rst:271 msgid ":c:expr:`void \\*`" -msgstr "" +msgstr ":c:expr:`void \\*`" -#: library/struct.rst:263 +#: library/struct.rst:271 msgid "\\(5)" -msgstr "" +msgstr "\\(5)" -#: library/struct.rst:266 +#: library/struct.rst:274 msgid "Added support for the ``'n'`` and ``'N'`` formats." -msgstr "" +msgstr "Προστέθηκε υποστήριξη για τις μορφές ``'n'`` και ``'N'``." -#: library/struct.rst:269 +#: library/struct.rst:277 msgid "Added support for the ``'e'`` format." -msgstr "" +msgstr "Προστέθηκε υποστήριξη για τη μορφή ``'e'``." + +#: library/struct.rst:280 +msgid "Added support for the ``'F'`` and ``'D'`` formats." +msgstr "Προστέθηκε υποστήριξη για τις μορφές ``'F'`` και ``'D'``." -#: library/struct.rst:278 +#: library/struct.rst:289 msgid "" "The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type defined " -"by C99. If this type is not available, it is simulated using a :c:expr:" -"`char`. In standard mode, it is always represented by one byte." +"by C standards since C99. In standard mode, it is represented by one byte." msgstr "" +"Ο κωδικός μετατροπής ``'?'`` αντιστοιχεί στον τύπο :c:expr:`_Bool` που " +"ορίζεται από τα πρότυπα C από την έκδοση C99. Σε τυπική λειτουργία, " +"αναπαρίσταται από ένα byte." -#: library/struct.rst:283 +#: library/struct.rst:294 msgid "" "When attempting to pack a non-integer using any of the integer conversion " "codes, if the non-integer has a :meth:`~object.__index__` method then that " "method is called to convert the argument to an integer before packing." msgstr "" +"Όταν επιχειρείται η συσκευασία ενός μη ακέραιου αριθμού χρησιμοποιώντας " +"οποιονδήποτε από τους κωδικούς μετατροπής ακεραίων, αν το αντικείμενο " +"διαθέτει τη μέθοδο :meth:`~object.__index__`, τότε καλείται αυτή η μέθοδος " +"για τη μετατροπή του ορίσματος σε ακέραιο πριν από τη συσκευασία." -#: library/struct.rst:287 +#: library/struct.rst:298 msgid "Added use of the :meth:`~object.__index__` method for non-integers." msgstr "" +"Προστέθηκε η χρήση της μεθόδου :meth:`~object.__index__` για μη ακέραιους " +"αριθμούς." -#: library/struct.rst:291 +#: library/struct.rst:302 msgid "" "The ``'n'`` and ``'N'`` conversion codes are only available for the native " "size (selected as the default or with the ``'@'`` byte order character). For " "the standard size, you can use whichever of the other integer formats fits " "your application." msgstr "" +"Οι κωδικοί μετατροπής ``'n'`` και ``'N'`` είναι διαθέσιμοι μόνο για το " +"native μέγεθος (επιλεγμένο ως προεπιλογή ή με τον χαρακτήρα διάταξης byte " +"``'@'``). Για το τυπικό μέγεθος, μπορείτε να χρησιμοποιήσετε οποιαδήποτε από " +"τις άλλες μορφές ακέραιων που ταιριάζουν στην εφαρμογή σας." -#: library/struct.rst:297 +#: library/struct.rst:308 msgid "" "For the ``'f'``, ``'d'`` and ``'e'`` conversion codes, the packed " "representation uses the IEEE 754 binary32, binary64 or binary16 format (for " "``'f'``, ``'d'`` or ``'e'`` respectively), regardless of the floating-point " "format used by the platform." msgstr "" +"Για τους κωδικούς μετατροπής ``'f'``, ``'d'`` και ``'e'``, η συσκευασμένη " +"αναπαράσταση χρησιμοποιεί τη μορφή IEEE 754 binary32, binary64 ή binary16 " +"(αντίστοιχα για ``'f'``, ``'d'`` ή ``'e'``), ανεξάρτητα από τη μορφή κινητής " +"υποδιαστολής που χρησιμοποιεί η πλατφόρμα." -#: library/struct.rst:303 +#: library/struct.rst:314 msgid "" "The ``'P'`` format character is only available for the native byte ordering " "(selected as the default or with the ``'@'`` byte order character). The byte " @@ -627,8 +786,13 @@ msgid "" "on the host system. The struct module does not interpret this as native " "ordering, so the ``'P'`` format is not available." msgstr "" +"Ο χαρακτήρας μορφοποίησης ``'P'`` είναι διαθέσιμος μόνο για τη φυσική σειρά " +"byte (επιλεγμένη ως προεπιλογή ή με τον χαρακτήρα σειράς byte ``'@'``). Ο " +"χαρακτήρας σειράς byte ``'='`` επιλέγει τη χρήση little- ή big-endian σειράς " +"με βάση το σύστημα. Το module struct δεν ερμηνεύει αυτό ως native σειρά, " +"επομένως η μορφή ``'P'`` δεν είναι διαθέσιμη." -#: library/struct.rst:310 +#: library/struct.rst:321 msgid "" "The IEEE 754 binary16 \"half precision\" type was introduced in the 2008 " "revision of the `IEEE 754 standard `_. It has a sign " @@ -639,12 +803,21 @@ msgid "" "operations. See the Wikipedia page on the `half-precision floating-point " "format `_ for more information." msgstr "" - -#: library/struct.rst:320 +"Ο τύπος IEEE 754 binary16 \"half precision\" εισήχθη στην αναθεώρηση του " +"2008 του προτύπου `IEEE 754 standard `_. Διαθέτει ένα " +"bit προσήμου, έναν εκθέτη 5-bit και ακρίβεια 11-bit (με 10 bit αποθηκευμένα " +"ρητά), και μπορεί να αναπαραστήσει αριθμούς μεταξύ περίπου ``6.1e-05`` και " +"``6.5e+04`` με πλήρη ακρίβεια. Αυτός ο τύπος δεν υποστηρίζεται ευρέως από " +"τους μεταγλωττιστές της C: σε μια τυπική μηχανή, ένας μη προσημασμένος short " +"μπορεί να χρησιμοποιηθεί για αποθήκευση, αλλά όχι για αριθμητικές πράξεις. " +"Δείτε τη σελίδα της Wikipedia για τη `half-precision floating-point\n" +"format `_ για περισσότερες πληροφορίες." + +#: library/struct.rst:331 msgid "When packing, ``'x'`` inserts one NUL byte." -msgstr "" +msgstr "Κατά τη συσκευασία, το ``'x'`` εισάγει ένα NUL byte." -#: library/struct.rst:323 +#: library/struct.rst:334 msgid "" "The ``'p'`` format character encodes a \"Pascal string\", meaning a short " "variable-length string stored in a *fixed number of bytes*, given by the " @@ -657,8 +830,20 @@ msgid "" "consumes ``count`` bytes, but that the string returned can never contain " "more than 255 bytes." msgstr "" - -#: library/struct.rst:335 +"Ο χαρακτήρας μορφοποίησης ``'p'`` κωδικοποιεί ένα \"Pascal string\", δηλαδή " +"μια μικρή συμβολοσειρά μεταβλητού μήκους αποθηκευμένη σε *σταθερό αριθμό " +"byte*, που καθορίζεται από τον μετρητή. Το πρώτο byte που αποθηκεύεται είναι " +"το μήκος της συμβολοσειράς ή 255, όποιο είναι μικρότερο. Ακολουθούν τα byte " +"της συμβολοσειράς. Εάν η συμβολοσειρά που περνά στην :func:`pack` είναι πολύ " +"μεγάλη (μεγαλύτερη από τον μετρητή μείον 1), αποθηκεύονται μόνο τα πρώτα " +"``count-1`` byte της συμβολοσειράς. Εάν η συμβολοσειρά είναι μικρότερη από " +"``count-1``, συμπληρώνεται με μηδενικά byte ώστε να χρησιμοποιηθούν ακριβώς " +"τόσα byte όσα καθορίζει ο μετρητής. Σημειώστε ότι για τη :func:`unpack`, ο " +"χαρακτήρας μορφοποίησης ``'p'`` καταναλώνει ``count`` byte, αλλά η " +"συμβολοσειρά που επιστρέφεται δεν μπορεί ποτέ να περιέχει περισσότερα από " +"255 byte." + +#: library/struct.rst:346 msgid "" "For the ``'s'`` format character, the count is interpreted as the length of " "the bytes, not a repeat count like for the other format characters; for " @@ -672,74 +857,195 @@ msgid "" "number of bytes. As a special case, ``'0s'`` means a single, empty string " "(while ``'0c'`` means 0 characters)." msgstr "" - -#: library/struct.rst:348 +"Για το χαρακτήρα μορφοποίησης ``'s'``, αριθμός (count) ερμηνεύεται ως το " +"μήκος των byte, και όχι ως ένας αριθμός επαναλήψεων, όπως συμβαίνει με " +"άλλους χαρακτήρες μορφοποίησης. Για παράδειγμα, ``'10s'`` σημαίνει μια " +"μοναδική συμβολοσειρά 10 byte που αντιστοιχεί ή προέρχεται από ένα ενιαίο " +"byte string της Python, ενώ ``'10c'`` σημαίνει 10 ξεχωριστούς χαρακτήρες του " +"ενός byte στοιχεία (π.χ. ``cccccccccc``) που αντιστοιχούν σε ή από δέκα " +"διαφορετικά byte objects της Python. (Δείτε το :ref:`struct-examples` για " +"μια συγκεκριμένη επίδειξη της διαφοράς.) Αν δεν δοθεί αριθμός, η " +"προεπιλεγμένη τιμή είναι 1. Κατά την συσκευασία (packing), η συμβολοσειρά " +"περικόπτεται ή συμπληρώνεται με μηδενικά byte ώστε να ταιριάζει στο " +"καθορισμένο μήκος. Κατά την αποσυσκευασία (unpacking), το αποτέλεσμα είναι " +"πάντα ένα αντικείμενο bytes με ακριβώς το καθορισμένο μήκος. Ως ειδική " +"περίπτωση, το ``'0s'`` σημαίνει μια μοναδική, κενή συμβολοσειρά (ενώ το " +"``'0c'`` σημαίνει 0 χαρακτήρες)." + +#: library/struct.rst:360 +msgid "" +"For the ``'F'`` and ``'D'`` format characters, the packed representation " +"uses the IEEE 754 binary32 and binary64 format for components of the complex " +"number, regardless of the floating-point format used by the platform. Note " +"that complex types (``F`` and ``D``) are available unconditionally, despite " +"complex types being an optional feature in C. As specified in the C11 " +"standard, each complex type is represented by a two-element C array " +"containing, respectively, the real and imaginary parts." +msgstr "" +"Για τους χαρακτήρες μορφής ``'F'`` and ``'D'``, η πακεταρισμένη αναπαράσταση " +"χρησιμοποιεί τη μορφή IEEE 754 binary32 και binary64 για τα στοιχεία του " +"μιγαδικού αριθμού, ανεξάρτητα από τη μορφή κινητής υποδιαστολής που " +"χρησιμοποιείται από την πλατφόρμα. Σημειώστε ότι οι μιγαδικοί τύποι (``F`` " +"και ``D``) είναι διαθέσιμοι άνευ όρων, παρά το γεγονός ότι οι μιγαδικοί " +"τύποι αποτελούν προαιρετικό χαρακτηριστικό στη C. Όπως ορίζεται στο πρότυπο " +"C11, κάθε μιγαδικός τύπος αναπαρίσταται από έναν πίνακα C δύο στοιχείων που " +"περιέχει αντίστοιχα, τα πραγματικά και τα φανταστικά μέρη." + +#: library/struct.rst:369 msgid "" "A format character may be preceded by an integral repeat count. For " "example, the format string ``'4h'`` means exactly the same as ``'hhhh'``." msgstr "" +"Ένας χαρακτήρας μορφοποίησης μπορεί να προηγείται από έναν ακέραιο αριθμό " +"επαναλήψεων. Για παράδειγμα, η συμβολοσειρά μορφοποίησης ``'4h'`` σημαίνει " +"ακριβώς το ίδιο με ``'hhhh'``." -#: library/struct.rst:351 +#: library/struct.rst:372 msgid "" "Whitespace characters between formats are ignored; a count and its format " "must not contain whitespace though." msgstr "" +"Οι χαρακτήρες κενού μεταξύ των μορφοποιήσεων αγνοούνται· ωστόσο, ένας " +"αριθμός και η μορφή του δεν πρέπει να περιέχουν κενά." -#: library/struct.rst:354 +#: library/struct.rst:375 msgid "" "When packing a value ``x`` using one of the integer formats (``'b'``, " "``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, ``'q'``, " "``'Q'``), if ``x`` is outside the valid range for that format then :exc:" "`struct.error` is raised." msgstr "" +"Κατά το πακετάρισμα μιας τιμής ``x`` χρησιμοποιώντας μια από τις μορφές " +"ακεραίων (``'b'``, ``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, " +"``'L'``, ``'q'``, ``'Q'``), εάν το ``x`` είναι εκτός του έγκυρου εύρους για " +"αυτήν τη μορφή, γίνεται raise μια εξαίρεση :exc:`struct.error`." -#: library/struct.rst:359 +#: library/struct.rst:380 msgid "" "Previously, some of the integer formats wrapped out-of-range values and " "raised :exc:`DeprecationWarning` instead of :exc:`struct.error`." msgstr "" +"Προηγουμένως, ορισμένες από τις μορφές ακεραίων περιτύλιγαν τιμές εκτός " +"εύρους και εμφάνιζαν :exc:`DeprecationWarning` αντί για :exc:`struct.error`." -#: library/struct.rst:365 +#: library/struct.rst:386 msgid "" "For the ``'?'`` format character, the return value is either :const:`True` " "or :const:`False`. When packing, the truth value of the argument object is " "used. Either 0 or 1 in the native or standard bool representation will be " "packed, and any non-zero value will be ``True`` when unpacking." msgstr "" +"Για το χαρακτήρα μορφής ``'?'``, η τιμή που επιστρέφεται είναι είτε :const:" +"`True` είτε :const:`False`. Κατά την συσκευασία, χρησιμοποιείται η λογική " +"τιμή του αντικειμένου-ορίσματος. Είτε 0 είτε 1 στη native ή τυπική " +"αναπαράσταση του bool θα συσκευαστούν, και οποιαδήποτε μη μηδενική τιμή θα " +"είναι ``True`` κατά την αποσυσκευασία." -#: library/struct.rst:375 +#: library/struct.rst:396 msgid "Examples" -msgstr "" +msgstr "Παραδείγματα" -#: library/struct.rst:378 +#: library/struct.rst:399 msgid "" "Native byte order examples (designated by the ``'@'`` format prefix or lack " "of any prefix character) may not match what the reader's machine produces as " "that depends on the platform and compiler." msgstr "" +"Τα παραδείγματα native σειράς byte (που καθορίζονται από το πρόθεμα μορφής " +"``'@'`` ή την απουσία οποιουδήποτε χαρακτήρα προθέματος) ενδέχεται να μην " +"αντιστοιχούν σε αυτά που παράγει η μηχανή του αναγνώστη, καθώς αυτό " +"εξαρτάται από την πλατφόρμα και τον μεταγλωττιστή." -#: library/struct.rst:383 +#: library/struct.rst:404 msgid "" "Pack and unpack integers of three different sizes, using big endian " "ordering::" msgstr "" +"Συσκευασία και αποσυσκευασία ακεραίων τριών διαφορετικών μεγεθών, " +"χρησιμοποιώντας διάταξη big endian::" -#: library/struct.rst:394 +#: library/struct.rst:407 +msgid "" +">>> from struct import *\n" +">>> pack(\">bhl\", 1, 2, 3)\n" +"b'\\x01\\x00\\x02\\x00\\x00\\x00\\x03'\n" +">>> unpack('>bhl', b'\\x01\\x00\\x02\\x00\\x00\\x00\\x03')\n" +"(1, 2, 3)\n" +">>> calcsize('>bhl')\n" +"7" +msgstr "" +">>> from struct import *\n" +">>> pack(\">bhl\", 1, 2, 3)\n" +"b'\\x01\\x00\\x02\\x00\\x00\\x00\\x03'\n" +">>> unpack('>bhl', b'\\x01\\x00\\x02\\x00\\x00\\x00\\x03')\n" +"(1, 2, 3)\n" +">>> calcsize('>bhl')\n" +"7" + +#: library/struct.rst:415 msgid "Attempt to pack an integer which is too large for the defined field::" msgstr "" +"Προσπάθεια συσκευασίας ενός ακεραίου που είναι πολύ μεγάλος για το " +"καθορισμένο πεδίο::" -#: library/struct.rst:401 +#: library/struct.rst:417 +msgid "" +">>> pack(\">h\", 99999)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"struct.error: 'h' format requires -32768 <= number <= 32767" +msgstr "" +">>> pack(\">h\", 99999)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"struct.error: 'h' format requires -32768 <= number <= 32767" + +#: library/struct.rst:422 msgid "" "Demonstrate the difference between ``'s'`` and ``'c'`` format characters::" msgstr "" +"Επιδεικνύει την διαφορά μεταξύ των χαρακτήρων μορφοποίησης ``'s'`` και " +"``'c'``::" -#: library/struct.rst:409 +#: library/struct.rst:425 +msgid "" +">>> pack(\"@ccc\", b'1', b'2', b'3')\n" +"b'123'\n" +">>> pack(\"@3s\", b'123')\n" +"b'123'" +msgstr "" +">>> pack(\"@ccc\", b'1', b'2', b'3')\n" +"b'123'\n" +">>> pack(\"@3s\", b'123')\n" +"b'123'" + +#: library/struct.rst:430 msgid "" "Unpacked fields can be named by assigning them to variables or by wrapping " "the result in a named tuple::" msgstr "" +"Τα αποσυσκευασμένα πεδία μπορούν να ονομαστούν είτε αναθέτοντάς τα σε " +"μεταβλητές είτε περιτυλίγοντάς τα σε μια ονομασμένη πλειάδα::" -#: library/struct.rst:420 +#: library/struct.rst:433 +msgid "" +">>> record = b'raymond \\x32\\x12\\x08\\x01\\x08'\n" +">>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n" +"\n" +">>> from collections import namedtuple\n" +">>> Student = namedtuple('Student', 'name serialnum school gradelevel')\n" +">>> Student._make(unpack('<10sHHb', record))\n" +"Student(name=b'raymond ', serialnum=4658, school=264, gradelevel=8)" +msgstr "" +">>> record = b'raymond \\x32\\x12\\x08\\x01\\x08'\n" +">>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n" +"\n" +">>> from collections import namedtuple\n" +">>> Student = namedtuple('Student', 'name serialnum school gradelevel')\n" +">>> Student._make(unpack('<10sHHb', record))\n" +"Student(name=b'raymond ', serialnum=4658, school=264, gradelevel=8)" + +#: library/struct.rst:441 msgid "" "The ordering of format characters may have an impact on size in native mode " "since padding is implicit. In standard mode, the user is responsible for " @@ -748,42 +1054,81 @@ msgid "" "integer on a four-byte boundary. In this example, the output was produced on " "a little endian machine::" msgstr "" +"Η σειρά των χαρακτήρων μορφοποίησης μπορεί να επηρεάσει το μέγεθος σε " +"κατάσταση native λειτουργίας, καθώς το συμπλήρωμα είναι έμμεσο. Σε τυπική " +"λειτουργία, ο χρήστης είναι υπεύθυνος για την εισαγωγή οποιασδήποτε " +"επιθυμητού συμπληρώματος. Σημειώστε στην πρώτη κλήση ``pack`` παρακάτω ότι " +"προστέθηκαν τρία μηδενικά (NUL) bytes μετά την συσκευασμένη τιμή ``'#'`` για " +"να ευθυγραμμιστεί ο επόμενος ακέραιος σε όριο τεσσάρων bytes. Σε αυτό το " +"παράδειγμα, η έξοδος παράχθηκε σε έναν υπολογιστή με little endian " +"αρχιτεκτονική::" -#: library/struct.rst:437 +#: library/struct.rst:449 +msgid "" +">>> pack('@ci', b'#', 0x12131415)\n" +"b'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n" +">>> pack('@ic', 0x12131415, b'#')\n" +"b'\\x15\\x14\\x13\\x12#'\n" +">>> calcsize('@ci')\n" +"8\n" +">>> calcsize('@ic')\n" +"5" +msgstr "" +">>> pack('@ci', b'#', 0x12131415)\n" +"b'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n" +">>> pack('@ic', 0x12131415, b'#')\n" +"b'\\x15\\x14\\x13\\x12#'\n" +">>> calcsize('@ci')\n" +"8\n" +">>> calcsize('@ic')\n" +"5" + +#: library/struct.rst:458 msgid "" "The following format ``'llh0l'`` results in two pad bytes being added at the " "end, assuming the platform's longs are aligned on 4-byte boundaries::" msgstr "" +"Η ακόλουθη μορφή ``'llh0l'`` έχει ως αποτέλεσμα την προσθήκη δύο bytes " +"συμπλήρωσης στο τέλος, υποθέτοντας ότι οι μακροί ακέραιοι (longs) της " +"πλατφόρμας ευθυγραμμίζονται σε όρια 4-byte::" -#: library/struct.rst:447 -msgid "Module :mod:`array`" +#: library/struct.rst:461 +msgid "" +">>> pack('@llh0l', 1, 2, 3)\n" +"b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" msgstr "" +">>> pack('@llh0l', 1, 2, 3)\n" +"b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" + +#: library/struct.rst:467 +msgid "Module :mod:`array`" +msgstr "Module :mod:`array`" -#: library/struct.rst:447 +#: library/struct.rst:468 msgid "Packed binary storage of homogeneous data." -msgstr "" +msgstr "Πακεταρισμένη δυαδική αποθήκευση ομοιογενών δεδομένων." -#: library/struct.rst:450 +#: library/struct.rst:470 msgid "Module :mod:`json`" -msgstr "" +msgstr "Module :mod:`json`" -#: library/struct.rst:450 +#: library/struct.rst:471 msgid "JSON encoder and decoder." -msgstr "" +msgstr "Κωδικοποιητής και αποκωδικοποιητής JSON." -#: library/struct.rst:452 +#: library/struct.rst:473 msgid "Module :mod:`pickle`" -msgstr "" +msgstr "Module :mod:`pickle`" -#: library/struct.rst:453 +#: library/struct.rst:474 msgid "Python object serialization." -msgstr "" +msgstr "Σειριοποίηση αντικειμένων Python." -#: library/struct.rst:459 +#: library/struct.rst:480 msgid "Applications" -msgstr "" +msgstr "Εφαρμογές" -#: library/struct.rst:461 +#: library/struct.rst:482 msgid "" "Two main applications for the :mod:`struct` module exist, data interchange " "between Python and C code within an application or another application " @@ -792,12 +1137,19 @@ msgid "" "layout (:ref:`standard formats`). Generally " "speaking, the format strings constructed for these two domains are distinct." msgstr "" +"Υπάρχουν δύο κύριες εφαρμογές για τη χρήση του :mod:`struct`: η ανταλλαγή " +"δεδομένων μεταξύ Python και κώδικα C μέσα σε μια εφαρμογή ή με μια άλλη " +"εφαρμογή που έχει μεταγλωττιστεί με τον ίδιο μεταγλωττιστή (:ref:`native " +"formats`), και η ανταλλαγή δεδομένων μεταξύ εφαρμογών " +"που χρησιμοποιούν μια συμφωνημένη διάταξη δεδομένων (:ref:`standard " +"formats`). Γενικά, οι συμβολοσειρές μορφής που " +"χρησιμοποιούνται σε αυτούς τους δύο τομείς είναι διαφορετικές." -#: library/struct.rst:472 +#: library/struct.rst:493 msgid "Native Formats" -msgstr "" +msgstr "Native Μορφές" -#: library/struct.rst:474 +#: library/struct.rst:495 msgid "" "When constructing format strings which mimic native layouts, the compiler " "and machine architecture determine byte ordering and padding. In such cases, " @@ -807,36 +1159,75 @@ msgid "" "format string to round up to the correct byte boundary for proper alignment " "of consecutive chunks of data." msgstr "" +"Όταν κατασκευάζετε συμβολοσειρές μορφοποίησης που μιμούνται native " +"διατάξεις, ο μεταγλωττιστής και η αρχιτεκτονική του μηχανήματος καθορίζουν " +"τη σειρά των byte και τη συμπλήρωση. Σε τέτοιες περιπτώσεις, ο χαρακτήρας " +"μορφής ``@`` θα πρέπει να χρησιμοποιείται για να καθορίζει την native σειρά " +"byte και τα μεγέθη δεδομένων. Τα εσωτερικά byte συμπλήρωσης εισάγονται " +"συνήθως αυτόματα. Είναι πιθανό να χρειαστεί ένας κωδικός μορφοποίησης με " +"επανάληψη μηδέν στο τέλος μιας συμβολοσειράς μορφοποίησης για να " +"ευθυγραμμιστεί σωστά με τα όρια byte των διαδοχικών τμημάτων δεδομένων." -#: library/struct.rst:482 +#: library/struct.rst:503 msgid "" "Consider these two simple examples (on a 64-bit, little-endian machine)::" msgstr "" +"Εξετάστε αυτά τα δύο απλά παραδείγματα (σε έναν 64-bit, little-endian " +"υπολογιστή)::" -#: library/struct.rst:490 +#: library/struct.rst:506 +msgid "" +">>> calcsize('@lhl')\n" +"24\n" +">>> calcsize('@llh')\n" +"18" +msgstr "" +">>> calcsize('@lhl')\n" +"24\n" +">>> calcsize('@llh')\n" +"18" + +#: library/struct.rst:511 msgid "" "Data is not padded to an 8-byte boundary at the end of the second format " "string without the use of extra padding. A zero-repeat format code solves " "that problem::" msgstr "" +"Τα δεδομένα δεν συμπληρώνονται σε όριο 8 byte στο τέλος της δεύτερης " +"συμβολοσειράς μορφοποίησης χωρίς τη χρήση επιπλέον συμπλήρωσης. Ένας κωδικός " +"μορφοποίησης με επανάληψη μηδέν λύνει αυτό το πρόβλημα::" + +#: library/struct.rst:515 +msgid "" +">>> calcsize('@llh0l')\n" +"24" +msgstr "" +">>> calcsize('@llh0l')\n" +"24" -#: library/struct.rst:497 +#: library/struct.rst:518 msgid "" "The ``'x'`` format code can be used to specify the repeat, but for native " "formats it is better to use a zero-repeat format like ``'0l'``." msgstr "" +"Ο κωδικός μορφοποίησης ``'x'`` μπορεί να χρησιμοποιηθεί για να καθορίσει την " +"επανάληψη, αλλά για native μορφές είναι προτιμότερο να χρησιμοποιείται ένας " +"κωδικός μορφοποίησης με επανάληψη μηδέν, όπως ``'0l'``." -#: library/struct.rst:500 +#: library/struct.rst:521 msgid "" "By default, native byte ordering and alignment is used, but it is better to " "be explicit and use the ``'@'`` prefix character." msgstr "" +"Από προεπιλογή, χρησιμοποιείται η native σειρά byte και στοίχιση, αλλά είναι " +"καλύτερο να είμαστε σαφείς και να χρησιμοποιούμε τον χαρακτήρα πρόθεμα " +"``'@'``." -#: library/struct.rst:507 +#: library/struct.rst:528 msgid "Standard Formats" -msgstr "" +msgstr "Τυπικές μορφές" -#: library/struct.rst:509 +#: library/struct.rst:530 msgid "" "When exchanging data beyond your process such as networking or storage, be " "precise. Specify the exact byte order, size, and alignment. Do not assume " @@ -849,128 +1240,225 @@ msgid "" "must explicitly add ``'x'`` pad bytes where needed. Revisiting the examples " "from the previous section, we have::" msgstr "" - -#: library/struct.rst:536 +"Όταν ανταλλάσετε δεδομένα πέρα από τη διεργασία σας, όπως σε δικτύωση ή " +"αποθήκευση, να είστε ακριβείς. Καθορίστε την ακριβή σειρά των byte, το " +"μέγεθος και την ευθυγράμμιση. Μην υποθέτετε ότι ταιριάζουν με τη φυσική " +"σειρά μιας συγκεκριμένης μηχανής. Για παράδειγμα, η σειρά byte του δικτύου " +"είναι big-endian, ενώ πολλοί δημοφιλείς επεξεργαστές είναι little-endian. " +"Ορίζοντας αυτό ρητά, ο χρήστης δεν χρειάζεται να ενδιαφέρεται για τις " +"λεπτομέρειες της πλατφόρμας στην οποία εκτελείται ο κώδικας. Ο πρώτος " +"χαρακτήρας πρέπει τυπικά να είναι ``<`` ή ``>`` (ή ``!``). Η ευθύνη για την " +"προσθήκη συμπληρωματικών byte ανήκει στον προγραμματιστή. Ο χαρακτήρας " +"μορφής με μηδενική επανάληψη δεν θα λειτουργήσει. Αντ' αυτού, ο χρήστης " +"πρέπει να προσθέτει ρητά byte ``'x'`` όπου απαιτείται. Επανεξετάζοντας τα " +"παραδείγματα από την προηγούμενη ενότητα, έχουμε::" + +#: library/struct.rst:542 +msgid "" +">>> calcsize('>> pack('>> calcsize('@llh')\n" +"18\n" +">>> pack('@llh', 1, 2, 3) == pack('>> calcsize('>> calcsize('@llh0l')\n" +"24\n" +">>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> pack('>> calcsize('@llh')\n" +"18\n" +">>> pack('@llh', 1, 2, 3) == pack('>> calcsize('>> calcsize('@llh0l')\n" +"24\n" +">>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> calcsize('@llh0l')\n" +"12\n" +">>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> calcsize('@llh0l')\n" +"12\n" +">>> pack('@llh0l', 1, 2, 3) == pack(' (greater)" -msgstr "" +msgstr "> (μεγαλύτερο)" -#: library/struct.rst:132 +#: library/struct.rst:136 msgid "! (exclamation)" -msgstr "" +msgstr "! (θαυμαστικό)" -#: library/struct.rst:363 +#: library/struct.rst:384 msgid "? (question mark)" -msgstr "" +msgstr "? (ερωτηματικό)" diff --git a/library/subprocess.po b/library/subprocess.po index 8da69069..56e4c752 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/subprocess.rst:2 -msgid ":mod:`subprocess` --- Subprocess management" +msgid ":mod:`!subprocess` --- Subprocess management" msgstr "" #: library/subprocess.rst:10 @@ -31,6 +32,12 @@ msgid "" "intends to replace several older modules and functions::" msgstr "" +#: library/subprocess.rst:18 +msgid "" +"os.system\n" +"os.spawn*" +msgstr "" + #: library/subprocess.rst:21 msgid "" "Information about how the :mod:`subprocess` module can be used to replace " @@ -41,15 +48,16 @@ msgstr "" msgid ":pep:`324` -- PEP proposing the subprocess module" msgstr "" -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#: library/subprocess.rst:605 library/subprocess.rst:624 +#: library/subprocess.rst:639 library/subprocess.rst:1523 +#: includes/wasm-mobile-notavail.rst:3 +msgid "Availability" msgstr "" -#: includes/wasm-notavail.rst:5 +#: includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" #: library/subprocess.rst:31 @@ -82,14 +90,15 @@ msgstr "" #: library/subprocess.rst:53 msgid "" "If *capture_output* is true, stdout and stderr will be captured. When used, " -"the internal :class:`Popen` object is automatically created with " -"``stdout=PIPE`` and ``stderr=PIPE``. The *stdout* and *stderr* arguments may " -"not be supplied at the same time as *capture_output*. If you wish to " -"capture and combine both streams into one, use ``stdout=PIPE`` and " -"``stderr=STDOUT`` instead of *capture_output*." +"the internal :class:`Popen` object is automatically created with *stdout* " +"and *stderr* both set to :data:`~subprocess.PIPE`. The *stdout* and *stderr* " +"arguments may not be supplied at the same time as *capture_output*. If you " +"wish to capture and combine both streams into one, set *stdout* to :data:" +"`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, instead of " +"using *capture_output*." msgstr "" -#: library/subprocess.rst:60 +#: library/subprocess.rst:62 msgid "" "A *timeout* may be specified in seconds, it is internally passed on to :meth:" "`Popen.communicate`. If the timeout expires, the child process will be " @@ -99,16 +108,16 @@ msgid "" "a timeout exception until at least after however long process creation takes." msgstr "" -#: library/subprocess.rst:68 +#: library/subprocess.rst:70 msgid "" "The *input* argument is passed to :meth:`Popen.communicate` and thus to the " "subprocess's stdin. If used it must be a byte sequence, or a string if " "*encoding* or *errors* is specified or *text* is true. When used, the " -"internal :class:`Popen` object is automatically created with ``stdin=PIPE``, " -"and the *stdin* argument may not be used as well." +"internal :class:`Popen` object is automatically created with *stdin* set to :" +"data:`~subprocess.PIPE`, and the *stdin* argument may not be used as well." msgstr "" -#: library/subprocess.rst:74 +#: library/subprocess.rst:77 msgid "" "If *check* is true, and the process exits with a non-zero exit code, a :exc:" "`CalledProcessError` exception will be raised. Attributes of that exception " @@ -116,7 +125,7 @@ msgid "" "captured." msgstr "" -#: library/subprocess.rst:79 +#: library/subprocess.rst:82 msgid "" "If *encoding* or *errors* are specified, or *text* is true, file objects for " "stdin, stdout and stderr are opened in text mode using the specified " @@ -125,7 +134,7 @@ msgid "" "backwards compatibility. By default, file objects are opened in binary mode." msgstr "" -#: library/subprocess.rst:85 +#: library/subprocess.rst:88 msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " @@ -135,22 +144,38 @@ msgid "" "`os.environb`." msgstr "" -#: library/subprocess.rst:92 +#: library/subprocess.rst:95 msgid "Examples::" msgstr "" -#: library/subprocess.rst:110 +#: library/subprocess.rst:97 +msgid "" +">>> subprocess.run([\"ls\", \"-l\"]) # doesn't capture output\n" +"CompletedProcess(args=['ls', '-l'], returncode=0)\n" +"\n" +">>> subprocess.run(\"exit 1\", shell=True, check=True)\n" +"Traceback (most recent call last):\n" +" ...\n" +"subprocess.CalledProcessError: Command 'exit 1' returned non-zero exit " +"status 1\n" +"\n" +">>> subprocess.run([\"ls\", \"-l\", \"/dev/null\"], capture_output=True)\n" +"CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,\n" +"stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\\n', stderr=b'')" +msgstr "" + +#: library/subprocess.rst:113 msgid "Added *encoding* and *errors* parameters" msgstr "" -#: library/subprocess.rst:114 +#: library/subprocess.rst:117 msgid "" "Added the *text* parameter, as a more understandable alias of " "*universal_newlines*. Added the *capture_output* parameter." msgstr "" -#: library/subprocess.rst:503 library/subprocess.rst:1227 -#: library/subprocess.rst:1290 +#: library/subprocess.rst:506 library/subprocess.rst:1261 +#: library/subprocess.rst:1324 msgid "" "Changed Windows shell search order for ``shell=True``. The current directory " "and ``%PATH%`` are replaced with ``%COMSPEC%`` and ``%SystemRoot%" @@ -158,92 +183,92 @@ msgid "" "exe`` into a current directory no longer works." msgstr "" -#: library/subprocess.rst:127 +#: library/subprocess.rst:130 msgid "" "The return value from :func:`run`, representing a process that has finished." msgstr "" -#: library/subprocess.rst:131 +#: library/subprocess.rst:134 msgid "" "The arguments used to launch the process. This may be a list or a string." msgstr "" -#: library/subprocess.rst:135 +#: library/subprocess.rst:138 msgid "" "Exit status of the child process. Typically, an exit status of 0 indicates " "that it ran successfully." msgstr "" -#: library/subprocess.rst:934 +#: library/subprocess.rst:952 msgid "" "A negative value ``-N`` indicates that the child was terminated by signal " "``N`` (POSIX only)." msgstr "" -#: library/subprocess.rst:143 +#: library/subprocess.rst:146 msgid "" "Captured stdout from the child process. A bytes sequence, or a string if :" "func:`run` was called with an encoding, errors, or text=True. ``None`` if " "stdout was not captured." msgstr "" -#: library/subprocess.rst:147 +#: library/subprocess.rst:150 msgid "" "If you ran the process with ``stderr=subprocess.STDOUT``, stdout and stderr " "will be combined in this attribute, and :attr:`stderr` will be ``None``." msgstr "" -#: library/subprocess.rst:153 +#: library/subprocess.rst:156 msgid "" "Captured stderr from the child process. A bytes sequence, or a string if :" "func:`run` was called with an encoding, errors, or text=True. ``None`` if " "stderr was not captured." msgstr "" -#: library/subprocess.rst:159 +#: library/subprocess.rst:162 msgid "If :attr:`returncode` is non-zero, raise a :exc:`CalledProcessError`." msgstr "" -#: library/subprocess.rst:165 +#: library/subprocess.rst:168 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " "to :class:`Popen` and indicates that the special file :data:`os.devnull` " "will be used." msgstr "" -#: library/subprocess.rst:174 +#: library/subprocess.rst:177 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " "to :class:`Popen` and indicates that a pipe to the standard stream should be " "opened. Most useful with :meth:`Popen.communicate`." msgstr "" -#: library/subprocess.rst:181 +#: library/subprocess.rst:184 msgid "" "Special value that can be used as the *stderr* argument to :class:`Popen` " "and indicates that standard error should go into the same handle as standard " "output." msgstr "" -#: library/subprocess.rst:188 +#: library/subprocess.rst:191 msgid "Base class for all other exceptions from this module." msgstr "" -#: library/subprocess.rst:195 +#: library/subprocess.rst:198 msgid "" "Subclass of :exc:`SubprocessError`, raised when a timeout expires while " "waiting for a child process." msgstr "" -#: library/subprocess.rst:244 +#: library/subprocess.rst:247 msgid "Command that was used to spawn the child process." msgstr "" -#: library/subprocess.rst:204 +#: library/subprocess.rst:207 msgid "Timeout in seconds." msgstr "" -#: library/subprocess.rst:208 +#: library/subprocess.rst:211 msgid "" "Output of the child process if it was captured by :func:`run` or :func:" "`check_output`. Otherwise, ``None``. This is always :class:`bytes` when " @@ -251,11 +276,11 @@ msgid "" "remain ``None`` instead of ``b''`` when no output was observed." msgstr "" -#: library/subprocess.rst:253 +#: library/subprocess.rst:256 msgid "Alias for output, for symmetry with :attr:`stderr`." msgstr "" -#: library/subprocess.rst:220 +#: library/subprocess.rst:223 msgid "" "Stderr output of the child process if it was captured by :func:`run`. " "Otherwise, ``None``. This is always :class:`bytes` when stderr output was " @@ -263,40 +288,40 @@ msgid "" "instead of ``b''`` when no stderr output was observed." msgstr "" -#: library/subprocess.rst:260 +#: library/subprocess.rst:263 msgid "*stdout* and *stderr* attributes added" msgstr "" -#: library/subprocess.rst:232 +#: library/subprocess.rst:235 msgid "" "Subclass of :exc:`SubprocessError`, raised when a process run by :func:" "`check_call`, :func:`check_output`, or :func:`run` (with ``check=True``) " "returns a non-zero exit status." msgstr "" -#: library/subprocess.rst:239 +#: library/subprocess.rst:242 msgid "" "Exit status of the child process. If the process exited due to a signal, " "this will be the negative signal number." msgstr "" -#: library/subprocess.rst:248 +#: library/subprocess.rst:251 msgid "" "Output of the child process if it was captured by :func:`run` or :func:" "`check_output`. Otherwise, ``None``." msgstr "" -#: library/subprocess.rst:257 +#: library/subprocess.rst:260 msgid "" "Stderr output of the child process if it was captured by :func:`run`. " "Otherwise, ``None``." msgstr "" -#: library/subprocess.rst:267 +#: library/subprocess.rst:270 msgid "Frequently Used Arguments" msgstr "" -#: library/subprocess.rst:269 +#: library/subprocess.rst:272 msgid "" "To support a wide variety of use cases, the :class:`Popen` constructor (and " "the convenience functions) accept a large number of optional arguments. For " @@ -304,7 +329,7 @@ msgid "" "default values. The arguments that are most commonly needed are:" msgstr "" -#: library/subprocess.rst:274 +#: library/subprocess.rst:277 msgid "" "*args* is required for all calls and should be a string, or a sequence of " "program arguments. Providing a sequence of arguments is generally preferred, " @@ -314,7 +339,7 @@ msgid "" "simply name the program to be executed without specifying any arguments." msgstr "" -#: library/subprocess.rst:282 +#: library/subprocess.rst:285 msgid "" "*stdin*, *stdout* and *stderr* specify the executed program's standard " "input, standard output and standard error file handles, respectively. Valid " @@ -328,7 +353,7 @@ msgid "" "captured into the same file handle as for *stdout*." msgstr "" -#: library/subprocess.rst:296 +#: library/subprocess.rst:299 msgid "" "If *encoding* or *errors* are specified, or *text* (also known as " "*universal_newlines*) is true, the file objects *stdin*, *stdout* and " @@ -336,7 +361,7 @@ msgid "" "specified in the call or the defaults for :class:`io.TextIOWrapper`." msgstr "" -#: library/subprocess.rst:302 +#: library/subprocess.rst:305 msgid "" "For *stdin*, line ending characters ``'\\n'`` in the input will be converted " "to the default line separator :data:`os.linesep`. For *stdout* and *stderr*, " @@ -345,28 +370,28 @@ msgid "" "when the *newline* argument to its constructor is ``None``." msgstr "" -#: library/subprocess.rst:308 +#: library/subprocess.rst:311 msgid "" "If text mode is not used, *stdin*, *stdout* and *stderr* will be opened as " "binary streams. No encoding or line ending conversion is performed." msgstr "" -#: library/subprocess.rst:1542 library/subprocess.rst:1560 +#: library/subprocess.rst:1510 library/subprocess.rst:1528 msgid "Added the *encoding* and *errors* parameters." msgstr "" -#: library/subprocess.rst:314 +#: library/subprocess.rst:317 msgid "Added the *text* parameter as an alias for *universal_newlines*." msgstr "" -#: library/subprocess.rst:319 +#: library/subprocess.rst:322 msgid "" "The newlines attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen." "stdout` and :attr:`Popen.stderr` are not updated by the :meth:`Popen." "communicate` method." msgstr "" -#: library/subprocess.rst:323 +#: library/subprocess.rst:326 msgid "" "If *shell* is ``True``, the specified command will be executed through the " "shell. This can be useful if you are using Python primarily for the " @@ -379,7 +404,7 @@ msgid "" "expanduser`, and :mod:`shutil`)." msgstr "" -#: library/subprocess.rst:333 +#: library/subprocess.rst:336 msgid "" "When *universal_newlines* is ``True``, the class uses the encoding :func:" "`locale.getpreferredencoding(False) ` instead " @@ -387,22 +412,22 @@ msgid "" "class for more information on this change." msgstr "" -#: library/subprocess.rst:462 +#: library/subprocess.rst:465 msgid "" "Read the `Security Considerations`_ section before using ``shell=True``." msgstr "" -#: library/subprocess.rst:343 +#: library/subprocess.rst:346 msgid "" "These options, along with all of the other options, are described in more " "detail in the :class:`Popen` constructor documentation." msgstr "" -#: library/subprocess.rst:348 +#: library/subprocess.rst:351 msgid "Popen Constructor" msgstr "" -#: library/subprocess.rst:350 +#: library/subprocess.rst:353 msgid "" "The underlying process creation and management in this module is handled by " "the :class:`Popen` class. It offers a lot of flexibility so that developers " @@ -410,7 +435,7 @@ msgid "" "functions." msgstr "" -#: library/subprocess.rst:365 +#: library/subprocess.rst:368 msgid "" "Execute a child program in a new process. On POSIX, the class uses :meth:" "`os.execvpe`-like behavior to execute the child program. On Windows, the " @@ -418,7 +443,7 @@ msgid "" "class:`Popen` are as follows." msgstr "" -#: library/subprocess.rst:370 +#: library/subprocess.rst:373 msgid "" "*args* should be a sequence of program arguments or else a single string or :" "term:`path-like object`. By default, the program to execute is the first " @@ -429,7 +454,7 @@ msgid "" "sequence." msgstr "" -#: library/subprocess.rst:380 +#: library/subprocess.rst:383 msgid "" "For maximum reliability, use a fully qualified path for the executable. To " "search for an unqualified name on :envvar:`PATH`, use :meth:`shutil.which`. " @@ -438,7 +463,7 @@ msgid "" "format to launch an installed module." msgstr "" -#: library/subprocess.rst:386 +#: library/subprocess.rst:389 msgid "" "Resolving the path of *executable* (or the first item of *args*) is platform " "dependent. For POSIX, see :meth:`os.execvpe`, and note that when resolving " @@ -452,27 +477,44 @@ msgid "" "variations." msgstr "" -#: library/subprocess.rst:397 +#: library/subprocess.rst:400 msgid "" "An example of passing some arguments to an external program as a sequence " "is::" msgstr "" -#: library/subprocess.rst:402 +#: library/subprocess.rst:403 +msgid "Popen([\"/usr/bin/git\", \"commit\", \"-m\", \"Fixes a bug.\"])" +msgstr "" + +#: library/subprocess.rst:405 msgid "" "On POSIX, if *args* is a string, the string is interpreted as the name or " "path of the program to execute. However, this can only be done if not " "passing arguments to the program." msgstr "" -#: library/subprocess.rst:408 +#: library/subprocess.rst:411 msgid "" "It may not be obvious how to break a shell command into a sequence of " "arguments, especially in complex cases. :meth:`shlex.split` can illustrate " "how to determine the correct tokenization for *args*::" msgstr "" -#: library/subprocess.rst:420 +#: library/subprocess.rst:415 +msgid "" +">>> import shlex, subprocess\n" +">>> command_line = input()\n" +"/bin/vikings -input eggs.txt -output \"spam spam.txt\" -cmd \"echo " +"'$MONEY'\"\n" +">>> args = shlex.split(command_line)\n" +">>> print(args)\n" +"['/bin/vikings', '-input', 'eggs.txt', '-output', 'spam spam.txt', '-cmd', " +"\"echo '$MONEY'\"]\n" +">>> p = subprocess.Popen(args) # Success!" +msgstr "" + +#: library/subprocess.rst:423 msgid "" "Note in particular that options (such as *-input*) and arguments (such as " "*eggs.txt*) that are separated by whitespace in the shell go in separate " @@ -481,33 +523,33 @@ msgid "" "shown above) are single list elements." msgstr "" -#: library/subprocess.rst:426 +#: library/subprocess.rst:429 msgid "" "On Windows, if *args* is a sequence, it will be converted to a string in a " "manner described in :ref:`converting-argument-sequence`. This is because " "the underlying ``CreateProcess()`` operates on strings." msgstr "" -#: library/subprocess.rst:430 +#: library/subprocess.rst:433 msgid "" "*args* parameter accepts a :term:`path-like object` if *shell* is ``False`` " "and a sequence containing path-like objects on POSIX." msgstr "" -#: library/subprocess.rst:434 +#: library/subprocess.rst:437 msgid "" "*args* parameter accepts a :term:`path-like object` if *shell* is ``False`` " "and a sequence containing bytes and path-like objects on Windows." msgstr "" -#: library/subprocess.rst:439 +#: library/subprocess.rst:442 msgid "" "The *shell* argument (which defaults to ``False``) specifies whether to use " "the shell as the program to execute. If *shell* is ``True``, it is " "recommended to pass *args* as a string rather than as a sequence." msgstr "" -#: library/subprocess.rst:443 +#: library/subprocess.rst:446 msgid "" "On POSIX with ``shell=True``, the shell defaults to :file:`/bin/sh`. If " "*args* is a string, the string specifies the command to execute through the " @@ -519,7 +561,11 @@ msgid "" "class:`Popen` does the equivalent of::" msgstr "" -#: library/subprocess.rst:454 +#: library/subprocess.rst:455 +msgid "Popen(['/bin/sh', '-c', args[0], args[1], ...])" +msgstr "" + +#: library/subprocess.rst:457 msgid "" "On Windows with ``shell=True``, the :envvar:`COMSPEC` environment variable " "specifies the default shell. The only time you need to specify " @@ -528,35 +574,35 @@ msgid "" "``shell=True`` to run a batch file or console-based executable." msgstr "" -#: library/subprocess.rst:464 +#: library/subprocess.rst:467 msgid "" "*bufsize* will be supplied as the corresponding argument to the :func:`open` " "function when creating the stdin/stdout/stderr pipe file objects:" msgstr "" -#: library/subprocess.rst:468 +#: library/subprocess.rst:471 msgid "" "``0`` means unbuffered (read and write are one system call and can return " "short)" msgstr "" -#: library/subprocess.rst:470 +#: library/subprocess.rst:473 msgid "" "``1`` means line buffered (only usable if ``text=True`` or " "``universal_newlines=True``)" msgstr "" -#: library/subprocess.rst:472 +#: library/subprocess.rst:475 msgid "any other positive value means use a buffer of approximately that size" msgstr "" -#: library/subprocess.rst:474 +#: library/subprocess.rst:477 msgid "" "negative bufsize (the default) means the system default of io." "DEFAULT_BUFFER_SIZE will be used." msgstr "" -#: library/subprocess.rst:477 +#: library/subprocess.rst:480 msgid "" "*bufsize* now defaults to -1 to enable buffering by default to match the " "behavior that most code expects. In versions prior to Python 3.2.4 and " @@ -565,7 +611,7 @@ msgid "" "Python 2 as most code expected." msgstr "" -#: library/subprocess.rst:484 +#: library/subprocess.rst:487 msgid "" "The *executable* argument specifies a replacement program to execute. It " "is very seldom needed. When ``shell=False``, *executable* replaces the " @@ -578,17 +624,17 @@ msgid "" "default :file:`/bin/sh`." msgstr "" -#: library/subprocess.rst:494 +#: library/subprocess.rst:497 msgid "*executable* parameter accepts a :term:`path-like object` on POSIX." msgstr "" -#: library/subprocess.rst:497 +#: library/subprocess.rst:500 msgid "" "*executable* parameter accepts a bytes and :term:`path-like object` on " "Windows." msgstr "" -#: library/subprocess.rst:509 +#: library/subprocess.rst:512 msgid "" "*stdin*, *stdout* and *stderr* specify the executed program's standard " "input, standard output and standard error file handles, respectively. Valid " @@ -602,19 +648,19 @@ msgid "" "captured into the same file handle as for *stdout*." msgstr "" -#: library/subprocess.rst:520 +#: library/subprocess.rst:523 msgid "" "If *preexec_fn* is set to a callable object, this object will be called in " "the child process just before the child is executed. (POSIX only)" msgstr "" -#: library/subprocess.rst:526 +#: library/subprocess.rst:529 msgid "" "The *preexec_fn* parameter is NOT SAFE to use in the presence of threads in " "your application. The child process could deadlock before exec is called." msgstr "" -#: library/subprocess.rst:532 +#: library/subprocess.rst:535 msgid "" "If you need to modify the environment for the child use the *env* parameter " "rather than doing it in a *preexec_fn*. The *start_new_session* and " @@ -622,7 +668,7 @@ msgid "" "to call :func:`os.setsid` or :func:`os.setpgid` in the child." msgstr "" -#: library/subprocess.rst:539 +#: library/subprocess.rst:542 msgid "" "The *preexec_fn* parameter is no longer supported in subinterpreters. The " "use of the parameter in a subinterpreter raises :exc:`RuntimeError`. The new " @@ -630,7 +676,7 @@ msgid "" "and other embedded environments." msgstr "" -#: library/subprocess.rst:544 +#: library/subprocess.rst:547 msgid "" "If *close_fds* is true, all file descriptors except ``0``, ``1`` and ``2`` " "will be closed before the child process is executed. Otherwise when " @@ -638,38 +684,38 @@ msgid "" "described in :ref:`fd_inheritance`." msgstr "" -#: library/subprocess.rst:549 +#: library/subprocess.rst:552 msgid "" "On Windows, if *close_fds* is true then no handles will be inherited by the " "child process unless explicitly passed in the ``handle_list`` element of :" "attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." msgstr "" -#: library/subprocess.rst:553 +#: library/subprocess.rst:556 msgid "" "The default for *close_fds* was changed from :const:`False` to what is " "described above." msgstr "" -#: library/subprocess.rst:557 +#: library/subprocess.rst:560 msgid "" "On Windows the default for *close_fds* was changed from :const:`False` to :" "const:`True` when redirecting the standard handles. It's now possible to set " "*close_fds* to :const:`True` when redirecting the standard handles." msgstr "" -#: library/subprocess.rst:562 +#: library/subprocess.rst:565 msgid "" "*pass_fds* is an optional sequence of file descriptors to keep open between " "the parent and child. Providing any *pass_fds* forces *close_fds* to be :" "const:`True`. (POSIX only)" msgstr "" -#: library/subprocess.rst:566 +#: library/subprocess.rst:569 msgid "The *pass_fds* parameter was added." msgstr "" -#: library/subprocess.rst:569 +#: library/subprocess.rst:572 msgid "" "If *cwd* is not ``None``, the function changes the working directory to " "*cwd* before executing the child. *cwd* can be a string, bytes or :term:" @@ -678,89 +724,84 @@ msgid "" "executable path is a relative path." msgstr "" -#: library/subprocess.rst:575 +#: library/subprocess.rst:578 msgid "*cwd* parameter accepts a :term:`path-like object` on POSIX." msgstr "" -#: library/subprocess.rst:578 +#: library/subprocess.rst:581 msgid "*cwd* parameter accepts a :term:`path-like object` on Windows." msgstr "" -#: library/subprocess.rst:581 +#: library/subprocess.rst:584 msgid "*cwd* parameter accepts a bytes object on Windows." msgstr "" -#: library/subprocess.rst:584 +#: library/subprocess.rst:587 msgid "" "If *restore_signals* is true (the default) all signals that Python has set " "to SIG_IGN are restored to SIG_DFL in the child process before the exec. " "Currently this includes the SIGPIPE, SIGXFZ and SIGXFSZ signals. (POSIX only)" msgstr "" -#: library/subprocess.rst:589 +#: library/subprocess.rst:592 msgid "*restore_signals* was added." msgstr "" -#: library/subprocess.rst:592 +#: library/subprocess.rst:595 msgid "" "If *start_new_session* is true the ``setsid()`` system call will be made in " "the child process prior to the execution of the subprocess." msgstr "" -#: library/subprocess.rst:602 library/subprocess.rst:621 -#: library/subprocess.rst:636 -msgid ":ref:`Availability `: POSIX" -msgstr "" - -#: library/subprocess.rst:596 +#: library/subprocess.rst:599 msgid "*start_new_session* was added." msgstr "" -#: library/subprocess.rst:599 +#: library/subprocess.rst:602 msgid "" "If *process_group* is a non-negative integer, the ``setpgid(0, value)`` " "system call will be made in the child process prior to the execution of the " "subprocess." msgstr "" -#: library/subprocess.rst:603 +#: library/subprocess.rst:606 msgid "*process_group* was added." msgstr "" -#: library/subprocess.rst:606 +#: library/subprocess.rst:609 msgid "" "If *group* is not ``None``, the setregid() system call will be made in the " "child process prior to the execution of the subprocess. If the provided " -"value is a string, it will be looked up via :func:`grp.getgrnam()` and the " +"value is a string, it will be looked up via :func:`grp.getgrnam` and the " "value in ``gr_gid`` will be used. If the value is an integer, it will be " "passed verbatim. (POSIX only)" msgstr "" -#: library/subprocess.rst:615 +#: library/subprocess.rst:618 msgid "" "If *extra_groups* is not ``None``, the setgroups() system call will be made " "in the child process prior to the execution of the subprocess. Strings " -"provided in *extra_groups* will be looked up via :func:`grp.getgrnam()` and " +"provided in *extra_groups* will be looked up via :func:`grp.getgrnam` and " "the values in ``gr_gid`` will be used. Integer values will be passed " "verbatim. (POSIX only)" msgstr "" -#: library/subprocess.rst:624 +#: library/subprocess.rst:627 msgid "" "If *user* is not ``None``, the setreuid() system call will be made in the " "child process prior to the execution of the subprocess. If the provided " -"value is a string, it will be looked up via :func:`pwd.getpwnam()` and the " +"value is a string, it will be looked up via :func:`pwd.getpwnam` and the " "value in ``pw_uid`` will be used. If the value is an integer, it will be " "passed verbatim. (POSIX only)" msgstr "" -#: library/subprocess.rst:633 +#: library/subprocess.rst:636 msgid "" "If *umask* is not negative, the umask() system call will be made in the " "child process prior to the execution of the subprocess." msgstr "" -#: library/subprocess.rst:639 +#: library/subprocess.rst:642 msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " @@ -769,14 +810,14 @@ msgid "" "data:`os.environ` or :data:`os.environb`." msgstr "" -#: library/subprocess.rst:647 +#: library/subprocess.rst:650 msgid "" "If specified, *env* must provide any variables required for the program to " "execute. On Windows, in order to run a `side-by-side assembly`_ the " -"specified *env* **must** include a valid :envvar:`SystemRoot`." +"specified *env* **must** include a valid ``%SystemRoot%``." msgstr "" -#: library/subprocess.rst:653 +#: library/subprocess.rst:656 msgid "" "If *encoding* or *errors* are specified, or *text* is true, the file objects " "*stdin*, *stdout* and *stderr* are opened in text mode with the specified " @@ -786,73 +827,73 @@ msgid "" "in binary mode." msgstr "" -#: library/subprocess.rst:659 +#: library/subprocess.rst:662 msgid "*encoding* and *errors* were added." msgstr "" -#: library/subprocess.rst:1285 +#: library/subprocess.rst:1319 msgid "*text* was added as a more readable alias for *universal_newlines*." msgstr "" -#: library/subprocess.rst:665 +#: library/subprocess.rst:668 msgid "" "If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is " "passed to the underlying ``CreateProcess`` function." msgstr "" -#: library/subprocess.rst:668 +#: library/subprocess.rst:671 msgid "If given, *creationflags*, can be one or more of the following flags:" msgstr "" -#: library/subprocess.rst:670 +#: library/subprocess.rst:673 msgid ":data:`CREATE_NEW_CONSOLE`" msgstr "" -#: library/subprocess.rst:671 +#: library/subprocess.rst:674 msgid ":data:`CREATE_NEW_PROCESS_GROUP`" msgstr "" -#: library/subprocess.rst:672 +#: library/subprocess.rst:675 msgid ":data:`ABOVE_NORMAL_PRIORITY_CLASS`" msgstr "" -#: library/subprocess.rst:673 +#: library/subprocess.rst:676 msgid ":data:`BELOW_NORMAL_PRIORITY_CLASS`" msgstr "" -#: library/subprocess.rst:674 +#: library/subprocess.rst:677 msgid ":data:`HIGH_PRIORITY_CLASS`" msgstr "" -#: library/subprocess.rst:675 +#: library/subprocess.rst:678 msgid ":data:`IDLE_PRIORITY_CLASS`" msgstr "" -#: library/subprocess.rst:676 +#: library/subprocess.rst:679 msgid ":data:`NORMAL_PRIORITY_CLASS`" msgstr "" -#: library/subprocess.rst:677 +#: library/subprocess.rst:680 msgid ":data:`REALTIME_PRIORITY_CLASS`" msgstr "" -#: library/subprocess.rst:678 +#: library/subprocess.rst:681 msgid ":data:`CREATE_NO_WINDOW`" msgstr "" -#: library/subprocess.rst:679 +#: library/subprocess.rst:682 msgid ":data:`DETACHED_PROCESS`" msgstr "" -#: library/subprocess.rst:680 +#: library/subprocess.rst:683 msgid ":data:`CREATE_DEFAULT_ERROR_MODE`" msgstr "" -#: library/subprocess.rst:681 +#: library/subprocess.rst:684 msgid ":data:`CREATE_BREAKAWAY_FROM_JOB`" msgstr "" -#: library/subprocess.rst:683 +#: library/subprocess.rst:686 msgid "" "*pipesize* can be used to change the size of the pipe when :data:`PIPE` is " "used for *stdin*, *stdout* or *stderr*. The size of the pipe is only changed " @@ -860,24 +901,24 @@ msgid "" "platforms will ignore this parameter." msgstr "" -#: library/subprocess.rst:688 +#: library/subprocess.rst:691 msgid "Added the *pipesize* parameter." msgstr "" -#: library/subprocess.rst:691 +#: library/subprocess.rst:694 msgid "" "Popen objects are supported as context managers via the :keyword:`with` " "statement: on exit, standard file descriptors are closed, and the process is " "waited for. ::" msgstr "" -#: library/subprocess.rst:709 +#: library/subprocess.rst:698 msgid "" -"Raises an :ref:`auditing event ` ``subprocess.Popen`` with " -"arguments ``executable``, ``args``, ``cwd``, ``env``." +"with Popen([\"ifconfig\"], stdout=PIPE) as proc:\n" +" log.write(proc.stdout.read())" msgstr "" -#: library/subprocess.rst:700 +#: library/subprocess.rst:703 msgid "" "Popen and the other functions in this module that use it raise an :ref:" "`auditing event ` ``subprocess.Popen`` with arguments " @@ -885,17 +926,17 @@ msgid "" "be a single string or a list of strings, depending on platform." msgstr "" -#: library/subprocess.rst:705 +#: library/subprocess.rst:708 msgid "Added context manager support." msgstr "" -#: library/subprocess.rst:708 +#: library/subprocess.rst:711 msgid "" "Popen destructor now emits a :exc:`ResourceWarning` warning if the child " "process is still running." msgstr "" -#: library/subprocess.rst:712 +#: library/subprocess.rst:715 msgid "" "Popen can use :func:`os.posix_spawn` in some cases for better performance. " "On Windows Subsystem for Linux and QEMU User Emulation, Popen constructor " @@ -904,17 +945,17 @@ msgid "" "returncode`." msgstr "" -#: library/subprocess.rst:721 +#: library/subprocess.rst:724 msgid "Exceptions" msgstr "" -#: library/subprocess.rst:723 +#: library/subprocess.rst:726 msgid "" "Exceptions raised in the child process, before the new program has started " "to execute, will be re-raised in the parent." msgstr "" -#: library/subprocess.rst:726 +#: library/subprocess.rst:729 msgid "" "The most common exception raised is :exc:`OSError`. This occurs, for " "example, when trying to execute a non-existent file. Applications should " @@ -925,42 +966,42 @@ msgid "" "subprocess." msgstr "" -#: library/subprocess.rst:733 +#: library/subprocess.rst:736 msgid "" "A :exc:`ValueError` will be raised if :class:`Popen` is called with invalid " "arguments." msgstr "" -#: library/subprocess.rst:736 +#: library/subprocess.rst:739 msgid "" ":func:`check_call` and :func:`check_output` will raise :exc:" "`CalledProcessError` if the called process returns a non-zero return code." msgstr "" -#: library/subprocess.rst:740 +#: library/subprocess.rst:743 msgid "" "All of the functions and methods that accept a *timeout* parameter, such as :" "func:`run` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` if " "the timeout expires before the process exits." msgstr "" -#: library/subprocess.rst:744 +#: library/subprocess.rst:747 msgid "" "Exceptions defined in this module all inherit from :exc:`SubprocessError`." msgstr "" -#: library/subprocess.rst:746 +#: library/subprocess.rst:749 msgid "The :exc:`SubprocessError` base class was added." msgstr "" -#: library/subprocess.rst:752 +#: library/subprocess.rst:755 msgid "Security Considerations" msgstr "" -#: library/subprocess.rst:754 +#: library/subprocess.rst:757 msgid "" -"Unlike some other popen functions, this implementation will never implicitly " -"call a system shell. This means that all characters, including shell " +"Unlike some other popen functions, this library will not implicitly choose " +"to call a system shell. This means that all characters, including shell " "metacharacters, can safely be passed to child processes. If the shell is " "invoked explicitly, via ``shell=True``, it is the application's " "responsibility to ensure that all whitespace and metacharacters are quoted " @@ -970,34 +1011,45 @@ msgid "" "escaping." msgstr "" -#: library/subprocess.rst:766 +#: library/subprocess.rst:767 +msgid "" +"On Windows, batch files (:file:`*.bat` or :file:`*.cmd`) may be launched by " +"the operating system in a system shell regardless of the arguments passed to " +"this library. This could result in arguments being parsed according to shell " +"rules, but without any escaping added by Python. If you are intentionally " +"launching a batch file with arguments from untrusted sources, consider " +"passing ``shell=True`` to allow Python to escape special characters. See :gh:" +"`114539` for additional discussion." +msgstr "" + +#: library/subprocess.rst:777 msgid "Popen Objects" msgstr "" -#: library/subprocess.rst:768 +#: library/subprocess.rst:779 msgid "Instances of the :class:`Popen` class have the following methods:" msgstr "" -#: library/subprocess.rst:773 +#: library/subprocess.rst:784 msgid "" "Check if child process has terminated. Set and return :attr:`~Popen." "returncode` attribute. Otherwise, returns ``None``." msgstr "" -#: library/subprocess.rst:779 +#: library/subprocess.rst:790 msgid "" "Wait for child process to terminate. Set and return :attr:`~Popen." "returncode` attribute." msgstr "" -#: library/subprocess.rst:782 +#: library/subprocess.rst:793 msgid "" "If the process does not terminate after *timeout* seconds, raise a :exc:" "`TimeoutExpired` exception. It is safe to catch this exception and retry " "the wait." msgstr "" -#: library/subprocess.rst:788 +#: library/subprocess.rst:799 msgid "" "This will deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and the " "child process generates enough output to a pipe such that it blocks waiting " @@ -1005,7 +1057,7 @@ msgid "" "when using pipes to avoid that." msgstr "" -#: library/subprocess.rst:795 +#: library/subprocess.rst:806 msgid "" "When the ``timeout`` parameter is not ``None``, then (on POSIX) the function " "is implemented using a busy loop (non-blocking call and short sleeps). Use " @@ -1013,12 +1065,12 @@ msgid "" "create_subprocess_exec`." msgstr "" -#: library/subprocess.rst:841 library/subprocess.rst:1222 -#: library/subprocess.rst:1276 +#: library/subprocess.rst:859 library/subprocess.rst:1256 +#: library/subprocess.rst:1310 msgid "*timeout* was added." msgstr "" -#: library/subprocess.rst:805 +#: library/subprocess.rst:816 msgid "" "Interact with process: Send data to stdin. Read data from stdout and " "stderr, until end-of-file is reached. Wait for process to terminate and set " @@ -1028,13 +1080,13 @@ msgid "" "must be a string. Otherwise, it must be bytes." msgstr "" -#: library/subprocess.rst:812 +#: library/subprocess.rst:823 msgid "" ":meth:`communicate` returns a tuple ``(stdout_data, stderr_data)``. The data " "will be strings if streams were opened in text mode; otherwise, bytes." msgstr "" -#: library/subprocess.rst:816 +#: library/subprocess.rst:827 msgid "" "Note that if you want to send data to the process's stdin, you need to " "create the Popen object with ``stdin=PIPE``. Similarly, to get anything " @@ -1042,67 +1094,87 @@ msgid "" "and/or ``stderr=PIPE`` too." msgstr "" -#: library/subprocess.rst:821 +#: library/subprocess.rst:832 msgid "" "If the process does not terminate after *timeout* seconds, a :exc:" "`TimeoutExpired` exception will be raised. Catching this exception and " -"retrying communication will not lose any output." +"retrying communication will not lose any output. Supplying *input* to a " +"subsequent post-timeout :meth:`communicate` call is in undefined behavior " +"and may become an error in the future." msgstr "" -#: library/subprocess.rst:825 +#: library/subprocess.rst:838 msgid "" "The child process is not killed if the timeout expires, so in order to " "cleanup properly a well-behaved application should kill the child process " "and finish communication::" msgstr "" -#: library/subprocess.rst:838 +#: library/subprocess.rst:842 +msgid "" +"proc = subprocess.Popen(...)\n" +"try:\n" +" outs, errs = proc.communicate(timeout=15)\n" +"except TimeoutExpired:\n" +" proc.kill()\n" +" outs, errs = proc.communicate()" +msgstr "" + +#: library/subprocess.rst:849 +msgid "" +"After a call to :meth:`~Popen.communicate` raises :exc:`TimeoutExpired`, do " +"not call :meth:`~Popen.wait`. Use an additional :meth:`~Popen.communicate` " +"call to finish handling pipes and populate the :attr:`~Popen.returncode` " +"attribute." +msgstr "" + +#: library/subprocess.rst:856 msgid "" "The data read is buffered in memory, so do not use this method if the data " "size is large or unlimited." msgstr "" -#: library/subprocess.rst:847 +#: library/subprocess.rst:865 msgid "Sends the signal *signal* to the child." msgstr "" -#: library/subprocess.rst:849 +#: library/subprocess.rst:867 msgid "Do nothing if the process completed." msgstr "" -#: library/subprocess.rst:853 +#: library/subprocess.rst:871 msgid "" "On Windows, SIGTERM is an alias for :meth:`terminate`. CTRL_C_EVENT and " "CTRL_BREAK_EVENT can be sent to processes started with a *creationflags* " "parameter which includes ``CREATE_NEW_PROCESS_GROUP``." msgstr "" -#: library/subprocess.rst:860 +#: library/subprocess.rst:878 msgid "" "Stop the child. On POSIX OSs the method sends :py:const:`~signal.SIGTERM` to " "the child. On Windows the Win32 API function :c:func:`!TerminateProcess` is " "called to stop the child." msgstr "" -#: library/subprocess.rst:867 +#: library/subprocess.rst:885 msgid "" "Kills the child. On POSIX OSs the function sends SIGKILL to the child. On " "Windows :meth:`kill` is an alias for :meth:`terminate`." msgstr "" -#: library/subprocess.rst:871 +#: library/subprocess.rst:889 msgid "" "The following attributes are also set by the class for you to access. " "Reassigning them to new values is unsupported:" msgstr "" -#: library/subprocess.rst:876 +#: library/subprocess.rst:894 msgid "" "The *args* argument as it was passed to :class:`Popen` -- a sequence of " "program arguments or else a single string." msgstr "" -#: library/subprocess.rst:883 +#: library/subprocess.rst:901 msgid "" "If the *stdin* argument was :data:`PIPE`, this attribute is a writeable " "stream object as returned by :func:`open`. If the *encoding* or *errors* " @@ -1111,7 +1183,7 @@ msgid "" "*stdin* argument was not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: library/subprocess.rst:892 +#: library/subprocess.rst:910 msgid "" "If the *stdout* argument was :data:`PIPE`, this attribute is a readable " "stream object as returned by :func:`open`. Reading from the stream provides " @@ -1121,7 +1193,7 @@ msgid "" "argument was not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: library/subprocess.rst:902 +#: library/subprocess.rst:920 msgid "" "If the *stderr* argument was :data:`PIPE`, this attribute is a readable " "stream object as returned by :func:`open`. Reading from the stream provides " @@ -1131,7 +1203,7 @@ msgid "" "argument was not :data:`PIPE`, this attribute is ``None``." msgstr "" -#: library/subprocess.rst:911 +#: library/subprocess.rst:929 msgid "" "Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write `, :attr:`.stdout.read ` or :attr:`.stderr.read `__ structure is used for :class:`Popen` " @@ -1180,38 +1252,45 @@ msgid "" "only arguments." msgstr "" -#: library/subprocess.rst:952 +#: library/subprocess.rst:970 msgid "Keyword-only argument support was added." msgstr "" -#: library/subprocess.rst:957 +#: library/subprocess.rst:975 msgid "" "A bit field that determines whether certain :class:`STARTUPINFO` attributes " "are used when the process creates a window. ::" msgstr "" -#: library/subprocess.rst:965 +#: library/subprocess.rst:978 +msgid "" +"si = subprocess.STARTUPINFO()\n" +"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." +"STARTF_USESHOWWINDOW" +msgstr "" + +#: library/subprocess.rst:983 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` " "is not specified, the default for standard input is the keyboard buffer." msgstr "" -#: library/subprocess.rst:972 +#: library/subprocess.rst:990 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard output handle for the process. Otherwise, this attribute is " "ignored and the default for standard output is the console window's buffer." msgstr "" -#: library/subprocess.rst:979 +#: library/subprocess.rst:997 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard error handle for the process. Otherwise, this attribute is " "ignored and the default for standard error is the console window's buffer." msgstr "" -#: library/subprocess.rst:985 +#: library/subprocess.rst:1003 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute " "can be any of the values that can be specified in the ``nCmdShow`` parameter " @@ -1220,34 +1299,34 @@ msgid "" "Otherwise, this attribute is ignored." msgstr "" -#: library/subprocess.rst:992 +#: library/subprocess.rst:1010 msgid "" ":data:`SW_HIDE` is provided for this attribute. It is used when :class:" "`Popen` is called with ``shell=True``." msgstr "" -#: library/subprocess.rst:997 +#: library/subprocess.rst:1015 msgid "" "A dictionary of additional attributes for process creation as given in " "``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." msgstr "" -#: library/subprocess.rst:1001 +#: library/subprocess.rst:1019 msgid "Supported attributes:" msgstr "" -#: library/subprocess.rst:1019 +#: library/subprocess.rst:1021 msgid "**handle_list**" msgstr "" -#: library/subprocess.rst:1004 +#: library/subprocess.rst:1022 msgid "" "Sequence of handles that will be inherited. *close_fds* must be true if non-" "empty." msgstr "" -#: library/subprocess.rst:1007 +#: library/subprocess.rst:1025 msgid "" "The handles must be temporarily made inheritable by :func:`os." "set_handle_inheritable` when passed to the :class:`Popen` constructor, else :" @@ -1255,7 +1334,7 @@ msgid "" "``ERROR_INVALID_PARAMETER`` (87)." msgstr "" -#: library/subprocess.rst:1014 +#: library/subprocess.rst:1032 msgid "" "In a multithreaded process, use caution to avoid leaking handles that are " "marked inheritable when combining this feature with concurrent calls to " @@ -1264,97 +1343,110 @@ msgid "" "temporarily creates inheritable handles." msgstr "" -#: library/subprocess.rst:1024 +#: library/subprocess.rst:1042 msgid "Windows Constants" msgstr "" -#: library/subprocess.rst:1026 +#: library/subprocess.rst:1044 msgid "The :mod:`subprocess` module exposes the following constants." msgstr "" -#: library/subprocess.rst:1030 +#: library/subprocess.rst:1048 msgid "" "The standard input device. Initially, this is the console input buffer, " "``CONIN$``." msgstr "" -#: library/subprocess.rst:1035 +#: library/subprocess.rst:1053 msgid "" "The standard output device. Initially, this is the active console screen " "buffer, ``CONOUT$``." msgstr "" -#: library/subprocess.rst:1040 +#: library/subprocess.rst:1058 msgid "" "The standard error device. Initially, this is the active console screen " "buffer, ``CONOUT$``." msgstr "" -#: library/subprocess.rst:1045 +#: library/subprocess.rst:1063 msgid "Hides the window. Another window will be activated." msgstr "" -#: library/subprocess.rst:1049 +#: library/subprocess.rst:1067 msgid "" "Specifies that the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO." "hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional " "information." msgstr "" -#: library/subprocess.rst:1055 +#: library/subprocess.rst:1073 msgid "" "Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains " "additional information." msgstr "" -#: library/subprocess.rst:1060 +#: library/subprocess.rst:1078 +msgid "" +"A :attr:`STARTUPINFO.dwFlags` parameter to specify that the *Working in " +"Background* mouse cursor will be displayed while a process is launching. " +"This is the default behavior for GUI processes." +msgstr "" + +#: library/subprocess.rst:1087 +msgid "" +"A :attr:`STARTUPINFO.dwFlags` parameter to specify that the mouse cursor " +"will not be changed when launching a process." +msgstr "" + +#: library/subprocess.rst:1094 msgid "" "The new process has a new console, instead of inheriting its parent's " "console (the default)." msgstr "" -#: library/subprocess.rst:1065 +#: library/subprocess.rst:1099 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "group will be created. This flag is necessary for using :func:`os.kill` on " "the subprocess." msgstr "" -#: library/subprocess.rst:1069 +#: library/subprocess.rst:1103 msgid "This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified." msgstr "" -#: library/subprocess.rst:1073 +#: library/subprocess.rst:1107 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an above average priority." msgstr "" -#: library/subprocess.rst:1080 +#: library/subprocess.rst:1114 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a below average priority." msgstr "" -#: library/subprocess.rst:1087 +#: library/subprocess.rst:1121 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a high priority." msgstr "" -#: library/subprocess.rst:1094 +#: library/subprocess.rst:1128 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an idle (lowest) priority." msgstr "" -#: library/subprocess.rst:1101 +#: library/subprocess.rst:1135 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " -"will have an normal priority. (default)" +"will have a normal priority. (default)" msgstr "" -#: library/subprocess.rst:1108 +#: library/subprocess.rst:1142 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have realtime priority. You should almost never use " @@ -1364,20 +1456,20 @@ msgid "" "perform brief tasks that should have limited interruptions." msgstr "" -#: library/subprocess.rst:1119 +#: library/subprocess.rst:1153 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not create a window." msgstr "" -#: library/subprocess.rst:1126 +#: library/subprocess.rst:1160 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not inherit its parent's console. This value cannot be used with " "CREATE_NEW_CONSOLE." msgstr "" -#: library/subprocess.rst:1134 +#: library/subprocess.rst:1168 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "does not inherit the error mode of the calling process. Instead, the new " @@ -1385,39 +1477,43 @@ msgid "" "multithreaded shell applications that run with hard errors disabled." msgstr "" -#: library/subprocess.rst:1144 +#: library/subprocess.rst:1178 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "is not associated with the job." msgstr "" -#: library/subprocess.rst:1152 +#: library/subprocess.rst:1186 msgid "Older high-level API" msgstr "" -#: library/subprocess.rst:1154 +#: library/subprocess.rst:1188 msgid "" "Prior to Python 3.5, these three functions comprised the high level API to " "subprocess. You can now use :func:`run` in many cases, but lots of existing " "code calls these functions." msgstr "" -#: library/subprocess.rst:1161 +#: library/subprocess.rst:1195 msgid "" "Run the command described by *args*. Wait for command to complete, then " "return the :attr:`~Popen.returncode` attribute." msgstr "" -#: library/subprocess.rst:1204 +#: library/subprocess.rst:1238 msgid "" "Code needing to capture stdout or stderr should use :func:`run` instead::" msgstr "" -#: library/subprocess.rst:1208 +#: library/subprocess.rst:1200 +msgid "run(...).returncode" +msgstr "" + +#: library/subprocess.rst:1242 msgid "To suppress stdout or stderr, supply a value of :data:`DEVNULL`." msgstr "" -#: library/subprocess.rst:1210 +#: library/subprocess.rst:1244 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is the same as that of the :class:`Popen` constructor - this " @@ -1425,14 +1521,14 @@ msgid "" "to that interface." msgstr "" -#: library/subprocess.rst:1217 +#: library/subprocess.rst:1251 msgid "" "Do not use ``stdout=PIPE`` or ``stderr=PIPE`` with this function. The child " "process will block if it generates enough output to a pipe to fill up the OS " "pipe buffer as the pipes are not being read from." msgstr "" -#: library/subprocess.rst:1197 +#: library/subprocess.rst:1231 msgid "" "Run command with arguments. Wait for command to complete. If the return " "code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" @@ -1441,11 +1537,15 @@ msgid "" "to start the process it will propagate the exception that was raised." msgstr "" -#: library/subprocess.rst:1239 +#: library/subprocess.rst:1240 +msgid "run(..., check=True)" +msgstr "" + +#: library/subprocess.rst:1273 msgid "Run command with arguments and return its output." msgstr "" -#: library/subprocess.rst:1241 +#: library/subprocess.rst:1275 msgid "" "If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" "exc:`CalledProcessError` object will have the return code in the :attr:" @@ -1453,11 +1553,15 @@ msgid "" "`~CalledProcessError.output` attribute." msgstr "" -#: library/subprocess.rst:1246 +#: library/subprocess.rst:1280 msgid "This is equivalent to::" msgstr "" -#: library/subprocess.rst:1250 +#: library/subprocess.rst:1282 +msgid "run(..., check=True, stdout=PIPE).stdout" +msgstr "" + +#: library/subprocess.rst:1284 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " @@ -1467,52 +1571,61 @@ msgid "" "using the parent's standard input file handle." msgstr "" -#: library/subprocess.rst:1257 +#: library/subprocess.rst:1291 msgid "" "By default, this function will return the data as encoded bytes. The actual " "encoding of the output data may depend on the command being invoked, so the " "decoding to text will often need to be handled at the application level." msgstr "" -#: library/subprocess.rst:1261 +#: library/subprocess.rst:1295 msgid "" "This behaviour may be overridden by setting *text*, *encoding*, *errors*, or " "*universal_newlines* to ``True`` as described in :ref:`frequently-used-" "arguments` and :func:`run`." msgstr "" -#: library/subprocess.rst:1265 +#: library/subprocess.rst:1299 msgid "" "To also capture standard error in the result, use ``stderr=subprocess." "STDOUT``::" msgstr "" -#: library/subprocess.rst:1279 +#: library/subprocess.rst:1302 +msgid "" +">>> subprocess.check_output(\n" +"... \"ls non_existent_file; exit 0\",\n" +"... stderr=subprocess.STDOUT,\n" +"... shell=True)\n" +"'ls: non_existent_file: No such file or directory\\n'" +msgstr "" + +#: library/subprocess.rst:1313 msgid "Support for the *input* keyword argument was added." msgstr "" -#: library/subprocess.rst:1282 +#: library/subprocess.rst:1316 msgid "*encoding* and *errors* were added. See :func:`run` for details." msgstr "" -#: library/subprocess.rst:1300 +#: library/subprocess.rst:1334 msgid "Replacing Older Functions with the :mod:`subprocess` Module" msgstr "" -#: library/subprocess.rst:1302 +#: library/subprocess.rst:1336 msgid "" "In this section, \"a becomes b\" means that b can be used as a replacement " "for a." msgstr "" -#: library/subprocess.rst:1306 +#: library/subprocess.rst:1340 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " "executed program cannot be found; the \"b\" replacements raise :exc:" "`OSError` instead." msgstr "" -#: library/subprocess.rst:1310 +#: library/subprocess.rst:1344 msgid "" "In addition, the replacements using :func:`check_output` will fail with a :" "exc:`CalledProcessError` if the requested operation produces a non-zero " @@ -1520,133 +1633,185 @@ msgid "" "output` attribute of the raised exception." msgstr "" -#: library/subprocess.rst:1315 +#: library/subprocess.rst:1349 msgid "" "In the following examples, we assume that the relevant functions have " "already been imported from the :mod:`subprocess` module." msgstr "" -#: library/subprocess.rst:1320 +#: library/subprocess.rst:1354 msgid "Replacing :program:`/bin/sh` shell command substitution" msgstr "" -#: library/subprocess.rst:1337 library/subprocess.rst:1354 +#: library/subprocess.rst:1356 +msgid "output=$(mycmd myarg)" +msgstr "" + +#: library/subprocess.rst:1371 library/subprocess.rst:1388 msgid "becomes::" msgstr "" -#: library/subprocess.rst:1331 +#: library/subprocess.rst:1362 +msgid "output = check_output([\"mycmd\", \"myarg\"])" +msgstr "" + +#: library/subprocess.rst:1365 msgid "Replacing shell pipeline" msgstr "" -#: library/subprocess.rst:1344 +#: library/subprocess.rst:1384 +msgid "output=$(dmesg | grep hda)" +msgstr "" + +#: library/subprocess.rst:1373 +msgid "" +"p1 = Popen([\"dmesg\"], stdout=PIPE)\n" +"p2 = Popen([\"grep\", \"hda\"], stdin=p1.stdout, stdout=PIPE)\n" +"p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits.\n" +"output = p2.communicate()[0]" +msgstr "" + +#: library/subprocess.rst:1378 msgid "" "The ``p1.stdout.close()`` call after starting the p2 is important in order " "for p1 to receive a SIGPIPE if p2 exits before p1." msgstr "" -#: library/subprocess.rst:1347 +#: library/subprocess.rst:1381 msgid "" "Alternatively, for trusted input, the shell's own pipeline support may still " "be used directly:" msgstr "" -#: library/subprocess.rst:1360 +#: library/subprocess.rst:1390 +msgid "output = check_output(\"dmesg | grep hda\", shell=True)" +msgstr "" + +#: library/subprocess.rst:1394 msgid "Replacing :func:`os.system`" msgstr "" -#: library/subprocess.rst:1368 +#: library/subprocess.rst:1398 +msgid "" +"sts = os.system(\"mycmd\" + \" myarg\")\n" +"# becomes\n" +"retcode = call(\"mycmd\" + \" myarg\", shell=True)" +msgstr "" + +#: library/subprocess.rst:1402 msgid "Notes:" msgstr "" -#: library/subprocess.rst:1370 +#: library/subprocess.rst:1404 msgid "Calling the program through the shell is usually not required." msgstr "" -#: library/subprocess.rst:1371 +#: library/subprocess.rst:1405 msgid "" "The :func:`call` return value is encoded differently to that of :func:`os." "system`." msgstr "" -#: library/subprocess.rst:1374 +#: library/subprocess.rst:1408 msgid "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " "command is running, but the caller must do this separately when using the :" "mod:`subprocess` module." msgstr "" -#: library/subprocess.rst:1378 +#: library/subprocess.rst:1412 msgid "A more realistic example would look like this::" msgstr "" -#: library/subprocess.rst:1391 -msgid "Replacing the :func:`os.spawn ` family" -msgstr "" - -#: library/subprocess.rst:1393 -msgid "P_NOWAIT example::" +#: library/subprocess.rst:1414 +msgid "" +"try:\n" +" retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" +" if retcode < 0:\n" +" print(\"Child was terminated by signal\", -retcode, file=sys." +"stderr)\n" +" else:\n" +" print(\"Child returned\", retcode, file=sys.stderr)\n" +"except OSError as e:\n" +" print(\"Execution failed:\", e, file=sys.stderr)" msgstr "" -#: library/subprocess.rst:1399 -msgid "P_WAIT example::" +#: library/subprocess.rst:1425 +msgid "Replacing the :func:`os.spawn ` family" msgstr "" -#: library/subprocess.rst:1405 -msgid "Vector example::" +#: library/subprocess.rst:1427 +msgid "P_NOWAIT example::" msgstr "" -#: library/subprocess.rst:1411 -msgid "Environment example::" +#: library/subprocess.rst:1429 +msgid "" +"pid = os.spawnlp(os.P_NOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" +"==>\n" +"pid = Popen([\"/bin/mycmd\", \"myarg\"]).pid" msgstr "" -#: library/subprocess.rst:1420 -msgid "Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`" +#: library/subprocess.rst:1433 +msgid "P_WAIT example::" msgstr "" -#: library/subprocess.rst:1450 -msgid "Return code handling translates as follows::" +#: library/subprocess.rst:1435 +msgid "" +"retcode = os.spawnlp(os.P_WAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" +"==>\n" +"retcode = call([\"/bin/mycmd\", \"myarg\"])" msgstr "" -#: library/subprocess.rst:1466 -msgid "Replacing functions from the :mod:`!popen2` module" +#: library/subprocess.rst:1439 +msgid "Vector example::" msgstr "" -#: library/subprocess.rst:1470 +#: library/subprocess.rst:1441 msgid "" -"If the cmd argument to popen2 functions is a string, the command is executed " -"through /bin/sh. If it is a list, the command is directly executed." +"os.spawnvp(os.P_NOWAIT, path, args)\n" +"==>\n" +"Popen([path] + args[1:])" msgstr "" -#: library/subprocess.rst:1489 -msgid "" -":class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as :class:" -"`subprocess.Popen`, except that:" +#: library/subprocess.rst:1445 +msgid "Environment example::" msgstr "" -#: library/subprocess.rst:1492 -msgid ":class:`Popen` raises an exception if the execution fails." +#: library/subprocess.rst:1447 +msgid "" +"os.spawnlpe(os.P_NOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\", env)\n" +"==>\n" +"Popen([\"/bin/mycmd\", \"myarg\"], env={\"PATH\": \"/usr/bin\"})" msgstr "" -#: library/subprocess.rst:1494 -msgid "The *capturestderr* argument is replaced with the *stderr* argument." +#: library/subprocess.rst:1454 +msgid "Replacing :func:`os.popen`" msgstr "" -#: library/subprocess.rst:1496 -msgid "``stdin=PIPE`` and ``stdout=PIPE`` must be specified." +#: library/subprocess.rst:1456 +msgid "Return code handling translates as follows::" msgstr "" -#: library/subprocess.rst:1498 +#: library/subprocess.rst:1458 msgid "" -"popen2 closes all file descriptors by default, but you have to specify " -"``close_fds=True`` with :class:`Popen` to guarantee this behavior on all " -"platforms or past Python versions." +"pipe = os.popen(cmd, 'w')\n" +"...\n" +"rc = pipe.close()\n" +"if rc is not None and rc >> 8:\n" +" print(\"There were some errors\")\n" +"==>\n" +"process = Popen(cmd, stdin=PIPE)\n" +"...\n" +"process.stdin.close()\n" +"if process.wait() != 0:\n" +" print(\"There were some errors\")" msgstr "" -#: library/subprocess.rst:1504 +#: library/subprocess.rst:1472 msgid "Legacy Shell Invocation Functions" msgstr "" -#: library/subprocess.rst:1506 +#: library/subprocess.rst:1474 msgid "" "This module also provides the following legacy functions from the 2.x " "``commands`` module. These operations implicitly invoke the system shell and " @@ -1654,93 +1819,133 @@ msgid "" "handling consistency are valid for these functions." msgstr "" -#: library/subprocess.rst:1513 +#: library/subprocess.rst:1481 msgid "Return ``(exitcode, output)`` of executing *cmd* in a shell." msgstr "" -#: library/subprocess.rst:1515 +#: library/subprocess.rst:1483 msgid "" -"Execute the string *cmd* in a shell with :meth:`Popen.check_output` and " -"return a 2-tuple ``(exitcode, output)``. *encoding* and *errors* are used to " -"decode output; see the notes on :ref:`frequently-used-arguments` for more " -"details." +"Execute the string *cmd* in a shell with :func:`check_output` and return a 2-" +"tuple ``(exitcode, output)``. *encoding* and *errors* are used to decode " +"output; see the notes on :ref:`frequently-used-arguments` for more details." msgstr "" -#: library/subprocess.rst:1520 +#: library/subprocess.rst:1488 msgid "" "A trailing newline is stripped from the output. The exit code for the " "command can be interpreted as the return code of subprocess. Example::" msgstr "" -#: library/subprocess.rst:1555 -msgid ":ref:`Availability `: Unix, Windows." +#: library/subprocess.rst:1492 +msgid "" +">>> subprocess.getstatusoutput('ls /bin/ls')\n" +"(0, '/bin/ls')\n" +">>> subprocess.getstatusoutput('cat /bin/junk')\n" +"(1, 'cat: /bin/junk: No such file or directory')\n" +">>> subprocess.getstatusoutput('/bin/junk')\n" +"(127, 'sh: /bin/junk: not found')\n" +">>> subprocess.getstatusoutput('/bin/kill $$')\n" +"(-15, '')" msgstr "" -#: library/subprocess.rst:1535 +#: library/subprocess.rst:1503 msgid "Windows support was added." msgstr "" -#: library/subprocess.rst:1538 +#: library/subprocess.rst:1506 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " "it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" "`~Popen.returncode`." msgstr "" -#: library/subprocess.rst:1547 +#: library/subprocess.rst:1515 msgid "Return output (stdout and stderr) of executing *cmd* in a shell." msgstr "" -#: library/subprocess.rst:1549 +#: library/subprocess.rst:1517 msgid "" "Like :func:`getstatusoutput`, except the exit code is ignored and the return " "value is a string containing the command's output. Example::" msgstr "" -#: library/subprocess.rst:1557 +#: library/subprocess.rst:1520 +msgid "" +">>> subprocess.getoutput('ls /bin/ls')\n" +"'/bin/ls'" +msgstr "" + +#: library/subprocess.rst:1525 msgid "Windows support added" msgstr "" -#: library/subprocess.rst:1565 +#: library/subprocess.rst:1533 msgid "Notes" msgstr "" -#: library/subprocess.rst:1570 +#: library/subprocess.rst:1538 +msgid "Timeout Behavior" +msgstr "" + +#: library/subprocess.rst:1540 +msgid "" +"When using the ``timeout`` parameter in functions like :func:`run`, :meth:" +"`Popen.wait`, or :meth:`Popen.communicate`, users should be aware of the " +"following behaviors:" +msgstr "" + +#: library/subprocess.rst:1544 +msgid "" +"**Process Creation Delay**: The initial process creation itself cannot be " +"interrupted on many platform APIs. This means that even when specifying a " +"timeout, you are not guaranteed to see a timeout exception until at least " +"after however long process creation takes." +msgstr "" + +#: library/subprocess.rst:1549 +msgid "" +"**Extremely Small Timeout Values**: Setting very small timeout values (such " +"as a few milliseconds) may result in almost immediate :exc:`TimeoutExpired` " +"exceptions because process creation and system scheduling inherently require " +"time." +msgstr "" + +#: library/subprocess.rst:1556 msgid "Converting an argument sequence to a string on Windows" msgstr "" -#: library/subprocess.rst:1572 +#: library/subprocess.rst:1558 msgid "" "On Windows, an *args* sequence is converted to a string that can be parsed " "using the following rules (which correspond to the rules used by the MS C " "runtime):" msgstr "" -#: library/subprocess.rst:1576 +#: library/subprocess.rst:1562 msgid "" "Arguments are delimited by white space, which is either a space or a tab." msgstr "" -#: library/subprocess.rst:1579 +#: library/subprocess.rst:1565 msgid "" "A string surrounded by double quotation marks is interpreted as a single " "argument, regardless of white space contained within. A quoted string can " "be embedded in an argument." msgstr "" -#: library/subprocess.rst:1584 +#: library/subprocess.rst:1570 msgid "" "A double quotation mark preceded by a backslash is interpreted as a literal " "double quotation mark." msgstr "" -#: library/subprocess.rst:1587 +#: library/subprocess.rst:1573 msgid "" "Backslashes are interpreted literally, unless they immediately precede a " "double quotation mark." msgstr "" -#: library/subprocess.rst:1590 +#: library/subprocess.rst:1576 msgid "" "If backslashes immediately precede a double quotation mark, every pair of " "backslashes is interpreted as a literal backslash. If the number of " @@ -1748,67 +1953,52 @@ msgid "" "mark as described in rule 3." msgstr "" -#: library/subprocess.rst:1599 +#: library/subprocess.rst:1585 msgid ":mod:`shlex`" msgstr "" -#: library/subprocess.rst:1600 +#: library/subprocess.rst:1586 msgid "Module which provides function to parse and escape command lines." msgstr "" -#: library/subprocess.rst:1607 -msgid "Disabling use of ``vfork()`` or ``posix_spawn()``" +#: library/subprocess.rst:1592 +msgid "Disable use of ``posix_spawn()``" msgstr "" -#: library/subprocess.rst:1609 +#: library/subprocess.rst:1594 msgid "" "On Linux, :mod:`subprocess` defaults to using the ``vfork()`` system call " "internally when it is safe to do so rather than ``fork()``. This greatly " "improves performance." msgstr "" -#: library/subprocess.rst:1613 -msgid "" -"If you ever encounter a presumed highly unusual situation where you need to " -"prevent ``vfork()`` from being used by Python, you can set the :const:" -"`subprocess._USE_VFORK` attribute to a false value." -msgstr "" - -#: library/subprocess.rst:1621 -msgid "" -"Setting this has no impact on use of ``posix_spawn()`` which could use " -"``vfork()`` internally within its libc implementation. There is a similar :" -"const:`subprocess._USE_POSIX_SPAWN` attribute if you need to prevent use of " -"that." +#: library/subprocess.rst:1600 +msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." msgstr "" -#: library/subprocess.rst:1630 +#: library/subprocess.rst:1602 msgid "" -"It is safe to set these to false on any Python version. They will have no " -"effect on older versions when unsupported. Do not assume the attributes are " -"available to read. Despite their names, a true value does not indicate that " -"the corresponding function will be used, only that it may be." +"It is safe to set this to false on any Python version. It will have no " +"effect on older or newer versions where unsupported. Do not assume the " +"attribute is available to read. Despite the name, a true value does not " +"indicate the corresponding function will be used, only that it may be." msgstr "" -#: library/subprocess.rst:1635 +#: library/subprocess.rst:1607 msgid "" "Please file issues any time you have to use these private knobs with a way " "to reproduce the issue you were seeing. Link to that issue from a comment in " "your code." msgstr "" -#: library/subprocess.rst:1639 +#: library/subprocess.rst:1611 msgid "``_USE_POSIX_SPAWN``" msgstr "" -#: library/subprocess.rst:1640 -msgid "``_USE_VFORK``" -msgstr "" - -#: library/subprocess.rst:293 +#: library/subprocess.rst:296 msgid "universal newlines" msgstr "" -#: library/subprocess.rst:293 +#: library/subprocess.rst:296 msgid "subprocess module" msgstr "" diff --git a/library/sunau.po b/library/sunau.po index d525a57a..d07ba933 100644 --- a/library/sunau.po +++ b/library/sunau.po @@ -8,348 +8,28 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/sunau.rst:2 -msgid ":mod:`sunau` --- Read and write Sun AU files" +msgid ":mod:`!sunau` --- Read and write Sun AU files" msgstr "" #: library/sunau.rst:10 -msgid "**Source code:** :source:`Lib/sunau.py`" -msgstr "" - -#: library/sunau.rst:15 -msgid "" -"The :mod:`sunau` module is deprecated (see :pep:`PEP 594 <594#sunau>` for " -"details)." -msgstr "" - -#: library/sunau.rst:18 -msgid "" -"The :mod:`sunau` module provides a convenient interface to the Sun AU sound " -"format. Note that this module is interface-compatible with the modules :mod:" -"`aifc` and :mod:`wave`." -msgstr "" - -#: library/sunau.rst:22 -msgid "" -"An audio file consists of a header followed by the data. The fields of the " -"header are:" -msgstr "" - -#: library/sunau.rst:26 -msgid "Field" -msgstr "" - -#: library/sunau.rst:26 -msgid "Contents" -msgstr "" - -#: library/sunau.rst:28 -msgid "magic word" -msgstr "" - -#: library/sunau.rst:28 -msgid "The four bytes ``.snd``." -msgstr "" - -#: library/sunau.rst:30 -msgid "header size" -msgstr "" - -#: library/sunau.rst:30 -msgid "Size of the header, including info, in bytes." -msgstr "" - -#: library/sunau.rst:32 -msgid "data size" -msgstr "" - -#: library/sunau.rst:32 -msgid "Physical size of the data, in bytes." -msgstr "" - -#: library/sunau.rst:34 -msgid "encoding" -msgstr "" - -#: library/sunau.rst:34 -msgid "Indicates how the audio samples are encoded." -msgstr "" - -#: library/sunau.rst:36 -msgid "sample rate" -msgstr "" - -#: library/sunau.rst:36 -msgid "The sampling rate." -msgstr "" - -#: library/sunau.rst:38 -msgid "# of channels" -msgstr "" - -#: library/sunau.rst:38 -msgid "The number of channels in the samples." -msgstr "" - -#: library/sunau.rst:40 -msgid "info" -msgstr "" - -#: library/sunau.rst:40 -msgid "" -"ASCII string giving a description of the audio file (padded with null bytes)." -msgstr "" - -#: library/sunau.rst:44 -msgid "" -"Apart from the info field, all header fields are 4 bytes in size. They are " -"all 32-bit unsigned integers encoded in big-endian byte order." -msgstr "" - -#: library/sunau.rst:47 -msgid "The :mod:`sunau` module defines the following functions:" -msgstr "" - -#: library/sunau.rst:52 -msgid "" -"If *file* is a string, open the file by that name, otherwise treat it as a " -"seekable file-like object. *mode* can be any of" -msgstr "" - -#: library/sunau.rst:56 -msgid "``'r'``" -msgstr "" - -#: library/sunau.rst:56 -msgid "Read only mode." -msgstr "" - -#: library/sunau.rst:59 -msgid "``'w'``" -msgstr "" - -#: library/sunau.rst:59 -msgid "Write only mode." -msgstr "" - -#: library/sunau.rst:61 -msgid "Note that it does not allow read/write files." -msgstr "" - -#: library/sunau.rst:63 -msgid "" -"A *mode* of ``'r'`` returns an :class:`AU_read` object, while a *mode* of " -"``'w'`` or ``'wb'`` returns an :class:`AU_write` object." -msgstr "" - -#: library/sunau.rst:67 -msgid "The :mod:`sunau` module defines the following exception:" -msgstr "" - -#: library/sunau.rst:71 -msgid "" -"An error raised when something is impossible because of Sun AU specs or " -"implementation deficiency." -msgstr "" - -#: library/sunau.rst:75 -msgid "The :mod:`sunau` module defines the following data items:" -msgstr "" - -#: library/sunau.rst:79 -msgid "" -"An integer every valid Sun AU file begins with, stored in big-endian form. " -"This is the string ``.snd`` interpreted as an integer." -msgstr "" - -#: library/sunau.rst:90 msgid "" -"Values of the encoding field from the AU header which are supported by this " -"module." -msgstr "" - -#: library/sunau.rst:101 -msgid "" -"Additional known values of the encoding field from the AU header, but which " -"are not supported by this module." -msgstr "" - -#: library/sunau.rst:108 -msgid "AU_read Objects" -msgstr "" - -#: library/sunau.rst:110 -msgid "" -"AU_read objects, as returned by :func:`.open` above, have the following " -"methods:" -msgstr "" - -#: library/sunau.rst:115 -msgid "" -"Close the stream, and make the instance unusable. (This is called " -"automatically on deletion.)" -msgstr "" - -#: library/sunau.rst:121 -msgid "Returns number of audio channels (1 for mono, 2 for stereo)." -msgstr "" - -#: library/sunau.rst:126 -msgid "Returns sample width in bytes." -msgstr "" - -#: library/sunau.rst:131 -msgid "Returns sampling frequency." -msgstr "" - -#: library/sunau.rst:136 -msgid "Returns number of audio frames." -msgstr "" - -#: library/sunau.rst:141 -msgid "" -"Returns compression type. Supported compression types are ``'ULAW'``, " -"``'ALAW'`` and ``'NONE'``." -msgstr "" - -#: library/sunau.rst:147 -msgid "" -"Human-readable version of :meth:`getcomptype`. The supported types have the " -"respective names ``'CCITT G.711 u-law'``, ``'CCITT G.711 A-law'`` and ``'not " -"compressed'``." -msgstr "" - -#: library/sunau.rst:154 -msgid "" -"Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " -"framerate, nframes, comptype, compname)``, equivalent to output of the :meth:" -"`get\\*` methods." -msgstr "" - -#: library/sunau.rst:161 -msgid "" -"Reads and returns at most *n* frames of audio, as a :class:`bytes` object. " -"The data will be returned in linear format. If the original data is in u-" -"LAW format, it will be converted." -msgstr "" - -#: library/sunau.rst:168 -msgid "Rewind the file pointer to the beginning of the audio stream." -msgstr "" - -#: library/sunau.rst:170 -msgid "" -"The following two methods define a term \"position\" which is compatible " -"between them, and is otherwise implementation dependent." -msgstr "" - -#: library/sunau.rst:176 -msgid "" -"Set the file pointer to the specified position. Only values returned from :" -"meth:`tell` should be used for *pos*." -msgstr "" - -#: library/sunau.rst:182 -msgid "" -"Return current file pointer position. Note that the returned value has " -"nothing to do with the actual position in the file." -msgstr "" - -#: library/sunau.rst:185 -msgid "" -"The following two functions are defined for compatibility with the :mod:" -"`aifc`, and don't do anything interesting." -msgstr "" - -#: library/sunau.rst:191 -msgid "Returns ``None``." -msgstr "" - -#: library/sunau.rst:196 -msgid "Raise an error." -msgstr "" - -#: library/sunau.rst:202 -msgid "AU_write Objects" -msgstr "" - -#: library/sunau.rst:204 -msgid "" -"AU_write objects, as returned by :func:`.open` above, have the following " -"methods:" -msgstr "" - -#: library/sunau.rst:209 -msgid "Set the number of channels." -msgstr "" - -#: library/sunau.rst:214 -msgid "Set the sample width (in bytes.)" -msgstr "" - -#: library/sunau.rst:216 -msgid "Added support for 24-bit samples." -msgstr "" - -#: library/sunau.rst:222 -msgid "Set the frame rate." -msgstr "" - -#: library/sunau.rst:227 -msgid "" -"Set the number of frames. This can be later changed, when and if more " -"frames are written." -msgstr "" - -#: library/sunau.rst:233 -msgid "" -"Set the compression type and description. Only ``'NONE'`` and ``'ULAW'`` are " -"supported on output." -msgstr "" - -#: library/sunau.rst:239 -msgid "" -"The *tuple* should be ``(nchannels, sampwidth, framerate, nframes, comptype, " -"compname)``, with values valid for the :meth:`set\\*` methods. Set all " -"parameters." -msgstr "" - -#: library/sunau.rst:246 -msgid "" -"Return current position in the file, with the same disclaimer for the :meth:" -"`AU_read.tell` and :meth:`AU_read.setpos` methods." -msgstr "" - -#: library/sunau.rst:252 -msgid "Write audio frames, without correcting *nframes*." -msgstr "" - -#: library/sunau.rst:262 -msgid "Any :term:`bytes-like object` is now accepted." -msgstr "" - -#: library/sunau.rst:260 -msgid "Write audio frames and make sure *nframes* is correct." -msgstr "" - -#: library/sunau.rst:268 -msgid "Make sure *nframes* is correct, and close the file." -msgstr "" - -#: library/sunau.rst:270 -msgid "This method is called upon deletion." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/sunau.rst:272 +#: library/sunau.rst:14 msgid "" -"Note that it is invalid to set any parameters after calling :meth:" -"`writeframes` or :meth:`writeframesraw`." +"The last version of Python that provided the :mod:`!sunau` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/superseded.po b/library/superseded.po index 8c65991e..6ad2ce6d 100644 --- a/library/superseded.po +++ b/library/superseded.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -22,6 +23,26 @@ msgstr "" #: library/superseded.rst:7 msgid "" -"The modules described in this chapter are deprecated and only kept for " -"backwards compatibility. They have been superseded by other modules." +"The modules described in this chapter have been superseded by other modules " +"for most use cases, and are retained primarily to preserve backwards " +"compatibility." +msgstr "" + +#: library/superseded.rst:10 +msgid "" +"Modules may appear in this chapter because they only cover a limited subset " +"of a problem space, and a more generally applicable solution is available " +"elsewhere in the standard library (for example, :mod:`getopt` covers the " +"very specific task of \"mimic the C :c:func:`!getopt` API in Python\", " +"rather than the broader command line option parsing and argument parsing " +"capabilities offered by :mod:`optparse` and :mod:`argparse`)." +msgstr "" + +#: library/superseded.rst:17 +msgid "" +"Alternatively, modules may appear in this chapter because they are " +"deprecated outright, and awaiting removal in a future release, or they are :" +"term:`soft deprecated` and their use is actively discouraged in new " +"projects. With the removal of various obsolete modules through :pep:`594`, " +"there are currently no modules in this latter category." msgstr "" diff --git a/library/symtable.po b/library/symtable.po index db5567b2..e010aff2 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/symtable.rst:2 -msgid ":mod:`symtable` --- Access to the compiler's symbol tables" +msgid ":mod:`!symtable` --- Access to the compiler's symbol tables" msgstr "" #: library/symtable.rst:7 @@ -48,28 +49,82 @@ msgid "Examining Symbol Tables" msgstr "" #: library/symtable.rst:36 +msgid "An enumeration indicating the type of a :class:`SymbolTable` object." +msgstr "" + +#: library/symtable.rst:41 +msgid "Used for the symbol table of a module." +msgstr "" + +#: library/symtable.rst:46 +msgid "Used for the symbol table of a function." +msgstr "" + +#: library/symtable.rst:51 +msgid "Used for the symbol table of a class." +msgstr "" + +#: library/symtable.rst:53 +msgid "" +"The following members refer to different flavors of :ref:`annotation scopes " +"`." +msgstr "" + +#: library/symtable.rst:59 +msgid "" +"Used for annotations if ``from __future__ import annotations`` is active." +msgstr "" + +#: library/symtable.rst:64 +msgid "Used for the symbol table of :keyword:`type` constructions." +msgstr "" + +#: library/symtable.rst:69 +msgid "" +"Used for the symbol table of :ref:`generic functions ` " +"or :ref:`generic classes `." +msgstr "" + +#: library/symtable.rst:75 +msgid "" +"Used for the symbol table of the bound, the constraint tuple or the default " +"value of a single type variable in the formal sense, i.e., a TypeVar, a " +"TypeVarTuple or a ParamSpec object (the latter two do not support a bound or " +"a constraint tuple)." +msgstr "" + +#: library/symtable.rst:84 msgid "A namespace table for a block. The constructor is not public." msgstr "" -#: library/symtable.rst:40 +#: library/symtable.rst:88 msgid "" -"Return the type of the symbol table. Possible values are ``'class'``, " -"``'module'``, ``'function'``, ``'annotation'``, ``'TypeVar bound'``, ``'type " -"alias'``, and ``'type parameter'``. The latter four refer to different " -"flavors of :ref:`annotation scopes `." +"Return the type of the symbol table. Possible values are members of the :" +"class:`SymbolTableType` enumeration." msgstr "" -#: library/symtable.rst:45 +#: library/symtable.rst:91 msgid "" "Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``, and ``'type " "parameter'`` as possible return values." msgstr "" -#: library/symtable.rst:51 +#: library/symtable.rst:95 +msgid "Return values are members of the :class:`SymbolTableType` enumeration." +msgstr "" + +#: library/symtable.rst:98 +msgid "" +"The exact values of the returned string may change in the future, and thus, " +"it is recommended to use :class:`SymbolTableType` members instead of hard-" +"coded strings." +msgstr "" + +#: library/symtable.rst:104 msgid "Return the table's identifier." msgstr "" -#: library/symtable.rst:55 +#: library/symtable.rst:108 msgid "" "Return the table's name. This is the name of the class if the table is for " "a class, the name of the function if the table is for a function, or " @@ -80,156 +135,273 @@ msgid "" "`~typing.TypeVar` bound scopes, it is the name of the ``TypeVar``." msgstr "" -#: library/symtable.rst:65 +#: library/symtable.rst:118 msgid "Return the number of the first line in the block this table represents." msgstr "" -#: library/symtable.rst:69 +#: library/symtable.rst:122 msgid "Return ``True`` if the locals in this table can be optimized." msgstr "" -#: library/symtable.rst:73 +#: library/symtable.rst:126 msgid "Return ``True`` if the block is a nested class or function." msgstr "" -#: library/symtable.rst:77 +#: library/symtable.rst:130 msgid "" "Return ``True`` if the block has nested namespaces within it. These can be " "obtained with :meth:`get_children`." msgstr "" -#: library/symtable.rst:82 +#: library/symtable.rst:135 msgid "" "Return a view object containing the names of symbols in the table. See the :" "ref:`documentation of view objects `." msgstr "" -#: library/symtable.rst:87 +#: library/symtable.rst:140 msgid "Lookup *name* in the table and return a :class:`Symbol` instance." msgstr "" -#: library/symtable.rst:91 +#: library/symtable.rst:144 msgid "Return a list of :class:`Symbol` instances for names in the table." msgstr "" -#: library/symtable.rst:95 +#: library/symtable.rst:148 msgid "Return a list of the nested symbol tables." msgstr "" -#: library/symtable.rst:100 +#: library/symtable.rst:153 msgid "" "A namespace for a function or method. This class inherits from :class:" "`SymbolTable`." msgstr "" -#: library/symtable.rst:105 +#: library/symtable.rst:158 msgid "Return a tuple containing names of parameters to this function." msgstr "" -#: library/symtable.rst:109 +#: library/symtable.rst:162 msgid "Return a tuple containing names of locals in this function." msgstr "" -#: library/symtable.rst:113 +#: library/symtable.rst:166 msgid "Return a tuple containing names of globals in this function." msgstr "" -#: library/symtable.rst:117 -msgid "Return a tuple containing names of nonlocals in this function." +#: library/symtable.rst:170 +msgid "" +"Return a tuple containing names of explicitly declared nonlocals in this " +"function." msgstr "" -#: library/symtable.rst:121 -msgid "Return a tuple containing names of free variables in this function." +#: library/symtable.rst:174 +msgid "" +"Return a tuple containing names of :term:`free (closure) variables ` in this function." msgstr "" -#: library/symtable.rst:126 +#: library/symtable.rst:180 msgid "A namespace of a class. This class inherits from :class:`SymbolTable`." msgstr "" -#: library/symtable.rst:130 -msgid "Return a tuple containing the names of methods declared in the class." +#: library/symtable.rst:184 +msgid "" +"Return a tuple containing the names of method-like functions declared in the " +"class." msgstr "" -#: library/symtable.rst:135 +#: library/symtable.rst:187 +msgid "" +"Here, the term 'method' designates *any* function defined in the class body " +"via :keyword:`def` or :keyword:`async def`." +msgstr "" + +#: library/symtable.rst:190 +msgid "" +"Functions defined in a deeper scope (e.g., in an inner class) are not picked " +"up by :meth:`get_methods`." +msgstr "" + +#: library/symtable.rst:193 +msgid "For example:" +msgstr "" + +#: library/symtable.rst:206 +msgid "" +">>> import symtable\n" +">>> st = symtable.symtable('''\n" +"... def outer(): pass\n" +"...\n" +"... class A:\n" +"... def f():\n" +"... def w(): pass\n" +"...\n" +"... def g(self): pass\n" +"...\n" +"... @classmethod\n" +"... async def h(cls): pass\n" +"...\n" +"... global outer\n" +"... def outer(self): pass\n" +"... ''', 'test', 'exec')\n" +">>> class_A = st.get_children()[2]\n" +">>> class_A.get_methods()\n" +"('f', 'g', 'h')" +msgstr "" + +#: library/symtable.rst:228 +msgid "" +"Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still " +"considered as a method-like function." +msgstr "" + +#: library/symtable.rst:236 msgid "" "An entry in a :class:`SymbolTable` corresponding to an identifier in the " "source. The constructor is not public." msgstr "" -#: library/symtable.rst:140 +#: library/symtable.rst:241 msgid "Return the symbol's name." msgstr "" -#: library/symtable.rst:144 +#: library/symtable.rst:245 msgid "Return ``True`` if the symbol is used in its block." msgstr "" -#: library/symtable.rst:148 +#: library/symtable.rst:249 msgid "Return ``True`` if the symbol is created from an import statement." msgstr "" -#: library/symtable.rst:152 +#: library/symtable.rst:253 msgid "Return ``True`` if the symbol is a parameter." msgstr "" -#: library/symtable.rst:156 +#: library/symtable.rst:257 +msgid "Return ``True`` if the symbol is a type parameter." +msgstr "" + +#: library/symtable.rst:263 msgid "Return ``True`` if the symbol is global." msgstr "" -#: library/symtable.rst:160 +#: library/symtable.rst:267 msgid "Return ``True`` if the symbol is nonlocal." msgstr "" -#: library/symtable.rst:164 +#: library/symtable.rst:271 msgid "" "Return ``True`` if the symbol is declared global with a global statement." msgstr "" -#: library/symtable.rst:168 +#: library/symtable.rst:275 msgid "Return ``True`` if the symbol is local to its block." msgstr "" -#: library/symtable.rst:172 +#: library/symtable.rst:279 msgid "Return ``True`` if the symbol is annotated." msgstr "" -#: library/symtable.rst:178 +#: library/symtable.rst:285 msgid "" "Return ``True`` if the symbol is referenced in its block, but not assigned " "to." msgstr "" -#: library/symtable.rst:183 +#: library/symtable.rst:290 +msgid "" +"Return *True* if a class-scoped symbol is free from the perspective of a " +"method." +msgstr "" + +#: library/symtable.rst:293 +msgid "Consider the following example::" +msgstr "" + +#: library/symtable.rst:295 +msgid "" +"def f():\n" +" x = 1 # function-scoped\n" +" class C:\n" +" x = 2 # class-scoped\n" +" def method(self):\n" +" return x" +msgstr "" + +#: library/symtable.rst:302 +msgid "" +"In this example, the class-scoped symbol ``x`` is considered to be free from " +"the perspective of ``C.method``, thereby allowing the latter to return *1* " +"at runtime and not *2*." +msgstr "" + +#: library/symtable.rst:310 msgid "Return ``True`` if the symbol is assigned to in its block." msgstr "" -#: library/symtable.rst:187 +#: library/symtable.rst:314 +msgid "Return ``True`` if the symbol is a comprehension iteration variable." +msgstr "" + +#: library/symtable.rst:320 +msgid "Return ``True`` if the symbol is a cell in an inlined comprehension." +msgstr "" + +#: library/symtable.rst:326 msgid "Return ``True`` if name binding introduces new namespace." msgstr "" -#: library/symtable.rst:189 +#: library/symtable.rst:328 msgid "" "If the name is used as the target of a function or class statement, this " "will be true." msgstr "" -#: library/symtable.rst:192 +#: library/symtable.rst:331 msgid "For example::" msgstr "" -#: library/symtable.rst:198 +#: library/symtable.rst:333 +msgid "" +">>> table = symtable.symtable(\"def some_func(): pass\", \"string\", " +"\"exec\")\n" +">>> table.lookup(\"some_func\").is_namespace()\n" +"True" +msgstr "" + +#: library/symtable.rst:337 msgid "" "Note that a single name can be bound to multiple objects. If the result is " "``True``, the name may also be bound to other objects, like an int or list, " "that does not introduce a new namespace." msgstr "" -#: library/symtable.rst:204 +#: library/symtable.rst:343 msgid "Return a list of namespaces bound to this name." msgstr "" -#: library/symtable.rst:208 +#: library/symtable.rst:347 msgid "" "Return the namespace bound to this name. If more than one or no namespace is " "bound to this name, a :exc:`ValueError` is raised." msgstr "" + +#: library/symtable.rst:354 +msgid "Command-Line Usage" +msgstr "" + +#: library/symtable.rst:358 +msgid "" +"The :mod:`symtable` module can be executed as a script from the command line." +msgstr "" + +#: library/symtable.rst:360 +msgid "python -m symtable [infile...]" +msgstr "" + +#: library/symtable.rst:364 +msgid "" +"Symbol tables are generated for the specified Python source files and dumped " +"to stdout. If no input file is specified, the content is read from stdin." +msgstr "" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 79e4c872..2c27b2e0 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/sys.monitoring.rst:2 -msgid ":mod:`sys.monitoring` --- Execution event monitoring" +msgid ":mod:`!sys.monitoring` --- Execution event monitoring" msgstr "" #: library/sys.monitoring.rst:13 @@ -86,223 +87,261 @@ msgid "" msgstr "" #: library/sys.monitoring.rst:55 -msgid "Should be called once a tool no longer requires *tool_id*." +msgid "Unregister all events and callback functions associated with *tool_id*." msgstr "" #: library/sys.monitoring.rst:59 msgid "" -":func:`free_tool_id` will not disable global or local events associated with " -"*tool_id*, nor will it unregister any callback functions. This function is " -"only intended to be used to notify the VM that the particular *tool_id* is " -"no longer in use." +"Should be called once a tool no longer requires *tool_id*. Will call :func:" +"`clear_tool_id` before releasing *tool_id*." msgstr "" -#: library/sys.monitoring.rst:66 +#: library/sys.monitoring.rst:64 msgid "" "Returns the name of the tool if *tool_id* is in use, otherwise it returns " "``None``. *tool_id* must be in the range 0 to 5 inclusive." msgstr "" -#: library/sys.monitoring.rst:70 +#: library/sys.monitoring.rst:68 msgid "" "All IDs are treated the same by the VM with regard to events, but the " "following IDs are pre-defined to make co-operation of tools easier::" msgstr "" -#: library/sys.monitoring.rst:78 +#: library/sys.monitoring.rst:71 msgid "" -"There is no obligation to set an ID, nor is there anything preventing a tool " -"from using an ID even it is already in use. However, tools are encouraged to " -"use a unique ID and respect other tools." +"sys.monitoring.DEBUGGER_ID = 0\n" +"sys.monitoring.COVERAGE_ID = 1\n" +"sys.monitoring.PROFILER_ID = 2\n" +"sys.monitoring.OPTIMIZER_ID = 5" msgstr "" -#: library/sys.monitoring.rst:83 +#: library/sys.monitoring.rst:78 msgid "Events" msgstr "" -#: library/sys.monitoring.rst:85 +#: library/sys.monitoring.rst:80 msgid "The following events are supported:" msgstr "" -#: library/sys.monitoring.rst:89 -msgid "A conditional branch is taken (or not)." +#: library/sys.monitoring.rst:84 +msgid "A conditional branch goes left." +msgstr "" + +#: library/sys.monitoring.rst:86 +msgid "" +"It is up to the tool to determine how to present \"left\" and \"right\" " +"branches. There is no guarantee which branch is \"left\" and which is " +"\"right\", except that it will be consistent for the duration of the program." +msgstr "" + +#: library/sys.monitoring.rst:92 +msgid "A conditional branch goes right." msgstr "" -#: library/sys.monitoring.rst:93 +#: library/sys.monitoring.rst:96 msgid "A call in Python code (event occurs before the call)." msgstr "" -#: library/sys.monitoring.rst:97 +#: library/sys.monitoring.rst:100 msgid "" "An exception raised from any callable, except for Python functions (event " "occurs after the exit)." msgstr "" -#: library/sys.monitoring.rst:101 +#: library/sys.monitoring.rst:104 msgid "" "Return from any callable, except for Python functions (event occurs after " "the return)." msgstr "" -#: library/sys.monitoring.rst:105 +#: library/sys.monitoring.rst:108 msgid "An exception is handled." msgstr "" -#: library/sys.monitoring.rst:109 +#: library/sys.monitoring.rst:112 msgid "A VM instruction is about to be executed." msgstr "" -#: library/sys.monitoring.rst:113 +#: library/sys.monitoring.rst:116 msgid "An unconditional jump in the control flow graph is made." msgstr "" -#: library/sys.monitoring.rst:117 +#: library/sys.monitoring.rst:120 msgid "" "An instruction is about to be executed that has a different line number from " "the preceding instruction." msgstr "" -#: library/sys.monitoring.rst:121 +#: library/sys.monitoring.rst:124 msgid "" "Resumption of a Python function (for generator and coroutine functions), " "except for ``throw()`` calls." msgstr "" -#: library/sys.monitoring.rst:125 +#: library/sys.monitoring.rst:128 msgid "" "Return from a Python function (occurs immediately before the return, the " "callee's frame will be on the stack)." msgstr "" -#: library/sys.monitoring.rst:129 +#: library/sys.monitoring.rst:132 msgid "" "Start of a Python function (occurs immediately after the call, the callee's " "frame will be on the stack)" msgstr "" -#: library/sys.monitoring.rst:133 +#: library/sys.monitoring.rst:136 msgid "A Python function is resumed by a ``throw()`` call." msgstr "" -#: library/sys.monitoring.rst:137 -msgid "Exit from a Python function during exception unwinding." +#: library/sys.monitoring.rst:140 +msgid "" +"Exit from a Python function during exception unwinding. This includes " +"exceptions raised directly within the function and that are allowed to " +"continue to propagate." msgstr "" -#: library/sys.monitoring.rst:141 +#: library/sys.monitoring.rst:145 msgid "" "Yield from a Python function (occurs immediately before the yield, the " "callee's frame will be on the stack)." msgstr "" -#: library/sys.monitoring.rst:145 +#: library/sys.monitoring.rst:149 msgid "" "An exception is raised, except those that cause a :monitoring-event:" "`STOP_ITERATION` event." msgstr "" -#: library/sys.monitoring.rst:149 +#: library/sys.monitoring.rst:153 msgid "" "An exception is re-raised, for example at the end of a :keyword:`finally` " "block." msgstr "" -#: library/sys.monitoring.rst:153 +#: library/sys.monitoring.rst:157 msgid "" "An artificial :exc:`StopIteration` is raised; see `the STOP_ITERATION " "event`_." msgstr "" -#: library/sys.monitoring.rst:156 +#: library/sys.monitoring.rst:160 msgid "More events may be added in the future." msgstr "" -#: library/sys.monitoring.rst:158 +#: library/sys.monitoring.rst:162 msgid "" "These events are attributes of the :mod:`!sys.monitoring.events` namespace. " "Each event is represented as a power-of-2 integer constant. To define a set " -"of events, simply bitwise or the individual events together. For example, to " +"of events, simply bitwise OR the individual events together. For example, to " "specify both :monitoring-event:`PY_RETURN` and :monitoring-event:`PY_START` " "events, use the expression ``PY_RETURN | PY_START``." msgstr "" -#: library/sys.monitoring.rst:166 -msgid "An alias for ``0`` so users can do explict comparisions like::" +#: library/sys.monitoring.rst:170 +msgid "An alias for ``0`` so users can do explicit comparisons like::" +msgstr "" + +#: library/sys.monitoring.rst:172 +msgid "" +"if get_events(DEBUGGER_ID) == NO_EVENTS:\n" +" ..." msgstr "" -#: library/sys.monitoring.rst:171 -msgid "Events are divided into three groups:" +#: library/sys.monitoring.rst:175 +msgid "Setting this event deactivates all events." msgstr "" -#: library/sys.monitoring.rst:174 +#: library/sys.monitoring.rst:180 msgid "Local events" msgstr "" -#: library/sys.monitoring.rst:176 +#: library/sys.monitoring.rst:182 msgid "" "Local events are associated with normal execution of the program and happen " "at clearly defined locations. All local events can be disabled. The local " "events are:" msgstr "" -#: library/sys.monitoring.rst:180 +#: library/sys.monitoring.rst:186 msgid ":monitoring-event:`PY_START`" msgstr "" -#: library/sys.monitoring.rst:181 +#: library/sys.monitoring.rst:187 msgid ":monitoring-event:`PY_RESUME`" msgstr "" -#: library/sys.monitoring.rst:182 +#: library/sys.monitoring.rst:188 msgid ":monitoring-event:`PY_RETURN`" msgstr "" -#: library/sys.monitoring.rst:183 +#: library/sys.monitoring.rst:189 msgid ":monitoring-event:`PY_YIELD`" msgstr "" -#: library/sys.monitoring.rst:184 +#: library/sys.monitoring.rst:190 msgid ":monitoring-event:`CALL`" msgstr "" -#: library/sys.monitoring.rst:185 +#: library/sys.monitoring.rst:191 msgid ":monitoring-event:`LINE`" msgstr "" -#: library/sys.monitoring.rst:186 +#: library/sys.monitoring.rst:192 msgid ":monitoring-event:`INSTRUCTION`" msgstr "" -#: library/sys.monitoring.rst:187 +#: library/sys.monitoring.rst:193 msgid ":monitoring-event:`JUMP`" msgstr "" -#: library/sys.monitoring.rst:188 -msgid ":monitoring-event:`BRANCH`" +#: library/sys.monitoring.rst:194 +msgid ":monitoring-event:`BRANCH_LEFT`" msgstr "" -#: library/sys.monitoring.rst:189 +#: library/sys.monitoring.rst:195 +msgid ":monitoring-event:`BRANCH_RIGHT`" +msgstr "" + +#: library/sys.monitoring.rst:196 msgid ":monitoring-event:`STOP_ITERATION`" msgstr "" -#: library/sys.monitoring.rst:192 +#: library/sys.monitoring.rst:199 +msgid "Deprecated event" +msgstr "" + +#: library/sys.monitoring.rst:201 +msgid "``BRANCH``" +msgstr "" + +#: library/sys.monitoring.rst:203 +msgid "" +"The ``BRANCH`` event is deprecated in 3.14. Using :monitoring-event:" +"`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events will give much " +"better performance as they can be disabled independently." +msgstr "" + +#: library/sys.monitoring.rst:209 msgid "Ancillary events" msgstr "" -#: library/sys.monitoring.rst:194 +#: library/sys.monitoring.rst:211 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" msgstr "" -#: library/sys.monitoring.rst:197 +#: library/sys.monitoring.rst:214 msgid ":monitoring-event:`C_RAISE`" msgstr "" -#: library/sys.monitoring.rst:198 +#: library/sys.monitoring.rst:215 msgid ":monitoring-event:`C_RETURN`" msgstr "" -#: library/sys.monitoring.rst:200 +#: library/sys.monitoring.rst:217 msgid "" "The :monitoring-event:`C_RETURN` and :monitoring-event:`C_RAISE` events are " "controlled by the :monitoring-event:`CALL` event. :monitoring-event:" @@ -310,41 +349,41 @@ msgid "" "corresponding :monitoring-event:`CALL` event is being monitored." msgstr "" -#: library/sys.monitoring.rst:206 +#: library/sys.monitoring.rst:226 msgid "Other events" msgstr "" -#: library/sys.monitoring.rst:208 +#: library/sys.monitoring.rst:228 msgid "" "Other events are not necessarily tied to a specific location in the program " -"and cannot be individually disabled." +"and cannot be individually disabled via :data:`DISABLE`." msgstr "" -#: library/sys.monitoring.rst:211 +#: library/sys.monitoring.rst:231 msgid "The other events that can be monitored are:" msgstr "" -#: library/sys.monitoring.rst:213 +#: library/sys.monitoring.rst:233 msgid ":monitoring-event:`PY_THROW`" msgstr "" -#: library/sys.monitoring.rst:214 +#: library/sys.monitoring.rst:234 msgid ":monitoring-event:`PY_UNWIND`" msgstr "" -#: library/sys.monitoring.rst:215 +#: library/sys.monitoring.rst:235 msgid ":monitoring-event:`RAISE`" msgstr "" -#: library/sys.monitoring.rst:216 +#: library/sys.monitoring.rst:236 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr "" -#: library/sys.monitoring.rst:220 +#: library/sys.monitoring.rst:240 msgid "The STOP_ITERATION event" msgstr "" -#: library/sys.monitoring.rst:222 +#: library/sys.monitoring.rst:242 msgid "" ":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that a :" "exc:`StopIteration` exception is raised when returning a value from a " @@ -353,7 +392,7 @@ msgid "" "an exception unless it would be visible to other code." msgstr "" -#: library/sys.monitoring.rst:228 +#: library/sys.monitoring.rst:248 msgid "" "To allow tools to monitor for real exceptions without slowing down " "generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is " @@ -361,83 +400,93 @@ msgid "" "unlike :monitoring-event:`RAISE`." msgstr "" -#: library/sys.monitoring.rst:234 +#: library/sys.monitoring.rst:253 +msgid "" +"Note that the :monitoring-event:`STOP_ITERATION` event and the :monitoring-" +"event:`RAISE` event for a :exc:`StopIteration` exception are equivalent, and " +"are treated as interchangeable when generating events. Implementations will " +"favor :monitoring-event:`STOP_ITERATION` for performance reasons, but may " +"generate a :monitoring-event:`RAISE` event with a :exc:`StopIteration`." +msgstr "" + +#: library/sys.monitoring.rst:261 msgid "Turning events on and off" msgstr "" -#: library/sys.monitoring.rst:236 +#: library/sys.monitoring.rst:263 msgid "" "In order to monitor an event, it must be turned on and a corresponding " "callback must be registered. Events can be turned on or off by setting the " -"events either globally or for a particular code object." +"events either globally and/or for a particular code object. An event will " +"trigger only once, even if it is turned on both globally and locally." msgstr "" -#: library/sys.monitoring.rst:243 +#: library/sys.monitoring.rst:270 msgid "Setting events globally" msgstr "" -#: library/sys.monitoring.rst:245 +#: library/sys.monitoring.rst:272 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." msgstr "" -#: library/sys.monitoring.rst:249 +#: library/sys.monitoring.rst:276 msgid "Returns the ``int`` representing all the active events." msgstr "" -#: library/sys.monitoring.rst:253 +#: library/sys.monitoring.rst:280 msgid "" "Activates all events which are set in *event_set*. Raises a :exc:" "`ValueError` if *tool_id* is not in use." msgstr "" -#: library/sys.monitoring.rst:256 +#: library/sys.monitoring.rst:283 msgid "No events are active by default." msgstr "" -#: library/sys.monitoring.rst:259 +#: library/sys.monitoring.rst:286 msgid "Per code object events" msgstr "" -#: library/sys.monitoring.rst:261 -msgid "Events can also be controlled on a per code object basis." -msgstr "" - -#: library/sys.monitoring.rst:265 -msgid "Returns all the local events for *code*" +#: library/sys.monitoring.rst:288 +msgid "" +"Events can also be controlled on a per code object basis. The functions " +"defined below which accept a :class:`types.CodeType` should be prepared to " +"accept a look-alike object from functions which are not defined in Python " +"(see :ref:`c-api-monitoring`)." msgstr "" -#: library/sys.monitoring.rst:269 -msgid "" -"Activates all the local events for *code* which are set in *event_set*. " -"Raises a :exc:`ValueError` if *tool_id* is not in use." +#: library/sys.monitoring.rst:295 +msgid "Returns all the :ref:`local events ` for *code*" msgstr "" -#: library/sys.monitoring.rst:272 +#: library/sys.monitoring.rst:299 msgid "" -"Local events add to global events, but do not mask them. In other words, all " -"global events will trigger for a code object, regardless of the local events." +"Activates all the :ref:`local events ` for *code* " +"which are set in *event_set*. Raises a :exc:`ValueError` if *tool_id* is not " +"in use." msgstr "" -#: library/sys.monitoring.rst:278 +#: library/sys.monitoring.rst:305 msgid "Disabling events" msgstr "" -#: library/sys.monitoring.rst:282 +#: library/sys.monitoring.rst:309 msgid "" "A special value that can be returned from a callback function to disable " "events for the current code location." msgstr "" -#: library/sys.monitoring.rst:285 +#: library/sys.monitoring.rst:312 msgid "" -"Local events can be disabled for a specific code location by returning :data:" -"`sys.monitoring.DISABLE` from a callback function. This does not change " -"which events are set, or any other code locations for the same event." +":ref:`Local events ` can be disabled for a specific " +"code location by returning :data:`sys.monitoring.DISABLE` from a callback " +"function. This does not change which events are set, or any other code " +"locations for the same event." msgstr "" -#: library/sys.monitoring.rst:289 +#: library/sys.monitoring.rst:317 msgid "" "Disabling events for specific locations is very important for high " "performance monitoring. For example, a program can be run under a debugger " @@ -445,105 +494,157 @@ msgid "" "breakpoints." msgstr "" -#: library/sys.monitoring.rst:296 +#: library/sys.monitoring.rst:322 +msgid "" +"If :data:`DISABLE` is returned by a callback for a :ref:`global event " +"`, :exc:`ValueError` will be raised by the " +"interpreter in a non-specific location (that is, no traceback will be " +"provided)." +msgstr "" + +#: library/sys.monitoring.rst:329 msgid "" "Enable all the events that were disabled by :data:`sys.monitoring.DISABLE` " "for all tools." msgstr "" -#: library/sys.monitoring.rst:303 +#: library/sys.monitoring.rst:336 msgid "Registering callback functions" msgstr "" -#: library/sys.monitoring.rst:305 -msgid "To register a callable for events call" -msgstr "" - -#: library/sys.monitoring.rst:309 +#: library/sys.monitoring.rst:340 msgid "Registers the callable *func* for the *event* with the given *tool_id*" msgstr "" -#: library/sys.monitoring.rst:311 +#: library/sys.monitoring.rst:342 msgid "" "If another callback was registered for the given *tool_id* and *event*, it " "is unregistered and returned. Otherwise :func:`register_callback` returns " "``None``." msgstr "" -#: library/sys.monitoring.rst:316 +#: library/sys.monitoring.rst:346 +msgid "" +"Raises an :ref:`auditing event ` ``sys.monitoring." +"register_callback`` with argument ``func``." +msgstr "" + +#: library/sys.monitoring.rst:348 msgid "" "Functions can be unregistered by calling ``sys.monitoring." "register_callback(tool_id, event, None)``." msgstr "" -#: library/sys.monitoring.rst:319 +#: library/sys.monitoring.rst:351 msgid "Callback functions can be registered and unregistered at any time." msgstr "" -#: library/sys.monitoring.rst:321 +#: library/sys.monitoring.rst:353 msgid "" -"Registering or unregistering a callback function will generate a :func:`sys." -"audit` event." +"Callbacks are called only once regardless if the event is turned on both " +"globally and locally. As such, if an event could be turned on for both " +"global and local events by your code then the callback needs to be written " +"to handle either trigger." msgstr "" -#: library/sys.monitoring.rst:325 +#: library/sys.monitoring.rst:360 msgid "Callback function arguments" msgstr "" -#: library/sys.monitoring.rst:329 +#: library/sys.monitoring.rst:364 msgid "" "A special value that is passed to a callback function to indicate that there " "are no arguments to the call." msgstr "" -#: library/sys.monitoring.rst:332 +#: library/sys.monitoring.rst:367 msgid "" "When an active event occurs, the registered callback function is called. " -"Different events will provide the callback function with different " -"arguments, as follows:" +"Callback functions returning an object other than :data:`DISABLE` will have " +"no effect. Different events will provide the callback function with " +"different arguments, as follows:" msgstr "" -#: library/sys.monitoring.rst:335 +#: library/sys.monitoring.rst:371 msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::" msgstr "" -#: library/sys.monitoring.rst:339 +#: library/sys.monitoring.rst:410 +msgid "func(code: CodeType, instruction_offset: int) -> object" +msgstr "" + +#: library/sys.monitoring.rst:375 msgid ":monitoring-event:`PY_RETURN` and :monitoring-event:`PY_YIELD`::" msgstr "" -#: library/sys.monitoring.rst:343 +#: library/sys.monitoring.rst:377 +msgid "func(code: CodeType, instruction_offset: int, retval: object) -> object" +msgstr "" + +#: library/sys.monitoring.rst:379 msgid "" ":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-event:" -"`C_RETURN`::" +"`C_RETURN` (*arg0* can be :data:`MISSING` specifically)::" +msgstr "" + +#: library/sys.monitoring.rst:382 +msgid "" +"func(code: CodeType, instruction_offset: int, callable: object, arg0: " +"object) -> object" +msgstr "" + +#: library/sys.monitoring.rst:384 +msgid "" +"*code* represents the code object where the call is being made, while " +"*callable* is the object that is about to be called (and thus triggered the " +"event). If there are no arguments, *arg0* is set to :data:`sys.monitoring." +"MISSING`." msgstr "" -#: library/sys.monitoring.rst:347 +#: library/sys.monitoring.rst:389 msgid "" -"If there are no arguments, *arg0* is set to :data:`sys.monitoring.MISSING`." +"For instance methods, *callable* will be the function object as found on the " +"class with *arg0* set to the instance (i.e. the ``self`` argument to the " +"method)." msgstr "" -#: library/sys.monitoring.rst:349 +#: library/sys.monitoring.rst:393 msgid "" ":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-event:" "`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-event:" "`PY_THROW` and :monitoring-event:`STOP_ITERATION`::" msgstr "" -#: library/sys.monitoring.rst:354 +#: library/sys.monitoring.rst:396 +msgid "" +"func(code: CodeType, instruction_offset: int, exception: BaseException) -> " +"object" +msgstr "" + +#: library/sys.monitoring.rst:398 msgid ":monitoring-event:`LINE`::" msgstr "" -#: library/sys.monitoring.rst:358 -msgid ":monitoring-event:`BRANCH` and :monitoring-event:`JUMP`::" +#: library/sys.monitoring.rst:400 +msgid "func(code: CodeType, line_number: int) -> object" +msgstr "" + +#: library/sys.monitoring.rst:402 +msgid "" +":monitoring-event:`BRANCH_LEFT`, :monitoring-event:`BRANCH_RIGHT` and :" +"monitoring-event:`JUMP`::" msgstr "" -#: library/sys.monitoring.rst:362 +#: library/sys.monitoring.rst:404 msgid "" -"Note that the *destination_offset* is where the code will next execute. For " -"an untaken branch this will be the offset of the instruction following the " -"branch." +"func(code: CodeType, instruction_offset: int, destination_offset: int) -> " +"object" +msgstr "" + +#: library/sys.monitoring.rst:406 +msgid "Note that the *destination_offset* is where the code will next execute." msgstr "" -#: library/sys.monitoring.rst:366 +#: library/sys.monitoring.rst:408 msgid ":monitoring-event:`INSTRUCTION`::" msgstr "" diff --git a/library/sys.po b/library/sys.po index d55656c3..46e6311c 100644 --- a/library/sys.po +++ b/library/sys.po @@ -8,23 +8,25 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/sys.rst:2 -msgid ":mod:`sys` --- System-specific parameters and functions" +msgid ":mod:`!sys` --- System-specific parameters and functions" msgstr "" #: library/sys.rst:9 msgid "" "This module provides access to some variables used or maintained by the " "interpreter and to functions that interact strongly with the interpreter. It " -"is always available." +"is always available. Unless explicitly noted otherwise, all variables are " +"read-only." msgstr "" #: library/sys.rst:16 @@ -39,8 +41,10 @@ msgid "" "removed)." msgstr "" -#: library/sys.rst:765 library/sys.rst:1459 -msgid ":ref:`Availability `: Unix." +#: library/sys.rst:298 library/sys.rst:789 library/sys.rst:1056 +#: library/sys.rst:1909 library/sys.rst:1932 library/sys.rst:1986 +#: library/sys.rst:2233 +msgid "Availability" msgstr "" #: library/sys.rst:30 @@ -71,12 +75,6 @@ msgid "" "mod:`ctypes`) should be completely removed or closely monitored." msgstr "" -#: library/sys.rst:49 -msgid "" -"Raises an :ref:`auditing event ` ``sys.addaudithook`` with no " -"arguments." -msgstr "" - #: library/sys.rst:51 msgid "" "Calling :func:`sys.addaudithook` will itself raise an auditing event named " @@ -178,75 +176,92 @@ msgstr "" #: library/sys.rst:133 msgid "" -"Set during Python startup, before ``site.py`` is run, to the same value as :" -"data:`exec_prefix`. If not running in a :ref:`virtual environment `, the values will stay the same; if ``site.py`` finds that a virtual " -"environment is in use, the values of :data:`prefix` and :data:`exec_prefix` " -"will be changed to point to the virtual environment, whereas :data:" -"`base_prefix` and :data:`base_exec_prefix` will remain pointing to the base " -"Python installation (the one which the virtual environment was created from)." +"Equivalent to :data:`exec_prefix`, but referring to the base Python " +"installation." msgstr "" -#: library/sys.rst:147 +#: library/sys.rst:135 msgid "" -"Set during Python startup, before ``site.py`` is run, to the same value as :" -"data:`prefix`. If not running in a :ref:`virtual environment `, " -"the values will stay the same; if ``site.py`` finds that a virtual " -"environment is in use, the values of :data:`prefix` and :data:`exec_prefix` " -"will be changed to point to the virtual environment, whereas :data:" -"`base_prefix` and :data:`base_exec_prefix` will remain pointing to the base " -"Python installation (the one which the virtual environment was created from)." +"When running under :ref:`sys-path-init-virtual-environments`, :data:" +"`exec_prefix` gets overwritten to the virtual environment prefix. :data:" +"`base_exec_prefix`, conversely, does not change, and always points to the " +"base Python installation. Refer to :ref:`sys-path-init-virtual-environments` " +"for more information." msgstr "" -#: library/sys.rst:160 +#: library/sys.rst:146 +msgid "" +"Equivalent to :data:`prefix`, but referring to the base Python installation." +msgstr "" + +#: library/sys.rst:148 +msgid "" +"When running under :ref:`virtual environment `, :data:`prefix` " +"gets overwritten to the virtual environment prefix. :data:`base_prefix`, " +"conversely, does not change, and always points to the base Python " +"installation. Refer to :ref:`sys-path-init-virtual-environments` for more " +"information." +msgstr "" + +#: library/sys.rst:159 msgid "" "An indicator of the native byte order. This will have the value ``'big'`` " "on big-endian (most-significant byte first) platforms, and ``'little'`` on " "little-endian (least-significant byte first) platforms." msgstr "" -#: library/sys.rst:167 +#: library/sys.rst:166 msgid "" "A tuple of strings containing the names of all modules that are compiled " "into this Python interpreter. (This information is not available in any " "other way --- ``modules.keys()`` only lists the imported modules.)" msgstr "" -#: library/sys.rst:171 +#: library/sys.rst:170 msgid "See also the :data:`sys.stdlib_module_names` list." msgstr "" -#: library/sys.rst:176 +#: library/sys.rst:175 msgid "" "Call ``func(*args)``, while tracing is enabled. The tracing state is saved, " "and restored afterwards. This is intended to be called from a debugger from " "a checkpoint, to recursively debug or profile some other code." msgstr "" -#: library/sys.rst:180 +#: library/sys.rst:179 msgid "" "Tracing is suspended while calling a tracing function set by :func:" "`settrace` or :func:`setprofile` to avoid infinite recursion. :func:`!" "call_tracing` enables explicit recursion of the tracing function." msgstr "" -#: library/sys.rst:187 +#: library/sys.rst:186 msgid "A string containing the copyright pertaining to the Python interpreter." msgstr "" -#: library/sys.rst:192 +#: library/sys.rst:191 msgid "" "Clear the internal type cache. The type cache is used to speed up attribute " "and method lookups. Use the function *only* to drop unnecessary references " "during reference leak debugging." msgstr "" -#: library/sys.rst:212 library/sys.rst:225 +#: library/sys.rst:222 library/sys.rst:235 msgid "" "This function should be used for internal and specialized purposes only." msgstr "" -#: library/sys.rst:201 +#: library/sys.rst:197 +msgid "Use the more general :func:`_clear_internal_caches` function instead." +msgstr "" + +#: library/sys.rst:203 +msgid "" +"Clear all internal performance-related caches. Use this function *only* to " +"release unnecessary references and memory blocks when hunting for leaks." +msgstr "" + +#: library/sys.rst:211 msgid "" "Return a dictionary mapping each thread's identifier to the topmost stack " "frame currently active in that thread at the time the function is called. " @@ -254,7 +269,7 @@ msgid "" "given such a frame." msgstr "" -#: library/sys.rst:206 +#: library/sys.rst:216 msgid "" "This is most useful for debugging deadlock: this function does not require " "the deadlocked threads' cooperation, and such threads' call stacks are " @@ -263,13 +278,13 @@ msgid "" "by the time calling code examines the frame." msgstr "" -#: library/sys.rst:214 +#: library/sys.rst:224 msgid "" "Raises an :ref:`auditing event ` ``sys._current_frames`` with no " "arguments." msgstr "" -#: library/sys.rst:218 +#: library/sys.rst:228 msgid "" "Return a dictionary mapping each thread's identifier to the topmost " "exception currently active in that thread at the time the function is " @@ -277,30 +292,30 @@ msgid "" "included in the result dictionary." msgstr "" -#: library/sys.rst:223 +#: library/sys.rst:233 msgid "This is most useful for statistical profiling." msgstr "" -#: library/sys.rst:227 +#: library/sys.rst:237 msgid "" "Raises an :ref:`auditing event ` ``sys._current_exceptions`` with " "no arguments." msgstr "" -#: library/sys.rst:229 +#: library/sys.rst:239 msgid "" "Each value in the dictionary is now a single exception instance, rather than " "a 3-tuple as returned from ``sys.exc_info()``." msgstr "" -#: library/sys.rst:235 +#: library/sys.rst:245 msgid "" "This hook function is called by built-in :func:`breakpoint`. By default, it " "drops you into the :mod:`pdb` debugger, but it can be set to any other " "function so that you can choose which debugger gets used." msgstr "" -#: library/sys.rst:239 +#: library/sys.rst:249 msgid "" "The signature of this function is dependent on what it calls. For example, " "the default binding (e.g. ``pdb.set_trace()``) expects no arguments, but you " @@ -310,7 +325,7 @@ msgid "" "returns is returned from ``breakpoint()``." msgstr "" -#: library/sys.rst:246 +#: library/sys.rst:256 msgid "" "The default implementation first consults the environment variable :envvar:" "`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this function returns " @@ -324,47 +339,43 @@ msgid "" "breakpointhook()`` returns to the built-in :func:`breakpoint` function." msgstr "" -#: library/sys.rst:258 +#: library/sys.rst:268 msgid "" "Note that if anything goes wrong while importing the callable named by :" "envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " "breakpoint is ignored." msgstr "" -#: library/sys.rst:262 +#: library/sys.rst:272 msgid "" "Also note that if ``sys.breakpointhook()`` is overridden programmatically, :" "envvar:`PYTHONBREAKPOINT` is *not* consulted." msgstr "" -#: library/sys.rst:269 +#: library/sys.rst:279 msgid "" "Print low-level information to stderr about the state of CPython's memory " "allocator." msgstr "" -#: library/sys.rst:272 +#: library/sys.rst:282 msgid "" "If Python is :ref:`built in debug mode ` (:option:`configure --" "with-pydebug option <--with-pydebug>`), it also performs some expensive " "internal consistency checks." msgstr "" -#: library/sys.rst:280 +#: library/sys.rst:290 msgid "" "This function is specific to CPython. The exact output format is not " "defined here, and may change." msgstr "" -#: library/sys.rst:286 +#: library/sys.rst:296 msgid "Integer specifying the handle of the Python DLL." msgstr "" -#: library/sys.rst:978 library/sys.rst:1981 -msgid ":ref:`Availability `: Windows." -msgstr "" - -#: library/sys.rst:293 +#: library/sys.rst:303 msgid "" "If *value* is not ``None``, this function prints ``repr(value)`` to ``sys." "stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is not " @@ -373,7 +384,7 @@ msgid "" "encoding`` with ``'backslashreplace'`` error handler." msgstr "" -#: library/sys.rst:299 +#: library/sys.rst:309 msgid "" "``sys.displayhook`` is called on the result of evaluating an :term:" "`expression` entered in an interactive Python session. The display of these " @@ -381,15 +392,36 @@ msgid "" "displayhook``." msgstr "" -#: library/sys.rst:303 +#: library/sys.rst:313 msgid "Pseudo-code::" msgstr "" -#: library/sys.rst:323 +#: library/sys.rst:315 +msgid "" +"def displayhook(value):\n" +" if value is None:\n" +" return\n" +" # Set '_' to None to avoid recursion\n" +" builtins._ = None\n" +" text = repr(value)\n" +" try:\n" +" sys.stdout.write(text)\n" +" except UnicodeEncodeError:\n" +" bytes = text.encode(sys.stdout.encoding, 'backslashreplace')\n" +" if hasattr(sys.stdout, 'buffer'):\n" +" sys.stdout.buffer.write(bytes)\n" +" else:\n" +" text = bytes.decode(sys.stdout.encoding, 'strict')\n" +" sys.stdout.write(text)\n" +" sys.stdout.write(\"\\n\")\n" +" builtins._ = value" +msgstr "" + +#: library/sys.rst:333 msgid "Use ``'backslashreplace'`` error handler on :exc:`UnicodeEncodeError`." msgstr "" -#: library/sys.rst:329 +#: library/sys.rst:339 msgid "" "If this is true, Python won't try to write ``.pyc`` files on the import of " "source modules. This value is initially set to ``True`` or ``False`` " @@ -398,38 +430,34 @@ msgid "" "to control bytecode file generation." msgstr "" -#: library/sys.rst:338 +#: library/sys.rst:348 msgid "" "A :term:`named tuple` holding information about the environment on the " "*wasm32-emscripten* platform. The named tuple is provisional and may change " "in the future." msgstr "" -#: library/sys.rst:344 +#: library/sys.rst:354 msgid "" "Emscripten version as tuple of ints (major, minor, micro), e.g. ``(3, 1, " "8)``." msgstr "" -#: library/sys.rst:348 +#: library/sys.rst:358 msgid "" "Runtime string, e.g. browser user agent, ``'Node.js v14.18.2'``, or " "``'UNKNOWN'``." msgstr "" -#: library/sys.rst:352 +#: library/sys.rst:362 msgid "``True`` if Python is compiled with Emscripten pthreads support." msgstr "" -#: library/sys.rst:356 +#: library/sys.rst:366 msgid "``True`` if Python is compiled with shared memory support." msgstr "" -#: library/sys.rst:358 -msgid ":ref:`Availability `: Emscripten." -msgstr "" - -#: library/sys.rst:365 +#: library/sys.rst:375 msgid "" "If this is set (not ``None``), Python will write bytecode-cache ``.pyc`` " "files to (and read them from) a parallel directory tree rooted at this " @@ -440,12 +468,12 @@ msgid "" "with the same pycache prefix (if any) that you will use at runtime." msgstr "" -#: library/sys.rst:373 +#: library/sys.rst:383 msgid "" "A relative path is interpreted relative to the current working directory." msgstr "" -#: library/sys.rst:375 +#: library/sys.rst:385 msgid "" "This value is initially set based on the value of the :option:`-X` " "``pycache_prefix=PATH`` command-line option or the :envvar:" @@ -453,12 +481,12 @@ msgid "" "If neither are set, it is ``None``." msgstr "" -#: library/sys.rst:385 +#: library/sys.rst:395 msgid "" "This function prints out a given traceback and exception to ``sys.stderr``." msgstr "" -#: library/sys.rst:387 +#: library/sys.rst:397 msgid "" "When an exception other than :exc:`SystemExit` is raised and uncaught, the " "interpreter calls ``sys.excepthook`` with three arguments, the exception " @@ -469,13 +497,7 @@ msgid "" "argument function to ``sys.excepthook``." msgstr "" -#: library/sys.rst:394 -msgid "" -"Raises an :ref:`auditing event ` ``sys.excepthook`` with arguments " -"``hook``, ``type``, ``value``, ``traceback``." -msgstr "" - -#: library/sys.rst:396 +#: library/sys.rst:406 msgid "" "Raise an auditing event ``sys.excepthook`` with arguments ``hook``, " "``type``, ``value``, ``traceback`` when an uncaught exception occurs. If no " @@ -485,14 +507,14 @@ msgid "" "excepthook`` will be called." msgstr "" -#: library/sys.rst:405 +#: library/sys.rst:415 msgid "" "The :func:`sys.unraisablehook` function handles unraisable exceptions and " "the :func:`threading.excepthook` function handles exception raised by :func:" "`threading.Thread.run`." msgstr "" -#: library/sys.rst:415 +#: library/sys.rst:425 msgid "" "These objects contain the original values of ``breakpointhook``, " "``displayhook``, ``excepthook``, and ``unraisablehook`` at the start of the " @@ -501,15 +523,15 @@ msgid "" "get replaced with broken or alternative objects." msgstr "" -#: library/sys.rst:421 +#: library/sys.rst:431 msgid "__breakpointhook__" msgstr "" -#: library/sys.rst:424 +#: library/sys.rst:434 msgid "__unraisablehook__" msgstr "" -#: library/sys.rst:430 +#: library/sys.rst:440 msgid "" "This function, when called while an exception handler is executing (such as " "an ``except`` or ``except*`` clause), returns the exception instance that " @@ -517,11 +539,11 @@ msgid "" "another, only the exception handled by the innermost handler is accessible." msgstr "" -#: library/sys.rst:435 +#: library/sys.rst:445 msgid "If no exception handler is executing, this function returns ``None``." msgstr "" -#: library/sys.rst:442 +#: library/sys.rst:452 msgid "" "This function returns the old-style representation of the handled exception. " "If an exception ``e`` is currently handled (so :func:`exception` would " @@ -532,13 +554,13 @@ msgid "" "stack at the point where the exception last occurred." msgstr "" -#: library/sys.rst:453 +#: library/sys.rst:463 msgid "" "If no exception is being handled anywhere on the stack, this function return " "a tuple containing three ``None`` values." msgstr "" -#: library/sys.rst:456 +#: library/sys.rst:466 msgid "" "The ``type`` and ``traceback`` fields are now derived from the ``value`` " "(the exception instance), so when an exception is modified while it is being " @@ -546,7 +568,7 @@ msgid "" "func:`exc_info`." msgstr "" -#: library/sys.rst:464 +#: library/sys.rst:474 msgid "" "A string giving the site-specific directory prefix where the platform-" "dependent Python files are installed; by default, this is also ``'/usr/" @@ -558,15 +580,24 @@ msgid "" "is the version number of Python, for example ``3.2``." msgstr "" -#: library/sys.rst:475 +#: library/sys.rst:485 +msgid "" +"If a :ref:`virtual environment ` is in effect, this :data:" +"`exec_prefix` will point to the virtual environment. The value for the " +"Python installation will still be available, via :data:`base_exec_prefix`. " +"Refer to :ref:`sys-path-init-virtual-environments` for more information." +msgstr "" + +#: library/sys.rst:1631 msgid "" -"If a :ref:`virtual environment ` is in effect, this value will be " -"changed in ``site.py`` to point to the virtual environment. The value for " -"the Python installation will still be available, via :data:" -"`base_exec_prefix`." +"When running under a :ref:`virtual environment `, :data:`prefix` " +"and :data:`exec_prefix` are now set to the virtual environment prefix by " +"the :ref:`path initialization `, instead of :mod:`site`. This " +"means that :data:`prefix` and :data:`exec_prefix` always point to the " +"virtual environment, even when :mod:`site` is disabled (:option:`-S`)." msgstr "" -#: library/sys.rst:483 +#: library/sys.rst:501 msgid "" "A string giving the absolute path of the executable binary for the Python " "interpreter, on systems where this makes sense. If Python is unable to " @@ -574,13 +605,13 @@ msgid "" "empty string or ``None``." msgstr "" -#: library/sys.rst:491 +#: library/sys.rst:509 msgid "" "Raise a :exc:`SystemExit` exception, signaling an intention to exit the " "interpreter." msgstr "" -#: library/sys.rst:493 +#: library/sys.rst:511 msgid "" "The optional argument *arg* can be an integer giving the exit status " "(defaulting to zero), or another type of object. If it is an integer, zero " @@ -596,7 +627,7 @@ msgid "" "way to exit a program when an error occurs." msgstr "" -#: library/sys.rst:506 +#: library/sys.rst:524 msgid "" "Since :func:`exit` ultimately \"only\" raises an exception, it will only " "exit the process when called from the main thread, and the exception is not " @@ -605,127 +636,156 @@ msgid "" "an outer level." msgstr "" -#: library/sys.rst:511 +#: library/sys.rst:529 msgid "" "If an error occurs in the cleanup after the Python interpreter has caught :" "exc:`SystemExit` (such as an error flushing buffered data in the standard " "streams), the exit status is changed to 120." msgstr "" -#: library/sys.rst:519 +#: library/sys.rst:537 msgid "" -"The :term:`named tuple` *flags* exposes the status of command line flags. " -"The attributes are read only." +"The :term:`named tuple` *flags* exposes the status of command line flags. " +"Flags should only be accessed only by name and not by index. The attributes " +"are read only." msgstr "" -#: library/sys.rst:525 +#: library/sys.rst:544 msgid ":option:`-d`" msgstr "" -#: library/sys.rst:531 +#: library/sys.rst:550 msgid ":option:`-i`" msgstr "" -#: library/sys.rst:534 +#: library/sys.rst:553 msgid ":option:`-I`" msgstr "" -#: library/sys.rst:537 +#: library/sys.rst:556 msgid ":option:`-O` or :option:`-OO`" msgstr "" -#: library/sys.rst:540 +#: library/sys.rst:559 msgid ":option:`-B`" msgstr "" -#: library/sys.rst:543 +#: library/sys.rst:562 msgid ":option:`-s`" msgstr "" -#: library/sys.rst:546 +#: library/sys.rst:565 msgid ":option:`-S`" msgstr "" -#: library/sys.rst:549 +#: library/sys.rst:568 msgid ":option:`-E`" msgstr "" -#: library/sys.rst:552 +#: library/sys.rst:571 msgid ":option:`-v`" msgstr "" -#: library/sys.rst:555 +#: library/sys.rst:574 msgid ":option:`-b`" msgstr "" -#: library/sys.rst:558 +#: library/sys.rst:577 msgid ":option:`-q`" msgstr "" -#: library/sys.rst:561 +#: library/sys.rst:580 msgid ":option:`-R`" msgstr "" -#: library/sys.rst:564 +#: library/sys.rst:583 msgid ":option:`-X dev <-X>` (:ref:`Python Development Mode `)" msgstr "" -#: library/sys.rst:567 +#: library/sys.rst:586 msgid ":option:`-X utf8 <-X>`" msgstr "" -#: library/sys.rst:570 +#: library/sys.rst:589 msgid ":option:`-P`" msgstr "" -#: library/sys.rst:573 +#: library/sys.rst:592 msgid "" ":option:`-X int_max_str_digits <-X>` (:ref:`integer string conversion length " "limitation `)" msgstr "" -#: library/sys.rst:577 +#: library/sys.rst:596 msgid ":option:`-X warn_default_encoding <-X>`" msgstr "" -#: library/sys.rst:579 +#: library/sys.rst:599 +msgid ":option:`-X gil <-X>` and :envvar:`PYTHON_GIL`" +msgstr "" + +#: library/sys.rst:602 +msgid "" +":option:`-X thread_inherit_context <-X>` and :envvar:" +"`PYTHON_THREAD_INHERIT_CONTEXT`" +msgstr "" + +#: library/sys.rst:606 +msgid "" +":option:`-X context_aware_warnings <-X>` and :envvar:" +"`PYTHON_CONTEXT_AWARE_WARNINGS`" +msgstr "" + +#: library/sys.rst:610 msgid "Added ``quiet`` attribute for the new :option:`-q` flag." msgstr "" -#: library/sys.rst:582 +#: library/sys.rst:613 msgid "The ``hash_randomization`` attribute." msgstr "" -#: library/sys.rst:585 +#: library/sys.rst:616 msgid "Removed obsolete ``division_warning`` attribute." msgstr "" -#: library/sys.rst:588 +#: library/sys.rst:619 msgid "Added ``isolated`` attribute for :option:`-I` ``isolated`` flag." msgstr "" -#: library/sys.rst:591 +#: library/sys.rst:622 msgid "" "Added the ``dev_mode`` attribute for the new :ref:`Python Development Mode " "` and the ``utf8_mode`` attribute for the new :option:`-X` " "``utf8`` flag." msgstr "" -#: library/sys.rst:596 +#: library/sys.rst:627 msgid "" "Added ``warn_default_encoding`` attribute for :option:`-X` " "``warn_default_encoding`` flag." msgstr "" -#: library/sys.rst:599 +#: library/sys.rst:630 msgid "Added the ``safe_path`` attribute for :option:`-P` option." msgstr "" -#: library/sys.rst:602 +#: library/sys.rst:633 msgid "Added the ``int_max_str_digits`` attribute." msgstr "" -#: library/sys.rst:608 +#: library/sys.rst:636 +msgid "Added the ``gil`` attribute." +msgstr "" + +#: library/sys.rst:639 +msgid "Added the ``thread_inherit_context`` attribute." +msgstr "" + +#: library/sys.rst:642 +msgid "Added the ``context_aware_warnings`` attribute." +msgstr "" + +#: library/sys.rst:648 msgid "" "A :term:`named tuple` holding information about the float type. It contains " "low level information about the precision and internal representation. The " @@ -735,161 +795,161 @@ msgid "" "floating types', for details." msgstr "" -#: library/sys.rst:615 +#: library/sys.rst:655 msgid "Attributes of the :data:`!float_info` :term:`named tuple`" msgstr "" -#: library/sys.rst:618 +#: library/sys.rst:658 msgid "attribute" msgstr "" -#: library/sys.rst:619 +#: library/sys.rst:659 msgid "float.h macro" msgstr "" -#: library/sys.rst:620 +#: library/sys.rst:660 msgid "explanation" msgstr "" -#: library/sys.rst:623 +#: library/sys.rst:663 msgid ":c:macro:`!DBL_EPSILON`" msgstr "" -#: library/sys.rst:624 +#: library/sys.rst:664 msgid "" "difference between 1.0 and the least value greater than 1.0 that is " "representable as a float." msgstr "" -#: library/sys.rst:627 +#: library/sys.rst:667 msgid "See also :func:`math.ulp`." msgstr "" -#: library/sys.rst:630 +#: library/sys.rst:670 msgid ":c:macro:`!DBL_DIG`" msgstr "" -#: library/sys.rst:631 +#: library/sys.rst:671 msgid "" "The maximum number of decimal digits that can be faithfully represented in a " "float; see below." msgstr "" -#: library/sys.rst:635 +#: library/sys.rst:675 msgid ":c:macro:`!DBL_MANT_DIG`" msgstr "" -#: library/sys.rst:636 +#: library/sys.rst:676 msgid "" "Float precision: the number of base-``radix`` digits in the significand of a " "float." msgstr "" -#: library/sys.rst:640 +#: library/sys.rst:680 msgid ":c:macro:`!DBL_MAX`" msgstr "" -#: library/sys.rst:641 +#: library/sys.rst:681 msgid "The maximum representable positive finite float." msgstr "" -#: library/sys.rst:644 +#: library/sys.rst:684 msgid ":c:macro:`!DBL_MAX_EXP`" msgstr "" -#: library/sys.rst:645 +#: library/sys.rst:685 msgid "" "The maximum integer *e* such that ``radix**(e-1)`` is a representable finite " "float." msgstr "" -#: library/sys.rst:649 +#: library/sys.rst:689 msgid ":c:macro:`!DBL_MAX_10_EXP`" msgstr "" -#: library/sys.rst:650 +#: library/sys.rst:690 msgid "" "The maximum integer *e* such that ``10**e`` is in the range of representable " "finite floats." msgstr "" -#: library/sys.rst:654 +#: library/sys.rst:694 msgid ":c:macro:`!DBL_MIN`" msgstr "" -#: library/sys.rst:655 +#: library/sys.rst:695 msgid "The minimum representable positive *normalized* float." msgstr "" -#: library/sys.rst:657 +#: library/sys.rst:697 msgid "" "Use :func:`math.ulp(0.0) ` to get the smallest positive " "*denormalized* representable float." msgstr "" -#: library/sys.rst:661 +#: library/sys.rst:701 msgid ":c:macro:`!DBL_MIN_EXP`" msgstr "" -#: library/sys.rst:662 +#: library/sys.rst:702 msgid "" "The minimum integer *e* such that ``radix**(e-1)`` is a normalized float." msgstr "" -#: library/sys.rst:666 +#: library/sys.rst:706 msgid ":c:macro:`!DBL_MIN_10_EXP`" msgstr "" -#: library/sys.rst:667 +#: library/sys.rst:707 msgid "The minimum integer *e* such that ``10**e`` is a normalized float." msgstr "" -#: library/sys.rst:670 +#: library/sys.rst:710 msgid ":c:macro:`!FLT_RADIX`" msgstr "" -#: library/sys.rst:671 +#: library/sys.rst:711 msgid "The radix of exponent representation." msgstr "" -#: library/sys.rst:674 +#: library/sys.rst:714 msgid ":c:macro:`!FLT_ROUNDS`" msgstr "" -#: library/sys.rst:675 +#: library/sys.rst:715 msgid "" "An integer representing the rounding mode for floating-point arithmetic. " "This reflects the value of the system :c:macro:`!FLT_ROUNDS` macro at " "interpreter startup time:" msgstr "" -#: library/sys.rst:679 +#: library/sys.rst:719 msgid "``-1``: indeterminable" msgstr "" -#: library/sys.rst:680 +#: library/sys.rst:720 msgid "``0``: toward zero" msgstr "" -#: library/sys.rst:681 +#: library/sys.rst:721 msgid "``1``: to nearest" msgstr "" -#: library/sys.rst:682 +#: library/sys.rst:722 msgid "``2``: toward positive infinity" msgstr "" -#: library/sys.rst:683 +#: library/sys.rst:723 msgid "``3``: toward negative infinity" msgstr "" -#: library/sys.rst:685 +#: library/sys.rst:725 msgid "" "All other values for :c:macro:`!FLT_ROUNDS` characterize implementation-" "defined rounding behavior." msgstr "" -#: library/sys.rst:688 +#: library/sys.rst:728 msgid "" "The attribute :attr:`sys.float_info.dig` needs further explanation. If " "``s`` is any string representing a decimal number with at most :attr:`!sys." @@ -897,13 +957,30 @@ msgid "" "back again will recover a string representing the same decimal value::" msgstr "" -#: library/sys.rst:701 +#: library/sys.rst:734 +msgid "" +">>> import sys\n" +">>> sys.float_info.dig\n" +"15\n" +">>> s = '3.14159265358979' # decimal string with 15 significant digits\n" +">>> format(float(s), '.15g') # convert to float and back -> same value\n" +"'3.14159265358979'" +msgstr "" + +#: library/sys.rst:741 msgid "" "But for strings with more than :attr:`sys.float_info.dig` significant " "digits, this isn't always true::" msgstr "" -#: library/sys.rst:710 +#: library/sys.rst:744 +msgid "" +">>> s = '9876543211234567' # 16 significant digits is too many!\n" +">>> format(float(s), '.16g') # conversion changes value\n" +"'9876543211234568'" +msgstr "" + +#: library/sys.rst:750 msgid "" "A string indicating how the :func:`repr` function behaves for floats. If " "the string has value ``'short'`` then for a finite float ``x``, ``repr(x)`` " @@ -913,48 +990,47 @@ msgid "" "same way as it did in versions of Python prior to 3.1." msgstr "" -#: library/sys.rst:723 +#: library/sys.rst:763 msgid "" "Return the number of memory blocks currently allocated by the interpreter, " "regardless of their size. This function is mainly useful for tracking and " "debugging memory leaks. Because of the interpreter's internal caches, the " "result can vary from call to call; you may have to call :func:" -"`_clear_type_cache()` and :func:`gc.collect()` to get more predictable " +"`_clear_internal_caches` and :func:`gc.collect` to get more predictable " "results." msgstr "" -#: library/sys.rst:730 +#: library/sys.rst:770 msgid "" "If a Python build or implementation cannot reasonably compute this " -"information, :func:`getallocatedblocks()` is allowed to return 0 instead." +"information, :func:`getallocatedblocks` is allowed to return 0 instead." msgstr "" -#: library/sys.rst:738 +#: library/sys.rst:778 msgid "Return the number of unicode objects that have been interned." msgstr "" -#: library/sys.rst:745 -msgid "Return the build time API version of Android as an integer." -msgstr "" - -#: library/sys.rst:747 -msgid ":ref:`Availability `: Android." +#: library/sys.rst:785 +msgid "" +"Return the build-time API level of Android as an integer. This represents " +"the minimum version of Android this build of Python can run on. For runtime " +"version information, see :func:`platform.android_ver`." msgstr "" -#: library/sys.rst:754 +#: library/sys.rst:796 msgid "" -"Return the name of the current default string encoding used by the Unicode " -"implementation." +"Return ``'utf-8'``. This is the name of the default string encoding, used in " +"methods like :meth:`str.encode`." msgstr "" -#: library/sys.rst:760 +#: library/sys.rst:802 msgid "" "Return the current value of the flags that are used for :c:func:`dlopen` " "calls. Symbolic names for the flag values can be found in the :mod:`os` " "module (:samp:`RTLD_{xxx}` constants, e.g. :const:`os.RTLD_LAZY`)." msgstr "" -#: library/sys.rst:770 +#: library/sys.rst:812 msgid "" "Get the :term:`filesystem encoding `: " "the encoding used with the :term:`filesystem error handler ` is enabled." msgstr "" -#: library/sys.rst:803 +#: library/sys.rst:845 msgid "" "Get the :term:`filesystem error handler `: the error handler used with the :term:`filesystem encoding " @@ -1009,35 +1085,41 @@ msgid "" "func:`getfilesystemencoding`." msgstr "" -#: library/sys.rst:821 +#: library/sys.rst:863 msgid "" "Returns the current value for the :ref:`integer string conversion length " "limitation `. See also :func:`set_int_max_str_digits`." msgstr "" -#: library/sys.rst:828 +#: library/sys.rst:870 msgid "" "Return the reference count of the *object*. The count returned is generally " "one higher than you might expect, because it includes the (temporary) " "reference as an argument to :func:`getrefcount`." msgstr "" -#: library/sys.rst:832 +#: library/sys.rst:874 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are \"immortal\" " -"and have a very high refcount that does not reflect the actual number of " -"references. Consequently, do not rely on the returned value to be accurate, " -"other than a value of 0 or 1." +"the object are actually held. For example, some objects are :term:" +"`immortal` and have a very high refcount that does not reflect the actual " +"number of references. Consequently, do not rely on the returned value to be " +"accurate, other than a value of 0 or 1." msgstr "" -#: library/sys.rst:838 +#: library/sys.rst:882 +msgid "" +":term:`Immortal ` objects with a large reference count can be " +"identified via :func:`_is_immortal`." +msgstr "" + +#: library/sys.rst:885 msgid "" "Immortal objects have very large refcounts that do not match the actual " "number of references to the object." msgstr "" -#: library/sys.rst:844 +#: library/sys.rst:891 msgid "" "Return the current value of the recursion limit, the maximum depth of the " "Python interpreter stack. This limit prevents infinite recursion from " @@ -1045,46 +1127,47 @@ msgid "" "func:`setrecursionlimit`." msgstr "" -#: library/sys.rst:852 +#: library/sys.rst:899 msgid "" "Return the size of an object in bytes. The object can be any type of object. " "All built-in objects will return correct results, but this does not have to " "hold true for third-party extensions as it is implementation specific." msgstr "" -#: library/sys.rst:857 +#: library/sys.rst:904 msgid "" "Only the memory consumption directly attributed to the object is accounted " "for, not the memory consumption of objects it refers to." msgstr "" -#: library/sys.rst:860 +#: library/sys.rst:907 msgid "" "If given, *default* will be returned if the object does not provide means to " "retrieve the size. Otherwise a :exc:`TypeError` will be raised." msgstr "" -#: library/sys.rst:863 +#: library/sys.rst:910 msgid "" ":func:`getsizeof` calls the object's ``__sizeof__`` method and adds an " "additional garbage collector overhead if the object is managed by the " "garbage collector." msgstr "" -#: library/sys.rst:867 +#: library/sys.rst:914 msgid "" -"See `recursive sizeof recipe `_ for an example of using :func:`getsizeof` recursively to find the size " -"of containers and all their contents." +"See `recursive sizeof recipe `_ for an example of " +"using :func:`getsizeof` recursively to find the size of containers and all " +"their contents." msgstr "" -#: library/sys.rst:873 +#: library/sys.rst:920 msgid "" -"Return the interpreter's \"thread switch interval\"; see :func:" +"Return the interpreter's \"thread switch interval\" in seconds; see :func:" "`setswitchinterval`." msgstr "" -#: library/sys.rst:881 +#: library/sys.rst:928 msgid "" "Return a frame object from the call stack. If optional integer *depth* is " "given, return the frame object that many calls below the top of the stack. " @@ -1093,19 +1176,19 @@ msgid "" "stack." msgstr "" -#: library/sys.rst:886 +#: library/sys.rst:933 msgid "" "Raises an :ref:`auditing event ` ``sys._getframe`` with argument " "``frame``." msgstr "" -#: library/sys.rst:906 +#: library/sys.rst:953 msgid "" "This function should be used for internal and specialized purposes only. It " "is not guaranteed to exist in all implementations of Python." msgstr "" -#: library/sys.rst:896 +#: library/sys.rst:943 msgid "" "Return the name of a module from the call stack. If optional integer " "*depth* is given, return the module that many calls below the top of the " @@ -1114,21 +1197,54 @@ msgid "" "returning the module at the top of the call stack." msgstr "" -#: library/sys.rst:902 +#: library/sys.rst:949 msgid "" "Raises an :ref:`auditing event ` ``sys._getframemodulename`` with " "argument ``depth``." msgstr "" -#: library/sys.rst:916 +#: library/sys.rst:961 +msgid "" +"This function only exists if CPython was built using the specialized " +"configure option :option:`--with-trace-refs`. It is intended only for " +"debugging garbage-collection issues." +msgstr "" + +#: library/sys.rst:965 +msgid "" +"Return a list of up to *limit* dynamically allocated Python objects. If " +"*type* is given, only objects of that exact type (not subtypes) are included." +msgstr "" + +#: library/sys.rst:969 +msgid "" +"Objects from the list are not safe to use. Specifically, the result will " +"include objects from all interpreters that share their object allocator " +"state (that is, ones created with :c:member:`PyInterpreterConfig." +"use_main_obmalloc` set to 1 or using :c:func:`Py_NewInterpreter`, and the :" +"ref:`main interpreter `). Mixing objects from " +"different interpreters may lead to crashes or other unexpected behavior." +msgstr "" + +#: library/sys.rst:1388 +msgid "" +"This function should be used for specialized purposes only. It is not " +"guaranteed to exist in all implementations of Python." +msgstr "" + +#: library/sys.rst:985 +msgid "The result may include objects from other interpreters." +msgstr "" + +#: library/sys.rst:994 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: library/sys.rst:925 +#: library/sys.rst:1003 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: library/sys.rst:929 +#: library/sys.rst:1007 msgid "" "The :func:`gettrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -1136,7 +1252,7 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: library/sys.rst:937 +#: library/sys.rst:1015 msgid "" "Return a named tuple describing the Windows version currently running. The " "named elements are *major*, *minor*, *build*, *platform*, *service_pack*, " @@ -1148,54 +1264,54 @@ msgid "" "first 5 elements are retrievable by indexing." msgstr "" -#: library/sys.rst:948 +#: library/sys.rst:1026 msgid "*platform* will be ``2`` (VER_PLATFORM_WIN32_NT)." msgstr "" -#: library/sys.rst:950 +#: library/sys.rst:1028 msgid "*product_type* may be one of the following values:" msgstr "" -#: library/sys.rst:953 +#: library/sys.rst:1031 msgid "Constant" msgstr "" -#: library/sys.rst:953 +#: library/sys.rst:1031 msgid "Meaning" msgstr "" -#: library/sys.rst:955 +#: library/sys.rst:1033 msgid "``1`` (VER_NT_WORKSTATION)" msgstr "" -#: library/sys.rst:955 +#: library/sys.rst:1033 msgid "The system is a workstation." msgstr "" -#: library/sys.rst:957 +#: library/sys.rst:1035 msgid "``2`` (VER_NT_DOMAIN_CONTROLLER)" msgstr "" -#: library/sys.rst:957 +#: library/sys.rst:1035 msgid "The system is a domain controller." msgstr "" -#: library/sys.rst:960 +#: library/sys.rst:1038 msgid "``3`` (VER_NT_SERVER)" msgstr "" -#: library/sys.rst:960 +#: library/sys.rst:1038 msgid "The system is a server, but not a domain controller." msgstr "" -#: library/sys.rst:964 +#: library/sys.rst:1042 msgid "" "This function wraps the Win32 :c:func:`!GetVersionEx` function; see the " "Microsoft documentation on :c:func:`!OSVERSIONINFOEX` for more information " "about these fields." msgstr "" -#: library/sys.rst:968 +#: library/sys.rst:1046 msgid "" "*platform_version* returns the major version, minor version and build number " "of the current operating system, rather than the version that is being " @@ -1203,24 +1319,24 @@ msgid "" "feature detection." msgstr "" -#: library/sys.rst:974 +#: library/sys.rst:1052 msgid "" "*platform_version* derives the version from kernel32.dll which can be of a " "different version than the OS version. Please use :mod:`platform` module for " "achieving accurate OS version." msgstr "" -#: library/sys.rst:980 +#: library/sys.rst:1058 msgid "" "Changed to a named tuple and added *service_pack_minor*, " "*service_pack_major*, *suite_mask*, and *product_type*." msgstr "" -#: library/sys.rst:984 +#: library/sys.rst:1062 msgid "Added *platform_version*" msgstr "" -#: library/sys.rst:990 +#: library/sys.rst:1068 msgid "" "Returns an *asyncgen_hooks* object, which is similar to a :class:" "`~collections.namedtuple` of the form ``(firstiter, finalizer)``, where " @@ -1230,71 +1346,75 @@ msgid "" "loop." msgstr "" -#: library/sys.rst:997 +#: library/sys.rst:1075 msgid "See :pep:`525` for more details." msgstr "" -#: library/sys.rst:1677 +#: library/sys.rst:1878 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" msgstr "" -#: library/sys.rst:1007 +#: library/sys.rst:1085 msgid "" "Get the current coroutine origin tracking depth, as set by :func:" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: library/sys.rst:1698 +#: library/sys.rst:1899 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." msgstr "" -#: library/sys.rst:1019 +#: library/sys.rst:1097 msgid "" "A :term:`named tuple` giving parameters of the numeric hash implementation. " "For more details about hashing of numeric types, see :ref:`numeric-hash`." msgstr "" -#: library/sys.rst:1025 +#: library/sys.rst:1103 msgid "The width in bits used for hash values" msgstr "" -#: library/sys.rst:1029 +#: library/sys.rst:1107 msgid "The prime modulus P used for numeric hash scheme" msgstr "" -#: library/sys.rst:1033 +#: library/sys.rst:1111 msgid "The hash value returned for a positive infinity" msgstr "" -#: library/sys.rst:1037 +#: library/sys.rst:1115 msgid "(This attribute is no longer used)" msgstr "" -#: library/sys.rst:1041 +#: library/sys.rst:1119 msgid "The multiplier used for the imaginary part of a complex number" msgstr "" -#: library/sys.rst:1045 +#: library/sys.rst:1123 msgid "The name of the algorithm for hashing of str, bytes, and memoryview" msgstr "" -#: library/sys.rst:1049 +#: library/sys.rst:1127 msgid "The internal output size of the hash algorithm" msgstr "" -#: library/sys.rst:1053 +#: library/sys.rst:1131 msgid "The size of the seed key of the hash algorithm" msgstr "" -#: library/sys.rst:1057 -msgid "Added *algorithm*, *hash_bits* and *seed_bits*" +#: library/sys.rst:1135 +msgid "Cutoff for small string DJBX33A optimization in range ``[1, cutoff)``." msgstr "" -#: library/sys.rst:1063 +#: library/sys.rst:1139 +msgid "Added *algorithm*, *hash_bits*, *seed_bits*, and *cutoff*." +msgstr "" + +#: library/sys.rst:1145 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " @@ -1302,7 +1422,17 @@ msgid "" "version 1.5.2, use::" msgstr "" -#: library/sys.rst:1074 +#: library/sys.rst:1149 +msgid "" +"if sys.hexversion >= 0x010502F0:\n" +" # use some advanced feature\n" +" ...\n" +"else:\n" +" # use an alternative implementation or warn the user\n" +" ..." +msgstr "" + +#: library/sys.rst:1156 msgid "" "This is called ``hexversion`` since it only really looks meaningful when " "viewed as the result of passing it to the built-in :func:`hex` function. " @@ -1310,25 +1440,25 @@ msgid "" "human-friendly encoding of the same information." msgstr "" -#: library/sys.rst:1079 +#: library/sys.rst:1161 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." msgstr "" -#: library/sys.rst:1084 +#: library/sys.rst:1166 msgid "" "An object containing information about the implementation of the currently " "running Python interpreter. The following attributes are required to exist " "in all Python implementations." msgstr "" -#: library/sys.rst:1088 +#: library/sys.rst:1170 msgid "" "*name* is the implementation's identifier, e.g. ``'cpython'``. The actual " "string is defined by the Python implementation, but it is guaranteed to be " "lower case." msgstr "" -#: library/sys.rst:1092 +#: library/sys.rst:1174 msgid "" "*version* is a named tuple, in the same format as :data:`sys.version_info`. " "It represents the version of the Python *implementation*. This has a " @@ -1340,13 +1470,13 @@ msgid "" "the same value, since it is the reference implementation." msgstr "" -#: library/sys.rst:1102 +#: library/sys.rst:1184 msgid "" "*hexversion* is the implementation version in hexadecimal format, like :data:" "`sys.hexversion`." msgstr "" -#: library/sys.rst:1105 +#: library/sys.rst:1187 msgid "" "*cache_tag* is the tag used by the import machinery in the filenames of " "cached modules. By convention, it would be a composite of the " @@ -1355,7 +1485,19 @@ msgid "" "set to ``None``, it indicates that module caching should be disabled." msgstr "" -#: library/sys.rst:1112 +#: library/sys.rst:1194 +msgid "" +"*supports_isolated_interpreters* is a boolean value, whether this " +"implementation supports multiple isolated interpreters. It is ``True`` for " +"CPython on most platforms. Platforms with this support implement the low-" +"level :mod:`!_interpreters` module." +msgstr "" + +#: library/sys.rst:1201 +msgid ":pep:`684`, :pep:`734`, and :mod:`concurrent.interpreters`." +msgstr "" + +#: library/sys.rst:1203 msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " @@ -1365,47 +1507,51 @@ msgid "" "versions, however.) See :pep:`421` for more information." msgstr "" -#: library/sys.rst:1123 +#: library/sys.rst:1212 +msgid "Added ``supports_isolated_interpreters`` field." +msgstr "" + +#: library/sys.rst:1217 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" -#: library/sys.rst:1128 +#: library/sys.rst:1222 msgid "" "A :term:`named tuple` that holds information about Python's internal " "representation of integers. The attributes are read only." msgstr "" -#: library/sys.rst:1133 +#: library/sys.rst:1227 msgid "" "The number of bits held in each digit. Python integers are stored internally " "in base ``2**int_info.bits_per_digit``." msgstr "" -#: library/sys.rst:1138 +#: library/sys.rst:1232 msgid "The size in bytes of the C type used to represent a digit." msgstr "" -#: library/sys.rst:1142 +#: library/sys.rst:1236 msgid "" "The default value for :func:`sys.get_int_max_str_digits` when it is not " "otherwise explicitly configured." msgstr "" -#: library/sys.rst:1147 +#: library/sys.rst:1241 msgid "" "The minimum non-zero value for :func:`sys.set_int_max_str_digits`, :envvar:" "`PYTHONINTMAXSTRDIGITS`, or :option:`-X int_max_str_digits <-X>`." msgstr "" -#: library/sys.rst:1154 +#: library/sys.rst:1248 msgid "" "Added :attr:`~int_info.default_max_str_digits` and :attr:`~int_info." "str_digits_check_threshold`." msgstr "" -#: library/sys.rst:1160 +#: library/sys.rst:1254 msgid "" "When this attribute exists, its value is automatically called (with no " "arguments) when the interpreter is launched in :ref:`interactive mode `." msgstr "" -#: library/sys.rst:1166 -msgid "" -"Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " -"with argument ``hook``." -msgstr "" - -#: library/sys.rst:1168 +#: library/sys.rst:1262 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with the hook object as the argument when the hook is called on startup." msgstr "" -#: library/sys.rst:1177 +#: library/sys.rst:1271 msgid "" "Enter *string* in the table of \"interned\" strings and return the interned " "string -- which is *string* itself or a copy. Interning strings is useful to " @@ -1438,19 +1578,96 @@ msgid "" "attributes have interned keys." msgstr "" -#: library/sys.rst:1185 +#: library/sys.rst:1279 msgid "" -"Interned strings are not immortal; you must keep a reference to the return " -"value of :func:`intern` around to benefit from it." +"Interned strings are not :term:`immortal`; you must keep a reference to the " +"return value of :func:`intern` around to benefit from it." msgstr "" -#: library/sys.rst:1191 +#: library/sys.rst:1285 msgid "" -"Return :const:`True` if the Python interpreter is :term:`shutting down " -"`, :const:`False` otherwise." +"Return :const:`True` if the :term:`GIL` is enabled and :const:`False` if it " +"is disabled." +msgstr "" + +#: library/sys.rst:1400 +msgid "It is not guaranteed to exist in all implementations of Python." +msgstr "" + +#: library/sys.rst:1296 +msgid "" +"Return :const:`True` if the main Python interpreter is :term:`shutting down " +"`. Return :const:`False` otherwise." +msgstr "" + +#: library/sys.rst:1299 +msgid "See also the :exc:`PythonFinalizationError` exception." +msgstr "" + +#: library/sys.rst:1305 +msgid "Utilities for observing just-in-time compilation." msgstr "" -#: library/sys.rst:1198 +#: library/sys.rst:1309 +msgid "" +"JIT compilation is an *experimental implementation detail* of CPython. ``sys." +"_jit`` is not guaranteed to exist or behave the same way in all Python " +"implementations, versions, or build configurations." +msgstr "" + +#: library/sys.rst:1317 +msgid "" +"Return ``True`` if the current Python executable supports JIT compilation, " +"and ``False`` otherwise. This can be controlled by building CPython with " +"the ``--experimental-jit`` option on Windows, and the :option:`--enable-" +"experimental-jit` option on all other platforms." +msgstr "" + +#: library/sys.rst:1324 +msgid "" +"Return ``True`` if JIT compilation is enabled for the current Python process " +"(implies :func:`sys._jit.is_available`), and ``False`` otherwise. If JIT " +"compilation is available, this can be controlled by setting the :envvar:" +"`PYTHON_JIT` environment variable to ``0`` (disabled) or ``1`` (enabled) at " +"interpreter startup." +msgstr "" + +#: library/sys.rst:1332 +msgid "" +"Return ``True`` if the topmost Python frame is currently executing JIT code " +"(implies :func:`sys._jit.is_enabled`), and ``False`` otherwise." +msgstr "" + +#: library/sys.rst:1337 +msgid "" +"This function is intended for testing and debugging the JIT itself. It " +"should be avoided for any other purpose." +msgstr "" + +#: library/sys.rst:1342 +msgid "" +"Due to the nature of tracing JIT compilers, repeated calls to this function " +"may give surprising results. For example, branching on its return value will " +"likely lead to unexpected behavior (if doing so causes JIT code to be " +"entered or exited):" +msgstr "" + +#: library/sys.rst:1347 +msgid "" +">>> for warmup in range(BIG_NUMBER):\n" +"... # This line is \"hot\", and is eventually JIT-compiled:\n" +"... if sys._jit.is_active():\n" +"... # This line is \"cold\", and is run in the interpreter:\n" +"... assert sys._jit.is_active()\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 5, in \n" +" assert sys._jit.is_active()\n" +" ~~~~~~~~~~~~~~~~~~^^\n" +"AssertionError" +msgstr "" + +#: library/sys.rst:1363 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1461,34 +1678,53 @@ msgid "" "more information.)" msgstr "" -#: library/sys.rst:1212 +#: library/sys.rst:1375 +msgid "" +"Return :const:`True` if the given object is :term:`immortal`, :const:`False` " +"otherwise." +msgstr "" + +#: library/sys.rst:1380 +msgid "" +"Objects that are immortal (and thus return ``True`` upon being passed to " +"this function) are not guaranteed to be immortal in future versions, and " +"vice versa for mortal objects." +msgstr "" + +#: library/sys.rst:1393 +msgid "" +"Return :const:`True` if the given string is \"interned\", :const:`False` " +"otherwise." +msgstr "" + +#: library/sys.rst:1407 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " "hold the legacy representation of ``sys.last_exc``, as returned from :func:" "`exc_info` above." msgstr "" -#: library/sys.rst:1218 +#: library/sys.rst:1413 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: library/sys.rst:1225 +#: library/sys.rst:1420 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: library/sys.rst:1228 +#: library/sys.rst:1423 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: library/sys.rst:1236 +#: library/sys.rst:1431 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1496,45 +1732,45 @@ msgid "" "implement Python's default import semantics. The :meth:`~importlib.abc." "MetaPathFinder.find_spec` method is called with at least the absolute name " "of the module being imported. If the module to be imported is contained in a " -"package, then the parent package's :attr:`__path__` attribute is passed in " -"as a second argument. The method returns a :term:`module spec`, or ``None`` " -"if the module cannot be found." +"package, then the parent package's :attr:`~module.__path__` attribute is " +"passed in as a second argument. The method returns a :term:`module spec`, or " +"``None`` if the module cannot be found." msgstr "" -#: library/sys.rst:1249 +#: library/sys.rst:1444 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr "" -#: library/sys.rst:1249 +#: library/sys.rst:1445 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: library/sys.rst:1253 +#: library/sys.rst:1447 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr "" -#: library/sys.rst:1252 +#: library/sys.rst:1448 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: library/sys.rst:1258 +#: library/sys.rst:1454 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" -#: library/sys.rst:1263 +#: library/sys.rst:1459 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" -#: library/sys.rst:1269 +#: library/sys.rst:1465 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1546,13 +1782,13 @@ msgid "" "other threads." msgstr "" -#: library/sys.rst:1281 +#: library/sys.rst:1477 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: library/sys.rst:1284 +#: library/sys.rst:1480 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1560,68 +1796,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: library/sys.rst:1296 +#: library/sys.rst:1492 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: library/sys.rst:1300 +#: library/sys.rst:1496 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: library/sys.rst:1304 +#: library/sys.rst:1500 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: library/sys.rst:1306 +#: library/sys.rst:1502 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: library/sys.rst:1308 +#: library/sys.rst:1504 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: library/sys.rst:1311 +#: library/sys.rst:1507 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: library/sys.rst:1314 +#: library/sys.rst:1510 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: library/sys.rst:1320 +#: library/sys.rst:1516 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: library/sys.rst:1325 +#: library/sys.rst:1521 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: library/sys.rst:1340 +#: library/sys.rst:1536 msgid "Originally specified in :pep:`302`." msgstr "" -#: library/sys.rst:1334 +#: library/sys.rst:1530 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1629,156 +1865,188 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: library/sys.rst:1345 -msgid "" -"This string contains a platform identifier that can be used to append " -"platform-specific components to :data:`sys.path`, for instance." -msgstr "" - -#: library/sys.rst:1348 -msgid "" -"For Unix systems, except on Linux and AIX, this is the lowercased OS name as " -"returned by ``uname -s`` with the first part of the version as returned by " -"``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time " -"when Python was built*. Unless you want to test for a specific system " -"version, it is therefore recommended to use the following idiom::" -msgstr "" - -#: library/sys.rst:1361 -msgid "For other systems, the values are:" +#: library/sys.rst:1541 +msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: library/sys.rst:1364 +#: library/sys.rst:1544 msgid "System" msgstr "" -#: library/sys.rst:1364 +#: library/sys.rst:1544 msgid "``platform`` value" msgstr "" -#: library/sys.rst:1366 +#: library/sys.rst:1546 msgid "AIX" msgstr "" -#: library/sys.rst:1366 +#: library/sys.rst:1546 msgid "``'aix'``" msgstr "" -#: library/sys.rst:1367 +#: library/sys.rst:1547 +msgid "Android" +msgstr "" + +#: library/sys.rst:1547 +msgid "``'android'``" +msgstr "" + +#: library/sys.rst:1548 msgid "Emscripten" msgstr "" -#: library/sys.rst:1367 +#: library/sys.rst:1548 msgid "``'emscripten'``" msgstr "" -#: library/sys.rst:1368 +#: library/sys.rst:1549 +msgid "FreeBSD" +msgstr "" + +#: library/sys.rst:1549 +msgid "``'freebsd'``" +msgstr "" + +#: library/sys.rst:1550 +msgid "iOS" +msgstr "" + +#: library/sys.rst:1550 +msgid "``'ios'``" +msgstr "" + +#: library/sys.rst:1551 msgid "Linux" msgstr "" -#: library/sys.rst:1368 +#: library/sys.rst:1551 msgid "``'linux'``" msgstr "" -#: library/sys.rst:1369 -msgid "WASI" +#: library/sys.rst:1552 +msgid "macOS" msgstr "" -#: library/sys.rst:1369 -msgid "``'wasi'``" +#: library/sys.rst:1552 +msgid "``'darwin'``" msgstr "" -#: library/sys.rst:1370 +#: library/sys.rst:1553 msgid "Windows" msgstr "" -#: library/sys.rst:1370 +#: library/sys.rst:1553 msgid "``'win32'``" msgstr "" -#: library/sys.rst:1371 +#: library/sys.rst:1554 msgid "Windows/Cygwin" msgstr "" -#: library/sys.rst:1371 +#: library/sys.rst:1554 msgid "``'cygwin'``" msgstr "" -#: library/sys.rst:1372 -msgid "macOS" +#: library/sys.rst:1555 +msgid "WASI" msgstr "" -#: library/sys.rst:1372 -msgid "``'darwin'``" +#: library/sys.rst:1555 +msgid "``'wasi'``" msgstr "" -#: library/sys.rst:1375 +#: library/sys.rst:1558 +msgid "" +"On Unix systems not listed in the table, the value is the lowercased OS name " +"as returned by ``uname -s``, with the first part of the version as returned " +"by ``uname -r`` appended, e.g. ``'sunos5'``, *at the time when Python was " +"built*. Unless you want to test for a specific system version, it is " +"therefore recommended to use the following idiom::" +msgstr "" + +#: library/sys.rst:1564 +msgid "" +"if sys.platform.startswith('sunos'):\n" +" # SunOS-specific code here..." +msgstr "" + +#: library/sys.rst:1567 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " -"is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. Since older " -"Python versions include the version number, it is recommended to always use " -"the ``startswith`` idiom presented above." +"is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: library/sys.rst:1381 +#: library/sys.rst:1571 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " -"is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``. Since older " -"Python versions include the version number, it is recommended to always use " -"the ``startswith`` idiom presented above." +"is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." +msgstr "" + +#: library/sys.rst:1575 +msgid "" +"On Android, :data:`sys.platform` now returns ``'android'`` rather than " +"``'linux'``." msgstr "" -#: library/sys.rst:1389 +#: library/sys.rst:1579 +msgid "" +"On FreeBSD, :data:`sys.platform` doesn't contain the major version anymore. " +"It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``." +msgstr "" + +#: library/sys.rst:1585 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: library/sys.rst:1392 +#: library/sys.rst:1588 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: library/sys.rst:1398 +#: library/sys.rst:1594 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: library/sys.rst:1401 +#: library/sys.rst:1597 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: library/sys.rst:1405 +#: library/sys.rst:1601 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: library/sys.rst:1407 +#: library/sys.rst:1603 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: library/sys.rst:1410 +#: library/sys.rst:1606 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: library/sys.rst:1412 +#: library/sys.rst:1608 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: library/sys.rst:1420 +#: library/sys.rst:1616 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1787,14 +2055,15 @@ msgid "" "derived paths." msgstr "" -#: library/sys.rst:1426 +#: library/sys.rst:1624 msgid "" -"If a :ref:`virtual environment ` is in effect, this value will be " -"changed in ``site.py`` to point to the virtual environment. The value for " -"the Python installation will still be available, via :data:`base_prefix`." +"If a :ref:`virtual environment ` is in effect, this :data:`prefix` " +"will point to the virtual environment. The value for the Python installation " +"will still be available, via :data:`base_prefix`. Refer to :ref:`sys-path-" +"init-virtual-environments` for more information." msgstr "" -#: library/sys.rst:1441 +#: library/sys.rst:1648 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1804,7 +2073,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: library/sys.rst:1451 +#: library/sys.rst:1658 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1815,14 +2084,14 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: library/sys.rst:1463 +#: library/sys.rst:1670 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: library/sys.rst:1475 +#: library/sys.rst:1682 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1837,14 +2106,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: library/sys.rst:1487 +#: library/sys.rst:1694 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: library/sys.rst:1491 +#: library/sys.rst:1698 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1852,71 +2121,71 @@ msgid "" "depends on the event type." msgstr "" -#: library/sys.rst:1583 +#: library/sys.rst:1790 msgid "The events have the following meaning:" msgstr "" -#: library/sys.rst:1588 +#: library/sys.rst:1792 msgid "``'call'``" msgstr "" -#: library/sys.rst:1499 +#: library/sys.rst:1706 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: library/sys.rst:1604 +#: library/sys.rst:1807 msgid "``'return'``" msgstr "" -#: library/sys.rst:1503 +#: library/sys.rst:1710 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: library/sys.rst:1509 +#: library/sys.rst:1714 msgid "``'c_call'``" msgstr "" -#: library/sys.rst:1508 +#: library/sys.rst:1715 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: library/sys.rst:1512 +#: library/sys.rst:1718 msgid "``'c_return'``" msgstr "" -#: library/sys.rst:1512 +#: library/sys.rst:1719 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: library/sys.rst:1515 +#: library/sys.rst:1721 msgid "``'c_exception'``" msgstr "" -#: library/sys.rst:1515 +#: library/sys.rst:1722 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: library/sys.rst:1517 +#: library/sys.rst:1724 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "" -#: library/sys.rst:1522 +#: library/sys.rst:1729 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: library/sys.rst:1526 +#: library/sys.rst:1733 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -1924,19 +2193,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: library/sys.rst:1531 +#: library/sys.rst:1738 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: library/sys.rst:1534 +#: library/sys.rst:1741 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: library/sys.rst:1541 +#: library/sys.rst:1748 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -1947,7 +2216,7 @@ msgid "" "scheduler." msgstr "" -#: library/sys.rst:1558 +#: library/sys.rst:1765 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -1956,15 +2225,15 @@ msgid "" "`threading.settrace`." msgstr "" -#: library/sys.rst:1563 +#: library/sys.rst:1770 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " -"*frame* is the current stack frame. *event* is a string: ``'call'``, " -"``'line'``, ``'return'``, ``'exception'`` or ``'opcode'``. *arg* depends on " -"the event type." +"*frame* is the :ref:`current stack frame `. *event* is a " +"string: ``'call'``, ``'line'``, ``'return'``, ``'exception'`` or " +"``'opcode'``. *arg* depends on the event type." msgstr "" -#: library/sys.rst:1568 +#: library/sys.rst:1775 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -1972,36 +2241,36 @@ msgid "" "traced." msgstr "" -#: library/sys.rst:1573 +#: library/sys.rst:1780 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: library/sys.rst:1576 +#: library/sys.rst:1783 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: library/sys.rst:1580 +#: library/sys.rst:1787 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: library/sys.rst:1586 +#: library/sys.rst:1793 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: library/sys.rst:1598 +#: library/sys.rst:1797 msgid "``'line'``" msgstr "" -#: library/sys.rst:1591 +#: library/sys.rst:1798 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2011,7 +2280,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: library/sys.rst:1601 +#: library/sys.rst:1808 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2019,22 +2288,22 @@ msgid "" "return value is ignored." msgstr "" -#: library/sys.rst:1609 +#: library/sys.rst:1813 msgid "``'exception'``" msgstr "" -#: library/sys.rst:1607 +#: library/sys.rst:1814 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: library/sys.rst:1617 +#: library/sys.rst:1818 msgid "``'opcode'``" msgstr "" -#: library/sys.rst:1612 +#: library/sys.rst:1819 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2044,13 +2313,13 @@ msgid "" "objects>`." msgstr "" -#: library/sys.rst:1619 +#: library/sys.rst:1826 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: library/sys.rst:1622 +#: library/sys.rst:1829 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2064,17 +2333,17 @@ msgid "" "on each frame)." msgstr "" -#: library/sys.rst:1633 +#: library/sys.rst:1840 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: library/sys.rst:1635 +#: library/sys.rst:1842 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "" -#: library/sys.rst:1639 +#: library/sys.rst:1846 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2082,21 +2351,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: library/sys.rst:1646 +#: library/sys.rst:1853 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: library/sys.rst:1649 -msgid "" -"``'opcode'`` event will only be emitted if :attr:`~frame.f_trace_opcodes` of " -"at least one frame has been set to :const:`True` before :func:`settrace` is " -"called. This behavior will be changed back in 3.13 to be consistent with " -"previous versions." -msgstr "" - -#: library/sys.rst:1657 +#: library/sys.rst:1858 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2105,138 +2366,188 @@ msgid "" "about to be garbage collected." msgstr "" -#: library/sys.rst:1663 +#: library/sys.rst:1864 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" -#: library/sys.rst:1665 +#: library/sys.rst:1866 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" -#: library/sys.rst:1667 +#: library/sys.rst:1868 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: library/sys.rst:1670 +#: library/sys.rst:1871 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: library/sys.rst:1682 +#: library/sys.rst:1883 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " "(filename, line number, function name) tuples describing the traceback where " "the coroutine object was created, with the most recent call first. When " -"disabled, ``cr_origin`` will be None." +"disabled, ``cr_origin`` will be ``None``." msgstr "" -#: library/sys.rst:1689 +#: library/sys.rst:1890 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " -"frames whose information will be captured. To disable, pass set *depth* to " -"zero." +"frames whose information will be captured. To disable, set *depth* to zero." msgstr "" -#: library/sys.rst:1693 +#: library/sys.rst:1894 msgid "This setting is thread-specific." msgstr "" -#: library/sys.rst:1703 +#: library/sys.rst:1904 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: library/sys.rst:1721 library/sys.rst:1729 -msgid ":ref:`Availability `: Linux." +#: library/sys.rst:1907 +msgid "Stack trampolines cannot be activated if the JIT is active." msgstr "" -#: library/sys.rst:1712 +#: library/sys.rst:1915 msgid ":ref:`perf_profiling`" msgstr "" -#: library/sys.rst:1713 +#: library/sys.rst:1916 msgid "https://perf.wiki.kernel.org" msgstr "" -#: library/sys.rst:1717 +#: library/sys.rst:1920 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: library/sys.rst:1719 +#: library/sys.rst:1922 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: library/sys.rst:1727 +#: library/sys.rst:1930 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: library/sys.rst:1735 +#: library/sys.rst:1939 +msgid "" +"Executes *script*, a file containing Python code in the remote process with " +"the given *pid*." +msgstr "" + +#: library/sys.rst:1942 +msgid "" +"This function returns immediately, and the code will be executed by the " +"target process's main thread at the next available opportunity, similarly to " +"how signals are handled. There is no interface to determine when the code " +"has been executed. The caller is responsible for making sure that the file " +"still exists whenever the remote process tries to read it and that it hasn't " +"been overwritten." +msgstr "" + +#: library/sys.rst:1949 +msgid "" +"The remote process must be running a CPython interpreter of the same major " +"and minor version as the local process. If either the local or remote " +"interpreter is pre-release (alpha, beta, or release candidate) then the " +"local and remote interpreters must be the same exact version." +msgstr "" + +#: library/sys.rst:1956 +msgid "" +"When the code is executed in the remote process, an :ref:`auditing event " +"` ``sys.remote_exec`` is raised with the *pid* and the path to the " +"script file. This event is raised in the process that called :func:`sys." +"remote_exec`." +msgstr "" + +#: library/sys.rst:1963 +msgid "" +"When the script is executed in the remote process, an :ref:`auditing event " +"` ``cpython.remote_debugger_script`` is raised with the path in " +"the remote process. This event is raised in the remote process, not the one " +"that called :func:`sys.remote_exec`." +msgstr "" + +#: library/sys.rst:1976 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: library/sys.rst:1739 +#: library/sys.rst:1980 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: library/sys.rst:1742 +#: library/sys.rst:1983 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: library/sys.rst:1747 +#: library/sys.rst:1989 +msgid "" +"Changing the filesystem encoding after Python startup is risky because the " +"old fsencoding or paths encoded by the old fsencoding may be cached " +"somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." +msgstr "" + +#: library/sys.rst:1993 msgid "See :pep:`529` for more details." msgstr "" -#: library/sys.rst:1754 +#: library/sys.rst:1996 +msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." +msgstr "" + +#: library/sys.rst:2003 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: library/sys.rst:1757 +#: library/sys.rst:2006 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: library/sys.rst:1759 +#: library/sys.rst:2008 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: library/sys.rst:1761 +#: library/sys.rst:2010 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: library/sys.rst:1763 +#: library/sys.rst:2012 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: library/sys.rst:1767 +#: library/sys.rst:2016 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: library/sys.rst:1770 +#: library/sys.rst:2019 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2247,14 +2558,14 @@ msgid "" "initially attached to a console." msgstr "" -#: library/sys.rst:1779 +#: library/sys.rst:2028 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: library/sys.rst:1784 +#: library/sys.rst:2033 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2263,7 +2574,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: library/sys.rst:1791 +#: library/sys.rst:2040 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2272,19 +2583,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: library/sys.rst:1797 +#: library/sys.rst:2046 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: library/sys.rst:1803 +#: library/sys.rst:2052 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: library/sys.rst:1807 +#: library/sys.rst:2056 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2292,7 +2603,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: library/sys.rst:1817 +#: library/sys.rst:2066 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2300,7 +2611,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: library/sys.rst:1822 +#: library/sys.rst:2071 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2308,7 +2619,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: library/sys.rst:1828 +#: library/sys.rst:2077 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2316,12 +2627,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: library/sys.rst:1836 +#: library/sys.rst:2085 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: library/sys.rst:1838 +#: library/sys.rst:2087 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2329,7 +2640,7 @@ msgid "" "modules are excluded." msgstr "" -#: library/sys.rst:1843 +#: library/sys.rst:2092 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2337,60 +2648,60 @@ msgid "" "listed." msgstr "" -#: library/sys.rst:1848 +#: library/sys.rst:2097 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "" -#: library/sys.rst:1855 +#: library/sys.rst:2104 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: library/sys.rst:1860 +#: library/sys.rst:2109 msgid "The name of the thread implementation:" msgstr "" -#: library/sys.rst:1862 +#: library/sys.rst:2111 msgid "``\"nt\"``: Windows threads" msgstr "" -#: library/sys.rst:1863 +#: library/sys.rst:2112 msgid "``\"pthread\"``: POSIX threads" msgstr "" -#: library/sys.rst:1864 +#: library/sys.rst:2113 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: library/sys.rst:1866 +#: library/sys.rst:2115 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: library/sys.rst:1870 +#: library/sys.rst:2119 msgid "The name of the lock implementation:" msgstr "" -#: library/sys.rst:1872 +#: library/sys.rst:2121 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: library/sys.rst:1873 +#: library/sys.rst:2122 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: library/sys.rst:1874 +#: library/sys.rst:2123 msgid "``None`` if this information is unknown" msgstr "" -#: library/sys.rst:1878 +#: library/sys.rst:2127 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: library/sys.rst:1886 +#: library/sys.rst:2135 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2399,79 +2710,73 @@ msgid "" "are printed." msgstr "" -#: library/sys.rst:1894 +#: library/sys.rst:2143 msgid "Handle an unraisable exception." msgstr "" -#: library/sys.rst:1896 +#: library/sys.rst:2145 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: library/sys.rst:1900 +#: library/sys.rst:2149 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: library/sys.rst:1902 +#: library/sys.rst:2151 msgid ":attr:`!exc_type`: Exception type." msgstr "" -#: library/sys.rst:1903 +#: library/sys.rst:2152 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr "" -#: library/sys.rst:1904 +#: library/sys.rst:2153 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr "" -#: library/sys.rst:1905 +#: library/sys.rst:2154 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr "" -#: library/sys.rst:1906 +#: library/sys.rst:2155 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr "" -#: library/sys.rst:1908 +#: library/sys.rst:2157 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " "``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" "attr:`!err_msg` is ``None``." msgstr "" -#: library/sys.rst:1912 +#: library/sys.rst:2161 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: library/sys.rst:1917 +#: library/sys.rst:2166 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "" -#: library/sys.rst:1921 +#: library/sys.rst:2170 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: library/sys.rst:1925 +#: library/sys.rst:2174 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: library/sys.rst:1929 -msgid "" -"Raises an :ref:`auditing event ` ``sys.unraisablehook`` with " -"arguments ``hook``, ``unraisable``." -msgstr "" - -#: library/sys.rst:1931 +#: library/sys.rst:2180 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2479,7 +2784,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: library/sys.rst:1940 +#: library/sys.rst:2189 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2488,13 +2793,19 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: library/sys.rst:1949 +#: library/sys.rst:2198 +msgid "" +"The C API version, equivalent to the C macro :c:macro:`PYTHON_API_VERSION`. " +"Defined for backwards compatibility." +msgstr "" + +#: library/sys.rst:2201 msgid "" -"The C API version for this interpreter. Programmers may find this useful " -"when debugging version conflicts between Python and extension modules." +"Currently, this constant is not updated in new Python versions, and is not " +"useful for versioning. This may change in the future." msgstr "" -#: library/sys.rst:1955 +#: library/sys.rst:2207 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2505,18 +2816,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: library/sys.rst:1963 +#: library/sys.rst:2215 msgid "Added named component attributes." msgstr "" -#: library/sys.rst:1968 +#: library/sys.rst:2220 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: library/sys.rst:1975 +#: library/sys.rst:2227 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2525,31 +2836,43 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: library/sys.rst:1987 +#: library/sys.rst:2239 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: library/sys.rst:1993 +#: library/sys.rst:2245 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: library/sys.rst:2009 +#: library/sys.rst:2249 +msgid "" +"$ ./python -Xa=b -Xc\n" +"Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" +"[GCC 4.4.3] on linux2\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>> import sys\n" +">>> sys._xoptions\n" +"{'a': 'b', 'c': True}" +msgstr "" + +#: library/sys.rst:2261 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: library/sys.rst:2017 +#: library/sys.rst:2269 msgid "Citations" msgstr "" -#: library/sys.rst:2018 +#: library/sys.rst:2270 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2560,58 +2883,58 @@ msgstr "" msgid "auditing" msgstr "" -#: library/sys.rst:451 +#: library/sys.rst:461 msgid "object" msgstr "" -#: library/sys.rst:451 +#: library/sys.rst:461 msgid "traceback" msgstr "" -#: library/sys.rst:1471 +#: library/sys.rst:1678 msgid "profile function" msgstr "" -#: library/sys.rst:1471 +#: library/sys.rst:1678 msgid "profiler" msgstr "" -#: library/sys.rst:1554 +#: library/sys.rst:1761 msgid "trace function" msgstr "" -#: library/sys.rst:1554 +#: library/sys.rst:1761 msgid "debugger" msgstr "" -#: library/sys.rst:1294 +#: library/sys.rst:1490 msgid "module" msgstr "" -#: library/sys.rst:1294 +#: library/sys.rst:1490 msgid "search" msgstr "" -#: library/sys.rst:1294 +#: library/sys.rst:1490 msgid "path" msgstr "" -#: library/sys.rst:1435 +#: library/sys.rst:1642 msgid "interpreter prompts" msgstr "" -#: library/sys.rst:1435 +#: library/sys.rst:1642 msgid "prompts, interpreter" msgstr "" -#: library/sys.rst:1435 +#: library/sys.rst:1642 msgid ">>>" msgstr "" -#: library/sys.rst:1435 +#: library/sys.rst:1642 msgid "interpreter prompt" msgstr "" -#: library/sys.rst:1435 +#: library/sys.rst:1642 msgid "..." msgstr "" diff --git a/library/sys_path_init.po b/library/sys_path_init.po index 5bd9e56c..987de41f 100644 --- a/library/sys_path_init.po +++ b/library/sys_path_init.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -90,51 +91,83 @@ msgstr "" #: library/sys_path_init.rst:50 msgid "" "Once found, ``prefix`` and ``exec_prefix`` are available at :data:`sys." -"prefix` and :data:`sys.exec_prefix` respectively." +"base_prefix` and :data:`sys.base_exec_prefix` respectively." msgstr "" #: library/sys_path_init.rst:53 msgid "" +"If :envvar:`PYTHONHOME` is not set, and a ``pyvenv.cfg`` file is found " +"alongside the main executable, or in its parent directory, :data:`sys." +"prefix` and :data:`sys.exec_prefix` get set to the directory containing " +"``pyvenv.cfg``, otherwise they are set to the same value as :data:`sys." +"base_prefix` and :data:`sys.base_exec_prefix`, respectively. This is used " +"by :ref:`sys-path-init-virtual-environments`." +msgstr "" + +#: library/sys_path_init.rst:60 +msgid "" "Finally, the :mod:`site` module is processed and :file:`site-packages` " "directories are added to the module search path. A common way to customize " "the search path is to create :mod:`sitecustomize` or :mod:`usercustomize` " "modules as described in the :mod:`site` module documentation." msgstr "" -#: library/sys_path_init.rst:60 +#: library/sys_path_init.rst:67 msgid "" "Certain command line options may further affect path calculations. See :" "option:`-E`, :option:`-I`, :option:`-s` and :option:`-S` for further details." msgstr "" -#: library/sys_path_init.rst:64 -msgid "Virtual environments" +#: library/sys_path_init.rst:72 +msgid "" +":data:`sys.prefix` and :data:`sys.exec_prefix` are now set to the ``pyvenv." +"cfg`` directory during the path initialization. This was previously done by :" +"mod:`site`, therefore affected by :option:`-S`." +msgstr "" + +#: library/sys_path_init.rst:79 +msgid "Virtual Environments" msgstr "" -#: library/sys_path_init.rst:66 +#: library/sys_path_init.rst:81 msgid "" -"If Python is run in a virtual environment (as described at :ref:`tut-venv`) " -"then ``prefix`` and ``exec_prefix`` are specific to the virtual environment." +"Virtual environments place a ``pyvenv.cfg`` file in their prefix, which " +"causes :data:`sys.prefix` and :data:`sys.exec_prefix` to point to them, " +"instead of the base installation." msgstr "" -#: library/sys_path_init.rst:69 +#: library/sys_path_init.rst:85 msgid "" -"If a ``pyvenv.cfg`` file is found alongside the main executable, or in the " -"directory one level above the executable, the following variations apply:" +"The ``prefix`` and ``exec_prefix`` values of the base installation are " +"available at :data:`sys.base_prefix` and :data:`sys.base_exec_prefix`." msgstr "" -#: library/sys_path_init.rst:72 +#: library/sys_path_init.rst:88 msgid "" -"If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " -"path is used instead of the path to the main executable when deducing " -"``prefix`` and ``exec_prefix``." +"As well as being used as a marker to identify virtual environments, ``pyvenv." +"cfg`` may also be used to configure the :mod:`site` initialization. Please " +"refer to :mod:`site`'s :ref:`virtual environments documentation `." +msgstr "" + +#: library/sys_path_init.rst:95 +msgid ":envvar:`PYTHONHOME` overrides the ``pyvenv.cfg`` detection." msgstr "" -#: library/sys_path_init.rst:77 +#: library/sys_path_init.rst:99 +msgid "" +"There are other ways how \"virtual environments\" could be implemented, this " +"documentation refers implementations based on the ``pyvenv.cfg`` mechanism, " +"such as :mod:`venv`. Most virtual environment implementations follow the " +"model set by :mod:`venv`, but there may be exotic implementations that " +"diverge from it." +msgstr "" + +#: library/sys_path_init.rst:106 msgid "_pth files" msgstr "" -#: library/sys_path_init.rst:79 +#: library/sys_path_init.rst:108 msgid "" "To completely override :data:`sys.path` create a ``._pth`` file with the " "same name as the shared library or executable (``python._pth`` or " @@ -145,7 +178,7 @@ msgid "" "allows paths to be restricted for any program loading the runtime if desired." msgstr "" -#: library/sys_path_init.rst:87 +#: library/sys_path_init.rst:116 msgid "" "When the file exists, all registry and environment variables are ignored, " "isolated mode is enabled, and :mod:`site` is not imported unless one line in " @@ -155,29 +188,28 @@ msgid "" "arbitrary code cannot be specified." msgstr "" -#: library/sys_path_init.rst:94 +#: library/sys_path_init.rst:123 msgid "" "Note that ``.pth`` files (without leading underscore) will be processed " "normally by the :mod:`site` module when ``import site`` has been specified." msgstr "" -#: library/sys_path_init.rst:98 +#: library/sys_path_init.rst:127 msgid "Embedded Python" msgstr "" -#: library/sys_path_init.rst:100 +#: library/sys_path_init.rst:129 msgid "" "If Python is embedded within another application :c:func:" "`Py_InitializeFromConfig` and the :c:type:`PyConfig` structure can be used " "to initialize Python. The path specific details are described at :ref:`init-" -"path-config`. Alternatively the older :c:func:`Py_SetPath` can be used to " -"bypass the initialization of the module search path." +"path-config`." msgstr "" -#: library/sys_path_init.rst:107 +#: library/sys_path_init.rst:135 msgid ":ref:`windows_finding_modules` for detailed Windows notes." msgstr "" -#: library/sys_path_init.rst:108 +#: library/sys_path_init.rst:136 msgid ":ref:`using-on-unix` for Unix details." msgstr "" diff --git a/library/sysconfig.po b/library/sysconfig.po index 8f8d00b6..939229fe 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/sysconfig.rst:2 msgid "" -":mod:`sysconfig` --- Provide access to Python's configuration information" +":mod:`!sysconfig` --- Provide access to Python's configuration information" msgstr "" #: library/sysconfig.rst:12 -msgid "**Source code:** :source:`Lib/sysconfig.py`" +msgid "**Source code:** :source:`Lib/sysconfig`" msgstr "" #: library/sysconfig.rst:19 @@ -83,6 +84,17 @@ msgstr "" msgid "Example of usage::" msgstr "" +#: library/sysconfig.rst:56 +msgid "" +">>> import sysconfig\n" +">>> sysconfig.get_config_var('Py_ENABLE_SHARED')\n" +"0\n" +">>> sysconfig.get_config_var('LIBDIR')\n" +"'/usr/local/lib'\n" +">>> sysconfig.get_config_vars('AR', 'CXX')\n" +"['ar', 'g++']" +msgstr "" + #: library/sysconfig.rst:68 msgid "Installation paths" msgstr "" @@ -502,7 +514,7 @@ msgstr "" #: library/sysconfig.rst:307 msgid "" "End users should not use this function, but :func:`get_default_scheme` and :" -"func:`get_preferred_scheme()` instead." +"func:`get_preferred_scheme` instead." msgstr "" #: library/sysconfig.rst:315 @@ -605,7 +617,7 @@ msgstr "" msgid "" "This is used mainly to distinguish platform-specific build directories and " "platform-specific built distributions. Typically includes the OS name and " -"version and the architecture (as supplied by 'os.uname()'), although the " +"version and the architecture (as supplied by :func:`os.uname`), although the " "exact information included depends on the OS; e.g., on Linux, the kernel " "version isn't particularly important." msgstr "" @@ -614,95 +626,112 @@ msgstr "" msgid "Examples of returned values:" msgstr "" -#: library/sysconfig.rst:385 -msgid "linux-i586" -msgstr "" - #: library/sysconfig.rst:386 -msgid "linux-alpha (?)" +msgid "Windows:" msgstr "" -#: library/sysconfig.rst:387 -msgid "solaris-2.6-sun4u" +#: library/sysconfig.rst:388 +msgid "win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" msgstr "" #: library/sysconfig.rst:389 -msgid "Windows will return one of:" +msgid "win-arm64 (64-bit Windows on ARM64, aka AArch64)" msgstr "" -#: library/sysconfig.rst:391 -msgid "win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" +#: library/sysconfig.rst:390 +msgid "win32 (all others - specifically, sys.platform is returned)" msgstr "" #: library/sysconfig.rst:392 -msgid "win32 (all others - specifically, sys.platform is returned)" +msgid "POSIX based OS:" msgstr "" #: library/sysconfig.rst:394 -msgid "macOS can return:" +msgid "linux-x86_64" msgstr "" -#: library/sysconfig.rst:396 -msgid "macosx-10.6-ppc" +#: library/sysconfig.rst:395 +msgid "macosx-15.5-arm64" msgstr "" -#: library/sysconfig.rst:397 -msgid "macosx-10.4-ppc64" +#: library/sysconfig.rst:396 +msgid "macosx-26.0-universal2 (macOS on Apple Silicon or Intel)" msgstr "" -#: library/sysconfig.rst:398 -msgid "macosx-10.3-i386" +#: library/sysconfig.rst:397 +msgid "android-24-arm64_v8a" msgstr "" #: library/sysconfig.rst:399 -msgid "macosx-10.4-fat" -msgstr "" - -#: library/sysconfig.rst:401 msgid "" "For other non-POSIX platforms, currently just returns :data:`sys.platform`." msgstr "" -#: library/sysconfig.rst:406 +#: library/sysconfig.rst:404 msgid "" "Return ``True`` if the running Python interpreter was built from source and " "is being run from its built location, and not from a location resulting from " "e.g. running ``make install`` or installing via a binary installer." msgstr "" -#: library/sysconfig.rst:413 +#: library/sysconfig.rst:411 msgid "Parse a :file:`config.h`\\-style file." msgstr "" -#: library/sysconfig.rst:415 +#: library/sysconfig.rst:413 msgid "" "*fp* is a file-like object pointing to the :file:`config.h`\\-like file." msgstr "" -#: library/sysconfig.rst:417 +#: library/sysconfig.rst:415 msgid "" "A dictionary containing name/value pairs is returned. If an optional " "dictionary is passed in as the second argument, it is used instead of a new " "dictionary, and updated with the values read in the file." msgstr "" -#: library/sysconfig.rst:424 +#: library/sysconfig.rst:422 msgid "Return the path of :file:`pyconfig.h`." msgstr "" -#: library/sysconfig.rst:428 +#: library/sysconfig.rst:426 msgid "Return the path of :file:`Makefile`." msgstr "" -#: library/sysconfig.rst:433 -msgid "Using :mod:`sysconfig` as a script" +#: library/sysconfig.rst:432 +msgid "Command-line usage" msgstr "" -#: library/sysconfig.rst:435 +#: library/sysconfig.rst:434 msgid "You can use :mod:`sysconfig` as a script with Python's *-m* option:" msgstr "" -#: library/sysconfig.rst:461 +#: library/sysconfig.rst:436 +msgid "" +"$ python -m sysconfig\n" +"Platform: \"macosx-10.4-i386\"\n" +"Python version: \"3.2\"\n" +"Current installation scheme: \"posix_prefix\"\n" +"\n" +"Paths:\n" +" data = \"/usr/local\"\n" +" include = \"/Users/tarek/Dev/svn.python.org/py3k/Include\"\n" +" platinclude = \".\"\n" +" platlib = \"/usr/local/lib/python3.2/site-packages\"\n" +" platstdlib = \"/usr/local/lib/python3.2\"\n" +" purelib = \"/usr/local/lib/python3.2/site-packages\"\n" +" scripts = \"/usr/local/bin\"\n" +" stdlib = \"/usr/local/lib/python3.2\"\n" +"\n" +"Variables:\n" +" AC_APPLE_UNIVERSAL_BUILD = \"0\"\n" +" AIX_GENUINE_CPLUSPLUS = \"0\"\n" +" AR = \"ar\"\n" +" ARFLAGS = \"rc\"\n" +" ..." +msgstr "" + +#: library/sysconfig.rst:460 msgid "" "This call will print in the standard output the information returned by :" "func:`get_platform`, :func:`get_python_version`, :func:`get_path` and :func:" diff --git a/library/syslog.po b/library/syslog.po index 7d339fcf..07f0ac0c 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/syslog.rst:2 -msgid ":mod:`syslog` --- Unix syslog library routines" +msgid ":mod:`!syslog` --- Unix syslog library routines" msgstr "" #: library/syslog.rst:10 @@ -28,14 +29,14 @@ msgid "" msgstr "" #: library/syslog.rst:14 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +msgid "Availability" msgstr "" #: library/syslog.rst:16 msgid "" "This module wraps the system ``syslog`` family of routines. A pure Python " "library that can speak to a syslog server is available in the :mod:`logging." -"handlers` module as :class:`SysLogHandler`." +"handlers` module as :class:`~logging.handlers.SysLogHandler`." msgstr "" #: library/syslog.rst:20 @@ -156,55 +157,59 @@ msgstr "" msgid "The module defines the following constants:" msgstr "" -#: library/syslog.rst:113 -msgid "Priority levels (high to low):" -msgstr "" - -#: library/syslog.rst:111 -msgid "" -":const:`LOG_EMERG`, :const:`LOG_ALERT`, :const:`LOG_CRIT`, :const:" -"`LOG_ERR`, :const:`LOG_WARNING`, :const:`LOG_NOTICE`, :const:`LOG_INFO`, :" -"const:`LOG_DEBUG`." -msgstr "" - #: library/syslog.rst:120 -msgid "Facilities:" +msgid "Priority levels (high to low)." msgstr "" -#: library/syslog.rst:116 +#: library/syslog.rst:149 msgid "" -":const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:" -"`LOG_DAEMON`, :const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:" -"`LOG_UUCP`, :const:`LOG_CRON`, :const:`LOG_SYSLOG`, :const:`LOG_LOCAL0` to :" -"const:`LOG_LOCAL7`, and, if defined in ````, :const:`LOG_AUTHPRIV`." +"Facilities, depending on availability in ```` for :const:" +"`LOG_AUTHPRIV`, :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:" +"`LOG_REMOTEAUTH`, :const:`LOG_INSTALL` and :const:`LOG_RAS`." msgstr "" -#: library/syslog.rst:126 -msgid "Log options:" +#: library/syslog.rst:153 +msgid "" +"Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`, :" +"const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD`." msgstr "" -#: library/syslog.rst:123 +#: library/syslog.rst:164 msgid "" -":const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, and, if defined in " -"````, :const:`LOG_ODELAY`, :const:`LOG_NOWAIT`, and :const:" -"`LOG_PERROR`." +"Log options, depending on availability in ```` for :const:" +"`LOG_ODELAY`, :const:`LOG_NOWAIT` and :const:`LOG_PERROR`." msgstr "" -#: library/syslog.rst:129 +#: library/syslog.rst:169 msgid "Examples" msgstr "" -#: library/syslog.rst:132 +#: library/syslog.rst:172 msgid "Simple example" msgstr "" -#: library/syslog.rst:134 +#: library/syslog.rst:174 msgid "A simple set of examples::" msgstr "" -#: library/syslog.rst:142 +#: library/syslog.rst:176 +msgid "" +"import syslog\n" +"\n" +"syslog.syslog('Processing started')\n" +"if error:\n" +" syslog.syslog(syslog.LOG_ERR, 'Processing started')" +msgstr "" + +#: library/syslog.rst:182 msgid "" "An example of setting some log options, these would include the process ID " "in logged messages, and write the messages to the destination facility used " "for mail logging::" msgstr "" + +#: library/syslog.rst:186 +msgid "" +"syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL)\n" +"syslog.syslog('E-mail processing initiated...')" +msgstr "" diff --git a/library/tabnanny.po b/library/tabnanny.po index a1d9b48a..ec103ad2 100644 --- a/library/tabnanny.po +++ b/library/tabnanny.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tabnanny.rst:2 -msgid ":mod:`tabnanny` --- Detection of ambiguous indentation" +msgid ":mod:`!tabnanny` --- Detection of ambiguous indentation" msgstr "" #: library/tabnanny.rst:13 diff --git a/library/tarfile.po b/library/tarfile.po index a5fe1c05..8d85b4c6 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tarfile.rst:2 -msgid ":mod:`tarfile` --- Read and write tar archive files" +msgid ":mod:`!tarfile` --- Read and write tar archive files" msgstr "" #: library/tarfile.rst:10 @@ -38,189 +39,233 @@ msgstr "" #: library/tarfile.rst:21 msgid "" -"reads and writes :mod:`gzip`, :mod:`bz2` and :mod:`lzma` compressed archives " -"if the respective modules are available." +"reads and writes :mod:`gzip`, :mod:`bz2`, :mod:`compression.zstd`, and :mod:" +"`lzma` compressed archives if the respective modules are available." msgstr "" -#: library/tarfile.rst:24 +#: library/tarfile.rst:27 +msgid "" +"If any of these :term:`optional modules ` are missing from " +"your copy of CPython, look for documentation from your distributor (that is, " +"whoever provided Python to you). If you are the distributor, see :ref:" +"`optional-module-requirements`." +msgstr "" + +#: library/tarfile.rst:32 msgid "read/write support for the POSIX.1-1988 (ustar) format." msgstr "" -#: library/tarfile.rst:26 +#: library/tarfile.rst:34 msgid "" "read/write support for the GNU tar format including *longname* and " "*longlink* extensions, read-only support for all variants of the *sparse* " "extension including restoration of sparse files." msgstr "" -#: library/tarfile.rst:30 +#: library/tarfile.rst:38 msgid "read/write support for the POSIX.1-2001 (pax) format." msgstr "" -#: library/tarfile.rst:32 +#: library/tarfile.rst:40 msgid "" "handles directories, regular files, hardlinks, symbolic links, fifos, " "character devices and block devices and is able to acquire and restore file " "information like timestamp, access permissions and owner." msgstr "" -#: library/tarfile.rst:36 +#: library/tarfile.rst:44 msgid "Added support for :mod:`lzma` compression." msgstr "" -#: library/tarfile.rst:39 +#: library/tarfile.rst:47 msgid "" "Archives are extracted using a :ref:`filter `, " "which makes it possible to either limit surprising/dangerous features, or to " -"acknowledge that they are expected and the archive is fully trusted. By " -"default, archives are fully trusted, but this default is deprecated and " -"slated to change in Python 3.14." +"acknowledge that they are expected and the archive is fully trusted." +msgstr "" + +#: library/tarfile.rst:52 +msgid "" +"Set the default extraction filter to :func:`data `, which " +"disallows some dangerous features such as links to absolute paths or paths " +"outside of the destination. Previously, the filter strategy was equivalent " +"to :func:`fully_trusted `." +msgstr "" + +#: library/tarfile.rst:60 +msgid "Added support for Zstandard compression using :mod:`compression.zstd`." msgstr "" -#: library/tarfile.rst:49 +#: library/tarfile.rst:64 msgid "" "Return a :class:`TarFile` object for the pathname *name*. For detailed " "information on :class:`TarFile` objects and the keyword arguments that are " "allowed, see :ref:`tarfile-objects`." msgstr "" -#: library/tarfile.rst:53 +#: library/tarfile.rst:68 msgid "" "*mode* has to be a string of the form ``'filemode[:compression]'``, it " "defaults to ``'r'``. Here is a full list of mode combinations:" msgstr "" -#: library/tarfile.rst:57 +#: library/tarfile.rst:72 msgid "mode" msgstr "" -#: library/tarfile.rst:57 +#: library/tarfile.rst:72 msgid "action" msgstr "" -#: library/tarfile.rst:59 -msgid "``'r' or 'r:*'``" +#: library/tarfile.rst:74 +msgid "``'r'`` or ``'r:*'``" msgstr "" -#: library/tarfile.rst:59 +#: library/tarfile.rst:74 msgid "Open for reading with transparent compression (recommended)." msgstr "" -#: library/tarfile.rst:62 +#: library/tarfile.rst:77 msgid "``'r:'``" msgstr "" -#: library/tarfile.rst:62 +#: library/tarfile.rst:77 msgid "Open for reading exclusively without compression." msgstr "" -#: library/tarfile.rst:65 +#: library/tarfile.rst:80 msgid "``'r:gz'``" msgstr "" -#: library/tarfile.rst:65 +#: library/tarfile.rst:80 msgid "Open for reading with gzip compression." msgstr "" -#: library/tarfile.rst:67 +#: library/tarfile.rst:82 msgid "``'r:bz2'``" msgstr "" -#: library/tarfile.rst:67 +#: library/tarfile.rst:82 msgid "Open for reading with bzip2 compression." msgstr "" -#: library/tarfile.rst:69 +#: library/tarfile.rst:84 msgid "``'r:xz'``" msgstr "" -#: library/tarfile.rst:69 +#: library/tarfile.rst:84 msgid "Open for reading with lzma compression." msgstr "" -#: library/tarfile.rst:71 +#: library/tarfile.rst:86 +msgid "``'r:zst'``" +msgstr "" + +#: library/tarfile.rst:86 +msgid "Open for reading with Zstandard compression." +msgstr "" + +#: library/tarfile.rst:88 msgid "``'x'`` or ``'x:'``" msgstr "" -#: library/tarfile.rst:71 +#: library/tarfile.rst:88 msgid "" "Create a tarfile exclusively without compression. Raise a :exc:" "`FileExistsError` exception if it already exists." msgstr "" -#: library/tarfile.rst:76 +#: library/tarfile.rst:93 msgid "``'x:gz'``" msgstr "" -#: library/tarfile.rst:76 +#: library/tarfile.rst:93 msgid "" "Create a tarfile with gzip compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -#: library/tarfile.rst:80 +#: library/tarfile.rst:97 msgid "``'x:bz2'``" msgstr "" -#: library/tarfile.rst:80 +#: library/tarfile.rst:97 msgid "" "Create a tarfile with bzip2 compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -#: library/tarfile.rst:84 +#: library/tarfile.rst:101 msgid "``'x:xz'``" msgstr "" -#: library/tarfile.rst:84 +#: library/tarfile.rst:101 msgid "" "Create a tarfile with lzma compression. Raise a :exc:`FileExistsError` " "exception if it already exists." msgstr "" -#: library/tarfile.rst:88 -msgid "``'a' or 'a:'``" +#: library/tarfile.rst:105 +msgid "``'x:zst'``" msgstr "" -#: library/tarfile.rst:88 +#: library/tarfile.rst:105 +msgid "" +"Create a tarfile with Zstandard compression. Raise a :exc:`FileExistsError` " +"exception if it already exists." +msgstr "" + +#: library/tarfile.rst:109 +msgid "``'a'`` or ``'a:'``" +msgstr "" + +#: library/tarfile.rst:109 msgid "" "Open for appending with no compression. The file is created if it does not " "exist." msgstr "" -#: library/tarfile.rst:91 -msgid "``'w' or 'w:'``" +#: library/tarfile.rst:112 +msgid "``'w'`` or ``'w:'``" msgstr "" -#: library/tarfile.rst:91 +#: library/tarfile.rst:112 msgid "Open for uncompressed writing." msgstr "" -#: library/tarfile.rst:93 +#: library/tarfile.rst:115 msgid "``'w:gz'``" msgstr "" -#: library/tarfile.rst:93 +#: library/tarfile.rst:115 msgid "Open for gzip compressed writing." msgstr "" -#: library/tarfile.rst:95 +#: library/tarfile.rst:117 msgid "``'w:bz2'``" msgstr "" -#: library/tarfile.rst:95 +#: library/tarfile.rst:117 msgid "Open for bzip2 compressed writing." msgstr "" -#: library/tarfile.rst:97 +#: library/tarfile.rst:119 msgid "``'w:xz'``" msgstr "" -#: library/tarfile.rst:97 +#: library/tarfile.rst:119 msgid "Open for lzma compressed writing." msgstr "" -#: library/tarfile.rst:100 +#: library/tarfile.rst:121 +msgid "``'w:zst'``" +msgstr "" + +#: library/tarfile.rst:121 +msgid "Open for Zstandard compressed writing." +msgstr "" + +#: library/tarfile.rst:124 msgid "" "Note that ``'a:gz'``, ``'a:bz2'`` or ``'a:xz'`` is not possible. If *mode* " "is not suitable to open a certain (compressed) file for reading, :exc:" @@ -228,26 +273,38 @@ msgid "" "method is not supported, :exc:`CompressionError` is raised." msgstr "" -#: library/tarfile.rst:105 +#: library/tarfile.rst:129 msgid "" "If *fileobj* is specified, it is used as an alternative to a :term:`file " "object` opened in binary mode for *name*. It is supposed to be at position 0." msgstr "" -#: library/tarfile.rst:108 +#: library/tarfile.rst:132 msgid "" "For modes ``'w:gz'``, ``'x:gz'``, ``'w|gz'``, ``'w:bz2'``, ``'x:bz2'``, ``'w|" "bz2'``, :func:`tarfile.open` accepts the keyword argument *compresslevel* " "(default ``9``) to specify the compression level of the file." msgstr "" -#: library/tarfile.rst:112 +#: library/tarfile.rst:136 msgid "" -"For modes ``'w:xz'`` and ``'x:xz'``, :func:`tarfile.open` accepts the " -"keyword argument *preset* to specify the compression level of the file." +"For modes ``'w:xz'``, ``'x:xz'`` and ``'w|xz'``, :func:`tarfile.open` " +"accepts the keyword argument *preset* to specify the compression level of " +"the file." msgstr "" -#: library/tarfile.rst:115 +#: library/tarfile.rst:139 +msgid "" +"For modes ``'w:zst'``, ``'x:zst'`` and ``'w|zst'``, :func:`tarfile.open` " +"accepts the keyword argument *level* to specify the compression level of the " +"file. The keyword argument *options* may also be passed, providing advanced " +"Zstandard compression parameters described by :class:`~compression.zstd." +"CompressionParameter`. The keyword argument *zstd_dict* can be passed to " +"provide a :class:`~compression.zstd.ZstdDict`, a Zstandard dictionary used " +"to improve compression of smaller amounts of data." +msgstr "" + +#: library/tarfile.rst:148 msgid "" "For special purposes, there is a second format for *mode*: ``'filemode|" "[compression]'``. :func:`tarfile.open` will return a :class:`TarFile` " @@ -261,302 +318,330 @@ msgid "" "random access, see :ref:`tar-examples`. The currently possible modes:" msgstr "" -#: library/tarfile.rst:129 +#: library/tarfile.rst:162 msgid "Mode" msgstr "" -#: library/tarfile.rst:129 +#: library/tarfile.rst:162 msgid "Action" msgstr "" -#: library/tarfile.rst:131 +#: library/tarfile.rst:164 msgid "``'r|*'``" msgstr "" -#: library/tarfile.rst:131 +#: library/tarfile.rst:164 msgid "Open a *stream* of tar blocks for reading with transparent compression." msgstr "" -#: library/tarfile.rst:134 +#: library/tarfile.rst:167 msgid "``'r|'``" msgstr "" -#: library/tarfile.rst:134 +#: library/tarfile.rst:167 msgid "Open a *stream* of uncompressed tar blocks for reading." msgstr "" -#: library/tarfile.rst:137 +#: library/tarfile.rst:170 msgid "``'r|gz'``" msgstr "" -#: library/tarfile.rst:137 +#: library/tarfile.rst:170 msgid "Open a gzip compressed *stream* for reading." msgstr "" -#: library/tarfile.rst:140 +#: library/tarfile.rst:173 msgid "``'r|bz2'``" msgstr "" -#: library/tarfile.rst:140 +#: library/tarfile.rst:173 msgid "Open a bzip2 compressed *stream* for reading." msgstr "" -#: library/tarfile.rst:143 +#: library/tarfile.rst:176 msgid "``'r|xz'``" msgstr "" -#: library/tarfile.rst:143 +#: library/tarfile.rst:176 msgid "Open an lzma compressed *stream* for reading." msgstr "" -#: library/tarfile.rst:146 +#: library/tarfile.rst:179 +msgid "``'r|zst'``" +msgstr "" + +#: library/tarfile.rst:179 +msgid "Open a Zstandard compressed *stream* for reading." +msgstr "" + +#: library/tarfile.rst:182 msgid "``'w|'``" msgstr "" -#: library/tarfile.rst:146 +#: library/tarfile.rst:182 msgid "Open an uncompressed *stream* for writing." msgstr "" -#: library/tarfile.rst:148 +#: library/tarfile.rst:184 msgid "``'w|gz'``" msgstr "" -#: library/tarfile.rst:148 +#: library/tarfile.rst:184 msgid "Open a gzip compressed *stream* for writing." msgstr "" -#: library/tarfile.rst:151 +#: library/tarfile.rst:187 msgid "``'w|bz2'``" msgstr "" -#: library/tarfile.rst:151 +#: library/tarfile.rst:187 msgid "Open a bzip2 compressed *stream* for writing." msgstr "" -#: library/tarfile.rst:154 +#: library/tarfile.rst:190 msgid "``'w|xz'``" msgstr "" -#: library/tarfile.rst:154 +#: library/tarfile.rst:190 msgid "Open an lzma compressed *stream* for writing." msgstr "" -#: library/tarfile.rst:422 +#: library/tarfile.rst:193 +msgid "``'w|zst'``" +msgstr "" + +#: library/tarfile.rst:193 +msgid "Open a Zstandard compressed *stream* for writing." +msgstr "" + +#: library/tarfile.rst:476 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" -#: library/tarfile.rst:425 library/tarfile.rst:660 +#: library/tarfile.rst:479 library/tarfile.rst:727 msgid "The *name* parameter accepts a :term:`path-like object`." msgstr "" -#: library/tarfile.rst:164 +#: library/tarfile.rst:203 msgid "The *compresslevel* keyword argument also works for streams." msgstr "" -#: library/tarfile.rst:171 +#: library/tarfile.rst:206 +msgid "The *preset* keyword argument also works for streams." +msgstr "" + +#: library/tarfile.rst:213 msgid "" "Class for reading and writing tar archives. Do not use this class directly: " "use :func:`tarfile.open` instead. See :ref:`tarfile-objects`." msgstr "" -#: library/tarfile.rst:177 +#: library/tarfile.rst:219 msgid "" "Return :const:`True` if *name* is a tar archive file, that the :mod:" "`tarfile` module can read. *name* may be a :class:`str`, file, or file-like " "object." msgstr "" -#: library/tarfile.rst:180 +#: library/tarfile.rst:222 msgid "Support for file and file-like objects." msgstr "" -#: library/tarfile.rst:184 +#: library/tarfile.rst:226 msgid "The :mod:`tarfile` module defines the following exceptions:" msgstr "" -#: library/tarfile.rst:189 +#: library/tarfile.rst:231 msgid "Base class for all :mod:`tarfile` exceptions." msgstr "" -#: library/tarfile.rst:194 +#: library/tarfile.rst:236 msgid "" "Is raised when a tar archive is opened, that either cannot be handled by " "the :mod:`tarfile` module or is somehow invalid." msgstr "" -#: library/tarfile.rst:200 +#: library/tarfile.rst:242 msgid "" "Is raised when a compression method is not supported or when the data cannot " "be decoded properly." msgstr "" -#: library/tarfile.rst:206 +#: library/tarfile.rst:248 msgid "" "Is raised for the limitations that are typical for stream-like :class:" "`TarFile` objects." msgstr "" -#: library/tarfile.rst:212 +#: library/tarfile.rst:254 msgid "" "Is raised for *non-fatal* errors when using :meth:`TarFile.extract`, but " "only if :attr:`TarFile.errorlevel`\\ ``== 2``." msgstr "" -#: library/tarfile.rst:218 +#: library/tarfile.rst:260 msgid "Is raised by :meth:`TarInfo.frombuf` if the buffer it gets is invalid." msgstr "" -#: library/tarfile.rst:223 +#: library/tarfile.rst:265 msgid "" "Base class for members :ref:`refused ` by filters." msgstr "" -#: library/tarfile.rst:228 +#: library/tarfile.rst:270 msgid "" "Information about the member that the filter refused to extract, as :ref:" "`TarInfo `." msgstr "" -#: library/tarfile.rst:233 +#: library/tarfile.rst:275 msgid "Raised to refuse extracting a member with an absolute path." msgstr "" -#: library/tarfile.rst:237 +#: library/tarfile.rst:279 msgid "Raised to refuse extracting a member outside the destination directory." msgstr "" -#: library/tarfile.rst:241 +#: library/tarfile.rst:283 msgid "Raised to refuse extracting a special file (e.g. a device or pipe)." msgstr "" -#: library/tarfile.rst:245 +#: library/tarfile.rst:287 msgid "Raised to refuse extracting a symbolic link with an absolute path." msgstr "" -#: library/tarfile.rst:249 +#: library/tarfile.rst:291 msgid "" "Raised to refuse extracting a symbolic link pointing outside the destination " "directory." msgstr "" -#: library/tarfile.rst:253 +#: library/tarfile.rst:296 +msgid "" +"Raised to refuse emulating a link (hard or symbolic) by extracting another " +"archive member, when that member would be rejected by the filter location. " +"The exception that was raised to reject the replacement member is available " +"as :attr:`!BaseException.__context__`." +msgstr "" + +#: library/tarfile.rst:304 msgid "The following constants are available at the module level:" msgstr "" -#: library/tarfile.rst:257 +#: library/tarfile.rst:308 msgid "" "The default character encoding: ``'utf-8'`` on Windows, the value returned " "by :func:`sys.getfilesystemencoding` otherwise." msgstr "" -#: library/tarfile.rst:263 +#: library/tarfile.rst:314 msgid "A regular file :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:267 +#: library/tarfile.rst:318 msgid "A link (inside tarfile) :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:271 +#: library/tarfile.rst:322 msgid "A symbolic link :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:275 +#: library/tarfile.rst:326 msgid "A character special device :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:279 +#: library/tarfile.rst:330 msgid "A block special device :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:283 +#: library/tarfile.rst:334 msgid "A directory :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:287 +#: library/tarfile.rst:338 msgid "A FIFO special device :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:291 +#: library/tarfile.rst:342 msgid "A contiguous file :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:295 +#: library/tarfile.rst:346 msgid "A GNU tar longname :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:299 +#: library/tarfile.rst:350 msgid "A GNU tar longlink :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:303 +#: library/tarfile.rst:354 msgid "A GNU tar sparse file :attr:`~TarInfo.type`." msgstr "" -#: library/tarfile.rst:306 +#: library/tarfile.rst:357 msgid "" "Each of the following constants defines a tar archive format that the :mod:" "`tarfile` module is able to create. See section :ref:`tar-formats` for " "details." msgstr "" -#: library/tarfile.rst:313 +#: library/tarfile.rst:364 msgid "POSIX.1-1988 (ustar) format." msgstr "" -#: library/tarfile.rst:318 +#: library/tarfile.rst:369 msgid "GNU tar format." msgstr "" -#: library/tarfile.rst:323 +#: library/tarfile.rst:374 msgid "POSIX.1-2001 (pax) format." msgstr "" -#: library/tarfile.rst:328 +#: library/tarfile.rst:379 msgid "" "The default format for creating archives. This is currently :const:" "`PAX_FORMAT`." msgstr "" -#: library/tarfile.rst:330 +#: library/tarfile.rst:381 msgid "" "The default format for new archives was changed to :const:`PAX_FORMAT` from :" "const:`GNU_FORMAT`." msgstr "" -#: library/tarfile.rst:338 +#: library/tarfile.rst:388 msgid "Module :mod:`zipfile`" msgstr "" -#: library/tarfile.rst:338 +#: library/tarfile.rst:389 msgid "Documentation of the :mod:`zipfile` standard module." msgstr "" -#: library/tarfile.rst:342 +#: library/tarfile.rst:391 msgid ":ref:`archiving-operations`" msgstr "" -#: library/tarfile.rst:341 +#: library/tarfile.rst:392 msgid "" "Documentation of the higher-level archiving facilities provided by the " "standard :mod:`shutil` module." msgstr "" -#: library/tarfile.rst:344 +#: library/tarfile.rst:395 msgid "" "`GNU tar manual, Basic Tar Format `_" msgstr "" -#: library/tarfile.rst:345 +#: library/tarfile.rst:396 msgid "Documentation for tar archive files, including GNU tar extensions." msgstr "" -#: library/tarfile.rst:351 +#: library/tarfile.rst:402 msgid "TarFile Objects" msgstr "" -#: library/tarfile.rst:353 +#: library/tarfile.rst:404 msgid "" "The :class:`TarFile` object provides an interface to a tar archive. A tar " "archive is a sequence of blocks. An archive member (a stored file) is made " @@ -565,7 +650,7 @@ msgid "" "class:`TarInfo` object, see :ref:`tarinfo-objects` for details." msgstr "" -#: library/tarfile.rst:359 +#: library/tarfile.rst:410 msgid "" "A :class:`TarFile` object can be used as a context manager in a :keyword:" "`with` statement. It will automatically be closed when the block is " @@ -574,24 +659,24 @@ msgid "" "be closed. See the :ref:`tar-examples` section for a use case." msgstr "" -#: library/tarfile.rst:365 +#: library/tarfile.rst:416 msgid "Added support for the context management protocol." msgstr "" -#: library/tarfile.rst:370 +#: library/tarfile.rst:421 msgid "" "All following arguments are optional and can be accessed as instance " "attributes as well." msgstr "" -#: library/tarfile.rst:373 +#: library/tarfile.rst:424 msgid "" "*name* is the pathname of the archive. *name* may be a :term:`path-like " "object`. It can be omitted if *fileobj* is given. In this case, the file " "object's :attr:`!name` attribute is used if it exists." msgstr "" -#: library/tarfile.rst:377 +#: library/tarfile.rst:428 msgid "" "*mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append " "data to an existing file, ``'w'`` to create a new file overwriting an " @@ -599,18 +684,18 @@ msgid "" "exist." msgstr "" -#: library/tarfile.rst:381 +#: library/tarfile.rst:432 msgid "" "If *fileobj* is given, it is used for reading or writing data. If it can be " "determined, *mode* is overridden by *fileobj*'s mode. *fileobj* will be used " "from position 0." msgstr "" -#: library/tarfile.rst:387 +#: library/tarfile.rst:438 msgid "*fileobj* is not closed, when :class:`TarFile` is closed." msgstr "" -#: library/tarfile.rst:389 +#: library/tarfile.rst:440 msgid "" "*format* controls the archive format for writing. It must be one of the " "constants :const:`USTAR_FORMAT`, :const:`GNU_FORMAT` or :const:`PAX_FORMAT` " @@ -618,20 +703,20 @@ msgid "" "detected, even if different formats are present in a single archive." msgstr "" -#: library/tarfile.rst:394 +#: library/tarfile.rst:445 msgid "" "The *tarinfo* argument can be used to replace the default :class:`TarInfo` " "class with a different one." msgstr "" -#: library/tarfile.rst:397 +#: library/tarfile.rst:448 msgid "" "If *dereference* is :const:`False`, add symbolic and hard links to the " "archive. If it is :const:`True`, add the content of the target files to the " "archive. This has no effect on systems that do not support symbolic links." msgstr "" -#: library/tarfile.rst:401 +#: library/tarfile.rst:452 msgid "" "If *ignore_zeros* is :const:`False`, treat an empty block as the end of the " "archive. If it is :const:`True`, skip empty (and invalid) blocks and try to " @@ -639,19 +724,19 @@ msgid "" "concatenated or damaged archives." msgstr "" -#: library/tarfile.rst:405 +#: library/tarfile.rst:456 msgid "" "*debug* can be set from ``0`` (no debug messages) up to ``3`` (all debug " "messages). The messages are written to ``sys.stderr``." msgstr "" -#: library/tarfile.rst:408 +#: library/tarfile.rst:459 msgid "" "*errorlevel* controls how extraction errors are handled, see :attr:`the " "corresponding attribute `." msgstr "" -#: library/tarfile.rst:411 +#: library/tarfile.rst:462 msgid "" "The *encoding* and *errors* arguments define the character encoding to be " "used for reading or writing the archive and how conversion errors are going " @@ -659,47 +744,57 @@ msgid "" "ref:`tar-unicode` for in-depth information." msgstr "" -#: library/tarfile.rst:416 +#: library/tarfile.rst:467 msgid "" "The *pax_headers* argument is an optional dictionary of strings which will " "be added as a pax global header if *format* is :const:`PAX_FORMAT`." msgstr "" -#: library/tarfile.rst:729 +#: library/tarfile.rst:470 +msgid "" +"If *stream* is set to :const:`True` then while reading the archive info " +"about files in the archive are not cached, saving memory." +msgstr "" + +#: library/tarfile.rst:796 msgid "Use ``'surrogateescape'`` as the default for the *errors* argument." msgstr "" -#: library/tarfile.rst:431 +#: library/tarfile.rst:482 +msgid "Add the *stream* parameter." +msgstr "" + +#: library/tarfile.rst:487 msgid "" "Alternative constructor. The :func:`tarfile.open` function is actually a " "shortcut to this classmethod." msgstr "" -#: library/tarfile.rst:437 +#: library/tarfile.rst:493 msgid "" "Return a :class:`TarInfo` object for member *name*. If *name* can not be " "found in the archive, :exc:`KeyError` is raised." msgstr "" -#: library/tarfile.rst:442 +#: library/tarfile.rst:498 msgid "" "If a member occurs more than once in the archive, its last occurrence is " "assumed to be the most up-to-date version." msgstr "" -#: library/tarfile.rst:448 +#: library/tarfile.rst:504 msgid "" "Return the members of the archive as a list of :class:`TarInfo` objects. The " "list has the same order as the members in the archive." msgstr "" -#: library/tarfile.rst:454 +#: library/tarfile.rst:510 msgid "" "Return the members as a list of their names. It has the same order as the " "list returned by :meth:`getmembers`." msgstr "" -#: library/tarfile.rst:460 +#: library/tarfile.rst:516 msgid "" "Print a table of contents to ``sys.stdout``. If *verbose* is :const:`False`, " "only the names of the members are printed. If it is :const:`True`, output " @@ -707,18 +802,18 @@ msgid "" "given, it must be a subset of the list returned by :meth:`getmembers`." msgstr "" -#: library/tarfile.rst:465 +#: library/tarfile.rst:521 msgid "Added the *members* parameter." msgstr "" -#: library/tarfile.rst:471 +#: library/tarfile.rst:527 msgid "" "Return the next member of the archive as a :class:`TarInfo` object, when :" "class:`TarFile` is opened for reading. Return :const:`None` if there is no " "more available." msgstr "" -#: library/tarfile.rst:478 +#: library/tarfile.rst:534 msgid "" "Extract all members from the archive to the current working directory or " "directory *path*. If optional *members* is given, it must be a subset of the " @@ -730,48 +825,51 @@ msgid "" "fail." msgstr "" -#: library/tarfile.rst:486 +#: library/tarfile.rst:542 msgid "" "If *numeric_owner* is :const:`True`, the uid and gid numbers from the " "tarfile are used to set the owner/group for the extracted files. Otherwise, " "the named values from the tarfile are used." msgstr "" -#: library/tarfile.rst:490 +#: library/tarfile.rst:546 msgid "" "The *filter* argument specifies how ``members`` are modified or rejected " "before extraction. See :ref:`tarfile-extraction-filter` for details. It is " -"recommended to set this explicitly depending on which *tar* features you " -"need to support." +"recommended to set this explicitly only if specific *tar* features are " +"required, or as ``filter='data'`` to support Python versions with a less " +"secure default (3.13 and lower)." msgstr "" -#: library/tarfile.rst:498 -msgid "" -"Never extract archives from untrusted sources without prior inspection. It " -"is possible that files are created outside of *path*, e.g. members that have " -"absolute filenames starting with ``\"/\"`` or filenames with two dots ``\".." -"\"``." +#: library/tarfile.rst:555 +msgid "Never extract archives from untrusted sources without prior inspection." msgstr "" -#: library/tarfile.rst:536 +#: library/tarfile.rst:557 msgid "" -"Set ``filter='data'`` to prevent the most dangerous security issues, and " -"read the :ref:`tarfile-extraction-filter` section for details." +"Since Python 3.14, the default (:func:`data `) will prevent the " +"most dangerous security issues. However, it will not prevent *all* " +"unintended or insecure behavior. Read the :ref:`tarfile-extraction-filter` " +"section for details." msgstr "" -#: library/tarfile.rst:542 +#: library/tarfile.rst:599 msgid "Added the *numeric_owner* parameter." msgstr "" -#: library/tarfile.rst:545 +#: library/tarfile.rst:602 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: library/tarfile.rst:548 library/tarfile.rst:626 +#: library/tarfile.rst:605 library/tarfile.rst:689 msgid "Added the *filter* parameter." msgstr "" -#: library/tarfile.rst:518 +#: library/tarfile.rst:571 +msgid "The *filter* parameter now defaults to ``'data'``." +msgstr "" + +#: library/tarfile.rst:577 msgid "" "Extract a member from the archive to the current working directory, using " "its full name. Its file information is extracted as accurately as possible. " @@ -780,27 +878,29 @@ msgid "" "File attributes (owner, mtime, mode) are set unless *set_attrs* is false." msgstr "" -#: library/tarfile.rst:524 +#: library/tarfile.rst:583 msgid "" "The *numeric_owner* and *filter* arguments are the same as for :meth:" "`extractall`." msgstr "" -#: library/tarfile.rst:529 +#: library/tarfile.rst:588 msgid "" "The :meth:`extract` method does not take care of several extraction issues. " "In most cases you should consider using the :meth:`extractall` method." msgstr "" -#: library/tarfile.rst:534 -msgid "See the warning for :meth:`extractall`." +#: library/tarfile.rst:593 +msgid "" +"Never extract archives from untrusted sources without prior inspection. See " +"the warning for :meth:`extractall` for details." msgstr "" -#: library/tarfile.rst:539 +#: library/tarfile.rst:596 msgid "Added the *set_attrs* parameter." msgstr "" -#: library/tarfile.rst:554 +#: library/tarfile.rst:611 msgid "" "Extract a member from the archive as a file object. *member* may be a " "filename or a :class:`TarInfo` object. If *member* is a regular file or a " @@ -809,11 +909,17 @@ msgid "" "the archive, :exc:`KeyError` is raised." msgstr "" -#: library/tarfile.rst:560 +#: library/tarfile.rst:617 msgid "Return an :class:`io.BufferedReader` object." msgstr "" -#: library/tarfile.rst:566 +#: library/tarfile.rst:620 +msgid "" +"The returned :class:`io.BufferedReader` object has the :attr:`!mode` " +"attribute which is always equal to ``'rb'``." +msgstr "" + +#: library/tarfile.rst:627 msgid "" "If *errorlevel* is ``0``, errors are ignored when using :meth:`TarFile." "extract` and :meth:`TarFile.extractall`. Nevertheless, they appear as error " @@ -823,64 +929,63 @@ msgid "" "exc:`TarError` exceptions as well." msgstr "" -#: library/tarfile.rst:574 +#: library/tarfile.rst:635 msgid "" "Some exceptions, e.g. ones caused by wrong argument types or data " "corruption, are always raised." msgstr "" -#: library/tarfile.rst:577 +#: library/tarfile.rst:638 msgid "" "Custom :ref:`extraction filters ` should raise :" "exc:`FilterError` for *fatal* errors and :exc:`ExtractError` for *non-fatal* " "ones." msgstr "" -#: library/tarfile.rst:581 +#: library/tarfile.rst:642 msgid "" "Note that when an exception is raised, the archive may be partially " "extracted. It is the user’s responsibility to clean up." msgstr "" -#: library/tarfile.rst:588 +#: library/tarfile.rst:649 msgid "" "The :ref:`extraction filter ` used as a default " "for the *filter* argument of :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`." msgstr "" -#: library/tarfile.rst:592 +#: library/tarfile.rst:653 msgid "" "The attribute may be ``None`` or a callable. String names are not allowed " "for this attribute, unlike the *filter* argument to :meth:`~TarFile.extract`." msgstr "" -#: library/tarfile.rst:596 +#: library/tarfile.rst:657 msgid "" -"If ``extraction_filter`` is ``None`` (the default), calling an extraction " -"method without a *filter* argument will raise a ``DeprecationWarning``, and " -"fall back to the :func:`fully_trusted ` filter, whose " -"dangerous behavior matches previous versions of Python." +"If ``extraction_filter`` is ``None`` (the default), extraction methods will " +"use the :func:`data ` filter by default." msgstr "" -#: library/tarfile.rst:602 -msgid "" -"In Python 3.14+, leaving ``extraction_filter=None`` will cause extraction " -"methods to use the :func:`data ` filter by default." -msgstr "" - -#: library/tarfile.rst:605 +#: library/tarfile.rst:660 msgid "" "The attribute may be set on instances or overridden in subclasses. It also " "is possible to set it on the ``TarFile`` class itself to set a global " "default, although, since it affects all uses of *tarfile*, it is best " "practice to only do so in top-level applications or :mod:`site configuration " "`. To set a global default this way, a filter function needs to be " -"wrapped in :func:`staticmethod()` to prevent injection of a ``self`` " -"argument." +"wrapped in :func:`staticmethod` to prevent injection of a ``self`` argument." +msgstr "" + +#: library/tarfile.rst:670 +msgid "" +"The default filter is set to :func:`data `, which disallows " +"some dangerous features such as links to absolute paths or paths outside of " +"the destination. Previously, the default was equivalent to :func:" +"`fully_trusted `." msgstr "" -#: library/tarfile.rst:615 +#: library/tarfile.rst:678 msgid "" "Add the file *name* to the archive. *name* may be any type of file " "(directory, fifo, symbolic link, etc.). If given, *arcname* specifies an " @@ -893,19 +998,24 @@ msgid "" "ref:`tar-examples` for an example." msgstr "" -#: library/tarfile.rst:629 +#: library/tarfile.rst:692 msgid "Recursion adds entries in sorted order." msgstr "" -#: library/tarfile.rst:635 +#: library/tarfile.rst:698 msgid "" -"Add the :class:`TarInfo` object *tarinfo* to the archive. If *fileobj* is " -"given, it should be a :term:`binary file`, and ``tarinfo.size`` bytes are " -"read from it and added to the archive. You can create :class:`TarInfo` " -"objects directly, or by using :meth:`gettarinfo`." +"Add the :class:`TarInfo` object *tarinfo* to the archive. If *tarinfo* " +"represents a non zero-size regular file, the *fileobj* argument should be a :" +"term:`binary file`, and ``tarinfo.size`` bytes are read from it and added to " +"the archive. You can create :class:`TarInfo` objects directly, or by using :" +"meth:`gettarinfo`." +msgstr "" + +#: library/tarfile.rst:705 +msgid "*fileobj* must be given for non-zero-sized regular files." msgstr "" -#: library/tarfile.rst:643 +#: library/tarfile.rst:710 msgid "" "Create a :class:`TarInfo` object from the result of :func:`os.stat` or " "equivalent on an existing file. The file is either named by *name*, or " @@ -916,7 +1026,7 @@ msgid "" "The name should be a text string." msgstr "" -#: library/tarfile.rst:652 +#: library/tarfile.rst:719 msgid "" "You can modify some of the :class:`TarInfo`’s attributes before you add it " "using :meth:`addfile`. If the file object is not an ordinary file object " @@ -926,21 +1036,21 @@ msgid "" "case *arcname* could be a dummy string." msgstr "" -#: library/tarfile.rst:666 +#: library/tarfile.rst:733 msgid "" "Close the :class:`TarFile`. In write mode, two finishing zero blocks are " "appended to the archive." msgstr "" -#: library/tarfile.rst:673 +#: library/tarfile.rst:740 msgid "A dictionary containing key-value pairs of pax global headers." msgstr "" -#: library/tarfile.rst:680 +#: library/tarfile.rst:747 msgid "TarInfo Objects" msgstr "" -#: library/tarfile.rst:682 +#: library/tarfile.rst:749 msgid "" "A :class:`TarInfo` object represents one member in a :class:`TarFile`. Aside " "from storing all required attributes of a file (like file type, size, time, " @@ -948,14 +1058,14 @@ msgid "" "type. It does *not* contain the file's data itself." msgstr "" -#: library/tarfile.rst:687 +#: library/tarfile.rst:754 msgid "" ":class:`TarInfo` objects are returned by :class:`TarFile`'s methods :meth:" "`~TarFile.getmember`, :meth:`~TarFile.getmembers` and :meth:`~TarFile." "gettarinfo`." msgstr "" -#: library/tarfile.rst:691 +#: library/tarfile.rst:758 msgid "" "Modifying the objects returned by :meth:`~TarFile.getmember` or :meth:" "`~TarFile.getmembers` will affect all subsequent operations on the archive. " @@ -964,80 +1074,80 @@ msgid "" "step." msgstr "" -#: library/tarfile.rst:697 +#: library/tarfile.rst:764 msgid "" "Several attributes can be set to ``None`` to indicate that a piece of " "metadata is unused or unknown. Different :class:`TarInfo` methods handle " "``None`` differently:" msgstr "" -#: library/tarfile.rst:701 +#: library/tarfile.rst:768 msgid "" "The :meth:`~TarFile.extract` or :meth:`~TarFile.extractall` methods will " "ignore the corresponding metadata, leaving it set to a default." msgstr "" -#: library/tarfile.rst:703 +#: library/tarfile.rst:770 msgid ":meth:`~TarFile.addfile` will fail." msgstr "" -#: library/tarfile.rst:704 +#: library/tarfile.rst:771 msgid ":meth:`~TarFile.list` will print a placeholder string." msgstr "" -#: library/tarfile.rst:708 +#: library/tarfile.rst:775 msgid "Create a :class:`TarInfo` object." msgstr "" -#: library/tarfile.rst:713 +#: library/tarfile.rst:780 msgid "Create and return a :class:`TarInfo` object from string buffer *buf*." msgstr "" -#: library/tarfile.rst:715 +#: library/tarfile.rst:782 msgid "Raises :exc:`HeaderError` if the buffer is invalid." msgstr "" -#: library/tarfile.rst:720 +#: library/tarfile.rst:787 msgid "" "Read the next member from the :class:`TarFile` object *tarfile* and return " "it as a :class:`TarInfo` object." msgstr "" -#: library/tarfile.rst:726 +#: library/tarfile.rst:793 msgid "" "Create a string buffer from a :class:`TarInfo` object. For information on " "the arguments see the constructor of the :class:`TarFile` class." msgstr "" -#: library/tarfile.rst:733 +#: library/tarfile.rst:800 msgid "A ``TarInfo`` object has the following public data attributes:" msgstr "" -#: library/tarfile.rst:739 +#: library/tarfile.rst:806 msgid "Name of the archive member." msgstr "" -#: library/tarfile.rst:745 +#: library/tarfile.rst:812 msgid "Size in bytes." msgstr "" -#: library/tarfile.rst:751 +#: library/tarfile.rst:818 msgid "" "Time of last modification in seconds since the :ref:`epoch `, as in :" "attr:`os.stat_result.st_mtime`." msgstr "" -#: library/tarfile.rst:767 library/tarfile.rst:810 library/tarfile.rst:832 +#: library/tarfile.rst:834 library/tarfile.rst:877 library/tarfile.rst:899 msgid "" "Can be set to ``None`` for :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`, causing extraction to skip applying this attribute." msgstr "" -#: library/tarfile.rst:763 +#: library/tarfile.rst:830 msgid "Permission bits, as for :func:`os.chmod`." msgstr "" -#: library/tarfile.rst:773 +#: library/tarfile.rst:840 msgid "" "File type. *type* is usually one of these constants: :const:`REGTYPE`, :" "const:`AREGTYPE`, :const:`LNKTYPE`, :const:`SYMTYPE`, :const:`DIRTYPE`, :" @@ -1046,124 +1156,128 @@ msgid "" "more conveniently, use the ``is*()`` methods below." msgstr "" -#: library/tarfile.rst:783 +#: library/tarfile.rst:850 msgid "" "Name of the target file name, which is only present in :class:`TarInfo` " "objects of type :const:`LNKTYPE` and :const:`SYMTYPE`." msgstr "" -#: library/tarfile.rst:786 +#: library/tarfile.rst:853 msgid "" "For symbolic links (``SYMTYPE``), the *linkname* is relative to the " "directory that contains the link. For hard links (``LNKTYPE``), the " "*linkname* is relative to the root of the archive." msgstr "" -#: library/tarfile.rst:795 +#: library/tarfile.rst:862 msgid "User ID of the user who originally stored this member." msgstr "" -#: library/tarfile.rst:806 +#: library/tarfile.rst:873 msgid "Group ID of the user who originally stored this member." msgstr "" -#: library/tarfile.rst:817 +#: library/tarfile.rst:884 msgid "User name." msgstr "" -#: library/tarfile.rst:828 +#: library/tarfile.rst:895 msgid "Group name." msgstr "" -#: library/tarfile.rst:839 +#: library/tarfile.rst:906 msgid "Header checksum." msgstr "" -#: library/tarfile.rst:845 +#: library/tarfile.rst:912 msgid "Device major number." msgstr "" -#: library/tarfile.rst:851 +#: library/tarfile.rst:918 msgid "Device minor number." msgstr "" -#: library/tarfile.rst:857 +#: library/tarfile.rst:924 msgid "The tar header starts here." msgstr "" -#: library/tarfile.rst:863 +#: library/tarfile.rst:930 msgid "The file's data starts here." msgstr "" -#: library/tarfile.rst:868 +#: library/tarfile.rst:935 msgid "Sparse member information." msgstr "" -#: library/tarfile.rst:874 +#: library/tarfile.rst:941 msgid "" "A dictionary containing key-value pairs of an associated pax extended header." msgstr "" -#: library/tarfile.rst:882 +#: library/tarfile.rst:949 msgid "" "Return a *new* copy of the :class:`!TarInfo` object with the given " "attributes changed. For example, to return a ``TarInfo`` with the group name " "set to ``'staff'``, use::" msgstr "" -#: library/tarfile.rst:888 +#: library/tarfile.rst:953 +msgid "new_tarinfo = old_tarinfo.replace(gname='staff')" +msgstr "" + +#: library/tarfile.rst:955 msgid "" "By default, a deep copy is made. If *deep* is false, the copy is shallow, i." "e. ``pax_headers`` and any custom attributes are shared with the original " "``TarInfo`` object." msgstr "" -#: library/tarfile.rst:892 +#: library/tarfile.rst:959 msgid "A :class:`TarInfo` object also provides some convenient query methods:" msgstr "" -#: library/tarfile.rst:897 +#: library/tarfile.rst:964 msgid "Return :const:`True` if the :class:`TarInfo` object is a regular file." msgstr "" -#: library/tarfile.rst:902 +#: library/tarfile.rst:969 msgid "Same as :meth:`isfile`." msgstr "" -#: library/tarfile.rst:907 +#: library/tarfile.rst:974 msgid "Return :const:`True` if it is a directory." msgstr "" -#: library/tarfile.rst:912 +#: library/tarfile.rst:979 msgid "Return :const:`True` if it is a symbolic link." msgstr "" -#: library/tarfile.rst:917 +#: library/tarfile.rst:984 msgid "Return :const:`True` if it is a hard link." msgstr "" -#: library/tarfile.rst:922 +#: library/tarfile.rst:989 msgid "Return :const:`True` if it is a character device." msgstr "" -#: library/tarfile.rst:927 +#: library/tarfile.rst:994 msgid "Return :const:`True` if it is a block device." msgstr "" -#: library/tarfile.rst:932 +#: library/tarfile.rst:999 msgid "Return :const:`True` if it is a FIFO." msgstr "" -#: library/tarfile.rst:937 +#: library/tarfile.rst:1004 msgid "" "Return :const:`True` if it is one of character device, block device or FIFO." msgstr "" -#: library/tarfile.rst:943 +#: library/tarfile.rst:1010 msgid "Extraction filters" msgstr "" -#: library/tarfile.rst:947 +#: library/tarfile.rst:1014 msgid "" "The *tar* format is designed to capture all details of a UNIX-like " "filesystem, which makes it very powerful. Unfortunately, the features make " @@ -1173,66 +1287,71 @@ msgid "" "components, or symlinks that affect later members)." msgstr "" -#: library/tarfile.rst:955 +#: library/tarfile.rst:1022 msgid "" "In most cases, the full functionality is not needed. Therefore, *tarfile* " "supports extraction filters: a mechanism to limit functionality, and thus " "mitigate some of the security issues." msgstr "" -#: library/tarfile.rst:961 +#: library/tarfile.rst:1028 +msgid "" +"None of the available filters blocks *all* dangerous archive features. Never " +"extract archives from untrusted sources without prior inspection. See also :" +"ref:`tarfile-further-verification`." +msgstr "" + +#: library/tarfile.rst:1034 msgid ":pep:`706`" msgstr "" -#: library/tarfile.rst:962 +#: library/tarfile.rst:1035 msgid "Contains further motivation and rationale behind the design." msgstr "" -#: library/tarfile.rst:964 +#: library/tarfile.rst:1037 msgid "" "The *filter* argument to :meth:`TarFile.extract` or :meth:`~TarFile." "extractall` can be:" msgstr "" -#: library/tarfile.rst:967 +#: library/tarfile.rst:1040 msgid "" "the string ``'fully_trusted'``: Honor all metadata as specified in the " "archive. Should be used if the user trusts the archive completely, or " "implements their own complex verification." msgstr "" -#: library/tarfile.rst:972 +#: library/tarfile.rst:1045 msgid "" "the string ``'tar'``: Honor most *tar*-specific features (i.e. features of " "UNIX-like filesystems), but block features that are very likely to be " "surprising or malicious. See :func:`tar_filter` for details." msgstr "" -#: library/tarfile.rst:976 +#: library/tarfile.rst:1049 msgid "" "the string ``'data'``: Ignore or block most features specific to UNIX-like " "filesystems. Intended for extracting cross-platform data archives. See :func:" "`data_filter` for details." msgstr "" -#: library/tarfile.rst:980 +#: library/tarfile.rst:1053 msgid "``None`` (default): Use :attr:`TarFile.extraction_filter`." msgstr "" -#: library/tarfile.rst:982 +#: library/tarfile.rst:1055 msgid "" -"If that is also ``None`` (the default), raise a ``DeprecationWarning``, and " -"fall back to the ``'fully_trusted'`` filter, whose dangerous behavior " -"matches previous versions of Python." +"If that is also ``None`` (the default), the ``'data'`` filter will be used." msgstr "" -#: library/tarfile.rst:986 +#: library/tarfile.rst:1059 msgid "" -"In Python 3.14, the ``'data'`` filter will become the default instead. It's " -"possible to switch earlier; see :attr:`TarFile.extraction_filter`." +"The default filter is set to :func:`data `. Previously, the " +"default was equivalent to :func:`fully_trusted `." msgstr "" -#: library/tarfile.rst:989 +#: library/tarfile.rst:1063 msgid "" "A callable which will be called for each extracted member with a :ref:" "`TarInfo ` describing the member and the destination path " @@ -1240,23 +1359,27 @@ msgid "" "members)::" msgstr "" -#: library/tarfile.rst:996 +#: library/tarfile.rst:1068 +msgid "filter(member: TarInfo, path: str, /) -> TarInfo | None" +msgstr "" + +#: library/tarfile.rst:1070 msgid "" "The callable is called just before each member is extracted, so it can take " "the current state of the disk into account. It can:" msgstr "" -#: library/tarfile.rst:1000 +#: library/tarfile.rst:1074 msgid "" "return a :class:`TarInfo` object which will be used instead of the metadata " "in the archive, or" msgstr "" -#: library/tarfile.rst:1002 +#: library/tarfile.rst:1076 msgid "return ``None``, in which case the member will be skipped, or" msgstr "" -#: library/tarfile.rst:1003 +#: library/tarfile.rst:1077 msgid "" "raise an exception to abort the operation or skip the member, depending on :" "attr:`~TarFile.errorlevel`. Note that when extraction is aborted, :meth:" @@ -1264,118 +1387,136 @@ msgid "" "attempt to clean up." msgstr "" -#: library/tarfile.rst:1009 +#: library/tarfile.rst:1083 msgid "Default named filters" msgstr "" -#: library/tarfile.rst:1011 +#: library/tarfile.rst:1085 msgid "" "The pre-defined, named filters are available as functions, so they can be " "reused in custom filters:" msgstr "" -#: library/tarfile.rst:1016 +#: library/tarfile.rst:1090 msgid "Return *member* unchanged." msgstr "" -#: library/tarfile.rst:1018 +#: library/tarfile.rst:1092 msgid "This implements the ``'fully_trusted'`` filter." msgstr "" -#: library/tarfile.rst:1022 +#: library/tarfile.rst:1096 msgid "Implements the ``'tar'`` filter." msgstr "" -#: library/tarfile.rst:1024 +#: library/tarfile.rst:1098 msgid "Strip leading slashes (``/`` and :data:`os.sep`) from filenames." msgstr "" -#: library/tarfile.rst:1025 +#: library/tarfile.rst:1099 msgid "" ":ref:`Refuse ` to extract files with absolute " "paths (in case the name is absolute even after stripping slashes, e.g. ``C:/" "foo`` on Windows). This raises :class:`~tarfile.AbsolutePathError`." msgstr "" -#: library/tarfile.rst:1029 +#: library/tarfile.rst:1103 msgid "" ":ref:`Refuse ` to extract files whose absolute " "path (after following symlinks) would end up outside the destination. This " "raises :class:`~tarfile.OutsideDestinationError`." msgstr "" -#: library/tarfile.rst:1032 +#: library/tarfile.rst:1106 msgid "" "Clear high mode bits (setuid, setgid, sticky) and group/other write bits (:" "const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`)." msgstr "" -#: library/tarfile.rst:1068 +#: library/tarfile.rst:1148 msgid "Return the modified ``TarInfo`` member." msgstr "" -#: library/tarfile.rst:1039 +#: library/tarfile.rst:1113 msgid "" "Implements the ``'data'`` filter. In addition to what ``tar_filter`` does:" msgstr "" -#: library/tarfile.rst:1042 +#: library/tarfile.rst:1116 +msgid "" +"Normalize link targets (:attr:`TarInfo.linkname`) using :func:`os.path." +"normpath`. Note that this removes internal ``..`` components, which may " +"change the meaning of the link if the path in :attr:`!TarInfo.linkname` " +"traverses symbolic links." +msgstr "" + +#: library/tarfile.rst:1122 msgid "" ":ref:`Refuse ` to extract links (hard or soft) " "that link to absolute paths, or ones that link outside the destination." msgstr "" -#: library/tarfile.rst:1045 +#: library/tarfile.rst:1125 msgid "" "This raises :class:`~tarfile.AbsoluteLinkError` or :class:`~tarfile." "LinkOutsideDestinationError`." msgstr "" -#: library/tarfile.rst:1048 +#: library/tarfile.rst:1128 msgid "" "Note that such files are refused even on platforms that do not support " "symbolic links." msgstr "" -#: library/tarfile.rst:1051 +#: library/tarfile.rst:1131 msgid "" ":ref:`Refuse ` to extract device files (including " "pipes). This raises :class:`~tarfile.SpecialFileError`." msgstr "" -#: library/tarfile.rst:1055 +#: library/tarfile.rst:1135 msgid "For regular files, including hard links:" msgstr "" -#: library/tarfile.rst:1057 +#: library/tarfile.rst:1137 msgid "" "Set the owner read and write permissions (:const:`~stat.S_IRUSR` | :const:" "`~stat.S_IWUSR`)." msgstr "" -#: library/tarfile.rst:1059 +#: library/tarfile.rst:1139 msgid "" "Remove the group & other executable permission (:const:`~stat.S_IXGRP` | :" "const:`~stat.S_IXOTH`) if the owner doesn’t have it (:const:`~stat.S_IXUSR`)." msgstr "" -#: library/tarfile.rst:1063 +#: library/tarfile.rst:1143 msgid "" "For other files (directories), set ``mode`` to ``None``, so that extraction " "methods skip applying permission bits." msgstr "" -#: library/tarfile.rst:1065 +#: library/tarfile.rst:1145 msgid "" "Set user and group info (``uid``, ``gid``, ``uname``, ``gname``) to " "``None``, so that extraction methods skip setting it." msgstr "" -#: library/tarfile.rst:1074 +#: library/tarfile.rst:1150 +msgid "" +"Note that this filter does not block *all* dangerous archive features. See :" +"ref:`tarfile-further-verification` for details." +msgstr "" + +#: library/tarfile.rst:1155 +msgid "Link targets are now normalized." +msgstr "" + +#: library/tarfile.rst:1161 msgid "Filter errors" msgstr "" -#: library/tarfile.rst:1076 +#: library/tarfile.rst:1163 msgid "" "When a filter refuses to extract a file, it will raise an appropriate " "exception, a subclass of :class:`~tarfile.FilterError`. This will abort the " @@ -1384,11 +1525,11 @@ msgid "" "continue." msgstr "" -#: library/tarfile.rst:1084 +#: library/tarfile.rst:1173 msgid "Hints for further verification" msgstr "" -#: library/tarfile.rst:1086 +#: library/tarfile.rst:1175 msgid "" "Even with ``filter='data'``, *tarfile* is not suited for extracting " "untrusted files without prior inspection. Among other issues, the pre-" @@ -1396,69 +1537,73 @@ msgid "" "additional checks." msgstr "" -#: library/tarfile.rst:1091 +#: library/tarfile.rst:1180 msgid "Here is an incomplete list of things to consider:" msgstr "" -#: library/tarfile.rst:1093 +#: library/tarfile.rst:1182 msgid "" "Extract to a :func:`new temporary directory ` to prevent e." "g. exploiting pre-existing links, and to make it easier to clean up after a " "failed extraction." msgstr "" -#: library/tarfile.rst:1096 +#: library/tarfile.rst:1185 +msgid "Disallow symbolic links if you do not need the functionality." +msgstr "" + +#: library/tarfile.rst:1186 msgid "" "When working with untrusted data, use external (e.g. OS-level) limits on " "disk, memory and CPU usage." msgstr "" -#: library/tarfile.rst:1098 +#: library/tarfile.rst:1188 msgid "" "Check filenames against an allow-list of characters (to filter out control " -"characters, confusables, foreign path separators, etc.)." +"characters, confusables, foreign path separators, and so on)." msgstr "" -#: library/tarfile.rst:1101 +#: library/tarfile.rst:1191 msgid "" "Check that filenames have expected extensions (discouraging files that " "execute when you “click on them”, or extension-less files like Windows " "special device names)." msgstr "" -#: library/tarfile.rst:1103 +#: library/tarfile.rst:1194 msgid "" "Limit the number of extracted files, total size of extracted data, filename " "length (including symlink length), and size of individual files." msgstr "" -#: library/tarfile.rst:1105 +#: library/tarfile.rst:1196 msgid "Check for files that would be shadowed on case-insensitive filesystems." msgstr "" -#: library/tarfile.rst:1107 +#: library/tarfile.rst:1198 msgid "Also note that:" msgstr "" -#: library/tarfile.rst:1109 +#: library/tarfile.rst:1200 msgid "" "Tar files may contain multiple versions of the same file. Later ones are " "expected to overwrite any earlier ones. This feature is crucial to allow " "updating tape archives, but can be abused maliciously." msgstr "" -#: library/tarfile.rst:1113 +#: library/tarfile.rst:1204 msgid "" "*tarfile* does not protect against issues with “live” data, e.g. an attacker " "tinkering with the destination (or source) directory while extraction (or " "archiving) is in progress." msgstr "" -#: library/tarfile.rst:1119 +#: library/tarfile.rst:1210 msgid "Supporting older Python versions" msgstr "" -#: library/tarfile.rst:1121 +#: library/tarfile.rst:1212 msgid "" "Extraction filters were added to Python 3.12, but may be backported to older " "versions as security updates. To check whether the feature is available, use " @@ -1466,163 +1611,331 @@ msgid "" "version." msgstr "" -#: library/tarfile.rst:1126 +#: library/tarfile.rst:1217 msgid "" "The following examples show how to support Python versions with and without " "the feature. Note that setting ``extraction_filter`` will affect any " "subsequent operations." msgstr "" -#: library/tarfile.rst:1130 +#: library/tarfile.rst:1221 msgid "Fully trusted archive::" msgstr "" -#: library/tarfile.rst:1135 +#: library/tarfile.rst:1223 +msgid "" +"my_tarfile.extraction_filter = (lambda member, path: member)\n" +"my_tarfile.extractall()" +msgstr "" + +#: library/tarfile.rst:1226 msgid "" "Use the ``'data'`` filter if available, but revert to Python 3.11 behavior " "(``'fully_trusted'``) if this feature is not available::" msgstr "" -#: library/tarfile.rst:1142 +#: library/tarfile.rst:1229 +msgid "" +"my_tarfile.extraction_filter = getattr(tarfile, 'data_filter',\n" +" (lambda member, path: member))\n" +"my_tarfile.extractall()" +msgstr "" + +#: library/tarfile.rst:1233 msgid "Use the ``'data'`` filter; *fail* if it is not available::" msgstr "" -#: library/tarfile.rst:1146 +#: library/tarfile.rst:1235 +msgid "my_tarfile.extractall(filter=tarfile.data_filter)" +msgstr "" + +#: library/tarfile.rst:1237 msgid "or::" msgstr "" -#: library/tarfile.rst:1151 +#: library/tarfile.rst:1239 +msgid "" +"my_tarfile.extraction_filter = tarfile.data_filter\n" +"my_tarfile.extractall()" +msgstr "" + +#: library/tarfile.rst:1242 msgid "Use the ``'data'`` filter; *warn* if it is not available::" msgstr "" -#: library/tarfile.rst:1162 +#: library/tarfile.rst:1244 +msgid "" +"if hasattr(tarfile, 'data_filter'):\n" +" my_tarfile.extractall(filter='data')\n" +"else:\n" +" # remove this when no longer needed\n" +" warn_the_user('Extracting may be unsafe; consider updating Python')\n" +" my_tarfile.extractall()" +msgstr "" + +#: library/tarfile.rst:1253 msgid "Stateful extraction filter example" msgstr "" -#: library/tarfile.rst:1164 +#: library/tarfile.rst:1255 msgid "" "While *tarfile*'s extraction methods take a simple *filter* callable, custom " "filters may be more complex objects with an internal state. It may be useful " "to write these as context managers, to be used like this::" msgstr "" -#: library/tarfile.rst:1171 +#: library/tarfile.rst:1259 +msgid "" +"with StatefulFilter() as filter_func:\n" +" tar.extractall(path, filter=filter_func)" +msgstr "" + +#: library/tarfile.rst:1262 msgid "Such a filter can be written as, for example::" msgstr "" -#: library/tarfile.rst:1193 +#: library/tarfile.rst:1264 +msgid "" +"class StatefulFilter:\n" +" def __init__(self):\n" +" self.file_count = 0\n" +"\n" +" def __enter__(self):\n" +" return self\n" +"\n" +" def __call__(self, member, path):\n" +" self.file_count += 1\n" +" return member\n" +"\n" +" def __exit__(self, *exc_info):\n" +" print(f'{self.file_count} files extracted')" +msgstr "" + +#: library/tarfile.rst:1284 msgid "Command-Line Interface" msgstr "" -#: library/tarfile.rst:1197 +#: library/tarfile.rst:1288 msgid "" "The :mod:`tarfile` module provides a simple command-line interface to " "interact with tar archives." msgstr "" -#: library/tarfile.rst:1200 +#: library/tarfile.rst:1291 msgid "" "If you want to create a new tar archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: library/tarfile.rst:1207 +#: library/tarfile.rst:1294 +msgid "$ python -m tarfile -c monty.tar spam.txt eggs.txt" +msgstr "" + +#: library/tarfile.rst:1298 msgid "Passing a directory is also acceptable:" msgstr "" -#: library/tarfile.rst:1213 +#: library/tarfile.rst:1300 +msgid "$ python -m tarfile -c monty.tar life-of-brian_1979/" +msgstr "" + +#: library/tarfile.rst:1304 msgid "" "If you want to extract a tar archive into the current directory, use the :" "option:`-e` option:" msgstr "" -#: library/tarfile.rst:1220 +#: library/tarfile.rst:1307 +msgid "$ python -m tarfile -e monty.tar" +msgstr "" + +#: library/tarfile.rst:1311 msgid "" "You can also extract a tar archive into a different directory by passing the " "directory's name:" msgstr "" -#: library/tarfile.rst:1227 +#: library/tarfile.rst:1314 +msgid "$ python -m tarfile -e monty.tar other-dir/" +msgstr "" + +#: library/tarfile.rst:1318 msgid "For a list of the files in a tar archive, use the :option:`-l` option:" msgstr "" -#: library/tarfile.rst:1235 +#: library/tarfile.rst:1320 +msgid "$ python -m tarfile -l monty.tar" +msgstr "" + +#: library/tarfile.rst:1326 msgid "Command-line options" msgstr "" -#: library/tarfile.rst:1240 +#: library/tarfile.rst:1331 msgid "List files in a tarfile." msgstr "" -#: library/tarfile.rst:1245 +#: library/tarfile.rst:1336 msgid "Create tarfile from source files." msgstr "" -#: library/tarfile.rst:1250 +#: library/tarfile.rst:1341 msgid "" "Extract tarfile into the current directory if *output_dir* is not specified." msgstr "" -#: library/tarfile.rst:1255 +#: library/tarfile.rst:1346 msgid "Test whether the tarfile is valid or not." msgstr "" -#: library/tarfile.rst:1259 +#: library/tarfile.rst:1350 msgid "Verbose output." msgstr "" -#: library/tarfile.rst:1263 +#: library/tarfile.rst:1354 msgid "" "Specifies the *filter* for ``--extract``. See :ref:`tarfile-extraction-" "filter` for details. Only string names are accepted (that is, " "``fully_trusted``, ``tar``, and ``data``)." msgstr "" -#: library/tarfile.rst:1271 +#: library/tarfile.rst:1362 msgid "Examples" msgstr "" -#: library/tarfile.rst:1273 +#: library/tarfile.rst:1365 +msgid "Reading examples" +msgstr "" + +#: library/tarfile.rst:1367 msgid "How to extract an entire tar archive to the current working directory::" msgstr "" -#: library/tarfile.rst:1280 +#: library/tarfile.rst:1369 +msgid "" +"import tarfile\n" +"tar = tarfile.open(\"sample.tar.gz\")\n" +"tar.extractall(filter='data')\n" +"tar.close()" +msgstr "" + +#: library/tarfile.rst:1374 msgid "" "How to extract a subset of a tar archive with :meth:`TarFile.extractall` " "using a generator function instead of a list::" msgstr "" -#: library/tarfile.rst:1295 +#: library/tarfile.rst:1377 +msgid "" +"import os\n" +"import tarfile\n" +"\n" +"def py_files(members):\n" +" for tarinfo in members:\n" +" if os.path.splitext(tarinfo.name)[1] == \".py\":\n" +" yield tarinfo\n" +"\n" +"tar = tarfile.open(\"sample.tar.gz\")\n" +"tar.extractall(members=py_files(tar))\n" +"tar.close()" +msgstr "" + +#: library/tarfile.rst:1389 +msgid "" +"How to read a gzip compressed tar archive and display some member " +"information::" +msgstr "" + +#: library/tarfile.rst:1391 +msgid "" +"import tarfile\n" +"tar = tarfile.open(\"sample.tar.gz\", \"r:gz\")\n" +"for tarinfo in tar:\n" +" print(tarinfo.name, \"is\", tarinfo.size, \"bytes in size and is \", " +"end=\"\")\n" +" if tarinfo.isreg():\n" +" print(\"a regular file.\")\n" +" elif tarinfo.isdir():\n" +" print(\"a directory.\")\n" +" else:\n" +" print(\"something else.\")\n" +"tar.close()" +msgstr "" + +#: library/tarfile.rst:1404 +msgid "Writing examples" +msgstr "" + +#: library/tarfile.rst:1406 msgid "How to create an uncompressed tar archive from a list of filenames::" msgstr "" -#: library/tarfile.rst:1303 +#: library/tarfile.rst:1408 +msgid "" +"import tarfile\n" +"tar = tarfile.open(\"sample.tar\", \"w\")\n" +"for name in [\"foo\", \"bar\", \"quux\"]:\n" +" tar.add(name)\n" +"tar.close()" +msgstr "" + +#: library/tarfile.rst:1414 msgid "The same example using the :keyword:`with` statement::" msgstr "" -#: library/tarfile.rst:1310 +#: library/tarfile.rst:1416 msgid "" -"How to read a gzip compressed tar archive and display some member " -"information::" +"import tarfile\n" +"with tarfile.open(\"sample.tar\", \"w\") as tar:\n" +" for name in [\"foo\", \"bar\", \"quux\"]:\n" +" tar.add(name)" +msgstr "" + +#: library/tarfile.rst:1421 +msgid "" +"How to create and write an archive to stdout using :data:`sys.stdout.buffer " +"` in the *fileobj* parameter in :meth:`TarFile.add`::" msgstr "" -#: library/tarfile.rst:1324 +#: library/tarfile.rst:1425 +msgid "" +"import sys\n" +"import tarfile\n" +"with tarfile.open(\"sample.tar.gz\", \"w|gz\", fileobj=sys.stdout.buffer) as " +"tar:\n" +" for name in [\"foo\", \"bar\", \"quux\"]:\n" +" tar.add(name)" +msgstr "" + +#: library/tarfile.rst:1431 msgid "" "How to create an archive and reset the user information using the *filter* " "parameter in :meth:`TarFile.add`::" msgstr "" -#: library/tarfile.rst:1340 +#: library/tarfile.rst:1434 +msgid "" +"import tarfile\n" +"def reset(tarinfo):\n" +" tarinfo.uid = tarinfo.gid = 0\n" +" tarinfo.uname = tarinfo.gname = \"root\"\n" +" return tarinfo\n" +"tar = tarfile.open(\"sample.tar.gz\", \"w:gz\")\n" +"tar.add(\"foo\", filter=reset)\n" +"tar.close()" +msgstr "" + +#: library/tarfile.rst:1447 msgid "Supported tar formats" msgstr "" -#: library/tarfile.rst:1342 +#: library/tarfile.rst:1449 msgid "" "There are three tar formats that can be created with the :mod:`tarfile` " "module:" msgstr "" -#: library/tarfile.rst:1344 +#: library/tarfile.rst:1451 msgid "" "The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames " "up to a length of at best 256 characters and linknames up to 100 characters. " @@ -1630,7 +1943,7 @@ msgid "" "supported format." msgstr "" -#: library/tarfile.rst:1349 +#: library/tarfile.rst:1456 msgid "" "The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and " "linknames, files bigger than 8 GiB and sparse files. It is the de facto " @@ -1638,7 +1951,7 @@ msgid "" "extensions for long names, sparse file support is read-only." msgstr "" -#: library/tarfile.rst:1354 +#: library/tarfile.rst:1461 msgid "" "The POSIX.1-2001 pax format (:const:`PAX_FORMAT`). It is the most flexible " "format with virtually no limits. It supports long filenames and linknames, " @@ -1649,7 +1962,7 @@ msgid "" "*ustar* format. It is the current default format for new archives." msgstr "" -#: library/tarfile.rst:1362 +#: library/tarfile.rst:1469 msgid "" "It extends the existing *ustar* format with extra headers for information " "that cannot be stored otherwise. There are two flavours of pax headers: " @@ -1658,13 +1971,13 @@ msgid "" "in a pax header is encoded in *UTF-8* for portability reasons." msgstr "" -#: library/tarfile.rst:1368 +#: library/tarfile.rst:1475 msgid "" "There are some more variants of the tar format which can be read, but not " "created:" msgstr "" -#: library/tarfile.rst:1371 +#: library/tarfile.rst:1478 msgid "" "The ancient V7 format. This is the first tar format from Unix Seventh " "Edition, storing only regular files and directories. Names must not be " @@ -1673,17 +1986,17 @@ msgid "" "ASCII characters." msgstr "" -#: library/tarfile.rst:1376 +#: library/tarfile.rst:1483 msgid "" "The SunOS tar extended format. This format is a variant of the POSIX.1-2001 " "pax format, but is not compatible." msgstr "" -#: library/tarfile.rst:1382 +#: library/tarfile.rst:1489 msgid "Unicode issues" msgstr "" -#: library/tarfile.rst:1384 +#: library/tarfile.rst:1491 msgid "" "The tar format was originally conceived to make backups on tape drives with " "the main focus on preserving file system information. Nowadays tar archives " @@ -1698,13 +2011,13 @@ msgid "" "It stores non-ASCII metadata using the universal character encoding *UTF-8*." msgstr "" -#: library/tarfile.rst:1396 +#: library/tarfile.rst:1503 msgid "" "The details of character conversion in :mod:`tarfile` are controlled by the " "*encoding* and *errors* keyword arguments of the :class:`TarFile` class." msgstr "" -#: library/tarfile.rst:1399 +#: library/tarfile.rst:1506 msgid "" "*encoding* defines the character encoding to use for the metadata in the " "archive. The default value is :func:`sys.getfilesystemencoding` or " @@ -1713,7 +2026,7 @@ msgid "" "not set appropriately, this conversion may fail." msgstr "" -#: library/tarfile.rst:1405 +#: library/tarfile.rst:1512 msgid "" "The *errors* argument defines how characters are treated that cannot be " "converted. Possible values are listed in section :ref:`error-handlers`. The " @@ -1721,7 +2034,7 @@ msgid "" "system calls, see :ref:`os-filenames`." msgstr "" -#: library/tarfile.rst:1410 +#: library/tarfile.rst:1517 msgid "" "For :const:`PAX_FORMAT` archives (the default), *encoding* is generally not " "needed because all the metadata is stored using *UTF-8*. *encoding* is only " diff --git a/library/telnetlib.po b/library/telnetlib.po index e822775f..08ad4ea5 100644 --- a/library/telnetlib.po +++ b/library/telnetlib.po @@ -8,298 +8,35 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/telnetlib.rst:2 -msgid ":mod:`telnetlib` --- Telnet client" +msgid ":mod:`!telnetlib` --- Telnet client" msgstr "" #: library/telnetlib.rst:10 -msgid "**Source code:** :source:`Lib/telnetlib.py`" -msgstr "" - -#: library/telnetlib.rst:17 -msgid "" -"The :mod:`telnetlib` module is deprecated (see :pep:`PEP 594 " -"<594#telnetlib>` for details and alternatives)." -msgstr "" - -#: library/telnetlib.rst:20 -msgid "" -"The :mod:`telnetlib` module provides a :class:`Telnet` class that implements " -"the Telnet protocol. See :rfc:`854` for details about the protocol. In " -"addition, it provides symbolic constants for the protocol characters (see " -"below), and for the telnet options. The symbolic names of the telnet options " -"follow the definitions in ``arpa/telnet.h``, with the leading ``TELOPT_`` " -"removed. For symbolic names of options which are traditionally not included " -"in ``arpa/telnet.h``, see the module source itself." -msgstr "" - -#: library/telnetlib.rst:28 -msgid "" -"The symbolic constants for the telnet commands are: IAC, DONT, DO, WONT, " -"WILL, SE (Subnegotiation End), NOP (No Operation), DM (Data Mark), BRK " -"(Break), IP (Interrupt process), AO (Abort output), AYT (Are You There), EC " -"(Erase Character), EL (Erase Line), GA (Go Ahead), SB (Subnegotiation Begin)." -msgstr "" - -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" - -#: library/telnetlib.rst:37 -msgid "" -":class:`Telnet` represents a connection to a Telnet server. The instance is " -"initially not connected by default; the :meth:`~Telnet.open` method must be " -"used to establish a connection. Alternatively, the host name and optional " -"port number can be passed to the constructor too, in which case the " -"connection to the server will be established before the constructor " -"returns. The optional *timeout* parameter specifies a timeout in seconds " -"for blocking operations like the connection attempt (if not specified, the " -"global default timeout setting will be used)." -msgstr "" - -#: library/telnetlib.rst:46 -msgid "Do not reopen an already connected instance." -msgstr "" - -#: library/telnetlib.rst:48 msgid "" -"This class has many :meth:`read_\\*` methods. Note that some of them " -"raise :exc:`EOFError` when the end of the connection is read, because they " -"can return an empty string for other reasons. See the individual " -"descriptions below." -msgstr "" - -#: library/telnetlib.rst:52 -msgid "" -"A :class:`Telnet` object is a context manager and can be used in a :keyword:" -"`with` statement. When the :keyword:`!with` block ends, the :meth:`close` " -"method is called::" -msgstr "" - -#: library/telnetlib.rst:61 -msgid "Context manager support added" -msgstr "" - -#: library/telnetlib.rst:66 -msgid ":rfc:`854` - Telnet Protocol Specification" -msgstr "" - -#: library/telnetlib.rst:67 -msgid "Definition of the Telnet protocol." -msgstr "" - -#: library/telnetlib.rst:73 -msgid "Telnet Objects" -msgstr "" - -#: library/telnetlib.rst:75 -msgid ":class:`Telnet` instances have the following methods:" -msgstr "" - -#: library/telnetlib.rst:80 -msgid "" -"Read until a given byte string, *expected*, is encountered or until " -"*timeout* seconds have passed." -msgstr "" - -#: library/telnetlib.rst:83 -msgid "" -"When no match is found, return whatever is available instead, possibly empty " -"bytes. Raise :exc:`EOFError` if the connection is closed and no cooked data " -"is available." -msgstr "" - -#: library/telnetlib.rst:90 -msgid "Read all data until EOF as bytes; block until connection closed." -msgstr "" - -#: library/telnetlib.rst:95 -msgid "" -"Read at least one byte of cooked data unless EOF is hit. Return ``b''`` if " -"EOF is hit. Block if no data is immediately available." -msgstr "" - -#: library/telnetlib.rst:101 -msgid "Read everything that can be without blocking in I/O (eager)." -msgstr "" - -#: library/telnetlib.rst:112 -msgid "" -"Raise :exc:`EOFError` if connection closed and no cooked data available. " -"Return ``b''`` if no cooked data available otherwise. Do not block unless in " -"the midst of an IAC sequence." -msgstr "" - -#: library/telnetlib.rst:110 -msgid "Read readily available data." -msgstr "" - -#: library/telnetlib.rst:119 -msgid "Process and return data already in the queues (lazy)." -msgstr "" - -#: library/telnetlib.rst:121 -msgid "" -"Raise :exc:`EOFError` if connection closed and no data available. Return " -"``b''`` if no cooked data available otherwise. Do not block unless in the " -"midst of an IAC sequence." -msgstr "" - -#: library/telnetlib.rst:128 -msgid "Return any data available in the cooked queue (very lazy)." +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." msgstr "" -#: library/telnetlib.rst:130 +#: library/telnetlib.rst:14 msgid "" -"Raise :exc:`EOFError` if connection closed and no data available. Return " -"``b''`` if no cooked data available otherwise. This method never blocks." +"Possible replacements are third-party libraries from PyPI: :pypi:" +"`telnetlib3` or :pypi:`Exscript`. These are not supported or maintained by " +"the Python core team." msgstr "" -#: library/telnetlib.rst:136 +#: library/telnetlib.rst:18 msgid "" -"Return the data collected between a SB/SE pair (suboption begin/end). The " -"callback should access these data when it was invoked with a ``SE`` command. " -"This method never blocks." -msgstr "" - -#: library/telnetlib.rst:143 -msgid "" -"Connect to a host. The optional second argument is the port number, which " -"defaults to the standard Telnet port (23). The optional *timeout* parameter " -"specifies a timeout in seconds for blocking operations like the connection " -"attempt (if not specified, the global default timeout setting will be used)." -msgstr "" - -#: library/telnetlib.rst:148 -msgid "Do not try to reopen an already connected instance." -msgstr "" - -#: library/telnetlib.rst:161 -msgid "" -"Raises an :ref:`auditing event ` ``telnetlib.Telnet.open`` with " -"arguments ``self``, ``host``, ``port``." -msgstr "" - -#: library/telnetlib.rst:155 -msgid "" -"Print a debug message when the debug level is ``>`` 0. If extra arguments " -"are present, they are substituted in the message using the standard string " -"formatting operator." -msgstr "" - -#: library/telnetlib.rst:162 -msgid "" -"Set the debug level. The higher the value of *debuglevel*, the more debug " -"output you get (on ``sys.stdout``)." -msgstr "" - -#: library/telnetlib.rst:168 -msgid "Close the connection." -msgstr "" - -#: library/telnetlib.rst:173 -msgid "Return the socket object used internally." -msgstr "" - -#: library/telnetlib.rst:178 -msgid "Return the file descriptor of the socket object used internally." -msgstr "" - -#: library/telnetlib.rst:183 -msgid "" -"Write a byte string to the socket, doubling any IAC characters. This can " -"block if the connection is blocked. May raise :exc:`OSError` if the " -"connection is closed." -msgstr "" - -#: library/telnetlib.rst:198 -msgid "" -"Raises an :ref:`auditing event ` ``telnetlib.Telnet.write`` with " -"arguments ``self``, ``buffer``." -msgstr "" - -#: library/telnetlib.rst:189 -msgid "" -"This method used to raise :exc:`socket.error`, which is now an alias of :exc:" -"`OSError`." -msgstr "" - -#: library/telnetlib.rst:196 -msgid "Interaction function, emulates a very dumb Telnet client." -msgstr "" - -#: library/telnetlib.rst:201 -msgid "Multithreaded version of :meth:`interact`." -msgstr "" - -#: library/telnetlib.rst:206 -msgid "Read until one from a list of a regular expressions matches." -msgstr "" - -#: library/telnetlib.rst:208 -msgid "" -"The first argument is a list of regular expressions, either compiled (:ref:" -"`regex objects `) or uncompiled (byte strings). The optional " -"second argument is a timeout, in seconds; the default is to block " -"indefinitely." -msgstr "" - -#: library/telnetlib.rst:213 -msgid "" -"Return a tuple of three items: the index in the list of the first regular " -"expression that matches; the match object returned; and the bytes read up " -"till and including the match." -msgstr "" - -#: library/telnetlib.rst:217 -msgid "" -"If end of file is found and no bytes were read, raise :exc:`EOFError`. " -"Otherwise, when nothing matches, return ``(-1, None, data)`` where *data* is " -"the bytes received so far (may be empty bytes if a timeout happened)." -msgstr "" - -#: library/telnetlib.rst:221 -msgid "" -"If a regular expression ends with a greedy match (such as ``.*``) or if more " -"than one expression can match the same input, the results are non-" -"deterministic, and may depend on the I/O timing." -msgstr "" - -#: library/telnetlib.rst:228 -msgid "" -"Each time a telnet option is read on the input flow, this *callback* (if " -"set) is called with the following parameters: callback(telnet socket, " -"command (DO/DONT/WILL/WONT), option). No other action is done afterwards by " -"telnetlib." -msgstr "" - -#: library/telnetlib.rst:236 -msgid "Telnet Example" -msgstr "" - -#: library/telnetlib.rst:241 -msgid "A simple example illustrating typical use::" -msgstr "" - -#: library/telnetlib.rst:12 -msgid "protocol" -msgstr "" - -#: library/telnetlib.rst:12 -msgid "Telnet" +"The last version of Python that provided the :mod:`!telnetlib` module was " +"`Python 3.12 `_." msgstr "" diff --git a/library/tempfile.po b/library/tempfile.po index 3551d888..7db9ec21 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tempfile.rst:2 -msgid ":mod:`tempfile` --- Generate temporary files and directories" +msgid ":mod:`!tempfile` --- Generate temporary files and directories" msgstr "" #: library/tempfile.rst:9 @@ -525,6 +526,49 @@ msgstr "" msgid "Here are some examples of typical usage of the :mod:`tempfile` module::" msgstr "" +#: library/tempfile.rst:390 +msgid "" +">>> import tempfile\n" +"\n" +"# create a temporary file and write some data to it\n" +">>> fp = tempfile.TemporaryFile()\n" +">>> fp.write(b'Hello world!')\n" +"# read data from file\n" +">>> fp.seek(0)\n" +">>> fp.read()\n" +"b'Hello world!'\n" +"# close the file, it will be removed\n" +">>> fp.close()\n" +"\n" +"# create a temporary file using a context manager\n" +">>> with tempfile.TemporaryFile() as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.seek(0)\n" +"... fp.read()\n" +"b'Hello world!'\n" +">>>\n" +"# file is now closed and removed\n" +"\n" +"# create a temporary file using a context manager\n" +"# close the file, use the name to open the file again\n" +">>> with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.close()\n" +"... # the file is closed, but not removed\n" +"... # open the file again by using its name\n" +"... with open(fp.name, mode='rb') as f:\n" +"... f.read()\n" +"b'Hello world!'\n" +">>>\n" +"# file is now removed\n" +"\n" +"# create a temporary directory using the context manager\n" +">>> with tempfile.TemporaryDirectory() as tmpdirname:\n" +"... print('created temporary directory', tmpdirname)\n" +">>>\n" +"# directory and contents have been removed" +msgstr "" + #: library/tempfile.rst:433 msgid "Deprecated functions and variables" msgstr "" @@ -561,6 +605,19 @@ msgid "" "parameter::" msgstr "" +#: library/tempfile.rst:462 +msgid "" +">>> f = NamedTemporaryFile(delete=False)\n" +">>> f.name\n" +"'/tmp/tmptjujjt'\n" +">>> f.write(b\"Hello World!\\n\")\n" +"13\n" +">>> f.close()\n" +">>> os.unlink(f.name)\n" +">>> os.path.exists(f.name)\n" +"False" +msgstr "" + #: library/tempfile.rst:11 msgid "temporary" msgstr "" diff --git a/library/termios.po b/library/termios.po index 65ae39c8..3318df45 100644 --- a/library/termios.po +++ b/library/termios.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/termios.rst:2 -msgid ":mod:`termios` --- POSIX style tty control" +msgid ":mod:`!termios` --- POSIX style tty control" msgstr "" #: library/termios.rst:14 @@ -29,7 +30,7 @@ msgid "" msgstr "" #: library/termios.rst:19 -msgid ":ref:`Availability `: Unix." +msgid "Availability" msgstr "" #: library/termios.rst:21 @@ -144,6 +145,22 @@ msgid "" "are restored exactly no matter what happens::" msgstr "" +#: library/termios.rst:125 +msgid "" +"def getpass(prompt=\"Password: \"):\n" +" import termios, sys\n" +" fd = sys.stdin.fileno()\n" +" old = termios.tcgetattr(fd)\n" +" new = termios.tcgetattr(fd)\n" +" new[3] = new[3] & ~termios.ECHO # lflags\n" +" try:\n" +" termios.tcsetattr(fd, termios.TCSADRAIN, new)\n" +" passwd = input(prompt)\n" +" finally:\n" +" termios.tcsetattr(fd, termios.TCSADRAIN, old)\n" +" return passwd" +msgstr "" + #: library/termios.rst:8 msgid "POSIX" msgstr "" diff --git a/library/test.po b/library/test.po index 6ddb19ac..f1b8ed1d 100644 --- a/library/test.po +++ b/library/test.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/test.rst:2 -msgid ":mod:`test` --- Regression tests package for Python" +msgid ":mod:`!test` --- Regression tests package for Python" msgstr "" #: library/test.rst:10 @@ -46,7 +47,7 @@ msgid "" "printed to ``sys.stdout``; this style of test is considered deprecated." msgstr "" -#: library/test.rst:33 +#: library/test.rst:32 msgid "Module :mod:`unittest`" msgstr "" @@ -84,6 +85,40 @@ msgstr "" msgid "A basic boilerplate is often used::" msgstr "" +#: library/test.rst:57 +msgid "" +"import unittest\n" +"from test import support\n" +"\n" +"class MyTestCase1(unittest.TestCase):\n" +"\n" +" # Only use setUp() and tearDown() if necessary\n" +"\n" +" def setUp(self):\n" +" ... code to execute in preparation for tests ...\n" +"\n" +" def tearDown(self):\n" +" ... code to execute to clean up after tests ...\n" +"\n" +" def test_feature_one(self):\n" +" # Test feature one.\n" +" ... testing code ...\n" +"\n" +" def test_feature_two(self):\n" +" # Test feature two.\n" +" ... testing code ...\n" +"\n" +" ... more test methods ...\n" +"\n" +"class MyTestCase2(unittest.TestCase):\n" +" ... same structure as MyTestCase1 ...\n" +"\n" +"... more test classes ...\n" +"\n" +"if __name__ == '__main__':\n" +" unittest.main()" +msgstr "" + #: library/test.rst:88 msgid "" "This code pattern allows the testing suite to be run by :mod:`test." @@ -158,6 +193,25 @@ msgid "" "subclassing a basic test class with a class that specifies the input::" msgstr "" +#: library/test.rst:129 +msgid "" +"class TestFuncAcceptsSequencesMixin:\n" +"\n" +" func = mySuperWhammyFunction\n" +"\n" +" def test_func(self):\n" +" self.func(self.arg)\n" +"\n" +"class AcceptLists(TestFuncAcceptsSequencesMixin, unittest.TestCase):\n" +" arg = [1, 2, 3]\n" +"\n" +"class AcceptStrings(TestFuncAcceptsSequencesMixin, unittest.TestCase):\n" +" arg = 'abc'\n" +"\n" +"class AcceptTuples(TestFuncAcceptsSequencesMixin, unittest.TestCase):\n" +" arg = (1, 2, 3)" +msgstr "" + #: library/test.rst:145 msgid "" "When using this pattern, remember that all classes that inherit from :class:" @@ -217,142 +271,166 @@ msgid "" "tests." msgstr "" -#: library/test.rst:197 +#: library/test.rst:195 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." +msgstr "" + +#: library/test.rst:201 msgid ":mod:`test.support` --- Utilities for the Python test suite" msgstr "" -#: library/test.rst:203 +#: library/test.rst:207 msgid "" "The :mod:`test.support` module provides support for Python's regression test " "suite." msgstr "" -#: library/test.rst:208 +#: library/test.rst:212 msgid "" ":mod:`test.support` is not a public module. It is documented here to help " "Python developers write tests. The API of this module is subject to change " "without backwards compatibility concerns between releases." msgstr "" -#: library/test.rst:213 +#: library/test.rst:217 msgid "This module defines the following exceptions:" msgstr "" -#: library/test.rst:217 +#: library/test.rst:221 msgid "" "Exception to be raised when a test fails. This is deprecated in favor of :" "mod:`unittest`\\ -based tests and :class:`unittest.TestCase`'s assertion " "methods." msgstr "" -#: library/test.rst:224 +#: library/test.rst:228 msgid "" "Subclass of :exc:`unittest.SkipTest`. Raised when a resource (such as a " "network connection) is not available. Raised by the :func:`requires` " "function." msgstr "" -#: library/test.rst:229 +#: library/test.rst:233 msgid "The :mod:`test.support` module defines the following constants:" msgstr "" -#: library/test.rst:233 +#: library/test.rst:237 msgid "" "``True`` when verbose output is enabled. Should be checked when more " "detailed information is desired about a running test. *verbose* is set by :" "mod:`test.regrtest`." msgstr "" -#: library/test.rst:240 +#: library/test.rst:244 msgid "``True`` if the running interpreter is Jython." msgstr "" -#: library/test.rst:245 -msgid "``True`` if the system is Android." +#: library/test.rst:249 +msgid "``True`` if ``sys.platform`` is ``android``." +msgstr "" + +#: library/test.rst:254 +msgid "``True`` if ``sys.platform`` is ``emscripten``." +msgstr "" + +#: library/test.rst:259 +msgid "``True`` if ``sys.platform`` is ``wasi``." +msgstr "" + +#: library/test.rst:264 +msgid "``True`` if ``sys.platform`` is ``ios``, ``tvos``, or ``watchos``." +msgstr "" + +#: library/test.rst:269 +msgid "" +"``True`` if ``sys.platform`` is ``darwin`` or ``is_apple_mobile`` is " +"``True``." msgstr "" -#: library/test.rst:250 +#: library/test.rst:274 msgid "Path for shell if not on Windows; otherwise ``None``." msgstr "" -#: library/test.rst:255 +#: library/test.rst:279 msgid "" "Timeout in seconds for tests using a network server listening on the network " "local loopback interface like ``127.0.0.1``." msgstr "" -#: library/test.rst:258 +#: library/test.rst:282 msgid "" "The timeout is long enough to prevent test failure: it takes into account " "that the client and the server can run in different threads or even " "different processes." msgstr "" -#: library/test.rst:262 +#: library/test.rst:286 msgid "" "The timeout should be long enough for :meth:`~socket.socket.connect`, :meth:" "`~socket.socket.recv` and :meth:`~socket.socket.send` methods of :class:" "`socket.socket`." msgstr "" -#: library/test.rst:266 +#: library/test.rst:290 msgid "Its default value is 5 seconds." msgstr "" -#: library/test.rst:268 +#: library/test.rst:292 msgid "See also :data:`INTERNET_TIMEOUT`." msgstr "" -#: library/test.rst:273 +#: library/test.rst:297 msgid "Timeout in seconds for network requests going to the internet." msgstr "" -#: library/test.rst:275 +#: library/test.rst:299 msgid "" "The timeout is short enough to prevent a test to wait for too long if the " "internet request is blocked for whatever reason." msgstr "" -#: library/test.rst:278 +#: library/test.rst:302 msgid "" "Usually, a timeout using :data:`INTERNET_TIMEOUT` should not mark a test as " "failed, but skip the test instead: see :func:`~test.support.socket_helper." "transient_internet`." msgstr "" -#: library/test.rst:282 +#: library/test.rst:306 msgid "Its default value is 1 minute." msgstr "" -#: library/test.rst:284 +#: library/test.rst:308 msgid "See also :data:`LOOPBACK_TIMEOUT`." msgstr "" -#: library/test.rst:289 +#: library/test.rst:313 msgid "" "Timeout in seconds to mark a test as failed if the test takes \"too long\"." msgstr "" -#: library/test.rst:291 +#: library/test.rst:315 msgid "" "The timeout value depends on the regrtest ``--timeout`` command line option." msgstr "" -#: library/test.rst:293 +#: library/test.rst:317 msgid "" "If a test using :data:`SHORT_TIMEOUT` starts to fail randomly on slow " "buildbots, use :data:`LONG_TIMEOUT` instead." msgstr "" -#: library/test.rst:296 +#: library/test.rst:320 msgid "Its default value is 30 seconds." msgstr "" -#: library/test.rst:301 +#: library/test.rst:325 msgid "Timeout in seconds to detect when a test hangs." msgstr "" -#: library/test.rst:303 +#: library/test.rst:327 msgid "" "It is long enough to reduce the risk of test failure on the slowest Python " "buildbots. It should not be used to mark a test as failed if the test takes " @@ -360,171 +438,203 @@ msgid "" "command line option." msgstr "" -#: library/test.rst:308 +#: library/test.rst:332 msgid "Its default value is 5 minutes." msgstr "" -#: library/test.rst:310 +#: library/test.rst:334 msgid "" "See also :data:`LOOPBACK_TIMEOUT`, :data:`INTERNET_TIMEOUT` and :data:" "`SHORT_TIMEOUT`." msgstr "" -#: library/test.rst:316 +#: library/test.rst:340 msgid "Set when tests can be skipped when they are not useful for PGO." msgstr "" -#: library/test.rst:321 +#: library/test.rst:345 msgid "" "A constant that is likely larger than the underlying OS pipe buffer size, to " "make writes blocking." msgstr "" -#: library/test.rst:327 +#: library/test.rst:351 msgid "" -"True if Python was built with the :c:macro:`Py_DEBUG` macro defined, that " -"is, if Python was :ref:`built in debug mode `." +"``True`` if Python was built with the :c:macro:`Py_DEBUG` macro defined, " +"that is, if Python was :ref:`built in debug mode `." msgstr "" -#: library/test.rst:336 +#: library/test.rst:360 msgid "" "A constant that is likely larger than the underlying OS socket buffer size, " "to make writes blocking." msgstr "" -#: library/test.rst:342 +#: library/test.rst:366 msgid "Set to the top level directory that contains :mod:`test.support`." msgstr "" -#: library/test.rst:347 +#: library/test.rst:371 msgid "Set to the top level directory for the test package." msgstr "" -#: library/test.rst:352 +#: library/test.rst:376 msgid "Set to the ``data`` directory within the test package." msgstr "" -#: library/test.rst:357 +#: library/test.rst:381 msgid "Set to :data:`sys.maxsize` for big memory tests." msgstr "" -#: library/test.rst:362 +#: library/test.rst:386 msgid "" "Set by :func:`set_memlimit` as the memory limit for big memory tests. " "Limited by :data:`MAX_Py_ssize_t`." msgstr "" -#: library/test.rst:368 +#: library/test.rst:392 msgid "" "Set by :func:`set_memlimit` as the memory limit for big memory tests. Not " "limited by :data:`MAX_Py_ssize_t`." msgstr "" -#: library/test.rst:374 +#: library/test.rst:398 msgid "" "Set to ``True`` if Python is built without docstrings (the :c:macro:" "`WITH_DOC_STRINGS` macro is not defined). See the :option:`configure --" "without-doc-strings <--without-doc-strings>` option." msgstr "" -#: library/test.rst:378 +#: library/test.rst:402 msgid "See also the :data:`HAVE_DOCSTRINGS` variable." msgstr "" -#: library/test.rst:383 +#: library/test.rst:407 msgid "" "Set to ``True`` if function docstrings are available. See the :option:" "`python -OO <-O>` option, which strips docstrings of functions implemented " "in Python." msgstr "" -#: library/test.rst:386 +#: library/test.rst:410 msgid "See also the :data:`MISSING_C_DOCSTRINGS` variable." msgstr "" -#: library/test.rst:391 +#: library/test.rst:415 msgid "Define the URL of a dedicated HTTP server for the network tests." msgstr "" -#: library/test.rst:396 +#: library/test.rst:420 msgid "Object that is equal to anything. Used to test mixed type comparison." msgstr "" -#: library/test.rst:401 +#: library/test.rst:425 msgid "" "Object that is not equal to anything (even to :data:`ALWAYS_EQ`). Used to " "test mixed type comparison." msgstr "" -#: library/test.rst:407 +#: library/test.rst:431 msgid "" "Object that is greater than anything (except itself). Used to test mixed " "type comparison." msgstr "" -#: library/test.rst:413 +#: library/test.rst:437 msgid "" "Object that is less than anything (except itself). Used to test mixed type " "comparison." msgstr "" -#: library/test.rst:417 +#: library/test.rst:441 msgid "The :mod:`test.support` module defines the following functions:" msgstr "" -#: library/test.rst:421 +#: library/test.rst:445 msgid "Run the loop body until ``break`` stops the loop." msgstr "" -#: library/test.rst:423 +#: library/test.rst:447 msgid "" "After *timeout* seconds, raise an :exc:`AssertionError` if *error* is true, " "or just stop the loop if *error* is false." msgstr "" -#: library/test.rst:426 +#: library/test.rst:450 msgid "Example::" msgstr "" -#: library/test.rst:456 +#: library/test.rst:452 +msgid "" +"for _ in support.busy_retry(support.SHORT_TIMEOUT):\n" +" if check():\n" +" break" +msgstr "" + +#: library/test.rst:480 msgid "Example of error=False usage::" msgstr "" -#: library/test.rst:442 +#: library/test.rst:458 +msgid "" +"for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):\n" +" if check():\n" +" break\n" +"else:\n" +" raise RuntimeError('my custom error')" +msgstr "" + +#: library/test.rst:466 msgid "Wait strategy that applies exponential backoff." msgstr "" -#: library/test.rst:444 +#: library/test.rst:468 msgid "" "Run the loop body until ``break`` stops the loop. Sleep at each loop " "iteration, but not at the first iteration. The sleep delay is doubled at " "each iteration (up to *max_delay* seconds)." msgstr "" -#: library/test.rst:448 +#: library/test.rst:472 msgid "See :func:`busy_retry` documentation for the parameters usage." msgstr "" -#: library/test.rst:450 +#: library/test.rst:474 msgid "Example raising an exception after SHORT_TIMEOUT seconds::" msgstr "" -#: library/test.rst:466 +#: library/test.rst:476 +msgid "" +"for _ in support.sleeping_retry(support.SHORT_TIMEOUT):\n" +" if check():\n" +" break" +msgstr "" + +#: library/test.rst:482 +msgid "" +"for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):\n" +" if check():\n" +" break\n" +"else:\n" +" raise RuntimeError('my custom error')" +msgstr "" + +#: library/test.rst:490 msgid "" "Return ``True`` if *resource* is enabled and available. The list of " "available resources is only set when :mod:`test.regrtest` is executing the " "tests." msgstr "" -#: library/test.rst:473 +#: library/test.rst:497 msgid "Return ``True`` if Python was not built with ``-O0`` or ``-Og``." msgstr "" -#: library/test.rst:478 +#: library/test.rst:502 msgid "Return :const:`_testcapi.WITH_PYMALLOC`." msgstr "" -#: library/test.rst:483 +#: library/test.rst:507 msgid "" "Raise :exc:`ResourceDenied` if *resource* is not available. *msg* is the " "argument to :exc:`ResourceDenied` if it is raised. Always returns ``True`` " @@ -532,89 +642,115 @@ msgid "" "tests are executed by :mod:`test.regrtest`." msgstr "" -#: library/test.rst:491 +#: library/test.rst:515 msgid "Return a repr of *dict* with keys sorted." msgstr "" -#: library/test.rst:496 +#: library/test.rst:520 msgid "" "Return the path to the file named *filename*. If no match is found " "*filename* is returned. This does not equal a failure since it could be the " "path to the file." msgstr "" -#: library/test.rst:500 +#: library/test.rst:524 msgid "" "Setting *subdir* indicates a relative path to use to find the file rather " "than looking directly in the path directories." msgstr "" -#: library/test.rst:506 +#: library/test.rst:530 msgid "Get size of a page in bytes." msgstr "" -#: library/test.rst:513 +#: library/test.rst:537 msgid "" "Set the :func:`sys.setswitchinterval` to the given *interval*. Defines a " "minimum interval for Android systems to prevent the system from hanging." msgstr "" -#: library/test.rst:519 +#: library/test.rst:543 msgid "" "Use this check to guard CPython's implementation-specific tests or to run " "them only on the implementations guarded by the arguments. This function " "returns ``True`` or ``False`` depending on the host platform. Example usage::" msgstr "" -#: library/test.rst:531 +#: library/test.rst:548 +msgid "" +"check_impl_detail() # Only on CPython (default).\n" +"check_impl_detail(jython=True) # Only on Jython.\n" +"check_impl_detail(cpython=False) # Everywhere except CPython." +msgstr "" + +#: library/test.rst:555 msgid "" "Set the values for :data:`max_memuse` and :data:`real_max_memuse` for big " "memory tests." msgstr "" -#: library/test.rst:537 +#: library/test.rst:561 msgid "" "Store the value from *stdout*. It is meant to hold the stdout at the time " "the regrtest began." msgstr "" -#: library/test.rst:543 +#: library/test.rst:567 msgid "" "Return the original stdout set by :func:`record_original_stdout` or ``sys." "stdout`` if it's not set." msgstr "" -#: library/test.rst:549 +#: library/test.rst:573 msgid "" "Return a list of command line arguments reproducing the current settings in " "``sys.flags`` and ``sys.warnoptions``." msgstr "" -#: library/test.rst:555 +#: library/test.rst:579 msgid "" "Return a list of command line arguments reproducing the current optimization " "settings in ``sys.flags``." msgstr "" -#: library/test.rst:563 +#: library/test.rst:587 msgid "" "A context managers that temporarily replaces the named stream with :class:" "`io.StringIO` object." msgstr "" -#: library/test.rst:566 +#: library/test.rst:590 msgid "Example use with output streams::" msgstr "" -#: library/test.rst:574 +#: library/test.rst:592 +msgid "" +"with captured_stdout() as stdout, captured_stderr() as stderr:\n" +" print(\"hello\")\n" +" print(\"error\", file=sys.stderr)\n" +"assert stdout.getvalue() == \"hello\\n\"\n" +"assert stderr.getvalue() == \"error\\n\"" +msgstr "" + +#: library/test.rst:598 msgid "Example use with input stream::" msgstr "" -#: library/test.rst:586 +#: library/test.rst:600 +msgid "" +"with captured_stdin() as stdin:\n" +" stdin.write('hello\\n')\n" +" stdin.seek(0)\n" +" # call test code that consumes from sys.stdin\n" +" captured = input()\n" +"self.assertEqual(captured, \"hello\")" +msgstr "" + +#: library/test.rst:610 msgid "A context manager that temporary disables :mod:`faulthandler`." msgstr "" -#: library/test.rst:591 +#: library/test.rst:615 msgid "" "Force as many objects as possible to be collected. This is needed because " "timely deallocation is not guaranteed by the garbage collector. This means " @@ -622,111 +758,123 @@ msgid "" "remain alive for longer than expected." msgstr "" -#: library/test.rst:599 +#: library/test.rst:623 msgid "" "A context manager that disables the garbage collector on entry. On exit, the " "garbage collector is restored to its prior state." msgstr "" -#: library/test.rst:605 +#: library/test.rst:629 msgid "Context manager to swap out an attribute with a new object." msgstr "" -#: library/test.rst:625 library/test.rst:1326 +#: library/test.rst:649 library/test.rst:1370 msgid "Usage::" msgstr "" -#: library/test.rst:612 +#: library/test.rst:633 +msgid "" +"with swap_attr(obj, \"attr\", 5):\n" +" ..." +msgstr "" + +#: library/test.rst:636 msgid "" "This will set ``obj.attr`` to 5 for the duration of the ``with`` block, " "restoring the old value at the end of the block. If ``attr`` doesn't exist " "on ``obj``, it will be created and then deleted at the end of the block." msgstr "" -#: library/test.rst:635 +#: library/test.rst:659 msgid "" "The old value (or ``None`` if it doesn't exist) will be assigned to the " "target of the \"as\" clause, if there is one." msgstr "" -#: library/test.rst:623 +#: library/test.rst:647 msgid "Context manager to swap out an item with a new object." msgstr "" -#: library/test.rst:630 +#: library/test.rst:651 +msgid "" +"with swap_item(obj, \"item\", 5):\n" +" ..." +msgstr "" + +#: library/test.rst:654 msgid "" "This will set ``obj[\"item\"]`` to 5 for the duration of the ``with`` block, " "restoring the old value at the end of the block. If ``item`` doesn't exist " "on ``obj``, it will be created and then deleted at the end of the block." msgstr "" -#: library/test.rst:641 +#: library/test.rst:665 msgid "" "Call the ``flush()`` method on :data:`sys.stdout` and then on :data:`sys." "stderr`. It can be used to make sure that the logs order is consistent " "before writing into stderr." msgstr "" -#: library/test.rst:650 +#: library/test.rst:674 msgid "" "Print a warning into :data:`sys.__stderr__`. Format the message as: " "``f\"Warning -- {msg}\"``. If *msg* is made of multiple lines, add " "``\"Warning -- \"`` prefix to each line." msgstr "" -#: library/test.rst:659 +#: library/test.rst:683 msgid "" "Wait until process *pid* completes and check that the process exit code is " "*exitcode*." msgstr "" -#: library/test.rst:662 +#: library/test.rst:686 msgid "" "Raise an :exc:`AssertionError` if the process exit code is not equal to " "*exitcode*." msgstr "" -#: library/test.rst:665 +#: library/test.rst:689 msgid "" "If the process runs longer than *timeout* seconds (:data:`SHORT_TIMEOUT` by " "default), kill the process and raise an :exc:`AssertionError`. The timeout " "feature is not available on Windows." msgstr "" -#: library/test.rst:674 +#: library/test.rst:698 msgid "" "Return the size of the :c:type:`PyObject` whose structure members are " "defined by *fmt*. The returned value includes the size of the Python object " "header and alignment." msgstr "" -#: library/test.rst:680 +#: library/test.rst:704 msgid "" "Return the size of the :c:type:`PyVarObject` whose structure members are " "defined by *fmt*. The returned value includes the size of the Python object " "header and alignment." msgstr "" -#: library/test.rst:686 +#: library/test.rst:710 msgid "" "For testcase *test*, assert that the ``sys.getsizeof`` for *o* plus the GC " "header size equals *size*." msgstr "" -#: library/test.rst:692 +#: library/test.rst:716 msgid "" "A decorator to conditionally mark tests with :func:`unittest." "expectedFailure`. Any use of this decorator should have an associated " "comment identifying the relevant tracker issue." msgstr "" -#: library/test.rst:699 +#: library/test.rst:723 msgid "" "A decorator that skips the decorated test on TLS certification validation " "failures." msgstr "" -#: library/test.rst:704 +#: library/test.rst:728 msgid "" "A decorator for running a function in a different locale, correctly " "resetting it after it has finished. *catstr* is the locale category as a " @@ -734,79 +882,91 @@ msgid "" "sequentially, and the first valid locale will be used." msgstr "" -#: library/test.rst:712 +#: library/test.rst:736 msgid "" "A decorator for running a function in a specific timezone, correctly " "resetting it after it has finished." msgstr "" -#: library/test.rst:718 +#: library/test.rst:742 msgid "" "Decorator for the minimum version when running test on FreeBSD. If the " "FreeBSD version is less than the minimum, the test is skipped." msgstr "" -#: library/test.rst:724 +#: library/test.rst:748 msgid "" "Decorator for the minimum version when running test on Linux. If the Linux " "version is less than the minimum, the test is skipped." msgstr "" -#: library/test.rst:730 +#: library/test.rst:754 msgid "" "Decorator for the minimum version when running test on macOS. If the macOS " "version is less than the minimum, the test is skipped." msgstr "" -#: library/test.rst:736 +#: library/test.rst:760 +msgid "" +"Decorator for skipping tests on the free-threaded build. If the :term:`GIL` " +"is disabled, the test is skipped." +msgstr "" + +#: library/test.rst:766 msgid "Decorator for skipping tests on non-IEEE 754 platforms." msgstr "" -#: library/test.rst:741 +#: library/test.rst:771 msgid "Decorator for skipping tests if :mod:`zlib` doesn't exist." msgstr "" -#: library/test.rst:746 +#: library/test.rst:776 msgid "Decorator for skipping tests if :mod:`gzip` doesn't exist." msgstr "" -#: library/test.rst:751 +#: library/test.rst:781 msgid "Decorator for skipping tests if :mod:`bz2` doesn't exist." msgstr "" -#: library/test.rst:756 +#: library/test.rst:786 msgid "Decorator for skipping tests if :mod:`lzma` doesn't exist." msgstr "" -#: library/test.rst:761 +#: library/test.rst:791 msgid "Decorator for skipping tests if *resource* is not available." msgstr "" -#: library/test.rst:766 +#: library/test.rst:796 msgid "Decorator for only running the test if :data:`HAVE_DOCSTRINGS`." msgstr "" -#: library/test.rst:771 +#: library/test.rst:801 msgid "" "Decorator for only running the test if :ref:`Limited C API ` " "is available." msgstr "" -#: library/test.rst:777 +#: library/test.rst:807 msgid "Decorator for tests only applicable to CPython." msgstr "" -#: library/test.rst:782 +#: library/test.rst:812 msgid "" "Decorator for invoking :func:`check_impl_detail` on *guards*. If that " "returns ``False``, then uses *msg* as the reason for skipping the test." msgstr "" -#: library/test.rst:788 +#: library/test.rst:817 +msgid "" +"Decorator for marking tests as thread-unsafe. This test always runs in one " +"thread even when invoked with ``--parallel-threads``." +msgstr "" + +#: library/test.rst:823 msgid "Decorator to temporarily turn off tracing for the duration of the test." msgstr "" -#: library/test.rst:793 +#: library/test.rst:828 msgid "" "Decorator for tests which involve reference counting. The decorator does " "not run the test if it is not run by CPython. Any trace function is unset " @@ -814,11 +974,11 @@ msgid "" "trace function." msgstr "" -#: library/test.rst:801 +#: library/test.rst:836 msgid "Decorator for bigmem tests." msgstr "" -#: library/test.rst:803 +#: library/test.rst:838 msgid "" "*size* is a requested size for the test (in arbitrary, test-interpreted " "units.) *memuse* is the number of bytes per unit for the test, or a good " @@ -826,7 +986,7 @@ msgid "" "each, could be decorated with ``@bigmemtest(size=_4G, memuse=2)``." msgstr "" -#: library/test.rst:808 +#: library/test.rst:843 msgid "" "The *size* argument is normally passed to the decorated test method as an " "extra argument. If *dry_run* is ``True``, the value passed to the test " @@ -834,11 +994,20 @@ msgid "" "means the test doesn't support dummy runs when ``-M`` is not specified." msgstr "" -#: library/test.rst:816 +#: library/test.rst:851 msgid "Decorator for tests that fill the address space." msgstr "" -#: library/test.rst:821 +#: library/test.rst:856 +msgid "" +"Return ``False`` if there is no evidence the interpreter was compiled with " +"``musl``, otherwise return a version triple, either ``(0, 0, 0)`` if the " +"version is unknown, or the actual version if it is known. Intended for use " +"in ``skip`` decorators. ``emscripten`` and ``wasi`` are assumed to be " +"compiled with ``musl``; otherwise ``platform.libc_ver`` is checked." +msgstr "" + +#: library/test.rst:865 msgid "" "Test for syntax errors in *statement* by attempting to compile *statement*. " "*testcase* is the :mod:`unittest` instance for the test. *errtext* is the " @@ -848,44 +1017,57 @@ msgid "" "of the exception." msgstr "" -#: library/test.rst:831 +#: library/test.rst:875 msgid "Open *url*. If open fails, raises :exc:`TestFailed`." msgstr "" -#: library/test.rst:836 +#: library/test.rst:880 msgid "" "Use this at the end of ``test_main`` whenever sub-processes are started. " "This will help ensure that no extra children (zombies) stick around to hog " "resources and create problems when looking for refleaks." msgstr "" -#: library/test.rst:843 +#: library/test.rst:887 msgid "" "Get an attribute, raising :exc:`unittest.SkipTest` if :exc:`AttributeError` " "is raised." msgstr "" -#: library/test.rst:849 +#: library/test.rst:893 msgid "" "Context manager catching unraisable exception using :func:`sys." "unraisablehook`." msgstr "" -#: library/test.rst:852 +#: library/test.rst:896 msgid "" "Storing the exception value (``cm.unraisable.exc_value``) creates a " "reference cycle. The reference cycle is broken explicitly when the context " "manager exits." msgstr "" -#: library/test.rst:856 +#: library/test.rst:900 msgid "" "Storing the object (``cm.unraisable.object``) can resurrect it if it is set " "to an object which is being finalized. Exiting the context manager clears " "the stored object." msgstr "" -#: library/test.rst:877 +#: library/test.rst:906 +msgid "" +"with support.catch_unraisable_exception() as cm:\n" +" # code creating an \"unraisable exception\"\n" +" ...\n" +"\n" +" # check the unraisable exception: use cm.unraisable\n" +" ...\n" +"\n" +"# cm.unraisable attribute no longer exists at this point\n" +"# (to break a reference cycle)" +msgstr "" + +#: library/test.rst:921 msgid "" "Generic implementation of the :mod:`unittest` ``load_tests`` protocol for " "use in test packages. *pkg_dir* is the root directory of the package; " @@ -894,55 +1076,64 @@ msgid "" "the following::" msgstr "" -#: library/test.rst:892 +#: library/test.rst:927 +msgid "" +"import os\n" +"from test.support import load_package_tests\n" +"\n" +"def load_tests(*args):\n" +" return load_package_tests(os.path.dirname(__file__), *args)" +msgstr "" + +#: library/test.rst:936 msgid "" "Returns the set of attributes, functions or methods of *ref_api* not found " "on *other_api*, except for a defined list of items to be ignored in this " "check specified in *ignore*." msgstr "" -#: library/test.rst:896 +#: library/test.rst:940 msgid "" "By default this skips private attributes beginning with '_' but includes all " "magic methods, i.e. those starting and ending in '__'." msgstr "" -#: library/test.rst:904 +#: library/test.rst:948 msgid "" "Override *object_to_patch.attr_name* with *new_value*. Also add cleanup " "procedure to *test_instance* to restore *object_to_patch* for *attr_name*. " "The *attr_name* should be a valid attribute for *object_to_patch*." msgstr "" -#: library/test.rst:912 +#: library/test.rst:956 msgid "" "Run *code* in subinterpreter. Raise :exc:`unittest.SkipTest` if :mod:" "`tracemalloc` is enabled." msgstr "" -#: library/test.rst:918 +#: library/test.rst:962 msgid "Assert instances of *cls* are deallocated after iterating." msgstr "" -#: library/test.rst:923 +#: library/test.rst:967 msgid "" "Check for the existence of the compiler executables whose names are listed " "in *cmd_names* or all the compiler executables when *cmd_names* is empty and " "return the first missing executable or ``None`` when none is found missing." msgstr "" -#: library/test.rst:931 +#: library/test.rst:975 msgid "" "Assert that the ``__all__`` variable of *module* contains all public names." msgstr "" -#: library/test.rst:933 +#: library/test.rst:977 msgid "" "The module's public names (its API) are detected automatically based on " "whether they match the public name convention and were defined in *module*." msgstr "" -#: library/test.rst:937 +#: library/test.rst:981 msgid "" "The *name_of_module* argument can specify (as a string or tuple thereof) " "what module(s) an API could be defined in order to be detected as a public " @@ -950,36 +1141,56 @@ msgid "" "other modules, possibly a C backend (like ``csv`` and its ``_csv``)." msgstr "" -#: library/test.rst:942 +#: library/test.rst:986 msgid "" "The *extra* argument can be a set of names that wouldn't otherwise be " -"automatically detected as \"public\", like objects without a proper " -"``__module__`` attribute. If provided, it will be added to the automatically " -"detected ones." +"automatically detected as \"public\", like objects without a proper :attr:" +"`~definition.__module__` attribute. If provided, it will be added to the " +"automatically detected ones." msgstr "" -#: library/test.rst:946 +#: library/test.rst:990 msgid "" "The *not_exported* argument can be a set of names that must not be treated " "as part of the public API even though their names indicate otherwise." msgstr "" -#: library/test.rst:1576 +#: library/test.rst:1630 msgid "Example use::" msgstr "" -#: library/test.rst:972 +#: library/test.rst:995 +msgid "" +"import bar\n" +"import foo\n" +"import unittest\n" +"from test import support\n" +"\n" +"class MiscTestCase(unittest.TestCase):\n" +" def test__all__(self):\n" +" support.check__all__(self, foo)\n" +"\n" +"class OtherTestCase(unittest.TestCase):\n" +" def test__all__(self):\n" +" extra = {'BAR_CONST', 'FOO_CONST'}\n" +" not_exported = {'baz'} # Undocumented name.\n" +" # bar imports part of its API from _bar.\n" +" support.check__all__(self, bar, ('bar', '_bar'),\n" +" extra=extra, not_exported=not_exported)" +msgstr "" + +#: library/test.rst:1016 msgid "" "Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if " "there is no available semaphore implementation, or if creating a lock raises " "an :exc:`OSError`." msgstr "" -#: library/test.rst:981 +#: library/test.rst:1025 msgid "Assert that type *tp* cannot be instantiated using *args* and *kwds*." msgstr "" -#: library/test.rst:988 +#: library/test.rst:1032 msgid "" "This function returns a context manager that will change the global :func:" "`sys.set_int_max_str_digits` setting for the duration of the context to " @@ -987,73 +1198,73 @@ msgid "" "digits when converting between an integer and string." msgstr "" -#: library/test.rst:996 +#: library/test.rst:1040 msgid "The :mod:`test.support` module defines the following classes:" msgstr "" -#: library/test.rst:1001 +#: library/test.rst:1045 msgid "" "A context manager used to try to prevent crash dialog popups on tests that " "are expected to crash a subprocess." msgstr "" -#: library/test.rst:1004 +#: library/test.rst:1048 msgid "" "On Windows, it disables Windows Error Reporting dialogs using `SetErrorMode " "`_." msgstr "" -#: library/test.rst:1007 +#: library/test.rst:1051 msgid "" "On UNIX, :func:`resource.setrlimit` is used to set :const:`resource." "RLIMIT_CORE`'s soft limit to 0 to prevent coredump file creation." msgstr "" -#: library/test.rst:1011 +#: library/test.rst:1055 msgid "" "On both platforms, the old value is restored by :meth:`~object.__exit__`." msgstr "" -#: library/test.rst:1016 +#: library/test.rst:1060 msgid "" "Class to save and restore signal handlers registered by the Python signal " "handler." msgstr "" -#: library/test.rst:1021 +#: library/test.rst:1065 msgid "" "Save the signal handlers to a dictionary mapping signal numbers to the " "current signal handler." msgstr "" -#: library/test.rst:1026 +#: library/test.rst:1070 msgid "" "Set the signal numbers from the :meth:`save` dictionary to the saved handler." msgstr "" -#: library/test.rst:1034 +#: library/test.rst:1078 msgid "Try to match a single dict with the supplied arguments." msgstr "" -#: library/test.rst:1039 +#: library/test.rst:1083 msgid "Try to match a single stored value (*dv*) with a supplied value (*v*)." msgstr "" -#: library/test.rst:1043 +#: library/test.rst:1087 msgid ":mod:`test.support.socket_helper` --- Utilities for socket tests" msgstr "" -#: library/test.rst:1049 +#: library/test.rst:1093 msgid "" "The :mod:`test.support.socket_helper` module provides support for socket " "tests." msgstr "" -#: library/test.rst:1056 +#: library/test.rst:1100 msgid "Set to ``True`` if IPv6 is enabled on this host, ``False`` otherwise." msgstr "" -#: library/test.rst:1061 +#: library/test.rst:1105 msgid "" "Returns an unused port that should be suitable for binding. This is " "achieved by creating a temporary socket with the same family and type as the " @@ -1064,7 +1275,7 @@ msgid "" "port is returned." msgstr "" -#: library/test.rst:1070 +#: library/test.rst:1114 msgid "" "Either this method or :func:`bind_port` should be used for any tests where a " "server socket needs to be bound to a particular port for the duration of the " @@ -1077,7 +1288,7 @@ msgid "" "simultaneously, which is a problem for buildbots." msgstr "" -#: library/test.rst:1084 +#: library/test.rst:1128 msgid "" "Bind the socket to a free port and return the port number. Relies on " "ephemeral ports in order to ensure we are using an unbound port. This is " @@ -1090,7 +1301,7 @@ msgid "" "testing multicasting via multiple UDP sockets." msgstr "" -#: library/test.rst:1095 +#: library/test.rst:1139 msgid "" "Additionally, if the :const:`~socket.SO_EXCLUSIVEADDRUSE` socket option is " "available (i.e. on Windows), it will be set on the socket. This will " @@ -1098,58 +1309,58 @@ msgid "" "test." msgstr "" -#: library/test.rst:1103 +#: library/test.rst:1147 msgid "" "Bind a Unix socket, raising :exc:`unittest.SkipTest` if :exc:" "`PermissionError` is raised." msgstr "" -#: library/test.rst:1109 +#: library/test.rst:1153 msgid "" "A decorator for running tests that require a functional ``bind()`` for Unix " "sockets." msgstr "" -#: library/test.rst:1115 +#: library/test.rst:1159 msgid "" "A context manager that raises :exc:`~test.support.ResourceDenied` when " "various issues with the internet connection manifest themselves as " "exceptions." msgstr "" -#: library/test.rst:1121 +#: library/test.rst:1165 msgid "" ":mod:`test.support.script_helper` --- Utilities for the Python execution " "tests" msgstr "" -#: library/test.rst:1127 +#: library/test.rst:1171 msgid "" "The :mod:`test.support.script_helper` module provides support for Python's " "script execution tests." msgstr "" -#: library/test.rst:1132 +#: library/test.rst:1176 msgid "" "Return ``True`` if ``sys.executable interpreter`` requires environment " "variables in order to be able to run at all." msgstr "" -#: library/test.rst:1135 +#: library/test.rst:1179 msgid "" "This is designed to be used with ``@unittest.skipIf()`` to annotate tests " "that need to use an ``assert_python*()`` function to launch an isolated mode " "(``-I``) or no environment mode (``-E``) sub-interpreter process." msgstr "" -#: library/test.rst:1139 +#: library/test.rst:1183 msgid "" "A normal build & test does not run into this situation but it can happen " "when trying to run the standard library test suite from an interpreter that " "doesn't have an obvious home with Python's current home finding logic." msgstr "" -#: library/test.rst:1143 +#: library/test.rst:1187 msgid "" "Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run " "in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are " @@ -1157,84 +1368,84 @@ msgid "" "interpreter can start." msgstr "" -#: library/test.rst:1151 +#: library/test.rst:1195 msgid "" "Set up the environment based on *env_vars* for running the interpreter in a " "subprocess. The values can include ``__isolated``, ``__cleanenv``, " "``__cwd``, and ``TERM``." msgstr "" -#: library/test.rst:1171 library/test.rst:1183 +#: library/test.rst:1215 library/test.rst:1227 msgid "The function no longer strips whitespaces from *stderr*." msgstr "" -#: library/test.rst:1161 +#: library/test.rst:1205 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* succeeds (``rc == 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: library/test.rst:1165 +#: library/test.rst:1209 msgid "" "If the *__cleanenv* keyword-only parameter is set, *env_vars* is used as a " "fresh environment." msgstr "" -#: library/test.rst:1168 +#: library/test.rst:1212 msgid "" "Python is started in isolated mode (command line option ``-I``), except if " "the *__isolated* keyword-only parameter is set to ``False``." msgstr "" -#: library/test.rst:1177 +#: library/test.rst:1221 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* fails (``rc != 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: library/test.rst:1181 +#: library/test.rst:1225 msgid "See :func:`assert_python_ok` for more options." msgstr "" -#: library/test.rst:1189 +#: library/test.rst:1233 msgid "Run a Python subprocess with the given arguments." msgstr "" -#: library/test.rst:1191 +#: library/test.rst:1235 msgid "" "*kw* is extra keyword args to pass to :func:`subprocess.Popen`. Returns a :" "class:`subprocess.Popen` object." msgstr "" -#: library/test.rst:1197 +#: library/test.rst:1241 msgid "" "Run the given :class:`subprocess.Popen` process until completion and return " "stdout." msgstr "" -#: library/test.rst:1203 +#: library/test.rst:1247 msgid "" "Create script containing *source* in path *script_dir* and " "*script_basename*. If *omit_suffix* is ``False``, append ``.py`` to the " "name. Return the full script path." msgstr "" -#: library/test.rst:1210 +#: library/test.rst:1254 msgid "" "Create zip file at *zip_dir* and *zip_basename* with extension ``zip`` which " "contains the files in *script_name*. *name_in_zip* is the archive name. " "Return a tuple containing ``(full path, full path of archive name)``." msgstr "" -#: library/test.rst:1217 +#: library/test.rst:1261 msgid "" "Create a directory named *pkg_dir* containing an ``__init__`` file with " "*init_source* as its contents." msgstr "" -#: library/test.rst:1224 +#: library/test.rst:1268 msgid "" "Create a zip package directory with a path of *zip_dir* and *zip_basename* " "containing an empty ``__init__`` file and a file *script_basename* " @@ -1243,60 +1454,60 @@ msgid "" "path and the archive name for the zip file." msgstr "" -#: library/test.rst:1232 +#: library/test.rst:1276 msgid "" ":mod:`test.support.bytecode_helper` --- Support tools for testing correct " "bytecode generation" msgstr "" -#: library/test.rst:1237 +#: library/test.rst:1281 msgid "" "The :mod:`test.support.bytecode_helper` module provides support for testing " "and inspecting bytecode generation." msgstr "" -#: library/test.rst:1242 +#: library/test.rst:1286 msgid "The module defines the following class:" msgstr "" -#: library/test.rst:1246 +#: library/test.rst:1290 msgid "This class has custom assertion methods for inspecting bytecode." msgstr "" -#: library/test.rst:1250 +#: library/test.rst:1294 msgid "Return the disassembly of *co* as string." msgstr "" -#: library/test.rst:1255 +#: library/test.rst:1299 msgid "" "Return instr if *opname* is found, otherwise throws :exc:`AssertionError`." msgstr "" -#: library/test.rst:1260 +#: library/test.rst:1304 msgid "Throws :exc:`AssertionError` if *opname* is found." msgstr "" -#: library/test.rst:1264 +#: library/test.rst:1308 msgid ":mod:`test.support.threading_helper` --- Utilities for threading tests" msgstr "" -#: library/test.rst:1269 +#: library/test.rst:1313 msgid "" "The :mod:`test.support.threading_helper` module provides support for " "threading tests." msgstr "" -#: library/test.rst:1276 +#: library/test.rst:1320 msgid "" "Join a *thread* within *timeout*. Raise an :exc:`AssertionError` if thread " "is still alive after *timeout* seconds." msgstr "" -#: library/test.rst:1282 +#: library/test.rst:1326 msgid "Decorator to ensure the threads are cleaned up even if the test fails." msgstr "" -#: library/test.rst:1287 +#: library/test.rst:1331 msgid "" "Context manager to start *threads*, which is a sequence of threads. *unlock* " "is a function called after the threads are started, even if an exception was " @@ -1304,79 +1515,100 @@ msgid "" "will attempt to join the started threads upon exit." msgstr "" -#: library/test.rst:1295 +#: library/test.rst:1339 msgid "" "Cleanup up threads not specified in *original_values*. Designed to emit a " "warning if a test leaves running threads in the background." msgstr "" -#: library/test.rst:1301 +#: library/test.rst:1345 msgid "Return current thread count and copy of dangling threads." msgstr "" -#: library/test.rst:1306 +#: library/test.rst:1350 msgid "" "Context manager to wait until all threads created in the ``with`` statement " "exit." msgstr "" -#: library/test.rst:1312 +#: library/test.rst:1356 msgid "" "Context manager catching :class:`threading.Thread` exception using :func:" "`threading.excepthook`." msgstr "" -#: library/test.rst:1315 +#: library/test.rst:1359 msgid "Attributes set when an exception is caught:" msgstr "" -#: library/test.rst:1317 +#: library/test.rst:1361 msgid "``exc_type``" msgstr "" -#: library/test.rst:1318 +#: library/test.rst:1362 msgid "``exc_value``" msgstr "" -#: library/test.rst:1319 +#: library/test.rst:1363 msgid "``exc_traceback``" msgstr "" -#: library/test.rst:1320 +#: library/test.rst:1364 msgid "``thread``" msgstr "" -#: library/test.rst:1322 +#: library/test.rst:1366 msgid "See :func:`threading.excepthook` documentation." msgstr "" -#: library/test.rst:1324 +#: library/test.rst:1368 msgid "These attributes are deleted at the context manager exit." msgstr "" -#: library/test.rst:1344 +#: library/test.rst:1372 +msgid "" +"with threading_helper.catch_threading_exception() as cm:\n" +" # code spawning a thread which raises an exception\n" +" ...\n" +"\n" +" # check the thread exception, use cm attributes:\n" +" # exc_type, exc_value, exc_traceback, thread\n" +" ...\n" +"\n" +"# exc_type, exc_value, exc_traceback, thread attributes of cm no longer\n" +"# exists at this point\n" +"# (to avoid reference cycles)" +msgstr "" + +#: library/test.rst:1389 +msgid "" +"Run the worker function concurrently in multiple threads. Re-raises an " +"exception if any thread raises one, after all threads have finished." +msgstr "" + +#: library/test.rst:1395 msgid ":mod:`test.support.os_helper` --- Utilities for os tests" msgstr "" -#: library/test.rst:1349 +#: library/test.rst:1400 msgid "The :mod:`test.support.os_helper` module provides support for os tests." msgstr "" -#: library/test.rst:1356 +#: library/test.rst:1407 msgid "A non-ASCII character encodable by :func:`os.fsencode`." msgstr "" -#: library/test.rst:1361 +#: library/test.rst:1412 msgid "Set to :func:`os.getcwd`." msgstr "" -#: library/test.rst:1366 +#: library/test.rst:1417 msgid "" "Set to a name that is safe to use as the name of a temporary file. Any " "temporary file that is created should be closed and unlinked (removed)." msgstr "" -#: library/test.rst:1372 +#: library/test.rst:1423 msgid "" "Set to a filename containing the :data:`FS_NONASCII` character, if it " "exists. This guarantees that if the filename exists, it can be encoded and " @@ -1384,25 +1616,25 @@ msgid "" "a non-ASCII filename to be easily skipped on platforms where they can't work." msgstr "" -#: library/test.rst:1380 +#: library/test.rst:1431 msgid "" "Set to a filename (str type) that should not be able to be encoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: library/test.rst:1387 +#: library/test.rst:1438 msgid "" "Set to a filename (bytes type) that should not be able to be decoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: library/test.rst:1394 +#: library/test.rst:1445 msgid "Set to a non-ASCII name for a temporary file." msgstr "" -#: library/test.rst:1399 +#: library/test.rst:1450 msgid "" "Class used to temporarily set or unset environment variables. Instances can " "be used as a context manager and have a complete dictionary interface for " @@ -1411,75 +1643,79 @@ msgid "" "instance will be rolled back." msgstr "" -#: library/test.rst:1405 +#: library/test.rst:1456 msgid "Added dictionary interface." msgstr "" -#: library/test.rst:1411 +#: library/test.rst:1462 msgid "" "Simple :term:`path-like object`. It implements the :meth:`~os.PathLike." "__fspath__` method which just returns the *path* argument. If *path* is an " "exception, it will be raised in :meth:`!__fspath__`." msgstr "" -#: library/test.rst:1419 +#: library/test.rst:1470 msgid "" "Temporarily set the environment variable ``envvar`` to the value of " "``value``." msgstr "" -#: library/test.rst:1425 -msgid "Temporarily unset the environment variable ``envvar``." +#: library/test.rst:1476 +msgid "Temporarily unset one or more environment variables." +msgstr "" + +#: library/test.rst:1478 +msgid "More than one environment variable can be unset." msgstr "" -#: library/test.rst:1430 +#: library/test.rst:1484 msgid "Return ``True`` if the OS supports symbolic links, ``False`` otherwise." msgstr "" -#: library/test.rst:1436 +#: library/test.rst:1490 msgid "Return ``True`` if the OS supports xattr, ``False`` otherwise." msgstr "" -#: library/test.rst:1442 +#: library/test.rst:1496 msgid "" "A context manager that temporarily changes the current working directory to " "*path* and yields the directory." msgstr "" -#: library/test.rst:1445 +#: library/test.rst:1499 msgid "" "If *quiet* is ``False``, the context manager raises an exception on error. " "Otherwise, it issues only a warning and keeps the current working directory " "the same." msgstr "" -#: library/test.rst:1452 +#: library/test.rst:1506 msgid "" "Create an empty file with *filename*. If it already exists, truncate it." msgstr "" -#: library/test.rst:1457 +#: library/test.rst:1511 msgid "Count the number of open file descriptors." msgstr "" -#: library/test.rst:1462 +#: library/test.rst:1516 msgid "Return ``True`` if the file system for *directory* is case-insensitive." msgstr "" -#: library/test.rst:1467 +#: library/test.rst:1521 msgid "" "Create an invalid file descriptor by opening and closing a temporary file, " "and returning its descriptor." msgstr "" -#: library/test.rst:1473 +#: library/test.rst:1527 msgid "" "Call :func:`os.rmdir` on *filename*. On Windows platforms, this is wrapped " "with a wait loop that checks for the existence of the file, which is needed " "due to antivirus programs that can hold files open and prevent deletion." msgstr "" -#: library/test.rst:1481 +#: library/test.rst:1535 msgid "" "Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and :func:`os." "rmdir` to remove a path and its contents. As with :func:`rmdir`, on Windows " @@ -1487,21 +1723,21 @@ msgid "" "the files." msgstr "" -#: library/test.rst:1489 +#: library/test.rst:1543 msgid "A decorator for running tests that require support for symbolic links." msgstr "" -#: library/test.rst:1494 +#: library/test.rst:1548 msgid "A decorator for running tests that require support for xattr." msgstr "" -#: library/test.rst:1499 +#: library/test.rst:1553 msgid "" "A context manager that temporarily creates a new directory and changes the " "current working directory (CWD)." msgstr "" -#: library/test.rst:1502 +#: library/test.rst:1556 msgid "" "The context manager creates a temporary directory in the current directory " "with name *name* before temporarily changing the current working directory. " @@ -1509,20 +1745,20 @@ msgid "" "`tempfile.mkdtemp`." msgstr "" -#: library/test.rst:1507 +#: library/test.rst:1561 msgid "" "If *quiet* is ``False`` and it is not possible to create or change the CWD, " "an error is raised. Otherwise, only a warning is raised and the original " "CWD is used." msgstr "" -#: library/test.rst:1514 +#: library/test.rst:1568 msgid "" "A context manager that creates a temporary directory at *path* and yields " "the directory." msgstr "" -#: library/test.rst:1517 +#: library/test.rst:1571 msgid "" "If *path* is ``None``, the temporary directory is created using :func:" "`tempfile.mkdtemp`. If *quiet* is ``False``, the context manager raises an " @@ -1530,34 +1766,34 @@ msgid "" "created, only a warning is issued." msgstr "" -#: library/test.rst:1525 +#: library/test.rst:1579 msgid "A context manager that temporarily sets the process umask." msgstr "" -#: library/test.rst:1530 +#: library/test.rst:1584 msgid "" "Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows " "platforms, this is wrapped with a wait loop that checks for the existence of " "the file." msgstr "" -#: library/test.rst:1536 +#: library/test.rst:1590 msgid ":mod:`test.support.import_helper` --- Utilities for import tests" msgstr "" -#: library/test.rst:1541 +#: library/test.rst:1595 msgid "" "The :mod:`test.support.import_helper` module provides support for import " "tests." msgstr "" -#: library/test.rst:1548 +#: library/test.rst:1602 msgid "" "Remove the module named *module_name* from ``sys.modules`` and delete any " "byte-compiled files of the module." msgstr "" -#: library/test.rst:1554 +#: library/test.rst:1608 msgid "" "This function imports and returns a fresh copy of the named Python module by " "removing the named module from ``sys.modules`` before doing the import. Note " @@ -1565,46 +1801,56 @@ msgid "" "operation." msgstr "" -#: library/test.rst:1559 +#: library/test.rst:1613 msgid "" "*fresh* is an iterable of additional module names that are also removed from " "the ``sys.modules`` cache before doing the import." msgstr "" -#: library/test.rst:1562 +#: library/test.rst:1616 msgid "" "*blocked* is an iterable of module names that are replaced with ``None`` in " "the module cache during the import to ensure that attempts to import them " "raise :exc:`ImportError`." msgstr "" -#: library/test.rst:1566 +#: library/test.rst:1620 msgid "" "The named module and any modules named in the *fresh* and *blocked* " "parameters are saved before starting the import and then reinserted into " "``sys.modules`` when the fresh import is complete." msgstr "" -#: library/test.rst:1570 +#: library/test.rst:1624 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``." msgstr "" -#: library/test.rst:1573 +#: library/test.rst:1627 msgid "" "This function will raise :exc:`ImportError` if the named module cannot be " "imported." msgstr "" -#: library/test.rst:1590 +#: library/test.rst:1632 +msgid "" +"# Get copies of the warnings module for testing without affecting the\n" +"# version being used by the rest of the test suite. One copy uses the\n" +"# C implementation, the other is forced to use the pure Python fallback\n" +"# implementation\n" +"py_warnings = import_fresh_module('warnings', blocked=['_warnings'])\n" +"c_warnings = import_fresh_module('warnings', fresh=['_warnings'])" +msgstr "" + +#: library/test.rst:1644 msgid "" "This function imports and returns the named module. Unlike a normal import, " "this function raises :exc:`unittest.SkipTest` if the module cannot be " "imported." msgstr "" -#: library/test.rst:1594 +#: library/test.rst:1648 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``. If a module is required on a platform but " @@ -1612,21 +1858,21 @@ msgid "" "which will be compared against :data:`sys.platform`." msgstr "" -#: library/test.rst:1604 +#: library/test.rst:1658 msgid "Return a copy of :data:`sys.modules`." msgstr "" -#: library/test.rst:1609 +#: library/test.rst:1663 msgid "" "Remove modules except for *oldmodules* and ``encodings`` in order to " "preserve internal cache." msgstr "" -#: library/test.rst:1615 +#: library/test.rst:1669 msgid "Delete *name* from ``sys.modules``." msgstr "" -#: library/test.rst:1620 +#: library/test.rst:1674 msgid "" "Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return " "the file system path to the legacy pyc file. The *source* value is the file " @@ -1634,42 +1880,48 @@ msgid "" "3147/488 pyc file must exist." msgstr "" -#: library/test.rst:1628 +#: library/test.rst:1682 msgid "" "A context manager to force import to return a new module reference. This is " "useful for testing module-level behaviors, such as the emission of a :exc:" "`DeprecationWarning` on import. Example usage::" msgstr "" -#: library/test.rst:1638 +#: library/test.rst:1686 +msgid "" +"with CleanImport('foo'):\n" +" importlib.import_module('foo') # New reference." +msgstr "" + +#: library/test.rst:1692 msgid "A context manager to temporarily add directories to :data:`sys.path`." msgstr "" -#: library/test.rst:1640 +#: library/test.rst:1694 msgid "" "This makes a copy of :data:`sys.path`, appends any directories given as " "positional arguments, then reverts :data:`sys.path` to the copied settings " "when the context ends." msgstr "" -#: library/test.rst:1644 +#: library/test.rst:1698 msgid "" "Note that *all* :data:`sys.path` modifications in the body of the context " "manager, including replacement of the object, will be reverted at the end of " "the block." msgstr "" -#: library/test.rst:1650 +#: library/test.rst:1704 msgid ":mod:`test.support.warnings_helper` --- Utilities for warnings tests" msgstr "" -#: library/test.rst:1655 +#: library/test.rst:1709 msgid "" "The :mod:`test.support.warnings_helper` module provides support for warnings " "tests." msgstr "" -#: library/test.rst:1662 +#: library/test.rst:1716 msgid "" "Suppress warnings that are instances of *category*, which must be :exc:" "`Warning` or a subclass. Roughly equivalent to :func:`warnings." @@ -1677,14 +1929,21 @@ msgid "" "category=category) `. For example::" msgstr "" -#: library/test.rst:1677 +#: library/test.rst:1722 +msgid "" +"@warning_helper.ignore_warnings(category=DeprecationWarning)\n" +"def test_suppress_warning():\n" +" # do something" +msgstr "" + +#: library/test.rst:1731 msgid "" "Context manager to check that no :exc:`ResourceWarning` was raised. You " "must remove the object which may emit :exc:`ResourceWarning` before the end " "of the context manager." msgstr "" -#: library/test.rst:1684 +#: library/test.rst:1738 msgid "" "Test for syntax warning in *statement* by attempting to compile *statement*. " "Test also that the :exc:`SyntaxWarning` is emitted only once, and that it " @@ -1696,16 +1955,16 @@ msgid "" "``None``, compares to the offset of the exception." msgstr "" -#: library/test.rst:1698 +#: library/test.rst:1752 msgid "" -"A convenience wrapper for :func:`warnings.catch_warnings()` that makes it " +"A convenience wrapper for :func:`warnings.catch_warnings` that makes it " "easier to test that a warning was correctly raised. It is approximately " "equivalent to calling ``warnings.catch_warnings(record=True)`` with :meth:" "`warnings.simplefilter` set to ``always`` and with the option to " "automatically validate the results that are recorded." msgstr "" -#: library/test.rst:1704 +#: library/test.rst:1758 msgid "" "``check_warnings`` accepts 2-tuples of the form ``(\"message regexp\", " "WarningCategory)`` as positional arguments. If one or more *filters* are " @@ -1717,15 +1976,19 @@ msgid "" "*quiet* to ``True``." msgstr "" -#: library/test.rst:1713 +#: library/test.rst:1767 msgid "If no arguments are specified, it defaults to::" msgstr "" -#: library/test.rst:1717 +#: library/test.rst:1769 +msgid "check_warnings((\"\", Warning), quiet=True)" +msgstr "" + +#: library/test.rst:1771 msgid "In this case all warnings are caught and no errors are raised." msgstr "" -#: library/test.rst:1719 +#: library/test.rst:1773 msgid "" "On entry to the context manager, a :class:`WarningRecorder` instance is " "returned. The underlying warnings list from :func:`~warnings.catch_warnings` " @@ -1737,39 +2000,60 @@ msgid "" "return ``None``." msgstr "" -#: library/test.rst:1728 +#: library/test.rst:1782 msgid "" "The recorder object also has a :meth:`reset` method, which clears the " "warnings list." msgstr "" -#: library/test.rst:1731 +#: library/test.rst:1785 msgid "The context manager is designed to be used like this::" msgstr "" -#: library/test.rst:1738 +#: library/test.rst:1787 +msgid "" +"with check_warnings((\"assertion is always true\", SyntaxWarning),\n" +" (\"\", UserWarning)):\n" +" exec('assert(False, \"Hey!\")')\n" +" warnings.warn(UserWarning(\"Hide me!\"))" +msgstr "" + +#: library/test.rst:1792 msgid "" "In this case if either warning was not raised, or some other warning was " "raised, :func:`check_warnings` would raise an error." msgstr "" -#: library/test.rst:1741 +#: library/test.rst:1795 msgid "" "When a test needs to look more deeply into the warnings, rather than just " "checking whether or not they occurred, code like this can be used::" msgstr "" -#: library/test.rst:1755 +#: library/test.rst:1798 +msgid "" +"with check_warnings(quiet=True) as w:\n" +" warnings.warn(\"foo\")\n" +" assert str(w.args[0]) == \"foo\"\n" +" warnings.warn(\"bar\")\n" +" assert str(w.args[0]) == \"bar\"\n" +" assert str(w.warnings[0].args[0]) == \"foo\"\n" +" assert str(w.warnings[1].args[0]) == \"bar\"\n" +" w.reset()\n" +" assert len(w.warnings) == 0" +msgstr "" + +#: library/test.rst:1809 msgid "" "Here all warnings will be caught, and the test code tests the captured " "warnings directly." msgstr "" -#: library/test.rst:1758 +#: library/test.rst:1812 msgid "New optional arguments *filters* and *quiet*." msgstr "" -#: library/test.rst:1764 +#: library/test.rst:1818 msgid "" "Class used to record warnings for unit tests. See documentation of :func:" "`check_warnings` above for more details." diff --git a/library/text.po b/library/text.po index 698476e4..4302cd39 100644 --- a/library/text.po +++ b/library/text.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/library/textwrap.po b/library/textwrap.po index 73ce906c..b7680097 100644 --- a/library/textwrap.po +++ b/library/textwrap.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-07-06 08:46+0300\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/textwrap.rst:2 -msgid ":mod:`textwrap` --- Text wrapping and filling" -msgstr "" +msgid ":mod:`!textwrap` --- Text wrapping and filling" +msgstr ":mod:`!textwrap` --- Περιτύλιγμα και γέμισμα κειμένου" #: library/textwrap.rst:10 msgid "**Source code:** :source:`Lib/textwrap.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/textwrap.py`" #: library/textwrap.rst:14 msgid "" @@ -32,6 +33,11 @@ msgid "" "should be good enough; otherwise, you should use an instance of :class:" "`TextWrapper` for efficiency." msgstr "" +"Το module :mod:`textwrap` παρέχει μερικές συναρτήσεις ευκολίας, καθώς και " +"την :class:`TextWrapper`, την κλάση που κάνει όλη τη δουλειά. Αν απλά " +"περιτυλίγετε ή γεμίζετε ένα ή δύο κείμενα, οι συναρτήσεις ευκολίας θα είναι " +"αρκετές· διαφορετικά, θα πρέπει να χρησιμοποιήσετε ένα στιγμιότυπο της :" +"class:`TextWrapper` για αποδοτικότητα." #: library/textwrap.rst:27 msgid "" @@ -39,34 +45,51 @@ msgid "" "*width* characters long. Returns a list of output lines, without final " "newlines." msgstr "" +"Περιτυλίγει την ενιαία παράγραφο στο *text* (μία συμβολοσειρά) έτσι ώστε " +"κάθε γραμμή να έχει το πολύ *width* αριθμό χαρακτήρες. Επιστρέφει μια λίστα " +"με τις γραμμές εξόδου, χωρίς τελικούς χαρακτήρες νέας γραμμής." #: library/textwrap.rst:31 msgid "" "Optional keyword arguments correspond to the instance attributes of :class:" "`TextWrapper`, documented below." msgstr "" +"Προαιρετικά ορίσματα λέξεων-κλειδιών αντιστοιχούν στις ιδιότητες " +"στιγμιότυπου της :class:`TextWrapper`, που τεκμηριώνονται παρακάτω." #: library/textwrap.rst:34 msgid "" "See the :meth:`TextWrapper.wrap` method for additional details on how :func:" "`wrap` behaves." msgstr "" +"Δείτε τη μέθοδο :meth:`TextWrapper.wrap` για πρόσθετες λεπτομέρειες σχετικά " +"με το πώς συμπεριφέρεται η :func:`wrap`." #: library/textwrap.rst:45 msgid "" "Wraps the single paragraph in *text*, and returns a single string containing " "the wrapped paragraph. :func:`fill` is shorthand for ::" msgstr "" +"Γεμίζει την ενιαία παράγραφο στο *text* και επιστρέφει μια μοναδική " +"συμβολοσειρά που περιέχει την γεμισμένη παράγραφο. Η :func:`fill` είναι " +"συντομογραφία για ::" + +#: library/textwrap.rst:48 +msgid "\"\\n\".join(wrap(text, ...))" +msgstr "\"\\n\".join(wrap(text, ...))" #: library/textwrap.rst:50 msgid "" "In particular, :func:`fill` accepts exactly the same keyword arguments as :" "func:`wrap`." msgstr "" +"Συγκεκριμένα, η :func:`fill` δέχεται ακριβώς τα ίδια ορίσματα λέξεων-" +"κλειδιών με την :func:`wrap`." #: library/textwrap.rst:58 msgid "Collapse and truncate the given *text* to fit in the given *width*." msgstr "" +"Συμπτύξτε και περικόψτε το δοθέν *text* ώστε να χωράει στο δοθέν *width*." #: library/textwrap.rst:60 msgid "" @@ -75,6 +98,26 @@ msgid "" "Otherwise, enough words are dropped from the end so that the remaining words " "plus the *placeholder* fit within *width*::" msgstr "" +"Αρχικά, ο χώρος στο *text* συμπτύσσεται (όλος ο χώρος αντικαθίσταται με μονά " +"κενά). Αν το αποτέλεσμα χωράει στο *width*, επιστρέφεται. Διαφορετικά, " +"αρκετές λέξεις απορρίπτονται από το τέλος ώστε οι υπόλοιπες λέξεις συν το " +"*placeholder* να χωρούν μέσα στο *width*::" + +#: library/textwrap.rst:65 +msgid "" +">>> textwrap.shorten(\"Hello world!\", width=12)\n" +"'Hello world!'\n" +">>> textwrap.shorten(\"Hello world!\", width=11)\n" +"'Hello [...]'\n" +">>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n" +"'Hello...'" +msgstr "" +">>> textwrap.shorten(\"Hello world!\", width=12)\n" +"'Hello world!'\n" +">>> textwrap.shorten(\"Hello world!\", width=11)\n" +"'Hello [...]'\n" +">>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n" +"'Hello...'" #: library/textwrap.rst:72 msgid "" @@ -84,16 +127,25 @@ msgid "" "so changing the value of :attr:`.tabsize`, :attr:`.expand_tabs`, :attr:`." "drop_whitespace`, and :attr:`.replace_whitespace` will have no effect." msgstr "" +"Προαιρετικά ορίσματα λέξεων-κλειδιών αντιστοιχούν στις ιδιότητες " +"στιγμιότυπου της :class:`TextWrapper`, που τεκμηριώνονται παρακάτω. " +"Σημειώστε ότι ο χώρος συμπτύσσεται πριν το κείμενο περαστεί στη συνάρτηση :" +"meth:`fill` της :class:`TextWrapper`, έτσι ώστε η αλλαγή της τιμής των :attr:" +"`.tabsize`, :attr:`.expand_tabs`, :attr:`.drop_whitespace` και :attr:`." +"replace_whitespace` να μην έχει καμία επίδραση." #: library/textwrap.rst:82 msgid "Remove any common leading whitespace from every line in *text*." -msgstr "" +msgstr "Αφαιρεί οποιοδήποτε κοινό αρχικό κενό από κάθε γραμμή στο *text*." #: library/textwrap.rst:84 msgid "" "This can be used to make triple-quoted strings line up with the left edge of " "the display, while still presenting them in the source code in indented form." msgstr "" +"Αυτό μπορεί να χρησιμοποιηθεί για να ευθυγραμμίσετε τις τριπλές παραθέσεις " +"με την αριστερή άκρη της οθόνης, ενώ παρουσιάζονται στον πηγαίο κώδικα σε " +"μορφή εσοχής." #: library/textwrap.rst:87 msgid "" @@ -101,30 +153,68 @@ msgid "" "equal: the lines ``\" hello\"`` and ``\"\\thello\"`` are considered to have " "no common leading whitespace." msgstr "" +"Σημειώστε ότι τα tab και τα κενά θεωρούνται και τα δύο ως κενό, αλλά δεν " +"είναι ίσα: οι γραμμές ``\" hello\"`` και ``\"\\thello\"`` θεωρούνται ότι " +"δεν έχουν κοινό αρχικό κενό." #: library/textwrap.rst:91 msgid "" "Lines containing only whitespace are ignored in the input and normalized to " "a single newline character in the output." msgstr "" +"Οι γραμμές που περιέχουν μόνο κενό αγνοούνται στην είσοδο και " +"κανονικοποιούνται σε έναν μόνο χαρακτήρα νέας γραμμής στην έξοδο." #: library/textwrap.rst:115 msgid "For example::" -msgstr "" +msgstr "Για παράδειγμα::" + +#: library/textwrap.rst:96 +msgid "" +"def test():\n" +" # end first line with \\ to avoid the empty line!\n" +" s = '''\\\n" +" hello\n" +" world\n" +" '''\n" +" print(repr(s)) # prints ' hello\\n world\\n '\n" +" print(repr(dedent(s))) # prints 'hello\\n world\\n'" +msgstr "" +"def test():\n" +" # end first line with \\ to avoid the empty line!\n" +" s = '''\\\n" +" hello\n" +" world\n" +" '''\n" +" print(repr(s)) # prints ' hello\\n world\\n '\n" +" print(repr(dedent(s))) # prints 'hello\\n world\\n'" #: library/textwrap.rst:108 msgid "Add *prefix* to the beginning of selected lines in *text*." -msgstr "" +msgstr "Προσθέτει το *prefix* στην αρχή των επιλεγμένων γραμμών στο *text*." #: library/textwrap.rst:110 msgid "Lines are separated by calling ``text.splitlines(True)``." -msgstr "" +msgstr "Οι γραμμές διαχωρίζονται καλώντας ``text.splitlines(True)``." #: library/textwrap.rst:112 msgid "" "By default, *prefix* is added to all lines that do not consist solely of " "whitespace (including any line endings)." msgstr "" +"Από προεπιλογή, το *prefix* προστίθεται σε όλες τις γραμμές που δεν " +"αποτελούνται μόνο από κενό (συμπεριλαμβανομένων των χαρακτήρων τέλους " +"γραμμής)." + +#: library/textwrap.rst:117 +msgid "" +">>> s = 'hello\\n\\n \\nworld'\n" +">>> indent(s, ' ')\n" +"' hello\\n\\n \\n world'" +msgstr "" +">>> s = 'hello\\n\\n \\nworld'\n" +">>> indent(s, ' ')\n" +"' hello\\n\\n \\n world'" #: library/textwrap.rst:121 msgid "" @@ -132,6 +222,23 @@ msgid "" "indented. For example, it is easy to add *prefix* to even empty and " "whitespace-only lines::" msgstr "" +"Το προαιρετικό όρισμα *predicate* μπορεί να χρησιμοποιηθεί για έλεγχο του " +"ποια γραμμή θα έχει εσοχή. Για παράδειγμα, είναι εύκολο να προσθέσετε το " +"*prefix* ακόμη και σε κενές γραμμές και γραμμές που περιέχουν μόνο κενό::" + +#: library/textwrap.rst:125 +msgid "" +">>> print(indent(s, '+ ', lambda line: True))\n" +"+ hello\n" +"+\n" +"+\n" +"+ world" +msgstr "" +">>> print(indent(s, '+ ', lambda line: True))\n" +"+ hello\n" +"+\n" +"+\n" +"+ world" #: library/textwrap.rst:134 msgid "" @@ -141,6 +248,12 @@ msgid "" "`wrap` and/or :func:`fill`, it may be more efficient to create your own :" "class:`TextWrapper` object." msgstr "" +"Οι :func:`wrap`, :func:`fill` και :func:`shorten` λειτουργούν δημιουργώντας " +"ένα στιγμιότυπο της :class:`TextWrapper` και καλώντας μια μόνο μέθοδο σε " +"αυτό. Αυτό το στιγμιότυπο δεν επαναχρησιμοποιείται, οπότε για εφαρμογές που " +"επεξεργάζονται πολλά κείμενα χρησιμοποιώντας :func:`wrap` και/ή :func:" +"`fill`, μπορεί να είναι πιο αποδοτικό να δημιουργήσετε το δικό σας " +"αντικείμενο :class:`TextWrapper`." #: library/textwrap.rst:140 msgid "" @@ -148,6 +261,9 @@ msgid "" "hyphenated words; only then will long words be broken if necessary, unless :" "attr:`TextWrapper.break_long_words` is set to false." msgstr "" +"Το κείμενο προτιμάται να περιτυλίγεται σε κενά και αμέσως μετά τις παύλες σε " +"λέξεις με παύλες· μόνο τότε θα σπάσουν οι μακριές λέξεις αν είναι αναγκαίο, " +"εκτός εάν η :attr:`TextWrapper.break_long_words` οριστεί σε false." #: library/textwrap.rst:146 msgid "" @@ -155,23 +271,43 @@ msgid "" "arguments. Each keyword argument corresponds to an instance attribute, so " "for example ::" msgstr "" +"Ο κατασκευαστής της :class:`TextWrapper` δέχεται αρκετά προαιρετικά ορίσματα " +"λέξεων-κλειδιών. Κάθε όρισμα λέξης-κλειδιού αντιστοιχεί σε μια ιδιότητα " +"στιγμιότυπου, οπότε για παράδειγμα ::" + +#: library/textwrap.rst:150 +msgid "wrapper = TextWrapper(initial_indent=\"* \")" +msgstr "wrapper = TextWrapper(initial_indent=\"* \")" #: library/textwrap.rst:152 msgid "is the same as ::" +msgstr "είναι το ίδιο με ::" + +#: library/textwrap.rst:154 +msgid "" +"wrapper = TextWrapper()\n" +"wrapper.initial_indent = \"* \"" msgstr "" +"wrapper = TextWrapper()\n" +"wrapper.initial_indent = \"* \"" #: library/textwrap.rst:157 msgid "" -"You can re-use the same :class:`TextWrapper` object many times, and you can " +"You can reuse the same :class:`TextWrapper` object many times, and you can " "change any of its options through direct assignment to instance attributes " "between uses." msgstr "" +"Μπορείτε να επαναχρησιμοποιήσετε το ίδιο αντικείμενο :class:`TextWrapper` " +"πολλές φορές, και μπορείτε να αλλάξετε οποιαδήποτε από τις επιλογές του μέσω " +"άμεσης ανάθεσης σε ιδιότητες στιγμιότυπου μεταξύ των χρήσεων." #: library/textwrap.rst:161 msgid "" "The :class:`TextWrapper` instance attributes (and keyword arguments to the " "constructor) are as follows:" msgstr "" +"Οι ιδιότητες στιγμιότυπου της :class:`TextWrapper` (και τα ορίσματα λέξεων-" +"κλειδιών στον κατασκευαστή) είναι οι εξής:" #: library/textwrap.rst:167 msgid "" @@ -180,12 +316,19 @@ msgid "" "`TextWrapper` guarantees that no output line will be longer than :attr:" "`width` characters." msgstr "" +"(προεπιλογή: ``70``) Το μέγιστο μήκος των περιτυλιγμένων γραμμών. Εφόσον δεν " +"υπάρχουν μεμονωμένες λέξεις στο εισαγόμενο κείμενο μεγαλύτερες από :attr:" +"`width`, η :class:`TextWrapper` εγγυάται ότι καμία γραμμή εξόδου δεν θα " +"είναι μεγαλύτερη από :attr:`width` χαρακτήρες." #: library/textwrap.rst:175 msgid "" "(default: ``True``) If true, then all tab characters in *text* will be " "expanded to spaces using the :meth:`~str.expandtabs` method of *text*." msgstr "" +"(προεπιλογή: ``True``) Αν είναι true, τότε όλοι οι χαρακτήρες tab στο *text* " +"θα επεκταθούν σε κενά χρησιμοποιώντας τη μέθοδο :meth:`~str.expandtabs` του " +"*text*." #: library/textwrap.rst:181 msgid "" @@ -193,6 +336,9 @@ msgid "" "*text* will be expanded to zero or more spaces, depending on the current " "column and the given tab size." msgstr "" +"(προεπιλογή: ``8``) Αν :attr:`expand_tabs` είναι true, τότε όλοι οι " +"χαρακτήρες tab στο *text* θα επεκταθούν σε μηδέν ή περισσότερα κενά, ανάλογα " +"με την τρέχουσα στήλη και το δεδομένο μέγεθος tab." #: library/textwrap.rst:190 msgid "" @@ -201,6 +347,11 @@ msgid "" "space. The whitespace characters replaced are as follows: tab, newline, " "vertical tab, formfeed, and carriage return (``'\\t\\n\\v\\f\\r'``)." msgstr "" +"(προεπιλογή: ``True``) Αν είναι true, μετά την επέκταση των tab αλλά πριν το " +"περιτύλιγμα, η μέθοδος :meth:`wrap` θα αντικαταστήσει κάθε χαρακτήρα κενών " +"με ένα μόνο κενό. Οι χαρακτήρες κενών που αντικαθίστανται είναι οι εξής: " +"tab, νέα γραμμή, κάθετος, τροφοδότης μορφής και carriage return " +"(``'\\t\\n\\v\\f\\r'``)." #: library/textwrap.rst:198 msgid "" @@ -208,6 +359,9 @@ msgid "" "tab character will be replaced by a single space, which is *not* the same as " "tab expansion." msgstr "" +"(προεπιλογή: ``True``) Αν το :attr:`expand_tabs` είναι false και το :attr:" +"`replace_whitespace` είναι true, κάθε χαρακτήρας tab θα αντικατασταθεί από " +"ένα μόνο κενό, το οποίο *δεν είναι* το ίδιο με την επέκταση των tab." #: library/textwrap.rst:204 msgid "" @@ -216,6 +370,11 @@ msgid "" "paragraphs (using :meth:`str.splitlines` or similar) which are wrapped " "separately." msgstr "" +"Αν το :attr:`replace_whitespace` είναι false, οι νέες γραμμές μπορεί να " +"εμφανιστούν στη μέση μιας γραμμής και να προκαλέσουν παράξενα αποτελέσματα. " +"Για αυτόν τον λόγο, το κείμενο θα πρέπει να διαχωρίζεται σε παραγράφους " +"(χρησιμοποιώντας :meth:`str.splitlines` ή παρόμοια) οι οποίες περιτυλίγονται " +"ξεχωριστά." #: library/textwrap.rst:212 msgid "" @@ -225,6 +384,11 @@ msgid "" "follows it. If whitespace being dropped takes up an entire line, the whole " "line is dropped." msgstr "" +"(προεπιλογή: ``True``) Αν είναι true, το κενό στην αρχή και στο τέλος κάθε " +"γραμμής (μετά το περιτύλιγμα αλλά πριν την εσοχή) αφαιρείται. Το κενό στην " +"αρχή της παραγράφου, ωστόσο, δεν αφαιρείται αν ακολουθείται από μη κενό. Αν " +"το κενό που αφαιρείται καταλαμβάνει ολόκληρη τη γραμμή, ολόκληρη η γραμμή " +"αφαιρείται." #: library/textwrap.rst:221 msgid "" @@ -232,6 +396,9 @@ msgid "" "output. Counts towards the length of the first line. The empty string is " "not indented." msgstr "" +"(προεπιλογή: ``''``) Συμβολοσειρά που θα προστεθεί στην αρχή της πρώτης " +"γραμμής της περιτυλιγμένης εξόδου. Μετράει προς το μήκος της πρώτης γραμμής. " +"Η κενή συμβολοσειρά δεν έχει εσοχή." #: library/textwrap.rst:228 msgid "" @@ -239,6 +406,9 @@ msgid "" "output except the first. Counts towards the length of each line except the " "first." msgstr "" +"(προεπιλογή: ``''``) Συμβολοσειρά που θα προστεθεί στην αρχή όλων των " +"γραμμών της περιτυλιγμένης εξόδου εκτός από την πρώτη. Μετράει προς το μήκος " +"κάθε γραμμής εκτός από την πρώτη." #: library/textwrap.rst:235 msgid "" @@ -251,14 +421,31 @@ msgid "" "followed by a space. One problem with this algorithm is that it is unable " "to detect the difference between \"Dr.\" in ::" msgstr "" +"(προεπιλογή: ``False``) Αν είναι true, η :class:`TextWrapper` προσπαθεί να " +"ανιχνεύσει τα τέλη προτάσεων και να διασφαλίσει ότι οι προτάσεις " +"διαχωρίζονται πάντα από ακριβώς δύο κενά. Αυτό είναι γενικά επιθυμητό για " +"κείμενα σε γραμματοσειρά μονού διαστήματος. Ωστόσο, ο αλγόριθμος ανίχνευσης " +"προτάσεων δεν είναι τέλειος: υποθέτει ότι ένα τέλος πρότασης αποτελείται από " +"ένα πεζό γράμμα ακολουθούμενο από ένα από τα ``'.'``, ``'!'`` ή ``'?'``, " +"πιθανώς ακολουθούμενο από ένα από τα ``'\"'`` ή ``\"'\"``, ακολουθούμενο από " +"ένα κενό. Ένα πρόβλημα με αυτόν τον αλγόριθμο είναι ότι δεν μπορεί να " +"ανιχνεύσει τη διαφορά μεταξύ \"Dr.\" στο ::" + +#: library/textwrap.rst:244 +msgid "[...] Dr. Frankenstein's monster [...]" +msgstr "[...] Dr. Frankenstein's monster [...]" #: library/textwrap.rst:246 msgid "and \"Spot.\" in ::" -msgstr "" +msgstr "and \"Spot.\" in ::" + +#: library/textwrap.rst:248 +msgid "[...] See Spot. See Spot run [...]" +msgstr "[...] See Spot. See Spot run [...]" #: library/textwrap.rst:250 msgid ":attr:`fix_sentence_endings` is false by default." -msgstr "" +msgstr ":attr:`fix_sentence_endings` είναι false από προεπιλογή." #: library/textwrap.rst:252 msgid "" @@ -267,6 +454,10 @@ msgid "" "after a period to separate sentences on the same line, it is specific to " "English-language texts." msgstr "" +"Δεδομένου ότι ο αλγόριθμος ανίχνευσης προτάσεων βασίζεται στο ``string." +"lowercase`` για τον ορισμό του \"πεζού γράμματος\", και μια σύμβαση χρήσης " +"δύο κενών μετά από μια τελεία για τον διαχωρισμό των προτάσεων στην ίδια " +"γραμμή, είναι συγκεκριμένος για κείμενα στα αγγλικά." #: library/textwrap.rst:260 msgid "" @@ -276,6 +467,12 @@ msgid "" "than :attr:`width`. (Long words will be put on a line by themselves, in " "order to minimize the amount by which :attr:`width` is exceeded.)" msgstr "" +"(προεπιλογή: ``True``) Αν είναι true, τότε οι λέξεις μεγαλύτερες από :attr:" +"`width` θα σπάσουν για να διασφαλιστεί ότι καμία γραμμή δεν θα είναι " +"μεγαλύτερη από :attr:`width`. Αν είναι false, οι μακριές λέξεις δεν θα " +"σπάσουν, και μερικές γραμμές μπορεί να είναι μεγαλύτερες από :attr:`width`. " +"(Οι μακριές λέξεις θα τοποθετηθούν σε μια γραμμή από μόνες τους, για να " +"ελαχιστοποιηθεί το ποσό κατά το οποίο ξεπερνάται το :attr:`width`)." #: library/textwrap.rst:269 msgid "" @@ -286,24 +483,38 @@ msgid "" "want truly insecable words. Default behaviour in previous versions was to " "always allow breaking hyphenated words." msgstr "" +"(προεπιλογή: ``True``) Αν είναι true, το περιτύλιγμα θα συμβαίνει " +"προτιμότερα σε κενά και αμέσως μετά τις παύλες σε σύνθετες λέξεις, όπως " +"είναι συνηθισμένο στα αγγλικά. Αν είναι false, μόνο τα κενά θα θεωρούνται ως " +"πιθανές καλές θέσεις για διακοπές γραμμής, αλλά πρέπει να ορίσετε το :attr:" +"`break_long_words` σε false αν θέλετε πραγματικά αδιάσπαστες λέξεις. Η " +"προεπιλεγμένη συμπεριφορά στις προηγούμενες εκδόσεις ήταν να επιτρέπεται " +"πάντα η διάσπαση των λέξεων με παύλες." #: library/textwrap.rst:279 msgid "" "(default: ``None``) If not ``None``, then the output will contain at most " "*max_lines* lines, with *placeholder* appearing at the end of the output." msgstr "" +"(προεπιλογή: ``None``) Αν δεν είναι ``None``, τότε η έξοδος θα περιέχει το " +"πολύ *max_lines* γραμμές, με το *placeholder* να εμφανίζεται στο τέλος της " +"εξόδου." #: library/textwrap.rst:289 msgid "" "(default: ``' [...]'``) String that will appear at the end of the output " "text if it has been truncated." msgstr "" +"(προεπιλογή: ``' [...]'``) Συμβολοσειρά που θα εμφανίζεται στο τέλος του " +"κειμένου εξόδου αν έχει περικοπεί." #: library/textwrap.rst:295 msgid "" ":class:`TextWrapper` also provides some public methods, analogous to the " "module-level convenience functions:" msgstr "" +"Η :class:`TextWrapper` παρέχει επίσης μερικές δημόσιες μεθόδους, παρόμοιες " +"με τις συναρτήσεις ευκολίας σε επίπεδο module:" #: library/textwrap.rst:300 msgid "" @@ -313,17 +524,25 @@ msgid "" "lines, without final newlines. If the wrapped output has no content, the " "returned list is empty." msgstr "" +"Περιτυλίγει την ενιαία παράγραφο στο *text* (μία συμβολοσειρά) έτσι ώστε " +"κάθε γραμμή να έχει το πολύ :attr:`width` χαρακτήρες. Όλες οι επιλογές " +"περιτυλίγματος λαμβάνονται από τις ιδιότητες στιγμιότυπου της :class:" +"`TextWrapper` κλάσης. Επιστρέφει μια λίστα με τις γραμμές εξόδου, χωρίς " +"τελικούς χαρακτήρες νέας γραμμής. Αν η περιτυλιγμένη έξοδος δεν έχει " +"περιεχόμενο, η επιστρεφόμενη λίστα είναι κενή." #: library/textwrap.rst:309 msgid "" "Wraps the single paragraph in *text*, and returns a single string containing " "the wrapped paragraph." msgstr "" +"Γεμίζει την ενιαία παράγραφο στο *text* και επιστρέφει μια μοναδική " +"συμβολοσειρά που περιέχει την γεμισμένη παράγραφο." #: library/textwrap.rst:285 msgid "..." -msgstr "" +msgstr "..." #: library/textwrap.rst:285 msgid "placeholder" -msgstr "" +msgstr "placeholder" diff --git a/library/threading.po b/library/threading.po index 205af140..fff1b706 100644 --- a/library/threading.po +++ b/library/threading.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/threading.rst:2 -msgid ":mod:`threading` --- Thread-based parallelism" +msgid ":mod:`!threading` --- Thread-based parallelism" msgstr "" #: library/threading.rst:7 @@ -30,38 +31,103 @@ msgid "" "level :mod:`_thread` module." msgstr "" -#: library/threading.rst:14 -msgid "This module used to be optional, it is now always available." +#: library/threading.rst:293 includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" + +#: includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." +msgstr "" + +#: library/threading.rst:17 +msgid "Introduction" msgstr "" #: library/threading.rst:19 msgid "" +"The :mod:`!threading` module provides a way to run multiple `threads " +"`_ (smaller units of a " +"process) concurrently within a single process. It allows for the creation " +"and management of threads, making it possible to execute tasks in parallel, " +"sharing memory space. Threads are particularly useful when tasks are I/O " +"bound, such as file operations or making network requests, where much of the " +"time is spent waiting for external resources." +msgstr "" + +#: library/threading.rst:27 +msgid "" +"A typical use case for :mod:`!threading` includes managing a pool of worker " +"threads that can process multiple tasks concurrently. Here's a basic " +"example of creating and starting threads using :class:`~threading.Thread`::" +msgstr "" + +#: library/threading.rst:31 +msgid "" +"import threading\n" +"import time\n" +"\n" +"def crawl(link, delay=3):\n" +" print(f\"crawl started for {link}\")\n" +" time.sleep(delay) # Blocking I/O (simulating a network request)\n" +" print(f\"crawl ended for {link}\")\n" +"\n" +"links = [\n" +" \"https://python.org\",\n" +" \"https://docs.python.org\",\n" +" \"https://peps.python.org\",\n" +"]\n" +"\n" +"# Start threads for each link\n" +"threads = []\n" +"for link in links:\n" +" # Using `args` to pass positional arguments and `kwargs` for keyword " +"arguments\n" +" t = threading.Thread(target=crawl, args=(link,), kwargs={\"delay\": 2})\n" +" threads.append(t)\n" +"\n" +"# Start each thread\n" +"for t in threads:\n" +" t.start()\n" +"\n" +"# Wait for all threads to finish\n" +"for t in threads:\n" +" t.join()" +msgstr "" + +#: library/threading.rst:60 +msgid "This module used to be optional, it is now always available." +msgstr "" + +#: library/threading.rst:65 +msgid "" ":class:`concurrent.futures.ThreadPoolExecutor` offers a higher level " "interface to push tasks to a background thread without blocking execution of " "the calling thread, while still being able to retrieve their results when " "needed." msgstr "" -#: library/threading.rst:23 +#: library/threading.rst:69 msgid "" ":mod:`queue` provides a thread-safe interface for exchanging data between " "running threads." msgstr "" -#: library/threading.rst:26 +#: library/threading.rst:72 msgid "" ":mod:`asyncio` offers an alternative approach to achieving task level " "concurrency without requiring the use of multiple operating system threads." msgstr "" -#: library/threading.rst:31 +#: library/threading.rst:77 msgid "" "In the Python 2.x series, this module contained ``camelCase`` names for some " "methods and functions. These are deprecated as of Python 3.10, but they are " "still supported for compatibility with Python 2.5 and lower." msgstr "" -#: library/threading.rst:38 +#: library/threading.rst:84 msgid "" "In CPython, due to the :term:`Global Interpreter Lock `, only one thread can execute Python code at once (even though certain " @@ -72,111 +138,126 @@ msgid "" "appropriate model if you want to run multiple I/O-bound tasks simultaneously." msgstr "" -#: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#: library/threading.rst:95 +msgid "GIL and performance considerations" msgstr "" -#: includes/wasm-notavail.rst:5 +#: library/threading.rst:97 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"Unlike the :mod:`multiprocessing` module, which uses separate processes to " +"bypass the :term:`global interpreter lock` (GIL), the threading module " +"operates within a single process, meaning that all threads share the same " +"memory space. However, the GIL limits the performance gains of threading " +"when it comes to CPU-bound tasks, as only one thread can execute Python " +"bytecode at a time. Despite this, threads remain a useful tool for achieving " +"concurrency in many scenarios." +msgstr "" + +#: library/threading.rst:105 +msgid "" +"As of Python 3.13, :term:`free-threaded ` builds can disable " +"the GIL, enabling true parallel execution of threads, but this feature is " +"not available by default (see :pep:`703`)." +msgstr "" + +#: library/threading.rst:112 +msgid "Reference" msgstr "" -#: library/threading.rst:50 +#: library/threading.rst:114 msgid "This module defines the following functions:" msgstr "" -#: library/threading.rst:55 +#: library/threading.rst:119 msgid "" "Return the number of :class:`Thread` objects currently alive. The returned " "count is equal to the length of the list returned by :func:`.enumerate`." msgstr "" -#: library/threading.rst:58 +#: library/threading.rst:122 msgid "The function ``activeCount`` is a deprecated alias for this function." msgstr "" -#: library/threading.rst:63 +#: library/threading.rst:127 msgid "" "Return the current :class:`Thread` object, corresponding to the caller's " "thread of control. If the caller's thread of control was not created " -"through the :mod:`threading` module, a dummy thread object with limited " +"through the :mod:`!threading` module, a dummy thread object with limited " "functionality is returned." msgstr "" -#: library/threading.rst:68 +#: library/threading.rst:132 msgid "The function ``currentThread`` is a deprecated alias for this function." msgstr "" -#: library/threading.rst:73 +#: library/threading.rst:137 msgid "Handle uncaught exception raised by :func:`Thread.run`." msgstr "" -#: library/threading.rst:75 +#: library/threading.rst:139 msgid "The *args* argument has the following attributes:" msgstr "" -#: library/threading.rst:77 +#: library/threading.rst:141 msgid "*exc_type*: Exception type." msgstr "" -#: library/threading.rst:78 +#: library/threading.rst:142 msgid "*exc_value*: Exception value, can be ``None``." msgstr "" -#: library/threading.rst:79 +#: library/threading.rst:143 msgid "*exc_traceback*: Exception traceback, can be ``None``." msgstr "" -#: library/threading.rst:80 +#: library/threading.rst:144 msgid "*thread*: Thread which raised the exception, can be ``None``." msgstr "" -#: library/threading.rst:82 +#: library/threading.rst:146 msgid "" "If *exc_type* is :exc:`SystemExit`, the exception is silently ignored. " "Otherwise, the exception is printed out on :data:`sys.stderr`." msgstr "" -#: library/threading.rst:85 +#: library/threading.rst:149 msgid "" "If this function raises an exception, :func:`sys.excepthook` is called to " "handle it." msgstr "" -#: library/threading.rst:88 +#: library/threading.rst:152 msgid "" ":func:`threading.excepthook` can be overridden to control how uncaught " "exceptions raised by :func:`Thread.run` are handled." msgstr "" -#: library/threading.rst:91 +#: library/threading.rst:155 msgid "" "Storing *exc_value* using a custom hook can create a reference cycle. It " "should be cleared explicitly to break the reference cycle when the exception " "is no longer needed." msgstr "" -#: library/threading.rst:95 +#: library/threading.rst:159 msgid "" "Storing *thread* using a custom hook can resurrect it if it is set to an " "object which is being finalized. Avoid storing *thread* after the custom " "hook completes to avoid resurrecting objects." msgstr "" -#: library/threading.rst:100 +#: library/threading.rst:164 msgid ":func:`sys.excepthook` handles uncaught exceptions." msgstr "" -#: library/threading.rst:106 +#: library/threading.rst:170 msgid "" "Holds the original value of :func:`threading.excepthook`. It is saved so " "that the original value can be restored in case they happen to get replaced " "with broken or alternative objects." msgstr "" -#: library/threading.rst:114 +#: library/threading.rst:178 msgid "" "Return the 'thread identifier' of the current thread. This is a nonzero " "integer. Its value has no direct meaning; it is intended as a magic cookie " @@ -185,7 +266,7 @@ msgid "" "created." msgstr "" -#: library/threading.rst:125 +#: library/threading.rst:189 msgid "" "Return the native integral Thread ID of the current thread assigned by the " "kernel. This is a non-negative integer. Its value may be used to uniquely " @@ -193,13 +274,11 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: library/threading.rst:465 -msgid "" -":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD." +#: library/threading.rst:198 +msgid "Added support for GNU/kFreeBSD." msgstr "" -#: library/threading.rst:137 +#: library/threading.rst:204 msgid "" "Return a list of all :class:`Thread` objects currently active. The list " "includes daemonic threads and dummy thread objects created by :func:" @@ -208,59 +287,59 @@ msgid "" "even when terminated." msgstr "" -#: library/threading.rst:146 +#: library/threading.rst:213 msgid "" "Return the main :class:`Thread` object. In normal conditions, the main " "thread is the thread from which the Python interpreter was started." msgstr "" -#: library/threading.rst:157 +#: library/threading.rst:224 msgid "" -"Set a trace function for all threads started from the :mod:`threading` " +"Set a trace function for all threads started from the :mod:`!threading` " "module. The *func* will be passed to :func:`sys.settrace` for each thread, " "before its :meth:`~Thread.run` method is called." msgstr "" -#: library/threading.rst:163 +#: library/threading.rst:230 msgid "" -"Set a trace function for all threads started from the :mod:`threading` " +"Set a trace function for all threads started from the :mod:`!threading` " "module and all Python threads that are currently executing." msgstr "" -#: library/threading.rst:166 +#: library/threading.rst:233 msgid "" "The *func* will be passed to :func:`sys.settrace` for each thread, before " "its :meth:`~Thread.run` method is called." msgstr "" -#: library/threading.rst:177 +#: library/threading.rst:244 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: library/threading.rst:186 +#: library/threading.rst:253 msgid "" -"Set a profile function for all threads started from the :mod:`threading` " +"Set a profile function for all threads started from the :mod:`!threading` " "module. The *func* will be passed to :func:`sys.setprofile` for each " "thread, before its :meth:`~Thread.run` method is called." msgstr "" -#: library/threading.rst:192 +#: library/threading.rst:259 msgid "" -"Set a profile function for all threads started from the :mod:`threading` " +"Set a profile function for all threads started from the :mod:`!threading` " "module and all Python threads that are currently executing." msgstr "" -#: library/threading.rst:195 +#: library/threading.rst:262 msgid "" "The *func* will be passed to :func:`sys.setprofile` for each thread, before " "its :meth:`~Thread.run` method is called." msgstr "" -#: library/threading.rst:204 +#: library/threading.rst:271 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: library/threading.rst:211 +#: library/threading.rst:278 msgid "" "Return the thread stack size used when creating new threads. The optional " "*size* argument specifies the stack size to be used for subsequently created " @@ -279,19 +358,15 @@ msgid "" "information)." msgstr "" -#: library/threading.rst:226 -msgid ":ref:`Availability `: Windows, pthreads." -msgstr "" - -#: library/threading.rst:228 +#: library/threading.rst:295 msgid "Unix platforms with POSIX threads support." msgstr "" -#: library/threading.rst:231 +#: library/threading.rst:298 msgid "This module also defines the following constant:" msgstr "" -#: library/threading.rst:235 +#: library/threading.rst:302 msgid "" "The maximum value allowed for the *timeout* parameter of blocking functions " "(:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.). " @@ -299,13 +374,13 @@ msgid "" "`OverflowError`." msgstr "" -#: library/threading.rst:243 +#: library/threading.rst:310 msgid "" "This module defines a number of classes, which are detailed in the sections " "below." msgstr "" -#: library/threading.rst:246 +#: library/threading.rst:313 msgid "" "The design of this module is loosely based on Java's threading model. " "However, where Java makes locks and condition variables basic behavior of " @@ -316,40 +391,222 @@ msgid "" "Thread class, when implemented, are mapped to module-level functions." msgstr "" -#: library/threading.rst:254 +#: library/threading.rst:321 msgid "All of the methods described below are executed atomically." msgstr "" -#: library/threading.rst:258 -msgid "Thread-Local Data" +#: library/threading.rst:325 +msgid "Thread-local data" msgstr "" -#: library/threading.rst:260 +#: library/threading.rst:327 msgid "" -"Thread-local data is data whose values are thread specific. To manage " -"thread-local data, just create an instance of :class:`local` (or a subclass) " -"and store attributes on it::" +"Thread-local data is data whose values are thread specific. If you have data " +"that you want to be local to a thread, create a :class:`local` object and " +"use its attributes::" msgstr "" -#: library/threading.rst:267 -msgid "The instance's values will be different for separate threads." +#: library/threading.rst:331 +msgid "" +">>> mydata = local()\n" +">>> mydata.number = 42\n" +">>> mydata.number\n" +"42" msgstr "" -#: library/threading.rst:272 -msgid "A class that represents thread-local data." +#: library/threading.rst:336 +msgid "You can also access the :class:`local`-object's dictionary::" +msgstr "" + +#: library/threading.rst:338 +msgid "" +">>> mydata.__dict__\n" +"{'number': 42}\n" +">>> mydata.__dict__.setdefault('widgets', [])\n" +"[]\n" +">>> mydata.widgets\n" +"[]" +msgstr "" + +#: library/threading.rst:345 +msgid "If we access the data in a different thread::" +msgstr "" + +#: library/threading.rst:347 +msgid "" +">>> log = []\n" +">>> def f():\n" +"... items = sorted(mydata.__dict__.items())\n" +"... log.append(items)\n" +"... mydata.number = 11\n" +"... log.append(mydata.number)\n" +"\n" +">>> import threading\n" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()\n" +">>> log\n" +"[[], 11]" +msgstr "" + +#: library/threading.rst:361 +msgid "" +"we get different data. Furthermore, changes made in the other thread don't " +"affect data seen in this thread::" +msgstr "" + +#: library/threading.rst:364 +msgid "" +">>> mydata.number\n" +"42" +msgstr "" + +#: library/threading.rst:367 +msgid "" +"Of course, values you get from a :class:`local` object, including their :" +"attr:`~object.__dict__` attribute, are for whatever thread was current at " +"the time the attribute was read. For that reason, you generally don't want " +"to save these values across threads, as they apply only to the thread they " +"came from." +msgstr "" + +#: library/threading.rst:373 +msgid "" +"You can create custom :class:`local` objects by subclassing the :class:" +"`local` class::" +msgstr "" + +#: library/threading.rst:376 +msgid "" +">>> class MyLocal(local):\n" +"... number = 2\n" +"... def __init__(self, /, **kw):\n" +"... self.__dict__.update(kw)\n" +"... def squared(self):\n" +"... return self.number ** 2" +msgstr "" + +#: library/threading.rst:383 +msgid "" +"This can be useful to support default values, methods and initialization. " +"Note that if you define an :py:meth:`~object.__init__` method, it will be " +"called each time the :class:`local` object is used in a separate thread. " +"This is necessary to initialize each thread's dictionary." +msgstr "" + +#: library/threading.rst:389 +msgid "Now if we create a :class:`local` object::" +msgstr "" + +#: library/threading.rst:391 +msgid ">>> mydata = MyLocal(color='red')" msgstr "" -#: library/threading.rst:274 +#: library/threading.rst:393 +msgid "we have a default number::" +msgstr "" + +#: library/threading.rst:395 msgid "" -"For more details and extensive examples, see the documentation string of " -"the :mod:`!_threading_local` module: :source:`Lib/_threading_local.py`." +">>> mydata.number\n" +"2" msgstr "" -#: library/threading.rst:281 -msgid "Thread Objects" +#: library/threading.rst:398 +msgid "an initial color::" msgstr "" -#: library/threading.rst:283 +#: library/threading.rst:400 +msgid "" +">>> mydata.color\n" +"'red'\n" +">>> del mydata.color" +msgstr "" + +#: library/threading.rst:404 +msgid "And a method that operates on the data::" +msgstr "" + +#: library/threading.rst:406 +msgid "" +">>> mydata.squared()\n" +"4" +msgstr "" + +#: library/threading.rst:409 +msgid "As before, we can access the data in a separate thread::" +msgstr "" + +#: library/threading.rst:411 +msgid "" +">>> log = []\n" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()\n" +">>> log\n" +"[[('color', 'red')], 11]" +msgstr "" + +#: library/threading.rst:418 +msgid "without affecting this thread's data::" +msgstr "" + +#: library/threading.rst:420 +msgid "" +">>> mydata.number\n" +"2\n" +">>> mydata.color\n" +"Traceback (most recent call last):\n" +"...\n" +"AttributeError: 'MyLocal' object has no attribute 'color'" +msgstr "" + +#: library/threading.rst:427 +msgid "" +"Note that subclasses can define :term:`__slots__`, but they are not thread " +"local. They are shared across threads::" +msgstr "" + +#: library/threading.rst:430 +msgid "" +">>> class MyLocal(local):\n" +"... __slots__ = 'number'\n" +"\n" +">>> mydata = MyLocal()\n" +">>> mydata.number = 42\n" +">>> mydata.color = 'red'" +msgstr "" + +#: library/threading.rst:437 +msgid "So, the separate thread::" +msgstr "" + +#: library/threading.rst:439 +msgid "" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()" +msgstr "" + +#: library/threading.rst:443 +msgid "affects what we see::" +msgstr "" + +#: library/threading.rst:445 +msgid "" +">>> mydata.number\n" +"11" +msgstr "" + +#: library/threading.rst:451 +msgid "A class that represents thread-local data." +msgstr "" + +#: library/threading.rst:457 +msgid "Thread objects" +msgstr "" + +#: library/threading.rst:459 msgid "" "The :class:`Thread` class represents an activity that is run in a separate " "thread of control. There are two ways to specify the activity: by passing a " @@ -359,14 +616,14 @@ msgid "" "``__init__()`` and :meth:`~Thread.run` methods of this class." msgstr "" -#: library/threading.rst:290 +#: library/threading.rst:466 msgid "" "Once a thread object is created, its activity must be started by calling the " "thread's :meth:`~Thread.start` method. This invokes the :meth:`~Thread.run` " "method in a separate thread of control." msgstr "" -#: library/threading.rst:294 +#: library/threading.rst:470 msgid "" "Once the thread's activity is started, the thread is considered 'alive'. It " "stops being alive when its :meth:`~Thread.run` method terminates -- either " @@ -374,27 +631,27 @@ msgid "" "is_alive` method tests whether the thread is alive." msgstr "" -#: library/threading.rst:299 +#: library/threading.rst:475 msgid "" "Other threads can call a thread's :meth:`~Thread.join` method. This blocks " "the calling thread until the thread whose :meth:`~Thread.join` method is " "called is terminated." msgstr "" -#: library/threading.rst:303 +#: library/threading.rst:479 msgid "" "A thread has a name. The name can be passed to the constructor, and read or " "changed through the :attr:`~Thread.name` attribute." msgstr "" -#: library/threading.rst:306 +#: library/threading.rst:482 msgid "" "If the :meth:`~Thread.run` method raises an exception, :func:`threading." "excepthook` is called to handle it. By default, :func:`threading.excepthook` " "ignores silently :exc:`SystemExit`." msgstr "" -#: library/threading.rst:310 +#: library/threading.rst:486 msgid "" "A thread can be flagged as a \"daemon thread\". The significance of this " "flag is that the entire Python program exits when only daemon threads are " @@ -403,7 +660,7 @@ msgid "" "constructor argument." msgstr "" -#: library/threading.rst:317 +#: library/threading.rst:493 msgid "" "Daemon threads are abruptly stopped at shutdown. Their resources (such as " "open files, database transactions, etc.) may not be released properly. If " @@ -411,13 +668,13 @@ msgid "" "suitable signalling mechanism such as an :class:`Event`." msgstr "" -#: library/threading.rst:322 +#: library/threading.rst:498 msgid "" "There is a \"main thread\" object; this corresponds to the initial thread of " "control in the Python program. It is not a daemon thread." msgstr "" -#: library/threading.rst:325 +#: library/threading.rst:501 msgid "" "There is the possibility that \"dummy thread objects\" are created. These " "are thread objects corresponding to \"alien threads\", which are threads of " @@ -428,25 +685,25 @@ msgid "" "threads." msgstr "" -#: library/threading.rst:336 +#: library/threading.rst:512 msgid "" "This constructor should always be called with keyword arguments. Arguments " "are:" msgstr "" -#: library/threading.rst:339 +#: library/threading.rst:515 msgid "" "*group* should be ``None``; reserved for future extension when a :class:`!" "ThreadGroup` class is implemented." msgstr "" -#: library/threading.rst:342 +#: library/threading.rst:518 msgid "" "*target* is the callable object to be invoked by the :meth:`run` method. " "Defaults to ``None``, meaning nothing is called." msgstr "" -#: library/threading.rst:345 +#: library/threading.rst:521 msgid "" "*name* is the thread name. By default, a unique name is constructed of the " "form \"Thread-*N*\" where *N* is a small decimal number, or \"Thread-*N* " @@ -454,62 +711,90 @@ msgid "" "is specified." msgstr "" -#: library/threading.rst:350 +#: library/threading.rst:526 msgid "" "*args* is a list or tuple of arguments for the target invocation. Defaults " "to ``()``." msgstr "" -#: library/threading.rst:352 +#: library/threading.rst:528 msgid "" "*kwargs* is a dictionary of keyword arguments for the target invocation. " "Defaults to ``{}``." msgstr "" -#: library/threading.rst:355 +#: library/threading.rst:531 msgid "" "If not ``None``, *daemon* explicitly sets whether the thread is daemonic. If " "``None`` (the default), the daemonic property is inherited from the current " "thread." msgstr "" -#: library/threading.rst:359 +#: library/threading.rst:535 +msgid "" +"*context* is the :class:`~contextvars.Context` value to use when starting " +"the thread. The default value is ``None`` which indicates that the :data:" +"`sys.flags.thread_inherit_context` flag controls the behaviour. If the flag " +"is true, threads will start with a copy of the context of the caller of :" +"meth:`~Thread.start`. If false, they will start with an empty context. To " +"explicitly start with an empty context, pass a new instance of :class:" +"`~contextvars.Context()`. To explicitly start with a copy of the current " +"context, pass the value from :func:`~contextvars.copy_context`. The flag " +"defaults true on free-threaded builds and false otherwise." +msgstr "" + +#: library/threading.rst:545 msgid "" "If the subclass overrides the constructor, it must make sure to invoke the " "base class constructor (``Thread.__init__()``) before doing anything else to " "the thread." msgstr "" -#: library/threading.rst:363 +#: library/threading.rst:549 msgid "Added the *daemon* parameter." msgstr "" -#: library/threading.rst:366 +#: library/threading.rst:552 msgid "Use the *target* name if *name* argument is omitted." msgstr "" -#: library/threading.rst:371 +#: library/threading.rst:555 +msgid "Added the *context* parameter." +msgstr "" + +#: library/threading.rst:560 msgid "Start the thread's activity." msgstr "" -#: library/threading.rst:373 +#: library/threading.rst:562 msgid "" "It must be called at most once per thread object. It arranges for the " "object's :meth:`~Thread.run` method to be invoked in a separate thread of " "control." msgstr "" -#: library/threading.rst:377 +#: library/threading.rst:566 msgid "" "This method will raise a :exc:`RuntimeError` if called more than once on the " "same thread object." msgstr "" -#: library/threading.rst:382 +#: library/threading.rst:569 +msgid "" +"If supported, set the operating system thread name to :attr:`threading." +"Thread.name`. The name can be truncated depending on the operating system " +"thread name limits." +msgstr "" + +#: library/threading.rst:573 +msgid "Set the operating system thread name." +msgstr "" + +#: library/threading.rst:578 msgid "Method representing the thread's activity." msgstr "" -#: library/threading.rst:384 +#: library/threading.rst:580 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the " @@ -517,17 +802,28 @@ msgid "" "the *args* and *kwargs* arguments, respectively." msgstr "" -#: library/threading.rst:389 +#: library/threading.rst:585 msgid "" "Using list or tuple as the *args* argument which passed to the :class:" "`Thread` could achieve the same effect." msgstr "" -#: library/threading.rst:392 +#: library/threading.rst:588 msgid "Example::" msgstr "" -#: library/threading.rst:406 +#: library/threading.rst:590 +msgid "" +">>> from threading import Thread\n" +">>> t = Thread(target=print, args=[1])\n" +">>> t.run()\n" +"1\n" +">>> t = Thread(target=print, args=(1,))\n" +">>> t.run()\n" +"1" +msgstr "" + +#: library/threading.rst:602 msgid "" "Wait until the thread terminates. This blocks the calling thread until the " "thread whose :meth:`~Thread.join` method is called terminates -- either " @@ -535,27 +831,27 @@ msgid "" "occurs." msgstr "" -#: library/threading.rst:411 +#: library/threading.rst:607 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " -"floating point number specifying a timeout for the operation in seconds (or " +"floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof). As :meth:`~Thread.join` always returns ``None``, you " "must call :meth:`~Thread.is_alive` after :meth:`~Thread.join` to decide " "whether a timeout happened -- if the thread is still alive, the :meth:" "`~Thread.join` call timed out." msgstr "" -#: library/threading.rst:418 +#: library/threading.rst:614 msgid "" "When the *timeout* argument is not present or ``None``, the operation will " "block until the thread terminates." msgstr "" -#: library/threading.rst:421 +#: library/threading.rst:617 msgid "A thread can be joined many times." msgstr "" -#: library/threading.rst:423 +#: library/threading.rst:619 msgid "" ":meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made to " "join the current thread as that would cause a deadlock. It is also an error " @@ -563,20 +859,46 @@ msgid "" "do so raise the same exception." msgstr "" -#: library/threading.rst:430 +#: library/threading.rst:624 +msgid "" +"If an attempt is made to join a running daemonic thread in late stages of :" +"term:`Python finalization ` :meth:`!join` raises a :" +"exc:`PythonFinalizationError`." +msgstr "" + +#: library/threading.rst:630 +msgid "May raise :exc:`PythonFinalizationError`." +msgstr "" + +#: library/threading.rst:634 msgid "" "A string used for identification purposes only. It has no semantics. " "Multiple threads may be given the same name. The initial name is set by the " "constructor." msgstr "" -#: library/threading.rst:437 +#: library/threading.rst:638 +msgid "" +"On some platforms, the thread name is set at the operating system level when " +"the thread starts, so that it is visible in task managers. This name may be " +"truncated to fit in a system-specific limit (for example, 15 bytes on Linux " +"or 63 bytes on macOS)." +msgstr "" + +#: library/threading.rst:643 +msgid "" +"Changes to *name* are only reflected at the OS level when the currently " +"running thread is renamed. (Setting the *name* attribute of a different " +"thread only updates the Python Thread object.)" +msgstr "" + +#: library/threading.rst:650 msgid "" "Deprecated getter/setter API for :attr:`~Thread.name`; use it directly as a " "property instead." msgstr "" -#: library/threading.rst:444 +#: library/threading.rst:657 msgid "" "The 'thread identifier' of this thread or ``None`` if the thread has not " "been started. This is a nonzero integer. See the :func:`get_ident` " @@ -585,7 +907,7 @@ msgid "" "thread has exited." msgstr "" -#: library/threading.rst:452 +#: library/threading.rst:665 msgid "" "The Thread ID (``TID``) of this thread, as assigned by the OS (kernel). This " "is a non-negative integer, or ``None`` if the thread has not been started. " @@ -594,25 +916,25 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: library/threading.rst:461 +#: library/threading.rst:674 msgid "" "Similar to Process IDs, Thread IDs are only valid (guaranteed unique system-" "wide) from the time the thread is created until the thread has been " "terminated." msgstr "" -#: library/threading.rst:471 +#: library/threading.rst:684 msgid "Return whether the thread is alive." msgstr "" -#: library/threading.rst:473 +#: library/threading.rst:686 msgid "" "This method returns ``True`` just before the :meth:`~Thread.run` method " "starts until just after the :meth:`~Thread.run` method terminates. The " "module function :func:`.enumerate` returns a list of all alive threads." msgstr "" -#: library/threading.rst:479 +#: library/threading.rst:692 msgid "" "A boolean value indicating whether this thread is a daemon thread (``True``) " "or not (``False``). This must be set before :meth:`~Thread.start` is " @@ -622,22 +944,22 @@ msgid "" "`~Thread.daemon` = ``False``." msgstr "" -#: library/threading.rst:486 +#: library/threading.rst:699 msgid "" "The entire Python program exits when no alive non-daemon threads are left." msgstr "" -#: library/threading.rst:491 +#: library/threading.rst:704 msgid "" "Deprecated getter/setter API for :attr:`~Thread.daemon`; use it directly as " "a property instead." msgstr "" -#: library/threading.rst:500 -msgid "Lock Objects" +#: library/threading.rst:713 +msgid "Lock objects" msgstr "" -#: library/threading.rst:502 +#: library/threading.rst:715 msgid "" "A primitive lock is a synchronization primitive that is not owned by a " "particular thread when locked. In Python, it is currently the lowest level " @@ -645,7 +967,7 @@ msgid "" "`_thread` extension module." msgstr "" -#: library/threading.rst:507 +#: library/threading.rst:720 msgid "" "A primitive lock is in one of two states, \"locked\" or \"unlocked\". It is " "created in the unlocked state. It has two basic methods, :meth:`~Lock." @@ -659,11 +981,11 @@ msgid "" "an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" -#: library/threading.rst:518 +#: library/threading.rst:731 msgid "Locks also support the :ref:`context management protocol `." msgstr "" -#: library/threading.rst:520 +#: library/threading.rst:733 msgid "" "When more than one thread is blocked in :meth:`~Lock.acquire` waiting for " "the state to turn to unlocked, only one thread proceeds when a :meth:`~Lock." @@ -671,42 +993,41 @@ msgid "" "proceeds is not defined, and may vary across implementations." msgstr "" -#: library/threading.rst:525 +#: library/threading.rst:738 msgid "All methods are executed atomically." msgstr "" -#: library/threading.rst:530 +#: library/threading.rst:743 msgid "" "The class implementing primitive lock objects. Once a thread has acquired a " "lock, subsequent attempts to acquire it block, until it is released; any " "thread may release it." msgstr "" -#: library/threading.rst:534 +#: library/threading.rst:747 msgid "" -"Note that ``Lock`` is actually a factory function which returns an instance " -"of the most efficient version of the concrete Lock class that is supported " -"by the platform." +"``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory function " +"which returned an instance of the underlying private lock type." msgstr "" -#: library/threading.rst:621 +#: library/threading.rst:849 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: library/threading.rst:543 +#: library/threading.rst:757 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." msgstr "" -#: library/threading.rst:546 +#: library/threading.rst:760 msgid "" "When invoked with the *blocking* argument set to ``False``, do not block. If " "a call with *blocking* set to ``True`` would block, return ``False`` " "immediately; otherwise, set the lock to locked and return ``True``." msgstr "" -#: library/threading.rst:550 +#: library/threading.rst:764 msgid "" "When invoked with the floating-point *timeout* argument set to a positive " "value, block for at most the number of seconds specified by *timeout* and as " @@ -715,52 +1036,56 @@ msgid "" "*blocking* is ``False``." msgstr "" -#: library/threading.rst:556 +#: library/threading.rst:770 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not (for example if the *timeout* expired)." msgstr "" -#: library/threading.rst:643 library/threading.rst:890 +#: library/threading.rst:887 library/threading.rst:1147 msgid "The *timeout* parameter is new." msgstr "" -#: library/threading.rst:562 +#: library/threading.rst:776 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." msgstr "" -#: library/threading.rst:569 +#: library/threading.rst:780 +msgid "Lock acquisition can now be interrupted by signals on Windows." +msgstr "" + +#: library/threading.rst:786 msgid "" "Release a lock. This can be called from any thread, not only the thread " "which has acquired the lock." msgstr "" -#: library/threading.rst:572 +#: library/threading.rst:789 msgid "" "When the lock is locked, reset it to unlocked, and return. If any other " "threads are blocked waiting for the lock to become unlocked, allow exactly " "one of them to proceed." msgstr "" -#: library/threading.rst:576 +#: library/threading.rst:793 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "" -#: library/threading.rst:659 +#: library/threading.rst:903 msgid "There is no return value." msgstr "" -#: library/threading.rst:582 +#: library/threading.rst:799 msgid "Return ``True`` if the lock is acquired." msgstr "" -#: library/threading.rst:589 -msgid "RLock Objects" +#: library/threading.rst:806 +msgid "RLock objects" msgstr "" -#: library/threading.rst:591 +#: library/threading.rst:808 msgid "" "A reentrant lock is a synchronization primitive that may be acquired " "multiple times by the same thread. Internally, it uses the concepts of " @@ -769,24 +1094,38 @@ msgid "" "lock; in the unlocked state, no thread owns it." msgstr "" -#: library/threading.rst:597 +#: library/threading.rst:814 msgid "" -"To lock the lock, a thread calls its :meth:`~RLock.acquire` method; this " -"returns once the thread owns the lock. To unlock the lock, a thread calls " -"its :meth:`~Lock.release` method. :meth:`~Lock.acquire`/:meth:`~Lock." -"release` call pairs may be nested; only the final :meth:`~Lock.release` " -"(the :meth:`~Lock.release` of the outermost pair) resets the lock to " -"unlocked and allows another thread blocked in :meth:`~Lock.acquire` to " -"proceed." +"Threads call a lock's :meth:`~RLock.acquire` method to lock it, and its :" +"meth:`~Lock.release` method to unlock it." msgstr "" -#: library/threading.rst:604 +#: library/threading.rst:819 msgid "" -"Reentrant locks also support the :ref:`context management protocol `." +"Reentrant locks support the :ref:`context management protocol `, " +"so it is recommended to use :keyword:`with` instead of manually calling :" +"meth:`~RLock.acquire` and :meth:`~RLock.release` to handle acquiring and " +"releasing the lock for a block of code." msgstr "" -#: library/threading.rst:609 +#: library/threading.rst:824 +msgid "" +"RLock's :meth:`~RLock.acquire`/:meth:`~RLock.release` call pairs may be " +"nested, unlike Lock's :meth:`~Lock.acquire`/:meth:`~Lock.release`. Only the " +"final :meth:`~RLock.release` (the :meth:`~Lock.release` of the outermost " +"pair) resets the lock to an unlocked state and allows another thread blocked " +"in :meth:`~RLock.acquire` to proceed." +msgstr "" + +#: library/threading.rst:830 +msgid "" +":meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each " +"acquire must have a release in the thread that has acquired the lock. " +"Failing to call release as many times the lock has been acquired can lead to " +"deadlock." +msgstr "" + +#: library/threading.rst:837 msgid "" "This class implements reentrant lock objects. A reentrant lock must be " "released by the thread that acquired it. Once a thread has acquired a " @@ -794,47 +1133,75 @@ msgid "" "thread must release it once for each time it has acquired it." msgstr "" -#: library/threading.rst:614 +#: library/threading.rst:842 msgid "" "Note that ``RLock`` is actually a factory function which returns an instance " "of the most efficient version of the concrete RLock class that is supported " "by the platform." msgstr "" -#: library/threading.rst:623 +#: library/threading.rst:853 +msgid ":ref:`Using RLock as a context manager `" +msgstr "" + +#: library/threading.rst:854 msgid "" -"When invoked without arguments: if this thread already owns the lock, " -"increment the recursion level by one, and return immediately. Otherwise, if " -"another thread owns the lock, block until the lock is unlocked. Once the " -"lock is unlocked (not owned by any thread), then grab ownership, set the " -"recursion level to one, and return. If more than one thread is blocked " -"waiting until the lock is unlocked, only one at a time will be able to grab " -"ownership of the lock. There is no return value in this case." +"Recommended over manual :meth:`!acquire` and :meth:`release` calls whenever " +"practical." msgstr "" -#: library/threading.rst:631 +#: library/threading.rst:858 msgid "" -"When invoked with the *blocking* argument set to ``True``, do the same thing " -"as when called without arguments, and return ``True``." +"When invoked with the *blocking* argument set to ``True`` (the default):" msgstr "" -#: library/threading.rst:634 +#: library/threading.rst:872 +msgid "If no thread owns the lock, acquire the lock and return immediately." +msgstr "" + +#: library/threading.rst:862 msgid "" -"When invoked with the *blocking* argument set to ``False``, do not block. " -"If a call without an argument would block, return ``False`` immediately; " -"otherwise, do the same thing as when called without arguments, and return " -"``True``." +"If another thread owns the lock, block until we are able to acquire lock, or " +"*timeout*, if set to a positive float value." msgstr "" -#: library/threading.rst:638 +#: library/threading.rst:865 msgid "" -"When invoked with the floating-point *timeout* argument set to a positive " -"value, block for at most the number of seconds specified by *timeout* and as " -"long as the lock cannot be acquired. Return ``True`` if the lock has been " -"acquired, ``False`` if the timeout has elapsed." +"If the same thread owns the lock, acquire the lock again, and return " +"immediately. This is the difference between :class:`Lock` and :class:`!" +"RLock`; :class:`Lock` handles this case the same as the previous, blocking " +"until the lock can be acquired." +msgstr "" + +#: library/threading.rst:870 +msgid "When invoked with the *blocking* argument set to ``False``:" +msgstr "" + +#: library/threading.rst:874 +msgid "If another thread owns the lock, return immediately." +msgstr "" + +#: library/threading.rst:876 +msgid "" +"If the same thread owns the lock, acquire the lock again and return " +"immediately." msgstr "" -#: library/threading.rst:649 +#: library/threading.rst:879 +msgid "" +"In all cases, if the thread was able to acquire the lock, return ``True``. " +"If the thread was unable to acquire the lock (i.e. if not blocking or the " +"timeout was reached) return ``False``." +msgstr "" + +#: library/threading.rst:883 +msgid "" +"If called multiple times, failing to call :meth:`~RLock.release` as many " +"times may lead to deadlock. Consider using :class:`!RLock` as a context " +"manager rather than calling acquire/release directly." +msgstr "" + +#: library/threading.rst:893 msgid "" "Release a lock, decrementing the recursion level. If after the decrement it " "is zero, reset the lock to unlocked (not owned by any thread), and if any " @@ -843,17 +1210,22 @@ msgid "" "is still nonzero, the lock remains locked and owned by the calling thread." msgstr "" -#: library/threading.rst:655 +#: library/threading.rst:899 msgid "" "Only call this method when the calling thread owns the lock. A :exc:" -"`RuntimeError` is raised if this method is called when the lock is unlocked." +"`RuntimeError` is raised if this method is called when the lock is not " +"acquired." msgstr "" -#: library/threading.rst:665 -msgid "Condition Objects" +#: library/threading.rst:1007 +msgid "Return a boolean indicating whether this object is locked right now." msgstr "" -#: library/threading.rst:667 +#: library/threading.rst:916 +msgid "Condition objects" +msgstr "" + +#: library/threading.rst:918 msgid "" "A condition variable is always associated with some kind of lock; this can " "be passed in or one will be created by default. Passing one in is useful " @@ -861,7 +1233,7 @@ msgid "" "of the condition object: you don't have to track it separately." msgstr "" -#: library/threading.rst:672 +#: library/threading.rst:923 msgid "" "A condition variable obeys the :ref:`context management protocol `: using the ``with`` statement acquires the associated lock for the " @@ -870,7 +1242,7 @@ msgid "" "associated lock." msgstr "" -#: library/threading.rst:678 +#: library/threading.rst:929 msgid "" "Other methods must be called with the associated lock held. The :meth:" "`~Condition.wait` method releases the lock, and then blocks until another " @@ -879,14 +1251,14 @@ msgid "" "and returns. It is also possible to specify a timeout." msgstr "" -#: library/threading.rst:684 +#: library/threading.rst:935 msgid "" "The :meth:`~Condition.notify` method wakes up one of the threads waiting for " "the condition variable, if any are waiting. The :meth:`~Condition." "notify_all` method wakes up all threads waiting for the condition variable." msgstr "" -#: library/threading.rst:688 +#: library/threading.rst:939 msgid "" "Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` " "methods don't release the lock; this means that the thread or threads " @@ -895,7 +1267,7 @@ msgid "" "or :meth:`~Condition.notify_all` finally relinquishes ownership of the lock." msgstr "" -#: library/threading.rst:694 +#: library/threading.rst:945 msgid "" "The typical programming style using condition variables uses the lock to " "synchronize access to some shared state; threads that are interested in a " @@ -907,7 +1279,21 @@ msgid "" "situation with unlimited buffer capacity::" msgstr "" -#: library/threading.rst:714 +#: library/threading.rst:954 +msgid "" +"# Consume one item\n" +"with cv:\n" +" while not an_item_is_available():\n" +" cv.wait()\n" +" get_an_available_item()\n" +"\n" +"# Produce one item\n" +"with cv:\n" +" make_an_item_available()\n" +" cv.notify()" +msgstr "" + +#: library/threading.rst:965 msgid "" "The ``while`` loop checking for the application's condition is necessary " "because :meth:`~Condition.wait` can return after an arbitrary long time, and " @@ -917,7 +1303,15 @@ msgid "" "checking, and eases the computation of timeouts::" msgstr "" -#: library/threading.rst:726 +#: library/threading.rst:972 +msgid "" +"# Consume an item\n" +"with cv:\n" +" cv.wait_for(an_item_is_available)\n" +" get_an_available_item()" +msgstr "" + +#: library/threading.rst:977 msgid "" "To choose between :meth:`~Condition.notify` and :meth:`~Condition." "notify_all`, consider whether one state change can be interesting for only " @@ -926,44 +1320,44 @@ msgid "" "thread." msgstr "" -#: library/threading.rst:734 +#: library/threading.rst:985 msgid "" "This class implements condition variable objects. A condition variable " "allows one or more threads to wait until they are notified by another thread." msgstr "" -#: library/threading.rst:737 +#: library/threading.rst:988 msgid "" "If the *lock* argument is given and not ``None``, it must be a :class:`Lock` " "or :class:`RLock` object, and it is used as the underlying lock. Otherwise, " "a new :class:`RLock` object is created and used as the underlying lock." msgstr "" -#: library/threading.rst:865 library/threading.rst:963 -#: library/threading.rst:1031 +#: library/threading.rst:1122 library/threading.rst:1220 +#: library/threading.rst:1288 msgid "changed from a factory function to a class." msgstr "" -#: library/threading.rst:746 +#: library/threading.rst:997 msgid "" "Acquire the underlying lock. This method calls the corresponding method on " "the underlying lock; the return value is whatever that method returns." msgstr "" -#: library/threading.rst:751 +#: library/threading.rst:1002 msgid "" "Release the underlying lock. This method calls the corresponding method on " "the underlying lock; there is no return value." msgstr "" -#: library/threading.rst:756 +#: library/threading.rst:1013 msgid "" "Wait until notified or until a timeout occurs. If the calling thread has not " "acquired the lock when this method is called, a :exc:`RuntimeError` is " "raised." msgstr "" -#: library/threading.rst:760 +#: library/threading.rst:1017 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call for the same " @@ -971,14 +1365,14 @@ msgid "" "Once awakened or timed out, it re-acquires the lock and returns." msgstr "" -#: library/threading.rst:765 +#: library/threading.rst:1022 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " -"floating point number specifying a timeout for the operation in seconds (or " +"floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof)." msgstr "" -#: library/threading.rst:769 +#: library/threading.rst:1026 msgid "" "When the underlying lock is an :class:`RLock`, it is not released using its :" "meth:`release` method, since this may not actually unlock the lock when it " @@ -988,24 +1382,24 @@ msgid "" "used to restore the recursion level when the lock is reacquired." msgstr "" -#: library/threading.rst:777 +#: library/threading.rst:1034 msgid "" "The return value is ``True`` unless a given *timeout* expired, in which case " "it is ``False``." msgstr "" -#: library/threading.rst:996 +#: library/threading.rst:1253 msgid "Previously, the method always returned ``None``." msgstr "" -#: library/threading.rst:785 +#: library/threading.rst:1042 msgid "" "Wait until a condition evaluates to true. *predicate* should be a callable " "which result will be interpreted as a boolean value. A *timeout* may be " "provided giving the maximum time to wait." msgstr "" -#: library/threading.rst:789 +#: library/threading.rst:1046 msgid "" "This utility method may call :meth:`wait` repeatedly until the predicate is " "satisfied, or until a timeout occurs. The return value is the last return " @@ -1013,33 +1407,39 @@ msgid "" "out." msgstr "" -#: library/threading.rst:794 +#: library/threading.rst:1051 msgid "" "Ignoring the timeout feature, calling this method is roughly equivalent to " "writing::" msgstr "" -#: library/threading.rst:800 +#: library/threading.rst:1054 +msgid "" +"while not predicate():\n" +" cv.wait()" +msgstr "" + +#: library/threading.rst:1057 msgid "" "Therefore, the same rules apply as with :meth:`wait`: The lock must be held " "when called and is re-acquired on return. The predicate is evaluated with " "the lock held." msgstr "" -#: library/threading.rst:808 +#: library/threading.rst:1065 msgid "" "By default, wake up one thread waiting on this condition, if any. If the " "calling thread has not acquired the lock when this method is called, a :exc:" "`RuntimeError` is raised." msgstr "" -#: library/threading.rst:812 +#: library/threading.rst:1069 msgid "" "This method wakes up at most *n* of the threads waiting for the condition " "variable; it is a no-op if no threads are waiting." msgstr "" -#: library/threading.rst:815 +#: library/threading.rst:1072 msgid "" "The current implementation wakes up exactly *n* threads, if at least *n* " "threads are waiting. However, it's not safe to rely on this behavior. A " @@ -1047,14 +1447,14 @@ msgid "" "threads." msgstr "" -#: library/threading.rst:820 +#: library/threading.rst:1077 msgid "" "Note: an awakened thread does not actually return from its :meth:`wait` call " "until it can reacquire the lock. Since :meth:`notify` does not release the " "lock, its caller should." msgstr "" -#: library/threading.rst:826 +#: library/threading.rst:1083 msgid "" "Wake up all threads waiting on this condition. This method acts like :meth:" "`notify`, but wakes up all waiting threads instead of one. If the calling " @@ -1062,15 +1462,15 @@ msgid "" "`RuntimeError` is raised." msgstr "" -#: library/threading.rst:831 +#: library/threading.rst:1088 msgid "The method ``notifyAll`` is a deprecated alias for this method." msgstr "" -#: library/threading.rst:837 -msgid "Semaphore Objects" +#: library/threading.rst:1094 +msgid "Semaphore objects" msgstr "" -#: library/threading.rst:839 +#: library/threading.rst:1096 msgid "" "This is one of the oldest synchronization primitives in the history of " "computer science, invented by the early Dutch computer scientist Edsger W. " @@ -1078,7 +1478,7 @@ msgid "" "acquire` and :meth:`~Semaphore.release`)." msgstr "" -#: library/threading.rst:844 +#: library/threading.rst:1101 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`~Semaphore.acquire` call and incremented by each :meth:`~Semaphore.release` " @@ -1087,12 +1487,12 @@ msgid "" "meth:`~Semaphore.release`." msgstr "" -#: library/threading.rst:850 +#: library/threading.rst:1107 msgid "" "Semaphores also support the :ref:`context management protocol `." msgstr "" -#: library/threading.rst:855 +#: library/threading.rst:1112 msgid "" "This class implements semaphore objects. A semaphore manages an atomic " "counter representing the number of :meth:`release` calls minus the number " @@ -1101,28 +1501,28 @@ msgid "" "If not given, *value* defaults to 1." msgstr "" -#: library/threading.rst:861 +#: library/threading.rst:1118 msgid "" "The optional argument gives the initial *value* for the internal counter; it " "defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is " "raised." msgstr "" -#: library/threading.rst:870 +#: library/threading.rst:1127 msgid "Acquire a semaphore." msgstr "" -#: library/threading.rst:872 +#: library/threading.rst:1129 msgid "When invoked without arguments:" msgstr "" -#: library/threading.rst:874 +#: library/threading.rst:1131 msgid "" "If the internal counter is larger than zero on entry, decrement it by one " "and return ``True`` immediately." msgstr "" -#: library/threading.rst:876 +#: library/threading.rst:1133 msgid "" "If the internal counter is zero on entry, block until awoken by a call to :" "meth:`~Semaphore.release`. Once awoken (and the counter is greater than 0), " @@ -1131,32 +1531,32 @@ msgid "" "threads are awoken should not be relied on." msgstr "" -#: library/threading.rst:882 +#: library/threading.rst:1139 msgid "" "When invoked with *blocking* set to ``False``, do not block. If a call " "without an argument would block, return ``False`` immediately; otherwise, do " "the same thing as when called without arguments, and return ``True``." msgstr "" -#: library/threading.rst:886 +#: library/threading.rst:1143 msgid "" "When invoked with a *timeout* other than ``None``, it will block for at most " "*timeout* seconds. If acquire does not complete successfully in that " "interval, return ``False``. Return ``True`` otherwise." msgstr "" -#: library/threading.rst:895 +#: library/threading.rst:1152 msgid "" "Release a semaphore, incrementing the internal counter by *n*. When it was " "zero on entry and other threads are waiting for it to become larger than " "zero again, wake up *n* of those threads." msgstr "" -#: library/threading.rst:899 +#: library/threading.rst:1156 msgid "Added the *n* parameter to release multiple waiting threads at once." msgstr "" -#: library/threading.rst:905 +#: library/threading.rst:1162 msgid "" "Class implementing bounded semaphore objects. A bounded semaphore checks to " "make sure its current value doesn't exceed its initial value. If it does, :" @@ -1165,11 +1565,11 @@ msgid "" "times it's a sign of a bug. If not given, *value* defaults to 1." msgstr "" -#: library/threading.rst:918 -msgid ":class:`Semaphore` Example" +#: library/threading.rst:1175 +msgid ":class:`Semaphore` example" msgstr "" -#: library/threading.rst:920 +#: library/threading.rst:1177 msgid "" "Semaphores are often used to guard resources with limited capacity, for " "example, a database server. In any situation where the size of the resource " @@ -1177,37 +1577,54 @@ msgid "" "threads, your main thread would initialize the semaphore::" msgstr "" -#: library/threading.rst:929 +#: library/threading.rst:1182 +msgid "" +"maxconnections = 5\n" +"# ...\n" +"pool_sema = BoundedSemaphore(value=maxconnections)" +msgstr "" + +#: library/threading.rst:1186 msgid "" "Once spawned, worker threads call the semaphore's acquire and release " "methods when they need to connect to the server::" msgstr "" -#: library/threading.rst:939 +#: library/threading.rst:1189 +msgid "" +"with pool_sema:\n" +" conn = connectdb()\n" +" try:\n" +" # ... use connection ...\n" +" finally:\n" +" conn.close()" +msgstr "" + +#: library/threading.rst:1196 msgid "" "The use of a bounded semaphore reduces the chance that a programming error " "which causes the semaphore to be released more than it's acquired will go " "undetected." msgstr "" -#: library/threading.rst:946 -msgid "Event Objects" +#: library/threading.rst:1203 +msgid "Event objects" msgstr "" -#: library/threading.rst:948 +#: library/threading.rst:1205 msgid "" "This is one of the simplest mechanisms for communication between threads: " "one thread signals an event and other threads wait for it." msgstr "" -#: library/threading.rst:951 +#: library/threading.rst:1208 msgid "" "An event object manages an internal flag that can be set to true with the :" "meth:`~Event.set` method and reset to false with the :meth:`~Event.clear` " "method. The :meth:`~Event.wait` method blocks until the flag is true." msgstr "" -#: library/threading.rst:958 +#: library/threading.rst:1215 msgid "" "Class implementing event objects. An event manages a flag that can be set " "to true with the :meth:`~Event.set` method and reset to false with the :meth:" @@ -1215,49 +1632,49 @@ msgid "" "flag is initially false." msgstr "" -#: library/threading.rst:968 +#: library/threading.rst:1225 msgid "Return ``True`` if and only if the internal flag is true." msgstr "" -#: library/threading.rst:970 +#: library/threading.rst:1227 msgid "The method ``isSet`` is a deprecated alias for this method." msgstr "" -#: library/threading.rst:974 +#: library/threading.rst:1231 msgid "" "Set the internal flag to true. All threads waiting for it to become true are " "awakened. Threads that call :meth:`wait` once the flag is true will not " "block at all." msgstr "" -#: library/threading.rst:980 +#: library/threading.rst:1237 msgid "" "Reset the internal flag to false. Subsequently, threads calling :meth:`wait` " "will block until :meth:`.set` is called to set the internal flag to true " "again." msgstr "" -#: library/threading.rst:986 +#: library/threading.rst:1243 msgid "" "Block as long as the internal flag is false and the timeout, if given, has " "not expired. The return value represents the reason that this blocking " "method returned; ``True`` if returning because the internal flag is set to " -"true, or ``False`` if a timeout is given and the the internal flag did not " +"true, or ``False`` if a timeout is given and the internal flag did not " "become true within the given wait time." msgstr "" -#: library/threading.rst:992 +#: library/threading.rst:1249 msgid "" "When the timeout argument is present and not ``None``, it should be a " -"floating point number specifying a timeout for the operation in seconds, or " +"floating-point number specifying a timeout for the operation in seconds, or " "fractions thereof." msgstr "" -#: library/threading.rst:1003 -msgid "Timer Objects" +#: library/threading.rst:1260 +msgid "Timer objects" msgstr "" -#: library/threading.rst:1005 +#: library/threading.rst:1262 msgid "" "This class represents an action that should be run only after a certain " "amount of time has passed --- a timer. :class:`Timer` is a subclass of :" @@ -1265,7 +1682,7 @@ msgid "" "threads." msgstr "" -#: library/threading.rst:1009 +#: library/threading.rst:1266 msgid "" "Timers are started, as with threads, by calling their :meth:`Timer.start " "` method. The timer can be stopped (before its action has " @@ -1274,11 +1691,20 @@ msgid "" "interval specified by the user." msgstr "" -#: library/threading.rst:1015 +#: library/threading.rst:1272 msgid "For example::" msgstr "" -#: library/threading.rst:1026 +#: library/threading.rst:1274 +msgid "" +"def hello():\n" +" print(\"hello, world\")\n" +"\n" +"t = Timer(30.0, hello)\n" +"t.start() # after 30 seconds, \"hello, world\" will be printed" +msgstr "" + +#: library/threading.rst:1283 msgid "" "Create a timer that will run *function* with arguments *args* and keyword " "arguments *kwargs*, after *interval* seconds have passed. If *args* is " @@ -1286,17 +1712,17 @@ msgid "" "``None`` (the default) then an empty dict will be used." msgstr "" -#: library/threading.rst:1036 +#: library/threading.rst:1293 msgid "" "Stop the timer, and cancel the execution of the timer's action. This will " "only work if the timer is still in its waiting stage." msgstr "" -#: library/threading.rst:1041 -msgid "Barrier Objects" +#: library/threading.rst:1298 +msgid "Barrier objects" msgstr "" -#: library/threading.rst:1045 +#: library/threading.rst:1302 msgid "" "This class provides a simple synchronization primitive for use by a fixed " "number of threads that need to wait for each other. Each of the threads " @@ -1305,18 +1731,36 @@ msgid "" "calls. At this point, the threads are released simultaneously." msgstr "" -#: library/threading.rst:1051 +#: library/threading.rst:1308 msgid "" "The barrier can be reused any number of times for the same number of threads." msgstr "" -#: library/threading.rst:1053 +#: library/threading.rst:1310 msgid "" "As an example, here is a simple way to synchronize a client and server " "thread::" msgstr "" -#: library/threading.rst:1073 +#: library/threading.rst:1312 +msgid "" +"b = Barrier(2, timeout=5)\n" +"\n" +"def server():\n" +" start_server()\n" +" b.wait()\n" +" while True:\n" +" connection = accept_connection()\n" +" process_server_connection(connection)\n" +"\n" +"def client():\n" +" b.wait()\n" +" while True:\n" +" connection = make_connection()\n" +" process_client_connection(connection)" +msgstr "" + +#: library/threading.rst:1330 msgid "" "Create a barrier object for *parties* number of threads. An *action*, when " "provided, is a callable to be called by one of the threads when they are " @@ -1324,7 +1768,7 @@ msgid "" "the :meth:`wait` method." msgstr "" -#: library/threading.rst:1080 +#: library/threading.rst:1337 msgid "" "Pass the barrier. When all the threads party to the barrier have called " "this function, they are all released simultaneously. If a *timeout* is " @@ -1332,44 +1776,52 @@ msgid "" "constructor." msgstr "" -#: library/threading.rst:1085 +#: library/threading.rst:1342 msgid "" "The return value is an integer in the range 0 to *parties* -- 1, different " "for each thread. This can be used to select a thread to do some special " "housekeeping, e.g.::" msgstr "" -#: library/threading.rst:1094 +#: library/threading.rst:1346 +msgid "" +"i = barrier.wait()\n" +"if i == 0:\n" +" # Only one thread needs to print this\n" +" print(\"passed the barrier\")" +msgstr "" + +#: library/threading.rst:1351 msgid "" "If an *action* was provided to the constructor, one of the threads will have " "called it prior to being released. Should this call raise an error, the " "barrier is put into the broken state." msgstr "" -#: library/threading.rst:1098 +#: library/threading.rst:1355 msgid "If the call times out, the barrier is put into the broken state." msgstr "" -#: library/threading.rst:1100 +#: library/threading.rst:1357 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a thread is waiting." msgstr "" -#: library/threading.rst:1105 +#: library/threading.rst:1362 msgid "" "Return the barrier to the default, empty state. Any threads waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: library/threading.rst:1108 +#: library/threading.rst:1365 msgid "" "Note that using this function may require some external synchronization if " "there are other threads whose state is unknown. If a barrier is broken it " "may be better to just leave it and create a new one." msgstr "" -#: library/threading.rst:1114 +#: library/threading.rst:1371 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " @@ -1377,36 +1829,36 @@ msgid "" "application." msgstr "" -#: library/threading.rst:1119 +#: library/threading.rst:1376 msgid "" "It may be preferable to simply create the barrier with a sensible *timeout* " "value to automatically guard against one of the threads going awry." msgstr "" -#: library/threading.rst:1125 +#: library/threading.rst:1382 msgid "The number of threads required to pass the barrier." msgstr "" -#: library/threading.rst:1129 +#: library/threading.rst:1386 msgid "The number of threads currently waiting in the barrier." msgstr "" -#: library/threading.rst:1133 +#: library/threading.rst:1390 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: library/threading.rst:1138 +#: library/threading.rst:1395 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: library/threading.rst:1145 +#: library/threading.rst:1402 msgid "" "Using locks, conditions, and semaphores in the :keyword:`!with` statement" msgstr "" -#: library/threading.rst:1147 +#: library/threading.rst:1404 msgid "" "All of the objects provided by this module that have ``acquire`` and " "``release`` methods can be used as context managers for a :keyword:`with` " @@ -1415,25 +1867,40 @@ msgid "" "following snippet::" msgstr "" -#: library/threading.rst:1156 +#: library/threading.rst:1410 +msgid "" +"with some_lock:\n" +" # do something..." +msgstr "" + +#: library/threading.rst:1413 msgid "is equivalent to::" msgstr "" -#: library/threading.rst:1164 +#: library/threading.rst:1415 +msgid "" +"some_lock.acquire()\n" +"try:\n" +" # do something...\n" +"finally:\n" +" some_lock.release()" +msgstr "" + +#: library/threading.rst:1421 msgid "" "Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:" "`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:" "`with` statement context managers." msgstr "" -#: library/threading.rst:173 +#: library/threading.rst:240 msgid "trace function" msgstr "" -#: library/threading.rst:173 +#: library/threading.rst:240 msgid "debugger" msgstr "" -#: library/threading.rst:202 +#: library/threading.rst:269 msgid "profile function" msgstr "" diff --git a/library/time.po b/library/time.po index a0efbc9a..64a4bb45 100644 --- a/library/time.po +++ b/library/time.po @@ -8,23 +8,27 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/time.rst:2 -msgid ":mod:`time` --- Time access and conversions" -msgstr "" +msgid ":mod:`!time` --- Time access and conversions" +msgstr ":mod:`!time` --- Πρόσβαση και μετατροπές χρόνου" #: library/time.rst:9 msgid "" "This module provides various time-related functions. For related " "functionality, see also the :mod:`datetime` and :mod:`calendar` modules." msgstr "" +"Αυτό το module παρέχει διάφορες συναρτήσεις σχετικές με τον χρόνο. Για " +"σχετική λειτουργικότητα, δείτε επίσης τα modules :mod:`datetime` και :mod:" +"`calendar`." #: library/time.rst:12 msgid "" @@ -34,16 +38,25 @@ msgid "" "consult the platform documentation, because the semantics of these functions " "varies among platforms." msgstr "" +"Αν και αυτό το module είναι πάντα διαθέσιμο, δεν είναι όλες οι συναρτήσεις " +"διαθέσιμες σε όλες τις πλατφόρμες. Οι περισσότερες από τις συναρτήσεις που " +"ορίζονται σε αυτό το module καλούν συναρτήσεις της πλατφόρμας C με το ίδιο " +"όνομα. Μπορεί μερικές φορές να είναι χρήσιμο να συμβουλευτείτε την " +"τεκμηρίωση της πλατφόρμας, επειδή η σημασιολογία αυτών των συναρτήσεων " +"διαφέρει μεταξύ των πλατφορμών." #: library/time.rst:18 msgid "An explanation of some terminology and conventions is in order." -msgstr "" +msgstr "Απαιτείται μια εξήγηση ορισμένης ορολογίας και συμβάσεων." #: library/time.rst:24 msgid "" "The :dfn:`epoch` is the point where the time starts, the return value of " "``time.gmtime(0)``. It is January 1, 1970, 00:00:00 (UTC) on all platforms." msgstr "" +"Το :dfn:`epoch` είναι το σημείο όπου ξεκινά ο χρόνος, η τιμή που επιστρέφει " +"το ``time.gmtime(0)``. Είναι η 1η Ιανουαρίου 1970, 00:00:00 (UTC) σε όλες " +"τις πλατφόρμες." #: library/time.rst:31 msgid "" @@ -51,6 +64,10 @@ msgid "" "elapsed seconds since the epoch, typically excluding `leap seconds`_. Leap " "seconds are excluded from this total on all POSIX-compliant platforms." msgstr "" +"Ο όρος :dfn:`seconds since the epoch` αναφέρεται στον συνολικό αριθμό των " +"δευτερολέπτων που έχουν παρέλθει από το epoch, συνήθως εξαιρώντας τα `leap " +"seconds`_. Τα δίσεκτα δευτερόλεπτα (leap seconds) εξαιρούνται από αυτό το " +"σύνολο σε όλες τις πλατφόρμες που συμμορφώνονται με το POSIX." #: library/time.rst:38 msgid "" @@ -58,6 +75,9 @@ msgid "" "epoch_ or far in the future. The cut-off point in the future is determined " "by the C library; for 32-bit systems, it is typically in 2038." msgstr "" +"Οι συναρτήσεις σε αυτό το module μπορεί να μην χειρίζονται ημερομηνίες και " +"ώρες πριν από το epoch_ ή πολύ μακριά στο μέλλον. Το σημείο κοπής στο μέλλον " +"καθορίζεται από τη βιβλιοθήκη C· για συστήματα 32-bit, είναι τυπικά το 2038." #: library/time.rst:45 msgid "" @@ -66,15 +86,25 @@ msgid "" "POSIX and ISO C standards: values 69--99 are mapped to 1969--1999, and " "values 0--68 are mapped to 2000--2068." msgstr "" +"Η συνάρτηση :func:`strptime` μπορεί να αναλύσει 2-ψήφια έτη όταν δοθεί " +"κωδικός μορφής ``%y``. Όταν αναλύονται 2-ψήφια έτη, μετατρέπονται σύμφωνα με " +"τα πρότυπα POSIX και ISO C: οι τιμές 69--99 αντιστοιχίζονται σε 1969--1999, " +"και οι τιμές 0--68 αντιστοιχίζονται σε2000--2068." #: library/time.rst:55 msgid "" -"UTC is Coordinated Universal Time (formerly known as Greenwich Mean Time, or " -"GMT). The acronym UTC is not a mistake but a compromise between English and " -"French." +"UTC is `Coordinated Universal Time`_ and superseded `Greenwich Mean Time`_ " +"or GMT as the basis of international timekeeping. The acronym UTC is not a " +"mistake but conforms to an earlier, language-agnostic naming scheme for time " +"standards such as UT0, UT1, and UT2." msgstr "" +"Το UTC είναι το `Coordinated Universal Time`_ και έχει αντικαταστήσει το " +"`Greenwich Mean Time`_ ή GMT ως τη βάση της διεθνούς τήρησης χρόνου. Το " +"ακρωνύμιο UTC δεν είναι λάθος αλλά συμμορφώνεται με ένα προηγούμενο, " +"ουδέτερο ως προς τη γλώσσα, σχήμα ονομασίας για πρότυπα χρόνου όπως τα UT0, " +"UT1, και UT2." -#: library/time.rst:61 +#: library/time.rst:65 msgid "" "DST is Daylight Saving Time, an adjustment of the timezone by (usually) one " "hour during part of the year. DST rules are magic (determined by local law) " @@ -82,25 +112,42 @@ msgid "" "local rules (often it is read from a system file for flexibility) and is the " "only source of True Wisdom in this respect." msgstr "" +"Το DST είναι το Daylight Saving Time, μια προσαρμογή της ζώνης ώρας κατά " +"(συνήθως) μία ώρα κατά τη διάρκεια μέρους του έτους. Οι κανόνες DST είναι " +"μαγικοί (καθορίζονται από τοπικό νόμο) και μπορεί να αλλάζουν από έτος σε " +"έτος. Η βιβλιοθήκη C έχει έναν πίνακα που περιέχει τους τοπικούς κανόνες " +"(συχνά διαβάζεται από ένα σύστημα αρχείων για ευελιξία) και είναι η μόνη " +"πηγή Αληθινής Σοφίας σε αυτό το θέμα." -#: library/time.rst:67 +#: library/time.rst:71 msgid "" "The precision of the various real-time functions may be less than suggested " "by the units in which their value or argument is expressed. E.g. on most " "Unix systems, the clock \"ticks\" only 50 or 100 times a second." msgstr "" +"Η ακρίβεια των διαφόρων συναρτήσεων πραγματικού χρόνου μπορεί να είναι " +"λιγότερη από αυτή που υποδηλώνεται από τις μονάδες στις οποίες εκφράζεται η " +"τιμή ή το όρισμά τους. Π.χ. στα περισσότερα συστήματα Unix, το ρολόι " +"\"χτυπάει\" μόνο 50 ή 100 φορές το δευτερόλεπτο." -#: library/time.rst:71 +#: library/time.rst:75 msgid "" "On the other hand, the precision of :func:`.time` and :func:`sleep` is " -"better than their Unix equivalents: times are expressed as floating point " +"better than their Unix equivalents: times are expressed as floating-point " "numbers, :func:`.time` returns the most accurate time available (using Unix :" "c:func:`!gettimeofday` where available), and :func:`sleep` will accept a " "time with a nonzero fraction (Unix :c:func:`!select` is used to implement " "this, where available)." msgstr "" +"Από την άλλη πλευρά, η ακρίβεια της :func:`.time` και της :func:`sleep` " +"είναι πιο καλή από τις αντίστοιχες Unix: οι χρόνοι εκφράζονται ως αριθμοί " +"κινητής υποδιαστολής, η :func:`.time` επιστρέφει τον πιο ακριβή διαθέσιμο " +"χρόνο (χρησιμοποιώντας το Unix :c:func:`!gettimeofday` όπου είναι " +"διαθέσιμο), και :func:`sleep` θα δεχτεί έναν χρόνο με μη μηδενικό κλάσμα (το " +"Unix :c::func:`!select` χρησιμοποιείται για αυτόν τον λόγο, όπου είναι " +"διαθέσιμο)." -#: library/time.rst:78 +#: library/time.rst:82 msgid "" "The time value as returned by :func:`gmtime`, :func:`localtime`, and :func:" "`strptime`, and accepted by :func:`asctime`, :func:`mktime` and :func:" @@ -108,232 +155,296 @@ msgid "" "`gmtime`, :func:`localtime`, and :func:`strptime` also offer attribute names " "for individual fields." msgstr "" +"Η τιμή χρόνου όπως επιστρέφεται από τις :func:`gmtime`, :func:`localtime`, " +"και :func:`strptime`, και γίνεται αποδεκτή από τις :func:`asctime`, :func:" +"`mktime` και :func:`strftime`, είναι μια ακολουθία από 9 ακέραιους. Οι τιμές " +"επιστροφής των :func:`gmtime`, :func:`localtime`, και :func:`strptime` " +"προσφέρουν επίσης ονόματα χαρακτηριστικών για μεμονωμένα πεδία." -#: library/time.rst:84 +#: library/time.rst:88 msgid "See :class:`struct_time` for a description of these objects." msgstr "" +"Δείτε την :class:`struct_time` για μια περιγραφή αυτών των αντικειμένων." -#: library/time.rst:86 +#: library/time.rst:90 msgid "" "The :class:`struct_time` type was extended to provide the :attr:" "`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` attributes when " "platform supports corresponding ``struct tm`` members." msgstr "" +"Ο τύπος :class:`struct_time` επεκτάθηκε για να παρέχει τα :attr:" +"`~struct_time.tm_gmtoff` και :attr:`~struct_time.tm_zone` χαρακτηριστικά " +"όταν η πλατφόρμα υποστηρίζει τα αντίστοιχα μέλη ``struct tm``." -#: library/time.rst:92 +#: library/time.rst:96 msgid "" "The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` and :attr:" "`~struct_time.tm_zone` are now available on all platforms." msgstr "" +"Τα :class:`struct_time` χαρακτηριστικά :attr:`~struct_time.tm_gmtoff` και :" +"attr:`~struct_time.tm_zone` είναι τώρα διαθέσιμα σε όλες τις πλατφόρμες." -#: library/time.rst:97 +#: library/time.rst:101 msgid "Use the following functions to convert between time representations:" msgstr "" +"Χρησιμοποιήστε τις ακόλουθες συναρτήσεις για να μετατρέψετε μεταξύ " +"αναπαραστάσεων χρόνου:" -#: library/time.rst:100 +#: library/time.rst:104 msgid "From" -msgstr "" +msgstr "Από" -#: library/time.rst:100 +#: library/time.rst:104 msgid "To" -msgstr "" +msgstr "Προς" -#: library/time.rst:100 +#: library/time.rst:104 msgid "Use" -msgstr "" +msgstr "Χρήση" -#: library/time.rst:102 library/time.rst:108 library/time.rst:111 +#: library/time.rst:106 library/time.rst:112 library/time.rst:115 msgid "seconds since the epoch" -msgstr "" +msgstr "δευτερόλεπτα από το epoch" -#: library/time.rst:108 +#: library/time.rst:112 msgid ":class:`struct_time` in UTC" -msgstr "" +msgstr ":class:`struct_time` σε UTC" -#: library/time.rst:102 +#: library/time.rst:106 msgid ":func:`gmtime`" -msgstr "" +msgstr ":func:`gmtime`" -#: library/time.rst:111 +#: library/time.rst:115 msgid ":class:`struct_time` in local time" -msgstr "" +msgstr ":class:`struct_time` σε τοπική ώρα" -#: library/time.rst:105 +#: library/time.rst:109 msgid ":func:`localtime`" -msgstr "" +msgstr ":func:`localtime`" -#: library/time.rst:108 +#: library/time.rst:112 msgid ":func:`calendar.timegm`" -msgstr "" +msgstr ":func:`calendar.timegm`" -#: library/time.rst:111 +#: library/time.rst:115 msgid ":func:`mktime`" -msgstr "" +msgstr ":func:`mktime`" -#: library/time.rst:119 +#: library/time.rst:123 msgid "Functions" -msgstr "" +msgstr "Συναρτήσεις" -#: library/time.rst:123 +#: library/time.rst:127 msgid "" "Convert a tuple or :class:`struct_time` representing a time as returned by :" "func:`gmtime` or :func:`localtime` to a string of the following form: ``'Sun " "Jun 20 23:21:05 1993'``. The day field is two characters long and is space " "padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 1993'``." msgstr "" +"Μετατρέπει μια πλειάδα ή :class:`struct_time` που αναπαριστά έναν χρόνο όπως " +"επιστρέφεται από τις :func:`gmtime` ή :func:`localtime` σε μια συμβολοσειρά " +"της ακόλουθης μορφής: ``'Sun Jun 20 23:21:05 1993'``. Το πεδίο της ημέρας " +"είναι δύο χαρακτήρων και γεμίζεται με κενό αν η ημέρα είναι μονοψήφια, π.χ.: " +"``'Wed Jun 9 04:26:40 1993'``." -#: library/time.rst:129 +#: library/time.rst:133 msgid "" "If *t* is not provided, the current time as returned by :func:`localtime` is " "used. Locale information is not used by :func:`asctime`." msgstr "" +"Αν το *t* δεν παρέχεται, χρησιμοποιείται ο τρέχων χρόνος όπως επιστρέφεται " +"από την :func:`localtime`. Οι πληροφορίες τοπικής ρύθμισης δεν " +"χρησιμοποιούνται από την :func:`asctime`." -#: library/time.rst:134 +#: library/time.rst:138 msgid "" "Unlike the C function of the same name, :func:`asctime` does not add a " "trailing newline." msgstr "" +"Σε αντίθεση με τη συνάρτηση C με το ίδιο όνομα, η :func:`asctime` δεν " +"προσθέτει μια νέα γραμμή στο τέλος." -#: library/time.rst:139 +#: library/time.rst:143 msgid "" "Return the *clk_id* of the thread-specific CPU-time clock for the specified " "*thread_id*." msgstr "" +"Επιστρέφει το *clk_id* του ρολογιού χρόνου CPU που είναι συγκεκριμένο για το " +"νήμα, για το καθορισμένο *thread_id*." -#: library/time.rst:141 +#: library/time.rst:145 msgid "" "Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" +"Χρησιμοποιήστε το :func:`threading.get_ident` ή το :attr:`~threading.Thread." +"ident` χαρακτηριστικό των αντικειμένων :class:`threading.Thread` για να " +"λάβετε μια κατάλληλη τιμή για το *thread_id*." -#: library/time.rst:146 +#: library/time.rst:150 msgid "" "Passing an invalid or expired *thread_id* may result in undefined behavior, " "such as segmentation fault." msgstr "" +"Η μετάδοση ενός μη έγκυρου ή ληγμένου *thread_id* μπορεί να έχει ως " +"αποτέλεσμα μη ορισμένη συμπεριφορά, όπως σφάλμα τμηματοποίησης." -#: library/time.rst:149 -msgid ":ref:`Availability `: Unix" -msgstr "" +#: library/time.rst:165 library/time.rst:187 library/time.rst:209 +#: library/time.rst:778 library/time.rst:885 library/time.rst:905 +#: library/time.rst:923 library/time.rst:943 library/time.rst:962 +#: library/time.rst:982 library/time.rst:995 +msgid "Availability" +msgstr "Διαθεσιμότητα" -#: library/time.rst:151 +#: library/time.rst:155 msgid "" "See the man page for :manpage:`pthread_getcpuclockid(3)` for further " "information." msgstr "" +"Δείτε τη σελίδα του εγχειριδίου για το :manpage:`pthread_getcpuclockid(3)` " +"για περαιτέρω πληροφορίες." -#: library/time.rst:158 +#: library/time.rst:162 msgid "" "Return the resolution (precision) of the specified clock *clk_id*. Refer " "to :ref:`time-clock-id-constants` for a list of accepted values for *clk_id*." msgstr "" +"Επιστρέφει την ανάλυση (ακρίβεια) του συγκεκριμένου ρολογιού *clk_id*. " +"Ανατρέξτε στο :ref:`time-clock-id-constants` για μια λίστα αποδεκτών τιμών " +"για *clk_id*." -#: library/time.rst:174 library/time.rst:196 library/time.rst:716 -#: library/time.rst:852 library/time.rst:915 -msgid ":ref:`Availability `: Unix." -msgstr "" - -#: library/time.rst:168 +#: library/time.rst:172 msgid "" "Return the time of the specified clock *clk_id*. Refer to :ref:`time-clock-" "id-constants` for a list of accepted values for *clk_id*." msgstr "" +"Επιστρέφει τον χρόνο του συγκεκριμένου ρολογιού *clk_id*. Ανατρέξτε στο :ref:" +"`time-clock-id-constants` για μια λίστα αποδεκτών τιμών για *clk_id*." -#: library/time.rst:171 +#: library/time.rst:175 msgid "" "Use :func:`clock_gettime_ns` to avoid the precision loss caused by the :" "class:`float` type." msgstr "" +"Χρησιμοποιήστε την :func:`clock_gettime_ns` για να αποφύγετε την απώλεια " +"ακρίβειας που προκαλείται από τον τύπο :class:`float`." -#: library/time.rst:181 +#: library/time.rst:185 msgid "Similar to :func:`clock_gettime` but return time as nanoseconds." msgstr "" +"Παρόμοιο με την :func:`clock_gettime` αλλά επιστρέφει τον χρόνο σε " +"νανοδευτερόλεπτα." -#: library/time.rst:190 +#: library/time.rst:194 msgid "" "Set the time of the specified clock *clk_id*. Currently, :data:" "`CLOCK_REALTIME` is the only accepted value for *clk_id*." msgstr "" +"Ορίζει τον χρόνο του συγκεκριμένου ρολογιού *clk_id*. Επί του παρόντος, το :" +"data:`CLOCK_REALTIME` είναι η μόνη αποδεκτή τιμή για το *clk_id*." -#: library/time.rst:193 +#: library/time.rst:197 msgid "" "Use :func:`clock_settime_ns` to avoid the precision loss caused by the :" "class:`float` type." msgstr "" +"Χρησιμοποιήστε την :func:`clock_settime_ns` για να αποφύγετε την απώλεια " +"ακρίβειας που προκαλείται από τον τύπο :class:`float`." -#: library/time.rst:203 +#: library/time.rst:207 msgid "Similar to :func:`clock_settime` but set time with nanoseconds." msgstr "" +"Παρόμοιο με την :func:`clock_settime` αλλά ορίζει τον χρόνο με " +"νανοδευτερόλεπτα." -#: library/time.rst:212 +#: library/time.rst:216 msgid "" "Convert a time expressed in seconds since the epoch_ to a string of a form: " "``'Sun Jun 20 23:21:05 1993'`` representing local time. The day field is two " "characters long and is space padded if the day is a single digit, e.g.: " "``'Wed Jun 9 04:26:40 1993'``." msgstr "" +"Μετατρέπει έναν χρόνο εκφρασμένο σε δευτερόλεπτα από το epoch_ σε μια " +"συμβολοσειρά της μορφής: ``'Sun Jun 20 23:21:05 1993'`` που αναπαριστά την " +"τοπική ώρα. Το πεδίο της ημέρας είναι δύο χαρακτήρων και γεμίζεται με κενό " +"αν η ημέρα είναι μονοψήφια, π.χ.: ``'Wed Jun 9 04:26:40 1993'``." -#: library/time.rst:217 +#: library/time.rst:221 msgid "" "If *secs* is not provided or :const:`None`, the current time as returned by :" "func:`.time` is used. ``ctime(secs)`` is equivalent to " "``asctime(localtime(secs))``. Locale information is not used by :func:" "`ctime`." msgstr "" +"Αν το *secs* δεν παρέχεται ή είναι :const:`None`, χρησιμοποιείται ο τρέχων " +"χρόνος όπως επιστρέφεται από την :func:`.time`. Το ``ctime(secs)`` είναι " +"ισοδύναμο με το ``asctime(localtime(secs))``. Οι πληροφορίες τοπικής " +"ρύθμισης δεν χρησιμοποιούνται από την :func:`ctime`." -#: library/time.rst:225 +#: library/time.rst:229 msgid "" "Get information on the specified clock as a namespace object. Supported " "clock names and the corresponding functions to read their value are:" msgstr "" +"Λάβετε πληροφορίες για το συγκεκριμένο ρολόι ως αντικείμενο χώρου ονομάτων. " +"Τα υποστηριζόμενα ονόματα ρολογιών και οι αντίστοιχες συναρτήσεις για την " +"ανάγνωση της τιμής τους είναι:" -#: library/time.rst:229 +#: library/time.rst:233 msgid "``'monotonic'``: :func:`time.monotonic`" -msgstr "" +msgstr "``'monotonic'``: :func:`time.monotonic`" -#: library/time.rst:230 +#: library/time.rst:234 msgid "``'perf_counter'``: :func:`time.perf_counter`" -msgstr "" +msgstr "``'perf_counter'``: :func:`time.perf_counter`" -#: library/time.rst:231 +#: library/time.rst:235 msgid "``'process_time'``: :func:`time.process_time`" -msgstr "" +msgstr "``'process_time'``: :func:`time.process_time`" -#: library/time.rst:232 +#: library/time.rst:236 msgid "``'thread_time'``: :func:`time.thread_time`" -msgstr "" +msgstr "``'thread_time'``: :func:`time.thread_time`" -#: library/time.rst:233 +#: library/time.rst:237 msgid "``'time'``: :func:`time.time`" -msgstr "" +msgstr "``'time'``: :func:`time.time`" -#: library/time.rst:235 +#: library/time.rst:239 msgid "The result has the following attributes:" -msgstr "" +msgstr "Το αποτέλεσμα έχει τα ακόλουθα χαρακτηριστικά:" -#: library/time.rst:237 +#: library/time.rst:241 msgid "" -"*adjustable*: ``True`` if the clock can be changed automatically (e.g. by a " -"NTP daemon) or manually by the system administrator, ``False`` otherwise" +"*adjustable*: ``True`` if the clock can be set to jump forward or backward " +"in time, ``False`` otherwise. Does not refer to gradual NTP rate adjustments." msgstr "" +"*adjustable*: ``True`` αν το ρολόι μπορεί να ρυθμιστεί να πηδήξει μπροστά ή " +"πίσω στον χρόνο, διαφορετικά ``False``. Δεν αναφέρεται σε σταδιακές NTP " +"ρυθμίσεις ρυθμού." -#: library/time.rst:239 +#: library/time.rst:243 msgid "" "*implementation*: The name of the underlying C function used to get the " "clock value. Refer to :ref:`time-clock-id-constants` for possible values." msgstr "" +"*implementation*: Το όνομα της υποκείμενης συνάρτησης C που χρησιμοποιείται " +"για να λάβει την τιμή του ρολογιού. Ανατρέξτε στο :ref:`time-clock-id-" +"constants` για πιθανές τιμές." -#: library/time.rst:241 +#: library/time.rst:245 msgid "" "*monotonic*: ``True`` if the clock cannot go backward, ``False`` otherwise" msgstr "" +"*monotonic*: ``True`` αν το ρολόι δεν μπορεί να πάει πίσω, διαφορετικά " +"``False``" -#: library/time.rst:243 +#: library/time.rst:247 msgid "*resolution*: The resolution of the clock in seconds (:class:`float`)" -msgstr "" +msgstr "*resolution*: Η ανάλυση του ρολογιού σε δευτερόλεπτα (:class:`float`)" -#: library/time.rst:250 +#: library/time.rst:254 msgid "" "Convert a time expressed in seconds since the epoch_ to a :class:" "`struct_time` in UTC in which the dst flag is always zero. If *secs* is not " @@ -342,15 +453,26 @@ msgid "" "the :class:`struct_time` object. See :func:`calendar.timegm` for the inverse " "of this function." msgstr "" +"Μετατρέπει έναν χρόνο εκφρασμένο σε δευτερόλεπτα από το epoch_ σε μια :class:" +"`struct_time` σε UTC στην οποία η σημαία dst είναι πάντα μηδέν. Αν το *secs* " +"δεν παρέχεται ή είναι :const:`None`, χρησιμοποιείται ο τρέχων χρόνος όπως " +"επιστρέφεται από την :func:`.time`. Τα κλάσματα του δευτερολέπτου " +"αγνοούνται. Δείτε παραπάνω για μια περιγραφή του αντικειμένου :class:" +"`struct_time`. Δείτε την :func:`calendar.timegm` για την αντίστροφη αυτής " +"της συνάρτησης." -#: library/time.rst:260 +#: library/time.rst:264 msgid "" "Like :func:`gmtime` but converts to local time. If *secs* is not provided " "or :const:`None`, the current time as returned by :func:`.time` is used. " "The dst flag is set to ``1`` when DST applies to the given time." msgstr "" +"Όπως η :func:`gmtime` αλλά μετατρέπει σε τοπική ώρα. Αν το *secs* δεν " +"παρέχεται ή είναι :const:`None`, χρησιμοποιείται ο τρέχων χρόνος όπως " +"επιστρέφεται από την :func:`.time`. Η σημαία dst ορίζεται σε ``1`` όταν το " +"DST ισχύει για τον δεδομένο χρόνο." -#: library/time.rst:264 +#: library/time.rst:268 msgid "" ":func:`localtime` may raise :exc:`OverflowError`, if the timestamp is " "outside the range of values supported by the platform C :c:func:`localtime` " @@ -358,70 +480,149 @@ msgid "" "c:func:`gmtime` failure. It's common for this to be restricted to years " "between 1970 and 2038." msgstr "" +":func:`localtime` μπορεί να κάνει raise :exc:`OverflowError`, αν η χρονική " +"σφραγίδα είναι εκτός του εύρους τιμών που υποστηρίζονται από τις πλατφόρμες " +"C :c:func:`localtime` ή :c:func:`gmtime` συναρτήσεις, και :exc:`OSError` σε :" +"c:func:`localtime` ή :c:func:`gmtime` αποτυχία. Είναι κοινό αυτό να " +"περιορίζεται σε έτη μεταξύ 1970 και 2038." -#: library/time.rst:273 +#: library/time.rst:277 msgid "" "This is the inverse function of :func:`localtime`. Its argument is the :" "class:`struct_time` or full 9-tuple (since the dst flag is needed; use " "``-1`` as the dst flag if it is unknown) which expresses the time in *local* " -"time, not UTC. It returns a floating point number, for compatibility with :" +"time, not UTC. It returns a floating-point number, for compatibility with :" "func:`.time`. If the input value cannot be represented as a valid time, " "either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " "depends on whether the invalid value is caught by Python or the underlying C " "libraries). The earliest date for which it can generate a time is platform-" "dependent." msgstr "" +"Αυτή είναι η αντίστροφη συνάρτηση της :func:`localtime`. Το όρισμά της είναι " +"η :class:`struct_time` ή πλήρης 9-πλειάδα (καθώς η σημαία dst είναι " +"απαραίτητη· χρησιμοποιήστε ``-1`` ως σημαία dst αν είναι άγνωστη) που " +"εκφράζει τον χρόνο σε *τοπική* ώρα, όχι σε UTC. Επιστρέφει έναν αριθμό " +"κινητής υποδιαστολής, για συμβατότητα με την :func:`.time`. Αν η τιμή " +"εισόδου δεν μπορεί να αναπαρασταθεί ως έγκυρος χρόνος, είτε :exc:" +"`OverflowError` είτε :exc:`ValueError` θα γίνει raise (που εξαρτάται από το " +"αν η μη έγκυρη τιμή πιαστεί από την Python ή τις υποκείμενες C βιβλιοθήκες). " +"Η πιο πρώιμη ημερομηνία για την οποία μπορεί να δημιουργήσει έναν χρόνο " +"εξαρτάται από την πλατφόρμα." -#: library/time.rst:285 +#: library/time.rst:289 msgid "" "Return the value (in fractional seconds) of a monotonic clock, i.e. a clock " "that cannot go backwards. The clock is not affected by system clock " "updates. The reference point of the returned value is undefined, so that " "only the difference between the results of two calls is valid." msgstr "" +"Επιστρέφει την τιμή (σε κλασματικά δευτερόλεπτα) ενός μονότονου ρολογιού, " +"δηλαδή ενός ρολογιού που δεν μπορεί να πάει πίσω. Το ρολόι δεν επηρεάζεται " +"από ενημερώσεις του συστήματος ρολογιού. Το σημείο αναφοράς της " +"επιστρεφόμενης τιμής είναι απροσδιόριστο, έτσι ώστε μόνο η διαφορά μεταξύ " +"των αποτελεσμάτων δύο κλήσεων να είναι έγκυρη." + +#: library/time.rst:715 +msgid "Clock:" +msgstr "Ρολόι:" + +#: library/time.rst:296 +msgid "" +"On Windows, call ``QueryPerformanceCounter()`` and " +"``QueryPerformanceFrequency()``." +msgstr "" +"Στα Windows, καλέστε τα ``QueryPerformanceCounter()`` και " +"``QueryPerformanceFrequency()``." + +#: library/time.rst:298 +msgid "On macOS, call ``mach_absolute_time()`` and ``mach_timebase_info()``." +msgstr "" +"Στο macOS, καλέστε τα ``mach_absolute_time()`` και ``mach_timebase_info()``." + +#: library/time.rst:299 +msgid "On HP-UX, call ``gethrtime()``." +msgstr "Στο HP-UX, καλέστε το ``gethrtime()``." + +#: library/time.rst:300 +msgid "Call ``clock_gettime(CLOCK_HIGHRES)`` if available." +msgstr "Καλέστε το ``clock_gettime(CLOCK_HIGHRES)`` αν είναι διαθέσιμο." -#: library/time.rst:290 +#: library/time.rst:301 +msgid "Otherwise, call ``clock_gettime(CLOCK_MONOTONIC)``." +msgstr "Αλλιώς, καλέστε το ``clock_gettime(CLOCK_MONOTONIC)``." + +#: library/time.rst:303 msgid "" "Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +"Χρησιμοποιήστε την :func:`monotonic_ns` για να αποφύγετε την απώλεια " +"ακρίβειας που προκαλείται από τον τύπο :class:`float`." -#: library/time.rst:295 -msgid "The function is now always available and always system-wide." +#: library/time.rst:308 +msgid "" +"The function is now always available and the clock is now the same for all " +"processes." msgstr "" +"Η συνάρτηση είναι τώρα πάντα διαθέσιμη και το ρολόι είναι τώρα ίδιο για όλες " +"τις διαδικασίες." -#: library/time.rst:298 -msgid "On macOS, the function is now system-wide." -msgstr "" +#: library/time.rst:312 +msgid "On macOS, the clock is now the same for all processes." +msgstr "Στο macOS, το ρολόι είναι τώρα ίδιο για όλες τις διαδικασίες." -#: library/time.rst:304 +#: library/time.rst:318 msgid "Similar to :func:`monotonic`, but return time as nanoseconds." msgstr "" +"Παρόμοιο με την :func:`monotonic`, αλλά επιστρέφει τον χρόνο σε " +"νανοδευτερόλεπτα." -#: library/time.rst:313 +#: library/time.rst:327 msgid "" "Return the value (in fractional seconds) of a performance counter, i.e. a " "clock with the highest available resolution to measure a short duration. It " -"does include time elapsed during sleep and is system-wide. The reference " -"point of the returned value is undefined, so that only the difference " -"between the results of two calls is valid." +"does include time elapsed during sleep. The clock is the same for all " +"processes. The reference point of the returned value is undefined, so that " +"only the difference between the results of two calls is valid." +msgstr "" +"Επιστρέφει την τιμή (σε κλασματικά δευτερόλεπτα) ενός μετρητή απόδοσης, " +"δηλαδή ενός ρολογιού με την υψηλότερη διαθέσιμη ανάλυση για τη μέτρηση μιας " +"σύντομης διάρκειας. Περιλαμβάνει τον χρόνο που πέρασε κατά τη διάρκεια του " +"ύπνου. Το ρολόι είναι το ίδιο για όλες τις διαδικασίες. Το σημείο αναφοράς " +"της επιστρεφόμενης τιμής είναι απροσδιόριστο, έτσι ώστε μόνο η διαφορά " +"μεταξύ των αποτελεσμάτων δύο κλήσεων να είναι έγκυρη." + +#: library/time.rst:336 +msgid "" +"On CPython, use the same clock as :func:`time.monotonic` and is a monotonic " +"clock, i.e. a clock that cannot go backwards." msgstr "" +"Στο CPython, χρησιμοποιεί το ίδιο ρολόι με την :func:`time.monotonic` και " +"είναι ένα μονότονο ρολόι, δηλαδή ένα ρολόι που δεν μπορεί να πάει πίσω." -#: library/time.rst:319 +#: library/time.rst:339 msgid "" "Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +"Χρησιμοποιήστε την :func:`perf_counter_ns` για να αποφύγετε την απώλεια " +"ακρίβειας που προκαλείται από τον τύπο :class:`float`." -#: library/time.rst:324 -msgid "On Windows, the function is now system-wide." -msgstr "" +#: library/time.rst:344 +msgid "On Windows, the clock is now the same for all processes." +msgstr "Στα Windows, το ρολόι είναι τώρα ίδιο για όλες τις διαδικασίες." -#: library/time.rst:329 +#: library/time.rst:347 +msgid "Use the same clock as :func:`time.monotonic`." +msgstr "Χρησιμοποιεί το ίδιο ρολόι με την :func:`time.monotonic`." + +#: library/time.rst:353 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." msgstr "" +"Παρόμοιο με την :func:`perf_counter`, αλλά επιστρέφει τον χρόνο σε " +"νανοδευτερόλεπτα." -#: library/time.rst:341 +#: library/time.rst:365 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current process. It does not include time elapsed during " @@ -429,77 +630,145 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls is valid." msgstr "" +"Επιστρέφει την τιμή (σε κλασματικά δευτερόλεπτα) του αθροίσματος του " +"συστήματος και του χρήστη CPU χρόνου της τρέχουσας διαδικασίας. Δεν " +"περιλαμβάνει τον χρόνο που πέρασε κατά τη διάρκεια του ύπνου. Είναι σε " +"επίπεδο διαδικασίας από τον ορισμό. Το σημείο αναφοράς της επιστρεφόμενης " +"τιμής είναι απροσδιόριστο, έτσι ώστε μόνο η διαφορά μεταξύ των αποτελεσμάτων " +"δύο κλήσεων να είναι έγκυρη." -#: library/time.rst:347 +#: library/time.rst:371 msgid "" "Use :func:`process_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +"Χρησιμοποιήστε την :func:`process_time_ns` για να αποφύγετε την απώλεια " +"ακρίβειας που προκαλείται από τον τύπο :class:`float`." -#: library/time.rst:354 +#: library/time.rst:378 msgid "Similar to :func:`process_time` but return time as nanoseconds." msgstr "" +"Παρόμοιο με την :func:`process_time` αλλά επιστρέφει τον χρόνο σε " +"νανοδευτερόλεπτα." -#: library/time.rst:360 +#: library/time.rst:384 msgid "" "Suspend execution of the calling thread for the given number of seconds. The " -"argument may be a floating point number to indicate a more precise sleep " +"argument may be a floating-point number to indicate a more precise sleep " "time." msgstr "" +"Αναστέλλει την εκτέλεση του καλούντος νήματος για τον δεδομένο αριθμό " +"δευτερολέπτων. Το όρισμα μπορεί να είναι ένας αριθμός κινητής υποδιαστολής " +"για να υποδείξει έναν πιο ακριβή χρόνο ύπνου." -#: library/time.rst:364 +#: library/time.rst:388 msgid "" "If the sleep is interrupted by a signal and no exception is raised by the " "signal handler, the sleep is restarted with a recomputed timeout." msgstr "" +"Αν ο ύπνος διακοπεί από ένα σήμα και δεν γίνει raise καμία εξαίρεση από τον " +"χειριστή σήματος, ο ύπνος επανεκκινείται με έναν επανυπολογισμένο χρόνο " +"λήξης." -#: library/time.rst:367 +#: library/time.rst:391 msgid "" "The suspension time may be longer than requested by an arbitrary amount, " "because of the scheduling of other activity in the system." msgstr "" +"Ο χρόνος αναστολής μπορεί να είναι μεγαλύτερος από τον ζητούμενο κατά " +"αυθαίρετο ποσό, λόγω του προγραμματισμού άλλων δραστηριοτήτων στο σύστημα." + +#: library/time.rst:395 +msgid "Windows implementation" +msgstr "Υλοποίηση Windows" -#: library/time.rst:370 +#: library/time.rst:396 msgid "" "On Windows, if *secs* is zero, the thread relinquishes the remainder of its " "time slice to any other thread that is ready to run. If there are no other " "threads ready to run, the function returns immediately, and the thread " -"continues execution. On Windows 8.1 and newer the implementation uses a " -"`high-resolution timer `_ which provides resolution of 100 " -"nanoseconds. If *secs* is zero, ``Sleep(0)`` is used." +"continues execution. On Windows 10 and newer the implementation uses a " +"`high-resolution timer `_ which provides resolution of " +"100 nanoseconds. If *secs* is zero, ``Sleep(0)`` is used." +msgstr "" +"Στα Windows, αν το *secs* είναι μηδέν, το νήμα παραχωρεί το υπόλοιπο του " +"χρόνου του σε οποιοδήποτε άλλο νήμα είναι έτοιμο να εκτελεστεί. Αν δεν " +"υπάρχουν άλλα νήματα έτοιμα να εκτελεστούν, η συνάρτηση επιστρέφει αμέσως " +"και το νήμα συνεχίζει την εκτέλεση. Στα Windows 10 και νεότερα, η υλοποίηση " +"χρησιμοποιεί έναν `χρονιστή υψηλής ακρίβειας `_ που παρέχει " +"ανάλυση των 100 νανοδευτερολέπτων. Αν το *secs* είναι μηδέν, χρησιμοποιείται " +"το ``Sleep(0)``." + +#: library/time.rst:405 +msgid "Unix implementation" +msgstr "Υλοποίηση Unix" + +#: library/time.rst:406 +msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "" +"Χρησιμοποιήστε το ``clock_nanosleep()`` αν είναι διαθέσιμο (ανάλυση: 1 " +"nanosecond)." -#: library/time.rst:378 -msgid "Unix implementation:" +#: library/time.rst:407 +msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "" +"Ή χρησιμοποιήστε το ``nanosleep()`` αν είναι διαθέσιμο (ανάλυση: 1 " +"nanosecond);" -#: library/time.rst:380 -msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" +#: library/time.rst:408 +msgid "Or use ``select()`` (resolution: 1 microsecond)." +msgstr "Ή χρησιμοποιήστε το ``select()`` (ανάλυση: 1 microsecond)." + +#: library/time.rst:412 +msgid "" +"To emulate a \"no-op\", use :keyword:`pass` instead of ``time.sleep(0)``." msgstr "" +"Για να μιμηθείτε μια \"no-op\", χρησιμοποιήστε το :keyword:`pass` αντί για " +"``time.sleep(0)``." -#: library/time.rst:381 -msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" +#: library/time.rst:414 +msgid "" +"To voluntarily relinquish the CPU, specify a real-time :ref:`scheduling " +"policy ` and use :func:`os.sched_yield` instead." msgstr "" +"Για να παραχωρήσετε εκούσια την CPU, καθορίστε μια πολιτική :ref:`scheduling " +"policy ` σε πραγματικό χρόνο και χρησιμοποιήστε την :" +"func:`os.sched_yield` αντί." -#: library/time.rst:382 -msgid "Or use ``select()`` (resolution: 1 microsecond)." +#: library/time.rst:417 +msgid "" +"Raises an :ref:`auditing event ` ``time.sleep`` with argument " +"``secs``." msgstr "" +"Κάνει raise ένα :ref:`auditing event ` ``time.sleep`` με όρισμα " +"``secs``." -#: library/time.rst:384 +#: library/time.rst:419 msgid "" "The function now sleeps at least *secs* even if the sleep is interrupted by " "a signal, except if the signal handler raises an exception (see :pep:`475` " "for the rationale)." msgstr "" +"Η συνάρτηση τώρα κοιμάται τουλάχιστον *secs* ακόμα και αν ο ύπνος διακοπεί " +"από ένα σήμα, εκτός αν ο χειριστής σήματος κάνει raise μια εξαίρεση (δείτε " +"το :pep:`475` για την αιτιολόγηση)." -#: library/time.rst:389 +#: library/time.rst:424 msgid "" "On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " "used if available. On Windows, a waitable timer is now used." msgstr "" +"Στο Unix, οι συναρτήσεις ``clock_nanosleep()`` και ``nanosleep()`` τώρα " +"χρησιμοποιούνται αν είναι διαθέσιμες. Στα Windows, τώρα χρησιμοποιείται ένας " +"χρονιστής που μπορεί να αναμένει." + +#: library/time.rst:428 +msgid "Raises an auditing event." +msgstr "Κάνει raise ένα auditing event." -#: library/time.rst:398 +#: library/time.rst:436 msgid "" "Convert a tuple or :class:`struct_time` representing a time as returned by :" "func:`gmtime` or :func:`localtime` to a string as specified by the *format* " @@ -507,314 +776,414 @@ msgid "" "`localtime` is used. *format* must be a string. :exc:`ValueError` is " "raised if any field in *t* is outside of the allowed range." msgstr "" +"Μετατρέπει μια πλειάδα ή :class:`struct_time` που αναπαριστά έναν χρόνο όπως " +"επιστρέφεται από την :func:`gmtime` ή :func:`localtime` σε μια συμβολοσειρά " +"όπως καθορίζεται από το όρισμα *format*. Αν το *t* δεν παρέχεται, " +"χρησιμοποιείται ο τρέχων χρόνος όπως επιστρέφεται από την :func:`localtime`. " +"Το *format* πρέπει να είναι μια συμβολοσειρά. Η :exc:`ValueError` γίνεται " +"raise αν οποιοδήποτε πεδίο στο *t* είναι εκτός του επιτρεπτού εύρους." -#: library/time.rst:404 +#: library/time.rst:442 msgid "" "0 is a legal argument for any position in the time tuple; if it is normally " "illegal the value is forced to a correct one." msgstr "" +"0 είναι ένα νόμιμο όρισμα για οποιαδήποτε θέση στην πλειάδα χρόνου· αν είναι " +"κανονικά παράνομο, η τιμή αναγκάζεται σε μια σωστή." -#: library/time.rst:407 +#: library/time.rst:445 msgid "" "The following directives can be embedded in the *format* string. They are " "shown without the optional field width and precision specification, and are " "replaced by the indicated characters in the :func:`strftime` result:" msgstr "" +"Οι ακόλουθες οδηγίες μπορούν να ενσωματωθούν στη συμβολοσειρά *format*. " +"Εμφανίζονται χωρίς την προαιρετική προδιαγραφή πλάτους πεδίου και ακρίβειας, " +"και αντικαθίστανται από τους υποδεικνυόμενους χαρακτήρες στο αποτέλεσμα της :" +"func:`strftime`:" -#: library/time.rst:412 +#: library/time.rst:450 msgid "Directive" -msgstr "" +msgstr "Οδηγία" -#: library/time.rst:412 +#: library/time.rst:450 msgid "Meaning" -msgstr "" +msgstr "Σημασία" -#: library/time.rst:412 +#: library/time.rst:450 msgid "Notes" -msgstr "" +msgstr "Σημειώσεις" -#: library/time.rst:414 +#: library/time.rst:452 msgid "``%a``" -msgstr "" +msgstr "``%a``" -#: library/time.rst:414 +#: library/time.rst:452 msgid "Locale's abbreviated weekday name." -msgstr "" +msgstr "Τοπικό συντομογραφημένο όνομα ημέρας της εβδομάδας." -#: library/time.rst:417 +#: library/time.rst:455 msgid "``%A``" -msgstr "" +msgstr "``%A``" -#: library/time.rst:417 +#: library/time.rst:455 msgid "Locale's full weekday name." -msgstr "" +msgstr "Τοπικό πλήρες όνομα ημέρας της εβδομάδας." -#: library/time.rst:419 +#: library/time.rst:457 msgid "``%b``" -msgstr "" +msgstr "``%b``" -#: library/time.rst:419 +#: library/time.rst:457 msgid "Locale's abbreviated month name." -msgstr "" +msgstr "Τοπικό συντομογραφημένο όνομα μήνα." -#: library/time.rst:422 +#: library/time.rst:460 msgid "``%B``" -msgstr "" +msgstr "``%B``" -#: library/time.rst:422 +#: library/time.rst:460 msgid "Locale's full month name." -msgstr "" +msgstr "Τοπικό πλήρες όνομα μήνα." -#: library/time.rst:424 +#: library/time.rst:462 msgid "``%c``" -msgstr "" +msgstr "``%c``" -#: library/time.rst:424 +#: library/time.rst:462 msgid "Locale's appropriate date and time representation." -msgstr "" +msgstr "Τοπική κατάλληλη αναπαράσταση ημερομηνίας και ώρας." -#: library/time.rst:427 +#: library/time.rst:465 msgid "``%d``" -msgstr "" +msgstr "``%d``" -#: library/time.rst:427 +#: library/time.rst:465 msgid "Day of the month as a decimal number [01,31]." -msgstr "" +msgstr "Ημέρα του μήνα ως δεκαδικός αριθμός [01,31]." -#: library/time.rst:430 +#: library/time.rst:468 msgid "``%f``" -msgstr "" +msgstr "``%f``" -#: library/time.rst:431 +#: library/time.rst:468 msgid "Microseconds as a decimal number" -msgstr "" +msgstr "Μικροδευτερόλεπτα ως δεκαδικός αριθμός" -#: library/time.rst:431 +#: library/time.rst:469 msgid "[000000,999999]." -msgstr "" +msgstr "[000000,999999]." -#: library/time.rst:430 +#: library/time.rst:468 msgid "\\(1)" -msgstr "" +msgstr "\\(1)" -#: library/time.rst:434 +#: library/time.rst:472 msgid "``%H``" -msgstr "" +msgstr "``%H``" -#: library/time.rst:434 +#: library/time.rst:472 msgid "Hour (24-hour clock) as a decimal number [00,23]." -msgstr "" +msgstr "Ώρα (ρολόι 24 ωρών) ως δεκαδικός αριθμός [00,23]." -#: library/time.rst:437 +#: library/time.rst:475 msgid "``%I``" -msgstr "" +msgstr "``%I``" -#: library/time.rst:437 +#: library/time.rst:475 msgid "Hour (12-hour clock) as a decimal number [01,12]." -msgstr "" +msgstr "Ώρα (ρολόι 12 ωρών) ως δεκαδικός αριθμός [01,12]." -#: library/time.rst:440 +#: library/time.rst:478 msgid "``%j``" -msgstr "" +msgstr "``%j``" -#: library/time.rst:440 +#: library/time.rst:478 msgid "Day of the year as a decimal number [001,366]." -msgstr "" +msgstr "Ημέρα του έτους ως δεκαδικός αριθμός [001,366]." -#: library/time.rst:443 +#: library/time.rst:481 msgid "``%m``" -msgstr "" +msgstr "``%m``" -#: library/time.rst:443 +#: library/time.rst:481 msgid "Month as a decimal number [01,12]." -msgstr "" +msgstr "Μήνας ως δεκαδικός αριθμός [01,12]." -#: library/time.rst:446 +#: library/time.rst:484 msgid "``%M``" -msgstr "" +msgstr "``%M``" -#: library/time.rst:446 +#: library/time.rst:484 msgid "Minute as a decimal number [00,59]." -msgstr "" +msgstr "Λεπτό ως δεκαδικός αριθμός [00,59]." -#: library/time.rst:449 +#: library/time.rst:487 msgid "``%p``" -msgstr "" +msgstr "``%p``" -#: library/time.rst:449 +#: library/time.rst:487 msgid "Locale's equivalent of either AM or PM." -msgstr "" +msgstr "Τοπικό ισοδύναμο είτε του AM είτε του PM." -#: library/time.rst:449 +#: library/time.rst:487 msgid "\\(2)" -msgstr "" +msgstr "\\(2)" -#: library/time.rst:452 +#: library/time.rst:490 msgid "``%S``" -msgstr "" +msgstr "``%S``" -#: library/time.rst:452 +#: library/time.rst:490 msgid "Second as a decimal number [00,61]." -msgstr "" +msgstr "Δευτερόλεπτο ως δεκαδικός αριθμός [00,61]." -#: library/time.rst:452 +#: library/time.rst:490 msgid "\\(3)" -msgstr "" +msgstr "\\(3)" -#: library/time.rst:455 +#: library/time.rst:493 msgid "``%U``" -msgstr "" +msgstr "``%U``" -#: library/time.rst:455 +#: library/time.rst:493 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" +"Αριθμός εβδομάδας του έτους (η Κυριακή ως πρώτη ημέρα της εβδομάδας) ως " +"δεκαδικός αριθμός [00,53]. Όλες οι ημέρες σε ένα νέο έτος που προηγούνται " +"της πρώτης Κυριακής θεωρούνται ότι είναι στην εβδομάδα 0." -#: library/time.rst:466 +#: library/time.rst:507 msgid "\\(4)" +msgstr "\\(4)" + +#: library/time.rst:501 +msgid "``%u``" +msgstr "``%u``" + +#: library/time.rst:501 +msgid "Day of the week (Monday is 1; Sunday is 7) as a decimal number [1, 7]." msgstr "" +"Ημέρα της εβδομάδας (η Δευτέρα είναι 1· η Κυριακή είναι 7) ως δεκαδικός " +"αριθμός [1, 7]." -#: library/time.rst:463 +#: library/time.rst:504 msgid "``%w``" -msgstr "" +msgstr "``%w``" -#: library/time.rst:463 +#: library/time.rst:504 msgid "Weekday as a decimal number [0(Sunday),6]." -msgstr "" +msgstr "Ημέρα της εβδομάδας ως δεκαδικός αριθμός [0(Κυριακή),6]." -#: library/time.rst:466 +#: library/time.rst:507 msgid "``%W``" -msgstr "" +msgstr "``%W``" -#: library/time.rst:466 +#: library/time.rst:507 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" +"Αριθμός εβδομάδας του έτους (η Δευτέρα ως πρώτη ημέρα της εβδομάδας) ως " +"δεκαδικός αριθμός [00,53]. Όλες οι ημέρες σε ένα νέο έτος που προηγούνται " +"της πρώτης Δευτέρας θεωρούνται ότι είναι στην εβδομάδα 0." -#: library/time.rst:474 +#: library/time.rst:515 msgid "``%x``" -msgstr "" +msgstr "``%x``" -#: library/time.rst:474 +#: library/time.rst:515 msgid "Locale's appropriate date representation." -msgstr "" +msgstr "Τοπική κατάλληλη αναπαράσταση ημερομηνίας." -#: library/time.rst:477 +#: library/time.rst:518 msgid "``%X``" -msgstr "" +msgstr "``%X``" -#: library/time.rst:477 +#: library/time.rst:518 msgid "Locale's appropriate time representation." -msgstr "" +msgstr "Τοπική κατάλληλη αναπαράσταση ώρας." -#: library/time.rst:480 +#: library/time.rst:521 msgid "``%y``" -msgstr "" +msgstr "``%y``" -#: library/time.rst:480 +#: library/time.rst:521 msgid "Year without century as a decimal number [00,99]." -msgstr "" +msgstr "Έτος χωρίς αιώνα ως δεκαδικός αριθμός [00,99]." -#: library/time.rst:483 +#: library/time.rst:524 msgid "``%Y``" -msgstr "" +msgstr "``%Y``" -#: library/time.rst:483 +#: library/time.rst:524 msgid "Year with century as a decimal number." -msgstr "" +msgstr "Έτος με αιώνα ως δεκαδικός αριθμός." -#: library/time.rst:486 +#: library/time.rst:527 msgid "``%z``" -msgstr "" +msgstr "``%z``" -#: library/time.rst:486 +#: library/time.rst:527 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " "represents decimal minute digits [-23:59, +23:59]. [1]_" msgstr "" +"Μετατόπιση ζώνης ώρας που υποδεικνύει μια θετική ή αρνητική χρονική διαφορά " +"από το UTC/GMT της μορφής +HHMM ή -HHMM, όπου το H αντιπροσωπεύει δεκαδικά " +"ψηφία ώρας και το M αντιπροσωπεύει δεκαδικά ψηφία λεπτών [-23:59, +23:59]. " +"[1]_" -#: library/time.rst:492 +#: library/time.rst:533 msgid "``%Z``" -msgstr "" +msgstr "``%Z``" -#: library/time.rst:492 +#: library/time.rst:533 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "" +"Όνομα ζώνης ώρας (κανένας χαρακτήρας αν δεν υπάρχει ζώνη ώρας). " +"Απαρχαιωμένο. [1]_" -#: library/time.rst:495 -msgid "``%%``" +#: library/time.rst:536 +msgid "``%G``" +msgstr "``%G``" + +#: library/time.rst:536 +msgid "" +"ISO 8601 year (similar to ``%Y`` but follows the rules for the ISO 8601 " +"calendar year). The year starts with the week that contains the first " +"Thursday of the calendar year." msgstr "" +"ISO 8601 έτος (παρόμοιο με το ``%Y`` αλλά ακολουθεί τους κανόνες για το ISO " +"8601 ημερολογιακό έτος). Το έτος ξεκινά με την εβδομάδα που περιέχει την " +"πρώτη Πέμπτη του ημερολογιακού έτους." -#: library/time.rst:495 -msgid "A literal ``'%'`` character." +#: library/time.rst:541 +msgid "``%V``" +msgstr "``%V``" + +#: library/time.rst:541 +msgid "" +"ISO 8601 week number (as a decimal number [01,53]). The first week of the " +"year is the one that contains the first Thursday of the year. Weeks start on " +"Monday." msgstr "" +"ISO 8601 αριθμός εβδομάδας (ως δεκαδικός αριθμός [01,53]). Η πρώτη εβδομάδα " +"του έτους είναι αυτή που περιέχει την πρώτη Πέμπτη του έτους. Οι εβδομάδες " +"ξεκινούν τη Δευτέρα." + +#: library/time.rst:546 +msgid "``%%``" +msgstr "``%%``" + +#: library/time.rst:546 +msgid "A literal ``'%'`` character." +msgstr "Ένας κυριολεκτικός χαρακτήρας ``'%'``." -#: library/time.rst:498 +#: library/time.rst:549 msgid "Notes:" -msgstr "" +msgstr "Σημειώσεις:" -#: library/time.rst:501 +#: library/time.rst:552 msgid "" "The ``%f`` format directive only applies to :func:`strptime`, not to :func:" "`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" "`datetime.datetime.strftime` where the ``%f`` format directive :ref:`applies " "to microseconds `." msgstr "" +"Η οδηγία μορφοποίησης ``%f`` εφαρμόζεται μόνο στην :func:`strptime`, όχι " +"στην :func:`strftime`. Ωστόσο, δείτε επίσης την :meth:`datetime.datetime." +"strptime` και την :meth:`datetime.datetime.strftime` όπου η οδηγία " +"μορφοποίησης ``%f`` :ref:`εφαρμόζεται στα μικροδευτερόλεπτα `." -#: library/time.rst:507 +#: library/time.rst:558 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " "hour." msgstr "" +"Όταν χρησιμοποιείται με τη συνάρτηση :func:`strptime`, η οδηγία ``%p`` " +"επηρεάζει μόνο το πεδίο ώρας εξόδου αν η οδηγία ``%I`` χρησιμοποιείται για " +"την ανάλυση της ώρας." -#: library/time.rst:513 +#: library/time.rst:564 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " "reasons." msgstr "" +"Το εύρος είναι πραγματικά από ``0`` έως ``61``· η τιμή ``60`` είναι έγκυρη " +"σε χρονικές σφραγίδες που αναπαριστούν `leap seconds`_ και η τιμή ``61`` " +"υποστηρίζεται για ιστορικούς λόγους." -#: library/time.rst:518 +#: library/time.rst:569 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." msgstr "" +"Όταν χρησιμοποιείται με τη συνάρτηση :func:`strptime`, τα ``%U`` και ``%W`` " +"χρησιμοποιούνται μόνο σε υπολογισμούς όταν η ημέρα της εβδομάδας και το έτος " +"καθορίζονται." -#: library/time.rst:521 +#: library/time.rst:572 msgid "" "Here is an example, a format for dates compatible with that specified in " -"the :rfc:`2822` Internet email standard. [1]_ ::" +"the :rfc:`5322` Internet email standard. [1]_ ::" msgstr "" +"Εδώ είναι ένα παράδειγμα, μια μορφή για ημερομηνίες συμβατή με αυτή που " +"καθορίζεται στο :rfc:`5322` πρότυπο ηλεκτρονικού ταχυδρομείου Internet. " +"[1]_ ::" -#: library/time.rst:528 +#: library/time.rst:575 +msgid "" +">>> from time import gmtime, strftime\n" +">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" +"'Thu, 28 Jun 2001 14:17:15 +0000'" +msgstr "" +">>> from time import gmtime, strftime\n" +">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" +"'Thu, 28 Jun 2001 14:17:15 +0000'" + +#: library/time.rst:579 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " "of format codes supported on your platform, consult the :manpage:" "`strftime(3)` documentation." msgstr "" +"Πρόσθετες οδηγίες μπορεί να υποστηρίζονται σε ορισμένες πλατφόρμες, αλλά " +"μόνο αυτές που αναφέρονται εδώ έχουν μια σημασία που τυποποιείται από την " +"ANSI C. Για να δείτε το πλήρες σύνολο κωδικών μορφοποίησης που " +"υποστηρίζονται στην πλατφόρμα σας, συμβουλευτείτε την τεκμηρίωση :manpage:" +"`strftime(3)`." -#: library/time.rst:533 +#: library/time.rst:584 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " "order; this is also not portable. The field width is normally 2 except for " "``%j`` where it is 3." msgstr "" +"Σε ορισμένες πλατφόρμες, μια προαιρετική προδιαγραφή πλάτους πεδίου και " +"ακρίβειας μπορεί να ακολουθεί αμέσως το αρχικό ``'%`` μιας οδηγίας με την " +"εξής σειρά· αυτό επίσης δεν είναι φορητό. Το πλάτος πεδίου είναι κανονικά 2 " +"εκτός από το ``%j`` όπου είναι 3." -#: library/time.rst:544 +#: library/time.rst:595 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." msgstr "" +"Ανάλυση μιας συμβολοσειράς που αναπαριστά έναν χρόνο σύμφωνα με μια μορφή. Η " +"επιστρεφόμενη τιμή είναι μια :class:`struct_time` όπως επιστρέφεται από την :" +"func:`gmtime` ή την :func:`localtime`." -#: library/time.rst:548 +#: library/time.rst:599 msgid "" "The *format* parameter uses the same directives as those used by :func:" "`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " @@ -824,20 +1193,33 @@ msgid "" "accurate values cannot be inferred are ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``. " "Both *string* and *format* must be strings." msgstr "" - -#: library/time.rst:556 +"Η παράμετρος *format* χρησιμοποιεί τις ίδιες οδηγίες με αυτές που " +"χρησιμοποιούνται από την :func:`strftime`; προεπιλέγεται σε ``\"%a %b %d %H:" +"%M:%S %Y\"`` που ταιριάζει με τη μορφοποίηση που επιστρέφεται από την :func:" +"`ctime`. Αν το *string* δεν μπορεί να αναλυθεί σύμφωνα με το *format*, ή αν " +"έχει πλεονάζοντα δεδομένα μετά την ανάλυση, γίνεται raise η :exc:" +"`ValueError`. Οι προεπιλεγμένες τιμές που χρησιμοποιούνται για να " +"συμπληρώσουν τυχόν ελλείποντα δεδομένα όταν δεν μπορούν να εξαχθούν πιο " +"ακριβείς τιμές είναι ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``. Τόσο το *string* " +"όσο και το *format* πρέπει να είναι συμβολοσειρές." + +#: library/time.rst:607 msgid "For example:" -msgstr "" +msgstr "Για παράδειγμα:" -#: library/time.rst:563 +#: library/time.rst:614 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " "platform-specific except for recognizing UTC and GMT which are always known " "(and are considered to be non-daylight savings timezones)." msgstr "" +"Η υποστήριξη για την οδηγία ``%Z`` βασίζεται στις τιμές που περιέχονται στο " +"``tzname`` και στο αν το ``daylight`` είναι αληθές. Εξαιτίας αυτού, είναι " +"ειδική για την πλατφόρμα εκτός από την αναγνώριση των UTC και GMT που είναι " +"πάντα γνωστά (και θεωρούνται ότι δεν είναι ζώνες ώρας θερινής ώρας)." -#: library/time.rst:568 +#: library/time.rst:619 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -845,151 +1227,181 @@ msgid "" "platform and thus does not necessarily support all directives available that " "are not documented as supported." msgstr "" +"Μόνο οι οδηγίες που καθορίζονται στην τεκμηρίωση υποστηρίζονται. Επειδή η " +"``strftime()`` υλοποιείται ανά πλατφόρμα, μπορεί μερικές φορές να προσφέρει " +"περισσότερες οδηγίες από αυτές που αναφέρονται. Αλλά η ``strptime()`` είναι " +"ανεξάρτητη από οποιαδήποτε πλατφόρμα και ως εκ τούτου δεν υποστηρίζει " +"απαραίτητα όλες τις διαθέσιμες οδηγίες που δεν τεκμηριώνονται ως " +"υποστηριζόμενες." -#: library/time.rst:577 +#: library/time.rst:628 msgid "" "The type of the time value sequence returned by :func:`gmtime`, :func:" "`localtime`, and :func:`strptime`. It is an object with a :term:`named " "tuple` interface: values can be accessed by index and by attribute name. " "The following values are present:" msgstr "" +"Ο τύπος της ακολουθίας τιμών χρόνου που επιστρέφεται από την :func:" +"`gmtime`, :func:`localtime`, και :func:`strptime`. Είναι ένα αντικείμενο με " +"μια :term:`named tuple` διεπαφή: οι τιμές μπορούν να προσπελαστεί με δείκτη " +"και με όνομα χαρακτηριστικού. Παρουσιάζονται οι ακόλουθες τιμές:" -#: library/time.rst:584 +#: library/time.rst:635 msgid "Index" -msgstr "" +msgstr "Δείκτης" -#: library/time.rst:585 +#: library/time.rst:636 msgid "Attribute" -msgstr "" +msgstr "Χαρακτηριστικό" -#: library/time.rst:586 +#: library/time.rst:637 msgid "Values" -msgstr "" +msgstr "Τιμές" -#: library/time.rst:588 +#: library/time.rst:639 msgid "0" -msgstr "" +msgstr "0" -#: library/time.rst:590 +#: library/time.rst:641 msgid "(for example, 1993)" -msgstr "" +msgstr "(για παράδειγμα, 1993)" -#: library/time.rst:592 +#: library/time.rst:643 msgid "1" -msgstr "" +msgstr "1" -#: library/time.rst:594 +#: library/time.rst:645 msgid "range [1, 12]" -msgstr "" +msgstr "εύρος [1, 12]" -#: library/time.rst:596 +#: library/time.rst:647 msgid "2" -msgstr "" +msgstr "2" -#: library/time.rst:598 +#: library/time.rst:649 msgid "range [1, 31]" -msgstr "" +msgstr "εύρος [1, 31]" -#: library/time.rst:600 +#: library/time.rst:651 msgid "3" -msgstr "" +msgstr "3" -#: library/time.rst:602 +#: library/time.rst:653 msgid "range [0, 23]" -msgstr "" +msgstr "εύρος [0, 23]" -#: library/time.rst:604 +#: library/time.rst:655 msgid "4" -msgstr "" +msgstr "4" -#: library/time.rst:606 +#: library/time.rst:657 msgid "range [0, 59]" -msgstr "" +msgstr "εύρος [0, 59]" -#: library/time.rst:608 +#: library/time.rst:659 msgid "5" -msgstr "" +msgstr "5" -#: library/time.rst:610 +#: library/time.rst:661 msgid "range [0, 61]; see :ref:`Note (2) ` in :func:`strftime`" msgstr "" +" εύρος [0, 61]; δείτε :ref:`Note (2) ` στην :func:`strftime`" -#: library/time.rst:612 +#: library/time.rst:663 msgid "6" -msgstr "" +msgstr "6" -#: library/time.rst:614 +#: library/time.rst:665 msgid "range [0, 6]; Monday is 0" -msgstr "" +msgstr "εύρος [0, 6]; η Δευτέρα είναι 0" -#: library/time.rst:616 +#: library/time.rst:667 msgid "7" -msgstr "" +msgstr "7" -#: library/time.rst:618 +#: library/time.rst:669 msgid "range [1, 366]" -msgstr "" +msgstr "εύρος [1, 366]" -#: library/time.rst:620 +#: library/time.rst:671 msgid "8" -msgstr "" +msgstr "8" -#: library/time.rst:622 +#: library/time.rst:673 msgid "0, 1 or -1; see below" -msgstr "" +msgstr "0, 1 ή -1; δείτε παρακάτω" -#: library/time.rst:628 +#: library/time.rst:679 msgid "N/A" -msgstr "" +msgstr "N/A" -#: library/time.rst:626 +#: library/time.rst:677 msgid "abbreviation of timezone name" -msgstr "" +msgstr "συντομογραφία ονόματος ζώνης ώρας" -#: library/time.rst:630 +#: library/time.rst:681 msgid "offset east of UTC in seconds" -msgstr "" +msgstr "μετατόπιση ανατολικά του UTC σε δευτερόλεπτα" -#: library/time.rst:632 +#: library/time.rst:683 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "" +"Σημειώστε ότι σε αντίθεση με τη δομή C, η τιμή του μήνα είναι σε εύρος [1, " +"12], όχι [0, 11]." -#: library/time.rst:635 +#: library/time.rst:686 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " "that this is not known, and will usually result in the correct state being " "filled in." msgstr "" +"Σε κλήσεις στην :func:`mktime`, το :attr:`tm_isdst` μπορεί να οριστεί σε 1 " +"όταν ισχύει η θερινή ώρα, και σε 0 όταν δεν ισχύει. Μια τιμή -1 υποδεικνύει " +"ότι αυτό δεν είναι γνωστό, και συνήθως θα έχει ως αποτέλεσμα τη συμπλήρωση " +"της σωστής κατάστασης." -#: library/time.rst:639 +#: library/time.rst:690 msgid "" "When a tuple with an incorrect length is passed to a function expecting a :" "class:`struct_time`, or having elements of the wrong type, a :exc:" "`TypeError` is raised." msgstr "" +"Όταν μια πλειάδα με λανθασμένο μήκος περνά σε μια συνάρτηση που αναμένει " +"μια :class:`struct_time`, ή έχει στοιχεία λάθος τύπου, γίνεται raise μια :" +"exc:`TypeError`." -#: library/time.rst:645 +#: library/time.rst:696 msgid "" -"Return the time in seconds since the epoch_ as a floating point number. The " +"Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " "systems, the leap seconds are not counted towards the time in seconds since " "the epoch_. This is commonly referred to as `Unix time `_." msgstr "" +"Επιστρέφει τον χρόνο σε δευτερόλεπτα από την epoch_ ως αριθμό κινητής " +"υποδιαστολής. Η διαχείριση των `leap seconds`_ εξαρτάται από την πλατφόρμα. " +"Στα Windows και στα περισσότερα συστήματα Unix, τα leap seconds δεν " +"υπολογίζονται στον χρόνο σε δευτερόλεπτα από την epoch_. Αυτό αναφέρεται " +"συνήθως ως `Unix time `_." -#: library/time.rst:651 +#: library/time.rst:702 msgid "" -"Note that even though the time is always returned as a floating point " +"Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " "While this function normally returns non-decreasing values, it can return a " "lower value than a previous call if the system clock has been set back " "between the two calls." msgstr "" +"Σημειώστε ότι παρόλο που ο χρόνος επιστρέφεται πάντα ως αριθμός κινητής " +"υποδιαστολής, όχι όλα τα συστήματα παρέχουν χρόνο με καλύτερη ακρίβεια από 1 " +"δευτερόλεπτο. Ενώ αυτή η συνάρτηση κανονικά επιστρέφει μη φθίνουσες τιμές, " +"μπορεί να επιστρέψει μια χαμηλότερη τιμή από μια προηγούμενη κλήση αν το " +"ρολόι του συστήματος έχει οριστεί πίσω μεταξύ των δύο κλήσεων." -#: library/time.rst:657 +#: library/time.rst:708 msgid "" "The number returned by :func:`.time` may be converted into a more common " "time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" @@ -998,20 +1410,50 @@ msgid "" "returned, from which the components of the calendar date may be accessed as " "attributes." msgstr "" +"Ο αριθμός που επιστρέφεται από την :func:`.time` μπορεί να μετατραπεί σε μια " +"πιο συνηθισμένη μορφή χρόνου (δηλαδή έτος, μήνας, ημέρα, ώρα, κ.λπ...) σε " +"UTC περνώντας τον στην :func:`gmtime` συνάρτηση ή σε τοπική ώρα περνώντας " +"τον στην :func:`localtime` συνάρτηση. Σε και τις δύο περιπτώσεις " +"επιστρέφεται ένα αντικείμενο :class:`struct_time`, από το οποίο τα στοιχεία " +"της ημερολογιακής ημερομηνίας μπορούν να προσπελαστούν ως χαρακτηριστικά." + +#: library/time.rst:717 +msgid "On Windows, call ``GetSystemTimePreciseAsFileTime()``." +msgstr "Στα Windows, καλέστε την ``GetSystemTimePreciseAsFileTime()``." -#: library/time.rst:664 +#: library/time.rst:718 +msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." +msgstr "Καλέστε την ``clock_gettime(CLOCK_REALTIME)`` αν είναι διαθέσιμη." + +#: library/time.rst:719 +msgid "Otherwise, call ``gettimeofday()``." +msgstr "Διαφορετικά, καλέστε την ``gettimeofday()``." + +#: library/time.rst:721 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "" +"Χρησιμοποιήστε την :func:`time_ns` για να αποφύγετε την απώλεια ακρίβειας " +"που προκαλείται από τον τύπο :class:`float`." + +#: library/time.rst:726 +msgid "" +"On Windows, calls ``GetSystemTimePreciseAsFileTime()`` instead of " +"``GetSystemTimeAsFileTime()``." +msgstr "" +"Στα Windows, καλέστε την ``GetSystemTimePreciseAsFileTime()`` αντί για την " +"``GetSystemTimeAsFileTime()``." -#: library/time.rst:670 +#: library/time.rst:732 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "" +"Παρόμοιο με την :func:`~time.time` αλλά επιστρέφει τον χρόνο ως ακέραιο " +"αριθμό νανοδευτερολέπτων από την epoch_." -#: library/time.rst:683 +#: library/time.rst:745 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1019,26 +1461,32 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls in the same thread is valid." msgstr "" +"Επιστρέφει την τιμή (σε κλάσματα δευτερολέπτου) του αθροίσματος του " +"συστήματος και του χρόνου CPU χρήστη του τρέχοντος νήματος. Δεν περιλαμβάνει " +"τον χρόνο που πέρασε κατά τη διάρκεια ύπνου. Είναι ειδικό για το νήμα από " +"τον ορισμό του. Το σημείο αναφοράς της επιστρεφόμενης τιμής είναι " +"απροσδιόριστο, έτσι ώστε μόνο η διαφορά μεταξύ των αποτελεσμάτων δύο κλήσεων " +"στο ίδιο νήμα να είναι έγκυρη." -#: library/time.rst:689 +#: library/time.rst:751 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +"Χρησιμοποιήστε την :func:`thread_time_ns` για να αποφύγετε την απώλεια " +"ακρίβειας που προκαλείται από τον τύπο :class:`float`." -#: library/time.rst:692 -msgid ":ref:`Availability `: Linux, Unix, Windows." -msgstr "" - -#: library/time.rst:694 +#: library/time.rst:756 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." -msgstr "" +msgstr "Συστήματα Unix που υποστηρίζουν το ``CLOCK_THREAD_CPUTIME_ID``." -#: library/time.rst:701 +#: library/time.rst:763 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "" +"Παρόμοιο με την :func:`thread_time` αλλά επιστρέφει τον χρόνο ως " +"νανοδευτερόλεπτα." -#: library/time.rst:708 +#: library/time.rst:770 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1048,99 +1496,158 @@ msgid "" "saving time rules, or to nonzero if there is a time, past, present or future " "when daylight saving time applies)." msgstr "" +"Επαναφέρει τους κανόνες μετατροπής χρόνου που χρησιμοποιούνται από τις " +"βιβλιοθήκες ρουτίνες. Η μεταβλητή περιβάλλοντος :envvar:`TZ` καθορίζει πώς " +"γίνεται αυτό. Θα ορίσει επίσης τις μεταβλητές ``tzname`` (από τη μεταβλητή " +"περιβάλλοντος :envvar:`TZ`), ``timezone`` (μη DST δευτερόλεπτα Δύση του " +"UTC), ``altzone`` (DST δευτερόλεπτα δυτικά του UTC) και ``daylight`` (σε 0 " +"αν αυτή η ζώνη ώρας δεν έχει κανόνες θερινής ώρας, ή σε μη μηδενικό αν " +"υπάρχει μια ώρα, παρελθούσα, παρούσα ή μελλοντική όταν ισχύει η θερινή ώρα)." -#: library/time.rst:720 +#: library/time.rst:782 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " "affect the output of functions like :func:`localtime` without calling :func:" "`tzset`, this behavior should not be relied on." msgstr "" +"Αν και σε πολλές περιπτώσεις, η αλλαγή της μεταβλητής περιβάλλοντος :envvar:" +"`TZ` μπορεί να επηρεάσει την έξοδο συναρτήσεων όπως η :func:`localtime` " +"χωρίς να καλέσει την :func:`tzset`, αυτή η συμπεριφορά δεν πρέπει να " +"βασίζεται." -#: library/time.rst:724 +#: library/time.rst:786 msgid "The :envvar:`TZ` environment variable should contain no whitespace." -msgstr "" +msgstr "Η μεταβλητή περιβάλλοντος :envvar:`TZ` δεν πρέπει να περιέχει κενά." -#: library/time.rst:726 +#: library/time.rst:788 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" +"Η τυπική μορφή της μεταβλητής περιβάλλοντος :envvar:`TZ` είναι (προστέθηκε " +"κενό για σαφήνεια)::" + +#: library/time.rst:791 +msgid "std offset [dst [offset [,start[/time], end[/time]]]]" +msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: library/time.rst:731 +#: library/time.rst:793 msgid "Where the components are:" -msgstr "" +msgstr "Όπου τα συστατικά είναι:" -#: library/time.rst:735 +#: library/time.rst:795 msgid "``std`` and ``dst``" -msgstr "" +msgstr "``std`` και ``dst``" -#: library/time.rst:734 +#: library/time.rst:796 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" +"Τρεις ή περισσότερες αλφαριθμητικές που δίνουν τις συντομογραφίες ζώνης " +"ώρας. Αυτές θα προωθηθούν στο time.tzname" -#: library/time.rst:741 +#: library/time.rst:799 msgid "``offset``" -msgstr "" +msgstr "``offset``" -#: library/time.rst:738 +#: library/time.rst:800 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " "of the Prime Meridian; otherwise, it is west. If no offset follows dst, " "summer time is assumed to be one hour ahead of standard time." msgstr "" +"Η μετατόπιση έχει τη μορφή: ``± hh[:mm[:ss]]``. Αυτό υποδεικνύει την τιμή " +"που προστίθεται στην τοπική ώρα για να φτάσει στο UTC. Εάν προηγείται από " +"'-', η ζώνη ώρας είναι ανατολικά του Πρώτου Μεσημβρινού· διαφορετικά, είναι " +"δυτικά. Αν δεν ακολουθεί μετατόπιση μετά το dst, η θερινή ώρα θεωρείται ότι " +"είναι μία ώρα μπροστά από την κανονική ώρα." -#: library/time.rst:763 +#: library/time.rst:805 msgid "``start[/time], end[/time]``" -msgstr "" +msgstr "``start[/time], end[/time]``" -#: library/time.rst:744 +#: library/time.rst:806 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" +"Υποδεικνύει πότε να αλλάξει σε και από το DST. Η μορφή των ημερομηνιών " +"έναρξης και λήξης είναι μία από τις ακόλουθες:" -#: library/time.rst:749 +#: library/time.rst:809 msgid ":samp:`J{n}`" -msgstr "" +msgstr ":samp:`J{n}`" -#: library/time.rst:748 +#: library/time.rst:810 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." msgstr "" +"Η Ιουλιανή ημέρα *n* (1 <= *n* <= 365). Οι δίσεκτες ημέρες δεν μετριούνται, " +"οπότε σε όλα τα έτη η 28η Φεβρουαρίου είναι η ημέρα 59 και η 1η Μαρτίου " +"είναι η ημέρα 60." -#: library/time.rst:753 +#: library/time.rst:813 msgid ":samp:`{n}`" -msgstr "" +msgstr ":samp:`{n}`" -#: library/time.rst:752 +#: library/time.rst:814 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" +"Η Ιουλιανή ημέρα με βάση το μηδέν (0 <= *n* <= 365). Οι δίσεκτες ημέρες " +"μετριούνται, και είναι δυνατόν να αναφερθεί η 29η Φεβρουαρίου." -#: library/time.rst:760 +#: library/time.rst:817 msgid ":samp:`M{m}.{n}.{d}`" -msgstr "" +msgstr ":samp:`M{m}.{n}.{d}`" -#: library/time.rst:756 +#: library/time.rst:818 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " "*m*\" which may occur in either the fourth or the fifth week). Week 1 is the " "first week in which the *d*'th day occurs. Day zero is a Sunday." msgstr "" +"Η *d*'η ημέρα (0 <= *d* <= 6) της εβδομάδας *n* του μήνα *m* του έτους (1 <= " +"*n* <= 5, 1 <= *m* <= 12, όπου η εβδομάδα 5 σημαίνει \"η τελευταία *d* ημέρα " +"στο μήνα *m*\" που μπορεί να συμβεί είτε στην τέταρτη είτε στην πέμπτη " +"εβδομάδα). Η εβδομάδα 1 είναι η πρώτη εβδομάδα στην οποία συμβαίνει η *d*'η " +"ημέρα. Η ημέρα μηδέν είναι η Κυριακή." -#: library/time.rst:762 +#: library/time.rst:824 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." msgstr "" +"Το ``time`` έχει την ίδια μορφή με την ``offset`` εκτός από το ότι δεν " +"επιτρέπεται προθετικός χαρακτήρας ('-' ή '+'). Η προεπιλογή, αν δεν δοθεί " +"χρόνος, είναι 02:00:00." + +#: library/time.rst:829 +msgid "" +">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" +">>> time.tzset()\n" +">>> time.strftime('%X %x %Z')\n" +"'02:07:36 05/08/03 EDT'\n" +">>> os.environ['TZ'] = 'AEST-10AEDT-11,M10.5.0,M3.5.0'\n" +">>> time.tzset()\n" +">>> time.strftime('%X %x %Z')\n" +"'16:08:12 05/08/03 AEST'" +msgstr "" +">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" +">>> time.tzset()\n" +">>> time.strftime('%X %x %Z')\n" +"'02:07:36 05/08/03 EDT'\n" +">>> os.environ['TZ'] = 'AEST-10AEDT-11,M10.5.0,M3.5.0'\n" +">>> time.tzset()\n" +">>> time.strftime('%X %x %Z')\n" +"'16:08:12 05/08/03 AEST'" -#: library/time.rst:776 +#: library/time.rst:838 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1150,154 +1657,214 @@ msgid "" "located at :file:`/usr/share/zoneinfo`. For example, ``'US/Eastern'``, " "``'Australia/Melbourne'``, ``'Egypt'`` or ``'Europe/Amsterdam'``. ::" msgstr "" +"Σε πολλά συστήματα Unix (συμπεριλαμβανομένων των \\*BSD, Linux, Solaris, και " +"Darwin), είναι πιο βολικό να χρησιμοποιήσετε τη βάση δεδομένων zoneinfo (:" +"manpage:`tzfile(5)`) του συστήματος για να καθορίσετε τους κανόνες ζώνης " +"ώρας. Για να το κάνετε αυτό, ορίστε τη μεταβλητή περιβάλλοντος :envvar:`TZ` " +"στη διαδρομή του απαιτούμενου αρχείου δεδομένων ζώνης ώρας, σε σχέση με τη " +"ρίζα της βάσης δεδομένων ζώνης ώρας 'zoneinfo' του συστήματος, που συνήθως " +"βρίσκεται στο :file:`/usr/share/zoneinfo`. Για παράδειγμα, ``'US/Eastern'``, " +"``'Australia/Melbourne'``, ``'Egypt'`` ή ``'Europe/Amsterdam'``. ::" + +#: library/time.rst:846 +msgid "" +">>> os.environ['TZ'] = 'US/Eastern'\n" +">>> time.tzset()\n" +">>> time.tzname\n" +"('EST', 'EDT')\n" +">>> os.environ['TZ'] = 'Egypt'\n" +">>> time.tzset()\n" +">>> time.tzname\n" +"('EET', 'EEST')" +msgstr "" +">>> os.environ['TZ'] = 'US/Eastern'\n" +">>> time.tzset()\n" +">>> time.tzname\n" +"('EST', 'EDT')\n" +">>> os.environ['TZ'] = 'Egypt'\n" +">>> time.tzset()\n" +">>> time.tzname\n" +"('EET', 'EEST')" -#: library/time.rst:797 +#: library/time.rst:859 msgid "Clock ID Constants" -msgstr "" +msgstr "Σταθερές αναγνωριστικού ρολογιού" -#: library/time.rst:799 +#: library/time.rst:861 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." msgstr "" +"Αυτές οι σταθερές χρησιμοποιούνται ως παράμετροι για την :func:" +"`clock_getres` και την :func:`clock_gettime`." -#: library/time.rst:804 +#: library/time.rst:866 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" +"Ταυτόσημο με το :data:`CLOCK_MONOTONIC`, εκτός από το ότι περιλαμβάνει " +"επίσης οποιονδήποτε χρόνο που το σύστημα είναι σε αναστολή." -#: library/time.rst:807 +#: library/time.rst:869 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " "have discontinuities if the time is changed using ``settimeofday()`` or " "similar." msgstr "" +"Αυτό επιτρέπει στις εφαρμογές να λαμβάνουν ένα ρολόι μονότονο με επίγνωση " +"αναστολής χωρίς να χρειάζεται να αντιμετωπίσουν τις επιπλοκές του :data:" +"`CLOCK_REALTIME`, το οποίο μπορεί να έχει ασυνέχειες εάν ο χρόνος αλλάξει " +"χρησιμοποιώντας την ``settimeofday()`` ή παρόμοια." -#: library/time.rst:812 -msgid ":ref:`Availability `: Linux >= 2.6.39." -msgstr "" - -#: library/time.rst:819 +#: library/time.rst:881 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" +"Το λειτουργικό σύστημα Solaris διαθέτει ένα χρονόμετρο ``CLOCK_HIGHRES`` που " +"προσπαθεί να χρησιμοποιήσει μια βέλτιστη πηγή υλικού και μπορεί να δώσει " +"σχεδόν ανάλυση νανοδευτερολέπτων. Το ``CLOCK_HIGHRES`` είναι το μη " +"ρυθμιζόμενο, ρολόι υψηλής ανάλυσης." -#: library/time.rst:823 -msgid ":ref:`Availability `: Solaris." -msgstr "" - -#: library/time.rst:830 +#: library/time.rst:892 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "" +"Ρολόι που δεν μπορεί να ρυθμιστεί και αντιπροσωπεύει τον μονότονο χρόνο από " +"ένα απροσδιόριστο σημείο εκκίνησης." -#: library/time.rst:840 +#: library/time.rst:902 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." msgstr "" +"Παρόμοιο με το :data:`CLOCK_MONOTONIC`, αλλά παρέχει πρόσβαση σε έναν " +"ακατέργαστο χρόνο βασισμένο σε υλικό που δεν υπόκειται σε ρυθμίσεις NTP." -#: library/time.rst:843 -msgid ":ref:`Availability `: Linux >= 2.6.28, macOS >= 10.12." +#: library/time.rst:911 +msgid "" +"Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " +"system at context switch and hence has less accuracy." msgstr "" +"Παρόμοιο με το :data:`CLOCK_MONOTONIC_RAW`, αλλά διαβάζει μια τιμή που έχει " +"αποθηκευτεί στην κρυφή μνήμη από το σύστημα κατά την αλλαγή πλαισίου και " +"επομένως έχει λιγότερη ακρίβεια." -#: library/time.rst:859 +#: library/time.rst:930 msgid "High-resolution per-process timer from the CPU." -msgstr "" +msgstr "Υψηλής ανάλυσης χρονομετρητής ανά διεργασία από την CPU." -#: library/time.rst:861 -msgid ":ref:`Availability `: FreeBSD, NetBSD >= 7, OpenBSD." -msgstr "" - -#: library/time.rst:867 +#: library/time.rst:938 msgid "" "`International Atomic Time `_" +"division/how-utcnist-related-coordinated-universal-time-utc-international>`_" msgstr "" +"`International Atomic Time `_" -#: library/time.rst:869 +#: library/time.rst:940 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" +"Το σύστημα πρέπει να έχει έναν τρέχοντα πίνακα leap second για να δώσει τη " +"σωστή απάντηση. Το λογισμικό PTP ή NTP μπορεί να διατηρήσει έναν πίνακα leap " +"second." -#: library/time.rst:872 -msgid ":ref:`Availability `: Linux." -msgstr "" - -#: library/time.rst:878 +#: library/time.rst:949 msgid "Thread-specific CPU-time clock." -msgstr "" +msgstr "Ρολόι χρόνου CPU ειδικό για νήμα." -#: library/time.rst:887 +#: library/time.rst:958 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" +"Χρόνος της απόλυτης τιμής του οποίου είναι ο χρόνος που το σύστημα " +"λειτουργεί και δεν έχει ανασταλεί, παρέχοντας ακριβή μέτρηση χρόνου " +"λειτουργίας, τόσο απόλυτη όσο και διαστήματος." -#: library/time.rst:891 -msgid ":ref:`Availability `: FreeBSD, OpenBSD >= 5.5." -msgstr "" - -#: library/time.rst:898 +#: library/time.rst:969 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " "the system is asleep." msgstr "" +"Ρολόι που αυξάνεται μονότονα, παρακολουθώντας τον χρόνο από ένα αυθαίρετο " +"σημείο, ανεπηρέαστο από ρυθμίσεις συχνότητας ή χρόνου και δεν αυξάνεται ενώ " +"το σύστημα είναι σε κατάσταση ύπνου." -#: library/time.rst:902 -msgid ":ref:`Availability `: macOS >= 10.12." +#: library/time.rst:979 +msgid "" +"Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " +"context switches and therefore has less accuracy." msgstr "" +"Όπως το :data:`CLOCK_UPTIME_RAW`, αλλά η τιμή αποθηκεύεται στην κρυφή μνήμη " +"από το σύστημα κατά τις αλλαγές πλαισίου και επομένως έχει λιγότερη ακρίβεια." -#: library/time.rst:906 +#: library/time.rst:986 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." msgstr "" +"The following constant is the only parameter that can be sent to :func:" +"`clock_settime`." -#: library/time.rst:912 +#: library/time.rst:992 msgid "" -"System-wide real-time clock. Setting this clock requires appropriate " -"privileges." +"Real-time clock. Setting this clock requires appropriate privileges. The " +"clock is the same for all processes." msgstr "" +"Ρολόι πραγματικού χρόνου. Η ρύθμιση αυτού του ρολογιού απαιτεί κατάλληλα " +"προνόμια. Το ρολόι είναι το ίδιο για όλες τις διεργασίες." -#: library/time.rst:923 +#: library/time.rst:1003 msgid "Timezone Constants" -msgstr "" +msgstr "Σταθερές ζώνης ώρας" -#: library/time.rst:927 +#: library/time.rst:1007 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " "Western Europe, including the UK). Only use this if ``daylight`` is " "nonzero. See note below." msgstr "" +"Η μετατόπιση της τοπικής ζώνης ώρας DST, σε δευτερόλεπτα δυτικά του UTC, αν " +"είναι ορισμένη. Αυτό είναι αρνητικό αν η τοπική ζώνη ώρας DST είναι " +"ανατολικά του UTC (όπως στη Δυτική Ευρώπη, συμπεριλαμβανομένου του Ηνωμένου " +"Βασιλείου). Χρησιμοποιήστε αυτό μόνο αν το ``daylight`` είναι μη μηδενικό. " +"Δείτε την σημείωση παρακάτω." -#: library/time.rst:933 +#: library/time.rst:1013 msgid "Nonzero if a DST timezone is defined. See note below." -msgstr "" +msgstr "Μη μηδενικό αν οριστεί μια ζώνη ώρας DST. Δείτε την σημείωση παρακάτω." -#: library/time.rst:937 +#: library/time.rst:1017 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " "below." msgstr "" +"Η μετατόπιση της τοπικής (μη DST) ζώνης ώρας, σε δευτερόλεπτα δυτικά του UTC " +"(αρνητικό στο μεγαλύτερο μέρος της Δυτικής Ευρώπης, θετικό στις ΗΠΑ, μηδέν " +"στο Ηνωμένο Βασίλειο). Δείτε την σημείωση παρακάτω." -#: library/time.rst:942 +#: library/time.rst:1022 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " "defined, the second string should not be used. See note below." msgstr "" +"Μια πλειάδα από δύο συμβολοσειρές: η πρώτη είναι το όνομα της τοπικής μη DST " +"ζώνης ώρας, η δεύτερη είναι το όνομα της τοπικής ζώνης ώρας DST. Αν δεν " +"οριστεί ζώνη ώρας DST, η δεύτερη συμβολοσειρά δεν πρέπει να χρησιμοποιηθεί. " +"Δείτε την σημείωση παρακάτω." -#: library/time.rst:948 +#: library/time.rst:1028 msgid "" "For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" "`timezone`, and :data:`tzname`), the value is determined by the timezone " @@ -1306,41 +1873,53 @@ msgid "" "attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` results from :" "func:`localtime` to obtain timezone information." msgstr "" +"Για τις παραπάνω σταθερές ζώνες ώρας (:data:`altzone`, :data:`daylight`, :" +"data:`timezone`, και :data:`tzname`), η τιμή καθορίζεται από τους κανόνες " +"ζώνης ώρας που ισχύουν κατά το χρόνο φόρτωσης της μονάδας ή την τελευταία " +"φορά που καλείται η :func:`tzset` και μπορεί να είναι λανθασμένη για χρόνους " +"στο παρελθόν. Συνιστάται να χρησιμοποιείτε τα :attr:`~struct_time.tm_gmtoff` " +"και :attr:`~struct_time.tm_zone` αποτελέσματα από την :func:`localtime` για " +"να λάβετε πληροφορίες ζώνης ώρας." -#: library/time.rst:958 +#: library/time.rst:1037 msgid "Module :mod:`datetime`" -msgstr "" +msgstr "Module :mod:`datetime`" -#: library/time.rst:958 +#: library/time.rst:1038 msgid "More object-oriented interface to dates and times." -msgstr "" +msgstr "Πιο αντικειμενοστραφής διεπαφή για ημερομηνίες και ώρες." -#: library/time.rst:962 +#: library/time.rst:1040 msgid "Module :mod:`locale`" -msgstr "" +msgstr "Module :mod:`locale`" -#: library/time.rst:961 +#: library/time.rst:1041 msgid "" "Internationalization services. The locale setting affects the " "interpretation of many format specifiers in :func:`strftime` and :func:" "`strptime`." msgstr "" +"Υπηρεσίες διεθνοποίησης. Η ρύθμιση τοπικής ρυθμίσεως επηρεάζει την ερμηνεία " +"πολλών προδιαγραφών μορφοποίησης στην :func:`strftime` και την :func:" +"`strptime`." -#: library/time.rst:965 +#: library/time.rst:1044 msgid "Module :mod:`calendar`" -msgstr "" +msgstr "Module :mod:`calendar`" -#: library/time.rst:965 +#: library/time.rst:1045 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." msgstr "" +"Γενικές συναρτήσεις σχετικές με το ημερολόγιο. Η :func:`~calendar.timegm` " +"είναι η αντίστροφη της :func:`gmtime` από αυτή τη μονάδα." -#: library/time.rst:969 +#: library/time.rst:1049 msgid "Footnotes" -msgstr "" +msgstr "Υποσημειώσεις" -#: library/time.rst:970 +#: library/time.rst:1050 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1348,53 +1927,69 @@ msgid "" "two-digit year (``%y`` rather than ``%Y``), but practice moved to 4-digit " "years long before the year 2000. After that, :rfc:`822` became obsolete and " "the 4-digit year has been first recommended by :rfc:`1123` and then mandated " -"by :rfc:`2822`." +"by :rfc:`2822`, with :rfc:`5322` continuing this requirement." msgstr "" +"Η χρήση του ``%Z`` είναι πλέον αποσυρμένη, αλλά η διαφυγή ``%z`` που " +"επεκτείνεται σε την προτιμώμενη μετατόπιση ώρας/λεπτού δεν υποστηρίζεται από " +"όλες τις βιβλιοθήκες ANSI C. Επίσης, μια αυστηρή ανάγνωση του αρχικού " +"προτύπου :rfc:`822` του 1982 απαιτεί ένα διψήφιο έτος (``%y`` αντί για " +"``%Y``), αλλά η πρακτική μετακινήθηκε σε έτη με 4 ψηφία πολύ πριν από το " +"έτος 2000. Μετά από αυτό, το :rfc:`822` έγινε παρωχημένο και το έτος με 4 " +"ψηφία έχει προταθεί πρώτα από το :rfc:`1123` και στη συνέχεια επιβλήθηκε από " +"το :rfc:`2822`, με το :rfc:`5322` να συνεχίζει αυτή την απαίτηση." #: library/time.rst:22 msgid "epoch" -msgstr "" +msgstr "epoch" #: library/time.rst:36 msgid "Year 2038" -msgstr "" +msgstr "Έτος 2038" #: library/time.rst:42 msgid "2-digit years" -msgstr "" +msgstr "Έτη με 2 ψηφία" #: library/time.rst:50 msgid "UTC" -msgstr "" +msgstr "UTC" #: library/time.rst:50 msgid "Coordinated Universal Time" -msgstr "" +msgstr "Συντονισμένη Παγκόσμια Ώρα" #: library/time.rst:50 msgid "Greenwich Mean Time" -msgstr "" +msgstr "Μεσημβρινή Ώρα Γκρίνουιτς" -#: library/time.rst:59 +#: library/time.rst:63 msgid "Daylight Saving Time" -msgstr "" +msgstr "Θερινή Ώρα" -#: library/time.rst:336 library/time.rst:678 +#: library/time.rst:360 library/time.rst:740 msgid "benchmarking" -msgstr "" +msgstr "μετρήσεις απόδοσης" -#: library/time.rst:678 +#: library/time.rst:740 msgid "CPU time" -msgstr "" +msgstr "χρόνος CPU" -#: library/time.rst:678 +#: library/time.rst:740 msgid "processor time" -msgstr "" +msgstr "χρόνος επεξεργαστή" -#: library/time.rst:539 +#: library/time.rst:590 msgid "% (percent)" -msgstr "" +msgstr "% (ποσοστό)" -#: library/time.rst:539 +#: library/time.rst:590 msgid "datetime format" -msgstr "" +msgstr "μορφή ημερομηνίας και ώρας" + +#~ msgid "" +#~ "*adjustable*: ``True`` if the clock can be changed automatically (e.g. by " +#~ "a NTP daemon) or manually by the system administrator, ``False`` otherwise" +#~ msgstr "" +#~ "*adjustable*: ``True`` αν το ρολόι μπορεί να αλλάξει αυτόματα (π.χ. από " +#~ "ένα NTP daemon) ή χειροκίνητα από τον διαχειριστή συστήματος, διαφορετικά " +#~ "``False``" diff --git a/library/timeit.po b/library/timeit.po index 0dff0724..6be0a3ad 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/timeit.rst:2 -msgid ":mod:`timeit` --- Measure execution time of small code snippets" +msgid ":mod:`!timeit` --- Measure execution time of small code snippets" msgstr "" #: library/timeit.rst:7 @@ -43,14 +44,41 @@ msgid "" "be used to compare three different expressions:" msgstr "" +#: library/timeit.rst:28 +msgid "" +"$ python -m timeit \"'-'.join(str(n) for n in range(100))\"\n" +"10000 loops, best of 5: 30.2 usec per loop\n" +"$ python -m timeit \"'-'.join([str(n) for n in range(100)])\"\n" +"10000 loops, best of 5: 27.5 usec per loop\n" +"$ python -m timeit \"'-'.join(map(str, range(100)))\"\n" +"10000 loops, best of 5: 23.2 usec per loop" +msgstr "" + #: library/timeit.rst:37 msgid "This can be achieved from the :ref:`python-interface` with::" msgstr "" +#: library/timeit.rst:39 +msgid "" +">>> import timeit\n" +">>> timeit.timeit('\"-\".join(str(n) for n in range(100))', number=10000)\n" +"0.3018611848820001\n" +">>> timeit.timeit('\"-\".join([str(n) for n in range(100)])', number=10000)\n" +"0.2727368790656328\n" +">>> timeit.timeit('\"-\".join(map(str, range(100)))', number=10000)\n" +"0.23702679807320237" +msgstr "" + #: library/timeit.rst:47 msgid "A callable can also be passed from the :ref:`python-interface`::" msgstr "" +#: library/timeit.rst:49 +msgid "" +">>> timeit.timeit(lambda: \"-\".join(map(str, range(100))), number=10000)\n" +"0.19665591977536678" +msgstr "" + #: library/timeit.rst:52 msgid "" "Note however that :func:`.timeit` will automatically determine the number of " @@ -156,6 +184,10 @@ msgid "" "example::" msgstr "" +#: library/timeit.rst:143 +msgid "timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()" +msgstr "" + #: library/timeit.rst:148 msgid "Automatically determine how many times to call :meth:`.timeit`." msgstr "" @@ -207,6 +239,15 @@ msgstr "" msgid "Typical use::" msgstr "" +#: library/timeit.rst:193 +msgid "" +"t = Timer(...) # outside the try/except\n" +"try:\n" +" t.timeit(...) # or t.repeat(...)\n" +"except Exception:\n" +" t.print_exc()" +msgstr "" + #: library/timeit.rst:199 msgid "" "The advantage over the standard traceback is that source lines in the " @@ -223,6 +264,11 @@ msgid "" "When called as a program from the command line, the following form is used::" msgstr "" +#: library/timeit.rst:211 +msgid "" +"python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...]" +msgstr "" + #: library/timeit.rst:213 msgid "Where the following options are understood:" msgstr "" @@ -302,6 +348,16 @@ msgid "" "the beginning:" msgstr "" +#: library/timeit.rst:280 +msgid "" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in " +"text\"\n" +"5000000 loops, best of 5: 0.0877 usec per loop\n" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text." +"find(char)\"\n" +"1000000 loops, best of 5: 0.342 usec per loop" +msgstr "" + #: library/timeit.rst:287 msgid "" "In the output, there are three fields. The loop count, which tells you how " @@ -312,10 +368,33 @@ msgid "" "repetition took divided by the loop count." msgstr "" +#: library/timeit.rst:296 +msgid "" +">>> import timeit\n" +">>> timeit.timeit('char in text', setup='text = \"sample string\"; char = " +"\"g\"')\n" +"0.41440500499993504\n" +">>> timeit.timeit('text.find(char)', setup='text = \"sample string\"; char = " +"\"g\"')\n" +"1.7246671520006203" +msgstr "" + #: library/timeit.rst:302 msgid "The same can be done using the :class:`Timer` class and its methods::" msgstr "" +#: library/timeit.rst:304 +msgid "" +">>> import timeit\n" +">>> t = timeit.Timer('char in text', setup='text = \"sample string\"; char = " +"\"g\"')\n" +">>> t.timeit()\n" +"0.3955516149999312\n" +">>> t.repeat()\n" +"[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, " +"0.3712595970846668, 0.37866875250654886]" +msgstr "" + #: library/timeit.rst:312 msgid "" "The following examples show how to time expressions that contain multiple " @@ -323,12 +402,68 @@ msgid "" "keyword:`except` to test for missing and present object attributes:" msgstr "" +#: library/timeit.rst:316 +msgid "" +"$ python -m timeit \"try:\" \" str.__bool__\" \"except AttributeError:\" " +"\" pass\"\n" +"20000 loops, best of 5: 15.7 usec per loop\n" +"$ python -m timeit \"if hasattr(str, '__bool__'): pass\"\n" +"50000 loops, best of 5: 4.26 usec per loop\n" +"\n" +"$ python -m timeit \"try:\" \" int.__bool__\" \"except AttributeError:\" " +"\" pass\"\n" +"200000 loops, best of 5: 1.43 usec per loop\n" +"$ python -m timeit \"if hasattr(int, '__bool__'): pass\"\n" +"100000 loops, best of 5: 2.23 usec per loop" +msgstr "" + +#: library/timeit.rst:330 +msgid "" +">>> import timeit\n" +">>> # attribute is missing\n" +">>> s = \"\"\"\\\n" +"... try:\n" +"... str.__bool__\n" +"... except AttributeError:\n" +"... pass\n" +"... \"\"\"\n" +">>> timeit.timeit(stmt=s, number=100000)\n" +"0.9138244460009446\n" +">>> s = \"if hasattr(str, '__bool__'): pass\"\n" +">>> timeit.timeit(stmt=s, number=100000)\n" +"0.5829014980008651\n" +">>>\n" +">>> # attribute is present\n" +">>> s = \"\"\"\\\n" +"... try:\n" +"... int.__bool__\n" +"... except AttributeError:\n" +"... pass\n" +"... \"\"\"\n" +">>> timeit.timeit(stmt=s, number=100000)\n" +"0.04215312199994514\n" +">>> s = \"if hasattr(int, '__bool__'): pass\"\n" +">>> timeit.timeit(stmt=s, number=100000)\n" +"0.08588060699912603" +msgstr "" + #: library/timeit.rst:358 msgid "" "To give the :mod:`timeit` module access to functions you define, you can " "pass a *setup* parameter which contains an import statement::" msgstr "" +#: library/timeit.rst:361 +msgid "" +"def test():\n" +" \"\"\"Stupid test function\"\"\"\n" +" L = [i for i in range(100)]\n" +"\n" +"if __name__ == '__main__':\n" +" import timeit\n" +" print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" +msgstr "" + #: library/timeit.rst:369 msgid "" "Another option is to pass :func:`globals` to the *globals* parameter, which " @@ -336,6 +471,19 @@ msgid "" "This can be more convenient than individually specifying imports::" msgstr "" +#: library/timeit.rst:373 +msgid "" +"def f(x):\n" +" return x**2\n" +"def g(x):\n" +" return x**4\n" +"def h(x):\n" +" return x**8\n" +"\n" +"import timeit\n" +"print(timeit.timeit('[func(42) for func in (f,g,h)]', globals=globals()))" +msgstr "" + #: library/timeit.rst:9 msgid "Benchmarking" msgstr "" diff --git a/library/tk.po b/library/tk.po index 27283f8a..67f73f42 100644 --- a/library/tk.po +++ b/library/tk.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tk.rst:5 -msgid "Graphical User Interfaces with Tk" +msgid "Graphical user interfaces with Tk" msgstr "" #: library/tk.rst:13 @@ -25,10 +26,10 @@ msgid "" "Tk/Tcl has long been an integral part of Python. It provides a robust and " "platform independent windowing toolkit, that is available to Python " "programmers using the :mod:`tkinter` package, and its extension, the :mod:" -"`tkinter.tix` and the :mod:`tkinter.ttk` modules." +"`tkinter.ttk` module." msgstr "" -#: library/tk.rst:18 +#: library/tk.rst:17 msgid "" "The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. " "To use :mod:`tkinter`, you don't need to write Tcl code, but you will need " @@ -37,7 +38,7 @@ msgid "" "classes." msgstr "" -#: library/tk.rst:24 +#: library/tk.rst:23 msgid "" ":mod:`tkinter`'s chief virtues are that it is fast, and that it usually " "comes bundled with Python. Although its standard documentation is weak, good " diff --git a/library/tkinter.colorchooser.po b/library/tkinter.colorchooser.po index 47f5ec52..0e694532 100644 --- a/library/tkinter.colorchooser.po +++ b/library/tkinter.colorchooser.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tkinter.colorchooser.rst:2 -msgid ":mod:`tkinter.colorchooser` --- Color choosing dialog" +msgid ":mod:`!tkinter.colorchooser` --- Color choosing dialog" msgstr "" #: library/tkinter.colorchooser.rst:8 diff --git a/library/tkinter.dnd.po b/library/tkinter.dnd.po index bc483db5..dfdef046 100644 --- a/library/tkinter.dnd.po +++ b/library/tkinter.dnd.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tkinter.dnd.rst:2 -msgid ":mod:`tkinter.dnd` --- Drag and drop support" +msgid ":mod:`!tkinter.dnd` --- Drag and drop support" msgstr "" #: library/tkinter.dnd.rst:8 @@ -56,11 +57,12 @@ msgstr "" #: library/tkinter.dnd.rst:28 msgid "" -"If *dnd_accept* is not present or returns None, search moves to parent widget" +"If *dnd_accept* is not present or returns ``None``, search moves to parent " +"widget" msgstr "" #: library/tkinter.dnd.rst:29 -msgid "If no target widget is found, then the target object is None" +msgid "If no target widget is found, then the target object is ``None``" msgstr "" #: library/tkinter.dnd.rst:31 diff --git a/library/tkinter.font.po b/library/tkinter.font.po index 1c8e3884..115d9340 100644 --- a/library/tkinter.font.po +++ b/library/tkinter.font.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tkinter.font.rst:2 -msgid ":mod:`tkinter.font` --- Tkinter font wrapper" +msgid ":mod:`!tkinter.font` --- Tkinter font wrapper" msgstr "" #: library/tkinter.font.rst:8 @@ -126,7 +127,7 @@ msgstr "" msgid "Return font-specific data. Options include:" msgstr "" -#: library/tkinter.font.rst:76 +#: library/tkinter.font.rst:75 msgid "*ascent* - distance between baseline and highest point that a" msgstr "" @@ -134,11 +135,11 @@ msgstr "" msgid "character of the font can occupy" msgstr "" -#: library/tkinter.font.rst:79 +#: library/tkinter.font.rst:78 msgid "*descent* - distance between baseline and lowest point that a" msgstr "" -#: library/tkinter.font.rst:82 +#: library/tkinter.font.rst:81 msgid "*linespace* - minimum vertical separation necessary between any two" msgstr "" diff --git a/library/tkinter.messagebox.po b/library/tkinter.messagebox.po index 8098e5e8..143331fc 100644 --- a/library/tkinter.messagebox.po +++ b/library/tkinter.messagebox.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tkinter.messagebox.rst:2 -msgid ":mod:`tkinter.messagebox` --- Tkinter message prompts" +msgid ":mod:`!tkinter.messagebox` --- Tkinter message prompts" msgstr "" #: library/tkinter.messagebox.rst:8 @@ -45,7 +46,7 @@ msgstr "" msgid "The following options are supported:" msgstr "" -#: library/tkinter.messagebox.rst:33 +#: library/tkinter.messagebox.rst:29 msgid "*command*" msgstr "" @@ -56,7 +57,7 @@ msgid "" "This is only available on macOS." msgstr "" -#: library/tkinter.messagebox.rst:39 +#: library/tkinter.messagebox.rst:35 msgid "*default*" msgstr "" @@ -68,7 +69,7 @@ msgid "" "default." msgstr "" -#: library/tkinter.messagebox.rst:46 +#: library/tkinter.messagebox.rst:41 msgid "*detail*" msgstr "" @@ -79,7 +80,7 @@ msgid "" "where supported by the OS, in a less emphasized font than the main message." msgstr "" -#: library/tkinter.messagebox.rst:51 +#: library/tkinter.messagebox.rst:48 msgid "*icon*" msgstr "" @@ -89,7 +90,7 @@ msgid "" "not specified, then the :data:`INFO` icon will be displayed." msgstr "" -#: library/tkinter.messagebox.rst:55 +#: library/tkinter.messagebox.rst:53 msgid "*message*" msgstr "" @@ -99,7 +100,7 @@ msgid "" "an empty string." msgstr "" -#: library/tkinter.messagebox.rst:59 +#: library/tkinter.messagebox.rst:57 msgid "*parent*" msgstr "" @@ -109,7 +110,7 @@ msgid "" "message box is displayed on top of its parent window." msgstr "" -#: library/tkinter.messagebox.rst:64 +#: library/tkinter.messagebox.rst:61 msgid "*title*" msgstr "" @@ -120,7 +121,7 @@ msgid "" "this kind of dialog." msgstr "" -#: library/tkinter.messagebox.rst:68 +#: library/tkinter.messagebox.rst:66 msgid "*type*" msgstr "" diff --git a/library/tkinter.po b/library/tkinter.po index 2a80b5ef..c6eeaa13 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tkinter.rst:2 -msgid ":mod:`tkinter` --- Python interface to Tcl/Tk" +msgid ":mod:`!tkinter` --- Python interface to Tcl/Tk" msgstr "" #: library/tkinter.rst:9 @@ -65,97 +66,105 @@ msgid "" "and can be woefully outdated." msgstr "" +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + #: library/tkinter.rst:43 msgid "`TkDocs `_" msgstr "" -#: library/tkinter.rst:42 +#: library/tkinter.rst:44 msgid "" "Extensive tutorial on creating user interfaces with Tkinter. Explains key " "concepts, and illustrates recommended approaches using the modern API." msgstr "" -#: library/tkinter.rst:46 +#: library/tkinter.rst:47 msgid "" "`Tkinter 8.5 reference: a GUI for Python `_" msgstr "" -#: library/tkinter.rst:46 +#: library/tkinter.rst:48 msgid "" "Reference documentation for Tkinter 8.5 detailing available classes, " "methods, and options." msgstr "" -#: library/tkinter.rst:48 +#: library/tkinter.rst:50 msgid "Tcl/Tk Resources:" msgstr "" -#: library/tkinter.rst:51 +#: library/tkinter.rst:52 msgid "`Tk commands `_" msgstr "" -#: library/tkinter.rst:51 +#: library/tkinter.rst:53 msgid "" "Comprehensive reference to each of the underlying Tcl/Tk commands used by " "Tkinter." msgstr "" -#: library/tkinter.rst:54 +#: library/tkinter.rst:55 msgid "`Tcl/Tk Home Page `_" msgstr "" -#: library/tkinter.rst:54 +#: library/tkinter.rst:56 msgid "Additional documentation, and links to Tcl/Tk core development." msgstr "" -#: library/tkinter.rst:56 +#: library/tkinter.rst:58 msgid "Books:" msgstr "" -#: library/tkinter.rst:59 +#: library/tkinter.rst:60 msgid "" "`Modern Tkinter for Busy Python Developers `_" msgstr "" -#: library/tkinter.rst:59 +#: library/tkinter.rst:61 msgid "By Mark Roseman. (ISBN 978-1999149567)" msgstr "" -#: library/tkinter.rst:62 +#: library/tkinter.rst:63 msgid "" -"`Python GUI programming with Tkinter `_" +"`Python GUI programming with Tkinter `_" msgstr "" -#: library/tkinter.rst:62 +#: library/tkinter.rst:64 msgid "By Alan D. Moore. (ISBN 978-1788835886)" msgstr "" -#: library/tkinter.rst:65 +#: library/tkinter.rst:66 msgid "`Programming Python `_" msgstr "" -#: library/tkinter.rst:65 +#: library/tkinter.rst:67 msgid "By Mark Lutz; has excellent coverage of Tkinter. (ISBN 978-0596158101)" msgstr "" -#: library/tkinter.rst:67 +#: library/tkinter.rst:69 msgid "" "`Tcl and the Tk Toolkit (2nd edition) `_" msgstr "" -#: library/tkinter.rst:68 +#: library/tkinter.rst:70 msgid "" "By John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does not cover " "Tkinter. (ISBN 978-0321336330)" msgstr "" -#: library/tkinter.rst:72 +#: library/tkinter.rst:74 msgid "Architecture" msgstr "" -#: library/tkinter.rst:74 +#: library/tkinter.rst:76 msgid "" "Tcl/Tk is not a single library but rather consists of a few distinct " "modules, each with separate functionality and its own official " @@ -163,11 +172,11 @@ msgid "" "with it." msgstr "" -#: library/tkinter.rst:90 +#: library/tkinter.rst:81 msgid "Tcl" msgstr "" -#: library/tkinter.rst:80 +#: library/tkinter.rst:82 msgid "" "Tcl is a dynamic interpreted programming language, just like Python. Though " "it can be used on its own as a general-purpose programming language, it is " @@ -181,11 +190,11 @@ msgid "" "difference (see `Threading model`_ for details)." msgstr "" -#: library/tkinter.rst:911 +#: library/tkinter.rst:908 msgid "Tk" msgstr "" -#: library/tkinter.rst:93 +#: library/tkinter.rst:95 msgid "" "Tk is a `Tcl package `_ implemented in C " "that adds custom commands to create and manipulate GUI widgets. Each :class:" @@ -194,11 +203,11 @@ msgid "" "appearance. Tk uses Tcl's event queue to generate and process GUI events." msgstr "" -#: library/tkinter.rst:103 +#: library/tkinter.rst:101 msgid "Ttk" msgstr "" -#: library/tkinter.rst:100 +#: library/tkinter.rst:102 msgid "" "Themed Tk (Ttk) is a newer family of Tk widgets that provide a much better " "appearance on different platforms than many of the classic Tk widgets. Ttk " @@ -206,13 +215,13 @@ msgid "" "are provided in a separate module, :mod:`tkinter.ttk`." msgstr "" -#: library/tkinter.rst:105 +#: library/tkinter.rst:107 msgid "" "Internally, Tk and Ttk use facilities of the underlying operating system, i." "e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows." msgstr "" -#: library/tkinter.rst:108 +#: library/tkinter.rst:110 msgid "" "When your Python application uses a class in Tkinter, e.g., to create a " "widget, the :mod:`tkinter` module first assembles a Tcl/Tk command string. " @@ -222,85 +231,91 @@ msgid "" "turn make calls to Xlib, Cocoa, or GDI." msgstr "" -#: library/tkinter.rst:116 +#: library/tkinter.rst:118 msgid "Tkinter Modules" msgstr "" -#: library/tkinter.rst:118 +#: library/tkinter.rst:120 msgid "" "Support for Tkinter is spread across several modules. Most applications will " "need the main :mod:`tkinter` module, as well as the :mod:`tkinter.ttk` " "module, which provides the modern themed widget set and API::" msgstr "" -#: library/tkinter.rst:129 +#: library/tkinter.rst:125 +msgid "" +"from tkinter import *\n" +"from tkinter import ttk" +msgstr "" + +#: library/tkinter.rst:131 msgid "" "Construct a toplevel Tk widget, which is usually the main window of an " "application, and initialize a Tcl interpreter for this widget. Each " "instance has its own associated Tcl interpreter." msgstr "" -#: library/tkinter.rst:133 +#: library/tkinter.rst:135 msgid "" "The :class:`Tk` class is typically instantiated using all default values. " "However, the following keyword arguments are currently recognized:" msgstr "" -#: library/tkinter.rst:137 +#: library/tkinter.rst:138 msgid "*screenName*" msgstr "" -#: library/tkinter.rst:137 +#: library/tkinter.rst:139 msgid "" "When given (as a string), sets the :envvar:`DISPLAY` environment variable. " "(X11 only)" msgstr "" -#: library/tkinter.rst:140 +#: library/tkinter.rst:141 msgid "*baseName*" msgstr "" -#: library/tkinter.rst:140 +#: library/tkinter.rst:142 msgid "" "Name of the profile file. By default, *baseName* is derived from the " "program name (``sys.argv[0]``)." msgstr "" -#: library/tkinter.rst:143 +#: library/tkinter.rst:144 msgid "*className*" msgstr "" -#: library/tkinter.rst:143 +#: library/tkinter.rst:145 msgid "" "Name of the widget class. Used as a profile file and also as the name with " "which Tcl is invoked (*argv0* in *interp*)." msgstr "" -#: library/tkinter.rst:146 +#: library/tkinter.rst:147 msgid "*useTk*" msgstr "" -#: library/tkinter.rst:146 +#: library/tkinter.rst:148 msgid "" "If ``True``, initialize the Tk subsystem. The :func:`tkinter.Tcl() ` " "function sets this to ``False``." msgstr "" -#: library/tkinter.rst:149 +#: library/tkinter.rst:150 msgid "*sync*" msgstr "" -#: library/tkinter.rst:149 +#: library/tkinter.rst:151 msgid "" "If ``True``, execute all X server commands synchronously, so that errors are " "reported immediately. Can be used for debugging. (X11 only)" msgstr "" -#: library/tkinter.rst:159 +#: library/tkinter.rst:153 msgid "*use*" msgstr "" -#: library/tkinter.rst:152 +#: library/tkinter.rst:154 msgid "" "Specifies the *id* of the window in which to embed the application, instead " "of it being created as an independent toplevel window. *id* must be " @@ -308,13 +323,13 @@ msgid "" "widgets (that is, it has a form like that returned by :meth:`winfo_id`)." msgstr "" -#: library/tkinter.rst:158 +#: library/tkinter.rst:160 msgid "" "Note that on some platforms this will only work correctly if *id* refers to " "a Tk frame or toplevel that has its -container option enabled." msgstr "" -#: library/tkinter.rst:161 +#: library/tkinter.rst:163 msgid "" ":class:`Tk` reads and interprets profile files, named :file:`.{className}." "tcl` and :file:`.{baseName}.tcl`, into the Tcl interpreter and calls :func:" @@ -323,14 +338,14 @@ msgid "" "variable or, if that isn't defined, then :data:`os.curdir`." msgstr "" -#: library/tkinter.rst:170 +#: library/tkinter.rst:172 msgid "" "The Tk application object created by instantiating :class:`Tk`. This " "provides access to the Tcl interpreter. Each widget that is attached the " "same instance of :class:`Tk` has the same value for its :attr:`tk` attribute." msgstr "" -#: library/tkinter.rst:177 +#: library/tkinter.rst:179 msgid "" "The widget object that contains this widget. For :class:`Tk`, the *master* " "is :const:`None` because it is the main window. The terms *master* and " @@ -341,13 +356,13 @@ msgid "" "structure." msgstr "" -#: library/tkinter.rst:187 +#: library/tkinter.rst:189 msgid "" "The immediate descendants of this widget as a :class:`dict` with the child " "widget names as the keys and the child instance objects as the values." msgstr "" -#: library/tkinter.rst:194 +#: library/tkinter.rst:196 msgid "" "The :func:`Tcl` function is a factory function which creates an object much " "like that created by the :class:`Tk` class, except that it does not " @@ -359,71 +374,71 @@ msgid "" "`loadtk` method." msgstr "" -#: library/tkinter.rst:203 +#: library/tkinter.rst:205 msgid "The modules that provide Tk support include:" msgstr "" -#: library/tkinter.rst:206 +#: library/tkinter.rst:207 msgid ":mod:`tkinter`" msgstr "" -#: library/tkinter.rst:206 +#: library/tkinter.rst:208 msgid "Main Tkinter module." msgstr "" -#: library/tkinter.rst:209 +#: library/tkinter.rst:210 msgid ":mod:`tkinter.colorchooser`" msgstr "" -#: library/tkinter.rst:209 +#: library/tkinter.rst:211 msgid "Dialog to let the user choose a color." msgstr "" -#: library/tkinter.rst:212 +#: library/tkinter.rst:213 msgid ":mod:`tkinter.commondialog`" msgstr "" -#: library/tkinter.rst:212 +#: library/tkinter.rst:214 msgid "Base class for the dialogs defined in the other modules listed here." msgstr "" -#: library/tkinter.rst:215 +#: library/tkinter.rst:216 msgid ":mod:`tkinter.filedialog`" msgstr "" -#: library/tkinter.rst:215 +#: library/tkinter.rst:217 msgid "Common dialogs to allow the user to specify a file to open or save." msgstr "" -#: library/tkinter.rst:218 +#: library/tkinter.rst:219 msgid ":mod:`tkinter.font`" msgstr "" -#: library/tkinter.rst:218 +#: library/tkinter.rst:220 msgid "Utilities to help work with fonts." msgstr "" -#: library/tkinter.rst:221 +#: library/tkinter.rst:222 msgid ":mod:`tkinter.messagebox`" msgstr "" -#: library/tkinter.rst:221 +#: library/tkinter.rst:223 msgid "Access to standard Tk dialog boxes." msgstr "" -#: library/tkinter.rst:224 +#: library/tkinter.rst:225 msgid ":mod:`tkinter.scrolledtext`" msgstr "" -#: library/tkinter.rst:224 +#: library/tkinter.rst:226 msgid "Text widget with a vertical scroll bar built in." msgstr "" -#: library/tkinter.rst:227 +#: library/tkinter.rst:228 msgid ":mod:`tkinter.simpledialog`" msgstr "" -#: library/tkinter.rst:227 +#: library/tkinter.rst:229 msgid "Basic dialogs and convenience functions." msgstr "" @@ -431,21 +446,21 @@ msgstr "" msgid ":mod:`tkinter.ttk`" msgstr "" -#: library/tkinter.rst:230 +#: library/tkinter.rst:232 msgid "" "Themed widget set introduced in Tk 8.5, providing modern alternatives for " "many of the classic widgets in the main :mod:`tkinter` module." msgstr "" -#: library/tkinter.rst:233 +#: library/tkinter.rst:235 msgid "Additional modules:" msgstr "" -#: library/tkinter.rst:243 +#: library/tkinter.rst:240 msgid ":mod:`_tkinter`" msgstr "" -#: library/tkinter.rst:239 +#: library/tkinter.rst:241 msgid "" "A binary module that contains the low-level interface to Tcl/Tk. It is " "automatically imported by the main :mod:`tkinter` module, and should never " @@ -458,17 +473,17 @@ msgstr "" msgid ":mod:`idlelib`" msgstr "" -#: library/tkinter.rst:246 +#: library/tkinter.rst:248 msgid "" "Python's Integrated Development and Learning Environment (IDLE). Based on :" "mod:`tkinter`." msgstr "" -#: library/tkinter.rst:252 +#: library/tkinter.rst:251 msgid ":mod:`tkinter.constants`" msgstr "" -#: library/tkinter.rst:250 +#: library/tkinter.rst:252 msgid "" "Symbolic constants that can be used in place of strings when passing various " "parameters to Tkinter calls. Automatically imported by the main :mod:" @@ -479,35 +494,25 @@ msgstr "" msgid ":mod:`tkinter.dnd`" msgstr "" -#: library/tkinter.rst:255 +#: library/tkinter.rst:257 msgid "" "(experimental) Drag-and-drop support for :mod:`tkinter`. This will become " "deprecated when it is replaced with the Tk DND." msgstr "" #: library/tkinter.rst:260 -msgid ":mod:`tkinter.tix`" -msgstr "" - -#: library/tkinter.rst:259 -msgid "" -"(deprecated) An older third-party Tcl/Tk package that adds several new " -"widgets. Better alternatives for most can be found in :mod:`tkinter.ttk`." -msgstr "" - -#: library/tkinter.rst:264 msgid ":mod:`turtle`" msgstr "" -#: library/tkinter.rst:263 +#: library/tkinter.rst:261 msgid "Turtle graphics in a Tk window." msgstr "" -#: library/tkinter.rst:267 +#: library/tkinter.rst:265 msgid "Tkinter Life Preserver" msgstr "" -#: library/tkinter.rst:269 +#: library/tkinter.rst:267 msgid "" "This section is not designed to be an exhaustive tutorial on either Tk or " "Tkinter. For that, refer to one of the external resources noted earlier. " @@ -516,7 +521,7 @@ msgid "" "how the Tkinter wrapper is structured." msgstr "" -#: library/tkinter.rst:275 +#: library/tkinter.rst:273 msgid "" "The remainder of this section will help you to identify the classes, " "methods, and options you'll need in your Tkinter application, and where to " @@ -524,18 +529,30 @@ msgid "" "reference manual." msgstr "" -#: library/tkinter.rst:282 +#: library/tkinter.rst:280 msgid "A Hello World Program" msgstr "" -#: library/tkinter.rst:284 +#: library/tkinter.rst:282 msgid "" "We'll start by walking through a \"Hello World\" application in Tkinter. " "This isn't the smallest one we could write, but has enough to illustrate " "some key concepts you'll need to know." msgstr "" -#: library/tkinter.rst:300 +#: library/tkinter.rst:288 +msgid "" +"from tkinter import *\n" +"from tkinter import ttk\n" +"root = Tk()\n" +"frm = ttk.Frame(root, padding=10)\n" +"frm.grid()\n" +"ttk.Label(frm, text=\"Hello World!\").grid(column=0, row=0)\n" +"ttk.Button(frm, text=\"Quit\", command=root.destroy).grid(column=1, row=0)\n" +"root.mainloop()" +msgstr "" + +#: library/tkinter.rst:298 msgid "" "After the imports, the next line creates an instance of the :class:`Tk` " "class, which initializes Tk and creates its associated Tcl interpreter. It " @@ -543,56 +560,56 @@ msgid "" "the main window of the application." msgstr "" -#: library/tkinter.rst:305 +#: library/tkinter.rst:303 msgid "" "The following line creates a frame widget, which in this case will contain a " "label and a button we'll create next. The frame is fit inside the root " "window." msgstr "" -#: library/tkinter.rst:309 +#: library/tkinter.rst:307 msgid "" "The next line creates a label widget holding a static text string. The :meth:" "`grid` method is used to specify the relative layout (position) of the label " "within its containing frame widget, similar to how tables in HTML work." msgstr "" -#: library/tkinter.rst:313 +#: library/tkinter.rst:311 msgid "" "A button widget is then created, and placed to the right of the label. When " "pressed, it will call the :meth:`destroy` method of the root window." msgstr "" -#: library/tkinter.rst:316 +#: library/tkinter.rst:314 msgid "" "Finally, the :meth:`mainloop` method puts everything on the display, and " "responds to user input until the program terminates." msgstr "" -#: library/tkinter.rst:322 +#: library/tkinter.rst:320 msgid "Important Tk Concepts" msgstr "" -#: library/tkinter.rst:324 +#: library/tkinter.rst:322 msgid "Even this simple program illustrates the following key Tk concepts:" msgstr "" -#: library/tkinter.rst:329 +#: library/tkinter.rst:324 msgid "widgets" msgstr "" -#: library/tkinter.rst:327 +#: library/tkinter.rst:325 msgid "" "A Tkinter user interface is made up of individual *widgets*. Each widget is " "represented as a Python object, instantiated from classes like :class:`ttk." "Frame`, :class:`ttk.Label`, and :class:`ttk.Button`." msgstr "" -#: library/tkinter.rst:335 +#: library/tkinter.rst:329 msgid "widget hierarchy" msgstr "" -#: library/tkinter.rst:332 +#: library/tkinter.rst:330 msgid "" "Widgets are arranged in a *hierarchy*. The label and button were contained " "within a frame, which in turn was contained within the root window. When " @@ -600,44 +617,44 @@ msgid "" "argument to the widget constructor." msgstr "" -#: library/tkinter.rst:340 +#: library/tkinter.rst:335 msgid "configuration options" msgstr "" -#: library/tkinter.rst:338 +#: library/tkinter.rst:336 msgid "" "Widgets have *configuration options*, which modify their appearance and " "behavior, such as the text to display in a label or button. Different " "classes of widgets will have different sets of options." msgstr "" -#: library/tkinter.rst:345 +#: library/tkinter.rst:340 msgid "geometry management" msgstr "" -#: library/tkinter.rst:343 +#: library/tkinter.rst:341 msgid "" "Widgets aren't automatically added to the user interface when they are " "created. A *geometry manager* like ``grid`` controls where in the user " "interface they are placed." msgstr "" -#: library/tkinter.rst:351 +#: library/tkinter.rst:345 msgid "event loop" msgstr "" -#: library/tkinter.rst:348 +#: library/tkinter.rst:346 msgid "" "Tkinter reacts to user input, changes from your program, and even refreshes " "the display only when actively running an *event loop*. If your program " "isn't running the event loop, your user interface won't update." msgstr "" -#: library/tkinter.rst:354 +#: library/tkinter.rst:352 msgid "Understanding How Tkinter Wraps Tcl/Tk" msgstr "" -#: library/tkinter.rst:356 +#: library/tkinter.rst:354 msgid "" "When your application uses Tkinter's classes and methods, internally Tkinter " "is assembling strings representing Tcl/Tk commands, and executing those " @@ -645,7 +662,7 @@ msgid "" "instance." msgstr "" -#: library/tkinter.rst:361 +#: library/tkinter.rst:359 msgid "" "Whether it's trying to navigate reference documentation, trying to find the " "right method or option, adapting some existing code, or debugging your " @@ -653,13 +670,22 @@ msgid "" "what those underlying Tcl/Tk commands look like." msgstr "" -#: library/tkinter.rst:366 +#: library/tkinter.rst:364 msgid "" "To illustrate, here is the Tcl/Tk equivalent of the main part of the Tkinter " "script above." msgstr "" -#: library/tkinter.rst:377 +#: library/tkinter.rst:369 +msgid "" +"ttk::frame .frm -padding 10\n" +"grid .frm\n" +"grid [ttk::label .frm.lbl -text \"Hello World!\"] -column 0 -row 0\n" +"grid [ttk::button .frm.btn -text \"Quit\" -command \"destroy .\"] -column 1 -" +"row 0" +msgstr "" + +#: library/tkinter.rst:375 msgid "" "Tcl's syntax is similar to many shell languages, where the first word is the " "command to be executed, with arguments to that command following it, " @@ -667,25 +693,25 @@ msgid "" "following:" msgstr "" -#: library/tkinter.rst:381 +#: library/tkinter.rst:379 msgid "" "The commands used to create widgets (like ``ttk::frame``) correspond to " "widget classes in Tkinter." msgstr "" -#: library/tkinter.rst:384 +#: library/tkinter.rst:382 msgid "" "Tcl widget options (like ``-text``) correspond to keyword arguments in " "Tkinter." msgstr "" -#: library/tkinter.rst:387 +#: library/tkinter.rst:385 msgid "" "Widgets are referred to by a *pathname* in Tcl (like ``.frm.btn``), whereas " "Tkinter doesn't use names but object references." msgstr "" -#: library/tkinter.rst:390 +#: library/tkinter.rst:388 msgid "" "A widget's place in the widget hierarchy is encoded in its (hierarchical) " "pathname, which uses a ``.`` (dot) as a path separator. The pathname for the " @@ -693,27 +719,27 @@ msgid "" "pathname but by specifying the parent widget when creating each child widget." msgstr "" -#: library/tkinter.rst:396 +#: library/tkinter.rst:394 msgid "" "Operations which are implemented as separate *commands* in Tcl (like " "``grid`` or ``destroy``) are represented as *methods* on Tkinter widget " "objects. As you'll see shortly, at other times Tcl uses what appear to be " -"method calls on widget objects, which more closely mirror what would is used " -"in Tkinter." +"method calls on widget objects, which more closely mirror what is used in " +"Tkinter." msgstr "" -#: library/tkinter.rst:404 +#: library/tkinter.rst:402 msgid "How do I...? What option does...?" msgstr "" -#: library/tkinter.rst:406 +#: library/tkinter.rst:404 msgid "" "If you're not sure how to do something in Tkinter, and you can't immediately " "find it in the tutorial or reference documentation you're using, there are a " "few strategies that can be helpful." msgstr "" -#: library/tkinter.rst:410 +#: library/tkinter.rst:408 msgid "" "First, remember that the details of how individual widgets work may vary " "across different versions of both Tkinter and Tcl/Tk. If you're searching " @@ -721,7 +747,7 @@ msgid "" "installed on your system." msgstr "" -#: library/tkinter.rst:415 +#: library/tkinter.rst:413 msgid "" "When searching for how to use an API, it helps to know the exact name of the " "class, option, or method that you're using. Introspection, either in an " @@ -729,7 +755,7 @@ msgid "" "you need." msgstr "" -#: library/tkinter.rst:420 +#: library/tkinter.rst:418 msgid "" "To find out what configuration options are available on any widget, call " "its :meth:`configure` method, which returns a dictionary containing a " @@ -737,7 +763,13 @@ msgid "" "values. Use :meth:`keys` to get just the names of each option." msgstr "" -#: library/tkinter.rst:430 +#: library/tkinter.rst:425 +msgid "" +"btn = ttk.Button(frm, ...)\n" +"print(btn.configure().keys())" +msgstr "" + +#: library/tkinter.rst:428 msgid "" "As most widgets have many configuration options in common, it can be useful " "to find out which are specific to a particular widget class. Comparing the " @@ -745,7 +777,11 @@ msgid "" "that." msgstr "" -#: library/tkinter.rst:439 +#: library/tkinter.rst:435 +msgid "print(set(btn.configure().keys()) - set(frm.configure().keys()))" +msgstr "" + +#: library/tkinter.rst:437 msgid "" "Similarly, you can find the available methods for a widget object using the " "standard :func:`dir` function. If you try it, you'll see there are over 200 " @@ -753,11 +789,17 @@ msgid "" "is helpful." msgstr "" -#: library/tkinter.rst:451 +#: library/tkinter.rst:444 +msgid "" +"print(dir(btn))\n" +"print(set(dir(btn)) - set(dir(frm)))" +msgstr "" + +#: library/tkinter.rst:449 msgid "Navigating the Tcl/Tk Reference Manual" msgstr "" -#: library/tkinter.rst:453 +#: library/tkinter.rst:451 msgid "" "As noted, the official `Tk commands `_ reference manual (man pages) is often the most accurate " @@ -766,7 +808,7 @@ msgid "" "places to look." msgstr "" -#: library/tkinter.rst:458 +#: library/tkinter.rst:456 msgid "" "While all operations in Tkinter are implemented as method calls on widget " "objects, you've seen that many Tcl/Tk operations appear as commands that " @@ -774,7 +816,13 @@ msgid "" "parameters, e.g." msgstr "" -#: library/tkinter.rst:468 +#: library/tkinter.rst:463 +msgid "" +"destroy .\n" +"grid .frm.btn -column 0 -row 0" +msgstr "" + +#: library/tkinter.rst:466 msgid "" "Others, however, look more like methods called on a widget object (in fact, " "when you create a widget in Tcl/Tk, it creates a Tcl command with the name " @@ -782,7 +830,13 @@ msgid "" "name of a method to call)." msgstr "" -#: library/tkinter.rst:479 +#: library/tkinter.rst:473 +msgid "" +".frm.btn invoke\n" +".frm.lbl configure -text \"Goodbye\"" +msgstr "" + +#: library/tkinter.rst:477 msgid "" "In the official Tcl/Tk reference documentation, you'll find most operations " "that look like method calls on the man page for a specific widget (e.g., " @@ -792,7 +846,7 @@ msgid "" "www.tcl.tk/man/tcl8.6/TkCmd/grid.htm>`_)." msgstr "" -#: library/tkinter.rst:487 +#: library/tkinter.rst:485 msgid "" "You'll find many common options and methods in the `options `_ or `ttk::widget `_ man page." msgstr "" -#: library/tkinter.rst:498 +#: library/tkinter.rst:496 msgid "" "Somewhat confusingly, there are also methods on all Tkinter widgets that " "don't actually operate on the widget, but operate at a global scope, " @@ -817,17 +871,17 @@ msgid "" "class:`Widget` class that all Tkinter widgets inherit from)." msgstr "" -#: library/tkinter.rst:507 +#: library/tkinter.rst:505 msgid "Threading model" msgstr "" -#: library/tkinter.rst:509 +#: library/tkinter.rst:507 msgid "" "Python and Tcl/Tk have very different threading models, which :mod:`tkinter` " "tries to bridge. If you use threads, you may need to be aware of this." msgstr "" -#: library/tkinter.rst:512 +#: library/tkinter.rst:510 msgid "" "A Python interpreter may have many threads associated with it. In Tcl, " "multiple threads can be created, but each thread has a separate Tcl " @@ -836,7 +890,7 @@ msgid "" "by the one thread that created it." msgstr "" -#: library/tkinter.rst:517 +#: library/tkinter.rst:515 msgid "" "Each :class:`Tk` object created by :mod:`tkinter` contains a Tcl " "interpreter. It also keeps track of which thread created that interpreter. " @@ -846,7 +900,7 @@ msgid "" "executed, the result is returned to the calling Python thread." msgstr "" -#: library/tkinter.rst:524 +#: library/tkinter.rst:522 msgid "" "Tcl/Tk applications are normally event-driven, meaning that after " "initialization, the interpreter runs an event loop (i.e. :func:`Tk." @@ -859,18 +913,18 @@ msgid "" "event handlers." msgstr "" -#: library/tkinter.rst:533 +#: library/tkinter.rst:531 msgid "" "If the Tcl interpreter is not running the event loop and processing events, " "any :mod:`tkinter` calls made from threads other than the one running the " "Tcl interpreter will fail." msgstr "" -#: library/tkinter.rst:537 +#: library/tkinter.rst:535 msgid "A number of special cases exist:" msgstr "" -#: library/tkinter.rst:539 +#: library/tkinter.rst:537 msgid "" "Tcl/Tk libraries can be built so they are not thread-aware. In this case, :" "mod:`tkinter` calls the library from the originating Python thread, even if " @@ -878,7 +932,7 @@ msgid "" "lock ensures only one call occurs at a time." msgstr "" -#: library/tkinter.rst:544 +#: library/tkinter.rst:542 msgid "" "While :mod:`tkinter` allows you to create more than one instance of a :class:" "`Tk` object (with its own interpreter), all interpreters that are part of " @@ -888,7 +942,7 @@ msgid "" "running a thread-aware Tcl/Tk build." msgstr "" -#: library/tkinter.rst:550 +#: library/tkinter.rst:548 msgid "" "Blocking event handlers are not the only way to prevent the Tcl interpreter " "from reentering the event loop. It is even possible to run multiple nested " @@ -896,47 +950,61 @@ msgid "" "tricky when it comes to events or threads, be aware of these possibilities." msgstr "" -#: library/tkinter.rst:555 +#: library/tkinter.rst:553 msgid "" "There are a few select :mod:`tkinter` functions that presently work only " "when called from the thread that created the Tcl interpreter." msgstr "" -#: library/tkinter.rst:560 +#: library/tkinter.rst:558 msgid "Handy Reference" msgstr "" -#: library/tkinter.rst:566 +#: library/tkinter.rst:564 msgid "Setting Options" msgstr "" -#: library/tkinter.rst:568 +#: library/tkinter.rst:566 msgid "" "Options control things like the color and border width of a widget. Options " "can be set in three ways:" msgstr "" -#: library/tkinter.rst:574 +#: library/tkinter.rst:569 msgid "At object creation time, using keyword arguments" msgstr "" -#: library/tkinter.rst:580 +#: library/tkinter.rst:572 +msgid "fred = Button(self, fg=\"red\", bg=\"blue\")" +msgstr "" + +#: library/tkinter.rst:574 msgid "After object creation, treating the option name like a dictionary index" msgstr "" -#: library/tkinter.rst:585 +#: library/tkinter.rst:577 +msgid "" +"fred[\"fg\"] = \"red\"\n" +"fred[\"bg\"] = \"blue\"" +msgstr "" + +#: library/tkinter.rst:580 msgid "" "Use the config() method to update multiple attrs subsequent to object " "creation" msgstr "" -#: library/tkinter.rst:587 +#: library/tkinter.rst:583 +msgid "fred.config(fg=\"red\", bg=\"blue\")" +msgstr "" + +#: library/tkinter.rst:585 msgid "" "For a complete explanation of a given option and its behavior, see the Tk " "man pages for the widget in question." msgstr "" -#: library/tkinter.rst:590 +#: library/tkinter.rst:588 msgid "" "Note that the man pages list \"STANDARD OPTIONS\" and \"WIDGET SPECIFIC " "OPTIONS\" for each widget. The former is a list of options that are common " @@ -945,7 +1013,7 @@ msgid "" "`options(3)` man page." msgstr "" -#: library/tkinter.rst:596 +#: library/tkinter.rst:594 msgid "" "No distinction between standard and widget-specific options is made in this " "document. Some options don't apply to some kinds of widgets. Whether a " @@ -953,7 +1021,7 @@ msgid "" "widget; buttons have a ``command`` option, labels do not." msgstr "" -#: library/tkinter.rst:601 +#: library/tkinter.rst:599 msgid "" "The options supported by a given widget are listed in that widget's man " "page, or can be queried at runtime by calling the :meth:`config` method " @@ -962,7 +1030,7 @@ msgid "" "option as a string (for example, ``'relief'``) and whose values are 5-tuples." msgstr "" -#: library/tkinter.rst:607 +#: library/tkinter.rst:605 msgid "" "Some options, like ``bg`` are synonyms for common options with long names " "(``bg`` is shorthand for \"background\"). Passing the ``config()`` method " @@ -971,89 +1039,95 @@ msgid "" "option (such as ``('bg', 'background')``)." msgstr "" -#: library/tkinter.rst:614 +#: library/tkinter.rst:612 msgid "Index" msgstr "" -#: library/tkinter.rst:614 +#: library/tkinter.rst:612 msgid "Meaning" msgstr "" -#: library/tkinter.rst:614 +#: library/tkinter.rst:612 msgid "Example" msgstr "" -#: library/tkinter.rst:616 +#: library/tkinter.rst:614 msgid "0" msgstr "" -#: library/tkinter.rst:616 +#: library/tkinter.rst:614 msgid "option name" msgstr "" -#: library/tkinter.rst:618 +#: library/tkinter.rst:616 msgid "``'relief'``" msgstr "" -#: library/tkinter.rst:618 +#: library/tkinter.rst:616 msgid "1" msgstr "" -#: library/tkinter.rst:618 +#: library/tkinter.rst:616 msgid "option name for database lookup" msgstr "" -#: library/tkinter.rst:620 +#: library/tkinter.rst:618 msgid "2" msgstr "" -#: library/tkinter.rst:620 +#: library/tkinter.rst:618 msgid "option class for database lookup" msgstr "" -#: library/tkinter.rst:620 +#: library/tkinter.rst:618 msgid "``'Relief'``" msgstr "" -#: library/tkinter.rst:623 +#: library/tkinter.rst:621 msgid "3" msgstr "" -#: library/tkinter.rst:623 +#: library/tkinter.rst:621 msgid "default value" msgstr "" -#: library/tkinter.rst:623 +#: library/tkinter.rst:621 msgid "``'raised'``" msgstr "" -#: library/tkinter.rst:625 +#: library/tkinter.rst:623 msgid "4" msgstr "" -#: library/tkinter.rst:625 +#: library/tkinter.rst:623 msgid "current value" msgstr "" -#: library/tkinter.rst:625 +#: library/tkinter.rst:623 msgid "``'groove'``" msgstr "" -#: library/tkinter.rst:628 +#: library/tkinter.rst:626 msgid "Example::" msgstr "" -#: library/tkinter.rst:633 +#: library/tkinter.rst:628 +msgid "" +">>> print(fred.config())\n" +"{'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}" +msgstr "" + +#: library/tkinter.rst:631 msgid "" "Of course, the dictionary printed will include all the options available and " "their values. This is meant only as an example." msgstr "" -#: library/tkinter.rst:638 +#: library/tkinter.rst:636 msgid "The Packer" msgstr "" -#: library/tkinter.rst:642 +#: library/tkinter.rst:640 msgid "" "The packer is one of Tk's geometry-management mechanisms. Geometry " "managers are used to specify the relative positioning of widgets within " @@ -1064,7 +1138,7 @@ msgid "" "coordinates for you." msgstr "" -#: library/tkinter.rst:649 +#: library/tkinter.rst:647 msgid "" "The size of any *master* widget is determined by the size of the \"slave " "widgets\" inside. The packer is used to control where slave widgets appear " @@ -1074,7 +1148,7 @@ msgid "" "accommodate incremental changes to the configuration, once it is packed." msgstr "" -#: library/tkinter.rst:656 +#: library/tkinter.rst:654 msgid "" "Note that widgets do not appear until they have had their geometry specified " "with a geometry manager. It's a common early mistake to leave out the " @@ -1083,79 +1157,86 @@ msgid "" "the packer's :meth:`pack` method applied to it." msgstr "" -#: library/tkinter.rst:662 +#: library/tkinter.rst:660 msgid "" "The pack() method can be called with keyword-option/value pairs that control " "where the widget is to appear within its container, and how it is to behave " "when the main application window is resized. Here are some examples::" msgstr "" -#: library/tkinter.rst:672 +#: library/tkinter.rst:664 +msgid "" +"fred.pack() # defaults to side = \"top\"\n" +"fred.pack(side=\"left\")\n" +"fred.pack(expand=1)" +msgstr "" + +#: library/tkinter.rst:670 msgid "Packer Options" msgstr "" -#: library/tkinter.rst:674 +#: library/tkinter.rst:672 msgid "" "For more extensive information on the packer and the options that it can " "take, see the man pages and page 183 of John Ousterhout's book." msgstr "" -#: library/tkinter.rst:798 +#: library/tkinter.rst:794 msgid "anchor" msgstr "" -#: library/tkinter.rst:678 +#: library/tkinter.rst:676 msgid "" "Anchor type. Denotes where the packer is to place each slave in its parcel." msgstr "" -#: library/tkinter.rst:681 +#: library/tkinter.rst:678 msgid "expand" msgstr "" -#: library/tkinter.rst:681 +#: library/tkinter.rst:679 msgid "Boolean, ``0`` or ``1``." msgstr "" -#: library/tkinter.rst:684 +#: library/tkinter.rst:681 msgid "fill" msgstr "" -#: library/tkinter.rst:684 +#: library/tkinter.rst:682 msgid "Legal values: ``'x'``, ``'y'``, ``'both'``, ``'none'``." msgstr "" -#: library/tkinter.rst:687 +#: library/tkinter.rst:684 msgid "ipadx and ipady" msgstr "" -#: library/tkinter.rst:687 +#: library/tkinter.rst:685 msgid "" "A distance - designating internal padding on each side of the slave widget." msgstr "" -#: library/tkinter.rst:690 +#: library/tkinter.rst:687 msgid "padx and pady" msgstr "" -#: library/tkinter.rst:690 +#: library/tkinter.rst:688 msgid "" "A distance - designating external padding on each side of the slave widget." msgstr "" -#: library/tkinter.rst:694 +#: library/tkinter.rst:690 msgid "side" msgstr "" -#: library/tkinter.rst:693 +#: library/tkinter.rst:691 msgid "Legal values are: ``'left'``, ``'right'``, ``'top'``, ``'bottom'``." msgstr "" -#: library/tkinter.rst:697 +#: library/tkinter.rst:695 msgid "Coupling Widget Variables" msgstr "" -#: library/tkinter.rst:699 +#: library/tkinter.rst:697 msgid "" "The current-value setting of some widgets (like text entry widgets) can be " "connected directly to application variables by using special options. These " @@ -1165,7 +1246,7 @@ msgid "" "value." msgstr "" -#: library/tkinter.rst:705 +#: library/tkinter.rst:703 msgid "" "Unfortunately, in the current implementation of :mod:`tkinter` it is not " "possible to hand over an arbitrary Python variable to a widget through a " @@ -1174,7 +1255,7 @@ msgid "" "Variable, defined in :mod:`tkinter`." msgstr "" -#: library/tkinter.rst:711 +#: library/tkinter.rst:709 msgid "" "There are many useful subclasses of Variable already defined: :class:" "`StringVar`, :class:`IntVar`, :class:`DoubleVar`, and :class:`BooleanVar`. " @@ -1184,15 +1265,48 @@ msgid "" "no further intervention on your part." msgstr "" -#: library/tkinter.rst:898 +#: library/tkinter.rst:895 msgid "For example::" msgstr "" -#: library/tkinter.rst:751 +#: library/tkinter.rst:718 +msgid "" +"import tkinter as tk\n" +"\n" +"class App(tk.Frame):\n" +" def __init__(self, master):\n" +" super().__init__(master)\n" +" self.pack()\n" +"\n" +" self.entrythingy = tk.Entry()\n" +" self.entrythingy.pack()\n" +"\n" +" # Create the application variable.\n" +" self.contents = tk.StringVar()\n" +" # Set it to some value.\n" +" self.contents.set(\"this is a variable\")\n" +" # Tell the entry widget to watch this variable.\n" +" self.entrythingy[\"textvariable\"] = self.contents\n" +"\n" +" # Define a callback for when the user hits return.\n" +" # It prints the current value of the variable.\n" +" self.entrythingy.bind('',\n" +" self.print_contents)\n" +"\n" +" def print_contents(self, event):\n" +" print(\"Hi. The current entry content is:\",\n" +" self.contents.get())\n" +"\n" +"root = tk.Tk()\n" +"myapp = App(root)\n" +"myapp.mainloop()" +msgstr "" + +#: library/tkinter.rst:749 msgid "The Window Manager" msgstr "" -#: library/tkinter.rst:755 +#: library/tkinter.rst:753 msgid "" "In Tk, there is a utility command, ``wm``, for interacting with the window " "manager. Options to the ``wm`` command allow you to control things like " @@ -1202,7 +1316,7 @@ msgid "" "the :class:`Wm` methods directly." msgstr "" -#: library/tkinter.rst:762 +#: library/tkinter.rst:760 msgid "" "To get at the toplevel window that contains a given widget, you can often " "just refer to the widget's master. Of course if the widget has been packed " @@ -1213,26 +1327,48 @@ msgid "" "to Tk functionality." msgstr "" -#: library/tkinter.rst:769 +#: library/tkinter.rst:767 msgid "Here are some examples of typical usage::" msgstr "" -#: library/tkinter.rst:794 +#: library/tkinter.rst:769 +msgid "" +"import tkinter as tk\n" +"\n" +"class App(tk.Frame):\n" +" def __init__(self, master=None):\n" +" super().__init__(master)\n" +" self.pack()\n" +"\n" +"# create the application\n" +"myapp = App()\n" +"\n" +"#\n" +"# here are method calls to the window manager class\n" +"#\n" +"myapp.master.title(\"My Do-Nothing Application\")\n" +"myapp.master.maxsize(1000, 400)\n" +"\n" +"# start the program\n" +"myapp.mainloop()" +msgstr "" + +#: library/tkinter.rst:792 msgid "Tk Option Data Types" msgstr "" -#: library/tkinter.rst:797 +#: library/tkinter.rst:795 msgid "" "Legal values are points of the compass: ``\"n\"``, ``\"ne\"``, ``\"e\"``, " "``\"se\"``, ``\"s\"``, ``\"sw\"``, ``\"w\"``, ``\"nw\"``, and also " "``\"center\"``." msgstr "" -#: library/tkinter.rst:804 +#: library/tkinter.rst:798 msgid "bitmap" msgstr "" -#: library/tkinter.rst:801 +#: library/tkinter.rst:799 msgid "" "There are eight built-in, named bitmaps: ``'error'``, ``'gray25'``, " "``'gray50'``, ``'hourglass'``, ``'info'``, ``'questhead'``, ``'question'``, " @@ -1240,27 +1376,34 @@ msgid "" "file, preceded with an ``@``, as in ``\"@/usr/contrib/bitmap/gumby.bit\"``." msgstr "" -#: library/tkinter.rst:807 +#: library/tkinter.rst:804 msgid "boolean" msgstr "" -#: library/tkinter.rst:807 +#: library/tkinter.rst:805 msgid "You can pass integers 0 or 1 or the strings ``\"yes\"`` or ``\"no\"``." msgstr "" -#: library/tkinter.rst:814 +#: library/tkinter.rst:807 msgid "callback" msgstr "" -#: library/tkinter.rst:810 +#: library/tkinter.rst:808 msgid "This is any Python function that takes no arguments. For example::" msgstr "" -#: library/tkinter.rst:820 +#: library/tkinter.rst:810 +msgid "" +"def print_it():\n" +" print(\"hi there\")\n" +"fred[\"command\"] = print_it" +msgstr "" + +#: library/tkinter.rst:814 msgid "color" msgstr "" -#: library/tkinter.rst:817 +#: library/tkinter.rst:815 msgid "" "Colors can be given as the names of X colors in the rgb.txt file, or as " "strings representing RGB values in 4 bit: ``\"#RGB\"``, 8 bit: " @@ -1269,11 +1412,11 @@ msgid "" "digit. See page 160 of Ousterhout's book for details." msgstr "" -#: library/tkinter.rst:826 +#: library/tkinter.rst:820 msgid "cursor" msgstr "" -#: library/tkinter.rst:823 +#: library/tkinter.rst:821 msgid "" "The standard X cursor names from :file:`cursorfont.h` can be used, without " "the ``XC_`` prefix. For example to get a hand cursor (:const:`XC_hand2`), " @@ -1281,11 +1424,11 @@ msgid "" "of your own. See page 179 of Ousterhout's book." msgstr "" -#: library/tkinter.rst:833 +#: library/tkinter.rst:826 msgid "distance" msgstr "" -#: library/tkinter.rst:829 +#: library/tkinter.rst:827 msgid "" "Screen distances can be specified in either pixels or absolute distances. " "Pixels are given as numbers and absolute distances as strings, with the " @@ -1294,120 +1437,124 @@ msgid "" "is expressed as ``\"3.5i\"``." msgstr "" -#: library/tkinter.rst:838 +#: library/tkinter.rst:833 msgid "font" msgstr "" -#: library/tkinter.rst:836 +#: library/tkinter.rst:834 msgid "" "Tk uses a list font name format, such as ``{courier 10 bold}``. Font sizes " "with positive numbers are measured in points; sizes with negative numbers " "are measured in pixels." msgstr "" -#: library/tkinter.rst:843 +#: library/tkinter.rst:838 msgid "geometry" msgstr "" -#: library/tkinter.rst:841 +#: library/tkinter.rst:839 msgid "" "This is a string of the form ``widthxheight``, where width and height are " "measured in pixels for most widgets (in characters for widgets displaying " "text). For example: ``fred[\"geometry\"] = \"200x100\"``." msgstr "" -#: library/tkinter.rst:847 +#: library/tkinter.rst:843 msgid "justify" msgstr "" -#: library/tkinter.rst:846 +#: library/tkinter.rst:844 msgid "" -"Legal values are the strings: ``\"left\"``, ``\"center\"``, ``\"right\"``, " -"and ``\"fill\"``." +"Legal values are the strings: ``\"left\"``, ``\"center\"``, and " +"``\"right\"``." msgstr "" -#: library/tkinter.rst:852 +#: library/tkinter.rst:846 msgid "region" msgstr "" -#: library/tkinter.rst:850 +#: library/tkinter.rst:847 msgid "" "This is a string with four space-delimited elements, each of which is a " "legal distance (see above). For example: ``\"2 3 4 5\"`` and ``\"3i 2i 4.5i " "2i\"`` and ``\"3c 2c 4c 10.43c\"`` are all legal regions." msgstr "" -#: library/tkinter.rst:856 +#: library/tkinter.rst:851 msgid "relief" msgstr "" -#: library/tkinter.rst:855 +#: library/tkinter.rst:852 msgid "" "Determines what the border style of a widget will be. Legal values are: " "``\"raised\"``, ``\"sunken\"``, ``\"flat\"``, ``\"groove\"``, and " "``\"ridge\"``." msgstr "" -#: library/tkinter.rst:860 +#: library/tkinter.rst:855 msgid "scrollcommand" msgstr "" -#: library/tkinter.rst:859 +#: library/tkinter.rst:856 msgid "" "This is almost always the :meth:`!set` method of some scrollbar widget, but " "can be any widget method that takes a single argument." msgstr "" -#: library/tkinter.rst:863 +#: library/tkinter.rst:859 msgid "wrap" msgstr "" -#: library/tkinter.rst:863 +#: library/tkinter.rst:860 msgid "Must be one of: ``\"none\"``, ``\"char\"``, or ``\"word\"``." msgstr "" -#: library/tkinter.rst:868 +#: library/tkinter.rst:865 msgid "Bindings and Events" msgstr "" -#: library/tkinter.rst:874 +#: library/tkinter.rst:871 msgid "" "The bind method from the widget command allows you to watch for certain " "events and to have a callback function trigger when that event type occurs. " "The form of the bind method is::" msgstr "" -#: library/tkinter.rst:880 +#: library/tkinter.rst:875 +msgid "def bind(self, sequence, func, add=''):" +msgstr "" + +#: library/tkinter.rst:877 msgid "where:" msgstr "" -#: library/tkinter.rst:885 +#: library/tkinter.rst:879 msgid "sequence" msgstr "" -#: library/tkinter.rst:883 +#: library/tkinter.rst:880 msgid "" "is a string that denotes the target kind of event. (See the :manpage:" "`bind(3tk)` man page, and page 201 of John Ousterhout's book, :title-" "reference:`Tcl and the Tk Toolkit (2nd edition)`, for details)." msgstr "" -#: library/tkinter.rst:890 +#: library/tkinter.rst:884 msgid "func" msgstr "" -#: library/tkinter.rst:888 +#: library/tkinter.rst:885 msgid "" "is a Python function, taking one argument, to be invoked when the event " "occurs. An Event instance will be passed as the argument. (Functions " "deployed this way are commonly known as *callbacks*.)" msgstr "" -#: library/tkinter.rst:896 +#: library/tkinter.rst:889 msgid "add" msgstr "" -#: library/tkinter.rst:893 +#: library/tkinter.rst:890 msgid "" "is optional, either ``''`` or ``'+'``. Passing an empty string denotes that " "this binding is to replace any other bindings that this event is associated " @@ -1415,7 +1562,15 @@ msgid "" "of functions bound to this event type." msgstr "" -#: library/tkinter.rst:905 +#: library/tkinter.rst:897 +msgid "" +"def turn_red(self, event):\n" +" event.widget[\"activeforeground\"] = \"red\"\n" +"\n" +"self.button.bind(\"\", self.turn_red)" +msgstr "" + +#: library/tkinter.rst:902 msgid "" "Notice how the widget field of the event is being accessed in the " "``turn_red()`` callback. This field contains the widget that caught the X " @@ -1424,209 +1579,209 @@ msgid "" "pages." msgstr "" -#: library/tkinter.rst:911 +#: library/tkinter.rst:908 msgid "Tkinter Event Field" msgstr "" -#: library/tkinter.rst:913 +#: library/tkinter.rst:910 msgid "%f" msgstr "" -#: library/tkinter.rst:913 +#: library/tkinter.rst:910 msgid "focus" msgstr "" -#: library/tkinter.rst:913 +#: library/tkinter.rst:910 msgid "%A" msgstr "" -#: library/tkinter.rst:913 +#: library/tkinter.rst:910 msgid "char" msgstr "" -#: library/tkinter.rst:915 +#: library/tkinter.rst:912 msgid "%h" msgstr "" -#: library/tkinter.rst:915 +#: library/tkinter.rst:912 msgid "height" msgstr "" -#: library/tkinter.rst:915 +#: library/tkinter.rst:912 msgid "%E" msgstr "" -#: library/tkinter.rst:915 +#: library/tkinter.rst:912 msgid "send_event" msgstr "" -#: library/tkinter.rst:917 +#: library/tkinter.rst:914 msgid "%k" msgstr "" -#: library/tkinter.rst:917 +#: library/tkinter.rst:914 msgid "keycode" msgstr "" -#: library/tkinter.rst:917 +#: library/tkinter.rst:914 msgid "%K" msgstr "" -#: library/tkinter.rst:917 +#: library/tkinter.rst:914 msgid "keysym" msgstr "" -#: library/tkinter.rst:919 +#: library/tkinter.rst:916 msgid "%s" msgstr "" -#: library/tkinter.rst:919 +#: library/tkinter.rst:916 msgid "state" msgstr "" -#: library/tkinter.rst:919 +#: library/tkinter.rst:916 msgid "%N" msgstr "" -#: library/tkinter.rst:919 +#: library/tkinter.rst:916 msgid "keysym_num" msgstr "" -#: library/tkinter.rst:921 +#: library/tkinter.rst:918 msgid "%t" msgstr "" -#: library/tkinter.rst:921 +#: library/tkinter.rst:918 msgid "time" msgstr "" -#: library/tkinter.rst:921 +#: library/tkinter.rst:918 msgid "%T" msgstr "" -#: library/tkinter.rst:921 +#: library/tkinter.rst:918 msgid "type" msgstr "" -#: library/tkinter.rst:923 +#: library/tkinter.rst:920 msgid "%w" msgstr "" -#: library/tkinter.rst:923 +#: library/tkinter.rst:920 msgid "width" msgstr "" -#: library/tkinter.rst:923 +#: library/tkinter.rst:920 msgid "%W" msgstr "" -#: library/tkinter.rst:923 +#: library/tkinter.rst:920 msgid "widget" msgstr "" -#: library/tkinter.rst:925 +#: library/tkinter.rst:922 msgid "%x" msgstr "" -#: library/tkinter.rst:925 +#: library/tkinter.rst:922 msgid "x" msgstr "" -#: library/tkinter.rst:925 +#: library/tkinter.rst:922 msgid "%X" msgstr "" -#: library/tkinter.rst:925 +#: library/tkinter.rst:922 msgid "x_root" msgstr "" -#: library/tkinter.rst:927 +#: library/tkinter.rst:924 msgid "%y" msgstr "" -#: library/tkinter.rst:927 +#: library/tkinter.rst:924 msgid "y" msgstr "" -#: library/tkinter.rst:927 +#: library/tkinter.rst:924 msgid "%Y" msgstr "" -#: library/tkinter.rst:927 +#: library/tkinter.rst:924 msgid "y_root" msgstr "" -#: library/tkinter.rst:932 +#: library/tkinter.rst:929 msgid "The index Parameter" msgstr "" -#: library/tkinter.rst:934 +#: library/tkinter.rst:931 msgid "" "A number of widgets require \"index\" parameters to be passed. These are " "used to point at a specific place in a Text widget, or to particular " "characters in an Entry widget, or to particular menu items in a Menu widget." msgstr "" -#: library/tkinter.rst:941 +#: library/tkinter.rst:935 msgid "Entry widget indexes (index, view index, etc.)" msgstr "" -#: library/tkinter.rst:939 +#: library/tkinter.rst:936 msgid "" "Entry widgets have options that refer to character positions in the text " "being displayed. You can use these :mod:`tkinter` functions to access these " "special points in text widgets:" msgstr "" -#: library/tkinter.rst:945 +#: library/tkinter.rst:940 msgid "Text widget indexes" msgstr "" -#: library/tkinter.rst:944 +#: library/tkinter.rst:941 msgid "" "The index notation for Text widgets is very rich and is best described in " "the Tk man pages." msgstr "" -#: library/tkinter.rst:970 +#: library/tkinter.rst:944 msgid "Menu indexes (menu.invoke(), menu.entryconfig(), etc.)" msgstr "" -#: library/tkinter.rst:948 +#: library/tkinter.rst:945 msgid "" "Some options and methods for menus manipulate specific menu entries. Anytime " "a menu index is needed for an option or a parameter, you may pass in:" msgstr "" -#: library/tkinter.rst:951 +#: library/tkinter.rst:948 msgid "" "an integer which refers to the numeric position of the entry in the widget, " "counted from the top, starting with 0;" msgstr "" -#: library/tkinter.rst:954 +#: library/tkinter.rst:951 msgid "" "the string ``\"active\"``, which refers to the menu position that is " "currently under the cursor;" msgstr "" -#: library/tkinter.rst:957 +#: library/tkinter.rst:954 msgid "the string ``\"last\"`` which refers to the last menu item;" msgstr "" -#: library/tkinter.rst:959 +#: library/tkinter.rst:956 msgid "" "An integer preceded by ``@``, as in ``@6``, where the integer is interpreted " "as a y pixel coordinate in the menu's coordinate system;" msgstr "" -#: library/tkinter.rst:962 +#: library/tkinter.rst:959 msgid "" "the string ``\"none\"``, which indicates no menu entry at all, most often " "used with menu.activate() to deactivate all entries, and finally," msgstr "" -#: library/tkinter.rst:965 +#: library/tkinter.rst:962 msgid "" "a text string that is pattern matched against the label of the menu entry, " "as scanned from the top of the menu to the bottom. Note that this index " @@ -1635,33 +1790,42 @@ msgid "" "above literals, instead." msgstr "" -#: library/tkinter.rst:973 +#: library/tkinter.rst:970 msgid "Images" msgstr "" -#: library/tkinter.rst:975 +#: library/tkinter.rst:972 msgid "" "Images of different formats can be created through the corresponding " "subclass of :class:`tkinter.Image`:" msgstr "" -#: library/tkinter.rst:978 +#: library/tkinter.rst:975 msgid ":class:`BitmapImage` for images in XBM format." msgstr "" -#: library/tkinter.rst:980 +#: library/tkinter.rst:977 msgid "" ":class:`PhotoImage` for images in PGM, PPM, GIF and PNG formats. The latter " "is supported starting with Tk 8.6." msgstr "" -#: library/tkinter.rst:983 +#: library/tkinter.rst:980 msgid "" "Either type of image is created through either the ``file`` or the ``data`` " "option (other options are available as well)." msgstr "" -#: library/tkinter.rst:986 +#: library/tkinter.rst:983 +msgid "" +"Added the :class:`!PhotoImage` method :meth:`!copy_replace` to copy a region " +"from one image to other image, possibly with pixel zooming and/or " +"subsampling. Add *from_coords* parameter to :class:`!PhotoImage` methods :" +"meth:`!copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and " +"*subsample* parameters to :class:`!PhotoImage` method :meth:`!copy`." +msgstr "" + +#: library/tkinter.rst:992 msgid "" "The image object can then be used wherever an ``image`` option is supported " "by some widget (e.g. labels, buttons, menus). In these cases, Tk will not " @@ -1670,28 +1834,38 @@ msgid "" "empty box wherever the image was used." msgstr "" -#: library/tkinter.rst:994 +#: library/tkinter.rst:1000 msgid "" "The `Pillow `_ package adds support for formats " "such as BMP, JPEG, TIFF, and WebP, among others." msgstr "" -#: library/tkinter.rst:1000 +#: library/tkinter.rst:1006 msgid "File Handlers" msgstr "" -#: library/tkinter.rst:1002 +#: library/tkinter.rst:1008 msgid "" "Tk allows you to register and unregister a callback function which will be " "called from the Tk mainloop when I/O is possible on a file descriptor. Only " "one handler may be registered per file descriptor. Example code::" msgstr "" -#: library/tkinter.rst:1013 +#: library/tkinter.rst:1012 +msgid "" +"import tkinter\n" +"widget = tkinter.Tk()\n" +"mask = tkinter.READABLE | tkinter.WRITABLE\n" +"widget.tk.createfilehandler(file, mask, callback)\n" +"...\n" +"widget.tk.deletefilehandler(file)" +msgstr "" + +#: library/tkinter.rst:1019 msgid "This feature is not available on Windows." msgstr "" -#: library/tkinter.rst:1015 +#: library/tkinter.rst:1021 msgid "" "Since you don't know how many bytes are available for reading, you may not " "want to use the :class:`~io.BufferedIOBase` or :class:`~io.TextIOBase` :meth:" @@ -1702,7 +1876,7 @@ msgid "" "maxbytecount)``." msgstr "" -#: library/tkinter.rst:1026 +#: library/tkinter.rst:1032 msgid "" "Registers the file handler callback function *func*. The *file* argument may " "either be an object with a :meth:`~io.IOBase.fileno` method (such as a file " @@ -1711,26 +1885,30 @@ msgid "" "as follows::" msgstr "" -#: library/tkinter.rst:1037 +#: library/tkinter.rst:1038 +msgid "callback(file, mask)" +msgstr "" + +#: library/tkinter.rst:1043 msgid "Unregisters a file handler." msgstr "" -#: library/tkinter.rst:1044 +#: library/tkinter.rst:1050 msgid "Constants used in the *mask* arguments." msgstr "" -#: library/tkinter.rst:640 +#: library/tkinter.rst:638 msgid "packing (widgets)" msgstr "" -#: library/tkinter.rst:753 +#: library/tkinter.rst:751 msgid "window manager (widgets)" msgstr "" -#: library/tkinter.rst:870 +#: library/tkinter.rst:867 msgid "bind (widgets)" msgstr "" -#: library/tkinter.rst:870 +#: library/tkinter.rst:867 msgid "events (widgets)" msgstr "" diff --git a/library/tkinter.scrolledtext.po b/library/tkinter.scrolledtext.po index 316603cf..04b9e00f 100644 --- a/library/tkinter.scrolledtext.po +++ b/library/tkinter.scrolledtext.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tkinter.scrolledtext.rst:2 -msgid ":mod:`tkinter.scrolledtext` --- Scrolled Text Widget" +msgid ":mod:`!tkinter.scrolledtext` --- Scrolled Text Widget" msgstr "" #: library/tkinter.scrolledtext.rst:10 diff --git a/library/tkinter.tix.po b/library/tkinter.tix.po index 65c0c4f1..f09c00e0 100644 --- a/library/tkinter.tix.po +++ b/library/tkinter.tix.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-05-02 23:29+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -51,7 +52,7 @@ msgid "" "match the special needs of your application and users." msgstr "" -#: library/tkinter.tix.rst:38 +#: library/tkinter.tix.rst:36 msgid "`Tix Homepage `_" msgstr "" @@ -61,7 +62,7 @@ msgid "" "documentation and downloads." msgstr "" -#: library/tkinter.tix.rst:41 +#: library/tkinter.tix.rst:40 msgid "`Tix Man Pages `_" msgstr "" @@ -69,7 +70,7 @@ msgstr "" msgid "On-line version of the man pages and reference material." msgstr "" -#: library/tkinter.tix.rst:44 +#: library/tkinter.tix.rst:43 msgid "" "`Tix Programming Guide `_" @@ -79,7 +80,7 @@ msgstr "" msgid "On-line version of the programmer's reference material." msgstr "" -#: library/tkinter.tix.rst:48 +#: library/tkinter.tix.rst:46 msgid "" "`Tix Development Applications `_" @@ -111,6 +112,13 @@ msgid "" "`tkinter.Tk` with :class:`tix.Tk`::" msgstr "" +#: library/tkinter.tix.rst:67 +msgid "" +"from tkinter import tix\n" +"from tkinter.constants import *\n" +"root = tix.Tk()" +msgstr "" + #: library/tkinter.tix.rst:71 msgid "" "To use :mod:`tkinter.tix`, you must have the Tix widgets installed, usually " @@ -118,6 +126,13 @@ msgid "" "try the following::" msgstr "" +#: library/tkinter.tix.rst:75 +msgid "" +"from tkinter import tix\n" +"root = tix.Tk()\n" +"root.tk.eval('package require Tix')" +msgstr "" + #: library/tkinter.tix.rst:81 msgid "Tix Widgets" msgstr "" @@ -423,6 +438,13 @@ msgstr "" msgid "To view the current settings, the common usage is::" msgstr "" +#: library/tkinter.tix.rst:499 +msgid "" +"from tkinter import tix\n" +"root = tix.Tk()\n" +"print(root.tix_configure())" +msgstr "" + #: library/tkinter.tix.rst:506 msgid "" "Query or modify the configuration options of the Tix application context. If " diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 24623012..6a941ad4 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tkinter.ttk.rst:2 -msgid ":mod:`tkinter.ttk` --- Tk themed widgets" +msgid ":mod:`!tkinter.ttk` --- Tk themed widgets" msgstr "" #: library/tkinter.ttk.rst:9 @@ -56,11 +57,21 @@ msgstr "" msgid "To start using Ttk, import its module::" msgstr "" +#: library/tkinter.ttk.rst:36 +msgid "from tkinter import ttk" +msgstr "" + #: library/tkinter.ttk.rst:38 msgid "" "To override the basic Tk widgets, the import should follow the Tk import::" msgstr "" +#: library/tkinter.ttk.rst:40 +msgid "" +"from tkinter import *\n" +"from tkinter.ttk import *" +msgstr "" + #: library/tkinter.ttk.rst:43 msgid "" "That code causes several :mod:`tkinter.ttk` widgets (:class:`Button`, :class:" @@ -80,7 +91,7 @@ msgid "" "styling effects." msgstr "" -#: library/tkinter.ttk.rst:60 +#: library/tkinter.ttk.rst:59 msgid "" "`Converting existing applications to use Tile widgets `_" @@ -117,10 +128,25 @@ msgstr "" msgid "Tk code::" msgstr "" +#: library/tkinter.ttk.rst:80 +msgid "" +"l1 = tkinter.Label(text=\"Test\", fg=\"black\", bg=\"white\")\n" +"l2 = tkinter.Label(text=\"Test\", fg=\"black\", bg=\"white\")" +msgstr "" + #: library/tkinter.ttk.rst:84 msgid "Ttk code::" msgstr "" +#: library/tkinter.ttk.rst:86 +msgid "" +"style = ttk.Style()\n" +"style.configure(\"BW.TLabel\", foreground=\"black\", background=\"white\")\n" +"\n" +"l1 = ttk.Label(text=\"Test\", style=\"BW.TLabel\")\n" +"l2 = ttk.Label(text=\"Test\", style=\"BW.TLabel\")" +msgstr "" + #: library/tkinter.ttk.rst:92 msgid "" "For more information about TtkStyling_, see the :class:`Style` class " @@ -1486,7 +1512,7 @@ msgid "" "Otherwise, sets the options to the corresponding values." msgstr "" -#: library/tkinter.ttk.rst:1042 library/tkinter.ttk.rst:1520 +#: library/tkinter.ttk.rst:1042 library/tkinter.ttk.rst:1578 msgid "The valid options/values are:" msgstr "" @@ -1498,7 +1524,7 @@ msgstr "" msgid "Returns the column name. This is a read-only option." msgstr "" -#: library/tkinter.ttk.rst:992 +#: library/tkinter.ttk.rst:991 msgid "*anchor*: One of the standard Tk anchor values." msgstr "" @@ -1508,7 +1534,7 @@ msgid "" "cell." msgstr "" -#: library/tkinter.ttk.rst:996 +#: library/tkinter.ttk.rst:994 msgid "*minwidth*: width" msgstr "" @@ -1519,7 +1545,7 @@ msgid "" "resized or the user drags a column." msgstr "" -#: library/tkinter.ttk.rst:999 +#: library/tkinter.ttk.rst:998 msgid "*stretch*: ``True``/``False``" msgstr "" @@ -1529,7 +1555,7 @@ msgid "" "resized." msgstr "" -#: library/tkinter.ttk.rst:1002 +#: library/tkinter.ttk.rst:1001 msgid "*width*: width" msgstr "" @@ -1600,7 +1626,7 @@ msgstr "" msgid "Specifies an image to display to the right of the column heading." msgstr "" -#: library/tkinter.ttk.rst:1049 +#: library/tkinter.ttk.rst:1048 msgid "*anchor*: anchor" msgstr "" @@ -1610,7 +1636,7 @@ msgid "" "anchor values." msgstr "" -#: library/tkinter.ttk.rst:1052 +#: library/tkinter.ttk.rst:1051 msgid "*command*: callback" msgstr "" @@ -1896,6 +1922,22 @@ msgid "" "padding and a different background color::" msgstr "" +#: library/tkinter.ttk.rst:1294 +msgid "" +"from tkinter import ttk\n" +"import tkinter\n" +"\n" +"root = tkinter.Tk()\n" +"\n" +"ttk.Style().configure(\"TButton\", padding=6, relief=\"flat\",\n" +" background=\"#ccc\")\n" +"\n" +"btn = ttk.Button(text=\"Sample\")\n" +"btn.pack()\n" +"\n" +"root.mainloop()" +msgstr "" + #: library/tkinter.ttk.rst:1310 msgid "Query or sets dynamic values of the specified option(s) in *style*." msgstr "" @@ -1911,6 +1953,24 @@ msgstr "" msgid "An example may make it more understandable::" msgstr "" +#: library/tkinter.ttk.rst:1319 +msgid "" +"import tkinter\n" +"from tkinter import ttk\n" +"\n" +"root = tkinter.Tk()\n" +"\n" +"style = ttk.Style()\n" +"style.map(\"C.TButton\",\n" +" foreground=[('pressed', 'red'), ('active', 'blue')],\n" +" background=[('pressed', '!disabled', 'black'), ('active', 'white')]\n" +" )\n" +"\n" +"colored_btn = ttk.Button(text=\"Test\", style=\"C.TButton\").pack()\n" +"\n" +"root.mainloop()" +msgstr "" + #: library/tkinter.ttk.rst:1335 msgid "" "Note that the order of the (states, value) sequences for an option does " @@ -1934,6 +1994,13 @@ msgstr "" msgid "To check what font a Button uses by default::" msgstr "" +#: library/tkinter.ttk.rst:1351 +msgid "" +"from tkinter import ttk\n" +"\n" +"print(ttk.Style().lookup(\"TButton\", \"font\"))" +msgstr "" + #: library/tkinter.ttk.rst:1358 msgid "" "Define the widget layout for given *style*. If *layoutspec* is omitted, " @@ -1954,74 +2021,111 @@ msgid "" "do anything useful)::" msgstr "" +#: library/tkinter.ttk.rst:1369 +msgid "" +"from tkinter import ttk\n" +"import tkinter\n" +"\n" +"root = tkinter.Tk()\n" +"\n" +"style = ttk.Style()\n" +"style.layout(\"TMenubutton\", [\n" +" (\"Menubutton.background\", None),\n" +" (\"Menubutton.button\", {\"children\":\n" +" [(\"Menubutton.focus\", {\"children\":\n" +" [(\"Menubutton.padding\", {\"children\":\n" +" [(\"Menubutton.label\", {\"side\": \"left\", \"expand\": " +"1})]\n" +" })]\n" +" })]\n" +" }),\n" +"])\n" +"\n" +"mbtn = ttk.Menubutton(text='Text')\n" +"mbtn.pack()\n" +"root.mainloop()" +msgstr "" + #: library/tkinter.ttk.rst:1393 msgid "" "Create a new element in the current theme, of the given *etype* which is " -"expected to be either \"image\" or \"from\"." +"expected to be either \"image\", \"from\" or \"vsapi\". The latter is only " +"available in Tk 8.6 on Windows." msgstr "" -#: library/tkinter.ttk.rst:1396 +#: library/tkinter.ttk.rst:1397 msgid "" "If \"image\" is used, *args* should contain the default image name followed " "by statespec/value pairs (this is the imagespec), and *kw* may have the " "following options:" msgstr "" -#: library/tkinter.ttk.rst:1402 +#: library/tkinter.ttk.rst:1401 msgid "border=padding" msgstr "" -#: library/tkinter.ttk.rst:1401 +#: library/tkinter.ttk.rst:1402 msgid "" "padding is a list of up to four integers, specifying the left, top, right, " "and bottom borders, respectively." msgstr "" -#: library/tkinter.ttk.rst:1406 +#: library/tkinter.ttk.rst:1479 msgid "height=height" msgstr "" -#: library/tkinter.ttk.rst:1405 +#: library/tkinter.ttk.rst:1406 msgid "" "Specifies a minimum height for the element. If less than zero, the base " "image's height is used as a default." msgstr "" -#: library/tkinter.ttk.rst:1410 +#: library/tkinter.ttk.rst:1453 msgid "padding=padding" msgstr "" -#: library/tkinter.ttk.rst:1409 +#: library/tkinter.ttk.rst:1410 msgid "" "Specifies the element's interior padding. Defaults to border's value if not " "specified." msgstr "" -#: library/tkinter.ttk.rst:1414 +#: library/tkinter.ttk.rst:1413 msgid "sticky=spec" msgstr "" -#: library/tkinter.ttk.rst:1413 +#: library/tkinter.ttk.rst:1414 msgid "" "Specifies how the image is placed within the final parcel. spec contains " "zero or more characters \"n\", \"s\", \"w\", or \"e\"." msgstr "" -#: library/tkinter.ttk.rst:1418 +#: library/tkinter.ttk.rst:1471 msgid "width=width" msgstr "" -#: library/tkinter.ttk.rst:1417 +#: library/tkinter.ttk.rst:1418 msgid "" "Specifies a minimum width for the element. If less than zero, the base " "image's width is used as a default." msgstr "" -#: library/tkinter.ttk.rst:1437 +#: library/tkinter.ttk.rst:1438 library/tkinter.ttk.rst:1483 msgid "Example::" msgstr "" -#: library/tkinter.ttk.rst:1430 +#: library/tkinter.ttk.rst:1423 +msgid "" +"img1 = tkinter.PhotoImage(master=root, file='button.png')\n" +"img1 = tkinter.PhotoImage(master=root, file='button-pressed.png')\n" +"img1 = tkinter.PhotoImage(master=root, file='button-active.png')\n" +"style = ttk.Style(root)\n" +"style.element_create('Button.button', 'image',\n" +" img1, ('pressed', img2), ('active', img3),\n" +" border=(2, 4), sticky='we')" +msgstr "" + +#: library/tkinter.ttk.rst:1431 msgid "" "If \"from\" is used as the value of *etype*, :meth:`element_create` will " "clone an existing element. *args* is expected to contain a themename, from " @@ -2030,19 +2134,91 @@ msgid "" "used. *kw* is discarded." msgstr "" -#: library/tkinter.ttk.rst:1445 +#: library/tkinter.ttk.rst:1440 +msgid "" +"style = ttk.Style(root)\n" +"style.element_create('plain.background', 'from', 'default')" +msgstr "" + +#: library/tkinter.ttk.rst:1443 +msgid "" +"If \"vsapi\" is used as the value of *etype*, :meth:`element_create` will " +"create a new element in the current theme whose visual appearance is drawn " +"using the Microsoft Visual Styles API which is responsible for the themed " +"styles on Windows XP and Vista. *args* is expected to contain the Visual " +"Styles class and part as given in the Microsoft documentation followed by an " +"optional sequence of tuples of ttk states and the corresponding Visual " +"Styles API state value. *kw* may have the following options:" +msgstr "" + +#: library/tkinter.ttk.rst:1454 +msgid "" +"Specify the element's interior padding. *padding* is a list of up to four " +"integers specifying the left, top, right and bottom padding quantities " +"respectively. If fewer than four elements are specified, bottom defaults to " +"top, right defaults to left, and top defaults to left. In other words, a " +"list of three numbers specify the left, vertical, and right padding; a list " +"of two numbers specify the horizontal and the vertical padding; a single " +"number specifies the same padding all the way around the widget. This option " +"may not be mixed with any other options." +msgstr "" + +#: library/tkinter.ttk.rst:1465 +msgid "margins=padding" +msgstr "" + +#: library/tkinter.ttk.rst:1466 +msgid "" +"Specifies the elements exterior padding. *padding* is a list of up to four " +"integers specifying the left, top, right and bottom padding quantities " +"respectively. This option may not be mixed with any other options." +msgstr "" + +#: library/tkinter.ttk.rst:1472 +msgid "" +"Specifies the width for the element. If this option is set then the Visual " +"Styles API will not be queried for the recommended size or the part. If this " +"option is set then *height* should also be set. The *width* and *height* " +"options cannot be mixed with the *padding* or *margins* options." +msgstr "" + +#: library/tkinter.ttk.rst:1480 +msgid "Specifies the height of the element. See the comments for *width*." +msgstr "" + +#: library/tkinter.ttk.rst:1485 +msgid "" +"style = ttk.Style(root)\n" +"style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, [\n" +" ('pressed', '!selected', 3),\n" +" ('active', '!selected', 2),\n" +" ('pressed', 'selected', 6),\n" +" ('active', 'selected', 5),\n" +" ('selected', 4),\n" +" ('', 1)])\n" +"style.layout('Explorer.Pin',\n" +" [('Explorer.Pin.pin', {'sticky': 'news'})])\n" +"pin = ttk.Checkbutton(style='Explorer.Pin')\n" +"pin.pack(expand=True, fill='both')" +msgstr "" + +#: library/tkinter.ttk.rst:1498 +msgid "Added support of the \"vsapi\" element factory." +msgstr "" + +#: library/tkinter.ttk.rst:1503 msgid "Returns the list of elements defined in the current theme." msgstr "" -#: library/tkinter.ttk.rst:1450 +#: library/tkinter.ttk.rst:1508 msgid "Returns the list of *elementname*'s options." msgstr "" -#: library/tkinter.ttk.rst:1455 +#: library/tkinter.ttk.rst:1513 msgid "Create a new theme." msgstr "" -#: library/tkinter.ttk.rst:1457 +#: library/tkinter.ttk.rst:1515 msgid "" "It is an error if *themename* already exists. If *parent* is specified, the " "new theme will inherit styles, elements and layouts from the parent theme. " @@ -2050,13 +2226,13 @@ msgid "" "for :meth:`theme_settings`." msgstr "" -#: library/tkinter.ttk.rst:1465 +#: library/tkinter.ttk.rst:1523 msgid "" "Temporarily sets the current theme to *themename*, apply specified " "*settings* and then restore the previous theme." msgstr "" -#: library/tkinter.ttk.rst:1468 +#: library/tkinter.ttk.rst:1526 msgid "" "Each key in *settings* is a style and each value may contain the keys " "'configure', 'map', 'layout' and 'element create' and they are expected to " @@ -2065,26 +2241,52 @@ msgid "" "respectively." msgstr "" -#: library/tkinter.ttk.rst:1474 +#: library/tkinter.ttk.rst:1532 msgid "As an example, let's change the Combobox for the default theme a bit::" msgstr "" -#: library/tkinter.ttk.rst:1502 +#: library/tkinter.ttk.rst:1534 +msgid "" +"from tkinter import ttk\n" +"import tkinter\n" +"\n" +"root = tkinter.Tk()\n" +"\n" +"style = ttk.Style()\n" +"style.theme_settings(\"default\", {\n" +" \"TCombobox\": {\n" +" \"configure\": {\"padding\": 5},\n" +" \"map\": {\n" +" \"background\": [(\"active\", \"green2\"),\n" +" (\"!disabled\", \"green4\")],\n" +" \"fieldbackground\": [(\"!disabled\", \"green3\")],\n" +" \"foreground\": [(\"focus\", \"OliveDrab1\"),\n" +" (\"!disabled\", \"OliveDrab2\")]\n" +" }\n" +" }\n" +"})\n" +"\n" +"combo = ttk.Combobox().pack()\n" +"\n" +"root.mainloop()" +msgstr "" + +#: library/tkinter.ttk.rst:1560 msgid "Returns a list of all known themes." msgstr "" -#: library/tkinter.ttk.rst:1507 +#: library/tkinter.ttk.rst:1565 msgid "" "If *themename* is not given, returns the theme in use. Otherwise, sets the " "current theme to *themename*, refreshes all widgets and emits a " "<> event." msgstr "" -#: library/tkinter.ttk.rst:1513 +#: library/tkinter.ttk.rst:1571 msgid "Layouts" msgstr "" -#: library/tkinter.ttk.rst:1515 +#: library/tkinter.ttk.rst:1573 msgid "" "A layout can be just ``None``, if it takes no options, or a dict of options " "specifying how to arrange the element. The layout mechanism uses a " @@ -2092,40 +2294,40 @@ msgid "" "each element is allocated a parcel." msgstr "" -#: library/tkinter.ttk.rst:1525 +#: library/tkinter.ttk.rst:1580 msgid "*side*: whichside" msgstr "" -#: library/tkinter.ttk.rst:1523 +#: library/tkinter.ttk.rst:1581 msgid "" "Specifies which side of the cavity to place the element; one of top, right, " "bottom or left. If omitted, the element occupies the entire cavity." msgstr "" -#: library/tkinter.ttk.rst:1528 +#: library/tkinter.ttk.rst:1585 msgid "*sticky*: nswe" msgstr "" -#: library/tkinter.ttk.rst:1528 +#: library/tkinter.ttk.rst:1586 msgid "Specifies where the element is placed inside its allocated parcel." msgstr "" -#: library/tkinter.ttk.rst:1533 +#: library/tkinter.ttk.rst:1588 msgid "*unit*: 0 or 1" msgstr "" -#: library/tkinter.ttk.rst:1531 +#: library/tkinter.ttk.rst:1589 msgid "" "If set to 1, causes the element and all of its descendants to be treated as " "a single element for the purposes of :meth:`Widget.identify` et al. It's " "used for things like scrollbar thumbs with grips." msgstr "" -#: library/tkinter.ttk.rst:1538 +#: library/tkinter.ttk.rst:1593 msgid "*children*: [sublayout... ]" msgstr "" -#: library/tkinter.ttk.rst:1536 +#: library/tkinter.ttk.rst:1594 msgid "" "Specifies a list of elements to place inside the element. Each element is a " "tuple (or other sequence type) where the first item is the layout name, and " diff --git a/library/token.po b/library/token.po index 662177f2..9d88c357 100644 --- a/library/token.po +++ b/library/token.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/token.rst:2 -msgid ":mod:`token` --- Constants used with Python parse trees" +msgid ":mod:`!token` --- Constants used with Python parse trees" msgstr "" #: library/token.rst:9 @@ -39,271 +40,460 @@ msgid "" "functions. The functions mirror definitions in the Python C header files." msgstr "" -#: library/token.rst:25 +#: library/token.rst:22 +msgid "" +"Note that a token's value may depend on tokenizer options. For example, a " +"``\"+\"`` token may be reported as either :data:`PLUS` or :data:`OP`, or a " +"``\"match\"`` token may be either :data:`NAME` or :data:`SOFT_KEYWORD`." +msgstr "" + +#: library/token.rst:29 msgid "" "Dictionary mapping the numeric values of the constants defined in this " "module back to name strings, allowing more human-readable representation of " "parse trees to be generated." msgstr "" -#: library/token.rst:32 +#: library/token.rst:36 msgid "Return ``True`` for terminal token values." msgstr "" -#: library/token.rst:37 +#: library/token.rst:41 msgid "Return ``True`` for non-terminal token values." msgstr "" -#: library/token.rst:42 +#: library/token.rst:46 msgid "Return ``True`` if *x* is the marker indicating the end of input." msgstr "" -#: library/token.rst:45 +#: library/token.rst:49 msgid "The token constants are:" msgstr "" -#: library/token-list.inc:18 -msgid "Token value for ``\"(\"``." +#: library/token.rst:53 +msgid "" +"Token value that indicates an :ref:`identifier `. Note that " +"keywords are also initially tokenized as ``NAME`` tokens." msgstr "" -#: library/token-list.inc:22 -msgid "Token value for ``\")\"``." +#: library/token.rst:58 +msgid "Token value that indicates a :ref:`numeric literal `" msgstr "" -#: library/token-list.inc:26 -msgid "Token value for ``\"[\"``." +#: library/token.rst:62 +msgid "" +"Token value that indicates a :ref:`string or byte literal `, " +"excluding :ref:`formatted string literals `. The token string is " +"not interpreted: it includes the surrounding quotation marks and the prefix " +"(if given); backslashes are included literally, without processing escape " +"sequences." msgstr "" -#: library/token-list.inc:30 -msgid "Token value for ``\"]\"``." +#: library/token.rst:70 +msgid "" +"A generic token value that indicates an :ref:`operator ` or :ref:" +"`delimiter `." msgstr "" -#: library/token-list.inc:34 -msgid "Token value for ``\":\"``." +#: library/token.rst:75 +msgid "" +"This value is only reported by the :mod:`tokenize` module. Internally, the " +"tokenizer uses :ref:`exact token types ` instead." msgstr "" -#: library/token-list.inc:38 -msgid "Token value for ``\",\"``." +#: library/token.rst:81 +msgid "" +"Token value used to indicate a comment. The parser ignores :data:`!COMMENT` " +"tokens." msgstr "" -#: library/token-list.inc:42 -msgid "Token value for ``\";\"``." +#: library/token.rst:86 +msgid "" +"Token value that indicates the end of a :ref:`logical line `." msgstr "" -#: library/token-list.inc:46 -msgid "Token value for ``\"+\"``." +#: library/token.rst:90 +msgid "" +"Token value used to indicate a non-terminating newline. :data:`!NL` tokens " +"are generated when a logical line of code is continued over multiple " +"physical lines. The parser ignores :data:`!NL` tokens." msgstr "" -#: library/token-list.inc:50 -msgid "Token value for ``\"-\"``." +#: library/token.rst:96 +msgid "" +"Token value used at the beginning of a :ref:`logical line ` " +"to indicate the start of an :ref:`indented block `." msgstr "" -#: library/token-list.inc:54 -msgid "Token value for ``\"*\"``." +#: library/token.rst:101 +msgid "" +"Token value used at the beginning of a :ref:`logical line ` " +"to indicate the end of an :ref:`indented block `." msgstr "" -#: library/token-list.inc:58 -msgid "Token value for ``\"/\"``." +#: library/token.rst:106 +msgid "" +"Token value used to indicate the beginning of an :ref:`f-string literal `." msgstr "" -#: library/token-list.inc:62 -msgid "Token value for ``\"|\"``." +#: library/token.rst:140 +msgid "" +"The token string includes the prefix and the opening quote(s), but none of " +"the contents of the literal." msgstr "" -#: library/token-list.inc:66 -msgid "Token value for ``\"&\"``." +#: library/token.rst:116 +msgid "" +"Token value used for literal text inside an :ref:`f-string literal `, including format specifications." msgstr "" -#: library/token-list.inc:70 -msgid "Token value for ``\"<\"``." +#: library/token.rst:121 +msgid "" +"Replacement fields (that is, the non-literal parts of f-strings) use the " +"same tokens as other expressions, and are delimited by :data:`LBRACE`, :data:" +"`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` tokens." msgstr "" -#: library/token-list.inc:74 -msgid "Token value for ``\">\"``." +#: library/token.rst:128 +msgid "Token value used to indicate the end of a :ref:`f-string `." msgstr "" -#: library/token-list.inc:78 -msgid "Token value for ``\"=\"``." +#: library/token.rst:165 +msgid "The token string contains the closing quote(s)." msgstr "" -#: library/token-list.inc:82 -msgid "Token value for ``\".\"``." +#: library/token.rst:136 +msgid "" +"Token value used to indicate the beginning of a template string literal." msgstr "" -#: library/token-list.inc:86 -msgid "Token value for ``\"%\"``." +#: library/token.rst:147 +msgid "" +"Token value used for literal text inside a template string literal including " +"format specifications." msgstr "" -#: library/token-list.inc:90 -msgid "Token value for ``\"{\"``." +#: library/token.rst:152 +msgid "" +"Replacement fields (that is, the non-literal parts of t-strings) use the " +"same tokens as other expressions, and are delimited by :data:`LBRACE`, :data:" +"`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` tokens." msgstr "" -#: library/token-list.inc:94 -msgid "Token value for ``\"}\"``." +#: library/token.rst:161 +msgid "Token value used to indicate the end of a template string literal." msgstr "" -#: library/token-list.inc:98 -msgid "Token value for ``\"==\"``." +#: library/token.rst:171 +msgid "" +"Token value that indicates the end of input. Used in :ref:`top-level grammar " +"rules `." msgstr "" -#: library/token-list.inc:102 -msgid "Token value for ``\"!=\"``." +#: library/token.rst:176 +msgid "" +"Token value that indicates the encoding used to decode the source bytes into " +"text. The first token returned by :func:`tokenize.tokenize` will always be " +"an ``ENCODING`` token." msgstr "" -#: library/token-list.inc:106 -msgid "Token value for ``\"<=\"``." +#: library/token.rst:182 +msgid "" +"This token type isn't used by the C tokenizer but is needed for the :mod:" +"`tokenize` module." msgstr "" -#: library/token-list.inc:110 -msgid "Token value for ``\">=\"``." +#: library/token.rst:186 +msgid "" +"The following token types are not produced by the :mod:`tokenize` module, " +"and are defined for special uses in the tokenizer or parser:" msgstr "" -#: library/token-list.inc:114 -msgid "Token value for ``\"~\"``." +#: library/token.rst:191 +msgid "" +"Token value indicating that a ``type: ignore`` comment was recognized. Such " +"tokens are produced instead of regular :data:`COMMENT` tokens only with the :" +"data:`~ast.PyCF_TYPE_COMMENTS` flag." msgstr "" -#: library/token-list.inc:118 -msgid "Token value for ``\"^\"``." +#: library/token.rst:197 +msgid "" +"Token value indicating that a type comment was recognized. Such tokens are " +"produced instead of regular :data:`COMMENT` tokens only with the :data:`~ast." +"PyCF_TYPE_COMMENTS` flag." msgstr "" -#: library/token-list.inc:122 -msgid "Token value for ``\"<<\"``." +#: library/token.rst:203 +msgid "Token value indicating a :ref:`soft keyword `." msgstr "" -#: library/token-list.inc:126 -msgid "Token value for ``\">>\"``." +#: library/token.rst:205 +msgid "" +"The tokenizer never produces this value. To check for a soft keyword, pass " +"a :data:`NAME` token's string to :func:`keyword.issoftkeyword`." msgstr "" -#: library/token-list.inc:130 -msgid "Token value for ``\"**\"``." +#: library/token.rst:211 +msgid "Token value used to indicate wrong input." msgstr "" -#: library/token-list.inc:134 -msgid "Token value for ``\"+=\"``." +#: library/token.rst:213 +msgid "" +"The :mod:`tokenize` module generally indicates errors by raising exceptions " +"instead of emitting this token. It can also emit tokens such as :data:`OP` " +"or :data:`NAME` with strings that are later rejected by the parser." msgstr "" -#: library/token-list.inc:138 -msgid "Token value for ``\"-=\"``." +#: library/token.rst:221 +msgid "" +"The remaining tokens represent specific :ref:`operators ` and :" +"ref:`delimiters `. (The :mod:`tokenize` module reports these as :" +"data:`OP`; see ``exact_type`` in the :mod:`tokenize` documentation for " +"details.)" msgstr "" -#: library/token-list.inc:142 -msgid "Token value for ``\"*=\"``." +#: library/token-list.inc:7 +msgid "Token" msgstr "" -#: library/token-list.inc:146 -msgid "Token value for ``\"/=\"``." +#: library/token-list.inc:8 +msgid "Value" msgstr "" -#: library/token-list.inc:150 -msgid "Token value for ``\"%=\"``." +#: library/token-list.inc:10 +msgid "``\"(\"``" msgstr "" -#: library/token-list.inc:154 -msgid "Token value for ``\"&=\"``." +#: library/token-list.inc:12 +msgid "``\")\"``" msgstr "" -#: library/token-list.inc:158 -msgid "Token value for ``\"|=\"``." +#: library/token-list.inc:14 +msgid "``\"[\"``" msgstr "" -#: library/token-list.inc:162 -msgid "Token value for ``\"^=\"``." +#: library/token-list.inc:16 +msgid "``\"]\"``" msgstr "" -#: library/token-list.inc:166 -msgid "Token value for ``\"<<=\"``." +#: library/token-list.inc:18 +msgid "``\":\"``" msgstr "" -#: library/token-list.inc:170 -msgid "Token value for ``\">>=\"``." +#: library/token-list.inc:20 +msgid "``\",\"``" msgstr "" -#: library/token-list.inc:174 -msgid "Token value for ``\"**=\"``." +#: library/token-list.inc:22 +msgid "``\";\"``" msgstr "" -#: library/token-list.inc:178 -msgid "Token value for ``\"//\"``." +#: library/token-list.inc:24 +msgid "``\"+\"``" msgstr "" -#: library/token-list.inc:182 -msgid "Token value for ``\"//=\"``." +#: library/token-list.inc:26 +msgid "``\"-\"``" msgstr "" -#: library/token-list.inc:186 -msgid "Token value for ``\"@\"``." +#: library/token-list.inc:28 +msgid "``\"*\"``" msgstr "" -#: library/token-list.inc:190 -msgid "Token value for ``\"@=\"``." +#: library/token-list.inc:30 +msgid "``\"/\"``" msgstr "" -#: library/token-list.inc:194 -msgid "Token value for ``\"->\"``." +#: library/token-list.inc:32 +msgid "``\"|\"``" msgstr "" -#: library/token-list.inc:198 -msgid "Token value for ``\"...\"``." +#: library/token-list.inc:34 +msgid "``\"&\"``" msgstr "" -#: library/token-list.inc:202 -msgid "Token value for ``\":=\"``." +#: library/token-list.inc:36 +msgid "``\"<\"``" msgstr "" -#: library/token-list.inc:206 -msgid "Token value for ``\"!\"``." +#: library/token-list.inc:38 +msgid "``\">\"``" msgstr "" -#: library/token.rst:49 -msgid "" -"The following token type values aren't used by the C tokenizer but are " -"needed for the :mod:`tokenize` module." +#: library/token-list.inc:40 +msgid "``\"=\"``" msgstr "" -#: library/token.rst:55 -msgid "Token value used to indicate a comment." +#: library/token-list.inc:42 +msgid "``\".\"``" msgstr "" -#: library/token.rst:61 -msgid "" -"Token value used to indicate a non-terminating newline. The :data:`NEWLINE` " -"token indicates the end of a logical line of Python code; ``NL`` tokens are " -"generated when a logical line of code is continued over multiple physical " -"lines." +#: library/token-list.inc:44 +msgid "``\"%\"``" msgstr "" -#: library/token.rst:69 -msgid "" -"Token value that indicates the encoding used to decode the source bytes into " -"text. The first token returned by :func:`tokenize.tokenize` will always be " -"an ``ENCODING`` token." +#: library/token-list.inc:46 +msgid "``\"{\"``" +msgstr "" + +#: library/token-list.inc:48 +msgid "``\"}\"``" msgstr "" -#: library/token.rst:77 +#: library/token-list.inc:50 +msgid "``\"==\"``" +msgstr "" + +#: library/token-list.inc:52 +msgid "``\"!=\"``" +msgstr "" + +#: library/token-list.inc:54 +msgid "``\"<=\"``" +msgstr "" + +#: library/token-list.inc:56 +msgid "``\">=\"``" +msgstr "" + +#: library/token-list.inc:58 +msgid "``\"~\"``" +msgstr "" + +#: library/token-list.inc:60 +msgid "``\"^\"``" +msgstr "" + +#: library/token-list.inc:62 +msgid "``\"<<\"``" +msgstr "" + +#: library/token-list.inc:64 +msgid "``\">>\"``" +msgstr "" + +#: library/token-list.inc:66 +msgid "``\"**\"``" +msgstr "" + +#: library/token-list.inc:68 +msgid "``\"+=\"``" +msgstr "" + +#: library/token-list.inc:70 +msgid "``\"-=\"``" +msgstr "" + +#: library/token-list.inc:72 +msgid "``\"*=\"``" +msgstr "" + +#: library/token-list.inc:74 +msgid "``\"/=\"``" +msgstr "" + +#: library/token-list.inc:76 +msgid "``\"%=\"``" +msgstr "" + +#: library/token-list.inc:78 +msgid "``\"&=\"``" +msgstr "" + +#: library/token-list.inc:80 +msgid "``\"|=\"``" +msgstr "" + +#: library/token-list.inc:82 +msgid "``\"^=\"``" +msgstr "" + +#: library/token-list.inc:84 +msgid "``\"<<=\"``" +msgstr "" + +#: library/token-list.inc:86 +msgid "``\">>=\"``" +msgstr "" + +#: library/token-list.inc:88 +msgid "``\"**=\"``" +msgstr "" + +#: library/token-list.inc:90 +msgid "``\"//\"``" +msgstr "" + +#: library/token-list.inc:92 +msgid "``\"//=\"``" +msgstr "" + +#: library/token-list.inc:94 +msgid "``\"@\"``" +msgstr "" + +#: library/token-list.inc:96 +msgid "``\"@=\"``" +msgstr "" + +#: library/token-list.inc:98 +msgid "``\"->\"``" +msgstr "" + +#: library/token-list.inc:100 +msgid "``\"...\"``" +msgstr "" + +#: library/token-list.inc:102 +msgid "``\":=\"``" +msgstr "" + +#: library/token-list.inc:104 +msgid "``\"!\"``" +msgstr "" + +#: library/token.rst:229 +msgid "The following non-token constants are provided:" +msgstr "" + +#: library/token.rst:233 +msgid "The number of token types defined in this module." +msgstr "" + +#: library/token.rst:240 msgid "" -"Token value indicating that a type comment was recognized. Such tokens are " -"only produced when :func:`ast.parse()` is invoked with " -"``type_comments=True``." +"A dictionary mapping the string representation of a token to its numeric " +"code." msgstr "" -#: library/token.rst:82 -msgid "Added :data:`AWAIT` and :data:`ASYNC` tokens." +#: library/token.rst:245 +msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" -#: library/token.rst:85 +#: library/token.rst:248 msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens." msgstr "" -#: library/token.rst:88 +#: library/token.rst:251 msgid "" -"Removed :data:`AWAIT` and :data:`ASYNC` tokens. \"async\" and \"await\" are " -"now tokenized as :data:`NAME` tokens." +"Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " +"are now tokenized as :data:`NAME` tokens." msgstr "" -#: library/token.rst:92 +#: library/token.rst:255 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" -"data:`AWAIT` and :data:`ASYNC` tokens back (they're needed to support " +"data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " "parsing older Python versions for :func:`ast.parse` with ``feature_version`` " "set to 6 or lower)." msgstr "" + +#: library/token.rst:261 +msgid "Added :data:`EXCLAMATION`." +msgstr "" + +#: library/token.rst:264 +msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." +msgstr "" diff --git a/library/tokenize.po b/library/tokenize.po index f4250d31..d3d64e7f 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tokenize.rst:2 -msgid ":mod:`tokenize` --- Tokenizer for Python source" +msgid ":mod:`!tokenize` --- Tokenizer for Python source" msgstr "" #: library/tokenize.rst:10 @@ -138,40 +139,39 @@ msgstr "" #: library/tokenize.rst:94 msgid "" -"The reconstructed script is returned as a single string. The result is " -"guaranteed to tokenize back to match the input so that the conversion is " -"lossless and round-trips are assured. The guarantee applies only to the " -"token type and token string as the spacing between tokens (column positions) " -"may change." +"The result is guaranteed to tokenize back to match the input so that the " +"conversion is lossless and round-trips are assured. The guarantee applies " +"only to the token type and token string as the spacing between tokens " +"(column positions) may change." msgstr "" -#: library/tokenize.rst:100 +#: library/tokenize.rst:99 msgid "" "It returns bytes, encoded using the :data:`~token.ENCODING` token, which is " "the first token sequence output by :func:`.tokenize`. If there is no " "encoding token in the input, it returns a str instead." msgstr "" -#: library/tokenize.rst:105 +#: library/tokenize.rst:104 msgid "" ":func:`.tokenize` needs to detect the encoding of source files it tokenizes. " "The function it uses to do this is available:" msgstr "" -#: library/tokenize.rst:110 +#: library/tokenize.rst:109 msgid "" "The :func:`detect_encoding` function is used to detect the encoding that " "should be used to decode a Python source file. It requires one argument, " "readline, in the same way as the :func:`.tokenize` generator." msgstr "" -#: library/tokenize.rst:114 +#: library/tokenize.rst:113 msgid "" "It will call readline a maximum of twice, and return the encoding used (as a " "string) and a list of any lines (not decoded from bytes) it has read in." msgstr "" -#: library/tokenize.rst:118 +#: library/tokenize.rst:117 msgid "" "It detects the encoding from the presence of a UTF-8 BOM or an encoding " "cookie as specified in :pep:`263`. If both a BOM and a cookie are present, " @@ -179,77 +179,145 @@ msgid "" "found, ``'utf-8-sig'`` will be returned as an encoding." msgstr "" -#: library/tokenize.rst:123 +#: library/tokenize.rst:122 msgid "" "If no encoding is specified, then the default of ``'utf-8'`` will be " "returned." msgstr "" -#: library/tokenize.rst:126 +#: library/tokenize.rst:125 msgid "" "Use :func:`.open` to open Python source files: it uses :func:" "`detect_encoding` to detect the file encoding." msgstr "" -#: library/tokenize.rst:132 +#: library/tokenize.rst:131 msgid "" "Open a file in read only mode using the encoding detected by :func:" "`detect_encoding`." msgstr "" -#: library/tokenize.rst:139 +#: library/tokenize.rst:138 msgid "" "Raised when either a docstring or expression that may be split over several " "lines is not completed anywhere in the file, for example::" msgstr "" -#: library/tokenize.rst:145 +#: library/tokenize.rst:141 +msgid "" +"\"\"\"Beginning of\n" +"docstring" +msgstr "" + +#: library/tokenize.rst:144 msgid "or::" msgstr "" -#: library/tokenize.rst:154 +#: library/tokenize.rst:146 +msgid "" +"[1,\n" +" 2,\n" +" 3" +msgstr "" + +#: library/tokenize.rst:153 msgid "Command-Line Usage" msgstr "" -#: library/tokenize.rst:158 +#: library/tokenize.rst:157 msgid "" "The :mod:`tokenize` module can be executed as a script from the command " "line. It is as simple as:" msgstr "" -#: library/tokenize.rst:165 +#: library/tokenize.rst:160 +msgid "python -m tokenize [-e] [filename.py]" +msgstr "" + +#: library/tokenize.rst:164 msgid "The following options are accepted:" msgstr "" -#: library/tokenize.rst:171 +#: library/tokenize.rst:170 msgid "show this help message and exit" msgstr "" -#: library/tokenize.rst:175 +#: library/tokenize.rst:174 msgid "display token names using the exact type" msgstr "" -#: library/tokenize.rst:177 +#: library/tokenize.rst:176 msgid "" "If :file:`filename.py` is specified its contents are tokenized to stdout. " "Otherwise, tokenization is performed on stdin." msgstr "" -#: library/tokenize.rst:181 +#: library/tokenize.rst:180 msgid "Examples" msgstr "" -#: library/tokenize.rst:183 +#: library/tokenize.rst:182 msgid "" "Example of a script rewriter that transforms float literals into Decimal " "objects::" msgstr "" -#: library/tokenize.rst:225 +#: library/tokenize.rst:185 +msgid "" +"from tokenize import tokenize, untokenize, NUMBER, STRING, NAME, OP\n" +"from io import BytesIO\n" +"\n" +"def decistmt(s):\n" +" \"\"\"Substitute Decimals for floats in a string of statements.\n" +"\n" +" >>> from decimal import Decimal\n" +" >>> s = 'print(+21.3e-5*-.1234/81.7)'\n" +" >>> decistmt(s)\n" +" \"print (+Decimal ('21.3e-5')*-Decimal ('.1234')/Decimal ('81.7'))\"\n" +"\n" +" The format of the exponent is inherited from the platform C library.\n" +" Known cases are \"e-007\" (Windows) and \"e-07\" (not Windows). Since\n" +" we're only showing 12 digits, and the 13th isn't close to 5, the\n" +" rest of the output should be platform-independent.\n" +"\n" +" >>> exec(s) #doctest: +ELLIPSIS\n" +" -3.21716034272e-0...7\n" +"\n" +" Output from calculations with Decimal should be identical across all\n" +" platforms.\n" +"\n" +" >>> exec(decistmt(s))\n" +" -3.217160342717258261933904529E-7\n" +" \"\"\"\n" +" result = []\n" +" g = tokenize(BytesIO(s.encode('utf-8')).readline) # tokenize the " +"string\n" +" for toknum, tokval, _, _, _ in g:\n" +" if toknum == NUMBER and '.' in tokval: # replace NUMBER tokens\n" +" result.extend([\n" +" (NAME, 'Decimal'),\n" +" (OP, '('),\n" +" (STRING, repr(tokval)),\n" +" (OP, ')')\n" +" ])\n" +" else:\n" +" result.append((toknum, tokval))\n" +" return untokenize(result).decode('utf-8')" +msgstr "" + +#: library/tokenize.rst:224 msgid "Example of tokenizing from the command line. The script::" msgstr "" -#: library/tokenize.rst:232 +#: library/tokenize.rst:226 +msgid "" +"def say_hello():\n" +" print(\"Hello, World!\")\n" +"\n" +"say_hello()" +msgstr "" + +#: library/tokenize.rst:231 msgid "" "will be tokenized to the following output where the first column is the " "range of the line/column coordinates where the token is found, the second " @@ -257,17 +325,87 @@ msgid "" "token (if any)" msgstr "" -#: library/tokenize.rst:260 +#: library/tokenize.rst:235 +msgid "" +"$ python -m tokenize hello.py\n" +"0,0-0,0: ENCODING 'utf-8'\n" +"1,0-1,3: NAME 'def'\n" +"1,4-1,13: NAME 'say_hello'\n" +"1,13-1,14: OP '('\n" +"1,14-1,15: OP ')'\n" +"1,15-1,16: OP ':'\n" +"1,16-1,17: NEWLINE '\\n'\n" +"2,0-2,4: INDENT ' '\n" +"2,4-2,9: NAME 'print'\n" +"2,9-2,10: OP '('\n" +"2,10-2,25: STRING '\"Hello, World!\"'\n" +"2,25-2,26: OP ')'\n" +"2,26-2,27: NEWLINE '\\n'\n" +"3,0-3,1: NL '\\n'\n" +"4,0-4,0: DEDENT ''\n" +"4,0-4,9: NAME 'say_hello'\n" +"4,9-4,10: OP '('\n" +"4,10-4,11: OP ')'\n" +"4,11-4,12: NEWLINE '\\n'\n" +"5,0-5,0: ENDMARKER ''" +msgstr "" + +#: library/tokenize.rst:259 msgid "" "The exact token type names can be displayed using the :option:`-e` option:" msgstr "" -#: library/tokenize.rst:286 +#: library/tokenize.rst:261 +msgid "" +"$ python -m tokenize -e hello.py\n" +"0,0-0,0: ENCODING 'utf-8'\n" +"1,0-1,3: NAME 'def'\n" +"1,4-1,13: NAME 'say_hello'\n" +"1,13-1,14: LPAR '('\n" +"1,14-1,15: RPAR ')'\n" +"1,15-1,16: COLON ':'\n" +"1,16-1,17: NEWLINE '\\n'\n" +"2,0-2,4: INDENT ' '\n" +"2,4-2,9: NAME 'print'\n" +"2,9-2,10: LPAR '('\n" +"2,10-2,25: STRING '\"Hello, World!\"'\n" +"2,25-2,26: RPAR ')'\n" +"2,26-2,27: NEWLINE '\\n'\n" +"3,0-3,1: NL '\\n'\n" +"4,0-4,0: DEDENT ''\n" +"4,0-4,9: NAME 'say_hello'\n" +"4,9-4,10: LPAR '('\n" +"4,10-4,11: RPAR ')'\n" +"4,11-4,12: NEWLINE '\\n'\n" +"5,0-5,0: ENDMARKER ''" +msgstr "" + +#: library/tokenize.rst:285 msgid "" "Example of tokenizing a file programmatically, reading unicode strings " "instead of bytes with :func:`generate_tokens`::" msgstr "" -#: library/tokenize.rst:296 +#: library/tokenize.rst:288 +msgid "" +"import tokenize\n" +"\n" +"with tokenize.open('hello.py') as f:\n" +" tokens = tokenize.generate_tokens(f.readline)\n" +" for token in tokens:\n" +" print(token)" +msgstr "" + +#: library/tokenize.rst:295 msgid "Or reading bytes directly with :func:`.tokenize`::" msgstr "" + +#: library/tokenize.rst:297 +msgid "" +"import tokenize\n" +"\n" +"with open('hello.py', 'rb') as f:\n" +" tokens = tokenize.tokenize(f.readline)\n" +" for token in tokens:\n" +" print(token)" +msgstr "" diff --git a/library/tomllib.po b/library/tomllib.po index 4f1de2f3..27ff017f 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tomllib.rst:2 -msgid ":mod:`tomllib` --- Parse TOML files" +msgid ":mod:`!tomllib` --- Parse TOML files" msgstr "" #: library/tomllib.rst:12 @@ -26,25 +27,23 @@ msgstr "" #: library/tomllib.rst:16 msgid "" -"This module provides an interface for parsing TOML (Tom's Obvious Minimal " -"Language, `https://toml.io `_). This module does not " -"support writing TOML." +"This module provides an interface for parsing TOML 1.0.0 (Tom's Obvious " +"Minimal Language, `https://toml.io `_). This module " +"does not support writing TOML." msgstr "" #: library/tomllib.rst:22 msgid "" -"The `Tomli-W package `__ is a TOML writer " -"that can be used in conjunction with this module, providing a write API " -"familiar to users of the standard library :mod:`marshal` and :mod:`pickle` " -"modules." +"The :pypi:`Tomli-W package ` is a TOML writer that can be used in " +"conjunction with this module, providing a write API familiar to users of the " +"standard library :mod:`marshal` and :mod:`pickle` modules." msgstr "" #: library/tomllib.rst:29 msgid "" -"The `TOML Kit package `__ is a style-" -"preserving TOML library with both read and write capability. It is a " -"recommended replacement for this module for editing already existing TOML " -"files." +"The :pypi:`TOML Kit package ` is a style-preserving TOML library " +"with both read and write capability. It is a recommended replacement for " +"this module for editing already existing TOML files." msgstr "" #: library/tomllib.rst:35 @@ -83,127 +82,177 @@ msgid "The following exceptions are available:" msgstr "" #: library/tomllib.rst:65 -msgid "Subclass of :exc:`ValueError`." +msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr "" #: library/tomllib.rst:69 +msgid "The unformatted error message." +msgstr "" + +#: library/tomllib.rst:73 +msgid "The TOML document being parsed." +msgstr "" + +#: library/tomllib.rst:77 +msgid "The index of *doc* where parsing failed." +msgstr "" + +#: library/tomllib.rst:81 +msgid "The line corresponding to *pos*." +msgstr "" + +#: library/tomllib.rst:85 +msgid "The column corresponding to *pos*." +msgstr "" + +#: library/tomllib.rst:87 +msgid "" +"Added the *msg*, *doc* and *pos* parameters. Added the :attr:`msg`, :attr:" +"`doc`, :attr:`pos`, :attr:`lineno` and :attr:`colno` attributes." +msgstr "" + +#: library/tomllib.rst:91 +msgid "Passing free-form positional arguments is deprecated." +msgstr "" + +#: library/tomllib.rst:96 msgid "Examples" msgstr "" -#: library/tomllib.rst:71 +#: library/tomllib.rst:98 msgid "Parsing a TOML file::" msgstr "" -#: library/tomllib.rst:78 +#: library/tomllib.rst:100 +msgid "" +"import tomllib\n" +"\n" +"with open(\"pyproject.toml\", \"rb\") as f:\n" +" data = tomllib.load(f)" +msgstr "" + +#: library/tomllib.rst:105 msgid "Parsing a TOML string::" msgstr "" -#: library/tomllib.rst:91 +#: library/tomllib.rst:107 +msgid "" +"import tomllib\n" +"\n" +"toml_str = \"\"\"\n" +"python-version = \"3.11.0\"\n" +"python-implementation = \"CPython\"\n" +"\"\"\"\n" +"\n" +"data = tomllib.loads(toml_str)" +msgstr "" + +#: library/tomllib.rst:118 msgid "Conversion Table" msgstr "" -#: library/tomllib.rst:96 +#: library/tomllib.rst:123 msgid "TOML" msgstr "" -#: library/tomllib.rst:96 +#: library/tomllib.rst:123 msgid "Python" msgstr "" -#: library/tomllib.rst:98 +#: library/tomllib.rst:125 msgid "TOML document" msgstr "" -#: library/tomllib.rst:118 library/tomllib.rst:120 +#: library/tomllib.rst:145 library/tomllib.rst:147 msgid "dict" msgstr "" -#: library/tomllib.rst:100 +#: library/tomllib.rst:127 msgid "string" msgstr "" -#: library/tomllib.rst:100 +#: library/tomllib.rst:127 msgid "str" msgstr "" -#: library/tomllib.rst:102 +#: library/tomllib.rst:129 msgid "integer" msgstr "" -#: library/tomllib.rst:102 +#: library/tomllib.rst:129 msgid "int" msgstr "" -#: library/tomllib.rst:104 +#: library/tomllib.rst:131 msgid "float" msgstr "" -#: library/tomllib.rst:104 +#: library/tomllib.rst:131 msgid "float (configurable with *parse_float*)" msgstr "" -#: library/tomllib.rst:106 +#: library/tomllib.rst:133 msgid "boolean" msgstr "" -#: library/tomllib.rst:106 +#: library/tomllib.rst:133 msgid "bool" msgstr "" -#: library/tomllib.rst:108 +#: library/tomllib.rst:135 msgid "offset date-time" msgstr "" -#: library/tomllib.rst:108 +#: library/tomllib.rst:135 msgid "" "datetime.datetime (``tzinfo`` attribute set to an instance of ``datetime." "timezone``)" msgstr "" -#: library/tomllib.rst:110 +#: library/tomllib.rst:137 msgid "local date-time" msgstr "" -#: library/tomllib.rst:110 +#: library/tomllib.rst:137 msgid "datetime.datetime (``tzinfo`` attribute set to ``None``)" msgstr "" -#: library/tomllib.rst:112 +#: library/tomllib.rst:139 msgid "local date" msgstr "" -#: library/tomllib.rst:112 +#: library/tomllib.rst:139 msgid "datetime.date" msgstr "" -#: library/tomllib.rst:114 +#: library/tomllib.rst:141 msgid "local time" msgstr "" -#: library/tomllib.rst:114 +#: library/tomllib.rst:141 msgid "datetime.time" msgstr "" -#: library/tomllib.rst:116 +#: library/tomllib.rst:143 msgid "array" msgstr "" -#: library/tomllib.rst:116 +#: library/tomllib.rst:143 msgid "list" msgstr "" -#: library/tomllib.rst:118 +#: library/tomllib.rst:145 msgid "table" msgstr "" -#: library/tomllib.rst:120 +#: library/tomllib.rst:147 msgid "inline table" msgstr "" -#: library/tomllib.rst:122 +#: library/tomllib.rst:149 msgid "array of tables" msgstr "" -#: library/tomllib.rst:122 +#: library/tomllib.rst:149 msgid "list of dicts" msgstr "" diff --git a/library/trace.po b/library/trace.po index 8eadb2a9..b62c41e2 100644 --- a/library/trace.po +++ b/library/trace.po @@ -3,26 +3,28 @@ # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # -#, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python docs\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-07-30 09:47+0300\n" +"Last-Translator: Maximos Nikiforakis nikiforos@live.co.uk\n" +"Language-Team: PyGreece \n" +"Language: el_GR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 3.0.1\n" #: library/trace.rst:2 -msgid ":mod:`trace` --- Trace or track Python statement execution" -msgstr "" +msgid ":mod:`!trace` --- Trace or track Python statement execution" +msgstr ":mod:`!trace` --- Ιχνηλάτηση ή παρακολούθηση εκτέλεσης εντολών Python" #: library/trace.rst:7 msgid "**Source code:** :source:`Lib/trace.py`" -msgstr "" +msgstr "**Source code:** :source:`Lib/trace.py`" #: library/trace.rst:11 msgid "" @@ -31,26 +33,39 @@ msgid "" "list functions executed during a program run. It can be used in another " "program or from the command line." msgstr "" +"Το module :mod:`trace` σας επιτρέπει να ιχνηλατήσετε την εκτέλεση ενός " +"προγράμματος, να παράγετε αρχεία κάλυψης με σημειωμένες δηλώσεις , να " +"εκτυπώσετε σχέσεις κλήσεων και να αριθμήσετε τις συναρτήσεις που καλούνται " +"κατά την εκτέλεση ενός προγράμματος. Μπορεί να χρησιμοποιηθεί σε κάποιο " +"πρόγραμμα ή μέσω της γραμμής εντολών." -#: library/trace.rst:19 +#: library/trace.rst:18 msgid "`Coverage.py `_" -msgstr "" +msgstr "`Coverage.py `_" #: library/trace.rst:19 msgid "" "A popular third-party coverage tool that provides HTML output along with " "advanced features such as branch coverage." msgstr "" +"Ένα δημοφιλές εργαλείο (διανέμεται από τρίτους) που παράγει αποτελέσματα σε " +"HTML και διαθέτει ανεπτυγμένες δυνατότητες όπως branch coverage." #: library/trace.rst:25 msgid "Command-Line Usage" -msgstr "" +msgstr "Οδηγίες χρήσης γραμμής εντολών" #: library/trace.rst:27 msgid "" "The :mod:`trace` module can be invoked from the command line. It can be as " "simple as ::" msgstr "" +"Το module :mod:`trace` μπορεί να κληθεί και από τη γραμμή εντολών , απλώς ως " +"εξής ::" + +#: library/trace.rst:30 +msgid "python -m trace --count -C . somefile.py ..." +msgstr "python -m trace --count -C . somefile.py ..." #: library/trace.rst:32 msgid "" @@ -58,22 +73,27 @@ msgid "" "of all Python modules imported during the execution into the current " "directory." msgstr "" +"Το παραπάνω θα εκτελέσει το αρχείο :file:`somefile.py` και θα παράγει μια " +"σημειωμένη λίστα με όλα τα Python modules που εισήχθησαν κατά την εκτέλεση " +"στον τρέχων φάκελο." #: library/trace.rst:39 msgid "Display usage and exit." -msgstr "" +msgstr "Εμφανίζει τις οδηγίες χρήσης και τερματίζει την εκτέλεση." #: library/trace.rst:43 msgid "Display the version of the module and exit." -msgstr "" +msgstr "Εμφανίζει την έκδοση του module και τερματίζει την εκτέλεση." #: library/trace.rst:45 msgid "Added ``--module`` option that allows to run an executable module." msgstr "" +"Προσετέθη η επιλογή ``--module`` που επιτρέπει την εκτέλεση ενός εκτελέσιμου " +"module." #: library/trace.rst:49 msgid "Main options" -msgstr "" +msgstr "Κύριες επιλογές" #: library/trace.rst:51 msgid "" @@ -83,6 +103,12 @@ msgid "" "`--listfuncs <-l>` is provided, neither :option:`--count <-c>` nor :option:" "`--trace <-t>` are accepted, and vice versa." msgstr "" +"Τουλάχιστον μία από τις ακόλουθες επιλογές πρέπει να προσδιορισθεί όταν " +"καλείται η :mod:`trace`. Η επιλογή :option:`--listfunc <-l>` είναι αμοιβαίως " +"αποκλειόμενη με την επιλογή :option:`--trace <-t>` και την επιλογή :option:" +"`--count <-c>`. Όταν δίνεται η επιλογή :option:`--listfuncs <-l>` δεν " +"γίνονται αποδεκτές οι επιλογές :option:`--count <-c>` ή :option:`--trace <-" +"t>` και το αντίστροφο." #: library/trace.rst:61 msgid "" @@ -90,14 +116,18 @@ msgid "" "how many times each statement was executed. See also :option:`--coverdir <-" "C>`, :option:`--file <-f>` and :option:`--no-report <-R>` below." msgstr "" +"Κατά την ολοκλήρωση του προγράμματος δημιουργεί ένα σύνολο από σημειωμένα " +"αρχεία όπου φαίνεται πόσες φορές εκτελέσθηκε κάθε έκφραση. Βλέπε επίσης :" +"option:`--coverdir <-C>`, :option:`--file <-f>` και :option:`--no-report <-" +"R>` παρακάτω." #: library/trace.rst:68 msgid "Display lines as they are executed." -msgstr "" +msgstr "Εμφανίζει τις γραμμές όπως εκτελούνται." #: library/trace.rst:72 msgid "Display the functions executed by running the program." -msgstr "" +msgstr "Εμφανίζει τις συναρτήσεις που εκτελούνται τρέχοντας το πρόγραμμα." #: library/trace.rst:76 msgid "" @@ -105,38 +135,51 @@ msgid "" "`--count <-c>` and :option:`--file <-f>` option. This does not execute any " "code." msgstr "" +"Παράγει μία σημειωμένη λίστα από την πρότερη εκτέλεση ενός προγράμματος που " +"χρησιμοποίησε την επιλογή :option:`--count<-c>` και :option:`--file <-f>`. " +"Δεν εκτελείται κάποιος κώδικας με την παρούσα επιλογή." #: library/trace.rst:82 msgid "Display the calling relationships exposed by running the program." msgstr "" +"Εμφανίζει τις σχέσεις κλήσεων που δημιουργούνται εκτελώντας το πρόγραμμα." #: library/trace.rst:85 msgid "Modifiers" -msgstr "" +msgstr "Τροποποιητές" #: library/trace.rst:91 msgid "" "Name of a file to accumulate counts over several tracing runs. Should be " "used with the :option:`--count <-c>` option." msgstr "" +"Όνομα αρχείου όπου σωρεύονται οι μετρήσεις πολλαπλών ιχνηλατήσεων. Πρέπει " +"να χρησιμοποιείται με την επιλογή :option:`--count <-c>`." #: library/trace.rst:96 msgid "" "Directory where the report files go. The coverage report for ``package." "module`` is written to file :file:`{dir}/{package}/{module}.cover`." msgstr "" +"Κατάλογος όπου αποθηκεύονται τα αρχεία αναφοράς. Η αναφορά κάλυψης (coverage " +"report) για το ``package.module`` εγγράφεται στο αρχείο :file:`{dir}/" +"{package}/{module}.cover`." #: library/trace.rst:101 msgid "" "When generating annotated listings, mark lines which were not executed with " "``>>>>>>``." msgstr "" +"Κατά την παραγωγή σημειωμένων λιστών, σημειώνει τις γραμμές που δεν " +"εκτελέστηκαν με ``>>>>>>``." #: library/trace.rst:106 msgid "" "When using :option:`--count <-c>` or :option:`--report <-r>`, write a brief " "summary to stdout for each file processed." msgstr "" +"Κατά την χρήση της επιλογής :option:`--count <-c>` ή της επιλογής :option:`--" +"report <-r>`, γράφει μία σύντομη περίληψη για κάθε αρχείο που επεξεργάζεται." #: library/trace.rst:111 msgid "" @@ -144,36 +187,46 @@ msgid "" "several runs with :option:`--count <-c>`, and then produce a single set of " "annotated listings at the end." msgstr "" +"Δεν δημιουργεί σημειωμένες λίστες. Αυτή η επιλογή είναι χρήσιμη εάν " +"σκοπεύετε να κάνετε πολλές εκτελέσεις με την επιλογή :option:`--count <-c>` " +"και τελικώς δημιουργήσετε ένα ενιαίο σύνολο σημειωμένων λιστών." #: library/trace.rst:117 msgid "" "Prefix each line with the time since the program started. Only used while " "tracing." msgstr "" +"Προθεμάτιζει κάθε γραμμή με τον χρόνο που παρήλθε από την εκκίνηση του " +"προγράμματος. Χρησιμοποιείται μόνο κατά την ιχνηλάτηση." #: library/trace.rst:121 msgid "Filters" -msgstr "" +msgstr "Φίλτρα" #: library/trace.rst:123 msgid "These options may be repeated multiple times." -msgstr "" +msgstr "Αυτές οι επιλογές μπορούν να επαναληφθούν πολλαπλές φορές." #: library/trace.rst:129 msgid "" "Ignore each of the given module names and its submodules (if it is a " "package). The argument can be a list of names separated by a comma." msgstr "" +"Αγνόησε κάθε ένα από τα δεδομένα modules και submodules (εάν είναι πακέτο). " +"Το όρισμα μπορεί να είναι μία λίστα από ονόματα διαχωρισμένα με κόμμα." #: library/trace.rst:134 msgid "" "Ignore all modules and packages in the named directory and subdirectories. " "The argument can be a list of directories separated by :data:`os.pathsep`." msgstr "" +"Αγνοεί όλα τα modules και πακέτα στους δεδομένους φακέλους και υποφακέλους. " +"Το όρισμα μπορεί να είναι μία λίστα από φάκελους που χωρίζονται με :data:`os." +"pathsep`." #: library/trace.rst:140 msgid "Programmatic Interface" -msgstr "" +msgstr "Προγραμματιστική διεπαφή" #: library/trace.rst:145 msgid "" @@ -188,6 +241,18 @@ msgid "" "count information. *timing* enables a timestamp relative to when tracing " "was started to be displayed." msgstr "" +"Δημιουργεί ένα αντικείμενο για την ιχνηλάτηση της εκτέλεσης μίας μόνο " +"εντολής ή έκφρασης. Όλες οι παράμετροι είναι προαιρετικές. Η *count* " +"επιτρέπει την αρίθμηση των γραμμών. Η *trace* επιτρέπει την ιχνηλάτηση " +"εκτελέσεων ανά γραμμή. Η *countfuncs* επιτρέπει την αρίθμηση των συναρτήσεων " +"που εκλήθησαν κατά την εκτέλεση. Η *countcallers* επιτρέπει την ιχνηλάτηση " +"συσχετισμένων κλήσεων. Η *ignoremods* είναι μία λίστα με modules ή πακέτα " +"προς παράβλεψη. Η *ignoredirs* είναι μία λίστα φακέλων με προς παράβλεψη " +"modules ή πακέτα. Η *infile* είναι το όνομα του αρχείου εκ του οποίου θα " +"ληφθούν αποθηκευμένα αποτελέσματα ιχνηλατήσεων. Η *outfile* είναι το όνομα " +"του αρχείου εις το οποίο θα εγγραφούν τα νεώτερα αποτελέσματα ιχνηλάτησης. Η " +"*timing* ενεργοποιεί μία χρονοσφραγίδα σχετική με την έναρξη της εμφάνισης " +"ιχνηλάτησης." #: library/trace.rst:158 msgid "" @@ -195,6 +260,9 @@ msgid "" "current tracing parameters. *cmd* must be a string or code object, suitable " "for passing into :func:`exec`." msgstr "" +"Εκτελεί την εντολή και συλλέγει στατιστικά από την εκτέλεση με τις τρέχουσες " +"επιλογές ιχνηλάτησης. Η *cmd* πρέπει να είναι μία συμβολοσειρά ή αντικείμενο " +"κώδικα, κατάλληλο για διαβίβαση στην συνάρτηση :func:`exec`." #: library/trace.rst:164 msgid "" @@ -202,12 +270,17 @@ msgid "" "current tracing parameters, in the defined global and local environments. " "If not defined, *globals* and *locals* default to empty dictionaries." msgstr "" +"Εκτελεί την εντολή και συλλέγει στατιστικά από την εκτέλεση με τις τρέχουσες " +"επιλογές ιχνηλάτησης, στο ορισμένο καθολικό και τοπικό περιβάλλον. Εάν δεν " +"ορισθούν, οι *globals* και *locals* λαμβάνουν την τιμή κενού dictionary." #: library/trace.rst:171 msgid "" "Call *func* with the given arguments under control of the :class:`Trace` " "object with the current tracing parameters." msgstr "" +"Καλεί την *func* με τα δεδομένα ορίσματα υπό τον έλεγχο του αντικειμένου :" +"class:`Trace` με τις τρέχουσες επιλογές ιχνηλάτησης." #: library/trace.rst:176 msgid "" @@ -215,18 +288,25 @@ msgid "" "results of all previous calls to ``run``, ``runctx`` and ``runfunc`` for the " "given :class:`Trace` instance. Does not reset the accumulated trace results." msgstr "" +"Επιστρέφει ένα αντικείμενο :class:`CoverageResults` που περιέχει τα " +"σωρευτικά αποτελέσματα όλων των προηγούμενων κλήσεων στις ``run``, " +"``runctx`` και ``runfunc`` για το δοθέν :class:`Trace` στιγμιότυπο. Δεν " +"επαναφέρει τα συσσωρευμένα αποτελέσματα ιχνηλατήσεων." #: library/trace.rst:183 msgid "" "A container for coverage results, created by :meth:`Trace.results`. Should " "not be created directly by the user." msgstr "" +"Ένας περιέκτης για αποτελέσματα κάλυψης (coverage results), που " +"δημιουργείται από τη :meth:`Trace.results`. Δεν πρέπει να δημιουργείται " +"απευθείας από τον χρήστη." #: library/trace.rst:188 msgid "Merge in data from another :class:`CoverageResults` object." -msgstr "" +msgstr "Συγχωνεύει δεδομένα από ένα άλλο αντικείμενο :class:`CoverageResults`." -#: library/trace.rst:192 +#: library/trace.rst:193 msgid "" "Write coverage results. Set *show_missing* to show lines that had no hits. " "Set *summary* to include in the output the coverage summary per module. " @@ -234,7 +314,64 @@ msgid "" "be output. If ``None``, the results for each source file are placed in its " "directory." msgstr "" +"Γράφει τα αποτελέσματα κάλυψης. Ορίστε την *show_missing* για να " +"εμφανίζονται οι γραμμές που δεν εκτελέσθηκαν. Ορίστε την *summary* ώστε να " +"συμπεριληφθεί στο αποτέλεσμα η περίληψη κάλυψης ανά module. Η *coverdir* " +"προσδιορίζει τον φάκελο εις τον οποίο θα εγγραφούν τα αρχεία με τα " +"αποτελέσματα. Εάν είναι ``None`` τα αποτελέσματα για κάθε αρχείο εγγράφονται " +"στον φάκελο του αρχείου αυτού." -#: library/trace.rst:198 +#: library/trace.rst:199 +msgid "" +"If *ignore_missing_files* is ``True``, coverage counts for files that no " +"longer exist are silently ignored. Otherwise, a missing file will raise a :" +"exc:`FileNotFoundError`." +msgstr "" +"Εάν η *ignore_missing_files* είναι ``True``, η κάλυψη για μη υπάρχοντα " +"αρχεία αγνοείται σιωπηρά. Ειδαλλιώς, ένα μη υπάρχον αρχείο θα εγείρει :exc:" +"`FileNotFoundError`." + +#: library/trace.rst:203 +msgid "Added *ignore_missing_files* parameter." +msgstr "Προστέθηκε η παράμετρος *ignore_missing_files*." + +#: library/trace.rst:206 msgid "A simple example demonstrating the use of the programmatic interface::" msgstr "" +"Ένα απλό παράδειγμα που υποδεικνύει τη χρήση της προγραμματιστικής διεπαφής::" + +#: library/trace.rst:208 +msgid "" +"import sys\n" +"import trace\n" +"\n" +"# create a Trace object, telling it what to ignore, and whether to\n" +"# do tracing or line-counting or both.\n" +"tracer = trace.Trace(\n" +" ignoredirs=[sys.prefix, sys.exec_prefix],\n" +" trace=0,\n" +" count=1)\n" +"\n" +"# run the new command using the given tracer\n" +"tracer.run('main()')\n" +"\n" +"# make a report, placing output in the current directory\n" +"r = tracer.results()\n" +"r.write_results(show_missing=True, coverdir=\".\")" +msgstr "" +"import sys\n" +"import trace\n" +"\n" +"# δημιούργησε ένα αντικείμενο Trace λέγοντάς του τι να αγνοήσει και\n" +"# εάν θα κάνει ιχνηλάτηση, αρίθμηση γραμμών ή και τα δύο.\n" +"tracer = trace.Trace(\n" +" ignoredirs=[sys.prefix, sys.exec_prefix],\n" +" trace=0,\n" +" count=1)\n" +"\n" +"# τρέξε τη νέα εντολή χρησιμοποιώντας τον δεδομένο ιχνηλάτη\n" +"tracer.run('main()')\n" +"\n" +"# φτιάξε μια αναφορά τοποθετώντας το αποτέλεσμα στον τρέχων φάκελο\n" +"r = tracer.results()\n" +"r.write_results(show_missing=True, coverdir=\".\")" diff --git a/library/traceback.po b/library/traceback.po index ff901bf0..9d88aab8 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/traceback.rst:2 -msgid ":mod:`traceback` --- Print or retrieve a stack traceback" +msgid ":mod:`!traceback` --- Print or retrieve a stack traceback" msgstr "" #: library/traceback.rst:7 @@ -27,13 +28,16 @@ msgstr "" #: library/traceback.rst:11 msgid "" "This module provides a standard interface to extract, format and print stack " -"traces of Python programs. It exactly mimics the behavior of the Python " -"interpreter when it prints a stack trace. This is useful when you want to " -"print stack traces under program control, such as in a \"wrapper\" around " -"the interpreter." +"traces of Python programs. It is more flexible than the interpreter's " +"default traceback display, and therefore makes it possible to configure " +"certain aspects of the output. Finally, it contains a utility for capturing " +"enough information about an exception to print it later, without the need to " +"save a reference to the actual exception. Since exceptions can be the roots " +"of large objects graph, this utility can significantly improve memory " +"management." msgstr "" -#: library/traceback.rst:19 +#: library/traceback.rst:23 msgid "" "The module uses :ref:`traceback objects ` --- these are " "objects of type :class:`types.TracebackType`, which are assigned to the :" @@ -41,29 +45,54 @@ msgid "" "instances." msgstr "" -#: library/traceback.rst:27 +#: library/traceback.rst:30 msgid "Module :mod:`faulthandler`" msgstr "" -#: library/traceback.rst:27 +#: library/traceback.rst:31 msgid "" "Used to dump Python tracebacks explicitly, on a fault, after a timeout, or " "on a user signal." msgstr "" -#: library/traceback.rst:29 +#: library/traceback.rst:33 msgid "Module :mod:`pdb`" msgstr "" -#: library/traceback.rst:30 +#: library/traceback.rst:34 msgid "Interactive source code debugger for Python programs." msgstr "" -#: library/traceback.rst:32 -msgid "The module defines the following functions:" +#: library/traceback.rst:36 +msgid "The module's API can be divided into two parts:" msgstr "" -#: library/traceback.rst:36 +#: library/traceback.rst:38 +msgid "" +"Module-level functions offering basic functionality, which are useful for " +"interactive inspection of exceptions and tracebacks." +msgstr "" + +#: library/traceback.rst:41 +msgid "" +":class:`TracebackException` class and its helper classes :class:" +"`StackSummary` and :class:`FrameSummary`. These offer both more flexibility " +"in the output generated and the ability to store the information necessary " +"for later formatting without holding references to actual exception and " +"traceback objects." +msgstr "" + +#: library/traceback.rst:47 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." +msgstr "" + +#: library/traceback.rst:53 +msgid "Module-Level Functions" +msgstr "" + +#: library/traceback.rst:57 msgid "" "Print up to *limit* stack trace entries from :ref:`traceback object " "` *tb* (starting from the caller's frame) if *limit* is " @@ -74,42 +103,50 @@ msgid "" "output." msgstr "" -#: library/traceback.rst:110 +#: library/traceback.rst:68 +msgid "" +"The meaning of the *limit* parameter is different than the meaning of :const:" +"`sys.tracebacklimit`. A negative *limit* value corresponds to a positive " +"value of :const:`!sys.tracebacklimit`, whereas the behaviour of a positive " +"*limit* value cannot be achieved with :const:`!sys.tracebacklimit`." +msgstr "" + +#: library/traceback.rst:139 msgid "Added negative *limit* support." msgstr "" -#: library/traceback.rst:52 +#: library/traceback.rst:81 msgid "" "Print exception information and stack trace entries from :ref:`traceback " "object ` *tb* to *file*. This differs from :func:" "`print_tb` in the following ways:" msgstr "" -#: library/traceback.rst:57 +#: library/traceback.rst:86 msgid "" "if *tb* is not ``None``, it prints a header ``Traceback (most recent call " "last):``" msgstr "" -#: library/traceback.rst:60 +#: library/traceback.rst:89 msgid "it prints the exception type and *value* after the stack trace" msgstr "" -#: library/traceback.rst:64 +#: library/traceback.rst:93 msgid "" "if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate " "format, it prints the line where the syntax error occurred with a caret " "indicating the approximate position of the error." msgstr "" -#: library/traceback.rst:68 +#: library/traceback.rst:97 msgid "" "Since Python 3.10, instead of passing *value* and *tb*, an exception object " "can be passed as the first argument. If *value* and *tb* are provided, the " "first argument is ignored in order to provide backwards compatibility." msgstr "" -#: library/traceback.rst:72 +#: library/traceback.rst:101 msgid "" "The optional *limit* argument has the same meaning as for :func:`print_tb`. " "If *chain* is true (the default), then chained exceptions (the :attr:" @@ -118,29 +155,29 @@ msgid "" "when printing an unhandled exception." msgstr "" -#: library/traceback.rst:176 +#: library/traceback.rst:219 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "" -#: library/traceback.rst:159 +#: library/traceback.rst:199 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." msgstr "" -#: library/traceback.rst:89 +#: library/traceback.rst:118 msgid "" -"This is a shorthand for ``print_exception(sys.exception(), limit, file, " -"chain)``." +"This is a shorthand for ``print_exception(sys.exception(), limit=limit, " +"file=file, chain=chain)``." msgstr "" -#: library/traceback.rst:95 +#: library/traceback.rst:124 msgid "" -"This is a shorthand for ``print_exception(sys.last_exc, limit, file, " -"chain)``. In general it will work only after an exception has reached an " -"interactive prompt (see :data:`sys.last_exc`)." +"This is a shorthand for ``print_exception(sys.last_exc, limit=limit, " +"file=file, chain=chain)``. In general it will work only after an exception " +"has reached an interactive prompt (see :data:`sys.last_exc`)." msgstr "" -#: library/traceback.rst:102 +#: library/traceback.rst:131 msgid "" "Print up to *limit* stack trace entries (starting from the invocation point) " "if *limit* is positive. Otherwise, print the last ``abs(limit)`` entries. " @@ -150,7 +187,7 @@ msgid "" "for :func:`print_tb`." msgstr "" -#: library/traceback.rst:116 +#: library/traceback.rst:145 msgid "" "Return a :class:`StackSummary` object representing a list of \"pre-" "processed\" stack trace entries extracted from the :ref:`traceback object " @@ -163,7 +200,7 @@ msgid "" "for a stack trace." msgstr "" -#: library/traceback.rst:129 +#: library/traceback.rst:158 msgid "" "Extract the raw traceback from the current :ref:`stack frame `. The return value has the same format as for :func:`extract_tb`. " @@ -171,7 +208,14 @@ msgid "" "`print_stack`." msgstr "" -#: library/traceback.rst:137 +#: library/traceback.rst:166 +msgid "" +"Print the list of tuples as returned by :func:`extract_tb` or :func:" +"`extract_stack` as a formatted stack trace to the given file. If *file* is " +"``None``, the output is written to :data:`sys.stderr`." +msgstr "" + +#: library/traceback.rst:173 msgid "" "Given a list of tuples or :class:`FrameSummary` objects as returned by :func:" "`extract_tb` or :func:`extract_stack`, return a list of strings ready for " @@ -181,7 +225,7 @@ msgid "" "text line is not ``None``." msgstr "" -#: library/traceback.rst:147 +#: library/traceback.rst:183 msgid "" "Format the exception part of a traceback using an exception value such as " "given by :data:`sys.last_value`. The return value is a list of strings, " @@ -192,20 +236,31 @@ msgid "" "contains the exception's :attr:`notes `." msgstr "" -#: library/traceback.rst:155 +#: library/traceback.rst:191 msgid "" "Since Python 3.10, instead of passing *value*, an exception object can be " "passed as the first argument. If *value* is provided, the first argument is " "ignored in order to provide backwards compatibility." msgstr "" -#: library/traceback.rst:163 +#: library/traceback.rst:431 +msgid "" +"When *show_group* is ``True``, and the exception is an instance of :exc:" +"`BaseExceptionGroup`, the nested exceptions are included as well, " +"recursively, with indentation relative to their nesting depth." +msgstr "" + +#: library/traceback.rst:203 msgid "" "The returned list now includes any :attr:`notes ` " "attached to the exception." msgstr "" -#: library/traceback.rst:170 +#: library/traceback.rst:207 +msgid "*show_group* parameter was added." +msgstr "" + +#: library/traceback.rst:213 msgid "" "Format a stack trace and the exception information. The arguments have the " "same meaning as the corresponding arguments to :func:`print_exception`. The " @@ -214,68 +269,76 @@ msgid "" "printed, exactly the same text is printed as does :func:`print_exception`." msgstr "" -#: library/traceback.rst:179 +#: library/traceback.rst:222 msgid "" "This function's behavior and signature were modified to match :func:" "`print_exception`." msgstr "" -#: library/traceback.rst:186 +#: library/traceback.rst:229 msgid "" "This is like ``print_exc(limit)`` but returns a string instead of printing " "to a file." msgstr "" -#: library/traceback.rst:192 +#: library/traceback.rst:235 msgid "A shorthand for ``format_list(extract_tb(tb, limit))``." msgstr "" -#: library/traceback.rst:197 +#: library/traceback.rst:240 msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "" -#: library/traceback.rst:201 +#: library/traceback.rst:244 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object `." msgstr "" -#: library/traceback.rst:210 +#: library/traceback.rst:253 msgid "" "Walk a stack following :attr:`f.f_back ` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" -#: library/traceback.rst:219 +#: library/traceback.rst:260 +msgid "" +"This function previously returned a generator that would walk the stack when " +"first iterated over. The generator returned now is the state of the stack " +"when ``walk_stack`` is called." +msgstr "" + +#: library/traceback.rst:267 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " "line number for each frame. This helper is used with :meth:`StackSummary." "extract`." msgstr "" -#: library/traceback.rst:225 -msgid "The module also defines the following classes:" -msgstr "" - -#: library/traceback.rst:228 +#: library/traceback.rst:275 msgid ":class:`!TracebackException` Objects" msgstr "" -#: library/traceback.rst:232 +#: library/traceback.rst:279 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " -"capture data for later printing in a lightweight fashion." +"capture data for later printing. They offer a more lightweight method of " +"storing this information by avoiding holding references to :ref:" +"`traceback` and :ref:`frame` objects. In " +"addition, they expose more options to configure the output compared to the " +"module-level functions described above." msgstr "" -#: library/traceback.rst:336 +#: library/traceback.rst:288 msgid "" -"Capture an exception for later rendering. *limit*, *lookup_lines* and " -"*capture_locals* are as for the :class:`StackSummary` class." +"Capture an exception for later rendering. The meaning of *limit*, " +"*lookup_lines* and *capture_locals* are as for the :class:`StackSummary` " +"class." msgstr "" -#: library/traceback.rst:240 +#: library/traceback.rst:292 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " @@ -283,12 +346,12 @@ msgid "" "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" -#: library/traceback.rst:339 +#: library/traceback.rst:399 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" -#: library/traceback.rst:248 +#: library/traceback.rst:300 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -297,147 +360,162 @@ msgid "" "limit is exceeded." msgstr "" -#: library/traceback.rst:254 +#: library/traceback.rst:306 msgid "Added the *compact* parameter." msgstr "" -#: library/traceback.rst:257 +#: library/traceback.rst:309 msgid "Added the *max_group_width* and *max_group_depth* parameters." msgstr "" -#: library/traceback.rst:262 +#: library/traceback.rst:314 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__cause__`." msgstr "" -#: library/traceback.rst:267 +#: library/traceback.rst:319 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__context__`." msgstr "" -#: library/traceback.rst:272 +#: library/traceback.rst:324 msgid "" "If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" "class:`!TracebackException` instances representing the nested exceptions. " "Otherwise it is ``None``." msgstr "" -#: library/traceback.rst:280 +#: library/traceback.rst:332 msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." msgstr "" -#: library/traceback.rst:285 +#: library/traceback.rst:337 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" -#: library/traceback.rst:294 +#: library/traceback.rst:346 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: library/traceback.rst:298 +#: library/traceback.rst:350 msgid "The class of the original traceback." msgstr "" -#: library/traceback.rst:302 +#: library/traceback.rst:356 +msgid "String display of the class of the original exception." +msgstr "" + +#: library/traceback.rst:362 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: library/traceback.rst:306 +#: library/traceback.rst:366 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: library/traceback.rst:310 +#: library/traceback.rst:370 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" -#: library/traceback.rst:317 +#: library/traceback.rst:377 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: library/traceback.rst:321 +#: library/traceback.rst:381 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: library/traceback.rst:325 +#: library/traceback.rst:385 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" -#: library/traceback.rst:332 +#: library/traceback.rst:392 msgid "For syntax errors - the compiler error message." msgstr "" -#: library/traceback.rst:343 +#: library/traceback.rst:396 +msgid "" +"Capture an exception for later rendering. *limit*, *lookup_lines* and " +"*capture_locals* are as for the :class:`StackSummary` class." +msgstr "" + +#: library/traceback.rst:403 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" -#: library/traceback.rst:350 +#: library/traceback.rst:410 msgid "Format the exception." msgstr "" -#: library/traceback.rst:352 +#: library/traceback.rst:412 msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" -#: library/traceback.rst:355 +#: library/traceback.rst:415 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: library/traceback.rst:361 +#: library/traceback.rst:421 msgid "Format the exception part of the traceback." msgstr "" -#: library/traceback.rst:363 +#: library/traceback.rst:423 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: library/traceback.rst:365 +#: library/traceback.rst:425 msgid "" -"The generator emits the exception's message followed by its notes (if it has " -"any). The exception message is normally a single string; however, for :exc:" -"`SyntaxError` exceptions, it consists of several lines that (when printed) " -"display detailed information about where the syntax error occurred." +"When *show_group* is ``False``, the generator emits the exception's message " +"followed by its notes (if it has any). The exception message is normally a " +"single string; however, for :exc:`SyntaxError` exceptions, it consists of " +"several lines that (when printed) display detailed information about where " +"the syntax error occurred." msgstr "" -#: library/traceback.rst:371 +#: library/traceback.rst:435 msgid "" "The exception's :attr:`notes ` are now included in " "the output." msgstr "" -#: library/traceback.rst:378 +#: library/traceback.rst:439 +msgid "Added the *show_group* parameter." +msgstr "" + +#: library/traceback.rst:444 msgid ":class:`!StackSummary` Objects" msgstr "" -#: library/traceback.rst:382 +#: library/traceback.rst:448 msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: library/traceback.rst:388 +#: library/traceback.rst:454 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: library/traceback.rst:392 +#: library/traceback.rst:458 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -447,20 +525,20 @@ msgid "" "class:`!FrameSummary` are captured as object representations." msgstr "" -#: library/traceback.rst:400 +#: library/traceback.rst:466 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" -#: library/traceback.rst:406 +#: library/traceback.rst:472 msgid "" "Construct a :class:`!StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with *filename*, *lineno*, *name*, *line* as the elements." msgstr "" -#: library/traceback.rst:413 +#: library/traceback.rst:479 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame ` from the stack. " @@ -468,18 +546,18 @@ msgid "" "well, for those items with source text lines." msgstr "" -#: library/traceback.rst:419 +#: library/traceback.rst:485 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: library/traceback.rst:423 +#: library/traceback.rst:489 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: library/traceback.rst:428 +#: library/traceback.rst:494 msgid "" "Returns a string for printing one of the :ref:`frames ` " "involved in the stack. This method is called for each :class:`FrameSummary` " @@ -487,17 +565,17 @@ msgid "" "the frame is omitted from the output." msgstr "" -#: library/traceback.rst:438 +#: library/traceback.rst:504 msgid ":class:`!FrameSummary` Objects" msgstr "" -#: library/traceback.rst:442 +#: library/traceback.rst:508 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `." msgstr "" -#: library/traceback.rst:447 +#: library/traceback.rst:515 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -506,43 +584,65 @@ msgid "" "class:`!FrameSummary` has the :attr:`~FrameSummary.line` attribute accessed " "(which also happens when casting it to a :class:`tuple`). :attr:" "`~FrameSummary.line` may be directly provided, and will prevent line lookups " -"happening at all. *locals* is an optional local variable dictionary, and if " +"happening at all. *locals* is an optional local variable mapping, and if " "supplied the variable representations are stored in the summary for later " "display." msgstr "" -#: library/traceback.rst:458 +#: library/traceback.rst:526 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: library/traceback.rst:462 +#: library/traceback.rst:530 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" -#: library/traceback.rst:468 +#: library/traceback.rst:536 msgid "The line number of the source code for this frame." msgstr "" -#: library/traceback.rst:472 +#: library/traceback.rst:540 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" -#: library/traceback.rst:477 +#: library/traceback.rst:545 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: library/traceback.rst:484 -msgid "Traceback Examples" +#: library/traceback.rst:551 +msgid "" +"The last line number of the source code for this frame. By default, it is " +"set to ``lineno`` and indexation starts from 1." +msgstr "" + +#: library/traceback.rst:554 +msgid "The default value changed from ``None`` to ``lineno``." msgstr "" -#: library/traceback.rst:486 +#: library/traceback.rst:559 +msgid "" +"The column number of the source code for this frame. By default, it is " +"``None`` and indexation starts from 0." +msgstr "" + +#: library/traceback.rst:564 +msgid "" +"The last column number of the source code for this frame. By default, it is " +"``None`` and indexation starts from 0." +msgstr "" + +#: library/traceback.rst:571 +msgid "Examples of Using the Module-Level Functions" +msgstr "" + +#: library/traceback.rst:573 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -550,38 +650,267 @@ msgid "" "`code` module. ::" msgstr "" -#: library/traceback.rst:508 +#: library/traceback.rst:578 +msgid "" +"import sys, traceback\n" +"\n" +"def run_user_code(envdir):\n" +" source = input(\">>> \")\n" +" try:\n" +" exec(source, envdir)\n" +" except Exception:\n" +" print(\"Exception in user code:\")\n" +" print(\"-\"*60)\n" +" traceback.print_exc(file=sys.stdout)\n" +" print(\"-\"*60)\n" +"\n" +"envdir = {}\n" +"while True:\n" +" run_user_code(envdir)" +msgstr "" + +#: library/traceback.rst:595 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: library/traceback.rst:543 +#: library/traceback.rst:598 +msgid "" +"import sys, traceback\n" +"\n" +"def lumberjack():\n" +" bright_side_of_life()\n" +"\n" +"def bright_side_of_life():\n" +" return tuple()[0]\n" +"\n" +"try:\n" +" lumberjack()\n" +"except IndexError as exc:\n" +" print(\"*** print_tb:\")\n" +" traceback.print_tb(exc.__traceback__, limit=1, file=sys.stdout)\n" +" print(\"*** print_exception:\")\n" +" traceback.print_exception(exc, limit=2, file=sys.stdout)\n" +" print(\"*** print_exc:\")\n" +" traceback.print_exc(limit=2, file=sys.stdout)\n" +" print(\"*** format_exc, first and last line:\")\n" +" formatted_lines = traceback.format_exc().splitlines()\n" +" print(formatted_lines[0])\n" +" print(formatted_lines[-1])\n" +" print(\"*** format_exception:\")\n" +" print(repr(traceback.format_exception(exc)))\n" +" print(\"*** extract_tb:\")\n" +" print(repr(traceback.extract_tb(exc.__traceback__)))\n" +" print(\"*** format_tb:\")\n" +" print(repr(traceback.format_tb(exc.__traceback__)))\n" +" print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" +msgstr "" + +#: library/traceback.rst:629 msgid "The output for the example would look similar to this:" msgstr "" -#: library/traceback.rst:585 +#: library/traceback.rst:631 +msgid "" +"*** print_tb:\n" +" File \"\", line 10, in \n" +" lumberjack()\n" +" ~~~~~~~~~~^^\n" +"*** print_exception:\n" +"Traceback (most recent call last):\n" +" File \"\", line 10, in \n" +" lumberjack()\n" +" ~~~~~~~~~~^^\n" +" File \"\", line 4, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +"IndexError: tuple index out of range\n" +"*** print_exc:\n" +"Traceback (most recent call last):\n" +" File \"\", line 10, in \n" +" lumberjack()\n" +" ~~~~~~~~~~^^\n" +" File \"\", line 4, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +"IndexError: tuple index out of range\n" +"*** format_exc, first and last line:\n" +"Traceback (most recent call last):\n" +"IndexError: tuple index out of range\n" +"*** format_exception:\n" +"['Traceback (most recent call last):\\n',\n" +" ' File \"\", line 10, in \\n " +"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 4, in lumberjack\\n " +"bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 7, in bright_side_of_life\\n " +"return tuple()[0]\\n ~~~~~~~^^^\\n',\n" +" 'IndexError: tuple index out of range\\n']\n" +"*** extract_tb:\n" +"[, line 10 in >,\n" +" , line 4 in lumberjack>,\n" +" , line 7 in bright_side_of_life>]\n" +"*** format_tb:\n" +"[' File \"\", line 10, in \\n " +"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 4, in lumberjack\\n " +"bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 7, in bright_side_of_life\\n " +"return tuple()[0]\\n ~~~~~~~^^^\\n']\n" +"*** tb_lineno: 10" +msgstr "" + +#: library/traceback.rst:676 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: library/traceback.rst:611 +#: library/traceback.rst:678 +msgid "" +">>> import traceback\n" +">>> def another_function():\n" +"... lumberstack()\n" +"...\n" +">>> def lumberstack():\n" +"... traceback.print_stack()\n" +"... print(repr(traceback.extract_stack()))\n" +"... print(repr(traceback.format_stack()))\n" +"...\n" +">>> another_function()\n" +" File \"\", line 10, in \n" +" another_function()\n" +" File \"\", line 3, in another_function\n" +" lumberstack()\n" +" File \"\", line 6, in lumberstack\n" +" traceback.print_stack()\n" +"[('', 10, '', 'another_function()'),\n" +" ('', 3, 'another_function', 'lumberstack()'),\n" +" ('', 7, 'lumberstack', 'print(repr(traceback.extract_stack()))')]\n" +"[' File \"\", line 10, in \\n another_function()\\n',\n" +" ' File \"\", line 3, in another_function\\n " +"lumberstack()\\n',\n" +" ' File \"\", line 8, in lumberstack\\n print(repr(traceback." +"format_stack()))\\n']" +msgstr "" + +#: library/traceback.rst:702 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: library/traceback.rst:17 +#: library/traceback.rst:704 +msgid "" +">>> import traceback\n" +">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" +"... ('eggs.py', 42, 'eggs', 'return \"bacon\"')])\n" +"[' File \"spam.py\", line 3, in \\n spam.eggs()\\n',\n" +" ' File \"eggs.py\", line 42, in eggs\\n return \"bacon\"\\n']\n" +">>> an_error = IndexError('tuple index out of range')\n" +">>> traceback.format_exception_only(an_error)\n" +"['IndexError: tuple index out of range\\n']" +msgstr "" + +#: library/traceback.rst:718 +msgid "Examples of Using :class:`TracebackException`" +msgstr "" + +#: library/traceback.rst:720 +msgid "With the helper class, we have more options::" +msgstr "" + +#: library/traceback.rst:722 +msgid "" +">>> import sys\n" +">>> from traceback import TracebackException\n" +">>>\n" +">>> def lumberjack():\n" +"... bright_side_of_life()\n" +"...\n" +">>> def bright_side_of_life():\n" +"... t = \"bright\", \"side\", \"of\", \"life\"\n" +"... return t[5]\n" +"...\n" +">>> try:\n" +"... lumberjack()\n" +"... except IndexError as e:\n" +"... exc = e\n" +"...\n" +">>> try:\n" +"... try:\n" +"... lumberjack()\n" +"... except:\n" +"... 1/0\n" +"... except Exception as e:\n" +"... chained_exc = e\n" +"...\n" +">>> # limit works as with the module-level functions\n" +">>> TracebackException.from_exception(exc, limit=-2).print()\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +" File \"\", line 10, in bright_side_of_life\n" +" return t[5]\n" +" ~^^^\n" +"IndexError: tuple index out of range\n" +"\n" +">>> # capture_locals adds local variables in frames\n" +">>> TracebackException.from_exception(exc, limit=-2, capture_locals=True)." +"print()\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +" File \"\", line 10, in bright_side_of_life\n" +" return t[5]\n" +" ~^^^\n" +" t = (\"bright\", \"side\", \"of\", \"life\")\n" +"IndexError: tuple index out of range\n" +"\n" +">>> # The *chain* kwarg to print() controls whether chained\n" +">>> # exceptions are displayed\n" +">>> TracebackException.from_exception(chained_exc).print()\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" lumberjack()\n" +" ~~~~~~~~~~^^\n" +" File \"\", line 7, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +" File \"\", line 11, in bright_side_of_life\n" +" return t[5]\n" +" ~^^^\n" +"IndexError: tuple index out of range\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in \n" +" 1/0\n" +" ~^~\n" +"ZeroDivisionError: division by zero\n" +"\n" +">>> TracebackException.from_exception(chained_exc).print(chain=False)\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in \n" +" 1/0\n" +" ~^~\n" +"ZeroDivisionError: division by zero" +msgstr "" + +#: library/traceback.rst:21 msgid "object" msgstr "" -#: library/traceback.rst:17 +#: library/traceback.rst:21 msgid "traceback" msgstr "" -#: library/traceback.rst:62 +#: library/traceback.rst:91 msgid "^ (caret)" msgstr "" -#: library/traceback.rst:62 +#: library/traceback.rst:91 msgid "marker" msgstr "" diff --git a/library/tracemalloc.po b/library/tracemalloc.po index 9b7bf4a5..d9fcbd92 100644 --- a/library/tracemalloc.po +++ b/library/tracemalloc.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tracemalloc.rst:2 -msgid ":mod:`tracemalloc` --- Trace memory allocations" +msgid ":mod:`!tracemalloc` --- Trace memory allocations" msgstr "" #: library/tracemalloc.rst:9 @@ -73,10 +74,45 @@ msgstr "" msgid "Display the 10 files allocating the most memory::" msgstr "" +#: library/tracemalloc.rst:41 +msgid "" +"import tracemalloc\n" +"\n" +"tracemalloc.start()\n" +"\n" +"# ... run your application ...\n" +"\n" +"snapshot = tracemalloc.take_snapshot()\n" +"top_stats = snapshot.statistics('lineno')\n" +"\n" +"print(\"[ Top 10 ]\")\n" +"for stat in top_stats[:10]:\n" +" print(stat)" +msgstr "" + #: library/tracemalloc.rst:225 msgid "Example of output of the Python test suite::" msgstr "" +#: library/tracemalloc.rst:57 +msgid "" +"[ Top 10 ]\n" +":716: size=4855 KiB, count=39328, average=126 " +"B\n" +":284: size=521 KiB, count=3199, average=167 B\n" +"/usr/lib/python3.4/collections/__init__.py:368: size=244 KiB, count=2315, " +"average=108 B\n" +"/usr/lib/python3.4/unittest/case.py:381: size=185 KiB, count=779, " +"average=243 B\n" +"/usr/lib/python3.4/unittest/case.py:402: size=154 KiB, count=378, " +"average=416 B\n" +"/usr/lib/python3.4/abc.py:133: size=88.7 KiB, count=347, average=262 B\n" +":1446: size=70.4 KiB, count=911, average=79 B\n" +":1454: size=52.0 KiB, count=25, average=2131 B\n" +":5: size=49.7 KiB, count=148, average=344 B\n" +"/usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB" +msgstr "" + #: library/tracemalloc.rst:69 msgid "" "We can see that Python loaded ``4855 KiB`` data (bytecode and constants) " @@ -96,11 +132,53 @@ msgstr "" msgid "Take two snapshots and display the differences::" msgstr "" +#: library/tracemalloc.rst:81 +msgid "" +"import tracemalloc\n" +"tracemalloc.start()\n" +"# ... start your application ...\n" +"\n" +"snapshot1 = tracemalloc.take_snapshot()\n" +"# ... call the function leaking memory ...\n" +"snapshot2 = tracemalloc.take_snapshot()\n" +"\n" +"top_stats = snapshot2.compare_to(snapshot1, 'lineno')\n" +"\n" +"print(\"[ Top 10 differences ]\")\n" +"for stat in top_stats[:10]:\n" +" print(stat)" +msgstr "" + #: library/tracemalloc.rst:95 msgid "" "Example of output before/after running some tests of the Python test suite::" msgstr "" +#: library/tracemalloc.rst:97 +msgid "" +"[ Top 10 differences ]\n" +":716: size=8173 KiB (+4428 KiB), count=71332 " +"(+39369), average=117 B\n" +"/usr/lib/python3.4/linecache.py:127: size=940 KiB (+940 KiB), count=8106 " +"(+8106), average=119 B\n" +"/usr/lib/python3.4/unittest/case.py:571: size=298 KiB (+298 KiB), count=589 " +"(+589), average=519 B\n" +":284: size=1005 KiB (+166 KiB), count=7423 " +"(+1526), average=139 B\n" +"/usr/lib/python3.4/mimetypes.py:217: size=112 KiB (+112 KiB), count=1334 " +"(+1334), average=86 B\n" +"/usr/lib/python3.4/http/server.py:848: size=96.0 KiB (+96.0 KiB), count=1 " +"(+1), average=96.0 KiB\n" +"/usr/lib/python3.4/inspect.py:1465: size=83.5 KiB (+83.5 KiB), count=109 " +"(+109), average=784 B\n" +"/usr/lib/python3.4/unittest/mock.py:491: size=77.7 KiB (+77.7 KiB), " +"count=143 (+143), average=557 B\n" +"/usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 " +"(+969), average=76 B\n" +"/usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 " +"(+126), average=546 B" +msgstr "" + #: library/tracemalloc.rst:109 msgid "" "We can see that Python has loaded ``8173 KiB`` of module data (bytecode and " @@ -125,11 +203,68 @@ msgstr "" msgid "Code to display the traceback of the biggest memory block::" msgstr "" +#: library/tracemalloc.rst:125 +msgid "" +"import tracemalloc\n" +"\n" +"# Store 25 frames\n" +"tracemalloc.start(25)\n" +"\n" +"# ... run your application ...\n" +"\n" +"snapshot = tracemalloc.take_snapshot()\n" +"top_stats = snapshot.statistics('traceback')\n" +"\n" +"# pick the biggest memory block\n" +"stat = top_stats[0]\n" +"print(\"%s memory blocks: %.1f KiB\" % (stat.count, stat.size / 1024))\n" +"for line in stat.traceback.format():\n" +" print(line)" +msgstr "" + #: library/tracemalloc.rst:141 msgid "" "Example of output of the Python test suite (traceback limited to 25 frames)::" msgstr "" +#: library/tracemalloc.rst:143 +msgid "" +"903 memory blocks: 870.1 KiB\n" +" File \"\", line 716\n" +" File \"\", line 1036\n" +" File \"\", line 934\n" +" File \"\", line 1068\n" +" File \"\", line 619\n" +" File \"\", line 1581\n" +" File \"\", line 1614\n" +" File \"/usr/lib/python3.4/doctest.py\", line 101\n" +" import pdb\n" +" File \"\", line 284\n" +" File \"\", line 938\n" +" File \"\", line 1068\n" +" File \"\", line 619\n" +" File \"\", line 1581\n" +" File \"\", line 1614\n" +" File \"/usr/lib/python3.4/test/support/__init__.py\", line 1728\n" +" import doctest\n" +" File \"/usr/lib/python3.4/test/test_pickletools.py\", line 21\n" +" support.run_doctest(pickletools)\n" +" File \"/usr/lib/python3.4/test/regrtest.py\", line 1276\n" +" test_runner()\n" +" File \"/usr/lib/python3.4/test/regrtest.py\", line 976\n" +" display_failure=not verbose)\n" +" File \"/usr/lib/python3.4/test/regrtest.py\", line 761\n" +" match_tests=ns.match_tests)\n" +" File \"/usr/lib/python3.4/test/regrtest.py\", line 1563\n" +" main()\n" +" File \"/usr/lib/python3.4/test/__main__.py\", line 3\n" +" regrtest.main_in_temp_cwd()\n" +" File \"/usr/lib/python3.4/runpy.py\", line 73\n" +" exec(code, run_globals)\n" +" File \"/usr/lib/python3.4/runpy.py\", line 160\n" +" \"__main__\", fname, loader, pkg_name)" +msgstr "" + #: library/tracemalloc.rst:178 msgid "" "We can see that the most memory was allocated in the :mod:`importlib` module " @@ -149,6 +284,69 @@ msgid "" "output, ignoring ```` and ```` files::" msgstr "" +#: library/tracemalloc.rst:191 +msgid "" +"import linecache\n" +"import os\n" +"import tracemalloc\n" +"\n" +"def display_top(snapshot, key_type='lineno', limit=10):\n" +" snapshot = snapshot.filter_traces((\n" +" tracemalloc.Filter(False, \"\"),\n" +" tracemalloc.Filter(False, \"\"),\n" +" ))\n" +" top_stats = snapshot.statistics(key_type)\n" +"\n" +" print(\"Top %s lines\" % limit)\n" +" for index, stat in enumerate(top_stats[:limit], 1):\n" +" frame = stat.traceback[0]\n" +" print(\"#%s: %s:%s: %.1f KiB\"\n" +" % (index, frame.filename, frame.lineno, stat.size / 1024))\n" +" line = linecache.getline(frame.filename, frame.lineno).strip()\n" +" if line:\n" +" print(' %s' % line)\n" +"\n" +" other = top_stats[limit:]\n" +" if other:\n" +" size = sum(stat.size for stat in other)\n" +" print(\"%s other: %.1f KiB\" % (len(other), size / 1024))\n" +" total = sum(stat.size for stat in top_stats)\n" +" print(\"Total allocated size: %.1f KiB\" % (total / 1024))\n" +"\n" +"tracemalloc.start()\n" +"\n" +"# ... run your application ...\n" +"\n" +"snapshot = tracemalloc.take_snapshot()\n" +"display_top(snapshot)" +msgstr "" + +#: library/tracemalloc.rst:227 +msgid "" +"Top 10 lines\n" +"#1: Lib/base64.py:414: 419.8 KiB\n" +" _b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]\n" +"#2: Lib/base64.py:306: 419.8 KiB\n" +" _a85chars2 = [(a + b) for a in _a85chars for b in _a85chars]\n" +"#3: collections/__init__.py:368: 293.6 KiB\n" +" exec(class_definition, namespace)\n" +"#4: Lib/abc.py:133: 115.2 KiB\n" +" cls = super().__new__(mcls, name, bases, namespace)\n" +"#5: unittest/case.py:574: 103.1 KiB\n" +" testMethod()\n" +"#6: Lib/linecache.py:127: 95.4 KiB\n" +" lines = fp.readlines()\n" +"#7: urllib/parse.py:476: 71.8 KiB\n" +" for a in _hexdig for b in _hexdig}\n" +"#8: :5: 62.0 KiB\n" +"#9: Lib/_weakrefset.py:37: 60.0 KiB\n" +" self.data = set()\n" +"#10: Lib/base64.py:142: 59.8 KiB\n" +" _b32tab2 = [a + b for a in _b32tab for b in _b32tab]\n" +"6220 other: 3602.8 KiB\n" +"Total allocated size: 5303.1 KiB" +msgstr "" + #: library/tracemalloc.rst:253 msgid "Record the current and peak size of all traced memory blocks" msgstr "" @@ -162,10 +360,38 @@ msgid "" "memory usage during the computations::" msgstr "" +#: library/tracemalloc.rst:261 +msgid "" +"import tracemalloc\n" +"\n" +"tracemalloc.start()\n" +"\n" +"# Example code: compute a sum with a large temporary list\n" +"large_sum = sum(list(range(100000)))\n" +"\n" +"first_size, first_peak = tracemalloc.get_traced_memory()\n" +"\n" +"tracemalloc.reset_peak()\n" +"\n" +"# Example code: compute a sum with a small temporary list\n" +"small_sum = sum(list(range(1000)))\n" +"\n" +"second_size, second_peak = tracemalloc.get_traced_memory()\n" +"\n" +"print(f\"{first_size=}, {first_peak=}\")\n" +"print(f\"{second_size=}, {second_peak=}\")" +msgstr "" + #: library/tracemalloc.rst:759 msgid "Output::" msgstr "" +#: library/tracemalloc.rst:282 +msgid "" +"first_size=664, first_peak=3592984\n" +"second_size=804, second_peak=29704" +msgstr "" + #: library/tracemalloc.rst:285 msgid "" "Using :func:`reset_peak` ensured we could accurately record the peak during " @@ -786,3 +1012,19 @@ msgstr "" #: library/tracemalloc.rst:753 msgid "Example::" msgstr "" + +#: library/tracemalloc.rst:755 +msgid "" +"print(\"Traceback (most recent call first):\")\n" +"for line in traceback:\n" +" print(line)" +msgstr "" + +#: library/tracemalloc.rst:761 +msgid "" +"Traceback (most recent call first):\n" +" File \"test.py\", line 9\n" +" obj = Object()\n" +" File \"test.py\", line 12\n" +" tb = tracemalloc.get_object_traceback(f())" +msgstr "" diff --git a/library/tty.po b/library/tty.po index 09c5e1be..2bbf2940 100644 --- a/library/tty.po +++ b/library/tty.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/tty.rst:2 -msgid ":mod:`tty` --- Terminal control functions" +msgid ":mod:`!tty` --- Terminal control functions" msgstr "" #: library/tty.rst:11 @@ -31,7 +32,7 @@ msgid "" msgstr "" #: library/tty.rst:18 -msgid ":ref:`Availability `: Unix." +msgid "Availability" msgstr "" #: library/tty.rst:20 @@ -76,7 +77,8 @@ msgid "" msgstr "" #: library/tty.rst:69 -msgid "The return value is now the original tty attributes, instead of None." +msgid "" +"The return value is now the original tty attributes, instead of ``None``." msgstr "" #: library/tty.rst:61 diff --git a/library/turtle.po b/library/turtle.po index 441c4f0f..50f6cb98 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -8,53 +8,75 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/turtle.rst:3 -msgid ":mod:`turtle` --- Turtle graphics" +msgid ":mod:`!turtle` --- Turtle graphics" msgstr "" #: library/turtle.rst:10 msgid "**Source code:** :source:`Lib/turtle.py`" msgstr "" -#: library/turtle.rst:20 +#: library/turtle.rst:25 msgid "Introduction" msgstr "" -#: library/turtle.rst:22 +#: library/turtle.rst:27 msgid "" "Turtle graphics is an implementation of `the popular geometric drawing tools " "introduced in Logo `_, " "developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967." msgstr "" -#: library/turtle.rst:29 +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/turtle.rst:36 +msgid "Get started" +msgstr "" + +#: library/turtle.rst:38 +msgid "" +"Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an " +"``import turtle``, give it the command ``turtle.forward(15)``, and it moves " +"(on-screen!) 15 pixels in the direction it is facing, drawing a line as it " +"moves. Give it the command ``turtle.right(25)``, and it rotates in-place 25 " +"degrees clockwise." +msgstr "" + +#: library/turtle.rst:45 msgid "" "Turtle can draw intricate shapes using programs that repeat simple moves." msgstr "" -#: library/turtle.rst:35 +#: library/turtle.rst:51 msgid "" "In Python, turtle graphics provides a representation of a physical " "\"turtle\" (a little robot with a pen) that draws on a sheet of paper on the " "floor." msgstr "" -#: library/turtle.rst:38 +#: library/turtle.rst:54 msgid "" "It's an effective and well-proven way for learners to encounter programming " "concepts and interaction with software, as it provides instant, visible " "feedback. It also provides convenient access to graphical output in general." msgstr "" -#: library/turtle.rst:43 +#: library/turtle.rst:59 msgid "" "Turtle drawing was originally created as an educational tool, to be used by " "teachers in the classroom. For the programmer who needs to produce some " @@ -62,159 +84,222 @@ msgid "" "introducing more complex or external libraries into their work." msgstr "" -#: library/turtle.rst:52 +#: library/turtle.rst:68 msgid "Tutorial" msgstr "" -#: library/turtle.rst:54 +#: library/turtle.rst:70 msgid "" "New users should start here. In this tutorial we'll explore some of the " "basics of turtle drawing." msgstr "" -#: library/turtle.rst:59 +#: library/turtle.rst:75 msgid "Starting a turtle environment" msgstr "" -#: library/turtle.rst:61 +#: library/turtle.rst:77 msgid "In a Python shell, import all the objects of the ``turtle`` module::" msgstr "" -#: library/turtle.rst:65 +#: library/turtle.rst:79 +msgid "from turtle import *" +msgstr "" + +#: library/turtle.rst:81 msgid "" "If you run into a ``No module named '_tkinter'`` error, you'll have to " "install the :mod:`Tk interface package ` on your system." msgstr "" -#: library/turtle.rst:70 +#: library/turtle.rst:86 msgid "Basic drawing" msgstr "" -#: library/turtle.rst:72 +#: library/turtle.rst:88 msgid "Send the turtle forward 100 steps::" msgstr "" -#: library/turtle.rst:76 +#: library/turtle.rst:90 +msgid "forward(100)" +msgstr "" + +#: library/turtle.rst:92 msgid "" "You should see (most likely, in a new window on your display) a line drawn " "by the turtle, heading East. Change the direction of the turtle, so that it " "turns 120 degrees left (anti-clockwise)::" msgstr "" -#: library/turtle.rst:82 +#: library/turtle.rst:96 +msgid "left(120)" +msgstr "" + +#: library/turtle.rst:98 msgid "Let's continue by drawing a triangle::" msgstr "" -#: library/turtle.rst:88 +#: library/turtle.rst:100 +msgid "" +"forward(100)\n" +"left(120)\n" +"forward(100)" +msgstr "" + +#: library/turtle.rst:104 msgid "" "Notice how the turtle, represented by an arrow, points in different " "directions as you steer it." msgstr "" -#: library/turtle.rst:91 +#: library/turtle.rst:107 msgid "" "Experiment with those commands, and also with ``backward()`` and ``right()``." msgstr "" -#: library/turtle.rst:346 library/turtle.rst:1016 +#: library/turtle.rst:366 library/turtle.rst:1064 msgid "Pen control" msgstr "" -#: library/turtle.rst:98 +#: library/turtle.rst:114 msgid "" "Try changing the color - for example, ``color('blue')`` - and width of the " "line - for example, ``width(3)`` - and then drawing again." msgstr "" -#: library/turtle.rst:101 +#: library/turtle.rst:117 msgid "" "You can also move the turtle around without drawing, by lifting up the pen: " "``up()`` before moving. To start drawing again, use ``down()``." msgstr "" -#: library/turtle.rst:106 +#: library/turtle.rst:122 msgid "The turtle's position" msgstr "" -#: library/turtle.rst:108 +#: library/turtle.rst:124 msgid "" "Send your turtle back to its starting-point (useful if it has disappeared " "off-screen)::" msgstr "" -#: library/turtle.rst:113 +#: library/turtle.rst:127 +msgid "home()" +msgstr "" + +#: library/turtle.rst:129 msgid "" "The home position is at the center of the turtle's screen. If you ever need " -"to know them, get the turtle's x-y co-ordinates with::" +"to know them, get the turtle's x-y coordinates with::" +msgstr "" + +#: library/turtle.rst:132 +msgid "pos()" msgstr "" -#: library/turtle.rst:118 +#: library/turtle.rst:134 msgid "Home is at ``(0, 0)``." msgstr "" -#: library/turtle.rst:120 +#: library/turtle.rst:136 msgid "" "And after a while, it will probably help to clear the window so we can start " "anew::" msgstr "" -#: library/turtle.rst:127 +#: library/turtle.rst:139 +msgid "clearscreen()" +msgstr "" + +#: library/turtle.rst:143 msgid "Making algorithmic patterns" msgstr "" -#: library/turtle.rst:129 +#: library/turtle.rst:145 msgid "Using loops, it's possible to build up geometric patterns::" msgstr "" -#: library/turtle.rst:138 +#: library/turtle.rst:147 +msgid "" +"for steps in range(100):\n" +" for c in ('blue', 'red', 'green'):\n" +" color(c)\n" +" forward(steps)\n" +" right(30)" +msgstr "" + +#: library/turtle.rst:154 msgid "\\ - which of course, are limited only by the imagination!" msgstr "" -#: library/turtle.rst:140 +#: library/turtle.rst:156 msgid "" "Let's draw the star shape at the top of this page. We want red lines, filled " "in with yellow::" msgstr "" -#: library/turtle.rst:146 +#: library/turtle.rst:159 +msgid "" +"color('red')\n" +"fillcolor('yellow')" +msgstr "" + +#: library/turtle.rst:162 msgid "" "Just as ``up()`` and ``down()`` determine whether lines will be drawn, " "filling can be turned on and off::" msgstr "" -#: library/turtle.rst:151 +#: library/turtle.rst:165 +msgid "begin_fill()" +msgstr "" + +#: library/turtle.rst:167 msgid "Next we'll create a loop::" msgstr "" -#: library/turtle.rst:159 +#: library/turtle.rst:169 +msgid "" +"while True:\n" +" forward(200)\n" +" left(170)\n" +" if abs(pos()) < 1:\n" +" break" +msgstr "" + +#: library/turtle.rst:175 msgid "" "``abs(pos()) < 1`` is a good way to know when the turtle is back at its home " "position." msgstr "" -#: library/turtle.rst:162 +#: library/turtle.rst:178 msgid "Finally, complete the filling::" msgstr "" -#: library/turtle.rst:166 +#: library/turtle.rst:180 +msgid "end_fill()" +msgstr "" + +#: library/turtle.rst:182 msgid "" "(Note that filling only actually takes place when you give the " "``end_fill()`` command.)" msgstr "" -#: library/turtle.rst:173 +#: library/turtle.rst:189 msgid "How to..." msgstr "" -#: library/turtle.rst:175 +#: library/turtle.rst:191 msgid "This section covers some typical turtle use-cases and approaches." msgstr "" -#: library/turtle.rst:179 +#: library/turtle.rst:195 msgid "Get started as quickly as possible" msgstr "" -#: library/turtle.rst:181 +#: library/turtle.rst:197 msgid "" "One of the joys of turtle graphics is the immediate, visual feedback that's " "available from simple commands - it's an excellent way to introduce children " @@ -222,21 +307,21 @@ msgid "" "course)." msgstr "" -#: library/turtle.rst:186 +#: library/turtle.rst:202 msgid "" "The turtle module makes this possible by exposing all its basic " "functionality as functions, available with ``from turtle import *``. The :" "ref:`turtle graphics tutorial ` covers this approach." msgstr "" -#: library/turtle.rst:190 +#: library/turtle.rst:206 msgid "" "It's worth noting that many of the turtle commands also have even more terse " "equivalents, such as ``fd()`` for :func:`forward`. These are especially " "useful when working with learners for whom typing is not a skill." msgstr "" -#: library/turtle.rst:196 +#: library/turtle.rst:212 msgid "" "You'll need to have the :mod:`Tk interface package ` installed on " "your system for turtle graphics to work. Be warned that this is not always " @@ -244,11 +329,47 @@ msgid "" "graphics with a learner." msgstr "" -#: library/turtle.rst:203 +#: library/turtle.rst:219 +msgid "Automatically begin and end filling" +msgstr "" + +#: library/turtle.rst:221 +msgid "" +"Starting with Python 3.14, you can use the :func:`fill` :term:`context " +"manager` instead of :func:`begin_fill` and :func:`end_fill` to automatically " +"begin and end fill. Here is an example::" +msgstr "" + +#: library/turtle.rst:225 +msgid "" +"with fill():\n" +" for i in range(4):\n" +" forward(100)\n" +" right(90)\n" +"\n" +"forward(200)" +msgstr "" + +#: library/turtle.rst:232 +msgid "The code above is equivalent to::" +msgstr "" + +#: library/turtle.rst:234 +msgid "" +"begin_fill()\n" +"for i in range(4):\n" +" forward(100)\n" +" right(90)\n" +"end_fill()\n" +"\n" +"forward(200)" +msgstr "" + +#: library/turtle.rst:244 msgid "Use the ``turtle`` module namespace" msgstr "" -#: library/turtle.rst:205 +#: library/turtle.rst:246 msgid "" "Using ``from turtle import *`` is convenient - but be warned that it imports " "a rather large collection of objects, and if you're doing anything but " @@ -257,7 +378,7 @@ msgid "" "might be imported)." msgstr "" -#: library/turtle.rst:211 +#: library/turtle.rst:252 msgid "" "The solution is to use ``import turtle`` - ``fd()`` becomes ``turtle.fd()``, " "``width()`` becomes ``turtle.width()`` and so on. (If typing \"turtle\" over " @@ -265,39 +386,55 @@ msgid "" "instead.)" msgstr "" -#: library/turtle.rst:218 +#: library/turtle.rst:259 msgid "Use turtle graphics in a script" msgstr "" -#: library/turtle.rst:220 +#: library/turtle.rst:261 msgid "" "It's recommended to use the ``turtle`` module namespace as described " "immediately above, for example::" msgstr "" -#: library/turtle.rst:232 +#: library/turtle.rst:264 +msgid "" +"import turtle as t\n" +"from random import random\n" +"\n" +"for i in range(100):\n" +" steps = int(random() * 100)\n" +" angle = int(random() * 360)\n" +" t.right(angle)\n" +" t.fd(steps)" +msgstr "" + +#: library/turtle.rst:273 msgid "" "Another step is also required though - as soon as the script ends, Python " "will also close the turtle's window. Add::" msgstr "" -#: library/turtle.rst:237 +#: library/turtle.rst:276 +msgid "t.mainloop()" +msgstr "" + +#: library/turtle.rst:278 msgid "" "to the end of the script. The script will now wait to be dismissed and will " "not exit until it is terminated, for example by closing the turtle graphics " "window." msgstr "" -#: library/turtle.rst:243 +#: library/turtle.rst:284 msgid "Use object-oriented turtle graphics" msgstr "" -#: library/turtle.rst:245 +#: library/turtle.rst:286 msgid "" ":ref:`Explanation of the object-oriented interface `" msgstr "" -#: library/turtle.rst:247 +#: library/turtle.rst:288 msgid "" "Other than for very basic introductory purposes, or for trying things out as " "quickly as possible, it's more usual and much more powerful to use the " @@ -305,48 +442,69 @@ msgid "" "multiple turtles on screen at once." msgstr "" -#: library/turtle.rst:252 +#: library/turtle.rst:293 msgid "" "In this approach, the various turtle commands are methods of objects (mostly " "of ``Turtle`` objects). You *can* use the object-oriented approach in the " "shell, but it would be more typical in a Python script." msgstr "" -#: library/turtle.rst:256 +#: library/turtle.rst:297 msgid "The example above then becomes::" msgstr "" -#: library/turtle.rst:270 +#: library/turtle.rst:299 +msgid "" +"from turtle import Turtle\n" +"from random import random\n" +"\n" +"t = Turtle()\n" +"for i in range(100):\n" +" steps = int(random() * 100)\n" +" angle = int(random() * 360)\n" +" t.right(angle)\n" +" t.fd(steps)\n" +"\n" +"t.screen.mainloop()" +msgstr "" + +#: library/turtle.rst:311 msgid "" "Note the last line. ``t.screen`` is an instance of the :class:`Screen` that " "a Turtle instance exists on; it's created automatically along with the " "turtle." msgstr "" -#: library/turtle.rst:274 +#: library/turtle.rst:315 msgid "The turtle's screen can be customised, for example::" msgstr "" -#: library/turtle.rst:281 +#: library/turtle.rst:317 +msgid "" +"t.screen.title('Object-oriented turtle demo')\n" +"t.screen.bgcolor(\"orange\")" +msgstr "" + +#: library/turtle.rst:322 msgid "Turtle graphics reference" msgstr "" -#: library/turtle.rst:285 +#: library/turtle.rst:326 msgid "" "In the following documentation the argument list for functions is given. " "Methods, of course, have the additional first argument *self* which is " "omitted here." msgstr "" -#: library/turtle.rst:291 +#: library/turtle.rst:332 msgid "Turtle methods" msgstr "" -#: library/turtle.rst:433 +#: library/turtle.rst:477 msgid "Turtle motion" msgstr "" -#: library/turtle.rst:311 +#: library/turtle.rst:335 msgid "Move and draw" msgstr "" @@ -390,7 +548,7 @@ msgstr "" msgid ":func:`home`" msgstr "" -#: library/turtle.rst:2723 +#: library/turtle.rst:2864 msgid ":func:`circle`" msgstr "" @@ -398,7 +556,7 @@ msgstr "" msgid ":func:`dot`" msgstr "" -#: library/turtle.rst:2701 +#: library/turtle.rst:2842 msgid ":func:`stamp`" msgstr "" @@ -418,7 +576,7 @@ msgstr "" msgid ":func:`speed`" msgstr "" -#: library/turtle.rst:865 +#: library/turtle.rst:913 msgid "Tell Turtle's state" msgstr "" @@ -446,7 +604,7 @@ msgstr "" msgid ":func:`distance`" msgstr "" -#: library/turtle.rst:323 +#: library/turtle.rst:362 msgid "Setting and measurement" msgstr "" @@ -458,7 +616,7 @@ msgstr "" msgid ":func:`radians`" msgstr "" -#: library/turtle.rst:1019 +#: library/turtle.rst:1067 msgid "Drawing state" msgstr "" @@ -482,7 +640,7 @@ msgstr "" msgid ":func:`isdown`" msgstr "" -#: library/turtle.rst:1111 +#: library/turtle.rst:1159 msgid "Color control" msgstr "" @@ -498,7 +656,7 @@ msgstr "" msgid ":func:`fillcolor`" msgstr "" -#: library/turtle.rst:1243 +#: library/turtle.rst:1298 msgid "Filling" msgstr "" @@ -506,6 +664,10 @@ msgstr "" msgid ":func:`filling`" msgstr "" +#: library/turtle.rst:0 +msgid ":func:`fill`" +msgstr "" + #: library/turtle.rst:0 msgid ":func:`begin_fill`" msgstr "" @@ -514,7 +676,7 @@ msgstr "" msgid ":func:`end_fill`" msgstr "" -#: library/turtle.rst:1290 +#: library/turtle.rst:1368 msgid "More drawing control" msgstr "" @@ -530,11 +692,11 @@ msgstr "" msgid ":func:`write`" msgstr "" -#: library/turtle.rst:1336 +#: library/turtle.rst:1414 msgid "Turtle state" msgstr "" -#: library/turtle.rst:1339 +#: library/turtle.rst:1417 msgid "Visibility" msgstr "" @@ -550,7 +712,7 @@ msgstr "" msgid ":func:`isvisible`" msgstr "" -#: library/turtle.rst:1378 +#: library/turtle.rst:1456 msgid "Appearance" msgstr "" @@ -570,10 +732,6 @@ msgstr "" msgid ":func:`shearfactor`" msgstr "" -#: library/turtle.rst:0 -msgid ":func:`settiltangle`" -msgstr "" - #: library/turtle.rst:0 msgid ":func:`tiltangle`" msgstr "" @@ -590,11 +748,11 @@ msgstr "" msgid ":func:`get_shapepoly`" msgstr "" -#: library/turtle.rst:1583 +#: library/turtle.rst:1639 msgid "Using events" msgstr "" -#: library/turtle.rst:2695 +#: library/turtle.rst:2836 msgid ":func:`onclick`" msgstr "" @@ -602,14 +760,18 @@ msgstr "" msgid ":func:`onrelease`" msgstr "" -#: library/turtle.rst:2678 +#: library/turtle.rst:2819 msgid ":func:`ondrag`" msgstr "" -#: library/turtle.rst:1657 +#: library/turtle.rst:1713 msgid "Special Turtle methods" msgstr "" +#: library/turtle.rst:0 +msgid ":func:`poly`" +msgstr "" + #: library/turtle.rst:0 msgid ":func:`begin_poly`" msgstr "" @@ -622,7 +784,7 @@ msgstr "" msgid ":func:`get_poly`" msgstr "" -#: library/turtle.rst:2717 +#: library/turtle.rst:2858 msgid ":func:`clone`" msgstr "" @@ -642,11 +804,11 @@ msgstr "" msgid ":func:`undobufferentries`" msgstr "" -#: library/turtle.rst:382 +#: library/turtle.rst:424 msgid "Methods of TurtleScreen/Screen" msgstr "" -#: library/turtle.rst:1811 +#: library/turtle.rst:1884 msgid "Window control" msgstr "" @@ -674,10 +836,14 @@ msgstr "" msgid ":func:`setworldcoordinates`" msgstr "" -#: library/turtle.rst:1934 +#: library/turtle.rst:2027 msgid "Animation control" msgstr "" +#: library/turtle.rst:0 +msgid ":func:`no_animation`" +msgstr "" + #: library/turtle.rst:0 msgid ":func:`delay`" msgstr "" @@ -690,7 +856,7 @@ msgstr "" msgid ":func:`update`" msgstr "" -#: library/turtle.rst:1987 +#: library/turtle.rst:2097 msgid "Using screen events" msgstr "" @@ -718,7 +884,7 @@ msgstr "" msgid ":func:`mainloop` | :func:`done`" msgstr "" -#: library/turtle.rst:2132 +#: library/turtle.rst:2242 msgid "Settings and special methods" msgstr "" @@ -754,7 +920,7 @@ msgstr "" msgid ":func:`window_width`" msgstr "" -#: library/turtle.rst:2096 +#: library/turtle.rst:2206 msgid "Input methods" msgstr "" @@ -766,7 +932,7 @@ msgstr "" msgid ":func:`numinput`" msgstr "" -#: library/turtle.rst:424 +#: library/turtle.rst:462 msgid "Methods specific to Screen" msgstr "" @@ -778,6 +944,10 @@ msgstr "" msgid ":func:`exitonclick`" msgstr "" +#: library/turtle.rst:0 +msgid ":func:`save`" +msgstr "" + #: library/turtle.rst:0 msgid ":func:`setup`" msgstr "" @@ -786,11 +956,11 @@ msgstr "" msgid ":func:`title`" msgstr "" -#: library/turtle.rst:427 +#: library/turtle.rst:471 msgid "Methods of RawTurtle/Turtle and corresponding functions" msgstr "" -#: library/turtle.rst:429 +#: library/turtle.rst:473 msgid "" "Most of the examples in this section refer to a Turtle instance called " "``turtle``." @@ -800,65 +970,120 @@ msgstr "" msgid "Parameters" msgstr "" -#: library/turtle.rst:483 library/turtle.rst:606 library/turtle.rst:652 +#: library/turtle.rst:527 library/turtle.rst:650 library/turtle.rst:696 msgid "a number (integer or float)" msgstr "" -#: library/turtle.rst:440 +#: library/turtle.rst:484 msgid "" "Move the turtle forward by the specified *distance*, in the direction the " "turtle is headed." msgstr "" -#: library/turtle.rst:702 library/turtle.rst:1477 library/turtle.rst:1496 +#: library/turtle.rst:487 +msgid "" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.forward(25)\n" +">>> turtle.position()\n" +"(25.00,0.00)\n" +">>> turtle.forward(-75)\n" +">>> turtle.position()\n" +"(-50.00,0.00)" +msgstr "" + +#: library/turtle.rst:746 library/turtle.rst:1555 msgid "a number" msgstr "" -#: library/turtle.rst:462 +#: library/turtle.rst:506 msgid "" "Move the turtle backward by *distance*, opposite to the direction the turtle " "is headed. Do not change the turtle's heading." msgstr "" -#: library/turtle.rst:485 +#: library/turtle.rst:514 +msgid "" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.backward(30)\n" +">>> turtle.position()\n" +"(-30.00,0.00)" +msgstr "" + +#: library/turtle.rst:529 msgid "" "Turn turtle right by *angle* units. (Units are by default degrees, but can " "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -#: library/turtle.rst:510 +#: library/turtle.rst:539 +msgid "" +">>> turtle.heading()\n" +"22.0\n" +">>> turtle.right(45)\n" +">>> turtle.heading()\n" +"337.0" +msgstr "" + +#: library/turtle.rst:554 msgid "" "Turn turtle left by *angle* units. (Units are by default degrees, but can " "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -#: library/turtle.rst:534 +#: library/turtle.rst:564 +msgid "" +">>> turtle.heading()\n" +"22.0\n" +">>> turtle.left(45)\n" +">>> turtle.heading()\n" +"67.0" +msgstr "" + +#: library/turtle.rst:578 msgid "a number or a pair/vector of numbers" msgstr "" -#: library/turtle.rst:568 library/turtle.rst:569 +#: library/turtle.rst:612 library/turtle.rst:613 msgid "a number or ``None``" msgstr "" -#: library/turtle.rst:537 +#: library/turtle.rst:581 msgid "" "If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` (e." "g. as returned by :func:`pos`)." msgstr "" -#: library/turtle.rst:540 +#: library/turtle.rst:584 msgid "" "Move turtle to an absolute position. If the pen is down, draw line. Do not " "change the turtle's orientation." msgstr "" -#: library/turtle.rst:570 +#: library/turtle.rst:593 +msgid "" +">>> tp = turtle.pos()\n" +">>> tp\n" +"(0.00,0.00)\n" +">>> turtle.setpos(60,30)\n" +">>> turtle.pos()\n" +"(60.00,30.00)\n" +">>> turtle.setpos((20,80))\n" +">>> turtle.pos()\n" +"(20.00,80.00)\n" +">>> turtle.setpos(tp)\n" +">>> turtle.pos()\n" +"(0.00,0.00)" +msgstr "" + +#: library/turtle.rst:614 msgid "a boolean" msgstr "" -#: library/turtle.rst:572 +#: library/turtle.rst:616 msgid "" "Move turtle to an absolute position. Unlike goto(x, y), a line will not be " "drawn. The turtle's orientation does not change. If currently filling, the " @@ -868,77 +1093,131 @@ msgid "" "barrier like in goto(x, y)." msgstr "" -#: library/turtle.rst:608 +#: library/turtle.rst:629 +msgid "" +">>> tp = turtle.pos()\n" +">>> tp\n" +"(0.00,0.00)\n" +">>> turtle.teleport(60)\n" +">>> turtle.pos()\n" +"(60.00,0.00)\n" +">>> turtle.teleport(y=10)\n" +">>> turtle.pos()\n" +"(60.00,10.00)\n" +">>> turtle.teleport(20, 30)\n" +">>> turtle.pos()\n" +"(20.00,30.00)" +msgstr "" + +#: library/turtle.rst:652 msgid "" "Set the turtle's first coordinate to *x*, leave second coordinate unchanged." msgstr "" -#: library/turtle.rst:631 +#: library/turtle.rst:661 +msgid "" +">>> turtle.position()\n" +"(0.00,240.00)\n" +">>> turtle.setx(10)\n" +">>> turtle.position()\n" +"(10.00,240.00)" +msgstr "" + +#: library/turtle.rst:675 msgid "" "Set the turtle's second coordinate to *y*, leave first coordinate unchanged." msgstr "" -#: library/turtle.rst:654 +#: library/turtle.rst:683 +msgid "" +">>> turtle.position()\n" +"(0.00,40.00)\n" +">>> turtle.sety(-10)\n" +">>> turtle.position()\n" +"(0.00,-10.00)" +msgstr "" + +#: library/turtle.rst:698 msgid "" "Set the orientation of the turtle to *to_angle*. Here are some common " "directions in degrees:" msgstr "" -#: library/turtle.rst:658 +#: library/turtle.rst:702 msgid "standard mode" msgstr "" -#: library/turtle.rst:658 +#: library/turtle.rst:702 msgid "logo mode" msgstr "" -#: library/turtle.rst:660 +#: library/turtle.rst:704 msgid "0 - east" msgstr "" -#: library/turtle.rst:660 +#: library/turtle.rst:704 msgid "0 - north" msgstr "" -#: library/turtle.rst:661 +#: library/turtle.rst:705 msgid "90 - north" msgstr "" -#: library/turtle.rst:661 +#: library/turtle.rst:705 msgid "90 - east" msgstr "" -#: library/turtle.rst:662 +#: library/turtle.rst:706 msgid "180 - west" msgstr "" -#: library/turtle.rst:662 +#: library/turtle.rst:706 msgid "180 - south" msgstr "" -#: library/turtle.rst:663 +#: library/turtle.rst:707 msgid "270 - south" msgstr "" -#: library/turtle.rst:663 +#: library/turtle.rst:707 msgid "270 - west" msgstr "" -#: library/turtle.rst:676 +#: library/turtle.rst:710 +msgid "" +">>> turtle.setheading(90)\n" +">>> turtle.heading()\n" +"90.0" +msgstr "" + +#: library/turtle.rst:720 msgid "" "Move turtle to the origin -- coordinates (0,0) -- and set its heading to its " "start-orientation (which depends on the mode, see :func:`mode`)." msgstr "" -#: library/turtle.rst:703 +#: library/turtle.rst:730 +msgid "" +">>> turtle.heading()\n" +"90.0\n" +">>> turtle.position()\n" +"(0.00,-10.00)\n" +">>> turtle.home()\n" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.heading()\n" +"0.0" +msgstr "" + +#: library/turtle.rst:747 msgid "a number (or ``None``)" msgstr "" -#: library/turtle.rst:797 +#: library/turtle.rst:845 msgid "an integer (or ``None``)" msgstr "" -#: library/turtle.rst:706 +#: library/turtle.rst:750 msgid "" "Draw a circle with given *radius*. The center is *radius* units left of the " "turtle; *extent* -- an angle -- determines which part of the circle is " @@ -949,117 +1228,205 @@ msgid "" "changed by the amount of *extent*." msgstr "" -#: library/turtle.rst:714 +#: library/turtle.rst:758 msgid "" "As the circle is approximated by an inscribed regular polygon, *steps* " "determines the number of steps to use. If not given, it will be calculated " "automatically. May be used to draw regular polygons." msgstr "" -#: library/turtle.rst:740 +#: library/turtle.rst:762 +msgid "" +">>> turtle.home()\n" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.heading()\n" +"0.0\n" +">>> turtle.circle(50)\n" +">>> turtle.position()\n" +"(-0.00,0.00)\n" +">>> turtle.heading()\n" +"0.0\n" +">>> turtle.circle(120, 180) # draw a semicircle\n" +">>> turtle.position()\n" +"(0.00,240.00)\n" +">>> turtle.heading()\n" +"180.0" +msgstr "" + +#: library/turtle.rst:788 msgid "an integer >= 1 (if given)" msgstr "" -#: library/turtle.rst:741 +#: library/turtle.rst:789 msgid "a colorstring or a numeric color tuple" msgstr "" -#: library/turtle.rst:743 +#: library/turtle.rst:791 msgid "" "Draw a circular dot with diameter *size*, using *color*. If *size* is not " -"given, the maximum of pensize+4 and 2*pensize is used." +"given, the maximum of ``pensize+4`` and ``2*pensize`` is used." +msgstr "" + +#: library/turtle.rst:795 +msgid "" +">>> turtle.home()\n" +">>> turtle.dot()\n" +">>> turtle.fd(50); turtle.dot(20, \"blue\"); turtle.fd(50)\n" +">>> turtle.position()\n" +"(100.00,-0.00)\n" +">>> turtle.heading()\n" +"0.0" msgstr "" -#: library/turtle.rst:761 +#: library/turtle.rst:809 msgid "" "Stamp a copy of the turtle shape onto the canvas at the current turtle " "position. Return a stamp_id for that stamp, which can be used to delete it " "by calling ``clearstamp(stamp_id)``." msgstr "" -#: library/turtle.rst:775 +#: library/turtle.rst:813 +msgid "" +">>> turtle.color(\"blue\")\n" +">>> stamp_id = turtle.stamp()\n" +">>> turtle.fd(50)" +msgstr "" + +#: library/turtle.rst:823 msgid "an integer, must be return value of previous :func:`stamp` call" msgstr "" -#: library/turtle.rst:778 +#: library/turtle.rst:826 msgid "Delete stamp with given *stampid*." msgstr "" -#: library/turtle.rst:799 +#: library/turtle.rst:828 +msgid "" +">>> turtle.position()\n" +"(150.00,-0.00)\n" +">>> turtle.color(\"blue\")\n" +">>> astamp = turtle.stamp()\n" +">>> turtle.fd(50)\n" +">>> turtle.position()\n" +"(200.00,-0.00)\n" +">>> turtle.clearstamp(astamp)\n" +">>> turtle.position()\n" +"(200.00,-0.00)" +msgstr "" + +#: library/turtle.rst:847 msgid "" "Delete all or first/last *n* of turtle's stamps. If *n* is ``None``, delete " "all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete last " "*n* stamps." msgstr "" -#: library/turtle.rst:815 +#: library/turtle.rst:851 +msgid "" +">>> for i in range(8):\n" +"... unused_stamp_id = turtle.stamp()\n" +"... turtle.fd(30)\n" +">>> turtle.clearstamps(2)\n" +">>> turtle.clearstamps(-2)\n" +">>> turtle.clearstamps()" +msgstr "" + +#: library/turtle.rst:863 msgid "" "Undo (repeatedly) the last turtle action(s). Number of available undo " "actions is determined by the size of the undobuffer." msgstr "" -#: library/turtle.rst:830 +#: library/turtle.rst:866 +msgid "" +">>> for i in range(4):\n" +"... turtle.fd(50); turtle.lt(80)\n" +"...\n" +">>> for i in range(8):\n" +"... turtle.undo()" +msgstr "" + +#: library/turtle.rst:878 msgid "an integer in the range 0..10 or a speedstring (see below)" msgstr "" -#: library/turtle.rst:832 +#: library/turtle.rst:880 msgid "" "Set the turtle's speed to an integer value in the range 0..10. If no " "argument is given, return current speed." msgstr "" -#: library/turtle.rst:835 +#: library/turtle.rst:883 msgid "" "If input is a number greater than 10 or smaller than 0.5, speed is set to " "0. Speedstrings are mapped to speedvalues as follows:" msgstr "" -#: library/turtle.rst:838 +#: library/turtle.rst:886 msgid "\"fastest\": 0" msgstr "" -#: library/turtle.rst:839 +#: library/turtle.rst:887 msgid "\"fast\": 10" msgstr "" -#: library/turtle.rst:840 +#: library/turtle.rst:888 msgid "\"normal\": 6" msgstr "" -#: library/turtle.rst:841 +#: library/turtle.rst:889 msgid "\"slow\": 3" msgstr "" -#: library/turtle.rst:842 +#: library/turtle.rst:890 msgid "\"slowest\": 1" msgstr "" -#: library/turtle.rst:844 +#: library/turtle.rst:892 msgid "" "Speeds from 1 to 10 enforce increasingly faster animation of line drawing " "and turtle turning." msgstr "" -#: library/turtle.rst:847 +#: library/turtle.rst:895 msgid "" "Attention: *speed* = 0 means that *no* animation takes place. forward/back " "makes turtle jump and likewise left/right make the turtle turn instantly." msgstr "" -#: library/turtle.rst:870 +#: library/turtle.rst:899 +msgid "" +">>> turtle.speed()\n" +"3\n" +">>> turtle.speed('normal')\n" +">>> turtle.speed()\n" +"6\n" +">>> turtle.speed(9)\n" +">>> turtle.speed()\n" +"9" +msgstr "" + +#: library/turtle.rst:918 msgid "" "Return the turtle's current location (x,y) (as a :class:`Vec2D` vector)." msgstr "" -#: library/turtle.rst:944 +#: library/turtle.rst:920 +msgid "" +">>> turtle.pos()\n" +"(440.00,-0.00)" +msgstr "" + +#: library/turtle.rst:992 msgid "a number or a pair/vector of numbers or a turtle instance" msgstr "" -#: library/turtle.rst:945 +#: library/turtle.rst:993 msgid "a number if *x* is a number, else ``None``" msgstr "" -#: library/turtle.rst:884 +#: library/turtle.rst:932 msgid "" "Return the angle between the line from turtle position to position specified " "by (x,y), the vector or the other turtle. This depends on the turtle's " @@ -1067,116 +1434,201 @@ msgid "" "\"logo\"." msgstr "" -#: library/turtle.rst:898 +#: library/turtle.rst:936 +msgid "" +">>> turtle.goto(10, 10)\n" +">>> turtle.towards(0,0)\n" +"225.0" +msgstr "" + +#: library/turtle.rst:946 msgid "Return the turtle's x coordinate." msgstr "" -#: library/turtle.rst:914 +#: library/turtle.rst:948 +msgid "" +">>> turtle.home()\n" +">>> turtle.left(50)\n" +">>> turtle.forward(100)\n" +">>> turtle.pos()\n" +"(64.28,76.60)\n" +">>> print(round(turtle.xcor(), 5))\n" +"64.27876" +msgstr "" + +#: library/turtle.rst:962 msgid "Return the turtle's y coordinate." msgstr "" -#: library/turtle.rst:930 +#: library/turtle.rst:964 +msgid "" +">>> turtle.home()\n" +">>> turtle.left(60)\n" +">>> turtle.forward(100)\n" +">>> print(turtle.pos())\n" +"(50.00,86.60)\n" +">>> print(round(turtle.ycor(), 5))\n" +"86.60254" +msgstr "" + +#: library/turtle.rst:978 msgid "" "Return the turtle's current heading (value depends on the turtle mode, see :" "func:`mode`)." msgstr "" -#: library/turtle.rst:947 +#: library/turtle.rst:981 +msgid "" +">>> turtle.home()\n" +">>> turtle.left(67)\n" +">>> turtle.heading()\n" +"67.0" +msgstr "" + +#: library/turtle.rst:995 msgid "" "Return the distance from the turtle to (x,y), the given vector, or the given " "other turtle, in turtle step units." msgstr "" -#: library/turtle.rst:965 +#: library/turtle.rst:998 +msgid "" +">>> turtle.home()\n" +">>> turtle.distance(30,40)\n" +"50.0\n" +">>> turtle.distance((30,40))\n" +"50.0\n" +">>> joe = Turtle()\n" +">>> joe.forward(77)\n" +">>> turtle.distance(joe)\n" +"77.0" +msgstr "" + +#: library/turtle.rst:1013 msgid "Settings for measurement" msgstr "" -#: library/turtle.rst:971 +#: library/turtle.rst:1019 msgid "" "Set angle measurement units, i.e. set number of \"degrees\" for a full " "circle. Default value is 360 degrees." msgstr "" -#: library/turtle.rst:994 +#: library/turtle.rst:1022 +msgid "" +">>> turtle.home()\n" +">>> turtle.left(90)\n" +">>> turtle.heading()\n" +"90.0\n" +"\n" +">>> # Change angle measurement unit to grad (also known as gon,\n" +">>> # grade, or gradian and equals 1/100-th of the right angle.)\n" +">>> turtle.degrees(400.0)\n" +">>> turtle.heading()\n" +"100.0\n" +">>> turtle.degrees(360)\n" +">>> turtle.heading()\n" +"90.0" +msgstr "" + +#: library/turtle.rst:1042 msgid "" "Set the angle measurement units to radians. Equivalent to ``degrees(2*math." "pi)``." msgstr "" -#: library/turtle.rst:1025 +#: library/turtle.rst:1045 +msgid "" +">>> turtle.home()\n" +">>> turtle.left(90)\n" +">>> turtle.heading()\n" +"90.0\n" +">>> turtle.radians()\n" +">>> turtle.heading()\n" +"1.5707963267948966" +msgstr "" + +#: library/turtle.rst:1073 msgid "Pull the pen down -- drawing when moving." msgstr "" -#: library/turtle.rst:1032 +#: library/turtle.rst:1080 msgid "Pull the pen up -- no drawing when moving." msgstr "" -#: library/turtle.rst:1038 +#: library/turtle.rst:1086 msgid "a positive number" msgstr "" -#: library/turtle.rst:1040 +#: library/turtle.rst:1088 msgid "" "Set the line thickness to *width* or return it. If resizemode is set to " "\"auto\" and turtleshape is a polygon, that polygon is drawn with the same " "line thickness. If no argument is given, the current pensize is returned." msgstr "" -#: library/turtle.rst:1054 +#: library/turtle.rst:1092 +msgid "" +">>> turtle.pensize()\n" +"1\n" +">>> turtle.pensize(10) # from here on lines of width 10 are drawn" +msgstr "" + +#: library/turtle.rst:1102 msgid "a dictionary with some or all of the below listed keys" msgstr "" -#: library/turtle.rst:1055 +#: library/turtle.rst:1103 msgid "one or more keyword-arguments with the below listed keys as keywords" msgstr "" -#: library/turtle.rst:1057 +#: library/turtle.rst:1105 msgid "" "Return or set the pen's attributes in a \"pen-dictionary\" with the " "following key/value pairs:" msgstr "" -#: library/turtle.rst:1060 +#: library/turtle.rst:1108 msgid "\"shown\": True/False" msgstr "" -#: library/turtle.rst:1061 +#: library/turtle.rst:1109 msgid "\"pendown\": True/False" msgstr "" -#: library/turtle.rst:1062 +#: library/turtle.rst:1110 msgid "\"pencolor\": color-string or color-tuple" msgstr "" -#: library/turtle.rst:1063 +#: library/turtle.rst:1111 msgid "\"fillcolor\": color-string or color-tuple" msgstr "" -#: library/turtle.rst:1064 +#: library/turtle.rst:1112 msgid "\"pensize\": positive number" msgstr "" -#: library/turtle.rst:1065 +#: library/turtle.rst:1113 msgid "\"speed\": number in range 0..10" msgstr "" -#: library/turtle.rst:1066 +#: library/turtle.rst:1114 msgid "\"resizemode\": \"auto\" or \"user\" or \"noresize\"" msgstr "" -#: library/turtle.rst:1067 +#: library/turtle.rst:1115 msgid "\"stretchfactor\": (positive number, positive number)" msgstr "" -#: library/turtle.rst:1068 +#: library/turtle.rst:1116 msgid "\"outline\": positive number" msgstr "" -#: library/turtle.rst:1069 +#: library/turtle.rst:1117 msgid "\"tilt\": number" msgstr "" -#: library/turtle.rst:1071 +#: library/turtle.rst:1119 msgid "" "This dictionary can be used as argument for a subsequent call to :func:`pen` " "to restore the former pen-state. Moreover one or more of these attributes " @@ -1184,181 +1636,290 @@ msgid "" "attributes in one statement." msgstr "" -#: library/turtle.rst:1097 +#: library/turtle.rst:1124 +msgid "" +">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" +">>> sorted(turtle.pen().items())\n" +"[('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'),\n" +" ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),\n" +" ('shearfactor', 0.0), ('shown', True), ('speed', 9),\n" +" ('stretchfactor', (1.0, 1.0)), ('tilt', 0.0)]\n" +">>> penstate=turtle.pen()\n" +">>> turtle.color(\"yellow\", \"\")\n" +">>> turtle.penup()\n" +">>> sorted(turtle.pen().items())[:3]\n" +"[('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow')]\n" +">>> turtle.pen(penstate, fillcolor=\"green\")\n" +">>> sorted(turtle.pen().items())[:3]\n" +"[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]" +msgstr "" + +#: library/turtle.rst:1145 msgid "Return ``True`` if pen is down, ``False`` if it's up." msgstr "" -#: library/turtle.rst:1115 +#: library/turtle.rst:1147 +msgid "" +">>> turtle.penup()\n" +">>> turtle.isdown()\n" +"False\n" +">>> turtle.pendown()\n" +">>> turtle.isdown()\n" +"True" +msgstr "" + +#: library/turtle.rst:1165 msgid "Return or set the pencolor." msgstr "" -#: library/turtle.rst:1166 +#: library/turtle.rst:1218 library/turtle.rst:1892 msgid "Four input formats are allowed:" msgstr "" -#: library/turtle.rst:1122 +#: library/turtle.rst:1169 msgid "``pencolor()``" msgstr "" -#: library/turtle.rst:1120 +#: library/turtle.rst:1170 msgid "" "Return the current pencolor as color specification string or as a tuple (see " -"example). May be used as input to another color/pencolor/fillcolor call." +"example). May be used as input to another color/pencolor/fillcolor/bgcolor " +"call." msgstr "" -#: library/turtle.rst:1126 +#: library/turtle.rst:1174 msgid "``pencolor(colorstring)``" msgstr "" -#: library/turtle.rst:1125 +#: library/turtle.rst:1175 msgid "" "Set pencolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: library/turtle.rst:1131 +#: library/turtle.rst:1178 msgid "``pencolor((r, g, b))``" msgstr "" -#: library/turtle.rst:1129 +#: library/turtle.rst:1179 msgid "" "Set pencolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: library/turtle.rst:1135 +#: library/turtle.rst:1183 msgid "``pencolor(r, g, b)``" msgstr "" -#: library/turtle.rst:1134 +#: library/turtle.rst:1184 msgid "" "Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: library/turtle.rst:1137 +#: library/turtle.rst:1187 msgid "" "If turtleshape is a polygon, the outline of that polygon is drawn with the " "newly set pencolor." msgstr "" -#: library/turtle.rst:1164 +#: library/turtle.rst:1190 +msgid "" +">>> colormode()\n" +"1.0\n" +">>> turtle.pencolor()\n" +"'red'\n" +">>> turtle.pencolor(\"brown\")\n" +">>> turtle.pencolor()\n" +"'brown'\n" +">>> tup = (0.2, 0.8, 0.55)\n" +">>> turtle.pencolor(tup)\n" +">>> turtle.pencolor()\n" +"(0.2, 0.8, 0.5490196078431373)\n" +">>> colormode(255)\n" +">>> turtle.pencolor()\n" +"(51.0, 204.0, 140.0)\n" +">>> turtle.pencolor('#32c18f')\n" +">>> turtle.pencolor()\n" +"(50.0, 193.0, 143.0)" +msgstr "" + +#: library/turtle.rst:1216 msgid "Return or set the fillcolor." msgstr "" -#: library/turtle.rst:1171 +#: library/turtle.rst:1220 msgid "``fillcolor()``" msgstr "" -#: library/turtle.rst:1169 +#: library/turtle.rst:1221 msgid "" "Return the current fillcolor as color specification string, possibly in " "tuple format (see example). May be used as input to another color/pencolor/" -"fillcolor call." +"fillcolor/bgcolor call." msgstr "" -#: library/turtle.rst:1175 +#: library/turtle.rst:1225 msgid "``fillcolor(colorstring)``" msgstr "" -#: library/turtle.rst:1174 +#: library/turtle.rst:1226 msgid "" "Set fillcolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: library/turtle.rst:1180 +#: library/turtle.rst:1229 msgid "``fillcolor((r, g, b))``" msgstr "" -#: library/turtle.rst:1178 +#: library/turtle.rst:1230 msgid "" "Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: library/turtle.rst:1184 +#: library/turtle.rst:1234 msgid "``fillcolor(r, g, b)``" msgstr "" -#: library/turtle.rst:1183 +#: library/turtle.rst:1235 msgid "" "Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: library/turtle.rst:1186 +#: library/turtle.rst:1238 msgid "" "If turtleshape is a polygon, the interior of that polygon is drawn with the " "newly set fillcolor." msgstr "" -#: library/turtle.rst:1207 +#: library/turtle.rst:1241 +msgid "" +">>> turtle.fillcolor(\"violet\")\n" +">>> turtle.fillcolor()\n" +"'violet'\n" +">>> turtle.pencolor()\n" +"(50.0, 193.0, 143.0)\n" +">>> turtle.fillcolor((50, 193, 143)) # Integers, not floats\n" +">>> turtle.fillcolor()\n" +"(50.0, 193.0, 143.0)\n" +">>> turtle.fillcolor('#ffffff')\n" +">>> turtle.fillcolor()\n" +"(255.0, 255.0, 255.0)" +msgstr "" + +#: library/turtle.rst:1262 msgid "Return or set pencolor and fillcolor." msgstr "" -#: library/turtle.rst:1209 +#: library/turtle.rst:1264 msgid "" "Several input formats are allowed. They use 0 to 3 arguments as follows:" msgstr "" -#: library/turtle.rst:1215 +#: library/turtle.rst:1267 msgid "``color()``" msgstr "" -#: library/turtle.rst:1213 +#: library/turtle.rst:1268 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " "specification strings or tuples as returned by :func:`pencolor` and :func:" "`fillcolor`." msgstr "" -#: library/turtle.rst:1219 +#: library/turtle.rst:1272 msgid "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" msgstr "" -#: library/turtle.rst:1218 +#: library/turtle.rst:1273 msgid "" "Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the " "given value." msgstr "" -#: library/turtle.rst:1223 +#: library/turtle.rst:1276 msgid "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" msgstr "" -#: library/turtle.rst:1222 +#: library/turtle.rst:1277 msgid "" "Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` and " "analogously if the other input format is used." msgstr "" -#: library/turtle.rst:1225 +#: library/turtle.rst:1280 msgid "" "If turtleshape is a polygon, outline and interior of that polygon is drawn " "with the newly set colors." msgstr "" -#: library/turtle.rst:1239 +#: library/turtle.rst:1283 +msgid "" +">>> turtle.color(\"red\", \"green\")\n" +">>> turtle.color()\n" +"('red', 'green')\n" +">>> color(\"#285078\", \"#a0c8f0\")\n" +">>> color()\n" +"((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))" +msgstr "" + +#: library/turtle.rst:1294 msgid "See also: Screen method :func:`colormode`." msgstr "" -#: library/turtle.rst:1253 +#: library/turtle.rst:1308 msgid "Return fillstate (``True`` if filling, ``False`` else)." msgstr "" -#: library/turtle.rst:1268 +#: library/turtle.rst:1310 +msgid "" +">>> turtle.begin_fill()\n" +">>> if turtle.filling():\n" +"... turtle.pensize(5)\n" +"... else:\n" +"... turtle.pensize(3)" +msgstr "" + +#: library/turtle.rst:1321 +msgid "Fill the shape drawn in the ``with turtle.fill():`` block." +msgstr "" + +#: library/turtle.rst:1323 +msgid "" +">>> turtle.color(\"black\", \"red\")\n" +">>> with turtle.fill():\n" +"... turtle.circle(80)" +msgstr "" + +#: library/turtle.rst:1330 +msgid "" +"Using :func:`!fill` is equivalent to adding the :func:`begin_fill` before " +"the fill-block and :func:`end_fill` after the fill-block:" +msgstr "" + +#: library/turtle.rst:1358 +msgid "" +">>> turtle.color(\"black\", \"red\")\n" +">>> turtle.begin_fill()\n" +">>> turtle.circle(80)\n" +">>> turtle.end_fill()" +msgstr "" + +#: library/turtle.rst:1346 msgid "To be called just before drawing a shape to be filled." msgstr "" -#: library/turtle.rst:1273 +#: library/turtle.rst:1351 msgid "Fill the shape drawn after the last call to :func:`begin_fill`." msgstr "" -#: library/turtle.rst:1275 +#: library/turtle.rst:1353 msgid "" "Whether or not overlap regions for self-intersecting polygons or multiple " "shapes are filled depends on the operating system graphics, type of overlap, " @@ -1366,36 +1927,51 @@ msgid "" "all yellow or have some white regions." msgstr "" -#: library/turtle.rst:1294 +#: library/turtle.rst:1372 msgid "" "Delete the turtle's drawings from the screen, re-center the turtle and set " "variables to the default values." msgstr "" -#: library/turtle.rst:1315 +#: library/turtle.rst:1375 msgid "" -"Delete the turtle's drawings from the screen. Do not move turtle. State " -"and position of the turtle as well as drawings of other turtles are not " +">>> turtle.goto(0,-22)\n" +">>> turtle.left(100)\n" +">>> turtle.position()\n" +"(0.00,-22.00)\n" +">>> turtle.heading()\n" +"100.0\n" +">>> turtle.reset()\n" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.heading()\n" +"0.0" +msgstr "" + +#: library/turtle.rst:1393 +msgid "" +"Delete the turtle's drawings from the screen. Do not move turtle. State " +"and position of the turtle as well as drawings of other turtles are not " "affected." msgstr "" -#: library/turtle.rst:1321 +#: library/turtle.rst:1399 msgid "object to be written to the TurtleScreen" msgstr "" -#: library/turtle.rst:1322 +#: library/turtle.rst:1400 msgid "True/False" msgstr "" -#: library/turtle.rst:1323 +#: library/turtle.rst:1401 msgid "one of the strings \"left\", \"center\" or right\"" msgstr "" -#: library/turtle.rst:1324 +#: library/turtle.rst:1402 msgid "a triple (fontname, fontsize, fonttype)" msgstr "" -#: library/turtle.rst:1326 +#: library/turtle.rst:1404 msgid "" "Write text - the string representation of *arg* - at the current turtle " "position according to *align* (\"left\", \"center\" or \"right\") and with " @@ -1403,26 +1979,34 @@ msgid "" "corner of the text. By default, *move* is ``False``." msgstr "" -#: library/turtle.rst:1344 +#: library/turtle.rst:1422 msgid "" "Make the turtle invisible. It's a good idea to do this while you're in the " "middle of doing some complex drawing, because hiding the turtle speeds up " "the drawing observably." msgstr "" -#: library/turtle.rst:1357 +#: library/turtle.rst:1426 +msgid ">>> turtle.hideturtle()" +msgstr "" + +#: library/turtle.rst:1435 msgid "Make the turtle visible." msgstr "" -#: library/turtle.rst:1367 +#: library/turtle.rst:1437 +msgid ">>> turtle.showturtle()" +msgstr "" + +#: library/turtle.rst:1445 msgid "Return ``True`` if the Turtle is shown, ``False`` if it's hidden." msgstr "" -#: library/turtle.rst:1382 +#: library/turtle.rst:1460 msgid "a string which is a valid shapename" msgstr "" -#: library/turtle.rst:1384 +#: library/turtle.rst:1462 msgid "" "Set turtle shape to shape with given *name* or, if name is not given, return " "name of current shape. Shape with *name* must exist in the TurtleScreen's " @@ -1432,44 +2016,62 @@ msgid "" "`register_shape`." msgstr "" -#: library/turtle.rst:1402 +#: library/turtle.rst:1468 +msgid "" +">>> turtle.shape()\n" +"'classic'\n" +">>> turtle.shape(\"turtle\")\n" +">>> turtle.shape()\n" +"'turtle'" +msgstr "" + +#: library/turtle.rst:1480 msgid "one of the strings \"auto\", \"user\", \"noresize\"" msgstr "" -#: library/turtle.rst:1404 +#: library/turtle.rst:1482 msgid "" "Set resizemode to one of the values: \"auto\", \"user\", \"noresize\". If " "*rmode* is not given, return current resizemode. Different resizemodes have " "the following effects:" msgstr "" -#: library/turtle.rst:1408 +#: library/turtle.rst:1486 msgid "" "\"auto\": adapts the appearance of the turtle corresponding to the value of " "pensize." msgstr "" -#: library/turtle.rst:1409 +#: library/turtle.rst:1487 msgid "" "\"user\": adapts the appearance of the turtle according to the values of " "stretchfactor and outlinewidth (outline), which are set by :func:`shapesize`." msgstr "" -#: library/turtle.rst:1412 +#: library/turtle.rst:1490 msgid "\"noresize\": no adaption of the turtle's appearance takes place." msgstr "" -#: library/turtle.rst:1414 +#: library/turtle.rst:1492 msgid "" "``resizemode(\"user\")`` is called by :func:`shapesize` when used with " "arguments." msgstr "" -#: library/turtle.rst:1430 library/turtle.rst:1431 +#: library/turtle.rst:1494 +msgid "" +">>> turtle.resizemode()\n" +"'noresize'\n" +">>> turtle.resizemode(\"auto\")\n" +">>> turtle.resizemode()\n" +"'auto'" +msgstr "" + +#: library/turtle.rst:1508 library/turtle.rst:1509 msgid "positive number" msgstr "" -#: library/turtle.rst:1433 +#: library/turtle.rst:1511 msgid "" "Return or set the pen's attributes x/y-stretchfactors and/or outline. Set " "resizemode to \"user\". If and only if resizemode is set to \"user\", the " @@ -1479,11 +2081,24 @@ msgid "" "determines the width of the shape's outline." msgstr "" -#: library/turtle.rst:2115 library/turtle.rst:2117 +#: library/turtle.rst:1518 +msgid "" +">>> turtle.shapesize()\n" +"(1.0, 1.0, 1)\n" +">>> turtle.resizemode(\"user\")\n" +">>> turtle.shapesize(5, 5, 12)\n" +">>> turtle.shapesize()\n" +"(5, 5, 12)\n" +">>> turtle.shapesize(outline=8)\n" +">>> turtle.shapesize()\n" +"(5, 5, 8)" +msgstr "" + +#: library/turtle.rst:2225 library/turtle.rst:2227 msgid "number (optional)" msgstr "" -#: library/turtle.rst:1458 +#: library/turtle.rst:1536 msgid "" "Set or return the current shearfactor. Shear the turtleshape according to " "the given shearfactor shear, which is the tangent of the shear angle. Do " @@ -1492,24 +2107,37 @@ msgid "" "by which lines parallel to the heading of the turtle are sheared." msgstr "" -#: library/turtle.rst:1479 +#: library/turtle.rst:1543 +msgid "" +">>> turtle.shape(\"circle\")\n" +">>> turtle.shapesize(5,2)\n" +">>> turtle.shearfactor(0.5)\n" +">>> turtle.shearfactor()\n" +"0.5" +msgstr "" + +#: library/turtle.rst:1557 msgid "" "Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* " "change the turtle's heading (direction of movement)." msgstr "" -#: library/turtle.rst:1498 +#: library/turtle.rst:1560 msgid "" -"Rotate the turtleshape to point in the direction specified by *angle*, " -"regardless of its current tilt-angle. *Do not* change the turtle's heading " -"(direction of movement)." +">>> turtle.reset()\n" +">>> turtle.shape(\"circle\")\n" +">>> turtle.shapesize(5,2)\n" +">>> turtle.tilt(30)\n" +">>> turtle.fd(50)\n" +">>> turtle.tilt(30)\n" +">>> turtle.fd(50)" msgstr "" -#: library/turtle.rst:1541 library/turtle.rst:1543 library/turtle.rst:1544 +#: library/turtle.rst:1597 library/turtle.rst:1599 library/turtle.rst:1600 msgid "a number (optional)" msgstr "" -#: library/turtle.rst:1520 +#: library/turtle.rst:1576 msgid "" "Set or return the current tilt-angle. If angle is given, rotate the " "turtleshape to point in the direction specified by angle, regardless of its " @@ -1519,11 +2147,21 @@ msgid "" "turtle (its direction of movement)." msgstr "" -#: library/turtle.rst:1546 +#: library/turtle.rst:1584 +msgid "" +">>> turtle.reset()\n" +">>> turtle.shape(\"circle\")\n" +">>> turtle.shapesize(5,2)\n" +">>> turtle.tilt(45)\n" +">>> turtle.tiltangle()\n" +"45.0" +msgstr "" + +#: library/turtle.rst:1602 msgid "Set or return the current transformation matrix of the turtle shape." msgstr "" -#: library/turtle.rst:1548 +#: library/turtle.rst:1604 msgid "" "If none of the matrix elements are given, return the transformation matrix " "as a tuple of 4 elements. Otherwise set the given elements and transform the " @@ -1533,98 +2171,193 @@ msgid "" "tiltangle according to the given matrix." msgstr "" -#: library/turtle.rst:1570 +#: library/turtle.rst:1613 +msgid "" +">>> turtle = Turtle()\n" +">>> turtle.shape(\"square\")\n" +">>> turtle.shapesize(4,2)\n" +">>> turtle.shearfactor(-0.5)\n" +">>> turtle.shapetransform()\n" +"(4.0, -1.0, -0.0, 2.0)" +msgstr "" + +#: library/turtle.rst:1626 msgid "" "Return the current shape polygon as tuple of coordinate pairs. This can be " "used to define a new shape or components of a compound shape." msgstr "" -#: library/turtle.rst:1610 library/turtle.rst:2039 +#: library/turtle.rst:1629 +msgid "" +">>> turtle.shape(\"square\")\n" +">>> turtle.shapetransform(4, -1, 0, 2)\n" +">>> turtle.get_shapepoly()\n" +"((50, -20), (30, 20), (-50, 20), (-30, -20))" +msgstr "" + +#: library/turtle.rst:1666 library/turtle.rst:2149 msgid "" "a function with two arguments which will be called with the coordinates of " "the clicked point on the canvas" msgstr "" -#: library/turtle.rst:1612 library/turtle.rst:2041 +#: library/turtle.rst:1668 library/turtle.rst:2151 msgid "number of the mouse-button, defaults to 1 (left mouse button)" msgstr "" -#: library/turtle.rst:1613 library/turtle.rst:2042 +#: library/turtle.rst:1669 library/turtle.rst:2152 msgid "" "``True`` or ``False`` -- if ``True``, a new binding will be added, otherwise " "it will replace a former binding" msgstr "" -#: library/turtle.rst:1594 +#: library/turtle.rst:1650 msgid "" "Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, " "existing bindings are removed. Example for the anonymous turtle, i.e. the " "procedural way:" msgstr "" -#: library/turtle.rst:1616 +#: library/turtle.rst:1654 +msgid "" +">>> def turn(x, y):\n" +"... left(180)\n" +"...\n" +">>> onclick(turn) # Now clicking into the turtle will turn it.\n" +">>> onclick(None) # event-binding will be removed" +msgstr "" + +#: library/turtle.rst:1672 msgid "" "Bind *fun* to mouse-button-release events on this turtle. If *fun* is " "``None``, existing bindings are removed." msgstr "" -#: library/turtle.rst:1641 +#: library/turtle.rst:1675 +msgid "" +">>> class MyTurtle(Turtle):\n" +"... def glow(self,x,y):\n" +"... self.fillcolor(\"red\")\n" +"... def unglow(self,x,y):\n" +"... self.fillcolor(\"\")\n" +"...\n" +">>> turtle = MyTurtle()\n" +">>> turtle.onclick(turtle.glow) # clicking on turtle turns fillcolor " +"red,\n" +">>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent." +msgstr "" + +#: library/turtle.rst:1697 msgid "" "Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: library/turtle.rst:1644 +#: library/turtle.rst:1700 msgid "" "Remark: Every sequence of mouse-move-events on a turtle is preceded by a " "mouse-click event on that turtle." msgstr "" -#: library/turtle.rst:1652 +#: library/turtle.rst:1703 +msgid ">>> turtle.ondrag(turtle.goto)" +msgstr "" + +#: library/turtle.rst:1708 msgid "" "Subsequently, clicking and dragging the Turtle will move it across the " "screen thereby producing handdrawings (if pen is down)." msgstr "" -#: library/turtle.rst:1661 +#: library/turtle.rst:1718 +msgid "" +"Record the vertices of a polygon drawn in the ``with turtle.poly():`` block. " +"The first and last vertices will be connected." +msgstr "" + +#: library/turtle.rst:1721 +msgid "" +">>> with turtle.poly():\n" +"... turtle.forward(100)\n" +"... turtle.right(60)\n" +"... turtle.forward(100)" +msgstr "" + +#: library/turtle.rst:1734 msgid "" "Start recording the vertices of a polygon. Current turtle position is first " "vertex of polygon." msgstr "" -#: library/turtle.rst:1667 +#: library/turtle.rst:1740 msgid "" "Stop recording the vertices of a polygon. Current turtle position is last " "vertex of polygon. This will be connected with the first vertex." msgstr "" -#: library/turtle.rst:1673 +#: library/turtle.rst:1746 msgid "Return the last recorded polygon." msgstr "" -#: library/turtle.rst:1692 +#: library/turtle.rst:1748 +msgid "" +">>> turtle.home()\n" +">>> turtle.begin_poly()\n" +">>> turtle.fd(100)\n" +">>> turtle.left(20)\n" +">>> turtle.fd(30)\n" +">>> turtle.left(60)\n" +">>> turtle.fd(50)\n" +">>> turtle.end_poly()\n" +">>> p = turtle.get_poly()\n" +">>> register_shape(\"myFavouriteShape\", p)" +msgstr "" + +#: library/turtle.rst:1765 msgid "" "Create and return a clone of the turtle with same position, heading and " "turtle properties." msgstr "" -#: library/turtle.rst:1705 +#: library/turtle.rst:1768 +msgid "" +">>> mick = Turtle()\n" +">>> joe = mick.clone()" +msgstr "" + +#: library/turtle.rst:1778 msgid "" "Return the Turtle object itself. Only reasonable use: as a function to " "return the \"anonymous turtle\":" msgstr "" -#: library/turtle.rst:1719 +#: library/turtle.rst:1781 +msgid "" +">>> pet = getturtle()\n" +">>> pet.fd(50)\n" +">>> pet\n" +"" +msgstr "" + +#: library/turtle.rst:1792 msgid "" "Return the :class:`TurtleScreen` object the turtle is drawing on. " "TurtleScreen methods can then be called for that object." msgstr "" -#: library/turtle.rst:1733 +#: library/turtle.rst:1795 +msgid "" +">>> ts = turtle.getscreen()\n" +">>> ts\n" +"\n" +">>> ts.bgcolor(\"pink\")" +msgstr "" + +#: library/turtle.rst:1806 msgid "an integer or ``None``" msgstr "" -#: library/turtle.rst:1735 +#: library/turtle.rst:1808 msgid "" "Set or disable undobuffer. If *size* is an integer, an empty undobuffer of " "given size is installed. *size* gives the maximum number of turtle actions " @@ -1632,71 +2365,144 @@ msgid "" "``None``, the undobuffer is disabled." msgstr "" -#: library/turtle.rst:1748 +#: library/turtle.rst:1813 +msgid ">>> turtle.setundobuffer(42)" +msgstr "" + +#: library/turtle.rst:1821 msgid "Return number of entries in the undobuffer." msgstr "" -#: library/turtle.rst:1761 +#: library/turtle.rst:1823 +msgid "" +">>> while undobufferentries():\n" +"... undo()" +msgstr "" + +#: library/turtle.rst:1834 msgid "Compound shapes" msgstr "" -#: library/turtle.rst:1763 +#: library/turtle.rst:1836 msgid "" "To use compound turtle shapes, which consist of several polygons of " "different color, you must use the helper class :class:`Shape` explicitly as " "described below:" msgstr "" -#: library/turtle.rst:1767 +#: library/turtle.rst:1840 msgid "Create an empty Shape object of type \"compound\"." msgstr "" -#: library/turtle.rst:1768 +#: library/turtle.rst:1841 msgid "" "Add as many components to this object as desired, using the :meth:`~Shape." "addcomponent` method." msgstr "" -#: library/turtle.rst:1771 +#: library/turtle.rst:1844 msgid "For example:" msgstr "" -#: library/turtle.rst:1782 +#: library/turtle.rst:1846 +msgid "" +">>> s = Shape(\"compound\")\n" +">>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))\n" +">>> s.addcomponent(poly1, \"red\", \"blue\")\n" +">>> poly2 = ((0,0),(10,-5),(-10,-5))\n" +">>> s.addcomponent(poly2, \"blue\", \"red\")" +msgstr "" + +#: library/turtle.rst:1855 msgid "Now add the Shape to the Screen's shapelist and use it:" msgstr "" -#: library/turtle.rst:1793 +#: library/turtle.rst:1857 +msgid "" +">>> register_shape(\"myshape\", s)\n" +">>> shape(\"myshape\")" +msgstr "" + +#: library/turtle.rst:1866 msgid "" "The :class:`Shape` class is used internally by the :func:`register_shape` " "method in different ways. The application programmer has to deal with the " "Shape class *only* when using compound shapes like shown above!" msgstr "" -#: library/turtle.rst:1799 +#: library/turtle.rst:1872 msgid "Methods of TurtleScreen/Screen and corresponding functions" msgstr "" -#: library/turtle.rst:1801 +#: library/turtle.rst:1874 msgid "" "Most of the examples in this section refer to a TurtleScreen instance called " "``screen``." msgstr "" -#: library/turtle.rst:1815 +#: library/turtle.rst:1890 +msgid "Return or set the background color of the TurtleScreen." +msgstr "" + +#: library/turtle.rst:1894 +msgid "``bgcolor()``" +msgstr "" + +#: library/turtle.rst:1895 msgid "" -"a color string or three numbers in the range 0..colormode or a 3-tuple of " -"such numbers" +"Return the current background color as color specification string or as a " +"tuple (see example). May be used as input to another color/pencolor/" +"fillcolor/bgcolor call." msgstr "" -#: library/turtle.rst:1819 -msgid "Set or return background color of the TurtleScreen." +#: library/turtle.rst:1899 +msgid "``bgcolor(colorstring)``" msgstr "" -#: library/turtle.rst:1834 -msgid "a string, name of a gif-file or ``\"nopic\"``, or ``None``" +#: library/turtle.rst:1900 +msgid "" +"Set the background color to *colorstring*, which is a Tk color specification " +"string, such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: library/turtle.rst:1836 +#: library/turtle.rst:1903 +msgid "``bgcolor((r, g, b))``" +msgstr "" + +#: library/turtle.rst:1904 +msgid "" +"Set the background color to the RGB color represented by the tuple of *r*, " +"*g*, and *b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, " +"where colormode is either 1.0 or 255 (see :func:`colormode`)." +msgstr "" + +#: library/turtle.rst:1909 +msgid "``bgcolor(r, g, b)``" +msgstr "" + +#: library/turtle.rst:1910 +msgid "" +"Set the background color to the RGB color represented by *r*, *g*, and *b*. " +"Each of *r*, *g*, and *b* must be in the range 0..colormode." +msgstr "" + +#: library/turtle.rst:1913 +msgid "" +">>> screen.bgcolor(\"orange\")\n" +">>> screen.bgcolor()\n" +"'orange'\n" +">>> screen.bgcolor(\"#800080\")\n" +">>> screen.bgcolor()\n" +"(128.0, 0.0, 128.0)" +msgstr "" + +#: library/turtle.rst:1926 +msgid "" +"a string, name of an image file (PNG, GIF, PGM, and PPM) or ``\"nopic\"``, " +"or ``None``" +msgstr "" + +#: library/turtle.rst:1929 msgid "" "Set background image or return name of current backgroundimage. If " "*picname* is a filename, set the corresponding image as background. If " @@ -1704,44 +2510,53 @@ msgid "" "*picname* is ``None``, return the filename of the current backgroundimage. ::" msgstr "" -#: library/turtle.rst:1852 +#: library/turtle.rst:1934 +msgid "" +">>> screen.bgpic()\n" +"'nopic'\n" +">>> screen.bgpic(\"landscape.gif\")\n" +">>> screen.bgpic()\n" +"\"landscape.gif\"" +msgstr "" + +#: library/turtle.rst:1945 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``clearscreen``. The global function ``clear`` is a different one " "derived from the Turtle method ``clear``." msgstr "" -#: library/turtle.rst:1859 +#: library/turtle.rst:1952 msgid "" "Delete all drawings and all turtles from the TurtleScreen. Reset the now " "empty TurtleScreen to its initial state: white background, no background " "image, no event bindings and tracing on." msgstr "" -#: library/turtle.rst:1868 +#: library/turtle.rst:1961 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``resetscreen``. The global function ``reset`` is another one derived " "from the Turtle method ``reset``." msgstr "" -#: library/turtle.rst:1875 +#: library/turtle.rst:1968 msgid "Reset all Turtles on the Screen to their initial state." msgstr "" -#: library/turtle.rst:1880 +#: library/turtle.rst:1973 msgid "positive integer, new width of canvas in pixels" msgstr "" -#: library/turtle.rst:1881 +#: library/turtle.rst:1974 msgid "positive integer, new height of canvas in pixels" msgstr "" -#: library/turtle.rst:1882 +#: library/turtle.rst:1975 msgid "colorstring or color-tuple, new background color" msgstr "" -#: library/turtle.rst:1884 +#: library/turtle.rst:1977 msgid "" "If no arguments are given, return current (canvaswidth, canvasheight). Else " "resize the canvas the turtles are drawing on. Do not alter the drawing " @@ -1750,59 +2565,94 @@ msgid "" "outside the canvas before." msgstr "" -#: library/turtle.rst:1896 +#: library/turtle.rst:1989 msgid "e.g. to search for an erroneously escaped turtle ;-)" msgstr "" -#: library/turtle.rst:1901 +#: library/turtle.rst:1994 msgid "a number, x-coordinate of lower left corner of canvas" msgstr "" -#: library/turtle.rst:1902 +#: library/turtle.rst:1995 msgid "a number, y-coordinate of lower left corner of canvas" msgstr "" -#: library/turtle.rst:1903 +#: library/turtle.rst:1996 msgid "a number, x-coordinate of upper right corner of canvas" msgstr "" -#: library/turtle.rst:1904 +#: library/turtle.rst:1997 msgid "a number, y-coordinate of upper right corner of canvas" msgstr "" -#: library/turtle.rst:1906 +#: library/turtle.rst:1999 msgid "" "Set up user-defined coordinate system and switch to mode \"world\" if " "necessary. This performs a ``screen.reset()``. If mode \"world\" is " "already active, all drawings are redrawn according to the new coordinates." msgstr "" -#: library/turtle.rst:1910 +#: library/turtle.rst:2003 msgid "" "**ATTENTION**: in user-defined coordinate systems angles may appear " "distorted." msgstr "" -#: library/turtle.rst:1938 +#: library/turtle.rst:2006 +msgid "" +">>> screen.reset()\n" +">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" +">>> for _ in range(72):\n" +"... left(10)\n" +"...\n" +">>> for _ in range(8):\n" +"... left(45); fd(2) # a regular octagon" +msgstr "" + +#: library/turtle.rst:2031 +msgid "" +"Temporarily disable turtle animation. The code written inside the " +"``no_animation`` block will not be animated; once the code block is exited, " +"the drawing will appear." +msgstr "" + +#: library/turtle.rst:2035 +msgid "" +">>> with screen.no_animation():\n" +"... for dist in range(2, 400, 2):\n" +"... fd(dist)\n" +"... rt(90)" +msgstr "" + +#: library/turtle.rst:2048 msgid "positive integer" msgstr "" -#: library/turtle.rst:1940 +#: library/turtle.rst:2050 msgid "" "Set or return the drawing *delay* in milliseconds. (This is approximately " "the time interval between two consecutive canvas updates.) The longer the " "drawing delay, the slower the animation." msgstr "" -#: library/turtle.rst:1944 +#: library/turtle.rst:2054 msgid "Optional argument:" msgstr "" -#: library/turtle.rst:1959 +#: library/turtle.rst:2056 +msgid "" +">>> screen.delay()\n" +"10\n" +">>> screen.delay(5)\n" +">>> screen.delay()\n" +"5" +msgstr "" + +#: library/turtle.rst:2069 msgid "nonnegative integer" msgstr "" -#: library/turtle.rst:1961 +#: library/turtle.rst:2071 msgid "" "Turn turtle animation on/off and set delay for update drawings. If *n* is " "given, only each n-th regular screen update is really performed. (Can be " @@ -1811,75 +2661,125 @@ msgid "" "delay value (see :func:`delay`)." msgstr "" -#: library/turtle.rst:1981 +#: library/turtle.rst:2078 +msgid "" +">>> screen.tracer(8, 25)\n" +">>> dist = 2\n" +">>> for i in range(200):\n" +"... fd(dist)\n" +"... rt(90)\n" +"... dist += 2" +msgstr "" + +#: library/turtle.rst:2091 msgid "Perform a TurtleScreen update. To be used when tracer is turned off." msgstr "" -#: library/turtle.rst:1983 +#: library/turtle.rst:2093 msgid "See also the RawTurtle/Turtle method :func:`speed`." msgstr "" -#: library/turtle.rst:1991 +#: library/turtle.rst:2101 msgid "" "Set focus on TurtleScreen (in order to collect key-events). Dummy arguments " "are provided in order to be able to pass :func:`listen` to the onclick " "method." msgstr "" -#: library/turtle.rst:2018 +#: library/turtle.rst:2128 msgid "a function with no arguments or ``None``" msgstr "" -#: library/turtle.rst:2019 +#: library/turtle.rst:2129 msgid "a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")" msgstr "" -#: library/turtle.rst:2001 +#: library/turtle.rst:2111 msgid "" "Bind *fun* to key-release event of key. If *fun* is ``None``, event " "bindings are removed. Remark: in order to be able to register key-events, " "TurtleScreen must have the focus. (See method :func:`listen`.)" msgstr "" -#: library/turtle.rst:2021 +#: library/turtle.rst:2115 +msgid "" +">>> def f():\n" +"... fd(50)\n" +"... lt(60)\n" +"...\n" +">>> screen.onkey(f, \"Up\")\n" +">>> screen.listen()" +msgstr "" + +#: library/turtle.rst:2131 msgid "" "Bind *fun* to key-press event of key if key is given, or to any key-press-" "event if no key is given. Remark: in order to be able to register key-" "events, TurtleScreen must have focus. (See method :func:`listen`.)" msgstr "" -#: library/turtle.rst:2045 +#: library/turtle.rst:2136 +msgid "" +">>> def f():\n" +"... fd(50)\n" +"...\n" +">>> screen.onkey(f, \"Up\")\n" +">>> screen.listen()" +msgstr "" + +#: library/turtle.rst:2155 msgid "" "Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: library/turtle.rst:2048 +#: library/turtle.rst:2158 msgid "" "Example for a TurtleScreen instance named ``screen`` and a Turtle instance " "named ``turtle``:" msgstr "" -#: library/turtle.rst:2059 +#: library/turtle.rst:2161 +msgid "" +">>> screen.onclick(turtle.goto) # Subsequently clicking into the " +"TurtleScreen will\n" +">>> # make the turtle move to the clicked " +"point.\n" +">>> screen.onclick(None) # remove event binding again" +msgstr "" + +#: library/turtle.rst:2169 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``onscreenclick``. The global function ``onclick`` is another one " "derived from the Turtle method ``onclick``." msgstr "" -#: library/turtle.rst:2066 +#: library/turtle.rst:2176 msgid "a function with no arguments" msgstr "" -#: library/turtle.rst:2067 +#: library/turtle.rst:2177 msgid "a number >= 0" msgstr "" -#: library/turtle.rst:2069 +#: library/turtle.rst:2179 msgid "Install a timer that calls *fun* after *t* milliseconds." msgstr "" -#: library/turtle.rst:2087 +#: library/turtle.rst:2181 +msgid "" +">>> running = True\n" +">>> def f():\n" +"... if running:\n" +"... fd(50)\n" +"... lt(60)\n" +"... screen.ontimer(f, 250)\n" +">>> f() ### makes the turtle march around\n" +">>> running = False" +msgstr "" + +#: library/turtle.rst:2197 msgid "" "Starts event loop - calling Tkinter's mainloop function. Must be the last " "statement in a turtle graphics program. Must *not* be used if a script is " @@ -1887,11 +2787,15 @@ msgid "" "turtle graphics. ::" msgstr "" -#: library/turtle.rst:2101 library/turtle.rst:2114 +#: library/turtle.rst:2202 +msgid ">>> screen.mainloop()" +msgstr "" + +#: library/turtle.rst:2211 library/turtle.rst:2224 msgid "string" msgstr "" -#: library/turtle.rst:2103 +#: library/turtle.rst:2213 msgid "" "Pop up a dialog window for input of a string. Parameter title is the title " "of the dialog window, prompt is a text mostly describing what information to " @@ -1899,7 +2803,11 @@ msgid "" "``None``. ::" msgstr "" -#: library/turtle.rst:2119 +#: library/turtle.rst:2218 +msgid ">>> screen.textinput(\"NIM\", \"Name of first player:\")" +msgstr "" + +#: library/turtle.rst:2229 msgid "" "Pop up a dialog window for input of a number. title is the title of the " "dialog window, prompt is a text mostly describing what numerical information " @@ -1910,17 +2818,23 @@ msgid "" "return ``None``. ::" msgstr "" -#: library/turtle.rst:2136 +#: library/turtle.rst:2238 +msgid "" +">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " +"maxval=10000)" +msgstr "" + +#: library/turtle.rst:2246 msgid "one of the strings \"standard\", \"logo\" or \"world\"" msgstr "" -#: library/turtle.rst:2138 +#: library/turtle.rst:2248 msgid "" "Set turtle mode (\"standard\", \"logo\" or \"world\") and perform reset. If " "mode is not given, current mode is returned." msgstr "" -#: library/turtle.rst:2141 +#: library/turtle.rst:2251 msgid "" "Mode \"standard\" is compatible with old :mod:`turtle`. Mode \"logo\" is " "compatible with most Logo turtle graphics. Mode \"world\" uses user-defined " @@ -1928,121 +2842,198 @@ msgid "" "if ``x/y`` unit-ratio doesn't equal 1." msgstr "" -#: library/turtle.rst:2147 +#: library/turtle.rst:2257 msgid "Mode" msgstr "" -#: library/turtle.rst:2147 +#: library/turtle.rst:2257 msgid "Initial turtle heading" msgstr "" -#: library/turtle.rst:2147 +#: library/turtle.rst:2257 msgid "positive angles" msgstr "" -#: library/turtle.rst:2149 +#: library/turtle.rst:2259 msgid "\"standard\"" msgstr "" -#: library/turtle.rst:2149 +#: library/turtle.rst:2259 msgid "to the right (east)" msgstr "" -#: library/turtle.rst:2149 +#: library/turtle.rst:2259 msgid "counterclockwise" msgstr "" -#: library/turtle.rst:2150 +#: library/turtle.rst:2260 msgid "\"logo\"" msgstr "" -#: library/turtle.rst:2150 +#: library/turtle.rst:2260 msgid "upward (north)" msgstr "" -#: library/turtle.rst:2150 +#: library/turtle.rst:2260 msgid "clockwise" msgstr "" -#: library/turtle.rst:2163 +#: library/turtle.rst:2263 +msgid "" +">>> mode(\"logo\") # resets turtle heading to north\n" +">>> mode()\n" +"'logo'" +msgstr "" + +#: library/turtle.rst:2273 msgid "one of the values 1.0 or 255" msgstr "" -#: library/turtle.rst:2165 +#: library/turtle.rst:2275 msgid "" "Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* " "values of color triples have to be in the range 0..*cmode*." msgstr "" -#: library/turtle.rst:2186 +#: library/turtle.rst:2278 +msgid "" +">>> screen.colormode(1)\n" +">>> turtle.pencolor(240, 160, 80)\n" +"Traceback (most recent call last):\n" +" ...\n" +"TurtleGraphicsError: bad color sequence: (240, 160, 80)\n" +">>> screen.colormode()\n" +"1.0\n" +">>> screen.colormode(255)\n" +">>> screen.colormode()\n" +"255\n" +">>> turtle.pencolor(240,160,80)" +msgstr "" + +#: library/turtle.rst:2296 msgid "" "Return the Canvas of this TurtleScreen. Useful for insiders who know what " "to do with a Tkinter Canvas." msgstr "" -#: library/turtle.rst:2199 +#: library/turtle.rst:2299 +msgid "" +">>> cv = screen.getcanvas()\n" +">>> cv\n" +"" +msgstr "" + +#: library/turtle.rst:2309 msgid "Return a list of names of all currently available turtle shapes." msgstr "" -#: library/turtle.rst:2211 -msgid "There are three different ways to call this function:" +#: library/turtle.rst:2311 +msgid "" +">>> screen.getshapes()\n" +"['arrow', 'blank', 'circle', ..., 'turtle']" msgstr "" -#: library/turtle.rst:2213 +#: library/turtle.rst:2321 +msgid "There are four different ways to call this function:" +msgstr "" + +#: library/turtle.rst:2323 msgid "" -"*name* is the name of a gif-file and *shape* is ``None``: Install the " -"corresponding image shape. ::" +"*name* is the name of an image file (PNG, GIF, PGM, and PPM) and *shape* is " +"``None``: Install the corresponding image shape. ::" +msgstr "" + +#: library/turtle.rst:2326 +msgid ">>> screen.register_shape(\"turtle.gif\")" msgstr "" -#: library/turtle.rst:2219 +#: library/turtle.rst:2338 msgid "" "Image shapes *do not* rotate when turning the turtle, so they do not display " "the heading of the turtle!" msgstr "" -#: library/turtle.rst:2222 +#: library/turtle.rst:2332 +msgid "" +"*name* is an arbitrary string and *shape* is the name of an image file (PNG, " +"GIF, PGM, and PPM): Install the corresponding image shape. ::" +msgstr "" + +#: library/turtle.rst:2335 +msgid ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" +msgstr "" + +#: library/turtle.rst:2341 msgid "" "*name* is an arbitrary string and *shape* is a tuple of pairs of " "coordinates: Install the corresponding polygon shape." msgstr "" -#: library/turtle.rst:2230 +#: library/turtle.rst:2344 +msgid ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" +msgstr "" + +#: library/turtle.rst:2349 msgid "" "*name* is an arbitrary string and *shape* is a (compound) :class:`Shape` " "object: Install the corresponding compound shape." msgstr "" -#: library/turtle.rst:2233 +#: library/turtle.rst:2352 msgid "" "Add a turtle shape to TurtleScreen's shapelist. Only thusly registered " "shapes can be used by issuing the command ``shape(shapename)``." msgstr "" -#: library/turtle.rst:2239 +#: library/turtle.rst:2355 +msgid "" +"Added support for PNG, PGM, and PPM image formats. Both a shape name and an " +"image file name can be specified." +msgstr "" + +#: library/turtle.rst:2362 msgid "Return the list of turtles on the screen." msgstr "" -#: library/turtle.rst:2250 +#: library/turtle.rst:2364 +msgid "" +">>> for turtle in screen.turtles():\n" +"... turtle.color(\"red\")" +msgstr "" + +#: library/turtle.rst:2373 msgid "Return the height of the turtle window. ::" msgstr "" -#: library/turtle.rst:2258 +#: library/turtle.rst:2375 +msgid "" +">>> screen.window_height()\n" +"480" +msgstr "" + +#: library/turtle.rst:2381 msgid "Return the width of the turtle window. ::" msgstr "" -#: library/turtle.rst:2267 +#: library/turtle.rst:2383 +msgid "" +">>> screen.window_width()\n" +"640" +msgstr "" + +#: library/turtle.rst:2390 msgid "Methods specific to Screen, not inherited from TurtleScreen" msgstr "" -#: library/turtle.rst:2271 +#: library/turtle.rst:2394 msgid "Shut the turtlegraphics window." msgstr "" -#: library/turtle.rst:2276 +#: library/turtle.rst:2399 msgid "Bind ``bye()`` method to mouse clicks on the Screen." msgstr "" -#: library/turtle.rst:2279 +#: library/turtle.rst:2402 msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " @@ -2051,211 +3042,252 @@ msgid "" "client script." msgstr "" -#: library/turtle.rst:2288 +#: library/turtle.rst:2411 +msgid "Save the current turtle drawing (and turtles) as a PostScript file." +msgstr "" + +#: library/turtle.rst:2413 +msgid "the path of the saved PostScript file" +msgstr "" + +#: library/turtle.rst:2414 +msgid "" +"if ``False`` and there already exists a file with the given filename, then " +"the function will raise a ``FileExistsError``. If it is ``True``, the file " +"will be overwritten." +msgstr "" + +#: library/turtle.rst:2419 +msgid "" +">>> screen.save(\"my_drawing.ps\")\n" +">>> screen.save(\"my_drawing.ps\", overwrite=True)" +msgstr "" + +#: library/turtle.rst:2429 msgid "" "Set the size and position of the main window. Default values of arguments " "are stored in the configuration dictionary and can be changed via a :file:" "`turtle.cfg` file." msgstr "" -#: library/turtle.rst:2292 +#: library/turtle.rst:2433 msgid "" "if an integer, a size in pixels, if a float, a fraction of the screen; " "default is 50% of screen" msgstr "" -#: library/turtle.rst:2294 +#: library/turtle.rst:2435 msgid "" "if an integer, the height in pixels, if a float, a fraction of the screen; " "default is 75% of screen" msgstr "" -#: library/turtle.rst:2296 +#: library/turtle.rst:2437 msgid "" "if positive, starting position in pixels from the left edge of the screen, " "if negative from the right edge, if ``None``, center window horizontally" msgstr "" -#: library/turtle.rst:2299 +#: library/turtle.rst:2440 msgid "" "if positive, starting position in pixels from the top edge of the screen, if " "negative from the bottom edge, if ``None``, center window vertically" msgstr "" -#: library/turtle.rst:2314 +#: library/turtle.rst:2444 +msgid "" +">>> screen.setup (width=200, height=200, startx=0, starty=0)\n" +">>> # sets window to 200x200 pixels, in upper left of screen\n" +">>> screen.setup(width=.75, height=0.5, startx=None, starty=None)\n" +">>> # sets window to 75% of screen by 50% of screen and centers" +msgstr "" + +#: library/turtle.rst:2455 msgid "a string that is shown in the titlebar of the turtle graphics window" msgstr "" -#: library/turtle.rst:2317 +#: library/turtle.rst:2458 msgid "Set title of turtle window to *titlestring*." msgstr "" -#: library/turtle.rst:2326 +#: library/turtle.rst:2460 +msgid ">>> screen.title(\"Welcome to the turtle zoo!\")" +msgstr "" + +#: library/turtle.rst:2467 msgid "Public classes" msgstr "" -#: library/turtle.rst:2332 +#: library/turtle.rst:2473 msgid "" "a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a :class:" "`TurtleScreen`" msgstr "" -#: library/turtle.rst:2335 +#: library/turtle.rst:2476 msgid "" "Create a turtle. The turtle has all methods described above as \"methods of " "Turtle/RawTurtle\"." msgstr "" -#: library/turtle.rst:2341 +#: library/turtle.rst:2482 msgid "" "Subclass of RawTurtle, has the same interface but draws on a default :class:" "`Screen` object created automatically when needed for the first time." msgstr "" -#: library/turtle.rst:2347 +#: library/turtle.rst:2488 msgid "a :class:`!tkinter.Canvas`" msgstr "" -#: library/turtle.rst:2349 +#: library/turtle.rst:2490 msgid "" "Provides screen oriented methods like :func:`bgcolor` etc. that are " "described above." msgstr "" -#: library/turtle.rst:2354 +#: library/turtle.rst:2495 msgid "" "Subclass of TurtleScreen, with :ref:`four methods added `." msgstr "" -#: library/turtle.rst:2359 +#: library/turtle.rst:2500 msgid "" "some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas " "with scrollbars added" msgstr "" -#: library/turtle.rst:2362 +#: library/turtle.rst:2503 msgid "" "Used by class Screen, which thus automatically provides a ScrolledCanvas as " "playground for the turtles." msgstr "" -#: library/turtle.rst:2367 +#: library/turtle.rst:2508 msgid "one of the strings \"polygon\", \"image\", \"compound\"" msgstr "" -#: library/turtle.rst:2369 +#: library/turtle.rst:2510 msgid "" "Data structure modeling shapes. The pair ``(type_, data)`` must follow this " "specification:" msgstr "" -#: library/turtle.rst:2374 +#: library/turtle.rst:2515 msgid "*type_*" msgstr "" -#: library/turtle.rst:2374 +#: library/turtle.rst:2515 msgid "*data*" msgstr "" -#: library/turtle.rst:2376 +#: library/turtle.rst:2517 msgid "\"polygon\"" msgstr "" -#: library/turtle.rst:2376 +#: library/turtle.rst:2517 msgid "a polygon-tuple, i.e. a tuple of pairs of coordinates" msgstr "" -#: library/turtle.rst:2377 +#: library/turtle.rst:2518 msgid "\"image\"" msgstr "" -#: library/turtle.rst:2377 +#: library/turtle.rst:2518 msgid "an image (in this form only used internally!)" msgstr "" -#: library/turtle.rst:2378 +#: library/turtle.rst:2519 msgid "\"compound\"" msgstr "" -#: library/turtle.rst:2378 +#: library/turtle.rst:2519 msgid "" "``None`` (a compound shape has to be constructed using the :meth:" "`addcomponent` method)" msgstr "" -#: library/turtle.rst:2384 +#: library/turtle.rst:2525 msgid "a polygon, i.e. a tuple of pairs of numbers" msgstr "" -#: library/turtle.rst:2385 +#: library/turtle.rst:2526 msgid "a color the *poly* will be filled with" msgstr "" -#: library/turtle.rst:2386 +#: library/turtle.rst:2527 msgid "a color for the poly's outline (if given)" msgstr "" -#: library/turtle.rst:2388 +#: library/turtle.rst:2529 msgid "Example:" msgstr "" -#: library/turtle.rst:2398 +#: library/turtle.rst:2531 +msgid "" +">>> poly = ((0,0),(10,-5),(0,10),(-10,-5))\n" +">>> s = Shape(\"compound\")\n" +">>> s.addcomponent(poly, \"red\", \"blue\")\n" +">>> # ... add more components and then use register_shape()" +msgstr "" + +#: library/turtle.rst:2539 msgid "See :ref:`compoundshapes`." msgstr "" -#: library/turtle.rst:2403 +#: library/turtle.rst:2544 msgid "" "A two-dimensional vector class, used as a helper class for implementing " "turtle graphics. May be useful for turtle graphics programs too. Derived " "from tuple, so a vector is a tuple!" msgstr "" -#: library/turtle.rst:2407 +#: library/turtle.rst:2548 msgid "Provides (for *a*, *b* vectors, *k* number):" msgstr "" -#: library/turtle.rst:2409 +#: library/turtle.rst:2550 msgid "``a + b`` vector addition" msgstr "" -#: library/turtle.rst:2410 +#: library/turtle.rst:2551 msgid "``a - b`` vector subtraction" msgstr "" -#: library/turtle.rst:2411 +#: library/turtle.rst:2552 msgid "``a * b`` inner product" msgstr "" -#: library/turtle.rst:2412 +#: library/turtle.rst:2553 msgid "``k * a`` and ``a * k`` multiplication with scalar" msgstr "" -#: library/turtle.rst:2413 +#: library/turtle.rst:2554 msgid "``abs(a)`` absolute value of a" msgstr "" -#: library/turtle.rst:2414 +#: library/turtle.rst:2555 msgid "``a.rotate(angle)`` rotation" msgstr "" -#: library/turtle.rst:2420 +#: library/turtle.rst:2561 msgid "Explanation" msgstr "" -#: library/turtle.rst:2422 +#: library/turtle.rst:2563 msgid "" "A turtle object draws on a screen object, and there a number of key classes " "in the turtle object-oriented interface that can be used to create them and " "relate them to each other." msgstr "" -#: library/turtle.rst:2426 +#: library/turtle.rst:2567 msgid "" "A :class:`Turtle` instance will automatically create a :class:`Screen` " "instance if one is not already present." msgstr "" -#: library/turtle.rst:2429 +#: library/turtle.rst:2570 msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " @@ -2263,7 +3295,7 @@ msgid "" "`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" -#: library/turtle.rst:2435 +#: library/turtle.rst:2576 msgid "" ":class:`TurtleScreen` is the basic drawing surface for a turtle. :class:" "`Screen` is a subclass of ``TurtleScreen``, and includes :ref:`some " @@ -2272,7 +3304,7 @@ msgid "" "`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." msgstr "" -#: library/turtle.rst:2442 +#: library/turtle.rst:2583 msgid "" "The functional interface for turtle graphics uses the various methods of " "``Turtle`` and ``TurtleScreen``/``Screen``. Behind the scenes, a screen " @@ -2281,65 +3313,131 @@ msgid "" "created whenever any of the functions derived from a Turtle method is called." msgstr "" -#: library/turtle.rst:2448 +#: library/turtle.rst:2589 msgid "" "To use multiple turtles on a screen, the object-oriented interface must be " "used." msgstr "" -#: library/turtle.rst:2453 +#: library/turtle.rst:2594 msgid "Help and configuration" msgstr "" -#: library/turtle.rst:2456 +#: library/turtle.rst:2597 msgid "How to use help" msgstr "" -#: library/turtle.rst:2458 +#: library/turtle.rst:2599 msgid "" "The public methods of the Screen and Turtle classes are documented " "extensively via docstrings. So these can be used as online-help via the " "Python help facilities:" msgstr "" -#: library/turtle.rst:2462 +#: library/turtle.rst:2603 msgid "" "When using IDLE, tooltips show the signatures and first lines of the " "docstrings of typed in function-/method calls." msgstr "" -#: library/turtle.rst:2465 +#: library/turtle.rst:2606 msgid "Calling :func:`help` on methods or functions displays the docstrings::" msgstr "" -#: library/turtle.rst:2496 +#: library/turtle.rst:2608 +msgid "" +">>> help(Screen.bgcolor)\n" +"Help on method bgcolor in module turtle:\n" +"\n" +"bgcolor(self, *args) unbound turtle.Screen method\n" +" Set or return backgroundcolor of the TurtleScreen.\n" +"\n" +" Arguments (if given): a color string or three numbers\n" +" in the range 0..colormode or a 3-tuple of such numbers.\n" +"\n" +"\n" +" >>> screen.bgcolor(\"orange\")\n" +" >>> screen.bgcolor()\n" +" \"orange\"\n" +" >>> screen.bgcolor(0.5,0,0.5)\n" +" >>> screen.bgcolor()\n" +" \"#800080\"\n" +"\n" +">>> help(Turtle.penup)\n" +"Help on method penup in module turtle:\n" +"\n" +"penup(self) unbound turtle.Turtle method\n" +" Pull the pen up -- no drawing when moving.\n" +"\n" +" Aliases: penup | pu | up\n" +"\n" +" No argument\n" +"\n" +" >>> turtle.penup()" +msgstr "" + +#: library/turtle.rst:2637 msgid "" "The docstrings of the functions which are derived from methods have a " "modified form::" msgstr "" -#: library/turtle.rst:2530 +#: library/turtle.rst:2640 +msgid "" +">>> help(bgcolor)\n" +"Help on function bgcolor in module turtle:\n" +"\n" +"bgcolor(*args)\n" +" Set or return backgroundcolor of the TurtleScreen.\n" +"\n" +" Arguments (if given): a color string or three numbers\n" +" in the range 0..colormode or a 3-tuple of such numbers.\n" +"\n" +" Example::\n" +"\n" +" >>> bgcolor(\"orange\")\n" +" >>> bgcolor()\n" +" \"orange\"\n" +" >>> bgcolor(0.5,0,0.5)\n" +" >>> bgcolor()\n" +" \"#800080\"\n" +"\n" +">>> help(penup)\n" +"Help on function penup in module turtle:\n" +"\n" +"penup()\n" +" Pull the pen up -- no drawing when moving.\n" +"\n" +" Aliases: penup | pu | up\n" +"\n" +" No argument\n" +"\n" +" Example:\n" +" >>> penup()" +msgstr "" + +#: library/turtle.rst:2671 msgid "" "These modified docstrings are created automatically together with the " "function definitions that are derived from the methods at import time." msgstr "" -#: library/turtle.rst:2535 +#: library/turtle.rst:2676 msgid "Translation of docstrings into different languages" msgstr "" -#: library/turtle.rst:2537 +#: library/turtle.rst:2678 msgid "" "There is a utility to create a dictionary the keys of which are the method " "names and the values of which are the docstrings of the public methods of " "the classes Screen and Turtle." msgstr "" -#: library/turtle.rst:2543 +#: library/turtle.rst:2684 msgid "a string, used as filename" msgstr "" -#: library/turtle.rst:2545 +#: library/turtle.rst:2686 msgid "" "Create and write docstring-dictionary to a Python script with the given " "filename. This function has to be called explicitly (it is not used by the " @@ -2348,37 +3446,37 @@ msgid "" "for translation of the docstrings into different languages." msgstr "" -#: library/turtle.rst:2551 +#: library/turtle.rst:2692 msgid "" "If you (or your students) want to use :mod:`turtle` with online help in your " "native language, you have to translate the docstrings and save the resulting " "file as e.g. :file:`turtle_docstringdict_german.py`." msgstr "" -#: library/turtle.rst:2555 +#: library/turtle.rst:2696 msgid "" "If you have an appropriate entry in your :file:`turtle.cfg` file this " "dictionary will be read in at import time and will replace the original " "English docstrings." msgstr "" -#: library/turtle.rst:2558 +#: library/turtle.rst:2699 msgid "" "At the time of this writing there are docstring dictionaries in German and " "in Italian. (Requests please to glingl@aon.at.)" msgstr "" -#: library/turtle.rst:2564 +#: library/turtle.rst:2705 msgid "How to configure Screen and Turtles" msgstr "" -#: library/turtle.rst:2566 +#: library/turtle.rst:2707 msgid "" "The built-in default configuration mimics the appearance and behaviour of " "the old turtle module in order to retain best possible compatibility with it." msgstr "" -#: library/turtle.rst:2569 +#: library/turtle.rst:2710 msgid "" "If you want to use a different configuration which better reflects the " "features of this module or which better fits to your needs, e.g. for use in " @@ -2387,54 +3485,78 @@ msgid "" "settings." msgstr "" -#: library/turtle.rst:2574 +#: library/turtle.rst:2715 msgid "" "The built in configuration would correspond to the following ``turtle.cfg``:" msgstr "" -#: library/turtle.rst:2599 +#: library/turtle.rst:2717 +msgid "" +"width = 0.5\n" +"height = 0.75\n" +"leftright = None\n" +"topbottom = None\n" +"canvwidth = 400\n" +"canvheight = 300\n" +"mode = standard\n" +"colormode = 1.0\n" +"delay = 10\n" +"undobuffersize = 1000\n" +"shape = classic\n" +"pencolor = black\n" +"fillcolor = black\n" +"resizemode = noresize\n" +"visible = True\n" +"language = english\n" +"exampleturtle = turtle\n" +"examplescreen = screen\n" +"title = Python Turtle Graphics\n" +"using_IDLE = False" +msgstr "" + +#: library/turtle.rst:2740 msgid "Short explanation of selected entries:" msgstr "" -#: library/turtle.rst:2601 +#: library/turtle.rst:2742 msgid "" "The first four lines correspond to the arguments of the :func:`Screen.setup " "` method." msgstr "" -#: library/turtle.rst:2603 +#: library/turtle.rst:2744 msgid "" "Line 5 and 6 correspond to the arguments of the method :func:`Screen." "screensize `." msgstr "" -#: library/turtle.rst:2605 +#: library/turtle.rst:2746 msgid "" "*shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For " "more info try ``help(shape)``." msgstr "" -#: library/turtle.rst:2607 +#: library/turtle.rst:2748 msgid "" "If you want to use no fill color (i.e. make the turtle transparent), you " "have to write ``fillcolor = \"\"`` (but all nonempty strings must not have " "quotes in the cfg file)." msgstr "" -#: library/turtle.rst:2610 +#: library/turtle.rst:2751 msgid "" "If you want to reflect the turtle its state, you have to use ``resizemode = " "auto``." msgstr "" -#: library/turtle.rst:2612 +#: library/turtle.rst:2753 msgid "" "If you set e.g. ``language = italian`` the docstringdict :file:" "`turtle_docstringdict_italian.py` will be loaded at import time (if present " "on the import path, e.g. in the same directory as :mod:`turtle`)." msgstr "" -#: library/turtle.rst:2615 +#: library/turtle.rst:2756 msgid "" "The entries *exampleturtle* and *examplescreen* define the names of these " "objects as they occur in the docstrings. The transformation of method-" @@ -2442,301 +3564,311 @@ msgid "" "docstrings." msgstr "" -#: library/turtle.rst:2619 +#: library/turtle.rst:2760 msgid "" "*using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its " "``-n`` switch (\"no subprocess\"). This will prevent :func:`exitonclick` to " "enter the mainloop." msgstr "" -#: library/turtle.rst:2623 +#: library/turtle.rst:2764 msgid "" "There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` " "is stored and an additional one in the current working directory. The " "latter will override the settings of the first one." msgstr "" -#: library/turtle.rst:2627 +#: library/turtle.rst:2768 msgid "" "The :file:`Lib/turtledemo` directory contains a :file:`turtle.cfg` file. " "You can study it as an example and see its effects when running the demos " "(preferably not from within the demo-viewer)." msgstr "" -#: library/turtle.rst:2633 +#: library/turtle.rst:2774 msgid ":mod:`turtledemo` --- Demo scripts" msgstr "" -#: library/turtle.rst:2638 +#: library/turtle.rst:2779 msgid "" "The :mod:`turtledemo` package includes a set of demo scripts. These scripts " "can be run and viewed using the supplied demo viewer as follows::" msgstr "" -#: library/turtle.rst:2643 +#: library/turtle.rst:2782 +msgid "python -m turtledemo" +msgstr "" + +#: library/turtle.rst:2784 msgid "" "Alternatively, you can run the demo scripts individually. For example, ::" msgstr "" -#: library/turtle.rst:2647 +#: library/turtle.rst:2786 +msgid "python -m turtledemo.bytedesign" +msgstr "" + +#: library/turtle.rst:2788 msgid "The :mod:`turtledemo` package directory contains:" msgstr "" -#: library/turtle.rst:2649 +#: library/turtle.rst:2790 msgid "" "A demo viewer :file:`__main__.py` which can be used to view the sourcecode " "of the scripts and run them at the same time." msgstr "" -#: library/turtle.rst:2651 +#: library/turtle.rst:2792 msgid "" "Multiple scripts demonstrating different features of the :mod:`turtle` " "module. Examples can be accessed via the Examples menu. They can also be " "run standalone." msgstr "" -#: library/turtle.rst:2654 +#: library/turtle.rst:2795 msgid "" "A :file:`turtle.cfg` file which serves as an example of how to write and use " "such files." msgstr "" -#: library/turtle.rst:2657 +#: library/turtle.rst:2798 msgid "The demo scripts are:" msgstr "" -#: library/turtle.rst:2664 +#: library/turtle.rst:2805 msgid "Name" msgstr "" -#: library/turtle.rst:2664 +#: library/turtle.rst:2805 msgid "Description" msgstr "" -#: library/turtle.rst:2664 +#: library/turtle.rst:2805 msgid "Features" msgstr "" -#: library/turtle.rst:2666 -msgid "bytedesign" +#: library/turtle.rst:2807 +msgid "``bytedesign``" msgstr "" -#: library/turtle.rst:2666 +#: library/turtle.rst:2807 msgid "complex classical turtle graphics pattern" msgstr "" -#: library/turtle.rst:2666 -msgid ":func:`tracer`, delay, :func:`update`" +#: library/turtle.rst:2807 +msgid ":func:`tracer`, :func:`delay`, :func:`update`" msgstr "" -#: library/turtle.rst:2669 -msgid "chaos" +#: library/turtle.rst:2810 +msgid "``chaos``" msgstr "" -#: library/turtle.rst:2669 +#: library/turtle.rst:2810 msgid "" "graphs Verhulst dynamics, shows that computer's computations can generate " "results sometimes against the common sense expectations" msgstr "" -#: library/turtle.rst:2669 +#: library/turtle.rst:2810 msgid "world coordinates" msgstr "" -#: library/turtle.rst:2675 -msgid "clock" +#: library/turtle.rst:2816 +msgid "``clock``" msgstr "" -#: library/turtle.rst:2675 +#: library/turtle.rst:2816 msgid "analog clock showing time of your computer" msgstr "" -#: library/turtle.rst:2675 -msgid "turtles as clock's hands, ontimer" +#: library/turtle.rst:2816 +msgid "turtles as clock's hands, :func:`ontimer`" msgstr "" -#: library/turtle.rst:2678 -msgid "colormixer" +#: library/turtle.rst:2819 +msgid "``colormixer``" msgstr "" -#: library/turtle.rst:2678 +#: library/turtle.rst:2819 msgid "experiment with r, g, b" msgstr "" -#: library/turtle.rst:2680 -msgid "forest" +#: library/turtle.rst:2821 +msgid "``forest``" msgstr "" -#: library/turtle.rst:2680 +#: library/turtle.rst:2821 msgid "3 breadth-first trees" msgstr "" -#: library/turtle.rst:2680 +#: library/turtle.rst:2821 msgid "randomization" msgstr "" -#: library/turtle.rst:2682 -msgid "fractalcurves" +#: library/turtle.rst:2823 +msgid "``fractalcurves``" msgstr "" -#: library/turtle.rst:2682 +#: library/turtle.rst:2823 msgid "Hilbert & Koch curves" msgstr "" -#: library/turtle.rst:2682 +#: library/turtle.rst:2823 msgid "recursion" msgstr "" -#: library/turtle.rst:2684 -msgid "lindenmayer" +#: library/turtle.rst:2825 +msgid "``lindenmayer``" msgstr "" -#: library/turtle.rst:2684 +#: library/turtle.rst:2825 msgid "ethnomathematics (indian kolams)" msgstr "" -#: library/turtle.rst:2684 +#: library/turtle.rst:2825 msgid "L-System" msgstr "" -#: library/turtle.rst:2687 -msgid "minimal_hanoi" +#: library/turtle.rst:2828 +msgid "``minimal_hanoi``" msgstr "" -#: library/turtle.rst:2687 +#: library/turtle.rst:2828 msgid "Towers of Hanoi" msgstr "" -#: library/turtle.rst:2687 -msgid "Rectangular Turtles as Hanoi discs (shape, shapesize)" +#: library/turtle.rst:2828 +msgid "Rectangular Turtles as Hanoi discs (:func:`shape`, :func:`shapesize`)" msgstr "" -#: library/turtle.rst:2691 -msgid "nim" +#: library/turtle.rst:2832 +msgid "``nim``" msgstr "" -#: library/turtle.rst:2691 +#: library/turtle.rst:2832 msgid "" "play the classical nim game with three heaps of sticks against the computer." msgstr "" -#: library/turtle.rst:2691 +#: library/turtle.rst:2832 msgid "turtles as nimsticks, event driven (mouse, keyboard)" msgstr "" -#: library/turtle.rst:2695 -msgid "paint" +#: library/turtle.rst:2836 +msgid "``paint``" msgstr "" -#: library/turtle.rst:2695 +#: library/turtle.rst:2836 msgid "super minimalistic drawing program" msgstr "" -#: library/turtle.rst:2698 -msgid "peace" +#: library/turtle.rst:2839 +msgid "``peace``" msgstr "" -#: library/turtle.rst:2698 +#: library/turtle.rst:2839 msgid "elementary" msgstr "" -#: library/turtle.rst:2698 +#: library/turtle.rst:2839 msgid "turtle: appearance and animation" msgstr "" -#: library/turtle.rst:2701 -msgid "penrose" +#: library/turtle.rst:2842 +msgid "``penrose``" msgstr "" -#: library/turtle.rst:2701 +#: library/turtle.rst:2842 msgid "aperiodic tiling with kites and darts" msgstr "" -#: library/turtle.rst:2704 -msgid "planet_and_moon" +#: library/turtle.rst:2845 +msgid "``planet_and_moon``" msgstr "" -#: library/turtle.rst:2704 +#: library/turtle.rst:2845 msgid "simulation of gravitational system" msgstr "" -#: library/turtle.rst:2704 +#: library/turtle.rst:2845 msgid "compound shapes, :class:`Vec2D`" msgstr "" -#: library/turtle.rst:2707 -msgid "rosette" +#: library/turtle.rst:2848 +msgid "``rosette``" msgstr "" -#: library/turtle.rst:2707 +#: library/turtle.rst:2848 msgid "a pattern from the wikipedia article on turtle graphics" msgstr "" -#: library/turtle.rst:2707 +#: library/turtle.rst:2848 msgid ":func:`clone`, :func:`undo`" msgstr "" -#: library/turtle.rst:2710 -msgid "round_dance" +#: library/turtle.rst:2851 +msgid "``round_dance``" msgstr "" -#: library/turtle.rst:2710 +#: library/turtle.rst:2851 msgid "dancing turtles rotating pairwise in opposite direction" msgstr "" -#: library/turtle.rst:2710 -msgid "compound shapes, clone shapesize, tilt, get_shapepoly, update" +#: library/turtle.rst:2851 +msgid "" +"compound shapes, :func:`clone` :func:`shapesize`, :func:`tilt`, :func:" +"`get_shapepoly`, :func:`update`" msgstr "" -#: library/turtle.rst:2714 -msgid "sorting_animate" +#: library/turtle.rst:2855 +msgid "``sorting_animate``" msgstr "" -#: library/turtle.rst:2714 +#: library/turtle.rst:2855 msgid "visual demonstration of different sorting methods" msgstr "" -#: library/turtle.rst:2714 +#: library/turtle.rst:2855 msgid "simple alignment, randomization" msgstr "" -#: library/turtle.rst:2717 -msgid "tree" +#: library/turtle.rst:2858 +msgid "``tree``" msgstr "" -#: library/turtle.rst:2717 +#: library/turtle.rst:2858 msgid "a (graphical) breadth first tree (using generators)" msgstr "" -#: library/turtle.rst:2720 -msgid "two_canvases" +#: library/turtle.rst:2861 +msgid "``two_canvases``" msgstr "" -#: library/turtle.rst:2720 +#: library/turtle.rst:2861 msgid "simple design" msgstr "" -#: library/turtle.rst:2720 +#: library/turtle.rst:2861 msgid "turtles on two canvases" msgstr "" -#: library/turtle.rst:2723 -msgid "yinyang" +#: library/turtle.rst:2864 +msgid "``yinyang``" msgstr "" -#: library/turtle.rst:2723 +#: library/turtle.rst:2864 msgid "another elementary example" msgstr "" -#: library/turtle.rst:2726 +#: library/turtle.rst:2867 msgid "Have fun!" msgstr "" -#: library/turtle.rst:2730 +#: library/turtle.rst:2871 msgid "Changes since Python 2.6" msgstr "" -#: library/turtle.rst:2732 +#: library/turtle.rst:2873 msgid "" "The methods :func:`Turtle.tracer `, :func:`Turtle.window_width " "` and :func:`Turtle.window_height ` have been " @@ -2747,14 +3879,14 @@ msgid "" "methods.)" msgstr "" -#: library/turtle.rst:2740 +#: library/turtle.rst:2881 msgid "" "The method :func:`!Turtle.fill` has been eliminated. The behaviour of :func:" "`begin_fill` and :func:`end_fill` have changed slightly: now every filling " "process must be completed with an ``end_fill()`` call." msgstr "" -#: library/turtle.rst:2745 +#: library/turtle.rst:2886 msgid "" "A method :func:`Turtle.filling ` has been added. It returns a " "boolean value: ``True`` if a filling process is under way, ``False`` " @@ -2762,42 +3894,36 @@ msgid "" "in Python 2.6." msgstr "" -#: library/turtle.rst:2751 +#: library/turtle.rst:2892 msgid "Changes since Python 3.0" msgstr "" -#: library/turtle.rst:2753 +#: library/turtle.rst:2894 msgid "" "The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and :" "func:`get_shapepoly` have been added. Thus the full range of regular linear " "transforms is now available for transforming turtle shapes. :func:" "`tiltangle` has been enhanced in functionality: it now can be used to get or " -"set the tilt angle. :func:`settiltangle` has been deprecated." +"set the tilt angle." msgstr "" -#: library/turtle.rst:2760 +#: library/turtle.rst:2900 msgid "" "The :class:`Screen` method :func:`onkeypress` has been added as a complement " "to :func:`onkey`. As the latter binds actions to the key release event, an " "alias: :func:`onkeyrelease` was also added for it." msgstr "" -#: library/turtle.rst:2764 +#: library/turtle.rst:2904 msgid "" "The method :func:`Screen.mainloop ` has been added, so there is no " "longer a need to use the standalone :func:`mainloop` function when working " "with :class:`Screen` and :class:`Turtle` objects." msgstr "" -#: library/turtle.rst:2768 +#: library/turtle.rst:2908 msgid "" "Two input methods have been added: :func:`Screen.textinput ` and :" "func:`Screen.numinput `. These pop up input dialogs and return " "strings and numbers respectively." msgstr "" - -#: library/turtle.rst:2772 -msgid "" -"Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py` " -"have been added to the :file:`Lib/turtledemo` directory." -msgstr "" diff --git a/library/types.po b/library/types.po index 520744f2..22a7cfdd 100644 --- a/library/types.po +++ b/library/types.po @@ -8,27 +8,32 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-22 18:56+0300\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/types.rst:2 -msgid ":mod:`types` --- Dynamic type creation and names for built-in types" +msgid ":mod:`!types` --- Dynamic type creation and names for built-in types" msgstr "" +":mod:`!types` --- Δημιουργία δυναμικών τύπων και ονόματα για ενσωματωμένους " +"τύπους" #: library/types.rst:7 msgid "**Source code:** :source:`Lib/types.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/types.py`" #: library/types.rst:11 msgid "" "This module defines utility functions to assist in dynamic creation of new " "types." msgstr "" +"Αυτό το module ορίζει συναρτήσεις βοηθητικού προγράμματος για να διευκολύνει " +"τη δυναμική δημιουργία νέων τύπων." #: library/types.rst:14 msgid "" @@ -36,20 +41,27 @@ msgid "" "Python interpreter, but not exposed as builtins like :class:`int` or :class:" "`str` are." msgstr "" +"Ορίζει επίσης ονόματα για κάποιους τύπους αντικειμένων που χρησιμοποιούνται " +"από τον τυπικό διερμηνέα Python, αλλά δεν εκτίθενται ως ενσωματωμένα όπως " +"οι :class:`int` ή :class:`str`." #: library/types.rst:18 msgid "" "Finally, it provides some additional type-related utility classes and " "functions that are not fundamental enough to be builtins." msgstr "" +"Τέλος, παρέχει κάποιες πρόσθετες κλάσεις και συναρτήσεις σχετικές με τους " +"τύπους που δεν είναι αρκετά θεμελιώδεις ώστε να είναι ενσωματωμένες." #: library/types.rst:23 msgid "Dynamic Type Creation" -msgstr "" +msgstr "Δημιουργία Δυναμικών Τύπων" #: library/types.rst:27 msgid "Creates a class object dynamically using the appropriate metaclass." msgstr "" +"Δημιουργεί ένα αντικείμενο κλάσης δυναμικά χρησιμοποιώντας την κατάλληλη " +"μετακλάση." #: library/types.rst:29 msgid "" @@ -57,6 +69,9 @@ msgid "" "header: the class name, the base classes (in order), the keyword arguments " "(such as ``metaclass``)." msgstr "" +"Τα τρία πρώτα ορίσματα είναι τα στοιχεία που αποτελούν την επικεφαλίδα του " +"ορισμού κλάσης: το όνομα της κλάσης, οι βάσεις κλάσης (με τη σειρά), τα " +"ορίσματα λέξεων-κλειδιών (όπως ``metaclass``)." #: library/types.rst:33 msgid "" @@ -66,10 +81,16 @@ msgid "" "callback is provided, it has the same effect as passing in ``lambda ns: " "None``." msgstr "" +"Το όρισμα *exec_body* είναι μια συνάρτηση που χρησιμοποιείται για να γεμίσει " +"το φρέσκο δημιουργημένο namespace κλάσης. Πρέπει να δέχεται το namespace της " +"κλάσης ως μοναδικό όρισμα και να ενημερώνει άμεσα το namespace με τα " +"περιεχόμενα της κλάσης. Αν δεν παρέχεται καμία συνάρτηση, έχει το ίδιο " +"αποτέλεσμα με την παράδοση ``lambda ns: None``." #: library/types.rst:43 msgid "Calculates the appropriate metaclass and creates the class namespace." msgstr "" +"Υπολογίζει την κατάλληλη μετακλάση και δημιουργεί το namespace της κλάσης." #: library/types.rst:45 msgid "" @@ -77,10 +98,14 @@ msgid "" "class name, the base classes (in order) and the keyword arguments (such as " "``metaclass``)." msgstr "" +"Τα ορίσματα είναι τα στοιχεία που αποτελούν την επικεφαλίδα του ορισμού " +"κλάσης: το όνομα της κλάσης, οι βάσεις κλάσης (με τη σειρά) και τα ορίσματα " +"λέξεων-κλειδιών (όπως ``metaclass``)." #: library/types.rst:49 msgid "The return value is a 3-tuple: ``metaclass, namespace, kwds``" msgstr "" +"Η επιστρεφόμενη τιμή είναι μια 3-πλειάδα: ``metaclass, namespace, kwds``" #: library/types.rst:51 msgid "" @@ -89,6 +114,10 @@ msgid "" "with any ``'metaclass'`` entry removed. If no *kwds* argument is passed in, " "this will be an empty dict." msgstr "" +"*metaclass* είναι η κατάλληλη μετακλάση, *namespace* είναι το προετοιμασμένο " +"namespace κλάσης και *kwds* είναι μια ενημερωμένη αντιγραφή του περασμένου " +"ορίσματος *kwds* με οποιαδήποτε είσοδο ``'metaclass'`` αφαιρεθεί. Αν δεν " +"περαστεί κανένα όρισμα *kwds*, αυτό θα είναι ένα κενό dict." #: library/types.rst:60 msgid "" @@ -96,26 +125,32 @@ msgid "" "changed. Now an insertion-order-preserving mapping is used when the " "metaclass does not have a ``__prepare__`` method." msgstr "" +"Η προεπιλεγμένη τιμή για το στοιχείο ``namespace`` της επιστρεφόμενης " +"πλειάδας έχει αλλάξει. Τώρα χρησιμοποιείται μια χαρτογράφηση που διατηρεί τη " +"σειρά εισαγωγής όταν η μετακλάση δεν έχει μέθοδο ``__prepare__``." -#: library/types.rst:67 +#: library/types.rst:66 msgid ":ref:`metaclasses`" -msgstr "" +msgstr ":ref:`metaclasses`" #: library/types.rst:67 msgid "Full details of the class creation process supported by these functions" msgstr "" +"Πλήρεις λεπτομέρειες της διαδικασίας δημιουργίας κλάσης που υποστηρίζεται " +"από αυτές τις συναρτήσεις" #: library/types.rst:69 msgid ":pep:`3115` - Metaclasses in Python 3000" -msgstr "" +msgstr ":pep:`3115` - Μετακλάσεις στην Python 3000" #: library/types.rst:70 msgid "Introduced the ``__prepare__`` namespace hook" -msgstr "" +msgstr "Εισήγαγε το hook namespace ``__prepare__``" #: library/types.rst:74 msgid "Resolve MRO entries dynamically as specified by :pep:`560`." msgstr "" +"Επιλύει τις καταχωρήσεις MRO δυναμικά όπως καθορίζεται από την :pep:`560`." #: library/types.rst:76 msgid "" @@ -126,6 +161,13 @@ msgid "" "it doesn't have an :meth:`!__mro_entries__` method, then it is included in " "the return tuple unchanged." msgstr "" +"Αυτή η συνάρτηση αναζητά στοιχεία στις *bases* που δεν είναι στιγμιότυπα " +"της :class:`type`, και επιστρέφει μια πλειάδα όπου κάθε τέτοιο αντικείμενο " +"που έχει μια μέθοδο :meth:`~object.__mro_entries__` αντικαθίσταται με ένα " +"αποσυσκευασμένο αποτέλεσμα της κλήσης αυτής της μεθόδου. Αν ένα στοιχείο " +"*bases* είναι στιγμιότυπο της :class:`type`, ή δεν έχει μια μέθοδο :meth:`!" +"__mro_entries__`, τότε περιλαμβάνεται στην επιστρεφόμενη πλειάδα χωρίς " +"αλλαγές." #: library/types.rst:87 msgid "" @@ -134,25 +176,85 @@ msgid "" "(following the mechanisms laid out in :pep:`560`). This is useful for " "introspecting :ref:`Generics `." msgstr "" +"Επιστρέφει την πλειάδα αντικειμένων που δόθηκαν αρχικά ως βάσεις του *cls* " +"πριν κληθεί η μέθοδος :meth:`~object.__mro_entries__` σε οποιαδήποτε βάση " +"(ακολουθώντας τους μηχανισμούς που καθορίζονται στην :pep:`560`). Αυτό είναι " +"χρήσιμο για την ανάλυση των :ref:`Generics `." #: library/types.rst:92 msgid "" "For classes that have an ``__orig_bases__`` attribute, this function returns " "the value of ``cls.__orig_bases__``. For classes without the " -"``__orig_bases__`` attribute, ``cls.__bases__`` is returned." +"``__orig_bases__`` attribute, :attr:`cls.__bases__ ` is " +"returned." msgstr "" +"Για κλάσεις που έχουν ένα χαρακτηριστικό ``__orig_bases__``, αυτή η " +"συνάρτηση επιστρέφει την τιμή του ``cls.__orig_bases__``. Για κλάσεις χωρίς " +"το χαρακτηριστικό ``__orig_bases__``, επιστρέφεται :attr:`cls.__bases__ " +"`." #: library/types.rst:97 msgid "Examples::" -msgstr "" +msgstr "Παραδείγματα::" + +#: library/types.rst:99 +msgid "" +"from typing import TypeVar, Generic, NamedTuple, TypedDict\n" +"\n" +"T = TypeVar(\"T\")\n" +"class Foo(Generic[T]): ...\n" +"class Bar(Foo[int], float): ...\n" +"class Baz(list[str]): ...\n" +"Eggs = NamedTuple(\"Eggs\", [(\"a\", int), (\"b\", str)])\n" +"Spam = TypedDict(\"Spam\", {\"a\": int, \"b\": str})\n" +"\n" +"assert Bar.__bases__ == (Foo, float)\n" +"assert get_original_bases(Bar) == (Foo[int], float)\n" +"\n" +"assert Baz.__bases__ == (list,)\n" +"assert get_original_bases(Baz) == (list[str],)\n" +"\n" +"assert Eggs.__bases__ == (tuple,)\n" +"assert get_original_bases(Eggs) == (NamedTuple,)\n" +"\n" +"assert Spam.__bases__ == (dict,)\n" +"assert get_original_bases(Spam) == (TypedDict,)\n" +"\n" +"assert int.__bases__ == (object,)\n" +"assert get_original_bases(int) == (object,)" +msgstr "" +"from typing import TypeVar, Generic, NamedTuple, TypedDict\n" +"\n" +"T = TypeVar(\"T\")\n" +"class Foo(Generic[T]): ...\n" +"class Bar(Foo[int], float): ...\n" +"class Baz(list[str]): ...\n" +"Eggs = NamedTuple(\"Eggs\", [(\"a\", int), (\"b\", str)])\n" +"Spam = TypedDict(\"Spam\", {\"a\": int, \"b\": str})\n" +"\n" +"assert Bar.__bases__ == (Foo, float)\n" +"assert get_original_bases(Bar) == (Foo[int], float)\n" +"\n" +"assert Baz.__bases__ == (list,)\n" +"assert get_original_bases(Baz) == (list[str],)\n" +"\n" +"assert Eggs.__bases__ == (tuple,)\n" +"assert get_original_bases(Eggs) == (NamedTuple,)\n" +"\n" +"assert Spam.__bases__ == (dict,)\n" +"assert get_original_bases(Spam) == (TypedDict,)\n" +"\n" +"assert int.__bases__ == (object,)\n" +"assert get_original_bases(int) == (object,)" #: library/types.rst:127 msgid ":pep:`560` - Core support for typing module and generic types" msgstr "" +":pep:`560` - Βασική υποστήριξη για το module typing και γενικούς τύπους" #: library/types.rst:131 msgid "Standard Interpreter Types" -msgstr "" +msgstr "Τυπικοί Τύποι Διερμηνέα" #: library/types.rst:133 msgid "" @@ -161,68 +263,91 @@ msgid "" "types that arise only incidentally during processing such as the " "``listiterator`` type." msgstr "" +"Αυτό το module παρέχει ονόματα για πολλούς από τους τύπους που απαιτούνται " +"για να υλοποιηθεί ένας διερμηνέας Python. Αποφεύγει σκόπιμα να συμπεριλάβει " +"κάποιους από τους τύπους που προκύπτουν μόνο παρεμπιπτόντως κατά τη διάρκεια " +"της επεξεργασίας, όπως ο τύπος ``listiterator``." #: library/types.rst:138 msgid "" "Typical use of these names is for :func:`isinstance` or :func:`issubclass` " "checks." msgstr "" +"Τυπική χρήση αυτών των ονομάτων είναι για ελέγχους :func:`isinstance` ή :" +"func:`issubclass`." #: library/types.rst:142 msgid "" "If you instantiate any of these types, note that signatures may vary between " "Python versions." msgstr "" +"Αν δημιουργήσετε στιγμιότυπα από αυτούς τους τύπους, σημειώστε ότι οι " +"υπογραφές μπορεί να διαφέρουν μεταξύ εκδόσεων Python." #: library/types.rst:144 msgid "Standard names are defined for the following types:" -msgstr "" +msgstr "Τυπικά ονόματα ορίζονται για τους παρακάτω τύπους:" #: library/types.rst:148 msgid "The type of :data:`None`." -msgstr "" +msgstr "Ο τύπος του :data:`None`." #: library/types.rst:156 msgid "" "The type of user-defined functions and functions created by :keyword:" "`lambda` expressions." msgstr "" +"Ο τύπος των συναρτήσεων που ορίζονται από τον χρήστη και των συναρτήσεων που " +"δημιουργούνται από εκφράσεις :keyword:`lambda`." #: library/types.rst:159 msgid "" "Raises an :ref:`auditing event ` ``function.__new__`` with " "argument ``code``." msgstr "" +"Κάνει raise ένα :ref:`auditing event ` ``function.__new__`` με το " +"όρισμα ``code``." #: library/types.rst:161 msgid "" "The audit event only occurs for direct instantiation of function objects, " "and is not raised for normal compilation." msgstr "" +"Το audit event συμβαίνει μόνο για άμεσες δημιουργίες αντικειμένων " +"συναρτήσεων και δεν γίνεται raise κατά τη διάρκεια της κανονικής " +"μεταγλώττισης." #: library/types.rst:167 msgid "" "The type of :term:`generator`-iterator objects, created by generator " "functions." msgstr "" +"Ο τύπος των αντικειμένων :term:`generator`-iterator, που δημιουργούνται από " +"συναρτήσεις γεννητριών." #: library/types.rst:173 msgid "" "The type of :term:`coroutine` objects, created by :keyword:`async def` " "functions." msgstr "" +"Ο τύπος των αντικειμένων :term:`coroutine`, που δημιουργούνται από " +"συναρτήσεις :keyword:`async def`." #: library/types.rst:181 msgid "" "The type of :term:`asynchronous generator`-iterator objects, created by " "asynchronous generator functions." msgstr "" +"Ο τύπος των αντικειμένων :term:`asynchronous generator`-iterator, που " +"δημιουργούνται από ασύγχρονες συναρτήσεις γεννητριών." #: library/types.rst:191 msgid "" "The type of :ref:`code objects ` such as returned by :func:" "`compile`." msgstr "" +"Ο τύπος των :ref:`code objects ` όπως επιστρέφεται από τη :" +"func:`compile`." #: library/types.rst:193 msgid "" @@ -230,6 +355,10 @@ msgid "" "``code``, ``filename``, ``name``, ``argcount``, ``posonlyargcount``, " "``kwonlyargcount``, ``nlocals``, ``stacksize``, ``flags``." msgstr "" +"Κάνει raise ένα :ref:`auditing event ` ``code.__new__`` με τα " +"ορίσματα ``code``, ``filename``, ``name``, ``argcount``, " +"``posonlyargcount``, ``kwonlyargcount``, ``nlocals``, ``stacksize``, " +"``flags``." #: library/types.rst:195 msgid "" @@ -237,16 +366,23 @@ msgid "" "required by the initializer. The audit event only occurs for direct " "instantiation of code objects, and is not raised for normal compilation." msgstr "" +"Σημειώστε ότι τα ελεγχόμενα ορίσματα μπορεί να μην ταιριάζουν με τα ονόματα " +"ή τις θέσεις που απαιτούνται από τον αρχικοποιητή. Το audit event συμβαίνει " +"μόνο για άμεσες δημιουργίες αντικειμένων κώδικα και δεν γίνεται raise κατά " +"τη διάρκεια της κανονικής μεταγλώττισης." #: library/types.rst:201 msgid "" "The type for cell objects: such objects are used as containers for a " -"function's free variables." +"function's :term:`closure variables `." msgstr "" +"Ο τύπος για τα αντικείμενα κελιών: τέτοια αντικείμενα χρησιμοποιούνται ως " +"δοχεία για τις :term:`closure variables ` μιας συνάρτησης." #: library/types.rst:209 msgid "The type of methods of user-defined class instances." msgstr "" +"Ο τύπος των μεθόδων των στιγμιοτύπων κλάσεων που ορίζονται από τον χρήστη." #: library/types.rst:215 msgid "" @@ -254,167 +390,179 @@ msgid "" "methods of built-in classes. (Here, the term \"built-in\" means \"written " "in C\".)" msgstr "" +"Ο τύπος των ενσωματωμένων συναρτήσεων όπως :func:`len` ή :func:`sys.exit`, " +"και μεθόδων ενσωματωμένων κλάσεων. (Εδώ, ο όρος \"built-in\" σημαίνει " +"\"γραμμένος σε C\".)" #: library/types.rst:222 msgid "" "The type of methods of some built-in data types and base classes such as :" "meth:`object.__init__` or :meth:`object.__lt__`." msgstr "" +"Ο τύπος των μεθόδων κάποιων ενσωματωμένων τύπων δεδομένων και βάσεων κλάσεων " +"όπως :meth:`object.__init__` ή :meth:`object.__lt__`." #: library/types.rst:230 msgid "" "The type of *bound* methods of some built-in data types and base classes. " "For example it is the type of :code:`object().__str__`." msgstr "" +"Ο τύπος των *bound* μεθόδων κάποιων ενσωματωμένων τύπων δεδομένων και βάσεων " +"κλάσεων. Για παράδειγμα είναι ο τύπος του :code:`object().__str__`." #: library/types.rst:238 msgid "The type of :data:`NotImplemented`." -msgstr "" +msgstr "Ο τύπος του :data:`NotImplemented`." #: library/types.rst:245 msgid "" "The type of methods of some built-in data types such as :meth:`str.join`." msgstr "" +"Ο τύπος των μεθόδων κάποιων ενσωματωμένων τύπων δεδομένων όπως :meth:`str." +"join`." #: library/types.rst:252 msgid "" "The type of *unbound* class methods of some built-in data types such as " "``dict.__dict__['fromkeys']``." msgstr "" +"Ο τύπος των *unbound* μεθόδων κλάσης κάποιων ενσωματωμένων τύπων δεδομένων " +"όπως ``dict.__dict__['fromkeys']``." #: library/types.rst:260 msgid "" "The type of :term:`modules `. The constructor takes the name of the " "module to be created and optionally its :term:`docstring`." msgstr "" +"Ο τύπος των :term:`modules `. Ο κατασκευαστής δέχεται το όνομα του " +"module που θα δημιουργηθεί και προαιρετικά την :term:`docstring` του." -#: library/types.rst:264 -msgid "" -"Use :func:`importlib.util.module_from_spec` to create a new module if you " -"wish to set the various import-controlled attributes." -msgstr "" - -#: library/types.rst:269 -msgid "The :term:`docstring` of the module. Defaults to ``None``." -msgstr "" - -#: library/types.rst:273 -msgid "The :term:`loader` which loaded the module. Defaults to ``None``." -msgstr "" - -#: library/types.rst:275 -msgid "" -"This attribute is to match :attr:`importlib.machinery.ModuleSpec.loader` as " -"stored in the :attr:`__spec__` object." -msgstr "" - -#: library/types.rst:279 -msgid "" -"A future version of Python may stop setting this attribute by default. To " -"guard against this potential change, preferably read from the :attr:" -"`__spec__` attribute instead or use ``getattr(module, \"__loader__\", " -"None)`` if you explicitly need to use this attribute." -msgstr "" - -#: library/types.rst:310 -msgid "Defaults to ``None``. Previously the attribute was optional." -msgstr "" +#: library/types.rst:265 +msgid ":ref:`Documentation on module objects `" +msgstr ":ref:`Documentation on module objects `" -#: library/types.rst:290 +#: library/types.rst:266 msgid "" -"The name of the module. Expected to match :attr:`importlib.machinery." -"ModuleSpec.name`." +"Provides details on the special attributes that can be found on instances " +"of :class:`!ModuleType`." msgstr "" +"Παρέχει λεπτομέρειες για τα ειδικά χαρακτηριστικά που μπορούν να βρεθούν σε " +"στιγμιότυπα της :class:`!ModuleType`." -#: library/types.rst:295 -msgid "" -"Which :term:`package` a module belongs to. If the module is top-level (i.e. " -"not a part of any specific package) then the attribute should be set to " -"``''``, else it should be set to the name of the package (which can be :attr:" -"`__name__` if the module is a package itself). Defaults to ``None``." -msgstr "" - -#: library/types.rst:300 -msgid "" -"This attribute is to match :attr:`importlib.machinery.ModuleSpec.parent` as " -"stored in the :attr:`__spec__` object." -msgstr "" - -#: library/types.rst:304 -msgid "" -"A future version of Python may stop setting this attribute by default. To " -"guard against this potential change, preferably read from the :attr:" -"`__spec__` attribute instead or use ``getattr(module, \"__package__\", " -"None)`` if you explicitly need to use this attribute." -msgstr "" +#: library/types.rst:269 +msgid ":func:`importlib.util.module_from_spec`" +msgstr ":func:`importlib.util.module_from_spec`" -#: library/types.rst:315 +#: library/types.rst:270 msgid "" -"A record of the module's import-system-related state. Expected to be an " -"instance of :class:`importlib.machinery.ModuleSpec`." +"Modules created using the :class:`!ModuleType` constructor are created with " +"many of their special attributes unset or set to default values. :func:`!" +"module_from_spec` provides a more robust way of creating :class:`!" +"ModuleType` instances which ensures the various attributes are set " +"appropriately." msgstr "" +"Τα modules που δημιουργούνται χρησιμοποιώντας τον κατασκευαστή :class:`!" +"ModuleType` δημιουργούνται με πολλά από τα ειδικά χαρακτηριστικά τους μη " +"ρυθμισμένα ή ρυθμισμένα σε προεπιλεγμένες τιμές. Η :func:`!module_from_spec` " +"παρέχει έναν πιο ανθεκτικό τρόπο δημιουργίας στιγμιοτύπων :class:`!" +"ModuleType` που διασφαλίζει ότι τα διάφορα χαρακτηριστικά είναι ρυθμισμένα " +"κατάλληλα." -#: library/types.rst:323 +#: library/types.rst:278 msgid "The type of :data:`Ellipsis`." -msgstr "" +msgstr "Ο τύπος του :data:`Ellipsis`." -#: library/types.rst:329 +#: library/types.rst:284 msgid "" "The type of :ref:`parameterized generics ` such as " "``list[int]``." msgstr "" +"O τύπος των :ref:`parameterized generics ` όπως το " +"``list[int]``." -#: library/types.rst:332 +#: library/types.rst:287 msgid "" "``t_origin`` should be a non-parameterized generic class, such as ``list``, " "``tuple`` or ``dict``. ``t_args`` should be a :class:`tuple` (possibly of " "length 1) of types which parameterize ``t_origin``::" msgstr "" +"``t_origin`` θα πρέπει να είναι μια μη παραμετροποιημένη γενική κλάση, όπως " +"``list``, ``tuple`` ή ``dict``. ``t_args`` θα πρέπει να είναι μια :class:" +"`tuple` (πιθανώς μήκους 1) τύπων που παραμετροποιούν το ``t_origin``::" -#: library/types.rst:345 -msgid "This type can now be subclassed." +#: library/types.rst:291 +msgid "" +">>> from types import GenericAlias\n" +"\n" +">>> list[int] == GenericAlias(list, (int,))\n" +"True\n" +">>> dict[str, int] == GenericAlias(dict, (str, int))\n" +"True" msgstr "" +">>> from types import GenericAlias\n" +"\n" +">>> list[int] == GenericAlias(list, (int,))\n" +"True\n" +">>> dict[str, int] == GenericAlias(dict, (str, int))\n" +"True" -#: library/types.rst:351 +#: library/types.rst:300 +msgid "This type can now be subclassed." +msgstr "Αυτός ο τύπος μπορεί πλέον να κληρονομείται." + +#: library/types.rst:305 msgid ":ref:`Generic Alias Types`" -msgstr "" +msgstr ":ref:`Generic Alias Types`" -#: library/types.rst:351 +#: library/types.rst:306 msgid "In-depth documentation on instances of :class:`!types.GenericAlias`" msgstr "" +"Λεπτομερής τεκμηρίωση για τα στιγμιότυπα της :class:`!types.GenericAlias`" -#: library/types.rst:353 +#: library/types.rst:308 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" -msgstr "" +msgstr ":pep:`585` - Υποδείξεις τύπου Generics σε τυπικές συλλογές" -#: library/types.rst:354 +#: library/types.rst:309 msgid "Introducing the :class:`!types.GenericAlias` class" -msgstr "" +msgstr "Εισαγωγή στην κλάση :class:`!types.GenericAlias`" -#: library/types.rst:358 +#: library/types.rst:313 msgid "The type of :ref:`union type expressions`." -msgstr "" +msgstr "Ο τύπος των :ref:`union type expressions`." + +#: library/types.rst:319 +msgid "This is now an alias for :class:`typing.Union`." +msgstr "Αυτό είναι τώρα ένα ψευδώνυμο για την κλάση :class:`typing.Union`." -#: library/types.rst:364 +#: library/types.rst:323 msgid "" "The type of traceback objects such as found in ``sys.exception()." "__traceback__``." msgstr "" +"Ο τύπος των αντικειμένων traceback όπως αυτά που βρίσκονται στο ``sys." +"exception().__traceback__``." -#: library/types.rst:366 +#: library/types.rst:325 msgid "" "See :ref:`the language reference ` for details of the " "available attributes and operations, and guidance on creating tracebacks " "dynamically." msgstr "" +"Δείτε :ref:`the language reference ` για λεπτομέρειες " +"σχετικά με τα διαθέσιμα χαρακτηριστικά και τις λειτουργίες, καθώς και " +"οδηγίες για τη δυναμική δημιουργία tracebacks." -#: library/types.rst:373 +#: library/types.rst:332 msgid "" "The type of :ref:`frame objects ` such as found in :attr:`tb." "tb_frame ` if ``tb`` is a traceback object." msgstr "" +"Ο τύπος των :ref:`frame objects ` όπως αυτά που βρίσκονται " +"στο :attr:`tb.tb_frame ` αν το ``tb`` είναι ένα " +"αντικείμενο traceback." -#: library/types.rst:379 +#: library/types.rst:338 msgid "" "The type of objects defined in extension modules with ``PyGetSetDef``, such " "as :attr:`FrameType.f_locals ` or ``array.array.typecode``. " @@ -422,8 +570,13 @@ msgid "" "purpose as the :class:`property` type, but for classes defined in extension " "modules." msgstr "" +"Ο τύπος των αντικειμένων που ορίζονται σε επεκτάσιμα modules με " +"``PyGetSetDef``, όπως :attr:`FrameType.f_locals ` ή ``array." +"array.typecode``. Αυτός ο τύπος χρησιμοποιείται ως περιγραφέας για τα " +"χαρακτηριστικά του αντικειμένου. Έχει τον ίδιο σκοπό με τον τύπο :class:" +"`property`, αλλά για κλάσεις που ορίζονται σε επεκτάσιμα modules." -#: library/types.rst:388 +#: library/types.rst:347 msgid "" "The type of objects defined in extension modules with ``PyMemberDef``, such " "as ``datetime.timedelta.days``. This type is used as descriptor for simple " @@ -431,145 +584,260 @@ msgid "" "purpose as the :class:`property` type, but for classes defined in extension " "modules." msgstr "" +"Ο τύπος των αντικειμένων που ορίζονται σε επεκτάσιμα modules με " +"``PyMemberDef``, όπως το ``datetime.timedelta.days``. Αυτός ο τύπος " +"χρησιμοποιείται ως περιγραφέας για απλά μέλη δεδομένων C που χρησιμοποιούν " +"τυπικές συναρτήσεις μετατροπής. Έχει τον ίδιο σκοπό με τον τύπο :class:" +"`property`, αλλά για κλάσεις που ορίζονται σε επεκτάσιμα modules." -#: library/types.rst:393 +#: library/types.rst:352 msgid "" "In addition, when a class is defined with a :attr:`~object.__slots__` " "attribute, then for each slot, an instance of :class:`!MemberDescriptorType` " "will be added as an attribute on the class. This allows the slot to appear " -"in the class's :attr:`~object.__dict__`." +"in the class's :attr:`~type.__dict__`." msgstr "" +"Επιπλέον, όταν μια κλάση ορίζεται με ένα χαρακτηριστικό :attr:`~object." +"__slots__`, τότε για κάθε slot, θα προστεθεί ένα στιγμιότυπο της :class:`!" +"MemberDescriptorType` ως χαρακτηριστικό στην κλάση. Αυτό επιτρέπει στο slot " +"να εμφανίζεται στο :attr:`~type.__dict__` της κλάσης." -#: library/types.rst:399 +#: library/types.rst:358 msgid "" "In other implementations of Python, this type may be identical to " "``GetSetDescriptorType``." msgstr "" +"Σε άλλες υλοποιήσεις της Python, αυτός ο τύπος μπορεί να είναι ταυτόσημος με " +"το ``GetSetDescriptorType``." -#: library/types.rst:404 +#: library/types.rst:363 msgid "" "Read-only proxy of a mapping. It provides a dynamic view on the mapping's " "entries, which means that when the mapping changes, the view reflects these " "changes." msgstr "" +"Read-only αναγνωριστικό για μια αντιστοίχιση. Παρέχει μια δυναμική προβολή " +"στις καταχωρήσεις της αντιστοίχισης, που σημαίνει ότι όταν η αντιστοίχιση " +"αλλάζει, η προβολή αντικατοπτρίζει αυτές τις αλλαγές." -#: library/types.rst:412 +#: library/types.rst:371 msgid "" "Updated to support the new union (``|``) operator from :pep:`584`, which " "simply delegates to the underlying mapping." msgstr "" +"Ενημερώθηκε για να υποστηρίζει τον νέο τελεστή ένωσης (``|``) από την :pep:" +"`584`, ο οποίος απλά αναθέτει στην υποκείμενη αντιστοίχιση." -#: library/types.rst:417 +#: library/types.rst:376 msgid "" "Return ``True`` if the underlying mapping has a key *key*, else ``False``." msgstr "" +"Επιστρέφει ``True`` αν η υποκείμενη αντιστοίχιση έχει το κλειδί *key*, " +"αλλιώς ``False``." -#: library/types.rst:422 +#: library/types.rst:381 msgid "" "Return the item of the underlying mapping with key *key*. Raises a :exc:" "`KeyError` if *key* is not in the underlying mapping." msgstr "" +"Επιστρέφει το στοιχείο της υποκείμενης αντιστοίχισης με το κλειδί *key*. " +"Κάνει raise μια :exc:`KeyError` αν το *key* δεν είναι στην υποκείμενη " +"αντιστοίχιση." -#: library/types.rst:427 +#: library/types.rst:386 msgid "" "Return an iterator over the keys of the underlying mapping. This is a " "shortcut for ``iter(proxy.keys())``." msgstr "" +"Επιστρέφει έναν iterator πάνω από τα κλειδιά της υποκείμενης αντιστοίχισης. " +"Αυτό είναι μια συντόμευση για ``iter(proxy.keys())``." -#: library/types.rst:432 +#: library/types.rst:391 msgid "Return the number of items in the underlying mapping." -msgstr "" +msgstr "Επιστρέφει τον αριθμό των στοιχείων στην υποκείμενη αντιστοίχιση." -#: library/types.rst:436 +#: library/types.rst:395 msgid "Return a shallow copy of the underlying mapping." -msgstr "" +msgstr "Επιστρέφει ένα ρηχό αντίγραφο της υποκείμενης αντιστοίχισης." -#: library/types.rst:440 +#: library/types.rst:399 msgid "" "Return the value for *key* if *key* is in the underlying mapping, else " "*default*. If *default* is not given, it defaults to ``None``, so that this " "method never raises a :exc:`KeyError`." msgstr "" +"Επιστρέφει την τιμή για το *key* αν το *key* είναι στην υποκείμενη " +"αντιστοίχιση, αλλιώς *default*. Αν το *default* δεν δοθεί, προεπιλέγεται σε " +"``None``, έτσι ώστε αυτή η μέθοδος να μην κάνει ποτέ raise μια :exc:" +"`KeyError`." -#: library/types.rst:446 +#: library/types.rst:405 msgid "" "Return a new view of the underlying mapping's items (``(key, value)`` pairs)." msgstr "" +"Επιστρέφει μια νέα προβολή των στοιχείων της υποκείμενης αντιστοίχισης " +"(ζεύγη ``(key, value)``)." -#: library/types.rst:451 +#: library/types.rst:410 msgid "Return a new view of the underlying mapping's keys." -msgstr "" +msgstr "Επιστρέφει μια νέα προβολή των κλειδιών της υποκείμενης αντιστοίχισης." -#: library/types.rst:455 +#: library/types.rst:414 msgid "Return a new view of the underlying mapping's values." -msgstr "" +msgstr "Επιστρέφει μια νέα προβολή των τιμών της υποκείμενης αντιστοίχισης." -#: library/types.rst:459 +#: library/types.rst:418 msgid "Return a reverse iterator over the keys of the underlying mapping." msgstr "" +"Επιστρέφει έναν αντίστροφο iterator πάνω από τα κλειδιά της υποκείμενης " +"αντιστοίχισης." -#: library/types.rst:465 +#: library/types.rst:424 msgid "Return a hash of the underlying mapping." -msgstr "" +msgstr "Επιστρέφει ένα hash της υποκείμενης αντιστοίχισης." + +#: library/types.rst:430 +msgid "The type of :ref:`capsule objects `." +msgstr "Ο τύπος των :ref:`capsule objects `." -#: library/types.rst:471 +#: library/types.rst:436 msgid "Additional Utility Classes and Functions" -msgstr "" +msgstr "Πρόσθετες βοηθητικές κλάσεις και συναρτήσεις" -#: library/types.rst:475 +#: library/types.rst:440 msgid "" "A simple :class:`object` subclass that provides attribute access to its " "namespace, as well as a meaningful repr." msgstr "" +"Απλή υποκλάση :class:`object` που παρέχει πρόσβαση χαρακτηριστικών στο χώρο " +"ονομάτων της, καθώς και μια σημαντική αναπαράσταση." -#: library/types.rst:478 +#: library/types.rst:443 msgid "" -"Unlike :class:`object`, with ``SimpleNamespace`` you can add and remove " -"attributes. If a ``SimpleNamespace`` object is initialized with keyword " -"arguments, those are directly added to the underlying namespace." +"Unlike :class:`object`, with :class:`!SimpleNamespace` you can add and " +"remove attributes." msgstr "" +"Σε αντίθεση με την :class:`object`, με την :class:`!SimpleNamespace` " +"μπορείτε να προσθέσετε και να αφαιρέσετε χαρακτηριστικά." -#: library/types.rst:482 +#: library/types.rst:446 +msgid "" +":py:class:`SimpleNamespace` objects may be initialized in the same way as :" +"class:`dict`: either with keyword arguments, with a single positional " +"argument, or with both. When initialized with keyword arguments, those are " +"directly added to the underlying namespace. Alternatively, when initialized " +"with a positional argument, the underlying namespace will be updated with " +"key-value pairs from that argument (either a mapping object or an :term:" +"`iterable` object producing key-value pairs). All such keys must be strings." +msgstr "" +"Τα αντικείμενα :py:class:`SimpleNamespace` μπορούν να αρχικοποιηθούν με τον " +"ίδιο τρόπο όπως η :class:`dict`: είτε με ονόματα χαρακτηριστικών, είτε με " +"ένα μόνο οριστικό όρισμα, είτε και με τα δύο. Όταν αρχικοποιούνται με " +"ονόματα χαρακτηριστικών, αυτά προστίθενται απευθείας στο υποκείμενο χώρο " +"ονομάτων. Εναλλακτικά, όταν αρχικοποιούνται με ένα οριστικό όρισμα, το " +"υποκείμενο χώρο ονομάτων θα ενημερωθεί με ζεύγη κλειδιού-τιμής από αυτό το " +"όρισμα (είτε ένα αντικείμενο αντιστοίχισης είτε ένα :term:`iterable` " +"αντικείμενο που παράγει ζεύγη κλειδιού-τιμής). Όλα αυτά τα κλειδιά πρέπει να " +"είναι συμβολοσειρές." + +#: library/types.rst:457 msgid "The type is roughly equivalent to the following code::" -msgstr "" +msgstr "Ο τύπος είναι περίπου ισοδύναμος με τον παρακάτω κώδικα::" -#: library/types.rst:497 +#: library/types.rst:459 +msgid "" +"class SimpleNamespace:\n" +" def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" +" self.__dict__.update(mapping_or_iterable)\n" +" self.__dict__.update(kwargs)\n" +"\n" +" def __repr__(self):\n" +" items = (f\"{k}={v!r}\" for k, v in self.__dict__.items())\n" +" return \"{}({})\".format(type(self).__name__, \", \".join(items))\n" +"\n" +" def __eq__(self, other):\n" +" if isinstance(self, SimpleNamespace) and isinstance(other, " +"SimpleNamespace):\n" +" return self.__dict__ == other.__dict__\n" +" return NotImplemented" +msgstr "" +"class SimpleNamespace:\n" +" def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" +" self.__dict__.update(mapping_or_iterable)\n" +" self.__dict__.update(kwargs)\n" +"\n" +" def __repr__(self):\n" +" items = (f\"{k}={v!r}\" for k, v in self.__dict__.items())\n" +" return \"{}({})\".format(type(self).__name__, \", \".join(items))\n" +"\n" +" def __eq__(self, other):\n" +" if isinstance(self, SimpleNamespace) and isinstance(other, " +"SimpleNamespace):\n" +" return self.__dict__ == other.__dict__\n" +" return NotImplemented" + +#: library/types.rst:473 msgid "" "``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``. " "However, for a structured record type use :func:`~collections.namedtuple` " "instead." msgstr "" +"Το ``SimpleNamespace`` μπορεί να είναι χρήσιμο ως αντικατάσταση για το " +"``class NS: pass``. Ωστόσο, για έναν δομημένο τύπο εγγραφής χρησιμοποιήστε :" +"func:`~collections.namedtuple` αντί αυτού." -#: library/types.rst:503 +#: library/types.rst:477 +msgid "" +":class:`!SimpleNamespace` objects are supported by :func:`copy.replace`." +msgstr "" +":class:`!SimpleNamespace` αντικείμενα υποστηρίζονται από την :func:`copy." +"replace`." + +#: library/types.rst:481 msgid "" "Attribute order in the repr changed from alphabetical to insertion (like " "``dict``)." msgstr "" +"Η σειρά των χαρακτηριστικών στην αναπαράσταση άλλαξε από αλφαβητική σε " +"εισαγωγή (όπως το ``dict``)." + +#: library/types.rst:485 +msgid "Added support for an optional positional argument." +msgstr "Προστέθηκε υποστήριξη για ένα προαιρετικό οριστικό όρισμα." -#: library/types.rst:509 +#: library/types.rst:490 msgid "Route attribute access on a class to __getattr__." -msgstr "" +msgstr "Δρομολόγηση πρόσβασης χαρακτηριστικών σε μια κλάση στο __getattr__." -#: library/types.rst:511 +#: library/types.rst:492 msgid "" "This is a descriptor, used to define attributes that act differently when " "accessed through an instance and through a class. Instance access remains " "normal, but access to an attribute through a class will be routed to the " "class's __getattr__ method; this is done by raising AttributeError." msgstr "" +"Αυτός είναι ένας περιγραφέας, που χρησιμοποιείται για τον ορισμό " +"χαρακτηριστικών που δρουν διαφορετικά όταν προσπελάζονται μέσω ενός " +"στιγμιότυπου και μέσω μιας κλάσης. Η πρόσβαση στο στιγμιότυπο παραμένει " +"κανονική, αλλά η πρόσβαση σε ένα χαρακτηριστικό μέσω μιας κλάσης θα " +"δρομολογηθεί στη μέθοδο __getattr__ της κλάσης. Αυτό γίνεται κάνοντας raise " +"ένα AttributeError." -#: library/types.rst:516 +#: library/types.rst:497 msgid "" "This allows one to have properties active on an instance, and have virtual " "attributes on the class with the same name (see :class:`enum.Enum` for an " "example)." msgstr "" +"Αυτό επιτρέπει να έχετε ιδιότητες ενεργές σε ένα στιγμιότυπο και να έχετε " +"εικονικά χαρακτηριστικά στην κλάση με το ίδιο όνομα (βλ. :class:`enum.Enum` " +"για παράδειγμα)." -#: library/types.rst:523 +#: library/types.rst:504 msgid "Coroutine Utility Functions" -msgstr "" +msgstr "Βοηθητικές Συναρτήσεις Coroutine" -#: library/types.rst:527 +#: library/types.rst:508 msgid "" "This function transforms a :term:`generator` function into a :term:" "`coroutine function` which returns a generator-based coroutine. The " @@ -578,23 +846,34 @@ msgid "" "However, it may not necessarily implement the :meth:`~object.__await__` " "method." msgstr "" +"Αυτή η συνάρτηση μετατρέπει μια :term:`generator` συνάρτηση σε μια :term:" +"`coroutine function` που επιστρέφει μια coroutine βασισμένη σε γεννήτρια. Η " +"coroutine βασισμένη σε γεννήτρια είναι ακόμα ένας :term:`generator " +"iterator`, αλλά θεωρείται επίσης ότι είναι ένα αντικείμενο :term:`coroutine` " +"και είναι :term:`awaitable`. Ωστόσο, δεν είναι απαραίτητο να υλοποιεί τη " +"μέθοδο :meth:`~object.__await__`." -#: library/types.rst:534 +#: library/types.rst:515 msgid "If *gen_func* is a generator function, it will be modified in-place." msgstr "" +"Αν το *gen_func* είναι μια γεννήτρια συνάρτηση, θα τροποποιηθεί επιτόπου." -#: library/types.rst:536 +#: library/types.rst:517 msgid "" "If *gen_func* is not a generator function, it will be wrapped. If it returns " "an instance of :class:`collections.abc.Generator`, the instance will be " "wrapped in an *awaitable* proxy object. All other types of objects will be " "returned as is." msgstr "" +"Αν το *gen_func* δεν είναι μια γεννήτρια συνάρτηση, θα τυλιχθεί. Αν " +"επιστρέφει μια παρουσία της :class:`collections.abc.Generator`, το " +"στιγμιότυπο θα τυλιχθεί σε ένα *awaitable* αντικείμενο proxy. Όλοι οι άλλοι " +"τύποι αντικειμένων θα επιστραφούν όπως είναι." #: library/types.rst:189 msgid "built-in function" -msgstr "" +msgstr "built-in συνάρτηση" #: library/types.rst:189 msgid "compile" -msgstr "" +msgstr "compile" diff --git a/library/typing.po b/library/typing.po index 57291ec0..1b93e555 100644 --- a/library/typing.po +++ b/library/typing.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/typing.rst:3 -msgid ":mod:`typing` --- Support for type hints" +msgid ":mod:`!typing` --- Support for type hints" msgstr "" #: library/typing.rst:16 @@ -32,294 +33,191 @@ msgid "" msgstr "" #: library/typing.rst:26 -msgid "" -"This module provides runtime support for type hints. For the original " -"specification of the typing system, see :pep:`484`. For a simplified " -"introduction to type hints, see :pep:`483`." +msgid "This module provides runtime support for type hints." +msgstr "" + +#: library/typing.rst:28 +msgid "Consider the function below::" msgstr "" -#: library/typing.rst:31 +#: library/typing.rst:30 msgid "" -"The function below takes and returns a string and is annotated as follows::" +"def surface_area_of_cube(edge_length: float) -> str:\n" +" return f\"The surface area of the cube is {6 * edge_length ** 2}.\"" msgstr "" -#: library/typing.rst:36 +#: library/typing.rst:33 msgid "" -"In the function ``greeting``, the argument ``name`` is expected to be of " -"type :class:`str` and the return type :class:`str`. Subtypes are accepted as " -"arguments." +"The function ``surface_area_of_cube`` takes an argument expected to be an " +"instance of :class:`float`, as indicated by the :term:`type hint` " +"``edge_length: float``. The function is expected to return an instance of :" +"class:`str`, as indicated by the ``-> str`` hint." msgstr "" -#: library/typing.rst:40 +#: library/typing.rst:38 msgid "" -"New features are frequently added to the ``typing`` module. The " -"`typing_extensions `_ package " -"provides backports of these new features to older versions of Python." +"While type hints can be simple classes like :class:`float` or :class:`str`, " +"they can also be more complex. The :mod:`typing` module provides a " +"vocabulary of more advanced type hints." msgstr "" -#: library/typing.rst:44 +#: library/typing.rst:42 msgid "" -"For a summary of deprecated features and a deprecation timeline, please see " -"`Deprecation Timeline of Major Features`_." +"New features are frequently added to the ``typing`` module. The :pypi:" +"`typing_extensions` package provides backports of these new features to " +"older versions of Python." msgstr "" -#: library/typing.rst:50 +#: library/typing.rst:48 msgid "" -"`\"Typing cheat sheet\" `_" +"`Typing cheat sheet `_" msgstr "" -#: library/typing.rst:50 +#: library/typing.rst:49 msgid "A quick overview of type hints (hosted at the mypy docs)" msgstr "" -#: library/typing.rst:55 +#: library/typing.rst:51 msgid "" -"\"Type System Reference\" section of `the mypy docs `_" +"Type System Reference section of `the mypy docs `_" msgstr "" -#: library/typing.rst:53 +#: library/typing.rst:52 msgid "" "The Python typing system is standardised via PEPs, so this reference should " "broadly apply to most Python type checkers. (Some parts may still be " "specific to mypy.)" msgstr "" -#: library/typing.rst:59 -msgid "" -"`\"Static Typing with Python\" `_" +#: library/typing.rst:56 +msgid "`Static Typing with Python `_" msgstr "" -#: library/typing.rst:58 +#: library/typing.rst:57 msgid "" "Type-checker-agnostic documentation written by the community detailing type " "system features, useful typing related tools and typing best practices." msgstr "" -#: library/typing.rst:65 -msgid "Relevant PEPs" -msgstr "" - -#: library/typing.rst:67 -msgid "" -"Since the initial introduction of type hints in :pep:`484` and :pep:`483`, a " -"number of PEPs have modified and enhanced Python's framework for type " -"annotations:" +#: library/typing.rst:64 +msgid "Specification for the Python Type System" msgstr "" -#: library/typing.rst:77 -msgid ":pep:`526`: Syntax for Variable Annotations" -msgstr "" - -#: library/typing.rst:77 +#: library/typing.rst:66 msgid "" -"*Introducing* syntax for annotating variables outside of function " -"definitions, and :data:`ClassVar`" +"The canonical, up-to-date specification of the Python type system can be " +"found at `Specification for the Python type system `_." msgstr "" -#: library/typing.rst:80 -msgid ":pep:`544`: Protocols: Structural subtyping (static duck typing)" +#: library/typing.rst:72 +msgid "Type aliases" msgstr "" -#: library/typing.rst:80 +#: library/typing.rst:74 msgid "" -"*Introducing* :class:`Protocol` and the :func:" -"`@runtime_checkable` decorator" -msgstr "" - -#: library/typing.rst:83 -msgid ":pep:`585`: Type Hinting Generics In Standard Collections" +"A type alias is defined using the :keyword:`type` statement, which creates " +"an instance of :class:`TypeAliasType`. In this example, ``Vector`` and " +"``list[float]`` will be treated equivalently by static type checkers::" msgstr "" -#: library/typing.rst:83 +#: library/typing.rst:79 msgid "" -"*Introducing* :class:`types.GenericAlias` and the ability to use standard " -"library classes as :ref:`generic types`" -msgstr "" - -#: library/typing.rst:85 -msgid ":pep:`586`: Literal Types" -msgstr "" - -#: library/typing.rst:86 -msgid "*Introducing* :data:`Literal`" +"type Vector = list[float]\n" +"\n" +"def scale(scalar: float, vector: Vector) -> Vector:\n" +" return [scalar * num for num in vector]\n" +"\n" +"# passes type checking; a list of floats qualifies as a Vector.\n" +"new_vector = scale(2.0, [1.0, -4.2, 5.4])" msgstr "" #: library/typing.rst:87 msgid "" -":pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of Keys" -msgstr "" - -#: library/typing.rst:88 -msgid "*Introducing* :class:`TypedDict`" +"Type aliases are useful for simplifying complex type signatures. For " +"example::" msgstr "" #: library/typing.rst:89 -msgid ":pep:`591`: Adding a final qualifier to typing" -msgstr "" - -#: library/typing.rst:90 -msgid "*Introducing* :data:`Final` and the :func:`@final` decorator" -msgstr "" - -#: library/typing.rst:91 -msgid ":pep:`593`: Flexible function and variable annotations" -msgstr "" - -#: library/typing.rst:92 -msgid "*Introducing* :data:`Annotated`" -msgstr "" - -#: library/typing.rst:95 -msgid ":pep:`604`: Allow writing union types as ``X | Y``" -msgstr "" - -#: library/typing.rst:94 msgid "" -"*Introducing* :data:`types.UnionType` and the ability to use the binary-or " -"operator ``|`` to signify a :ref:`union of types`" -msgstr "" - -#: library/typing.rst:97 -msgid ":pep:`612`: Parameter Specification Variables" -msgstr "" - -#: library/typing.rst:98 -msgid "*Introducing* :class:`ParamSpec` and :data:`Concatenate`" -msgstr "" - -#: library/typing.rst:99 -msgid ":pep:`613`: Explicit Type Aliases" -msgstr "" - -#: library/typing.rst:100 -msgid "*Introducing* :data:`TypeAlias`" -msgstr "" - -#: library/typing.rst:101 -msgid ":pep:`646`: Variadic Generics" -msgstr "" - -#: library/typing.rst:102 -msgid "*Introducing* :data:`TypeVarTuple`" -msgstr "" - -#: library/typing.rst:103 -msgid ":pep:`647`: User-Defined Type Guards" -msgstr "" - -#: library/typing.rst:104 -msgid "*Introducing* :data:`TypeGuard`" -msgstr "" - -#: library/typing.rst:105 -msgid "" -":pep:`655`: Marking individual TypedDict items as required or potentially " -"missing" +"from collections.abc import Sequence\n" +"\n" +"type ConnectionOptions = dict[str, str]\n" +"type Address = tuple[str, int]\n" +"type Server = tuple[Address, ConnectionOptions]\n" +"\n" +"def broadcast_message(message: str, servers: Sequence[Server]) -> None:\n" +" ...\n" +"\n" +"# The static type checker will treat the previous type signature as\n" +"# being exactly equivalent to this one.\n" +"def broadcast_message(\n" +" message: str,\n" +" servers: Sequence[tuple[tuple[str, int], dict[str, str]]]\n" +") -> None:\n" +" ..." msgstr "" #: library/typing.rst:106 -msgid "*Introducing* :data:`Required` and :data:`NotRequired`" -msgstr "" - -#: library/typing.rst:107 -msgid ":pep:`673`: Self type" -msgstr "" - -#: library/typing.rst:108 -msgid "*Introducing* :data:`Self`" +msgid "" +"The :keyword:`type` statement is new in Python 3.12. For backwards " +"compatibility, type aliases can also be created through simple assignment::" msgstr "" #: library/typing.rst:109 -msgid ":pep:`675`: Arbitrary Literal String Type" -msgstr "" - -#: library/typing.rst:110 -msgid "*Introducing* :data:`LiteralString`" +msgid "Vector = list[float]" msgstr "" #: library/typing.rst:111 -msgid ":pep:`681`: Data Class Transforms" -msgstr "" - -#: library/typing.rst:112 msgid "" -"*Introducing* the :func:`@dataclass_transform` decorator" -msgstr "" - -#: library/typing.rst:114 -msgid ":pep:`692`: Using ``TypedDict`` for more precise ``**kwargs`` typing" +"Or marked with :data:`TypeAlias` to make it explicit that this is a type " +"alias, not a normal variable assignment::" msgstr "" #: library/typing.rst:114 msgid "" -"*Introducing* a new way of typing ``**kwargs`` with :data:`Unpack` and :data:" -"`TypedDict`" +"from typing import TypeAlias\n" +"\n" +"Vector: TypeAlias = list[float]" msgstr "" -#: library/typing.rst:116 -msgid ":pep:`695`: Type Parameter Syntax" -msgstr "" - -#: library/typing.rst:117 -msgid "" -"*Introducing* builtin syntax for creating generic functions, classes, and " -"type aliases." -msgstr "" - -#: library/typing.rst:119 -msgid ":pep:`698`: Adding an override decorator to typing" -msgstr "" - -#: library/typing.rst:119 -msgid "*Introducing* the :func:`@override` decorator" -msgstr "" - -#: library/typing.rst:129 -msgid "Type aliases" -msgstr "" - -#: library/typing.rst:131 -msgid "" -"A type alias is defined using the :keyword:`type` statement, which creates " -"an instance of :class:`TypeAliasType`. In this example, ``Vector`` and " -"``list[float]`` will be treated equivalently by static type checkers::" +#: library/typing.rst:121 +msgid "NewType" msgstr "" -#: library/typing.rst:144 -msgid "" -"Type aliases are useful for simplifying complex type signatures. For " -"example::" +#: library/typing.rst:123 +msgid "Use the :class:`NewType` helper to create distinct types::" msgstr "" -#: library/typing.rst:162 +#: library/typing.rst:125 msgid "" -"The :keyword:`type` statement is new in Python 3.12. For backwards " -"compatibility, type aliases can also be created through simple assignment::" +"from typing import NewType\n" +"\n" +"UserId = NewType('UserId', int)\n" +"some_id = UserId(524313)" msgstr "" -#: library/typing.rst:167 +#: library/typing.rst:130 msgid "" -"Or marked with :data:`TypeAlias` to make it explicit that this is a type " -"alias, not a normal variable assignment::" -msgstr "" - -#: library/typing.rst:177 -msgid "NewType" -msgstr "" - -#: library/typing.rst:179 -msgid "Use the :class:`NewType` helper to create distinct types::" +"The static type checker will treat the new type as if it were a subclass of " +"the original type. This is useful in helping catch logical errors::" msgstr "" -#: library/typing.rst:186 +#: library/typing.rst:133 msgid "" -"The static type checker will treat the new type as if it were a subclass of " -"the original type. This is useful in helping catch logical errors::" +"def get_user_name(user_id: UserId) -> str:\n" +" ...\n" +"\n" +"# passes type checking\n" +"user_a = get_user_name(UserId(42351))\n" +"\n" +"# fails type checking; an int is not a UserId\n" +"user_b = get_user_name(-1)" msgstr "" -#: library/typing.rst:198 +#: library/typing.rst:142 msgid "" "You may still perform all ``int`` operations on a variable of type " "``UserId``, but the result will always be of type ``int``. This lets you " @@ -327,7 +225,13 @@ msgid "" "you from accidentally creating a ``UserId`` in an invalid way::" msgstr "" -#: library/typing.rst:206 +#: library/typing.rst:147 +msgid "" +"# 'output' is of type 'int', not 'UserId'\n" +"output = UserId(23413) + UserId(54341)" +msgstr "" + +#: library/typing.rst:150 msgid "" "Note that these checks are enforced only by the static type checker. At " "runtime, the statement ``Derived = NewType('Derived', Base)`` will make " @@ -336,31 +240,50 @@ msgid "" "class or introduce much overhead beyond that of a regular function call." msgstr "" -#: library/typing.rst:212 +#: library/typing.rst:156 msgid "" "More precisely, the expression ``some_value is Derived(some_value)`` is " "always true at runtime." msgstr "" -#: library/typing.rst:215 +#: library/typing.rst:159 msgid "It is invalid to create a subtype of ``Derived``::" msgstr "" -#: library/typing.rst:224 +#: library/typing.rst:161 +msgid "" +"from typing import NewType\n" +"\n" +"UserId = NewType('UserId', int)\n" +"\n" +"# Fails at runtime and does not pass type checking\n" +"class AdminUserId(UserId): pass" +msgstr "" + +#: library/typing.rst:168 msgid "" "However, it is possible to create a :class:`NewType` based on a 'derived' " "``NewType``::" msgstr "" -#: library/typing.rst:232 +#: library/typing.rst:170 +msgid "" +"from typing import NewType\n" +"\n" +"UserId = NewType('UserId', int)\n" +"\n" +"ProUserId = NewType('ProUserId', UserId)" +msgstr "" + +#: library/typing.rst:176 msgid "and typechecking for ``ProUserId`` will work as expected." msgstr "" -#: library/typing.rst:234 +#: library/typing.rst:178 msgid "See :pep:`484` for more details." msgstr "" -#: library/typing.rst:238 +#: library/typing.rst:182 msgid "" "Recall that the use of a type alias declares two types to be *equivalent* to " "one another. Doing ``type Alias = Original`` will make the static type " @@ -368,7 +291,7 @@ msgid "" "cases. This is useful when you want to simplify complex type signatures." msgstr "" -#: library/typing.rst:243 +#: library/typing.rst:187 msgid "" "In contrast, ``NewType`` declares one type to be a *subtype* of another. " "Doing ``Derived = NewType('Derived', Original)`` will make the static type " @@ -378,50 +301,77 @@ msgid "" "errors with minimal runtime cost." msgstr "" -#: library/typing.rst:252 +#: library/typing.rst:196 msgid "" "``NewType`` is now a class rather than a function. As a result, there is " "some additional runtime cost when calling ``NewType`` over a regular " "function." msgstr "" -#: library/typing.rst:257 +#: library/typing.rst:201 msgid "" "The performance of calling ``NewType`` has been restored to its level in " "Python 3.9." msgstr "" -#: library/typing.rst:264 +#: library/typing.rst:208 msgid "Annotating callable objects" msgstr "" -#: library/typing.rst:266 +#: library/typing.rst:210 msgid "" "Functions -- or other :term:`callable` objects -- can be annotated using :" -"class:`collections.abc.Callable` or :data:`typing.Callable`. " +"class:`collections.abc.Callable` or deprecated :data:`typing.Callable`. " "``Callable[[int], str]`` signifies a function that takes a single parameter " "of type :class:`int` and returns a :class:`str`." msgstr "" -#: library/typing.rst:2889 library/typing.rst:3031 +#: library/typing.rst:3288 library/typing.rst:3474 msgid "For example:" msgstr "" -#: library/typing.rst:289 +#: library/typing.rst:217 +msgid "" +"from collections.abc import Callable, Awaitable\n" +"\n" +"def feeder(get_next_item: Callable[[], str]) -> None:\n" +" ... # Body\n" +"\n" +"def async_query(on_success: Callable[[int], None],\n" +" on_error: Callable[[int, Exception], None]) -> None:\n" +" ... # Body\n" +"\n" +"async def on_update(value: str) -> None:\n" +" ... # Body\n" +"\n" +"callback: Callable[[str], Awaitable[None]] = on_update" +msgstr "" + +#: library/typing.rst:235 msgid "" "The subscription syntax must always be used with exactly two values: the " "argument list and the return type. The argument list must be a list of " -"types, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis. The return " -"type must be a single type." +"types, a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis (``...``). " +"The return type must be a single type." msgstr "" -#: library/typing.rst:294 +#: library/typing.rst:240 msgid "" "If a literal ellipsis ``...`` is given as the argument list, it indicates " "that a callable with any arbitrary parameter list would be acceptable:" msgstr "" -#: library/typing.rst:306 +#: library/typing.rst:243 +msgid "" +"def concat(x: str, y: str) -> str:\n" +" return x + y\n" +"\n" +"x: Callable[..., str]\n" +"x = str # OK\n" +"x = concat # Also OK" +msgstr "" + +#: library/typing.rst:252 msgid "" "``Callable`` cannot express complex signatures such as functions that take a " "variadic number of arguments, :ref:`overloaded functions `, or " @@ -430,7 +380,31 @@ msgid "" "__call__` method:" msgstr "" -#: library/typing.rst:333 +#: library/typing.rst:258 +msgid "" +"from collections.abc import Iterable\n" +"from typing import Protocol\n" +"\n" +"class Combiner(Protocol):\n" +" def __call__(self, *vals: bytes, maxlen: int | None = None) -> " +"list[bytes]: ...\n" +"\n" +"def batch_proc(data: Iterable[bytes], cb_results: Combiner) -> bytes:\n" +" for item in data:\n" +" ...\n" +"\n" +"def good_cb(*vals: bytes, maxlen: int | None = None) -> list[bytes]:\n" +" ...\n" +"def bad_cb(*vals: bytes, maxitems: int | None) -> list[bytes]:\n" +" ...\n" +"\n" +"batch_proc([], good_cb) # OK\n" +"batch_proc([], bad_cb) # Error! Argument 2 has incompatible type because " +"of\n" +" # different name and kind in the callback" +msgstr "" + +#: library/typing.rst:279 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -441,54 +415,104 @@ msgid "" "ReturnType]`` respectively." msgstr "" -#: library/typing.rst:3557 +#: library/typing.rst:4005 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." msgstr "" -#: library/typing.rst:346 +#: library/typing.rst:292 msgid "" "The documentation for :class:`ParamSpec` and :class:`Concatenate` provides " "examples of usage in ``Callable``." msgstr "" -#: library/typing.rst:352 +#: library/typing.rst:298 msgid "Generics" msgstr "" -#: library/typing.rst:354 +#: library/typing.rst:300 msgid "" "Since type information about objects kept in containers cannot be statically " "inferred in a generic way, many container classes in the standard library " "support subscription to denote the expected types of container elements." msgstr "" -#: library/typing.rst:371 +#: library/typing.rst:304 +msgid "" +"from collections.abc import Mapping, Sequence\n" +"\n" +"class Employee: ...\n" +"\n" +"# Sequence[Employee] indicates that all elements in the sequence\n" +"# must be instances of \"Employee\".\n" +"# Mapping[str, str] indicates that all keys and all values in the mapping\n" +"# must be strings.\n" +"def notify_by_email(employees: Sequence[Employee],\n" +" overrides: Mapping[str, str]) -> None: ..." +msgstr "" + +#: library/typing.rst:317 msgid "" "Generic functions and classes can be parameterized by using :ref:`type " "parameter syntax `::" msgstr "" -#: library/typing.rst:379 +#: library/typing.rst:320 +msgid "" +"from collections.abc import Sequence\n" +"\n" +"def first[T](l: Sequence[T]) -> T: # Function is generic over the TypeVar " +"\"T\"\n" +" return l[0]" +msgstr "" + +#: library/typing.rst:325 msgid "Or by using the :class:`TypeVar` factory directly::" msgstr "" -#: library/typing.rst:389 +#: library/typing.rst:327 +msgid "" +"from collections.abc import Sequence\n" +"from typing import TypeVar\n" +"\n" +"U = TypeVar('U') # Declare type variable \"U\"\n" +"\n" +"def second(l: Sequence[U]) -> U: # Function is generic over the TypeVar " +"\"U\"\n" +" return l[1]" +msgstr "" + +#: library/typing.rst:335 msgid "Syntactic support for generics is new in Python 3.12." msgstr "" -#: library/typing.rst:395 +#: library/typing.rst:341 msgid "Annotating tuples" msgstr "" -#: library/typing.rst:397 +#: library/typing.rst:343 msgid "" "For most containers in Python, the typing system assumes that all elements " "in the container will be of the same type. For example::" msgstr "" -#: library/typing.rst:412 +#: library/typing.rst:346 +msgid "" +"from collections.abc import Mapping\n" +"\n" +"# Type checker will infer that all elements in ``x`` are meant to be ints\n" +"x: list[int] = []\n" +"\n" +"# Type checker error: ``list`` only accepts a single type argument:\n" +"y: list[int, str] = [1, 'foo']\n" +"\n" +"# Type checker will infer that all keys in ``z`` are meant to be strings,\n" +"# and that all values in ``z`` are meant to be either strings or ints\n" +"z: Mapping[str, str | int] = {}" +msgstr "" + +#: library/typing.rst:358 msgid "" ":class:`list` only accepts one type argument, so a type checker would emit " "an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." @@ -496,7 +520,7 @@ msgid "" "the keys, and the second indicates the type of the values." msgstr "" -#: library/typing.rst:418 +#: library/typing.rst:364 msgid "" "Unlike most other Python containers, however, it is common in idiomatic " "Python code for tuples to have elements which are not all of the same type. " @@ -504,140 +528,469 @@ msgid "" "`tuple` accepts *any number* of type arguments::" msgstr "" -#: library/typing.rst:434 +#: library/typing.rst:369 msgid "" -"To denote a tuple which could be of *any* length, and in which all elements " -"are of the same type ``T``, use ``tuple[T, ...]``. To denote an empty tuple, " -"use ``tuple[()]``. Using plain ``tuple`` as an annotation is equivalent to " -"using ``tuple[Any, ...]``::" +"# OK: ``x`` is assigned to a tuple of length 1 where the sole element is an " +"int\n" +"x: tuple[int] = (5,)\n" +"\n" +"# OK: ``y`` is assigned to a tuple of length 2;\n" +"# element 1 is an int, element 2 is a str\n" +"y: tuple[int, str] = (5, \"foo\")\n" +"\n" +"# Error: the type annotation indicates a tuple of length 1,\n" +"# but ``z`` has been assigned to a tuple of length 3\n" +"z: tuple[int] = (1, 2, 3)" msgstr "" -#: library/typing.rst:457 +#: library/typing.rst:382 +msgid "" +"To denote a tuple which could be of *any* length, and in which all elements " +"are of the same type ``T``, use the literal ellipsis ``...``: " +"``tuple[T, ...]``. To denote an empty tuple, use ``tuple[()]``. Using plain " +"``tuple`` as an annotation is equivalent to using ``tuple[Any, ...]``::" +msgstr "" + +#: library/typing.rst:388 +msgid "" +"x: tuple[int, ...] = (1, 2)\n" +"# These reassignments are OK: ``tuple[int, ...]`` indicates x can be of any " +"length\n" +"x = (1, 2, 3)\n" +"x = ()\n" +"# This reassignment is an error: all elements in ``x`` must be ints\n" +"x = (\"foo\", \"bar\")\n" +"\n" +"# ``y`` can only ever be assigned to an empty tuple\n" +"y: tuple[()] = ()\n" +"\n" +"z: tuple = (\"foo\", \"bar\")\n" +"# These reassignments are OK: plain ``tuple`` is equivalent to " +"``tuple[Any, ...]``\n" +"z = (1, 2, 3)\n" +"z = ()" +msgstr "" + +#: library/typing.rst:406 msgid "The type of class objects" msgstr "" -#: library/typing.rst:459 +#: library/typing.rst:408 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " -"contrast, a variable annotated with ``type[C]`` (or :class:`typing.Type[C] " -"`) may accept values that are classes themselves -- specifically, it " -"will accept the *class object* of ``C``. For example::" +"contrast, a variable annotated with ``type[C]`` (or deprecated :class:" +"`typing.Type[C] `) may accept values that are classes themselves -- " +"specifically, it will accept the *class object* of ``C``. For example::" msgstr "" -#: library/typing.rst:469 +#: library/typing.rst:414 +msgid "" +"a = 3 # Has type ``int``\n" +"b = int # Has type ``type[int]``\n" +"c = type(a) # Also has type ``type[int]``" +msgstr "" + +#: library/typing.rst:418 msgid "Note that ``type[C]`` is covariant::" msgstr "" -#: library/typing.rst:485 +#: library/typing.rst:420 +msgid "" +"class User: ...\n" +"class ProUser(User): ...\n" +"class TeamUser(User): ...\n" +"\n" +"def make_new_user(user_class: type[User]) -> User:\n" +" # ...\n" +" return user_class()\n" +"\n" +"make_new_user(User) # OK\n" +"make_new_user(ProUser) # Also OK: ``type[ProUser]`` is a subtype of " +"``type[User]``\n" +"make_new_user(TeamUser) # Still fine\n" +"make_new_user(User()) # Error: expected ``type[User]`` but got ``User``\n" +"make_new_user(int) # Error: ``type[int]`` is not a subtype of " +"``type[User]``" +msgstr "" + +#: library/typing.rst:434 msgid "" "The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" "`type variables `, and unions of any of these types. For example::" msgstr "" -#: library/typing.rst:497 +#: library/typing.rst:438 +msgid "" +"def new_non_team_user(user_class: type[BasicUser | ProUser]): ...\n" +"\n" +"new_non_team_user(BasicUser) # OK\n" +"new_non_team_user(ProUser) # OK\n" +"new_non_team_user(TeamUser) # Error: ``type[TeamUser]`` is not a subtype\n" +" # of ``type[BasicUser | ProUser]``\n" +"new_non_team_user(User) # Also an error" +msgstr "" + +#: library/typing.rst:446 msgid "" "``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" "ref:`metaclass hierarchy `." msgstr "" -#: library/typing.rst:503 +#: library/typing.rst:453 +msgid "Annotating generators and coroutines" +msgstr "" + +#: library/typing.rst:455 +msgid "" +"A generator can be annotated using the generic type :class:" +"`Generator[YieldType, SendType, ReturnType] `. " +"For example::" +msgstr "" + +#: library/typing.rst:459 +msgid "" +"def echo_round() -> Generator[int, float, str]:\n" +" sent = yield 0\n" +" while sent >= 0:\n" +" sent = yield round(sent)\n" +" return 'Done'" +msgstr "" + +#: library/typing.rst:465 +msgid "" +"Note that unlike many other generic classes in the standard library, the " +"``SendType`` of :class:`~collections.abc.Generator` behaves contravariantly, " +"not covariantly or invariantly." +msgstr "" + +#: library/typing.rst:469 +msgid "" +"The ``SendType`` and ``ReturnType`` parameters default to :const:`!None`::" +msgstr "" + +#: library/typing.rst:471 +msgid "" +"def infinite_stream(start: int) -> Generator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" +msgstr "" + +#: library/typing.rst:476 +msgid "It is also possible to set these types explicitly::" +msgstr "" + +#: library/typing.rst:478 +msgid "" +"def infinite_stream(start: int) -> Generator[int, None, None]:\n" +" while True:\n" +" yield start\n" +" start += 1" +msgstr "" + +#: library/typing.rst:483 +msgid "" +"Simple generators that only ever yield values can also be annotated as " +"having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" +msgstr "" + +#: library/typing.rst:488 +msgid "" +"def infinite_stream(start: int) -> Iterator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" +msgstr "" + +#: library/typing.rst:493 +msgid "" +"Async generators are handled in a similar fashion, but don't expect a " +"``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " +"`). The ``SendType`` argument defaults to :" +"const:`!None`, so the following definitions are equivalent::" +msgstr "" + +#: library/typing.rst:499 +msgid "" +"async def infinite_stream(start: int) -> AsyncGenerator[int]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)\n" +"\n" +"async def infinite_stream(start: int) -> AsyncGenerator[int, None]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)" +msgstr "" + +#: library/typing.rst:509 +msgid "" +"As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" +msgstr "" + +#: library/typing.rst:514 +msgid "" +"async def infinite_stream(start: int) -> AsyncIterator[int]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)" +msgstr "" + +#: library/typing.rst:519 +msgid "" +"Coroutines can be annotated using :class:`Coroutine[YieldType, SendType, " +"ReturnType] `. Generic arguments correspond to " +"those of :class:`~collections.abc.Generator`, for example::" +msgstr "" + +#: library/typing.rst:524 +msgid "" +"from collections.abc import Coroutine\n" +"c: Coroutine[list[str], str, int] # Some coroutine defined elsewhere\n" +"x = c.send('hi') # Inferred type of 'x' is list[str]\n" +"async def bar() -> None:\n" +" y = await c # Inferred type of 'y' is int" +msgstr "" + +#: library/typing.rst:533 msgid "User-defined generic types" msgstr "" -#: library/typing.rst:505 +#: library/typing.rst:535 msgid "A user-defined class can be defined as a generic class." msgstr "" -#: library/typing.rst:528 +#: library/typing.rst:539 +msgid "" +"from logging import Logger\n" +"\n" +"class LoggedVar[T]:\n" +" def __init__(self, value: T, name: str, logger: Logger) -> None:\n" +" self.name = name\n" +" self.logger = logger\n" +" self.value = value\n" +"\n" +" def set(self, new: T) -> None:\n" +" self.log('Set ' + repr(self.value))\n" +" self.value = new\n" +"\n" +" def get(self) -> T:\n" +" self.log('Get ' + repr(self.value))\n" +" return self.value\n" +"\n" +" def log(self, message: str) -> None:\n" +" self.logger.info('%s: %s', self.name, message)" +msgstr "" + +#: library/typing.rst:558 msgid "" "This syntax indicates that the class ``LoggedVar`` is parameterised around a " "single :ref:`type variable ` ``T`` . This also makes ``T`` valid as " "a type within the class body." msgstr "" -#: library/typing.rst:532 +#: library/typing.rst:562 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " "with Python 3.11 and lower, it is also possible to inherit explicitly from :" "class:`Generic` to indicate a generic class::" msgstr "" -#: library/typing.rst:543 +#: library/typing.rst:566 +msgid "" +"from typing import TypeVar, Generic\n" +"\n" +"T = TypeVar('T')\n" +"\n" +"class LoggedVar(Generic[T]):\n" +" ..." +msgstr "" + +#: library/typing.rst:573 msgid "" "Generic classes have :meth:`~object.__class_getitem__` methods, meaning they " "can be parameterised at runtime (e.g. ``LoggedVar[int]`` below)::" msgstr "" -#: library/typing.rst:552 +#: library/typing.rst:576 +msgid "" +"from collections.abc import Iterable\n" +"\n" +"def zero_all_vars(vars: Iterable[LoggedVar[int]]) -> None:\n" +" for var in vars:\n" +" var.set(0)" +msgstr "" + +#: library/typing.rst:582 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" -#: library/typing.rst:567 +#: library/typing.rst:585 +msgid "" +"from typing import TypeVar, Generic, Sequence\n" +"\n" +"class WeirdTrio[T, B: Sequence[bytes], S: (int, str)]:\n" +" ...\n" +"\n" +"OldT = TypeVar('OldT', contravariant=True)\n" +"OldB = TypeVar('OldB', bound=Sequence[bytes], covariant=True)\n" +"OldS = TypeVar('OldS', int, str)\n" +"\n" +"class OldWeirdTrio(Generic[OldT, OldB, OldS]):\n" +" ..." +msgstr "" + +#: library/typing.rst:597 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr "" -#: library/typing.rst:581 +#: library/typing.rst:600 +msgid "" +"from typing import TypeVar, Generic\n" +"...\n" +"\n" +"class Pair[M, M]: # SyntaxError\n" +" ...\n" +"\n" +"T = TypeVar('T')\n" +"\n" +"class Pair(Generic[T, T]): # INVALID\n" +" ..." +msgstr "" + +#: library/typing.rst:611 msgid "Generic classes can also inherit from other classes::" msgstr "" -#: library/typing.rst:588 +#: library/typing.rst:613 +msgid "" +"from collections.abc import Sized\n" +"\n" +"class LinkedList[T](Sized):\n" +" ..." +msgstr "" + +#: library/typing.rst:618 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "" -#: library/typing.rst:595 +#: library/typing.rst:620 +msgid "" +"from collections.abc import Mapping\n" +"\n" +"class MyDict[T](Mapping[str, T]):\n" +" ..." +msgstr "" + +#: library/typing.rst:625 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "" -#: library/typing.rst:597 +#: library/typing.rst:627 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " "but implicitly inherits from ``Iterable[Any]``:" msgstr "" -#: library/typing.rst:608 +#: library/typing.rst:631 +msgid "" +"from collections.abc import Iterable\n" +"\n" +"class MyIterable(Iterable): # Same as Iterable[Any]\n" +" ..." +msgstr "" + +#: library/typing.rst:638 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "" -#: library/typing.rst:623 +#: library/typing.rst:640 +msgid "" +"from collections.abc import Iterable\n" +"\n" +"type Response[S] = Iterable[S] | int\n" +"\n" +"# Return type here is same as Iterable[str] | int\n" +"def response(query: str) -> Response[str]:\n" +" ...\n" +"\n" +"type Vec[T] = Iterable[tuple[T, T]]\n" +"\n" +"def inproduct[T: (int, float, complex)](v: Vec[T]) -> T: # Same as " +"Iterable[tuple[T, T]]\n" +" return sum(x*y for x, y in v)" +msgstr "" + +#: library/typing.rst:653 msgid "" "For backward compatibility, generic type aliases can also be created through " "a simple assignment::" msgstr "" -#: library/typing.rst:632 +#: library/typing.rst:656 +msgid "" +"from collections.abc import Iterable\n" +"from typing import TypeVar\n" +"\n" +"S = TypeVar(\"S\")\n" +"Response = Iterable[S] | int" +msgstr "" + +#: library/typing.rst:662 msgid ":class:`Generic` no longer has a custom metaclass." msgstr "" -#: library/typing.rst:635 +#: library/typing.rst:665 msgid "" "Syntactic support for generics and type aliases is new in version 3.12. " "Previously, generic classes had to explicitly inherit from :class:`Generic` " "or contain a type variable in one of their bases." msgstr "" -#: library/typing.rst:640 +#: library/typing.rst:670 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``[**P]``. The behavior is " "consistent with type variables' described above as parameter specification " -"variables are treated by the typing module as a specialized type variable. " -"The one exception to this is that a list of types can be used to substitute " -"a :class:`ParamSpec`::" +"variables are treated by the :mod:`!typing` module as a specialized type " +"variable. The one exception to this is that a list of types can be used to " +"substitute a :class:`ParamSpec`::" msgstr "" -#: library/typing.rst:651 +#: library/typing.rst:676 +msgid "" +">>> class Z[T, **P]: ... # T is a TypeVar; P is a ParamSpec\n" +"...\n" +">>> Z[int, [dict, float]]\n" +"__main__.Z[int, [dict, float]]" +msgstr "" + +#: library/typing.rst:681 msgid "" "Classes generic over a :class:`ParamSpec` can also be created using explicit " "inheritance from :class:`Generic`. In this case, ``**`` is not used::" msgstr "" -#: library/typing.rst:661 +#: library/typing.rst:684 +msgid "" +"from typing import ParamSpec, Generic\n" +"\n" +"P = ParamSpec('P')\n" +"\n" +"class Z(Generic[P]):\n" +" ..." +msgstr "" + +#: library/typing.rst:691 msgid "" "Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a " "generic with only one parameter specification variable will accept parameter " @@ -646,45 +999,73 @@ msgid "" "the former, so the following are equivalent::" msgstr "" -#: library/typing.rst:674 +#: library/typing.rst:697 +msgid "" +">>> class X[**P]: ...\n" +"...\n" +">>> X[int, str]\n" +"__main__.X[[int, str]]\n" +">>> X[[int, str]]\n" +"__main__.X[[int, str]]" +msgstr "" + +#: library/typing.rst:704 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " "intended primarily for static type checking." msgstr "" -#: library/typing.rst:678 +#: library/typing.rst:708 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." msgstr "" -#: library/typing.rst:682 +#: library/typing.rst:712 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " -"parameterizing generics is cached, and most types in the typing module are :" -"term:`hashable` and comparable for equality." +"parameterizing generics is cached, and most types in the :mod:`!typing` " +"module are :term:`hashable` and comparable for equality." msgstr "" -#: library/typing.rst:689 +#: library/typing.rst:719 msgid "The :data:`Any` type" msgstr "" -#: library/typing.rst:691 +#: library/typing.rst:721 msgid "" "A special kind of type is :data:`Any`. A static type checker will treat " "every type as being compatible with :data:`Any` and :data:`Any` as being " "compatible with every type." msgstr "" -#: library/typing.rst:695 +#: library/typing.rst:725 msgid "" "This means that it is possible to perform any operation or method call on a " "value of type :data:`Any` and assign it to any variable::" msgstr "" -#: library/typing.rst:713 +#: library/typing.rst:728 +msgid "" +"from typing import Any\n" +"\n" +"a: Any = None\n" +"a = [] # OK\n" +"a = 2 # OK\n" +"\n" +"s: str = ''\n" +"s = a # OK\n" +"\n" +"def foo(item: Any) -> int:\n" +" # Passes type checking; 'item' could be any type,\n" +" # and that type might have a 'bar' method\n" +" item.bar()\n" +" ..." +msgstr "" + +#: library/typing.rst:743 msgid "" "Notice that no type checking is performed when assigning a value of type :" "data:`Any` to a more precise type. For example, the static type checker did " @@ -693,19 +1074,32 @@ msgid "" "runtime!" msgstr "" -#: library/typing.rst:719 +#: library/typing.rst:749 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "" -#: library/typing.rst:732 +#: library/typing.rst:752 +msgid "" +"def legacy_parser(text):\n" +" ...\n" +" return data\n" +"\n" +"# A static type checker will treat the above\n" +"# as having the same signature as:\n" +"def legacy_parser(text: Any) -> Any:\n" +" ...\n" +" return data" +msgstr "" + +#: library/typing.rst:762 msgid "" "This behavior allows :data:`Any` to be used as an *escape hatch* when you " "need to mix dynamically and statically typed code." msgstr "" -#: library/typing.rst:735 +#: library/typing.rst:765 msgid "" "Contrast the behavior of :data:`Any` with the behavior of :class:`object`. " "Similar to :data:`Any`, every type is a subtype of :class:`object`. However, " @@ -713,7 +1107,7 @@ msgid "" "subtype of every other type." msgstr "" -#: library/typing.rst:740 +#: library/typing.rst:770 msgid "" "That means when the type of a value is :class:`object`, a type checker will " "reject almost all operations on it, and assigning it to a variable (or using " @@ -721,24 +1115,45 @@ msgid "" "example::" msgstr "" -#: library/typing.rst:762 +#: library/typing.rst:774 +msgid "" +"def hash_a(item: object) -> int:\n" +" # Fails type checking; an object does not have a 'magic' method.\n" +" item.magic()\n" +" ...\n" +"\n" +"def hash_b(item: Any) -> int:\n" +" # Passes type checking\n" +" item.magic()\n" +" ...\n" +"\n" +"# Passes type checking, since ints and strs are subclasses of object\n" +"hash_a(42)\n" +"hash_a(\"foo\")\n" +"\n" +"# Passes type checking, since Any is compatible with all types\n" +"hash_b(42)\n" +"hash_b(\"foo\")" +msgstr "" + +#: library/typing.rst:792 msgid "" "Use :class:`object` to indicate that a value could be any type in a typesafe " "manner. Use :data:`Any` to indicate that a value is dynamically typed." msgstr "" -#: library/typing.rst:767 +#: library/typing.rst:797 msgid "Nominal vs structural subtyping" msgstr "" -#: library/typing.rst:769 +#: library/typing.rst:799 msgid "" "Initially :pep:`484` defined the Python static type system as using *nominal " "subtyping*. This means that a class ``A`` is allowed where a class ``B`` is " "expected if and only if ``A`` is a subclass of ``B``." msgstr "" -#: library/typing.rst:773 +#: library/typing.rst:803 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -747,7 +1162,17 @@ msgid "" "code. For example, this conforms to :pep:`484`::" msgstr "" -#: library/typing.rst:786 +#: library/typing.rst:809 +msgid "" +"from collections.abc import Sized, Iterable, Iterator\n" +"\n" +"class Bucket(Sized, Iterable[int]):\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ..." +msgstr "" + +#: library/typing.rst:816 msgid "" ":pep:`544` allows to solve this problem by allowing users to write the above " "code without explicit base classes in the class definition, allowing " @@ -756,87 +1181,142 @@ msgid "" "subtyping* (or static duck-typing)::" msgstr "" -#: library/typing.rst:802 +#: library/typing.rst:822 +msgid "" +"from collections.abc import Iterator, Iterable\n" +"\n" +"class Bucket: # Note: no base classes\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ...\n" +"\n" +"def collect(items: Iterable[int]) -> int: ...\n" +"result = collect(Bucket()) # Passes type check" +msgstr "" + +#: library/typing.rst:832 msgid "" "Moreover, by subclassing a special class :class:`Protocol`, a user can " "define new custom protocols to fully enjoy structural subtyping (see " "examples below)." msgstr "" -#: library/typing.rst:807 +#: library/typing.rst:837 msgid "Module contents" msgstr "" -#: library/typing.rst:809 +#: library/typing.rst:839 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." msgstr "" -#: library/typing.rst:812 +#: library/typing.rst:842 msgid "Special typing primitives" msgstr "" -#: library/typing.rst:815 +#: library/typing.rst:845 msgid "Special types" msgstr "" -#: library/typing.rst:817 +#: library/typing.rst:847 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "" -#: library/typing.rst:822 +#: library/typing.rst:852 msgid "Special type indicating an unconstrained type." msgstr "" -#: library/typing.rst:824 +#: library/typing.rst:854 msgid "Every type is compatible with :data:`Any`." msgstr "" -#: library/typing.rst:825 +#: library/typing.rst:855 msgid ":data:`Any` is compatible with every type." msgstr "" -#: library/typing.rst:827 +#: library/typing.rst:857 msgid "" ":data:`Any` can now be used as a base class. This can be useful for avoiding " "type checker errors with classes that can duck type anywhere or are highly " "dynamic." msgstr "" -#: library/typing.rst:834 +#: library/typing.rst:864 msgid "A :ref:`constrained type variable `." msgstr "" -#: library/typing.rst:836 +#: library/typing.rst:866 msgid "Definition::" msgstr "" -#: library/typing.rst:840 +#: library/typing.rst:868 +msgid "AnyStr = TypeVar('AnyStr', str, bytes)" +msgstr "" + +#: library/typing.rst:870 msgid "" "``AnyStr`` is meant to be used for functions that may accept :class:`str` " "or :class:`bytes` arguments but cannot allow the two to mix." msgstr "" -#: library/typing.rst:934 library/typing.rst:1010 library/typing.rst:1233 -#: library/typing.rst:2829 +#: library/typing.rst:991 library/typing.rst:1230 library/typing.rst:1359 +#: library/typing.rst:1629 library/typing.rst:3459 msgid "For example::" msgstr "" -#: library/typing.rst:852 +#: library/typing.rst:875 +msgid "" +"def concat(a: AnyStr, b: AnyStr) -> AnyStr:\n" +" return a + b\n" +"\n" +"concat(\"foo\", \"bar\") # OK, output has type 'str'\n" +"concat(b\"foo\", b\"bar\") # OK, output has type 'bytes'\n" +"concat(\"foo\", b\"bar\") # Error, cannot mix str and bytes" +msgstr "" + +#: library/typing.rst:882 msgid "" "Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" "`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " "``str | bytes`` are different from each other and have different use cases::" msgstr "" -#: library/typing.rst:869 +#: library/typing.rst:887 +msgid "" +"# Invalid use of AnyStr:\n" +"# The type variable is used only once in the function signature,\n" +"# so cannot be \"solved\" by the type checker\n" +"def greet_bad(cond: bool) -> AnyStr:\n" +" return \"hi there!\" if cond else b\"greetings!\"\n" +"\n" +"# The better way of annotating this function:\n" +"def greet_proper(cond: bool) -> str | bytes:\n" +" return \"hi there!\" if cond else b\"greetings!\"" +msgstr "" + +#: library/typing.rst:897 +msgid "" +"Deprecated in favor of the new :ref:`type parameter syntax `. " +"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" +"pep:`695` for more details." +msgstr "" + +#: library/typing.rst:902 +msgid "" +"In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and " +"deprecation warnings will be emitted at runtime when it is accessed or " +"imported from ``typing``. ``AnyStr`` will be removed from ``typing`` in " +"Python 3.18." +msgstr "" + +#: library/typing.rst:909 msgid "Special type that includes only literal strings." msgstr "" -#: library/typing.rst:871 +#: library/typing.rst:911 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " @@ -844,11 +1324,26 @@ msgid "" "``LiteralString``." msgstr "" -#: library/typing.rst:1957 +#: library/typing.rst:2250 msgid "Example:" msgstr "" -#: library/typing.rst:893 +#: library/typing.rst:919 +msgid "" +"def run_query(sql: LiteralString) -> None:\n" +" ...\n" +"\n" +"def caller(arbitrary_string: str, literal_string: LiteralString) -> None:\n" +" run_query(\"SELECT * FROM students\") # OK\n" +" run_query(literal_string) # OK\n" +" run_query(\"SELECT * FROM \" + literal_string) # OK\n" +" run_query(arbitrary_string) # type checker error\n" +" run_query( # type checker error\n" +" f\"SELECT * FROM students WHERE name = {arbitrary_string}\"\n" +" )" +msgstr "" + +#: library/typing.rst:933 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " @@ -856,51 +1351,107 @@ msgid "" "attack." msgstr "" -#: library/typing.rst:898 -msgid "See :pep:`675` for more details." +#: library/typing.rst:938 +msgid "See :pep:`675` for more details." +msgstr "" + +#: library/typing.rst:945 +msgid "" +":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." +msgstr "" + +#: library/typing.rst:949 +msgid "" +"They can be used to indicate that a function never returns, such as :func:" +"`sys.exit`::" +msgstr "" + +#: library/typing.rst:952 +msgid "" +"from typing import Never # or NoReturn\n" +"\n" +"def stop() -> Never:\n" +" raise RuntimeError('no way')" msgstr "" -#: library/typing.rst:904 +#: library/typing.rst:957 msgid "" -"The `bottom type `_, a type that " -"has no members." +"Or to define a function that should never be called, as there are no valid " +"arguments, such as :func:`assert_never`::" msgstr "" -#: library/typing.rst:907 +#: library/typing.rst:961 msgid "" -"This can be used to define a function that should never be called, or a " -"function that never returns::" +"from typing import Never # or NoReturn\n" +"\n" +"def never_call_me(arg: Never) -> None:\n" +" pass\n" +"\n" +"def int_or_str(arg: int | str) -> None:\n" +" never_call_me(arg) # type checker error\n" +" match arg:\n" +" case int():\n" +" print(\"It's an int\")\n" +" case str():\n" +" print(\"It's a str\")\n" +" case _:\n" +" never_call_me(arg) # OK, arg is of type Never (or NoReturn)" msgstr "" -#: library/typing.rst:927 +#: library/typing.rst:976 msgid "" -"On older Python versions, :data:`NoReturn` may be used to express the same " -"concept. ``Never`` was added to make the intended meaning more explicit." +":data:`!Never` and :data:`!NoReturn` have the same meaning in the type " +"system and static type checkers treat both equivalently." msgstr "" -#: library/typing.rst:932 -msgid "Special type indicating that a function never returns." +#: library/typing.rst:981 +msgid "Added :data:`NoReturn`." msgstr "" -#: library/typing.rst:941 -msgid "" -"``NoReturn`` can also be used as a `bottom type `_, a type that has no values. Starting in Python 3.11, " -"the :data:`Never` type should be used for this concept instead. Type " -"checkers should treat the two equivalently." +#: library/typing.rst:985 +msgid "Added :data:`Never`." msgstr "" -#: library/typing.rst:951 +#: library/typing.rst:989 msgid "Special type to represent the current enclosed class." msgstr "" -#: library/typing.rst:967 +#: library/typing.rst:993 +msgid "" +"from typing import Self, reveal_type\n" +"\n" +"class Foo:\n" +" def return_self(self) -> Self:\n" +" ...\n" +" return self\n" +"\n" +"class SubclassOfFoo(Foo): pass\n" +"\n" +"reveal_type(Foo().return_self()) # Revealed type is \"Foo\"\n" +"reveal_type(SubclassOfFoo().return_self()) # Revealed type is " +"\"SubclassOfFoo\"" +msgstr "" + +#: library/typing.rst:1005 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "" -#: library/typing.rst:979 +#: library/typing.rst:1008 +msgid "" +"from typing import TypeVar\n" +"\n" +"Self = TypeVar(\"Self\", bound=\"Foo\")\n" +"\n" +"class Foo:\n" +" def return_self(self: Self) -> Self:\n" +" ...\n" +" return self" +msgstr "" + +#: library/typing.rst:1017 msgid "" "In general, if something returns ``self``, as in the above examples, you " "should use ``Self`` as the return annotation. If ``Foo.return_self`` was " @@ -909,48 +1460,83 @@ msgid "" "rather than ``SubclassOfFoo``." msgstr "" -#: library/typing.rst:985 +#: library/typing.rst:1023 msgid "Other common use cases include:" msgstr "" -#: library/typing.rst:987 +#: library/typing.rst:1025 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." msgstr "" -#: library/typing.rst:989 +#: library/typing.rst:1027 msgid "Annotating an :meth:`~object.__enter__` method which returns self." msgstr "" -#: library/typing.rst:991 +#: library/typing.rst:1029 msgid "" "You should not use ``Self`` as the return annotation if the method is not " "guaranteed to return an instance of a subclass when the class is subclassed::" msgstr "" -#: library/typing.rst:1002 +#: library/typing.rst:1033 +msgid "" +"class Eggs:\n" +" # Self would be an incorrect return annotation here,\n" +" # as the object returned is always an instance of Eggs,\n" +" # even in subclasses\n" +" def returns_eggs(self) -> \"Eggs\":\n" +" return Eggs()" +msgstr "" + +#: library/typing.rst:1040 msgid "See :pep:`673` for more details." msgstr "" -#: library/typing.rst:1008 +#: library/typing.rst:1046 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "" -#: library/typing.rst:1016 +#: library/typing.rst:1050 +msgid "" +"from typing import TypeAlias\n" +"\n" +"Factors: TypeAlias = list[int]" +msgstr "" + +#: library/typing.rst:1054 msgid "" "``TypeAlias`` is particularly useful on older Python versions for annotating " "aliases that make use of forward references, as it can be hard for type " "checkers to distinguish these from normal variable assignments:" msgstr "" -#: library/typing.rst:1036 +#: library/typing.rst:1058 +msgid "" +"from typing import Generic, TypeAlias, TypeVar\n" +"\n" +"T = TypeVar(\"T\")\n" +"\n" +"# \"Box\" does not exist yet,\n" +"# so we have to use quotes for the forward reference on Python <3.12.\n" +"# Using ``TypeAlias`` tells the type checker that this is a type alias " +"declaration,\n" +"# not a variable assignment to a string.\n" +"BoxOfStrings: TypeAlias = \"Box[str]\"\n" +"\n" +"class Box(Generic[T]):\n" +" @classmethod\n" +" def make_box_of_strings(cls) -> BoxOfStrings: ..." +msgstr "" + +#: library/typing.rst:1074 msgid "See :pep:`613` for more details." msgstr "" -#: library/typing.rst:1040 +#: library/typing.rst:1078 msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " @@ -961,71 +1547,108 @@ msgid "" "to :keyword:`type` statements." msgstr "" -#: library/typing.rst:1051 +#: library/typing.rst:1089 msgid "Special forms" msgstr "" -#: library/typing.rst:1053 +#: library/typing.rst:1091 msgid "" "These can be used as types in annotations. They all support subscription " "using ``[]``, but each has a unique syntax." msgstr "" -#: library/typing.rst:1058 +#: library/typing.rst:1096 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" -#: library/typing.rst:1060 +#: library/typing.rst:1098 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" msgstr "" -#: library/typing.rst:1062 +#: library/typing.rst:1100 msgid "The arguments must be types and there must be at least one." msgstr "" -#: library/typing.rst:1064 +#: library/typing.rst:1102 msgid "Unions of unions are flattened, e.g.::" msgstr "" -#: library/typing.rst:1068 +#: library/typing.rst:1104 +msgid "Union[Union[int, str], float] == Union[int, str, float]" +msgstr "" + +#: library/typing.rst:1106 +msgid "" +"However, this does not apply to unions referenced through a type alias, to " +"avoid forcing evaluation of the underlying :class:`TypeAliasType`::" +msgstr "" + +#: library/typing.rst:1109 +msgid "" +"type A = Union[int, str]\n" +"Union[A, float] != Union[int, str, float]" +msgstr "" + +#: library/typing.rst:1112 msgid "Unions of a single argument vanish, e.g.::" msgstr "" -#: library/typing.rst:1072 +#: library/typing.rst:1114 +msgid "Union[int] == int # The constructor actually returns int" +msgstr "" + +#: library/typing.rst:1260 msgid "Redundant arguments are skipped, e.g.::" msgstr "" -#: library/typing.rst:1076 +#: library/typing.rst:1118 +msgid "Union[int, str, int] == Union[int, str] == int | str" +msgstr "" + +#: library/typing.rst:1120 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "" -#: library/typing.rst:1080 +#: library/typing.rst:1122 +msgid "Union[int, str] == Union[str, int]" +msgstr "" + +#: library/typing.rst:1124 msgid "You cannot subclass or instantiate a ``Union``." msgstr "" -#: library/typing.rst:1082 +#: library/typing.rst:1126 msgid "You cannot write ``Union[X][Y]``." msgstr "" -#: library/typing.rst:1084 +#: library/typing.rst:1128 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "" -#: library/typing.rst:1087 +#: library/typing.rst:1131 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" -#: library/typing.rst:1093 +#: library/typing.rst:1135 +msgid "" +":class:`types.UnionType` is now an alias for :class:`Union`, and both " +"``Union[int, str]`` and ``int | str`` create instances of the same class. To " +"check whether an object is a ``Union`` at runtime, use ``isinstance(obj, " +"Union)``. For compatibility with earlier versions of Python, use " +"``get_origin(obj) is typing.Union or get_origin(obj) is types.UnionType``." +msgstr "" + +#: library/typing.rst:1145 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "" -#: library/typing.rst:1095 +#: library/typing.rst:1147 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " @@ -1033,24 +1656,36 @@ msgid "" "optional. For example::" msgstr "" -#: library/typing.rst:1103 +#: library/typing.rst:1152 +msgid "" +"def foo(arg: int = 0) -> None:\n" +" ..." +msgstr "" + +#: library/typing.rst:1155 msgid "" "On the other hand, if an explicit value of ``None`` is allowed, the use of " "``Optional`` is appropriate, whether the argument is optional or not. For " "example::" msgstr "" -#: library/typing.rst:1110 +#: library/typing.rst:1159 +msgid "" +"def foo(arg: Optional[int] = None) -> None:\n" +" ..." +msgstr "" + +#: library/typing.rst:1162 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." msgstr "" -#: library/typing.rst:1116 +#: library/typing.rst:1168 msgid "Special form for annotating higher-order functions." msgstr "" -#: library/typing.rst:1118 +#: library/typing.rst:1172 msgid "" "``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " @@ -1061,7 +1696,7 @@ msgid "" "``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." msgstr "" -#: library/typing.rst:1127 +#: library/typing.rst:1181 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -1072,38 +1707,127 @@ msgid "" "passed in::" msgstr "" -#: library/typing.rst:1925 +#: library/typing.rst:1189 +msgid "" +"from collections.abc import Callable\n" +"from threading import Lock\n" +"from typing import Concatenate\n" +"\n" +"# Use this lock to ensure that only one thread is executing a function\n" +"# at any time.\n" +"my_lock = Lock()\n" +"\n" +"def with_lock[**P, R](f: Callable[Concatenate[Lock, P], R]) -> Callable[P, " +"R]:\n" +" '''A type-safe decorator which provides a lock.'''\n" +" def inner(*args: P.args, **kwargs: P.kwargs) -> R:\n" +" # Provide the lock as the first argument.\n" +" return f(my_lock, *args, **kwargs)\n" +" return inner\n" +"\n" +"@with_lock\n" +"def sum_threadsafe(lock: Lock, numbers: list[float]) -> float:\n" +" '''Add a list of numbers together in a thread-safe manner.'''\n" +" with lock:\n" +" return sum(numbers)\n" +"\n" +"# We don't need to pass in the lock ourselves thanks to the decorator.\n" +"sum_threadsafe([1.1, 2.2, 3.3])" +msgstr "" + +#: library/typing.rst:2218 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr "" -#: library/typing.rst:1165 +#: library/typing.rst:1219 msgid ":class:`ParamSpec`" msgstr "" -#: library/typing.rst:1928 +#: library/typing.rst:2221 msgid ":ref:`annotating-callables`" msgstr "" -#: library/typing.rst:1170 +#: library/typing.rst:1224 msgid "Special typing form to define \"literal types\"." msgstr "" -#: library/typing.rst:1172 +#: library/typing.rst:1226 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" -#: library/typing.rst:1188 +#: library/typing.rst:1232 +msgid "" +"def validate_simple(data: Any) -> Literal[True]: # always returns True\n" +" ...\n" +"\n" +"type Mode = Literal['r', 'rb', 'w', 'wb']\n" +"def open_helper(file: str, mode: Mode) -> str:\n" +" ...\n" +"\n" +"open_helper('/some/path', 'r') # Passes type check\n" +"open_helper('/other/path', 'typo') # Error in type checker" +msgstr "" + +#: library/typing.rst:1242 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " "restrictions. See :pep:`586` for more details about literal types." msgstr "" -#: library/typing.rst:1194 +#: library/typing.rst:1246 +msgid "Additional details:" +msgstr "" + +#: library/typing.rst:1248 +msgid "The arguments must be literal values and there must be at least one." +msgstr "" + +#: library/typing.rst:1250 +msgid "Nested ``Literal`` types are flattened, e.g.::" +msgstr "" + +#: library/typing.rst:1252 +msgid "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" +msgstr "" + +#: library/typing.rst:1254 +msgid "" +"However, this does not apply to ``Literal`` types referenced through a type " +"alias, to avoid forcing evaluation of the underlying :class:`TypeAliasType`::" +msgstr "" + +#: library/typing.rst:1257 +msgid "" +"type A = Literal[1, 2]\n" +"assert Literal[A, 3] != Literal[1, 2, 3]" +msgstr "" + +#: library/typing.rst:1262 +msgid "assert Literal[1, 2, 1] == Literal[1, 2]" +msgstr "" + +#: library/typing.rst:1264 +msgid "When comparing literals, the argument order is ignored, e.g.::" +msgstr "" + +#: library/typing.rst:1266 +msgid "assert Literal[1, 2] == Literal[2, 1]" +msgstr "" + +#: library/typing.rst:1268 +msgid "You cannot subclass or instantiate a ``Literal``." +msgstr "" + +#: library/typing.rst:1270 +msgid "You cannot write ``Literal[X][Y]``." +msgstr "" + +#: library/typing.rst:1274 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -1111,22 +1835,29 @@ msgid "" "their parameters are not :term:`hashable`." msgstr "" -#: library/typing.rst:1202 +#: library/typing.rst:1282 msgid "Special type construct to mark class variables." msgstr "" -#: library/typing.rst:1204 +#: library/typing.rst:1284 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " "and should not be set on instances of that class. Usage::" msgstr "" -#: library/typing.rst:1212 +#: library/typing.rst:1288 +msgid "" +"class Starship:\n" +" stats: ClassVar[dict[str, int]] = {} # class variable\n" +" damage: int = 10 # instance variable" +msgstr "" + +#: library/typing.rst:1292 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr "" -#: library/typing.rst:1214 +#: library/typing.rst:1294 msgid "" ":data:`ClassVar` is not a class itself, and should not be used with :func:" "`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " @@ -1134,47 +1865,99 @@ msgid "" "example, a type checker might flag the following code as an error::" msgstr "" -#: library/typing.rst:1228 +#: library/typing.rst:1300 +msgid "" +"enterprise_d = Starship(3000)\n" +"enterprise_d.stats = {} # Error, setting class variable on instance\n" +"Starship.stats = {} # This is OK" +msgstr "" + +#: library/typing.rst:1308 +msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." +msgstr "" + +#: library/typing.rst:1312 msgid "Special typing construct to indicate final names to type checkers." msgstr "" -#: library/typing.rst:1230 +#: library/typing.rst:1314 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." msgstr "" -#: library/typing.rst:2845 +#: library/typing.rst:1319 +msgid "" +"MAX_SIZE: Final = 9000\n" +"MAX_SIZE += 1 # Error reported by type checker\n" +"\n" +"class Connection:\n" +" TIMEOUT: Final[int] = 10\n" +"\n" +"class FastConnector(Connection):\n" +" TIMEOUT = 1 # Error reported by type checker" +msgstr "" + +#: library/typing.rst:3241 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" -#: library/typing.rst:1251 +#: library/typing.rst:1335 +msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." +msgstr "" + +#: library/typing.rst:1339 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "" -#: library/typing.rst:1253 +#: library/typing.rst:1341 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." msgstr "" -#: library/typing.rst:1260 +#: library/typing.rst:1348 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "" -#: library/typing.rst:1263 +#: library/typing.rst:1351 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "" -#: library/typing.rst:1269 +#: library/typing.rst:1357 +msgid "" +"A special typing construct to mark an item of a :class:`TypedDict` as read-" +"only." +msgstr "" + +#: library/typing.rst:1361 +msgid "" +"class Movie(TypedDict):\n" +" title: ReadOnly[str]\n" +" year: int\n" +"\n" +"def mutate_movie(m: Movie) -> None:\n" +" m[\"year\"] = 1999 # allowed\n" +" m[\"title\"] = \"The Matrix\" # typechecker error" +msgstr "" + +#: library/typing.rst:1369 +msgid "There is no runtime checking for this property." +msgstr "" + +#: library/typing.rst:1371 +msgid "See :class:`TypedDict` and :pep:`705` for more details." +msgstr "" + +#: library/typing.rst:1377 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: library/typing.rst:1271 +#: library/typing.rst:1379 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -1182,7 +1965,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: library/typing.rst:1276 +#: library/typing.rst:1384 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -1191,17 +1974,17 @@ msgid "" "system." msgstr "" -#: library/typing.rst:1282 +#: library/typing.rst:1390 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " -"``x``. In this way, ``Annotated`` differs from the :func:`@no_type_check " -"` decorator, which can also be used for adding annotations " -"outside the scope of the typing system, but completely disables typechecking " -"for a function or class." +"``x``. In this way, ``Annotated`` differs from the :deco:`no_type_check` " +"decorator, which can also be used for adding annotations outside the scope " +"of the typing system, but completely disables typechecking for a function or " +"class." msgstr "" -#: library/typing.rst:1289 +#: library/typing.rst:1397 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -1209,177 +1992,399 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: library/typing.rst:1297 +#: library/typing.rst:1405 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: library/typing.rst:1310 -msgid "Details of the syntax:" +#: library/typing.rst:1408 +msgid "" +"@dataclass\n" +"class ValueRange:\n" +" lo: int\n" +" hi: int\n" +"\n" +"T1 = Annotated[int, ValueRange(-10, 5)]\n" +"T2 = Annotated[T1, ValueRange(-20, 3)]" msgstr "" -#: library/typing.rst:1312 -msgid "The first argument to ``Annotated`` must be a valid type" +#: library/typing.rst:1418 +msgid "" +"The first argument to ``Annotated`` must be a valid type. Multiple metadata " +"elements can be supplied as ``Annotated`` supports variadic arguments. The " +"order of the metadata elements is preserved and matters for equality checks::" msgstr "" -#: library/typing.rst:1314 +#: library/typing.rst:1422 msgid "" -"Multiple metadata elements can be supplied (``Annotated`` supports variadic " -"arguments)::" +"@dataclass\n" +"class ctype:\n" +" kind: str\n" +"\n" +"a1 = Annotated[int, ValueRange(3, 10), ctype(\"char\")]\n" +"a2 = Annotated[int, ctype(\"char\"), ValueRange(3, 10)]\n" +"\n" +"assert a1 != a2 # Order matters" msgstr "" -#: library/typing.rst:1323 +#: library/typing.rst:1431 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: library/typing.rst:1327 +#: library/typing.rst:1435 +msgid "" +"Nested ``Annotated`` types are flattened. The order of the metadata elements " +"starts with the innermost annotation::" +msgstr "" + +#: library/typing.rst:1438 msgid "" -"``Annotated`` must be subscripted with at least two arguments " -"( ``Annotated[int]`` is not valid)" +"assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " +"Annotated[\n" +" int, ValueRange(3, 10), ctype(\"char\")\n" +"]" msgstr "" -#: library/typing.rst:1330 +#: library/typing.rst:1442 msgid "" -"The order of the metadata elements is preserved and matters for equality " -"checks::" +"However, this does not apply to ``Annotated`` types referenced through a " +"type alias, to avoid forcing evaluation of the underlying :class:" +"`TypeAliasType`::" msgstr "" -#: library/typing.rst:1337 +#: library/typing.rst:1445 msgid "" -"Nested ``Annotated`` types are flattened. The order of the metadata elements " -"starts with the innermost annotation::" +"type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" +"assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" +" int, ValueRange(3, 10), ctype(\"char\")\n" +"]" msgstr "" -#: library/typing.rst:1344 +#: library/typing.rst:1450 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: library/typing.rst:1350 +#: library/typing.rst:1452 +msgid "" +"assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" +" int, ValueRange(3, 10), ValueRange(3, 10)\n" +"]" +msgstr "" + +#: library/typing.rst:1456 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: library/typing.rst:1364 +#: library/typing.rst:1458 +msgid "" +"@dataclass\n" +"class MaxLen:\n" +" value: int\n" +"\n" +"type Vec[T] = Annotated[list[tuple[T, T]], MaxLen(10)]\n" +"\n" +"# When used in a type annotation, a type checker will treat \"V\" the same " +"as\n" +"# ``Annotated[list[tuple[int, int]], MaxLen(10)]``:\n" +"type V = Vec[int]" +msgstr "" + +#: library/typing.rst:1470 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: library/typing.rst:1368 -msgid "This would be equivalent to::" +#: library/typing.rst:1472 +msgid "" +"type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " +"Ann1] # NOT valid" msgstr "" -#: library/typing.rst:1372 +#: library/typing.rst:1474 msgid "" -"where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " -"invalid: only one type should be passed to Annotated." +"where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " +"as only one type should be passed to Annotated." msgstr "" -#: library/typing.rst:1375 +#: library/typing.rst:1477 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: library/typing.rst:1388 +#: library/typing.rst:1480 +msgid "" +">>> from typing import Annotated, get_type_hints\n" +">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" +"...\n" +">>> get_type_hints(func)\n" +"{'x': , 'return': }\n" +">>> get_type_hints(func, include_extras=True)\n" +"{'x': typing.Annotated[int, 'metadata'], 'return': }" +msgstr "" + +#: library/typing.rst:1490 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: library/typing.rst:1402 +#: library/typing.rst:1493 +msgid "" +">>> from typing import Annotated\n" +">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" +">>> X\n" +"typing.Annotated[int, 'very', 'important', 'metadata']\n" +">>> X.__metadata__\n" +"('very', 'important', 'metadata')" +msgstr "" + +#: library/typing.rst:1502 +msgid "" +"If you want to retrieve the original type wrapped by ``Annotated``, use the :" +"attr:`!__origin__` attribute:" +msgstr "" + +#: library/typing.rst:1505 +msgid "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" +msgstr "" + +#: library/typing.rst:1512 +msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" +msgstr "" + +#: library/typing.rst:1514 +msgid "" +">>> get_origin(Password)\n" +"typing.Annotated" +msgstr "" + +#: library/typing.rst:1521 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: library/typing.rst:1403 +#: library/typing.rst:1522 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: library/typing.rst:1410 -msgid "Special typing construct for marking user-defined type guard functions." +#: library/typing.rst:1613 +msgid "" +"Special typing construct for marking user-defined type predicate functions." msgstr "" -#: library/typing.rst:1412 +#: library/typing.rst:1531 msgid "" -"``TypeGuard`` can be used to annotate the return type of a user-defined type " -"guard function. ``TypeGuard`` only accepts a single type argument. At " -"runtime, functions marked this way should return a boolean." +"``TypeIs`` can be used to annotate the return type of a user-defined type " +"predicate function. ``TypeIs`` only accepts a single type argument. At " +"runtime, functions marked this way should return a boolean and take at least " +"one positional argument." msgstr "" -#: library/typing.rst:1416 +#: library/typing.rst:1536 msgid "" -"``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static " +"``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " "program's code flow. Usually type narrowing is done by analyzing " "conditional code flow and applying the narrowing to a block of code. The " -"conditional expression here is sometimes referred to as a \"type guard\"::" +"conditional expression here is sometimes referred to as a \"type " +"predicate\"::" msgstr "" -#: library/typing.rst:1431 +#: library/typing.rst:1542 +msgid "" +"def is_str(val: str | float):\n" +" # \"isinstance\" type predicate\n" +" if isinstance(val, str):\n" +" # Type of ``val`` is narrowed to ``str``\n" +" ...\n" +" else:\n" +" # Else, type of ``val`` is narrowed to ``float``.\n" +" ..." +msgstr "" + +#: library/typing.rst:1551 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " -"type guard. Such a function should use ``TypeGuard[...]`` as its return " -"type to alert static type checkers to this intention." +"type predicate. Such a function should use ``TypeIs[...]`` or :data:" +"`TypeGuard` as its return type to alert static type checkers to this " +"intention. ``TypeIs`` usually has more intuitive behavior than " +"``TypeGuard``, but it cannot be used when the input and output types are " +"incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " +"does not return ``True`` for all instances of the narrowed type." msgstr "" -#: library/typing.rst:1435 +#: library/typing.rst:1559 msgid "" -"Using ``-> TypeGuard`` tells the static type checker that for a given " -"function:" +"Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " +"given function:" msgstr "" -#: library/typing.rst:1438 +#: library/typing.rst:1623 msgid "The return value is a boolean." msgstr "" -#: library/typing.rst:1439 +#: library/typing.rst:1563 msgid "" -"If the return value is ``True``, the type of its argument is the type inside " -"``TypeGuard``." +"If the return value is ``True``, the type of its argument is the " +"intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: library/typing.rst:1456 +#: library/typing.rst:1565 msgid "" -"If ``is_str_list`` is a class or instance method, then the type in " -"``TypeGuard`` maps to the type of the second parameter after ``cls`` or " -"``self``." +"If the return value is ``False``, the type of its argument is narrowed to " +"exclude ``NarrowedType``." msgstr "" -#: library/typing.rst:1460 +#: library/typing.rst:1570 msgid "" -"In short, the form ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...``, means " -"that if ``foo(arg)`` returns ``True``, then ``arg`` narrows from ``TypeA`` " -"to ``TypeB``." +"from typing import assert_type, final, TypeIs\n" +"\n" +"class Parent: pass\n" +"class Child(Parent): pass\n" +"@final\n" +"class Unrelated: pass\n" +"\n" +"def is_parent(val: object) -> TypeIs[Parent]:\n" +" return isinstance(val, Parent)\n" +"\n" +"def run(arg: Child | Unrelated):\n" +" if is_parent(arg):\n" +" # Type of ``arg`` is narrowed to the intersection\n" +" # of ``Parent`` and ``Child``, which is equivalent to\n" +" # ``Child``.\n" +" assert_type(arg, Child)\n" +" else:\n" +" # Type of ``arg`` is narrowed to exclude ``Parent``,\n" +" # so only ``Unrelated`` is left.\n" +" assert_type(arg, Unrelated)" msgstr "" -#: library/typing.rst:1466 +#: library/typing.rst:1591 msgid "" -"``TypeB`` need not be a narrower form of ``TypeA`` -- it can even be a wider " -"form. The main reason is to allow for things like narrowing ``list[object]`` " -"to ``list[str]`` even though the latter is not a subtype of the former, " -"since ``list`` is invariant. The responsibility of writing type-safe type " -"guards is left to the user." +"The type inside ``TypeIs`` must be consistent with the type of the " +"function's argument; if it is not, static type checkers will raise an " +"error. An incorrectly written ``TypeIs`` function can lead to unsound " +"behavior in the type system; it is the user's responsibility to write such " +"functions in a type-safe manner." msgstr "" -#: library/typing.rst:1472 +#: library/typing.rst:1597 +msgid "" +"If a ``TypeIs`` function is a class or instance method, then the type in " +"``TypeIs`` maps to the type of the second parameter (after ``cls`` or " +"``self``)." +msgstr "" + +#: library/typing.rst:1601 +msgid "" +"In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " +"if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " +"and if it returns ``False``, it is not an instance of ``TypeB``." +msgstr "" + +#: library/typing.rst:1605 +msgid "" +"``TypeIs`` also works with type variables. For more information, see :pep:" +"`742` (Narrowing types with ``TypeIs``)." +msgstr "" + +#: library/typing.rst:1615 +msgid "" +"Type predicate functions are user-defined functions that return whether " +"their argument is an instance of a particular type. ``TypeGuard`` works " +"similarly to :data:`TypeIs`, but has subtly different effects on type " +"checking behavior (see below)." +msgstr "" + +#: library/typing.rst:1620 +msgid "" +"Using ``-> TypeGuard`` tells the static type checker that for a given " +"function:" +msgstr "" + +#: library/typing.rst:1624 +msgid "" +"If the return value is ``True``, the type of its argument is the type inside " +"``TypeGuard``." +msgstr "" + +#: library/typing.rst:1627 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: library/typing.rst:1479 +#: library/typing.rst:1631 +msgid "" +"def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" +" '''Determines whether all objects in the list are strings'''\n" +" return all(isinstance(x, str) for x in val)\n" +"\n" +"def func1(val: list[object]):\n" +" if is_str_list(val):\n" +" # Type of ``val`` is narrowed to ``list[str]``.\n" +" print(\" \".join(val))\n" +" else:\n" +" # Type of ``val`` remains as ``list[object]``.\n" +" print(\"Not a list of strings!\")" +msgstr "" + +#: library/typing.rst:1643 +msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" +msgstr "" + +#: library/typing.rst:1645 +msgid "" +"``TypeIs`` requires the narrowed type to be a subtype of the input type, " +"while ``TypeGuard`` does not. The main reason is to allow for things like " +"narrowing ``list[object]`` to ``list[str]`` even though the latter is not a " +"subtype of the former, since ``list`` is invariant." +msgstr "" + +#: library/typing.rst:1649 +msgid "" +"When a ``TypeGuard`` function returns ``True``, type checkers narrow the " +"type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " +"function returns ``True``, type checkers can infer a more precise type " +"combining the previously known type of the variable with the ``TypeIs`` " +"type. (Technically, this is known as an intersection type.)" +msgstr "" + +#: library/typing.rst:1653 +msgid "" +"When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " +"the type of the variable at all. When a ``TypeIs`` function returns " +"``False``, type checkers can narrow the type of the variable to exclude the " +"``TypeIs`` type." +msgstr "" + +#: library/typing.rst:1662 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: library/typing.rst:1481 +#: library/typing.rst:1664 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: library/typing.rst:1490 +#: library/typing.rst:1668 +msgid "" +"Ts = TypeVarTuple('Ts')\n" +"tup: tuple[*Ts]\n" +"# Effectively does:\n" +"tup: tuple[Unpack[Ts]]" +msgstr "" + +#: library/typing.rst:1673 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -1387,29 +2392,53 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: library/typing.rst:1504 +#: library/typing.rst:1679 +msgid "" +"# In older versions of Python, TypeVarTuple and Unpack\n" +"# are located in the `typing_extensions` backports package.\n" +"from typing_extensions import TypeVarTuple, Unpack\n" +"\n" +"Ts = TypeVarTuple('Ts')\n" +"tup: tuple[*Ts] # Syntax error on Python <= 3.10!\n" +"tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" +msgstr "" + +#: library/typing.rst:1687 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: library/typing.rst:1517 +#: library/typing.rst:1690 +msgid "" +"from typing import TypedDict, Unpack\n" +"\n" +"class Movie(TypedDict):\n" +" name: str\n" +" year: int\n" +"\n" +"# This function expects two keyword arguments - `name` of type `str`\n" +"# and `year` of type `int`.\n" +"def foo(**kwargs: Unpack[Movie]): ..." +msgstr "" + +#: library/typing.rst:1700 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: library/typing.rst:1522 +#: library/typing.rst:1705 msgid "Building generic types and type aliases" msgstr "" -#: library/typing.rst:1524 +#: library/typing.rst:1707 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: library/typing.rst:1528 +#: library/typing.rst:1711 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -1417,62 +2446,115 @@ msgid "" "syntax, as documented below." msgstr "" -#: library/typing.rst:1535 +#: library/typing.rst:1718 msgid "Abstract base class for generic types." msgstr "" -#: library/typing.rst:1537 +#: library/typing.rst:1720 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: library/typing.rst:1545 +#: library/typing.rst:1723 +msgid "" +"class Mapping[KT, VT]:\n" +" def __getitem__(self, key: KT) -> VT:\n" +" ...\n" +" # Etc." +msgstr "" + +#: library/typing.rst:1728 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: library/typing.rst:1549 +#: library/typing.rst:1732 msgid "This class can then be used as follows::" msgstr "" -#: library/typing.rst:1557 +#: library/typing.rst:1734 +msgid "" +"def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" +" try:\n" +" return mapping[key]\n" +" except KeyError:\n" +" return default" +msgstr "" + +#: library/typing.rst:1740 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: library/typing.rst:1560 +#: library/typing.rst:1743 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: library/typing.rst:1577 +#: library/typing.rst:1748 +msgid "" +"KT = TypeVar('KT')\n" +"VT = TypeVar('VT')\n" +"\n" +"class Mapping(Generic[KT, VT]):\n" +" def __getitem__(self, key: KT) -> VT:\n" +" ...\n" +" # Etc." +msgstr "" + +#: library/typing.rst:1760 msgid "Type variable." msgstr "" -#: library/typing.rst:1579 +#: library/typing.rst:1762 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: library/typing.rst:1587 +#: library/typing.rst:1767 msgid "" -"This syntax can also be used to create bound and constrained type variables::" +"class Sequence[T]: # T is a TypeVar\n" +" ..." msgstr "" -#: library/typing.rst:1597 +#: library/typing.rst:1770 +msgid "" +"This syntax can also be used to create bounded and constrained type " +"variables::" +msgstr "" + +#: library/typing.rst:1773 +msgid "" +"class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" +" ... # we can say that S is \"bounded by `str`\"\n" +"\n" +"\n" +"class StrOrBytesSequence[A: (str, bytes)]: # A is a TypeVar constrained to " +"str or bytes\n" +" ..." +msgstr "" + +#: library/typing.rst:1780 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: library/typing.rst:1603 +#: library/typing.rst:1782 +msgid "" +"T = TypeVar('T') # Can be anything\n" +"S = TypeVar('S', bound=str) # Can be any subtype of str\n" +"A = TypeVar('A', str, bytes) # Must be exactly str or bytes" +msgstr "" + +#: library/typing.rst:1786 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -1480,13 +2562,31 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: library/typing.rst:1624 +#: library/typing.rst:1792 msgid "" -"Note that type variables can be *bound*, *constrained*, or neither, but " -"cannot be both bound *and* constrained." +"def repeat[T](x: T, n: int) -> Sequence[T]:\n" +" \"\"\"Return a list containing n references to x.\"\"\"\n" +" return [x]*n\n" +"\n" +"\n" +"def print_capitalized[S: str](x: S) -> S:\n" +" \"\"\"Print x capitalized, and return x.\"\"\"\n" +" print(x.capitalize())\n" +" return x\n" +"\n" +"\n" +"def concatenate[A: (str, bytes)](x: A, y: A) -> A:\n" +" \"\"\"Add two strings or bytes objects together.\"\"\"\n" +" return x + y" msgstr "" -#: library/typing.rst:1627 +#: library/typing.rst:1807 +msgid "" +"Note that type variables can be *bounded*, *constrained*, or neither, but " +"cannot be both bounded *and* constrained." +msgstr "" + +#: library/typing.rst:1810 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -1496,92 +2596,194 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: library/typing.rst:1635 +#: library/typing.rst:1818 +msgid "" +"Bounded type variables and constrained type variables have different " +"semantics in several important ways. Using a *bounded* type variable means " +"that the ``TypeVar`` will be solved using the most specific type possible::" +msgstr "" + +#: library/typing.rst:1822 +msgid "" +"x = print_capitalized('a string')\n" +"reveal_type(x) # revealed type is str\n" +"\n" +"class StringSubclass(str):\n" +" pass\n" +"\n" +"y = print_capitalized(StringSubclass('another string'))\n" +"reveal_type(y) # revealed type is StringSubclass\n" +"\n" +"z = print_capitalized(45) # error: int is not a subtype of str" +msgstr "" + +#: library/typing.rst:1833 msgid "" -"Bound type variables and constrained type variables have different semantics " -"in several important ways. Using a *bound* type variable means that the " -"``TypeVar`` will be solved using the most specific type possible::" +"The upper bound of a type variable can be a concrete type, abstract type " +"(ABC or Protocol), or even a union of types::" msgstr "" -#: library/typing.rst:1650 +#: library/typing.rst:1836 msgid "" -"Type variables can be bound to concrete types, abstract types (ABCs or " -"protocols), and even unions of types::" +"# Can be anything with an __abs__ method\n" +"def print_abs[T: SupportsAbs](arg: T) -> None:\n" +" print(\"Absolute value:\", abs(arg))\n" +"\n" +"U = TypeVar('U', bound=str|bytes) # Can be any subtype of the union str|" +"bytes\n" +"V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: library/typing.rst:1662 +#: library/typing.rst:1845 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: library/typing.rst:1673 +#: library/typing.rst:1848 +msgid "" +"a = concatenate('one', 'two')\n" +"reveal_type(a) # revealed type is str\n" +"\n" +"b = concatenate(StringSubclass('one'), StringSubclass('two'))\n" +"reveal_type(b) # revealed type is str, despite StringSubclass being passed " +"in\n" +"\n" +"c = concatenate('one', b'two') # error: type variable 'A' can be either str " +"or bytes in a function call, but not both" +msgstr "" + +#: library/typing.rst:1856 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: library/typing.rst:1677 +#: library/typing.rst:1860 msgid "The name of the type variable." msgstr "" -#: library/typing.rst:1681 +#: library/typing.rst:1864 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: library/typing.rst:1685 +#: library/typing.rst:1868 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: library/typing.rst:1689 +#: library/typing.rst:1872 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: library/typing.rst:1695 -msgid "The bound of the type variable, if any." +#: library/typing.rst:1878 +msgid "The upper bound of the type variable, if any." msgstr "" -#: library/typing.rst:1699 +#: library/typing.rst:1882 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: library/typing.rst:1705 +#: library/typing.rst:1888 +msgid "" +"An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` " +"attribute. When called directly, this method supports only the :attr:" +"`~annotationlib.Format.VALUE` format, which is equivalent to accessing the :" +"attr:`~TypeVar.__bound__` attribute directly, but the method object can be " +"passed to :func:`annotationlib.call_evaluate_function` to evaluate the value " +"in a different format." +msgstr "" + +#: library/typing.rst:1898 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: library/typing.rst:1709 +#: library/typing.rst:1902 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: library/typing.rst:1715 +#: library/typing.rst:1908 +msgid "" +"An :term:`evaluate function` corresponding to the :attr:`~TypeVar." +"__constraints__` attribute. When called directly, this method supports only " +"the :attr:`~annotationlib.Format.VALUE` format, which is equivalent to " +"accessing the :attr:`~TypeVar.__constraints__` attribute directly, but the " +"method object can be passed to :func:`annotationlib.call_evaluate_function` " +"to evaluate the value in a different format." +msgstr "" + +#: library/typing.rst:1918 +msgid "" +"The default value of the type variable, or :data:`typing.NoDefault` if it " +"has no default." +msgstr "" + +#: library/typing.rst:1925 +msgid "" +"An :term:`evaluate function` corresponding to the :attr:`~TypeVar." +"__default__` attribute. When called directly, this method supports only the :" +"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " +"the :attr:`~TypeVar.__default__` attribute directly, but the method object " +"can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " +"the value in a different format." +msgstr "" + +#: library/typing.rst:1935 +msgid "" +"Return whether or not the type variable has a default value. This is " +"equivalent to checking whether :attr:`__default__` is not the :data:`typing." +"NoDefault` singleton, except that it does not force evaluation of the :ref:" +"`lazily evaluated ` default value." +msgstr "" + +#: library/typing.rst:1944 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: library/typing.rst:1723 +#: library/typing.rst:2099 library/typing.rst:2211 +msgid "Support for default values was added." +msgstr "" + +#: library/typing.rst:1956 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: library/typing.rst:1726 +#: library/typing.rst:1959 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: library/typing.rst:1732 +#: library/typing.rst:1962 +msgid "" +"def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " +"T]:\n" +" return (*tup[1:], tup[0])" +msgstr "" + +#: library/typing.rst:1965 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: library/typing.rst:1740 +#: library/typing.rst:1967 +msgid "" +"T = TypeVar(\"T\")\n" +"Ts = TypeVarTuple(\"Ts\")\n" +"\n" +"def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" +" return (*tup[1:], tup[0])" +msgstr "" + +#: library/typing.rst:1973 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -1589,7 +2791,27 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: library/typing.rst:1762 +#: library/typing.rst:1978 +msgid "" +"# T is bound to int, Ts is bound to ()\n" +"# Return value is (1,), which has type tuple[int]\n" +"move_first_element_to_last(tup=(1,))\n" +"\n" +"# T is bound to int, Ts is bound to (str,)\n" +"# Return value is ('spam', 1), which has type tuple[str, int]\n" +"move_first_element_to_last(tup=(1, 'spam'))\n" +"\n" +"# T is bound to int, Ts is bound to (str, float)\n" +"# Return value is ('spam', 3.0, 1), which has type tuple[str, float, int]\n" +"move_first_element_to_last(tup=(1, 'spam', 3.0))\n" +"\n" +"# This fails to type check (and fails at runtime)\n" +"# because tuple[()] is not compatible with tuple[T, *Ts]\n" +"# (at least one element is required)\n" +"move_first_element_to_last(tup=())" +msgstr "" + +#: library/typing.rst:1995 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -1599,36 +2821,83 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: library/typing.rst:1770 +#: library/typing.rst:2003 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: library/typing.rst:1777 +#: library/typing.rst:2006 +msgid "" +"x: Ts # Not valid\n" +"x: tuple[Ts] # Not valid\n" +"x: tuple[*Ts] # The correct way to do it" +msgstr "" + +#: library/typing.rst:2010 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: library/typing.rst:1785 +#: library/typing.rst:2013 +msgid "" +"class Array[*Shape]:\n" +" def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" +" def __abs__(self) -> \"Array[*Shape]\": ...\n" +" def get_shape(self) -> tuple[*Shape]: ..." +msgstr "" + +#: library/typing.rst:2018 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: library/typing.rst:1801 +#: library/typing.rst:2020 +msgid "" +"class Array[DType, *Shape]: # This is fine\n" +" pass\n" +"\n" +"class Array2[*Shape, DType]: # This would also be fine\n" +" pass\n" +"\n" +"class Height: ...\n" +"class Width: ...\n" +"\n" +"float_array_1d: Array[float, Height] = Array() # Totally fine\n" +"int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" +msgstr "" + +#: library/typing.rst:2034 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: library/typing.rst:1808 +#: library/typing.rst:2037 +msgid "" +"x: tuple[*Ts, *Ts] # Not valid\n" +"class Array[*Shape, *Shape]: # Not valid\n" +" pass" +msgstr "" + +#: library/typing.rst:2041 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: library/typing.rst:1818 +#: library/typing.rst:2044 +msgid "" +"def call_soon[*Ts](\n" +" callback: Callable[[*Ts], None],\n" +" *args: *Ts\n" +") -> None:\n" +" ...\n" +" callback(*args)" +msgstr "" + +#: library/typing.rst:2051 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -1637,39 +2906,71 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: library/typing.rst:1825 +#: library/typing.rst:2058 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: library/typing.rst:1829 +#: library/typing.rst:2062 msgid "The name of the type variable tuple." msgstr "" -#: library/typing.rst:1835 +#: library/typing.rst:2066 +msgid "" +"The default value of the type variable tuple, or :data:`typing.NoDefault` if " +"it has no default." +msgstr "" + +#: library/typing.rst:2073 +msgid "" +"An :term:`evaluate function` corresponding to the :attr:`~TypeVarTuple." +"__default__` attribute. When called directly, this method supports only the :" +"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " +"the :attr:`~TypeVarTuple.__default__` attribute directly, but the method " +"object can be passed to :func:`annotationlib.call_evaluate_function` to " +"evaluate the value in a different format." +msgstr "" + +#: library/typing.rst:2083 +msgid "" +"Return whether or not the type variable tuple has a default value. This is " +"equivalent to checking whether :attr:`__default__` is not the :data:`typing." +"NoDefault` singleton, except that it does not force evaluation of the :ref:" +"`lazily evaluated ` default value." +msgstr "" + +#: library/typing.rst:2094 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: library/typing.rst:1840 +#: library/typing.rst:2103 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: library/typing.rst:1843 +#: library/typing.rst:2106 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: library/typing.rst:1848 +#: library/typing.rst:2109 +msgid "type IntFunc[**P] = Callable[P, int]" +msgstr "" + +#: library/typing.rst:2111 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: library/typing.rst:1853 +#: library/typing.rst:2114 +msgid "P = ParamSpec('P')" +msgstr "" + +#: library/typing.rst:2116 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -1679,7 +2980,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: library/typing.rst:1860 +#: library/typing.rst:2123 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -1687,27 +2988,45 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: library/typing.rst:1880 +#: library/typing.rst:2128 +msgid "" +"from collections.abc import Callable\n" +"import logging\n" +"\n" +"def add_logging[T, **P](f: Callable[P, T]) -> Callable[P, T]:\n" +" '''A type-safe decorator to add logging to a function.'''\n" +" def inner(*args: P.args, **kwargs: P.kwargs) -> T:\n" +" logging.info(f'{f.__name__} was called')\n" +" return f(*args, **kwargs)\n" +" return inner\n" +"\n" +"@add_logging\n" +"def add_two(x: float, y: float) -> float:\n" +" '''Add two numbers together.'''\n" +" return x + y" +msgstr "" + +#: library/typing.rst:2143 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " -"use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " -"causes two problems:" +"use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " +"this causes two problems:" msgstr "" -#: library/typing.rst:1884 +#: library/typing.rst:2147 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: library/typing.rst:1886 +#: library/typing.rst:2149 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: library/typing.rst:1893 +#: library/typing.rst:2156 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -1720,11 +3039,35 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: library/typing.rst:1905 +#: library/typing.rst:2168 msgid "The name of the parameter specification." msgstr "" -#: library/typing.rst:1907 +#: library/typing.rst:2172 +msgid "" +"The default value of the parameter specification, or :data:`typing." +"NoDefault` if it has no default." +msgstr "" + +#: library/typing.rst:2179 +msgid "" +"An :term:`evaluate function` corresponding to the :attr:`~ParamSpec." +"__default__` attribute. When called directly, this method supports only the :" +"attr:`~annotationlib.Format.VALUE` format, which is equivalent to accessing " +"the :attr:`~ParamSpec.__default__` attribute directly, but the method object " +"can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " +"the value in a different format." +msgstr "" + +#: library/typing.rst:2189 +msgid "" +"Return whether or not the parameter specification has a default value. This " +"is equivalent to checking whether :attr:`__default__` is not the :data:" +"`typing.NoDefault` singleton, except that it does not force evaluation of " +"the :ref:`lazily evaluated ` default value." +msgstr "" + +#: library/typing.rst:2196 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -1733,23 +3076,23 @@ msgid "" "decided." msgstr "" -#: library/typing.rst:1917 +#: library/typing.rst:2206 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: library/typing.rst:1921 +#: library/typing.rst:2214 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: library/typing.rst:1927 +#: library/typing.rst:2220 msgid ":data:`Concatenate`" msgstr "" -#: library/typing.rst:1933 +#: library/typing.rst:2226 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -1757,71 +3100,191 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: library/typing.rst:1938 +#: library/typing.rst:2231 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: library/typing.rst:1955 +#: library/typing.rst:2234 +msgid "" +">>> from typing import ParamSpec, get_origin\n" +">>> P = ParamSpec(\"P\")\n" +">>> get_origin(P.args) is P\n" +"True\n" +">>> get_origin(P.kwargs) is P\n" +"True" +msgstr "" + +#: library/typing.rst:2248 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: library/typing.rst:1969 +#: library/typing.rst:2252 +msgid "" +">>> type Alias = int\n" +">>> type(Alias)\n" +"" +msgstr "" + +#: library/typing.rst:2262 msgid "The name of the type alias:" msgstr "" -#: library/typing.rst:1979 -msgid "The module in which the type alias was defined::" +#: library/typing.rst:2264 +msgid "" +">>> type Alias = int\n" +">>> Alias.__name__\n" +"'Alias'" +msgstr "" + +#: library/typing.rst:2272 +msgid "The name of the module in which the type alias was defined::" msgstr "" -#: library/typing.rst:1987 +#: library/typing.rst:2274 +msgid "" +">>> type Alias = int\n" +">>> Alias.__module__\n" +"'__main__'" +msgstr "" + +#: library/typing.rst:2280 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: library/typing.rst:2001 +#: library/typing.rst:2283 +msgid "" +">>> type ListOrSet[T] = list[T] | set[T]\n" +">>> ListOrSet.__type_params__\n" +"(T,)\n" +">>> type NotGeneric = int\n" +">>> NotGeneric.__type_params__\n" +"()" +msgstr "" + +#: library/typing.rst:2294 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: library/typing.rst:2019 +#: library/typing.rst:2298 +msgid "" +">>> type Mutually = Recursive\n" +">>> type Recursive = Mutually\n" +">>> Mutually\n" +"Mutually\n" +">>> Recursive\n" +"Recursive\n" +">>> Mutually.__value__\n" +"Recursive\n" +">>> Recursive.__value__\n" +"Mutually" +msgstr "" + +#: library/typing.rst:2313 +msgid "" +"An :term:`evaluate function` corresponding to the :attr:`__value__` " +"attribute. When called directly, this method supports only the :attr:" +"`~annotationlib.Format.VALUE` format, which is equivalent to accessing the :" +"attr:`__value__` attribute directly, but the method object can be passed to :" +"func:`annotationlib.call_evaluate_function` to evaluate the value in a " +"different format:" +msgstr "" + +#: library/typing.rst:2319 +msgid "" +">>> type Alias = undefined\n" +">>> Alias.__value__\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> from annotationlib import Format, call_evaluate_function\n" +">>> Alias.evaluate_value(Format.VALUE)\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" +"ForwardRef('undefined')" +msgstr "" + +#: library/typing.rst:2337 +msgid "Unpacking" +msgstr "" + +#: library/typing.rst:2338 +msgid "" +"Type aliases support star unpacking using the ``*Alias`` syntax. This is " +"equivalent to using ``Unpack[Alias]`` directly:" +msgstr "" + +#: library/typing.rst:2341 +msgid "" +">>> type Alias = tuple[int, str]\n" +">>> type Unpacked = tuple[bool, *Alias]\n" +">>> Unpacked.__value__\n" +"tuple[bool, typing.Unpack[Alias]]" +msgstr "" + +#: library/typing.rst:2352 msgid "Other special directives" msgstr "" -#: library/typing.rst:2021 +#: library/typing.rst:2354 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: library/typing.rst:2027 +#: library/typing.rst:2360 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: library/typing.rst:2106 library/typing.rst:3071 +#: library/typing.rst:2458 library/typing.rst:3563 msgid "Usage::" msgstr "" -#: library/typing.rst:2035 +#: library/typing.rst:2364 +msgid "" +"class Employee(NamedTuple):\n" +" name: str\n" +" id: int" +msgstr "" + +#: library/typing.rst:2368 msgid "This is equivalent to::" msgstr "" -#: library/typing.rst:2039 +#: library/typing.rst:2370 +msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" +msgstr "" + +#: library/typing.rst:2372 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: library/typing.rst:2048 +#: library/typing.rst:2374 +msgid "" +"class Employee(NamedTuple):\n" +" name: str\n" +" id: int = 3\n" +"\n" +"employee = Employee('Guido')\n" +"assert employee.id == 3" +msgstr "" + +#: library/typing.rst:2381 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: library/typing.rst:2050 +#: library/typing.rst:2383 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -1830,114 +3293,232 @@ msgid "" "API.)" msgstr "" -#: library/typing.rst:2056 +#: library/typing.rst:2389 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: library/typing.rst:2066 +#: library/typing.rst:2391 +msgid "" +"class Employee(NamedTuple):\n" +" \"\"\"Represents an employee.\"\"\"\n" +" name: str\n" +" id: int = 3\n" +"\n" +" def __repr__(self) -> str:\n" +" return f''" +msgstr "" + +#: library/typing.rst:2399 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: library/typing.rst:2072 +#: library/typing.rst:2401 +msgid "" +"class Group[T](NamedTuple):\n" +" key: T\n" +" group: list[T]" +msgstr "" + +#: library/typing.rst:2405 msgid "Backward-compatible usage::" msgstr "" -#: library/typing.rst:2082 +#: library/typing.rst:2407 +msgid "" +"# For creating a generic NamedTuple on Python 3.11\n" +"T = TypeVar(\"T\")\n" +"\n" +"class Group(NamedTuple, Generic[T]):\n" +" key: T\n" +" group: list[T]\n" +"\n" +"# A functional syntax is also supported\n" +"Employee = NamedTuple('Employee', [('name', str), ('id', int)])" +msgstr "" + +#: library/typing.rst:2417 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: library/typing.rst:2085 +#: library/typing.rst:2420 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: library/typing.rst:2088 +#: library/typing.rst:2423 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: library/typing.rst:2092 +#: library/typing.rst:2427 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: library/typing.rst:2096 +#: library/typing.rst:2431 msgid "Added support for generic namedtuples." msgstr "" -#: library/typing.rst:2101 +#: library/typing.rst:2434 +msgid "" +"Using :func:`super` (and the ``__class__`` :term:`closure variable`) in " +"methods of ``NamedTuple`` subclasses is unsupported and causes a :class:" +"`TypeError`." +msgstr "" + +#: library/typing.rst:2438 +msgid "" +"The undocumented keyword argument syntax for creating NamedTuple classes " +"(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " +"in 3.15. Use the class-based syntax or the functional syntax instead." +msgstr "" + +#: library/typing.rst:2443 +msgid "" +"When using the functional syntax to create a NamedTuple class, failing to " +"pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " +"deprecated. Passing ``None`` to the 'fields' parameter (``NT = " +"NamedTuple(\"NT\", None)``) is also deprecated. Both will be disallowed in " +"Python 3.15. To create a NamedTuple class with 0 fields, use ``class " +"NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." +msgstr "" + +#: library/typing.rst:2453 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: library/typing.rst:2103 +#: library/typing.rst:2455 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: library/typing.rst:2113 -msgid "The module in which the new type is defined." +#: library/typing.rst:2460 +msgid "" +"UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" +"first_user = UserId(1) # \"UserId\" returns the argument unchanged at " +"runtime" +msgstr "" + +#: library/typing.rst:2465 +msgid "The name of the module in which the new type is defined." msgstr "" -#: library/typing.rst:2117 +#: library/typing.rst:2469 msgid "The name of the new type." msgstr "" -#: library/typing.rst:2121 +#: library/typing.rst:2473 msgid "The type that the new type is based on." msgstr "" -#: library/typing.rst:2125 +#: library/typing.rst:2477 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: library/typing.rst:2130 +#: library/typing.rst:2482 msgid "Base class for protocol classes." msgstr "" -#: library/typing.rst:2132 +#: library/typing.rst:2484 msgid "Protocol classes are defined like this::" msgstr "" -#: library/typing.rst:2138 +#: library/typing.rst:2486 +msgid "" +"class Proto(Protocol):\n" +" def meth(self) -> int:\n" +" ..." +msgstr "" + +#: library/typing.rst:2490 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: library/typing.rst:2150 +#: library/typing.rst:2493 +msgid "" +"class C:\n" +" def meth(self) -> int:\n" +" return 0\n" +"\n" +"def func(x: Proto) -> int:\n" +" return x.meth()\n" +"\n" +"func(C()) # Passes static type check" +msgstr "" + +#: library/typing.rst:2502 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " "that check only the presence of given attributes, ignoring their type " -"signatures." +"signatures. Protocol classes without this decorator cannot be used as the " +"second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" -#: library/typing.rst:2155 +#: library/typing.rst:2508 msgid "Protocol classes can be generic, for example::" msgstr "" -#: library/typing.rst:2161 +#: library/typing.rst:2510 +msgid "" +"class GenProto[T](Protocol):\n" +" def meth(self) -> T:\n" +" ..." +msgstr "" + +#: library/typing.rst:2514 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: library/typing.rst:2174 +#: library/typing.rst:2517 +msgid "" +"T = TypeVar(\"T\")\n" +"\n" +"class GenProto(Protocol[T]):\n" +" def meth(self) -> T:\n" +" ..." +msgstr "" + +#: library/typing.rst:2527 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: library/typing.rst:2176 +#: library/typing.rst:2529 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " -"This raises :exc:`TypeError` when applied to a non-protocol class. This " -"allows a simple-minded structural check, very similar to \"one trick " +"This allows a simple-minded structural check, very similar to \"one trick " "ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." "Iterable`. For example::" msgstr "" -#: library/typing.rst:2196 +#: library/typing.rst:2533 +msgid "" +"@runtime_checkable\n" +"class Closable(Protocol):\n" +" def close(self): ...\n" +"\n" +"assert isinstance(open('/some/file'), Closable)\n" +"\n" +"@runtime_checkable\n" +"class Named(Protocol):\n" +" name: str\n" +"\n" +"import threading\n" +"assert isinstance(threading.Thread(name='Bob'), Named)" +msgstr "" + +#: library/typing.rst:2546 +msgid "" +"This decorator raises :exc:`TypeError` when applied to a non-protocol class." +msgstr "" + +#: library/typing.rst:2550 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -1948,7 +3529,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: library/typing.rst:2207 +#: library/typing.rst:2561 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -1956,7 +3537,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: library/typing.rst:2215 +#: library/typing.rst:2569 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -1966,22 +3547,22 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: library/typing.rst:2224 +#: library/typing.rst:2578 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " "onto a runtime-checkable protocol will still work, but will have no impact " "on :func:`isinstance` checks comparing objects to the protocol. See :ref:" -"`\"What's new in Python 3.12\" ` for more details." +"`What's new in Python 3.12 ` for more details." msgstr "" -#: library/typing.rst:2235 +#: library/typing.rst:2589 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: library/typing.rst:2238 +#: library/typing.rst:2592 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -1989,53 +3570,93 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: library/typing.rst:2254 +#: library/typing.rst:2598 msgid "" -"To allow using this feature with older versions of Python that do not " -"support :pep:`526`, ``TypedDict`` supports two additional equivalent " -"syntactic forms:" +"class Point2D(TypedDict):\n" +" x: int\n" +" y: int\n" +" label: str\n" +"\n" +"a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK\n" +"b: Point2D = {'z': 3, 'label': 'bad'} # Fails type check\n" +"\n" +"assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: library/typing.rst:2258 -msgid "Using a literal :class:`dict` as the second argument::" +#: library/typing.rst:2608 +msgid "" +"An alternative way to create a ``TypedDict`` is by using function-call " +"syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: library/typing.rst:2262 -msgid "Using keyword arguments::" +#: library/typing.rst:2611 +msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "" -#: library/typing.rst:2269 +#: library/typing.rst:2613 msgid "" -"The keyword-argument syntax is deprecated in 3.11 and will be removed in " -"3.13. It may also be unsupported by static type checkers." +"This functional syntax allows defining keys which are not valid :ref:" +"`identifiers `, for example because they are keywords or " +"contain hyphens, or when key names must not be :ref:`mangled ` like regular private names::" msgstr "" -#: library/typing.rst:2270 +#: library/typing.rst:2618 msgid "" -"The functional syntax should also be used when any of the keys are not " -"valid :ref:`identifiers `, for example because they are " -"keywords or contain hyphens. Example::" +"# raises SyntaxError\n" +"class Point2D(TypedDict):\n" +" in: int # 'in' is a keyword\n" +" x-y: int # name with hyphens\n" +"\n" +"class Definition(TypedDict):\n" +" __schema: str # mangled to `_Definition__schema`\n" +"\n" +"# OK, functional syntax\n" +"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})\n" +"Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" -#: library/typing.rst:2282 +#: library/typing.rst:2630 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: library/typing.rst:2293 +#: library/typing.rst:2633 +msgid "" +"class Point2D(TypedDict):\n" +" x: int\n" +" y: int\n" +" label: NotRequired[str]\n" +"\n" +"# Alternative syntax\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " +"NotRequired[str]})" +msgstr "" + +#: library/typing.rst:2641 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: library/typing.rst:2296 +#: library/typing.rst:2644 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: library/typing.rst:2306 +#: library/typing.rst:2647 +msgid "" +"class Point2D(TypedDict, total=False):\n" +" x: int\n" +" y: int\n" +"\n" +"# Alternative syntax\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" +msgstr "" + +#: library/typing.rst:2654 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -2043,78 +3664,152 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: library/typing.rst:2311 +#: library/typing.rst:2659 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: library/typing.rst:2326 +#: library/typing.rst:2662 +msgid "" +"class Point2D(TypedDict, total=False):\n" +" x: Required[int]\n" +" y: Required[int]\n" +" label: str\n" +"\n" +"# Alternative syntax\n" +"Point2D = TypedDict('Point2D', {\n" +" 'x': Required[int],\n" +" 'y': Required[int],\n" +" 'label': str\n" +"}, total=False)" +msgstr "" + +#: library/typing.rst:2674 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: library/typing.rst:2333 +#: library/typing.rst:2678 +msgid "" +"class Point3D(Point2D):\n" +" z: int" +msgstr "" + +#: library/typing.rst:2681 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: library/typing.rst:2341 +#: library/typing.rst:2684 +msgid "" +"class Point3D(TypedDict):\n" +" x: int\n" +" y: int\n" +" z: int" +msgstr "" + +#: library/typing.rst:2689 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: library/typing.rst:2356 +#: library/typing.rst:2692 +msgid "" +"class X(TypedDict):\n" +" x: int\n" +"\n" +"class Y(TypedDict):\n" +" y: int\n" +"\n" +"class Z(object): pass # A non-TypedDict class\n" +"\n" +"class XY(X, Y): pass # OK\n" +"\n" +"class XZ(X, Z): pass # raises TypeError" +msgstr "" + +#: library/typing.rst:2704 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: library/typing.rst:2362 +#: library/typing.rst:2706 +msgid "" +"class Group[T](TypedDict):\n" +" key: T\n" +" group: list[T]" +msgstr "" + +#: library/typing.rst:2710 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: library/typing.rst:2373 +#: library/typing.rst:2713 +msgid "" +"T = TypeVar(\"T\")\n" +"\n" +"class Group(TypedDict, Generic[T]):\n" +" key: T\n" +" group: list[T]" +msgstr "" + +#: library/typing.rst:2721 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: library/typing.rst:2379 +#: library/typing.rst:2727 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: library/typing.rst:2395 +#: library/typing.rst:2730 +msgid "" +">>> from typing import TypedDict\n" +">>> class Point2D(TypedDict): pass\n" +">>> Point2D.__total__\n" +"True\n" +">>> class Point2D(TypedDict, total=False): pass\n" +">>> Point2D.__total__\n" +"False\n" +">>> class Point3D(Point2D): pass\n" +">>> Point3D.__total__\n" +"True" +msgstr "" + +#: library/typing.rst:2743 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " -"For example, a ``TypedDict`` with ``__total__`` set to True may have keys " -"marked with :data:`NotRequired`, or it may inherit from another " +"For example, a ``TypedDict`` with ``__total__`` set to ``True`` may have " +"keys marked with :data:`NotRequired`, or it may inherit from another " "``TypedDict`` with ``total=False``. Therefore, it is generally better to " "use :attr:`__required_keys__` and :attr:`__optional_keys__` for " "introspection." msgstr "" -#: library/typing.rst:2408 +#: library/typing.rst:2756 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: library/typing.rst:2411 +#: library/typing.rst:2759 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: library/typing.rst:2414 +#: library/typing.rst:2762 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -2123,7 +3818,22 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: library/typing.rst:2439 +#: library/typing.rst:2769 +msgid "" +">>> class Point2D(TypedDict, total=False):\n" +"... x: int\n" +"... y: int\n" +"...\n" +">>> class Point3D(Point2D):\n" +"... z: int\n" +"...\n" +">>> Point3D.__required_keys__ == frozenset({'z'})\n" +"True\n" +">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" +"True" +msgstr "" + +#: library/typing.rst:2787 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -2132,130 +3842,225 @@ msgid "" "attributes may be incorrect." msgstr "" -#: library/typing.rst:2445 +#: library/typing.rst:2793 +msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" +msgstr "" + +#: library/typing.rst:2797 +msgid "" +"A :class:`frozenset` containing the names of all read-only keys. Keys are " +"read-only if they carry the :data:`ReadOnly` qualifier." +msgstr "" + +#: library/typing.rst:2804 msgid "" -"See :pep:`589` for more examples and detailed rules of using ``TypedDict``." +"A :class:`frozenset` containing the names of all mutable keys. Keys are " +"mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: library/typing.rst:2449 +#: library/typing.rst:2809 +msgid "" +"See the `TypedDict `_ section in the typing documentation for more examples and " +"detailed rules." +msgstr "" + +#: library/typing.rst:2813 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: library/typing.rst:2453 +#: library/typing.rst:2817 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: library/typing.rst:2457 +#: library/typing.rst:2820 +msgid "" +"Removed support for the keyword-argument method of creating ``TypedDict``\\ " +"s." +msgstr "" + +#: library/typing.rst:2823 +msgid "Support for the :data:`ReadOnly` qualifier was added." +msgstr "" + +#: library/typing.rst:2826 +msgid "" +"When using the functional syntax to create a TypedDict class, failing to " +"pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " +"deprecated. Passing ``None`` to the 'fields' parameter (``TD = " +"TypedDict(\"TD\", None)``) is also deprecated. Both will be disallowed in " +"Python 3.15. To create a TypedDict class with 0 fields, use ``class " +"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +msgstr "" + +#: library/typing.rst:2835 msgid "Protocols" msgstr "" -#: library/typing.rst:2459 +#: library/typing.rst:2837 msgid "" -"The following protocols are provided by the typing module. All are decorated " -"with :func:`@runtime_checkable `." +"The following protocols are provided by the :mod:`!typing` module. All are " +"decorated with :deco:`runtime_checkable`." msgstr "" -#: library/typing.rst:2464 +#: library/typing.rst:2842 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: library/typing.rst:2469 +#: library/typing.rst:2847 msgid "An ABC with one abstract method ``__bytes__``." msgstr "" -#: library/typing.rst:2473 +#: library/typing.rst:2851 msgid "An ABC with one abstract method ``__complex__``." msgstr "" -#: library/typing.rst:2477 +#: library/typing.rst:2855 msgid "An ABC with one abstract method ``__float__``." msgstr "" -#: library/typing.rst:2481 +#: library/typing.rst:2859 msgid "An ABC with one abstract method ``__index__``." msgstr "" -#: library/typing.rst:2487 +#: library/typing.rst:2865 msgid "An ABC with one abstract method ``__int__``." msgstr "" -#: library/typing.rst:2491 +#: library/typing.rst:2869 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: library/typing.rst:2495 -msgid "ABCs for working with IO" +#: library/typing.rst:2875 +msgid "ABCs and Protocols for working with I/O" msgstr "" -#: library/typing.rst:2501 +#: library/typing.rst:2881 msgid "" -"Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " +"Generic class ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " -"by :func:`open`." +"by :func:`open`. Please note that these classes are not protocols, and their " +"interface is fairly broad." +msgstr "" + +#: library/typing.rst:2887 +msgid "" +"The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler " +"alternative for argument types, when only the ``read()`` or ``write()`` " +"methods are accessed, respectively::" +msgstr "" + +#: library/typing.rst:2891 +msgid "" +"def read_and_write(reader: Reader[str], writer: Writer[bytes]):\n" +" data = reader.read()\n" +" writer.write(data.encode())" +msgstr "" + +#: library/typing.rst:2895 +msgid "" +"Also consider using :class:`collections.abc.Iterable` for iterating over the " +"lines of an input stream::" msgstr "" -#: library/typing.rst:2507 +#: library/typing.rst:2898 +msgid "" +"def read_config(stream: Iterable[str]):\n" +" for line in stream:\n" +" ..." +msgstr "" + +#: library/typing.rst:2903 msgid "Functions and decorators" msgstr "" -#: library/typing.rst:2511 +#: library/typing.rst:2907 msgid "Cast a value to a type." msgstr "" -#: library/typing.rst:2513 +#: library/typing.rst:2909 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: library/typing.rst:2520 +#: library/typing.rst:2916 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: library/typing.rst:2522 +#: library/typing.rst:2918 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: library/typing.rst:2525 +#: library/typing.rst:2921 +msgid "" +"When a static type checker encounters a call to ``assert_type()``, it emits " +"an error if the value is not of the specified type::" +msgstr "" + +#: library/typing.rst:2924 msgid "" -"When a static type checker encounters a call to ``assert_type()``, it emits " -"an error if the value is not of the specified type::" +"def greet(name: str) -> None:\n" +" assert_type(name, str) # OK, inferred type of `name` is `str`\n" +" assert_type(name, int) # type checker error" msgstr "" -#: library/typing.rst:2532 +#: library/typing.rst:2928 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: library/typing.rst:2546 +#: library/typing.rst:2931 +msgid "" +"def complex_function(arg: object):\n" +" # Do some complex type-narrowing logic,\n" +" # after which we hope the inferred type will be `int`\n" +" ...\n" +" # Test whether the type checker correctly understands our function\n" +" assert_type(arg, int)" +msgstr "" + +#: library/typing.rst:2942 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: library/typing.rst:2548 +#: library/typing.rst:2944 msgid "Example::" msgstr "" -#: library/typing.rst:2559 +#: library/typing.rst:2946 +msgid "" +"def int_or_str(arg: int | str) -> None:\n" +" match arg:\n" +" case int():\n" +" print(\"It's an int\")\n" +" case str():\n" +" print(\"It's a str\")\n" +" case _ as unreachable:\n" +" assert_never(unreachable)" +msgstr "" + +#: library/typing.rst:2955 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: library/typing.rst:2564 +#: library/typing.rst:2960 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -2265,47 +4070,59 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: library/typing.rst:2572 +#: library/typing.rst:2968 msgid "At runtime, this throws an exception when called." msgstr "" -#: library/typing.rst:2575 +#: library/typing.rst:2971 msgid "" -"`Unreachable Code and Exhaustiveness Checking `__ has more information about " -"exhaustiveness checking with static typing." +"`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " +"checking with static typing." msgstr "" -#: library/typing.rst:2583 +#: library/typing.rst:2979 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: library/typing.rst:2585 +#: library/typing.rst:2981 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: library/typing.rst:2591 +#: library/typing.rst:2984 +msgid "" +"x: int = 1\n" +"reveal_type(x) # Revealed type is \"builtins.int\"" +msgstr "" + +#: library/typing.rst:2987 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: library/typing.rst:2594 +#: library/typing.rst:2990 msgid "" "At runtime, this function prints the runtime type of its argument to :data:" "`sys.stderr` and returns the argument unchanged (allowing the call to be " "used within an expression)::" msgstr "" -#: library/typing.rst:2601 +#: library/typing.rst:2994 +msgid "" +"x = reveal_type(1) # prints \"Runtime type is int\"\n" +"print(x) # prints \"1\"" +msgstr "" + +#: library/typing.rst:2997 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: library/typing.rst:2604 +#: library/typing.rst:3000 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -2313,52 +4130,87 @@ msgid "" "clearly." msgstr "" -#: library/typing.rst:2615 +#: library/typing.rst:3011 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: library/typing.rst:2618 +#: library/typing.rst:3014 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " "``@dataclass_transform()`` tells a static type checker that the decorated " "object performs runtime \"magic\" that transforms a class in a similar way " -"to :func:`@dataclasses.dataclass `." +"to :deco:`dataclasses.dataclass`." msgstr "" -#: library/typing.rst:2625 +#: library/typing.rst:3021 msgid "Example usage with a decorator function:" msgstr "" -#: library/typing.rst:2639 +#: library/typing.rst:3023 +msgid "" +"@dataclass_transform()\n" +"def create_model[T](cls: type[T]) -> type[T]:\n" +" ...\n" +" return cls\n" +"\n" +"@create_model\n" +"class CustomerModel:\n" +" id: int\n" +" name: str" +msgstr "" + +#: library/typing.rst:3035 msgid "On a base class::" msgstr "" -#: library/typing.rst:2648 +#: library/typing.rst:3037 +msgid "" +"@dataclass_transform()\n" +"class ModelBase: ...\n" +"\n" +"class CustomerModel(ModelBase):\n" +" id: int\n" +" name: str" +msgstr "" + +#: library/typing.rst:3044 msgid "On a metaclass::" msgstr "" -#: library/typing.rst:2659 +#: library/typing.rst:3046 +msgid "" +"@dataclass_transform()\n" +"class ModelMeta(type): ...\n" +"\n" +"class ModelBase(metaclass=ModelMeta): ...\n" +"\n" +"class CustomerModel(ModelBase):\n" +" id: int\n" +" name: str" +msgstr "" + +#: library/typing.rst:3055 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " -"``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :deco:`dataclasses.dataclass`. For " +"example, type checkers will assume these classes have ``__init__`` methods " +"that accept ``id`` and ``name``." msgstr "" -#: library/typing.rst:2665 +#: library/typing.rst:3061 msgid "" "The decorated class, metaclass, or function may accept the following bool " "arguments which type checkers will assume have the same effect as they would " -"have on the :func:`@dataclasses.dataclass` decorator: " -"``init``, ``eq``, ``order``, ``unsafe_hash``, ``frozen``, ``match_args``, " -"``kw_only``, and ``slots``. It must be possible for the value of these " -"arguments (``True`` or ``False``) to be statically evaluated." +"have on the :deco:`dataclasses.dataclass` decorator: ``init``, ``eq``, " +"``order``, ``unsafe_hash``, ``frozen``, ``match_args``, ``kw_only``, and " +"``slots``. It must be possible for the value of these arguments (``True`` or " +"``False``) to be statically evaluated." msgstr "" -#: library/typing.rst:2673 +#: library/typing.rst:3069 msgid "" "The arguments to the ``dataclass_transform`` decorator can be used to " "customize the default behaviors of the decorated class, metaclass, or " @@ -2369,90 +4221,90 @@ msgstr "" msgid "Parameters" msgstr "" -#: library/typing.rst:2677 +#: library/typing.rst:3073 msgid "" "Indicates whether the ``eq`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``True``." msgstr "" -#: library/typing.rst:2682 +#: library/typing.rst:3078 msgid "" "Indicates whether the ``order`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: library/typing.rst:2687 +#: library/typing.rst:3083 msgid "" "Indicates whether the ``kw_only`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: library/typing.rst:2692 +#: library/typing.rst:3088 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``. .. " "versionadded:: 3.12" msgstr "" -#: library/typing.rst:2693 +#: library/typing.rst:3089 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" -#: library/typing.rst:2699 +#: library/typing.rst:3095 msgid "" "Specifies a static list of supported classes or functions that describe " "fields, similar to :func:`dataclasses.field`. Defaults to ``()``." msgstr "" -#: library/typing.rst:2705 +#: library/typing.rst:3101 msgid "" "Arbitrary other keyword arguments are accepted in order to allow for " "possible future extensions." msgstr "" -#: library/typing.rst:2709 +#: library/typing.rst:3105 msgid "" "Type checkers recognize the following optional parameters on field " "specifiers:" msgstr "" -#: library/typing.rst:2712 +#: library/typing.rst:3108 msgid "**Recognised parameters for field specifiers**" msgstr "" -#: library/typing.rst:2716 +#: library/typing.rst:3112 msgid "Parameter name" msgstr "" -#: library/typing.rst:2717 +#: library/typing.rst:3113 msgid "Description" msgstr "" -#: library/typing.rst:2718 +#: library/typing.rst:3114 msgid "``init``" msgstr "" -#: library/typing.rst:2719 +#: library/typing.rst:3115 msgid "" "Indicates whether the field should be included in the synthesized " "``__init__`` method. If unspecified, ``init`` defaults to ``True``." msgstr "" -#: library/typing.rst:2722 +#: library/typing.rst:3118 msgid "``default``" msgstr "" -#: library/typing.rst:2723 +#: library/typing.rst:3119 msgid "Provides the default value for the field." msgstr "" -#: library/typing.rst:2724 +#: library/typing.rst:3120 msgid "``default_factory``" msgstr "" -#: library/typing.rst:2725 +#: library/typing.rst:3121 msgid "" "Provides a runtime callback that returns the default value for the field. If " "neither ``default`` nor ``default_factory`` are specified, the field is " @@ -2460,19 +4312,19 @@ msgid "" "is instantiated." msgstr "" -#: library/typing.rst:2730 +#: library/typing.rst:3126 msgid "``factory``" msgstr "" -#: library/typing.rst:2731 +#: library/typing.rst:3127 msgid "An alias for the ``default_factory`` parameter on field specifiers." msgstr "" -#: library/typing.rst:2732 +#: library/typing.rst:3128 msgid "``kw_only``" msgstr "" -#: library/typing.rst:2733 +#: library/typing.rst:3129 msgid "" "Indicates whether the field should be marked as keyword-only. If ``True``, " "the field will be keyword-only. If ``False``, it will not be keyword-only. " @@ -2482,32 +4334,32 @@ msgid "" "will be used." msgstr "" -#: library/typing.rst:2739 +#: library/typing.rst:3135 msgid "``alias``" msgstr "" -#: library/typing.rst:2740 +#: library/typing.rst:3136 msgid "" "Provides an alternative name for the field. This alternative name is used in " "the synthesized ``__init__`` method." msgstr "" -#: library/typing.rst:2743 +#: library/typing.rst:3139 msgid "" "At runtime, this decorator records its arguments in the " "``__dataclass_transform__`` attribute on the decorated object. It has no " "other runtime effect." msgstr "" -#: library/typing.rst:2747 +#: library/typing.rst:3143 msgid "See :pep:`681` for more details." msgstr "" -#: library/typing.rst:2755 +#: library/typing.rst:3151 msgid "Decorator for creating overloaded functions and methods." msgstr "" -#: library/typing.rst:2757 +#: library/typing.rst:3153 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -2515,7 +4367,7 @@ msgid "" "``@overload``-decorated definition (for the same function/method)." msgstr "" -#: library/typing.rst:2762 +#: library/typing.rst:3158 msgid "" "``@overload``-decorated definitions are for the benefit of the type checker " "only, since they will be overwritten by the non-``@overload``-decorated " @@ -2525,65 +4377,95 @@ msgid "" "`NotImplementedError`." msgstr "" -#: library/typing.rst:2770 +#: library/typing.rst:3166 msgid "" "An example of overload that gives a more precise type than can be expressed " "using a union or a type variable:" msgstr "" -#: library/typing.rst:2787 +#: library/typing.rst:3169 +msgid "" +"@overload\n" +"def process(response: None) -> None:\n" +" ...\n" +"@overload\n" +"def process(response: int) -> tuple[int, str]:\n" +" ...\n" +"@overload\n" +"def process(response: bytes) -> str:\n" +" ...\n" +"def process(response):\n" +" ... # actual implementation goes here" +msgstr "" + +#: library/typing.rst:3183 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: library/typing.rst:2789 +#: library/typing.rst:3185 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" -#: library/typing.rst:2796 -msgid "" -"Return a sequence of :func:`@overload `-decorated definitions for " -"*func*." +#: library/typing.rst:3192 +msgid "Return a sequence of :deco:`overload`-decorated definitions for *func*." msgstr "" -#: library/typing.rst:2799 +#: library/typing.rst:3195 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " -"documentation for :func:`@overload `, ``get_overloads(process)`` " -"will return a sequence of three function objects for the three defined " -"overloads. If called on a function with no overloads, ``get_overloads()`` " -"returns an empty sequence." +"documentation for :deco:`overload`, ``get_overloads(process)`` will return a " +"sequence of three function objects for the three defined overloads. If " +"called on a function with no overloads, ``get_overloads()`` returns an empty " +"sequence." msgstr "" -#: library/typing.rst:2806 +#: library/typing.rst:3202 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: library/typing.rst:2814 +#: library/typing.rst:3210 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: library/typing.rst:2816 +#: library/typing.rst:3212 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: library/typing.rst:2823 +#: library/typing.rst:3219 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: library/typing.rst:2825 +#: library/typing.rst:3221 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: library/typing.rst:2850 +#: library/typing.rst:3227 +msgid "" +"class Base:\n" +" @final\n" +" def done(self) -> None:\n" +" ...\n" +"class Sub(Base):\n" +" def done(self) -> None: # Error reported by type checker\n" +" ...\n" +"\n" +"@final\n" +"class Leaf:\n" +" ...\n" +"class Other(Leaf): # Error reported by type checker\n" +" ..." +msgstr "" + +#: library/typing.rst:3246 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -2593,11 +4475,11 @@ msgid "" "exception." msgstr "" -#: library/typing.rst:2861 +#: library/typing.rst:3257 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: library/typing.rst:2863 +#: library/typing.rst:3259 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -2605,38 +4487,60 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: library/typing.rst:2869 +#: library/typing.rst:3265 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: library/typing.rst:2873 +#: library/typing.rst:3269 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: library/typing.rst:2875 +#: library/typing.rst:3271 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: library/typing.rst:2881 +#: library/typing.rst:3274 +msgid "" +"No type checker ever added support for ``@no_type_check_decorator``. It is " +"therefore deprecated, and will be removed in Python 3.15." +msgstr "" + +#: library/typing.rst:3280 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: library/typing.rst:2884 +#: library/typing.rst:3283 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: library/typing.rst:2906 +#: library/typing.rst:3290 +msgid "" +"class Base:\n" +" def log_status(self) -> None:\n" +" ...\n" +"\n" +"class Sub(Base):\n" +" @override\n" +" def log_status(self) -> None: # Okay: overrides Base.log_status\n" +" ...\n" +"\n" +" @override\n" +" def done(self) -> None: # Error reported by type checker\n" +" ..." +msgstr "" + +#: library/typing.rst:3305 msgid "There is no runtime checking of this property." msgstr "" -#: library/typing.rst:2908 +#: library/typing.rst:3307 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -2646,80 +4550,131 @@ msgid "" "without raising an exception." msgstr "" -#: library/typing.rst:2915 +#: library/typing.rst:3314 msgid "See :pep:`698` for more details." msgstr "" -#: library/typing.rst:2922 +#: library/typing.rst:3321 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: library/typing.rst:2924 +#: library/typing.rst:3323 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: library/typing.rst:2935 +#: library/typing.rst:3327 +msgid "" +"@type_check_only\n" +"class Response: # private or not available at runtime\n" +" code: int\n" +" def get_header(self, name: str) -> str: ...\n" +"\n" +"def fetch_response() -> Response: ..." +msgstr "" + +#: library/typing.rst:3334 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: library/typing.rst:2939 +#: library/typing.rst:3338 msgid "Introspection helpers" msgstr "" -#: library/typing.rst:2943 +#: library/typing.rst:3342 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: library/typing.rst:2946 +#: library/typing.rst:3345 msgid "" -"This is often the same as ``obj.__annotations__``. In addition, forward " -"references encoded as string literals are handled by evaluating them in " -"``globals`` and ``locals`` namespaces. For a class ``C``, return a " -"dictionary constructed by merging all the ``__annotations__`` along ``C." -"__mro__`` in reverse order." +"This is often the same as ``obj.__annotations__``, but this function makes " +"the following changes to the annotations dictionary:" msgstr "" -#: library/typing.rst:2952 +#: library/typing.rst:3348 +msgid "" +"Forward references encoded as string literals or :class:`ForwardRef` objects " +"are handled by evaluating them in *globalns*, *localns*, and (where " +"applicable) *obj*'s :ref:`type parameter ` namespace. If " +"*globalns* or *localns* is not given, appropriate namespace dictionaries are " +"inferred from *obj*." +msgstr "" + +#: library/typing.rst:3353 +msgid "``None`` is replaced with :class:`types.NoneType`." +msgstr "" + +#: library/typing.rst:3354 +msgid "" +"If :deco:`no_type_check` has been applied to *obj*, an empty dictionary is " +"returned." +msgstr "" + +#: library/typing.rst:3356 +msgid "" +"If *obj* is a class ``C``, the function returns a dictionary that merges " +"annotations from ``C``'s base classes with those on ``C`` directly. This is " +"done by traversing :attr:`C.__mro__ ` and iteratively " +"combining ``__annotations__`` dictionaries. Annotations on classes appearing " +"earlier in the :term:`method resolution order` always take precedence over " +"annotations on classes appearing later in the method resolution order." +msgstr "" + +#: library/typing.rst:3363 +msgid "" +"The function recursively replaces all occurrences of ``Annotated[T, ...]``, " +"``Required[T]``, ``NotRequired[T]``, and ``ReadOnly[T]`` with ``T``, unless " +"*include_extras* is set to ``True`` (see :class:`Annotated` for more " +"information)." +msgstr "" + +#: library/typing.rst:3368 +msgid "" +"See also :func:`annotationlib.get_annotations`, a lower-level function that " +"returns annotations more directly." +msgstr "" + +#: library/typing.rst:3524 msgid "" -"The function recursively replaces all ``Annotated[T, ...]`` with ``T``, " -"unless ``include_extras`` is set to ``True`` (see :class:`Annotated` for " -"more information). For example:" +"This function may execute arbitrary code contained in annotations. See :ref:" +"`annotationlib-security` for more information." msgstr "" -#: library/typing.rst:2969 +#: library/typing.rst:3378 msgid "" -":func:`get_type_hints` does not work with imported :ref:`type aliases ` that include forward references. Enabling postponed evaluation of " -"annotations (:pep:`563`) may remove the need for most forward references." +"If any forward references in the annotations of *obj* are not resolvable or " +"are not valid Python code, this function will raise an exception such as :" +"exc:`NameError`. For example, this can happen with imported :ref:`type " +"aliases ` that include forward references, or with names " +"imported under :data:`if TYPE_CHECKING `." msgstr "" -#: library/typing.rst:2974 +#: library/typing.rst:3384 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." msgstr "" -#: library/typing.rst:2978 +#: library/typing.rst:3388 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: library/typing.rst:2985 +#: library/typing.rst:3395 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: library/typing.rst:2988 +#: library/typing.rst:3398 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -2727,17 +4682,28 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: library/typing.rst:3017 +#: library/typing.rst:3428 msgid "Examples:" msgstr "" -#: library/typing.rst:3009 +#: library/typing.rst:3406 +msgid "" +"assert get_origin(str) is None\n" +"assert get_origin(Dict[str, int]) is dict\n" +"assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" +"P = ParamSpec('P')\n" +"assert get_origin(P.args) is P\n" +"assert get_origin(P.kwargs) is P" +msgstr "" + +#: library/typing.rst:3420 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: library/typing.rst:3012 +#: library/typing.rst:3423 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -2745,69 +4711,177 @@ msgid "" "objects." msgstr "" -#: library/typing.rst:3029 +#: library/typing.rst:3430 +msgid "" +"assert get_args(int) == ()\n" +"assert get_args(Dict[int, str]) == (int, str)\n" +"assert get_args(Union[int, str]) == (int, str)" +msgstr "" + +#: library/typing.rst:3440 +msgid "Return the set of members defined in a :class:`Protocol`." +msgstr "" + +#: library/typing.rst:3442 +msgid "" +">>> from typing import Protocol, get_protocol_members\n" +">>> class P(Protocol):\n" +"... def a(self) -> str: ...\n" +"... b: int\n" +">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" +"True" +msgstr "" + +#: library/typing.rst:3451 +msgid "Raise :exc:`TypeError` for arguments that are not Protocols." +msgstr "" + +#: library/typing.rst:3457 +msgid "Determine if a type is a :class:`Protocol`." +msgstr "" + +#: library/typing.rst:3461 +msgid "" +"class P(Protocol):\n" +" def a(self) -> str: ...\n" +" b: int\n" +"\n" +"is_protocol(P) # => True\n" +"is_protocol(int) # => False" +msgstr "" + +#: library/typing.rst:3472 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: library/typing.rst:3050 +#: library/typing.rst:3476 +msgid "" +"class Film(TypedDict):\n" +" title: str\n" +" year: int\n" +"\n" +"assert is_typeddict(Film)\n" +"assert not is_typeddict(list | str)\n" +"\n" +"# TypedDict is a factory for creating typed dicts,\n" +"# not a typed dict itself\n" +"assert not is_typeddict(TypedDict)" +msgstr "" + +#: library/typing.rst:3493 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: library/typing.rst:3052 +#: library/typing.rst:3495 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " -"``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " +"``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: library/typing.rst:3057 +#: library/typing.rst:3500 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: library/typing.rst:3064 +#: library/typing.rst:3506 +msgid "" +"This is now an alias for :class:`annotationlib.ForwardRef`. Several " +"undocumented behaviors of this class have been changed; for example, after a " +"``ForwardRef`` has been evaluated, the evaluated value is no longer cached." +msgstr "" + +#: library/typing.rst:3513 +msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." +msgstr "" + +#: library/typing.rst:3515 +msgid "" +"This is similar to calling :meth:`annotationlib.ForwardRef.evaluate`, but " +"unlike that method, :func:`!evaluate_forward_ref` also recursively evaluates " +"forward references nested within the type hint." +msgstr "" + +#: library/typing.rst:3519 +msgid "" +"See the documentation for :meth:`annotationlib.ForwardRef.evaluate` for the " +"meaning of the *owner*, *globals*, *locals*, *type_params*, and *format* " +"parameters." +msgstr "" + +#: library/typing.rst:3531 +msgid "" +"A sentinel object used to indicate that a type parameter has no default " +"value. For example:" +msgstr "" + +#: library/typing.rst:3534 +msgid "" +">>> T = TypeVar(\"T\")\n" +">>> T.__default__ is typing.NoDefault\n" +"True\n" +">>> S = TypeVar(\"S\", default=None)\n" +">>> S.__default__ is None\n" +"True" +msgstr "" + +#: library/typing.rst:3546 msgid "Constant" msgstr "" -#: library/typing.rst:3068 +#: library/typing.rst:3550 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " -"checkers. It is ``False`` at runtime." +"checkers. It's ``False`` at runtime." msgstr "" -#: library/typing.rst:3079 +#: library/typing.rst:3553 +msgid "" +"A module which is expensive to import, and which only contain types used for " +"typing annotations, can be safely imported inside an ``if TYPE_CHECKING:`` " +"block. This prevents the module from actually being imported at runtime; " +"annotations aren't eagerly evaluated (see :pep:`649`) so using undefined " +"symbols in annotations is harmless--as long as you don't later examine them. " +"Your static type analysis tool will set ``TYPE_CHECKING`` to ``True`` during " +"static type analysis, which means the module will be imported and the types " +"will be checked properly during such analysis." +msgstr "" + +#: library/typing.rst:3565 msgid "" -"The first type annotation must be enclosed in quotes, making it a \"forward " -"reference\", to hide the ``expensive_mod`` reference from the interpreter " -"runtime. Type annotations for local variables are not evaluated, so the " -"second annotation does not need to be enclosed in quotes." +"if TYPE_CHECKING:\n" +" import expensive_mod\n" +"\n" +"def fun(arg: expensive_mod.SomeType) -> None:\n" +" local_var: expensive_mod.AnotherType = other_fun()" msgstr "" -#: library/typing.rst:3086 +#: library/typing.rst:3571 msgid "" -"If ``from __future__ import annotations`` is used, annotations are not " -"evaluated at function definition time. Instead, they are stored as strings " -"in ``__annotations__``. This makes it unnecessary to use quotes around the " -"annotation (see :pep:`563`)." +"If you occasionally need to examine type annotations at runtime which may " +"contain undefined symbols, use :meth:`annotationlib.get_annotations` with a " +"``format`` parameter of :attr:`annotationlib.Format.STRING` or :attr:" +"`annotationlib.Format.FORWARDREF` to safely retrieve the annotations without " +"raising :exc:`NameError`." msgstr "" -#: library/typing.rst:3098 +#: library/typing.rst:3584 msgid "Deprecated aliases" msgstr "" -#: library/typing.rst:3100 +#: library/typing.rst:3586 msgid "" "This module defines several deprecated aliases to pre-existing standard " -"library classes. These were originally included in the typing module in " -"order to support parameterizing these generic classes using ``[]``. However, " -"the aliases became redundant in Python 3.9 when the corresponding pre-" -"existing classes were enhanced to support ``[]`` (see :pep:`585`)." +"library classes. These were originally included in the :mod:`!typing` module " +"in order to support parameterizing these generic classes using ``[]``. " +"However, the aliases became redundant in Python 3.9 when the corresponding " +"pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: library/typing.rst:3107 +#: library/typing.rst:3593 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -2815,196 +4889,183 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: library/typing.rst:3112 +#: library/typing.rst:3598 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " -"releases prior to removal. The aliases are guaranteed to remain in the " -"typing module without deprecation warnings until at least Python 3.14." +"releases prior to removal. The aliases are guaranteed to remain in the :mod:" +"`!typing` module without deprecation warnings until at least Python 3.14." msgstr "" -#: library/typing.rst:3117 +#: library/typing.rst:3603 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: library/typing.rst:3123 +#: library/typing.rst:3609 msgid "Aliases to built-in types" msgstr "" -#: library/typing.rst:3127 +#: library/typing.rst:3613 msgid "Deprecated alias to :class:`dict`." msgstr "" -#: library/typing.rst:3129 +#: library/typing.rst:3615 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`Mapping` rather than to use :class:`dict` " -"or :class:`!typing.Dict`." -msgstr "" - -#: library/typing.rst:3372 -msgid "This type can be used as follows::" +"collection type such as :class:`~collections.abc.Mapping` rather than to " +"use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: library/typing.rst:3138 +#: library/typing.rst:3619 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3144 +#: library/typing.rst:3625 msgid "Deprecated alias to :class:`list`." msgstr "" -#: library/typing.rst:3146 +#: library/typing.rst:3627 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`Sequence` or :class:`Iterable` rather than " -"to use :class:`list` or :class:`!typing.List`." -msgstr "" - -#: library/typing.rst:3150 -msgid "This type may be used as follows::" +"collection type such as :class:`~collections.abc.Sequence` or :class:" +"`~collections.abc.Iterable` rather than to use :class:`list` or :class:`!" +"typing.List`." msgstr "" -#: library/typing.rst:3158 +#: library/typing.rst:3632 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3164 +#: library/typing.rst:3638 msgid "Deprecated alias to :class:`builtins.set `." msgstr "" -#: library/typing.rst:3166 +#: library/typing.rst:3640 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`AbstractSet` rather than to use :class:`set` " -"or :class:`!typing.Set`." +"collection type such as :class:`collections.abc.Set` rather than to use :" +"class:`set` or :class:`typing.Set`." msgstr "" -#: library/typing.rst:3170 +#: library/typing.rst:3644 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3176 +#: library/typing.rst:3650 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "" -#: library/typing.rst:3178 +#: library/typing.rst:3652 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3185 +#: library/typing.rst:3659 msgid "Deprecated alias for :class:`tuple`." msgstr "" -#: library/typing.rst:3187 +#: library/typing.rst:3661 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: library/typing.rst:3190 +#: library/typing.rst:3664 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3196 +#: library/typing.rst:3670 msgid "Deprecated alias to :class:`type`." msgstr "" -#: library/typing.rst:3198 +#: library/typing.rst:3672 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: library/typing.rst:3203 +#: library/typing.rst:3677 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3210 +#: library/typing.rst:3684 msgid "Aliases to types in :mod:`collections`" msgstr "" -#: library/typing.rst:3214 +#: library/typing.rst:3688 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "" -#: library/typing.rst:3218 +#: library/typing.rst:3692 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3224 +#: library/typing.rst:3698 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "" -#: library/typing.rst:3228 +#: library/typing.rst:3702 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3234 +#: library/typing.rst:3708 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "" -#: library/typing.rst:3238 +#: library/typing.rst:3712 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3244 +#: library/typing.rst:3718 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "" -#: library/typing.rst:3248 +#: library/typing.rst:3722 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3254 +#: library/typing.rst:3728 msgid "Deprecated alias to :class:`collections.deque`." msgstr "" -#: library/typing.rst:3258 +#: library/typing.rst:3732 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3265 +#: library/typing.rst:3739 msgid "Aliases to other concrete types" msgstr "" -#: library/typing.rst:3270 -msgid "" -"The ``typing.io`` namespace is deprecated and will be removed. These types " -"should be directly imported from ``typing`` instead." -msgstr "" - -#: library/typing.rst:3274 +#: library/typing.rst:3744 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: library/typing.rst:3277 +#: library/typing.rst:3747 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -3012,391 +5073,403 @@ msgid "" "``Match[bytes]``." msgstr "" -#: library/typing.rst:3285 -msgid "" -"The ``typing.re`` namespace is deprecated and will be removed. These types " -"should be directly imported from ``typing`` instead." -msgstr "" - -#: library/typing.rst:3286 +#: library/typing.rst:3752 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3292 +#: library/typing.rst:3758 msgid "Deprecated alias for :class:`str`." msgstr "" -#: library/typing.rst:3294 +#: library/typing.rst:3760 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: library/typing.rst:3298 +#: library/typing.rst:3764 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: library/typing.rst:3306 +#: library/typing.rst:3767 +msgid "" +"def add_unicode_checkmark(text: Text) -> Text:\n" +" return text + u' \\u2713'" +msgstr "" + +#: library/typing.rst:3772 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: library/typing.rst:3316 +#: library/typing.rst:3782 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr "" -#: library/typing.rst:3320 +#: library/typing.rst:3786 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "" -#: library/typing.rst:3322 +#: library/typing.rst:3788 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3328 +#: library/typing.rst:3794 +msgid "Deprecated alias to :class:`collections.abc.ByteString`." +msgstr "" + +#: library/typing.rst:3796 msgid "" -"This type represents the types :class:`bytes`, :class:`bytearray`, and :" -"class:`memoryview` of byte sequences." +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." msgstr "" -#: library/typing.rst:3332 +#: library/typing.rst:3802 msgid "" -"Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " -"| memoryview``." +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" + +#: library/typing.rst:3810 +msgid "See :pep:`PEP 688 <688#current-options>` for more details." msgstr "" -#: library/typing.rst:3336 +#: library/typing.rst:3816 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "" -#: library/typing.rst:3340 +#: library/typing.rst:3820 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3346 +#: library/typing.rst:3826 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "" -#: library/typing.rst:3348 +#: library/typing.rst:3828 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3354 +#: library/typing.rst:3834 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "" -#: library/typing.rst:3356 +#: library/typing.rst:3836 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3362 +#: library/typing.rst:3842 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "" -#: library/typing.rst:3364 +#: library/typing.rst:3844 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3370 +#: library/typing.rst:3850 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "" -#: library/typing.rst:3377 +#: library/typing.rst:3852 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3383 +#: library/typing.rst:3858 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "" -#: library/typing.rst:3385 +#: library/typing.rst:3860 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3391 +#: library/typing.rst:3866 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "" -#: library/typing.rst:3393 +#: library/typing.rst:3868 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3400 +#: library/typing.rst:3875 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "" -#: library/typing.rst:3402 +#: library/typing.rst:3877 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3409 +#: library/typing.rst:3884 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "" -#: library/typing.rst:3411 +#: library/typing.rst:3886 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3417 +#: library/typing.rst:3892 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "" -#: library/typing.rst:3419 +#: library/typing.rst:3894 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3425 +#: library/typing.rst:3900 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "" -#: library/typing.rst:3427 +#: library/typing.rst:3902 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3434 +#: library/typing.rst:3909 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: library/typing.rst:3438 +#: library/typing.rst:3913 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "" -#: library/typing.rst:3440 +#: library/typing.rst:3915 msgid "" -"The variance and order of type variables correspond to those of :class:" -"`Generator`, for example::" +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" -#: library/typing.rst:3451 +#: library/typing.rst:3921 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3457 +#: library/typing.rst:3927 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "" -#: library/typing.rst:3459 -msgid "" -"An async generator can be annotated by the generic type " -"``AsyncGenerator[YieldType, SendType]``. For example::" -msgstr "" - -#: library/typing.rst:3468 -msgid "" -"Unlike normal generators, async generators cannot return a value, so there " -"is no ``ReturnType`` type parameter. As with :class:`Generator`, the " -"``SendType`` behaves contravariantly." -msgstr "" - -#: library/typing.rst:3472 -msgid "" -"If your generator will only yield values, set the ``SendType`` to ``None``::" -msgstr "" - -#: library/typing.rst:3480 +#: library/typing.rst:3929 msgid "" -"Alternatively, annotate your generator as having a return type of either " -"``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``::" +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " +"annotations." msgstr "" -#: library/typing.rst:3490 +#: library/typing.rst:3935 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3497 +#: library/typing.rst:3940 +msgid "The ``SendType`` parameter now has a default." +msgstr "" + +#: library/typing.rst:3945 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "" -#: library/typing.rst:3501 +#: library/typing.rst:3949 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3507 +#: library/typing.rst:3955 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "" -#: library/typing.rst:3511 +#: library/typing.rst:3959 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3517 +#: library/typing.rst:3965 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "" -#: library/typing.rst:3521 +#: library/typing.rst:3969 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3528 +#: library/typing.rst:3976 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: library/typing.rst:3532 +#: library/typing.rst:3980 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "" -#: library/typing.rst:3534 +#: library/typing.rst:3982 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3540 +#: library/typing.rst:3988 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "" -#: library/typing.rst:3542 +#: library/typing.rst:3990 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3548 +#: library/typing.rst:3996 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "" -#: library/typing.rst:3550 +#: library/typing.rst:3998 msgid "" "See :ref:`annotating-callables` for details on how to use :class:" "`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" -#: library/typing.rst:3553 +#: library/typing.rst:4001 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3563 +#: library/typing.rst:4011 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "" -#: library/typing.rst:3565 -msgid "" -"A generator can be annotated by the generic type ``Generator[YieldType, " -"SendType, ReturnType]``. For example::" -msgstr "" - -#: library/typing.rst:3574 -msgid "" -"Note that unlike many other generics in the typing module, the ``SendType`` " -"of :class:`Generator` behaves contravariantly, not covariantly or " -"invariantly." -msgstr "" - -#: library/typing.rst:3578 +#: library/typing.rst:4013 msgid "" -"If your generator will only yield values, set the ``SendType`` and " -"``ReturnType`` to ``None``::" +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" -#: library/typing.rst:3586 -msgid "" -"Alternatively, annotate your generator as having a return type of either " -"``Iterable[YieldType]`` or ``Iterator[YieldType]``::" -msgstr "" - -#: library/typing.rst:3594 +#: library/typing.rst:4017 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3600 +#: library/typing.rst:4021 +msgid "Default values for the send and return types were added." +msgstr "" + +#: library/typing.rst:4026 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "" -#: library/typing.rst:3602 +#: library/typing.rst:4028 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "" -#: library/typing.rst:3607 +#: library/typing.rst:4033 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "" -#: library/typing.rst:3609 +#: library/typing.rst:4035 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3615 +#: library/typing.rst:4041 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "" -#: library/typing.rst:3617 +#: library/typing.rst:4043 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "" -#: library/typing.rst:3623 +#: library/typing.rst:4049 msgid "Aliases to :mod:`contextlib` ABCs" msgstr "" -#: library/typing.rst:3627 +#: library/typing.rst:4053 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: library/typing.rst:3631 +#: library/typing.rst:4055 +msgid "" +"The first type parameter, ``T_co``, represents the type returned by the :" +"meth:`~object.__enter__` method. The optional second type parameter, " +"``ExitT_co``, which defaults to ``bool | None``, represents the type " +"returned by the :meth:`~object.__exit__` method." +msgstr "" + +#: library/typing.rst:4062 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3638 +#: library/typing.rst:4067 +msgid "Added the optional second type parameter, ``ExitT_co``." +msgstr "" + +#: library/typing.rst:4072 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: library/typing.rst:3642 +#: library/typing.rst:4074 +msgid "" +"The first type parameter, ``T_co``, represents the type returned by the :" +"meth:`~object.__aenter__` method. The optional second type parameter, " +"``AExitT_co``, which defaults to ``bool | None``, represents the type " +"returned by the :meth:`~object.__aexit__` method." +msgstr "" + +#: library/typing.rst:4081 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: library/typing.rst:3648 +#: library/typing.rst:4086 +msgid "Added the optional second type parameter, ``AExitT_co``." +msgstr "" + +#: library/typing.rst:4090 msgid "Deprecation Timeline of Major Features" msgstr "" -#: library/typing.rst:3650 +#: library/typing.rst:4092 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -3404,98 +5477,118 @@ msgid "" "listed." msgstr "" -#: library/typing.rst:3657 +#: library/typing.rst:4099 msgid "Feature" msgstr "" -#: library/typing.rst:3658 +#: library/typing.rst:4100 msgid "Deprecated in" msgstr "" -#: library/typing.rst:3659 +#: library/typing.rst:4101 msgid "Projected removal" msgstr "" -#: library/typing.rst:3660 +#: library/typing.rst:4102 msgid "PEP/issue" msgstr "" -#: library/typing.rst:3661 -msgid "``typing.io`` and ``typing.re`` submodules" -msgstr "" - -#: library/typing.rst:3662 -msgid "3.8" -msgstr "" - -#: library/typing.rst:3663 -msgid "3.13" -msgstr "" - -#: library/typing.rst:3664 -msgid ":issue:`38291`" -msgstr "" - -#: library/typing.rst:3665 +#: library/typing.rst:4103 msgid "``typing`` versions of standard collections" msgstr "" -#: library/typing.rst:3670 +#: library/typing.rst:4108 msgid "3.9" msgstr "" -#: library/typing.rst:3667 +#: library/typing.rst:4105 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: library/typing.rst:3668 +#: library/typing.rst:4106 msgid ":pep:`585`" msgstr "" -#: library/typing.rst:3669 +#: library/typing.rst:4107 msgid ":class:`typing.ByteString`" msgstr "" -#: library/typing.rst:3671 -msgid "3.14" +#: library/typing.rst:4109 +msgid "3.17" msgstr "" -#: library/typing.rst:3672 +#: library/typing.rst:4110 msgid ":gh:`91896`" msgstr "" -#: library/typing.rst:3673 +#: library/typing.rst:4111 msgid ":data:`typing.Text`" msgstr "" -#: library/typing.rst:3674 +#: library/typing.rst:4112 msgid "3.11" msgstr "" -#: library/typing.rst:3679 library/typing.rst:3683 +#: library/typing.rst:4117 library/typing.rst:4121 msgid "Undecided" msgstr "" -#: library/typing.rst:3676 +#: library/typing.rst:4114 msgid ":gh:`92332`" msgstr "" -#: library/typing.rst:3677 +#: library/typing.rst:4115 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr "" -#: library/typing.rst:3682 +#: library/typing.rst:4120 msgid "3.12" msgstr "" -#: library/typing.rst:3680 +#: library/typing.rst:4118 msgid ":gh:`94309`" msgstr "" -#: library/typing.rst:3681 +#: library/typing.rst:4119 msgid ":data:`typing.TypeAlias`" msgstr "" -#: library/typing.rst:3684 +#: library/typing.rst:4122 msgid ":pep:`695`" msgstr "" + +#: library/typing.rst:4123 +msgid ":func:`@typing.no_type_check_decorator `" +msgstr "" + +#: library/typing.rst:4128 +msgid "3.13" +msgstr "" + +#: library/typing.rst:4125 +msgid "3.15" +msgstr "" + +#: library/typing.rst:4126 +msgid ":gh:`106309`" +msgstr "" + +#: library/typing.rst:4127 +msgid ":data:`typing.AnyStr`" +msgstr "" + +#: library/typing.rst:4129 +msgid "3.18" +msgstr "" + +#: library/typing.rst:4130 +msgid ":gh:`105578`" +msgstr "" + +#: library/typing.rst:380 library/typing.rst:1170 +msgid "..." +msgstr "" + +#: library/typing.rst:380 library/typing.rst:1170 +msgid "ellipsis literal" +msgstr "" diff --git a/library/unicodedata.po b/library/unicodedata.po index 2b6fb6fe..27230f6b 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -8,24 +8,25 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/unicodedata.rst:2 -msgid ":mod:`unicodedata` --- Unicode Database" +msgid ":mod:`!unicodedata` --- Unicode Database" msgstr "" #: library/unicodedata.rst:18 msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 15.0.0 `_." +"in this database is compiled from the `UCD version 16.0.0 `_." msgstr "" #: library/unicodedata.rst:23 @@ -35,84 +36,177 @@ msgid "" "tr44/>`_. It defines the following functions:" msgstr "" -#: library/unicodedata.rst:31 +#: library/unicodedata.rst:30 +msgid "" +"The :ref:`unicode-howto` for more information about Unicode and how to use " +"this module." +msgstr "" + +#: library/unicodedata.rst:36 msgid "" "Look up character by name. If a character with the given name is found, " -"return the corresponding character. If not found, :exc:`KeyError` is raised." +"return the corresponding character. If not found, :exc:`KeyError` is " +"raised. For example::" +msgstr "" + +#: library/unicodedata.rst:40 +msgid "" +">>> unicodedata.lookup('LEFT CURLY BRACKET')\n" +"'{'" +msgstr "" + +#: library/unicodedata.rst:43 +msgid "" +"The characters returned by this function are the same as those produced by " +"``\\N`` escape sequence in string literals. For example::" +msgstr "" + +#: library/unicodedata.rst:46 +msgid "" +">>> unicodedata.lookup('MIDDLE DOT') == '\\N{MIDDLE DOT}'\n" +"True" msgstr "" -#: library/unicodedata.rst:34 +#: library/unicodedata.rst:49 msgid "Support for name aliases [#]_ and named sequences [#]_ has been added." msgstr "" -#: library/unicodedata.rst:40 +#: library/unicodedata.rst:55 msgid "" "Returns the name assigned to the character *chr* as a string. If no name is " "defined, *default* is returned, or, if not given, :exc:`ValueError` is " -"raised." +"raised. For example::" +msgstr "" + +#: library/unicodedata.rst:59 +msgid "" +">>> unicodedata.name('½')\n" +"'VULGAR FRACTION ONE HALF'\n" +">>> unicodedata.name('\\uFFFF', 'fallback')\n" +"'fallback'" msgstr "" -#: library/unicodedata.rst:47 +#: library/unicodedata.rst:67 msgid "" "Returns the decimal value assigned to the character *chr* as integer. If no " "such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"`ValueError` is raised. For example::" +msgstr "" + +#: library/unicodedata.rst:71 +msgid "" +">>> unicodedata.decimal('\\N{ARABIC-INDIC DIGIT NINE}')\n" +"9\n" +">>> unicodedata.decimal('\\N{SUPERSCRIPT NINE}', -1)\n" +"-1" msgstr "" -#: library/unicodedata.rst:54 +#: library/unicodedata.rst:79 msgid "" "Returns the digit value assigned to the character *chr* as integer. If no " "such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"`ValueError` is raised::" +msgstr "" + +#: library/unicodedata.rst:83 +msgid "" +">>> unicodedata.digit('\\N{SUPERSCRIPT NINE}')\n" +"9" msgstr "" -#: library/unicodedata.rst:61 +#: library/unicodedata.rst:89 msgid "" "Returns the numeric value assigned to the character *chr* as float. If no " "such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"`ValueError` is raised::" +msgstr "" + +#: library/unicodedata.rst:93 +msgid "" +">>> unicodedata.numeric('½')\n" +"0.5" msgstr "" -#: library/unicodedata.rst:68 -msgid "Returns the general category assigned to the character *chr* as string." +#: library/unicodedata.rst:99 +msgid "" +"Returns the general category assigned to the character *chr* as string. " +"General category names consist of two letters. See the `General Category " +"Values section of the Unicode Character Database documentation `_ for a list " +"of category codes. For example::" msgstr "" -#: library/unicodedata.rst:74 +#: library/unicodedata.rst:105 +msgid "" +">>> unicodedata.category('A') # 'L'etter, 'u'ppercase\n" +"'Lu'" +msgstr "" + +#: library/unicodedata.rst:111 msgid "" "Returns the bidirectional class assigned to the character *chr* as string. " -"If no such value is defined, an empty string is returned." +"If no such value is defined, an empty string is returned. See the " +"`Bidirectional Class Values section of the Unicode Character Database " +"`_ " +"documentation for a list of bidirectional codes. For example::" msgstr "" -#: library/unicodedata.rst:80 +#: library/unicodedata.rst:117 +msgid "" +">>> unicodedata.bidirectional('\\N{ARABIC-INDIC DIGIT SEVEN}') # 'A'rabic, " +"'N'umber\n" +"'AN'" +msgstr "" + +#: library/unicodedata.rst:123 msgid "" "Returns the canonical combining class assigned to the character *chr* as " -"integer. Returns ``0`` if no combining class is defined." +"integer. Returns ``0`` if no combining class is defined. See the `Canonical " +"Combining Class Values section of the Unicode Character Database `_ for more information." msgstr "" -#: library/unicodedata.rst:86 -msgid "Returns the east asian width assigned to the character *chr* as string." +#: library/unicodedata.rst:132 +msgid "" +"Returns the east asian width assigned to the character *chr* as string. For " +"a list of widths and or more information, see the `Unicode Standard Annex " +"#11 `_." msgstr "" -#: library/unicodedata.rst:92 +#: library/unicodedata.rst:139 msgid "" "Returns the mirrored property assigned to the character *chr* as integer. " "Returns ``1`` if the character has been identified as a \"mirrored\" " -"character in bidirectional text, ``0`` otherwise." +"character in bidirectional text, ``0`` otherwise. For example::" msgstr "" -#: library/unicodedata.rst:99 +#: library/unicodedata.rst:143 +msgid "" +">>> unicodedata.mirrored('>')\n" +"1" +msgstr "" + +#: library/unicodedata.rst:149 msgid "" "Returns the character decomposition mapping assigned to the character *chr* " -"as string. An empty string is returned in case no such mapping is defined." +"as string. An empty string is returned in case no such mapping is defined. " +"For example::" +msgstr "" + +#: library/unicodedata.rst:153 +msgid "" +">>> unicodedata.decomposition('Ã')\n" +"'0041 0303'" msgstr "" -#: library/unicodedata.rst:106 +#: library/unicodedata.rst:159 msgid "" "Return the normal form *form* for the Unicode string *unistr*. Valid values " "for *form* are 'NFC', 'NFKC', 'NFD', and 'NFKD'." msgstr "" -#: library/unicodedata.rst:109 +#: library/unicodedata.rst:162 msgid "" "The Unicode standard defines various normalization forms of a Unicode " "string, based on the definition of canonical equivalence and compatibility " @@ -122,7 +216,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: library/unicodedata.rst:115 +#: library/unicodedata.rst:168 msgid "" "For each character, there are two normal forms: normal form C and normal " "form D. Normal form D (NFD) is also known as canonical decomposition, and " @@ -131,66 +225,62 @@ msgid "" "characters again." msgstr "" -#: library/unicodedata.rst:120 +#: library/unicodedata.rst:173 msgid "" "In addition to these two forms, there are two additional normal forms based " "on compatibility equivalence. In Unicode, certain characters are supported " "which normally would be unified with other characters. For example, U+2160 " "(ROMAN NUMERAL ONE) is really the same thing as U+0049 (LATIN CAPITAL LETTER " "I). However, it is supported in Unicode for compatibility with existing " -"character sets (e.g. gb2312)." +"character sets (for example, gb2312)." msgstr "" -#: library/unicodedata.rst:127 +#: library/unicodedata.rst:180 msgid "" -"The normal form KD (NFKD) will apply the compatibility decomposition, i.e. " -"replace all compatibility characters with their equivalents. The normal form " -"KC (NFKC) first applies the compatibility decomposition, followed by the " -"canonical composition." +"The normal form KD (NFKD) will apply the compatibility decomposition, that " +"is, replace all compatibility characters with their equivalents. The normal " +"form KC (NFKC) first applies the compatibility decomposition, followed by " +"the canonical composition." msgstr "" -#: library/unicodedata.rst:132 +#: library/unicodedata.rst:185 msgid "" "Even if two unicode strings are normalized and look the same to a human " "reader, if one has combining characters and the other doesn't, they may not " "compare equal." msgstr "" -#: library/unicodedata.rst:138 +#: library/unicodedata.rst:192 msgid "" "Return whether the Unicode string *unistr* is in the normal form *form*. " "Valid values for *form* are 'NFC', 'NFKC', 'NFD', and 'NFKD'." msgstr "" -#: library/unicodedata.rst:144 +#: library/unicodedata.rst:198 msgid "In addition, the module exposes the following constant:" msgstr "" -#: library/unicodedata.rst:148 +#: library/unicodedata.rst:202 msgid "The version of the Unicode database used in this module." msgstr "" -#: library/unicodedata.rst:153 +#: library/unicodedata.rst:207 msgid "" "This is an object that has the same methods as the entire module, but uses " "the Unicode database version 3.2 instead, for applications that require this " "specific version of the Unicode database (such as IDNA)." msgstr "" -#: library/unicodedata.rst:157 -msgid "Examples:" -msgstr "" - -#: library/unicodedata.rst:177 +#: library/unicodedata.rst:213 msgid "Footnotes" msgstr "" -#: library/unicodedata.rst:178 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +#: library/unicodedata.rst:214 +msgid "https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt" msgstr "" -#: library/unicodedata.rst:180 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt" +#: library/unicodedata.rst:216 +msgid "https://www.unicode.org/Public/16.0.0/ucd/NamedSequences.txt" msgstr "" #: library/unicodedata.rst:11 diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index eb52d6f5..2d599e0d 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -8,49 +8,55 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2026-01-17 23:50+0300\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/unittest.mock-examples.rst:2 -msgid ":mod:`unittest.mock` --- getting started" -msgstr "" +msgid ":mod:`!unittest.mock` --- getting started" +msgstr ":mod:`!unittest.mock` --- ξεκινώντας" #: library/unittest.mock-examples.rst:27 msgid "Using Mock" -msgstr "" +msgstr "Χρήση της Προσομοίωσης (Mock)" #: library/unittest.mock-examples.rst:30 msgid "Mock Patching Methods" -msgstr "" +msgstr "Προσομοίωση Μεθόδων με Επιδιόρθωση (Patching)" #: library/unittest.mock-examples.rst:32 msgid "Common uses for :class:`Mock` objects include:" -msgstr "" +msgstr "Κοινές χρήσεις για αντικείμενα :class:`Mock` περιλαμβάνουν:" #: library/unittest.mock-examples.rst:34 msgid "Patching methods" -msgstr "" +msgstr "Επιδιόρθωση (Patching) μεθόδων" #: library/unittest.mock-examples.rst:35 msgid "Recording method calls on objects" -msgstr "" +msgstr "Καταγραφή κλήσεων μεθόδων σε αντικείμενα" #: library/unittest.mock-examples.rst:37 msgid "" "You might want to replace a method on an object to check that it is called " "with the correct arguments by another part of the system:" msgstr "" +"Ίσως θέλετε να αντικαταστήσετε μια μέθοδο σε ένα αντικείμενο για να ελέγξετε " +"ότι καλείται με τα σωστά ορίσματα από ένα άλλο μέρος του συστήματος:" #: library/unittest.mock-examples.rst:45 msgid "" "Once our mock has been used (``real.method`` in this example) it has methods " "and attributes that allow you to make assertions about how it has been used." msgstr "" +"Μόλις χρησιμοποιηθεί η προσομοίωσή μας (``real.method`` σε αυτό το " +"παράδειγμα) θα έχει μεθόδους και χαρακτηριστικά που σας επιτρέπουν να κάνετε " +"δηλώσεις σχετικά με το πώς έχει χρησιμοποιηθεί." #: library/unittest.mock-examples.rst:50 msgid "" @@ -58,6 +64,9 @@ msgid "" "are interchangeable. As the ``MagicMock`` is the more capable class it makes " "a sensible one to use by default." msgstr "" +"Στα περισσότερα από αυτά τα παραδείγματα οι κλάσεις :class:`Mock` και :class:" +"`MagicMock` είναι εναλλάξιμες. Καθώς η ``MagicMock`` είναι η πιο ικανή " +"κλάση, αποτελεί μια λογική επιλογή για χρήση από προεπιλογή." #: library/unittest.mock-examples.rst:54 msgid "" @@ -66,16 +75,22 @@ msgid "" "or :meth:`~Mock.assert_called_once_with` method to check that it was called " "with the correct arguments." msgstr "" +"Μόλις κληθεί η προσομοίωση, το χαρακτηριστικό :attr:`~Mock.called` ορίζεται " +"σε ``True``. Πιο σημαντικό είναι ότι μπορούμε να χρησιμοποιήσουμε τη μέθοδο :" +"meth:`~Mock.assert_called_with` ή :meth:`~Mock.assert_called_once_with` για " +"να ελέγξουμε ότι κλήθηκε με τα σωστά ορίσματα." #: library/unittest.mock-examples.rst:59 msgid "" "This example tests that calling ``ProductionClass().method`` results in a " "call to the ``something`` method:" msgstr "" +"Αυτό το παράδειγμα ελέγχει ότι η κλήση της ``ProductionClass().method`` έχει " +"ως αποτέλεσμα μια κλήση στη μέθοδο ``something``:" #: library/unittest.mock-examples.rst:76 msgid "Mock for Method Calls on an Object" -msgstr "" +msgstr "Προσομοίωση για Κλήσεις Μεθόδων σε ένα Αντικείμενο" #: library/unittest.mock-examples.rst:78 msgid "" @@ -84,18 +99,27 @@ msgid "" "method (or some part of the system under test) and then check that it is " "used in the correct way." msgstr "" +"Στο τελευταίο παράδειγμα επιδιορθώσαμε μια μέθοδο απευθείας σε ένα " +"αντικείμενο για να ελέγξουμε ότι κλήθηκε σωστά. Μια άλλη κοινή χρήση είναι " +"να περάσουμε ένα αντικείμενο σε μια μέθοδο (ή σε κάποιο μέρος του συστήματος " +"υπό δοκιμή) και στη συνέχεια να ελέγξουμε ότι χρησιμοποιείται με τον σωστό " +"τρόπο." #: library/unittest.mock-examples.rst:83 msgid "" "The simple ``ProductionClass`` below has a ``closer`` method. If it is " "called with an object then it calls ``close`` on it." msgstr "" +"Η απλή ``ProductionClass`` παρακάτω έχει μια μέθοδο ``closer``. Εάν κληθεί " +"με ένα αντικείμενο, τότε καλεί τη μέθοδο ``close`` σε αυτό." #: library/unittest.mock-examples.rst:91 msgid "" "So to test it we need to pass in an object with a ``close`` method and check " "that it was called correctly." msgstr "" +"Έτσι, για να το δοκιμάσουμε, πρέπει να περάσουμε ένα αντικείμενο με μια " +"μέθοδο ``close`` και να ελέγξουμε ότι κλήθηκε σωστά." #: library/unittest.mock-examples.rst:99 msgid "" @@ -104,10 +128,15 @@ msgid "" "accessing it in the test will create it, but :meth:`~Mock." "assert_called_with` will raise a failure exception." msgstr "" +"Δεν χρειάζεται να κάνουμε καμία εργασία για να παρέχουμε τη μέθοδο 'close' " +"στην προσομοίωσή μας. Η πρόσβαση στο close τη δημιουργεί. Έτσι, αν το " +"'close' δεν έχει ήδη κληθεί, τότε η πρόσβαση σε αυτό στη δοκιμή θα το " +"δημιουργήσει, αλλά η :meth:`~Mock.assert_called_with` θα κάνει raise μια " +"εξαίρεση αποτυχίας." #: library/unittest.mock-examples.rst:106 msgid "Mocking Classes" -msgstr "" +msgstr "Προσομοίωση Κλάσεων" #: library/unittest.mock-examples.rst:108 msgid "" @@ -116,6 +145,12 @@ msgid "" "Instances are created by *calling the class*. This means you access the " "\"mock instance\" by looking at the return value of the mocked class." msgstr "" +"Μια συνηθισμένη περίπτωση χρήσης είναι η προσομοίωση κλάσεων που " +"δημιουργούνται από τον κώδικα υπό δοκιμή. Όταν επιδιορθώνετε (patch) μια " +"κλάση, τότε αυτή η κλάση αντικαθίσταται με μια προσομοίωση. Τα στιγμιότυπα " +"δημιουργούνται με την *κλήση της κλάσης*. Αυτό σημαίνει ότι έχετε πρόσβαση " +"στο \"στιγμιότυπο προσομοίωσης\" εξετάζοντας την τιμή επιστροφής της " +"προσομοιωμένης κλάσης." #: library/unittest.mock-examples.rst:113 msgid "" @@ -125,10 +160,38 @@ msgid "" "mock, so it is configured by modifying the mock :attr:`~Mock." "return_value`. ::" msgstr "" +"Στο παρακάτω παράδειγμα έχουμε μια συνάρτηση ``some_function`` που " +"δημιουργεί ένα στιγμιότυπο της ``Foo`` και καλεί μια μέθοδο σε αυτό. Η κλήση " +"στη :func:`patch` αντικαθιστά την κλάση ``Foo`` με μια προσομοίωση. Το " +"στιγμιότυπο της ``Foo`` είναι το αποτέλεσμα της κλήσης της προσομοίωσης, " +"οπότε διαμορφώνεται τροποποιώντας το χαρακτηριστικό :attr:`~Mock." +"return_value` της προσομοίωσης. ::" + +#: library/unittest.mock-examples.rst:118 +msgid "" +">>> def some_function():\n" +"... instance = module.Foo()\n" +"... return instance.method()\n" +"...\n" +">>> with patch('module.Foo') as mock:\n" +"... instance = mock.return_value\n" +"... instance.method.return_value = 'the result'\n" +"... result = some_function()\n" +"... assert result == 'the result'" +msgstr "" +">>> def some_function():\n" +"... instance = module.Foo()\n" +"... return instance.method()\n" +"...\n" +">>> with patch('module.Foo') as mock:\n" +"... instance = mock.return_value\n" +"... instance.method.return_value = 'the result'\n" +"... result = some_function()\n" +"... assert result == 'the result'" #: library/unittest.mock-examples.rst:130 msgid "Naming your mocks" -msgstr "" +msgstr "Ονομασία των προσομοιώσεών σας" #: library/unittest.mock-examples.rst:132 msgid "" @@ -136,10 +199,14 @@ msgid "" "the mock and can be helpful when the mock appears in test failure messages. " "The name is also propagated to attributes or methods of the mock:" msgstr "" +"Μπορεί να είναι χρήσιμο να δώσετε στις προσομοιώσεις σας ένα όνομα. Το όνομα " +"εμφανίζεται στην αναπαράσταση (repr) της προσομοίωσης και μπορεί να είναι " +"χρήσιμο όταν η προσομοίωση εμφανίζεται σε μηνύματα αποτυχίας δοκιμών. Το " +"όνομα επίσης μεταδίδεται σε χαρακτηριστικά ή μεθόδους της προσομοίωσης:" #: library/unittest.mock-examples.rst:144 msgid "Tracking all Calls" -msgstr "" +msgstr "Παρακολούθηση όλων των Κλήσεων" #: library/unittest.mock-examples.rst:146 msgid "" @@ -147,6 +214,9 @@ msgid "" "`~Mock.mock_calls` attribute records all calls to child attributes of the " "mock - and also to their children." msgstr "" +"Συχνά θέλετε να παρακολουθείτε περισσότερες από μία κλήσεις σε μια μέθοδο. " +"Το χαρακτηριστικό :attr:`~Mock.mock_calls` καταγράφει όλες τις κλήσεις σε " +"θυγατρικά χαρακτηριστικά της προσομοίωσης - και επίσης στα παιδιά τους." #: library/unittest.mock-examples.rst:158 msgid "" @@ -155,12 +225,18 @@ msgid "" "well as asserting that the calls you expected have been made, you are also " "checking that they were made in the right order and with no additional calls:" msgstr "" +"Εάν κάνετε μια δήλωση σχετικά με το ``mock_calls`` και έχουν κληθεί " +"απροσδόκητες μέθοδοι, τότε η δήλωση θα αποτύχει. Αυτό είναι χρήσιμο επειδή " +"εκτός από το να δηλώνετε ότι οι κλήσεις που περιμένατε έχουν γίνει, ελέγχετε " +"επίσης ότι έγιναν με τη σωστή σειρά και χωρίς επιπλέον κλήσεις:" #: library/unittest.mock-examples.rst:163 msgid "" "You use the :data:`call` object to construct lists for comparing with " "``mock_calls``:" msgstr "" +"Χρησιμοποιήστε το αντικείμενο :data:`call` για να κατασκευάσετε λίστες για " +"σύγκριση με το ``mock_calls``:" #: library/unittest.mock-examples.rst:170 msgid "" @@ -168,26 +244,34 @@ msgid "" "it is not possible to track nested calls where the parameters used to create " "ancestors are important:" msgstr "" +"Ωστόσο, οι παράμετροι σε κλήσεις που επιστρέφουν προσομοιώσεις δεν " +"καταγράφονται, που σημαίνει ότι δεν είναι δυνατή η παρακολούθηση " +"εμφωλευμένων κλήσεων όπου οι παράμετροι που χρησιμοποιούνται για τη " +"δημιουργία προγόνων είναι σημαντικοί:" #: library/unittest.mock-examples.rst:181 msgid "Setting Return Values and Attributes" -msgstr "" +msgstr "Ορισμός Τιμών Επιστροφής και Χαρακτηριστικών" #: library/unittest.mock-examples.rst:183 msgid "Setting the return values on a mock object is trivially easy:" msgstr "" +"Ορισμός των τιμών επιστροφής σε ένα αντικείμενο προσομοίωσης είναι " +"εξαιρετικά εύκολος:" #: library/unittest.mock-examples.rst:190 msgid "Of course you can do the same for methods on the mock:" -msgstr "" +msgstr "Φυσικά μπορείτε να κάνετε το ίδιο για μεθόδους στην προσομοίωση:" #: library/unittest.mock-examples.rst:197 msgid "The return value can also be set in the constructor:" -msgstr "" +msgstr "Η τιμή επιστροφής μπορεί επίσης να οριστεί στον κατασκευαστή:" #: library/unittest.mock-examples.rst:203 msgid "If you need an attribute setting on your mock, just do it:" msgstr "" +"Εάν χρειάζεστε έναν ορισμό χαρακτηριστικού στην προσομοίωσή σας, απλώς κάντε " +"το:" #: library/unittest.mock-examples.rst:210 msgid "" @@ -195,22 +279,31 @@ msgid "" "``mock.connection.cursor().execute(\"SELECT 1\")``. If we wanted this call " "to return a list, then we have to configure the result of the nested call." msgstr "" +"Μερικές φορές θέλετε να προσομοιώσετε μια πιο σύνθετη κατάσταση, όπως για " +"παράδειγμα ``mock.connection.cursor().execute(\"SELECT 1\")``. Εάν θέλαμε " +"αυτή τη κλήση να επιστρέψει μια λίστα, τότε πρέπει να διαμορφώσουμε το " +"αποτέλεσμα της εμφωλευμένης κλήσης." #: library/unittest.mock-examples.rst:214 msgid "" "We can use :data:`call` to construct the set of calls in a \"chained call\" " "like this for easy assertion afterwards:" msgstr "" +"Μπορούμε να χρησιμοποιήσουμε το αντικείμενο :data:`call` για να " +"κατασκευάσουμε την λίστα των κλήσεων σε μια \"αλυσιδωτή κλήση\" όπως αυτή " +"για εύκολη δήλωση αργότερα:" #: library/unittest.mock-examples.rst:228 msgid "" "It is the call to ``.call_list()`` that turns our call object into a list of " "calls representing the chained calls." msgstr "" +"Είναι η κλήση στο ``.call_list()`` που μετατρέπει το αντικείμενο κλήσης σε " +"μια λίστα κλήσεων που αντιπροσωπεύουν τις αλυσιδωτές κλήσεις." #: library/unittest.mock-examples.rst:233 msgid "Raising exceptions with mocks" -msgstr "" +msgstr "Πρόκληση εξαιρέσεων με προσομοιώσεις" #: library/unittest.mock-examples.rst:235 msgid "" @@ -218,10 +311,13 @@ msgid "" "exception class or instance then the exception will be raised when the mock " "is called." msgstr "" +"Ένα χρήσιμο χαρακτηριστικό είναι το :attr:`~Mock.side_effect`. Εάν το " +"ορίσετε σε μια κλάση εξαίρεσης ή ένα στιγμιότυπο, τότε η εξαίρεση θα γίνει " +"raise όταν κληθεί η προσομοίωση." #: library/unittest.mock-examples.rst:247 msgid "Side effect functions and iterables" -msgstr "" +msgstr "Συναρτήσεις παρενέργειας και iterables" #: library/unittest.mock-examples.rst:249 msgid "" @@ -231,6 +327,11 @@ msgid "" "set ``side_effect`` to an iterable every call to the mock returns the next " "value from the iterable:" msgstr "" +"Το ``side_effect`` μπορεί επίσης να οριστεί σε μια συνάρτηση ή ένα iterable. " +"Η χρήση του ``side_effect`` ως iterable είναι όταν η προσομοίωσή σας " +"πρόκειται να κληθεί αρκετές φορές, και θέλετε κάθε κλήση να επιστρέφει μια " +"διαφορετική τιμή. Όταν ορίζετε το ``side_effect`` σε ένα iterable, κάθε " +"κλήση στην προσομοίωση επιστρέφει την επόμενη τιμή από το iterable:" #: library/unittest.mock-examples.rst:264 msgid "" @@ -239,10 +340,14 @@ msgid "" "function. The function will be called with the same arguments as the mock. " "Whatever the function returns is what the call returns:" msgstr "" +"Για πιο προηγμένες χρήσεις, όπως η δυναμική μεταβολή των τιμών επιστροφής " +"ανάλογα με το πώς καλείται η προσομοίωση, το ``side_effect`` μπορεί να είναι " +"μια συνάρτηση. Η συνάρτηση θα κληθεί με τα ίδια ορίσματα με την προσομοίωση. " +"Ό,τι επιστρέφει η συνάρτηση είναι αυτό που επιστρέφει η κλήση:" #: library/unittest.mock-examples.rst:281 msgid "Mocking asynchronous iterators" -msgstr "" +msgstr "Προσομοίωση ασύγχρονων επαναληπτών" #: library/unittest.mock-examples.rst:283 msgid "" @@ -251,10 +356,15 @@ msgid "" "attribute of ``__aiter__`` can be used to set the return values to be used " "for iteration." msgstr "" +"Από την έκδοση Python 3.8, οι ``AsyncMock`` και ``MagicMock`` έχουν " +"υποστήριξη για την προσομοίωση :ref:`ασύγχρονων επαναληπτών ` μέσω του ``__aiter__``. Το χαρακτηριστικό :attr:`~Mock." +"return_value` του ``__aiter__`` μπορεί να χρησιμοποιηθεί για να ορίσει τις " +"τιμές επιστροφής που θα χρησιμοποιηθούν για την επανάληψη." #: library/unittest.mock-examples.rst:298 msgid "Mocking asynchronous context manager" -msgstr "" +msgstr "Προσομοίωση ασύγχρονου διαχειριστή περιεχομένου" #: library/unittest.mock-examples.rst:300 msgid "" @@ -263,10 +373,15 @@ msgid "" "default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances that " "return an async function." msgstr "" +"Από την έκδοση Python 3.8, οι ``AsyncMock`` και ``MagicMock`` έχουν " +"υποστήριξη για την προσομοίωση :ref:`ασύγχρονων διαχειριστών ` μέσω των ``__aenter__`` και ``__aexit__``. Από προεπιλογή, οι " +"``__aenter__`` και ``__aexit__`` είναι στιγμιότυπα ``AsyncMock`` που " +"επιστρέφουν μια ασύγχρονη συνάρτηση." #: library/unittest.mock-examples.rst:322 msgid "Creating a Mock from an Existing Object" -msgstr "" +msgstr "Δημιουργία Προσομοίωσης από ένα Υφιστάμενο Αντικείμενο" #: library/unittest.mock-examples.rst:324 msgid "" @@ -277,6 +392,14 @@ msgid "" "you refactor the first class, so that it no longer has ``some_method`` - " "then your tests will continue to pass even though your code is now broken!" msgstr "" +"Ένα πρόβλημα με την υπερβολική χρήση της προσομοίωσης είναι ότι συνδέει τις " +"δοκιμές σας με την υλοποίηση των προσομοιώσεών σας αντί με τον πραγματικό " +"κώδικα. Υποθέστε ότι έχετε μια κλάση που υλοποιεί την ``some_method``. Σε " +"μια δοκιμή για μια άλλη κλάση, παρέχετε μια προσομοίωση αυτού του " +"αντικειμένου που *επίσης* παρέχει την ``some_method``. Εάν αργότερα " +"αναδιαρθρώσετε την πρώτη κλάση, έτσι ώστε να μην έχει πλέον την " +"``some_method`` - τότε οι δοκιμές σας θα συνεχίσουν να περνούν, παρόλο που ο " +"κώδικάς σας είναι τώρα σπασμένος!" #: library/unittest.mock-examples.rst:331 msgid "" @@ -287,6 +410,14 @@ msgid "" "specification, then tests that use that class will start failing immediately " "without you having to instantiate the class in those tests." msgstr "" +":class:`Mock` σας επιτρέπει να παρέχετε ένα αντικείμενο ως προδιαγραφή για " +"την προσομοίωση, χρησιμοποιώντας το όρισμα λέξης-κλειδιού *spec*. Η πρόσβαση " +"σε μεθόδους / χαρακτηριστικά στην προσομοίωση που δεν υπάρχουν στο " +"αντικείμενο προδιαγραφής σας θα γίνει raise αμέσως ένα σφάλμα " +"χαρακτηριστικού. Εάν αλλάξετε την υλοποίηση της προδιαγραφής σας, τότε οι " +"δοκιμές που χρησιμοποιούν αυτή την κλάση θα αρχίσουν να αποτυγχάνουν αμέσως " +"χωρίς να χρειάζεται να δημιουργήσετε ένα στιγμιότυπο της κλάσης σε αυτές τις " +"δοκιμές." #: library/unittest.mock-examples.rst:344 msgid "" @@ -294,12 +425,34 @@ msgid "" "mock, regardless of whether some parameters were passed as positional or " "named arguments::" msgstr "" +"Η χρήση μιας προδιαγραφής επιτρέπει επίσης μια πιο έξυπνη αντιστοίχιση των " +"κλήσεων που γίνονται στην προσομοίωση, ανεξάρτητα από το αν ορισμένες " +"παράμετροι περάστηκαν ως ορισμένες ή ονομαστικές παραμέτρους::" + +#: library/unittest.mock-examples.rst:348 +msgid "" +">>> def f(a, b, c): pass\n" +"...\n" +">>> mock = Mock(spec=f)\n" +">>> mock(1, 2, 3)\n" +"\n" +">>> mock.assert_called_with(a=1, b=2, c=3)" +msgstr "" +">>> def f(a, b, c): pass\n" +"...\n" +">>> mock = Mock(spec=f)\n" +">>> mock(1, 2, 3)\n" +"\n" +">>> mock.assert_called_with(a=1, b=2, c=3)" #: library/unittest.mock-examples.rst:355 msgid "" "If you want this smarter matching to also work with method calls on the " "mock, you can use :ref:`auto-speccing `." msgstr "" +"Εάν θέλετε αυτή η πιο έξυπνη αντιστοίχιση να λειτουργεί επίσης με κλήσεις " +"μεθόδων στην προσομοίωση, μπορείτε να χρησιμοποιήσετε :ref:`auto-speccing " +"`." #: library/unittest.mock-examples.rst:358 msgid "" @@ -307,10 +460,13 @@ msgid "" "arbitrary attributes as well as the getting of them then you can use " "*spec_set* instead of *spec*." msgstr "" +"Εάν θέλετε μια πιο ισχυρή μορφή προδιαγραφής που αποτρέπει τον ορισμό " +"αυθαίρετων χαρακτηριστικών καθώς και την πρόσβαση σε αυτά, τότε μπορείτε να " +"χρησιμοποιήσετε το *spec_set* αντί για το *spec*." #: library/unittest.mock-examples.rst:364 msgid "Using side_effect to return per file content" -msgstr "" +msgstr "Χρήση του side_effect για επιστροφή περιεχομένου ανά αρχείο" #: library/unittest.mock-examples.rst:366 msgid "" @@ -318,10 +474,51 @@ msgid "" "side_effect` can be used to return a new Mock object per call. This can be " "used to return different contents per file stored in a dictionary::" msgstr "" +"Η :func:`mock_open` χρησιμοποιείται για την επιδιόρθωση (patch) της :func:" +"`open` μεθόδου. Το :attr:`~Mock.side_effect` μπορεί να χρησιμοποιηθεί για " +"την επιστροφή ενός νέου αντικειμένου Mock ανά κλήση. Αυτό μπορεί να " +"χρησιμοποιηθεί για την επιστροφή διαφορετικών περιεχομένων ανά αρχείο που " +"αποθηκεύονται σε ένα λεξικό::" + +#: library/unittest.mock-examples.rst:370 +msgid "" +"DEFAULT = \"default\"\n" +"data_dict = {\"file1\": \"data1\",\n" +" \"file2\": \"data2\"}\n" +"\n" +"def open_side_effect(name):\n" +" return mock_open(read_data=data_dict.get(name, DEFAULT))()\n" +"\n" +"with patch(\"builtins.open\", side_effect=open_side_effect):\n" +" with open(\"file1\") as file1:\n" +" assert file1.read() == \"data1\"\n" +"\n" +" with open(\"file2\") as file2:\n" +" assert file2.read() == \"data2\"\n" +"\n" +" with open(\"file3\") as file2:\n" +" assert file2.read() == \"default\"" +msgstr "" +"DEFAULT = \"default\"\n" +"data_dict = {\"file1\": \"data1\",\n" +" \"file2\": \"data2\"}\n" +"\n" +"def open_side_effect(name):\n" +" return mock_open(read_data=data_dict.get(name, DEFAULT))()\n" +"\n" +"with patch(\"builtins.open\", side_effect=open_side_effect):\n" +" with open(\"file1\") as file1:\n" +" assert file1.read() == \"data1\"\n" +"\n" +" with open(\"file2\") as file2:\n" +" assert file2.read() == \"data2\"\n" +"\n" +" with open(\"file3\") as file2:\n" +" assert file2.read() == \"default\"" #: library/unittest.mock-examples.rst:389 msgid "Patch Decorators" -msgstr "" +msgstr "Διακοσμητές Επιδιόρθωσης (Patch Decorators)" #: library/unittest.mock-examples.rst:393 msgid "" @@ -329,6 +526,9 @@ msgid "" "they are looked up. This is normally straightforward, but for a quick guide " "read :ref:`where to patch `." msgstr "" +"Με την :func:`patch` έχει σημασία να επιδιορθώνετε αντικείμενα στο χώρο " +"ονομάτων όπου αναζητούνται. Αυτό είναι συνήθως απλό, αλλά για έναν γρήγορο " +"οδηγό διαβάστε :ref:`where to patch `." #: library/unittest.mock-examples.rst:398 msgid "" @@ -338,6 +538,13 @@ msgid "" "on them has to be undone after the test or the patch will persist into other " "tests and cause hard to diagnose problems." msgstr "" +"Μια κοινή ανάγκη στις δοκιμές είναι να επιδιορθώσετε ένα χαρακτηριστικό " +"κλάσης ή ένα χαρακτηριστικό μονάδας, για παράδειγμα επιδιόρθωση ενός " +"ενσωματωμένου ή επιδιόρθωση μιας κλάσης σε μια μονάδα για να ελέγξετε ότι " +"δημιουργείται. Οι μονάδες και οι κλάσεις είναι ουσιαστικά παγκόσμιες, οπότε " +"η επιδιόρθωση σε αυτές πρέπει να αναιρεθεί μετά τη δοκιμή ή η επιδιόρθωση θα " +"επιμείνει σε άλλες δοκιμές και θα προκαλέσει προβλήματα που είναι δύσκολα να " +"διαγνωστούν." #: library/unittest.mock-examples.rst:404 msgid "" @@ -349,25 +556,85 @@ msgid "" "the name of the attribute you would like patched, plus optionally the value " "to patch it with." msgstr "" +"Η προσομοίωση παρέχει τρεις βολικούς διακοσμητές για αυτό: :func:`patch`, :" +"func:`patch.object` και :func:`patch.dict`. Η ``patch`` παίρνει μια μοναδική " +"συμβολοσειρά, της μορφής ``package.module.Class.attribute`` για να καθορίσει " +"το χαρακτηριστικό που επιδιορθώνετε. Επίσης παίρνει προαιρετικά μια τιμή με " +"την οποία θέλετε να αντικατασταθεί το χαρακτηριστικό (ή η κλάση ή " +"οτιδήποτε). 'patch.object' παίρνει ένα αντικείμενο και το όνομα του " +"χαρακτηριστικού που θα θέλατε να επιδιορθώσετε, συν προαιρετικά την τιμή με " +"την οποία θα το επιδιορθώσετε." #: library/unittest.mock-examples.rst:412 msgid "``patch.object``::" -msgstr "" +msgstr "``patch.object``::" + +#: library/unittest.mock-examples.rst:414 +msgid "" +">>> original = SomeClass.attribute\n" +">>> @patch.object(SomeClass, 'attribute', sentinel.attribute)\n" +"... def test():\n" +"... assert SomeClass.attribute == sentinel.attribute\n" +"...\n" +">>> test()\n" +">>> assert SomeClass.attribute == original\n" +"\n" +">>> @patch('package.module.attribute', sentinel.attribute)\n" +"... def test():\n" +"... from package.module import attribute\n" +"... assert attribute is sentinel.attribute\n" +"...\n" +">>> test()" +msgstr "" +">>> original = SomeClass.attribute\n" +">>> @patch.object(SomeClass, 'attribute', sentinel.attribute)\n" +"... def test():\n" +"... assert SomeClass.attribute == sentinel.attribute\n" +"...\n" +">>> test()\n" +">>> assert SomeClass.attribute == original\n" +"\n" +">>> @patch('package.module.attribute', sentinel.attribute)\n" +"... def test():\n" +"... from package.module import attribute\n" +"... assert attribute is sentinel.attribute\n" +"...\n" +">>> test()" #: library/unittest.mock-examples.rst:429 msgid "" "If you are patching a module (including :mod:`builtins`) then use :func:" "`patch` instead of :func:`patch.object`:" msgstr "" +"Εάν επιδιορθώνετε ένα module (συμπεριλαμβανομένου του :mod:`builtins`), τότε " +"χρησιμοποιήστε την :func:`patch` αντί για την :func:`patch.object`:" #: library/unittest.mock-examples.rst:439 msgid "" "The module name can be 'dotted', in the form ``package.module`` if needed::" msgstr "" +"Το όνομα του module μπορεί να είναι 'τελεία', με τη μορφή ``package.module`` " +"εάν χρειάζεται::" + +#: library/unittest.mock-examples.rst:441 +msgid "" +">>> @patch('package.module.ClassName.attribute', sentinel.attribute)\n" +"... def test():\n" +"... from package.module import ClassName\n" +"... assert ClassName.attribute == sentinel.attribute\n" +"...\n" +">>> test()" +msgstr "" +">>> @patch('package.module.ClassName.attribute', sentinel.attribute)\n" +"... def test():\n" +"... from package.module import ClassName\n" +"... assert ClassName.attribute == sentinel.attribute\n" +"...\n" +">>> test()" #: library/unittest.mock-examples.rst:448 msgid "A nice pattern is to actually decorate test methods themselves:" -msgstr "" +msgstr "Ένα ωραίο μοτίβο είναι να διακοσμείτε πραγματικά τις μεθόδους δοκιμής:" #: library/unittest.mock-examples.rst:459 msgid "" @@ -375,10 +642,35 @@ msgid "" "argument (or :func:`patch.object` with two arguments). The mock will be " "created for you and passed into the test function / method:" msgstr "" +"Εάν θέλετε να επιδιορθώσετε με μια προσομοίωση, μπορείτε να χρησιμοποιήσετε :" +"func:`patch` με μόνο ένα όρισμα (ή :func:`patch.object` με δύο ορίσματα). Η " +"προσομοίωση θα δημιουργηθεί για εσάς και θα περαστεί στη συνάρτηση / μέθοδο " +"δοκιμής:" #: library/unittest.mock-examples.rst:471 msgid "You can stack up multiple patch decorators using this pattern::" msgstr "" +"Μπορείτε να στοιβάξετε πολλαπλούς διακοσμητές επιδιόρθωσης χρησιμοποιώντας " + +#: library/unittest.mock-examples.rst:473 +msgid "" +">>> class MyTest(unittest.TestCase):\n" +"... @patch('package.module.ClassName1')\n" +"... @patch('package.module.ClassName2')\n" +"... def test_something(self, MockClass2, MockClass1):\n" +"... self.assertIs(package.module.ClassName1, MockClass1)\n" +"... self.assertIs(package.module.ClassName2, MockClass2)\n" +"...\n" +">>> MyTest('test_something').test_something()" +msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"... @patch('package.module.ClassName1')\n" +"... @patch('package.module.ClassName2')\n" +"... def test_something(self, MockClass2, MockClass1):\n" +"... self.assertIs(package.module.ClassName1, MockClass1)\n" +"... self.assertIs(package.module.ClassName2, MockClass2)\n" +"...\n" +">>> MyTest('test_something').test_something()" #: library/unittest.mock-examples.rst:482 msgid "" @@ -387,6 +679,11 @@ msgid "" "decorators are applied). This means from the bottom up, so in the example " "above the mock for ``test_module.ClassName2`` is passed in first." msgstr "" +"Όταν εμφωλεύετε διακοσμητές επιδιόρθωσης, οι προσομοιώσεις περνιούνται στη " +"διακοσμημένη συνάρτηση με την ίδια σειρά που εφαρμόστηκαν (η κανονική τάξη " +"*Python* με την οποία εφαρμόζονται οι διακοσμητές). Αυτό σημαίνει από κάτω " +"προς τα πάνω, οπότε στο παραπάνω παράδειγμα η προσομοίωση για το " +"``test_module.ClassName2`` περνάει πρώτη." #: library/unittest.mock-examples.rst:487 msgid "" @@ -394,18 +691,26 @@ msgid "" "during a scope and restoring the dictionary to its original state when the " "test ends:" msgstr "" +"Υπάρχει επίσης η :func:`patch.dict` για τον ορισμό τιμών σε ένα λεξικό μόνο " +"κατά τη διάρκεια ενός πεδίου και την αποκατάσταση του λεξικού στην αρχική " +"του κατάσταση όταν τελειώνει η δοκιμή:" #: library/unittest.mock-examples.rst:498 msgid "" "``patch``, ``patch.object`` and ``patch.dict`` can all be used as context " "managers." msgstr "" +"Η ``patch``, η ``patch.object`` και η ``patch.dict`` μπορούν όλες να " +"χρησιμοποιηθούν ως διαχειριστές συμφραζομένων." #: library/unittest.mock-examples.rst:500 msgid "" "Where you use :func:`patch` to create a mock for you, you can get a " "reference to the mock using the \"as\" form of the with statement:" msgstr "" +"Όπου χρησιμοποιείτε την :func:`patch` για να δημιουργήσετε μια προσομοίωση " +"για εσάς, μπορείτε να λάβετε μια αναφορά στην προσομοίωση χρησιμοποιώντας τη " +"μορφή \"as\" της δήλωσης with:" #: library/unittest.mock-examples.rst:515 msgid "" @@ -413,18 +718,23 @@ msgid "" "as class decorators. When used in this way it is the same as applying the " "decorator individually to every method whose name starts with \"test\"." msgstr "" +"Ως εναλλακτική, η ``patch``, η ``patch.object`` και η ``patch.dict`` μπορούν " +"να χρησιμοποιηθούν ως διακοσμητές κλάσης. Όταν χρησιμοποιούνται με αυτόν τον " +"τρόπο, είναι το ίδιο με την εφαρμογή του διακοσμητή ξεχωριστά σε κάθε μέθοδο " +"του οποίου το όνομα ξεκινά με \"test\"." #: library/unittest.mock-examples.rst:523 msgid "Further Examples" -msgstr "" +msgstr "Περαιτέρω Παραδείγματα" #: library/unittest.mock-examples.rst:526 msgid "Here are some more examples for some slightly more advanced scenarios." msgstr "" +"Εδώ είναι μερικά ακόμη παραδείγματα για μερικά ελαφρώς πιο προηγμένα σενάρια." #: library/unittest.mock-examples.rst:530 msgid "Mocking chained calls" -msgstr "" +msgstr "Προσομοίωση αλυσιδωτών κλήσεων" #: library/unittest.mock-examples.rst:532 msgid "" @@ -433,12 +743,19 @@ msgid "" "for the first time, or you fetch its ``return_value`` before it has been " "called, a new :class:`Mock` is created." msgstr "" +"Η προσομοίωση αλυσιδωτών κλήσεων είναι στην πραγματικότητα απλή με την " +"προσομοίωση μόλις κατανοήσετε το χαρακτηριστικό :attr:`~Mock.return_value`. " +"Όταν καλείται μια προσομοίωση για πρώτη φορά, ή λαμβάνετε την " +"``return_value`` της πριν καλεστεί, δημιουργείται μια νέα :class:`Mock`." #: library/unittest.mock-examples.rst:537 msgid "" "This means that you can see how the object returned from a call to a mocked " "object has been used by interrogating the ``return_value`` mock:" msgstr "" +"Αυτό σημαίνει ότι μπορείτε να δείτε πώς έχει χρησιμοποιηθεί το αντικείμενο " +"που επιστρέφεται από μια κλήση σε ένα προσομοιωμένο αντικείμενο, εξετάζοντας " +"την προσομοίωση ``return_value``:" #: library/unittest.mock-examples.rst:545 msgid "" @@ -446,10 +763,13 @@ msgid "" "chained calls. Of course another alternative is writing your code in a more " "testable way in the first place..." msgstr "" +"Από εδώ είναι ένα απλό βήμα για τη διαμόρφωση και στη συνέχεια τη δημιουργία " +"δηλώσεων σχετικά με τις αλυσιδωτές κλήσεις. Φυσικά μια άλλη εναλλακτική " +"είναι να γράψετε τον κώδικά σας με πιο δοκιμαστικό τρόπο από την αρχή..." #: library/unittest.mock-examples.rst:549 msgid "So, suppose we have some code that looks a little bit like this:" -msgstr "" +msgstr "Λοιπόν, υποθέτουμε ότι έχουμε κάποιο κώδικα που μοιάζει λίγο με αυτό:" #: library/unittest.mock-examples.rst:558 msgid "" @@ -457,6 +777,10 @@ msgid "" "``method()``? Specifically, we want to test that the code section ``# more " "code`` uses the response object in the correct way." msgstr "" +"Υποθέτοντας ότι το ``BackendProvider`` έχει ήδη δοκιμαστεί καλά, πώς " +"δοκιμάζουμε τη ``method()``; Συγκεκριμένα, θέλουμε να δοκιμάσουμε ότι η " +"ενότητα κώδικα ``# more code`` χρησιμοποιεί το αντικείμενο απόκρισης με τον " +"σωστό τρόπο." #: library/unittest.mock-examples.rst:562 msgid "" @@ -467,6 +791,14 @@ msgid "" "assume the object it returns is 'file-like', so we'll ensure that our " "response object uses the builtin :func:`open` as its ``spec``." msgstr "" +"Καθώς αυτή η αλυσίδα κλήσεων γίνεται από ένα χαρακτηριστικό στιγμιότυπου, " +"μπορούμε να επιδιορθώσουμε (monkey patch) το χαρακτηριστικό ``backend`` σε " +"ένα στιγμιότυπο ``Something``. Σε αυτή την συγκεκριμένη περίπτωση, μας " +"ενδιαφέρει μόνο η τιμή επιστροφής από την τελική κλήση στο ``start_call``, " +"οπότε δεν έχουμε πολλή διαμόρφωση να κάνουμε. Ας υποθέσουμε ότι το " +"αντικείμενο που επιστρέφει είναι 'σαν αρχείο', οπότε θα διασφαλίσουμε ότι το " +"αντικείμενο απόκρισης μας χρησιμοποιεί την ενσωματωμένη :func:`open` ως το " +"``spec`` της." #: library/unittest.mock-examples.rst:569 msgid "" @@ -474,18 +806,59 @@ msgid "" "response object for it. To set the response as the return value for that " "final ``start_call`` we could do this::" msgstr "" +"Για να το κάνουμε αυτό, δημιουργούμε ένα στιγμιότυπο προσομοίωσης ως το mock " +"backend μας και δημιουργούμε ένα αντικείμενο προσομοίωσης απόκρισης για " +"αυτό. Για να ορίσουμε την απόκριση ως την τιμή επιστροφής για εκείνο το " +"τελικό ``start_call``, θα μπορούσαμε να κάνουμε αυτό::" + +#: library/unittest.mock-examples.rst:573 +msgid "" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." +"return_value = mock_response" +msgstr "" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." +"return_value = mock_response" #: library/unittest.mock-examples.rst:575 msgid "" "We can do that in a slightly nicer way using the :meth:`~Mock." "configure_mock` method to directly set the return value for us::" msgstr "" +"Μπορούμε να το κάνουμε με έναν ελαφρώς πιο ωραίο τρόπο χρησιμοποιώντας τη :" +"meth:`~Mock.configure_mock` μέθοδο για να ορίσουμε απευθείας την τιμή " +"επιστροφής για εμάς::" + +#: library/unittest.mock-examples.rst:578 +msgid "" +">>> something = Something()\n" +">>> mock_response = Mock(spec=open)\n" +">>> mock_backend = Mock()\n" +">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." +"return_value': mock_response}\n" +">>> mock_backend.configure_mock(**config)" +msgstr "" +">>> something = Something()\n" +">>> mock_response = Mock(spec=open)\n" +">>> mock_backend = Mock()\n" +">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." +"return_value': mock_response}\n" +">>> mock_backend.configure_mock(**config)" #: library/unittest.mock-examples.rst:584 msgid "" "With these we monkey patch the \"mock backend\" in place and can make the " "real call::" msgstr "" +"Με αυτά, επιδιορθώνουμε (monkey patch) το \"mock backend\" στη θέση του και " +"μπορούμε να κάνουμε την πραγματική κλήση::" + +#: library/unittest.mock-examples.rst:587 +msgid "" +">>> something.backend = mock_backend\n" +">>> something.method()" +msgstr "" +">>> something.backend = mock_backend\n" +">>> something.method()" #: library/unittest.mock-examples.rst:590 msgid "" @@ -494,26 +867,52 @@ msgid "" "be several entries in ``mock_calls``. We can use :meth:`call.call_list` to " "create this list of calls for us::" msgstr "" +"Με το χαρακτηριστικό :attr:`~Mock.mock_calls` μπορούμε να ελέγξουμε την " +"αλυσιδωτή κλήση με μια μοναδική δήλωση. Μια αλυσιδωτή κλήση είναι πολλές " +"κλήσεις σε μία γραμμή κώδικα, οπότε θα υπάρχουν πολλές εισαγωγές στο " +"``mock_calls``. Μπορούμε να χρησιμοποιήσουμε τη :meth:`call.call_list` για " +"να δημιουργήσουμε αυτή τη λίστα κλήσεων για εμάς::" + +#: library/unittest.mock-examples.rst:595 +msgid "" +">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." +"start_call()\n" +">>> call_list = chained.call_list()\n" +">>> assert mock_backend.mock_calls == call_list" +msgstr "" +">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." +"start_call()\n" +">>> call_list = chained.call_list()\n" +">>> assert mock_backend.mock_calls == call_list" #: library/unittest.mock-examples.rst:601 msgid "Partial mocking" -msgstr "" +msgstr "Μερική προσομοίωση" #: library/unittest.mock-examples.rst:603 msgid "" -"In some tests I wanted to mock out a call to :meth:`datetime.date.today` to " -"return a known date, but I didn't want to prevent the code under test from " -"creating new date objects. Unfortunately :class:`datetime.date` is written " -"in C, and so I couldn't just monkey-patch out the static :meth:`datetime." +"For some tests, you may want to mock out a call to :meth:`datetime.date." +"today` to return a known date, but don't want to prevent the code under test " +"from creating new date objects. Unfortunately :class:`datetime.date` is " +"written in C, so you cannot just monkey-patch out the static :meth:`datetime." "date.today` method." msgstr "" +"Για ορισμένες δοκιμές, μπορεί να θέλετε να προσομοιώσετε μια κλήση στη :meth:" +"`datetime.date.today` για να επιστρέψετε μια γνωστή ημερομηνία, αλλά δεν " +"θέλετε να αποτρέψετε τον κώδικα υπό δοκιμή από τη δημιουργία νέων " +"αντικειμένων ημερομηνίας. Δυστυχώς, η :class:`datetime.date` είναι γραμμένη " +"σε C, οπότε δεν μπορείτε απλώς να κάνετε monkey-patch στη στατική :meth:" +"`datetime.date.today` μέθοδο." #: library/unittest.mock-examples.rst:608 msgid "" -"I found a simple way of doing this that involved effectively wrapping the " -"date class with a mock, but passing through calls to the constructor to the " -"real class (and returning real instances)." +"Instead, you can effectively wrap the date class with a mock, while passing " +"through calls to the constructor to the real class (and returning real " +"instances)." msgstr "" +"Αντίθετα, μπορείτε ουσιαστικά να τυλίξετε την κλάση ημερομηνίας με μια " +"προσομοίωση, ενώ περνάτε κλήσεις στον κατασκευαστή στην πραγματική κλάση " +"(και επιστρέφοντας πραγματικά στιγμιότυπα)." #: library/unittest.mock-examples.rst:612 msgid "" @@ -523,12 +922,39 @@ msgid "" "date. When the mock date class is called a real date will be constructed and " "returned by ``side_effect``. ::" msgstr "" +"Η :func:`patch decorator ` χρησιμοποιείται εδώ για να επιδιορθώσετε " +"την κλάση ημερομηνίας στο μοντέλο υπό δοκιμή. Το χαρακτηριστικό :attr:`~Mock." +"side_effect` στην προσομοίωση της κλάσης ημερομηνίας ρυθμίζεται στη συνέχεια " +"σε μια συνάρτηση λάμδα που επιστρέφει μια πραγματική ημερομηνία. Όταν " +"καλείται η προσομοίωση της κλάσης ημερομηνίας, θα κατασκευαστεί και θα " +"επιστραφεί μια πραγματική ημερομηνία από το ``side_effect``. ::" + +#: library/unittest.mock-examples.rst:618 +msgid "" +">>> from datetime import date\n" +">>> with patch('mymodule.date') as mock_date:\n" +"... mock_date.today.return_value = date(2010, 10, 8)\n" +"... mock_date.side_effect = lambda *args, **kw: date(*args, **kw)\n" +"...\n" +"... assert mymodule.date.today() == date(2010, 10, 8)\n" +"... assert mymodule.date(2009, 6, 8) == date(2009, 6, 8)" +msgstr "" +">>> from datetime import date\n" +">>> with patch('mymodule.date') as mock_date:\n" +"... mock_date.today.return_value = date(2010, 10, 8)\n" +"... mock_date.side_effect = lambda *args, **kw: date(*args, **kw)\n" +"...\n" +"... assert mymodule.date.today() == date(2010, 10, 8)\n" +"... assert mymodule.date(2009, 6, 8) == date(2009, 6, 8)" #: library/unittest.mock-examples.rst:626 msgid "" "Note that we don't patch :class:`datetime.date` globally, we patch ``date`` " "in the module that *uses* it. See :ref:`where to patch `." msgstr "" +"Σημειώστε ότι δεν επιδιορθώνουμε παγκοσμίως την :class:`datetime.date`, αλλά " +"επιδιορθώνουμε την ``date`` στο μοντέλο που τη *χρησιμοποιεί*. Δείτε :ref:" +"`where to patch `." #: library/unittest.mock-examples.rst:629 msgid "" @@ -537,12 +963,21 @@ msgid "" "find yourself having to calculate an expected result using exactly the same " "algorithm as the code under test, which is a classic testing anti-pattern." msgstr "" +"Όταν καλείται το ``date.today()``, επιστρέφεται μια γνωστή ημερομηνία, αλλά " +"οι κλήσεις στον κατασκευαστή ``date(...)`` εξακολουθούν να επιστρέφουν " +"κανονικές ημερομηνίες. Χωρίς αυτό, μπορεί να βρεθείτε να πρέπει να " +"υπολογίσετε ένα αναμενόμενο αποτέλεσμα χρησιμοποιώντας ακριβώς τον ίδιο " +"αλγόριθμο με τον κώδικα υπό δοκιμή, που είναι ένα κλασικό αντι-μοτίβο " +"δοκιμών." #: library/unittest.mock-examples.rst:634 msgid "" "Calls to the date constructor are recorded in the ``mock_date`` attributes " "(``call_count`` and friends) which may also be useful for your tests." msgstr "" +"Οι κλήσεις στον κατασκευαστή ημερομηνίας καταγράφονται στα χαρακτηριστικά " +"του ``mock_date`` (``call_count`` και φίλοι), τα οποία μπορεί επίσης να " +"είναι χρήσιμα για τις δοκιμές σας." #: library/unittest.mock-examples.rst:637 msgid "" @@ -550,16 +985,23 @@ msgid "" "is discussed in `this blog entry `_." msgstr "" +"Ένας εναλλακτικός τρόπος αντιμετώπισης της προσομοίωσης ημερομηνιών ή άλλων " +"ενσωματωμένων κλάσεων, συζητείται σε `αυτή την καταχώρηση ιστολογίου " +"`_." #: library/unittest.mock-examples.rst:643 msgid "Mocking a Generator Method" -msgstr "" +msgstr "Προσομοίωση μιας Μεθόδου Γεννήτριας" #: library/unittest.mock-examples.rst:645 msgid "" "A Python generator is a function or method that uses the :keyword:`yield` " "statement to return a series of values when iterated over [#]_." msgstr "" +"Μια γεννήτρια Python είναι μια συνάρτηση ή μέθοδος που χρησιμοποιεί τη :" +"keyword:`yield` δήλωση για να επιστρέψει μια σειρά τιμών όταν γίνεται " +"επανάληψη πάνω της [#]_." #: library/unittest.mock-examples.rst:648 msgid "" @@ -568,15 +1010,23 @@ msgid "" "iteration is :meth:`~container.__iter__`, so we can mock this using a :class:" "`MagicMock`." msgstr "" +"Μια μέθοδος / συνάρτηση γεννήτριας καλείται για να επιστρέψει το αντικείμενο " +"γεννήτριας. Είναι το αντικείμενο γεννήτριας που στη συνέχεια " +"επαναλαμβάνεται. Η μέθοδος πρωτοκόλλου για την επανάληψη είναι η :meth:" +"`~container.__iter__`, οπότε μπορούμε να την προσομοιώσουμε χρησιμοποιώντας " +"μια :class:`MagicMock`." #: library/unittest.mock-examples.rst:653 msgid "" "Here's an example class with an \"iter\" method implemented as a generator:" msgstr "" +"Εδώ είναι ένα παράδειγμα κλάσης με μια μέθοδο \"iter\" που υλοποιείται ως " +"γεννήτρια:" #: library/unittest.mock-examples.rst:665 msgid "How would we mock this class, and in particular its \"iter\" method?" msgstr "" +"Πώς θα προσομοιώναμε αυτή την κλάση, και συγκεκριμένα τη μέθοδο της \"iter\";" #: library/unittest.mock-examples.rst:667 msgid "" @@ -584,6 +1034,9 @@ msgid "" "to :class:`list`), we need to configure the object returned by the call to " "``foo.iter()``." msgstr "" +"Για να διαμορφώσουμε τις τιμές που επιστρέφονται από την επανάληψη (ρητά " +"στην κλήση στη :class:`list`), πρέπει να διαμορφώσουμε το αντικείμενο που " +"επιστρέφεται από την κλήση στο ``foo.iter()``." #: library/unittest.mock-examples.rst:675 msgid "" @@ -593,10 +1046,14 @@ msgid "" "they are is: `Generator Tricks for Systems Programmers `_." msgstr "" +"Υπάρχουν επίσης εκφράσεις γεννητριών και πιο `προηγμένες χρήσεις `_ γεννητριών, αλλά δεν μας απασχολούν εδώ. " +"Μια πολύ καλή εισαγωγή στις γεννήτριες και πόσο ισχυρές είναι: `Generator " +"Tricks for Systems Programmers `_." #: library/unittest.mock-examples.rst:683 msgid "Applying the same patch to every test method" -msgstr "" +msgstr "Εφαρμογή της ίδιας επιδιόρθωσης σε κάθε μέθοδο δοκιμής" #: library/unittest.mock-examples.rst:685 msgid "" @@ -607,6 +1064,49 @@ msgid "" "methods on the class. A test method is identified by methods whose names " "start with ``test``::" msgstr "" +"Εάν θέλετε να υπάρχουν πολλές επιδιορθώσεις για πολλαπλές μεθόδους δοκιμής, " +"ο προφανής τρόπος είναι να εφαρμόσετε τους διακοσμητές επιδιόρθωσης σε κάθε " +"μέθοδο. Αυτό μπορεί να φαίνεται σαν περιττή επανάληψη. Αντίθετα, μπορείτε να " +"χρησιμοποιήσετε την :func:`patch` (σε όλες τις διάφορες μορφές της) ως " +"διακοσμητή κλάσης. Αυτό εφαρμόζει τις επιδιορθώσεις σε όλες τις μεθόδους " +"δοκιμής στην κλάση. Μια μέθοδος δοκιμής αναγνωρίζεται από μεθόδους των " +"οποίων τα ονόματα ξεκινούν με ``test``::" + +#: library/unittest.mock-examples.rst:692 +msgid "" +">>> @patch('mymodule.SomeClass')\n" +"... class MyTest(unittest.TestCase):\n" +"...\n" +"... def test_one(self, MockSomeClass):\n" +"... self.assertIs(mymodule.SomeClass, MockSomeClass)\n" +"...\n" +"... def test_two(self, MockSomeClass):\n" +"... self.assertIs(mymodule.SomeClass, MockSomeClass)\n" +"...\n" +"... def not_a_test(self):\n" +"... return 'something'\n" +"...\n" +">>> MyTest('test_one').test_one()\n" +">>> MyTest('test_two').test_two()\n" +">>> MyTest('test_two').not_a_test()\n" +"'something'" +msgstr "" +">>> @patch('mymodule.SomeClass')\n" +"... class MyTest(unittest.TestCase):\n" +"...\n" +"... def test_one(self, MockSomeClass):\n" +"... self.assertIs(mymodule.SomeClass, MockSomeClass)\n" +"...\n" +"... def test_two(self, MockSomeClass):\n" +"... self.assertIs(mymodule.SomeClass, MockSomeClass)\n" +"...\n" +"... def not_a_test(self):\n" +"... return 'something'\n" +"...\n" +">>> MyTest('test_one').test_one()\n" +">>> MyTest('test_two').test_two()\n" +">>> MyTest('test_two').not_a_test()\n" +"'something'" #: library/unittest.mock-examples.rst:709 msgid "" @@ -614,6 +1114,37 @@ msgid "" "These allow you to move the patching into your ``setUp`` and ``tearDown`` " "methods. ::" msgstr "" +"Ένας εναλλακτικός τρόπος διαχείρισης των επιδιορθώσεων είναι η χρήση των :" +"ref:`start-and-stop`. Αυτά σας επιτρέπουν να μετακινήσετε την επιδιόρθωση " +"στις μεθόδους σας ``setUp`` και ``tearDown``. ::" + +#: library/unittest.mock-examples.rst:713 +msgid "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... self.patcher = patch('mymodule.foo')\n" +"... self.mock_foo = self.patcher.start()\n" +"...\n" +"... def test_foo(self):\n" +"... self.assertIs(mymodule.foo, self.mock_foo)\n" +"...\n" +"... def tearDown(self):\n" +"... self.patcher.stop()\n" +"...\n" +">>> MyTest('test_foo').run()" +msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... self.patcher = patch('mymodule.foo')\n" +"... self.mock_foo = self.patcher.start()\n" +"...\n" +"... def test_foo(self):\n" +"... self.assertIs(mymodule.foo, self.mock_foo)\n" +"...\n" +"... def tearDown(self):\n" +"... self.patcher.stop()\n" +"...\n" +">>> MyTest('test_foo').run()" #: library/unittest.mock-examples.rst:726 msgid "" @@ -622,26 +1153,66 @@ msgid "" "exception is raised in the setUp then tearDown is not called. :meth:" "`unittest.TestCase.addCleanup` makes this easier::" msgstr "" +"Εάν χρησιμοποιήσετε αυτήν την τεχνική, πρέπει να διασφαλίσετε ότι η " +"επιδιόρθωση αναιρείται καλώντας το ``stop``. Αυτό μπορεί να είναι πιο " +"περίπλοκο από ό,τι μπορεί να νομίζετε, επειδή εάν γίνει raise μια εξαίρεση " +"στο setUp, τότε το tearDown δεν καλείται. Η :meth:`unittest.TestCase." +"addCleanup` καθιστά αυτό πιο εύκολο::" + +#: library/unittest.mock-examples.rst:731 +msgid "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... patcher = patch('mymodule.foo')\n" +"... self.addCleanup(patcher.stop)\n" +"... self.mock_foo = patcher.start()\n" +"...\n" +"... def test_foo(self):\n" +"... self.assertIs(mymodule.foo, self.mock_foo)\n" +"...\n" +">>> MyTest('test_foo').run()" +msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... patcher = patch('mymodule.foo')\n" +"... self.addCleanup(patcher.stop)\n" +"... self.mock_foo = patcher.start()\n" +"...\n" +"... def test_foo(self):\n" +"... self.assertIs(mymodule.foo, self.mock_foo)\n" +"...\n" +">>> MyTest('test_foo').run()" #: library/unittest.mock-examples.rst:744 msgid "Mocking Unbound Methods" -msgstr "" +msgstr "Προσομοίωση Μη Δεσμευμένων Μεθόδων" #: library/unittest.mock-examples.rst:746 msgid "" -"Whilst writing tests today I needed to patch an *unbound method* (patching " -"the method on the class rather than on the instance). I needed self to be " -"passed in as the first argument because I want to make asserts about which " -"objects were calling this particular method. The issue is that you can't " -"patch with a mock for this, because if you replace an unbound method with a " -"mock it doesn't become a bound method when fetched from the instance, and so " -"it doesn't get self passed in. The workaround is to patch the unbound method " -"with a real function instead. The :func:`patch` decorator makes it so simple " -"to patch out methods with a mock that having to create a real function " -"becomes a nuisance." -msgstr "" - -#: library/unittest.mock-examples.rst:757 +"Sometimes a test needs to patch an *unbound method*, which means patching " +"the method on the class rather than on the instance. In order to make " +"assertions about which objects were calling this particular method, you need " +"to pass ``self`` as the first argument. The issue is that you can't patch " +"with a mock for this, because if you replace an unbound method with a mock " +"it doesn't become a bound method when fetched from the instance, and so it " +"doesn't get ``self`` passed in. The workaround is to patch the unbound " +"method with a real function instead. The :func:`patch` decorator makes it so " +"simple to patch out methods with a mock that having to create a real " +"function becomes a nuisance." +msgstr "" +"Μερικές φορές μια δοκιμή χρειάζεται να επιδιορθώσει μια *μη δεσμευμένη " +"μέθοδο*, που σημαίνει την επιδιόρθωση της μεθόδου στην κλάση αντί για το " +"στιγμιότυπο. Για να κάνετε δηλώσεις σχετικά με το ποια αντικείμενα καλούσαν " +"αυτή τη συγκεκριμένη μέθοδο, πρέπει να περάσετε το ``self`` ως πρώτο όρισμα. " +"Το πρόβλημα είναι ότι δεν μπορείτε να επιδιορθώσετε με μια προσομοίωση για " +"αυτό, επειδή αν αντικαταστήσετε μια μη δεσμευμένη μέθοδο με μια προσομοίωση, " +"δεν γίνεται δεσμευμένη μέθοδος όταν ανακτάται από το στιγμιότυπο, και έτσι " +"δεν περνάει το ``self``. Η λύση είναι να επιδιορθώσετε τη μη δεσμευμένη " +"μέθοδο με μια πραγματική συνάρτηση αντί για αυτό. Ο διακοσμητής :func:" +"`patch` το καθιστά τόσο απλό να επιδιορθώνετε μεθόδους με μια προσομοίωση " +"που η ανάγκη δημιουργίας μιας πραγματικής συνάρτησης γίνεται ενοχλητική." + +#: library/unittest.mock-examples.rst:756 msgid "" "If you pass ``autospec=True`` to patch then it does the patching with a " "*real* function object. This function object has the same signature as the " @@ -650,31 +1221,48 @@ msgid "" "though, is that if you use it to patch out an unbound method on a class the " "mocked function will be turned into a bound method if it is fetched from an " "instance. It will have ``self`` passed in as the first argument, which is " -"exactly what I wanted:" +"exactly what was needed:" msgstr "" +"Εάν περάσετε το ``autospec=True`` στην επιδιόρθωση, τότε γίνεται η " +"επιδιόρθωση με ένα *πραγματικό* αντικείμενο συνάρτησης. Αυτό το αντικείμενο " +"συνάρτησης έχει την ίδια υπογραφή με αυτό που αντικαθιστά, αλλά αναθέτει σε " +"μια προσομοίωση κάτω από την κουκούλα. Ακόμα λαμβάνετε την προσομοίωσή σας " +"που δημιουργείται αυτόματα με ακριβώς τον ίδιο τρόπο όπως πριν. Αυτό που " +"σημαίνει, όμως, είναι ότι αν το χρησιμοποιήσετε για να επιδιορθώσετε μια μη " +"δεσμευμένη μέθοδο σε μια κλάση, η προσομοιωμένη συνάρτηση θα μετατραπεί σε " +"δεσμευμένη μέθοδο εάν ανακτηθεί από ένα στιγμιότυπο. Θα έχει το ``self`` που " +"περνάει ως πρώτο όρισμα, που είναι ακριβώς αυτό που χρειαζόταν:" -#: library/unittest.mock-examples.rst:778 +#: library/unittest.mock-examples.rst:777 msgid "" "If we don't use ``autospec=True`` then the unbound method is patched out " "with a Mock instance instead, and isn't called with ``self``." msgstr "" +"Εάν δεν χρησιμοποιήσουμε το ``autospec=True``, τότε η μη δεσμευμένη μέθοδος " +"επιδιορθώνεται με ένα στιγμιότυπο Mock αντίθετα, και δεν καλείται με το " +"``self``." -#: library/unittest.mock-examples.rst:783 +#: library/unittest.mock-examples.rst:782 msgid "Checking multiple calls with mock" -msgstr "" +msgstr "Έλεγχος πολλαπλών κλήσεων με προσομοίωση" -#: library/unittest.mock-examples.rst:785 +#: library/unittest.mock-examples.rst:784 msgid "" "mock has a nice API for making assertions about how your mock objects are " "used." msgstr "" +"Η προσομοίωση έχει ένα ωραίο API για τη δημιουργία δηλώσεων σχετικά με το " +"πώς χρησιμοποιούνται τα αντικείμενα προσομοίωσής σας." -#: library/unittest.mock-examples.rst:792 +#: library/unittest.mock-examples.rst:791 msgid "" "If your mock is only being called once you can use the :meth:`~Mock." "assert_called_once_with` method that also asserts that the :attr:`~Mock." "call_count` is one." msgstr "" +"Εάν η προσομοίωσή σας καλείται μόνο μία φορά, μπορείτε να χρησιμοποιήσετε " +"τη :meth:`~Mock.assert_called_once_with` μέθοδο που επίσης δηλώνει ότι το :" +"attr:`~Mock.call_count` είναι ένα." #: library/unittest.mock-examples.rst:803 msgid "" @@ -683,6 +1271,11 @@ msgid "" "times, and you want to make assertions about *all* those calls you can use :" "attr:`~Mock.call_args_list`:" msgstr "" +"Και οι δύο ``assert_called_with`` και ``assert_called_once_with`` κάνουν " +"δηλώσεις σχετικά με την *τελευταία* κλήση. Εάν η προσομοίωσή σας πρόκειται " +"να καλείται πολλές φορές, και θέλετε να κάνετε δηλώσεις σχετικά με *όλες* " +"αυτές τις κλήσεις, μπορείτε να χρησιμοποιήσετε το :attr:`~Mock." +"call_args_list`:" #: library/unittest.mock-examples.rst:815 msgid "" @@ -691,10 +1284,14 @@ msgid "" "``call_args_list``. This looks remarkably similar to the repr of the " "``call_args_list``:" msgstr "" +"Ο βοηθός :data:`call` καθιστά εύκολο να κάνετε δηλώσεις σχετικά με αυτές τις " +"κλήσεις. Μπορείτε να δημιουργήσετε μια λίστα με τις αναμενόμενες κλήσεις και " +"να τη συγκρίνετε με το ``call_args_list``. Αυτό μοιάζει αξιοσημείωτα με το " +"repr του ``call_args_list``:" #: library/unittest.mock-examples.rst:825 msgid "Coping with mutable arguments" -msgstr "" +msgstr "Αντιμετώπιση μεταβλητών ορισμάτων" #: library/unittest.mock-examples.rst:827 msgid "" @@ -704,18 +1301,71 @@ msgid "" "under test then you can no longer make assertions about what the values were " "when the mock was called." msgstr "" +"Μια άλλη κατάσταση που είναι σπάνια, αλλά μπορεί να σας δαγκώσει, είναι όταν " +"η προσομοίωσή σας καλείται με μεταβλητά ορίσματα. Το ``call_args`` και το " +"``call_args_list`` αποθηκεύουν *αναφορές* στα ορίσματα. Εάν τα ορίσματα " +"μεταβλητοποιηθούν από τον κώδικα υπό δοκιμή, τότε δεν μπορείτε πλέον να " +"κάνετε δηλώσεις σχετικά με το ποιες ήταν οι τιμές όταν κλήθηκε η προσομοίωση." #: library/unittest.mock-examples.rst:832 msgid "" "Here's some example code that shows the problem. Imagine the following " "functions defined in 'mymodule'::" msgstr "" +"Εδώ είναι μερικοί παραδείγματα κώδικα που δείχνουν το πρόβλημα. Φανταστείτε " +"τις παρακάτω συναρτήσεις ορισμένες στο 'mymodule'::" + +#: library/unittest.mock-examples.rst:835 +msgid "" +"def frob(val):\n" +" pass\n" +"\n" +"def grob(val):\n" +" \"First frob and then clear val\"\n" +" frob(val)\n" +" val.clear()" +msgstr "" +"def frob(val):\n" +" pass\n" +"\n" +"def grob(val):\n" +" \"First frob and then clear val\"\n" +" frob(val)\n" +" val.clear()" #: library/unittest.mock-examples.rst:843 msgid "" "When we try to test that ``grob`` calls ``frob`` with the correct argument " "look what happens::" msgstr "" +"Όταν προσπαθήσουμε να δοκιμάσουμε ότι το ``grob`` καλεί το ``frob`` με το " +"σωστό όρισμα, δείτε τι συμβαίνει::" + +#: library/unittest.mock-examples.rst:846 +msgid "" +">>> with patch('mymodule.frob') as mock_frob:\n" +"... val = {6}\n" +"... mymodule.grob(val)\n" +"...\n" +">>> val\n" +"set()\n" +">>> mock_frob.assert_called_with({6})\n" +"Traceback (most recent call last):\n" +" ...\n" +"AssertionError: Expected: (({6},), {})\n" +"Called with: ((set(),), {})" +msgstr "" +">>> with patch('mymodule.frob') as mock_frob:\n" +"... val = {6}\n" +"... mymodule.grob(val)\n" +"...\n" +">>> val\n" +"set()\n" +">>> mock_frob.assert_called_with({6})\n" +"Traceback (most recent call last):\n" +" ...\n" +"AssertionError: Expected: (({6},), {})\n" +"Called with: ((set(),), {})" #: library/unittest.mock-examples.rst:858 msgid "" @@ -723,6 +1373,9 @@ msgid "" "could then cause problems if you do assertions that rely on object identity " "for equality." msgstr "" +"Μια πιθανότητα θα ήταν για την προσομοίωση να αντιγράψει τα ορίσματα που " +"περνάτε. Αυτό θα μπορούσε στη συνέχεια να προκαλέσει προβλήματα εάν κάνετε " +"δηλώσεις που βασίζονται στην ταυτότητα αντικειμένου για την ισότητα." #: library/unittest.mock-examples.rst:862 msgid "" @@ -734,6 +1387,58 @@ msgid "" "methods for doing the assertion. Again a helper function sets this up for " "me. ::" msgstr "" +"Εδώ είναι μια λύση που χρησιμοποιεί τη λειτουργικότητα :attr:`~Mock." +"side_effect`. Εάν παρέχετε μια συνάρτηση ``side_effect`` για μια " +"προσομοίωση, τότε το ``side_effect`` θα κληθεί με τα ίδια ορίσματα με την " +"προσομοίωση. Αυτό μας δίνει μια ευκαιρία να αντιγράψουμε τα ορίσματα και να " +"τα αποθηκεύσουμε για μετέπειτα δηλώσεις. Σε αυτό το παράδειγμα, χρησιμοποιώ " +"*άλλη* προσομοίωση για να αποθηκεύσω τα ορίσματα, ώστε να μπορώ να " +"χρησιμοποιήσω τις μεθόδους προσομοίωσης για να κάνω τη δήλωση. Και πάλι, μια " +"βοηθητική συνάρτηση το ρυθμίζει για μένα. ::" + +#: library/unittest.mock-examples.rst:870 +msgid "" +">>> from copy import deepcopy\n" +">>> from unittest.mock import Mock, patch, DEFAULT\n" +">>> def copy_call_args(mock):\n" +"... new_mock = Mock()\n" +"... def side_effect(*args, **kwargs):\n" +"... args = deepcopy(args)\n" +"... kwargs = deepcopy(kwargs)\n" +"... new_mock(*args, **kwargs)\n" +"... return DEFAULT\n" +"... mock.side_effect = side_effect\n" +"... return new_mock\n" +"...\n" +">>> with patch('mymodule.frob') as mock_frob:\n" +"... new_mock = copy_call_args(mock_frob)\n" +"... val = {6}\n" +"... mymodule.grob(val)\n" +"...\n" +">>> new_mock.assert_called_with({6})\n" +">>> new_mock.call_args\n" +"call({6})" +msgstr "" +">>> from copy import deepcopy\n" +">>> from unittest.mock import Mock, patch, DEFAULT\n" +">>> def copy_call_args(mock):\n" +"... new_mock = Mock()\n" +"... def side_effect(*args, **kwargs):\n" +"... args = deepcopy(args)\n" +"... kwargs = deepcopy(kwargs)\n" +"... new_mock(*args, **kwargs)\n" +"... return DEFAULT\n" +"... mock.side_effect = side_effect\n" +"... return new_mock\n" +"...\n" +">>> with patch('mymodule.frob') as mock_frob:\n" +"... new_mock = copy_call_args(mock_frob)\n" +"... val = {6}\n" +"... mymodule.grob(val)\n" +"...\n" +">>> new_mock.assert_called_with({6})\n" +">>> new_mock.call_args\n" +"call({6})" #: library/unittest.mock-examples.rst:891 msgid "" @@ -741,6 +1446,10 @@ msgid "" "new mock that we do the assertion on. The ``side_effect`` function makes a " "copy of the args and calls our ``new_mock`` with the copy." msgstr "" +"Το ``copy_call_args`` καλείται με την προσομοίωση που θα κληθεί. Επιστρέφει " +"μια νέα προσομοίωση στην οποία κάνουμε τη δήλωση. Η συνάρτηση " +"``side_effect`` κάνει ένα αντίγραφο των ορισμάτων και καλεί τη ``new_mock`` " +"με το αντίγραφο." #: library/unittest.mock-examples.rst:897 msgid "" @@ -748,6 +1457,9 @@ msgid "" "checking arguments at the point they are called. You can simply do the " "checking inside a ``side_effect`` function." msgstr "" +"Εάν η προσομοίωσή σας πρόκειται να χρησιμοποιηθεί μόνο μία φορά, υπάρχει " +"ένας ευκολότερος τρόπος ελέγχου των ορισμάτων στο σημείο που καλούνται. " +"Μπορείτε απλά να κάνετε τον έλεγχο μέσα σε μια ``side_effect`` συνάρτηση." #: library/unittest.mock-examples.rst:911 msgid "" @@ -755,102 +1467,219 @@ msgid "" "`MagicMock` that copies (using :func:`copy.deepcopy`) the arguments. Here's " "an example implementation:" msgstr "" +"Μια εναλλακτική προσέγγιση είναι να δημιουργήσετε μια υποκλάση της :class:" +"`Mock` ή :class:`MagicMock` που αντιγράφει (χρησιμοποιώντας τη :func:`copy." +"deepcopy`) τα ορίσματα. Εδώ είναι ένα παράδειγμα υλοποίησης:" -#: library/unittest.mock-examples.rst:935 +#: library/unittest.mock-examples.rst:936 msgid "" "When you subclass ``Mock`` or ``MagicMock`` all dynamically created " "attributes, and the ``return_value`` will use your subclass automatically. " "That means all children of a ``CopyingMock`` will also have the type " "``CopyingMock``." msgstr "" +"Όταν υποκλάσετε το ``Mock`` ή το ``MagicMock``, όλα τα δυναμικά " +"δημιουργημένα χαρακτηριστικά, και το ``return_value`` θα χρησιμοποιούν την " +"υποκλάση σας αυτόματα. Αυτό σημαίνει ότι όλα τα παιδιά ενός ``CopyingMock`` " +"θα έχουν επίσης τον τύπο ``CopyingMock``." -#: library/unittest.mock-examples.rst:941 +#: library/unittest.mock-examples.rst:942 msgid "Nesting Patches" -msgstr "" +msgstr "Εμφωλευμένες Επιδιορθώσεις" -#: library/unittest.mock-examples.rst:943 +#: library/unittest.mock-examples.rst:944 msgid "" "Using patch as a context manager is nice, but if you do multiple patches you " "can end up with nested with statements indenting further and further to the " "right::" msgstr "" - -#: library/unittest.mock-examples.rst:961 +"Η χρήση της επιδιόρθωσης ως διαχειριστής περιβάλλοντος είναι ωραία, αλλά αν " +"κάνετε πολλαπλές επιδιορθώσεις, μπορεί να καταλήξετε με επικαλυπτόμενες " +"δηλώσεις with που εσοχίζουν όλο και περισσότερο προς τα δεξιά::" + +#: library/unittest.mock-examples.rst:948 +msgid "" +">>> class MyTest(unittest.TestCase):\n" +"...\n" +"... def test_foo(self):\n" +"... with patch('mymodule.Foo') as mock_foo:\n" +"... with patch('mymodule.Bar') as mock_bar:\n" +"... with patch('mymodule.Spam') as mock_spam:\n" +"... assert mymodule.Foo is mock_foo\n" +"... assert mymodule.Bar is mock_bar\n" +"... assert mymodule.Spam is mock_spam\n" +"...\n" +">>> original = mymodule.Foo\n" +">>> MyTest('test_foo').test_foo()\n" +">>> assert mymodule.Foo is original" +msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"...\n" +"... def test_foo(self):\n" +"... with patch('mymodule.Foo') as mock_foo:\n" +"... with patch('mymodule.Bar') as mock_bar:\n" +"... with patch('mymodule.Spam') as mock_spam:\n" +"... assert mymodule.Foo is mock_foo\n" +"... assert mymodule.Bar is mock_bar\n" +"... assert mymodule.Spam is mock_spam\n" +"...\n" +">>> original = mymodule.Foo\n" +">>> MyTest('test_foo').test_foo()\n" +">>> assert mymodule.Foo is original" + +#: library/unittest.mock-examples.rst:962 msgid "" "With unittest ``cleanup`` functions and the :ref:`start-and-stop` we can " "achieve the same effect without the nested indentation. A simple helper " "method, ``create_patch``, puts the patch in place and returns the created " "mock for us::" msgstr "" - -#: library/unittest.mock-examples.rst:989 +"Με τις λειτουργίες καθαρισμού του unittest και το :ref:`start-and-stop` " +"μπορούμε να επιτύχουμε το ίδιο αποτέλεσμα χωρίς την εμφωλευμένη εσοχή. Μια " +"απλή βοηθητική μέθοδος, ``create_patch``, τοποθετεί την επιδιόρθωση στη θέση " +"της και επιστρέφει την δημιουργημένη προσομοίωση για εμάς::" + +#: library/unittest.mock-examples.rst:967 +msgid "" +">>> class MyTest(unittest.TestCase):\n" +"...\n" +"... def create_patch(self, name):\n" +"... patcher = patch(name)\n" +"... thing = patcher.start()\n" +"... self.addCleanup(patcher.stop)\n" +"... return thing\n" +"...\n" +"... def test_foo(self):\n" +"... mock_foo = self.create_patch('mymodule.Foo')\n" +"... mock_bar = self.create_patch('mymodule.Bar')\n" +"... mock_spam = self.create_patch('mymodule.Spam')\n" +"...\n" +"... assert mymodule.Foo is mock_foo\n" +"... assert mymodule.Bar is mock_bar\n" +"... assert mymodule.Spam is mock_spam\n" +"...\n" +">>> original = mymodule.Foo\n" +">>> MyTest('test_foo').run()\n" +">>> assert mymodule.Foo is original" +msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"...\n" +"... def create_patch(self, name):\n" +"... patcher = patch(name)\n" +"... thing = patcher.start()\n" +"... self.addCleanup(patcher.stop)\n" +"... return thing\n" +"...\n" +"... def test_foo(self):\n" +"... mock_foo = self.create_patch('mymodule.Foo')\n" +"... mock_bar = self.create_patch('mymodule.Bar')\n" +"... mock_spam = self.create_patch('mymodule.Spam')\n" +"...\n" +"... assert mymodule.Foo is mock_foo\n" +"... assert mymodule.Bar is mock_bar\n" +"... assert mymodule.Spam is mock_spam\n" +"...\n" +">>> original = mymodule.Foo\n" +">>> MyTest('test_foo').run()\n" +">>> assert mymodule.Foo is original" + +#: library/unittest.mock-examples.rst:990 msgid "Mocking a dictionary with MagicMock" -msgstr "" +msgstr "Προσομοίωση ενός λεξικού με το MagicMock" -#: library/unittest.mock-examples.rst:991 +#: library/unittest.mock-examples.rst:992 msgid "" "You may want to mock a dictionary, or other container object, recording all " "access to it whilst having it still behave like a dictionary." msgstr "" +"Ίσως θέλετε να προσομοιώσετε ένα λεξικό ή άλλο αντικείμενο κοντέινερ, " +"καταγράφοντας όλη την πρόσβαση σε αυτό, ενώ εξακολουθεί να συμπεριφέρεται " +"σαν λεξικό." -#: library/unittest.mock-examples.rst:994 +#: library/unittest.mock-examples.rst:995 msgid "" "We can do this with :class:`MagicMock`, which will behave like a dictionary, " "and using :data:`~Mock.side_effect` to delegate dictionary access to a real " "underlying dictionary that is under our control." msgstr "" +"Μπορούμε να το κάνουμε αυτό με την :class:`MagicMock`, η οποία θα " +"συμπεριφέρεται σαν λεξικό, και χρησιμοποιώντας το :data:`~Mock.side_effect` " +"για να αναθέσουμε την πρόσβαση στο λεξικό σε ένα πραγματικό υποκείμενο " +"λεξικό που είναι υπό τον έλεγχό μας." -#: library/unittest.mock-examples.rst:998 +#: library/unittest.mock-examples.rst:999 msgid "" "When the :meth:`~object.__getitem__` and :meth:`~object.__setitem__` methods " "of our ``MagicMock`` are called (normal dictionary access) then " "``side_effect`` is called with the key (and in the case of ``__setitem__`` " "the value too). We can also control what is returned." msgstr "" +"Όταν οι μέθοδοι :meth:`~object.__getitem__` και :meth:`~object.__setitem__` " +"του ``MagicMock`` μας καλούνται (κανονική πρόσβαση λεξικού), τότε το " +"``side_effect`` καλείται με το κλειδί (και στην περίπτωση του " +"``__setitem__`` και την τιμή επίσης). Μπορούμε επίσης να ελέγξουμε τι " +"επιστρέφεται." -#: library/unittest.mock-examples.rst:1003 +#: library/unittest.mock-examples.rst:1004 msgid "" "After the ``MagicMock`` has been used we can use attributes like :data:" "`~Mock.call_args_list` to assert about how the dictionary was used:" msgstr "" +"Μετά τη χρήση του ``MagicMock``, μπορούμε να χρησιμοποιήσουμε χαρακτηριστικά " +"όπως το :data:`~Mock.call_args_list` για να κάνουμε δηλώσεις σχετικά με το " +"πώς χρησιμοποιήθηκε το λεξικό:" -#: library/unittest.mock-examples.rst:1019 +#: library/unittest.mock-examples.rst:1020 msgid "" "An alternative to using ``MagicMock`` is to use ``Mock`` and *only* provide " "the magic methods you specifically want:" msgstr "" +"Μια εναλλακτική λύση στη χρήση του ``MagicMock`` είναι να χρησιμοποιήσετε το " +"``Mock`` και να παρέχετε *μόνο* τις μαγικές μεθόδους που θέλετε συγκεκριμένα:" -#: library/unittest.mock-examples.rst:1026 +#: library/unittest.mock-examples.rst:1027 msgid "" "A *third* option is to use ``MagicMock`` but passing in ``dict`` as the " "*spec* (or *spec_set*) argument so that the ``MagicMock`` created only has " "dictionary magic methods available:" msgstr "" +"Μια *τρίτη* επιλογή είναι να χρησιμοποιήσετε το ``MagicMock`` αλλά περνώντας " +"το ``dict`` ως όρισμα *spec* (ή *spec_set*), έτσι ώστε το δημιουργημένο " +"``MagicMock`` να έχει διαθέσιμες μόνο τις μαγικές μεθόδους λεξικού:" -#: library/unittest.mock-examples.rst:1034 +#: library/unittest.mock-examples.rst:1035 msgid "" "With these side effect functions in place, the ``mock`` will behave like a " "normal dictionary but recording the access. It even raises a :exc:`KeyError` " "if you try to access a key that doesn't exist." msgstr "" +"Με αυτές τις λειτουργίες side effect στη θέση τους, το ``mock`` θα " +"συμπεριφέρεται σαν ένα κανονικό λεξικό αλλά καταγράφοντας την πρόσβαση. " +"Ακόμα κάνει raise μια :exc:`KeyError` εάν προσπαθήσετε να αποκτήσετε " +"πρόσβαση σε ένα κλειδί που δεν υπάρχει." -#: library/unittest.mock-examples.rst:1053 +#: library/unittest.mock-examples.rst:1054 msgid "" "After it has been used you can make assertions about the access using the " "normal mock methods and attributes:" msgstr "" +"Μετά τη χρήση του, μπορείτε να κάνετε δηλώσεις σχετικά με την πρόσβαση " +"χρησιμοποιώντας τις κανονικές μεθόδους και χαρακτηριστικά προσομοίωσης:" -#: library/unittest.mock-examples.rst:1065 +#: library/unittest.mock-examples.rst:1066 msgid "Mock subclasses and their attributes" -msgstr "" +msgstr "Υποκλάσεις Mock και τα χαρακτηριστικά τους" -#: library/unittest.mock-examples.rst:1067 +#: library/unittest.mock-examples.rst:1068 msgid "" "There are various reasons why you might want to subclass :class:`Mock`. One " "reason might be to add helper methods. Here's a silly example:" msgstr "" +"Υπάρχουν διάφοροι λόγοι για τους οποίους μπορεί να θέλετε να υποκλάσετε την :" +"class:`Mock`. Ένας λόγος μπορεί να είναι η προσθήκη βοηθητικών μεθόδων. Εδώ " +"είναι ένα ανόητο παράδειγμα:" -#: library/unittest.mock-examples.rst:1083 +#: library/unittest.mock-examples.rst:1084 msgid "" "The standard behaviour for ``Mock`` instances is that attributes and the " "return value mocks are of the same type as the mock they are accessed on. " @@ -859,16 +1688,28 @@ msgid "" "methods then they'll also be available on the attributes and return value " "mock of instances of your subclass." msgstr "" +"Η τυπική συμπεριφορά για τα στιγμιότυπα ``Mock`` είναι ότι τα χαρακτηριστικά " +"και οι επιστρεφόμενες τιμές προσομοιώσεων είναι του ίδιου τύπου με την " +"προσομοίωση στην οποία έχουν πρόσβαση. Αυτό διασφαλίζει ότι τα " +"χαρακτηριστικά ``Mock`` είναι ``Mocks`` και τα χαρακτηριστικά ``MagicMock`` " +"είναι ``MagicMocks`` [#]_. Έτσι, εάν υποκλάσετε για να προσθέσετε βοηθητικές " +"μεθόδους, τότε θα είναι επίσης διαθέσιμες στα χαρακτηριστικά και στην " +"επιστρεφόμενη τιμή προσομοίωσης των στιγμιότυπων της υποκλάσης σας." -#: library/unittest.mock-examples.rst:1099 +#: library/unittest.mock-examples.rst:1100 msgid "" "Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created a `Twisted " "adaptor `_. Having this applied to attributes too actually causes errors." msgstr "" +"Μερικές φορές αυτό είναι άβολο. Για παράδειγμα, `ένας χρήστης `_ υποκλάσει την προσομοίωση για να " +"δημιουργήσει έναν `προσαρμογέα Twisted `_. Η εφαρμογή αυτού και στα " +"χαρακτηριστικά προκαλεί πραγματικά σφάλματα." -#: library/unittest.mock-examples.rst:1105 +#: library/unittest.mock-examples.rst:1106 msgid "" "``Mock`` (in all its flavours) uses a method called ``_get_child_mock`` to " "create these \"sub-mocks\" for attributes and return values. You can prevent " @@ -876,26 +1717,39 @@ msgid "" "signature is that it takes arbitrary keyword arguments (``**kwargs``) which " "are then passed onto the mock constructor:" msgstr "" +"``Mock`` (σε όλες τις παραλλαγές του) χρησιμοποιεί μια μέθοδο που ονομάζεται " +"``_get_child_mock`` για να δημιουργήσει αυτές τις \"υπο-προσομοιώσεις\" για " +"χαρακτηριστικά και επιστρεφόμενες τιμές. Μπορείτε να αποτρέψετε τη χρήση της " +"υποκλάσης σας για χαρακτηριστικά, υπερκαλύπτοντας αυτή τη μέθοδο. Η υπογραφή " +"είναι ότι λαμβάνει αυθαίρετα ορίσματα λέξεων-κλειδιών (``**kwargs``) που στη " +"συνέχεια περνιούνται στον κατασκευαστή προσομοιώσεων:" -#: library/unittest.mock-examples.rst:1122 +#: library/unittest.mock-examples.rst:1123 msgid "" "An exception to this rule are the non-callable mocks. Attributes use the " "callable variant because otherwise non-callable mocks couldn't have callable " "methods." msgstr "" +"Μια εξαίρεση σε αυτόν τον κανόνα είναι οι μη κλητές προσομοιώσεις. Τα " +"χαρακτηριστικά χρησιμοποιούν την κλητή παραλλαγή επειδή διαφορετικά οι μη " +"κλητές προσομοιώσεις δεν θα μπορούσαν να έχουν κλητές μεθόδους." -#: library/unittest.mock-examples.rst:1128 +#: library/unittest.mock-examples.rst:1129 msgid "Mocking imports with patch.dict" -msgstr "" +msgstr "Προσομοίωση εισαγωγών με το patch.dict" -#: library/unittest.mock-examples.rst:1130 +#: library/unittest.mock-examples.rst:1131 msgid "" "One situation where mocking can be hard is where you have a local import " "inside a function. These are harder to mock because they aren't using an " "object from the module namespace that we can patch out." msgstr "" +"Μια κατάσταση όπου η προσομοίωση μπορεί να είναι δύσκολη είναι όταν έχετε " +"μια τοπική εισαγωγή μέσα σε μια συνάρτηση. Αυτές είναι πιο δύσκολες για " +"προσομοίωση επειδή δεν χρησιμοποιούν ένα αντικείμενο από το χώρο ονομάτων " +"του module που μπορούμε να επιδιορθώσουμε." -#: library/unittest.mock-examples.rst:1134 +#: library/unittest.mock-examples.rst:1135 msgid "" "Generally local imports are to be avoided. They are sometimes done to " "prevent circular dependencies, for which there is *usually* a much better " @@ -904,8 +1758,15 @@ msgid "" "an unconditional local import (store the module as a class or module " "attribute and only do the import on first use)." msgstr "" +"Γενικά, οι τοπικές εισαγωγές πρέπει να αποφεύγονται. Κάποιες φορές γίνονται " +"για να αποτραπούν οι κυκλικές εξαρτήσεις, για τις οποίες υπάρχει *συνήθως* " +"ένας πολύ καλύτερος τρόπος για να λυθεί το πρόβλημα (αναδιαμόρφωση του " +"κώδικα) ή για να αποτραπούν τα \"προκαταβολικά κόστη\" καθυστερώντας την " +"εισαγωγή. Αυτό μπορεί επίσης να λυθεί με καλύτερους τρόπους από μια άνευ " +"όρων τοπική εισαγωγή (αποθηκεύστε το module ως χαρακτηριστικό κλάσης ή " +"module και κάντε την εισαγωγή μόνο στην πρώτη χρήση)." -#: library/unittest.mock-examples.rst:1141 +#: library/unittest.mock-examples.rst:1142 msgid "" "That aside there is a way to use ``mock`` to affect the results of an " "import. Importing fetches an *object* from the :data:`sys.modules` " @@ -914,8 +1775,15 @@ msgid "" "in ``sys.modules``, so usually when you import something you get a module " "back. This need not be the case however." msgstr "" +"Ανεξάρτητα από αυτό, υπάρχει ένας τρόπος να χρησιμοποιήσετε το ``mock`` για " +"να επηρεάσετε τα αποτελέσματα μιας εισαγωγής. Η εισαγωγή ανακτά ένα " +"*αντικείμενο* από το λεξικό :data:`sys.modules`. Σημειώστε ότι ανακτά ένα " +"*αντικείμενο*, το οποίο δεν χρειάζεται να είναι ένα module. Η εισαγωγή ενός " +"module για πρώτη φορά έχει ως αποτέλεσμα τη τοποθέτηση ενός αντικειμένου " +"module στο ``sys.modules``, οπότε συνήθως όταν εισάγετε κάτι, λαμβάνετε πίσω " +"ένα module. Ωστόσο, αυτό δεν χρειάζεται να είναι η περίπτωση." -#: library/unittest.mock-examples.rst:1148 +#: library/unittest.mock-examples.rst:1149 msgid "" "This means you can use :func:`patch.dict` to *temporarily* put a mock in " "place in :data:`sys.modules`. Any imports whilst this patch is active will " @@ -923,59 +1791,121 @@ msgid "" "the with statement body is complete or ``patcher.stop()`` is called) then " "whatever was there previously will be restored safely." msgstr "" +"Αυτό σημαίνει ότι μπορείτε να χρησιμοποιήσετε το :func:`patch.dict` για να " +"τοποθετήσετε *προσωρινά* μια προσομοίωση στο :data:`sys.modules`. " +"Οποιεσδήποτε εισαγωγές ενώ αυτή η επιδιόρθωση είναι ενεργή θα ανακτούν την " +"προσομοίωση. Όταν ολοκληρωθεί η επιδιόρθωση (η διακοσμημένη συνάρτηση " +"εξέρχεται, το σώμα της δήλωσης with ολοκληρώνεται ή καλείται το ``patcher." +"stop()``), τότε ό,τι υπήρχε προηγουμένως θα αποκατασταθεί με ασφάλεια." -#: library/unittest.mock-examples.rst:1154 +#: library/unittest.mock-examples.rst:1155 msgid "Here's an example that mocks out the 'fooble' module." -msgstr "" +msgstr "Εδώ είναι ένα παράδειγμα που προσομοιώνει το module 'fooble'." -#: library/unittest.mock-examples.rst:1166 +#: library/unittest.mock-examples.rst:1167 msgid "" "As you can see the ``import fooble`` succeeds, but on exit there is no " "'fooble' left in :data:`sys.modules`." msgstr "" +"Όπως μπορείτε να δείτε, το ``import fooble`` πετυχαίνει, αλλά κατά την έξοδο " +"δεν παραμένει κανένα 'fooble' στο :data:`sys.modules`." -#: library/unittest.mock-examples.rst:1169 +#: library/unittest.mock-examples.rst:1170 msgid "This also works for the ``from module import name`` form:" -msgstr "" +msgstr "Αυτό λειτουργεί επίσης για τη μορφή ``from module import name``:" -#: library/unittest.mock-examples.rst:1179 +#: library/unittest.mock-examples.rst:1180 msgid "With slightly more work you can also mock package imports:" msgstr "" +"Με λίγη περισσότερη δουλειά, μπορείτε επίσης να προσομοιώσετε εισαγωγές " +"πακέτων:" -#: library/unittest.mock-examples.rst:1192 +#: library/unittest.mock-examples.rst:1193 msgid "Tracking order of calls and less verbose call assertions" msgstr "" +"Παρακολούθηση της σειράς κλήσεων και λιγότερο λεκτικές δηλώσεις κλήσεων" -#: library/unittest.mock-examples.rst:1194 +#: library/unittest.mock-examples.rst:1195 msgid "" "The :class:`Mock` class allows you to track the *order* of method calls on " "your mock objects through the :attr:`~Mock.method_calls` attribute. This " "doesn't allow you to track the order of calls between separate mock objects, " "however we can use :attr:`~Mock.mock_calls` to achieve the same effect." msgstr "" +"Η :class:`Mock` σας επιτρέπει να παρακολουθείτε τη *σειρά* των κλήσεων " +"μεθόδων στις προσομοιώσεις σας μέσω του χαρακτηριστικού :attr:`~Mock." +"method_calls`. Αυτό δεν σας επιτρέπει να παρακολουθείτε τη σειρά των κλήσεων " +"μεταξύ ξεχωριστών αντικειμένων προσομοίωσης, ωστόσο μπορούμε να " +"χρησιμοποιήσουμε το :attr:`~Mock.mock_calls` για να επιτύχουμε το ίδιο " +"αποτέλεσμα." -#: library/unittest.mock-examples.rst:1199 +#: library/unittest.mock-examples.rst:1200 msgid "" "Because mocks track calls to child mocks in ``mock_calls``, and accessing an " "arbitrary attribute of a mock creates a child mock, we can create our " "separate mocks from a parent one. Calls to those child mock will then all be " "recorded, in order, in the ``mock_calls`` of the parent:" msgstr "" +"Επειδή οι προσομοιώσεις παρακολουθούν τις κλήσεις σε υπο-προσομοιώσεις στο " +"``mock_calls``, και η πρόσβαση σε ένα αυθαίρετο χαρακτηριστικό μιας " +"προσομοίωσης δημιουργεί μια υπο-προσομοίωση, μπορούμε να δημιουργήσουμε τις " +"ξεχωριστές προσομοιώσεις μας από μια γονική. Οι κλήσεις σε αυτές τις υπο-" +"προσομοιώσεις θα καταγράφονται στη συνέχεια, με σειρά, στο ``mock_calls`` " +"της γονικής:" -#: library/unittest.mock-examples.rst:1216 +#: library/unittest.mock-examples.rst:1217 msgid "" "We can then assert about the calls, including the order, by comparing with " "the ``mock_calls`` attribute on the manager mock:" msgstr "" +"Μπορούμε στη συνέχεια να κάνουμε δηλώσεις σχετικά με τις κλήσεις, " +"συμπεριλαμβανομένης της σειράς, συγκρίνοντας με το χαρακτηριστικό " +"``mock_calls`` στην προσομοίωση διαχειριστή:" -#: library/unittest.mock-examples.rst:1223 +#: library/unittest.mock-examples.rst:1224 msgid "" "If ``patch`` is creating, and putting in place, your mocks then you can " "attach them to a manager mock using the :meth:`~Mock.attach_mock` method. " "After attaching calls will be recorded in ``mock_calls`` of the manager. ::" msgstr "" - -#: library/unittest.mock-examples.rst:1242 +"Αν το ``patch`` δημιουργεί και τοποθετεί τις προσομοιώσεις σας, τότε " +"μπορείτε να τις επισυνάψετε σε μια διαχειριστική προσομοίωση χρησιμοποιώντας " +"τη μέθοδο :meth:`~Mock.attach_mock`. Μετά την επισύναψη, οι κλήσεις θα " +"καταγράφονται στο ``mock_calls`` του διαχειριστή. ::" + +#: library/unittest.mock-examples.rst:1228 +msgid "" +">>> manager = MagicMock()\n" +">>> with patch('mymodule.Class1') as MockClass1:\n" +"... with patch('mymodule.Class2') as MockClass2:\n" +"... manager.attach_mock(MockClass1, 'MockClass1')\n" +"... manager.attach_mock(MockClass2, 'MockClass2')\n" +"... MockClass1().foo()\n" +"... MockClass2().bar()\n" +"\n" +"\n" +">>> manager.mock_calls\n" +"[call.MockClass1(),\n" +"call.MockClass1().foo(),\n" +"call.MockClass2(),\n" +"call.MockClass2().bar()]" +msgstr "" +">>> manager = MagicMock()\n" +">>> with patch('mymodule.Class1') as MockClass1:\n" +"... with patch('mymodule.Class2') as MockClass2:\n" +"... manager.attach_mock(MockClass1, 'MockClass1')\n" +"... manager.attach_mock(MockClass2, 'MockClass2')\n" +"... MockClass1().foo()\n" +"... MockClass2().bar()\n" +"\n" +"\n" +">>> manager.mock_calls\n" +"[call.MockClass1(),\n" +"call.MockClass1().foo(),\n" +"call.MockClass2(),\n" +"call.MockClass2().bar()]" + +#: library/unittest.mock-examples.rst:1243 msgid "" "If many calls have been made, but you're only interested in a particular " "sequence of them then an alternative is to use the :meth:`~Mock." @@ -983,32 +1913,46 @@ msgid "" "data:`call` object). If that sequence of calls are in :attr:`~Mock." "mock_calls` then the assert succeeds." msgstr "" +"Εάν έχουν γίνει πολλές κλήσεις, αλλά σας ενδιαφέρει μόνο μια συγκεκριμένη " +"ακολουθία από αυτές, τότε μια εναλλακτική είναι να χρησιμοποιήσετε τη " +"μέθοδο :meth:`~Mock.assert_has_calls`. Αυτή λαμβάνει μια λίστα κλήσεων " +"(κατασκευασμένη με το :data:`call` αντικείμενο). Εάν αυτή η ακολουθία " +"κλήσεων βρίσκεται στο :attr:`~Mock.mock_calls`, τότε η δήλωση πετυχαίνει." -#: library/unittest.mock-examples.rst:1256 +#: library/unittest.mock-examples.rst:1257 msgid "" "Even though the chained call ``m.one().two().three()`` aren't the only calls " "that have been made to the mock, the assert still succeeds." msgstr "" +"Ακόμα κι αν η αλυσιδωτή κλήση ``m.one().two().three()`` δεν είναι οι μόνες " +"κλήσεις που έχουν γίνει στην προσομοίωση, η δήλωση εξακολουθεί να πετυχαίνει." -#: library/unittest.mock-examples.rst:1259 +#: library/unittest.mock-examples.rst:1260 msgid "" "Sometimes a mock may have several calls made to it, and you are only " "interested in asserting about *some* of those calls. You may not even care " "about the order. In this case you can pass ``any_order=True`` to " "``assert_has_calls``:" msgstr "" +"Μερικές φορές μια προσομοίωση μπορεί να έχει γίνει πολλές κλήσεις σε αυτήν, " +"και σας ενδιαφέρει μόνο να κάνετε δηλώσεις για *μερικές* από αυτές τις " +"κλήσεις. Μπορεί να μην σας ενδιαφέρει καν η σειρά. Σε αυτή την περίπτωση, " +"μπορείτε να περάσετε το ``any_order=True`` στο ``assert_has_calls``:" -#: library/unittest.mock-examples.rst:1271 +#: library/unittest.mock-examples.rst:1272 msgid "More complex argument matching" -msgstr "" +msgstr "Πιο σύνθετη αντιστοίχιση ορισμάτων" -#: library/unittest.mock-examples.rst:1273 +#: library/unittest.mock-examples.rst:1274 msgid "" "Using the same basic concept as :data:`ANY` we can implement matchers to do " "more complex assertions on objects used as arguments to mocks." msgstr "" +"Χρησιμοποιώντας την ίδια βασική έννοια με το :data:`ANY`, μπορούμε να " +"υλοποιήσουμε αντιστοιχίσεις για να κάνουμε πιο σύνθετες δηλώσεις σχετικά με " +"αντικείμενα που χρησιμοποιούνται ως ορίσματα σε προσομοιώσεις." -#: library/unittest.mock-examples.rst:1276 +#: library/unittest.mock-examples.rst:1277 msgid "" "Suppose we expect some object to be passed to a mock that by default " "compares equal based on object identity (which is the Python default for " @@ -1017,29 +1961,43 @@ msgid "" "attributes of this object then we can create a matcher that will check these " "attributes for us." msgstr "" +"Ας υποθέσουμε ότι αναμένουμε να περαστεί κάποιο αντικείμενο σε μια " +"προσομοίωση που κανονικά συγκρίνεται ως ίσο βάσει της ταυτότητας του " +"αντικειμένου (που είναι το προεπιλεγμένο της Python για καθορισμένες από τον " +"χρήστη κλάσεις). Για να χρησιμοποιήσουμε τη :meth:`~Mock." +"assert_called_with`, θα πρέπει να περάσουμε το ακριβώς ίδιο αντικείμενο. Εάν " +"μας ενδιαφέρουν μόνο μερικά από τα χαρακτηριστικά αυτού του αντικειμένου, " +"τότε μπορούμε να δημιουργήσουμε έναν αντιστοιχιστή που θα ελέγχει αυτά τα " +"χαρακτηριστικά για εμάς." -#: library/unittest.mock-examples.rst:1283 +#: library/unittest.mock-examples.rst:1284 msgid "" "You can see in this example how a 'standard' call to ``assert_called_with`` " "isn't sufficient:" msgstr "" +"Μπορείτε να δείτε σε αυτό το παράδειγμα πώς μια 'τυπική' κλήση στο " +"``assert_called_with`` δεν είναι επαρκής:" -#: library/unittest.mock-examples.rst:1298 +#: library/unittest.mock-examples.rst:1300 msgid "" "A comparison function for our ``Foo`` class might look something like this:" msgstr "" +"Μια συνάρτηση σύγκρισης για την κλάση μας ``Foo`` μπορεί να μοιάζει κάπως " +"έτσι:" -#: library/unittest.mock-examples.rst:1310 +#: library/unittest.mock-examples.rst:1312 msgid "" "And a matcher object that can use comparison functions like this for its " "equality operation would look something like this:" msgstr "" +"Και ένα αντικείμενο αντιστοίχισης που μπορεί να χρησιμοποιεί συναρτήσεις " +"σύγκρισης όπως αυτή για τη λειτουργία ισότητας του θα μοιάζει κάπως έτσι:" -#: library/unittest.mock-examples.rst:1321 +#: library/unittest.mock-examples.rst:1323 msgid "Putting all this together:" -msgstr "" +msgstr "Βάζοντας όλα αυτά μαζί:" -#: library/unittest.mock-examples.rst:1326 +#: library/unittest.mock-examples.rst:1328 msgid "" "The ``Matcher`` is instantiated with our compare function and the ``Foo`` " "object we want to compare against. In ``assert_called_with`` the ``Matcher`` " @@ -1048,14 +2006,23 @@ msgid "" "``assert_called_with`` passes, and if they don't an :exc:`AssertionError` is " "raised:" msgstr "" +"Το ``Matcher`` δημιουργείται με τη συνάρτηση σύγκρισης και το αντικείμενο " +"που θέλουμε να συγκρίνουμε. Στο ``assert_called_with``, θα κληθεί η μέθοδος " +"ισότητας του ``Matcher``, η οποία συγκρίνει το αντικείμενο με το οποίο " +"κλήθηκε η προσομοίωση με αυτό που δημιουργήσαμε τον αντιστοιχιστή μας. Εάν " +"ταιριάζουν, τότε το ``assert_called_with`` περνάει, και αν δεν ταιριάζουν, " +"γίνεται raise μια :exc:`AssertionError`:" -#: library/unittest.mock-examples.rst:1339 +#: library/unittest.mock-examples.rst:1341 msgid "" "With a bit of tweaking you could have the comparison function raise the :exc:" "`AssertionError` directly and provide a more useful failure message." msgstr "" +"Με λίγη τροποποίηση, θα μπορούσατε να κάνετε τη συνάρτηση σύγκρισης να κάνει " +"raise απευθείας την :exc:`AssertionError` και να παρέχει ένα πιο χρήσιμο " +"μήνυμα αποτυχίας." -#: library/unittest.mock-examples.rst:1342 +#: library/unittest.mock-examples.rst:1344 msgid "" "As of version 1.5, the Python testing library `PyHamcrest `_ provides similar functionality, that may be " @@ -1063,3 +2030,9 @@ msgid "" "integration.match_equality `_)." msgstr "" +"Από την έκδοση 1.5, η βιβλιοθήκη δοκιμών Python `PyHamcrest `_ παρέχει παρόμοια λειτουργικότητα, που μπορεί " +"να είναι χρήσιμη εδώ, με τη μορφή του αντιστοιχιστή ισότητας (`hamcrest." +"library.integration.match_equality `_)." diff --git a/library/unittest.mock.po b/library/unittest.mock.po index d1040dc0..3d4cd386 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -8,30 +8,31 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: library/unittest.mock.rst:3 -msgid ":mod:`unittest.mock` --- mock object library" +#: library/unittest.mock.rst:2 +msgid ":mod:`!unittest.mock` --- mock object library" msgstr "" -#: library/unittest.mock.rst:13 +#: library/unittest.mock.rst:12 msgid "**Source code:** :source:`Lib/unittest/mock.py`" msgstr "" -#: library/unittest.mock.rst:17 +#: library/unittest.mock.rst:16 msgid "" ":mod:`unittest.mock` is a library for testing in Python. It allows you to " "replace parts of your system under test with mock objects and make " "assertions about how they have been used." msgstr "" -#: library/unittest.mock.rst:21 +#: library/unittest.mock.rst:20 msgid "" ":mod:`unittest.mock` provides a core :class:`Mock` class removing the need " "to create a host of stubs throughout your test suite. After performing an " @@ -40,7 +41,7 @@ msgid "" "set needed attributes in the normal way." msgstr "" -#: library/unittest.mock.rst:27 +#: library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " "module and class level attributes within the scope of a test, along with :" @@ -49,24 +50,24 @@ msgid "" "`patch`." msgstr "" -#: library/unittest.mock.rst:33 +#: library/unittest.mock.rst:32 msgid "" "Mock is designed for use with :mod:`unittest` and is based on the 'action -> " "assertion' pattern instead of 'record -> replay' used by many mocking " "frameworks." msgstr "" -#: library/unittest.mock.rst:37 +#: library/unittest.mock.rst:36 msgid "" "There is a backport of :mod:`unittest.mock` for earlier versions of Python, " -"available as `mock on PyPI `_." +"available as :pypi:`mock` on PyPI." msgstr "" -#: library/unittest.mock.rst:42 +#: library/unittest.mock.rst:41 msgid "Quick Guide" msgstr "" -#: library/unittest.mock.rst:60 +#: library/unittest.mock.rst:59 msgid "" ":class:`Mock` and :class:`MagicMock` objects create all attributes and " "methods as you access them and store details of how they have been used. You " @@ -74,13 +75,13 @@ msgid "" "available, and then make assertions about how they have been used:" msgstr "" -#: library/unittest.mock.rst:72 +#: library/unittest.mock.rst:71 msgid "" -":attr:`side_effect` allows you to perform side effects, including raising an " -"exception when a mock is called:" +":attr:`~Mock.side_effect` allows you to perform side effects, including " +"raising an exception when a mock is called:" msgstr "" -#: library/unittest.mock.rst:93 +#: library/unittest.mock.rst:92 msgid "" "Mock has many other ways you can configure it and control its behaviour. For " "example the *spec* argument configures the mock to take its specification " @@ -88,7 +89,7 @@ msgid "" "that don't exist on the spec will fail with an :exc:`AttributeError`." msgstr "" -#: library/unittest.mock.rst:98 +#: library/unittest.mock.rst:97 msgid "" "The :func:`patch` decorator / context manager makes it easy to mock classes " "or objects in a module under test. The object you specify will be replaced " @@ -96,7 +97,23 @@ msgid "" "ends::" msgstr "" -#: library/unittest.mock.rst:117 +#: library/unittest.mock.rst:101 +msgid "" +">>> from unittest.mock import patch\n" +">>> @patch('module.ClassName2')\n" +"... @patch('module.ClassName1')\n" +"... def test(MockClass1, MockClass2):\n" +"... module.ClassName1()\n" +"... module.ClassName2()\n" +"... assert MockClass1 is module.ClassName1\n" +"... assert MockClass2 is module.ClassName2\n" +"... assert MockClass1.called\n" +"... assert MockClass2.called\n" +"...\n" +">>> test()" +msgstr "" + +#: library/unittest.mock.rst:116 msgid "" "When you nest patch decorators the mocks are passed in to the decorated " "function in the same order they applied (the normal *Python* order that " @@ -104,34 +121,34 @@ msgid "" "above the mock for ``module.ClassName1`` is passed in first." msgstr "" -#: library/unittest.mock.rst:122 +#: library/unittest.mock.rst:121 msgid "" "With :func:`patch` it matters that you patch objects in the namespace where " "they are looked up. This is normally straightforward, but for a quick guide " "read :ref:`where to patch `." msgstr "" -#: library/unittest.mock.rst:126 +#: library/unittest.mock.rst:125 msgid "" "As well as a decorator :func:`patch` can be used as a context manager in a " "with statement:" msgstr "" -#: library/unittest.mock.rst:136 +#: library/unittest.mock.rst:135 msgid "" "There is also :func:`patch.dict` for setting values in a dictionary just " "during a scope and restoring the dictionary to its original state when the " "test ends:" msgstr "" -#: library/unittest.mock.rst:147 +#: library/unittest.mock.rst:146 msgid "" "Mock supports the mocking of Python :ref:`magic methods `. " "The easiest way of using magic methods is with the :class:`MagicMock` class. " "It allows you to do things like:" msgstr "" -#: library/unittest.mock.rst:157 +#: library/unittest.mock.rst:156 msgid "" "Mock allows you to assign functions (or other Mock instances) to magic " "methods and they will be called appropriately. The :class:`MagicMock` class " @@ -139,13 +156,13 @@ msgid "" "(well, all the useful ones anyway)." msgstr "" -#: library/unittest.mock.rst:162 +#: library/unittest.mock.rst:161 msgid "" "The following is an example of using magic methods with the ordinary Mock " "class:" msgstr "" -#: library/unittest.mock.rst:170 +#: library/unittest.mock.rst:169 msgid "" "For ensuring that the mock objects in your tests have the same api as the " "objects they are replacing, you can use :ref:`auto-speccing >> mock = Mock(return_value=None)\n" +">>> mock('hello')\n" +">>> mock.called\n" +"True\n" +">>> mock.reset_mock()\n" +">>> mock.called\n" +"False" msgstr "" -#: library/unittest.mock.rst:412 +#: library/unittest.mock.rst:414 msgid "" "This can be useful where you want to make a series of assertions that reuse " -"the same object. Note that :meth:`reset_mock` *doesn't* clear the return " -"value, :attr:`side_effect` or any child attributes you have set using normal " -"assignment by default. In case you want to reset *return_value* or :attr:" -"`side_effect`, then pass the corresponding parameter as ``True``. Child " -"mocks and the return value mock (if any) are reset as well." +"the same object." +msgstr "" + +#: library/unittest.mock.rst:417 +msgid "" +"*return_value* parameter when set to ``True`` resets :attr:`return_value`:" +msgstr "" + +#: library/unittest.mock.rst:419 +msgid "" +">>> mock = Mock(return_value=5)\n" +">>> mock('hello')\n" +"5\n" +">>> mock.reset_mock(return_value=True)\n" +">>> mock('hello')\n" +"" +msgstr "" + +#: library/unittest.mock.rst:428 +msgid "" +"*side_effect* parameter when set to ``True`` resets :attr:`side_effect`:" +msgstr "" + +#: library/unittest.mock.rst:430 +msgid "" +">>> mock = Mock(side_effect=ValueError)\n" +">>> mock('hello')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> mock.reset_mock(side_effect=True)\n" +">>> mock('hello')\n" +"" +msgstr "" + +#: library/unittest.mock.rst:441 +msgid "" +"Note that :meth:`reset_mock` *doesn't* clear the :attr:`return_value`, :attr:" +"`side_effect` or any child attributes you have set using normal assignment " +"by default." +msgstr "" + +#: library/unittest.mock.rst:445 +msgid "Child mocks are reset as well." msgstr "" -#: library/unittest.mock.rst:420 -msgid "*return_value*, and :attr:`side_effect` are keyword-only arguments." +#: library/unittest.mock.rst:447 +msgid "Added two keyword-only arguments to the reset_mock function." msgstr "" -#: library/unittest.mock.rst:426 +#: library/unittest.mock.rst:452 msgid "" "Add a spec to a mock. *spec* can either be an object or a list of strings. " "Only attributes on the *spec* can be fetched as attributes from the mock." msgstr "" -#: library/unittest.mock.rst:430 +#: library/unittest.mock.rst:456 msgid "If *spec_set* is true then only attributes on the spec can be set." msgstr "" -#: library/unittest.mock.rst:435 +#: library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " "Calls to the attached mock will be recorded in the :attr:`method_calls` and :" "attr:`mock_calls` attributes of this one." msgstr "" -#: library/unittest.mock.rst:442 +#: library/unittest.mock.rst:468 msgid "Set attributes on the mock through keyword arguments." msgstr "" -#: library/unittest.mock.rst:444 +#: library/unittest.mock.rst:470 msgid "" "Attributes plus return values and side effects can be set on child mocks " "using standard dot notation and unpacking a dictionary in the method call:" msgstr "" -#: library/unittest.mock.rst:458 +#: library/unittest.mock.rst:484 msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "" -#: library/unittest.mock.rst:471 +#: library/unittest.mock.rst:497 msgid "" ":meth:`configure_mock` exists to make it easier to do configuration after " "the mock has been created." msgstr "" -#: library/unittest.mock.rst:477 +#: library/unittest.mock.rst:503 msgid "" ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " "results. For mocks with a *spec* this includes all the permitted attributes " "for the mock." msgstr "" -#: library/unittest.mock.rst:481 +#: library/unittest.mock.rst:507 msgid "" "See :data:`FILTER_DIR` for what this filtering does, and how to switch it " "off." msgstr "" -#: library/unittest.mock.rst:487 +#: library/unittest.mock.rst:513 msgid "" "Create the child mocks for attributes and return value. By default child " "mocks will be the same type as the parent. Subclasses of Mock may want to " "override this to customize the way child mocks are made." msgstr "" -#: library/unittest.mock.rst:492 +#: library/unittest.mock.rst:518 msgid "" "For non-callable mocks the callable variant will be used (rather than any " "custom subclass)." msgstr "" -#: library/unittest.mock.rst:498 +#: library/unittest.mock.rst:524 msgid "A boolean representing whether or not the mock object has been called:" msgstr "" -#: library/unittest.mock.rst:509 +#: library/unittest.mock.rst:535 msgid "An integer telling you how many times the mock object has been called:" msgstr "" -#: library/unittest.mock.rst:521 +#: library/unittest.mock.rst:547 msgid "Set this to configure the value returned by calling the mock:" msgstr "" -#: library/unittest.mock.rst:528 +#: library/unittest.mock.rst:554 msgid "" "The default return value is a mock object and you can configure it in the " "normal way:" msgstr "" -#: library/unittest.mock.rst:537 +#: library/unittest.mock.rst:563 msgid ":attr:`return_value` can also be set in the constructor:" msgstr "" -#: library/unittest.mock.rst:548 +#: library/unittest.mock.rst:574 msgid "" "This can either be a function to be called when the mock is called, an " "iterable or an exception (class or instance) to be raised." msgstr "" -#: library/unittest.mock.rst:551 +#: library/unittest.mock.rst:577 msgid "" "If you pass in a function it will be called with same arguments as the mock " "and unless the function returns the :data:`DEFAULT` singleton the call to " @@ -472,7 +535,7 @@ msgid "" "the :attr:`return_value`)." msgstr "" -#: library/unittest.mock.rst:557 +#: library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " @@ -480,41 +543,41 @@ msgid "" "`DEFAULT` handling is identical to the function case)." msgstr "" -#: library/unittest.mock.rst:562 +#: library/unittest.mock.rst:588 msgid "" "An example of a mock that raises an exception (to test exception handling of " "an API):" msgstr "" -#: library/unittest.mock.rst:572 +#: library/unittest.mock.rst:598 msgid "Using :attr:`side_effect` to return a sequence of values:" msgstr "" -#: library/unittest.mock.rst:579 +#: library/unittest.mock.rst:605 msgid "Using a callable:" msgstr "" -#: library/unittest.mock.rst:589 +#: library/unittest.mock.rst:615 msgid "" ":attr:`side_effect` can be set in the constructor. Here's an example that " "adds one to the value the mock is called with and returns it:" msgstr "" -#: library/unittest.mock.rst:599 +#: library/unittest.mock.rst:625 msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgstr "" -#: library/unittest.mock.rst:613 +#: library/unittest.mock.rst:639 msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " "first member, which can also be accessed through the ``args`` property, is " -"any ordered arguments the mock was called with (or an empty tuple) and the " -"second member, which can also be accessed through the ``kwargs`` property, " -"is any keyword arguments (or an empty dictionary)." +"any positional arguments the mock was called with (or an empty tuple) and " +"the second member, which can also be accessed through the ``kwargs`` " +"property, is any keyword arguments (or an empty dictionary)." msgstr "" -#: library/unittest.mock.rst:646 +#: library/unittest.mock.rst:672 msgid "" ":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" "attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " @@ -522,11 +585,11 @@ msgid "" "make more complex assertions. See :ref:`calls as tuples `." msgstr "" -#: library/unittest.mock.rst:652 +#: library/unittest.mock.rst:678 msgid "Added ``args`` and ``kwargs`` properties." msgstr "" -#: library/unittest.mock.rst:658 +#: library/unittest.mock.rst:684 msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " @@ -535,80 +598,80 @@ msgid "" "`call_args_list`." msgstr "" -#: library/unittest.mock.rst:674 +#: library/unittest.mock.rst:700 msgid "" "Members of :attr:`call_args_list` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " "tuples `." msgstr "" -#: library/unittest.mock.rst:681 +#: library/unittest.mock.rst:707 msgid "" "As well as tracking calls to themselves, mocks also track calls to methods " "and attributes, and *their* methods and attributes:" msgstr "" -#: library/unittest.mock.rst:692 +#: library/unittest.mock.rst:718 msgid "" "Members of :attr:`method_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " "tuples `." msgstr "" -#: library/unittest.mock.rst:699 +#: library/unittest.mock.rst:725 msgid "" ":attr:`mock_calls` records *all* calls to the mock object, its methods, " "magic methods *and* return value mocks." msgstr "" -#: library/unittest.mock.rst:717 +#: library/unittest.mock.rst:743 msgid "" "Members of :attr:`mock_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " "tuples `." msgstr "" -#: library/unittest.mock.rst:723 +#: library/unittest.mock.rst:749 msgid "" "The way :attr:`mock_calls` are recorded means that where nested calls are " "made, the parameters of ancestor calls are not recorded and so will always " "compare equal:" msgstr "" -#: library/unittest.mock.rst:737 +#: library/unittest.mock.rst:763 msgid "" -"Normally the :attr:`__class__` attribute of an object will return its type. " -"For a mock object with a :attr:`spec`, ``__class__`` returns the spec class " -"instead. This allows mock objects to pass :func:`isinstance` tests for the " -"object they are replacing / masquerading as:" +"Normally the :attr:`!__class__` attribute of an object will return its type. " +"For a mock object with a :attr:`!spec`, :attr:`!__class__` returns the spec " +"class instead. This allows mock objects to pass :func:`isinstance` tests for " +"the object they are replacing / masquerading as:" msgstr "" -#: library/unittest.mock.rst:746 +#: library/unittest.mock.rst:772 msgid "" -":attr:`__class__` is assignable to, this allows a mock to pass an :func:" +":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" "`isinstance` check without forcing you to use a spec:" msgstr "" -#: library/unittest.mock.rst:756 +#: library/unittest.mock.rst:782 msgid "" "A non-callable version of :class:`Mock`. The constructor parameters have the " "same meaning of :class:`Mock`, with the exception of *return_value* and " "*side_effect* which have no meaning on a non-callable mock." msgstr "" -#: library/unittest.mock.rst:760 +#: library/unittest.mock.rst:786 msgid "" -"Mock objects that use a class or an instance as a :attr:`spec` or :attr:" -"`spec_set` are able to pass :func:`isinstance` tests:" +"Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" +"spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -#: library/unittest.mock.rst:770 +#: library/unittest.mock.rst:796 msgid "" "The :class:`Mock` classes have support for mocking magic methods. See :ref:" "`magic methods ` for the full details." msgstr "" -#: library/unittest.mock.rst:773 +#: library/unittest.mock.rst:799 msgid "" "The mock classes and the :func:`patch` decorators all take arbitrary keyword " "arguments for configuration. For the :func:`patch` decorators the keywords " @@ -616,14 +679,14 @@ msgid "" "arguments are for configuring attributes of the mock:" msgstr "" -#: library/unittest.mock.rst:784 +#: library/unittest.mock.rst:810 msgid "" "The return value and side effect of child mocks can be set in the same way, " "using dotted notation. As you can't use dotted names directly in a call you " "have to create a dictionary and unpack it using ``**``:" msgstr "" -#: library/unittest.mock.rst:799 +#: library/unittest.mock.rst:825 msgid "" "A callable mock which was created with a *spec* (or a *spec_set*) will " "introspect the specification object's signature when matching calls to the " @@ -631,7 +694,18 @@ msgid "" "whether they were passed positionally or by name::" msgstr "" -#: library/unittest.mock.rst:812 +#: library/unittest.mock.rst:830 +msgid "" +">>> def f(a, b, c): pass\n" +"...\n" +">>> mock = Mock(spec=f)\n" +">>> mock(1, 2, c=3)\n" +"\n" +">>> mock.assert_called_with(1, 2, 3)\n" +">>> mock.assert_called_with(a=1, b=2, c=3)" +msgstr "" + +#: library/unittest.mock.rst:838 msgid "" "This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." "assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." @@ -639,11 +713,11 @@ msgid "" "calls on the mock object." msgstr "" -#: library/unittest.mock.rst:817 +#: library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." msgstr "" -#: library/unittest.mock.rst:823 +#: library/unittest.mock.rst:849 msgid "" "A mock intended to be used as a :class:`property`, or other :term:" "`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." @@ -651,65 +725,116 @@ msgid "" "value when it is fetched." msgstr "" -#: library/unittest.mock.rst:828 +#: library/unittest.mock.rst:854 msgid "" "Fetching a :class:`PropertyMock` instance from an object calls the mock, " "with no args. Setting it calls the mock with the value being set. ::" msgstr "" -#: library/unittest.mock.rst:849 +#: library/unittest.mock.rst:857 +msgid "" +">>> class Foo:\n" +"... @property\n" +"... def foo(self):\n" +"... return 'something'\n" +"... @foo.setter\n" +"... def foo(self, value):\n" +"... pass\n" +"...\n" +">>> with patch('__main__.Foo.foo', new_callable=PropertyMock) as mock_foo:\n" +"... mock_foo.return_value = 'mockity-mock'\n" +"... this_foo = Foo()\n" +"... print(this_foo.foo)\n" +"... this_foo.foo = 6\n" +"...\n" +"mockity-mock\n" +">>> mock_foo.mock_calls\n" +"[call(), call(6)]" +msgstr "" + +#: library/unittest.mock.rst:875 msgid "" "Because of the way mock attributes are stored you can't directly attach a :" "class:`PropertyMock` to a mock object. Instead you can attach it to the mock " "type object::" msgstr "" -#: library/unittest.mock.rst:863 +#: library/unittest.mock.rst:879 +msgid "" +">>> m = MagicMock()\n" +">>> p = PropertyMock(return_value=3)\n" +">>> type(m).foo = p\n" +">>> m.foo\n" +"3\n" +">>> p.assert_called_once_with()" +msgstr "" + +#: library/unittest.mock.rst:888 +msgid "" +"If an :exc:`AttributeError` is raised by :class:`PropertyMock`, it will be " +"interpreted as a missing descriptor and :meth:`~object.__getattr__` will be " +"called on the parent mock::" +msgstr "" + +#: library/unittest.mock.rst:892 +msgid "" +">>> m = MagicMock()\n" +">>> no_attribute = PropertyMock(side_effect=AttributeError)\n" +">>> type(m).my_property = no_attribute\n" +">>> m.my_property\n" +"" +msgstr "" + +#: library/unittest.mock.rst:898 +msgid "See :meth:`~object.__getattr__` for details." +msgstr "" + +#: library/unittest.mock.rst:903 msgid "" "An asynchronous version of :class:`MagicMock`. The :class:`AsyncMock` object " "will behave so the object is recognized as an async function, and the result " "of a call is an awaitable." msgstr "" -#: library/unittest.mock.rst:873 +#: library/unittest.mock.rst:913 msgid "" "The result of ``mock()`` is an async function which will have the outcome of " "``side_effect`` or ``return_value`` after it has been awaited:" msgstr "" -#: library/unittest.mock.rst:876 +#: library/unittest.mock.rst:916 msgid "" "if ``side_effect`` is a function, the async function will return the result " "of that function," msgstr "" -#: library/unittest.mock.rst:878 +#: library/unittest.mock.rst:918 msgid "" "if ``side_effect`` is an exception, the async function will raise the " "exception," msgstr "" -#: library/unittest.mock.rst:880 +#: library/unittest.mock.rst:920 msgid "" "if ``side_effect`` is an iterable, the async function will return the next " "value of the iterable, however, if the sequence of result is exhausted, " "``StopAsyncIteration`` is raised immediately," msgstr "" -#: library/unittest.mock.rst:883 +#: library/unittest.mock.rst:923 msgid "" "if ``side_effect`` is not defined, the async function will return the value " "defined by ``return_value``, hence, by default, the async function returns a " "new :class:`AsyncMock` object." msgstr "" -#: library/unittest.mock.rst:888 +#: library/unittest.mock.rst:928 msgid "" "Setting the *spec* of a :class:`Mock` or :class:`MagicMock` to an async " "function will result in a coroutine object being returned after calling." msgstr "" -#: library/unittest.mock.rst:900 +#: library/unittest.mock.rst:940 msgid "" "Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" "`AsyncMock` to a class with asynchronous and synchronous functions will " @@ -719,82 +844,129 @@ msgid "" "functions will be :class:`AsyncMock`." msgstr "" -#: library/unittest.mock.rst:928 +#: library/unittest.mock.rst:968 msgid "" "Assert that the mock was awaited at least once. Note that this is separate " "from the object having been called, the ``await`` keyword must be used:" msgstr "" -#: library/unittest.mock.rst:947 +#: library/unittest.mock.rst:987 msgid "Assert that the mock was awaited exactly once." msgstr "" -#: library/unittest.mock.rst:963 +#: library/unittest.mock.rst:1003 msgid "Assert that the last await was with the specified arguments." msgstr "" -#: library/unittest.mock.rst:980 +#: library/unittest.mock.rst:1020 msgid "" "Assert that the mock was awaited exactly once and with the specified " "arguments." msgstr "" -#: library/unittest.mock.rst:997 +#: library/unittest.mock.rst:1037 msgid "Assert the mock has ever been awaited with the specified arguments." msgstr "" -#: library/unittest.mock.rst:1013 +#: library/unittest.mock.rst:1053 msgid "" "Assert the mock has been awaited with the specified calls. The :attr:" "`await_args_list` list is checked for the awaits." msgstr "" -#: library/unittest.mock.rst:1016 +#: library/unittest.mock.rst:1056 msgid "" "If *any_order* is false then the awaits must be sequential. There can be " "extra calls before or after the specified awaits." msgstr "" -#: library/unittest.mock.rst:1020 +#: library/unittest.mock.rst:1060 msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" -#: library/unittest.mock.rst:1040 +#: library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." msgstr "" -#: library/unittest.mock.rst:1047 +#: library/unittest.mock.rst:1087 msgid "" "See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" "`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" -#: library/unittest.mock.rst:1052 +#: library/unittest.mock.rst:1092 msgid "" "An integer keeping track of how many times the mock object has been awaited." msgstr "" -#: library/unittest.mock.rst:1067 +#: library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " "that the mock was last awaited with. Functions the same as :attr:`Mock." "call_args`." msgstr "" -#: library/unittest.mock.rst:1085 +#: library/unittest.mock.rst:1125 msgid "" "This is a list of all the awaits made to the mock object in sequence (so the " "length of the list is the number of times it has been awaited). Before any " "awaits have been made it is an empty list." msgstr "" -#: library/unittest.mock.rst:1104 +#: library/unittest.mock.rst:1145 +msgid "" +"A version of :class:`MagicMock` for multithreading tests. The :class:" +"`ThreadingMock` object provides extra methods to wait for a call to be " +"invoked, rather than assert on it immediately." +msgstr "" + +#: library/unittest.mock.rst:1149 +msgid "" +"The default timeout is specified by the ``timeout`` argument, or if unset by " +"the :attr:`ThreadingMock.DEFAULT_TIMEOUT` attribute, which defaults to " +"blocking (``None``)." +msgstr "" + +#: library/unittest.mock.rst:1152 +msgid "" +"You can configure the global default timeout by setting :attr:`ThreadingMock." +"DEFAULT_TIMEOUT`." +msgstr "" + +#: library/unittest.mock.rst:1156 +msgid "Waits until the mock is called." +msgstr "" + +#: library/unittest.mock.rst:1158 +msgid "" +"If a timeout was passed at the creation of the mock or if a timeout argument " +"is passed to this function, the function raises an :exc:`AssertionError` if " +"the call is not performed in time." +msgstr "" + +#: library/unittest.mock.rst:1170 +msgid "Waits until the mock is called with the specified arguments." +msgstr "" + +#: library/unittest.mock.rst:1172 +msgid "" +"If a timeout was passed at the creation of the mock the function raises an :" +"exc:`AssertionError` if the call is not performed in time." +msgstr "" + +#: library/unittest.mock.rst:1183 +msgid "" +"Global default timeout in seconds to create instances of :class:" +"`ThreadingMock`." +msgstr "" + +#: library/unittest.mock.rst:1189 msgid "Calling" msgstr "" -#: library/unittest.mock.rst:1106 +#: library/unittest.mock.rst:1191 msgid "" "Mock objects are callable. The call will return the value set as the :attr:" "`~Mock.return_value` attribute. The default return value is a new Mock " @@ -803,89 +975,103 @@ msgid "" "returned each time." msgstr "" -#: library/unittest.mock.rst:1112 +#: library/unittest.mock.rst:1197 msgid "" "Calls made to the object will be recorded in the attributes like :attr:" "`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -#: library/unittest.mock.rst:1115 +#: library/unittest.mock.rst:1200 msgid "" "If :attr:`~Mock.side_effect` is set then it will be called after the call " -"has been recorded, so if :attr:`side_effect` raises an exception the call is " -"still recorded." +"has been recorded, so if :attr:`!side_effect` raises an exception the call " +"is still recorded." msgstr "" -#: library/unittest.mock.rst:1119 +#: library/unittest.mock.rst:1204 msgid "" "The simplest way to make a mock raise an exception when called is to make :" "attr:`~Mock.side_effect` an exception class or instance:" msgstr "" -#: library/unittest.mock.rst:1137 +#: library/unittest.mock.rst:1222 msgid "" -"If :attr:`side_effect` is a function then whatever that function returns is " -"what calls to the mock return. The :attr:`side_effect` function is called " -"with the same arguments as the mock. This allows you to vary the return " -"value of the call dynamically, based on the input:" +"If :attr:`~Mock.side_effect` is a function then whatever that function " +"returns is what calls to the mock return. The :attr:`!side_effect` function " +"is called with the same arguments as the mock. This allows you to vary the " +"return value of the call dynamically, based on the input:" msgstr "" -#: library/unittest.mock.rst:1153 +#: library/unittest.mock.rst:1238 msgid "" "If you want the mock to still return the default return value (a new mock), " "or any set return value, then there are two ways of doing this. Either " -"return :attr:`mock.return_value` from inside :attr:`side_effect`, or return :" -"data:`DEFAULT`:" +"return :attr:`~Mock.return_value` from inside :attr:`~Mock.side_effect`, or " +"return :data:`DEFAULT`:" msgstr "" -#: library/unittest.mock.rst:1172 +#: library/unittest.mock.rst:1257 msgid "" -"To remove a :attr:`side_effect`, and return to the default behaviour, set " -"the :attr:`side_effect` to ``None``:" +"To remove a :attr:`~Mock.side_effect`, and return to the default behaviour, " +"set the :attr:`!side_effect` to ``None``:" msgstr "" -#: library/unittest.mock.rst:1186 +#: library/unittest.mock.rst:1271 msgid "" -"The :attr:`side_effect` can also be any iterable object. Repeated calls to " -"the mock will return values from the iterable (until the iterable is " -"exhausted and a :exc:`StopIteration` is raised):" +"The :attr:`~Mock.side_effect` can also be any iterable object. Repeated " +"calls to the mock will return values from the iterable (until the iterable " +"is exhausted and a :exc:`StopIteration` is raised):" msgstr "" -#: library/unittest.mock.rst:1202 +#: library/unittest.mock.rst:1287 msgid "" "If any members of the iterable are exceptions they will be raised instead of " "returned::" msgstr "" -#: library/unittest.mock.rst:1220 +#: library/unittest.mock.rst:1290 +msgid "" +">>> iterable = (33, ValueError, 66)\n" +">>> m = MagicMock(side_effect=iterable)\n" +">>> m()\n" +"33\n" +">>> m()\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> m()\n" +"66" +msgstr "" + +#: library/unittest.mock.rst:1305 msgid "Deleting Attributes" msgstr "" -#: library/unittest.mock.rst:1222 +#: library/unittest.mock.rst:1307 msgid "" "Mock objects create attributes on demand. This allows them to pretend to be " "objects of any type." msgstr "" -#: library/unittest.mock.rst:1225 +#: library/unittest.mock.rst:1310 msgid "" "You may want a mock object to return ``False`` to a :func:`hasattr` call, or " "raise an :exc:`AttributeError` when an attribute is fetched. You can do this " -"by providing an object as a :attr:`spec` for a mock, but that isn't always " +"by providing an object as a :attr:`!spec` for a mock, but that isn't always " "convenient." msgstr "" -#: library/unittest.mock.rst:1229 +#: library/unittest.mock.rst:1314 msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -#: library/unittest.mock.rst:1246 +#: library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" msgstr "" -#: library/unittest.mock.rst:1248 +#: library/unittest.mock.rst:1333 msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " @@ -893,17 +1079,31 @@ msgid "" "configure_mock`::" msgstr "" -#: library/unittest.mock.rst:1258 +#: library/unittest.mock.rst:1338 +msgid "" +">>> mock = MagicMock()\n" +">>> mock.configure_mock(name='my_name')\n" +">>> mock.name\n" +"'my_name'" +msgstr "" + +#: library/unittest.mock.rst:1343 msgid "" "A simpler option is to simply set the \"name\" attribute after mock " "creation::" msgstr "" -#: library/unittest.mock.rst:1265 +#: library/unittest.mock.rst:1345 +msgid "" +">>> mock = MagicMock()\n" +">>> mock.name = \"foo\"" +msgstr "" + +#: library/unittest.mock.rst:1350 msgid "Attaching Mocks as Attributes" msgstr "" -#: library/unittest.mock.rst:1267 +#: library/unittest.mock.rst:1352 msgid "" "When you attach a mock as an attribute of another mock (or as the return " "value) it becomes a \"child\" of that mock. Calls to the child are recorded " @@ -914,20 +1114,36 @@ msgid "" "calls between mocks:" msgstr "" -#: library/unittest.mock.rst:1285 +#: library/unittest.mock.rst:1370 msgid "" "The exception to this is if the mock has a name. This allows you to prevent " "the \"parenting\" if for some reason you don't want it to happen." msgstr "" -#: library/unittest.mock.rst:1296 +#: library/unittest.mock.rst:1381 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " "attach mocks that have names to a parent you use the :meth:`~Mock." "attach_mock` method::" msgstr "" -#: library/unittest.mock.rst:1314 +#: library/unittest.mock.rst:1385 +msgid "" +">>> thing1 = object()\n" +">>> thing2 = object()\n" +">>> parent = MagicMock()\n" +">>> with patch('__main__.thing1', return_value=None) as child1:\n" +"... with patch('__main__.thing2', return_value=None) as child2:\n" +"... parent.attach_mock(child1, 'child1')\n" +"... parent.attach_mock(child2, 'child2')\n" +"... child1('one')\n" +"... child2('two')\n" +"...\n" +">>> parent.mock_calls\n" +"[call.child1('one'), call.child2('two')]" +msgstr "" + +#: library/unittest.mock.rst:1399 msgid "" "The only exceptions are magic methods and attributes (those that have " "leading and trailing double underscores). Mock doesn't create these but " @@ -937,11 +1153,11 @@ msgid "" "support see :ref:`magic methods `." msgstr "" -#: library/unittest.mock.rst:1323 +#: library/unittest.mock.rst:1408 msgid "The patchers" msgstr "" -#: library/unittest.mock.rst:1325 +#: library/unittest.mock.rst:1410 msgid "" "The patch decorators are used for patching objects only within the scope of " "the function they decorate. They automatically handle the unpatching for " @@ -949,17 +1165,17 @@ msgid "" "in with statements or as class decorators." msgstr "" -#: library/unittest.mock.rst:1332 +#: library/unittest.mock.rst:1417 msgid "patch" msgstr "" -#: library/unittest.mock.rst:1336 +#: library/unittest.mock.rst:1421 msgid "" "The key is to do the patching in the right namespace. See the section `where " "to patch`_." msgstr "" -#: library/unittest.mock.rst:1340 +#: library/unittest.mock.rst:1425 msgid "" ":func:`patch` acts as a function decorator, class decorator or a context " "manager. Inside the body of the function or with statement, the *target* is " @@ -967,7 +1183,7 @@ msgid "" "patch is undone." msgstr "" -#: library/unittest.mock.rst:1345 +#: library/unittest.mock.rst:1430 msgid "" "If *new* is omitted, then the target is replaced with an :class:`AsyncMock` " "if the patched object is an async function or a :class:`MagicMock` " @@ -977,7 +1193,7 @@ msgid "" "by the context manager." msgstr "" -#: library/unittest.mock.rst:1353 +#: library/unittest.mock.rst:1438 msgid "" "*target* should be a string in the form ``'package.module.ClassName'``. The " "*target* is imported and the specified object replaced with the *new* " @@ -986,26 +1202,26 @@ msgid "" "function is executed, not at decoration time." msgstr "" -#: library/unittest.mock.rst:1359 +#: library/unittest.mock.rst:1444 msgid "" "The *spec* and *spec_set* keyword arguments are passed to the :class:" "`MagicMock` if patch is creating one for you." msgstr "" -#: library/unittest.mock.rst:1362 +#: library/unittest.mock.rst:1447 msgid "" "In addition you can pass ``spec=True`` or ``spec_set=True``, which causes " "patch to pass in the object being mocked as the spec/spec_set object." msgstr "" -#: library/unittest.mock.rst:1365 +#: library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " "that will be called to create the *new* object. By default :class:" "`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." msgstr "" -#: library/unittest.mock.rst:1369 +#: library/unittest.mock.rst:1454 msgid "" "A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` " "then the mock will be created with a spec from the object being replaced. " @@ -1017,13 +1233,13 @@ msgid "" "func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" -#: library/unittest.mock.rst:1379 +#: library/unittest.mock.rst:1464 msgid "" "Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an " "arbitrary object as the spec instead of the one being replaced." msgstr "" -#: library/unittest.mock.rst:1382 +#: library/unittest.mock.rst:1467 msgid "" "By default :func:`patch` will fail to replace attributes that don't exist. " "If you pass in ``create=True``, and the attribute doesn't exist, patch will " @@ -1034,24 +1250,24 @@ msgid "" "write passing tests against APIs that don't actually exist!" msgstr "" -#: library/unittest.mock.rst:1392 +#: library/unittest.mock.rst:1477 msgid "" "If you are patching builtins in a module then you don't need to pass " "``create=True``, it will be added by default." msgstr "" -#: library/unittest.mock.rst:1396 +#: library/unittest.mock.rst:1481 msgid "" -"Patch can be used as a :class:`TestCase` class decorator. It works by " -"decorating each test method in the class. This reduces the boilerplate code " -"when your test methods share a common patchings set. :func:`patch` finds " -"tests by looking for method names that start with ``patch.TEST_PREFIX``. By " -"default this is ``'test'``, which matches the way :mod:`unittest` finds " -"tests. You can specify an alternative prefix by setting ``patch." -"TEST_PREFIX``." +"Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " +"by decorating each test method in the class. This reduces the boilerplate " +"code when your test methods share a common patchings set. :func:`patch` " +"finds tests by looking for method names that start with ``patch." +"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" +"`unittest` finds tests. You can specify an alternative prefix by setting " +"``patch.TEST_PREFIX``." msgstr "" -#: library/unittest.mock.rst:1403 +#: library/unittest.mock.rst:1488 msgid "" "Patch can be used as a context manager, with the with statement. Here the " "patching applies to the indented block after the with statement. If you use " @@ -1059,65 +1275,126 @@ msgid "" "very useful if :func:`patch` is creating a mock object for you." msgstr "" -#: library/unittest.mock.rst:1408 +#: library/unittest.mock.rst:1493 msgid "" ":func:`patch` takes arbitrary keyword arguments. These will be passed to :" "class:`AsyncMock` if the patched object is asynchronous, to :class:" "`MagicMock` otherwise or to *new_callable* if specified." msgstr "" -#: library/unittest.mock.rst:1412 +#: library/unittest.mock.rst:1497 msgid "" "``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are " "available for alternate use-cases." msgstr "" -#: library/unittest.mock.rst:1415 +#: library/unittest.mock.rst:1500 msgid "" ":func:`patch` as function decorator, creating the mock for you and passing " "it into the decorated function::" msgstr "" -#: library/unittest.mock.rst:1425 +#: library/unittest.mock.rst:1503 +msgid "" +">>> @patch('__main__.SomeClass')\n" +"... def function(normal_argument, mock_class):\n" +"... print(mock_class is SomeClass)\n" +"...\n" +">>> function(None)\n" +"True" +msgstr "" + +#: library/unittest.mock.rst:1510 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " "the class is instantiated in the code under test then it will be the :attr:" "`~Mock.return_value` of the mock that will be used." msgstr "" -#: library/unittest.mock.rst:1429 +#: library/unittest.mock.rst:1514 msgid "" "If the class is instantiated multiple times you could use :attr:`~Mock." "side_effect` to return a new mock each time. Alternatively you can set the " "*return_value* to be anything you want." msgstr "" -#: library/unittest.mock.rst:1433 +#: library/unittest.mock.rst:1518 msgid "" "To configure return values on methods of *instances* on the patched class " -"you must do this on the :attr:`return_value`. For example::" +"you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -#: library/unittest.mock.rst:1447 +#: library/unittest.mock.rst:1521 +msgid "" +">>> class Class:\n" +"... def method(self):\n" +"... pass\n" +"...\n" +">>> with patch('__main__.Class') as MockClass:\n" +"... instance = MockClass.return_value\n" +"... instance.method.return_value = 'foo'\n" +"... assert Class() is instance\n" +"... assert Class().method() == 'foo'\n" +"..." +msgstr "" + +#: library/unittest.mock.rst:1532 msgid "" "If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, " "then the return value of the created mock will have the same spec. ::" msgstr "" -#: library/unittest.mock.rst:1457 +#: library/unittest.mock.rst:1535 +msgid "" +">>> Original = Class\n" +">>> patcher = patch('__main__.Class', spec=True)\n" +">>> MockClass = patcher.start()\n" +">>> instance = MockClass()\n" +">>> assert isinstance(instance, Original)\n" +">>> patcher.stop()" +msgstr "" + +#: library/unittest.mock.rst:1542 msgid "" "The *new_callable* argument is useful where you want to use an alternative " "class to the default :class:`MagicMock` for the created mock. For example, " "if you wanted a :class:`NonCallableMock` to be used::" msgstr "" -#: library/unittest.mock.rst:1470 +#: library/unittest.mock.rst:1546 +msgid "" +">>> thing = object()\n" +">>> with patch('__main__.thing', new_callable=NonCallableMock) as " +"mock_thing:\n" +"... assert thing is mock_thing\n" +"... thing()\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'NonCallableMock' object is not callable" +msgstr "" + +#: library/unittest.mock.rst:1555 msgid "" "Another use case might be to replace an object with an :class:`io.StringIO` " "instance::" msgstr "" -#: library/unittest.mock.rst:1483 +#: library/unittest.mock.rst:1557 +msgid "" +">>> from io import StringIO\n" +">>> def foo():\n" +"... print('Something')\n" +"...\n" +">>> @patch('sys.stdout', new_callable=StringIO)\n" +"... def test(mock_stdout):\n" +"... foo()\n" +"... assert mock_stdout.getvalue() == 'Something\\n'\n" +"...\n" +">>> test()" +msgstr "" + +#: library/unittest.mock.rst:1568 msgid "" "When :func:`patch` is creating a mock for you, it is common that the first " "thing you need to do is to configure the mock. Some of that configuration " @@ -1125,7 +1402,17 @@ msgid "" "call will be used to set attributes on the created mock::" msgstr "" -#: library/unittest.mock.rst:1495 +#: library/unittest.mock.rst:1573 +msgid "" +">>> patcher = patch('__main__.thing', first='one', second='two')\n" +">>> mock_thing = patcher.start()\n" +">>> mock_thing.first\n" +"'one'\n" +">>> mock_thing.second\n" +"'two'" +msgstr "" + +#: library/unittest.mock.rst:1580 msgid "" "As well as attributes on the created mock attributes, like the :attr:`~Mock." "return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " @@ -1134,36 +1421,71 @@ msgid "" "func:`patch` call using ``**``::" msgstr "" -#: library/unittest.mock.rst:1511 +#: library/unittest.mock.rst:1586 +msgid "" +">>> config = {'method.return_value': 3, 'other.side_effect': KeyError}\n" +">>> patcher = patch('__main__.thing', **config)\n" +">>> mock_thing = patcher.start()\n" +">>> mock_thing.method()\n" +"3\n" +">>> mock_thing.other()\n" +"Traceback (most recent call last):\n" +" ...\n" +"KeyError" +msgstr "" + +#: library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " "attribute in a class) that does not exist will fail with :exc:" "`AttributeError`::" msgstr "" -#: library/unittest.mock.rst:1523 +#: library/unittest.mock.rst:1599 +msgid "" +">>> @patch('sys.non_existing_attribute', 42)\n" +"... def test():\n" +"... assert sys.non_existing_attribute == 42\n" +"...\n" +">>> test()\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: does not have the attribute " +"'non_existing_attribute'" +msgstr "" + +#: library/unittest.mock.rst:1608 msgid "" "but adding ``create=True`` in the call to :func:`patch` will make the " "previous example work as expected::" msgstr "" -#: library/unittest.mock.rst:1534 +#: library/unittest.mock.rst:1611 +msgid "" +">>> @patch('sys.non_existing_attribute', 42, create=True)\n" +"... def test(mock_stdout):\n" +"... assert sys.non_existing_attribute == 42\n" +"...\n" +">>> test()" +msgstr "" + +#: library/unittest.mock.rst:1619 msgid "" ":func:`patch` now returns an :class:`AsyncMock` if the target is an async " "function." msgstr "" -#: library/unittest.mock.rst:1538 +#: library/unittest.mock.rst:1623 msgid "patch.object" msgstr "" -#: library/unittest.mock.rst:1542 +#: library/unittest.mock.rst:1627 msgid "" "patch the named member (*attribute*) on an object (*target*) with a mock " "object." msgstr "" -#: library/unittest.mock.rst:1545 +#: library/unittest.mock.rst:1630 msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " @@ -1172,112 +1494,113 @@ msgid "" "configuring the mock object it creates." msgstr "" -#: library/unittest.mock.rst:1551 +#: library/unittest.mock.rst:1636 msgid "" "When used as a class decorator :func:`patch.object` honours ``patch." "TEST_PREFIX`` for choosing which methods to wrap." msgstr "" -#: library/unittest.mock.rst:1554 +#: library/unittest.mock.rst:1639 msgid "" "You can either call :func:`patch.object` with three arguments or two " "arguments. The three argument form takes the object to be patched, the " "attribute name and the object to replace the attribute with." msgstr "" -#: library/unittest.mock.rst:1558 +#: library/unittest.mock.rst:1643 msgid "" "When calling with the two argument form you omit the replacement object, and " "a mock is created for you and passed in as an extra argument to the " "decorated function:" msgstr "" -#: library/unittest.mock.rst:1569 +#: library/unittest.mock.rst:1654 msgid "" "*spec*, *create* and the other arguments to :func:`patch.object` have the " "same meaning as they do for :func:`patch`." msgstr "" -#: library/unittest.mock.rst:1574 +#: library/unittest.mock.rst:1659 msgid "patch.dict" msgstr "" -#: library/unittest.mock.rst:1578 +#: library/unittest.mock.rst:1663 msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " -"its original state after the test." +"its original state after the test, where the restored dictionary is a copy " +"of the dictionary as it was before the test." msgstr "" -#: library/unittest.mock.rst:1581 +#: library/unittest.mock.rst:1667 msgid "" "*in_dict* can be a dictionary or a mapping like container. If it is a " "mapping then it must at least support getting, setting and deleting items " "plus iterating over keys." msgstr "" -#: library/unittest.mock.rst:1585 +#: library/unittest.mock.rst:1671 msgid "" "*in_dict* can also be a string specifying the name of the dictionary, which " "will then be fetched by importing it." msgstr "" -#: library/unittest.mock.rst:1588 +#: library/unittest.mock.rst:1674 msgid "" "*values* can be a dictionary of values to set in the dictionary. *values* " "can also be an iterable of ``(key, value)`` pairs." msgstr "" -#: library/unittest.mock.rst:1591 +#: library/unittest.mock.rst:1677 msgid "" "If *clear* is true then the dictionary will be cleared before the new values " "are set." msgstr "" -#: library/unittest.mock.rst:1594 +#: library/unittest.mock.rst:1680 msgid "" ":func:`patch.dict` can also be called with arbitrary keyword arguments to " "set values in the dictionary." msgstr "" -#: library/unittest.mock.rst:1599 +#: library/unittest.mock.rst:1685 msgid "" ":func:`patch.dict` now returns the patched dictionary when used as a context " "manager." msgstr "" -#: library/unittest.mock.rst:1602 +#: library/unittest.mock.rst:1688 msgid "" ":func:`patch.dict` can be used as a context manager, decorator or class " "decorator:" msgstr "" -#: library/unittest.mock.rst:1613 +#: library/unittest.mock.rst:1699 msgid "" "When used as a class decorator :func:`patch.dict` honours ``patch." "TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" msgstr "" -#: library/unittest.mock.rst:1624 +#: library/unittest.mock.rst:1710 msgid "" "If you want to use a different prefix for your test, you can inform the " "patchers of the different prefix by setting ``patch.TEST_PREFIX``. For more " "details about how to change the value of see :ref:`test-prefix`." msgstr "" -#: library/unittest.mock.rst:1628 +#: library/unittest.mock.rst:1714 msgid "" ":func:`patch.dict` can be used to add members to a dictionary, or simply let " "a test change a dictionary, and ensure the dictionary is restored when the " "test ends." msgstr "" -#: library/unittest.mock.rst:1649 +#: library/unittest.mock.rst:1735 msgid "" "Keywords can be used in the :func:`patch.dict` call to set values in the " "dictionary:" msgstr "" -#: library/unittest.mock.rst:1659 +#: library/unittest.mock.rst:1745 msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " @@ -1287,18 +1610,24 @@ msgid "" "__iter__` or :meth:`~object.__contains__`." msgstr "" -#: library/unittest.mock.rst:1689 +#: library/unittest.mock.rst:1775 msgid "patch.multiple" msgstr "" -#: library/unittest.mock.rst:1693 +#: library/unittest.mock.rst:1779 msgid "" "Perform multiple patches in a single call. It takes the object to be patched " "(either as an object or a string to fetch the object by importing) and " "keyword arguments for the patches::" msgstr "" -#: library/unittest.mock.rst:1700 +#: library/unittest.mock.rst:1783 +msgid "" +"with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" +" ..." +msgstr "" + +#: library/unittest.mock.rst:1786 msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " @@ -1306,7 +1635,7 @@ msgid "" "`patch.multiple` is used as a context manager." msgstr "" -#: library/unittest.mock.rst:1705 +#: library/unittest.mock.rst:1791 msgid "" ":func:`patch.multiple` can be used as a decorator, class decorator or a " "context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " @@ -1314,13 +1643,13 @@ msgid "" "will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" -#: library/unittest.mock.rst:1710 +#: library/unittest.mock.rst:1796 msgid "" "When used as a class decorator :func:`patch.multiple` honours ``patch." "TEST_PREFIX`` for choosing which methods to wrap." msgstr "" -#: library/unittest.mock.rst:1713 +#: library/unittest.mock.rst:1799 msgid "" "If you want :func:`patch.multiple` to create mocks for you, then you can " "use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " @@ -1328,52 +1657,121 @@ msgid "" "keyword. ::" msgstr "" -#: library/unittest.mock.rst:1727 +#: library/unittest.mock.rst:1803 +msgid "" +">>> thing = object()\n" +">>> other = object()\n" +"\n" +">>> @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" +"... def test_function(thing, other):\n" +"... assert isinstance(thing, MagicMock)\n" +"... assert isinstance(other, MagicMock)\n" +"...\n" +">>> test_function()" +msgstr "" + +#: library/unittest.mock.rst:1813 msgid "" ":func:`patch.multiple` can be nested with other ``patch`` decorators, but " "put arguments passed by keyword *after* any of the standard arguments " "created by :func:`patch`::" msgstr "" -#: library/unittest.mock.rst:1739 +#: library/unittest.mock.rst:1816 +msgid "" +">>> @patch('sys.exit')\n" +"... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" +"... def test_function(mock_exit, other, thing):\n" +"... assert 'other' in repr(other)\n" +"... assert 'thing' in repr(thing)\n" +"... assert 'exit' in repr(mock_exit)\n" +"...\n" +">>> test_function()" +msgstr "" + +#: library/unittest.mock.rst:1825 msgid "" "If :func:`patch.multiple` is used as a context manager, the value returned " "by the context manager is a dictionary where created mocks are keyed by " "name::" msgstr "" -#: library/unittest.mock.rst:1753 +#: library/unittest.mock.rst:1828 +msgid "" +">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " +"values:\n" +"... assert 'other' in repr(values['other'])\n" +"... assert 'thing' in repr(values['thing'])\n" +"... assert values['thing'] is thing\n" +"... assert values['other'] is other\n" +"..." +msgstr "" + +#: library/unittest.mock.rst:1839 msgid "patch methods: start and stop" msgstr "" -#: library/unittest.mock.rst:1755 +#: library/unittest.mock.rst:1841 msgid "" -"All the patchers have :meth:`start` and :meth:`stop` methods. These make it " -"simpler to do patching in ``setUp`` methods or where you want to do multiple " -"patches without nesting decorators or with statements." +"All the patchers have :meth:`!start` and :meth:`!stop` methods. These make " +"it simpler to do patching in ``setUp`` methods or where you want to do " +"multiple patches without nesting decorators or with statements." msgstr "" -#: library/unittest.mock.rst:1759 +#: library/unittest.mock.rst:1845 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " -"then call :meth:`start` to put the patch in place and :meth:`stop` to undo " +"then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" -#: library/unittest.mock.rst:1763 +#: library/unittest.mock.rst:1849 msgid "" "If you are using :func:`patch` to create a mock for you then it will be " "returned by the call to ``patcher.start``. ::" msgstr "" -#: library/unittest.mock.rst:1777 +#: library/unittest.mock.rst:1852 +msgid "" +">>> patcher = patch('package.module.ClassName')\n" +">>> from package import module\n" +">>> original = module.ClassName\n" +">>> new_mock = patcher.start()\n" +">>> assert module.ClassName is not original\n" +">>> assert module.ClassName is new_mock\n" +">>> patcher.stop()\n" +">>> assert module.ClassName is original\n" +">>> assert module.ClassName is not new_mock" +msgstr "" + +#: library/unittest.mock.rst:1863 msgid "" "A typical use case for this might be for doing multiple patches in the " -"``setUp`` method of a :class:`TestCase`::" +"``setUp`` method of a :class:`~unittest.TestCase`::" msgstr "" -#: library/unittest.mock.rst:1799 +#: library/unittest.mock.rst:1866 +msgid "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... self.patcher1 = patch('package.module.Class1')\n" +"... self.patcher2 = patch('package.module.Class2')\n" +"... self.MockClass1 = self.patcher1.start()\n" +"... self.MockClass2 = self.patcher2.start()\n" +"...\n" +"... def tearDown(self):\n" +"... self.patcher1.stop()\n" +"... self.patcher2.stop()\n" +"...\n" +"... def test_something(self):\n" +"... assert package.module.Class1 is self.MockClass1\n" +"... assert package.module.Class2 is self.MockClass2\n" +"...\n" +">>> MyTest('test_something').run()" +msgstr "" + +#: library/unittest.mock.rst:1885 msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " @@ -1381,37 +1779,61 @@ msgid "" "`unittest.TestCase.addCleanup` makes this easier::" msgstr "" -#: library/unittest.mock.rst:1814 +#: library/unittest.mock.rst:1890 +msgid "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... patcher = patch('package.module.Class')\n" +"... self.MockClass = patcher.start()\n" +"... self.addCleanup(patcher.stop)\n" +"...\n" +"... def test_something(self):\n" +"... assert package.module.Class is self.MockClass\n" +"..." +msgstr "" + +#: library/unittest.mock.rst:1900 msgid "" "As an added bonus you no longer need to keep a reference to the ``patcher`` " "object." msgstr "" -#: library/unittest.mock.rst:1817 +#: library/unittest.mock.rst:1903 msgid "" "It is also possible to stop all patches which have been started by using :" "func:`patch.stopall`." msgstr "" -#: library/unittest.mock.rst:1822 +#: library/unittest.mock.rst:1908 msgid "Stop all active patches. Only stops patches started with ``start``." msgstr "" -#: library/unittest.mock.rst:1828 +#: library/unittest.mock.rst:1914 msgid "patch builtins" msgstr "" -#: library/unittest.mock.rst:1829 +#: library/unittest.mock.rst:1915 msgid "" "You can patch any builtins within a module. The following example patches " "builtin :func:`ord`::" msgstr "" -#: library/unittest.mock.rst:1844 +#: library/unittest.mock.rst:1918 +msgid "" +">>> @patch('__main__.ord')\n" +"... def test(mock_ord):\n" +"... mock_ord.return_value = 101\n" +"... print(ord('c'))\n" +"...\n" +">>> test()\n" +"101" +msgstr "" + +#: library/unittest.mock.rst:1930 msgid "TEST_PREFIX" msgstr "" -#: library/unittest.mock.rst:1846 +#: library/unittest.mock.rst:1932 msgid "" "All of the patchers can be used as class decorators. When used in this way " "they wrap every test method on the class. The patchers recognise methods " @@ -1419,39 +1841,60 @@ msgid "" "the :class:`unittest.TestLoader` finds test methods by default." msgstr "" -#: library/unittest.mock.rst:1851 +#: library/unittest.mock.rst:1937 msgid "" "It is possible that you want to use a different prefix for your tests. You " "can inform the patchers of the different prefix by setting ``patch." "TEST_PREFIX``::" msgstr "" -#: library/unittest.mock.rst:1874 +#: library/unittest.mock.rst:1940 +msgid "" +">>> patch.TEST_PREFIX = 'foo'\n" +">>> value = 3\n" +">>>\n" +">>> @patch('__main__.value', 'not three')\n" +"... class Thing:\n" +"... def foo_one(self):\n" +"... print(value)\n" +"... def foo_two(self):\n" +"... print(value)\n" +"...\n" +">>>\n" +">>> Thing().foo_one()\n" +"not three\n" +">>> Thing().foo_two()\n" +"not three\n" +">>> value\n" +"3" +msgstr "" + +#: library/unittest.mock.rst:1960 msgid "Nesting Patch Decorators" msgstr "" -#: library/unittest.mock.rst:1876 +#: library/unittest.mock.rst:1962 msgid "" "If you want to perform multiple patches then you can simply stack up the " "decorators." msgstr "" -#: library/unittest.mock.rst:1879 +#: library/unittest.mock.rst:1965 msgid "You can stack up multiple patch decorators using this pattern:" msgstr "" -#: library/unittest.mock.rst:1895 +#: library/unittest.mock.rst:1981 msgid "" "Note that the decorators are applied from the bottom upwards. This is the " "standard way that Python applies decorators. The order of the created mocks " "passed into your test function matches this order." msgstr "" -#: library/unittest.mock.rst:1903 +#: library/unittest.mock.rst:1989 msgid "Where to patch" msgstr "" -#: library/unittest.mock.rst:1905 +#: library/unittest.mock.rst:1991 msgid "" ":func:`patch` works by (temporarily) changing the object that a *name* " "points to with another one. There can be many names pointing to any " @@ -1459,29 +1902,39 @@ msgid "" "the name used by the system under test." msgstr "" -#: library/unittest.mock.rst:1910 +#: library/unittest.mock.rst:1996 msgid "" "The basic principle is that you patch where an object is *looked up*, which " "is not necessarily the same place as where it is defined. A couple of " "examples will help to clarify this." msgstr "" -#: library/unittest.mock.rst:1914 +#: library/unittest.mock.rst:2000 msgid "" "Imagine we have a project that we want to test with the following structure::" msgstr "" -#: library/unittest.mock.rst:1923 +#: library/unittest.mock.rst:2002 +msgid "" +"a.py\n" +" -> Defines SomeClass\n" +"\n" +"b.py\n" +" -> from a import SomeClass\n" +" -> some_function instantiates SomeClass" +msgstr "" + +#: library/unittest.mock.rst:2009 msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " -"will have to do then it imports ``SomeClass`` from module a. If we use :func:" +"will have to do when it imports ``SomeClass`` from module a. If we use :func:" "`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " "module b already has a reference to the *real* ``SomeClass`` and it looks " "like our patching had no effect." msgstr "" -#: library/unittest.mock.rst:1930 +#: library/unittest.mock.rst:2016 msgid "" "The key is to patch out ``SomeClass`` where it is used (or where it is " "looked up). In this case ``some_function`` will actually look up " @@ -1489,7 +1942,11 @@ msgid "" "look like::" msgstr "" -#: library/unittest.mock.rst:1936 +#: library/unittest.mock.rst:2020 +msgid "@patch('b.SomeClass')" +msgstr "" + +#: library/unittest.mock.rst:2022 msgid "" "However, consider the alternative scenario where instead of ``from a import " "SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." @@ -1498,11 +1955,15 @@ msgid "" "``a.SomeClass`` instead::" msgstr "" -#: library/unittest.mock.rst:1945 +#: library/unittest.mock.rst:2027 +msgid "@patch('a.SomeClass')" +msgstr "" + +#: library/unittest.mock.rst:2031 msgid "Patching Descriptors and Proxy Objects" msgstr "" -#: library/unittest.mock.rst:1947 +#: library/unittest.mock.rst:2033 msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " @@ -1512,22 +1973,22 @@ msgid "" "arch_d7_2010_12_04.shtml#e1198>`_." msgstr "" -#: library/unittest.mock.rst:1955 +#: library/unittest.mock.rst:2041 msgid "MagicMock and magic method support" msgstr "" -#: library/unittest.mock.rst:1960 +#: library/unittest.mock.rst:2046 msgid "Mocking Magic Methods" msgstr "" -#: library/unittest.mock.rst:1962 +#: library/unittest.mock.rst:2048 msgid "" ":class:`Mock` supports mocking the Python protocol methods, also known as :" "term:`\"magic methods\" `. This allows mock objects to replace " "containers or other objects that implement Python protocols." msgstr "" -#: library/unittest.mock.rst:1966 +#: library/unittest.mock.rst:2052 msgid "" "Because magic methods are looked up differently from normal methods [#]_, " "this support has been specially implemented. This means that only specific " @@ -1535,72 +1996,72 @@ msgid "" "them. If there are any missing that you need please let us know." msgstr "" -#: library/unittest.mock.rst:1971 +#: library/unittest.mock.rst:2057 msgid "" "You mock magic methods by setting the method you are interested in to a " "function or a mock instance. If you are using a function then it *must* take " "``self`` as the first argument [#]_." msgstr "" -#: library/unittest.mock.rst:1994 +#: library/unittest.mock.rst:2080 msgid "" "One use case for this is for mocking objects used as context managers in a :" "keyword:`with` statement:" msgstr "" -#: library/unittest.mock.rst:2006 +#: library/unittest.mock.rst:2092 msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -#: library/unittest.mock.rst:2011 +#: library/unittest.mock.rst:2097 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " "set a magic method that isn't in the spec will raise an :exc:" "`AttributeError`." msgstr "" -#: library/unittest.mock.rst:2014 +#: library/unittest.mock.rst:2100 msgid "The full list of supported magic methods is:" msgstr "" -#: library/unittest.mock.rst:2016 +#: library/unittest.mock.rst:2102 msgid "``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``" msgstr "" -#: library/unittest.mock.rst:2017 +#: library/unittest.mock.rst:2103 msgid "``__dir__``, ``__format__`` and ``__subclasses__``" msgstr "" -#: library/unittest.mock.rst:2018 +#: library/unittest.mock.rst:2104 msgid "``__round__``, ``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "" -#: library/unittest.mock.rst:2019 +#: library/unittest.mock.rst:2105 msgid "" "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " "``__ne__``" msgstr "" -#: library/unittest.mock.rst:2021 +#: library/unittest.mock.rst:2107 msgid "" "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " "``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " "``__missing__``" msgstr "" -#: library/unittest.mock.rst:2024 +#: library/unittest.mock.rst:2110 msgid "" "Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and " "``__aexit__``" msgstr "" -#: library/unittest.mock.rst:2025 +#: library/unittest.mock.rst:2111 msgid "Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``" msgstr "" -#: library/unittest.mock.rst:2026 +#: library/unittest.mock.rst:2112 msgid "" "The numeric methods (including right hand and in-place variants): " "``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " @@ -1608,100 +2069,100 @@ msgid "" "``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and ``__pow__``" msgstr "" -#: library/unittest.mock.rst:2030 +#: library/unittest.mock.rst:2116 msgid "" "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " "``__index__``" msgstr "" -#: library/unittest.mock.rst:2032 +#: library/unittest.mock.rst:2118 msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "" -#: library/unittest.mock.rst:2033 +#: library/unittest.mock.rst:2119 msgid "" "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " "``__getnewargs__``, ``__getstate__`` and ``__setstate__``" msgstr "" -#: library/unittest.mock.rst:2035 +#: library/unittest.mock.rst:2121 msgid "File system path representation: ``__fspath__``" msgstr "" -#: library/unittest.mock.rst:2036 +#: library/unittest.mock.rst:2122 msgid "Asynchronous iteration methods: ``__aiter__`` and ``__anext__``" msgstr "" -#: library/unittest.mock.rst:2038 +#: library/unittest.mock.rst:2124 msgid "Added support for :func:`os.PathLike.__fspath__`." msgstr "" -#: library/unittest.mock.rst:2041 +#: library/unittest.mock.rst:2127 msgid "" "Added support for ``__aenter__``, ``__aexit__``, ``__aiter__`` and " "``__anext__``." msgstr "" -#: library/unittest.mock.rst:2045 +#: library/unittest.mock.rst:2131 msgid "" "The following methods exist but are *not* supported as they are either in " "use by mock, can't be set dynamically, or can cause problems:" msgstr "" -#: library/unittest.mock.rst:2048 +#: library/unittest.mock.rst:2134 msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "" -#: library/unittest.mock.rst:2049 +#: library/unittest.mock.rst:2135 msgid "" "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" -#: library/unittest.mock.rst:2054 +#: library/unittest.mock.rst:2140 msgid "Magic Mock" msgstr "" -#: library/unittest.mock.rst:2056 +#: library/unittest.mock.rst:2142 msgid "" "There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" "`NonCallableMagicMock`." msgstr "" -#: library/unittest.mock.rst:2061 +#: library/unittest.mock.rst:2147 msgid "" "``MagicMock`` is a subclass of :class:`Mock` with default implementations of " "most of the :term:`magic methods `. You can use ``MagicMock`` " "without having to configure the magic methods yourself." msgstr "" -#: library/unittest.mock.rst:2065 +#: library/unittest.mock.rst:2151 msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "" -#: library/unittest.mock.rst:2067 +#: library/unittest.mock.rst:2153 msgid "" "If you use the *spec* or *spec_set* arguments then *only* magic methods that " "exist in the spec will be created." msgstr "" -#: library/unittest.mock.rst:2073 +#: library/unittest.mock.rst:2159 msgid "A non-callable version of :class:`MagicMock`." msgstr "" -#: library/unittest.mock.rst:2075 +#: library/unittest.mock.rst:2161 msgid "" "The constructor parameters have the same meaning as for :class:`MagicMock`, " "with the exception of *return_value* and *side_effect* which have no meaning " "on a non-callable mock." msgstr "" -#: library/unittest.mock.rst:2079 +#: library/unittest.mock.rst:2165 msgid "" "The magic methods are setup with :class:`MagicMock` objects, so you can " "configure them and use them in the usual way:" msgstr "" -#: library/unittest.mock.rst:2089 +#: library/unittest.mock.rst:2175 msgid "" "By default many of the protocol methods are required to return objects of a " "specific type. These methods are preconfigured with a default return value, " @@ -1710,83 +2171,83 @@ msgid "" "manually if you want to change the default." msgstr "" -#: library/unittest.mock.rst:2095 +#: library/unittest.mock.rst:2181 msgid "Methods and their defaults:" msgstr "" -#: library/unittest.mock.rst:2097 +#: library/unittest.mock.rst:2183 msgid "``__lt__``: :data:`NotImplemented`" msgstr "" -#: library/unittest.mock.rst:2098 +#: library/unittest.mock.rst:2184 msgid "``__gt__``: :data:`!NotImplemented`" msgstr "" -#: library/unittest.mock.rst:2099 +#: library/unittest.mock.rst:2185 msgid "``__le__``: :data:`!NotImplemented`" msgstr "" -#: library/unittest.mock.rst:2100 +#: library/unittest.mock.rst:2186 msgid "``__ge__``: :data:`!NotImplemented`" msgstr "" -#: library/unittest.mock.rst:2101 +#: library/unittest.mock.rst:2187 msgid "``__int__``: ``1``" msgstr "" -#: library/unittest.mock.rst:2102 +#: library/unittest.mock.rst:2188 msgid "``__contains__``: ``False``" msgstr "" -#: library/unittest.mock.rst:2103 +#: library/unittest.mock.rst:2189 msgid "``__len__``: ``0``" msgstr "" -#: library/unittest.mock.rst:2104 +#: library/unittest.mock.rst:2190 msgid "``__iter__``: ``iter([])``" msgstr "" -#: library/unittest.mock.rst:2105 +#: library/unittest.mock.rst:2191 msgid "``__exit__``: ``False``" msgstr "" -#: library/unittest.mock.rst:2106 +#: library/unittest.mock.rst:2192 msgid "``__aexit__``: ``False``" msgstr "" -#: library/unittest.mock.rst:2107 +#: library/unittest.mock.rst:2193 msgid "``__complex__``: ``1j``" msgstr "" -#: library/unittest.mock.rst:2108 +#: library/unittest.mock.rst:2194 msgid "``__float__``: ``1.0``" msgstr "" -#: library/unittest.mock.rst:2109 +#: library/unittest.mock.rst:2195 msgid "``__bool__``: ``True``" msgstr "" -#: library/unittest.mock.rst:2110 +#: library/unittest.mock.rst:2196 msgid "``__index__``: ``1``" msgstr "" -#: library/unittest.mock.rst:2111 +#: library/unittest.mock.rst:2197 msgid "``__hash__``: default hash for the mock" msgstr "" -#: library/unittest.mock.rst:2112 +#: library/unittest.mock.rst:2198 msgid "``__str__``: default str for the mock" msgstr "" -#: library/unittest.mock.rst:2113 +#: library/unittest.mock.rst:2199 msgid "``__sizeof__``: default sizeof for the mock" msgstr "" -#: library/unittest.mock.rst:2115 +#: library/unittest.mock.rst:2201 msgid "For example:" msgstr "" -#: library/unittest.mock.rst:2127 +#: library/unittest.mock.rst:2213 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " "They do the default equality comparison on identity, using the :attr:`~Mock." @@ -1794,102 +2255,114 @@ msgid "" "something else::" msgstr "" -#: library/unittest.mock.rst:2141 +#: library/unittest.mock.rst:2218 +msgid "" +">>> MagicMock() == 3\n" +"False\n" +">>> MagicMock() != 3\n" +"True\n" +">>> mock = MagicMock()\n" +">>> mock.__eq__.return_value = True\n" +">>> mock == 3\n" +"True" +msgstr "" + +#: library/unittest.mock.rst:2227 msgid "" "The return value of :meth:`MagicMock.__iter__` can be any iterable object " "and isn't required to be an iterator:" msgstr "" -#: library/unittest.mock.rst:2151 +#: library/unittest.mock.rst:2237 msgid "" "If the return value *is* an iterator, then iterating over it once will " "consume it and subsequent iterations will result in an empty list:" msgstr "" -#: library/unittest.mock.rst:2160 +#: library/unittest.mock.rst:2246 msgid "" "``MagicMock`` has all of the supported magic methods configured except for " "some of the obscure and obsolete ones. You can still set these up if you " "want." msgstr "" -#: library/unittest.mock.rst:2163 +#: library/unittest.mock.rst:2249 msgid "" "Magic methods that are supported but not setup by default in ``MagicMock`` " "are:" msgstr "" -#: library/unittest.mock.rst:2165 +#: library/unittest.mock.rst:2251 msgid "``__subclasses__``" msgstr "" -#: library/unittest.mock.rst:2166 +#: library/unittest.mock.rst:2252 msgid "``__dir__``" msgstr "" -#: library/unittest.mock.rst:2167 +#: library/unittest.mock.rst:2253 msgid "``__format__``" msgstr "" -#: library/unittest.mock.rst:2168 +#: library/unittest.mock.rst:2254 msgid "``__get__``, ``__set__`` and ``__delete__``" msgstr "" -#: library/unittest.mock.rst:2169 +#: library/unittest.mock.rst:2255 msgid "``__reversed__`` and ``__missing__``" msgstr "" -#: library/unittest.mock.rst:2170 +#: library/unittest.mock.rst:2256 msgid "" "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " "``__getstate__`` and ``__setstate__``" msgstr "" -#: library/unittest.mock.rst:2172 +#: library/unittest.mock.rst:2258 msgid "``__getformat__``" msgstr "" -#: library/unittest.mock.rst:2176 +#: library/unittest.mock.rst:2262 msgid "" "Magic methods *should* be looked up on the class rather than the instance. " "Different versions of Python are inconsistent about applying this rule. The " "supported protocol methods should work with all supported versions of Python." msgstr "" -#: library/unittest.mock.rst:2180 +#: library/unittest.mock.rst:2266 msgid "" "The function is basically hooked up to the class, but each ``Mock`` instance " "is kept isolated from the others." msgstr "" -#: library/unittest.mock.rst:2185 +#: library/unittest.mock.rst:2271 msgid "Helpers" msgstr "" -#: library/unittest.mock.rst:2188 +#: library/unittest.mock.rst:2274 msgid "sentinel" msgstr "" -#: library/unittest.mock.rst:2192 +#: library/unittest.mock.rst:2278 msgid "" "The ``sentinel`` object provides a convenient way of providing unique " "objects for your tests." msgstr "" -#: library/unittest.mock.rst:2195 +#: library/unittest.mock.rst:2281 msgid "" "Attributes are created on demand when you access them by name. Accessing the " "same attribute will always return the same object. The objects returned have " "a sensible repr so that test failure messages are readable." msgstr "" -#: library/unittest.mock.rst:2199 +#: library/unittest.mock.rst:2285 msgid "" "The ``sentinel`` attributes now preserve their identity when they are :mod:" "`copied ` or :mod:`pickled `." msgstr "" -#: library/unittest.mock.rst:2203 +#: library/unittest.mock.rst:2289 msgid "" "Sometimes when testing you need to test that a specific object is passed as " "an argument to another method, or returned. It can be common to create named " @@ -1897,28 +2370,28 @@ msgid "" "creating and testing the identity of objects like this." msgstr "" -#: library/unittest.mock.rst:2208 +#: library/unittest.mock.rst:2294 msgid "" "In this example we monkey patch ``method`` to return ``sentinel." "some_object``:" msgstr "" -#: library/unittest.mock.rst:2220 +#: library/unittest.mock.rst:2306 msgid "DEFAULT" msgstr "" -#: library/unittest.mock.rst:2225 +#: library/unittest.mock.rst:2311 msgid "" "The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." "DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " "indicate that the normal return value should be used." msgstr "" -#: library/unittest.mock.rst:2231 +#: library/unittest.mock.rst:2317 msgid "call" msgstr "" -#: library/unittest.mock.rst:2235 +#: library/unittest.mock.rst:2321 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " "with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." @@ -1926,13 +2399,13 @@ msgid "" "with :meth:`~Mock.assert_has_calls`." msgstr "" -#: library/unittest.mock.rst:2248 +#: library/unittest.mock.rst:2334 msgid "" "For a call object that represents multiple calls, :meth:`call_list` returns " "a list of all the intermediate calls as well as the final call." msgstr "" -#: library/unittest.mock.rst:2252 +#: library/unittest.mock.rst:2338 msgid "" "``call_list`` is particularly useful for making assertions on \"chained " "calls\". A chained call is multiple calls on a single line of code. This " @@ -1940,13 +2413,13 @@ msgid "" "constructing the sequence of calls can be tedious." msgstr "" -#: library/unittest.mock.rst:2257 +#: library/unittest.mock.rst:2343 msgid "" ":meth:`~call.call_list` can construct the sequence of calls from the same " "chained call:" msgstr "" -#: library/unittest.mock.rst:2274 +#: library/unittest.mock.rst:2360 msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " @@ -1956,7 +2429,7 @@ msgid "" "to get at the individual arguments they contain." msgstr "" -#: library/unittest.mock.rst:2281 +#: library/unittest.mock.rst:2367 msgid "" "The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." "call_args_list` are two-tuples of (positional args, keyword args) whereas " @@ -1965,7 +2438,7 @@ msgid "" "args)." msgstr "" -#: library/unittest.mock.rst:2286 +#: library/unittest.mock.rst:2372 msgid "" "You can use their \"tupleness\" to pull out the individual arguments for " "more complex introspection and assertions. The positional arguments are a " @@ -1973,29 +2446,29 @@ msgid "" "arguments are a dictionary:" msgstr "" -#: library/unittest.mock.rst:2319 +#: library/unittest.mock.rst:2405 msgid "create_autospec" msgstr "" -#: library/unittest.mock.rst:2323 +#: library/unittest.mock.rst:2409 msgid "" "Create a mock object using another object as a spec. Attributes on the mock " "will use the corresponding attribute on the *spec* object as their spec." msgstr "" -#: library/unittest.mock.rst:2327 +#: library/unittest.mock.rst:2413 msgid "" "Functions or methods being mocked will have their arguments checked to " "ensure that they are called with the correct signature." msgstr "" -#: library/unittest.mock.rst:2330 +#: library/unittest.mock.rst:2416 msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." msgstr "" -#: library/unittest.mock.rst:2333 +#: library/unittest.mock.rst:2419 msgid "" "If a class is used as a spec then the return value of the mock (the instance " "of the class) will have the same spec. You can use a class as the spec for " @@ -2003,29 +2476,29 @@ msgid "" "be callable if instances of the mock are callable." msgstr "" -#: library/unittest.mock.rst:2338 +#: library/unittest.mock.rst:2424 msgid "" ":func:`create_autospec` also takes arbitrary keyword arguments that are " "passed to the constructor of the created mock." msgstr "" -#: library/unittest.mock.rst:2341 +#: library/unittest.mock.rst:2427 msgid "" "See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" "`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" -#: library/unittest.mock.rst:2347 +#: library/unittest.mock.rst:2433 msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." msgstr "" -#: library/unittest.mock.rst:2352 +#: library/unittest.mock.rst:2438 msgid "ANY" msgstr "" -#: library/unittest.mock.rst:2356 +#: library/unittest.mock.rst:2442 msgid "" "Sometimes you may need to make assertions about *some* of the arguments in a " "call to mock, but either not care about some of the arguments or want to " @@ -2033,30 +2506,39 @@ msgid "" "assertions on them." msgstr "" -#: library/unittest.mock.rst:2361 +#: library/unittest.mock.rst:2447 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " "*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." "assert_called_once_with` will then succeed no matter what was passed in." msgstr "" -#: library/unittest.mock.rst:2370 +#: library/unittest.mock.rst:2456 msgid "" ":data:`ANY` can also be used in comparisons with call lists like :attr:" "`~Mock.mock_calls`:" msgstr "" -#: library/unittest.mock.rst:2380 +#: library/unittest.mock.rst:2466 msgid "" ":data:`ANY` is not limited to comparisons with call objects and so can also " "be used in test assertions::" msgstr "" -#: library/unittest.mock.rst:2391 +#: library/unittest.mock.rst:2469 +msgid "" +"class TestStringMethods(unittest.TestCase):\n" +"\n" +" def test_split(self):\n" +" s = 'hello world'\n" +" self.assertEqual(s.split(), ['hello', ANY])" +msgstr "" + +#: library/unittest.mock.rst:2477 msgid "FILTER_DIR" msgstr "" -#: library/unittest.mock.rst:2395 +#: library/unittest.mock.rst:2481 msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " @@ -2065,7 +2547,7 @@ msgid "" "FILTER_DIR = False``." msgstr "" -#: library/unittest.mock.rst:2401 +#: library/unittest.mock.rst:2487 msgid "" "With filtering on, ``dir(some_mock)`` shows only useful attributes and will " "include any dynamically created attributes that wouldn't normally be shown. " @@ -2074,7 +2556,28 @@ msgid "" "yet:" msgstr "" -#: library/unittest.mock.rst:2428 +#: library/unittest.mock.rst:2493 +msgid "" +">>> dir(Mock())\n" +"['assert_any_call',\n" +" 'assert_called',\n" +" 'assert_called_once',\n" +" 'assert_called_once_with',\n" +" 'assert_called_with',\n" +" 'assert_has_calls',\n" +" 'assert_not_called',\n" +" 'attach_mock',\n" +" ...\n" +">>> from urllib import request\n" +">>> dir(Mock(spec=request))\n" +"['AbstractBasicAuthHandler',\n" +" 'AbstractDigestAuthHandler',\n" +" 'AbstractHTTPHandler',\n" +" 'BaseHandler',\n" +" ..." +msgstr "" + +#: library/unittest.mock.rst:2514 msgid "" "Many of the not-very-useful (private to :class:`Mock` rather than the thing " "being mocked) underscore and double underscore prefixed attributes have been " @@ -2083,90 +2586,138 @@ msgid "" "switch :data:`FILTER_DIR`:" msgstr "" -#: library/unittest.mock.rst:2449 +#: library/unittest.mock.rst:2520 +msgid "" +">>> from unittest import mock\n" +">>> mock.FILTER_DIR = False\n" +">>> dir(mock.Mock())\n" +"['_NonCallableMock__get_return_value',\n" +" '_NonCallableMock__get_side_effect',\n" +" '_NonCallableMock__return_value_doc',\n" +" '_NonCallableMock__set_return_value',\n" +" '_NonCallableMock__set_side_effect',\n" +" '__call__',\n" +" '__class__',\n" +" ..." +msgstr "" + +#: library/unittest.mock.rst:2535 msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " -"of :const:`mock.FILTER_DIR`." +"of :const:`FILTER_DIR`." msgstr "" -#: library/unittest.mock.rst:2455 +#: library/unittest.mock.rst:2541 msgid "mock_open" msgstr "" -#: library/unittest.mock.rst:2459 +#: library/unittest.mock.rst:2545 msgid "" "A helper function to create a mock to replace the use of :func:`open`. It " "works for :func:`open` called directly or used as a context manager." msgstr "" -#: library/unittest.mock.rst:2462 +#: library/unittest.mock.rst:2548 msgid "" "The *mock* argument is the mock object to configure. If ``None`` (the " "default) then a :class:`MagicMock` will be created for you, with the API " "limited to methods or attributes available on standard file handles." msgstr "" -#: library/unittest.mock.rst:2466 +#: library/unittest.mock.rst:2552 msgid "" -"*read_data* is a string for the :meth:`~io.IOBase.read`, :meth:`~io.IOBase." -"readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to " -"return. Calls to those methods will take data from *read_data* until it is " -"depleted. The mock of these methods is pretty simplistic: every time the " -"*mock* is called, the *read_data* is rewound to the start. If you need more " -"control over the data that you are feeding to the tested code you will need " -"to customize this mock for yourself. When that is insufficient, one of the " -"in-memory filesystem packages on `PyPI `_ can offer a " -"realistic filesystem for testing." +"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." +"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " +"handle to return. Calls to those methods will take data from *read_data* " +"until it is depleted. The mock of these methods is pretty simplistic: every " +"time the *mock* is called, the *read_data* is rewound to the start. If you " +"need more control over the data that you are feeding to the tested code you " +"will need to customize this mock for yourself. When that is insufficient, " +"one of the in-memory filesystem packages on `PyPI `_ can " +"offer a realistic filesystem for testing." msgstr "" -#: library/unittest.mock.rst:2476 +#: library/unittest.mock.rst:2562 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " -"The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather " +"The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" -#: library/unittest.mock.rst:2481 +#: library/unittest.mock.rst:2567 msgid "*read_data* is now reset on each call to the *mock*." msgstr "" -#: library/unittest.mock.rst:2484 +#: library/unittest.mock.rst:2570 msgid "" "Added :meth:`~container.__iter__` to implementation so that iteration (such " "as in for loops) correctly consumes *read_data*." msgstr "" -#: library/unittest.mock.rst:2488 +#: library/unittest.mock.rst:2574 msgid "" "Using :func:`open` as a context manager is a great way to ensure your file " "handles are closed properly and is becoming common::" msgstr "" -#: library/unittest.mock.rst:2494 +#: library/unittest.mock.rst:2577 +msgid "" +"with open('/some/path', 'w') as f:\n" +" f.write('something')" +msgstr "" + +#: library/unittest.mock.rst:2580 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " "*returned object* that is used as a context manager (and has :meth:`~object." "__enter__` and :meth:`~object.__exit__` called)." msgstr "" -#: library/unittest.mock.rst:2498 +#: library/unittest.mock.rst:2584 msgid "" "Mocking context managers with a :class:`MagicMock` is common enough and " "fiddly enough that a helper function is useful. ::" msgstr "" -#: library/unittest.mock.rst:2515 +#: library/unittest.mock.rst:2587 +msgid "" +">>> m = mock_open()\n" +">>> with patch('__main__.open', m):\n" +"... with open('foo', 'w') as h:\n" +"... h.write('some stuff')\n" +"...\n" +">>> m.mock_calls\n" +"[call('foo', 'w'),\n" +" call().__enter__(),\n" +" call().write('some stuff'),\n" +" call().__exit__(None, None, None)]\n" +">>> m.assert_called_once_with('foo', 'w')\n" +">>> handle = m()\n" +">>> handle.write.assert_called_once_with('some stuff')" +msgstr "" + +#: library/unittest.mock.rst:2601 msgid "And for reading files::" msgstr "" -#: library/unittest.mock.rst:2528 +#: library/unittest.mock.rst:2603 +msgid "" +">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" +"... with open('foo') as h:\n" +"... result = h.read()\n" +"...\n" +">>> m.assert_called_once_with('foo')\n" +">>> assert result == 'bibble'" +msgstr "" + +#: library/unittest.mock.rst:2614 msgid "Autospeccing" msgstr "" -#: library/unittest.mock.rst:2530 +#: library/unittest.mock.rst:2616 msgid "" -"Autospeccing is based on the existing :attr:`spec` feature of mock. It " +"Autospeccing is based on the existing :attr:`!spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " @@ -2174,45 +2725,27 @@ msgid "" "`TypeError` if they are called incorrectly." msgstr "" -#: library/unittest.mock.rst:2537 +#: library/unittest.mock.rst:2623 msgid "Before I explain how auto-speccing works, here's why it is needed." msgstr "" -#: library/unittest.mock.rst:2539 -msgid "" -":class:`Mock` is a very powerful and flexible object, but it suffers from " -"two flaws when used to mock out objects from a system under test. One of " -"these flaws is specific to the :class:`Mock` api and the other is a more " -"general problem with using mock objects." -msgstr "" - -#: library/unittest.mock.rst:2544 +#: library/unittest.mock.rst:2625 msgid "" -"First the problem specific to :class:`Mock`. :class:`Mock` has two assert " -"methods that are extremely handy: :meth:`~Mock.assert_called_with` and :meth:" -"`~Mock.assert_called_once_with`." -msgstr "" - -#: library/unittest.mock.rst:2557 -msgid "" -"Because mocks auto-create attributes on demand, and allow you to call them " -"with arbitrary arguments, if you misspell one of these assert methods then " -"your assertion is gone:" -msgstr "" - -#: library/unittest.mock.rst:2567 -msgid "Your tests can pass silently and incorrectly because of the typo." +":class:`Mock` is a very powerful and flexible object, but it suffers from a " +"flaw which is general to mocking. If you refactor some of your code, rename " +"members and so on, any tests for code that is still using the *old api* but " +"uses mocks instead of the real objects will still pass. This means your " +"tests can all pass even though your code is broken." msgstr "" -#: library/unittest.mock.rst:2569 +#: library/unittest.mock.rst:2633 msgid "" -"The second issue is more general to mocking. If you refactor some of your " -"code, rename members and so on, any tests for code that is still using the " -"*old api* but uses mocks instead of the real objects will still pass. This " -"means your tests can all pass even though your code is broken." +"Before 3.5, tests with a typo in the word assert would silently pass when " +"they should raise an error. You can still achieve this behavior by passing " +"``unsafe=True`` to Mock." msgstr "" -#: library/unittest.mock.rst:2574 +#: library/unittest.mock.rst:2636 msgid "" "Note that this is another reason why you need integration tests as well as " "unit tests. Testing everything in isolation is all fine and dandy, but if " @@ -2220,20 +2753,27 @@ msgid "" "room for bugs that tests might have caught." msgstr "" -#: library/unittest.mock.rst:2579 +#: library/unittest.mock.rst:2641 msgid "" -":mod:`mock` already provides a feature to help with this, called speccing. " -"If you use a class or instance as the :attr:`spec` for a mock then you can " -"only access attributes on the mock that exist on the real class:" +":mod:`unittest.mock` already provides a feature to help with this, called " +"speccing. If you use a class or instance as the :attr:`!spec` for a mock " +"then you can only access attributes on the mock that exist on the real class:" msgstr "" -#: library/unittest.mock.rst:2590 +#: library/unittest.mock.rst:2652 msgid "" "The spec only applies to the mock itself, so we still have the same issue " "with any methods on the mock:" msgstr "" -#: library/unittest.mock.rst:2599 +#: library/unittest.mock.rst:2655 +msgid "" +">>> mock.header_items()\n" +"\n" +">>> mock.header_items.assret_called_with() # Intentional typo!" +msgstr "" + +#: library/unittest.mock.rst:2661 msgid "" "Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" "func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " @@ -2245,45 +2785,82 @@ msgid "" "import modules) without a big performance hit." msgstr "" -#: library/unittest.mock.rst:2608 +#: library/unittest.mock.rst:2670 msgid "Here's an example of it in use::" msgstr "" -#: library/unittest.mock.rst:2618 +#: library/unittest.mock.rst:2672 msgid "" -"You can see that :class:`request.Request` has a spec. :class:`request." +">>> from urllib import request\n" +">>> patcher = patch('__main__.request', autospec=True)\n" +">>> mock_request = patcher.start()\n" +">>> request is mock_request\n" +"True\n" +">>> mock_request.Request\n" +"" +msgstr "" + +#: library/unittest.mock.rst:2680 +msgid "" +"You can see that :class:`!request.Request` has a spec. :class:`!request." "Request` takes two arguments in the constructor (one of which is *self*). " "Here's what happens if we try to call it incorrectly::" msgstr "" -#: library/unittest.mock.rst:2627 +#: library/unittest.mock.rst:2684 +msgid "" +">>> req = request.Request()\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: () takes at least 2 arguments (1 given)" +msgstr "" + +#: library/unittest.mock.rst:2689 msgid "" "The spec also applies to instantiated classes (i.e. the return value of " "specced mocks)::" msgstr "" -#: library/unittest.mock.rst:2634 +#: library/unittest.mock.rst:2692 +msgid "" +">>> req = request.Request('foo')\n" +">>> req\n" +"" +msgstr "" + +#: library/unittest.mock.rst:2696 msgid "" -":class:`Request` objects are not callable, so the return value of " -"instantiating our mocked out :class:`request.Request` is a non-callable " +":class:`!Request` objects are not callable, so the return value of " +"instantiating our mocked out :class:`!request.Request` is a non-callable " "mock. With the spec in place any typos in our asserts will raise the correct " "error::" msgstr "" -#: library/unittest.mock.rst:2646 +#: library/unittest.mock.rst:2700 +msgid "" +">>> req.add_header('spam', 'eggs')\n" +"\n" +">>> req.add_header.assret_called_with # Intentional typo!\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: Mock object has no attribute 'assret_called_with'\n" +">>> req.add_header.assert_called_with('spam', 'eggs')" +msgstr "" + +#: library/unittest.mock.rst:2708 msgid "" "In many cases you will just be able to add ``autospec=True`` to your " "existing :func:`patch` calls and then be protected against bugs due to typos " "and api changes." msgstr "" -#: library/unittest.mock.rst:2650 +#: library/unittest.mock.rst:2712 msgid "" "As well as using *autospec* through :func:`patch` there is a :func:" "`create_autospec` for creating autospecced mocks directly:" msgstr "" -#: library/unittest.mock.rst:2658 +#: library/unittest.mock.rst:2720 msgid "" "This isn't without caveats and limitations however, which is why it is not " "the default behaviour. In order to know what attributes are available on the " @@ -2295,7 +2872,7 @@ msgid "" "objects so that introspection is safe [#]_." msgstr "" -#: library/unittest.mock.rst:2667 +#: library/unittest.mock.rst:2729 msgid "" "A more serious problem is that it is common for instance attributes to be " "created in the :meth:`~object.__init__` method and not to exist on the class " @@ -2303,7 +2880,22 @@ msgid "" "restricts the api to visible attributes. ::" msgstr "" -#: library/unittest.mock.rst:2684 +#: library/unittest.mock.rst:2734 +msgid "" +">>> class Something:\n" +"... def __init__(self):\n" +"... self.a = 33\n" +"...\n" +">>> with patch('__main__.Something', autospec=True):\n" +"... thing = Something()\n" +"... thing.a\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: Mock object has no attribute 'a'" +msgstr "" + +#: library/unittest.mock.rst:2746 msgid "" "There are a few different ways of resolving this problem. The easiest, but " "not necessarily the least annoying, way is to simply set the required " @@ -2312,7 +2904,15 @@ msgid "" "setting them::" msgstr "" -#: library/unittest.mock.rst:2695 +#: library/unittest.mock.rst:2752 +msgid "" +">>> with patch('__main__.Something', autospec=True):\n" +"... thing = Something()\n" +"... thing.a = 33\n" +"..." +msgstr "" + +#: library/unittest.mock.rst:2757 msgid "" "There is a more aggressive version of both *spec* and *autospec* that *does* " "prevent you setting non-existent attributes. This is useful if you want to " @@ -2320,7 +2920,7 @@ msgid "" "this particular scenario:" msgstr "" -#: library/unittest.mock.rst:2708 +#: library/unittest.mock.rst:2770 msgid "" "Probably the best way of solving the problem is to add class attributes as " "default values for instance members initialised in :meth:`~object.__init__`. " @@ -2329,7 +2929,13 @@ msgid "" "course) is faster too. e.g." msgstr "" -#: library/unittest.mock.rst:2719 +#: library/unittest.mock.rst:2776 +msgid "" +"class Something:\n" +" a = 33" +msgstr "" + +#: library/unittest.mock.rst:2781 msgid "" "This brings up another issue. It is relatively common to provide a default " "value of ``None`` for members that will later be an object of a different " @@ -2340,7 +2946,7 @@ msgid "" "These will just be ordinary mocks (well - MagicMocks):" msgstr "" -#: library/unittest.mock.rst:2734 +#: library/unittest.mock.rst:2796 msgid "" "If modifying your production classes to add defaults isn't to your liking " "then there are more options. One of these is simply to use an instance as " @@ -2351,27 +2957,138 @@ msgid "" "alternative object as the *autospec* argument::" msgstr "" -#: library/unittest.mock.rst:2755 +#: library/unittest.mock.rst:2804 +msgid "" +">>> class Something:\n" +"... def __init__(self):\n" +"... self.a = 33\n" +"...\n" +">>> class SomethingForTest(Something):\n" +"... a = 33\n" +"...\n" +">>> p = patch('__main__.Something', autospec=SomethingForTest)\n" +">>> mock = p.start()\n" +">>> mock.a\n" +"" +msgstr "" + +#: library/unittest.mock.rst:2817 msgid "" "This only applies to classes or already instantiated objects. Calling a " "mocked class to create a mock instance *does not* create a real instance. It " "is only attribute lookups - along with calls to :func:`dir` - that are done." msgstr "" -#: library/unittest.mock.rst:2760 +#: library/unittest.mock.rst:2822 msgid "Sealing mocks" msgstr "" -#: library/unittest.mock.rst:2769 +#: library/unittest.mock.rst:2831 msgid "" "Seal will disable the automatic creation of mocks when accessing an " "attribute of the mock being sealed or any of its attributes that are already " "mocks recursively." msgstr "" -#: library/unittest.mock.rst:2772 +#: library/unittest.mock.rst:2834 msgid "" "If a mock instance with a name or a spec is assigned to an attribute it " "won't be considered in the sealing chain. This allows one to prevent seal " "from fixing part of the mock object. ::" msgstr "" + +#: library/unittest.mock.rst:2838 +msgid "" +">>> mock = Mock()\n" +">>> mock.submock.attribute1 = 2\n" +">>> mock.not_submock = mock.Mock(name=\"sample_name\")\n" +">>> seal(mock)\n" +">>> mock.new_attribute # This will raise AttributeError.\n" +">>> mock.submock.attribute2 # This will raise AttributeError.\n" +">>> mock.not_submock.attribute2 # This won't raise." +msgstr "" + +#: library/unittest.mock.rst:2850 +msgid "" +"Order of precedence of :attr:`!side_effect`, :attr:`!return_value` and " +"*wraps*" +msgstr "" + +#: library/unittest.mock.rst:2852 +msgid "The order of their precedence is:" +msgstr "" + +#: library/unittest.mock.rst:2854 +msgid ":attr:`~Mock.side_effect`" +msgstr "" + +#: library/unittest.mock.rst:2855 +msgid ":attr:`~Mock.return_value`" +msgstr "" + +#: library/unittest.mock.rst:2856 +msgid "*wraps*" +msgstr "" + +#: library/unittest.mock.rst:2858 +msgid "" +"If all three are set, mock will return the value from :attr:`~Mock." +"side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " +"altogether. If any two are set, the one with the higher precedence will " +"return the value. Regardless of the order of which was set first, the order " +"of precedence remains unchanged." +msgstr "" + +#: library/unittest.mock.rst:2876 +msgid "" +"As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " +"reassign its value back to ``None``, the order of precedence will be checked " +"between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" +"`~Mock.side_effect`." +msgstr "" + +#: library/unittest.mock.rst:2885 +msgid "" +"If the value being returned by :attr:`~Mock.side_effect` is :data:`DEFAULT`, " +"it is ignored and the order of precedence moves to the successor to obtain " +"the value to return." +msgstr "" + +#: library/unittest.mock.rst:2894 +msgid "" +"When :class:`Mock` wraps an object, the default value of :attr:`~Mock." +"return_value` will be :data:`DEFAULT`." +msgstr "" + +#: library/unittest.mock.rst:2903 +msgid "" +"The order of precedence will ignore this value and it will move to the last " +"successor which is the wrapped object." +msgstr "" + +#: library/unittest.mock.rst:2906 +msgid "" +"As the real call is being made to the wrapped object, creating an instance " +"of this mock will return the real instance of the class. The positional " +"arguments, if any, required by the wrapped object must be passed." +msgstr "" + +#: library/unittest.mock.rst:2924 +msgid "" +"But if you assign ``None`` to it, this will not be ignored as it is an " +"explicit assignment. So, the order of precedence will not move to the " +"wrapped object." +msgstr "" + +#: library/unittest.mock.rst:2932 +msgid "" +"Even if you set all three at once when initializing the mock, the order of " +"precedence remains the same:" +msgstr "" + +#: library/unittest.mock.rst:2949 +msgid "" +"If :attr:`~Mock.side_effect` is exhausted, the order of precedence will not " +"cause a value to be obtained from the successors. Instead, ``StopIteration`` " +"exception is raised." +msgstr "" diff --git a/library/unittest.po b/library/unittest.po index 60d193f6..053550f8 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/unittest.rst:2 -msgid ":mod:`unittest` --- Unit testing framework" +msgid ":mod:`!unittest` --- Unit testing framework" msgstr "" #: library/unittest.rst:12 @@ -45,7 +46,7 @@ msgid "" "object-oriented way:" msgstr "" -#: library/unittest.rst:32 +#: library/unittest.rst:28 msgid "test fixture" msgstr "" @@ -57,7 +58,7 @@ msgid "" "server process." msgstr "" -#: library/unittest.rst:37 +#: library/unittest.rst:34 msgid "test case" msgstr "" @@ -68,7 +69,7 @@ msgid "" "base class, :class:`TestCase`, which may be used to create new test cases." msgstr "" -#: library/unittest.rst:41 +#: library/unittest.rst:39 msgid "test suite" msgstr "" @@ -78,7 +79,7 @@ msgid "" "is used to aggregate tests that should be executed together." msgstr "" -#: library/unittest.rst:48 +#: library/unittest.rst:43 msgid "test runner" msgstr "" @@ -90,61 +91,61 @@ msgid "" "results of executing the tests." msgstr "" -#: library/unittest.rst:53 +#: library/unittest.rst:51 msgid "Module :mod:`doctest`" msgstr "" -#: library/unittest.rst:53 +#: library/unittest.rst:52 msgid "Another test-support module with a very different flavor." msgstr "" -#: library/unittest.rst:57 +#: library/unittest.rst:54 msgid "" "`Simple Smalltalk Testing: With Patterns `_" msgstr "" -#: library/unittest.rst:56 +#: library/unittest.rst:55 msgid "" "Kent Beck's original paper on testing frameworks using the pattern shared " "by :mod:`unittest`." msgstr "" -#: library/unittest.rst:61 +#: library/unittest.rst:58 msgid "`pytest `_" msgstr "" -#: library/unittest.rst:60 +#: library/unittest.rst:59 msgid "" "Third-party unittest framework with a lighter-weight syntax for writing " "tests. For example, ``assert func(10) == 42``." msgstr "" -#: library/unittest.rst:65 +#: library/unittest.rst:62 msgid "" "`The Python Testing Tools Taxonomy `_" msgstr "" -#: library/unittest.rst:64 +#: library/unittest.rst:63 msgid "" "An extensive list of Python testing tools including functional testing " "frameworks and mock object libraries." msgstr "" -#: library/unittest.rst:69 +#: library/unittest.rst:66 msgid "" "`Testing in Python Mailing List `_" msgstr "" -#: library/unittest.rst:68 +#: library/unittest.rst:67 msgid "" "A special-interest-group for discussion of testing, and testing tools, in " "Python." msgstr "" -#: library/unittest.rst:71 +#: library/unittest.rst:70 msgid "" "The script :file:`Tools/unittestgui/unittestgui.py` in the Python source " "distribution is a GUI tool for test discovery and execution. This is " @@ -155,30 +156,54 @@ msgid "" "features/actions>`_, or `AppVeyor `_." msgstr "" -#: library/unittest.rst:83 +#: library/unittest.rst:82 msgid "Basic example" msgstr "" -#: library/unittest.rst:85 +#: library/unittest.rst:84 msgid "" "The :mod:`unittest` module provides a rich set of tools for constructing and " "running tests. This section demonstrates that a small subset of the tools " "suffice to meet the needs of most users." msgstr "" -#: library/unittest.rst:89 +#: library/unittest.rst:88 msgid "Here is a short script to test three string methods::" msgstr "" -#: library/unittest.rst:113 -msgid "" -"A testcase is created by subclassing :class:`unittest.TestCase`. The three " +#: library/unittest.rst:90 +msgid "" +"import unittest\n" +"\n" +"class TestStringMethods(unittest.TestCase):\n" +"\n" +" def test_upper(self):\n" +" self.assertEqual('foo'.upper(), 'FOO')\n" +"\n" +" def test_isupper(self):\n" +" self.assertTrue('FOO'.isupper())\n" +" self.assertFalse('Foo'.isupper())\n" +"\n" +" def test_split(self):\n" +" s = 'hello world'\n" +" self.assertEqual(s.split(), ['hello', 'world'])\n" +" # check that s.split fails when the separator is not a string\n" +" with self.assertRaises(TypeError):\n" +" s.split(2)\n" +"\n" +"if __name__ == '__main__':\n" +" unittest.main()" +msgstr "" + +#: library/unittest.rst:112 +msgid "" +"A test case is created by subclassing :class:`unittest.TestCase`. The three " "individual tests are defined with methods whose names start with the letters " "``test``. This naming convention informs the test runner about which " "methods represent tests." msgstr "" -#: library/unittest.rst:118 +#: library/unittest.rst:117 msgid "" "The crux of each test is a call to :meth:`~TestCase.assertEqual` to check " "for an expected result; :meth:`~TestCase.assertTrue` or :meth:`~TestCase." @@ -188,7 +213,7 @@ msgid "" "all test results and produce a report." msgstr "" -#: library/unittest.rst:125 +#: library/unittest.rst:124 msgid "" "The :meth:`~TestCase.setUp` and :meth:`~TestCase.tearDown` methods allow you " "to define instructions that will be executed before and after each test " @@ -196,54 +221,86 @@ msgid "" "tests`." msgstr "" -#: library/unittest.rst:129 +#: library/unittest.rst:128 msgid "" "The final block shows a simple way to run the tests. :func:`unittest.main` " "provides a command-line interface to the test script. When run from the " "command line, the above script produces an output that looks like this::" msgstr "" -#: library/unittest.rst:139 +#: library/unittest.rst:132 +msgid "" +"...\n" +"----------------------------------------------------------------------\n" +"Ran 3 tests in 0.000s\n" +"\n" +"OK" +msgstr "" + +#: library/unittest.rst:138 msgid "" "Passing the ``-v`` option to your test script will instruct :func:`unittest." "main` to enable a higher level of verbosity, and produce the following " "output::" msgstr "" -#: library/unittest.rst:151 +#: library/unittest.rst:141 +msgid "" +"test_isupper (__main__.TestStringMethods.test_isupper) ... ok\n" +"test_split (__main__.TestStringMethods.test_split) ... ok\n" +"test_upper (__main__.TestStringMethods.test_upper) ... ok\n" +"\n" +"----------------------------------------------------------------------\n" +"Ran 3 tests in 0.001s\n" +"\n" +"OK" +msgstr "" + +#: library/unittest.rst:150 msgid "" "The above examples show the most commonly used :mod:`unittest` features " "which are sufficient to meet many everyday testing needs. The remainder of " "the documentation explores the full feature set from first principles." msgstr "" -#: library/unittest.rst:155 +#: library/unittest.rst:154 msgid "" "The behavior of returning a value from a test method (other than the default " "``None`` value), is now deprecated." msgstr "" -#: library/unittest.rst:163 +#: library/unittest.rst:162 msgid "Command-Line Interface" msgstr "" -#: library/unittest.rst:165 +#: library/unittest.rst:164 msgid "" "The unittest module can be used from the command line to run tests from " "modules, classes or even individual test methods::" msgstr "" -#: library/unittest.rst:172 +#: library/unittest.rst:167 +msgid "" +"python -m unittest test_module1 test_module2\n" +"python -m unittest test_module.TestClass\n" +"python -m unittest test_module.TestClass.test_method" +msgstr "" + +#: library/unittest.rst:171 msgid "" "You can pass in a list with any combination of module names, and fully " "qualified class or method names." msgstr "" -#: library/unittest.rst:175 +#: library/unittest.rst:174 msgid "Test modules can be specified by file path as well::" msgstr "" -#: library/unittest.rst:179 +#: library/unittest.rst:176 +msgid "python -m unittest tests/test_something.py" +msgstr "" + +#: library/unittest.rst:178 msgid "" "This allows you to use the shell filename completion to specify the test " "module. The file specified must still be importable as a module. The path is " @@ -252,120 +309,138 @@ msgid "" "importable as a module you should execute the file directly instead." msgstr "" -#: library/unittest.rst:185 +#: library/unittest.rst:184 msgid "" "You can run tests with more detail (higher verbosity) by passing in the -v " "flag::" msgstr "" -#: library/unittest.rst:189 +#: library/unittest.rst:186 +msgid "python -m unittest -v test_module" +msgstr "" + +#: library/unittest.rst:188 msgid "" "When executed without arguments :ref:`unittest-test-discovery` is started::" msgstr "" -#: library/unittest.rst:193 +#: library/unittest.rst:190 +msgid "python -m unittest" +msgstr "" + +#: library/unittest.rst:192 msgid "For a list of all the command-line options::" msgstr "" -#: library/unittest.rst:197 +#: library/unittest.rst:194 +msgid "python -m unittest -h" +msgstr "" + +#: library/unittest.rst:196 msgid "" "In earlier versions it was only possible to run individual test methods and " "not modules or classes." msgstr "" -#: library/unittest.rst:203 -msgid "Command-line options" +#: library/unittest.rst:200 +msgid "" +"Output is colorized by default and can be :ref:`controlled using environment " +"variables `." msgstr "" #: library/unittest.rst:205 +msgid "Command-line options" +msgstr "" + +#: library/unittest.rst:207 msgid ":program:`unittest` supports these command-line options:" msgstr "" -#: library/unittest.rst:211 +#: library/unittest.rst:213 msgid "" "The standard output and standard error streams are buffered during the test " "run. Output during a passing test is discarded. Output is echoed normally on " "test fail or error and is added to the failure messages." msgstr "" -#: library/unittest.rst:217 +#: library/unittest.rst:219 msgid "" ":kbd:`Control-C` during the test run waits for the current test to end and " "then reports all the results so far. A second :kbd:`Control-C` raises the " "normal :exc:`KeyboardInterrupt` exception." msgstr "" -#: library/unittest.rst:221 +#: library/unittest.rst:223 msgid "" "See `Signal Handling`_ for the functions that provide this functionality." msgstr "" -#: library/unittest.rst:225 +#: library/unittest.rst:227 msgid "Stop the test run on the first error or failure." msgstr "" -#: library/unittest.rst:229 +#: library/unittest.rst:231 msgid "" "Only run test methods and classes that match the pattern or substring. This " "option may be used multiple times, in which case all test cases that match " "any of the given patterns are included." msgstr "" -#: library/unittest.rst:233 +#: library/unittest.rst:235 msgid "" "Patterns that contain a wildcard character (``*``) are matched against the " "test name using :meth:`fnmatch.fnmatchcase`; otherwise simple case-sensitive " "substring matching is used." msgstr "" -#: library/unittest.rst:237 +#: library/unittest.rst:239 msgid "" "Patterns are matched against the fully qualified test method name as " "imported by the test loader." msgstr "" -#: library/unittest.rst:240 +#: library/unittest.rst:242 msgid "" "For example, ``-k foo`` matches ``foo_tests.SomeTest.test_something``, " "``bar_tests.SomeTest.test_foo``, but not ``bar_tests.FooTest." "test_something``." msgstr "" -#: library/unittest.rst:245 +#: library/unittest.rst:247 msgid "Show local variables in tracebacks." msgstr "" -#: library/unittest.rst:249 +#: library/unittest.rst:251 msgid "Show the N slowest test cases (N=0 for all)." msgstr "" -#: library/unittest.rst:251 +#: library/unittest.rst:253 msgid "The command-line options ``-b``, ``-c`` and ``-f`` were added." msgstr "" -#: library/unittest.rst:254 +#: library/unittest.rst:256 msgid "The command-line option ``--locals``." msgstr "" -#: library/unittest.rst:257 +#: library/unittest.rst:259 msgid "The command-line option ``-k``." msgstr "" -#: library/unittest.rst:260 +#: library/unittest.rst:262 msgid "The command-line option ``--durations``." msgstr "" -#: library/unittest.rst:263 +#: library/unittest.rst:265 msgid "" "The command line can also be used for test discovery, for running all of the " "tests in a project or just a subset." msgstr "" -#: library/unittest.rst:269 +#: library/unittest.rst:271 msgid "Test Discovery" msgstr "" -#: library/unittest.rst:273 +#: library/unittest.rst:275 msgid "" "Unittest supports simple test discovery. In order to be compatible with test " "discovery, all of the test files must be :ref:`modules ` or :" @@ -374,47 +449,59 @@ msgid "" "`)." msgstr "" -#: library/unittest.rst:279 +#: library/unittest.rst:281 msgid "" "Test discovery is implemented in :meth:`TestLoader.discover`, but can also " "be used from the command line. The basic command-line usage is::" msgstr "" -#: library/unittest.rst:287 +#: library/unittest.rst:284 +msgid "" +"cd project_directory\n" +"python -m unittest discover" +msgstr "" + +#: library/unittest.rst:289 msgid "" "As a shortcut, ``python -m unittest`` is the equivalent of ``python -m " "unittest discover``. If you want to pass arguments to test discovery the " "``discover`` sub-command must be used explicitly." msgstr "" -#: library/unittest.rst:291 +#: library/unittest.rst:293 msgid "The ``discover`` sub-command has the following options:" msgstr "" -#: library/unittest.rst:297 +#: library/unittest.rst:299 msgid "Verbose output" msgstr "" -#: library/unittest.rst:301 +#: library/unittest.rst:303 msgid "Directory to start discovery (``.`` default)" msgstr "" -#: library/unittest.rst:305 +#: library/unittest.rst:307 msgid "Pattern to match test files (``test*.py`` default)" msgstr "" -#: library/unittest.rst:309 +#: library/unittest.rst:311 msgid "Top level directory of project (defaults to start directory)" msgstr "" -#: library/unittest.rst:311 +#: library/unittest.rst:313 msgid "" "The :option:`-s`, :option:`-p`, and :option:`-t` options can be passed in as " "positional arguments in that order. The following two command lines are " "equivalent::" msgstr "" -#: library/unittest.rst:318 +#: library/unittest.rst:317 +msgid "" +"python -m unittest discover -s project_directory -p \"*_test.py\"\n" +"python -m unittest discover project_directory \"*_test.py\"" +msgstr "" + +#: library/unittest.rst:320 msgid "" "As well as being a path it is possible to pass a package name, for example " "``myproject.subpackage.test``, as the start directory. The package name you " @@ -422,7 +509,7 @@ msgid "" "as the start directory." msgstr "" -#: library/unittest.rst:325 +#: library/unittest.rst:327 msgid "" "Test discovery loads tests by importing them. Once test discovery has found " "all the test files from the start directory you specify it turns the paths " @@ -430,53 +517,56 @@ msgid "" "imported as ``foo.bar.baz``." msgstr "" -#: library/unittest.rst:330 +#: library/unittest.rst:332 msgid "" "If you have a package installed globally and attempt test discovery on a " "different copy of the package then the import *could* happen from the wrong " "place. If this happens test discovery will warn you and exit." msgstr "" -#: library/unittest.rst:334 +#: library/unittest.rst:336 msgid "" "If you supply the start directory as a package name rather than a path to a " "directory then discover assumes that whichever location it imports from is " "the location you intended, so you will not get the warning." msgstr "" -#: library/unittest.rst:339 +#: library/unittest.rst:341 msgid "" "Test modules and packages can customize test loading and discovery by " "through the `load_tests protocol`_." msgstr "" -#: library/unittest.rst:342 +#: library/unittest.rst:344 +msgid "Test discovery supports :term:`namespace packages `." +msgstr "" + +#: library/unittest.rst:347 msgid "" -"Test discovery supports :term:`namespace packages ` for " -"the start directory. Note that you need to specify the top level directory " -"too (e.g. ``python -m unittest discover -s root/namespace -t root``)." +"Test discovery dropped the :term:`namespace packages ` " +"support. It has been broken since Python 3.7. Start directory and its " +"subdirectories containing tests must be regular package that have ``__init__." +"py`` file." msgstr "" -#: library/unittest.rst:348 +#: library/unittest.rst:353 msgid "" -":mod:`unittest` dropped the :term:`namespace packages ` " -"support in Python 3.11. It has been broken since Python 3.7. Start directory " -"and subdirectories containing tests must be regular package that have " -"``__init__.py`` file." +"If the start directory is the dotted name of the package, the ancestor " +"packages can be namespace packages." msgstr "" -#: library/unittest.rst:354 +#: library/unittest.rst:356 msgid "" -"Directories containing start directory still can be a namespace package. In " -"this case, you need to specify start directory as dotted package name, and " -"target directory explicitly. For example::" +"Test discovery supports :term:`namespace package` as start directory again. " +"To avoid scanning directories unrelated to Python, tests are not searched in " +"subdirectories that do not contain ``__init__.py``." msgstr "" -#: library/unittest.rst:370 +#: library/unittest.rst:365 msgid "Organizing test code" msgstr "" -#: library/unittest.rst:372 +#: library/unittest.rst:367 msgid "" "The basic building blocks of unit testing are :dfn:`test cases` --- single " "scenarios that must be set up and checked for correctness. In :mod:" @@ -485,21 +575,31 @@ msgid "" "`TestCase` or use :class:`FunctionTestCase`." msgstr "" -#: library/unittest.rst:378 +#: library/unittest.rst:373 msgid "" "The testing code of a :class:`TestCase` instance should be entirely self " "contained, such that it can be run either in isolation or in arbitrary " "combination with any number of other test cases." msgstr "" -#: library/unittest.rst:382 +#: library/unittest.rst:377 msgid "" "The simplest :class:`TestCase` subclass will simply implement a test method " "(i.e. a method whose name starts with ``test``) in order to perform specific " "testing code::" msgstr "" -#: library/unittest.rst:393 +#: library/unittest.rst:381 +msgid "" +"import unittest\n" +"\n" +"class DefaultWidgetSizeTestCase(unittest.TestCase):\n" +" def test_default_widget_size(self):\n" +" widget = Widget('The widget')\n" +" self.assertEqual(widget.size(), (50, 50))" +msgstr "" + +#: library/unittest.rst:388 msgid "" "Note that in order to test something, we use one of the :ref:`assert\\* " "methods ` provided by the :class:`TestCase` base class. If " @@ -508,7 +608,7 @@ msgid "" "other exceptions will be treated as :dfn:`errors`." msgstr "" -#: library/unittest.rst:399 +#: library/unittest.rst:394 msgid "" "Tests can be numerous, and their set-up can be repetitive. Luckily, we can " "factor out set-up code by implementing a method called :meth:`~TestCase." @@ -516,41 +616,71 @@ msgid "" "test we run::" msgstr "" -#: library/unittest.rst:420 +#: library/unittest.rst:399 +msgid "" +"import unittest\n" +"\n" +"class WidgetTestCase(unittest.TestCase):\n" +" def setUp(self):\n" +" self.widget = Widget('The widget')\n" +"\n" +" def test_default_widget_size(self):\n" +" self.assertEqual(self.widget.size(), (50,50),\n" +" 'incorrect default size')\n" +"\n" +" def test_widget_resize(self):\n" +" self.widget.resize(100,150)\n" +" self.assertEqual(self.widget.size(), (100,150),\n" +" 'wrong size after resize')" +msgstr "" + +#: library/unittest.rst:415 msgid "" "The order in which the various tests will be run is determined by sorting " "the test method names with respect to the built-in ordering for strings." msgstr "" -#: library/unittest.rst:424 +#: library/unittest.rst:419 msgid "" "If the :meth:`~TestCase.setUp` method raises an exception while the test is " "running, the framework will consider the test to have suffered an error, and " "the test method will not be executed." msgstr "" -#: library/unittest.rst:428 +#: library/unittest.rst:423 msgid "" "Similarly, we can provide a :meth:`~TestCase.tearDown` method that tidies up " "after the test method has been run::" msgstr "" -#: library/unittest.rst:440 +#: library/unittest.rst:426 +msgid "" +"import unittest\n" +"\n" +"class WidgetTestCase(unittest.TestCase):\n" +" def setUp(self):\n" +" self.widget = Widget('The widget')\n" +"\n" +" def tearDown(self):\n" +" self.widget.dispose()" +msgstr "" + +#: library/unittest.rst:435 msgid "" "If :meth:`~TestCase.setUp` succeeded, :meth:`~TestCase.tearDown` will be run " "whether the test method succeeded or not." msgstr "" -#: library/unittest.rst:443 +#: library/unittest.rst:438 msgid "" "Such a working environment for the testing code is called a :dfn:`test " "fixture`. A new TestCase instance is created as a unique test fixture used " "to execute each individual test method. Thus :meth:`~TestCase.setUp`, :meth:" -"`~TestCase.tearDown`, and :meth:`~TestCase.__init__` will be called once per " +"`~TestCase.tearDown`, and :meth:`!TestCase.__init__` will be called once per " "test." msgstr "" -#: library/unittest.rst:449 +#: library/unittest.rst:444 msgid "" "It is recommended that you use TestCase implementations to group tests " "together according to the features they test. :mod:`unittest` provides a " @@ -560,13 +690,26 @@ msgid "" "execute them." msgstr "" -#: library/unittest.rst:456 +#: library/unittest.rst:451 msgid "" "However, should you want to customize the building of your test suite, you " "can do it yourself::" msgstr "" -#: library/unittest.rst:469 +#: library/unittest.rst:454 +msgid "" +"def suite():\n" +" suite = unittest.TestSuite()\n" +" suite.addTest(WidgetTestCase('test_default_widget_size'))\n" +" suite.addTest(WidgetTestCase('test_widget_resize'))\n" +" return suite\n" +"\n" +"if __name__ == '__main__':\n" +" runner = unittest.TextTestRunner()\n" +" runner.run(suite())" +msgstr "" + +#: library/unittest.rst:464 msgid "" "You can place the definitions of test cases and test suites in the same " "modules as the code they are to test (such as :file:`widget.py`), but there " @@ -574,69 +717,84 @@ msgid "" "as :file:`test_widget.py`:" msgstr "" -#: library/unittest.rst:474 +#: library/unittest.rst:469 msgid "The test module can be run standalone from the command line." msgstr "" -#: library/unittest.rst:476 +#: library/unittest.rst:471 msgid "The test code can more easily be separated from shipped code." msgstr "" -#: library/unittest.rst:478 +#: library/unittest.rst:473 msgid "" "There is less temptation to change test code to fit the code it tests " "without a good reason." msgstr "" -#: library/unittest.rst:481 +#: library/unittest.rst:476 msgid "" "Test code should be modified much less frequently than the code it tests." msgstr "" -#: library/unittest.rst:483 +#: library/unittest.rst:478 msgid "Tested code can be refactored more easily." msgstr "" -#: library/unittest.rst:485 +#: library/unittest.rst:480 msgid "" "Tests for modules written in C must be in separate modules anyway, so why " "not be consistent?" msgstr "" -#: library/unittest.rst:488 +#: library/unittest.rst:483 msgid "" "If the testing strategy changes, there is no need to change the source code." msgstr "" -#: library/unittest.rst:494 +#: library/unittest.rst:489 msgid "Re-using old test code" msgstr "" -#: library/unittest.rst:496 +#: library/unittest.rst:491 msgid "" "Some users will find that they have existing test code that they would like " "to run from :mod:`unittest`, without converting every old test function to " "a :class:`TestCase` subclass." msgstr "" -#: library/unittest.rst:500 +#: library/unittest.rst:495 msgid "" "For this reason, :mod:`unittest` provides a :class:`FunctionTestCase` class. " "This subclass of :class:`TestCase` can be used to wrap an existing test " "function. Set-up and tear-down functions can also be provided." msgstr "" -#: library/unittest.rst:504 +#: library/unittest.rst:499 msgid "Given the following test function::" msgstr "" -#: library/unittest.rst:511 +#: library/unittest.rst:501 +msgid "" +"def testSomething():\n" +" something = makeSomething()\n" +" assert something.name is not None\n" +" # ..." +msgstr "" + +#: library/unittest.rst:506 msgid "" "one can create an equivalent test case instance as follows, with optional " "set-up and tear-down methods::" msgstr "" -#: library/unittest.rst:520 +#: library/unittest.rst:509 +msgid "" +"testcase = unittest.FunctionTestCase(testSomething,\n" +" setUp=makeSomethingDB,\n" +" tearDown=deleteSomethingDB)" +msgstr "" + +#: library/unittest.rst:515 msgid "" "Even though :class:`FunctionTestCase` can be used to quickly convert an " "existing test base over to a :mod:`unittest`\\ -based system, this approach " @@ -644,19 +802,19 @@ msgid "" "subclasses will make future test refactorings infinitely easier." msgstr "" -#: library/unittest.rst:525 +#: library/unittest.rst:520 msgid "" "In some cases, the existing tests may have been written using the :mod:" -"`doctest` module. If so, :mod:`doctest` provides a :class:`DocTestSuite` " -"class that can automatically build :class:`unittest.TestSuite` instances " -"from the existing :mod:`doctest`\\ -based tests." +"`doctest` module. If so, :mod:`doctest` provides a :class:`~doctest." +"DocTestSuite` class that can automatically build :class:`unittest.TestSuite` " +"instances from the existing :mod:`doctest`\\ -based tests." msgstr "" -#: library/unittest.rst:534 +#: library/unittest.rst:529 msgid "Skipping tests and expected failures" msgstr "" -#: library/unittest.rst:538 +#: library/unittest.rst:533 msgid "" "Unittest supports skipping individual test methods and even whole classes of " "tests. In addition, it supports marking a test as an \"expected failure,\" " @@ -664,7 +822,7 @@ msgid "" "on a :class:`TestResult`." msgstr "" -#: library/unittest.rst:543 +#: library/unittest.rst:538 msgid "" "Skipping a test is simply a matter of using the :func:`skip` :term:" "`decorator` or one of its conditional variants, calling :meth:`TestCase." @@ -672,56 +830,124 @@ msgid "" "`SkipTest` directly." msgstr "" -#: library/unittest.rst:547 +#: library/unittest.rst:542 msgid "Basic skipping looks like this::" msgstr "" -#: library/unittest.rst:572 +#: library/unittest.rst:544 +msgid "" +"class MyTestCase(unittest.TestCase):\n" +"\n" +" @unittest.skip(\"demonstrating skipping\")\n" +" def test_nothing(self):\n" +" self.fail(\"shouldn't happen\")\n" +"\n" +" @unittest.skipIf(mylib.__version__ < (1, 3),\n" +" \"not supported in this library version\")\n" +" def test_format(self):\n" +" # Tests that work for only a certain version of the library.\n" +" pass\n" +"\n" +" @unittest.skipUnless(sys.platform.startswith(\"win\"), \"requires " +"Windows\")\n" +" def test_windows_support(self):\n" +" # windows specific testing code\n" +" pass\n" +"\n" +" def test_maybe_skipped(self):\n" +" if not external_resource_available():\n" +" self.skipTest(\"external resource not available\")\n" +" # test code that depends on the external resource\n" +" pass" +msgstr "" + +#: library/unittest.rst:567 msgid "This is the output of running the example above in verbose mode::" msgstr "" -#: library/unittest.rst:584 +#: library/unittest.rst:569 +msgid "" +"test_format (__main__.MyTestCase.test_format) ... skipped 'not supported in " +"this library version'\n" +"test_nothing (__main__.MyTestCase.test_nothing) ... skipped 'demonstrating " +"skipping'\n" +"test_maybe_skipped (__main__.MyTestCase.test_maybe_skipped) ... skipped " +"'external resource not available'\n" +"test_windows_support (__main__.MyTestCase.test_windows_support) ... skipped " +"'requires Windows'\n" +"\n" +"----------------------------------------------------------------------\n" +"Ran 4 tests in 0.005s\n" +"\n" +"OK (skipped=4)" +msgstr "" + +#: library/unittest.rst:579 msgid "Classes can be skipped just like methods::" msgstr "" -#: library/unittest.rst:591 +#: library/unittest.rst:581 +msgid "" +"@unittest.skip(\"showing class skipping\")\n" +"class MySkippedTestCase(unittest.TestCase):\n" +" def test_not_run(self):\n" +" pass" +msgstr "" + +#: library/unittest.rst:586 msgid "" ":meth:`TestCase.setUp` can also skip the test. This is useful when a " "resource that needs to be set up is not available." msgstr "" -#: library/unittest.rst:594 +#: library/unittest.rst:589 msgid "Expected failures use the :func:`expectedFailure` decorator. ::" msgstr "" -#: library/unittest.rst:601 +#: library/unittest.rst:591 +msgid "" +"class ExpectedFailureTestCase(unittest.TestCase):\n" +" @unittest.expectedFailure\n" +" def test_fail(self):\n" +" self.assertEqual(1, 0, \"broken\")" +msgstr "" + +#: library/unittest.rst:596 msgid "" "It's easy to roll your own skipping decorators by making a decorator that " "calls :func:`skip` on the test when it wants it to be skipped. This " "decorator skips the test unless the passed object has a certain attribute::" msgstr "" -#: library/unittest.rst:610 +#: library/unittest.rst:600 +msgid "" +"def skipUnlessHasattr(obj, attr):\n" +" if hasattr(obj, attr):\n" +" return lambda func: func\n" +" return unittest.skip(\"{!r} doesn't have {!r}\".format(obj, attr))" +msgstr "" + +#: library/unittest.rst:605 msgid "" "The following decorators and exception implement test skipping and expected " "failures:" msgstr "" -#: library/unittest.rst:614 +#: library/unittest.rst:609 msgid "" "Unconditionally skip the decorated test. *reason* should describe why the " "test is being skipped." msgstr "" -#: library/unittest.rst:619 +#: library/unittest.rst:614 msgid "Skip the decorated test if *condition* is true." msgstr "" -#: library/unittest.rst:623 +#: library/unittest.rst:618 msgid "Skip the decorated test unless *condition* is true." msgstr "" -#: library/unittest.rst:627 +#: library/unittest.rst:622 msgid "" "Mark the test as an expected failure or error. If the test fails or errors " "in the test function itself (rather than in one of the :dfn:`test fixture` " @@ -729,17 +955,17 @@ msgid "" "be considered a failure." msgstr "" -#: library/unittest.rst:634 +#: library/unittest.rst:629 msgid "This exception is raised to skip a test." msgstr "" -#: library/unittest.rst:636 +#: library/unittest.rst:631 msgid "" "Usually you can use :meth:`TestCase.skipTest` or one of the skipping " "decorators instead of raising this directly." msgstr "" -#: library/unittest.rst:639 +#: library/unittest.rst:634 msgid "" "Skipped tests will not have :meth:`~TestCase.setUp` or :meth:`~TestCase." "tearDown` run around them. Skipped classes will not have :meth:`~TestCase." @@ -747,45 +973,102 @@ msgid "" "have :func:`setUpModule` or :func:`tearDownModule` run." msgstr "" -#: library/unittest.rst:647 +#: library/unittest.rst:642 msgid "Distinguishing test iterations using subtests" msgstr "" -#: library/unittest.rst:651 +#: library/unittest.rst:646 msgid "" "When there are very small differences among your tests, for instance some " "parameters, unittest allows you to distinguish them inside the body of a " "test method using the :meth:`~TestCase.subTest` context manager." msgstr "" -#: library/unittest.rst:655 +#: library/unittest.rst:650 msgid "For example, the following test::" msgstr "" -#: library/unittest.rst:667 +#: library/unittest.rst:652 +msgid "" +"class NumbersTest(unittest.TestCase):\n" +"\n" +" def test_even(self):\n" +" \"\"\"\n" +" Test that numbers between 0 and 5 are all even.\n" +" \"\"\"\n" +" for i in range(0, 6):\n" +" with self.subTest(i=i):\n" +" self.assertEqual(i % 2, 0)" +msgstr "" + +#: library/unittest.rst:662 msgid "will produce the following output::" msgstr "" -#: library/unittest.rst:699 +#: library/unittest.rst:664 +msgid "" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=1)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0\n" +"\n" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=3)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0\n" +"\n" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=5)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0" +msgstr "" + +#: library/unittest.rst:694 msgid "" "Without using a subtest, execution would stop after the first failure, and " "the error would be less easy to diagnose because the value of ``i`` wouldn't " "be displayed::" msgstr "" -#: library/unittest.rst:715 +#: library/unittest.rst:698 +msgid "" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even)\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 32, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +"AssertionError: 1 != 0" +msgstr "" + +#: library/unittest.rst:710 msgid "Classes and functions" msgstr "" -#: library/unittest.rst:717 +#: library/unittest.rst:712 msgid "This section describes in depth the API of :mod:`unittest`." msgstr "" -#: library/unittest.rst:723 +#: library/unittest.rst:718 msgid "Test cases" msgstr "" -#: library/unittest.rst:727 +#: library/unittest.rst:722 msgid "" "Instances of the :class:`TestCase` class represent the logical test units in " "the :mod:`unittest` universe. This class is intended to be used as a base " @@ -795,21 +1078,21 @@ msgid "" "report various kinds of failure." msgstr "" -#: library/unittest.rst:734 +#: library/unittest.rst:729 msgid "" "Each instance of :class:`TestCase` will run a single base method: the method " "named *methodName*. In most uses of :class:`TestCase`, you will neither " "change the *methodName* nor reimplement the default ``runTest()`` method." msgstr "" -#: library/unittest.rst:739 +#: library/unittest.rst:734 msgid "" ":class:`TestCase` can be instantiated successfully without providing a " "*methodName*. This makes it easier to experiment with :class:`TestCase` from " "the interactive interpreter." msgstr "" -#: library/unittest.rst:744 +#: library/unittest.rst:739 msgid "" ":class:`TestCase` instances provide three groups of methods: one group used " "to run the test, another used by the test implementation to check conditions " @@ -817,11 +1100,11 @@ msgid "" "test itself to be gathered." msgstr "" -#: library/unittest.rst:749 +#: library/unittest.rst:744 msgid "Methods in the first group (running the test) are:" msgstr "" -#: library/unittest.rst:753 +#: library/unittest.rst:748 msgid "" "Method called to prepare the test fixture. This is called immediately " "before calling the test method; other than :exc:`AssertionError` or :exc:" @@ -829,7 +1112,7 @@ msgid "" "rather than a test failure. The default implementation does nothing." msgstr "" -#: library/unittest.rst:761 +#: library/unittest.rst:756 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called even if the test method raised an " @@ -842,25 +1125,39 @@ msgid "" "The default implementation does nothing." msgstr "" -#: library/unittest.rst:774 +#: library/unittest.rst:769 msgid "" "A class method called before tests in an individual class are run. " "``setUpClass`` is called with the class as the only argument and must be " "decorated as a :func:`classmethod`::" msgstr "" -#: library/unittest.rst:797 +#: library/unittest.rst:773 +msgid "" +"@classmethod\n" +"def setUpClass(cls):\n" +" ..." +msgstr "" + +#: library/unittest.rst:792 msgid "See `Class and Module Fixtures`_ for more details." msgstr "" -#: library/unittest.rst:789 +#: library/unittest.rst:784 msgid "" "A class method called after tests in an individual class have run. " "``tearDownClass`` is called with the class as the only argument and must be " "decorated as a :meth:`classmethod`::" msgstr "" -#: library/unittest.rst:804 +#: library/unittest.rst:788 +msgid "" +"@classmethod\n" +"def tearDownClass(cls):\n" +" ..." +msgstr "" + +#: library/unittest.rst:799 msgid "" "Run the test, collecting the result into the :class:`TestResult` object " "passed as *result*. If *result* is omitted or ``None``, a temporary result " @@ -868,174 +1165,195 @@ msgid "" "used. The result object is returned to :meth:`run`'s caller." msgstr "" -#: library/unittest.rst:810 +#: library/unittest.rst:805 msgid "" "The same effect may be had by simply calling the :class:`TestCase` instance." msgstr "" -#: library/unittest.rst:813 +#: library/unittest.rst:808 msgid "" "Previous versions of ``run`` did not return the result. Neither did calling " "an instance." msgstr "" -#: library/unittest.rst:819 +#: library/unittest.rst:814 msgid "" "Calling this during a test method or :meth:`setUp` skips the current test. " "See :ref:`unittest-skipping` for more information." msgstr "" -#: library/unittest.rst:827 +#: library/unittest.rst:822 msgid "" "Return a context manager which executes the enclosed code block as a " "subtest. *msg* and *params* are optional, arbitrary values which are " "displayed whenever a subtest fails, allowing you to identify them clearly." msgstr "" -#: library/unittest.rst:832 +#: library/unittest.rst:827 msgid "" "A test case can contain any number of subtest declarations, and they can be " "arbitrarily nested." msgstr "" -#: library/unittest.rst:835 +#: library/unittest.rst:830 msgid "See :ref:`subtests` for more information." msgstr "" -#: library/unittest.rst:842 +#: library/unittest.rst:837 msgid "" "Run the test without collecting the result. This allows exceptions raised " "by the test to be propagated to the caller, and can be used to support " "running tests under a debugger." msgstr "" -#: library/unittest.rst:848 +#: library/unittest.rst:843 msgid "" "The :class:`TestCase` class provides several assert methods to check for and " "report failures. The following table lists the most commonly used methods " "(see the tables below for more assert methods):" msgstr "" -#: library/unittest.rst:974 library/unittest.rst:1312 +#: library/unittest.rst:984 library/unittest.rst:1368 msgid "Method" msgstr "" -#: library/unittest.rst:974 library/unittest.rst:1188 +#: library/unittest.rst:984 library/unittest.rst:1198 msgid "Checks that" msgstr "" -#: library/unittest.rst:974 library/unittest.rst:1312 +#: library/unittest.rst:984 library/unittest.rst:1368 msgid "New in" msgstr "" -#: library/unittest.rst:855 +#: library/unittest.rst:850 msgid ":meth:`assertEqual(a, b) `" msgstr "" -#: library/unittest.rst:855 +#: library/unittest.rst:850 msgid "``a == b``" msgstr "" -#: library/unittest.rst:858 +#: library/unittest.rst:853 msgid ":meth:`assertNotEqual(a, b) `" msgstr "" -#: library/unittest.rst:858 +#: library/unittest.rst:853 msgid "``a != b``" msgstr "" -#: library/unittest.rst:861 +#: library/unittest.rst:856 msgid ":meth:`assertTrue(x) `" msgstr "" -#: library/unittest.rst:861 +#: library/unittest.rst:856 msgid "``bool(x) is True``" msgstr "" -#: library/unittest.rst:864 +#: library/unittest.rst:859 msgid ":meth:`assertFalse(x) `" msgstr "" -#: library/unittest.rst:864 +#: library/unittest.rst:859 msgid "``bool(x) is False``" msgstr "" -#: library/unittest.rst:867 +#: library/unittest.rst:862 msgid ":meth:`assertIs(a, b) `" msgstr "" -#: library/unittest.rst:867 +#: library/unittest.rst:862 msgid "``a is b``" msgstr "" -#: library/unittest.rst:870 library/unittest.rst:876 library/unittest.rst:882 -#: library/unittest.rst:1196 library/unittest.rst:1202 -#: library/unittest.rst:1208 library/unittest.rst:1317 -#: library/unittest.rst:1323 library/unittest.rst:1329 +#: library/unittest.rst:865 library/unittest.rst:871 library/unittest.rst:877 +#: library/unittest.rst:1206 library/unittest.rst:1212 +#: library/unittest.rst:1218 library/unittest.rst:1373 +#: library/unittest.rst:1379 library/unittest.rst:1385 msgid "3.1" msgstr "" -#: library/unittest.rst:870 +#: library/unittest.rst:865 msgid ":meth:`assertIsNot(a, b) `" msgstr "" -#: library/unittest.rst:870 +#: library/unittest.rst:865 msgid "``a is not b``" msgstr "" -#: library/unittest.rst:873 +#: library/unittest.rst:868 msgid ":meth:`assertIsNone(x) `" msgstr "" -#: library/unittest.rst:873 +#: library/unittest.rst:868 msgid "``x is None``" msgstr "" -#: library/unittest.rst:876 +#: library/unittest.rst:871 msgid ":meth:`assertIsNotNone(x) `" msgstr "" -#: library/unittest.rst:876 +#: library/unittest.rst:871 msgid "``x is not None``" msgstr "" -#: library/unittest.rst:879 +#: library/unittest.rst:874 msgid ":meth:`assertIn(a, b) `" msgstr "" -#: library/unittest.rst:879 +#: library/unittest.rst:874 msgid "``a in b``" msgstr "" -#: library/unittest.rst:882 +#: library/unittest.rst:877 msgid ":meth:`assertNotIn(a, b) `" msgstr "" -#: library/unittest.rst:882 +#: library/unittest.rst:877 msgid "``a not in b``" msgstr "" -#: library/unittest.rst:885 +#: library/unittest.rst:880 msgid ":meth:`assertIsInstance(a, b) `" msgstr "" -#: library/unittest.rst:885 +#: library/unittest.rst:880 msgid "``isinstance(a, b)``" msgstr "" -#: library/unittest.rst:888 library/unittest.rst:985 library/unittest.rst:1214 +#: library/unittest.rst:883 library/unittest.rst:995 library/unittest.rst:1224 msgid "3.2" msgstr "" -#: library/unittest.rst:888 +#: library/unittest.rst:883 msgid ":meth:`assertNotIsInstance(a, b) `" msgstr "" -#: library/unittest.rst:888 +#: library/unittest.rst:883 msgid "``not isinstance(a, b)``" msgstr "" -#: library/unittest.rst:892 +#: library/unittest.rst:886 +msgid ":meth:`assertIsSubclass(a, b) `" +msgstr "" + +#: library/unittest.rst:886 +msgid "``issubclass(a, b)``" +msgstr "" + +#: library/unittest.rst:889 library/unittest.rst:1231 library/unittest.rst:1237 +#: library/unittest.rst:1243 +msgid "3.14" +msgstr "" + +#: library/unittest.rst:889 +msgid ":meth:`assertNotIsSubclass(a, b) `" +msgstr "" + +#: library/unittest.rst:889 +msgid "``not issubclass(a, b)``" +msgstr "" + +#: library/unittest.rst:893 msgid "" "All the assert methods accept a *msg* argument that, if specified, is used " "as the error message on failure (see also :data:`longMessage`). Note that " @@ -1044,13 +1362,13 @@ msgid "" "they are used as a context manager." msgstr "" -#: library/unittest.rst:900 +#: library/unittest.rst:901 msgid "" "Test that *first* and *second* are equal. If the values do not compare " "equal, the test will fail." msgstr "" -#: library/unittest.rst:903 +#: library/unittest.rst:904 msgid "" "In addition, if *first* and *second* are the exact same type and one of " "list, tuple, dict, set, frozenset or str or any type that a subclass " @@ -1060,27 +1378,27 @@ msgid "" "methods>`)." msgstr "" -#: library/unittest.rst:910 +#: library/unittest.rst:911 msgid "Added the automatic calling of type-specific equality function." msgstr "" -#: library/unittest.rst:913 +#: library/unittest.rst:914 msgid "" ":meth:`assertMultiLineEqual` added as the default type equality function for " "comparing strings." msgstr "" -#: library/unittest.rst:920 +#: library/unittest.rst:921 msgid "" "Test that *first* and *second* are not equal. If the values do compare " "equal, the test will fail." msgstr "" -#: library/unittest.rst:926 +#: library/unittest.rst:927 msgid "Test that *expr* is true (or false)." msgstr "" -#: library/unittest.rst:928 +#: library/unittest.rst:929 msgid "" "Note that this is equivalent to ``bool(expr) is True`` and not to ``expr is " "True`` (use ``assertIs(expr, True)`` for the latter). This method should " @@ -1089,96 +1407,103 @@ msgid "" "provide a better error message in case of failure." msgstr "" -#: library/unittest.rst:938 +#: library/unittest.rst:939 msgid "Test that *first* and *second* are (or are not) the same object." msgstr "" -#: library/unittest.rst:946 +#: library/unittest.rst:947 msgid "Test that *expr* is (or is not) ``None``." msgstr "" -#: library/unittest.rst:954 +#: library/unittest.rst:955 msgid "Test that *member* is (or is not) in *container*." msgstr "" -#: library/unittest.rst:962 +#: library/unittest.rst:963 msgid "" "Test that *obj* is (or is not) an instance of *cls* (which can be a class or " "a tuple of classes, as supported by :func:`isinstance`). To check for the " "exact type, use :func:`assertIs(type(obj), cls) `." msgstr "" -#: library/unittest.rst:970 +#: library/unittest.rst:973 +msgid "" +"Test that *cls* is (or is not) a subclass of *superclass* (which can be a " +"class or a tuple of classes, as supported by :func:`issubclass`). To check " +"for the exact type, use :func:`assertIs(cls, superclass) `." +msgstr "" + +#: library/unittest.rst:980 msgid "" "It is also possible to check the production of exceptions, warnings, and log " "messages using the following methods:" msgstr "" -#: library/unittest.rst:976 +#: library/unittest.rst:986 msgid ":meth:`assertRaises(exc, fun, *args, **kwds) `" msgstr "" -#: library/unittest.rst:976 +#: library/unittest.rst:986 msgid "``fun(*args, **kwds)`` raises *exc*" msgstr "" -#: library/unittest.rst:979 +#: library/unittest.rst:989 msgid "" ":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) `" msgstr "" -#: library/unittest.rst:979 +#: library/unittest.rst:989 msgid "``fun(*args, **kwds)`` raises *exc* and the message matches regex *r*" msgstr "" -#: library/unittest.rst:982 +#: library/unittest.rst:992 msgid ":meth:`assertWarns(warn, fun, *args, **kwds) `" msgstr "" -#: library/unittest.rst:982 +#: library/unittest.rst:992 msgid "``fun(*args, **kwds)`` raises *warn*" msgstr "" -#: library/unittest.rst:985 +#: library/unittest.rst:995 msgid "" ":meth:`assertWarnsRegex(warn, r, fun, *args, **kwds) `" msgstr "" -#: library/unittest.rst:985 +#: library/unittest.rst:995 msgid "``fun(*args, **kwds)`` raises *warn* and the message matches regex *r*" msgstr "" -#: library/unittest.rst:988 +#: library/unittest.rst:998 msgid ":meth:`assertLogs(logger, level) `" msgstr "" -#: library/unittest.rst:988 +#: library/unittest.rst:998 msgid "The ``with`` block logs on *logger* with minimum *level*" msgstr "" -#: library/unittest.rst:988 +#: library/unittest.rst:998 msgid "3.4" msgstr "" -#: library/unittest.rst:991 +#: library/unittest.rst:1001 msgid ":meth:`assertNoLogs(logger, level) `" msgstr "" -#: library/unittest.rst:991 +#: library/unittest.rst:1001 msgid "The ``with`` block does not log on" msgstr "" -#: library/unittest.rst:992 +#: library/unittest.rst:1002 msgid "*logger* with minimum *level*" msgstr "" -#: library/unittest.rst:991 +#: library/unittest.rst:1001 msgid "3.10" msgstr "" -#: library/unittest.rst:998 +#: library/unittest.rst:1008 msgid "" "Test that an exception is raised when *callable* is called with any " "positional or keyword arguments that are also passed to :meth:" @@ -1188,39 +1513,54 @@ msgid "" "be passed as *exception*." msgstr "" -#: library/unittest.rst:1005 +#: library/unittest.rst:1015 msgid "" "If only the *exception* and possibly the *msg* arguments are given, return a " "context manager so that the code under test can be written inline rather " "than as a function::" msgstr "" -#: library/unittest.rst:1012 +#: library/unittest.rst:1019 +msgid "" +"with self.assertRaises(SomeException):\n" +" do_something()" +msgstr "" + +#: library/unittest.rst:1022 msgid "" "When used as a context manager, :meth:`assertRaises` accepts the additional " "keyword argument *msg*." msgstr "" -#: library/unittest.rst:1015 +#: library/unittest.rst:1025 msgid "" -"The context manager will store the caught exception object in its :attr:" -"`exception` attribute. This can be useful if the intention is to perform " +"The context manager will store the caught exception object in its :attr:`!" +"exception` attribute. This can be useful if the intention is to perform " "additional checks on the exception raised::" msgstr "" -#: library/unittest.rst:1025 +#: library/unittest.rst:1029 +msgid "" +"with self.assertRaises(SomeException) as cm:\n" +" do_something()\n" +"\n" +"the_exception = cm.exception\n" +"self.assertEqual(the_exception.error_code, 3)" +msgstr "" + +#: library/unittest.rst:1035 msgid "Added the ability to use :meth:`assertRaises` as a context manager." msgstr "" -#: library/unittest.rst:1028 -msgid "Added the :attr:`exception` attribute." +#: library/unittest.rst:1038 +msgid "Added the :attr:`!exception` attribute." msgstr "" -#: library/unittest.rst:1057 library/unittest.rst:1121 +#: library/unittest.rst:1067 library/unittest.rst:1131 msgid "Added the *msg* keyword argument when used as a context manager." msgstr "" -#: library/unittest.rst:1038 +#: library/unittest.rst:1048 msgid "" "Like :meth:`assertRaises` but also tests that *regex* matches on the string " "representation of the raised exception. *regex* may be a regular expression " @@ -1228,19 +1568,31 @@ msgid "" "`re.search`. Examples::" msgstr "" -#: library/unittest.rst:1114 +#: library/unittest.rst:1053 +msgid "" +"self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" +" int, 'XYZ')" +msgstr "" + +#: library/unittest.rst:1124 msgid "or::" msgstr "" -#: library/unittest.rst:1051 +#: library/unittest.rst:1058 +msgid "" +"with self.assertRaisesRegex(ValueError, 'literal'):\n" +" int('XYZ')" +msgstr "" + +#: library/unittest.rst:1061 msgid "Added under the name ``assertRaisesRegexp``." msgstr "" -#: library/unittest.rst:1054 +#: library/unittest.rst:1064 msgid "Renamed to :meth:`assertRaisesRegex`." msgstr "" -#: library/unittest.rst:1064 +#: library/unittest.rst:1074 msgid "" "Test that a warning is triggered when *callable* is called with any " "positional or keyword arguments that are also passed to :meth:" @@ -1249,34 +1601,49 @@ msgid "" "tuple containing the warning classes may be passed as *warnings*." msgstr "" -#: library/unittest.rst:1071 +#: library/unittest.rst:1081 msgid "" "If only the *warning* and possibly the *msg* arguments are given, return a " "context manager so that the code under test can be written inline rather " "than as a function::" msgstr "" -#: library/unittest.rst:1078 +#: library/unittest.rst:1085 +msgid "" +"with self.assertWarns(SomeWarning):\n" +" do_something()" +msgstr "" + +#: library/unittest.rst:1088 msgid "" "When used as a context manager, :meth:`assertWarns` accepts the additional " "keyword argument *msg*." msgstr "" -#: library/unittest.rst:1081 +#: library/unittest.rst:1091 +msgid "" +"The context manager will store the caught warning object in its :attr:`!" +"warning` attribute, and the source line which triggered the warnings in the :" +"attr:`!filename` and :attr:`!lineno` attributes. This can be useful if the " +"intention is to perform additional checks on the warning caught::" +msgstr "" + +#: library/unittest.rst:1097 msgid "" -"The context manager will store the caught warning object in its :attr:" -"`warning` attribute, and the source line which triggered the warnings in " -"the :attr:`filename` and :attr:`lineno` attributes. This can be useful if " -"the intention is to perform additional checks on the warning caught::" +"with self.assertWarns(SomeWarning) as cm:\n" +" do_something()\n" +"\n" +"self.assertIn('myfile.py', cm.filename)\n" +"self.assertEqual(320, cm.lineno)" msgstr "" -#: library/unittest.rst:1093 +#: library/unittest.rst:1103 msgid "" "This method works regardless of the warning filters in place when it is " "called." msgstr "" -#: library/unittest.rst:1105 +#: library/unittest.rst:1115 msgid "" "Like :meth:`assertWarns` but also tests that *regex* matches on the message " "of the triggered warning. *regex* may be a regular expression object or a " @@ -1284,13 +1651,26 @@ msgid "" "search`. Example::" msgstr "" +#: library/unittest.rst:1120 +msgid "" +"self.assertWarnsRegex(DeprecationWarning,\n" +" r'legacy_function\\(\\) is deprecated',\n" +" legacy_function, 'XYZ')" +msgstr "" + #: library/unittest.rst:1126 msgid "" +"with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" +" frobnicate('/etc/passwd')" +msgstr "" + +#: library/unittest.rst:1136 +msgid "" "A context manager to test that at least one message is logged on the " "*logger* or one of its children, with at least the given *level*." msgstr "" -#: library/unittest.rst:1130 +#: library/unittest.rst:1140 msgid "" "If given, *logger* should be a :class:`logging.Logger` object or a :class:" "`str` giving the name of a logger. The default is the root logger, which " @@ -1298,138 +1678,195 @@ msgid "" "descendent logger." msgstr "" -#: library/unittest.rst:1176 +#: library/unittest.rst:1186 msgid "" "If given, *level* should be either a numeric logging level or its string " "equivalent (for example either ``\"ERROR\"`` or :const:`logging.ERROR`). " "The default is :const:`logging.INFO`." msgstr "" -#: library/unittest.rst:1139 +#: library/unittest.rst:1149 msgid "" "The test passes if at least one message emitted inside the ``with`` block " "matches the *logger* and *level* conditions, otherwise it fails." msgstr "" -#: library/unittest.rst:1142 +#: library/unittest.rst:1152 msgid "" "The object returned by the context manager is a recording helper which keeps " "tracks of the matching log messages. It has two attributes:" msgstr "" -#: library/unittest.rst:1148 +#: library/unittest.rst:1158 msgid "" "A list of :class:`logging.LogRecord` objects of the matching log messages." msgstr "" -#: library/unittest.rst:1153 +#: library/unittest.rst:1163 msgid "" "A list of :class:`str` objects with the formatted output of matching " "messages." msgstr "" -#: library/unittest.rst:1156 +#: library/unittest.rst:1166 msgid "Example::" msgstr "" #: library/unittest.rst:1168 msgid "" +"with self.assertLogs('foo', level='INFO') as cm:\n" +" logging.getLogger('foo').info('first message')\n" +" logging.getLogger('foo.bar').error('second message')\n" +"self.assertEqual(cm.output, ['INFO:foo:first message',\n" +" 'ERROR:foo.bar:second message'])" +msgstr "" + +#: library/unittest.rst:1178 +msgid "" "A context manager to test that no messages are logged on the *logger* or one " "of its children, with at least the given *level*." msgstr "" -#: library/unittest.rst:1172 +#: library/unittest.rst:1182 msgid "" "If given, *logger* should be a :class:`logging.Logger` object or a :class:" "`str` giving the name of a logger. The default is the root logger, which " "will catch all messages." msgstr "" -#: library/unittest.rst:1180 +#: library/unittest.rst:1190 msgid "" "Unlike :meth:`assertLogs`, nothing will be returned by the context manager." msgstr "" -#: library/unittest.rst:1185 +#: library/unittest.rst:1195 msgid "" "There are also other methods used to perform more specific checks, such as:" msgstr "" -#: library/unittest.rst:1190 +#: library/unittest.rst:1200 msgid ":meth:`assertAlmostEqual(a, b) `" msgstr "" -#: library/unittest.rst:1190 +#: library/unittest.rst:1200 msgid "``round(a-b, 7) == 0``" msgstr "" -#: library/unittest.rst:1193 +#: library/unittest.rst:1203 msgid ":meth:`assertNotAlmostEqual(a, b) `" msgstr "" -#: library/unittest.rst:1193 +#: library/unittest.rst:1203 msgid "``round(a-b, 7) != 0``" msgstr "" -#: library/unittest.rst:1196 +#: library/unittest.rst:1206 msgid ":meth:`assertGreater(a, b) `" msgstr "" -#: library/unittest.rst:1196 +#: library/unittest.rst:1206 msgid "``a > b``" msgstr "" -#: library/unittest.rst:1199 +#: library/unittest.rst:1209 msgid ":meth:`assertGreaterEqual(a, b) `" msgstr "" -#: library/unittest.rst:1199 +#: library/unittest.rst:1209 msgid "``a >= b``" msgstr "" -#: library/unittest.rst:1202 +#: library/unittest.rst:1212 msgid ":meth:`assertLess(a, b) `" msgstr "" -#: library/unittest.rst:1202 +#: library/unittest.rst:1212 msgid "``a < b``" msgstr "" -#: library/unittest.rst:1205 +#: library/unittest.rst:1215 msgid ":meth:`assertLessEqual(a, b) `" msgstr "" -#: library/unittest.rst:1205 +#: library/unittest.rst:1215 msgid "``a <= b``" msgstr "" -#: library/unittest.rst:1208 +#: library/unittest.rst:1218 msgid ":meth:`assertRegex(s, r) `" msgstr "" -#: library/unittest.rst:1208 +#: library/unittest.rst:1218 msgid "``r.search(s)``" msgstr "" -#: library/unittest.rst:1211 +#: library/unittest.rst:1221 msgid ":meth:`assertNotRegex(s, r) `" msgstr "" -#: library/unittest.rst:1211 +#: library/unittest.rst:1221 msgid "``not r.search(s)``" msgstr "" -#: library/unittest.rst:1214 +#: library/unittest.rst:1224 msgid ":meth:`assertCountEqual(a, b) `" msgstr "" -#: library/unittest.rst:1214 +#: library/unittest.rst:1224 msgid "" "*a* and *b* have the same elements in the same number, regardless of their " "order." msgstr "" -#: library/unittest.rst:1223 +#: library/unittest.rst:1228 +msgid ":meth:`assertStartsWith(a, b) `" +msgstr "" + +#: library/unittest.rst:1228 +msgid "``a.startswith(b)``" +msgstr "" + +#: library/unittest.rst:1231 +msgid ":meth:`assertNotStartsWith(a, b) `" +msgstr "" + +#: library/unittest.rst:1231 +msgid "``not a.startswith(b)``" +msgstr "" + +#: library/unittest.rst:1234 +msgid ":meth:`assertEndsWith(a, b) `" +msgstr "" + +#: library/unittest.rst:1234 +msgid "``a.endswith(b)``" +msgstr "" + +#: library/unittest.rst:1237 +msgid ":meth:`assertNotEndsWith(a, b) `" +msgstr "" + +#: library/unittest.rst:1237 +msgid "``not a.endswith(b)``" +msgstr "" + +#: library/unittest.rst:1240 +msgid ":meth:`assertHasAttr(a, b) `" +msgstr "" + +#: library/unittest.rst:1240 +msgid "``hastattr(a, b)``" +msgstr "" + +#: library/unittest.rst:1243 +msgid ":meth:`assertNotHasAttr(a, b) `" +msgstr "" + +#: library/unittest.rst:1243 +msgid "``not hastattr(a, b)``" +msgstr "" + +#: library/unittest.rst:1251 msgid "" "Test that *first* and *second* are approximately (or not approximately) " "equal by computing the difference, rounding to the given number of decimal " @@ -1438,30 +1875,36 @@ msgid "" "`round` function) and not *significant digits*." msgstr "" -#: library/unittest.rst:1229 +#: library/unittest.rst:1257 msgid "" "If *delta* is supplied instead of *places* then the difference between " "*first* and *second* must be less or equal to (or greater than) *delta*." msgstr "" -#: library/unittest.rst:1232 +#: library/unittest.rst:1260 msgid "Supplying both *delta* and *places* raises a :exc:`TypeError`." msgstr "" -#: library/unittest.rst:1234 +#: library/unittest.rst:1262 msgid "" ":meth:`assertAlmostEqual` automatically considers almost equal objects that " "compare equal. :meth:`assertNotAlmostEqual` automatically fails if the " "objects compare equal. Added the *delta* keyword argument." msgstr "" -#: library/unittest.rst:1245 +#: library/unittest.rst:1273 msgid "" "Test that *first* is respectively >, >=, < or <= than *second* depending on " "the method name. If not, the test will fail::" msgstr "" -#: library/unittest.rst:1257 +#: library/unittest.rst:1276 +msgid "" +">>> self.assertGreaterEqual(3, 4)\n" +"AssertionError: \"3\" unexpectedly not greater than or equal to \"4\"" +msgstr "" + +#: library/unittest.rst:1285 msgid "" "Test that a *regex* search matches (or does not match) *text*. In case of " "failure, the error message will include the pattern and the *text* (or the " @@ -1470,28 +1913,28 @@ msgid "" "suitable for use by :func:`re.search`." msgstr "" -#: library/unittest.rst:1263 +#: library/unittest.rst:1291 msgid "Added under the name ``assertRegexpMatches``." msgstr "" -#: library/unittest.rst:1265 +#: library/unittest.rst:1293 msgid "" "The method ``assertRegexpMatches()`` has been renamed to :meth:`." "assertRegex`." msgstr "" -#: library/unittest.rst:1268 +#: library/unittest.rst:1296 msgid ":meth:`.assertNotRegex`." msgstr "" -#: library/unittest.rst:1274 +#: library/unittest.rst:1302 msgid "" "Test that sequence *first* contains the same elements as *second*, " "regardless of their order. When they don't, an error message listing the " "differences between the sequences will be generated." msgstr "" -#: library/unittest.rst:1278 +#: library/unittest.rst:1306 msgid "" "Duplicate elements are *not* ignored when comparing *first* and *second*. It " "verifies whether each element has the same count in both sequences. " @@ -1499,7 +1942,23 @@ msgid "" "but works with sequences of unhashable objects as well." msgstr "" -#: library/unittest.rst:1289 +#: library/unittest.rst:1318 +msgid "" +"Test that the Unicode or byte string *s* starts (or does not start) with a " +"*prefix*. *prefix* can also be a tuple of strings to try." +msgstr "" + +#: library/unittest.rst:1328 +msgid "" +"Test that the Unicode or byte string *s* ends (or does not end) with a " +"*suffix*. *suffix* can also be a tuple of strings to try." +msgstr "" + +#: library/unittest.rst:1338 +msgid "Test that the object *obj* has (or has not) an attribute *name*." +msgstr "" + +#: library/unittest.rst:1345 msgid "" "The :meth:`assertEqual` method dispatches the equality check for objects of " "the same type to different type-specific methods. These methods are already " @@ -1507,7 +1966,7 @@ msgid "" "register new methods using :meth:`addTypeEqualityFunc`:" msgstr "" -#: library/unittest.rst:1296 +#: library/unittest.rst:1352 msgid "" "Registers a type-specific method called by :meth:`assertEqual` to check if " "two objects of exactly the same *typeobj* (not subclasses) compare equal. " @@ -1518,66 +1977,66 @@ msgid "" "explaining the inequalities in details in the error message." msgstr "" -#: library/unittest.rst:1307 +#: library/unittest.rst:1363 msgid "" "The list of type-specific methods automatically used by :meth:`~TestCase." "assertEqual` are summarized in the following table. Note that it's usually " "not necessary to invoke these methods directly." msgstr "" -#: library/unittest.rst:1312 +#: library/unittest.rst:1368 msgid "Used to compare" msgstr "" -#: library/unittest.rst:1314 +#: library/unittest.rst:1370 msgid ":meth:`assertMultiLineEqual(a, b) `" msgstr "" -#: library/unittest.rst:1314 +#: library/unittest.rst:1370 msgid "strings" msgstr "" -#: library/unittest.rst:1317 +#: library/unittest.rst:1373 msgid ":meth:`assertSequenceEqual(a, b) `" msgstr "" -#: library/unittest.rst:1317 +#: library/unittest.rst:1373 msgid "sequences" msgstr "" -#: library/unittest.rst:1320 +#: library/unittest.rst:1376 msgid ":meth:`assertListEqual(a, b) `" msgstr "" -#: library/unittest.rst:1320 +#: library/unittest.rst:1376 msgid "lists" msgstr "" -#: library/unittest.rst:1323 +#: library/unittest.rst:1379 msgid ":meth:`assertTupleEqual(a, b) `" msgstr "" -#: library/unittest.rst:1323 +#: library/unittest.rst:1379 msgid "tuples" msgstr "" -#: library/unittest.rst:1326 +#: library/unittest.rst:1382 msgid ":meth:`assertSetEqual(a, b) `" msgstr "" -#: library/unittest.rst:1326 +#: library/unittest.rst:1382 msgid "sets or frozensets" msgstr "" -#: library/unittest.rst:1329 +#: library/unittest.rst:1385 msgid ":meth:`assertDictEqual(a, b) `" msgstr "" -#: library/unittest.rst:1329 +#: library/unittest.rst:1385 msgid "dicts" msgstr "" -#: library/unittest.rst:1337 +#: library/unittest.rst:1393 msgid "" "Test that the multiline string *first* is equal to the string *second*. When " "not equal a diff of the two strings highlighting the differences will be " @@ -1585,7 +2044,7 @@ msgid "" "strings with :meth:`assertEqual`." msgstr "" -#: library/unittest.rst:1347 +#: library/unittest.rst:1403 msgid "" "Tests that two sequences are equal. If a *seq_type* is supplied, both " "*first* and *second* must be instances of *seq_type* or a failure will be " @@ -1593,13 +2052,13 @@ msgid "" "shows the difference between the two." msgstr "" -#: library/unittest.rst:1352 +#: library/unittest.rst:1408 msgid "" "This method is not called directly by :meth:`assertEqual`, but it's used to " "implement :meth:`assertListEqual` and :meth:`assertTupleEqual`." msgstr "" -#: library/unittest.rst:1362 +#: library/unittest.rst:1418 msgid "" "Tests that two lists or tuples are equal. If not, an error message is " "constructed that shows only the differences between the two. An error is " @@ -1607,38 +2066,38 @@ msgid "" "are used by default when comparing lists or tuples with :meth:`assertEqual`." msgstr "" -#: library/unittest.rst:1373 +#: library/unittest.rst:1429 msgid "" "Tests that two sets are equal. If not, an error message is constructed that " "lists the differences between the sets. This method is used by default when " "comparing sets or frozensets with :meth:`assertEqual`." msgstr "" -#: library/unittest.rst:1377 +#: library/unittest.rst:1433 msgid "" -"Fails if either of *first* or *second* does not have a :meth:`set." +"Fails if either of *first* or *second* does not have a :meth:`~frozenset." "difference` method." msgstr "" -#: library/unittest.rst:1385 +#: library/unittest.rst:1441 msgid "" "Test that two dictionaries are equal. If not, an error message is " "constructed that shows the differences in the dictionaries. This method will " "be used by default to compare dictionaries in calls to :meth:`assertEqual`." msgstr "" -#: library/unittest.rst:1396 +#: library/unittest.rst:1452 msgid "" "Finally the :class:`TestCase` provides the following methods and attributes:" msgstr "" -#: library/unittest.rst:1401 +#: library/unittest.rst:1457 msgid "" "Signals a test failure unconditionally, with *msg* or ``None`` for the error " "message." msgstr "" -#: library/unittest.rst:1407 +#: library/unittest.rst:1463 msgid "" "This class attribute gives the exception raised by the test method. If a " "test framework needs to use a specialized exception, possibly to carry " @@ -1647,7 +2106,7 @@ msgid "" "`AssertionError`." msgstr "" -#: library/unittest.rst:1416 +#: library/unittest.rst:1472 msgid "" "This class attribute determines what happens when a custom failure message " "is passed as the msg argument to an assertXYY call that fails. ``True`` is " @@ -1656,18 +2115,18 @@ msgid "" "replaces the standard message." msgstr "" -#: library/unittest.rst:1422 +#: library/unittest.rst:1478 msgid "" "The class setting can be overridden in individual test methods by assigning " "an instance attribute, self.longMessage, to ``True`` or ``False`` before " "calling the assert methods." msgstr "" -#: library/unittest.rst:1426 +#: library/unittest.rst:1482 msgid "The class setting gets reset before each test call." msgstr "" -#: library/unittest.rst:1433 +#: library/unittest.rst:1489 msgid "" "This attribute controls the maximum length of diffs output by assert methods " "that report diffs on failure. It defaults to 80*8 characters. Assert methods " @@ -1676,52 +2135,52 @@ msgid "" "`assertDictEqual` and :meth:`assertMultiLineEqual`." msgstr "" -#: library/unittest.rst:1440 +#: library/unittest.rst:1496 msgid "" "Setting ``maxDiff`` to ``None`` means that there is no maximum length of " "diffs." msgstr "" -#: library/unittest.rst:1446 +#: library/unittest.rst:1502 msgid "" "Testing frameworks can use the following methods to collect information on " "the test:" msgstr "" -#: library/unittest.rst:1452 +#: library/unittest.rst:1508 msgid "" "Return the number of tests represented by this test object. For :class:" "`TestCase` instances, this will always be ``1``." msgstr "" -#: library/unittest.rst:1458 +#: library/unittest.rst:1514 msgid "" "Return an instance of the test result class that should be used for this " "test case class (if no other result instance is provided to the :meth:`run` " "method)." msgstr "" -#: library/unittest.rst:1462 +#: library/unittest.rst:1518 msgid "" "For :class:`TestCase` instances, this will always be an instance of :class:" "`TestResult`; subclasses of :class:`TestCase` should override this as " "necessary." msgstr "" -#: library/unittest.rst:1469 +#: library/unittest.rst:1525 msgid "" "Return a string identifying the specific test case. This is usually the " "full name of the test method, including the module and class name." msgstr "" -#: library/unittest.rst:1475 +#: library/unittest.rst:1531 msgid "" "Returns a description of the test, or ``None`` if no description has been " "provided. The default implementation of this method returns the first line " "of the test method's docstring, if available, or ``None``." msgstr "" -#: library/unittest.rst:1480 +#: library/unittest.rst:1536 msgid "" "In 3.1 this was changed to add the test name to the short description even " "in the presence of a docstring. This caused compatibility issues with " @@ -1729,7 +2188,7 @@ msgid "" "`TextTestResult` in Python 3.2." msgstr "" -#: library/unittest.rst:1489 +#: library/unittest.rst:1545 msgid "" "Add a function to be called after :meth:`tearDown` to cleanup resources used " "during the test. Functions will be called in reverse order to the order they " @@ -1738,39 +2197,39 @@ msgid "" "added." msgstr "" -#: library/unittest.rst:1495 +#: library/unittest.rst:1551 msgid "" "If :meth:`setUp` fails, meaning that :meth:`tearDown` is not called, then " "any cleanup functions added will still be called." msgstr "" -#: library/unittest.rst:1503 +#: library/unittest.rst:1559 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :meth:`addCleanup` " "and return the result of the :meth:`~object.__enter__` method." msgstr "" -#: library/unittest.rst:1513 +#: library/unittest.rst:1569 msgid "" "This method is called unconditionally after :meth:`tearDown`, or after :meth:" "`setUp` if :meth:`setUp` raises an exception." msgstr "" -#: library/unittest.rst:1516 +#: library/unittest.rst:1572 msgid "" "It is responsible for calling all the cleanup functions added by :meth:" "`addCleanup`. If you need cleanup functions to be called *prior* to :meth:" "`tearDown` then you can call :meth:`doCleanups` yourself." msgstr "" -#: library/unittest.rst:1521 +#: library/unittest.rst:1577 msgid "" ":meth:`doCleanups` pops methods off the stack of cleanup functions one at a " "time, so it can be called at any time." msgstr "" -#: library/unittest.rst:1529 +#: library/unittest.rst:1585 msgid "" "Add a function to be called after :meth:`tearDownClass` to cleanup resources " "used during the test class. Functions will be called in reverse order to the " @@ -1779,13 +2238,13 @@ msgid "" "when they are added." msgstr "" -#: library/unittest.rst:1535 +#: library/unittest.rst:1591 msgid "" "If :meth:`setUpClass` fails, meaning that :meth:`tearDownClass` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: library/unittest.rst:1543 +#: library/unittest.rst:1599 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :meth:" @@ -1793,45 +2252,51 @@ msgid "" "method." msgstr "" -#: library/unittest.rst:1553 +#: library/unittest.rst:1609 msgid "" "This method is called unconditionally after :meth:`tearDownClass`, or after :" "meth:`setUpClass` if :meth:`setUpClass` raises an exception." msgstr "" -#: library/unittest.rst:1556 +#: library/unittest.rst:1612 msgid "" "It is responsible for calling all the cleanup functions added by :meth:" "`addClassCleanup`. If you need cleanup functions to be called *prior* to :" "meth:`tearDownClass` then you can call :meth:`doClassCleanups` yourself." msgstr "" -#: library/unittest.rst:1561 +#: library/unittest.rst:1617 msgid "" ":meth:`doClassCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: library/unittest.rst:1569 +#: library/unittest.rst:1625 msgid "" "This class provides an API similar to :class:`TestCase` and also accepts " "coroutines as test functions." msgstr "" -#: library/unittest.rst:1576 +#: library/unittest.rst:1632 +msgid "" +"The *loop_factory* passed to :class:`asyncio.Runner`. Override in subclasses " +"with :class:`asyncio.EventLoop` to avoid using the asyncio policy system." +msgstr "" + +#: library/unittest.rst:1641 msgid "" "Method called to prepare the test fixture. This is called after :meth:" -"`setUp`. This is called immediately before calling the test method; other " -"than :exc:`AssertionError` or :exc:`SkipTest`, any exception raised by this " -"method will be considered an error rather than a test failure. The default " -"implementation does nothing." +"`TestCase.setUp`. This is called immediately before calling the test method; " +"other than :exc:`AssertionError` or :exc:`SkipTest`, any exception raised by " +"this method will be considered an error rather than a test failure. The " +"default implementation does nothing." msgstr "" -#: library/unittest.rst:1584 +#: library/unittest.rst:1650 msgid "" "Method called immediately after the test method has been called and the " -"result recorded. This is called before :meth:`tearDown`. This is called " -"even if the test method raised an exception, so the implementation in " +"result recorded. This is called before :meth:`~TestCase.tearDown`. This is " +"called even if the test method raised an exception, so the implementation in " "subclasses may need to be particularly careful about checking internal " "state. Any exception, other than :exc:`AssertionError` or :exc:`SkipTest`, " "raised by this method will be considered an additional error rather than a " @@ -1840,11 +2305,11 @@ msgid "" "the outcome of the test method. The default implementation does nothing." msgstr "" -#: library/unittest.rst:1596 +#: library/unittest.rst:1662 msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" -#: library/unittest.rst:1600 +#: library/unittest.rst:1667 msgid "" "Enter the supplied :term:`asynchronous context manager`. If successful, " "also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" @@ -1852,28 +2317,66 @@ msgid "" "method." msgstr "" -#: library/unittest.rst:1610 +#: library/unittest.rst:1677 msgid "" "Sets up a new event loop to run the test, collecting the result into the :" "class:`TestResult` object passed as *result*. If *result* is omitted or " "``None``, a temporary result object is created (by calling the :meth:" -"`defaultTestResult` method) and used. The result object is returned to :meth:" -"`run`'s caller. At the end of the test all the tasks in the event loop are " -"cancelled." +"`~TestCase.defaultTestResult` method) and used. The result object is " +"returned to :meth:`run`'s caller. At the end of the test all the tasks in " +"the event loop are cancelled." msgstr "" -#: library/unittest.rst:1618 +#: library/unittest.rst:1685 msgid "An example illustrating the order::" msgstr "" -#: library/unittest.rst:1654 +#: library/unittest.rst:1687 +msgid "" +"from unittest import IsolatedAsyncioTestCase\n" +"\n" +"events = []\n" +"\n" +"\n" +"class Test(IsolatedAsyncioTestCase):\n" +"\n" +"\n" +" def setUp(self):\n" +" events.append(\"setUp\")\n" +"\n" +" async def asyncSetUp(self):\n" +" self._async_connection = await AsyncConnection()\n" +" events.append(\"asyncSetUp\")\n" +"\n" +" async def test_response(self):\n" +" events.append(\"test_response\")\n" +" response = await self._async_connection.get(\"https://example." +"com\")\n" +" self.assertEqual(response.status_code, 200)\n" +" self.addAsyncCleanup(self.on_cleanup)\n" +"\n" +" def tearDown(self):\n" +" events.append(\"tearDown\")\n" +"\n" +" async def asyncTearDown(self):\n" +" await self._async_connection.close()\n" +" events.append(\"asyncTearDown\")\n" +"\n" +" async def on_cleanup(self):\n" +" events.append(\"cleanup\")\n" +"\n" +"if __name__ == \"__main__\":\n" +" unittest.main()" +msgstr "" + +#: library/unittest.rst:1721 msgid "" "After running the test, ``events`` would contain ``[\"setUp\", " "\"asyncSetUp\", \"test_response\", \"asyncTearDown\", \"tearDown\", " "\"cleanup\"]``." msgstr "" -#: library/unittest.rst:1659 +#: library/unittest.rst:1726 msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " @@ -1882,11 +2385,11 @@ msgid "" "`unittest`-based test framework." msgstr "" -#: library/unittest.rst:1669 +#: library/unittest.rst:1736 msgid "Grouping tests" msgstr "" -#: library/unittest.rst:1673 +#: library/unittest.rst:1740 msgid "" "This class represents an aggregation of individual test cases and test " "suites. The class presents the interface needed by the test runner to allow " @@ -1894,14 +2397,14 @@ msgid "" "is the same as iterating over the suite, running each test individually." msgstr "" -#: library/unittest.rst:1678 +#: library/unittest.rst:1745 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -#: library/unittest.rst:1682 +#: library/unittest.rst:1749 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -1910,47 +2413,47 @@ msgid "" "instances:" msgstr "" -#: library/unittest.rst:1690 +#: library/unittest.rst:1757 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." msgstr "" -#: library/unittest.rst:1695 +#: library/unittest.rst:1762 msgid "" "Add all the tests from an iterable of :class:`TestCase` and :class:" "`TestSuite` instances to this test suite." msgstr "" -#: library/unittest.rst:1698 +#: library/unittest.rst:1765 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -#: library/unittest.rst:1701 +#: library/unittest.rst:1768 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" msgstr "" -#: library/unittest.rst:1706 +#: library/unittest.rst:1773 msgid "" "Run the tests associated with this suite, collecting the result into the " "test result object passed as *result*. Note that unlike :meth:`TestCase." "run`, :meth:`TestSuite.run` requires the result object to be passed in." msgstr "" -#: library/unittest.rst:1714 +#: library/unittest.rst:1781 msgid "" "Run the tests associated with this suite without collecting the result. This " "allows exceptions raised by the test to be propagated to the caller and can " "be used to support running tests under a debugger." msgstr "" -#: library/unittest.rst:1721 +#: library/unittest.rst:1788 msgid "" "Return the number of tests represented by this test object, including all " "individual tests and sub-suites." msgstr "" -#: library/unittest.rst:1727 +#: library/unittest.rst:1794 msgid "" "Tests grouped by a :class:`TestSuite` are always accessed by iteration. " "Subclasses can lazily provide tests by overriding :meth:`!__iter__`. Note " @@ -1959,34 +2462,35 @@ msgid "" "repeated iterations before :meth:`TestSuite.run` must be the same for each " "call iteration. After :meth:`TestSuite.run`, callers should not rely on the " "tests returned by this method unless the caller uses a subclass that " -"overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references." +"overrides :meth:`!TestSuite._removeTestAtIndex` to preserve test references." msgstr "" -#: library/unittest.rst:1737 +#: library/unittest.rst:1804 msgid "" "In earlier versions the :class:`TestSuite` accessed tests directly rather " "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" -#: library/unittest.rst:1742 +#: library/unittest.rst:1809 msgid "" "In earlier versions the :class:`TestSuite` held references to each :class:" "`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " -"by overriding :meth:`TestSuite._removeTestAtIndex`." +"by overriding :meth:`!TestSuite._removeTestAtIndex`." msgstr "" -#: library/unittest.rst:1747 +#: library/unittest.rst:1814 msgid "" "In the typical usage of a :class:`TestSuite` object, the :meth:`run` method " -"is invoked by a :class:`TestRunner` rather than by the end-user test harness." +"is invoked by a :class:`!TestRunner` rather than by the end-user test " +"harness." msgstr "" -#: library/unittest.rst:1752 +#: library/unittest.rst:1819 msgid "Loading and running tests" msgstr "" -#: library/unittest.rst:1756 +#: library/unittest.rst:1823 msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " @@ -1995,11 +2499,11 @@ msgid "" "customization of some configurable properties." msgstr "" -#: library/unittest.rst:1762 +#: library/unittest.rst:1829 msgid ":class:`TestLoader` objects have the following attributes:" msgstr "" -#: library/unittest.rst:1767 +#: library/unittest.rst:1834 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -2007,33 +2511,33 @@ msgid "" "synthetic test that will raise the original error when run." msgstr "" -#: library/unittest.rst:1776 +#: library/unittest.rst:1843 msgid ":class:`TestLoader` objects have the following methods:" msgstr "" -#: library/unittest.rst:1781 +#: library/unittest.rst:1848 msgid "" "Return a suite of all test cases contained in the :class:`TestCase`\\ -" -"derived :class:`testCaseClass`." +"derived :class:`!testCaseClass`." msgstr "" -#: library/unittest.rst:1784 +#: library/unittest.rst:1851 msgid "" "A test case instance is created for each method named by :meth:" "`getTestCaseNames`. By default these are the method names beginning with " -"``test``. If :meth:`getTestCaseNames` returns no methods, but the :meth:" -"`runTest` method is implemented, a single test case is created for that " +"``test``. If :meth:`getTestCaseNames` returns no methods, but the :meth:`!" +"runTest` method is implemented, a single test case is created for that " "method instead." msgstr "" -#: library/unittest.rst:1793 +#: library/unittest.rst:1860 msgid "" "Return a suite of all test cases contained in the given module. This method " "searches *module* for classes derived from :class:`TestCase` and creates an " "instance of the class for each test method defined for the class." msgstr "" -#: library/unittest.rst:1800 +#: library/unittest.rst:1867 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -2042,7 +2546,7 @@ msgid "" "fixtures are different and defined in subclasses." msgstr "" -#: library/unittest.rst:1806 +#: library/unittest.rst:1873 msgid "" "If a module provides a ``load_tests`` function it will be called to load the " "tests. This allows modules to customize test loading. This is the " @@ -2050,24 +2554,24 @@ msgid "" "argument to ``load_tests``." msgstr "" -#: library/unittest.rst:1811 +#: library/unittest.rst:1878 msgid "Support for ``load_tests`` added." msgstr "" -#: library/unittest.rst:1814 +#: library/unittest.rst:1881 msgid "Support for a keyword-only argument *pattern* has been added." msgstr "" -#: library/unittest.rst:1817 +#: library/unittest.rst:1884 msgid "" "The undocumented and unofficial *use_load_tests* parameter has been removed." msgstr "" -#: library/unittest.rst:1824 +#: library/unittest.rst:1891 msgid "Return a suite of all test cases given a string specifier." msgstr "" -#: library/unittest.rst:1826 +#: library/unittest.rst:1893 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " "module, a test case class, a test method within a test case class, a :class:" @@ -2078,44 +2582,44 @@ msgid "" "object\"." msgstr "" -#: library/unittest.rst:1834 +#: library/unittest.rst:1901 msgid "" -"For example, if you have a module :mod:`SampleTests` containing a :class:" -"`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " -"(:meth:`test_one`, :meth:`test_two`, and :meth:`test_three`), the specifier " -"``'SampleTests.SampleTestCase'`` would cause this method to return a suite " -"which will run all three test methods. Using the specifier ``'SampleTests." -"SampleTestCase.test_two'`` would cause it to return a test suite which will " -"run only the :meth:`test_two` test method. The specifier can refer to " -"modules and packages which have not been imported; they will be imported as " -"a side-effect." +"For example, if you have a module :mod:`!SampleTests` containing a :class:" +"`TestCase`\\ -derived class :class:`!SampleTestCase` with three test methods " +"(:meth:`!test_one`, :meth:`!test_two`, and :meth:`!test_three`), the " +"specifier ``'SampleTests.SampleTestCase'`` would cause this method to return " +"a suite which will run all three test methods. Using the specifier " +"``'SampleTests.SampleTestCase.test_two'`` would cause it to return a test " +"suite which will run only the :meth:`!test_two` test method. The specifier " +"can refer to modules and packages which have not been imported; they will be " +"imported as a side-effect." msgstr "" -#: library/unittest.rst:1844 +#: library/unittest.rst:1911 msgid "The method optionally resolves *name* relative to the given *module*." msgstr "" -#: library/unittest.rst:1846 +#: library/unittest.rst:1913 msgid "" "If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing " "*name* then a synthetic test that raises that error when run will be " "returned. These errors are included in the errors accumulated by self.errors." msgstr "" -#: library/unittest.rst:1855 +#: library/unittest.rst:1922 msgid "" "Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather " "than a single name. The return value is a test suite which supports all the " "tests defined for each name." msgstr "" -#: library/unittest.rst:1862 +#: library/unittest.rst:1929 msgid "" "Return a sorted sequence of method names found within *testCaseClass*; this " "should be a subclass of :class:`TestCase`." msgstr "" -#: library/unittest.rst:1868 +#: library/unittest.rst:1935 msgid "" "Find all the test modules by recursing into subdirectories from the " "specified start directory, and return a TestSuite object containing them. " @@ -2124,14 +2628,14 @@ msgid "" "Python identifiers) will be loaded." msgstr "" -#: library/unittest.rst:1874 +#: library/unittest.rst:1941 msgid "" "All test modules must be importable from the top level of the project. If " -"the start directory is not the top level directory then the top level " -"directory must be specified separately." +"the start directory is not the top level directory then *top_level_dir* must " +"be specified separately." msgstr "" -#: library/unittest.rst:1878 +#: library/unittest.rst:1945 msgid "" "If importing a module fails, for example due to a syntax error, then this " "will be recorded as a single error and discovery will continue. If the " @@ -2139,7 +2643,7 @@ msgid "" "as a skip instead of an error." msgstr "" -#: library/unittest.rst:1883 +#: library/unittest.rst:1950 msgid "" "If a package (a directory containing a file named :file:`__init__.py`) is " "found, the package will be checked for a ``load_tests`` function. If this " @@ -2149,94 +2653,107 @@ msgid "" "itself calls ``loader.discover``." msgstr "" -#: library/unittest.rst:1891 +#: library/unittest.rst:1958 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -#: library/unittest.rst:1895 +#: library/unittest.rst:1962 msgid "" "The pattern is deliberately not stored as a loader attribute so that " -"packages can continue discovery themselves. *top_level_dir* is stored so " -"``load_tests`` does not need to pass this argument in to ``loader." -"discover()``." +"packages can continue discovery themselves." +msgstr "" + +#: library/unittest.rst:1965 +msgid "" +"*top_level_dir* is stored internally, and used as a default to any nested " +"calls to ``discover()``. That is, if a package's ``load_tests`` calls " +"``loader.discover()``, it does not need to pass this argument." msgstr "" -#: library/unittest.rst:1900 +#: library/unittest.rst:1969 msgid "*start_dir* can be a dotted module name as well as a directory." msgstr "" -#: library/unittest.rst:1904 +#: library/unittest.rst:1973 msgid "" "Modules that raise :exc:`SkipTest` on import are recorded as skips, not " "errors." msgstr "" -#: library/unittest.rst:1908 +#: library/unittest.rst:1977 msgid "*start_dir* can be a :term:`namespace packages `." msgstr "" -#: library/unittest.rst:1911 +#: library/unittest.rst:1979 msgid "" "Paths are sorted before being imported so that execution order is the same " "even if the underlying file system's ordering is not dependent on file name." msgstr "" -#: library/unittest.rst:1916 +#: library/unittest.rst:1983 msgid "" "Found packages are now checked for ``load_tests`` regardless of whether " "their path matches *pattern*, because it is impossible for a package name to " "match the default pattern." msgstr "" -#: library/unittest.rst:1921 +#: library/unittest.rst:1988 msgid "" "*start_dir* can not be a :term:`namespace packages `. It " -"has been broken since Python 3.7 and Python 3.11 officially remove it." +"has been broken since Python 3.7, and Python 3.11 officially removes it." +msgstr "" + +#: library/unittest.rst:1992 +msgid "*top_level_dir* is only stored for the duration of *discover* call." +msgstr "" + +#: library/unittest.rst:1995 +msgid "*start_dir* can once again be a :term:`namespace package`." msgstr "" -#: library/unittest.rst:1926 +#: library/unittest.rst:1998 msgid "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -#: library/unittest.rst:1932 +#: library/unittest.rst:2004 msgid "" "String giving the prefix of method names which will be interpreted as test " "methods. The default value is ``'test'``." msgstr "" -#: library/unittest.rst:1935 +#: library/unittest.rst:2007 msgid "" "This affects :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: library/unittest.rst:1941 +#: library/unittest.rst:2013 msgid "" "Function to be used to compare method names when sorting them in :meth:" "`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: library/unittest.rst:1947 +#: library/unittest.rst:2019 msgid "" "Callable object that constructs a test suite from a list of tests. No " "methods on the resulting object are needed. The default value is the :class:" "`TestSuite` class." msgstr "" -#: library/unittest.rst:1964 +#: library/unittest.rst:2036 msgid "This affects all the ``loadTestsFrom*`` methods." msgstr "" -#: library/unittest.rst:1955 +#: library/unittest.rst:2027 msgid "" "List of Unix shell-style wildcard test name patterns that test methods have " "to match to be included in test suites (see ``-k`` option)." msgstr "" -#: library/unittest.rst:1958 +#: library/unittest.rst:2030 msgid "" "If this attribute is not ``None`` (the default), all test methods to be " "included in test suites must match one of the patterns in this list. Note " @@ -2245,13 +2762,13 @@ msgid "" "have to be converted using ``*`` wildcards." msgstr "" -#: library/unittest.rst:1971 +#: library/unittest.rst:2043 msgid "" "This class is used to compile information about which tests have succeeded " "and which have failed." msgstr "" -#: library/unittest.rst:1974 +#: library/unittest.rst:2046 msgid "" "A :class:`TestResult` object stores the results of a set of tests. The :" "class:`TestCase` and :class:`TestSuite` classes ensure that results are " @@ -2259,69 +2776,69 @@ msgid "" "outcome of tests." msgstr "" -#: library/unittest.rst:1979 +#: library/unittest.rst:2051 msgid "" "Testing frameworks built on top of :mod:`unittest` may want access to the :" "class:`TestResult` object generated by running a set of tests for reporting " -"purposes; a :class:`TestResult` instance is returned by the :meth:" -"`TestRunner.run` method for this purpose." +"purposes; a :class:`TestResult` instance is returned by the :meth:`!" +"TestRunner.run` method for this purpose." msgstr "" -#: library/unittest.rst:1984 +#: library/unittest.rst:2056 msgid "" ":class:`TestResult` instances have the following attributes that will be of " "interest when inspecting the results of running a set of tests:" msgstr "" -#: library/unittest.rst:1990 +#: library/unittest.rst:2062 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test which raised an " "unexpected exception." msgstr "" -#: library/unittest.rst:1996 +#: library/unittest.rst:2068 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :ref:`assert\\* methods `." msgstr "" -#: library/unittest.rst:2002 +#: library/unittest.rst:2074 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding the reason for skipping the test." msgstr "" -#: library/unittest.rst:2009 +#: library/unittest.rst:2081 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents an expected failure or " "error of the test case." msgstr "" -#: library/unittest.rst:2015 +#: library/unittest.rst:2087 msgid "" "A list containing :class:`TestCase` instances that were marked as expected " "failures, but succeeded." msgstr "" -#: library/unittest.rst:2020 +#: library/unittest.rst:2092 msgid "" "A list containing 2-tuples of test case names and floats representing the " "elapsed time of each test which was run." msgstr "" -#: library/unittest.rst:2027 +#: library/unittest.rst:2099 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." msgstr "" -#: library/unittest.rst:2031 +#: library/unittest.rst:2103 msgid "The total number of tests run so far." msgstr "" -#: library/unittest.rst:2035 +#: library/unittest.rst:2107 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -2330,45 +2847,45 @@ msgid "" "error message." msgstr "" -#: library/unittest.rst:2044 +#: library/unittest.rst:2116 msgid "" "If set to true :meth:`stop` will be called on the first failure or error, " "halting the test run." msgstr "" -#: library/unittest.rst:2051 +#: library/unittest.rst:2123 msgid "If set to true then local variables will be shown in tracebacks." msgstr "" -#: library/unittest.rst:2057 +#: library/unittest.rst:2129 msgid "" "Return ``True`` if all tests run so far have passed, otherwise returns " "``False``." msgstr "" -#: library/unittest.rst:2060 +#: library/unittest.rst:2132 msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -#: library/unittest.rst:2066 +#: library/unittest.rst:2138 msgid "" "This method can be called to signal that the set of tests being run should " -"be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" -"`TestRunner` objects should respect this flag and return without running any " +"be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:`!" +"TestRunner` objects should respect this flag and return without running any " "additional tests." msgstr "" -#: library/unittest.rst:2071 +#: library/unittest.rst:2143 msgid "" "For example, this feature is used by the :class:`TextTestRunner` class to " "stop the test framework when the user signals an interrupt from the " -"keyboard. Interactive tools which provide :class:`TestRunner` " +"keyboard. Interactive tools which provide :class:`!TestRunner` " "implementations can use this in a similar manner." msgstr "" -#: library/unittest.rst:2076 +#: library/unittest.rst:2148 msgid "" "The following methods of the :class:`TestResult` class are used to maintain " "the internal data structures, and may be extended in subclasses to support " @@ -2376,141 +2893,141 @@ msgid "" "tools which support interactive reporting while tests are being run." msgstr "" -#: library/unittest.rst:2084 +#: library/unittest.rst:2156 msgid "Called when the test case *test* is about to be run." msgstr "" -#: library/unittest.rst:2088 +#: library/unittest.rst:2160 msgid "" "Called after the test case *test* has been executed, regardless of the " "outcome." msgstr "" -#: library/unittest.rst:2093 +#: library/unittest.rst:2165 msgid "Called once before any tests are executed." msgstr "" -#: library/unittest.rst:2100 +#: library/unittest.rst:2172 msgid "Called once after all tests are executed." msgstr "" -#: library/unittest.rst:2107 +#: library/unittest.rst:2179 msgid "" "Called when the test case *test* raises an unexpected exception. *err* is a " "tuple of the form returned by :func:`sys.exc_info`: ``(type, value, " "traceback)``." msgstr "" -#: library/unittest.rst:2111 +#: library/unittest.rst:2183 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: library/unittest.rst:2118 +#: library/unittest.rst:2190 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: library/unittest.rst:2121 +#: library/unittest.rst:2193 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: library/unittest.rst:2128 +#: library/unittest.rst:2200 msgid "Called when the test case *test* succeeds." msgstr "" -#: library/unittest.rst:2130 +#: library/unittest.rst:2202 msgid "The default implementation does nothing." msgstr "" -#: library/unittest.rst:2135 +#: library/unittest.rst:2207 msgid "" "Called when the test case *test* is skipped. *reason* is the reason the " "test gave for skipping." msgstr "" -#: library/unittest.rst:2138 +#: library/unittest.rst:2210 msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -#: library/unittest.rst:2144 +#: library/unittest.rst:2216 msgid "" "Called when the test case *test* fails or errors, but was marked with the :" "func:`expectedFailure` decorator." msgstr "" -#: library/unittest.rst:2147 +#: library/unittest.rst:2219 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -#: library/unittest.rst:2154 +#: library/unittest.rst:2226 msgid "" "Called when the test case *test* was marked with the :func:`expectedFailure` " "decorator, but succeeded." msgstr "" -#: library/unittest.rst:2157 +#: library/unittest.rst:2229 msgid "" "The default implementation appends the test to the instance's :attr:" "`unexpectedSuccesses` attribute." msgstr "" -#: library/unittest.rst:2163 +#: library/unittest.rst:2235 msgid "" "Called when a subtest finishes. *test* is the test case corresponding to " "the test method. *subtest* is a custom :class:`TestCase` instance " "describing the subtest." msgstr "" -#: library/unittest.rst:2167 +#: library/unittest.rst:2239 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " "with an exception where *outcome* is a tuple of the form returned by :func:" "`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: library/unittest.rst:2171 +#: library/unittest.rst:2243 msgid "" "The default implementation does nothing when the outcome is a success, and " "records subtest failures as normal failures." msgstr "" -#: library/unittest.rst:2178 +#: library/unittest.rst:2250 msgid "" "Called when the test case finishes. *elapsed* is the time represented in " "seconds, and it includes the execution of cleanup functions." msgstr "" -#: library/unittest.rst:2185 +#: library/unittest.rst:2257 msgid "" "A concrete implementation of :class:`TestResult` used by the :class:" "`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " "compatibility as the interface changes." msgstr "" -#: library/unittest.rst:2191 +#: library/unittest.rst:2263 msgid "Added the *durations* keyword parameter." msgstr "" -#: library/unittest.rst:2196 +#: library/unittest.rst:2268 msgid "" "Instance of the :class:`TestLoader` class intended to be shared. If no " "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -#: library/unittest.rst:2205 +#: library/unittest.rst:2277 msgid "" "A basic test runner implementation that outputs results to a stream. If " "*stream* is ``None``, the default, :data:`sys.stderr` is used as the output " @@ -2521,7 +3038,7 @@ msgid "" "unittest." msgstr "" -#: library/unittest.rst:2212 +#: library/unittest.rst:2284 msgid "" "By default this runner shows :exc:`DeprecationWarning`, :exc:" "`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " @@ -2531,32 +3048,32 @@ msgid "" "``None``." msgstr "" -#: library/unittest.rst:2220 +#: library/unittest.rst:2292 msgid "Added the *warnings* parameter." msgstr "" -#: library/unittest.rst:2223 +#: library/unittest.rst:2295 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -#: library/unittest.rst:2227 +#: library/unittest.rst:2299 msgid "Added the *tb_locals* parameter." msgstr "" -#: library/unittest.rst:2230 +#: library/unittest.rst:2302 msgid "Added the *durations* parameter." msgstr "" -#: library/unittest.rst:2235 +#: library/unittest.rst:2307 msgid "" "This method returns the instance of ``TestResult`` used by :meth:`run`. It " "is not intended to be called directly, but can be overridden in subclasses " "to provide a custom ``TestResult``." msgstr "" -#: library/unittest.rst:2239 +#: library/unittest.rst:2311 msgid "" "``_makeResult()`` instantiates the class or callable passed in the " "``TextTestRunner`` constructor as the ``resultclass`` argument. It defaults " @@ -2564,7 +3081,11 @@ msgid "" "class is instantiated with the following arguments::" msgstr "" -#: library/unittest.rst:2248 +#: library/unittest.rst:2316 +msgid "stream, descriptions, verbosity" +msgstr "" + +#: library/unittest.rst:2320 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " "method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" @@ -2572,7 +3093,7 @@ msgid "" "run and the results printed to stdout." msgstr "" -#: library/unittest.rst:2259 +#: library/unittest.rst:2331 msgid "" "A command-line program that loads a set of tests from *module* and runs " "them; this is primarily for making test modules conveniently executable. The " @@ -2580,13 +3101,25 @@ msgid "" "of a test script::" msgstr "" -#: library/unittest.rst:2267 +#: library/unittest.rst:2336 +msgid "" +"if __name__ == '__main__':\n" +" unittest.main()" +msgstr "" + +#: library/unittest.rst:2339 msgid "" "You can run tests with more detailed information by passing in the verbosity " "argument::" msgstr "" -#: library/unittest.rst:2273 +#: library/unittest.rst:2342 +msgid "" +"if __name__ == '__main__':\n" +" unittest.main(verbosity=2)" +msgstr "" + +#: library/unittest.rst:2345 msgid "" "The *defaultTest* argument is either the name of a single test or an " "iterable of test names to run if no test names are specified via *argv*. If " @@ -2594,14 +3127,14 @@ msgid "" "tests found in *module* are run." msgstr "" -#: library/unittest.rst:2278 +#: library/unittest.rst:2350 msgid "" "The *argv* argument can be a list of options passed to the program, with the " "first element being the program name. If not specified or ``None``, the " "values of :data:`sys.argv` are used." msgstr "" -#: library/unittest.rst:2282 +#: library/unittest.rst:2354 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " @@ -2609,26 +3142,32 @@ msgid "" "code of 5 indicates that no tests were run or skipped." msgstr "" -#: library/unittest.rst:2287 +#: library/unittest.rst:2359 msgid "" "The *testLoader* argument has to be a :class:`TestLoader` instance, and " "defaults to :data:`defaultTestLoader`." msgstr "" -#: library/unittest.rst:2290 +#: library/unittest.rst:2362 msgid "" "``main`` supports being used from the interactive interpreter by passing in " "the argument ``exit=False``. This displays the result on standard output " "without calling :func:`sys.exit`::" msgstr "" -#: library/unittest.rst:2297 +#: library/unittest.rst:2366 +msgid "" +">>> from unittest import main\n" +">>> main(module='test_module', exit=False)" +msgstr "" + +#: library/unittest.rst:2369 msgid "" "The *failfast*, *catchbreak* and *buffer* parameters have the same effect as " "the same-name `command-line options`_." msgstr "" -#: library/unittest.rst:2300 +#: library/unittest.rst:2372 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -2637,56 +3176,60 @@ msgid "" "to ``'default'``." msgstr "" -#: library/unittest.rst:2306 +#: library/unittest.rst:2378 msgid "" -"Calling ``main`` actually returns an instance of the ``TestProgram`` class. " -"This stores the result of the tests run as the ``result`` attribute." +"Calling ``main`` returns an object with the ``result`` attribute that " +"contains the result of the tests run as a :class:`unittest.TestResult`." msgstr "" -#: library/unittest.rst:2309 +#: library/unittest.rst:2381 msgid "The *exit* parameter was added." msgstr "" -#: library/unittest.rst:2312 +#: library/unittest.rst:2384 msgid "" "The *verbosity*, *failfast*, *catchbreak*, *buffer* and *warnings* " "parameters were added." msgstr "" -#: library/unittest.rst:2316 +#: library/unittest.rst:2388 msgid "" "The *defaultTest* parameter was changed to also accept an iterable of test " "names." msgstr "" -#: library/unittest.rst:2324 +#: library/unittest.rst:2396 msgid "load_tests Protocol" msgstr "" -#: library/unittest.rst:2328 +#: library/unittest.rst:2400 msgid "" "Modules or packages can customize how tests are loaded from them during " "normal test runs or test discovery by implementing a function called " "``load_tests``." msgstr "" -#: library/unittest.rst:2331 +#: library/unittest.rst:2403 msgid "" "If a test module defines ``load_tests`` it will be called by :meth:" "`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -#: library/unittest.rst:2336 +#: library/unittest.rst:2438 +msgid "load_tests(loader, standard_tests, pattern)" +msgstr "" + +#: library/unittest.rst:2408 msgid "" "where *pattern* is passed straight through from ``loadTestsFromModule``. It " "defaults to ``None``." msgstr "" -#: library/unittest.rst:2339 +#: library/unittest.rst:2411 msgid "It should return a :class:`TestSuite`." msgstr "" -#: library/unittest.rst:2341 +#: library/unittest.rst:2413 msgid "" "*loader* is the instance of :class:`TestLoader` doing the loading. " "*standard_tests* are the tests that would be loaded by default from the " @@ -2695,13 +3238,25 @@ msgid "" "packages as part of test discovery." msgstr "" -#: library/unittest.rst:2347 +#: library/unittest.rst:2419 msgid "" "A typical ``load_tests`` function that loads tests from a specific set of :" "class:`TestCase` classes may look like::" msgstr "" -#: library/unittest.rst:2359 +#: library/unittest.rst:2422 +msgid "" +"test_cases = (TestCase1, TestCase2, TestCase3)\n" +"\n" +"def load_tests(loader, tests, pattern):\n" +" suite = TestSuite()\n" +" for test_class in test_cases:\n" +" tests = loader.loadTestsFromTestCase(test_class)\n" +" suite.addTests(tests)\n" +" return suite" +msgstr "" + +#: library/unittest.rst:2431 msgid "" "If discovery is started in a directory containing a package, either from the " "command line or by calling :meth:`TestLoader.discover`, then the package :" @@ -2711,59 +3266,69 @@ msgid "" "left up to ``load_tests`` which is called with the following arguments::" msgstr "" -#: library/unittest.rst:2368 +#: library/unittest.rst:2440 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " "package. (``standard_tests`` will only contain tests collected from :file:" "`__init__.py`.)" msgstr "" -#: library/unittest.rst:2372 +#: library/unittest.rst:2444 msgid "" "Because the pattern is passed into ``load_tests`` the package is free to " "continue (and potentially modify) test discovery. A 'do nothing' " "``load_tests`` function for a test package would look like::" msgstr "" -#: library/unittest.rst:2383 +#: library/unittest.rst:2448 +msgid "" +"def load_tests(loader, standard_tests, pattern):\n" +" # top level directory cached on loader instance\n" +" this_dir = os.path.dirname(__file__)\n" +" package_tests = loader.discover(start_dir=this_dir, pattern=pattern)\n" +" standard_tests.addTests(package_tests)\n" +" return standard_tests" +msgstr "" + +#: library/unittest.rst:2455 msgid "" "Discovery no longer checks package names for matching *pattern* due to the " "impossibility of package names matching the default pattern." msgstr "" -#: library/unittest.rst:2390 +#: library/unittest.rst:2462 msgid "Class and Module Fixtures" msgstr "" -#: library/unittest.rst:2392 +#: library/unittest.rst:2464 msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " -"the test suite encounters a test from a new class then :meth:`tearDownClass` " -"from the previous class (if there is one) is called, followed by :meth:" -"`setUpClass` from the new class." +"the test suite encounters a test from a new class then :meth:`~TestCase." +"tearDownClass` from the previous class (if there is one) is called, followed " +"by :meth:`~TestCase.setUpClass` from the new class." msgstr "" -#: library/unittest.rst:2397 +#: library/unittest.rst:2469 msgid "" "Similarly if a test is from a different module from the previous test then " "``tearDownModule`` from the previous module is run, followed by " "``setUpModule`` from the new module." msgstr "" -#: library/unittest.rst:2401 +#: library/unittest.rst:2473 msgid "" "After all the tests have run the final ``tearDownClass`` and " "``tearDownModule`` are run." msgstr "" -#: library/unittest.rst:2404 +#: library/unittest.rst:2476 msgid "" "Note that shared fixtures do not play well with [potential] features like " "test parallelization and they break test isolation. They should be used with " "care." msgstr "" -#: library/unittest.rst:2407 +#: library/unittest.rst:2479 msgid "" "The default ordering of tests created by the unittest test loaders is to " "group all tests from the same modules and classes together. This will lead " @@ -2773,14 +3338,14 @@ msgid "" "functions may be called multiple times in a single test run." msgstr "" -#: library/unittest.rst:2414 +#: library/unittest.rst:2486 msgid "" "Shared fixtures are not intended to work with suites with non-standard " "ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to " "support shared fixtures." msgstr "" -#: library/unittest.rst:2418 +#: library/unittest.rst:2490 msgid "" "If there are any exceptions raised during one of the shared fixture " "functions the test is reported as an error. Because there is no " @@ -2790,22 +3355,36 @@ msgid "" "matter, but if you are a framework author it may be relevant." msgstr "" -#: library/unittest.rst:2427 +#: library/unittest.rst:2499 msgid "setUpClass and tearDownClass" msgstr "" -#: library/unittest.rst:2429 +#: library/unittest.rst:2501 msgid "These must be implemented as class methods::" msgstr "" -#: library/unittest.rst:2442 +#: library/unittest.rst:2503 +msgid "" +"import unittest\n" +"\n" +"class Test(unittest.TestCase):\n" +" @classmethod\n" +" def setUpClass(cls):\n" +" cls._connection = createExpensiveConnectionObject()\n" +"\n" +" @classmethod\n" +" def tearDownClass(cls):\n" +" cls._connection.destroy()" +msgstr "" + +#: library/unittest.rst:2514 msgid "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " "then you must call up to them yourself. The implementations in :class:" "`TestCase` are empty." msgstr "" -#: library/unittest.rst:2446 +#: library/unittest.rst:2518 msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " @@ -2814,15 +3393,24 @@ msgid "" "instead of as an error." msgstr "" -#: library/unittest.rst:2454 +#: library/unittest.rst:2526 msgid "setUpModule and tearDownModule" msgstr "" -#: library/unittest.rst:2456 +#: library/unittest.rst:2532 msgid "These should be implemented as functions::" msgstr "" -#: library/unittest.rst:2464 +#: library/unittest.rst:2534 +msgid "" +"def setUpModule():\n" +" createConnection()\n" +"\n" +"def tearDownModule():\n" +" closeConnection()" +msgstr "" + +#: library/unittest.rst:2540 msgid "" "If an exception is raised in a ``setUpModule`` then none of the tests in the " "module will be run and the ``tearDownModule`` will not be run. If the " @@ -2830,13 +3418,13 @@ msgid "" "having been skipped instead of as an error." msgstr "" -#: library/unittest.rst:2469 +#: library/unittest.rst:2545 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" -#: library/unittest.rst:2475 +#: library/unittest.rst:2551 msgid "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " @@ -2845,13 +3433,13 @@ msgid "" "`addModuleCleanup` when they are added." msgstr "" -#: library/unittest.rst:2481 +#: library/unittest.rst:2557 msgid "" "If :meth:`setUpModule` fails, meaning that :func:`tearDownModule` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: library/unittest.rst:2489 +#: library/unittest.rst:2565 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :func:" @@ -2859,40 +3447,40 @@ msgid "" "method." msgstr "" -#: library/unittest.rst:2499 +#: library/unittest.rst:2575 msgid "" "This function is called unconditionally after :func:`tearDownModule`, or " "after :func:`setUpModule` if :func:`setUpModule` raises an exception." msgstr "" -#: library/unittest.rst:2502 +#: library/unittest.rst:2578 msgid "" "It is responsible for calling all the cleanup functions added by :func:" "`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" "func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." msgstr "" -#: library/unittest.rst:2507 +#: library/unittest.rst:2583 msgid "" ":func:`doModuleCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: library/unittest.rst:2514 +#: library/unittest.rst:2590 msgid "Signal Handling" msgstr "" -#: library/unittest.rst:2518 +#: library/unittest.rst:2594 msgid "" "The :option:`-c/--catch ` command-line option to unittest, " -"along with the ``catchbreak`` parameter to :func:`unittest.main()`, provide " +"along with the ``catchbreak`` parameter to :func:`unittest.main`, provide " "more friendly handling of control-C during a test run. With catch break " "behavior enabled control-C will allow the currently running test to " "complete, and the test run will then end and report all the results so far. " "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" -#: library/unittest.rst:2525 +#: library/unittest.rst:2601 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " @@ -2904,43 +3492,50 @@ msgid "" "disabled the :func:`removeHandler` decorator can be used." msgstr "" -#: library/unittest.rst:2534 +#: library/unittest.rst:2610 msgid "" "There are a few utility functions for framework authors to enable control-c " "handling functionality within test frameworks." msgstr "" -#: library/unittest.rst:2539 +#: library/unittest.rst:2615 msgid "" "Install the control-c handler. When a :const:`signal.SIGINT` is received " "(usually in response to the user pressing control-c) all registered results " "have :meth:`~TestResult.stop` called." msgstr "" -#: library/unittest.rst:2546 +#: library/unittest.rst:2622 msgid "" "Register a :class:`TestResult` object for control-c handling. Registering a " "result stores a weak reference to it, so it doesn't prevent the result from " "being garbage collected." msgstr "" -#: library/unittest.rst:2550 +#: library/unittest.rst:2626 msgid "" "Registering a :class:`TestResult` object has no side-effects if control-c " "handling is not enabled, so test frameworks can unconditionally register all " "results they create independently of whether or not handling is enabled." msgstr "" -#: library/unittest.rst:2557 +#: library/unittest.rst:2633 msgid "" "Remove a registered result. Once a result has been removed then :meth:" "`~TestResult.stop` will no longer be called on that result object in " "response to a control-c." msgstr "" -#: library/unittest.rst:2564 +#: library/unittest.rst:2640 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " "temporarily remove the handler while the test is being executed::" msgstr "" + +#: library/unittest.rst:2644 +msgid "" +"@unittest.removeHandler\n" +"def test_signal_handling(self):\n" +" ..." +msgstr "" diff --git a/library/unix.po b/library/unix.po index 1fef186a..37bab3e7 100644 --- a/library/unix.po +++ b/library/unix.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/unix.rst:5 -msgid "Unix Specific Services" +msgid "Unix-specific services" msgstr "" #: library/unix.rst:7 diff --git a/library/urllib.error.po b/library/urllib.error.po index 3bba9d1a..4e0e0d45 100644 --- a/library/urllib.error.po +++ b/library/urllib.error.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/urllib.error.rst:2 -msgid ":mod:`urllib.error` --- Exception classes raised by urllib.request" +msgid ":mod:`!urllib.error` --- Exception classes raised by urllib.request" msgstr "" #: library/urllib.error.rst:10 diff --git a/library/urllib.parse.po b/library/urllib.parse.po index 73d5725e..82f50a10 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/urllib.parse.rst:2 -msgid ":mod:`urllib.parse` --- Parse URLs into components" +msgid ":mod:`!urllib.parse` --- Parse URLs into components" msgstr "" #: library/urllib.parse.rst:7 @@ -36,30 +37,47 @@ msgstr "" msgid "" "The module has been designed to match the internet RFC on Relative Uniform " "Resource Locators. It supports the following URL schemes: ``file``, ``ftp``, " -"``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``mailto``, ``mms``, " -"``news``, ``nntp``, ``prospero``, ``rsync``, ``rtsp``, ``rtsps``, ``rtspu``, " -"``sftp``, ``shttp``, ``sip``, ``sips``, ``snews``, ``svn``, ``svn+ssh``, " -"``telnet``, ``wais``, ``ws``, ``wss``." +"``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``itms-services``, " +"``mailto``, ``mms``, ``news``, ``nntp``, ``prospero``, ``rsync``, ``rtsp``, " +"``rtsps``, ``rtspu``, ``sftp``, ``shttp``, ``sip``, ``sips``, ``snews``, " +"``svn``, ``svn+ssh``, ``telnet``, ``wais``, ``ws``, ``wss``." msgstr "" -#: library/urllib.parse.rst:30 +#: library/urllib.parse.rst:32 +msgid "" +"The inclusion of the ``itms-services`` URL scheme can prevent an app from " +"passing Apple's App Store review process for the macOS and iOS App Stores. " +"Handling for the ``itms-services`` scheme is always removed on iOS; on " +"macOS, it *may* be removed if CPython has been built with the :option:`--" +"with-app-store-compliance` option." +msgstr "" + +#: library/urllib.parse.rst:38 msgid "" "The :mod:`urllib.parse` module defines functions that fall into two broad " "categories: URL parsing and URL quoting. These are covered in detail in the " "following sections." msgstr "" -#: library/urllib.parse.rst:35 +#: library/urllib.parse.rst:42 +msgid "" +"This module's functions use the deprecated term ``netloc`` (or ``net_loc``), " +"which was introduced in :rfc:`1808`. However, this term has been obsoleted " +"by :rfc:`3986`, which introduced the term ``authority`` as its replacement. " +"The use of ``netloc`` is continued for backward compatibility." +msgstr "" + +#: library/urllib.parse.rst:48 msgid "URL Parsing" msgstr "" -#: library/urllib.parse.rst:37 +#: library/urllib.parse.rst:50 msgid "" "The URL parsing functions focus on splitting a URL string into its " "components, or on combining URL components into a URL string." msgstr "" -#: library/urllib.parse.rst:42 +#: library/urllib.parse.rst:55 msgid "" "Parse a URL into six components, returning a 6-item :term:`named tuple`. " "This corresponds to the general structure of a URL: ``scheme://netloc/path;" @@ -70,14 +88,54 @@ msgid "" "slash in the *path* component, which is retained if present. For example:" msgstr "" -#: library/urllib.parse.rst:75 +#: library/urllib.parse.rst:64 +msgid "" +">>> from urllib.parse import urlparse\n" +">>> urlparse(\"scheme://netloc/path;parameters?query#fragment\")\n" +"ParseResult(scheme='scheme', netloc='netloc', path='/path;parameters', " +"params='',\n" +" query='query', fragment='fragment')\n" +">>> o = urlparse(\"http://docs.python.org:80/3/library/urllib.parse.html?\"\n" +"... \"highlight=params#url-parsing\")\n" +">>> o\n" +"ParseResult(scheme='http', netloc='docs.python.org:80',\n" +" path='/3/library/urllib.parse.html', params='',\n" +" query='highlight=params', fragment='url-parsing')\n" +">>> o.scheme\n" +"'http'\n" +">>> o.netloc\n" +"'docs.python.org:80'\n" +">>> o.hostname\n" +"'docs.python.org'\n" +">>> o.port\n" +"80\n" +">>> o._replace(fragment=\"\").geturl()\n" +"'http://docs.python.org:80/3/library/urllib.parse.html?highlight=params'" +msgstr "" + +#: library/urllib.parse.rst:88 msgid "" "Following the syntax specifications in :rfc:`1808`, urlparse recognizes a " "netloc only if it is properly introduced by '//'. Otherwise the input is " "presumed to be a relative URL and thus to start with a path component." msgstr "" -#: library/urllib.parse.rst:94 +#: library/urllib.parse.rst:93 +msgid "" +">>> from urllib.parse import urlparse\n" +">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" +" params='', query='', fragment='')\n" +">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" +"ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" +" params='', query='', fragment='')\n" +">>> urlparse('help/Python.html')\n" +"ParseResult(scheme='', netloc='', path='help/Python.html', params='',\n" +" query='', fragment='')" +msgstr "" + +#: library/urllib.parse.rst:107 msgid "" "The *scheme* argument gives the default addressing scheme, to be used only " "if the URL does not specify one. It should be the same type (text or bytes) " @@ -85,7 +143,7 @@ msgid "" "is automatically converted to ``b''`` if appropriate." msgstr "" -#: library/urllib.parse.rst:99 +#: library/urllib.parse.rst:112 msgid "" "If the *allow_fragments* argument is false, fragment identifiers are not " "recognized. Instead, they are parsed as part of the path, parameters or " @@ -93,161 +151,161 @@ msgid "" "return value." msgstr "" -#: library/urllib.parse.rst:104 +#: library/urllib.parse.rst:117 msgid "" "The return value is a :term:`named tuple`, which means that its items can be " "accessed by index or as named attributes, which are:" msgstr "" -#: library/urllib.parse.rst:297 library/urllib.parse.rst:410 +#: library/urllib.parse.rst:314 library/urllib.parse.rst:436 msgid "Attribute" msgstr "" -#: library/urllib.parse.rst:297 library/urllib.parse.rst:410 +#: library/urllib.parse.rst:314 library/urllib.parse.rst:436 msgid "Index" msgstr "" -#: library/urllib.parse.rst:297 library/urllib.parse.rst:410 +#: library/urllib.parse.rst:314 library/urllib.parse.rst:436 msgid "Value" msgstr "" -#: library/urllib.parse.rst:297 library/urllib.parse.rst:410 +#: library/urllib.parse.rst:314 library/urllib.parse.rst:436 msgid "Value if not present" msgstr "" -#: library/urllib.parse.rst:299 +#: library/urllib.parse.rst:316 msgid ":attr:`scheme`" msgstr "" -#: library/urllib.parse.rst:299 library/urllib.parse.rst:412 +#: library/urllib.parse.rst:316 library/urllib.parse.rst:438 msgid "0" msgstr "" -#: library/urllib.parse.rst:299 +#: library/urllib.parse.rst:316 msgid "URL scheme specifier" msgstr "" -#: library/urllib.parse.rst:299 +#: library/urllib.parse.rst:316 msgid "*scheme* parameter" msgstr "" -#: library/urllib.parse.rst:301 +#: library/urllib.parse.rst:318 msgid ":attr:`netloc`" msgstr "" -#: library/urllib.parse.rst:301 library/urllib.parse.rst:414 +#: library/urllib.parse.rst:318 library/urllib.parse.rst:440 msgid "1" msgstr "" -#: library/urllib.parse.rst:301 +#: library/urllib.parse.rst:318 msgid "Network location part" msgstr "" -#: library/urllib.parse.rst:114 library/urllib.parse.rst:119 -#: library/urllib.parse.rst:301 library/urllib.parse.rst:305 -#: library/urllib.parse.rst:412 library/urllib.parse.rst:414 +#: library/urllib.parse.rst:127 library/urllib.parse.rst:132 +#: library/urllib.parse.rst:318 library/urllib.parse.rst:322 +#: library/urllib.parse.rst:438 library/urllib.parse.rst:440 msgid "empty string" msgstr "" -#: library/urllib.parse.rst:303 +#: library/urllib.parse.rst:320 msgid ":attr:`path`" msgstr "" -#: library/urllib.parse.rst:303 +#: library/urllib.parse.rst:320 msgid "2" msgstr "" -#: library/urllib.parse.rst:303 +#: library/urllib.parse.rst:320 msgid "Hierarchical path" msgstr "" -#: library/urllib.parse.rst:116 +#: library/urllib.parse.rst:129 msgid ":attr:`params`" msgstr "" -#: library/urllib.parse.rst:305 +#: library/urllib.parse.rst:322 msgid "3" msgstr "" -#: library/urllib.parse.rst:116 +#: library/urllib.parse.rst:129 msgid "Parameters for last path element" msgstr "" -#: library/urllib.parse.rst:305 +#: library/urllib.parse.rst:322 msgid ":attr:`query`" msgstr "" -#: library/urllib.parse.rst:307 +#: library/urllib.parse.rst:324 msgid "4" msgstr "" -#: library/urllib.parse.rst:305 +#: library/urllib.parse.rst:322 msgid "Query component" msgstr "" -#: library/urllib.parse.rst:307 library/urllib.parse.rst:414 +#: library/urllib.parse.rst:324 library/urllib.parse.rst:440 msgid ":attr:`fragment`" msgstr "" -#: library/urllib.parse.rst:121 +#: library/urllib.parse.rst:134 msgid "5" msgstr "" -#: library/urllib.parse.rst:307 library/urllib.parse.rst:414 +#: library/urllib.parse.rst:324 library/urllib.parse.rst:440 msgid "Fragment identifier" msgstr "" -#: library/urllib.parse.rst:309 +#: library/urllib.parse.rst:326 msgid ":attr:`username`" msgstr "" -#: library/urllib.parse.rst:309 +#: library/urllib.parse.rst:326 msgid "User name" msgstr "" -#: library/urllib.parse.rst:125 library/urllib.parse.rst:129 -#: library/urllib.parse.rst:311 library/urllib.parse.rst:315 +#: library/urllib.parse.rst:138 library/urllib.parse.rst:142 +#: library/urllib.parse.rst:328 library/urllib.parse.rst:332 msgid ":const:`None`" msgstr "" -#: library/urllib.parse.rst:311 +#: library/urllib.parse.rst:328 msgid ":attr:`password`" msgstr "" -#: library/urllib.parse.rst:311 +#: library/urllib.parse.rst:328 msgid "Password" msgstr "" -#: library/urllib.parse.rst:313 +#: library/urllib.parse.rst:330 msgid ":attr:`hostname`" msgstr "" -#: library/urllib.parse.rst:313 +#: library/urllib.parse.rst:330 msgid "Host name (lower case)" msgstr "" -#: library/urllib.parse.rst:315 +#: library/urllib.parse.rst:332 msgid ":attr:`port`" msgstr "" -#: library/urllib.parse.rst:315 +#: library/urllib.parse.rst:332 msgid "Port number as integer, if present" msgstr "" -#: library/urllib.parse.rst:319 +#: library/urllib.parse.rst:336 msgid "" "Reading the :attr:`port` attribute will raise a :exc:`ValueError` if an " "invalid port is specified in the URL. See section :ref:`urlparse-result-" "object` for more information on the result object." msgstr "" -#: library/urllib.parse.rst:323 +#: library/urllib.parse.rst:340 msgid "" "Unmatched square brackets in the :attr:`netloc` attribute will raise a :exc:" "`ValueError`." msgstr "" -#: library/urllib.parse.rst:326 +#: library/urllib.parse.rst:343 msgid "" "Characters in the :attr:`netloc` attribute that decompose under NFKC " "normalization (as used by the IDNA encoding) into any of ``/``, ``?``, " @@ -255,7 +313,7 @@ msgid "" "decomposed before parsing, no error will be raised." msgstr "" -#: library/urllib.parse.rst:145 +#: library/urllib.parse.rst:158 msgid "" "As is the case with all named tuples, the subclass has a few additional " "methods and attributes that are particularly useful. One such method is :" @@ -263,36 +321,50 @@ msgid "" "object replacing specified fields with new values." msgstr "" -#: library/urllib.parse.rst:164 +#: library/urllib.parse.rst:163 +msgid "" +">>> from urllib.parse import urlparse\n" +">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" +">>> u\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" +" params='', query='', fragment='')\n" +">>> u._replace(scheme='http')\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." +"html',\n" +" params='', query='', fragment='')" +msgstr "" + +#: library/urllib.parse.rst:177 msgid "" ":func:`urlparse` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" -#: library/urllib.parse.rst:167 +#: library/urllib.parse.rst:180 msgid "Added IPv6 URL parsing capabilities." msgstr "" -#: library/urllib.parse.rst:170 +#: library/urllib.parse.rst:183 msgid "" -"The fragment is now parsed for all URL schemes (unless *allow_fragment* is " +"The fragment is now parsed for all URL schemes (unless *allow_fragments* is " "false), in accordance with :rfc:`3986`. Previously, an allowlist of schemes " "that support fragments existed." msgstr "" -#: library/urllib.parse.rst:340 +#: library/urllib.parse.rst:357 msgid "" "Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :" "const:`None`." msgstr "" -#: library/urllib.parse.rst:344 +#: library/urllib.parse.rst:361 msgid "" "Characters that affect netloc parsing under NFKC normalization will now " "raise :exc:`ValueError`." msgstr "" -#: library/urllib.parse.rst:186 +#: library/urllib.parse.rst:199 msgid "" "Parse a query string given as a string argument (data of type :mimetype:" "`application/x-www-form-urlencoded`). Data are returned as a dictionary. " @@ -300,7 +372,7 @@ msgid "" "lists of values for each name." msgstr "" -#: library/urllib.parse.rst:236 +#: library/urllib.parse.rst:253 msgid "" "The optional argument *keep_blank_values* is a flag indicating whether blank " "values in percent-encoded queries should be treated as blank strings. A true " @@ -309,48 +381,48 @@ msgid "" "treated as if they were not included." msgstr "" -#: library/urllib.parse.rst:242 +#: library/urllib.parse.rst:259 msgid "" "The optional argument *strict_parsing* is a flag indicating what to do with " "parsing errors. If false (the default), errors are silently ignored. If " "true, errors raise a :exc:`ValueError` exception." msgstr "" -#: library/urllib.parse.rst:246 +#: library/urllib.parse.rst:263 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " "percent-encoded sequences into Unicode characters, as accepted by the :meth:" "`bytes.decode` method." msgstr "" -#: library/urllib.parse.rst:250 +#: library/urllib.parse.rst:267 msgid "" "The optional argument *max_num_fields* is the maximum number of fields to " "read. If set, then throws a :exc:`ValueError` if there are more than " "*max_num_fields* fields read." msgstr "" -#: library/urllib.parse.rst:254 +#: library/urllib.parse.rst:271 msgid "" "The optional argument *separator* is the symbol to use for separating the " "query arguments. It defaults to ``&``." msgstr "" -#: library/urllib.parse.rst:212 +#: library/urllib.parse.rst:225 msgid "" "Use the :func:`urllib.parse.urlencode` function (with the ``doseq`` " "parameter set to ``True``) to convert such dictionaries into query strings." msgstr "" -#: library/urllib.parse.rst:260 +#: library/urllib.parse.rst:277 msgid "Add *encoding* and *errors* parameters." msgstr "" -#: library/urllib.parse.rst:263 +#: library/urllib.parse.rst:280 msgid "Added *max_num_fields* parameter." msgstr "" -#: library/urllib.parse.rst:266 +#: library/urllib.parse.rst:283 msgid "" "Added *separator* parameter with the default value of ``&``. Python versions " "earlier than Python 3.10 allowed using both ``;`` and ``&`` as query " @@ -358,20 +430,26 @@ msgid "" "key, with ``&`` as the default separator." msgstr "" -#: library/urllib.parse.rst:232 +#: library/urllib.parse.rst:761 +msgid "" +"Accepting objects with false values (like ``0`` and ``[]``) except empty " +"strings and byte-like objects and ``None`` is now deprecated." +msgstr "" + +#: library/urllib.parse.rst:249 msgid "" "Parse a query string given as a string argument (data of type :mimetype:" "`application/x-www-form-urlencoded`). Data are returned as a list of name, " "value pairs." msgstr "" -#: library/urllib.parse.rst:257 +#: library/urllib.parse.rst:274 msgid "" "Use the :func:`urllib.parse.urlencode` function to convert such lists of " "pairs into query strings." msgstr "" -#: library/urllib.parse.rst:275 +#: library/urllib.parse.rst:292 msgid "" "Construct a URL from a tuple as returned by ``urlparse()``. The *parts* " "argument can be any six-item iterable. This may result in a slightly " @@ -380,7 +458,7 @@ msgid "" "states that these are equivalent)." msgstr "" -#: library/urllib.parse.rst:284 +#: library/urllib.parse.rst:301 msgid "" "This is similar to :func:`urlparse`, but does not split the params from the " "URL. This should generally be used instead of :func:`urlparse` if the more " @@ -390,35 +468,40 @@ msgid "" "returns a 5-item :term:`named tuple`::" msgstr "" -#: library/urllib.parse.rst:406 +#: library/urllib.parse.rst:308 +msgid "" +"(addressing scheme, network location, path, query, fragment identifier)." +msgstr "" + +#: library/urllib.parse.rst:432 msgid "" "The return value is a :term:`named tuple`, its items can be accessed by " "index or as named attributes:" msgstr "" -#: library/urllib.parse.rst:331 +#: library/urllib.parse.rst:348 msgid "" "Following some of the `WHATWG spec`_ that updates RFC 3986, leading C0 " "control and space characters are stripped from the URL. ``\\n``, ``\\r`` and " "tab ``\\t`` characters are removed from the URL at any position." msgstr "" -#: library/urllib.parse.rst:337 +#: library/urllib.parse.rst:354 msgid "" ":func:`urlsplit` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" -#: library/urllib.parse.rst:348 +#: library/urllib.parse.rst:365 msgid "ASCII newline and tab characters are stripped from the URL." msgstr "" -#: library/urllib.parse.rst:351 +#: library/urllib.parse.rst:368 msgid "" "Leading WHATWG C0 control and space characters are stripped from the URL." msgstr "" -#: library/urllib.parse.rst:358 +#: library/urllib.parse.rst:375 msgid "" "Combine the elements of a tuple as returned by :func:`urlsplit` into a " "complete URL as a string. The *parts* argument can be any five-item " @@ -427,7 +510,7 @@ msgid "" "a ? with an empty query; the RFC states that these are equivalent)." msgstr "" -#: library/urllib.parse.rst:367 +#: library/urllib.parse.rst:384 msgid "" "Construct a full (\"absolute\") URL by combining a \"base URL\" (*base*) " "with another URL (*url*). Informally, this uses components of the base URL, " @@ -435,30 +518,46 @@ msgid "" "path, to provide missing components in the relative URL. For example:" msgstr "" -#: library/urllib.parse.rst:376 +#: library/urllib.parse.rst:393 msgid "" "The *allow_fragments* argument has the same meaning and default as for :func:" "`urlparse`." msgstr "" -#: library/urllib.parse.rst:381 +#: library/urllib.parse.rst:398 msgid "" "If *url* is an absolute URL (that is, it starts with ``//`` or ``scheme://" "``), the *url*'s hostname and/or scheme will be present in the result. For " "example:" msgstr "" -#: library/urllib.parse.rst:390 +#: library/urllib.parse.rst:401 +msgid "" +">>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',\n" +"... '//www.python.org/%7Eguido')\n" +"'http://www.python.org/%7Eguido'" +msgstr "" + +#: library/urllib.parse.rst:407 msgid "" "If you do not want that behavior, preprocess the *url* with :func:`urlsplit` " "and :func:`urlunsplit`, removing possible *scheme* and *netloc* parts." msgstr "" -#: library/urllib.parse.rst:396 +#: library/urllib.parse.rst:412 +msgid "" +"Because an absolute URL may be passed as the ``url`` parameter, it is " +"generally **not secure** to use ``urljoin`` with an attacker-controlled " +"``url``. For example in, ``urljoin(\"https://website.com/users/\", " +"username)``, if ``username`` can contain an absolute URL, the result of " +"``urljoin`` will be the absolute URL." +msgstr "" + +#: library/urllib.parse.rst:422 msgid "Behavior updated to match the semantics defined in :rfc:`3986`." msgstr "" -#: library/urllib.parse.rst:401 +#: library/urllib.parse.rst:427 msgid "" "If *url* contains a fragment identifier, return a modified version of *url* " "with no fragment identifier, and the fragment identifier as a separate " @@ -466,25 +565,25 @@ msgid "" "unmodified and an empty string." msgstr "" -#: library/urllib.parse.rst:412 +#: library/urllib.parse.rst:438 msgid ":attr:`url`" msgstr "" -#: library/urllib.parse.rst:412 +#: library/urllib.parse.rst:438 msgid "URL with no fragment" msgstr "" -#: library/urllib.parse.rst:417 +#: library/urllib.parse.rst:443 msgid "" "See section :ref:`urlparse-result-object` for more information on the result " "object." msgstr "" -#: library/urllib.parse.rst:420 +#: library/urllib.parse.rst:446 msgid "Result is a structured object rather than a simple 2-tuple." msgstr "" -#: library/urllib.parse.rst:425 +#: library/urllib.parse.rst:451 msgid "" "Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " @@ -492,11 +591,11 @@ msgid "" "without changes." msgstr "" -#: library/urllib.parse.rst:433 +#: library/urllib.parse.rst:459 msgid "URL parsing security" msgstr "" -#: library/urllib.parse.rst:435 +#: library/urllib.parse.rst:461 msgid "" "The :func:`urlsplit` and :func:`urlparse` APIs do not perform **validation** " "of inputs. They may not raise errors on inputs that other applications " @@ -505,14 +604,14 @@ msgid "" "rather than purity." msgstr "" -#: library/urllib.parse.rst:441 +#: library/urllib.parse.rst:467 msgid "" "Instead of raising an exception on unusual input, they may instead return " "some component parts as empty strings. Or components may contain more than " "perhaps they should." msgstr "" -#: library/urllib.parse.rst:445 +#: library/urllib.parse.rst:471 msgid "" "We recommend that users of these APIs where the values may be used anywhere " "with security implications code defensively. Do some verification within " @@ -521,7 +620,7 @@ msgid "" "that ``hostname``? etc." msgstr "" -#: library/urllib.parse.rst:451 +#: library/urllib.parse.rst:477 msgid "" "What constitutes a URL is not universally well defined. Different " "applications have different needs and desired constraints. For instance the " @@ -533,11 +632,11 @@ msgid "" "API behavior changes." msgstr "" -#: library/urllib.parse.rst:462 +#: library/urllib.parse.rst:488 msgid "Parsing ASCII Encoded Bytes" msgstr "" -#: library/urllib.parse.rst:464 +#: library/urllib.parse.rst:490 msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " @@ -546,14 +645,14 @@ msgid "" "`bytearray` objects in addition to :class:`str` objects." msgstr "" -#: library/urllib.parse.rst:470 +#: library/urllib.parse.rst:496 msgid "" "If :class:`str` data is passed in, the result will also contain only :class:" "`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " "result will contain only :class:`bytes` data." msgstr "" -#: library/urllib.parse.rst:474 +#: library/urllib.parse.rst:500 msgid "" "Attempting to mix :class:`str` data with :class:`bytes` or :class:" "`bytearray` in a single function call will result in a :exc:`TypeError` " @@ -561,7 +660,7 @@ msgid "" "trigger :exc:`UnicodeDecodeError`." msgstr "" -#: library/urllib.parse.rst:479 +#: library/urllib.parse.rst:505 msgid "" "To support easier conversion of result objects between :class:`str` and :" "class:`bytes`, all return values from URL parsing functions provide either " @@ -574,14 +673,14 @@ msgid "" "`str` data (for :meth:`decode` methods)." msgstr "" -#: library/urllib.parse.rst:490 +#: library/urllib.parse.rst:516 msgid "" "Applications that need to operate on potentially improperly quoted URLs that " "may contain non-ASCII data will need to do their own decoding from bytes to " "characters before invoking the URL parsing methods." msgstr "" -#: library/urllib.parse.rst:494 +#: library/urllib.parse.rst:520 msgid "" "The behaviour described in this section applies only to the URL parsing " "functions. The URL quoting functions use their own rules when producing or " @@ -589,15 +688,15 @@ msgid "" "URL quoting functions." msgstr "" -#: library/urllib.parse.rst:499 +#: library/urllib.parse.rst:525 msgid "URL parsing functions now accept ASCII encoded byte sequences" msgstr "" -#: library/urllib.parse.rst:506 +#: library/urllib.parse.rst:532 msgid "Structured Parse Results" msgstr "" -#: library/urllib.parse.rst:508 +#: library/urllib.parse.rst:534 msgid "" "The result objects from the :func:`urlparse`, :func:`urlsplit` and :func:" "`urldefrag` functions are subclasses of the :class:`tuple` type. These " @@ -606,7 +705,7 @@ msgid "" "section, as well as an additional method:" msgstr "" -#: library/urllib.parse.rst:516 +#: library/urllib.parse.rst:542 msgid "" "Return the re-combined version of the original URL as a string. This may " "differ from the original URL in that the scheme may be normalized to lower " @@ -614,72 +713,72 @@ msgid "" "queries, and fragment identifiers will be removed." msgstr "" -#: library/urllib.parse.rst:521 +#: library/urllib.parse.rst:547 msgid "" "For :func:`urldefrag` results, only empty fragment identifiers will be " "removed. For :func:`urlsplit` and :func:`urlparse` results, all noted " "changes will be made to the URL returned by this method." msgstr "" -#: library/urllib.parse.rst:525 +#: library/urllib.parse.rst:551 msgid "" "The result of this method remains unchanged if passed back through the " "original parsing function:" msgstr "" -#: library/urllib.parse.rst:538 +#: library/urllib.parse.rst:564 msgid "" "The following classes provide the implementations of the structured parse " "results when operating on :class:`str` objects:" msgstr "" -#: library/urllib.parse.rst:543 +#: library/urllib.parse.rst:569 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`DefragResultBytes` instance." msgstr "" -#: library/urllib.parse.rst:551 +#: library/urllib.parse.rst:577 msgid "" "Concrete class for :func:`urlparse` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`ParseResultBytes` instance." msgstr "" -#: library/urllib.parse.rst:557 +#: library/urllib.parse.rst:583 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`SplitResultBytes` instance." msgstr "" -#: library/urllib.parse.rst:562 +#: library/urllib.parse.rst:588 msgid "" "The following classes provide the implementations of the parse results when " "operating on :class:`bytes` or :class:`bytearray` objects:" msgstr "" -#: library/urllib.parse.rst:567 +#: library/urllib.parse.rst:593 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`DefragResult` instance." msgstr "" -#: library/urllib.parse.rst:575 +#: library/urllib.parse.rst:601 msgid "" "Concrete class for :func:`urlparse` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`ParseResult` instance." msgstr "" -#: library/urllib.parse.rst:583 +#: library/urllib.parse.rst:609 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`SplitResult` instance." msgstr "" -#: library/urllib.parse.rst:591 +#: library/urllib.parse.rst:617 msgid "URL Quoting" msgstr "" -#: library/urllib.parse.rst:593 +#: library/urllib.parse.rst:619 msgid "" "The URL quoting functions focus on taking program data and making it safe " "for use as URL components by quoting special characters and appropriately " @@ -688,7 +787,7 @@ msgid "" "isn't already covered by the URL parsing functions above." msgstr "" -#: library/urllib.parse.rst:601 +#: library/urllib.parse.rst:627 msgid "" "Replace special characters in *string* using the :samp:`%{xx}` escape. " "Letters, digits, and the characters ``'_.-~'`` are never quoted. By default, " @@ -697,17 +796,17 @@ msgid "" "not be quoted --- its default value is ``'/'``." msgstr "" -#: library/urllib.parse.rst:653 library/urllib.parse.rst:682 +#: library/urllib.parse.rst:679 library/urllib.parse.rst:708 msgid "*string* may be either a :class:`str` or a :class:`bytes` object." msgstr "" -#: library/urllib.parse.rst:609 +#: library/urllib.parse.rst:635 msgid "" "Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. \"~\" is now " "included in the set of unreserved characters." msgstr "" -#: library/urllib.parse.rst:613 +#: library/urllib.parse.rst:639 msgid "" "The optional *encoding* and *errors* parameters specify how to deal with non-" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " @@ -717,17 +816,17 @@ msgid "" "`TypeError` is raised." msgstr "" -#: library/urllib.parse.rst:621 +#: library/urllib.parse.rst:647 msgid "" "Note that ``quote(string, safe, encoding, errors)`` is equivalent to " "``quote_from_bytes(string.encode(encoding, errors), safe)``." msgstr "" -#: library/urllib.parse.rst:624 +#: library/urllib.parse.rst:650 msgid "Example: ``quote('/El Niño/')`` yields ``'/El%20Ni%C3%B1o/'``." msgstr "" -#: library/urllib.parse.rst:629 +#: library/urllib.parse.rst:655 msgid "" "Like :func:`quote`, but also replace spaces with plus signs, as required for " "quoting HTML form values when building up a query string to go into a URL. " @@ -735,21 +834,21 @@ msgid "" "*safe*. It also does not have *safe* default to ``'/'``." msgstr "" -#: library/urllib.parse.rst:634 +#: library/urllib.parse.rst:660 msgid "Example: ``quote_plus('/El Niño/')`` yields ``'%2FEl+Ni%C3%B1o%2F'``." msgstr "" -#: library/urllib.parse.rst:639 +#: library/urllib.parse.rst:665 msgid "" "Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" "`str`, and does not perform string-to-bytes encoding." msgstr "" -#: library/urllib.parse.rst:642 +#: library/urllib.parse.rst:668 msgid "Example: ``quote_from_bytes(b'a&\\xef')`` yields ``'a%26%EF'``." msgstr "" -#: library/urllib.parse.rst:648 +#: library/urllib.parse.rst:674 msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" @@ -757,52 +856,52 @@ msgid "" "decode` method." msgstr "" -#: library/urllib.parse.rst:655 +#: library/urllib.parse.rst:681 msgid "" "*encoding* defaults to ``'utf-8'``. *errors* defaults to ``'replace'``, " "meaning invalid sequences are replaced by a placeholder character." msgstr "" -#: library/urllib.parse.rst:659 +#: library/urllib.parse.rst:685 msgid "Example: ``unquote('/El%20Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: library/urllib.parse.rst:661 +#: library/urllib.parse.rst:687 msgid "" "*string* parameter supports bytes and str objects (previously only str)." msgstr "" -#: library/urllib.parse.rst:669 +#: library/urllib.parse.rst:695 msgid "" "Like :func:`unquote`, but also replace plus signs with spaces, as required " "for unquoting HTML form values." msgstr "" -#: library/urllib.parse.rst:672 +#: library/urllib.parse.rst:698 msgid "*string* must be a :class:`str`." msgstr "" -#: library/urllib.parse.rst:674 +#: library/urllib.parse.rst:700 msgid "Example: ``unquote_plus('/El+Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: library/urllib.parse.rst:679 +#: library/urllib.parse.rst:705 msgid "" "Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return " "a :class:`bytes` object." msgstr "" -#: library/urllib.parse.rst:684 +#: library/urllib.parse.rst:710 msgid "" "If it is a :class:`str`, unescaped non-ASCII characters in *string* are " "encoded into UTF-8 bytes." msgstr "" -#: library/urllib.parse.rst:687 +#: library/urllib.parse.rst:713 msgid "Example: ``unquote_to_bytes('a%26%EF')`` yields ``b'a&\\xef'``." msgstr "" -#: library/urllib.parse.rst:693 +#: library/urllib.parse.rst:719 msgid "" "Convert a mapping object or a sequence of two-element tuples, which may " "contain :class:`str` or :class:`bytes` objects, to a percent-encoded ASCII " @@ -811,7 +910,7 @@ msgid "" "be encoded to bytes, otherwise it would result in a :exc:`TypeError`." msgstr "" -#: library/urllib.parse.rst:700 +#: library/urllib.parse.rst:726 msgid "" "The resulting string is a series of ``key=value`` pairs separated by ``'&'`` " "characters, where both *key* and *value* are quoted using the *quote_via* " @@ -824,7 +923,7 @@ msgid "" "``quote`` and specify a value for *safe*." msgstr "" -#: library/urllib.parse.rst:710 +#: library/urllib.parse.rst:736 msgid "" "When a sequence of two-element tuples is used as the *query* argument, the " "first element of each tuple is a key and the second is a value. The value " @@ -835,49 +934,49 @@ msgid "" "order of parameter tuples in the sequence." msgstr "" -#: library/urllib.parse.rst:718 +#: library/urllib.parse.rst:744 msgid "" "The *safe*, *encoding*, and *errors* parameters are passed down to " "*quote_via* (the *encoding* and *errors* parameters are only passed when a " "query element is a :class:`str`)." msgstr "" -#: library/urllib.parse.rst:722 +#: library/urllib.parse.rst:748 msgid "" "To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are " "provided in this module to parse query strings into Python data structures." msgstr "" -#: library/urllib.parse.rst:725 +#: library/urllib.parse.rst:751 msgid "" "Refer to :ref:`urllib examples ` to find out how the :func:" "`urllib.parse.urlencode` method can be used for generating the query string " "of a URL or data for a POST request." msgstr "" -#: library/urllib.parse.rst:729 +#: library/urllib.parse.rst:755 msgid "*query* supports bytes and string objects." msgstr "" -#: library/urllib.parse.rst:732 +#: library/urllib.parse.rst:758 msgid "Added the *quote_via* parameter." msgstr "" -#: library/urllib.parse.rst:740 +#: library/urllib.parse.rst:768 msgid "`WHATWG`_ - URL Living standard" msgstr "" -#: library/urllib.parse.rst:739 +#: library/urllib.parse.rst:769 msgid "" "Working Group for the URL Standard that defines URLs, domains, IP addresses, " "the application/x-www-form-urlencoded format, and their API." msgstr "" -#: library/urllib.parse.rst:746 +#: library/urllib.parse.rst:772 msgid ":rfc:`3986` - Uniform Resource Identifiers" msgstr "" -#: library/urllib.parse.rst:743 +#: library/urllib.parse.rst:773 msgid "" "This is the current standard (STD66). Any changes to urllib.parse module " "should conform to this. Certain deviations could be observed, which are " @@ -885,48 +984,48 @@ msgid "" "requirements as commonly observed in major browsers." msgstr "" -#: library/urllib.parse.rst:749 +#: library/urllib.parse.rst:778 msgid ":rfc:`2732` - Format for Literal IPv6 Addresses in URL's." msgstr "" -#: library/urllib.parse.rst:749 +#: library/urllib.parse.rst:779 msgid "This specifies the parsing requirements of IPv6 URLs." msgstr "" -#: library/urllib.parse.rst:753 +#: library/urllib.parse.rst:781 msgid ":rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax" msgstr "" -#: library/urllib.parse.rst:752 +#: library/urllib.parse.rst:782 msgid "" "Document describing the generic syntactic requirements for both Uniform " "Resource Names (URNs) and Uniform Resource Locators (URLs)." msgstr "" -#: library/urllib.parse.rst:756 +#: library/urllib.parse.rst:785 msgid ":rfc:`2368` - The mailto URL scheme." msgstr "" -#: library/urllib.parse.rst:756 +#: library/urllib.parse.rst:786 msgid "Parsing requirements for mailto URL schemes." msgstr "" -#: library/urllib.parse.rst:761 +#: library/urllib.parse.rst:788 msgid ":rfc:`1808` - Relative Uniform Resource Locators" msgstr "" -#: library/urllib.parse.rst:759 +#: library/urllib.parse.rst:789 msgid "" "This Request For Comments includes the rules for joining an absolute and a " "relative URL, including a fair number of \"Abnormal Examples\" which govern " "the treatment of border cases." msgstr "" -#: library/urllib.parse.rst:763 +#: library/urllib.parse.rst:793 msgid ":rfc:`1738` - Uniform Resource Locators (URL)" msgstr "" -#: library/urllib.parse.rst:764 +#: library/urllib.parse.rst:794 msgid "This specifies the formal syntax and semantics of absolute URLs." msgstr "" diff --git a/library/urllib.po b/library/urllib.po index c533f1bb..ae0ce20d 100644 --- a/library/urllib.po +++ b/library/urllib.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/urllib.rst:2 -msgid ":mod:`urllib` --- URL handling modules" +msgid ":mod:`!urllib` --- URL handling modules" msgstr "" #: library/urllib.rst:6 diff --git a/library/urllib.request.po b/library/urllib.request.po index cfb6b2bb..5ff6cd11 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/urllib.request.rst:2 -msgid ":mod:`urllib.request` --- Extensible library for opening URLs" +msgid ":mod:`!urllib.request` --- Extensible library for opening URLs" msgstr "" #: library/urllib.request.rst:11 @@ -46,14 +47,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/urllib.request.rst:34 @@ -96,25 +96,12 @@ msgstr "" #: library/urllib.request.rst:58 msgid "" -"The optional *cafile* and *capath* parameters specify a set of trusted CA " -"certificates for HTTPS requests. *cafile* should point to a single file " -"containing a bundle of CA certificates, whereas *capath* should point to a " -"directory of hashed certificate files. More information can be found in :" -"meth:`ssl.SSLContext.load_verify_locations`." -msgstr "" - -#: library/urllib.request.rst:64 -msgid "The *cadefault* parameter is ignored." -msgstr "" - -#: library/urllib.request.rst:66 -msgid "" "This function always returns an object which can work as a :term:`context " "manager` and has the properties *url*, *headers*, and *status*. See :class:" "`urllib.response.addinfourl` for more detail on these properties." msgstr "" -#: library/urllib.request.rst:70 +#: library/urllib.request.rst:62 msgid "" "For HTTP and HTTPS URLs, this function returns a :class:`http.client." "HTTPResponse` object slightly modified. In addition to the three new methods " @@ -124,25 +111,24 @@ msgid "" "documentation for :class:`~http.client.HTTPResponse`." msgstr "" -#: library/urllib.request.rst:78 +#: library/urllib.request.rst:70 msgid "" -"For FTP, file, and data URLs and requests explicitly handled by legacy :" -"class:`URLopener` and :class:`FancyURLopener` classes, this function returns " -"a :class:`urllib.response.addinfourl` object." +"For FTP, file, and data URLs, this function returns a :class:`urllib." +"response.addinfourl` object." msgstr "" -#: library/urllib.request.rst:82 +#: library/urllib.request.rst:73 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." msgstr "" -#: library/urllib.request.rst:84 +#: library/urllib.request.rst:75 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " "the default installed global :class:`OpenerDirector` uses :class:" "`UnknownHandler` to ensure this never happens)." msgstr "" -#: library/urllib.request.rst:88 +#: library/urllib.request.rst:79 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " "environment variable like :envvar:`!http_proxy` is set), :class:" @@ -150,7 +136,7 @@ msgid "" "through the proxy." msgstr "" -#: library/urllib.request.rst:93 +#: library/urllib.request.rst:84 msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " @@ -159,56 +145,49 @@ msgid "" "`ProxyHandler` objects." msgstr "" -#: library/urllib.request.rst:110 -msgid "" -"Raises an :ref:`auditing event ` ``urllib.Request`` with arguments " -"``fullurl``, ``data``, ``headers``, ``method``." -msgstr "" - -#: library/urllib.request.rst:101 +#: library/urllib.request.rst:92 msgid "" "The default opener raises an :ref:`auditing event ` ``urllib." "Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " "taken from the request object." msgstr "" -#: library/urllib.request.rst:105 +#: library/urllib.request.rst:96 msgid "*cafile* and *capath* were added." msgstr "" -#: library/urllib.request.rst:108 +#: library/urllib.request.rst:99 msgid "" "HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." "HAS_SNI` is true)." msgstr "" -#: library/urllib.request.rst:111 +#: library/urllib.request.rst:102 msgid "*data* can be an iterable object." msgstr "" -#: library/urllib.request.rst:113 +#: library/urllib.request.rst:104 msgid "*cadefault* was added." msgstr "" -#: library/urllib.request.rst:116 +#: library/urllib.request.rst:107 msgid "*context* was added." msgstr "" -#: library/urllib.request.rst:119 +#: library/urllib.request.rst:110 msgid "" "HTTPS connection now send an ALPN extension with protocol indicator " "``http/1.1`` when no *context* is given. Custom *context* should set ALPN " "protocols with :meth:`~ssl.SSLContext.set_alpn_protocols`." msgstr "" -#: library/urllib.request.rst:126 +#: library/urllib.request.rst:115 msgid "" -"*cafile*, *capath* and *cadefault* are deprecated in favor of *context*. " -"Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." -"create_default_context` select the system's trusted CA certificates for you." +"Remove *cafile*, *capath* and *cadefault* parameters: use the *context* " +"parameter instead." msgstr "" -#: library/urllib.request.rst:134 +#: library/urllib.request.rst:122 msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " @@ -217,7 +196,7 @@ msgid "" "`OpenerDirector`, and any class with the appropriate interface will work." msgstr "" -#: library/urllib.request.rst:144 +#: library/urllib.request.rst:132 msgid "" "Return an :class:`OpenerDirector` instance, which chains the handlers in the " "order given. *handler*\\s can be either instances of :class:`BaseHandler`, " @@ -231,34 +210,109 @@ msgid "" "`HTTPErrorProcessor`." msgstr "" -#: library/urllib.request.rst:154 +#: library/urllib.request.rst:142 msgid "" "If the Python installation has SSL support (i.e., if the :mod:`ssl` module " "can be imported), :class:`HTTPSHandler` will also be added." msgstr "" -#: library/urllib.request.rst:157 +#: library/urllib.request.rst:145 msgid "" "A :class:`BaseHandler` subclass may also change its :attr:`handler_order` " "attribute to modify its position in the handlers list." msgstr "" -#: library/urllib.request.rst:163 +#: library/urllib.request.rst:151 msgid "" -"Convert the pathname *path* from the local syntax for a path to the form " -"used in the path component of a URL. This does not produce a complete URL. " -"The return value will already be quoted using the :func:`~urllib.parse." -"quote` function." +"Convert the given local path to a ``file:`` URL. This function uses :func:" +"`~urllib.parse.quote` function to encode the path." msgstr "" -#: library/urllib.request.rst:170 +#: library/urllib.request.rst:154 +msgid "" +"If *add_scheme* is false (the default), the return value omits the ``file:`` " +"scheme prefix. Set *add_scheme* to true to return a complete URL." +msgstr "" + +#: library/urllib.request.rst:195 +msgid "This example shows the function being used on Windows::" +msgstr "" + +#: library/urllib.request.rst:159 msgid "" -"Convert the path component *path* from a percent-encoded URL to the local " -"syntax for a path. This does not accept a complete URL. This function " -"uses :func:`~urllib.parse.unquote` to decode *path*." +">>> from urllib.request import pathname2url\n" +">>> path = 'C:\\\\Program Files'\n" +">>> pathname2url(path, add_scheme=True)\n" +"'file:///C:/Program%20Files'" +msgstr "" + +#: library/urllib.request.rst:202 +msgid "" +"Windows drive letters are no longer converted to uppercase, and ``:`` " +"characters not following a drive letter no longer cause an :exc:`OSError` " +"exception to be raised on Windows." +msgstr "" + +#: library/urllib.request.rst:169 +msgid "" +"Paths beginning with a slash are converted to URLs with authority sections. " +"For example, the path ``/etc/hosts`` is converted to the URL ``///etc/" +"hosts``." +msgstr "" + +#: library/urllib.request.rst:174 +msgid "The *add_scheme* parameter was added." msgstr "" -#: library/urllib.request.rst:176 +#: library/urllib.request.rst:180 +msgid "" +"Convert the given ``file:`` URL to a local path. This function uses :func:" +"`~urllib.parse.unquote` to decode the URL." +msgstr "" + +#: library/urllib.request.rst:183 +msgid "" +"If *require_scheme* is false (the default), the given value should omit a " +"``file:`` scheme prefix. If *require_scheme* is set to true, the given value " +"should include the prefix; a :exc:`~urllib.error.URLError` is raised if it " +"doesn't." +msgstr "" + +#: library/urllib.request.rst:188 +msgid "" +"The URL authority is discarded if it is empty, ``localhost``, or the local " +"hostname. Otherwise, if *resolve_host* is set to true, the authority is " +"resolved using :func:`socket.gethostbyname` and discarded if it matches a " +"local IP address (as per :rfc:`RFC 8089 §3 <8089#section-3>`). If the " +"authority is still unhandled, then on Windows a UNC path is returned, and on " +"other platforms a :exc:`~urllib.error.URLError` is raised." +msgstr "" + +#: library/urllib.request.rst:197 +msgid "" +">>> from urllib.request import url2pathname\n" +">>> url = 'file:///C:/Program%20Files'\n" +">>> url2pathname(url, require_scheme=True)\n" +"'C:\\\\Program Files'" +msgstr "" + +#: library/urllib.request.rst:207 +msgid "" +"The URL authority is discarded if it matches the local hostname. Otherwise, " +"if the authority isn't empty or ``localhost``, then on Windows a UNC path is " +"returned (as before), and on other platforms a :exc:`~urllib.error.URLError` " +"is raised." +msgstr "" + +#: library/urllib.request.rst:213 +msgid "The URL query and fragment components are discarded if present." +msgstr "" + +#: library/urllib.request.rst:216 +msgid "The *require_scheme* and *resolve_host* parameters were added." +msgstr "" + +#: library/urllib.request.rst:222 msgid "" "This helper function returns a dictionary of scheme to proxy server URL " "mappings. It scans the environment for variables named ``_proxy``, " @@ -268,7 +322,7 @@ msgid "" "uppercase environment variables exist (and disagree), lowercase is preferred." msgstr "" -#: library/urllib.request.rst:186 +#: library/urllib.request.rst:232 msgid "" "If the environment variable ``REQUEST_METHOD`` is set, which usually " "indicates your script is running in a CGI environment, the environment " @@ -279,19 +333,19 @@ msgid "" "(or at least the ``_proxy`` suffix)." msgstr "" -#: library/urllib.request.rst:195 +#: library/urllib.request.rst:241 msgid "The following classes are provided:" msgstr "" -#: library/urllib.request.rst:199 +#: library/urllib.request.rst:245 msgid "This class is an abstraction of a URL request." msgstr "" -#: library/urllib.request.rst:201 +#: library/urllib.request.rst:247 msgid "*url* should be a string containing a valid, properly encoded URL." msgstr "" -#: library/urllib.request.rst:203 +#: library/urllib.request.rst:249 msgid "" "*data* must be an object specifying additional data to send to the server, " "or ``None`` if no such data is needed. Currently HTTP requests are the only " @@ -304,7 +358,7 @@ msgid "" "iterables." msgstr "" -#: library/urllib.request.rst:213 +#: library/urllib.request.rst:259 msgid "" "For an HTTP POST request method, *data* should be a buffer in the standard :" "mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." @@ -313,7 +367,7 @@ msgid "" "being used as the *data* parameter." msgstr "" -#: library/urllib.request.rst:219 +#: library/urllib.request.rst:265 msgid "" "*headers* should be a dictionary, and will be treated as if :meth:" "`add_header` was called with each key and value as arguments. This is often " @@ -326,21 +380,21 @@ msgid "" "case." msgstr "" -#: library/urllib.request.rst:230 +#: library/urllib.request.rst:276 msgid "" "An appropriate ``Content-Type`` header should be included if the *data* " "argument is present. If this header has not been provided and *data* is not " -"None, ``Content-Type: application/x-www-form-urlencoded`` will be added as a " -"default." +"``None``, ``Content-Type: application/x-www-form-urlencoded`` will be added " +"as a default." msgstr "" -#: library/urllib.request.rst:235 +#: library/urllib.request.rst:281 msgid "" "The next two arguments are only of interest for correct handling of third-" "party HTTP cookies:" msgstr "" -#: library/urllib.request.rst:238 +#: library/urllib.request.rst:284 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " "defined by :rfc:`2965`. It defaults to ``http.cookiejar." @@ -350,7 +404,7 @@ msgid "" "for the page containing the image." msgstr "" -#: library/urllib.request.rst:246 +#: library/urllib.request.rst:292 msgid "" "*unverifiable* should indicate whether the request is unverifiable, as " "defined by :rfc:`2965`. It defaults to ``False``. An unverifiable request " @@ -359,17 +413,17 @@ msgid "" "option to approve the automatic fetching of the image, this should be true." msgstr "" -#: library/urllib.request.rst:253 +#: library/urllib.request.rst:299 msgid "" "*method* should be a string that indicates the HTTP request method that will " "be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" -"`~Request.method` attribute and is used by :meth:`get_method()`. The default " +"`~Request.method` attribute and is used by :meth:`get_method`. The default " "is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. Subclasses may " "indicate a different default method by setting the :attr:`~Request.method` " "attribute in the class itself." msgstr "" -#: library/urllib.request.rst:261 +#: library/urllib.request.rst:307 msgid "" "The request will not work as expected if the data object is unable to " "deliver its content more than once (e.g. a file or an iterable that can " @@ -379,49 +433,49 @@ msgid "" "library." msgstr "" -#: library/urllib.request.rst:268 +#: library/urllib.request.rst:314 msgid ":attr:`Request.method` argument is added to the Request class." msgstr "" -#: library/urllib.request.rst:271 +#: library/urllib.request.rst:317 msgid "Default :attr:`Request.method` may be indicated at the class level." msgstr "" -#: library/urllib.request.rst:274 +#: library/urllib.request.rst:320 msgid "" "Do not raise an error if the ``Content-Length`` has not been provided and " "*data* is neither ``None`` nor a bytes object. Fall back to use chunked " "transfer encoding instead." msgstr "" -#: library/urllib.request.rst:281 +#: library/urllib.request.rst:327 msgid "" "The :class:`OpenerDirector` class opens URLs via :class:`BaseHandler`\\ s " "chained together. It manages the chaining of handlers, and recovery from " "errors." msgstr "" -#: library/urllib.request.rst:287 +#: library/urllib.request.rst:333 msgid "" "This is the base class for all registered handlers --- and handles only the " "simple mechanics of registration." msgstr "" -#: library/urllib.request.rst:293 +#: library/urllib.request.rst:339 msgid "" "A class which defines a default handler for HTTP error responses; all " "responses are turned into :exc:`~urllib.error.HTTPError` exceptions." msgstr "" -#: library/urllib.request.rst:299 +#: library/urllib.request.rst:345 msgid "A class to handle redirections." msgstr "" -#: library/urllib.request.rst:304 +#: library/urllib.request.rst:350 msgid "A class to handle HTTP Cookies." msgstr "" -#: library/urllib.request.rst:309 +#: library/urllib.request.rst:355 msgid "" "Cause requests to go through a proxy. If *proxies* is given, it must be a " "dictionary mapping protocol names to URLs of proxies. The default is to read " @@ -432,11 +486,11 @@ msgid "" "Configuration Framework." msgstr "" -#: library/urllib.request.rst:317 +#: library/urllib.request.rst:363 msgid "To disable autodetected proxy pass an empty dictionary." msgstr "" -#: library/urllib.request.rst:319 +#: library/urllib.request.rst:365 msgid "" "The :envvar:`no_proxy` environment variable can be used to specify hosts " "which shouldn't be reached via proxy; if set, it should be a comma-separated " @@ -444,24 +498,24 @@ msgid "" "``cern.ch,ncsa.uiuc.edu,some.host:8080``." msgstr "" -#: library/urllib.request.rst:326 +#: library/urllib.request.rst:372 msgid "" "``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see " "the documentation on :func:`~urllib.request.getproxies`." msgstr "" -#: library/urllib.request.rst:332 +#: library/urllib.request.rst:378 msgid "Keep a database of ``(realm, uri) -> (user, password)`` mappings." msgstr "" -#: library/urllib.request.rst:337 +#: library/urllib.request.rst:383 msgid "" "Keep a database of ``(realm, uri) -> (user, password)`` mappings. A realm " "of ``None`` is considered a catch-all realm, which is searched if no other " "realm fits." msgstr "" -#: library/urllib.request.rst:344 +#: library/urllib.request.rst:390 msgid "" "A variant of :class:`HTTPPasswordMgrWithDefaultRealm` that also has a " "database of ``uri -> is_authenticated`` mappings. Can be used by a " @@ -469,7 +523,7 @@ msgid "" "immediately instead of waiting for a ``401`` response first." msgstr "" -#: library/urllib.request.rst:354 +#: library/urllib.request.rst:400 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -488,11 +542,11 @@ msgid "" "will automatically include the authentication credentials." msgstr "" -#: library/urllib.request.rst:371 +#: library/urllib.request.rst:417 msgid "Added ``is_authenticated`` support." msgstr "" -#: library/urllib.request.rst:377 +#: library/urllib.request.rst:423 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -501,7 +555,7 @@ msgid "" "presented with a wrong Authentication scheme." msgstr "" -#: library/urllib.request.rst:420 +#: library/urllib.request.rst:469 msgid "" "Handle authentication with the proxy. *password_mgr*, if given, should be " "something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -509,7 +563,7 @@ msgid "" "be supported." msgstr "" -#: library/urllib.request.rst:394 +#: library/urllib.request.rst:440 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -517,7 +571,11 @@ msgid "" "`http-password-mgr` for information on the interface that must be supported." msgstr "" -#: library/urllib.request.rst:403 +#: library/urllib.request.rst:446 +msgid "Added support for HTTP digest authentication algorithm ``SHA-256``." +msgstr "" + +#: library/urllib.request.rst:452 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -530,108 +588,108 @@ msgid "" "Digest or Basic." msgstr "" -#: library/urllib.request.rst:413 +#: library/urllib.request.rst:462 msgid "Raise :exc:`ValueError` on unsupported Authentication Scheme." msgstr "" -#: library/urllib.request.rst:428 +#: library/urllib.request.rst:477 msgid "A class to handle opening of HTTP URLs." msgstr "" -#: library/urllib.request.rst:433 +#: library/urllib.request.rst:482 msgid "" "A class to handle opening of HTTPS URLs. *context* and *check_hostname* " "have the same meaning as in :class:`http.client.HTTPSConnection`." msgstr "" -#: library/urllib.request.rst:436 +#: library/urllib.request.rst:485 msgid "*context* and *check_hostname* were added." msgstr "" -#: library/urllib.request.rst:442 +#: library/urllib.request.rst:491 msgid "Open local files." msgstr "" -#: library/urllib.request.rst:446 +#: library/urllib.request.rst:495 msgid "Open data URLs." msgstr "" -#: library/urllib.request.rst:452 +#: library/urllib.request.rst:501 msgid "Open FTP URLs." msgstr "" -#: library/urllib.request.rst:457 +#: library/urllib.request.rst:506 msgid "" "Open FTP URLs, keeping a cache of open FTP connections to minimize delays." msgstr "" -#: library/urllib.request.rst:462 +#: library/urllib.request.rst:511 msgid "A catch-all class to handle unknown URLs." msgstr "" -#: library/urllib.request.rst:1173 +#: library/urllib.request.rst:1225 msgid "Process HTTP error responses." msgstr "" -#: library/urllib.request.rst:473 +#: library/urllib.request.rst:522 msgid "Request Objects" msgstr "" -#: library/urllib.request.rst:475 +#: library/urllib.request.rst:524 msgid "" "The following methods describe :class:`Request`'s public interface, and so " "all may be overridden in subclasses. It also defines several public " "attributes that can be used by clients to inspect the parsed request." msgstr "" -#: library/urllib.request.rst:482 +#: library/urllib.request.rst:531 msgid "The original URL passed to the constructor." msgstr "" -#: library/urllib.request.rst:486 +#: library/urllib.request.rst:535 msgid "" "Request.full_url is a property with setter, getter and a deleter. Getting :" "attr:`~Request.full_url` returns the original request URL with the fragment, " "if it was present." msgstr "" -#: library/urllib.request.rst:492 +#: library/urllib.request.rst:541 msgid "The URI scheme." msgstr "" -#: library/urllib.request.rst:496 +#: library/urllib.request.rst:545 msgid "" "The URI authority, typically a host, but may also contain a port separated " "by a colon." msgstr "" -#: library/urllib.request.rst:501 +#: library/urllib.request.rst:550 msgid "The original host for the request, without port." msgstr "" -#: library/urllib.request.rst:505 +#: library/urllib.request.rst:554 msgid "" "The URI path. If the :class:`Request` uses a proxy, then selector will be " "the full URL that is passed to the proxy." msgstr "" -#: library/urllib.request.rst:510 +#: library/urllib.request.rst:559 msgid "The entity body for the request, or ``None`` if not specified." msgstr "" -#: library/urllib.request.rst:512 +#: library/urllib.request.rst:561 msgid "" "Changing value of :attr:`Request.data` now deletes \"Content-Length\" header " "if it was previously set or calculated." msgstr "" -#: library/urllib.request.rst:518 +#: library/urllib.request.rst:567 msgid "" "boolean, indicates whether the request is unverifiable as defined by :rfc:" "`2965`." msgstr "" -#: library/urllib.request.rst:523 +#: library/urllib.request.rst:572 msgid "" "The HTTP request method to use. By default its value is :const:`None`, " "which means that :meth:`~Request.get_method` will do its normal computation " @@ -642,13 +700,13 @@ msgid "" "argument." msgstr "" -#: library/urllib.request.rst:533 +#: library/urllib.request.rst:582 msgid "" "A default value can now be set in subclasses; previously it could only be " "set via the constructor argument." msgstr "" -#: library/urllib.request.rst:540 +#: library/urllib.request.rst:589 msgid "" "Return a string indicating the HTTP request method. If :attr:`Request." "method` is not ``None``, return its value, otherwise return ``'GET'`` if :" @@ -656,11 +714,11 @@ msgid "" "meaningful for HTTP requests." msgstr "" -#: library/urllib.request.rst:545 +#: library/urllib.request.rst:594 msgid "get_method now looks at the value of :attr:`Request.method`." msgstr "" -#: library/urllib.request.rst:551 +#: library/urllib.request.rst:600 msgid "" "Add another header to the request. Headers are currently ignored by all " "handlers except HTTP handlers, where they are added to the list of headers " @@ -672,64 +730,64 @@ msgid "" "headers added using this method are also added to redirected requests." msgstr "" -#: library/urllib.request.rst:563 +#: library/urllib.request.rst:612 msgid "Add a header that will not be added to a redirected request." msgstr "" -#: library/urllib.request.rst:568 +#: library/urllib.request.rst:617 msgid "" "Return whether the instance has the named header (checks both regular and " "unredirected)." msgstr "" -#: library/urllib.request.rst:574 +#: library/urllib.request.rst:623 msgid "" "Remove named header from the request instance (both from regular and " "unredirected headers)." msgstr "" -#: library/urllib.request.rst:582 +#: library/urllib.request.rst:631 msgid "Return the URL given in the constructor." msgstr "" -#: library/urllib.request.rst:586 +#: library/urllib.request.rst:635 msgid "Returns :attr:`Request.full_url`" msgstr "" -#: library/urllib.request.rst:591 +#: library/urllib.request.rst:640 msgid "" "Prepare the request by connecting to a proxy server. The *host* and *type* " "will replace those of the instance, and the instance's selector will be the " "original URL given in the constructor." msgstr "" -#: library/urllib.request.rst:598 +#: library/urllib.request.rst:647 msgid "" "Return the value of the given header. If the header is not present, return " "the default value." msgstr "" -#: library/urllib.request.rst:604 +#: library/urllib.request.rst:653 msgid "" "Return a list of tuples (header_name, header_value) of the Request headers." msgstr "" -#: library/urllib.request.rst:606 +#: library/urllib.request.rst:655 msgid "" "The request methods add_data, has_data, get_data, get_type, get_host, " "get_selector, get_origin_req_host and is_unverifiable that were deprecated " "since 3.3 have been removed." msgstr "" -#: library/urllib.request.rst:615 +#: library/urllib.request.rst:664 msgid "OpenerDirector Objects" msgstr "" -#: library/urllib.request.rst:617 +#: library/urllib.request.rst:666 msgid ":class:`OpenerDirector` instances have the following methods:" msgstr "" -#: library/urllib.request.rst:622 +#: library/urllib.request.rst:671 msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " @@ -740,53 +798,53 @@ msgid "" "`http_error_404` would handle HTTP 404 errors." msgstr "" -#: library/urllib.request.rst:630 +#: library/urllib.request.rst:679 msgid "" ":meth:`!_open` --- signal that the handler knows how to open " "*protocol* URLs." msgstr "" -#: library/urllib.request.rst:633 +#: library/urllib.request.rst:682 msgid "See |protocol_open|_ for more information." msgstr "" -#: library/urllib.request.rst:635 +#: library/urllib.request.rst:684 msgid "" ":meth:`!http_error_\\` --- signal that the handler knows how to " "handle HTTP errors with HTTP error code *type*." msgstr "" -#: library/urllib.request.rst:638 +#: library/urllib.request.rst:687 msgid "See |http_error_nnn|_ for more information." msgstr "" -#: library/urllib.request.rst:640 +#: library/urllib.request.rst:689 msgid "" ":meth:`!_error` --- signal that the handler knows how to handle " "errors from (non-\\ ``http``) *protocol*." msgstr "" -#: library/urllib.request.rst:643 +#: library/urllib.request.rst:692 msgid "" ":meth:`!_request` --- signal that the handler knows how to pre-" "process *protocol* requests." msgstr "" -#: library/urllib.request.rst:646 +#: library/urllib.request.rst:695 msgid "See |protocol_request|_ for more information." msgstr "" -#: library/urllib.request.rst:648 +#: library/urllib.request.rst:697 msgid "" ":meth:`!_response` --- signal that the handler knows how to post-" "process *protocol* responses." msgstr "" -#: library/urllib.request.rst:651 +#: library/urllib.request.rst:700 msgid "See |protocol_response|_ for more information." msgstr "" -#: library/urllib.request.rst:660 +#: library/urllib.request.rst:709 msgid "" "Open the given *url* (which can be a request object or a string), optionally " "passing the given *data*. Arguments, return values and exceptions raised are " @@ -798,7 +856,7 @@ msgid "" "HTTP, HTTPS and FTP connections." msgstr "" -#: library/urllib.request.rst:672 +#: library/urllib.request.rst:721 msgid "" "Handle an error of the given protocol. This will call the registered error " "handlers for the given protocol with the given arguments (which are protocol " @@ -807,28 +865,28 @@ msgid "" "http_error_\\` methods of the handler classes." msgstr "" -#: library/urllib.request.rst:678 +#: library/urllib.request.rst:727 msgid "" "Return values and exceptions raised are the same as those of :func:`urlopen`." msgstr "" -#: library/urllib.request.rst:680 +#: library/urllib.request.rst:729 msgid "OpenerDirector objects open URLs in three stages:" msgstr "" -#: library/urllib.request.rst:682 +#: library/urllib.request.rst:731 msgid "" "The order in which these methods are called within each stage is determined " "by sorting the handler instances." msgstr "" -#: library/urllib.request.rst:685 +#: library/urllib.request.rst:734 msgid "" "Every handler with a method named like :meth:`!_request` has that " "method called to pre-process the request." msgstr "" -#: library/urllib.request.rst:688 +#: library/urllib.request.rst:737 msgid "" "Handlers with a method named like :meth:`!_open` are called to " "handle the request. This stage ends when a handler either returns a non-\\ :" @@ -836,7 +894,7 @@ msgid "" "`~urllib.error.URLError`). Exceptions are allowed to propagate." msgstr "" -#: library/urllib.request.rst:693 +#: library/urllib.request.rst:742 msgid "" "In fact, the above algorithm is first tried for methods named :meth:" "`~BaseHandler.default_open`. If all such methods return :const:`None`, the " @@ -845,64 +903,64 @@ msgid "" "named :meth:`~BaseHandler.unknown_open`." msgstr "" -#: library/urllib.request.rst:699 +#: library/urllib.request.rst:748 msgid "" "Note that the implementation of these methods may involve calls of the " "parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" "meth:`~OpenerDirector.error` methods." msgstr "" -#: library/urllib.request.rst:703 +#: library/urllib.request.rst:752 msgid "" "Every handler with a method named like :meth:`!_response` has that " "method called to post-process the response." msgstr "" -#: library/urllib.request.rst:710 +#: library/urllib.request.rst:759 msgid "BaseHandler Objects" msgstr "" -#: library/urllib.request.rst:712 +#: library/urllib.request.rst:761 msgid "" ":class:`BaseHandler` objects provide a couple of methods that are directly " "useful, and others that are meant to be used by derived classes. These are " "intended for direct use:" msgstr "" -#: library/urllib.request.rst:719 +#: library/urllib.request.rst:768 msgid "Add a director as parent." msgstr "" -#: library/urllib.request.rst:724 +#: library/urllib.request.rst:773 msgid "Remove any parents." msgstr "" -#: library/urllib.request.rst:726 +#: library/urllib.request.rst:775 msgid "" "The following attribute and methods should only be used by classes derived " "from :class:`BaseHandler`." msgstr "" -#: library/urllib.request.rst:731 +#: library/urllib.request.rst:780 msgid "" "The convention has been adopted that subclasses defining :meth:`!" "_request` or :meth:`!_response` methods are named :class:" "`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" -#: library/urllib.request.rst:738 +#: library/urllib.request.rst:787 msgid "" "A valid :class:`OpenerDirector`, which can be used to open using a different " "protocol, or handle errors." msgstr "" -#: library/urllib.request.rst:744 +#: library/urllib.request.rst:793 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs." msgstr "" -#: library/urllib.request.rst:747 +#: library/urllib.request.rst:796 msgid "" "This method, if implemented, will be called by the parent :class:" "`OpenerDirector`. It should return a file-like object as described in the " @@ -912,38 +970,38 @@ msgid "" "`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." msgstr "" -#: library/urllib.request.rst:754 +#: library/urllib.request.rst:803 msgid "This method will be called before any protocol-specific open method." msgstr "" -#: library/urllib.request.rst:761 +#: library/urllib.request.rst:810 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to handle URLs with the given protocol." msgstr "" -#: library/urllib.request.rst:764 +#: library/urllib.request.rst:813 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`~BaseHandler.default_open`." msgstr "" -#: library/urllib.request.rst:770 +#: library/urllib.request.rst:819 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs with no specific registered handler " "to open it." msgstr "" -#: library/urllib.request.rst:774 +#: library/urllib.request.rst:823 msgid "" "This method, if implemented, will be called by the :attr:`parent` :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`default_open`." msgstr "" -#: library/urllib.request.rst:781 +#: library/urllib.request.rst:830 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " @@ -952,57 +1010,74 @@ msgid "" "other circumstances." msgstr "" -#: library/urllib.request.rst:786 +#: library/urllib.request.rst:835 msgid "" -"*req* will be a :class:`Request` object, *fp* will be a file-like object " -"with the HTTP error body, *code* will be the three-digit code of the error, " -"*msg* will be the user-visible explanation of the code and *hdrs* will be a " -"mapping object with the headers of the error." +":class:`OpenerDirector` will call this method with five positional arguments:" +msgstr "" + +#: library/urllib.request.rst:837 +msgid "a :class:`Request` object," msgstr "" -#: library/urllib.request.rst:791 +#: library/urllib.request.rst:838 +msgid "a file-like object with the HTTP error body," +msgstr "" + +#: library/urllib.request.rst:839 +msgid "the three-digit code of the error, as a string," +msgstr "" + +#: library/urllib.request.rst:840 +msgid "the user-visible explanation of the code, as a string, and" +msgstr "" + +#: library/urllib.request.rst:841 +msgid "the headers of the error, as a mapping object." +msgstr "" + +#: library/urllib.request.rst:843 msgid "" "Return values and exceptions raised should be the same as those of :func:" "`urlopen`." msgstr "" -#: library/urllib.request.rst:798 +#: library/urllib.request.rst:850 msgid "" "*nnn* should be a three-digit HTTP error code. This method is also not " "defined in :class:`BaseHandler`, but will be called, if it exists, on an " "instance of a subclass, when an HTTP error with code *nnn* occurs." msgstr "" -#: library/urllib.request.rst:802 +#: library/urllib.request.rst:854 msgid "Subclasses should override this method to handle specific HTTP errors." msgstr "" -#: library/urllib.request.rst:804 +#: library/urllib.request.rst:856 msgid "" "Arguments, return values and exceptions raised should be the same as for :" "meth:`~BaseHandler.http_error_default`." msgstr "" -#: library/urllib.request.rst:812 +#: library/urllib.request.rst:864 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to pre-process requests of the given protocol." msgstr "" -#: library/urllib.request.rst:815 +#: library/urllib.request.rst:867 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. The return value " "should be a :class:`Request` object." msgstr "" -#: library/urllib.request.rst:824 +#: library/urllib.request.rst:876 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to post-process responses of the given protocol." msgstr "" -#: library/urllib.request.rst:827 +#: library/urllib.request.rst:879 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " @@ -1011,25 +1086,25 @@ msgid "" "return value of :func:`urlopen`." msgstr "" -#: library/urllib.request.rst:837 +#: library/urllib.request.rst:889 msgid "HTTPRedirectHandler Objects" msgstr "" -#: library/urllib.request.rst:841 +#: library/urllib.request.rst:893 msgid "" "Some HTTP redirections require action from this module's client code. If " "this is the case, :exc:`~urllib.error.HTTPError` is raised. See :rfc:`2616` " "for details of the precise meanings of the various redirection codes." msgstr "" -#: library/urllib.request.rst:845 +#: library/urllib.request.rst:897 msgid "" "An :exc:`~urllib.error.HTTPError` exception raised as a security " "consideration if the HTTPRedirectHandler is presented with a redirected URL " "which is not an HTTP, HTTPS or FTP URL." msgstr "" -#: library/urllib.request.rst:852 +#: library/urllib.request.rst:904 msgid "" "Return a :class:`Request` or ``None`` in response to a redirect. This is " "called by the default implementations of the :meth:`!http_error_30\\*` " @@ -1040,7 +1115,7 @@ msgid "" "URL, or return ``None`` if you can't but another handler might." msgstr "" -#: library/urllib.request.rst:862 +#: library/urllib.request.rst:914 msgid "" "The default implementation of this method does not strictly follow :rfc:" "`2616`, which says that 301 and 302 responses to ``POST`` requests must not " @@ -1049,54 +1124,54 @@ msgid "" "POST to a ``GET``, and the default implementation reproduces this behavior." msgstr "" -#: library/urllib.request.rst:871 +#: library/urllib.request.rst:923 msgid "" "Redirect to the ``Location:`` or ``URI:`` URL. This method is called by the " "parent :class:`OpenerDirector` when getting an HTTP 'moved permanently' " "response." msgstr "" -#: library/urllib.request.rst:877 +#: library/urllib.request.rst:929 msgid "" "The same as :meth:`http_error_301`, but called for the 'found' response." msgstr "" -#: library/urllib.request.rst:882 +#: library/urllib.request.rst:934 msgid "" "The same as :meth:`http_error_301`, but called for the 'see other' response." msgstr "" -#: library/urllib.request.rst:887 +#: library/urllib.request.rst:939 msgid "" "The same as :meth:`http_error_301`, but called for the 'temporary redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: library/urllib.request.rst:894 +#: library/urllib.request.rst:946 msgid "" "The same as :meth:`http_error_301`, but called for the 'permanent redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: library/urllib.request.rst:904 +#: library/urllib.request.rst:956 msgid "HTTPCookieProcessor Objects" msgstr "" -#: library/urllib.request.rst:906 +#: library/urllib.request.rst:958 msgid ":class:`HTTPCookieProcessor` instances have one attribute:" msgstr "" -#: library/urllib.request.rst:910 +#: library/urllib.request.rst:962 msgid "The :class:`http.cookiejar.CookieJar` in which cookies are stored." msgstr "" -#: library/urllib.request.rst:916 +#: library/urllib.request.rst:968 msgid "ProxyHandler Objects" msgstr "" -#: library/urllib.request.rst:922 +#: library/urllib.request.rst:974 msgid "" "The :class:`ProxyHandler` will have a method :meth:`!_open` for " "every *protocol* which has a proxy in the *proxies* dictionary given in the " @@ -1105,17 +1180,17 @@ msgid "" "actually execute the protocol." msgstr "" -#: library/urllib.request.rst:932 +#: library/urllib.request.rst:984 msgid "HTTPPasswordMgr Objects" msgstr "" -#: library/urllib.request.rst:934 +#: library/urllib.request.rst:986 msgid "" "These methods are available on :class:`HTTPPasswordMgr` and :class:" "`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" -#: library/urllib.request.rst:940 +#: library/urllib.request.rst:992 msgid "" "*uri* can be either a single URI, or a sequence of URIs. *realm*, *user* and " "*passwd* must be strings. This causes ``(user, passwd)`` to be used as " @@ -1123,30 +1198,30 @@ msgid "" "of the given URIs is given." msgstr "" -#: library/urllib.request.rst:948 +#: library/urllib.request.rst:1000 msgid "" "Get user/password for given realm and URI, if any. This method will return " "``(None, None)`` if there is no matching user/password." msgstr "" -#: library/urllib.request.rst:951 +#: library/urllib.request.rst:1003 msgid "" "For :class:`HTTPPasswordMgrWithDefaultRealm` objects, the realm ``None`` " "will be searched if the given *realm* has no matching user/password." msgstr "" -#: library/urllib.request.rst:958 +#: library/urllib.request.rst:1010 msgid "HTTPPasswordMgrWithPriorAuth Objects" msgstr "" -#: library/urllib.request.rst:960 +#: library/urllib.request.rst:1012 msgid "" "This password manager extends :class:`HTTPPasswordMgrWithDefaultRealm` to " "support tracking URIs for which authentication credentials should always be " "sent." msgstr "" -#: library/urllib.request.rst:967 +#: library/urllib.request.rst:1019 msgid "" "*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." "add_password`. *is_authenticated* sets the initial value of the " @@ -1154,25 +1229,25 @@ msgid "" "*is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" -#: library/urllib.request.rst:975 +#: library/urllib.request.rst:1027 msgid "Same as for :class:`HTTPPasswordMgrWithDefaultRealm` objects" msgstr "" -#: library/urllib.request.rst:981 +#: library/urllib.request.rst:1033 msgid "" "Update the ``is_authenticated`` flag for the given *uri* or list of URIs." msgstr "" -#: library/urllib.request.rst:987 +#: library/urllib.request.rst:1039 msgid "" "Returns the current state of the ``is_authenticated`` flag for the given URI." msgstr "" -#: library/urllib.request.rst:994 +#: library/urllib.request.rst:1046 msgid "AbstractBasicAuthHandler Objects" msgstr "" -#: library/urllib.request.rst:999 +#: library/urllib.request.rst:1051 msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " @@ -1181,7 +1256,7 @@ msgid "" "`Request` object, and *headers* should be the error headers." msgstr "" -#: library/urllib.request.rst:1005 +#: library/urllib.request.rst:1057 msgid "" "*host* is either an authority (e.g. ``\"python.org\"``) or a URL containing " "an authority component (e.g. ``\"http://python.org/\"``). In either case, " @@ -1189,24 +1264,24 @@ msgid "" "and ``\"python.org:80\"`` are fine, ``\"joe:password@python.org\"`` is not)." msgstr "" -#: library/urllib.request.rst:1014 +#: library/urllib.request.rst:1066 msgid "HTTPBasicAuthHandler Objects" msgstr "" -#: library/urllib.request.rst:1019 library/urllib.request.rst:1030 -#: library/urllib.request.rst:1055 library/urllib.request.rst:1066 +#: library/urllib.request.rst:1071 library/urllib.request.rst:1082 +#: library/urllib.request.rst:1107 library/urllib.request.rst:1118 msgid "Retry the request with authentication information, if available." msgstr "" -#: library/urllib.request.rst:1025 +#: library/urllib.request.rst:1077 msgid "ProxyBasicAuthHandler Objects" msgstr "" -#: library/urllib.request.rst:1036 +#: library/urllib.request.rst:1088 msgid "AbstractDigestAuthHandler Objects" msgstr "" -#: library/urllib.request.rst:1041 +#: library/urllib.request.rst:1093 msgid "" "*authreq* should be the name of the header where the information about the " "realm is included in the request, *host* should be the host to authenticate " @@ -1214,109 +1289,109 @@ msgid "" "should be the error headers." msgstr "" -#: library/urllib.request.rst:1050 +#: library/urllib.request.rst:1102 msgid "HTTPDigestAuthHandler Objects" msgstr "" -#: library/urllib.request.rst:1061 +#: library/urllib.request.rst:1113 msgid "ProxyDigestAuthHandler Objects" msgstr "" -#: library/urllib.request.rst:1072 +#: library/urllib.request.rst:1124 msgid "HTTPHandler Objects" msgstr "" -#: library/urllib.request.rst:1077 +#: library/urllib.request.rst:1129 msgid "" "Send an HTTP request, which can be either GET or POST, depending on ``req." -"has_data()``." +"data``." msgstr "" -#: library/urllib.request.rst:1084 +#: library/urllib.request.rst:1136 msgid "HTTPSHandler Objects" msgstr "" -#: library/urllib.request.rst:1089 +#: library/urllib.request.rst:1141 msgid "" "Send an HTTPS request, which can be either GET or POST, depending on ``req." -"has_data()``." +"data``." msgstr "" -#: library/urllib.request.rst:1096 +#: library/urllib.request.rst:1148 msgid "FileHandler Objects" msgstr "" -#: library/urllib.request.rst:1101 +#: library/urllib.request.rst:1153 msgid "" "Open the file locally, if there is no host name, or the host name is " "``'localhost'``." msgstr "" -#: library/urllib.request.rst:1104 +#: library/urllib.request.rst:1156 msgid "" "This method is applicable only for local hostnames. When a remote hostname " -"is given, an :exc:`~urllib.error.URLError` is raised." +"is given, a :exc:`~urllib.error.URLError` is raised." msgstr "" -#: library/urllib.request.rst:1112 +#: library/urllib.request.rst:1164 msgid "DataHandler Objects" msgstr "" -#: library/urllib.request.rst:1116 +#: library/urllib.request.rst:1168 msgid "" "Read a data URL. This kind of URL contains the content encoded in the URL " "itself. The data URL syntax is specified in :rfc:`2397`. This implementation " "ignores white spaces in base64 encoded data URLs so the URL may be wrapped " "in whatever source file it comes from. But even though some browsers don't " "mind about a missing padding at the end of a base64 encoded data URL, this " -"implementation will raise an :exc:`ValueError` in that case." +"implementation will raise a :exc:`ValueError` in that case." msgstr "" -#: library/urllib.request.rst:1127 +#: library/urllib.request.rst:1179 msgid "FTPHandler Objects" msgstr "" -#: library/urllib.request.rst:1132 +#: library/urllib.request.rst:1184 msgid "" "Open the FTP file indicated by *req*. The login is always done with empty " "username and password." msgstr "" -#: library/urllib.request.rst:1139 +#: library/urllib.request.rst:1191 msgid "CacheFTPHandler Objects" msgstr "" -#: library/urllib.request.rst:1141 +#: library/urllib.request.rst:1193 msgid "" ":class:`CacheFTPHandler` objects are :class:`FTPHandler` objects with the " "following additional methods:" msgstr "" -#: library/urllib.request.rst:1147 +#: library/urllib.request.rst:1199 msgid "Set timeout of connections to *t* seconds." msgstr "" -#: library/urllib.request.rst:1152 +#: library/urllib.request.rst:1204 msgid "Set maximum number of cached connections to *m*." msgstr "" -#: library/urllib.request.rst:1158 +#: library/urllib.request.rst:1210 msgid "UnknownHandler Objects" msgstr "" -#: library/urllib.request.rst:1163 +#: library/urllib.request.rst:1215 msgid "Raise a :exc:`~urllib.error.URLError` exception." msgstr "" -#: library/urllib.request.rst:1169 +#: library/urllib.request.rst:1221 msgid "HTTPErrorProcessor Objects" msgstr "" -#: library/urllib.request.rst:1175 +#: library/urllib.request.rst:1227 msgid "For 200 error codes, the response object is returned immediately." msgstr "" -#: library/urllib.request.rst:1177 +#: library/urllib.request.rst:1229 msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " @@ -1324,31 +1399,43 @@ msgid "" "error.HTTPError` if no other handler handles the error." msgstr "" -#: library/urllib.request.rst:1185 +#: library/urllib.request.rst:1237 msgid "Process HTTPS error responses." msgstr "" -#: library/urllib.request.rst:1187 +#: library/urllib.request.rst:1239 msgid "The behavior is same as :meth:`http_response`." msgstr "" -#: library/urllib.request.rst:1193 +#: library/urllib.request.rst:1245 msgid "Examples" msgstr "" -#: library/urllib.request.rst:1195 +#: library/urllib.request.rst:1247 msgid "" "In addition to the examples below, more examples are given in :ref:`urllib-" "howto`." msgstr "" -#: library/urllib.request.rst:1198 +#: library/urllib.request.rst:1250 msgid "" "This example gets the python.org main page and displays the first 300 bytes " -"of it. ::" +"of it::" msgstr "" -#: library/urllib.request.rst:1211 +#: library/urllib.request.rst:1253 +msgid "" +">>> import urllib.request\n" +">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" +"... print(f.read(300))\n" +"...\n" +"b'\\n\\n\\n\n" +">> import urllib.request\n" +">>> f = urllib.request.urlopen('http://www.python.org/')\n" +">>> try:\n" +"... print(f.read(100).decode('utf-8'))\n" +"... finally:\n" +"... f.close()\n" +"...\n" +"\n" +"\n" +"', char.text)" +msgstr "" + +#: library/xml.etree.elementtree.rst:348 msgid "" "A better way to search the namespaced XML example is to create a dictionary " "with your own prefixes and use those in the search functions::" msgstr "" -#: library/xml.etree.elementtree.rst:361 +#: library/xml.etree.elementtree.rst:351 +msgid "" +"ns = {'real_person': 'http://people.example.com',\n" +" 'role': 'http://characters.example.com'}\n" +"\n" +"for actor in root.findall('real_person:actor', ns):\n" +" name = actor.find('real_person:name', ns)\n" +" print(name.text)\n" +" for char in actor.findall('role:character', ns):\n" +" print(' |-->', char.text)" +msgstr "" + +#: library/xml.etree.elementtree.rst:360 msgid "These two approaches both output::" msgstr "" -#: library/xml.etree.elementtree.rst:375 +#: library/xml.etree.elementtree.rst:362 +msgid "" +"John Cleese\n" +" |--> Lancelot\n" +" |--> Archie Leach\n" +"Eric Idle\n" +" |--> Sir Robin\n" +" |--> Gunther\n" +" |--> Commander Clement" +msgstr "" + +#: library/xml.etree.elementtree.rst:374 msgid "XPath support" msgstr "" -#: library/xml.etree.elementtree.rst:377 +#: library/xml.etree.elementtree.rst:376 msgid "" "This module provides limited support for `XPath expressions `_ for locating elements in a tree. The goal is to support a " @@ -295,40 +526,69 @@ msgid "" "scope of the module." msgstr "" -#: library/xml.etree.elementtree.rst:383 library/xml.etree.elementtree.rst:777 +#: library/xml.etree.elementtree.rst:382 library/xml.etree.elementtree.rst:781 msgid "Example" msgstr "" -#: library/xml.etree.elementtree.rst:385 +#: library/xml.etree.elementtree.rst:384 msgid "" "Here's an example that demonstrates some of the XPath capabilities of the " "module. We'll be using the ``countrydata`` XML document from the :ref:" "`Parsing XML ` section::" msgstr "" -#: library/xml.etree.elementtree.rst:409 +#: library/xml.etree.elementtree.rst:388 +msgid "" +"import xml.etree.ElementTree as ET\n" +"\n" +"root = ET.fromstring(countrydata)\n" +"\n" +"# Top-level elements\n" +"root.findall(\".\")\n" +"\n" +"# All 'neighbor' grand-children of 'country' children of the top-level\n" +"# elements\n" +"root.findall(\"./country/neighbor\")\n" +"\n" +"# Nodes with name='Singapore' that have a 'year' child\n" +"root.findall(\".//year/..[@name='Singapore']\")\n" +"\n" +"# 'year' nodes that are children of nodes with name='Singapore'\n" +"root.findall(\".//*[@name='Singapore']/year\")\n" +"\n" +"# All 'neighbor' nodes that are the second child of their parent\n" +"root.findall(\".//neighbor[2]\")" +msgstr "" + +#: library/xml.etree.elementtree.rst:408 msgid "" "For XML with namespaces, use the usual qualified ``{namespace}tag`` " "notation::" msgstr "" -#: library/xml.etree.elementtree.rst:416 +#: library/xml.etree.elementtree.rst:410 +msgid "" +"# All dublin-core \"title\" tags in the document\n" +"root.findall(\".//{http://purl.org/dc/elements/1.1/}title\")" +msgstr "" + +#: library/xml.etree.elementtree.rst:415 msgid "Supported XPath syntax" msgstr "" -#: library/xml.etree.elementtree.rst:421 +#: library/xml.etree.elementtree.rst:420 msgid "Syntax" msgstr "" -#: library/xml.etree.elementtree.rst:421 +#: library/xml.etree.elementtree.rst:420 msgid "Meaning" msgstr "" -#: library/xml.etree.elementtree.rst:423 +#: library/xml.etree.elementtree.rst:422 msgid "``tag``" msgstr "" -#: library/xml.etree.elementtree.rst:423 +#: library/xml.etree.elementtree.rst:422 msgid "" "Selects all child elements with the given tag. For example, ``spam`` selects " "all child elements named ``spam``, and ``spam/egg`` selects all " @@ -338,133 +598,133 @@ msgid "" "not in a namespace." msgstr "" -#: library/xml.etree.elementtree.rst:432 +#: library/xml.etree.elementtree.rst:431 msgid "Support for star-wildcards was added." msgstr "" -#: library/xml.etree.elementtree.rst:435 +#: library/xml.etree.elementtree.rst:434 msgid "``*``" msgstr "" -#: library/xml.etree.elementtree.rst:435 +#: library/xml.etree.elementtree.rst:434 msgid "" "Selects all child elements, including comments and processing instructions. " "For example, ``*/egg`` selects all grandchildren named ``egg``." msgstr "" -#: library/xml.etree.elementtree.rst:439 +#: library/xml.etree.elementtree.rst:438 msgid "``.``" msgstr "" -#: library/xml.etree.elementtree.rst:439 +#: library/xml.etree.elementtree.rst:438 msgid "" "Selects the current node. This is mostly useful at the beginning of the " "path, to indicate that it's a relative path." msgstr "" -#: library/xml.etree.elementtree.rst:443 +#: library/xml.etree.elementtree.rst:442 msgid "``//``" msgstr "" -#: library/xml.etree.elementtree.rst:443 +#: library/xml.etree.elementtree.rst:442 msgid "" "Selects all subelements, on all levels beneath the current element. For " "example, ``.//egg`` selects all ``egg`` elements in the entire tree." msgstr "" -#: library/xml.etree.elementtree.rst:447 +#: library/xml.etree.elementtree.rst:446 msgid "``..``" msgstr "" -#: library/xml.etree.elementtree.rst:447 +#: library/xml.etree.elementtree.rst:446 msgid "" "Selects the parent element. Returns ``None`` if the path attempts to reach " "the ancestors of the start element (the element ``find`` was called on)." msgstr "" -#: library/xml.etree.elementtree.rst:451 +#: library/xml.etree.elementtree.rst:450 msgid "``[@attrib]``" msgstr "" -#: library/xml.etree.elementtree.rst:451 +#: library/xml.etree.elementtree.rst:450 msgid "Selects all elements that have the given attribute." msgstr "" -#: library/xml.etree.elementtree.rst:453 +#: library/xml.etree.elementtree.rst:452 msgid "``[@attrib='value']``" msgstr "" -#: library/xml.etree.elementtree.rst:453 +#: library/xml.etree.elementtree.rst:452 msgid "" "Selects all elements for which the given attribute has the given value. The " "value cannot contain quotes." msgstr "" -#: library/xml.etree.elementtree.rst:457 +#: library/xml.etree.elementtree.rst:456 msgid "``[@attrib!='value']``" msgstr "" -#: library/xml.etree.elementtree.rst:457 +#: library/xml.etree.elementtree.rst:456 msgid "" "Selects all elements for which the given attribute does not have the given " "value. The value cannot contain quotes." msgstr "" -#: library/xml.etree.elementtree.rst:463 +#: library/xml.etree.elementtree.rst:462 msgid "``[tag]``" msgstr "" -#: library/xml.etree.elementtree.rst:463 +#: library/xml.etree.elementtree.rst:462 msgid "" "Selects all elements that have a child named ``tag``. Only immediate " "children are supported." msgstr "" -#: library/xml.etree.elementtree.rst:466 +#: library/xml.etree.elementtree.rst:465 msgid "``[.='text']``" msgstr "" -#: library/xml.etree.elementtree.rst:466 +#: library/xml.etree.elementtree.rst:465 msgid "" "Selects all elements whose complete text content, including descendants, " "equals the given ``text``." msgstr "" -#: library/xml.etree.elementtree.rst:471 +#: library/xml.etree.elementtree.rst:470 msgid "``[.!='text']``" msgstr "" -#: library/xml.etree.elementtree.rst:471 +#: library/xml.etree.elementtree.rst:470 msgid "" "Selects all elements whose complete text content, including descendants, " "does not equal the given ``text``." msgstr "" -#: library/xml.etree.elementtree.rst:477 +#: library/xml.etree.elementtree.rst:476 msgid "``[tag='text']``" msgstr "" -#: library/xml.etree.elementtree.rst:477 +#: library/xml.etree.elementtree.rst:476 msgid "" "Selects all elements that have a child named ``tag`` whose complete text " "content, including descendants, equals the given ``text``." msgstr "" -#: library/xml.etree.elementtree.rst:481 +#: library/xml.etree.elementtree.rst:480 msgid "``[tag!='text']``" msgstr "" -#: library/xml.etree.elementtree.rst:481 +#: library/xml.etree.elementtree.rst:480 msgid "" "Selects all elements that have a child named ``tag`` whose complete text " "content, including descendants, does not equal the given ``text``." msgstr "" -#: library/xml.etree.elementtree.rst:487 +#: library/xml.etree.elementtree.rst:486 msgid "``[position]``" msgstr "" -#: library/xml.etree.elementtree.rst:487 +#: library/xml.etree.elementtree.rst:486 msgid "" "Selects all elements that are located at the given position. The position " "can be either an integer (1 is the first position), the expression " @@ -472,35 +732,35 @@ msgid "" "position (e.g. ``last()-1``)." msgstr "" -#: library/xml.etree.elementtree.rst:494 +#: library/xml.etree.elementtree.rst:493 msgid "" "Predicates (expressions within square brackets) must be preceded by a tag " "name, an asterisk, or another predicate. ``position`` predicates must be " "preceded by a tag name." msgstr "" -#: library/xml.etree.elementtree.rst:499 library/xml.etree.elementtree.rst:829 +#: library/xml.etree.elementtree.rst:498 library/xml.etree.elementtree.rst:833 msgid "Reference" msgstr "" -#: library/xml.etree.elementtree.rst:504 library/xml.etree.elementtree.rst:834 +#: library/xml.etree.elementtree.rst:503 library/xml.etree.elementtree.rst:838 msgid "Functions" msgstr "" -#: library/xml.etree.elementtree.rst:508 +#: library/xml.etree.elementtree.rst:507 msgid "`C14N 2.0 `_ transformation function." msgstr "" -#: library/xml.etree.elementtree.rst:510 +#: library/xml.etree.elementtree.rst:509 msgid "" "Canonicalization is a way to normalise XML output in a way that allows byte-" -"by-byte comparisons and digital signatures. It reduced the freedom that XML " +"by-byte comparisons and digital signatures. It reduces the freedom that XML " "serializers have and instead generates a more constrained XML " "representation. The main restrictions regard the placement of namespace " "declarations, the ordering of attributes, and ignorable whitespace." msgstr "" -#: library/xml.etree.elementtree.rst:516 +#: library/xml.etree.elementtree.rst:515 msgid "" "This function takes an XML data string (*xml_data*) or a file path or file-" "like object (*from_file*) as input, converts it to the canonical form, and " @@ -509,61 +769,73 @@ msgid "" "should therefore be opened in text mode with ``utf-8`` encoding." msgstr "" -#: library/xml.etree.elementtree.rst:523 +#: library/xml.etree.elementtree.rst:522 msgid "Typical uses::" msgstr "" -#: library/xml.etree.elementtree.rst:534 +#: library/xml.etree.elementtree.rst:524 +msgid "" +"xml_data = \"...\"\n" +"print(canonicalize(xml_data))\n" +"\n" +"with open(\"c14n_output.xml\", mode='w', encoding='utf-8') as out_file:\n" +" canonicalize(xml_data, out=out_file)\n" +"\n" +"with open(\"c14n_output.xml\", mode='w', encoding='utf-8') as out_file:\n" +" canonicalize(from_file=\"inputfile.xml\", out=out_file)" +msgstr "" + +#: library/xml.etree.elementtree.rst:533 msgid "The configuration *options* are as follows:" msgstr "" -#: library/xml.etree.elementtree.rst:536 +#: library/xml.etree.elementtree.rst:535 msgid "*with_comments*: set to true to include comments (default: false)" msgstr "" -#: library/xml.etree.elementtree.rst:537 +#: library/xml.etree.elementtree.rst:536 msgid "" "*strip_text*: set to true to strip whitespace before and after text content" msgstr "" -#: library/xml.etree.elementtree.rst:538 library/xml.etree.elementtree.rst:540 +#: library/xml.etree.elementtree.rst:537 library/xml.etree.elementtree.rst:539 msgid "(default: false)" msgstr "" -#: library/xml.etree.elementtree.rst:539 +#: library/xml.etree.elementtree.rst:538 msgid "" "*rewrite_prefixes*: set to true to replace namespace prefixes by " "\"n{number}\"" msgstr "" -#: library/xml.etree.elementtree.rst:541 +#: library/xml.etree.elementtree.rst:540 msgid "*qname_aware_tags*: a set of qname aware tag names in which prefixes" msgstr "" -#: library/xml.etree.elementtree.rst:542 library/xml.etree.elementtree.rst:544 +#: library/xml.etree.elementtree.rst:541 library/xml.etree.elementtree.rst:543 msgid "should be replaced in text content (default: empty)" msgstr "" -#: library/xml.etree.elementtree.rst:543 +#: library/xml.etree.elementtree.rst:542 msgid "" "*qname_aware_attrs*: a set of qname aware attribute names in which prefixes" msgstr "" -#: library/xml.etree.elementtree.rst:545 +#: library/xml.etree.elementtree.rst:544 msgid "*exclude_attrs*: a set of attribute names that should not be serialised" msgstr "" -#: library/xml.etree.elementtree.rst:546 +#: library/xml.etree.elementtree.rst:545 msgid "*exclude_tags*: a set of tag names that should not be serialised" msgstr "" -#: library/xml.etree.elementtree.rst:548 +#: library/xml.etree.elementtree.rst:547 msgid "" "In the option list above, \"a set\" refers to any collection or iterable of " "strings, no ordering is expected." msgstr "" -#: library/xml.etree.elementtree.rst:556 +#: library/xml.etree.elementtree.rst:555 msgid "" "Comment element factory. This factory function creates a special element " "that will be serialized as an XML comment by the standard serializer. The " @@ -572,7 +844,7 @@ msgid "" "representing a comment." msgstr "" -#: library/xml.etree.elementtree.rst:562 +#: library/xml.etree.elementtree.rst:561 msgid "" "Note that :class:`XMLParser` skips over comments in the input instead of " "creating comment objects for them. An :class:`ElementTree` will only contain " @@ -580,29 +852,29 @@ msgid "" "class:`Element` methods." msgstr "" -#: library/xml.etree.elementtree.rst:569 +#: library/xml.etree.elementtree.rst:568 msgid "" "Writes an element tree or element structure to sys.stdout. This function " "should be used for debugging only." msgstr "" -#: library/xml.etree.elementtree.rst:572 +#: library/xml.etree.elementtree.rst:571 msgid "" "The exact output format is implementation dependent. In this version, it's " "written as an ordinary XML file." msgstr "" -#: library/xml.etree.elementtree.rst:575 +#: library/xml.etree.elementtree.rst:574 msgid "*elem* is an element tree or an individual element." msgstr "" -#: library/xml.etree.elementtree.rst:577 +#: library/xml.etree.elementtree.rst:576 msgid "" "The :func:`dump` function now preserves the attribute order specified by the " "user." msgstr "" -#: library/xml.etree.elementtree.rst:584 +#: library/xml.etree.elementtree.rst:583 msgid "" "Parses an XML section from a string constant. Same as :func:`XML`. *text* " "is a string containing XML data. *parser* is an optional parser instance. " @@ -610,7 +882,7 @@ msgid "" "class:`Element` instance." msgstr "" -#: library/xml.etree.elementtree.rst:592 +#: library/xml.etree.elementtree.rst:591 msgid "" "Parses an XML document from a sequence of string fragments. *sequence* is a " "list or other sequence containing XML data fragments. *parser* is an " @@ -618,7 +890,7 @@ msgid "" "parser is used. Returns an :class:`Element` instance." msgstr "" -#: library/xml.etree.elementtree.rst:602 +#: library/xml.etree.elementtree.rst:601 msgid "" "Appends whitespace to the subtree to indent the tree visually. This can be " "used to generate pretty-printed XML output. *tree* can be an Element or " @@ -628,13 +900,13 @@ msgid "" "indentation level as *level*." msgstr "" -#: library/xml.etree.elementtree.rst:614 +#: library/xml.etree.elementtree.rst:613 msgid "" "Check if an object appears to be a valid element object. *element* is an " "element instance. Return ``True`` if this is an element object." msgstr "" -#: library/xml.etree.elementtree.rst:620 +#: library/xml.etree.elementtree.rst:619 msgid "" "Parses an XML section into an element tree incrementally, and reports what's " "going on to the user. *source* is a filename or :term:`file object` " @@ -648,10 +920,11 @@ msgid "" "the default :class:`TreeBuilder` as a target. Returns an :term:`iterator` " "providing ``(event, elem)`` pairs; it has a ``root`` attribute that " "references the root element of the resulting XML tree once *source* is fully " -"read." +"read. The iterator has the :meth:`!close` method that closes the internal " +"file object if *source* is a filename." msgstr "" -#: library/xml.etree.elementtree.rst:634 +#: library/xml.etree.elementtree.rst:635 msgid "" "Note that while :func:`iterparse` builds the tree incrementally, it issues " "blocking reads on *source* (or the file it names). As such, it's unsuitable " @@ -659,7 +932,7 @@ msgid "" "parsing, see :class:`XMLPullParser`." msgstr "" -#: library/xml.etree.elementtree.rst:641 +#: library/xml.etree.elementtree.rst:642 msgid "" ":func:`iterparse` only guarantees that it has seen the \">\" character of a " "starting tag when it emits a \"start\" event, so the attributes are defined, " @@ -668,19 +941,23 @@ msgid "" "present." msgstr "" -#: library/xml.etree.elementtree.rst:647 library/xml.etree.elementtree.rst:1520 +#: library/xml.etree.elementtree.rst:648 library/xml.etree.elementtree.rst:1521 msgid "If you need a fully populated element, look for \"end\" events instead." msgstr "" -#: library/xml.etree.elementtree.rst:649 +#: library/xml.etree.elementtree.rst:650 msgid "The *parser* argument." msgstr "" -#: library/xml.etree.elementtree.rst:652 library/xml.etree.elementtree.rst:1524 +#: library/xml.etree.elementtree.rst:653 library/xml.etree.elementtree.rst:1525 msgid "The ``comment`` and ``pi`` events were added." msgstr "" -#: library/xml.etree.elementtree.rst:658 +#: library/xml.etree.elementtree.rst:656 +msgid "Added the :meth:`!close` method." +msgstr "" + +#: library/xml.etree.elementtree.rst:662 msgid "" "Parses an XML section into an element tree. *source* is a filename or file " "object containing XML data. *parser* is an optional parser instance. If " @@ -688,7 +965,7 @@ msgid "" "class:`ElementTree` instance." msgstr "" -#: library/xml.etree.elementtree.rst:666 +#: library/xml.etree.elementtree.rst:670 msgid "" "PI element factory. This factory function creates a special element that " "will be serialized as an XML processing instruction. *target* is a string " @@ -696,7 +973,7 @@ msgid "" "given. Returns an element instance, representing a processing instruction." msgstr "" -#: library/xml.etree.elementtree.rst:671 +#: library/xml.etree.elementtree.rst:675 msgid "" "Note that :class:`XMLParser` skips over processing instructions in the input " "instead of creating PI objects for them. An :class:`ElementTree` will only " @@ -704,7 +981,7 @@ msgid "" "tree using one of the :class:`Element` methods." msgstr "" -#: library/xml.etree.elementtree.rst:679 +#: library/xml.etree.elementtree.rst:683 msgid "" "Registers a namespace prefix. The registry is global, and any existing " "mapping for either the given prefix or the namespace URI will be removed. " @@ -713,13 +990,13 @@ msgid "" "all possible." msgstr "" -#: library/xml.etree.elementtree.rst:690 +#: library/xml.etree.elementtree.rst:694 msgid "" "Subelement factory. This function creates an element instance, and appends " "it to an existing element." msgstr "" -#: library/xml.etree.elementtree.rst:693 +#: library/xml.etree.elementtree.rst:697 msgid "" "The element name, attribute names, and attribute values can be either " "bytestrings or Unicode strings. *parent* is the parent element. *tag* is " @@ -728,7 +1005,7 @@ msgid "" "arguments. Returns an element instance." msgstr "" -#: library/xml.etree.elementtree.rst:704 +#: library/xml.etree.elementtree.rst:708 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -740,22 +1017,22 @@ msgid "" "Returns an (optionally) encoded string containing the XML data." msgstr "" -#: library/xml.etree.elementtree.rst:713 library/xml.etree.elementtree.rst:740 -#: library/xml.etree.elementtree.rst:1197 +#: library/xml.etree.elementtree.rst:717 library/xml.etree.elementtree.rst:744 +#: library/xml.etree.elementtree.rst:1198 msgid "Added the *short_empty_elements* parameter." msgstr "" -#: library/xml.etree.elementtree.rst:716 library/xml.etree.elementtree.rst:743 +#: library/xml.etree.elementtree.rst:720 library/xml.etree.elementtree.rst:747 msgid "Added the *xml_declaration* and *default_namespace* parameters." msgstr "" -#: library/xml.etree.elementtree.rst:719 +#: library/xml.etree.elementtree.rst:723 msgid "" "The :func:`tostring` function now preserves the attribute order specified by " "the user." msgstr "" -#: library/xml.etree.elementtree.rst:728 +#: library/xml.etree.elementtree.rst:732 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -769,13 +1046,13 @@ msgid "" "join(tostringlist(element)) == tostring(element)``." msgstr "" -#: library/xml.etree.elementtree.rst:746 +#: library/xml.etree.elementtree.rst:750 msgid "" "The :func:`tostringlist` function now preserves the attribute order " "specified by the user." msgstr "" -#: library/xml.etree.elementtree.rst:753 +#: library/xml.etree.elementtree.rst:757 msgid "" "Parses an XML section from a string constant. This function can be used to " "embed \"XML literals\" in Python code. *text* is a string containing XML " @@ -783,7 +1060,7 @@ msgid "" "class:`XMLParser` parser is used. Returns an :class:`Element` instance." msgstr "" -#: library/xml.etree.elementtree.rst:761 +#: library/xml.etree.elementtree.rst:765 msgid "" "Parses an XML section from a string constant, and also returns a dictionary " "which maps from element id:s to elements. *text* is a string containing XML " @@ -792,11 +1069,11 @@ msgid "" "`Element` instance and a dictionary." msgstr "" -#: library/xml.etree.elementtree.rst:771 +#: library/xml.etree.elementtree.rst:775 msgid "XInclude support" msgstr "" -#: library/xml.etree.elementtree.rst:773 +#: library/xml.etree.elementtree.rst:777 msgid "" "This module provides limited support for `XInclude directives `_, via the :mod:`xml.etree.ElementInclude` helper " @@ -804,7 +1081,7 @@ msgid "" "element trees, based on information in the tree." msgstr "" -#: library/xml.etree.elementtree.rst:779 +#: library/xml.etree.elementtree.rst:783 msgid "" "Here's an example that demonstrates use of the XInclude module. To include " "an XML document in the current document, use the ``{http://www.w3.org/2001/" @@ -812,76 +1089,111 @@ msgid "" "and use the **href** attribute to specify the document to include." msgstr "" -#: library/xml.etree.elementtree.rst:788 +#: library/xml.etree.elementtree.rst:785 +msgid "" +"\n" +"\n" +" \n" +"" +msgstr "" + +#: library/xml.etree.elementtree.rst:792 msgid "" "By default, the **href** attribute is treated as a file name. You can use " "custom loaders to override this behaviour. Also note that the standard " "helper does not support XPointer syntax." msgstr "" -#: library/xml.etree.elementtree.rst:790 +#: library/xml.etree.elementtree.rst:794 msgid "" "To process this file, load it as usual, and pass the root element to the :" "mod:`xml.etree.ElementTree` module:" msgstr "" -#: library/xml.etree.elementtree.rst:801 +#: library/xml.etree.elementtree.rst:796 +msgid "" +"from xml.etree import ElementTree, ElementInclude\n" +"\n" +"tree = ElementTree.parse(\"document.xml\")\n" +"root = tree.getroot()\n" +"\n" +"ElementInclude.include(root)" +msgstr "" + +#: library/xml.etree.elementtree.rst:805 msgid "" "The ElementInclude module replaces the ``{http://www.w3.org/2001/XInclude}" "include`` element with the root element from the **source.xml** document. " "The result might look something like this:" msgstr "" -#: library/xml.etree.elementtree.rst:809 +#: library/xml.etree.elementtree.rst:807 +msgid "" +"\n" +" This is a paragraph.\n" +"" +msgstr "" + +#: library/xml.etree.elementtree.rst:813 msgid "" "If the **parse** attribute is omitted, it defaults to \"xml\". The href " "attribute is required." msgstr "" -#: library/xml.etree.elementtree.rst:811 +#: library/xml.etree.elementtree.rst:815 msgid "" "To include a text document, use the ``{http://www.w3.org/2001/XInclude}" "include`` element, and set the **parse** attribute to \"text\":" msgstr "" -#: library/xml.etree.elementtree.rst:820 +#: library/xml.etree.elementtree.rst:817 +msgid "" +"\n" +"\n" +" Copyright (c) .\n" +"" +msgstr "" + +#: library/xml.etree.elementtree.rst:824 msgid "The result might look something like:" msgstr "" -#: library/xml.etree.elementtree.rst:841 +#: library/xml.etree.elementtree.rst:826 msgid "" -"Default loader. This default loader reads an included resource from disk. " -"*href* is a URL. *parse* is for parse mode either \"xml\" or \"text\". " -"*encoding* is an optional text encoding. If not given, encoding is " -"``utf-8``. Returns the expanded resource. If the parse mode is " -"``\"xml\"``, this is an ElementTree instance. If the parse mode is " -"\"text\", this is a Unicode string. If the loader fails, it can return None " -"or raise an exception." +"\n" +" Copyright (c) 2003.\n" +"" msgstr "" -#: library/xml.etree.elementtree.rst:853 +#: library/xml.etree.elementtree.rst:844 msgid "" -"This function expands XInclude directives. *elem* is the root element. " -"*loader* is an optional resource loader. If omitted, it defaults to :func:" -"`default_loader`. If given, it should be a callable that implements the same " -"interface as :func:`default_loader`. *base_url* is base URL of the original " -"file, to resolve relative include file references. *max_depth* is the " -"maximum number of recursive inclusions. Limited to reduce the risk of " -"malicious content explosion. Pass a negative value to disable the limitation." +"Default loader. This default loader reads an included resource from disk. " +"*href* is a URL. *parse* is for parse mode either \"xml\" or \"text\". " +"*encoding* is an optional text encoding. If not given, encoding is " +"``utf-8``. Returns the expanded resource. If the parse mode is ``\"xml\"``, " +"this is an :class:`~xml.etree.ElementTree.Element` instance. If the parse " +"mode is ``\"text\"``, this is a string. If the loader fails, it can return " +"``None`` or raise an exception." msgstr "" -#: library/xml.etree.elementtree.rst:861 +#: library/xml.etree.elementtree.rst:855 msgid "" -"Returns the expanded resource. If the parse mode is ``\"xml\"``, this is an " -"ElementTree instance. If the parse mode is \"text\", this is a Unicode " -"string. If the loader fails, it can return None or raise an exception." +"This function expands XInclude directives in-place in tree pointed by " +"*elem*. *elem* is either the root :class:`~xml.etree.ElementTree.Element` or " +"an :class:`~xml.etree.ElementTree.ElementTree` instance to find such " +"element. *loader* is an optional resource loader. If omitted, it defaults " +"to :func:`default_loader`. If given, it should be a callable that implements " +"the same interface as :func:`default_loader`. *base_url* is base URL of the " +"original file, to resolve relative include file references. *max_depth* is " +"the maximum number of recursive inclusions. Limited to reduce the risk of " +"malicious content explosion. Pass ``None`` to disable the limitation." msgstr "" -#: library/xml.etree.elementtree.rst:866 +#: library/xml.etree.elementtree.rst:865 msgid "Added the *base_url* and *max_depth* parameters." msgstr "" -#: library/xml.etree.elementtree.rst:873 +#: library/xml.etree.elementtree.rst:872 msgid "Element Objects" msgstr "" @@ -916,6 +1228,10 @@ msgid "" "the XML data" msgstr "" +#: library/xml.etree.elementtree.rst:906 +msgid "1234" +msgstr "" + #: library/xml.etree.elementtree.rst:910 msgid "" "the *a* element has ``None`` for both *text* and *tail* attributes, the *b* " @@ -991,8 +1307,8 @@ msgstr "" #: library/xml.etree.elementtree.rst:973 msgid "" -"Appends *subelements* from a sequence object with zero or more elements. " -"Raises :exc:`TypeError` if a subelement is not an :class:`Element`." +"Appends *subelements* from an iterable of elements. Raises :exc:`TypeError` " +"if a subelement is not an :class:`Element`." msgstr "" #: library/xml.etree.elementtree.rst:981 @@ -1075,16 +1391,28 @@ msgstr "" #: library/xml.etree.elementtree.rst:1061 msgid "" -"Caution: Elements with no subelements will test as ``False``. Testing the " -"truth value of an Element is deprecated and will raise an exception in " -"Python 3.14. Use specific ``len(elem)`` or ``elem is None`` test instead.::" +"Caution: Elements with no subelements will test as ``False``. In a future " +"release of Python, all elements will test as ``True`` regardless of whether " +"subelements exist. Instead, prefer explicit ``len(elem)`` or ``elem is not " +"None`` tests.::" msgstr "" -#: library/xml.etree.elementtree.rst:1073 +#: library/xml.etree.elementtree.rst:1066 +msgid "" +"element = root.find('foo')\n" +"\n" +"if not element: # careful!\n" +" print(\"element not found, or element has no subelements\")\n" +"\n" +"if element is None:\n" +" print(\"element not found\")" +msgstr "" + +#: library/xml.etree.elementtree.rst:1074 msgid "Testing the truth value of an Element emits :exc:`DeprecationWarning`." msgstr "" -#: library/xml.etree.elementtree.rst:1076 +#: library/xml.etree.elementtree.rst:1077 msgid "" "Prior to Python 3.8, the serialisation order of the XML attributes of " "elements was artificially made predictable by sorting the attributes by " @@ -1093,7 +1421,7 @@ msgid "" "attributes were originally parsed or created by user code." msgstr "" -#: library/xml.etree.elementtree.rst:1082 +#: library/xml.etree.elementtree.rst:1083 msgid "" "In general, user code should try not to depend on a specific ordering of " "attributes, given that the `XML Information Set 1:\n" +" # adjust attribute order, e.g. by sorting\n" +" attribs = sorted(attrib.items())\n" +" attrib.clear()\n" +" attrib.update(attribs)" +msgstr "" + +#: library/xml.etree.elementtree.rst:1111 msgid "ElementTree Objects" msgstr "" -#: library/xml.etree.elementtree.rst:1115 +#: library/xml.etree.elementtree.rst:1116 msgid "" "ElementTree wrapper class. This class represents an entire element " "hierarchy, and adds some extra support for serialization to and from " "standard XML." msgstr "" -#: library/xml.etree.elementtree.rst:1119 +#: library/xml.etree.elementtree.rst:1120 msgid "" "*element* is the root element. The tree is initialized with the contents of " "the XML *file* if given." msgstr "" -#: library/xml.etree.elementtree.rst:1125 +#: library/xml.etree.elementtree.rst:1126 msgid "" "Replaces the root element for this tree. This discards the current contents " "of the tree, and replaces it with the given element. Use with care. " "*element* is an element instance." msgstr "" -#: library/xml.etree.elementtree.rst:1132 +#: library/xml.etree.elementtree.rst:1133 msgid "Same as :meth:`Element.find`, starting at the root of the tree." msgstr "" -#: library/xml.etree.elementtree.rst:1137 +#: library/xml.etree.elementtree.rst:1138 msgid "Same as :meth:`Element.findall`, starting at the root of the tree." msgstr "" -#: library/xml.etree.elementtree.rst:1142 +#: library/xml.etree.elementtree.rst:1143 msgid "Same as :meth:`Element.findtext`, starting at the root of the tree." msgstr "" -#: library/xml.etree.elementtree.rst:1147 +#: library/xml.etree.elementtree.rst:1148 msgid "Returns the root element for this tree." msgstr "" -#: library/xml.etree.elementtree.rst:1152 +#: library/xml.etree.elementtree.rst:1153 msgid "" "Creates and returns a tree iterator for the root element. The iterator " "loops over all elements in this tree, in section order. *tag* is the tag to " "look for (default is to return all elements)." msgstr "" -#: library/xml.etree.elementtree.rst:1159 +#: library/xml.etree.elementtree.rst:1160 msgid "Same as :meth:`Element.iterfind`, starting at the root of the tree." msgstr "" -#: library/xml.etree.elementtree.rst:1166 +#: library/xml.etree.elementtree.rst:1167 msgid "" "Loads an external XML section into this element tree. *source* is a file " "name or :term:`file object`. *parser* is an optional parser instance. If " @@ -1173,7 +1513,7 @@ msgid "" "section root element." msgstr "" -#: library/xml.etree.elementtree.rst:1176 +#: library/xml.etree.elementtree.rst:1177 msgid "" "Writes the element tree to a file, as XML. *file* is a file name, or a :" "term:`file object` opened for writing. *encoding* [1]_ is the output " @@ -1188,7 +1528,7 @@ msgid "" "are emitted as a pair of start/end tags." msgstr "" -#: library/xml.etree.elementtree.rst:1190 +#: library/xml.etree.elementtree.rst:1191 msgid "" "The output is either a string (:class:`str`) or binary (:class:`bytes`). " "This is controlled by the *encoding* argument. If *encoding* is " @@ -1198,27 +1538,58 @@ msgid "" "vice versa." msgstr "" -#: library/xml.etree.elementtree.rst:1200 +#: library/xml.etree.elementtree.rst:1201 msgid "" "The :meth:`write` method now preserves the attribute order specified by the " "user." msgstr "" -#: library/xml.etree.elementtree.rst:1205 +#: library/xml.etree.elementtree.rst:1206 msgid "This is the XML file that is going to be manipulated::" msgstr "" -#: library/xml.etree.elementtree.rst:1217 +#: library/xml.etree.elementtree.rst:1208 +msgid "" +"\n" +" \n" +" Example page\n" +" \n" +" \n" +"

Moved to example.org\n" +" or example.com.

\n" +" \n" +"" +msgstr "" + +#: library/xml.etree.elementtree.rst:1218 msgid "" "Example of changing the attribute \"target\" of every link in first " "paragraph::" msgstr "" -#: library/xml.etree.elementtree.rst:1237 +#: library/xml.etree.elementtree.rst:1220 +msgid "" +">>> from xml.etree.ElementTree import ElementTree\n" +">>> tree = ElementTree()\n" +">>> tree.parse(\"index.xhtml\")\n" +"\n" +">>> p = tree.find(\"body/p\") # Finds first occurrence of tag p in body\n" +">>> p\n" +"\n" +">>> links = list(p.iter(\"a\")) # Returns list of all links\n" +">>> links\n" +"[, ]\n" +">>> for i in links: # Iterates through all found links\n" +"... i.attrib[\"target\"] = \"blank\"\n" +"...\n" +">>> tree.write(\"output.xhtml\")" +msgstr "" + +#: library/xml.etree.elementtree.rst:1238 msgid "QName Objects" msgstr "" -#: library/xml.etree.elementtree.rst:1242 +#: library/xml.etree.elementtree.rst:1243 msgid "" "QName wrapper. This can be used to wrap a QName attribute value, in order " "to get proper namespace handling on output. *text_or_uri* is a string " @@ -1228,11 +1599,11 @@ msgid "" "class:`QName` instances are opaque." msgstr "" -#: library/xml.etree.elementtree.rst:1254 +#: library/xml.etree.elementtree.rst:1255 msgid "TreeBuilder Objects" msgstr "" -#: library/xml.etree.elementtree.rst:1260 +#: library/xml.etree.elementtree.rst:1261 msgid "" "Generic element structure builder. This builder converts a sequence of " "start, data, end, comment and pi method calls to a well-formed element " @@ -1240,14 +1611,14 @@ msgid "" "custom XML parser, or a parser for some other XML-like format." msgstr "" -#: library/xml.etree.elementtree.rst:1265 +#: library/xml.etree.elementtree.rst:1266 msgid "" "*element_factory*, when given, must be a callable accepting two positional " "arguments: a tag and a dict of attributes. It is expected to return a new " "element instance." msgstr "" -#: library/xml.etree.elementtree.rst:1269 +#: library/xml.etree.elementtree.rst:1270 msgid "" "The *comment_factory* and *pi_factory* functions, when given, should behave " "like the :func:`Comment` and :func:`ProcessingInstruction` functions to " @@ -1257,56 +1628,56 @@ msgid "" "element (but not outside of it)." msgstr "" -#: library/xml.etree.elementtree.rst:1278 +#: library/xml.etree.elementtree.rst:1279 msgid "" "Flushes the builder buffers, and returns the toplevel document element. " "Returns an :class:`Element` instance." msgstr "" -#: library/xml.etree.elementtree.rst:1284 +#: library/xml.etree.elementtree.rst:1285 msgid "" "Adds text to the current element. *data* is a string. This should be " "either a bytestring, or a Unicode string." msgstr "" -#: library/xml.etree.elementtree.rst:1290 +#: library/xml.etree.elementtree.rst:1291 msgid "" "Closes the current element. *tag* is the element name. Returns the closed " "element." msgstr "" -#: library/xml.etree.elementtree.rst:1296 +#: library/xml.etree.elementtree.rst:1297 msgid "" "Opens a new element. *tag* is the element name. *attrs* is a dictionary " "containing element attributes. Returns the opened element." msgstr "" -#: library/xml.etree.elementtree.rst:1302 +#: library/xml.etree.elementtree.rst:1303 msgid "" "Creates a comment with the given *text*. If ``insert_comments`` is true, " "this will also add it to the tree." msgstr "" -#: library/xml.etree.elementtree.rst:1310 +#: library/xml.etree.elementtree.rst:1311 msgid "" "Creates a process instruction with the given *target* name and *text*. If " "``insert_pis`` is true, this will also add it to the tree." msgstr "" -#: library/xml.etree.elementtree.rst:1316 +#: library/xml.etree.elementtree.rst:1317 msgid "" "In addition, a custom :class:`TreeBuilder` object can provide the following " "methods:" msgstr "" -#: library/xml.etree.elementtree.rst:1321 +#: library/xml.etree.elementtree.rst:1322 msgid "" "Handles a doctype declaration. *name* is the doctype name. *pubid* is the " "public identifier. *system* is the system identifier. This method does not " "exist on the default :class:`TreeBuilder` class." msgstr "" -#: library/xml.etree.elementtree.rst:1329 +#: library/xml.etree.elementtree.rst:1330 msgid "" "Is called whenever the parser encounters a new namespace declaration, before " "the ``start()`` callback for the opening element that defines it. *prefix* " @@ -1314,14 +1685,14 @@ msgid "" "otherwise. *uri* is the namespace URI." msgstr "" -#: library/xml.etree.elementtree.rst:1338 +#: library/xml.etree.elementtree.rst:1339 msgid "" "Is called after the ``end()`` callback of an element that declared a " "namespace prefix mapping, with the name of the *prefix* that went out of " "scope." msgstr "" -#: library/xml.etree.elementtree.rst:1350 +#: library/xml.etree.elementtree.rst:1351 msgid "" "A `C14N 2.0 `_ writer. Arguments are the " "same as for the :func:`canonicalize` function. This class does not build a " @@ -1329,11 +1700,11 @@ msgid "" "using the *write* function." msgstr "" -#: library/xml.etree.elementtree.rst:1361 +#: library/xml.etree.elementtree.rst:1362 msgid "XMLParser Objects" msgstr "" -#: library/xml.etree.elementtree.rst:1366 +#: library/xml.etree.elementtree.rst:1367 msgid "" "This class is the low-level building block of the module. It uses :mod:`xml." "parsers.expat` for efficient, event-based parsing of XML. It can be fed XML " @@ -1344,25 +1715,25 @@ msgid "" "XML file." msgstr "" -#: library/xml.etree.elementtree.rst:1374 +#: library/xml.etree.elementtree.rst:1375 msgid "" "Parameters are now :ref:`keyword-only `. The *html* " -"argument no longer supported." +"argument is no longer supported." msgstr "" -#: library/xml.etree.elementtree.rst:1381 +#: library/xml.etree.elementtree.rst:1382 msgid "" "Finishes feeding data to the parser. Returns the result of calling the " "``close()`` method of the *target* passed during construction; by default, " "this is the toplevel document element." msgstr "" -#: library/xml.etree.elementtree.rst:1388 +#: library/xml.etree.elementtree.rst:1389 msgid "Feeds data to the parser. *data* is encoded data." msgstr "" -#: library/xml.etree.elementtree.rst:1393 -#: library/xml.etree.elementtree.rst:1471 +#: library/xml.etree.elementtree.rst:1394 +#: library/xml.etree.elementtree.rst:1472 msgid "" "Triggers parsing of any previously fed unparsed data, which can be used to " "ensure more immediate feedback, in particular with Expat >=2.6.0. The " @@ -1372,15 +1743,15 @@ msgid "" "xmlparser.SetReparseDeferralEnabled` for details." msgstr "" -#: library/xml.etree.elementtree.rst:1400 -#: library/xml.etree.elementtree.rst:1478 +#: library/xml.etree.elementtree.rst:1401 +#: library/xml.etree.elementtree.rst:1479 msgid "" "Note that :meth:`flush` has been backported to some prior releases of " "CPython as a security fix. Check for availability of :meth:`flush` using :" "func:`hasattr` if used in code running across a variety of Python versions." msgstr "" -#: library/xml.etree.elementtree.rst:1408 +#: library/xml.etree.elementtree.rst:1409 msgid "" ":meth:`XMLParser.feed` calls *target*\\'s ``start(tag, attrs_dict)`` method " "for each opening tag, its ``end(tag)`` method for each closing tag, and data " @@ -1391,11 +1762,46 @@ msgid "" "of an XML file::" msgstr "" -#: library/xml.etree.elementtree.rst:1452 +#: library/xml.etree.elementtree.rst:1417 +msgid "" +">>> from xml.etree.ElementTree import XMLParser\n" +">>> class MaxDepth: # The target object of the parser\n" +"... maxDepth = 0\n" +"... depth = 0\n" +"... def start(self, tag, attrib): # Called for each opening tag.\n" +"... self.depth += 1\n" +"... if self.depth > self.maxDepth:\n" +"... self.maxDepth = self.depth\n" +"... def end(self, tag): # Called for each closing tag.\n" +"... self.depth -= 1\n" +"... def data(self, data):\n" +"... pass # We do not need to do anything with data.\n" +"... def close(self): # Called when all data has been parsed.\n" +"... return self.maxDepth\n" +"...\n" +">>> target = MaxDepth()\n" +">>> parser = XMLParser(target=target)\n" +">>> exampleXml = \"\"\"\n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \"\"\"\n" +">>> parser.feed(exampleXml)\n" +">>> parser.close()\n" +"4" +msgstr "" + +#: library/xml.etree.elementtree.rst:1453 msgid "XMLPullParser Objects" msgstr "" -#: library/xml.etree.elementtree.rst:1456 +#: library/xml.etree.elementtree.rst:1457 msgid "" "A pull parser suitable for non-blocking applications. Its input-side API is " "similar to that of :class:`XMLParser`, but instead of pushing calls to a " @@ -1407,11 +1813,11 @@ msgid "" "If *events* is omitted, only ``\"end\"`` events are reported." msgstr "" -#: library/xml.etree.elementtree.rst:1467 +#: library/xml.etree.elementtree.rst:1468 msgid "Feed the given bytes data to the parser." msgstr "" -#: library/xml.etree.elementtree.rst:1487 +#: library/xml.etree.elementtree.rst:1488 msgid "" "Signal the parser that the data stream is terminated. Unlike :meth:" "`XMLParser.close`, this method always returns :const:`None`. Any events not " @@ -1419,7 +1825,7 @@ msgid "" "`read_events`." msgstr "" -#: library/xml.etree.elementtree.rst:1494 +#: library/xml.etree.elementtree.rst:1495 msgid "" "Return an iterator over the events which have been encountered in the data " "fed to the parser. The iterator yields ``(event, elem)`` pairs, where " @@ -1428,25 +1834,25 @@ msgid "" "follows." msgstr "" -#: library/xml.etree.elementtree.rst:1500 +#: library/xml.etree.elementtree.rst:1501 msgid "``start``, ``end``: the current Element." msgstr "" -#: library/xml.etree.elementtree.rst:1501 +#: library/xml.etree.elementtree.rst:1502 msgid "``comment``, ``pi``: the current comment / processing instruction" msgstr "" -#: library/xml.etree.elementtree.rst:1502 +#: library/xml.etree.elementtree.rst:1503 msgid "" "``start-ns``: a tuple ``(prefix, uri)`` naming the declared namespace " "mapping." msgstr "" -#: library/xml.etree.elementtree.rst:1504 +#: library/xml.etree.elementtree.rst:1505 msgid "``end-ns``: :const:`None` (this may change in a future version)" msgstr "" -#: library/xml.etree.elementtree.rst:1506 +#: library/xml.etree.elementtree.rst:1507 msgid "" "Events provided in a previous call to :meth:`read_events` will not be " "yielded again. Events are consumed from the internal queue only when they " @@ -1455,7 +1861,7 @@ msgid "" "results." msgstr "" -#: library/xml.etree.elementtree.rst:1514 +#: library/xml.etree.elementtree.rst:1515 msgid "" ":class:`XMLPullParser` only guarantees that it has seen the \">\" character " "of a starting tag when it emits a \"start\" event, so the attributes are " @@ -1464,11 +1870,11 @@ msgid "" "be present." msgstr "" -#: library/xml.etree.elementtree.rst:1529 +#: library/xml.etree.elementtree.rst:1530 msgid "Exceptions" msgstr "" -#: library/xml.etree.elementtree.rst:1533 +#: library/xml.etree.elementtree.rst:1534 msgid "" "XML parse error, raised by the various parsing methods in this module when " "parsing fails. The string representation of an instance of this exception " @@ -1476,22 +1882,22 @@ msgid "" "following attributes available:" msgstr "" -#: library/xml.etree.elementtree.rst:1540 +#: library/xml.etree.elementtree.rst:1541 msgid "" "A numeric error code from the expat parser. See the documentation of :mod:" "`xml.parsers.expat` for the list of error codes and their meanings." msgstr "" -#: library/xml.etree.elementtree.rst:1545 +#: library/xml.etree.elementtree.rst:1546 msgid "" "A tuple of *line*, *column* numbers, specifying where the error occurred." msgstr "" -#: library/xml.etree.elementtree.rst:1548 +#: library/xml.etree.elementtree.rst:1549 msgid "Footnotes" msgstr "" -#: library/xml.etree.elementtree.rst:1549 +#: library/xml.etree.elementtree.rst:1550 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See " diff --git a/library/xml.po b/library/xml.po index 08dc4274..528bd04f 100644 --- a/library/xml.po +++ b/library/xml.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,12 +32,11 @@ msgstr "" #: library/xml.rst:20 msgid "" -"The XML modules are not secure against erroneous or maliciously constructed " -"data. If you need to parse untrusted or unauthenticated data see the :ref:" -"`xml-vulnerabilities` and :ref:`defusedxml-package` sections." +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." msgstr "" -#: library/xml.rst:25 +#: library/xml.rst:23 msgid "" "It is important to note that modules in the :mod:`xml` package require that " "there be at least one SAX-compliant XML parser available. The Expat parser " @@ -44,183 +44,86 @@ msgid "" "be available." msgstr "" -#: library/xml.rst:30 +#: library/xml.rst:28 msgid "" "The documentation for the :mod:`xml.dom` and :mod:`xml.sax` packages are the " "definition of the Python bindings for the DOM and SAX interfaces." msgstr "" -#: library/xml.rst:33 +#: library/xml.rst:31 msgid "The XML handling submodules are:" msgstr "" -#: library/xml.rst:35 +#: library/xml.rst:33 msgid "" ":mod:`xml.etree.ElementTree`: the ElementTree API, a simple and lightweight " "XML processor" msgstr "" -#: library/xml.rst:40 +#: library/xml.rst:38 msgid ":mod:`xml.dom`: the DOM API definition" msgstr "" -#: library/xml.rst:41 +#: library/xml.rst:39 msgid ":mod:`xml.dom.minidom`: a minimal DOM implementation" msgstr "" -#: library/xml.rst:42 +#: library/xml.rst:40 msgid ":mod:`xml.dom.pulldom`: support for building partial DOM trees" msgstr "" -#: library/xml.rst:46 +#: library/xml.rst:44 msgid ":mod:`xml.sax`: SAX2 base classes and convenience functions" msgstr "" -#: library/xml.rst:47 +#: library/xml.rst:45 msgid ":mod:`xml.parsers.expat`: the Expat parser binding" msgstr "" -#: library/xml.rst:53 -msgid "XML vulnerabilities" +#: library/xml.rst:52 +msgid "XML security" msgstr "" -#: library/xml.rst:55 +#: library/xml.rst:54 msgid "" -"The XML processing modules are not secure against maliciously constructed " -"data. An attacker can abuse XML features to carry out denial of service " -"attacks, access local files, generate network connections to other machines, " -"or circumvent firewalls." +"An attacker can abuse XML features to carry out denial of service attacks, " +"access local files, generate network connections to other machines, or " +"circumvent firewalls when attacker-controlled XML is being parsed, in Python " +"or elsewhere." msgstr "" -#: library/xml.rst:60 +#: library/xml.rst:59 msgid "" -"The following table gives an overview of the known attacks and whether the " -"various modules are vulnerable to them." -msgstr "" - -#: library/xml.rst:64 -msgid "kind" -msgstr "" - -#: library/xml.rst:64 -msgid "sax" -msgstr "" - -#: library/xml.rst:64 -msgid "etree" -msgstr "" - -#: library/xml.rst:64 -msgid "minidom" -msgstr "" - -#: library/xml.rst:64 -msgid "pulldom" -msgstr "" - -#: library/xml.rst:64 -msgid "xmlrpc" -msgstr "" - -#: library/xml.rst:66 -msgid "billion laughs" -msgstr "" - -#: library/xml.rst:67 -msgid "**Vulnerable** (1)" -msgstr "" - -#: library/xml.rst:67 -msgid "quadratic blowup" -msgstr "" - -#: library/xml.rst:109 -msgid "external entity expansion" -msgstr "" - -#: library/xml.rst:69 -msgid "Safe (5)" -msgstr "" - -#: library/xml.rst:68 -msgid "Safe (2)" -msgstr "" - -#: library/xml.rst:68 -msgid "Safe (3)" -msgstr "" - -#: library/xml.rst:68 -msgid "Safe (4)" -msgstr "" - -#: library/xml.rst:114 -msgid "`DTD`_ retrieval" -msgstr "" - -#: library/xml.rst:70 -msgid "Safe" -msgstr "" - -#: library/xml.rst:121 -msgid "decompression bomb" +"The built-in XML parsers of Python rely on the library `libexpat`_, commonly " +"called Expat, for parsing XML." msgstr "" -#: library/xml.rst:70 -msgid "**Vulnerable**" -msgstr "" - -#: library/xml.rst:128 -msgid "large tokens" -msgstr "" - -#: library/xml.rst:71 -msgid "**Vulnerable** (6)" -msgstr "" - -#: library/xml.rst:74 +#: library/xml.rst:62 msgid "" -"Expat 2.4.1 and newer is not vulnerable to the \"billion laughs\" and " -"\"quadratic blowup\" vulnerabilities. Items still listed as vulnerable due " -"to potential reliance on system-provided libraries. Check :const:`!pyexpat." -"EXPAT_VERSION`." +"By default, Expat itself does not access local files or create network " +"connections." msgstr "" -#: library/xml.rst:78 +#: library/xml.rst:65 msgid "" -":mod:`xml.etree.ElementTree` doesn't expand external entities and raises a :" -"exc:`~xml.etree.ElementTree.ParseError` when an entity occurs." +"Expat versions lower than 2.7.2 may be vulnerable to the \"billion laughs\", " +"\"quadratic blowup\" and \"large tokens\" vulnerabilities, or to " +"disproportional use of dynamic memory. Python bundles a copy of Expat, and " +"whether Python uses the bundled or a system-wide Expat, depends on how the " +"Python interpreter :option:`has been configured <--with-system-expat>` in " +"your environment. Python may be vulnerable if it uses such older versions of " +"Expat. Check :const:`!pyexpat.EXPAT_VERSION`." msgstr "" -#: library/xml.rst:80 -msgid "" -":mod:`xml.dom.minidom` doesn't expand external entities and simply returns " -"the unexpanded entity verbatim." -msgstr "" - -#: library/xml.rst:82 -msgid ":mod:`xmlrpc.client` doesn't expand external entities and omits them." -msgstr "" - -#: library/xml.rst:83 -msgid "" -"Since Python 3.7.1, external general entities are no longer processed by " -"default." -msgstr "" - -#: library/xml.rst:85 -msgid "" -"Expat 2.6.0 and newer is not vulnerable to denial of service through " -"quadratic runtime caused by parsing large tokens. Items still listed as " -"vulnerable due to potential reliance on system-provided libraries. Check :" -"const:`!pyexpat.EXPAT_VERSION`." +#: library/xml.rst:74 +msgid ":mod:`xmlrpc` is **vulnerable** to the \"decompression bomb\" attack." msgstr "" -#: library/xml.rst:97 +#: library/xml.rst:77 msgid "billion laughs / exponential entity expansion" msgstr "" -#: library/xml.rst:93 +#: library/xml.rst:78 msgid "" "The `Billion Laughs`_ attack -- also known as exponential entity expansion " "-- uses multiple levels of nested entities. Each entity refers to another " @@ -229,11 +132,11 @@ msgid "" "consumes lots of memory and CPU time." msgstr "" -#: library/xml.rst:104 +#: library/xml.rst:84 msgid "quadratic blowup entity expansion" msgstr "" -#: library/xml.rst:100 +#: library/xml.rst:85 msgid "" "A quadratic blowup attack is similar to a `Billion Laughs`_ attack; it " "abuses entity expansion, too. Instead of nested entities it repeats one " @@ -242,21 +145,11 @@ msgid "" "countermeasures that forbid deeply nested entities." msgstr "" -#: library/xml.rst:107 -msgid "" -"Entity declarations can contain more than just text for replacement. They " -"can also point to external resources or local files. The XML parser accesses " -"the resource and embeds the content into the XML document." -msgstr "" - -#: library/xml.rst:112 -msgid "" -"Some XML libraries like Python's :mod:`xml.dom.pulldom` retrieve document " -"type definitions from remote or local locations. The feature has similar " -"implications as the external entity expansion issue." +#: library/xml.rst:91 +msgid "decompression bomb" msgstr "" -#: library/xml.rst:117 +#: library/xml.rst:92 msgid "" "Decompression bombs (aka `ZIP bomb`_) apply to all XML libraries that can " "parse compressed XML streams such as gzipped HTTP streams or LZMA-compressed " @@ -264,30 +157,14 @@ msgid "" "magnitudes or more." msgstr "" -#: library/xml.rst:124 -msgid "" -"Expat needs to re-parse unfinished tokens; without the protection introduced " -"in Expat 2.6.0, this can lead to quadratic runtime that can be used to cause " -"denial of service in the application parsing XML. The issue is known as " -"`CVE-2023-52425 `_." -msgstr "" - -#: library/xml.rst:130 -msgid "" -"The documentation for `defusedxml`_ on PyPI has further information about " -"all known attack vectors with examples and references." -msgstr "" - -#: library/xml.rst:136 -msgid "The :mod:`!defusedxml` Package" +#: library/xml.rst:98 +msgid "large tokens" msgstr "" -#: library/xml.rst:138 +#: library/xml.rst:99 msgid "" -"`defusedxml`_ is a pure Python package with modified subclasses of all " -"stdlib XML parsers that prevent any potentially malicious operation. Use of " -"this package is recommended for any server code that parses untrusted XML " -"data. The package also ships with example exploits and extended " -"documentation on more XML exploits such as XPath injection." +"Expat needs to re-parse unfinished tokens; without the protection introduced " +"in Expat 2.6.0, this can lead to quadratic runtime that can be used to cause " +"denial of service in the application parsing XML. The issue is known as :cve:" +"`2023-52425`." msgstr "" diff --git a/library/xml.sax.handler.po b/library/xml.sax.handler.po index 1bba0b72..6e9099f7 100644 --- a/library/xml.sax.handler.po +++ b/library/xml.sax.handler.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/xml.sax.handler.rst:2 -msgid ":mod:`xml.sax.handler` --- Base classes for SAX handlers" -msgstr "" +msgid ":mod:`!xml.sax.handler` --- Base classes for SAX handlers" +msgstr ":mod:`!xml.sax.handler` --- Βασικές κλάσεις για χειριστές SAX" #: library/xml.sax.handler.rst:10 msgid "**Source code:** :source:`Lib/xml/sax/handler.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/xml/sax/handler.py`" #: library/xml.sax.handler.rst:14 msgid "" @@ -34,6 +35,14 @@ msgid "" "module :mod:`xml.sax.handler`, so that all methods get default " "implementations." msgstr "" +"Το SAX API ορίζει πέντε είδη χειριστών: χειριστές περιεχομένου, χειριστές " +"DTD, χειριστές σφαλμάτων, χειριστές επίλυσης οντοτήτων και χειριστές " +"λεξικών. Οι εφαρμογές συνήθως χρειάζεται να υλοποιήσουν μόνο τις διεπαφές " +"των γεγονότων που τους ενδιαφέρουν. Μπορούν να υλοποιήσουν τις διεπαφές σε " +"ένα μόνο αντικείμενο ή σε πολλαπλά αντικείμενα. Οι υλοποιήσεις χειριστών θα " +"πρέπει να κληρονομούν από τις βασικές κλάσεις που παρέχονται στο module :mod:" +"`xml.sax.handler`, έτσι ώστε όλες οι μέθοδοι να αποκτούν προεπιλεγμένες " +"υλοποιήσεις." #: library/xml.sax.handler.rst:24 msgid "" @@ -41,16 +50,21 @@ msgid "" "applications. The order of events in this interface mirrors the order of the " "information in the document." msgstr "" +"Αυτή είναι η κύρια διεπαφή callback στο SAX και η πιο σημαντική για τις " +"εφαρμογές. Η σειρά των γεγονότων σε αυτή τη διεπαφή αντικατοπτρίζει τη σειρά " +"των πληροφοριών στο έγγραφο." #: library/xml.sax.handler.rst:31 msgid "Handle DTD events." -msgstr "" +msgstr "Χειρισμός DTD γεγονότων." #: library/xml.sax.handler.rst:33 msgid "" "This interface specifies only those DTD events required for basic parsing " "(unparsed entities and attributes)." msgstr "" +"Αυτή η διεπαφή καθορίζει μόνο τα γεγονότα DTD που απαιτούνται για βασική " +"ανάλυση (μη αναλυμένες οντότητες και ιδιότητες)." #: library/xml.sax.handler.rst:39 msgid "" @@ -58,6 +72,10 @@ msgid "" "this interface, then register the object with your Parser, the parser will " "call the method in your object to resolve all external entities." msgstr "" +"Βασική διεπαφή για την επίλυση οντοτήτων. Εάν δημιουργήσετε ένα αντικείμενο " +"που υλοποιεί αυτή τη διεπαφή, τότε θα πρέπει να το καταχωρήσετε στον αναλυτή " +"σας, o αναλυτής θα καλέσει τη μέθοδο στο αντικείμενό σας για να επιλύσει " +"όλες τις εξωτερικές οντότητες." #: library/xml.sax.handler.rst:46 msgid "" @@ -65,209 +83,267 @@ msgid "" "application. The methods of this object control whether errors are " "immediately converted to exceptions or are handled in some other way." msgstr "" +"Διεπαφή που χρησιμοποιείται από τον αναλυτή για να παρουσιάσει μηνύματα " +"σφάλματος και προειδοποιήσεων στην εφαρμογή. Οι μέθοδοι αυτού του " +"αντικειμένου ελέγχουν αν τα σφάλματα μετατρέπονται άμεσα σε εξαιρέσεις ή " +"αντιμετωπίζονται με κάποιο άλλο τρόπο." #: library/xml.sax.handler.rst:53 msgid "" "Interface used by the parser to represent low frequency events which may not " "be of interest to many applications." msgstr "" +"Διεπαφή που χρησιμοποιείται από τον αναλυτή για να παρουσιάσει γεγονότα " +"χαμηλής συχνότητας που μπορεί να μην ενδιαφέρουν πολλές εφαρμογές." #: library/xml.sax.handler.rst:56 msgid "" "In addition to these classes, :mod:`xml.sax.handler` provides symbolic " "constants for the feature and property names." msgstr "" +"Εκτός από αυτές τις κλάσεις, το :mod:`xml.sax.handler` παρέχει συμβολικές " +"σταθερές για τα ονόματα χαρακτηριστικών και ιδιοτήτων." #: library/xml.sax.handler.rst:62 msgid "value: ``\"http://xml.org/sax/features/namespaces\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/features/namespaces\"``" #: library/xml.sax.handler.rst:63 msgid "true: Perform Namespace processing." -msgstr "" +msgstr "true: Εκτέλεση επεξεργασίας ονομάτων χώρου." #: library/xml.sax.handler.rst:65 msgid "" "false: Optionally do not perform Namespace processing (implies namespace-" "prefixes; default)." msgstr "" +"false: Προαιρετικά μη εκτέλεση επεξεργασίας ονομάτων χώρου (υπονοεί " +"namespace-prefixes; προεπιλογή)." #: library/xml.sax.handler.rst:76 library/xml.sax.handler.rst:94 -#: library/xml.sax.handler.rst:102 library/xml.sax.handler.rst:112 -#: library/xml.sax.handler.rst:144 +#: library/xml.sax.handler.rst:110 library/xml.sax.handler.rst:120 +#: library/xml.sax.handler.rst:152 msgid "access: (parsing) read-only; (not parsing) read/write" -msgstr "" +msgstr "access: (ανάλυση) μόνο για ανάγνωση; (μη ανάλυση) ανάγνωση/εγγραφή" #: library/xml.sax.handler.rst:71 msgid "value: ``\"http://xml.org/sax/features/namespace-prefixes\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/features/namespace-prefixes\"``" #: library/xml.sax.handler.rst:73 msgid "" "true: Report the original prefixed names and attributes used for Namespace " "declarations." msgstr "" +"true: Αναφορά των αρχικών ονομάτων με πρόθεμα και ιδιοτήτων που " +"χρησιμοποιούνται για δηλώσεις ονομάτων χώρου." #: library/xml.sax.handler.rst:75 msgid "" "false: Do not report attributes used for Namespace declarations, and " "optionally do not report original prefixed names (default)." msgstr "" +"false: Μη αναφορά ιδιοτήτων που χρησιμοποιούνται για δηλώσεις ονομάτων " +"χώρου, και προαιρετικά μη αναφορά αρχικών ονομάτων με πρόθεμα (προεπιλογή)." #: library/xml.sax.handler.rst:81 msgid "value: ``\"http://xml.org/sax/features/string-interning\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/features/string-interning\"``" #: library/xml.sax.handler.rst:83 msgid "" "true: All element names, prefixes, attribute names, Namespace URIs, and " "local names are interned using the built-in intern function." msgstr "" +"true: Όλα τα ονόματα στοιχείων, πρόθεμα, ονόματα ιδιοτήτων, URIs ονομάτων " +"χώρου και τοπικά ονόματα εσωτερικεύονται χρησιμοποιώντας την ενσωματωμένη " +"συνάρτηση εσωτερικοποίησης (intern)." #: library/xml.sax.handler.rst:84 msgid "" "false: Names are not necessarily interned, although they may be (default)." msgstr "" +"false: Τα ονόματα δεν εσωτερικεύονται απαραίτητα, αν και μπορεί να είναι " +"(προεπιλογή)." #: library/xml.sax.handler.rst:90 msgid "value: ``\"http://xml.org/sax/features/validation\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/features/validation\"``" #: library/xml.sax.handler.rst:92 msgid "" "true: Report all validation errors (implies external-general-entities and " "external-parameter-entities)." msgstr "" +"true: Αναφορά όλων των σφαλμάτων επικύρωσης (υπονοεί external-general-" +"entities και external-parameter-entities)." #: library/xml.sax.handler.rst:93 msgid "false: Do not report validation errors." +msgstr "false: Μη αναφορά σφαλμάτων επικύρωσης." + +#: library/xml.sax.handler.rst:101 +msgid "" +"Enabling opens a vulnerability to `external entity attacks `_ if the parser is used with " +"user-provided XML content. Please reflect on your `threat model `_ before enabling this feature." msgstr "" +"Η ενεργοποίηση ανοίγει μια ευπάθεια σε `επιθέσεις εξωτερικών οντοτήτων " +"`_ εάν ο αναλυτής " +"χρησιμοποιείται με περιεχόμενο XML που παρέχεται από τον χρήστη. Παρακαλώ " +"σκεφτείτε το `μοντέλο απειλών σας `_ πριν ενεργοποιήσετε αυτό το χαρακτηριστικό." -#: library/xml.sax.handler.rst:99 +#: library/xml.sax.handler.rst:107 msgid "value: ``\"http://xml.org/sax/features/external-general-entities\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/features/external-general-entities\"``" -#: library/xml.sax.handler.rst:100 +#: library/xml.sax.handler.rst:108 msgid "true: Include all external general (text) entities." -msgstr "" +msgstr "true: Συμπερίληψη όλων των εξωτερικών γενικών (κείμενο) οντοτήτων." -#: library/xml.sax.handler.rst:101 +#: library/xml.sax.handler.rst:109 msgid "false: Do not include external general entities." -msgstr "" +msgstr "false: Μη συμπερίληψη εξωτερικών γενικών οντοτήτων." -#: library/xml.sax.handler.rst:107 +#: library/xml.sax.handler.rst:115 msgid "value: ``\"http://xml.org/sax/features/external-parameter-entities\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/features/external-parameter-entities\"``" -#: library/xml.sax.handler.rst:109 +#: library/xml.sax.handler.rst:117 msgid "" "true: Include all external parameter entities, including the external DTD " "subset." msgstr "" +"true: Συμπερίληψη όλων των εξωτερικών παραμέτρων οντοτήτων, " +"συμπεριλαμβανομένου του εξωτερικού υποσυνόλου DTD." -#: library/xml.sax.handler.rst:111 +#: library/xml.sax.handler.rst:119 msgid "" "false: Do not include any external parameter entities, even the external DTD " "subset." msgstr "" +"false: Μη συμπερίληψη εξωτερικών παραμέτρων οντοτήτων, ακόμη και του " +"εξωτερικού υποσυνόλου DTD." -#: library/xml.sax.handler.rst:117 +#: library/xml.sax.handler.rst:125 msgid "List of all features." -msgstr "" +msgstr "Λίστα όλων των χαρακτηριστικών." -#: library/xml.sax.handler.rst:122 +#: library/xml.sax.handler.rst:130 msgid "value: ``\"http://xml.org/sax/properties/lexical-handler\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/properties/lexical-handler\"``" -#: library/xml.sax.handler.rst:123 +#: library/xml.sax.handler.rst:131 msgid "data type: xml.sax.handler.LexicalHandler (not supported in Python 2)" msgstr "" +"data type: xml.sax.handler.LexicalHandler (δεν υποστηρίζεται στην Python 2)" -#: library/xml.sax.handler.rst:125 +#: library/xml.sax.handler.rst:133 msgid "" "description: An optional extension handler for lexical events like comments." msgstr "" +"description: Ένας προαιρετικός χειριστής επέκτασης για λεξικά συμβάντα όπως " +"τα σχόλια." -#: library/xml.sax.handler.rst:126 library/xml.sax.handler.rst:135 +#: library/xml.sax.handler.rst:134 library/xml.sax.handler.rst:143 msgid "access: read/write" -msgstr "" +msgstr "access: read/write" -#: library/xml.sax.handler.rst:131 +#: library/xml.sax.handler.rst:139 msgid "value: ``\"http://xml.org/sax/properties/declaration-handler\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/properties/declaration-handler\"``" -#: library/xml.sax.handler.rst:132 +#: library/xml.sax.handler.rst:140 msgid "data type: xml.sax.sax2lib.DeclHandler (not supported in Python 2)" msgstr "" +"data type: xml.sax.sax2lib.DeclHandler (δεν υποστηρίζεται στην Python 2)" -#: library/xml.sax.handler.rst:134 +#: library/xml.sax.handler.rst:142 msgid "" "description: An optional extension handler for DTD-related events other than " "notations and unparsed entities." msgstr "" +"description: Ένας προαιρετικός χειριστής επέκτασης για γεγονότα που " +"σχετίζονται με το DTD εκτός από τις δηλώσεις και τις μη αναλυμένες οντότητες." -#: library/xml.sax.handler.rst:140 +#: library/xml.sax.handler.rst:148 msgid "value: ``\"http://xml.org/sax/properties/dom-node\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/properties/dom-node\"``" -#: library/xml.sax.handler.rst:141 +#: library/xml.sax.handler.rst:149 msgid "data type: org.w3c.dom.Node (not supported in Python 2)" -msgstr "" +msgstr "data type: org.w3c.dom.Node (δεν υποστηρίζεται στην Python 2)" -#: library/xml.sax.handler.rst:143 +#: library/xml.sax.handler.rst:151 msgid "" "description: When parsing, the current DOM node being visited if this is a " "DOM iterator; when not parsing, the root DOM node for iteration." msgstr "" +"description: Κατά την ανάλυση, ο τρέχων DOM κόμβος που επισκέπτεται εάν " +"αυτός είναι ένας επαναληπτικός DOM κόμβος∙ όταν δεν αναλύεται, ο ριζικός DOM " +"κόμβος για την επανάληψη." -#: library/xml.sax.handler.rst:149 +#: library/xml.sax.handler.rst:157 msgid "value: ``\"http://xml.org/sax/properties/xml-string\"``" -msgstr "" +msgstr "value: ``\"http://xml.org/sax/properties/xml-string\"``" -#: library/xml.sax.handler.rst:150 +#: library/xml.sax.handler.rst:158 msgid "data type: Bytes" -msgstr "" +msgstr "data type: Bytes" -#: library/xml.sax.handler.rst:152 +#: library/xml.sax.handler.rst:160 msgid "" "description: The literal string of characters that was the source for the " "current event." msgstr "" +"description: Η κυριολεκτική συμβολοσειρά χαρακτήρων που ήταν η πηγή για το " +"τρέχον γεγονός." -#: library/xml.sax.handler.rst:153 +#: library/xml.sax.handler.rst:161 msgid "access: read-only" -msgstr "" +msgstr "access: μόνο για ανάγνωση" -#: library/xml.sax.handler.rst:158 +#: library/xml.sax.handler.rst:166 msgid "List of all known property names." -msgstr "" +msgstr "Λίστα όλων των γνωστών ονομάτων ιδιοτήτων." -#: library/xml.sax.handler.rst:164 +#: library/xml.sax.handler.rst:172 msgid "ContentHandler Objects" -msgstr "" +msgstr "ContentHandler Αντικείμενα" -#: library/xml.sax.handler.rst:166 +#: library/xml.sax.handler.rst:174 msgid "" "Users are expected to subclass :class:`ContentHandler` to support their " "application. The following methods are called by the parser on the " "appropriate events in the input document:" msgstr "" +"Οι χρήστες αναμένεται να δημιουργήσουν υποκλάση :class:`ContentHandler` για " +"να υποστηρίξουν την εφαρμογή τους. Οι ακόλουθες μέθοδοι καλούνται από τον " +"αναλυτή στα κατάλληλα γεγονότα στο έγγραφο εισόδου:" -#: library/xml.sax.handler.rst:173 +#: library/xml.sax.handler.rst:181 msgid "" "Called by the parser to give the application a locator for locating the " "origin of document events." msgstr "" +"Καλείται από τον αναλυτή για να δώσει στην εφαρμογή έναν εντοπιστή για τον " +"εντοπισμό της προέλευσης των γεγονότων του εγγράφου." -#: library/xml.sax.handler.rst:176 +#: library/xml.sax.handler.rst:184 msgid "" "SAX parsers are strongly encouraged (though not absolutely required) to " "supply a locator: if it does so, it must supply the locator to the " "application by invoking this method before invoking any of the other methods " "in the DocumentHandler interface." msgstr "" +"Οι αναλυτές SAX ενθαρρύνονται έντονα (αν και δεν απαιτείται απολύτως) να " +"παρέχουν έναν εντοπιστή: εάν το κάνουν, πρέπει να παρέχουν τον εντοπιστή " +"στην εφαρμογή καλώντας αυτή τη μέθοδο πριν από την κλήση οποιωνδήποτε άλλων " +"μεθόδων στη διεπαφή DocumentHandler." -#: library/xml.sax.handler.rst:181 +#: library/xml.sax.handler.rst:189 msgid "" "The locator allows the application to determine the end position of any " "document-related event, even if the parser is not reporting an error. " @@ -276,49 +352,70 @@ msgid "" "business rules). The information returned by the locator is probably not " "sufficient for use with a search engine." msgstr "" +"Ο εντοπιστής επιτρέπει στην εφαρμογή να προσδιορίσει τη θέση τέλους " +"οποιουδήποτε γεγονότος που σχετίζεται με το έγγραφο, ακόμη και αν ο αναλυτής " +"δεν αναφέρει σφάλμα. Συνήθως, η εφαρμογή θα χρησιμοποιήσει αυτές τις " +"πληροφορίες για την αναφορά των δικών της σφαλμάτων (όπως περιεχόμενο " +"χαρακτήρων που δεν αντιστοιχεί στους επιχειρηματικούς κανόνες της " +"εφαρμογής). Οι πληροφορίες που επιστρέφονται από τον εντοπιστή πιθανώς δεν " +"είναι αρκετές για χρήση με μια μηχανή αναζήτησης." -#: library/xml.sax.handler.rst:188 +#: library/xml.sax.handler.rst:196 msgid "" "Note that the locator will return correct information only during the " "invocation of the events in this interface. The application should not " "attempt to use it at any other time." msgstr "" +"Σημειώστε ότι ο εντοπιστής θα επιστρέψει σωστές πληροφορίες μόνο κατά την " +"κλήση των γεγονότων σε αυτή τη διεπαφή. Η εφαρμογή δεν θα πρέπει να " +"προσπαθήσει να τον χρησιμοποιήσει σε οποιαδήποτε άλλη στιγμή." -#: library/xml.sax.handler.rst:195 +#: library/xml.sax.handler.rst:203 msgid "Receive notification of the beginning of a document." -msgstr "" +msgstr "Λήψη ειδοποίησης για την αρχή ενός εγγράφου." -#: library/xml.sax.handler.rst:197 +#: library/xml.sax.handler.rst:205 msgid "" "The SAX parser will invoke this method only once, before any other methods " "in this interface or in DTDHandler (except for :meth:`setDocumentLocator`)." msgstr "" +"Ο αναλυτής SAX θα καλέσει αυτή τη μέθοδο μόνο μία φορά, πριν από οποιαδήποτε " +"άλλη μέθοδο σε αυτή τη διεπαφή ή σε DTDHandler (εκτός από :meth:" +"`setDocumentLocator`)." -#: library/xml.sax.handler.rst:203 +#: library/xml.sax.handler.rst:211 msgid "Receive notification of the end of a document." -msgstr "" +msgstr "Λήψη ειδοποίησης για το τέλος ενός εγγράφου." -#: library/xml.sax.handler.rst:205 +#: library/xml.sax.handler.rst:213 msgid "" "The SAX parser will invoke this method only once, and it will be the last " "method invoked during the parse. The parser shall not invoke this method " "until it has either abandoned parsing (because of an unrecoverable error) or " "reached the end of input." msgstr "" +"Ο αναλυτής SAX θα καλέσει αυτή τη μέθοδο μόνο μία φορά, και θα είναι η " +"τελευταία μέθοδος που θα κληθεί κατά τη διάρκεια της ανάλυσης. Ο αναλυτής " +"δεν θα καλέσει αυτή τη μέθοδο μέχρι να εγκαταλείψει την ανάλυση (εξαιτίας " +"ενός μη ανακτήσιμου σφάλματος) ή να φτάσει στο τέλος της εισόδου." -#: library/xml.sax.handler.rst:213 +#: library/xml.sax.handler.rst:221 msgid "Begin the scope of a prefix-URI Namespace mapping." -msgstr "" +msgstr "Αρχή της έκτασης ενός προθέματος-URI χαρτογράφησης ονόματος χώρου." -#: library/xml.sax.handler.rst:215 +#: library/xml.sax.handler.rst:223 msgid "" "The information from this event is not necessary for normal Namespace " "processing: the SAX XML reader will automatically replace prefixes for " "element and attribute names when the ``feature_namespaces`` feature is " "enabled (the default)." msgstr "" +"Οι πληροφορίες από αυτό το γεγονός δεν είναι απαραίτητες για την κανονική " +"επεξεργασία ονομάτων χώρου: ο αναγνώστης SAX XML θα αντικαταστήσει αυτόματα " +"τα προθέματα για τα ονόματα στοιχείων και ιδιοτήτων όταν είναι " +"ενεργοποιημένο το χαρακτηριστικό ``feature_namespaces`` (η προεπιλογή)." -#: library/xml.sax.handler.rst:220 +#: library/xml.sax.handler.rst:228 msgid "" "There are cases, however, when applications need to use prefixes in " "character data or in attribute values, where they cannot safely be expanded " @@ -326,8 +423,13 @@ msgid "" "events supply the information to the application to expand prefixes in those " "contexts itself, if necessary." msgstr "" +"Υπάρχουν, ωστόσο, περιπτώσεις όπου οι εφαρμογές χρειάζεται να χρησιμοποιούν " +"προθέματα σε δεδομένα χαρακτήρων ή σε τιμές ιδιοτήτων, όπου δεν μπορούν να " +"επεκταθούν αυτόματα με ασφάλεια. Τα γεγονότα :meth:`startPrefixMapping` και :" +"meth:`endPrefixMapping` παρέχουν στις εφαρμογές τις πληροφορίες για να " +"επεκτείνουν τα προθέματα σε αυτά τα συμφραζόμενα, εάν είναι απαραίτητο." -#: library/xml.sax.handler.rst:228 +#: library/xml.sax.handler.rst:236 msgid "" "Note that :meth:`startPrefixMapping` and :meth:`endPrefixMapping` events are " "not guaranteed to be properly nested relative to each-other: all :meth:" @@ -336,82 +438,115 @@ msgid "" "after the corresponding :meth:`endElement` event, but their order is not " "guaranteed." msgstr "" +"Σημειώστε ότι τα γεγονότα :meth:`startPrefixMapping` και :meth:" +"`endPrefixMapping` δεν εγγυώνται ότι θα είναι σωστά εγκατεστημένα σε σχέση " +"με το ένα το άλλο: όλα τα γεγονότα :meth:`startPrefixMapping` θα συμβούν " +"πριν από το αντίστοιχο :meth:`startElement` γεγονός, και όλα τα γεγονότα :" +"meth:`endPrefixMapping` θα συμβούν μετά το αντίστοιχο :meth:`endElement` " +"γεγονός, αλλά η σειρά τους δεν είναι εγγυημένη." -#: library/xml.sax.handler.rst:238 +#: library/xml.sax.handler.rst:246 msgid "End the scope of a prefix-URI mapping." -msgstr "" +msgstr "Τέλος της έκτασης μιας χαρτογράφησης προθέματος-URI." -#: library/xml.sax.handler.rst:240 +#: library/xml.sax.handler.rst:248 msgid "" "See :meth:`startPrefixMapping` for details. This event will always occur " "after the corresponding :meth:`endElement` event, but the order of :meth:" "`endPrefixMapping` events is not otherwise guaranteed." msgstr "" +"Δείτε :meth:`startPrefixMapping` για λεπτομέρειες. Αυτό το γεγονός θα συμβεί " +"πάντα μετά το αντίστοιχο γεγονός :meth:`endElement`, αλλά η σειρά των " +"γεγονότων :meth:`endPrefixMapping` δεν είναι εγγυημένη." -#: library/xml.sax.handler.rst:247 +#: library/xml.sax.handler.rst:255 msgid "Signals the start of an element in non-namespace mode." -msgstr "" +msgstr "Σηματοδοτεί την αρχή ενός στοιχείου σε λειτουργία χωρίς ονόματα χώρου." -#: library/xml.sax.handler.rst:249 +#: library/xml.sax.handler.rst:257 msgid "" "The *name* parameter contains the raw XML 1.0 name of the element type as a " -"string and the *attrs* parameter holds an object of the :class:`~xml.sax." -"xmlreader.Attributes` interface (see :ref:`attributes-objects`) containing " -"the attributes of the element. The object passed as *attrs* may be re-used " -"by the parser; holding on to a reference to it is not a reliable way to keep " -"a copy of the attributes. To keep a copy of the attributes, use the :meth:" -"`copy` method of the *attrs* object." -msgstr "" - -#: library/xml.sax.handler.rst:261 +"string and the *attrs* parameter holds an object of the :ref:`Attributes " +"` interface containing the attributes of the element. " +"The object passed as *attrs* may be re-used by the parser; holding on to a " +"reference to it is not a reliable way to keep a copy of the attributes. To " +"keep a copy of the attributes, use the :meth:`copy` method of the *attrs* " +"object." +msgstr "" +"Η παράμετρος *name* περιέχει το ακατέργαστο όνομα XML 1.0 του τύπου " +"στοιχείου ως συμβολοσειρά και η παράμετρος *attrs* περιέχει ένα αντικείμενο " +"της :ref:`Attributes ` διεπαφής που περιέχει τις " +"ιδιότητες του στοιχείου. Το αντικείμενο που περιέχεται στην παράμετρο " +"*attrs* μπορεί να χρησιμοποιηθεί ξανά από τον αναλυτή∙ η διατήρηση αναφοράς " +"σε αυτό δεν είναι αξιόπιστος τρόπος για να διατηρήσετε αντίγραφο των " +"ιδιοτήτων. Για να διατηρήσετε ένα αντίγραφο των ιδιοτήτων, χρησιμοποιήστε τη " +"μέθοδο :meth:`copy` του αντικειμένου *attrs*." + +#: library/xml.sax.handler.rst:268 msgid "Signals the end of an element in non-namespace mode." -msgstr "" +msgstr "Σηματοδοτεί το τέλος ενός στοιχείου σε λειτουργία χωρίς ονόματα χώρου." -#: library/xml.sax.handler.rst:263 +#: library/xml.sax.handler.rst:270 msgid "" "The *name* parameter contains the name of the element type, just as with " "the :meth:`startElement` event." msgstr "" +"Η παράμετρος *name* περιέχει το όνομα του τύπου στοιχείου, όπως και με το :" +"meth:`startElement` γεγονός." -#: library/xml.sax.handler.rst:269 +#: library/xml.sax.handler.rst:276 msgid "Signals the start of an element in namespace mode." -msgstr "" +msgstr "Σηματοδοτεί την αρχή ενός στοιχείου σε λειτουργία ονομάτων χώρου." -#: library/xml.sax.handler.rst:271 +#: library/xml.sax.handler.rst:278 msgid "" "The *name* parameter contains the name of the element type as a ``(uri, " "localname)`` tuple, the *qname* parameter contains the raw XML 1.0 name used " "in the source document, and the *attrs* parameter holds an instance of the :" -"class:`~xml.sax.xmlreader.AttributesNS` interface (see :ref:`attributes-ns-" -"objects`) containing the attributes of the element. If no namespace is " -"associated with the element, the *uri* component of *name* will be " -"``None``. The object passed as *attrs* may be re-used by the parser; " -"holding on to a reference to it is not a reliable way to keep a copy of the " -"attributes. To keep a copy of the attributes, use the :meth:`copy` method " -"of the *attrs* object." -msgstr "" +"ref:`AttributesNS ` interface containing the " +"attributes of the element. If no namespace is associated with the element, " +"the *uri* component of *name* will be ``None``. The object passed as " +"*attrs* may be re-used by the parser; holding on to a reference to it is not " +"a reliable way to keep a copy of the attributes. To keep a copy of the " +"attributes, use the :meth:`copy` method of the *attrs* object." +msgstr "" +"Η παράμετρος *name* περιέχει το όνομα του τύπου στοιχείου ως ``(uri, " +"localname)`` πλειάδα, η παράμετρος *qname* περιέχει το ακατέργαστο όνομα XML " +"1.0 που χρησιμοποιείται στο έγγραφο προέλευσης, και η παράμετρος *attrs* " +"περιέχει μια παρουσία της διεπαφής :ref:`AttributesNS ` που περιέχει τις ιδιότητες του στοιχείου. Εάν δεν συσχετίζεται " +"κανένα όνομα χώρου με το στοιχείο, το *uri* συστατικό του *name* θα είναι " +"``None``. Το αντικείμενο που περιέχεται στην παράμετρο *attrs* μπορεί να " +"χρησιμοποιηθεί ξανά από τον αναλυτή. Η διατήρηση αναφοράς σε αυτό δεν είναι " +"αξιόπιστος τρόπος για να διατηρήσετε αντίγραφο των ιδιοτήτων. Για να " +"διατηρήσετε ένα αντίγραφο των ιδιοτήτων, χρησιμοποιήστε τη μέθοδο :meth:" +"`copy` του αντικειμένου *attrs*." -#: library/xml.sax.handler.rst:282 +#: library/xml.sax.handler.rst:288 msgid "" "Parsers may set the *qname* parameter to ``None``, unless the " "``feature_namespace_prefixes`` feature is activated." msgstr "" +"Οι αναλυτές μπορούν να ορίσουν την παράμετρο *qname* σε ``None``, εκτός εάν " +"είναι ενεργοποιημένο το χαρακτηριστικό ``feature_namespace_prefixes``." -#: library/xml.sax.handler.rst:288 +#: library/xml.sax.handler.rst:294 msgid "Signals the end of an element in namespace mode." -msgstr "" +msgstr "Σηματοδοτεί το τέλος ενός στοιχείου σε λειτουργία ονομάτων χώρου." -#: library/xml.sax.handler.rst:290 +#: library/xml.sax.handler.rst:296 msgid "" "The *name* parameter contains the name of the element type, just as with " "the :meth:`startElementNS` method, likewise the *qname* parameter." msgstr "" +"Η παράμετρος *name* περιέχει το όνομα του τύπου στοιχείου, όπως και με τη :" +"meth:`startElementNS` μέθοδο, όπως και η παράμετρος *qname*." -#: library/xml.sax.handler.rst:296 +#: library/xml.sax.handler.rst:302 msgid "Receive notification of character data." -msgstr "" +msgstr "Λήψη ειδοποίησης για δεδομένα χαρακτήρων." -#: library/xml.sax.handler.rst:298 +#: library/xml.sax.handler.rst:304 msgid "" "The Parser will call this method to report each chunk of character data. SAX " "parsers may return all contiguous character data in a single chunk, or they " @@ -419,14 +554,22 @@ msgid "" "single event must come from the same external entity so that the Locator " "provides useful information." msgstr "" +"Ο Αναλυτής θα καλέσει αυτή τη μέθοδο για να αναφέρει κάθε κομμάτι δεδομένων " +"χαρακτήρων. Οι αναλυτές SAX μπορεί να επιστρέψουν όλα τα συνεχόμενα δεδομένα " +"χαρακτήρων σε ένα μοναδικό κομμάτι, ή μπορεί να τα χωρίσουν σε αρκετά " +"κομμάτια. Ωστόσο, όλοι οι χαρακτήρες σε οποιοδήποτε μεμονωμένο γεγονός " +"πρέπει να προέρχονται από την ίδια εξωτερική οντότητα, έτσι ώστε ο " +"Εντοπιστής να παρέχει χρήσιμες πληροφορίες." -#: library/xml.sax.handler.rst:304 +#: library/xml.sax.handler.rst:310 msgid "" "*content* may be a string or bytes instance; the ``expat`` reader module " "always produces strings." msgstr "" +"Το *content* μπορεί να είναι μια συμβολοσειρά ή ένα στιγμιότυπο bytes. Το " +"αναγνωστικό ``expat`` παράγει πάντα συμβολοσειρές." -#: library/xml.sax.handler.rst:309 +#: library/xml.sax.handler.rst:315 msgid "" "The earlier SAX 1 interface provided by the Python XML Special Interest " "Group used a more Java-like interface for this method. Since most parsers " @@ -435,49 +578,72 @@ msgid "" "interface, use *content* instead of slicing content with the old *offset* " "and *length* parameters." msgstr "" +"Η προηγούμενη διεπαφή SAX 1 που παρείχε η ομάδα ειδικού ενδιαφέροντος Python " +"XML Group χρησιμοποιούσε μια διεπαφή που έμοιαζε περισσότερο με τη Java για " +"αυτή τη μέθοδο. Δεδομένου ότι οι περισσότεροι αναλυτές που χρησιμοποιούνται " +"από την Python δεν εκμεταλλεύονταν την παλαιότερη διεπαφή, επιλέχθηκε η " +"απλούστερη υπογραφή για να την αντικαταστήσει. Για να μετατρέψετε τον παλιό " +"κώδικα στη νέα διεπαφή, χρησιμοποιήστε *content* αντί να τεμαχίζετε το " +"περιεχόμενο με τις παλιές παραμέτρους *offset* και *length*." -#: library/xml.sax.handler.rst:318 +#: library/xml.sax.handler.rst:324 msgid "Receive notification of ignorable whitespace in element content." -msgstr "" +msgstr "Λήψη ειδοποίησης για αγνοήσιμα κενά σε περιεχόμενο στοιχείου." -#: library/xml.sax.handler.rst:320 +#: library/xml.sax.handler.rst:326 msgid "" "Validating Parsers must use this method to report each chunk of ignorable " "whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-" "validating parsers may also use this method if they are capable of parsing " "and using content models." msgstr "" +"Οι Επικυρωτικοί Αναλυτές πρέπει να χρησιμοποιούν αυτή τη μέθοδο για να " +"αναφέρουν κάθε κομμάτι αγνοήσιμου κενού (βλ. την W3C XML 1.0 σύσταση, τμήμα " +"2.10): οι μη επικυρωτικοί αναλυτές μπορούν επίσης να χρησιμοποιούν αυτή τη " +"μέθοδο εάν είναι ικανοί να αναλύουν και να χρησιμοποιούν μοντέλα " +"περιεχομένου." -#: library/xml.sax.handler.rst:325 +#: library/xml.sax.handler.rst:331 msgid "" "SAX parsers may return all contiguous whitespace in a single chunk, or they " "may split it into several chunks; however, all of the characters in any " "single event must come from the same external entity, so that the Locator " "provides useful information." msgstr "" +"Οι αναλυτές SAX μπορεί να επιστρέψουν όλα τα συνεχόμενα κενά σε ένα μοναδικό " +"κομμάτι, ή μπορεί να τα χωρίσουν σε αρκετά κομμάτια. Ωστόσο, όλοι οι " +"χαρακτήρες σε οποιοδήποτε μεμονωμένο γεγονός πρέπει να προέρχονται από την " +"ίδια εξωτερική οντότητα, έτσι ώστε ο Εντοπιστής να παρέχει χρήσιμες " +"πληροφορίες." -#: library/xml.sax.handler.rst:333 +#: library/xml.sax.handler.rst:339 msgid "Receive notification of a processing instruction." -msgstr "" +msgstr "Λήψη ειδοποίησης για μια οδηγία επεξεργασίας." -#: library/xml.sax.handler.rst:335 +#: library/xml.sax.handler.rst:341 msgid "" "The Parser will invoke this method once for each processing instruction " "found: note that processing instructions may occur before or after the main " "document element." msgstr "" +"Ο Αναλυτής θα καλέσει αυτή τη μέθοδο μία φορά για κάθε οδηγία επεξεργασίας " +"που βρέθηκε: σημειώστε ότι οι οδηγίες επεξεργασίας μπορεί να εμφανίζονται " +"πριν ή μετά το κύριο στοιχείο του εγγράφου." -#: library/xml.sax.handler.rst:339 +#: library/xml.sax.handler.rst:345 msgid "" "A SAX parser should never report an XML declaration (XML 1.0, section 2.8) " "or a text declaration (XML 1.0, section 4.3.1) using this method." msgstr "" +"Ένας αναλυτής SAX δεν πρέπει ποτέ να αναφέρει μια δήλωση XML (XML 1.0, τμήμα " +"2.8) ή μια δήλωση κειμένου (XML 1.0, τμήμα 4.3.1) χρησιμοποιώντας αυτή τη " +"μέθοδο." -#: library/xml.sax.handler.rst:345 +#: library/xml.sax.handler.rst:351 msgid "Receive notification of a skipped entity." -msgstr "" +msgstr "Λήψη ειδοποίησης για μια παράλειψη οντότητας." -#: library/xml.sax.handler.rst:347 +#: library/xml.sax.handler.rst:353 msgid "" "The Parser will invoke this method once for each entity skipped. Non-" "validating processors may skip entities if they have not seen the " @@ -486,39 +652,48 @@ msgid "" "values of the ``feature_external_ges`` and the ``feature_external_pes`` " "properties." msgstr "" +"Ο Αναλυτής θα καλέσει αυτή τη μέθοδο μία φορά για κάθε παράλειψη οντότητας. " +"Οι μη επικυρωτικοί επεξεργαστές μπορεί να παραλείψουν οντότητες εάν δεν " +"έχουν δει τις δηλώσεις (για παράδειγμα, η οντότητα δηλώθηκε σε ένα εξωτερικό " +"υποσύνολο DTD). Όλοι οι επεξεργαστές μπορεί να παραλείψουν εξωτερικές " +"οντότητες, ανάλογα με τις τιμές των ιδιοτήτων ``feature_external_ges`` και " +"``feature_external_pes``." -#: library/xml.sax.handler.rst:357 +#: library/xml.sax.handler.rst:363 msgid "DTDHandler Objects" -msgstr "" +msgstr "DTDHandler Αντικείμενα" -#: library/xml.sax.handler.rst:359 +#: library/xml.sax.handler.rst:365 msgid ":class:`DTDHandler` instances provide the following methods:" -msgstr "" +msgstr "Τα :class:`DTDHandler` αντικείμενα παρέχουν τις ακόλουθες μεθόδους:" -#: library/xml.sax.handler.rst:364 +#: library/xml.sax.handler.rst:370 msgid "Handle a notation declaration event." -msgstr "" +msgstr "Χειρισμός ενός γεγονότος δήλωσης σημείωσης." -#: library/xml.sax.handler.rst:369 +#: library/xml.sax.handler.rst:375 msgid "Handle an unparsed entity declaration event." -msgstr "" +msgstr "Χειρισμός ενός γεγονότος δήλωσης μη αναλυμένης οντότητας." -#: library/xml.sax.handler.rst:375 +#: library/xml.sax.handler.rst:381 msgid "EntityResolver Objects" -msgstr "" +msgstr "EntityResolver Αντικείμενα" -#: library/xml.sax.handler.rst:380 +#: library/xml.sax.handler.rst:386 msgid "" "Resolve the system identifier of an entity and return either the system " "identifier to read from as a string, or an InputSource to read from. The " "default implementation returns *systemId*." msgstr "" +"Επιλύστε τον αναγνωριστικό συστήματος μιας οντότητας και επιστρέψτε είτε τον " +"αναγνωριστικό συστήματος για ανάγνωση ως συμβολοσειρά, είτε μια InputSource " +"για ανάγνωση. Η προεπιλεγμένη υλοποίηση επιστρέφει το *systemId*." -#: library/xml.sax.handler.rst:388 +#: library/xml.sax.handler.rst:394 msgid "ErrorHandler Objects" -msgstr "" +msgstr "ErrorHandler Αντικείμενα" -#: library/xml.sax.handler.rst:390 +#: library/xml.sax.handler.rst:396 msgid "" "Objects with this interface are used to receive error and warning " "information from the :class:`~xml.sax.xmlreader.XMLReader`. If you create " @@ -530,8 +705,19 @@ msgid "" "parameter. Errors and warnings may be converted to an exception by raising " "the passed-in exception object." msgstr "" +"Τα αντικείμενα με αυτή τη διεπαφή χρησιμοποιούνται για να λαμβάνουν " +"πληροφορίες σφάλματος και προειδοποίησης από το :class:`~xml.sax.xmlreader." +"XMLReader`. Εάν δημιουργήσετε ένα αντικείμενο που υλοποιεί αυτή τη διεπαφή, " +"τότε εγγράψτε το αντικείμενο με το σας :class:`~xml.sax.xmlreader." +"XMLReader`, ο αναλυτής θα καλέσει τις μεθόδους στο αντικείμενό σας για να " +"αναφέρει όλες τις προειδοποιήσεις και τα σφάλματα. Υπάρχουν τρία επίπεδα " +"σφαλμάτων διαθέσιμα: προειδοποιήσεις, (πιθανώς) ανακτήσιμα σφάλματα και μη " +"ανακτήσιμα σφάλματα. Όλες οι μέθοδοι δέχονται ένα :exc:`~xml.sax." +"SAXParseException` ως τη μόνη παράμετρο. Τα σφάλματα και οι προειδοποιήσεις " +"μπορούν να μετατραπούν σε εξαίρεση κάνοντας raise το αντικείμενο της " +"εξαίρεσης που περιέχεται." -#: library/xml.sax.handler.rst:403 +#: library/xml.sax.handler.rst:409 msgid "" "Called when the parser encounters a recoverable error. If this method does " "not raise an exception, parsing may continue, but further document " @@ -539,30 +725,43 @@ msgid "" "to continue may allow additional errors to be discovered in the input " "document." msgstr "" +"Καλείται όταν ο αναλυτής συναντήσει ένα ανακτήσιμο σφάλμα. Εάν αυτή η " +"μέθοδος δεν κάνει raise μια εξαίρεση, η ανάλυση μπορεί να συνεχιστεί, αλλά " +"δεν θα πρέπει να αναμένεται περαιτέρω πληροφορίες εγγράφου από την εφαρμογή. " +"Η επιτρεπόμενη συνέχιση του αναλυτή μπορεί να επιτρέψει την ανακάλυψη " +"πρόσθετων σφαλμάτων στο έγγραφο εισόδου." -#: library/xml.sax.handler.rst:411 +#: library/xml.sax.handler.rst:417 msgid "" "Called when the parser encounters an error it cannot recover from; parsing " "is expected to terminate when this method returns." msgstr "" +"Καλείται όταν ο αναλυτής συναντήσει ένα σφάλμα από το οποίο δεν μπορεί να " +"ανακάμψει. Η ανάλυση αναμένεται να τερματιστεί όταν αυτή η μέθοδος " +"επιστρέψει." -#: library/xml.sax.handler.rst:417 +#: library/xml.sax.handler.rst:423 msgid "" "Called when the parser presents minor warning information to the " "application. Parsing is expected to continue when this method returns, and " "document information will continue to be passed to the application. Raising " "an exception in this method will cause parsing to end." msgstr "" +"Καλείται όταν ο αναλυτής παρουσιάσει πληροφορίες προειδοποίησης στην " +"εφαρμογή. Η ανάλυση αναμένεται να συνεχιστεί όταν αυτή η μέθοδος επιστρέψει, " +"και οι πληροφορίες του εγγράφου θα συνεχίσουν να περνούν στην εφαρμογή. " +"Κάνοντας raise μια εξαίρεση σε αυτή τη μέθοδο, θα οδηγήσει στον τερματισμό " +"της ανάλυσης." -#: library/xml.sax.handler.rst:426 +#: library/xml.sax.handler.rst:432 msgid "LexicalHandler Objects" -msgstr "" +msgstr "LexicalHandler Αντικείμενα" -#: library/xml.sax.handler.rst:427 +#: library/xml.sax.handler.rst:433 msgid "Optional SAX2 handler for lexical events." -msgstr "" +msgstr "Προαιρετικός χειριστής SAX2 για λεξικά γεγονότα." -#: library/xml.sax.handler.rst:429 +#: library/xml.sax.handler.rst:435 msgid "" "This handler is used to obtain lexical information about an XML document. " "Lexical information includes information describing the document encoding " @@ -570,39 +769,53 @@ msgid "" "boundaries for the DTD and for any CDATA sections. The lexical handlers are " "used in the same manner as content handlers." msgstr "" +"Αυτός ο χειριστής χρησιμοποιείται για την απόκτηση λεξικών πληροφοριών " +"σχετικά με ένα έγγραφο XML. Οι λεξικές πληροφορίες περιλαμβάνουν πληροφορίες " +"που περιγράφουν την κωδικοποίηση του εγγράφου που χρησιμοποιείται και τα " +"σχόλια XML που ενσωματώνονται στο έγγραφο, καθώς και τα όρια τμημάτων για το " +"DTD και για τυχόν τμήματα CDATA. Οι λεξικοί χειριστές χρησιμοποιούνται με " +"τον ίδιο τρόπο όπως οι χειριστές περιεχομένου." -#: library/xml.sax.handler.rst:435 +#: library/xml.sax.handler.rst:441 msgid "" "Set the LexicalHandler of an XMLReader by using the setProperty method with " "the property identifier ``'http://xml.org/sax/properties/lexical-handler'``." msgstr "" +"Ορίστε τον LexicalHandler ενός XMLReader χρησιμοποιώντας τη μέθοδο " +"setProperty με τον αναγνωριστικό ιδιότητας ``'http://xml.org/sax/properties/" +"lexical-handler'``." -#: library/xml.sax.handler.rst:442 +#: library/xml.sax.handler.rst:448 msgid "" "Reports a comment anywhere in the document (including the DTD and outside " "the document element)." msgstr "" +"Αναφέρει ένα σχόλιο οπουδήποτε στο έγγραφο (συμπεριλαμβανομένου του DTD και " +"εκτός του στοιχείου εγγράφου)." -#: library/xml.sax.handler.rst:447 +#: library/xml.sax.handler.rst:453 msgid "" "Reports the start of the DTD declarations if the document has an associated " "DTD." msgstr "" +"Αναφέρει την αρχή των δηλώσεων DTD εάν το έγγραφο έχει συσχετισμένο DTD." -#: library/xml.sax.handler.rst:452 +#: library/xml.sax.handler.rst:458 msgid "Reports the end of DTD declaration." -msgstr "" +msgstr "Αναφέρει το τέλος της δήλωσης DTD." -#: library/xml.sax.handler.rst:456 +#: library/xml.sax.handler.rst:462 msgid "Reports the start of a CDATA marked section." -msgstr "" +msgstr "Αναφέρει την αρχή ενός τμήματος σημειωμένου ως CDATA." -#: library/xml.sax.handler.rst:458 +#: library/xml.sax.handler.rst:464 msgid "" "The contents of the CDATA marked section will be reported through the " "characters handler." msgstr "" +"Τα περιεχόμενα του τμήματος σημειωμένου ως CDATA θα αναφερθούν μέσω του " +"χειριστή χαρακτήρων." -#: library/xml.sax.handler.rst:463 +#: library/xml.sax.handler.rst:469 msgid "Reports the end of a CDATA marked section." -msgstr "" +msgstr "Αναφέρει το τέλος ενός τμήματος σημειωμένου ως CDATA." diff --git a/library/xml.sax.po b/library/xml.sax.po index 8925775d..8064edf2 100644 --- a/library/xml.sax.po +++ b/library/xml.sax.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/xml.sax.rst:2 -msgid ":mod:`xml.sax` --- Support for SAX2 parsers" +msgid ":mod:`!xml.sax` --- Support for SAX2 parsers" msgstr "" #: library/xml.sax.rst:11 @@ -34,12 +35,11 @@ msgstr "" #: library/xml.sax.rst:23 msgid "" -"The :mod:`xml.sax` module is not secure against maliciously constructed " -"data. If you need to parse untrusted or unauthenticated data see :ref:`xml-" -"vulnerabilities`." +"If you need to parse untrusted or unauthenticated data, see :ref:`xml-" +"security`." msgstr "" -#: library/xml.sax.rst:29 +#: library/xml.sax.rst:28 msgid "" "The SAX parser no longer processes general external entities by default to " "increase security. Before, the parser created network connections to fetch " @@ -49,11 +49,11 @@ msgid "" "`~xml.sax.handler.feature_external_ges`." msgstr "" -#: library/xml.sax.rst:36 +#: library/xml.sax.rst:35 msgid "The convenience functions are:" msgstr "" -#: library/xml.sax.rst:41 +#: library/xml.sax.rst:40 msgid "" "Create and return a SAX :class:`~xml.sax.xmlreader.XMLReader` object. The " "first parser found will be used. If *parser_list* is provided, it must be " @@ -62,11 +62,11 @@ msgid "" "modules in the default list of parsers." msgstr "" -#: library/xml.sax.rst:47 +#: library/xml.sax.rst:46 msgid "The *parser_list* argument can be any iterable, not just a list." msgstr "" -#: library/xml.sax.rst:53 +#: library/xml.sax.rst:52 msgid "" "Create a SAX parser and use it to parse a document. The document, passed in " "as *filename_or_stream*, can be a filename or a file object. The *handler* " @@ -77,18 +77,18 @@ msgid "" "passed in." msgstr "" -#: library/xml.sax.rst:64 +#: library/xml.sax.rst:63 msgid "" "Similar to :func:`parse`, but parses from a buffer *string* received as a " "parameter. *string* must be a :class:`str` instance or a :term:`bytes-like " "object`." msgstr "" -#: library/xml.sax.rst:68 +#: library/xml.sax.rst:67 msgid "Added support of :class:`str` instances." msgstr "" -#: library/xml.sax.rst:71 +#: library/xml.sax.rst:70 msgid "" "A typical SAX application uses three kinds of objects: readers, handlers and " "input sources. \"Reader\" in this context is another term for parser, i.e. " @@ -102,7 +102,7 @@ msgid "" "structural and syntactic events from the input data." msgstr "" -#: library/xml.sax.rst:82 +#: library/xml.sax.rst:81 msgid "" "For these objects, only the interfaces are relevant; they are normally not " "instantiated by the application itself. Since Python does not have an " @@ -118,13 +118,13 @@ msgid "" "interfaces are described below." msgstr "" -#: library/xml.sax.rst:95 +#: library/xml.sax.rst:94 msgid "" "In addition to these classes, :mod:`xml.sax` provides the following " "exception classes." msgstr "" -#: library/xml.sax.rst:101 +#: library/xml.sax.rst:100 msgid "" "Encapsulate an XML error or warning. This class can contain basic error or " "warning information from either the XML parser or the application: it can be " @@ -135,7 +135,7 @@ msgid "" "container for information." msgstr "" -#: library/xml.sax.rst:109 +#: library/xml.sax.rst:108 msgid "" "When instantiated, *msg* should be a human-readable description of the " "error. The optional *exception* parameter, if given, should be ``None`` or " @@ -143,11 +143,11 @@ msgid "" "as information." msgstr "" -#: library/xml.sax.rst:113 +#: library/xml.sax.rst:112 msgid "This is the base class for the other SAX exception classes." msgstr "" -#: library/xml.sax.rst:118 +#: library/xml.sax.rst:117 msgid "" "Subclass of :exc:`SAXException` raised on parse errors. Instances of this " "class are passed to the methods of the SAX :class:`~xml.sax.handler." @@ -156,14 +156,14 @@ msgid "" "as the :class:`SAXException` interface." msgstr "" -#: library/xml.sax.rst:128 +#: library/xml.sax.rst:127 msgid "" "Subclass of :exc:`SAXException` raised when a SAX :class:`~xml.sax.xmlreader." "XMLReader` is confronted with an unrecognized feature or property. SAX " "applications and extensions may use this class for similar purposes." msgstr "" -#: library/xml.sax.rst:136 +#: library/xml.sax.rst:135 msgid "" "Subclass of :exc:`SAXException` raised when a SAX :class:`~xml.sax.xmlreader." "XMLReader` is asked to enable a feature that is not supported, or to set a " @@ -171,54 +171,54 @@ msgid "" "applications and extensions may use this class for similar purposes." msgstr "" -#: library/xml.sax.rst:148 +#: library/xml.sax.rst:144 msgid "`SAX: The Simple API for XML `_" msgstr "" -#: library/xml.sax.rst:146 +#: library/xml.sax.rst:145 msgid "" "This site is the focal point for the definition of the SAX API. It provides " "a Java implementation and online documentation. Links to implementations " "and historical information are also available." msgstr "" -#: library/xml.sax.rst:151 +#: library/xml.sax.rst:149 msgid "Module :mod:`xml.sax.handler`" msgstr "" -#: library/xml.sax.rst:151 +#: library/xml.sax.rst:150 msgid "Definitions of the interfaces for application-provided objects." msgstr "" -#: library/xml.sax.rst:154 +#: library/xml.sax.rst:152 msgid "Module :mod:`xml.sax.saxutils`" msgstr "" -#: library/xml.sax.rst:154 +#: library/xml.sax.rst:153 msgid "Convenience functions for use in SAX applications." msgstr "" -#: library/xml.sax.rst:156 +#: library/xml.sax.rst:155 msgid "Module :mod:`xml.sax.xmlreader`" msgstr "" -#: library/xml.sax.rst:157 +#: library/xml.sax.rst:156 msgid "Definitions of the interfaces for parser-provided objects." msgstr "" -#: library/xml.sax.rst:163 +#: library/xml.sax.rst:162 msgid "SAXException Objects" msgstr "" -#: library/xml.sax.rst:165 +#: library/xml.sax.rst:164 msgid "" "The :class:`SAXException` exception class supports the following methods:" msgstr "" -#: library/xml.sax.rst:170 +#: library/xml.sax.rst:169 msgid "Return a human-readable message describing the error condition." msgstr "" -#: library/xml.sax.rst:175 +#: library/xml.sax.rst:174 msgid "Return an encapsulated exception object, or ``None``." msgstr "" diff --git a/library/xml.sax.reader.po b/library/xml.sax.reader.po index c0bfe4a7..fd11e953 100644 --- a/library/xml.sax.reader.po +++ b/library/xml.sax.reader.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/xml.sax.reader.rst:2 -msgid ":mod:`xml.sax.xmlreader` --- Interface for XML parsers" +msgid ":mod:`!xml.sax.xmlreader` --- Interface for XML parsers" msgstr "" #: library/xml.sax.reader.rst:10 diff --git a/library/xml.sax.utils.po b/library/xml.sax.utils.po index c2fc8b71..4661e0ec 100644 --- a/library/xml.sax.utils.po +++ b/library/xml.sax.utils.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/xml.sax.utils.rst:2 -msgid ":mod:`xml.sax.saxutils` --- SAX Utilities" +msgid ":mod:`!xml.sax.saxutils` --- SAX Utilities" msgstr "" #: library/xml.sax.utils.rst:10 @@ -58,7 +59,7 @@ msgstr "" msgid "" "You can unescape other strings of data by passing a dictionary as the " "optional *entities* parameter. The keys and values must all be strings; " -"each key will be replaced with its corresponding value. ``'&'``, " +"each key will be replaced with its corresponding value. ``'&'``, " "``'<'``, and ``'>'`` are always unescaped, even if *entities* is " "provided." msgstr "" @@ -75,6 +76,12 @@ msgid "" "directly as an attribute value::" msgstr "" +#: library/xml.sax.utils.rst:55 +msgid "" +">>> print(\"\" % quoteattr(\"ab ' cd \\\" ef\"))\n" +"" +msgstr "" + #: library/xml.sax.utils.rst:58 msgid "" "This function is useful when generating attribute values for HTML or any " diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index ca822cde..add91090 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/xmlrpc.client.rst:2 -msgid ":mod:`xmlrpc.client` --- XML-RPC client access" +msgid ":mod:`!xmlrpc.client` --- XML-RPC client access" msgstr "" #: library/xmlrpc.client.rst:10 @@ -36,8 +37,8 @@ msgstr "" #: library/xmlrpc.client.rst:26 msgid "" "The :mod:`xmlrpc.client` module is not secure against maliciously " -"constructed data. If you need to parse untrusted or unauthenticated data " -"see :ref:`xml-vulnerabilities`." +"constructed data. If you need to parse untrusted or unauthenticated data, " +"see :ref:`xml-security`." msgstr "" #: library/xmlrpc.client.rst:32 @@ -47,14 +48,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/xmlrpc.client.rst:41 @@ -84,29 +84,29 @@ msgid "" "class:`bytes` and :class:`bytearray` objects may be passed to calls. The " "*headers* parameter is an optional sequence of HTTP headers to send with " "each request, expressed as a sequence of 2-tuples representing the header " -"name and value. (e.g. ``[('Header-Name', 'value')]``). The obsolete " -"*use_datetime* flag is similar to *use_builtin_types* but it applies only to " -"date/time values." +"name and value. (e.g. ``[('Header-Name', 'value')]``). If an HTTPS URL is " +"provided, *context* may be :class:`ssl.SSLContext` and configures the SSL " +"settings of the underlying HTTPS connection. The obsolete *use_datetime* " +"flag is similar to *use_builtin_types* but it applies only to date/time " +"values." msgstr "" #: library/xmlrpc.client.rst:549 msgid "The *use_builtin_types* flag was added." msgstr "" -#: library/xmlrpc.client.rst:70 +#: library/xmlrpc.client.rst:72 msgid "The *headers* parameter was added." msgstr "" -#: library/xmlrpc.client.rst:73 +#: library/xmlrpc.client.rst:75 msgid "" "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP " "Basic Authentication: ``http://user:pass@host:port/path``. The ``user:" "pass`` portion will be base64-encoded as an HTTP 'Authorization' header, and " "sent to the remote server as part of the connection process when invoking an " "XML-RPC method. You only need to use this if the remote server requires a " -"Basic Authentication user and password. If an HTTPS URL is provided, " -"*context* may be :class:`ssl.SSLContext` and configures the SSL settings of " -"the underlying HTTPS connection." +"Basic Authentication user and password." msgstr "" #: library/xmlrpc.client.rst:82 @@ -266,7 +266,7 @@ msgid "" "description." msgstr "" -#: library/xmlrpc.client.rst:166 +#: library/xmlrpc.client.rst:164 msgid "`XML-RPC HOWTO `_" msgstr "" @@ -277,10 +277,9 @@ msgid "" "to know." msgstr "" -#: library/xmlrpc.client.rst:169 +#: library/xmlrpc.client.rst:168 msgid "" -"`XML-RPC Introspection `_" +"`XML-RPC Introspection `_" msgstr "" #: library/xmlrpc.client.rst:169 @@ -369,10 +368,32 @@ msgstr "" msgid "A working example follows. The server code::" msgstr "" +#: library/xmlrpc.client.rst:231 +msgid "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"\n" +"def is_even(n):\n" +" return n % 2 == 0\n" +"\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_function(is_even, \"is_even\")\n" +"server.serve_forever()" +msgstr "" + #: library/xmlrpc.client.rst:291 library/xmlrpc.client.rst:507 msgid "The client code for the preceding server::" msgstr "" +#: library/xmlrpc.client.rst:243 +msgid "" +"import xmlrpc.client\n" +"\n" +"with xmlrpc.client.ServerProxy(\"http://localhost:8000/\") as proxy:\n" +" print(\"3 is even: %s\" % str(proxy.is_even(3)))\n" +" print(\"100 is even: %s\" % str(proxy.is_even(100)))" +msgstr "" + #: library/xmlrpc.client.rst:252 msgid "DateTime Objects" msgstr "" @@ -401,6 +422,35 @@ msgid "" "comparison ` and :meth:`~object.__repr__` methods." msgstr "" +#: library/xmlrpc.client.rst:278 +msgid "" +"import datetime\n" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"import xmlrpc.client\n" +"\n" +"def today():\n" +" today = datetime.datetime.today()\n" +" return xmlrpc.client.DateTime(today)\n" +"\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_function(today, \"today\")\n" +"server.serve_forever()" +msgstr "" + +#: library/xmlrpc.client.rst:293 +msgid "" +"import xmlrpc.client\n" +"import datetime\n" +"\n" +"proxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\n" +"\n" +"today = proxy.today()\n" +"# convert the ISO8601 string to a datetime object\n" +"converted = datetime.datetime.strptime(today.value, \"%Y%m%dT%H:%M:%S\")\n" +"print(\"Today: %s\" % converted.strftime(\"%d.%m.%Y, %H:%M\"))" +msgstr "" + #: library/xmlrpc.client.rst:306 msgid "Binary Objects" msgstr "" @@ -455,10 +505,35 @@ msgid "" "XMLRPC::" msgstr "" +#: library/xmlrpc.client.rst:344 +msgid "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"import xmlrpc.client\n" +"\n" +"def python_logo():\n" +" with open(\"python_logo.jpg\", \"rb\") as handle:\n" +" return xmlrpc.client.Binary(handle.read())\n" +"\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_function(python_logo, 'python_logo')\n" +"\n" +"server.serve_forever()" +msgstr "" + #: library/xmlrpc.client.rst:357 msgid "The client gets the image and saves it to a file::" msgstr "" +#: library/xmlrpc.client.rst:359 +msgid "" +"import xmlrpc.client\n" +"\n" +"proxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\n" +"with open(\"fetched_python_logo.jpg\", \"wb\") as handle:\n" +" handle.write(proxy.python_logo().data)" +msgstr "" + #: library/xmlrpc.client.rst:368 msgid "Fault Objects" msgstr "" @@ -483,6 +558,35 @@ msgid "" "by returning a complex type object. The server code::" msgstr "" +#: library/xmlrpc.client.rst:388 +msgid "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"\n" +"# A marshalling error is going to occur because we're returning a\n" +"# complex number\n" +"def add(x, y):\n" +" return x+y+0j\n" +"\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_function(add, 'add')\n" +"\n" +"server.serve_forever()" +msgstr "" + +#: library/xmlrpc.client.rst:403 +msgid "" +"import xmlrpc.client\n" +"\n" +"proxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\n" +"try:\n" +" proxy.add(2, 5)\n" +"except xmlrpc.client.Fault as err:\n" +" print(\"A fault occurred\")\n" +" print(\"Fault code: %d\" % err.faultCode)\n" +" print(\"Fault string: %s\" % err.faultString)" +msgstr "" + #: library/xmlrpc.client.rst:418 msgid "ProtocolError Objects" msgstr "" @@ -518,6 +622,23 @@ msgid "" "`ProtocolError` by providing an invalid URI::" msgstr "" +#: library/xmlrpc.client.rst:450 +msgid "" +"import xmlrpc.client\n" +"\n" +"# create a ServerProxy with a URI that doesn't respond to XMLRPC requests\n" +"proxy = xmlrpc.client.ServerProxy(\"http://google.com/\")\n" +"\n" +"try:\n" +" proxy.some_method()\n" +"except xmlrpc.client.ProtocolError as err:\n" +" print(\"A protocol error occurred\")\n" +" print(\"URL: %s\" % err.url)\n" +" print(\"HTTP/HTTPS headers: %s\" % err.headers)\n" +" print(\"Error code: %d\" % err.errcode)\n" +" print(\"Error message: %s\" % err.errmsg)" +msgstr "" + #: library/xmlrpc.client.rst:465 msgid "MultiCall Objects" msgstr "" @@ -543,13 +664,55 @@ msgstr "" msgid "A usage example of this class follows. The server code::" msgstr "" +#: library/xmlrpc.client.rst:483 +msgid "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"\n" +"def add(x, y):\n" +" return x + y\n" +"\n" +"def subtract(x, y):\n" +" return x - y\n" +"\n" +"def multiply(x, y):\n" +" return x * y\n" +"\n" +"def divide(x, y):\n" +" return x // y\n" +"\n" +"# A simple server with simple arithmetic functions\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_multicall_functions()\n" +"server.register_function(add, 'add')\n" +"server.register_function(subtract, 'subtract')\n" +"server.register_function(multiply, 'multiply')\n" +"server.register_function(divide, 'divide')\n" +"server.serve_forever()" +msgstr "" + +#: library/xmlrpc.client.rst:509 +msgid "" +"import xmlrpc.client\n" +"\n" +"proxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\n" +"multicall = xmlrpc.client.MultiCall(proxy)\n" +"multicall.add(7, 3)\n" +"multicall.subtract(7, 3)\n" +"multicall.multiply(7, 3)\n" +"multicall.divide(7, 3)\n" +"result = multicall()\n" +"\n" +"print(\"7+3=%d, 7-3=%d, 7*3=%d, 7//3=%d\" % tuple(result))" +msgstr "" + #: library/xmlrpc.client.rst:523 msgid "Convenience Functions" msgstr "" #: library/xmlrpc.client.rst:527 msgid "" -"Convert *params* into an XML-RPC request. or into a response if " +"Convert *params* into an XML-RPC request, or into a response if " "*methodresponse* is true. *params* can be either a tuple of arguments or an " "instance of the :exc:`Fault` exception class. If *methodresponse* is true, " "only a single value can be returned, meaning that *params* must be of length " @@ -580,12 +743,52 @@ msgstr "" msgid "Example of Client Usage" msgstr "" +#: library/xmlrpc.client.rst:560 +msgid "" +"# simple test program (from the XML-RPC specification)\n" +"from xmlrpc.client import ServerProxy, Error\n" +"\n" +"# server = ServerProxy(\"http://localhost:8000\") # local server\n" +"with ServerProxy(\"http://betty.userland.com\") as proxy:\n" +"\n" +" print(proxy)\n" +"\n" +" try:\n" +" print(proxy.examples.getStateName(41))\n" +" except Error as v:\n" +" print(\"ERROR\", v)" +msgstr "" + #: library/xmlrpc.client.rst:573 msgid "" "To access an XML-RPC server through a HTTP proxy, you need to define a " "custom transport. The following example shows how::" msgstr "" +#: library/xmlrpc.client.rst:576 +msgid "" +"import http.client\n" +"import xmlrpc.client\n" +"\n" +"class ProxiedTransport(xmlrpc.client.Transport):\n" +"\n" +" def set_proxy(self, host, port=None, headers=None):\n" +" self.proxy = host, port\n" +" self.proxy_headers = headers\n" +"\n" +" def make_connection(self, host):\n" +" connection = http.client.HTTPConnection(*self.proxy)\n" +" connection.set_tunnel(host, headers=self.proxy_headers)\n" +" self._connection = host, connection\n" +" return connection\n" +"\n" +"transport = ProxiedTransport()\n" +"transport.set_proxy('proxy-server', 8080)\n" +"server = xmlrpc.client.ServerProxy('http://betty.userland.com', " +"transport=transport)\n" +"print(server.examples.getStateName(41))" +msgstr "" + #: library/xmlrpc.client.rst:598 msgid "Example of Client and Server Usage" msgstr "" diff --git a/library/xmlrpc.po b/library/xmlrpc.po index 123f91b0..9bf25495 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -20,23 +21,23 @@ msgstr "" msgid ":mod:`!xmlrpc` --- XMLRPC server and client modules" msgstr "" -#: library/xmlrpc.rst:4 +#: library/xmlrpc.rst:7 msgid "" "XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a " "transport. With it, a client can call methods with parameters on a remote " "server (the server is named by a URI) and get back structured data." msgstr "" -#: library/xmlrpc.rst:8 +#: library/xmlrpc.rst:11 msgid "" "``xmlrpc`` is a package that collects server and client modules implementing " "XML-RPC. The modules are:" msgstr "" -#: library/xmlrpc.rst:11 +#: library/xmlrpc.rst:14 msgid ":mod:`xmlrpc.client`" msgstr "" -#: library/xmlrpc.rst:12 +#: library/xmlrpc.rst:15 msgid ":mod:`xmlrpc.server`" msgstr "" diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index 91daeb6a..5c7ab7f6 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/xmlrpc.server.rst:2 -msgid ":mod:`xmlrpc.server` --- Basic XML-RPC servers" +msgid ":mod:`!xmlrpc.server` --- Basic XML-RPC servers" msgstr "" #: library/xmlrpc.server.rst:10 @@ -35,19 +36,18 @@ msgstr "" #: library/xmlrpc.server.rst:22 msgid "" "The :mod:`xmlrpc.server` module is not secure against maliciously " -"constructed data. If you need to parse untrusted or unauthenticated data " -"see :ref:`xml-vulnerabilities`." +"constructed data. If you need to parse untrusted or unauthenticated data, " +"see :ref:`xml-security`." msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/xmlrpc.server.rst:32 @@ -179,18 +179,97 @@ msgstr "" msgid "Server code::" msgstr "" +#: library/xmlrpc.server.rst:150 +msgid "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"from xmlrpc.server import SimpleXMLRPCRequestHandler\n" +"\n" +"# Restrict to a particular path.\n" +"class RequestHandler(SimpleXMLRPCRequestHandler):\n" +" rpc_paths = ('/RPC2',)\n" +"\n" +"# Create server\n" +"with SimpleXMLRPCServer(('localhost', 8000),\n" +" requestHandler=RequestHandler) as server:\n" +" server.register_introspection_functions()\n" +"\n" +" # Register pow() function; this will use the value of\n" +" # pow.__name__ as the name, which is just 'pow'.\n" +" server.register_function(pow)\n" +"\n" +" # Register a function under a different name\n" +" def adder_function(x, y):\n" +" return x + y\n" +" server.register_function(adder_function, 'add')\n" +"\n" +" # Register an instance; all the methods of the instance are\n" +" # published as XML-RPC methods (in this case, just 'mul').\n" +" class MyFuncs:\n" +" def mul(self, x, y):\n" +" return x * y\n" +"\n" +" server.register_instance(MyFuncs())\n" +"\n" +" # Run the server's main loop\n" +" server.serve_forever()" +msgstr "" + #: library/xmlrpc.server.rst:182 msgid "" "The following client code will call the methods made available by the " "preceding server::" msgstr "" +#: library/xmlrpc.server.rst:185 +msgid "" +"import xmlrpc.client\n" +"\n" +"s = xmlrpc.client.ServerProxy('http://localhost:8000')\n" +"print(s.pow(2,3)) # Returns 2**3 = 8\n" +"print(s.add(2,3)) # Returns 5\n" +"print(s.mul(5,2)) # Returns 5*2 = 10\n" +"\n" +"# Print list of available methods\n" +"print(s.system.listMethods())" +msgstr "" + #: library/xmlrpc.server.rst:195 msgid "" ":meth:`register_function` can also be used as a decorator. The previous " "server example can register functions in a decorator way::" msgstr "" +#: library/xmlrpc.server.rst:198 +msgid "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"from xmlrpc.server import SimpleXMLRPCRequestHandler\n" +"\n" +"class RequestHandler(SimpleXMLRPCRequestHandler):\n" +" rpc_paths = ('/RPC2',)\n" +"\n" +"with SimpleXMLRPCServer(('localhost', 8000),\n" +" requestHandler=RequestHandler) as server:\n" +" server.register_introspection_functions()\n" +"\n" +" # Register pow() function; this will use the value of\n" +" # pow.__name__ as the name, which is just 'pow'.\n" +" server.register_function(pow)\n" +"\n" +" # Register a function under a different name, using\n" +" # register_function as a decorator. *name* can only be given\n" +" # as a keyword argument.\n" +" @server.register_function(name='add')\n" +" def adder_function(x, y):\n" +" return x + y\n" +"\n" +" # Register a function under function.__name__.\n" +" @server.register_function\n" +" def mul(x, y):\n" +" return x * y\n" +"\n" +" server.serve_forever()" +msgstr "" + #: library/xmlrpc.server.rst:226 msgid "" "The following example included in the :file:`Lib/xmlrpc/server.py` module " @@ -204,21 +283,75 @@ msgid "" "on your machine. Only use this example only within a secure, closed network." msgstr "" +#: library/xmlrpc.server.rst:237 +msgid "" +"import datetime\n" +"\n" +"class ExampleService:\n" +" def getData(self):\n" +" return '42'\n" +"\n" +" class currentTime:\n" +" @staticmethod\n" +" def getCurrentTime():\n" +" return datetime.datetime.now()\n" +"\n" +"with SimpleXMLRPCServer((\"localhost\", 8000)) as server:\n" +" server.register_function(pow)\n" +" server.register_function(lambda x,y: x+y, 'add')\n" +" server.register_instance(ExampleService(), allow_dotted_names=True)\n" +" server.register_multicall_functions()\n" +" print('Serving XML-RPC on localhost port 8000')\n" +" try:\n" +" server.serve_forever()\n" +" except KeyboardInterrupt:\n" +" print(\"\\nKeyboard interrupt received, exiting.\")\n" +" sys.exit(0)" +msgstr "" + #: library/xmlrpc.server.rst:260 msgid "This ExampleService demo can be invoked from the command line::" msgstr "" +#: library/xmlrpc.server.rst:262 +msgid "python -m xmlrpc.server" +msgstr "" + #: library/xmlrpc.server.rst:265 msgid "" "The client that interacts with the above server is included in ``Lib/xmlrpc/" "client.py``::" msgstr "" +#: library/xmlrpc.server.rst:268 +msgid "" +"server = ServerProxy(\"http://localhost:8000\")\n" +"\n" +"try:\n" +" print(server.currentTime.getCurrentTime())\n" +"except Error as v:\n" +" print(\"ERROR\", v)\n" +"\n" +"multi = MultiCall(server)\n" +"multi.getData()\n" +"multi.pow(2,9)\n" +"multi.add(1,2)\n" +"try:\n" +" for response in multi():\n" +" print(response)\n" +"except Error as v:\n" +" print(\"ERROR\", v)" +msgstr "" + #: library/xmlrpc.server.rst:285 msgid "" "This client which interacts with the demo XMLRPC server can be invoked as::" msgstr "" +#: library/xmlrpc.server.rst:287 +msgid "python -m xmlrpc.client" +msgstr "" + #: library/xmlrpc.server.rst:291 msgid "CGIXMLRPCRequestHandler" msgstr "" @@ -265,6 +398,21 @@ msgstr "" msgid "Example::" msgstr "" +#: library/xmlrpc.server.rst:344 +msgid "" +"class MyFuncs:\n" +" def mul(self, x, y):\n" +" return x * y\n" +"\n" +"\n" +"handler = CGIXMLRPCRequestHandler()\n" +"handler.register_function(pow)\n" +"handler.register_function(lambda x,y: x+y, 'add')\n" +"handler.register_introspection_functions()\n" +"handler.register_instance(MyFuncs())\n" +"handler.handle_request()" +msgstr "" + #: library/xmlrpc.server.rst:358 msgid "Documenting XMLRPC server" msgstr "" diff --git a/library/zipapp.po b/library/zipapp.po index a7efec0a..b6603a2d 100644 --- a/library/zipapp.po +++ b/library/zipapp.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-06-14 12:23+0300\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/zipapp.rst:2 -msgid ":mod:`zipapp` --- Manage executable Python zip archives" -msgstr "" +msgid ":mod:`!zipapp` --- Manage executable Python zip archives" +msgstr ":mod:`!zipapp` --- Διαχείριση εκτελέσιμων αρχείων zip Python" #: library/zipapp.rst:9 msgid "**Source code:** :source:`Lib/zipapp.py`" -msgstr "" +msgstr "**Πηγαίος κώδικας:** :source:`Lib/zipapp.py`" #: library/zipapp.rst:16 msgid "" @@ -31,10 +32,15 @@ msgid "" "`. The module provides both a :ref:`zipapp-" "command-line-interface` and a :ref:`zipapp-python-api`." msgstr "" +"Το παρόν module παρέχει εργαλεία για τη διαχείριση της δημιουργίας αρχείων " +"zip που περιέχουν κώδικα Python, τα οποία μπορούν να :ref:`executed directly " +"by the Python interpreter `. Το module παρέχει " +"τόσο μια :ref:`zipapp-command-line-interface` όσο και ένα :ref:`zipapp-" +"python-api`." #: library/zipapp.rst:23 msgid "Basic Example" -msgstr "" +msgstr "Βασικό Παράδειγμα" #: library/zipapp.rst:25 msgid "" @@ -43,15 +49,35 @@ msgid "" "code. When run, the archive will execute the ``main`` function from the " "module ``myapp`` in the archive." msgstr "" +"Το παρακάτω παράδειγμα δείχνει πώς μπορεί να χρησιμοποιηθεί η :ref:`zipapp-" +"command-line-interface` για να δημιουργήσει ένα εκτελέσιμο αρχείο από έναν " +"φάκελο που περιέχει κώδικα Python. Όταν εκτελείται, το αρχείο θα εκτελέσει " +"τη συνάρτηση ``main`` από το module ``myapp`` στο αρχείο." + +#: library/zipapp.rst:30 +msgid "" +"$ python -m zipapp myapp -m \"myapp:main\"\n" +"$ python myapp.pyz\n" +"" +msgstr "" +"$ python -m zipapp myapp -m \"myapp:main\"\n" +"$ python myapp.pyz\n" +"" #: library/zipapp.rst:40 msgid "Command-Line Interface" -msgstr "" +msgstr "Διεπαφή Γραμμής Εντολών" #: library/zipapp.rst:42 msgid "" "When called as a program from the command line, the following form is used:" msgstr "" +"Όταν καλείται ως πρόγραμμα από τη γραμμή εντολών, χρησιμοποιείται η παρακάτω " +"μορφή:" + +#: library/zipapp.rst:44 +msgid "$ python -m zipapp source [options]" +msgstr "$ python -m zipapp source [options]" #: library/zipapp.rst:48 msgid "" @@ -60,10 +86,14 @@ msgid "" "copied to the target archive (or the contents of its shebang line will be " "displayed if the --info option is specified)." msgstr "" +"Αν το *source* είναι ένας φάκελος, αυτό θα δημιουργήσει ένα αρχείο από τα " +"περιεχόμενα του *source*. Αν το *source* είναι ένα αρχείο, θα πρέπει να " +"είναι ένα αρχείο, και θα αντιγραφεί στο αρχείο προορισμού (ή το περιεχόμενο " +"της γραμμής shebang θα εμφανιστεί αν έχει καθοριστεί η επιλογή --info)." #: library/zipapp.rst:53 msgid "The following options are understood:" -msgstr "" +msgstr "Οι παρακάτω επιλογές γίνονται κατανοητές:" #: library/zipapp.rst:59 msgid "" @@ -72,12 +102,20 @@ msgid "" "extension ``.pyz`` added. If an explicit filename is given, it is used as " "is (so a ``.pyz`` extension should be included if required)." msgstr "" +"Γράφει την έξοδο σε ένα αρχείο με όνομα *output*. Αν αυτή η επιλογή δεν " +"καθοριστεί, το όνομα του αρχείου εξόδου θα είναι το ίδιο με το εισαγωγικό " +"*source*, με την προσθήκη της επέκτασης ``.pyz``. Αν καθοριστεί ένα ρητό " +"όνομα αρχείου, χρησιμοποιείται όπως είναι (έτσι θα πρέπει να συμπεριληφθεί " +"μια επέκταση ``.pyz`` αν απαιτείται)." #: library/zipapp.rst:64 msgid "" "An output filename must be specified if the *source* is an archive (and in " "that case, *output* must not be the same as *source*)." msgstr "" +"Ένα όνομα αρχείου εξόδου πρέπει να καθοριστεί αν το *source* είναι ένα " +"αρχείο (και σε αυτή την περίπτωση, το *output* δεν πρέπει να είναι το ίδιο " +"με το *source*)." #: library/zipapp.rst:69 msgid "" @@ -85,6 +123,10 @@ msgid "" "run. Also, on POSIX, make the archive executable. The default is to write " "no ``#!`` line, and not make the file executable." msgstr "" +"Προσθέτει μια γραμμή ``#!`` στο αρχείο που καθορίζει το *interpreter* ως την " +"εντολή που θα εκτελεστεί. Επίσης, σε POSIX, καθιστά το αρχείο εκτελέσιμο. Η " +"προεπιλογή είναι να μην γράφεται καμία γραμμή ``#!`` και να μην καθίσταται " +"το αρχείο εκτελέσιμο." #: library/zipapp.rst:75 msgid "" @@ -93,20 +135,30 @@ msgid "" "a package/module in the archive, and \"fn\" is a callable in the given " "module. The ``__main__.py`` file will execute that callable." msgstr "" +"Γράφει ένα αρχείο ``__main__.py`` στο αρχείο που εκτελεί το *mainfn*. Το " +"*mainfn* πρέπει να έχει τη μορφή \"pkg.mod:fn\", όπου \"pkg.mod\" είναι ένα " +"πακέτο/module στο αρχείο, και \"fn\" είναι μια καλούμενη συνάρτηση στο " +"δεδομένο module. Το αρχείο ``__main__.py`` θα εκτελέσει αυτή τη συνάρτηση." #: library/zipapp.rst:80 msgid ":option:`--main` cannot be specified when copying an archive." msgstr "" +"Η επιλογή :option:`--main` δεν μπορεί να καθοριστεί κατά την αντιγραφή ενός " +"αρχείου." #: library/zipapp.rst:84 msgid "" "Compress files with the deflate method, reducing the size of the output " "file. By default, files are stored uncompressed in the archive." msgstr "" +"Συμπιέζει τα αρχεία με τη μέθοδο deflate, μειώνοντας το μέγεθος του αρχείου " +"εξόδου. Από προεπιλογή, τα αρχεία αποθηκεύονται χωρίς συμπίεση στο αρχείο." #: library/zipapp.rst:87 msgid ":option:`--compress` has no effect when copying an archive." msgstr "" +"Η επιλογή :option:`--compress` δεν έχει καμία επίδραση κατά την αντιγραφή " +"ενός αρχείου." #: library/zipapp.rst:93 msgid "" @@ -114,24 +166,29 @@ msgid "" "In this case, any other options are ignored and SOURCE must be an archive, " "not a directory." msgstr "" +"Εμφανίζει τον ενσωματωμένο διερμηνέα στο αρχείο, για διαγνωστικούς σκοπούς. " +"Σε αυτή την περίπτωση, αγνοούνται όλες οι άλλες επιλογές και το SOURCE " +"πρέπει να είναι ένα αρχείο, όχι ένας φάκελος." #: library/zipapp.rst:99 msgid "Print a short usage message and exit." -msgstr "" +msgstr "Εκτυπώνει ένα σύντομο μήνυμα χρήσης και εξέρχεται." #: library/zipapp.rst:105 msgid "Python API" -msgstr "" +msgstr "Διεπαφή Python" #: library/zipapp.rst:107 msgid "The module defines two convenience functions:" -msgstr "" +msgstr "Το module ορίζει δύο συναρτήσεις ευκολίας:" #: library/zipapp.rst:112 msgid "" "Create an application archive from *source*. The source can be any of the " "following:" msgstr "" +"Δημιουργεί ένα αρχείο εφαρμογής από το *source*. Η πηγή μπορεί να είναι " +"οποιοδήποτε από τα παρακάτω:" #: library/zipapp.rst:115 msgid "" @@ -139,6 +196,9 @@ msgid "" "directory, in which case a new application archive will be created from the " "content of that directory." msgstr "" +"Το όνομα ενός φακέλου, ή ένα :term:`path-like object` που αναφέρεται σε έναν " +"φάκελο, οπότε θα δημιουργηθεί ένα νέο αρχείο εφαρμογής από το περιεχόμενο " +"αυτού του φακέλου." #: library/zipapp.rst:118 msgid "" @@ -147,6 +207,11 @@ msgid "" "target (modifying it to reflect the value given for the *interpreter* " "argument). The file name should include the ``.pyz`` extension, if required." msgstr "" +"Το όνομα ενός υπάρχοντος αρχείου εφαρμογής, ή ένα :term:`path-like object` " +"που αναφέρεται σε ένα τέτοιο αρχείο, οπότε το αρχείο αντιγράφεται στο " +"προορισμό (τροποποιώντας το για να αντικατοπτρίζει την τιμή που δίνεται για " +"το όρισμα *interpreter*). Το όνομα του αρχείου θα πρέπει να περιλαμβάνει την " +"επέκταση ``.pyz``, αν απαιτείται." #: library/zipapp.rst:122 msgid "" @@ -154,23 +219,31 @@ msgid "" "should be an application archive, and the file object is assumed to be " "positioned at the start of the archive." msgstr "" +"Ένα αντικείμενο αρχείου ανοιχτό για ανάγνωση σε λειτουργία bytes. Το " +"περιεχόμενο του αρχείου θα πρέπει να είναι ένα αρχείο εφαρμογής, και το " +"αντικείμενο αρχείου θεωρείται ότι είναι τοποθετημένο στην αρχή του αρχείου." #: library/zipapp.rst:126 msgid "" "The *target* argument determines where the resulting archive will be written:" -msgstr "" +msgstr "Το όρισμα *target* καθορίζει που θα γραφτεί το αποτέλεσμα του αρχείου:" #: library/zipapp.rst:129 msgid "" "If it is the name of a file, or a :term:`path-like object`, the archive will " "be written to that file." msgstr "" +"Αν είναι το όνομα ενός αρχείου, ή ένα :term:`path-like object`, το αρχείο θα " +"γραφτεί σε αυτό το αρχείο." #: library/zipapp.rst:131 msgid "" "If it is an open file object, the archive will be written to that file " "object, which must be open for writing in bytes mode." msgstr "" +"Αν είναι ένα ανοιχτό αντικείμενο αρχείου, το αρχείο θα γραφτεί σε αυτό το " +"αντικείμενο αρχείου, το οποίο πρέπει να είναι ανοιχτό για εγγραφή σε " +"λειτουργία bytes." #: library/zipapp.rst:133 msgid "" @@ -178,6 +251,9 @@ msgid "" "the target will be a file with the same name as the source, with a ``.pyz`` " "extension added." msgstr "" +"Αν το όρισμα προορισμού παραλειφθεί (ή είναι ``None``), η πηγή πρέπει να " +"είναι ένας φάκελος και ο προορισμός θα είναι ένα αρχείο με το ίδιο όνομα με " +"την πηγή, με μια επέκταση ``.pyz`` προστιθέμενη." #: library/zipapp.rst:137 msgid "" @@ -189,6 +265,13 @@ msgid "" "is specified, and the target is a filename, the executable bit of the target " "file will be set." msgstr "" +"Το όρισμα *interpreter* καθορίζει το όνομα του διερμηνέα Python με τον οποίο " +"θα εκτελείται το αρχείο. Γράφεται ως μια γραμμή \"shebang\" στην αρχή του " +"αρχείου. Σε POSIX, αυτό θα ερμηνευτεί από το λειτουργικό σύστημα, και σε " +"Windows θα διαχειριστεί από τον διερμηνέα Python. Η παράλειψη του " +"*interpreter* έχει ως αποτέλεσμα να μην γραφτεί καμία γραμμή shebang. Αν " +"καθοριστεί ένας διερμηνέας, και ο προορισμός είναι ένα όνομα αρχείου, θα " +"τεθεί το εκτελέσιμο bit του αρχείου προορισμού." #: library/zipapp.rst:145 msgid "" @@ -201,6 +284,15 @@ msgid "" "a directory and does not contain a ``__main__.py`` file, as otherwise the " "resulting archive would not be executable." msgstr "" +"Το όρισμα *main* καθορίζει το όνομα μιας καλούμενης συνάρτησης που θα " +"χρησιμοποιηθεί ως το κύριο πρόγραμμα για το αρχείο. Μπορεί να καθοριστεί " +"μόνο αν η πηγή είναι ένας φάκελος, και η πηγή δεν περιέχει ήδη ένα αρχείο " +"``__main__.py``. Το όρισμα *main* θα πρέπει να έχει τη μορφή \"pkg.module:" +"callable\" και το αρχείο θα εκτελείται με την εισαγωγή \"pkg.module\" και " +"την εκτέλεση της δεδομένης καλούμενης συνάρτησης χωρίς ορίσματα. Είναι " +"σφάλμα να παραλειφθεί το *main* αν η πηγή είναι ένας φάκελος και δεν " +"περιέχει ένα αρχείο ``__main__.py``, καθώς διαφορετικά το παραγόμενο αρχείο " +"δεν θα ήταν εκτελέσιμο." #: library/zipapp.rst:155 msgid "" @@ -208,6 +300,10 @@ msgid "" "a Path object representing the path to the file being added (relative to the " "source directory). It should return ``True`` if the file is to be added." msgstr "" +"Το προαιρετικό όρισμα *filter* καθορίζει μια συνάρτηση callback που περνάει " +"ένα αντικείμενο Path που αναπαριστά το μονοπάτι του αρχείου που προστίθεται " +"(σχετικό με τον φάκελο πηγής). Θα πρέπει να επιστρέφει ``True`` αν το αρχείο " +"πρέπει να προστεθεί." #: library/zipapp.rst:160 msgid "" @@ -216,12 +312,18 @@ msgid "" "method; otherwise, files are stored uncompressed. This argument has no " "effect when copying an existing archive." msgstr "" +"Το προαιρετικό όρισμα *compressed* καθορίζει αν τα αρχεία συμπιέζονται. Αν " +"οριστεί σε ``True``, τα αρχεία στο αρχείο συμπιέζονται με τη μέθοδο deflate. " +"Διαφορετικά, τα αρχεία αποθηκεύονται χωρίς συμπίεση. Αυτό το όρισμα δεν έχει " +"καμία επίδραση κατά την αντιγραφή ενός υπάρχοντος αρχείου." #: library/zipapp.rst:165 msgid "" "If a file object is specified for *source* or *target*, it is the caller's " "responsibility to close it after calling create_archive." msgstr "" +"Αν ένα αντικείμενο αρχείου καθοριστεί για το *source* ή το *target*, είναι " +"ευθύνη του καλούντος να το κλείσει μετά την κλήση της create_archive." #: library/zipapp.rst:168 msgid "" @@ -230,10 +332,15 @@ msgid "" "directory, if the target is a file object it will be passed to the ``zipfile." "ZipFile`` class, and must supply the methods needed by that class." msgstr "" +"Κατά την αντιγραφή ενός υπάρχοντος αρχείου, τα αντικείμενα αρχείων που " +"παρέχονται χρειάζονται μόνο τις μεθόδους ``read`` και ``readline``, ή " +"``write``. Όταν δημιουργείται ένα αρχείο από έναν φάκελο, αν το target είναι " +"ένα αντικείμενο αρχείου, θα περαστεί στην κλάση ``zipfile.ZipFile`` και " +"πρέπει να παρέχει τις μεθόδους που χρειάζεται αυτή η κλάση." #: library/zipapp.rst:174 msgid "Added the *filter* and *compressed* parameters." -msgstr "" +msgstr "Προστέθηκαν οι παράμετροι *filter* και *compressed*." #: library/zipapp.rst:179 msgid "" @@ -242,30 +349,78 @@ msgid "" "argument can be a filename or a file-like object open for reading in bytes " "mode. It is assumed to be at the start of the archive." msgstr "" +"Επιστρέφει τον διερμηνέα που καθορίζεται στη γραμμή ``#!`` στην αρχή του " +"αρχείου. Αν δεν υπάρχει γραμμή ``#!``, επιστρέφει :const:`None`. Το " +"*archive* μπορεί να είναι ένα όνομα αρχείου ή ένα αντικείμενο που μοιάζει με " +"αρχείο και είναι ανοιχτό για ανάγνωση σε bytes." #: library/zipapp.rst:188 msgid "Examples" -msgstr "" +msgstr "Παραδείγματα" #: library/zipapp.rst:190 msgid "Pack up a directory into an archive, and run it." +msgstr "Συσκευάζει έναν φάκελο σε ένα αρχείο, και το εκτελεί." + +#: library/zipapp.rst:192 +msgid "" +"$ python -m zipapp myapp\n" +"$ python myapp.pyz\n" +"" msgstr "" +"$ python -m zipapp myapp\n" +"$ python myapp.pyz\n" +"" #: library/zipapp.rst:198 msgid "The same can be done using the :func:`create_archive` function::" msgstr "" +"Το ίδιο μπορεί να γίνει χρησιμοποιώντας τη συνάρτηση :func:`create_archive`::" + +#: library/zipapp.rst:200 +msgid "" +">>> import zipapp\n" +">>> zipapp.create_archive('myapp', 'myapp.pyz')" +msgstr "" +">>> import zipapp\n" +">>> zipapp.create_archive('myapp', 'myapp.pyz')" #: library/zipapp.rst:203 msgid "" "To make the application directly executable on POSIX, specify an interpreter " "to use." msgstr "" +"Για να κάνετε την εφαρμογή άμεσα εκτελέσιμη σε POSIX, καθορίστε έναν " +"διερμηνέα που θα χρησιμοποιηθεί." + +#: library/zipapp.rst:206 +msgid "" +"$ python -m zipapp myapp -p \"/usr/bin/env python\"\n" +"$ ./myapp.pyz\n" +"" +msgstr "" +"$ python -m zipapp myapp -p \"/usr/bin/env python\"\n" +"$ ./myapp.pyz\n" +"" #: library/zipapp.rst:212 msgid "" "To replace the shebang line on an existing archive, create a modified " "archive using the :func:`create_archive` function::" msgstr "" +"Για να αντικαταστήσετε τη γραμμή shebang σε ένα υπάρχον αρχείο, δημιουργήστε " +"ένα τροποποιημένο αρχείο χρησιμοποιώντας τη συνάρτηση :func:" +"`create_archive`::" + +#: library/zipapp.rst:215 +msgid "" +">>> import zipapp\n" +">>> zipapp.create_archive('old_archive.pyz', 'new_archive.pyz', '/usr/bin/" +"python3')" +msgstr "" +">>> import zipapp\n" +">>> zipapp.create_archive('old_archive.pyz', 'new_archive.pyz', '/usr/bin/" +"python3')" #: library/zipapp.rst:218 msgid "" @@ -276,10 +431,33 @@ msgid "" "errors, but production code should do so. Also, this method will only work " "if the archive fits in memory::" msgstr "" +"Για να ενημερώσετε το αρχείο στη θέση του, κάντε την αντικατάσταση στη μνήμη " +"χρησιμοποιώντας ένα αντικείμενο :class:`~io.BytesIO`, και στη συνέχεια " +"αντικαταστήστε την πηγή. Σημειώστε ότι υπάρχει κίνδυνος κατά την " +"αντικατάσταση ενός αρχείου στη θέση του ότι ένα σφάλμα θα οδηγήσει στην " +"απώλεια του αρχικού αρχείου. Αυτός ο κώδικας δεν προστατεύει από τέτοια " +"σφάλματα, αλλά ο κώδικας παραγωγής θα πρέπει να το κάνει. Επίσης, αυτή η " +"μέθοδος θα λειτουργήσει μόνο αν το αρχείο χωράει στη μνήμη::" + +#: library/zipapp.rst:225 +msgid "" +">>> import zipapp\n" +">>> import io\n" +">>> temp = io.BytesIO()\n" +">>> zipapp.create_archive('myapp.pyz', temp, '/usr/bin/python2')\n" +">>> with open('myapp.pyz', 'wb') as f:\n" +">>> f.write(temp.getvalue())" +msgstr "" +">>> import zipapp\n" +">>> import io\n" +">>> temp = io.BytesIO()\n" +">>> zipapp.create_archive('myapp.pyz', temp, '/usr/bin/python2')\n" +">>> with open('myapp.pyz', 'wb') as f:\n" +">>> f.write(temp.getvalue())" #: library/zipapp.rst:236 msgid "Specifying the Interpreter" -msgstr "" +msgstr "Καθορισμός του Διερμηνέα" #: library/zipapp.rst:238 msgid "" @@ -288,6 +466,11 @@ msgid "" "Python launcher for Windows supports most common forms of POSIX ``#!`` line, " "but there are other issues to consider:" msgstr "" +"Σημειώστε ότι αν καθορίσετε έναν διερμηνέα και στη συνέχεια διανείμετε το " +"αρχείο εφαρμογής σας, πρέπει να διασφαλίσετε ότι ο διερμηνέας που " +"χρησιμοποιείται είναι φορητός. Ο διερμηνέας Python για Windows υποστηρίζει " +"τις περισσότερες κοινές μορφές γραμμής ``#!`` POSIX, αλλά υπάρχουν και άλλα " +"ζητήματα που πρέπει να ληφθούν υπόψη:" #: library/zipapp.rst:243 msgid "" @@ -296,6 +479,10 @@ msgid "" "may have either Python 2 or Python 3 as their default, and write your code " "to work under both versions." msgstr "" +"Αν χρησιμοποιήσετε \"/usr/bin/env python\" (ή άλλες μορφές της εντολής " +"\"python\", όπως \"/usr/bin/python\"), πρέπει να λάβετε υπόψη ότι οι χρήστες " +"σας μπορεί να έχουν είτε Python 2 είτε Python 3 ως προεπιλογή, και να " +"γράψετε τον κώδικά σας ώστε να λειτουργεί και στις δύο εκδόσεις." #: library/zipapp.rst:247 msgid "" @@ -303,6 +490,10 @@ msgid "" "application will not work for users who do not have that version. (This may " "be what you want if you have not made your code Python 2 compatible)." msgstr "" +"Αν χρησιμοποιήσετε μια ρητή έκδοση, για παράδειγμα \"/usr/bin/env python3\", " +"η εφαρμογή σας δεν θα λειτουργήσει για χρήστες που δεν έχουν αυτή την " +"έκδοση. (Αυτό μπορεί να είναι αυτό που θέλετε αν δεν έχετε κάνει τον κώδικά " +"σας συμβατό με την Python 2)." #: library/zipapp.rst:250 msgid "" @@ -310,16 +501,23 @@ msgid "" "exact version like \"/usr/bin/env python3.4\" as you will need to change " "your shebang line for users of Python 3.5, for example." msgstr "" +"Δεν υπάρχει τρόπος να πείτε \"python X.Y ή νεότερη\", οπότε να είστε " +"προσεκτικοί όταν χρησιμοποιείτε μια ακριβή έκδοση όπως \"/usr/bin/env " +"python3.4\", καθώς θα χρειαστεί να αλλάξετε τη γραμμή shebang για χρήστες " +"της Python 3.5, για παράδειγμα." #: library/zipapp.rst:254 msgid "" "Typically, you should use an \"/usr/bin/env python2\" or \"/usr/bin/env " "python3\", depending on whether your code is written for Python 2 or 3." msgstr "" +"Συνήθως, θα πρέπει να χρησιμοποιήσετε ένα \"/usr/bin/env python2\" ή \"/usr/" +"bin/env python3\", ανάλογα με το αν ο κώδικάς σας είναι γραμμένος για την " +"Python 2 ή 3." #: library/zipapp.rst:259 msgid "Creating Standalone Applications with zipapp" -msgstr "" +msgstr "Δημιουργία Αυτόνομων Εφαρμογών με το zipapp" #: library/zipapp.rst:261 msgid "" @@ -329,10 +527,16 @@ msgid "" "this is to bundle all of the application's dependencies into the archive, " "along with the application code." msgstr "" +"Χρησιμοποιώντας το module :mod:`zipapp`, είναι δυνατό να δημιουργηθούν " +"αυτόνομες εφαρμογές Python, οι οποίες μπορούν να διανεμηθούν σε τελικούς " +"χρήστες που χρειάζονται μόνο να έχουν εγκατεστημένη μια κατάλληλη έκδοση της " +"Python στο σύστημά τους. Το κλειδί για να γίνει αυτό είναι να συμπεριληφθούν " +"όλες οι εξαρτήσεις της εφαρμογής στο αρχείο, μαζί με τον κώδικα της " +"εφαρμογής." #: library/zipapp.rst:267 msgid "The steps to create a standalone archive are as follows:" -msgstr "" +msgstr "Τα βήματα για τη δημιουργία ενός αυτόνομου αρχείου είναι τα εξής:" #: library/zipapp.rst:269 msgid "" @@ -340,12 +544,21 @@ msgid "" "directory containing a ``__main__.py`` file, and any supporting application " "code." msgstr "" +"Δημιουργήστε την εφαρμογή σας σε έναν φάκελο όπως συνήθως, έτσι ώστε να " +"έχετε έναν φάκελο ``myapp`` που περιέχει ένα αρχείο ``__main__.py`` και " +"οποιονδήποτε υποστηρικτικό κώδικα εφαρμογής." #: library/zipapp.rst:273 msgid "" "Install all of your application's dependencies into the ``myapp`` directory, " "using pip:" msgstr "" +"Εγκαταστήστε όλες τις εξαρτήσεις της εφαρμογής σας στον φάκελο ``myapp``, " +"χρησιμοποιώντας το pip:" + +#: library/zipapp.rst:276 +msgid "$ python -m pip install -r requirements.txt --target myapp" +msgstr "$ python -m pip install -r requirements.txt --target myapp" #: library/zipapp.rst:280 msgid "" @@ -353,10 +566,17 @@ msgid "" "file - if not, you can just list the dependencies manually on the pip " "command line)." msgstr "" +"(αυτό υποθέτει ότι έχετε τις απαιτήσεις του έργου σας σε ένα αρχείο " +"``requirements.txt`` - αν όχι, μπορείτε απλώς να καταγράψετε τις εξαρτήσεις " +"χειροκίνητα στη γραμμή εντολών του pip)." #: library/zipapp.rst:284 msgid "Package the application using:" -msgstr "" +msgstr "Συσκευάστε την εφαρμογή χρησιμοποιώντας:" + +#: library/zipapp.rst:286 +msgid "$ python -m zipapp -p \"interpreter\" myapp" +msgstr "$ python -m zipapp -p \"interpreter\" myapp" #: library/zipapp.rst:290 msgid "" @@ -364,6 +584,10 @@ msgid "" "with the appropriate interpreter available. See :ref:`zipapp-specifying-the-" "interpreter` for details. It can be shipped to users as a single file." msgstr "" +"Αυτό θα παράγει ένα αυτόνομο εκτελέσιμο, το οποίο μπορεί να εκτελεστεί σε " +"οποιαδήποτε μηχανή με τον κατάλληλο διερμηνέα διαθέσιμο. Δείτε :ref:`zipapp-" +"specifying-the-interpreter` για λεπτομέρειες. Μπορεί να αποσταλεί στους " +"χρήστες ως ένα μόνο αρχείο." #: library/zipapp.rst:294 msgid "" @@ -373,10 +597,15 @@ msgid "" "fact that the Python interpreter registers the ``.pyz`` and ``.pyzw`` file " "extensions when installed." msgstr "" +"Σε Unix, το αρχείο ``myapp.pyz`` είναι εκτελέσιμο όπως είναι. Μπορείτε να " +"μετονομάσετε το αρχείο για να αφαιρέσετε την επέκταση ``.pyz`` αν προτιμάτε " +"ένα \"καθαρό\" όνομα εντολής. Σε Windows, το αρχείο ``myapp.pyz[w]`` είναι " +"εκτελέσιμο λόγω του γεγονότος ότι ο διερμηνέας Python καταχωρεί τις " +"επεκτάσεις αρχείων ``.pyz`` και ``.pyzw`` κατά την εγκατάσταση." #: library/zipapp.rst:302 msgid "Caveats" -msgstr "" +msgstr "Προειδοποιήσεις" #: library/zipapp.rst:304 msgid "" @@ -391,10 +620,23 @@ msgid "" "(and potentially pick the correct version to add to ``sys.path`` at runtime, " "based on the user's machine)." msgstr "" +"Αν η εφαρμογή σας εξαρτάται από ένα πακέτο που περιλαμβάνει μια επέκταση C, " +"αυτό το πακέτο δεν μπορεί να εκτελεστεί από ένα αρχείο zip (αυτό είναι " +"περιορισμός του λειτουργικού συστήματος, καθώς ο εκτελέσιμος κώδικας πρέπει " +"να είναι παρών στο σύστημα αρχείων για να τον φορτώσει ο φορτωτής του " +"λειτουργικού συστήματος). Σε αυτή την περίπτωση, μπορείτε να εξαιρέσετε αυτή " +"την εξάρτηση από το αρχείο zip, και είτε να απαιτήσετε από τους χρήστες σας " +"να το έχουν εγκατεστημένο, είτε να το αποστείλετε μαζί με το αρχείο zip και " +"να προσθέσετε κώδικα στο ``__main__.py`` για να συμπεριλάβετε τον φάκελο που " +"περιέχει το αποσυμπιεσμένο module στο ``sys.path``. Σε αυτή την περίπτωση, " +"θα πρέπει να διασφαλίσετε ότι θα αποστείλετε κατάλληλα δυαδικά αρχεία για " +"την αρχιτεκτονική/αρχιτεκτονικές (και ενδεχομένως να επιλέξετε την κατάλληλη " +"έκδοση για να προσθέσετε στο ``sys.path`` κατά τη διάρκεια εκτέλεσης, με " +"βάση τη μηχανή του χρήστη)." #: library/zipapp.rst:316 msgid "The Python Zip Application Archive Format" -msgstr "" +msgstr "Η Μορφή Αρχείου Εφαρμογής Zip της Python" #: library/zipapp.rst:318 msgid "" @@ -406,6 +648,13 @@ msgid "" "be placed on :data:`sys.path` and thus further modules can be imported from " "the zip file." msgstr "" +"Η Python μπορεί να εκτελεί αρχεία zip που περιέχουν ένα αρχείο ``__main__." +"py`` από την έκδοση 2.6. Για να εκτελεστεί από την Python, ένα αρχείο " +"εφαρμογής απλά πρέπει να είναι ένα τυπικό αρχείο zip που περιέχει ένα αρχείο " +"``__main__.py`` το οποίο θα εκτελείται ως το σημείο εισόδου για την " +"εφαρμογή. Όπως συνήθως για οποιοδήποτε Python script, ο γονέας του script " +"(σε αυτή την περίπτωση το αρχείο zip) θα τοποθετηθεί στο :data:`sys.path` " +"και έτσι περαιτέρω modules μπορούν να εισαχθούν από το αρχείο zip." #: library/zipapp.rst:325 msgid "" @@ -413,10 +662,14 @@ msgid "" "The zip application format uses this ability to prepend a standard POSIX " "\"shebang\" line to the file (``#!/path/to/interpreter``)." msgstr "" +"Η μορφή αρχείου zip επιτρέπει την προσθήκη αυθαίρετων δεδομένων στην αρχή " +"ενός αρχείου zip. Η μορφή αρχείου εφαρμογής zip χρησιμοποιεί αυτή την " +"ικανότητα για να προσθέσει μια τυπική γραμμή \"shebang\" POSIX στην αρχή του " +"αρχείου (``#!/path/to/interpreter``)." #: library/zipapp.rst:329 msgid "Formally, the Python zip application format is therefore:" -msgstr "" +msgstr "Επίσημα, η μορφή αρχείου εφαρμογής zip της Python είναι επομένως:" #: library/zipapp.rst:331 msgid "" @@ -424,9 +677,15 @@ msgid "" "interpreter name, and then a newline (``b'\\n'``) character. The " "interpreter name can be anything acceptable to the OS \"shebang\" " "processing, or the Python launcher on Windows. The interpreter should be " -"encoded in UTF-8 on Windows, and in :func:`sys.getfilesystemencoding()` on " +"encoded in UTF-8 on Windows, and in :func:`sys.getfilesystemencoding` on " "POSIX." msgstr "" +"Μια προαιρετική γραμμή shebang, που περιέχει τους χαρακτήρες ``b'#!'`` " +"ακολουθούμενους από ένα όνομα διερμηνέα, και στη συνέχεια έναν χαρακτήρα " +"newline (``b'\\n'``). Το όνομα του διερμηνέα μπορεί να είναι οτιδήποτε " +"αποδεκτό από την επεξεργασία \"shebang\" του λειτουργικού συστήματος, ή τον " +"διερμηνέα Python σε Windows. Ο διερμηνέας θα πρέπει να κωδικοποιείται σε " +"UTF-8 σε Windows, και σε :func:`sys.getfilesystemencoding` σε POSIX." #: library/zipapp.rst:336 msgid "" @@ -435,12 +694,19 @@ msgid "" "in the \"root\" of the zipfile - i.e., it cannot be in a subdirectory). The " "zipfile data can be compressed or uncompressed." msgstr "" +"Τυπικά δεδομένα αρχείου zip, όπως παράγονται από το module :mod:`zipfile`. " +"Το περιεχόμενο του αρχείου zip *πρέπει* να περιλαμβάνει ένα αρχείο " +"``__main__.py`` (το οποίο πρέπει να βρίσκεται στο \"root\" του αρχείου zip - " +"δηλαδή, δεν μπορεί να βρίσκεται σε υποφάκελο). Τα δεδομένα του αρχείου zip " +"μπορεί να είναι συμπιεσμένα ή μη συμπιεσμένα." #: library/zipapp.rst:341 msgid "" "If an application archive has a shebang line, it may have the executable bit " "set on POSIX systems, to allow it to be executed directly." msgstr "" +"Αν ένα αρχείο εφαρμογής έχει μια γραμμή shebang, μπορεί να έχει ρυθμιστεί το " +"εκτελέσιμο bit σε συστήματα POSIX, για να επιτρέπεται η άμεση εκτέλεσή του." #: library/zipapp.rst:344 msgid "" @@ -448,7 +714,11 @@ msgid "" "application archives - the module is a convenience, but archives in the " "above format created by any means are acceptable to Python." msgstr "" +"Δεν υπάρχει απαίτηση να χρησιμοποιούνται τα εργαλεία σε αυτό το module για " +"τη δημιουργία αρχείων εφαρμογής - το module είναι μια ευκολία, αλλά τα " +"αρχεία σε παραπάνω μορφή που δημιουργούνται με οποιονδήποτε τρόπο είναι " +"αποδεκτά από την Python." #: library/zipapp.rst:11 msgid "Executable Zip Files" -msgstr "" +msgstr "Εκτελέσιμα Αρχεία Zip" diff --git a/library/zipfile.po b/library/zipfile.po index 1f475873..63384ba3 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/zipfile.rst:2 -msgid ":mod:`zipfile` --- Work with ZIP archives" +msgid ":mod:`!zipfile` --- Work with ZIP archives" msgstr "" #: library/zipfile.rst:10 @@ -34,50 +35,59 @@ msgstr "" #: library/zipfile.rst:19 msgid "" -"This module does not currently handle multi-disk ZIP files. It can handle " -"ZIP files that use the ZIP64 extensions (that is ZIP files that are more " -"than 4 GiB in size). It supports decryption of encrypted files in ZIP " -"archives, but it currently cannot create an encrypted file. Decryption is " -"extremely slow as it is implemented in native Python rather than C." +"This module does not handle multipart ZIP files. It can handle ZIP files " +"that use the ZIP64 extensions (that is ZIP files that are more than 4 GiB in " +"size). It supports decryption of encrypted files in ZIP archives, but it " +"cannot create an encrypted file. Decryption is extremely slow as it is " +"implemented in native Python rather than C." msgstr "" -#: library/zipfile.rst:26 +#: library/zipfile.rst:29 +msgid "" +"Handling compressed archives requires :term:`optional modules ` such as :mod:`zlib`, :mod:`bz2`, :mod:`lzma`, and :mod:`compression." +"zstd`. If any of them are missing from your copy of CPython, look for " +"documentation from your distributor (that is, whoever provided Python to " +"you). If you are the distributor, see :ref:`optional-module-requirements`." +msgstr "" + +#: library/zipfile.rst:36 msgid "The module defines the following items:" msgstr "" -#: library/zipfile.rst:30 +#: library/zipfile.rst:40 msgid "The error raised for bad ZIP files." msgstr "" -#: library/zipfile.rst:37 +#: library/zipfile.rst:47 msgid "" "Alias of :exc:`BadZipFile`, for compatibility with older Python versions." msgstr "" -#: library/zipfile.rst:44 +#: library/zipfile.rst:54 msgid "" "The error raised when a ZIP file would require ZIP64 functionality but that " "has not been enabled." msgstr "" -#: library/zipfile.rst:51 +#: library/zipfile.rst:61 msgid "" "The class for reading and writing ZIP files. See section :ref:`zipfile-" "objects` for constructor details." msgstr "" -#: library/zipfile.rst:58 +#: library/zipfile.rst:68 msgid "" "Class that implements a subset of the interface provided by :class:`pathlib." "Path`, including the full :class:`importlib.resources.abc.Traversable` " "interface." msgstr "" -#: library/zipfile.rst:68 +#: library/zipfile.rst:78 msgid "Class for creating ZIP archives containing Python libraries." msgstr "" -#: library/zipfile.rst:73 +#: library/zipfile.rst:83 msgid "" "Class used to represent information about a member of an archive. Instances " "of this class are returned by the :meth:`.getinfo` and :meth:`.infolist` " @@ -89,79 +99,111 @@ msgid "" "ref:`zipinfo-objects`." msgstr "" -#: library/zipfile.rst:84 +#: library/zipfile.rst:92 +msgid "" +"A public :attr:`!compress_level` attribute has been added to expose the " +"formerly protected :attr:`!_compresslevel`. The older protected name " +"continues to work as a property for backwards compatibility." +msgstr "" + +#: library/zipfile.rst:100 +msgid "" +"Resolve the date_time, compression attributes, and external attributes to " +"suitable defaults as used by :meth:`ZipFile.writestr`." +msgstr "" + +#: library/zipfile.rst:103 +msgid "Returns self for chaining." +msgstr "" + +#: library/zipfile.rst:110 msgid "" "Returns ``True`` if *filename* is a valid ZIP file based on its magic " "number, otherwise returns ``False``. *filename* may be a file or file-like " "object too." msgstr "" -#: library/zipfile.rst:87 +#: library/zipfile.rst:113 msgid "Support for file and file-like objects." msgstr "" -#: library/zipfile.rst:93 +#: library/zipfile.rst:119 msgid "The numeric constant for an uncompressed archive member." msgstr "" -#: library/zipfile.rst:98 +#: library/zipfile.rst:124 msgid "" "The numeric constant for the usual ZIP compression method. This requires " "the :mod:`zlib` module." msgstr "" -#: library/zipfile.rst:104 +#: library/zipfile.rst:130 msgid "" "The numeric constant for the BZIP2 compression method. This requires the :" "mod:`bz2` module." msgstr "" -#: library/zipfile.rst:111 +#: library/zipfile.rst:137 msgid "" "The numeric constant for the LZMA compression method. This requires the :" "mod:`lzma` module." msgstr "" -#: library/zipfile.rst:118 +#: library/zipfile.rst:144 +msgid "" +"The numeric constant for Zstandard compression. This requires the :mod:" +"`compression.zstd` module." +msgstr "" + +#: library/zipfile.rst:149 +msgid "" +"In APPNOTE 6.3.7, the method ID ``20`` was assigned to Zstandard " +"compression. This was changed in APPNOTE 6.3.8 to method ID ``93`` to avoid " +"conflicts, with method ID ``20`` being deprecated. For compatibility, the :" +"mod:`!zipfile` module reads both method IDs but will only write data with " +"method ID ``93``." +msgstr "" + +#: library/zipfile.rst:159 msgid "" "The ZIP file format specification has included support for bzip2 compression " -"since 2001, and for LZMA compression since 2006. However, some tools " -"(including older Python releases) do not support these compression methods, " -"and may either refuse to process the ZIP file altogether, or fail to extract " -"individual files." +"since 2001, for LZMA compression since 2006, and Zstandard compression since " +"2020. However, some tools (including older Python releases) do not support " +"these compression methods, and may either refuse to process the ZIP file " +"altogether, or fail to extract individual files." msgstr "" -#: library/zipfile.rst:129 +#: library/zipfile.rst:167 msgid "`PKZIP Application Note`_" msgstr "" -#: library/zipfile.rst:128 +#: library/zipfile.rst:168 msgid "" "Documentation on the ZIP file format by Phil Katz, the creator of the format " "and algorithms used." msgstr "" -#: library/zipfile.rst:132 +#: library/zipfile.rst:171 msgid "`Info-ZIP Home Page `_" msgstr "" -#: library/zipfile.rst:132 +#: library/zipfile.rst:172 msgid "" "Information about the Info-ZIP project's ZIP archive programs and " "development libraries." msgstr "" -#: library/zipfile.rst:139 -msgid "ZipFile Objects" +#: library/zipfile.rst:179 +msgid "ZipFile objects" msgstr "" -#: library/zipfile.rst:146 +#: library/zipfile.rst:186 msgid "" "Open a ZIP file, where *file* can be a path to a file (a string), a file-" "like object or a :term:`path-like object`." msgstr "" -#: library/zipfile.rst:149 +#: library/zipfile.rst:189 msgid "" "The *mode* parameter should be ``'r'`` to read an existing file, ``'w'`` to " "truncate and write a new file, ``'a'`` to append to an existing file, or " @@ -175,18 +217,19 @@ msgid "" "``'r'`` or ``'a'``, the file should be seekable." msgstr "" -#: library/zipfile.rst:161 +#: library/zipfile.rst:201 msgid "" "*compression* is the ZIP compression method to use when writing the archive, " -"and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2` " -"or :const:`ZIP_LZMA`; unrecognized values will cause :exc:" -"`NotImplementedError` to be raised. If :const:`ZIP_DEFLATED`, :const:" -"`ZIP_BZIP2` or :const:`ZIP_LZMA` is specified but the corresponding module (:" -"mod:`zlib`, :mod:`bz2` or :mod:`lzma`) is not available, :exc:`RuntimeError` " -"is raised. The default is :const:`ZIP_STORED`." +"and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:" +"`ZIP_BZIP2`, :const:`ZIP_LZMA`, or :const:`ZIP_ZSTANDARD`; unrecognized " +"values will cause :exc:`NotImplementedError` to be raised. If :const:" +"`ZIP_DEFLATED`, :const:`ZIP_BZIP2`, :const:`ZIP_LZMA`, or :const:" +"`ZIP_ZSTANDARD` is specified but the corresponding module (:mod:`zlib`, :mod:" +"`bz2`, :mod:`lzma`, or :mod:`compression.zstd`) is not available, :exc:" +"`RuntimeError` is raised. The default is :const:`ZIP_STORED`." msgstr "" -#: library/zipfile.rst:169 +#: library/zipfile.rst:210 msgid "" "If *allowZip64* is ``True`` (the default) zipfile will create ZIP files that " "use the ZIP64 extensions when the zipfile is larger than 4 GiB. If it is " @@ -194,17 +237,21 @@ msgid "" "require ZIP64 extensions." msgstr "" -#: library/zipfile.rst:174 +#: library/zipfile.rst:215 msgid "" "The *compresslevel* parameter controls the compression level to use when " "writing files to the archive. When using :const:`ZIP_STORED` or :const:" "`ZIP_LZMA` it has no effect. When using :const:`ZIP_DEFLATED` integers ``0`` " "through ``9`` are accepted (see :class:`zlib ` for more " "information). When using :const:`ZIP_BZIP2` integers ``1`` through ``9`` are " -"accepted (see :class:`bz2 ` for more information)." +"accepted (see :class:`bz2 ` for more information). When using :" +"const:`ZIP_ZSTANDARD` integers ``-131072`` through ``22`` are commonly " +"accepted (see :attr:`CompressionParameter.compression_level ` for more on retrieving valid " +"values and their meaning)." msgstr "" -#: library/zipfile.rst:735 +#: library/zipfile.rst:809 msgid "" "The *strict_timestamps* argument, when set to ``False``, allows to zip files " "older than 1980-01-01 at the cost of setting the timestamp to 1980-01-01. " @@ -212,34 +259,40 @@ msgid "" "also set to the limit." msgstr "" -#: library/zipfile.rst:188 +#: library/zipfile.rst:233 msgid "" "When mode is ``'r'``, *metadata_encoding* may be set to the name of a codec, " "which will be used to decode metadata such as the names of members and ZIP " "comments." msgstr "" -#: library/zipfile.rst:192 +#: library/zipfile.rst:237 msgid "" "If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and then :meth:" "`closed ` without adding any files to the archive, the appropriate " "ZIP structures for an empty archive will be written to the file." msgstr "" -#: library/zipfile.rst:196 +#: library/zipfile.rst:241 msgid "" "ZipFile is also a context manager and therefore supports the :keyword:`with` " "statement. In the example, *myzip* is closed after the :keyword:`!with` " "statement's suite is finished---even if an exception occurs::" msgstr "" -#: library/zipfile.rst:205 +#: library/zipfile.rst:245 +msgid "" +"with ZipFile('spam.zip', 'w') as myzip:\n" +" myzip.write('eggs.txt')" +msgstr "" + +#: library/zipfile.rst:250 msgid "" "*metadata_encoding* is an instance-wide setting for the ZipFile. It is not " -"currently possible to set this on a per-member basis." +"possible to set this on a per-member basis." msgstr "" -#: library/zipfile.rst:208 +#: library/zipfile.rst:253 msgid "" "This attribute is a workaround for legacy implementations which produce " "archives with names in the current locale encoding or code page (mostly on " @@ -249,73 +302,73 @@ msgid "" "is a Python-specific extension." msgstr "" -#: library/zipfile.rst:216 +#: library/zipfile.rst:261 msgid "Added the ability to use :class:`ZipFile` as a context manager." msgstr "" -#: library/zipfile.rst:219 +#: library/zipfile.rst:264 msgid "Added support for :mod:`bzip2 ` and :mod:`lzma` compression." msgstr "" -#: library/zipfile.rst:648 +#: library/zipfile.rst:722 msgid "ZIP64 extensions are enabled by default." msgstr "" -#: library/zipfile.rst:225 +#: library/zipfile.rst:270 msgid "" "Added support for writing to unseekable streams. Added support for the " "``'x'`` mode." msgstr "" -#: library/zipfile.rst:229 +#: library/zipfile.rst:274 msgid "" "Previously, a plain :exc:`RuntimeError` was raised for unrecognized " "compression values." msgstr "" -#: library/zipfile.rst:233 +#: library/zipfile.rst:278 msgid "The *file* parameter accepts a :term:`path-like object`." msgstr "" -#: library/zipfile.rst:236 +#: library/zipfile.rst:281 msgid "Add the *compresslevel* parameter." msgstr "" -#: library/zipfile.rst:239 +#: library/zipfile.rst:284 msgid "The *strict_timestamps* keyword-only parameter." msgstr "" -#: library/zipfile.rst:242 +#: library/zipfile.rst:287 msgid "" "Added support for specifying member name encoding for reading metadata in " "the zipfile's directory and file headers." msgstr "" -#: library/zipfile.rst:249 +#: library/zipfile.rst:294 msgid "" "Close the archive file. You must call :meth:`close` before exiting your " "program or essential records will not be written." msgstr "" -#: library/zipfile.rst:255 +#: library/zipfile.rst:300 msgid "" "Return a :class:`ZipInfo` object with information about the archive member " "*name*. Calling :meth:`getinfo` for a name not currently contained in the " "archive will raise a :exc:`KeyError`." msgstr "" -#: library/zipfile.rst:262 +#: library/zipfile.rst:307 msgid "" "Return a list containing a :class:`ZipInfo` object for each member of the " "archive. The objects are in the same order as their entries in the actual " "ZIP file on disk if an existing archive was opened." msgstr "" -#: library/zipfile.rst:269 +#: library/zipfile.rst:314 msgid "Return a list of archive members by name." msgstr "" -#: library/zipfile.rst:274 +#: library/zipfile.rst:319 msgid "" "Access a member of the archive as a binary file-like object. *name* can be " "either the name of a file within the archive or a :class:`ZipInfo` object. " @@ -324,13 +377,20 @@ msgid "" "class:`bytes` object." msgstr "" -#: library/zipfile.rst:280 +#: library/zipfile.rst:325 msgid "" ":meth:`~ZipFile.open` is also a context manager and therefore supports the :" "keyword:`with` statement::" msgstr "" -#: library/zipfile.rst:287 +#: library/zipfile.rst:328 +msgid "" +"with ZipFile('spam.zip') as myzip:\n" +" with myzip.open('eggs.txt') as myfile:\n" +" print(myfile.read())" +msgstr "" + +#: library/zipfile.rst:332 msgid "" "With *mode* ``'r'`` the file-like object (``ZipExtFile``) is read-only and " "provides the following methods: :meth:`~io.BufferedIOBase.read`, :meth:`~io." @@ -339,7 +399,7 @@ msgid "" "__next__`. These objects can operate independently of the ZipFile." msgstr "" -#: library/zipfile.rst:294 +#: library/zipfile.rst:339 msgid "" "With ``mode='w'``, a writable file handle is returned, which supports the :" "meth:`~io.BufferedIOBase.write` method. While a writable file handle is " @@ -347,7 +407,14 @@ msgid "" "exc:`ValueError`." msgstr "" -#: library/zipfile.rst:299 +#: library/zipfile.rst:344 +msgid "" +"In both cases the file-like object has also attributes :attr:`!name`, which " +"is equivalent to the name of a file within the archive, and :attr:`!mode`, " +"which is ``'rb'`` or ``'wb'`` depending on the input mode." +msgstr "" + +#: library/zipfile.rst:348 msgid "" "When writing a file, if the file size is not known in advance but may exceed " "2 GiB, pass ``force_zip64=True`` to ensure that the header format is capable " @@ -356,32 +423,39 @@ msgid "" "as the *name* parameter." msgstr "" -#: library/zipfile.rst:307 +#: library/zipfile.rst:356 msgid "" "The :meth:`.open`, :meth:`read` and :meth:`extract` methods can take a " "filename or a :class:`ZipInfo` object. You will appreciate this when trying " "to read a ZIP file that contains members with duplicate names." msgstr "" -#: library/zipfile.rst:311 +#: library/zipfile.rst:360 msgid "" "Removed support of ``mode='U'``. Use :class:`io.TextIOWrapper` for reading " "compressed text files in :term:`universal newlines` mode." msgstr "" -#: library/zipfile.rst:315 +#: library/zipfile.rst:364 msgid "" ":meth:`ZipFile.open` can now be used to write files into the archive with " "the ``mode='w'`` option." msgstr "" -#: library/zipfile.rst:319 +#: library/zipfile.rst:368 msgid "" "Calling :meth:`.open` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: library/zipfile.rst:326 +#: library/zipfile.rst:372 +msgid "" +"Added attributes :attr:`!name` and :attr:`!mode` for the writeable file-like " +"object. The value of the :attr:`!mode` attribute for the readable file-like " +"object was changed from ``'r'`` to ``'rb'``." +msgstr "" + +#: library/zipfile.rst:381 msgid "" "Extract a member from the archive to the current working directory; *member* " "must be its full name or a :class:`ZipInfo` object. Its file information is " @@ -390,11 +464,11 @@ msgid "" "*pwd* is the password used for encrypted files as a :class:`bytes` object." msgstr "" -#: library/zipfile.rst:332 +#: library/zipfile.rst:387 msgid "Returns the normalized path created (a directory or new file)." msgstr "" -#: library/zipfile.rst:336 +#: library/zipfile.rst:391 msgid "" "If a member filename is an absolute path, a drive/UNC sharepoint and leading " "(back)slashes will be stripped, e.g.: ``///foo/bar`` becomes ``foo/bar`` on " @@ -405,17 +479,17 @@ msgid "" "(``_``)." msgstr "" -#: library/zipfile.rst:344 +#: library/zipfile.rst:399 msgid "" "Calling :meth:`extract` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: library/zipfile.rst:371 +#: library/zipfile.rst:426 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: library/zipfile.rst:354 +#: library/zipfile.rst:409 msgid "" "Extract all members from the archive to the current working directory. " "*path* specifies a different directory to extract to. *members* is optional " @@ -423,7 +497,7 @@ msgid "" "password used for encrypted files as a :class:`bytes` object." msgstr "" -#: library/zipfile.rst:361 +#: library/zipfile.rst:416 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of *path*, e.g. members that have " @@ -431,23 +505,23 @@ msgid "" "\"``. This module attempts to prevent that. See :meth:`extract` note." msgstr "" -#: library/zipfile.rst:367 +#: library/zipfile.rst:422 msgid "" "Calling :meth:`extractall` on a closed ZipFile will raise a :exc:" "`ValueError`. Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: library/zipfile.rst:377 +#: library/zipfile.rst:432 msgid "Print a table of contents for the archive to ``sys.stdout``." msgstr "" -#: library/zipfile.rst:382 +#: library/zipfile.rst:437 msgid "" "Set *pwd* (a :class:`bytes` object) as default password to extract encrypted " "files." msgstr "" -#: library/zipfile.rst:387 +#: library/zipfile.rst:442 msgid "" "Return the bytes of the file *name* in the archive. *name* is the name of " "the file in the archive, or a :class:`ZipInfo` object. The archive must be " @@ -455,30 +529,30 @@ msgid "" "a :class:`bytes` object and, if specified, overrides the default password " "set with :meth:`setpassword`. Calling :meth:`read` on a ZipFile that uses a " "compression method other than :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :" -"const:`ZIP_BZIP2` or :const:`ZIP_LZMA` will raise a :exc:" -"`NotImplementedError`. An error will also be raised if the corresponding " -"compression module is not available." +"const:`ZIP_BZIP2`, :const:`ZIP_LZMA`, or :const:`ZIP_ZSTANDARD` will raise " +"a :exc:`NotImplementedError`. An error will also be raised if the " +"corresponding compression module is not available." msgstr "" -#: library/zipfile.rst:396 +#: library/zipfile.rst:452 msgid "" "Calling :meth:`read` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: library/zipfile.rst:403 +#: library/zipfile.rst:459 msgid "" "Read all the files in the archive and check their CRC's and file headers. " "Return the name of the first bad file, or else return ``None``." msgstr "" -#: library/zipfile.rst:406 +#: library/zipfile.rst:462 msgid "" "Calling :meth:`testzip` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: library/zipfile.rst:414 +#: library/zipfile.rst:470 msgid "" "Write the file named *filename* to the archive, giving it the archive name " "*arcname* (by default, this will be the same as *filename*, but without a " @@ -489,7 +563,7 @@ msgid "" "``'x'`` or ``'a'``." msgstr "" -#: library/zipfile.rst:424 +#: library/zipfile.rst:480 msgid "" "The ZIP file standard historically did not specify a metadata encoding, but " "strongly recommended CP437 (the original IBM PC encoding) for " @@ -499,33 +573,33 @@ msgid "" "in any encoding other than ASCII or UTF-8." msgstr "" -#: library/zipfile.rst:433 +#: library/zipfile.rst:489 msgid "" "Archive names should be relative to the archive root, that is, they should " "not start with a path separator." msgstr "" -#: library/zipfile.rst:438 +#: library/zipfile.rst:494 msgid "" "If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a " "null byte, the name of the file in the archive will be truncated at the null " "byte." msgstr "" -#: library/zipfile.rst:443 +#: library/zipfile.rst:499 msgid "" "A leading slash in the filename may lead to the archive being impossible to " "open in some zip programs on Windows systems." msgstr "" -#: library/zipfile.rst:446 +#: library/zipfile.rst:502 msgid "" "Calling :meth:`write` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -#: library/zipfile.rst:455 +#: library/zipfile.rst:511 msgid "" "Write a file into the archive. The contents is *data*, which may be either " "a :class:`str` or a :class:`bytes` instance; if it is a :class:`str`, it is " @@ -536,7 +610,7 @@ msgid "" "must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -#: library/zipfile.rst:463 +#: library/zipfile.rst:519 msgid "" "If given, *compress_type* overrides the value given for the *compression* " "parameter to the constructor for the new entry, or in the *zinfo_or_arcname* " @@ -544,7 +618,7 @@ msgid "" "override the constructor if given." msgstr "" -#: library/zipfile.rst:470 +#: library/zipfile.rst:526 msgid "" "When passing a :class:`ZipInfo` instance as the *zinfo_or_arcname* " "parameter, the compression method used will be that specified in the " @@ -552,18 +626,18 @@ msgid "" "the :class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`." msgstr "" -#: library/zipfile.rst:475 +#: library/zipfile.rst:531 msgid "The *compress_type* argument." msgstr "" -#: library/zipfile.rst:478 +#: library/zipfile.rst:534 msgid "" "Calling :meth:`writestr` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -#: library/zipfile.rst:485 +#: library/zipfile.rst:541 msgid "" "Create a directory inside the archive. If *zinfo_or_directory* is a string, " "a directory is created inside the archive with the mode that is specified in " @@ -571,26 +645,26 @@ msgid "" "instance then the *mode* argument is ignored." msgstr "" -#: library/zipfile.rst:490 +#: library/zipfile.rst:546 msgid "The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -#: library/zipfile.rst:495 +#: library/zipfile.rst:551 msgid "The following data attributes are also available:" msgstr "" -#: library/zipfile.rst:499 +#: library/zipfile.rst:555 msgid "Name of the ZIP file." msgstr "" -#: library/zipfile.rst:503 +#: library/zipfile.rst:559 msgid "" "The level of debug output to use. This may be set from ``0`` (the default, " "no output) to ``3`` (the most output). Debugging information is written to " "``sys.stdout``." msgstr "" -#: library/zipfile.rst:509 +#: library/zipfile.rst:565 msgid "" "The comment associated with the ZIP file as a :class:`bytes` object. If " "assigning a comment to a :class:`ZipFile` instance created with mode " @@ -598,37 +672,48 @@ msgid "" "Comments longer than this will be truncated." msgstr "" -#: library/zipfile.rst:519 -msgid "Path Objects" +#: library/zipfile.rst:575 +msgid "Path objects" msgstr "" -#: library/zipfile.rst:523 +#: library/zipfile.rst:579 msgid "" "Construct a Path object from a ``root`` zipfile (which may be a :class:" "`ZipFile` instance or ``file`` suitable for passing to the :class:`ZipFile` " "constructor)." msgstr "" -#: library/zipfile.rst:527 +#: library/zipfile.rst:583 msgid "" "``at`` specifies the location of this Path within the zipfile, e.g. 'dir/" "file.txt', 'dir/', or ''. Defaults to the empty string, indicating the root." msgstr "" -#: library/zipfile.rst:531 +#: library/zipfile.rst:588 +msgid "" +"The :class:`Path` class does not sanitize filenames within the ZIP archive. " +"Unlike the :meth:`ZipFile.extract` and :meth:`ZipFile.extractall` methods, " +"it is the caller's responsibility to validate or sanitize filenames to " +"prevent path traversal vulnerabilities (e.g., filenames containing \"..\" or " +"absolute paths). When handling untrusted archives, consider resolving " +"filenames using :func:`os.path.abspath` and checking against the target " +"directory with :func:`os.path.commonpath`." +msgstr "" + +#: library/zipfile.rst:595 msgid "" "Path objects expose the following features of :mod:`pathlib.Path` objects:" msgstr "" -#: library/zipfile.rst:534 +#: library/zipfile.rst:598 msgid "Path objects are traversable using the ``/`` operator or ``joinpath``." msgstr "" -#: library/zipfile.rst:538 +#: library/zipfile.rst:602 msgid "The final path component." msgstr "" -#: library/zipfile.rst:542 +#: library/zipfile.rst:606 msgid "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " @@ -637,12 +722,12 @@ msgid "" "``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" -#: library/zipfile.rst:551 +#: library/zipfile.rst:615 msgid "" "Added support for text and binary modes for open. Default mode is now text." msgstr "" -#: library/zipfile.rst:606 +#: library/zipfile.rst:680 msgid "" "The ``encoding`` parameter can be supplied as a positional argument without " "causing a :exc:`TypeError`. As it could in 3.9. Code needing to be " @@ -650,117 +735,134 @@ msgid "" "TextIOWrapper` arguments, ``encoding`` included, as keywords." msgstr "" -#: library/zipfile.rst:563 +#: library/zipfile.rst:627 msgid "Enumerate the children of the current directory." msgstr "" -#: library/zipfile.rst:567 +#: library/zipfile.rst:631 msgid "Return ``True`` if the current context references a directory." msgstr "" -#: library/zipfile.rst:571 +#: library/zipfile.rst:635 msgid "Return ``True`` if the current context references a file." msgstr "" -#: library/zipfile.rst:575 +#: library/zipfile.rst:639 +msgid "Return ``True`` if the current context references a symbolic link." +msgstr "" + +#: library/zipfile.rst:643 +msgid "Previously, ``is_symlink`` would unconditionally return ``False``." +msgstr "" + +#: library/zipfile.rst:648 msgid "" "Return ``True`` if the current context references a file or directory in the " "zip file." msgstr "" -#: library/zipfile.rst:580 -msgid "The file extension of the final component." +#: library/zipfile.rst:653 +msgid "" +"The last dot-separated portion of the final component, if any. This is " +"commonly called the file extension." msgstr "" -#: library/zipfile.rst:582 +#: library/zipfile.rst:656 msgid "Added :data:`Path.suffix` property." msgstr "" -#: library/zipfile.rst:587 +#: library/zipfile.rst:661 msgid "The final path component, without its suffix." msgstr "" -#: library/zipfile.rst:589 +#: library/zipfile.rst:663 msgid "Added :data:`Path.stem` property." msgstr "" -#: library/zipfile.rst:594 -msgid "A list of the path’s file extensions." +#: library/zipfile.rst:668 +msgid "A list of the path’s suffixes, commonly called file extensions." msgstr "" -#: library/zipfile.rst:596 +#: library/zipfile.rst:670 msgid "Added :data:`Path.suffixes` property." msgstr "" -#: library/zipfile.rst:601 +#: library/zipfile.rst:675 msgid "" "Read the current file as unicode text. Positional and keyword arguments are " "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" -#: library/zipfile.rst:614 +#: library/zipfile.rst:688 msgid "Read the current file as bytes." msgstr "" -#: library/zipfile.rst:618 +#: library/zipfile.rst:692 msgid "" "Return a new Path object with each of the *other* arguments joined. The " "following are equivalent::" msgstr "" -#: library/zipfile.rst:625 +#: library/zipfile.rst:695 +msgid "" +">>> Path(...).joinpath('child').joinpath('grandchild')\n" +">>> Path(...).joinpath('child', 'grandchild')\n" +">>> Path(...) / 'child' / 'grandchild'" +msgstr "" + +#: library/zipfile.rst:699 msgid "" "Prior to 3.10, ``joinpath`` was undocumented and accepted exactly one " "parameter." msgstr "" -#: library/zipfile.rst:629 +#: library/zipfile.rst:703 msgid "" -"The `zipp `_ project provides backports of " -"the latest path object functionality to older Pythons. Use ``zipp.Path`` in " -"place of ``zipfile.Path`` for early access to changes." +"The :pypi:`zipp` project provides backports of the latest path object " +"functionality to older Pythons. Use ``zipp.Path`` in place of ``zipfile." +"Path`` for early access to changes." msgstr "" -#: library/zipfile.rst:637 -msgid "PyZipFile Objects" +#: library/zipfile.rst:711 +msgid "PyZipFile objects" msgstr "" -#: library/zipfile.rst:639 +#: library/zipfile.rst:713 msgid "" "The :class:`PyZipFile` constructor takes the same parameters as the :class:" "`ZipFile` constructor, and one additional parameter, *optimize*." msgstr "" -#: library/zipfile.rst:645 +#: library/zipfile.rst:719 msgid "Added the *optimize* parameter." msgstr "" -#: library/zipfile.rst:651 +#: library/zipfile.rst:725 msgid "" "Instances have one method in addition to those of :class:`ZipFile` objects:" msgstr "" -#: library/zipfile.rst:655 +#: library/zipfile.rst:729 msgid "" "Search for files :file:`\\*.py` and add the corresponding file to the " "archive." msgstr "" -#: library/zipfile.rst:658 +#: library/zipfile.rst:732 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was not given or ``-1``, " "the corresponding file is a :file:`\\*.pyc` file, compiling if necessary." msgstr "" -#: library/zipfile.rst:661 +#: library/zipfile.rst:735 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was ``0``, ``1`` or ``2``, " "only files with that optimization level (see :func:`compile`) are added to " "the archive, compiling if necessary." msgstr "" -#: library/zipfile.rst:665 +#: library/zipfile.rst:739 msgid "" "If *pathname* is a file, the filename must end with :file:`.py`, and just " "the (corresponding :file:`\\*.pyc`) file is added at the top level (no path " @@ -773,11 +875,11 @@ msgid "" "in sorted order." msgstr "" -#: library/zipfile.rst:675 +#: library/zipfile.rst:749 msgid "*basename* is intended for internal use only." msgstr "" -#: library/zipfile.rst:677 +#: library/zipfile.rst:751 msgid "" "*filterfunc*, if given, must be a function taking a single string argument. " "It will be passed each path (including each individual full file path) " @@ -788,290 +890,343 @@ msgid "" "exclude them::" msgstr "" -#: library/zipfile.rst:692 +#: library/zipfile.rst:759 +msgid "" +">>> zf = PyZipFile('myprog.zip')\n" +">>> def notests(s):\n" +"... fn = os.path.basename(s)\n" +"... return (not (fn == 'test' or fn.startswith('test_')))\n" +"...\n" +">>> zf.writepy('myprog', filterfunc=notests)" +msgstr "" + +#: library/zipfile.rst:766 msgid "The :meth:`writepy` method makes archives with file names like this::" msgstr "" -#: library/zipfile.rst:701 +#: library/zipfile.rst:769 +msgid "" +"string.pyc # Top level name\n" +"test/__init__.pyc # Package directory\n" +"test/testall.pyc # Module test.testall\n" +"test/bogus/__init__.pyc # Subpackage directory\n" +"test/bogus/myfile.pyc # Submodule test.bogus.myfile" +msgstr "" + +#: library/zipfile.rst:775 msgid "Added the *filterfunc* parameter." msgstr "" -#: library/zipfile.rst:704 +#: library/zipfile.rst:778 msgid "The *pathname* parameter accepts a :term:`path-like object`." msgstr "" -#: library/zipfile.rst:707 +#: library/zipfile.rst:781 msgid "Recursion sorts directory entries." msgstr "" -#: library/zipfile.rst:714 -msgid "ZipInfo Objects" +#: library/zipfile.rst:788 +msgid "ZipInfo objects" msgstr "" -#: library/zipfile.rst:716 +#: library/zipfile.rst:790 msgid "" "Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` " "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -#: library/zipfile.rst:720 +#: library/zipfile.rst:794 msgid "" "There is one classmethod to make a :class:`ZipInfo` instance for a " "filesystem file:" msgstr "" -#: library/zipfile.rst:726 +#: library/zipfile.rst:800 msgid "" "Construct a :class:`ZipInfo` instance for a file on the filesystem, in " "preparation for adding it to a zip file." msgstr "" -#: library/zipfile.rst:729 +#: library/zipfile.rst:803 msgid "*filename* should be the path to a file or directory on the filesystem." msgstr "" -#: library/zipfile.rst:731 +#: library/zipfile.rst:805 msgid "" "If *arcname* is specified, it is used as the name within the archive. If " "*arcname* is not specified, the name will be the same as *filename*, but " "with any drive letter and leading path separators removed." msgstr "" -#: library/zipfile.rst:743 +#: library/zipfile.rst:817 msgid "The *filename* parameter accepts a :term:`path-like object`." msgstr "" -#: library/zipfile.rst:746 +#: library/zipfile.rst:820 msgid "Added the *strict_timestamps* keyword-only parameter." msgstr "" -#: library/zipfile.rst:750 +#: library/zipfile.rst:824 msgid "Instances have the following methods and attributes:" msgstr "" -#: library/zipfile.rst:754 +#: library/zipfile.rst:828 msgid "Return ``True`` if this archive member is a directory." msgstr "" -#: library/zipfile.rst:756 +#: library/zipfile.rst:830 msgid "This uses the entry's name: directories should always end with ``/``." msgstr "" -#: library/zipfile.rst:763 +#: library/zipfile.rst:837 msgid "Name of the file in the archive." msgstr "" -#: library/zipfile.rst:768 +#: library/zipfile.rst:842 msgid "" "The time and date of the last modification to the archive member. This is a " -"tuple of six values:" +"tuple of six values representing the \"last [modified] file time\" and " +"\"last [modified] file date\" fields from the ZIP file's central directory." msgstr "" -#: library/zipfile.rst:772 +#: library/zipfile.rst:846 +msgid "The tuple contains:" +msgstr "" + +#: library/zipfile.rst:849 msgid "Index" msgstr "" -#: library/zipfile.rst:772 +#: library/zipfile.rst:849 msgid "Value" msgstr "" -#: library/zipfile.rst:774 +#: library/zipfile.rst:851 msgid "``0``" msgstr "" -#: library/zipfile.rst:774 +#: library/zipfile.rst:851 msgid "Year (>= 1980)" msgstr "" -#: library/zipfile.rst:776 +#: library/zipfile.rst:853 msgid "``1``" msgstr "" -#: library/zipfile.rst:776 +#: library/zipfile.rst:853 msgid "Month (one-based)" msgstr "" -#: library/zipfile.rst:778 +#: library/zipfile.rst:855 msgid "``2``" msgstr "" -#: library/zipfile.rst:778 +#: library/zipfile.rst:855 msgid "Day of month (one-based)" msgstr "" -#: library/zipfile.rst:780 +#: library/zipfile.rst:857 msgid "``3``" msgstr "" -#: library/zipfile.rst:780 +#: library/zipfile.rst:857 msgid "Hours (zero-based)" msgstr "" -#: library/zipfile.rst:782 +#: library/zipfile.rst:859 msgid "``4``" msgstr "" -#: library/zipfile.rst:782 +#: library/zipfile.rst:859 msgid "Minutes (zero-based)" msgstr "" -#: library/zipfile.rst:784 +#: library/zipfile.rst:861 msgid "``5``" msgstr "" -#: library/zipfile.rst:784 +#: library/zipfile.rst:861 msgid "Seconds (zero-based)" msgstr "" -#: library/zipfile.rst:789 -msgid "The ZIP file format does not support timestamps before 1980." +#: library/zipfile.rst:866 +msgid "" +"The ZIP format supports multiple timestamp fields in different locations " +"(central directory, extra fields for NTFS/UNIX systems, etc.). This " +"attribute specifically returns the timestamp from the central directory. The " +"central directory timestamp format in ZIP files does not support timestamps " +"before 1980. While some extra field formats (such as UNIX timestamps) can " +"represent earlier dates, this attribute only returns the central directory " +"timestamp." msgstr "" -#: library/zipfile.rst:794 +#: library/zipfile.rst:873 +msgid "" +"The central directory timestamp is interpreted as representing local time, " +"rather than UTC time, to match the behavior of other zip tools." +msgstr "" + +#: library/zipfile.rst:879 msgid "Type of compression for the archive member." msgstr "" -#: library/zipfile.rst:799 +#: library/zipfile.rst:884 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "" -#: library/zipfile.rst:804 +#: library/zipfile.rst:889 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " "object." msgstr "" -#: library/zipfile.rst:811 +#: library/zipfile.rst:896 msgid "System which created ZIP archive." msgstr "" -#: library/zipfile.rst:816 +#: library/zipfile.rst:901 msgid "PKZIP version which created ZIP archive." msgstr "" -#: library/zipfile.rst:821 +#: library/zipfile.rst:906 msgid "PKZIP version needed to extract archive." msgstr "" -#: library/zipfile.rst:826 +#: library/zipfile.rst:911 msgid "Must be zero." msgstr "" -#: library/zipfile.rst:831 +#: library/zipfile.rst:916 msgid "ZIP flag bits." msgstr "" -#: library/zipfile.rst:836 +#: library/zipfile.rst:921 msgid "Volume number of file header." msgstr "" -#: library/zipfile.rst:841 +#: library/zipfile.rst:926 msgid "Internal attributes." msgstr "" -#: library/zipfile.rst:846 +#: library/zipfile.rst:931 msgid "External file attributes." msgstr "" -#: library/zipfile.rst:851 +#: library/zipfile.rst:936 msgid "Byte offset to the file header." msgstr "" -#: library/zipfile.rst:856 +#: library/zipfile.rst:941 msgid "CRC-32 of the uncompressed file." msgstr "" -#: library/zipfile.rst:861 +#: library/zipfile.rst:946 msgid "Size of the compressed data." msgstr "" -#: library/zipfile.rst:866 +#: library/zipfile.rst:951 msgid "Size of the uncompressed file." msgstr "" -#: library/zipfile.rst:873 -msgid "Command-Line Interface" +#: library/zipfile.rst:958 +msgid "Command-line interface" msgstr "" -#: library/zipfile.rst:875 +#: library/zipfile.rst:960 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" -#: library/zipfile.rst:878 +#: library/zipfile.rst:963 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: library/zipfile.rst:885 +#: library/zipfile.rst:966 +msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" +msgstr "" + +#: library/zipfile.rst:970 msgid "Passing a directory is also acceptable:" msgstr "" -#: library/zipfile.rst:891 +#: library/zipfile.rst:972 +msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" +msgstr "" + +#: library/zipfile.rst:976 msgid "" "If you want to extract a ZIP archive into the specified directory, use the :" "option:`-e` option:" msgstr "" -#: library/zipfile.rst:898 +#: library/zipfile.rst:979 +msgid "$ python -m zipfile -e monty.zip target-dir/" +msgstr "" + +#: library/zipfile.rst:983 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "" -#: library/zipfile.rst:906 +#: library/zipfile.rst:985 +msgid "$ python -m zipfile -l monty.zip" +msgstr "" + +#: library/zipfile.rst:991 msgid "Command-line options" msgstr "" -#: library/zipfile.rst:911 +#: library/zipfile.rst:996 msgid "List files in a zipfile." msgstr "" -#: library/zipfile.rst:916 +#: library/zipfile.rst:1001 msgid "Create zipfile from source files." msgstr "" -#: library/zipfile.rst:921 +#: library/zipfile.rst:1006 msgid "Extract zipfile into target directory." msgstr "" -#: library/zipfile.rst:926 +#: library/zipfile.rst:1011 msgid "Test whether the zipfile is valid or not." msgstr "" -#: library/zipfile.rst:930 +#: library/zipfile.rst:1015 msgid "" "Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" "`-t`." msgstr "" -#: library/zipfile.rst:937 +#: library/zipfile.rst:1022 msgid "Decompression pitfalls" msgstr "" -#: library/zipfile.rst:939 +#: library/zipfile.rst:1024 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "" -#: library/zipfile.rst:942 +#: library/zipfile.rst:1027 msgid "From file itself" msgstr "" -#: library/zipfile.rst:944 +#: library/zipfile.rst:1029 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." msgstr "" -#: library/zipfile.rst:948 -msgid "File System limitations" +#: library/zipfile.rst:1033 +msgid "File system limitations" msgstr "" -#: library/zipfile.rst:950 +#: library/zipfile.rst:1035 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -1079,33 +1234,33 @@ msgid "" "files, etc." msgstr "" -#: library/zipfile.rst:957 +#: library/zipfile.rst:1042 msgid "Resources limitations" msgstr "" -#: library/zipfile.rst:959 +#: library/zipfile.rst:1044 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " "can cause disk volume exhaustion." msgstr "" -#: library/zipfile.rst:964 +#: library/zipfile.rst:1049 msgid "Interruption" msgstr "" -#: library/zipfile.rst:966 +#: library/zipfile.rst:1051 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " "archive." msgstr "" -#: library/zipfile.rst:970 +#: library/zipfile.rst:1055 msgid "Default behaviors of extraction" msgstr "" -#: library/zipfile.rst:972 +#: library/zipfile.rst:1057 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " diff --git a/library/zipimport.po b/library/zipimport.po index 87557dad..a09210a5 100644 --- a/library/zipimport.po +++ b/library/zipimport.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/zipimport.rst:2 -msgid ":mod:`zipimport` --- Import modules from Zip archives" +msgid ":mod:`!zipimport` --- Import modules from Zip archives" msgstr "" #: library/zipimport.rst:9 @@ -55,16 +56,20 @@ msgid "" msgstr "" #: library/zipimport.rst:33 +msgid "ZIP64 is supported" +msgstr "" + +#: library/zipimport.rst:36 msgid "Previously, ZIP archives with an archive comment were not supported." msgstr "" -#: library/zipimport.rst:40 +#: library/zipimport.rst:41 msgid "" "`PKZIP Application Note `_" msgstr "" -#: library/zipimport.rst:39 +#: library/zipimport.rst:42 msgid "" "Documentation on the ZIP file format by Phil Katz, the creator of the format " "and algorithms used." @@ -74,7 +79,7 @@ msgstr "" msgid ":pep:`273` - Import Modules from Zip Archives" msgstr "" -#: library/zipimport.rst:43 +#: library/zipimport.rst:46 msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " @@ -82,34 +87,34 @@ msgid "" "`302`." msgstr "" -#: library/zipimport.rst:48 +#: library/zipimport.rst:50 msgid ":mod:`importlib` - The implementation of the import machinery" msgstr "" -#: library/zipimport.rst:48 +#: library/zipimport.rst:51 msgid "" "Package providing the relevant protocols for all importers to implement." msgstr "" -#: library/zipimport.rst:52 +#: library/zipimport.rst:55 msgid "This module defines an exception:" msgstr "" -#: library/zipimport.rst:56 +#: library/zipimport.rst:59 msgid "" "Exception raised by zipimporter objects. It's a subclass of :exc:" "`ImportError`, so it can be caught as :exc:`ImportError`, too." msgstr "" -#: library/zipimport.rst:63 +#: library/zipimport.rst:66 msgid "zipimporter Objects" msgstr "" -#: library/zipimport.rst:65 +#: library/zipimport.rst:68 msgid ":class:`zipimporter` is the class for importing ZIP files." msgstr "" -#: library/zipimport.rst:69 +#: library/zipimport.rst:72 msgid "" "Create a new zipimporter instance. *archivepath* must be a path to a ZIP " "file, or to a specific path within a ZIP file. For example, an " @@ -118,109 +123,130 @@ msgid "" "exists)." msgstr "" -#: library/zipimport.rst:74 +#: library/zipimport.rst:77 msgid "" ":exc:`ZipImportError` is raised if *archivepath* doesn't point to a valid " "ZIP archive." msgstr "" -#: library/zipimport.rst:79 +#: library/zipimport.rst:82 msgid "" "Methods ``find_loader()`` and ``find_module()``, deprecated in 3.10 are now " "removed. Use :meth:`find_spec` instead." msgstr "" -#: library/zipimport.rst:84 +#: library/zipimport.rst:87 msgid "" "Implementation of :meth:`importlib.abc.Loader.create_module` that returns :" "const:`None` to explicitly request the default semantics." msgstr "" -#: library/zipimport.rst:92 +#: library/zipimport.rst:95 msgid "Implementation of :meth:`importlib.abc.Loader.exec_module`." msgstr "" -#: library/zipimport.rst:99 +#: library/zipimport.rst:102 msgid "An implementation of :meth:`importlib.abc.PathEntryFinder.find_spec`." msgstr "" -#: library/zipimport.rst:106 +#: library/zipimport.rst:109 msgid "" "Return the code object for the specified module. Raise :exc:`ZipImportError` " "if the module couldn't be imported." msgstr "" -#: library/zipimport.rst:112 +#: library/zipimport.rst:115 msgid "" "Return the data associated with *pathname*. Raise :exc:`OSError` if the file " "wasn't found." msgstr "" -#: library/zipimport.rst:115 +#: library/zipimport.rst:118 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "" -#: library/zipimport.rst:121 +#: library/zipimport.rst:124 msgid "" "Return the value ``__file__`` would be set to if the specified module was " "imported. Raise :exc:`ZipImportError` if the module couldn't be imported." msgstr "" -#: library/zipimport.rst:130 +#: library/zipimport.rst:133 msgid "" "Return the source code for the specified module. Raise :exc:`ZipImportError` " "if the module couldn't be found, return :const:`None` if the archive does " "contain the module, but has no source for it." msgstr "" -#: library/zipimport.rst:138 +#: library/zipimport.rst:141 msgid "" "Return ``True`` if the module specified by *fullname* is a package. Raise :" "exc:`ZipImportError` if the module couldn't be found." msgstr "" -#: library/zipimport.rst:144 +#: library/zipimport.rst:147 msgid "" "Load the module specified by *fullname*. *fullname* must be the fully " "qualified (dotted) module name. Returns the imported module on success, " "raises :exc:`ZipImportError` on failure." msgstr "" -#: library/zipimport.rst:150 +#: library/zipimport.rst:153 msgid "Use :meth:`exec_module` instead." msgstr "" -#: library/zipimport.rst:155 +#: library/zipimport.rst:158 msgid "" "Clear out the internal cache of information about files found within the ZIP " "archive." msgstr "" -#: library/zipimport.rst:163 +#: library/zipimport.rst:166 msgid "" "The file name of the importer's associated ZIP file, without a possible " "subpath." msgstr "" -#: library/zipimport.rst:169 +#: library/zipimport.rst:172 msgid "" "The subpath within the ZIP file where modules are searched. This is the " "empty string for zipimporter objects which point to the root of the ZIP file." msgstr "" -#: library/zipimport.rst:173 +#: library/zipimport.rst:176 msgid "" "The :attr:`archive` and :attr:`prefix` attributes, when combined with a " "slash, equal the original *archivepath* argument given to the :class:" "`zipimporter` constructor." msgstr "" -#: library/zipimport.rst:181 +#: library/zipimport.rst:184 msgid "Examples" msgstr "" -#: library/zipimport.rst:183 +#: library/zipimport.rst:186 msgid "" "Here is an example that imports a module from a ZIP archive - note that the :" "mod:`zipimport` module is not explicitly used." msgstr "" + +#: library/zipimport.rst:189 +msgid "" +"$ unzip -l example_archive.zip\n" +"Archive: example_archive.zip\n" +" Length Date Time Name\n" +" -------- ---- ---- ----\n" +" 8467 01-01-00 12:30 example.py\n" +" -------- -------\n" +" 8467 1 file" +msgstr "" + +#: library/zipimport.rst:199 +msgid "" +">>> import sys\n" +">>> # Add the archive to the front of the module search path\n" +">>> sys.path.insert(0, 'example_archive.zip')\n" +">>> import example\n" +">>> example.__file__\n" +"'example_archive.zip/example.py'" +msgstr "" diff --git a/library/zlib.po b/library/zlib.po index 358c6d05..8a24c2fb 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -8,49 +8,55 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/zlib.rst:2 -msgid ":mod:`zlib` --- Compression compatible with :program:`gzip`" +msgid ":mod:`!zlib` --- Compression compatible with :program:`gzip`" msgstr "" #: library/zlib.rst:10 msgid "" "For applications that require data compression, the functions in this module " -"allow compression and decompression, using the zlib library. The zlib " -"library has its own home page at https://www.zlib.net. There are known " -"incompatibilities between the Python module and versions of the zlib library " -"earlier than 1.1.3; 1.1.3 has a `security vulnerability `_, so we recommend using 1.1.4 or later." +"allow compression and decompression, using the `zlib library `_." msgstr "" -#: library/zlib.rst:17 +#: includes/optional-module.rst:1 +msgid "" +"This is an :term:`optional module`. If it is missing from your copy of " +"CPython, look for documentation from your distributor (that is, whoever " +"provided Python to you). If you are the distributor, see :ref:`optional-" +"module-requirements`." +msgstr "" + +#: library/zlib.rst:15 msgid "" "zlib's functions have many options and often need to be used in a particular " "order. This documentation doesn't attempt to cover all of the permutations; " -"consult the zlib manual at http://www.zlib.net/manual.html for authoritative " -"information." +"consult the `zlib manual `_ for " +"authoritative information." msgstr "" -#: library/zlib.rst:22 +#: library/zlib.rst:20 msgid "For reading and writing ``.gz`` files see the :mod:`gzip` module." msgstr "" -#: library/zlib.rst:24 +#: library/zlib.rst:22 msgid "The available exception and functions in this module are:" msgstr "" -#: library/zlib.rst:29 +#: library/zlib.rst:27 msgid "Exception raised on compression and decompression errors." msgstr "" -#: library/zlib.rst:34 +#: library/zlib.rst:32 msgid "" "Computes an Adler-32 checksum of *data*. (An Adler-32 checksum is almost as " "reliable as a CRC32 but can be computed much more quickly.) The result is " @@ -63,31 +69,29 @@ msgid "" "suitable for use as a general hash algorithm." msgstr "" -#: library/zlib.rst:136 +#: library/zlib.rst:131 msgid "The result is always unsigned." msgstr "" -#: library/zlib.rst:49 +#: library/zlib.rst:47 msgid "" "Compresses the bytes in *data*, returning a bytes object containing " "compressed data. *level* is an integer from ``0`` to ``9`` or ``-1`` " -"controlling the level of compression; ``1`` (Z_BEST_SPEED) is fastest and " -"produces the least compression, ``9`` (Z_BEST_COMPRESSION) is slowest and " -"produces the most. ``0`` (Z_NO_COMPRESSION) is no compression. The default " -"value is ``-1`` (Z_DEFAULT_COMPRESSION). Z_DEFAULT_COMPRESSION represents a " -"default compromise between speed and compression (currently equivalent to " -"level 6)." +"controlling the level of compression; See :const:`Z_BEST_SPEED` (``1``), :" +"const:`Z_BEST_COMPRESSION` (``9``), :const:`Z_NO_COMPRESSION` (``0``), and " +"the default, :const:`Z_DEFAULT_COMPRESSION` (``-1``) for more information " +"about these values." msgstr "" -#: library/zlib.rst:58 +#: library/zlib.rst:55 msgid "" "The *wbits* argument controls the size of the history buffer (or the " "\"window size\") used when compressing data, and whether a header and " "trailer is included in the output. It can take several ranges of values, " -"defaulting to ``15`` (MAX_WBITS):" +"defaulting to ``15`` (:const:`MAX_WBITS`):" msgstr "" -#: library/zlib.rst:63 +#: library/zlib.rst:60 msgid "" "+9 to +15: The base-two logarithm of the window size, which therefore ranges " "between 512 and 32768. Larger values produce better compression at the " @@ -95,78 +99,75 @@ msgid "" "specific header and trailer." msgstr "" -#: library/zlib.rst:68 +#: library/zlib.rst:65 msgid "" "−9 to −15: Uses the absolute value of *wbits* as the window size logarithm, " "while producing a raw output stream with no header or trailing checksum." msgstr "" -#: library/zlib.rst:72 +#: library/zlib.rst:69 msgid "" "+25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value as the window " "size logarithm, while including a basic :program:`gzip` header and trailing " "checksum in the output." msgstr "" -#: library/zlib.rst:76 +#: library/zlib.rst:73 msgid "Raises the :exc:`error` exception if any error occurs." msgstr "" -#: library/zlib.rst:78 +#: library/zlib.rst:75 msgid "*level* can now be used as a keyword parameter." msgstr "" -#: library/zlib.rst:81 +#: library/zlib.rst:78 msgid "" "The *wbits* parameter is now available to set window bits and compression " "type." msgstr "" -#: library/zlib.rst:87 +#: library/zlib.rst:84 msgid "" "Returns a compression object, to be used for compressing data streams that " "won't fit into memory at once." msgstr "" -#: library/zlib.rst:90 +#: library/zlib.rst:87 msgid "" "*level* is the compression level -- an integer from ``0`` to ``9`` or " -"``-1``. A value of ``1`` (Z_BEST_SPEED) is fastest and produces the least " -"compression, while a value of ``9`` (Z_BEST_COMPRESSION) is slowest and " -"produces the most. ``0`` (Z_NO_COMPRESSION) is no compression. The default " -"value is ``-1`` (Z_DEFAULT_COMPRESSION). Z_DEFAULT_COMPRESSION represents a " -"default compromise between speed and compression (currently equivalent to " -"level 6)." +"``-1``. See :const:`Z_BEST_SPEED` (``1``), :const:`Z_BEST_COMPRESSION` " +"(``9``), :const:`Z_NO_COMPRESSION` (``0``), and the default, :const:" +"`Z_DEFAULT_COMPRESSION` (``-1``) for more information about these values." msgstr "" -#: library/zlib.rst:97 +#: library/zlib.rst:92 msgid "" "*method* is the compression algorithm. Currently, the only supported value " "is :const:`DEFLATED`." msgstr "" -#: library/zlib.rst:100 +#: library/zlib.rst:95 msgid "" "The *wbits* parameter controls the size of the history buffer (or the " "\"window size\"), and what header and trailer format will be used. It has " "the same meaning as `described for compress() <#compress-wbits>`__." msgstr "" -#: library/zlib.rst:104 +#: library/zlib.rst:99 msgid "" "The *memLevel* argument controls the amount of memory used for the internal " "compression state. Valid values range from ``1`` to ``9``. Higher values use " "more memory, but are faster and produce smaller output." msgstr "" -#: library/zlib.rst:108 +#: library/zlib.rst:103 msgid "" "*strategy* is used to tune the compression algorithm. Possible values are :" "const:`Z_DEFAULT_STRATEGY`, :const:`Z_FILTERED`, :const:`Z_HUFFMAN_ONLY`, :" -"const:`Z_RLE` (zlib 1.2.0.1) and :const:`Z_FIXED` (zlib 1.2.2.2)." +"const:`Z_RLE` and :const:`Z_FIXED`." msgstr "" -#: library/zlib.rst:112 +#: library/zlib.rst:107 msgid "" "*zdict* is a predefined compression dictionary. This is a sequence of bytes " "(such as a :class:`bytes` object) containing subsequences that are expected " @@ -174,11 +175,11 @@ msgid "" "that are expected to be most common should come at the end of the dictionary." msgstr "" -#: library/zlib.rst:117 +#: library/zlib.rst:112 msgid "Added the *zdict* parameter and keyword argument support." msgstr "" -#: library/zlib.rst:127 +#: library/zlib.rst:122 msgid "" "Computes a CRC (Cyclic Redundancy Check) checksum of *data*. The result is " "an unsigned 32-bit integer. If *value* is present, it is used as the " @@ -190,7 +191,7 @@ msgid "" "suitable for use as a general hash algorithm." msgstr "" -#: library/zlib.rst:141 +#: library/zlib.rst:136 msgid "" "Decompresses the bytes in *data*, returning a bytes object containing the " "uncompressed data. The *wbits* parameter depends on the format of *data*, " @@ -199,44 +200,44 @@ msgid "" "error occurs." msgstr "" -#: library/zlib.rst:149 +#: library/zlib.rst:144 msgid "" "The *wbits* parameter controls the size of the history buffer (or \"window " "size\"), and what header and trailer format is expected. It is similar to " "the parameter for :func:`compressobj`, but accepts more ranges of values:" msgstr "" -#: library/zlib.rst:154 +#: library/zlib.rst:149 msgid "" "+8 to +15: The base-two logarithm of the window size. The input must " "include a zlib header and trailer." msgstr "" -#: library/zlib.rst:157 +#: library/zlib.rst:152 msgid "" "0: Automatically determine the window size from the zlib header. Only " "supported since zlib 1.2.3.5." msgstr "" -#: library/zlib.rst:160 +#: library/zlib.rst:155 msgid "" "−8 to −15: Uses the absolute value of *wbits* as the window size logarithm. " "The input must be a raw stream with no header or trailer." msgstr "" -#: library/zlib.rst:163 +#: library/zlib.rst:158 msgid "" "+24 to +31 = 16 + (8 to 15): Uses the low 4 bits of the value as the window " "size logarithm. The input must include a gzip header and trailer." msgstr "" -#: library/zlib.rst:167 +#: library/zlib.rst:162 msgid "" "+40 to +47 = 32 + (8 to 15): Uses the low 4 bits of the value as the window " "size logarithm, and automatically accepts either the zlib or gzip format." msgstr "" -#: library/zlib.rst:171 +#: library/zlib.rst:166 msgid "" "When decompressing a stream, the window size must not be smaller than the " "size originally used to compress the stream; using a too-small value may " @@ -245,7 +246,7 @@ msgid "" "included." msgstr "" -#: library/zlib.rst:177 +#: library/zlib.rst:172 msgid "" "*bufsize* is the initial size of the buffer used to hold decompressed data. " "If more space is required, the buffer size will be increased as needed, so " @@ -253,46 +254,46 @@ msgid "" "few calls to :c:func:`malloc`." msgstr "" -#: library/zlib.rst:182 +#: library/zlib.rst:177 msgid "*wbits* and *bufsize* can be used as keyword arguments." msgstr "" -#: library/zlib.rst:187 +#: library/zlib.rst:182 msgid "" "Returns a decompression object, to be used for decompressing data streams " "that won't fit into memory at once." msgstr "" -#: library/zlib.rst:190 +#: library/zlib.rst:185 msgid "" "The *wbits* parameter controls the size of the history buffer (or the " "\"window size\"), and what header and trailer format is expected. It has " "the same meaning as `described for decompress() <#decompress-wbits>`__." msgstr "" -#: library/zlib.rst:194 +#: library/zlib.rst:189 msgid "" "The *zdict* parameter specifies a predefined compression dictionary. If " "provided, this must be the same dictionary as was used by the compressor " "that produced the data that is to be decompressed." msgstr "" -#: library/zlib.rst:200 +#: library/zlib.rst:195 msgid "" "If *zdict* is a mutable object (such as a :class:`bytearray`), you must not " "modify its contents between the call to :func:`decompressobj` and the first " "call to the decompressor's ``decompress()`` method." msgstr "" -#: library/zlib.rst:204 +#: library/zlib.rst:199 msgid "Added the *zdict* parameter." msgstr "" -#: library/zlib.rst:208 +#: library/zlib.rst:203 msgid "Compression objects support the following methods:" msgstr "" -#: library/zlib.rst:213 +#: library/zlib.rst:208 msgid "" "Compress *data*, returning a bytes object containing compressed data for at " "least part of the data in *data*. This data should be concatenated to the " @@ -300,37 +301,36 @@ msgid "" "input may be kept in internal buffers for later processing." msgstr "" -#: library/zlib.rst:221 +#: library/zlib.rst:216 msgid "" "All pending input is processed, and a bytes object containing the remaining " "compressed output is returned. *mode* can be selected from the constants :" "const:`Z_NO_FLUSH`, :const:`Z_PARTIAL_FLUSH`, :const:`Z_SYNC_FLUSH`, :const:" -"`Z_FULL_FLUSH`, :const:`Z_BLOCK` (zlib 1.2.3.4), or :const:`Z_FINISH`, " -"defaulting to :const:`Z_FINISH`. Except :const:`Z_FINISH`, all constants " -"allow compressing further bytestrings of data, while :const:`Z_FINISH` " -"finishes the compressed stream and prevents compressing any more data. " -"After calling :meth:`flush` with *mode* set to :const:`Z_FINISH`, the :meth:" -"`compress` method cannot be called again; the only realistic action is to " -"delete the object." +"`Z_FULL_FLUSH`, :const:`Z_BLOCK`, or :const:`Z_FINISH`, defaulting to :const:" +"`Z_FINISH`. Except :const:`Z_FINISH`, all constants allow compressing " +"further bytestrings of data, while :const:`Z_FINISH` finishes the compressed " +"stream and prevents compressing any more data. After calling :meth:`flush` " +"with *mode* set to :const:`Z_FINISH`, the :meth:`compress` method cannot be " +"called again; the only realistic action is to delete the object." msgstr "" -#: library/zlib.rst:234 +#: library/zlib.rst:229 msgid "" "Returns a copy of the compression object. This can be used to efficiently " "compress a set of data that share a common initial prefix." msgstr "" -#: library/zlib.rst:238 +#: library/zlib.rst:233 msgid "" "Added :func:`copy.copy` and :func:`copy.deepcopy` support to compression " "objects." msgstr "" -#: library/zlib.rst:243 +#: library/zlib.rst:238 msgid "Decompression objects support the following methods and attributes:" msgstr "" -#: library/zlib.rst:248 +#: library/zlib.rst:243 msgid "" "A bytes object which contains any bytes past the end of the compressed data. " "That is, this remains ``b\"\"`` until the last byte that contains " @@ -338,7 +338,7 @@ msgid "" "contain compressed data, this is ``b\"\"``, an empty bytes object." msgstr "" -#: library/zlib.rst:256 +#: library/zlib.rst:251 msgid "" "A bytes object that contains any data that was not consumed by the last :" "meth:`decompress` call because it exceeded the limit for the uncompressed " @@ -347,19 +347,19 @@ msgid "" "subsequent :meth:`decompress` method call in order to get correct output." msgstr "" -#: library/zlib.rst:265 +#: library/zlib.rst:260 msgid "" "A boolean indicating whether the end of the compressed data stream has been " "reached." msgstr "" -#: library/zlib.rst:268 +#: library/zlib.rst:263 msgid "" "This makes it possible to distinguish between a properly formed compressed " "stream, and an incomplete or truncated one." msgstr "" -#: library/zlib.rst:276 +#: library/zlib.rst:271 msgid "" "Decompress *data*, returning a bytes object containing the uncompressed data " "corresponding to at least part of the data in *string*. This data should be " @@ -368,7 +368,7 @@ msgid "" "buffers for later processing." msgstr "" -#: library/zlib.rst:282 +#: library/zlib.rst:277 msgid "" "If the optional parameter *max_length* is non-zero then the return value " "will be no longer than *max_length*. This may mean that not all of the " @@ -379,11 +379,11 @@ msgid "" "`unconsumed_tail` is empty." msgstr "" -#: library/zlib.rst:289 +#: library/zlib.rst:284 msgid "*max_length* can be used as a keyword argument." msgstr "" -#: library/zlib.rst:295 +#: library/zlib.rst:290 msgid "" "All pending input is processed, and a bytes object containing the remaining " "uncompressed output is returned. After calling :meth:`flush`, the :meth:" @@ -391,72 +391,207 @@ msgid "" "delete the object." msgstr "" -#: library/zlib.rst:300 +#: library/zlib.rst:295 msgid "" "The optional parameter *length* sets the initial size of the output buffer." msgstr "" -#: library/zlib.rst:305 +#: library/zlib.rst:300 msgid "" "Returns a copy of the decompression object. This can be used to save the " "state of the decompressor midway through the data stream in order to speed " "up random seeks into the stream at a future point." msgstr "" -#: library/zlib.rst:310 +#: library/zlib.rst:305 msgid "" "Added :func:`copy.copy` and :func:`copy.deepcopy` support to decompression " "objects." msgstr "" +#: library/zlib.rst:310 +msgid "" +"The following constants are available to configure compression and " +"decompression behavior:" +msgstr "" + #: library/zlib.rst:315 +msgid "The deflate compression method." +msgstr "" + +#: library/zlib.rst:320 +msgid "" +"The maximum window size, expressed as a power of 2. For example, if :const:`!" +"MAX_WBITS` is ``15`` it results in a window size of ``32 KiB``." +msgstr "" + +#: library/zlib.rst:327 +msgid "The default memory level for compression objects." +msgstr "" + +#: library/zlib.rst:332 +msgid "The default buffer size for decompression operations." +msgstr "" + +#: library/zlib.rst:337 +msgid "Compression level ``0``; no compression." +msgstr "" + +#: library/zlib.rst:344 +msgid "Compression level ``1``; fastest and produces the least compression." +msgstr "" + +#: library/zlib.rst:349 +msgid "Compression level ``9``; slowest and produces the most compression." +msgstr "" + +#: library/zlib.rst:354 +msgid "" +"Default compression level (``-1``); a compromise between speed and " +"compression. Currently equivalent to compression level ``6``." +msgstr "" + +#: library/zlib.rst:360 +msgid "Default compression strategy, for normal data." +msgstr "" + +#: library/zlib.rst:365 +msgid "Compression strategy for data produced by a filter (or predictor)." +msgstr "" + +#: library/zlib.rst:370 +msgid "Compression strategy that forces Huffman coding only." +msgstr "" + +#: library/zlib.rst:375 +msgid "" +"Compression strategy that limits match distances to one (run-length " +"encoding)." +msgstr "" + +#: library/zlib.rst:377 +msgid "" +"This constant is only available if Python was compiled with zlib 1.2.0.1 or " +"greater." +msgstr "" + +#: library/zlib.rst:385 +msgid "Compression strategy that prevents the use of dynamic Huffman codes." +msgstr "" + +#: library/zlib.rst:424 +msgid "" +"This constant is only available if Python was compiled with zlib 1.2.2.2 or " +"greater." +msgstr "" + +#: library/zlib.rst:395 +msgid "Flush mode ``0``. No special flushing behavior." +msgstr "" + +#: library/zlib.rst:402 +msgid "Flush mode ``1``. Flush as much output as possible." +msgstr "" + +#: library/zlib.rst:407 +msgid "" +"Flush mode ``2``. All output is flushed and the output is aligned to a byte " +"boundary." +msgstr "" + +#: library/zlib.rst:412 +msgid "" +"Flush mode ``3``. All output is flushed and the compression state is reset." +msgstr "" + +#: library/zlib.rst:417 +msgid "" +"Flush mode ``4``. All pending input is processed, no more input is expected." +msgstr "" + +#: library/zlib.rst:422 +msgid "Flush mode ``5``. A deflate block is completed and emitted." +msgstr "" + +#: library/zlib.rst:432 +msgid "" +"Flush mode ``6``, for inflate operations. Instructs inflate to return when " +"it gets to the next deflate block boundary." +msgstr "" + +#: library/zlib.rst:435 +msgid "" +"This constant is only available if Python was compiled with zlib 1.2.3.4 or " +"greater." +msgstr "" + +#: library/zlib.rst:441 msgid "" "Information about the version of the zlib library in use is available " "through the following constants:" msgstr "" -#: library/zlib.rst:321 +#: library/zlib.rst:447 msgid "" "The version string of the zlib library that was used for building the " "module. This may be different from the zlib library actually used at " "runtime, which is available as :const:`ZLIB_RUNTIME_VERSION`." msgstr "" -#: library/zlib.rst:328 +#: library/zlib.rst:454 msgid "" "The version string of the zlib library actually loaded by the interpreter." msgstr "" -#: library/zlib.rst:336 +#: library/zlib.rst:461 +msgid "" +"The version string of the zlib-ng library that was used for building the " +"module if zlib-ng was used. When present, the :data:`ZLIB_VERSION` and :data:" +"`ZLIB_RUNTIME_VERSION` constants reflect the version of the zlib API " +"provided by zlib-ng." +msgstr "" + +#: library/zlib.rst:466 +msgid "" +"If zlib-ng was not used to build the module, this constant will be absent." +msgstr "" + +#: library/zlib.rst:473 msgid "Module :mod:`gzip`" msgstr "" -#: library/zlib.rst:336 +#: library/zlib.rst:474 msgid "Reading and writing :program:`gzip`\\ -format files." msgstr "" -#: library/zlib.rst:339 -msgid "http://www.zlib.net" +#: library/zlib.rst:476 +msgid "https://www.zlib.net" msgstr "" -#: library/zlib.rst:339 +#: library/zlib.rst:477 msgid "The zlib library home page." msgstr "" -#: library/zlib.rst:342 -msgid "http://www.zlib.net/manual.html" +#: library/zlib.rst:479 +msgid "https://www.zlib.net/manual.html" msgstr "" -#: library/zlib.rst:342 +#: library/zlib.rst:480 msgid "" "The zlib manual explains the semantics and usage of the library's many " "functions." msgstr "" -#: library/zlib.rst:123 +#: library/zlib.rst:483 +msgid "" +"In case gzip (de)compression is a bottleneck, the `python-isal`_ package " +"speeds up (de)compression with a mostly compatible API." +msgstr "" + +#: library/zlib.rst:118 msgid "Cyclic Redundancy Check" msgstr "" -#: library/zlib.rst:123 +#: library/zlib.rst:118 msgid "checksum" msgstr "" diff --git a/library/zoneinfo.po b/library/zoneinfo.po index 49d6a70d..a0649983 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -8,16 +8,17 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: library/zoneinfo.rst:2 -msgid ":mod:`zoneinfo` --- IANA time zone support" +msgid ":mod:`!zoneinfo` --- IANA time zone support" msgstr "" #: library/zoneinfo.rst:12 @@ -30,10 +31,10 @@ msgid "" "support the IANA time zone database as originally specified in :pep:`615`. " "By default, :mod:`zoneinfo` uses the system's time zone data if available; " "if no system time zone data is available, the library will fall back to " -"using the first-party `tzdata`_ package available on PyPI." +"using the first-party :pypi:`tzdata` package available on PyPI." msgstr "" -#: library/zoneinfo.rst:26 +#: library/zoneinfo.rst:24 msgid "Module: :mod:`datetime`" msgstr "" @@ -43,8 +44,8 @@ msgid "" "with which the :class:`ZoneInfo` class is designed to be used." msgstr "" -#: library/zoneinfo.rst:29 -msgid "Package `tzdata`_" +#: library/zoneinfo.rst:28 +msgid "Package :pypi:`tzdata`" msgstr "" #: library/zoneinfo.rst:29 @@ -54,14 +55,13 @@ msgid "" msgstr "" #: includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid "Availability" msgstr "" #: includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" #: library/zoneinfo.rst:35 @@ -77,12 +77,37 @@ msgid "" "astimezone>`::" msgstr "" +#: library/zoneinfo.rst:42 +msgid "" +">>> from zoneinfo import ZoneInfo\n" +">>> from datetime import datetime, timedelta\n" +"\n" +">>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo(\"America/" +"Los_Angeles\"))\n" +">>> print(dt)\n" +"2020-10-31 12:00:00-07:00\n" +"\n" +">>> dt.tzname()\n" +"'PDT'" +msgstr "" + #: library/zoneinfo.rst:52 msgid "" "Datetimes constructed in this way are compatible with datetime arithmetic " "and handle daylight saving time transitions with no further intervention::" msgstr "" +#: library/zoneinfo.rst:55 +msgid "" +">>> dt_add = dt + timedelta(days=1)\n" +"\n" +">>> print(dt_add)\n" +"2020-11-01 12:00:00-08:00\n" +"\n" +">>> dt_add.tzname()\n" +"'PST'" +msgstr "" + #: library/zoneinfo.rst:63 msgid "" "These time zones also support the :attr:`~datetime.datetime.fold` attribute " @@ -92,12 +117,37 @@ msgid "" "*after* the transition is used when ``fold=1``, for example::" msgstr "" +#: library/zoneinfo.rst:69 +msgid "" +">>> dt = datetime(2020, 11, 1, 1, tzinfo=ZoneInfo(\"America/Los_Angeles\"))\n" +">>> print(dt)\n" +"2020-11-01 01:00:00-07:00\n" +"\n" +">>> print(dt.replace(fold=1))\n" +"2020-11-01 01:00:00-08:00" +msgstr "" + #: library/zoneinfo.rst:76 msgid "" "When converting from another time zone, the fold will be set to the correct " "value::" msgstr "" +#: library/zoneinfo.rst:79 +msgid "" +">>> from datetime import timezone\n" +">>> LOS_ANGELES = ZoneInfo(\"America/Los_Angeles\")\n" +">>> dt_utc = datetime(2020, 11, 1, 8, tzinfo=timezone.utc)\n" +"\n" +">>> # Before the PDT -> PST transition\n" +">>> print(dt_utc.astimezone(LOS_ANGELES))\n" +"2020-11-01 01:00:00-07:00\n" +"\n" +">>> # After the PDT -> PST transition\n" +">>> print((dt_utc + timedelta(hours=1)).astimezone(LOS_ANGELES))\n" +"2020-11-01 01:00:00-08:00" +msgstr "" + #: library/zoneinfo.rst:92 msgid "Data sources" msgstr "" @@ -106,7 +156,7 @@ msgstr "" msgid "" "The ``zoneinfo`` module does not directly provide time zone data, and " "instead pulls time zone information from the system time zone database or " -"the first-party PyPI package `tzdata`_, if available. Some systems, " +"the first-party PyPI package :pypi:`tzdata`, if available. Some systems, " "including notably Windows systems, do not have an IANA database available, " "and so for projects targeting cross-platform compatibility that require time " "zone data, it is recommended to declare a dependency on tzdata. If neither " @@ -221,6 +271,13 @@ msgid "" "``key``, the following assertion will always be true:" msgstr "" +#: library/zoneinfo.rst:182 +msgid "" +"a = ZoneInfo(key)\n" +"b = ZoneInfo(key)\n" +"assert a is b" +msgstr "" + #: library/zoneinfo.rst:188 msgid "" "``key`` must be in the form of a relative, normalized POSIX path, with no up-" @@ -340,6 +397,17 @@ msgid "" "the note on usage in the attribute documentation)::" msgstr "" +#: library/zoneinfo.rst:275 +msgid "" +">>> zone = ZoneInfo(\"Pacific/Kwajalein\")\n" +">>> str(zone)\n" +"'Pacific/Kwajalein'\n" +"\n" +">>> dt = datetime(2020, 4, 1, 3, 15, tzinfo=zone)\n" +">>> f\"{dt.isoformat()} [{dt.tzinfo}]\"\n" +"'2020-04-01T03:15:00+12:00 [Pacific/Kwajalein]'" +msgstr "" + #: library/zoneinfo.rst:283 msgid "" "For objects constructed from a file without specifying a ``key`` parameter, " @@ -368,10 +436,17 @@ msgid "" "``ZoneInfo(key)``: When constructed with the primary constructor, a " "``ZoneInfo`` object is serialized by key, and when deserialized, the " "deserializing process uses the primary and thus it is expected that these " -"are expected to be the same object as other references to the same time " -"zone. For example, if ``europe_berlin_pkl`` is a string containing a pickle " -"constructed from ``ZoneInfo(\"Europe/Berlin\")``, one would expect the " -"following behavior:" +"are the same object as other references to the same time zone. For example, " +"if ``europe_berlin_pkl`` is a string containing a pickle constructed from " +"``ZoneInfo(\"Europe/Berlin\")``, one would expect the following behavior:" +msgstr "" + +#: library/zoneinfo.rst:307 +msgid "" +">>> a = ZoneInfo(\"Europe/Berlin\")\n" +">>> b = pickle.loads(europe_berlin_pkl)\n" +">>> a is b\n" +"True" msgstr "" #: library/zoneinfo.rst:314 @@ -384,13 +459,22 @@ msgid "" "the following behavior:" msgstr "" +#: library/zoneinfo.rst:321 +msgid "" +">>> a = ZoneInfo(\"Europe/Berlin\")\n" +">>> b = pickle.loads(europe_berlin_pkl_nc)\n" +">>> a is b\n" +"False" +msgstr "" + #: library/zoneinfo.rst:328 msgid "" -"``ZoneInfo.from_file(fobj, /, key=None)``: When constructed from a file, the " -"``ZoneInfo`` object raises an exception on pickling. If an end user wants to " -"pickle a ``ZoneInfo`` constructed from a file, it is recommended that they " -"use a wrapper type or a custom serialization function: either serializing by " -"key or storing the contents of the file object and serializing that." +"``ZoneInfo.from_file(file_obj, /, key=None)``: When constructed from a file, " +"the ``ZoneInfo`` object raises an exception on pickling. If an end user " +"wants to pickle a ``ZoneInfo`` constructed from a file, it is recommended " +"that they use a wrapper type or a custom serialization function: either " +"serializing by key or storing the contents of the file object and " +"serializing that." msgstr "" #: library/zoneinfo.rst:334 diff --git a/license.po b/license.po index ca7d359c..c1c67545 100644 --- a/license.po +++ b/license.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-04-24 22:38+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-14 22:38+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -29,12 +29,12 @@ msgstr "Η ιστορία του λογισμικού" #: license.rst:13 msgid "" "Python was created in the early 1990s by Guido van Rossum at Stichting " -"Mathematisch Centrum (CWI, see https://www.cwi.nl/) in the Netherlands as a " +"Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands as a " "successor of a language called ABC. Guido remains Python's principal " "author, although it includes many contributions from others." msgstr "" "Η Python δημιουργήθηκε στις αρχές του 1990 από τον Guido van Rossum στο " -"Stichting Mathematisch Centrum (CWI, βλ. https://www.cwi.nl/) στην Ολλανδία " +"Stichting Mathematisch Centrum (CWI, βλ. https://www.cwi.nl) στην Ολλανδία " "ως διάδοχος μια γλώσσας που ονομάζεται ABC. Ο Guido παραμένει ο κύριος " "συγγραφέας της Python, παρόλα αυτά περιλαμβάνει συνεισφορές και από άλλα " "άτομα." @@ -42,41 +42,40 @@ msgstr "" #: license.rst:18 msgid "" "In 1995, Guido continued his work on Python at the Corporation for National " -"Research Initiatives (CNRI, see https://www.cnri.reston.va.us/) in Reston, " +"Research Initiatives (CNRI, see https://www.cnri.reston.va.us) in Reston, " "Virginia where he released several versions of the software." msgstr "" "Το 1995, ο Guido συνέχισε το έργο του για την Python στο Corporation for " -"National Research Initiatives (CNRI, βλ. https://www.cnri.reston.va.us/) στο " +"National Research Initiatives (CNRI, βλ. https://www.cnri.reston.va.us) στο " "Reston της Virginia, όπου κυκλοφόρησε πολλές εκδόσεις του λογισμικού." #: license.rst:22 msgid "" "In May 2000, Guido and the Python core development team moved to BeOpen.com " "to form the BeOpen PythonLabs team. In October of the same year, the " -"PythonLabs team moved to Digital Creations (now Zope Corporation; see " -"https://www.zope.org/). In 2001, the Python Software Foundation (PSF, see " -"https://www.python.org/psf/) was formed, a non-profit organization created " -"specifically to own Python-related Intellectual Property. Zope Corporation " -"is a sponsoring member of the PSF." +"PythonLabs team moved to Digital Creations, which became Zope Corporation. " +"In 2001, the Python Software Foundation (PSF, see https://www.python.org/" +"psf/) was formed, a non-profit organization created specifically to own " +"Python-related Intellectual Property. Zope Corporation was a sponsoring " +"member of the PSF." msgstr "" "Τον Μάιο του 2000, ο Guido και η βασική ομάδα ανάπτυξης της Python " "μετακόμισαν στο BeOpen.com για να σχηματίσουν την ομάδα BeOpen PythonLabs. " "Τον Οκτώβριο του ίδιου έτους, η ομάδα του PythonLabs μετακόμισε στην Digital " -"Creations (τώρα Zope Corporation, βλ. https://www.zope.org/). Το 2001, το " -"Python Software Foundation (PSF, βλ. https://www.python.org/psf/) " -"δημιουργήθηκε ως ένας μη κερδοσκοπικός οργανισμός με στόχο να κατέχει την " -"πνευματική ιδιοκτησία που σχετίζεται με την Python. Η Zope Corporation είναι " -"μέλος-χορηγός του PSF." +"Creations, η οποία μετατράπηκε σε Zope Corporation. Το 2001, το Python " +"Software Foundation (PSF, βλ. https://www.python.org/psf) δημιουργήθηκε ως " +"ένας μη κερδοσκοπικός οργανισμός με στόχο να κατέχει την πνευματική " +"ιδιοκτησία που σχετίζεται με την Python. Η Zope Corporation ήταν μέλος-" +"χορηγός του PSF." #: license.rst:30 msgid "" -"All Python releases are Open Source (see https://opensource.org/ for the " -"Open Source Definition). Historically, most, but not all, Python releases " -"have also been GPL-compatible; the table below summarizes the various " -"releases." +"All Python releases are Open Source (see https://opensource.org for the Open " +"Source Definition). Historically, most, but not all, Python releases have " +"also been GPL-compatible; the table below summarizes the various releases." msgstr "" "Όλες οι εκδόσεις της Python είναι Ανοιχτού Κώδικα (βλ. https://opensource." -"org/ για τον ορισμό του Ανοιχτού Κώδικα). Ιστορικά οι περισσότερες, αλλά όχι " +"org για τον ορισμό του Ανοιχτού Κώδικα). Ιστορικά οι περισσότερες, αλλά όχι " "όλες, εκδόσεις της Python ήταν επίσης συμβατές με την άδεια GPL: ο παρακάτω " "πίνακας συνοψίζει τις διάφορες εκδόσεις." @@ -97,8 +96,8 @@ msgid "Owner" msgstr "Ιδιοκτησία" #: license.rst:35 -msgid "GPL compatible?" -msgstr "Συμβατότητα GPL;" +msgid "GPL-compatible? (1)" +msgstr "Συμβατότητα GPL; (1)" #: license.rst:37 msgid "0.9.0 thru 1.2" @@ -148,7 +147,7 @@ msgstr "1.5.2" msgid "2000" msgstr "2000" -#: license.rst:45 license.rst:47 +#: license.rst:47 msgid "no" msgstr "όχι" @@ -168,6 +167,10 @@ msgstr "1.6.1" msgid "2001" msgstr "2001" +#: license.rst:45 +msgid "yes (2)" +msgstr "ναι (2)" + #: license.rst:47 msgid "2.1" msgstr "2.1" @@ -214,14 +217,14 @@ msgstr "2001-σήμερα" #: license.rst:62 msgid "" -"GPL-compatible doesn't mean that we're distributing Python under the GPL. " +"GPL-compatible doesn't mean that we're distributing Python under the GPL. " "All Python licenses, unlike the GPL, let you distribute a modified version " "without making your changes open source. The GPL-compatible licenses make it " "possible to combine Python with other software that is released under the " "GPL; the others don't." msgstr "" "Η συμβατότητα με GPL δεν σημαίνει ότι διανέμεται η Python κάτω από την άδεια " -"GPL. Όλες οι άδειες της Python, σε αντίθεση με την GPL, σας επιτρέπουν να " +"GPL. Όλες οι άδειες της Python, σε αντίθεση με την GPL, σας επιτρέπουν να " "διανείμετε μια τροποποιημένη έκδοση χωρίς να κάνετε τις αλλαγές σας, " "ανοιχτού κώδικα. Οι άδειες με συμβατότητα GPL καθιστούν δυνατό τον συνδυασμό " "της Python με άλλο λογισμικό που κυκλοφορεί με βάσει της GPL, ενώ οι άλλες " @@ -229,37 +232,49 @@ msgstr "" #: license.rst:68 msgid "" +"According to Richard Stallman, 1.6.1 is not GPL-compatible, because its " +"license has a choice of law clause. According to CNRI, however, Stallman's " +"lawyer has told CNRI's lawyer that 1.6.1 is \"not incompatible\" with the " +"GPL." +msgstr "" +"Σύμφωνα με τον Richard Stallman, 1.6.1 δεν είναι συμβατή με την GPL, επειδή " +"η άδεια της έχει νομική ρήτρα επιλογής, Σύμφωνα με το CNRI, ωστόσο, ο " +"δικηγόρος του Stallman είπε στον δικηγόρο της CNRI ότι η 1.6.1 \"δεν είναι " +"συμβατή\" με την GPL." + +#: license.rst:72 +msgid "" "Thanks to the many outside volunteers who have worked under Guido's " "direction to make these releases possible." msgstr "" "Χάρη, στους πολλούς εξωτερικούς εθελοντές που εργάστηκαν κάτω από τις " "οδηγίες του Guido, αυτές οι εκδόσεις έγιναν εφικτές." -#: license.rst:73 +#: license.rst:77 msgid "Terms and conditions for accessing or otherwise using Python" msgstr "" "Όροι και προϋποθέσεις για την πρόσβαση ή την χρήση της Python με άλλους " "τρόπους" -#: license.rst:75 +#: license.rst:79 msgid "" -"Python software and documentation are licensed under the :ref:`PSF License " -"Agreement `." +"Python software and documentation are licensed under the Python Software " +"Foundation License Version 2." msgstr "" -"Το λογισμικό και η τεκμηρίωση της Python αδειοδοτούνται σύμφωνα με :ref:" -"`Σύμβαση άδειας χρήσης PSF `." +"Το λογισμικό της Python και η τεκμηρίωση αδειοδοτούνται σύμφωνα με την άδεια " +"χρήσης Python Software Foundation Έκδοση 2." -#: license.rst:78 +#: license.rst:82 msgid "" "Starting with Python 3.8.6, examples, recipes, and other code in the " -"documentation are dual licensed under the PSF License Agreement and the :ref:" +"documentation are dual licensed under the PSF License Version 2 and the :ref:" "`Zero-Clause BSD license `." msgstr "" "Ξεκινώντας από την Python 3.8.6, παραδείγματα, συνταγές και ο άλλος κώδικας " -"στην τεκμηρίωση έχουν διπλή άδεια χρήσης, βάση της Άδεια Χρήσης PSF και της :" -"ref:`Zero-Clause BSD άδεια `." +"στην τεκμηρίωση έχουν διπλή άδεια χρήσης, σύμφωνα με την Άδεια PSF Έκδοση 2 " +"και της :ref:`Zero-Clause BSD άδεια `." -#: license.rst:82 +#: license.rst:86 msgid "" "Some software incorporated into Python is under different licenses. The " "licenses are listed with code falling under that license. See :ref:" @@ -269,36 +284,569 @@ msgstr "" "άδειες χρήσης. Οι άδειες παρατίθενται με κώδικα που εμπίπτει σε αυτήν την " "άδεια. Δείτε :ref:`OtherLicenses` για μια ελλιπή λίστα αυτών των αδειών." -#: license.rst:90 -msgid "PSF LICENSE AGREEMENT FOR PYTHON |release|" -msgstr "ΣΥΜΦΩΝΙΑ ΑΔΕΙΑΣ PSF ΓΙΑ ΤΗΝ PYTHON |release|" +#: license.rst:94 +msgid "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" +msgstr "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" -#: license.rst:138 +#: license.rst:98 +msgid "" +"1. This LICENSE AGREEMENT is between the Python Software Foundation " +"(\"PSF\"), and\n" +" the Individual or Organization (\"Licensee\") accessing and otherwise " +"using this\n" +" software (\"Python\") in source or binary form and its associated " +"documentation.\n" +"\n" +"2. Subject to the terms and conditions of this License Agreement, PSF " +"hereby\n" +" grants Licensee a nonexclusive, royalty-free, world-wide license to " +"reproduce,\n" +" analyze, test, perform and/or display publicly, prepare derivative " +"works,\n" +" distribute, and otherwise use Python alone or in any derivative\n" +" version, provided, however, that PSF's License Agreement and PSF's notice " +"of\n" +" copyright, i.e., \"Copyright © 2001 Python Software Foundation; All " +"Rights\n" +" Reserved\" are retained in Python alone or in any derivative version\n" +" prepared by Licensee.\n" +"\n" +"3. In the event Licensee prepares a derivative work that is based on or\n" +" incorporates Python or any part thereof, and wants to make the\n" +" derivative work available to others as provided herein, then Licensee " +"hereby\n" +" agrees to include in any such work a brief summary of the changes made to " +"Python.\n" +"\n" +"4. PSF is making Python available to Licensee on an \"AS IS\" basis.\n" +" PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY " +"OF\n" +" EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY " +"REPRESENTATION OR\n" +" WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT " +"THE\n" +" USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +"\n" +"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\n" +" FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT " +"OF\n" +" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE\n" +" THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n" +"\n" +"6. This License Agreement will automatically terminate upon a material " +"breach of\n" +" its terms and conditions.\n" +"\n" +"7. Nothing in this License Agreement shall be deemed to create any " +"relationship\n" +" of agency, partnership, or joint venture between PSF and Licensee. This " +"License\n" +" Agreement does not grant permission to use PSF trademarks or trade name " +"in a\n" +" trademark sense to endorse or promote products or services of Licensee, " +"or any\n" +" third party.\n" +"\n" +"8. By copying, installing or otherwise using Python, Licensee agrees\n" +" to be bound by the terms and conditions of this License Agreement." +msgstr "" +"1. This LICENSE AGREEMENT is between the Python Software Foundation " +"(\"PSF\"), and\n" +" the Individual or Organization (\"Licensee\") accessing and otherwise " +"using this\n" +" software (\"Python\") in source or binary form and its associated " +"documentation.\n" +"\n" +"2. Subject to the terms and conditions of this License Agreement, PSF " +"hereby\n" +" grants Licensee a nonexclusive, royalty-free, world-wide license to " +"reproduce,\n" +" analyze, test, perform and/or display publicly, prepare derivative " +"works,\n" +" distribute, and otherwise use Python alone or in any derivative\n" +" version, provided, however, that PSF's License Agreement and PSF's notice " +"of\n" +" copyright, i.e., \"Copyright © 2001 Python Software Foundation; All " +"Rights\n" +" Reserved\" are retained in Python alone or in any derivative version\n" +" prepared by Licensee.\n" +"\n" +"3. In the event Licensee prepares a derivative work that is based on or\n" +" incorporates Python or any part thereof, and wants to make the\n" +" derivative work available to others as provided herein, then Licensee " +"hereby\n" +" agrees to include in any such work a brief summary of the changes made to " +"Python.\n" +"\n" +"4. PSF is making Python available to Licensee on an \"AS IS\" basis.\n" +" PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY " +"OF\n" +" EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY " +"REPRESENTATION OR\n" +" WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT " +"THE\n" +" USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +"\n" +"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\n" +" FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT " +"OF\n" +" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE\n" +" THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n" +"\n" +"6. This License Agreement will automatically terminate upon a material " +"breach of\n" +" its terms and conditions.\n" +"\n" +"7. Nothing in this License Agreement shall be deemed to create any " +"relationship\n" +" of agency, partnership, or joint venture between PSF and Licensee. This " +"License\n" +" Agreement does not grant permission to use PSF trademarks or trade name " +"in a\n" +" trademark sense to endorse or promote products or services of Licensee, " +"or any\n" +" third party.\n" +"\n" +"8. By copying, installing or otherwise using Python, Licensee agrees\n" +" to be bound by the terms and conditions of this License Agreement." + +#: license.rst:141 msgid "BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0" msgstr "ΣΥΜΦΩΝΙΑ ΑΔΕΙΑΣ BEOPEN.COM ΓΙΑ PYTHON 2.0" -#: license.rst:140 +#: license.rst:143 msgid "BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1" msgstr "ΣΥΜΦΩΝΙΑ ΑΔΕΙΑΣ ΑΝΟΙΧΤΟΥ ΚΩΔΙΚΑ BEOPEN PYTHON ΕΚΔΟΣΗ 1" -#: license.rst:185 +#: license.rst:147 +msgid "" +"1. This LICENSE AGREEMENT is between BeOpen.com (\"BeOpen\"), having an " +"office at\n" +" 160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or " +"Organization\n" +" (\"Licensee\") accessing and otherwise using this software in source or " +"binary\n" +" form and its associated documentation (\"the Software\").\n" +"\n" +"2. Subject to the terms and conditions of this BeOpen Python License " +"Agreement,\n" +" BeOpen hereby grants Licensee a non-exclusive, royalty-free, world-wide " +"license\n" +" to reproduce, analyze, test, perform and/or display publicly, prepare " +"derivative\n" +" works, distribute, and otherwise use the Software alone or in any " +"derivative\n" +" version, provided, however, that the BeOpen Python License is retained in " +"the\n" +" Software, alone or in any derivative version prepared by Licensee.\n" +"\n" +"3. BeOpen is making the Software available to Licensee on an \"AS IS\" " +"basis.\n" +" BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY " +"WAY OF\n" +" EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND DISCLAIMS ANY " +"REPRESENTATION OR\n" +" WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT " +"THE\n" +" USE OF THE SOFTWARE WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +"\n" +"4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE SOFTWARE " +"FOR\n" +" ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF " +"USING,\n" +" MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE THEREOF, EVEN " +"IF\n" +" ADVISED OF THE POSSIBILITY THEREOF.\n" +"\n" +"5. This License Agreement will automatically terminate upon a material " +"breach of\n" +" its terms and conditions.\n" +"\n" +"6. This License Agreement shall be governed by and interpreted in all " +"respects\n" +" by the law of the State of California, excluding conflict of law " +"provisions.\n" +" Nothing in this License Agreement shall be deemed to create any " +"relationship of\n" +" agency, partnership, or joint venture between BeOpen and Licensee. This " +"License\n" +" Agreement does not grant permission to use BeOpen trademarks or trade " +"names in a\n" +" trademark sense to endorse or promote products or services of Licensee, " +"or any\n" +" third party. As an exception, the \"BeOpen Python\" logos available at\n" +" http://www.pythonlabs.com/logos.html may be used according to the " +"permissions\n" +" granted on that web page.\n" +"\n" +"7. By copying, installing or otherwise using the software, Licensee agrees " +"to be\n" +" bound by the terms and conditions of this License Agreement." +msgstr "" +"1. This LICENSE AGREEMENT is between BeOpen.com (\"BeOpen\"), having an " +"office at\n" +" 160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or " +"Organization\n" +" (\"Licensee\") accessing and otherwise using this software in source or " +"binary\n" +" form and its associated documentation (\"the Software\").\n" +"\n" +"2. Subject to the terms and conditions of this BeOpen Python License " +"Agreement,\n" +" BeOpen hereby grants Licensee a non-exclusive, royalty-free, world-wide " +"license\n" +" to reproduce, analyze, test, perform and/or display publicly, prepare " +"derivative\n" +" works, distribute, and otherwise use the Software alone or in any " +"derivative\n" +" version, provided, however, that the BeOpen Python License is retained in " +"the\n" +" Software, alone or in any derivative version prepared by Licensee.\n" +"\n" +"3. BeOpen is making the Software available to Licensee on an \"AS IS\" " +"basis.\n" +" BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY " +"WAY OF\n" +" EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND DISCLAIMS ANY " +"REPRESENTATION OR\n" +" WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT " +"THE\n" +" USE OF THE SOFTWARE WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +"\n" +"4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE SOFTWARE " +"FOR\n" +" ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF " +"USING,\n" +" MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE THEREOF, EVEN " +"IF\n" +" ADVISED OF THE POSSIBILITY THEREOF.\n" +"\n" +"5. This License Agreement will automatically terminate upon a material " +"breach of\n" +" its terms and conditions.\n" +"\n" +"6. This License Agreement shall be governed by and interpreted in all " +"respects\n" +" by the law of the State of California, excluding conflict of law " +"provisions.\n" +" Nothing in this License Agreement shall be deemed to create any " +"relationship of\n" +" agency, partnership, or joint venture between BeOpen and Licensee. This " +"License\n" +" Agreement does not grant permission to use BeOpen trademarks or trade " +"names in a\n" +" trademark sense to endorse or promote products or services of Licensee, " +"or any\n" +" third party. As an exception, the \"BeOpen Python\" logos available at\n" +" http://www.pythonlabs.com/logos.html may be used according to the " +"permissions\n" +" granted on that web page.\n" +"\n" +"7. By copying, installing or otherwise using the software, Licensee agrees " +"to be\n" +" bound by the terms and conditions of this License Agreement." + +#: license.rst:188 msgid "CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1" msgstr "ΣΥΜΦΩΝΙΑ ΑΔΕΙΑΣ CNRI ΓΙΑ PYTHON 1.6.1" -#: license.rst:250 +#: license.rst:192 +msgid "" +"1. This LICENSE AGREEMENT is between the Corporation for National Research\n" +" Initiatives, having an office at 1895 Preston White Drive, Reston, VA " +"20191\n" +" (\"CNRI\"), and the Individual or Organization (\"Licensee\") accessing " +"and\n" +" otherwise using Python 1.6.1 software in source or binary form and its\n" +" associated documentation.\n" +"\n" +"2. Subject to the terms and conditions of this License Agreement, CNRI " +"hereby\n" +" grants Licensee a nonexclusive, royalty-free, world-wide license to " +"reproduce,\n" +" analyze, test, perform and/or display publicly, prepare derivative " +"works,\n" +" distribute, and otherwise use Python 1.6.1 alone or in any derivative " +"version,\n" +" provided, however, that CNRI's License Agreement and CNRI's notice of " +"copyright,\n" +" i.e., \"Copyright © 1995-2001 Corporation for National Research " +"Initiatives; All\n" +" Rights Reserved\" are retained in Python 1.6.1 alone or in any derivative " +"version\n" +" prepared by Licensee. Alternately, in lieu of CNRI's License Agreement,\n" +" Licensee may substitute the following text (omitting the quotes): " +"\"Python 1.6.1\n" +" is made available subject to the terms and conditions in CNRI's License\n" +" Agreement. This Agreement together with Python 1.6.1 may be located on " +"the\n" +" internet using the following unique, persistent identifier (known as a " +"handle):\n" +" 1895.22/1013. This Agreement may also be obtained from a proxy server on " +"the\n" +" internet using the following URL: http://hdl.handle.net/1895.22/1013\".\n" +"\n" +"3. In the event Licensee prepares a derivative work that is based on or\n" +" incorporates Python 1.6.1 or any part thereof, and wants to make the " +"derivative\n" +" work available to others as provided herein, then Licensee hereby agrees " +"to\n" +" include in any such work a brief summary of the changes made to Python " +"1.6.1.\n" +"\n" +"4. CNRI is making Python 1.6.1 available to Licensee on an \"AS IS\" basis. " +"CNRI\n" +" MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF " +"EXAMPLE,\n" +" BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR " +"WARRANTY\n" +" OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE " +"OF\n" +" PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +"\n" +"5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 1.6.1 " +"FOR\n" +" ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF\n" +" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, OR ANY " +"DERIVATIVE\n" +" THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n" +"\n" +"6. This License Agreement will automatically terminate upon a material " +"breach of\n" +" its terms and conditions.\n" +"\n" +"7. This License Agreement shall be governed by the federal intellectual " +"property\n" +" law of the United States, including without limitation the federal " +"copyright\n" +" law, and, to the extent such U.S. federal law does not apply, by the law " +"of the\n" +" Commonwealth of Virginia, excluding Virginia's conflict of law " +"provisions.\n" +" Notwithstanding the foregoing, with regard to derivative works based on " +"Python\n" +" 1.6.1 that incorporate non-separable material that was previously " +"distributed\n" +" under the GNU General Public License (GPL), the law of the Commonwealth " +"of\n" +" Virginia shall govern this License Agreement only as to issues arising " +"under or\n" +" with respect to Paragraphs 4, 5, and 7 of this License Agreement. " +"Nothing in\n" +" this License Agreement shall be deemed to create any relationship of " +"agency,\n" +" partnership, or joint venture between CNRI and Licensee. This License " +"Agreement\n" +" does not grant permission to use CNRI trademarks or trade name in a " +"trademark\n" +" sense to endorse or promote products or services of Licensee, or any " +"third\n" +" party.\n" +"\n" +"8. By clicking on the \"ACCEPT\" button where indicated, or by copying, " +"installing\n" +" or otherwise using Python 1.6.1, Licensee agrees to be bound by the terms " +"and\n" +" conditions of this License Agreement." +msgstr "" +"1. This LICENSE AGREEMENT is between the Corporation for National Research\n" +" Initiatives, having an office at 1895 Preston White Drive, Reston, VA " +"20191\n" +" (\"CNRI\"), and the Individual or Organization (\"Licensee\") accessing " +"and\n" +" otherwise using Python 1.6.1 software in source or binary form and its\n" +" associated documentation.\n" +"\n" +"2. Subject to the terms and conditions of this License Agreement, CNRI " +"hereby\n" +" grants Licensee a nonexclusive, royalty-free, world-wide license to " +"reproduce,\n" +" analyze, test, perform and/or display publicly, prepare derivative " +"works,\n" +" distribute, and otherwise use Python 1.6.1 alone or in any derivative " +"version,\n" +" provided, however, that CNRI's License Agreement and CNRI's notice of " +"copyright,\n" +" i.e., \"Copyright © 1995-2001 Corporation for National Research " +"Initiatives; All\n" +" Rights Reserved\" are retained in Python 1.6.1 alone or in any derivative " +"version\n" +" prepared by Licensee. Alternately, in lieu of CNRI's License Agreement,\n" +" Licensee may substitute the following text (omitting the quotes): " +"\"Python 1.6.1\n" +" is made available subject to the terms and conditions in CNRI's License\n" +" Agreement. This Agreement together with Python 1.6.1 may be located on " +"the\n" +" internet using the following unique, persistent identifier (known as a " +"handle):\n" +" 1895.22/1013. This Agreement may also be obtained from a proxy server on " +"the\n" +" internet using the following URL: http://hdl.handle.net/1895.22/1013\".\n" +"\n" +"3. In the event Licensee prepares a derivative work that is based on or\n" +" incorporates Python 1.6.1 or any part thereof, and wants to make the " +"derivative\n" +" work available to others as provided herein, then Licensee hereby agrees " +"to\n" +" include in any such work a brief summary of the changes made to Python " +"1.6.1.\n" +"\n" +"4. CNRI is making Python 1.6.1 available to Licensee on an \"AS IS\" basis. " +"CNRI\n" +" MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF " +"EXAMPLE,\n" +" BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR " +"WARRANTY\n" +" OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE " +"OF\n" +" PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +"\n" +"5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 1.6.1 " +"FOR\n" +" ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF\n" +" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, OR ANY " +"DERIVATIVE\n" +" THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n" +"\n" +"6. This License Agreement will automatically terminate upon a material " +"breach of\n" +" its terms and conditions.\n" +"\n" +"7. This License Agreement shall be governed by the federal intellectual " +"property\n" +" law of the United States, including without limitation the federal " +"copyright\n" +" law, and, to the extent such U.S. federal law does not apply, by the law " +"of the\n" +" Commonwealth of Virginia, excluding Virginia's conflict of law " +"provisions.\n" +" Notwithstanding the foregoing, with regard to derivative works based on " +"Python\n" +" 1.6.1 that incorporate non-separable material that was previously " +"distributed\n" +" under the GNU General Public License (GPL), the law of the Commonwealth " +"of\n" +" Virginia shall govern this License Agreement only as to issues arising " +"under or\n" +" with respect to Paragraphs 4, 5, and 7 of this License Agreement. " +"Nothing in\n" +" this License Agreement shall be deemed to create any relationship of " +"agency,\n" +" partnership, or joint venture between CNRI and Licensee. This License " +"Agreement\n" +" does not grant permission to use CNRI trademarks or trade name in a " +"trademark\n" +" sense to endorse or promote products or services of Licensee, or any " +"third\n" +" party.\n" +"\n" +"8. By clicking on the \"ACCEPT\" button where indicated, or by copying, " +"installing\n" +" or otherwise using Python 1.6.1, Licensee agrees to be bound by the terms " +"and\n" +" conditions of this License Agreement." + +#: license.rst:253 msgid "CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2" msgstr "ΣΥΜΦΩΝΙΑ ΑΔΕΙΑΣ CWI ΓΙΑ PYTHON 0.9.0 ΕΩΣ 1.2" -#: license.rst:277 -msgid "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON |release| DOCUMENTATION" +#: license.rst:257 +msgid "" +"Copyright © 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The\n" +"Netherlands. All rights reserved.\n" +"\n" +"Permission to use, copy, modify, and distribute this software and its\n" +"documentation for any purpose and without fee is hereby granted, provided " +"that\n" +"the above copyright notice appear in all copies and that both that " +"copyright\n" +"notice and this permission notice appear in supporting documentation, and " +"that\n" +"the name of Stichting Mathematisch Centrum or CWI not be used in advertising " +"or\n" +"publicity pertaining to distribution of the software without specific, " +"written\n" +"prior permission.\n" +"\n" +"STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS\n" +"SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, " +"IN NO\n" +"EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, " +"INDIRECT\n" +"OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF " +"USE,\n" +"DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER " +"TORTIOUS\n" +"ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n" +"SOFTWARE." msgstr "" -"ZERO-CLAUSE BSD ΑΔΕΙΑ ΓΙΑ ΤΟΝ ΚΩΔΙΚΑ ΣΤΗΝ ΤΕΚΜΗΡΙΩΣΗ ΤΗΣ PYTHON |release|" - -#: license.rst:296 +"Copyright © 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The\n" +"Netherlands. All rights reserved.\n" +"\n" +"Permission to use, copy, modify, and distribute this software and its\n" +"documentation for any purpose and without fee is hereby granted, provided " +"that\n" +"the above copyright notice appear in all copies and that both that " +"copyright\n" +"notice and this permission notice appear in supporting documentation, and " +"that\n" +"the name of Stichting Mathematisch Centrum or CWI not be used in advertising " +"or\n" +"publicity pertaining to distribution of the software without specific, " +"written\n" +"prior permission.\n" +"\n" +"STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS\n" +"SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, " +"IN NO\n" +"EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, " +"INDIRECT\n" +"OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF " +"USE,\n" +"DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER " +"TORTIOUS\n" +"ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n" +"SOFTWARE." + +#: license.rst:280 +msgid "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION" +msgstr "ZERO-CLAUSE BSD ΑΔΕΙΑ ΓΙΑ ΤΟΝ ΚΩΔΙΚΑ ΣΤΗΝ ΤΕΚΜΗΡΙΩΣΗ ΤΗΣ PYTHON" + +#: license.rst:284 +msgid "" +"Permission to use, copy, modify, and/or distribute this software for any\n" +"purpose with or without fee is hereby granted.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES " +"WITH\n" +"REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n" +"AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, " +"DIRECT,\n" +"INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n" +"LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE " +"OR\n" +"OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" +"PERFORMANCE OF THIS SOFTWARE." +msgstr "" +"Permission to use, copy, modify, and/or distribute this software for any\n" +"purpose with or without fee is hereby granted.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES " +"WITH\n" +"REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n" +"AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, " +"DIRECT,\n" +"INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n" +"LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE " +"OR\n" +"OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" +"PERFORMANCE OF THIS SOFTWARE." + +#: license.rst:299 msgid "Licenses and Acknowledgements for Incorporated Software" msgstr "Άδειες και Ευχαριστίες για Ενσωματωμένο Λογισμικό" -#: license.rst:298 +#: license.rst:301 msgid "" "This section is an incomplete, but growing list of licenses and " "acknowledgements for third-party software incorporated in the Python " @@ -307,11 +855,11 @@ msgstr "" "Αυτή η ενότητα είναι μια ημιτελής, αλλά αυξανόμενη λίστα αδειών και " "ευχαριστιών για λογισμικό τρίτων, που ενσωματώνεται στην διανομή της Python." -#: license.rst:303 +#: license.rst:306 msgid "Mersenne Twister" msgstr "Mersenne Twister" -#: license.rst:305 +#: license.rst:308 msgid "" "The :mod:`!_random` C extension underlying the :mod:`random` module includes " "code based on a download from http://www.math.sci.hiroshima-u.ac.jp/~m-mat/" @@ -323,11 +871,97 @@ msgstr "" "hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html. Ακολουθούν κατά λέξη τα " "σχόλια από το αρχικό κώδικα::" -#: license.rst:353 +#: license.rst:313 +msgid "" +"A C-program for MT19937, with initialization improved 2002/1/26.\n" +"Coded by Takuji Nishimura and Makoto Matsumoto.\n" +"\n" +"Before using, initialize the state by using init_genrand(seed)\n" +"or init_by_array(init_key, key_length).\n" +"\n" +"Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n" +"All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +" 1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"\n" +" 2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +" 3. The names of its contributors may not be used to endorse or promote\n" +" products derived from this software without specific prior written\n" +" permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" +"\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" +"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" +"A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER " +"OR\n" +"CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" +"EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" +"PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" +"PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n" +"LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n" +"NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n" +"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +"\n" +"\n" +"Any feedback is very welcome.\n" +"http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n" +"email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)" +msgstr "" +"A C-program for MT19937, with initialization improved 2002/1/26.\n" +"Coded by Takuji Nishimura and Makoto Matsumoto.\n" +"\n" +"Before using, initialize the state by using init_genrand(seed)\n" +"or init_by_array(init_key, key_length).\n" +"\n" +"Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n" +"All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +" 1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"\n" +" 2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +" 3. The names of its contributors may not be used to endorse or promote\n" +" products derived from this software without specific prior written\n" +" permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" +"\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" +"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" +"A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER " +"OR\n" +"CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n" +"EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n" +"PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n" +"PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n" +"LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n" +"NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n" +"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" +"\n" +"\n" +"Any feedback is very welcome.\n" +"http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n" +"email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)" + +#: license.rst:356 msgid "Sockets" msgstr "Sockets" -#: license.rst:355 +#: license.rst:358 msgid "" "The :mod:`socket` module uses the functions, :c:func:`!getaddrinfo`, and :c:" "func:`!getnameinfo`, which are coded in separate source files from the WIDE " @@ -337,11 +971,67 @@ msgstr "" "getaddrinfo`, και :c:func:`!getnameinfo`, τα οποία έχουν υλοποιηθεί σε " "διαφορετικά αρχεία από το WIDE Έργο, https://www.wide.ad.jp/. ::" -#: license.rst:388 +#: license.rst:362 +msgid "" +"Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n" +"All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"3. Neither the name of the project nor the names of its contributors\n" +" may be used to endorse or promote products derived from this software\n" +" without specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS \"AS IS\" AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE." +msgstr "" +"Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n" +"All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"3. Neither the name of the project nor the names of its contributors\n" +" may be used to endorse or promote products derived from this software\n" +" without specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS \"AS IS\" AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE." + +#: license.rst:391 msgid "Asynchronous socket services" msgstr "Ασύγχρονες socket υπηρεσίες" -#: license.rst:390 +#: license.rst:393 msgid "" "The :mod:`!test.support.asynchat` and :mod:`!test.support.asyncore` modules " "contain the following notice::" @@ -349,51 +1039,347 @@ msgstr "" "Οι ενότητες :mod:`!test.support.asynchat` και :mod:`!test.support.asyncore` " "περιέχουν την παρακάτω ειδοποίηση::" -#: license.rst:416 +#: license.rst:396 +msgid "" +"Copyright 1996 by Sam Rushing\n" +"\n" +" All Rights Reserved\n" +"\n" +"Permission to use, copy, modify, and distribute this software and\n" +"its documentation for any purpose and without fee is hereby\n" +"granted, provided that the above copyright notice appear in all\n" +"copies and that both that copyright notice and this permission\n" +"notice appear in supporting documentation, and that the name of Sam\n" +"Rushing not be used in advertising or publicity pertaining to\n" +"distribution of the software without specific, written prior\n" +"permission.\n" +"\n" +"SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\n" +"INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN\n" +"NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR\n" +"CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n" +"OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,\n" +"NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n" +"CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE." +msgstr "" +"Copyright 1996 by Sam Rushing\n" +"\n" +" All Rights Reserved\n" +"\n" +"Permission to use, copy, modify, and distribute this software and\n" +"its documentation for any purpose and without fee is hereby\n" +"granted, provided that the above copyright notice appear in all\n" +"copies and that both that copyright notice and this permission\n" +"notice appear in supporting documentation, and that the name of Sam\n" +"Rushing not be used in advertising or publicity pertaining to\n" +"distribution of the software without specific, written prior\n" +"permission.\n" +"\n" +"SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\n" +"INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN\n" +"NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR\n" +"CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\n" +"OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,\n" +"NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n" +"CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE." + +#: license.rst:419 msgid "Cookie management" msgstr "Διαχείριση Cookie" -#: license.rst:418 +#: license.rst:421 msgid "The :mod:`http.cookies` module contains the following notice::" msgstr "Η ενότητα :mod:`http.cookies` περιέχει την παρακάτω ειδοποίηση::" -#: license.rst:444 +#: license.rst:423 +msgid "" +"Copyright 2000 by Timothy O'Malley \n" +"\n" +" All Rights Reserved\n" +"\n" +"Permission to use, copy, modify, and distribute this software\n" +"and its documentation for any purpose and without fee is hereby\n" +"granted, provided that the above copyright notice appear in all\n" +"copies and that both that copyright notice and this permission\n" +"notice appear in supporting documentation, and that the name of\n" +"Timothy O'Malley not be used in advertising or publicity\n" +"pertaining to distribution of the software without specific, written\n" +"prior permission.\n" +"\n" +"Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS\n" +"SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n" +"AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR\n" +"ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n" +"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n" +"WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n" +"ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" +"PERFORMANCE OF THIS SOFTWARE." +msgstr "" +"Copyright 2000 by Timothy O'Malley \n" +"\n" +" All Rights Reserved\n" +"\n" +"Permission to use, copy, modify, and distribute this software\n" +"and its documentation for any purpose and without fee is hereby\n" +"granted, provided that the above copyright notice appear in all\n" +"copies and that both that copyright notice and this permission\n" +"notice appear in supporting documentation, and that the name of\n" +"Timothy O'Malley not be used in advertising or publicity\n" +"pertaining to distribution of the software without specific, written\n" +"prior permission.\n" +"\n" +"Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS\n" +"SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n" +"AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR\n" +"ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n" +"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n" +"WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n" +"ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" +"PERFORMANCE OF THIS SOFTWARE." + +#: license.rst:447 msgid "Execution tracing" msgstr "Ανίχνευση εκτέλεσης" -#: license.rst:446 +#: license.rst:449 msgid "The :mod:`trace` module contains the following notice::" msgstr "Η ενότητα :mod:`trace` περιέχει την παρακάτω ειδοποίηση::" -#: license.rst:477 +#: license.rst:451 +msgid "" +"portions copyright 2001, Autonomous Zones Industries, Inc., all rights...\n" +"err... reserved and offered to the public under the terms of the\n" +"Python 2.2 license.\n" +"Author: Zooko O'Whielacronx\n" +"http://zooko.com/\n" +"mailto:zooko@zooko.com\n" +"\n" +"Copyright 2000, Mojam Media, Inc., all rights reserved.\n" +"Author: Skip Montanaro\n" +"\n" +"Copyright 1999, Bioreason, Inc., all rights reserved.\n" +"Author: Andrew Dalke\n" +"\n" +"Copyright 1995-1997, Automatrix, Inc., all rights reserved.\n" +"Author: Skip Montanaro\n" +"\n" +"Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved.\n" +"\n" +"\n" +"Permission to use, copy, modify, and distribute this Python software and\n" +"its associated documentation for any purpose without fee is hereby\n" +"granted, provided that the above copyright notice appears in all copies,\n" +"and that both that copyright notice and this permission notice appear in\n" +"supporting documentation, and that the name of neither Automatrix,\n" +"Bioreason or Mojam Media be used in advertising or publicity pertaining to\n" +"distribution of the software without specific, written prior permission." +msgstr "" +"portions copyright 2001, Autonomous Zones Industries, Inc., all rights...\n" +"err... reserved and offered to the public under the terms of the\n" +"Python 2.2 license.\n" +"Author: Zooko O'Whielacronx\n" +"http://zooko.com/\n" +"mailto:zooko@zooko.com\n" +"\n" +"Copyright 2000, Mojam Media, Inc., all rights reserved.\n" +"Author: Skip Montanaro\n" +"\n" +"Copyright 1999, Bioreason, Inc., all rights reserved.\n" +"Author: Andrew Dalke\n" +"\n" +"Copyright 1995-1997, Automatrix, Inc., all rights reserved.\n" +"Author: Skip Montanaro\n" +"\n" +"Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved.\n" +"\n" +"\n" +"Permission to use, copy, modify, and distribute this Python software and\n" +"its associated documentation for any purpose without fee is hereby\n" +"granted, provided that the above copyright notice appears in all copies,\n" +"and that both that copyright notice and this permission notice appear in\n" +"supporting documentation, and that the name of neither Automatrix,\n" +"Bioreason or Mojam Media be used in advertising or publicity pertaining to\n" +"distribution of the software without specific, written prior permission." + +#: license.rst:480 msgid "UUencode and UUdecode functions" msgstr "Συναρτήσεις UUencode και UUdecode" -#: license.rst:479 -msgid "The :mod:`uu` module contains the following notice::" -msgstr "Η ενότητα :mod:`uu` περιέχει την παρακάτω ειδοποίηση::" +#: license.rst:482 +msgid "The ``uu`` codec contains the following notice::" +msgstr "Ο ``uu`` κωδικοποιητής περιέχει την παρακάτω ειδοποίηση::" -#: license.rst:507 +#: license.rst:484 +msgid "" +"Copyright 1994 by Lance Ellinghouse\n" +"Cathedral City, California Republic, United States of America.\n" +" All Rights Reserved\n" +"Permission to use, copy, modify, and distribute this software and its\n" +"documentation for any purpose and without fee is hereby granted,\n" +"provided that the above copyright notice appear in all copies and that\n" +"both that copyright notice and this permission notice appear in\n" +"supporting documentation, and that the name of Lance Ellinghouse\n" +"not be used in advertising or publicity pertaining to distribution\n" +"of the software without specific, written prior permission.\n" +"LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO\n" +"THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n" +"FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE CENTRUM BE LIABLE\n" +"FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n" +"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n" +"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n" +"OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n" +"\n" +"Modified by Jack Jansen, CWI, July 1995:\n" +"- Use binascii module to do the actual line-by-line conversion\n" +" between ascii and binary. This results in a 1000-fold speedup. The C\n" +" version is still 5 times faster, though.\n" +"- Arguments more compliant with Python standard" +msgstr "" +"Copyright 1994 by Lance Ellinghouse\n" +"Cathedral City, California Republic, United States of America.\n" +" All Rights Reserved\n" +"Permission to use, copy, modify, and distribute this software and its\n" +"documentation for any purpose and without fee is hereby granted,\n" +"provided that the above copyright notice appear in all copies and that\n" +"both that copyright notice and this permission notice appear in\n" +"supporting documentation, and that the name of Lance Ellinghouse\n" +"not be used in advertising or publicity pertaining to distribution\n" +"of the software without specific, written prior permission.\n" +"LANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO\n" +"THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n" +"FITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE CENTRUM BE LIABLE\n" +"FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n" +"WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n" +"ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n" +"OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n" +"\n" +"Modified by Jack Jansen, CWI, July 1995:\n" +"- Use binascii module to do the actual line-by-line conversion\n" +" between ascii and binary. This results in a 1000-fold speedup. The C\n" +" version is still 5 times faster, though.\n" +"- Arguments more compliant with Python standard" + +#: license.rst:510 msgid "XML Remote Procedure Calls" msgstr "Κλήσεις Απομακρυσμένης Διαδικασίας XML" -#: license.rst:509 +#: license.rst:512 msgid "The :mod:`xmlrpc.client` module contains the following notice::" msgstr "Η ενότητα :mod:`xmlrpc.client` περιέχει την παρακάτω ειδοποίηση::" -#: license.rst:540 +#: license.rst:514 +msgid "" +" The XML-RPC client interface is\n" +"\n" +"Copyright (c) 1999-2002 by Secret Labs AB\n" +"Copyright (c) 1999-2002 by Fredrik Lundh\n" +"\n" +"By obtaining, using, and/or copying this software and/or its\n" +"associated documentation, you agree that you have read, understood,\n" +"and will comply with the following terms and conditions:\n" +"\n" +"Permission to use, copy, modify, and distribute this software and\n" +"its associated documentation for any purpose and without fee is\n" +"hereby granted, provided that the above copyright notice appears in\n" +"all copies, and that both that copyright notice and this permission\n" +"notice appear in supporting documentation, and that the name of\n" +"Secret Labs AB or the author not be used in advertising or publicity\n" +"pertaining to distribution of the software without specific, written\n" +"prior permission.\n" +"\n" +"SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD\n" +"TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-\n" +"ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR\n" +"BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY\n" +"DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n" +"WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n" +"ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n" +"OF THIS SOFTWARE." +msgstr "" +" The XML-RPC client interface is\n" +"\n" +"Copyright (c) 1999-2002 by Secret Labs AB\n" +"Copyright (c) 1999-2002 by Fredrik Lundh\n" +"\n" +"By obtaining, using, and/or copying this software and/or its\n" +"associated documentation, you agree that you have read, understood,\n" +"and will comply with the following terms and conditions:\n" +"\n" +"Permission to use, copy, modify, and distribute this software and\n" +"its associated documentation for any purpose and without fee is\n" +"hereby granted, provided that the above copyright notice appears in\n" +"all copies, and that both that copyright notice and this permission\n" +"notice appear in supporting documentation, and that the name of\n" +"Secret Labs AB or the author not be used in advertising or publicity\n" +"pertaining to distribution of the software without specific, written\n" +"prior permission.\n" +"\n" +"SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD\n" +"TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-\n" +"ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR\n" +"BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY\n" +"DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\n" +"WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n" +"ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n" +"OF THIS SOFTWARE." + +#: license.rst:543 msgid "test_epoll" msgstr "test_epoll" -#: license.rst:542 +#: license.rst:545 msgid "The :mod:`!test.test_epoll` module contains the following notice::" msgstr "Η ενότητα :mod:`!test.test_epoll` περιέχει την παρακάτω ειδοποίηση::" -#: license.rst:566 +#: license.rst:547 +msgid "" +"Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +msgstr "" +"Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + +#: license.rst:569 msgid "Select kqueue" msgstr "Επιλογή kqueue" -#: license.rst:568 +#: license.rst:571 msgid "" "The :mod:`select` module contains the following notice for the kqueue " "interface::" @@ -401,11 +1387,61 @@ msgstr "" "Η ενότητα :mod:`select` περιέχει την παρακάτω ειδοποίηση για την kqueue " "διεπαφή::" -#: license.rst:597 +#: license.rst:574 +msgid "" +"Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes\n" +"All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE." +msgstr "" +"Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes\n" +"All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE." + +#: license.rst:600 msgid "SipHash24" msgstr "SipHash24" -#: license.rst:599 +#: license.rst:602 msgid "" "The file :file:`Python/pyhash.c` contains Marek Majkowski' implementation of " "Dan Bernstein's SipHash24 algorithm. It contains the following note::" @@ -414,11 +1450,63 @@ msgstr "" "του αλγορίθμου τού Dan Bernstein, SipHash24. Αυτό περιέχει την παρακάτω " "σημείωση::" -#: license.rst:626 +#: license.rst:605 +msgid "" +"\n" +"Copyright (c) 2013 Marek Majkowski \n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining a " +"copy\n" +"of this software and associated documentation files (the \"Software\"), to " +"deal\n" +"in the Software without restriction, including without limitation the " +"rights\n" +"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +"copies of the Software, and to permit persons to whom the Software is\n" +"furnished to do so, subject to the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included in\n" +"all copies or substantial portions of the Software.\n" +"\n" +"\n" +"Original location:\n" +" https://github.com/majek/csiphash/\n" +"\n" +"Solution inspired by code from:\n" +" Samuel Neves (supercop/crypto_auth/siphash24/little)\n" +" djb (supercop/crypto_auth/siphash24/little2)\n" +" Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)" +msgstr "" +"\n" +"Copyright (c) 2013 Marek Majkowski \n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining a " +"copy\n" +"of this software and associated documentation files (the \"Software\"), to " +"deal\n" +"in the Software without restriction, including without limitation the " +"rights\n" +"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +"copies of the Software, and to permit persons to whom the Software is\n" +"furnished to do so, subject to the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included in\n" +"all copies or substantial portions of the Software.\n" +"\n" +"\n" +"Original location:\n" +" https://github.com/majek/csiphash/\n" +"\n" +"Solution inspired by code from:\n" +" Samuel Neves (supercop/crypto_auth/siphash24/little)\n" +" djb (supercop/crypto_auth/siphash24/little2)\n" +" Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)" + +#: license.rst:629 msgid "strtod and dtoa" msgstr "strtod και dtoa" -#: license.rst:628 +#: license.rst:631 msgid "" "The file :file:`Python/dtoa.c`, which supplies C functions dtoa and strtod " "for conversion of C doubles to and from strings, is derived from the file of " @@ -434,32 +1522,430 @@ msgstr "" "αρχείο, όπως ανακτήθηκε στις 16 Μαρτίου, 2009, περιέχει τα ακόλουθα " "πνευματικά δικαιώματα και την ειδοποίηση αδειοδότησης::" -#: license.rst:656 +#: license.rst:638 +msgid "" +"/****************************************************************\n" +" *\n" +" * The author of this software is David M. Gay.\n" +" *\n" +" * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.\n" +" *\n" +" * Permission to use, copy, modify, and distribute this software for any\n" +" * purpose without fee is hereby granted, provided that this entire notice\n" +" * is included in all copies of any software which is or includes a copy\n" +" * or modification of this software and in all copies of the supporting\n" +" * documentation for such software.\n" +" *\n" +" * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR " +"IMPLIED\n" +" * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY\n" +" * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY\n" +" * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.\n" +" *\n" +" ***************************************************************/" +msgstr "" +"/****************************************************************\n" +" *\n" +" * The author of this software is David M. Gay.\n" +" *\n" +" * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.\n" +" *\n" +" * Permission to use, copy, modify, and distribute this software for any\n" +" * purpose without fee is hereby granted, provided that this entire notice\n" +" * is included in all copies of any software which is or includes a copy\n" +" * or modification of this software and in all copies of the supporting\n" +" * documentation for such software.\n" +" *\n" +" * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR " +"IMPLIED\n" +" * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY\n" +" * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY\n" +" * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.\n" +" *\n" +" ***************************************************************/" + +#: license.rst:659 msgid "OpenSSL" msgstr "OpenSSL" -#: license.rst:658 +#: license.rst:661 msgid "" -"The modules :mod:`hashlib`, :mod:`posix`, :mod:`ssl`, :mod:`crypt` use the " -"OpenSSL library for added performance if made available by the operating " -"system. Additionally, the Windows and macOS installers for Python may " -"include a copy of the OpenSSL libraries, so we include a copy of the OpenSSL " -"license here. For the OpenSSL 3.0 release, and later releases derived from " -"that, the Apache License v2 applies::" +"The modules :mod:`hashlib`, :mod:`posix` and :mod:`ssl` use the OpenSSL " +"library for added performance if made available by the operating system. " +"Additionally, the Windows and macOS installers for Python may include a copy " +"of the OpenSSL libraries, so we include a copy of the OpenSSL license here. " +"For the OpenSSL 3.0 release, and later releases derived from that, the " +"Apache License v2 applies::" msgstr "" -"Οι μονάδες :mod:`hashlib`, :mod:`posix`, :mod:`ssl`, :mod:`crypt` " -"χρησιμοποιούν την βιβλιοθήκη OpenSSL για επιπλέον απόδοση, εάν διατίθενται " -"από το λειτουργικό σύστημα. Επιπλέον, τα προγράμματα εγκατάστασης για την " -"Python για Windows και macOS, ενδέχεται να περιλαμβάνουν ένα αντίγραφο των " -"βιβλιοθηκών OpenSSL, επομένως συμπεριλαμβάνουμε ένα αντίγραφο της άδειας " -"OpenSSL εδώ. Για την έκδοση OpenSSL 3.0 και για νεότερες εκδόσεις που " -"προέρχονται από αυτή, ισχύει η άδεια Apache v2::" - -#: license.rst:845 +"Οι μονάδες :mod:`hashlib`, :mod:`posix` και :mod:`ssl` χρησιμοποιούν την " +"βιβλιοθήκη OpenSSL για επιπλέον απόδοση, εάν διατίθενται από το λειτουργικό " +"σύστημα. Επιπλέον, τα προγράμματα εγκατάστασης για την Python για Windows " +"και macOS, ενδέχεται να περιλαμβάνουν ένα αντίγραφο των βιβλιοθηκών OpenSSL, " +"επομένως συμπεριλαμβάνουμε ένα αντίγραφο της άδειας OpenSSL εδώ. Για την " +"έκδοση OpenSSL 3.0 και για νεότερες εκδόσεις που προέρχονται από αυτή, " +"ισχύει η άδεια Apache v2::" + +#: license.rst:669 +msgid "" +" Apache License\n" +" Version 2.0, January 2004\n" +" https://www.apache.org/licenses/\n" +"\n" +"TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n" +"\n" +"1. Definitions.\n" +"\n" +" \"License\" shall mean the terms and conditions for use, reproduction,\n" +" and distribution as defined by Sections 1 through 9 of this document.\n" +"\n" +" \"Licensor\" shall mean the copyright owner or entity authorized by\n" +" the copyright owner that is granting the License.\n" +"\n" +" \"Legal Entity\" shall mean the union of the acting entity and all\n" +" other entities that control, are controlled by, or are under common\n" +" control with that entity. For the purposes of this definition,\n" +" \"control\" means (i) the power, direct or indirect, to cause the\n" +" direction or management of such entity, whether by contract or\n" +" otherwise, or (ii) ownership of fifty percent (50%) or more of the\n" +" outstanding shares, or (iii) beneficial ownership of such entity.\n" +"\n" +" \"You\" (or \"Your\") shall mean an individual or Legal Entity\n" +" exercising permissions granted by this License.\n" +"\n" +" \"Source\" form shall mean the preferred form for making modifications,\n" +" including but not limited to software source code, documentation\n" +" source, and configuration files.\n" +"\n" +" \"Object\" form shall mean any form resulting from mechanical\n" +" transformation or translation of a Source form, including but\n" +" not limited to compiled object code, generated documentation,\n" +" and conversions to other media types.\n" +"\n" +" \"Work\" shall mean the work of authorship, whether in Source or\n" +" Object form, made available under the License, as indicated by a\n" +" copyright notice that is included in or attached to the work\n" +" (an example is provided in the Appendix below).\n" +"\n" +" \"Derivative Works\" shall mean any work, whether in Source or Object\n" +" form, that is based on (or derived from) the Work and for which the\n" +" editorial revisions, annotations, elaborations, or other modifications\n" +" represent, as a whole, an original work of authorship. For the purposes\n" +" of this License, Derivative Works shall not include works that remain\n" +" separable from, or merely link (or bind by name) to the interfaces of,\n" +" the Work and Derivative Works thereof.\n" +"\n" +" \"Contribution\" shall mean any work of authorship, including\n" +" the original version of the Work and any modifications or additions\n" +" to that Work or Derivative Works thereof, that is intentionally\n" +" submitted to Licensor for inclusion in the Work by the copyright owner\n" +" or by an individual or Legal Entity authorized to submit on behalf of\n" +" the copyright owner. For the purposes of this definition, \"submitted\"\n" +" means any form of electronic, verbal, or written communication sent\n" +" to the Licensor or its representatives, including but not limited to\n" +" communication on electronic mailing lists, source code control systems,\n" +" and issue tracking systems that are managed by, or on behalf of, the\n" +" Licensor for the purpose of discussing and improving the Work, but\n" +" excluding communication that is conspicuously marked or otherwise\n" +" designated in writing by the copyright owner as \"Not a Contribution.\"\n" +"\n" +" \"Contributor\" shall mean Licensor and any individual or Legal Entity\n" +" on behalf of whom a Contribution has been received by Licensor and\n" +" subsequently incorporated within the Work.\n" +"\n" +"2. Grant of Copyright License. Subject to the terms and conditions of\n" +" this License, each Contributor hereby grants to You a perpetual,\n" +" worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n" +" copyright license to reproduce, prepare Derivative Works of,\n" +" publicly display, publicly perform, sublicense, and distribute the\n" +" Work and such Derivative Works in Source or Object form.\n" +"\n" +"3. Grant of Patent License. Subject to the terms and conditions of\n" +" this License, each Contributor hereby grants to You a perpetual,\n" +" worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n" +" (except as stated in this section) patent license to make, have made,\n" +" use, offer to sell, sell, import, and otherwise transfer the Work,\n" +" where such license applies only to those patent claims licensable\n" +" by such Contributor that are necessarily infringed by their\n" +" Contribution(s) alone or by combination of their Contribution(s)\n" +" with the Work to which such Contribution(s) was submitted. If You\n" +" institute patent litigation against any entity (including a\n" +" cross-claim or counterclaim in a lawsuit) alleging that the Work\n" +" or a Contribution incorporated within the Work constitutes direct\n" +" or contributory patent infringement, then any patent licenses\n" +" granted to You under this License for that Work shall terminate\n" +" as of the date such litigation is filed.\n" +"\n" +"4. Redistribution. You may reproduce and distribute copies of the\n" +" Work or Derivative Works thereof in any medium, with or without\n" +" modifications, and in Source or Object form, provided that You\n" +" meet the following conditions:\n" +"\n" +" (a) You must give any other recipients of the Work or\n" +" Derivative Works a copy of this License; and\n" +"\n" +" (b) You must cause any modified files to carry prominent notices\n" +" stating that You changed the files; and\n" +"\n" +" (c) You must retain, in the Source form of any Derivative Works\n" +" that You distribute, all copyright, patent, trademark, and\n" +" attribution notices from the Source form of the Work,\n" +" excluding those notices that do not pertain to any part of\n" +" the Derivative Works; and\n" +"\n" +" (d) If the Work includes a \"NOTICE\" text file as part of its\n" +" distribution, then any Derivative Works that You distribute must\n" +" include a readable copy of the attribution notices contained\n" +" within such NOTICE file, excluding those notices that do not\n" +" pertain to any part of the Derivative Works, in at least one\n" +" of the following places: within a NOTICE text file distributed\n" +" as part of the Derivative Works; within the Source form or\n" +" documentation, if provided along with the Derivative Works; or,\n" +" within a display generated by the Derivative Works, if and\n" +" wherever such third-party notices normally appear. The contents\n" +" of the NOTICE file are for informational purposes only and\n" +" do not modify the License. You may add Your own attribution\n" +" notices within Derivative Works that You distribute, alongside\n" +" or as an addendum to the NOTICE text from the Work, provided\n" +" that such additional attribution notices cannot be construed\n" +" as modifying the License.\n" +"\n" +" You may add Your own copyright statement to Your modifications and\n" +" may provide additional or different license terms and conditions\n" +" for use, reproduction, or distribution of Your modifications, or\n" +" for any such Derivative Works as a whole, provided Your use,\n" +" reproduction, and distribution of the Work otherwise complies with\n" +" the conditions stated in this License.\n" +"\n" +"5. Submission of Contributions. Unless You explicitly state otherwise,\n" +" any Contribution intentionally submitted for inclusion in the Work\n" +" by You to the Licensor shall be under the terms and conditions of\n" +" this License, without any additional terms or conditions.\n" +" Notwithstanding the above, nothing herein shall supersede or modify\n" +" the terms of any separate license agreement you may have executed\n" +" with Licensor regarding such Contributions.\n" +"\n" +"6. Trademarks. This License does not grant permission to use the trade\n" +" names, trademarks, service marks, or product names of the Licensor,\n" +" except as required for reasonable and customary use in describing the\n" +" origin of the Work and reproducing the content of the NOTICE file.\n" +"\n" +"7. Disclaimer of Warranty. Unless required by applicable law or\n" +" agreed to in writing, Licensor provides the Work (and each\n" +" Contributor provides its Contributions) on an \"AS IS\" BASIS,\n" +" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n" +" implied, including, without limitation, any warranties or conditions\n" +" of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n" +" PARTICULAR PURPOSE. You are solely responsible for determining the\n" +" appropriateness of using or redistributing the Work and assume any\n" +" risks associated with Your exercise of permissions under this License.\n" +"\n" +"8. Limitation of Liability. In no event and under no legal theory,\n" +" whether in tort (including negligence), contract, or otherwise,\n" +" unless required by applicable law (such as deliberate and grossly\n" +" negligent acts) or agreed to in writing, shall any Contributor be\n" +" liable to You for damages, including any direct, indirect, special,\n" +" incidental, or consequential damages of any character arising as a\n" +" result of this License or out of the use or inability to use the\n" +" Work (including but not limited to damages for loss of goodwill,\n" +" work stoppage, computer failure or malfunction, or any and all\n" +" other commercial damages or losses), even if such Contributor\n" +" has been advised of the possibility of such damages.\n" +"\n" +"9. Accepting Warranty or Additional Liability. While redistributing\n" +" the Work or Derivative Works thereof, You may choose to offer,\n" +" and charge a fee for, acceptance of support, warranty, indemnity,\n" +" or other liability obligations and/or rights consistent with this\n" +" License. However, in accepting such obligations, You may act only\n" +" on Your own behalf and on Your sole responsibility, not on behalf\n" +" of any other Contributor, and only if You agree to indemnify,\n" +" defend, and hold each Contributor harmless for any liability\n" +" incurred by, or claims asserted against, such Contributor by reason\n" +" of your accepting any such warranty or additional liability.\n" +"\n" +"END OF TERMS AND CONDITIONS" +msgstr "" +" Apache License\n" +" Version 2.0, January 2004\n" +" https://www.apache.org/licenses/\n" +"\n" +"TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n" +"\n" +"1. Definitions.\n" +"\n" +" \"License\" shall mean the terms and conditions for use, reproduction,\n" +" and distribution as defined by Sections 1 through 9 of this document.\n" +"\n" +" \"Licensor\" shall mean the copyright owner or entity authorized by\n" +" the copyright owner that is granting the License.\n" +"\n" +" \"Legal Entity\" shall mean the union of the acting entity and all\n" +" other entities that control, are controlled by, or are under common\n" +" control with that entity. For the purposes of this definition,\n" +" \"control\" means (i) the power, direct or indirect, to cause the\n" +" direction or management of such entity, whether by contract or\n" +" otherwise, or (ii) ownership of fifty percent (50%) or more of the\n" +" outstanding shares, or (iii) beneficial ownership of such entity.\n" +"\n" +" \"You\" (or \"Your\") shall mean an individual or Legal Entity\n" +" exercising permissions granted by this License.\n" +"\n" +" \"Source\" form shall mean the preferred form for making modifications,\n" +" including but not limited to software source code, documentation\n" +" source, and configuration files.\n" +"\n" +" \"Object\" form shall mean any form resulting from mechanical\n" +" transformation or translation of a Source form, including but\n" +" not limited to compiled object code, generated documentation,\n" +" and conversions to other media types.\n" +"\n" +" \"Work\" shall mean the work of authorship, whether in Source or\n" +" Object form, made available under the License, as indicated by a\n" +" copyright notice that is included in or attached to the work\n" +" (an example is provided in the Appendix below).\n" +"\n" +" \"Derivative Works\" shall mean any work, whether in Source or Object\n" +" form, that is based on (or derived from) the Work and for which the\n" +" editorial revisions, annotations, elaborations, or other modifications\n" +" represent, as a whole, an original work of authorship. For the purposes\n" +" of this License, Derivative Works shall not include works that remain\n" +" separable from, or merely link (or bind by name) to the interfaces of,\n" +" the Work and Derivative Works thereof.\n" +"\n" +" \"Contribution\" shall mean any work of authorship, including\n" +" the original version of the Work and any modifications or additions\n" +" to that Work or Derivative Works thereof, that is intentionally\n" +" submitted to Licensor for inclusion in the Work by the copyright owner\n" +" or by an individual or Legal Entity authorized to submit on behalf of\n" +" the copyright owner. For the purposes of this definition, \"submitted\"\n" +" means any form of electronic, verbal, or written communication sent\n" +" to the Licensor or its representatives, including but not limited to\n" +" communication on electronic mailing lists, source code control systems,\n" +" and issue tracking systems that are managed by, or on behalf of, the\n" +" Licensor for the purpose of discussing and improving the Work, but\n" +" excluding communication that is conspicuously marked or otherwise\n" +" designated in writing by the copyright owner as \"Not a Contribution.\"\n" +"\n" +" \"Contributor\" shall mean Licensor and any individual or Legal Entity\n" +" on behalf of whom a Contribution has been received by Licensor and\n" +" subsequently incorporated within the Work.\n" +"\n" +"2. Grant of Copyright License. Subject to the terms and conditions of\n" +" this License, each Contributor hereby grants to You a perpetual,\n" +" worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n" +" copyright license to reproduce, prepare Derivative Works of,\n" +" publicly display, publicly perform, sublicense, and distribute the\n" +" Work and such Derivative Works in Source or Object form.\n" +"\n" +"3. Grant of Patent License. Subject to the terms and conditions of\n" +" this License, each Contributor hereby grants to You a perpetual,\n" +" worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n" +" (except as stated in this section) patent license to make, have made,\n" +" use, offer to sell, sell, import, and otherwise transfer the Work,\n" +" where such license applies only to those patent claims licensable\n" +" by such Contributor that are necessarily infringed by their\n" +" Contribution(s) alone or by combination of their Contribution(s)\n" +" with the Work to which such Contribution(s) was submitted. If You\n" +" institute patent litigation against any entity (including a\n" +" cross-claim or counterclaim in a lawsuit) alleging that the Work\n" +" or a Contribution incorporated within the Work constitutes direct\n" +" or contributory patent infringement, then any patent licenses\n" +" granted to You under this License for that Work shall terminate\n" +" as of the date such litigation is filed.\n" +"\n" +"4. Redistribution. You may reproduce and distribute copies of the\n" +" Work or Derivative Works thereof in any medium, with or without\n" +" modifications, and in Source or Object form, provided that You\n" +" meet the following conditions:\n" +"\n" +" (a) You must give any other recipients of the Work or\n" +" Derivative Works a copy of this License; and\n" +"\n" +" (b) You must cause any modified files to carry prominent notices\n" +" stating that You changed the files; and\n" +"\n" +" (c) You must retain, in the Source form of any Derivative Works\n" +" that You distribute, all copyright, patent, trademark, and\n" +" attribution notices from the Source form of the Work,\n" +" excluding those notices that do not pertain to any part of\n" +" the Derivative Works; and\n" +"\n" +" (d) If the Work includes a \"NOTICE\" text file as part of its\n" +" distribution, then any Derivative Works that You distribute must\n" +" include a readable copy of the attribution notices contained\n" +" within such NOTICE file, excluding those notices that do not\n" +" pertain to any part of the Derivative Works, in at least one\n" +" of the following places: within a NOTICE text file distributed\n" +" as part of the Derivative Works; within the Source form or\n" +" documentation, if provided along with the Derivative Works; or,\n" +" within a display generated by the Derivative Works, if and\n" +" wherever such third-party notices normally appear. The contents\n" +" of the NOTICE file are for informational purposes only and\n" +" do not modify the License. You may add Your own attribution\n" +" notices within Derivative Works that You distribute, alongside\n" +" or as an addendum to the NOTICE text from the Work, provided\n" +" that such additional attribution notices cannot be construed\n" +" as modifying the License.\n" +"\n" +" You may add Your own copyright statement to Your modifications and\n" +" may provide additional or different license terms and conditions\n" +" for use, reproduction, or distribution of Your modifications, or\n" +" for any such Derivative Works as a whole, provided Your use,\n" +" reproduction, and distribution of the Work otherwise complies with\n" +" the conditions stated in this License.\n" +"\n" +"5. Submission of Contributions. Unless You explicitly state otherwise,\n" +" any Contribution intentionally submitted for inclusion in the Work\n" +" by You to the Licensor shall be under the terms and conditions of\n" +" this License, without any additional terms or conditions.\n" +" Notwithstanding the above, nothing herein shall supersede or modify\n" +" the terms of any separate license agreement you may have executed\n" +" with Licensor regarding such Contributions.\n" +"\n" +"6. Trademarks. This License does not grant permission to use the trade\n" +" names, trademarks, service marks, or product names of the Licensor,\n" +" except as required for reasonable and customary use in describing the\n" +" origin of the Work and reproducing the content of the NOTICE file.\n" +"\n" +"7. Disclaimer of Warranty. Unless required by applicable law or\n" +" agreed to in writing, Licensor provides the Work (and each\n" +" Contributor provides its Contributions) on an \"AS IS\" BASIS,\n" +" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n" +" implied, including, without limitation, any warranties or conditions\n" +" of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n" +" PARTICULAR PURPOSE. You are solely responsible for determining the\n" +" appropriateness of using or redistributing the Work and assume any\n" +" risks associated with Your exercise of permissions under this License.\n" +"\n" +"8. Limitation of Liability. In no event and under no legal theory,\n" +" whether in tort (including negligence), contract, or otherwise,\n" +" unless required by applicable law (such as deliberate and grossly\n" +" negligent acts) or agreed to in writing, shall any Contributor be\n" +" liable to You for damages, including any direct, indirect, special,\n" +" incidental, or consequential damages of any character arising as a\n" +" result of this License or out of the use or inability to use the\n" +" Work (including but not limited to damages for loss of goodwill,\n" +" work stoppage, computer failure or malfunction, or any and all\n" +" other commercial damages or losses), even if such Contributor\n" +" has been advised of the possibility of such damages.\n" +"\n" +"9. Accepting Warranty or Additional Liability. While redistributing\n" +" the Work or Derivative Works thereof, You may choose to offer,\n" +" and charge a fee for, acceptance of support, warranty, indemnity,\n" +" or other liability obligations and/or rights consistent with this\n" +" License. However, in accepting such obligations, You may act only\n" +" on Your own behalf and on Your sole responsibility, not on behalf\n" +" of any other Contributor, and only if You agree to indemnify,\n" +" defend, and hold each Contributor harmless for any liability\n" +" incurred by, or claims asserted against, such Contributor by reason\n" +" of your accepting any such warranty or additional liability.\n" +"\n" +"END OF TERMS AND CONDITIONS" + +#: license.rst:848 msgid "expat" msgstr "expat" -#: license.rst:847 +#: license.rst:850 msgid "" "The :mod:`pyexpat ` extension is built using an included " "copy of the expat sources unless the build is configured ``--with-system-" @@ -469,11 +1955,57 @@ msgstr "" "ένα συμπεριλαμβανόμενο αντίγραφο των πηγών expat, εκτός εάν η έκδοση έχει " "την ρύθμιση ``--with-system-expat``::" -#: license.rst:874 +#: license.rst:853 +msgid "" +"Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n" +" and Clark Cooper\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included\n" +"in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n" +"IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n" +"CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n" +"TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n" +"SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +msgstr "" +"Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n" +" and Clark Cooper\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included\n" +"in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n" +"IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n" +"CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n" +"TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n" +"SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + +#: license.rst:877 msgid "libffi" msgstr "libffi" -#: license.rst:876 +#: license.rst:879 msgid "" "The :mod:`!_ctypes` C extension underlying the :mod:`ctypes` module is built " "using an included copy of the libffi sources unless the build is configured " @@ -483,11 +2015,57 @@ msgstr "" "`ctypes` δημιουργείται χρησιμοποιώντας ένα συμπεριλαμβανόμενο αντίγραφο των " "πηγών libffi, εκτός εάν η έκδοση έχει την ρύθμιση ``--with-system-libffi``::" -#: license.rst:904 +#: license.rst:883 +msgid "" +"Copyright (c) 1996-2008 Red Hat, Inc and others.\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included\n" +"in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n" +"HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n" +"WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n" +"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n" +"DEALINGS IN THE SOFTWARE." +msgstr "" +"Copyright (c) 1996-2008 Red Hat, Inc and others.\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included\n" +"in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n" +"HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n" +"WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n" +"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n" +"DEALINGS IN THE SOFTWARE." + +#: license.rst:907 msgid "zlib" msgstr "zlib" -#: license.rst:906 +#: license.rst:909 msgid "" "The :mod:`zlib` extension is built using an included copy of the zlib " "sources if the zlib version found on the system is too old to be used for " @@ -497,11 +2075,59 @@ msgstr "" "αντίγραφο των πηγών zlib, εάν η έκδοση του zlib που βρίσκεται στο σύστημα " "είναι πολύ παλιά για να χρησιμοποιηθεί για την κατασκευή::" -#: license.rst:935 +#: license.rst:913 +msgid "" +"Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler\n" +"\n" +"This software is provided 'as-is', without any express or implied\n" +"warranty. In no event will the authors be held liable for any damages\n" +"arising from the use of this software.\n" +"\n" +"Permission is granted to anyone to use this software for any purpose,\n" +"including commercial applications, and to alter it and redistribute it\n" +"freely, subject to the following restrictions:\n" +"\n" +"1. The origin of this software must not be misrepresented; you must not\n" +" claim that you wrote the original software. If you use this software\n" +" in a product, an acknowledgment in the product documentation would be\n" +" appreciated but is not required.\n" +"\n" +"2. Altered source versions must be plainly marked as such, and must not be\n" +" misrepresented as being the original software.\n" +"\n" +"3. This notice may not be removed or altered from any source distribution.\n" +"\n" +"Jean-loup Gailly Mark Adler\n" +"jloup@gzip.org madler@alumni.caltech.edu" +msgstr "" +"Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler\n" +"\n" +"This software is provided 'as-is', without any express or implied\n" +"warranty. In no event will the authors be held liable for any damages\n" +"arising from the use of this software.\n" +"\n" +"Permission is granted to anyone to use this software for any purpose,\n" +"including commercial applications, and to alter it and redistribute it\n" +"freely, subject to the following restrictions:\n" +"\n" +"1. The origin of this software must not be misrepresented; you must not\n" +" claim that you wrote the original software. If you use this software\n" +" in a product, an acknowledgment in the product documentation would be\n" +" appreciated but is not required.\n" +"\n" +"2. Altered source versions must be plainly marked as such, and must not be\n" +" misrepresented as being the original software.\n" +"\n" +"3. This notice may not be removed or altered from any source distribution.\n" +"\n" +"Jean-loup Gailly Mark Adler\n" +"jloup@gzip.org madler@alumni.caltech.edu" + +#: license.rst:938 msgid "cfuhash" msgstr "cfuhash" -#: license.rst:937 +#: license.rst:940 msgid "" "The implementation of the hash table used by the :mod:`tracemalloc` is based " "on the cfuhash project::" @@ -509,11 +2135,81 @@ msgstr "" "Η υλοποίηση του πίνακα κατακερματισμού που χρησιμοποιείται από το :mod:" "`tracemalloc` βασίζεται στο έργο cfuhash::" -#: license.rst:976 +#: license.rst:943 +msgid "" +"Copyright (c) 2005 Don Owens\n" +"All rights reserved.\n" +"\n" +"This code is released under the BSD license:\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +" * Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"\n" +" * Redistributions in binary form must reproduce the above\n" +" copyright notice, this list of conditions and the following\n" +" disclaimer in the documentation and/or other materials provided\n" +" with the distribution.\n" +"\n" +" * Neither the name of the author nor the names of its\n" +" contributors may be used to endorse or promote products derived\n" +" from this software without specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" +"\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" +"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n" +"FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n" +"COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n" +"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n" +"(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n" +"SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n" +"STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n" +"ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n" +"OF THE POSSIBILITY OF SUCH DAMAGE." +msgstr "" +"Copyright (c) 2005 Don Owens\n" +"All rights reserved.\n" +"\n" +"This code is released under the BSD license:\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +" * Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"\n" +" * Redistributions in binary form must reproduce the above\n" +" copyright notice, this list of conditions and the following\n" +" disclaimer in the documentation and/or other materials provided\n" +" with the distribution.\n" +"\n" +" * Neither the name of the author nor the names of its\n" +" contributors may be used to endorse or promote products derived\n" +" from this software without specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" +"\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" +"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n" +"FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n" +"COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n" +"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n" +"(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n" +"SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n" +"STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n" +"ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n" +"OF THE POSSIBILITY OF SUCH DAMAGE." + +#: license.rst:979 msgid "libmpdec" msgstr "libmpdec" -#: license.rst:978 +#: license.rst:981 msgid "" "The :mod:`!_decimal` C extension underlying the :mod:`decimal` module is " "built using an included copy of the libmpdec library unless the build is " @@ -524,11 +2220,63 @@ msgstr "" "της βιβλιοθήκης libmpdec, εκτός αν ή έκδοση έχει ρύθμιση ``--with-system-" "libmpdec``::" -#: license.rst:1009 +#: license.rst:985 +msgid "" +"Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE." +msgstr "" +"Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE." + +#: license.rst:1012 msgid "W3C C14N test suite" msgstr "W3C C14N σουίτα δοκιμής" -#: license.rst:1011 +#: license.rst:1014 msgid "" "The C14N 2.0 test suite in the :mod:`test` package (``Lib/test/xmltestdata/" "c14n-20/``) was retrieved from the W3C website at https://www.w3.org/TR/xml-" @@ -538,74 +2286,127 @@ msgstr "" "c14n-20/``) ανακτήθηκε από τον ιστότοπο του W3C https://www.w3.org/TR/xml-" "c14n2-testcases/ και διανέμεται με την άδεια 3 ρήτρων BSD::" -#: license.rst:1046 -msgid "Audioop" -msgstr "Audioop" - -#: license.rst:1048 +#: license.rst:1019 msgid "" -"The audioop module uses the code base in g771.c file of the SoX project. " -"https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" +"Copyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),\n" +"All Rights Reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +"* Redistributions of works must retain the original copyright notice,\n" +" this list of conditions and the following disclaimer.\n" +"* Redistributions in binary form must reproduce the original copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"* Neither the name of the W3C nor the names of its contributors may be\n" +" used to endorse or promote products derived from this work without\n" +" specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" +"\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" +"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" +"A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n" +"OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n" +"SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n" +"LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" +"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" +"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" +"OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." msgstr "" -"Το module audioop χρησιμοποιεί ως βάση κώδικα του αρχείου g771.c του έργου " -"Sox. https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar." -"gz" +"Copyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),\n" +"All Rights Reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +"* Redistributions of works must retain the original copyright notice,\n" +" this list of conditions and the following disclaimer.\n" +"* Redistributions in binary form must reproduce the original copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"* Neither the name of the W3C nor the names of its contributors may be\n" +" used to endorse or promote products derived from this work without\n" +" specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" +"\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" +"LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n" +"A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n" +"OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n" +"SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n" +"LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" +"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" +"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" +"OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." #: license.rst:1051 -msgid "" -"This source code is a product of Sun Microsystems, Inc. and is provided for " -"unrestricted use. Users may copy or modify this source code without charge." -msgstr "" -"Αυτό ο πηγαίος κώδικας είναι προϊόν της Sun Microsystems, Inc. και παρέχεται " -"για απεριόριστη χρήση. Οι χρήστες μπορούν να αντιγράψουν ή να τροποποιήσουν " -"αυτόν τον πηγαίο κώδικα χωρίς χρέωση." - -#: license.rst:1055 -msgid "" -"SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING " -"THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR " -"PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE." -msgstr "" -"Ο ΠΗΓΑΙΟΣ ΚΩΔΙΚΑΣ ΤΟΥ SUN ΠΑΡΕΧΕΤΑΙ ΟΠΩΣ ΕΧΕΙ ΧΩΡΙΣ ΚΑΝΕΝΟΣ ΕΙΔΟΥΣ ΕΓΓΥΗΣΕΙΣ " -"ΣΥΜΠΕΡΙΛΑΜΒΑΝΟΜΕΝΩΝ ΕΓΓΥΗΣΕΩΝ ΣΧΕΔΙΑΣΜΟΥ, ΕΜΠΟΡΕΥΣΙΜΟΤΗΤΑΣ ΚΑΙ " -"ΚΑΤΑΛΛΗΛΟΤΗΤΑΣ ΓΙΑ ΣΥΓΚΕΚΡΙΜΕΝΟ ΣΚΟΠΟ Ή ΠΟΥ ΠΡΟΚΥΠΤΕΙ ΑΠΟ ΚΑΠΟΙΑ ΠΟΡΕΙΑ " -"ΣΥΝΑΛΛΑΓΗΣ, ΧΡΗΣΗΣ Ή ΕΜΠΟΡΙΚΗΣ ΠΡΑΚΤΙΚΗΣ." +msgid "mimalloc" +msgstr "mimalloc" -#: license.rst:1059 -msgid "" -"Sun source code is provided with no support and without any obligation on " -"the part of Sun Microsystems, Inc. to assist in its use, correction, " -"modification or enhancement." -msgstr "" -"Ο πηγαίος κώδικας του Sun παρέχεται χωρίς την υποστήριξη και χωρίς καμία " -"υποχρέωση εκ μέρους της Sun Microsystems, Inc. να βοηθήσει στην χρήση, στη " -"διόρθωση, τροποποίηση ή βελτίωση του." +#: license.rst:1053 +msgid "MIT License::" +msgstr "MIT Άδεια::" -#: license.rst:1063 -msgid "" -"SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE " -"INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE OR " -"ANY PART THEREOF." -msgstr "" -"Η SUN MICROSYSTEMS, INC. ΔΕΝ ΕΧΕΙ ΚΑΜΙΑ ΕΥΘΥΝΗ ΣΧΕΤΙΚΑ ΜΕ ΤΗΝ ΠΑΡΑΒΙΑΣΗ " -"ΠΝΕΥΜΑΤΙΚΩΝ ΔΙΚΑΙΩΜΑΤΩΝ, ΕΜΠΟΡΙΚΩΝ ΑΠΟΡΡΗΤΩΝ Ή ΟΠΟΙΑΔΗΠΟΤΕ ΕΥΡΕΣΙΤΕΧΝΙΑ ΑΠΟ " -"ΑΥΤΟ ΤΟ ΛΟΓΙΣΜΙΚΟ Ή ΟΠΟΙΟΔΗΠΟΤΕ ΜΕΡΟΣ ΑΥΤΟΥ." - -#: license.rst:1067 -msgid "" -"In no event will Sun Microsystems, Inc. be liable for any lost revenue or " -"profits or other special, indirect and consequential damages, even if Sun " -"has been advised of the possibility of such damages." -msgstr "" -"Σε καμία περίπτωση η Sun Microsystems, Inc. δεν φέρει ευθύνη για τυχόν " -"απώλεια εσόδων ή κερδών ή άλλες ειδικές, έμμεσες και επακόλουθες ζημίες, " -"ακόμη και αν η Sun έχει ενημερωθεί για την πιθανότητα τέτοιων ζημιών." - -#: license.rst:1071 +#: license.rst:1055 msgid "" -"Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, California 94043" +"Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining a " +"copy\n" +"of this software and associated documentation files (the \"Software\"), to " +"deal\n" +"in the Software without restriction, including without limitation the " +"rights\n" +"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +"copies of the Software, and to permit persons to whom the Software is\n" +"furnished to do so, subject to the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included in " +"all\n" +"copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " +"OR\n" +"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" +"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" +"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" +"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING " +"FROM,\n" +"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +"THE\n" +"SOFTWARE." msgstr "" -"Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, Καλιφόρνια 94043" +"Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining a " +"copy\n" +"of this software and associated documentation files (the \"Software\"), to " +"deal\n" +"in the Software without restriction, including without limitation the " +"rights\n" +"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +"copies of the Software, and to permit persons to whom the Software is\n" +"furnished to do so, subject to the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included in " +"all\n" +"copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " +"OR\n" +"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" +"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" +"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" +"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING " +"FROM,\n" +"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +"THE\n" +"SOFTWARE." #: license.rst:1077 msgid "asyncio" @@ -620,3 +2421,267 @@ msgstr "" "Μέρη της ενότητας :mod:`asyncio` ενσωματώνονται από το `uvloop 0.16 `_, η οποία διανέμεται με άδεια " "MIT::" + +#: license.rst:1083 +msgid "" +"Copyright (c) 2015-2021 MagicStack Inc. http://magic.io\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +msgstr "" +"Copyright (c) 2015-2021 MagicStack Inc. http://magic.io\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + +#: license.rst:1106 +msgid "Global Unbounded Sequences (GUS)" +msgstr "Καθολικές Απεριόριστες Ακολουθίες (ΚΑΑ)" + +#: license.rst:1108 +msgid "" +"The file :file:`Python/qsbr.c` is adapted from FreeBSD's \"Global Unbounded " +"Sequences\" safe memory reclamation scheme in `subr_smr.c `_. The file is " +"distributed under the 2-Clause BSD License::" +msgstr "" +"Το αρχείο :file:`Python/qsbr.c` είναι προσαρμοσμένο από το σύστημα ασφαλούς " +"ανάκτησης μνήμης \"Global Unbounded Sequences\" του FreeBSD, που υλοποιείται " +"στο `subr_smr.c `_. Το αρχείο διανέμεται υπό την Άδεια 2-Clause BSD::" + +#: license.rst:1113 +msgid "" +"Copyright (c) 2019,2020 Jeffrey Roberson \n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice unmodified, this list of conditions, and the following\n" +" disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR\n" +"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" +"OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" +"IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" +"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" +"NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" +"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" +"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" +"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +msgstr "" +"Copyright (c) 2019,2020 Jeffrey Roberson \n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice unmodified, this list of conditions, and the following\n" +" disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR\n" +"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" +"OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" +"IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" +"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" +"NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" +"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" +"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" +"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + +#: license.rst:1138 +msgid "Zstandard bindings" +msgstr "Δεσμεύσεις Zstandard" + +#: license.rst:1140 +msgid "" +"Zstandard bindings in :file:`Modules/_zstd` and :file:`Lib/compression/zstd` " +"are based on code from the `pyzstd library `_, copyright Ma Lin and contributors. The pyzstd code is " +"distributed under the 3-Clause BSD License::" +msgstr "" +"Οι δεσμεύσεις Zstandard στα :file:`Modules/_zstd` και :file:`Lib/compression/" +"zstd` βασίζονται σε κώδικα από τη βιβλιοθήκη `pyzstd library `_, πνευματικής ιδιοκτησίας του Ma Lin και των " +"συνεργατών του. Ο κώδικας της pyzstd διανέμεται υπό την άδεια 3-Clause BSD." + +#: license.rst:1145 +msgid "" +"Copyright (c) 2020-present, Ma Lin and contributors.\n" +"All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions are met:\n" +"\n" +"1. Redistributions of source code must retain the above copyright notice, " +"this\n" +" list of conditions and the following disclaimer.\n" +"\n" +"2. Redistributions in binary form must reproduce the above copyright " +"notice,\n" +" this list of conditions and the following disclaimer in the " +"documentation\n" +" and/or other materials provided with the distribution.\n" +"\n" +"3. Neither the name of the copyright holder nor the names of its\n" +" contributors may be used to endorse or promote products derived from\n" +" this software without specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS " +"IS\"\n" +"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE " +"ARE\n" +"DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE " +"LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n" +"SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n" +"CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT " +"LIABILITY,\n" +"OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE " +"USE\n" +"OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +msgstr "" +"Copyright (c) 2020-present, Ma Lin and contributors.\n" +"All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions are met:\n" +"\n" +"1. Redistributions of source code must retain the above copyright notice, " +"this\n" +" list of conditions and the following disclaimer.\n" +"\n" +"2. Redistributions in binary form must reproduce the above copyright " +"notice,\n" +" this list of conditions and the following disclaimer in the " +"documentation\n" +" and/or other materials provided with the distribution.\n" +"\n" +"3. Neither the name of the copyright holder nor the names of its\n" +" contributors may be used to endorse or promote products derived from\n" +" this software without specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS " +"IS\"\n" +"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE " +"ARE\n" +"DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE " +"LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n" +"SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n" +"CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT " +"LIABILITY,\n" +"OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE " +"USE\n" +"OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + +#~ msgid "Audioop" +#~ msgstr "Audioop" + +#~ msgid "" +#~ "The audioop module uses the code base in g771.c file of the SoX project. " +#~ "https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" +#~ msgstr "" +#~ "Το module audioop χρησιμοποιεί ως βάση κώδικα του αρχείου g771.c του " +#~ "έργου Sox. https://sourceforge.net/projects/sox/files/sox/12.17.7/" +#~ "sox-12.17.7.tar.gz" + +#~ msgid "" +#~ "This source code is a product of Sun Microsystems, Inc. and is provided " +#~ "for unrestricted use. Users may copy or modify this source code without " +#~ "charge." +#~ msgstr "" +#~ "Αυτό ο πηγαίος κώδικας είναι προϊόν της Sun Microsystems, Inc. και " +#~ "παρέχεται για απεριόριστη χρήση. Οι χρήστες μπορούν να αντιγράψουν ή να " +#~ "τροποποιήσουν αυτόν τον πηγαίο κώδικα χωρίς χρέωση." + +#~ msgid "" +#~ "SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND " +#~ "INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A " +#~ "PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE " +#~ "PRACTICE." +#~ msgstr "" +#~ "Ο ΠΗΓΑΙΟΣ ΚΩΔΙΚΑΣ ΤΟΥ SUN ΠΑΡΕΧΕΤΑΙ ΟΠΩΣ ΕΧΕΙ ΧΩΡΙΣ ΚΑΝΕΝΟΣ ΕΙΔΟΥΣ " +#~ "ΕΓΓΥΗΣΕΙΣ ΣΥΜΠΕΡΙΛΑΜΒΑΝΟΜΕΝΩΝ ΕΓΓΥΗΣΕΩΝ ΣΧΕΔΙΑΣΜΟΥ, ΕΜΠΟΡΕΥΣΙΜΟΤΗΤΑΣ ΚΑΙ " +#~ "ΚΑΤΑΛΛΗΛΟΤΗΤΑΣ ΓΙΑ ΣΥΓΚΕΚΡΙΜΕΝΟ ΣΚΟΠΟ Ή ΠΟΥ ΠΡΟΚΥΠΤΕΙ ΑΠΟ ΚΑΠΟΙΑ ΠΟΡΕΙΑ " +#~ "ΣΥΝΑΛΛΑΓΗΣ, ΧΡΗΣΗΣ Ή ΕΜΠΟΡΙΚΗΣ ΠΡΑΚΤΙΚΗΣ." + +#~ msgid "" +#~ "Sun source code is provided with no support and without any obligation on " +#~ "the part of Sun Microsystems, Inc. to assist in its use, correction, " +#~ "modification or enhancement." +#~ msgstr "" +#~ "Ο πηγαίος κώδικας του Sun παρέχεται χωρίς την υποστήριξη και χωρίς καμία " +#~ "υποχρέωση εκ μέρους της Sun Microsystems, Inc. να βοηθήσει στην χρήση, " +#~ "στη διόρθωση, τροποποίηση ή βελτίωση του." + +#~ msgid "" +#~ "SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE " +#~ "INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE " +#~ "OR ANY PART THEREOF." +#~ msgstr "" +#~ "SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE " +#~ "INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE " +#~ "OR ANY PART THEREOF." + +#~ msgid "" +#~ "In no event will Sun Microsystems, Inc. be liable for any lost revenue or " +#~ "profits or other special, indirect and consequential damages, even if Sun " +#~ "has been advised of the possibility of such damages." +#~ msgstr "" +#~ "Σε καμία περίπτωση η Sun Microsystems, Inc. δεν φέρει ευθύνη για τυχόν " +#~ "απώλεια εσόδων ή κερδών ή άλλες ειδικές, έμμεσες και επακόλουθες ζημίες, " +#~ "ακόμη και αν η Sun έχει ενημερωθεί για την πιθανότητα τέτοιων ζημιών." + +#~ msgid "" +#~ "Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, California 94043" +#~ msgstr "" +#~ "Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, Καλιφόρνια 94043" + +#~ msgid "PSF LICENSE AGREEMENT FOR PYTHON |release|" +#~ msgstr "ΣΥΜΦΩΝΙΑ ΑΔΕΙΑΣ PSF ΓΙΑ ΤΗΝ PYTHON |release|" diff --git a/public/assets/fork-image.png b/public/assets/fork-image.png new file mode 100644 index 00000000..d544fb38 Binary files /dev/null and b/public/assets/fork-image.png differ diff --git a/public/assets/fork_image.jpg b/public/assets/fork_image.jpg deleted file mode 100644 index efb1148d..00000000 Binary files a/public/assets/fork_image.jpg and /dev/null differ diff --git a/public/assets/metadata-po.png b/public/assets/metadata-po.png new file mode 100644 index 00000000..5cb27ce3 Binary files /dev/null and b/public/assets/metadata-po.png differ diff --git a/public/assets/new-issue.png b/public/assets/new-issue.png new file mode 100644 index 00000000..777ce408 Binary files /dev/null and b/public/assets/new-issue.png differ diff --git a/public/assets/pr-description.png b/public/assets/pr-description.png new file mode 100644 index 00000000..5fce7692 Binary files /dev/null and b/public/assets/pr-description.png differ diff --git a/public/assets/pr.png b/public/assets/pr.png new file mode 100644 index 00000000..673e29a8 Binary files /dev/null and b/public/assets/pr.png differ diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 489c5687..0978b547 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -53,6 +54,10 @@ msgid "" "belong::" msgstr "" +#: reference/compound_stmts.rst:37 +msgid "if test1: if test2: print(x)" +msgstr "" + #: reference/compound_stmts.rst:39 msgid "" "Also note that the semicolon binds tighter than the colon in this context, " @@ -60,6 +65,10 @@ msgid "" "calls are executed::" msgstr "" +#: reference/compound_stmts.rst:43 +msgid "if x < y < z: print(x); print(y); print(z)" +msgstr "" + #: reference/compound_stmts.rst:45 msgid "Summarizing:" msgstr "" @@ -135,13 +144,13 @@ msgstr "" #: reference/compound_stmts.rst:160 msgid "" -"The ``starred_list`` expression is evaluated once; it should yield an :term:" -"`iterable` object. An :term:`iterator` is created for that iterable. The " -"first item provided by the iterator is then assigned to the target list " -"using the standard rules for assignments (see :ref:`assignment`), and the " -"suite is executed. This repeats for each item provided by the iterator. " -"When the iterator is exhausted, the suite in the :keyword:`!else` clause, if " -"present, is executed, and the loop terminates." +"The :token:`~python-grammar:starred_expression_list` expression is evaluated " +"once; it should yield an :term:`iterable` object. An :term:`iterator` is " +"created for that iterable. The first item provided by the iterator is then " +"assigned to the target list using the standard rules for assignments (see :" +"ref:`assignment`), and the suite is executed. This repeats for each item " +"provided by the iterator. When the iterator is exhausted, the suite in the :" +"keyword:`!else` clause, if present, is executed, and the loop terminates." msgstr "" #: reference/compound_stmts.rst:173 @@ -160,6 +169,15 @@ msgid "" "in the suite of the for-loop::" msgstr "" +#: reference/compound_stmts.rst:183 +msgid "" +"for i in range(10):\n" +" print(i)\n" +" i = 5 # this will not affect the for-loop\n" +" # because i will be overwritten with the next\n" +" # index in the range" +msgstr "" + #: reference/compound_stmts.rst:193 msgid "" "Names in the target list are not deleted when the loop is finished, but if " @@ -190,11 +208,17 @@ msgid "" "generate exceptions may be found in section :ref:`raise`." msgstr "" -#: reference/compound_stmts.rst:239 -msgid ":keyword:`!except` clause" +#: reference/compound_stmts.rst:235 +msgid "" +"Support for optionally dropping grouping parentheses when using multiple " +"exception types. See :pep:`758`." msgstr "" #: reference/compound_stmts.rst:241 +msgid ":keyword:`!except` clause" +msgstr "" + +#: reference/compound_stmts.rst:243 msgid "" "The :keyword:`!except` clause(s) specify one or more exception handlers. " "When no exception occurs in the :keyword:`try` clause, no exception handler " @@ -202,23 +226,28 @@ msgid "" "for an exception handler is started. This search inspects the :keyword:`!" "except` clauses in turn until one is found that matches the exception. An " "expression-less :keyword:`!except` clause, if present, must be last; it " -"matches any exception. For an :keyword:`!except` clause with an expression, " -"that expression is evaluated, and the clause matches the exception if the " -"resulting object is \"compatible\" with the exception. An object is " -"compatible with an exception if the object is the class or a :term:`non-" -"virtual base class ` of the exception object, or a " -"tuple containing an item that is the class or a non-virtual base class of " -"the exception object." +"matches any exception." msgstr "" -#: reference/compound_stmts.rst:256 +#: reference/compound_stmts.rst:251 +msgid "" +"For an :keyword:`!except` clause with an expression, the expression must " +"evaluate to an exception type or a tuple of exception types. Parentheses can " +"be dropped if multiple exception types are provided and the ``as`` clause is " +"not used. The raised exception matches an :keyword:`!except` clause whose " +"expression evaluates to the class or a :term:`non-virtual base class " +"` of the exception object, or to a tuple that contains " +"such a class." +msgstr "" + +#: reference/compound_stmts.rst:258 msgid "" "If no :keyword:`!except` clause matches the exception, the search for an " "exception handler continues in the surrounding code and on the invocation " "stack. [#]_" msgstr "" -#: reference/compound_stmts.rst:260 +#: reference/compound_stmts.rst:262 msgid "" "If the evaluation of an expression in the header of an :keyword:`!except` " "clause raises an exception, the original search for a handler is canceled " @@ -227,7 +256,7 @@ msgid "" "the exception)." msgstr "" -#: reference/compound_stmts.rst:268 +#: reference/compound_stmts.rst:270 msgid "" "When a matching :keyword:`!except` clause is found, the exception is " "assigned to the target specified after the :keyword:`!as` keyword in that :" @@ -240,17 +269,32 @@ msgid "" "handle the exception.)" msgstr "" -#: reference/compound_stmts.rst:279 +#: reference/compound_stmts.rst:281 msgid "" "When an exception has been assigned using ``as target``, it is cleared at " "the end of the :keyword:`!except` clause. This is as if ::" msgstr "" -#: reference/compound_stmts.rst:285 +#: reference/compound_stmts.rst:284 +msgid "" +"except E as N:\n" +" foo" +msgstr "" + +#: reference/compound_stmts.rst:287 msgid "was translated to ::" msgstr "" -#: reference/compound_stmts.rst:293 +#: reference/compound_stmts.rst:289 +msgid "" +"except E as N:\n" +" try:\n" +" foo\n" +" finally:\n" +" del N" +msgstr "" + +#: reference/compound_stmts.rst:295 msgid "" "This means the exception must be assigned to a different name to be able to " "refer to it after the :keyword:`!except` clause. Exceptions are cleared " @@ -259,7 +303,7 @@ msgid "" "garbage collection occurs." msgstr "" -#: reference/compound_stmts.rst:303 +#: reference/compound_stmts.rst:305 msgid "" "Before an :keyword:`!except` clause's suite is executed, the exception is " "stored in the :mod:`sys` module, where it can be accessed from within the " @@ -268,52 +312,117 @@ msgid "" "is reset to its previous value::" msgstr "" -#: reference/compound_stmts.rst:334 -msgid ":keyword:`!except*` clause" +#: reference/compound_stmts.rst:311 +msgid "" +">>> print(sys.exception())\n" +"None\n" +">>> try:\n" +"... raise TypeError\n" +"... except:\n" +"... print(repr(sys.exception()))\n" +"... try:\n" +"... raise ValueError\n" +"... except:\n" +"... print(repr(sys.exception()))\n" +"... print(repr(sys.exception()))\n" +"...\n" +"TypeError()\n" +"ValueError()\n" +"TypeError()\n" +">>> print(sys.exception())\n" +"None" msgstr "" #: reference/compound_stmts.rst:336 +msgid ":keyword:`!except*` clause" +msgstr "" + +#: reference/compound_stmts.rst:338 msgid "" -"The :keyword:`!except*` clause(s) are used for handling :exc:" -"`ExceptionGroup`\\s. The exception type for matching is interpreted as in " -"the case of :keyword:`except`, but in the case of exception groups we can " -"have partial matches when the type matches some of the exceptions in the " -"group. This means that multiple :keyword:`!except*` clauses can execute, " -"each handling part of the exception group. Each clause executes at most once " -"and handles an exception group of all matching exceptions. Each exception " -"in the group is handled by at most one :keyword:`!except*` clause, the first " -"that matches it. ::" +"The :keyword:`!except*` clause(s) specify one or more handlers for groups of " +"exceptions (:exc:`BaseExceptionGroup` instances). A :keyword:`try` statement " +"can have either :keyword:`except` or :keyword:`!except*` clauses, but not " +"both. The exception type for matching is mandatory in the case of :keyword:`!" +"except*`, so ``except*:`` is a syntax error. The type is interpreted as in " +"the case of :keyword:`!except`, but matching is performed on the exceptions " +"contained in the group that is being handled. An :exc:`TypeError` is raised " +"if a matching type is a subclass of :exc:`!BaseExceptionGroup`, because that " +"would have ambiguous semantics." msgstr "" -#: reference/compound_stmts.rst:364 +#: reference/compound_stmts.rst:348 msgid "" -"Any remaining exceptions that were not handled by any :keyword:`!except*` " -"clause are re-raised at the end, along with all exceptions that were raised " -"from within the :keyword:`!except*` clauses. If this list contains more than " -"one exception to reraise, they are combined into an exception group." +"When an exception group is raised in the try block, each :keyword:`!except*` " +"clause splits (see :meth:`~BaseExceptionGroup.split`) it into the subgroups " +"of matching and non-matching exceptions. If the matching subgroup is not " +"empty, it becomes the handled exception (the value returned from :func:`sys." +"exception`) and assigned to the target of the :keyword:`!except*` clause (if " +"there is one). Then, the body of the :keyword:`!except*` clause executes. If " +"the non-matching subgroup is not empty, it is processed by the next :keyword:" +"`!except*` in the same manner. This continues until all exceptions in the " +"group have been matched, or the last :keyword:`!except*` clause has run." msgstr "" -#: reference/compound_stmts.rst:370 +#: reference/compound_stmts.rst:358 msgid "" -"If the raised exception is not an exception group and its type matches one " -"of the :keyword:`!except*` clauses, it is caught and wrapped by an exception " -"group with an empty message string. ::" +"After all :keyword:`!except*` clauses execute, the group of unhandled " +"exceptions is merged with any exceptions that were raised or re-raised from " +"within :keyword:`!except*` clauses. This merged exception group propagates " +"on.::" +msgstr "" + +#: reference/compound_stmts.rst:362 +msgid "" +">>> try:\n" +"... raise ExceptionGroup(\"eg\",\n" +"... [ValueError(1), TypeError(2), OSError(3), OSError(4)])\n" +"... except* TypeError as e:\n" +"... print(f'caught {type(e)} with nested {e.exceptions}')\n" +"... except* OSError as e:\n" +"... print(f'caught {type(e)} with nested {e.exceptions}')\n" +"...\n" +"caught with nested (TypeError(2),)\n" +"caught with nested (OSError(3), OSError(4))\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 2, in \n" +" | raise ExceptionGroup(\"eg\",\n" +" | [ValueError(1), TypeError(2), OSError(3), OSError(4)])\n" +" | ExceptionGroup: eg (1 sub-exception)\n" +" +-+---------------- 1 ----------------\n" +" | ValueError: 1\n" +" +------------------------------------" msgstr "" #: reference/compound_stmts.rst:381 msgid "" -"An :keyword:`!except*` clause must have a matching type, and this type " -"cannot be a subclass of :exc:`BaseExceptionGroup`. It is not possible to " -"mix :keyword:`except` and :keyword:`!except*` in the same :keyword:`try`. :" -"keyword:`break`, :keyword:`continue` and :keyword:`return` cannot appear in " +"If the exception raised from the :keyword:`try` block is not an exception " +"group and its type matches one of the :keyword:`!except*` clauses, it is " +"caught and wrapped by an exception group with an empty message string. This " +"ensures that the type of the target ``e`` is consistently :exc:" +"`BaseExceptionGroup`::" +msgstr "" + +#: reference/compound_stmts.rst:386 +msgid "" +">>> try:\n" +"... raise BlockingIOError\n" +"... except* BlockingIOError as e:\n" +"... print(repr(e))\n" +"...\n" +"ExceptionGroup('', (BlockingIOError()))" +msgstr "" + +#: reference/compound_stmts.rst:393 +msgid "" +":keyword:`break`, :keyword:`continue` and :keyword:`return` cannot appear in " "an :keyword:`!except*` clause." msgstr "" -#: reference/compound_stmts.rst:398 +#: reference/compound_stmts.rst:406 msgid ":keyword:`!else` clause" msgstr "" -#: reference/compound_stmts.rst:400 +#: reference/compound_stmts.rst:408 msgid "" "The optional :keyword:`!else` clause is executed if the control flow leaves " "the :keyword:`try` suite, no exception was raised, and no :keyword:" @@ -322,31 +431,40 @@ msgid "" "keyword:`except` clauses." msgstr "" -#: reference/compound_stmts.rst:412 +#: reference/compound_stmts.rst:420 msgid ":keyword:`!finally` clause" msgstr "" -#: reference/compound_stmts.rst:414 +#: reference/compound_stmts.rst:422 msgid "" "If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The :" "keyword:`try` clause is executed, including any :keyword:`except` and :" -"keyword:`else` clauses. If an exception occurs in any of the clauses and is " -"not handled, the exception is temporarily saved. The :keyword:`!finally` " -"clause is executed. If there is a saved exception it is re-raised at the " -"end of the :keyword:`!finally` clause. If the :keyword:`!finally` clause " -"raises another exception, the saved exception is set as the context of the " -"new exception. If the :keyword:`!finally` clause executes a :keyword:" -"`return`, :keyword:`break` or :keyword:`continue` statement, the saved " -"exception is discarded::" +"keyword:`else ` clauses. If an exception occurs in any of the " +"clauses and is not handled, the exception is temporarily saved. The :keyword:" +"`!finally` clause is executed. If there is a saved exception it is re-" +"raised at the end of the :keyword:`!finally` clause. If the :keyword:`!" +"finally` clause raises another exception, the saved exception is set as the " +"context of the new exception. If the :keyword:`!finally` clause executes a :" +"keyword:`return`, :keyword:`break` or :keyword:`continue` statement, the " +"saved exception is discarded. For example, this function returns 42." msgstr "" -#: reference/compound_stmts.rst:433 +#: reference/compound_stmts.rst:435 +msgid "" +"def f():\n" +" try:\n" +" 1/0\n" +" finally:\n" +" return 42" +msgstr "" + +#: reference/compound_stmts.rst:443 msgid "" "The exception information is not available to the program during execution " "of the :keyword:`!finally` clause." msgstr "" -#: reference/compound_stmts.rst:441 +#: reference/compound_stmts.rst:451 msgid "" "When a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement " "is executed in the :keyword:`try` suite of a :keyword:`!try`...\\ :keyword:`!" @@ -354,25 +472,42 @@ msgid "" "way out.'" msgstr "" -#: reference/compound_stmts.rst:445 +#: reference/compound_stmts.rst:455 msgid "" "The return value of a function is determined by the last :keyword:`return` " "statement executed. Since the :keyword:`!finally` clause always executes, " "a :keyword:`!return` statement executed in the :keyword:`!finally` clause " -"will always be the last one executed::" +"will always be the last one executed. The following function returns " +"'finally'." msgstr "" -#: reference/compound_stmts.rst:459 +#: reference/compound_stmts.rst:460 +msgid "" +"def foo():\n" +" try:\n" +" return 'try'\n" +" finally:\n" +" return 'finally'" +msgstr "" + +#: reference/compound_stmts.rst:468 msgid "" "Prior to Python 3.8, a :keyword:`continue` statement was illegal in the :" "keyword:`!finally` clause due to a problem with the implementation." msgstr "" -#: reference/compound_stmts.rst:468 +#: reference/compound_stmts.rst:472 +msgid "" +"The compiler emits a :exc:`SyntaxWarning` when a :keyword:`return`, :keyword:" +"`break` or :keyword:`continue` appears in a :keyword:`!finally` block (see :" +"pep:`765`)." +msgstr "" + +#: reference/compound_stmts.rst:482 msgid "The :keyword:`!with` statement" msgstr "" -#: reference/compound_stmts.rst:477 +#: reference/compound_stmts.rst:491 msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " @@ -380,38 +515,38 @@ msgid "" "`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" -#: reference/compound_stmts.rst:487 +#: reference/compound_stmts.rst:501 msgid "" "The execution of the :keyword:`with` statement with one \"item\" proceeds as " "follows:" msgstr "" -#: reference/compound_stmts.rst:489 +#: reference/compound_stmts.rst:503 msgid "" "The context expression (the expression given in the :token:`~python-grammar:" "with_item`) is evaluated to obtain a context manager." msgstr "" -#: reference/compound_stmts.rst:492 +#: reference/compound_stmts.rst:506 msgid "" "The context manager's :meth:`~object.__enter__` is loaded for later use." msgstr "" -#: reference/compound_stmts.rst:494 +#: reference/compound_stmts.rst:508 msgid "The context manager's :meth:`~object.__exit__` is loaded for later use." msgstr "" -#: reference/compound_stmts.rst:496 +#: reference/compound_stmts.rst:510 msgid "The context manager's :meth:`~object.__enter__` method is invoked." msgstr "" -#: reference/compound_stmts.rst:498 +#: reference/compound_stmts.rst:512 msgid "" "If a target was included in the :keyword:`with` statement, the return value " "from :meth:`~object.__enter__` is assigned to it." msgstr "" -#: reference/compound_stmts.rst:503 +#: reference/compound_stmts.rst:517 msgid "" "The :keyword:`with` statement guarantees that if the :meth:`~object." "__enter__` method returns without an error, then :meth:`~object.__exit__` " @@ -420,11 +555,11 @@ msgid "" "suite would be. See step 7 below." msgstr "" -#: reference/compound_stmts.rst:509 +#: reference/compound_stmts.rst:523 msgid "The suite is executed." msgstr "" -#: reference/compound_stmts.rst:511 +#: reference/compound_stmts.rst:525 msgid "" "The context manager's :meth:`~object.__exit__` method is invoked. If an " "exception caused the suite to be exited, its type, value, and traceback are " @@ -432,7 +567,7 @@ msgid "" "`None` arguments are supplied." msgstr "" -#: reference/compound_stmts.rst:516 +#: reference/compound_stmts.rst:530 msgid "" "If the suite was exited due to an exception, and the return value from the :" "meth:`~object.__exit__` method was false, the exception is reraised. If the " @@ -440,115 +575,163 @@ msgid "" "with the statement following the :keyword:`with` statement." msgstr "" -#: reference/compound_stmts.rst:521 +#: reference/compound_stmts.rst:535 msgid "" "If the suite was exited for any reason other than an exception, the return " "value from :meth:`~object.__exit__` is ignored, and execution proceeds at " "the normal location for the kind of exit that was taken." msgstr "" -#: reference/compound_stmts.rst:525 reference/compound_stmts.rst:1540 -#: reference/compound_stmts.rst:1581 +#: reference/compound_stmts.rst:539 reference/compound_stmts.rst:1557 +#: reference/compound_stmts.rst:1598 msgid "The following code::" msgstr "" -#: reference/compound_stmts.rst:530 reference/compound_stmts.rst:555 -#: reference/compound_stmts.rst:1586 +#: reference/compound_stmts.rst:541 +msgid "" +"with EXPRESSION as TARGET:\n" +" SUITE" +msgstr "" + +#: reference/compound_stmts.rst:544 reference/compound_stmts.rst:569 +#: reference/compound_stmts.rst:1603 msgid "is semantically equivalent to::" msgstr "" -#: reference/compound_stmts.rst:549 +#: reference/compound_stmts.rst:546 +msgid "" +"manager = (EXPRESSION)\n" +"enter = type(manager).__enter__\n" +"exit = type(manager).__exit__\n" +"value = enter(manager)\n" +"hit_except = False\n" +"\n" +"try:\n" +" TARGET = value\n" +" SUITE\n" +"except:\n" +" hit_except = True\n" +" if not exit(manager, *sys.exc_info()):\n" +" raise\n" +"finally:\n" +" if not hit_except:\n" +" exit(manager, None, None, None)" +msgstr "" + +#: reference/compound_stmts.rst:563 msgid "" "With more than one item, the context managers are processed as if multiple :" "keyword:`with` statements were nested::" msgstr "" -#: reference/compound_stmts.rst:561 +#: reference/compound_stmts.rst:566 +msgid "" +"with A() as a, B() as b:\n" +" SUITE" +msgstr "" + +#: reference/compound_stmts.rst:571 +msgid "" +"with A() as a:\n" +" with B() as b:\n" +" SUITE" +msgstr "" + +#: reference/compound_stmts.rst:575 msgid "" "You can also write multi-item context managers in multiple lines if the " "items are surrounded by parentheses. For example::" msgstr "" -#: reference/compound_stmts.rst:570 +#: reference/compound_stmts.rst:578 +msgid "" +"with (\n" +" A() as a,\n" +" B() as b,\n" +"):\n" +" SUITE" +msgstr "" + +#: reference/compound_stmts.rst:584 msgid "Support for multiple context expressions." msgstr "" -#: reference/compound_stmts.rst:573 +#: reference/compound_stmts.rst:587 msgid "" "Support for using grouping parentheses to break the statement in multiple " "lines." msgstr "" -#: reference/compound_stmts.rst:579 +#: reference/compound_stmts.rst:592 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: reference/compound_stmts.rst:579 +#: reference/compound_stmts.rst:593 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: reference/compound_stmts.rst:585 +#: reference/compound_stmts.rst:600 msgid "The :keyword:`!match` statement" msgstr "" -#: reference/compound_stmts.rst:599 +#: reference/compound_stmts.rst:614 msgid "The match statement is used for pattern matching. Syntax:" msgstr "" -#: reference/compound_stmts.rst:608 +#: reference/compound_stmts.rst:623 msgid "" "This section uses single quotes to denote :ref:`soft keywords `." msgstr "" -#: reference/compound_stmts.rst:611 +#: reference/compound_stmts.rst:626 msgid "" "Pattern matching takes a pattern as input (following ``case``) and a subject " "value (following ``match``). The pattern (which may contain subpatterns) is " "matched against the subject value. The outcomes are:" msgstr "" -#: reference/compound_stmts.rst:615 +#: reference/compound_stmts.rst:630 msgid "A match success or failure (also termed a pattern success or failure)." msgstr "" -#: reference/compound_stmts.rst:617 +#: reference/compound_stmts.rst:632 msgid "" "Possible binding of matched values to a name. The prerequisites for this " "are further discussed below." msgstr "" -#: reference/compound_stmts.rst:620 +#: reference/compound_stmts.rst:635 msgid "" "The ``match`` and ``case`` keywords are :ref:`soft keywords `." msgstr "" -#: reference/compound_stmts.rst:624 reference/compound_stmts.rst:1181 +#: reference/compound_stmts.rst:639 reference/compound_stmts.rst:1196 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: reference/compound_stmts.rst:625 reference/compound_stmts.rst:1182 +#: reference/compound_stmts.rst:640 reference/compound_stmts.rst:1197 msgid ":pep:`636` -- Structural Pattern Matching: Tutorial" msgstr "" -#: reference/compound_stmts.rst:629 +#: reference/compound_stmts.rst:644 msgid "Overview" msgstr "" -#: reference/compound_stmts.rst:631 +#: reference/compound_stmts.rst:646 msgid "Here's an overview of the logical flow of a match statement:" msgstr "" -#: reference/compound_stmts.rst:634 +#: reference/compound_stmts.rst:649 msgid "" "The subject expression ``subject_expr`` is evaluated and a resulting subject " "value obtained. If the subject expression contains a comma, a tuple is " "constructed using :ref:`the standard rules `." msgstr "" -#: reference/compound_stmts.rst:638 +#: reference/compound_stmts.rst:653 msgid "" "Each pattern in a ``case_block`` is attempted to match with the subject " "value. The specific rules for success or failure are described below. The " @@ -558,7 +741,7 @@ msgid "" "outlive the executed block and can be used after the match statement**." msgstr "" -#: reference/compound_stmts.rst:647 +#: reference/compound_stmts.rst:662 msgid "" "During failed pattern matches, some subpatterns may succeed. Do not rely on " "bindings being made for a failed match. Conversely, do not rely on " @@ -567,87 +750,103 @@ msgid "" "made to allow different implementations to add optimizations." msgstr "" -#: reference/compound_stmts.rst:654 +#: reference/compound_stmts.rst:669 msgid "" "If the pattern succeeds, the corresponding guard (if present) is evaluated. " "In this case all name bindings are guaranteed to have happened." msgstr "" -#: reference/compound_stmts.rst:657 +#: reference/compound_stmts.rst:672 msgid "" "If the guard evaluates as true or is missing, the ``block`` inside " "``case_block`` is executed." msgstr "" -#: reference/compound_stmts.rst:660 +#: reference/compound_stmts.rst:675 msgid "Otherwise, the next ``case_block`` is attempted as described above." msgstr "" -#: reference/compound_stmts.rst:662 +#: reference/compound_stmts.rst:677 msgid "If there are no further case blocks, the match statement is completed." msgstr "" -#: reference/compound_stmts.rst:666 +#: reference/compound_stmts.rst:681 msgid "" "Users should generally never rely on a pattern being evaluated. Depending " "on implementation, the interpreter may cache values or use other " "optimizations which skip repeated evaluations." msgstr "" -#: reference/compound_stmts.rst:670 +#: reference/compound_stmts.rst:685 msgid "A sample match statement::" msgstr "" -#: reference/compound_stmts.rst:686 +#: reference/compound_stmts.rst:687 +msgid "" +">>> flag = False\n" +">>> match (100, 200):\n" +"... case (100, 300): # Mismatch: 200 != 300\n" +"... print('Case 1')\n" +"... case (100, 200) if flag: # Successful match, but guard fails\n" +"... print('Case 2')\n" +"... case (100, y): # Matches and binds y to 200\n" +"... print(f'Case 3, y: {y}')\n" +"... case _: # Pattern not attempted\n" +"... print('Case 4, I match anything!')\n" +"...\n" +"Case 3, y: 200" +msgstr "" + +#: reference/compound_stmts.rst:701 msgid "" "In this case, ``if flag`` is a guard. Read more about that in the next " "section." msgstr "" -#: reference/compound_stmts.rst:689 +#: reference/compound_stmts.rst:704 msgid "Guards" msgstr "" -#: reference/compound_stmts.rst:696 +#: reference/compound_stmts.rst:711 msgid "" "A ``guard`` (which is part of the ``case``) must succeed for code inside the " "``case`` block to execute. It takes the form: :keyword:`if` followed by an " "expression." msgstr "" -#: reference/compound_stmts.rst:701 +#: reference/compound_stmts.rst:716 msgid "The logical flow of a ``case`` block with a ``guard`` follows:" msgstr "" -#: reference/compound_stmts.rst:703 +#: reference/compound_stmts.rst:718 msgid "" "Check that the pattern in the ``case`` block succeeded. If the pattern " "failed, the ``guard`` is not evaluated and the next ``case`` block is " "checked." msgstr "" -#: reference/compound_stmts.rst:707 +#: reference/compound_stmts.rst:722 msgid "If the pattern succeeded, evaluate the ``guard``." msgstr "" -#: reference/compound_stmts.rst:709 +#: reference/compound_stmts.rst:724 msgid "" "If the ``guard`` condition evaluates as true, the case block is selected." msgstr "" -#: reference/compound_stmts.rst:712 +#: reference/compound_stmts.rst:727 msgid "" "If the ``guard`` condition evaluates as false, the case block is not " "selected." msgstr "" -#: reference/compound_stmts.rst:715 +#: reference/compound_stmts.rst:730 msgid "" "If the ``guard`` raises an exception during evaluation, the exception " "bubbles up." msgstr "" -#: reference/compound_stmts.rst:718 +#: reference/compound_stmts.rst:733 msgid "" "Guards are allowed to have side effects as they are expressions. Guard " "evaluation must proceed from the first to the last case block, one at a " @@ -656,17 +855,17 @@ msgid "" "block is selected." msgstr "" -#: reference/compound_stmts.rst:728 +#: reference/compound_stmts.rst:743 msgid "Irrefutable Case Blocks" msgstr "" -#: reference/compound_stmts.rst:732 +#: reference/compound_stmts.rst:747 msgid "" "An irrefutable case block is a match-all case block. A match statement may " "have at most one irrefutable case block, and it must be last." msgstr "" -#: reference/compound_stmts.rst:735 +#: reference/compound_stmts.rst:750 msgid "" "A case block is considered irrefutable if it has no guard and its pattern is " "irrefutable. A pattern is considered irrefutable if we can prove from its " @@ -674,47 +873,47 @@ msgid "" "irrefutable:" msgstr "" -#: reference/compound_stmts.rst:740 +#: reference/compound_stmts.rst:755 msgid ":ref:`as-patterns` whose left-hand side is irrefutable" msgstr "" -#: reference/compound_stmts.rst:742 +#: reference/compound_stmts.rst:757 msgid ":ref:`or-patterns` containing at least one irrefutable pattern" msgstr "" -#: reference/compound_stmts.rst:744 +#: reference/compound_stmts.rst:759 msgid ":ref:`capture-patterns`" msgstr "" -#: reference/compound_stmts.rst:746 +#: reference/compound_stmts.rst:761 msgid ":ref:`wildcard-patterns`" msgstr "" -#: reference/compound_stmts.rst:748 +#: reference/compound_stmts.rst:763 msgid "parenthesized irrefutable patterns" msgstr "" -#: reference/compound_stmts.rst:752 +#: reference/compound_stmts.rst:767 msgid "Patterns" msgstr "" -#: reference/compound_stmts.rst:759 +#: reference/compound_stmts.rst:774 msgid "This section uses grammar notations beyond standard EBNF:" msgstr "" -#: reference/compound_stmts.rst:761 +#: reference/compound_stmts.rst:776 msgid "the notation ``SEP.RULE+`` is shorthand for ``RULE (SEP RULE)*``" msgstr "" -#: reference/compound_stmts.rst:763 +#: reference/compound_stmts.rst:778 msgid "the notation ``!RULE`` is shorthand for a negative lookahead assertion" msgstr "" -#: reference/compound_stmts.rst:766 +#: reference/compound_stmts.rst:781 msgid "The top-level syntax for ``patterns`` is:" msgstr "" -#: reference/compound_stmts.rst:780 +#: reference/compound_stmts.rst:795 msgid "" "The descriptions below will include a description \"in simple terms\" of " "what a pattern does for illustration purposes (credits to Raymond Hettinger " @@ -724,113 +923,113 @@ msgid "" "forms." msgstr "" -#: reference/compound_stmts.rst:790 +#: reference/compound_stmts.rst:805 msgid "OR Patterns" msgstr "" -#: reference/compound_stmts.rst:792 +#: reference/compound_stmts.rst:807 msgid "" "An OR pattern is two or more patterns separated by vertical bars ``|``. " "Syntax:" msgstr "" -#: reference/compound_stmts.rst:798 +#: reference/compound_stmts.rst:813 msgid "" "Only the final subpattern may be :ref:`irrefutable `, and " "each subpattern must bind the same set of names to avoid ambiguity." msgstr "" -#: reference/compound_stmts.rst:801 +#: reference/compound_stmts.rst:816 msgid "" "An OR pattern matches each of its subpatterns in turn to the subject value, " "until one succeeds. The OR pattern is then considered successful. " "Otherwise, if none of the subpatterns succeed, the OR pattern fails." msgstr "" -#: reference/compound_stmts.rst:805 +#: reference/compound_stmts.rst:820 msgid "" "In simple terms, ``P1 | P2 | ...`` will try to match ``P1``, if it fails it " "will try to match ``P2``, succeeding immediately if any succeeds, failing " "otherwise." msgstr "" -#: reference/compound_stmts.rst:811 +#: reference/compound_stmts.rst:826 msgid "AS Patterns" msgstr "" -#: reference/compound_stmts.rst:813 +#: reference/compound_stmts.rst:828 msgid "" "An AS pattern matches an OR pattern on the left of the :keyword:`as` keyword " "against a subject. Syntax:" msgstr "" -#: reference/compound_stmts.rst:819 +#: reference/compound_stmts.rst:834 msgid "" "If the OR pattern fails, the AS pattern fails. Otherwise, the AS pattern " "binds the subject to the name on the right of the as keyword and succeeds. " "``capture_pattern`` cannot be a ``_``." msgstr "" -#: reference/compound_stmts.rst:823 +#: reference/compound_stmts.rst:838 msgid "" "In simple terms ``P as NAME`` will match with ``P``, and on success it will " "set ``NAME = ``." msgstr "" -#: reference/compound_stmts.rst:830 +#: reference/compound_stmts.rst:845 msgid "Literal Patterns" msgstr "" -#: reference/compound_stmts.rst:832 +#: reference/compound_stmts.rst:847 msgid "" "A literal pattern corresponds to most :ref:`literals ` in Python. " "Syntax:" msgstr "" -#: reference/compound_stmts.rst:845 +#: reference/compound_stmts.rst:860 msgid "" "The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" "`standard Python grammar <./grammar>`. Triple-quoted strings are " "supported. Raw strings and byte strings are supported. :ref:`f-strings` " -"are not supported." +"and :ref:`t-strings` are not supported." msgstr "" -#: reference/compound_stmts.rst:850 +#: reference/compound_stmts.rst:865 msgid "" "The forms ``signed_number '+' NUMBER`` and ``signed_number '-' NUMBER`` are " "for expressing :ref:`complex numbers `; they require a real " "number on the left and an imaginary number on the right. E.g. ``3 + 4j``." msgstr "" -#: reference/compound_stmts.rst:854 +#: reference/compound_stmts.rst:869 msgid "" "In simple terms, ``LITERAL`` will succeed only if `` == LITERAL``. " "For the singletons ``None``, ``True`` and ``False``, the :keyword:`is` " "operator is used." msgstr "" -#: reference/compound_stmts.rst:860 +#: reference/compound_stmts.rst:875 msgid "Capture Patterns" msgstr "" -#: reference/compound_stmts.rst:862 +#: reference/compound_stmts.rst:877 msgid "A capture pattern binds the subject value to a name. Syntax:" msgstr "" -#: reference/compound_stmts.rst:868 +#: reference/compound_stmts.rst:883 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " "expresses). It is instead treated as a :token:`~python-grammar:" "wildcard_pattern`." msgstr "" -#: reference/compound_stmts.rst:872 +#: reference/compound_stmts.rst:887 msgid "" "In a given pattern, a given name can only be bound once. E.g. ``case x, " "x: ...`` is invalid while ``case [x] | x: ...`` is allowed." msgstr "" -#: reference/compound_stmts.rst:875 +#: reference/compound_stmts.rst:890 msgid "" "Capture patterns always succeed. The binding follows scoping rules " "established by the assignment expression operator in :pep:`572`; the name " @@ -838,55 +1037,55 @@ msgid "" "there's an applicable :keyword:`global` or :keyword:`nonlocal` statement." msgstr "" -#: reference/compound_stmts.rst:880 +#: reference/compound_stmts.rst:895 msgid "" "In simple terms ``NAME`` will always succeed and it will set ``NAME = " "``." msgstr "" -#: reference/compound_stmts.rst:885 +#: reference/compound_stmts.rst:900 msgid "Wildcard Patterns" msgstr "" -#: reference/compound_stmts.rst:887 +#: reference/compound_stmts.rst:902 msgid "" "A wildcard pattern always succeeds (matches anything) and binds no name. " "Syntax:" msgstr "" -#: reference/compound_stmts.rst:893 +#: reference/compound_stmts.rst:908 msgid "" "``_`` is a :ref:`soft keyword ` within any pattern, but only " "within patterns. It is an identifier, as usual, even within ``match`` " "subject expressions, ``guard``\\ s, and ``case`` blocks." msgstr "" -#: reference/compound_stmts.rst:897 +#: reference/compound_stmts.rst:912 msgid "In simple terms, ``_`` will always succeed." msgstr "" -#: reference/compound_stmts.rst:902 +#: reference/compound_stmts.rst:917 msgid "Value Patterns" msgstr "" -#: reference/compound_stmts.rst:904 +#: reference/compound_stmts.rst:919 msgid "A value pattern represents a named value in Python. Syntax:" msgstr "" -#: reference/compound_stmts.rst:912 +#: reference/compound_stmts.rst:927 msgid "" "The dotted name in the pattern is looked up using standard Python :ref:`name " "resolution rules `. The pattern succeeds if the value found " "compares equal to the subject value (using the ``==`` equality operator)." msgstr "" -#: reference/compound_stmts.rst:917 +#: reference/compound_stmts.rst:932 msgid "" "In simple terms ``NAME1.NAME2`` will succeed only if `` == NAME1." "NAME2``" msgstr "" -#: reference/compound_stmts.rst:921 +#: reference/compound_stmts.rst:936 msgid "" "If the same value occurs multiple times in the same match statement, the " "interpreter may cache the first value found and reuse it rather than repeat " @@ -894,44 +1093,44 @@ msgid "" "given match statement." msgstr "" -#: reference/compound_stmts.rst:929 +#: reference/compound_stmts.rst:944 msgid "Group Patterns" msgstr "" -#: reference/compound_stmts.rst:931 +#: reference/compound_stmts.rst:946 msgid "" "A group pattern allows users to add parentheses around patterns to emphasize " "the intended grouping. Otherwise, it has no additional syntax. Syntax:" msgstr "" -#: reference/compound_stmts.rst:938 +#: reference/compound_stmts.rst:953 msgid "In simple terms ``(P)`` has the same effect as ``P``." msgstr "" -#: reference/compound_stmts.rst:943 +#: reference/compound_stmts.rst:958 msgid "Sequence Patterns" msgstr "" -#: reference/compound_stmts.rst:945 +#: reference/compound_stmts.rst:960 msgid "" "A sequence pattern contains several subpatterns to be matched against " "sequence elements. The syntax is similar to the unpacking of a list or tuple." msgstr "" -#: reference/compound_stmts.rst:956 +#: reference/compound_stmts.rst:971 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" -#: reference/compound_stmts.rst:960 +#: reference/compound_stmts.rst:975 msgid "" "A single pattern enclosed in parentheses without a trailing comma (e.g. ``(3 " "| 4)``) is a :ref:`group pattern `. While a single pattern " "enclosed in square brackets (e.g. ``[3 | 4]``) is still a sequence pattern." msgstr "" -#: reference/compound_stmts.rst:965 +#: reference/compound_stmts.rst:980 msgid "" "At most one star subpattern may be in a sequence pattern. The star " "subpattern may occur in any position. If no star subpattern is present, the " @@ -939,40 +1138,40 @@ msgid "" "variable-length sequence pattern." msgstr "" -#: reference/compound_stmts.rst:970 +#: reference/compound_stmts.rst:985 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" -#: reference/compound_stmts.rst:973 +#: reference/compound_stmts.rst:988 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" -#: reference/compound_stmts.rst:976 +#: reference/compound_stmts.rst:991 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" -#: reference/compound_stmts.rst:979 +#: reference/compound_stmts.rst:994 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." msgstr "" -#: reference/compound_stmts.rst:982 +#: reference/compound_stmts.rst:997 msgid "If the sequence pattern is fixed-length:" msgstr "" -#: reference/compound_stmts.rst:984 +#: reference/compound_stmts.rst:999 msgid "" "If the length of the subject sequence is not equal to the number of " "subpatterns, the sequence pattern fails" msgstr "" -#: reference/compound_stmts.rst:987 +#: reference/compound_stmts.rst:1002 msgid "" "Subpatterns in the sequence pattern are matched to their corresponding items " "in the subject sequence from left to right. Matching stops as soon as a " @@ -980,373 +1179,369 @@ msgid "" "corresponding item, the sequence pattern succeeds." msgstr "" -#: reference/compound_stmts.rst:992 +#: reference/compound_stmts.rst:1007 msgid "Otherwise, if the sequence pattern is variable-length:" msgstr "" -#: reference/compound_stmts.rst:994 +#: reference/compound_stmts.rst:1009 msgid "" "If the length of the subject sequence is less than the number of non-star " "subpatterns, the sequence pattern fails." msgstr "" -#: reference/compound_stmts.rst:997 +#: reference/compound_stmts.rst:1012 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" -#: reference/compound_stmts.rst:1000 +#: reference/compound_stmts.rst:1015 msgid "" "If the previous step succeeds, the star subpattern matches a list formed of " "the remaining subject items, excluding the remaining items corresponding to " "non-star subpatterns following the star subpattern." msgstr "" -#: reference/compound_stmts.rst:1004 +#: reference/compound_stmts.rst:1019 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" -#: reference/compound_stmts.rst:1007 +#: reference/compound_stmts.rst:1022 msgid "" "The length of the subject sequence is obtained via :func:`len` (i.e. via " -"the :meth:`__len__` protocol). This length may be cached by the interpreter " -"in a similar manner as :ref:`value patterns `." +"the :meth:`~object.__len__` protocol). This length may be cached by the " +"interpreter in a similar manner as :ref:`value patterns `." msgstr "" -#: reference/compound_stmts.rst:1013 +#: reference/compound_stmts.rst:1028 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P]`` matches only if all the " "following happens:" msgstr "" -#: reference/compound_stmts.rst:1016 +#: reference/compound_stmts.rst:1031 msgid "check ```` is a sequence" msgstr "" -#: reference/compound_stmts.rst:1017 +#: reference/compound_stmts.rst:1032 msgid "``len(subject) == ``" msgstr "" -#: reference/compound_stmts.rst:1018 +#: reference/compound_stmts.rst:1033 msgid "" "``P1`` matches ``[0]`` (note that this match can also bind names)" msgstr "" -#: reference/compound_stmts.rst:1019 +#: reference/compound_stmts.rst:1034 msgid "" "``P2`` matches ``[1]`` (note that this match can also bind names)" msgstr "" -#: reference/compound_stmts.rst:1020 +#: reference/compound_stmts.rst:1035 msgid "... and so on for the corresponding pattern/element." msgstr "" -#: reference/compound_stmts.rst:1025 +#: reference/compound_stmts.rst:1040 msgid "Mapping Patterns" msgstr "" -#: reference/compound_stmts.rst:1027 +#: reference/compound_stmts.rst:1042 msgid "" "A mapping pattern contains one or more key-value patterns. The syntax is " "similar to the construction of a dictionary. Syntax:" msgstr "" -#: reference/compound_stmts.rst:1038 +#: reference/compound_stmts.rst:1053 msgid "" "At most one double star pattern may be in a mapping pattern. The double " "star pattern must be the last subpattern in the mapping pattern." msgstr "" -#: reference/compound_stmts.rst:1041 +#: reference/compound_stmts.rst:1056 msgid "" "Duplicate keys in mapping patterns are disallowed. Duplicate literal keys " "will raise a :exc:`SyntaxError`. Two keys that otherwise have the same value " "will raise a :exc:`ValueError` at runtime." msgstr "" -#: reference/compound_stmts.rst:1045 +#: reference/compound_stmts.rst:1060 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" -#: reference/compound_stmts.rst:1048 +#: reference/compound_stmts.rst:1063 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" -#: reference/compound_stmts.rst:1050 +#: reference/compound_stmts.rst:1065 msgid "" "If every key given in the mapping pattern is present in the subject mapping, " "and the pattern for each key matches the corresponding item of the subject " "mapping, the mapping pattern succeeds." msgstr "" -#: reference/compound_stmts.rst:1054 +#: reference/compound_stmts.rst:1069 msgid "" "If duplicate keys are detected in the mapping pattern, the pattern is " "considered invalid. A :exc:`SyntaxError` is raised for duplicate literal " "values; or a :exc:`ValueError` for named keys of the same value." msgstr "" -#: reference/compound_stmts.rst:1058 +#: reference/compound_stmts.rst:1073 msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " -"in the mapping, and not created on-the-fly via :meth:`__missing__` or :meth:" -"`~object.__getitem__`." +"in the mapping, and not created on-the-fly via :meth:`~object.__missing__` " +"or :meth:`~object.__getitem__`." msgstr "" -#: reference/compound_stmts.rst:1063 +#: reference/compound_stmts.rst:1078 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" -#: reference/compound_stmts.rst:1066 +#: reference/compound_stmts.rst:1081 msgid "check ```` is a mapping" msgstr "" -#: reference/compound_stmts.rst:1067 +#: reference/compound_stmts.rst:1082 msgid "``KEY1 in ``" msgstr "" -#: reference/compound_stmts.rst:1068 +#: reference/compound_stmts.rst:1083 msgid "``P1`` matches ``[KEY1]``" msgstr "" -#: reference/compound_stmts.rst:1069 +#: reference/compound_stmts.rst:1084 msgid "... and so on for the corresponding KEY/pattern pair." msgstr "" -#: reference/compound_stmts.rst:1075 +#: reference/compound_stmts.rst:1090 msgid "Class Patterns" msgstr "" -#: reference/compound_stmts.rst:1077 +#: reference/compound_stmts.rst:1092 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" -#: reference/compound_stmts.rst:1088 +#: reference/compound_stmts.rst:1103 msgid "The same keyword should not be repeated in class patterns." msgstr "" -#: reference/compound_stmts.rst:1090 +#: reference/compound_stmts.rst:1105 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" -#: reference/compound_stmts.rst:1093 +#: reference/compound_stmts.rst:1108 msgid "" "If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" "exc:`TypeError`." msgstr "" -#: reference/compound_stmts.rst:1096 +#: reference/compound_stmts.rst:1111 msgid "" "If the subject value is not an instance of ``name_or_attr`` (tested via :" "func:`isinstance`), the class pattern fails." msgstr "" -#: reference/compound_stmts.rst:1099 +#: reference/compound_stmts.rst:1114 msgid "" "If no pattern arguments are present, the pattern succeeds. Otherwise, the " "subsequent steps depend on whether keyword or positional argument patterns " "are present." msgstr "" -#: reference/compound_stmts.rst:1103 +#: reference/compound_stmts.rst:1118 msgid "" "For a number of built-in types (specified below), a single positional " "subpattern is accepted which will match the entire subject; for these types " "keyword patterns also work as for other types." msgstr "" -#: reference/compound_stmts.rst:1107 +#: reference/compound_stmts.rst:1122 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" msgstr "" -#: reference/compound_stmts.rst:1110 -msgid "I. The keyword is looked up as an attribute on the subject." +#: reference/compound_stmts.rst:1125 +msgid "The keyword is looked up as an attribute on the subject." msgstr "" -#: reference/compound_stmts.rst:1112 +#: reference/compound_stmts.rst:1127 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" -#: reference/compound_stmts.rst:1115 +#: reference/compound_stmts.rst:1130 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" -#: reference/compound_stmts.rst:1117 +#: reference/compound_stmts.rst:1132 msgid "" "Else, the subpattern associated with the keyword pattern is matched against " "the subject's attribute value. If this fails, the class pattern fails; if " "this succeeds, the match proceeds to the next keyword." msgstr "" -#: reference/compound_stmts.rst:1122 -msgid "II. If all keyword patterns succeed, the class pattern succeeds." +#: reference/compound_stmts.rst:1137 +msgid "If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: reference/compound_stmts.rst:1124 +#: reference/compound_stmts.rst:1139 msgid "" "If any positional patterns are present, they are converted to keyword " "patterns using the :data:`~object.__match_args__` attribute on the class " "``name_or_attr`` before matching:" msgstr "" -#: reference/compound_stmts.rst:1128 -msgid "" -"I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." +#: reference/compound_stmts.rst:1143 +msgid "The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: reference/compound_stmts.rst:1130 +#: reference/compound_stmts.rst:1145 msgid "If this raises an exception, the exception bubbles up." msgstr "" -#: reference/compound_stmts.rst:1132 +#: reference/compound_stmts.rst:1147 msgid "" "If the returned value is not a tuple, the conversion fails and :exc:" "`TypeError` is raised." msgstr "" -#: reference/compound_stmts.rst:1135 +#: reference/compound_stmts.rst:1150 msgid "" "If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" "`TypeError` is raised." msgstr "" -#: reference/compound_stmts.rst:1138 +#: reference/compound_stmts.rst:1153 msgid "" "Otherwise, positional pattern ``i`` is converted to a keyword pattern using " "``__match_args__[i]`` as the keyword. ``__match_args__[i]`` must be a " "string; if not :exc:`TypeError` is raised." msgstr "" -#: reference/compound_stmts.rst:1142 +#: reference/compound_stmts.rst:1157 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." msgstr "" -#: reference/compound_stmts.rst:1144 +#: reference/compound_stmts.rst:1159 msgid ":ref:`class-pattern-matching`" msgstr "" -#: reference/compound_stmts.rst:1147 +#: reference/compound_stmts.rst:1161 msgid "" -"II. Once all positional patterns have been converted to keyword patterns," -msgstr "" - -#: reference/compound_stmts.rst:1147 -msgid "the match proceeds as if there were only keyword patterns." +"Once all positional patterns have been converted to keyword patterns, the " +"match proceeds as if there were only keyword patterns." msgstr "" -#: reference/compound_stmts.rst:1149 +#: reference/compound_stmts.rst:1164 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" msgstr "" -#: reference/compound_stmts.rst:1152 +#: reference/compound_stmts.rst:1167 msgid ":class:`bool`" msgstr "" -#: reference/compound_stmts.rst:1153 +#: reference/compound_stmts.rst:1168 msgid ":class:`bytearray`" msgstr "" -#: reference/compound_stmts.rst:1154 +#: reference/compound_stmts.rst:1169 msgid ":class:`bytes`" msgstr "" -#: reference/compound_stmts.rst:1155 +#: reference/compound_stmts.rst:1170 msgid ":class:`dict`" msgstr "" -#: reference/compound_stmts.rst:1156 +#: reference/compound_stmts.rst:1171 msgid ":class:`float`" msgstr "" -#: reference/compound_stmts.rst:1157 +#: reference/compound_stmts.rst:1172 msgid ":class:`frozenset`" msgstr "" -#: reference/compound_stmts.rst:1158 +#: reference/compound_stmts.rst:1173 msgid ":class:`int`" msgstr "" -#: reference/compound_stmts.rst:1159 reference/compound_stmts.rst:1856 +#: reference/compound_stmts.rst:1174 reference/compound_stmts.rst:1932 msgid ":class:`list`" msgstr "" -#: reference/compound_stmts.rst:1160 +#: reference/compound_stmts.rst:1175 msgid ":class:`set`" msgstr "" -#: reference/compound_stmts.rst:1161 +#: reference/compound_stmts.rst:1176 msgid ":class:`str`" msgstr "" -#: reference/compound_stmts.rst:1162 reference/compound_stmts.rst:1859 +#: reference/compound_stmts.rst:1177 reference/compound_stmts.rst:1935 msgid ":class:`tuple`" msgstr "" -#: reference/compound_stmts.rst:1164 +#: reference/compound_stmts.rst:1179 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " "``int(0|1)`` matches the value ``0``, but not the value ``0.0``." msgstr "" -#: reference/compound_stmts.rst:1168 +#: reference/compound_stmts.rst:1183 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" -#: reference/compound_stmts.rst:1170 +#: reference/compound_stmts.rst:1185 msgid "``isinstance(, CLS)``" msgstr "" -#: reference/compound_stmts.rst:1171 +#: reference/compound_stmts.rst:1186 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" msgstr "" -#: reference/compound_stmts.rst:1172 +#: reference/compound_stmts.rst:1187 msgid "For each keyword argument ``attr=P2``:" msgstr "" -#: reference/compound_stmts.rst:1174 +#: reference/compound_stmts.rst:1189 msgid "``hasattr(, \"attr\")``" msgstr "" -#: reference/compound_stmts.rst:1175 +#: reference/compound_stmts.rst:1190 msgid "``P2`` matches ``.attr``" msgstr "" -#: reference/compound_stmts.rst:1177 +#: reference/compound_stmts.rst:1192 msgid "... and so on for the corresponding keyword argument/pattern pair." msgstr "" -#: reference/compound_stmts.rst:1192 +#: reference/compound_stmts.rst:1207 msgid "Function definitions" msgstr "" -#: reference/compound_stmts.rst:1207 +#: reference/compound_stmts.rst:1222 msgid "" "A function definition defines a user-defined function object (see section :" "ref:`types`):" msgstr "" -#: reference/compound_stmts.rst:1226 +#: reference/compound_stmts.rst:1244 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1355,13 +1550,13 @@ msgid "" "used when the function is called." msgstr "" -#: reference/compound_stmts.rst:1232 +#: reference/compound_stmts.rst:1250 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: reference/compound_stmts.rst:1238 +#: reference/compound_stmts.rst:1256 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1372,24 +1567,37 @@ msgid "" "example, the following code ::" msgstr "" -#: reference/compound_stmts.rst:1249 reference/compound_stmts.rst:1439 +#: reference/compound_stmts.rst:1263 +msgid "" +"@f1(arg)\n" +"@f2\n" +"def func(): pass" +msgstr "" + +#: reference/compound_stmts.rst:1267 reference/compound_stmts.rst:1456 msgid "is roughly equivalent to ::" msgstr "" -#: reference/compound_stmts.rst:1254 +#: reference/compound_stmts.rst:1269 +msgid "" +"def func(): pass\n" +"func = f1(arg)(f2(func))" +msgstr "" + +#: reference/compound_stmts.rst:1272 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: reference/compound_stmts.rst:1256 +#: reference/compound_stmts.rst:1274 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: reference/compound_stmts.rst:1261 +#: reference/compound_stmts.rst:1279 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1399,11 +1607,11 @@ msgid "" "functions` for more." msgstr "" -#: reference/compound_stmts.rst:1268 reference/compound_stmts.rst:1458 +#: reference/compound_stmts.rst:1286 reference/compound_stmts.rst:1475 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: reference/compound_stmts.rst:1276 +#: reference/compound_stmts.rst:1294 msgid "" "When one or more :term:`parameters ` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1414,7 +1622,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: reference/compound_stmts.rst:1284 +#: reference/compound_stmts.rst:1302 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1427,7 +1635,16 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: reference/compound_stmts.rst:1305 +#: reference/compound_stmts.rst:1312 +msgid "" +"def whats_on_the_telly(penguin=None):\n" +" if penguin is None:\n" +" penguin = []\n" +" penguin.append(\"property of the zoo\")\n" +" return penguin" +msgstr "" + +#: reference/compound_stmts.rst:1323 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1443,30 +1660,32 @@ msgid "" "positional arguments." msgstr "" -#: reference/compound_stmts.rst:1317 +#: reference/compound_stmts.rst:1335 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: reference/compound_stmts.rst:1326 +#: reference/compound_stmts.rst:1344 msgid "" "Parameters may have an :term:`annotation ` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " -"an annotation, even those of the form ``*identifier`` or ``**identifier``. " -"Functions may have \"return\" annotation of the form \"``-> expression``\" " -"after the parameter list. These annotations can be any valid Python " -"expression. The presence of annotations does not change the semantics of a " -"function. The annotation values are available as values of a dictionary " -"keyed by the parameters' names in the :attr:`__annotations__` attribute of " -"the function object. If the ``annotations`` import from :mod:`__future__` " -"is used, annotations are preserved as strings at runtime which enables " -"postponed evaluation. Otherwise, they are evaluated when the function " -"definition is executed. In this case annotations may be evaluated in a " -"different order than they appear in the source code." +"an annotation, even those of the form ``*identifier`` or ``**identifier``. " +"(As a special case, parameters of the form ``*identifier`` may have an " +"annotation \"``: *expression``\".) Functions may have \"return\" annotation " +"of the form \"``-> expression``\" after the parameter list. These " +"annotations can be any valid Python expression. The presence of annotations " +"does not change the semantics of a function. See :ref:`annotations` for more " +"information on annotations." +msgstr "" + +#: reference/compound_stmts.rst:1352 +msgid "" +"Parameters of the form \"``*identifier``\" may have an annotation \"``: " +"*expression``\". See :pep:`646`." msgstr "" -#: reference/compound_stmts.rst:1341 +#: reference/compound_stmts.rst:1358 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -1478,7 +1697,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: reference/compound_stmts.rst:1349 +#: reference/compound_stmts.rst:1366 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1487,61 +1706,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: reference/compound_stmts.rst:1358 +#: reference/compound_stmts.rst:1374 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: reference/compound_stmts.rst:1358 +#: reference/compound_stmts.rst:1375 msgid "The original specification for function annotations." msgstr "" -#: reference/compound_stmts.rst:1361 +#: reference/compound_stmts.rst:1377 msgid ":pep:`484` - Type Hints" msgstr "" -#: reference/compound_stmts.rst:1361 +#: reference/compound_stmts.rst:1378 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: reference/compound_stmts.rst:1365 +#: reference/compound_stmts.rst:1380 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: reference/compound_stmts.rst:1364 +#: reference/compound_stmts.rst:1381 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: reference/compound_stmts.rst:1369 +#: reference/compound_stmts.rst:1384 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: reference/compound_stmts.rst:1368 +#: reference/compound_stmts.rst:1385 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: reference/compound_stmts.rst:1372 +#: reference/compound_stmts.rst:1388 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: reference/compound_stmts.rst:1372 +#: reference/compound_stmts.rst:1389 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: reference/compound_stmts.rst:1378 +#: reference/compound_stmts.rst:1395 msgid "Class definitions" msgstr "" -#: reference/compound_stmts.rst:1393 +#: reference/compound_stmts.rst:1410 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: reference/compound_stmts.rst:1400 +#: reference/compound_stmts.rst:1417 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1550,11 +1769,23 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: reference/compound_stmts.rst:1409 +#: reference/compound_stmts.rst:1423 +msgid "" +"class Foo:\n" +" pass" +msgstr "" + +#: reference/compound_stmts.rst:1426 msgid "is equivalent to ::" msgstr "" -#: reference/compound_stmts.rst:1414 +#: reference/compound_stmts.rst:1428 +msgid "" +"class Foo(object):\n" +" pass" +msgstr "" + +#: reference/compound_stmts.rst:1431 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1566,47 +1797,60 @@ msgid "" "original local namespace." msgstr "" -#: reference/compound_stmts.rst:1423 +#: reference/compound_stmts.rst:1440 msgid "" "The order in which attributes are defined in the class body is preserved in " -"the new class's ``__dict__``. Note that this is reliable only right after " -"the class is created and only for classes that were defined using the " -"definition syntax." +"the new class's :attr:`~type.__dict__`. Note that this is reliable only " +"right after the class is created and only for classes that were defined " +"using the definition syntax." msgstr "" -#: reference/compound_stmts.rst:1428 +#: reference/compound_stmts.rst:1445 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "`." msgstr "" -#: reference/compound_stmts.rst:1433 +#: reference/compound_stmts.rst:1450 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: reference/compound_stmts.rst:1444 +#: reference/compound_stmts.rst:1452 +msgid "" +"@f1(arg)\n" +"@f2\n" +"class Foo: pass" +msgstr "" + +#: reference/compound_stmts.rst:1458 +msgid "" +"class Foo: pass\n" +"Foo = f1(arg)(f2(Foo))" +msgstr "" + +#: reference/compound_stmts.rst:1461 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: reference/compound_stmts.rst:1447 +#: reference/compound_stmts.rst:1464 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: reference/compound_stmts.rst:1452 +#: reference/compound_stmts.rst:1469 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets immediately after the class's name. This indicates to static type " "checkers that the class is generic. At runtime, the type parameters can be " -"retrieved from the class's ``__type_params__`` attribute. See :ref:`generic-" -"classes` for more." +"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" +"`generic-classes` for more." msgstr "" -#: reference/compound_stmts.rst:1461 +#: reference/compound_stmts.rst:1478 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1619,35 +1863,35 @@ msgid "" "implementation details." msgstr "" -#: reference/compound_stmts.rst:1476 +#: reference/compound_stmts.rst:1490 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: reference/compound_stmts.rst:1474 +#: reference/compound_stmts.rst:1491 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: reference/compound_stmts.rst:1479 +#: reference/compound_stmts.rst:1495 msgid ":pep:`3129` - Class Decorators" msgstr "" -#: reference/compound_stmts.rst:1479 +#: reference/compound_stmts.rst:1496 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: reference/compound_stmts.rst:1486 +#: reference/compound_stmts.rst:1503 msgid "Coroutines" msgstr "" -#: reference/compound_stmts.rst:1494 +#: reference/compound_stmts.rst:1511 msgid "Coroutine function definition" msgstr "" -#: reference/compound_stmts.rst:1504 +#: reference/compound_stmts.rst:1521 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1655,104 +1899,184 @@ msgid "" "function." msgstr "" -#: reference/compound_stmts.rst:1508 +#: reference/compound_stmts.rst:1525 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: reference/compound_stmts.rst:1511 +#: reference/compound_stmts.rst:1528 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: reference/compound_stmts.rst:1514 +#: reference/compound_stmts.rst:1531 msgid "An example of a coroutine function::" msgstr "" -#: reference/compound_stmts.rst:1520 +#: reference/compound_stmts.rst:1533 +msgid "" +"async def func(param1, param2):\n" +" do_stuff()\n" +" await some_coroutine()" +msgstr "" + +#: reference/compound_stmts.rst:1537 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: reference/compound_stmts.rst:1528 +#: reference/compound_stmts.rst:1545 msgid "The :keyword:`!async for` statement" msgstr "" -#: reference/compound_stmts.rst:1533 +#: reference/compound_stmts.rst:1550 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: reference/compound_stmts.rst:1537 +#: reference/compound_stmts.rst:1554 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: reference/compound_stmts.rst:1547 +#: reference/compound_stmts.rst:1559 +msgid "" +"async for TARGET in ITER:\n" +" SUITE\n" +"else:\n" +" SUITE2" +msgstr "" + +#: reference/compound_stmts.rst:1564 msgid "Is semantically equivalent to::" msgstr "" -#: reference/compound_stmts.rst:1563 +#: reference/compound_stmts.rst:1566 +msgid "" +"iter = (ITER)\n" +"iter = type(iter).__aiter__(iter)\n" +"running = True\n" +"\n" +"while running:\n" +" try:\n" +" TARGET = await type(iter).__anext__(iter)\n" +" except StopAsyncIteration:\n" +" running = False\n" +" else:\n" +" SUITE\n" +"else:\n" +" SUITE2" +msgstr "" + +#: reference/compound_stmts.rst:1580 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "" -#: reference/compound_stmts.rst:1565 +#: reference/compound_stmts.rst:1582 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: reference/compound_stmts.rst:1573 +#: reference/compound_stmts.rst:1590 msgid "The :keyword:`!async with` statement" msgstr "" -#: reference/compound_stmts.rst:1578 +#: reference/compound_stmts.rst:1595 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" +#: reference/compound_stmts.rst:1600 +msgid "" +"async with EXPRESSION as TARGET:\n" +" SUITE" +msgstr "" + #: reference/compound_stmts.rst:1605 msgid "" +"manager = (EXPRESSION)\n" +"aenter = type(manager).__aenter__\n" +"aexit = type(manager).__aexit__\n" +"value = await aenter(manager)\n" +"hit_except = False\n" +"\n" +"try:\n" +" TARGET = value\n" +" SUITE\n" +"except:\n" +" hit_except = True\n" +" if not await aexit(manager, *sys.exc_info()):\n" +" raise\n" +"finally:\n" +" if not hit_except:\n" +" await aexit(manager, None, None, None)" +msgstr "" + +#: reference/compound_stmts.rst:1622 +msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "" -#: reference/compound_stmts.rst:1607 +#: reference/compound_stmts.rst:1624 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: reference/compound_stmts.rst:1613 +#: reference/compound_stmts.rst:1629 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: reference/compound_stmts.rst:1613 +#: reference/compound_stmts.rst:1630 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: reference/compound_stmts.rst:1619 +#: reference/compound_stmts.rst:1636 msgid "Type parameter lists" msgstr "" -#: reference/compound_stmts.rst:1633 +#: reference/compound_stmts.rst:1640 +msgid "Support for default values was added (see :pep:`696`)." +msgstr "" + +#: reference/compound_stmts.rst:1653 msgid "" ":ref:`Functions ` (including :ref:`coroutines `), :ref:" "`classes ` and :ref:`type aliases ` may contain a type " "parameter list::" msgstr "" -#: reference/compound_stmts.rst:1652 +#: reference/compound_stmts.rst:1657 +msgid "" +"def max[T](args: list[T]) -> T:\n" +" ...\n" +"\n" +"async def amax[T](args: list[T]) -> T:\n" +" ...\n" +"\n" +"class Bag[T]:\n" +" def __iter__(self) -> Iterator[T]:\n" +" ...\n" +"\n" +" def add(self, arg: T) -> None:\n" +" ...\n" +"\n" +"type ListOrSet[T] = list[T] | set[T]" +msgstr "" + +#: reference/compound_stmts.rst:1672 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -1760,7 +2084,7 @@ msgid "" "generic counterparts." msgstr "" -#: reference/compound_stmts.rst:1657 +#: reference/compound_stmts.rst:1677 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -1772,36 +2096,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: reference/compound_stmts.rst:1666 +#: reference/compound_stmts.rst:1686 msgid "" -"Generic functions, classes, and type aliases have a :attr:`!__type_params__` " -"attribute listing their type parameters." +"Generic functions, classes, and type aliases have a :attr:`~definition." +"__type_params__` attribute listing their type parameters." msgstr "" -#: reference/compound_stmts.rst:1669 +#: reference/compound_stmts.rst:1689 msgid "Type parameters come in three kinds:" msgstr "" -#: reference/compound_stmts.rst:1671 +#: reference/compound_stmts.rst:1691 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: reference/compound_stmts.rst:1673 +#: reference/compound_stmts.rst:1693 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: reference/compound_stmts.rst:1676 +#: reference/compound_stmts.rst:1696 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: reference/compound_stmts.rst:1679 +#: reference/compound_stmts.rst:1699 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -1813,7 +2137,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: reference/compound_stmts.rst:1688 +#: reference/compound_stmts.rst:1708 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -1823,31 +2147,76 @@ msgid "" "`." msgstr "" -#: reference/compound_stmts.rst:1694 +#: reference/compound_stmts.rst:1714 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: reference/compound_stmts.rst:1697 +#: reference/compound_stmts.rst:1717 +msgid "" +"All three flavors of type parameters can also have a *default value*, which " +"is used when the type parameter is not explicitly provided. This is added by " +"appending a single equals sign (``=``) followed by an expression. Like the " +"bounds and constraints of type variables, the default value is not evaluated " +"when the object is created, but only when the type parameter's " +"``__default__`` attribute is accessed. To this end, the default value is " +"evaluated in a separate :ref:`annotation scope `. If no " +"default value is specified for a type parameter, the ``__default__`` " +"attribute is set to the special sentinel object :data:`typing.NoDefault`." +msgstr "" + +#: reference/compound_stmts.rst:1727 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: reference/compound_stmts.rst:1715 +#: reference/compound_stmts.rst:1729 +msgid "" +"def overly_generic[\n" +" SimpleTypeVar,\n" +" TypeVarWithDefault = int,\n" +" TypeVarWithBound: int,\n" +" TypeVarWithConstraints: (str, bytes),\n" +" *SimpleTypeVarTuple = (int, float),\n" +" **SimpleParamSpec = (str, bytearray),\n" +"](\n" +" a: SimpleTypeVar,\n" +" b: TypeVarWithDefault,\n" +" c: TypeVarWithBound,\n" +" d: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" +" *e: SimpleTypeVarTuple,\n" +"): ..." +msgstr "" + +#: reference/compound_stmts.rst:1747 msgid "Generic functions" msgstr "" -#: reference/compound_stmts.rst:1717 +#: reference/compound_stmts.rst:1749 msgid "Generic functions are declared as follows::" msgstr "" -#: reference/compound_stmts.rst:1721 reference/compound_stmts.rst:1781 +#: reference/compound_stmts.rst:1751 +msgid "def func[T](arg: T): ..." +msgstr "" + +#: reference/compound_stmts.rst:1753 reference/compound_stmts.rst:1813 msgid "This syntax is equivalent to::" msgstr "" -#: reference/compound_stmts.rst:1730 +#: reference/compound_stmts.rst:1755 +msgid "" +"annotation-def TYPE_PARAMS_OF_func():\n" +" T = typing.TypeVar(\"T\")\n" +" def func(arg: T): ...\n" +" func.__type_params__ = (T,)\n" +" return func\n" +"func = TYPE_PARAMS_OF_func()" +msgstr "" + +#: reference/compound_stmts.rst:1762 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope `, which is not actually bound to any name at runtime. (One other " @@ -1856,47 +2225,91 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: reference/compound_stmts.rst:1736 +#: reference/compound_stmts.rst:1768 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: reference/compound_stmts.rst:1740 +#: reference/compound_stmts.rst:1772 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: reference/compound_stmts.rst:1747 +#: reference/compound_stmts.rst:1775 +msgid "" +"@decorator\n" +"def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" +" ..." +msgstr "" + +#: reference/compound_stmts.rst:1779 msgid "" "Except for the :ref:`lazy evaluation ` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: reference/compound_stmts.rst:1769 +#: reference/compound_stmts.rst:1782 +msgid "" +"DEFAULT_OF_arg = some_default\n" +"\n" +"annotation-def TYPE_PARAMS_OF_func():\n" +"\n" +" annotation-def BOUND_OF_T():\n" +" return int\n" +" # In reality, BOUND_OF_T() is evaluated only on demand.\n" +" T = typing.TypeVar(\"T\", bound=BOUND_OF_T())\n" +"\n" +" Ts = typing.TypeVarTuple(\"Ts\")\n" +" P = typing.ParamSpec(\"P\")\n" +"\n" +" def func(*args: *Ts, arg: Callable[P, T] = DEFAULT_OF_arg):\n" +" ...\n" +"\n" +" func.__type_params__ = (T, Ts, P)\n" +" return func\n" +"func = decorator(TYPE_PARAMS_OF_func())" +msgstr "" + +#: reference/compound_stmts.rst:1801 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: reference/compound_stmts.rst:1775 +#: reference/compound_stmts.rst:1807 msgid "Generic classes" msgstr "" -#: reference/compound_stmts.rst:1777 +#: reference/compound_stmts.rst:1809 msgid "Generic classes are declared as follows::" msgstr "" -#: reference/compound_stmts.rst:1791 +#: reference/compound_stmts.rst:1811 +msgid "class Bag[T]: ..." +msgstr "" + +#: reference/compound_stmts.rst:1815 +msgid "" +"annotation-def TYPE_PARAMS_OF_Bag():\n" +" T = typing.TypeVar(\"T\")\n" +" class Bag(typing.Generic[T]):\n" +" __type_params__ = (T,)\n" +" ...\n" +" return Bag\n" +"Bag = TYPE_PARAMS_OF_Bag()" +msgstr "" + +#: reference/compound_stmts.rst:1823 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope `, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: reference/compound_stmts.rst:1795 +#: reference/compound_stmts.rst:1827 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -1904,128 +2317,233 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: reference/compound_stmts.rst:1804 +#: reference/compound_stmts.rst:1833 +msgid "" +"@decorator\n" +"class Bag(Base[T], arg=T): ..." +msgstr "" + +#: reference/compound_stmts.rst:1836 msgid "This is equivalent to::" msgstr "" -#: reference/compound_stmts.rst:1817 +#: reference/compound_stmts.rst:1838 +msgid "" +"annotation-def TYPE_PARAMS_OF_Bag():\n" +" T = typing.TypeVar(\"T\")\n" +" class Bag(Base[T], typing.Generic[T], arg=T):\n" +" __type_params__ = (T,)\n" +" ...\n" +" return Bag\n" +"Bag = decorator(TYPE_PARAMS_OF_Bag())" +msgstr "" + +#: reference/compound_stmts.rst:1849 msgid "Generic type aliases" msgstr "" -#: reference/compound_stmts.rst:1819 +#: reference/compound_stmts.rst:1851 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: reference/compound_stmts.rst:1823 +#: reference/compound_stmts.rst:1853 +msgid "type ListOrSet[T] = list[T] | set[T]" +msgstr "" + +#: reference/compound_stmts.rst:1855 msgid "" "Except for the :ref:`lazy evaluation ` of the value, this " "is equivalent to::" msgstr "" -#: reference/compound_stmts.rst:1835 +#: reference/compound_stmts.rst:1858 +msgid "" +"annotation-def TYPE_PARAMS_OF_ListOrSet():\n" +" T = typing.TypeVar(\"T\")\n" +"\n" +" annotation-def VALUE_OF_ListOrSet():\n" +" return list[T] | set[T]\n" +" # In reality, the value is lazily evaluated\n" +" return typing.TypeAliasType(\"ListOrSet\", VALUE_OF_ListOrSet(), " +"type_params=(T,))\n" +"ListOrSet = TYPE_PARAMS_OF_ListOrSet()" +msgstr "" + +#: reference/compound_stmts.rst:1867 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope `. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: reference/compound_stmts.rst:1840 +#: reference/compound_stmts.rst:1874 +msgid "Annotations" +msgstr "" + +#: reference/compound_stmts.rst:1876 +msgid "Annotations are now lazily evaluated by default." +msgstr "" + +#: reference/compound_stmts.rst:1879 +msgid "" +"Variables and function parameters may carry :term:`annotations " +"`, created by adding a colon after the name, followed by an " +"expression::" +msgstr "" + +#: reference/compound_stmts.rst:1882 +msgid "" +"x: annotation = 1\n" +"def f(param: annotation): ..." +msgstr "" + +#: reference/compound_stmts.rst:1885 +msgid "Functions may also carry a return annotation following an arrow::" +msgstr "" + +#: reference/compound_stmts.rst:1887 +msgid "def f() -> annotation: ..." +msgstr "" + +#: reference/compound_stmts.rst:1889 +msgid "" +"Annotations are conventionally used for :term:`type hints `, but " +"this is not enforced by the language, and in general annotations may contain " +"arbitrary expressions. The presence of annotations does not change the " +"runtime semantics of the code, except if some mechanism is used that " +"introspects and uses the annotations (such as :mod:`dataclasses` or :func:" +"`functools.singledispatch`)." +msgstr "" + +#: reference/compound_stmts.rst:1895 +msgid "" +"By default, annotations are lazily evaluated in an :ref:`annotation scope " +"`. This means that they are not evaluated when the code " +"containing the annotation is evaluated. Instead, the interpreter saves " +"information that can be used to evaluate the annotation later if requested. " +"The :mod:`annotationlib` module provides tools for evaluating annotations." +msgstr "" + +#: reference/compound_stmts.rst:1900 +msgid "" +"If the :ref:`future statement ` ``from __future__ import " +"annotations`` is present, all annotations are instead stored as strings::" +msgstr "" + +#: reference/compound_stmts.rst:1903 +msgid "" +">>> from __future__ import annotations\n" +">>> def f(param: annotation): ...\n" +">>> f.__annotations__\n" +"{'param': 'annotation'}" +msgstr "" + +#: reference/compound_stmts.rst:1908 +msgid "" +"This future statement will be deprecated and removed in a future version of " +"Python, but not before Python 3.13 reaches its end of life (see :pep:`749`). " +"When it is used, introspection tools like :func:`annotationlib." +"get_annotations` and :func:`typing.get_type_hints` are less likely to be " +"able to resolve annotations at runtime." +msgstr "" + +#: reference/compound_stmts.rst:1916 msgid "Footnotes" msgstr "" -#: reference/compound_stmts.rst:1841 +#: reference/compound_stmts.rst:1917 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: reference/compound_stmts.rst:1845 +#: reference/compound_stmts.rst:1921 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: reference/compound_stmts.rst:1847 +#: reference/compound_stmts.rst:1923 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: reference/compound_stmts.rst:1848 +#: reference/compound_stmts.rst:1924 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: reference/compound_stmts.rst:1849 +#: reference/compound_stmts.rst:1925 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: reference/compound_stmts.rst:1850 reference/compound_stmts.rst:1869 +#: reference/compound_stmts.rst:1926 reference/compound_stmts.rst:1945 msgid "a class that inherits from any of the above" msgstr "" -#: reference/compound_stmts.rst:1852 +#: reference/compound_stmts.rst:1928 msgid "The following standard library classes are sequences:" msgstr "" -#: reference/compound_stmts.rst:1854 +#: reference/compound_stmts.rst:1930 msgid ":class:`array.array`" msgstr "" -#: reference/compound_stmts.rst:1855 +#: reference/compound_stmts.rst:1931 msgid ":class:`collections.deque`" msgstr "" -#: reference/compound_stmts.rst:1857 +#: reference/compound_stmts.rst:1933 msgid ":class:`memoryview`" msgstr "" -#: reference/compound_stmts.rst:1858 +#: reference/compound_stmts.rst:1934 msgid ":class:`range`" msgstr "" -#: reference/compound_stmts.rst:1861 +#: reference/compound_stmts.rst:1937 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: reference/compound_stmts.rst:1864 +#: reference/compound_stmts.rst:1940 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: reference/compound_stmts.rst:1866 +#: reference/compound_stmts.rst:1942 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: reference/compound_stmts.rst:1867 +#: reference/compound_stmts.rst:1943 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: reference/compound_stmts.rst:1868 +#: reference/compound_stmts.rst:1944 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: reference/compound_stmts.rst:1871 +#: reference/compound_stmts.rst:1947 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: reference/compound_stmts.rst:1874 +#: reference/compound_stmts.rst:1950 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: reference/compound_stmts.rst:1878 +#: reference/compound_stmts.rst:1954 msgid "" "A string literal appearing as the first statement in the class body is " -"transformed into the namespace's ``__doc__`` item and therefore the class's :" -"term:`docstring`." +"transformed into the namespace's :attr:`~type.__doc__` item and therefore " +"the class's :term:`docstring`." msgstr "" #: reference/compound_stmts.rst:7 @@ -2035,11 +2553,11 @@ msgstr "" #: reference/compound_stmts.rst:86 reference/compound_stmts.rst:111 #: reference/compound_stmts.rst:129 reference/compound_stmts.rst:144 #: reference/compound_stmts.rst:169 reference/compound_stmts.rst:207 -#: reference/compound_stmts.rst:389 reference/compound_stmts.rst:436 -#: reference/compound_stmts.rst:470 reference/compound_stmts.rst:587 -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1380 -#: reference/compound_stmts.rst:1490 reference/compound_stmts.rst:1524 -#: reference/compound_stmts.rst:1569 +#: reference/compound_stmts.rst:397 reference/compound_stmts.rst:446 +#: reference/compound_stmts.rst:484 reference/compound_stmts.rst:602 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1397 +#: reference/compound_stmts.rst:1507 reference/compound_stmts.rst:1541 +#: reference/compound_stmts.rst:1586 msgid "statement" msgstr "" @@ -2069,19 +2587,19 @@ msgstr "" #: reference/compound_stmts.rst:64 reference/compound_stmts.rst:86 #: reference/compound_stmts.rst:111 reference/compound_stmts.rst:144 -#: reference/compound_stmts.rst:207 reference/compound_stmts.rst:389 +#: reference/compound_stmts.rst:207 reference/compound_stmts.rst:397 msgid "else" msgstr "" -#: reference/compound_stmts.rst:86 reference/compound_stmts.rst:587 +#: reference/compound_stmts.rst:86 reference/compound_stmts.rst:602 msgid "if" msgstr "" #: reference/compound_stmts.rst:86 reference/compound_stmts.rst:111 #: reference/compound_stmts.rst:144 reference/compound_stmts.rst:207 -#: reference/compound_stmts.rst:328 reference/compound_stmts.rst:389 -#: reference/compound_stmts.rst:407 reference/compound_stmts.rst:470 -#: reference/compound_stmts.rst:587 reference/compound_stmts.rst:1500 +#: reference/compound_stmts.rst:330 reference/compound_stmts.rst:397 +#: reference/compound_stmts.rst:415 reference/compound_stmts.rst:484 +#: reference/compound_stmts.rst:602 reference/compound_stmts.rst:1517 msgid "keyword" msgstr "" @@ -2091,16 +2609,16 @@ msgstr "" #: reference/compound_stmts.rst:86 reference/compound_stmts.rst:111 #: reference/compound_stmts.rst:144 reference/compound_stmts.rst:207 -#: reference/compound_stmts.rst:470 reference/compound_stmts.rst:587 -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1321 -#: reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:484 reference/compound_stmts.rst:602 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1339 +#: reference/compound_stmts.rst:1397 msgid ": (colon)" msgstr "" #: reference/compound_stmts.rst:86 reference/compound_stmts.rst:111 #: reference/compound_stmts.rst:144 reference/compound_stmts.rst:207 -#: reference/compound_stmts.rst:470 reference/compound_stmts.rst:587 -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:484 reference/compound_stmts.rst:602 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1397 msgid "compound statement" msgstr "" @@ -2113,12 +2631,12 @@ msgid "loop" msgstr "" #: reference/compound_stmts.rst:129 reference/compound_stmts.rst:169 -#: reference/compound_stmts.rst:389 reference/compound_stmts.rst:436 +#: reference/compound_stmts.rst:397 reference/compound_stmts.rst:446 msgid "break" msgstr "" #: reference/compound_stmts.rst:129 reference/compound_stmts.rst:169 -#: reference/compound_stmts.rst:389 reference/compound_stmts.rst:436 +#: reference/compound_stmts.rst:397 reference/compound_stmts.rst:446 msgid "continue" msgstr "" @@ -2138,8 +2656,8 @@ msgstr "" msgid "list" msgstr "" -#: reference/compound_stmts.rst:144 reference/compound_stmts.rst:299 -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:144 reference/compound_stmts.rst:301 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1397 msgid "object" msgstr "" @@ -2163,230 +2681,230 @@ msgstr "" msgid "except" msgstr "" -#: reference/compound_stmts.rst:207 reference/compound_stmts.rst:407 +#: reference/compound_stmts.rst:207 reference/compound_stmts.rst:415 msgid "finally" msgstr "" -#: reference/compound_stmts.rst:207 reference/compound_stmts.rst:266 -#: reference/compound_stmts.rst:470 reference/compound_stmts.rst:587 +#: reference/compound_stmts.rst:207 reference/compound_stmts.rst:268 +#: reference/compound_stmts.rst:484 reference/compound_stmts.rst:602 msgid "as" msgstr "" -#: reference/compound_stmts.rst:266 +#: reference/compound_stmts.rst:268 msgid "except clause" msgstr "" -#: reference/compound_stmts.rst:299 +#: reference/compound_stmts.rst:301 msgid "module" msgstr "" -#: reference/compound_stmts.rst:299 +#: reference/compound_stmts.rst:301 msgid "sys" msgstr "" -#: reference/compound_stmts.rst:299 +#: reference/compound_stmts.rst:301 msgid "traceback" msgstr "" -#: reference/compound_stmts.rst:328 +#: reference/compound_stmts.rst:330 msgid "except_star" msgstr "" -#: reference/compound_stmts.rst:389 reference/compound_stmts.rst:436 +#: reference/compound_stmts.rst:397 reference/compound_stmts.rst:446 msgid "return" msgstr "" -#: reference/compound_stmts.rst:470 +#: reference/compound_stmts.rst:484 msgid "with" msgstr "" -#: reference/compound_stmts.rst:470 +#: reference/compound_stmts.rst:484 msgid "with statement" msgstr "" -#: reference/compound_stmts.rst:470 reference/compound_stmts.rst:1194 -#: reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:484 reference/compound_stmts.rst:1209 +#: reference/compound_stmts.rst:1397 msgid ", (comma)" msgstr "" -#: reference/compound_stmts.rst:587 +#: reference/compound_stmts.rst:602 msgid "match" msgstr "" -#: reference/compound_stmts.rst:587 +#: reference/compound_stmts.rst:602 msgid "case" msgstr "" -#: reference/compound_stmts.rst:587 +#: reference/compound_stmts.rst:602 msgid "pattern matching" msgstr "" -#: reference/compound_stmts.rst:587 +#: reference/compound_stmts.rst:602 msgid "match statement" msgstr "" -#: reference/compound_stmts.rst:691 +#: reference/compound_stmts.rst:706 msgid "guard" msgstr "" -#: reference/compound_stmts.rst:730 +#: reference/compound_stmts.rst:745 msgid "irrefutable case block" msgstr "" -#: reference/compound_stmts.rst:730 +#: reference/compound_stmts.rst:745 msgid "case block" msgstr "" -#: reference/compound_stmts.rst:754 +#: reference/compound_stmts.rst:769 msgid "! patterns" msgstr "" -#: reference/compound_stmts.rst:754 +#: reference/compound_stmts.rst:769 msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" -#: reference/compound_stmts.rst:1185 reference/compound_stmts.rst:1271 +#: reference/compound_stmts.rst:1200 reference/compound_stmts.rst:1289 msgid "parameter" msgstr "" -#: reference/compound_stmts.rst:1185 reference/compound_stmts.rst:1194 -#: reference/compound_stmts.rst:1235 reference/compound_stmts.rst:1271 -#: reference/compound_stmts.rst:1300 +#: reference/compound_stmts.rst:1200 reference/compound_stmts.rst:1209 +#: reference/compound_stmts.rst:1253 reference/compound_stmts.rst:1289 +#: reference/compound_stmts.rst:1318 msgid "function definition" msgstr "" -#: reference/compound_stmts.rst:1194 +#: reference/compound_stmts.rst:1209 msgid "def" msgstr "" -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1321 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1339 msgid "function" msgstr "" -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1397 msgid "definition" msgstr "" -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1397 msgid "name" msgstr "" -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1397 msgid "binding" msgstr "" -#: reference/compound_stmts.rst:1194 +#: reference/compound_stmts.rst:1209 msgid "user-defined function" msgstr "" -#: reference/compound_stmts.rst:1194 reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1209 reference/compound_stmts.rst:1397 msgid "() (parentheses)" msgstr "" -#: reference/compound_stmts.rst:1194 +#: reference/compound_stmts.rst:1209 msgid "parameter list" msgstr "" -#: reference/compound_stmts.rst:1235 reference/compound_stmts.rst:1430 +#: reference/compound_stmts.rst:1253 reference/compound_stmts.rst:1447 msgid "@ (at)" msgstr "" -#: reference/compound_stmts.rst:1271 +#: reference/compound_stmts.rst:1289 msgid "default" msgstr "" -#: reference/compound_stmts.rst:1271 +#: reference/compound_stmts.rst:1289 msgid "value" msgstr "" -#: reference/compound_stmts.rst:1271 +#: reference/compound_stmts.rst:1289 msgid "argument" msgstr "" -#: reference/compound_stmts.rst:1271 +#: reference/compound_stmts.rst:1289 msgid "= (equals)" msgstr "" -#: reference/compound_stmts.rst:1300 +#: reference/compound_stmts.rst:1318 msgid "/ (slash)" msgstr "" -#: reference/compound_stmts.rst:1300 +#: reference/compound_stmts.rst:1318 msgid "* (asterisk)" msgstr "" -#: reference/compound_stmts.rst:1300 +#: reference/compound_stmts.rst:1318 msgid "**" msgstr "" -#: reference/compound_stmts.rst:1321 +#: reference/compound_stmts.rst:1339 msgid "annotations" msgstr "" -#: reference/compound_stmts.rst:1321 +#: reference/compound_stmts.rst:1339 msgid "->" msgstr "" -#: reference/compound_stmts.rst:1321 +#: reference/compound_stmts.rst:1339 msgid "function annotations" msgstr "" -#: reference/compound_stmts.rst:1339 +#: reference/compound_stmts.rst:1356 msgid "lambda" msgstr "" -#: reference/compound_stmts.rst:1339 +#: reference/compound_stmts.rst:1356 msgid "expression" msgstr "" -#: reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1397 msgid "class" msgstr "" -#: reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1397 msgid "execution" msgstr "" -#: reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1397 msgid "frame" msgstr "" -#: reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1397 msgid "inheritance" msgstr "" -#: reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1397 msgid "docstring" msgstr "" -#: reference/compound_stmts.rst:1380 reference/compound_stmts.rst:1430 +#: reference/compound_stmts.rst:1397 reference/compound_stmts.rst:1447 msgid "class definition" msgstr "" -#: reference/compound_stmts.rst:1380 +#: reference/compound_stmts.rst:1397 msgid "expression list" msgstr "" -#: reference/compound_stmts.rst:1490 +#: reference/compound_stmts.rst:1507 msgid "async def" msgstr "" -#: reference/compound_stmts.rst:1500 +#: reference/compound_stmts.rst:1517 msgid "async" msgstr "" -#: reference/compound_stmts.rst:1500 +#: reference/compound_stmts.rst:1517 msgid "await" msgstr "" -#: reference/compound_stmts.rst:1524 +#: reference/compound_stmts.rst:1541 msgid "async for" msgstr "" -#: reference/compound_stmts.rst:1569 +#: reference/compound_stmts.rst:1586 msgid "async with" msgstr "" -#: reference/compound_stmts.rst:1623 +#: reference/compound_stmts.rst:1643 msgid "type parameters" msgstr "" diff --git a/reference/datamodel.po b/reference/datamodel.po index bb64eafc..6be329b4 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,31 +8,36 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Panagiotis Skias \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.6\n" #: reference/datamodel.rst:6 msgid "Data model" -msgstr "" +msgstr "Μοντέλο Δεδομένων" #: reference/datamodel.rst:12 msgid "Objects, values and types" -msgstr "" +msgstr "Αντικείμενα, τιμές και τύποι" #: reference/datamodel.rst:18 msgid "" ":dfn:`Objects` are Python's abstraction for data. All data in a Python " -"program is represented by objects or by relations between objects. (In a " -"sense, and in conformance to Von Neumann's model of a \"stored program " -"computer\", code is also represented by objects.)" +"program is represented by objects or by relations between objects. Even code " +"is represented by objects." msgstr "" +"Το :dfn:`Objects` είναι μια αφαιρετική αναπαράσταση της Python για τα " +"δεδομένα. Όλα τα δεδομένα σε ένα Python πρόγραμμα αναπαριστώνται από " +"αντικείμενα ή από συσχετίσεις μεταξύ αντικειμένων. Ακόμη και ο κώδικας " +"αναπαρίσταται από αντικείμενα." -#: reference/datamodel.rst:35 +#: reference/datamodel.rst:31 msgid "" "Every object has an identity, a type and a value. An object's *identity* " "never changes once it has been created; you may think of it as the object's " @@ -40,12 +45,19 @@ msgid "" "objects; the :func:`id` function returns an integer representing its " "identity." msgstr "" +"Κάθε αντικείμενο έχει μια ταυτότητα, έναν τύπο και μια τιμή. Η *ταυτότητα* " +"ενός αντικειμένου δεν αλλάζει ποτέ αφού δημιουργηθεί∙ μπορείτε να το " +"σκεφτείτε ως τη διεύθυνση του αντικειμένου στη μνήμη. Ο τελεστής :keyword:" +"`is` συγκρίνει την ταυτότητα δύο αντικειμένων∙ η συνάρτηση :func:`id` " +"επιστρέφει έναν ακέραιο αριθμό που αντιπροσωπεύει την ταυτότητά του." -#: reference/datamodel.rst:42 +#: reference/datamodel.rst:38 msgid "For CPython, ``id(x)`` is the memory address where ``x`` is stored." msgstr "" +"Για την CPython, το ``id(x)`` είναι η διεύθυνση μνήμης όπου είναι " +"αποθηκευμένο το ``x``." -#: reference/datamodel.rst:44 +#: reference/datamodel.rst:40 msgid "" "An object's type determines the operations that the object supports (e.g., " "\"does it have a length?\") and also defines the possible values for objects " @@ -53,8 +65,13 @@ msgid "" "an object itself). Like its identity, an object's :dfn:`type` is also " "unchangeable. [#]_" msgstr "" +"Ο τύπος ενός αντικειμένου καθορίζει τις λειτουργίες που υποστηρίζει το " +"αντικείμενο (π.χ., \"έχει μήκος;\") και ορίζει επίσης τις πιθανές τιμές για " +"αντικείμενα αυτού του τύπου. Η συνάρτηση :func:`type` επιστρέφει τον τύπο " +"ενός αντικειμένου (που είναι το ίδιο το αντικείμενο). Όπως και η ταυτότητά, " +"το :dfn:`type` ενός αντικειμένου είναι επίσης αμετάβλητο. [#]_" -#: reference/datamodel.rst:50 +#: reference/datamodel.rst:46 msgid "" "The *value* of some objects can change. Objects whose value can change are " "said to be *mutable*; objects whose value is unchangeable once they are " @@ -67,8 +84,19 @@ msgid "" "instance, numbers, strings and tuples are immutable, while dictionaries and " "lists are mutable." msgstr "" +"Η *τιμή* ορισμένων αντικειμένων μπορεί να αλλάξει. Τα αντικείμενα των " +"οποίων η τιμή μπορεί να αλλάξει λέγονται *μεταβλητά*∙ τα αντικείμενα των " +"οποίων η τιμή είναι αμετάβλητη μόλις δημιουργηθούν ονομάζονται *αμετάβλητα*. " +"(Η τιμή ενός αμετάβλητου container αντικειμένου που περιέχει μια αναφορά σε " +"ένα μεταβλητό αντικείμενο μπορεί να αλλάξει όταν αλλάξει η τιμή του " +"τελευταίου. Ωστόσο, το container δεν μπορεί να θεωρείται ακόμα αμετάβλητο, " +"επειδή η συλλογή δεν μπορεί να αλλάξει. Έτσι, η αμετάβλητη δεν είναι " +"αυστηρά ίδια με την αμετάβλητη τιμή, είναι πιο λεπτή.) Η μεταβλητότητα ενός " +"αντικειμένου καθορίζεται από τον τύπο του∙ για παράδειγμα οι αριθμοί, οι " +"συμβολοσειρές και οι πλειάδες είναι αμετάβλητα, ενώ τα λεξικά και οι λίστες " +"είναι μεταβλητά." -#: reference/datamodel.rst:65 +#: reference/datamodel.rst:61 msgid "" "Objects are never explicitly destroyed; however, when they become " "unreachable they may be garbage-collected. An implementation is allowed to " @@ -76,8 +104,13 @@ msgid "" "implementation quality how garbage collection is implemented, as long as no " "objects are collected that are still reachable." msgstr "" +"Τα αντικείμενα δεν καταστρέφονται ποτέ ρητά∙ ωστόσο, όταν γίνονται απρόσιτα " +"μπορεί να συλλεχθούν ως σκουπίδια. Μια υλοποίηση επιτρέπεται να αναβάλει τη " +"συλλογή σκουπιδιών ή να την παραλείψει εντελώς --- είναι θέμα ποιότητας " +"υλοποίησης πώς θα υλοποιηθεί η συλλογή απορριμμάτων, εφόσον δεν συλλέγονται " +"αντικείμενα που είναι ακόμα προσβάσιμα." -#: reference/datamodel.rst:73 +#: reference/datamodel.rst:69 msgid "" "CPython currently uses a reference-counting scheme with (optional) delayed " "detection of cyclically linked garbage, which collects most objects as soon " @@ -88,16 +121,30 @@ msgid "" "on immediate finalization of objects when they become unreachable (so you " "should always close files explicitly)." msgstr "" +"Η CPython χρησιμοποιεί επί του παρόντος ένα σχήμα μέτρησης αναφορών με " +"(προαιρετικό) καθυστερημένο εντοπισμό κυκλικά συνδεδεμένων σκουπιδιών, το " +"οποίο συλλέγει τα περισσότερα αντικείμενα μόλις γίνουν απρόσιτα, αλλά δεν " +"είναι εγγυημένο ότι συλλέγει σκουπίδια που κάνουν κυκλικές αναφορές. Δείτε " +"την τεκμηρίωση του module :mod:`gc` για πληροφορίες σχετικά με τον έλεγχο " +"της συλλογής κυκλικών σκουπιδιών. Άλλες υλοποιήσεις ενεργούν διαφορετικά και " +"η CPython μπορεί να αλλάξει. Μην εξαρτάστε από την άμεση οριστικοποίηση των " +"αντικειμένων όταν γίνονται απρόσιτα (έτσι θα πρέπει πάντα να κλείνετε ρητά " +"τα αρχεία)." -#: reference/datamodel.rst:82 +#: reference/datamodel.rst:78 msgid "" "Note that the use of the implementation's tracing or debugging facilities " "may keep objects alive that would normally be collectable. Also note that " "catching an exception with a :keyword:`try`...\\ :keyword:`except` statement " "may keep objects alive." msgstr "" +"Λάβετε υπόψη ότι η χρήση των υπηρεσιών ανίχνευσης ή εντοπισμού σφαλμάτων της " +"υλοποίησης μπορεί να διατηρήσει ζωντανά αντικείμενα που κανονικά θα " +"μπορούσαν να συλλεχθούν. Επίσης σημειώστε ότι η σύλληψη μιας εξαίρεσης με " +"μια δήλωση :keyword:`try`...\\ :keyword:`except`, μπορεί να κρατήσει ζωντανά " +"αντικείμενα." -#: reference/datamodel.rst:87 +#: reference/datamodel.rst:83 msgid "" "Some objects contain references to \"external\" resources such as open files " "or windows. It is understood that these resources are freed when the object " @@ -108,8 +155,16 @@ msgid "" "`finally` statement and the :keyword:`with` statement provide convenient " "ways to do this." msgstr "" +"Ορισμένα αντικείμενα περιέχουν αναφορές σε \"εξωτερικούς\" πόρους, όπως " +"ανοιχτά αρχεία ή παράθυρα. Είναι κατανοητό ότι αυτοί οι πόροι " +"ελευθερώνονται όταν το αντικείμενο συλλέγεται από σκουπίδια, αλλά επειδή η " +"συλλογή απορριμμάτων δεν είναι εγγυημένη, τέτοια αντικείμενα παρέχουν επίσης " +"έναν σαφή τρόπο απελευθέρωσης του εξωτερικού πόρου, συνήθως μια μέθοδο :meth:" +"`!close`. Συνιστώνται προγράμματα για τη ρητό κλείσιμο τέτοιων " +"αντικειμένων. Η δήλωση :keyword:`try`...\\ :keyword:`finally` και η δήλωση :" +"keyword:`with` παρέχουν βολικούς τρόπους για να το κάνετε αυτό." -#: reference/datamodel.rst:97 +#: reference/datamodel.rst:93 msgid "" "Some objects contain references to other objects; these are called " "*containers*. Examples of containers are tuples, lists and dictionaries. " @@ -120,23 +175,52 @@ msgid "" "implied. So, if an immutable container (like a tuple) contains a reference " "to a mutable object, its value changes if that mutable object is changed." msgstr "" +"Μερικά αντικείμενα περιέχουν αναφορές σε άλλα αντικείμενα· αυτά ονομάζονται " +"*containers*. Παραδείγματα containers είναι πλειάδες, λίστες και λεξικά. Οι " +"αναφορές αποτελούν μέρος της τιμής ενός container. Στις περισσότερες " +"περιπτώσεις, όταν μιλάμε για την αξία ενός container, υπονοούμε τις τιμές, " +"όχι τις ταυτότητες των αντικειμένων που περιέχονται. Ωστόσο, όταν μιλάμε για " +"τη μεταβλητότητα ενός δοχείου υπονοούνται μόνο οι ταυτότητες των αμέσως " +"περιεχομένων αντικειμένων. Έτσι, εάν ένα αμετάβλητο container (όπως μια " +"πλειάδα) περιέχει μια αναφορά σε ένα μεταβλητό αντικείμενο, η τιμή του " +"αλλάζει εάν αυτό το μεταβλητό αντικείμενο αλλάξει." -#: reference/datamodel.rst:106 +#: reference/datamodel.rst:102 msgid "" "Types affect almost all aspects of object behavior. Even the importance of " "object identity is affected in some sense: for immutable types, operations " "that compute new values may actually return a reference to any existing " "object with the same type and value, while for mutable objects this is not " -"allowed. E.g., after ``a = 1; b = 1``, ``a`` and ``b`` may or may not refer " -"to the same object with the value one, depending on the implementation, but " -"after ``c = []; d = []``, ``c`` and ``d`` are guaranteed to refer to two " -"different, unique, newly created empty lists. (Note that ``c = d = []`` " -"assigns the same object to both ``c`` and ``d``.)" -msgstr "" +"allowed. For example, after ``a = 1; b = 1``, *a* and *b* may or may not " +"refer to the same object with the value one, depending on the " +"implementation. This is because :class:`int` is an immutable type, so the " +"reference to ``1`` can be reused. This behaviour depends on the " +"implementation used, so should not be relied upon, but is something to be " +"aware of when making use of object identity tests. However, after ``c = []; " +"d = []``, *c* and *d* are guaranteed to refer to two different, unique, " +"newly created empty lists. (Note that ``e = f = []`` assigns the *same* " +"object to both *e* and *f*.)" +msgstr "" +"Οι τύποι επηρεάζουν σχεδόν όλες τις πτυχές της συμπεριφοράς των " +"αντικειμένων. Ακόμη και η σημασία της ταυτότητας αντικειμένου επηρεάζεται " +"κατά κάποιο τρόπο: για αμετάβλητους τύπους, οι πράξεις που υπολογίζουν νέες " +"τιμές μπορούν στην πραγματικότητα να επιστρέψουν μια αναφορά σε οποιοδήποτε " +"υπάρχον αντικείμενο με τον ίδιο τύπο και τιμή, ενώ για μεταβλητά αντικείμενα " +"αυτό δεν επιτρέπεται. Π.χ., μετά από ``a = 1; b = 1``, τα *a* και *b* μπορεί " +"να αναφέρονται ή να μην αναφέρονται στο ίδιο αντικείμενο με την τιμή ένα, " +"ανάλογα με την υλοποίηση. Αυτό συμβαίνει επειδή το :class:`int` είναι ένας " +"αμετάβλητος τύπος, επομένως η αναφορά στο ``1`` μπορεί να " +"επαναχρησιμοποιηθεί. Αυτή η συμπεριφορά εξαρτάται από την υλοποίηση που " +"χρησιμοποιείται, επομένως δεν πρέπει να βασίζεστε σε αυτήν, αλλά είναι κάτι " +"που πρέπει να γνωρίζετε όταν χρησιμοποιείτε δοκιμές ταυτότητας αντικειμένων. " +"Ωστόσο, μετά από ``c = []; d = []``, *c* και *d* είναι εγγυημένα ότι " +"αναφέρονται σε δύο διαφορετικές, μοναδικές, νεοδημιουργημένες κενές λίστες. " +"(Σημειώστε ότι το ``e = f = []`` αντιστοιχίζει το *ίδιο* αντικείμενο τόσο " +"στο *e* όσο και στο *f*.)" #: reference/datamodel.rst:120 msgid "The standard type hierarchy" -msgstr "" +msgstr "Η τυπική ιεραρχία τύπου" #: reference/datamodel.rst:129 msgid "" @@ -147,6 +231,12 @@ msgid "" "integers, etc.), although such additions will often be provided via the " "standard library instead." msgstr "" +"Ακολουθεί μια λίστα με τους τύπους που είναι ενσωματωμένοι στην Python. Τα " +"modules επέκτασης (γραμμένες σε C, Java, ή άλλες γλώσσες, ανάλογα με την " +"υλοποίηση) μπορούν να ορίσουν πρόσθετους τύπους. Οι μελλοντικές εκδόσεις της " +"Python ενδέχεται να προσθέσουν τύπους στην ιεραρχία τύπων (π.χ. ορθολογικοί " +"αριθμοί, αποτελεσματικά αποθηκευμένοι πίνακες ακεραίων κ.λπ.), ν και αντ' " +"αυτού παρέχονται τυπικές βιβλιοθήκες." #: reference/datamodel.rst:140 msgid "" @@ -155,10 +245,14 @@ msgid "" "and are not intended for general use. Their definition may change in the " "future." msgstr "" +"Ορισμένες από τις παρακάτω περιγραφές τύπων περιέχουν μια παράγραφο με " +"'ειδικά χαρακτηριστικά.' Αυτά είναι χαρακτηριστικά που παρέχουν πρόσβαση " +"στην υλοποίηση και δεν προορίζονται για γενική χρήση ο ορισμός τους μπορεί " +"να αλλάξει στο μέλλον." #: reference/datamodel.rst:148 msgid "None" -msgstr "" +msgstr "None" #: reference/datamodel.rst:150 msgid "" @@ -167,10 +261,15 @@ msgid "" "signify the absence of a value in many situations, e.g., it is returned from " "functions that don't explicitly return anything. Its truth value is false." msgstr "" +"Αυτό ο τύπος έχει μια ενιαία τιμή. Υπάρχει ένα μεμονωμένο αντικείμενο με " +"αυτήν την τιμή. Η πρόσβαση σε αυτό το αντικείμενο γίνεται μέσω του " +"ενσωματωμένου ονόματος ``None``. Χρησιμοποιείται για να υποδηλώσει την " +"απουσία τιμής σε πολλές περιπτώσεις, π.χ. επιστρέφεται από συναρτήσεις που " +"δεν επιστρέφουν ρητά τίποτα. Η τιμή αλήθειας του είναι ψευδής." #: reference/datamodel.rst:159 msgid "NotImplemented" -msgstr "" +msgstr "NotImplemented" #: reference/datamodel.rst:161 msgid "" @@ -181,34 +280,56 @@ msgid "" "will then try the reflected operation, or some other fallback, depending on " "the operator.) It should not be evaluated in a boolean context." msgstr "" +"Αυτός ο τύπος έχει μια ενιαία τιμή. Υπάρχει ένα μεμονωμένο αντικείμενο με " +"αυτήν την τιμή. Η πρόσβαση σε αυτό το αντικείμενο γίνεται μέσω του " +"ενσωματωμένου ονόματος :data:`NotImplemented`. Οι αριθμητικές μέθοδοι και οι " +"μέθοδοι εμπλουτισμένης σύγκρισης θα πρέπει να επιστρέφουν αυτήν την τιμή εάν " +"δεν εφαρμόζουν τη λειτουργία για τους τελεστές που παρέχονται. (Ο " +"διερμηνέας θα δοκιμάσει την ανακλώμενη λειτουργία ή κάποια άλλη εναλλακτική, " +"ανάλογα με τον τελεστή.) Δεν πρέπει να αξιολογείται σε ένα boolean πλαίσιο." #: reference/datamodel.rst:168 msgid "See :ref:`implementing-the-arithmetic-operations` for more details." msgstr "" +"Δείτε το :ref:`implementing-the-arithmetic-operations` για περισσότερες " +"λεπτομέρειες." #: reference/datamodel.rst:172 +msgid "Evaluating :data:`NotImplemented` in a boolean context was deprecated." +msgstr "" +"Η αξιολόγηση του :data:`NotImplemented` σε ένα boolean πλαίσιο έχει " +"αποσυρθεί." + +#: reference/datamodel.rst:175 msgid "" -"Evaluating :data:`NotImplemented` in a boolean context is deprecated. While " -"it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. It " -"will raise a :exc:`TypeError` in a future version of Python." +"Evaluating :data:`NotImplemented` in a boolean context now raises a :exc:" +"`TypeError`. It previously evaluated to :const:`True` and emitted a :exc:" +"`DeprecationWarning` since Python 3.9." msgstr "" +"Η αξιολόγηση του :data:`NotImplemented` σε ένα boolean πλαίσιο τώρα κάνει " +"raise μια :exc:`TypeError`. Προηγουμένως αξιολογούνταν σε :const:`True` και " +"εξέπεμπε μια :exc:`DeprecationWarning` από την Python 3.9." -#: reference/datamodel.rst:180 +#: reference/datamodel.rst:183 msgid "Ellipsis" -msgstr "" +msgstr "Ellipsis" -#: reference/datamodel.rst:184 +#: reference/datamodel.rst:187 msgid "" "This type has a single value. There is a single object with this value. " "This object is accessed through the literal ``...`` or the built-in name " "``Ellipsis``. Its truth value is true." msgstr "" +"Αυτός ο τύπος έχει μια ενιαία τιμή. Υπάρχει ένα μεμονωμένο αντικείμενο με " +"αυτή την τιμή. Η πρόσβαση σε αυτό το αντικείμενο γίνεται μέσω του literal " +"``...`` ή του ενσωματωμένου ονόματος ``Ellipsis``. Η τιμή αλήθειας του " +"είναι αληθής." -#: reference/datamodel.rst:190 +#: reference/datamodel.rst:193 msgid ":class:`numbers.Number`" -msgstr "" +msgstr ":class:`numbers.Number`" -#: reference/datamodel.rst:194 +#: reference/datamodel.rst:197 msgid "" "These are created by numeric literals and returned as results by arithmetic " "operators and arithmetic built-in functions. Numeric objects are immutable; " @@ -216,72 +337,95 @@ msgid "" "strongly related to mathematical numbers, but subject to the limitations of " "numerical representation in computers." msgstr "" +"Αυτά δημιουργούνται από αριθμητικά literals και επιστρέφονται ως " +"αποτελέσματα από αριθμητικούς τελεστές και αριθμητικές ενσωματωμένες " +"συναρτήσεις. Τα αριθμητικά αντικείμενα είναι αμετάβλητα∙ μόλις " +"δημιουργηθούν, η τιμή τους δεν αλλάζει ποτέ. Οι αριθμοί Python φυσικά " +"σχετίζονται στενά με τους μαθηματικούς αριθμούς, αλλά υπόκεινται στους " +"περιορισμούς της αριθμητικής αναπαράστασης στους υπολογιστές." -#: reference/datamodel.rst:200 +#: reference/datamodel.rst:203 msgid "" "The string representations of the numeric classes, computed by :meth:" "`~object.__repr__` and :meth:`~object.__str__`, have the following " "properties:" msgstr "" +"Οι αναπαραστάσεις συμβολοσειρών των αριθμητικών κλάσεων, που υπολογίζονται " +"από την :meth:`~object.__repr__` και από τη :meth:`~object.__str__`, έχουν " +"τις ακόλουθες ιδιότητες:" -#: reference/datamodel.rst:204 +#: reference/datamodel.rst:207 msgid "" "They are valid numeric literals which, when passed to their class " "constructor, produce an object having the value of the original numeric." msgstr "" +"Είναι έγκυρα αριθμητικά γράμματα τα οποία, όταν περάσουν στον κατασκευαστή " +"της κλάσης τους, παράγουν ένα αντικείμενο που έχει την τιμή του αρχικού " +"αριθμητικού." -#: reference/datamodel.rst:208 +#: reference/datamodel.rst:211 msgid "The representation is in base 10, when possible." -msgstr "" +msgstr "Η αναπαράσταση είναι στη βάση του 10, όταν αυτό είναι εφικτό." -#: reference/datamodel.rst:210 +#: reference/datamodel.rst:213 msgid "" "Leading zeros, possibly excepting a single zero before a decimal point, are " "not shown." msgstr "" +"Τα προηγούμενα μηδενικά, ενδεχομένως με εξαίρεση ένα μόνο μηδέν πριν από μια " +"υποδιαστολή, δεν εμφανίζονται." -#: reference/datamodel.rst:213 +#: reference/datamodel.rst:216 msgid "" "Trailing zeros, possibly excepting a single zero after a decimal point, are " "not shown." msgstr "" +"Τα μηδενικά που ακολουθούν, ενδεχομένως με εξαίρεση ένα μεμονωμένο μηδέν " +"μετά από μια υποδιαστολή, δεν εμφανίζονται." -#: reference/datamodel.rst:216 +#: reference/datamodel.rst:219 msgid "A sign is shown only when the number is negative." -msgstr "" +msgstr "Ένα πρόσημο εμφανίζεται μόνο όταν ο αριθμός είναι αρνητικός." -#: reference/datamodel.rst:218 +#: reference/datamodel.rst:221 msgid "" -"Python distinguishes between integers, floating point numbers, and complex " +"Python distinguishes between integers, floating-point numbers, and complex " "numbers:" msgstr "" +"Η Python κάνει διάκριση μεταξύ ακεραίων, αριθμών κινητής υποδιαστολής και " +"μιγαδικών αριθμών:" -#: reference/datamodel.rst:223 +#: reference/datamodel.rst:226 msgid ":class:`numbers.Integral`" -msgstr "" +msgstr ":class:`numbers.Integral`" -#: reference/datamodel.rst:227 +#: reference/datamodel.rst:230 msgid "" "These represent elements from the mathematical set of integers (positive and " "negative)." msgstr "" +"Αυτά αντιπροσωπεύουν στοιχεία από το μαθηματικό σύνολο ακεραίων (θετικών και " +"αρνητικών)." -#: reference/datamodel.rst:233 +#: reference/datamodel.rst:236 msgid "" "The rules for integer representation are intended to give the most " "meaningful interpretation of shift and mask operations involving negative " "integers." msgstr "" +"Οι κανόνες για την αναπαράσταση ακεραίων έχουν σκοπό να δώσουν την πιο " +"ουσιαστική ερμηνεία των πράξεων μετατόπισης και κάλυψης που περιλαμβάνουν " +"αρνητικούς ακέραιους αριθμούς." -#: reference/datamodel.rst:236 +#: reference/datamodel.rst:239 msgid "There are two types of integers:" -msgstr "" +msgstr "Υπάρχουν δύο τύποι ακεραίων:" -#: reference/datamodel.rst:243 +#: reference/datamodel.rst:241 msgid "Integers (:class:`int`)" -msgstr "" +msgstr "Ακέραιοι (:class:`int`)" -#: reference/datamodel.rst:239 +#: reference/datamodel.rst:242 msgid "" "These represent numbers in an unlimited range, subject to available " "(virtual) memory only. For the purpose of shift and mask operations, a " @@ -289,12 +433,18 @@ msgid "" "variant of 2's complement which gives the illusion of an infinite string of " "sign bits extending to the left." msgstr "" +"Αυτές αντιπροσωπεύουν αριθμούς σε απεριόριστο εύρος, υπόκεινται μόνο στη " +"διαθέσιμη (εικονική) μνήμη. Για τους σκοπούς των λειτουργιών μετατόπισης " +"και κάλυψης, θεωρείται μια δυαδική αναπαράσταση και οι αρνητικοί αριθμοί " +"αντιπροσωπεύονται σε μια παραλλαγή του συμπληρώματος του 2 που δίνει την " +"ψευδαίσθηση μιας άπειρης συμβολοσειράς bits από bits προσήμου που " +"εκτείνονται προς τα αριστερά." -#: reference/datamodel.rst:256 +#: reference/datamodel.rst:248 msgid "Booleans (:class:`bool`)" -msgstr "" +msgstr "Booleans (:class:`bool`)" -#: reference/datamodel.rst:251 +#: reference/datamodel.rst:254 msgid "" "These represent the truth values False and True. The two objects " "representing the values ``False`` and ``True`` are the only Boolean objects. " @@ -303,86 +453,132 @@ msgid "" "being that when converted to a string, the strings ``\"False\"`` or " "``\"True\"`` are returned, respectively." msgstr "" +"Αυτά αντιπροσωπεύουν τις τιμές αλήθειας False και True. Τα δύο αντικείμενα " +"που αντιπροσωπεύουν τις τιμές ``False`` και ``True`` είναι τα μόνα Boolean " +"αντικείμενα. Ο Boolean τύπος είναι ένας υποτύπος του ακεραίου τύπου και οι " +"Boolean τιμές συμπεριφέρονται όπως οι τιμές 0 και 1, αντίστοιχα, σχεδόν σε " +"όλα τα περιβάλλοντα, οι εξαιρέσεις που μετατρέπονται σε string είναι " +"``\"False\"`` ή ``\"True\"`` επιστρέφονται, αντίστοιχα." -#: reference/datamodel.rst:259 +#: reference/datamodel.rst:264 msgid ":class:`numbers.Real` (:class:`float`)" -msgstr "" +msgstr ":class:`numbers.Real` (:class:`float`)" -#: reference/datamodel.rst:267 +#: reference/datamodel.rst:272 msgid "" -"These represent machine-level double precision floating point numbers. You " +"These represent machine-level double precision floating-point numbers. You " "are at the mercy of the underlying machine architecture (and C or Java " "implementation) for the accepted range and handling of overflow. Python does " -"not support single-precision floating point numbers; the savings in " +"not support single-precision floating-point numbers; the savings in " "processor and memory usage that are usually the reason for using these are " "dwarfed by the overhead of using objects in Python, so there is no reason to " -"complicate the language with two kinds of floating point numbers." -msgstr "" - -#: reference/datamodel.rst:277 +"complicate the language with two kinds of floating-point numbers." +msgstr "" +"Αυτοί αντιπροσωπεύουν αριθμούς κινητής υποδιαστολής διπλής ακρίβειας σε " +"επίπεδο μηχανής. Βρίσκεστε σε έλεος της υποκείμενης αρχιτεκτονικής μηχανής " +"(και της εφαρμογής C ή Java) για το αποδεκτό εύρος και τον χειρισμό " +"υπερχείλισης. Η Python δεν υποστηρίζει αριθμούς κινητής υποδιαστολής απλής " +"ακρίβειας∙ η εξοικονόμηση στη χρήση επεξεργαστή και μνήμης που συνήθως είναι " +"συνήθως ο λόγος για τη χρήση τους μειώνεται από την επιβάρυνση της χρήσης " +"αντικειμένων στην Python, επομένως δεν υπάρχει λόγος να περιπλέκουμε τη " +"γλώσσα με δύο είδη αριθμών κινητής υποδιαστολής." + +#: reference/datamodel.rst:282 msgid ":class:`numbers.Complex` (:class:`complex`)" -msgstr "" +msgstr ":class:`numbers.Complex` (:class:`complex`)" -#: reference/datamodel.rst:283 +#: reference/datamodel.rst:288 msgid "" "These represent complex numbers as a pair of machine-level double precision " -"floating point numbers. The same caveats apply as for floating point " +"floating-point numbers. The same caveats apply as for floating-point " "numbers. The real and imaginary parts of a complex number ``z`` can be " "retrieved through the read-only attributes ``z.real`` and ``z.imag``." msgstr "" +"Αυτοί αντιπροσωπεύουν μιγαδικούς αριθμούς ως ζεύγος αριθμών κινητής " +"υποδιαστολής διπλής ακρίβειας σε επίπεδο μηχανής. Ισχύουν οι ίδιες " +"προειδοποιήσεις όπως και για τους αριθμούς κινητής υποδιαστολής. Τα " +"πραγματικά και τα φανταστικά μέρη ενός μιγαδικού αριθμού ``z`` μπορούν να " +"ανακτηθούν μέσω των χαρακτηριστικών ``z.real`` και ``z.imag`` μόνο για " +"ανάγνωση." -#: reference/datamodel.rst:290 +#: reference/datamodel.rst:295 msgid "Sequences" -msgstr "" +msgstr "Ακολουθίες" -#: reference/datamodel.rst:299 +#: reference/datamodel.rst:304 msgid "" "These represent finite ordered sets indexed by non-negative numbers. The " "built-in function :func:`len` returns the number of items of a sequence. " "When the length of a sequence is *n*, the index set contains the numbers 0, " -"1, ..., *n*-1. Item *i* of sequence *a* is selected by ``a[i]``." -msgstr "" - -#: reference/datamodel.rst:306 +"1, ..., *n*-1. Item *i* of sequence *a* is selected by ``a[i]``. Some " +"sequences, including built-in sequences, interpret negative subscripts by " +"adding the sequence length. For example, ``a[-2]`` equals ``a[n-2]``, the " +"second to last item of sequence a with length ``n``." +msgstr "" +"Αυτά αντιπροσωπεύουν πεπερασμένα διατεταγμένα σύνολα ευρετηριασμένα με μη " +"αρνητικούς αριθμούς. Η ενσωματωμένη συνάρτηση :func:`len` επιστρέφει τον " +"αριθμός των στοιχείων μιας ακολουθίας. Όταν το μήκος μια ακολουθίας είναι " +"*n*, το σύνολο δεικτών περιέχει τους αριθμούς 0, 1, ..., *n*-1. Το στοιχείο " +"*i* της ακολουθίας *a* επιλέγεται από το ``a[i]``. Ορισμένες ακολουθίες, " +"συμπεριλαμβανομένων των ενσωματωμένων ακολουθιών, ερμηνεύουν αρνητικούς " +"δείκτες προσθέτοντας το μήκος της ακολουθίας. Για παράδειγμα, το ``a[-2]`` " +"ισούται με ``a[n-2]``, το δεύτερο έως το τελευταίο στοιχείο της ακολουθίας a " +"με μήκος ``n``." + +#: reference/datamodel.rst:314 msgid "" "Sequences also support slicing: ``a[i:j]`` selects all items with index *k* " "such that *i* ``<=`` *k* ``<`` *j*. When used as an expression, a slice is " -"a sequence of the same type. This implies that the index set is renumbered " -"so that it starts at 0." +"a sequence of the same type. The comment above about negative indexes also " +"applies to negative slice positions." msgstr "" +"Οι ακολουθίες υποστηρίζουν επίσης την τμηματοποίηση: το ``a[i:j]`` επιλέγει " +"όλα τα στοιχεία με ευρετήριο *k* έτσι ώστε *i* ``<=`` *k* ``<`` *j*. Όταν " +"χρησιμοποιείται ως έκφραση, ένα τμήμα είναι μια ακολουθία του ίδιου τύπου. " +"Το παραπάνω σχόλιο σχετικά με τους αρνητικούς δείκτες ισχύει και για " +"αρνητικές θέσεις." -#: reference/datamodel.rst:311 +#: reference/datamodel.rst:319 msgid "" "Some sequences also support \"extended slicing\" with a third \"step\" " "parameter: ``a[i:j:k]`` selects all items of *a* with index *x* where ``x = " "i + n*k``, *n* ``>=`` ``0`` and *i* ``<=`` *x* ``<`` *j*." msgstr "" +"Ορισμένες ακολουθίες υποστηρίζουν επίσης την \"εκτεταμένη τμηματοποίηση\" με " +"μια τρίτη παράμετρο \"βήμα\": το ``a[i:j:k]`` επιλέγει όλα τα στοιχεία του " +"*a* με ευρετήριο *x* όπου ``x = i + n*k``, *n* ``>=`` ``0`` και *i* ``<=`` " +"*x* ``<`` *j*." -#: reference/datamodel.rst:315 +#: reference/datamodel.rst:323 msgid "Sequences are distinguished according to their mutability:" -msgstr "" +msgstr "Οι ακολουθίες διακρίνονται ανάλογα με τη μεταβλητότητά τους:" -#: reference/datamodel.rst:319 +#: reference/datamodel.rst:327 msgid "Immutable sequences" -msgstr "" +msgstr "Αμετάβλητες ακολουθίες" -#: reference/datamodel.rst:325 +#: reference/datamodel.rst:333 msgid "" "An object of an immutable sequence type cannot change once it is created. " "(If the object contains references to other objects, these other objects may " "be mutable and may be changed; however, the collection of objects directly " "referenced by an immutable object cannot change.)" msgstr "" +"Ένα αντικείμενο ενός τύπου αμετάβλητης ακολουθίας δεν μπορεί να αλλάξει " +"μόλις δημιουργηθεί. (Εάν το αντικείμενο περιέχει αναφορές σε άλλα " +"αντικείμενα, αυτά τα άλλα αντικείμενα μπορεί να είναι μεταβλητά και μπορεί " +"να αλλάξουν∙ ωστόσο, η συλλογή αντικειμένων που αναφέρονται απευθείας από " +"ένα αμετάβλητο αντικείμενο δεν μπορεί να αλλάξει.)" -#: reference/datamodel.rst:330 +#: reference/datamodel.rst:338 msgid "The following types are immutable sequences:" -msgstr "" +msgstr "Οι ακόλουθοι τύποι είναι αμετάβλητες ακολουθίες:" -#: reference/datamodel.rst:353 +#: reference/datamodel.rst:343 msgid "Strings" -msgstr "" +msgstr "Συμβολοσειρές" -#: reference/datamodel.rst:343 +#: reference/datamodel.rst:351 msgid "" "A string is a sequence of values that represent Unicode code points. All the " "code points in the range ``U+0000 - U+10FFFF`` can be represented in a " @@ -395,12 +591,24 @@ msgid "" "`bytes` using the given text encoding, and :meth:`bytes.decode` can be used " "to achieve the opposite." msgstr "" - -#: reference/datamodel.rst:366 +"Μια συμβολοσειρά είναι μια ακολουθία τιμών που αντιπροσωπεύουν σημεία κώδικα " +"Unicode. Όλα τα σημεία κώδικα στο εύρος ``U+0000 - U+10FFFF`` μπορούν να " +"αναπαρασταθούν σε μια συμβολοσειρά. Η Python δεν έχει τύπο :c:expr:`char` ∙ " +"αντίθετα, κάθε σημείο κώδικα στη συμβολοσειρά αντιπροσωπεύεται ως " +"αντικείμενο συμβολοσειράς με μήκος ``1``. Η ενσωματωμένη συνάρτηση :func:" +"`ord` μετατρέπει ένα σημείο κώδικα από τη μορφή συμβολοσειράς του σε έναν " +"ακέραιο στο εύρος ``0 - 10FFFF`` ∙ η :func:`chr` μετατρέπει έναν ακέραιο στο " +"εύρος ``0 - 10FFFF`` στο αντικείμενο συμβολοσειράς αντίστοιχου μήκους ``1``. " +"Η :meth:`str.encode` μπορεί να χρησιμοποιηθεί για τη μετατροπή μιας :class:" +"`str` σε :class:`bytes` χρησιμοποιώντας τη δεδομένη κωδικοποίηση κειμένου " +"και η :meth:`bytes.decode` μπορεί να χρησιμοποιηθεί για να επιτευχθεί το " +"αντίθετο." + +#: reference/datamodel.rst:363 msgid "Tuples" -msgstr "" +msgstr "Πλειάδες (Tuples)" -#: reference/datamodel.rst:361 +#: reference/datamodel.rst:369 msgid "" "The items of a tuple are arbitrary Python objects. Tuples of two or more " "items are formed by comma-separated lists of expressions. A tuple of one " @@ -409,69 +617,96 @@ msgid "" "usable for grouping of expressions). An empty tuple can be formed by an " "empty pair of parentheses." msgstr "" +"Τα στοιχεία της πλειάδας είναι αυθαίρετα αντικείμενα Python. Οι πλειάδες δύο " +"ή περισσότερων αντικειμένων σχηματίζονται από λίστες εκφράσεων διαχωρισμένων " +"με κόμμα. Μια πλειάδα ενός στοιχείο (ενός «singleton») μπορεί να " +"σχηματιστεί με την τοποθέτηση ενός κόμματος σε μια έκφραση (μια έκφραση από " +"μόνη της δεν δημιουργεί πλειάδα, αφού οι παρενθέσεις μπορούν να " +"χρησιμοποιηθούν για ομαδοποίηση εκφράσεων). Μια κενή πλειάδα μπορεί να " +"σχηματιστεί από ένα κενό ζευγάρι παρενθέσεων." #: reference/datamodel.rst:376 msgid "Bytes" -msgstr "" +msgstr "Bytes" -#: reference/datamodel.rst:371 +#: reference/datamodel.rst:379 msgid "" "A bytes object is an immutable array. The items are 8-bit bytes, " "represented by integers in the range 0 <= x < 256. Bytes literals (like " -"``b'abc'``) and the built-in :func:`bytes()` constructor can be used to " -"create bytes objects. Also, bytes objects can be decoded to strings via " -"the :meth:`~bytes.decode` method." -msgstr "" - -#: reference/datamodel.rst:379 +"``b'abc'``) and the built-in :func:`bytes` constructor can be used to create " +"bytes objects. Also, bytes objects can be decoded to strings via the :meth:" +"`~bytes.decode` method." +msgstr "" +"Ένα αντικείμενο bytes είναι ένας αμετάβλητος πίνακας. Τα στοιχεία είναι " +"bytes των 8-bit, που αντιπροσωπεύονται από ακέραιους αριθμούς στο εύρος 0 <= " +"x < 256. Τα bytes literals (όπως ``b'abc'``) και ο ενσωματωμένος " +"κατασκευαστής :func:`bytes` μπορεί να χρησιμοποιηθεί για τη δημιουργία " +"αντικειμένων bytes. Επίσης, τα αντικείμενα bytes μπορούν να " +"αποκωδικοποιηθούν σε συμβολοσειρές μέσω της μεθόδου :meth:`~bytes.decode`." + +#: reference/datamodel.rst:387 msgid "Mutable sequences" -msgstr "" +msgstr "Μεταβλητές ακολουθίες" -#: reference/datamodel.rst:388 +#: reference/datamodel.rst:396 msgid "" "Mutable sequences can be changed after they are created. The subscription " "and slicing notations can be used as the target of assignment and :keyword:" "`del` (delete) statements." msgstr "" +"Οι μεταβλητές ακολουθίες μπορούν να αλλάξουν αφού δημιουργηθούν. Οι " +"σημειώσεις εγγραφής και τμηματοποίησης μπορούν να χρησιμοποιηθούν ως στόχος " +"εκχώρησης και δηλώσεων :keyword:`del` (delete)." -#: reference/datamodel.rst:396 +#: reference/datamodel.rst:404 msgid "" "The :mod:`collections` and :mod:`array` module provide additional examples " "of mutable sequence types." msgstr "" +"Τα modules :mod:`collections` και :mod:`array` παρέχουν πρόσθετα " +"παραδείγματα μεταβλητών τύπων ακολουθιών." -#: reference/datamodel.rst:399 +#: reference/datamodel.rst:407 msgid "There are currently two intrinsic mutable sequence types:" -msgstr "" +msgstr "Υπάρχουν επί του παρόντος δύο εγγενείς τύποι μεταβλητών ακολουθιών:" -#: reference/datamodel.rst:406 +#: reference/datamodel.rst:409 msgid "Lists" -msgstr "" +msgstr "Λίστες" -#: reference/datamodel.rst:404 +#: reference/datamodel.rst:412 msgid "" "The items of a list are arbitrary Python objects. Lists are formed by " "placing a comma-separated list of expressions in square brackets. (Note that " "there are no special cases needed to form lists of length 0 or 1.)" msgstr "" +"Τα στοιχεία μιας λίστας είναι αυθαίρετα αντικείμενα Python. Οι λίστες " +"σχηματίζονται τοποθετώντας μια λίστα εκφράσεων διαχωρισμένων με κόμματα σε " +"αγκύλες. (Σημειώστε ότι δεν χρειάζονται ειδικές περιπτώσεις για να " +"σχηματιστούν λίστες μήκους 0 ή 1.)" -#: reference/datamodel.rst:415 +#: reference/datamodel.rst:416 msgid "Byte Arrays" -msgstr "" +msgstr "Πίνακες Byte" -#: reference/datamodel.rst:411 +#: reference/datamodel.rst:419 msgid "" "A bytearray object is a mutable array. They are created by the built-in :" "func:`bytearray` constructor. Aside from being mutable (and hence " "unhashable), byte arrays otherwise provide the same interface and " "functionality as immutable :class:`bytes` objects." msgstr "" +"Ένα αντικείμενο bytearray είναι ένα ευμετάβλητος πίνακας. Δημιουργούνται από " +"τον ενσωματωμένο κατασκευαστή :func:`bytearray`. Εκτός από το ότι είναι " +"μεταβλητοί (και επομένως μη κατακερματισμένοι), οι πίνακες byte κατά τα άλλα " +"παρέχουν την ίδια διεπαφή και λειτουργικότητα με τα αμετάβλητα αντικείμενα :" +"class:`bytes`." -#: reference/datamodel.rst:418 +#: reference/datamodel.rst:426 msgid "Set types" -msgstr "" +msgstr "Σύνολο τύπων" -#: reference/datamodel.rst:424 +#: reference/datamodel.rst:432 msgid "" "These represent unordered, finite sets of unique, immutable objects. As " "such, they cannot be indexed by any subscript. However, they can be iterated " @@ -480,46 +715,65 @@ msgid "" "from a sequence, and computing mathematical operations such as intersection, " "union, difference, and symmetric difference." msgstr "" +"Αυτά αντιπροσωπεύουν μη διατεταγμένα, πεπερασμένα, σύνολα μοναδικών, " +"αμετάβλητων αντικειμένων. Ως εκ τούτου, δεν μπορούν να ευρετηριοποιηθούν από " +"κανένα δείκτη. Ωστόσο, μπορούν να επαναληφθούν και η ενσωματωμένη συνάρτηση :" +"func:`len` επιστρέφει τον αριθμό των στοιχείων σε ένα σύνολο. Συνήθεις " +"χρήσεις για τα σύνολα είναι ο γρήγορος έλεγχος ιδιότητας μέλους, η αφαίρεση " +"διπλότυπων από μια αλληλουχία, μη συνδυαστική λειτουργία, και συμμετρική " +"διαφορά." -#: reference/datamodel.rst:431 +#: reference/datamodel.rst:439 msgid "" "For set elements, the same immutability rules apply as for dictionary keys. " "Note that numeric types obey the normal rules for numeric comparison: if two " "numbers compare equal (e.g., ``1`` and ``1.0``), only one of them can be " "contained in a set." msgstr "" +"Για τα στοιχεία συνόλου ισχύουν οι ίδιοι κανόνες αμετάβλητης όπως και για τα " +"κλειδιά λεξικού. Λάβετε υπόψη ότι οι αριθμητικοί τύποι λειτουργία στους " +"κανονικούς κανόνες για αριθμητική σύγκριση: εάν δύο αριθμοί συγκρίνονται " +"ίσοι (π.χ. ``1`` και ``1.0``), μόνο ένας από αυτούς μπορεί να περιέχεται σε " +"ένα σύνολο." -#: reference/datamodel.rst:436 +#: reference/datamodel.rst:444 msgid "There are currently two intrinsic set types:" -msgstr "" +msgstr "Υπάρχουν επί του παρόντος δύο εγγενείς τύποι συνόλων:" -#: reference/datamodel.rst:445 +#: reference/datamodel.rst:447 msgid "Sets" -msgstr "" +msgstr "Σύνολα" -#: reference/datamodel.rst:442 +#: reference/datamodel.rst:450 msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " "constructor and can be modified afterwards by several methods, such as :meth:" -"`~set.add`." +"`add `." msgstr "" +"Αυτά αντιπροσωπεύουν ένα μεταβλητό σύνολο. Δημιουργούνται από τον " +"ενσωματωμένο κατασκευαστή :func:`set` και μπορούν να τροποποιηθούν στη " +"συνέχεια με διάφορες μεθόδους, όπως :meth:`add `." -#: reference/datamodel.rst:454 +#: reference/datamodel.rst:455 msgid "Frozen sets" -msgstr "" +msgstr "Frozen σύνολα" -#: reference/datamodel.rst:450 +#: reference/datamodel.rst:458 msgid "" "These represent an immutable set. They are created by the built-in :func:" "`frozenset` constructor. As a frozenset is immutable and :term:`hashable`, " "it can be used again as an element of another set, or as a dictionary key." msgstr "" +"Αυτά αντιπροσωπεύουν ένα αμετάβλητο σύνολο. Δημιουργούνται από τον " +"ενσωματωμένο κατασκευαστή :func:`frozenset`. Καθώς ένα παγωμένο σύνολο είναι " +"αμετάβλητο και το :term:`hashable`, μπορεί να χρησιμοποιηθεί ξανά ως " +"στοιχείο ενός άλλου συνόλου ή ως κλειδί λεξικού." -#: reference/datamodel.rst:457 +#: reference/datamodel.rst:465 msgid "Mappings" -msgstr "" +msgstr "Αντιστοιχίσεις" -#: reference/datamodel.rst:464 +#: reference/datamodel.rst:472 msgid "" "These represent finite sets of objects indexed by arbitrary index sets. The " "subscript notation ``a[k]`` selects the item indexed by ``k`` from the " @@ -527,16 +781,22 @@ msgid "" "assignments or :keyword:`del` statements. The built-in function :func:`len` " "returns the number of items in a mapping." msgstr "" +"Αυτά αντιπροσωπεύουν πεπερασμένα σύνολα αντικειμένων που ευρετηριάζονται από " +"αυθαίρετα σύνολα ευρετηρίου. Ο συμβολικός συμβολισμός ``a[k]`` επιλέγει το " +"στοιχείο που ευρετηριάζεται με ``k`` από την αντιστοίχιση ``a`` · αυτό " +"μπορεί να χρησιμοποιηθεί σε εκφράσεις και ως στόχος αναθέσεων ή δηλώσεων :" +"keyword:`del`. Η ενσωματωμένη συνάρτηση :func:`len` επιστρέφει τον αριθμό " +"των στοιχείων σε μια αντιστοίχιση." -#: reference/datamodel.rst:470 +#: reference/datamodel.rst:478 msgid "There is currently a single intrinsic mapping type:" -msgstr "" +msgstr "Υπάρχει επί του παρόντος ένας ενιαίος εγγενής τύπος αντιστοίχισης:" -#: reference/datamodel.rst:474 +#: reference/datamodel.rst:482 msgid "Dictionaries" -msgstr "" +msgstr "Λεξικά" -#: reference/datamodel.rst:478 +#: reference/datamodel.rst:486 msgid "" "These represent finite sets of objects indexed by nearly arbitrary values. " "The only types of values not acceptable as keys are values containing lists " @@ -547,235 +807,343 @@ msgid "" "numbers compare equal (e.g., ``1`` and ``1.0``) then they can be used " "interchangeably to index the same dictionary entry." msgstr "" +"Αυτά αντιπροσωπεύουν πεπερασμένα σύνολα αντικειμένων που ευρετηριάζονται με " +"σχεδόν αυθαίρετες τιμές. Οι μόνοι τύποι τιμών που δεν είναι αποδεκτοί ως " +"κλειδιά είναι τιμές που περιέχουν λίστες ή λεξικά ή άλλους μεταβλητούς " +"τύπους που συγκρίνονται με βάση την τιμή και όχι με την ταυτότητα " +"αντικειμένου, ο λόγος είναι ότι η αποτελεσματική υλοποίηση λεξικών απαιτεί " +"τιμή κατακερματισμού ενός κλειδιού να παραμένει σταθερή. Οι αριθμητικοί " +"τύποι που χρησιμοποιούνται για κλειδιά υπακούουν στους κανονικούς κανόνες " +"για αριθμητική σύγκριση: εάν δύο αριθμοί συγκρίνονται ίσοι (π.χ. ``1`` και " +"``1.0``), τότε μπορούν να χρησιμοποιηθούν εναλλακτικά για την ευρετηρίαση " +"της ίδιας καταχώρησης λεξικού." -#: reference/datamodel.rst:487 +#: reference/datamodel.rst:495 msgid "" "Dictionaries preserve insertion order, meaning that keys will be produced in " "the same order they were added sequentially over the dictionary. Replacing " "an existing key does not change the order, however removing a key and re-" "inserting it will add it to the end instead of keeping its old place." msgstr "" +"Τα λεξικά διατηρούν τη σειρά εισαγωγής, πράγμα που σημαίνει ότι τα κλειδιά " +"θα παράγονται με την ίδια σειρά που προστέθηκαν διαδοχικά στο λεξικό. Η " +"αντικατάσταση ενός υπάρχοντος κλειδιού δεν αλλάζει τη σειρά, ωστόσο η " +"αφαίρεση ενός κλειδιού και η επανεισαγωγή του θα προσθέσει στο τέλος αντί να " +"διατηρήσει την παλιά του θέση." -#: reference/datamodel.rst:492 +#: reference/datamodel.rst:500 msgid "" -"Dictionaries are mutable; they can be created by the ``{...}`` notation (see " +"Dictionaries are mutable; they can be created by the ``{}`` notation (see " "section :ref:`dict`)." msgstr "" +"Τα λεξικά είναι μεταβλητά· μπορούν να δημιουργηθούν με τη σημείωση ``{...}`` " +"(βλ. ενότητα :ref:`dict`)." -#: reference/datamodel.rst:499 +#: reference/datamodel.rst:507 msgid "" "The extension modules :mod:`dbm.ndbm` and :mod:`dbm.gnu` provide additional " "examples of mapping types, as does the :mod:`collections` module." msgstr "" +"Τα modules επέκτασης :mod:`dbm.ndbm` και :mod:`dbm.gnu` παρέχουν πρόσθετα " +"παραδείγματα τύπων αντιστοίχισης, όπως και το module :mod:`collections`." -#: reference/datamodel.rst:503 +#: reference/datamodel.rst:511 msgid "" "Dictionaries did not preserve insertion order in versions of Python before " "3.6. In CPython 3.6, insertion order was preserved, but it was considered an " "implementation detail at that time rather than a language guarantee." msgstr "" +"Τα λεξικά δεν διατήρησαν τη σειρά εισαγωγής σε εκδόσεις της Python πριν από " +"την 3.6. Στη CPython 3.6, η σειρά εισαγωγής διατηρήθηκε, αλλά θεωρήθηκε ως " +"λεπτομέρεια υλοποίησης εκείνη τη στιγμή και όχι ως εγγύηση γλώσσας." -#: reference/datamodel.rst:510 +#: reference/datamodel.rst:518 msgid "Callable types" -msgstr "" +msgstr "Τύποι με δυνατότητα κλήσης" -#: reference/datamodel.rst:518 +#: reference/datamodel.rst:526 msgid "" "These are the types to which the function call operation (see section :ref:" "`calls`) can be applied:" msgstr "" +"Αυτοί είναι οι τύποι στους οποίους μπορεί να εφαρμοστεί η λειτουργία κλήσης " +"συνάρτησης (βλ. ενότητα :ref:`calls`) :" -#: reference/datamodel.rst:525 +#: reference/datamodel.rst:533 msgid "User-defined functions" -msgstr "" +msgstr "Συναρτήσεις που ορίζονται από τον χρήστη" -#: reference/datamodel.rst:532 +#: reference/datamodel.rst:540 msgid "" "A user-defined function object is created by a function definition (see " "section :ref:`function`). It should be called with an argument list " "containing the same number of items as the function's formal parameter list." msgstr "" +"Ένα αντικείμενο συνάρτησης που ορίζεται από τον χρήστη δημιουργείται από " +"έναν ορισμό συνάρτησης (βλ. ενότητα :ref:`function`). Θα πρέπει να καλείται " +"με μια λίστα ορισμών που περιέχει τον ίδιο αριθμό στοιχείων με την επίσημη " +"λίστα παραμέτρων της συνάρτησης." -#: reference/datamodel.rst:1127 reference/datamodel.rst:1322 +#: reference/datamodel.rst:1447 reference/datamodel.rst:1648 msgid "Special read-only attributes" -msgstr "" +msgstr "Ειδικά χαρακτηριστικά μόνο για ανάγνωση" -#: reference/datamodel.rst:582 +#: reference/datamodel.rst:592 reference/datamodel.rst:1195 msgid "Attribute" -msgstr "" +msgstr "Χαρακτηριστικό" -#: reference/datamodel.rst:583 +#: reference/datamodel.rst:593 reference/datamodel.rst:1196 msgid "Meaning" -msgstr "" +msgstr "Έννοια" -#: reference/datamodel.rst:552 +#: reference/datamodel.rst:560 msgid "" "A reference to the :class:`dictionary ` that holds the function's :ref:" "`global variables ` -- the global namespace of the module in which " "the function was defined." msgstr "" +"Μια αναφορά στη :class:`dictionary ` που περιέχει τις :ref:`global " +"variables ` -- τον καθολικό χώρο ονομάτων του module στην οποία " +"ορίστηκε η συνάρτηση." -#: reference/datamodel.rst:557 +#: reference/datamodel.rst:565 msgid "" -"``None`` or a :class:`tuple` of cells that contain bindings for the " -"function's free variables." +"``None`` or a :class:`tuple` of cells that contain bindings for the names " +"specified in the :attr:`~codeobject.co_freevars` attribute of the " +"function's :attr:`code object `." msgstr "" +"Το ``None`` ή μια :class:`tuple` από κελιά που περιέχουν δεσμεύσεις για τα " +"ονόματα που καθορίζονται στο χαρακτηριστικό :attr:`~codeobject.co_freevars` " +"του :attr:`code object ` της συνάρτησης." -#: reference/datamodel.rst:560 +#: reference/datamodel.rst:569 msgid "" "A cell object has the attribute ``cell_contents``. This can be used to get " "the value of the cell, as well as set the value." msgstr "" +"Ένα αντικείμενο κελιού έχει το χαρακτηριστικό ``cell_contents``. Αυτό μπορεί " +"να χρησιμοποιηθεί για να ληφθεί η τιμή του κελιού, καθώς και να οριστεί η " +"τιμή." -#: reference/datamodel.rst:1359 +#: reference/datamodel.rst:1696 msgid "Special writable attributes" -msgstr "" +msgstr "Ειδικά εγγράψιμα χαρακτηριστικά" -#: reference/datamodel.rst:577 +#: reference/datamodel.rst:587 msgid "Most of these attributes check the type of the assigned value:" msgstr "" +"Τα περισσότερα από αυτά τα χαρακτηριστικά ελέγχουν τον τύπο της εκχωρημένης " +"τιμής:" -#: reference/datamodel.rst:586 -msgid "" -"The function's documentation string, or ``None`` if unavailable. Not " -"inherited by subclasses." +#: reference/datamodel.rst:596 +msgid "The function's documentation string, or ``None`` if unavailable." msgstr "" +"Η συμβολοσειρά τεκμηρίωσης της συνάρτηση ή ``None`` εάν δεν είναι διαθέσιμη." -#: reference/datamodel.rst:590 +#: reference/datamodel.rst:599 msgid "" "The function's name. See also: :attr:`__name__ attributes `." msgstr "" +"Το όνομα της συνάρτησης. Δείτε επίσης :attr:`__name__ attributes `." -#: reference/datamodel.rst:594 +#: reference/datamodel.rst:603 msgid "" "The function's :term:`qualified name`. See also: :attr:`__qualname__ " "attributes `." msgstr "" +"Η συνάρτηση είναι :term:`qualified name`. Δείτε επίσης :attr:`__qualname__ " +"attributes `." -#: reference/datamodel.rst:600 +#: reference/datamodel.rst:609 msgid "" "The name of the module the function was defined in, or ``None`` if " "unavailable." msgstr "" +"Το όνομα του module στην οποία ορίστηκε η συνάρτηση ή ``None`` εάν δεν είναι " +"διαθέσιμη." -#: reference/datamodel.rst:604 +#: reference/datamodel.rst:613 msgid "" "A :class:`tuple` containing default :term:`parameter` values for those " "parameters that have defaults, or ``None`` if no parameters have a default " "value." msgstr "" +"Ένα :class:`tuple` που περιέχει προεπιλεγμένες τιμές :term:`parameter` για " +"εκείνες τις παραμέτρους που έχουν προεπιλογές ή ``None`` εάν καμία " +"παράμετρος δεν έχει προεπιλεγμένη τιμή." -#: reference/datamodel.rst:609 +#: reference/datamodel.rst:618 msgid "" "The :ref:`code object ` representing the compiled function " "body." msgstr "" +"Το αντικείμενο :ref:`code object ` που αντιπροσωπεύει το " +"μεταγλωττισμένο σώμα συνάρτησης." -#: reference/datamodel.rst:613 +#: reference/datamodel.rst:622 msgid "" "The namespace supporting arbitrary function attributes. See also: :attr:" "`__dict__ attributes `." msgstr "" +"Ο χώρος ονομάτων που υποστηρίζει αυθαίρετα χαρακτηριστικά συνάρτησης. Δείτε " +"επίσης :attr:`__dict__ attributes `." -#: reference/datamodel.rst:617 +#: reference/datamodel.rst:626 msgid "" "A :class:`dictionary ` containing annotations of :term:`parameters " "`. The keys of the dictionary are the parameter names, and " -"``'return'`` for the return annotation, if provided. See also: :ref:" -"`annotations-howto`." +"``'return'`` for the return annotation, if provided. See also: :attr:`object." +"__annotations__`." +msgstr "" +"Μια :class:`dictionary ` που περιέχει annotations για :term:" +"`parameters `. Τα κλειδιά του λεξικού είναι τα ονόματα των " +"παραμέτρων και ``'return'``, για το annotation επιστροφής, εάν παρέχεται. " +"Δείτε επίσης: :attr:`object.__annotations__`." + +#: reference/datamodel.rst:1101 reference/datamodel.rst:1253 +msgid "" +"Annotations are now :ref:`lazily evaluated `. See :pep:" +"`649`." +msgstr "" +"Τα annotations πλέον :ref:`lazily evaluated `. Βλ. :pep:" +"`649`." + +#: reference/datamodel.rst:637 +msgid "" +"The :term:`annotate function` for this function, or ``None`` if the function " +"has no annotations. See :attr:`object.__annotate__`." msgstr "" +"Η :term:`annotate function` για αυτή τη συνάρτηση ή ``None`` εάν η συνάρτηση " +"δεν έχει annotations. Δείτε :attr:`object.__annotate__`." -#: reference/datamodel.rst:624 +#: reference/datamodel.rst:643 msgid "" "A :class:`dictionary ` containing defaults for keyword-only :term:" "`parameters `." msgstr "" +"Μια :class:`dictionary ` που περιέχει προεπιλογές για λέξεις-κλειδιά " +"μόνο :term:`parameters `." -#: reference/datamodel.rst:628 +#: reference/datamodel.rst:647 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic function `." msgstr "" +"Μια :class:`tuple` που περιέχει τις παραμέτρους :ref:`type parameters ` μιας :ref:`generic function `." -#: reference/datamodel.rst:633 +#: reference/datamodel.rst:652 msgid "" "Function objects also support getting and setting arbitrary attributes, " "which can be used, for example, to attach metadata to functions. Regular " "attribute dot-notation is used to get and set such attributes." msgstr "" +"Τα αντικείμενα συναρτήσεων υποστηρίζουν επίσης τη λήψη και τον καθορισμό " +"αυθαίρετων χαρακτηριστικών , τα οποία μπορούν να χρησιμοποιηθούν, για " +"παράδειγμα, για την επισύναψη μεταδεδομένων σε συναρτήσεις. Η τυπική " +"σημειογραφία σημείων χαρακτηριστικών χρησιμοποιείται για τη λήψη και τον " +"ορισμό τέτοιων χαρακτηριστικών." -#: reference/datamodel.rst:639 +#: reference/datamodel.rst:658 msgid "" "CPython's current implementation only supports function attributes on user-" "defined functions. Function attributes on :ref:`built-in functions ` may be supported in the future." msgstr "" +"Η τρέχουσα υλοποίηση του CPython υποστηρίζει μόνο χαρακτηριστικά συναρτήσεων " +"σε συναρτήσεις που καθορίζονται από τον χρήστη. Τα χαρακτηριστικά " +"συναρτήσεων σε :ref:`built-in functions ` ενδέχεται να " +"υποστηρίζονται στο μέλλον." -#: reference/datamodel.rst:644 +#: reference/datamodel.rst:663 msgid "" "Additional information about a function's definition can be retrieved from " "its :ref:`code object ` (accessible via the :attr:`~function." "__code__` attribute)." msgstr "" +"Μπορούν να ανακτηθούν πρόσθετες πληροφορίες σχετικά με τον ορισμό μιας " +"συνάρτησης από το αντικείμενο :ref:`code object ` (προσβάσιμο " +"μέσω του χαρακτηριστικού :attr:`~function.__code__`)." -#: reference/datamodel.rst:652 +#: reference/datamodel.rst:671 msgid "Instance methods" -msgstr "" +msgstr "Μέθοδοι Στιγμιοτύπου" -#: reference/datamodel.rst:659 +#: reference/datamodel.rst:678 msgid "" "An instance method object combines a class, a class instance and any " "callable object (normally a user-defined function)." msgstr "" +"Ένα αντικείμενο μεθόδου στιγμιοτύπου συνδυάζει μια κλάση, ένα στιγμιότυπο " +"κλάσης και οποιοδήποτε αντικείμενο που μπορεί να κληθεί (συνήθως μια " +"συνάρτηση που ορίζεται από τον χρήστη.)" -#: reference/datamodel.rst:1450 +#: reference/datamodel.rst:1792 msgid "Special read-only attributes:" -msgstr "" +msgstr "Ειδικά χαρακτηριστικά μόνο για ανάγνωση:" -#: reference/datamodel.rst:674 +#: reference/datamodel.rst:693 msgid "" "Refers to the class instance object to which the method is :ref:`bound " "`" msgstr "" +"Αναφέρεται στο αντικείμενο στιγμιοτύπου κλάσης στο οποίο βρίσκεται η " +"μέθοδος :ref:`bound `" -#: reference/datamodel.rst:678 +#: reference/datamodel.rst:697 msgid "Refers to the original :ref:`function object `" -msgstr "" +msgstr "Αναφέρεται στο αρχικό :ref:`function object `" -#: reference/datamodel.rst:681 +#: reference/datamodel.rst:700 msgid "" "The method's documentation (same as :attr:`method.__func__.__doc__ `). A :class:`string ` if the original function had a " "docstring, else ``None``." msgstr "" +"Η τεκμηρίωση της μεθόδου (ίδια με την :attr:`method.__func__.__doc__ " +"`). Μια :class:`string ` εάν η αρχική συνάρτηση είχε " +"docstring, αλλιώς ``None``." -#: reference/datamodel.rst:687 +#: reference/datamodel.rst:706 msgid "" "The name of the method (same as :attr:`method.__func__.__name__ `)" msgstr "" +"Το όνομα της μεθόδου (ίδιο με το :attr:`method.__func__.__name__ `)" -#: reference/datamodel.rst:691 +#: reference/datamodel.rst:710 msgid "" "The name of the module the method was defined in, or ``None`` if unavailable." msgstr "" +"Το όνομα του module στην οποία ορίστηκε η μέθοδος, ή ``None`` εάν δεν είναι " +"διαθέσιμη." -#: reference/datamodel.rst:694 +#: reference/datamodel.rst:713 msgid "" "Methods also support accessing (but not setting) the arbitrary function " "attributes on the underlying :ref:`function object `." msgstr "" +"Οι μέθοδοι υποστηρίζουν επίσης την πρόσβαση (αλλά όχι τη ρύθμιση) των " +"αυθαίρετων χαρακτηριστικών συνάρτησης στο υποκείμενο αντικείμενο :ref:" +"`function object `." -#: reference/datamodel.rst:697 +#: reference/datamodel.rst:716 msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" "defined :ref:`function object ` or a :class:" "`classmethod` object." msgstr "" +"Τα αντικείμενα μεθόδου που ορίζονται από το χρήστη μπορούν να δημιουργηθούν " +"όταν λαμβάνεται ένα χαρακτηριστικό μιας κλάσης (ίσως μέσω ενός στιγμιοτύπου " +"αυτής της κλάσης), εάν αυτό το χαρακτηριστικό είναι ένα αντικείμενο :ref:" +"`function object ` ή ένα αντικείμενο :class:" +"`classmethod`." -#: reference/datamodel.rst:704 +#: reference/datamodel.rst:723 msgid "" "When an instance method object is created by retrieving a user-defined :ref:" "`function object ` from a class via one of its " @@ -783,16 +1151,27 @@ msgid "" "method object is said to be *bound*. The new method's :attr:`~method." "__func__` attribute is the original function object." msgstr "" +"Όταν δημιουργείται ένα αντικείμενο μεθόδου στιγμιοτύπου ανακτώντας ένα " +"αντικείμενο :ref:`function object ` που ορίζεται από το " +"χρήστη από μια κλάση, το χαρακτηριστικό :attr:`~method.__self__` είναι το " +"στιγμιότυπο και το αντικείμενό της μεθόδου λέγεται ότι είναι *δεσμευμένο*. " +"Το χαρακτηριστικό :attr:`~method.__func__` της νέας μεθόδου είναι το αρχικό " +"αντικείμενο συνάρτησης." -#: reference/datamodel.rst:710 +#: reference/datamodel.rst:729 msgid "" "When an instance method object is created by retrieving a :class:" "`classmethod` object from a class or instance, its :attr:`~method.__self__` " "attribute is the class itself, and its :attr:`~method.__func__` attribute is " "the function object underlying the class method." msgstr "" +"Όταν ένα αντικείμενο μεθόδου παρουσίας δημιουργείται με ανάκτηση ενός " +"αντικειμένου :class:`classmethod` από μια κλάση ή στιγμιότυπο, το " +"χαρακτηριστικό :attr:`~method.__self__` είναι η ίδια κλάση και το " +"χαρακτηριστικό :attr:`~method.__func__` είναι το αντικείμενο συνάρτησης που " +"βρίσκεται κάτω από τη μέθοδο κλάσης." -#: reference/datamodel.rst:715 +#: reference/datamodel.rst:734 msgid "" "When an instance method object is called, the underlying function (:attr:" "`~method.__func__`) is called, inserting the class instance (:attr:`~method." @@ -801,8 +1180,14 @@ msgid "" "an instance of :class:`!C`, calling ``x.f(1)`` is equivalent to calling ``C." "f(x, 1)``." msgstr "" +"Όταν καλείται ένα αντικείμενο μεθόδου στιγμιοτύπου, καλείται η υποκείμενη " +"συνάρτηση (:attr:`~method.__func__`), εισάγοντας το στιγμιότυπο κλάσης (:" +"attr:`~method.__self__`) μπροστά από τη λίστα ορισμάτων. Για παράδειγμα, " +"όταν η :class:`!C` είναι μια κλάση που περιέχει έναν ορισμό για μια " +"συνάρτηση :meth:`!f`, και το ``x`` είναι ένα στιγμιότυπο της :class:`!C`, η " +"κλήση του ``x.f(1)`` ισοδυναμεί με την κλήση του ``C.f(x, 1)``." -#: reference/datamodel.rst:722 +#: reference/datamodel.rst:741 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " @@ -810,25 +1195,28 @@ msgid "" "f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " "function." msgstr "" +"Όταν ένα αντικείμενο μεθόδου στιγμιοτύπου προέρχεται από ένα αντικείμενο :" +"class:`classmethod`, το \"στιγμιότυπο κλάσης\" που είναι αποθηκευμένο στη :" +"attr:`~method.__self__` θα είναι στη πραγματικότητα η ίδια η κλάση, έτσι " +"ώστε η κλήση είτε του ``x.f(1)`` ή του ``C.f(1)`` ισοδυναμεί με την κλήση " +"του ``f(C,1)`` όπου το ``f`` είναι η υποκείμενη συνάρτηση." -#: reference/datamodel.rst:727 +#: reference/datamodel.rst:746 msgid "" -"Note that the transformation from :ref:`function object ` to instance method object happens each time the attribute is " -"retrieved from the instance. In some cases, a fruitful optimization is to " -"assign the attribute to a local variable and call that local variable. Also " -"notice that this transformation only happens for user-defined functions; " -"other callable objects (and all non-callable objects) are retrieved without " -"transformation. It is also important to note that user-defined functions " -"which are attributes of a class instance are not converted to bound methods; " -"this *only* happens when the function is an attribute of the class." +"It is important to note that user-defined functions which are attributes of " +"a class instance are not converted to bound methods; this *only* happens " +"when the function is an attribute of the class." msgstr "" +"Είναι σημαντικό να σημειωθεί ότι οι συναρτήσεις που ορίζονται από το χρήστη " +"και είναι χαρακτηριστικό ενός στιγμιοτύπου μιας κλάσης δεν μετατρέπονται σε " +"δεσμευμένες μεθόδους∙ Αυτό συμβαίνει *μόνο* όταν η συνάρτηση είναι " +"χαρακτηριστικό της κλάσης." -#: reference/datamodel.rst:741 +#: reference/datamodel.rst:753 msgid "Generator functions" -msgstr "" +msgstr "Generator Συναρτήσεις" -#: reference/datamodel.rst:747 +#: reference/datamodel.rst:759 msgid "" "A function or method which uses the :keyword:`yield` statement (see section :" "ref:`yield`) is called a :dfn:`generator function`. Such a function, when " @@ -840,12 +1228,21 @@ msgid "" "exception is raised and the iterator will have reached the end of the set of " "values to be returned." msgstr "" - -#: reference/datamodel.rst:759 +"Μια συνάρτηση ή μέθοδος που χρησιμοποιεί τη δήλωση :keyword:`yield` (βλ. " +"ενότητα :ref:`yield`) ονομάζεται :dfn:`generator function`. Μια τέτοια " +"συνάρτηση, όταν καλείται, επιστρέφει πάντα ένα αντικείμενο :term:`iterator` " +"που μπορεί να χρησιμοποιηθεί για την εκτέλεση του σώματος της συνάρτησης: " +"καλώντας τη μέθοδο :meth:`iterator.__next__` του iterator θα προκαλέσει την " +"εκτέλεση της συνάρτησης έως ότου παρέχει μια τιμή χρησιμοποιώντας τη δήλωση :" +"keyword:`!yield`. Όταν η συνάρτηση εκτελεί μια δήλωση :keyword:`return` ή " +"πέσει στο τέλος, γίνεται raise μια εξαίρεση :exc:`StopIteration` και ο " +"iterator θα έχει φτάσει στο τέλος του συνόλου τιμών που θα επιστραφεί." + +#: reference/datamodel.rst:771 msgid "Coroutine functions" -msgstr "" +msgstr "Coroutine συναρτήσεις" -#: reference/datamodel.rst:764 +#: reference/datamodel.rst:776 msgid "" "A function or method which is defined using :keyword:`async def` is called " "a :dfn:`coroutine function`. Such a function, when called, returns a :term:" @@ -853,12 +1250,17 @@ msgid "" "as :keyword:`async with` and :keyword:`async for` statements. See also the :" "ref:`coroutine-objects` section." msgstr "" +"Μια συνάρτηση ή μέθοδος που ορίζεται χρησιμοποιώντας :keyword:`async def` " +"ονομάζεται μια :dfn:`coroutine function`. Μια τέτοια συνάρτηση, όταν " +"καλείται, επιστρέφει ένα αντικείμενο :term:`coroutine`. Μπορεί να περιέχει " +"εκφράσεις :keyword:`await`, καθώς και :keyword:`async with` και :keyword:" +"`async for`. Δείτε επίσης την ενότητα :ref:`coroutine-objects`." -#: reference/datamodel.rst:772 +#: reference/datamodel.rst:784 msgid "Asynchronous generator functions" -msgstr "" +msgstr "Asynchronous generator συναρτήσεις" -#: reference/datamodel.rst:778 +#: reference/datamodel.rst:790 msgid "" "A function or method which is defined using :keyword:`async def` and which " "uses the :keyword:`yield` statement is called a :dfn:`asynchronous generator " @@ -866,8 +1268,14 @@ msgid "" "iterator` object which can be used in an :keyword:`async for` statement to " "execute the body of the function." msgstr "" +"Μια συνάρτηση ή μέθοδος που ορίζεται χρησιμοποιώντας :keyword:`async def` " +"και που χρησιμοποιεί την πρόταση :keyword:`yield` ονομάζεται :dfn:" +"`asynchronous generator function`. Μια τέτοια συνάρτηση, όταν καλείται, " +"επιστρέφει ένα αντικείμενο :term:`asynchronous iterator` που μπορεί να " +"χρησιμοποιηθεί σε μια δήλωση :keyword:`async for` για την εκτέλεση του " +"σώματος της συνάρτησης." -#: reference/datamodel.rst:784 +#: reference/datamodel.rst:796 msgid "" "Calling the asynchronous iterator's :meth:`aiterator.__anext__ ` method will return an :term:`awaitable` which when awaited will " @@ -877,45 +1285,66 @@ msgid "" "asynchronous iterator will have reached the end of the set of values to be " "yielded." msgstr "" +"Η κλήση της μεθόδου :meth:`aiterator.__anext__ ` του " +"ασύγχρονου iterator θα επιστρέψει ένα :term:`awaitable` το οποίο όταν " +"αναμένεται θα εκτελεστεί έως ότου δώσει μια τιμή χρησιμοποιώντας την " +"έκφραση :keyword:`yield`. Όταν η συνάρτηση εκτελεί μια κενή εντολή :keyword:" +"`return` ή πέφτει στο τέλος, γίνεται raise μια εξαίρεση :exc:" +"`StopAsyncIteration` και ο ασύγχρονος iterator θα έχει φτάσει στο τέλος του " +"συνόλου τιμών που θα αποδοθούν." -#: reference/datamodel.rst:797 +#: reference/datamodel.rst:809 msgid "Built-in functions" -msgstr "" +msgstr "Ενσωματωμένες συναρτήσεις" -#: reference/datamodel.rst:804 +#: reference/datamodel.rst:816 msgid "" "A built-in function object is a wrapper around a C function. Examples of " "built-in functions are :func:`len` and :func:`math.sin` (:mod:`math` is a " "standard built-in module). The number and type of the arguments are " "determined by the C function. Special read-only attributes:" msgstr "" +"Ένα αντικείμενο ενσωματωμένης συνάρτησης είναι ένας wrapper γύρω από μια " +"συνάρτηση C. Παραδείγματα ενσωματωμένων συναρτήσεων είναι οι :func:`len` " +"και :func:`math.sin` (:mod:`math` είναι ένα ενσωματωμένο module). Ο αριθμός " +"και ο τύπος των ορισμάτων καθορίζονται από τη συνάρτηση C. Ειδικά " +"χαρακτηριστικά μόνο για ανάγνωση:" -#: reference/datamodel.rst:809 +#: reference/datamodel.rst:821 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." msgstr "" +"Η :attr:`!__doc__` είναι η συμβολοσειρά τεκμηρίωσης της συνάρτησης, ή " +"``None`` εάν δεν είναι διαθέσιμη . Δείτε :attr:`function.__doc__`." -#: reference/datamodel.rst:811 +#: reference/datamodel.rst:823 msgid "" ":attr:`!__name__` is the function's name. See :attr:`function.__name__`." msgstr "" +"Η :attr:`!__name__` είναι το όνομα της συνάρτησης. Δείτε :attr:`function." +"__name__`." -#: reference/datamodel.rst:812 +#: reference/datamodel.rst:824 msgid ":attr:`!__self__` is set to ``None`` (but see the next item)." msgstr "" +"Η :attr:`!__self__` έχει οριστεί σε ``None`` (αλλά δείτε το επόμενο " +"στοιχείο)." -#: reference/datamodel.rst:813 +#: reference/datamodel.rst:825 msgid "" ":attr:`!__module__` is the name of the module the function was defined in or " "``None`` if unavailable. See :attr:`function.__module__`." msgstr "" +"Η :attr:`!__module__` είναι το όνομα του module στην οποία ορίστηκε η " +"συνάρτηση ή ``None`` εάν δεν είναι διαθέσιμη. Δείτε :attr:`function." +"__module__`." -#: reference/datamodel.rst:821 +#: reference/datamodel.rst:833 msgid "Built-in methods" -msgstr "" +msgstr "Ενσωματωμένες μεθόδους" -#: reference/datamodel.rst:828 +#: reference/datamodel.rst:840 msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " @@ -925,12 +1354,20 @@ msgid "" "the same semantics as it does with :attr:`other instance methods `.)" msgstr "" +"Αυτή είναι πραγματικά μια διαφορετική μεταμφίεση μιας ενσωματωμένης " +"συνάρτησης, αυτή τη φορά που περιέχει ένα αντικείμενο που μεταβιβάστηκε στη " +"συνάρτηση C ως ένα έμμεσο επιπλέον όρισμα. Ένα παράδειγμα ενσωματωμένης " +"μεθόδου είναι η ``alist.append()``, υποθέτοντας ότι το *alist* είναι " +"αντικείμενο λίστας. Σε αυτήν την περίπτωση, το ειδικό χαρακτηριστικό μόνο " +"για ανάγνωση :attr:`!__self__` ορίζεται στο αντικείμενο που συμβολίζεται με " +"*alist*. (Το χαρακτηριστικό έχει την ίδια σημασιολογία με το :attr:`other " +"instance methods `.)" -#: reference/datamodel.rst:837 +#: reference/datamodel.rst:850 msgid "Classes" -msgstr "" +msgstr "Κλάσεις" -#: reference/datamodel.rst:839 +#: reference/datamodel.rst:852 msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " @@ -938,22 +1375,30 @@ msgid "" "meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " "initialize the new instance." msgstr "" +"Οι κλάσεις μπορούν να κληθούν. Αυτά τα αντικείμενα λειτουργούν κανονικά ως " +"εργοστάσια (factories) για νέα στιγμιότυπα του εαυτού τους, αλλά είναι " +"δυνατές παραλλαγές για τύπους κλάσεων που παρακάμπτουν το :meth:`~object." +"__new__`. Τα ορίσματα της κλήσης μεταβιβάζονται στην :meth:`!__new__` και, " +"στην τυπική περίπτωση, στη :meth:`~object.__init__` για να αρχικοποιηθεί το " +"νέο στιγμιότυπο." -#: reference/datamodel.rst:847 +#: reference/datamodel.rst:860 msgid "Class Instances" -msgstr "" +msgstr "Στιγμιότυπα Κλάσης" -#: reference/datamodel.rst:849 +#: reference/datamodel.rst:862 msgid "" "Instances of arbitrary classes can be made callable by defining a :meth:" "`~object.__call__` method in their class." msgstr "" +"Τα στιγμιότυπα αυθαίρετων κλάσεων μπορούν να έχουν την δυνατότητα κλήσης " +"ορίζοντας μια μέθοδο :meth:`~object.__call__` στην κλάση τους." -#: reference/datamodel.rst:854 +#: reference/datamodel.rst:869 msgid "Modules" -msgstr "" +msgstr "Modules" -#: reference/datamodel.rst:860 +#: reference/datamodel.rst:875 msgid "" "Modules are a basic organizational unit of Python code, and are created by " "the :ref:`import system ` as invoked either by the :keyword:" @@ -967,76 +1412,464 @@ msgid "" "initialize the module (since it isn't needed once the initialization is " "done)." msgstr "" - -#: reference/datamodel.rst:873 +"Τα modules είναι μια βασική οργανωτική μονάδα κώδικα Python, και " +"δημιουργούνται από το :ref:`import system ` όπως καλείται είτε " +"από τη δήλωση :keyword:`import` είτε με κλήση συναρτήσεων όπως :func:" +"`importlib.import_module` και το ενσωματωμένο :func:`__import__`. Ένα " +"αντικείμενο module έχει έναν χώρο ονομάτων που υλοποιείται από ένα " +"αντικείμενο :class:`dictionary ` (αυτό είναι το λεξικό που αναφέρεται " +"από τη συνάρτηση :attr:`~function.__globals__` των συναρτήσεων που ορίζονται " +"στο module). Οι αναφορές χαρακτηριστικών μεταφράζονται σε αναζητήσεις σε " +"αυτό το λεξικό, π.χ., το ``m.x`` ισοδυναμεί με ``m.__dict__[\"x\"]``. Ένα " +"αντικείμενο module δεν περιέχει το αντικείμενο κώδικα που χρησιμοποιείται " +"για την προετοιμασία του module (καθώς δεν χρειάζεται μόλις ολοκληρωθεί η " +"προετοιμασία)." + +#: reference/datamodel.rst:888 msgid "" "Attribute assignment updates the module's namespace dictionary, e.g., ``m.x " "= 1`` is equivalent to ``m.__dict__[\"x\"] = 1``." msgstr "" +"Η εκχώρηση χαρακτηριστικών ενημερώνει το λεξικό χώρου ονομάτων του module, π." +"χ., ``m.x = 1`` ισοδυναμεί με ``m.__dict__[\"x\"] = 1``." + +#: reference/datamodel.rst:907 +msgid "Import-related attributes on module objects" +msgstr "Χαρακτηριστικά που σχετίζονται με εισαγωγή σε αντικείμενα modules" + +#: reference/datamodel.rst:909 +msgid "" +"Module objects have the following attributes that relate to the :ref:`import " +"system `. When a module is created using the machinery " +"associated with the import system, these attributes are filled in based on " +"the module's :term:`spec `, before the :term:`loader` executes " +"and loads the module." +msgstr "" +"Τα αντικείμενα modules έχουν τα ακόλουθα χαρακτηριστικά που σχετίζονται με " +"το :ref:`import system `. Όταν δημιουργείται ένα module με τη " +"χρήση του μηχανήματος που σχετίζεται με το σύστημα εισαγωγής, αυτά τα " +"χαρακτηριστικά συμπληρώνονται με βάση το :term:`spec ` του " +"module, προτού το :term:`loader` εκτελέσει και φορτώσει το module." + +#: reference/datamodel.rst:915 +msgid "" +"To create a module dynamically rather than using the import system, it's " +"recommended to use :func:`importlib.util.module_from_spec`, which will set " +"the various import-controlled attributes to appropriate values. It's also " +"possible to use the :class:`types.ModuleType` constructor to create modules " +"directly, but this technique is more error-prone, as most attributes must be " +"manually set on the module object after it has been created when using this " +"approach." +msgstr "" +"Για να δημιουργήσετε ένα module δυναμικά αντί να χρησιμοποιήσετε το σύστημα " +"εισαγωγής, συνίσταται να χρησιμοποιήσετε τη :func:`importlib.util." +"module_from_spec`, η οποία θα ορίσει τα διάφορα ελεγχόμενα από εισαγωγή " +"χαρακτηριστικών σε κατάλληλες τιμές. Είναι επίσης δυνατό να χρησιμοποιηθεί ο " +"κατασκευαστής :class:`types.ModuleType` για τη δημιουργία modules απευθείας, " +"αλλά αυτή η τεχνική είναι πιο επιρρεπής σε σφάλματα, καθώς τα περισσότερα " +"χαρακτηριστικά πρέπει να οριστούν χειροκίνητα στο αντικείμενο του module " +"αφού δημιουργηθεί κατά τη χρήση αυτής της προσέγγισης." + +#: reference/datamodel.rst:925 +msgid "" +"With the exception of :attr:`~module.__name__`, it is **strongly** " +"recommended that you rely on :attr:`~module.__spec__` and its attributes " +"instead of any of the other individual attributes listed in this subsection. " +"Note that updating an attribute on :attr:`!__spec__` will not update the " +"corresponding attribute on the module itself:" +msgstr "" +"Με εξαίρεση το :attr:`~module.__name__`, **συνίσταται ανεπιφύλακτα** να " +"βασίζεστε στο :attr:`~module.__spec__` και στα χαρακτηριστικά του αντί για " +"οποιοδήποτε από τα άλλα μεμονωμένα χαρακτηριστικά που αναφέρονται σε αυτήν " +"την υποενότητα. Σημειώστε ότι η ενημέρωση ενός χαρακτηριστικού στο :attr:`!" +"__spec__` δεν θα ενημερώσει το αντίστοιχο χαρακτηριστικό στο ίδιο το module:" + +#: reference/datamodel.rst:931 +msgid "" +">>> import typing\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'typing')\n" +">>> typing.__spec__.name = 'spelling'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'spelling')\n" +">>> typing.__name__ = 'keyboard_smashing'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('keyboard_smashing', 'spelling')" +msgstr "" +">>> import typing\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'typing')\n" +">>> typing.__spec__.name = 'spelling'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'spelling')\n" +">>> typing.__name__ = 'keyboard_smashing'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('keyboard_smashing', 'spelling')" + +#: reference/datamodel.rst:945 +msgid "" +"The name used to uniquely identify the module in the import system. For a " +"directly executed module, this will be set to ``\"__main__\"``." +msgstr "" +"Το όνομα που χρησιμοποιείται για την μοναδική αναγνώριση της ενότητας στο " +"σύστημα εισαγωγής. Για ένα άμεσο εκτελούμενο module, αυτό θα οριστεί σε " +"``\"__main__\"``." + +#: reference/datamodel.rst:948 +msgid "" +"This attribute must be set to the fully qualified name of the module. It is " +"expected to match the value of :attr:`module.__spec__.name `." +msgstr "" +"Αυτό το χαρακτηριστικό πρέπει να οριστεί στο πλήρως προσδιορισμένο όνομα του " +"module. Αναμένεται να ταιριάζει με την τιμή :attr:`module.__spec__.name " +"`." + +#: reference/datamodel.rst:954 +msgid "A record of the module's import-system-related state." +msgstr "" +"Μια εγγραφή της κατάστασης του module που σχετίζεται με το σύστημα εισαγωγής." + +#: reference/datamodel.rst:956 +msgid "" +"Set to the :class:`module spec ` that was " +"used when importing the module. See :ref:`module-specs` for more details." +msgstr "" +"Ορίστε την παράμετρο :class:`module spec ` " +"που χρησιμοποιήθηκε κατά την εισαγωγή της ενότητας. Δείτε το :ref:`module-" +"specs` για περισσότερες λεπτομέρειες." + +#: reference/datamodel.rst:963 +msgid "The :term:`package` a module belongs to." +msgstr "Το :term:`package` στο οποίο ανήκει μια ενότητα." + +#: reference/datamodel.rst:965 +msgid "" +"If the module is top-level (that is, not a part of any specific package) " +"then the attribute should be set to ``''`` (the empty string). Otherwise, it " +"should be set to the name of the module's package (which can be equal to :" +"attr:`module.__name__` if the module itself is a package). See :pep:`366` " +"for further details." +msgstr "" +"Εάν το module είναι ανώτατου επιπέδου (δηλαδή, δεν αποτελεί μέρος κάποιου " +"συγκεκριμένου πακέτου), τότε το χαρακτηριστικό θα πρέπει να οριστεί σε " +"``''`` (η κενή συμβολοσειρά). Διαφορετικά, θα πρέπει να οριστεί το όνομα του " +"πακέτου της ενότητας (το οποίο μπορεί να είναι ίσο με :attr:`module." +"__name__` εάν η ίδια η ενότητα είναι πακέτο). Δείτε :pep:`366` για " +"περισσότερες λεπτομέρειες." + +#: reference/datamodel.rst:971 +msgid "" +"This attribute is used instead of :attr:`~module.__name__` to calculate " +"explicit relative imports for main modules. It defaults to ``None`` for " +"modules created dynamically using the :class:`types.ModuleType` constructor; " +"use :func:`importlib.util.module_from_spec` instead to ensure the attribute " +"is set to a :class:`str`." +msgstr "" +"Αυτό το χαρακτηριστικό χρησιμοποιείται αντί για το :attr:`~module.__name__` " +"για την υπολογισμό σαφών σχετικών εισαγωγών για τα κύρια modules. Η " +"προεπιλεγμένη τιμή είναι ``None`` για modules που δημιουργούνται δυναμικά " +"χρησιμοποιώντας τον κατασκευαστή :class:`types.ModuleType` ∙ χρησιμοποιήστε " +"το :func:`importlib.util.module_from_spec` για να βεβαιωθείτε ότι το " +"χαρακτηριστικό έχει οριστεί σε :class:`str`." + +#: reference/datamodel.rst:977 +msgid "" +"It is **strongly** recommended that you use :attr:`module.__spec__.parent " +"` instead of :attr:`!module." +"__package__`. :attr:`__package__` is now only used as a fallback if :attr:`!" +"__spec__.parent` is not set, and this fallback path is deprecated." +msgstr "" +"Συνίσταται ανεπιφύλακτα να χρησιμοποιείτε την εντολή :attr:`module.__spec__." +"parent ` αντί για την εντολή :attr:`!" +"module.__package__`. Η εντολή :attr:`__package__` χρησιμοποιείται πλέον μόνο " +"ως εφεδρική εντολή εάν η εντολή :attr:`!__spec__.parent` δεν έχει οριστεί " +"και αυτή η εφεδρική διαδρομή έχει καταργηθεί." + +#: reference/datamodel.rst:1024 +msgid "" +"This attribute now defaults to ``None`` for modules created dynamically " +"using the :class:`types.ModuleType` constructor. Previously the attribute " +"was optional." +msgstr "" +"Αυτό το χαρακτηριστικό έχει πλέον την προεπιλεγμένη τιμή ``None`` για " +"modules που δημιουργούνται δυναμικά χρησιμοποιώντας τον κατασκευαστή :class:" +"`types.ModuleType`. Προηγουμένως, το χαρακτηριστικό ήταν προαιρετικό." + +#: reference/datamodel.rst:988 +msgid "" +"The value of :attr:`!__package__` is expected to be the same as :attr:" +"`__spec__.parent `. :attr:" +"`__package__` is now only used as a fallback during import resolution if :" +"attr:`!__spec__.parent` is not defined." +msgstr "" +"Η τιμή του :attr:`!__package__` αναμένεται να είναι η ίδια με την τιμή του :" +"attr:`__spec__.parent `. Το :attr:" +"`__package__` χρησιμοποιείται πλέον μόνο ως εφεδρική τιμή κατά την ανάλυση " +"εισαγωγής εάν δεν έχει οριστεί το :attr:`!__spec__.parent`." + +#: reference/datamodel.rst:994 +msgid "" +":exc:`ImportWarning` is raised if an import resolution falls back to :attr:`!" +"__package__` instead of :attr:`__spec__.parent `." +msgstr "" +"Η :exc:`ImportWarning` γίνεται raised εάν η ανάλυση εισαγωγής επανέλθει σε :" +"attr:`!__package__` αντί για :attr:`__spec__.parent `." + +#: reference/datamodel.rst:999 +msgid "" +"Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning` when falling " +"back to :attr:`!__package__` during import resolution." +msgstr "" +"Γίνεται :exc:`DeprecationWarning` αντί για :exc:`ImportWarning` κατά την " +"επιστροφή στο :attr:`!__package__` κατά την επίλυση της εισαγωγής." + +#: reference/datamodel.rst:1003 +msgid "" +":attr:`!__package__` will cease to be set or taken into consideration by the " +"import system or standard library." +msgstr "" +"Το :attr:`!__package__` θα πάψει να ορίζεται ή να λαμβάνεται υπόψη από το " +"σύστημα εισαγωγής ή την τυπική βιβλιοθήκη." + +#: reference/datamodel.rst:1009 +msgid "" +"The :term:`loader` object that the import machinery used to load the module." +msgstr "" +"Το αντικείμενο :term:`loader` που χρησιμοποίησε ο μηχανισμός εισαγωγής για " +"τη φόρτωση του module." + +#: reference/datamodel.rst:1011 +msgid "" +"This attribute is mostly useful for introspection, but can be used for " +"additional loader-specific functionality, for example getting data " +"associated with a loader." +msgstr "" +"Αυτό το χαρακτηριστικό είναι κυρίως χρήσιμο για ενδοσκόπηση, αλλά μπορεί να " +"χρησιμοποιηθεί για πρόσθετη λειτουργικότητα ειδικά για τον loader, για " +"παράδειγμα για τη λήψη δεδομένων που σχετίζονται με έναν loader." + +#: reference/datamodel.rst:1015 +msgid "" +":attr:`!__loader__` defaults to ``None`` for modules created dynamically " +"using the :class:`types.ModuleType` constructor; use :func:`importlib.util." +"module_from_spec` instead to ensure the attribute is set to a :term:`loader` " +"object." +msgstr "" +"Το :attr:`!__loader__` έχει προεπιλεγμένη τιμή ``None`` για modules που " +"δημιουργούνται δυναμικά χρησιμοποιώντας τον κατασκευαστή :class:`types." +"ModuleType` ∙ χρησιμοποιήστε τη :func:`importlib.util.module_from_spec` για " +"να βεβαιωθείτε ότι το χαρακτηριστικό έχει οριστεί σε ένα αντικείμενο :term:" +"`loader`." + +#: reference/datamodel.rst:1020 +msgid "" +"It is **strongly** recommended that you use :attr:`module.__spec__.loader " +"` instead of :attr:`!module." +"__loader__`." +msgstr "" +"Συνίσταται ανεπιφύλακτα να χρησιμοποιείτε την εντολή :attr:`module.__spec__." +"loader ` αντί για την εντολή :attr:`!" +"module.__loader__`." + +#: reference/datamodel.rst:1029 +msgid "" +"Setting :attr:`!__loader__` on a module while failing to set :attr:`!" +"__spec__.loader` is deprecated. In Python 3.16, :attr:`!__loader__` will " +"cease to be set or taken into consideration by the import system or the " +"standard library." +msgstr "" +"Ο ορισμός του :attr:`!__loader__` σε ένα module χωρίς τον αντίστοιχο ορισμό " +"του :attr:`!__spec__.loader` θεωρείται παρωχημένος. Στην Python 3.16, το :" +"attr:`!__loader__` θα πάψει να ορίζεται η να λαμβάνεται υπόψη από το σύστημα " +"εισαγωγής ή την τυπική βιβλιοθήκη." -#: reference/datamodel.rst:883 -msgid "Predefined (writable) attributes:" +#: reference/datamodel.rst:1037 +msgid "" +"A (possibly empty) :term:`sequence` of strings enumerating the locations " +"where the package's submodules will be found. Non-package modules should not " +"have a :attr:`!__path__` attribute. See :ref:`package-path-rules` for more " +"details." +msgstr "" +"Μια (ενδεχομένως κενή) :term:`sequence` από συμβολοσειρές που απαριθμεί τις " +"τοποθεσίες όπου θα εντοπιστούν τα submodules του πακέτου. Modules που δεν " +"είναι πακέτα δεν θα πρέπει να έχουν το χαρακτηριστικό :attr:`!__path__`. " +"Δείτε το :ref:`package-path-rules` για περισσότερες λεπτομέρειες." + +#: reference/datamodel.rst:1042 +msgid "" +"It is **strongly** recommended that you use :attr:`module.__spec__." +"submodule_search_locations ` instead of :attr:`!module.__path__`." +msgstr "" +"Συνίσταται **ισχυρά** να χρησιμοποιείτε το :attr:`module.__spec__." +"submodule_search_locations ` αντί για το :attr:`!module.__path__`." + +#: reference/datamodel.rst:1049 +msgid "" +":attr:`!__file__` and :attr:`!__cached__` are both optional attributes that " +"may or may not be set. Both attributes should be a :class:`str` when they " +"are available." msgstr "" +"Τα :attr:`!__file__` και :attr:`!__cached__` είναι και τα δύο προαιρετικά " +"χαρακτηριστικά, τα οποία ενδέχεται να μην έχουν οριστεί. Όταν είναι " +"διαθέσιμα, και τα δύο θα πρέπει να είναι αντικείμενα τύπου μιας :class:`str`." -#: reference/datamodel.rst:886 -msgid ":attr:`__name__`" +#: reference/datamodel.rst:1053 +msgid "" +":attr:`!__file__` indicates the pathname of the file from which the module " +"was loaded (if loaded from a file), or the pathname of the shared library " +"file for extension modules loaded dynamically from a shared library. It " +"might be missing for certain types of modules, such as C modules that are " +"statically linked into the interpreter, and the :ref:`import system " +"` may opt to leave it unset if it has no semantic meaning (for " +"example, a module loaded from a database)." msgstr "" +"Το :attr:`!__file__` υποδεικνύει το όνομα διαδρομής του αρχείου από το οποίο " +"φορτώθηκε το module (εάν φορτώθηκε από ένα αρχείο) ή το όνομα διαδρομής της " +"κοινόχρηστης βιβλιοθήκης στην περίπτωση επεκτάσεων που φορτώνονται δυναμικά " +"από τέτοια βιβλιοθήκη. Ενδέχεται να απουσιάζει για ορισμένους τύπους " +"modules, όπως modules C που έχουν συνδεθεί στατικά στον διερμηνέα, και το :" +"ref:`import system ` μπορεί να επιλέξει να μην το ορίσει εάν " +"δεν έχει σημασιολογική αξία (π.χ. ένα module που φορτώνεται από μια βάση " +"δεδομένων)." -#: reference/datamodel.rst:886 -msgid "The module's name." +#: reference/datamodel.rst:1061 +msgid "" +"If :attr:`!__file__` is set then the :attr:`!__cached__` attribute might " +"also be set, which is the path to any compiled version of the code (for " +"example, a byte-compiled file). The file does not need to exist to set this " +"attribute; the path can simply point to where the compiled file *would* " +"exist (see :pep:`3147`)." msgstr "" +"Αν το :attr:`!__file__` έχει οριστεί τότε το χαρακτηριστικό :attr:`!" +"__cached__` μπορεί επίσης να ρυθμιστεί, η οποία είναι η διαδρομή σε " +"οποιαδήποτε καταρτισμένη έκδοση του κώδικα (για παράδειγμα, ένα byte-" +"compiled αρχείο). Το αρχείο δεν χρειάζεται να υπάρχει για να ορίσετε αυτό το " +"χαρακτηριστικό. Η διαδρομή μπορεί απλά να επισημάνει το πού *θα* υπήρχε το " +"αρχείο που έχει καταρτιστεί (βλ. :pep:`3147`)." -#: reference/datamodel.rst:990 -msgid ":attr:`__doc__`" +#: reference/datamodel.rst:1067 +msgid "" +"Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not " +"set. However, that scenario is quite atypical. Ultimately, the :term:" +"`loader` is what makes use of the module spec provided by the :term:`finder` " +"(from which :attr:`!__file__` and :attr:`!__cached__` are derived). So if a " +"loader can load from a cached module but otherwise does not load from a " +"file, that atypical scenario may be appropriate." msgstr "" +"Σημειώστε ότι το :attr:`!__cached__` μπορεί να ρυθμιστεί ακόμη και αν το :" +"attr:`!__file__` δεν έχει οριστεί. Ωστόσο, αυτό το σενάριο είναι αρκετά " +"άτυπο. Τελικά, ο :term:`loader` είναι αυτό που κάνει τη χρήση του spec " +"module που παρέχεται από το :term:`finder` (από το οποίο :attr:`!__file__` " +"και :attr:`!__cached__` παρέχονται). Έτσι, εάν ένας loader μπορεί να " +"φορτωθεί από ένα προσωρινό module, αλλά διαφορετικά δεν φορτώνεται από ένα " +"αρχείο, αυτό το άτυπο σενάριο μπορεί να είναι κατάλληλο." -#: reference/datamodel.rst:889 -msgid "The module's documentation string, or ``None`` if unavailable." +#: reference/datamodel.rst:1074 +msgid "" +"It is **strongly** recommended that you use :attr:`module.__spec__.cached " +"` instead of :attr:`!module." +"__cached__`." msgstr "" +"Συνίσταται **ισχυρά** να χρησιμοποιείτε το :attr:`module.__spec__.cached " +"` αντί για το :attr:`!module." +"__cached__`." -#: reference/datamodel.rst:899 -msgid ":attr:`__file__`" +#: reference/datamodel.rst:1078 +msgid "" +"Setting :attr:`!__cached__` on a module while failing to set :attr:`!" +"__spec__.cached` is deprecated. In Python 3.15, :attr:`!__cached__` will " +"cease to be set or taken into consideration by the import system or standard " +"library." msgstr "" +"Ο ορισμός του :attr:`!__cached__` σε ένα module χωρίς τον αντίστοιχο ορισμό " +"του :attr:`!__spec__.cached` θεωρείται παρωχημένος. Στην Python 3.15, το :" +"attr:`!__cached__` θα πάψει να ορίζεται η να λαμβάνεται υπόψη από το σύστημα " +"εισαγωγής ή την τυπική βιβλιοθήκη." -#: reference/datamodel.rst:893 +#: reference/datamodel.rst:1085 +msgid "Other writable attributes on module objects" +msgstr "Άλλα εγγράφως χαρακτηριστικά σε αντικείμενα μονάδων" + +#: reference/datamodel.rst:1087 msgid "" -"The pathname of the file from which the module was loaded, if it was loaded " -"from a file. The :attr:`__file__` attribute may be missing for certain types " -"of modules, such as C modules that are statically linked into the " -"interpreter. For extension modules loaded dynamically from a shared " -"library, it's the pathname of the shared library file." +"As well as the import-related attributes listed above, module objects also " +"have the following writable attributes:" msgstr "" +"Εκτός από τα χαρακτηριστικά που σχετίζονται με τις εισαγωγές που αναφέρονται " +"παραπάνω, τα αντικείμενα της μονάδας έχουν επίσης τα ακόλουθα δικαιολογημένα " +"χαρακτηριστικά:" -#: reference/datamodel.rst:997 -msgid ":attr:`__annotations__`" +#: reference/datamodel.rst:1092 +msgid "" +"The module's documentation string, or ``None`` if unavailable. See also: :" +"attr:`__doc__ attributes `." msgstr "" +"Η συμβολοσειρά τεκμηρίωσης του module, ή ``None`` αν δεν είναι διαθέσιμη. " +"Δείτε επίσης: :attr:`__doc__ attributes `." -#: reference/datamodel.rst:902 +#: reference/datamodel.rst:1097 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during module body execution. For best practices on working with :" -"attr:`__annotations__`, please see :ref:`annotations-howto`." +"attr:`!__annotations__`, see :mod:`annotationlib`." msgstr "" +"Ένα λεξικό που περιέχει :term:`variable annotations ` " +"που συλλέγονται κατά την εκτέλεση του σώματος του module. Για τις βέλτιστες " +"πρακτικές σχετικά με την εργασία με :attr:`!__annotations__`, δείτε το :mod:" +"`annotationlib`." -#: reference/datamodel.rst:909 +#: reference/datamodel.rst:1107 +msgid "" +"The :term:`annotate function` for this module, or ``None`` if the module has " +"no annotations. See also: :attr:`~object.__annotate__` attributes." +msgstr "" +"Η :term:`annotate function` για αυτό το module, ή ``None`` εάν το module δεν " +"έχει annotations. Δείτε επίσης: :attr:`~object.__annotate__` attributes." + +#: reference/datamodel.rst:1113 +msgid "Module dictionaries" +msgstr "Λεξικά Modules" + +#: reference/datamodel.rst:1115 +msgid "Module objects also have the following special read-only attribute:" +msgstr "" +"Τα αντικείμενα module έχουν επίσης την ακόλουθη ειδική ιδιότητα μόνο για " +"ανάγνωση:" + +#: reference/datamodel.rst:1120 msgid "" -"Special read-only attribute: :attr:`~object.__dict__` is the module's " -"namespace as a dictionary object." +"The module's namespace as a dictionary object. Uniquely among the attributes " +"listed here, :attr:`!__dict__` cannot be accessed as a global variable from " +"within a module; it can only be accessed as an attribute on module objects." msgstr "" +"Ο χώρος ονομάτων του module ως αντικείμενο λεξικού. Μοναδικά μεταξύ των " +"χαρακτηριστικών που αναφέρονται εδώ, το :attr:`!__dict__` δεν μπορεί να " +"προσπελαστεί ως καθολική μεταβλητή από μέσα σε ένα module∙ μπορεί να " +"προσπελαστεί μόνο ως χαρακτηριστικό σε αντικείμενα module." -#: reference/datamodel.rst:914 +#: reference/datamodel.rst:1126 msgid "" "Because of the way CPython clears module dictionaries, the module dictionary " "will be cleared when the module falls out of scope even if the dictionary " "still has live references. To avoid this, copy the dictionary or keep the " "module around while using its dictionary directly." msgstr "" +"Λόγω του τρόπου με τον οποίο η CPython διαγράφει τα λεξικά των modules το " +"λεξικό του module θα διαγραφεί όταν το module πέσει εκτός πεδίου εφαρμογής, " +"ακόμα κι αν το λεξικό εξακολουθεί να έχει ζωντανές αναφορές. Για να " +"αποφύγετε αυτό, αντιγράψτε το λεξικό ή κρατήστε το module ενώ " +"χρησιμοποιείται απευθείας το λεξικό της." -#: reference/datamodel.rst:921 +#: reference/datamodel.rst:1135 msgid "Custom classes" -msgstr "" +msgstr "Προσαρμοσμένες κλάσεις" -#: reference/datamodel.rst:923 +#: reference/datamodel.rst:1137 msgid "" "Custom class types are typically created by class definitions (see section :" "ref:`class`). A class has a namespace implemented by a dictionary object. " @@ -1048,11 +1881,23 @@ msgid "" "order which behaves correctly even in the presence of 'diamond' inheritance " "structures where there are multiple inheritance paths leading back to a " "common ancestor. Additional details on the C3 MRO used by Python can be " -"found in the documentation accompanying the 2.3 release at https://www." -"python.org/download/releases/2.3/mro/." -msgstr "" - -#: reference/datamodel.rst:947 +"found at :ref:`python_2.3_mro`." +msgstr "" +"Οι τύποι προσαρμοσμένων κλάσεων δημιουργούνται συνήθως από ορισμούς κλάσεων " +"(βλ. ενότητα :ref:`class`). Μια κλάση έχει έναν χώρο ονομάτων που " +"υλοποιείται από ένα αντικείμενο λεξικού. Οι αναφορές χαρακτηριστικών κλάσης " +"μεταφράζονται σε αναζητήσεις σε αυτό το λεξικό, π.χ., το ``C.x`` " +"μεταφράζεται σε ``C.__dict__[\"x\"]`` (αν και άλλα μέσα για τα οποία " +"επιτρέπεται ο αριθμός των θέσεων υπάρχουν). Όταν το όνομα του " +"χαρακτηριστικού δεν βρίσκεται εκεί, η αναζήτηση χαρακτηριστικών συνεχίζεται " +"στις βασικές κλάσεις. Αυτή η αναζήτηση των βασικών κλάσεων χρησιμοποιεί τη " +"σειρά ανάλυσης της μεθόδου C3 η οποία συμπεριφέρεται σωστά ακόμη και με την " +"παρουσία δομών κληρονομικότητας «διαμάντι» όπου υπάρχουν πολλαπλές διαδρομές " +"κληρονομικότητας που οδηγούν πίσω σε έναν κοινό πρόγονο. Πρόσθετε " +"λεπτομέρειες για το C3 MRO που χρησιμοποιείται από την Python μπορείτε να " +"βρείτε στην διεύθυνση :ref:`python_2.3_mro`." + +#: reference/datamodel.rst:1158 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " "class method object, it is transformed into an instance method object whose :" @@ -1062,83 +1907,232 @@ msgid "" "which attributes retrieved from a class may differ from those actually " "contained in its :attr:`~object.__dict__`." msgstr "" +"Όταν μια αναφορά χαρακτηριστικού κλάσης (για την κλάση :class:`!C`, ας " +"πούμε) θα έδινε ένα αντικείμενο μεθόδου κλάσης, μετατρέπεται σε ένα " +"αντικείμενο μεθόδου παρουσίας του οποίου το χαρακτηριστικό :attr:`~method." +"__self__` είναι :class:`!C`. Όταν θα έδινε ένα αντικείμενο :class:" +"`staticmethod`, μετατρέπεται στο αντικείμενο που είναι wrapped από το " +"αντικείμενο στατικής μεθόδου. Δείτε την ενότητα :ref:`descriptors` για έναν " +"άλλο τρόπο με το οποίο τα χαρακτηριστικά που ανακτώνται από μια κλάση μπορεί " +"να διαφέρουν από αυτά που πραγματικά περιέχονται στο :attr:`~object." +"__dict__` της." -#: reference/datamodel.rst:958 +#: reference/datamodel.rst:1169 msgid "" "Class attribute assignments update the class's dictionary, never the " "dictionary of a base class." msgstr "" +"Οι αναθέσεις χαρακτηριστικών κλάσης ενημερώνουν το λεξικό της κλάσης, ποτέ " +"το λεξικό μιας βασικής κλάσης." -#: reference/datamodel.rst:963 +#: reference/datamodel.rst:1174 msgid "" "A class object can be called (see above) to yield a class instance (see " "below)." msgstr "" +"Ένα αντικείμενο κλάσης μπορεί να κληθεί (δείτε παραπάνω) για να δώσει ένα " +"στιγμιότυπο κλάσης (δείτε παρακάτω)." + +#: reference/datamodel.rst:1353 +msgid "Special attributes" +msgstr "Ειδικά χαρακτηριστικά" + +#: reference/datamodel.rst:1199 +msgid "" +"The class's name. See also: :attr:`__name__ attributes `." +msgstr "" +"Το όνομα της κλάσης, Δείτε επίσης: :attr:`__name__ attributes `." -#: reference/datamodel.rst:974 -msgid "Special attributes:" +#: reference/datamodel.rst:1203 +msgid "" +"The class's :term:`qualified name`. See also: :attr:`__qualname__ attributes " +"`." msgstr "" +"Το :term:`qualified name` της κλάσης. Δείτε επίσης: :attr:`__qualname__ " +"attributes `." -#: reference/datamodel.rst:977 -msgid ":attr:`~definition.__name__`" +#: reference/datamodel.rst:1207 +msgid "The name of the module in which the class was defined." +msgstr "Το όνομα του module στην οποία ορίστηκε η κλάση." + +#: reference/datamodel.rst:1210 +msgid "" +"A :class:`mapping proxy ` providing a read-only view " +"of the class's namespace. See also: :attr:`__dict__ attributes `." msgstr "" +"Μια :class:`mapping proxy ` που παρέχει μια προβολή " +"μόνο για ανάγνωση του χώρου ονομάτων της κλάσης. Δείτε επίσης: :attr:" +"`__dict__ attributes `." -#: reference/datamodel.rst:977 -msgid "The class name." +#: reference/datamodel.rst:1215 +msgid "" +"A :class:`tuple` containing the class's bases. In most cases, for a class " +"defined as ``class X(A, B, C)``, ``X.__bases__`` will be exactly equal to " +"``(A, B, C)``." msgstr "" +"Μια :class:`tuple` που περιέχει τις βάσεις της κλάσης. Στις περισσότερες " +"περιπτώσεις, για μια κλάση που ορίζεται ως ``class X(A, B, C)``, το ``X." +"__bases__`` θα είναι ακριβώς ίσο με ``(A, B, C)``." -#: reference/datamodel.rst:980 -msgid ":attr:`__module__`" +#: reference/datamodel.rst:1222 +msgid "" +"The single base class in the inheritance chain that is responsible for the " +"memory layout of instances. This attribute corresponds to :c:member:" +"`~PyTypeObject.tp_base` at the C level." msgstr "" +"Η μοναδική βασική κλάση στην αλυσίδα κληρονομικότητας που είναι υπεύθυνη για " +"τη διάταξη μνήμης των στιγμιοτύπων. Αυτό το χαρακτηριστικό αντιστοιχεί στο :" +"c:member:`~PyTypeObject.tp_base` σε επίπεδο C." -#: reference/datamodel.rst:980 -msgid "The name of the module in which the class was defined." +#: reference/datamodel.rst:1227 +msgid "" +"The class's documentation string, or ``None`` if undefined. Not inherited by " +"subclasses." msgstr "" +"Η συμβολοσειρά τεκμηρίωσης της κλάσης ή ``None`` εάν δεν έχει οριστεί. Δεν " +"κληρονομείται από υποκλάσεις." -#: reference/datamodel.rst:983 -msgid ":attr:`~object.__dict__`" +#: reference/datamodel.rst:1231 +msgid "" +"A dictionary containing :term:`variable annotations ` " +"collected during class body execution. See also: :attr:`__annotations__ " +"attributes `." msgstr "" +"Ένα λεξικό που περιέχει :term:`variable annotations ` " +"που συλλέγονται κατά την εκτέλεση του σώματος της κλάσης. Δείτε επίσης: :" +"attr:`__annotations__ attributes `." -#: reference/datamodel.rst:983 -msgid "The dictionary containing the class's namespace." +#: reference/datamodel.rst:1236 +msgid "" +"For best practices on working with :attr:`~object.__annotations__`, please " +"see :mod:`annotationlib`. Use :func:`annotationlib.get_annotations` instead " +"of accessing this attribute directly." msgstr "" +"Για βέλτιστες πρακτικές σχετικά με την εργασία με :attr:`~object." +"__annotations__`, δείτε το :mod:`annotationlib`. Χρησιμοποιήστε την :func:" +"`annotationlib.get_annotations` αντί να έχετε άμεση πρόσβαση σε αυτό το " +"χαρακτηριστικό." -#: reference/datamodel.rst:987 -msgid ":attr:`~class.__bases__`" +#: reference/datamodel.rst:1243 +msgid "" +"Accessing the :attr:`!__annotations__` attribute directly on a class object " +"may return annotations for the wrong class, specifically in certain cases " +"where the class, its base class, or a metaclass is defined under ``from " +"__future__ import annotations``. See :pep:`749 <749#pep749-metaclasses>` for " +"details." msgstr "" +"Η πρόσβαση στο χαρακτηριστικό :attr:`!__annotations__` απευθείας σε ένα " +"αντικείμενο κλάσης ενδέχεται να επιστρέψει annotations για τη λάθος κλάση, " +"συγκεκριμένα σε ορισμένες περιπτώσεις όπου η κλάση, η βασική της κλάση ή μια " +"μετακλάση ορίζεται με το ``from __future__ import annotations``. Δείτε το :" +"pep:`749 <749#pep749-metaclasses>` για λεπτομέρειες." -#: reference/datamodel.rst:986 +#: reference/datamodel.rst:1249 msgid "" -"A tuple containing the base classes, in the order of their occurrence in the " -"base class list." +"This attribute does not exist on certain builtin classes. On user-defined " +"classes without ``__annotations__``, it is an empty dictionary." msgstr "" +"Αυτό το χαρακτηριστικό δεν υπάρχει σε ορισμένες ενσωματωμένες κλάσεις. Σε " +"προσαρμοσμένες κλάσεις χωρίς ``__annotations__``, είναι ένα κενό λεξικό." -#: reference/datamodel.rst:990 -msgid "The class's documentation string, or ``None`` if undefined." +#: reference/datamodel.rst:1258 +msgid "" +"The :term:`annotate function` for this class, or ``None`` if the class has " +"no annotations. See also: :attr:`__annotate__ attributes `." msgstr "" +"Η :term:`annotate function` για αυτή την κλάση, ή ``None`` εάν η κλάση δεν " +"έχει annotations. Δείτε επίσης: :attr:`__annotate__ attributes `." -#: reference/datamodel.rst:993 +#: reference/datamodel.rst:1265 msgid "" -"A dictionary containing :term:`variable annotations ` " -"collected during class body execution. For best practices on working with :" -"attr:`__annotations__`, please see :ref:`annotations-howto`." +"A :class:`tuple` containing the :ref:`type parameters ` of a :" +"ref:`generic class `." msgstr "" +"Μια :class:`tuple` που περιέχει τις :ref:`type parameters ` " +"μιας :ref:`generic class `." -#: reference/datamodel.rst:1002 -msgid ":attr:`__type_params__`" +#: reference/datamodel.rst:1271 +msgid "" +"A :class:`tuple` containing names of attributes of this class which are " +"assigned through ``self.X`` from any function in its body." msgstr "" +"Ένα :class:`tuple` που περιέχει ονόματα χαρακτηριστικών αυτής της κλάσης τα " +"οποία ανατίθενται μέσω του ``self.X`` από οποιαδήποτε συνάρτηση στο σώμα της." -#: reference/datamodel.rst:1000 +#: reference/datamodel.rst:1277 msgid "" -"A tuple containing the :ref:`type parameters ` of a :ref:" -"`generic class `." +"The line number of the first line of the class definition, including " +"decorators. Setting the :attr:`~type.__module__` attribute removes the :attr:" +"`!__firstlineno__` item from the type's dictionary." msgstr "" +"Ο αριθμός γραμμής της πρώτης γραμμής του ορισμού της κλάσης, " +"συμπεριλαμβανομένων των διακοσμητών. Ο ορισμός του χαρακτηριστικού :attr:" +"`~type.__module__` αφαιρεί το :attr:`!__firstlineno__` από το λεξικό του " +"τύπου." -#: reference/datamodel.rst:1005 -msgid "Class instances" +#: reference/datamodel.rst:1285 +msgid "" +"The :class:`tuple` of classes that are considered when looking for base " +"classes during method resolution." +msgstr "" +"Η :class:`tuple` των κλάσεων που λαμβάνονται υπόψη κατά την αναζήτηση " +"βασικών κλάσεων κατά την ανάλυση της μεθόδου." + +#: reference/datamodel.rst:1290 +msgid "Special methods" +msgstr "Ειδικές μέθοδοι" + +#: reference/datamodel.rst:1292 +msgid "" +"In addition to the special attributes described above, all Python classes " +"also have the following two methods available:" +msgstr "" +"Εκτός από τα ειδικά χαρακτηριστικά που περιγράφονται παραπάνω, όλες οι " +"κλάσεις Python έχουν επίσης διαθέσιμες τις ακόλουθες δύο μεθόδους:" + +#: reference/datamodel.rst:1297 +msgid "" +"This method can be overridden by a metaclass to customize the method " +"resolution order for its instances. It is called at class instantiation, " +"and its result is stored in :attr:`~type.__mro__`." +msgstr "" +"Αυτή η μέθοδος μπορεί να παρακαμφθεί από μια μετακλάση για να προσαρμόσετε " +"τη σειρά ανάλυσης της μεθόδου για τις παρουσίες της. Καλείται κατά την " +"έναρξη της κλάσης και το αποτέλεσμα της αποθηκεύεται στο :attr:`~type." +"__mro__`." + +#: reference/datamodel.rst:1303 +msgid "" +"Each class keeps a list of weak references to its immediate subclasses. This " +"method returns a list of all those references still alive. The list is in " +"definition order. Example:" msgstr "" +"Κάθε κλάση διατηρεί μια λίστα με ασθενείς αναφορές στις άμεσες υποκλάσεις " +"της. Αυτή η μέθοδος επιστρέφει μια λίστα με όλες αυτές τις αναφορές που " +"εξακολουθούν να είναι ενεργές. Η λίστα είναι με σειρά ορισμού. Παράδειγμα:" -#: reference/datamodel.rst:1013 +#: reference/datamodel.rst:1307 +msgid "" +">>> class A: pass\n" +">>> class B(A): pass\n" +">>> A.__subclasses__()\n" +"[]" +msgstr "" +">>> class A: pass\n" +">>> class B(A): pass\n" +">>> A.__subclasses__()\n" +"[]" + +#: reference/datamodel.rst:1315 +msgid "Class instances" +msgstr "Στιγμιότυπα κλάσης" + +#: reference/datamodel.rst:1323 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1154,32 +2148,65 @@ msgid "" "class attribute is found, and the object's class has a :meth:`~object." "__getattr__` method, that is called to satisfy the lookup." msgstr "" - -#: reference/datamodel.rst:1029 +"Ένα στιγμιότυπο κλάσης δημιουργείται καλώντας ένα αντικείμενο κλάσης (δείτε " +"παραπάνω). Ένα στιγμιότυπο κλάσης έχει έναν χώρο ονομάτων που υλοποιείται " +"ως λεξικό που είναι το πρώτο μέρος στο οποίο αναζητούνται οι αναφορές " +"χαρακτηριστικών. Όταν ένα χαρακτηριστικό δεν βρίσκεται εκεί και η κλάση του " +"στιγμιοτύπου έχει ένα χαρακτηριστικό με αυτό το όνομα, η αναζήτηση " +"συνεχίζεται με τα χαρακτηριστικά κλάσης. Εάν βρεθεί ένα χαρακτηριστικό " +"κλάσης που είναι ένα αντικείμενο συνάρτησης που ορίζεται από το χρήστη, " +"μετατρέπεται σε ένα αντικείμενο μεθόδου στιγμιοτύπου του οποίου το " +"χαρακτηριστικό :attr:`~method.__self__` είναι το στιγμιότυπο. Τα " +"αντικείμενα στατικής μεθόδου και μεθόδου κλάσης μετασχηματίζονται επίσης· " +"δείτε παραπάνω στην ενότητα \"Κλάσεις\". Δείτε την ενότητα :ref:" +"`descriptors` για έναν άλλο τρόπο με τον οποίο τα χαρακτηριστικά μιας κλάσης " +"που ανακτώνται μέσω των στιγμιοτύπων της μπορεί να διαφέρουν από τα " +"αντικείμενα που είναι πραγματικά αποθηκευμένα στο :attr:`~object.__dict__` " +"της κλάσης. Εάν δεν βρεθεί χαρακτηριστικό κλάσης και η κλάση του " +"αντικειμένου έχει μια μέθοδο :meth:`~object.__getattr__`, αυτή καλείται να " +"ικανοποιήσει την αναζήτηση." + +#: reference/datamodel.rst:1339 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " "a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" "meth:`~object.__delattr__` method, this is called instead of updating the " "instance dictionary directly." msgstr "" +"Οι αναθέσεις χαρακτηριστικών ενημερώνουν το λεξικό της παρουσίας και πότε το " +"λεξικό μιας κλάσης. Εάν η κλάση έχει μια μέθοδο :meth:`~object.__setattr__` " +"ή :meth:`~object.__delattr__`, καλείται αντί να ενημερώνεται απευθείας το " +"λεξικό του στιγμιοτύπου." -#: reference/datamodel.rst:1039 +#: reference/datamodel.rst:1349 msgid "" "Class instances can pretend to be numbers, sequences, or mappings if they " "have methods with certain special names. See section :ref:`specialnames`." msgstr "" +"Τα στιγμιότυπα κλάσεων μπορούν να προσποιηθούν ότι είναι αριθμοί, ακολουθίες " +"ή αντιστοιχίσεις εάν έχουν μεθόδους με συγκεκριμένα ειδικά ονόματα. Δείτε " +"την ενότητα :ref:`specialnames`." -#: reference/datamodel.rst:1046 +#: reference/datamodel.rst:1361 +msgid "The class to which a class instance belongs." +msgstr "Η κλάση στην οποία ανήκει ένα στιγμιότυπο κλάσης." + +#: reference/datamodel.rst:1365 msgid "" -"Special attributes: :attr:`~object.__dict__` is the attribute dictionary; :" -"attr:`~instance.__class__` is the instance's class." +"A dictionary or other mapping object used to store an object's (writable) " +"attributes. Not all instances have a :attr:`!__dict__` attribute; see the " +"section on :ref:`slots` for more details." msgstr "" +"Ένα λεξικό ή άλλο αντικείμενο αντιστοίχισης που χρησιμοποιείται για την " +"αποθήκευση των (εγγράψιμων) χαρακτηριστικών ενός αντικειμένου. Δεν έχουν όλα " +"τα στιγμιότυπα ένα χαρακτηριστικό :attr:`!__dict__` ∙ δείτε την ενότητα για " +"τα :ref:`slots` για περισσότερες λεπτομέρειες." -#: reference/datamodel.rst:1051 +#: reference/datamodel.rst:1371 msgid "I/O objects (also known as file objects)" -msgstr "" +msgstr "Αντικείμενα εισόδου/εξόδου (γνωστά και ως αντικείμενα αρχείου)" -#: reference/datamodel.rst:1066 +#: reference/datamodel.rst:1386 msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " @@ -1187,31 +2214,45 @@ msgid "" "makefile` method of socket objects (and perhaps by other functions or " "methods provided by extension modules)." msgstr "" +"Ένα αντικείμενο :term:`file object` αντιπροσωπεύει ένα ανοιχτό αρχείο. " +"Διάφορες συντομεύσεις είναι διαθέσιμες για τη δημιουργία αντικειμένων " +"αρχείου: η ενσωματωμένη συνάρτηση :func:`open`, και επίσης :func:`os." +"popen`, :func:`os.fdopen`, και τη μέθοδο :meth:`~socket.socket.makefile` των " +"αντικειμένων socket (και ίσως από άλλες συναρτήσεις ή μεθόδους που " +"παρέχονται από modules επέκτασης)." -#: reference/datamodel.rst:1072 +#: reference/datamodel.rst:1392 msgid "" "The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized " "to file objects corresponding to the interpreter's standard input, output " "and error streams; they are all open in text mode and therefore follow the " "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" +"Τα αντικείμενα ``sys.stdin``, ``sys.stdout`` και ``sys.stderr`` " +"αρχικοποιούνται για να αρχειοθετούν αντικείμενα που αντιστοιχούν στις " +"τυπικές ροές εισόδου, εξόδου και σφαλμάτων του διερμηνέα· είναι όλα ανοιχτά " +"σε λειτουργία κειμένου και επομένως ακολουθούν τη διεπαφή που ορίζεται από " +"την αφηρημένη κλάση :class:`io.TextIOBase`." -#: reference/datamodel.rst:1080 +#: reference/datamodel.rst:1400 msgid "Internal types" -msgstr "" +msgstr "Εσωτερικοί τύποι" -#: reference/datamodel.rst:1086 +#: reference/datamodel.rst:1406 msgid "" "A few types used internally by the interpreter are exposed to the user. " "Their definitions may change with future versions of the interpreter, but " "they are mentioned here for completeness." msgstr "" +"Μερικοί τύποι που χρησιμοποιούνται εσωτερικά από τον διερμηνέα εκτίθενται " +"στο χρήστη. Οι ορισμοί τους μπορεί να αλλάξουν με μελλοντικές εκδόσεις του " +"διερμηνέα, αλλά αναφέρονται εδώ για πληρότητα." -#: reference/datamodel.rst:1094 +#: reference/datamodel.rst:1414 msgid "Code objects" -msgstr "" +msgstr "Αντικείμενα κώδικα" -#: reference/datamodel.rst:1098 +#: reference/datamodel.rst:1418 msgid "" "Code objects represent *byte-compiled* executable Python code, or :term:" "`bytecode`. The difference between a code object and a function object is " @@ -1222,104 +2263,154 @@ msgid "" "run-time). Unlike function objects, code objects are immutable and contain " "no references (directly or indirectly) to mutable objects." msgstr "" - -#: reference/datamodel.rst:1132 +"Τα αντικείμενα κώδικα αντιπροσωπεύουν *byte-compiled* εκτελέσιμο κώδικα " +"Python, ή :term:`bytecode`. Η διαφορά μεταξύ ενός αντικειμένου κώδικα και " +"ενός αντικειμένου συνάρτησης είναι ότι το αντικείμενο συνάρτησης περιέχει " +"μια ρητή αναφορά στα καθολικά της συνάρτησης (το module στο οποίο ορίστηκε), " +"ενώ ένα αντικείμενο κώδικα δεν περιέχει πλαίσιο· επίσης, οι προεπιλεγμένες " +"τιμές ορίσματος αποθηκεύονται στο αντικείμενο συνάρτησης, όχι στο " +"αντικείμενο κώδικα (επειδή αντιπροσωπεύουν τιμές που υπολογίζονται κατά τον " +"χρόνο εκτέλεσης). Σε αντίθεση με τα αντικείμενα συνάρτησης, τα αντικείμενα " +"κώδικα είναι αμετάβλητα και δεν περιέχουν αναφορές (άμεσα ή έμμεσα) σε " +"μεταβλητά αντικείμενα." + +#: reference/datamodel.rst:1452 msgid "The function name" -msgstr "" +msgstr "Το όνομα της συνάρτησης" -#: reference/datamodel.rst:1135 +#: reference/datamodel.rst:1455 msgid "The fully qualified function name" -msgstr "" +msgstr "Το πλήρως αναγνωρισμένο όνομα συνάρτησης" -#: reference/datamodel.rst:1140 +#: reference/datamodel.rst:1460 msgid "" "The total number of positional :term:`parameters ` (including " "positional-only parameters and parameters with default values) that the " "function has" msgstr "" +"Ο συνολικός αριθμός των θέσεων :term:`parameters ` " +"(συμπεριλαμβανομένων των παραμέτρων μόνο θέσης και παραμέτρων με " +"προεπιλεγμένες τιμές) που έχει η συνάρτηση" -#: reference/datamodel.rst:1145 +#: reference/datamodel.rst:1465 msgid "" "The number of positional-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" +"Ο αριθμός των :term:`parameters ` θέσεως (συμπεριλαμβανομένων " +"ορισμάτων με προεπιλεγμένες τιμές) που έχει η συνάρτηση" -#: reference/datamodel.rst:1149 +#: reference/datamodel.rst:1469 msgid "" "The number of keyword-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" +"Ο αριθμός των :term:`parameters ` λέξεων κλειδιών " +"(συμπεριλαμβανομένων ορισμάτων με προεπιλεγμένες τιμές) που έχει η συνάρτηση" -#: reference/datamodel.rst:1153 +#: reference/datamodel.rst:1473 msgid "" "The number of :ref:`local variables ` used by the function " "(including parameters)" msgstr "" +"Ο αριθμός των :ref:`local variables ` που χρησιμοποιούνται από τη " +"συνάρτηση (συμπεριλαμβανομένων των παραμέτρων)" -#: reference/datamodel.rst:1157 +#: reference/datamodel.rst:1477 msgid "" "A :class:`tuple` containing the names of the local variables in the function " "(starting with the parameter names)" msgstr "" +"Μια :class:`tuple` που περιέχει τα ονόματα των τοπικών μεταβλητών στη " +"συνάρτηση (ξεκινώντας με τα ονόματα των παραμέτρων)" -#: reference/datamodel.rst:1161 +#: reference/datamodel.rst:1481 msgid "" "A :class:`tuple` containing the names of :ref:`local variables ` " -"that are referenced by nested functions inside the function" +"that are referenced from at least one :term:`nested scope` inside the " +"function" msgstr "" +"Ένα :class:`tuple` που περιέχει τα ονόματα των :ref:`local variables " +"` που αναφέρονται από τουλάχιστον ένα :term:`nested scope` μέσα στη " +"συνάρτηση" -#: reference/datamodel.rst:1165 -msgid "A :class:`tuple` containing the names of free variables in the function" +#: reference/datamodel.rst:1485 +msgid "" +"A :class:`tuple` containing the names of :term:`free (closure) variables " +"` that a :term:`nested scope` references in an outer " +"scope. See also :attr:`function.__closure__`." +msgstr "" +"Ένα :class:`tuple` που περιέχει τα ονόματα των :term:`free (closure) " +"variables ` που αναφέρεται από ένα :term:`nested scope` σε " +"ένα εξωτερικό πλαίσιο. Δείτε επίσης το :attr:`function.__closure__`." + +#: reference/datamodel.rst:1489 +msgid "Note: references to global and builtin names are *not* included." msgstr "" +"Σημείωση: οι αναφορές σε καθολικά και ενσωματωμένα ονόματα *δεν* " +"περιλαμβάνονται." -#: reference/datamodel.rst:1168 +#: reference/datamodel.rst:1492 msgid "" "A string representing the sequence of :term:`bytecode` instructions in the " "function" msgstr "" +"Μια συμβολοσειρά που αντιπροσωπεύει την ακολουθία εντολών :term:`bytecode` " +"στη συνάρτηση" -#: reference/datamodel.rst:1172 +#: reference/datamodel.rst:1496 msgid "" "A :class:`tuple` containing the literals used by the :term:`bytecode` in the " "function" msgstr "" +"Μια :class:`tuple` που περιέχει τα literals που χρησιμοποιούνται από το :" +"term:`bytecode` στη συνάρτηση" -#: reference/datamodel.rst:1176 +#: reference/datamodel.rst:1500 msgid "" "A :class:`tuple` containing the names used by the :term:`bytecode` in the " "function" msgstr "" +"Μια :class:`tuple` που περιέχει τα ονόματα που χρησιμοποιούνται από τον :" +"term:`bytecode` στην συνάρτηση" -#: reference/datamodel.rst:1180 +#: reference/datamodel.rst:1504 msgid "The name of the file from which the code was compiled" -msgstr "" +msgstr "Το όνομα του αρχείου από το οποίο συντάχθηκε ο κώδικας" -#: reference/datamodel.rst:1183 +#: reference/datamodel.rst:1507 msgid "The line number of the first line of the function" -msgstr "" +msgstr "Ο αριθμός γραμμής της πρώτης γραμμής της συνάρτησης" -#: reference/datamodel.rst:1186 +#: reference/datamodel.rst:1510 msgid "" "A string encoding the mapping from :term:`bytecode` offsets to line numbers. " "For details, see the source code of the interpreter." msgstr "" +"Μια συμβολοσειρά που κωδικοποιεί την αντιστοίχιση από τον :term:`bytecode` " +"μετατοπίζεται σε αριθμούς γραμμών. Για λεπτομέρειες, ανατρέξτε στον πηγαίο " +"κώδικα του διερμηνέα." -#: reference/datamodel.rst:1189 +#: reference/datamodel.rst:1513 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " -"3.14." +"3.15." msgstr "" +"Αυτό το χαρακτηριστικό των αντικειμένων κώδικα έχει καταργηθεί, και μπορεί " +"να αφαιρεθεί στην Python 3.15." -#: reference/datamodel.rst:1194 +#: reference/datamodel.rst:1518 msgid "The required stack size of the code object" -msgstr "" +msgstr "Το απαιτούμενο μέγεθος στοίβας του αντικειμένου κώδικα" -#: reference/datamodel.rst:1197 +#: reference/datamodel.rst:1521 msgid "" "An :class:`integer ` encoding a number of flags for the interpreter." msgstr "" +"Μια :class:`integer ` που κωδικοποιεί έναν αριθμό flags για τον " +"διερμηνέα." -#: reference/datamodel.rst:1202 +#: reference/datamodel.rst:1526 msgid "" "The following flag bits are defined for :attr:`~codeobject.co_flags`: bit " "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " @@ -1329,77 +2420,110 @@ msgid "" "`inspect-module-co-flags` for details on the semantics of each flags that " "might be present." msgstr "" +"Τα ακόλουθα flag bits ορίζονται για :attr:`~codeobject.co_flags`: το bit " +"``0x04`` ορίζεται εάν η συνάρτηση χρησιμοποιεί τη σύνταξη ``*arguments`` για " +"να αποδεχτεί έναν αυθαίρετο αριθμό ορισμάτων θέσης· το bit ``0x08`` ορίζεται " +"εάν η συνάρτηση χρησιμοποιεί τη σύνταξη ``**keywords`` για να δέχεται " +"αυθαίρετα ορίσματα λέξεων-κλειδιών· το bit ``0x20`` ορίζεται εάν η συνάρτηση " +"είναι γεννήτρια. Δείτε το :ref:`inspect-module-co-flags` για λεπτομέρειες " +"σχετικά με τη σημασιολογία κάθε σημαίας που μπορεί να υπάρχει." -#: reference/datamodel.rst:1210 +#: reference/datamodel.rst:1534 msgid "" -"Future feature declarations (``from __future__ import division``) also use " -"bits in :attr:`~codeobject.co_flags` to indicate whether a code object was " -"compiled with a particular feature enabled: bit ``0x2000`` is set if the " -"function was compiled with future division enabled; bits ``0x10`` and " -"``0x1000`` were used in earlier versions of Python." +"Future feature declarations (for example, ``from __future__ import " +"division``) also use bits in :attr:`~codeobject.co_flags` to indicate " +"whether a code object was compiled with a particular feature enabled. See :" +"attr:`~__future__._Feature.compiler_flag`." msgstr "" +"Οι δηλώσεις μελλοντικών δυνατοτήτων (για παράδειγμα, ``from __future__ " +"import division``) χρησιμοποιούν επίσης bits στο :attr:`~codeobject." +"co_flags` για να υποδείξουν εάν ένα αντικείμενο κώδικα έχει συνταχθεί με μια " +"συγκεκριμένη ενεργοποιημένη δυνατότητα. Δείτε το :attr:`~__future__._Feature." +"compiler_flag`." -#: reference/datamodel.rst:1216 +#: reference/datamodel.rst:1538 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" +"Άλλα bits στο :attr:`~codeobject.co_flags` είναι δεσμευμένα για εσωτερική " +"χρήση." -#: reference/datamodel.rst:1220 +#: reference/datamodel.rst:1542 msgid "" -"If a code object represents a function, the first item in :attr:`~codeobject." -"co_consts` is the documentation string of the function, or ``None`` if " -"undefined." +"If a code object represents a function and has a docstring, the :data:" +"`~inspect.CO_HAS_DOCSTRING` bit is set in :attr:`~codeobject.co_flags` and " +"the first item in :attr:`~codeobject.co_consts` is the docstring of the " +"function." msgstr "" +"Εάν ένα αντικείμενο κώδικα αντιπροσωπεύει μια συνάρτηση και έχει μια " +"συμβολοσειρά τεκμηρίωσης, το bit :data:`~inspect.CO_HAS_DOCSTRING` ορίζεται " +"στο :attr:`~codeobject.co_flags` και το πρώτο στοιχείο στο :attr:" +"`~codeobject.co_consts` είναι η συμβολοσειρά τεκμηρίωσης της συνάρτησης." -#: reference/datamodel.rst:1225 +#: reference/datamodel.rst:1548 msgid "Methods on code objects" -msgstr "" +msgstr "Μέθοδοι σε αντικείμενα κώδικα" -#: reference/datamodel.rst:1229 +#: reference/datamodel.rst:1552 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" +"Επιστρέφει έναν iterable πάνω από τις θέσεις του πηγαίου κώδικα κάθε " +"εντολής :term:`bytecode` στο αντικείμενο κώδικα." -#: reference/datamodel.rst:1232 +#: reference/datamodel.rst:1555 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " -"position of the source code that compiled to the *i-th* instruction. Column " +"position of the source code that compiled to the *i-th* code unit. Column " "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" +"Ο iterator επιστρέφει :class:`tuple`\\s που περιέχει το ``(start_line, " +"end_line, start_column, end_column)``. Η πλειάδα *i-th* αντιστοιχεί στη θέση " +"του πηγαίου κώδικα που μεταγλωττίστηκε στην εντολή *i-th*. Οι πληροφορίες " +"στηλών είναι μετατοπίσεις utf-8 byte με ευρετήριο 0 στη δεδομένη γραμμή " +"πηγής." -#: reference/datamodel.rst:1238 +#: reference/datamodel.rst:1561 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" +"Αυτές οι πληροφορίες θέσης μπορεί να λείπουν. Μια μη εξαντλητική λίστα " +"περιπτώσεων όπου αυτό μπορεί να συμβεί:" -#: reference/datamodel.rst:1241 +#: reference/datamodel.rst:1564 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." -msgstr "" +msgstr "Εκτέλεση του διερμηνέα με :option:`-X` ``no_debug_ranges``." -#: reference/datamodel.rst:1242 +#: reference/datamodel.rst:1565 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" +"Φόρτωση ενός αρχείου pyc που έχει μεταγλωττιστεί κατά τη χρήση του :option:`-" +"X` ``no_debug_ranges``." -#: reference/datamodel.rst:1243 +#: reference/datamodel.rst:1566 msgid "Position tuples corresponding to artificial instructions." -msgstr "" +msgstr "Τοποθετεί τις πλειάδες που αντιστοιχούν σε τεχνικές οδηγίες." -#: reference/datamodel.rst:1244 +#: reference/datamodel.rst:1567 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" +"Αριθμοί γραμμών και στηλών που δεν μπορούν να αναπαρασταθούν λόγω " +"περιορισμών για την υλοποίηση." -#: reference/datamodel.rst:1247 +#: reference/datamodel.rst:1570 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" +"Όταν συμβαίνει αυτό, ορισμένα η όλα τα πολλαπλά στοιχεία μπορεί να είναι :" +"const:`None`." -#: reference/datamodel.rst:1253 +#: reference/datamodel.rst:1576 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1408,161 +2532,248 @@ msgid "" "``no_debug_ranges`` command line flag or the :envvar:`PYTHONNODEBUGRANGES` " "environment variable can be used." msgstr "" +"Αυτή η δυνατότητα απαιτεί αποθήκευση θέσεων στηλών σε αντικείμενα κώδικα που " +"μπορεί να οδηγήσει σε μικρή αύξηση της χρήσης δίσκου των μεταγλωττισμένων " +"αρχείων Python ή της χρήσης μνήμης διερμηνέα. Για να αποφύγετε την " +"αποθήκευση των επιπλέον πληροφοριών ή/και να απενεργοποιήσετε την εκτύπωση " +"των επιπλέον πληροφοριών παρακολούθησης, μπορεί να χρησιμοποιηθεί η σημαία " +"(flag) γραμμής εντολών :option:`-X` ``no_debug_ranges`` ή η μεταβλητή " +"περιβάλλοντος :envvar:`PYTHONNODEBUGRANGES`." -#: reference/datamodel.rst:1262 +#: reference/datamodel.rst:1585 msgid "" "Returns an iterator that yields information about successive ranges of :term:" "`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" "`tuple`:" msgstr "" +"Επιστρέφει έναν iterator που παράγει πληροφορίες σχετικά με διαδοχικά εύρη :" +"term:`bytecode`\\s. Κάθε στοιχείο που αποδίδεται είναι μια ``(start, end, " +"lineno)`` :class:`tuple`:" -#: reference/datamodel.rst:1266 +#: reference/datamodel.rst:1589 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" +"Το ``start`` (ένα :class:`int`) αναπαριστά τη μετατόπιση " +"(συμπεριλαμβανομένης) της έναρξης του εύρους :term:`bytecode`" -#: reference/datamodel.rst:1268 +#: reference/datamodel.rst:1591 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" +"Το ``end`` (ένα :class:`int`) αναπαριστά τη μετατόπιση (αποκλειστική) του " +"τέλους του εύρους :term:`bytecode`" -#: reference/datamodel.rst:1270 +#: reference/datamodel.rst:1593 msgid "" "``lineno`` is an :class:`int` representing the line number of the :term:" "`bytecode` range, or ``None`` if the bytecodes in the given range have no " "line number" msgstr "" +"Το ``lineno`` είναι ένα :class:`int` που αναπαριστά τον αριθμό γραμμής του " +"εύρους :term:`bytecode` ή ``None`` εάν τα bytecodes στη δεδομένη περιοχή δεν " +"έχουν αριθμό γραμμής" -#: reference/datamodel.rst:1274 +#: reference/datamodel.rst:1597 msgid "The items yielded will have the following properties:" -msgstr "" +msgstr "Τα στοιχεία που θα προκύψουν θα έχουν τις ακόλουθες ιδιότητες:" -#: reference/datamodel.rst:1276 +#: reference/datamodel.rst:1599 msgid "The first range yielded will have a ``start`` of 0." -msgstr "" +msgstr "Το πρώτο εύρος που θα προκύψει θα έχει ένα ``start`` 0." -#: reference/datamodel.rst:1277 +#: reference/datamodel.rst:1600 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" +"Τα εύρη ``(start, end)`` θα είναι μη φθίνουσες και διαδοχικές. Δηλαδή, για " +"οποιοδήποτε ζεύγος :class:`tuple`\\s, το ``start`` του δεύτερου θα είναι ίσο " +"με το το ``end`` του πρώτου." -#: reference/datamodel.rst:1280 +#: reference/datamodel.rst:1603 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" +"Κανένα εύρος δεν θα είναι προς τα πίσω: ``end >= start`` για όλες τις " +"τριάδες." -#: reference/datamodel.rst:1281 +#: reference/datamodel.rst:1604 msgid "" "The last :class:`tuple` yielded will have ``end`` equal to the size of the :" "term:`bytecode`." msgstr "" +"Το τελευταίο :class:`tuple` που θα αποφέρει θα έχει ``end`` ίσο με το " +"μέγεθος του :term:`bytecode`." -#: reference/datamodel.rst:1284 +#: reference/datamodel.rst:1607 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" +"Εύρος μηδενικού πλάτους, όπου ``start == end``, επιτρέπονται. Τα εύρη " +"μηδενικού πλάτους χρησιμοποιούνται για γραμμές που υπάρχουν στον πηγαίο " +"κώδικα, αλλά έχουν εξαλειφθεί από τον μεταγλωττιστή :term:`bytecode`." -#: reference/datamodel.rst:1292 +#: reference/datamodel.rst:1615 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" +":pep:`626` - Ακριβείς αριθμοί γραμμών για εντοπισμό σφαλμάτων και άλλα " +"εργαλεία." -#: reference/datamodel.rst:1293 +#: reference/datamodel.rst:1616 msgid "The PEP that introduced the :meth:`!co_lines` method." -msgstr "" +msgstr "Το PEP που εισήγαγε τη μέθοδο :meth:`!co_lines`." -#: reference/datamodel.rst:1297 +#: reference/datamodel.rst:1620 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" +"Επιστρέφει ένα αντίγραφο του αντικειμένου κώδικα με νέες τιμές για τα " +"καθορισμένα πεδία." -#: reference/datamodel.rst:1305 -msgid "Frame objects" +#: reference/datamodel.rst:1622 +msgid "" +"Code objects are also supported by the generic function :func:`copy.replace`." msgstr "" +"Τα αντικείμενα κώδικα υποστηρίζονται επίσης από τη γενική συνάρτηση :func:" +"`copy.replace`." + +#: reference/datamodel.rst:1630 +msgid "Frame objects" +msgstr "Πλαίσιο αντικειμένων" -#: reference/datamodel.rst:1309 +#: reference/datamodel.rst:1634 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects `, and are also passed to registered trace " "functions." msgstr "" +"Τα αντικείμενα πλαισίου αναπαριστούν πλαίσια εκτέλεσης. Μπορούν να " +"εμφανίζονται σε :ref:`traceback objects `, και επίσης " +"μεταβιβάζονται σε καταχωρημένες συναρτήσεις ανίχνευσης." -#: reference/datamodel.rst:1327 +#: reference/datamodel.rst:1653 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" +"Δείχνει το προηγούμενο πλαίσιο στοίβας (προς από εκεί που καλείται), ή " +"``None`` αν αυτό είναι το πλαίσιο της κάτω στοίβας" -#: reference/datamodel.rst:1331 +#: reference/datamodel.rst:1657 msgid "" "The :ref:`code object ` being executed in this frame. " "Accessing this attribute raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"f_code\"``." msgstr "" +"Το αντικείμενο :ref:`code object ` εκτελείται σε αυτό το " +"πλαίσιο. Η πρόσβαση σε αυτό το χαρακτηριστικό κάνει raise σε ένα συμβάν :ref:" +"`auditing event ` ``object.__getattr__`` με ορίσματα ``obj`` και " +"``\"f_code\"``." -#: reference/datamodel.rst:1336 +#: reference/datamodel.rst:1662 msgid "" -"The dictionary used by the frame to look up :ref:`local variables `" +"The mapping used by the frame to look up :ref:`local variables `. If " +"the frame refers to an :term:`optimized scope`, this may return a write-" +"through proxy object." msgstr "" +"Η αντιστοίχιση που χρησιμοποιείται από το πλαίσιο για την αναζήτηση :ref:" +"`local variables `. Εάν το πλαίσιο αναφέρεται σε ένα :term:" +"`optimized scope`, αυτό μπορεί να επιστρέψει ένα αντικείμενο proxy write-" +"through." -#: reference/datamodel.rst:1340 +#: reference/datamodel.rst:1667 +msgid "Return a proxy for optimized scopes." +msgstr "Επιστρέφει ένα proxy για βελτιστοποιημένα πλαίσια." + +#: reference/datamodel.rst:1671 msgid "" "The dictionary used by the frame to look up :ref:`global variables `" msgstr "" +"Το λεξικό που χρησιμοποιείται από το πλαίσιο για την αναζήτηση :ref:`global " +"variables `" -#: reference/datamodel.rst:1344 +#: reference/datamodel.rst:1675 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "`" msgstr "" +"Το λεξικό που χρησιμοποιείται από το πλαίσιο για την αναζήτηση :ref:`built-" +"in (intrinsic) names `" -#: reference/datamodel.rst:1348 +#: reference/datamodel.rst:1679 msgid "" "The \"precise instruction\" of the frame object (this is an index into the :" "term:`bytecode` string of the :ref:`code object `)" msgstr "" +"Η \"ακριβής εντολή\" του αντικειμένου πλαισίου (αυτό είναι ένα ευρετήριο στη " +"συμβολοσειρά :term:`bytecode` του αντικειμένου :ref:`code object `)" + +#: reference/datamodel.rst:1684 +msgid "" +"The :term:`generator` or :term:`coroutine` object that owns this frame, or " +"``None`` if the frame is a normal function." +msgstr "" +"Το αντικείμενο :term:`generator` ή :term:`coroutine` που κατέχει αυτό το " +"πλαίσιο, ή ``None`` εάν το πλαίσιο είναι μια κανονική συνάρτηση." -#: reference/datamodel.rst:1364 +#: reference/datamodel.rst:1701 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" +"Εάν όχι ``None``, αυτή είναι μια συνάρτηση που καλείται για διάφορα συμβάντα " +"κατά την εκτέλεση κώδικα (αυτό χρησιμοποιείται από προγράμματα εντοπισμού " +"σφαλμάτων). Κανονικά ένα συμβάν ενεργοποιείται για κάθε νέα γραμμή πηγαίου " +"κώδικα (δείτε :attr:`~frame.f_trace_lines`)." -#: reference/datamodel.rst:1369 +#: reference/datamodel.rst:1706 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" +"Ορίστε αυτό το χαρακτηριστικό σε :const:`False` για να απενεργοποιήσετε την " +"ενεργοποίηση ενός συμβάντος ανίχνευσης για κάθε γραμμή πηγαίου κώδικα." -#: reference/datamodel.rst:1373 +#: reference/datamodel.rst:1710 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" +"Ορίζει αυτό το χαρακτηριστικό σε :const:`True` για να επιτρέψετε να ζητηθούν " +"συμβάντα ανά opcode. Σημειώστε ότι αυτό μπορεί να οδηγήσει σε απροσδιόριστη " +"συμπεριφορά διερμηνέα εάν οι εξαιρέσεις που προκύπτουν από τη συνάρτηση " +"ανίχνευσης διαφεύγουν στη συνάρτηση που παρακολουθείται." -#: reference/datamodel.rst:1379 +#: reference/datamodel.rst:1716 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " "debugger can implement a Jump command (aka Set Next Statement) by writing to " "this attribute." msgstr "" +"Ο τρέχων αριθμός γραμμής του πλαισίου -- η εγγραφή σε αυτό μέσα από μια " +"συνάρτηση ανίχνευσης μεταβαίνει στη δεδομένη γραμμή (μόνο για το πιο κάτω " +"πλαίσιο). Ένας εντοπισμός σφαλμάτων μπορεί να εφαρμόσει μια εντολή " +"Μετάβασης (γνωστή και ως Ορισμός Επόμενης Δήλωσης) γράφοντας σε αυτό το " +"χαρακτηριστικό." -#: reference/datamodel.rst:1385 +#: reference/datamodel.rst:1722 msgid "Frame object methods" -msgstr "" +msgstr "Μέθοδοι αντικειμένων πλαισίου" -#: reference/datamodel.rst:1387 +#: reference/datamodel.rst:1724 msgid "Frame objects support one method:" -msgstr "" +msgstr "Τα αντικείμενα πλαισίου υποστηρίζουν μια μέθοδο:" -#: reference/datamodel.rst:1391 +#: reference/datamodel.rst:1728 msgid "" "This method clears all references to :ref:`local variables ` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -1570,27 +2781,50 @@ msgid "" "objects (for example when catching an :ref:`exception ` " "and storing its :ref:`traceback ` for later use)." msgstr "" +"Αυτή η μέθοδος διαγράφει όλες τις αναφορές σε :ref:`local variables " +"` που τηρούνται από το πλαίσιο. Επίσης, εάν το πλαίσιο ανήκε σε " +"ένα :term:`generator`, η γεννήτρια έχει οριστικοποιηθεί. Αυτό βοηθά στη " +"διακοπή των κύκλων αναφοράς που περιλαμβάνουν αντικείμενα πλαισίου (για " +"παράδειγμα, όταν γίνεται catch μια :ref:`exception ` και " +"αποθηκεύετε το :ref:`traceback ` για μετέπειτα χρήση)." -#: reference/datamodel.rst:1397 -msgid ":exc:`RuntimeError` is raised if the frame is currently executing." +#: reference/datamodel.rst:1734 +msgid "" +":exc:`RuntimeError` is raised if the frame is currently executing or " +"suspended." msgstr "" +"Η :exc:`RuntimeError` γίνεται raise εάν το πλαίσιο εκτελείται ή αναστέλλεται." -#: reference/datamodel.rst:1405 -msgid "Traceback objects" +#: reference/datamodel.rst:1739 +msgid "" +"Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " +"always been the case for executing frames)." msgstr "" +"Η προσπάθεια εκκαθάρισης ενός ανασταλμένου πλαισίου κάνει raise :exc:" +"`RuntimeError` (όπως πάντα συμβαίνει για τα εκτελούμενα πλαίσια)." -#: reference/datamodel.rst:1418 +#: reference/datamodel.rst:1747 +msgid "Traceback objects" +msgstr "Αντικείμενα ανίχνευσης" + +#: reference/datamodel.rst:1760 msgid "" "Traceback objects represent the stack trace of an :ref:`exception `. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" +"Τα αντικείμενα ανίχνευσης αντιπροσωπεύουν το ίχνος στοίβας μιας :ref:" +"`exception `. Ένα αντικείμενο traceback δημιουργείται σιωπηρά " +"όταν εμφανίζεται μια εξαίρεση και μπορεί επίσης να δημιουργηθεί ρητά " +"καλώντας το :class:`types.TracebackType`." -#: reference/datamodel.rst:1423 +#: reference/datamodel.rst:1765 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" +"Τα αντικείμενα Traceback μπορούν τώρα να δημιουργηθούν ρητά από τον κώδικα " +"Python." -#: reference/datamodel.rst:1426 +#: reference/datamodel.rst:1768 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -1600,82 +2834,114 @@ msgid "" "`sys.exc_info`, and as the :attr:`~BaseException.__traceback__` attribute of " "the caught exception." msgstr "" +"Για εμμέσως δημιουργημένα tracebacks, όταν η αναζήτηση για έναν χειριστή " +"εξαιρέσεων ξετυλίγει τη στοίβα εκτέλεσης, σε κάθε επίπεδο ξετυλίγματος " +"εισάγεται ένα αντικείμενο traceback μπροστά από το τρέχον traceback. Όταν " +"εισάγεται ένα χειριστής εξαίρεσης, το ίχνος στοίβας διατίθεται στο " +"πρόγραμμα. (Δείτε την ενότητα :ref:`try`.) Είναι προσβάσιμο ως το τρίτο " +"στοιχείο της πλειάδα που επιστρέφεται από το :func:`sys.exc_info` και έχει " +"ως το χαρακτηριστικό :attr:`~BaseException.__traceback__` της εξαίρεσης που " +"έχει εντοπιστεί." -#: reference/datamodel.rst:1435 +#: reference/datamodel.rst:1777 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " "interactive, it is also made available to the user as :data:`sys." "last_traceback`." msgstr "" +"Όταν το πρόγραμμα δεν περιέχει ον κατάλληλο χειριστή, το ίχνος στοίβας " +"γράφεται (όμορφα μορφοποιημένο) στην τυπική ροή σφαλμάτων· εάν ο διερμηνέα " +"είναι διαδραστικός, διατίθεται επίσης στον χρήστη ως :data:`sys." +"last_traceback`." -#: reference/datamodel.rst:1440 +#: reference/datamodel.rst:1782 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" +"Για ρητά δημιουργημένα tracebacks, εναπόκειται στον δημιουργό του traceback " +"να καθορίσει πως θα πρέπει να συνδεθούν, τα χαρακτηριστικά :attr:`~traceback." +"tb_next` για να σχηματίσουν ένα ίχνος πλήρους στοίβας." -#: reference/datamodel.rst:1455 +#: reference/datamodel.rst:1797 msgid "" "Points to the execution :ref:`frame ` of the current level." msgstr "" +"Δείχνει την εκτέλεση :ref:`frame ` του τρέχοντος επιπέδου." -#: reference/datamodel.rst:1458 +#: reference/datamodel.rst:1800 msgid "" "Accessing this attribute raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." msgstr "" +"Η πρόσβαση σε αυτό το χαρακτηριστικό κάνει raise ένα :ref:`auditing event " +"` ``object.__getattr__`` με ορίσματα ``obj`` και ``\"tb_frame\"``." -#: reference/datamodel.rst:1463 +#: reference/datamodel.rst:1805 msgid "Gives the line number where the exception occurred" -msgstr "" +msgstr "Δίνει τον αριθμό γραμμής όπου προέκυψε η εξαίρεση" -#: reference/datamodel.rst:1466 +#: reference/datamodel.rst:1808 msgid "Indicates the \"precise instruction\"." -msgstr "" +msgstr "Δηλώνει την \"ακριβή οδηγία\"." -#: reference/datamodel.rst:1468 +#: reference/datamodel.rst:1810 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object ` if the exception " "occurred in a :keyword:`try` statement with no matching except clause or " "with a :keyword:`finally` clause." msgstr "" +"Ο αριθμός γραμμής και η τελευταία εντολή στο traceback μπορεί να διαφέρουν " +"από τον αριθμό γραμμής του αντικειμένου :ref:`frame object ` " +"εάν η εξαίρεση εμφανίστηκε σε μια πρόταση :keyword:`try` χωρίς αντιστοίχιση " +"εκτός από τον όρο ή με έναν όρο :keyword:`finally`." -#: reference/datamodel.rst:1479 +#: reference/datamodel.rst:1821 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" +"Το ειδικό εγγράψιμο χαρακτηριστικό :attr:`!tb_next` είναι το επόμενο επίπεδο " +"στο ίχνος στοίβας (προς το πλαίσιο όπου σημειώθηκε η εξαίρεση), ή ``None`` " +"εάν δεν υπάρχει επόμενο επίπεδο." -#: reference/datamodel.rst:1483 +#: reference/datamodel.rst:1825 msgid "This attribute is now writable" -msgstr "" +msgstr "Αυτό το χαρακτηριστικό είναι τώρα εγγράψιμο" -#: reference/datamodel.rst:1488 +#: reference/datamodel.rst:1830 msgid "Slice objects" -msgstr "" +msgstr "Αντικείμενα τμηματοποίησης" -#: reference/datamodel.rst:1492 +#: reference/datamodel.rst:1834 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" +"Τα αντικείμενα τμηματοποίησης χρησιμοποιούνται για να αναπαραστήσουν τμήματα " +"για μεθόδους :meth:`~object.__getitem__`. Δημιουργούνται επίσης από την " +"ενσωματωμένη συνάρτηση :func:`slice`." -#: reference/datamodel.rst:1501 +#: reference/datamodel.rst:1843 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" +"Ειδικά χαρακτηριστικά μόνο για ανάγνωση: το :attr:`~slice.start` είναι το " +"κάτω όριο∙ το :attr:`~slice.stop` είναι το άνω όριο∙ και το :attr:`~slice." +"step` είναι το βήμα∙ κάθε ένα είναι ``None`` αν παραλειφθεί. Τα " +"χαρακτηριστικά μπορούν να έχουν οποιονδήποτε τύπο." -#: reference/datamodel.rst:1505 +#: reference/datamodel.rst:1847 msgid "Slice objects support one method:" -msgstr "" +msgstr "Τα αντικείμενα slice υποστηρίζουν μια μέθοδο:" -#: reference/datamodel.rst:1509 +#: reference/datamodel.rst:1851 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -1684,12 +2950,19 @@ msgid "" "stride length of the slice. Missing or out-of-bounds indices are handled in " "a manner consistent with regular slices." msgstr "" +"Αυτή η μέθοδος παίρνει ένα μόνο ακέραιο όρισμα *length* και υπολογίζει " +"πληροφορίες σχετικά το slice που θα περιέγραφε το αντικείμενο slice εάν " +"εφαρμοστεί σε μια ακολουθία στοιχείων *length*. Επιστρέφει μια πλειάδα " +"τριών ακεραίων αριθμών∙ αντίστοιχα αυτοί είναι δείκτες *start* και *stop* " +"και το *step* ή το μήκος του βήματος του τμήματος. Οι δείκτες που λείπουν ή " +"είναι εκτός ορίων αντιμετωπίζονται με τρόπο που συνάδει με τα κανονικά " +"slices." -#: reference/datamodel.rst:1518 +#: reference/datamodel.rst:1860 msgid "Static method objects" -msgstr "" +msgstr "Αντικείμενα στατικών μεθόδων" -#: reference/datamodel.rst:1520 +#: reference/datamodel.rst:1862 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -1699,12 +2972,22 @@ msgid "" "any further transformation. Static method objects are also callable. Static " "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" - -#: reference/datamodel.rst:1530 +"Τα αντικείμενα στατικής μεθόδου παρέχουν έναν τρόπο εξουδετέρωσης του " +"μετασχηματισμού αντικειμένων συνάρτησης σε αντικείμενα μεθόδου που " +"περιγράφονται παραπάνω. Ένα αντικείμενο στατικής μεθόδου είναι ένα " +"περιτύλιγμα γύρω από οποιοδήποτε άλλο αντικείμενο , συνήθως ένα αντικείμενο " +"μεθόδου που ορίζεται από το χρήστη. Όταν ένα αντικείμενο στατικής μεθόδου " +"ανακτάται από μια κλάση ή ένα στιγμιότυπο κλάσης, το αντικείμενο που " +"επιστρέφεται στην πραγματικότητα είναι το τυλιγμένο αντικείμενο, το οποίο " +"δεν υπόκειται σε περαιτέρω μετασχηματισμό. Τα αντικείμενα στατικής μεθόδου " +"μπορούν επίσης να κληθούν. Τα αντικείμενα στατικής μεθόδου δημιουργούνται " +"από τον ενσωματωμένο κατασκευαστή :func:`staticmethod`." + +#: reference/datamodel.rst:1872 msgid "Class method objects" -msgstr "" +msgstr "Αντικείμενα μεθόδων κλάσεων" -#: reference/datamodel.rst:1532 +#: reference/datamodel.rst:1874 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -1713,12 +2996,19 @@ msgid "" "methods>`. Class method objects are created by the built-in :func:" "`classmethod` constructor." msgstr "" +"Ένα αντικείμενο μεθόδου κλάσης, όπως ένα αντικείμενο στατικής μεθόδου, είναι " +"ένα περιτύλιγμα γύρω από ένα άλλο αντικείμενο που αλλάζει τον τρόπο με τον " +"οποίο ανακτάται αυτό το αντικείμενο από κλάσεις και στιγμιότυπα κλάσεων. Η " +"συμπεριφορά των αντικειμένων της μεθόδου κλάσης κατά την ανάκτηση αυτή " +"περιγράφεται παραπάνω, στην ενότητα :ref:`\"instance methods\" `. Τα αντικείμενα της μεθόδου κλάσης δημιουργούνται από τον " +"ενσωματωμένο κατασκευαστή :func:`classmethod`." -#: reference/datamodel.rst:1542 +#: reference/datamodel.rst:1884 msgid "Special method names" -msgstr "" +msgstr "Ειδικά ονόματα μεθόδων" -#: reference/datamodel.rst:1548 +#: reference/datamodel.rst:1890 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " @@ -1731,8 +3021,19 @@ msgid "" "appropriate method is defined (typically :exc:`AttributeError` or :exc:" "`TypeError`)." msgstr "" +"Μια κλάση μπορεί να εφαρμόσει ορισμένες πράξεις που καλούνται από ειδική " +"σύνταξη (όπως αριθμητικές πράξεις ή εγγραφή και κοπή) ορίζονται μεθόδους με " +"ειδικά ονόματα. Αυτή είναι η προσέγγιση της Python για το :dfn:`operator " +"overloading`, επιτρέποντας στις κλάσεις να ορίσουν τη δική τους συμπεριφορά " +"σε σχέση με τους τελεστές γλώσσας. Για παράδειγμα, εάν μια κλάση ορίζει μια " +"μέθοδο με το όνομα :meth:`~object.__getitem__`, και το ``x`` είναι ένα " +"στιγμιότυπο αυτής της κλάσης, τότε το ``x[i]`` είναι περίπου ισοδύναμο με το " +"``type(x).__getitem__(x, i)``. Εκτός από τις περιπτώσεις που αναφέρονται, οι " +"προσπάθειες εκτέλεσης μιας λειτουργίας δημιουργούν εξαίρεση όταν δεν " +"ορίζεται κατάλληλη μέθοδος (συνήθως :exc:`AttributeError` ή :exc:" +"`TypeError`)." -#: reference/datamodel.rst:1559 +#: reference/datamodel.rst:1901 msgid "" "Setting a special method to ``None`` indicates that the corresponding " "operation is not available. For example, if a class sets :meth:`~object." @@ -1740,22 +3041,34 @@ msgid "" "its instances will raise a :exc:`TypeError` (without falling back to :meth:" "`~object.__getitem__`). [#]_" msgstr "" +"Ο ορισμός μιας ειδική μεθόδου σε ``None`` σημαίνει ότι η αντίστοιχη " +"λειτουργία δεν είναι διαθέσιμη. Για παράδειγμα, εάν μια κλάση ορίσει την :" +"meth:`~object.__iter__` σε ``None`` η κλάση δεν είναι iterable, επομένως η " +"κλήση :func:`iter` στα στιγμιότυπα της θα κάνει raise μια :exc:`TypeError` " +"(χωρίς να επιστρέψουμε στο :meth:`~object.__getitem__`). [#]_" -#: reference/datamodel.rst:1565 +#: reference/datamodel.rst:1907 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " "the object being modelled. For example, some sequences may work well with " -"retrieval of individual elements, but extracting a slice may not make " -"sense. (One example of this is the :class:`~xml.dom.NodeList` interface in " -"the W3C's Document Object Model.)" -msgstr "" - -#: reference/datamodel.rst:1576 +"retrieval of individual elements, but extracting a slice may not make sense. " +"(One example of this is the :ref:`NodeList ` interface " +"in the W3C's Document Object Model.)" +msgstr "" +"Κατά την υλοποίηση μιας κλάσης που προσομοιώνει οποιονδήποτε ενσωματωμένο " +"τύπο, είναι σημαντικό η εξομοίωση να υλοποιείται μόνο στο βαθμό που έχει " +"νόημα για το αντικείμενο που μοντελοποιείται. Για παράδειγμα, ορισμένες " +"ακολουθίες μπορεί να λειτουργούν καλά με την ανάκτηση μεμονωμένων στοιχείων, " +"αλλά η εξαγωγή ενός τμήματος μπορεί να μην έχει νόημα. (Ένα παράδειγμα " +"αυτού είναι η διεπαφή :ref:`NodeList ` στο Μοντέλο " +"Αντικειμένου Εγγράφου του W3C.)" + +#: reference/datamodel.rst:1918 msgid "Basic customization" -msgstr "" +msgstr "Βασική προσαρμογή" -#: reference/datamodel.rst:1582 +#: reference/datamodel.rst:1924 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -1764,16 +3077,27 @@ msgid "" "(the call to the class). The return value of :meth:`__new__` should be the " "new object instance (usually an instance of *cls*)." msgstr "" +"Καλείται για τη δημιουργία ενός νέου στιγμιοτύπου κλάσης *cls*. Η :meth:" +"`__new__` είναι μια στατική μέθοδος (ειδική περίπτωση, επομένως δεν " +"χρειάζεται να τη δηλώνετε ως τέτοια) που παίρνει την κλάση της οποίας " +"ζητήθηκε ένα στιγμιότυπο ως πρώτο όρισμα. Τα υπόλοιπα ορίσματα είναι αυτά " +"που μεταβιβάζονται στην έκφραση του κατασκευαστή αντικειμένου (η κλήση στην " +"κλάση). Η επιστρεφόμενη τιμή του :meth:`__new__` θα πρέπει να είναι το νέο " +"στιγμιότυπο αντικειμένου (συνήθως ένα στιγμιότυπο του *cls*)." -#: reference/datamodel.rst:1589 +#: reference/datamodel.rst:1931 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " "with appropriate arguments and then modifying the newly created instance as " "necessary before returning it." msgstr "" +"Οι τυπικές υλοποιήσεις δημιουργούν ένα νέο στιγμιότυπο κλάσης επικαλώντας τη " +"μέθοδο :meth:`__new__` της υπερκλάσης χρησιμοποιώντας ``super()." +"__new__(cls[, ...])`` με κατάλληλα ορίσματα και στη συνέχεια τροποποιώντας " +"τη νεο-δημιουργηθείσα παρουσία όπως απαιτείται πριν την επιστρέψει." -#: reference/datamodel.rst:1594 +#: reference/datamodel.rst:1936 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -1781,22 +3105,33 @@ msgid "" "the remaining arguments are the same as were passed to the object " "constructor." msgstr "" +"Εάν το :meth:`__new__` καλείται κατά την κατασκευή αντικειμένου και " +"επιστρέφει ένα στιγμιότυπο του *cls*, τότε η μέθοδος :meth:`__init__` του " +"νέου στιγμιοτύπου θα κληθεί όπως ``__init__(self[, ...])``, όπου το *self* " +"είναι το νέο στιγμιότυπο και τα υπόλοιπα ορίσματα είναι τα ίδια με αυτά που " +"διαβιβάστηκαν στον κατασκευαστή του αντικειμένου." -#: reference/datamodel.rst:1599 +#: reference/datamodel.rst:1941 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" +"Εάν το :meth:`__new__` δεν επιστρέφει ένα στιγμιότυπο του *cls*, τότε η " +"μέθοδος :meth:`__init__` του νέου στιγμιοτύπου δεν θα κληθεί." -#: reference/datamodel.rst:1602 +#: reference/datamodel.rst:1944 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " "commonly overridden in custom metaclasses in order to customize class " "creation." msgstr "" +"Το :meth:`__new__` προορίζεται κυρίως για να επιτρέψει σε υποκλάσεις " +"αμετάβλητων τύπων (όπως int, str, ή tuple) να προσαρμόσουν τη δημιουργία " +"στιγμιοτύπων. Επίσης συνήθως παρακάμπτεται σε προσαρμοσμένες μετακλάσεις " +"προκειμένου να προσαρμόσουν τη δημιουργία κλάσεων." -#: reference/datamodel.rst:1611 +#: reference/datamodel.rst:1953 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -1805,16 +3140,28 @@ msgid "" "ensure proper initialization of the base class part of the instance; for " "example: ``super().__init__([args...])``." msgstr "" +"Καλείται μετά τη δημιουργία του στιγμιοτύπου (από :meth:`__new__`), αλλά " +"πριν επιστραφεί εκεί που καλέστηκε. Τα ορίσματα είναι αυτά που " +"μεταβιβάζονται στην έκφραση του κατασκευαστή κλάσης. Εάν μια κλάση βάσης " +"έχει μια μέθοδο :meth:`__init__`, η μέθοδος :meth:`__init__` της παραγόμενης " +"κλάσης, εάν υπάρχει πρέπει να την καλέσει ρητά για να διασφαλιστεί η σωστή " +"προετοιμασία του τμήματος της βασικής κλάσης του στιγμιοτύπου∙ για " +"παράδειγμα: ``super().__init__([args...])``." -#: reference/datamodel.rst:1618 +#: reference/datamodel.rst:1960 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " "it), no non-``None`` value may be returned by :meth:`__init__`; doing so " "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" +"Επειδή τα :meth:`__new__` και :meth:`__init__` συνεργάζονται για την " +"κατασκευή αντικειμένων (:meth:`__new__` για να το δημιουργήσετε, και :meth:" +"`__init__` για να το προσαρμόσετε), δεν επιτρέπεται να επιστραφεί καμία τιμή " +"μη-``None`` από το :meth:`__init__` ∙ αν το κάνετε αυτό, θα εμφανιστεί ένα :" +"exc:`TypeError` κατά το χρόνο εκτέλεσης." -#: reference/datamodel.rst:1631 +#: reference/datamodel.rst:1973 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -1822,8 +3169,13 @@ msgid "" "explicitly call it to ensure proper deletion of the base class part of the " "instance." msgstr "" +"Καλείται όταν το παράδειγμα πρόκειται να καταστραφεί. Αυτό ονομάζεται " +"επίσης τελικό ή (κακώς) καταστροφέας. Εάν μια βασική κλάση έχει μια μέθοδο :" +"meth:`__del__`, η μέθοδος :meth:`__del__` της παράγωγης κλάσης, εάν υπάρχει, " +"πρέπει να την καλέσει ρητά για να διασφαλιστεί η σωστή διαγραφή του τμήματος " +"της βασικής κλάσης του στιγμιοτύπου." -#: reference/datamodel.rst:1637 +#: reference/datamodel.rst:1979 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -1832,21 +3184,36 @@ msgid "" "about to be destroyed; the current :term:`CPython` implementation only calls " "it once." msgstr "" +"Είναι δυνατό (αν και δεν συνίσταται!) η μέθοδος :meth:`__del__` να αναβάλει " +"την καταστροφή του στιγμιότυπου δημιουργώντας μια νέα αναφορά σε αυτό. Αυτό " +"ονομάζεται αντικείμενο *ανάσταση (resurrection)*. Εξαρτάται από την " +"υλοποίηση εάν το :meth:`__del__` καλείται δεύτερη φορά όταν ένα αναστημένο " +"αντικείμενο πρόκειται να καταστραφεί εξαρτάται από την υλοποίηση∙ η τρέχουσα " +"υλοποίηση του :term:`CPython` την καλεί μόνο μία φορά." -#: reference/datamodel.rst:1644 +#: reference/datamodel.rst:1986 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " -"that still exist when the interpreter exits." +"that still exist when the interpreter exits. :class:`weakref.finalize` " +"provides a straightforward way to register a cleanup function to be called " +"when an object is garbage collected." msgstr "" +"Δεν είναι εγγυημένο ότι οι μέθοδοι :meth:`__del__` καλούνται για αντικείμενα " +"που εξακολουθούν να υπάρχουν κατά την έξοδο του διερμηνέα. Η :class:`weakref." +"finalize` παρέχει έναν απλό τρόπο για την καταχώριση μιας συνάρτησης " +"καθαρισμού που θα καλείται όταν ένα αντικείμενο συλλέγεται από τα σκουπίδια." -#: reference/datamodel.rst:1649 +#: reference/datamodel.rst:1993 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" +"Το ``del x`` δεν καλεί απευθείας το ``x.__del__()`` --- το πρώτο μειώνει το " +"πλήθος αναφοράς για το ``x`` κατά ένα και το δεύτερο καλείται μόνο όταν το " +"πλήθος αναφοράς του ``x`` φτάσει στο μηδέν." -#: reference/datamodel.rst:1654 +#: reference/datamodel.rst:1998 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -1856,19 +3223,29 @@ msgid "" "references its own traceback, which references the locals of all frames " "caught in the traceback." msgstr "" +"Είναι δυνατό για έναν κύκλο αναφοράς να εμποδίσει το πλήθος αναφοράς ενός να " +"μηδενιστεί. Σε αυτήν την περίπτωσης, ο κύκλος θα εντοπιστεί αργότερα και θα " +"διαγραφεί από τον :term:`cyclic garbage collector `. Μια " +"κοινή αιτία κύκλων αναφοράς είναι όταν μια εξαίρεση έχει εντοπιστεί σε μια " +"τοπική μεταβλητή. Στη συνέχεια, τα τοπικά του πλαισίου αναφέρονται στην " +"εξαίρεση, η οποία αναφέρεται στο δικό του traceback, το οποίο αναφέρεται " +"στους τοπικούς αριθμούς όλων των καρέ που έχουν εντοπιστεί στο traceback." -#: reference/datamodel.rst:1664 +#: reference/datamodel.rst:2008 msgid "Documentation for the :mod:`gc` module." -msgstr "" +msgstr "Τεκμηρίωση για το module :mod:`gc`." -#: reference/datamodel.rst:1668 +#: reference/datamodel.rst:2012 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" +"Λόγω των επισφαλών συνθηκών υπό τις οποίες καλούνται οι μέθοδοι :meth:" +"`__del__`, οι εξαιρέσεις που προκύπτουν κατά την εκτέλεση τους αγνοούνται " +"και αντ' αυτού εκτυπώνεται μια προειδοποίηση στο ``sys.stderr``. Ειδικότερα:" -#: reference/datamodel.rst:1672 +#: reference/datamodel.rst:2016 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -1876,8 +3253,13 @@ msgid "" "may already be taken by the code that gets interrupted to execute :meth:" "`__del__`." msgstr "" +"Η :meth:`__del__` μπορεί να καλεστεί, όταν καλείται αυθαίρετος κώδικα, " +"συμπεριλαμβανομένου οποιουδήποτε αυθαίρετου νήματος. Εάν η :meth:`__del__` " +"χρειάζεται να κλειδώσει ή να επικαλεστεί οποιονδήποτε άλλο πόρο αποκλεισμού, " +"μπορεί να είναι αδιέξοδο καθώς ο πόρος μπορεί να έχει ήδη ληφθεί από τον " +"κώδικα που διακόπτεται για να εκτελεστεί :meth:`__del__`." -#: reference/datamodel.rst:1678 +#: reference/datamodel.rst:2022 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -1887,8 +3269,17 @@ msgid "" "such globals exist, this may help in assuring that imported modules are " "still available at the time when the :meth:`__del__` method is called." msgstr "" +"Η :meth:`__del__` μπορεί να εκτελεστεί κατά τη διάρκεια του τερματισμού " +"λειτουργίας του διερμηνέα. Κατά συνέπεια, οι καθολικές μεταβλητές στις " +"οποίες χρειάζεται πρόσβαση (συμπεριλαμβανομένων άλλως modules) μπορεί να " +"έχουν ήδη διαγραφεί ή να έχουν οριστεί σε ``None``. Η Python εγγυάται ότι τα " +"καθολικά των οποίων το όνομα αρχίζει με μία μόνο υπογράμμιση διαγράφονται " +"από το module τους πριν διαγραφούν άλλα καθολικά∙ εάν δεν υπάρχουν άλλες " +"αναφορές σε τέτοια καθολικά, αυτό μπορεί να βοηθήσει στη διασφάλιση ότι τα " +"εισαγόμενα modules εξακολουθούν να είναι διαθέσιμες τη στιγμή που καλείται η " +"μέθοδος :meth:`__del__`." -#: reference/datamodel.rst:1693 +#: reference/datamodel.rst:2037 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -1899,41 +3290,69 @@ msgid "" "`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is also used when " "an \"informal\" string representation of instances of that class is required." msgstr "" +"Καλείται από την ενσωματωμένη συνάρτηση :func:`repr` για τον υπολογισμό της " +"\"official\" αναπαράστασης συμβολοσειράς ενός αντικειμένου. Εάν είναι " +"δυνατόν, αυτό θα πρέπει να μοιάζει με μια έγκυρη έκφραση Python που θα " +"μπορούσε να χρησιμοποιηθεί για την αναδημιουργία ενός αντικειμένου με την " +"ίδια τιμή (δεδομένου ενός κατάλληλου περιβάλλοντος). Εάν αυτό δεν είναι " +"δυνατό, θα πρέπει να επιστραφεί μια συμβολοσειρά της μορφής ``<...κάποια " +"χρήσιμη περιγραφή...>``. Η τιμή επιστροφής πρέπει να είναι αντικείμενο " +"συμβολοσειράς. Εάν μια κλάση ορίζει :meth:`__repr__` αλλά όχι :meth:" +"`__str__`, τότε η :meth:`__repr__` χρησιμοποιείται επίσης όταν απαιτείται " +"μια \"ανεπίσημη\" αναπαράσταση συμβολοσειράς στιγμιοτύπων αυτής της κλάσης." -#: reference/datamodel.rst:1702 +#: reference/datamodel.rst:2046 msgid "" "This is typically used for debugging, so it is important that the " -"representation is information-rich and unambiguous." +"representation is information-rich and unambiguous. A default implementation " +"is provided by the :class:`object` class itself." msgstr "" +"Αυτό χρησιμοποιείται συνήθως για εντοπισμός σφαλμάτων, επομένως είναι " +"σημαντικό η αναπαράσταση να είναι πλούσια σε πληροφορίες και ξεκάθαρη. Μια " +"προεπιλεγμένη υλοποίηση παρέχεται από την ίδια την κλάση :class:`object`." -#: reference/datamodel.rst:1713 +#: reference/datamodel.rst:2058 msgid "" -"Called by :func:`str(object) ` and the built-in functions :func:" -"`format` and :func:`print` to compute the \"informal\" or nicely printable " -"string representation of an object. The return value must be a :ref:`string " -"` object." +"Called by :func:`str(object) `, the default :meth:`__format__` " +"implementation, and the built-in function :func:`print`, to compute the " +"\"informal\" or nicely printable string representation of an object. The " +"return value must be a :ref:`str ` object." msgstr "" +"Καλείται από :func:`str(object) ` και τις ενσωματωμένες συναρτήσεις :" +"meth:`__format__` και :func:`print` για τον υπολογισμό της \"ανεπίσημης\" ή " +"ωραίας εκτύπωσης συμβολοσειράς ενός αντικειμένου. Η τιμή που επιστρέφεται " +"πρέπει να είναι ένα αντικείμενο :ref:`string `." -#: reference/datamodel.rst:1718 +#: reference/datamodel.rst:2063 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" +"Αυτή η μέθοδος διαφέρει από τη :meth:`object.__repr__` στο ότι δεν υπάρχει " +"καμία προσδοκία ότι η :meth:`__str__` θα επιστρέψει μια έγκυρη έκφραση " +"Python: μπορεί να χρησιμοποιηθεί μια πιο βολική ή συνοπτική αναπαράσταση." -#: reference/datamodel.rst:1722 +#: reference/datamodel.rst:2067 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" +"Η προεπιλεγμένη υλοποίηση που ορίζεται από τον ενσωματωμένο τύπο :class:" +"`object` καλεί την :meth:`object.__repr__`." -#: reference/datamodel.rst:1732 +#: reference/datamodel.rst:2077 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " -"of an object. This should return a :class:`bytes` object." +"of an object. This should return a :class:`bytes` object. The :class:" +"`object` class itself does not provide this method." msgstr "" +"Καλείται από :ref:`bytes ` για να υπολογιστεί μια παράσταση " +"συμβολοσειράς byte ενός αντικειμένου. Αυτό θα πρέπει να επιστρέψει ένα :" +"class:`bytes` αντικείμενο. Η ίδια κλάση :class:`object` δεν παρέχει αυτήν τη " +"μέθοδο." -#: reference/datamodel.rst:1743 +#: reference/datamodel.rst:2089 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -1944,29 +3363,52 @@ msgid "" "either delegate formatting to one of the built-in types, or use a similar " "formatting option syntax." msgstr "" +"Καλείται από την ενσωματωμένη συνάρτηση :func:`format` και κατ' επέκταση, " +"αξιολόγηση των :ref:`formatted string literals ` και της μεθόδου :" +"meth:`str.format`, για την παραγωγή μιας \"μορφοποιημένης\" συμβολοσειράς " +"αναπαράστασης ενός αντικειμένου. Το όρισμα *format_spec* είναι μια " +"συμβολοσειρά που περιέχει μια περιγραφή των επιλογών μορφοποίησης που " +"επιθυμείτε. Η ερμηνεία του ορίσματος *format_spec* εξαρτάται από τον τύπο " +"που υλοποιεί τη :meth:`__format__`, ωστόσο οι περισσότερες κλάσεις είτε θα " +"αναθέσουν τη μορφοποίηση σε έναν από τους ενσωματωμένους τύπους είτε θα " +"χρησιμοποιήσουν παρόμοια σύνταξη επιλογής μορφοποίησης." -#: reference/datamodel.rst:1753 +#: reference/datamodel.rst:2099 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" +"Δείτε το :ref:`formatspec` για μια περιγραφή της τυπικής σύνταξης " +"μορφοποίησης." -#: reference/datamodel.rst:1755 +#: reference/datamodel.rst:2101 msgid "The return value must be a string object." +msgstr "Η τιμή επιστροφής πρέπει να είναι αντικείμενο συμβολοσειράς." + +#: reference/datamodel.rst:2103 +msgid "" +"The default implementation by the :class:`object` class should be given an " +"empty *format_spec* string. It delegates to :meth:`__str__`." msgstr "" +"Η προεπιλεγμένη υλοποίηση από την κλάση :class:`object` θα πρέπει να λάβει " +"μια κενή συμβολοσειρά *format_spec*. Αναθέτει την εντολή σε :meth:`__str__`." -#: reference/datamodel.rst:1757 +#: reference/datamodel.rst:2106 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" +"Η ίδια μέθοδος __format__ του ``object`` κάνει raise μια :exc:`TypeError` " +"εάν περάσει οποιαδήποτε μη κενή συμβολοσειρά." -#: reference/datamodel.rst:1761 +#: reference/datamodel.rst:2110 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" +"Το ``object.__format__(x, '')`` είναι πλέον ισοδύναμο με το ``str(x)`` αντί " +"για το ``format(str(x), '')``." -#: reference/datamodel.rst:1777 +#: reference/datamodel.rst:2126 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``xy`` calls ``x.__gt__(y)``, and ``x>=y`` " "calls ``x.__ge__(y)``." msgstr "" +"Αυτές είναι οι λεγόμενες μέθοδοι \"πλούσιας σύγκρισης (rich comparison)\". Η " +"αντιστοιχία μεταξύ των συμβόλων των τελεστών και των ονομάτων των μεθόδων " +"έχει ως εξής: ``xy`` " +"καλεί ``x.__gt__(y)``, και ``x>=y`` καλεί ``x.__ge__(y)``." -#: reference/datamodel.rst:1783 +#: reference/datamodel.rst:2132 msgid "" "A rich comparison method may return the singleton :data:`NotImplemented` if " "it does not implement the operation for a given pair of arguments. By " @@ -1985,8 +3432,16 @@ msgid "" "statement), Python will call :func:`bool` on the value to determine if the " "result is true or false." msgstr "" +"Μια μέθοδος πλούσια σύγκρισης μπορεί να επιστρέψει το singleton :data:" +"`NotImplemented` εάν δεν υλοποιήσει τη λειτουργία για ένα δεδομένο ζεύγος " +"ορισμάτων. Σύμφωνα με τη σύμβαση, επιστρέφονται οι τιμές ``False`` και " +"``True`` για μια επιτυχημένη σύγκριση. Ωστόσο, αυτές οι μέθοδοι μπορούν αν " +"επιστρέψουν οποιαδήποτε τιμή, επομένως εάν ο τελεστής σύγκρισης " +"χρησιμοποιείται σε ένα Boolean περιβάλλον (π.χ., στη συνθήκη μιας πρότασης " +"``if``), η Python θα καλέσει τη συνάρτηση :func:`bool` στην τιμή για να " +"προσδιορίσει εάν το αποτέλεσμα είναι αληθές ή ψευδές." -#: reference/datamodel.rst:1790 +#: reference/datamodel.rst:2139 msgid "" "By default, ``object`` implements :meth:`__eq__` by using ``is``, returning :" "data:`NotImplemented` in the case of a false comparison: ``True if x is y " @@ -1997,15 +3452,43 @@ msgid "" "``x<=y``. To automatically generate ordering operations from a single root " "operation, see :func:`functools.total_ordering`." msgstr "" +"Από προεπιλογή, το ``object`` υλοποιεί την :meth:`__eq__` χρησιμοποιώντας " +"την ``is``, επιστρέφοντας :data:`NotImplemented` σε περίπτωση ψευδούς " +"σύγκρισης: ``True if x is y else NotImplemented``. Για την :meth:`__ne__`, " +"από προεπιλογή αναθέτει σε :meth:`__eq__` και αντιστρέφει το αποτέλεσμα " +"εκτός αν είναι :data:`!NotImplemented`. Δεν υπάρχουν άλλες σιωπηρές σχέσεις " +"μεταξύ των τελεστών σύγκρισης ή των προεπιλεγμένων υλοποιήσεων∙ για " +"παράδειγμα, το αληθές του ``(x.__hash__``." msgstr "" +"Εάν μια κλάση που παρακάμπτει την :meth:`__eq__` χρειάζεται να διατηρήσει " +"την υλοποίηση της :meth:`__hash__` από μια γονική κλάση, ο διερμηνέας πρέπει " +"να ενημερωθεί ρητά για αυτό ορίζονται την ``__hash__ = ." +"__hash__``." -#: reference/datamodel.rst:1869 +#: reference/datamodel.rst:2224 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2091,82 +3638,130 @@ msgid "" "`TypeError` would be incorrectly identified as hashable by an " "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" +"Εάν μια κλάση που δεν παρακάμπτει τη :meth:`__eq__` επιθυμεί να καταστείλει " +"την υποστήριξη κατακερματισμού, θα πρέπει να συμπεριλάβει το ``__hash__ = " +"None`` στον ορισμός της κλάσης. Μια κλάση που ορίζει τη δικιά της :meth:" +"`__hash__` που κάνει raise μια :exc:`TypeError` θα αναγνωριστεί εσφαλμένα ως " +"μια κλάση που μπορεί να κατακερματιστεί από μια κλήση ``isinstance(obj, " +"collections.abc.Hashable)``." -#: reference/datamodel.rst:1878 +#: reference/datamodel.rst:2233 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " "constant within an individual Python process, they are not predictable " "between repeated invocations of Python." msgstr "" +"Από προεπιλογή, οι τιμές :meth:`__hash__` των αντικειμένων str και bytes " +"είναι \"salted\" με μια απρόβλεπτη τυχαία τιμή. Παρόλο που παραμένουν " +"σταθερές μέσα σε μια μεμονωμένη διεργασία Python, δεν είναι προβλέψιμες " +"μεταξύ επαναλαμβανόμενων κλήσεων της Python." -#: reference/datamodel.rst:1883 +#: reference/datamodel.rst:2238 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " "insertion, *O*\\ (*n*\\ :sup:`2`) complexity. See http://ocert.org/" "advisories/ocert-2011-003.html for details." msgstr "" +"Αυτό έχει ως στόχο να παρέχει προστασία από άρνηση υπηρεσίας που προκαλείται " +"από προσεκτικά επιλεγμένες εισόδους που εκμεταλλεύονται τη χειρότερη " +"περίπτωση απόδοσης μιας εισαγωγής ψηφίου, πολυπλοκότητας *O*\\ (*n*\\ :sup:" +"`2`). Δείτε http://ocert.org/advisories/ocert-2011-003.html για " +"λεπτομέρειες." -#: reference/datamodel.rst:1888 +#: reference/datamodel.rst:2243 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" +"Η αλλαγή των τιμών κατακερματισμού επηρεάζει τη σειρά επανάληψης των " +"συνόλων. Η Python δεν έχει δώσει ποτέ εγγυήσεις σχετικά με αυτήν τη σειρά " +"(και συνήθως ποικίλει μεταξύ εκδόσεων 32-bit και 64-bit)." -#: reference/datamodel.rst:1892 +#: reference/datamodel.rst:2247 msgid "See also :envvar:`PYTHONHASHSEED`." -msgstr "" +msgstr "Δείτε επίσης :envvar:`PYTHONHASHSEED`." -#: reference/datamodel.rst:1894 +#: reference/datamodel.rst:2249 msgid "Hash randomization is enabled by default." -msgstr "" +msgstr "Η τυχαιοποίηση κατακερματισμού είναι ενεργοποιημένη από προεπιλογή." -#: reference/datamodel.rst:1902 +#: reference/datamodel.rst:2257 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " "defined, :meth:`~object.__len__` is called, if it is defined, and the object " "is considered true if its result is nonzero. If a class defines neither :" -"meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." -msgstr "" - -#: reference/datamodel.rst:1913 +"meth:`!__len__` nor :meth:`!__bool__` (which is true of the :class:`object` " +"class itself), all its instances are considered true." +msgstr "" +"Καλείται για την υλοποίηση ελέγχου τιμών αλήθειας και την ενσωματωμένη " +"λειτουργία ``bool()`` ∙ θα πρέπει να επιστρέφει ``False`` ή ``True``. Όταν " +"αυτή η μέθοδος δεν έχει οριστεί, καλείται η :meth:`~object.__len__`, εάν " +"έχει οριστεί, και το αντικείμενο θεωρείται αληθές εάν το αποτέλεσμα του " +"είναι μη μηδενικό. Εάν μια κλάση δεν ορίζει ούτε :meth:`!__len__` ούτε :" +"meth:`!__bool__`, (κάτι που ισχύει για την ίδια την κλάση :class:`object`), " +"όλα τα στιγμιότυπα της θεωρούνται αληθείς." + +#: reference/datamodel.rst:2268 msgid "Customizing attribute access" -msgstr "" +msgstr "Προσαρμογή πρόσβασης χαρακτηριστικών" -#: reference/datamodel.rst:1915 +#: reference/datamodel.rst:2270 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" +"Οι ακόλουθες μέθοδοι μπορούν αν οριστούν για την προσαρμογή της έννοιας της " +"πρόσβασης χαρακτηριστικών (χρήση, ανάθεση ή διαγραφή του ``x.name``) για " +"στιγμιότυπα κλάσης." -#: reference/datamodel.rst:1923 +#: reference/datamodel.rst:2278 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " "*name* is not an instance attribute or an attribute in the class tree for " "``self``; or :meth:`__get__` of a *name* property raises :exc:" "`AttributeError`). This method should either return the (computed) " -"attribute value or raise an :exc:`AttributeError` exception." +"attribute value or raise an :exc:`AttributeError` exception. The :class:" +"`object` class itself does not provide this method." msgstr "" +"Καλείται όταν η πρόσβαση προεπιλεγμένου χαρακτηριστικού αποτυγχάνει με μια :" +"exc:`AttributeError` (είτε η :meth:`__getattribute__` κάνει raise μια :exc:" +"`AttributeError` επειδή το *name* δεν είναι χαρακτηριστικό στιγμιοτύπου ή " +"χαρακτηριστικό στο δέντρο κλάσης για το ``self`` ∙ ή η :meth:`__get__` μια " +"ιδιότητας *name* κάνει raise μια :exc:`AttributeError`). Αυτή η μέθοδος θα " +"πρέπει είτε να επιστρέψει την (υπολογισμένη) τιμή του χαρακτηριστικού είτε " +"να κάνει raise μια εξαίρεση :exc:`AttributeError`. Η ίδια η κλάση :class:" +"`object` δεν παρέχει αυτήν τη μέθοδο." -#: reference/datamodel.rst:1930 +#: reference/datamodel.rst:2286 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" "meth:`__getattr__` and :meth:`__setattr__`.) This is done both for " "efficiency reasons and because otherwise :meth:`__getattr__` would have no " "way to access other attributes of the instance. Note that at least for " -"instance variables, you can fake total control by not inserting any values " +"instance variables, you can take total control by not inserting any values " "in the instance attribute dictionary (but instead inserting them in another " "object). See the :meth:`__getattribute__` method below for a way to " "actually get total control over attribute access." msgstr "" +"Σημειώστε ότι εάν το χαρακτηριστικό βρεθεί μέσω του κανονικού μηχανισμού, η :" +"meth:`__getattr__` δεν καλείται. (Αυτή είναι μια σκόπιμη ασυμμετρία μεταξύ " +"της :meth:`__getattr__` και της :meth:`__setattr__`.) Αυτό γίνεται τόσο για " +"λόγους αποδοτικότητας όσο και επειδή διαφορετικά η :meth:`__getattr__` δεν " +"θα είχε κανέναν τρόπο να έχει πρόσβαση σε άλλα χαρακτηριστικά του " +"στιγμιοτύπου. Σημειώστε ότι τουλάχιστον για τις μεταβλητές στιγμιοτύπου, " +"μπορείτε να αναλάβετε πλήρη έλεγχο εισάγοντας καμία τιμή στο λεξικό " +"χαρακτηριστικών στιγμιοτύπου (αλλά αντίθετα εισάγοντάς τις σε ένα άλλο " +"αντικείμενο). Δείτε την παρακάτω μέθοδο :meth:`__getattribute__` για έναν " +"τρόπο να έχετε πραγματικά πλήρη έλεγχο της πρόσβασης σε χαρακτηριστικά." -#: reference/datamodel.rst:1943 +#: reference/datamodel.rst:2299 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2177,83 +3772,100 @@ msgid "" "base class method with the same name to access any attributes it needs, for " "example, ``object.__getattribute__(self, name)``." msgstr "" +"Καλείται χωρίς προϋποθέσεις για την υλοποίηση της πρόσβασης σε " +"χαρακτηριστικά για στιγμιότυπα κλάσης. Αν η κλάση ορίζει επίσης τη μέθοδο :" +"meth:`__getattr__`, αυτή δεν θα κληθεί εκτός αν η :meth:`__getattribute__` " +"την καλέσει ρητά ή κάνει raise μια εξαίρεση :exc:`AttributeError`. Αυτή η " +"μέθοδος πρέπει να επιστρέφει την (υπολογισμένη) τιμή του χαρακτηριστικού ή " +"να κάνει raise μια εξαίρεση :exc:`AttributeError`. Για να αποφευχθεί η " +"ατέρμονη αναδρομή μέσα σε αυτή τη μέθοδο, η υλοποίηση της πρέπει πάντα να " +"καλεί τη μέθοδο της βασικής κλάσης με το ίδιο όνομα για να έχει πρόσβαση σε " +"οποιαδήποτε ιδιότητα χρειάζεται, για παράδειγμα ``object." +"__getattribute__(self, name)``." -#: reference/datamodel.rst:1954 +#: reference/datamodel.rst:2310 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" +"Αυτή η μέθοδος μπορεί ακόμα να παρακαμφθεί κατά την αναζήτηση ειδικών " +"μεθόδων ως αποτέλεσμα σιωπηρής επίκλησης μέσω σύνταξης γλώσσας ή :ref:`built-" +"in functions `. Βλ. :ref:`special-lookup`." -#: reference/datamodel.rst:1959 -msgid "" -"Raises an :ref:`auditing event ` ``object.__getattr__`` with " -"arguments ``obj``, ``name``." -msgstr "" - -#: reference/datamodel.rst:1961 +#: reference/datamodel.rst:2317 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" +"Για συγκεκριμένες προσβάσεις ευαίσθητων χαρακτηριστικών, δημιουργεί ένα :ref:" +"`auditing event ` ``object.__getattr__`` με ορίσματα ``obj`` και " +"``name``." -#: reference/datamodel.rst:1968 +#: reference/datamodel.rst:2324 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" +"Καλείται όταν επιχειρείται εκχώρηση χαρακτηριστικού. Αυτό καλείται αντί για " +"τον κανονικό μηχανισμό (δηλαδή αποθήκευση της τιμής στο λεξικό " +"στιγμιοτύπου). Το *name* είναι το όνομα του χαρακτηριστικού, *value* είναι η " +"τιμή που θα του εκχωρηθεί." -#: reference/datamodel.rst:1972 +#: reference/datamodel.rst:2328 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" +"Εάν η :meth:`__setattr__` θέλει να εκχωρήσει σε ένα χαρακτηριστικό " +"στιγμιοτύπου, θα πρέπει να καλέσει τη μέθοδο της βασικής κλάσης με το ίδιο " +"όνομα, για παράδειγμα, ``object.__setattr__(self, name, value)``." -#: reference/datamodel.rst:1976 -msgid "" -"Raises an :ref:`auditing event ` ``object.__setattr__`` with " -"arguments ``obj``, ``name``, ``value``." -msgstr "" - -#: reference/datamodel.rst:1978 +#: reference/datamodel.rst:2334 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" +"Για ορισμένες εκχωρήσεις ευαίσθητων χαρακτηριστικών, γίνεται raise μια :ref:" +"`auditing event ` ``object.__setattr__`` με ορίσματα ``obj``, " +"``name``, ``value``." -#: reference/datamodel.rst:1985 +#: reference/datamodel.rst:2341 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" +"Όπως η :meth:`__setattr__` αλλά για διαγραφή χαρακτηριστικών αντί για " +"ανάθεση. Αυτό θα πρέπει να εφαρμοστεί μόνο εάν το ``del obj.name`` έχει " +"νόημα για το αντικείμενο." -#: reference/datamodel.rst:1988 -msgid "" -"Raises an :ref:`auditing event ` ``object.__delattr__`` with " -"arguments ``obj``, ``name``." -msgstr "" - -#: reference/datamodel.rst:1990 +#: reference/datamodel.rst:2346 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" +"Για ορισμένες διαγραφές ευαίσθητων χαρακτηριστικών, κάνει raise ένα :ref:" +"`auditing event ` ``object.__delattr__`` με ορίσματα ``obj`` και " +"``name``." -#: reference/datamodel.rst:1997 +#: reference/datamodel.rst:2353 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" +"Καλείται όταν η :func:`dir` καλείται στο αντικείμενο. Πρέπει να επιστραφεί " +"ένα iterable. Η :func:`dir` μετατρέπει το iterable που επιστρέφεται σε λίστα " +"και τον ταξινομεί." -#: reference/datamodel.rst:2002 +#: reference/datamodel.rst:2358 msgid "Customizing module attribute access" -msgstr "" +msgstr "Προσαρμογή πρόσβασης χαρακτηριστικών module" -#: reference/datamodel.rst:2009 +#: reference/datamodel.rst:2368 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2264,60 +3876,120 @@ msgid "" "``__dict__`` before raising an :exc:`AttributeError`. If found, it is called " "with the attribute name and the result is returned." msgstr "" +"Οι ειδικές ονομασίες ``__getattr__`` και ``__dir__`` μπορούν επίσης να " +"χρησιμοποιηθούν για την προσαρμογή της πρόσβασης στα χαρακτηριστικά του " +"module. Η συνάρτηση ``__getattr__`` στο επίπεδο του module πρέπει να δέχεται " +"ένα όρισμα, το οποίο είναι το όνομα ενός χαρακτηριστικού, και να επιστρέφει " +"την υπολογισμένη τιμή ή να κάνει raise μια εξαίρεση :exc:`AttributeError`. " +"Εάν ένα χαρακτηριστικό δεν βρεθεί σε ένα αντικείμενο module μέσω της " +"κανονικής αναζήτησης, δηλαδή με τη μέθοδο :meth:`object.__getattribute__`, " +"τότε η μέθοδος ``__getattr__`` αναζητείται στο λεξικό ``__dict__`` του " +"module πριν γίνει raise η εξαίρεση :exc:`AttributeError`. Αν βρεθεί, " +"καλείται με το όνομα της ιδιότητας και το αποτέλεσμα επιστρέφεται." -#: reference/datamodel.rst:2018 +#: reference/datamodel.rst:2377 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" +"Η συνάρτηση ``__dir__`` δεν πρέπει να δέχεται ορίσματα και να επιστρέφει μια " +"επαναλαμβανόμενη σειρά συμβολοσειρών που αντιπροσωπεύει τα ονόματα που είναι " +"προσβάσιμα στο module. Εάν υπάρχει, αυτή η συνάρτηση παρακάμπτει την τυπική " +"αναζήτηση :func:`dir` σε ένα module." -#: reference/datamodel.rst:2022 +#: reference/datamodel.rst:2383 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" +"Για μια πιο λεπτομερή προσαρμογή της συμπεριφοράς του module (ρύθμιση " +"χαρακτηριστικών, ιδιοτήτων κλπ.), μπορεί κανείς να ορίσει το χαρακτηριστικό " +"``__class__`` ενός αντικειμένου module σε μια υποκλάση :class:`types." +"ModuleType`. Για παράδειγμα::" + +#: reference/datamodel.rst:2387 +msgid "" +"import sys\n" +"from types import ModuleType\n" +"\n" +"class VerboseModule(ModuleType):\n" +" def __repr__(self):\n" +" return f'Verbose {self.__name__}'\n" +"\n" +" def __setattr__(self, attr, value):\n" +" print(f'Setting {attr}...')\n" +" super().__setattr__(attr, value)\n" +"\n" +"sys.modules[__name__].__class__ = VerboseModule" +msgstr "" +"import sys\n" +"from types import ModuleType\n" +"\n" +"class VerboseModule(ModuleType):\n" +" def __repr__(self):\n" +" return f'Verbose {self.__name__}'\n" +"\n" +" def __setattr__(self, attr, value):\n" +" print(f'Setting {attr}...')\n" +" super().__setattr__(attr, value)\n" +"\n" +"sys.modules[__name__].__class__ = VerboseModule" -#: reference/datamodel.rst:2040 +#: reference/datamodel.rst:2401 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " "module globals (whether by code within the module, or via a reference to the " "module's globals dictionary) is unaffected." msgstr "" +"Ο καθορισμός του module ``__getattr__`` και η ρύθμιση του module " +"``__class__`` επηρεάζουν μόνο τις αναζητήσεις που πραγματοποιούνται με χρήση " +"της σύνταξης πρόσβασης χαρακτηριστικών -- η απευθείας πρόσβαση στα καθολικά " +"του module (είτε μέσω κώδικας εντός του module, είτε μέσω αναφοράς στο " +"λεξικό καθολικών του module) δεν επηρεάζεται." -#: reference/datamodel.rst:2045 +#: reference/datamodel.rst:2406 msgid "``__class__`` module attribute is now writable." -msgstr "" +msgstr "Το χαρακτηριστικό ``__class__`` του module είναι πλέον εγγράψιμο." -#: reference/datamodel.rst:2048 +#: reference/datamodel.rst:2409 msgid "``__getattr__`` and ``__dir__`` module attributes." -msgstr "" +msgstr "Τα χαρακτηριστικά ``__getattr__`` και ``__dir__`` του module." -#: reference/datamodel.rst:2053 +#: reference/datamodel.rst:2414 msgid ":pep:`562` - Module __getattr__ and __dir__" -msgstr "" +msgstr ":pep:`562` - Module __getattr__ and __dir__" -#: reference/datamodel.rst:2054 +#: reference/datamodel.rst:2415 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." -msgstr "" +msgstr "Περιγράφει τις συναρτήσεις ``__getattr__`` και ``__dir__`` σε modules." -#: reference/datamodel.rst:2060 +#: reference/datamodel.rst:2421 msgid "Implementing Descriptors" -msgstr "" +msgstr "Υλοποίηση Περιγραφέων" -#: reference/datamodel.rst:2062 +#: reference/datamodel.rst:2423 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " "descriptor must be in either the owner's class dictionary or in the class " "dictionary for one of its parents). In the examples below, \"the " "attribute\" refers to the attribute whose name is the key of the property in " -"the owner class' :attr:`~object.__dict__`." -msgstr "" +"the owner class' :attr:`~object.__dict__`. The :class:`object` class itself " +"does not implement any of these protocols." +msgstr "" +"Οι παρακάτω μέθοδοι ισχύουν μόνο όταν ένα στιγμιότυπο της κλάσης που " +"περιέχει τη μέθοδο (μια λεγόμενη κλάση *περιγραφέα*) εμφανίζεται μια " +"*ιδιοκτήτρια* κλάση (ο περιγραφέας πρέπει να βρίσκεται είτε στο λεξικό της " +"κλάσης της ιδιοκτήτριας είτε στο λεξικό κλάσης κάποιου από τους γονείς " +"της). Στα παρακάτω παραδείγματα, \"το χαρακτηριστικό\" αναφέρεται στο " +"χαρακτηριστικό του οποίου το όνομα είναι το κλειδί της ιδιότητας στο :attr:" +"`~object.__dict__` της ιδιοκτήτριας κλάσης. Η ίδια η κλάση :class:`object` " +"δεν υλοποιεί κανένα από αυτά τα πρωτόκολλα." -#: reference/datamodel.rst:2072 +#: reference/datamodel.rst:2433 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2325,14 +3997,22 @@ msgid "" "the attribute was accessed through, or ``None`` when the attribute is " "accessed through the *owner*." msgstr "" +"Καλείται για να ληφθεί η ιδιότητα της ιδιοκτήτρια κλάσης (πρόσβαση σε " +"χαρακτηριστικό κλάσης) ή ενός στιγμιοτύπου αυτή της κλάση (πρόσβαση σε " +"χαρακτηριστικό στιγμιοτύπου). Η προαιρετική παράμετρος *owner* είναι η " +"ιδιοκτήτρια κλάση, ενώ η *instance* είναι το στιγμιότυπο μέσω της οποίας " +"έγινε πρόσβαση στο χαρακτηριστικό, ή ``None`` όταν η πρόσβαση στο " +"χαρακτηριστικό έγινε μέσω της *owner*." -#: reference/datamodel.rst:2078 +#: reference/datamodel.rst:2439 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" +"Αυτή η μέθοδος πρέπει να επιστρέφει την υπολογισμένη τιμή του " +"χαρακτηριστικού ή να κάνει raise μια :exc:`AttributeError` εξαίρεση." -#: reference/datamodel.rst:2081 +#: reference/datamodel.rst:2442 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2341,32 +4021,47 @@ msgid "" "implementation always passes in both arguments whether they are required or " "not." msgstr "" +"Το :PEP:`252` ορίζει ότι η μέθοδος :meth:`__get__` μπορεί να καλείται με ένα " +"ή δύο ορίσματα. Οι ενσωματωμένοι περιγραφείς της Python υποστηρίζουν αυτή " +"την προδιαγραφή∙ ωστόσο, είναι πιθανό κάποια εργαλεία τρίτων να έχουν " +"περιγραφείς που απαιτούν και τα δύο ορίσματα. Η ενσωματωμένη υλοποίηση της " +"Python για τη μέθοδο :meth:`__getattribute__` περνάει πάντα και τα δύο " +"ορίσματα, είτε είναι απαραίτητα είτε όχι." -#: reference/datamodel.rst:2090 +#: reference/datamodel.rst:2451 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" +"Καλείται για να οριστεί το χαρακτηριστικό σε ένα στιγμιότυπο *instance* της " +"ιδιοκτήτρια κλάσης σε μια νέα τιμή, *value*." -#: reference/datamodel.rst:2093 +#: reference/datamodel.rst:2454 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" +"Σημείωση, η προσθήκη της :meth:`__set__` ή :meth:`__delete__` αλλάζει το " +"είδος του περιγραφέα σε έναν \"περιγραφέα δεδομένων\". Δείτε το :ref:" +"`descriptor-invocation` για περισσότερες λεπτομέρειες." -#: reference/datamodel.rst:2099 +#: reference/datamodel.rst:2460 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" +"Καλείται για να διαγραφεί το χαρακτηριστικό σε ένα στιγμιότυπο *instance* " +"της ιδιοκτήτρια κλάσης." -#: reference/datamodel.rst:2101 +#: reference/datamodel.rst:2462 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" +"Τα στιγμιότυπα περιγραφέων μπορείς επίσης να έχουν διαθέσιμο το " +"χαρακτηριστικό :attr:`!__objclass__`:" -#: reference/datamodel.rst:2106 +#: reference/datamodel.rst:2467 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2376,12 +4071,20 @@ msgid "" "argument (for example, CPython sets this attribute for unbound methods that " "are implemented in C)." msgstr "" +"Το χαρακτηριστικό :attr:`!__objclass__` ερμηνεύεται από το module :mod:" +"`inspect` ως ένδειξη κλάσης στην οποία ορίστηκε το αντικείμενο (η κατάλληλη " +"ρύθμιση αυτής μπορεί να βοηθήσει στην ανάκτηση πληροφοριών κατά την εκτέλεση " +"για δυναμικά χαρακτηριστικά κλάσεων). Για αυτά που μπορούν να κληθούν, " +"μπορεί να υποδεικνύει ότι ένα στιγμιότυπο του δεδομένου τύπου (ή μιας " +"υποκλάσης του) αναμένεται ή απαιτείται ως το πρώτο όρισμα θέσεως (για " +"παράδειγμα, η CPython θέτει αυτήν την ιδιότητα για μη δεσμευμένες μεθόδους " +"που έχουν υλοποιηθεί σε C)." -#: reference/datamodel.rst:2117 +#: reference/datamodel.rst:2478 msgid "Invoking Descriptors" -msgstr "" +msgstr "Κλήση Descriptors" -#: reference/datamodel.rst:2119 +#: reference/datamodel.rst:2480 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2389,71 +4092,100 @@ msgid "" "`~object.__delete__`. If any of those methods are defined for an object, it " "is said to be a descriptor." msgstr "" +"Γενικά, ένας descriptor είναι ένα χαρακτηριστικό αντικειμένου με " +"\"συμπεριφορά δέσμευσης\", δηλαδή μια ιδιότητα της οποίας η πρόσβαση έχει " +"παρακαμφθεί μέσω μεθόδων του πρωτοκόλλου περιγραφέα :meth:`~object." +"__get__`, :meth:`~object.__set__`, και :meth:`~object.__delete__`. Αν " +"οποιαδήποτε από αυτές τις μεθόδους έχει οριστεί για ένα αντικείμενο, τότε το " +"αντικείμενο αυτό θεωρείται descriptor." -#: reference/datamodel.rst:2125 +#: reference/datamodel.rst:2486 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " "chain starting with ``a.__dict__['x']``, then ``type(a).__dict__['x']``, and " "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" +"Η προεπιλεγμένη συμπεριφορά για την πρόσβαση χαρακτηριστικών είναι η " +"ανάκτηση, ο ορισμός, ή η διαγραφή του χαρακτηριστικού από το λεξικό ενός " +"αντικειμένου. Για παράδειγμα, το ``a.x`` έχει μια αλυσίδα αναζήτησης που " +"ξεκινά με ``a.__dict__['x']``, στη συνέχεια με ``type(a).__dict__['x']`` και " +"συνεχίζει στις βασικές κατηγορίες του ``type(a)`` εξαιρουμένων των " +"μετακλάσεων." -#: reference/datamodel.rst:2130 +#: reference/datamodel.rst:2491 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " "descriptor method instead. Where this occurs in the precedence chain " "depends on which descriptor methods were defined and how they were called." msgstr "" +"Ωστόσο, εάν η τιμή αναζήτησης είναι ένα αντικείμενο που ορίζει μία από τις " +"μεθόδους περιγραφής, τότε η Python μπορεί να παρακάμψει την προεπιλεγμένη " +"συμπεριφορά και να επικαλεστεί τη μέθοδο περιγραφής. Το πού συμβαίνει αυτό " +"στην αλυσίδα προτεραιότητας εξαρτάται από το ποιες μέθοδοι περιγραφής " +"ορίστηκαν και πώς ονομάστηκαν." -#: reference/datamodel.rst:2135 +#: reference/datamodel.rst:2496 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" +"Το σημείο εκκίνηση για την επίκληση του περιγραφέα είναι ένα δεσμευτικό, ``a." +"x``. Ο τρόπος συναρμολόγησης των ορισμάτων εξαρτάται από το ``a``:" -#: reference/datamodel.rst:2140 +#: reference/datamodel.rst:2499 msgid "Direct Call" -msgstr "" +msgstr "Απευθείας Κλήση" -#: reference/datamodel.rst:2139 +#: reference/datamodel.rst:2500 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" +"Η απλούστερη και λιγότερο συνηθισμένη κλήση είναι όταν ο κωδικός χρήστη " +"καλεί απευθείας μια μέθοδο περιγραφής: ``x.__get__(a)``." -#: reference/datamodel.rst:2144 +#: reference/datamodel.rst:2503 msgid "Instance Binding" -msgstr "" +msgstr "Δέσμευση Στιγμιοτύπου" -#: reference/datamodel.rst:2143 +#: reference/datamodel.rst:2504 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" +"Εάν δεσμεύεται σε ένα στιγμιότυπο αντικειμένου, το ``a.x`` μετατρέπεται στην " +"κλήση: ``type(a).__dict__['x'].__get__(a, type(a))``." -#: reference/datamodel.rst:2148 +#: reference/datamodel.rst:2507 msgid "Class Binding" -msgstr "" +msgstr "Δέσμευση Κλάσης" -#: reference/datamodel.rst:2147 +#: reference/datamodel.rst:2508 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" +"Εάν δεσμεύεται σε μια κλάση, το ``A.x`` μετατρέπεται στην κλήση: ``A." +"__dict__['x'].__get__(None, A)``." -#: reference/datamodel.rst:2154 +#: reference/datamodel.rst:2511 msgid "Super Binding" -msgstr "" +msgstr "Υπερ-Δέσμευση" -#: reference/datamodel.rst:2151 +#: reference/datamodel.rst:2512 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" +"Μια διακεκομμένη αναζήτηση όπως ``super(A, a).x`` αναζητά το ``a.__class__." +"__mro__`` για μια βασική κλάση ``B`` μετά το ``A`` και, στη συνέχεια, " +"επιστρέφει το ``B.__dict__['x'].__get__(a, A)``. Εάν δεν είναι περιγραφέας, " +"το ``x`` επιστρέφεται αμετάβλητο." -#: reference/datamodel.rst:2188 +#: reference/datamodel.rst:2549 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2470,59 +4202,96 @@ msgid "" "dictionary. In contrast, non-data descriptors can be overridden by " "instances." msgstr "" +"Για δεσμεύσεις στιγμιοτύπου, η προτεραιότητα της κλήση του περιγραφέα " +"εξαρτάται από το ποιες μέθοδοι περιγραφέα έχουν οριστεί. Ένα περιγραφέας " +"μπορεί να ορίσει οποιονδήποτε συνδυασμό των :meth:`~object.__get__`, :meth:" +"`~object.__set__` και :meth:`~object.__delete__`. Αν δεν ορίσει τη μέθοδο :" +"meth:`!__get__`, τότε η πρόσβαση στην ιδιότητα θα επιστρέψει το ίδιο το " +"αντικείμενο του περιγραφέα, εκτός αν υπάρχει τιμή στο λεξικό στιγμιοτύπου " +"του αντικειμένου. Αν ο περιγραφέας ορίζει τη μέθοδο :meth:`!__set__` και/ή :" +"meth:`!__delete__`, θεωρείται περιγραφέας δεδομένων∙ αν δεν ορίζει καμία από " +"τις δύο, είναι μη-περιγραφέας δεδομένων. Συνήθως, οι περιγραφείς δεδομένων " +"ορίζουν και τις δύο :meth:`!__get__` και :meth:`!__set__`, ενώ οι μη-" +"περιγραφείς δεδομένων έχουν μόνο τη μέθοδο :meth:`!__get__`. Οι περιγραφείς " +"δεδομένων που έχουν ορίσει :meth:`!__get__` και :meth:`!__set__` (και/ή :" +"meth:`!__delete__`) υπερισχύουν πάντα από έναν επαναπροσδιορισμό στο λεξικό " +"στιγμιοτύπου. Αντίθετα, οι μη περιγραφείς δεδομένων μπορούν να παρακαμφθούν " +"από στιγμιότυπα." + +#: reference/datamodel.rst:2564 +msgid "" +"Python methods (including those decorated with :deco:`staticmethod` and :" +"deco:`classmethod`) are implemented as non-data descriptors. Accordingly, " +"instances can redefine and override methods. This allows individual " +"instances to acquire behaviors that differ from other instances of the same " +"class." +msgstr "" +"Οι μέθοδοι Python (συμπεριλαμβανομένων εκείνων που είναι διακοσμημένες με :" +"deco:`staticmethod` και :deco:`classmethod`) υλοποιούνται ως περιγραφέα " +"χωρίς δεδομένα. Αντίστοιχα, τα στιγμιότυπα μπορούν να επαναπροσδιορίσουν και " +"να παρακάμψουν μεθόδους. Αυτό επιτρέπει σε μεμονωμένα στιγμιότυπα να " +"αποκτήσουν συμπεριφορές που διαφέρουν από άλλα στιγμιότυπα της ίδιας κλάσης." -#: reference/datamodel.rst:2203 -msgid "" -"Python methods (including those decorated with :func:`@staticmethod " -"` and :func:`@classmethod `) are implemented as " -"non-data descriptors. Accordingly, instances can redefine and override " -"methods. This allows individual instances to acquire behaviors that differ " -"from other instances of the same class." -msgstr "" - -#: reference/datamodel.rst:2209 +#: reference/datamodel.rst:2570 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" +"Η συνάρτηση :func:`property` υλοποιείται ως περιγραφέας δεδομένων. Συνεπώς, " +"οι περιπτώσεις δεν μπορούν να παρακάμψουν τη συμπεριφορά μιας ιδιότητας." -#: reference/datamodel.rst:2216 +#: reference/datamodel.rst:2577 msgid "__slots__" -msgstr "" +msgstr "__slots__" -#: reference/datamodel.rst:2218 +#: reference/datamodel.rst:2579 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" +"Το *__slots__* μας επιτρέπει να δηλώνουμε ρητά τα μέλη δεδομένων (όπως " +"ιδιότητες) και να αρνηθούμε τη δημιουργία των :attr:`~object.__dict__` και " +"*__weakref__* (εκτός εάν δηλώνεται ρητά στο *__slots__* ή είναι διαθέσιμο σε " +"έναν γονέα.)" -#: reference/datamodel.rst:2222 +#: reference/datamodel.rst:2583 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" +"Ο χώρος που εξοικονομείται χρησιμοποιώντας :attr:`~object.__dict__` μπορεί " +"να είναι σημαντικός. Η ταχύτητα αναζήτησης χαρακτηριστικών μπορεί επίσης να " +"βελτιωθεί σημαντικά." -#: reference/datamodel.rst:2227 +#: reference/datamodel.rst:2588 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " "for the declared variables and prevents the automatic creation of :attr:" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" +"Σε αυτήν την μεταβλητή κλάσης μπορεί να εκχωρηθεί μια συμβολοσειρά, iterable " +"ή ακολουθία συμβολοσειρών με ονόματα μεταβλητών που χρησιμοποιούνται από " +"στιγμιότυπα. Το *__slots__* διατηρεί χώρο για τις δηλωμένες μεταβλητές και " +"αποτρέπει την αυτόματη δημιουργία των :attr:`~object.__dict__` και " +"*__weakref__* για κάθε περίπτωση." -#: reference/datamodel.rst:2236 +#: reference/datamodel.rst:2597 msgid "Notes on using *__slots__*:" -msgstr "" +msgstr "Σημειώσεις σχετικά με τη χρήση *__slots__*:" -#: reference/datamodel.rst:2238 +#: reference/datamodel.rst:2599 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" +"Όταν γίνεται κληρονομιά από μια κλάση χωρίς *__slots__*, το χαρακτηριστικό :" +"attr:`~object.__dict__` και *__weakref__* των στιγμιοτύπων θα είναι πάντα " +"προσβάσιμο." -#: reference/datamodel.rst:2242 +#: reference/datamodel.rst:2603 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2530,33 +4299,56 @@ msgid "" "assignment of new variables is desired, then add ``'__dict__'`` to the " "sequence of strings in the *__slots__* declaration." msgstr "" +"Χωρίς μια μεταβλητή :attr:`~object.__dict__`, τα στιγμιότυπα δεν μπορούν να " +"αντιστοιχιστούν σε νέες μεταβλητές που δεν αναφέρονται στον ορισμό " +"*__slots__*. Οι προσπάθειες αντιστοίχισης σε ένα όνομα μεταβλητής εκτός " +"λίστας κάνουν raise τη :exc:`AttributeError`. Εάν είναι επιθυμητή η δυναμική " +"αντιστοίχιση νέων μεταβλητών, τότε προσθέστε το ``'__dict__'`` στην " +"ακολουθία συμβολοσειρών στη δήλωση *__slots__*." -#: reference/datamodel.rst:2249 +#: reference/datamodel.rst:2610 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " "instances. If weak reference support is needed, then add ``'__weakref__'`` " "to the sequence of strings in the *__slots__* declaration." msgstr "" +"Χωρίς μια μεταβλητή *__weakref__* για κάθε στιγμιότυπο, οι κλάσεις που " +"ορίζουν *__slots__* δεν υποστηρίζουν :mod:`weak references ` στα " +"στιγμιότυπα τους. Εάν απαιτείται αδύναμη υποστήριξη για αδύναμες αναφορές, " +"τότε προσθέστε το ``'__weakref__'`` στην ακολουθία των συμβολοσειρών στη " +"δήλωση των *__slots__*." -#: reference/datamodel.rst:2255 +#: reference/datamodel.rst:2616 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " "be used to set default values for instance variables defined by *__slots__*; " "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" +"Τα *__slots__* υλοποιούνται σε επίπεδα κλάσης με τη δημιουργία :ref:" +"`descriptors ` για κάθε όνομα μεταβλητής. Ως ένα αποτέλεσμα, " +"οι ιδιότητες της κλάσης δεν μπορούν να χρησιμοποιηθούν για να ορίσουν " +"προεπιλεγμένες τιμές για μεταβλητές στιγμιοτύπων που έχουν δηλωθεί μέσω " +"*__slots__* ∙ διαφορετικά, το χαρακτηριστικό της κλάσης θα αντικαθιστούσε " +"την ανάθεση του descriptor." -#: reference/datamodel.rst:2261 +#: reference/datamodel.rst:2622 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " -"However, child subclasses will get a :attr:`~object.__dict__` and " -"*__weakref__* unless they also define *__slots__* (which should only contain " -"names of any *additional* slots)." +"However, instances of a child subclass will get a :attr:`~object.__dict__` " +"and *__weakref__* unless the subclass also defines *__slots__* (which should " +"only contain names of any *additional* slots)." msgstr "" +"Η ενέργεια μιας δήλωσης *__slots__* δεν περιορίζεται μόνο στην κλάση όπου " +"ορίζεται. Τα *__slots__* που δηλώνονται σε γονικές κλάσεις είναι διαθέσιμα " +"και στις θυγατρικές κλάσεις. Ωστόσο, οι θυγατρικές κλάσεις θα αποκτήσουν " +"ένα :attr:`~object.__dict__` και *__weakref__*, εκτός αν δηλώσουν και οι " +"ίδιες *__slots__* (τα οποία θα πρέπει να περιέχουν μόνο τα *επιπλέον* " +"ονόματα slots)." -#: reference/datamodel.rst:2267 +#: reference/datamodel.rst:2628 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2564,53 +4356,80 @@ msgid "" "meaning of the program undefined. In the future, a check may be added to " "prevent this." msgstr "" +"Αν μια κλάση ορίσει ένα slot που έχει ήδη οριστεί σε μια γονική κλάση, τότε " +"η μεταβλητή στιγμιοτύπου που ορίζεται από το slot της γονικής κλάσης γίνεται " +"μη προσβάσιμη (εκτός αν ανακτηθεί απευθείας ο descriptor της από τη γονική " +"κλάση). Αυτό καθιστά το νόημα του προγράμματος ασαφές. Στο μέλλον, μπορεί " +"να προστεθεί έλεγχος που να αποτρέπει κάτι τέτοιο." -#: reference/datamodel.rst:2272 +#: reference/datamodel.rst:2633 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " "` such as :class:`int`, :class:`bytes`, and :class:" "`tuple`." msgstr "" +"Θα γίνει raise :exc:`TypeError` αν οριστούν μη κενά *__slots__* σε μια κλάση " +"που προέρχεται από έναν :c:member:`\"variable-length\" ενσωματωμένο τύπο " +"`, όπως οι :class:`int`, :class:`bytes`, και :" +"class:`tuple`." -#: reference/datamodel.rst:2277 +#: reference/datamodel.rst:2638 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" +"Οποιαδήποτε μη συμβολοσειρά :term:`iterable` μπορεί να εκχωρηθεί σε " +"*__slots__*." -#: reference/datamodel.rst:2279 +#: reference/datamodel.rst:2640 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " "can be used to provide per-attribute docstrings that will be recognised by :" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" +"Αν χρησιμοποιηθεί μια :class:`dictionary ` για την ανάθεση των " +"*__slots__*, τα κλειδιά του λεξικού θα χρησιμοποιηθούν ως ονόματα των slots. " +"Οι τιμές του λεξικού μπορούν να χρησιμοποιηθούν για να παρέχουν τεκμηρίωση " +"(docstrings) για κάθε ιδιότητα ξεχωριστά, η οποία θα αναγνωρίζεται από τη " +"συνάρτηση :func:`inspect.getdoc` και θα εμφανίζεται στην έξοδο της :func:" +"`help`." -#: reference/datamodel.rst:2284 +#: reference/datamodel.rst:2645 msgid "" -":attr:`~instance.__class__` assignment works only if both classes have the " +":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" +"Η ανάθεση στη :attr:`~object.__class__` λειτουργεί μόνο αν και οι δύο " +"κλάσεις έχουν τα ίδια *__slots__*." -#: reference/datamodel.rst:2287 +#: reference/datamodel.rst:2648 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " "created by slots (the other bases must have empty slot layouts) - violations " "raise :exc:`TypeError`." msgstr "" +"Το :ref:`Multiple inheritance ` με πολλαπλές γονικές κλάσεις " +"που χρησιμοποιούν __slots__ μπορεί να χρησιμοποιηθεί, αλλά επιτρέπεται μόνο " +"ένας γονέας να έχει ορίσει ιδιότητες μέσω των slots (οι υπόλοιπες γονικές " +"κλάσεις πρέπει να έχουν κενή διάταξη slots) - παραβιάσεις αυτού κάνουν " +"raise :exc:`TypeError`." -#: reference/datamodel.rst:2293 +#: reference/datamodel.rst:2654 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" +"Εάν χρησιμοποιείται ένας :term:`iterator` για *__slots__* τότε δημιουργείται " +"ένας :term:`descriptor` για κάθε μία από τις τιμές του iterator. Ωστόσο, το " +"χαρακτηριστικό *__slots__* θα είναι ένας κενός iterator." -#: reference/datamodel.rst:2301 +#: reference/datamodel.rst:2662 msgid "Customizing class creation" -msgstr "" +msgstr "Προσαρμογή δημιουργίας κλάσης" -#: reference/datamodel.rst:2303 +#: reference/datamodel.rst:2664 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -2619,113 +4438,213 @@ msgid "" "specific class they're applied to, ``__init_subclass__`` solely applies to " "future subclasses of the class defining the method." msgstr "" +"Όποτε μια κλάση κληρονομεί από μια άλλη κλάση, τη :meth:`~object." +"__init_subclass__` καλείται μια γονική κλάση. Με αυτόν τον τρόπο, είναι " +"δυνατόν να γραφτούν κλάσεις που αλλάζουν τη συμπεριφορά των υποκλάσεων. Αυτό " +"σχετίζεται στενά με τους decorators των κλάσεων, αλλά όπου οι decorators " +"κλάσεων επηρεάζουν μόνο τη συγκεκριμένη κλάση στην οποία εφαρμόζονται, το " +"``__init_subclass__`` ισχύει αποκλειστικά για μελλοντικές υποκλάσεις της " +"κλάσης που ορίζουν τη μέθοδο." -#: reference/datamodel.rst:2312 +#: reference/datamodel.rst:2673 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" +"Αυτή η μέθοδος καλείται κάθε φορά που η κλάση περιέχει υποκλάση. Το *cls* " +"είναι τότε η νέα υποκλάση. Εάν οριστεί ως μια κανονική μέθοδος στιγμιοτύπου, " +"αυτή η μέθοδος μετατρέπεται σιωπηρά σε μέθοδο κλάσης." -#: reference/datamodel.rst:2316 +#: reference/datamodel.rst:2677 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " "``__init_subclass__``, one should take out the needed keyword arguments and " "pass the others over to the base class, as in::" msgstr "" +"Τα ορίσματα λέξεων-κλειδιών που δίνονται σε μια νέα κλάση μεταβιβάζονται στη " +"``__init_subclass__``. Για συμβατότητα με άλλες κλάσεις που χρησιμοποιούν " +"``__init_subclass__``, θα πρέπει να αφαιρεθούν τα απαραίτητα ορίσματα λέξεων-" +"κλειδιών και να περάσουν τα άλλα στη βασική κλάση, όπως στο::" + +#: reference/datamodel.rst:2683 +msgid "" +"class Philosopher:\n" +" def __init_subclass__(cls, /, default_name, **kwargs):\n" +" super().__init_subclass__(**kwargs)\n" +" cls.default_name = default_name\n" +"\n" +"class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" +" pass" +msgstr "" +"class Philosopher:\n" +" def __init_subclass__(cls, /, default_name, **kwargs):\n" +" super().__init_subclass__(**kwargs)\n" +" cls.default_name = default_name\n" +"\n" +"class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" +" pass" -#: reference/datamodel.rst:2330 +#: reference/datamodel.rst:2691 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" +"Η προεπιλεγμένη υλοποίηση ``object.__init_subclass__`` δεν κάνει τίποτα, " +"αλλά δημιουργεί ένα σφάλμα εάν καλείται με οποιαδήποτε ορίσματα." -#: reference/datamodel.rst:2335 +#: reference/datamodel.rst:2696 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " "actual metaclass (rather than the explicit hint) can be accessed as " "``type(cls)``." msgstr "" +"Η υπόδειξη μετακλάσης ``metaclass`` καταναλώνεται από τα υπόλοιπα μηχανήματα " +"τύπου και δεν μεταβιβάζεται ποτέ στις υλοποιήσεις ``__init_subclass__``. Η " +"πραγματική μετακλάση (και όχι η ρητή υπόδειξη) μπορεί να προσπελαστεί ως " +"``type(cls)``." -#: reference/datamodel.rst:2343 +#: reference/datamodel.rst:2704 msgid "" -"When a class is created, :meth:`type.__new__` scans the class variables and " +"When a class is created, :meth:`!type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" +"Όταν δημιουργείται μια κλάση, η :meth:`!type.__new__` σαρώνει τις μεταβλητές " +"κλάσης και πραγματοποιεί επανάκληση σε εκείνες με ένα :meth:`~object." +"__set_name__` hook." -#: reference/datamodel.rst:2348 +#: reference/datamodel.rst:2709 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" +"Καλείται αυτόματα τη στιγμή που δημιουργείται η ιδιοκτήτρια κλάση *owner*. " +"Το αντικείμενο έχει εκχωρηθεί στο *name* σε αυτήν την κλάση::" + +#: reference/datamodel.rst:2712 +msgid "" +"class A:\n" +" x = C() # Automatically calls: x.__set_name__(A, 'x')" +msgstr "" +"class A:\n" +" x = C() # Automatically calls: x.__set_name__(A, 'x')" -#: reference/datamodel.rst:2354 +#: reference/datamodel.rst:2715 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" +"Εάν η μεταβλητή κλάσης εκχωρηθεί μετά τη δημιουργία της κλάσης, η :meth:" +"`__set_name__` δεν θα κληθεί αυτόματα. Εάν χρειάζεται, η :meth:" +"`__set_name__` μπορεί να κληθεί απευθείας::" -#: reference/datamodel.rst:2365 +#: reference/datamodel.rst:2719 +msgid "" +"class A:\n" +" pass\n" +"\n" +"c = C()\n" +"A.x = c # The hook is not called\n" +"c.__set_name__(A, 'x') # Manually invoke the hook" +msgstr "" +"class A:\n" +" pass\n" +"\n" +"c = C()\n" +"A.x = c # The hook is not called\n" +"c.__set_name__(A, 'x') # Manually invoke the hook" + +#: reference/datamodel.rst:2726 msgid "See :ref:`class-object-creation` for more details." -msgstr "" +msgstr "Δείτε το :ref:`class-object-creation` για περισσότερες λεπτομέρειες." -#: reference/datamodel.rst:2373 +#: reference/datamodel.rst:2734 msgid "Metaclasses" -msgstr "" +msgstr "Μετα-κλάσεις" -#: reference/datamodel.rst:2380 +#: reference/datamodel.rst:2741 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" +"Από προεπιλογή, οι κλάσεις κατασκευάζονται χρησιμοποιώντας :func:`type`. Το " +"σώμα κλάσης εκτελείται σε νέο χώρο ονομάτων και το όνομα της κλάσης " +"συνδέεται τοπικά με το αποτέλεσμα του ``type(name, bases, namespace)``." -#: reference/datamodel.rst:2384 +#: reference/datamodel.rst:2745 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " "existing class that included such an argument. In the following example, " "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" - -#: reference/datamodel.rst:2398 +"Η διαδικασία δημιουργία κλάσης μπορεί να προσαρμοστεί μεταβιβάζοντας το " +"όρισμα λέξης-κλειδιού ``metaclass`` στη γραμμή ορισμού κλάσης ή " +"κληρονομώντας από μια υπάρχουσα κλάση που περιλάμβανε ένα τέτοιο όρισμα. Στο " +"παρακάτω παράδειγμα, τόσο το ``MyClass`` και ``MySubclass`` είναι " +"περιπτώσεις του ``Meta``::" + +#: reference/datamodel.rst:2750 +msgid "" +"class Meta(type):\n" +" pass\n" +"\n" +"class MyClass(metaclass=Meta):\n" +" pass\n" +"\n" +"class MySubclass(MyClass):\n" +" pass" +msgstr "" +"class Meta(type):\n" +" pass\n" +"\n" +"class MyClass(metaclass=Meta):\n" +" pass\n" +"\n" +"class MySubclass(MyClass):\n" +" pass" + +#: reference/datamodel.rst:2759 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" +"Οποιαδήποτε άλλα ορίσματα λέξης-κλειδιού που καθορίζονται στον ορισμό κλάσης " +"μεταβιβάζονται σε όλες τις λειτουργίες μετακλάσης που περιγράφονται παρακάτω." -#: reference/datamodel.rst:2401 +#: reference/datamodel.rst:2762 msgid "When a class definition is executed, the following steps occur:" -msgstr "" +msgstr "Όταν εκτελείται ένας ορισμός κλάσης, εμφανίζονται τα ακόλουθα βήματα:" -#: reference/datamodel.rst:2403 +#: reference/datamodel.rst:2764 msgid "MRO entries are resolved;" -msgstr "" +msgstr "Οι εγγραφές MRO επιλύονται∙" -#: reference/datamodel.rst:2404 +#: reference/datamodel.rst:2765 msgid "the appropriate metaclass is determined;" -msgstr "" +msgstr "καθορίζεται η κατάλληλη μετακλάση∙" -#: reference/datamodel.rst:2405 +#: reference/datamodel.rst:2766 msgid "the class namespace is prepared;" -msgstr "" +msgstr "προετοιμάζεται ο χώρος ονομάτων της κλάσης∙" -#: reference/datamodel.rst:2406 +#: reference/datamodel.rst:2767 msgid "the class body is executed;" -msgstr "" +msgstr "εκτελείται το σώμα της κλάσης∙" -#: reference/datamodel.rst:2407 +#: reference/datamodel.rst:2768 msgid "the class object is created." -msgstr "" +msgstr "δημιουργείται το αντικείμενο της κλάσης." -#: reference/datamodel.rst:2411 +#: reference/datamodel.rst:2772 msgid "Resolving MRO entries" -msgstr "" +msgstr "Επίλυση εγγραφών MRO" -#: reference/datamodel.rst:2415 +#: reference/datamodel.rst:2776 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -2736,60 +4655,77 @@ msgid "" "the base. The returned tuple may be empty: in these cases, the original base " "is ignored." msgstr "" - -#: reference/datamodel.rst:2427 +"Εάν μια βάση που εμφανίζεται σε ένα ορισμό κλάσης δεν είναι ένα στιγμιότυπο " +"της :class:`type`, τότε γίνεται αναζήτηση στη βάση μιας :meth:`!" +"__mro_entries__` μεθόδου. Εάν βρεθεί μια μέθοδος :meth:`!__mro_entries__`, η " +"βάση αντικαθίσταται με το αποτέλεσμα μιας κλήσης στο :meth:`!" +"__mro_entries__` κατά τη δημιουργία της κλάσης. Η μέθοδος καλείται με την " +"αρχική πλειάδα βάσεων μεταβιβασμένη στην παράμετρο *bases* και πρέπει να " +"επιστρέψει μια πλειάδα κλάσεων που θα χρησιμοποιηθούν αντί για τη βάση. Η " +"πλειάδα που επιστράφηκε μπορεί να είναι κενή: σε αυτές τις περιπτώσεις, η " +"αρχική βάση αγνοείται." + +#: reference/datamodel.rst:2787 msgid ":func:`types.resolve_bases`" -msgstr "" +msgstr ":func:`types.resolve_bases`" -#: reference/datamodel.rst:2427 +#: reference/datamodel.rst:2788 msgid "Dynamically resolve bases that are not instances of :class:`type`." -msgstr "" +msgstr "Επιλύστε δυναμικά βάσεις που δεν είναι στιγμιότυπα του :class:`type`." -#: reference/datamodel.rst:2431 +#: reference/datamodel.rst:2790 msgid ":func:`types.get_original_bases`" -msgstr "" +msgstr ":func:`types.get_original_bases`" -#: reference/datamodel.rst:2430 +#: reference/datamodel.rst:2791 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" +"Ανακτήσετε τις \"αρχικές βάσεις\" μιας κλάσης πριν από τις τροποποιήσεις " +"από :meth:`~object.__mro_entries__`." -#: reference/datamodel.rst:2433 +#: reference/datamodel.rst:2794 msgid ":pep:`560`" -msgstr "" +msgstr ":pep:`560`" -#: reference/datamodel.rst:2434 +#: reference/datamodel.rst:2795 msgid "Core support for typing module and generic types." -msgstr "" +msgstr "Βασική υποστήριξη για modules τύπων και γενικούς τύπους." -#: reference/datamodel.rst:2438 +#: reference/datamodel.rst:2799 msgid "Determining the appropriate metaclass" -msgstr "" +msgstr "Προσδιορισμός της κατάλληλης μετακλάσης" -#: reference/datamodel.rst:2442 +#: reference/datamodel.rst:2803 msgid "" "The appropriate metaclass for a class definition is determined as follows:" -msgstr "" +msgstr "Η κατάλληλη μετακλάση για έναν ορισμό κλάσης καθορίζεται ως εξής:" -#: reference/datamodel.rst:2444 +#: reference/datamodel.rst:2805 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" +"εάν δεν δίνονται βάσεις και καμία ρητή μετακλάση, τότε χρησιμοποιείται η :" +"func:`type` ∙" -#: reference/datamodel.rst:2445 +#: reference/datamodel.rst:2806 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" +"εάν δοθεί μια ρητή μετακλάση και *δεν* είναι ένα στιγμιότυπο της :func:" +"`type`, τότε χρησιμοποιείται απευθείας ως μετακλάση∙" -#: reference/datamodel.rst:2447 +#: reference/datamodel.rst:2808 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" +"εάν ένα στιγμιότυπο της :func:`type` δίνεται ως ρητή μετακλάση ή ορίζονται " +"βάσεις, τότε χρησιμοποιείται η πιο παραγόμενη μετακλάση." -#: reference/datamodel.rst:2450 +#: reference/datamodel.rst:2811 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -2797,12 +4733,18 @@ msgid "" "of these candidate metaclasses. If none of the candidate metaclasses meets " "that criterion, then the class definition will fail with ``TypeError``." msgstr "" +"Η πιο παραγόμενη μετακλάση επιλέγεται από τη ρητά καθορισμένη μετακλάση (εάν " +"υπάρχει) και τις μετακλάσεις (δηλαδή ``type(cls)``) όλων των καθορισμένων " +"βασικών κλάσεων. Η πιο παραγόμενη μετακλάση είναι αυτή που είναι υπο-τύπος " +"*όλων* αυτών των υποψήφιων μετακλάσεων. Εάν καμία από τις υποψήφιες " +"μετακλάσεις δεν πληροί αυτό το κριτήριο, τότε ο ορισμός της κλάσης θα " +"αποτύχει με ``TypeError``." -#: reference/datamodel.rst:2460 +#: reference/datamodel.rst:2821 msgid "Preparing the class namespace" -msgstr "" +msgstr "Προετοιμασία του χώρου ονομάτων της κλάσης" -#: reference/datamodel.rst:2465 +#: reference/datamodel.rst:2826 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -2813,26 +4755,37 @@ msgid "" "``__new__``, but when the final class object is created the namespace is " "copied into a new ``dict``." msgstr "" +"Μόλις εντοπιστεί η κατάλληλη μετακλάση, τότε προετοιμάζεται ο χώρος ονομάτων " +"της κλάσης. Εάν η μετακλάση έχει ένα χαρακτηριστικό ``__prepare__``, " +"ονομάζεται ``namespace = metaclass.__prepare__(name, bases, **kwds)`` (όπου " +"τα πρόσθετα ορίσματα λέξης-κλειδιού, εάν υπάρχουν, προέρχονται από τον " +"ορισμό της κλάσης). Η μέθοδος ``__prepare__`` θα πρέπει να υλοποιηθεί ως " +"μέθοδος :func:`classmethod `. Ο χώρος ονομάτων που επιστρέφεται " +"από το ``__prepare__`` μεταβιβάζεται στο ``__new__``, αλλά όταν " +"δημιουργείται το τελικό αντικείμενο κλάσης, ο χώρος ονομάτων αντιγράφεται σε " +"ένα νέο ``dict``." -#: reference/datamodel.rst:2474 +#: reference/datamodel.rst:2835 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" +"Εάν η μετακλάση δεν έχει χαρακτηριστικό ``__prepare__``, τότε ο χώρος " +"ονομάτων κλάσης αρχικοποιείται ως κενή ταξινομημένη αντιστοίχιση." -#: reference/datamodel.rst:2479 +#: reference/datamodel.rst:2840 msgid ":pep:`3115` - Metaclasses in Python 3000" -msgstr "" +msgstr ":pep:`3115` - Μετακλάσεις στην Python 3000" -#: reference/datamodel.rst:2480 +#: reference/datamodel.rst:2841 msgid "Introduced the ``__prepare__`` namespace hook" -msgstr "" +msgstr "Παρουσιάστηκε το άγκιστρο χώρου ονομάτων ``__prepare__``" -#: reference/datamodel.rst:2484 +#: reference/datamodel.rst:2845 msgid "Executing the class body" -msgstr "" +msgstr "Εκτέλεση του σώματος της κλάσης" -#: reference/datamodel.rst:2489 +#: reference/datamodel.rst:2850 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -2840,8 +4793,14 @@ msgid "" "names from the current and outer scopes when the class definition occurs " "inside a function." msgstr "" +"Το σώμα της κλάσης εκτελείται (περίπου) ως ``exec(body, globals(), " +"namespace)``. Η βασική διαφορά από μια κανονική κλήση στην :func:`exec` " +"είναι ότι το λεξικό πεδίο εφαρμογής επιτρέπει στο σώμα της κλάσης " +"(συμπεριλαμβανομένων οποιωνδήποτε μεθόδων) να παραπέμπει σε ονόματα από το " +"τρέχον και το εξωτερικό πεδίο εφαρμογής όταν ο ορισμός κλάσης εμφανίζεται " +"μέσα σε μια συνάρτηση." -#: reference/datamodel.rst:2495 +#: reference/datamodel.rst:2856 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -2849,20 +4808,30 @@ msgid "" "class methods, or through the implicit lexically scoped ``__class__`` " "reference described in the next section." msgstr "" +"Ωστόσο, ακόμα και όταν ο ορισμός της κλάσης εμφανίζεται μέσα στη συνάρτηση, " +"οι μέθοδοι που ορίζονται μέσα στην κλάση εξακολουθούν να μην μπορούν να δουν " +"ονόματα που ορίζονται στο πεδίο της κλάσης. Οι μεταβλητές κλάσης πρέπει να " +"είναι προσβάσιμες μέσω της πρώτης παραμέτρου των μεθόδων στιγμιοτύπου ή " +"κλάσης ή μέσω της σιωπηρής αναφοράς ``__class__`` με λεξικό που περιγράφεται " +"στην επόμενη ενότητα." -#: reference/datamodel.rst:2504 +#: reference/datamodel.rst:2865 msgid "Creating the class object" -msgstr "" +msgstr "Δημιουργία αντικειμένου κλάσης" -#: reference/datamodel.rst:2511 +#: reference/datamodel.rst:2872 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " "**kwds)`` (the additional keywords passed here are the same as those passed " "to ``__prepare__``)." msgstr "" +"Μόλις ο χώρος ονομάτων της κλάσης έχει συμπληρωθεί εκτελώντας το σώμα της " +"κλάσης, το αντικείμενο της κλάσης δημιουργείται καλώντας ``metaclass(name, " +"bases, namespace, **kwds)`` (οι πρόσθετε λέξεις-κλειδιά που μεταβιβάζονται " +"εδώ είναι οι ίδιες με αυτές που διαβιβάζονται στο ``__prepare__``)." -#: reference/datamodel.rst:2516 +#: reference/datamodel.rst:2877 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -2872,8 +4841,17 @@ msgid "" "scoping, while the class or instance that was used to make the current call " "is identified based on the first argument passed to the method." msgstr "" +"Αυτό το αντικείμενο κλάσης είναι αυτό που θα αναφέρεται με τη μορφή " +"μηδενικού ορίσματος του :func:`super`. Το ``__class__`` είναι μια σιωπηρή " +"αναφορά κλεισίματος που δημιουργείται από τον μεταγλωττιστή εάν οποιεσδήποτε " +"μέθοδοι σε ένα σώμα κλάσης αναφέρονται είτε σε ``__class__`` είτε σε " +"``super``. Αυτό επιτρέπει στη μορφή μηδενικού ορίσματος του :func:`super` να " +"προσδιορίζει σωστά την κλάση που ορίζεται με βάση το λεξικό πεδίο εφαρμογής, " +"ενώ η κλάση ή το παράδειγμα που χρησιμοποιήθηκε για την πραγματοποίηση της " +"τρέχουσας κλήσης προσδιορίζεται με βάση το πρώτο όρισμα που μεταβιβάστηκε " +"στη μέθοδο." -#: reference/datamodel.rst:2526 +#: reference/datamodel.rst:2887 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -2881,191 +4859,266 @@ msgid "" "initialised correctly. Failing to do so will result in a :exc:`RuntimeError` " "in Python 3.8." msgstr "" +"Στη CPython 3.6 και μεταγενέστερα, το κελί ``__class__`` μεταβιβάζεται στην " +"μετακλάση ως μια καταχώρηση ``__classcell__`` στον χώρο ονομάτων της κλάσης. " +"Εάν υπάρχει, αυτό πρέπει να διαδοθεί μέχρι την κλήση ``type.__new__``, " +"προκειμένου η κλάση να έχει ως αποτέλεσμα να αρχικοποιηθεί σωστά ώστε να " +"γίνει σωστά. Αν δεν το κάνετε αυτό θα έχει ως αποτέλεσμα μια :exc:" +"`RuntimeError` στην Python 3.8." -#: reference/datamodel.rst:2532 +#: reference/datamodel.rst:2893 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" +"Κατά τη χρήση της προεπιλεγμένης μετακλάσης :class:`type` ή οποιασδήποτε " +"μετακλάσης που τελικά καλεί ``type.__new__``, τα ακόλουθα πρόσθετα βήματα " +"προσαρμογής καλούνται μετά τη δημιουργία του αντικείμενου κλάσης:" -#: reference/datamodel.rst:2536 +#: reference/datamodel.rst:2897 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" +"Η μέθοδος ``type.__new__`` συλλέγει όλα τα χαρακτηριστικά στον χώρο ονομάτων " +"της κλάσης που ορίζουν μια μέθοδο :meth:`~object.__set_name__` ∙" -#: reference/datamodel.rst:2538 +#: reference/datamodel.rst:2899 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" +"Αυτές οι μέθοδοι ``__set_name__`` καλούνται με την κλάση που ορίζεται και το " +"εκχωρημένο όνομα του συγκεκριμένου χαρακτηριστικού∙" -#: reference/datamodel.rst:2540 +#: reference/datamodel.rst:2901 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" +"Το άγκιστρο :meth:`~object.__init_subclass__` καλείται στον άμεσο γονέα της " +"νέας κλάσης στη σειρά ανάλυσης της μεθόδου." -#: reference/datamodel.rst:2543 +#: reference/datamodel.rst:2904 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" +"Αφού δημιουργηθεί το αντικείμενο κλάσης, μεταβιβάζεται στους decorators " +"κλάσης που περιλαμβάνονται στον ορισμό της κλάσης (εάν υπάρχει) και το " +"αντικείμενο που προκύπτει δεσμεύεται στον τοπικό χώρο ονομάτων ως η " +"καθορισμένη κλάση." -#: reference/datamodel.rst:2547 +#: reference/datamodel.rst:2908 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " "object is discarded. The new copy is wrapped in a read-only proxy, which " -"becomes the :attr:`~object.__dict__` attribute of the class object." +"becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" +"Όταν δημιουργείται μια νέα κλάση από ``type.__new__``, το αντικείμενο που " +"παρέχεται ως παράμετρος στο χώρο ονομάτων αντιγράφεται σε μια νέα " +"ταξινομημένη αντιστοίχιση και το αρχικό αντικείμενο απορρίπτεται. Το νέο " +"αντίγραφο τυλίγεται σε έναν διακομιστή μεσολάβησης μόνο για ανάγνωση, ο " +"οποίος γίνεται το χαρακτηριστικό :attr:`~type.__dict__` του αντικειμένου " +"κλάσης." -#: reference/datamodel.rst:2554 +#: reference/datamodel.rst:2915 msgid ":pep:`3135` - New super" -msgstr "" +msgstr ":pep:`3135` - Νέο super" -#: reference/datamodel.rst:2555 +#: reference/datamodel.rst:2916 msgid "Describes the implicit ``__class__`` closure reference" -msgstr "" +msgstr "Περιγράφει την σιωπηρή αναφορά κλεισίματος ``__class__``" -#: reference/datamodel.rst:2559 +#: reference/datamodel.rst:2920 msgid "Uses for metaclasses" -msgstr "" +msgstr "Χρήσεις για μετακλάσεις" -#: reference/datamodel.rst:2561 +#: reference/datamodel.rst:2922 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " "automatic property creation, proxies, frameworks, and automatic resource " "locking/synchronization." msgstr "" +"Οι πιθανές χρήσεις για μετακλάσεις είναι απεριόριστες. Ορισμένες ιδέες που " +"έχουν διερευνηθεί περιλαμβάνουν το enum, την καταγραφή, τον έλεγχο διεπαφής, " +"την αυτόματα ανάθεση την αυτόματη δημιουργία ιδιοτήτων, τους διακομιστές " +"μεσολάβησης, τα πλαίσια και το αυτόματο κλείδωμα/συγχρονισμό πόρων." -#: reference/datamodel.rst:2568 +#: reference/datamodel.rst:2929 msgid "Customizing instance and subclass checks" -msgstr "" +msgstr "Προσαρμογή ελέγχων παρουσίας και υποκλάσης" -#: reference/datamodel.rst:2570 +#: reference/datamodel.rst:2931 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" +"Οι ακόλουθες μέθοδοι χρησιμοποιούνται για την παράκαμψη της προεπιλεγμένης " +"συμπεριφοράς των ενσωματωμένων συναρτήσεων :func:`isinstance` και :func:" +"`issubclass`." -#: reference/datamodel.rst:2573 +#: reference/datamodel.rst:2934 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " "base classes\" to any class or type (including built-in types), including " "other ABCs." msgstr "" +"Συγκεκριμένα, η μετακλάση :class:`abc.ABCMeta` υλοποιεί αυτές τις μεθόδους " +"προκειμένου να επιτρέψει την προσθήκη Αφηρημένων Βασικών Κλάσεων (ABCs) ως " +"\"εικονικές βασικές κλάσεις\" σε οποιαδήποτε κλάση ή τύπο " +"(συμπεριλαμβανομένων των ενσωματωμένων τύπων), συμπεριλαμβανομένων άλλων " +"ABCs." -#: reference/datamodel.rst:2580 +#: reference/datamodel.rst:2941 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" +"Επιστρέφετε true εάν το *instance* θα πρέπει να θεωρείται ένα (άμεσο ή " +"έμμεσο) στιγμιότυπο της *class*. Εάν ορίζεται, καλείται να υλοποιήσει " +"``isinstance(instance, class)``." -#: reference/datamodel.rst:2587 +#: reference/datamodel.rst:2948 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" +"Επιστρέφετε true εάν η *subclass* πρέπει να θεωρείται μια (άμεση ή έμμεση) " +"υποκλάση της *class*. Εάν ορίζεται, καλείται να υλοποιήσει " +"``issubclass(subclass, class)``." -#: reference/datamodel.rst:2592 +#: reference/datamodel.rst:2953 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " "consistent with the lookup of special methods that are called on instances, " "only in this case the instance is itself a class." msgstr "" +"Λάβετε υπόψη ότι αυτές οι μέθοδοι αναζητούνται στον τύπο (μετακλάση) μιας " +"κλάσης. Δεν μπορούν να οριστούν ως μέθοδοι κλάσης στην πραγματική κλάση. " +"Αυτό είναι σύμφωνο με την αναζήτηση ειδικών μεθόδων που καλούνται σε " +"στιγμιότυπα, μόνο σε αυτήν την περίπτωση το ίδιο στιγμιότυπο είναι μια κλάση." -#: reference/datamodel.rst:2603 +#: reference/datamodel.rst:2960 msgid ":pep:`3119` - Introducing Abstract Base Classes" -msgstr "" +msgstr ":pep:`3119` - Εισάγοντας τις Αφηρημένες Βασικές Κλάσεις" -#: reference/datamodel.rst:2600 +#: reference/datamodel.rst:2961 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" -"`issubclass` behavior through :meth:`~class.__instancecheck__` and :meth:" -"`~class.__subclasscheck__`, with motivation for this functionality in the " +"`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" +"`~type.__subclasscheck__`, with motivation for this functionality in the " "context of adding Abstract Base Classes (see the :mod:`abc` module) to the " "language." msgstr "" +"Περιλαμβάνει την προδιαγραφή για την προσαρμογή της συμπεριφορά της :func:" +"`isinstance` και της :func:`issubclass` μέσω των :meth:`~type." +"__instancecheck__` και :meth:`~type.__subclasscheck__`, με κίνητρο για αυτήν " +"τη λειτουργικότητα στο πλαίσιο της προσθήκης Αφηρημένης Βασικής Κλάσης " +"(δείτε το module :mod:`abc`) στη γλώσσα." -#: reference/datamodel.rst:2608 +#: reference/datamodel.rst:2969 msgid "Emulating generic types" -msgstr "" +msgstr "Εξομοίωση γενικών τύπων" -#: reference/datamodel.rst:2610 +#: reference/datamodel.rst:2971 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " "notation. For example, the annotation ``list[int]`` might be used to signify " "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" +"Όταν χρησιμοποιείτε το :term:`type annotations`, είναι συχνά " +"χρήσιμο να *παραμετροποιήσετε* έναν :term:`generic type` χρησιμοποιώντας τον " +"συμβολισμό σε αγκύλες της Python. Για παράδειγμα, το annotation " +"``list[int]`` μπορεί να χρησιμοποιηθεί για να υποδηλώσει μια :class:`list` " +"στην οποία όλα τα στοιχεία της κλάσης είναι τύπου :class:`int`." -#: reference/datamodel.rst:2618 +#: reference/datamodel.rst:2978 msgid ":pep:`484` - Type Hints" -msgstr "" +msgstr ":pep:`484` - Τύπος Hints" -#: reference/datamodel.rst:2618 +#: reference/datamodel.rst:2979 msgid "Introducing Python's framework for type annotations" -msgstr "" +msgstr "Εισάγοντας το πλαίσιο της Python για τύπους annotations" -#: reference/datamodel.rst:2621 +#: reference/datamodel.rst:2981 msgid ":ref:`Generic Alias Types`" -msgstr "" +msgstr ":ref:`Generic Alias Types`" -#: reference/datamodel.rst:2621 +#: reference/datamodel.rst:2982 msgid "Documentation for objects representing parameterized generic classes" msgstr "" +"Τεκμηρίωση για αντικείμενα που αντιπροσωπεύουν παραμετροποιημένες γενικές " +"κλάσεις" -#: reference/datamodel.rst:2624 +#: reference/datamodel.rst:2984 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" +":ref:`Generics`, :ref:`user-defined generics` και :" +"class:`typing.Generic`" -#: reference/datamodel.rst:2624 +#: reference/datamodel.rst:2985 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" +"Τεκμηρίωση για τον τρόπο υλοποίησης γενικών κλάσεων που μπορούν να " +"παραμετροποιηθούν κατά το χρόνο εκτέλεσης και να κατανοηθούν από στατικούς " +"ελεγκτές τύπων." -#: reference/datamodel.rst:2627 +#: reference/datamodel.rst:2988 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" +"Μια κλάση *γενικά* μπορεί να παραμετροποιηθεί μόνο εάν ορίζει την ειδική " +"μέθοδο κλάσης ``__class_getitem__()``." -#: reference/datamodel.rst:2632 +#: reference/datamodel.rst:2993 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" +"Επιστρέφετε ένα αντικείμενο που αντιπροσωπεύει την εξειδίκευση μιας γενικής " +"κλάσης κατά ορίσματα τύπου που βρίσκονται στο *key*." -#: reference/datamodel.rst:2635 +#: reference/datamodel.rst:2996 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " -"method. As such, there is no need for it to be decorated with :func:" -"`@classmethod` when it is defined." +"method. As such, there is no need for it to be decorated with :deco:" +"`classmethod` when it is defined." msgstr "" +"Όταν ορίζεται σε μια κλάση, το ``__class_getitem__()`` είναι αυτόματα " +"μέθοδος κλάσης. Ως εκ τούτου, δεν χρειάζεται να γίνει decorated με :deco:" +"`classmethod` όταν ορίζεται." -#: reference/datamodel.rst:2641 +#: reference/datamodel.rst:3002 msgid "The purpose of *__class_getitem__*" -msgstr "" +msgstr "Ο σκοπός του *__class_getitem__*" -#: reference/datamodel.rst:2643 +#: reference/datamodel.rst:3004 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" +"Ο σκοπός της :meth:`~object.__class_getitem__` είναι να επιτρέψει την " +"παραμετροποίηση χρόνου εκτέλεσης των γενικών κλάσεων τυπικής βιβλιοθήκης " +"προκειμένου να εφαρμοστούν πιο εύκολα :term:`type hints` σε αυτές " +"τις κλάσεις." -#: reference/datamodel.rst:2647 +#: reference/datamodel.rst:3008 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3073,20 +5126,31 @@ msgid "" "__class_getitem__`, or inherit from :class:`typing.Generic`, which has its " "own implementation of ``__class_getitem__()``." msgstr "" +"Για να εφαρμόσουν προσαρμοσμένες γενικές κλάσεις που μπορούν να " +"παραμετροποιηθούν κατά το χρόνο εκτέλεσης και να κατανοηθούν από στατικούς " +"ελεγκτές τύπων, οι χρήστες θα πρέπει είτε να κληρονομήσουν από μια τυπική " +"κλάση βιβλιοθήκης που ήδη υλοποιεί τη :meth:`~object.__class_getitem__`, " +"είτε να κληρονομήσουν από την :class:`typing.Generic`, η οποία έχει τη δική " +"της υλοποίηση του ``__class_getitem__()``." -#: reference/datamodel.rst:2653 +#: reference/datamodel.rst:3014 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " "type-checkers such as mypy. Using ``__class_getitem__()`` on any class for " "purposes other than type hinting is discouraged." msgstr "" +"Προσαρμοσμένες υλοποιήσεις της :meth:`~object.__class_getitem__` σε κλάσεις " +"που ορίζονται εκτός της τυπικής βιβλιοθήκης ενδέχεται να μην είναι " +"κατανοητές από ελεγκτές τύπων τρίτου μέρους, όπως το mypy. Η χρήση " +"``__class_getitem__()`` σε οποιαδήποτε κλάση για άλλους σκοπούς εκτός από " +"την υπόδειξη τύπων δεν ενθαρρύνεται." -#: reference/datamodel.rst:2663 +#: reference/datamodel.rst:3024 msgid "*__class_getitem__* versus *__getitem__*" -msgstr "" +msgstr "*__class_getitem__* έναντι *__getitem__*" -#: reference/datamodel.rst:2665 +#: reference/datamodel.rst:3026 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3095,15 +5159,73 @@ msgid "" "instead. ``__class_getitem__()`` should return a :ref:`GenericAlias` object if it is properly defined." msgstr "" +"Συνήθως, η :ref:`subscription` ενός αντικειμένου που " +"χρησιμοποιεί αγκύλες θα καλεί τη μέθοδο του στιγμιοτύπου :meth:`~object." +"__getitem__` που ορίζεται στην κλάση του αντικειμένου. Ωστόσο, εάν το " +"αντικείμενο που εγγράφεται είναι το ίδιο μια κλάση, η μέθοδος της κλάσης :" +"meth:`~object.__class_getitem__` μπορεί να κληθεί αντί να γίνει. Το " +"``__class_getitem__()`` θα πρέπει να επιστρέψει ένα αντικείμενο :ref:" +"`GenericAlias`, εάν έχει οριστεί σωστά." -#: reference/datamodel.rst:2672 +#: reference/datamodel.rst:3033 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" - -#: reference/datamodel.rst:2700 +"Παρουσιάζεται με το :term:`expression` ``obj[x]``, ο διερμηνέας Python " +"ακολουθεί κάτι σαν την ακόλουθη διαδικασία για να αποφασίσει εάν θα πρέπει " +"να κληθεί :meth:`~object.__getitem__` ή :meth:`~object.__class_getitem__`::" + +#: reference/datamodel.rst:3038 +msgid "" +"from inspect import isclass\n" +"\n" +"def subscribe(obj, x):\n" +" \"\"\"Return the result of the expression 'obj[x]'\"\"\"\n" +"\n" +" class_of_obj = type(obj)\n" +"\n" +" # If the class of obj defines __getitem__,\n" +" # call class_of_obj.__getitem__(obj, x)\n" +" if hasattr(class_of_obj, '__getitem__'):\n" +" return class_of_obj.__getitem__(obj, x)\n" +"\n" +" # Else, if obj is a class and defines __class_getitem__,\n" +" # call obj.__class_getitem__(x)\n" +" elif isclass(obj) and hasattr(obj, '__class_getitem__'):\n" +" return obj.__class_getitem__(x)\n" +"\n" +" # Else, raise an exception\n" +" else:\n" +" raise TypeError(\n" +" f\"'{class_of_obj.__name__}' object is not subscriptable\"\n" +" )" +msgstr "" +"from inspect import isclass\n" +"\n" +"def subscribe(obj, x):\n" +" \"\"\"Return the result of the expression 'obj[x]'\"\"\"\n" +"\n" +" class_of_obj = type(obj)\n" +"\n" +" # If the class of obj defines __getitem__,\n" +" # call class_of_obj.__getitem__(obj, x)\n" +" if hasattr(class_of_obj, '__getitem__'):\n" +" return class_of_obj.__getitem__(obj, x)\n" +"\n" +" # Else, if obj is a class and defines __class_getitem__,\n" +" # call obj.__class_getitem__(x)\n" +" elif isclass(obj) and hasattr(obj, '__class_getitem__'):\n" +" return obj.__class_getitem__(x)\n" +"\n" +" # Else, raise an exception\n" +" else:\n" +" raise TypeError(\n" +" f\"'{class_of_obj.__name__}' object is not subscriptable\"\n" +" )" + +#: reference/datamodel.rst:3061 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3112,85 +5234,220 @@ msgid "" "``dict[str, float]`` and ``tuple[str, bytes]`` all result in :meth:`~object." "__class_getitem__` being called::" msgstr "" - -#: reference/datamodel.rst:2719 +"Στην Python, όλες οι κλάσεις είναι οι ίδιες παρουσίες άλλων κλάσεων. Η κλάση " +"μιας κλάσης είναι γνωστή ως :term:`metaclass` αυτής της κλάσης, και οι " +"περισσότερες κλάσεις έχουν ως μετακλάση την κλάση :class:`type`. Η :class:" +"`type` δεν ορίζει το :meth:`~object.__getitem__`, πράγμα που σημαίνει ότι " +"εκφράσεις όπως ``list[int]``, ``dict[str, float]`` και ``tuple[str, bytes]`` " +"έχουν ως αποτέλεσμα την κλήση της :meth:`~object.__class_getitem__`::" + +#: reference/datamodel.rst:3068 +msgid "" +">>> # list has class \"type\" as its metaclass, like most classes:\n" +">>> type(list)\n" +"\n" +">>> type(dict) == type(list) == type(tuple) == type(str) == type(bytes)\n" +"True\n" +">>> # \"list[int]\" calls \"list.__class_getitem__(int)\"\n" +">>> list[int]\n" +"list[int]\n" +">>> # list.__class_getitem__ returns a GenericAlias object:\n" +">>> type(list[int])\n" +"" +msgstr "" +">>> # list has class \"type\" as its metaclass, like most classes:\n" +">>> type(list)\n" +"\n" +">>> type(dict) == type(list) == type(tuple) == type(str) == type(bytes)\n" +"True\n" +">>> # \"list[int]\" calls \"list.__class_getitem__(int)\"\n" +">>> list[int]\n" +"list[int]\n" +">>> # list.__class_getitem__ returns a GenericAlias object:\n" +">>> type(list[int])\n" +"" + +#: reference/datamodel.rst:3080 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" - -#: reference/datamodel.rst:2744 +"Ωστόσο, εάν μια κλάση έχει μια προσαρμοσμένη μετακλάση που ορίζει :meth:" +"`~object.__getitem__`, η εγγραφή στην κλάση μπορεί να οδηγήσει σε " +"διαφορετική συμπεριφορά. Ένα παράδειγμα αυτού μπορεί να βρεθεί στο module :" +"mod:`enum`::" + +#: reference/datamodel.rst:3084 +msgid "" +">>> from enum import Enum\n" +">>> class Menu(Enum):\n" +"... \"\"\"A breakfast menu\"\"\"\n" +"... SPAM = 'spam'\n" +"... BACON = 'bacon'\n" +"...\n" +">>> # Enum classes have a custom metaclass:\n" +">>> type(Menu)\n" +"\n" +">>> # EnumMeta defines __getitem__,\n" +">>> # so __class_getitem__ is not called,\n" +">>> # and the result is not a GenericAlias object:\n" +">>> Menu['SPAM']\n" +"\n" +">>> type(Menu['SPAM'])\n" +"" +msgstr "" +">>> from enum import Enum\n" +">>> class Menu(Enum):\n" +"... \"\"\"A breakfast menu\"\"\"\n" +"... SPAM = 'spam'\n" +"... BACON = 'bacon'\n" +"...\n" +">>> # Enum classes have a custom metaclass:\n" +">>> type(Menu)\n" +"\n" +">>> # EnumMeta defines __getitem__,\n" +">>> # so __class_getitem__ is not called,\n" +">>> # and the result is not a GenericAlias object:\n" +">>> Menu['SPAM']\n" +"\n" +">>> type(Menu['SPAM'])\n" +"" + +#: reference/datamodel.rst:3103 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" +":pep:`560` - Βασική υποστήριξη για module πληκτρολόγησης και γενικούς τύπους" -#: reference/datamodel.rst:2743 +#: reference/datamodel.rst:3104 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" +"Παρουσίαση της :meth:`~object.__class_getitem__`, και περιγραφή του πότε " +"ένα :ref:`subscription` έχει ως αποτέλεσμα την κλήση " +"``__class_getitem__()`` αντί για :meth:`~object.__getitem__`" -#: reference/datamodel.rst:2751 +#: reference/datamodel.rst:3112 msgid "Emulating callable objects" -msgstr "" +msgstr "Εξομοίωση αντικειμένων με δυνατότητα κλήσης" -#: reference/datamodel.rst:2758 +#: reference/datamodel.rst:3119 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " -"arg1, ...)``." +"arg1, ...)``. The :class:`object` class itself does not provide this method." msgstr "" +"Καλείται όταν το στιγμιότυπο \"καλείται\" ως συνάρτηση∙ εάν αυτή η μέθοδος " +"οριστεί, το ``x(arg1, arg2, ...)`` μεταφράζεται χονδρικά σε ``type(x)." +"__call__(x, arg1, ...)``. Η ίδια η κλάση :class:`object` δεν παρέχει αυτήν " +"τη μέθοδο." -#: reference/datamodel.rst:2765 +#: reference/datamodel.rst:3127 msgid "Emulating container types" -msgstr "" +msgstr "Εξομοίωση τύπων κοντέινερ" -#: reference/datamodel.rst:2767 +#: reference/datamodel.rst:3129 msgid "" -"The following methods can be defined to implement container objects. " -"Containers usually are :term:`sequences ` (such as :class:`lists " -"` or :class:`tuples `) or :term:`mappings ` (like :" -"class:`dictionaries `), but can represent other containers as well. " -"The first set of methods is used either to emulate a sequence or to emulate " -"a mapping; the difference is that for a sequence, the allowable keys should " -"be the integers *k* for which ``0 <= k < N`` where *N* is the length of the " -"sequence, or :class:`slice` objects, which define a range of items. It is " -"also recommended that mappings provide the methods :meth:`!keys`, :meth:`!" +"The following methods can be defined to implement container objects. None of " +"them are provided by the :class:`object` class itself. Containers usually " +"are :term:`sequences ` (such as :class:`lists ` or :class:" +"`tuples `) or :term:`mappings ` (like :term:`dictionaries " +"`), but can represent other containers as well. The first set " +"of methods is used either to emulate a sequence or to emulate a mapping; the " +"difference is that for a sequence, the allowable keys should be the integers " +"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or :" +"class:`slice` objects, which define a range of items. It is also " +"recommended that mappings provide the methods :meth:`!keys`, :meth:`!" "values`, :meth:`!items`, :meth:`!get`, :meth:`!clear`, :meth:`!setdefault`, :" "meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, and :meth:`!update` behaving " "similar to those for Python's standard :class:`dictionary ` objects. " "The :mod:`collections.abc` module provides a :class:`~collections.abc." "MutableMapping` :term:`abstract base class` to help create those methods " "from a base set of :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. Mutable " -"sequences should provide methods :meth:`!append`, :meth:`!count`, :meth:`!" -"index`, :meth:`!extend`, :meth:`!insert`, :meth:`!pop`, :meth:`!remove`, :" -"meth:`!reverse` and :meth:`!sort`, like Python standard :class:`list` " -"objects. Finally, sequence types should implement addition (meaning " -"concatenation) and multiplication (meaning repetition) by defining the " -"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object." -"__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` and :meth:" -"`~object.__imul__` described below; they should not define other numerical " -"operators. It is recommended that both mappings and sequences implement " -"the :meth:`~object.__contains__` method to allow efficient use of the ``in`` " -"operator; for mappings, ``in`` should search the mapping's keys; for " -"sequences, it should search through the values. It is further recommended " -"that both mappings and sequences implement the :meth:`~object.__iter__` " -"method to allow efficient iteration through the container; for mappings, :" -"meth:`!__iter__` should iterate through the object's keys; for sequences, it " -"should iterate through the values." -msgstr "" +"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`." +msgstr "" +"Οι ακόλουθες μέθοδοι μπορούν να οριστούν για την υλοποίηση αντικειμένων " +"κοντέινερ. Καμία από αυτές δεν παρέχεται από την ίδια την κλάση :class:" +"`object`. Τα κοντέινερ είναι συνήθως :term:`sequences ` (όπως :" +"class:`lists ` ή :class:`tuples `) ή :term:`mappings ` " +"(όπως :term:`dictionaries `), αλλά τα λεξικά μπορούν επίσης να " +"αντιπροσωπεύουν άλλα κοντέινερ. Το πρώτο σύνολο μεθόδων χρησιμοποιείται " +"είτε για την εξομοίωση μιας ακολουθίας είτε για την εξομοίωση μιας " +"αντιστοίχισης∙ η διαφορά είναι ότι για μια ακολουθία, τα επιτρεπόμενα " +"κλειδιά θα πρέπει να είναι οι ακέραιοι *k* για τους οποίους ``0 <= k < N`` " +"όπου *N* είναι το μήκος της ακολουθίας, ή αντικείμενα :class:`slice`, τα " +"οποία ορίζουν ένα εύρος στοιχείων. Συνίσταται επίσης οι αντιστοιχίσεις να " +"παρέχουν τις μεθόδους :meth:`!keys`, :meth:`!values`, :meth:`!items`, :meth:" +"`!get`, :meth:`!clear`, :meth:`!setdefault`, :meth:`!pop`, :meth:`!" +"popitem`, :meth:`!copy`, και :meth:`!update` όπου συμπεριφέρονται παρόμοια " +"με εκείνα για τα τυπικά αντικείμενα :class:`dictionary ` της Python. " +"Το module :mod:`collections.abc` παρέχει μια :class:`~collections.abc." +"MutableMapping` :term:`abstract base class` για να βοηθήσει στη δημιουργία " +"αυτών των μεθόδων από ένα βασικό σύνολο :meth:`~object.__getitem__`, :meth:" +"`~object.__setitem__`, :meth:`~object.__delitem__`, και :meth:`!keys`." -#: reference/datamodel.rst:2808 +#: reference/datamodel.rst:3148 +msgid "" +"Mutable sequences should provide methods :meth:`~sequence.append`, :meth:" +"`~sequence.clear`, :meth:`~sequence.count`, :meth:`~sequence.extend`, :meth:" +"`~sequence.index`, :meth:`~sequence.insert`, :meth:`~sequence.pop`, :meth:" +"`~sequence.remove`, and :meth:`~sequence.reverse`, like Python standard :" +"class:`list` objects. Finally, sequence types should implement addition " +"(meaning concatenation) and multiplication (meaning repetition) by defining " +"the methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:" +"`~object.__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` and :" +"meth:`~object.__imul__` described below; they should not define other " +"numerical operators." +msgstr "" +"Οι μεταβλητές ακολουθίες θα πρέπει να παρέχουν μεθόδους :meth:`~sequence." +"append`, :meth:`~sequence.clear`, :meth:`~sequence.count`, :meth:`~sequence." +"extend`, :meth:`~sequence.index`, :meth:`~sequence.insert`, :meth:`~sequence." +"pop`, :meth:`~sequence.remove`, και :meth:`~sequence.reverse`, όπως τα " +"πρότυπα Python :class:`list` αντικείμενα. Τέλος, οι τύποι ακολουθιών θα " +"πρέπει να υλοποιούν πρόσθεση (που σημαίνει συνένωση) και πολλαπλασιασμό " +"(δηλαδή επανάληψη) ορίζοντας τις μεθόδους :meth:`~object.__add__`, :meth:" +"`~object.__radd__`, :meth:`~object.__iadd__`, :meth:`~object.__mul__`, :meth:" +"`~object.__rmul__` και :meth:`~object.__imul__` που περιγράφονται παρακάτω∙ " +"δεν θα πρέπει να ορίζουν άλλους αριθμητικούς τελεστές." + +#: reference/datamodel.rst:3160 +msgid "" +"It is recommended that both mappings and sequences implement the :meth:" +"`~object.__contains__` method to allow efficient use of the ``in`` operator; " +"for mappings, ``in`` should search the mapping's keys; for sequences, it " +"should search through the values. It is further recommended that both " +"mappings and sequences implement the :meth:`~object.__iter__` method to " +"allow efficient iteration through the container; for mappings, :meth:`!" +"__iter__` should iterate through the object's keys; for sequences, it should " +"iterate through the values." +msgstr "" +"Αυτό συνίσταται τόσο οι αντιστοιχίσεις όσο και οι ακολουθίες να εφαρμόζουν " +"τη μέθοδο :meth:`~object.__contains__` για να επιτρέπεται η αποτελεσματική " +"χρήση του τελεστή ``in`` ∙ για αντιστοιχίσεις, το ``in`` θα πρέπει να " +"αναζητήσει τα κλειδιά της αντιστοίχισης∙ για ακολουθίες θα πρέπει να " +"αναζητήσει τις τιμές. Συνίσταται περαιτέρω τόσο οι αντιστοιχίσεις όσο και " +"οι ακολουθίες να εφαρμόζουν τη μέθοδο :meth:`~object.__iter__` για να " +"επιτρέπεται η αποτελεσματική επανάληψη μέσω του κοντέινερ∙ για " +"αντιστοιχίσεις, η :meth:`!__iter__` θα πρέπει να επαναλαμβάνεται μέσω των " +"κλειδιών του αντικειμένου∙ για ακολουθίες, θα πρέπει να επαναλαμβάνεται μέσω " +"των τιμών." + +#: reference/datamodel.rst:3175 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " "define a :meth:`~object.__bool__` method and whose :meth:`!__len__` method " "returns zero is considered to be false in a Boolean context." msgstr "" +"Καλείται για την υλοποίηση της ενσωματωμένης συνάρτησης :func:`len`. Θα " +"πρέπει να επιστρέψει το μήκος του αντικειμένου, ένας ακέραιος αριθμός ``>=`` " +"0. Επίσης, ένα αντικείμενο που δεν ορίζει μια μέθοδο :meth:`~object." +"__bool__` και του οποίου η μέθοδος :meth:`!__len__` επιστρέφει μηδέν, " +"θεωρείται ψευδές σε ένα Boolean περιβάλλον." -#: reference/datamodel.rst:2815 +#: reference/datamodel.rst:3182 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3198,8 +5455,14 @@ msgid "" "OverflowError` by truth value testing, an object must define a :meth:" "`~object.__bool__` method." msgstr "" +"Στο CPython, το μήκος απαιτείται να είναι το πολύ :data:`sys.maxsize`. Εάν " +"το μήκος είναι μεγαλύτερο από :data:`!sys.maxsize` ορισμένες δυνατότητες " +"(όπως :func:`len`) ενδέχεται να αυξήσουν το :exc:`OverflowError`. Για να " +"αποφευχθεί να γίνει raise :exc:`!OverflowError` από τον έλεγχο τιμής " +"αλήθειας, ένα αντικείμενο πρέπει να ορίσει μια μέθοδο :meth:`~object." +"__bool__`." -#: reference/datamodel.rst:2824 +#: reference/datamodel.rst:3191 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3208,21 +5471,40 @@ msgid "" "method didn't exist at all. This method is purely an optimization and is " "never required for correctness." msgstr "" +"Καλείται για υλοποίηση :func:`operator.length_hint`. Θα πρέπει να επιστρέψει " +"ένα εκτιμώμενο μήκος για το αντικείμενο (το οποίο μπορεί να είναι μεγαλύτερο " +"ή μικρότερο από το πραγματικό μήκος). Το μήκος πρέπει να είναι ένας ακέραιος " +"αριθμός ``>=`` 0. Η τιμή επιστροφής μπορεί επίσης να είναι :data:" +"`NotImplemented`, η οποία αντιμετωπίζεται με τον ίδιο τρόπο σαν να μην " +"υπήρχε καθόλου η μέθοδος ``__length_hint__``. Αυτή η μέθοδος είναι καθαρά " +"βελτιστοποίηση και δεν απαιτείται ποτέ για ορθότητα." -#: reference/datamodel.rst:2838 +#: reference/datamodel.rst:3205 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" +"Η διαδικασία τμηματοποίησης γίνεται αποκλειστικά με τις ακόλουθες τρεις " +"μεθόδους. Μια κλήση όπως ::" + +#: reference/datamodel.rst:3207 +msgid "a[1:2] = b" +msgstr "a[1:2] = b" -#: reference/datamodel.rst:2842 +#: reference/datamodel.rst:3209 msgid "is translated to ::" -msgstr "" +msgstr "μεταφράζεται σε ::" + +#: reference/datamodel.rst:3211 +msgid "a[slice(1, 2, None)] = b" +msgstr "a[slice(1, 2, None)] = b" -#: reference/datamodel.rst:2846 +#: reference/datamodel.rst:3213 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" +"και ούτω καθεξής. Τα στοιχεία τμήματος που λείπουν συμπληρώνονται πάντα με " +"``None``." -#: reference/datamodel.rst:2851 +#: reference/datamodel.rst:3218 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3233,21 +5515,37 @@ msgid "" "term:`mapping` types, if *key* is missing (not in the container), :exc:" "`KeyError` should be raised." msgstr "" +"Καλείται για την υλοποίηση αξιολόγησης του ``self[key]``. Για τους τύπους :" +"term:`sequence`, τα αποδεκτά κλειδιά πρέπει να είναι ακέραιοι. Προαιρετικά, " +"ενδέχεται να υποστηρίζουν επίσης αντικείμενα :class:`slice`. Η υποστήριξη " +"αρνητικού ευρετηρίου είναι επίσης προαιρετική. Εάν το *key* είναι " +"ακατάλληλου τύπου, μπορεί να γίνει raise το :exc:`TypeError` ∙ εάν το *key* " +"είναι μια τιμή εκτός του συνόλου των ευρετηρίων για την ακολουθία (μετά από " +"οποιαδήποτε ειδική ερμηνεία αρνητικών τιμών), το :exc:`IndexError` θα πρέπει " +"να γίνει raise. Για τύπους :term:`mapping`, εάν λείπει το *key* (όχι στο " +"κοντέινερ), το :exc:`KeyError` θα πρέπει να γίνει raise." -#: reference/datamodel.rst:2863 +#: reference/datamodel.rst:3230 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" +"Οι βρόχοι :keyword:`for` αναμένουν ότι θα γίνει raise ένα :exc:`IndexError` " +"για παράνομα ευρετήρια για να επιτρέπεται ο σωστός εντοπισμός του τέλους της " +"ακολουθίας." -#: reference/datamodel.rst:2868 +#: reference/datamodel.rst:3235 msgid "" "When :ref:`subscripting` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" +"Όταν το :ref:`subscripting` μια *class*, η μέθοδος ειδικής " +"κλάσης :meth:`~object.__class_getitem__` μπορεί να κληθεί αντί για " +"``__getitem__()``. Δείτε το :ref:`classgetitem-versus-getitem` για " +"περισσότερες λεπτομέρειες." -#: reference/datamodel.rst:2876 +#: reference/datamodel.rst:3243 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3255,8 +5553,14 @@ msgid "" "sequences if elements can be replaced. The same exceptions should be raised " "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" +"Καλείται για την υλοποίηση της ανάθεσης στο ``self[key]``. Ίδια σημείωση με " +"το :meth:`__getitem__`. Αυτό θα πρέπει να εφαρμοστεί μόνο για αντιστοιχίσεις " +"εάν τα αντικείμενα υποστηρίζουν αλλαγές στις τιμές για κλειδιά ή εάν μπορούν " +"να προστεθούν νέα κλειδιά ή για ακολουθίες εάν μπορούν να αντικατασταθούν " +"στοιχεία. Θα πρέπει να δημιουργηθούν οι ίδιες εξαιρέσεις για ακατάλληλες " +"τιμές *key* όπως και για τη μέθοδο :meth:`__getitem__`." -#: reference/datamodel.rst:2885 +#: reference/datamodel.rst:3252 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3264,29 +5568,46 @@ msgid "" "the sequence. The same exceptions should be raised for improper *key* " "values as for the :meth:`__getitem__` method." msgstr "" +"Κλήθηκε για την υλοποίηση της διαγραφής του ``self[key]``. Ίδια σημείωση με " +"το :meth:`__getitem__`. Αυτό θα πρέπει να εφαρμόζεται μόνο για " +"αντιστοιχίσεις εάν τα αντικείμενα υποστηρίζουν την αφαίρεση πλήκτρων ή για " +"ακολουθίες εάν μπορούν να αφαιρεθούν στοιχεία από την ακολουθία. Θα πρέπει " +"να δημιουργηθούν οι ίδιες εξαιρέσεις για ακατάλληλες τιμές *key* όπως και " +"για τη μέθοδο :meth:`__getitem__`." -#: reference/datamodel.rst:2894 +#: reference/datamodel.rst:3261 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" +"Κλήθηκε από :class:`dict`\\ .\\ :meth:`__getitem__` για την υλοποίηση του " +"``self[key]`` για υποκλάσεις dict όταν το κλειδί δεν υπάρχει στο λεξικό." -#: reference/datamodel.rst:2900 +#: reference/datamodel.rst:3267 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " "the objects in the container. For mappings, it should iterate over the keys " "of the container." msgstr "" +"Αυτή η μέθοδος καλείται όταν απαιτείται ένας :term:`iterator` για ένα " +"κοντέινερ. Αυτή η μέθοδος θα πρέπει να επιστρέψει ένα νέο αντικείμενο " +"iterator που μπορεί να επαναλάβει όλα τα αντικείμενα στο κοντέινερ. Για " +"αντιστοιχίσεις, θα πρέπει να επαναλαμβάνεται πάνω από τα κλειδιά του " +"κοντέινερ." -#: reference/datamodel.rst:2908 +#: reference/datamodel.rst:3275 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" +"Καλείται (εάν υπάρχει) από την ενσωματωμένη :func:`reversed` για την " +"υλοποίηση της αντίστροφης επανάληψης. Θα πρέπει να επιστρέψει ένα νέο " +"iterator αντικείμενο που επαναλαμβάνεται πάνω από όλα τα αντικείμενα στο " +"κοντέινερ με αντίστροφη σειρά." -#: reference/datamodel.rst:2912 +#: reference/datamodel.rst:3279 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3294,43 +5615,66 @@ msgid "" "provide :meth:`__reversed__` if they can provide an implementation that is " "more efficient than the one provided by :func:`reversed`." msgstr "" +"Εάν η μέθοδος :meth:`__reversed__` δεν παρέχεται, η ενσωματωμένη :func:" +"`reversed` θα χρησιμοποιήσει το πρωτόκολλο ακολουθίας (:meth:`__len__` και :" +"meth:`__getitem__`). Τα αντικείμενα που υποστηρίζουν το πρωτόκολλο " +"ακολουθίας θα πρέπει να παρέχουν μόνο τη :meth:`__reversed__` εάν μπορούν να " +"παρέχουν μια υλοποίηση που είναι πιο αποτελεσματική από αυτή που παρέχεται " +"από τη :func:`reversed`." -#: reference/datamodel.rst:2919 +#: reference/datamodel.rst:3286 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " "objects can supply the following special method with a more efficient " "implementation, which also does not require the object be iterable." msgstr "" +"Οι τελεστές τεστ ιδιότητας μέλους (:keyword:`in` και :keyword:`not in`) " +"συνήθως υλοποιούνται ως επανάληψη μέσω ενός κοντέινερ. Ωστόσο, τα " +"αντικείμενα κοντέινερ μπορούν να παρέχουν την ακόλουθη ειδική μέθοδο μια μια " +"αποτελεσματική υλοποίηση, η οποία επίσης δεν απαιτεί το αντικείμενο να είναι " +"επαναλαμβανόμενο." -#: reference/datamodel.rst:2926 +#: reference/datamodel.rst:3293 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" +"Καλείται για την εφαρμογή τελεστών δοκιμής ιδιότητας μέλους. Θα πρέπει να " +"επιστρέψει true εάν το *item* είναι στο *self*, false διαφορετικά. Για την " +"αντιστοίχιση αντικειμένων, αυτό θα πρέπει να λαμβάνει υπόψη τα κλειδιά της " +"αντιστοίχισης αντί για τις τιμές ή τα ζεύγη κλειδιών-στοιχείων." -#: reference/datamodel.rst:2930 +#: reference/datamodel.rst:3297 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " "protocol via :meth:`__getitem__`, see :ref:`this section in the language " "reference `." msgstr "" +"Για αντικείμενα που δεν ορίζουν :meth:`__contains__`, το τεστ ιδιότητας " +"δοκιμάζει πρώτα την επανάληψη μέσω :meth:`__iter__`, και μετά το παλιό " +"πρωτόκολλο επανάληψης ακολουθίας μέσω :meth:`__getitem__`, δείτε :ref:`this " +"section in the language reference `." -#: reference/datamodel.rst:2939 +#: reference/datamodel.rst:3306 msgid "Emulating numeric types" -msgstr "" +msgstr "Εξομοίωση αριθμητικών τύπων" -#: reference/datamodel.rst:2941 +#: reference/datamodel.rst:3308 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " "number implemented (e.g., bitwise operations for non-integral numbers) " "should be left undefined." msgstr "" +"Οι ακόλουθες μέθοδοι μπορούν να οριστούν για την εξομοίωση αριθμητικών " +"αντικειμένων. Οι μέθοδοι που αντιστοιχούν σε πράξεις που δεν υποστηρίζονται " +"από το συγκεκριμένο είδος αριθμού που υλοποιείται (π.χ. λειτουργίες bitwise " +"για μη ακέραιους αριθμούς) θα πρέπει να παραμείνουν απροσδιόριστες." -#: reference/datamodel.rst:2967 +#: reference/datamodel.rst:3334 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3340,36 +5684,75 @@ msgid "" "meth:`__divmod__` method should be the equivalent to using :meth:" "`__floordiv__` and :meth:`__mod__`; it should not be related to :meth:" "`__truediv__`. Note that :meth:`__pow__` should be defined to accept an " -"optional third argument if the ternary version of the built-in :func:`pow` " -"function is to be supported." -msgstr "" - -#: reference/datamodel.rst:2978 +"optional third argument if the three-argument version of the built-in :func:" +"`pow` function is to be supported." +msgstr "" +"Αυτές οι μέθοδοι καλούνται να υλοποιήσουν τις δυαδικές αριθμητικές " +"λειτουργίες (``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:" +"`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). Για " +"παράδειγμα, για να αξιολογηθεί η έκφραση ``x + y``, όπου *x* είναι ένα " +"στιγμιότυπο μιας κλάσης που έχει μια μέθοδο :meth:`__add__`, καλείται το " +"``type(x).__add__(x, y)``. Η μέθοδος :meth:`__divmod__` θα πρέπει να είναι " +"ισοδύναμη με τη χρήση των :meth:`__floordiv__` και :meth:`__mod__`; δεν θα " +"πρέπει να σχετίζεται με τη :meth:`__truediv__`. Σημειώστε ότι η :meth:" +"`__pow__` θα πρέπει να ορίζεται ώστε να δέχεται ένα προαιρετικό τρίτο όρισμα " +"εάν υποστηρίζεται η τριών ορισμάτων έκδοση της ενσωματωμένης συνάρτησης :" +"func:`pow`." + +#: reference/datamodel.rst:3345 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" +"Εάν μία από αυτές τις μεθόδους δεν υποστηρίζει τη λειτουργία με τα " +"παρεχόμενα ορίσματα, θα πρέπει να επιστρέψει :data:`NotImplemented`." -#: reference/datamodel.rst:3001 +#: reference/datamodel.rst:3368 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" "`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with reflected (swapped) " -"operands. These functions are only called if the left operand does not " -"support the corresponding operation [#]_ and the operands are of different " -"types. [#]_ For instance, to evaluate the expression ``x - y``, where *y* is " -"an instance of a class that has an :meth:`__rsub__` method, ``type(y)." +"operands. These functions are only called if the operands are of different " +"types, when the left operand does not support the corresponding operation " +"[#]_, or the right operand's class is derived from the left operand's class. " +"[#]_ For instance, to evaluate the expression ``x - y``, where *y* is an " +"instance of a class that has an :meth:`__rsub__` method, ``type(y)." "__rsub__(y, x)`` is called if ``type(x).__sub__(x, y)`` returns :data:" -"`NotImplemented`." -msgstr "" +"`NotImplemented` or ``type(y)`` is a subclass of ``type(x)``. [#]_" +msgstr "" +"Αυτές οι μέθοδοι καλούνται να υλοποιήσουν τις δυαδικές αριθμητικές " +"λειτουργίες (``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:" +"`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) με " +"ανακλώμενους (ανταλλαγμένους) τελεστές. Αυτές οι λειτουργίες καλούνται μόνο " +"εάν οι τελεστές είναι διαφορετικών τύπων, όταν ο αριστερός τελεστής δεν " +"υποστηρίζει την αντίστοιχη λειτουργία [#]_, ή η κλάση του δεξιού τελεστή " +"προέρχεται από την κλάση του αριστερού τελεστή. [#]_ Για παράδειγμα, για να " +"αξιολογηθεί η έκφραση ``x - y``, όπου *y* είναι ένα στιγμιότυπο μιας κλάσης " +"που έχει μια μέθοδο :meth:`__rsub__`, καλείται το ``type(y).__rsub__(y, x)`` " +"εάν το ``type(x).__sub__(x, y)`` επιστρέψει :data:`NotImplemented` ή το " +"``type(y)`` είναι υποκλάση του ``type(x)``. [#]_" + +#: reference/datamodel.rst:3379 +msgid "" +"Note that :meth:`__rpow__` should be defined to accept an optional third " +"argument if the three-argument version of the built-in :func:`pow` function " +"is to be supported." +msgstr "" +"Σημειώστε ότι η :meth:`__rpow__` θα πρέπει να ορίζεται ώστε να δέχεται ένα " +"προαιρετικό τρίτο όρισμα εάν υποστηρίζεται η τριών ορισμάτων έκδοση της " +"ενσωματωμένης συνάρτησης :func:`pow`." -#: reference/datamodel.rst:3013 +#: reference/datamodel.rst:3385 msgid "" -"Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " -"coercion rules would become too complicated)." +"Three-argument :func:`pow` now try calling :meth:`~object.__rpow__` if " +"necessary. Previously it was only called in two-argument :func:`!pow` and " +"the binary power operator." msgstr "" +"Η τριών ορισμάτων :func:`pow` τώρα προσπαθεί να καλέσει τη :meth:`~object." +"__rpow__` εάν είναι απαραίτητο. Παλαιότερα καλούνταν μόνο στη δύο ορισμάτων :" +"func:`!pow` και στον δυαδικό τελεστή δύναμης." -#: reference/datamodel.rst:3018 +#: reference/datamodel.rst:3391 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3377,8 +5760,13 @@ msgid "" "reflected method. This behavior allows subclasses to override their " "ancestors' operations." msgstr "" +"Εάν ο τύπος του δεξιού τελεστή είναι υποκλάση του τύπου του αριστερού " +"τελεστή και αυτή η υποκλάση παρέχει μια διαφορετική υλοποίηση της " +"ανακλώμενης μεθόδου για τη λειτουργία, αυτή η μέθοδος θα κληθεί πριν από τη " +"μη ανακλώμενη μέθοδο του αριστερού τελεστή. Αυτή η συμπεριφορά επιτρέπει " +"στις υποκλάσεις να παρακάμπτουν τις πράξεις των προγόνων τους." -#: reference/datamodel.rst:3039 +#: reference/datamodel.rst:3411 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3395,20 +5783,41 @@ msgid "" "augmented-assignment-tuple-error`), but this behavior is in fact part of the " "data model." msgstr "" - -#: reference/datamodel.rst:3062 +"Αυτές οι μέθοδοι καλούνται να υλοποιήσουν τις επαυξημένες αριθμητικές " +"εκχωρήσεις (``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, " +"``**=``, ``<<=``, ``>>=``, ``&=``, ``^=``, ``|=``). Αυτές οι μέθοδοι θα " +"πρέπει να προσπαθήσουν να κάνουν τη λειτουργία επιτόπου (τροποποίηση *self*) " +"και να επιστρέψουν το αποτέλεσμα (το οποίο θα μπορούσε, αλλά δεν χρειάζεται " +"να είναι, *self*). Εάν δεν έχει οριστεί μια συγκεκριμένη μέθοδος ή εάν αυτή " +"η μέθοδος επιστρέψει :data:`NotImplemented`, η επαυξημένη ανάθεση " +"επανέρχεται στις κανονικές μεθόδους. Για παράδειγμα, εάν το *x* είναι ένα " +"στιγμιότυπο μιας κλάσης με μια μέθοδο :meth:`__iadd__`, το ``x += y`` " +"ισοδυναμεί ``x = x.__iadd__(y)`` . Εάν το :meth:`__iadd__` δεν υπάρχει, ή " +"εάν το ``x.__iadd__(y)`` επιστρέφει :data:`!NotImplemented`, τα ``x." +"__add__(y)`` και ``y.__radd__(x)`` θεωρούνται, όπως και με την αξιολόγηση " +"του. Σε ορισμένες περιπτώσεις, η επαυξημένη ανάθεση μπορεί να οδηγήσει σε " +"απροσδόκητα σφάλματα (δείτε :ref:`faq-augmented-assignment-tuple-error`), " +"αλλά αυτή η συμπεριφορά είναι στην πραγματικότητα μέρος του μοντέλου " +"δεδομένων." + +#: reference/datamodel.rst:3434 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" +"Καλείται για την υλοποίηση μονομερών αριθμητικών πράξεων (``-``, ``+``, :" +"func:`abs` και ``~``)." -#: reference/datamodel.rst:3075 +#: reference/datamodel.rst:3447 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" +"Καλείται για την υλοποίηση των ενσωματωμένων συναρτήσεων :func:`complex`, :" +"func:`int` και :func:`float`. Θα πρέπει να επιστρέψει μια τιμή του " +"κατάλληλου τύπου." -#: reference/datamodel.rst:3082 +#: reference/datamodel.rst:3454 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3416,15 +5825,24 @@ msgid "" "functions). Presence of this method indicates that the numeric object is an " "integer type. Must return an integer." msgstr "" +"Καλείται για υλοποίηση :func:`operator.index`, και όποτε η Python χρειάζεται " +"να μετατρέψει χωρίς απώλειες το αριθμητικό αντικείμενο σε ένα ακέραιο " +"αντικείμενο (όπως στη λειτουργία τμηματοποίησης ή στις ενσωματωμένες " +"συναρτήσεις :func:`bin`, :func:`hex` και :func:`oct`). Η παρουσία αυτής της " +"μεθόδου υποδεικνύει ότι το αριθμητικό αντικείμενο είναι ακέραιου τύπου. " +"Πρέπει να επιστρέψει έναν ακέραιο αριθμό." -#: reference/datamodel.rst:3088 +#: reference/datamodel.rst:3460 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" +"Εάν οι :meth:`__int__`, :meth:`__float__` και :meth:`__complex__` δεν " +"ορίζονται, τότε οι αντίστοιχες ενσωματωμένες συναρτήσεις :func:`int`, :func:" +"`float` και :func:`complex` επιστρέφουν στο :meth:`__index__`." -#: reference/datamodel.rst:3100 +#: reference/datamodel.rst:3472 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3432,22 +5850,22 @@ msgid "" "return the value of the object truncated to an :class:`~numbers.Integral` " "(typically an :class:`int`)." msgstr "" +"Καλείται για την υλοποίηση της ενσωματωμένης συνάρτησης :func:`round` και :" +"mod:`math` συναρτήσεις :func:`~math.trunc`, :func:`~math.floor` και :func:" +"`~math.ceil`. Εκτός εάν το *ndigits* μεταβιβαστεί στο :meth:`!__round__` " +"όλες αυτές οι μέθοδοι θα πρέπει να επιστρέψουν την τιμή του αντικειμένου που " +"περικόπτεται σε μια :class:`~numbers.Integral` (συνήθως ένα :class:`int`)." -#: reference/datamodel.rst:3106 +#: reference/datamodel.rst:3478 msgid "" -"The built-in function :func:`int` falls back to :meth:`__trunc__` if " -"neither :meth:`__int__` nor :meth:`__index__` is defined." -msgstr "" +":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." +msgstr "Η :func:`int` δεν αναθέτει πλέον στη μέθοδο :meth:`~object.__trunc__`." -#: reference/datamodel.rst:3109 -msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." -msgstr "" - -#: reference/datamodel.rst:3116 +#: reference/datamodel.rst:3485 msgid "With Statement Context Managers" -msgstr "" +msgstr "Με τους Διαχειριστές Περιβάλλοντος Δήλωσης" -#: reference/datamodel.rst:3118 +#: reference/datamodel.rst:3487 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3456,69 +5874,105 @@ msgid "" "using the :keyword:`!with` statement (described in section :ref:`with`), but " "can also be used by directly invoking their methods." msgstr "" +"Ένα :dfn:`context manager` είναι ένα αντικείμενο που ορίζει το περιβάλλον " +"χρόνου εκτέλεσης που θα καθοριστεί κατά την εκτέλεση μιας πρότασης :keyword:" +"`with`. Ο διαχειριστής περιβάλλοντος χειρίζεται την είσοδο και την έξοδο από " +"το επιθυμητό περιβάλλον χρόνου εκτέλεσης για την εκτέλεση του μπλοκ κώδικα. " +"Οι διαχειριστές περιβάλλοντος συνήθως καλούνται χρησιμοποιώντας τη δήλωση :" +"keyword:`!with` (που περιγράφεται στην ενότητα :ref:`with`), αλλά μπορούν " +"επίσης να χρησιμοποιηθούν με απευθείας επίκληση των μεθόδων τους." -#: reference/datamodel.rst:3129 +#: reference/datamodel.rst:3498 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" +"Οι τυπικές χρήσεις των διαχειριστών περιβάλλοντος περιλαμβάνουν την " +"αποθήκευση και την επαναφορά διαφόρων ειδών καθολικών καταστάσεων, το " +"κλείδωμα και το ξεκλείδωμα πόρων, το κλείσιμο των ανοιχτών αρχείων κ.λπ." -#: reference/datamodel.rst:3132 +#: reference/datamodel.rst:3501 msgid "" -"For more information on context managers, see :ref:`typecontextmanager`." +"For more information on context managers, see :ref:`typecontextmanager`. " +"The :class:`object` class itself does not provide the context manager " +"methods." msgstr "" +"Για περισσότερες πληροφορίες σχετικά με τους διαχειριστές περιβάλλοντος, " +"ανατρέξτε στο :ref:`typecontextmanager`. Η ίδια η κλάση :class:`object` δεν " +"παρέχει τις μεθόδους διαχειριστή περιβάλλοντος." -#: reference/datamodel.rst:3137 +#: reference/datamodel.rst:3507 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" +"Εισαγάγετε το περιβάλλον χρόνου εκτέλεσης που σχετίζεται με αυτό το " +"αντικείμενο. Η δήλωση :keyword:`with` θα δεσμεύσει την επιστρεφόμενη τιμή " +"αυτής της μεθόδου με τους στόχους που καθορίζονται στον όρο :keyword:`!as` " +"της πρότασης, εάν υπάρχει." -#: reference/datamodel.rst:3144 +#: reference/datamodel.rst:3514 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" +"Έξοδος από το περιβάλλον χρόνου εκτέλεσης που σχετίζεται με αυτό το " +"αντικείμενο. Οι παράμετροι περιγράφουν την εξαίρεση που προκάλεσε την έξοδο " +"από το περιβάλλον. Εάν το περιβάλλον είχε βγει χωρίς εξαίρεση, και τα τρία " +"ορίσματα θα είναι :const:`None`." -#: reference/datamodel.rst:3148 +#: reference/datamodel.rst:3518 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " "Otherwise, the exception will be processed normally upon exit from this " "method." msgstr "" +"Εάν παρέχεται μια εξαίρεση και η μέθοδος επιθυμεί να καταργήσει την εξαίρεση " +"(δηλαδή, να αποτρέψει τη διάδοση της), θα πρέπει να επιστρέψει μια " +"πραγματική τιμή. Διαφορετικά, η εξαίρεση θα διεκπεραιωθεί κανονικά κατά την " +"έξοδο από αυτήν τη μέθοδο." -#: reference/datamodel.rst:3152 +#: reference/datamodel.rst:3522 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" +"Λάβετε υπόψη ότι οι μέθοδοι :meth:`~object.__exit__` δεν θα πρέπει να " +"επαναφέρουν την εξαίρεση που μεταβιβάστηκε∙ αυτή είναι ευθύνη του καλούντος." -#: reference/datamodel.rst:3159 +#: reference/datamodel.rst:3528 msgid ":pep:`343` - The \"with\" statement" -msgstr "" +msgstr ":pep:`343` - Η πρόταση \"with\"" -#: reference/datamodel.rst:3159 +#: reference/datamodel.rst:3529 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" +"Οι προδιαγραφές, το υπόβαθρο και τα παραδείγματα για τη δήλωση Python :" +"keyword:`with`." -#: reference/datamodel.rst:3166 +#: reference/datamodel.rst:3536 msgid "Customizing positional arguments in class pattern matching" -msgstr "" +msgstr "Προσαρμογή ορισμάτων θέσης στην αντιστοίχιση προτύπων κλάσης" -#: reference/datamodel.rst:3168 +#: reference/datamodel.rst:3538 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " "without special support in ``MyClass``. To be able to use that kind of " "pattern, the class needs to define a *__match_args__* attribute." msgstr "" +"Όταν χρησιμοποιείται ένα όνομα κλάσης σε ένα μοτίβο, τα ορίσματα θέσης στο " +"μοτίβο δεν επιτρέπονται από προεπιλογή, δηλαδή ``case MyClass(x, y)`` δεν " +"είναι συνήθως έγκυρη χωρίς ειδική υποστήριξη στο ``MyClass``. Για να " +"μπορέσει να χρησιμοποιήσει αυτό το είδος μοτίβου, η κλάση πρέπει να ορίσει " +"ένα χαρακτηριστικό *__match_args__*." -#: reference/datamodel.rst:3175 +#: reference/datamodel.rst:3545 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3526,8 +5980,13 @@ msgid "" "*__match_args__* as the keyword. The absence of this attribute is equivalent " "to setting it to ``()``." msgstr "" +"Σε αυτήν την μεταβλητή κλάσης μπορεί να εκχωρηθεί μια πλειάδα συμβολοσειρών. " +"Όταν αυτή η κλάση χρησιμοποιείται σε ένα μοτίβο κλάσης με ορίσματα θέσης, " +"κάθε όρισμα θέσης θα μετατραπεί σε όρισμα λέξης-κλειδιού, χρησιμοποιώντας " +"την αντίστοιχη τιμή στο *__match_args__* ως λέξη-κλειδί. Η απουσία αυτού του " +"χαρακτηριστικού ισοδυναμεί με τη ρύθμιση του σε ``()``." -#: reference/datamodel.rst:3181 +#: reference/datamodel.rst:3551 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3536,34 +5995,47 @@ msgid "" "*__match_args__*; if it is larger, the pattern match attempt will raise a :" "exc:`TypeError`." msgstr "" +"Για παράδειγμα, εάν το ``MyClass.__match_args__`` είναι ``(\"left\", " +"\"center\", \"right\")`` αυτό σημαίνει ότι το ``case MyClass(x, y)`` " +"ισοδυναμεί με ``case MyClass(left=x, center=y)``. Σημειώστε ότι ο αριθμός " +"των ορισμάτων στο μοτίβο πρέπει να είναι μικρότερος ή ίσος με τον αριθμό των " +"στοιχείων στο *__match_args__* ∙ αν είναι μεγαλύτερο, η προσπάθεια " +"αντιστοίχισης μοτίβου θα κάνει raise μια :exc:`TypeError`." -#: reference/datamodel.rst:3191 +#: reference/datamodel.rst:3561 msgid ":pep:`634` - Structural Pattern Matching" -msgstr "" +msgstr ":pep:`634` - Αντιστοίχιση δομικών προτύπων" -#: reference/datamodel.rst:3192 +#: reference/datamodel.rst:3562 msgid "The specification for the Python ``match`` statement." -msgstr "" +msgstr "Η προδιαγραφή για τη δήλωση Python ``match``." -#: reference/datamodel.rst:3198 +#: reference/datamodel.rst:3568 msgid "Emulating buffer types" -msgstr "" +msgstr "Εξομοίωση τύπων buffer" -#: reference/datamodel.rst:3200 +#: reference/datamodel.rst:3570 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " "implemented by builtin types such as :class:`bytes` and :class:`memoryview`, " "and third-party libraries may define additional buffer types." msgstr "" +"Το πρωτόκολλο :ref:`buffer protocol ` παρέχει έναν τρόπο για " +"τα αντικείμενα της Python να εκθέτουν αποτελεσματική πρόσβαση σε έναν πίνακα " +"μνήμης χαμηλού επιπέδου. Αυτό το πρωτόκολλο υλοποιείται από ενσωματωμένους " +"τύπους όπως :class:`bytes` και :class:`memoryview`, και οι βιβλιοθήκες " +"τρίτων μπορούν να ορίσουν πρόσθετους τύπους buffer." -#: reference/datamodel.rst:3205 +#: reference/datamodel.rst:3575 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" +"Ενώ οι τύπου buffer συνήθως υλοποιούνται σε C, είναι επίσης δυνατή η " +"υλοποίηση του πρωτοκόλλου στην Python." -#: reference/datamodel.rst:3210 +#: reference/datamodel.rst:3580 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -3572,8 +6044,15 @@ msgid "" "convenient way to interpret the flags. The method must return a :class:" "`memoryview` object." msgstr "" +"Καλείται όταν ζητείται buffer από τον *self* (για παράδειγμα, από τον " +"κατασκευαστή :class:`memoryview`). Το όρισμα *flags* είναι ένας ακέραιος " +"αριθμός που αντιπροσωπεύει το είδος της προσωρινής μνήμης που ζητήθηκε, " +"επηρεάζοντας για παράδειγμα εάν η προσωρινή μνήμη που επιστρέφεται είναι " +"μόνο για ανάγνωση ή για εγγράψιμο. Η :class:`inspect.BufferFlags` παρέχει " +"έναν βολικό τρόπο ερμηνείας των flags. Η μέθοδος πρέπει να επιστρέψει ένα " +"αντικείμενο :class:`memoryview`." -#: reference/datamodel.rst:3219 +#: reference/datamodel.rst:3589 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -3581,37 +6060,167 @@ msgid "" "buffer. This method should return ``None``. Buffer objects that do not need " "to perform any cleanup are not required to implement this method." msgstr "" +"Καλείται όταν δεν χρειάζεται πλέον μια προσωρινή μνήμη. Το όρισμα *buffer* " +"είναι ένα αντικείμενο :class:`memoryview` που επιστράφηκε προηγουμένως από " +"την :meth:`~object.__buffer__`. Η μέθοδος πρέπει να απελευθερώσει τυχόν " +"πόρους που σχετίζονται με το buffer. Αυτή η μέθοδος θα πρέπει να επιστρέψει " +"``None``. Τα αντικείμενα buffer που δεν χρειάζονται εκκαθάριση δεν " +"απαιτούνται για την εφαρμογή αυτής της μεθόδου." -#: reference/datamodel.rst:3231 +#: reference/datamodel.rst:3600 msgid ":pep:`688` - Making the buffer protocol accessible in Python" -msgstr "" +msgstr ":pep:`688` - Κάνοντας το πρωτόκολλο buffer προσβάσιμο στην Python" -#: reference/datamodel.rst:3231 +#: reference/datamodel.rst:3601 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" +"Παρουσιάζει τις μεθόδους Python ``__buffer__`` και ``__release_buffer__``." -#: reference/datamodel.rst:3233 +#: reference/datamodel.rst:3603 msgid ":class:`collections.abc.Buffer`" -msgstr "" +msgstr ":class:`collections.abc.Buffer`" -#: reference/datamodel.rst:3234 +#: reference/datamodel.rst:3604 msgid "ABC for buffer types." +msgstr "ABC για τύπους buffer." + +#: reference/datamodel.rst:3607 +msgid "Annotations" +msgstr "Annotations" + +#: reference/datamodel.rst:3609 +msgid "" +"Functions, classes, and modules may contain :term:`annotations " +"`, which are a way to associate information (usually :term:`type " +"hints `) with a symbol." msgstr "" +"Οι συναρτήσεις, οι κλάσεις και τα προγράμματα μπορεί να περιέχουν :term:" +"`annotations `, που είναι ένας τρόπος να συσχετιστεί πληροφορία " +"(συνήθως :term:`type hints `) με ένα σύμβολο." -#: reference/datamodel.rst:3239 -msgid "Special method lookup" +#: reference/datamodel.rst:3615 +msgid "" +"This attribute contains the annotations for an object. It is :ref:`lazily " +"evaluated `, so accessing the attribute may execute " +"arbitrary code and raise exceptions. If evaluation is successful, the " +"attribute is set to a dictionary mapping from variable names to annotations." msgstr "" +"Αυτό το χαρακτηριστικό περιέχει τα annotations για ένα αντικείμενο. Είναι :" +"ref:`lazily evaluated `, οπότε η πρόσβαση στο " +"χαρακτηριστικό μπορεί να εκτελέσει αυθαίρετο κώδικα και να κάνει raise " +"εξαιρέσεις. Εάν η αξιολόγηση είναι επιτυχής, το χαρακτηριστικό ορίζεται σε " +"ένα λεξικό που αντιστοιχεί από ονόματα μεταβλητών σε annotations." -#: reference/datamodel.rst:3241 +#: reference/datamodel.rst:3620 +msgid "Annotations are now lazily evaluated." +msgstr "Τα annotations αξιολογούνται πλέον τεμπέλικα." + +#: reference/datamodel.rst:3625 +msgid "" +"An :term:`annotate function`. Returns a new dictionary object mapping " +"attribute/parameter names to their annotation values." +msgstr "" +"Ένα :term:`annotate function`. Επιστρέφει ένα νέο αντικείμενο λεξικού που " +"αντιστοιχεί ονόματα χαρακτηριστικών/παραμέτρων στις τιμές των annotations " +"τους." + +#: reference/datamodel.rst:3628 +msgid "" +"Takes a format parameter specifying the format in which annotations values " +"should be provided. It must be a member of the :class:`annotationlib.Format` " +"enum, or an integer with a value corresponding to a member of the enum." +msgstr "" +"Λαμβάνει μια παράμετρο μορφής που καθορίζει τη μορφή στην οποία θα πρέπει να " +"παρέχονται οι τιμές των annotations. Πρέπει να είναι μέλος της :class:" +"`annotationlib.Format` enum, ή ένας ακέραιος αριθμός με τιμή που αντιστοιχεί " +"σε μέλος της enum." + +#: reference/datamodel.rst:3632 +msgid "" +"If an annotate function doesn't support the requested format, it must raise :" +"exc:`NotImplementedError`. Annotate functions must always support :attr:" +"`~annotationlib.Format.VALUE` format; they must not raise :exc:" +"`NotImplementedError()` when called with this format." +msgstr "" +"Εάν μια annotate συνάρτηση δεν υποστηρίζει την ζητούμενη μορφή, πρέπει να " +"κάνει raise :exc:`NotImplementedError`. Οι annotate συναρτήσεις πρέπει πάντα " +"να υποστηρίζουν τη μορφή :attr:`~annotationlib.Format.VALUE` ∙ δεν πρέπει να " +"κάνουν raise :exc:`NotImplementedError()` όταν καλούνται με αυτή τη μορφή." + +#: reference/datamodel.rst:3637 +msgid "" +"When called with :attr:`~annotationlib.Format.VALUE` format, an annotate " +"function may raise :exc:`NameError`; it must not raise :exc:`!NameError` " +"when called requesting any other format." +msgstr "" +"Όταν καλείται με τη μορφή :attr:`~annotationlib.Format.VALUE`, μια annotate " +"συνάρτηση μπορεί να κάνει raise :exc:`NameError` ∙ δεν πρέπει να κάνει " +"raise :exc:`!NameError` όταν καλείται ζητώντας οποιαδήποτε άλλη μορφή." + +#: reference/datamodel.rst:3640 +msgid "" +"If an object does not have any annotations, :attr:`~object.__annotate__` " +"should preferably be set to ``None`` (it can’t be deleted), rather than set " +"to a function that returns an empty dict." +msgstr "" +"Εάν ένα αντικείμενο δεν έχει κανένα annotation, το :attr:`~object." +"__annotate__` θα πρέπει κατά προτίμηση να ορίζεται σε ``None`` (δεν μπορεί " +"να διαγραφεί), αντί να ορίζεται σε μια συνάρτηση που επιστρέφει ένα κενό " +"dict." + +#: reference/datamodel.rst:3647 +msgid ":pep:`649` --- Deferred evaluation of annotation using descriptors" +msgstr "" +":pep:`649` --- Τεμπέλικη αξιολόγηση annotation χρησιμοποιώντας descriptors" + +#: reference/datamodel.rst:3648 +msgid "" +"Introduces lazy evaluation of annotations and the ``__annotate__`` function." +msgstr "" +"Παρουσιάζει την τεμπέλικη αξιολόγηση των annotations και τη συνάρτηση " +"``__annotate__``." + +#: reference/datamodel.rst:3654 +msgid "Special method lookup" +msgstr "Αναζήτηση ειδικής μεθόδου" + +#: reference/datamodel.rst:3656 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " "object's instance dictionary. That behaviour is the reason why the " "following code raises an exception::" msgstr "" - -#: reference/datamodel.rst:3256 +"Για προσαρμοσμένες κλάσεις, οι σιωπηρές επικλήσεις ειδικών μεθόδων είναι " +"εγγυημένο ότι θα λειτουργούν σωστά μόνο εάν ορίζονται στον τύπο ενός " +"αντικειμένου και όχι στο λεξικό στιγμιοτύπου του αντικειμένου. Αυτή η " +"συμπεριφορά είναι ο λόγος για τον οποίο ο ακόλουθος κώδικας κάνει raise μια " +"εξαίρεση::" + +#: reference/datamodel.rst:3661 +msgid "" +">>> class C:\n" +"... pass\n" +"...\n" +">>> c = C()\n" +">>> c.__len__ = lambda: 5\n" +">>> len(c)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: object of type 'C' has no len()" +msgstr "" +">>> class C:\n" +"... pass\n" +"...\n" +">>> c = C()\n" +">>> c.__len__ = lambda: 5\n" +">>> len(c)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: object of type 'C' has no len()" + +#: reference/datamodel.rst:3671 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -3619,22 +6228,108 @@ msgid "" "of these methods used the conventional lookup process, they would fail when " "invoked on the type object itself::" msgstr "" +"Η λογική πίσω από αυτήν τη συμπεριφορά έγκειται σε μια σειρά ειδικών μεθόδων " +"όπως :meth:`~object.__hash__` και :meth:`~object.__repr__` που υλοποιούνται " +"από όλα τα αντικείμενα, συμπεριλαμβανομένων των αντικειμένων τύπου. Εάν η " +"σιωπηρή αναζήτηση αυτών των μεθόδων χρησιμοποιούσε τη συμβατική διαδικασία " +"αναζήτησης, θα αποτύγχανε όταν καλούνταν στο ίδιο το αντικείμενο τύπου::" -#: reference/datamodel.rst:3270 +#: reference/datamodel.rst:3678 +msgid "" +">>> 1 .__hash__() == hash(1)\n" +"True\n" +">>> int.__hash__() == hash(int)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: descriptor '__hash__' of 'int' object needs an argument" +msgstr "" +">>> 1 .__hash__() == hash(1)\n" +"True\n" +">>> int.__hash__() == hash(int)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: descriptor '__hash__' of 'int' object needs an argument" + +#: reference/datamodel.rst:3685 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" +"Η εσφαλμένη προσπάθειας επίκλησης μιας μη δεσμευμένης μεθόδου μιας κλάσης με " +"αυτόν τον τρόπο αναφέρεται μερικές φορές ως 'σύγχυση μετακλάσης', και " +"αποφεύγεται με παράκαμψη της παρουσίας κατά την αναζήτηση ειδικών μεθόδων::" -#: reference/datamodel.rst:3279 +#: reference/datamodel.rst:3689 +msgid "" +">>> type(1).__hash__(1) == hash(1)\n" +"True\n" +">>> type(int).__hash__(int) == hash(int)\n" +"True" +msgstr "" +">>> type(1).__hash__(1) == hash(1)\n" +"True\n" +">>> type(int).__hash__(int) == hash(int)\n" +"True" + +#: reference/datamodel.rst:3694 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" - -#: reference/datamodel.rst:3305 +"Εκτός από την παράκαμψη οποιωνδήποτε χαρακτηριστικών στιγμιοτύπου για λόγους " +"ορθότητας, η σιωπηρή αναζήτηση ειδική μεθόδου γενικά παρακάμπτει επίσης τη " +"μέθοδο :meth:`~object.__getattribute__` ακόμη και της μετακλάσης του " +"αντικειμένου::" + +#: reference/datamodel.rst:3698 +msgid "" +">>> class Meta(type):\n" +"... def __getattribute__(*args):\n" +"... print(\"Metaclass getattribute invoked\")\n" +"... return type.__getattribute__(*args)\n" +"...\n" +">>> class C(object, metaclass=Meta):\n" +"... def __len__(self):\n" +"... return 10\n" +"... def __getattribute__(*args):\n" +"... print(\"Class getattribute invoked\")\n" +"... return object.__getattribute__(*args)\n" +"...\n" +">>> c = C()\n" +">>> c.__len__() # Explicit lookup via instance\n" +"Class getattribute invoked\n" +"10\n" +">>> type(c).__len__(c) # Explicit lookup via type\n" +"Metaclass getattribute invoked\n" +"10\n" +">>> len(c) # Implicit lookup\n" +"10" +msgstr "" +">>> class Meta(type):\n" +"... def __getattribute__(*args):\n" +"... print(\"Metaclass getattribute invoked\")\n" +"... return type.__getattribute__(*args)\n" +"...\n" +">>> class C(object, metaclass=Meta):\n" +"... def __len__(self):\n" +"... return 10\n" +"... def __getattribute__(*args):\n" +"... print(\"Class getattribute invoked\")\n" +"... return object.__getattribute__(*args)\n" +"...\n" +">>> c = C()\n" +">>> c.__len__() # Explicit lookup via instance\n" +"Class getattribute invoked\n" +"10\n" +">>> type(c).__len__(c) # Explicit lookup via type\n" +"Metaclass getattribute invoked\n" +"10\n" +">>> len(c) # Implicit lookup\n" +"10" + +#: reference/datamodel.rst:3720 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -3642,53 +6337,75 @@ msgid "" "special method *must* be set on the class object itself in order to be " "consistently invoked by the interpreter)." msgstr "" +"Η παράκαμψη του μηχανισμού :meth:`~object.__getattribute__` με αυτόν τον " +"τρόπο παρέχει σημαντικά περιθώρια για βελτιστοποιήσεις ταχύτητας εντός του " +"διερμηνέα, με κόστος κάποιας ευελιξίας στον χειρισμό ειδικών μεθόδων (η " +"ειδική μέθοδος *πρέπει* να οριστεί στο ίδιο το αντικείμενο κλάσης για να " +"καλείται με συνέπεια από τον διερμηνέα)." -#: reference/datamodel.rst:3316 +#: reference/datamodel.rst:3731 msgid "Coroutines" -msgstr "" +msgstr "Coroutines" -#: reference/datamodel.rst:3320 +#: reference/datamodel.rst:3735 msgid "Awaitable Objects" -msgstr "" +msgstr "Awaitable Αντικείμενα" -#: reference/datamodel.rst:3322 +#: reference/datamodel.rst:3737 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" +"Ένα αντικείμενο :term:`awaitable` εφαρμόζει γενικά μια μέθοδο :meth:`~object." +"__await__`. Τα :term:`Coroutine objects ` που επιστρέφονται από " +"τις :keyword:`async def` συναρτήσεις είναι awaitable." -#: reference/datamodel.rst:3328 +#: reference/datamodel.rst:3743 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" +"Τα αντικείμενα :term:`generator iterator` που επιστράφηκαν από γεννήτριες " +"διακοσμημένες με :func:`types.coroutine` είναι επίσης awaitable, αλλά δεν " +"εφαρμόζουν το :meth:`~object.__await__`." -#: reference/datamodel.rst:3334 +#: reference/datamodel.rst:3749 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " -"method to be compatible with the :keyword:`await` expression." +"method to be compatible with the :keyword:`await` expression. The :class:" +"`object` class itself is not awaitable and does not provide this method." msgstr "" +"Πρέπει να επιστρέψει ένα :term:`iterator`. Θα πρέπει να χρησιμοποιείται για " +"την υλοποίηση :term:`awaitable` αντικειμένων. Για παράδειγμα, η :class:" +"`asyncio.Future` υλοποιεί αυτήν την μέθοδο ώστε να είναι συμβατή με την " +"έκφραση :keyword:`await`. Η ίδια η κλάση :class:`object` δεν είναι αναμονή " +"και δεν παρέχει αυτήν τη μέθοδο." -#: reference/datamodel.rst:3340 +#: reference/datamodel.rst:3757 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " "specific to the implementation of the asynchronous execution framework (e." "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" +"Η γλώσσα δεν θέτει κανέναν περιορισμό στον τύπο ή την τιμή των αντικειμένων " +"που παράγονται από τον iterator που επιστρέφεται από το ``__await__``, καθώς " +"αυτό αφορά συγκεκριμένα την υλοποίηση του πλαισίου ασύγχρονης εκτέλεσης (π." +"χ. :mod:`asyncio`) που θα διαχειρίζεται το :term:`awaitable` αντικείμενο." -#: reference/datamodel.rst:3348 +#: reference/datamodel.rst:3765 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" +"Το :pep:`492` για πρόσθετες πληροφορίες σχετικά με τα awaitable αντικείμενα." -#: reference/datamodel.rst:3354 +#: reference/datamodel.rst:3771 msgid "Coroutine Objects" -msgstr "" +msgstr "Coroutine Αντικείμενα" -#: reference/datamodel.rst:3356 +#: reference/datamodel.rst:3773 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -3698,19 +6415,33 @@ msgid "" "coroutine raises an exception, it is propagated by the iterator. Coroutines " "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" +"Τα :term:`Coroutine objects ` είναι :term:`awaitable` " +"αντικείμενα. Η εκτέλεση μιας coroutine μπορεί να ελεγχθεί καλώντας το :meth:" +"`~object.__await__` και επαναλαμβάνοντας το αποτέλεσμα. Όταν η coroutine " +"ολοκληρώσει την εκτέλεση και επιστρέψει ο iterator κάνει raise την :exc:" +"`StopIteration`, και το χαρακτηριστικό :attr:`~StopIteration.value` της " +"εξαίρεσης διατηρεί την τιμή επιστροφής. Εάν η coroutine εγείρει μια " +"εξαίρεση, αυτή διαδίδεται από τον iterator. Οι coroutines δεν πρέπει να " +"κάνουν raise ανεξέλεγκτες εξαιρέσεις :exc:`StopIteration`." -#: reference/datamodel.rst:3364 +#: reference/datamodel.rst:3781 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" +"Οι coroutines έχουν επίσης τις μεθόδου που αναφέρονται παρακάτω, οι οποίες " +"είναι ανάλογες με αυτές των γεννητριών (βλ. :ref:`generator-methods`). " +"Ωστόσο, σε αντίθεση με τις γεννήτριες, οι coroutines δεν υποστηρίζουν άμεσα " +"την επανάληψη." -#: reference/datamodel.rst:3368 +#: reference/datamodel.rst:3785 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" +"Είναι ένα :exc:`RuntimeError` να περιμένει κανείς σε μια coroutine " +"περισσότερες από μία φορές." -#: reference/datamodel.rst:3374 +#: reference/datamodel.rst:3791 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -3720,8 +6451,15 @@ msgid "" "exception) is the same as when iterating over the :meth:`!__await__` return " "value, described above." msgstr "" +"Ξεκινά ή συνεχίζει την εκτέλεση της coroutine. Εάν η *τιμή* είναι ``None``, " +"αυτό ισοδυναμεί με την προώθηση του iterator που επιστρέφεται :meth:`~object." +"__await__`. Εάν η *τιμή* δεν είναι ``None``, αυτή η μέθοδος εκχωρεί στη " +"μέθοδο :meth:`~generator.send` του iterator που προκάλεσε την αναστολή της " +"coroutine. Το αποτέλεσμα (επιστρεφόμενη τιμή, :exc:`StopIteration`, ή άλλη " +"εξαίρεση) είναι το ίδιο όπως όταν γίνεται επανάληψη πάνω από την τιμή " +"επιστροφής :meth:`!__await__` , που περιγράφεται παραπάνω." -#: reference/datamodel.rst:3385 +#: reference/datamodel.rst:3802 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -3731,14 +6469,24 @@ msgid "" "meth:`~object.__await__` return value, described above. If the exception is " "not caught in the coroutine, it propagates back to the caller." msgstr "" +"Κάνει Raise την καθορισμένη εξαίρεση στην coroutine. Αυτή η μέθοδος εκχωρεί " +"στη μέθοδο :meth:`~generator.throw` του iterator που προκάλεσε την αναστολή " +"της coroutine, εάν διαθέτει τέτοια μέθοδο. Διαφορετικά, η εξαίρεση γίνεται " +"raise στο σημείο αναστολής. Το αποτέλεσμα (επιστρεφόμενη τιμή, :exc:" +"`StopIteration`, ή άλλη εξαίρεση) είναι το ίδιο όπως όταν γίνεται επανάληψη " +"πάνω από την τιμή επιστροφής :meth:`~object.__await__`, που περιγράφεται " +"παραπάνω. Εάν η εξαίρεση δεν περιλαμβάνεται στην coroutine, διαδίδεται πίσω " +"από εκεί που καλέστηκε." -#: reference/datamodel.rst:3396 +#: reference/datamodel.rst:3813 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" +"Η δεύτερη υπογραφή \\(type\\[, value\\[, traceback\\]\\]\\) έχει καταργηθεί " +"και μπορεί να αφαιρεθεί σε μια μελλοντική έκδοση της Python." -#: reference/datamodel.rst:3401 +#: reference/datamodel.rst:3818 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -3747,1039 +6495,1195 @@ msgid "" "causing the coroutine to immediately clean itself up. Finally, the coroutine " "is marked as having finished executing, even if it was never started." msgstr "" +"Προκαλεί τον καθαρισμό και την έξοδο της coroutine. Εάν η coroutine τεθεί " +"σε αναστολή, αυτή η μέθοδος εκχωρεί πρώτα στην μέθοδο :meth:`~generator." +"close` του iterator που προκάλεσε την αναστολή της coroutine, εάν έχει " +"τέτοια μέθοδο. Στη συνέχεια, σηκώνει το :exc:`GeneratorExit` στο σημείο " +"αναστολής, με αποτέλεσμα η coroutine να καθαριστεί αμέσως. Τέλος, η " +"coroutine επισημαίνεται ότι έχει τελειώσει την εκτέλεση, ακόμα κι αν δεν " +"ξεκίνησε ποτέ." -#: reference/datamodel.rst:3409 +#: reference/datamodel.rst:3826 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" +"Τα αντικείμενα coroutine κλείνουν αυτόματα χρησιμοποιώντας την παραπάνω " +"διαδικασία όταν πρόκειται να καταστραφούν." -#: reference/datamodel.rst:3415 +#: reference/datamodel.rst:3832 msgid "Asynchronous Iterators" -msgstr "" +msgstr "Ασύγχρονοι Iterators" -#: reference/datamodel.rst:3417 +#: reference/datamodel.rst:3834 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" +"Ένας *ασύγχρονος iterator* μπορεί να καλέσει ασύγχρονο κώδικα με τη μέθοδο " +"``__anext__``." -#: reference/datamodel.rst:3420 +#: reference/datamodel.rst:3837 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" +"Οι ασύγχρονοι iterators μπορούν να χρησιμοποιηθούν σε μια δήλωση :keyword:" +"`async for`." + +#: reference/datamodel.rst:3888 +msgid "The :class:`object` class itself does not provide these methods." +msgstr "Η ίδια η κλάση :class:`object` δεν παρέχει αυτές τις μεθόδους." -#: reference/datamodel.rst:3424 +#: reference/datamodel.rst:3844 msgid "Must return an *asynchronous iterator* object." -msgstr "" +msgstr "Πρέπει να επιστρέψει ένα αντικείμενο *ασύγχρονου iterator*." -#: reference/datamodel.rst:3428 +#: reference/datamodel.rst:3848 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" +"Πρέπει να επιστρέψει ένα *αναμενόμενο* που θα έχει ως αποτέλεσμα μια επόμενη " +"τιμή iterator. Θα πρέπει να κάνει raise ένα σφάλμα :exc:" +"`StopAsyncIteration` όταν τελειώσει η επανάληψη." -#: reference/datamodel.rst:3431 +#: reference/datamodel.rst:3851 msgid "An example of an asynchronous iterable object::" -msgstr "" - -#: reference/datamodel.rst:3448 +msgstr "Παράδειγμα σύγχρονου iterator αντικειμένου::" + +#: reference/datamodel.rst:3853 +msgid "" +"class Reader:\n" +" async def readline(self):\n" +" ...\n" +"\n" +" def __aiter__(self):\n" +" return self\n" +"\n" +" async def __anext__(self):\n" +" val = await self.readline()\n" +" if val == b'':\n" +" raise StopAsyncIteration\n" +" return val" +msgstr "" +"class Reader:\n" +" async def readline(self):\n" +" ...\n" +"\n" +" def __aiter__(self):\n" +" return self\n" +"\n" +" async def __anext__(self):\n" +" val = await self.readline()\n" +" if val == b'':\n" +" raise StopAsyncIteration\n" +" return val" + +#: reference/datamodel.rst:3868 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" +"Πριν από την Python 3.7, η :meth:`~object.__aiter__` θα μπορούσε να " +"επιστρέψει ένα *αναμενόμενο* που θα επιλύονται σε ένα :term:`asynchronous " +"iterator `." -#: reference/datamodel.rst:3453 +#: reference/datamodel.rst:3873 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" +"Ξεκινώντας με την Python 3.7, η :meth:`~object.__aiter__` πρέπει να " +"επιστρέψει ένα ασύγχρονο αντικείμενο iterator. Εάν επιστρέφει οτιδήποτε " +"άλλο θα έχει ως αποτέλεσμα ένα σφάλμα :exc:`TypeError`." -#: reference/datamodel.rst:3461 +#: reference/datamodel.rst:3881 msgid "Asynchronous Context Managers" -msgstr "" +msgstr "Ασύγχρονοι Διαχειριστές Περιβάλλοντος" -#: reference/datamodel.rst:3463 +#: reference/datamodel.rst:3883 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" +"Ένας *ασύγχρονος διαχειριστής περιβάλλοντος* είναι ένα *διαχειριστής " +"περιβάλλοντος* που μπορεί να αναστείλει την εκτέλεση στις μεθόδους " +"``__aenter__`` και ``__aexit__``." -#: reference/datamodel.rst:3466 +#: reference/datamodel.rst:3886 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" +"Οι ασύγχρονοι διαχειριστές περιβάλλοντος μπορούν να χρησιμοποιηθούν σε μια " +"δήλωση :keyword:`async with`." -#: reference/datamodel.rst:3470 +#: reference/datamodel.rst:3892 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" +"Σημασιολογικά παρόμοια με :meth:`~object.__enter__`, η μόνη διαφορά είναι " +"ότι πρέπει να επιστρέψει ένα *awaitable*." -#: reference/datamodel.rst:3475 +#: reference/datamodel.rst:3897 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" +"Σημασιολογικά παρόμοια με :meth:`~object.__exit__`, η μόνη διαφορά είναι ότι " +"πρέπει να επιστρέψει ένα *awaitable*." -#: reference/datamodel.rst:3478 +#: reference/datamodel.rst:3900 msgid "An example of an asynchronous context manager class::" +msgstr "Ένα παράδειγμα κλάσης ασύγχρονης διαχείρισης περιβάλλοντος::" + +#: reference/datamodel.rst:3902 +msgid "" +"class AsyncContextManager:\n" +" async def __aenter__(self):\n" +" await log('entering context')\n" +"\n" +" async def __aexit__(self, exc_type, exc, tb):\n" +" await log('exiting context')" msgstr "" +"class AsyncContextManager:\n" +" async def __aenter__(self):\n" +" await log('entering context')\n" +"\n" +" async def __aexit__(self, exc_type, exc, tb):\n" +" await log('exiting context')" -#: reference/datamodel.rst:3491 +#: reference/datamodel.rst:3913 msgid "Footnotes" -msgstr "" +msgstr "Υποσημειώσεις" -#: reference/datamodel.rst:3492 +#: reference/datamodel.rst:3914 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" +"Αυτό *είναι* δυνατό σε ορισμένες περιπτώσεις να αλλάξει ο τύπος ενός " +"αντικειμένου, υπό ορισμένες ελεγχόμενες συνθήκες. Γενικά δεν είναι καλή ιδέα " +"όμως, καθώς μπορεί να οδηγήσει σε κάποια πολύ περίεργη συμπεριφορά εάν γίνει " +"λάθος χειρισμός." -#: reference/datamodel.rst:3496 +#: reference/datamodel.rst:3918 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." -"__reversed__`, and :meth:`~object.__contains__` methods have special " -"handling for this; others will still raise a :exc:`TypeError`, but may do so " +"__reversed__`, :meth:`~object.__contains__`, :meth:`~object." +"__class_getitem__` and :meth:`~os.PathLike.__fspath__` methods have special " +"handling for this. Others will still raise a :exc:`TypeError`, but may do so " "by relying on the behavior that ``None`` is not callable." msgstr "" +"Οι μέθοδοι :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:" +"`~object.__reversed__`, :meth:`~object.__contains__`, :meth:`~object." +"__class_getitem__` και :meth:`~os.PathLike.__fspath__` έχουν ειδικό χειρισμό " +"για αυτό. Άλλες θα εξακολουθούν να κάνουν raise ένα :exc:`TypeError`, αλλά " +"μπορεί να το κάνουν με την αξιοποίηση της συμπεριφοράς ότι το ``None`` δεν " +"είναι καλούμενο." -#: reference/datamodel.rst:3502 +#: reference/datamodel.rst:3925 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " "you want to force fallback to the right operand's reflected method—that will " "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" +"Το \"Δεν υποστηρίζει\" εδώ σημαίνει ότι η κλάση δεν έχει τέτοια μέθοδο ή η " +"μέθοδος επιστρέφει :data:`NotImplemented`. Μην ορίσετε τη μέθοδο σε " +"``None`` εάν θέλετε να αναγκάσετε την επιστροφή στη μέθοδο ανακλώμενης του " +"δεξιού τελεστή-αυτό θα έχει το αντίθετο αποτέλεσμα του ρητού " +"*μπλοκαρίσματος* αυτού του εναλλακτικού." -#: reference/datamodel.rst:3508 +#: reference/datamodel.rst:3931 msgid "" "For operands of the same type, it is assumed that if the non-reflected " -"method -- such as :meth:`~object.__add__` -- fails then the overall " -"operation is not supported, which is why the reflected method is not called." -msgstr "" - -#: reference/datamodel.rst:148 reference/datamodel.rst:180 -#: reference/datamodel.rst:225 reference/datamodel.rst:261 -#: reference/datamodel.rst:292 reference/datamodel.rst:356 -#: reference/datamodel.rst:402 reference/datamodel.rst:440 -#: reference/datamodel.rst:459 reference/datamodel.rst:512 -#: reference/datamodel.rst:654 reference/datamodel.rst:823 -#: reference/datamodel.rst:938 reference/datamodel.rst:1034 -#: reference/datamodel.rst:1200 reference/datamodel.rst:1407 -#: reference/datamodel.rst:2834 -msgid "object" +"method (such as :meth:`~object.__add__`) fails then the operation is not " +"supported, which is why the reflected method is not called." +msgstr "" +"Για τελεστές του ίδιου τύπου, θεωρείται ότι εάν η μη ανακλώμενη μέθοδος " +"(όπως :meth:`~object.__add__`) αποτύχει τότε η λειτουργία δεν υποστηρίζεται, " +"γι' αυτό δεν καλείται η ανακλώμενη μέθοδος." + +#: reference/datamodel.rst:3935 +msgid "" +"If the right operand's type is a subclass of the left operand's type, the " +"reflected method having precedence allows subclasses to override their " +"ancestors' operations." msgstr "" +"Εάν ο τύπος του δεξιού τελεστή είναι υποκλάση του τύπου του αριστερού " +"τελεστή, η προτεραιότητα της ανακλώμενης μεθόδου επιτρέπει στις υποκλάσεις " +"να υπερισχύουν των λειτουργιών των προγόνων τους." + +#: reference/datamodel.rst:148 reference/datamodel.rst:183 +#: reference/datamodel.rst:228 reference/datamodel.rst:266 +#: reference/datamodel.rst:297 reference/datamodel.rst:364 +#: reference/datamodel.rst:410 reference/datamodel.rst:448 +#: reference/datamodel.rst:467 reference/datamodel.rst:520 +#: reference/datamodel.rst:673 reference/datamodel.rst:835 +#: reference/datamodel.rst:1149 reference/datamodel.rst:1344 +#: reference/datamodel.rst:1524 reference/datamodel.rst:1749 +#: reference/datamodel.rst:3201 +msgid "object" +msgstr "αντικείμενο" #: reference/datamodel.rst:122 msgid "data" -msgstr "" +msgstr "δεδομένα" -#: reference/datamodel.rst:292 reference/datamodel.rst:420 -#: reference/datamodel.rst:799 reference/datamodel.rst:1490 -#: reference/datamodel.rst:1735 reference/datamodel.rst:2375 -#: reference/datamodel.rst:2962 reference/datamodel.rst:3011 -#: reference/datamodel.rst:3070 reference/datamodel.rst:3098 +#: reference/datamodel.rst:297 reference/datamodel.rst:428 +#: reference/datamodel.rst:811 reference/datamodel.rst:1832 +#: reference/datamodel.rst:2081 reference/datamodel.rst:2736 +#: reference/datamodel.rst:3329 reference/datamodel.rst:3432 +#: reference/datamodel.rst:3470 msgid "built-in function" -msgstr "" +msgstr "ενσωματωμένη συνάρτηση" -#: reference/datamodel.rst:23 +#: reference/datamodel.rst:22 msgid "id" -msgstr "" +msgstr "αναγνωριστικό" -#: reference/datamodel.rst:122 reference/datamodel.rst:2375 +#: reference/datamodel.rst:122 reference/datamodel.rst:2736 msgid "type" -msgstr "" +msgstr "τύπος" -#: reference/datamodel.rst:23 +#: reference/datamodel.rst:22 msgid "identity of an object" -msgstr "" +msgstr "ταυτότητα ενός αντικειμένου" -#: reference/datamodel.rst:23 +#: reference/datamodel.rst:22 msgid "value of an object" -msgstr "" +msgstr "τιμή ενός αντικειμένου" -#: reference/datamodel.rst:23 +#: reference/datamodel.rst:22 msgid "type of an object" -msgstr "" +msgstr "τύπος ενός αντικειμένου" -#: reference/datamodel.rst:23 +#: reference/datamodel.rst:22 msgid "mutable object" -msgstr "" +msgstr "ευμετάβλητο αντικείμενο" -#: reference/datamodel.rst:23 +#: reference/datamodel.rst:22 msgid "immutable object" -msgstr "" +msgstr "αμετάβλητο αντικείμενο" -#: reference/datamodel.rst:60 +#: reference/datamodel.rst:56 msgid "garbage collection" -msgstr "" +msgstr "συλλογή σκουπιδιών" -#: reference/datamodel.rst:60 +#: reference/datamodel.rst:56 msgid "reference counting" -msgstr "" +msgstr "καταμέτρηση αναφοράς" -#: reference/datamodel.rst:60 +#: reference/datamodel.rst:56 msgid "unreachable object" -msgstr "" +msgstr "απρόσιτο αντικείμενο" -#: reference/datamodel.rst:938 +#: reference/datamodel.rst:1149 msgid "container" -msgstr "" +msgstr "κοντέινερ" #: reference/datamodel.rst:122 msgid "hierarchy" -msgstr "" +msgstr "ιεραρχία" #: reference/datamodel.rst:122 msgid "extension" -msgstr "" +msgstr "επέκταση" -#: reference/datamodel.rst:393 reference/datamodel.rst:495 -#: reference/datamodel.rst:876 reference/datamodel.rst:1053 +#: reference/datamodel.rst:401 reference/datamodel.rst:503 +#: reference/datamodel.rst:891 reference/datamodel.rst:1373 msgid "module" -msgstr "" +msgstr "module" -#: reference/datamodel.rst:261 reference/datamodel.rst:799 +#: reference/datamodel.rst:266 reference/datamodel.rst:811 msgid "C" -msgstr "" +msgstr "C" -#: reference/datamodel.rst:261 reference/datamodel.rst:799 +#: reference/datamodel.rst:266 reference/datamodel.rst:811 msgid "language" -msgstr "" +msgstr "γλώσσα" -#: reference/datamodel.rst:938 reference/datamodel.rst:1007 -#: reference/datamodel.rst:1027 +#: reference/datamodel.rst:1149 reference/datamodel.rst:1317 +#: reference/datamodel.rst:1337 msgid "attribute" -msgstr "" +msgstr "χαρακτηριστικό" #: reference/datamodel.rst:135 msgid "special" -msgstr "" +msgstr "ειδικό" #: reference/datamodel.rst:135 msgid "generic" -msgstr "" +msgstr "γενικό" -#: reference/datamodel.rst:180 +#: reference/datamodel.rst:183 msgid "..." -msgstr "" +msgstr "..." -#: reference/datamodel.rst:180 +#: reference/datamodel.rst:183 msgid "ellipsis literal" -msgstr "" +msgstr "ellipsis literal" -#: reference/datamodel.rst:1034 +#: reference/datamodel.rst:1344 msgid "numeric" -msgstr "" +msgstr "αριθμητικό" -#: reference/datamodel.rst:231 reference/datamodel.rst:336 +#: reference/datamodel.rst:234 reference/datamodel.rst:344 msgid "integer" -msgstr "" +msgstr "ακέραιος" -#: reference/datamodel.rst:231 +#: reference/datamodel.rst:234 msgid "representation" -msgstr "" +msgstr "αναπαράσταση" -#: reference/datamodel.rst:246 +#: reference/datamodel.rst:249 msgid "Boolean" -msgstr "" +msgstr "Boolean" -#: reference/datamodel.rst:246 +#: reference/datamodel.rst:249 msgid "False" -msgstr "" +msgstr "False" -#: reference/datamodel.rst:246 +#: reference/datamodel.rst:249 msgid "True" -msgstr "" +msgstr "True" -#: reference/datamodel.rst:261 -msgid "floating point" -msgstr "" +#: reference/datamodel.rst:266 +msgid "floating-point" +msgstr "κινητής υποδιαστολής" -#: reference/datamodel.rst:279 +#: reference/datamodel.rst:284 msgid "number" -msgstr "" +msgstr "αριθμός" -#: reference/datamodel.rst:261 +#: reference/datamodel.rst:266 msgid "Java" -msgstr "" +msgstr "Java" -#: reference/datamodel.rst:3070 +#: reference/datamodel.rst:3442 msgid "complex" -msgstr "" +msgstr "complex" -#: reference/datamodel.rst:420 reference/datamodel.rst:2804 +#: reference/datamodel.rst:428 reference/datamodel.rst:3171 msgid "len" -msgstr "" +msgstr "len" -#: reference/datamodel.rst:1034 +#: reference/datamodel.rst:1344 msgid "sequence" -msgstr "" +msgstr "ακολουθία" -#: reference/datamodel.rst:292 +#: reference/datamodel.rst:297 msgid "index operation" -msgstr "" +msgstr "λειτουργία ευρετηρίου" -#: reference/datamodel.rst:292 +#: reference/datamodel.rst:297 msgid "item selection" -msgstr "" +msgstr "επιλογή αντικειμένου" -#: reference/datamodel.rst:381 reference/datamodel.rst:459 +#: reference/datamodel.rst:389 reference/datamodel.rst:467 msgid "subscription" -msgstr "" +msgstr "εγγραφή" -#: reference/datamodel.rst:381 +#: reference/datamodel.rst:389 msgid "slicing" -msgstr "" +msgstr "τμηματοποίηση" -#: reference/datamodel.rst:321 +#: reference/datamodel.rst:329 msgid "immutable sequence" -msgstr "" +msgstr "αμετάβλητη ακολουθία" -#: reference/datamodel.rst:321 +#: reference/datamodel.rst:329 msgid "immutable" -msgstr "" +msgstr "αμετάβλητο" -#: reference/datamodel.rst:1705 reference/datamodel.rst:1735 +#: reference/datamodel.rst:2050 reference/datamodel.rst:2081 msgid "string" -msgstr "" +msgstr "συμβολοσειρά" -#: reference/datamodel.rst:332 +#: reference/datamodel.rst:340 msgid "immutable sequences" -msgstr "" +msgstr "αμετάβλητες ακολουθίες" -#: reference/datamodel.rst:336 +#: reference/datamodel.rst:344 msgid "chr" -msgstr "" +msgstr "chr" -#: reference/datamodel.rst:336 +#: reference/datamodel.rst:344 msgid "ord" -msgstr "" +msgstr "ord" -#: reference/datamodel.rst:336 +#: reference/datamodel.rst:344 msgid "character" -msgstr "" +msgstr "χαρακτήρας" -#: reference/datamodel.rst:336 +#: reference/datamodel.rst:344 msgid "Unicode" -msgstr "" +msgstr "Unicode" -#: reference/datamodel.rst:356 +#: reference/datamodel.rst:364 msgid "tuple" -msgstr "" +msgstr "πλειάδα" -#: reference/datamodel.rst:356 +#: reference/datamodel.rst:364 msgid "singleton" -msgstr "" +msgstr "singleton" -#: reference/datamodel.rst:356 +#: reference/datamodel.rst:364 msgid "empty" -msgstr "" +msgstr "empty" -#: reference/datamodel.rst:1730 +#: reference/datamodel.rst:2075 msgid "bytes" -msgstr "" +msgstr "bytes" -#: reference/datamodel.rst:369 +#: reference/datamodel.rst:377 msgid "byte" -msgstr "" +msgstr "byte" -#: reference/datamodel.rst:381 +#: reference/datamodel.rst:389 msgid "mutable sequence" -msgstr "" +msgstr "ευμετάβλητη ακολουθία" -#: reference/datamodel.rst:381 +#: reference/datamodel.rst:389 msgid "mutable" -msgstr "" +msgstr "ευμετάβλητο" -#: reference/datamodel.rst:956 reference/datamodel.rst:1027 +#: reference/datamodel.rst:1167 reference/datamodel.rst:1337 msgid "assignment" -msgstr "" +msgstr "εκχώρηση" -#: reference/datamodel.rst:856 reference/datamodel.rst:1626 -#: reference/datamodel.rst:3125 +#: reference/datamodel.rst:871 reference/datamodel.rst:1968 +#: reference/datamodel.rst:3494 msgid "statement" -msgstr "" +msgstr "δήλωση" -#: reference/datamodel.rst:393 +#: reference/datamodel.rst:401 msgid "array" -msgstr "" +msgstr "πίνακας" -#: reference/datamodel.rst:394 +#: reference/datamodel.rst:402 msgid "collections" -msgstr "" +msgstr "συλλογές" -#: reference/datamodel.rst:402 +#: reference/datamodel.rst:410 msgid "list" -msgstr "" +msgstr "λίστα" -#: reference/datamodel.rst:409 +#: reference/datamodel.rst:417 msgid "bytearray" -msgstr "" +msgstr "πίνακας byte" -#: reference/datamodel.rst:420 +#: reference/datamodel.rst:428 msgid "set type" -msgstr "" +msgstr "τύπος συνόλου" -#: reference/datamodel.rst:440 +#: reference/datamodel.rst:448 msgid "set" -msgstr "" +msgstr "σύνολο" -#: reference/datamodel.rst:448 +#: reference/datamodel.rst:456 msgid "frozenset" -msgstr "" +msgstr "αμετάβλητο σύνολο" -#: reference/datamodel.rst:1034 +#: reference/datamodel.rst:1344 msgid "mapping" -msgstr "" +msgstr "αντιστοίχιση" -#: reference/datamodel.rst:938 reference/datamodel.rst:1819 +#: reference/datamodel.rst:1149 reference/datamodel.rst:2174 msgid "dictionary" -msgstr "" +msgstr "λεξικό" -#: reference/datamodel.rst:495 +#: reference/datamodel.rst:503 msgid "dbm.ndbm" -msgstr "" +msgstr "dbm.ndbm" -#: reference/datamodel.rst:495 +#: reference/datamodel.rst:503 msgid "dbm.gnu" -msgstr "" +msgstr "dbm.gnu" -#: reference/datamodel.rst:512 +#: reference/datamodel.rst:520 msgid "callable" -msgstr "" +msgstr "με δυνατότητα κλήσης" -#: reference/datamodel.rst:527 reference/datamodel.rst:761 -#: reference/datamodel.rst:799 +#: reference/datamodel.rst:535 reference/datamodel.rst:773 +#: reference/datamodel.rst:811 msgid "function" -msgstr "" +msgstr "συνάρτηση" -#: reference/datamodel.rst:938 reference/datamodel.rst:2756 +#: reference/datamodel.rst:1149 reference/datamodel.rst:3117 msgid "call" -msgstr "" +msgstr "κλήση" -#: reference/datamodel.rst:512 +#: reference/datamodel.rst:520 msgid "invocation" -msgstr "" +msgstr "εκτέλεση" -#: reference/datamodel.rst:512 +#: reference/datamodel.rst:520 msgid "argument" -msgstr "" +msgstr "παράμετρος" -#: reference/datamodel.rst:654 +#: reference/datamodel.rst:673 msgid "user-defined" -msgstr "" +msgstr "ορισμένο από τον χρήστη" -#: reference/datamodel.rst:527 +#: reference/datamodel.rst:535 msgid "user-defined function" -msgstr "" +msgstr "συνάρτηση ορισμένη από τον χρήστη" -#: reference/datamodel.rst:540 +#: reference/datamodel.rst:548 msgid "__closure__ (function attribute)" -msgstr "" +msgstr "__closure__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:540 +#: reference/datamodel.rst:548 msgid "__globals__ (function attribute)" -msgstr "" +msgstr "__globals__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:540 +#: reference/datamodel.rst:548 msgid "global" -msgstr "" +msgstr "global" -#: reference/datamodel.rst:876 +#: reference/datamodel.rst:891 msgid "namespace" -msgstr "" +msgstr "πεδίο ονομάτων" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 msgid "__doc__ (function attribute)" -msgstr "" +msgstr "__doc__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 msgid "__name__ (function attribute)" -msgstr "" +msgstr "__name__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 msgid "__module__ (function attribute)" -msgstr "" +msgstr "__module__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 msgid "__dict__ (function attribute)" -msgstr "" +msgstr "__dict__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 msgid "__defaults__ (function attribute)" -msgstr "" +msgstr "__defaults__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 msgid "__code__ (function attribute)" -msgstr "" +msgstr "__code__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 msgid "__annotations__ (function attribute)" -msgstr "" +msgstr "__annotations__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 +msgid "__annotate__ (function attribute)" +msgstr "__annotate__ (χαρακτηριστικό συνάρτησης)" + +#: reference/datamodel.rst:575 msgid "__kwdefaults__ (function attribute)" -msgstr "" +msgstr "__kwdefaults__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:566 +#: reference/datamodel.rst:575 msgid "__type_params__ (function attribute)" -msgstr "" +msgstr "__type_params__ (χαρακτηριστικό συνάρτησης)" -#: reference/datamodel.rst:823 +#: reference/datamodel.rst:835 msgid "method" -msgstr "" +msgstr "μέθοδος" -#: reference/datamodel.rst:654 +#: reference/datamodel.rst:673 msgid "user-defined method" -msgstr "" +msgstr "μέθοδος ορισμένη από τον χρήστη" -#: reference/datamodel.rst:662 +#: reference/datamodel.rst:681 msgid "__func__ (method attribute)" -msgstr "" +msgstr "__func__ (χαρακτηριστικό μεθόδου)" -#: reference/datamodel.rst:662 +#: reference/datamodel.rst:681 msgid "__self__ (method attribute)" -msgstr "" +msgstr "__self__ (χαρακτηριστικό μεθόδου)" -#: reference/datamodel.rst:662 +#: reference/datamodel.rst:681 msgid "__doc__ (method attribute)" -msgstr "" +msgstr "__doc__ (χαρακτηριστικό μεθόδου)" -#: reference/datamodel.rst:662 +#: reference/datamodel.rst:681 msgid "__name__ (method attribute)" -msgstr "" +msgstr "__name__ (χαρακτηριστικό μεθόδου)" -#: reference/datamodel.rst:662 +#: reference/datamodel.rst:681 msgid "__module__ (method attribute)" -msgstr "" +msgstr "__module__ (χαρακτηριστικό μεθόδου)" -#: reference/datamodel.rst:1200 +#: reference/datamodel.rst:1524 msgid "generator" -msgstr "" +msgstr "γεννήτρια" -#: reference/datamodel.rst:743 +#: reference/datamodel.rst:755 msgid "iterator" -msgstr "" +msgstr "iterator" -#: reference/datamodel.rst:3312 +#: reference/datamodel.rst:3727 msgid "coroutine" -msgstr "" +msgstr "coroutine" -#: reference/datamodel.rst:774 +#: reference/datamodel.rst:786 msgid "asynchronous generator" -msgstr "" +msgstr "ασύγχρονη γεννήτρια" -#: reference/datamodel.rst:774 +#: reference/datamodel.rst:786 msgid "asynchronous iterator" -msgstr "" +msgstr "ασύγχρονος iterator" -#: reference/datamodel.rst:823 +#: reference/datamodel.rst:835 msgid "built-in method" -msgstr "" +msgstr "ενσωματωμένη μέθοδος" -#: reference/datamodel.rst:823 +#: reference/datamodel.rst:835 msgid "built-in" -msgstr "" +msgstr "built-in" -#: reference/datamodel.rst:856 +#: reference/datamodel.rst:871 msgid "import" -msgstr "" +msgstr "import" -#: reference/datamodel.rst:876 +#: reference/datamodel.rst:891 msgid "__name__ (module attribute)" -msgstr "" +msgstr "__name__ (χαρακτηριστικό module)" -#: reference/datamodel.rst:876 -msgid "__doc__ (module attribute)" -msgstr "" +#: reference/datamodel.rst:891 +msgid "__spec__ (module attribute)" +msgstr "__spec__ (χαρακτηριστικό module)" -#: reference/datamodel.rst:876 +#: reference/datamodel.rst:891 +msgid "__package__ (module attribute)" +msgstr "__package__ (χαρακτηριστικό module)" + +#: reference/datamodel.rst:891 +msgid "__loader__ (module attribute)" +msgstr "__loader__ (χαρακτηριστικό module)" + +#: reference/datamodel.rst:891 +msgid "__path__ (module attribute)" +msgstr "__path__ (χαρακτηριστικό module)" + +#: reference/datamodel.rst:891 msgid "__file__ (module attribute)" -msgstr "" +msgstr "__file__ (χαρακτηριστικό module)" + +#: reference/datamodel.rst:891 +msgid "__cached__ (module attribute)" +msgstr "__cached__ (χαρακτηριστικό module)" + +#: reference/datamodel.rst:891 +msgid "__doc__ (module attribute)" +msgstr "__doc__ (χαρακτηριστικό module)" -#: reference/datamodel.rst:876 +#: reference/datamodel.rst:891 msgid "__annotations__ (module attribute)" -msgstr "" +msgstr "__annotations__ (χαρακτηριστικό module)" -#: reference/datamodel.rst:907 +#: reference/datamodel.rst:891 +msgid "__annotate__ (module attribute)" +msgstr "__annotate__ (χαρακτηριστικό module)" + +#: reference/datamodel.rst:1117 msgid "__dict__ (module attribute)" -msgstr "" +msgstr "__dict__ (χαρακτηριστικό module)" -#: reference/datamodel.rst:956 reference/datamodel.rst:1609 -#: reference/datamodel.rst:2486 +#: reference/datamodel.rst:1167 reference/datamodel.rst:1951 +#: reference/datamodel.rst:2847 msgid "class" -msgstr "" +msgstr "κλάση" -#: reference/datamodel.rst:1007 reference/datamodel.rst:1027 +#: reference/datamodel.rst:1317 reference/datamodel.rst:1337 msgid "class instance" -msgstr "" +msgstr "στιγμιότυπο κλάσης" -#: reference/datamodel.rst:1007 reference/datamodel.rst:2756 +#: reference/datamodel.rst:1317 reference/datamodel.rst:3117 msgid "instance" -msgstr "" +msgstr "στιγμιότυπο" -#: reference/datamodel.rst:961 +#: reference/datamodel.rst:1172 msgid "class object" -msgstr "" +msgstr "αντικείμενα κλάσης" -#: reference/datamodel.rst:965 +#: reference/datamodel.rst:1179 msgid "__name__ (class attribute)" -msgstr "" +msgstr "__name__ (χαρακτηριστικό κλάσης)" -#: reference/datamodel.rst:965 +#: reference/datamodel.rst:1179 msgid "__module__ (class attribute)" -msgstr "" +msgstr "__module__ (χαρακτηριστικό κλάσης)" -#: reference/datamodel.rst:965 +#: reference/datamodel.rst:1179 msgid "__dict__ (class attribute)" -msgstr "" +msgstr "__dict__ (χαρακτηριστικό κλάσης)" -#: reference/datamodel.rst:965 +#: reference/datamodel.rst:1179 msgid "__bases__ (class attribute)" -msgstr "" +msgstr "__bases__ (χαρακτηριστικό κλάσης)" -#: reference/datamodel.rst:965 +#: reference/datamodel.rst:1179 +msgid "__base__ (class attribute)" +msgstr "__base__ (χαρακτηριστικό κλάσης)" + +#: reference/datamodel.rst:1179 msgid "__doc__ (class attribute)" -msgstr "" +msgstr "__doc__ (χαρακτηριστικό κλάσης)" -#: reference/datamodel.rst:965 +#: reference/datamodel.rst:1179 msgid "__annotations__ (class attribute)" -msgstr "" +msgstr "__annotations__ (χαρακτηριστικό κλάσης)" -#: reference/datamodel.rst:965 +#: reference/datamodel.rst:1179 +msgid "__annotate__ (class attribute)" +msgstr "__annotate__ (χαρακτηριστικό κλάσης)" + +#: reference/datamodel.rst:1179 msgid "__type_params__ (class attribute)" -msgstr "" +msgstr "__type_params__ (χαρακτηριστικό κλάσης)" -#: reference/datamodel.rst:1042 +#: reference/datamodel.rst:1179 +msgid "__static_attributes__ (class attribute)" +msgstr "__static_attributes__ (χαρακτηριστικό κλάσης)" + +#: reference/datamodel.rst:1179 +msgid "__firstlineno__ (class attribute)" +msgstr "__firstlineno__ (χαρακτηριστικό κλάσης)" + +#: reference/datamodel.rst:1355 msgid "__dict__ (instance attribute)" -msgstr "" +msgstr "__dict__ (χαρακτηριστικό στιγμιοτύπου)" -#: reference/datamodel.rst:1042 +#: reference/datamodel.rst:1355 msgid "__class__ (instance attribute)" -msgstr "" +msgstr "__class__ (χαρακτηριστικό στιγμιοτύπου)" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "open" -msgstr "" +msgstr "open" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "io" -msgstr "" +msgstr "io" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "popen() (in module os)" -msgstr "" +msgstr "popen() (στο module os)" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "makefile() (socket method)" -msgstr "" +msgstr "makefile() (μέθοδος socket)" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "sys.stdin" -msgstr "" +msgstr "sys.stdin" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "sys.stdout" -msgstr "" +msgstr "sys.stdout" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "sys.stderr" -msgstr "" +msgstr "sys.stderr" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "stdio" -msgstr "" +msgstr "stdio" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "stdin (in module sys)" -msgstr "" +msgstr "stdin (στο module sys)" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "stdout (in module sys)" -msgstr "" +msgstr "stdout (στο module sys)" -#: reference/datamodel.rst:1053 +#: reference/datamodel.rst:1373 msgid "stderr (in module sys)" -msgstr "" +msgstr "stderr (στο module sys)" -#: reference/datamodel.rst:1082 +#: reference/datamodel.rst:1402 msgid "internal type" -msgstr "" +msgstr "εσωτερικός τύπος" -#: reference/datamodel.rst:1082 +#: reference/datamodel.rst:1402 msgid "types, internal" -msgstr "" +msgstr "τύποι, εσωτερικό" -#: reference/datamodel.rst:1096 +#: reference/datamodel.rst:1416 msgid "bytecode" -msgstr "" +msgstr "bytecode" -#: reference/datamodel.rst:1096 +#: reference/datamodel.rst:1416 msgid "code" -msgstr "" +msgstr "code" -#: reference/datamodel.rst:1096 +#: reference/datamodel.rst:1416 msgid "code object" -msgstr "" +msgstr "code object" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_argcount (code object attribute)" -msgstr "" +msgstr "co_argcount (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_posonlyargcount (code object attribute)" -msgstr "" +msgstr "co_posonlyargcount (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_kwonlyargcount (code object attribute)" -msgstr "" +msgstr "co_kwonlyargcount (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_code (code object attribute)" -msgstr "" +msgstr "co_code (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_consts (code object attribute)" -msgstr "" +msgstr "co_consts (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_filename (code object attribute)" -msgstr "" +msgstr "co_filename (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_firstlineno (code object attribute)" -msgstr "" +msgstr "co_firstlineno (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_flags (code object attribute)" -msgstr "" +msgstr "co_flags (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_lnotab (code object attribute)" -msgstr "" +msgstr "co_lnotab (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_name (code object attribute)" -msgstr "" +msgstr "co_name (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_names (code object attribute)" -msgstr "" +msgstr "co_names (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_nlocals (code object attribute)" -msgstr "" +msgstr "co_nlocals (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_stacksize (code object attribute)" -msgstr "" +msgstr "co_stacksize (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_varnames (code object attribute)" -msgstr "" +msgstr "co_varnames (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_cellvars (code object attribute)" -msgstr "" +msgstr "co_cellvars (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_freevars (code object attribute)" -msgstr "" +msgstr "co_freevars (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1107 +#: reference/datamodel.rst:1427 msgid "co_qualname (code object attribute)" -msgstr "" +msgstr "co_qualname (χαρακτηριστικό code object)" -#: reference/datamodel.rst:1218 +#: reference/datamodel.rst:1540 msgid "documentation string" -msgstr "" +msgstr "κείμενο τεκμηρίωσης" -#: reference/datamodel.rst:1307 +#: reference/datamodel.rst:1632 msgid "frame" -msgstr "" +msgstr "frame" -#: reference/datamodel.rst:1313 +#: reference/datamodel.rst:1638 msgid "f_back (frame attribute)" -msgstr "" +msgstr "f_back (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1313 +#: reference/datamodel.rst:1638 msgid "f_code (frame attribute)" -msgstr "" +msgstr "f_code (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1313 +#: reference/datamodel.rst:1638 msgid "f_globals (frame attribute)" -msgstr "" +msgstr "f_globals (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1313 +#: reference/datamodel.rst:1638 msgid "f_locals (frame attribute)" -msgstr "" +msgstr "f_locals (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1313 +#: reference/datamodel.rst:1638 msgid "f_lasti (frame attribute)" -msgstr "" +msgstr "f_lasti (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1313 +#: reference/datamodel.rst:1638 msgid "f_builtins (frame attribute)" -msgstr "" +msgstr "f_builtins (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1352 +#: reference/datamodel.rst:1638 +msgid "f_generator (frame attribute)" +msgstr "f_generator (χαρακτηριστικό frame)" + +#: reference/datamodel.rst:1689 msgid "f_trace (frame attribute)" -msgstr "" +msgstr "f_trace (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1352 +#: reference/datamodel.rst:1689 msgid "f_trace_lines (frame attribute)" -msgstr "" +msgstr "f_trace_lines (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1352 +#: reference/datamodel.rst:1689 msgid "f_trace_opcodes (frame attribute)" -msgstr "" +msgstr "f_trace_opcodes (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1352 +#: reference/datamodel.rst:1689 msgid "f_lineno (frame attribute)" -msgstr "" +msgstr "f_lineno (χαρακτηριστικό frame)" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "traceback" -msgstr "" +msgstr "traceback" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "stack" -msgstr "" +msgstr "stack" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "trace" -msgstr "" +msgstr "trace" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "exception" -msgstr "" +msgstr "exception" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "handler" -msgstr "" +msgstr "χειριστής" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "execution" -msgstr "" +msgstr "execution" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "exc_info (in module sys)" -msgstr "" +msgstr "exc_info (στο module sys)" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "last_traceback (in module sys)" -msgstr "" +msgstr "last_traceback (στο module sys)" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "sys.exc_info" -msgstr "" +msgstr "sys.exc_info" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "sys.exception" -msgstr "" +msgstr "sys.exception" -#: reference/datamodel.rst:1407 +#: reference/datamodel.rst:1749 msgid "sys.last_traceback" -msgstr "" +msgstr "sys.last_traceback" -#: reference/datamodel.rst:1444 +#: reference/datamodel.rst:1786 msgid "tb_frame (traceback attribute)" -msgstr "" +msgstr "tb_frame (χαρακτηριστικό traceback)" -#: reference/datamodel.rst:1444 +#: reference/datamodel.rst:1786 msgid "tb_lineno (traceback attribute)" -msgstr "" +msgstr "tb_lineno (χαρακτηριστικό traceback)" -#: reference/datamodel.rst:1444 +#: reference/datamodel.rst:1786 msgid "tb_lasti (traceback attribute)" -msgstr "" +msgstr "tb_lasti (χαρακτηριστικό traceback)" -#: reference/datamodel.rst:1444 +#: reference/datamodel.rst:1786 msgid "try" -msgstr "" +msgstr "try" -#: reference/datamodel.rst:1474 +#: reference/datamodel.rst:1816 msgid "tb_next (traceback attribute)" -msgstr "" +msgstr "tb_next (χαρακτηριστικό traceback)" -#: reference/datamodel.rst:2834 +#: reference/datamodel.rst:3201 msgid "slice" -msgstr "" +msgstr "slice" -#: reference/datamodel.rst:1496 +#: reference/datamodel.rst:1838 msgid "start (slice object attribute)" -msgstr "" +msgstr "start (χαρακτηριστικό αντικειμένου slice)" -#: reference/datamodel.rst:1496 +#: reference/datamodel.rst:1838 msgid "stop (slice object attribute)" -msgstr "" +msgstr "stop (χαρακτηριστικό αντικειμένου slice)" -#: reference/datamodel.rst:1496 +#: reference/datamodel.rst:1838 msgid "step (slice object attribute)" -msgstr "" +msgstr "step (χαρακτηριστικό αντικειμένου slice)" -#: reference/datamodel.rst:1544 +#: reference/datamodel.rst:1886 msgid "operator" -msgstr "" +msgstr "τελεστής" -#: reference/datamodel.rst:1544 +#: reference/datamodel.rst:1886 msgid "overloading" -msgstr "" +msgstr "υπερφόρτωση" -#: reference/datamodel.rst:1544 +#: reference/datamodel.rst:1886 msgid "__getitem__() (mapping object method)" -msgstr "" +msgstr "__getitem__() (μέθοδος αντικειμένου αντιστοίχισης)" -#: reference/datamodel.rst:1580 +#: reference/datamodel.rst:1922 msgid "subclassing" -msgstr "" +msgstr "δημιουργία υποκλάσης" -#: reference/datamodel.rst:1580 +#: reference/datamodel.rst:1922 msgid "immutable types" -msgstr "" +msgstr "αμετάβλητοι τύποι" -#: reference/datamodel.rst:1609 +#: reference/datamodel.rst:1951 msgid "constructor" -msgstr "" +msgstr "constructor" -#: reference/datamodel.rst:1626 +#: reference/datamodel.rst:1968 msgid "destructor" -msgstr "" +msgstr "destructor" -#: reference/datamodel.rst:1626 +#: reference/datamodel.rst:1968 msgid "finalizer" -msgstr "" +msgstr "finalizer" -#: reference/datamodel.rst:1626 +#: reference/datamodel.rst:1968 msgid "del" -msgstr "" +msgstr "del" -#: reference/datamodel.rst:1688 +#: reference/datamodel.rst:2032 msgid "repr() (built-in function)" -msgstr "" +msgstr "repr() (ενσωματωμένη συνάρτηση)" -#: reference/datamodel.rst:1688 +#: reference/datamodel.rst:2032 msgid "__repr__() (object method)" -msgstr "" +msgstr "__repr__() (μέθοδος αντικειμένου)" -#: reference/datamodel.rst:1705 +#: reference/datamodel.rst:2050 msgid "__str__() (object method)" -msgstr "" +msgstr "__str__() (μέθοδος αντικειμένου)" -#: reference/datamodel.rst:1705 +#: reference/datamodel.rst:2050 msgid "format() (built-in function)" -msgstr "" +msgstr "format() (ενσωματωμένη συνάρτηση)" -#: reference/datamodel.rst:1705 +#: reference/datamodel.rst:2050 msgid "print() (built-in function)" -msgstr "" +msgstr "print() (ενσωματωμένη συνάρτηση)" -#: reference/datamodel.rst:1735 +#: reference/datamodel.rst:2081 msgid "__format__() (object method)" -msgstr "" +msgstr "__format__() (μέθοδος αντικειμένου)" -#: reference/datamodel.rst:1735 +#: reference/datamodel.rst:2081 msgid "conversion" -msgstr "" +msgstr "μετατροπή" -#: reference/datamodel.rst:1735 +#: reference/datamodel.rst:2081 msgid "print" -msgstr "" +msgstr "print" -#: reference/datamodel.rst:1774 +#: reference/datamodel.rst:2123 msgid "comparisons" -msgstr "" +msgstr "συγκρίσεις" -#: reference/datamodel.rst:1819 +#: reference/datamodel.rst:2174 msgid "hash" -msgstr "" +msgstr "hash" -#: reference/datamodel.rst:1900 +#: reference/datamodel.rst:2255 msgid "__len__() (mapping object method)" -msgstr "" +msgstr "__len__() (μέθοδος αντιστοίχισης αντικειμένου)" -#: reference/datamodel.rst:2004 +#: reference/datamodel.rst:2360 msgid "__getattr__ (module attribute)" -msgstr "" +msgstr "__getattr__ (χαρακτηριστικό module)" -#: reference/datamodel.rst:2004 +#: reference/datamodel.rst:2360 msgid "__dir__ (module attribute)" -msgstr "" +msgstr "__dir__ (χαρακτηριστικό module)" -#: reference/datamodel.rst:2004 +#: reference/datamodel.rst:2360 msgid "__class__ (module attribute)" -msgstr "" +msgstr "__class__ (χαρακτηριστικό module)" -#: reference/datamodel.rst:2375 +#: reference/datamodel.rst:2736 msgid "metaclass" -msgstr "" +msgstr "μετακλάση" -#: reference/datamodel.rst:2375 +#: reference/datamodel.rst:2736 msgid "= (equals)" -msgstr "" +msgstr "= (ισοδυναμεί)" -#: reference/datamodel.rst:2375 +#: reference/datamodel.rst:2736 msgid "class definition" -msgstr "" +msgstr "ορισμός κλάσης" -#: reference/datamodel.rst:2439 +#: reference/datamodel.rst:2800 msgid "metaclass hint" -msgstr "" +msgstr "υπόδειξη μετακλάσης" -#: reference/datamodel.rst:2462 +#: reference/datamodel.rst:2823 msgid "__prepare__ (metaclass method)" -msgstr "" +msgstr "__prepare__ (μέθοδος μετακλάσης)" -#: reference/datamodel.rst:2486 +#: reference/datamodel.rst:2847 msgid "body" -msgstr "" +msgstr "σώμα" -#: reference/datamodel.rst:2506 +#: reference/datamodel.rst:2867 msgid "__class__ (method cell)" -msgstr "" +msgstr "__class__ (κελί που περιέχει μέθοδο)" -#: reference/datamodel.rst:2506 +#: reference/datamodel.rst:2867 msgid "__classcell__ (class namespace entry)" -msgstr "" +msgstr "__classcell__ (καταχώρηση στο namespace της κλάσης)" -#: reference/datamodel.rst:2804 +#: reference/datamodel.rst:3171 msgid "__bool__() (object method)" -msgstr "" +msgstr "__bool__() (μέθοδος αντικειμένου)" -#: reference/datamodel.rst:2997 +#: reference/datamodel.rst:3364 msgid "divmod" -msgstr "" +msgstr "divmod" -#: reference/datamodel.rst:2997 reference/datamodel.rst:3011 +#: reference/datamodel.rst:3364 msgid "pow" -msgstr "" +msgstr "pow" -#: reference/datamodel.rst:3060 +#: reference/datamodel.rst:3432 msgid "abs" -msgstr "" +msgstr "abs" -#: reference/datamodel.rst:3070 +#: reference/datamodel.rst:3442 msgid "int" -msgstr "" +msgstr "int" -#: reference/datamodel.rst:3070 +#: reference/datamodel.rst:3442 msgid "float" -msgstr "" +msgstr "float" -#: reference/datamodel.rst:3098 +#: reference/datamodel.rst:3470 msgid "round" -msgstr "" +msgstr "round" -#: reference/datamodel.rst:3125 +#: reference/datamodel.rst:3494 msgid "with" -msgstr "" +msgstr "with" -#: reference/datamodel.rst:3125 +#: reference/datamodel.rst:3494 msgid "context manager" -msgstr "" +msgstr "διαχειριστής περιβάλλοντος" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index 968f1bdc..deca0407 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -8,21 +8,22 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-13 19:59+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: reference/executionmodel.rst:6 msgid "Execution model" -msgstr "" +msgstr "Μοντέλο εκτέλεσης" #: reference/executionmodel.rst:15 msgid "Structure of a program" -msgstr "" +msgstr "Δομή ενός προγράμματος" #: reference/executionmodel.rst:19 msgid "" @@ -37,6 +38,18 @@ msgid "" "option:`-m` argument is also a code block. The string argument passed to the " "built-in functions :func:`eval` and :func:`exec` is a code block." msgstr "" +"Ένα πρόγραμμα Python αποτελείται από μπλοκ κώδικα. Ένα :dfn:`μπλοκ` είναι " +"ένα κομμάτι κειμένου προγράμματος Python που εκτελείται ως μια μονάδα. Τα " +"παρακάτω είναι μπλοκ: ένα module, το σώμα μιας συνάρτησης, ο ένας ορισμός " +"κλάσης. Κάθε εντολή που πληκτρολογείται διαδραστικά αποτελεί μπλοκ. Ένα " +"αρχείο δέσμης ενεργειών (ένα αρχείο που δίνεται ως τυπική είσοδος στο " +"διερμηνέα ή καθορίζεται ως όρισμα γραμμής εντολών στον διερμηνέα) είναι ένα " +"μπλοκ κώδικα. Μια script εντολή (μια εντολή που καθορίζεται στο διερμηνέα με " +"την επιλογή :option:`-c`) είναι ένα μπλοκ κώδικα. Μια ενότητα που εκτελείται " +"ως ανωτέρου επιπέδου script (ως module ``__main__``) από τη γραμμή εντολών " +"χρησιμοποιώντας ένα όρισμα :option:`-m` όρισμα είναι επίσης ένα μπλοκ " +"κώδικα. Το όρισμα συμβολοσειράς που περνάει στις ενσωματωμένες συναρτήσεις :" +"func:`eval` και :func:`exec` είναι ένα μπλοκ κώδικα." #: reference/executionmodel.rst:33 msgid "" @@ -44,50 +57,58 @@ msgid "" "some administrative information (used for debugging) and determines where " "and how execution continues after the code block's execution has completed." msgstr "" +"Ένα μπλοκ κώδικα εκτελείται σε ένα :dfn:`πλαίσιο εκτέλεσης`. Ένα πλαίσιο " +"περιέχει ορισμένες πληροφορίες διαχείρισης (που χρησιμοποιούνται για " +"αποσφαλμάτωση) και καθορίζει που και πως συνεχίζεται η εκτέλεση μετά την " +"ολοκλήρωση της εκτέλεσης του μπλοκ κώδικα." #: reference/executionmodel.rst:40 msgid "Naming and binding" -msgstr "" +msgstr "Ονομασία και σύνδεση" #: reference/executionmodel.rst:49 msgid "Binding of names" -msgstr "" +msgstr "Σύνδεση ονομάτων" #: reference/executionmodel.rst:55 msgid "" ":dfn:`Names` refer to objects. Names are introduced by name binding " "operations." msgstr "" +":dfn:`Names` αναφέρονται σε αντικείμενα. Τα ονόματα εισάγονται μέσω " +"λειτουργιών δέσμευσης ονομάτων." #: reference/executionmodel.rst:59 msgid "The following constructs bind names:" -msgstr "" +msgstr "Οι παρακάτω δομές δεσμεύουν ονόματα:" #: reference/executionmodel.rst:61 msgid "formal parameters to functions," -msgstr "" +msgstr "τυπικές παράμετροι συναρτήσεων," #: reference/executionmodel.rst:62 msgid "class definitions," -msgstr "" +msgstr "ορισμοί κλάσεων," #: reference/executionmodel.rst:63 msgid "function definitions," -msgstr "" +msgstr "ορισμοί συναρτήσεων" #: reference/executionmodel.rst:64 msgid "assignment expressions," -msgstr "" +msgstr "εκφράσεις ανάθεσης" #: reference/executionmodel.rst:65 msgid "" ":ref:`targets ` that are identifiers if occurring in an " "assignment:" msgstr "" +":ref:`targets ` που είναι αναγνωριστικά αν εμφανίζονται σε μια " +"ανάθεση:" #: reference/executionmodel.rst:68 msgid ":keyword:`for` loop header," -msgstr "" +msgstr "επικεφαλίδα βρόχου :keyword:`for`," #: reference/executionmodel.rst:69 msgid "" @@ -95,22 +116,25 @@ msgid "" "clause, :keyword:`except* ` clause, or in the as-pattern in " "structural pattern matching," msgstr "" +"μετά το :keyword:`!as` σε μια δήλωση :keyword:`with`, σε ρήτρα :keyword:" +"`except`, σε ρήτρα :keyword:`except* ` ή στο as-pattern κατά τη " +"δομική αντιστοίχησης μοτίβων," #: reference/executionmodel.rst:71 msgid "in a capture pattern in structural pattern matching" -msgstr "" +msgstr "σε ένα στιγμιότυπο μοτίβου κατά τη δομική αντιστοίχησης μοτίβων" #: reference/executionmodel.rst:73 msgid ":keyword:`import` statements." -msgstr "" +msgstr "δηλώσεις :keyword:`import`." #: reference/executionmodel.rst:74 msgid ":keyword:`type` statements." -msgstr "" +msgstr "δηλώσεις :keyword:`type`." #: reference/executionmodel.rst:75 msgid ":ref:`type parameter lists `." -msgstr "" +msgstr ":ref:`λίστες παραμέτρων τύπου `." #: reference/executionmodel.rst:77 msgid "" @@ -118,18 +142,28 @@ msgid "" "names defined in the imported module, except those beginning with an " "underscore. This form may only be used at the module level." msgstr "" +"Η δήλωση :keyword:`!import` της μορφής ``from ... import *`` συνδέει όλα τα " +"ονόματα που ορίζονται στο εισαγόμενο module, εκτός από αυτά που ξεκινούν με " +"μια κάτω παύλα. Αυτή η μορφή μπορεί να χρησιμοποιηθεί μόνο στο επίπεδο του " +"module." #: reference/executionmodel.rst:81 msgid "" "A target occurring in a :keyword:`del` statement is also considered bound " "for this purpose (though the actual semantics are to unbind the name)." msgstr "" +"Ένας στόχος που εμφανίζεται σε μια δήλωση :keyword:`del` θεωρείται επίσης " +"δεσμευμένος για αυτό τον σκοπό (αν και η πραγματική σημασιολογία είναι να " +"αποσυνδέσει το όνομα)." #: reference/executionmodel.rst:84 msgid "" "Each assignment or import statement occurs within a block defined by a class " "or function definition or at the module level (the top-level code block)." msgstr "" +"Κάθε δήλωση ανάθεσης ή εισαγωγής συμβαίνει μέσα σε ένα μπλοκ που ορίζεται " +"από έναν ορισμό κλάσης ή συνάρτησης ή στο επίπεδο του module (το μπλοκ " +"κώδικα ανώτατου επιπέδου)." #: reference/executionmodel.rst:89 msgid "" @@ -137,18 +171,27 @@ msgid "" "declared as :keyword:`nonlocal` or :keyword:`global`. If a name is bound at " "the module level, it is a global variable. (The variables of the module " "code block are local and global.) If a variable is used in a code block but " -"not defined there, it is a :dfn:`free variable`." +"not defined there, it is a :term:`free variable`." msgstr "" +"Αν ένα όνομα δεσμεύεται σε ένα μπλοκ, είναι μια τοπική μεταβλητή αυτού του " +"μπλοκ, εκτός αν δηλωθεί ως :keyword:`nonlocal` ή :keyword:`global`. Αν ένα " +"όνομα δεσμεύεται στο επίπεδο του module, είναι μια καθολική μεταβλητή. (Οι " +"μεταβλητές του μπλοκ του module είναι ταυτόχρονα τοπικές και καθολικές.) Αν " +"μια μεταβλητή χρησιμοποιείται σε ένα μπλοκ κώδικα αλλά δεν ορίζεται εκεί, " +"είναι μια :term:`free variable`." #: reference/executionmodel.rst:95 msgid "" "Each occurrence of a name in the program text refers to the :dfn:`binding` " "of that name established by the following name resolution rules." msgstr "" +"Κάθε εμφάνιση ενός ονόματος στο κείμενο του προγράμματος αναφέρεται στη :dfn:" +"`binding` αυτού του ονόματος που καθορίζεται από τους παρακάτω κανόνες " +"επίλυσης ονομάτων." #: reference/executionmodel.rst:101 msgid "Resolution of names" -msgstr "" +msgstr "Επίλυση ονομάτων" #: reference/executionmodel.rst:105 msgid "" @@ -158,6 +201,11 @@ msgid "" "contained within the defining one, unless a contained block introduces a " "different binding for the name." msgstr "" +"Ένα :dfn:`scope` ορίζει την ορατότητα ενός ονόματος μέσα σε ένα μπλοκ. Αν " +"μια τοπική μεταβλητή οριστεί σε ένα μπλοκ, το πεδίο της περιλαμβάνει το " +"μπλοκ αυτό. Αν ο ορισμός συμβαίνει σε ένα μπλοκ συνάρτησης, το πεδίο " +"επεκτείνεται σε οποιαδήποτε μπλοκ περιέχονται μέσα σε αυτό που την ορίζει, " +"εκτός αν ένα περιεχόμενο μπλοκ εισάγει διαφορετική σύνδεση για το όνομα." #: reference/executionmodel.rst:113 msgid "" @@ -165,6 +213,9 @@ msgid "" "enclosing scope. The set of all such scopes visible to a code block is " "called the block's :dfn:`environment`." msgstr "" +"Όταν ένα όνομα χρησιμοποιείται σε ένα μπλοκ κώδικα, επιλύεται " +"χρησιμοποιώντας το πλησιέστερο περιβάλλον πεδίο. Το σύνολο όλων των πεδίων " +"που είναι ορατά σε ένα μπλοκ κώδικα ονομάζεται :dfn:`environment` του μπλοκ." #: reference/executionmodel.rst:121 msgid "" @@ -174,6 +225,12 @@ msgid "" "is used, an :exc:`UnboundLocalError` exception is raised. :exc:" "`UnboundLocalError` is a subclass of :exc:`NameError`." msgstr "" +"Όταν ένα όνομα δεν βρίσκεται καθόλου, γίνεται raise μια εξαίρεση :exc:" +"`NameError`. Αν το τρέχον πεδίο είναι πεδίο συνάρτησης και το όνομα " +"αναφέρεται σε μια τοπική μεταβλητή που δεν έχει ακόμα δεσμευτεί σε κάποια " +"τιμή στο σημείο που χρησιμοποιείται το όνομα, γίνεται raise μια εξαίρεση :" +"exc:`UnboundLocalError`. Η :exc:`UnboundLocalError` είναι μια υποκλάση της :" +"exc:`NameError`." #: reference/executionmodel.rst:127 msgid "" @@ -186,6 +243,16 @@ msgid "" "the block for name binding operations. See :ref:`the FAQ entry on " "UnboundLocalError ` for examples." msgstr "" +"Αν μια λειτουργία σύνδεσης ονομάτων συμβεί οπουδήποτε μέσα σε ένα μπλοκ " +"κώδικα, όλες οι χρήσεις του ονόματος μέσα στο μπλοκ αντιμετωπίζονται ως " +"αναφορές στο τρέχον μπλοκ. Αυτό μπορεί να οδηγήσει σε σφάλματα όταν ένα " +"όνομα χρησιμοποιείται μέσα σε ένα μπλοκ πριν δεσμευτεί. Αυτός ο κανόνας " +"είναι λεπτός. Η Python δεν διαθέτει δηλώσεις και επιτρέπει τις λειτουργίες " +"σύνδεση ονομάτων να συμβαίνουν οπουδήποτε μέσα σε ένα μπλοκ κώδικα. Οι " +"τοπικές μεταβλητές ενός μπλοκ κώδικα μπορούν να προσδιοριστούν σαρώνοντας " +"ολόκληρο το κείμενο του μπλοκ για λειτουργίες σύνδεσης ονομάτων. Δείτε :ref:" +"`την εγγραφή στο FAQ για το UnboundLocalError ` για " +"παραδείγματα." #: reference/executionmodel.rst:136 msgid "" @@ -195,19 +262,35 @@ msgid "" "searching the global namespace, i.e. the namespace of the module containing " "the code block, and the builtins namespace, the namespace of the module :mod:" "`builtins`. The global namespace is searched first. If the names are not " -"found there, the builtins namespace is searched. The :keyword:`!global` " -"statement must precede all uses of the listed names." -msgstr "" - -#: reference/executionmodel.rst:145 +"found there, the builtins namespace is searched next. If the names are also " +"not found in the builtins namespace, new variables are created in the global " +"namespace. The global statement must precede all uses of the listed names." +msgstr "" +"Αν η δήλωση :keyword:`global` εμφανιστεί μέσα σε ένα μπλοκ, όλες οι χρήσεις " +"των ονομάτων που καθορίζονται στη δήλωση αναφέρονται στις συνδέσεις αυτών " +"των ονομάτων στον χώρο ονομάτων ανώτατου επιπέδου. Τα ονόματα επιλύονται " +"στον χώρο ανώτατου επιπέδου αναζητώντας πρώτα στον καθολικό χώρο ονομάτων, " +"δηλαδή τον χώρο ονομάτων του module που περιέχει το μπλοκ κώδικα, και στη " +"συνέχεια στο χώρο ονομάτων των builtins, τον χώρο ονομάτων του module :mod:" +"`builtins`. Ο καθολικός χώρος ονομάτων αναζητείται πρώτος. Αν τα ονόματα δεν " +"βρεθούν εκεί, γίνεται αναζήτηση του ενσωματωμένου χώρου ονομάτων. Εάν τα " +"ονόματα δεν βρίσκονται επίσης στον ενσωματωμένο χώρο ονομάτων, " +"δημιουργούνται νέες μεταβλητές στον καθολικό χώρο ονομάτων. Η καθολική " +"δήλωση πρέπει να προηγείται όλων των χρήσεων των ονομάτων που αναφέρονται." + +#: reference/executionmodel.rst:146 msgid "" "The :keyword:`global` statement has the same scope as a name binding " "operation in the same block. If the nearest enclosing scope for a free " "variable contains a global statement, the free variable is treated as a " "global." msgstr "" +"Η δήλωση :keyword:`global` έχει το ίδιο πεδίο με μια λειτουργία σύνδεσης " +"ονόματος στο ίδιο μπλοκ. Αν το πλησιέστερο περιβάλλον πεδίου για μια " +"ελεύθερη μεταβλητή περιέχει μια δήλωση global, η ελεύθερη μεταβλητή " +"αντιμετωπίζεται ως καθολική." -#: reference/executionmodel.rst:151 +#: reference/executionmodel.rst:152 msgid "" "The :keyword:`nonlocal` statement causes corresponding names to refer to " "previously bound variables in the nearest enclosing function scope. :exc:" @@ -215,14 +298,23 @@ msgid "" "any enclosing function scope. :ref:`Type parameters ` cannot be " "rebound with the :keyword:`!nonlocal` statement." msgstr "" +"Η δήλωση :keyword:`nonlocal` προκαλεί τα αντίστοιχα ονόματα να αναφέρονται " +"σε προηγουμένως δεσμευμένες μεταβλητές στο πλησιέστερο περιβάλλον πεδίου " +"συνάρτησης. Μια εξαίρεση :exc:`SyntaxError` εγείρεται κατά το χρόνο " +"μεταγλώττισης αν το συγκεκριμένο δεν υπάρχει σε κανένα περιβάλλον πεδίου " +"συνάρτησης. :ref:`Οι παράμετροι τύπου ` δεν μπορούν να " +"δεσμευτούν εκ νέου με τη δήλωση :keyword:`!nonlocal`." -#: reference/executionmodel.rst:159 +#: reference/executionmodel.rst:160 msgid "" "The namespace for a module is automatically created the first time a module " "is imported. The main module for a script is always called :mod:`__main__`." msgstr "" +"Ο χώρος ονομάτων για ένα module δημιουργείται αυτόματα την πρώτη φορά που το " +"module εισάγεται Το κύριο module για ένα script ονομάζεται πάντα :mod:" +"`__main__`." -#: reference/executionmodel.rst:162 +#: reference/executionmodel.rst:163 msgid "" "Class definition blocks and arguments to :func:`exec` and :func:`eval` are " "special in the context of name resolution. A class definition is an " @@ -236,62 +328,121 @@ msgid "" "scopes>`, which have access to their enclosing class scopes. This means that " "the following will fail::" msgstr "" +"Τα μπλοκ ορισμού κλάσεων και τα ορίσματα στις συναρτήσεις :func:`exec` και :" +"func:`eval` είναι ειδικές περιπτώσεις στο πλαίσιο της επίλυσης ονομάτων. " +"Ένας ορισμός κλάσης είναι μια εκτελέσιμη δήλωση που μπορεί να χρησιμοποιεί " +"και να ορίζει ονόματα. Αυτές οι αναφορές ακολουθούν τους κανονικούς κανόνες " +"επίλυσης ονομάτων, με την εξαίρεση ότι οι αδέσμευτες τοπικές μεταβλητές " +"αναζητούνται στον καθολικό χώρο ονομάτων. Ο χώρος ονομάτων του ορισμού της " +"κλάσης γίνεται το λεξικό χαρακτηριστικών της κλάσης. Το πεδίο των ονομάτων " +"που ορίζονται σε ένα μπλοκ κλάσης περιορίζεται στο μπλοκ της κλάσης· δεν " +"επεκτείνεται στα μπλοκ κώδικα των μεθόδων. Αυτό περιλαμβάνει συνθέσεις και " +"εκφράσεις γεννητριών, αλλά δεν περιλαμβάνει :ref:`πεδία σημειώσεων " +"`, τα οποία έχουν πρόσβαση στα περιβάλλοντα πεδία της " +"περιβάλλουσας κλάσης. Αυτό σημαίνει ότι το παρακάτω θα αποτύχει::" + +#: reference/executionmodel.rst:176 +msgid "" +"class A:\n" +" a = 42\n" +" b = list(a + i for i in range(10))" +msgstr "" +"class A:\n" +" a = 42\n" +" b = list(a + i for i in range(10))" -#: reference/executionmodel.rst:179 +#: reference/executionmodel.rst:180 msgid "However, the following will succeed::" -msgstr "" +msgstr "Ωστόσο, το παρακάτω θα επιτύχει::" -#: reference/executionmodel.rst:190 +#: reference/executionmodel.rst:182 +msgid "" +"class A:\n" +" type Alias = Nested\n" +" class Nested: pass\n" +"\n" +"print(A.Alias.__value__) # " +msgstr "" +"class A:\n" +" type Alias = Nested\n" +" class Nested: pass\n" +"\n" +"print(A.Alias.__value__) # " + +#: reference/executionmodel.rst:191 msgid "Annotation scopes" -msgstr "" +msgstr "Σημειογραφία πεδία" -#: reference/executionmodel.rst:192 +#: reference/executionmodel.rst:193 msgid "" -":ref:`Type parameter lists ` and :keyword:`type` statements " -"introduce *annotation scopes*, which behave mostly like function scopes, but " -"with some exceptions discussed below. :term:`Annotations ` " -"currently do not use annotation scopes, but they are expected to use " -"annotation scopes in Python 3.13 when :pep:`649` is implemented." +":term:`Annotations `, :ref:`type parameter lists ` " +"and :keyword:`type` statements introduce *annotation scopes*, which behave " +"mostly like function scopes, but with some exceptions discussed below." msgstr "" +"Τα :term:`Annotations `, :ref:`Οι λίστες παραμέτρων τύπου ` και οι δηλώσεις :keyword:`type` εισάγουν *πεδία σημειογραφίας*, τα " +"οποία συμπεριφέρονται κυρίως όπως τα πεδία συναρτήσεων, αλλά με κάποιες " +"εξαιρέσεις που συζητούνται παρακάτω." #: reference/executionmodel.rst:198 msgid "Annotation scopes are used in the following contexts:" -msgstr "" +msgstr "Τα πεδία σημειογραφίας χρησιμοποιούνται στα παρακάτω συμφραζόμενα:" #: reference/executionmodel.rst:200 +msgid ":term:`Function annotations `." +msgstr ":term:`Function annotations `." + +#: reference/executionmodel.rst:201 +msgid ":term:`Variable annotations `." +msgstr ":term:`Variable annotations `." + +#: reference/executionmodel.rst:202 msgid "" "Type parameter lists for :ref:`generic type aliases `." msgstr "" +"Λίστες παραμέτρων τύπου για :ref:`generic type aliases `." -#: reference/executionmodel.rst:201 +#: reference/executionmodel.rst:203 msgid "" "Type parameter lists for :ref:`generic functions `. A " "generic function's annotations are executed within the annotation scope, but " "its defaults and decorators are not." msgstr "" +"Λίστες τύπου παραμέτρου για :ref:`generic functions `. Οι " +"σημειογραφίες μιας γενικής συνάρτησης εκτελούνται μέσα στο πεδίο σημειώσεων, " +"αλλά οι προεπιλογές και οι διακοσμητές της όχι." -#: reference/executionmodel.rst:204 +#: reference/executionmodel.rst:206 msgid "" "Type parameter lists for :ref:`generic classes `. A generic " "class's base classes and keyword arguments are executed within the " "annotation scope, but its decorators are not." msgstr "" +"Λίστες παραμέτρων τύπου για :ref:`generic classes `. Οι " +"βασικές κλάσεις και τα ορίσματα λέξεων-κλειδιών μιας γενικής κλάσης " +"εκτελούνται μέσα στο πεδίο σημειώσεων, αλλά οι διακοσμητές της όχι." -#: reference/executionmodel.rst:207 +#: reference/executionmodel.rst:209 msgid "" -"The bounds and constraints for type variables (:ref:`lazily evaluated `)." +"The bounds, constraints, and default values for type parameters (:ref:" +"`lazily evaluated `)." msgstr "" +"Τα όρια, οι περιορισμοί οι προεπιλεγμένες τιμές για παραμέτρους τύπου (:ref:" +"`lazily evaluated `)." -#: reference/executionmodel.rst:209 +#: reference/executionmodel.rst:211 msgid "The value of type aliases (:ref:`lazily evaluated `)." msgstr "" +"Η τιμή των ψευδωνύμων τύπου (:ref:`lazily evaluated `)." -#: reference/executionmodel.rst:211 +#: reference/executionmodel.rst:213 msgid "Annotation scopes differ from function scopes in the following ways:" msgstr "" +"Τα πεδία σημειογραφίας διαφέρουν από τα πεδία συναρτήσεων με τους εξής " +"τρόπους:" -#: reference/executionmodel.rst:213 +#: reference/executionmodel.rst:215 msgid "" "Annotation scopes have access to their enclosing class namespace. If an " "annotation scope is immediately within a class scope, or within another " @@ -301,86 +452,190 @@ msgid "" "functions defined within classes, which cannot access names defined in the " "class scope." msgstr "" +"Τα πεδία σημειογραφίας έχουν πρόσβαση στον χώρο ονομάτων της περιβάλλουσας " +"κλάσης. Αν ένα πεδίο σημειογραφίας βρίσκεται αμέσως μέσα σε έναν χώρο κλάσης " +"ή μέσα σε ένα άλλο πεδίο σημειογραφίας που βρίσκεται αμέσως μέσα σε έναν " +"χώρο κλάσης, ο κώδικας στο πεδίο σημειογραφίας μπορεί να χρησιμοποιεί " +"ονόματα που έχουν οριστεί στον χώρο της κλάσης σαν να εκτελούνταν απευθείας " +"στο σώμα της κλάσης. Αυτό έρχεται σε αντίθεση με τις κανονικές συναρτήσεις " +"που ορίζονται μέσα σε κλάσεις, οι οποίες δεν μπορούν να έχουν πρόσβαση σε " +"ονόματα που έχουν οριστεί στο χώρο της κλάσης." -#: reference/executionmodel.rst:219 +#: reference/executionmodel.rst:221 msgid "" "Expressions in annotation scopes cannot contain :keyword:`yield`, ``yield " "from``, :keyword:`await`, or :token:`:= ` expressions. (These expressions are allowed in other " "scopes contained within the annotation scope.)" msgstr "" +"Οι εκφράσεις σε πεδία σημειογραφίας δεν μπορούν να περιέχουν τις εκφράσεις :" +"keyword:`yield`, ``yield from``, :keyword:`await` ή :token:`:= ` εκφράσεις. (Αυτές οι εκφράσεις επιτρέπονται " +"σε άλλα πεδία που περιέχονται μέσα στο πεδίο σημειογραφίας.)" -#: reference/executionmodel.rst:223 +#: reference/executionmodel.rst:225 msgid "" "Names defined in annotation scopes cannot be rebound with :keyword:" "`nonlocal` statements in inner scopes. This includes only type parameters, " "as no other syntactic elements that can appear within annotation scopes can " "introduce new names." msgstr "" +"Τα ονόματα που ορίζονται σε πεδία σημειογραφίας δεν μπορούν να δεσμευτούν εκ " +"νέου με δηλώσεις :keyword:`nonlocal` σε εσωτερικά πεδία. Αυτό περιλαμβάνει " +"μόνο παραμέτρους τύπου, καθώς και κανένα άλλο συντακτικό στοιχείο που μπορεί " +"να εμφανιστεί μέσα σε πεδία σημειώσεων δεν μπορεί να εισαγάγει νέα ονόματα." -#: reference/executionmodel.rst:226 +#: reference/executionmodel.rst:228 msgid "" "While annotation scopes have an internal name, that name is not reflected in " -"the :term:`__qualname__ ` of objects defined within the " -"scope. Instead, the :attr:`!__qualname__` of such objects is as if the " -"object were defined in the enclosing scope." +"the :term:`qualified name` of objects defined within the scope. Instead, " +"the :attr:`~definition.__qualname__` of such objects is as if the object " +"were defined in the enclosing scope." msgstr "" +"Ενώ τα πεδία σημειογραφίας έχουν ένα εσωτερικό όνομα, αυτό το όνομα δεν " +"αντικατοπτρίζεται στο :term:`qualified name` των αντικειμένων που ορίζονται " +"μέσα στο πεδίο.Αντίθετα, το :attr:`~definition.__qualname__` αυτών των " +"αντικειμένων είναι σαν το αντικείμενο να είχε οριστεί στο περιβάλλων πεδίο." -#: reference/executionmodel.rst:231 +#: reference/executionmodel.rst:233 msgid "Annotation scopes were introduced in Python 3.12 as part of :pep:`695`." msgstr "" +"Τα πεδία σημειώσεων εισήχθησαν στην Python 3.12 ως μέρος του :pep:`695`." -#: reference/executionmodel.rst:237 -msgid "Lazy evaluation" +#: reference/executionmodel.rst:236 +msgid "" +"Annotation scopes are also used for type parameter defaults, as introduced " +"by :pep:`696`." msgstr "" +"Οι περιοχές σχολίων τύπου χρησιμοποιούνται επίσης για τις προεπιλεγμένες " +"τιμές παραμέτρων τύπου, όπως εισάγεται από το :pep:`696`." -#: reference/executionmodel.rst:239 +#: reference/executionmodel.rst:240 msgid "" -"The values of type aliases created through the :keyword:`type` statement are " -"*lazily evaluated*. The same applies to the bounds and constraints of type " -"variables created through the :ref:`type parameter syntax `. " -"This means that they are not evaluated when the type alias or type variable " -"is created. Instead, they are only evaluated when doing so is necessary to " -"resolve an attribute access." +"Annotation scopes are now also used for annotations, as specified in :pep:" +"`649` and :pep:`749`." msgstr "" +"Οι περιοχές σχολίων τύπου χρησιμοποιούνται επίσης για τα annotations, όπως " +"εισάγεται από το :pep:`649` and :pep:`749`." + +#: reference/executionmodel.rst:247 +msgid "Lazy evaluation" +msgstr "Καθυστερημένη εκτίμηση" -#: reference/executionmodel.rst:246 +#: reference/executionmodel.rst:249 +msgid "" +"Most annotation scopes are *lazily evaluated*. This includes annotations, " +"the values of type aliases created through the :keyword:`type` statement, " +"and the bounds, constraints, and default values of type variables created " +"through the :ref:`type parameter syntax `. This means that they " +"are not evaluated when the type alias or type variable is created, or when " +"the object carrying annotations is created. Instead, they are only evaluated " +"when necessary, for example when the ``__value__`` attribute on a type alias " +"is accessed." +msgstr "" +"Τα περισσότερα πεδία annotation *αξιολογούνται νωχελικά*. Αυτό περιλαμβάνει " +"annotations, τις τιμές των ψευδωνύμων τύπου που δημιουργούνται μέσω της " +"δήλωσης :keyword:`type` και τα όρια, τους περιορισμούς και τις " +"προεπιλεγμένες τιμές των μεταβλητών τύπου που δημιουργούνται μέσω της " +"σύνταξης παραμέτρων :ref:`type parameter syntax `. Αυτό " +"σημαίνει ότι δεν αξιολογούνται όταν δημιουργείται το ψευδώνυμο τύπου ή η " +"μεταβλητή τύπου ή όταν δημιουργείται το αντικείμενο που φέρει σχολιασμούς. " +"Αντίθετα, αξιολογούνται μόνο όταν είναι απαραίτητο, για παράδειγμα όταν " +"γίνεται πρόσβαση στο χαρακτηριστικό ``__value__`` σε ένα ψευδώνυμο τύπου." + +#: reference/executionmodel.rst:258 msgid "Example:" -msgstr "" +msgstr "Παράδειγμα:" -#: reference/executionmodel.rst:262 +#: reference/executionmodel.rst:260 +msgid "" +">>> type Alias = 1/0\n" +">>> Alias.__value__\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> def func[T: 1/0](): pass\n" +">>> T = func.__type_params__[0]\n" +">>> T.__bound__\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero" +msgstr "" +">>> type Alias = 1/0\n" +">>> Alias.__value__\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> def func[T: 1/0](): pass\n" +">>> T = func.__type_params__[0]\n" +">>> T.__bound__\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero" + +#: reference/executionmodel.rst:274 msgid "" "Here the exception is raised only when the ``__value__`` attribute of the " "type alias or the ``__bound__`` attribute of the type variable is accessed." msgstr "" +"Εδώ η εξαίρεση εγείρεται μόνο όταν γίνει πρόσβαση στο χαρακτηριστικό " +"``__value__`` του ψευδωνύμου τύπου ή στο χαρακτηριστικό ``__bound__`` της " +"μεταβλητής τύπου." -#: reference/executionmodel.rst:266 +#: reference/executionmodel.rst:278 msgid "" "This behavior is primarily useful for references to types that have not yet " "been defined when the type alias or type variable is created. For example, " "lazy evaluation enables creation of mutually recursive type aliases::" msgstr "" +"Αυτή η συμπεριφορά είναι κυρίως χρήσιμη για αναφορές σε τύπους που δεν έχουν " +"ακόμη οριστεί κατά τη δημιουργία του ψευδωνύμου τύπου ή της μεταβλητής " +"τύπου. Για παράδειγμα, η καθυστερημένη εκτίμηση επιτρέπει τη δημιουργία " +"αμοιβαίων αναδρομικών ψευδωνύμων τύπων::" -#: reference/executionmodel.rst:276 +#: reference/executionmodel.rst:282 +msgid "" +"from typing import Literal\n" +"\n" +"type SimpleExpr = int | Parenthesized\n" +"type Parenthesized = tuple[Literal[\"(\"], Expr, Literal[\")\"]]\n" +"type Expr = SimpleExpr | tuple[SimpleExpr, Literal[\"+\", \"-\"], Expr]" +msgstr "" +"from typing import Literal\n" +"\n" +"type SimpleExpr = int | Parenthesized\n" +"type Parenthesized = tuple[Literal[\"(\"], Expr, Literal[\")\"]]\n" +"type Expr = SimpleExpr | tuple[SimpleExpr, Literal[\"+\", \"-\"], Expr]" + +#: reference/executionmodel.rst:288 msgid "" "Lazily evaluated values are evaluated in :ref:`annotation scope `, which means that names that appear inside the lazily evaluated " "value are looked up as if they were used in the immediately enclosing scope." msgstr "" +"Οι τιμές που αξιολογούνται καθυστερημένα αξιολογούνται στο :ref:`πεδίο " +"σημειογραφίας `, που σημαίνει ότι τα ονόματα που " +"εμφανίζονται μέσα στην καθυστερημένα αξιολογούμενη τιμή αναζητούνται σαν να " +"χρησιμοποιήθηκαν στο αμέσως περιβάλλον πεδίο." -#: reference/executionmodel.rst:285 +#: reference/executionmodel.rst:297 msgid "Builtins and restricted execution" -msgstr "" +msgstr "Ενσωματωμένες συναρτήσεις και περιορισμένη εκτέλεση" -#: reference/executionmodel.rst:291 +#: reference/executionmodel.rst:303 msgid "" "Users should not touch ``__builtins__``; it is strictly an implementation " "detail. Users wanting to override values in the builtins namespace should :" "keyword:`import` the :mod:`builtins` module and modify its attributes " "appropriately." msgstr "" +"Οι χρήστες δεν θα πρέπει να τροποποιούν το ``__builtins__``· είναι αυστηρά " +"μια λεπτομέρεια υλοποίησης. Οι χρήστες που θέλουν να παρακάμψουν τιμές στον " +"χώρο ονομάτων των ενσωματωμένων συναρτήσεων θα πρέπει να κάνουν :keyword:" +"`import` το module :mod:`builtins` και να τροποποιούν τα χαρακτηριστικά του " +"κατάλληλα." -#: reference/executionmodel.rst:296 +#: reference/executionmodel.rst:308 msgid "" "The builtins namespace associated with the execution of a code block is " "actually found by looking up the name ``__builtins__`` in its global " @@ -390,18 +645,43 @@ msgid "" "other module, ``__builtins__`` is an alias for the dictionary of the :mod:" "`builtins` module itself." msgstr "" +"Ο χώρος ονομάτων των ενσωματωμένων συναρτήσεων που σχετίζεται με την " +"εκτέλεση ενός μπλοκ κώδικα βρίσκεται στην πραγματικότητα μέσω αναζήτησης του " +"ονόματος ``__builtins__`` στον καθολικό του χώρο ονομάτων· αυτό θα πρέπει να " +"είναι ένα λεξικό ή ένα module (στη δεύτερη περίπτωση χρησιμοποιείται το " +"λεξικό του module). Από προεπιλογή, όταν βρισκόμαστε στο module :mod:" +"`__main__`, το ``__builtins__`` είναι το ενσωματωμένο module :mod:" +"`builtins`· όταν βρισκόμαστε σε οποιοδήποτε άλλο module, το ``__builtins__`` " +"είναι ένα ψευδώνυμο για το λεξικό του ίδιου του module :mod:`builtins`." -#: reference/executionmodel.rst:308 +#: reference/executionmodel.rst:320 msgid "Interaction with dynamic features" -msgstr "" +msgstr "Αλληλεπίδραση με δυναμικές λειτουργίες" -#: reference/executionmodel.rst:310 +#: reference/executionmodel.rst:322 msgid "" "Name resolution of free variables occurs at runtime, not at compile time. " "This means that the following code will print 42::" msgstr "" +"Η επίλυση ονομάτων των ελεύθερων μεταβλητών συμβαίνει κατά το χρόνο " +"εκτέλεσης, όχι κατά το χρόνο μεταγλώττισης. Αυτό σημαίνει ότι ο παρακάτω " +"κώδικας θα εκτυπώσει το 42::" -#: reference/executionmodel.rst:321 +#: reference/executionmodel.rst:325 +msgid "" +"i = 10\n" +"def f():\n" +" print(i)\n" +"i = 42\n" +"f()" +msgstr "" +"i = 10\n" +"def f():\n" +" print(i)\n" +"i = 42\n" +"f()" + +#: reference/executionmodel.rst:333 msgid "" "The :func:`eval` and :func:`exec` functions do not have access to the full " "environment for resolving names. Names may be resolved in the local and " @@ -411,12 +691,20 @@ msgid "" "global and local namespace. If only one namespace is specified, it is used " "for both." msgstr "" +"Οι συναρτήσεις :func:`eval` και :func:`exec` δεν έχουν πρόσβαση στο πλήρες " +"περιβάλλον για την επίλυση ονομάτων. Τα ονόματα μπορεί να επιλύονται στους " +"τοπικούς και καθολικούς χώρους ονομάτων του καλούντος. Οι ελεύθερες " +"μεταβλητές δεν επιλύονται στο πλησιέστερο περιβάλλον πεδίου, αλλά στον " +"καθολικό χώρο ονομάτων. [#]_ Οι συναρτήσεις :func:`exec` και :func:`eval` " +"έχουν προαιρετικά ορίσματα για να παρακάμψουν τους καθολικούς και τοπικούς " +"χώρους ονομάτων. Αν καθοριστεί μόνο ένας χώρος ονομάτων, χρησιμοποιείται και " +"για τους δύο." -#: reference/executionmodel.rst:332 +#: reference/executionmodel.rst:347 msgid "Exceptions" -msgstr "" +msgstr "Εξαιρέσεις" -#: reference/executionmodel.rst:343 +#: reference/executionmodel.rst:358 msgid "" "Exceptions are a means of breaking out of the normal flow of control of a " "code block in order to handle errors or other exceptional conditions. An " @@ -424,8 +712,14 @@ msgid "" "*handled* by the surrounding code block or by any code block that directly " "or indirectly invoked the code block where the error occurred." msgstr "" +"Οι εξαιρέσεις είναι ένας τρόπος διακοπής της κανονικής ροής ελέγχου ενός " +"μπλοκ κώδικα, προκειμένου να αντιμετωπιστούν σφάλματα ή άλλες εξαιρετικές " +"συνθήκες. Μια εξαίρεση *γίνεται raise* στο σημείο όπου εντοπίζεται το " +"σφάλμα· μπορεί να *αντιμετωπιστεί* από το περιβάλλον μπλοκ κώδικα ή από " +"οποιοδήποτε μπλοκ κώδικα που άμεσα ή έμμεσα εκτέλεσε το μπλοκ κώδικα όπου " +"συνέβη το σφάλμα." -#: reference/executionmodel.rst:349 +#: reference/executionmodel.rst:364 msgid "" "The Python interpreter raises an exception when it detects a run-time error " "(such as division by zero). A Python program can also explicitly raise an " @@ -435,24 +729,41 @@ msgid "" "code which does not handle the exception, but is executed whether an " "exception occurred or not in the preceding code." msgstr "" +"Ο διερμηνέας της Python εγείρει μια εξαίρεση όταν εντοπίσει ένα σφάλμα κατά " +"την εκτέλεση(όπως η διαίρεση με το μηδέν). Ένα πρόγραμμα Python μπορεί " +"επίσης να εγείρει ρητά μια εξαίρεση με τη δήλωση :keyword:`raise`. Οι " +"διαχειριστές εξαιρέσεων καθορίζονται με τη δήλωση :keyword:`try` ... :" +"keyword:`except`. Η ρήτρα :keyword:`finally` μιας τέτοιας δήλωσης μπορεί να " +"χρησιμοποιηθεί για να καθοριστεί κώδικας καθαρισμού, ο οποίος δεν " +"διαχειρίζεται την εξαίρεση αλλά εκτελείται ανεξάρτητα από το αν προηγήθηκε " +"εξαίρεση ή όχι στον προηγούμενο κώδικα." -#: reference/executionmodel.rst:359 +#: reference/executionmodel.rst:374 msgid "" "Python uses the \"termination\" model of error handling: an exception " "handler can find out what happened and continue execution at an outer level, " "but it cannot repair the cause of the error and retry the failing operation " "(except by re-entering the offending piece of code from the top)." msgstr "" +"Η Python χρησιμοποιεί το μοντέλο διαχείρισης σφαλμάτων «τερματισμού»: ένας " +"διαχειριστής εξαιρέσεων μπορεί να διαπιστώσει τι συνέβη και να συνεχίσει την " +"εκτέλεση σε ένα εξωτερικό επίπεδο, αλλά δεν μπορεί να διορθώσει την αιτία " +"του σφάλματος και να επαναλάβει τη λειτουργία που απέτυχε (εκτός αν " +"επανεισαχθεί το προβληματικό κομμάτι κώδικα από την αρχή)." -#: reference/executionmodel.rst:366 +#: reference/executionmodel.rst:381 msgid "" "When an exception is not handled at all, the interpreter terminates " "execution of the program, or returns to its interactive main loop. In " "either case, it prints a stack traceback, except when the exception is :exc:" "`SystemExit`." msgstr "" +"Όταν μια εξαίρεση δεν αντιμετωπιστεί καθόλου, ο διερμηνέας τερματίζει την " +"εκτέλεση του προγράμματος ή επιστρέφει στον διαδραστικό κύριο βρόχο του. Και " +"στις δύο περιπτώσεις, εκτυπώνει το ίχνος της στοίβας, εκτός αν η εξαίρεση " +"είναι :exc:`SystemExit`." -#: reference/executionmodel.rst:370 +#: reference/executionmodel.rst:385 msgid "" "Exceptions are identified by class instances. The :keyword:`except` clause " "is selected depending on the class of the instance: it must reference the " @@ -460,135 +771,552 @@ msgid "" "class>` thereof. The instance can be received by the handler and can carry " "additional information about the exceptional condition." msgstr "" +"Οι εξαιρέσεις αναγνωρίζονται από στιγμιότυπα κλάσεων. Η ρήτρα :keyword:" +"`except` επιλέγεται ανάλογα με την κλάση του στιγμιότυπου: πρέπει να " +"αναφέρεται στην κλάση του στιγμιότυπου ή σε μια :term:`μη εικονική βασική " +"κλάση ` αυτής. Το στιγμιότυπο μπορεί να παραληφθεί από " +"τον διαχειριστή και να μεταφέρει πρόσθετες πληροφορίες σχετικά με την " +"εξαιρετική συνθήκη." -#: reference/executionmodel.rst:378 +#: reference/executionmodel.rst:393 msgid "" "Exception messages are not part of the Python API. Their contents may " "change from one version of Python to the next without warning and should not " "be relied on by code which will run under multiple versions of the " "interpreter." msgstr "" +"Τα μηνύματα εξαιρέσεων δεν αποτελούν μέρος του API της Python. Το " +"περιεχόμενό τους μπορεί να αλλάξει από τη μία έκδοση της Python στην επόμενη " +"χωρίς προειδοποίηση και δεν θα πρέπει να βασίζεται σε αυτά ο κώδικας που θα " +"εκτελεστεί σε πολλαπλές εκδόσεις του διερμηνέα." -#: reference/executionmodel.rst:382 +#: reference/executionmodel.rst:397 msgid "" "See also the description of the :keyword:`try` statement in section :ref:" "`try` and :keyword:`raise` statement in section :ref:`raise`." msgstr "" +"Δείτε επίσης την περιγραφή της δήλωσης :keyword:`try` στην ενότητα :ref:" +"`try` και της δήλωσης :keyword:`raise` στην ενότητα :ref:`raise`." -#: reference/executionmodel.rst:387 -msgid "Footnotes" +#: reference/executionmodel.rst:404 +msgid "Runtime Components" +msgstr "Συστατικά χρόνου εκτέλεσης" + +#: reference/executionmodel.rst:407 +msgid "General Computing Model" +msgstr "Γενικό μοντέλο υπολογισμού" + +#: reference/executionmodel.rst:409 +msgid "" +"Python's execution model does not operate in a vacuum. It runs on a host " +"machine and through that host's runtime environment, including its operating " +"system (OS), if there is one. When a program runs, the conceptual layers of " +"how it runs on the host look something like this:" +msgstr "" +"Το μοντέλο εκτέλεσης της Python δεν λειτουργεί σε κενό. Εκτελείται σε μια " +"μηχανή υποδοχής και μέσω του περιβάλλοντος χρόνου εκτέλεσης αυτής της " +"υποδοχής, συμπεριλαμβανομένου του λειτουργικού της συστήματος (OS), αν " +"υπάρχει. Όταν εκτελείται ένα πρόγραμμα, τα εννοιολογικά επίπεδα του τρόπου " +"με τον οποίο εκτελείται στην υποδοχή μοιάζουν κάπως έτσι:" + +#: reference/executionmodel.rst:0 +msgid "**host machine**" +msgstr "**μηχανή υποδοχής**" + +#: reference/executionmodel.rst:0 +msgid "**process** (global resources)" +msgstr "**διαδικασία** (παγκόσμιοι πόροι)" + +#: reference/executionmodel.rst:0 +msgid "**thread** (runs machine code)" +msgstr "**νήμα** (εκτελεί κώδικα μηχανής)" + +#: reference/executionmodel.rst:419 +msgid "" +"Each process represents a program running on the host. Think of each " +"process itself as the data part of its program. Think of the process' " +"threads as the execution part of the program. This distinction will be " +"important to understand the conceptual Python runtime." +msgstr "" +"Κάθε διαδικασία αντιπροσωπεύει ένα πρόγραμμα που εκτελείται στην υποδοχή. " +"Σκεφτείτε κάθε διαδικασία ως το δεδομένο μέρος του προγράμματός της. " +"Σκεφτείτε τα νήματα της διαδικασίας ως το εκτελεστικό μέρος του " +"προγράμματος. Αυτή η διάκριση θα είναι σημαντική για την κατανόηση του " +"εννοιολογικού χρόνου εκτέλεσης της Python." + +#: reference/executionmodel.rst:424 +msgid "" +"The process, as the data part, is the execution context in which the program " +"runs. It mostly consists of the set of resources assigned to the program by " +"the host, including memory, signals, file handles, sockets, and environment " +"variables." +msgstr "" +"Η διαδικασία, ως το δεδομένο μέρος, είναι το εκτελεστικό πλαίσιο στο οποίο " +"εκτελείται το πρόγραμμα. Αποτελείται κυρίως από το σύνολο των πόρων που " +"ανατίθενται στο πρόγραμμα από την υποδοχή, συμπεριλαμβανομένης της μνήμης, " +"των σημάτων, των χειριστηρίων αρχείων, των υποδοχών και των μεταβλητών " +"περιβάλλοντος." + +#: reference/executionmodel.rst:429 +msgid "" +"Processes are isolated and independent from one another. (The same is true " +"for hosts.) The host manages the process' access to its assigned resources, " +"in addition to coordinating between processes." +msgstr "" +"Οι διαδικασίες είναι απομονωμένες και ανεξάρτητες η μία από την άλλη. (Το " +"ίδιο ισχύει και για τις υποδοχές.) Η υποδοχή διαχειρίζεται την πρόσβαση της " +"διαδικασίας στους ανατεθειμένους πόρους της, εκτός από τον συντονισμό μεταξύ " +"διαδικασιών." + +#: reference/executionmodel.rst:433 +msgid "" +"Each thread represents the actual execution of the program's machine code, " +"running relative to the resources assigned to the program's process. It's " +"strictly up to the host how and when that execution takes place." +msgstr "" +"Κάθε νήμα αντιπροσωπεύει την πραγματική εκτέλεση του κώδικα μηχανής του " +"προγράμματος, που εκτελείται σε σχέση με τους πόρους που έχουν ανατεθεί στη " +"διαδικασία του προγράμματος. Είναι αυστηρά στην υποδοχή ο τρόπος και ο " +"χρόνος με τον οποίο πραγματοποιείται αυτή η εκτέλεση." + +#: reference/executionmodel.rst:438 +msgid "" +"From the point of view of Python, a program always starts with exactly one " +"thread. However, the program may grow to run in multiple simultaneous " +"threads. Not all hosts support multiple threads per process, but most do. " +"Unlike processes, threads in a process are not isolated and independent from " +"one another. Specifically, all threads in a process share all of the " +"process' resources." +msgstr "" +"Από την άποψη της Python, ένα πρόγραμμα ξεκινά πάντα με ακριβώς ένα νήμα. " +"Ωστόσο, το πρόγραμμα μπορεί να αναπτυχθεί για να εκτελείται σε πολλαπλά " +"ταυτόχρονα νήματα. Δεν υποστηρίζουν όλοι οι οικοδεσπότες πολλαπλά νήματα ανά " +"διαδικασία, αλλά οι περισσότεροι το κάνουν. Σε αντίθεση με τις διαδικασίες, " +"τα νήματα σε μια διαδικασία δεν είναι απομονωμένα και ανεξάρτητα το ένα από " +"το άλλο. Συγκεκριμένα, όλα τα νήματα σε μια διαδικασία μοιράζονται όλους " +"τους πόρους της διαδικασίας." + +#: reference/executionmodel.rst:445 +msgid "" +"The fundamental point of threads is that each one does *run* independently, " +"at the same time as the others. That may be only conceptually at the same " +"time (\"concurrently\") or physically (\"in parallel\"). Either way, the " +"threads effectively run at a non-synchronized rate." +msgstr "" +"Το θεμελιώδες σημείο των νημάτων είναι ότι το καθένα *εκτελείται* " +"ανεξάρτητα, ταυτόχρονα με τα άλλα. Αυτό μπορεί να είναι μόνο εννοιολογικά " +"ταυτόχρονα (\"concurrently\") ή φυσικά (\"in parallel\"). Σε κάθε περίπτωση, " +"τα νήματα εκτελούνται αποτελεσματικά με μη συγχρονισμένο ρυθμό." + +#: reference/executionmodel.rst:453 +msgid "" +"That non-synchronized rate means none of the process' memory is guaranteed " +"to stay consistent for the code running in any given thread. Thus multi-" +"threaded programs must take care to coordinate access to intentionally " +"shared resources. Likewise, they must take care to be absolutely diligent " +"about not accessing any *other* resources in multiple threads; otherwise two " +"threads running at the same time might accidentally interfere with each " +"other's use of some shared data. All this is true for both Python programs " +"and the Python runtime." +msgstr "" +"Αυτός ο μη συγχρονισμένος ρυθμός σημαίνει ότι δεν εγγυάται ότι η μνήμη της " +"διαδικασίας θα παραμείνει συνεπής για τον κώδικα που εκτελείται σε " +"οποιοδήποτε δοσμένο νήμα. Επομένως, τα πολυνηματικά προγράμματα πρέπει να " +"φροντίζουν να συντονίζουν την πρόσβαση σε σκόπιμα κοινόχρηστους πόρους. " +"Ομοίως, πρέπει να φροντίζουν να είναι απόλυτα επιμελείς ώστε να μην έχουν " +"πρόσβαση σε *άλλους* πόρους σε πολλαπλά νήματα· διαφορετικά, δύο νήματα που " +"εκτελούνται ταυτόχρονα μπορεί να παρεμβαίνουν κατά λάθος στη χρήση κάποιων " +"κοινόχρηστων δεδομένων. Όλα αυτά ισχύουν τόσο για προγράμματα Python όσο και " +"για τον χρόνο εκτέλεσης της Python." + +#: reference/executionmodel.rst:463 +msgid "" +"The cost of this broad, unstructured requirement is the tradeoff for the " +"kind of raw concurrency that threads provide. The alternative to the " +"required discipline generally means dealing with non-deterministic bugs and " +"data corruption." msgstr "" +"Το κόστος αυτής της ευρείας, μη δομημένης απαίτησης είναι το αντάλλαγμα για " +"τον τύπο της ακατέργαστης ταυτόχρονης εκτέλεσης που παρέχουν τα νήματα. Η " +"εναλλακτική λύση στην απαιτούμενη πειθαρχία γενικά σημαίνει την αντιμετώπιση " +"μη ντετερμινιστικών σφαλμάτων και διαφθοράς δεδομένων." -#: reference/executionmodel.rst:388 +#: reference/executionmodel.rst:469 +msgid "Python Runtime Model" +msgstr "Μοντέλο χρόνου εκτέλεσης της Python" + +#: reference/executionmodel.rst:471 +msgid "" +"The same conceptual layers apply to each Python program, with some extra " +"data layers specific to Python:" +msgstr "" +"Τα ίδια εννοιολογικά επίπεδα ισχύουν για κάθε πρόγραμμα Python, με μερικά " +"επιπλέον επίπεδα δεδομένων συγκεκριμένα για την Python:" + +#: reference/executionmodel.rst:0 +msgid "Python global runtime (*state*)" +msgstr "Παγκόσμιος χρόνος εκτέλεσης της Python (*κατάσταση*)" + +#: reference/executionmodel.rst:0 +msgid "Python interpreter (*state*)" +msgstr "Διερμηνέας Python (*κατάσταση*)" + +#: reference/executionmodel.rst:0 +msgid "**thread** (runs Python bytecode and \"C-API\")" +msgstr "**thread** (εκτελεί bytecode Python και \"C-API\")" + +#: reference/executionmodel.rst:0 +msgid "Python thread *state*" +msgstr "*Κατάσταση* νήματος Python" + +#: reference/executionmodel.rst:481 +msgid "" +"At the conceptual level: when a Python program starts, it looks exactly like " +"that diagram, with one of each. The runtime may grow to include multiple " +"interpreters, and each interpreter may grow to include multiple thread " +"states." +msgstr "" +"Σε εννοιολογικό επίπεδο: όταν ξεκινά ένα πρόγραμμα Python, μοιάζει ακριβώς " +"με αυτό το διάγραμμα, με ένα από κάθε στοιχείο. Ο χρόνος εκτέλεσης μπορεί να " +"αναπτυχθεί ώστε να περιλαμβάνει πολλαπλούς διερμηνείς, και κάθε διερμηνέας " +"μπορεί να αναπτυχθεί ώστε να περιλαμβάνει πολλαπλές καταστάσεις νημάτων." + +#: reference/executionmodel.rst:488 +msgid "" +"A Python implementation won't necessarily implement the runtime layers " +"distinctly or even concretely. The only exception is places where distinct " +"layers are directly specified or exposed to users, like through the :mod:" +"`threading` module." +msgstr "" +"Μια υλοποίηση της Python δεν θα υλοποιήσει απαραίτητα τα επίπεδα χρόνου " +"εκτέλεσης με διακριτό ή ακόμη και συγκεκριμένο τρόπο. Η μόνη εξαίρεση είναι " +"τα σημεία όπου τα διακριτά επίπεδα καθορίζονται άμεσα ή εκτίθενται στους " +"χρήστες, όπως μέσω του module :mod:`threading`." + +#: reference/executionmodel.rst:495 +msgid "" +"The initial interpreter is typically called the \"main\" interpreter. Some " +"Python implementations, like CPython, assign special roles to the main " +"interpreter." +msgstr "" +"Ο αρχικός διερμηνέας ονομάζεται συνήθως ο \"κύριος\" διερμηνέας. Ορισμένες " +"υλοποιήσεις της Python, όπως η CPython, αναθέτουν ειδικούς ρόλους στον κύριο " +"διερμηνέα." + +#: reference/executionmodel.rst:499 +msgid "" +"Likewise, the host thread where the runtime was initialized is known as the " +"\"main\" thread. It may be different from the process' initial thread, " +"though they are often the same. In some cases \"main thread\" may be even " +"more specific and refer to the initial thread state. A Python runtime might " +"assign specific responsibilities to the main thread, such as handling " +"signals." +msgstr "" +"Ομοίως, το νήμα υποδοχής όπου αρχικοποιήθηκε ο χρόνος εκτέλεσης είναι γνωστό " +"ως το \"κύριο\" νήμα. Μπορεί να είναι διαφορετικό από το αρχικό νήμα της " +"διαδικασίας, αν και συχνά είναι το ίδιο. Σε ορισμένες περιπτώσεις, το " +"\"κύριο νήμα\" μπορεί να είναι ακόμη πιο συγκεκριμένο και να αναφέρεται στην " +"αρχική κατάσταση νήματος. Ένας χρόνος εκτέλεσης της Python μπορεί να " +"αναθέσει συγκεκριμένες ευθύνες στο κύριο νήμα, όπως η διαχείριση σημάτων." + +#: reference/executionmodel.rst:506 +msgid "" +"As a whole, the Python runtime consists of the global runtime state, " +"interpreters, and thread states. The runtime ensures all that state stays " +"consistent over its lifetime, particularly when used with multiple host " +"threads." +msgstr "" +"Συνολικά, ο χρόνος εκτέλεσης της Python αποτελείται από την παγκόσμια " +"κατάσταση χρόνου εκτέλεσης, τους διερμηνείς και τις καταστάσεις νημάτων. Ο " +"χρόνος εκτέλεσης διασφαλίζει ότι όλη αυτή η κατάσταση παραμένει συνεπής κατά " +"τη διάρκειά της ζωής του, ιδιαίτερα όταν χρησιμοποιείται με πολλαπλά νήματα " +"υποδοχής." + +#: reference/executionmodel.rst:511 +msgid "" +"The global runtime, at the conceptual level, is just a set of interpreters. " +"While those interpreters are otherwise isolated and independent from one " +"another, they may share some data or other resources. The runtime is " +"responsible for managing these global resources safely. The actual nature " +"and management of these resources is implementation-specific. Ultimately, " +"the external utility of the global runtime is limited to managing " +"interpreters." +msgstr "" +"Ο παγκόσμιος χρόνος εκτέλεσης, σε εννοιολογικό επίπεδο, είναι απλώς ένα " +"σύνολο διερμηνέων. Ενώ αυτοί οι διερμηνείς είναι διαφορετικά απομονωμένοι " +"και ανεξάρτητοι ο ένας από τον άλλον, μπορεί να μοιράζονται ορισμένα " +"δεδομένα ή άλλους πόρους. Ο χρόνος εκτέλεσης είναι υπεύθυνος για τη " +"διαχείριση αυτών των παγκόσμιων πόρων με ασφάλεια. Η πραγματική φύση και " +"διαχείριση αυτών των πόρων είναι συγκεκριμένη για την υλοποίηση. Τελικά, η " +"εξωτερική χρησιμότητα του παγκόσμιου χρόνου εκτέλεσης περιορίζεται στη " +"διαχείριση διερμηνέων." + +#: reference/executionmodel.rst:519 +msgid "" +"In contrast, an \"interpreter\" is conceptually what we would normally think " +"of as the (full-featured) \"Python runtime\". When machine code executing " +"in a host thread interacts with the Python runtime, it calls into Python in " +"the context of a specific interpreter." +msgstr "" +"Σε αντίθεση, ένας \"διερμηνέας\" είναι εννοιολογικά αυτό που θα σκεφτόμασταν " +"κανονικά ως ο (πλήρως εξοπλισμένος) \"χρόνος εκτέλεσης της Python\". Όταν ο " +"κώδικας μηχανής που εκτελείται σε ένα νήμα υποδοχής αλληλεπιδράει με τον " +"χρόνο εκτέλεσης της Python, καλεί την Python στο πλαίσιο ενός συγκεκριμένου " +"διερμηνέα." + +#: reference/executionmodel.rst:526 +msgid "" +"The term \"interpreter\" here is not the same as the \"bytecode " +"interpreter\", which is what regularly runs in threads, executing compiled " +"Python code." +msgstr "" +"Ο όρος \"διερμηνέας\" εδώ δεν είναι ο ίδιος με τον \"διερμηνέα bytecode\", " +"που είναι αυτός που εκτελείται τακτικά σε νήματα, εκτελώντας μεταγλωττισμένο " +"κώδικα Python." + +#: reference/executionmodel.rst:530 +msgid "" +"In an ideal world, \"Python runtime\" would refer to what we currently call " +"\"interpreter\". However, it's been called \"interpreter\" at least since " +"introduced in 1997 (`CPython:a027efa5b`_)." +msgstr "" +"Σε έναν ιδανικό κόσμο, ο όρος \"χρόνος εκτέλεσης της Python\" θα αναφερόταν " +"σε αυτό που τώρα ονομάζουμε \"διερμηνέα\". Ωστόσο, έχει ονομαστεί " +"\"διερμηνέας\" τουλάχιστον από την εισαγωγή του το 1997 (`CPython:" +"a027efa5b`_)." + +#: reference/executionmodel.rst:536 +msgid "" +"Each interpreter completely encapsulates all of the non-process-global, non-" +"thread-specific state needed for the Python runtime to work. Notably, the " +"interpreter's state persists between uses. It includes fundamental data " +"like :data:`sys.modules`. The runtime ensures multiple threads using the " +"same interpreter will safely share it between them." +msgstr "" +"Κάθε διερμηνέας ενσωματώνει πλήρως όλη την κατάσταση που δεν είναι παγκόσμια " +"για τη διαδικασία και δεν είναι ειδική για το νήμα που χρειάζεται ο χρόνος " +"εκτέλεσης της Python για να λειτουργήσει. Σημαντικά, η κατάσταση του " +"διερμηνέα διατηρείται μεταξύ των χρήσεων. Περιλαμβάνει θεμελιώδη δεδομένα " +"όπως το :data:`sys.modules`. Ο χρόνος εκτέλεσης διασφαλίζει ότι πολλαπλά " +"νήματα που χρησιμοποιούν τον ίδιο διερμηνέα θα τον μοιράζονται με ασφάλεια " +"μεταξύ τους." + +#: reference/executionmodel.rst:543 +msgid "" +"A Python implementation may support using multiple interpreters at the same " +"time in the same process. They are independent and isolated from one " +"another. For example, each interpreter has its own :data:`sys.modules`." +msgstr "" +"Μια υλοποίηση της Python μπορεί να υποστηρίζει τη χρήση πολλαπλών διερμηνέων " +"ταυτόχρονα στην ίδια διαδικασία. Είναι ανεξάρτητοι και απομονωμένοι ο ένας " +"από τον άλλον. Για παράδειγμα, κάθε διερμηνέας έχει το δικό του :data:`sys." +"modules`." + +#: reference/executionmodel.rst:548 +msgid "" +"For thread-specific runtime state, each interpreter has a set of thread " +"states, which it manages, in the same way the global runtime contains a set " +"of interpreters. It can have thread states for as many host threads as it " +"needs. It may even have multiple thread states for the same host thread, " +"though that isn't as common." +msgstr "" +"Για το χρόνο εκτέλεσης ειδικό για τα νήματα, κάθε διερμηνέας έχει ένα σύνολο " +"καταστάσεων νημάτων, τις οποίες διαχειρίζεται, με τον ίδιο τρόπο που ο " +"παγκόσμιος χρόνος εκτέλεσης περιέχει ένα σύνολο διερμηνέων. Μπορεί να έχει " +"καταστάσεις νημάτων για όσα νήματα υποδοχής χρειάζεται. Μπορεί ακόμη και να " +"έχει πολλαπλές καταστάσεις νημάτων για το ίδιο νήμα υποδοχής, αν και αυτό " +"δεν είναι τόσο συνηθισμένο." + +#: reference/executionmodel.rst:554 +msgid "" +"Each thread state, conceptually, has all the thread-specific runtime data an " +"interpreter needs to operate in one host thread. The thread state includes " +"the current raised exception and the thread's Python call stack. It may " +"include other thread-specific resources." +msgstr "" +"Κάθε κατάσταση νήματος, εννοιολογικά, έχει όλα τα δεδομένα χρόνου εκτέλεσης " +"ειδικά για το νήμα που χρειάζεται ένας διερμηνέας για να λειτουργήσει σε ένα " +"νήμα υποδοχής. Η κατάσταση νήματος περιλαμβάνει την τρέχουσα εξαίρεση που " +"έγινε raise και τη στοίβα κλήσεων Python του νήματος. Μπορεί να περιλαμβάνει " +"και άλλους πόρους ειδικούς για το νήμα." + +#: reference/executionmodel.rst:561 +msgid "" +"The term \"Python thread\" can sometimes refer to a thread state, but " +"normally it means a thread created using the :mod:`threading` module." +msgstr "" +"Ο όρος \"νήμα Python\" μπορεί μερικές φορές να αναφέρεται σε μια κατάσταση " +"νήματος, αλλά συνήθως σημαίνει ένα νήμα που δημιουργείται χρησιμοποιώντας το " +"module :mod:`threading`." + +#: reference/executionmodel.rst:564 +msgid "" +"Each thread state, over its lifetime, is always tied to exactly one " +"interpreter and exactly one host thread. It will only ever be used in that " +"thread and with that interpreter." +msgstr "" +"Κάθε κατάσταση νήματος, κατά τη διάρκεια της ζωής της, συνδέεται πάντα με " +"ακριβώς έναν διερμηνέα και ακριβώς ένα νήμα υποδοχής. Θα χρησιμοποιηθεί μόνο " +"σε αυτό το νήμα και με αυτόν τον διερμηνέα." + +#: reference/executionmodel.rst:568 +msgid "" +"Multiple thread states may be tied to the same host thread, whether for " +"different interpreters or even the same interpreter. However, for any given " +"host thread, only one of the thread states tied to it can be used by the " +"thread at a time." +msgstr "" +"Πολλαπλές καταστάσεις νημάτων μπορεί να συνδέονται με το ίδιο νήμα υποδοχής, " +"είτε για διαφορετικούς διερμηνείς είτε ακόμη και για τον ίδιο διερμηνέα. " +"Ωστόσο, για οποιοδήποτε δεδομένο νήμα υποδοχής, μόνο μία από τις καταστάσεις " +"νημάτων που συνδέονται με αυτό μπορεί να χρησιμοποιηθεί από το νήμα τη φορά." + +#: reference/executionmodel.rst:573 +msgid "" +"Thread states are isolated and independent from one another and don't share " +"any data, except for possibly sharing an interpreter and objects or other " +"resources belonging to that interpreter." +msgstr "" +"Οι καταστάσεις νημάτων είναι απομονωμένες και ανεξάρτητες η μία από την άλλη " +"και δεν μοιράζονται κανένα δεδομένο, εκτός από το ενδεχόμενο να μοιράζονται " +"έναν διερμηνέα και αντικείμενα ή άλλους πόρους που ανήκουν σε αυτόν τον " +"διερμηνέα." + +#: reference/executionmodel.rst:577 +msgid "" +"Once a program is running, new Python threads can be created using the :mod:" +"`threading` module (on platforms and Python implementations that support " +"threads). Additional processes can be created using the :mod:`os`, :mod:" +"`subprocess`, and :mod:`multiprocessing` modules. Interpreters can be " +"created and used with the :mod:`~concurrent.interpreters` module. " +"Coroutines (async) can be run using :mod:`asyncio` in each interpreter, " +"typically only in a single thread (often the main thread)." +msgstr "" +"Μόλις εκτελείται ένα πρόγραμμα, μπορούν να δημιουργηθούν νέα νήματα Python " +"χρησιμοποιώντας το module :mod:`threading` (σε πλατφόρμες και υλοποιήσεις " +"Python που υποστηρίζουν νήματα). Μπορούν να δημιουργηθούν επιπλέον " +"διαδικασίες χρησιμοποιώντας τα modules :mod:`os`, :mod:`subprocess` και :mod:" +"`multiprocessing`. Οι διερμηνείς μπορούν να δημιουργηθούν και να " +"χρησιμοποιηθούν με το module :mod:`~concurrent.interpreters`. Οι συναρτήσεις-" +"συνεργάτες (async) μπορούν να εκτελεστούν χρησιμοποιώντας το :mod:`asyncio` " +"σε κάθε διερμηνέα, συνήθως μόνο σε ένα νήμα (συχνά το κύριο νήμα)." + +#: reference/executionmodel.rst:588 +msgid "Footnotes" +msgstr "Υποσημειώσεις" + +#: reference/executionmodel.rst:589 msgid "" "This limitation occurs because the code that is executed by these operations " "is not available at the time the module is compiled." msgstr "" +"Αυτός ο περιορισμός προκύπτει επειδή ο κώδικας που εκτελείται από αυτές τις " +"λειτουργίες δεν είναι διαθέσιμος τη στιγμή που το module μεταγλωττίζεται." #: reference/executionmodel.rst:8 msgid "execution model" -msgstr "" +msgstr "μοντέλο εκτέλεσης" #: reference/executionmodel.rst:8 msgid "code" -msgstr "" +msgstr "κώδικας" #: reference/executionmodel.rst:17 msgid "block" -msgstr "" +msgstr "μπλοκ" -#: reference/executionmodel.rst:31 reference/executionmodel.rst:287 +#: reference/executionmodel.rst:31 reference/executionmodel.rst:299 msgid "execution" -msgstr "" +msgstr "εκτέλεση" #: reference/executionmodel.rst:31 msgid "frame" -msgstr "" +msgstr "πλαίσιο" #: reference/executionmodel.rst:42 msgid "namespace" -msgstr "" +msgstr "χώρος ονομάτων" #: reference/executionmodel.rst:42 reference/executionmodel.rst:103 msgid "scope" -msgstr "" +msgstr "πεδίο" #: reference/executionmodel.rst:51 msgid "name" -msgstr "" +msgstr "όνομα" #: reference/executionmodel.rst:51 msgid "binding" -msgstr "" +msgstr "σύνδεση" #: reference/executionmodel.rst:57 msgid "from" -msgstr "" +msgstr "από" #: reference/executionmodel.rst:57 msgid "import statement" -msgstr "" +msgstr "δήλωση εισαγωγής" #: reference/executionmodel.rst:87 msgid "free" -msgstr "" +msgstr "ελεύθερη" #: reference/executionmodel.rst:87 msgid "variable" -msgstr "" +msgstr "μεταβλητή" #: reference/executionmodel.rst:111 msgid "environment" -msgstr "" +msgstr "περιβάλλον" #: reference/executionmodel.rst:117 msgid "NameError (built-in exception)" -msgstr "" +msgstr "NameError (ενσωματωμένη εξαίρεση)" #: reference/executionmodel.rst:117 msgid "UnboundLocalError" -msgstr "" +msgstr "UnboundLocalError" -#: reference/executionmodel.rst:157 +#: reference/executionmodel.rst:158 msgid "module" -msgstr "" +msgstr "module" -#: reference/executionmodel.rst:157 +#: reference/executionmodel.rst:158 msgid "__main__" -msgstr "" +msgstr "__main__" -#: reference/executionmodel.rst:287 +#: reference/executionmodel.rst:299 msgid "restricted" -msgstr "" +msgstr "περιορισμένη" -#: reference/executionmodel.rst:334 +#: reference/executionmodel.rst:349 msgid "exception" -msgstr "" +msgstr "εξαίρεση" -#: reference/executionmodel.rst:336 +#: reference/executionmodel.rst:351 msgid "raise an exception" -msgstr "" +msgstr "κάνει raise μια εξαίρεση" -#: reference/executionmodel.rst:336 +#: reference/executionmodel.rst:351 msgid "handle an exception" -msgstr "" +msgstr "διαχειρίζεται μια εξαίρεση" -#: reference/executionmodel.rst:336 +#: reference/executionmodel.rst:351 msgid "exception handler" -msgstr "" +msgstr "διαχειριστής εξαιρέσεων" -#: reference/executionmodel.rst:336 +#: reference/executionmodel.rst:351 msgid "errors" -msgstr "" +msgstr "σφάλματα" -#: reference/executionmodel.rst:336 +#: reference/executionmodel.rst:351 msgid "error handling" -msgstr "" +msgstr "διαχείριση σφαλμάτων" -#: reference/executionmodel.rst:357 +#: reference/executionmodel.rst:372 msgid "termination model" -msgstr "" +msgstr "μοντέλο τερματισμού" -#: reference/executionmodel.rst:364 +#: reference/executionmodel.rst:379 msgid "SystemExit (built-in exception)" -msgstr "" +msgstr "SystemExit (ενσωματωμένη εξαίρεση)" diff --git a/reference/expressions.po b/reference/expressions.po index c45978ab..5144ebe3 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -45,55 +46,54 @@ msgstr "" #: reference/expressions.rst:30 msgid "" "When a description of an arithmetic operator below uses the phrase \"the " -"numeric arguments are converted to a common type\", this means that the " +"numeric arguments are converted to a common real type\", this means that the " "operator implementation for built-in types works as follows:" msgstr "" #: reference/expressions.rst:34 -msgid "" -"If either argument is a complex number, the other is converted to complex;" +msgid "If both arguments are complex numbers, no conversion is performed;" msgstr "" #: reference/expressions.rst:36 msgid "" -"otherwise, if either argument is a floating point number, the other is " -"converted to floating point;" +"if either argument is a complex or a floating-point number, the other is " +"converted to a floating-point number;" msgstr "" -#: reference/expressions.rst:39 +#: reference/expressions.rst:38 msgid "otherwise, both must be integers and no conversion is necessary." msgstr "" -#: reference/expressions.rst:41 +#: reference/expressions.rst:40 msgid "" "Some additional rules apply for certain operators (e.g., a string as a left " "argument to the '%' operator). Extensions must define their own conversion " "behavior." msgstr "" -#: reference/expressions.rst:49 +#: reference/expressions.rst:48 msgid "Atoms" msgstr "" -#: reference/expressions.rst:53 +#: reference/expressions.rst:52 msgid "" "Atoms are the most basic elements of expressions. The simplest atoms are " "identifiers or literals. Forms enclosed in parentheses, brackets or braces " "are also categorized syntactically as atoms. The syntax for atoms is:" msgstr "" -#: reference/expressions.rst:66 +#: reference/expressions.rst:65 msgid "Identifiers (Names)" msgstr "" -#: reference/expressions.rst:70 +#: reference/expressions.rst:69 msgid "" "An identifier occurring as an atom is a name. See section :ref:" "`identifiers` for lexical definition and section :ref:`naming` for " "documentation of naming and binding." msgstr "" -#: reference/expressions.rst:76 +#: reference/expressions.rst:75 msgid "" "When the name is bound to an object, evaluation of the atom yields that " "object. When a name is not bound, an attempt to evaluate it raises a :exc:" @@ -101,38 +101,94 @@ msgid "" msgstr "" #: reference/expressions.rst:86 +msgid "Private name mangling" +msgstr "" + +#: reference/expressions.rst:88 msgid "" -"**Private name mangling:** When an identifier that textually occurs in a " -"class definition begins with two or more underscore characters and does not " -"end in two or more underscores, it is considered a :dfn:`private name` of " -"that class. Private names are transformed to a longer form before code is " -"generated for them. The transformation inserts the class name, with leading " -"underscores removed and a single underscore inserted, in front of the name. " -"For example, the identifier ``__spam`` occurring in a class named ``Ham`` " -"will be transformed to ``_Ham__spam``. This transformation is independent " -"of the syntactical context in which the identifier is used. If the " -"transformed name is extremely long (longer than 255 characters), " -"implementation defined truncation may happen. If the class name consists " -"only of underscores, no transformation is done." -msgstr "" - -#: reference/expressions.rst:102 -msgid "Literals" +"When an identifier that textually occurs in a class definition begins with " +"two or more underscore characters and does not end in two or more " +"underscores, it is considered a :dfn:`private name` of that class." +msgstr "" + +#: reference/expressions.rst:94 +msgid "The :ref:`class specifications `." +msgstr "" + +#: reference/expressions.rst:96 +msgid "" +"More precisely, private names are transformed to a longer form before code " +"is generated for them. If the transformed name is longer than 255 " +"characters, implementation-defined truncation may happen." +msgstr "" + +#: reference/expressions.rst:100 +msgid "" +"The transformation is independent of the syntactical context in which the " +"identifier is used but only the following private identifiers are mangled:" +msgstr "" + +#: reference/expressions.rst:103 +msgid "" +"Any name used as the name of a variable that is assigned or read or any name " +"of an attribute being accessed." msgstr "" #: reference/expressions.rst:106 +msgid "" +"The :attr:`~definition.__name__` attribute of nested functions, classes, and " +"type aliases is however not mangled." +msgstr "" + +#: reference/expressions.rst:109 +msgid "" +"The name of imported modules, e.g., ``__spam`` in ``import __spam``. If the " +"module is part of a package (i.e., its name contains a dot), the name is " +"*not* mangled, e.g., the ``__foo`` in ``import __foo.bar`` is not mangled." +msgstr "" + +#: reference/expressions.rst:114 +msgid "" +"The name of an imported member, e.g., ``__f`` in ``from spam import __f``." +msgstr "" + +#: reference/expressions.rst:116 +msgid "The transformation rule is defined as follows:" +msgstr "" + +#: reference/expressions.rst:118 +msgid "" +"The class name, with leading underscores removed and a single leading " +"underscore inserted, is inserted in front of the identifier, e.g., the " +"identifier ``__spam`` occurring in a class named ``Foo``, ``_Foo`` or " +"``__Foo`` is transformed to ``_Foo__spam``." +msgstr "" + +#: reference/expressions.rst:123 +msgid "" +"If the class name consists only of underscores, the transformation is the " +"identity, e.g., the identifier ``__spam`` occurring in a class named ``_`` " +"or ``__`` is left as is." +msgstr "" + +#: reference/expressions.rst:130 +msgid "Literals" +msgstr "" + +#: reference/expressions.rst:134 msgid "Python supports string and bytes literals and various numeric literals:" msgstr "" -#: reference/expressions.rst:112 +#: reference/expressions.rst:141 msgid "" "Evaluation of a literal yields an object of the given type (string, bytes, " -"integer, floating point number, complex number) with the given value. The " -"value may be approximated in the case of floating point and imaginary " -"(complex) literals. See section :ref:`literals` for details." +"integer, floating-point number, complex number) with the given value. The " +"value may be approximated in the case of floating-point and imaginary " +"(complex) literals. See section :ref:`literals` for details. See section :" +"ref:`string-concatenation` for details on ``strings``." msgstr "" -#: reference/expressions.rst:121 +#: reference/expressions.rst:153 msgid "" "All literals correspond to immutable data types, and hence the object's " "identity is less important than its value. Multiple evaluations of literals " @@ -141,30 +197,106 @@ msgid "" "the same value." msgstr "" -#: reference/expressions.rst:131 +#: reference/expressions.rst:163 +msgid "String literal concatenation" +msgstr "" + +#: reference/expressions.rst:165 +msgid "" +"Multiple adjacent string or bytes literals (delimited by whitespace), " +"possibly using different quoting conventions, are allowed, and their meaning " +"is the same as their concatenation::" +msgstr "" + +#: reference/expressions.rst:169 +msgid "" +">>> \"hello\" 'world'\n" +"\"helloworld\"" +msgstr "" + +#: reference/expressions.rst:172 +msgid "Formally:" +msgstr "" + +#: reference/expressions.rst:179 +msgid "" +"This feature is defined at the syntactical level, so it only works with " +"literals. To concatenate string expressions at run time, the '+' operator " +"may be used::" +msgstr "" + +#: reference/expressions.rst:182 +msgid "" +">>> greeting = \"Hello\"\n" +">>> space = \" \"\n" +">>> name = \"Blaise\"\n" +">>> print(greeting + space + name) # not: print(greeting space name)\n" +"Hello Blaise" +msgstr "" + +#: reference/expressions.rst:188 +msgid "" +"Literal concatenation can freely mix raw strings, triple-quoted strings, and " +"formatted string literals. For example::" +msgstr "" + +#: reference/expressions.rst:192 +msgid "" +">>> \"Hello\" r', ' f\"{name}!\"\n" +"\"Hello, Blaise!\"" +msgstr "" + +#: reference/expressions.rst:195 +msgid "" +"This feature can be used to reduce the number of backslashes needed, to " +"split long strings conveniently across long lines, or even to add comments " +"to parts of strings. For example::" +msgstr "" + +#: reference/expressions.rst:199 +msgid "" +"re.compile(\"[A-Za-z_]\" # letter or underscore\n" +" \"[A-Za-z0-9_]*\" # letter, digit or underscore\n" +" )" +msgstr "" + +#: reference/expressions.rst:203 +msgid "" +"However, bytes literals may only be combined with other byte literals; not " +"with string literals of any kind. Also, template string literals may only be " +"combined with other template string literals::" +msgstr "" + +#: reference/expressions.rst:208 +msgid "" +">>> t\"Hello\" t\"{name}!\"\n" +"Template(strings=('Hello', '!'), interpolations=(...))" +msgstr "" + +#: reference/expressions.rst:215 msgid "Parenthesized forms" msgstr "" -#: reference/expressions.rst:137 +#: reference/expressions.rst:221 msgid "" "A parenthesized form is an optional expression list enclosed in parentheses:" msgstr "" -#: reference/expressions.rst:142 +#: reference/expressions.rst:226 msgid "" "A parenthesized expression list yields whatever that expression list yields: " "if the list contains at least one comma, it yields a tuple; otherwise, it " "yields the single expression that makes up the expression list." msgstr "" -#: reference/expressions.rst:148 +#: reference/expressions.rst:232 msgid "" "An empty pair of parentheses yields an empty tuple object. Since tuples are " "immutable, the same rules as for literals apply (i.e., two occurrences of " "the empty tuple may or may not yield the same object)." msgstr "" -#: reference/expressions.rst:156 +#: reference/expressions.rst:240 msgid "" "Note that tuples are not formed by the parentheses, but rather by use of the " "comma. The exception is the empty tuple, for which parentheses *are* " @@ -172,31 +304,31 @@ msgid "" "ambiguities and allow common typos to pass uncaught." msgstr "" -#: reference/expressions.rst:165 +#: reference/expressions.rst:249 msgid "Displays for lists, sets and dictionaries" msgstr "" -#: reference/expressions.rst:169 +#: reference/expressions.rst:253 msgid "" "For constructing a list, a set or a dictionary Python provides special " "syntax called \"displays\", each of them in two flavors:" msgstr "" -#: reference/expressions.rst:172 +#: reference/expressions.rst:256 msgid "either the container contents are listed explicitly, or" msgstr "" -#: reference/expressions.rst:174 +#: reference/expressions.rst:258 msgid "" "they are computed via a set of looping and filtering instructions, called a :" "dfn:`comprehension`." msgstr "" -#: reference/expressions.rst:182 +#: reference/expressions.rst:266 msgid "Common syntax elements for comprehensions are:" msgstr "" -#: reference/expressions.rst:190 +#: reference/expressions.rst:274 msgid "" "The comprehension consists of a single expression followed by at least one :" "keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!if` " @@ -206,7 +338,7 @@ msgid "" "expression to produce an element each time the innermost block is reached." msgstr "" -#: reference/expressions.rst:197 +#: reference/expressions.rst:281 msgid "" "However, aside from the iterable expression in the leftmost :keyword:`!for` " "clause, the comprehension is executed in a separate implicitly nested scope. " @@ -214,7 +346,7 @@ msgid "" "the enclosing scope." msgstr "" -#: reference/expressions.rst:201 +#: reference/expressions.rst:285 msgid "" "The iterable expression in the leftmost :keyword:`!for` clause is evaluated " "directly in the enclosing scope and then passed as an argument to the " @@ -224,52 +356,58 @@ msgid "" "iterable. For example: ``[x*y for x in range(10) for y in range(x, x+10)]``." msgstr "" -#: reference/expressions.rst:208 +#: reference/expressions.rst:292 msgid "" "To ensure the comprehension always results in a container of the appropriate " "type, ``yield`` and ``yield from`` expressions are prohibited in the " "implicitly nested scope." msgstr "" -#: reference/expressions.rst:215 +#: reference/expressions.rst:299 msgid "" "Since Python 3.6, in an :keyword:`async def` function, an :keyword:`!async " "for` clause may be used to iterate over a :term:`asynchronous iterator`. A " "comprehension in an :keyword:`!async def` function may consist of either a :" "keyword:`!for` or :keyword:`!async for` clause following the leading " "expression, may contain additional :keyword:`!for` or :keyword:`!async for` " -"clauses, and may also use :keyword:`await` expressions. If a comprehension " -"contains either :keyword:`!async for` clauses or :keyword:`!await` " -"expressions or other asynchronous comprehensions it is called an :dfn:" -"`asynchronous comprehension`. An asynchronous comprehension may suspend the " -"execution of the coroutine function in which it appears. See also :pep:`530`." +"clauses, and may also use :keyword:`await` expressions." msgstr "" -#: reference/expressions.rst:227 +#: reference/expressions.rst:306 +msgid "" +"If a comprehension contains :keyword:`!async for` clauses, or if it " +"contains :keyword:`!await` expressions or other asynchronous comprehensions " +"anywhere except the iterable expression in the leftmost :keyword:`!for` " +"clause, it is called an :dfn:`asynchronous comprehension`. An asynchronous " +"comprehension may suspend the execution of the coroutine function in which " +"it appears. See also :pep:`530`." +msgstr "" + +#: reference/expressions.rst:313 msgid "Asynchronous comprehensions were introduced." msgstr "" -#: reference/expressions.rst:408 +#: reference/expressions.rst:495 msgid "``yield`` and ``yield from`` prohibited in the implicitly nested scope." msgstr "" -#: reference/expressions.rst:233 +#: reference/expressions.rst:319 msgid "" "Asynchronous comprehensions are now allowed inside comprehensions in " "asynchronous functions. Outer comprehensions implicitly become asynchronous." msgstr "" -#: reference/expressions.rst:242 +#: reference/expressions.rst:328 msgid "List displays" msgstr "" -#: reference/expressions.rst:252 +#: reference/expressions.rst:338 msgid "" "A list display is a possibly empty series of expressions enclosed in square " "brackets:" msgstr "" -#: reference/expressions.rst:258 +#: reference/expressions.rst:344 msgid "" "A list display yields a new list object, the contents being specified by " "either a list of expressions or a comprehension. When a comma-separated " @@ -279,17 +417,17 @@ msgid "" "comprehension." msgstr "" -#: reference/expressions.rst:268 +#: reference/expressions.rst:354 msgid "Set displays" msgstr "" -#: reference/expressions.rst:277 +#: reference/expressions.rst:363 msgid "" "A set display is denoted by curly braces and distinguishable from dictionary " "displays by the lack of colons separating keys and values:" msgstr "" -#: reference/expressions.rst:283 +#: reference/expressions.rst:369 msgid "" "A set display yields a new mutable set object, the contents being specified " "by either a sequence of expressions or a comprehension. When a comma-" @@ -299,27 +437,27 @@ msgid "" "comprehension." msgstr "" -#: reference/expressions.rst:289 +#: reference/expressions.rst:375 msgid "" "An empty set cannot be constructed with ``{}``; this literal constructs an " "empty dictionary." msgstr "" -#: reference/expressions.rst:296 +#: reference/expressions.rst:382 msgid "Dictionary displays" msgstr "" -#: reference/expressions.rst:307 +#: reference/expressions.rst:393 msgid "" "A dictionary display is a possibly empty series of dict items (key/value " "pairs) enclosed in curly braces:" msgstr "" -#: reference/expressions.rst:316 +#: reference/expressions.rst:402 msgid "A dictionary display yields a new dictionary object." msgstr "" -#: reference/expressions.rst:318 +#: reference/expressions.rst:404 msgid "" "If a comma-separated sequence of dict items is given, they are evaluated " "from left to right to define the entries of the dictionary: each key object " @@ -329,7 +467,7 @@ msgid "" "given." msgstr "" -#: reference/expressions.rst:328 +#: reference/expressions.rst:414 msgid "" "A double asterisk ``**`` denotes :dfn:`dictionary unpacking`. Its operand " "must be a :term:`mapping`. Each mapping item is added to the new " @@ -337,11 +475,11 @@ msgid "" "and earlier dictionary unpackings." msgstr "" -#: reference/expressions.rst:333 +#: reference/expressions.rst:419 msgid "Unpacking into dictionary displays, originally proposed by :pep:`448`." msgstr "" -#: reference/expressions.rst:336 +#: reference/expressions.rst:422 msgid "" "A dict comprehension, in contrast to list and set comprehensions, needs two " "expressions separated with a colon followed by the usual \"for\" and \"if\" " @@ -349,7 +487,7 @@ msgid "" "are inserted in the new dictionary in the order they are produced." msgstr "" -#: reference/expressions.rst:344 +#: reference/expressions.rst:430 msgid "" "Restrictions on the types of the key values are listed earlier in section :" "ref:`types`. (To summarize, the key type should be :term:`hashable`, which " @@ -358,7 +496,7 @@ msgid "" "given key value prevails." msgstr "" -#: reference/expressions.rst:350 +#: reference/expressions.rst:436 msgid "" "Prior to Python 3.8, in dict comprehensions, the evaluation order of key and " "value was not well-defined. In CPython, the value was evaluated before the " @@ -366,49 +504,50 @@ msgid "" "by :pep:`572`." msgstr "" -#: reference/expressions.rst:360 +#: reference/expressions.rst:446 msgid "Generator expressions" msgstr "" -#: reference/expressions.rst:367 +#: reference/expressions.rst:453 msgid "A generator expression is a compact generator notation in parentheses:" msgstr "" -#: reference/expressions.rst:372 +#: reference/expressions.rst:458 msgid "" "A generator expression yields a new generator object. Its syntax is the " "same as for comprehensions, except that it is enclosed in parentheses " "instead of brackets or curly braces." msgstr "" -#: reference/expressions.rst:376 +#: reference/expressions.rst:462 msgid "" "Variables used in the generator expression are evaluated lazily when the :" "meth:`~generator.__next__` method is called for the generator object (in the " "same fashion as normal generators). However, the iterable expression in the " -"leftmost :keyword:`!for` clause is immediately evaluated, so that an error " -"produced by it will be emitted at the point where the generator expression " -"is defined, rather than at the point where the first value is retrieved. " -"Subsequent :keyword:`!for` clauses and any filter condition in the leftmost :" -"keyword:`!for` clause cannot be evaluated in the enclosing scope as they may " -"depend on the values obtained from the leftmost iterable. For example: " -"``(x*y for x in range(10) for y in range(x, x+10))``." +"leftmost :keyword:`!for` clause is immediately evaluated, and the :term:" +"`iterator` is immediately created for that iterable, so that an error " +"produced while creating the iterator will be emitted at the point where the " +"generator expression is defined, rather than at the point where the first " +"value is retrieved. Subsequent :keyword:`!for` clauses and any filter " +"condition in the leftmost :keyword:`!for` clause cannot be evaluated in the " +"enclosing scope as they may depend on the values obtained from the leftmost " +"iterable. For example: ``(x*y for x in range(10) for y in range(x, x+10))``." msgstr "" -#: reference/expressions.rst:387 +#: reference/expressions.rst:474 msgid "" "The parentheses can be omitted on calls with only one argument. See " "section :ref:`calls` for details." msgstr "" -#: reference/expressions.rst:390 +#: reference/expressions.rst:477 msgid "" "To avoid interfering with the expected operation of the generator expression " "itself, ``yield`` and ``yield from`` expressions are prohibited in the " "implicitly defined generator." msgstr "" -#: reference/expressions.rst:394 +#: reference/expressions.rst:481 msgid "" "If a generator expression contains either :keyword:`!async for` clauses or :" "keyword:`await` expressions it is called an :dfn:`asynchronous generator " @@ -417,22 +556,22 @@ msgid "" "`async-iterators`)." msgstr "" -#: reference/expressions.rst:400 +#: reference/expressions.rst:487 msgid "Asynchronous generator expressions were introduced." msgstr "" -#: reference/expressions.rst:403 +#: reference/expressions.rst:490 msgid "" "Prior to Python 3.7, asynchronous generator expressions could only appear " "in :keyword:`async def` coroutines. Starting with 3.7, any function can use " "asynchronous generator expressions." msgstr "" -#: reference/expressions.rst:415 +#: reference/expressions.rst:502 msgid "Yield expressions" msgstr "" -#: reference/expressions.rst:428 +#: reference/expressions.rst:515 msgid "" "The yield expression is used when defining a :term:`generator` function or " "an :term:`asynchronous generator` function and thus can only be used in the " @@ -442,36 +581,45 @@ msgid "" "asynchronous generator function. For example::" msgstr "" -#: reference/expressions.rst:441 +#: reference/expressions.rst:522 +msgid "" +"def gen(): # defines a generator function\n" +" yield 123\n" +"\n" +"async def agen(): # defines an asynchronous generator function\n" +" yield 123" +msgstr "" + +#: reference/expressions.rst:528 msgid "" "Due to their side effects on the containing scope, ``yield`` expressions are " "not permitted as part of the implicitly defined scopes used to implement " "comprehensions and generator expressions." msgstr "" -#: reference/expressions.rst:445 +#: reference/expressions.rst:532 msgid "" "Yield expressions prohibited in the implicitly nested scopes used to " "implement comprehensions and generator expressions." msgstr "" -#: reference/expressions.rst:449 +#: reference/expressions.rst:536 msgid "" "Generator functions are described below, while asynchronous generator " "functions are described separately in section :ref:`asynchronous-generator-" "functions`." msgstr "" -#: reference/expressions.rst:453 +#: reference/expressions.rst:540 msgid "" "When a generator function is called, it returns an iterator known as a " "generator. That generator then controls the execution of the generator " "function. The execution starts when one of the generator's methods is " "called. At that time, the execution proceeds to the first yield expression, " "where it is suspended again, returning the value of :token:`~python-grammar:" -"expression_list` to the generator's caller, or ``None`` if :token:`~python-" -"grammar:expression_list` is omitted. By suspended, we mean that all local " -"state is retained, including the current bindings of local variables, the " +"yield_list` to the generator's caller, or ``None`` if :token:`~python-" +"grammar:yield_list` is omitted. By suspended, we mean that all local state " +"is retained, including the current bindings of local variables, the " "instruction pointer, the internal evaluation stack, and the state of any " "exception handling. When the execution is resumed by calling one of the " "generator's methods, the function can proceed exactly as if the yield " @@ -483,7 +631,7 @@ msgid "" "be the value passed in to that method." msgstr "" -#: reference/expressions.rst:473 +#: reference/expressions.rst:560 msgid "" "All of this makes generator functions quite similar to coroutines; they " "yield multiple times, they have more than one entry point and their " @@ -492,7 +640,7 @@ msgid "" "the control is always transferred to the generator's caller." msgstr "" -#: reference/expressions.rst:479 +#: reference/expressions.rst:566 msgid "" "Yield expressions are allowed anywhere in a :keyword:`try` construct. If " "the generator is not resumed before it is finalized (by reaching a zero " @@ -501,7 +649,7 @@ msgid "" "`finally` clauses to execute." msgstr "" -#: reference/expressions.rst:488 +#: reference/expressions.rst:575 msgid "" "When ``yield from `` is used, the supplied expression must be an " "iterable. The values produced by iterating that iterable are passed directly " @@ -513,7 +661,7 @@ msgid "" "will just raise the passed in exception immediately." msgstr "" -#: reference/expressions.rst:497 +#: reference/expressions.rst:584 msgid "" "When the underlying iterator is complete, the :attr:`~StopIteration.value` " "attribute of the raised :exc:`StopIteration` instance becomes the value of " @@ -522,91 +670,91 @@ msgid "" "returning a value from the subgenerator)." msgstr "" -#: reference/expressions.rst:503 +#: reference/expressions.rst:590 msgid "Added ``yield from `` to delegate control flow to a subiterator." msgstr "" -#: reference/expressions.rst:506 +#: reference/expressions.rst:593 msgid "" "The parentheses may be omitted when the yield expression is the sole " "expression on the right hand side of an assignment statement." msgstr "" -#: reference/expressions.rst:512 +#: reference/expressions.rst:598 msgid ":pep:`255` - Simple Generators" msgstr "" -#: reference/expressions.rst:512 +#: reference/expressions.rst:599 msgid "" "The proposal for adding generators and the :keyword:`yield` statement to " "Python." msgstr "" -#: reference/expressions.rst:516 +#: reference/expressions.rst:601 msgid ":pep:`342` - Coroutines via Enhanced Generators" msgstr "" -#: reference/expressions.rst:515 +#: reference/expressions.rst:602 msgid "" "The proposal to enhance the API and syntax of generators, making them usable " "as simple coroutines." msgstr "" -#: reference/expressions.rst:520 +#: reference/expressions.rst:605 msgid ":pep:`380` - Syntax for Delegating to a Subgenerator" msgstr "" -#: reference/expressions.rst:519 +#: reference/expressions.rst:606 msgid "" "The proposal to introduce the :token:`~python-grammar:yield_from` syntax, " "making delegation to subgenerators easy." msgstr "" -#: reference/expressions.rst:523 +#: reference/expressions.rst:609 msgid ":pep:`525` - Asynchronous Generators" msgstr "" -#: reference/expressions.rst:523 +#: reference/expressions.rst:610 msgid "" "The proposal that expanded on :pep:`492` by adding generator capabilities to " "coroutine functions." msgstr "" -#: reference/expressions.rst:530 +#: reference/expressions.rst:617 msgid "Generator-iterator methods" msgstr "" -#: reference/expressions.rst:532 +#: reference/expressions.rst:619 msgid "" "This subsection describes the methods of a generator iterator. They can be " "used to control the execution of a generator function." msgstr "" -#: reference/expressions.rst:535 +#: reference/expressions.rst:622 msgid "" "Note that calling any of the generator methods below when the generator is " "already executing raises a :exc:`ValueError` exception." msgstr "" -#: reference/expressions.rst:543 +#: reference/expressions.rst:630 msgid "" "Starts the execution of a generator function or resumes it at the last " "executed yield expression. When a generator function is resumed with a :" "meth:`~generator.__next__` method, the current yield expression always " "evaluates to :const:`None`. The execution then continues to the next yield " "expression, where the generator is suspended again, and the value of the :" -"token:`~python-grammar:expression_list` is returned to :meth:`__next__`'s " +"token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " "caller. If the generator exits without yielding another value, a :exc:" "`StopIteration` exception is raised." msgstr "" -#: reference/expressions.rst:552 +#: reference/expressions.rst:639 msgid "" "This method is normally called implicitly, e.g. by a :keyword:`for` loop, or " "by the built-in :func:`next` function." msgstr "" -#: reference/expressions.rst:558 +#: reference/expressions.rst:645 msgid "" "Resumes the execution and \"sends\" a value into the generator function. " "The *value* argument becomes the result of the current yield expression. " @@ -617,7 +765,7 @@ msgid "" "expression that could receive the value." msgstr "" -#: reference/expressions.rst:570 +#: reference/expressions.rst:657 msgid "" "Raises an exception at the point where the generator was paused, and returns " "the next value yielded by the generator function. If the generator exits " @@ -626,13 +774,13 @@ msgid "" "a different exception, then that exception propagates to the caller." msgstr "" -#: reference/expressions.rst:576 +#: reference/expressions.rst:663 msgid "" "In typical use, this is called with a single exception instance similar to " "the way the :keyword:`raise` keyword is used." msgstr "" -#: reference/expressions.rst:579 +#: reference/expressions.rst:666 msgid "" "For backwards compatibility, however, the second signature is supported, " "following a convention from older versions of Python. The *type* argument " @@ -643,51 +791,89 @@ msgid "" "*value* may be cleared." msgstr "" -#: reference/expressions.rst:764 +#: reference/expressions.rst:863 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: reference/expressions.rst:598 +#: reference/expressions.rst:685 msgid "" -"Raises a :exc:`GeneratorExit` at the point where the generator function was " -"paused. If the generator function then exits gracefully, is already closed, " -"or raises :exc:`GeneratorExit` (by not catching the exception), close " -"returns to its caller. If the generator yields a value, a :exc:" +"Raises a :exc:`GeneratorExit` exception at the point where the generator " +"function was paused (equivalent to calling ``throw(GeneratorExit)``). The " +"exception is raised by the yield expression where the generator was paused. " +"If the generator function catches the exception and returns a value, this " +"value is returned from :meth:`close`. If the generator function is already " +"closed, or raises :exc:`GeneratorExit` (by not catching the exception), :" +"meth:`close` returns :const:`None`. If the generator yields a value, a :exc:" "`RuntimeError` is raised. If the generator raises any other exception, it " -"is propagated to the caller. :meth:`close` does nothing if the generator " -"has already exited due to an exception or normal exit." +"is propagated to the caller. If the generator has already exited due to an " +"exception or normal exit, :meth:`close` returns :const:`None` and has no " +"other effect." msgstr "" -#: reference/expressions.rst:609 +#: reference/expressions.rst:699 +msgid "" +"If a generator returns a value upon being closed, the value is returned by :" +"meth:`close`." +msgstr "" + +#: reference/expressions.rst:705 msgid "Examples" msgstr "" -#: reference/expressions.rst:611 +#: reference/expressions.rst:707 msgid "" "Here is a simple example that demonstrates the behavior of generators and " "generator functions::" msgstr "" -#: reference/expressions.rst:638 +#: reference/expressions.rst:710 +msgid "" +">>> def echo(value=None):\n" +"... print(\"Execution starts when 'next()' is called for the first time." +"\")\n" +"... try:\n" +"... while True:\n" +"... try:\n" +"... value = (yield value)\n" +"... except Exception as e:\n" +"... value = e\n" +"... finally:\n" +"... print(\"Don't forget to clean up when 'close()' is called.\")\n" +"...\n" +">>> generator = echo(1)\n" +">>> print(next(generator))\n" +"Execution starts when 'next()' is called for the first time.\n" +"1\n" +">>> print(next(generator))\n" +"None\n" +">>> print(generator.send(2))\n" +"2\n" +">>> generator.throw(TypeError, \"spam\")\n" +"TypeError('spam',)\n" +">>> generator.close()\n" +"Don't forget to clean up when 'close()' is called." +msgstr "" + +#: reference/expressions.rst:734 msgid "" "For examples using ``yield from``, see :ref:`pep-380` in \"What's New in " "Python.\"" msgstr "" -#: reference/expressions.rst:644 +#: reference/expressions.rst:740 msgid "Asynchronous generator functions" msgstr "" -#: reference/expressions.rst:646 +#: reference/expressions.rst:742 msgid "" "The presence of a yield expression in a function or method defined using :" "keyword:`async def` further defines the function as an :term:`asynchronous " "generator` function." msgstr "" -#: reference/expressions.rst:650 +#: reference/expressions.rst:746 msgid "" "When an asynchronous generator function is called, it returns an " "asynchronous iterator known as an asynchronous generator object. That object " @@ -697,26 +883,25 @@ msgid "" "keyword:`for` statement." msgstr "" -#: reference/expressions.rst:657 +#: reference/expressions.rst:753 msgid "" "Calling one of the asynchronous generator's methods returns an :term:" "`awaitable` object, and the execution starts when this object is awaited on. " "At that time, the execution proceeds to the first yield expression, where it " "is suspended again, returning the value of :token:`~python-grammar:" -"expression_list` to the awaiting coroutine. As with a generator, suspension " -"means that all local state is retained, including the current bindings of " -"local variables, the instruction pointer, the internal evaluation stack, and " -"the state of any exception handling. When the execution is resumed by " -"awaiting on the next object returned by the asynchronous generator's " -"methods, the function can proceed exactly as if the yield expression were " -"just another external call. The value of the yield expression after resuming " -"depends on the method which resumed the execution. If :meth:`~agen." -"__anext__` is used then the result is :const:`None`. Otherwise, if :meth:" -"`~agen.asend` is used, then the result will be the value passed in to that " -"method." +"yield_list` to the awaiting coroutine. As with a generator, suspension means " +"that all local state is retained, including the current bindings of local " +"variables, the instruction pointer, the internal evaluation stack, and the " +"state of any exception handling. When the execution is resumed by awaiting " +"on the next object returned by the asynchronous generator's methods, the " +"function can proceed exactly as if the yield expression were just another " +"external call. The value of the yield expression after resuming depends on " +"the method which resumed the execution. If :meth:`~agen.__anext__` is used " +"then the result is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, " +"then the result will be the value passed in to that method." msgstr "" -#: reference/expressions.rst:672 +#: reference/expressions.rst:768 msgid "" "If an asynchronous generator happens to exit early by :keyword:`break`, the " "caller task being cancelled, or other exceptions, the generator's async " @@ -728,7 +913,7 @@ msgid "" "generator and ultimately detach it from the event loop." msgstr "" -#: reference/expressions.rst:682 +#: reference/expressions.rst:778 msgid "" "In an asynchronous generator function, yield expressions are allowed " "anywhere in a :keyword:`try` construct. However, if an asynchronous " @@ -742,7 +927,7 @@ msgid "" "finally` clauses to execute." msgstr "" -#: reference/expressions.rst:693 +#: reference/expressions.rst:789 msgid "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" @@ -755,30 +940,30 @@ msgid "" "asyncio/base_events.py`." msgstr "" -#: reference/expressions.rst:702 +#: reference/expressions.rst:798 msgid "" "The expression ``yield from `` is a syntax error when used in an " "asynchronous generator function." msgstr "" -#: reference/expressions.rst:709 +#: reference/expressions.rst:805 msgid "Asynchronous generator-iterator methods" msgstr "" -#: reference/expressions.rst:711 +#: reference/expressions.rst:807 msgid "" "This subsection describes the methods of an asynchronous generator iterator, " "which are used to control the execution of a generator function." msgstr "" -#: reference/expressions.rst:719 +#: reference/expressions.rst:816 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " "asynchronous generator function is resumed with an :meth:`~agen.__anext__` " "method, the current yield expression always evaluates to :const:`None` in " "the returned awaitable, which when run will continue to the next yield " -"expression. The value of the :token:`~python-grammar:expression_list` of the " +"expression. The value of the :token:`~python-grammar:yield_list` of the " "yield expression is the value of the :exc:`StopIteration` exception raised " "by the completing coroutine. If the asynchronous generator exits without " "yielding another value, the awaitable instead raises a :exc:" @@ -786,15 +971,15 @@ msgid "" "has completed." msgstr "" -#: reference/expressions.rst:731 +#: reference/expressions.rst:828 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: reference/expressions.rst:736 +#: reference/expressions.rst:834 msgid "" "Returns an awaitable which when run resumes the execution of the " -"asynchronous generator. As with the :meth:`~generator.send()` method for a " +"asynchronous generator. As with the :meth:`~generator.send` method for a " "generator, this \"sends\" a value into the asynchronous generator function, " "and the *value* argument becomes the result of the current yield expression. " "The awaitable returned by the :meth:`asend` method will return the next " @@ -806,7 +991,7 @@ msgid "" "receive the value." msgstr "" -#: reference/expressions.rst:752 +#: reference/expressions.rst:851 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " @@ -818,7 +1003,7 @@ msgid "" "that exception propagates to the caller of the awaitable." msgstr "" -#: reference/expressions.rst:772 +#: reference/expressions.rst:872 msgid "" "Returns an awaitable that when run will throw a :exc:`GeneratorExit` into " "the asynchronous generator function at the point where it was paused. If the " @@ -834,25 +1019,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: reference/expressions.rst:788 +#: reference/expressions.rst:888 msgid "Primaries" msgstr "" -#: reference/expressions.rst:792 +#: reference/expressions.rst:892 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: reference/expressions.rst:802 +#: reference/expressions.rst:902 msgid "Attribute references" msgstr "" -#: reference/expressions.rst:808 +#: reference/expressions.rst:908 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: reference/expressions.rst:818 +#: reference/expressions.rst:918 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -861,7 +1046,7 @@ msgid "" "reference may yield different objects." msgstr "" -#: reference/expressions.rst:824 +#: reference/expressions.rst:924 msgid "" "This production can be customized by overriding the :meth:`~object." "__getattribute__` method or the :meth:`~object.__getattr__` method. The :" @@ -869,17 +1054,17 @@ msgid "" "or raises :exc:`AttributeError` if the attribute is not available." msgstr "" -#: reference/expressions.rst:830 +#: reference/expressions.rst:930 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" -#: reference/expressions.rst:836 +#: reference/expressions.rst:936 msgid "Subscriptions" msgstr "" -#: reference/expressions.rst:851 +#: reference/expressions.rst:951 msgid "" "The subscription of an instance of a :ref:`container class ` " "will generally select an element from the container. The subscription of a :" @@ -887,13 +1072,13 @@ msgid "" "`GenericAlias ` object." msgstr "" -#: reference/expressions.rst:859 +#: reference/expressions.rst:959 msgid "" "When an object is subscripted, the interpreter will evaluate the primary and " "the expression list." msgstr "" -#: reference/expressions.rst:862 +#: reference/expressions.rst:962 msgid "" "The primary must evaluate to an object that supports subscription. An object " "may support subscription through defining one or both of :meth:`~object." @@ -903,20 +1088,25 @@ msgid "" "called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." msgstr "" -#: reference/expressions.rst:869 +#: reference/expressions.rst:969 msgid "" -"If the expression list contains at least one comma, it will evaluate to a :" -"class:`tuple` containing the items of the expression list. Otherwise, the " +"If the expression list contains at least one comma, or if any of the " +"expressions are starred, the expression list will evaluate to a :class:" +"`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: reference/expressions.rst:873 +#: reference/expressions.rst:974 +msgid "Expressions in an expression list may be starred. See :pep:`646`." +msgstr "" + +#: reference/expressions.rst:977 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: reference/expressions.rst:876 +#: reference/expressions.rst:980 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -924,7 +1114,7 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: reference/expressions.rst:880 +#: reference/expressions.rst:984 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " @@ -932,7 +1122,7 @@ msgid "" "`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: reference/expressions.rst:885 +#: reference/expressions.rst:989 msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences `. However, built-in sequences all provide a :meth:" @@ -946,25 +1136,25 @@ msgid "" "explicitly add that support." msgstr "" -#: reference/expressions.rst:899 +#: reference/expressions.rst:1003 msgid "" "A :class:`string ` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: reference/expressions.rst:907 +#: reference/expressions.rst:1011 msgid "Slicings" msgstr "" -#: reference/expressions.rst:921 +#: reference/expressions.rst:1025 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: reference/expressions.rst:934 +#: reference/expressions.rst:1038 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -974,7 +1164,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: reference/expressions.rst:946 +#: reference/expressions.rst:1050 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -989,23 +1179,23 @@ msgid "" "missing expressions." msgstr "" -#: reference/expressions.rst:970 +#: reference/expressions.rst:1074 msgid "Calls" msgstr "" -#: reference/expressions.rst:972 +#: reference/expressions.rst:1076 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments `:" msgstr "" -#: reference/expressions.rst:989 +#: reference/expressions.rst:1093 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: reference/expressions.rst:995 +#: reference/expressions.rst:1099 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1015,7 +1205,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: reference/expressions.rst:1003 +#: reference/expressions.rst:1107 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1036,7 +1226,7 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: reference/expressions.rst:1023 +#: reference/expressions.rst:1127 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1045,7 +1235,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: reference/expressions.rst:1029 +#: reference/expressions.rst:1133 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1054,7 +1244,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: reference/expressions.rst:1035 +#: reference/expressions.rst:1139 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1064,7 +1254,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: reference/expressions.rst:1046 +#: reference/expressions.rst:1150 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1074,20 +1264,35 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: reference/expressions.rst:1053 +#: reference/expressions.rst:1157 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: reference/expressions.rst:1069 +#: reference/expressions.rst:1161 +msgid "" +">>> def f(a, b):\n" +"... print(a, b)\n" +"...\n" +">>> f(b=1, *(2,))\n" +"2 1\n" +">>> f(a=1, *(2,))\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: f() got multiple values for keyword argument 'a'\n" +">>> f(1, *(2,))\n" +"1 2" +msgstr "" + +#: reference/expressions.rst:1173 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: reference/expressions.rst:1075 +#: reference/expressions.rst:1179 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1096,7 +1301,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: reference/expressions.rst:1081 +#: reference/expressions.rst:1185 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1108,110 +1313,112 @@ msgid "" "is raised." msgstr "" -#: reference/expressions.rst:1091 +#: reference/expressions.rst:1195 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: reference/expressions.rst:1094 +#: reference/expressions.rst:1198 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: reference/expressions.rst:1100 +#: reference/expressions.rst:1204 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: reference/expressions.rst:1104 +#: reference/expressions.rst:1208 msgid "If it is---" msgstr "" -#: reference/expressions.rst:1117 +#: reference/expressions.rst:1210 msgid "a user-defined function:" msgstr "" -#: reference/expressions.rst:1113 +#: reference/expressions.rst:1217 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " "arguments; this is described in section :ref:`function`. When the code " "block executes a :keyword:`return` statement, this specifies the return " -"value of the function call." +"value of the function call. If execution reaches the end of the code block " +"without executing a :keyword:`return` statement, the return value is " +"``None``." msgstr "" -#: reference/expressions.rst:1131 +#: reference/expressions.rst:1224 msgid "a built-in function or method:" msgstr "" -#: reference/expressions.rst:1130 +#: reference/expressions.rst:1235 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: reference/expressions.rst:1138 +#: reference/expressions.rst:1238 msgid "a class object:" msgstr "" -#: reference/expressions.rst:1138 +#: reference/expressions.rst:1243 msgid "A new instance of that class is returned." msgstr "" -#: reference/expressions.rst:1148 +#: reference/expressions.rst:1245 msgid "a class instance method:" msgstr "" -#: reference/expressions.rst:1146 +#: reference/expressions.rst:1251 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: reference/expressions.rst:1157 +#: reference/expressions.rst:1255 msgid "a class instance:" msgstr "" -#: reference/expressions.rst:1155 +#: reference/expressions.rst:1260 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: reference/expressions.rst:1946 +#: reference/expressions.rst:2082 msgid "Await expression" msgstr "" -#: reference/expressions.rst:1165 +#: reference/expressions.rst:1270 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: reference/expressions.rst:1177 +#: reference/expressions.rst:1282 msgid "The power operator" msgstr "" -#: reference/expressions.rst:1183 +#: reference/expressions.rst:1288 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: reference/expressions.rst:1189 +#: reference/expressions.rst:1294 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: reference/expressions.rst:1193 +#: reference/expressions.rst:1298 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1219,7 +1426,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: reference/expressions.rst:1198 +#: reference/expressions.rst:1303 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1227,41 +1434,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: reference/expressions.rst:1203 +#: reference/expressions.rst:1308 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: reference/expressions.rst:1207 +#: reference/expressions.rst:1312 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " -"method." +"and :meth:`~object.__rpow__` methods." msgstr "" -#: reference/expressions.rst:1212 +#: reference/expressions.rst:1318 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: reference/expressions.rst:1218 +#: reference/expressions.rst:1324 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: reference/expressions.rst:1229 +#: reference/expressions.rst:1335 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: reference/expressions.rst:1237 +#: reference/expressions.rst:1343 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: reference/expressions.rst:1244 +#: reference/expressions.rst:1350 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1269,17 +1476,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: reference/expressions.rst:1253 +#: reference/expressions.rst:1359 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: reference/expressions.rst:1260 +#: reference/expressions.rst:1366 msgid "Binary arithmetic operations" msgstr "" -#: reference/expressions.rst:1264 +#: reference/expressions.rst:1370 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1287,29 +1494,41 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: reference/expressions.rst:1279 +#: reference/expressions.rst:1385 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " "integer and the other must be a sequence. In the former case, the numbers " -"are converted to a common type and then multiplied together. In the latter " -"case, sequence repetition is performed; a negative repetition factor yields " -"an empty sequence." +"are converted to a common real type and then multiplied together. In the " +"latter case, sequence repetition is performed; a negative repetition factor " +"yields an empty sequence." msgstr "" -#: reference/expressions.rst:1285 +#: reference/expressions.rst:1391 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: reference/expressions.rst:1292 +#: reference/expressions.rst:1471 reference/expressions.rst:1486 +msgid "" +"If only one operand is a complex number, the other operand is converted to a " +"floating-point number." +msgstr "" + +#: reference/expressions.rst:1402 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: reference/expressions.rst:1303 +#: reference/expressions.rst:1405 +msgid "" +"This operation can be customized using the special :meth:`~object." +"__matmul__` and :meth:`~object.__rmatmul__` methods." +msgstr "" + +#: reference/expressions.rst:1416 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1319,25 +1538,27 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: reference/expressions.rst:1310 +#: reference/expressions.rst:1423 msgid "" -"This operation can be customized using the special :meth:`~object." -"__truediv__` and :meth:`~object.__floordiv__` methods." +"The division operation can be customized using the special :meth:`~object." +"__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " +"operation can be customized using the special :meth:`~object.__floordiv__` " +"and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: reference/expressions.rst:1317 +#: reference/expressions.rst:1432 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " "a common type. A zero right argument raises the :exc:`ZeroDivisionError` " -"exception. The arguments may be floating point numbers, e.g., ``3.14%0.7`` " +"exception. The arguments may be floating-point numbers, e.g., ``3.14%0.7`` " "equals ``0.34`` (since ``3.14`` equals ``4*0.7 + 0.34``.) The modulo " "operator always yields a result with the same sign as its second operand (or " "zero); the absolute value of the result is strictly smaller than the " "absolute value of the second operand [#]_." msgstr "" -#: reference/expressions.rst:1326 +#: reference/expressions.rst:1441 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1345,7 +1566,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: reference/expressions.rst:1331 +#: reference/expressions.rst:1446 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1354,106 +1575,108 @@ msgid "" "formatting`." msgstr "" -#: reference/expressions.rst:1336 +#: reference/expressions.rst:1451 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." -"__mod__` method." +"__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: reference/expressions.rst:1338 +#: reference/expressions.rst:1454 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " -"floating point number using the :func:`abs` function if appropriate." +"floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: reference/expressions.rst:1347 +#: reference/expressions.rst:1463 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " -"type. In the former case, the numbers are converted to a common type and " -"then added together. In the latter case, the sequences are concatenated." +"type. In the former case, the numbers are converted to a common real type " +"and then added together. In the latter case, the sequences are concatenated." msgstr "" -#: reference/expressions.rst:1352 +#: reference/expressions.rst:1468 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: reference/expressions.rst:1360 +#: reference/expressions.rst:1480 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " -"The numeric arguments are first converted to a common type." +"The numeric arguments are first converted to a common real type." msgstr "" -#: reference/expressions.rst:1363 +#: reference/expressions.rst:1483 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " -"method." +"and :meth:`~object.__rsub__` methods." msgstr "" -#: reference/expressions.rst:1369 +#: reference/expressions.rst:1494 msgid "Shifting operations" msgstr "" -#: reference/expressions.rst:1376 +#: reference/expressions.rst:1501 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: reference/expressions.rst:1381 +#: reference/expressions.rst:1506 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: reference/expressions.rst:1384 +#: reference/expressions.rst:1509 msgid "" -"This operation can be customized using the special :meth:`~object." -"__lshift__` and :meth:`~object.__rshift__` methods." +"The left shift operation can be customized using the special :meth:`~object." +"__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " +"operation can be customized using the special :meth:`~object.__rshift__` " +"and :meth:`~object.__rrshift__` methods." msgstr "" -#: reference/expressions.rst:1389 +#: reference/expressions.rst:1516 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: reference/expressions.rst:1396 +#: reference/expressions.rst:1523 msgid "Binary bitwise operations" msgstr "" -#: reference/expressions.rst:1400 +#: reference/expressions.rst:1527 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: reference/expressions.rst:1411 +#: reference/expressions.rst:1538 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: reference/expressions.rst:1420 +#: reference/expressions.rst:1547 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: reference/expressions.rst:1429 +#: reference/expressions.rst:1556 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: reference/expressions.rst:1437 +#: reference/expressions.rst:1564 msgid "Comparisons" msgstr "" -#: reference/expressions.rst:1449 +#: reference/expressions.rst:1576 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1461,14 +1684,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: reference/expressions.rst:1459 +#: reference/expressions.rst:1586 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: reference/expressions.rst:1465 +#: reference/expressions.rst:1592 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1476,7 +1699,7 @@ msgid "" "false)." msgstr "" -#: reference/expressions.rst:1469 +#: reference/expressions.rst:1596 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1484,24 +1707,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: reference/expressions.rst:1474 +#: reference/expressions.rst:1601 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: reference/expressions.rst:1481 +#: reference/expressions.rst:1608 msgid "Value comparisons" msgstr "" -#: reference/expressions.rst:1483 +#: reference/expressions.rst:1610 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: reference/expressions.rst:1486 +#: reference/expressions.rst:1613 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1513,7 +1736,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: reference/expressions.rst:1495 +#: reference/expressions.rst:1622 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1521,7 +1744,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: reference/expressions.rst:1501 +#: reference/expressions.rst:1628 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1531,14 +1754,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: reference/expressions.rst:1508 +#: reference/expressions.rst:1635 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: reference/expressions.rst:1512 +#: reference/expressions.rst:1639 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1547,13 +1770,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: reference/expressions.rst:1518 +#: reference/expressions.rst:1645 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: reference/expressions.rst:1521 +#: reference/expressions.rst:1648 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1563,7 +1786,7 @@ msgid "" "of precision." msgstr "" -#: reference/expressions.rst:1528 +#: reference/expressions.rst:1655 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1573,32 +1796,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: reference/expressions.rst:1535 +#: reference/expressions.rst:1662 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: reference/expressions.rst:1539 +#: reference/expressions.rst:1666 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: reference/expressions.rst:1543 +#: reference/expressions.rst:1670 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: reference/expressions.rst:1547 +#: reference/expressions.rst:1674 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: reference/expressions.rst:1549 +#: reference/expressions.rst:1676 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1607,7 +1830,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: reference/expressions.rst:1555 +#: reference/expressions.rst:1682 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1615,19 +1838,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: reference/expressions.rst:1560 +#: reference/expressions.rst:1687 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: reference/expressions.rst:1562 +#: reference/expressions.rst:1689 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: reference/expressions.rst:1567 +#: reference/expressions.rst:1694 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1636,25 +1859,25 @@ msgid "" "true)." msgstr "" -#: reference/expressions.rst:1573 +#: reference/expressions.rst:1700 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: reference/expressions.rst:1577 +#: reference/expressions.rst:1704 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: reference/expressions.rst:1579 +#: reference/expressions.rst:1706 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: reference/expressions.rst:1582 +#: reference/expressions.rst:1709 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1665,110 +1888,110 @@ msgid "" "sets as inputs)." msgstr "" -#: reference/expressions.rst:1590 +#: reference/expressions.rst:1717 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: reference/expressions.rst:1592 +#: reference/expressions.rst:1719 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: reference/expressions.rst:1595 +#: reference/expressions.rst:1722 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: reference/expressions.rst:1598 +#: reference/expressions.rst:1725 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: reference/expressions.rst:1601 +#: reference/expressions.rst:1728 msgid "``x is y`` implies ``x == y``" msgstr "" -#: reference/expressions.rst:1603 +#: reference/expressions.rst:1730 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: reference/expressions.rst:1606 +#: reference/expressions.rst:1733 msgid "``x == y`` and ``y == x``" msgstr "" -#: reference/expressions.rst:1608 +#: reference/expressions.rst:1735 msgid "``x != y`` and ``y != x``" msgstr "" -#: reference/expressions.rst:1610 +#: reference/expressions.rst:1737 msgid "``x < y`` and ``y > x``" msgstr "" -#: reference/expressions.rst:1612 +#: reference/expressions.rst:1739 msgid "``x <= y`` and ``y >= x``" msgstr "" -#: reference/expressions.rst:1614 +#: reference/expressions.rst:1741 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: reference/expressions.rst:1617 +#: reference/expressions.rst:1744 msgid "``x > y and y > z`` implies ``x > z``" msgstr "" -#: reference/expressions.rst:1619 +#: reference/expressions.rst:1746 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "" -#: reference/expressions.rst:1621 +#: reference/expressions.rst:1748 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: reference/expressions.rst:1624 +#: reference/expressions.rst:1751 msgid "``x == y`` and ``not x != y``" msgstr "" -#: reference/expressions.rst:1626 +#: reference/expressions.rst:1753 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: reference/expressions.rst:1628 +#: reference/expressions.rst:1755 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: reference/expressions.rst:1630 +#: reference/expressions.rst:1757 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: reference/expressions.rst:1634 +#: reference/expressions.rst:1761 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: reference/expressions.rst:1638 +#: reference/expressions.rst:1765 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: reference/expressions.rst:1647 +#: reference/expressions.rst:1774 msgid "Membership test operations" msgstr "" -#: reference/expressions.rst:1649 +#: reference/expressions.rst:1776 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1779,7 +2002,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: reference/expressions.rst:1657 +#: reference/expressions.rst:1784 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1787,14 +2010,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: reference/expressions.rst:1662 +#: reference/expressions.rst:1789 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: reference/expressions.rst:1666 +#: reference/expressions.rst:1793 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1803,7 +2026,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: reference/expressions.rst:1672 +#: reference/expressions.rst:1799 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -1812,17 +2035,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: reference/expressions.rst:1684 +#: reference/expressions.rst:1811 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: reference/expressions.rst:1697 +#: reference/expressions.rst:1824 msgid "Identity comparisons" msgstr "" -#: reference/expressions.rst:1699 +#: reference/expressions.rst:1826 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1830,11 +2053,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: reference/expressions.rst:1711 +#: reference/expressions.rst:1838 msgid "Boolean operations" msgstr "" -#: reference/expressions.rst:1722 +#: reference/expressions.rst:1849 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1845,25 +2068,25 @@ msgid "" "__bool__` method." msgstr "" -#: reference/expressions.rst:1731 +#: reference/expressions.rst:1858 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: reference/expressions.rst:1736 +#: reference/expressions.rst:1863 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: reference/expressions.rst:1741 +#: reference/expressions.rst:1868 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: reference/expressions.rst:1744 +#: reference/expressions.rst:1871 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -1874,11 +2097,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: reference/expressions.rst:1760 +#: reference/expressions.rst:1890 msgid "Assignment expressions" msgstr "" -#: reference/expressions.rst:1765 +#: reference/expressions.rst:1895 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -1886,15 +2109,27 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: reference/expressions.rst:1770 +#: reference/expressions.rst:1900 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: reference/expressions.rst:1777 +#: reference/expressions.rst:1902 +msgid "" +"if matching := pattern.search(data):\n" +" do_something(matching)" +msgstr "" + +#: reference/expressions.rst:1907 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: reference/expressions.rst:1784 +#: reference/expressions.rst:1909 +msgid "" +"while chunk := file.read(9000):\n" +" process(chunk)" +msgstr "" + +#: reference/expressions.rst:1914 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -1904,36 +2139,37 @@ msgid "" "and ``while`` statements." msgstr "" -#: reference/expressions.rst:1792 +#: reference/expressions.rst:1922 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: reference/expressions.rst:1799 +#: reference/expressions.rst:1929 msgid "Conditional expressions" msgstr "" -#: reference/expressions.rst:1811 +#: reference/expressions.rst:1941 msgid "" -"Conditional expressions (sometimes called a \"ternary operator\") have the " -"lowest priority of all Python operations." +"A conditional expression (sometimes called a \"ternary operator\") is an " +"alternative to the if-else statement. As it is an expression, it returns a " +"value and can appear as a sub-expression." msgstr "" -#: reference/expressions.rst:1814 +#: reference/expressions.rst:1945 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: reference/expressions.rst:1818 +#: reference/expressions.rst:1949 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: reference/expressions.rst:1825 +#: reference/expressions.rst:1956 msgid "Lambdas" msgstr "" -#: reference/expressions.rst:1836 +#: reference/expressions.rst:1967 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -1941,25 +2177,31 @@ msgid "" "defined with:" msgstr "" -#: reference/expressions.rst:1845 +#: reference/expressions.rst:1971 +msgid "" +"def (parameters):\n" +" return expression" +msgstr "" + +#: reference/expressions.rst:1976 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: reference/expressions.rst:1853 +#: reference/expressions.rst:1984 msgid "Expression lists" msgstr "" -#: reference/expressions.rst:1867 +#: reference/expressions.rst:2000 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: reference/expressions.rst:1876 +#: reference/expressions.rst:2009 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -1967,12 +2209,16 @@ msgid "" "unpacking." msgstr "" -#: reference/expressions.rst:1881 +#: reference/expressions.rst:2014 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: reference/expressions.rst:1886 +#: reference/expressions.rst:2017 +msgid "Any item in an expression list may be starred. See :pep:`646`." +msgstr "" + +#: reference/expressions.rst:2022 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -1981,28 +2227,38 @@ msgid "" "``()``.)" msgstr "" -#: reference/expressions.rst:1897 +#: reference/expressions.rst:2033 msgid "Evaluation order" msgstr "" -#: reference/expressions.rst:1901 +#: reference/expressions.rst:2037 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: reference/expressions.rst:1904 +#: reference/expressions.rst:2040 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: reference/expressions.rst:1918 +#: reference/expressions.rst:2043 +msgid "" +"expr1, expr2, expr3, expr4\n" +"(expr1, expr2, expr3, expr4)\n" +"{expr1: expr2, expr3: expr4}\n" +"expr1 + expr2 * (expr3 - expr4)\n" +"expr1(expr2, expr3, *expr4, **expr5)\n" +"expr3, expr4 = expr1, expr2" +msgstr "" + +#: reference/expressions.rst:2054 msgid "Operator precedence" msgstr "" -#: reference/expressions.rst:1923 +#: reference/expressions.rst:2059 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2012,176 +2268,176 @@ msgid "" "group from right to left)." msgstr "" -#: reference/expressions.rst:1929 +#: reference/expressions.rst:2065 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: reference/expressions.rst:1935 +#: reference/expressions.rst:2071 msgid "Operator" msgstr "" -#: reference/expressions.rst:1935 +#: reference/expressions.rst:2071 msgid "Description" msgstr "" -#: reference/expressions.rst:1937 +#: reference/expressions.rst:2073 msgid "``(expressions...)``," msgstr "" -#: reference/expressions.rst:1939 +#: reference/expressions.rst:2075 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "" -#: reference/expressions.rst:1937 +#: reference/expressions.rst:2073 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: reference/expressions.rst:1943 +#: reference/expressions.rst:2079 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "" -#: reference/expressions.rst:1943 +#: reference/expressions.rst:2079 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: reference/expressions.rst:1946 +#: reference/expressions.rst:2082 msgid ":keyword:`await x `" msgstr "" -#: reference/expressions.rst:1948 +#: reference/expressions.rst:2084 msgid "``**``" msgstr "" -#: reference/expressions.rst:1948 +#: reference/expressions.rst:2084 msgid "Exponentiation [#]_" msgstr "" -#: reference/expressions.rst:1950 +#: reference/expressions.rst:2086 msgid "``+x``, ``-x``, ``~x``" msgstr "" -#: reference/expressions.rst:1950 +#: reference/expressions.rst:2086 msgid "Positive, negative, bitwise NOT" msgstr "" -#: reference/expressions.rst:1952 +#: reference/expressions.rst:2088 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "" -#: reference/expressions.rst:1952 +#: reference/expressions.rst:2088 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: reference/expressions.rst:1956 +#: reference/expressions.rst:2092 msgid "``+``, ``-``" msgstr "" -#: reference/expressions.rst:1956 +#: reference/expressions.rst:2092 msgid "Addition and subtraction" msgstr "" -#: reference/expressions.rst:1958 +#: reference/expressions.rst:2094 msgid "``<<``, ``>>``" msgstr "" -#: reference/expressions.rst:1958 +#: reference/expressions.rst:2094 msgid "Shifts" msgstr "" -#: reference/expressions.rst:1960 +#: reference/expressions.rst:2096 msgid "``&``" msgstr "" -#: reference/expressions.rst:1960 +#: reference/expressions.rst:2096 msgid "Bitwise AND" msgstr "" -#: reference/expressions.rst:1962 +#: reference/expressions.rst:2098 msgid "``^``" msgstr "" -#: reference/expressions.rst:1962 +#: reference/expressions.rst:2098 msgid "Bitwise XOR" msgstr "" -#: reference/expressions.rst:1964 +#: reference/expressions.rst:2100 msgid "``|``" msgstr "" -#: reference/expressions.rst:1964 +#: reference/expressions.rst:2100 msgid "Bitwise OR" msgstr "" -#: reference/expressions.rst:1966 +#: reference/expressions.rst:2102 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: reference/expressions.rst:1966 +#: reference/expressions.rst:2102 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: reference/expressions.rst:1970 +#: reference/expressions.rst:2106 msgid ":keyword:`not x `" msgstr "" -#: reference/expressions.rst:1970 +#: reference/expressions.rst:2106 msgid "Boolean NOT" msgstr "" -#: reference/expressions.rst:1972 +#: reference/expressions.rst:2108 msgid ":keyword:`and`" msgstr "" -#: reference/expressions.rst:1972 +#: reference/expressions.rst:2108 msgid "Boolean AND" msgstr "" -#: reference/expressions.rst:1974 +#: reference/expressions.rst:2110 msgid ":keyword:`or`" msgstr "" -#: reference/expressions.rst:1974 +#: reference/expressions.rst:2110 msgid "Boolean OR" msgstr "" -#: reference/expressions.rst:1976 +#: reference/expressions.rst:2112 msgid ":keyword:`if ` -- :keyword:`!else`" msgstr "" -#: reference/expressions.rst:1976 +#: reference/expressions.rst:2112 msgid "Conditional expression" msgstr "" -#: reference/expressions.rst:1978 +#: reference/expressions.rst:2114 msgid ":keyword:`lambda`" msgstr "" -#: reference/expressions.rst:1978 +#: reference/expressions.rst:2114 msgid "Lambda expression" msgstr "" -#: reference/expressions.rst:1980 +#: reference/expressions.rst:2116 msgid "``:=``" msgstr "" -#: reference/expressions.rst:1980 +#: reference/expressions.rst:2116 msgid "Assignment expression" msgstr "" -#: reference/expressions.rst:1985 +#: reference/expressions.rst:2121 msgid "Footnotes" msgstr "" -#: reference/expressions.rst:1986 +#: reference/expressions.rst:2122 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2193,7 +2449,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: reference/expressions.rst:1995 +#: reference/expressions.rst:2131 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2201,7 +2457,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: reference/expressions.rst:2000 +#: reference/expressions.rst:2136 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2215,7 +2471,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: reference/expressions.rst:2011 +#: reference/expressions.rst:2147 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2223,13 +2479,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: reference/expressions.rst:2016 +#: reference/expressions.rst:2152 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: reference/expressions.rst:2019 +#: reference/expressions.rst:2155 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2237,20 +2493,20 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: reference/expressions.rst:2024 +#: reference/expressions.rst:2160 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: reference/expressions.rst:2027 +#: reference/expressions.rst:2163 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" -#: reference/expressions.rst:362 reference/expressions.rst:1713 -#: reference/expressions.rst:1827 reference/expressions.rst:1855 +#: reference/expressions.rst:448 reference/expressions.rst:1840 +#: reference/expressions.rst:1931 reference/expressions.rst:1986 msgid "expression" msgstr "" @@ -2258,7 +2514,7 @@ msgstr "" msgid "BNF" msgstr "" -#: reference/expressions.rst:1214 reference/expressions.rst:1262 +#: reference/expressions.rst:1320 reference/expressions.rst:1368 msgid "arithmetic" msgstr "" @@ -2266,710 +2522,714 @@ msgstr "" msgid "conversion" msgstr "" -#: reference/expressions.rst:51 +#: reference/expressions.rst:50 msgid "atom" msgstr "" -#: reference/expressions.rst:82 +#: reference/expressions.rst:81 msgid "name" msgstr "" -#: reference/expressions.rst:68 +#: reference/expressions.rst:67 msgid "identifier" msgstr "" -#: reference/expressions.rst:538 reference/expressions.rst:715 -#: reference/expressions.rst:813 reference/expressions.rst:1297 -#: reference/expressions.rst:1387 +#: reference/expressions.rst:625 reference/expressions.rst:811 +#: reference/expressions.rst:913 reference/expressions.rst:1410 +#: reference/expressions.rst:1514 msgid "exception" msgstr "" -#: reference/expressions.rst:74 +#: reference/expressions.rst:73 msgid "NameError" msgstr "" -#: reference/expressions.rst:82 +#: reference/expressions.rst:81 msgid "mangling" msgstr "" -#: reference/expressions.rst:82 +#: reference/expressions.rst:81 msgid "private" msgstr "" -#: reference/expressions.rst:82 +#: reference/expressions.rst:81 msgid "names" msgstr "" -#: reference/expressions.rst:104 +#: reference/expressions.rst:132 msgid "literal" msgstr "" -#: reference/expressions.rst:341 +#: reference/expressions.rst:427 msgid "immutable" msgstr "" -#: reference/expressions.rst:117 +#: reference/expressions.rst:149 msgid "data" msgstr "" -#: reference/expressions.rst:117 +#: reference/expressions.rst:149 msgid "type" msgstr "" -#: reference/expressions.rst:244 reference/expressions.rst:298 -#: reference/expressions.rst:362 reference/expressions.rst:705 -#: reference/expressions.rst:842 reference/expressions.rst:959 -#: reference/expressions.rst:1120 reference/expressions.rst:1141 -#: reference/expressions.rst:1865 +#: reference/expressions.rst:330 reference/expressions.rst:384 +#: reference/expressions.rst:448 reference/expressions.rst:801 +#: reference/expressions.rst:942 reference/expressions.rst:1063 +#: reference/expressions.rst:1225 reference/expressions.rst:1246 +#: reference/expressions.rst:1998 msgid "object" msgstr "" -#: reference/expressions.rst:133 +#: reference/expressions.rst:217 msgid "parenthesized form" msgstr "" -#: reference/expressions.rst:362 reference/expressions.rst:959 +#: reference/expressions.rst:448 reference/expressions.rst:1063 msgid "() (parentheses)" msgstr "" -#: reference/expressions.rst:133 +#: reference/expressions.rst:217 msgid "tuple display" msgstr "" -#: reference/expressions.rst:244 +#: reference/expressions.rst:330 msgid "empty" msgstr "" -#: reference/expressions.rst:842 reference/expressions.rst:1865 +#: reference/expressions.rst:942 reference/expressions.rst:1998 msgid "tuple" msgstr "" -#: reference/expressions.rst:1884 +#: reference/expressions.rst:2020 msgid "comma" msgstr "" -#: reference/expressions.rst:244 reference/expressions.rst:298 -#: reference/expressions.rst:959 reference/expressions.rst:1855 +#: reference/expressions.rst:330 reference/expressions.rst:384 +#: reference/expressions.rst:1063 reference/expressions.rst:1986 msgid ", (comma)" msgstr "" -#: reference/expressions.rst:244 reference/expressions.rst:298 +#: reference/expressions.rst:330 reference/expressions.rst:384 msgid "comprehensions" msgstr "" -#: reference/expressions.rst:177 +#: reference/expressions.rst:261 msgid "for" msgstr "" -#: reference/expressions.rst:212 +#: reference/expressions.rst:296 msgid "in comprehensions" msgstr "" -#: reference/expressions.rst:1801 +#: reference/expressions.rst:1931 msgid "if" msgstr "" -#: reference/expressions.rst:177 +#: reference/expressions.rst:261 msgid "async for" msgstr "" -#: reference/expressions.rst:1159 +#: reference/expressions.rst:1264 msgid "await" msgstr "" -#: reference/expressions.rst:813 reference/expressions.rst:915 -#: reference/expressions.rst:1855 +#: reference/expressions.rst:913 reference/expressions.rst:1019 +#: reference/expressions.rst:1986 msgid "list" msgstr "" -#: reference/expressions.rst:270 reference/expressions.rst:298 +#: reference/expressions.rst:356 reference/expressions.rst:384 msgid "display" msgstr "" -#: reference/expressions.rst:838 +#: reference/expressions.rst:938 msgid "[] (square brackets)" msgstr "" -#: reference/expressions.rst:244 +#: reference/expressions.rst:330 msgid "list expression" msgstr "" -#: reference/expressions.rst:270 reference/expressions.rst:1855 +#: reference/expressions.rst:356 reference/expressions.rst:1986 msgid "expression list" msgstr "" -#: reference/expressions.rst:270 +#: reference/expressions.rst:356 msgid "set" msgstr "" -#: reference/expressions.rst:298 +#: reference/expressions.rst:384 msgid "{} (curly brackets)" msgstr "" -#: reference/expressions.rst:270 +#: reference/expressions.rst:356 msgid "set expression" msgstr "" -#: reference/expressions.rst:324 reference/expressions.rst:842 +#: reference/expressions.rst:410 reference/expressions.rst:942 msgid "dictionary" msgstr "" -#: reference/expressions.rst:298 +#: reference/expressions.rst:384 msgid "key" msgstr "" -#: reference/expressions.rst:298 +#: reference/expressions.rst:384 msgid "value" msgstr "" -#: reference/expressions.rst:298 +#: reference/expressions.rst:384 msgid "key/value pair" msgstr "" -#: reference/expressions.rst:298 +#: reference/expressions.rst:384 msgid "dictionary expression" msgstr "" -#: reference/expressions.rst:909 reference/expressions.rst:1827 +#: reference/expressions.rst:1013 reference/expressions.rst:1958 msgid ": (colon)" msgstr "" -#: reference/expressions.rst:298 +#: reference/expressions.rst:384 msgid "in dictionary expressions" msgstr "" -#: reference/expressions.rst:324 +#: reference/expressions.rst:410 msgid "in dictionary displays" msgstr "" -#: reference/expressions.rst:1042 reference/expressions.rst:1872 +#: reference/expressions.rst:1146 reference/expressions.rst:2005 msgid "unpacking" msgstr "" -#: reference/expressions.rst:1072 reference/expressions.rst:1179 +#: reference/expressions.rst:1176 reference/expressions.rst:1284 msgid "**" msgstr "" -#: reference/expressions.rst:341 +#: reference/expressions.rst:427 msgid "hashable" msgstr "" -#: reference/expressions.rst:417 reference/expressions.rst:526 +#: reference/expressions.rst:504 reference/expressions.rst:613 msgid "generator" msgstr "" -#: reference/expressions.rst:362 +#: reference/expressions.rst:448 msgid "generator expression" msgstr "" -#: reference/expressions.rst:1159 +#: reference/expressions.rst:1264 msgid "keyword" msgstr "" -#: reference/expressions.rst:606 +#: reference/expressions.rst:702 msgid "yield" msgstr "" -#: reference/expressions.rst:485 +#: reference/expressions.rst:572 msgid "from" msgstr "" -#: reference/expressions.rst:1107 reference/expressions.rst:1827 +#: reference/expressions.rst:1211 reference/expressions.rst:1958 msgid "function" msgstr "" -#: reference/expressions.rst:471 +#: reference/expressions.rst:558 msgid "coroutine" msgstr "" -#: reference/expressions.rst:485 +#: reference/expressions.rst:572 msgid "yield from expression" msgstr "" -#: reference/expressions.rst:538 +#: reference/expressions.rst:625 msgid "StopIteration" msgstr "" -#: reference/expressions.rst:767 +#: reference/expressions.rst:866 msgid "GeneratorExit" msgstr "" -#: reference/expressions.rst:606 +#: reference/expressions.rst:702 msgid "examples" msgstr "" -#: reference/expressions.rst:705 +#: reference/expressions.rst:801 msgid "asynchronous-generator" msgstr "" -#: reference/expressions.rst:715 +#: reference/expressions.rst:811 msgid "StopAsyncIteration" msgstr "" -#: reference/expressions.rst:790 +#: reference/expressions.rst:890 msgid "primary" msgstr "" -#: reference/expressions.rst:804 +#: reference/expressions.rst:904 msgid "attribute" msgstr "" -#: reference/expressions.rst:804 +#: reference/expressions.rst:904 msgid "reference" msgstr "" -#: reference/expressions.rst:804 +#: reference/expressions.rst:904 msgid ". (dot)" msgstr "" -#: reference/expressions.rst:804 +#: reference/expressions.rst:904 msgid "attribute reference" msgstr "" -#: reference/expressions.rst:813 +#: reference/expressions.rst:913 msgid "AttributeError" msgstr "" -#: reference/expressions.rst:813 +#: reference/expressions.rst:913 msgid "module" msgstr "" -#: reference/expressions.rst:838 +#: reference/expressions.rst:938 msgid "subscription" msgstr "" -#: reference/expressions.rst:915 reference/expressions.rst:1678 +#: reference/expressions.rst:1019 reference/expressions.rst:1805 msgid "sequence" msgstr "" -#: reference/expressions.rst:842 +#: reference/expressions.rst:942 msgid "mapping" msgstr "" -#: reference/expressions.rst:895 reference/expressions.rst:915 +#: reference/expressions.rst:999 reference/expressions.rst:1019 msgid "string" msgstr "" -#: reference/expressions.rst:895 +#: reference/expressions.rst:999 msgid "item" msgstr "" -#: reference/expressions.rst:895 +#: reference/expressions.rst:999 msgid "character" msgstr "" -#: reference/expressions.rst:909 +#: reference/expressions.rst:1013 msgid "slicing" msgstr "" -#: reference/expressions.rst:909 +#: reference/expressions.rst:1013 msgid "slice" msgstr "" -#: reference/expressions.rst:941 +#: reference/expressions.rst:1045 msgid "start (slice object attribute)" msgstr "" -#: reference/expressions.rst:941 +#: reference/expressions.rst:1045 msgid "stop (slice object attribute)" msgstr "" -#: reference/expressions.rst:941 +#: reference/expressions.rst:1045 msgid "step (slice object attribute)" msgstr "" -#: reference/expressions.rst:959 +#: reference/expressions.rst:1063 msgid "callable" msgstr "" -#: reference/expressions.rst:1107 reference/expressions.rst:1134 -#: reference/expressions.rst:1151 +#: reference/expressions.rst:1211 reference/expressions.rst:1239 +#: reference/expressions.rst:1256 msgid "call" msgstr "" -#: reference/expressions.rst:959 +#: reference/expressions.rst:1063 msgid "argument" msgstr "" -#: reference/expressions.rst:992 +#: reference/expressions.rst:1096 msgid "call semantics" msgstr "" -#: reference/expressions.rst:959 +#: reference/expressions.rst:1063 msgid "argument list" msgstr "" -#: reference/expressions.rst:959 +#: reference/expressions.rst:1063 msgid "= (equals)" msgstr "" -#: reference/expressions.rst:1042 reference/expressions.rst:1072 +#: reference/expressions.rst:1146 reference/expressions.rst:1176 msgid "in function calls" msgstr "" -#: reference/expressions.rst:992 +#: reference/expressions.rst:1096 msgid "parameter" msgstr "" -#: reference/expressions.rst:1275 reference/expressions.rst:1872 +#: reference/expressions.rst:1381 reference/expressions.rst:2005 msgid "* (asterisk)" msgstr "" -#: reference/expressions.rst:1107 +#: reference/expressions.rst:1211 msgid "user-defined" msgstr "" -#: reference/expressions.rst:1107 +#: reference/expressions.rst:1211 msgid "user-defined function" msgstr "" -#: reference/expressions.rst:1120 +#: reference/expressions.rst:1225 msgid "built-in function" msgstr "" -#: reference/expressions.rst:1120 +#: reference/expressions.rst:1225 msgid "method" msgstr "" -#: reference/expressions.rst:1120 +#: reference/expressions.rst:1225 msgid "built-in method" msgstr "" -#: reference/expressions.rst:1134 +#: reference/expressions.rst:1239 msgid "class" msgstr "" -#: reference/expressions.rst:1134 +#: reference/expressions.rst:1239 msgid "class object" msgstr "" -#: reference/expressions.rst:1141 +#: reference/expressions.rst:1246 msgid "class instance" msgstr "" -#: reference/expressions.rst:1151 +#: reference/expressions.rst:1256 msgid "instance" msgstr "" -#: reference/expressions.rst:1151 +#: reference/expressions.rst:1256 msgid "__call__() (object method)" msgstr "" -#: reference/expressions.rst:1179 +#: reference/expressions.rst:1284 msgid "power" msgstr "" -#: reference/expressions.rst:1214 reference/expressions.rst:1371 -#: reference/expressions.rst:1713 +#: reference/expressions.rst:1320 reference/expressions.rst:1496 +#: reference/expressions.rst:1840 msgid "operation" msgstr "" -#: reference/expressions.rst:1223 reference/expressions.rst:1240 -#: reference/expressions.rst:1288 reference/expressions.rst:1313 -#: reference/expressions.rst:1355 reference/expressions.rst:1407 -#: reference/expressions.rst:1424 reference/expressions.rst:1678 -#: reference/expressions.rst:1729 reference/expressions.rst:1739 -#: reference/expressions.rst:1920 +#: reference/expressions.rst:1329 reference/expressions.rst:1346 +#: reference/expressions.rst:1398 reference/expressions.rst:1428 +#: reference/expressions.rst:1475 reference/expressions.rst:1534 +#: reference/expressions.rst:1551 reference/expressions.rst:1805 +#: reference/expressions.rst:1856 reference/expressions.rst:1866 +#: reference/expressions.rst:2056 msgid "operator" msgstr "" -#: reference/expressions.rst:1214 +#: reference/expressions.rst:1320 msgid "unary" msgstr "" -#: reference/expressions.rst:1398 reference/expressions.rst:1415 -#: reference/expressions.rst:1424 +#: reference/expressions.rst:1525 reference/expressions.rst:1542 +#: reference/expressions.rst:1551 msgid "bitwise" msgstr "" -#: reference/expressions.rst:1223 +#: reference/expressions.rst:1329 msgid "negation" msgstr "" -#: reference/expressions.rst:1223 +#: reference/expressions.rst:1329 msgid "minus" msgstr "" -#: reference/expressions.rst:1355 +#: reference/expressions.rst:1475 msgid "- (minus)" msgstr "" -#: reference/expressions.rst:1232 +#: reference/expressions.rst:1338 msgid "unary operator" msgstr "" -#: reference/expressions.rst:1232 +#: reference/expressions.rst:1338 msgid "plus" msgstr "" -#: reference/expressions.rst:1342 +#: reference/expressions.rst:1458 msgid "+ (plus)" msgstr "" -#: reference/expressions.rst:1240 +#: reference/expressions.rst:1346 msgid "inversion" msgstr "" -#: reference/expressions.rst:1240 +#: reference/expressions.rst:1346 msgid "~ (tilde)" msgstr "" -#: reference/expressions.rst:1251 +#: reference/expressions.rst:1357 msgid "TypeError" msgstr "" -#: reference/expressions.rst:1398 +#: reference/expressions.rst:1525 msgid "binary" msgstr "" -#: reference/expressions.rst:1275 +#: reference/expressions.rst:1381 msgid "multiplication" msgstr "" -#: reference/expressions.rst:1288 +#: reference/expressions.rst:1398 msgid "matrix multiplication" msgstr "" -#: reference/expressions.rst:1288 +#: reference/expressions.rst:1398 msgid "@ (at)" msgstr "" -#: reference/expressions.rst:1297 +#: reference/expressions.rst:1410 msgid "ZeroDivisionError" msgstr "" -#: reference/expressions.rst:1297 +#: reference/expressions.rst:1410 msgid "division" msgstr "" -#: reference/expressions.rst:1297 +#: reference/expressions.rst:1410 msgid "/ (slash)" msgstr "" -#: reference/expressions.rst:1297 +#: reference/expressions.rst:1410 msgid "//" msgstr "" -#: reference/expressions.rst:1313 +#: reference/expressions.rst:1428 msgid "modulo" msgstr "" -#: reference/expressions.rst:1313 +#: reference/expressions.rst:1428 msgid "% (percent)" msgstr "" -#: reference/expressions.rst:1342 +#: reference/expressions.rst:1458 msgid "addition" msgstr "" -#: reference/expressions.rst:1355 +#: reference/expressions.rst:1475 msgid "binary operator" msgstr "" -#: reference/expressions.rst:1355 +#: reference/expressions.rst:1475 msgid "subtraction" msgstr "" -#: reference/expressions.rst:1371 +#: reference/expressions.rst:1496 msgid "shifting" msgstr "" -#: reference/expressions.rst:1371 +#: reference/expressions.rst:1496 msgid "<<" msgstr "" -#: reference/expressions.rst:1371 +#: reference/expressions.rst:1496 msgid ">>" msgstr "" -#: reference/expressions.rst:1387 +#: reference/expressions.rst:1514 msgid "ValueError" msgstr "" -#: reference/expressions.rst:1734 +#: reference/expressions.rst:1861 msgid "and" msgstr "" -#: reference/expressions.rst:1407 +#: reference/expressions.rst:1534 msgid "& (ampersand)" msgstr "" -#: reference/expressions.rst:1415 +#: reference/expressions.rst:1542 msgid "xor" msgstr "" -#: reference/expressions.rst:1415 +#: reference/expressions.rst:1542 msgid "exclusive" msgstr "" -#: reference/expressions.rst:1424 reference/expressions.rst:1739 +#: reference/expressions.rst:1551 reference/expressions.rst:1866 msgid "or" msgstr "" -#: reference/expressions.rst:1415 +#: reference/expressions.rst:1542 msgid "^ (caret)" msgstr "" -#: reference/expressions.rst:1424 +#: reference/expressions.rst:1551 msgid "inclusive" msgstr "" -#: reference/expressions.rst:1424 +#: reference/expressions.rst:1551 msgid "| (vertical bar)" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid "comparison" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid "C" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid "language" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid "< (less)" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid "> (greater)" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid "<=" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid ">=" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid "==" msgstr "" -#: reference/expressions.rst:1439 +#: reference/expressions.rst:1566 msgid "!=" msgstr "" -#: reference/expressions.rst:1463 +#: reference/expressions.rst:1590 msgid "chaining" msgstr "" -#: reference/expressions.rst:1463 +#: reference/expressions.rst:1590 msgid "comparisons" msgstr "" -#: reference/expressions.rst:1678 +#: reference/expressions.rst:1805 msgid "in" msgstr "" -#: reference/expressions.rst:1678 +#: reference/expressions.rst:1805 msgid "not in" msgstr "" -#: reference/expressions.rst:1678 +#: reference/expressions.rst:1805 msgid "membership" msgstr "" -#: reference/expressions.rst:1687 +#: reference/expressions.rst:1814 msgid "test" msgstr "" -#: reference/expressions.rst:1687 +#: reference/expressions.rst:1814 msgid "is" msgstr "" -#: reference/expressions.rst:1687 +#: reference/expressions.rst:1814 msgid "is not" msgstr "" -#: reference/expressions.rst:1687 +#: reference/expressions.rst:1814 msgid "identity" msgstr "" -#: reference/expressions.rst:1713 +#: reference/expressions.rst:1840 msgid "Conditional" msgstr "" -#: reference/expressions.rst:1713 +#: reference/expressions.rst:1840 msgid "Boolean" msgstr "" -#: reference/expressions.rst:1729 +#: reference/expressions.rst:1856 msgid "not" msgstr "" -#: reference/expressions.rst:1753 +#: reference/expressions.rst:1880 msgid ":= (colon equals)" msgstr "" -#: reference/expressions.rst:1753 +#: reference/expressions.rst:1880 msgid "assignment expression" msgstr "" -#: reference/expressions.rst:1753 +#: reference/expressions.rst:1880 msgid "walrus operator" msgstr "" -#: reference/expressions.rst:1753 +#: reference/expressions.rst:1880 msgid "named expression" msgstr "" -#: reference/expressions.rst:1801 +#: reference/expressions.rst:1880 +msgid "assignment" +msgstr "" + +#: reference/expressions.rst:1931 msgid "conditional" msgstr "" -#: reference/expressions.rst:1801 +#: reference/expressions.rst:1931 msgid "ternary" msgstr "" -#: reference/expressions.rst:1801 +#: reference/expressions.rst:1931 msgid "conditional expression" msgstr "" -#: reference/expressions.rst:1801 +#: reference/expressions.rst:1931 msgid "else" msgstr "" -#: reference/expressions.rst:1827 +#: reference/expressions.rst:1958 msgid "lambda" msgstr "" -#: reference/expressions.rst:1827 +#: reference/expressions.rst:1958 msgid "form" msgstr "" -#: reference/expressions.rst:1827 +#: reference/expressions.rst:1958 msgid "anonymous" msgstr "" -#: reference/expressions.rst:1827 +#: reference/expressions.rst:1958 msgid "lambda expression" msgstr "" -#: reference/expressions.rst:1872 +#: reference/expressions.rst:2005 msgid "iterable" msgstr "" -#: reference/expressions.rst:1872 +#: reference/expressions.rst:2005 msgid "in expression lists" msgstr "" -#: reference/expressions.rst:1884 +#: reference/expressions.rst:2020 msgid "trailing" msgstr "" -#: reference/expressions.rst:1899 +#: reference/expressions.rst:2035 msgid "evaluation" msgstr "" -#: reference/expressions.rst:1899 +#: reference/expressions.rst:2035 msgid "order" msgstr "" -#: reference/expressions.rst:1920 +#: reference/expressions.rst:2056 msgid "precedence" msgstr "" diff --git a/reference/grammar.po b/reference/grammar.po index 1899e787..831752c0 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: reference/grammar.rst:4 msgid "Full Grammar specification" -msgstr "" +msgstr "Πλήρης προδιαγραφή γραμματικής" #: reference/grammar.rst:6 msgid "" @@ -26,15 +27,3900 @@ msgid "" "generate the CPython parser (see :source:`Grammar/python.gram`). The version " "here omits details related to code generation and error recovery." msgstr "" +"Αυτή είναι η πλήρης γραμματική της Python, που προέρχεται απευθείας από τη " +"γραμματική που χρησιμοποιείται για τη δημιουργία του αναλυτή CPython (βλ. :" +"source:`Grammar/python.gram`). Η έκδοση αυτή παραλείπει λεπτομέρειες που " +"σχετίζονται με τη δημιουργία κώδικα και την ανάκτηση από σφάλματα." #: reference/grammar.rst:11 msgid "" -"The notation is a mixture of `EBNF `_ and `PEG `_. In particular, ``&`` followed by a symbol, " -"token or parenthesized group indicates a positive lookahead (i.e., is " -"required to match but not consumed), while ``!`` indicates a negative " -"lookahead (i.e., is required *not* to match). We use the ``|`` separator to " -"mean PEG's \"ordered choice\" (written as ``/`` in traditional PEG " -"grammars). See :pep:`617` for more details on the grammar's syntax." +"The notation used here is the same as in the preceding docs, and is " +"described in the :ref:`notation ` section, except for an extra " +"complication:" +msgstr "" +"Η σημειογραφία που χρησιμοποιείται εδώ είναι η ίδια με τα προηγούμενα " +"έγγραφα και περιγράφεται στην ενότητα :ref:`notation `, εκτός από " +"μερικές επιπλέον επιπλοκές:" + +#: reference/grammar.rst:15 +msgid "" +"``~`` (\"cut\"): commit to the current alternative and fail the rule even if " +"this fails to parse" +msgstr "" +"``~`` (\"cut\"): ολοκλήρωση της τρέχουσας εναλλακτικής λύσης και αποτυχία " +"του κανόνα ακόμα κι αν αυτή αποτύχει να αναλυθεί" + +#: reference/grammar.rst:18 +msgid "" +"# PEG grammar for Python\n" +"\n" +"@trailer '''\n" +"void *\n" +"_PyPegen_parse(Parser *p)\n" +"{\n" +" // Initialize keywords\n" +" p->keywords = reserved_keywords;\n" +" p->n_keyword_lists = n_keyword_lists;\n" +" p->soft_keywords = soft_keywords;\n" +"\n" +" // Run parser\n" +" void *result = NULL;\n" +" if (p->start_rule == Py_file_input) {\n" +" result = file_rule(p);\n" +" } else if (p->start_rule == Py_single_input) {\n" +" result = interactive_rule(p);\n" +" } else if (p->start_rule == Py_eval_input) {\n" +" result = eval_rule(p);\n" +" } else if (p->start_rule == Py_func_type_input) {\n" +" result = func_type_rule(p);\n" +" }\n" +"\n" +" return result;\n" +"}\n" +"'''\n" +"\n" +"# ========================= START OF THE GRAMMAR =========================\n" +"\n" +"# General grammatical elements and rules:\n" +"#\n" +"# * Strings with double quotes (\") denote SOFT KEYWORDS\n" +"# * Strings with single quotes (') denote KEYWORDS\n" +"# * Upper case names (NAME) denote tokens in the Grammar/Tokens file\n" +"# * Rule names starting with \"invalid_\" are used for specialized syntax " +"errors\n" +"# - These rules are NOT used in the first pass of the parser.\n" +"# - Only if the first pass fails to parse, a second pass including the " +"invalid\n" +"# rules will be executed.\n" +"# - If the parser fails in the second phase with a generic syntax error, " +"the\n" +"# location of the generic failure of the first pass will be used (this " +"avoids\n" +"# reporting incorrect locations due to the invalid rules).\n" +"# - The order of the alternatives involving invalid rules matter\n" +"# (like any rule in PEG).\n" +"#\n" +"# Grammar Syntax (see PEP 617 for more information):\n" +"#\n" +"# rule_name: expression\n" +"# Optionally, a type can be included right after the rule name, which\n" +"# specifies the return type of the C or Python function corresponding to " +"the\n" +"# rule:\n" +"# rule_name[return_type]: expression\n" +"# If the return type is omitted, then a void * is returned in C and an Any " +"in\n" +"# Python.\n" +"# e1 e2\n" +"# Match e1, then match e2.\n" +"# e1 | e2\n" +"# Match e1 or e2.\n" +"# The first alternative can also appear on the line after the rule name " +"for\n" +"# formatting purposes. In that case, a | must be used before the first\n" +"# alternative, like so:\n" +"# rule_name[return_type]:\n" +"# | first_alt\n" +"# | second_alt\n" +"# ( e )\n" +"# Match e (allows also to use other operators in the group like '(e)*')\n" +"# [ e ] or e?\n" +"# Optionally match e.\n" +"# e*\n" +"# Match zero or more occurrences of e.\n" +"# e+\n" +"# Match one or more occurrences of e.\n" +"# s.e+\n" +"# Match one or more occurrences of e, separated by s. The generated parse " +"tree\n" +"# does not include the separator. This is otherwise identical to (e (s " +"e)*).\n" +"# &e\n" +"# Succeed if e can be parsed, without consuming any input.\n" +"# !e\n" +"# Fail if e can be parsed, without consuming any input.\n" +"# ~\n" +"# Commit to the current alternative, even if it fails to parse.\n" +"# &&e\n" +"# Eager parse e. The parser will not backtrack and will immediately\n" +"# fail with SyntaxError if e cannot be parsed.\n" +"#\n" +"\n" +"# STARTING RULES\n" +"# ==============\n" +"\n" +"file[mod_ty]: a=[statements] ENDMARKER { _PyPegen_make_module(p, a) }\n" +"interactive[mod_ty]: a=statement_newline { _PyAST_Interactive(a, p-" +">arena) }\n" +"eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { _PyAST_Expression(a, p-" +">arena) }\n" +"func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* " +"ENDMARKER { _PyAST_FunctionType(a, b, p->arena) }\n" +"\n" +"# GENERAL STATEMENTS\n" +"# ==================\n" +"\n" +"statements[asdl_stmt_seq*]: a=statement+ " +"{ (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }\n" +"\n" +"statement[asdl_stmt_seq*]:\n" +" | a=compound_stmt { _PyPegen_register_stmts(p ,\n" +" (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a)\n" +" ) }\n" +" | a[asdl_stmt_seq*]=simple_stmts { a }\n" +"\n" +"single_compound_stmt[asdl_stmt_seq*]:\n" +" | a=compound_stmt {\n" +" _PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_singleton_seq(p, " +"a)) }\n" +"\n" +"statement_newline[asdl_stmt_seq*]:\n" +" | a=single_compound_stmt NEWLINE { a }\n" +" | simple_stmts\n" +" | NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, " +"_PyAST_Pass(EXTRA))) }\n" +" | ENDMARKER { _PyPegen_interactive_exit(p) }\n" +"\n" +"simple_stmts[asdl_stmt_seq*]:\n" +" | a=simple_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, " +"a) } # Not needed, there for speedup\n" +" | a[asdl_stmt_seq*]=';'.simple_stmt+ [';'] NEWLINE { a }\n" +"\n" +"# NOTE: assignment MUST precede expression, else parsing a simple " +"assignment\n" +"# will throw a SyntaxError.\n" +"simple_stmt[stmt_ty] (memo):\n" +" | assignment\n" +" | &\"type\" type_alias\n" +" | e=star_expressions { _PyAST_Expr(e, EXTRA) }\n" +" | &'return' return_stmt\n" +" | &('import' | 'from') import_stmt\n" +" | &'raise' raise_stmt\n" +" | &'pass' pass_stmt\n" +" | &'del' del_stmt\n" +" | &'yield' yield_stmt\n" +" | &'assert' assert_stmt\n" +" | &'break' break_stmt\n" +" | &'continue' continue_stmt\n" +" | &'global' global_stmt\n" +" | &'nonlocal' nonlocal_stmt\n" +"\n" +"compound_stmt[stmt_ty]:\n" +" | &('def' | '@' | 'async') function_def\n" +" | &'if' if_stmt\n" +" | &('class' | '@') class_def\n" +" | &('with' | 'async') with_stmt\n" +" | &('for' | 'async') for_stmt\n" +" | &'try' try_stmt\n" +" | &'while' while_stmt\n" +" | match_stmt\n" +"\n" +"# SIMPLE STATEMENTS\n" +"# =================\n" +"\n" +"# NOTE: annotated_rhs may start with 'yield'; yield_expr must start with " +"'yield'\n" +"assignment[stmt_ty]:\n" +" | a=NAME ':' b=expression c=['=' d=annotated_rhs { d }] {\n" +" CHECK_VERSION(\n" +" stmt_ty,\n" +" 6,\n" +" \"Variable annotation syntax is\",\n" +" _PyAST_AnnAssign(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), b, c, 1, EXTRA)\n" +" ) }\n" +" | a=('(' b=single_target ')' { b }\n" +" | single_subscript_attribute_target) ':' b=expression c=['=' " +"d=annotated_rhs { d }] {\n" +" CHECK_VERSION(stmt_ty, 6, \"Variable annotations syntax is\", " +"_PyAST_AnnAssign(a, b, c, 0, EXTRA)) }\n" +" | a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=annotated_rhs !'=' " +"tc=[TYPE_COMMENT] {\n" +" _PyAST_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | a=single_target b=augassign ~ c=annotated_rhs {\n" +" _PyAST_AugAssign(a, b->kind, c, EXTRA) }\n" +" | invalid_assignment\n" +"\n" +"annotated_rhs[expr_ty]: yield_expr | star_expressions\n" +"\n" +"augassign[AugOperator*]:\n" +" | '+=' { _PyPegen_augoperator(p, Add) }\n" +" | '-=' { _PyPegen_augoperator(p, Sub) }\n" +" | '*=' { _PyPegen_augoperator(p, Mult) }\n" +" | '@=' { CHECK_VERSION(AugOperator*, 5, \"The '@' operator is\", " +"_PyPegen_augoperator(p, MatMult)) }\n" +" | '/=' { _PyPegen_augoperator(p, Div) }\n" +" | '%=' { _PyPegen_augoperator(p, Mod) }\n" +" | '&=' { _PyPegen_augoperator(p, BitAnd) }\n" +" | '|=' { _PyPegen_augoperator(p, BitOr) }\n" +" | '^=' { _PyPegen_augoperator(p, BitXor) }\n" +" | '<<=' { _PyPegen_augoperator(p, LShift) }\n" +" | '>>=' { _PyPegen_augoperator(p, RShift) }\n" +" | '**=' { _PyPegen_augoperator(p, Pow) }\n" +" | '//=' { _PyPegen_augoperator(p, FloorDiv) }\n" +"\n" +"return_stmt[stmt_ty]:\n" +" | 'return' a=[star_expressions] { _PyAST_Return(a, EXTRA) }\n" +"\n" +"raise_stmt[stmt_ty]:\n" +" | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, " +"b, EXTRA) }\n" +" | 'raise' { _PyAST_Raise(NULL, NULL, EXTRA) }\n" +"\n" +"pass_stmt[stmt_ty]:\n" +" | 'pass' { _PyAST_Pass(EXTRA) }\n" +"\n" +"break_stmt[stmt_ty]:\n" +" | 'break' { _PyAST_Break(EXTRA) }\n" +"\n" +"continue_stmt[stmt_ty]:\n" +" | 'continue' { _PyAST_Continue(EXTRA) }\n" +"\n" +"global_stmt[stmt_ty]: 'global' a[asdl_expr_seq*]=','.NAME+ {\n" +" _PyAST_Global(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, " +"a)), EXTRA) }\n" +"\n" +"nonlocal_stmt[stmt_ty]: 'nonlocal' a[asdl_expr_seq*]=','.NAME+ {\n" +" _PyAST_Nonlocal(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, " +"a)), EXTRA) }\n" +"\n" +"del_stmt[stmt_ty]:\n" +" | 'del' a=del_targets &(';' | NEWLINE) { _PyAST_Delete(a, EXTRA) }\n" +" | invalid_del_stmt\n" +"\n" +"yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }\n" +"\n" +"assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] " +"{ _PyAST_Assert(a, b, EXTRA) }\n" +"\n" +"import_stmt[stmt_ty]:\n" +" | invalid_import\n" +" | import_name\n" +" | import_from\n" +"\n" +"# Import statements\n" +"# -----------------\n" +"\n" +"import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, " +"EXTRA) }\n" +"# note below: the ('.' | '...') is necessary because '...' is tokenized as " +"ELLIPSIS\n" +"import_from[stmt_ty]:\n" +" | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets " +"{\n" +" _PyPegen_checked_future_import(p, b->v.Name.id, c, " +"_PyPegen_seq_count_dots(a), EXTRA) }\n" +" | 'from' a=('.' | '...')+ 'import' b=import_from_targets {\n" +" _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }\n" +"import_from_targets[asdl_alias_seq*]:\n" +" | '(' a=import_from_as_names [','] ')' { a }\n" +" | import_from_as_names !','\n" +" | '*' { (asdl_alias_seq*)_PyPegen_singleton_seq(p, CHECK(alias_ty, " +"_PyPegen_alias_for_star(p, EXTRA))) }\n" +" | invalid_import_from_targets\n" +"import_from_as_names[asdl_alias_seq*]:\n" +" | a[asdl_alias_seq*]=','.import_from_as_name+ { a }\n" +"import_from_as_name[alias_ty]:\n" +" | invalid_import_from_as_name\n" +" | a=NAME b=['as' z=NAME { z }] { _PyAST_alias(\n" +" a->v.Name.id, (b) ? ((expr_ty) b)->v.Name.id : NULL, EXTRA) }\n" +"\n" +"dotted_as_names[asdl_alias_seq*]:\n" +" | a[asdl_alias_seq*]=','.dotted_as_name+ { a }\n" +"dotted_as_name[alias_ty]:\n" +" | invalid_dotted_as_name\n" +" | a=dotted_name b=['as' z=NAME { z }] { _PyAST_alias(\n" +" a->v.Name.id, (b) ? ((expr_ty) b)->v.Name.id : NULL, EXTRA) }\n" +"\n" +"dotted_name[expr_ty]:\n" +" | a=dotted_name '.' b=NAME { _PyPegen_join_names_with_dot(p, a, b) }\n" +" | NAME\n" +"\n" +"# COMPOUND STATEMENTS\n" +"# ===================\n" +"\n" +"# Common elements\n" +"# ---------------\n" +"\n" +"block[asdl_stmt_seq*] (memo):\n" +" | NEWLINE INDENT a=statements DEDENT { a }\n" +" | simple_stmts\n" +" | invalid_block\n" +"\n" +"decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression " +"NEWLINE { f })+ { a }\n" +"\n" +"# Class definitions\n" +"# -----------------\n" +"\n" +"class_def[stmt_ty]:\n" +" | a=decorators b=class_def_raw { _PyPegen_class_def_decorators(p, a, " +"b) }\n" +" | class_def_raw\n" +"\n" +"class_def_raw[stmt_ty]:\n" +" | invalid_class_def_raw\n" +" | 'class' a=NAME t=[type_params] b=['(' z=[arguments] ')' { z }] ':' " +"c=block {\n" +" _PyAST_ClassDef(a->v.Name.id,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" c, NULL, t, EXTRA) }\n" +"\n" +"# Function definitions\n" +"# --------------------\n" +"\n" +"function_def[stmt_ty]:\n" +" | d=decorators f=function_def_raw { _PyPegen_function_def_decorators(p, " +"d, f) }\n" +" | function_def_raw\n" +"\n" +"function_def_raw[stmt_ty]:\n" +" | invalid_def_raw\n" +" | 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" +" _PyAST_FunctionDef(n->v.Name.id,\n" +" (params) ? params : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)),\n" +" b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) }\n" +" | 'async' 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" +" CHECK_VERSION(\n" +" stmt_ty,\n" +" 5,\n" +" \"Async functions are\",\n" +" _PyAST_AsyncFunctionDef(n->v.Name.id,\n" +" (params) ? params : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)),\n" +" b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA)\n" +" ) }\n" +"\n" +"# Function parameters\n" +"# -------------------\n" +"\n" +"params[arguments_ty]:\n" +" | invalid_parameters\n" +" | parameters\n" +"\n" +"parameters[arguments_ty]:\n" +" | a=slash_no_default b[asdl_arg_seq*]=param_no_default* " +"c=param_with_default* d=[star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, a, NULL, b, c, d)) }\n" +" | a=slash_with_default b=param_with_default* c=[star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, NULL, a, NULL, b, c)) }\n" +" | a[asdl_arg_seq*]=param_no_default+ b=param_with_default* c=[star_etc] " +"{\n" +" _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }\n" +" | a=param_with_default+ b=[star_etc] { _PyPegen_make_arguments(p, NULL, " +"NULL, NULL, a, b)}\n" +" | a=star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }\n" +"\n" +"# Some duplication here because we can't write (',' | &')'),\n" +"# which is because we don't support empty alternatives (yet).\n" +"\n" +"slash_no_default[asdl_arg_seq*]:\n" +" | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }\n" +" | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }\n" +"slash_with_default[SlashWithDefault*]:\n" +" | a=param_no_default* b=param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' " +"&')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +"\n" +"star_etc[StarEtc*]:\n" +" | invalid_star_etc\n" +" | '*' a=param_no_default b=param_maybe_default* c=[kwds] {\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' a=param_no_default_star_annotation b=param_maybe_default* c=[kwds] " +"{\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' ',' b=param_maybe_default+ c=[kwds] {\n" +" _PyPegen_star_etc(p, NULL, b, c) }\n" +" | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) }\n" +"\n" +"kwds[arg_ty]:\n" +" | invalid_kwds\n" +" | '**' a=param_no_default { a }\n" +"\n" +"# One parameter. This *includes* a following comma and type comment.\n" +"#\n" +"# There are three styles:\n" +"# - No default\n" +"# - With default\n" +"# - Maybe with default\n" +"#\n" +"# There are two alternative forms of each, to deal with type comments:\n" +"# - Ends in a comma followed by an optional type comment\n" +"# - No comma, optional type comment, must be followed by close paren\n" +"# The latter form is for a final parameter without trailing comma.\n" +"#\n" +"\n" +"param_no_default[arg_ty]:\n" +" | a=param ',' tc=TYPE_COMMENT? { _PyPegen_add_type_comment_to_arg(p, a, " +"tc) }\n" +" | a=param tc=TYPE_COMMENT? &')' { _PyPegen_add_type_comment_to_arg(p, a, " +"tc) }\n" +"param_no_default_star_annotation[arg_ty]:\n" +" | a=param_star_annotation ',' tc=TYPE_COMMENT? " +"{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +" | a=param_star_annotation tc=TYPE_COMMENT? " +"&')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +"param_with_default[NameDefaultPair*]:\n" +" | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " +"a, c, tc) }\n" +" | a=param c=default tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" +"param_maybe_default[NameDefaultPair*]:\n" +" | a=param c=default? ',' tc=TYPE_COMMENT? " +"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default? tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" +"param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, " +"EXTRA) }\n" +"param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a->v." +"Name.id, b, NULL, EXTRA) }\n" +"annotation[expr_ty]: ':' a=expression { a }\n" +"star_annotation[expr_ty]: ':' a=star_expression { a }\n" +"default[expr_ty]: '=' a=expression { a } | invalid_default\n" +"\n" +"# If statement\n" +"# ------------\n" +"\n" +"if_stmt[stmt_ty]:\n" +" | invalid_if_stmt\n" +" | 'if' a=named_expression ':' b=block c=elif_stmt {\n" +" _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), " +"EXTRA) }\n" +" | 'if' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, " +"c, EXTRA) }\n" +"elif_stmt[stmt_ty]:\n" +" | invalid_elif_stmt\n" +" | 'elif' a=named_expression ':' b=block c=elif_stmt {\n" +" _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), " +"EXTRA) }\n" +" | 'elif' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, " +"c, EXTRA) }\n" +"else_block[asdl_stmt_seq*]:\n" +" | invalid_else_stmt\n" +" | 'else' &&':' b=block { b }\n" +"\n" +"# While statement\n" +"# ---------------\n" +"\n" +"while_stmt[stmt_ty]:\n" +" | invalid_while_stmt\n" +" | 'while' a=named_expression ':' b=block c=[else_block] " +"{ _PyAST_While(a, b, c, EXTRA) }\n" +"\n" +"# For statement\n" +"# -------------\n" +"\n" +"for_stmt[stmt_ty]:\n" +" | invalid_for_stmt\n" +" | 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] " +"b=block el=[else_block] {\n" +" _PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'async' 'for' t=star_targets 'in' ~ ex=star_expressions ':' " +"tc=[TYPE_COMMENT] b=block el=[else_block] {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async for loops are\", " +"_PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" +" | invalid_for_target\n" +"\n" +"# With statement\n" +"# --------------\n" +"\n" +"with_stmt[stmt_ty]:\n" +" | invalid_with_stmt_indent\n" +" | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +"tc=[TYPE_COMMENT] b=block {\n" +" _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] " +"b=block {\n" +" _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'async' 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +"b=block {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " +"_PyAST_AsyncWith(a, b, NULL, EXTRA)) }\n" +" | 'async' 'with' a[asdl_withitem_seq*]=','.with_item+ ':' " +"tc=[TYPE_COMMENT] b=block {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " +"_PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" +" | invalid_with_stmt\n" +"\n" +"with_item[withitem_ty]:\n" +" | e=expression 'as' t=star_target &(',' | ')' | ':') " +"{ _PyAST_withitem(e, t, p->arena) }\n" +" | invalid_with_item\n" +" | e=expression { _PyAST_withitem(e, NULL, p->arena) }\n" +"\n" +"# Try statement\n" +"# -------------\n" +"\n" +"try_stmt[stmt_ty]:\n" +" | invalid_try_stmt\n" +" | 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, " +"EXTRA) }\n" +" | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ " +"el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, EXTRA) }\n" +" | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ " +"el=[else_block] f=[finally_block] {\n" +" CHECK_VERSION(stmt_ty, 11, \"Exception groups are\",\n" +" _PyAST_TryStar(b, ex, el, f, EXTRA)) }\n" +"\n" +"\n" +"# Except statement\n" +"# ----------------\n" +"\n" +"except_block[excepthandler_ty]:\n" +" | invalid_except_stmt_indent\n" +" | 'except' e=expression ':' b=block {\n" +" _PyAST_ExceptHandler(e, NULL, b, EXTRA) }\n" +" | 'except' e=expression 'as' t=NAME ':' b=block {\n" +" _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }\n" +" | 'except' e=expressions ':' b=block {\n" +" CHECK_VERSION(\n" +" excepthandler_ty,\n" +" 14,\n" +" \"except expressions without parentheses are\",\n" +" _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }\n" +" | 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }\n" +" | invalid_except_stmt\n" +"except_star_block[excepthandler_ty]:\n" +" | invalid_except_star_stmt_indent\n" +" | 'except' '*' e=expression ':' b=block {\n" +" _PyAST_ExceptHandler(e, NULL, b, EXTRA) }\n" +" | 'except' '*' e=expression 'as' t=NAME ':' b=block {\n" +" _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }\n" +" | 'except' '*' e=expressions ':' b=block {\n" +" CHECK_VERSION(\n" +" excepthandler_ty,\n" +" 14,\n" +" \"except expressions without parentheses are\",\n" +" _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }\n" +" | invalid_except_star_stmt\n" +"finally_block[asdl_stmt_seq*]:\n" +" | invalid_finally_stmt\n" +" | 'finally' &&':' a=block { a }\n" +"\n" +"# Match statement\n" +"# ---------------\n" +"\n" +"match_stmt[stmt_ty]:\n" +" | \"match\" subject=subject_expr ':' NEWLINE INDENT " +"cases[asdl_match_case_seq*]=case_block+ DEDENT {\n" +" CHECK_VERSION(stmt_ty, 10, \"Pattern matching is\", " +"_PyAST_Match(subject, cases, EXTRA)) }\n" +" | invalid_match_stmt\n" +"\n" +"subject_expr[expr_ty]:\n" +" | value=star_named_expression ',' values=star_named_expressions? {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"value, values)), Load, EXTRA) }\n" +" | named_expression\n" +"\n" +"case_block[match_case_ty]:\n" +" | invalid_case_block\n" +" | \"case\" pattern=patterns guard=guard? ':' body=block {\n" +" _PyAST_match_case(pattern, guard, body, p->arena) }\n" +"\n" +"guard[expr_ty]: 'if' guard=named_expression { guard }\n" +"\n" +"patterns[pattern_ty]:\n" +" | patterns[asdl_pattern_seq*]=open_sequence_pattern {\n" +" _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | pattern\n" +"\n" +"pattern[pattern_ty]:\n" +" | as_pattern\n" +" | or_pattern\n" +"\n" +"as_pattern[pattern_ty]:\n" +" | pattern=or_pattern 'as' target=pattern_capture_target {\n" +" _PyAST_MatchAs(pattern, target->v.Name.id, EXTRA) }\n" +" | invalid_as_pattern\n" +"\n" +"or_pattern[pattern_ty]:\n" +" | patterns[asdl_pattern_seq*]='|'.closed_pattern+ {\n" +" asdl_seq_LEN(patterns) == 1 ? asdl_seq_GET(patterns, 0) : " +"_PyAST_MatchOr(patterns, EXTRA) }\n" +"\n" +"closed_pattern[pattern_ty] (memo):\n" +" | literal_pattern\n" +" | capture_pattern\n" +" | wildcard_pattern\n" +" | value_pattern\n" +" | group_pattern\n" +" | sequence_pattern\n" +" | mapping_pattern\n" +" | class_pattern\n" +"\n" +"# Literal patterns are used for equality and identity constraints\n" +"literal_pattern[pattern_ty]:\n" +" | value=signed_number !('+' | '-') { _PyAST_MatchValue(value, EXTRA) }\n" +" | value=complex_number { _PyAST_MatchValue(value, EXTRA) }\n" +" | value=strings { _PyAST_MatchValue(value, EXTRA) }\n" +" | 'None' { _PyAST_MatchSingleton(Py_None, EXTRA) }\n" +" | 'True' { _PyAST_MatchSingleton(Py_True, EXTRA) }\n" +" | 'False' { _PyAST_MatchSingleton(Py_False, EXTRA) }\n" +"\n" +"# Literal expressions are used to restrict permitted mapping pattern keys\n" +"literal_expr[expr_ty]:\n" +" | signed_number !('+' | '-')\n" +" | complex_number\n" +" | &(STRING|FSTRING_START|TSTRING_START) strings\n" +" | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }\n" +" | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }\n" +" | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }\n" +"\n" +"complex_number[expr_ty]:\n" +" | real=signed_real_number '+' imag=imaginary_number {\n" +" _PyAST_BinOp(real, Add, imag, EXTRA) }\n" +" | real=signed_real_number '-' imag=imaginary_number {\n" +" _PyAST_BinOp(real, Sub, imag, EXTRA) }\n" +"\n" +"signed_number[expr_ty]:\n" +" | NUMBER\n" +" | '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) }\n" +"\n" +"signed_real_number[expr_ty]:\n" +" | real_number\n" +" | '-' real=real_number { _PyAST_UnaryOp(USub, real, EXTRA) }\n" +"\n" +"real_number[expr_ty]:\n" +" | real=NUMBER { _PyPegen_ensure_real(p, real) }\n" +"\n" +"imaginary_number[expr_ty]:\n" +" | imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }\n" +"\n" +"capture_pattern[pattern_ty]:\n" +" | target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name." +"id, EXTRA) }\n" +"\n" +"pattern_capture_target[expr_ty]:\n" +" | !\"_\" name=NAME !('.' | '(' | '=') {\n" +" _PyPegen_set_expr_context(p, name, Store) }\n" +"\n" +"wildcard_pattern[pattern_ty]:\n" +" | \"_\" { _PyAST_MatchAs(NULL, NULL, EXTRA) }\n" +"\n" +"value_pattern[pattern_ty]:\n" +" | attr=attr !('.' | '(' | '=') { _PyAST_MatchValue(attr, EXTRA) }\n" +"\n" +"attr[expr_ty]:\n" +" | value=name_or_attr '.' attr=NAME {\n" +" _PyAST_Attribute(value, attr->v.Name.id, Load, EXTRA) }\n" +"\n" +"name_or_attr[expr_ty]:\n" +" | attr\n" +" | NAME\n" +"\n" +"group_pattern[pattern_ty]:\n" +" | '(' pattern=pattern ')' { pattern }\n" +"\n" +"sequence_pattern[pattern_ty]:\n" +" | '[' patterns=maybe_sequence_pattern? " +"']' { _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '(' patterns=open_sequence_pattern? " +"')' { _PyAST_MatchSequence(patterns, EXTRA) }\n" +"\n" +"open_sequence_pattern[asdl_seq*]:\n" +" | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {\n" +" _PyPegen_seq_insert_in_front(p, pattern, patterns) }\n" +"\n" +"maybe_sequence_pattern[asdl_seq*]:\n" +" | patterns=','.maybe_star_pattern+ ','? { patterns }\n" +"\n" +"maybe_star_pattern[pattern_ty]:\n" +" | star_pattern\n" +" | pattern\n" +"\n" +"star_pattern[pattern_ty] (memo):\n" +" | '*' target=pattern_capture_target {\n" +" _PyAST_MatchStar(target->v.Name.id, EXTRA) }\n" +" | '*' wildcard_pattern {\n" +" _PyAST_MatchStar(NULL, EXTRA) }\n" +"\n" +"mapping_pattern[pattern_ty]:\n" +" | '{' '}' {\n" +" _PyAST_MatchMapping(NULL, NULL, NULL, EXTRA) }\n" +" | '{' rest=double_star_pattern ','? '}' {\n" +" _PyAST_MatchMapping(NULL, NULL, rest->v.Name.id, EXTRA) }\n" +" | '{' items=items_pattern ',' rest=double_star_pattern ','? '}' {\n" +" _PyAST_MatchMapping(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),\n" +" rest->v.Name.id,\n" +" EXTRA) }\n" +" | '{' items=items_pattern ','? '}' {\n" +" _PyAST_MatchMapping(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),\n" +" NULL,\n" +" EXTRA) }\n" +"\n" +"items_pattern[asdl_seq*]:\n" +" | ','.key_value_pattern+\n" +"\n" +"key_value_pattern[KeyPatternPair*]:\n" +" | key=(literal_expr | attr) ':' pattern=pattern {\n" +" _PyPegen_key_pattern_pair(p, key, pattern) }\n" +"\n" +"double_star_pattern[expr_ty]:\n" +" | '**' target=pattern_capture_target { target }\n" +"\n" +"class_pattern[pattern_ty]:\n" +" | cls=name_or_attr '(' ')' {\n" +" _PyAST_MatchClass(cls, NULL, NULL, NULL, EXTRA) }\n" +" | cls=name_or_attr '(' patterns=positional_patterns ','? ')' {\n" +" _PyAST_MatchClass(cls, patterns, NULL, NULL, EXTRA) }\n" +" | cls=name_or_attr '(' keywords=keyword_patterns ','? ')' {\n" +" _PyAST_MatchClass(\n" +" cls, NULL,\n" +" CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, " +"keywords)))),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),\n" +" EXTRA) }\n" +" | cls=name_or_attr '(' patterns=positional_patterns ',' " +"keywords=keyword_patterns ','? ')' {\n" +" _PyAST_MatchClass(\n" +" cls,\n" +" patterns,\n" +" CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, " +"keywords)))),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),\n" +" EXTRA) }\n" +" | invalid_class_pattern\n" +"\n" +"positional_patterns[asdl_pattern_seq*]:\n" +" | args[asdl_pattern_seq*]=','.pattern+ { args }\n" +"\n" +"keyword_patterns[asdl_seq*]:\n" +" | ','.keyword_pattern+\n" +"\n" +"keyword_pattern[KeyPatternPair*]:\n" +" | arg=NAME '=' value=pattern { _PyPegen_key_pattern_pair(p, arg, " +"value) }\n" +"\n" +"# Type statement\n" +"# ---------------\n" +"\n" +"type_alias[stmt_ty]:\n" +" | \"type\" n=NAME t=[type_params] '=' b=expression {\n" +" CHECK_VERSION(stmt_ty, 12, \"Type statement is\",\n" +" _PyAST_TypeAlias(CHECK(expr_ty, _PyPegen_set_expr_context(p, n, " +"Store)), t, b, EXTRA)) }\n" +"\n" +"# Type parameter declaration\n" +"# --------------------------\n" +"\n" +"type_params[asdl_type_param_seq*]:\n" +" | invalid_type_params\n" +" | '[' t=type_param_seq ']' {\n" +" CHECK_VERSION(asdl_type_param_seq *, 12, \"Type parameter lists " +"are\", t) }\n" +"\n" +"type_param_seq[asdl_type_param_seq*]: a[asdl_type_param_seq*]=','." +"type_param+ [','] { a }\n" +"\n" +"type_param[type_param_ty] (memo):\n" +" | a=NAME b=[type_param_bound] c=[type_param_default] { _PyAST_TypeVar(a-" +">v.Name.id, b, c, EXTRA) }\n" +" | invalid_type_param\n" +" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a->v." +"Name.id, b, EXTRA) }\n" +" | '**' a=NAME b=[type_param_default] { _PyAST_ParamSpec(a->v.Name.id, b, " +"EXTRA) }\n" +"\n" +"type_param_bound[expr_ty]: ':' e=expression { e }\n" +"type_param_default[expr_ty]: '=' e=expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" +"type_param_starred_default[expr_ty]: '=' e=star_expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" +"\n" +"# EXPRESSIONS\n" +"# -----------\n" +"\n" +"expressions[expr_ty]:\n" +" | a=expression b=(',' c=expression { c })+ [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"a, b)), Load, EXTRA) }\n" +" | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, " +"_PyPegen_singleton_seq(p, a)), Load, EXTRA) }\n" +" | expression\n" +"\n" +"expression[expr_ty] (memo):\n" +" | invalid_expression\n" +" | invalid_legacy_expression\n" +" | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, " +"a, c, EXTRA) }\n" +" | disjunction\n" +" | lambdef\n" +"\n" +"yield_expr[expr_ty]:\n" +" | 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }\n" +" | 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }\n" +"\n" +"star_expressions[expr_ty]:\n" +" | a=star_expression b=(',' c=star_expression { c })+ [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"a, b)), Load, EXTRA) }\n" +" | a=star_expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, " +"_PyPegen_singleton_seq(p, a)), Load, EXTRA) }\n" +" | star_expression\n" +"\n" +"star_expression[expr_ty] (memo):\n" +" | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" +" | expression\n" +"\n" +"star_named_expressions[asdl_expr_seq*]: a[asdl_expr_seq*]=','." +"star_named_expression+ [','] { a }\n" +"\n" +"star_named_expression[expr_ty]:\n" +" | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" +" | named_expression\n" +"\n" +"assignment_expression[expr_ty]:\n" +" | a=NAME ':=' ~ b=expression {\n" +" CHECK_VERSION(expr_ty, 8, \"Assignment expressions are\",\n" +" _PyAST_NamedExpr(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), b, EXTRA)) }\n" +"\n" +"named_expression[expr_ty]:\n" +" | assignment_expression\n" +" | invalid_named_expression\n" +" | expression !':='\n" +"\n" +"disjunction[expr_ty] (memo):\n" +" | a=conjunction b=('or' c=conjunction { c })+ { _PyAST_BoolOp(\n" +" Or,\n" +" CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),\n" +" EXTRA) }\n" +" | conjunction\n" +"\n" +"conjunction[expr_ty] (memo):\n" +" | a=inversion b=('and' c=inversion { c })+ { _PyAST_BoolOp(\n" +" And,\n" +" CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),\n" +" EXTRA) }\n" +" | inversion\n" +"\n" +"inversion[expr_ty] (memo):\n" +" | 'not' a=inversion { _PyAST_UnaryOp(Not, a, EXTRA) }\n" +" | comparison\n" +"\n" +"# Comparison operators\n" +"# --------------------\n" +"\n" +"comparison[expr_ty]:\n" +" | a=bitwise_or b=compare_op_bitwise_or_pair+ {\n" +" _PyAST_Compare(\n" +" a,\n" +" CHECK(asdl_int_seq*, _PyPegen_get_cmpops(p, b)),\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_exprs(p, b)),\n" +" EXTRA) }\n" +" | bitwise_or\n" +"\n" +"compare_op_bitwise_or_pair[CmpopExprPair*]:\n" +" | eq_bitwise_or\n" +" | noteq_bitwise_or\n" +" | lte_bitwise_or\n" +" | lt_bitwise_or\n" +" | gte_bitwise_or\n" +" | gt_bitwise_or\n" +" | notin_bitwise_or\n" +" | in_bitwise_or\n" +" | isnot_bitwise_or\n" +" | is_bitwise_or\n" +"\n" +"eq_bitwise_or[CmpopExprPair*]: '==' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Eq, a) }\n" +"noteq_bitwise_or[CmpopExprPair*]:\n" +" | (tok='!=' { _PyPegen_check_barry_as_flufl(p, tok) ? NULL : tok}) " +"a=bitwise_or {_PyPegen_cmpop_expr_pair(p, NotEq, a) }\n" +"lte_bitwise_or[CmpopExprPair*]: '<=' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, LtE, a) }\n" +"lt_bitwise_or[CmpopExprPair*]: '<' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Lt, a) }\n" +"gte_bitwise_or[CmpopExprPair*]: '>=' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, GtE, a) }\n" +"gt_bitwise_or[CmpopExprPair*]: '>' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Gt, a) }\n" +"notin_bitwise_or[CmpopExprPair*]: 'not' 'in' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, NotIn, a) }\n" +"in_bitwise_or[CmpopExprPair*]: 'in' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, In, a) }\n" +"isnot_bitwise_or[CmpopExprPair*]: 'is' 'not' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, IsNot, a) }\n" +"is_bitwise_or[CmpopExprPair*]: 'is' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Is, a) }\n" +"\n" +"# Bitwise operators\n" +"# -----------------\n" +"\n" +"bitwise_or[expr_ty]:\n" +" | a=bitwise_or '|' b=bitwise_xor { _PyAST_BinOp(a, BitOr, b, EXTRA) }\n" +" | bitwise_xor\n" +"\n" +"bitwise_xor[expr_ty]:\n" +" | a=bitwise_xor '^' b=bitwise_and { _PyAST_BinOp(a, BitXor, b, EXTRA) }\n" +" | bitwise_and\n" +"\n" +"bitwise_and[expr_ty]:\n" +" | a=bitwise_and '&' b=shift_expr { _PyAST_BinOp(a, BitAnd, b, EXTRA) }\n" +" | shift_expr\n" +"\n" +"shift_expr[expr_ty]:\n" +" | a=shift_expr '<<' b=sum { _PyAST_BinOp(a, LShift, b, EXTRA) }\n" +" | a=shift_expr '>>' b=sum { _PyAST_BinOp(a, RShift, b, EXTRA) }\n" +" | invalid_arithmetic\n" +" | sum\n" +"\n" +"# Arithmetic operators\n" +"# --------------------\n" +"\n" +"sum[expr_ty]:\n" +" | a=sum '+' b=term { _PyAST_BinOp(a, Add, b, EXTRA) }\n" +" | a=sum '-' b=term { _PyAST_BinOp(a, Sub, b, EXTRA) }\n" +" | term\n" +"\n" +"term[expr_ty]:\n" +" | a=term '*' b=factor { _PyAST_BinOp(a, Mult, b, EXTRA) }\n" +" | a=term '/' b=factor { _PyAST_BinOp(a, Div, b, EXTRA) }\n" +" | a=term '//' b=factor { _PyAST_BinOp(a, FloorDiv, b, EXTRA) }\n" +" | a=term '%' b=factor { _PyAST_BinOp(a, Mod, b, EXTRA) }\n" +" | a=term '@' b=factor { CHECK_VERSION(expr_ty, 5, \"The '@' operator " +"is\", _PyAST_BinOp(a, MatMult, b, EXTRA)) }\n" +" | invalid_factor\n" +" | factor\n" +"\n" +"factor[expr_ty] (memo):\n" +" | '+' a=factor { _PyAST_UnaryOp(UAdd, a, EXTRA) }\n" +" | '-' a=factor { _PyAST_UnaryOp(USub, a, EXTRA) }\n" +" | '~' a=factor { _PyAST_UnaryOp(Invert, a, EXTRA) }\n" +" | power\n" +"\n" +"power[expr_ty]:\n" +" | a=await_primary '**' b=factor { _PyAST_BinOp(a, Pow, b, EXTRA) }\n" +" | await_primary\n" +"\n" +"# Primary elements\n" +"# ----------------\n" +"\n" +"# Primary elements are things like \"obj.something.something\", " +"\"obj[something]\", \"obj(something)\", \"obj\" ...\n" +"\n" +"await_primary[expr_ty] (memo):\n" +" | 'await' a=primary { CHECK_VERSION(expr_ty, 5, \"Await expressions " +"are\", _PyAST_Await(a, EXTRA)) }\n" +" | primary\n" +"\n" +"primary[expr_ty]:\n" +" | a=primary '.' b=NAME { _PyAST_Attribute(a, b->v.Name.id, Load, " +"EXTRA) }\n" +" | a=primary b=genexp { _PyAST_Call(a, CHECK(asdl_expr_seq*, " +"(asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }\n" +" | a=primary '(' b=[arguments] ')' {\n" +" _PyAST_Call(a,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" EXTRA) }\n" +" | a=primary '[' b=slices ']' { _PyAST_Subscript(a, b, Load, EXTRA) }\n" +" | atom\n" +"\n" +"slices[expr_ty]:\n" +" | a=slice !',' { a }\n" +" | a[asdl_expr_seq*]=','.(slice | starred_expression)+ [','] " +"{ _PyAST_Tuple(a, Load, EXTRA) }\n" +"\n" +"slice[expr_ty]:\n" +" | a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] " +"{ _PyAST_Slice(a, b, c, EXTRA) }\n" +" | a=named_expression { a }\n" +"\n" +"atom[expr_ty]:\n" +" | NAME\n" +" | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }\n" +" | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }\n" +" | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }\n" +" | &(STRING|FSTRING_START|TSTRING_START) strings\n" +" | NUMBER\n" +" | &'(' (tuple | group | genexp)\n" +" | &'[' (list | listcomp)\n" +" | &'{' (dict | set | dictcomp | setcomp)\n" +" | '...' { _PyAST_Constant(Py_Ellipsis, NULL, EXTRA) }\n" +"\n" +"group[expr_ty]:\n" +" | '(' a=(yield_expr | named_expression) ')' { a }\n" +" | invalid_group\n" +"\n" +"# Lambda functions\n" +"# ----------------\n" +"\n" +"lambdef[expr_ty]:\n" +" | 'lambda' a=[lambda_params] ':' b=expression {\n" +" _PyAST_Lambda((a) ? a : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)), b, EXTRA) }\n" +"\n" +"lambda_params[arguments_ty]:\n" +" | invalid_lambda_parameters\n" +" | lambda_parameters\n" +"\n" +"# lambda_parameters etc. duplicates parameters but without annotations\n" +"# or type comments, and if there's no comma after a parameter, we expect\n" +"# a colon, not a close parenthesis. (For more, see parameters above.)\n" +"#\n" +"lambda_parameters[arguments_ty]:\n" +" | a=lambda_slash_no_default b[asdl_arg_seq*]=lambda_param_no_default* " +"c=lambda_param_with_default* d=[lambda_star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, a, NULL, b, c, d)) }\n" +" | a=lambda_slash_with_default b=lambda_param_with_default* " +"c=[lambda_star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, NULL, a, NULL, b, c)) }\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ b=lambda_param_with_default* " +"c=[lambda_star_etc] {\n" +" _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }\n" +" | a=lambda_param_with_default+ b=[lambda_star_etc] " +"{ _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}\n" +" | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, " +"a) }\n" +"\n" +"lambda_slash_no_default[asdl_arg_seq*]:\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ '/' ',' { a }\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }\n" +"\n" +"lambda_slash_with_default[SlashWithDefault*]:\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"&':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +"\n" +"lambda_star_etc[StarEtc*]:\n" +" | invalid_lambda_star_etc\n" +" | '*' a=lambda_param_no_default b=lambda_param_maybe_default* " +"c=[lambda_kwds] {\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] {\n" +" _PyPegen_star_etc(p, NULL, b, c) }\n" +" | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) }\n" +"\n" +"lambda_kwds[arg_ty]:\n" +" | invalid_lambda_kwds\n" +" | '**' a=lambda_param_no_default { a }\n" +"\n" +"lambda_param_no_default[arg_ty]:\n" +" | a=lambda_param ',' { a }\n" +" | a=lambda_param &':' { a }\n" +"lambda_param_with_default[NameDefaultPair*]:\n" +" | a=lambda_param c=default ',' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +" | a=lambda_param c=default &':' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +"lambda_param_maybe_default[NameDefaultPair*]:\n" +" | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +" | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +"lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, " +"EXTRA) }\n" +"\n" +"# LITERALS\n" +"# ========\n" +"\n" +"fstring_middle[expr_ty]:\n" +" | fstring_replacement_field\n" +" | t=FSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }\n" +"fstring_replacement_field[expr_ty]:\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[fstring_full_format_spec] rbrace='}' {\n" +" _PyPegen_formatted_value(p, a, debug_expr, conversion, format, " +"rbrace, EXTRA) }\n" +" | invalid_fstring_replacement_field\n" +"fstring_conversion[ResultTokenWithMetadata*]:\n" +" | conv_token=\"!\" conv=NAME { _PyPegen_check_fstring_conversion(p, " +"conv_token, conv) }\n" +"fstring_full_format_spec[ResultTokenWithMetadata*]:\n" +" | colon=':' spec=fstring_format_spec* " +"{ _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, " +"EXTRA) }\n" +"fstring_format_spec[expr_ty]:\n" +" | t=FSTRING_MIDDLE { _PyPegen_decoded_constant_from_token(p, t) }\n" +" | fstring_replacement_field\n" +"fstring[expr_ty]:\n" +" | a=FSTRING_START b=fstring_middle* c=FSTRING_END " +"{ _PyPegen_joined_str(p, a, (asdl_expr_seq*)b, c) }\n" +"\n" +"tstring_format_spec_replacement_field[expr_ty]:\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[tstring_full_format_spec] rbrace='}' {\n" +" _PyPegen_formatted_value(p, a, debug_expr, conversion, format, " +"rbrace, EXTRA) }\n" +" | invalid_tstring_replacement_field\n" +"tstring_format_spec[expr_ty]:\n" +" | t=TSTRING_MIDDLE { _PyPegen_decoded_constant_from_token(p, t) }\n" +" | tstring_format_spec_replacement_field\n" +"tstring_full_format_spec[ResultTokenWithMetadata*]:\n" +" | colon=':' spec=tstring_format_spec* " +"{ _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, " +"EXTRA) }\n" +"tstring_replacement_field[expr_ty]:\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[tstring_full_format_spec] rbrace='}' {\n" +" _PyPegen_interpolation(p, a, debug_expr, conversion, format, rbrace, " +"EXTRA) }\n" +" | invalid_tstring_replacement_field\n" +"tstring_middle[expr_ty]:\n" +" | tstring_replacement_field\n" +" | t=TSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }\n" +"tstring[expr_ty] (memo):\n" +" | a=TSTRING_START b=tstring_middle* c=TSTRING_END {\n" +" CHECK_VERSION(\n" +" expr_ty,\n" +" 14,\n" +" \"t-strings are\",\n" +" _PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) }\n" +"\n" +"string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }\n" +"strings[expr_ty] (memo):\n" +" | invalid_string_tstring_concat\n" +" | a[asdl_expr_seq*]=(fstring|string)+ { _PyPegen_concatenate_strings(p, " +"a, EXTRA) }\n" +" | a[asdl_expr_seq*]=tstring+ { _PyPegen_concatenate_tstrings(p, a, " +"EXTRA) }\n" +"\n" +"list[expr_ty]:\n" +" | '[' a=[star_named_expressions] ']' { _PyAST_List(a, Load, EXTRA) }\n" +"\n" +"tuple[expr_ty]:\n" +" | '(' a=[y=star_named_expression ',' z=[star_named_expressions] " +"{ _PyPegen_seq_insert_in_front(p, y, z) } ] ')' {\n" +" _PyAST_Tuple(a, Load, EXTRA) }\n" +"\n" +"set[expr_ty]: '{' a=star_named_expressions '}' { _PyAST_Set(a, EXTRA) }\n" +"\n" +"# Dicts\n" +"# -----\n" +"\n" +"dict[expr_ty]:\n" +" | '{' a=[double_starred_kvpairs] '}' {\n" +" _PyAST_Dict(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_keys(p, a)),\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_values(p, a)),\n" +" EXTRA) }\n" +" | '{' invalid_double_starred_kvpairs '}'\n" +"\n" +"double_starred_kvpairs[asdl_seq*]: a=','.double_starred_kvpair+ [','] { a }\n" +"\n" +"double_starred_kvpair[KeyValuePair*]:\n" +" | '**' a=bitwise_or { _PyPegen_key_value_pair(p, NULL, a) }\n" +" | kvpair\n" +"\n" +"kvpair[KeyValuePair*]: a=expression ':' b=expression " +"{ _PyPegen_key_value_pair(p, a, b) }\n" +"\n" +"# Comprehensions & Generators\n" +"# ---------------------------\n" +"\n" +"for_if_clauses[asdl_comprehension_seq*]:\n" +" | a[asdl_comprehension_seq*]=for_if_clause+ { a }\n" +"\n" +"for_if_clause[comprehension_ty]:\n" +" | 'async' 'for' a=star_targets 'in' ~ b=disjunction " +"c[asdl_expr_seq*]=('if' z=disjunction { z })* {\n" +" CHECK_VERSION(comprehension_ty, 6, \"Async comprehensions are\", " +"_PyAST_comprehension(a, b, c, 1, p->arena)) }\n" +" | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' " +"z=disjunction { z })* {\n" +" _PyAST_comprehension(a, b, c, 0, p->arena) }\n" +" | invalid_for_if_clause\n" +" | invalid_for_target\n" +"\n" +"listcomp[expr_ty]:\n" +" | '[' a=named_expression b=for_if_clauses ']' { _PyAST_ListComp(a, b, " +"EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"setcomp[expr_ty]:\n" +" | '{' a=named_expression b=for_if_clauses '}' { _PyAST_SetComp(a, b, " +"EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"genexp[expr_ty]:\n" +" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses " +"')' { _PyAST_GeneratorExp(a, b, EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"dictcomp[expr_ty]:\n" +" | '{' a=kvpair b=for_if_clauses '}' { _PyAST_DictComp(a->key, a->value, " +"b, EXTRA) }\n" +" | invalid_dict_comprehension\n" +"\n" +"# FUNCTION CALL ARGUMENTS\n" +"# =======================\n" +"\n" +"arguments[expr_ty] (memo):\n" +" | a=args [','] &')' { a }\n" +" | invalid_arguments\n" +"\n" +"args[expr_ty]:\n" +" | a[asdl_expr_seq*]=','.(starred_expression | ( assignment_expression | " +"expression !':=') !'=')+ b=[',' k=kwargs {k}] {\n" +" _PyPegen_collect_call_seqs(p, a, b, EXTRA) }\n" +" | a=kwargs { _PyAST_Call(_PyPegen_dummy_name(p),\n" +" CHECK_NULL_ALLOWED(asdl_expr_seq*, " +"_PyPegen_seq_extract_starred_exprs(p, a)),\n" +" CHECK_NULL_ALLOWED(asdl_keyword_seq*, " +"_PyPegen_seq_delete_starred_exprs(p, a)),\n" +" EXTRA) }\n" +"\n" +"kwargs[asdl_seq*]:\n" +" | a=','.kwarg_or_starred+ ',' b=','.kwarg_or_double_starred+ " +"{ _PyPegen_join_sequences(p, a, b) }\n" +" | ','.kwarg_or_starred+\n" +" | ','.kwarg_or_double_starred+\n" +"\n" +"starred_expression[expr_ty]:\n" +" | invalid_starred_expression_unpacking\n" +" | '*' a=expression { _PyAST_Starred(a, Load, EXTRA) }\n" +" | invalid_starred_expression\n" +"\n" +"kwarg_or_starred[KeywordOrStarred*]:\n" +" | invalid_kwarg\n" +" | a=NAME '=' b=expression {\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v." +"Name.id, b, EXTRA)), 1) }\n" +" | a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }\n" +"\n" +"kwarg_or_double_starred[KeywordOrStarred*]:\n" +" | invalid_kwarg\n" +" | a=NAME '=' b=expression {\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v." +"Name.id, b, EXTRA)), 1) }\n" +" | '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, " +"_PyAST_keyword(NULL, a, EXTRA)), 1) }\n" +"\n" +"# ASSIGNMENT TARGETS\n" +"# ==================\n" +"\n" +"# Generic targets\n" +"# ---------------\n" +"\n" +"# NOTE: star_targets may contain *bitwise_or, targets may not.\n" +"star_targets[expr_ty]:\n" +" | a=star_target !',' { a }\n" +" | a=star_target b=(',' c=star_target { c })* [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"a, b)), Store, EXTRA) }\n" +"\n" +"star_targets_list_seq[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_target+ " +"[','] { a }\n" +"\n" +"star_targets_tuple_seq[asdl_expr_seq*]:\n" +" | a=star_target b=(',' c=star_target { c })+ [','] { (asdl_expr_seq*) " +"_PyPegen_seq_insert_in_front(p, a, b) }\n" +" | a=star_target ',' { (asdl_expr_seq*) _PyPegen_singleton_seq(p, a) }\n" +"\n" +"star_target[expr_ty] (memo):\n" +" | '*' a=(!'*' star_target) {\n" +" _PyAST_Starred(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), Store, EXTRA) }\n" +" | target_with_star_atom\n" +"\n" +"target_with_star_atom[expr_ty] (memo):\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." +"id, Store, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +"Store, EXTRA) }\n" +" | star_atom\n" +"\n" +"star_atom[expr_ty]:\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Store) }\n" +" | '(' a=target_with_star_atom ')' { _PyPegen_set_expr_context(p, a, " +"Store) }\n" +" | '(' a=[star_targets_tuple_seq] ')' { _PyAST_Tuple(a, Store, EXTRA) }\n" +" | '[' a=[star_targets_list_seq] ']' { _PyAST_List(a, Store, EXTRA) }\n" +"\n" +"single_target[expr_ty]:\n" +" | single_subscript_attribute_target\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Store) }\n" +" | '(' a=single_target ')' { a }\n" +"\n" +"single_subscript_attribute_target[expr_ty]:\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." +"id, Store, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +"Store, EXTRA) }\n" +"\n" +"t_primary[expr_ty]:\n" +" | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name." +"id, Load, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' &t_lookahead { _PyAST_Subscript(a, b, " +"Load, EXTRA) }\n" +" | a=t_primary b=genexp &t_lookahead {\n" +" _PyAST_Call(a, CHECK(asdl_expr_seq*, " +"(asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }\n" +" | a=t_primary '(' b=[arguments] ')' &t_lookahead {\n" +" _PyAST_Call(a,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" EXTRA) }\n" +" | a=atom &t_lookahead { a }\n" +"\n" +"t_lookahead: '(' | '[' | '.'\n" +"\n" +"# Targets for del statements\n" +"# --------------------------\n" +"\n" +"del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }\n" +"\n" +"del_target[expr_ty] (memo):\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." +"id, Del, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +"Del, EXTRA) }\n" +" | del_t_atom\n" +"\n" +"del_t_atom[expr_ty]:\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Del) }\n" +" | '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }\n" +" | '(' a=[del_targets] ')' { _PyAST_Tuple(a, Del, EXTRA) }\n" +" | '[' a=[del_targets] ']' { _PyAST_List(a, Del, EXTRA) }\n" +"\n" +"# TYPING ELEMENTS\n" +"# ---------------\n" +"\n" +"# type_expressions allow */** but ignore them\n" +"type_expressions[asdl_expr_seq*]:\n" +" | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {\n" +" (asdl_expr_seq*)_PyPegen_seq_append_to_end(\n" +" p,\n" +" CHECK(asdl_seq*, _PyPegen_seq_append_to_end(p, a, b)),\n" +" c) }\n" +" | a=','.expression+ ',' '*' b=expression " +"{ (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }\n" +" | a=','.expression+ ',' '**' b=expression " +"{ (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }\n" +" | '*' a=expression ',' '**' b=expression {\n" +" (asdl_expr_seq*)_PyPegen_seq_append_to_end(\n" +" p,\n" +" CHECK(asdl_seq*, _PyPegen_singleton_seq(p, a)),\n" +" b) }\n" +" | '*' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }\n" +" | '**' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }\n" +" | a[asdl_expr_seq*]=','.expression+ {a}\n" +"\n" +"func_type_comment[Token*]:\n" +" | NEWLINE t=TYPE_COMMENT &(NEWLINE INDENT) { t } # Must be followed by " +"indented block\n" +" | invalid_double_type_comments\n" +" | TYPE_COMMENT\n" +"\n" +"# ========================= END OF THE GRAMMAR ===========================\n" +"\n" +"\n" +"\n" +"# ========================= START OF INVALID RULES =======================\n" +"\n" +"# From here on, there are rules for invalid syntax with specialised error " +"messages\n" +"invalid_arguments:\n" +" | ((','.(starred_expression | ( assignment_expression | expression !':" +"=') !'=')+ ',' kwargs) | kwargs) a=',' ','.(starred_expression !'=')+ {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"iterable argument unpacking " +"follows keyword argument unpacking\") }\n" +" | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] " +"{\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, " +"comprehension_ty)), \"Generator expression must be parenthesized\") }\n" +" | a=NAME b='=' expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\")}\n" +" | (args ',')? a=NAME b='=' &(',' | ')') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"expected argument value " +"expression\")}\n" +" | a=args b=for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a, b) }\n" +" | args ',' a=expression b=for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, " +"comprehension_ty)), \"Generator expression must be parenthesized\") }\n" +" | a=args ',' args { _PyPegen_arguments_parsing_error(p, a) }\n" +"invalid_kwarg:\n" +" | a[Token*]=('True'|'False'|'None') b='=' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot assign to %s\", " +"PyBytes_AS_STRING(a->bytes)) }\n" +" | a=NAME b='=' expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\")}\n" +" | !(NAME '=') a=expression b='=' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(\n" +" a, b, \"expression cannot contain assignment, perhaps you meant " +"\\\"==\\\"?\") }\n" +" | a='**' expression '=' b=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot assign to keyword " +"argument unpacking\") }\n" +"\n" +"# IMPORTANT: Note that the \"_without_invalid\" suffix causes the rule to " +"not call invalid rules under it\n" +"expression_without_invalid[expr_ty]:\n" +" | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, " +"a, c, EXTRA) }\n" +" | disjunction\n" +" | lambdef\n" +"invalid_legacy_expression:\n" +" | a=NAME !'(' b=star_expressions {\n" +" _PyPegen_check_legacy_stmt(p, a) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b,\n" +" \"Missing parentheses in call to '%U'. Did you mean %U(...)?\", " +"a->v.Name.id, a->v.Name.id) : NULL}\n" +"\n" +"invalid_type_param:\n" +" | '*' a=NAME colon=':' e=expression {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" +" ? \"cannot use constraints with TypeVarTuple\"\n" +" : \"cannot use bound with TypeVarTuple\")\n" +" }\n" +" | '**' a=NAME colon=':' e=expression {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" +" ? \"cannot use constraints with ParamSpec\"\n" +" : \"cannot use bound with ParamSpec\")\n" +" }\n" +"\n" +"invalid_expression:\n" +" | STRING a=(!STRING expression_without_invalid)+ STRING {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE( PyPegen_first_item(a, expr_ty), " +"PyPegen_last_item(a, expr_ty),\n" +" \"invalid syntax. Is this intended to be part of the string?\") }\n" +" # !(NAME STRING) is not matched so we don't show this error with some " +"invalid string prefixes like: kf\"dsfsdf\"\n" +" # Soft keywords need to also be ignored because they can be parsed as " +"NAME NAME\n" +" | !(NAME STRING | SOFT_KEYWORD) a=disjunction " +"b=expression_without_invalid {\n" +" _PyPegen_check_legacy_stmt(p, a) ? NULL : p->tokens[p->mark-1]-" +">level == 0 ? NULL :\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Perhaps you " +"forgot a comma?\") }\n" +" | a=disjunction 'if' b=disjunction !('else'|':') " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"expected 'else' after 'if' " +"expression\") }\n" +" | a=disjunction 'if' b=disjunction 'else' !expression {\n" +" RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"expected expression after 'else', " +"but statement is given\") }\n" +" | a[stmt_ty]=(pass_stmt|break_stmt|continue_stmt) 'if' b=disjunction " +"'else' c=simple_stmt {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION (a, \"expected expression before " +"'if', but statement is given\") }\n" +" | a='lambda' [lambda_params] b=':' &FSTRING_MIDDLE {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"f-string: lambda expressions " +"are not allowed without parentheses\") }\n" +" | a='lambda' [lambda_params] b=':' &TSTRING_MIDDLE {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"t-string: lambda expressions " +"are not allowed without parentheses\") }\n" +"\n" +"invalid_named_expression(memo):\n" +" | a=expression ':=' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use assignment expressions with %s\", " +"_PyPegen_get_expr_name(a)) }\n" +" | a=NAME '=' b=bitwise_or !('='|':=') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\") }\n" +" | !(list|tuple|genexp|'True'|'None'|'False') a=bitwise_or b='=' " +"bitwise_or !('='|':=') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot assign to %s here. " +"Maybe you meant '==' instead of '='?\",\n" +" _PyPegen_get_expr_name(a)) }\n" +"\n" +"invalid_assignment:\n" +" | a=invalid_ann_assign_target ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a,\n" +" \"only single target (not %s) can be annotated\",\n" +" _PyPegen_get_expr_name(a)\n" +" )}\n" +" | a=star_named_expression ',' star_named_expressions* ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"only single target (not " +"tuple) can be annotated\") }\n" +" | a=expression ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"illegal target for " +"annotation\") }\n" +" | (star_targets '=')* a=star_expressions '=' {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" +" | (star_targets '=')* a=yield_expr " +"'=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression " +"not possible\") }\n" +" | a=star_expressions augassign annotated_rhs {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a,\n" +" \"'%s' is an illegal expression for augmented assignment\",\n" +" _PyPegen_get_expr_name(a)\n" +" )}\n" +"invalid_ann_assign_target[expr_ty]:\n" +" | list\n" +" | tuple\n" +" | '(' a=invalid_ann_assign_target ')' { a }\n" +"invalid_del_stmt:\n" +" | 'del' a=star_expressions {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(DEL_TARGETS, a) }\n" +"invalid_block:\n" +" | NEWLINE !INDENT { RAISE_INDENTATION_ERROR(\"expected an indented " +"block\") }\n" +"invalid_comprehension:\n" +" | ('[' | '(' | '{') a=starred_expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"iterable unpacking cannot be " +"used in comprehension\") }\n" +" | ('[' | '{') a=star_named_expression ',' b=star_named_expressions " +"for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, PyPegen_last_item(b, expr_ty),\n" +" \"did you forget parentheses around the comprehension target?\") }\n" +" | ('[' | '{') a=star_named_expression b=',' for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"did you forget parentheses " +"around the comprehension target?\") }\n" +"invalid_dict_comprehension:\n" +" | '{' a='**' bitwise_or for_if_clauses '}' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"dict unpacking cannot be used " +"in dict comprehension\") }\n" +"invalid_parameters:\n" +" | a=\"/\" ',' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"at least one argument must " +"precede /\") }\n" +" | (slash_no_default | slash_with_default) param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ may appear only once\") }\n" +" | slash_no_default? param_no_default* invalid_parameters_helper " +"a=param_no_default {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"parameter without a default " +"follows parameter with a default\") }\n" +" | param_no_default* a='(' param_no_default+ ','? b=')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"Function parameters cannot be " +"parenthesized\") }\n" +" | (slash_no_default | slash_with_default)? param_maybe_default* '*' (',' " +"| param_no_default) param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ must be ahead of *\") }\n" +" | param_maybe_default+ '/' a='*' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected comma between / and " +"*\") }\n" +"invalid_default:\n" +" | a='=' &(')'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected " +"default value expression\") }\n" +"invalid_star_etc:\n" +" | a='*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"named arguments must follow bare *\") }\n" +" | '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR(\"bare * has associated type " +"comment\") }\n" +" | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" +"positional argument cannot have default value\") }\n" +" | '*' (param_no_default | ',') param_maybe_default* " +"a='*' (param_no_default | ',') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " +"once\") }\n" +"invalid_kwds:\n" +" | '**' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-keyword " +"argument cannot have default value\") }\n" +" | '**' param ',' a=param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"arguments cannot follow var-keyword argument\") }\n" +" | '**' param ',' a[Token*]=('*'|'**'|'/') " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +"invalid_parameters_helper: # This is only there to avoid type errors\n" +" | a=slash_with_default { _PyPegen_singleton_seq(p, a) }\n" +" | param_with_default+\n" +"invalid_lambda_parameters:\n" +" | a=\"/\" ',' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"at least one argument must " +"precede /\") }\n" +" | (lambda_slash_no_default | lambda_slash_with_default) " +"lambda_param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ may appear only once\") }\n" +" | lambda_slash_no_default? lambda_param_no_default* " +"invalid_lambda_parameters_helper a=lambda_param_no_default {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"parameter without a default " +"follows parameter with a default\") }\n" +" | lambda_param_no_default* a='(' ','.lambda_param+ ','? b=')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"Lambda expression parameters " +"cannot be parenthesized\") }\n" +" | (lambda_slash_no_default | lambda_slash_with_default)? " +"lambda_param_maybe_default* '*' (',' | lambda_param_no_default) " +"lambda_param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ must be ahead of *\") }\n" +" | lambda_param_maybe_default+ '/' a='*' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected comma between / and " +"*\") }\n" +"invalid_lambda_parameters_helper:\n" +" | a=lambda_slash_with_default { _PyPegen_singleton_seq(p, a) }\n" +" | lambda_param_with_default+\n" +"invalid_lambda_star_etc:\n" +" | '*' (':' | ',' (':' | '**')) { RAISE_SYNTAX_ERROR(\"named arguments " +"must follow bare *\") }\n" +" | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" +"positional argument cannot have default value\") }\n" +" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* " +"a='*' (lambda_param_no_default | ',') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " +"once\") }\n" +"invalid_lambda_kwds:\n" +" | '**' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" +"keyword argument cannot have default value\") }\n" +" | '**' lambda_param ',' a=lambda_param " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +" | '**' lambda_param ',' a[Token*]=('*'|'**'|'/') " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +"invalid_double_type_comments:\n" +" | TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {\n" +" RAISE_SYNTAX_ERROR(\"Cannot have two type comments on def\") }\n" +"invalid_with_item:\n" +" | expression 'as' a=expression &(',' | ')' | ':') {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" +"\n" +"invalid_for_if_clause:\n" +" | 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in' {\n" +" RAISE_SYNTAX_ERROR(\"'in' expected after for-loop variables\") }\n" +"\n" +"invalid_for_target:\n" +" | 'async'? 'for' a=star_expressions {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(FOR_TARGETS, a) }\n" +"\n" +"invalid_group:\n" +" | '(' a=starred_expression ')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot use starred expression " +"here\") }\n" +" | '(' a='**' expression ')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot use double starred " +"expression here\") }\n" +"invalid_import:\n" +" | a='import' ','.dotted_name+ 'from' dotted_name {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"Did you mean to use 'from ... " +"import ...' instead?\") }\n" +" | 'import' token=NEWLINE {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" +"invalid_dotted_as_name:\n" +" | dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,\n" +" \"cannot use %s as import target\", " +"_PyPegen_get_expr_name(a)) }\n" +"invalid_import_from_as_name:\n" +" | NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,\n" +" \"cannot use %s as import target\", " +"_PyPegen_get_expr_name(a)) }\n" +"\n" +"invalid_import_from_targets:\n" +" | import_from_as_names ',' NEWLINE {\n" +" RAISE_SYNTAX_ERROR(\"trailing comma not allowed without surrounding " +"parentheses\") }\n" +" | token=NEWLINE {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" +"\n" +"invalid_with_stmt:\n" +" | ['async'] 'with' ','.(expression ['as' star_target])+ NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | ['async'] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +"NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +"invalid_with_stmt_indent:\n" +" | ['async'] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !" +"INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " +"statement on line %d\", a->lineno) }\n" +" | ['async'] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +"':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " +"statement on line %d\", a->lineno) }\n" +"\n" +"invalid_try_stmt:\n" +" | a='try' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'try' " +"statement on line %d\", a->lineno) }\n" +" | 'try' ':' block !('except' | 'finally') " +"{ RAISE_SYNTAX_ERROR(\"expected 'except' or 'finally' block\") }\n" +" | 'try' ':' block* except_block+ a='except' b='*' expression ['as' NAME] " +"':' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot have both 'except' and " +"'except*' on the same 'try'\") }\n" +" | 'try' ':' block* except_star_block+ a='except' [expression ['as' " +"NAME]] ':' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot have both 'except' and " +"'except*' on the same 'try'\") }\n" +"invalid_except_stmt:\n" +" | 'except' a=expression ',' expressions 'as' NAME ':' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"multiple exception types must " +"be parenthesized when using 'as'\") }\n" +" | a='except' expression ['as' NAME ] NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='except' NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | 'except' expression 'as' a=expression ':' block {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use except statement with %s\", " +"_PyPegen_get_expr_name(a)) }\n" +"invalid_except_star_stmt:\n" +" | 'except' '*' a=expression ',' expressions 'as' NAME ':' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"multiple exception types must " +"be parenthesized when using 'as'\") }\n" +" | a='except' '*' expression ['as' NAME ] NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='except' '*' (NEWLINE | ':') { RAISE_SYNTAX_ERROR(\"expected one or " +"more exception types\") }\n" +" | 'except' '*' expression 'as' a=expression ':' block {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use except* statement with %s\", " +"_PyPegen_get_expr_name(a)) }\n" +"invalid_finally_stmt:\n" +" | a='finally' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'finally' " +"statement on line %d\", a->lineno) }\n" +"invalid_except_stmt_indent:\n" +" | a='except' expression ['as' NAME ] ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'except' " +"statement on line %d\", a->lineno) }\n" +" | a='except' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR(\"expected an " +"indented block after 'except' statement on line %d\", a->lineno) }\n" +"invalid_except_star_stmt_indent:\n" +" | a='except' '*' expression ['as' NAME ] ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'except*' " +"statement on line %d\", a->lineno) }\n" +"invalid_match_stmt:\n" +" | \"match\" subject_expr NEWLINE { CHECK_VERSION(void*, 10, \"Pattern " +"matching is\", RAISE_SYNTAX_ERROR(\"expected ':'\") ) }\n" +" | a=\"match\" subject=subject_expr ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'match' " +"statement on line %d\", a->lineno) }\n" +"invalid_case_block:\n" +" | \"case\" patterns guard? NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a=\"case\" patterns guard? ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'case' " +"statement on line %d\", a->lineno) }\n" +"invalid_as_pattern:\n" +" | or_pattern 'as' a=\"_\" { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"cannot use '_' as a target\") }\n" +" | or_pattern 'as' a=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use %s as pattern target\", " +"_PyPegen_get_expr_name(a)) }\n" +"invalid_class_pattern:\n" +" | name_or_attr '(' a=invalid_class_argument_pattern " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(\n" +" PyPegen_first_item(a, pattern_ty),\n" +" PyPegen_last_item(a, pattern_ty),\n" +" \"positional patterns follow keyword patterns\") }\n" +"invalid_class_argument_pattern[asdl_pattern_seq*]:\n" +" | [positional_patterns ','] keyword_patterns ',' a=positional_patterns " +"{ a }\n" +"invalid_if_stmt:\n" +" | 'if' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a='if' a=named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'if' " +"statement on line %d\", a->lineno) }\n" +"invalid_elif_stmt:\n" +" | 'elif' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a='elif' named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'elif' " +"statement on line %d\", a->lineno) }\n" +"invalid_else_stmt:\n" +" | a='else' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'else' " +"statement on line %d\", a->lineno) }\n" +" | 'else' ':' block 'elif' { RAISE_SYNTAX_ERROR(\"'elif' block follows an " +"'else' block\")}\n" +"invalid_while_stmt:\n" +" | 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a='while' named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'while' " +"statement on line %d\", a->lineno) }\n" +"invalid_for_stmt:\n" +" | ['async'] 'for' star_targets 'in' star_expressions NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | ['async'] a='for' star_targets 'in' star_expressions ':' NEWLINE !" +"INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'for' " +"statement on line %d\", a->lineno) }\n" +"invalid_def_raw:\n" +" | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' " +"expression] ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after function " +"definition on line %d\", a->lineno) }\n" +" | ['async'] 'def' NAME [type_params] &&'(' [params] ')' ['->' " +"expression] &&':' [func_type_comment] block\n" +"invalid_class_def_raw:\n" +" | 'class' NAME [type_params] ['(' [arguments] ')'] NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='class' NAME [type_params] ['(' [arguments] ')'] ':' NEWLINE !INDENT " +"{\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after class " +"definition on line %d\", a->lineno) }\n" +"\n" +"invalid_double_starred_kvpairs:\n" +" | ','.double_starred_kvpair+ ',' invalid_kvpair\n" +" | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, " +"\"cannot use a starred expression in a dictionary value\") }\n" +" | expression a=':' &('}'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"expression expected after dictionary key and ':'\") }\n" +"invalid_kvpair:\n" +" | a=expression !(':') {\n" +" RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, a->lineno, a-" +">end_col_offset - 1, a->end_lineno, -1, \"':' expected after dictionary " +"key\") }\n" +" | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, " +"\"cannot use a starred expression in a dictionary value\") }\n" +" | expression a=':' &('}'|',') {RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"expression expected after dictionary key and ':'\") }\n" +"invalid_starred_expression_unpacking:\n" +" | a='*' expression '=' b=expression { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b, \"cannot assign to iterable argument unpacking\") }\n" +"invalid_starred_expression:\n" +" | '*' { RAISE_SYNTAX_ERROR(\"Invalid star expression\") }\n" +"\n" +"invalid_fstring_replacement_field:\n" +" | '{' a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '='\") }\n" +" | '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '!'\") }\n" +" | '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before ':'\") }\n" +" | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '}'\") }\n" +" | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: " +"expecting a valid expression after '{'\") }\n" +" | '{' annotated_rhs !('=' | '!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '=', or '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '=' !('!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '='? invalid_fstring_conversion_character\n" +" | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting ':' or '}'\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '}', or format specs\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '}'\") }\n" +"\n" +"invalid_fstring_conversion_character:\n" +" | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: " +"missing conversion character\") }\n" +" | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: invalid " +"conversion character\") }\n" +"\n" +"invalid_tstring_replacement_field:\n" +" | '{' a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"t-string: valid " +"expression required before '='\") }\n" +" | '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"t-string: valid " +"expression required before '!'\") }\n" +" | '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"t-string: valid " +"expression required before ':'\") }\n" +" | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"t-string: valid " +"expression required before '}'\") }\n" +" | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-string: " +"expecting a valid expression after '{'\") }\n" +" | '{' annotated_rhs !('=' | '!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting '=', or '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '=' !('!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '='? invalid_tstring_conversion_character\n" +" | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting ':' or '}'\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting '}', or format specs\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting '}'\") }\n" +"\n" +"invalid_tstring_conversion_character:\n" +" | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-string: " +"missing conversion character\") }\n" +" | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-string: invalid " +"conversion character\") }\n" +"\n" +"invalid_string_tstring_concat:\n" +" | a=(fstring|string)+ b[expr_ty]=tstring {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(PyPegen_last_item(a, expr_ty), b, " +"\"cannot mix t-string literals with string or bytes literals\") }\n" +" | a=tstring+ b[expr_ty]=(fstring|string) {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(PyPegen_last_item(a, expr_ty), b, " +"\"cannot mix t-string literals with string or bytes literals\") }\n" +"\n" +"invalid_arithmetic:\n" +" | sum ('+'|'-'|'*'|'/'|'%'|'//'|'@') a='not' b=inversion " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"'not' after an operator must be " +"parenthesized\") }\n" +"invalid_factor:\n" +" | ('+' | '-' | '~') a='not' b=factor { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b, \"'not' after an operator must be parenthesized\") }\n" +"\n" +"invalid_type_params:\n" +" | '[' token=']' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(\n" +" token,\n" +" \"Type parameter list cannot be empty\")}\n" msgstr "" +"# PEG grammar for Python\n" +"\n" +"@trailer '''\n" +"void *\n" +"_PyPegen_parse(Parser *p)\n" +"{\n" +" // Initialize keywords\n" +" p->keywords = reserved_keywords;\n" +" p->n_keyword_lists = n_keyword_lists;\n" +" p->soft_keywords = soft_keywords;\n" +"\n" +" // Run parser\n" +" void *result = NULL;\n" +" if (p->start_rule == Py_file_input) {\n" +" result = file_rule(p);\n" +" } else if (p->start_rule == Py_single_input) {\n" +" result = interactive_rule(p);\n" +" } else if (p->start_rule == Py_eval_input) {\n" +" result = eval_rule(p);\n" +" } else if (p->start_rule == Py_func_type_input) {\n" +" result = func_type_rule(p);\n" +" }\n" +"\n" +" return result;\n" +"}\n" +"'''\n" +"\n" +"# ========================= START OF THE GRAMMAR =========================\n" +"\n" +"# General grammatical elements and rules:\n" +"#\n" +"# * Strings with double quotes (\") denote SOFT KEYWORDS\n" +"# * Strings with single quotes (') denote KEYWORDS\n" +"# * Upper case names (NAME) denote tokens in the Grammar/Tokens file\n" +"# * Rule names starting with \"invalid_\" are used for specialized syntax " +"errors\n" +"# - These rules are NOT used in the first pass of the parser.\n" +"# - Only if the first pass fails to parse, a second pass including the " +"invalid\n" +"# rules will be executed.\n" +"# - If the parser fails in the second phase with a generic syntax error, " +"the\n" +"# location of the generic failure of the first pass will be used (this " +"avoids\n" +"# reporting incorrect locations due to the invalid rules).\n" +"# - The order of the alternatives involving invalid rules matter\n" +"# (like any rule in PEG).\n" +"#\n" +"# Grammar Syntax (see PEP 617 for more information):\n" +"#\n" +"# rule_name: expression\n" +"# Optionally, a type can be included right after the rule name, which\n" +"# specifies the return type of the C or Python function corresponding to " +"the\n" +"# rule:\n" +"# rule_name[return_type]: expression\n" +"# If the return type is omitted, then a void * is returned in C and an Any " +"in\n" +"# Python.\n" +"# e1 e2\n" +"# Match e1, then match e2.\n" +"# e1 | e2\n" +"# Match e1 or e2.\n" +"# The first alternative can also appear on the line after the rule name " +"for\n" +"# formatting purposes. In that case, a | must be used before the first\n" +"# alternative, like so:\n" +"# rule_name[return_type]:\n" +"# | first_alt\n" +"# | second_alt\n" +"# ( e )\n" +"# Match e (allows also to use other operators in the group like '(e)*')\n" +"# [ e ] or e?\n" +"# Optionally match e.\n" +"# e*\n" +"# Match zero or more occurrences of e.\n" +"# e+\n" +"# Match one or more occurrences of e.\n" +"# s.e+\n" +"# Match one or more occurrences of e, separated by s. The generated parse " +"tree\n" +"# does not include the separator. This is otherwise identical to (e (s " +"e)*).\n" +"# &e\n" +"# Succeed if e can be parsed, without consuming any input.\n" +"# !e\n" +"# Fail if e can be parsed, without consuming any input.\n" +"# ~\n" +"# Commit to the current alternative, even if it fails to parse.\n" +"# &&e\n" +"# Eager parse e. The parser will not backtrack and will immediately\n" +"# fail with SyntaxError if e cannot be parsed.\n" +"#\n" +"\n" +"# STARTING RULES\n" +"# ==============\n" +"\n" +"file[mod_ty]: a=[statements] ENDMARKER { _PyPegen_make_module(p, a) }\n" +"interactive[mod_ty]: a=statement_newline { _PyAST_Interactive(a, p-" +">arena) }\n" +"eval[mod_ty]: a=expressions NEWLINE* ENDMARKER { _PyAST_Expression(a, p-" +">arena) }\n" +"func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* " +"ENDMARKER { _PyAST_FunctionType(a, b, p->arena) }\n" +"\n" +"# GENERAL STATEMENTS\n" +"# ==================\n" +"\n" +"statements[asdl_stmt_seq*]: a=statement+ " +"{ (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a) }\n" +"\n" +"statement[asdl_stmt_seq*]:\n" +" | a=compound_stmt { _PyPegen_register_stmts(p ,\n" +" (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a)\n" +" ) }\n" +" | a[asdl_stmt_seq*]=simple_stmts { a }\n" +"\n" +"single_compound_stmt[asdl_stmt_seq*]:\n" +" | a=compound_stmt {\n" +" _PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_singleton_seq(p, " +"a)) }\n" +"\n" +"statement_newline[asdl_stmt_seq*]:\n" +" | a=single_compound_stmt NEWLINE { a }\n" +" | simple_stmts\n" +" | NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, CHECK(stmt_ty, " +"_PyAST_Pass(EXTRA))) }\n" +" | ENDMARKER { _PyPegen_interactive_exit(p) }\n" +"\n" +"simple_stmts[asdl_stmt_seq*]:\n" +" | a=simple_stmt !';' NEWLINE { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, " +"a) } # Not needed, there for speedup\n" +" | a[asdl_stmt_seq*]=';'.simple_stmt+ [';'] NEWLINE { a }\n" +"\n" +"# NOTE: assignment MUST precede expression, else parsing a simple " +"assignment\n" +"# will throw a SyntaxError.\n" +"simple_stmt[stmt_ty] (memo):\n" +" | assignment\n" +" | &\"type\" type_alias\n" +" | e=star_expressions { _PyAST_Expr(e, EXTRA) }\n" +" | &'return' return_stmt\n" +" | &('import' | 'from') import_stmt\n" +" | &'raise' raise_stmt\n" +" | &'pass' pass_stmt\n" +" | &'del' del_stmt\n" +" | &'yield' yield_stmt\n" +" | &'assert' assert_stmt\n" +" | &'break' break_stmt\n" +" | &'continue' continue_stmt\n" +" | &'global' global_stmt\n" +" | &'nonlocal' nonlocal_stmt\n" +"\n" +"compound_stmt[stmt_ty]:\n" +" | &('def' | '@' | 'async') function_def\n" +" | &'if' if_stmt\n" +" | &('class' | '@') class_def\n" +" | &('with' | 'async') with_stmt\n" +" | &('for' | 'async') for_stmt\n" +" | &'try' try_stmt\n" +" | &'while' while_stmt\n" +" | match_stmt\n" +"\n" +"# SIMPLE STATEMENTS\n" +"# =================\n" +"\n" +"# NOTE: annotated_rhs may start with 'yield'; yield_expr must start with " +"'yield'\n" +"assignment[stmt_ty]:\n" +" | a=NAME ':' b=expression c=['=' d=annotated_rhs { d }] {\n" +" CHECK_VERSION(\n" +" stmt_ty,\n" +" 6,\n" +" \"Variable annotation syntax is\",\n" +" _PyAST_AnnAssign(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), b, c, 1, EXTRA)\n" +" ) }\n" +" | a=('(' b=single_target ')' { b }\n" +" | single_subscript_attribute_target) ':' b=expression c=['=' " +"d=annotated_rhs { d }] {\n" +" CHECK_VERSION(stmt_ty, 6, \"Variable annotations syntax is\", " +"_PyAST_AnnAssign(a, b, c, 0, EXTRA)) }\n" +" | a[asdl_expr_seq*]=(z=star_targets '=' { z })+ b=annotated_rhs !'=' " +"tc=[TYPE_COMMENT] {\n" +" _PyAST_Assign(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | a=single_target b=augassign ~ c=annotated_rhs {\n" +" _PyAST_AugAssign(a, b->kind, c, EXTRA) }\n" +" | invalid_assignment\n" +"\n" +"annotated_rhs[expr_ty]: yield_expr | star_expressions\n" +"\n" +"augassign[AugOperator*]:\n" +" | '+=' { _PyPegen_augoperator(p, Add) }\n" +" | '-=' { _PyPegen_augoperator(p, Sub) }\n" +" | '*=' { _PyPegen_augoperator(p, Mult) }\n" +" | '@=' { CHECK_VERSION(AugOperator*, 5, \"The '@' operator is\", " +"_PyPegen_augoperator(p, MatMult)) }\n" +" | '/=' { _PyPegen_augoperator(p, Div) }\n" +" | '%=' { _PyPegen_augoperator(p, Mod) }\n" +" | '&=' { _PyPegen_augoperator(p, BitAnd) }\n" +" | '|=' { _PyPegen_augoperator(p, BitOr) }\n" +" | '^=' { _PyPegen_augoperator(p, BitXor) }\n" +" | '<<=' { _PyPegen_augoperator(p, LShift) }\n" +" | '>>=' { _PyPegen_augoperator(p, RShift) }\n" +" | '**=' { _PyPegen_augoperator(p, Pow) }\n" +" | '//=' { _PyPegen_augoperator(p, FloorDiv) }\n" +"\n" +"return_stmt[stmt_ty]:\n" +" | 'return' a=[star_expressions] { _PyAST_Return(a, EXTRA) }\n" +"\n" +"raise_stmt[stmt_ty]:\n" +" | 'raise' a=expression b=['from' z=expression { z }] { _PyAST_Raise(a, " +"b, EXTRA) }\n" +" | 'raise' { _PyAST_Raise(NULL, NULL, EXTRA) }\n" +"\n" +"pass_stmt[stmt_ty]:\n" +" | 'pass' { _PyAST_Pass(EXTRA) }\n" +"\n" +"break_stmt[stmt_ty]:\n" +" | 'break' { _PyAST_Break(EXTRA) }\n" +"\n" +"continue_stmt[stmt_ty]:\n" +" | 'continue' { _PyAST_Continue(EXTRA) }\n" +"\n" +"global_stmt[stmt_ty]: 'global' a[asdl_expr_seq*]=','.NAME+ {\n" +" _PyAST_Global(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, " +"a)), EXTRA) }\n" +"\n" +"nonlocal_stmt[stmt_ty]: 'nonlocal' a[asdl_expr_seq*]=','.NAME+ {\n" +" _PyAST_Nonlocal(CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p, " +"a)), EXTRA) }\n" +"\n" +"del_stmt[stmt_ty]:\n" +" | 'del' a=del_targets &(';' | NEWLINE) { _PyAST_Delete(a, EXTRA) }\n" +" | invalid_del_stmt\n" +"\n" +"yield_stmt[stmt_ty]: y=yield_expr { _PyAST_Expr(y, EXTRA) }\n" +"\n" +"assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] " +"{ _PyAST_Assert(a, b, EXTRA) }\n" +"\n" +"import_stmt[stmt_ty]:\n" +" | invalid_import\n" +" | import_name\n" +" | import_from\n" +"\n" +"# Import statements\n" +"# -----------------\n" +"\n" +"import_name[stmt_ty]: 'import' a=dotted_as_names { _PyAST_Import(a, " +"EXTRA) }\n" +"# note below: the ('.' | '...') is necessary because '...' is tokenized as " +"ELLIPSIS\n" +"import_from[stmt_ty]:\n" +" | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets " +"{\n" +" _PyPegen_checked_future_import(p, b->v.Name.id, c, " +"_PyPegen_seq_count_dots(a), EXTRA) }\n" +" | 'from' a=('.' | '...')+ 'import' b=import_from_targets {\n" +" _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }\n" +"import_from_targets[asdl_alias_seq*]:\n" +" | '(' a=import_from_as_names [','] ')' { a }\n" +" | import_from_as_names !','\n" +" | '*' { (asdl_alias_seq*)_PyPegen_singleton_seq(p, CHECK(alias_ty, " +"_PyPegen_alias_for_star(p, EXTRA))) }\n" +" | invalid_import_from_targets\n" +"import_from_as_names[asdl_alias_seq*]:\n" +" | a[asdl_alias_seq*]=','.import_from_as_name+ { a }\n" +"import_from_as_name[alias_ty]:\n" +" | invalid_import_from_as_name\n" +" | a=NAME b=['as' z=NAME { z }] { _PyAST_alias(\n" +" a->v.Name.id, (b) ? ((expr_ty) b)->v.Name.id : NULL, EXTRA) }\n" +"\n" +"dotted_as_names[asdl_alias_seq*]:\n" +" | a[asdl_alias_seq*]=','.dotted_as_name+ { a }\n" +"dotted_as_name[alias_ty]:\n" +" | invalid_dotted_as_name\n" +" | a=dotted_name b=['as' z=NAME { z }] { _PyAST_alias(\n" +" a->v.Name.id, (b) ? ((expr_ty) b)->v.Name.id : NULL, EXTRA) }\n" +"\n" +"dotted_name[expr_ty]:\n" +" | a=dotted_name '.' b=NAME { _PyPegen_join_names_with_dot(p, a, b) }\n" +" | NAME\n" +"\n" +"# COMPOUND STATEMENTS\n" +"# ===================\n" +"\n" +"# Common elements\n" +"# ---------------\n" +"\n" +"block[asdl_stmt_seq*] (memo):\n" +" | NEWLINE INDENT a=statements DEDENT { a }\n" +" | simple_stmts\n" +" | invalid_block\n" +"\n" +"decorators[asdl_expr_seq*]: a[asdl_expr_seq*]=('@' f=named_expression " +"NEWLINE { f })+ { a }\n" +"\n" +"# Class definitions\n" +"# -----------------\n" +"\n" +"class_def[stmt_ty]:\n" +" | a=decorators b=class_def_raw { _PyPegen_class_def_decorators(p, a, " +"b) }\n" +" | class_def_raw\n" +"\n" +"class_def_raw[stmt_ty]:\n" +" | invalid_class_def_raw\n" +" | 'class' a=NAME t=[type_params] b=['(' z=[arguments] ')' { z }] ':' " +"c=block {\n" +" _PyAST_ClassDef(a->v.Name.id,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" c, NULL, t, EXTRA) }\n" +"\n" +"# Function definitions\n" +"# --------------------\n" +"\n" +"function_def[stmt_ty]:\n" +" | d=decorators f=function_def_raw { _PyPegen_function_def_decorators(p, " +"d, f) }\n" +" | function_def_raw\n" +"\n" +"function_def_raw[stmt_ty]:\n" +" | invalid_def_raw\n" +" | 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" +" _PyAST_FunctionDef(n->v.Name.id,\n" +" (params) ? params : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)),\n" +" b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) }\n" +" | 'async' 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" +" CHECK_VERSION(\n" +" stmt_ty,\n" +" 5,\n" +" \"Async functions are\",\n" +" _PyAST_AsyncFunctionDef(n->v.Name.id,\n" +" (params) ? params : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)),\n" +" b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA)\n" +" ) }\n" +"\n" +"# Function parameters\n" +"# -------------------\n" +"\n" +"params[arguments_ty]:\n" +" | invalid_parameters\n" +" | parameters\n" +"\n" +"parameters[arguments_ty]:\n" +" | a=slash_no_default b[asdl_arg_seq*]=param_no_default* " +"c=param_with_default* d=[star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, a, NULL, b, c, d)) }\n" +" | a=slash_with_default b=param_with_default* c=[star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, NULL, a, NULL, b, c)) }\n" +" | a[asdl_arg_seq*]=param_no_default+ b=param_with_default* c=[star_etc] " +"{\n" +" _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }\n" +" | a=param_with_default+ b=[star_etc] { _PyPegen_make_arguments(p, NULL, " +"NULL, NULL, a, b)}\n" +" | a=star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, a) }\n" +"\n" +"# Some duplication here because we can't write (',' | &')'),\n" +"# which is because we don't support empty alternatives (yet).\n" +"\n" +"slash_no_default[asdl_arg_seq*]:\n" +" | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }\n" +" | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }\n" +"slash_with_default[SlashWithDefault*]:\n" +" | a=param_no_default* b=param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' " +"&')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +"\n" +"star_etc[StarEtc*]:\n" +" | invalid_star_etc\n" +" | '*' a=param_no_default b=param_maybe_default* c=[kwds] {\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' a=param_no_default_star_annotation b=param_maybe_default* c=[kwds] " +"{\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' ',' b=param_maybe_default+ c=[kwds] {\n" +" _PyPegen_star_etc(p, NULL, b, c) }\n" +" | a=kwds { _PyPegen_star_etc(p, NULL, NULL, a) }\n" +"\n" +"kwds[arg_ty]:\n" +" | invalid_kwds\n" +" | '**' a=param_no_default { a }\n" +"\n" +"# One parameter. This *includes* a following comma and type comment.\n" +"#\n" +"# There are three styles:\n" +"# - No default\n" +"# - With default\n" +"# - Maybe with default\n" +"#\n" +"# There are two alternative forms of each, to deal with type comments:\n" +"# - Ends in a comma followed by an optional type comment\n" +"# - No comma, optional type comment, must be followed by close paren\n" +"# The latter form is for a final parameter without trailing comma.\n" +"#\n" +"\n" +"param_no_default[arg_ty]:\n" +" | a=param ',' tc=TYPE_COMMENT? { _PyPegen_add_type_comment_to_arg(p, a, " +"tc) }\n" +" | a=param tc=TYPE_COMMENT? &')' { _PyPegen_add_type_comment_to_arg(p, a, " +"tc) }\n" +"param_no_default_star_annotation[arg_ty]:\n" +" | a=param_star_annotation ',' tc=TYPE_COMMENT? " +"{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +" | a=param_star_annotation tc=TYPE_COMMENT? " +"&')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +"param_with_default[NameDefaultPair*]:\n" +" | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " +"a, c, tc) }\n" +" | a=param c=default tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" +"param_maybe_default[NameDefaultPair*]:\n" +" | a=param c=default? ',' tc=TYPE_COMMENT? " +"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default? tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" +"param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, " +"EXTRA) }\n" +"param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a->v." +"Name.id, b, NULL, EXTRA) }\n" +"annotation[expr_ty]: ':' a=expression { a }\n" +"star_annotation[expr_ty]: ':' a=star_expression { a }\n" +"default[expr_ty]: '=' a=expression { a } | invalid_default\n" +"\n" +"# If statement\n" +"# ------------\n" +"\n" +"if_stmt[stmt_ty]:\n" +" | invalid_if_stmt\n" +" | 'if' a=named_expression ':' b=block c=elif_stmt {\n" +" _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), " +"EXTRA) }\n" +" | 'if' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, " +"c, EXTRA) }\n" +"elif_stmt[stmt_ty]:\n" +" | invalid_elif_stmt\n" +" | 'elif' a=named_expression ':' b=block c=elif_stmt {\n" +" _PyAST_If(a, b, CHECK(asdl_stmt_seq*, _PyPegen_singleton_seq(p, c)), " +"EXTRA) }\n" +" | 'elif' a=named_expression ':' b=block c=[else_block] { _PyAST_If(a, b, " +"c, EXTRA) }\n" +"else_block[asdl_stmt_seq*]:\n" +" | invalid_else_stmt\n" +" | 'else' &&':' b=block { b }\n" +"\n" +"# While statement\n" +"# ---------------\n" +"\n" +"while_stmt[stmt_ty]:\n" +" | invalid_while_stmt\n" +" | 'while' a=named_expression ':' b=block c=[else_block] " +"{ _PyAST_While(a, b, c, EXTRA) }\n" +"\n" +"# For statement\n" +"# -------------\n" +"\n" +"for_stmt[stmt_ty]:\n" +" | invalid_for_stmt\n" +" | 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] " +"b=block el=[else_block] {\n" +" _PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'async' 'for' t=star_targets 'in' ~ ex=star_expressions ':' " +"tc=[TYPE_COMMENT] b=block el=[else_block] {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async for loops are\", " +"_PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" +" | invalid_for_target\n" +"\n" +"# With statement\n" +"# --------------\n" +"\n" +"with_stmt[stmt_ty]:\n" +" | invalid_with_stmt_indent\n" +" | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +"tc=[TYPE_COMMENT] b=block {\n" +" _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] " +"b=block {\n" +" _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" +" | 'async' 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +"b=block {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " +"_PyAST_AsyncWith(a, b, NULL, EXTRA)) }\n" +" | 'async' 'with' a[asdl_withitem_seq*]=','.with_item+ ':' " +"tc=[TYPE_COMMENT] b=block {\n" +" CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " +"_PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" +" | invalid_with_stmt\n" +"\n" +"with_item[withitem_ty]:\n" +" | e=expression 'as' t=star_target &(',' | ')' | ':') " +"{ _PyAST_withitem(e, t, p->arena) }\n" +" | invalid_with_item\n" +" | e=expression { _PyAST_withitem(e, NULL, p->arena) }\n" +"\n" +"# Try statement\n" +"# -------------\n" +"\n" +"try_stmt[stmt_ty]:\n" +" | invalid_try_stmt\n" +" | 'try' &&':' b=block f=finally_block { _PyAST_Try(b, NULL, NULL, f, " +"EXTRA) }\n" +" | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_block+ " +"el=[else_block] f=[finally_block] { _PyAST_Try(b, ex, el, f, EXTRA) }\n" +" | 'try' &&':' b=block ex[asdl_excepthandler_seq*]=except_star_block+ " +"el=[else_block] f=[finally_block] {\n" +" CHECK_VERSION(stmt_ty, 11, \"Exception groups are\",\n" +" _PyAST_TryStar(b, ex, el, f, EXTRA)) }\n" +"\n" +"\n" +"# Except statement\n" +"# ----------------\n" +"\n" +"except_block[excepthandler_ty]:\n" +" | invalid_except_stmt_indent\n" +" | 'except' e=expression ':' b=block {\n" +" _PyAST_ExceptHandler(e, NULL, b, EXTRA) }\n" +" | 'except' e=expression 'as' t=NAME ':' b=block {\n" +" _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }\n" +" | 'except' e=expressions ':' b=block {\n" +" CHECK_VERSION(\n" +" excepthandler_ty,\n" +" 14,\n" +" \"except expressions without parentheses are\",\n" +" _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }\n" +" | 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }\n" +" | invalid_except_stmt\n" +"except_star_block[excepthandler_ty]:\n" +" | invalid_except_star_stmt_indent\n" +" | 'except' '*' e=expression ':' b=block {\n" +" _PyAST_ExceptHandler(e, NULL, b, EXTRA) }\n" +" | 'except' '*' e=expression 'as' t=NAME ':' b=block {\n" +" _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }\n" +" | 'except' '*' e=expressions ':' b=block {\n" +" CHECK_VERSION(\n" +" excepthandler_ty,\n" +" 14,\n" +" \"except expressions without parentheses are\",\n" +" _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }\n" +" | invalid_except_star_stmt\n" +"finally_block[asdl_stmt_seq*]:\n" +" | invalid_finally_stmt\n" +" | 'finally' &&':' a=block { a }\n" +"\n" +"# Match statement\n" +"# ---------------\n" +"\n" +"match_stmt[stmt_ty]:\n" +" | \"match\" subject=subject_expr ':' NEWLINE INDENT " +"cases[asdl_match_case_seq*]=case_block+ DEDENT {\n" +" CHECK_VERSION(stmt_ty, 10, \"Pattern matching is\", " +"_PyAST_Match(subject, cases, EXTRA)) }\n" +" | invalid_match_stmt\n" +"\n" +"subject_expr[expr_ty]:\n" +" | value=star_named_expression ',' values=star_named_expressions? {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"value, values)), Load, EXTRA) }\n" +" | named_expression\n" +"\n" +"case_block[match_case_ty]:\n" +" | invalid_case_block\n" +" | \"case\" pattern=patterns guard=guard? ':' body=block {\n" +" _PyAST_match_case(pattern, guard, body, p->arena) }\n" +"\n" +"guard[expr_ty]: 'if' guard=named_expression { guard }\n" +"\n" +"patterns[pattern_ty]:\n" +" | patterns[asdl_pattern_seq*]=open_sequence_pattern {\n" +" _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | pattern\n" +"\n" +"pattern[pattern_ty]:\n" +" | as_pattern\n" +" | or_pattern\n" +"\n" +"as_pattern[pattern_ty]:\n" +" | pattern=or_pattern 'as' target=pattern_capture_target {\n" +" _PyAST_MatchAs(pattern, target->v.Name.id, EXTRA) }\n" +" | invalid_as_pattern\n" +"\n" +"or_pattern[pattern_ty]:\n" +" | patterns[asdl_pattern_seq*]='|'.closed_pattern+ {\n" +" asdl_seq_LEN(patterns) == 1 ? asdl_seq_GET(patterns, 0) : " +"_PyAST_MatchOr(patterns, EXTRA) }\n" +"\n" +"closed_pattern[pattern_ty] (memo):\n" +" | literal_pattern\n" +" | capture_pattern\n" +" | wildcard_pattern\n" +" | value_pattern\n" +" | group_pattern\n" +" | sequence_pattern\n" +" | mapping_pattern\n" +" | class_pattern\n" +"\n" +"# Literal patterns are used for equality and identity constraints\n" +"literal_pattern[pattern_ty]:\n" +" | value=signed_number !('+' | '-') { _PyAST_MatchValue(value, EXTRA) }\n" +" | value=complex_number { _PyAST_MatchValue(value, EXTRA) }\n" +" | value=strings { _PyAST_MatchValue(value, EXTRA) }\n" +" | 'None' { _PyAST_MatchSingleton(Py_None, EXTRA) }\n" +" | 'True' { _PyAST_MatchSingleton(Py_True, EXTRA) }\n" +" | 'False' { _PyAST_MatchSingleton(Py_False, EXTRA) }\n" +"\n" +"# Literal expressions are used to restrict permitted mapping pattern keys\n" +"literal_expr[expr_ty]:\n" +" | signed_number !('+' | '-')\n" +" | complex_number\n" +" | &(STRING|FSTRING_START|TSTRING_START) strings\n" +" | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }\n" +" | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }\n" +" | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }\n" +"\n" +"complex_number[expr_ty]:\n" +" | real=signed_real_number '+' imag=imaginary_number {\n" +" _PyAST_BinOp(real, Add, imag, EXTRA) }\n" +" | real=signed_real_number '-' imag=imaginary_number {\n" +" _PyAST_BinOp(real, Sub, imag, EXTRA) }\n" +"\n" +"signed_number[expr_ty]:\n" +" | NUMBER\n" +" | '-' number=NUMBER { _PyAST_UnaryOp(USub, number, EXTRA) }\n" +"\n" +"signed_real_number[expr_ty]:\n" +" | real_number\n" +" | '-' real=real_number { _PyAST_UnaryOp(USub, real, EXTRA) }\n" +"\n" +"real_number[expr_ty]:\n" +" | real=NUMBER { _PyPegen_ensure_real(p, real) }\n" +"\n" +"imaginary_number[expr_ty]:\n" +" | imag=NUMBER { _PyPegen_ensure_imaginary(p, imag) }\n" +"\n" +"capture_pattern[pattern_ty]:\n" +" | target=pattern_capture_target { _PyAST_MatchAs(NULL, target->v.Name." +"id, EXTRA) }\n" +"\n" +"pattern_capture_target[expr_ty]:\n" +" | !\"_\" name=NAME !('.' | '(' | '=') {\n" +" _PyPegen_set_expr_context(p, name, Store) }\n" +"\n" +"wildcard_pattern[pattern_ty]:\n" +" | \"_\" { _PyAST_MatchAs(NULL, NULL, EXTRA) }\n" +"\n" +"value_pattern[pattern_ty]:\n" +" | attr=attr !('.' | '(' | '=') { _PyAST_MatchValue(attr, EXTRA) }\n" +"\n" +"attr[expr_ty]:\n" +" | value=name_or_attr '.' attr=NAME {\n" +" _PyAST_Attribute(value, attr->v.Name.id, Load, EXTRA) }\n" +"\n" +"name_or_attr[expr_ty]:\n" +" | attr\n" +" | NAME\n" +"\n" +"group_pattern[pattern_ty]:\n" +" | '(' pattern=pattern ')' { pattern }\n" +"\n" +"sequence_pattern[pattern_ty]:\n" +" | '[' patterns=maybe_sequence_pattern? " +"']' { _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '(' patterns=open_sequence_pattern? " +"')' { _PyAST_MatchSequence(patterns, EXTRA) }\n" +"\n" +"open_sequence_pattern[asdl_seq*]:\n" +" | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {\n" +" _PyPegen_seq_insert_in_front(p, pattern, patterns) }\n" +"\n" +"maybe_sequence_pattern[asdl_seq*]:\n" +" | patterns=','.maybe_star_pattern+ ','? { patterns }\n" +"\n" +"maybe_star_pattern[pattern_ty]:\n" +" | star_pattern\n" +" | pattern\n" +"\n" +"star_pattern[pattern_ty] (memo):\n" +" | '*' target=pattern_capture_target {\n" +" _PyAST_MatchStar(target->v.Name.id, EXTRA) }\n" +" | '*' wildcard_pattern {\n" +" _PyAST_MatchStar(NULL, EXTRA) }\n" +"\n" +"mapping_pattern[pattern_ty]:\n" +" | '{' '}' {\n" +" _PyAST_MatchMapping(NULL, NULL, NULL, EXTRA) }\n" +" | '{' rest=double_star_pattern ','? '}' {\n" +" _PyAST_MatchMapping(NULL, NULL, rest->v.Name.id, EXTRA) }\n" +" | '{' items=items_pattern ',' rest=double_star_pattern ','? '}' {\n" +" _PyAST_MatchMapping(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),\n" +" rest->v.Name.id,\n" +" EXTRA) }\n" +" | '{' items=items_pattern ','? '}' {\n" +" _PyAST_MatchMapping(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, items)),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),\n" +" NULL,\n" +" EXTRA) }\n" +"\n" +"items_pattern[asdl_seq*]:\n" +" | ','.key_value_pattern+\n" +"\n" +"key_value_pattern[KeyPatternPair*]:\n" +" | key=(literal_expr | attr) ':' pattern=pattern {\n" +" _PyPegen_key_pattern_pair(p, key, pattern) }\n" +"\n" +"double_star_pattern[expr_ty]:\n" +" | '**' target=pattern_capture_target { target }\n" +"\n" +"class_pattern[pattern_ty]:\n" +" | cls=name_or_attr '(' ')' {\n" +" _PyAST_MatchClass(cls, NULL, NULL, NULL, EXTRA) }\n" +" | cls=name_or_attr '(' patterns=positional_patterns ','? ')' {\n" +" _PyAST_MatchClass(cls, patterns, NULL, NULL, EXTRA) }\n" +" | cls=name_or_attr '(' keywords=keyword_patterns ','? ')' {\n" +" _PyAST_MatchClass(\n" +" cls, NULL,\n" +" CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, " +"keywords)))),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),\n" +" EXTRA) }\n" +" | cls=name_or_attr '(' patterns=positional_patterns ',' " +"keywords=keyword_patterns ','? ')' {\n" +" _PyAST_MatchClass(\n" +" cls,\n" +" patterns,\n" +" CHECK(asdl_identifier_seq*, _PyPegen_map_names_to_ids(p,\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_pattern_keys(p, " +"keywords)))),\n" +" CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, keywords)),\n" +" EXTRA) }\n" +" | invalid_class_pattern\n" +"\n" +"positional_patterns[asdl_pattern_seq*]:\n" +" | args[asdl_pattern_seq*]=','.pattern+ { args }\n" +"\n" +"keyword_patterns[asdl_seq*]:\n" +" | ','.keyword_pattern+\n" +"\n" +"keyword_pattern[KeyPatternPair*]:\n" +" | arg=NAME '=' value=pattern { _PyPegen_key_pattern_pair(p, arg, " +"value) }\n" +"\n" +"# Type statement\n" +"# ---------------\n" +"\n" +"type_alias[stmt_ty]:\n" +" | \"type\" n=NAME t=[type_params] '=' b=expression {\n" +" CHECK_VERSION(stmt_ty, 12, \"Type statement is\",\n" +" _PyAST_TypeAlias(CHECK(expr_ty, _PyPegen_set_expr_context(p, n, " +"Store)), t, b, EXTRA)) }\n" +"\n" +"# Type parameter declaration\n" +"# --------------------------\n" +"\n" +"type_params[asdl_type_param_seq*]:\n" +" | invalid_type_params\n" +" | '[' t=type_param_seq ']' {\n" +" CHECK_VERSION(asdl_type_param_seq *, 12, \"Type parameter lists " +"are\", t) }\n" +"\n" +"type_param_seq[asdl_type_param_seq*]: a[asdl_type_param_seq*]=','." +"type_param+ [','] { a }\n" +"\n" +"type_param[type_param_ty] (memo):\n" +" | a=NAME b=[type_param_bound] c=[type_param_default] { _PyAST_TypeVar(a-" +">v.Name.id, b, c, EXTRA) }\n" +" | invalid_type_param\n" +" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a->v." +"Name.id, b, EXTRA) }\n" +" | '**' a=NAME b=[type_param_default] { _PyAST_ParamSpec(a->v.Name.id, b, " +"EXTRA) }\n" +"\n" +"type_param_bound[expr_ty]: ':' e=expression { e }\n" +"type_param_default[expr_ty]: '=' e=expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" +"type_param_starred_default[expr_ty]: '=' e=star_expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" +"\n" +"# EXPRESSIONS\n" +"# -----------\n" +"\n" +"expressions[expr_ty]:\n" +" | a=expression b=(',' c=expression { c })+ [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"a, b)), Load, EXTRA) }\n" +" | a=expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, " +"_PyPegen_singleton_seq(p, a)), Load, EXTRA) }\n" +" | expression\n" +"\n" +"expression[expr_ty] (memo):\n" +" | invalid_expression\n" +" | invalid_legacy_expression\n" +" | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, " +"a, c, EXTRA) }\n" +" | disjunction\n" +" | lambdef\n" +"\n" +"yield_expr[expr_ty]:\n" +" | 'yield' 'from' a=expression { _PyAST_YieldFrom(a, EXTRA) }\n" +" | 'yield' a=[star_expressions] { _PyAST_Yield(a, EXTRA) }\n" +"\n" +"star_expressions[expr_ty]:\n" +" | a=star_expression b=(',' c=star_expression { c })+ [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"a, b)), Load, EXTRA) }\n" +" | a=star_expression ',' { _PyAST_Tuple(CHECK(asdl_expr_seq*, " +"_PyPegen_singleton_seq(p, a)), Load, EXTRA) }\n" +" | star_expression\n" +"\n" +"star_expression[expr_ty] (memo):\n" +" | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" +" | expression\n" +"\n" +"star_named_expressions[asdl_expr_seq*]: a[asdl_expr_seq*]=','." +"star_named_expression+ [','] { a }\n" +"\n" +"star_named_expression[expr_ty]:\n" +" | '*' a=bitwise_or { _PyAST_Starred(a, Load, EXTRA) }\n" +" | named_expression\n" +"\n" +"assignment_expression[expr_ty]:\n" +" | a=NAME ':=' ~ b=expression {\n" +" CHECK_VERSION(expr_ty, 8, \"Assignment expressions are\",\n" +" _PyAST_NamedExpr(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), b, EXTRA)) }\n" +"\n" +"named_expression[expr_ty]:\n" +" | assignment_expression\n" +" | invalid_named_expression\n" +" | expression !':='\n" +"\n" +"disjunction[expr_ty] (memo):\n" +" | a=conjunction b=('or' c=conjunction { c })+ { _PyAST_BoolOp(\n" +" Or,\n" +" CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),\n" +" EXTRA) }\n" +" | conjunction\n" +"\n" +"conjunction[expr_ty] (memo):\n" +" | a=inversion b=('and' c=inversion { c })+ { _PyAST_BoolOp(\n" +" And,\n" +" CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, a, b)),\n" +" EXTRA) }\n" +" | inversion\n" +"\n" +"inversion[expr_ty] (memo):\n" +" | 'not' a=inversion { _PyAST_UnaryOp(Not, a, EXTRA) }\n" +" | comparison\n" +"\n" +"# Comparison operators\n" +"# --------------------\n" +"\n" +"comparison[expr_ty]:\n" +" | a=bitwise_or b=compare_op_bitwise_or_pair+ {\n" +" _PyAST_Compare(\n" +" a,\n" +" CHECK(asdl_int_seq*, _PyPegen_get_cmpops(p, b)),\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_exprs(p, b)),\n" +" EXTRA) }\n" +" | bitwise_or\n" +"\n" +"compare_op_bitwise_or_pair[CmpopExprPair*]:\n" +" | eq_bitwise_or\n" +" | noteq_bitwise_or\n" +" | lte_bitwise_or\n" +" | lt_bitwise_or\n" +" | gte_bitwise_or\n" +" | gt_bitwise_or\n" +" | notin_bitwise_or\n" +" | in_bitwise_or\n" +" | isnot_bitwise_or\n" +" | is_bitwise_or\n" +"\n" +"eq_bitwise_or[CmpopExprPair*]: '==' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Eq, a) }\n" +"noteq_bitwise_or[CmpopExprPair*]:\n" +" | (tok='!=' { _PyPegen_check_barry_as_flufl(p, tok) ? NULL : tok}) " +"a=bitwise_or {_PyPegen_cmpop_expr_pair(p, NotEq, a) }\n" +"lte_bitwise_or[CmpopExprPair*]: '<=' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, LtE, a) }\n" +"lt_bitwise_or[CmpopExprPair*]: '<' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Lt, a) }\n" +"gte_bitwise_or[CmpopExprPair*]: '>=' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, GtE, a) }\n" +"gt_bitwise_or[CmpopExprPair*]: '>' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Gt, a) }\n" +"notin_bitwise_or[CmpopExprPair*]: 'not' 'in' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, NotIn, a) }\n" +"in_bitwise_or[CmpopExprPair*]: 'in' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, In, a) }\n" +"isnot_bitwise_or[CmpopExprPair*]: 'is' 'not' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, IsNot, a) }\n" +"is_bitwise_or[CmpopExprPair*]: 'is' a=bitwise_or " +"{ _PyPegen_cmpop_expr_pair(p, Is, a) }\n" +"\n" +"# Bitwise operators\n" +"# -----------------\n" +"\n" +"bitwise_or[expr_ty]:\n" +" | a=bitwise_or '|' b=bitwise_xor { _PyAST_BinOp(a, BitOr, b, EXTRA) }\n" +" | bitwise_xor\n" +"\n" +"bitwise_xor[expr_ty]:\n" +" | a=bitwise_xor '^' b=bitwise_and { _PyAST_BinOp(a, BitXor, b, EXTRA) }\n" +" | bitwise_and\n" +"\n" +"bitwise_and[expr_ty]:\n" +" | a=bitwise_and '&' b=shift_expr { _PyAST_BinOp(a, BitAnd, b, EXTRA) }\n" +" | shift_expr\n" +"\n" +"shift_expr[expr_ty]:\n" +" | a=shift_expr '<<' b=sum { _PyAST_BinOp(a, LShift, b, EXTRA) }\n" +" | a=shift_expr '>>' b=sum { _PyAST_BinOp(a, RShift, b, EXTRA) }\n" +" | invalid_arithmetic\n" +" | sum\n" +"\n" +"# Arithmetic operators\n" +"# --------------------\n" +"\n" +"sum[expr_ty]:\n" +" | a=sum '+' b=term { _PyAST_BinOp(a, Add, b, EXTRA) }\n" +" | a=sum '-' b=term { _PyAST_BinOp(a, Sub, b, EXTRA) }\n" +" | term\n" +"\n" +"term[expr_ty]:\n" +" | a=term '*' b=factor { _PyAST_BinOp(a, Mult, b, EXTRA) }\n" +" | a=term '/' b=factor { _PyAST_BinOp(a, Div, b, EXTRA) }\n" +" | a=term '//' b=factor { _PyAST_BinOp(a, FloorDiv, b, EXTRA) }\n" +" | a=term '%' b=factor { _PyAST_BinOp(a, Mod, b, EXTRA) }\n" +" | a=term '@' b=factor { CHECK_VERSION(expr_ty, 5, \"The '@' operator " +"is\", _PyAST_BinOp(a, MatMult, b, EXTRA)) }\n" +" | invalid_factor\n" +" | factor\n" +"\n" +"factor[expr_ty] (memo):\n" +" | '+' a=factor { _PyAST_UnaryOp(UAdd, a, EXTRA) }\n" +" | '-' a=factor { _PyAST_UnaryOp(USub, a, EXTRA) }\n" +" | '~' a=factor { _PyAST_UnaryOp(Invert, a, EXTRA) }\n" +" | power\n" +"\n" +"power[expr_ty]:\n" +" | a=await_primary '**' b=factor { _PyAST_BinOp(a, Pow, b, EXTRA) }\n" +" | await_primary\n" +"\n" +"# Primary elements\n" +"# ----------------\n" +"\n" +"# Primary elements are things like \"obj.something.something\", " +"\"obj[something]\", \"obj(something)\", \"obj\" ...\n" +"\n" +"await_primary[expr_ty] (memo):\n" +" | 'await' a=primary { CHECK_VERSION(expr_ty, 5, \"Await expressions " +"are\", _PyAST_Await(a, EXTRA)) }\n" +" | primary\n" +"\n" +"primary[expr_ty]:\n" +" | a=primary '.' b=NAME { _PyAST_Attribute(a, b->v.Name.id, Load, " +"EXTRA) }\n" +" | a=primary b=genexp { _PyAST_Call(a, CHECK(asdl_expr_seq*, " +"(asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }\n" +" | a=primary '(' b=[arguments] ')' {\n" +" _PyAST_Call(a,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" EXTRA) }\n" +" | a=primary '[' b=slices ']' { _PyAST_Subscript(a, b, Load, EXTRA) }\n" +" | atom\n" +"\n" +"slices[expr_ty]:\n" +" | a=slice !',' { a }\n" +" | a[asdl_expr_seq*]=','.(slice | starred_expression)+ [','] " +"{ _PyAST_Tuple(a, Load, EXTRA) }\n" +"\n" +"slice[expr_ty]:\n" +" | a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] " +"{ _PyAST_Slice(a, b, c, EXTRA) }\n" +" | a=named_expression { a }\n" +"\n" +"atom[expr_ty]:\n" +" | NAME\n" +" | 'True' { _PyAST_Constant(Py_True, NULL, EXTRA) }\n" +" | 'False' { _PyAST_Constant(Py_False, NULL, EXTRA) }\n" +" | 'None' { _PyAST_Constant(Py_None, NULL, EXTRA) }\n" +" | &(STRING|FSTRING_START|TSTRING_START) strings\n" +" | NUMBER\n" +" | &'(' (tuple | group | genexp)\n" +" | &'[' (list | listcomp)\n" +" | &'{' (dict | set | dictcomp | setcomp)\n" +" | '...' { _PyAST_Constant(Py_Ellipsis, NULL, EXTRA) }\n" +"\n" +"group[expr_ty]:\n" +" | '(' a=(yield_expr | named_expression) ')' { a }\n" +" | invalid_group\n" +"\n" +"# Lambda functions\n" +"# ----------------\n" +"\n" +"lambdef[expr_ty]:\n" +" | 'lambda' a=[lambda_params] ':' b=expression {\n" +" _PyAST_Lambda((a) ? a : CHECK(arguments_ty, " +"_PyPegen_empty_arguments(p)), b, EXTRA) }\n" +"\n" +"lambda_params[arguments_ty]:\n" +" | invalid_lambda_parameters\n" +" | lambda_parameters\n" +"\n" +"# lambda_parameters etc. duplicates parameters but without annotations\n" +"# or type comments, and if there's no comma after a parameter, we expect\n" +"# a colon, not a close parenthesis. (For more, see parameters above.)\n" +"#\n" +"lambda_parameters[arguments_ty]:\n" +" | a=lambda_slash_no_default b[asdl_arg_seq*]=lambda_param_no_default* " +"c=lambda_param_with_default* d=[lambda_star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, a, NULL, b, c, d)) }\n" +" | a=lambda_slash_with_default b=lambda_param_with_default* " +"c=[lambda_star_etc] {\n" +" CHECK_VERSION(arguments_ty, 8, \"Positional-only parameters are\", " +"_PyPegen_make_arguments(p, NULL, a, NULL, b, c)) }\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ b=lambda_param_with_default* " +"c=[lambda_star_etc] {\n" +" _PyPegen_make_arguments(p, NULL, NULL, a, b, c) }\n" +" | a=lambda_param_with_default+ b=[lambda_star_etc] " +"{ _PyPegen_make_arguments(p, NULL, NULL, NULL, a, b)}\n" +" | a=lambda_star_etc { _PyPegen_make_arguments(p, NULL, NULL, NULL, NULL, " +"a) }\n" +"\n" +"lambda_slash_no_default[asdl_arg_seq*]:\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ '/' ',' { a }\n" +" | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }\n" +"\n" +"lambda_slash_with_default[SlashWithDefault*]:\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"&':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +"\n" +"lambda_star_etc[StarEtc*]:\n" +" | invalid_lambda_star_etc\n" +" | '*' a=lambda_param_no_default b=lambda_param_maybe_default* " +"c=[lambda_kwds] {\n" +" _PyPegen_star_etc(p, a, b, c) }\n" +" | '*' ',' b=lambda_param_maybe_default+ c=[lambda_kwds] {\n" +" _PyPegen_star_etc(p, NULL, b, c) }\n" +" | a=lambda_kwds { _PyPegen_star_etc(p, NULL, NULL, a) }\n" +"\n" +"lambda_kwds[arg_ty]:\n" +" | invalid_lambda_kwds\n" +" | '**' a=lambda_param_no_default { a }\n" +"\n" +"lambda_param_no_default[arg_ty]:\n" +" | a=lambda_param ',' { a }\n" +" | a=lambda_param &':' { a }\n" +"lambda_param_with_default[NameDefaultPair*]:\n" +" | a=lambda_param c=default ',' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +" | a=lambda_param c=default &':' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +"lambda_param_maybe_default[NameDefaultPair*]:\n" +" | a=lambda_param c=default? ',' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +" | a=lambda_param c=default? &':' { _PyPegen_name_default_pair(p, a, c, " +"NULL) }\n" +"lambda_param[arg_ty]: a=NAME { _PyAST_arg(a->v.Name.id, NULL, NULL, " +"EXTRA) }\n" +"\n" +"# LITERALS\n" +"# ========\n" +"\n" +"fstring_middle[expr_ty]:\n" +" | fstring_replacement_field\n" +" | t=FSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }\n" +"fstring_replacement_field[expr_ty]:\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[fstring_full_format_spec] rbrace='}' {\n" +" _PyPegen_formatted_value(p, a, debug_expr, conversion, format, " +"rbrace, EXTRA) }\n" +" | invalid_fstring_replacement_field\n" +"fstring_conversion[ResultTokenWithMetadata*]:\n" +" | conv_token=\"!\" conv=NAME { _PyPegen_check_fstring_conversion(p, " +"conv_token, conv) }\n" +"fstring_full_format_spec[ResultTokenWithMetadata*]:\n" +" | colon=':' spec=fstring_format_spec* " +"{ _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, " +"EXTRA) }\n" +"fstring_format_spec[expr_ty]:\n" +" | t=FSTRING_MIDDLE { _PyPegen_decoded_constant_from_token(p, t) }\n" +" | fstring_replacement_field\n" +"fstring[expr_ty]:\n" +" | a=FSTRING_START b=fstring_middle* c=FSTRING_END " +"{ _PyPegen_joined_str(p, a, (asdl_expr_seq*)b, c) }\n" +"\n" +"tstring_format_spec_replacement_field[expr_ty]:\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[tstring_full_format_spec] rbrace='}' {\n" +" _PyPegen_formatted_value(p, a, debug_expr, conversion, format, " +"rbrace, EXTRA) }\n" +" | invalid_tstring_replacement_field\n" +"tstring_format_spec[expr_ty]:\n" +" | t=TSTRING_MIDDLE { _PyPegen_decoded_constant_from_token(p, t) }\n" +" | tstring_format_spec_replacement_field\n" +"tstring_full_format_spec[ResultTokenWithMetadata*]:\n" +" | colon=':' spec=tstring_format_spec* " +"{ _PyPegen_setup_full_format_spec(p, colon, (asdl_expr_seq *) spec, " +"EXTRA) }\n" +"tstring_replacement_field[expr_ty]:\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[tstring_full_format_spec] rbrace='}' {\n" +" _PyPegen_interpolation(p, a, debug_expr, conversion, format, rbrace, " +"EXTRA) }\n" +" | invalid_tstring_replacement_field\n" +"tstring_middle[expr_ty]:\n" +" | tstring_replacement_field\n" +" | t=TSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }\n" +"tstring[expr_ty] (memo):\n" +" | a=TSTRING_START b=tstring_middle* c=TSTRING_END {\n" +" CHECK_VERSION(\n" +" expr_ty,\n" +" 14,\n" +" \"t-strings are\",\n" +" _PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) }\n" +"\n" +"string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }\n" +"strings[expr_ty] (memo):\n" +" | invalid_string_tstring_concat\n" +" | a[asdl_expr_seq*]=(fstring|string)+ { _PyPegen_concatenate_strings(p, " +"a, EXTRA) }\n" +" | a[asdl_expr_seq*]=tstring+ { _PyPegen_concatenate_tstrings(p, a, " +"EXTRA) }\n" +"\n" +"list[expr_ty]:\n" +" | '[' a=[star_named_expressions] ']' { _PyAST_List(a, Load, EXTRA) }\n" +"\n" +"tuple[expr_ty]:\n" +" | '(' a=[y=star_named_expression ',' z=[star_named_expressions] " +"{ _PyPegen_seq_insert_in_front(p, y, z) } ] ')' {\n" +" _PyAST_Tuple(a, Load, EXTRA) }\n" +"\n" +"set[expr_ty]: '{' a=star_named_expressions '}' { _PyAST_Set(a, EXTRA) }\n" +"\n" +"# Dicts\n" +"# -----\n" +"\n" +"dict[expr_ty]:\n" +" | '{' a=[double_starred_kvpairs] '}' {\n" +" _PyAST_Dict(\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_keys(p, a)),\n" +" CHECK(asdl_expr_seq*, _PyPegen_get_values(p, a)),\n" +" EXTRA) }\n" +" | '{' invalid_double_starred_kvpairs '}'\n" +"\n" +"double_starred_kvpairs[asdl_seq*]: a=','.double_starred_kvpair+ [','] { a }\n" +"\n" +"double_starred_kvpair[KeyValuePair*]:\n" +" | '**' a=bitwise_or { _PyPegen_key_value_pair(p, NULL, a) }\n" +" | kvpair\n" +"\n" +"kvpair[KeyValuePair*]: a=expression ':' b=expression " +"{ _PyPegen_key_value_pair(p, a, b) }\n" +"\n" +"# Comprehensions & Generators\n" +"# ---------------------------\n" +"\n" +"for_if_clauses[asdl_comprehension_seq*]:\n" +" | a[asdl_comprehension_seq*]=for_if_clause+ { a }\n" +"\n" +"for_if_clause[comprehension_ty]:\n" +" | 'async' 'for' a=star_targets 'in' ~ b=disjunction " +"c[asdl_expr_seq*]=('if' z=disjunction { z })* {\n" +" CHECK_VERSION(comprehension_ty, 6, \"Async comprehensions are\", " +"_PyAST_comprehension(a, b, c, 1, p->arena)) }\n" +" | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' " +"z=disjunction { z })* {\n" +" _PyAST_comprehension(a, b, c, 0, p->arena) }\n" +" | invalid_for_if_clause\n" +" | invalid_for_target\n" +"\n" +"listcomp[expr_ty]:\n" +" | '[' a=named_expression b=for_if_clauses ']' { _PyAST_ListComp(a, b, " +"EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"setcomp[expr_ty]:\n" +" | '{' a=named_expression b=for_if_clauses '}' { _PyAST_SetComp(a, b, " +"EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"genexp[expr_ty]:\n" +" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses " +"')' { _PyAST_GeneratorExp(a, b, EXTRA) }\n" +" | invalid_comprehension\n" +"\n" +"dictcomp[expr_ty]:\n" +" | '{' a=kvpair b=for_if_clauses '}' { _PyAST_DictComp(a->key, a->value, " +"b, EXTRA) }\n" +" | invalid_dict_comprehension\n" +"\n" +"# FUNCTION CALL ARGUMENTS\n" +"# =======================\n" +"\n" +"arguments[expr_ty] (memo):\n" +" | a=args [','] &')' { a }\n" +" | invalid_arguments\n" +"\n" +"args[expr_ty]:\n" +" | a[asdl_expr_seq*]=','.(starred_expression | ( assignment_expression | " +"expression !':=') !'=')+ b=[',' k=kwargs {k}] {\n" +" _PyPegen_collect_call_seqs(p, a, b, EXTRA) }\n" +" | a=kwargs { _PyAST_Call(_PyPegen_dummy_name(p),\n" +" CHECK_NULL_ALLOWED(asdl_expr_seq*, " +"_PyPegen_seq_extract_starred_exprs(p, a)),\n" +" CHECK_NULL_ALLOWED(asdl_keyword_seq*, " +"_PyPegen_seq_delete_starred_exprs(p, a)),\n" +" EXTRA) }\n" +"\n" +"kwargs[asdl_seq*]:\n" +" | a=','.kwarg_or_starred+ ',' b=','.kwarg_or_double_starred+ " +"{ _PyPegen_join_sequences(p, a, b) }\n" +" | ','.kwarg_or_starred+\n" +" | ','.kwarg_or_double_starred+\n" +"\n" +"starred_expression[expr_ty]:\n" +" | invalid_starred_expression_unpacking\n" +" | '*' a=expression { _PyAST_Starred(a, Load, EXTRA) }\n" +" | invalid_starred_expression\n" +"\n" +"kwarg_or_starred[KeywordOrStarred*]:\n" +" | invalid_kwarg\n" +" | a=NAME '=' b=expression {\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v." +"Name.id, b, EXTRA)), 1) }\n" +" | a=starred_expression { _PyPegen_keyword_or_starred(p, a, 0) }\n" +"\n" +"kwarg_or_double_starred[KeywordOrStarred*]:\n" +" | invalid_kwarg\n" +" | a=NAME '=' b=expression {\n" +" _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, _PyAST_keyword(a->v." +"Name.id, b, EXTRA)), 1) }\n" +" | '**' a=expression { _PyPegen_keyword_or_starred(p, CHECK(keyword_ty, " +"_PyAST_keyword(NULL, a, EXTRA)), 1) }\n" +"\n" +"# ASSIGNMENT TARGETS\n" +"# ==================\n" +"\n" +"# Generic targets\n" +"# ---------------\n" +"\n" +"# NOTE: star_targets may contain *bitwise_or, targets may not.\n" +"star_targets[expr_ty]:\n" +" | a=star_target !',' { a }\n" +" | a=star_target b=(',' c=star_target { c })* [','] {\n" +" _PyAST_Tuple(CHECK(asdl_expr_seq*, _PyPegen_seq_insert_in_front(p, " +"a, b)), Store, EXTRA) }\n" +"\n" +"star_targets_list_seq[asdl_expr_seq*]: a[asdl_expr_seq*]=','.star_target+ " +"[','] { a }\n" +"\n" +"star_targets_tuple_seq[asdl_expr_seq*]:\n" +" | a=star_target b=(',' c=star_target { c })+ [','] { (asdl_expr_seq*) " +"_PyPegen_seq_insert_in_front(p, a, b) }\n" +" | a=star_target ',' { (asdl_expr_seq*) _PyPegen_singleton_seq(p, a) }\n" +"\n" +"star_target[expr_ty] (memo):\n" +" | '*' a=(!'*' star_target) {\n" +" _PyAST_Starred(CHECK(expr_ty, _PyPegen_set_expr_context(p, a, " +"Store)), Store, EXTRA) }\n" +" | target_with_star_atom\n" +"\n" +"target_with_star_atom[expr_ty] (memo):\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." +"id, Store, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +"Store, EXTRA) }\n" +" | star_atom\n" +"\n" +"star_atom[expr_ty]:\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Store) }\n" +" | '(' a=target_with_star_atom ')' { _PyPegen_set_expr_context(p, a, " +"Store) }\n" +" | '(' a=[star_targets_tuple_seq] ')' { _PyAST_Tuple(a, Store, EXTRA) }\n" +" | '[' a=[star_targets_list_seq] ']' { _PyAST_List(a, Store, EXTRA) }\n" +"\n" +"single_target[expr_ty]:\n" +" | single_subscript_attribute_target\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Store) }\n" +" | '(' a=single_target ')' { a }\n" +"\n" +"single_subscript_attribute_target[expr_ty]:\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." +"id, Store, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +"Store, EXTRA) }\n" +"\n" +"t_primary[expr_ty]:\n" +" | a=t_primary '.' b=NAME &t_lookahead { _PyAST_Attribute(a, b->v.Name." +"id, Load, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' &t_lookahead { _PyAST_Subscript(a, b, " +"Load, EXTRA) }\n" +" | a=t_primary b=genexp &t_lookahead {\n" +" _PyAST_Call(a, CHECK(asdl_expr_seq*, " +"(asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }\n" +" | a=t_primary '(' b=[arguments] ')' &t_lookahead {\n" +" _PyAST_Call(a,\n" +" (b) ? ((expr_ty) b)->v.Call.args : NULL,\n" +" (b) ? ((expr_ty) b)->v.Call.keywords : NULL,\n" +" EXTRA) }\n" +" | a=atom &t_lookahead { a }\n" +"\n" +"t_lookahead: '(' | '[' | '.'\n" +"\n" +"# Targets for del statements\n" +"# --------------------------\n" +"\n" +"del_targets[asdl_expr_seq*]: a[asdl_expr_seq*]=','.del_target+ [','] { a }\n" +"\n" +"del_target[expr_ty] (memo):\n" +" | a=t_primary '.' b=NAME !t_lookahead { _PyAST_Attribute(a, b->v.Name." +"id, Del, EXTRA) }\n" +" | a=t_primary '[' b=slices ']' !t_lookahead { _PyAST_Subscript(a, b, " +"Del, EXTRA) }\n" +" | del_t_atom\n" +"\n" +"del_t_atom[expr_ty]:\n" +" | a=NAME { _PyPegen_set_expr_context(p, a, Del) }\n" +" | '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }\n" +" | '(' a=[del_targets] ')' { _PyAST_Tuple(a, Del, EXTRA) }\n" +" | '[' a=[del_targets] ']' { _PyAST_List(a, Del, EXTRA) }\n" +"\n" +"# TYPING ELEMENTS\n" +"# ---------------\n" +"\n" +"# type_expressions allow */** but ignore them\n" +"type_expressions[asdl_expr_seq*]:\n" +" | a=','.expression+ ',' '*' b=expression ',' '**' c=expression {\n" +" (asdl_expr_seq*)_PyPegen_seq_append_to_end(\n" +" p,\n" +" CHECK(asdl_seq*, _PyPegen_seq_append_to_end(p, a, b)),\n" +" c) }\n" +" | a=','.expression+ ',' '*' b=expression " +"{ (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }\n" +" | a=','.expression+ ',' '**' b=expression " +"{ (asdl_expr_seq*)_PyPegen_seq_append_to_end(p, a, b) }\n" +" | '*' a=expression ',' '**' b=expression {\n" +" (asdl_expr_seq*)_PyPegen_seq_append_to_end(\n" +" p,\n" +" CHECK(asdl_seq*, _PyPegen_singleton_seq(p, a)),\n" +" b) }\n" +" | '*' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }\n" +" | '**' a=expression { (asdl_expr_seq*)_PyPegen_singleton_seq(p, a) }\n" +" | a[asdl_expr_seq*]=','.expression+ {a}\n" +"\n" +"func_type_comment[Token*]:\n" +" | NEWLINE t=TYPE_COMMENT &(NEWLINE INDENT) { t } # Must be followed by " +"indented block\n" +" | invalid_double_type_comments\n" +" | TYPE_COMMENT\n" +"\n" +"# ========================= END OF THE GRAMMAR ===========================\n" +"\n" +"\n" +"\n" +"# ========================= START OF INVALID RULES =======================\n" +"\n" +"# From here on, there are rules for invalid syntax with specialised error " +"messages\n" +"invalid_arguments:\n" +" | ((','.(starred_expression | ( assignment_expression | expression !':" +"=') !'=')+ ',' kwargs) | kwargs) a=',' ','.(starred_expression !'=')+ {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"iterable argument unpacking " +"follows keyword argument unpacking\") }\n" +" | a=expression b=for_if_clauses ',' [args | expression for_if_clauses] " +"{\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, " +"comprehension_ty)), \"Generator expression must be parenthesized\") }\n" +" | a=NAME b='=' expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\")}\n" +" | (args ',')? a=NAME b='=' &(',' | ')') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"expected argument value " +"expression\")}\n" +" | a=args b=for_if_clauses { _PyPegen_nonparen_genexp_in_call(p, a, b) }\n" +" | args ',' a=expression b=for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"_PyPegen_get_last_comprehension_item(PyPegen_last_item(b, " +"comprehension_ty)), \"Generator expression must be parenthesized\") }\n" +" | a=args ',' args { _PyPegen_arguments_parsing_error(p, a) }\n" +"invalid_kwarg:\n" +" | a[Token*]=('True'|'False'|'None') b='=' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot assign to %s\", " +"PyBytes_AS_STRING(a->bytes)) }\n" +" | a=NAME b='=' expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\")}\n" +" | !(NAME '=') a=expression b='=' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(\n" +" a, b, \"expression cannot contain assignment, perhaps you meant " +"\\\"==\\\"?\") }\n" +" | a='**' expression '=' b=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot assign to keyword " +"argument unpacking\") }\n" +"\n" +"# IMPORTANT: Note that the \"_without_invalid\" suffix causes the rule to " +"not call invalid rules under it\n" +"expression_without_invalid[expr_ty]:\n" +" | a=disjunction 'if' b=disjunction 'else' c=expression { _PyAST_IfExp(b, " +"a, c, EXTRA) }\n" +" | disjunction\n" +" | lambdef\n" +"invalid_legacy_expression:\n" +" | a=NAME !'(' b=star_expressions {\n" +" _PyPegen_check_legacy_stmt(p, a) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b,\n" +" \"Missing parentheses in call to '%U'. Did you mean %U(...)?\", " +"a->v.Name.id, a->v.Name.id) : NULL}\n" +"\n" +"invalid_type_param:\n" +" | '*' a=NAME colon=':' e=expression {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" +" ? \"cannot use constraints with TypeVarTuple\"\n" +" : \"cannot use bound with TypeVarTuple\")\n" +" }\n" +" | '**' a=NAME colon=':' e=expression {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" +" ? \"cannot use constraints with ParamSpec\"\n" +" : \"cannot use bound with ParamSpec\")\n" +" }\n" +"\n" +"invalid_expression:\n" +" | STRING a=(!STRING expression_without_invalid)+ STRING {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE( PyPegen_first_item(a, expr_ty), " +"PyPegen_last_item(a, expr_ty),\n" +" \"invalid syntax. Is this intended to be part of the string?\") }\n" +" # !(NAME STRING) is not matched so we don't show this error with some " +"invalid string prefixes like: kf\"dsfsdf\"\n" +" # Soft keywords need to also be ignored because they can be parsed as " +"NAME NAME\n" +" | !(NAME STRING | SOFT_KEYWORD) a=disjunction " +"b=expression_without_invalid {\n" +" _PyPegen_check_legacy_stmt(p, a) ? NULL : p->tokens[p->mark-1]-" +">level == 0 ? NULL :\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Perhaps you " +"forgot a comma?\") }\n" +" | a=disjunction 'if' b=disjunction !('else'|':') " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"expected 'else' after 'if' " +"expression\") }\n" +" | a=disjunction 'if' b=disjunction 'else' !expression {\n" +" RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"expected expression after 'else', " +"but statement is given\") }\n" +" | a[stmt_ty]=(pass_stmt|break_stmt|continue_stmt) 'if' b=disjunction " +"'else' c=simple_stmt {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION (a, \"expected expression before " +"'if', but statement is given\") }\n" +" | a='lambda' [lambda_params] b=':' &FSTRING_MIDDLE {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"f-string: lambda expressions " +"are not allowed without parentheses\") }\n" +" | a='lambda' [lambda_params] b=':' &TSTRING_MIDDLE {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"t-string: lambda expressions " +"are not allowed without parentheses\") }\n" +"\n" +"invalid_named_expression(memo):\n" +" | a=expression ':=' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use assignment expressions with %s\", " +"_PyPegen_get_expr_name(a)) }\n" +" | a=NAME '=' b=bitwise_or !('='|':=') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"invalid syntax. Maybe you " +"meant '==' or ':=' instead of '='?\") }\n" +" | !(list|tuple|genexp|'True'|'None'|'False') a=bitwise_or b='=' " +"bitwise_or !('='|':=') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot assign to %s here. " +"Maybe you meant '==' instead of '='?\",\n" +" _PyPegen_get_expr_name(a)) }\n" +"\n" +"invalid_assignment:\n" +" | a=invalid_ann_assign_target ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a,\n" +" \"only single target (not %s) can be annotated\",\n" +" _PyPegen_get_expr_name(a)\n" +" )}\n" +" | a=star_named_expression ',' star_named_expressions* ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"only single target (not " +"tuple) can be annotated\") }\n" +" | a=expression ':' expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"illegal target for " +"annotation\") }\n" +" | (star_targets '=')* a=star_expressions '=' {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" +" | (star_targets '=')* a=yield_expr " +"'=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression " +"not possible\") }\n" +" | a=star_expressions augassign annotated_rhs {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a,\n" +" \"'%s' is an illegal expression for augmented assignment\",\n" +" _PyPegen_get_expr_name(a)\n" +" )}\n" +"invalid_ann_assign_target[expr_ty]:\n" +" | list\n" +" | tuple\n" +" | '(' a=invalid_ann_assign_target ')' { a }\n" +"invalid_del_stmt:\n" +" | 'del' a=star_expressions {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(DEL_TARGETS, a) }\n" +"invalid_block:\n" +" | NEWLINE !INDENT { RAISE_INDENTATION_ERROR(\"expected an indented " +"block\") }\n" +"invalid_comprehension:\n" +" | ('[' | '(' | '{') a=starred_expression for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"iterable unpacking cannot be " +"used in comprehension\") }\n" +" | ('[' | '{') a=star_named_expression ',' b=star_named_expressions " +"for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, PyPegen_last_item(b, expr_ty),\n" +" \"did you forget parentheses around the comprehension target?\") }\n" +" | ('[' | '{') a=star_named_expression b=',' for_if_clauses {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"did you forget parentheses " +"around the comprehension target?\") }\n" +"invalid_dict_comprehension:\n" +" | '{' a='**' bitwise_or for_if_clauses '}' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"dict unpacking cannot be used " +"in dict comprehension\") }\n" +"invalid_parameters:\n" +" | a=\"/\" ',' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"at least one argument must " +"precede /\") }\n" +" | (slash_no_default | slash_with_default) param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ may appear only once\") }\n" +" | slash_no_default? param_no_default* invalid_parameters_helper " +"a=param_no_default {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"parameter without a default " +"follows parameter with a default\") }\n" +" | param_no_default* a='(' param_no_default+ ','? b=')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"Function parameters cannot be " +"parenthesized\") }\n" +" | (slash_no_default | slash_with_default)? param_maybe_default* '*' (',' " +"| param_no_default) param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ must be ahead of *\") }\n" +" | param_maybe_default+ '/' a='*' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected comma between / and " +"*\") }\n" +"invalid_default:\n" +" | a='=' &(')'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected " +"default value expression\") }\n" +"invalid_star_etc:\n" +" | a='*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"named arguments must follow bare *\") }\n" +" | '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR(\"bare * has associated type " +"comment\") }\n" +" | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" +"positional argument cannot have default value\") }\n" +" | '*' (param_no_default | ',') param_maybe_default* " +"a='*' (param_no_default | ',') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " +"once\") }\n" +"invalid_kwds:\n" +" | '**' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-keyword " +"argument cannot have default value\") }\n" +" | '**' param ',' a=param { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"arguments cannot follow var-keyword argument\") }\n" +" | '**' param ',' a[Token*]=('*'|'**'|'/') " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +"invalid_parameters_helper: # This is only there to avoid type errors\n" +" | a=slash_with_default { _PyPegen_singleton_seq(p, a) }\n" +" | param_with_default+\n" +"invalid_lambda_parameters:\n" +" | a=\"/\" ',' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"at least one argument must " +"precede /\") }\n" +" | (lambda_slash_no_default | lambda_slash_with_default) " +"lambda_param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ may appear only once\") }\n" +" | lambda_slash_no_default? lambda_param_no_default* " +"invalid_lambda_parameters_helper a=lambda_param_no_default {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"parameter without a default " +"follows parameter with a default\") }\n" +" | lambda_param_no_default* a='(' ','.lambda_param+ ','? b=')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"Lambda expression parameters " +"cannot be parenthesized\") }\n" +" | (lambda_slash_no_default | lambda_slash_with_default)? " +"lambda_param_maybe_default* '*' (',' | lambda_param_no_default) " +"lambda_param_maybe_default* a='/' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"/ must be ahead of *\") }\n" +" | lambda_param_maybe_default+ '/' a='*' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"expected comma between / and " +"*\") }\n" +"invalid_lambda_parameters_helper:\n" +" | a=lambda_slash_with_default { _PyPegen_singleton_seq(p, a) }\n" +" | lambda_param_with_default+\n" +"invalid_lambda_star_etc:\n" +" | '*' (':' | ',' (':' | '**')) { RAISE_SYNTAX_ERROR(\"named arguments " +"must follow bare *\") }\n" +" | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" +"positional argument cannot have default value\") }\n" +" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* " +"a='*' (lambda_param_no_default | ',') {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " +"once\") }\n" +"invalid_lambda_kwds:\n" +" | '**' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" +"keyword argument cannot have default value\") }\n" +" | '**' lambda_param ',' a=lambda_param " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +" | '**' lambda_param ',' a[Token*]=('*'|'**'|'/') " +"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"arguments cannot follow var-keyword " +"argument\") }\n" +"invalid_double_type_comments:\n" +" | TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {\n" +" RAISE_SYNTAX_ERROR(\"Cannot have two type comments on def\") }\n" +"invalid_with_item:\n" +" | expression 'as' a=expression &(',' | ')' | ':') {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" +"\n" +"invalid_for_if_clause:\n" +" | 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in' {\n" +" RAISE_SYNTAX_ERROR(\"'in' expected after for-loop variables\") }\n" +"\n" +"invalid_for_target:\n" +" | 'async'? 'for' a=star_expressions {\n" +" RAISE_SYNTAX_ERROR_INVALID_TARGET(FOR_TARGETS, a) }\n" +"\n" +"invalid_group:\n" +" | '(' a=starred_expression ')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot use starred expression " +"here\") }\n" +" | '(' a='**' expression ')' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot use double starred " +"expression here\") }\n" +"invalid_import:\n" +" | a='import' ','.dotted_name+ 'from' dotted_name {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"Did you mean to use 'from ... " +"import ...' instead?\") }\n" +" | 'import' token=NEWLINE {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" +"invalid_dotted_as_name:\n" +" | dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,\n" +" \"cannot use %s as import target\", " +"_PyPegen_get_expr_name(a)) }\n" +"invalid_import_from_as_name:\n" +" | NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,\n" +" \"cannot use %s as import target\", " +"_PyPegen_get_expr_name(a)) }\n" +"\n" +"invalid_import_from_targets:\n" +" | import_from_as_names ',' NEWLINE {\n" +" RAISE_SYNTAX_ERROR(\"trailing comma not allowed without surrounding " +"parentheses\") }\n" +" | token=NEWLINE {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" +"\n" +"invalid_with_stmt:\n" +" | ['async'] 'with' ','.(expression ['as' star_target])+ NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | ['async'] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +"NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +"invalid_with_stmt_indent:\n" +" | ['async'] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !" +"INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " +"statement on line %d\", a->lineno) }\n" +" | ['async'] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +"':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " +"statement on line %d\", a->lineno) }\n" +"\n" +"invalid_try_stmt:\n" +" | a='try' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'try' " +"statement on line %d\", a->lineno) }\n" +" | 'try' ':' block !('except' | 'finally') " +"{ RAISE_SYNTAX_ERROR(\"expected 'except' or 'finally' block\") }\n" +" | 'try' ':' block* except_block+ a='except' b='*' expression ['as' NAME] " +"':' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"cannot have both 'except' and " +"'except*' on the same 'try'\") }\n" +" | 'try' ':' block* except_star_block+ a='except' [expression ['as' " +"NAME]] ':' {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"cannot have both 'except' and " +"'except*' on the same 'try'\") }\n" +"invalid_except_stmt:\n" +" | 'except' a=expression ',' expressions 'as' NAME ':' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"multiple exception types must " +"be parenthesized when using 'as'\") }\n" +" | a='except' expression ['as' NAME ] NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='except' NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | 'except' expression 'as' a=expression ':' block {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use except statement with %s\", " +"_PyPegen_get_expr_name(a)) }\n" +"invalid_except_star_stmt:\n" +" | 'except' '*' a=expression ',' expressions 'as' NAME ':' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"multiple exception types must " +"be parenthesized when using 'as'\") }\n" +" | a='except' '*' expression ['as' NAME ] NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='except' '*' (NEWLINE | ':') { RAISE_SYNTAX_ERROR(\"expected one or " +"more exception types\") }\n" +" | 'except' '*' expression 'as' a=expression ':' block {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use except* statement with %s\", " +"_PyPegen_get_expr_name(a)) }\n" +"invalid_finally_stmt:\n" +" | a='finally' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'finally' " +"statement on line %d\", a->lineno) }\n" +"invalid_except_stmt_indent:\n" +" | a='except' expression ['as' NAME ] ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'except' " +"statement on line %d\", a->lineno) }\n" +" | a='except' ':' NEWLINE !INDENT { RAISE_INDENTATION_ERROR(\"expected an " +"indented block after 'except' statement on line %d\", a->lineno) }\n" +"invalid_except_star_stmt_indent:\n" +" | a='except' '*' expression ['as' NAME ] ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'except*' " +"statement on line %d\", a->lineno) }\n" +"invalid_match_stmt:\n" +" | \"match\" subject_expr NEWLINE { CHECK_VERSION(void*, 10, \"Pattern " +"matching is\", RAISE_SYNTAX_ERROR(\"expected ':'\") ) }\n" +" | a=\"match\" subject=subject_expr ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'match' " +"statement on line %d\", a->lineno) }\n" +"invalid_case_block:\n" +" | \"case\" patterns guard? NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a=\"case\" patterns guard? ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'case' " +"statement on line %d\", a->lineno) }\n" +"invalid_as_pattern:\n" +" | or_pattern 'as' a=\"_\" { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"cannot use '_' as a target\") }\n" +" | or_pattern 'as' a=expression {\n" +" RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" +" a, \"cannot use %s as pattern target\", " +"_PyPegen_get_expr_name(a)) }\n" +"invalid_class_pattern:\n" +" | name_or_attr '(' a=invalid_class_argument_pattern " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(\n" +" PyPegen_first_item(a, pattern_ty),\n" +" PyPegen_last_item(a, pattern_ty),\n" +" \"positional patterns follow keyword patterns\") }\n" +"invalid_class_argument_pattern[asdl_pattern_seq*]:\n" +" | [positional_patterns ','] keyword_patterns ',' a=positional_patterns " +"{ a }\n" +"invalid_if_stmt:\n" +" | 'if' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a='if' a=named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'if' " +"statement on line %d\", a->lineno) }\n" +"invalid_elif_stmt:\n" +" | 'elif' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a='elif' named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'elif' " +"statement on line %d\", a->lineno) }\n" +"invalid_else_stmt:\n" +" | a='else' ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'else' " +"statement on line %d\", a->lineno) }\n" +" | 'else' ':' block 'elif' { RAISE_SYNTAX_ERROR(\"'elif' block follows an " +"'else' block\")}\n" +"invalid_while_stmt:\n" +" | 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR(\"expected " +"':'\") }\n" +" | a='while' named_expression ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'while' " +"statement on line %d\", a->lineno) }\n" +"invalid_for_stmt:\n" +" | ['async'] 'for' star_targets 'in' star_expressions NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | ['async'] a='for' star_targets 'in' star_expressions ':' NEWLINE !" +"INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after 'for' " +"statement on line %d\", a->lineno) }\n" +"invalid_def_raw:\n" +" | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' " +"expression] ':' NEWLINE !INDENT {\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after function " +"definition on line %d\", a->lineno) }\n" +" | ['async'] 'def' NAME [type_params] &&'(' [params] ')' ['->' " +"expression] &&':' [func_type_comment] block\n" +"invalid_class_def_raw:\n" +" | 'class' NAME [type_params] ['(' [arguments] ')'] NEWLINE " +"{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" +" | a='class' NAME [type_params] ['(' [arguments] ')'] ':' NEWLINE !INDENT " +"{\n" +" RAISE_INDENTATION_ERROR(\"expected an indented block after class " +"definition on line %d\", a->lineno) }\n" +"\n" +"invalid_double_starred_kvpairs:\n" +" | ','.double_starred_kvpair+ ',' invalid_kvpair\n" +" | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, " +"\"cannot use a starred expression in a dictionary value\") }\n" +" | expression a=':' &('}'|',') { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"expression expected after dictionary key and ':'\") }\n" +"invalid_kvpair:\n" +" | a=expression !(':') {\n" +" RAISE_ERROR_KNOWN_LOCATION(p, PyExc_SyntaxError, a->lineno, a-" +">end_col_offset - 1, a->end_lineno, -1, \"':' expected after dictionary " +"key\") }\n" +" | expression ':' a='*' bitwise_or { RAISE_SYNTAX_ERROR_STARTING_FROM(a, " +"\"cannot use a starred expression in a dictionary value\") }\n" +" | expression a=':' &('}'|',') {RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, " +"\"expression expected after dictionary key and ':'\") }\n" +"invalid_starred_expression_unpacking:\n" +" | a='*' expression '=' b=expression { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b, \"cannot assign to iterable argument unpacking\") }\n" +"invalid_starred_expression:\n" +" | '*' { RAISE_SYNTAX_ERROR(\"Invalid star expression\") }\n" +"\n" +"invalid_fstring_replacement_field:\n" +" | '{' a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '='\") }\n" +" | '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '!'\") }\n" +" | '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before ':'\") }\n" +" | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " +"expression required before '}'\") }\n" +" | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: " +"expecting a valid expression after '{'\") }\n" +" | '{' annotated_rhs !('=' | '!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '=', or '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '=' !('!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '='? invalid_fstring_conversion_character\n" +" | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting ':' or '}'\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '}', or format specs\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" +"string: expecting '}'\") }\n" +"\n" +"invalid_fstring_conversion_character:\n" +" | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: " +"missing conversion character\") }\n" +" | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: invalid " +"conversion character\") }\n" +"\n" +"invalid_tstring_replacement_field:\n" +" | '{' a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"t-string: valid " +"expression required before '='\") }\n" +" | '{' a='!' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"t-string: valid " +"expression required before '!'\") }\n" +" | '{' a=':' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"t-string: valid " +"expression required before ':'\") }\n" +" | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"t-string: valid " +"expression required before '}'\") }\n" +" | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-string: " +"expecting a valid expression after '{'\") }\n" +" | '{' annotated_rhs !('=' | '!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting '=', or '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '=' !('!' | ':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting '!', or ':', or '}'\") }\n" +" | '{' annotated_rhs '='? invalid_tstring_conversion_character\n" +" | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting ':' or '}'\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting '}', or format specs\") }\n" +" | '{' annotated_rhs '='? ['!' NAME] !'}' {\n" +" PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-" +"string: expecting '}'\") }\n" +"\n" +"invalid_tstring_conversion_character:\n" +" | '!' &(':' | '}') { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-string: " +"missing conversion character\") }\n" +" | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"t-string: invalid " +"conversion character\") }\n" +"\n" +"invalid_string_tstring_concat:\n" +" | a=(fstring|string)+ b[expr_ty]=tstring {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(PyPegen_last_item(a, expr_ty), b, " +"\"cannot mix t-string literals with string or bytes literals\") }\n" +" | a=tstring+ b[expr_ty]=(fstring|string) {\n" +" RAISE_SYNTAX_ERROR_KNOWN_RANGE(PyPegen_last_item(a, expr_ty), b, " +"\"cannot mix t-string literals with string or bytes literals\") }\n" +"\n" +"invalid_arithmetic:\n" +" | sum ('+'|'-'|'*'|'/'|'%'|'//'|'@') a='not' b=inversion " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"'not' after an operator must be " +"parenthesized\") }\n" +"invalid_factor:\n" +" | ('+' | '-' | '~') a='not' b=factor { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b, \"'not' after an operator must be parenthesized\") }\n" +"\n" +"invalid_type_params:\n" +" | '[' token=']' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(\n" +" token,\n" +" \"Type parameter list cannot be empty\")}\n" + +#~ msgid "" +#~ "``&e``: a positive lookahead (that is, ``e`` is required to match but not " +#~ "consumed)" +#~ msgstr "" +#~ "``&e``: μια θετική προοπτική (δηλαδή, το ``e`` απαιτείται να ταιριάζει " +#~ "αλλά δεν καταναλώνεται)" + +#~ msgid "" +#~ "``!e``: a negative lookahead (that is, ``e`` is required *not* to match)" +#~ msgstr "" +#~ "``!e``: μια αρνητική προοπτική (δηλαδή, το ``e`` απαιτείται *να μην* " +#~ "ταιριάζει)" + +#~ msgid "" +#~ "The notation is a mixture of `EBNF `_ and `PEG `_. In particular, ``&`` followed by a " +#~ "symbol, token or parenthesized group indicates a positive lookahead (i." +#~ "e., is required to match but not consumed), while ``!`` indicates a " +#~ "negative lookahead (i.e., is required *not* to match). We use the ``|`` " +#~ "separator to mean PEG's \"ordered choice\" (written as ``/`` in " +#~ "traditional PEG grammars). See :pep:`617` for more details on the " +#~ "grammar's syntax." +#~ msgstr "" +#~ "Η σημειογραφία είναι ένα μείγμα από `EBNF `_ και `PEG `_. Συγκεκριμένα, το ``&`` που " +#~ "ακολουθείται από ένα σύμβολο, ένα token ή μια παρενθετική ομάδα " +#~ "υποδηλώνει θετική προεπισκόπηση (δηλαδή απαιτείται να ταιριάζει αλλά δεν " +#~ "καταναλώνεται), ενώ το ``!`` υποδηλώνει αρνητική προεπισκόπηση (δηλαδή " +#~ "απαιτείται *να μην* ταιριάζει). Χρησιμοποιούμε τον τελεστή ``|`` για να " +#~ "εκφράσουμε την \"ταξινομημένη επιλογή\" του PEG (που γράφεται ως ``/`` " +#~ "στις παραδοσιακές γραμματικές PEG). Δείτε το :pep:`617` για περισσότερες " +#~ "λεπτομέρειες σχετικά με τη σύνταξη της γραμματικής." diff --git a/reference/import.po b/reference/import.po index a2ae8894..e34250d8 100644 --- a/reference/import.po +++ b/reference/import.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -152,6 +153,18 @@ msgid "" "package with three subpackages::" msgstr "" +#: reference/import.rst:111 +msgid "" +"parent/\n" +" __init__.py\n" +" one/\n" +" __init__.py\n" +" two/\n" +" __init__.py\n" +" three/\n" +" __init__.py" +msgstr "" + #: reference/import.rst:120 msgid "" "Importing ``parent.one`` will implicitly execute ``parent/__init__.py`` and " @@ -160,11 +173,11 @@ msgid "" "__init__.py`` respectively." msgstr "" -#: reference/import.rst:127 +#: reference/import.rst:129 msgid "Namespace packages" msgstr "" -#: reference/import.rst:133 +#: reference/import.rst:135 msgid "" "A namespace package is a composite of various :term:`portions `, " "where each portion contributes a subpackage to the parent package. Portions " @@ -175,7 +188,7 @@ msgid "" "concrete representation." msgstr "" -#: reference/import.rst:141 +#: reference/import.rst:143 msgid "" "Namespace packages do not use an ordinary list for their ``__path__`` " "attribute. They instead use a custom iterable type which will automatically " @@ -184,7 +197,7 @@ msgid "" "top level package) changes." msgstr "" -#: reference/import.rst:147 +#: reference/import.rst:149 msgid "" "With namespace packages, there is no ``parent/__init__.py`` file. In fact, " "there may be multiple ``parent`` directories found during import search, " @@ -194,15 +207,15 @@ msgid "" "or one of its subpackages is imported." msgstr "" -#: reference/import.rst:154 +#: reference/import.rst:156 msgid "See also :pep:`420` for the namespace package specification." msgstr "" -#: reference/import.rst:158 +#: reference/import.rst:160 msgid "Searching" msgstr "" -#: reference/import.rst:160 +#: reference/import.rst:162 msgid "" "To begin the search, Python needs the :term:`fully qualified ` name of the module (or package, but for the purposes of this " @@ -212,7 +225,7 @@ msgid "" "functions." msgstr "" -#: reference/import.rst:166 +#: reference/import.rst:168 msgid "" "This name will be used in various phases of the import search, and it may be " "the dotted path to a submodule, e.g. ``foo.bar.baz``. In this case, Python " @@ -221,11 +234,11 @@ msgid "" "is raised." msgstr "" -#: reference/import.rst:173 +#: reference/import.rst:175 msgid "The module cache" msgstr "" -#: reference/import.rst:178 +#: reference/import.rst:180 msgid "" "The first place checked during import search is :data:`sys.modules`. This " "mapping serves as a cache of all modules that have been previously imported, " @@ -235,7 +248,7 @@ msgid "" "module object." msgstr "" -#: reference/import.rst:185 +#: reference/import.rst:187 msgid "" "During import, the module name is looked up in :data:`sys.modules` and if " "present, the associated value is the module satisfying the import, and the " @@ -244,7 +257,7 @@ msgid "" "continue searching for the module." msgstr "" -#: reference/import.rst:191 +#: reference/import.rst:193 msgid "" ":data:`sys.modules` is writable. Deleting a key may not destroy the " "associated module (as other modules may hold references to it), but it will " @@ -254,7 +267,7 @@ msgid "" "`ModuleNotFoundError`." msgstr "" -#: reference/import.rst:198 +#: reference/import.rst:200 msgid "" "Beware though, as if you keep a reference to the module object, invalidate " "its cache entry in :data:`sys.modules`, and then re-import the named module, " @@ -263,11 +276,11 @@ msgid "" "module contents by rerunning the module's code." msgstr "" -#: reference/import.rst:208 +#: reference/import.rst:210 msgid "Finders and loaders" msgstr "" -#: reference/import.rst:215 +#: reference/import.rst:217 msgid "" "If the named module is not found in :data:`sys.modules`, then Python's " "import protocol is invoked to find and load the module. This protocol " @@ -279,7 +292,7 @@ msgid "" "module." msgstr "" -#: reference/import.rst:223 +#: reference/import.rst:225 msgid "" "Python includes a number of default finders and importers. The first one " "knows how to locate built-in modules, and the second knows how to locate " @@ -289,13 +302,13 @@ msgid "" "locatable resource, such as those identified by URLs." msgstr "" -#: reference/import.rst:230 +#: reference/import.rst:232 msgid "" "The import machinery is extensible, so new finders can be added to extend " "the range and scope of module searching." msgstr "" -#: reference/import.rst:233 +#: reference/import.rst:235 msgid "" "Finders do not actually load modules. If they can find the named module, " "they return a :dfn:`module spec`, an encapsulation of the module's import-" @@ -303,32 +316,32 @@ msgid "" "module." msgstr "" -#: reference/import.rst:237 +#: reference/import.rst:239 msgid "" "The following sections describe the protocol for finders and loaders in more " "detail, including how you can create and register new ones to extend the " "import machinery." msgstr "" -#: reference/import.rst:241 +#: reference/import.rst:243 msgid "" "In previous versions of Python, finders returned :term:`loaders ` " "directly, whereas now they return module specs which *contain* loaders. " "Loaders are still used during import but have fewer responsibilities." msgstr "" -#: reference/import.rst:247 +#: reference/import.rst:249 msgid "Import hooks" msgstr "" -#: reference/import.rst:257 +#: reference/import.rst:259 msgid "" "The import machinery is designed to be extensible; the primary mechanism for " "this are the *import hooks*. There are two types of import hooks: *meta " "hooks* and *import path hooks*." msgstr "" -#: reference/import.rst:261 +#: reference/import.rst:263 msgid "" "Meta hooks are called at the start of import processing, before any other " "import processing has occurred, other than :data:`sys.modules` cache look " @@ -337,7 +350,7 @@ msgid "" "finder objects to :data:`sys.meta_path`, as described below." msgstr "" -#: reference/import.rst:267 +#: reference/import.rst:269 msgid "" "Import path hooks are called as part of :data:`sys.path` (or ``package." "__path__``) processing, at the point where their associated path item is " @@ -345,23 +358,23 @@ msgid "" "data:`sys.path_hooks` as described below." msgstr "" -#: reference/import.rst:274 +#: reference/import.rst:276 msgid "The meta path" msgstr "" -#: reference/import.rst:280 +#: reference/import.rst:282 msgid "" "When the named module is not found in :data:`sys.modules`, Python next " "searches :data:`sys.meta_path`, which contains a list of meta path finder " "objects. These finders are queried in order to see if they know how to " "handle the named module. Meta path finders must implement a method called :" -"meth:`~importlib.abc.MetaPathFinder.find_spec()` which takes three " -"arguments: a name, an import path, and (optionally) a target module. The " -"meta path finder can use any strategy it wants to determine whether it can " -"handle the named module or not." +"meth:`~importlib.abc.MetaPathFinder.find_spec` which takes three arguments: " +"a name, an import path, and (optionally) a target module. The meta path " +"finder can use any strategy it wants to determine whether it can handle the " +"named module or not." msgstr "" -#: reference/import.rst:289 +#: reference/import.rst:291 msgid "" "If the meta path finder knows how to handle the named module, it returns a " "spec object. If it cannot handle the named module, it returns ``None``. " @@ -370,9 +383,9 @@ msgid "" "exceptions raised are simply propagated up, aborting the import process." msgstr "" -#: reference/import.rst:295 +#: reference/import.rst:297 msgid "" -"The :meth:`~importlib.abc.MetaPathFinder.find_spec()` method of meta path " +"The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders is called with two or three arguments. The first is the fully " "qualified name of the module being imported, for example ``foo.bar.baz``. " "The second argument is the path entries to use for the module search. For " @@ -384,7 +397,7 @@ msgid "" "system passes in a target module only during reload." msgstr "" -#: reference/import.rst:306 +#: reference/import.rst:308 msgid "" "The meta path may be traversed multiple times for a single import request. " "For example, assuming none of the modules involved has already been cached, " @@ -396,14 +409,14 @@ msgid "" "will call ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, None)``." msgstr "" -#: reference/import.rst:316 +#: reference/import.rst:318 msgid "" "Some meta path finders only support top level imports. These importers will " "always return ``None`` when anything other than ``None`` is passed as the " "second argument." msgstr "" -#: reference/import.rst:320 +#: reference/import.rst:322 msgid "" "Python's default :data:`sys.meta_path` has three meta path finders, one that " "knows how to import built-in modules, one that knows how to import frozen " @@ -411,7 +424,7 @@ msgid "" "path` (i.e. the :term:`path based finder`)." msgstr "" -#: reference/import.rst:325 +#: reference/import.rst:327 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders replaced :meth:`!find_module`, which is now deprecated. While it " @@ -420,40 +433,72 @@ msgid "" "find_spec`." msgstr "" -#: reference/import.rst:332 +#: reference/import.rst:334 msgid "" "Use of :meth:`!find_module` by the import system now raises :exc:" "`ImportWarning`." msgstr "" -#: reference/import.rst:336 +#: reference/import.rst:338 msgid "" ":meth:`!find_module` has been removed. Use :meth:`~importlib.abc." "MetaPathFinder.find_spec` instead." msgstr "" -#: reference/import.rst:342 +#: reference/import.rst:344 msgid "Loading" msgstr "" -#: reference/import.rst:344 +#: reference/import.rst:346 msgid "" "If and when a module spec is found, the import machinery will use it (and " "the loader it contains) when loading the module. Here is an approximation " "of what happens during the loading portion of import::" msgstr "" -#: reference/import.rst:377 -msgid "Note the following details:" +#: reference/import.rst:350 +msgid "" +"module = None\n" +"if spec.loader is not None and hasattr(spec.loader, 'create_module'):\n" +" # It is assumed 'exec_module' will also be defined on the loader.\n" +" module = spec.loader.create_module(spec)\n" +"if module is None:\n" +" module = ModuleType(spec.name)\n" +"# The import-related module attributes get set here:\n" +"_init_module_attrs(spec, module)\n" +"\n" +"if spec.loader is None:\n" +" # unsupported\n" +" raise ImportError\n" +"if spec.origin is None and spec.submodule_search_locations is not None:\n" +" # namespace package\n" +" sys.modules[spec.name] = module\n" +"elif not hasattr(spec.loader, 'exec_module'):\n" +" module = spec.loader.load_module(spec.name)\n" +"else:\n" +" sys.modules[spec.name] = module\n" +" try:\n" +" spec.loader.exec_module(module)\n" +" except BaseException:\n" +" try:\n" +" del sys.modules[spec.name]\n" +" except KeyError:\n" +" pass\n" +" raise\n" +"return sys.modules[spec.name]" msgstr "" #: reference/import.rst:379 +msgid "Note the following details:" +msgstr "" + +#: reference/import.rst:381 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, import will have already returned it." msgstr "" -#: reference/import.rst:382 +#: reference/import.rst:384 msgid "" "The module will exist in :data:`sys.modules` before the loader executes the " "module code. This is crucial because the module code may (directly or " @@ -462,7 +507,7 @@ msgid "" "best." msgstr "" -#: reference/import.rst:388 +#: reference/import.rst:390 msgid "" "If loading fails, the failing module -- and only the failing module -- gets " "removed from :data:`sys.modules`. Any module already in the :data:`sys." @@ -471,7 +516,7 @@ msgid "" "the failing module is left in :data:`sys.modules`." msgstr "" -#: reference/import.rst:394 +#: reference/import.rst:396 msgid "" "After the module is created but before execution, the import machinery sets " "the import-related module attributes (\"_init_module_attrs\" in the pseudo-" @@ -479,31 +524,31 @@ msgid "" "attrs>`." msgstr "" -#: reference/import.rst:399 +#: reference/import.rst:401 msgid "" "Module execution is the key moment of loading in which the module's " "namespace gets populated. Execution is entirely delegated to the loader, " "which gets to decide what gets populated and how." msgstr "" -#: reference/import.rst:403 +#: reference/import.rst:405 msgid "" "The module created during loading and passed to exec_module() may not be the " "one returned at the end of import [#fnlo]_." msgstr "" -#: reference/import.rst:406 +#: reference/import.rst:408 msgid "" "The import system has taken over the boilerplate responsibilities of " "loaders. These were previously performed by the :meth:`importlib.abc.Loader." "load_module` method." msgstr "" -#: reference/import.rst:412 +#: reference/import.rst:414 msgid "Loaders" msgstr "" -#: reference/import.rst:414 +#: reference/import.rst:416 msgid "" "Module loaders provide the critical function of loading: module execution. " "The import machinery calls the :meth:`importlib.abc.Loader.exec_module` " @@ -511,32 +556,32 @@ msgid "" "returned from :meth:`~importlib.abc.Loader.exec_module` is ignored." msgstr "" -#: reference/import.rst:419 +#: reference/import.rst:421 msgid "Loaders must satisfy the following requirements:" msgstr "" -#: reference/import.rst:421 +#: reference/import.rst:423 msgid "" "If the module is a Python module (as opposed to a built-in module or a " "dynamically loaded extension), the loader should execute the module's code " "in the module's global name space (``module.__dict__``)." msgstr "" -#: reference/import.rst:425 +#: reference/import.rst:427 msgid "" "If the loader cannot execute the module, it should raise an :exc:" "`ImportError`, although any other exception raised during :meth:`~importlib." "abc.Loader.exec_module` will be propagated." msgstr "" -#: reference/import.rst:429 +#: reference/import.rst:431 msgid "" "In many cases, the finder and loader can be the same object; in such cases " "the :meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return " "a spec with the loader set to ``self``." msgstr "" -#: reference/import.rst:433 +#: reference/import.rst:435 msgid "" "Module loaders may opt in to creating the module object during loading by " "implementing a :meth:`~importlib.abc.Loader.create_module` method. It takes " @@ -546,18 +591,18 @@ msgid "" "will create the new module itself." msgstr "" -#: reference/import.rst:440 +#: reference/import.rst:442 msgid "The :meth:`~importlib.abc.Loader.create_module` method of loaders." msgstr "" -#: reference/import.rst:443 +#: reference/import.rst:445 msgid "" "The :meth:`~importlib.abc.Loader.load_module` method was replaced by :meth:" "`~importlib.abc.Loader.exec_module` and the import machinery assumed all the " "boilerplate responsibilities of loading." msgstr "" -#: reference/import.rst:448 +#: reference/import.rst:450 msgid "" "For compatibility with existing loaders, the import machinery will use the " "``load_module()`` method of loaders if it exists and the loader does not " @@ -565,14 +610,14 @@ msgid "" "deprecated and loaders should implement ``exec_module()`` instead." msgstr "" -#: reference/import.rst:453 +#: reference/import.rst:455 msgid "" "The ``load_module()`` method must implement all the boilerplate loading " "functionality described above in addition to executing the module. All the " "same constraints apply, with some additional clarification:" msgstr "" -#: reference/import.rst:457 +#: reference/import.rst:459 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, the loader must use that existing module. (Otherwise, :func:" @@ -581,40 +626,40 @@ msgid "" "add it to :data:`sys.modules`." msgstr "" -#: reference/import.rst:463 +#: reference/import.rst:465 msgid "" "The module *must* exist in :data:`sys.modules` before the loader executes " "the module code, to prevent unbounded recursion or multiple loading." msgstr "" -#: reference/import.rst:467 +#: reference/import.rst:469 msgid "" "If loading fails, the loader must remove any modules it has inserted into :" "data:`sys.modules`, but it must remove **only** the failing module(s), and " "only if the loader itself has loaded the module(s) explicitly." msgstr "" -#: reference/import.rst:472 +#: reference/import.rst:474 msgid "" "A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." msgstr "" -#: reference/import.rst:476 +#: reference/import.rst:478 msgid "" "An :exc:`ImportError` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." msgstr "" -#: reference/import.rst:480 +#: reference/import.rst:482 msgid "Use of ``load_module()`` will raise :exc:`ImportWarning`." msgstr "" -#: reference/import.rst:484 +#: reference/import.rst:486 msgid "Submodules" msgstr "" -#: reference/import.rst:486 +#: reference/import.rst:488 msgid "" "When a submodule is loaded using any mechanism (e.g. ``importlib`` APIs, the " "``import`` or ``import-from`` statements, or built-in ``__import__()``) a " @@ -624,17 +669,37 @@ msgid "" "submodule. Let's say you have the following directory structure::" msgstr "" -#: reference/import.rst:497 +#: reference/import.rst:495 +msgid "" +"spam/\n" +" __init__.py\n" +" foo.py" +msgstr "" + +#: reference/import.rst:499 msgid "and ``spam/__init__.py`` has the following line in it::" msgstr "" #: reference/import.rst:501 +msgid "from .foo import Foo" +msgstr "" + +#: reference/import.rst:503 msgid "" "then executing the following puts name bindings for ``foo`` and ``Foo`` in " "the ``spam`` module::" msgstr "" -#: reference/import.rst:510 +#: reference/import.rst:506 +msgid "" +">>> import spam\n" +">>> spam.foo\n" +"\n" +">>> spam.Foo\n" +"" +msgstr "" + +#: reference/import.rst:512 msgid "" "Given Python's familiar name binding rules this might seem surprising, but " "it's actually a fundamental feature of the import system. The invariant " @@ -643,11 +708,11 @@ msgid "" "``foo`` attribute of the former." msgstr "" -#: reference/import.rst:517 -msgid "Module spec" +#: reference/import.rst:521 +msgid "Module specs" msgstr "" -#: reference/import.rst:519 +#: reference/import.rst:523 msgid "" "The import machinery uses a variety of information about each module during " "import, especially before loading. Most of the information is common to all " @@ -655,7 +720,7 @@ msgid "" "related information on a per-module basis." msgstr "" -#: reference/import.rst:524 +#: reference/import.rst:528 msgid "" "Using a spec during import allows state to be transferred between import " "system components, e.g. between the finder that creates the module spec and " @@ -664,208 +729,70 @@ msgid "" "a module spec the loader had that responsibility." msgstr "" -#: reference/import.rst:530 -msgid "" -"The module's spec is exposed as the ``__spec__`` attribute on a module " -"object. See :class:`~importlib.machinery.ModuleSpec` for details on the " -"contents of the module spec." -msgstr "" - -#: reference/import.rst:539 -msgid "Import-related module attributes" -msgstr "" - -#: reference/import.rst:541 -msgid "" -"The import machinery fills in these attributes on each module object during " -"loading, based on the module's spec, before the loader executes the module." -msgstr "" - -#: reference/import.rst:545 -msgid "" -"It is **strongly** recommended that you rely on :attr:`__spec__` and its " -"attributes instead of any of the other individual attributes listed below." -msgstr "" - -#: reference/import.rst:551 -msgid "" -"The ``__name__`` attribute must be set to the fully qualified name of the " -"module. This name is used to uniquely identify the module in the import " -"system." -msgstr "" - -#: reference/import.rst:557 -msgid "" -"The ``__loader__`` attribute must be set to the loader object that the " -"import machinery used when loading the module. This is mostly for " -"introspection, but can be used for additional loader-specific functionality, " -"for example getting data associated with a loader." -msgstr "" - -#: reference/import.rst:583 -msgid "" -"It is **strongly** recommended that you rely on :attr:`__spec__` instead of " -"this attribute." -msgstr "" - -#: reference/import.rst:565 -msgid "" -"The value of ``__loader__`` is expected to be the same as ``__spec__." -"loader``. The use of ``__loader__`` is deprecated and slated for removal in " -"Python 3.14." -msgstr "" - -#: reference/import.rst:572 -msgid "" -"The module's ``__package__`` attribute may be set. Its value must be a " -"string, but it can be the same value as its ``__name__``. When the module " -"is a package, its ``__package__`` value should be set to its ``__name__``. " -"When the module is not a package, ``__package__`` should be set to the empty " -"string for top-level modules, or for submodules, to the parent package's " -"name. See :pep:`366` for further details." -msgstr "" - -#: reference/import.rst:580 -msgid "" -"This attribute is used instead of ``__name__`` to calculate explicit " -"relative imports for main modules, as defined in :pep:`366`." -msgstr "" - -#: reference/import.rst:586 -msgid "" -"The value of ``__package__`` is expected to be the same as ``__spec__." -"parent``." -msgstr "" - -#: reference/import.rst:590 -msgid "" -":exc:`ImportWarning` is raised if import falls back to ``__package__`` " -"instead of :attr:`~importlib.machinery.ModuleSpec.parent`." -msgstr "" - -#: reference/import.rst:595 -msgid "" -"Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning` when falling " -"back to ``__package__``." -msgstr "" - -#: reference/import.rst:602 -msgid "" -"The ``__spec__`` attribute must be set to the module spec that was used when " -"importing the module. Setting ``__spec__`` appropriately applies equally to :" -"ref:`modules initialized during interpreter startup `. The one " -"exception is ``__main__``, where ``__spec__`` is :ref:`set to None in some " -"cases `." -msgstr "" - -#: reference/import.rst:608 -msgid "" -"When ``__spec__.parent`` is not set, ``__package__`` is used as a fallback." -msgstr "" - -#: reference/import.rst:613 -msgid "" -"``__spec__.parent`` is used as a fallback when ``__package__`` is not " -"defined." -msgstr "" - -#: reference/import.rst:619 -msgid "" -"If the module is a package (either regular or namespace), the module " -"object's ``__path__`` attribute must be set. The value must be iterable, " -"but may be empty if ``__path__`` has no further significance. If " -"``__path__`` is not empty, it must produce strings when iterated over. More " -"details on the semantics of ``__path__`` are given :ref:`below `." -msgstr "" - -#: reference/import.rst:626 -msgid "Non-package modules should not have a ``__path__`` attribute." -msgstr "" - -#: reference/import.rst:631 +#: reference/import.rst:534 msgid "" -"``__file__`` is optional (if set, value must be a string). It indicates the " -"pathname of the file from which the module was loaded (if loaded from a " -"file), or the pathname of the shared library file for extension modules " -"loaded dynamically from a shared library. It might be missing for certain " -"types of modules, such as C modules that are statically linked into the " -"interpreter, and the import system may opt to leave it unset if it has no " -"semantic meaning (e.g. a module loaded from a database)." +"The module's spec is exposed as :attr:`module.__spec__`. Setting :attr:`!" +"__spec__` appropriately applies equally to :ref:`modules initialized during " +"interpreter startup `. The one exception is ``__main__``, where :" +"attr:`!__spec__` is :ref:`set to None in some cases `." msgstr "" -#: reference/import.rst:640 +#: reference/import.rst:540 msgid "" -"If ``__file__`` is set then the ``__cached__`` attribute might also be set, " -"which is the path to any compiled version of the code (e.g. byte-compiled " -"file). The file does not need to exist to set this attribute; the path can " -"simply point to where the compiled file would exist (see :pep:`3147`)." +"See :class:`~importlib.machinery.ModuleSpec` for details on the contents of " +"the module spec." msgstr "" -#: reference/import.rst:646 -msgid "" -"Note that ``__cached__`` may be set even if ``__file__`` is not set. " -"However, that scenario is quite atypical. Ultimately, the loader is what " -"makes use of the module spec provided by the finder (from which ``__file__`` " -"and ``__cached__`` are derived). So if a loader can load from a cached " -"module but otherwise does not load from a file, that atypical scenario may " -"be appropriate." +#: reference/import.rst:548 +msgid "__path__ attributes on modules" msgstr "" -#: reference/import.rst:653 +#: reference/import.rst:550 msgid "" -"It is **strongly** recommended that you rely on :attr:`__spec__` instead of " -"``__cached__``." +"The :attr:`~module.__path__` attribute should be a (possibly empty) :term:" +"`sequence` of strings enumerating the locations where the package's " +"submodules will be found. By definition, if a module has a :attr:`!__path__` " +"attribute, it is a :term:`package`." msgstr "" -#: reference/import.rst:659 -msgid "module.__path__" -msgstr "" - -#: reference/import.rst:661 +#: reference/import.rst:555 msgid "" -"By definition, if a module has a ``__path__`` attribute, it is a package." -msgstr "" - -#: reference/import.rst:663 -msgid "" -"A package's ``__path__`` attribute is used during imports of its " +"A package's :attr:`~module.__path__` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" "data:`sys.path`, i.e. providing a list of locations to search for modules " -"during import. However, ``__path__`` is typically much more constrained " -"than :data:`sys.path`." +"during import. However, :attr:`!__path__` is typically much more constrained " +"than :data:`!sys.path`." msgstr "" -#: reference/import.rst:669 +#: reference/import.rst:562 msgid "" -"``__path__`` must be an iterable of strings, but it may be empty. The same " -"rules used for :data:`sys.path` also apply to a package's ``__path__``, and :" -"data:`sys.path_hooks` (described below) are consulted when traversing a " -"package's ``__path__``." +"The same rules used for :data:`sys.path` also apply to a package's :attr:`!" +"__path__`. :data:`sys.path_hooks` (described below) are consulted when " +"traversing a package's :attr:`!__path__`." msgstr "" -#: reference/import.rst:674 +#: reference/import.rst:566 msgid "" -"A package's ``__init__.py`` file may set or alter the package's ``__path__`` " -"attribute, and this was typically the way namespace packages were " -"implemented prior to :pep:`420`. With the adoption of :pep:`420`, namespace " -"packages no longer need to supply ``__init__.py`` files containing only " -"``__path__`` manipulation code; the import machinery automatically sets " -"``__path__`` correctly for the namespace package." +"A package's ``__init__.py`` file may set or alter the package's :attr:" +"`~module.__path__` attribute, and this was typically the way namespace " +"packages were implemented prior to :pep:`420`. With the adoption of :pep:" +"`420`, namespace packages no longer need to supply ``__init__.py`` files " +"containing only :attr:`!__path__` manipulation code; the import machinery " +"automatically sets :attr:`!__path__` correctly for the namespace package." msgstr "" -#: reference/import.rst:682 +#: reference/import.rst:575 msgid "Module reprs" msgstr "" -#: reference/import.rst:684 +#: reference/import.rst:577 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: reference/import.rst:688 +#: reference/import.rst:581 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -875,45 +802,45 @@ msgid "" "for whatever information is missing." msgstr "" -#: reference/import.rst:695 +#: reference/import.rst:588 msgid "Here are the exact rules used:" msgstr "" -#: reference/import.rst:697 +#: reference/import.rst:590 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: reference/import.rst:701 +#: reference/import.rst:594 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: reference/import.rst:704 +#: reference/import.rst:597 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: reference/import.rst:707 +#: reference/import.rst:600 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: reference/import.rst:709 +#: reference/import.rst:602 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" -#: reference/import.rst:717 +#: reference/import.rst:610 msgid "Cached bytecode invalidation" msgstr "" -#: reference/import.rst:719 +#: reference/import.rst:612 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -923,7 +850,7 @@ msgid "" "source's metadata." msgstr "" -#: reference/import.rst:726 +#: reference/import.rst:619 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -937,17 +864,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: reference/import.rst:737 +#: reference/import.rst:630 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: reference/import.rst:743 +#: reference/import.rst:636 msgid "The Path Based Finder" msgstr "" -#: reference/import.rst:748 +#: reference/import.rst:641 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -956,14 +883,14 @@ msgid "" "a location to search for modules." msgstr "" -#: reference/import.rst:754 +#: reference/import.rst:647 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: reference/import.rst:758 +#: reference/import.rst:651 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -974,14 +901,14 @@ msgid "" "from zipfiles." msgstr "" -#: reference/import.rst:765 +#: reference/import.rst:658 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: reference/import.rst:769 +#: reference/import.rst:662 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -992,7 +919,7 @@ msgid "" "from the web." msgstr "" -#: reference/import.rst:777 +#: reference/import.rst:670 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -1003,7 +930,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: reference/import.rst:785 +#: reference/import.rst:678 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -1011,11 +938,11 @@ msgid "" "would be invoked." msgstr "" -#: reference/import.rst:792 +#: reference/import.rst:685 msgid "Path entry finders" msgstr "" -#: reference/import.rst:800 +#: reference/import.rst:693 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -1023,7 +950,7 @@ msgid "" "not be limited to this." msgstr "" -#: reference/import.rst:805 +#: reference/import.rst:698 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1031,7 +958,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: reference/import.rst:810 +#: reference/import.rst:703 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1039,7 +966,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: reference/import.rst:815 +#: reference/import.rst:708 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1051,7 +978,7 @@ msgid "" "other data types are ignored." msgstr "" -#: reference/import.rst:824 +#: reference/import.rst:717 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1063,7 +990,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: reference/import.rst:833 +#: reference/import.rst:726 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1079,7 +1006,7 @@ msgid "" "finder to perform the path entry search again." msgstr "" -#: reference/import.rst:846 +#: reference/import.rst:739 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1095,7 +1022,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: reference/import.rst:860 +#: reference/import.rst:753 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1105,7 +1032,7 @@ msgid "" "could not find the module." msgstr "" -#: reference/import.rst:867 +#: reference/import.rst:760 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1113,30 +1040,30 @@ msgid "" "the module." msgstr "" -#: reference/import.rst:872 +#: reference/import.rst:765 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " -"current working directory is found to not exist, no value is stored in :data:" -"`sys.path_importer_cache`. Second, the value for the current working " -"directory is looked up fresh for each module lookup. Third, the path used " -"for :data:`sys.path_importer_cache` and returned by :meth:`importlib." -"machinery.PathFinder.find_spec` will be the actual current working directory " -"and not the empty string." +"current working directory cannot be determined or is found not to exist, no " +"value is stored in :data:`sys.path_importer_cache`. Second, the value for " +"the current working directory is looked up fresh for each module lookup. " +"Third, the path used for :data:`sys.path_importer_cache` and returned by :" +"meth:`importlib.machinery.PathFinder.find_spec` will be the actual current " +"working directory and not the empty string." msgstr "" -#: reference/import.rst:882 +#: reference/import.rst:775 msgid "Path entry finder protocol" msgstr "" -#: reference/import.rst:884 +#: reference/import.rst:777 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: reference/import.rst:888 +#: reference/import.rst:781 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1144,21 +1071,21 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: reference/import.rst:893 +#: reference/import.rst:786 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" -#: reference/import.rst:897 +#: reference/import.rst:790 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" -#: reference/import.rst:903 +#: reference/import.rst:796 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1166,14 +1093,14 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: reference/import.rst:908 +#: reference/import.rst:801 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" -#: reference/import.rst:913 +#: reference/import.rst:806 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1183,7 +1110,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: reference/import.rst:920 +#: reference/import.rst:813 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1192,28 +1119,28 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: reference/import.rst:926 +#: reference/import.rst:819 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" -#: reference/import.rst:931 +#: reference/import.rst:824 msgid "``find_module()`` and ``find_loader()`` have been removed." msgstr "" -#: reference/import.rst:936 +#: reference/import.rst:829 msgid "Replacing the standard import system" msgstr "" -#: reference/import.rst:938 +#: reference/import.rst:831 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: reference/import.rst:942 +#: reference/import.rst:835 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1222,7 +1149,7 @@ msgid "" "statements within that module." msgstr "" -#: reference/import.rst:948 +#: reference/import.rst:841 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1232,11 +1159,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: reference/import.rst:958 +#: reference/import.rst:851 msgid "Package Relative Imports" msgstr "" -#: reference/import.rst:960 +#: reference/import.rst:853 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1244,30 +1171,58 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: reference/import.rst:976 +#: reference/import.rst:858 +msgid "" +"package/\n" +" __init__.py\n" +" subpackage1/\n" +" __init__.py\n" +" moduleX.py\n" +" moduleY.py\n" +" subpackage2/\n" +" __init__.py\n" +" moduleZ.py\n" +" moduleA.py" +msgstr "" + +#: reference/import.rst:869 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: reference/import.rst:986 +#: reference/import.rst:872 +msgid "" +"from .moduleY import spam\n" +"from .moduleY import spam as ham\n" +"from . import moduleY\n" +"from ..subpackage1 import moduleY\n" +"from ..subpackage2.moduleZ import eggs\n" +"from ..moduleA import foo" +msgstr "" + +#: reference/import.rst:879 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: reference/import.rst:992 +#: reference/import.rst:883 +msgid "import XXX.YYY.ZZZ" +msgstr "" + +#: reference/import.rst:885 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: reference/import.rst:999 +#: reference/import.rst:892 msgid "Special considerations for __main__" msgstr "" -#: reference/import.rst:1001 +#: reference/import.rst:894 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere `, the ``__main__`` module is " @@ -1278,17 +1233,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: reference/import.rst:1012 +#: reference/import.rst:905 msgid "__main__.__spec__" msgstr "" -#: reference/import.rst:1014 +#: reference/import.rst:907 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: reference/import.rst:1017 +#: reference/import.rst:910 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1296,30 +1251,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: reference/import.rst:1022 +#: reference/import.rst:915 msgid "" "In :ref:`the remaining cases ` ``__main__." "__spec__`` is set to ``None``, as the code used to populate the :mod:" "`__main__` does not correspond directly with an importable module:" msgstr "" -#: reference/import.rst:1026 +#: reference/import.rst:919 msgid "interactive prompt" msgstr "" -#: reference/import.rst:1027 +#: reference/import.rst:920 msgid ":option:`-c` option" msgstr "" -#: reference/import.rst:1028 +#: reference/import.rst:921 msgid "running from stdin" msgstr "" -#: reference/import.rst:1029 +#: reference/import.rst:922 msgid "running directly from a source or bytecode file" msgstr "" -#: reference/import.rst:1031 +#: reference/import.rst:924 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1327,7 +1282,7 @@ msgid "" "`__main__`." msgstr "" -#: reference/import.rst:1036 +#: reference/import.rst:929 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1336,11 +1291,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: reference/import.rst:1044 +#: reference/import.rst:937 msgid "References" msgstr "" -#: reference/import.rst:1046 +#: reference/import.rst:939 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages ` for " "Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as " "an alternative to :meth:`!find_module`." msgstr "" -#: reference/import.rst:1058 +#: reference/import.rst:951 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: reference/import.rst:1061 +#: reference/import.rst:954 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: reference/import.rst:1065 +#: reference/import.rst:958 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: reference/import.rst:1067 +#: reference/import.rst:960 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1387,15 +1342,15 @@ msgid "" "finders and loaders." msgstr "" -#: reference/import.rst:1074 +#: reference/import.rst:967 msgid "Footnotes" msgstr "" -#: reference/import.rst:1075 +#: reference/import.rst:968 msgid "See :class:`types.ModuleType`." msgstr "" -#: reference/import.rst:1077 +#: reference/import.rst:970 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1408,7 +1363,7 @@ msgstr "" msgid "import machinery" msgstr "" -#: reference/import.rst:95 reference/import.rst:129 +#: reference/import.rst:95 reference/import.rst:131 msgid "package" msgstr "" @@ -1416,82 +1371,82 @@ msgstr "" msgid "regular" msgstr "" -#: reference/import.rst:129 +#: reference/import.rst:131 msgid "namespace" msgstr "" -#: reference/import.rst:129 +#: reference/import.rst:131 msgid "portion" msgstr "" -#: reference/import.rst:175 +#: reference/import.rst:177 msgid "sys.modules" msgstr "" -#: reference/import.rst:276 +#: reference/import.rst:278 msgid "finder" msgstr "" -#: reference/import.rst:210 +#: reference/import.rst:212 msgid "loader" msgstr "" -#: reference/import.rst:210 +#: reference/import.rst:212 msgid "module spec" msgstr "" -#: reference/import.rst:249 +#: reference/import.rst:251 msgid "import hooks" msgstr "" -#: reference/import.rst:249 +#: reference/import.rst:251 msgid "meta hooks" msgstr "" -#: reference/import.rst:249 +#: reference/import.rst:251 msgid "path hooks" msgstr "" -#: reference/import.rst:249 +#: reference/import.rst:251 msgid "hooks" msgstr "" -#: reference/import.rst:249 +#: reference/import.rst:251 msgid "import" msgstr "" -#: reference/import.rst:249 +#: reference/import.rst:251 msgid "meta" msgstr "" -#: reference/import.rst:249 +#: reference/import.rst:251 msgid "path" msgstr "" -#: reference/import.rst:276 +#: reference/import.rst:278 msgid "sys.meta_path" msgstr "" -#: reference/import.rst:276 +#: reference/import.rst:278 msgid "find_spec" msgstr "" -#: reference/import.rst:745 +#: reference/import.rst:638 msgid "path based finder" msgstr "" -#: reference/import.rst:794 +#: reference/import.rst:687 msgid "sys.path" msgstr "" -#: reference/import.rst:794 +#: reference/import.rst:687 msgid "sys.path_hooks" msgstr "" -#: reference/import.rst:794 +#: reference/import.rst:687 msgid "sys.path_importer_cache" msgstr "" -#: reference/import.rst:794 +#: reference/import.rst:687 msgid "PYTHONPATH" msgstr "" diff --git a/reference/index.po b/reference/index.po index 6932b088..c6559a4a 100644 --- a/reference/index.po +++ b/reference/index.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-12-11 18:57+0200\n" +"Last-Translator: Vassiliki Dalakiari \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: reference/index.rst:5 msgid "The Python Language Reference" -msgstr "" +msgstr "Εγχειρίδιο Αναφοράς της Γλώσσας Python" #: reference/index.rst:7 msgid "" @@ -31,3 +32,13 @@ msgid "" "picture of how to write a Python extension module, and the :ref:`c-api-" "index` describes the interfaces available to C/C++ programmers in detail." msgstr "" +"Αυτό το εγχειρίδιο αναφοράς περιγράφει τη σύνταξη και τη «βασική " +"σημασιολογία» της γλώσσας. Είναι συνοπτικό, αλλά προσπαθεί να είναι ακριβές " +"και πλήρες. Η σημασιολογία των μη απαραίτητων ενσωματωμένων τύπων " +"αντικειμένων και των ενσωματωμένων συναρτήσεων και modules περιγράφεται στη :" +"ref:`library-index`. Για μια άτυπη εισαγωγή στη γλώσσα, ανατρέξτε στο :ref:" +"`tutorial-index`. Για προγραμματιστές C ή C++, υπάρχουν δύο επιπλέον " +"εγχειρίδια: το :ref:`extending-index` περιγράφει τη συνολική εικόνα του " +"τρόπου συγγραφής ενός module επέκτασης της Python και το :ref:`c-api-index` " +"περιγράφει λεπτομερώς τις διεπαφές που είναι διαθέσιμες στους " +"προγραμματιστές C/C++." diff --git a/reference/introduction.po b/reference/introduction.po index 20ac7dd6..41c78efd 100644 --- a/reference/introduction.po +++ b/reference/introduction.po @@ -8,23 +8,27 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Stelios Rotas \n" +"Language-Team: PyGreece \n" +"Language: el_GR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.5\n" #: reference/introduction.rst:6 msgid "Introduction" -msgstr "" +msgstr "Εισαγωγή" #: reference/introduction.rst:8 msgid "" "This reference manual describes the Python programming language. It is not " "intended as a tutorial." msgstr "" +"Αυτό το εγχειρίδιο αναφοράς περιγράφει την γλώσσα προγραμματισμού Python. " +"Δεν προορίζεται ως εγχειρίδιο εκμάθησης." #: reference/introduction.rst:11 msgid "" @@ -40,6 +44,19 @@ msgid "" "like to see a more formal definition of the language, maybe you could " "volunteer your time --- or invent a cloning machine :-)." msgstr "" +"Στην προσπάθεια το έγγραφο αυτό να είναι όσο το δυνατόν πιο ακριβές, " +"επιλέχθηκε αρχικά η Αγγλική γλώσσα, και ύστερα μεταφράστηκε στην Ελληνική, " +"και όχι οι επίσημες προδιαγραφές, με εξαίρεση την συντακτική και λεξιλογική " +"ανάλυση. Αυτό θα πρέπει να κάνει το έγγραφο πιο κατανοητό στον μέσο " +"αναγνώστη, αλλά θα αφήσει χώρο για αμφισημίες. Συνεπώς, αν ερχόσουν από τον " +"Άρη και προσπαθούσες να υλοποιήσεις ξανά την Python από το έγγραφο αυτό και " +"μόνο, μάλλον θα χρειαζόταν να μαντέψεις κάποια πράγματα και για την ακρίβεια " +"ίσως θα κατέληγες να υλοποιείς μια τελείως διαφορετική γλώσσα. Από την άλλη " +"πλευρά, αν χρησιμοποιείς την Python και αναρωτιέσαι ποιοι είναι οι ακριβείς " +"κανόνες σχετικά με έναν συγκεκριμένο τομέα της γλώσσας, τότε σίγουρα θα τους " +"βρεις εδώ πέρα. Αν θα ήθελες να δεις έναν πιο επίσημο ορισμό της γλώσσας, " +"ίσως θα μπορούσες να προσφέρεις λίγο από τον χρόνο σου --- ή να φτιάξεις μια " +"μηχανή κλωνοποίησης :-)." #: reference/introduction.rst:23 msgid "" @@ -52,6 +69,14 @@ msgid "" "implementation imposes additional limitations. Therefore, you'll find short " "\"implementation notes\" sprinkled throughout the text." msgstr "" +"Είναι επικίνδυνο να προσθέσουμε πολλές λεπτομέρειες υλοποίησης σε ένα " +"έγγραφο αναφοράς μίας γλώσσας --- η υλοποίηση δύναται να αλλάξει, και άλλες " +"υλοποιήσεις της ίδιας γλώσσας μπορεί να λειτουργούν διαφορετικά. Από την " +"άλλη, η CPython είναι μία υλοποίηση της Python με ευρεία χρήση (ωστόσο " +"εναλλακτικές υλοποιήσεις συνεχίζουν να υποστηρίζονται), και οι συγκεκριμένες " +"της ιδιομορφίες ενίοτε αξίζουν αναφορά, ειδικά εκεί που η υλοποίηση " +"επιβάλλει επιπρόσθετους περιορισμούς. Επομένως, θα βρεις σύντομες " +"\"σημειώσεις υλοποίησης\" σε διάφορα μέρη του κειμένου." #: reference/introduction.rst:32 msgid "" @@ -60,10 +85,14 @@ msgid "" "modules are mentioned when they interact in a significant way with the " "language definition." msgstr "" +"Κάθε υλοποίηση της Python συνοδεύεται από έναν αριθμό ενσωματωμένων και " +"πρότυπων module. Αυτές είναι καταγεγραμμένες στο :ref:`library-index`. " +"Κάποια ενσωματωμένα module αναφέρονται όταν αλληλεπιδρούν με έναν σημαντικό " +"τρόπο με τον ορισμό της γλώσσας." #: reference/introduction.rst:41 msgid "Alternate Implementations" -msgstr "" +msgstr "Εναλλακτικές Υλοποιήσεις" #: reference/introduction.rst:43 msgid "" @@ -71,24 +100,29 @@ msgid "" "there are some alternate implementations which are of particular interest to " "different audiences." msgstr "" +"Παρόλο που υπάρχει μία υλοποίηση της Python που είναι μακράν η πιο διάσημη, " +"υπάρχουν εναλλακτικές υλοποιήσεις που έχουν ιδιαίτερο ενδιαφέρον για " +"διάφορους ανθρώπους." #: reference/introduction.rst:47 msgid "Known implementations include:" -msgstr "" +msgstr "Γνωστές υλοποιήσεις περιλαμβάνουν:" -#: reference/introduction.rst:51 +#: reference/introduction.rst:49 msgid "CPython" -msgstr "" +msgstr "CPython" #: reference/introduction.rst:50 msgid "" "This is the original and most-maintained implementation of Python, written " "in C. New language features generally appear here first." msgstr "" +"Αυτή είναι η πρωτότυπη και η πιο καλοδιατηρημένη υλοποίηση της Python, " +"γραμμένη στην C. Νέες λειτουργίες της γλώσσας συνήθως εμφανίζονται πρώτα εδώ." -#: reference/introduction.rst:57 +#: reference/introduction.rst:53 msgid "Jython" -msgstr "" +msgstr "Jython" #: reference/introduction.rst:54 msgid "" @@ -98,10 +132,16 @@ msgid "" "libraries. More information can be found at `the Jython website `_." msgstr "" +"Η υλοποίηση της Python στην Java. Αυτή η υλοποίηση μπορεί να χρησιμοποιηθεί " +"ως γλώσσα δέσμης ενεργειών για εφαρμογές στην Java, ή μπορεί να " +"χρησιμοποιηθεί για να δημιουργήσει εφαρμογές με τη χρήση των βιβλιοθηκών των " +"κλάσεων της Java. Συχνά επίσης χρησιμοποιείται για να δημιουργήσει τεστ για " +"τις βιβλιοθήκες της Java. Περισσότερες πληροφορίες μπορείτε να βρείτε στην " +"`ιστοσελίδα της Jython `_." -#: reference/introduction.rst:63 +#: reference/introduction.rst:59 msgid "Python for .NET" -msgstr "" +msgstr "Python για το .NET" #: reference/introduction.rst:60 msgid "" @@ -110,10 +150,15 @@ msgid "" "by Brian Lloyd. For more information, see the `Python for .NET home page " "`_." msgstr "" +"Αυτή η υλοποίηση στην πραγματικότητα χρησιμοποιεί την υλοποίηση CPython, " +"αλλά είναι μία διαχειριζόμενη εφαρμογή του .NET και κάνει διαθέσιμες τις ." +"NET βιβλιοθήκες. Δημιουργήθηκε από τον *Brian Lloyd*. Για περισσότερες " +"πληροφορίες, δείτε την `αρχική σελίδα της Python για το .NET `_." -#: reference/introduction.rst:69 +#: reference/introduction.rst:65 msgid "IronPython" -msgstr "" +msgstr "IronPython" #: reference/introduction.rst:66 msgid "" @@ -123,10 +168,15 @@ msgid "" "For more information, see `the IronPython website `_." msgstr "" +"Μια εναλλακτική Python για το .NET. Σε αντίθεση με το Python.NET, αυτή είναι " +"μία ολοκληρωμένη υλοποίηση της Python που παράγει IL, και κάνει μεταγλώττιση " +"του κώδικα της Python απευθείας στη γλώσσα assembly του .NET. Δημιουργήθηκε " +"από τον Jim Hugunin, τον πρωτότυπο δημιουργό της Jython. Για περισσότερες " +"πληροφορίες δείτε την `ιστοσελίδα της IronPython `_." -#: reference/introduction.rst:77 +#: reference/introduction.rst:71 msgid "PyPy" -msgstr "" +msgstr "PyPy" #: reference/introduction.rst:72 msgid "" @@ -135,9 +185,16 @@ msgid "" "support and a Just in Time compiler. One of the goals of the project is to " "encourage experimentation with the language itself by making it easier to " "modify the interpreter (since it is written in Python). Additional " -"information is available on `the PyPy project's home page `_." +"information is available on `the PyPy project's home page `_." msgstr "" +"Μια υλοποίηση της Python γραμμένη εξ ολοκλήρου σε Python. Υποστηρίζει " +"αρκετές προηγμένες λειτουργίες που δεν υπάρχουν σε άλλες υλοποιήσεις όπως " +"υποστήριξη για stackless και τον μεταγλωττιστή Just in Time. Ένας από τους " +"στόχους του πρότζεκτ είναι να ενθαρρύνει τον πειραματισμό με την ίδια την " +"γλώσσα κάνοντας πιο εύκολη την τροποποίηση του διερμηνέα (αφού είναι " +"γραμμένος στην Python). Περισσότερες πληροφορίες είναι διαθέσιμες στην " +"`αρχική σελίδα του PyPy πρότζεκτ `_." #: reference/introduction.rst:79 msgid "" @@ -147,83 +204,350 @@ msgid "" "implementation-specific documentation to determine what else you need to " "know about the specific implementation you're using." msgstr "" +"Κάθε μία από αυτές τις υλοποιήσεις διαφοροποιούνται με κάποιον τρόπο από την " +"γλώσσα όπως καταγράφεται σε αυτό το εγχειρίδιο, ή εισάγει συγκεκριμένη " +"πληροφορία πέρα από ό,τι καλύπτουν τα πρότυπα έγγραφα της Python. Παρακαλώ " +"να συμβουλευτείτε το έγγραφο της συγκεκριμένης υλοποίησης για να " +"προσδιορίσετε τι άλλο χρειάζεται να ξέρετε σχετικά με την συγκεκριμένη " +"υλοποίηση που χρησιμοποιείτε." #: reference/introduction.rst:89 msgid "Notation" -msgstr "" +msgstr "Σημειογραφία" #: reference/introduction.rst:93 msgid "" -"The descriptions of lexical analysis and syntax use a modified `Backus–Naur " -"form (BNF) `_ " -"grammar notation. This uses the following style of definition:" +"The descriptions of lexical analysis and syntax use a grammar notation that " +"is a mixture of `EBNF `_ and `PEG `_. For example:" +msgstr "" +"Οι περιγραφές στην λεξιλογική ανάλυση και σύνταξη χρησιμοποιούν μια " +"γραμματική σημειογραφία που είναι μείγμα των `EBNF `_ και `PEG `_. Για παράδειγμα:" + +#: reference/introduction.rst:106 +msgid "" +"In this example, the first line says that a ``name`` is a ``letter`` " +"followed by a sequence of zero or more ``letter``\\ s, ``digit``\\ s, and " +"underscores. A ``letter`` in turn is any of the single characters ``'a'`` " +"through ``'z'`` and ``A`` through ``Z``; a ``digit`` is a single character " +"from ``0`` to ``9``." +msgstr "" +"Σε αυτό το παράδειγμα, η πρώτη γραμμή αναφέρει ότι ένα ``name`` είναι ένα " +"``letter`` ακολουθούμενο από μια ακολουθία μηδενός ή περισσότερων " +"``γραμμάτος``\\ ων, ``ψηφίο``\\ α, και κάτω παύλων. Ένα ``letter`` με τη " +"σειρά του είναι οποιοσδήποτε από τους μεμονωμένους χαρακτήρες ``'a'`` έως " +"``'z'`` και ``A`` έως ``Z`` ∙ ένα ``digit`` είναι ένας μεμονωμένος " +"χαρακτήρας από ``0`` έως ``9``." + +#: reference/introduction.rst:112 +msgid "" +"Each rule begins with a name (which identifies the rule that's being " +"defined) followed by a colon, ``:``. The definition to the right of the " +"colon uses the following syntax elements:" msgstr "" +"Κάθε κανόνας ξεκινά με ένα όνομα (το οποίο προσδιορίζει τον κανόνα που " +"ορίζεται) ακολουθούμενο από άνω κάτω τελεία, ``:``. Ο ορισμός στα δεξιά της " +"άνω και κάτω τελείας χρησιμοποιεί τα ακόλουθα στοιχεία σύνταξης:" -#: reference/introduction.rst:101 +#: reference/introduction.rst:116 msgid "" -"The first line says that a ``name`` is an ``lc_letter`` followed by a " -"sequence of zero or more ``lc_letter``\\ s and underscores. An " -"``lc_letter`` in turn is any of the single characters ``'a'`` through " -"``'z'``. (This rule is actually adhered to for the names defined in lexical " -"and grammar rules in this document.)" +"``name``: A name refers to another rule. Where possible, it is a link to the " +"rule's definition." msgstr "" +"``name``: Ένα όνομα αναφέρεται σε έναν άλλο κανόνα, Όπου είναι δυνατόν, " +"είναι ένας σύνδεσμος προς τον ορισμό του κανόνα." -#: reference/introduction.rst:106 +#: reference/introduction.rst:119 msgid "" -"Each rule begins with a name (which is the name defined by the rule) and ``::" -"=``. A vertical bar (``|``) is used to separate alternatives; it is the " -"least binding operator in this notation. A star (``*``) means zero or more " -"repetitions of the preceding item; likewise, a plus (``+``) means one or " -"more repetitions, and a phrase enclosed in square brackets (``[ ]``) means " -"zero or one occurrences (in other words, the enclosed phrase is optional). " -"The ``*`` and ``+`` operators bind as tightly as possible; parentheses are " -"used for grouping. Literal strings are enclosed in quotes. White space is " -"only meaningful to separate tokens. Rules are normally contained on a single " -"line; rules with many alternatives may be formatted alternatively with each " -"line after the first beginning with a vertical bar." +"``TOKEN``: An uppercase name refers to a :term:`token`. For the purposes of " +"grammar definitions, tokens are the same as rules." msgstr "" +"``TOKEN``: Ένα κεφαλαίο όνομα αναφέρεται σε ένα :term:`token`. Για τους " +"σκοπούς των γραμματικών ορισμών, τα tokens είναι το ίδιο με τους κανόνες." -#: reference/introduction.rst:120 +#: reference/introduction.rst:122 msgid "" -"In lexical definitions (as the example above), two more conventions are " -"used: Two literal characters separated by three dots mean a choice of any " -"single character in the given (inclusive) range of ASCII characters. A " -"phrase between angular brackets (``<...>``) gives an informal description of " -"the symbol defined; e.g., this could be used to describe the notion of " -"'control character' if needed." +"``\"text\"``, ``'text'``: Text in single or double quotes must match " +"literally (without the quotes). The type of quote is chosen according to the " +"meaning of ``text``:" +msgstr "" +"``\"text\"``, ``'text'``: Το κείμενο σε μονά ή διπλά εισαγωγικά πρέπει να " +"ταιριάζει κυριολεκτικά (χωρίς τα εισαγωγικά). Ο τύπος του εισαγωγικού " +"επιλέγεται ανάλογα με τη σημασία του ``text``:" + +#: reference/introduction.rst:126 +msgid "``'if'``: A name in single quotes denotes a :ref:`keyword `." msgstr "" +"``'if'``: Ένα όνομα σε μονά εισαγωγικά υποδηλώνει μια :ref:`keyword " +"`." #: reference/introduction.rst:127 msgid "" -"Even though the notation used is almost the same, there is a big difference " -"between the meaning of lexical and syntactic definitions: a lexical " -"definition operates on the individual characters of the input source, while " -"a syntax definition operates on the stream of tokens generated by the " -"lexical analysis. All uses of BNF in the next chapter (\"Lexical Analysis\") " -"are lexical definitions; uses in subsequent chapters are syntactic " -"definitions." +"``\"case\"``: A name in double quotes denotes a :ref:`soft-keyword `." +msgstr "" +"``\"case\"``: Ένα όνομα σε διπλά εισαγωγικά υποδηλώνει ένα :ref:`soft-" +"keyword `." + +#: reference/introduction.rst:129 +msgid "" +"``'@'``: A non-letter symbol in single quotes denotes an :py:data:`~token." +"OP` token, that is, a :ref:`delimiter ` or :ref:`operator " +"`." +msgstr "" +"``'@'``: Ένα σύμβολο που δεν περιέχει γράμμα σε μονά εισαγωγικά υποδηλώνει " +"ένα :py:data:`~token.OP` token, δηλαδή, ένα :ref:`delimiter ` ή :" +"ref:`operator `." + +#: reference/introduction.rst:133 +msgid "" +"``e1 e2``: Items separated only by whitespace denote a sequence. Here, " +"``e1`` must be followed by ``e2``." +msgstr "" +"``e1 e2``: Τα στοιχεία που χωρίζονται μόνο με κενό υποδηλώνουν μια " +"ακολουθία. Εδώ, το ``e1`` πρέπει να ακολουθείται από το ``e2``." + +#: reference/introduction.rst:135 +msgid "" +"``e1 | e2``: A vertical bar is used to separate alternatives. It denotes " +"PEG's \"ordered choice\": if ``e1`` matches, ``e2`` is not considered. In " +"traditional PEG grammars, this is written as a slash, ``/``, rather than a " +"vertical bar. See :pep:`617` for more background and details." +msgstr "" +"``e1 | e2``: Χρησιμοποιείται μια κάθετη γραμμή για τον διαχωρισμό των " +"εναλλακτικών λύσεων. Υποδηλώνει την \"διατεταγμένη επιλογή\" του PEG: εάν το " +"``e1`` ταιριάζει, το ``e2`` δεν λαμβάνεται υπόψη. Στις παραδοσιακές " +"γραμματικές του PEG, αυτό γράφεται ως κάθετος, ``/``, αντί για κάθετη " +"γραμμή. Δείτε το :pep:`617` για περισσότερες πληροφορίες και λεπτομέρειες." + +#: reference/introduction.rst:141 +msgid "``e*``: A star means zero or more repetitions of the preceding item." +msgstr "" +"``e*``: Ένας αστερίσκος σημαίνει μηδέν ή περισσότερες επαναλήψεις του " +"προηγούμενοι στοιχείου." + +#: reference/introduction.rst:142 +msgid "``e+``: Likewise, a plus means one or more repetitions." +msgstr "``e+``: Ομοίως, ένα συν σημαίνει μία ή περισσότερες επαναλήψεις." + +#: reference/introduction.rst:143 +msgid "" +"``[e]``: A phrase enclosed in square brackets means zero or one occurrences. " +"In other words, the enclosed phrase is optional." +msgstr "" +"``[e]``: Μια φράση που περικλείεται σε αγκύλες σημαίνει μηδέν ή μία " +"εμφάνιση. Με άλλα λόγια, η φράση που περικλείεται είναι προαιρετική." + +#: reference/introduction.rst:145 +msgid "" +"``e?``: A question mark has exactly the same meaning as square brackets: the " +"preceding item is optional." +msgstr "" +"``e?``: Ένα ερωτηματικό έχει ακριβώς την ίδια σημασία με τις αγκύλες: το " +"προηγούμενο στοιχείο είναι προαιρετικό." + +#: reference/introduction.rst:147 +msgid "``(e)``: Parentheses are used for grouping." +msgstr "``(e)``: Οι παρενθέσεις χρησιμοποιούνται για ομαδοποίηση." + +#: reference/introduction.rst:149 +msgid "" +"The following notation is only used in :ref:`lexical definitions `." msgstr "" +"Η ακόλουθη σημειογραφία χρησιμοποιείται μόνο σε :ref:`λεξιλογικούς ορισμούς " +"`." + +#: reference/introduction.rst:152 +msgid "" +"``\"a\"...\"z\"``: Two literal characters separated by three dots mean a " +"choice of any single character in the given (inclusive) range of ASCII " +"characters." +msgstr "" +"``\"a\"...\"z\"``: Δύο κυριολεκτικοί χαρακτήρες διαχωρισμένοι από τρεις " +"τελείες σημαίνουν την επιλογή οποιουδήποτε μεμονωμένου χαρακτήρα στο " +"δεδομένο (συμπεριλαμβανομένου) εύρος χαρακτήρων ASCII." + +#: reference/introduction.rst:154 +msgid "" +"``<...>``: A phrase between angular brackets gives an informal description " +"of the matched symbol (for example, ````), or an abbreviation that is defined in nearby text (for example, " +"````)." +msgstr "" +"``<...>``: Μια φράση μέσα σε γωνιακές αγκύλες δίνει μια άτυπη περιγραφή του " +"αντίστοιχου συμβόλου (για παράδειγμα ````), ή μια συντομογραφία που ορίζεται σε κοντινό κείμενο (για παράδειγμα, " +"````)." + +#: reference/introduction.rst:160 +msgid "" +"Some definitions also use *lookaheads*, which indicate that an element must " +"(or must not) match at a given position, but without consuming any input:" +msgstr "" +"Ορισμοί επίσης χρησιμοποιούν *lookaheads*, που υποδεικνύουν ότι ένα στοιχείο " +"πρέπει (ή δεν πρέπει) να ταιριάζει σε μια δεδομένη θέση, αλλά χωρίς να " +"καταναλώνει οποιαδήποτε είσοδο:" + +#: reference/introduction.rst:163 +msgid "``&e``: a positive lookahead (that is, ``e`` is required to match)" +msgstr "" +"``&e``: μια θετική προοπτική (δηλαδή, το ``e`` απαιτείται να ταιριάζει)" + +#: reference/introduction.rst:164 +msgid "" +"``!e``: a negative lookahead (that is, ``e`` is required *not* to match)" +msgstr "" +"``!e``: μια αρνητική προοπτική (δηλαδή, το ``e`` απαιτείται *να μην* " +"ταιριάζει)" + +#: reference/introduction.rst:166 +msgid "" +"The unary operators (``*``, ``+``, ``?``) bind as tightly as possible; the " +"vertical bar (``|``) binds most loosely." +msgstr "" +"Οι μοναδιαίοι τελεστές (``*``, ``+``, ``?``) συνδέονται όσο το δυνατόν πιο " +"σφιχτά∙ η κάθετη γραμμή (``|``) συνδέεται πιο χαλαρά." + +#: reference/introduction.rst:169 +msgid "White space is only meaningful to separate tokens." +msgstr "Το κενό έχει νόημα μόνο για τον διαχωρισμό των διακριτικών." + +#: reference/introduction.rst:171 +msgid "" +"Rules are normally contained on a single line, but rules that are too long " +"may be wrapped:" +msgstr "" +"Οι κανόνες συνήθως περιέχονται σε μία μόνο γραμμή, αλλά οι κανόνες που είναι " +"πολύ μεγάλοι μπορούν να αναδιπλωθούν." + +#: reference/introduction.rst:180 +msgid "" +"Alternatively, rules may be formatted with the first line ending at the " +"colon, and each alternative beginning with a vertical bar on a new line. For " +"example:" +msgstr "" +"Εναλλακτικά, οι κανόνες μπορούν να μορφοποιηθούν με την πρώτη γραμμή να " +"τελειών στην άνω και κάτω τελεία και κάθε εναλλακτική να ξεκινά με μια " +"κάθετη γραμμή σε μια νέα γραμμή. Για παράδειγμα:" + +#: reference/introduction.rst:195 +msgid "This does *not* mean that there is an empty first alternative." +msgstr "Αυτό *δεν* σημαίνει ότι υπάρχει μια κενή πρώτη εναλλακτική λύση." + +#: reference/introduction.rst:202 +msgid "Lexical and Syntactic definitions" +msgstr "Λεξικοί και Συντακτικοί ορισμοί" + +#: reference/introduction.rst:204 +msgid "" +"There is some difference between *lexical* and *syntactic* analysis: the :" +"term:`lexical analyzer` operates on the individual characters of the input " +"source, while the *parser* (syntactic analyzer) operates on the stream of :" +"term:`tokens ` generated by the lexical analysis. However, in some " +"cases the exact boundary between the two phases is a CPython implementation " +"detail." +msgstr "" +"Υπάρχει κάποια διαφορά μεταξύ της *λεξικής* και της *συντακτικής* ανάλυσης: " +"ο :term:`lexical analyzer` λειτουργεί στους μεμονωμένους χαρακτήρες της " +"πηγής εισόδου, ενώ ο *αναλυτής* (συντακτικός αναλυτής) λειτουργεί στη ροή " +"των :term:`tokens ` που δημιουργούνται από τη λεξική ανάλυση. Ωστόσο, " +"σε ορισμένες περιπτώσεις το ακριβές όριο μεταξύ των δύο φάσεων είναι μια " +"λεπτομέρεια υλοποίησης της CPython." + +#: reference/introduction.rst:211 +msgid "" +"The practical difference between the two is that in *lexical* definitions, " +"all whitespace is significant. The lexical analyzer :ref:`discards " +"` all whitespace that is not converted to tokens like :data:" +"`token.INDENT` or :data:`~token.NEWLINE`. *Syntactic* definitions then use " +"these tokens, rather than source characters." +msgstr "" +"Η πρακτική διαφορά μεταξύ των δύο είναι ότι στους *λεξιλογικούς* ορισμούς, " +"όλα τα κενά είναι σημαντικά. Ο λεξικός αναλυτής :ref:`discards ` " +"όλα τα κενά που δεν μετατρέπονται σε διακριτικά όπως :data:`token.INDENT` ή :" +"data:`~token.NEWLINE`. Οι *συντακτικοί* ορισμοί χρησιμοποιούν στη συνέχεια " +"αυτά τα διακριτικά, αντί για τους χαρακτήρες προέλευσης." + +#: reference/introduction.rst:217 +msgid "" +"This documentation uses the same BNF grammar for both styles of definitions. " +"All uses of BNF in the next chapter (:ref:`lexical`) are lexical " +"definitions; uses in subsequent chapters are syntactic definitions." +msgstr "" +"Αυτή η τεκμηρίωση χρησιμοποιεί την ίδια γραμματική BNF και για τα δύο στυλ " +"ορισμών. Όλες οι χρήσεις του BNF στο επόμενο κεφάλαιο (:ref:`lexical`) είναι " +"λεξιλογικοί ορισμοί∙ οι χρήσεις στα επόμενα κεφάλαια είναι συντακτικοί " +"ορισμοί." #: reference/introduction.rst:91 msgid "BNF" -msgstr "" +msgstr "BNF" #: reference/introduction.rst:91 msgid "grammar" -msgstr "" +msgstr "γραμματική" #: reference/introduction.rst:91 msgid "syntax" -msgstr "" +msgstr "συντακτικό" #: reference/introduction.rst:91 msgid "notation" -msgstr "" +msgstr "σημειογραφία" -#: reference/introduction.rst:118 +#: reference/introduction.rst:197 msgid "lexical definitions" -msgstr "" +msgstr "λεξιλογικοί ορισμοί" -#: reference/introduction.rst:118 -msgid "ASCII" -msgstr "" +#~ msgid "" +#~ "Each rule begins with a name (which is the name defined by the rule) and " +#~ "``::=``. A vertical bar (``|``) is used to separate alternatives; it is " +#~ "the least binding operator in this notation. A star (``*``) means zero " +#~ "or more repetitions of the preceding item; likewise, a plus (``+``) means " +#~ "one or more repetitions, and a phrase enclosed in square brackets " +#~ "(``[ ]``) means zero or one occurrences (in other words, the enclosed " +#~ "phrase is optional). The ``*`` and ``+`` operators bind as tightly as " +#~ "possible; parentheses are used for grouping. Literal strings are " +#~ "enclosed in quotes. White space is only meaningful to separate tokens. " +#~ "Rules are normally contained on a single line; rules with many " +#~ "alternatives may be formatted alternatively with each line after the " +#~ "first beginning with a vertical bar." +#~ msgstr "" +#~ "Κάθε κανόνας ξεκινά με ένα όνομα (το οποίο είναι ένα όνομα ορισμένο από " +#~ "τον κανόνα) και ``::=``. Μία κάθετη γραμμή (``|``) χρησιμοποιείται για να " +#~ "διαχωρίσει τις εναλλακτικές· έχει την μικρότερη προτεραιότητα στην σειρά " +#~ "προτεραιότητας πράξεων αυτού του συμβολισμού. Ένας αστερίσκος (``*``) " +#~ "σημαίνει μηδέν ή περισσότερες επαναλήψεις του προηγούμενου αντικειμένου· " +#~ "παρομοίως, το συν (``+``) σημαίνει μία ή περισσότερες επαναλήψεις, και " +#~ "μία φράση περιφραγμένη από αγκύλες (``[ ]``) σημαίνει μηδέν ή μία " +#~ "περίπτωση (με άλλα λόγια, η περιφραγμένη φράση είναι προαιρετική). Οι " +#~ "τελεστές ``*`` και ``+`` ενώνονται όσο το δυνατόν πιο σφιχτά· οι " +#~ "παρενθέσεις χρησιμοποιούνται για ομαδοποίηση. Οι συμβολοσειρές είναι " +#~ "περιφραγμένες από εισαγωγικά. Οι κενοί χαρακτήρες είναι μόνο σημαντικοί " +#~ "για να διαχωρίσουν τα *tokens*. Οι κανόνες συνήθως περιέχονται σε μία " +#~ "μονή γραμμή· οι κανόνες με πολλές εναλλακτικές μπορεί να μορφοποιηθούν " +#~ "εναλλακτικά με κάθε γραμμή μετά την πρώτη να ξεκινάει με μια κάθετη " +#~ "γραμμή." + +#~ msgid "" +#~ "In lexical definitions (as the example above), two more conventions are " +#~ "used: Two literal characters separated by three dots mean a choice of any " +#~ "single character in the given (inclusive) range of ASCII characters. A " +#~ "phrase between angular brackets (``<...>``) gives an informal description " +#~ "of the symbol defined; e.g., this could be used to describe the notion of " +#~ "'control character' if needed." +#~ msgstr "" +#~ "Στους λεξιλογικούς ορισμούς (όπως στο παραπάνω παράδειγμα), δύο " +#~ "περισσότεροι κανόνες χρησιμοποιούνται: Δύο χαρακτήρες χωρισμένοι από " +#~ "τρεις τελείες σημαίνει επιλογή όποιου μονού χαρακτήρα στο συγκεκριμένο " +#~ "(κλειστό) εύρος *ASCII* χαρακτήρων. Η φράση ανάμεσα σε γωνιακές " +#~ "παρενθέσεις (``<...>``) δίνει μία άτυπη περιγραφή του ορισμένου συμβόλου· " +#~ "π.χ., αυτό θα μπορούσε να χρησιμοποιηθεί για να περιγράψει την ιδέα του " +#~ "'χαρακτήρα ελέγχου' (control character) αν χρειαστεί." + +#~ msgid "ASCII" +#~ msgstr "ASCII" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 44111a19..b1934b50 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -22,67 +23,239 @@ msgstr "" #: reference/lexical_analysis.rst:10 msgid "" -"A Python program is read by a *parser*. Input to the parser is a stream of " -"*tokens*, generated by the *lexical analyzer*. This chapter describes how " -"the lexical analyzer breaks a file into tokens." +"A Python program is read by a *parser*. Input to the parser is a stream of :" +"term:`tokens `, generated by the *lexical analyzer* (also known as " +"the *tokenizer*). This chapter describes how the lexical analyzer produces " +"these tokens." msgstr "" -#: reference/lexical_analysis.rst:14 +#: reference/lexical_analysis.rst:15 msgid "" -"Python reads program text as Unicode code points; the encoding of a source " -"file can be given by an encoding declaration and defaults to UTF-8, see :pep:" -"`3120` for details. If the source file cannot be decoded, a :exc:" -"`SyntaxError` is raised." +"The lexical analyzer determines the program text's :ref:`encoding " +"` (UTF-8 by default), and decodes the text into :ref:`source " +"characters `. If the text cannot be decoded, a :" +"exc:`SyntaxError` is raised." msgstr "" -#: reference/lexical_analysis.rst:23 +#: reference/lexical_analysis.rst:20 +msgid "" +"Next, the lexical analyzer uses the source characters to generate a stream " +"of tokens. The type of a generated token generally depends on the next " +"source character to be processed. Similarly, other special behavior of the " +"analyzer depends on the first source character that hasn't yet been " +"processed. The following table gives a quick summary of these source " +"characters, with links to sections that contain more information." +msgstr "" + +#: reference/lexical_analysis.rst:30 +msgid "Character" +msgstr "" + +#: reference/lexical_analysis.rst:31 +msgid "Next token (or other relevant documentation)" +msgstr "" + +#: reference/lexical_analysis.rst:33 reference/lexical_analysis.rst:266 +msgid "space" +msgstr "" + +#: reference/lexical_analysis.rst:34 reference/lexical_analysis.rst:266 +msgid "tab" +msgstr "" + +#: reference/lexical_analysis.rst:35 +msgid "formfeed" +msgstr "" + +#: reference/lexical_analysis.rst:36 +msgid ":ref:`Whitespace `" +msgstr "" + +#: reference/lexical_analysis.rst:38 +msgid "CR, LF" +msgstr "" + +#: reference/lexical_analysis.rst:39 +msgid ":ref:`New line `" +msgstr "" + +#: reference/lexical_analysis.rst:40 +msgid ":ref:`Indentation `" +msgstr "" + +#: reference/lexical_analysis.rst:42 +msgid "backslash (``\\``)" +msgstr "" + +#: reference/lexical_analysis.rst:43 +msgid ":ref:`Explicit line joining `" +msgstr "" + +#: reference/lexical_analysis.rst:44 +msgid "(Also significant in :ref:`string escape sequences `)" +msgstr "" + +#: reference/lexical_analysis.rst:46 +msgid "hash (``#``)" +msgstr "" + +#: reference/lexical_analysis.rst:47 +msgid ":ref:`Comment `" +msgstr "" + +#: reference/lexical_analysis.rst:49 +msgid "quote (``'``, ``\"``)" +msgstr "" + +#: reference/lexical_analysis.rst:50 +msgid ":ref:`String literal `" +msgstr "" + +#: reference/lexical_analysis.rst:52 +msgid "ASCII letter (``a``-``z``, ``A``-``Z``)" +msgstr "" + +#: reference/lexical_analysis.rst:53 +msgid "non-ASCII character" +msgstr "" + +#: reference/lexical_analysis.rst:54 reference/lexical_analysis.rst:58 +msgid ":ref:`Name `" +msgstr "" + +#: reference/lexical_analysis.rst:55 +msgid "Prefixed :ref:`string or bytes literal `" +msgstr "" + +#: reference/lexical_analysis.rst:57 +msgid "underscore (``_``)" +msgstr "" + +#: reference/lexical_analysis.rst:59 +msgid "(Can also be part of :ref:`numeric literals `)" +msgstr "" + +#: reference/lexical_analysis.rst:61 +msgid "number (``0``-``9``)" +msgstr "" + +#: reference/lexical_analysis.rst:62 reference/lexical_analysis.rst:65 +msgid ":ref:`Numeric literal `" +msgstr "" + +#: reference/lexical_analysis.rst:64 +msgid "dot (``.``)" +msgstr "" + +#: reference/lexical_analysis.rst:66 +msgid ":ref:`Operator `" +msgstr "" + +#: reference/lexical_analysis.rst:68 +msgid "question mark (``?``)" +msgstr "" + +#: reference/lexical_analysis.rst:69 +msgid "dollar (``$``)" +msgstr "" + +#: reference/lexical_analysis.rst:74 +msgid "backquote (``​`​``)" +msgstr "" + +#: reference/lexical_analysis.rst:75 +msgid "control character" +msgstr "" + +#: reference/lexical_analysis.rst:76 +msgid "Error (outside string literals and comments)" +msgstr "" + +#: reference/lexical_analysis.rst:78 +msgid "other printing character" +msgstr "" + +#: reference/lexical_analysis.rst:79 +msgid ":ref:`Operator or delimiter `" +msgstr "" + +#: reference/lexical_analysis.rst:81 +msgid "end of file" +msgstr "" + +#: reference/lexical_analysis.rst:82 +msgid ":ref:`End marker `" +msgstr "" + +#: reference/lexical_analysis.rst:88 msgid "Line structure" msgstr "" -#: reference/lexical_analysis.rst:27 +#: reference/lexical_analysis.rst:92 msgid "A Python program is divided into a number of *logical lines*." msgstr "" -#: reference/lexical_analysis.rst:33 +#: reference/lexical_analysis.rst:98 msgid "Logical lines" msgstr "" -#: reference/lexical_analysis.rst:37 +#: reference/lexical_analysis.rst:102 msgid "" -"The end of a logical line is represented by the token NEWLINE. Statements " -"cannot cross logical line boundaries except where NEWLINE is allowed by the " -"syntax (e.g., between statements in compound statements). A logical line is " -"constructed from one or more *physical lines* by following the explicit or " -"implicit *line joining* rules." +"The end of a logical line is represented by the token :data:`~token." +"NEWLINE`. Statements cannot cross logical line boundaries except where :data:" +"`!NEWLINE` is allowed by the syntax (e.g., between statements in compound " +"statements). A logical line is constructed from one or more *physical lines* " +"by following the :ref:`explicit ` or :ref:`implicit " +"` *line joining* rules." msgstr "" -#: reference/lexical_analysis.rst:47 +#: reference/lexical_analysis.rst:113 msgid "Physical lines" msgstr "" -#: reference/lexical_analysis.rst:49 +#: reference/lexical_analysis.rst:115 +msgid "" +"A physical line is a sequence of characters terminated by one the following " +"end-of-line sequences:" +msgstr "" + +#: reference/lexical_analysis.rst:118 +msgid "the Unix form using ASCII LF (linefeed)," +msgstr "" + +#: reference/lexical_analysis.rst:119 msgid "" -"A physical line is a sequence of characters terminated by an end-of-line " -"sequence. In source files and strings, any of the standard platform line " -"termination sequences can be used - the Unix form using ASCII LF (linefeed), " "the Windows form using the ASCII sequence CR LF (return followed by " -"linefeed), or the old Macintosh form using the ASCII CR (return) character. " -"All of these forms can be used equally, regardless of platform. The end of " -"input also serves as an implicit terminator for the final physical line." +"linefeed)," msgstr "" -#: reference/lexical_analysis.rst:57 +#: reference/lexical_analysis.rst:120 +msgid "the '`Classic Mac OS`__' form using the ASCII CR (return) character." +msgstr "" + +#: reference/lexical_analysis.rst:124 msgid "" -"When embedding Python, source code strings should be passed to Python APIs " -"using the standard C conventions for newline characters (the ``\\n`` " -"character, representing ASCII LF, is the line terminator)." +"Regardless of platform, each of these sequences is replaced by a single " +"ASCII LF (linefeed) character. (This is done even inside :ref:`string " +"literals `.) Each line can use any of the sequences; they do not " +"need to be consistent within a file." msgstr "" -#: reference/lexical_analysis.rst:65 +#: reference/lexical_analysis.rst:130 +msgid "" +"The end of input also serves as an implicit terminator for the final " +"physical line." +msgstr "" + +#: reference/lexical_analysis.rst:133 +msgid "Formally:" +msgstr "" + +#: reference/lexical_analysis.rst:144 msgid "Comments" msgstr "" -#: reference/lexical_analysis.rst:70 +#: reference/lexical_analysis.rst:149 msgid "" "A comment starts with a hash character (``#``) that is not part of a string " "literal, and ends at the end of the physical line. A comment signifies the " @@ -90,11 +263,11 @@ msgid "" "Comments are ignored by the syntax." msgstr "" -#: reference/lexical_analysis.rst:79 +#: reference/lexical_analysis.rst:158 msgid "Encoding declarations" msgstr "" -#: reference/lexical_analysis.rst:84 +#: reference/lexical_analysis.rst:163 msgid "" "If a comment in the first or second line of the Python script matches the " "regular expression ``coding[=:]\\s*([-\\w.]+)``, this comment is processed " @@ -104,34 +277,49 @@ msgid "" "comment-only line. The recommended forms of an encoding expression are ::" msgstr "" -#: reference/lexical_analysis.rst:93 +#: reference/lexical_analysis.rst:170 +msgid "# -*- coding: -*-" +msgstr "" + +#: reference/lexical_analysis.rst:172 msgid "which is recognized also by GNU Emacs, and ::" msgstr "" -#: reference/lexical_analysis.rst:97 +#: reference/lexical_analysis.rst:174 +msgid "# vim:fileencoding=" +msgstr "" + +#: reference/lexical_analysis.rst:176 msgid "which is recognized by Bram Moolenaar's VIM." msgstr "" -#: reference/lexical_analysis.rst:99 +#: reference/lexical_analysis.rst:178 msgid "" -"If no encoding declaration is found, the default encoding is UTF-8. In " -"addition, if the first bytes of the file are the UTF-8 byte-order mark " -"(``b'\\xef\\xbb\\xbf'``), the declared file encoding is UTF-8 (this is " -"supported, among others, by Microsoft's :program:`notepad`)." +"If no encoding declaration is found, the default encoding is UTF-8. If the " +"implicit or explicit encoding of a file is UTF-8, an initial UTF-8 byte-" +"order mark (``b'\\xef\\xbb\\xbf'``) is ignored rather than being a syntax " +"error." msgstr "" -#: reference/lexical_analysis.rst:104 +#: reference/lexical_analysis.rst:182 msgid "" "If an encoding is declared, the encoding name must be recognized by Python " "(see :ref:`standard-encodings`). The encoding is used for all lexical " "analysis, including string literals, comments and identifiers." msgstr "" -#: reference/lexical_analysis.rst:113 +#: reference/lexical_analysis.rst:189 +msgid "" +"All lexical analysis, including string literals, comments and identifiers, " +"works on Unicode text decoded using the source encoding. Any Unicode code " +"point, except the NUL control character, can appear in Python source." +msgstr "" + +#: reference/lexical_analysis.rst:203 msgid "Explicit line joining" msgstr "" -#: reference/lexical_analysis.rst:117 +#: reference/lexical_analysis.rst:207 msgid "" "Two or more physical lines may be joined into logical lines using backslash " "characters (``\\``), as follows: when a physical line ends in a backslash " @@ -140,7 +328,15 @@ msgid "" "following end-of-line character. For example::" msgstr "" -#: reference/lexical_analysis.rst:128 +#: reference/lexical_analysis.rst:213 +msgid "" +"if 1900 < year < 2100 and 1 <= month <= 12 \\\n" +" and 1 <= day <= 31 and 0 <= hour < 24 \\\n" +" and 0 <= minute < 60 and 0 <= second < 60: # Looks like a valid date\n" +" return 1" +msgstr "" + +#: reference/lexical_analysis.rst:218 msgid "" "A line ending in a backslash cannot carry a comment. A backslash does not " "continue a comment. A backslash does not continue a token except for string " @@ -149,17 +345,25 @@ msgid "" "line outside a string literal." msgstr "" -#: reference/lexical_analysis.rst:138 +#: reference/lexical_analysis.rst:228 msgid "Implicit line joining" msgstr "" -#: reference/lexical_analysis.rst:140 +#: reference/lexical_analysis.rst:230 msgid "" "Expressions in parentheses, square brackets or curly braces can be split " "over more than one physical line without using backslashes. For example::" msgstr "" -#: reference/lexical_analysis.rst:148 +#: reference/lexical_analysis.rst:233 +msgid "" +"month_names = ['Januari', 'Februari', 'Maart', # These are the\n" +" 'April', 'Mei', 'Juni', # Dutch names\n" +" 'Juli', 'Augustus', 'September', # for the months\n" +" 'Oktober', 'November', 'December'] # of the year" +msgstr "" + +#: reference/lexical_analysis.rst:238 msgid "" "Implicitly continued lines can carry comments. The indentation of the " "continuation lines is not important. Blank continuation lines are allowed. " @@ -168,33 +372,33 @@ msgid "" "that case they cannot carry comments." msgstr "" -#: reference/lexical_analysis.rst:158 +#: reference/lexical_analysis.rst:248 msgid "Blank lines" msgstr "" -#: reference/lexical_analysis.rst:162 +#: reference/lexical_analysis.rst:252 msgid "" "A logical line that contains only spaces, tabs, formfeeds and possibly a " -"comment, is ignored (i.e., no NEWLINE token is generated). During " -"interactive input of statements, handling of a blank line may differ " -"depending on the implementation of the read-eval-print loop. In the " -"standard interactive interpreter, an entirely blank logical line (i.e. one " +"comment, is ignored (i.e., no :data:`~token.NEWLINE` token is generated). " +"During interactive input of statements, handling of a blank line may differ " +"depending on the implementation of the read-eval-print loop. In the standard " +"interactive interpreter, an entirely blank logical line (that is, one " "containing not even whitespace or a comment) terminates a multi-line " "statement." msgstr "" -#: reference/lexical_analysis.rst:173 +#: reference/lexical_analysis.rst:264 msgid "Indentation" msgstr "" -#: reference/lexical_analysis.rst:177 +#: reference/lexical_analysis.rst:268 msgid "" "Leading whitespace (spaces and tabs) at the beginning of a logical line is " "used to compute the indentation level of the line, which in turn is used to " "determine the grouping of statements." msgstr "" -#: reference/lexical_analysis.rst:181 +#: reference/lexical_analysis.rst:272 msgid "" "Tabs are replaced (from left to right) by one to eight spaces such that the " "total number of characters up to and including the replacement is a multiple " @@ -205,14 +409,14 @@ msgid "" "the indentation." msgstr "" -#: reference/lexical_analysis.rst:189 +#: reference/lexical_analysis.rst:280 msgid "" "Indentation is rejected as inconsistent if a source file mixes tabs and " "spaces in a way that makes the meaning dependent on the worth of a tab in " "spaces; a :exc:`TabError` is raised in that case." msgstr "" -#: reference/lexical_analysis.rst:193 +#: reference/lexical_analysis.rst:284 msgid "" "**Cross-platform compatibility note:** because of the nature of text editors " "on non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for " @@ -220,7 +424,7 @@ msgid "" "different platforms may explicitly limit the maximum indentation level." msgstr "" -#: reference/lexical_analysis.rst:198 +#: reference/lexical_analysis.rst:289 msgid "" "A formfeed character may be present at the start of the line; it will be " "ignored for the indentation calculations above. Formfeed characters " @@ -228,274 +432,277 @@ msgid "" "instance, they may reset the space count to zero)." msgstr "" -#: reference/lexical_analysis.rst:205 +#: reference/lexical_analysis.rst:296 msgid "" -"The indentation levels of consecutive lines are used to generate INDENT and " -"DEDENT tokens, using a stack, as follows." +"The indentation levels of consecutive lines are used to generate :data:" +"`~token.INDENT` and :data:`~token.DEDENT` tokens, using a stack, as follows." msgstr "" -#: reference/lexical_analysis.rst:208 +#: reference/lexical_analysis.rst:300 msgid "" "Before the first line of the file is read, a single zero is pushed on the " "stack; this will never be popped off again. The numbers pushed on the stack " "will always be strictly increasing from bottom to top. At the beginning of " "each logical line, the line's indentation level is compared to the top of " "the stack. If it is equal, nothing happens. If it is larger, it is pushed on " -"the stack, and one INDENT token is generated. If it is smaller, it *must* " -"be one of the numbers occurring on the stack; all numbers on the stack that " -"are larger are popped off, and for each number popped off a DEDENT token is " -"generated. At the end of the file, a DEDENT token is generated for each " -"number remaining on the stack that is larger than zero." +"the stack, and one :data:`!INDENT` token is generated. If it is smaller, it " +"*must* be one of the numbers occurring on the stack; all numbers on the " +"stack that are larger are popped off, and for each number popped off a :data:" +"`!DEDENT` token is generated. At the end of the file, a :data:`!DEDENT` " +"token is generated for each number remaining on the stack that is larger " +"than zero." msgstr "" -#: reference/lexical_analysis.rst:219 +#: reference/lexical_analysis.rst:311 msgid "" "Here is an example of a correctly (though confusingly) indented piece of " "Python code::" msgstr "" -#: reference/lexical_analysis.rst:234 +#: reference/lexical_analysis.rst:314 +msgid "" +"def perm(l):\n" +" # Compute the list of all permutations of l\n" +" if len(l) <= 1:\n" +" return [l]\n" +" r = []\n" +" for i in range(len(l)):\n" +" s = l[:i] + l[i+1:]\n" +" p = perm(s)\n" +" for x in p:\n" +" r.append(l[i:i+1] + x)\n" +" return r" +msgstr "" + +#: reference/lexical_analysis.rst:326 msgid "The following example shows various indentation errors::" msgstr "" -#: reference/lexical_analysis.rst:244 +#: reference/lexical_analysis.rst:328 +msgid "" +" def perm(l): # error: first line indented\n" +"for i in range(len(l)): # error: not indented\n" +" s = l[:i] + l[i+1:]\n" +" p = perm(l[:i] + l[i+1:]) # error: unexpected indent\n" +" for x in p:\n" +" r.append(l[i:i+1] + x)\n" +" return r # error: inconsistent dedent" +msgstr "" + +#: reference/lexical_analysis.rst:336 msgid "" "(Actually, the first three errors are detected by the parser; only the last " "error is found by the lexical analyzer --- the indentation of ``return r`` " "does not match a level popped off the stack.)" msgstr "" -#: reference/lexical_analysis.rst:252 +#: reference/lexical_analysis.rst:344 msgid "Whitespace between tokens" msgstr "" -#: reference/lexical_analysis.rst:254 +#: reference/lexical_analysis.rst:346 msgid "" "Except at the beginning of a logical line or in string literals, the " "whitespace characters space, tab and formfeed can be used interchangeably to " "separate tokens. Whitespace is needed between two tokens only if their " -"concatenation could otherwise be interpreted as a different token (e.g., ab " -"is one token, but a b is two tokens)." +"concatenation could otherwise be interpreted as a different token. For " +"example, ``ab`` is one token, but ``a b`` is two tokens. However, ``+a`` and " +"``+ a`` both produce two tokens, ``+`` and ``a``, as ``+a`` is not a valid " +"token." msgstr "" -#: reference/lexical_analysis.rst:264 -msgid "Other tokens" +#: reference/lexical_analysis.rst:357 +msgid "End marker" msgstr "" -#: reference/lexical_analysis.rst:266 +#: reference/lexical_analysis.rst:359 msgid "" -"Besides NEWLINE, INDENT and DEDENT, the following categories of tokens " -"exist: *identifiers*, *keywords*, *literals*, *operators*, and *delimiters*. " -"Whitespace characters (other than line terminators, discussed earlier) are " -"not tokens, but serve to delimit tokens. Where ambiguity exists, a token " -"comprises the longest possible string that forms a legal token, when read " -"from left to right." +"At the end of non-interactive input, the lexical analyzer generates an :data:" +"`~token.ENDMARKER` token." msgstr "" -#: reference/lexical_analysis.rst:276 -msgid "Identifiers and keywords" +#: reference/lexical_analysis.rst:366 +msgid "Other tokens" msgstr "" -#: reference/lexical_analysis.rst:280 +#: reference/lexical_analysis.rst:368 msgid "" -"Identifiers (also referred to as *names*) are described by the following " -"lexical definitions." +"Besides :data:`~token.NEWLINE`, :data:`~token.INDENT` and :data:`~token." +"DEDENT`, the following categories of tokens exist: *identifiers* and " +"*keywords* (:data:`~token.NAME`), *literals* (such as :data:`~token.NUMBER` " +"and :data:`~token.STRING`), and other symbols (*operators* and " +"*delimiters*, :data:`~token.OP`). Whitespace characters (other than logical " +"line terminators, discussed earlier) are not tokens, but serve to delimit " +"tokens. Where ambiguity exists, a token comprises the longest possible " +"string that forms a legal token, when read from left to right." msgstr "" -#: reference/lexical_analysis.rst:283 -msgid "" -"The syntax of identifiers in Python is based on the Unicode standard annex " -"UAX-31, with elaboration and changes as defined below; see also :pep:`3131` " -"for further details." +#: reference/lexical_analysis.rst:382 +msgid "Names (identifiers and keywords)" msgstr "" -#: reference/lexical_analysis.rst:287 -msgid "" -"Within the ASCII range (U+0001..U+007F), the valid characters for " -"identifiers are the same as in Python 2.x: the uppercase and lowercase " -"letters ``A`` through ``Z``, the underscore ``_`` and, except for the first " -"character, the digits ``0`` through ``9``." -msgstr "" - -#: reference/lexical_analysis.rst:292 +#: reference/lexical_analysis.rst:386 msgid "" -"Python 3.0 introduces additional characters from outside the ASCII range " -"(see :pep:`3131`). For these characters, the classification uses the " -"version of the Unicode Character Database as included in the :mod:" -"`unicodedata` module." -msgstr "" - -#: reference/lexical_analysis.rst:296 -msgid "Identifiers are unlimited in length. Case is significant." -msgstr "" - -#: reference/lexical_analysis.rst:305 -msgid "The Unicode category codes mentioned above stand for:" +":data:`~token.NAME` tokens represent *identifiers*, *keywords*, and *soft " +"keywords*." msgstr "" -#: reference/lexical_analysis.rst:307 -msgid "*Lu* - uppercase letters" +#: reference/lexical_analysis.rst:389 +msgid "Names are composed of the following characters:" msgstr "" -#: reference/lexical_analysis.rst:308 -msgid "*Ll* - lowercase letters" -msgstr "" - -#: reference/lexical_analysis.rst:309 -msgid "*Lt* - titlecase letters" +#: reference/lexical_analysis.rst:391 +msgid "uppercase and lowercase letters (``A-Z`` and ``a-z``)," msgstr "" -#: reference/lexical_analysis.rst:310 -msgid "*Lm* - modifier letters" +#: reference/lexical_analysis.rst:392 +msgid "the underscore (``_``)," msgstr "" -#: reference/lexical_analysis.rst:311 -msgid "*Lo* - other letters" +#: reference/lexical_analysis.rst:393 +msgid "" +"digits (``0`` through ``9``), which cannot appear as the first character, and" msgstr "" -#: reference/lexical_analysis.rst:312 -msgid "*Nl* - letter numbers" +#: reference/lexical_analysis.rst:394 +msgid "" +"non-ASCII characters. Valid names may only contain \"letter-like\" and " +"\"digit-like\" characters; see :ref:`lexical-names-nonascii` for details." msgstr "" -#: reference/lexical_analysis.rst:313 -msgid "*Mn* - nonspacing marks" +#: reference/lexical_analysis.rst:397 +msgid "" +"Names must contain at least one character, but have no upper length limit. " +"Case is significant." msgstr "" -#: reference/lexical_analysis.rst:314 -msgid "*Mc* - spacing combining marks" +#: reference/lexical_analysis.rst:400 +msgid "Formally, names are described by the following lexical definitions:" msgstr "" -#: reference/lexical_analysis.rst:315 -msgid "*Nd* - decimal numbers" +#: reference/lexical_analysis.rst:410 +msgid "" +"Note that not all names matched by this grammar are valid; see :ref:`lexical-" +"names-nonascii` for details." msgstr "" -#: reference/lexical_analysis.rst:316 -msgid "*Pc* - connector punctuations" +#: reference/lexical_analysis.rst:417 +msgid "Keywords" msgstr "" -#: reference/lexical_analysis.rst:317 +#: reference/lexical_analysis.rst:423 msgid "" -"*Other_ID_Start* - explicit list of characters in `PropList.txt `_ to support backwards " -"compatibility" -msgstr "" - -#: reference/lexical_analysis.rst:320 -msgid "*Other_ID_Continue* - likewise" +"The following names are used as reserved words, or *keywords* of the " +"language, and cannot be used as ordinary identifiers. They must be spelled " +"exactly as written here:" msgstr "" -#: reference/lexical_analysis.rst:322 +#: reference/lexical_analysis.rst:427 msgid "" -"All identifiers are converted into the normal form NFKC while parsing; " -"comparison of identifiers is based on NFKC." +"False await else import pass\n" +"None break except in raise\n" +"True class finally is return\n" +"and continue for lambda try\n" +"as def from nonlocal while\n" +"assert del global not with\n" +"async elif if or yield" msgstr "" -#: reference/lexical_analysis.rst:325 -msgid "" -"A non-normative HTML file listing all valid identifier characters for " -"Unicode 15.0.0 can be found at https://www.unicode.org/Public/15.0.0/ucd/" -"DerivedCoreProperties.txt" +#: reference/lexical_analysis.rst:441 +msgid "Soft Keywords" msgstr "" -#: reference/lexical_analysis.rst:333 -msgid "Keywords" +#: reference/lexical_analysis.rst:447 +msgid "" +"Some names are only reserved under specific contexts. These are known as " +"*soft keywords*:" msgstr "" -#: reference/lexical_analysis.rst:339 +#: reference/lexical_analysis.rst:450 msgid "" -"The following identifiers are used as reserved words, or *keywords* of the " -"language, and cannot be used as ordinary identifiers. They must be spelled " -"exactly as written here:" +"``match``, ``case``, and ``_``, when used in the :keyword:`match` statement." msgstr "" -#: reference/lexical_analysis.rst:357 -msgid "Soft Keywords" +#: reference/lexical_analysis.rst:451 +msgid "``type``, when used in the :keyword:`type` statement." msgstr "" -#: reference/lexical_analysis.rst:363 +#: reference/lexical_analysis.rst:453 msgid "" -"Some identifiers are only reserved under specific contexts. These are known " -"as *soft keywords*. The identifiers ``match``, ``case``, ``type`` and ``_`` " -"can syntactically act as keywords in certain contexts, but this distinction " -"is done at the parser level, not when tokenizing." +"These syntactically act as keywords in their specific contexts, but this " +"distinction is done at the parser level, not when tokenizing." msgstr "" -#: reference/lexical_analysis.rst:368 +#: reference/lexical_analysis.rst:456 msgid "" "As soft keywords, their use in the grammar is possible while still " "preserving compatibility with existing code that uses these names as " "identifier names." msgstr "" -#: reference/lexical_analysis.rst:372 -msgid "" -"``match``, ``case``, and ``_`` are used in the :keyword:`match` statement. " -"``type`` is used in the :keyword:`type` statement." -msgstr "" - -#: reference/lexical_analysis.rst:375 +#: reference/lexical_analysis.rst:460 msgid "``type`` is now a soft keyword." msgstr "" -#: reference/lexical_analysis.rst:384 +#: reference/lexical_analysis.rst:469 msgid "Reserved classes of identifiers" msgstr "" -#: reference/lexical_analysis.rst:386 +#: reference/lexical_analysis.rst:471 msgid "" "Certain classes of identifiers (besides keywords) have special meanings. " "These classes are identified by the patterns of leading and trailing " "underscore characters:" msgstr "" -#: reference/lexical_analysis.rst:391 +#: reference/lexical_analysis.rst:475 msgid "``_*``" msgstr "" -#: reference/lexical_analysis.rst:391 +#: reference/lexical_analysis.rst:476 msgid "Not imported by ``from module import *``." msgstr "" -#: reference/lexical_analysis.rst:412 +#: reference/lexical_analysis.rst:478 msgid "``_``" msgstr "" -#: reference/lexical_analysis.rst:394 +#: reference/lexical_analysis.rst:479 msgid "" "In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" "`soft keyword ` that denotes a :ref:`wildcard `." msgstr "" -#: reference/lexical_analysis.rst:398 +#: reference/lexical_analysis.rst:483 msgid "" "Separately, the interactive interpreter makes the result of the last " "evaluation available in the variable ``_``. (It is stored in the :mod:" "`builtins` module, alongside built-in functions like ``print``.)" msgstr "" -#: reference/lexical_analysis.rst:403 +#: reference/lexical_analysis.rst:488 msgid "" "Elsewhere, ``_`` is a regular identifier. It is often used to name " "\"special\" items, but it is not special to Python itself." msgstr "" -#: reference/lexical_analysis.rst:408 +#: reference/lexical_analysis.rst:493 msgid "" "The name ``_`` is often used in conjunction with internationalization; refer " "to the documentation for the :mod:`gettext` module for more information on " "this convention." msgstr "" -#: reference/lexical_analysis.rst:412 +#: reference/lexical_analysis.rst:497 msgid "It is also commonly used for unused variables." msgstr "" -#: reference/lexical_analysis.rst:420 +#: reference/lexical_analysis.rst:499 msgid "``__*__``" msgstr "" -#: reference/lexical_analysis.rst:415 +#: reference/lexical_analysis.rst:500 msgid "" "System-defined names, informally known as \"dunder\" names. These names are " "defined by the interpreter and its implementation (including the standard " @@ -505,11 +712,11 @@ msgid "" "explicitly documented use, is subject to breakage without warning." msgstr "" -#: reference/lexical_analysis.rst:427 +#: reference/lexical_analysis.rst:507 msgid "``__*``" msgstr "" -#: reference/lexical_analysis.rst:423 +#: reference/lexical_analysis.rst:508 msgid "" "Class-private names. Names in this category, when used within the context " "of a class definition, are re-written to use a mangled form to help avoid " @@ -517,349 +724,749 @@ msgid "" "section :ref:`atom-identifiers`." msgstr "" -#: reference/lexical_analysis.rst:432 +#: reference/lexical_analysis.rst:517 +msgid "Non-ASCII characters in names" +msgstr "" + +#: reference/lexical_analysis.rst:519 +msgid "" +"Names that contain non-ASCII characters need additional normalization and " +"validation beyond the rules and grammar explained :ref:`above " +"`. For example, ``ř_1``, ``蛇``, or ``साँप`` are valid names, " +"but ``r〰2``, ``€``, or ``🐍`` are not." +msgstr "" + +#: reference/lexical_analysis.rst:525 +msgid "This section explains the exact rules." +msgstr "" + +#: reference/lexical_analysis.rst:527 +msgid "" +"All names are converted into the `normalization form`_ NFKC while parsing. " +"This means that, for example, some typographic variants of characters are " +"converted to their \"basic\" form. For example, ``fiⁿₐˡᵢᶻₐᵗᵢᵒₙ`` normalizes " +"to ``finalization``, so Python treats them as the same name::" +msgstr "" + +#: reference/lexical_analysis.rst:532 +msgid "" +">>> fiⁿₐˡᵢᶻₐᵗᵢᵒₙ = 3\n" +">>> finalization\n" +"3" +msgstr "" + +#: reference/lexical_analysis.rst:538 +msgid "" +"Normalization is done at the lexical level only. Run-time functions that " +"take names as *strings* generally do not normalize their arguments. For " +"example, the variable defined above is accessible at run time in the :func:" +"`globals` dictionary as ``globals()[\"finalization\"]`` but not ``globals()" +"[\"fiⁿₐˡᵢᶻₐᵗᵢᵒₙ\"]``." +msgstr "" + +#: reference/lexical_analysis.rst:545 +msgid "" +"Similarly to how ASCII-only names must contain only letters, digits and the " +"underscore, and cannot start with a digit, a valid name must start with a " +"character in the \"letter-like\" set ``xid_start``, and the remaining " +"characters must be in the \"letter- and digit-like\" set ``xid_continue``." +msgstr "" + +#: reference/lexical_analysis.rst:551 +msgid "" +"These sets based on the *XID_Start* and *XID_Continue* sets as defined by " +"the Unicode standard annex `UAX-31`_. Python's ``xid_start`` additionally " +"includes the underscore (``_``). Note that Python does not necessarily " +"conform to `UAX-31`_." +msgstr "" + +#: reference/lexical_analysis.rst:556 +msgid "" +"A non-normative listing of characters in the *XID_Start* and *XID_Continue* " +"sets as defined by Unicode is available in the `DerivedCoreProperties.txt`_ " +"file in the Unicode Character Database. For reference, the construction " +"rules for the ``xid_*`` sets are given below." +msgstr "" + +#: reference/lexical_analysis.rst:561 +msgid "The set ``id_start`` is defined as the union of:" +msgstr "" + +#: reference/lexical_analysis.rst:563 +msgid "Unicode category ```` - uppercase letters (includes ``A`` to ``Z``)" +msgstr "" + +#: reference/lexical_analysis.rst:564 +msgid "Unicode category ```` - lowercase letters (includes ``a`` to ``z``)" +msgstr "" + +#: reference/lexical_analysis.rst:565 +msgid "Unicode category ```` - titlecase letters" +msgstr "" + +#: reference/lexical_analysis.rst:566 +msgid "Unicode category ```` - modifier letters" +msgstr "" + +#: reference/lexical_analysis.rst:567 +msgid "Unicode category ```` - other letters" +msgstr "" + +#: reference/lexical_analysis.rst:568 +msgid "Unicode category ```` - letter numbers" +msgstr "" + +#: reference/lexical_analysis.rst:569 +msgid "{``\"_\"``} - the underscore" +msgstr "" + +#: reference/lexical_analysis.rst:570 +msgid "" +"```` - an explicit set of characters in `PropList.txt`_ to " +"support backwards compatibility" +msgstr "" + +#: reference/lexical_analysis.rst:573 +msgid "" +"The set ``xid_start`` then closes this set under NFKC normalization, by " +"removing all characters whose normalization is not of the form ``id_start " +"id_continue*``." +msgstr "" + +#: reference/lexical_analysis.rst:577 +msgid "The set ``id_continue`` is defined as the union of:" +msgstr "" + +#: reference/lexical_analysis.rst:579 +msgid "``id_start`` (see above)" +msgstr "" + +#: reference/lexical_analysis.rst:580 +msgid "Unicode category ```` - decimal numbers (includes ``0`` to ``9``)" +msgstr "" + +#: reference/lexical_analysis.rst:581 +msgid "Unicode category ```` - connector punctuations" +msgstr "" + +#: reference/lexical_analysis.rst:582 +msgid "Unicode category ```` - nonspacing marks" +msgstr "" + +#: reference/lexical_analysis.rst:583 +msgid "Unicode category ```` - spacing combining marks" +msgstr "" + +#: reference/lexical_analysis.rst:584 +msgid "" +"```` - another explicit set of characters in `PropList." +"txt`_ to support backwards compatibility" +msgstr "" + +#: reference/lexical_analysis.rst:587 +msgid "Again, ``xid_continue`` closes this set under NFKC normalization." +msgstr "" + +#: reference/lexical_analysis.rst:589 +msgid "" +"Unicode categories use the version of the Unicode Character Database as " +"included in the :mod:`unicodedata` module." +msgstr "" + +#: reference/lexical_analysis.rst:599 +msgid ":pep:`3131` -- Supporting Non-ASCII Identifiers" +msgstr "" + +#: reference/lexical_analysis.rst:600 +msgid ":pep:`672` -- Unicode-related Security Considerations for Python" +msgstr "" + +#: reference/lexical_analysis.rst:606 msgid "Literals" msgstr "" -#: reference/lexical_analysis.rst:436 +#: reference/lexical_analysis.rst:610 msgid "Literals are notations for constant values of some built-in types." msgstr "" -#: reference/lexical_analysis.rst:447 +#: reference/lexical_analysis.rst:612 +msgid "" +"In terms of lexical analysis, Python has :ref:`string, bytes ` and :" +"ref:`numeric ` literals." +msgstr "" + +#: reference/lexical_analysis.rst:615 +msgid "" +"Other \"literals\" are lexically denoted using :ref:`keywords ` " +"(``None``, ``True``, ``False``) and the special :ref:`ellipsis token " +"` (``...``)." +msgstr "" + +#: reference/lexical_analysis.rst:626 msgid "String and Bytes literals" msgstr "" -#: reference/lexical_analysis.rst:449 -msgid "String literals are described by the following lexical definitions:" +#: reference/lexical_analysis.rst:628 +msgid "" +"String literals are text enclosed in single quotes (``'``) or double quotes " +"(``\"``). For example:" msgstr "" -#: reference/lexical_analysis.rst:474 +#: reference/lexical_analysis.rst:631 msgid "" -"One syntactic restriction not indicated by these productions is that " -"whitespace is not allowed between the :token:`~python-grammar:stringprefix` " -"or :token:`~python-grammar:bytesprefix` and the rest of the literal. The " -"source character set is defined by the encoding declaration; it is UTF-8 if " -"no encoding declaration is given in the source file; see section :ref:" -"`encodings`." +"\"spam\"\n" +"'eggs'" msgstr "" -#: reference/lexical_analysis.rst:484 +#: reference/lexical_analysis.rst:636 msgid "" -"In plain English: Both types of literals can be enclosed in matching single " -"quotes (``'``) or double quotes (``\"``). They can also be enclosed in " -"matching groups of three single or double quotes (these are generally " -"referred to as *triple-quoted strings*). The backslash (``\\``) character is " -"used to give special meaning to otherwise ordinary characters like ``n``, " -"which means 'newline' when escaped (``\\n``). It can also be used to escape " -"characters that otherwise have a special meaning, such as newline, backslash " -"itself, or the quote character. See :ref:`escape sequences ` below for examples." +"The quote used to start the literal also terminates it, so a string literal " +"can only contain the other quote (except with escape sequences, see below). " +"For example:" msgstr "" -#: reference/lexical_analysis.rst:497 +#: reference/lexical_analysis.rst:640 msgid "" -"Bytes literals are always prefixed with ``'b'`` or ``'B'``; they produce an " -"instance of the :class:`bytes` type instead of the :class:`str` type. They " -"may only contain ASCII characters; bytes with a numeric value of 128 or " -"greater must be expressed with escapes." +"'Say \"Hello\", please.'\n" +"\"Don't do that!\"" msgstr "" -#: reference/lexical_analysis.rst:506 +#: reference/lexical_analysis.rst:645 msgid "" -"Both string and bytes literals may optionally be prefixed with a letter " -"``'r'`` or ``'R'``; such strings are called :dfn:`raw strings` and treat " -"backslashes as literal characters. As a result, in string literals, " -"``'\\U'`` and ``'\\u'`` escapes in raw strings are not treated specially. " -"Given that Python 2.x's raw unicode literals behave differently than Python " -"3.x's the ``'ur'`` syntax is not supported." +"Except for this limitation, the choice of quote character (``'`` or ``\"``) " +"does not affect how the literal is parsed." +msgstr "" + +#: reference/lexical_analysis.rst:648 +msgid "" +"Inside a string literal, the backslash (``\\``) character introduces an :dfn:" +"`escape sequence`, which has special meaning depending on the character " +"after the backslash. For example, ``\\\"`` denotes the double quote " +"character, and does *not* end the string:" msgstr "" -#: reference/lexical_analysis.rst:513 +#: reference/lexical_analysis.rst:654 +msgid "" +">>> print(\"Say \\\"Hello\\\" to everyone!\")\n" +"Say \"Hello\" to everyone!" +msgstr "" + +#: reference/lexical_analysis.rst:659 +msgid "" +"See :ref:`escape sequences ` below for a full list of such " +"sequences, and more details." +msgstr "" + +#: reference/lexical_analysis.rst:668 +msgid "Triple-quoted strings" +msgstr "" + +#: reference/lexical_analysis.rst:670 +msgid "" +"Strings can also be enclosed in matching groups of three single or double " +"quotes. These are generally referred to as :dfn:`triple-quoted strings`::" +msgstr "" + +#: reference/lexical_analysis.rst:674 +msgid "\"\"\"This is a triple-quoted string.\"\"\"" +msgstr "" + +#: reference/lexical_analysis.rst:676 +msgid "" +"In triple-quoted literals, unescaped quotes are allowed (and are retained), " +"except that three unescaped quotes in a row terminate the literal, if they " +"are of the same kind (``'`` or ``\"``) used at the start::" +msgstr "" + +#: reference/lexical_analysis.rst:680 +msgid "\"\"\"This string has \"quotes\" inside.\"\"\"" +msgstr "" + +#: reference/lexical_analysis.rst:682 +msgid "Unescaped newlines are also allowed and retained::" +msgstr "" + +#: reference/lexical_analysis.rst:684 +msgid "" +"'''This triple-quoted string\n" +"continues on the next line.'''" +msgstr "" + +#: reference/lexical_analysis.rst:693 +msgid "String prefixes" +msgstr "" + +#: reference/lexical_analysis.rst:695 +msgid "" +"String literals can have an optional :dfn:`prefix` that influences how the " +"content of the literal is parsed, for example:" +msgstr "" + +#: reference/lexical_analysis.rst:698 +msgid "" +"b\"data\"\n" +"f'{result=}'" +msgstr "" + +#: reference/lexical_analysis.rst:703 +msgid "The allowed prefixes are:" +msgstr "" + +#: reference/lexical_analysis.rst:705 +msgid "``b``: :ref:`Bytes literal `" +msgstr "" + +#: reference/lexical_analysis.rst:706 +msgid "``r``: :ref:`Raw string `" +msgstr "" + +#: reference/lexical_analysis.rst:707 +msgid "``f``: :ref:`Formatted string literal ` (\"f-string\")" +msgstr "" + +#: reference/lexical_analysis.rst:708 +msgid "``t``: :ref:`Template string literal ` (\"t-string\")" +msgstr "" + +#: reference/lexical_analysis.rst:709 +msgid "``u``: No effect (allowed for backwards compatibility)" +msgstr "" + +#: reference/lexical_analysis.rst:711 +msgid "See the linked sections for details on each type." +msgstr "" + +#: reference/lexical_analysis.rst:713 +msgid "" +"Prefixes are case-insensitive (for example, '``B``' works the same as " +"'``b``'). The '``r``' prefix can be combined with '``f``', '``t``' or " +"'``b``', so '``fr``', '``rf``', '``tr``', '``rt``', '``br``', and '``rb``' " +"are also valid prefixes." +msgstr "" + +#: reference/lexical_analysis.rst:717 msgid "" "The ``'rb'`` prefix of raw bytes literals has been added as a synonym of " "``'br'``." msgstr "" -#: reference/lexical_analysis.rst:517 +#: reference/lexical_analysis.rst:721 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " "simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" "`414` for more information." msgstr "" -#: reference/lexical_analysis.rst:525 +#: reference/lexical_analysis.rst:727 +msgid "Formal grammar" +msgstr "" + +#: reference/lexical_analysis.rst:729 +msgid "" +"String literals, except :ref:`\"f-strings\" ` and :ref:`\"t-" +"strings\" `, are described by the following lexical definitions." +msgstr "" + +#: reference/lexical_analysis.rst:733 msgid "" -"A string literal with ``'f'`` or ``'F'`` in its prefix is a :dfn:`formatted " -"string literal`; see :ref:`f-strings`. The ``'f'`` may be combined with " -"``'r'``, but not with ``'b'`` or ``'u'``, therefore raw formatted strings " -"are possible, but formatted bytes literals are not." +"These definitions use :ref:`negative lookaheads ` (``!" +"``) to indicate that an ending quote ends the literal." msgstr "" -#: reference/lexical_analysis.rst:530 +#: reference/lexical_analysis.rst:751 msgid "" -"In triple-quoted literals, unescaped newlines and quotes are allowed (and " -"are retained), except that three unescaped quotes in a row terminate the " -"literal. (A \"quote\" is the character used to open the literal, i.e. " -"either ``'`` or ``\"``.)" +"Note that as in all lexical definitions, whitespace is significant. In " +"particular, the prefix (if any) must be immediately followed by the starting " +"quote." msgstr "" -#: reference/lexical_analysis.rst:553 +#: reference/lexical_analysis.rst:773 msgid "Escape sequences" msgstr "" -#: reference/lexical_analysis.rst:555 +#: reference/lexical_analysis.rst:775 msgid "" -"Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string " +"Unless an '``r``' or '``R``' prefix is present, escape sequences in string " "and bytes literals are interpreted according to rules similar to those used " "by Standard C. The recognized escape sequences are:" msgstr "" -#: reference/lexical_analysis.rst:560 reference/lexical_analysis.rst:593 +#: reference/lexical_analysis.rst:783 msgid "Escape Sequence" msgstr "" -#: reference/lexical_analysis.rst:560 reference/lexical_analysis.rst:593 +#: reference/lexical_analysis.rst:784 msgid "Meaning" msgstr "" -#: reference/lexical_analysis.rst:560 reference/lexical_analysis.rst:593 -msgid "Notes" -msgstr "" - -#: reference/lexical_analysis.rst:562 +#: reference/lexical_analysis.rst:785 msgid "``\\``\\ " msgstr "" -#: reference/lexical_analysis.rst:562 -msgid "Backslash and newline ignored" -msgstr "" - -#: reference/lexical_analysis.rst:562 -msgid "\\(1)" +#: reference/lexical_analysis.rst:786 +msgid ":ref:`string-escape-ignore`" msgstr "" -#: reference/lexical_analysis.rst:564 +#: reference/lexical_analysis.rst:787 msgid "``\\\\``" msgstr "" -#: reference/lexical_analysis.rst:564 -msgid "Backslash (``\\``)" +#: reference/lexical_analysis.rst:788 +msgid ":ref:`Backslash `" msgstr "" -#: reference/lexical_analysis.rst:566 +#: reference/lexical_analysis.rst:789 msgid "``\\'``" msgstr "" -#: reference/lexical_analysis.rst:566 -msgid "Single quote (``'``)" +#: reference/lexical_analysis.rst:790 +msgid ":ref:`Single quote `" msgstr "" -#: reference/lexical_analysis.rst:568 +#: reference/lexical_analysis.rst:791 msgid "``\\\"``" msgstr "" -#: reference/lexical_analysis.rst:568 -msgid "Double quote (``\"``)" +#: reference/lexical_analysis.rst:792 +msgid ":ref:`Double quote `" msgstr "" -#: reference/lexical_analysis.rst:570 +#: reference/lexical_analysis.rst:793 msgid "``\\a``" msgstr "" -#: reference/lexical_analysis.rst:570 +#: reference/lexical_analysis.rst:794 msgid "ASCII Bell (BEL)" msgstr "" -#: reference/lexical_analysis.rst:572 +#: reference/lexical_analysis.rst:795 msgid "``\\b``" msgstr "" -#: reference/lexical_analysis.rst:572 +#: reference/lexical_analysis.rst:796 msgid "ASCII Backspace (BS)" msgstr "" -#: reference/lexical_analysis.rst:574 +#: reference/lexical_analysis.rst:797 msgid "``\\f``" msgstr "" -#: reference/lexical_analysis.rst:574 +#: reference/lexical_analysis.rst:798 msgid "ASCII Formfeed (FF)" msgstr "" -#: reference/lexical_analysis.rst:576 +#: reference/lexical_analysis.rst:799 msgid "``\\n``" msgstr "" -#: reference/lexical_analysis.rst:576 +#: reference/lexical_analysis.rst:800 msgid "ASCII Linefeed (LF)" msgstr "" -#: reference/lexical_analysis.rst:578 +#: reference/lexical_analysis.rst:801 msgid "``\\r``" msgstr "" -#: reference/lexical_analysis.rst:578 +#: reference/lexical_analysis.rst:802 msgid "ASCII Carriage Return (CR)" msgstr "" -#: reference/lexical_analysis.rst:580 +#: reference/lexical_analysis.rst:803 msgid "``\\t``" msgstr "" -#: reference/lexical_analysis.rst:580 +#: reference/lexical_analysis.rst:804 msgid "ASCII Horizontal Tab (TAB)" msgstr "" -#: reference/lexical_analysis.rst:582 +#: reference/lexical_analysis.rst:805 msgid "``\\v``" msgstr "" -#: reference/lexical_analysis.rst:582 +#: reference/lexical_analysis.rst:806 msgid "ASCII Vertical Tab (VT)" msgstr "" -#: reference/lexical_analysis.rst:584 +#: reference/lexical_analysis.rst:807 msgid ":samp:`\\\\\\\\{ooo}`" msgstr "" -#: reference/lexical_analysis.rst:584 -msgid "Character with octal value *ooo*" +#: reference/lexical_analysis.rst:808 +msgid ":ref:`string-escape-oct`" msgstr "" -#: reference/lexical_analysis.rst:584 -msgid "(2,4)" +#: reference/lexical_analysis.rst:809 +msgid ":samp:`\\\\x{hh}`" msgstr "" -#: reference/lexical_analysis.rst:587 -msgid ":samp:`\\\\x{hh}`" +#: reference/lexical_analysis.rst:810 +msgid ":ref:`string-escape-hex`" msgstr "" -#: reference/lexical_analysis.rst:587 -msgid "Character with hex value *hh*" +#: reference/lexical_analysis.rst:811 +msgid ":samp:`\\\\N\\\\{{name}\\\\}`" msgstr "" -#: reference/lexical_analysis.rst:587 -msgid "(3,4)" +#: reference/lexical_analysis.rst:812 +msgid ":ref:`string-escape-named`" msgstr "" -#: reference/lexical_analysis.rst:590 -msgid "Escape sequences only recognized in string literals are:" +#: reference/lexical_analysis.rst:813 +msgid ":samp:`\\\\u{xxxx}`" msgstr "" -#: reference/lexical_analysis.rst:595 -msgid ":samp:`\\\\N\\\\{{name}\\\\}`" +#: reference/lexical_analysis.rst:814 reference/lexical_analysis.rst:816 +msgid ":ref:`Hexadecimal Unicode character `" msgstr "" -#: reference/lexical_analysis.rst:595 -msgid "Character named *name* in the Unicode database" +#: reference/lexical_analysis.rst:815 +msgid ":samp:`\\\\U{xxxxxxxx}`" msgstr "" -#: reference/lexical_analysis.rst:595 -msgid "\\(5)" +#: reference/lexical_analysis.rst:821 +msgid "Ignored end of line" msgstr "" -#: reference/lexical_analysis.rst:598 -msgid ":samp:`\\\\u{xxxx}`" +#: reference/lexical_analysis.rst:823 +msgid "A backslash can be added at the end of a line to ignore the newline::" msgstr "" -#: reference/lexical_analysis.rst:598 -msgid "Character with 16-bit hex value *xxxx*" +#: reference/lexical_analysis.rst:825 +msgid "" +">>> 'This string will not include \\\n" +"... backslashes or newline characters.'\n" +"'This string will not include backslashes or newline characters.'" msgstr "" -#: reference/lexical_analysis.rst:598 -msgid "\\(6)" +#: reference/lexical_analysis.rst:829 +msgid "" +"The same result can be achieved using :ref:`triple-quoted strings " +"`, or parentheses and :ref:`string literal concatenation `." msgstr "" -#: reference/lexical_analysis.rst:601 -msgid ":samp:`\\\\U{xxxxxxxx}`" +#: reference/lexical_analysis.rst:835 +msgid "Escaped characters" msgstr "" -#: reference/lexical_analysis.rst:601 -msgid "Character with 32-bit hex value *xxxxxxxx*" +#: reference/lexical_analysis.rst:837 +msgid "" +"To include a backslash in a non-:ref:`raw ` Python string " +"literal, it must be doubled. The ``\\\\`` escape sequence denotes a single " +"backslash character::" msgstr "" -#: reference/lexical_analysis.rst:601 -msgid "\\(7)" +#: reference/lexical_analysis.rst:841 +msgid "" +">>> print('C:\\\\Program Files')\n" +"C:\\Program Files" msgstr "" -#: reference/lexical_analysis.rst:605 -msgid "Notes:" +#: reference/lexical_analysis.rst:844 +msgid "" +"Similarly, the ``\\'`` and ``\\\"`` sequences denote the single and double " +"quote character, respectively::" msgstr "" -#: reference/lexical_analysis.rst:608 -msgid "A backslash can be added at the end of a line to ignore the newline::" +#: reference/lexical_analysis.rst:847 +msgid "" +">>> print('\\' and \\\"')\n" +"' and \"" +msgstr "" + +#: reference/lexical_analysis.rst:853 +msgid "Octal character" msgstr "" -#: reference/lexical_analysis.rst:614 +#: reference/lexical_analysis.rst:855 msgid "" -"The same result can be achieved using :ref:`triple-quoted strings " -"`, or parentheses and :ref:`string literal concatenation `." +"The sequence :samp:`\\\\\\\\{ooo}` denotes a *character* with the octal " +"(base 8) value *ooo*::" msgstr "" -#: reference/lexical_analysis.rst:619 -msgid "As in Standard C, up to three octal digits are accepted." +#: reference/lexical_analysis.rst:858 +msgid "" +">>> '\\120'\n" +"'P'" +msgstr "" + +#: reference/lexical_analysis.rst:861 +msgid "Up to three octal digits (0 through 7) are accepted." msgstr "" -#: reference/lexical_analysis.rst:621 +#: reference/lexical_analysis.rst:863 reference/lexical_analysis.rst:888 msgid "" -"Octal escapes with value larger than ``0o377`` produce a :exc:" +"In a bytes literal, *character* means a *byte* with the given value. In a " +"string literal, it means a Unicode character with the given value." +msgstr "" + +#: reference/lexical_analysis.rst:866 +msgid "" +"Octal escapes with value larger than ``0o377`` (255) produce a :exc:" "`DeprecationWarning`." msgstr "" -#: reference/lexical_analysis.rst:625 +#: reference/lexical_analysis.rst:870 msgid "" -"Octal escapes with value larger than ``0o377`` produce a :exc:" -"`SyntaxWarning`. In a future Python version they will be eventually a :exc:" +"Octal escapes with value larger than ``0o377`` (255) produce a :exc:" +"`SyntaxWarning`. In a future Python version they will raise a :exc:" "`SyntaxError`." msgstr "" -#: reference/lexical_analysis.rst:631 +#: reference/lexical_analysis.rst:878 +msgid "Hexadecimal character" +msgstr "" + +#: reference/lexical_analysis.rst:880 +msgid "" +"The sequence :samp:`\\\\x{hh}` denotes a *character* with the hex (base 16) " +"value *hh*::" +msgstr "" + +#: reference/lexical_analysis.rst:883 +msgid "" +">>> '\\x50'\n" +"'P'" +msgstr "" + +#: reference/lexical_analysis.rst:886 msgid "Unlike in Standard C, exactly two hex digits are required." msgstr "" -#: reference/lexical_analysis.rst:634 +#: reference/lexical_analysis.rst:894 +msgid "Named Unicode character" +msgstr "" + +#: reference/lexical_analysis.rst:896 +msgid "" +"The sequence :samp:`\\\\N\\\\{{name}\\\\}` denotes a Unicode character with " +"the given *name*::" +msgstr "" + +#: reference/lexical_analysis.rst:899 +msgid "" +">>> '\\N{LATIN CAPITAL LETTER P}'\n" +"'P'\n" +">>> '\\N{SNAKE}'\n" +"'🐍'" +msgstr "" + +#: reference/lexical_analysis.rst:904 +msgid "This sequence cannot appear in :ref:`bytes literals `." +msgstr "" + +#: reference/lexical_analysis.rst:906 +msgid "" +"Support for `name aliases `__ has been added." +msgstr "" + +#: reference/lexical_analysis.rst:913 +msgid "Hexadecimal Unicode characters" +msgstr "" + +#: reference/lexical_analysis.rst:915 +msgid "" +"These sequences :samp:`\\\\u{xxxx}` and :samp:`\\\\U{xxxxxxxx}` denote the " +"Unicode character with the given hex (base 16) value. Exactly four digits " +"are required for ``\\u``; exactly eight digits are required for ``\\U``. The " +"latter can encode any Unicode character." +msgstr "" + +#: reference/lexical_analysis.rst:921 +msgid "" +">>> '\\u1234'\n" +"'ሴ'\n" +">>> '\\U0001f40d'\n" +"'🐍'" +msgstr "" + +#: reference/lexical_analysis.rst:928 +msgid "These sequences cannot appear in :ref:`bytes literals `." +msgstr "" + +#: reference/lexical_analysis.rst:934 +msgid "Unrecognized escape sequences" +msgstr "" + +#: reference/lexical_analysis.rst:936 +msgid "" +"Unlike in Standard C, all unrecognized escape sequences are left in the " +"string unchanged, that is, *the backslash is left in the result*::" +msgstr "" + +#: reference/lexical_analysis.rst:939 +msgid "" +">>> print('\\q')\n" +"\\q\n" +">>> list('\\q')\n" +"['\\\\', 'q']" +msgstr "" + +#: reference/lexical_analysis.rst:944 +msgid "" +"Note that for bytes literals, the escape sequences only recognized in string " +"literals (``\\N...``, ``\\u...``, ``\\U...``) fall into the category of " +"unrecognized escapes." +msgstr "" + +#: reference/lexical_analysis.rst:948 +msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." +msgstr "" + +#: reference/lexical_analysis.rst:951 msgid "" -"In a bytes literal, hexadecimal and octal escapes denote the byte with the " -"given value. In a string literal, these escapes denote a Unicode character " -"with the given value." +"Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future " +"Python version they will raise a :exc:`SyntaxError`." msgstr "" -#: reference/lexical_analysis.rst:639 -msgid "Support for name aliases [#]_ has been added." +#: reference/lexical_analysis.rst:964 +msgid "Bytes literals" msgstr "" -#: reference/lexical_analysis.rst:643 -msgid "Exactly four hex digits are required." +#: reference/lexical_analysis.rst:966 +msgid "" +":dfn:`Bytes literals` are always prefixed with '``b``' or '``B``'; they " +"produce an instance of the :class:`bytes` type instead of the :class:`str` " +"type. They may only contain ASCII characters; bytes with a numeric value of " +"128 or greater must be expressed with escape sequences (typically :ref:" +"`string-escape-hex` or :ref:`string-escape-oct`):" msgstr "" -#: reference/lexical_analysis.rst:646 +#: reference/lexical_analysis.rst:972 msgid "" -"Any Unicode character can be encoded this way. Exactly eight hex digits are " -"required." +">>> b'\\x89PNG\\r\\n\\x1a\\n'\n" +"b'\\x89PNG\\r\\n\\x1a\\n'\n" +">>> list(b'\\x89PNG\\r\\n\\x1a\\n')\n" +"[137, 80, 78, 71, 13, 10, 26, 10]" msgstr "" -#: reference/lexical_analysis.rst:652 +#: reference/lexical_analysis.rst:979 msgid "" -"Unlike Standard C, all unrecognized escape sequences are left in the string " -"unchanged, i.e., *the backslash is left in the result*. (This behavior is " -"useful when debugging: if an escape sequence is mistyped, the resulting " -"output is more easily recognized as broken.) It is also important to note " -"that the escape sequences only recognized in string literals fall into the " -"category of unrecognized escapes for bytes literals." +"Similarly, a zero byte must be expressed using an escape sequence (typically " +"``\\0`` or ``\\x00``)." msgstr "" -#: reference/lexical_analysis.rst:659 -msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." +#: reference/lexical_analysis.rst:990 +msgid "Raw string literals" msgstr "" -#: reference/lexical_analysis.rst:662 +#: reference/lexical_analysis.rst:992 msgid "" -"Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future " -"Python version they will be eventually a :exc:`SyntaxError`." +"Both string and bytes literals may optionally be prefixed with a letter " +"'``r``' or '``R``'; such constructs are called :dfn:`raw string literals` " +"and :dfn:`raw bytes literals` respectively and treat backslashes as literal " +"characters. As a result, in raw string literals, :ref:`escape sequences " +"` are not treated specially:" +msgstr "" + +#: reference/lexical_analysis.rst:999 +msgid "" +">>> r'\\d{4}-\\d{2}-\\d{2}'\n" +"'\\\\d{4}-\\\\d{2}-\\\\d{2}'" msgstr "" -#: reference/lexical_analysis.rst:666 +#: reference/lexical_analysis.rst:1004 msgid "" "Even in a raw literal, quotes can be escaped with a backslash, but the " "backslash remains in the result; for example, ``r\"\\\"\"`` is a valid " @@ -872,51 +1479,27 @@ msgid "" "continuation." msgstr "" -#: reference/lexical_analysis.rst:679 -msgid "String literal concatenation" -msgstr "" - -#: reference/lexical_analysis.rst:681 -msgid "" -"Multiple adjacent string or bytes literals (delimited by whitespace), " -"possibly using different quoting conventions, are allowed, and their meaning " -"is the same as their concatenation. Thus, ``\"hello\" 'world'`` is " -"equivalent to ``\"helloworld\"``. This feature can be used to reduce the " -"number of backslashes needed, to split long strings conveniently across long " -"lines, or even to add comments to parts of strings, for example::" -msgstr "" - -#: reference/lexical_analysis.rst:692 -msgid "" -"Note that this feature is defined at the syntactical level, but implemented " -"at compile time. The '+' operator must be used to concatenate string " -"expressions at run time. Also note that literal concatenation can use " -"different quoting styles for each component (even mixing raw strings and " -"triple quoted strings), and formatted string literals may be concatenated " -"with plain string literals." -msgstr "" - -#: reference/lexical_analysis.rst:715 +#: reference/lexical_analysis.rst:1032 msgid "f-strings" msgstr "" -#: reference/lexical_analysis.rst:719 +#: reference/lexical_analysis.rst:1036 msgid "" "A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " -"that is prefixed with ``'f'`` or ``'F'``. These strings may contain " +"that is prefixed with '``f``' or '``F``'. These strings may contain " "replacement fields, which are expressions delimited by curly braces ``{}``. " "While other string literals always have a constant value, formatted strings " "are really expressions evaluated at run time." msgstr "" -#: reference/lexical_analysis.rst:725 +#: reference/lexical_analysis.rst:1042 msgid "" "Escape sequences are decoded like in ordinary string literals (except when a " "literal is also marked as a raw string). After decoding, the grammar for " "the contents of the string is:" msgstr "" -#: reference/lexical_analysis.rst:739 +#: reference/lexical_analysis.rst:1056 msgid "" "The parts of the string outside curly braces are treated literally, except " "that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the " @@ -929,7 +1512,7 @@ msgid "" "replacement field ends with a closing curly bracket ``'}'``." msgstr "" -#: reference/lexical_analysis.rst:749 +#: reference/lexical_analysis.rst:1066 msgid "" "Expressions in formatted string literals are treated like regular Python " "expressions surrounded by parentheses, with a few exceptions. An empty " @@ -943,20 +1526,27 @@ msgid "" "replacement fields must be closed in a different line." msgstr "" -#: reference/lexical_analysis.rst:766 +#: reference/lexical_analysis.rst:1077 +msgid "" +">>> f\"abc{a # This is a comment }\"\n" +"... + 3}\"\n" +"'abc5'" +msgstr "" + +#: reference/lexical_analysis.rst:1083 msgid "" "Prior to Python 3.7, an :keyword:`await` expression and comprehensions " "containing an :keyword:`async for` clause were illegal in the expressions in " "formatted string literals due to a problem with the implementation." msgstr "" -#: reference/lexical_analysis.rst:771 +#: reference/lexical_analysis.rst:1088 msgid "" "Prior to Python 3.12, comments were not allowed inside f-string replacement " "fields." msgstr "" -#: reference/lexical_analysis.rst:775 +#: reference/lexical_analysis.rst:1092 msgid "" "When the equal sign ``'='`` is provided, the output will have the expression " "text, the ``'='`` and the evaluated value. Spaces after the opening brace " @@ -967,18 +1557,18 @@ msgid "" "r'`` is declared." msgstr "" -#: reference/lexical_analysis.rst:783 +#: reference/lexical_analysis.rst:1100 msgid "The equal sign ``'='``." msgstr "" -#: reference/lexical_analysis.rst:786 +#: reference/lexical_analysis.rst:1103 msgid "" "If a conversion is specified, the result of evaluating the expression is " "converted before formatting. Conversion ``'!s'`` calls :func:`str` on the " "result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`." msgstr "" -#: reference/lexical_analysis.rst:790 +#: reference/lexical_analysis.rst:1107 msgid "" "The result is then formatted using the :func:`format` protocol. The format " "specifier is passed to the :meth:`~object.__format__` method of the " @@ -987,7 +1577,7 @@ msgid "" "value of the whole string." msgstr "" -#: reference/lexical_analysis.rst:796 +#: reference/lexical_analysis.rst:1113 msgid "" "Top-level format specifiers may include nested replacement fields. These " "nested fields may include their own conversion fields and :ref:`format " @@ -996,187 +1586,482 @@ msgid "" "as that used by the :meth:`str.format` method." msgstr "" -#: reference/lexical_analysis.rst:802 +#: reference/lexical_analysis.rst:1119 msgid "" "Formatted string literals may be concatenated, but replacement fields cannot " "be split across literals." msgstr "" -#: reference/lexical_analysis.rst:805 +#: reference/lexical_analysis.rst:1122 msgid "Some examples of formatted string literals::" msgstr "" -#: reference/lexical_analysis.rst:837 +#: reference/lexical_analysis.rst:1124 +msgid "" +">>> name = \"Fred\"\n" +">>> f\"He said his name is {name!r}.\"\n" +"\"He said his name is 'Fred'.\"\n" +">>> f\"He said his name is {repr(name)}.\" # repr() is equivalent to !r\n" +"\"He said his name is 'Fred'.\"\n" +">>> width = 10\n" +">>> precision = 4\n" +">>> value = decimal.Decimal(\"12.34567\")\n" +">>> f\"result: {value:{width}.{precision}}\" # nested fields\n" +"'result: 12.35'\n" +">>> today = datetime(year=2017, month=1, day=27)\n" +">>> f\"{today:%B %d, %Y}\" # using date format specifier\n" +"'January 27, 2017'\n" +">>> f\"{today=:%B %d, %Y}\" # using date format specifier and debugging\n" +"'today=January 27, 2017'\n" +">>> number = 1024\n" +">>> f\"{number:#0x}\" # using integer format specifier\n" +"'0x400'\n" +">>> foo = \"bar\"\n" +">>> f\"{ foo = }\" # preserves whitespace\n" +"\" foo = 'bar'\"\n" +">>> line = \"The mill's closed\"\n" +">>> f\"{line = }\"\n" +"'line = \"The mill\\'s closed\"'\n" +">>> f\"{line = :20}\"\n" +"\"line = The mill's closed \"\n" +">>> f\"{line = !r:20}\"\n" +"'line = \"The mill\\'s closed\" '" +msgstr "" + +#: reference/lexical_analysis.rst:1154 msgid "" "Reusing the outer f-string quoting type inside a replacement field is " "permitted::" msgstr "" -#: reference/lexical_analysis.rst:844 +#: reference/lexical_analysis.rst:1157 +msgid "" +">>> a = dict(x=2)\n" +">>> f\"abc {a[\"x\"]} def\"\n" +"'abc 2 def'" +msgstr "" + +#: reference/lexical_analysis.rst:1161 msgid "" "Prior to Python 3.12, reuse of the same quoting type of the outer f-string " "inside a replacement field was not possible." msgstr "" -#: reference/lexical_analysis.rst:848 +#: reference/lexical_analysis.rst:1165 msgid "" "Backslashes are also allowed in replacement fields and are evaluated the " "same way as in any other context::" msgstr "" -#: reference/lexical_analysis.rst:858 +#: reference/lexical_analysis.rst:1168 +msgid "" +">>> a = [\"a\", \"b\", \"c\"]\n" +">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" +"List a contains:\n" +"a\n" +"b\n" +"c" +msgstr "" + +#: reference/lexical_analysis.rst:1175 msgid "" "Prior to Python 3.12, backslashes were not permitted inside an f-string " "replacement field." msgstr "" -#: reference/lexical_analysis.rst:862 +#: reference/lexical_analysis.rst:1179 msgid "" "Formatted string literals cannot be used as docstrings, even if they do not " "include expressions." msgstr "" -#: reference/lexical_analysis.rst:873 +#: reference/lexical_analysis.rst:1184 +msgid "" +">>> def foo():\n" +"... f\"Not a docstring\"\n" +"...\n" +">>> foo.__doc__ is None\n" +"True" +msgstr "" + +#: reference/lexical_analysis.rst:1190 msgid "" "See also :pep:`498` for the proposal that added formatted string literals, " "and :meth:`str.format`, which uses a related format string mechanism." msgstr "" -#: reference/lexical_analysis.rst:880 +#: reference/lexical_analysis.rst:1198 +msgid "t-strings" +msgstr "" + +#: reference/lexical_analysis.rst:1202 +msgid "" +"A :dfn:`template string literal` or :dfn:`t-string` is a string literal that " +"is prefixed with '``t``' or '``T``'. These strings follow the same syntax " +"and evaluation rules as :ref:`formatted string literals `, with " +"the following differences:" +msgstr "" + +#: reference/lexical_analysis.rst:1207 +msgid "" +"Rather than evaluating to a ``str`` object, template string literals " +"evaluate to a :class:`string.templatelib.Template` object." +msgstr "" + +#: reference/lexical_analysis.rst:1210 +msgid "" +"The :func:`format` protocol is not used. Instead, the format specifier and " +"conversions (if any) are passed to a new :class:`~string.templatelib." +"Interpolation` object that is created for each evaluated expression. It is " +"up to code that processes the resulting :class:`~string.templatelib." +"Template` object to decide how to handle format specifiers and conversions." +msgstr "" + +#: reference/lexical_analysis.rst:1217 +msgid "" +"Format specifiers containing nested replacement fields are evaluated " +"eagerly, prior to being passed to the :class:`~string.templatelib." +"Interpolation` object. For instance, an interpolation of the form ``{amount:." +"{precision}f}`` will evaluate the inner expression ``{precision}`` to " +"determine the value of the ``format_spec`` attribute. If ``precision`` were " +"to be ``2``, the resulting format specifier would be ``'.2f'``." +msgstr "" + +#: reference/lexical_analysis.rst:1225 +msgid "" +"When the equals sign ``'='`` is provided in an interpolation expression, the " +"text of the expression is appended to the literal string that precedes the " +"relevant interpolation. This includes the equals sign and any surrounding " +"whitespace. The :class:`!Interpolation` instance for the expression will be " +"created as normal, except that :attr:`~string.templatelib.Interpolation." +"conversion` will be set to '``r``' (:func:`repr`) by default. If an explicit " +"conversion or format specifier are provided, this will override the default " +"behaviour." +msgstr "" + +#: reference/lexical_analysis.rst:1239 msgid "Numeric literals" msgstr "" -#: reference/lexical_analysis.rst:886 +#: reference/lexical_analysis.rst:1245 msgid "" -"There are three types of numeric literals: integers, floating point numbers, " -"and imaginary numbers. There are no complex literals (complex numbers can " -"be formed by adding a real number and an imaginary number)." +":data:`~token.NUMBER` tokens represent numeric literals, of which there are " +"three types: integers, floating-point numbers, and imaginary numbers." msgstr "" -#: reference/lexical_analysis.rst:890 +#: reference/lexical_analysis.rst:1253 msgid "" -"Note that numeric literals do not include a sign; a phrase like ``-1`` is " -"actually an expression composed of the unary operator '``-``' and the " -"literal ``1``." +"The numeric value of a numeric literal is the same as if it were passed as a " +"string to the :class:`int`, :class:`float` or :class:`complex` class " +"constructor, respectively. Note that not all valid inputs for those " +"constructors are also valid literals." msgstr "" -#: reference/lexical_analysis.rst:904 +#: reference/lexical_analysis.rst:1258 +msgid "" +"Numeric literals do not include a sign; a phrase like ``-1`` is actually an " +"expression composed of the unary operator '``-``' and the literal ``1``." +msgstr "" + +#: reference/lexical_analysis.rst:1272 msgid "Integer literals" msgstr "" -#: reference/lexical_analysis.rst:906 -msgid "Integer literals are described by the following lexical definitions:" +#: reference/lexical_analysis.rst:1274 +msgid "Integer literals denote whole numbers. For example::" +msgstr "" + +#: reference/lexical_analysis.rst:1276 +msgid "" +"7\n" +"3\n" +"2147483647" msgstr "" -#: reference/lexical_analysis.rst:920 +#: reference/lexical_analysis.rst:1280 msgid "" "There is no limit for the length of integer literals apart from what can be " -"stored in available memory." +"stored in available memory::" +msgstr "" + +#: reference/lexical_analysis.rst:1283 +msgid "7922816251426433759354395033679228162514264337593543950336" msgstr "" -#: reference/lexical_analysis.rst:923 +#: reference/lexical_analysis.rst:1285 msgid "" -"Underscores are ignored for determining the numeric value of the literal. " -"They can be used to group digits for enhanced readability. One underscore " -"can occur between digits, and after base specifiers like ``0x``." +"Underscores can be used to group digits for enhanced readability, and are " +"ignored for determining the numeric value of the literal. For example, the " +"following literals are equivalent::" msgstr "" -#: reference/lexical_analysis.rst:927 +#: reference/lexical_analysis.rst:1289 msgid "" -"Note that leading zeros in a non-zero decimal number are not allowed. This " -"is for disambiguation with C-style octal literals, which Python used before " -"version 3.0." +"100_000_000_000\n" +"100000000000\n" +"1_00_00_00_00_000" msgstr "" -#: reference/lexical_analysis.rst:931 -msgid "Some examples of integer literals::" +#: reference/lexical_analysis.rst:1293 +msgid "" +"Underscores can only occur between digits. For example, ``_123``, ``321_``, " +"and ``123__321`` are *not* valid literals." +msgstr "" + +#: reference/lexical_analysis.rst:1296 +msgid "" +"Integers can be specified in binary (base 2), octal (base 8), or hexadecimal " +"(base 16) using the prefixes ``0b``, ``0o`` and ``0x``, respectively. " +"Hexadecimal digits 10 through 15 are represented by letters ``A``-``F``, " +"case-insensitive. For example::" +msgstr "" + +#: reference/lexical_analysis.rst:1301 +msgid "" +"0b100110111\n" +"0b_1110_0101\n" +"0o177\n" +"0o377\n" +"0xdeadbeef\n" +"0xDead_Beef" +msgstr "" + +#: reference/lexical_analysis.rst:1308 +msgid "" +"An underscore can follow the base specifier. For example, ``0x_1f`` is a " +"valid literal, but ``0_x1f`` and ``0x__1f`` are not." +msgstr "" + +#: reference/lexical_analysis.rst:1312 +msgid "" +"Leading zeros in a non-zero decimal number are not allowed. For example, " +"``0123`` is not a valid literal. This is for disambiguation with C-style " +"octal literals, which Python used before version 3.0." +msgstr "" + +#: reference/lexical_analysis.rst:1317 +msgid "" +"Formally, integer literals are described by the following lexical " +"definitions:" msgstr "" -#: reference/lexical_analysis.rst:937 reference/lexical_analysis.rst:969 +#: reference/lexical_analysis.rst:1334 reference/lexical_analysis.rst:1398 msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" -#: reference/lexical_analysis.rst:948 -msgid "Floating point literals" +#: reference/lexical_analysis.rst:1345 +msgid "Floating-point literals" +msgstr "" + +#: reference/lexical_analysis.rst:1347 +msgid "" +"Floating-point (float) literals, such as ``3.14`` or ``1.5``, denote :ref:" +"`approximations of real numbers `." +msgstr "" + +#: reference/lexical_analysis.rst:1350 +msgid "" +"They consist of *integer* and *fraction* parts, each composed of decimal " +"digits. The parts are separated by a decimal point, ``.``::" +msgstr "" + +#: reference/lexical_analysis.rst:1353 +msgid "" +"2.71828\n" +"4.0" +msgstr "" + +#: reference/lexical_analysis.rst:1356 +msgid "" +"Unlike in integer literals, leading zeros are allowed. For example, " +"``077.010`` is legal, and denotes the same number as ``77.01``." +msgstr "" + +#: reference/lexical_analysis.rst:1359 +msgid "" +"As in integer literals, single underscores may occur between digits to help " +"readability::" +msgstr "" + +#: reference/lexical_analysis.rst:1362 +msgid "" +"96_485.332_123\n" +"3.14_15_93" +msgstr "" + +#: reference/lexical_analysis.rst:1365 +msgid "Either of these parts, but not both, can be empty. For example::" +msgstr "" + +#: reference/lexical_analysis.rst:1367 +msgid "" +"10. # (equivalent to 10.0)\n" +".001 # (equivalent to 0.001)" msgstr "" -#: reference/lexical_analysis.rst:950 +#: reference/lexical_analysis.rst:1370 msgid "" -"Floating point literals are described by the following lexical definitions:" +"Optionally, the integer and fraction may be followed by an *exponent*: the " +"letter ``e`` or ``E``, followed by an optional sign, ``+`` or ``-``, and a " +"number in the same format as the integer and fraction parts. The ``e`` or " +"``E`` represents \"times ten raised to the power of\"::" msgstr "" -#: reference/lexical_analysis.rst:960 +#: reference/lexical_analysis.rst:1375 msgid "" -"Note that the integer and exponent parts are always interpreted using radix " -"10. For example, ``077e010`` is legal, and denotes the same number as " -"``77e10``. The allowed range of floating point literals is implementation-" -"dependent. As in integer literals, underscores are supported for digit " -"grouping." +"1.0e3 # (represents 1.0×10³, or 1000.0)\n" +"1.166e-5 # (represents 1.166×10⁻⁵, or 0.00001166)\n" +"6.02214076e+23 # (represents 6.02214076×10²³, or 602214076000000000000000.)" msgstr "" -#: reference/lexical_analysis.rst:965 -msgid "Some examples of floating point literals::" +#: reference/lexical_analysis.rst:1379 +msgid "" +"In floats with only integer and exponent parts, the decimal point may be " +"omitted::" +msgstr "" + +#: reference/lexical_analysis.rst:1382 +msgid "" +"1e3 # (equivalent to 1.e3 and 1.0e3)\n" +"0e0 # (equivalent to 0.)" msgstr "" -#: reference/lexical_analysis.rst:978 +#: reference/lexical_analysis.rst:1385 +msgid "" +"Formally, floating-point literals are described by the following lexical " +"definitions:" +msgstr "" + +#: reference/lexical_analysis.rst:1407 msgid "Imaginary literals" msgstr "" -#: reference/lexical_analysis.rst:980 -msgid "Imaginary literals are described by the following lexical definitions:" +#: reference/lexical_analysis.rst:1409 +msgid "" +"Python has :ref:`complex number ` objects, but no complex " +"literals. Instead, *imaginary literals* denote complex numbers with a zero " +"real part." msgstr "" -#: reference/lexical_analysis.rst:985 +#: reference/lexical_analysis.rst:1414 msgid "" -"An imaginary literal yields a complex number with a real part of 0.0. " -"Complex numbers are represented as a pair of floating point numbers and have " -"the same restrictions on their range. To create a complex number with a " -"nonzero real part, add a floating point number to it, e.g., ``(3+4j)``. " -"Some examples of imaginary literals::" +"For example, in math, the complex number 3+4.2\\ *i* is written as the real " +"number 3 added to the imaginary number 4.2\\ *i*. Python uses a similar " +"syntax, except the imaginary unit is written as ``j`` rather than *i*::" msgstr "" -#: reference/lexical_analysis.rst:997 -msgid "Operators" +#: reference/lexical_analysis.rst:1419 +msgid "3+4.2j" msgstr "" -#: reference/lexical_analysis.rst:1001 -msgid "The following tokens are operators:" +#: reference/lexical_analysis.rst:1421 +msgid "" +"This is an expression composed of the :ref:`integer literal ` " +"``3``, the :ref:`operator ` '``+``', and the :ref:`imaginary " +"literal ` ``4.2j``. Since these are three separate tokens, " +"whitespace is allowed between them::" msgstr "" -#: reference/lexical_analysis.rst:1014 -msgid "Delimiters" +#: reference/lexical_analysis.rst:1427 +msgid "3 + 4.2j" msgstr "" -#: reference/lexical_analysis.rst:1018 -msgid "The following tokens serve as delimiters in the grammar:" +#: reference/lexical_analysis.rst:1429 +msgid "" +"No whitespace is allowed *within* each token. In particular, the ``j`` " +"suffix, may not be separated from the number before it." msgstr "" -#: reference/lexical_analysis.rst:1027 +#: reference/lexical_analysis.rst:1433 msgid "" -"The period can also occur in floating-point and imaginary literals. A " -"sequence of three periods has a special meaning as an ellipsis literal. The " -"second half of the list, the augmented assignment operators, serve lexically " -"as delimiters, but also perform an operation." +"The number before the ``j`` has the same syntax as a floating-point literal. " +"Thus, the following are valid imaginary literals::" msgstr "" -#: reference/lexical_analysis.rst:1032 +#: reference/lexical_analysis.rst:1436 +msgid "" +"4.2j\n" +"3.14j\n" +"10.j\n" +".001j\n" +"1e100j\n" +"3.14e-10j\n" +"3.14_15_93j" +msgstr "" + +#: reference/lexical_analysis.rst:1444 +msgid "" +"Unlike in a floating-point literal the decimal point can be omitted if the " +"imaginary number only has an integer part. The number is still evaluated as " +"a floating-point number, not an integer::" +msgstr "" + +#: reference/lexical_analysis.rst:1448 +msgid "" +"10j\n" +"0j\n" +"1000000000000000000000000j # equivalent to 1e+24j" +msgstr "" + +#: reference/lexical_analysis.rst:1452 +msgid "" +"The ``j`` suffix is case-insensitive. That means you can use ``J`` instead::" +msgstr "" + +#: reference/lexical_analysis.rst:1455 +msgid "3.14J # equivalent to 3.14j" +msgstr "" + +#: reference/lexical_analysis.rst:1457 +msgid "" +"Formally, imaginary literals are described by the following lexical " +"definition:" +msgstr "" + +#: reference/lexical_analysis.rst:1470 +msgid "Operators and delimiters" +msgstr "" + +#: reference/lexical_analysis.rst:1476 +msgid "" +"The following grammar defines :dfn:`operator` and :dfn:`delimiter` tokens, " +"that is, the generic :data:`~token.OP` token type. A :ref:`list of these " +"tokens and their names ` is also available in " +"the :mod:`!token` module documentation." +msgstr "" + +#: reference/lexical_analysis.rst:1505 +msgid "" +"Generally, *operators* are used to combine :ref:`expressions `, " +"while *delimiters* serve other purposes. However, there is no clear, formal " +"distinction between the two categories." +msgstr "" + +#: reference/lexical_analysis.rst:1509 msgid "" -"The following printing ASCII characters have special meaning as part of " -"other tokens or are otherwise significant to the lexical analyzer:" +"Some tokens can serve as either operators or delimiters, depending on usage. " +"For example, ``*`` is both the multiplication operator and a delimiter used " +"for sequence unpacking, and ``@`` is both the matrix multiplication and a " +"delimiter that introduces decorators." msgstr "" -#: reference/lexical_analysis.rst:1039 +#: reference/lexical_analysis.rst:1514 msgid "" -"The following printing ASCII characters are not used in Python. Their " -"occurrence outside string literals and comments is an unconditional error:" +"For some tokens, the distinction is unclear. For example, some people " +"consider ``.``, ``(``, and ``)`` to be delimiters, while others see the :py:" +"func:`getattr` operator and the function call operator(s)." msgstr "" -#: reference/lexical_analysis.rst:1048 -msgid "Footnotes" +#: reference/lexical_analysis.rst:1518 +msgid "" +"Some of Python's operators, like ``and``, ``or``, and ``not in``, use :ref:" +"`keyword ` tokens rather than \"symbols\" (operator tokens)." msgstr "" -#: reference/lexical_analysis.rst:1049 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +#: reference/lexical_analysis.rst:1521 +msgid "" +"A sequence of three consecutive periods (``...``) has a special meaning as " +"an :py:data:`Ellipsis` literal." msgstr "" #: reference/lexical_analysis.rst:8 @@ -1191,404 +2076,389 @@ msgstr "" msgid "token" msgstr "" -#: reference/lexical_analysis.rst:25 +#: reference/lexical_analysis.rst:90 msgid "line structure" msgstr "" -#: reference/lexical_analysis.rst:35 +#: reference/lexical_analysis.rst:100 msgid "logical line" msgstr "" -#: reference/lexical_analysis.rst:35 reference/lexical_analysis.rst:115 -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:100 reference/lexical_analysis.rst:205 +#: reference/lexical_analysis.rst:755 msgid "physical line" msgstr "" -#: reference/lexical_analysis.rst:35 reference/lexical_analysis.rst:115 +#: reference/lexical_analysis.rst:100 reference/lexical_analysis.rst:205 msgid "line joining" msgstr "" -#: reference/lexical_analysis.rst:35 +#: reference/lexical_analysis.rst:100 msgid "NEWLINE token" msgstr "" -#: reference/lexical_analysis.rst:67 +#: reference/lexical_analysis.rst:146 msgid "comment" msgstr "" -#: reference/lexical_analysis.rst:67 +#: reference/lexical_analysis.rst:146 msgid "hash character" msgstr "" -#: reference/lexical_analysis.rst:67 reference/lexical_analysis.rst:81 +#: reference/lexical_analysis.rst:146 reference/lexical_analysis.rst:160 msgid "# (hash)" msgstr "" -#: reference/lexical_analysis.rst:81 +#: reference/lexical_analysis.rst:160 msgid "source character set" msgstr "" -#: reference/lexical_analysis.rst:81 +#: reference/lexical_analysis.rst:160 msgid "encoding declarations (source file)" msgstr "" -#: reference/lexical_analysis.rst:81 +#: reference/lexical_analysis.rst:160 msgid "source encoding declaration" msgstr "" -#: reference/lexical_analysis.rst:115 +#: reference/lexical_analysis.rst:205 msgid "line continuation" msgstr "" -#: reference/lexical_analysis.rst:115 +#: reference/lexical_analysis.rst:205 msgid "backslash character" msgstr "" -#: reference/lexical_analysis.rst:160 +#: reference/lexical_analysis.rst:250 msgid "blank line" msgstr "" -#: reference/lexical_analysis.rst:175 +#: reference/lexical_analysis.rst:266 msgid "indentation" msgstr "" -#: reference/lexical_analysis.rst:175 +#: reference/lexical_analysis.rst:266 msgid "leading whitespace" msgstr "" -#: reference/lexical_analysis.rst:175 -msgid "space" -msgstr "" - -#: reference/lexical_analysis.rst:175 -msgid "tab" -msgstr "" - -#: reference/lexical_analysis.rst:175 +#: reference/lexical_analysis.rst:266 msgid "grouping" msgstr "" -#: reference/lexical_analysis.rst:175 +#: reference/lexical_analysis.rst:266 msgid "statement grouping" msgstr "" -#: reference/lexical_analysis.rst:203 +#: reference/lexical_analysis.rst:294 msgid "INDENT token" msgstr "" -#: reference/lexical_analysis.rst:203 +#: reference/lexical_analysis.rst:294 msgid "DEDENT token" msgstr "" -#: reference/lexical_analysis.rst:278 +#: reference/lexical_analysis.rst:384 msgid "identifier" msgstr "" -#: reference/lexical_analysis.rst:278 +#: reference/lexical_analysis.rst:384 msgid "name" msgstr "" -#: reference/lexical_analysis.rst:335 reference/lexical_analysis.rst:359 +#: reference/lexical_analysis.rst:419 reference/lexical_analysis.rst:443 msgid "keyword" msgstr "" -#: reference/lexical_analysis.rst:335 +#: reference/lexical_analysis.rst:419 msgid "reserved word" msgstr "" -#: reference/lexical_analysis.rst:359 +#: reference/lexical_analysis.rst:443 msgid "soft keyword" msgstr "" -#: reference/lexical_analysis.rst:378 +#: reference/lexical_analysis.rst:463 msgid "_, identifiers" msgstr "" -#: reference/lexical_analysis.rst:378 +#: reference/lexical_analysis.rst:463 msgid "__, identifiers" msgstr "" -#: reference/lexical_analysis.rst:434 +#: reference/lexical_analysis.rst:608 msgid "literal" msgstr "" -#: reference/lexical_analysis.rst:434 +#: reference/lexical_analysis.rst:608 msgid "constant" msgstr "" -#: reference/lexical_analysis.rst:439 reference/lexical_analysis.rst:480 +#: reference/lexical_analysis.rst:620 reference/lexical_analysis.rst:663 +#: reference/lexical_analysis.rst:688 msgid "string literal" msgstr "" -#: reference/lexical_analysis.rst:439 reference/lexical_analysis.rst:493 +#: reference/lexical_analysis.rst:620 reference/lexical_analysis.rst:956 msgid "bytes literal" msgstr "" -#: reference/lexical_analysis.rst:439 +#: reference/lexical_analysis.rst:620 msgid "ASCII" msgstr "" -#: reference/lexical_analysis.rst:439 +#: reference/lexical_analysis.rst:620 msgid "' (single quote)" msgstr "" -#: reference/lexical_analysis.rst:439 +#: reference/lexical_analysis.rst:620 msgid "\" (double quote)" msgstr "" -#: reference/lexical_analysis.rst:439 -msgid "u'" -msgstr "" - -#: reference/lexical_analysis.rst:439 -msgid "u\"" -msgstr "" - -#: reference/lexical_analysis.rst:480 +#: reference/lexical_analysis.rst:663 msgid "triple-quoted string" msgstr "" -#: reference/lexical_analysis.rst:480 -msgid "Unicode Consortium" -msgstr "" - -#: reference/lexical_analysis.rst:480 -msgid "raw string" -msgstr "" - -#: reference/lexical_analysis.rst:480 +#: reference/lexical_analysis.rst:663 msgid "\"\"\"" msgstr "" -#: reference/lexical_analysis.rst:480 +#: reference/lexical_analysis.rst:663 msgid "'''" msgstr "" -#: reference/lexical_analysis.rst:493 -msgid "b'" -msgstr "" - -#: reference/lexical_analysis.rst:493 -msgid "b\"" -msgstr "" - -#: reference/lexical_analysis.rst:502 -msgid "r'" -msgstr "" - -#: reference/lexical_analysis.rst:502 -msgid "raw string literal" -msgstr "" - -#: reference/lexical_analysis.rst:502 -msgid "r\"" -msgstr "" - -#: reference/lexical_analysis.rst:521 -msgid "f'" -msgstr "" - -#: reference/lexical_analysis.rst:521 reference/lexical_analysis.rst:699 -msgid "formatted string literal" +#: reference/lexical_analysis.rst:688 +msgid "u'" msgstr "" -#: reference/lexical_analysis.rst:521 -msgid "f\"" +#: reference/lexical_analysis.rst:688 +msgid "u\"" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "escape sequence" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "Standard C" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "C" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\ (backslash)" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\\\" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\a" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\b" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\f" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\n" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\r" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\t" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\v" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\x" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\N" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\u" msgstr "" -#: reference/lexical_analysis.rst:534 +#: reference/lexical_analysis.rst:755 msgid "\\U" msgstr "" -#: reference/lexical_analysis.rst:650 +#: reference/lexical_analysis.rst:931 msgid "unrecognized escape sequence" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:956 +msgid "b'" +msgstr "" + +#: reference/lexical_analysis.rst:956 +msgid "b\"" +msgstr "" + +#: reference/lexical_analysis.rst:983 +msgid "r'" +msgstr "" + +#: reference/lexical_analysis.rst:983 +msgid "raw string literal" +msgstr "" + +#: reference/lexical_analysis.rst:983 +msgid "r\"" +msgstr "" + +#: reference/lexical_analysis.rst:1014 +msgid "formatted string literal" +msgstr "" + +#: reference/lexical_analysis.rst:1014 msgid "interpolated string literal" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "string" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "formatted literal" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "interpolated literal" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "f-string" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "fstring" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 +msgid "f'" +msgstr "" + +#: reference/lexical_analysis.rst:1014 +msgid "f\"" +msgstr "" + +#: reference/lexical_analysis.rst:1014 msgid "{} (curly brackets)" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "in formatted string literal" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "! (exclamation)" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid ": (colon)" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "= (equals)" msgstr "" -#: reference/lexical_analysis.rst:699 +#: reference/lexical_analysis.rst:1014 msgid "for help in debugging using string literals" msgstr "" -#: reference/lexical_analysis.rst:882 +#: reference/lexical_analysis.rst:1241 msgid "number" msgstr "" -#: reference/lexical_analysis.rst:882 +#: reference/lexical_analysis.rst:1241 msgid "numeric literal" msgstr "" -#: reference/lexical_analysis.rst:882 reference/lexical_analysis.rst:895 +#: reference/lexical_analysis.rst:1241 reference/lexical_analysis.rst:1263 msgid "integer literal" msgstr "" -#: reference/lexical_analysis.rst:882 -msgid "floating point literal" +#: reference/lexical_analysis.rst:1241 +msgid "floating-point literal" msgstr "" -#: reference/lexical_analysis.rst:882 +#: reference/lexical_analysis.rst:1241 msgid "hexadecimal literal" msgstr "" -#: reference/lexical_analysis.rst:882 +#: reference/lexical_analysis.rst:1241 msgid "octal literal" msgstr "" -#: reference/lexical_analysis.rst:882 +#: reference/lexical_analysis.rst:1241 msgid "binary literal" msgstr "" -#: reference/lexical_analysis.rst:882 +#: reference/lexical_analysis.rst:1241 msgid "decimal literal" msgstr "" -#: reference/lexical_analysis.rst:882 +#: reference/lexical_analysis.rst:1241 msgid "imaginary literal" msgstr "" -#: reference/lexical_analysis.rst:882 +#: reference/lexical_analysis.rst:1241 msgid "complex literal" msgstr "" -#: reference/lexical_analysis.rst:895 +#: reference/lexical_analysis.rst:1263 msgid "0b" msgstr "" -#: reference/lexical_analysis.rst:895 +#: reference/lexical_analysis.rst:1263 msgid "0o" msgstr "" -#: reference/lexical_analysis.rst:895 +#: reference/lexical_analysis.rst:1263 msgid "0x" msgstr "" -#: reference/lexical_analysis.rst:895 reference/lexical_analysis.rst:941 +#: reference/lexical_analysis.rst:1263 reference/lexical_analysis.rst:1338 msgid "_ (underscore)" msgstr "" -#: reference/lexical_analysis.rst:895 reference/lexical_analysis.rst:941 -#: reference/lexical_analysis.rst:973 +#: reference/lexical_analysis.rst:1263 reference/lexical_analysis.rst:1338 +#: reference/lexical_analysis.rst:1402 msgid "in numeric literal" msgstr "" -#: reference/lexical_analysis.rst:941 +#: reference/lexical_analysis.rst:1338 msgid ". (dot)" msgstr "" -#: reference/lexical_analysis.rst:941 +#: reference/lexical_analysis.rst:1338 msgid "e" msgstr "" -#: reference/lexical_analysis.rst:973 +#: reference/lexical_analysis.rst:1402 msgid "j" msgstr "" -#: reference/lexical_analysis.rst:999 +#: reference/lexical_analysis.rst:1472 msgid "operators" msgstr "" -#: reference/lexical_analysis.rst:1016 +#: reference/lexical_analysis.rst:1472 msgid "delimiters" msgstr "" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 1a27e17b..84686891 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -174,6 +175,14 @@ msgid "" "side creates a new instance attribute as the target of the assignment::" msgstr "" +#: reference/simple_stmts.rst:179 +msgid "" +"class Cls:\n" +" x = 3 # class variable\n" +"inst = Cls()\n" +"inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3" +msgstr "" + #: reference/simple_stmts.rst:184 msgid "" "This description does not necessarily apply to descriptor attributes, such " @@ -246,6 +255,14 @@ msgid "" "instance, the following program prints ``[0, 2]``::" msgstr "" +#: reference/simple_stmts.rst:246 +msgid "" +"x = [0, 1]\n" +"i = 0\n" +"i, x[i] = 1, 2 # i is updated, then x[i] is updated\n" +"print(x)" +msgstr "" + #: reference/simple_stmts.rst:254 msgid ":pep:`3132` - Extended Iterable Unpacking" msgstr "" @@ -281,7 +298,7 @@ msgstr "" #: reference/simple_stmts.rst:296 msgid "" -"An augmented assignment expression like ``x += 1`` can be rewritten as ``x = " +"An augmented assignment statement like ``x += 1`` can be rewritten as ``x = " "x + 1`` to achieve a similar, but not exactly equal effect. In the augmented " "version, ``x`` is only evaluated once. Also, when possible, the actual " "operation is performed *in-place*, meaning that rather than creating a new " @@ -331,137 +348,164 @@ msgstr "" #: reference/simple_stmts.rst:336 msgid "" -"For simple names as assignment targets, if in class or module scope, the " -"annotations are evaluated and stored in a special class or module attribute :" -"attr:`__annotations__` that is a dictionary mapping from variable names " -"(mangled if private) to evaluated annotations. This attribute is writable " -"and is automatically created at the start of class or module body execution, " -"if annotations are found statically." +"The assignment target is considered \"simple\" if it consists of a single " +"name that is not enclosed in parentheses. For simple assignment targets, if " +"in class or module scope, the annotations are gathered in a lazily " +"evaluated :ref:`annotation scope `. The annotations can " +"be evaluated using the :attr:`~object.__annotations__` attribute of a class " +"or module, or using the facilities in the :mod:`annotationlib` module." msgstr "" -#: reference/simple_stmts.rst:344 +#: reference/simple_stmts.rst:345 msgid "" -"For expressions as assignment targets, the annotations are evaluated if in " -"class or module scope, but not stored." +"If the assignment target is not simple (an attribute, subscript node, or " +"parenthesized name), the annotation is never evaluated." msgstr "" -#: reference/simple_stmts.rst:347 +#: reference/simple_stmts.rst:348 msgid "" "If a name is annotated in a function scope, then this name is local for that " "scope. Annotations are never evaluated and stored in function scopes." msgstr "" -#: reference/simple_stmts.rst:350 +#: reference/simple_stmts.rst:351 msgid "" "If the right hand side is present, an annotated assignment performs the " -"actual assignment before evaluating annotations (where applicable). If the " -"right hand side is not present for an expression target, then the " -"interpreter evaluates the target except for the last :meth:`~object." -"__setitem__` or :meth:`~object.__setattr__` call." +"actual assignment as if there was no annotation present. If the right hand " +"side is not present for an expression target, then the interpreter evaluates " +"the target except for the last :meth:`~object.__setitem__` or :meth:`~object." +"__setattr__` call." msgstr "" -#: reference/simple_stmts.rst:361 +#: reference/simple_stmts.rst:359 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: reference/simple_stmts.rst:359 +#: reference/simple_stmts.rst:360 msgid "" "The proposal that added syntax for annotating the types of variables " "(including class variables and instance variables), instead of expressing " "them through comments." msgstr "" -#: reference/simple_stmts.rst:365 +#: reference/simple_stmts.rst:364 msgid ":pep:`484` - Type hints" msgstr "" -#: reference/simple_stmts.rst:364 +#: reference/simple_stmts.rst:365 msgid "" "The proposal that added the :mod:`typing` module to provide a standard " "syntax for type annotations that can be used in static analysis tools and " "IDEs." msgstr "" -#: reference/simple_stmts.rst:368 +#: reference/simple_stmts.rst:369 msgid "" "Now annotated assignments allow the same expressions in the right hand side " "as regular assignments. Previously, some expressions (like un-parenthesized " "tuple expressions) caused a syntax error." msgstr "" -#: reference/simple_stmts.rst:377 +#: reference/simple_stmts.rst:374 +msgid "" +"Annotations are now lazily evaluated in a separate :ref:`annotation scope " +"`. If the assignment target is not simple, annotations " +"are never evaluated." +msgstr "" + +#: reference/simple_stmts.rst:382 msgid "The :keyword:`!assert` statement" msgstr "" -#: reference/simple_stmts.rst:384 +#: reference/simple_stmts.rst:389 msgid "" "Assert statements are a convenient way to insert debugging assertions into a " "program:" msgstr "" -#: reference/simple_stmts.rst:390 +#: reference/simple_stmts.rst:395 msgid "The simple form, ``assert expression``, is equivalent to ::" msgstr "" -#: reference/simple_stmts.rst:395 +#: reference/simple_stmts.rst:397 +msgid "" +"if __debug__:\n" +" if not expression: raise AssertionError" +msgstr "" + +#: reference/simple_stmts.rst:400 msgid "" "The extended form, ``assert expression1, expression2``, is equivalent to ::" msgstr "" -#: reference/simple_stmts.rst:404 +#: reference/simple_stmts.rst:402 +msgid "" +"if __debug__:\n" +" if not expression1: raise AssertionError(expression2)" +msgstr "" + +#: reference/simple_stmts.rst:409 msgid "" "These equivalences assume that :const:`__debug__` and :exc:`AssertionError` " "refer to the built-in variables with those names. In the current " -"implementation, the built-in variable :const:`__debug__` is ``True`` under " -"normal circumstances, ``False`` when optimization is requested (command line " -"option :option:`-O`). The current code generator emits no code for an " -"assert statement when optimization is requested at compile time. Note that " -"it is unnecessary to include the source code for the expression that failed " -"in the error message; it will be displayed as part of the stack trace." +"implementation, the built-in variable ``__debug__`` is ``True`` under normal " +"circumstances, ``False`` when optimization is requested (command line " +"option :option:`-O`). The current code generator emits no code for an :" +"keyword:`assert` statement when optimization is requested at compile time. " +"Note that it is unnecessary to include the source code for the expression " +"that failed in the error message; it will be displayed as part of the stack " +"trace." msgstr "" -#: reference/simple_stmts.rst:413 +#: reference/simple_stmts.rst:418 msgid "" "Assignments to :const:`__debug__` are illegal. The value for the built-in " "variable is determined when the interpreter starts." msgstr "" -#: reference/simple_stmts.rst:420 +#: reference/simple_stmts.rst:425 msgid "The :keyword:`!pass` statement" msgstr "" -#: reference/simple_stmts.rst:430 +#: reference/simple_stmts.rst:435 msgid "" ":keyword:`pass` is a null operation --- when it is executed, nothing " "happens. It is useful as a placeholder when a statement is required " "syntactically, but no code needs to be executed, for example::" msgstr "" -#: reference/simple_stmts.rst:442 +#: reference/simple_stmts.rst:439 +msgid "" +"def f(arg): pass # a function that does nothing (yet)\n" +"\n" +"class C: pass # a class with no methods (yet)" +msgstr "" + +#: reference/simple_stmts.rst:447 msgid "The :keyword:`!del` statement" msgstr "" -#: reference/simple_stmts.rst:452 +#: reference/simple_stmts.rst:457 msgid "" "Deletion is recursively defined very similar to the way assignment is " "defined. Rather than spelling it out in full details, here are some hints." msgstr "" -#: reference/simple_stmts.rst:455 +#: reference/simple_stmts.rst:460 msgid "" "Deletion of a target list recursively deletes each target, from left to " "right." msgstr "" -#: reference/simple_stmts.rst:461 +#: reference/simple_stmts.rst:466 msgid "" "Deletion of a name removes the binding of that name from the local or global " "namespace, depending on whether the name occurs in a :keyword:`global` " -"statement in the same code block. If the name is unbound, a :exc:" -"`NameError` exception will be raised." +"statement in the same code block. Trying to delete an unbound name raises " +"a :exc:`NameError` exception." msgstr "" -#: reference/simple_stmts.rst:468 +#: reference/simple_stmts.rst:473 msgid "" "Deletion of attribute references, subscriptions and slicings is passed to " "the primary object involved; deletion of a slicing is in general equivalent " @@ -469,42 +513,42 @@ msgid "" "determined by the sliced object)." msgstr "" -#: reference/simple_stmts.rst:473 +#: reference/simple_stmts.rst:478 msgid "" "Previously it was illegal to delete a name from the local namespace if it " "occurs as a free variable in a nested block." msgstr "" -#: reference/simple_stmts.rst:481 +#: reference/simple_stmts.rst:486 msgid "The :keyword:`!return` statement" msgstr "" -#: reference/simple_stmts.rst:491 +#: reference/simple_stmts.rst:496 msgid "" ":keyword:`return` may only occur syntactically nested in a function " "definition, not within a nested class definition." msgstr "" -#: reference/simple_stmts.rst:494 +#: reference/simple_stmts.rst:499 msgid "" "If an expression list is present, it is evaluated, else ``None`` is " "substituted." msgstr "" -#: reference/simple_stmts.rst:496 +#: reference/simple_stmts.rst:501 msgid "" ":keyword:`return` leaves the current function call with the expression list " "(or ``None``) as return value." msgstr "" -#: reference/simple_stmts.rst:501 +#: reference/simple_stmts.rst:506 msgid "" "When :keyword:`return` passes control out of a :keyword:`try` statement with " "a :keyword:`finally` clause, that :keyword:`!finally` clause is executed " "before really leaving the function." msgstr "" -#: reference/simple_stmts.rst:505 +#: reference/simple_stmts.rst:510 msgid "" "In a generator function, the :keyword:`return` statement indicates that the " "generator is done and will cause :exc:`StopIteration` to be raised. The " @@ -512,7 +556,7 @@ msgid "" "`StopIteration` and becomes the :attr:`StopIteration.value` attribute." msgstr "" -#: reference/simple_stmts.rst:510 +#: reference/simple_stmts.rst:515 msgid "" "In an asynchronous generator function, an empty :keyword:`return` statement " "indicates that the asynchronous generator is done and will cause :exc:" @@ -520,41 +564,54 @@ msgid "" "is a syntax error in an asynchronous generator function." msgstr "" -#: reference/simple_stmts.rst:518 +#: reference/simple_stmts.rst:523 msgid "The :keyword:`!yield` statement" msgstr "" -#: reference/simple_stmts.rst:530 +#: reference/simple_stmts.rst:535 msgid "" "A :keyword:`yield` statement is semantically equivalent to a :ref:`yield " -"expression `. The yield statement can be used to omit the " +"expression `. The ``yield`` statement can be used to omit the " "parentheses that would otherwise be required in the equivalent yield " "expression statement. For example, the yield statements ::" msgstr "" -#: reference/simple_stmts.rst:538 -msgid "are equivalent to the yield expression statements ::" +#: reference/simple_stmts.rst:540 +msgid "" +"yield \n" +"yield from " msgstr "" #: reference/simple_stmts.rst:543 +msgid "are equivalent to the yield expression statements ::" +msgstr "" + +#: reference/simple_stmts.rst:545 +msgid "" +"(yield )\n" +"(yield from )" +msgstr "" + +#: reference/simple_stmts.rst:548 msgid "" "Yield expressions and statements are only used when defining a :term:" "`generator` function, and are only used in the body of the generator " -"function. Using yield in a function definition is sufficient to cause that " -"definition to create a generator function instead of a normal function." +"function. Using :keyword:`yield` in a function definition is sufficient to " +"cause that definition to create a generator function instead of a normal " +"function." msgstr "" -#: reference/simple_stmts.rst:548 +#: reference/simple_stmts.rst:553 msgid "" "For full details of :keyword:`yield` semantics, refer to the :ref:" "`yieldexpr` section." msgstr "" -#: reference/simple_stmts.rst:554 +#: reference/simple_stmts.rst:559 msgid "The :keyword:`!raise` statement" msgstr "" -#: reference/simple_stmts.rst:565 +#: reference/simple_stmts.rst:570 msgid "" "If no expressions are present, :keyword:`raise` re-raises the exception that " "is currently being handled, which is also known as the *active exception*. " @@ -562,7 +619,7 @@ msgid "" "exception is raised indicating that this is an error." msgstr "" -#: reference/simple_stmts.rst:570 +#: reference/simple_stmts.rst:575 msgid "" "Otherwise, :keyword:`raise` evaluates the first expression as the exception " "object. It must be either a subclass or an instance of :class:" @@ -570,13 +627,13 @@ msgid "" "when needed by instantiating the class with no arguments." msgstr "" -#: reference/simple_stmts.rst:575 +#: reference/simple_stmts.rst:580 msgid "" "The :dfn:`type` of the exception is the exception instance's class, the :dfn:" "`value` is the instance itself." msgstr "" -#: reference/simple_stmts.rst:580 +#: reference/simple_stmts.rst:585 msgid "" "A traceback object is normally created automatically when an exception is " "raised and attached to it as the :attr:`~BaseException.__traceback__` " @@ -586,7 +643,11 @@ msgid "" "argument), like so::" msgstr "" -#: reference/simple_stmts.rst:592 +#: reference/simple_stmts.rst:591 +msgid "raise Exception(\"foo occurred\").with_traceback(tracebackobj)" +msgstr "" + +#: reference/simple_stmts.rst:597 msgid "" "The ``from`` clause is used for exception chaining: if given, the second " "*expression* must be another exception class or instance. If the second " @@ -598,7 +659,28 @@ msgid "" "exception is not handled, both exceptions will be printed:" msgstr "" -#: reference/simple_stmts.rst:621 +#: reference/simple_stmts.rst:606 +msgid "" +">>> try:\n" +"... print(1 / 0)\n" +"... except Exception as exc:\n" +"... raise RuntimeError(\"Something bad happened\") from exc\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" print(1 / 0)\n" +" ~~^~~\n" +"ZeroDivisionError: division by zero\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError(\"Something bad happened\") from exc\n" +"RuntimeError: Something bad happened" +msgstr "" + +#: reference/simple_stmts.rst:626 msgid "" "A similar mechanism works implicitly if a new exception is raised when an " "exception is already being handled. An exception may be handled when an :" @@ -607,30 +689,63 @@ msgid "" "exception's :attr:`~BaseException.__context__` attribute:" msgstr "" -#: reference/simple_stmts.rst:647 +#: reference/simple_stmts.rst:632 +msgid "" +">>> try:\n" +"... print(1 / 0)\n" +"... except:\n" +"... raise RuntimeError(\"Something bad happened\")\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" print(1 / 0)\n" +" ~~^~~\n" +"ZeroDivisionError: division by zero\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError(\"Something bad happened\")\n" +"RuntimeError: Something bad happened" +msgstr "" + +#: reference/simple_stmts.rst:652 msgid "" "Exception chaining can be explicitly suppressed by specifying :const:`None` " "in the ``from`` clause:" msgstr "" -#: reference/simple_stmts.rst:661 +#: reference/simple_stmts.rst:655 +msgid "" +">>> try:\n" +"... print(1 / 0)\n" +"... except:\n" +"... raise RuntimeError(\"Something bad happened\") from None\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +"RuntimeError: Something bad happened" +msgstr "" + +#: reference/simple_stmts.rst:666 msgid "" "Additional information on exceptions can be found in section :ref:" "`exceptions`, and information about handling exceptions is in section :ref:" "`try`." msgstr "" -#: reference/simple_stmts.rst:664 +#: reference/simple_stmts.rst:669 msgid ":const:`None` is now permitted as ``Y`` in ``raise X from Y``." msgstr "" -#: reference/simple_stmts.rst:667 +#: reference/simple_stmts.rst:672 msgid "" "Added the :attr:`~BaseException.__suppress_context__` attribute to suppress " "automatic display of the exception context." msgstr "" -#: reference/simple_stmts.rst:670 +#: reference/simple_stmts.rst:675 msgid "" "If the traceback of the active exception is modified in an :keyword:`except` " "clause, a subsequent ``raise`` statement re-raises the exception with the " @@ -638,41 +753,41 @@ msgid "" "traceback it had when it was caught." msgstr "" -#: reference/simple_stmts.rst:679 +#: reference/simple_stmts.rst:684 msgid "The :keyword:`!break` statement" msgstr "" -#: reference/simple_stmts.rst:690 +#: reference/simple_stmts.rst:695 msgid "" ":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" "keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" -#: reference/simple_stmts.rst:697 +#: reference/simple_stmts.rst:702 msgid "" "It terminates the nearest enclosing loop, skipping the optional :keyword:`!" "else` clause if the loop has one." msgstr "" -#: reference/simple_stmts.rst:700 +#: reference/simple_stmts.rst:705 msgid "" "If a :keyword:`for` loop is terminated by :keyword:`break`, the loop control " "target keeps its current value." msgstr "" -#: reference/simple_stmts.rst:705 +#: reference/simple_stmts.rst:710 msgid "" "When :keyword:`break` passes control out of a :keyword:`try` statement with " "a :keyword:`finally` clause, that :keyword:`!finally` clause is executed " "before really leaving the loop." msgstr "" -#: reference/simple_stmts.rst:713 +#: reference/simple_stmts.rst:718 msgid "The :keyword:`!continue` statement" msgstr "" -#: reference/simple_stmts.rst:725 +#: reference/simple_stmts.rst:730 msgid "" ":keyword:`continue` may only occur syntactically nested in a :keyword:`for` " "or :keyword:`while` loop, but not nested in a function or class definition " @@ -680,41 +795,41 @@ msgid "" "loop." msgstr "" -#: reference/simple_stmts.rst:729 +#: reference/simple_stmts.rst:734 msgid "" "When :keyword:`continue` passes control out of a :keyword:`try` statement " "with a :keyword:`finally` clause, that :keyword:`!finally` clause is " "executed before really starting the next loop cycle." msgstr "" -#: reference/simple_stmts.rst:738 +#: reference/simple_stmts.rst:743 msgid "The :keyword:`!import` statement" msgstr "" -#: reference/simple_stmts.rst:759 +#: reference/simple_stmts.rst:764 msgid "" "The basic import statement (no :keyword:`from` clause) is executed in two " "steps:" msgstr "" -#: reference/simple_stmts.rst:762 +#: reference/simple_stmts.rst:767 msgid "find a module, loading and initializing it if necessary" msgstr "" -#: reference/simple_stmts.rst:763 +#: reference/simple_stmts.rst:768 msgid "" "define a name or names in the local namespace for the scope where the :" "keyword:`import` statement occurs." msgstr "" -#: reference/simple_stmts.rst:766 +#: reference/simple_stmts.rst:771 msgid "" "When the statement contains multiple clauses (separated by commas) the two " "steps are carried out separately for each clause, just as though the clauses " "had been separated out into individual import statements." msgstr "" -#: reference/simple_stmts.rst:771 +#: reference/simple_stmts.rst:776 msgid "" "The details of the first step, finding and loading modules, are described in " "greater detail in the section on the :ref:`import system `, " @@ -725,26 +840,26 @@ msgid "" "module, which includes execution of the module's code." msgstr "" -#: reference/simple_stmts.rst:779 +#: reference/simple_stmts.rst:784 msgid "" "If the requested module is retrieved successfully, it will be made available " "in the local namespace in one of three ways:" msgstr "" -#: reference/simple_stmts.rst:784 +#: reference/simple_stmts.rst:789 msgid "" "If the module name is followed by :keyword:`!as`, then the name following :" "keyword:`!as` is bound directly to the imported module." msgstr "" -#: reference/simple_stmts.rst:786 +#: reference/simple_stmts.rst:791 msgid "" "If no other name is specified, and the module being imported is a top level " "module, the module's name is bound in the local namespace as a reference to " "the imported module" msgstr "" -#: reference/simple_stmts.rst:789 +#: reference/simple_stmts.rst:794 msgid "" "If the module being imported is *not* a top level module, then the name of " "the top level package that contains the module is bound in the local " @@ -752,53 +867,65 @@ msgid "" "be accessed using its full qualified name rather than directly" msgstr "" -#: reference/simple_stmts.rst:799 +#: reference/simple_stmts.rst:804 msgid "The :keyword:`from` form uses a slightly more complex process:" msgstr "" -#: reference/simple_stmts.rst:801 +#: reference/simple_stmts.rst:806 msgid "" "find the module specified in the :keyword:`from` clause, loading and " "initializing it if necessary;" msgstr "" -#: reference/simple_stmts.rst:803 +#: reference/simple_stmts.rst:808 msgid "for each of the identifiers specified in the :keyword:`import` clauses:" msgstr "" -#: reference/simple_stmts.rst:805 +#: reference/simple_stmts.rst:810 msgid "check if the imported module has an attribute by that name" msgstr "" -#: reference/simple_stmts.rst:806 +#: reference/simple_stmts.rst:811 msgid "" "if not, attempt to import a submodule with that name and then check the " "imported module again for that attribute" msgstr "" -#: reference/simple_stmts.rst:808 +#: reference/simple_stmts.rst:813 msgid "if the attribute is not found, :exc:`ImportError` is raised." msgstr "" -#: reference/simple_stmts.rst:809 +#: reference/simple_stmts.rst:814 msgid "" "otherwise, a reference to that value is stored in the local namespace, using " "the name in the :keyword:`!as` clause if it is present, otherwise using the " "attribute name" msgstr "" -#: reference/simple_stmts.rst:813 +#: reference/simple_stmts.rst:818 msgid "Examples::" msgstr "" -#: reference/simple_stmts.rst:823 +#: reference/simple_stmts.rst:820 +msgid "" +"import foo # foo imported and bound locally\n" +"import foo.bar.baz # foo, foo.bar, and foo.bar.baz imported, foo " +"bound locally\n" +"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, foo.bar." +"baz bound as fbb\n" +"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, foo.bar." +"baz bound as baz\n" +"from foo import attr # foo imported and foo.attr bound as attr" +msgstr "" + +#: reference/simple_stmts.rst:828 msgid "" "If the list of identifiers is replaced by a star (``'*'``), all public names " "defined in the module are bound in the local namespace for the scope where " "the :keyword:`import` statement occurs." msgstr "" -#: reference/simple_stmts.rst:829 +#: reference/simple_stmts.rst:837 msgid "" "The *public names* defined by a module are determined by checking the " "module's namespace for a variable named ``__all__``; if defined, it must be " @@ -811,14 +938,14 @@ msgid "" "API (such as library modules which were imported and used within the module)." msgstr "" -#: reference/simple_stmts.rst:839 +#: reference/simple_stmts.rst:847 msgid "" "The wild card form of import --- ``from module import *`` --- is only " "allowed at the module level. Attempting to use it in class or function " "definitions will raise a :exc:`SyntaxError`." msgstr "" -#: reference/simple_stmts.rst:846 +#: reference/simple_stmts.rst:854 msgid "" "When specifying what module to import you do not have to specify the " "absolute name of the module. When a module or package is contained within " @@ -835,31 +962,31 @@ msgid "" "the :ref:`relativeimports` section." msgstr "" -#: reference/simple_stmts.rst:860 +#: reference/simple_stmts.rst:868 msgid "" ":func:`importlib.import_module` is provided to support applications that " "determine dynamically the modules to be loaded." msgstr "" -#: reference/simple_stmts.rst:863 +#: reference/simple_stmts.rst:871 msgid "" "Raises an :ref:`auditing event ` ``import`` with arguments " "``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." "path_hooks``." msgstr "" -#: reference/simple_stmts.rst:868 +#: reference/simple_stmts.rst:876 msgid "Future statements" msgstr "" -#: reference/simple_stmts.rst:874 +#: reference/simple_stmts.rst:882 msgid "" "A :dfn:`future statement` is a directive to the compiler that a particular " "module should be compiled using syntax or semantics that will be available " "in a specified future release of Python where the feature becomes standard." msgstr "" -#: reference/simple_stmts.rst:878 +#: reference/simple_stmts.rst:886 msgid "" "The future statement is intended to ease migration to future versions of " "Python that introduce incompatible changes to the language. It allows use " @@ -867,35 +994,35 @@ msgid "" "feature becomes standard." msgstr "" -#: reference/simple_stmts.rst:890 +#: reference/simple_stmts.rst:898 msgid "" "A future statement must appear near the top of the module. The only lines " "that can appear before a future statement are:" msgstr "" -#: reference/simple_stmts.rst:893 +#: reference/simple_stmts.rst:901 msgid "the module docstring (if any)," msgstr "" -#: reference/simple_stmts.rst:894 +#: reference/simple_stmts.rst:902 msgid "comments," msgstr "" -#: reference/simple_stmts.rst:895 +#: reference/simple_stmts.rst:903 msgid "blank lines, and" msgstr "" -#: reference/simple_stmts.rst:896 +#: reference/simple_stmts.rst:904 msgid "other future statements." msgstr "" -#: reference/simple_stmts.rst:898 +#: reference/simple_stmts.rst:906 msgid "" "The only feature that requires using the future statement is ``annotations`` " "(see :pep:`563`)." msgstr "" -#: reference/simple_stmts.rst:901 +#: reference/simple_stmts.rst:909 msgid "" "All historical features enabled by the future statement are still recognized " "by Python 3. The list includes ``absolute_import``, ``division``, " @@ -905,7 +1032,7 @@ msgid "" "compatibility." msgstr "" -#: reference/simple_stmts.rst:908 +#: reference/simple_stmts.rst:916 msgid "" "A future statement is recognized and treated specially at compile time: " "Changes to the semantics of core constructs are often implemented by " @@ -915,37 +1042,41 @@ msgid "" "cannot be pushed off until runtime." msgstr "" -#: reference/simple_stmts.rst:915 +#: reference/simple_stmts.rst:923 msgid "" "For any given release, the compiler knows which feature names have been " "defined, and raises a compile-time error if a future statement contains a " "feature not known to it." msgstr "" -#: reference/simple_stmts.rst:919 +#: reference/simple_stmts.rst:927 msgid "" "The direct runtime semantics are the same as for any import statement: there " "is a standard module :mod:`__future__`, described later, and it will be " "imported in the usual way at the time the future statement is executed." msgstr "" -#: reference/simple_stmts.rst:923 +#: reference/simple_stmts.rst:931 msgid "" "The interesting runtime semantics depend on the specific feature enabled by " "the future statement." msgstr "" -#: reference/simple_stmts.rst:926 +#: reference/simple_stmts.rst:934 msgid "Note that there is nothing special about the statement::" msgstr "" -#: reference/simple_stmts.rst:930 +#: reference/simple_stmts.rst:936 +msgid "import __future__ [as name]" +msgstr "" + +#: reference/simple_stmts.rst:938 msgid "" "That is not a future statement; it's an ordinary import statement with no " "special semantics or syntax restrictions." msgstr "" -#: reference/simple_stmts.rst:933 +#: reference/simple_stmts.rst:941 msgid "" "Code compiled by calls to the built-in functions :func:`exec` and :func:" "`compile` that occur in a module :mod:`!M` containing a future statement " @@ -954,7 +1085,7 @@ msgid "" "--- see the documentation of that function for details." msgstr "" -#: reference/simple_stmts.rst:939 +#: reference/simple_stmts.rst:947 msgid "" "A future statement typed at an interactive interpreter prompt will take " "effect for the rest of the interpreter session. If an interpreter is " @@ -963,49 +1094,43 @@ msgid "" "interactive session started after the script is executed." msgstr "" -#: reference/simple_stmts.rst:947 +#: reference/simple_stmts.rst:955 msgid ":pep:`236` - Back to the __future__" msgstr "" -#: reference/simple_stmts.rst:948 +#: reference/simple_stmts.rst:956 msgid "The original proposal for the __future__ mechanism." msgstr "" -#: reference/simple_stmts.rst:954 +#: reference/simple_stmts.rst:962 msgid "The :keyword:`!global` statement" msgstr "" -#: reference/simple_stmts.rst:964 +#: reference/simple_stmts.rst:972 msgid "" -"The :keyword:`global` statement is a declaration which holds for the entire " -"current code block. It means that the listed identifiers are to be " -"interpreted as globals. It would be impossible to assign to a global " +"The :keyword:`global` statement causes the listed identifiers to be " +"interpreted as globals. It would be impossible to assign to a global " "variable without :keyword:`!global`, although free variables may refer to " "globals without being declared global." msgstr "" -#: reference/simple_stmts.rst:970 +#: reference/simple_stmts.rst:977 msgid "" -"Names listed in a :keyword:`global` statement must not be used in the same " -"code block textually preceding that :keyword:`!global` statement." +"The :keyword:`!global` statement applies to the entire current scope " +"(module, function body or class definition). A :exc:`SyntaxError` is raised " +"if a variable is used or assigned to prior to its global declaration in the " +"scope." msgstr "" -#: reference/simple_stmts.rst:973 +#: reference/simple_stmts.rst:982 msgid "" -"Names listed in a :keyword:`global` statement must not be defined as formal " -"parameters, or as targets in :keyword:`with` statements or :keyword:`except` " -"clauses, or in a :keyword:`for` target list, :keyword:`class` definition, " -"function definition, :keyword:`import` statement, or variable annotation." +"At the module level, all variables are global, so a :keyword:`!global` " +"statement has no effect. However, variables must still not be used or " +"assigned to prior to their :keyword:`!global` declaration. This requirement " +"is relaxed in the interactive prompt (:term:`REPL`)." msgstr "" -#: reference/simple_stmts.rst:980 -msgid "" -"The current implementation does not enforce some of these restrictions, but " -"programs should not abuse this freedom, as future implementations may " -"enforce them or silently change the meaning of the program." -msgstr "" - -#: reference/simple_stmts.rst:989 +#: reference/simple_stmts.rst:993 msgid "" "**Programmer's note:** :keyword:`global` is a directive to the parser. It " "applies only to code parsed at the same time as the :keyword:`!global` " @@ -1017,66 +1142,80 @@ msgid "" "func:`compile` functions." msgstr "" -#: reference/simple_stmts.rst:1001 +#: reference/simple_stmts.rst:1005 msgid "The :keyword:`!nonlocal` statement" msgstr "" -#: reference/simple_stmts.rst:1009 -msgid "" -"The :keyword:`nonlocal` statement causes the listed identifiers to refer to " -"previously bound variables in the nearest enclosing scope excluding globals. " -"This is important because the default behavior for binding is to search the " -"local namespace first. The statement allows encapsulated code to rebind " -"variables outside of the local scope besides the global (module) scope." -msgstr "" - -#: reference/simple_stmts.rst:1015 +#: reference/simple_stmts.rst:1013 msgid "" -"Names listed in a :keyword:`nonlocal` statement, unlike those listed in a :" -"keyword:`global` statement, must refer to pre-existing bindings in an " -"enclosing scope (the scope in which a new binding should be created cannot " -"be determined unambiguously)." +"When the definition of a function or class is nested (enclosed) within the " +"definitions of other functions, its nonlocal scopes are the local scopes of " +"the enclosing functions. The :keyword:`nonlocal` statement causes the listed " +"identifiers to refer to names previously bound in nonlocal scopes. It allows " +"encapsulated code to rebind such nonlocal identifiers. If a name is bound " +"in more than one nonlocal scope, the nearest binding is used. If a name is " +"not bound in any nonlocal scope, or if there is no nonlocal scope, a :exc:" +"`SyntaxError` is raised." msgstr "" -#: reference/simple_stmts.rst:1020 +#: reference/simple_stmts.rst:1022 msgid "" -"Names listed in a :keyword:`nonlocal` statement must not collide with pre-" -"existing bindings in the local scope." +"The :keyword:`nonlocal` statement applies to the entire scope of a function " +"or class body. A :exc:`SyntaxError` is raised if a variable is used or " +"assigned to prior to its nonlocal declaration in the scope." msgstr "" -#: reference/simple_stmts.rst:1025 +#: reference/simple_stmts.rst:1028 msgid ":pep:`3104` - Access to Names in Outer Scopes" msgstr "" -#: reference/simple_stmts.rst:1026 +#: reference/simple_stmts.rst:1029 msgid "The specification for the :keyword:`nonlocal` statement." msgstr "" #: reference/simple_stmts.rst:1031 +msgid "" +"**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " +"applies only to code parsed along with it. See the note for the :keyword:" +"`global` statement." +msgstr "" + +#: reference/simple_stmts.rst:1039 msgid "The :keyword:`!type` statement" msgstr "" -#: reference/simple_stmts.rst:1038 +#: reference/simple_stmts.rst:1046 msgid "" "The :keyword:`!type` statement declares a type alias, which is an instance " "of :class:`typing.TypeAliasType`." msgstr "" -#: reference/simple_stmts.rst:1041 +#: reference/simple_stmts.rst:1049 msgid "For example, the following statement creates a type alias::" msgstr "" -#: reference/simple_stmts.rst:1045 +#: reference/simple_stmts.rst:1051 +msgid "type Point = tuple[float, float]" +msgstr "" + +#: reference/simple_stmts.rst:1053 msgid "This code is roughly equivalent to::" msgstr "" -#: reference/simple_stmts.rst:1051 +#: reference/simple_stmts.rst:1055 +msgid "" +"annotation-def VALUE_OF_Point():\n" +" return tuple[float, float]\n" +"Point = typing.TypeAliasType(\"Point\", VALUE_OF_Point())" +msgstr "" + +#: reference/simple_stmts.rst:1059 msgid "" "``annotation-def`` indicates an :ref:`annotation scope `, " "which behaves mostly like a function, but with several small differences." msgstr "" -#: reference/simple_stmts.rst:1054 +#: reference/simple_stmts.rst:1062 msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " @@ -1085,21 +1224,21 @@ msgid "" "not yet defined." msgstr "" -#: reference/simple_stmts.rst:1060 +#: reference/simple_stmts.rst:1068 msgid "" "Type aliases may be made generic by adding a :ref:`type parameter list ` after the name. See :ref:`generic-type-aliases` for more." msgstr "" -#: reference/simple_stmts.rst:1063 +#: reference/simple_stmts.rst:1071 msgid ":keyword:`!type` is a :ref:`soft keyword `." msgstr "" -#: reference/simple_stmts.rst:1070 +#: reference/simple_stmts.rst:1077 msgid ":pep:`695` - Type Parameter Syntax" msgstr "" -#: reference/simple_stmts.rst:1070 +#: reference/simple_stmts.rst:1078 msgid "" "Introduced the :keyword:`!type` statement and syntax for generic classes and " "functions." @@ -1110,10 +1249,10 @@ msgid "simple" msgstr "" #: reference/simple_stmts.rst:39 reference/simple_stmts.rst:263 -#: reference/simple_stmts.rst:379 reference/simple_stmts.rst:444 -#: reference/simple_stmts.rst:483 reference/simple_stmts.rst:556 -#: reference/simple_stmts.rst:715 reference/simple_stmts.rst:870 -#: reference/simple_stmts.rst:1003 reference/simple_stmts.rst:1033 +#: reference/simple_stmts.rst:384 reference/simple_stmts.rst:449 +#: reference/simple_stmts.rst:488 reference/simple_stmts.rst:561 +#: reference/simple_stmts.rst:720 reference/simple_stmts.rst:878 +#: reference/simple_stmts.rst:1007 reference/simple_stmts.rst:1041 msgid "statement" msgstr "" @@ -1122,11 +1261,11 @@ msgid "expression" msgstr "" #: reference/simple_stmts.rst:42 reference/simple_stmts.rst:116 -#: reference/simple_stmts.rst:444 +#: reference/simple_stmts.rst:449 msgid "list" msgstr "" -#: reference/simple_stmts.rst:984 +#: reference/simple_stmts.rst:988 msgid "built-in function" msgstr "" @@ -1135,7 +1274,7 @@ msgid "repr" msgstr "" #: reference/simple_stmts.rst:75 reference/simple_stmts.rst:196 -#: reference/simple_stmts.rst:578 +#: reference/simple_stmts.rst:583 msgid "object" msgstr "" @@ -1188,12 +1327,12 @@ msgstr "" msgid "assignment" msgstr "" -#: reference/simple_stmts.rst:740 reference/simple_stmts.rst:956 +#: reference/simple_stmts.rst:745 reference/simple_stmts.rst:964 msgid "binding" msgstr "" -#: reference/simple_stmts.rst:457 reference/simple_stmts.rst:795 -#: reference/simple_stmts.rst:956 +#: reference/simple_stmts.rst:462 reference/simple_stmts.rst:800 +#: reference/simple_stmts.rst:964 msgid "name" msgstr "" @@ -1205,16 +1344,16 @@ msgstr "" msgid "mutable" msgstr "" -#: reference/simple_stmts.rst:159 reference/simple_stmts.rst:466 +#: reference/simple_stmts.rst:159 reference/simple_stmts.rst:471 msgid "attribute" msgstr "" -#: reference/simple_stmts.rst:116 reference/simple_stmts.rst:694 +#: reference/simple_stmts.rst:116 reference/simple_stmts.rst:699 msgid "target" msgstr "" -#: reference/simple_stmts.rst:379 reference/simple_stmts.rst:956 -#: reference/simple_stmts.rst:1003 +#: reference/simple_stmts.rst:384 reference/simple_stmts.rst:964 +#: reference/simple_stmts.rst:1007 msgid ", (comma)" msgstr "" @@ -1222,7 +1361,7 @@ msgstr "" msgid "in target list" msgstr "" -#: reference/simple_stmts.rst:821 +#: reference/simple_stmts.rst:826 msgid "* (asterisk)" msgstr "" @@ -1338,228 +1477,228 @@ msgstr "" msgid "annotated variable" msgstr "" -#: reference/simple_stmts.rst:379 +#: reference/simple_stmts.rst:384 msgid "assert" msgstr "" -#: reference/simple_stmts.rst:379 +#: reference/simple_stmts.rst:384 msgid "debugging" msgstr "" -#: reference/simple_stmts.rst:379 +#: reference/simple_stmts.rst:384 msgid "assertions" msgstr "" -#: reference/simple_stmts.rst:379 +#: reference/simple_stmts.rst:384 msgid "expression list" msgstr "" -#: reference/simple_stmts.rst:400 +#: reference/simple_stmts.rst:405 msgid "__debug__" msgstr "" -#: reference/simple_stmts.rst:520 reference/simple_stmts.rst:588 -#: reference/simple_stmts.rst:740 +#: reference/simple_stmts.rst:525 reference/simple_stmts.rst:593 +#: reference/simple_stmts.rst:745 msgid "exception" msgstr "" -#: reference/simple_stmts.rst:400 +#: reference/simple_stmts.rst:405 msgid "AssertionError" msgstr "" -#: reference/simple_stmts.rst:422 +#: reference/simple_stmts.rst:427 msgid "pass" msgstr "" -#: reference/simple_stmts.rst:422 +#: reference/simple_stmts.rst:427 msgid "null" msgstr "" -#: reference/simple_stmts.rst:422 +#: reference/simple_stmts.rst:427 msgid "operation" msgstr "" -#: reference/simple_stmts.rst:444 +#: reference/simple_stmts.rst:449 msgid "del" msgstr "" -#: reference/simple_stmts.rst:466 +#: reference/simple_stmts.rst:471 msgid "deletion" msgstr "" -#: reference/simple_stmts.rst:956 +#: reference/simple_stmts.rst:964 msgid "global" msgstr "" -#: reference/simple_stmts.rst:457 +#: reference/simple_stmts.rst:462 msgid "unbinding" msgstr "" -#: reference/simple_stmts.rst:483 +#: reference/simple_stmts.rst:488 msgid "return" msgstr "" -#: reference/simple_stmts.rst:520 +#: reference/simple_stmts.rst:525 msgid "function" msgstr "" -#: reference/simple_stmts.rst:483 +#: reference/simple_stmts.rst:488 msgid "definition" msgstr "" -#: reference/simple_stmts.rst:483 +#: reference/simple_stmts.rst:488 msgid "class" msgstr "" -#: reference/simple_stmts.rst:694 reference/simple_stmts.rst:715 -#: reference/simple_stmts.rst:740 +#: reference/simple_stmts.rst:699 reference/simple_stmts.rst:720 +#: reference/simple_stmts.rst:745 msgid "keyword" msgstr "" -#: reference/simple_stmts.rst:703 reference/simple_stmts.rst:715 +#: reference/simple_stmts.rst:708 reference/simple_stmts.rst:720 msgid "finally" msgstr "" -#: reference/simple_stmts.rst:520 +#: reference/simple_stmts.rst:525 msgid "yield" msgstr "" -#: reference/simple_stmts.rst:520 +#: reference/simple_stmts.rst:525 msgid "generator" msgstr "" -#: reference/simple_stmts.rst:520 +#: reference/simple_stmts.rst:525 msgid "iterator" msgstr "" -#: reference/simple_stmts.rst:520 +#: reference/simple_stmts.rst:525 msgid "StopIteration" msgstr "" -#: reference/simple_stmts.rst:556 +#: reference/simple_stmts.rst:561 msgid "raise" msgstr "" -#: reference/simple_stmts.rst:556 +#: reference/simple_stmts.rst:561 msgid "raising" msgstr "" -#: reference/simple_stmts.rst:556 +#: reference/simple_stmts.rst:561 msgid "__traceback__ (exception attribute)" msgstr "" -#: reference/simple_stmts.rst:578 +#: reference/simple_stmts.rst:583 msgid "traceback" msgstr "" -#: reference/simple_stmts.rst:588 +#: reference/simple_stmts.rst:593 msgid "chaining" msgstr "" -#: reference/simple_stmts.rst:588 +#: reference/simple_stmts.rst:593 msgid "__cause__ (exception attribute)" msgstr "" -#: reference/simple_stmts.rst:588 +#: reference/simple_stmts.rst:593 msgid "__context__ (exception attribute)" msgstr "" -#: reference/simple_stmts.rst:681 +#: reference/simple_stmts.rst:686 msgid "break" msgstr "" -#: reference/simple_stmts.rst:715 +#: reference/simple_stmts.rst:720 msgid "for" msgstr "" -#: reference/simple_stmts.rst:715 +#: reference/simple_stmts.rst:720 msgid "while" msgstr "" -#: reference/simple_stmts.rst:715 +#: reference/simple_stmts.rst:720 msgid "loop" msgstr "" -#: reference/simple_stmts.rst:694 +#: reference/simple_stmts.rst:699 msgid "else" msgstr "" -#: reference/simple_stmts.rst:694 +#: reference/simple_stmts.rst:699 msgid "loop control" msgstr "" -#: reference/simple_stmts.rst:715 +#: reference/simple_stmts.rst:720 msgid "continue" msgstr "" -#: reference/simple_stmts.rst:843 +#: reference/simple_stmts.rst:851 msgid "import" msgstr "" -#: reference/simple_stmts.rst:740 +#: reference/simple_stmts.rst:745 msgid "module" msgstr "" -#: reference/simple_stmts.rst:740 +#: reference/simple_stmts.rst:745 msgid "importing" msgstr "" -#: reference/simple_stmts.rst:795 +#: reference/simple_stmts.rst:800 msgid "from" msgstr "" -#: reference/simple_stmts.rst:782 +#: reference/simple_stmts.rst:787 msgid "as" msgstr "" -#: reference/simple_stmts.rst:740 +#: reference/simple_stmts.rst:745 msgid "ImportError" msgstr "" -#: reference/simple_stmts.rst:782 reference/simple_stmts.rst:821 +#: reference/simple_stmts.rst:787 reference/simple_stmts.rst:826 msgid "import statement" msgstr "" -#: reference/simple_stmts.rst:827 +#: reference/simple_stmts.rst:832 msgid "__all__ (optional module attribute)" msgstr "" -#: reference/simple_stmts.rst:843 +#: reference/simple_stmts.rst:851 msgid "relative" msgstr "" -#: reference/simple_stmts.rst:870 +#: reference/simple_stmts.rst:878 msgid "future" msgstr "" -#: reference/simple_stmts.rst:870 +#: reference/simple_stmts.rst:878 msgid "__future__" msgstr "" -#: reference/simple_stmts.rst:870 +#: reference/simple_stmts.rst:878 msgid "future statement" msgstr "" -#: reference/simple_stmts.rst:1003 +#: reference/simple_stmts.rst:1007 msgid "identifier list" msgstr "" -#: reference/simple_stmts.rst:984 +#: reference/simple_stmts.rst:988 msgid "exec" msgstr "" -#: reference/simple_stmts.rst:984 +#: reference/simple_stmts.rst:988 msgid "eval" msgstr "" -#: reference/simple_stmts.rst:984 +#: reference/simple_stmts.rst:988 msgid "compile" msgstr "" -#: reference/simple_stmts.rst:1003 +#: reference/simple_stmts.rst:1007 msgid "nonlocal" msgstr "" -#: reference/simple_stmts.rst:1033 +#: reference/simple_stmts.rst:1041 msgid "type" msgstr "" diff --git a/reference/toplevel_components.po b/reference/toplevel_components.po index f3972abe..60bfd64b 100644 --- a/reference/toplevel_components.po +++ b/reference/toplevel_components.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-12-07 19:15+0200\n" +"Last-Translator: Vassiliki Dalakiari \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: reference/toplevel_components.rst:6 msgid "Top-level components" -msgstr "" +msgstr "Συστατικά ανωτάτου επιπέδου" #: reference/toplevel_components.rst:10 msgid "" @@ -27,10 +28,15 @@ msgid "" "interactively, from a module source file, etc. This chapter gives the " "syntax used in these cases." msgstr "" +"Ο διερμηνέας της Python μπορεί να λάβει την είσοδό του από διάφορες πηγές: " +"από ένα script που του δίνεται ως τυπική είσοδος ή ως όρισμα προγράμματος, " +"πληκτρολογημένο διαδραστικά, από ένα αρχείο πηγαίου κώδικα που περιέχει ένα " +"module, κ.λπ. Αυτό το κεφάλαιο παραθέτει τη σύνταξη που χρησιμοποιείται σε " +"αυτές τις περιπτώσεις." #: reference/toplevel_components.rst:19 msgid "Complete Python programs" -msgstr "" +msgstr "Πλήρη προγράμματα Python" #: reference/toplevel_components.rst:28 msgid "" @@ -43,12 +49,23 @@ msgid "" "`__main__`. The latter is used to provide the local and global namespace " "for execution of the complete program." msgstr "" +"Αν και μια προδιαγραφή γλώσσας δεν χρειάζεται να ορίζει τον τρόπο κλήσης του " +"διερμηνέα της γλώσσας, είναι χρήσιμο να υπάρχει η έννοια ενός πλήρους Python " +"προγράμματος. Ένα πλήρες πρόγραμμα Python εκτελείται σε ένα ελάχιστα " +"αρχικοποιημένο περιβάλλον: όλα τα ενσωματωμένα και τυπικά modules είναι " +"διαθέσιμα, αλλά κανένα δεν έχει αρχικοποιηθεί, εκτός από τα :mod:`sys` " +"(διάφορες υπηρεσίες του συστήματος), :mod:`builtins` (ενσωματωμένες " +"συναρτήσεις, εξαιρέσεις και ``None``) και το :mod:`__main__`. Το τελευταίο " +"χρησιμοποιείται για να παρέχει τον τοπικό και καθολικό χώρο ονομάτων για την " +"εκτέλεση του πλήρους προγράμματος." #: reference/toplevel_components.rst:36 msgid "" "The syntax for a complete Python program is that for file input, described " "in the next section." msgstr "" +"Η σύνταξη για ένα πλήρες πρόγραμμα Python είναι αυτή της εισόδου από αρχείο, " +"που περιγράφεται στην επόμενη ενότητα." #: reference/toplevel_components.rst:43 msgid "" @@ -58,6 +75,11 @@ msgid "" "identical to that of a complete program; each statement is executed in the " "namespace of :mod:`__main__`." msgstr "" +"Ο διερμηνέας μπορεί επίσης να κληθεί σε διαδραστική λειτουργία· σε αυτήν την " +"περίπτωση, δεν διαβάζει και δεν εκτελεί ένα πλήρες πρόγραμμα αλλά διαβάζει " +"και εκτελεί μία εντολή (πιθανώς σύνθετη) κάθε φορά. Το αρχικό περιβάλλον " +"είναι πανομοιότυπο με αυτό ενός πλήρους προγράμματος· κάθε εντολή εκτελείται " +"στον χώρο ονομάτων του :mod:`__main__`." #: reference/toplevel_components.rst:55 msgid "" @@ -67,108 +89,125 @@ msgid "" "is a tty device, the interpreter enters interactive mode; otherwise, it " "executes the file as a complete program." msgstr "" +"Ένα πλήρες πρόγραμμα μπορεί να δοθεί στον διερμηνέα με τρεις μορφές: με την " +"επιλογή γραμμής εντολών :option:`-c` *string*, ως αρχείο που δίνεται ως το " +"πρώτο όρισμα της γραμμής εντολών, ή ως τυπική είσοδος. Εάν το αρχείο ή η " +"τυπική είσοδος είναι μια συσκευή tty, ο διερμηνέας εισέρχεται σε διαδραστική " +"λειτουργία· διαφορετικά, εκτελεί το αρχείο ως πλήρες πρόγραμμα." #: reference/toplevel_components.rst:65 msgid "File input" -msgstr "" +msgstr "Είσοδος από αρχείο" #: reference/toplevel_components.rst:67 msgid "All input read from non-interactive files has the same form:" msgstr "" +"Όλη η είσοδος που διαβάζεται από μη διαδραστικά αρχεία έχει την ίδια μορφή:" -#: reference/toplevel_components.rst:72 +#: reference/toplevel_components.rst:74 msgid "This syntax is used in the following situations:" -msgstr "" +msgstr "Αυτή η σύνταξη χρησιμοποιείται στις ακόλουθες περιπτώσεις:" -#: reference/toplevel_components.rst:74 +#: reference/toplevel_components.rst:76 msgid "when parsing a complete Python program (from a file or from a string);" msgstr "" +"κατά την ανάλυση ενός πλήρους προγράμματος Python (από αρχείο ή από " +"συμβολοσειρά)·" -#: reference/toplevel_components.rst:76 +#: reference/toplevel_components.rst:78 msgid "when parsing a module;" -msgstr "" +msgstr "κατά την ανάλυση ενός module·" -#: reference/toplevel_components.rst:78 +#: reference/toplevel_components.rst:80 msgid "when parsing a string passed to the :func:`exec` function;" msgstr "" +"κατά την ανάλυση μιας συμβολοσειράς που δίνεται στη συνάρτηση :func:`exec`·" -#: reference/toplevel_components.rst:84 +#: reference/toplevel_components.rst:86 msgid "Interactive input" -msgstr "" +msgstr "Διαδραστική είσοδος" -#: reference/toplevel_components.rst:86 +#: reference/toplevel_components.rst:88 msgid "Input in interactive mode is parsed using the following grammar:" msgstr "" +"Η είσοδος σε διαδραστική λειτουργία αναλύεται χρησιμοποιώντας την ακόλουθη " +"γραμματική:" -#: reference/toplevel_components.rst:91 +#: reference/toplevel_components.rst:95 msgid "" "Note that a (top-level) compound statement must be followed by a blank line " "in interactive mode; this is needed to help the parser detect the end of the " "input." msgstr "" +"Σημειώστε ότι μια (ανωτάτου επιπέδου) σύνθετη εντολή πρέπει να ακολουθείται " +"από μια κενή γραμμή σε διαδραστική λειτουργία· αυτό είναι απαραίτητο για να " +"βοηθήσει τον αναλυτή να εντοπίσει το τέλος της εισόδου." -#: reference/toplevel_components.rst:98 +#: reference/toplevel_components.rst:102 msgid "Expression input" -msgstr "" +msgstr "Είσοδος έκφρασης" -#: reference/toplevel_components.rst:103 +#: reference/toplevel_components.rst:107 msgid "" ":func:`eval` is used for expression input. It ignores leading whitespace. " "The string argument to :func:`eval` must have the following form:" msgstr "" +"Η :func:`eval` χρησιμοποιείται για την είσοδο των εκφράσεων. Αγνοεί τα " +"αρχικά κενά. Το όρισμα συμβολοσειράς στη :func:`eval` πρέπει να έχει την " +"ακόλουθη μορφή:" #: reference/toplevel_components.rst:8 msgid "interpreter" -msgstr "" +msgstr "διερμηνέας" #: reference/toplevel_components.rst:21 msgid "program" -msgstr "" +msgstr "πρόγραμμα" #: reference/toplevel_components.rst:23 reference/toplevel_components.rst:39 msgid "module" -msgstr "" +msgstr "module" #: reference/toplevel_components.rst:23 msgid "sys" -msgstr "" +msgstr "sys" #: reference/toplevel_components.rst:23 reference/toplevel_components.rst:39 msgid "__main__" -msgstr "" +msgstr "__main__" #: reference/toplevel_components.rst:23 msgid "builtins" -msgstr "" +msgstr "builtins" #: reference/toplevel_components.rst:39 msgid "interactive mode" -msgstr "" +msgstr "διαδραστική λειτουργία" #: reference/toplevel_components.rst:49 msgid "UNIX" -msgstr "" +msgstr "UNIX" #: reference/toplevel_components.rst:49 msgid "Windows" -msgstr "" +msgstr "Windows" #: reference/toplevel_components.rst:49 msgid "command line" -msgstr "" +msgstr "γραμμή εντολών" #: reference/toplevel_components.rst:49 msgid "standard input" -msgstr "" +msgstr "τυπική είσοδος" -#: reference/toplevel_components.rst:100 +#: reference/toplevel_components.rst:104 msgid "input" -msgstr "" +msgstr "είσοδος" -#: reference/toplevel_components.rst:101 +#: reference/toplevel_components.rst:105 msgid "built-in function" -msgstr "" +msgstr "ενσωματωμένη συνάρτηση" -#: reference/toplevel_components.rst:101 +#: reference/toplevel_components.rst:105 msgid "eval" -msgstr "" +msgstr "eval" diff --git a/requirements.txt b/requirements.txt index 8f30ddce..b407c0a9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,5 @@ -poutils==0.15.4 +-r cpython/Doc/requirements.txt +poutils==0.15.5 +potodo==0.23.1 pre-commit==3.7.1 - -# Rest of dependencies from cpython/Doc/requirements.txt -# Manually listed here so that we install sphinx version 5 -# and any version conflicts are avoided. -Sphinx==7.3.7 -blurb==1.1.0 -sphinxext-opengraph==0.9.1 -python-docs-theme==2024.4 --c cpython/Doc/constraints.txt +matplotlib==3.10.0 diff --git a/scripts/create_issues.py b/scripts/create_issues.py index e9455517..55536220 100644 --- a/scripts/create_issues.py +++ b/scripts/create_issues.py @@ -21,7 +21,7 @@ # (optional) GITHUB_MVP_MILESTONE: the id of the milestone for required translated # files of this version. Default is 2. # (optional) GITHUB_REPO: the github repo of the greek python translation. Default -# is pygreece/python-docs-gr. +# is pygreece/python-docs-el. # (optional) PYTHON_VERSION: the python version that all the issues created will # scope. # @@ -53,10 +53,10 @@ Παρακαλούμε, σχολιάστε μέσα στο issue εάν θέλετε αυτό το αρχείο να ανατεθεί σε σας. Ένα μέλος της διαχειριστικής ομάδας θα σας το αναθέσει το συντομότερο δυνατό, ώστε να μπορέσεται να το δουλέψετε. -Θυμηθείτε να ακουληθείσεται τις οδηγίες στον [οδηγό συνεισφοράς](https://github.com/pygreece/python-docs-gr/blob/main/CONTRIBUTING.md) +Θυμηθείτε να ακουληθείσεται τις οδηγίες στον [οδηγό συνεισφοράς](https://github.com/pygreece/python-docs-el/blob/main/CONTRIBUTING.md) """ GITHUB_MVP_MILESTONE = int(os.getenv("GITHUB_MVP_MILESTONE", 2)) -GITHUB_REPO = os.getenv("GITHUB_REPO", "pygreece/python-docs-gr") +GITHUB_REPO = os.getenv("GITHUB_REPO", "python/python-docs-el") GITHUB_SEVERITY_MAJOR_LABEL = "severity/major" GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") PYTHON_VERSION = os.getenv("PYTHON_VERSION", "3.12") diff --git a/sphinx.po b/sphinx.po index 4607e1b4..b13d6e64 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,288 +8,437 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-05-08 09:17+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 3.4.2\n" +#: tools/templates/_docs_by_version.html:10 +msgid "Stable" +msgstr "Σταθερή" + +#: tools/templates/_docs_by_version.html:11 +msgid "In development" +msgstr "Υπό ανάπτυξη" + #: tools/templates/customsourcelink.html:3 -msgid "This Page" -msgstr "Αυτή η Σελίδα" +msgid "This page" +msgstr "Αυτή η σελίδα" #: tools/templates/customsourcelink.html:5 -msgid "Report a Bug" -msgstr "Ανέφερε ένα Bug" +msgid "Report a bug" +msgstr "Ανέφερε ένα bug" #: tools/templates/customsourcelink.html:8 -msgid "Show Source" -msgstr "Εμφάνιση Πηγής" +msgid "Show source" +msgstr "Εμφάνιση πηγαίου" -#: tools/templates/dummy.html:6 -msgid "CPython implementation detail:" -msgstr "Λεπτομέρεια υλοποίησης CPython:" +#: tools/templates/download.html:2 tools/templates/indexsidebar.html:1 +msgid "Download" +msgstr "Κατεβάστε" + +#: tools/templates/download.html:30 +msgid "Download Python %(dl_version)s documentation" +msgstr "Κατεβάστε την τεκμηρίωση της Python %(dl_version)s" + +#: tools/templates/download.html:32 +msgid "Last updated on: %(last_updated)s." +msgstr "Τελευταία ενημέρωση στις: %(last_updated)s." -#: tools/templates/dummy.html:7 +#: tools/templates/download.html:34 msgid "" -"Deprecated since version {deprecated}, will be removed in version {removed}" +"Download an archive containing all the documentation for this version of " +"Python:" msgstr "" -"Καταργήθηκε στην έκδοση {deprecated}, θα αφαιρεθεί στην έκδοση {removed}" +"Για λήψη ενός αρχείου που περιέχει όλα τα έγγραφα για αυτήν την έκδοση της " +"Python:" -#: tools/templates/dummy.html:8 -msgid "Deprecated since version {deprecated}, removed in version {removed}" -msgstr "Καταργήθηκε στην έκδοση {deprecated}, αφαιρέθηκε στην έκδοση {removed}" +#: tools/templates/download.html:38 +msgid "Format" +msgstr "Διάταξη" -#: tools/templates/dummy.html:12 +#: tools/templates/download.html:39 +msgid "Packed as .zip" +msgstr "Συσκευασμένο ως .zip" + +#: tools/templates/download.html:40 +msgid "Packed as .tar.bz2" +msgstr "Συσκευασμένο ως .tar.bz2" + +#: tools/templates/download.html:43 +msgid "HTML" +msgstr "HTML" + +#: tools/templates/download.html:44 +msgid "" +"Download" +msgstr "" +"Download" + +#: tools/templates/download.html:45 +msgid "" +"Download" +msgstr "" +"Download" + +#: tools/templates/download.html:48 +msgid "Plain text" +msgstr "Απλό κείμενο" + +#: tools/templates/download.html:49 +msgid "" +"Download" +msgstr "" +"Download" + +#: tools/templates/download.html:50 +msgid "" +"Download" +msgstr "" +"Download" + +#: tools/templates/download.html:53 +msgid "Texinfo" +msgstr "Texinfo" + +#: tools/templates/download.html:54 +msgid "" +"Download" +msgstr "" +"Download" + +#: tools/templates/download.html:55 +msgid "" +"Download" +msgstr "" +"Download" + +#: tools/templates/download.html:58 +msgid "EPUB" +msgstr "EPUB" + +#: tools/templates/download.html:59 +msgid "Download" +msgstr "Download" + +#: tools/templates/download.html:64 +msgid "" +"\n" +"We no longer provide pre-built PDFs of the documentation.\n" +"To build a PDF archive, follow the instructions in the\n" +"Developer's Guide\n" +"and run make dist-pdf in the Doc/ directory of a " +"copy of the CPython repository.\n" +msgstr "" +"\n" +"Δεν παρέχουμε πλέον προ-κατασκευασμένα PDF της τεκμηρίωσης.\n" +"Για να δημιουργήσετε ένα αρχείο PDF, ακολουθήστε τις οδηγίες στο\n" +"Developer's Guide\n" +"και εκτελέστε make dist-pdf στον κατάλογο Doc/ " +"ενός αντιγράφου του αποθετηρίου CPython.\n" + +#: tools/templates/download.html:71 +msgid "" +"\n" +"See the directory " +"listing\n" +"for file sizes." +msgstr "" +"\n" +"Δείτε τον directory listing\n" +"για τα μεγέθη των αρχείων." + +#: tools/templates/download.html:75 +msgid "Problems" +msgstr "Προβλήματα" + +#: tools/templates/download.html:77 +msgid "" +"Open an issue\n" +"if you have comments or suggestions for the Python documentation." +msgstr "" +"Ανοίξτε ένα θέμα\n" +"εάν έχετε σχόλια ή προτάσεις για την τεκμηρίωση της Python." + +#: tools/templates/dummy.html:6 +msgid "Availability" +msgstr "Διαθεσιμότητα" + +#: tools/templates/dummy.html:10 msgid "Part of the" msgstr "Μέρος του" -#: tools/templates/dummy.html:13 +#: tools/templates/dummy.html:11 msgid "Limited API" msgstr "Περιορισμένο API" -#: tools/templates/dummy.html:14 +#: tools/templates/dummy.html:12 msgid "Stable ABI" msgstr "Σταθερό ABI" -#: tools/templates/dummy.html:15 +#: tools/templates/dummy.html:13 msgid "(as an opaque struct)" msgstr "(ως μια αδιαφανής κατασκευή)" -#: tools/templates/dummy.html:16 +#: tools/templates/dummy.html:14 msgid "(including all members)" msgstr "(συμπεριλαμβανομένων όλων των μελών)" -#: tools/templates/dummy.html:17 +#: tools/templates/dummy.html:15 msgid "since version %s" msgstr "από την έκδοση %s" -#: tools/templates/dummy.html:18 +#: tools/templates/dummy.html:16 msgid "(Only some members are part of the stable ABI.)" msgstr "(Μόνο ορισμένα μέλη αποτελούν μέρος του σταθερού ABI.)" -#: tools/templates/dummy.html:19 +#: tools/templates/dummy.html:17 msgid "This is" msgstr "Αυτό είναι" -#: tools/templates/dummy.html:20 +#: tools/templates/dummy.html:18 msgid "Unstable API" msgstr "Ασταθές API" -#: tools/templates/dummy.html:21 +#: tools/templates/dummy.html:19 msgid ". It may change without warning in minor releases." msgstr ". Μπορεί να αλλάξει χωρίς προειδοποίηση σε μικρές εκδόσεις." -#: tools/templates/dummy.html:22 +#: tools/templates/dummy.html:20 msgid "Return value: Always NULL." msgstr "Επιστρεφόμενη τιμή: Πάντοτε NULL." -#: tools/templates/dummy.html:23 +#: tools/templates/dummy.html:21 msgid "Return value: New reference." msgstr "Επιστρεφόμενη τιμή: New reference." -#: tools/templates/dummy.html:24 +#: tools/templates/dummy.html:22 msgid "Return value: Borrowed reference." msgstr "Επιστρεφόμενη τιμή: Borrowed reference." -#: tools/templates/dummy.html:28 +#: tools/templates/dummy.html:26 +msgid "CPython implementation detail:" +msgstr "Λεπτομέρεια υλοποίησης CPython:" + +#: tools/templates/dummy.html:30 +msgid "Deprecated since version %s, will be removed in version %s" +msgstr "Καταργήθηκε από την έκδοση %s, θα αφαιρεθεί στην έκδοση %s" + +#: tools/templates/dummy.html:31 +msgid "Deprecated since version %s, removed in version %s" +msgstr "Καταργήθηκε από την έκδοση %s, αφαιρέθηκε στην έκδοση %s" + +#: tools/templates/dummy.html:35 msgid "in development" msgstr "υπό ανάπτυξη" -#: tools/templates/dummy.html:29 +#: tools/templates/dummy.html:36 msgid "pre-release" msgstr "προέκδοση" -#: tools/templates/dummy.html:30 +#: tools/templates/dummy.html:37 msgid "stable" msgstr "σταθερή" -#: tools/templates/dummy.html:31 +#: tools/templates/dummy.html:38 msgid "security-fixes" msgstr "επιδιορθώσεις ασφαλείας" -#: tools/templates/dummy.html:32 +#: tools/templates/dummy.html:39 msgid "EOL" msgstr "EOL" -#: tools/templates/indexcontent.html:8 +#: tools/templates/indexcontent.html:21 msgid "Welcome! This is the official documentation for Python %(release)s." msgstr "" "Καλώς ήρθατε! Αυτό είναι η επίσημη τεκμηρίωση για την Python %(release)s." -#: tools/templates/indexcontent.html:10 -msgid "Parts of the documentation:" -msgstr "Μέρη της τεκμηρίωσης:" +#: tools/templates/indexcontent.html:23 +msgid "Documentation sections:" +msgstr "Ενότητες Τεκμηρίωσης:" -#: tools/templates/indexcontent.html:13 +#: tools/templates/indexcontent.html:26 msgid "What's new in Python %(version)s?" msgstr "Τι νέο υπάρχει στην Python %(version)s;" -#: tools/templates/indexcontent.html:14 +#: tools/templates/indexcontent.html:27 msgid "" -"or all \"What's new\" documents since 2.0" +"Or all \"What's new\" documents since Python " +"2.0" msgstr "" -"ή όλα \"Τι νέο υπάρχει\" έγγραφα από 2.0" +"Ή όλα \"Τι νέο υπάρχει\" έγγραφα από την " +"Python 2.0" -#: tools/templates/indexcontent.html:15 +#: tools/templates/indexcontent.html:28 msgid "Tutorial" msgstr "Tutorial" -#: tools/templates/indexcontent.html:16 -msgid "start here" -msgstr "ξεκινήστε εδώ" - -#: tools/templates/indexcontent.html:17 -msgid "Library Reference" -msgstr "Αναφορά Βιβλιοθήκης" - -#: tools/templates/indexcontent.html:18 -msgid "keep this under your pillow" -msgstr "κρατήστε αυτό κάτω κατά νου" - -#: tools/templates/indexcontent.html:19 -msgid "Language Reference" -msgstr "Γλωσσική Αναφορά" - -#: tools/templates/indexcontent.html:20 -msgid "describes syntax and language elements" -msgstr "περιγράφει συντακτικά και γλωσσικά στοιχεία" - -#: tools/templates/indexcontent.html:21 -msgid "Python Setup and Usage" -msgstr "Ρύθμιση και Χρήση της Python" - -#: tools/templates/indexcontent.html:22 -msgid "how to use Python on different platforms" -msgstr "πως να χρησιμοποιήσετε την Python σε διαφορετικές πλατφόρμες" - -#: tools/templates/indexcontent.html:23 -msgid "Python HOWTOs" -msgstr "Python HOWTOs" - -#: tools/templates/indexcontent.html:24 -msgid "in-depth documents on specific topics" -msgstr "σε βάθος έγγραφα για συγκεκριμένα θέματα" - -#: tools/templates/indexcontent.html:26 -msgid "Installing Python Modules" -msgstr "Εγκατάσταση Python Modules" - -#: tools/templates/indexcontent.html:27 -msgid "installing from the Python Package Index & other sources" -msgstr "εγκατάσταση από το Python Package Index & άλλες πηγές" - -#: tools/templates/indexcontent.html:28 -msgid "Distributing Python Modules" -msgstr "Διανομή Python Modules" - #: tools/templates/indexcontent.html:29 -msgid "publishing modules for installation by others" -msgstr "δημοσίευση modules για εγκατάσταση από άλλους" +msgid "Start here: a tour of Python's syntax and features" +msgstr "" +"Ξεκινήστε εδώ, μια περιήγηση στη σύνταξη και τις δυνατότητες της Python" #: tools/templates/indexcontent.html:30 -msgid "Extending and Embedding" -msgstr "Επέκταση και Ενσωμάτωση" +msgid "Library reference" +msgstr "Αναφορά βιβλιοθήκης" #: tools/templates/indexcontent.html:31 -msgid "tutorial for C/C++ programmers" -msgstr "tutorial για προγραμματιστές C/C++" +msgid "Standard library and builtins" +msgstr "Τυπική Βιβλιοθήκη και builtins" #: tools/templates/indexcontent.html:32 -msgid "Python/C API" -msgstr "Python/C API" +msgid "Language reference" +msgstr "Γλωσσική αναφορά" #: tools/templates/indexcontent.html:33 -msgid "reference for C/C++ programmers" -msgstr "αναφορά για προγραμματιστές C/C++" +msgid "Syntax and language elements" +msgstr "Συντακτικά και γλωσσικά στοιχεία" #: tools/templates/indexcontent.html:34 -msgid "FAQs" -msgstr "FAQs" +msgid "Python setup and usage" +msgstr "Ρύθμιση και χρήση της Python" #: tools/templates/indexcontent.html:35 -msgid "frequently asked questions (with answers!)" -msgstr "συχνές ερωτήσεις (με απαντήσεις!)" +msgid "How to install, configure, and use Python" +msgstr "Πως να εγκαταστήσετε, ρυθμίσετε, και χρησιμοποιήσετε την Python" + +#: tools/templates/indexcontent.html:36 +msgid "Python HOWTOs" +msgstr "Python HOWTOs" + +#: tools/templates/indexcontent.html:37 +msgid "In-depth topic manuals" +msgstr "Σε βάθος εγχειρίδια θεμάτων" #: tools/templates/indexcontent.html:39 -msgid "Indices and tables:" -msgstr "Δείκτες και πίνακες:" +msgid "Installing Python modules" +msgstr "Εγκατάσταση Python modules" + +#: tools/templates/indexcontent.html:40 +msgid "Third-party modules and PyPI.org" +msgstr "Modules τρίτων και PyPI.org" + +#: tools/templates/indexcontent.html:41 +msgid "Distributing Python modules" +msgstr "Διανομή Python modules" #: tools/templates/indexcontent.html:42 -msgid "Global Module Index" -msgstr "Global Module Index" +msgid "Publishing modules for use by other people" +msgstr "Δημοσίευση modules για χρήση από άλλους" #: tools/templates/indexcontent.html:43 -msgid "quick access to all modules" -msgstr "γρήγορη πρόσβαση σε όλα τα modules" +msgid "Extending and embedding" +msgstr "Επέκταση και ενσωμάτωση" #: tools/templates/indexcontent.html:44 -msgid "General Index" -msgstr "Γενικό Index" +msgid "For C/C++ programmers" +msgstr "Για προγραμματιστές C/C++" #: tools/templates/indexcontent.html:45 -msgid "all functions, classes, terms" -msgstr "όλες οι συναρτήσεις, οι κλάσεις, οι όροι" +msgid "Python's C API" +msgstr "Το C API της Python" #: tools/templates/indexcontent.html:46 -msgid "Glossary" -msgstr "Γλωσσάριο" +msgid "C API reference" +msgstr "Αναφορά C API" #: tools/templates/indexcontent.html:47 -msgid "the most important terms explained" -msgstr "οι πιο σημαντικοί όροι που εξηγούνται" +msgid "FAQs" +msgstr "FAQs" + +#: tools/templates/indexcontent.html:48 +msgid "Frequently asked questions (with answers!)" +msgstr "Συχνές ερωτήσεις (με απαντήσεις!)" #: tools/templates/indexcontent.html:49 -msgid "Search page" -msgstr "Αναζήτηση σελίδας" +msgid "Deprecations" +msgstr "Απαρχαιωμένες δυνατότητες" #: tools/templates/indexcontent.html:50 -msgid "search this documentation" -msgstr "αναζητήστε αυτήν την τεκμηρίωση" +msgid "Deprecated functionality" +msgstr "Απαρχαιωμένη λειτουργικότητα" -#: tools/templates/indexcontent.html:51 -msgid "Complete Table of Contents" -msgstr "Ολοκληρωμένος Πίνακας Περιεχομένων" +#: tools/templates/indexcontent.html:54 +msgid "Indices, glossary, and search:" +msgstr "Ευρετήρια, Γλωσσάριο, και αναζήτηση:" -#: tools/templates/indexcontent.html:52 -msgid "lists all sections and subsections" -msgstr "παραθέτει όλες τις ενότητες και τις υποενότητες" +#: tools/templates/indexcontent.html:57 +msgid "Global module index" +msgstr "Global module Index" -#: tools/templates/indexcontent.html:56 -msgid "Meta information:" -msgstr "Μετα-πληροφορίες:" +#: tools/templates/indexcontent.html:58 +msgid "All modules and libraries" +msgstr "Όλα τα modules και οι βιβλιοθήκες" #: tools/templates/indexcontent.html:59 -msgid "Reporting bugs" -msgstr "Αναφορά σφαλμάτων" +msgid "General index" +msgstr "Γενικό ευρετήριο" #: tools/templates/indexcontent.html:60 -msgid "Contributing to Docs" -msgstr "Συμβολή στην Τεκμηρίωση" +msgid "All functions, classes, and terms" +msgstr "Όλες οι συναρτήσεις, οι κλάσεις, οι όροι" #: tools/templates/indexcontent.html:61 -msgid "About the documentation" -msgstr "Σχετικά με την τεκμηρίωση" +msgid "Glossary" +msgstr "Γλωσσάριο" -#: tools/templates/indexcontent.html:63 -msgid "History and License of Python" -msgstr "Ιστορία και άδεια χρήσης της Python" +#: tools/templates/indexcontent.html:62 +msgid "Terms explained" +msgstr "Οι όροι εξηγούνται" #: tools/templates/indexcontent.html:64 -msgid "Copyright" -msgstr "Copyright" +msgid "Search page" +msgstr "Αναζήτηση σελίδας" #: tools/templates/indexcontent.html:65 +msgid "Search this documentation" +msgstr "Αναζητήστε αυτήν την τεκμηρίωση" + +#: tools/templates/indexcontent.html:66 +msgid "Complete table of contents" +msgstr "Ολοκληρωμένος πίνακας περιεχομένων" + +#: tools/templates/indexcontent.html:67 +msgid "Lists all sections and subsections" +msgstr "Παραθέτει όλες τις ενότητες και τις υποενότητες" + +#: tools/templates/indexcontent.html:71 +msgid "Project information:" +msgstr "Πληροφορίες έργου:" + +#: tools/templates/indexcontent.html:74 +msgid "Reporting issues" +msgstr "Αναφορά ζητημάτων" + +#: tools/templates/indexcontent.html:75 +msgid "Contributing to docs" +msgstr "Συμβολή στην τεκμηρίωση" + +#: tools/templates/indexcontent.html:76 msgid "Download the documentation" msgstr "Κατεβάστε την τεκμηρίωση" -#: tools/templates/indexsidebar.html:1 -msgid "Download" -msgstr "Κατεβάστε" +#: tools/templates/indexcontent.html:78 +msgid "History and license of Python" +msgstr "Ιστορία και άδεια της Python" + +#: tools/templates/indexcontent.html:79 +msgid "Copyright" +msgstr "Copyright" + +#: tools/templates/indexcontent.html:80 +msgid "About the documentation" +msgstr "Σχετικά με την τεκμηρίωση" #: tools/templates/indexsidebar.html:2 msgid "Download these documents" @@ -299,41 +448,33 @@ msgstr "Κατεβάστε αυτά τα έγγραφα" msgid "Docs by version" msgstr "Έγγραφα ανά έκδοση" -#: tools/templates/indexsidebar.html:5 -msgid "Stable" -msgstr "Σταθερή" - -#: tools/templates/indexsidebar.html:6 -msgid "In development" -msgstr "Υπό ανάπτυξη" - #: tools/templates/indexsidebar.html:7 msgid "All versions" msgstr "Όλες οι εκδόσεις" -#: tools/templates/indexsidebar.html:10 +#: tools/templates/indexsidebar.html:9 msgid "Other resources" msgstr "Άλλες πηγές" -#: tools/templates/indexsidebar.html:13 -msgid "PEP Index" +#: tools/templates/indexsidebar.html:12 +msgid "PEP index" msgstr "Ευρετήριο PEP" -#: tools/templates/indexsidebar.html:14 -msgid "Beginner's Guide" +#: tools/templates/indexsidebar.html:13 +msgid "Beginner's guide" msgstr "Οδηγός για αρχάριους" +#: tools/templates/indexsidebar.html:14 +msgid "Book list" +msgstr "Λίστα βιβλίων" + #: tools/templates/indexsidebar.html:15 -msgid "Book List" -msgstr "Λίστα Βιβλίων" +msgid "Audio/visual talks" +msgstr "Οπτικοακουστικές ομιλίες" #: tools/templates/indexsidebar.html:16 -msgid "Audio/Visual Talks" -msgstr "Οπτικοακουστικές Ομιλίες" - -#: tools/templates/indexsidebar.html:17 -msgid "Python Developer’s Guide" -msgstr "Οδηγός Προγραμματιστή Python" +msgid "Python developer’s guide" +msgstr "Οδηγός προγραμματιστή Python" #: tools/templates/layout.html:6 msgid "" @@ -361,3 +502,93 @@ msgstr "" #: tools/templates/layout.html:16 msgid "the current stable release" msgstr "η τρέχουσα σταθερή έκδοση" + +#~ msgid "PDF" +#~ msgstr "PDF" + +#~ msgid "" +#~ "Download (ca. %(download_size)s MiB)" +#~ msgstr "" +#~ "Download (ca. %(download_size)s MiB)" + +#~ msgid "" +#~ "Download (ca. %(download_size)s MiB)" +#~ msgstr "" +#~ "Download (ca. %(download_size)s MiB)" + +#~ msgid "These archives contain all the content in the documentation." +#~ msgstr "Αυτά τα αρχεία περιέχουν όλο το περιεχόμενο της τεκμηρίωσης." + +#~ msgid "Unpacking" +#~ msgstr "Αποσυμπίεση" + +#~ msgid "" +#~ "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" +#~ "archives and can be handled in the usual way using tar and the bzip2\n" +#~ "program. The Info-ZIP " +#~ "unzip program can be\n" +#~ "used to handle the ZIP archives if desired. The .tar.bz2 archives provide " +#~ "the\n" +#~ "best compression and fastest download times." +#~ msgstr "" +#~ "Οι χρήστες Unix θα πρέπει να κατεβάσουν τα αρχεία .tar.bz2· αυτά τα " +#~ "αρχεία tar\n" +#~ "archives με μορφή bzip μπορούν να τα χειριστούν με τον συνήθη τρόπο " +#~ "χρησιμοποιώντας το tar και το πρόγραμμα bzip2\n" +#~ ". Το πρόγραμμα αποσυμπίεσης Info-ZIP μπορεί να\n" +#~ " χρησιμοποιηθεί για το χειρισμό των αρχείων ZIP εάν το επιθυμείτε. Τα " +#~ "αρχεία .tar.bz2 παρέχουν την καλύτερη συμπίεση και τους ταχύτερους " +#~ "χρόνους λήψης." + +#~ msgid "" +#~ "Windows users can use the ZIP archives since those are customary on that\n" +#~ "platform. These are created on Unix using the Info-ZIP zip program." +#~ msgstr "" +#~ "Οι χρήστες των Windows μπορούν να χρησιμοποιήσουν τα αρχεία ZIP αφού αυτά " +#~ "είναι συνηθισμένα σε αυτήν την\n" +#~ "πλατφόρμα. Αυτά δημιουργούνται στο Unix χρησιμοποιώντας το πρόγραμμα zip " +#~ "Info-ZIP." + +#~ msgid "" +#~ "If you have comments or suggestions for the Python documentation, please " +#~ "send\n" +#~ "email to docs@python.org." +#~ msgstr "" +#~ "Εάν έχετε σχόλια ή προτάσεις για την τεκμηρίωση της Python, στείλτε\n" +#~ "email στη διεύθυνση docs@python.org." + +#~ msgid "Parts of the documentation:" +#~ msgstr "Μέρη της τεκμηρίωσης:" + +#~ msgid "start here" +#~ msgstr "ξεκινήστε εδώ" + +#~ msgid "keep this under your pillow" +#~ msgstr "κρατήστε αυτό κάτω κατά νου" + +#~ msgid "how to use Python on different platforms" +#~ msgstr "πως να χρησιμοποιήσετε την Python σε διαφορετικές πλατφόρμες" + +#~ msgid "in-depth documents on specific topics" +#~ msgstr "σε βάθος έγγραφα για συγκεκριμένα θέματα" + +#~ msgid "installing from the Python Package Index & other sources" +#~ msgstr "εγκατάσταση από το Python Package Index & άλλες πηγές" + +#~ msgid "reference for C/C++ programmers" +#~ msgstr "αναφορά για προγραμματιστές C/C++" + +#~ msgid "Indices and tables:" +#~ msgstr "Δείκτες και πίνακες:" + +#~ msgid "quick access to all modules" +#~ msgstr "γρήγορη πρόσβαση σε όλα τα modules" + +#~ msgid "the most important terms explained" +#~ msgstr "οι πιο σημαντικοί όροι που εξηγούνται" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index 735efb9b..09ecf01e 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-08-06 00:40+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2024-05-03 22:21+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -26,11 +26,62 @@ msgstr "Παράρτημα" msgid "Interactive Mode" msgstr "Διαδραστική Λειτουργία" -#: tutorial/appendix.rst:16 +#: tutorial/appendix.rst:13 +msgid "" +"There are two variants of the interactive :term:`REPL`. The classic basic " +"interpreter is supported on all platforms with minimal line control " +"capabilities." +msgstr "" +"Υπάρχουν δύο παραλλαγές του διαδραστικού :term:`REPL`. Ο κλασικός βασικός " +"διερμηνέας υποστηρίζει σε όλες τις πλατφόρμες με ελάχιστες δυνατότητες " +"ελέγχου γραμμής." + +#: tutorial/appendix.rst:17 +msgid "" +"On Windows, or Unix-like systems with :mod:`curses` support, a new " +"interactive shell is used by default since Python 3.13. This one supports " +"color, multiline editing, history browsing, and paste mode. To disable " +"color, see :ref:`using-on-controlling-color` for details. Function keys " +"provide some additional functionality. :kbd:`F1` enters the interactive help " +"browser :mod:`pydoc`. :kbd:`F2` allows for browsing command-line history " +"with neither output nor the :term:`>>>` and :term:`...` prompts. :kbd:`F3` " +"enters \"paste mode\", which makes pasting larger blocks of code easier. " +"Press :kbd:`F3` to return to the regular prompt." +msgstr "" +"Σε Windows ή συστήματα τύπου Unix με υποστήριξη :mod:`curses`, ένα νέο " +"διαδραστικό κέλυφος χρησιμοποιείται από προεπιλογή από την Python 3.13. Αυτό " +"υποστηρίζει χρώμα, επεξεργασία πολλαπλών γραμμών, περιήγηση στο ιστορικό και " +"λειτουργία επικόλλησης. Για να απενεργοποιήσετε το χρώμα, δείτε :ref:`using-" +"on-controlling-color` για λεπτομέρειες. Τα πλήκτρα λειτουργιών παρέχουν " +"επιπλέον λειτουργικότητα. :kbd:`F1` εισέρχεται στον διαδραστικό περιηγητή " +"βοήθειας :mod:`pydoc`. :kbd:`F2` επιτρέπει την περιήγηση στο ιστορικό " +"γραμμής εντολών χωρίς έξοδο ή τις προτροπές :term:`>>>` και :term:`...`. :" +"kbd:`F3` εισέρχεται στη \"λειτουργία επικόλλησης\", η οποία καθιστά την " +"επικόλληση μεγαλύτερων μπλοκ κώδικα πιο εύκολη. Πατήστε :kbd:`F3` για να " +"επιστρέψετε στην κανονική προτροπή." + +#: tutorial/appendix.rst:28 +msgid "" +"When using the new interactive shell, exit the shell by typing :kbd:`exit` " +"or :kbd:`quit`. Adding call parentheses after those commands is not required." +msgstr "" +"Όταν χρησιμοποιείτε το νέο διαδραστικό κέλυφος, βγείτε από το shell " +"πληκτρολογώντας :kbd:`exit` or :kbd:`quit`. Η προσθήκη παρενθέσεων κλήσης " +"μετά από αυτές τις εντολές δεν απαιτείται." + +#: tutorial/appendix.rst:32 +msgid "" +"If the new interactive shell is not desired, it can be disabled via the :" +"envvar:`PYTHON_BASIC_REPL` environment variable." +msgstr "" +"Εάν το νέο διαδραστικό shell δεν είναι επιθυμητό, μπορεί να απενεργοποιηθεί " +"μέσω της μεταβλητής περιβάλλοντος :envvar:`PYTHON_BASIC_REPL`." + +#: tutorial/appendix.rst:38 msgid "Error Handling" msgstr "Διαχείριση Σφαλμάτων" -#: tutorial/appendix.rst:18 +#: tutorial/appendix.rst:40 msgid "" "When an error occurs, the interpreter prints an error message and a stack " "trace. In interactive mode, it then returns to the primary prompt; when " @@ -54,7 +105,7 @@ msgstr "" "στην τυπική ροή σφαλμάτων∙ η κανονική έξοδος από τις εκτελεσμένες εντολές " "γράφεται στην τυπική έξοδο." -#: tutorial/appendix.rst:28 +#: tutorial/appendix.rst:50 msgid "" "Typing the interrupt character (usually :kbd:`Control-C` or :kbd:`Delete`) " "to the primary or secondary prompt cancels the input and returns to the " @@ -68,11 +119,11 @@ msgstr "" "εκτελείται μια εντολή δημιουργείται η εξαίρεση :exc:`KeyboardInterrupt`, η " "οποία μπορεί να αντιμετωπιστεί από μια πρόταση :keyword:`try`." -#: tutorial/appendix.rst:38 +#: tutorial/appendix.rst:60 msgid "Executable Python Scripts" msgstr "Εκτελέσιμα Python Scripts" -#: tutorial/appendix.rst:40 +#: tutorial/appendix.rst:62 msgid "" "On BSD'ish Unix systems, Python scripts can be made directly executable, " "like shell scripts, by putting the line ::" @@ -80,7 +131,11 @@ msgstr "" "Στα συστήματα BSD'ish Unix systems, τα Python scripts μπορούν να γίνουν " "άμεσα εκτελέσιμα, όπως τα shell scripts, βάζοντας τη γραμμή::" -#: tutorial/appendix.rst:45 +#: tutorial/appendix.rst:65 +msgid "#!/usr/bin/env python3" +msgstr "#!/usr/bin/env python3" + +#: tutorial/appendix.rst:67 msgid "" "(assuming that the interpreter is on the user's :envvar:`PATH`) at the " "beginning of the script and giving the file an executable mode. The ``#!`` " @@ -98,7 +153,7 @@ msgstr "" "κατακερματισμού, , ``'#'``, χρησιμοποιείται για την έναρξη ενός σχολίου στην " "Python." -#: tutorial/appendix.rst:52 +#: tutorial/appendix.rst:74 msgid "" "The script can be given an executable mode, or permission, using the :" "program:`chmod` command." @@ -106,7 +161,11 @@ msgstr "" "Το script μπορεί να δοθεί μια εκτελέσιμη λειτουργία ή άδεια, χρησιμοποιώντας " "την εντολή :program:`chmod`." -#: tutorial/appendix.rst:59 +#: tutorial/appendix.rst:77 +msgid "$ chmod +x myscript.py" +msgstr "$ chmod +x myscript.py" + +#: tutorial/appendix.rst:81 msgid "" "On Windows systems, there is no notion of an \"executable mode\". The " "Python installer automatically associates ``.py`` files with ``python.exe`` " @@ -120,11 +179,11 @@ msgstr "" "Python ως script. Η επέκταση μπορεί επίσης να είναι ``.pyw``, σε αυτήν την " "περίπτωση, το παράθυρο της κονσόλας που εμφανίζεται συνήθως αποκρύπτεται." -#: tutorial/appendix.rst:69 +#: tutorial/appendix.rst:91 msgid "The Interactive Startup File" msgstr "Το διαδραστικό αρχείο εκκίνησης" -#: tutorial/appendix.rst:71 +#: tutorial/appendix.rst:93 msgid "" "When you use Python interactively, it is frequently handy to have some " "standard commands executed every time the interpreter is started. You can " @@ -139,7 +198,7 @@ msgstr "" "εντολές εκκίνησης σας. Αυτό είναι παρόμοιο με το χαρακτηριστικό :file:`." "profile` στα Unix shells." -#: tutorial/appendix.rst:77 +#: tutorial/appendix.rst:99 msgid "" "This file is only read in interactive sessions, not when Python reads " "commands from a script, and not when :file:`/dev/tty` is given as the " @@ -158,7 +217,7 @@ msgstr "" "λειτουργίας. Μπορείτε επίσης να αλλάξετε τις προτροπές ``sys.ps1`` και ``sys." "ps2`` σε αυτό το αρχείο." -#: tutorial/appendix.rst:85 +#: tutorial/appendix.rst:107 msgid "" "If you want to read an additional start-up file from the current directory, " "you can program this in the global start-up file using code like ``if os." @@ -172,11 +231,27 @@ msgstr "" "pythonrc.py').read())``. Εάν θέλετε να χρησιμοποιήσετε το αρχείο εκκίνησης " "σε ένα σενάριο, πρέπει να το κάνετε ρητά στο script::" -#: tutorial/appendix.rst:102 +#: tutorial/appendix.rst:113 +msgid "" +"import os\n" +"filename = os.environ.get('PYTHONSTARTUP')\n" +"if filename and os.path.isfile(filename):\n" +" with open(filename) as fobj:\n" +" startup_file = fobj.read()\n" +" exec(startup_file)" +msgstr "" +"import os\n" +"filename = os.environ.get('PYTHONSTARTUP')\n" +"if filename and os.path.isfile(filename):\n" +" with open(filename) as fobj:\n" +" startup_file = fobj.read()\n" +" exec(startup_file)" + +#: tutorial/appendix.rst:124 msgid "The Customization Modules" msgstr "Τα Modules Προσαρμογής" -#: tutorial/appendix.rst:104 +#: tutorial/appendix.rst:126 msgid "" "Python provides two hooks to let you customize it: :index:`sitecustomize` " "and :index:`usercustomize`. To see how it works, you need first to find the " @@ -188,7 +263,17 @@ msgstr "" "λειτουργεί, πρέπει πρώτα να βρείτε τη θέση του καταλόγου πακέτων ιστοτόπων " "χρήστη. Ξεκινήστε την Python και εκτελέσετε αυτός ο κώδικας::" -#: tutorial/appendix.rst:112 +#: tutorial/appendix.rst:130 +msgid "" +">>> import site\n" +">>> site.getusersitepackages()\n" +"'/home/user/.local/lib/python3.x/site-packages'" +msgstr "" +">>> import site\n" +">>> site.getusersitepackages()\n" +"'/home/user/.local/lib/python3.x/site-packages'" + +#: tutorial/appendix.rst:134 msgid "" "Now you can create a file named :file:`usercustomize.py` in that directory " "and put anything you want in it. It will affect every invocation of Python, " @@ -200,7 +285,7 @@ msgstr "" "κάθε επίκληση της Python, εκτός εάν ξεκινήσει με την επιλογή :option:`-s` " "απενεργοποιήστε την αυτόματη εισαγωγή." -#: tutorial/appendix.rst:116 +#: tutorial/appendix.rst:138 msgid "" ":index:`sitecustomize` works in the same way, but is typically created by an " "administrator of the computer in the global site-packages directory, and is " @@ -212,10 +297,10 @@ msgstr "" "πακέτων τοποθεσιών και εισάγεται πριν από το :index:`usercustomize`. Δείτε " "την τεκμηρίωση του module :mod:`site` για περισσότερες λεπτομέρειες." -#: tutorial/appendix.rst:123 +#: tutorial/appendix.rst:145 msgid "Footnotes" msgstr "Υποσημειώσεις" -#: tutorial/appendix.rst:124 +#: tutorial/appendix.rst:146 msgid "A problem with the GNU Readline package may prevent this." msgstr "Ένα πρόβλημα με το πακέτο GNU Readline μπορεί να το αποτρέψει." diff --git a/tutorial/appetite.po b/tutorial/appetite.po index a571f3b4..07f42b7f 100644 --- a/tutorial/appetite.po +++ b/tutorial/appetite.po @@ -8,10 +8,9 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-08-02 13:10+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" "Language-Team: LANGUAGE \n" "Language: el\n" "MIME-Version: 1.0\n" diff --git a/tutorial/classes.po b/tutorial/classes.po index 8ec6fc1b..a5de0ed9 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -8,17 +8,19 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Anastasios Louka \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.5\n" #: tutorial/classes.rst:5 msgid "Classes" -msgstr "" +msgstr "Κλάσεις" #: tutorial/classes.rst:7 msgid "" @@ -28,6 +30,13 @@ msgid "" "attributes attached to it for maintaining its state. Class instances can " "also have methods (defined by its class) for modifying its state." msgstr "" +"Οι κλάσεις παρέχουν ένα μέσο ομαδοποίησης δεδομένων και λειτουργικότητας. Η " +"δημιουργία μιας νέας κλάσης δημιουργεί έναν νέο *τύπο* αντικειμένου, " +"επιτρέποντας νέα *στιγμιότυπα* αυτού του τύπου που πρόκειται να γίνουν. Κάθε " +"στιγμιότυπο κλάσης μπορεί να έχει χαρακτηριστικά που συνδέονται με αυτό για " +"τη διατήρηση της κατάστασής του. Τα στιγμιότυπα κλάσης μπορούν να έχουν " +"επίσης μεθόδους (που ορίζονται από την κλάση του) για την τροποποίηση της " +"κατάστασής του." #: tutorial/classes.rst:13 msgid "" @@ -42,6 +51,18 @@ msgid "" "nature of Python: they are created at runtime, and can be modified further " "after creation." msgstr "" +"Σε σύγκριση με άλλες γλώσσες προγραμματισμού, ο μηχανισμός κλάσης της Python " +"προσθέτει κλάσεις με ελάχιστο νέο συντακτικό και σημασιολογία. Είναι ένα " +"μείγμα των μηχανισμών κλάσεων που βρέθηκαν στη C++ και στο Modula-3. Οι " +"κλάσεις της Python παρέχουν όλα τα standard χαρακτηριστικά του " +"Αντικειμενοστραφούς Προγραμματισμού: ο μηχανισμός της κληρονομικότητας της " +"κλάσης επιτρέπει την ύπαρξη πολλαπλών βασικών κλάσεων, μια παραγόμενη κλάση " +"να μπορεί να παρακάμψει οποιεσδήποτε μεθόδους της βασικής κλάσης ή κλάσεων, " +"και μια μέθοδος να μπορεί να καλέσει τη μέθοδο μίας βασικής κλάσης με το " +"ίδιο όνομα. Τα αντικείμενα μπορούν να περιέχουν αυθαίρετα ποσά και είδη " +"δεδομένων. Όπως ισχύει για τα modules, οι κλάσεις συμμετέχουν στη δυναμική " +"φύση της Python: δημιουργούνται κατά το χρόνο εκτέλεσης και μπορούν να " +"τροποποιηθούν περαιτέρω μετά τη δημιουργία." #: tutorial/classes.rst:23 msgid "" @@ -57,6 +78,18 @@ msgid "" "(arithmetic operators, subscripting etc.) can be redefined for class " "instances." msgstr "" +"Στην ορολογία της C++, συνήθως τα μέλη της κλάσης (συμπεριλαμβανομένων των " +"μελών δεδομένων) είναι *δημόσια* (εκτός από βλέπε παρακάτω :ref:`tut-" +"private`), και όλες οι συμμετέχουσες συναρτήσεις είναι *εικονικές*. Όπως και " +"στο Modula-3, δεν υπάρχουν συντομογραφίες για την αναφορά στα μέλη του " +"αντικειμένου από τις μεθόδους του: η μέθοδος δηλώνεται με ρητό πρώτο όρισμα " +"που αντιπροσωπεύει το αντικείμενο, το οποίο παρέχεται έμμεσα από την κλήση. " +"Όπως και στο Smalltalk, οι ίδιες οι κλάσεις είναι αντικείμενα.Αυτό παρέχει " +"σημασιολογία για εισαγωγή και μετονομασία. Σε αντίθεση με τις γλώσσες C++ " +"και Modula-3, οι built-in τύποι μπορούν να χρησιμοποιηθούν ως βασικές " +"κλάσεις για επέκταση από τον χρήστη. Επίσης, όπως στην C++, οι περισσότεροι " +"built-in τελεστές με ειδική σύνταξη (αριθμητικοί τελεστές, εγγραφή κ.λπ.) " +"μπορούν να επαναπροσδιοριστούν για τα στιγμιότυπα κλάσης." #: tutorial/classes.rst:34 msgid "" @@ -65,10 +98,15 @@ msgid "" "since its object-oriented semantics are closer to those of Python than C++, " "but I expect that few readers have heard of it.)" msgstr "" +"(Ελλείψει καθολικής αποδεκτής ορολογίας για να μιλήσω για τις κλάσεις, θα " +"κάνω περιστασιακή χρήση όρων από τη Smalltalk και τη C++. Θα χρησιμοποιούσα " +"όρους από τη Modula-3, καθώς η αντικειμενοστραφής σημασιολογία του είναι " +"πιο κοντά σε αυτήν της Python από ότι της C++, Αλλά πιστεύω ότι λίγοι " +"αναγνώστες το έχουν ακούσει.)" #: tutorial/classes.rst:43 msgid "A Word About Names and Objects" -msgstr "" +msgstr "Λίγα λόγια για Ονόματα και Αντικείμενα" #: tutorial/classes.rst:45 msgid "" @@ -85,10 +123,24 @@ msgid "" "the caller will see the change --- this eliminates the need for two " "different argument passing mechanisms as in Pascal." msgstr "" +"Τα αντικείμενα έχουν μοναδικότητα και πολλά ονόματα (σε πολλαπλά πεδία) " +"μπορούν να συνδεθούν στο ίδιο αντικείμενο. Αυτό είναι γνωστό ως ψευδώνυμο σε " +"άλλες γλώσσες.Αυτό συνήθως δεν εκτιμάται με μια πρώτη ματιά στην Python και " +"μπορεί να αγνοείται με ασφάλεια όταν ασχολείται με αμετάβλητους βασικούς " +"τύπους (αριθμοί, συμβολοσειρές, πλειάδες (tuples)). Ωστόσο, το ψευδώνυμο " +"έχει μια πιθανώς εκπληκτική επίδραση στη σημασιολογία του κώδικα της Python " +"που περιλαμβάνει ευμετάβλητα αντικείμενα όπως λίστες, λεξικά, και τους " +"περισσότερους άλλους τύπους. Αυτό χρησιμοποιείται συνήθως προς όφελος του " +"προγράμματος, δεδομένου ότι τα ψευδώνυμα συμπεριφέρονται σαν δείκτες από " +"ορισμένες απόψεις. Για παράδειγμα, η μετάδοση ενός αντικειμένου είναι " +"ανέξοδη αφού μόνο ένας δείκτης περνά από την υλοποίηση, και αν μια συνάρτηση " +"τροποποιεί ένα αντικείμενο που έχει περάσει ως όρισμα, ο καλών θα δει την " +"αλλαγή --- αυτό εξαλείφει την ανάγκη για δύο διαφορετικούς μηχανισμούς " +"μετάδοσης ορισμάτων όπως στην Pascal." #: tutorial/classes.rst:61 msgid "Python Scopes and Namespaces" -msgstr "" +msgstr "Εμβέλεια και Πεδία Ονομάτων στην Python" #: tutorial/classes.rst:63 msgid "" @@ -98,10 +150,16 @@ msgid "" "understand what's going on. Incidentally, knowledge about this subject is " "useful for any advanced Python programmer." msgstr "" +"Πριν από την εισαγωγή των κλάσεων, πρέπει πρώτα να σας πω κάτι για τους " +"κανόνες εμβέλειας της Python. Οι ορισμοί των κλάσεων παίζουν μερικά ξεκάθαρα " +"κόλπα με τα πεδία ονομάτων και πρέπει να γνωρίζετε πώς λειτουργούν πλήρως τα " +"πεδία ονομάτων και η εμβέλεια για να κατανοήσετε πλήρως τι συμβαίνει. " +"Παρεμπιπτόντως, η γνώση για αυτό το θέμα είναι χρήσιμη για κάθε προχωρημένο " +"προγραμματιστή της Python." #: tutorial/classes.rst:69 msgid "Let's begin with some definitions." -msgstr "" +msgstr "Ας ξεκινήσουμε με ορισμένους ορισμούς." #: tutorial/classes.rst:71 msgid "" @@ -117,6 +175,20 @@ msgid "" "may both define a function ``maximize`` without confusion --- users of the " "modules must prefix it with the module name." msgstr "" +"Ένας *πεδίο ονομάτων (namespace)* είναι μια αντιστοίχιση από ονόματα σε " +"αντικείμενα. Τα περισσότερα πεδία ονομάτων υλοποιούνται επί του παρόντος ως " +"λεξικά Python, αλλά αυτό συνήθως δεν γίνεται αντιληπτό με κανέναν τρόπο " +"(εκτός από την απόδοση) και μπορεί να αλλάξει στο μέλλον. Παραδείγματα " +"πεδίων ονομάτων είναι: το σύνολο των ενσωματωμένων ονομάτων (που περιέχει " +"συναρτήσεις όπως :func:`abs` και ενσωματωμένα ονόματα εξαιρέσεων)∙ τα " +"καθολικά ονόματα σε ένα module και τα τοπικά ονόματα σε μια επίκληση " +"συνάρτησης. Κατά μία έννοια το σύνολο των χαρακτηριστικών ενός αντικειμένου " +"σχηματίζει επίσης ένα πεδίο ονομάτων. Το σημαντικό πράγμα που πρέπει να " +"γνωρίζετε για τα πεδία ονομάτων είναι ότι δεν υπάρχει καμία απολύτως σχέση " +"μεταξύ ονομάτων σε διαφορετικά πεδία ονομάτων, για παράδειγμα, δύο " +"διαφορετικά modules μπορεί και τα δύο να ορίσουν μια συνάρτηση ``maximize`` " +"χωρίς σύγχυση --- χρήστες των modules πρέπει να την προσθέσουν με το όνομα " +"του module." #: tutorial/classes.rst:82 msgid "" @@ -128,6 +200,15 @@ msgid "" "happens to be a straightforward mapping between the module's attributes and " "the global names defined in the module: they share the same namespace! [#]_" msgstr "" +"Παρεμπιπτόντως, χρησιμοποιώ τη λέξη *attribute* για οποιοδήποτε όνομα που " +"ακολουθεί μια τελεία --- για παράδειγμα, στην έκφραση ``z.real``, το " +"``real`` είναι ένα attribute του αντικειμένου ``z``. Αυστηρά μιλώντας, οι " +"αναφορές σε ονόματα των modules είναι αναφορές σε attributes: στην έκφραση " +"``modname.funcname``, το ``modname`` είναι ένα module αντικείμενο και το " +"``funcname`` είναι ένα attribute του αντικειμένου. Σε αυτήν την περίπτωση " +"συμβαίνει να υπάρχει μια απλή αντιστοίχιση μεταξύ των attributes των modules " +"και των καθολικών ονομάτων που ορίζονται στο module: μοιράζονται τον ίδιο " +"χώρο ονομάτων! [#]_" #: tutorial/classes.rst:90 msgid "" @@ -138,6 +219,12 @@ msgid "" "remove the attribute :attr:`!the_answer` from the object named by " "``modname``." msgstr "" +"Τα attributes μπορεί να είναι μόνο για ανάγνωση ή εγγράψιμα. Στην τελευταία " +"περίπτωση, είναι δυνατή η ανάθεση attributes. Τα attributes των modules " +"είναι εγγράψιμα: μπορείτε να γράψετε ``modname.the_answer = 42``. Τα " +"εγγράψιμα attributes μπορούν επίσης να διαγραφούν με την δήλωση :keyword:" +"`del`. Για παράδειγμα, ``del modname.the_answer`` θα αφαιρέσει το attribute :" +"attr:`!the_answer` από το αντικείμενο που ονομάστηκε από το ``modname``." #: tutorial/classes.rst:96 msgid "" @@ -151,6 +238,17 @@ msgid "" "`__main__`, so they have their own global namespace. (The built-in names " "actually also live in a module; this is called :mod:`builtins`.)" msgstr "" +"Οι χώροι ονομάτων δημιουργούνται σε διαφορετικές στιγμές και έχουν " +"διαφορετική διάρκεια ζωής.Ο χώρος ονομάτων που περιέχει τα built-in ονόματα " +"δημιουργείται κατά την εκκίνηση του διερμηνέα της Python και δεν διαγράφεται " +"ποτέ. Ο καθολικός χώρος ονομάτων για ένα module δημιουργείται όταν " +"διαβάζεται ο ορισμός του module. Κανονικά, οι χώροι ονομάτων των modules " +"διαρκούν επίσης μέχρι να τερματιστεί ο διερμηνέας. Οι δηλώσεις που " +"εκτελούνται από την επίκληση ανώτατου επιπέδου του διερμηνέα, είτε " +"διαβάζονται από ένα script είτε διαδραστικά, θεωρούνται μέρος ενός module " +"που ονομάζεται :mod:`__main__`, επομένως έχουν τον δικό τους καθολικό χώρο " +"ονομάτων. (Τα ενσωματωμένα ονόματα στην πραγματικότητα υπάρχουν επίσης σε " +"ένα module,αυτό ονομάζεται :mod:`builtins`.)" #: tutorial/classes.rst:106 msgid "" @@ -160,6 +258,12 @@ msgid "" "describe what actually happens.) Of course, recursive invocations each have " "their own local namespace." msgstr "" +"Ο τοπικός χώρος ονομάτων για μια συνάρτηση δημιουργείται όταν καλείται η " +"συνάρτηση, και διαγράφεται όταν η συνάρτηση επιστρέφει ή δημιουργεί μια " +"εξαίρεση που δεν αντιμετωπίζεται στην συνάρτηση. (Στην πραγματικότητα, η " +"λήθη θα ήταν καλύτερος τρόπος για να περιγράψουμε τι πραγματικά συμβαίνει.) " +"Φυσικά, οι επαναλαμβανόμενες επικλήσεις έχουν το δικό τους τοπικό χώρο " +"ονομάτων." #: tutorial/classes.rst:112 msgid "" @@ -167,6 +271,10 @@ msgid "" "directly accessible. \"Directly accessible\" here means that an unqualified " "reference to a name attempts to find the name in the namespace." msgstr "" +"Η εμβέλεια είναι μια περιοχή κειμένου ενός προγράμματος Python όπου ένας " +"χώρος ονομάτων είναι άμεσα προσβάσιμος. Το \"Άμεση πρόσβαση\" εδώ σημαίνει " +"ότι μια ανεπιφύλακτη αναφορά σε ένα όνομα προσπαθεί να βρει το όνομα στον " +"χώρο ονομάτων." #: tutorial/classes.rst:116 msgid "" @@ -174,26 +282,37 @@ msgid "" "time during execution, there are 3 or 4 nested scopes whose namespaces are " "directly accessible:" msgstr "" +"Παρόλο που τα πεδία προσδιορίζονται στατικά, χρησιμοποιούνται δυναμικά. Σε " +"οποιοδήποτε χρόνο κατά την διάρκεια της εκτέλεσης, υπάρχουν 3 ή 4 ένθετα " +"πεδία των οποίων οι χώροι ονομάτων είναι άμεσα προσβάσιμοι:" #: tutorial/classes.rst:120 msgid "the innermost scope, which is searched first, contains the local names" msgstr "" +"η ενδότερη εμβέλεια, η οποία αναζητείται πρώτα, περιέχει τα τοπικά ονόματα" #: tutorial/classes.rst:121 msgid "" "the scopes of any enclosing functions, which are searched starting with the " "nearest enclosing scope, contain non-local, but also non-global names" msgstr "" +"η εμβέλεια οποιωνδήποτε εσωκλειόμενων συναρτήσεων, τα οποία αναζητούνται " +"ξεκινώντας από την πλησιέστερη εσωκλειόμενη εμβέλεια, περιέχει μη τοπικά, " +"αλλά και μη καθολικά ονόματα" #: tutorial/classes.rst:123 msgid "the next-to-last scope contains the current module's global names" msgstr "" +"η επόμενη προς την τελευταία εμβέλεια περιέχει τα τρέχοντα καθολικά ονόματα " +"του module" #: tutorial/classes.rst:124 msgid "" "the outermost scope (searched last) is the namespace containing built-in " "names" msgstr "" +"η πιο απομακρυσμένη εμβέλεια (που έγινε τελευταία αναζήτηση) είναι ο χώρος " +"ονομάτων που περιέχει built-in ονόματα" #: tutorial/classes.rst:126 msgid "" @@ -205,6 +324,14 @@ msgid "" "*new* local variable in the innermost scope, leaving the identically named " "outer variable unchanged)." msgstr "" +"Εάν ένα όνομα έχει δηλωθεί ως καθολικό, τότε όλες οι αναφορές και οι " +"εκχωρήσεις πηγαίνουν απευθείας στο επόμενο προς το τελευταίο πεδίο που " +"περιέχει τα καθολικά ονόματα του module. Για την επανασύνδεση μεταβλητών που " +"βρίσκονται εκτός της ενδότερης εμβέλειας ,μπορεί να χρησιμοποιηθεί η δήλωση " +"του :keyword:`nonlocal` . Εάν δεν δηλωθούν ως μη τοπικές, αυτές οι " +"μεταβλητές είναι μόνο για ανάγνωση (μια προσπάθεια εγγραφής σε μια τέτοια " +"μεταβλητή θα δημιουργήσει απλώς μια *νέα* τοπική μεταβλητή στην ενδότερη " +"εμβέλεια, αφήνοντας αμετάβλητη την εξωτερική μεταβλητή με το ίδιο όνομα )." #: tutorial/classes.rst:133 msgid "" @@ -213,6 +340,10 @@ msgid "" "namespace as the global scope: the module's namespace. Class definitions " "place yet another namespace in the local scope." msgstr "" +"Συνήθως, η τοπική εμβέλεια παραπέμπει στα τοπικά ονόματα της (κείμενης) " +"τρέχουσας συνάρτησης. Εκτός συναρτήσεων, η τοπική εμβέλεια αναφέρεται στον " +"ίδιο χώρο ονομάτων με την καθολική εμβέλεια: τον χώρο ονομάτων του module.Οι " +"ορισμοί κλάσεων τοποθετούν έναν ακόμη χώρο ονομάτων στην τοπική εμβέλεια." #: tutorial/classes.rst:138 msgid "" @@ -224,6 +355,14 @@ msgid "" "at \"compile\" time, so don't rely on dynamic name resolution! (In fact, " "local variables are already determined statically.)" msgstr "" +"Είναι σημαντικό να συνειδητοποιήσουμε ότι οι εμβέλειες καθορίζονται με " +"κείμενο: η καθολική εμβέλεια μιας συνάρτησης που ορίζεται σε ένα module " +"είναι ο χώρος ονομάτων αυτού του module ανεξάρτητα από το πού ή με ποιο " +"ψευδώνυμο καλείται η συνάρτηση. Από την άλλη πλευρά, η πραγματική αναζήτηση " +"ονομάτων γίνεται δυναμικά, κατά το χρόνο εκτέλεσης --- ωστόσο, ο ορισμός της " +"γλώσσας εξελίσσεται προς τη στατική ανάλυση ονομάτων, την ώρα της " +"\"μεταγλώττισης\", επομένως μην βασίζεστε σε δυναμική ανάλυση ονόματος! " +"(Στην πραγματικότητα, οι τοπικές μεταβλητές έχουν ήδη καθοριστεί στατικά.)" #: tutorial/classes.rst:146 msgid "" @@ -236,6 +375,16 @@ msgid "" "particular, :keyword:`import` statements and function definitions bind the " "module or function name in the local scope." msgstr "" +"Μια ιδιαίτερη ιδιορρυθμία της Python είναι ότι -- αν οι δηλώσεις :keyword:" +"`global` ή :keyword:`nonlocal` δεν είναι σε ισχύ -- οι εκχωρήσεις στα " +"ονόματα πηγαίνουν πάντα στην ενδότερη εμβέλεια. Οι εκχωρήσεις δεν " +"αντιγράφουν δεδομένα --- απλώς δεσμεύουν ονόματα σε αντικείμενα. Το ίδιο " +"ισχύει και για τις διαγραφές: η δήλωση `del x` αφαιρεί την σύνδεση του ``x`` " +"από τον χώρο ονομάτων που αναφέρεται από την τοπική εμβέλεια. Στην " +"πραγματικότητα, όλες οι λειτουργίες που εισάγουν νέα ονόματα χρησιμοποιούν " +"την τοπική εμβέλεια: συγκεκριμένα οι δηλώσεις, :keyword:`import` και οι " +"ορισμοί συναρτήσεων δεσμεύουν το όνομα του module ή της συνάρτησης στην " +"τοπική εμβέλεια." #: tutorial/classes.rst:154 msgid "" @@ -244,10 +393,14 @@ msgid "" "`nonlocal` statement indicates that particular variables live in an " "enclosing scope and should be rebound there." msgstr "" +"Η δήλωση :keyword:`global` μπορεί να χρησιμοποιηθεί για να υποδείξει ότι " +"συγκεκριμένες μεταβλητές ζουν στην καθολική εμβέλεια και θα πρέπει να " +"ανακάμψουν εκεί. Η δήλωση :keyword:`nonlocal` υποδηλώνει ότι συγκεκριμένες " +"μεταβλητές ζουν σε μια εσώκλειστη εμβέλεια και θα πρέπει να ανακάμψουν εκεί." #: tutorial/classes.rst:162 msgid "Scopes and Namespaces Example" -msgstr "" +msgstr "Παράδειγμα Εμβέλειας και Χώρων Ονομάτων" #: tutorial/classes.rst:164 msgid "" @@ -255,10 +408,73 @@ msgid "" "namespaces, and how :keyword:`global` and :keyword:`nonlocal` affect " "variable binding::" msgstr "" +"Αυτό είναι ένα παράδειγμα που δείχνει τον τρόπο αναφοράς στα διαφορετικά " +"πεδία και χώρους ονομάτων και πώς τα :keyword:`global` και :keyword:" +"`nonlocal` επηρεάζουν τα variable binding::" + +#: tutorial/classes.rst:168 +msgid "" +"def scope_test():\n" +" def do_local():\n" +" spam = \"local spam\"\n" +"\n" +" def do_nonlocal():\n" +" nonlocal spam\n" +" spam = \"nonlocal spam\"\n" +"\n" +" def do_global():\n" +" global spam\n" +" spam = \"global spam\"\n" +"\n" +" spam = \"test spam\"\n" +" do_local()\n" +" print(\"After local assignment:\", spam)\n" +" do_nonlocal()\n" +" print(\"After nonlocal assignment:\", spam)\n" +" do_global()\n" +" print(\"After global assignment:\", spam)\n" +"\n" +"scope_test()\n" +"print(\"In global scope:\", spam)" +msgstr "" +"def scope_test():\n" +" def do_local():\n" +" spam = \"local spam\"\n" +"\n" +" def do_nonlocal():\n" +" nonlocal spam\n" +" spam = \"nonlocal spam\"\n" +"\n" +" def do_global():\n" +" global spam\n" +" spam = \"global spam\"\n" +"\n" +" spam = \"test spam\"\n" +" do_local()\n" +" print(\"After local assignment:\", spam)\n" +" do_nonlocal()\n" +" print(\"After nonlocal assignment:\", spam)\n" +" do_global()\n" +" print(\"After global assignment:\", spam)\n" +"\n" +"scope_test()\n" +"print(\"In global scope:\", spam)" #: tutorial/classes.rst:191 msgid "The output of the example code is:" +msgstr "Το αποτέλεσμα του κώδικα στο παράδειγμα είναι:" + +#: tutorial/classes.rst:193 +msgid "" +"After local assignment: test spam\n" +"After nonlocal assignment: nonlocal spam\n" +"After global assignment: nonlocal spam\n" +"In global scope: global spam" msgstr "" +"After local assignment: test spam\n" +"After nonlocal assignment: nonlocal spam\n" +"After global assignment: nonlocal spam\n" +"In global scope: global spam" #: tutorial/classes.rst:200 msgid "" @@ -267,30 +483,54 @@ msgid "" "changed *scope_test*\\'s binding of *spam*, and the :keyword:`global` " "assignment changed the module-level binding." msgstr "" +"Σημειώστε πώς η εκχώρηση *τοπική* (η οποία είναι προεπιλεγμένη) δεν άλλαξε " +"την δέσμευση *scope_test*\\'s του *spam*. Η εκχώρηση :keyword:`nonlocal` " +"άλλαξε την δέσμευση του *scope_test*\\'s του *spam* και η εκχώρηση του :" +"keyword:`global` άλλαξε τη δέσμευση σε επίπεδο module." #: tutorial/classes.rst:205 msgid "" "You can also see that there was no previous binding for *spam* before the :" "keyword:`global` assignment." msgstr "" +"Μπορείτε επίσης να δείτε ότι δεν υπήρχε προηγούμενη δέσμευση για *spam* πριν " +"από την εκχώρηση :keyword:`global`.." #: tutorial/classes.rst:212 msgid "A First Look at Classes" -msgstr "" +msgstr "Μια πρώτη ματιά στις Κλάσεις" #: tutorial/classes.rst:214 msgid "" "Classes introduce a little bit of new syntax, three new object types, and " "some new semantics." msgstr "" +"Οι Κλάσεις εισάγουν λίγη νέα σύνταξη, τρεις νέους τύπους αντικειμένων και " +"κάποια νέα σημασιολογία." #: tutorial/classes.rst:221 msgid "Class Definition Syntax" -msgstr "" +msgstr "Σύνταξη Ορισμού Κλάσης" #: tutorial/classes.rst:223 msgid "The simplest form of class definition looks like this::" +msgstr "Η απλούστερη μορφή ορισμού κλάσης μοιάζει με αυτό::" + +#: tutorial/classes.rst:225 +msgid "" +"class ClassName:\n" +" \n" +" .\n" +" .\n" +" .\n" +" " msgstr "" +"class ClassName:\n" +" \n" +" .\n" +" .\n" +" .\n" +" " #: tutorial/classes.rst:232 msgid "" @@ -299,6 +539,10 @@ msgid "" "a class definition in a branch of an :keyword:`if` statement, or inside a " "function.)" msgstr "" +"Ορισμοί κλάσεων, όπως ορισμοί συναρτήσεων (:keyword:`def` δηλώσεις) πρέπει " +"να εκτελεστούν προτού έχουν οποιοδήποτε αποτέλεσμα. (Θα μπορούσατε να " +"τοποθετήσετε έναν ορισμό κλάσης σε έναν κλάδο μιας δήλωσης :keyword:`if` ή " +"μέσα σε μια συνάρτηση.)" #: tutorial/classes.rst:236 msgid "" @@ -308,6 +552,11 @@ msgid "" "normally have a peculiar form of argument list, dictated by the calling " "conventions for methods --- again, this is explained later." msgstr "" +"Στην πράξη, οι δηλώσεις μέσα σε έναν ορισμό κλάσης συνήθως θα είναι ορισμοί " +"συναρτήσεων, αλλά επιτρέπονται άλλες δηλώσεις και μερικές φορές χρήσιμες --- " +"θα επανέλθουμε σε αυτό αργότερα. Οι ορισμοί συναρτήσεων μέσα σε μια κλάση " +"συνήθως έχουν μια περίεργη μορφή λίστας ορισμάτων, που υπαγορεύεται από τις " +"συμβάσεις κλήσης για μεθόδους --- και πάλι, αυτό εξηγείται αργότερα." #: tutorial/classes.rst:242 msgid "" @@ -316,6 +565,10 @@ msgid "" "new namespace. In particular, function definitions bind the name of the new " "function here." msgstr "" +"Όταν εισάγεται ένας ορισμός κλάσης, δημιουργείται ένας νέος χώρος ονομάτων " +"και χρησιμοποιείται ως τοπική εμβέλεια --- επομένως, όλες οι εκχωρήσεις σε " +"τοπικές μεταβλητές πηγαίνουν σε αυτόν τον νέο χώρο ονομάτων. Συγκεκριμένα, " +"οι ορισμοί συναρτήσεων δεσμεύουν το όνομα της νέας συνάρτησης εδώ." #: tutorial/classes.rst:247 msgid "" @@ -327,16 +580,26 @@ msgid "" "here to the class name given in the class definition header (:class:`!" "ClassName` in the example)." msgstr "" +"Όταν ένας ορισμός κλάσης αφήνεται κανονικά (μέσω του τέλους),δημιουργείται " +"ένα *αντικείμενο κλάσης*. Αυτό είναι βασικά ένα περιτύλιγμα γύρω από τα " +"περιεχόμενα του χώρου ονομάτων που δημιουργήθηκε από τον ορισμό κλάσης. θα " +"μάθουμε περισσότερα για τα αντικείμενα κλάσης στην επόμενη ενότητα.Η αρχική " +"τοπική εμβέλεια(αυτό που ίσχυε λίγο πριν από την εισαγωγή του ορισμού της " +"κλάσης) αποκαθίσταται και το αντικείμενο κλάσης δεσμεύεται εδώ στο όνομα " +"κλάσης που δίνεται στην κεφαλίδα ορισμού κλάσης (:class:`!ClassName` στο " +"παράδειγμα)." #: tutorial/classes.rst:259 msgid "Class Objects" -msgstr "" +msgstr "Αντικείμενα Κλάσης" #: tutorial/classes.rst:261 msgid "" "Class objects support two kinds of operations: attribute references and " "instantiation." msgstr "" +"Τα αντικείμενα κλάσης υποστηρίζουν δύο είδη πράξεων: αναφορές " +"χαρακτηριστικών και στιγμιότυπο." #: tutorial/classes.rst:264 msgid "" @@ -345,15 +608,42 @@ msgid "" "that were in the class's namespace when the class object was created. So, " "if the class definition looked like this::" msgstr "" +"Οι *Αναφορές χαρακτηριστικών* χρησιμοποιούν την τυπική σύνταξη που " +"χρησιμοποιείται για όλα τις αναφορές χαρακτηριστικών στην Python: ``obj." +"name``. Τα έγκυρα ονόματα χαρακτηριστικών είναι όλα τα ονόματα που " +"βρίσκονταν στον χώρο ονομάτων της κλάσης όταν δημιουργήθηκε το αντικείμενο " +"της κλάσης. Έτσι, αν ο ορισμός της κλάσης έμοιαζε ως εξής::" + +#: tutorial/classes.rst:269 +msgid "" +"class MyClass:\n" +" \"\"\"A simple example class\"\"\"\n" +" i = 12345\n" +"\n" +" def f(self):\n" +" return 'hello world'" +msgstr "" +"class MyClass:\n" +" \"\"\"A simple example class\"\"\"\n" +" i = 12345\n" +"\n" +" def f(self):\n" +" return 'hello world'" #: tutorial/classes.rst:276 msgid "" "then ``MyClass.i`` and ``MyClass.f`` are valid attribute references, " "returning an integer and a function object, respectively. Class attributes " "can also be assigned to, so you can change the value of ``MyClass.i`` by " -"assignment. :attr:`!__doc__` is also a valid attribute, returning the " +"assignment. :attr:`~type.__doc__` is also a valid attribute, returning the " "docstring belonging to the class: ``\"A simple example class\"``." msgstr "" +"τότε τα `MyClass.i` και `MyClass.f` είναι έγκυρες αναφορές χαρακτηριστικών, " +"επιστρέφοντας έναν ακέραιο και ένα αντικείμενο συνάρτησης, αντίστοιχα.Τα " +"attributes κλάσης μπορούν επίσης να εκχωρηθούν, ώστε να μπορείτε να αλλάξετε " +"την τιμή του `MyClass.i` ανά ανάθεση. Το :attr:`~type.__doc__` είναι επίσης " +"ένα έγκυρο χαρακτηριστικό, επιστρέφοντας το docstring που ανήκει στην κλάση: " +"``\"Ένα απλό παράδειγμα κλάσης\"``." #: tutorial/classes.rst:282 msgid "" @@ -361,12 +651,22 @@ msgid "" "object is a parameterless function that returns a new instance of the class. " "For example (assuming the above class)::" msgstr "" +"Η κλάση *στιγμιότυπο* χρησιμοποιεί σημειογραφία συνάρτησης. Απλώς " +"προσποιηθείτε ότι το αντικείμενο της κλάσης είναι μια συνάρτηση χωρίς " +"παραμέτρους που επιστρέφει ένα νέο στιγμιότυπο της κλάσης.Για παράδειγμα " +"(υποθέτοντας την παραπάνω κλάση)::" + +#: tutorial/classes.rst:303 +msgid "x = MyClass()" +msgstr "x = MyClass()" #: tutorial/classes.rst:288 msgid "" "creates a new *instance* of the class and assigns this object to the local " "variable ``x``." msgstr "" +"δημιουργεί ένα νέο *στιγμιότυπο* της κλάσης και εκχωρεί αυτό το αντικείμενο " +"στην τοπική μεταβλητή ``x``." #: tutorial/classes.rst:291 msgid "" @@ -375,6 +675,19 @@ msgid "" "specific initial state. Therefore a class may define a special method named :" "meth:`~object.__init__`, like this::" msgstr "" +"Η λειτουργία του στιγμιότυπου (\"calling\" ένα αντικείμενο κλάσης) " +"δημιουργεί ένα κενό αντικείμενο. Σε πολλές κλάσεις αρέσει να δημιουργούν " +"αντικείμενα με στιγμιότυπα προσαρμοσμένα σε μια συγκεκριμένη αρχική " +"κατάσταση. Επομένως μια κλάση μπορεί να ορίσει μια ειδική μέθοδο με το " +"όνομα :meth:`~object.__init__`, όπως αυτό::" + +#: tutorial/classes.rst:296 +msgid "" +"def __init__(self):\n" +" self.data = []" +msgstr "" +"def __init__(self):\n" +" self.data = []" #: tutorial/classes.rst:299 msgid "" @@ -383,6 +696,10 @@ msgid "" "instance. So in this example, a new, initialized instance can be obtained " "by::" msgstr "" +"Όταν μια κλάση ορίζει μια μέθοδο :meth:`~object.__init__`, το στιγμιότυπο " +"κλάσης καλεί αυτόματα :meth:`!__init__` για το στιγμιότυπο κλάσης που " +"δημιουργήθηκε πρόσφατα. Έτσι σε αυτό το παράδειγμα,ένα νέο, αρχικοποιημένο " +"στιγμιότυπο μπορεί να ληφθεί από::" #: tutorial/classes.rst:305 msgid "" @@ -390,10 +707,34 @@ msgid "" "greater flexibility. In that case, arguments given to the class " "instantiation operator are passed on to :meth:`!__init__`. For example, ::" msgstr "" +"Φυσικά, η μέθοδος :meth:`~object.__init__` μπορεί να έχει ορίσματα για " +"μεγαλύτερη ευελιξία. Σε αυτήν την περίπτωση, τα ορίσματα που δίνονται στον " +"τελεστή στιγμιότυπου κλάσης μεταβιβάζονται σε :meth:`!__init__`. Για " +"παράδειγμα, ::" + +#: tutorial/classes.rst:309 +msgid "" +">>> class Complex:\n" +"... def __init__(self, realpart, imagpart):\n" +"... self.r = realpart\n" +"... self.i = imagpart\n" +"...\n" +">>> x = Complex(3.0, -4.5)\n" +">>> x.r, x.i\n" +"(3.0, -4.5)" +msgstr "" +">>> class Complex:\n" +"... def __init__(self, realpart, imagpart):\n" +"... self.r = realpart\n" +"... self.i = imagpart\n" +"...\n" +">>> x = Complex(3.0, -4.5)\n" +">>> x.r, x.i\n" +"(3.0, -4.5)" #: tutorial/classes.rst:322 msgid "Instance Objects" -msgstr "" +msgstr "Αντικείμενα Στιγμιοτύπων" #: tutorial/classes.rst:324 msgid "" @@ -401,29 +742,50 @@ msgid "" "instance objects are attribute references. There are two kinds of valid " "attribute names: data attributes and methods." msgstr "" +"Τώρα τι μπορούμε να κάνουμε με τα αντικείμενα στιγμιοτύπων; Οι μόνες " +"λειτουργίες που γίνονται κατανοητές από τα αντικείμενα στιγμιοτύπων είναι οι " +"αναφορές χαρακτηριστικών. Υπάρχουν δύο είδη έγκυρων ονομάτων attributes: " +"attributes και μέθοδοι δεδομένων." #: tutorial/classes.rst:328 msgid "" -"*data attributes* correspond to \"instance variables\" in Smalltalk, and to " +"*Data attributes* correspond to \"instance variables\" in Smalltalk, and to " "\"data members\" in C++. Data attributes need not be declared; like local " "variables, they spring into existence when they are first assigned to. For " "example, if ``x`` is the instance of :class:`!MyClass` created above, the " "following piece of code will print the value ``16``, without leaving a " "trace::" msgstr "" +"*Τα χαρακτηριστικά δεδομένων* αντιστοιχούν στις \"μεταβλητές στιγμιότυπου\" " +"στο Smalltalk και στα \"μέλη δεδομένων\" στη C++. Τα χαρακτηριστικά " +"δεδομένων δεν χρειάζεται να δηλωθούν, όπως και οι τοπικές μεταβλητές, " +"εμφανίζονται όταν εκχωρούνται για πρώτη φορά. Για παράδειγμα, εάν το ``x`` " +"είναι στιγμιότυπο της :class:`!MyClass` που δημιουργήθηκε παραπάνω, το " +"ακόλουθο κομμάτι κώδικα θα εκτυπώσει την τιμή ``16``, χωρίς να αφήσει ίχνος::" + +#: tutorial/classes.rst:334 +msgid "" +"x.counter = 1\n" +"while x.counter < 10:\n" +" x.counter = x.counter * 2\n" +"print(x.counter)\n" +"del x.counter" +msgstr "" +"x.counter = 1\n" +"while x.counter < 10:\n" +" x.counter = x.counter * 2\n" +"print(x.counter)\n" +"del x.counter" #: tutorial/classes.rst:340 msgid "" "The other kind of instance attribute reference is a *method*. A method is a " -"function that \"belongs to\" an object. (In Python, the term method is not " -"unique to class instances: other object types can have methods as well. For " -"example, list objects have methods called append, insert, remove, sort, and " -"so on. However, in the following discussion, we'll use the term method " -"exclusively to mean methods of class instance objects, unless explicitly " -"stated otherwise.)" +"function that \"belongs to\" an object." msgstr "" +"Το άλλο είδος αναφοράς χαρακτηριστικού στιγμιότυπου είναι μια *μέθοδος*. Μια " +"μέθοδος είναι μια συνάρτηση που \"ανήκει\" σε ένα αντικείμενο." -#: tutorial/classes.rst:349 +#: tutorial/classes.rst:345 msgid "" "Valid method names of an instance object depend on its class. By " "definition, all attributes of a class that are function objects define " @@ -432,28 +794,54 @@ msgid "" "not, since ``MyClass.i`` is not. But ``x.f`` is not the same thing as " "``MyClass.f`` --- it is a *method object*, not a function object." msgstr "" +"Τα έγκυρα ονόματα μεθόδων ενός αντικειμένου στιγμιότυπου εξαρτώνται από την " +"κλάση του. Εξ ορισμού, όλα τα χαρακτηριστικά μιας κλάσης που είναι " +"αντικείμενα συνάρτησης ορίζουν τις αντίστοιχες μεθόδους των στιγμιοτύπων " +"της. Έτσι στο παράδειγμά μας, το `x.f` είναι μια έγκυρη αναφορά μεθόδου, " +"αφού το `MyClass.f` είναι συνάρτηση, αλλά το `x.i` δεν είναι αφού το " +"`MyClass.i` δεν είναι. Αλλά το `x.f` δεν είναι το ίδιο πράγμα με το `MyClass." +"f` --- είναι ένα *αντικείμενο μεθόδου*, όχι ένα αντικείμενο συνάρτησης." -#: tutorial/classes.rst:360 +#: tutorial/classes.rst:356 msgid "Method Objects" -msgstr "" +msgstr "Αντικείμενα Μεθόδου" -#: tutorial/classes.rst:362 +#: tutorial/classes.rst:358 msgid "Usually, a method is called right after it is bound::" -msgstr "" +msgstr "Συνήθως, μια μέθοδος καλείται αμέσως μετά τη δέσμευσή της::" -#: tutorial/classes.rst:366 +#: tutorial/classes.rst:360 +msgid "x.f()" +msgstr "x.f()" + +#: tutorial/classes.rst:362 msgid "" -"In the :class:`!MyClass` example, this will return the string ``'hello " +"If ``x = MyClass()``, as above, this will return the string ``'hello " "world'``. However, it is not necessary to call a method right away: ``x.f`` " "is a method object, and can be stored away and called at a later time. For " "example::" msgstr "" +"Αν ``x = MyClass()``, όπως παραπάνω, αυτό θα επιστρέψει τη συμβολοσειρά " +"``'hello world'``. Ωστόσο, δεν είναι απαραίτητο να καλέσετε μια μέθοδο " +"αμέσως: το ``x.f`` είναι ένα αντικείμενο μεθόδου και μπορεί να αποθηκευτεί " +"και να κληθεί αργότερα. Για παράδειγμα::" + +#: tutorial/classes.rst:366 +msgid "" +"xf = x.f\n" +"while True:\n" +" print(xf())" +msgstr "" +"xf = x.f\n" +"while True:\n" +" print(xf())" -#: tutorial/classes.rst:374 +#: tutorial/classes.rst:370 msgid "will continue to print ``hello world`` until the end of time." msgstr "" +"θα συνεχίσει να εκτυπώνει το ``hello world`` μέχρι το τέλος του χρόνου." -#: tutorial/classes.rst:376 +#: tutorial/classes.rst:372 msgid "" "What exactly happens when a method is called? You may have noticed that ``x." "f()`` was called without an argument above, even though the function " @@ -462,8 +850,13 @@ msgid "" "argument is called without any --- even if the argument isn't actually " "used..." msgstr "" +"Τι ακριβώς συμβαίνει όταν καλείται μια μέθοδος; Ίσως έχετε παρατηρήσει ότι " +"``x.f()`` κλήθηκε χωρίς όρισμα παραπάνω, παρόλο που ο ορισμός της συνάρτησης " +"για :meth:`!f` καθόριζε ένα όρισμα. Τι συνέβη με το όρισμα; Σίγουρα η Python " +"δημιουργεί μια εξαίρεση όταν μια συνάρτηση που απαιτεί όρισμα καλείται χωρίς " +"--- ακόμα κι αν το όρισμα δεν χρησιμοποιείται στην πραγματικότητα.." -#: tutorial/classes.rst:382 +#: tutorial/classes.rst:378 msgid "" "Actually, you may have guessed the answer: the special thing about methods " "is that the instance object is passed as the first argument of the " @@ -473,8 +866,15 @@ msgid "" "that is created by inserting the method's instance object before the first " "argument." msgstr "" +"Στην πραγματικότητα, μπορεί να έχετε μαντέψει την απάντηση: το ιδιαίτερο με " +"τις μεθόδους είναι ότι το αντικείμενο του στιγμιότυπου μεταβιβάζεται ως το " +"πρώτο όρισμα της συνάρτησης. Στο παράδειγμά μας, η κλήση ``x.f()`` είναι " +"ακριβώς ισοδύναμη με το ``MyClass.f(x)``. Γενικά, η κλήση μιας μεθόδου με " +"μια λίστα από *n* ορίσματα ισοδυναμεί με την κλήση της αντίστοιχης " +"συνάρτησης με μια λίστα ορισμάτων που δημιουργείται με την εισαγωγή του " +"αντικειμένου στιγμιότυπου της μεθόδου πριν από το πρώτο όρισμα." -#: tutorial/classes.rst:389 +#: tutorial/classes.rst:385 msgid "" "In general, methods work as follows. When a non-data attribute of an " "instance is referenced, the instance's class is searched. If the name " @@ -484,19 +884,69 @@ msgid "" "argument list is constructed from the instance object and the argument list, " "and the function object is called with this new argument list." msgstr "" - -#: tutorial/classes.rst:402 +"Γενικά, οι μέθοδοι λειτουργούν ως εξής. Όταν γίνεται αναφορά σε ένα " +"χαρακτηριστικό μη δεδομένων ενός στιγμιότυπου, γίνεται η αναζήτηση της " +"κλάσης του στιγμιότυπου. Εάν το όνομα υποδηλώνει ένα έγκυρο χαρακτηριστικό " +"κλάσης που είναι αντικείμενο συνάρτησης, οι αναφορές τόσο στο αντικείμενο " +"στιγμιότυπου όσο και στο αντικείμενο συνάρτησης συσκευάζονται σε ένα " +"αντικείμενο μεθόδου. Όταν το αντικείμενο της μεθόδου καλείται με μια λίστα " +"ορισμάτων,δημιουργείται μια νέα λίστα ορισμάτων από το αντικείμενο " +"στιγμιότυπου και τη λίστα ορισμάτων, και το αντικείμενο συνάρτησης καλείται " +"με αυτήν τη νέα λίστα ορισμάτων." + +#: tutorial/classes.rst:398 msgid "Class and Instance Variables" -msgstr "" +msgstr "Μεταβλητές Κλάσης και Στιγμιότυπου" -#: tutorial/classes.rst:404 +#: tutorial/classes.rst:400 msgid "" "Generally speaking, instance variables are for data unique to each instance " "and class variables are for attributes and methods shared by all instances " "of the class::" msgstr "" +"Σε γενικές γραμμές, οι μεταβλητές στιγμιότυπου προορίζονται για δεδομένα " +"μοναδικά για κάθε στιγμιότυπο και οι μεταβλητές κλάσης είναι για " +"χαρακτηριστικά και μεθόδους που μοιράζονται όλα τα στιγμιότυπα της κλάσης::" -#: tutorial/classes.rst:426 +#: tutorial/classes.rst:404 +msgid "" +"class Dog:\n" +"\n" +" kind = 'canine' # class variable shared by all instances\n" +"\n" +" def __init__(self, name):\n" +" self.name = name # instance variable unique to each instance\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.kind # shared by all dogs\n" +"'canine'\n" +">>> e.kind # shared by all dogs\n" +"'canine'\n" +">>> d.name # unique to d\n" +"'Fido'\n" +">>> e.name # unique to e\n" +"'Buddy'" +msgstr "" +"class Dog:\n" +"\n" +" kind = 'canine' # class variable shared by all instances\n" +"\n" +" def __init__(self, name):\n" +" self.name = name # instance variable unique to each instance\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.kind # shared by all dogs\n" +"'canine'\n" +">>> e.kind # shared by all dogs\n" +"'canine'\n" +">>> d.name # unique to d\n" +"'Fido'\n" +">>> e.name # unique to e\n" +"'Buddy'" + +#: tutorial/classes.rst:422 msgid "" "As discussed in :ref:`tut-object`, shared data can have possibly surprising " "effects with involving :term:`mutable` objects such as lists and " @@ -504,22 +954,132 @@ msgid "" "not be used as a class variable because just a single list would be shared " "by all *Dog* instances::" msgstr "" - -#: tutorial/classes.rst:449 +"Όπως συζητήθηκε στο :ref:`tut-object`, τα κοινά δεδομένα μπορεί να έχουν " +"πιθανώς εκπληκτικά αποτελέσματα με τη συμμετοχή αντικειμένων :term:" +"`mutable` όπως λίστες και λεξικά. Για παράδειγμα, η λίστα *tricks* στον " +"παρακάτω κώδικα δεν θα πρέπει να χρησιμοποιείται ως μεταβλητή κλάσης επειδή " +"μόνο μία λίστα θα μπορούσε να είναι κοινή σε όλα τα στιγμιότυπα *Dog*::" + +#: tutorial/classes.rst:428 +msgid "" +"class Dog:\n" +"\n" +" tricks = [] # mistaken use of a class variable\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks # unexpectedly shared by all dogs\n" +"['roll over', 'play dead']" +msgstr "" +"class Dog:\n" +"\n" +" tricks = [] # mistaken use of a class variable\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks # unexpectedly shared by all dogs\n" +"['roll over', 'play dead']" + +#: tutorial/classes.rst:445 msgid "Correct design of the class should use an instance variable instead::" msgstr "" - -#: tutorial/classes.rst:473 +"Ο σωστός σχεδιασμός της κλάσης θα πρέπει να χρησιμοποιεί μια μεταβλητή " +"στιγμιότυπου αντί::" + +#: tutorial/classes.rst:447 +msgid "" +"class Dog:\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +" self.tricks = [] # creates a new empty list for each dog\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks\n" +"['roll over']\n" +">>> e.tricks\n" +"['play dead']" +msgstr "" +"class Dog:\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +" self.tricks = [] # creates a new empty list for each dog\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks\n" +"['roll over']\n" +">>> e.tricks\n" +"['play dead']" + +#: tutorial/classes.rst:469 msgid "Random Remarks" -msgstr "" +msgstr "Τυχαίες Παρατηρήσεις" -#: tutorial/classes.rst:477 +#: tutorial/classes.rst:473 msgid "" "If the same attribute name occurs in both an instance and in a class, then " "attribute lookup prioritizes the instance::" msgstr "" - -#: tutorial/classes.rst:492 +"Αν το ίδιο όνομα χαρακτηριστικού εμφανίζεται και σε ένα στιγμιότυπο και σε " +"μια κλάση, τότε η αναζήτηση χαρακτηριστικών δίνει προτεραιότητα στο " +"στιγμιότυπο::" + +#: tutorial/classes.rst:476 +msgid "" +">>> class Warehouse:\n" +"... purpose = 'storage'\n" +"... region = 'west'\n" +"...\n" +">>> w1 = Warehouse()\n" +">>> print(w1.purpose, w1.region)\n" +"storage west\n" +">>> w2 = Warehouse()\n" +">>> w2.region = 'east'\n" +">>> print(w2.purpose, w2.region)\n" +"storage east" +msgstr "" +">>> class Warehouse:\n" +"... purpose = 'storage'\n" +"... region = 'west'\n" +"...\n" +">>> w1 = Warehouse()\n" +">>> print(w1.purpose, w1.region)\n" +"storage west\n" +">>> w2 = Warehouse()\n" +">>> w2.region = 'east'\n" +">>> print(w2.purpose, w2.region)\n" +"storage east" + +#: tutorial/classes.rst:488 msgid "" "Data attributes may be referenced by methods as well as by ordinary users " "(\"clients\") of an object. In other words, classes are not usable to " @@ -529,8 +1089,17 @@ msgid "" "implementation details and control access to an object if necessary; this " "can be used by extensions to Python written in C.)" msgstr "" +"Τα χαρακτηριστικά δεδομένων μπορούν να αναφέρονται με μεθόδους καθώς και από " +"απλούς χρήστες (\"πελάτες\") ενός αντικειμένου. Με άλλα λόγια, οι κλάσεις " +"δεν μπορούν να χρησιμοποιηθούν για την υλοποίηση καθαρών αφηρημένων τύπων " +"δεδομένων. Στην πραγματικότητα, τίποτα στην Python δεν καθιστά δυνατή την " +"επιβολή της απόκρυψης δεδομένων --- όλα βασίζονται σε σύμβαση. (από την άλλη " +"πλευρά, η εφαρμογή Python, γραμμένη σε C, μπορεί να αποκρύψει εντελώς τις " +"λεπτομέρειες υλοποίησης και να ελέγξει την πρόσβαση σε ένα αντικείμενο εάν " +"είναι απαραίτητο αυτό μπορεί να χρησιμοποιηθεί από επεκτάσεις στην Python " +"γραμμένες σε C.)" -#: tutorial/classes.rst:500 +#: tutorial/classes.rst:496 msgid "" "Clients should use data attributes with care --- clients may mess up " "invariants maintained by the methods by stamping on their data attributes. " @@ -538,16 +1107,28 @@ msgid "" "without affecting the validity of the methods, as long as name conflicts are " "avoided --- again, a naming convention can save a lot of headaches here." msgstr "" +"Οι χρήστες θα πρέπει να χρησιμοποιούν τα χαρακτηριστικά δεδομένων με προσοχή " +"--- οι χρήστες ενδέχεται να μπερδέψουν τα αμετάβλητα που διατηρούνται από " +"τις μεθόδους σφραγίζοντας τα χαρακτηριστικά των δεδομένων τους. Λάβετε υπόψη " +"ότι οι χρήστες μπορούν να προσθέσουν δικά τους χαρακτηριστικά δεδομένων σε " +"ένα αντικείμενο στιγμιότυπου χωρίς να επηρεάσουν την εγκυρότητα των μεθόδων, " +"εφόσον αποφεύγονται οι συγκρούσεις ονομάτων --- και πάλι, μια σύμβαση " +"ονομασίας μπορεί να σώσει πολλούς πονοκεφάλους εδώ." -#: tutorial/classes.rst:506 +#: tutorial/classes.rst:502 msgid "" "There is no shorthand for referencing data attributes (or other methods!) " "from within methods. I find that this actually increases the readability of " "methods: there is no chance of confusing local variables and instance " "variables when glancing through a method." msgstr "" +"Δεν υπάρχει συντομογραφία για την αναφορά χαρακτηριστικών δεδομένων (ή άλλων " +"μεθόδων!) μέσα από τις μεθόδους. Διαπιστώνω ότι αυτό στην πραγματικότητα " +"αυξάνει την αναγνωσιμότητα των μεθόδων: δεν υπάρχει καμία πιθανότητα " +"σύγχυσης τοπικών μεταβλητών και των μεταβλητών παραδείγματος όταν εξετάζουμε " +"μια μέθοδο." -#: tutorial/classes.rst:511 +#: tutorial/classes.rst:507 msgid "" "Often, the first argument of a method is called ``self``. This is nothing " "more than a convention: the name ``self`` has absolutely no special meaning " @@ -556,30 +1137,98 @@ msgid "" "that a *class browser* program might be written that relies upon such a " "convention." msgstr "" +"Συχνά, το πρώτο όρισμα μιας μεθόδου ονομάζεται `self`. Αυτό δεν είναι τίποτα " +"περισσότερο από μια σύμβαση: το όνομα `self` δεν έχει καμία απολύτως " +"ιδιαίτερη σημασία για την Python. Σημειώστε, ωστόσο, ότι αν δεν ακολουθήσετε " +"τη σύμβαση ο κώδικάς σας μπορεί να είναι λιγότερο ευανάγνωστος σε άλλους " +"προγραμματιστές Python, και είναι επίσης κατανοητό ότι μπορεί να γραφτεί ένα " +"πρόγραμμα *class browser* που να βασίζεται σε μια τέτοια σύμβαση." -#: tutorial/classes.rst:517 +#: tutorial/classes.rst:513 msgid "" "Any function object that is a class attribute defines a method for instances " "of that class. It is not necessary that the function definition is " "textually enclosed in the class definition: assigning a function object to a " "local variable in the class is also ok. For example::" msgstr "" - -#: tutorial/classes.rst:534 +"Κάθε αντικείμενο συνάρτησης που είναι χαρακτηριστικό κλάσης ορίζει μια " +"μέθοδο για στιγμιότυπα αυτής της κλάσης. Δεν είναι απαραίτητο ο ορισμός της " +"συνάρτησης να περικλείεται με κείμενο στον ορισμό της κλάσης: η αντιστοίχηση " +"ενός αντικειμένου συνάρτησης σε μια τοπική μεταβλητή της κλάσης είναι επίσης " +"εντάξει. Για παράδειγμα::" + +#: tutorial/classes.rst:518 +msgid "" +"# Function defined outside the class\n" +"def f1(self, x, y):\n" +" return min(x, x+y)\n" +"\n" +"class C:\n" +" f = f1\n" +"\n" +" def g(self):\n" +" return 'hello world'\n" +"\n" +" h = g" +msgstr "" +"# Function defined outside the class\n" +"def f1(self, x, y):\n" +" return min(x, x+y)\n" +"\n" +"class C:\n" +" f = f1\n" +"\n" +" def g(self):\n" +" return 'hello world'\n" +"\n" +" h = g" + +#: tutorial/classes.rst:530 msgid "" "Now ``f``, ``g`` and ``h`` are all attributes of class :class:`!C` that " "refer to function objects, and consequently they are all methods of " "instances of :class:`!C` --- ``h`` being exactly equivalent to ``g``. Note " "that this practice usually only serves to confuse the reader of a program." msgstr "" +"Τώρα τα ``f``, ``g`` και ``h`` είναι όλα χαρακτηριστικά της κλάσης :class:`!" +"C` που αναφέρονται σε αντικείμενα συνάρτησης, και κατά συνέπεια είναι όλες " +"μέθοδοι στιγμιοτύπων του :class:`!C` --- Το ``h`` είναι ακριβώς ισοδύναμο με " +"το ``g``. Σημειώστε ότι αυτή η πρακτική συνήθως χρησιμεύει μόνο για να " +"μπερδέψει τον αναγνώστη ενός προγράμματος." -#: tutorial/classes.rst:539 +#: tutorial/classes.rst:535 msgid "" "Methods may call other methods by using method attributes of the ``self`` " "argument::" msgstr "" - -#: tutorial/classes.rst:553 +"Οι μέθοδοι μπορούν να καλούν άλλες μεθόδους χρησιμοποιώντας χαρακτηριστικά " +"μεθόδου του argument ``self``::" + +#: tutorial/classes.rst:538 +msgid "" +"class Bag:\n" +" def __init__(self):\n" +" self.data = []\n" +"\n" +" def add(self, x):\n" +" self.data.append(x)\n" +"\n" +" def addtwice(self, x):\n" +" self.add(x)\n" +" self.add(x)" +msgstr "" +"class Bag:\n" +" def __init__(self):\n" +" self.data = []\n" +"\n" +" def add(self, x):\n" +" self.data.append(x)\n" +"\n" +" def addtwice(self, x):\n" +" self.add(x)\n" +" self.add(x)" + +#: tutorial/classes.rst:549 msgid "" "Methods may reference global names in the same way as ordinary functions. " "The global scope associated with a method is the module containing its " @@ -591,33 +1240,74 @@ msgid "" "itself defined in this global scope, and in the next section we'll find some " "good reasons why a method would want to reference its own class." msgstr "" +"Οι μέθοδοι μπορεί να αναφέρονται σε καθολικά ονόματα με τον ίδιο τρόπο όπως " +"οι συνηθισμένες συναρτήσεις.Η καθολική εμβέλεια που σχετίζεται με μια μέθοδο " +"είναι το module που περιέχει τον ορισμό της. (Μια κλάση δεν χρησιμοποιείται " +"ποτέ ως καθολική εμβέλεια.) Αν και σπάνια συναντά κανείς έναν καλό λόγο για " +"τη χρήση καθολικών δεδομένων σε μια μέθοδο, υπάρχουν πολλές Νόμιμες χρήσεις " +"της καθολικής εμβέλειας: για ένα πράγμα, οι λειτουργίες και οι λειτουργικές " +"μονάδες που εισάγονται στην καθολική εμβέλεια μπορούν να χρησιμοποιηθούν από " +"μεθόδους, καθώς και συναρτήσεις και κλάσεις που ορίζονται σε αυτό. Συνήθως, " +"η κλάση που περιέχει τη μέθοδο ορίζεται από μόνη της σε αυτή την καθολική " +"εμβέλεια, και στην επόμενη ενότητα θα βρούμε μερικούς καλούς λόγους για τους " +"οποίους μια μέθοδος θα ήθελε να αναφέρει τη δική της κλάση." -#: tutorial/classes.rst:563 +#: tutorial/classes.rst:559 msgid "" "Each value is an object, and therefore has a *class* (also called its " "*type*). It is stored as ``object.__class__``." msgstr "" +"Κάθε τιμή είναι ένα αντικείμενο και επομένως έχει μια *κλάση* (ονομάζεται " +"επίσης *τύπος* της). Αποθηκεύεται ως ``object.__class__``." -#: tutorial/classes.rst:570 +#: tutorial/classes.rst:566 msgid "Inheritance" -msgstr "" +msgstr "Κληρονομικότητα" -#: tutorial/classes.rst:572 +#: tutorial/classes.rst:568 msgid "" "Of course, a language feature would not be worthy of the name \"class\" " "without supporting inheritance. The syntax for a derived class definition " "looks like this::" msgstr "" +"Φυσικά, ένα χαρακτηριστικό γλώσσας δεν θα ήταν αντάξιο του ονόματος " +"\"class\" χωρίς την υποστήριξη της κληρονομικότητας. Η σύνταξη για έναν " +"παραγόμενο ορισμό κλάσης μοιάζει με αυτό:" + +#: tutorial/classes.rst:572 +msgid "" +"class DerivedClassName(BaseClassName):\n" +" \n" +" .\n" +" .\n" +" .\n" +" " +msgstr "" +"class DerivedClassName(BaseClassName):\n" +" \n" +" .\n" +" .\n" +" .\n" +" " -#: tutorial/classes.rst:583 +#: tutorial/classes.rst:579 msgid "" "The name :class:`!BaseClassName` must be defined in a namespace accessible " "from the scope containing the derived class definition. In place of a base " "class name, other arbitrary expressions are also allowed. This can be " "useful, for example, when the base class is defined in another module::" msgstr "" +"Το όνομα :class:`!BaseClassName` πρέπει να οριστεί σε έναν χώρο ονομάτων " +"προσβάσιμο από το πεδίο που περιέχει τον παραγόμενο ορισμό κλάσης. Στη θέση " +"ενός ονόματος βασικής κλάσης, επιτρέπονται και άλλες αυθαίρετες εκφράσεις. " +"Αυτό μπορεί να είναι χρήσιμο, για παράδειγμα, όταν η βασική κλάση ορίζεται " +"σε άλλη module::" + +#: tutorial/classes.rst:585 +msgid "class DerivedClassName(modname.BaseClassName):" +msgstr "class DerivedClassName(modname.BaseClassName):" -#: tutorial/classes.rst:591 +#: tutorial/classes.rst:587 msgid "" "Execution of a derived class definition proceeds the same as for a base " "class. When the class object is constructed, the base class is remembered. " @@ -626,8 +1316,15 @@ msgid "" "rule is applied recursively if the base class itself is derived from some " "other class." msgstr "" +"Η εκτέλεση ενός παραγόμενου ορισμού κλάσης προχωρά το ίδιο όπως για μια " +"βασική κλάση. Όταν το αντικείμενο της κλάσης κατασκευάζεται, η βασική κλάση " +"απομνημονεύεται.Αυτό χρησιμοποιείται για την επίλυση αναφορών " +"χαρακτηριστικών: εάν ένα ζητούμενο χαρακτηριστικό δεν βρεθεί στην κλάση, η " +"αναζήτηση προχωρά στην αναζήτηση στη βασική κλάση. Αυτός ο κανόνας " +"εφαρμόζεται αναδρομικά εάν η ίδια η βασική κλάση προέρχεται από κάποια άλλη " +"κλάση." -#: tutorial/classes.rst:597 +#: tutorial/classes.rst:593 msgid "" "There's nothing special about instantiation of derived classes: " "``DerivedClassName()`` creates a new instance of the class. Method " @@ -635,8 +1332,14 @@ msgid "" "searched, descending down the chain of base classes if necessary, and the " "method reference is valid if this yields a function object." msgstr "" +"Δεν υπάρχει τίποτα το ιδιαίτερο σχετικά με την δημιουργία στιγμιότυπου " +"παραγόμενων κλάσεων: ``DerivedClassName()`` δημιουργεί ένα νέο στιγμιότυπο " +"της κλάσης. Οι αναφορές μεθόδων επιλύονται ως εξής: γίνεται αναζήτηση του " +"αντίστοιχου χαρακτηριστικού κλάσης, κατεβαίνοντας προς τα κάτω στην αλυσίδα " +"των βασικών κλάσεων εάν είναι απαραίτητο, και η αναφορά της μεθόδου είναι " +"έγκυρη εάν αυτό αποδίδει ένα αντικείμενο συνάρτησης." -#: tutorial/classes.rst:603 +#: tutorial/classes.rst:599 msgid "" "Derived classes may override methods of their base classes. Because methods " "have no special privileges when calling other methods of the same object, a " @@ -644,8 +1347,15 @@ msgid "" "class may end up calling a method of a derived class that overrides it. " "(For C++ programmers: all methods in Python are effectively ``virtual``.)" msgstr "" +"Οι παράγωγες κλάσεις ενδέχεται να παρακάμπτουν τις μεθόδους των βασικών τους " +"κλάσεων. Επειδή οι μέθοδοι δεν έχουν ειδικά προνόμια όταν καλούν άλλες " +"μεθόδους του ίδιου αντικειμένου, μια μέθοδος μιας βασικής κλάσης που καλεί " +"μια άλλη μέθοδο που ορίζεται στην ίδια βασική κλάση μπορεί να καταλήξει να " +"καλεί μια μέθοδο μιας παραγόμενης κλάσης που την αντικαθιστά.(Για " +"προγραμματιστές C++: όλες οι μέθοδοι στην Python είναι ουσιαστικά " +"«εικονικές».)" -#: tutorial/classes.rst:609 +#: tutorial/classes.rst:605 msgid "" "An overriding method in a derived class may in fact want to extend rather " "than simply replace the base class method of the same name. There is a " @@ -654,37 +1364,72 @@ msgid "" "well. (Note that this only works if the base class is accessible as " "``BaseClassName`` in the global scope.)" msgstr "" +"Μια υπερισχύουσα μέθοδος σε μια παραγόμενη κλάση μπορεί στην πραγματικότητα " +"να θέλει να επεκτείνει αντί να αντικαταστήσει απλώς τη μέθοδο βασικής κλάσης " +"με το ίδιο όνομα. Υπάρχει ένας απλός τρόπος για να καλέσετε τη μέθοδο " +"βασικής κλάσης απευθείας: απλώς καλέστε το ``BaseClassName.methodname(self, " +"arguments)``. Αυτό είναι περιστασιακά χρήσιμο στους χρήστες (Λάβετε υπόψη " +"ότι αυτό λειτουργεί μόνο εάν η βασική κλάση είναι προσβάσιμη ως " +"``BaseClassName`` στην καθολική εμβέλεια.)" -#: tutorial/classes.rst:616 +#: tutorial/classes.rst:612 msgid "Python has two built-in functions that work with inheritance:" msgstr "" +"Η Python έχει δύο (ενσωματωμένες) built-in συναρτήσεις που λειτουργούν με " +"κληρονομικότητα:" -#: tutorial/classes.rst:618 +#: tutorial/classes.rst:614 msgid "" "Use :func:`isinstance` to check an instance's type: ``isinstance(obj, int)`` " "will be ``True`` only if ``obj.__class__`` is :class:`int` or some class " "derived from :class:`int`." msgstr "" +"Χρησιμοποιήστε το :func:`isinstance` για να ελέγξετε τον τύπο ενός " +"στιγμιότυπου: το ``isinstance(obj, int)`` θα είναι ``True`` μόνο εάν το " +"``obj.__class__`` είναι :class:`int` ή προέρχεται από κάποια κλάση από :" +"class:`int`." -#: tutorial/classes.rst:622 +#: tutorial/classes.rst:618 msgid "" "Use :func:`issubclass` to check class inheritance: ``issubclass(bool, int)`` " "is ``True`` since :class:`bool` is a subclass of :class:`int`. However, " "``issubclass(float, int)`` is ``False`` since :class:`float` is not a " "subclass of :class:`int`." msgstr "" +"Χρησιμοποιήστε το :func:`issubclass` για να ελέγξετε την κληρονομικότητα " +"κλάσης: Το ``issubclass(bool, int)`` είναι ``True`` αφού το :class:`bool` " +"είναι υποκλάση του :class:`int`. Ωστόσο, το ``issubclass(float, int)`` είναι " +"``False`` αφού το :class:`float` δεν είναι υποκλάση του :class:`int`." -#: tutorial/classes.rst:632 +#: tutorial/classes.rst:628 msgid "Multiple Inheritance" -msgstr "" +msgstr "Πολλαπλή Κληρονομικότητα" -#: tutorial/classes.rst:634 +#: tutorial/classes.rst:630 msgid "" "Python supports a form of multiple inheritance as well. A class definition " "with multiple base classes looks like this::" msgstr "" +"Η Python υποστηρίζει επίσης μια μορφή πολλαπλής κληρονομικότητας. Ένας " +"ορισμός κλάσης με πολλαπλές βασικές κλάσεις μοιάζει με αυτό::" -#: tutorial/classes.rst:644 +#: tutorial/classes.rst:633 +msgid "" +"class DerivedClassName(Base1, Base2, Base3):\n" +" \n" +" .\n" +" .\n" +" .\n" +" " +msgstr "" +"class DerivedClassName(Base1, Base2, Base3):\n" +" \n" +" .\n" +" .\n" +" .\n" +" " + +#: tutorial/classes.rst:640 msgid "" "For most purposes, in the simplest cases, you can think of the search for " "attributes inherited from a parent class as depth-first, left-to-right, not " @@ -694,8 +1439,15 @@ msgid "" "classes of :class:`!Base1`, and if it was not found there, it was searched " "for in :class:`!Base2`, and so on." msgstr "" +"Για τους περισσότερους σκοπούς, στις πιο απλές περιπτώσεις, μπορείτε να " +"σκεφτείτε την αναζήτηση χαρακτηριστικών που κληρονομήθηκαν από μια γονική " +"κλάση ως depth-first, από αριστερά προς τα δεξιά, χωρίς αναζήτηση δύο φορές " +"στην ίδια κλάση όπου υπάρχει επικάλυψη στην ιεραρχία. Έτσι, εάν δεν βρεθεί " +"ένα χαρακτηριστικό στο :class:`!DerivedClassName`, αναζητείται στο :class:`!" +"Base1` και μετά (αναδρομικά) στις βασικές κλάσεις του :class:`!Base1`, και " +"αν δεν βρέθηκε εκεί,αναζητήθηκε στο :class:`!Base2`, και ούτω καθεξής." -#: tutorial/classes.rst:651 +#: tutorial/classes.rst:647 msgid "" "In fact, it is slightly more complex than that; the method resolution order " "changes dynamically to support cooperative calls to :func:`super`. This " @@ -703,8 +1455,13 @@ msgid "" "method and is more powerful than the super call found in single-inheritance " "languages." msgstr "" +"Στην πραγματικότητα, είναι λίγο πιο περίπλοκο από αυτό. Η σειρά ανάλυσης της " +"μεθόδου αλλάζει δυναμικά για να υποστηρίξει συνεργατικές κλήσεις σε :func:" +"`super`. Αυτή η προσέγγιση είναι γνωστή σε ορισμένες άλλες γλώσσες πολλαπλής " +"κληρονομικότητας ως call-next-method και είναι πιο ισχυρή από τη σούπερ " +"κλήση που βρίσκεται σε γλώσσες μεμονωμένης κληρονομικότητας." -#: tutorial/classes.rst:657 +#: tutorial/classes.rst:653 msgid "" "Dynamic ordering is necessary because all cases of multiple inheritance " "exhibit one or more diamond relationships (where at least one of the parent " @@ -717,15 +1474,29 @@ msgid "" "and that is monotonic (meaning that a class can be subclassed without " "affecting the precedence order of its parents). Taken together, these " "properties make it possible to design reliable and extensible classes with " -"multiple inheritance. For more detail, see https://www.python.org/download/" -"releases/2.3/mro/." -msgstr "" - -#: tutorial/classes.rst:674 +"multiple inheritance. For more detail, see :ref:`python_2.3_mro`." +msgstr "" +"Η δυναμική σειρά είναι απαραίτητη επειδή όλες οι περιπτώσεις πολλαπλής " +"κληρονομικότητας εμφανίζουν μία ή περισσότερες σχέσεις διαμαντιών (όπου " +"τουλάχιστον μια από τις γονικές κλάσεις μπορεί να προσπελαστεί μέσω " +"πολλαπλών διαδρομών από την κατώτατη κλάση). Για παράδειγμα, όλες οι κλάσεις " +"κληρονομούν από :class:`object`, επομένως κάθε περίπτωση πολλαπλής " +"κληρονομικότητας παρέχει περισσότερες από μία διαδρομές για να φτάσετε στο :" +"class:`object`. Για να μην υπάρχει πρόσβαση στις βασικές κλάσεις " +"περισσότερες από μία φορές, ο δυναμικός αλγόριθμος γραμμικοποιεί τη σειρά " +"αναζήτησης με τρόπο που διατηρεί τη σειρά από αριστερά προς τα δεξιά-που " +"καθορίζεται σε κάθε κλάση, που καλεί κάθε γονέα μόνο μία φορά, και που είναι " +"μονότονος (που σημαίνει ότι μια κλάση μπορεί να γίνει υπό-κλάση χωρίς να " +"επηρεαστεί η σειρά προτεραιότητας των γονέων της). Συνολικά, αυτές οι " +"ιδιότητες καθιστούν δυνατό τον σχεδιασμό αξιόπιστων και επεκτάσιμων κλάσεων " +"με πολλαπλή κληρονομικότητα. Για περισσότερες λεπτομέρειες, δείτε :ref:" +"`python_2.3_mro`." + +#: tutorial/classes.rst:670 msgid "Private Variables" -msgstr "" +msgstr "Ιδιωτικές Μεταβλητές" -#: tutorial/classes.rst:676 +#: tutorial/classes.rst:672 msgid "" "\"Private\" instance variables that cannot be accessed except from inside an " "object don't exist in Python. However, there is a convention that is " @@ -734,8 +1505,15 @@ msgid "" "a function, a method or a data member). It should be considered an " "implementation detail and subject to change without notice." msgstr "" +"Οι μεταβλητές στιγμιοτύπου \"Private\" στις οποίες δεν είναι δυνατή η " +"πρόσβαση εκτός από το εσωτερικό ενός αντικειμένου,δεν υπάρχουν στην Python. " +"Ωστόσο, υπάρχει μια σύμβαση που ακολουθείται από τον περισσότερο Python " +"κώδικα: ένα όνομα με πρόθεμα κάτω παύλα (π.χ. ``_spam``) θα πρέπει να " +"αντιμετωπίζεται ως μη δημόσιο μέρος του API (είτε πρόκειται για συνάρτηση," +"μέθοδο ή μέλος δεδομένων). Θα πρέπει να θεωρείται ως λεπτομέρεια υλοποίησης " +"και υπόκειται σε αλλαγές χωρίς προειδοποίηση." -#: tutorial/classes.rst:686 +#: tutorial/classes.rst:682 msgid "" "Since there is a valid use-case for class-private members (namely to avoid " "name clashes of names with names defined by subclasses), there is limited " @@ -746,30 +1524,100 @@ msgid "" "stripped. This mangling is done without regard to the syntactic position of " "the identifier, as long as it occurs within the definition of a class." msgstr "" +"Δεδομένου ότι υπάρχει μια έγκυρη περίπτωση χρήσης για ιδιωτικά μέλη της " +"κλάσης (δηλαδή για να αποφευχθούν συγκρούσεις ονομάτων με ονόματα που " +"ορίζονται από υποκλάσεις), υπάρχει περιορισμένη υποστήριξη για έναν τέτοιο " +"μηχανισμό, που ονομάζεται :dfn:`name mangling`. Οποιοδήποτε αναγνωριστικό " +"της φόρμας ``__spam`` (τουλάχιστον δύο προπορευόμενες κάτω παύλες, το πολύ " +"μια στη συνέχεια κάτω παύλα) αντικαθίσταται με κείμενο με το " +"``_classname__spam``, όπου το ``classname`` είναι το όνομα της τρέχουσας " +"τάξης με την πρώτη υπογράμμιση stripped. Αυτό το mangling γίνεται χωρίς να " +"λαμβάνεται υπόψη η συντακτική θέση του του αναγνωριστικού, αρκεί να " +"εμφανίζεται εντός του ορισμού μιας κλάσης." -#: tutorial/classes.rst:695 +#: tutorial/classes.rst:693 +msgid "" +"The :ref:`private name mangling specifications ` for " +"details and special cases." +msgstr "" +"Οι :ref:`προδιαγραφές παραποίησης ιδιωτικού ονόματος ` για λεπτομέρειες και ειδικές περιπτώσεις." + +#: tutorial/classes.rst:696 msgid "" "Name mangling is helpful for letting subclasses override methods without " "breaking intraclass method calls. For example::" msgstr "" - -#: tutorial/classes.rst:717 +"Η παραβίαση ονομάτων είναι χρήσιμη για να επιτρέπεται στις υποκλάσεις να " +"παρακάμπτουν μεθόδους χωρίς να διακόπτουν τις κλήσεις μεθόδων ενδοκλάσεων. " +"Για παράδειγμα::" + +#: tutorial/classes.rst:699 +msgid "" +"class Mapping:\n" +" def __init__(self, iterable):\n" +" self.items_list = []\n" +" self.__update(iterable)\n" +"\n" +" def update(self, iterable):\n" +" for item in iterable:\n" +" self.items_list.append(item)\n" +"\n" +" __update = update # private copy of original update() method\n" +"\n" +"class MappingSubclass(Mapping):\n" +"\n" +" def update(self, keys, values):\n" +" # provides new signature for update()\n" +" # but does not break __init__()\n" +" for item in zip(keys, values):\n" +" self.items_list.append(item)" +msgstr "" +"class Mapping:\n" +" def __init__(self, iterable):\n" +" self.items_list = []\n" +" self.__update(iterable)\n" +"\n" +" def update(self, iterable):\n" +" for item in iterable:\n" +" self.items_list.append(item)\n" +"\n" +" __update = update # private copy of original update() method\n" +"\n" +"class MappingSubclass(Mapping):\n" +"\n" +" def update(self, keys, values):\n" +" # provides new signature for update()\n" +" # but does not break __init__()\n" +" for item in zip(keys, values):\n" +" self.items_list.append(item)" + +#: tutorial/classes.rst:718 msgid "" "The above example would work even if ``MappingSubclass`` were to introduce a " "``__update`` identifier since it is replaced with ``_Mapping__update`` in " "the ``Mapping`` class and ``_MappingSubclass__update`` in the " "``MappingSubclass`` class respectively." msgstr "" +"Το παραπάνω παράδειγμα θα λειτουργούσε ακόμα και αν το ``MappingSubclass`` " +"εισήγαγε ένα αναγνωριστικό ``__update`` αφού αντικαταστάθηκε με το " +"``_Mapping__update`` στην κλάση ``Mapping`` και με το " +"``_MappingSubclass__update`` στη κλάση ``MappingSubclass`` αντίστοιχα." -#: tutorial/classes.rst:722 +#: tutorial/classes.rst:723 msgid "" "Note that the mangling rules are designed mostly to avoid accidents; it " "still is possible to access or modify a variable that is considered " "private. This can even be useful in special circumstances, such as in the " "debugger." msgstr "" +"Λάβετε υπόψη ότι οι κανόνες παραβίασης έχουν σχεδιαστεί κυρίως για την " +"αποφυγή ατυχημάτων.Εξακολουθεί να είναι δυνατή η πρόσβαση ή η τροποποίηση " +"μιας μεταβλητής που θεωρείται ιδιωτική. Αυτό μπορεί να είναι χρήσιμο ακόμη " +"και σε ειδικές περιπτώσεις, όπως στο πρόγραμμα εντοπισμού " +"σφαλμάτων(debugger)." -#: tutorial/classes.rst:726 +#: tutorial/classes.rst:727 msgid "" "Notice that code passed to ``exec()`` or ``eval()`` does not consider the " "classname of the invoking class to be the current class; this is similar to " @@ -778,19 +1626,62 @@ msgid "" "applies to ``getattr()``, ``setattr()`` and ``delattr()``, as well as when " "referencing ``__dict__`` directly." msgstr "" +"Σημειώστε ότι ο κώδικας που μεταβιβάστηκε στο ``exec()`` ή στο ``eval()`` " +"δεν θεωρεί ότι το το όνομα κλάσης της κλάσης επίκλησης να είναι η τρέχουσα " +"κλάση. Αυτό είναι παρόμοιο με το αποτέλεσμα της ``καθολικής`` δήλωσης , το " +"αποτέλεσμα της οποίας επίσης περιορίζεται στον κώδικα που έχει " +"μεταγλωττιστεί μαζί(byte-compiled). Ο ίδιος περιορισμός ισχύει για τα " +"``getattr()``, ``setattr()`` και ``delattr()``, καθώς και όταν γίνεται " +"αναφορά απευθείας στο ``__dict__``." -#: tutorial/classes.rst:737 +#: tutorial/classes.rst:738 msgid "Odds and Ends" -msgstr "" +msgstr "Μικροπράγματα" -#: tutorial/classes.rst:739 +#: tutorial/classes.rst:740 msgid "" "Sometimes it is useful to have a data type similar to the Pascal \"record\" " "or C \"struct\", bundling together a few named data items. The idiomatic " "approach is to use :mod:`dataclasses` for this purpose::" msgstr "" - -#: tutorial/classes.rst:759 +"Μερικές φορές είναι χρήσιμο να έχετε έναν τύπο δεδομένων παρόμοιο με τον " +"Pascal \"record\" ή C \"struct\", ομαδοποιώντας μερικά επώνυμα στοιχεία " +"δεδομένων. Η ιδιωματική προσέγγιση είναι η χρήση :mod:`dataclasses` για " +"αυτόν τον σκοπό::" + +#: tutorial/classes.rst:744 +msgid "" +"from dataclasses import dataclass\n" +"\n" +"@dataclass\n" +"class Employee:\n" +" name: str\n" +" dept: str\n" +" salary: int" +msgstr "" +"from dataclasses import dataclass\n" +"\n" +"@dataclass\n" +"class Employee:\n" +" name: str\n" +" dept: str\n" +" salary: int" + +#: tutorial/classes.rst:754 +msgid "" +">>> john = Employee('john', 'computer lab', 1000)\n" +">>> john.dept\n" +"'computer lab'\n" +">>> john.salary\n" +"1000" +msgstr "" +">>> john = Employee('john', 'computer lab', 1000)\n" +">>> john.dept\n" +"'computer lab'\n" +">>> john.salary\n" +"1000" + +#: tutorial/classes.rst:760 msgid "" "A piece of Python code that expects a particular abstract data type can " "often be passed a class that emulates the methods of that data type " @@ -799,26 +1690,64 @@ msgid "" "and :meth:`~io.TextIOBase.readline` that get the data from a string buffer " "instead, and pass it as an argument." msgstr "" +"Ένα κομμάτι κώδικα Python που αναμένει έναν συγκεκριμένο αφηρημένο τύπο " +"δεδομένων μπορεί συχνά να περάσει σε μια κλάση που μιμείται τις μεθόδους " +"αυτού του τύπου δεδομένων. Για παράδειγμα, εάν έχετε μια συνάρτηση που " +"μορφοποιεί ορισμένα δεδομένα από ένα αντικείμενο αρχείου, μπορείτε να " +"ορίσετε μια κλάση με μεθόδους :meth:`~io.TextIOBase.read` και :meth:`~io." +"TextIOBase.readline` που λαμβάνουν τα δεδομένα από ένα buffer συμβολοσειρών " +"αντ' αυτού, και περάστε το ως όρισμα." -#: tutorial/classes.rst:771 +#: tutorial/classes.rst:772 msgid "" ":ref:`Instance method objects ` have attributes, too: :" "attr:`m.__self__ ` is the instance object with the method :" "meth:`!m`, and :attr:`m.__func__ ` is the :ref:`function " "object ` corresponding to the method." msgstr "" +":ref:`Instance method objects ` έχουν επίσης " +"χαρακτηριστικά: :attr:`m.__self__ ` είναι το αντικείμενο " +"παρουσίας με τη μέθοδο :meth:`!m`, και :attr:`m.__func__ ` " +"είναι το :ref:`αντικείμενο συνάρτησης ` που αντιστοιχεί " +"στη μέθοδο." -#: tutorial/classes.rst:781 +#: tutorial/classes.rst:782 msgid "Iterators" -msgstr "" +msgstr "Επαναλήπτες" -#: tutorial/classes.rst:783 +#: tutorial/classes.rst:784 msgid "" "By now you have probably noticed that most container objects can be looped " "over using a :keyword:`for` statement::" msgstr "" - -#: tutorial/classes.rst:797 +"Μέχρι τώρα πιθανότατα έχετε παρατηρήσει ότι τα περισσότερα αντικείμενα " +"container μπορούν να επαναληφθούν χρησιμοποιώντας μια δήλωση :keyword:`for`::" + +#: tutorial/classes.rst:787 +msgid "" +"for element in [1, 2, 3]:\n" +" print(element)\n" +"for element in (1, 2, 3):\n" +" print(element)\n" +"for key in {'one':1, 'two':2}:\n" +" print(key)\n" +"for char in \"123\":\n" +" print(char)\n" +"for line in open(\"myfile.txt\"):\n" +" print(line, end='')" +msgstr "" +"for element in [1, 2, 3]:\n" +" print(element)\n" +"for element in (1, 2, 3):\n" +" print(element)\n" +"for key in {'one':1, 'two':2}:\n" +" print(key)\n" +"for char in \"123\":\n" +" print(char)\n" +"for line in open(\"myfile.txt\"):\n" +" print(line, end='')" + +#: tutorial/classes.rst:798 msgid "" "This style of access is clear, concise, and convenient. The use of " "iterators pervades and unifies Python. Behind the scenes, the :keyword:" @@ -830,8 +1759,52 @@ msgid "" "terminate. You can call the :meth:`~iterator.__next__` method using the :" "func:`next` built-in function; this example shows how it all works::" msgstr "" - -#: tutorial/classes.rst:822 +"Αυτό το στυλ πρόσβασης είναι σαφές, συνοπτικό και βολικό. Η χρήση των " +"Iterators διαπερνά και ενοποιεί την Python. Στο παρασκήνιο, η δήλωση :" +"keyword:`for` καλεί :func:`iter` στο αντικείμενο container. Η συνάρτηση " +"επιστρέφει ένα αντικείμενο iterator που ορίζει τη μέθοδο :meth:`~iterator." +"__next__` η οποία έχει πρόσβαση σε στοιχεία στο container ένα κάθε φορά. " +"Όταν δεν υπάρχουν άλλα στοιχεία, το :meth:`~iterator.__next__` δημιουργεί " +"μια :exc:`StopIteration` εξαίρεση που λέει τον βρόχο :keyword:`!for` να " +"τερματιστεί. Μπορείτε να καλέσετε τη μέθοδο :meth:`~iterator.__next__` " +"χρησιμοποιώντας την ενσωματωμένη συνάρτηση :func:`next`. Αυτό το παράδειγμα " +"δείχνει πώς λειτουργούν όλα::" + +#: tutorial/classes.rst:807 +msgid "" +">>> s = 'abc'\n" +">>> it = iter(s)\n" +">>> it\n" +"\n" +">>> next(it)\n" +"'a'\n" +">>> next(it)\n" +"'b'\n" +">>> next(it)\n" +"'c'\n" +">>> next(it)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" next(it)\n" +"StopIteration" +msgstr "" +">>> s = 'abc'\n" +">>> it = iter(s)\n" +">>> it\n" +"\n" +">>> next(it)\n" +"'a'\n" +">>> next(it)\n" +"'b'\n" +">>> next(it)\n" +"'c'\n" +">>> next(it)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" next(it)\n" +"StopIteration" + +#: tutorial/classes.rst:823 msgid "" "Having seen the mechanics behind the iterator protocol, it is easy to add " "iterator behavior to your classes. Define an :meth:`~container.__iter__` " @@ -839,12 +1812,73 @@ msgid "" "the class defines :meth:`!__next__`, then :meth:`!__iter__` can just return " "``self``::" msgstr "" - -#: tutorial/classes.rst:859 +"Έχοντας δει τους μηχανισμούς πίσω από το πρωτόκολλο iterator, είναι εύκολο " +"να προσθέσετε συμπεριφορά iterator στις κλάσεις σας. Ορίστε μια μέθοδο :meth:" +"`~container.__iter__` που επιστρέφει ένα αντικείμενο με μια μέθοδο :meth:" +"`~iterator.__next__`. Εάν η κλάση ορίζει :meth:`!__next__`, τότε το :meth:`!" +"__iter__` μπορεί απλώς να επιστρέψει ``self``::" + +#: tutorial/classes.rst:828 +msgid "" +"class Reverse:\n" +" \"\"\"Iterator for looping over a sequence backwards.\"\"\"\n" +" def __init__(self, data):\n" +" self.data = data\n" +" self.index = len(data)\n" +"\n" +" def __iter__(self):\n" +" return self\n" +"\n" +" def __next__(self):\n" +" if self.index == 0:\n" +" raise StopIteration\n" +" self.index = self.index - 1\n" +" return self.data[self.index]" +msgstr "" +"class Reverse:\n" +" \"\"\"Iterator for looping over a sequence backwards.\"\"\"\n" +" def __init__(self, data):\n" +" self.data = data\n" +" self.index = len(data)\n" +"\n" +" def __iter__(self):\n" +" return self\n" +"\n" +" def __next__(self):\n" +" if self.index == 0:\n" +" raise StopIteration\n" +" self.index = self.index - 1\n" +" return self.data[self.index]" + +#: tutorial/classes.rst:845 +msgid "" +">>> rev = Reverse('spam')\n" +">>> iter(rev)\n" +"<__main__.Reverse object at 0x00A1DB50>\n" +">>> for char in rev:\n" +"... print(char)\n" +"...\n" +"m\n" +"a\n" +"p\n" +"s" +msgstr "" +">>> rev = Reverse('spam')\n" +">>> iter(rev)\n" +"<__main__.Reverse object at 0x00A1DB50>\n" +">>> for char in rev:\n" +"... print(char)\n" +"...\n" +"m\n" +"a\n" +"p\n" +"s" + +#: tutorial/classes.rst:860 msgid "Generators" -msgstr "" +msgstr "Γεννήτορες (Generators)" -#: tutorial/classes.rst:861 +#: tutorial/classes.rst:862 msgid "" ":term:`Generators ` are a simple and powerful tool for creating " "iterators. They are written like regular functions but use the :keyword:" @@ -853,36 +1887,84 @@ msgid "" "the data values and which statement was last executed). An example shows " "that generators can be trivially easy to create::" msgstr "" +":term:`Generators ` είναι ένα απλό και ισχυρό εργαλείο για τη " +"δημιουργία iterators. Είναι γραμμένες σαν κανονικές συναρτήσεις αλλά " +"χρησιμοποιούν τη :keyword:`yield` όποτε θέλουν να επιστρέψουν δεδομένα. Κάθε " +"φορά που καλείται :func:`next` σε αυτό, ο generator συνεχίζει από εκεί που " +"σταμάτησε (θυμάται όλες τις τιμές δεδομένων και ποια δήλωση εκτελέστηκε " +"τελευταία). Ένα παράδειγμα δείχνει ότι οι generators μπορεί να είναι " +"ασήμαντα εύκολο να δημιουργηθούν::" + +#: tutorial/classes.rst:869 +msgid "" +"def reverse(data):\n" +" for index in range(len(data)-1, -1, -1):\n" +" yield data[index]" +msgstr "" +"def reverse(data):\n" +" for index in range(len(data)-1, -1, -1):\n" +" yield data[index]" + +#: tutorial/classes.rst:875 +msgid "" +">>> for char in reverse('golf'):\n" +"... print(char)\n" +"...\n" +"f\n" +"l\n" +"o\n" +"g" +msgstr "" +">>> for char in reverse('golf'):\n" +"... print(char)\n" +"...\n" +"f\n" +"l\n" +"o\n" +"g" -#: tutorial/classes.rst:882 +#: tutorial/classes.rst:883 msgid "" "Anything that can be done with generators can also be done with class-based " "iterators as described in the previous section. What makes generators so " "compact is that the :meth:`~iterator.__iter__` and :meth:`~generator." "__next__` methods are created automatically." msgstr "" +"Οτιδήποτε μπορεί να γίνει με generators μπορεί να γίνει και με iterators που " +"βασίζονται σε κλάσεις, όπως περιγράφεται στην προηγούμενη ενότητα. Αυτό που " +"κάνει τους generators τόσο συμπαγείς είναι ότι οι μέθοδοι :meth:`~iterator." +"__iter__` και :meth:`~generator.__next__` δημιουργούνται αυτόματα." -#: tutorial/classes.rst:887 +#: tutorial/classes.rst:888 msgid "" "Another key feature is that the local variables and execution state are " "automatically saved between calls. This made the function easier to write " "and much more clear than an approach using instance variables like ``self." "index`` and ``self.data``." msgstr "" +"Ένα άλλο βασικό χαρακτηριστικό είναι ότι οι τοπικές μεταβλητές και η " +"κατάσταση εκτέλεσης αποθηκεύονται αυτόματα μεταξύ των κλήσεων. Αυτό έκανε τη " +"συνάρτηση πιο εύκολη στην γραφή και πολύ πιο ξεκάθαρη από μια προσέγγιση που " +"χρησιμοποιεί μεταβλητές παράδειγμα όπως ``self.index`` και ``self.data``." -#: tutorial/classes.rst:892 +#: tutorial/classes.rst:893 msgid "" "In addition to automatic method creation and saving program state, when " "generators terminate, they automatically raise :exc:`StopIteration`. In " "combination, these features make it easy to create iterators with no more " "effort than writing a regular function." msgstr "" +"Εκτός από την αυτόματη δημιουργία μεθόδου και την αποθήκευση της κατάστασης " +"του προγράμματος, όταν οι generators τερματίζονται, εγείρουν αυτόματα την " +"εξαίρεση :exc:`StopIteration`. Σε συνδυασμό, αυτά τα χαρακτηριστικά " +"καθιστούν εύκολη τη δημιουργία επαναλήψεων χωρίς περισσότερη προσπάθεια από " +"τη σύνταξη μιας κανονικής συνάρτησης." -#: tutorial/classes.rst:901 +#: tutorial/classes.rst:902 msgid "Generator Expressions" -msgstr "" +msgstr "Εκφράσεις Γεννήτορων" -#: tutorial/classes.rst:903 +#: tutorial/classes.rst:904 msgid "" "Some simple generators can be coded succinctly as expressions using a syntax " "similar to list comprehensions but with parentheses instead of square " @@ -891,37 +1973,106 @@ msgid "" "compact but less versatile than full generator definitions and tend to be " "more memory friendly than equivalent list comprehensions." msgstr "" +"Ορισμένοι απλοί generators μπορούν να κωδικοποιηθούν συνοπτικά ως εκφράσεις " +"χρησιμοποιώντας μια σύνταξη παρόμοια με τις list comprehensions, αλλά με " +"παρενθέσεις αντί για αγκύλες. Αυτές οι εκφράσεις έχουν σχεδιαστεί για " +"καταστάσεις όπου ο generator χρησιμοποιείται αμέσως από μια περικλείουσα " +"συνάρτηση. Οι εκφράσεις generator είναι πιο συμπαγείς αλλά λιγότερο " +"ευέλικτες από τους ορισμούς πλήρους generator και τείνουν να είναι " +"περισσότερο φιλικό προς τη μνήμη από αντίστοιχα list comprehensions." -#: tutorial/classes.rst:910 +#: tutorial/classes.rst:911 msgid "Examples::" -msgstr "" +msgstr "Παραδείγματα::" + +#: tutorial/classes.rst:913 +msgid "" +">>> sum(i*i for i in range(10)) # sum of squares\n" +"285\n" +"\n" +">>> xvec = [10, 20, 30]\n" +">>> yvec = [7, 5, 3]\n" +">>> sum(x*y for x,y in zip(xvec, yvec)) # dot product\n" +"260\n" +"\n" +">>> unique_words = set(word for line in page for word in line.split())\n" +"\n" +">>> valedictorian = max((student.gpa, student.name) for student in " +"graduates)\n" +"\n" +">>> data = 'golf'\n" +">>> list(data[i] for i in range(len(data)-1, -1, -1))\n" +"['f', 'l', 'o', 'g']" +msgstr "" +">>> sum(i*i for i in range(10)) # sum of squares\n" +"285\n" +"\n" +">>> xvec = [10, 20, 30]\n" +">>> yvec = [7, 5, 3]\n" +">>> sum(x*y for x,y in zip(xvec, yvec)) # dot product\n" +"260\n" +"\n" +">>> unique_words = set(word for line in page for word in line.split())\n" +"\n" +">>> valedictorian = max((student.gpa, student.name) for student in " +"graduates)\n" +"\n" +">>> data = 'golf'\n" +">>> list(data[i] for i in range(len(data)-1, -1, -1))\n" +"['f', 'l', 'o', 'g']" -#: tutorial/classes.rst:931 +#: tutorial/classes.rst:932 msgid "Footnotes" -msgstr "" +msgstr "Υποσημειώσεις" -#: tutorial/classes.rst:932 +#: tutorial/classes.rst:933 msgid "" "Except for one thing. Module objects have a secret read-only attribute " "called :attr:`~object.__dict__` which returns the dictionary used to " -"implement the module's namespace; the name :attr:`~object.__dict__` is an " -"attribute but not a global name. Obviously, using this violates the " -"abstraction of namespace implementation, and should be restricted to things " -"like post-mortem debuggers." -msgstr "" - -#: tutorial/classes.rst:347 +"implement the module's namespace; the name ``__dict__`` is an attribute but " +"not a global name. Obviously, using this violates the abstraction of " +"namespace implementation, and should be restricted to things like post-" +"mortem debuggers." +msgstr "" +"Εκτός από ένα πράγμα. Τα αντικείμενα του module έχουν ένα μυστικό " +"χαρακτηριστικό μόνο για ανάγνωση που καλείται :attr:`~object.__dict__` το " +"οποίο επιστρέφει το λεξικό που χρησιμοποιείται για την υλοποίηση του χώρου " +"ονομάτων του module.Το όνομα ``__dict__`` είναι ένα χαρακτηριστικό αλλά όχι " +"καθολικό όνομα. Προφανώς, η χρήση αυτού παραβιάζει την αφαίρεση υλοποίησης " +"χώρου ονομάτων και θα πρέπει να περιορίζεται σε πράγματα όπως τα ύστερα " +"προγράμματα εντοπισμού σφαλμάτων." + +#: tutorial/classes.rst:343 msgid "object" -msgstr "" +msgstr "αντικείμενο" -#: tutorial/classes.rst:347 +#: tutorial/classes.rst:343 msgid "method" -msgstr "" +msgstr "μέθοδος" -#: tutorial/classes.rst:683 +#: tutorial/classes.rst:679 msgid "name" -msgstr "" +msgstr "όνομα" -#: tutorial/classes.rst:683 +#: tutorial/classes.rst:679 msgid "mangling" -msgstr "" +msgstr "συντριβή" + +#~ msgid "" +#~ "The other kind of instance attribute reference is a *method*. A method is " +#~ "a function that \"belongs to\" an object. (In Python, the term method is " +#~ "not unique to class instances: other object types can have methods as " +#~ "well. For example, list objects have methods called append, insert, " +#~ "remove, sort, and so on. However, in the following discussion, we'll use " +#~ "the term method exclusively to mean methods of class instance objects, " +#~ "unless explicitly stated otherwise.)" +#~ msgstr "" +#~ "Το άλλο είδος αναφοράς χαρακτηριστικού στιγμιότυπου είναι μια *μέθοδος*. " +#~ "Μια μέθοδος είναι μια συνάρτηση που \"ανήκει\" σε ένα αντικείμενο. (Στην " +#~ "Python, ο όρος μέθοδος δεν είναι μοναδικός σε στιγμιότυπα κλάσεων: άλλοι " +#~ "τύποι αντικειμένων μπορούν επίσης να έχουν μεθόδους. Για παράδειγμα, τα " +#~ "αντικείμενα λίστας έχουν μεθόδους που ονομάζονται προσάρτηση(append), " +#~ "εισαγωγή(insert), αφαίρεση(remove), ταξινόμηση(sort) και ούτω καθεξής. " +#~ "Ωστόσο, στην παρακάτω συζήτηση, θα χρησιμοποιήσουμε τον όρο μέθοδος " +#~ "αποκλειστικά για να εννοούμε μεθόδους αντικειμένων στιγμιότυπου κλάσης, " +#~ "εκτός εάν ρητά δηλώνεται διαφορετικά.)" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index fb1f7b91..b0a41f5a 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-09-30 23:13+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -42,6 +42,36 @@ msgstr "" "Ίσως ο πιο γνωστός τύπος statement είναι η πρόταση :keyword:`if`. Για " "παράδειγμα::" +#: tutorial/controlflow.rst:19 +msgid "" +">>> x = int(input(\"Please enter an integer: \"))\n" +"Please enter an integer: 42\n" +">>> if x < 0:\n" +"... x = 0\n" +"... print('Negative changed to zero')\n" +"... elif x == 0:\n" +"... print('Zero')\n" +"... elif x == 1:\n" +"... print('Single')\n" +"... else:\n" +"... print('More')\n" +"...\n" +"More" +msgstr "" +">>> x = int(input(\"Please enter an integer: \"))\n" +"Please enter an integer: 42\n" +">>> if x < 0:\n" +"... x = 0\n" +"... print('Negative changed to zero')\n" +"... elif x == 0:\n" +"... print('Zero')\n" +"... elif x == 1:\n" +"... print('Single')\n" +"... else:\n" +"... print('More')\n" +"...\n" +"More" + #: tutorial/controlflow.rst:33 msgid "" "There can be zero or more :keyword:`elif` parts, and the :keyword:`else` " @@ -53,7 +83,7 @@ msgstr "" "Μπορεί να υπάρχουν μηδέν ή περισσότερα μέρη :keyword:`elif` και το τμήμα :" "keyword:`else` είναι προαιρετικό. To keyword ':keyword:`!elif`' είναι " "συντομογραφία του 'else if', και είναι χρήσιμη για να αποφύγετε την " -"υπερβολική εσοχή. Μια ακολουθία keyword:`!if` ... :keyword:`!elif` ... :" +"υπερβολική εσοχή. Μια ακολουθία :keyword:`!if` ... :keyword:`!elif` ... :" "keyword:`!elif` ... είναι υποκατάστατο των δηλώσεων ``switch`` ή ``case`` " "που υπάρχουν σε άλλες γλώσσες." @@ -90,6 +120,26 @@ msgstr "" "στοιχεία οποιασδήποτε ακολουθίας (λίστας ή συμβολοσειράς), με τη σειρά που " "εμφανίζονται στην ακολουθία. Για παράδειγμα (χωρίς λογοπαίγνιο)::" +#: tutorial/controlflow.rst:63 +msgid "" +">>> # Measure some strings:\n" +">>> words = ['cat', 'window', 'defenestrate']\n" +">>> for w in words:\n" +"... print(w, len(w))\n" +"...\n" +"cat 3\n" +"window 6\n" +"defenestrate 12" +msgstr "" +">>> # Measure some strings:\n" +">>> words = ['cat', 'window', 'defenestrate']\n" +">>> for w in words:\n" +"... print(w, len(w))\n" +"...\n" +"cat 3\n" +"window 6\n" +"defenestrate 12" + #: tutorial/controlflow.rst:72 msgid "" "Code that modifies a collection while iterating over that same collection " @@ -101,6 +151,36 @@ msgstr "" "συνήθως πιο απλό να κάνετε loop πάνω από ένα αντίγραφο συλλογής ή να " "δημιουργήσετε μια νέα συλλογή::" +#: tutorial/controlflow.rst:76 +msgid "" +"# Create a sample collection\n" +"users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'}\n" +"\n" +"# Strategy: Iterate over a copy\n" +"for user, status in users.copy().items():\n" +" if status == 'inactive':\n" +" del users[user]\n" +"\n" +"# Strategy: Create a new collection\n" +"active_users = {}\n" +"for user, status in users.items():\n" +" if status == 'active':\n" +" active_users[user] = status" +msgstr "" +"# Create a sample collection\n" +"users = {'Hans': 'active', 'Éléonore': 'inactive', '景太郎': 'active'}\n" +"\n" +"# Strategy: Iterate over a copy\n" +"for user, status in users.copy().items():\n" +" if status == 'inactive':\n" +" del users[user]\n" +"\n" +"# Strategy: Create a new collection\n" +"active_users = {}\n" +"for user, status in users.items():\n" +" if status == 'active':\n" +" active_users[user] = status" + #: tutorial/controlflow.rst:94 msgid "The :func:`range` Function" msgstr "Η συνάρτηση :func:`range`" @@ -114,6 +194,26 @@ msgstr "" "(built-in) συνάρτηση :func:`range` είναι χρήσιμη. Δημιουργεί αριθμητικές " "προόδους::" +#: tutorial/controlflow.rst:99 +msgid "" +">>> for i in range(5):\n" +"... print(i)\n" +"...\n" +"0\n" +"1\n" +"2\n" +"3\n" +"4" +msgstr "" +">>> for i in range(5):\n" +"... print(i)\n" +"...\n" +"0\n" +"1\n" +"2\n" +"3\n" +"4" + #: tutorial/controlflow.rst:108 msgid "" "The given end point is never part of the generated sequence; ``range(10)`` " @@ -127,6 +227,26 @@ msgstr "" "άλλο αριθμό ή για να καθορίσετε μια διαφορετική προσαύξηση (ακόμη και " "αρνητική, μερικές φορές αυτό ονομάζεται 'βήμα')::" +#: tutorial/controlflow.rst:113 +msgid "" +">>> list(range(5, 10))\n" +"[5, 6, 7, 8, 9]\n" +"\n" +">>> list(range(0, 10, 3))\n" +"[0, 3, 6, 9]\n" +"\n" +">>> list(range(-10, -100, -30))\n" +"[-10, -40, -70]" +msgstr "" +">>> list(range(5, 10))\n" +"[5, 6, 7, 8, 9]\n" +"\n" +">>> list(range(0, 10, 3))\n" +"[0, 3, 6, 9]\n" +"\n" +">>> list(range(-10, -100, -30))\n" +"[-10, -40, -70]" + #: tutorial/controlflow.rst:122 msgid "" "To iterate over the indices of a sequence, you can combine :func:`range` " @@ -135,6 +255,28 @@ msgstr "" "Για να γίνουν iterate οι δείκτες μια ακολουθίας, μπορείτε να συνδυάσετε τις :" "func:`range` και :func:`len` ως εξής::" +#: tutorial/controlflow.rst:125 +msgid "" +">>> a = ['Mary', 'had', 'a', 'little', 'lamb']\n" +">>> for i in range(len(a)):\n" +"... print(i, a[i])\n" +"...\n" +"0 Mary\n" +"1 had\n" +"2 a\n" +"3 little\n" +"4 lamb" +msgstr "" +">>> a = ['Mary', 'had', 'a', 'little', 'lamb']\n" +">>> for i in range(len(a)):\n" +"... print(i, a[i])\n" +"...\n" +"0 Mary\n" +"1 had\n" +"2 a\n" +"3 little\n" +"4 lamb" + #: tutorial/controlflow.rst:135 msgid "" "In most such cases, however, it is convenient to use the :func:`enumerate` " @@ -147,6 +289,14 @@ msgstr "" msgid "A strange thing happens if you just print a range::" msgstr "Ένα περίεργο πράγμα συμβαίνει αν απλώς εκτυπώσετε ένα range::" +#: tutorial/controlflow.rst:140 +msgid "" +">>> range(10)\n" +"range(0, 10)" +msgstr "" +">>> range(10)\n" +"range(0, 10)" + #: tutorial/controlflow.rst:143 msgid "" "In many ways the object returned by :func:`range` behaves as if it is a " @@ -174,6 +324,14 @@ msgstr "" "ότι η δήλωση :keyword:`for` είναι μια τέτοια κατασκευή, ενώ ένα παράδειγμα " "συνάρτησης που παίρνει ένα iterable είναι η :func:`sum`::" +#: tutorial/controlflow.rst:154 +msgid "" +">>> sum(range(4)) # 0 + 1 + 2 + 3\n" +"6" +msgstr "" +">>> sum(range(4)) # 0 + 1 + 2 + 3\n" +"6" + #: tutorial/controlflow.rst:157 msgid "" "Later we will see more functions that return iterables and take iterables as " @@ -185,38 +343,107 @@ msgstr "" "θα συζητήσουμε λεπτομερέστερα για το :func:`list`." #: tutorial/controlflow.rst:164 -msgid "" -":keyword:`!break` and :keyword:`!continue` Statements, and :keyword:`!else` " -"Clauses on Loops" -msgstr "" -":keyword:`!break` και :keyword:`!continue` Προτάσεις, και :keyword:`!else` " -"Προτάσεις για Loops" +msgid ":keyword:`!break` and :keyword:`!continue` Statements" +msgstr ":keyword:`!break` και :keyword:`!continue` Προτάσεις" #: tutorial/controlflow.rst:166 msgid "" "The :keyword:`break` statement breaks out of the innermost enclosing :" -"keyword:`for` or :keyword:`while` loop." +"keyword:`for` or :keyword:`while` loop::" msgstr "" "Η δήλωση :keyword:`break` ξεφεύγει από τον πιο εσωτερικό βρόχο :keyword:" -"`for` ή :keyword:`while`." +"`for` ή :keyword:`while`::" #: tutorial/controlflow.rst:169 msgid "" -"A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!else` " -"clause." -msgstr "" -"Ένας βρόχος :keyword:`!for` ή :keyword:`!while` μπορεί να περιλαμβάνει μια " -"πρόταση :keyword:`!else`." - -#: tutorial/controlflow.rst:171 +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(f\"{n} equals {x} * {n//x}\")\n" +"... break\n" +"...\n" +"4 equals 2 * 2\n" +"6 equals 2 * 3\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" +msgstr "" +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(f\"{n} equals {x} * {n//x}\")\n" +"... break\n" +"...\n" +"4 equals 2 * 2\n" +"6 equals 2 * 3\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" + +#: tutorial/controlflow.rst:180 +msgid "" +"The :keyword:`continue` statement continues with the next iteration of the " +"loop::" +msgstr "" +"Η δήλωση :keyword:`continue` συνεχίζεται με την επόμενη επανάληψη του " +"βρόχου::" + +#: tutorial/controlflow.rst:183 +msgid "" +">>> for num in range(2, 10):\n" +"... if num % 2 == 0:\n" +"... print(f\"Found an even number {num}\")\n" +"... continue\n" +"... print(f\"Found an odd number {num}\")\n" +"...\n" +"Found an even number 2\n" +"Found an odd number 3\n" +"Found an even number 4\n" +"Found an odd number 5\n" +"Found an even number 6\n" +"Found an odd number 7\n" +"Found an even number 8\n" +"Found an odd number 9" +msgstr "" +">>> for num in range(2, 10):\n" +"... if num % 2 == 0:\n" +"... print(f\"Found an even number {num}\")\n" +"... continue\n" +"... print(f\"Found an odd number {num}\")\n" +"...\n" +"Found an even number 2\n" +"Found an odd number 3\n" +"Found an even number 4\n" +"Found an odd number 5\n" +"Found an even number 6\n" +"Found an odd number 7\n" +"Found an even number 8\n" +"Found an odd number 9" + +#: tutorial/controlflow.rst:202 +msgid ":keyword:`!else` Clauses on Loops" +msgstr ":keyword:`!else` Ρήτρες στους βρόχους" + +#: tutorial/controlflow.rst:204 +msgid "" +"In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` " +"statement may be paired with an :keyword:`!else` clause. If the loop " +"finishes without executing the :keyword:`!break`, the :keyword:`!else` " +"clause executes." +msgstr "" +"Σε έναν βρόχο :keyword:`!for` ή :keyword:`!while` η πρόταση :keyword:`!" +"break` μπορεί να συνδυαστεί με μια πρόταση :keyword:`!else`. Εάν ο βρόχος " +"τελειώσει χωρίς να εκτελεστεί η :keyword:`!break`, εκτελείται ο όρος :" +"keyword:`!else`." + +#: tutorial/controlflow.rst:208 msgid "" "In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the " -"loop reaches its final iteration." +"loop finishes its final iteration, that is, if no break occurred." msgstr "" "Σε έναν βρόχο :keyword:`for`, η πρόταση :keyword:`!else` εκτελείται αφού ο " -"βρόχος φτάσει στην τελική του επανάληψη." +"βρόχος ολοκληρώσει στην τελική του επανάληψη, δηλαδή αν δεν σημειωθεί " +"διάλειμμα." -#: tutorial/controlflow.rst:174 +#: tutorial/controlflow.rst:211 msgid "" "In a :keyword:`while` loop, it's executed after the loop's condition becomes " "false." @@ -224,15 +451,20 @@ msgstr "" "Σε έναν βρόχο :keyword:`while`, εκτελείται αφού η συνθήκη του βρόχου είναι " "ψευδής." -#: tutorial/controlflow.rst:176 +#: tutorial/controlflow.rst:213 msgid "" "In either kind of loop, the :keyword:`!else` clause is **not** executed if " -"the loop was terminated by a :keyword:`break`." +"the loop was terminated by a :keyword:`break`. Of course, other ways of " +"ending the loop early, such as a :keyword:`return` or a raised exception, " +"will also skip execution of the :keyword:`else` clause." msgstr "" "Σε οποιοδήποτε είδος βρόχου, η πρόταση :keyword:`!else` **δεν** εκτελείται " -"εάν ο βρόχος τερματίστηκε με μια λέξη :keyword:`break`." +"εάν ο βρόχος τερματίστηκε με μια λέξη :keyword:`break`. Φυσικά, άλλοι " +"τρόποι για να τερματίσετε νωρίς τον βρόχο, όπως ένα :keyword:`return` ή μια " +"αυξημένη εξαίρεση, θα παρακάμψουν επίσης την εκτέλεση της πρότασης :keyword:" +"`else`." -#: tutorial/controlflow.rst:179 +#: tutorial/controlflow.rst:218 msgid "" "This is exemplified in the following :keyword:`!for` loop, which searches " "for prime numbers::" @@ -240,43 +472,88 @@ msgstr "" "Αυτό αποδεικνύεται στον ακόλουθο βρόχο :keyword:`!for`, που αναζητά πρώτους " "αριθμούς::" -#: tutorial/controlflow.rst:200 +#: tutorial/controlflow.rst:221 +msgid "" +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(n, 'equals', x, '*', n//x)\n" +"... break\n" +"... else:\n" +"... # loop fell through without finding a factor\n" +"... print(n, 'is a prime number')\n" +"...\n" +"2 is a prime number\n" +"3 is a prime number\n" +"4 equals 2 * 2\n" +"5 is a prime number\n" +"6 equals 2 * 3\n" +"7 is a prime number\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" +msgstr "" +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(n, 'equals', x, '*', n//x)\n" +"... break\n" +"... else:\n" +"... # loop fell through without finding a factor\n" +"... print(n, 'is a prime number')\n" +"...\n" +"2 is a prime number\n" +"3 is a prime number\n" +"4 equals 2 * 2\n" +"5 is a prime number\n" +"6 equals 2 * 3\n" +"7 is a prime number\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" + +#: tutorial/controlflow.rst:239 msgid "" "(Yes, this is the correct code. Look closely: the ``else`` clause belongs " -"to the :keyword:`for` loop, **not** the :keyword:`if` statement.)" +"to the ``for`` loop, **not** the ``if`` statement.)" msgstr "" "(Ναι, αυτός είναι ο σωστός κώδικας. Κοιτάξτε προσεκτικά: η πρόταση ``else`` " -"ανήκει στον βρόχο :keyword:`for`, **όχι** στη δήλωση :keyword:`if`.)" +"ανήκει στον βρόχο ``for``, **όχι** στη δήλωση `if`.)" -#: tutorial/controlflow.rst:203 +#: tutorial/controlflow.rst:242 msgid "" -"When used with a loop, the ``else`` clause has more in common with the " -"``else`` clause of a :keyword:`try` statement than it does with that of :" -"keyword:`if` statements: a :keyword:`try` statement's ``else`` clause runs " -"when no exception occurs, and a loop's ``else`` clause runs when no " -"``break`` occurs. For more on the :keyword:`!try` statement and exceptions, " -"see :ref:`tut-handling`." +"One way to think of the else clause is to imagine it paired with the ``if`` " +"inside the loop. As the loop executes, it will run a sequence like if/if/if/" +"else. The ``if`` is inside the loop, encountered a number of times. If the " +"condition is ever true, a ``break`` will happen. If the condition is never " +"true, the ``else`` clause outside the loop will execute." msgstr "" -"Όταν χρησιμοποιείται με έναν βρόχο, η πρόταση ``else`` έχει περισσότερα " -"κοινά με την πρόταση ``else`` μιας πρότασης :keyword:`try` παρά με αυτήν των " -"statements :keyword:`if`: η πρόταση ``else`` μιας δήλωσης :keyword:`try` " -"εκτελείται όταν δεν υπάρχει εξαίρεση, και η πρόταση ``else`` ενός βρόχου " -"εκτελείται όταν δεν υπάρχει ``break``. Για περισσότερα με τη δήλωση :keyword:" -"`!try` και τις εξαιρέσεις, δείτε :ref:`tut-handling`." +"Ένας τρόπος για να σκεφτούμε την ρήτρα else είναι να τη φανταστούμε σε " +"σύζευξη με το ``if`` μέσα στον βρόχο. Καθώς εκτελείται ο βρόχος, θα " +"εκτελέσει μια ακολουθία όπως if/if/if/else. Το ``if`` βρίσκεται μέσα στον " +"βρόχο, συναντάται πολλές φορές. Εάν η συνθήκη είναι ποτέ αληθής, θα συμβεί " +"``break``. Εάν η συνθήκη δεν είναι ποτέ αληθής, θα εκτελεστεί ο όρος " +"``else`` εκτός του βρόχου." -#: tutorial/controlflow.rst:210 +#: tutorial/controlflow.rst:248 msgid "" -"The :keyword:`continue` statement, also borrowed from C, continues with the " -"next iteration of the loop::" +"When used with a loop, the ``else`` clause has more in common with the " +"``else`` clause of a :keyword:`try` statement than it does with that of " +"``if`` statements: a ``try`` statement's ``else`` clause runs when no " +"exception occurs, and a loop's ``else`` clause runs when no ``break`` " +"occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" +"handling`." msgstr "" -"Η δήλωση :keyword:`continue`, επίσης δανεισμένη από τη C, συνεχίζεται με την " -"επόμενη επανάληψη του βρόχου::" +"Όταν χρησιμοποιείται με έναν βρόχο, η πρόταση ``else`` έχει περισσότερα " +"κοινά με την πρόταση ``else`` μιας πρότασης :keyword:`try` παρά με αυτήν των " +"statements ``if`` η πρόταση ``else`` μιας ``try`` εκτελείται όταν δεν " +"υπάρχει εξαίρεση, και η πρόταση ``else`` ενός βρόχου εκτελείται όταν δεν " +"υπάρχει ``break``. Για περισσότερα με τη δήλωση ``try`` και τις εξαιρέσεις, " +"δείτε :ref:`tut-handling`." -#: tutorial/controlflow.rst:231 +#: tutorial/controlflow.rst:258 msgid ":keyword:`!pass` Statements" msgstr "Προτάσεις :keyword:`!pass`" -#: tutorial/controlflow.rst:233 +#: tutorial/controlflow.rst:260 msgid "" "The :keyword:`pass` statement does nothing. It can be used when a statement " "is required syntactically but the program requires no action. For example::" @@ -285,11 +562,31 @@ msgstr "" "απαιτείται συντακτικά μια πρόταση, αλλά το πρόγραμμα δεν απαιτεί καμία " "ενέργεια. Για παράδειγμα::" -#: tutorial/controlflow.rst:240 +#: tutorial/controlflow.rst:263 +msgid "" +">>> while True:\n" +"... pass # Busy-wait for keyboard interrupt (Ctrl+C)\n" +"..." +msgstr "" +">>> while True:\n" +"... pass # Busy-wait for keyboard interrupt (Ctrl+C)\n" +"..." + +#: tutorial/controlflow.rst:267 msgid "This is commonly used for creating minimal classes::" msgstr "Αυτό χρησιμοποιείται συνήθως για τη δημιουργία ελάχιστων κλάσεων::" -#: tutorial/controlflow.rst:246 +#: tutorial/controlflow.rst:269 +msgid "" +">>> class MyEmptyClass:\n" +"... pass\n" +"..." +msgstr "" +">>> class MyEmptyClass:\n" +"... pass\n" +"..." + +#: tutorial/controlflow.rst:273 msgid "" "Another place :keyword:`pass` can be used is as a place-holder for a " "function or conditional body when you are working on new code, allowing you " @@ -301,11 +598,36 @@ msgstr "" "επιτρέποντας σας να συνεχίσετε να σκέφτεστε σε ένα πιο αφηρημένο επίπεδο. " "Το :keyword:`!pass` αγνοείται σιωπηλά::" -#: tutorial/controlflow.rst:258 +#: tutorial/controlflow.rst:277 +msgid "" +">>> def initlog(*args):\n" +"... pass # Remember to implement this!\n" +"..." +msgstr "" +">>> def initlog(*args):\n" +"... pass # Remember to implement this!\n" +"..." + +#: tutorial/controlflow.rst:281 +msgid "" +"For this last case, many people use the ellipsis literal :code:`...` instead " +"of :code:`pass`. This use has no special meaning to Python, and is not part " +"of the language definition (you could use any constant expression here), " +"but :code:`...` is used conventionally as a placeholder body as well. See :" +"ref:`bltin-ellipsis-object`." +msgstr "" +"Για αυτήν την τελευταία περίπτωση, πολλοί άνθρωποι χρησιμοποιούν το literale " +"αποσιωπητικών :code:`...` αντί για :code:`pass`. Αυτή η χρήση δεν έχει " +"ειδική σημασία για την Python και δεν αποτελεί μέρος του ορισμού της γλώσσας " +"(θα μπορούσατε να χρησιμοποιήσετε οποιαδήποτε σταθερή έκφραση εδώ), αλλά το :" +"code:`...` χρησιμοποιείται συμβατικά και ως σώμα placeholder. Δείτε :ref:" +"`bltin-ellipsis-object`." + +#: tutorial/controlflow.rst:291 msgid ":keyword:`!match` Statements" msgstr "Προτάσεις :keyword:`!match`" -#: tutorial/controlflow.rst:260 +#: tutorial/controlflow.rst:293 msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -313,7 +635,7 @@ msgid "" "languages), but it's more similar to pattern matching in languages like Rust " "or Haskell. Only the first pattern that matches gets executed and it can " "also extract components (sequence elements or object attributes) from the " -"value into variables." +"value into variables. If no case matches, none of the branches is executed." msgstr "" "Μια δήλωση :keyword:`match` παίρνει μια έκφραση και συγκρίνει την τιμή της " "με διαδοχικά μοτίβα που δίνονται ως ένα ή περισσότερα μπλοκ πεζών-" @@ -321,31 +643,63 @@ msgstr "" "Java ή JavaScript (και πολλές άλλες γλώσσες), αλλά είναι πιο παρόμοια με την " "αντιστοίχιση προτύπων σε γλώσσες όπως η Rust ή η Haskell. Εκτελείται μόνο το " "πρώτο μοτίβο που ταιριάζει και μπορεί επίσης να εξαγάγει στοιχεία (στοιχεία " -"ακολουθίας ή ιδιότητες αντικειμένου) από την τιμή σε μεταβλητές." +"ακολουθίας ή ιδιότητες αντικειμένου) από την τιμή σε μεταβλητές. Εάν καμία " +"περίπτωση δεν ταιριάζει, κανένας από τους κλάδους δεν εκτελείται." -#: tutorial/controlflow.rst:268 +#: tutorial/controlflow.rst:302 msgid "" "The simplest form compares a subject value against one or more literals::" msgstr "" "Η απλούστερη φόρμα συγκρίνει μια τιμή θέματος με ένα ή περισσότερα literals::" -#: tutorial/controlflow.rst:281 +#: tutorial/controlflow.rst:304 +msgid "" +"def http_error(status):\n" +" match status:\n" +" case 400:\n" +" return \"Bad request\"\n" +" case 404:\n" +" return \"Not found\"\n" +" case 418:\n" +" return \"I'm a teapot\"\n" +" case _:\n" +" return \"Something's wrong with the internet\"" +msgstr "" +"def http_error(status):\n" +" match status:\n" +" case 400:\n" +" return \"Bad request\"\n" +" case 404:\n" +" return \"Not found\"\n" +" case 418:\n" +" return \"I'm a teapot\"\n" +" case _:\n" +" return \"Something's wrong with the internet\"" + +#: tutorial/controlflow.rst:315 msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " -"never fails to match. If no case matches, none of the branches is executed." +"never fails to match." msgstr "" "Σημειώστε το τελευταίο μπλοκ: το \"variable name\" ``_`` λειτουργεί ως " -"*μπαλαντέρ* και δεν αποτυγχάνει ποτέ να ταιριάζει. Εάν δεν ταιριάζει κανένα " -"case, κανένας από τους κλάδους δεν εκτελείται." +"*μπαλαντέρ* και δεν αποτυγχάνει ποτέ να ταιριάζει." -#: tutorial/controlflow.rst:284 +#: tutorial/controlflow.rst:318 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "" "Μπορείτε να συνδυάσετε πολλά γράμματα σε ένα μόνο μοτίβο χρησιμοποιώντας το " "``|`` (\"ή\")::" -#: tutorial/controlflow.rst:289 +#: tutorial/controlflow.rst:320 +msgid "" +"case 401 | 403 | 404:\n" +" return \"Not allowed\"" +msgstr "" +"case 401 | 403 | 404:\n" +" return \"Not allowed\"" + +#: tutorial/controlflow.rst:323 msgid "" "Patterns can look like unpacking assignments, and can be used to bind " "variables::" @@ -353,7 +707,35 @@ msgstr "" "Τα μοτίβα μπορεί να μοιάζουν με αναθέσεις unpacking, και μπορούν να " "χρησιμοποιηθούν για τη σύνδεση μεταβλητών::" -#: tutorial/controlflow.rst:305 +#: tutorial/controlflow.rst:326 +msgid "" +"# point is an (x, y) tuple\n" +"match point:\n" +" case (0, 0):\n" +" print(\"Origin\")\n" +" case (0, y):\n" +" print(f\"Y={y}\")\n" +" case (x, 0):\n" +" print(f\"X={x}\")\n" +" case (x, y):\n" +" print(f\"X={x}, Y={y}\")\n" +" case _:\n" +" raise ValueError(\"Not a point\")" +msgstr "" +"# point is an (x, y) tuple\n" +"match point:\n" +" case (0, 0):\n" +" print(\"Origin\")\n" +" case (0, y):\n" +" print(f\"Y={y}\")\n" +" case (x, 0):\n" +" print(f\"X={x}\")\n" +" case (x, y):\n" +" print(f\"X={x}, Y={y}\")\n" +" case _:\n" +" raise ValueError(\"Not a point\")" + +#: tutorial/controlflow.rst:339 msgid "" "Study that one carefully! The first pattern has two literals, and can be " "thought of as an extension of the literal pattern shown above. But the next " @@ -369,7 +751,7 @@ msgstr "" "δύο τιμές, γεγονός που το κάνει εννοιολογικά παρόμοιο με την ανάθεση " "unpacking ``(x, y) = point``." -#: tutorial/controlflow.rst:312 +#: tutorial/controlflow.rst:346 msgid "" "If you are using classes to structure your data you can use the class name " "followed by an argument list resembling a constructor, but with the ability " @@ -380,7 +762,45 @@ msgstr "" "που μοιάζει με έναν κατασκευαστή, αλλά με τη δυνατότητα να συλλαμβάνει " "χαρακτηριστικά σε μεταβλητές::" -#: tutorial/controlflow.rst:334 +#: tutorial/controlflow.rst:350 +msgid "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y\n" +"\n" +"def where_is(point):\n" +" match point:\n" +" case Point(x=0, y=0):\n" +" print(\"Origin\")\n" +" case Point(x=0, y=y):\n" +" print(f\"Y={y}\")\n" +" case Point(x=x, y=0):\n" +" print(f\"X={x}\")\n" +" case Point():\n" +" print(\"Somewhere else\")\n" +" case _:\n" +" print(\"Not a point\")" +msgstr "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y\n" +"\n" +"def where_is(point):\n" +" match point:\n" +" case Point(x=0, y=0):\n" +" print(\"Origin\")\n" +" case Point(x=0, y=y):\n" +" print(f\"Y={y}\")\n" +" case Point(x=x, y=0):\n" +" print(f\"X={x}\")\n" +" case Point():\n" +" print(\"Somewhere else\")\n" +" case _:\n" +" print(\"Not a point\")" + +#: tutorial/controlflow.rst:368 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -397,7 +817,19 @@ msgstr "" "ακόλουθα μοτίβα είναι όλα ισοδύναμα (και όλα δεσμεύουν το χαρακτηριστικό " "``y`` στη μεταβλητή ``var``)::" -#: tutorial/controlflow.rst:345 +#: tutorial/controlflow.rst:374 +msgid "" +"Point(1, var)\n" +"Point(1, y=var)\n" +"Point(x=1, y=var)\n" +"Point(y=var, x=1)" +msgstr "" +"Point(1, var)\n" +"Point(1, y=var)\n" +"Point(x=1, y=var)\n" +"Point(y=var, x=1)" + +#: tutorial/controlflow.rst:379 msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " @@ -415,7 +847,7 @@ msgstr "" "παραπάνω) ή ονόματα κλάσεων (αναγνωρίζονται από το \"(...)\" που βρίσκεται " "δίπλα όπως το ``Point`` παραπάνω) δεν ανατίθενται ποτέ." -#: tutorial/controlflow.rst:352 +#: tutorial/controlflow.rst:386 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " "Points, with ``__match_args__`` added, we could match it like this::" @@ -424,7 +856,45 @@ msgstr "" "σύντομη λίστα με πόντους, με προσθήκη ``__match_args__``, θα μπορούσαμε να " "την αντιστοιχίσουμε ως εξής::" -#: tutorial/controlflow.rst:373 +#: tutorial/controlflow.rst:389 +msgid "" +"class Point:\n" +" __match_args__ = ('x', 'y')\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y\n" +"\n" +"match points:\n" +" case []:\n" +" print(\"No points\")\n" +" case [Point(0, 0)]:\n" +" print(\"The origin\")\n" +" case [Point(x, y)]:\n" +" print(f\"Single point {x}, {y}\")\n" +" case [Point(0, y1), Point(0, y2)]:\n" +" print(f\"Two on the Y axis at {y1}, {y2}\")\n" +" case _:\n" +" print(\"Something else\")" +msgstr "" +"class Point:\n" +" __match_args__ = ('x', 'y')\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y\n" +"\n" +"match points:\n" +" case []:\n" +" print(\"No points\")\n" +" case [Point(0, 0)]:\n" +" print(\"The origin\")\n" +" case [Point(x, y)]:\n" +" print(f\"Single point {x}, {y}\")\n" +" case [Point(0, y1), Point(0, y2)]:\n" +" print(f\"Two on the Y axis at {y1}, {y2}\")\n" +" case _:\n" +" print(\"Something else\")" + +#: tutorial/controlflow.rst:407 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " @@ -435,11 +905,25 @@ msgstr "" "δοκιμάσει το επόμενο μπλοκ πεζών-κεφαλαίων. Λάβετε υπόψη ότι η σύλληψη της " "τιμής γίνεται πριν ο guard αξιολογηθεί::" -#: tutorial/controlflow.rst:383 +#: tutorial/controlflow.rst:411 +msgid "" +"match point:\n" +" case Point(x, y) if x == y:\n" +" print(f\"Y=X at {x}\")\n" +" case Point(x, y):\n" +" print(f\"Not on the diagonal\")" +msgstr "" +"match point:\n" +" case Point(x, y) if x == y:\n" +" print(f\"Y=X at {x}\")\n" +" case Point(x, y):\n" +" print(f\"Not on the diagonal\")" + +#: tutorial/controlflow.rst:417 msgid "Several other key features of this statement:" msgstr "Πολλά άλλα βασικά χαρακτηριστικά αυτής της δήλωσης:" -#: tutorial/controlflow.rst:385 +#: tutorial/controlflow.rst:419 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. An important exception is " @@ -450,7 +934,7 @@ msgstr "" "ακολουθίες. Μια σημαντική εξαίρεση είναι ότι δεν ταιριάζουν με iterators ή " "συμβολοσειρές." -#: tutorial/controlflow.rst:389 +#: tutorial/controlflow.rst:423 msgid "" "Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, " "*rest)`` work similar to unpacking assignments. The name after ``*`` may " @@ -463,7 +947,7 @@ msgstr "" "αντιστοιχεί σε μια ακολουθία τουλάχιστον δύο στοιχείων χωρίς να δεσμεύει τα " "υπόλοιπα στοιχεία." -#: tutorial/controlflow.rst:394 +#: tutorial/controlflow.rst:428 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike " @@ -476,13 +960,17 @@ msgstr "" "unpacking όπως το ``**rest``. (Αλλά το ``**_`` θα ήταν περιττό, επομένως " "δεν επιτρέπεται.)" -#: tutorial/controlflow.rst:399 +#: tutorial/controlflow.rst:433 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "" "Τα δευτερεύοντα μοτίβα μπορούν να αποτυπωθούν χρησιμοποιώντας το keyword " "``as``::" -#: tutorial/controlflow.rst:403 +#: tutorial/controlflow.rst:435 +msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." +msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..." + +#: tutorial/controlflow.rst:437 msgid "" "will capture the second element of the input as ``p2`` (as long as the input " "is a sequence of two points)" @@ -490,7 +978,7 @@ msgstr "" "θα καταγράψει το δεύτερο στοιχείο της εισόδου ως ``p2`` (εφόσον η είσοδος " "είναι μια ακολουθία δύο σημείων)" -#: tutorial/controlflow.rst:406 +#: tutorial/controlflow.rst:440 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -498,7 +986,7 @@ msgstr "" "Τα περισσότερα literals συγκρίνονται με ισότητα, ωστόσο τα singletons " "``True``, ``False`` και ``None`` συγκρίνονται με ταυτότητα." -#: tutorial/controlflow.rst:409 +#: tutorial/controlflow.rst:443 msgid "" "Patterns may use named constants. These must be dotted names to prevent " "them from being interpreted as capture variable::" @@ -506,7 +994,41 @@ msgstr "" "Τα μοτίβα μπορούν να χρησιμοποιούν ονομασμένες σταθερές. Αυτά πρέπει να " "είναι ονόματα με κουκκίδες για να μην ερμηνεύονται ως capture μεταβλητή::" -#: tutorial/controlflow.rst:428 +#: tutorial/controlflow.rst:446 +msgid "" +"from enum import Enum\n" +"class Color(Enum):\n" +" RED = 'red'\n" +" GREEN = 'green'\n" +" BLUE = 'blue'\n" +"\n" +"color = Color(input(\"Enter your choice of 'red', 'blue' or 'green': \"))\n" +"\n" +"match color:\n" +" case Color.RED:\n" +" print(\"I see red!\")\n" +" case Color.GREEN:\n" +" print(\"Grass is green\")\n" +" case Color.BLUE:\n" +" print(\"I'm feeling the blues :(\")" +msgstr "" +"from enum import Enum\n" +"class Color(Enum):\n" +" RED = 'red'\n" +" GREEN = 'green'\n" +" BLUE = 'blue'\n" +"\n" +"color = Color(input(\"Enter your choice of 'red', 'blue' or 'green': \"))\n" +"\n" +"match color:\n" +" case Color.RED:\n" +" print(\"I see red!\")\n" +" case Color.GREEN:\n" +" print(\"Grass is green\")\n" +" case Color.BLUE:\n" +" print(\"I'm feeling the blues :(\")" + +#: tutorial/controlflow.rst:462 msgid "" "For a more detailed explanation and additional examples, you can look into :" "pep:`636` which is written in a tutorial format." @@ -514,11 +1036,11 @@ msgstr "" "Για πιο λεπτομερή επεξήγηση και πρόσθετα παραδείγματα, μπορείτε να δείτε το :" "pep:`636` το οποίο είναι γραμμένο σε μορφή εκμάθησης." -#: tutorial/controlflow.rst:434 +#: tutorial/controlflow.rst:468 msgid "Defining Functions" msgstr "Καθορισμός Συναρτήσεων" -#: tutorial/controlflow.rst:436 +#: tutorial/controlflow.rst:470 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" @@ -526,7 +1048,33 @@ msgstr "" "Μπορούμε να δημιουργήσουμε μια συνάρτηση που γράφει τη σειρά Fibonacci σε " "ένα αυθαίρετο όριο::" -#: tutorial/controlflow.rst:456 +#: tutorial/controlflow.rst:473 +msgid "" +">>> def fib(n): # write Fibonacci series less than n\n" +"... \"\"\"Print a Fibonacci series less than n.\"\"\"\n" +"... a, b = 0, 1\n" +"... while a < n:\n" +"... print(a, end=' ')\n" +"... a, b = b, a+b\n" +"... print()\n" +"...\n" +">>> # Now call the function we just defined:\n" +">>> fib(2000)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" +msgstr "" +">>> def fib(n): # write Fibonacci series less than n\n" +"... \"\"\"Print a Fibonacci series less than n.\"\"\"\n" +"... a, b = 0, 1\n" +"... while a < n:\n" +"... print(a, end=' ')\n" +"... a, b = b, a+b\n" +"... print()\n" +"...\n" +">>> # Now call the function we just defined:\n" +">>> fib(2000)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" + +#: tutorial/controlflow.rst:490 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -538,7 +1086,7 @@ msgstr "" "σε παρένθεση. Οι δηλώσεις που σχηματίζουν το σώμα της συνάρτησης ξεκινούν " "από την επόμενη γραμμή και πρέπει να είναι εσοχές." -#: tutorial/controlflow.rst:461 +#: tutorial/controlflow.rst:495 msgid "" "The first statement of the function body can optionally be a string literal; " "this string literal is the function's documentation string, or :dfn:" @@ -557,7 +1105,7 @@ msgstr "" "στον κώδικα· είναι καλή πρακτική να συμπεριλαμβάνονται docstrings στον " "κώδικα που γράφετε, για αυτό κάντε το συνήθεια." -#: tutorial/controlflow.rst:468 +#: tutorial/controlflow.rst:502 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -583,7 +1131,7 @@ msgstr "" "μεταβλητές συναρτήσεων που περικλείουν, ονομάζονται ως μια δήλωση :keyword:" "`nonlocal`), αν και μπορεί να αναφέρονται." -#: tutorial/controlflow.rst:479 +#: tutorial/controlflow.rst:513 msgid "" "The actual parameters (arguments) to a function call are introduced in the " "local symbol table of the called function when it is called; thus, arguments " @@ -600,7 +1148,7 @@ msgstr "" "αναδρομικά, δημιουργείται ένας νέος πίνακας τοπικών συμβόλων για αυτήν την " "κλήση." -#: tutorial/controlflow.rst:486 +#: tutorial/controlflow.rst:520 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -613,7 +1161,21 @@ msgstr "" "από τον χρήστη. Άλλα ονόματα μπορούν επίσης να δείχνουν το ίδιο αντικείμενο " "συνάρτησης και μπορούν επίσης να χρησιμοποιηθούν για πρόσβαση στη συνάρτηση::" -#: tutorial/controlflow.rst:497 +#: tutorial/controlflow.rst:525 +msgid "" +">>> fib\n" +"\n" +">>> f = fib\n" +">>> f(100)\n" +"0 1 1 2 3 5 8 13 21 34 55 89" +msgstr "" +">>> fib\n" +"\n" +">>> f = fib\n" +">>> f(100)\n" +"0 1 1 2 3 5 8 13 21 34 55 89" + +#: tutorial/controlflow.rst:531 msgid "" "Coming from other languages, you might object that ``fib`` is not a function " "but a procedure since it doesn't return a value. In fact, even functions " @@ -631,7 +1193,17 @@ msgstr "" "μόνη τιμή που γράφεται. Μπορείτε να το δείτε αν το θέλετε πραγματικά " "χρησιμοποιώντας τη :func:`print`::" -#: tutorial/controlflow.rst:508 +#: tutorial/controlflow.rst:538 +msgid "" +">>> fib(0)\n" +">>> print(fib(0))\n" +"None" +msgstr "" +">>> fib(0)\n" +">>> print(fib(0))\n" +"None" + +#: tutorial/controlflow.rst:542 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" @@ -639,12 +1211,40 @@ msgstr "" "Είναι απλό να γράψετε μια συνάρτηση που επιστρέφει μια λίστα με τους " "αριθμούς της σειράς Fibonacci, αντί να την εκτυπώσετε::" -#: tutorial/controlflow.rst:524 +#: tutorial/controlflow.rst:545 +msgid "" +">>> def fib2(n): # return Fibonacci series up to n\n" +"... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" +"... result = []\n" +"... a, b = 0, 1\n" +"... while a < n:\n" +"... result.append(a) # see below\n" +"... a, b = b, a+b\n" +"... return result\n" +"...\n" +">>> f100 = fib2(100) # call it\n" +">>> f100 # write the result\n" +"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" +msgstr "" +">>> def fib2(n): # return Fibonacci series up to n\n" +"... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" +"... result = []\n" +"... a, b = 0, 1\n" +"... while a < n:\n" +"... result.append(a) # see below\n" +"... a, b = b, a+b\n" +"... return result\n" +"...\n" +">>> f100 = fib2(100) # call it\n" +">>> f100 # write the result\n" +"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" + +#: tutorial/controlflow.rst:558 msgid "This example, as usual, demonstrates some new Python features:" msgstr "" "Αυτό το παράδειγμα, ως συνήθως, δείχνει μερικά νέα χαρακτηριστικά Python:" -#: tutorial/controlflow.rst:526 +#: tutorial/controlflow.rst:560 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " @@ -654,7 +1254,7 @@ msgstr "" "keyword:`!return` χωρίς όρισμα έκφρασης, επιστρέφει το ``None``. Η πτώση του " "τέλους μιας συνάρτησης επιστρέφει επίσης ``None``." -#: tutorial/controlflow.rst:530 +#: tutorial/controlflow.rst:564 msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -663,7 +1263,7 @@ msgid "" "the object's type. Different types define different methods. Methods of " "different types may have the same name without causing ambiguity. (It is " "possible to define your own object types and methods, using *classes*, see :" -"ref:`tut-classes`) The method :meth:`!append` shown in the example is " +"ref:`tut-classes`) The method :meth:`~list.append` shown in the example is " "defined for list objects; it adds a new element at the end of the list. In " "this example it is equivalent to ``result = result + [a]``, but more " "efficient." @@ -676,16 +1276,16 @@ msgstr "" "ορίζουν διαφορετικές μεθόδους. Μέθοδοι διαφορετικών τύπων μπορεί να έχουν " "το ίδιο όνομα χωρίς να προκαλούν ασάφεια. (Είναι δυνατό να ορίσετε τους " "δικούς σας τύπους αντικειμένων και μεθόδους, χρησιμοποιώντας *classes*, " -"δείτε :ref:`tut-classes`) Η μέθοδος :meth:`!append` που εμφανίζεται στο " +"δείτε :ref:`tut-classes`) Η μέθοδος :meth:`~list.append` που εμφανίζεται στο " "παράδειγμα ορίζεται για αντικείμενα λίστας· προσθέτει ένα νέο στοιχείο στο " "τέλος της λίστας. Σε αυτό το παράδειγμα είναι ισοδύναμο με ``result = " "result + [a]``, αλλά πιο αποτελεσματικό." -#: tutorial/controlflow.rst:545 +#: tutorial/controlflow.rst:579 msgid "More on Defining Functions" msgstr "Περισσότερο για τον Καθορισμό Συναρτήσεων" -#: tutorial/controlflow.rst:547 +#: tutorial/controlflow.rst:581 msgid "" "It is also possible to define functions with a variable number of arguments. " "There are three forms, which can be combined." @@ -693,11 +1293,11 @@ msgstr "" "Είναι επίσης δυνατός ο ορισμός συναρτήσεων με μεταβλητό αριθμό ορισμάτων. " "Υπάρχουν τρεις μορφές, που μπορούν να συνδυαστούν." -#: tutorial/controlflow.rst:554 +#: tutorial/controlflow.rst:588 msgid "Default Argument Values" msgstr "Προεπιλεγμένες Τιμές Ορίσματος" -#: tutorial/controlflow.rst:556 +#: tutorial/controlflow.rst:590 msgid "" "The most useful form is to specify a default value for one or more " "arguments. This creates a function that can be called with fewer arguments " @@ -707,18 +1307,44 @@ msgstr "" "περισσότερα ορίσματα. Αυτό δημιουργεί μια συνάρτηση που μπορεί να κληθεί με " "λιγότερα ορίσματα από αυτά που έχει ορίσει ότι επιτρέπει. Για παράδειγμα::" -#: tutorial/controlflow.rst:572 +#: tutorial/controlflow.rst:594 +msgid "" +"def ask_ok(prompt, retries=4, reminder='Please try again!'):\n" +" while True:\n" +" reply = input(prompt)\n" +" if reply in {'y', 'ye', 'yes'}:\n" +" return True\n" +" if reply in {'n', 'no', 'nop', 'nope'}:\n" +" return False\n" +" retries = retries - 1\n" +" if retries < 0:\n" +" raise ValueError('invalid user response')\n" +" print(reminder)" +msgstr "" +"def ask_ok(prompt, retries=4, reminder='Please try again!'):\n" +" while True:\n" +" reply = input(prompt)\n" +" if reply in {'y', 'ye', 'yes'}:\n" +" return True\n" +" if reply in {'n', 'no', 'nop', 'nope'}:\n" +" return False\n" +" retries = retries - 1\n" +" if retries < 0:\n" +" raise ValueError('invalid user response')\n" +" print(reminder)" + +#: tutorial/controlflow.rst:606 msgid "This function can be called in several ways:" msgstr "Αυτή η συνάρτηση μπορεί να κληθεί με διάφορους τρόπους:" -#: tutorial/controlflow.rst:574 +#: tutorial/controlflow.rst:608 msgid "" "giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``" msgstr "" "δίνοντας μόνο το υποχρεωτικό όρισμα: ``ask_ok('Do you really want to " "quit?')``" -#: tutorial/controlflow.rst:576 +#: tutorial/controlflow.rst:610 msgid "" "giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', " "2)``" @@ -726,7 +1352,7 @@ msgstr "" "δίνοντας ένα από τα προαιρετικά ορίσματα: ``ask_ok('OK to overwrite the " "file?', 2)``" -#: tutorial/controlflow.rst:578 +#: tutorial/controlflow.rst:612 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -734,7 +1360,7 @@ msgstr "" "ή δίνοντας όλα τα ορίσματα: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" -#: tutorial/controlflow.rst:581 +#: tutorial/controlflow.rst:615 msgid "" "This example also introduces the :keyword:`in` keyword. This tests whether " "or not a sequence contains a certain value." @@ -742,7 +1368,7 @@ msgstr "" "Αυτό το παράδειγμα εισάγει επίσης το keyword :keyword:`in`. Αυτό ελέγχει εάν " "μια ακολουθία περιέχει ή όχι μια συγκεκριμένη τιμή." -#: tutorial/controlflow.rst:584 +#: tutorial/controlflow.rst:618 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" @@ -750,11 +1376,29 @@ msgstr "" "Οι προεπιλεγμένες τιμές αξιολογούνται στο σημείο του ορισμού της συνάρτησης " "στο πεδίο που *ορίζεται*, έτσι ώστε ::" -#: tutorial/controlflow.rst:595 +#: tutorial/controlflow.rst:621 +msgid "" +"i = 5\n" +"\n" +"def f(arg=i):\n" +" print(arg)\n" +"\n" +"i = 6\n" +"f()" +msgstr "" +"i = 5\n" +"\n" +"def f(arg=i):\n" +" print(arg)\n" +"\n" +"i = 6\n" +"f()" + +#: tutorial/controlflow.rst:629 msgid "will print ``5``." msgstr "θα εκτυπώσει ``5``." -#: tutorial/controlflow.rst:597 +#: tutorial/controlflow.rst:631 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " @@ -767,11 +1411,39 @@ msgstr "" "Για παράδειγμα, η ακόλουθη συνάρτηση συσσωρεύει τα ορίσματα που διαβάζονται " "σε αυτό σε επόμενες κλήσεις::" -#: tutorial/controlflow.rst:610 +#: tutorial/controlflow.rst:636 +msgid "" +"def f(a, L=[]):\n" +" L.append(a)\n" +" return L\n" +"\n" +"print(f(1))\n" +"print(f(2))\n" +"print(f(3))" +msgstr "" +"def f(a, L=[]):\n" +" L.append(a)\n" +" return L\n" +"\n" +"print(f(1))\n" +"print(f(2))\n" +"print(f(3))" + +#: tutorial/controlflow.rst:644 msgid "This will print ::" msgstr "Αυτό θα εκτυπώσει ::" -#: tutorial/controlflow.rst:616 +#: tutorial/controlflow.rst:646 +msgid "" +"[1]\n" +"[1, 2]\n" +"[1, 2, 3]" +msgstr "" +"[1]\n" +"[1, 2]\n" +"[1, 2, 3]" + +#: tutorial/controlflow.rst:650 msgid "" "If you don't want the default to be shared between subsequent calls, you can " "write the function like this instead::" @@ -779,11 +1451,25 @@ msgstr "" "Εάν δεν θέλετε να γίνεται κοινή χρήση της προεπιλογής μεταξύ των επόμενων " "κλήσεων, μπορείτε να γράψετε τη συνάρτηση ως εξής::" -#: tutorial/controlflow.rst:629 +#: tutorial/controlflow.rst:653 +msgid "" +"def f(a, L=None):\n" +" if L is None:\n" +" L = []\n" +" L.append(a)\n" +" return L" +msgstr "" +"def f(a, L=None):\n" +" if L is None:\n" +" L = []\n" +" L.append(a)\n" +" return L" + +#: tutorial/controlflow.rst:663 msgid "Keyword Arguments" msgstr "Ορίσματα Keyword" -#: tutorial/controlflow.rst:631 +#: tutorial/controlflow.rst:665 msgid "" "Functions can also be called using :term:`keyword arguments ` of the form ``kwarg=value``. For instance, the following " @@ -793,7 +1479,21 @@ msgstr "" "arguments ` της μορφής ``kwarg=value``. Για παράδειγμα, " "την ακόλουθη συνάρτηση::" -#: tutorial/controlflow.rst:640 +#: tutorial/controlflow.rst:668 +msgid "" +"def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):\n" +" print(\"-- This parrot wouldn't\", action, end=' ')\n" +" print(\"if you put\", voltage, \"volts through it.\")\n" +" print(\"-- Lovely plumage, the\", type)\n" +" print(\"-- It's\", state, \"!\")" +msgstr "" +"def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):\n" +" print(\"-- This parrot wouldn't\", action, end=' ')\n" +" print(\"if you put\", voltage, \"volts through it.\")\n" +" print(\"-- Lovely plumage, the\", type)\n" +" print(\"-- It's\", state, \"!\")" + +#: tutorial/controlflow.rst:674 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -803,11 +1503,47 @@ msgstr "" "(``state``, ``action``, και ``type``). Αυτή η συνάρτηση μπορεί να κληθεί με " "οποιονδήποτε από τους ακόλουθους τρόπους::" -#: tutorial/controlflow.rst:651 +#: tutorial/controlflow.rst:678 +msgid "" +"parrot(1000) # 1 positional " +"argument\n" +"parrot(voltage=1000) # 1 keyword argument\n" +"parrot(voltage=1000000, action='VOOOOOM') # 2 keyword arguments\n" +"parrot(action='VOOOOOM', voltage=1000000) # 2 keyword arguments\n" +"parrot('a million', 'bereft of life', 'jump') # 3 positional " +"arguments\n" +"parrot('a thousand', state='pushing up the daisies') # 1 positional, 1 " +"keyword" +msgstr "" +"parrot(1000) # 1 positional " +"argument\n" +"parrot(voltage=1000) # 1 keyword argument\n" +"parrot(voltage=1000000, action='VOOOOOM') # 2 keyword arguments\n" +"parrot(action='VOOOOOM', voltage=1000000) # 2 keyword arguments\n" +"parrot('a million', 'bereft of life', 'jump') # 3 positional " +"arguments\n" +"parrot('a thousand', state='pushing up the daisies') # 1 positional, 1 " +"keyword" + +#: tutorial/controlflow.rst:685 msgid "but all the following calls would be invalid::" msgstr "αλλά όλες οι ακόλουθες κλήσεις θα ήταν άκυρες::" -#: tutorial/controlflow.rst:658 +#: tutorial/controlflow.rst:687 +msgid "" +"parrot() # required argument missing\n" +"parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword " +"argument\n" +"parrot(110, voltage=220) # duplicate value for the same argument\n" +"parrot(actor='John Cleese') # unknown keyword argument" +msgstr "" +"parrot() # required argument missing\n" +"parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword " +"argument\n" +"parrot(110, voltage=220) # duplicate value for the same argument\n" +"parrot(actor='John Cleese') # unknown keyword argument" + +#: tutorial/controlflow.rst:692 msgid "" "In a function call, keyword arguments must follow positional arguments. All " "the keyword arguments passed must match one of the arguments accepted by the " @@ -826,7 +1562,25 @@ msgstr "" "λάβει μια τιμή περισσότερες από μία φορές. Ακολουθεί ένα παράδειγμα που " "αποτυγχάνει λόγω αυτού του περιορισμού::" -#: tutorial/controlflow.rst:674 +#: tutorial/controlflow.rst:700 +msgid "" +">>> def function(a):\n" +"... pass\n" +"...\n" +">>> function(0, a=0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: function() got multiple values for argument 'a'" +msgstr "" +">>> def function(a):\n" +"... pass\n" +"...\n" +">>> function(0, a=0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: function() got multiple values for argument 'a'" + +#: tutorial/controlflow.rst:708 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -845,15 +1599,69 @@ msgstr "" "``*name`` πρέπει να εμφανίζεται πριν από το ``**name``.) Για παράδειγμα, αν " "ορίσουμε μια συνάρτηση όπως αυτή::" -#: tutorial/controlflow.rst:691 +#: tutorial/controlflow.rst:716 +msgid "" +"def cheeseshop(kind, *arguments, **keywords):\n" +" print(\"-- Do you have any\", kind, \"?\")\n" +" print(\"-- I'm sorry, we're all out of\", kind)\n" +" for arg in arguments:\n" +" print(arg)\n" +" print(\"-\" * 40)\n" +" for kw in keywords:\n" +" print(kw, \":\", keywords[kw])" +msgstr "" +"def cheeseshop(kind, *arguments, **keywords):\n" +" print(\"-- Do you have any\", kind, \"?\")\n" +" print(\"-- I'm sorry, we're all out of\", kind)\n" +" for arg in arguments:\n" +" print(arg)\n" +" print(\"-\" * 40)\n" +" for kw in keywords:\n" +" print(kw, \":\", keywords[kw])" + +#: tutorial/controlflow.rst:725 msgid "It could be called like this::" msgstr "Μπορεί να καλεστεί κάπως έτσι::" -#: tutorial/controlflow.rst:699 +#: tutorial/controlflow.rst:727 +msgid "" +"cheeseshop(\"Limburger\", \"It's very runny, sir.\",\n" +" \"It's really very, VERY runny, sir.\",\n" +" shopkeeper=\"Michael Palin\",\n" +" client=\"John Cleese\",\n" +" sketch=\"Cheese Shop Sketch\")" +msgstr "" +"cheeseshop(\"Limburger\", \"It's very runny, sir.\",\n" +" \"It's really very, VERY runny, sir.\",\n" +" shopkeeper=\"Michael Palin\",\n" +" client=\"John Cleese\",\n" +" sketch=\"Cheese Shop Sketch\")" + +#: tutorial/controlflow.rst:733 msgid "and of course it would print:" msgstr "και φυσικά θα εκτυπώσει:" -#: tutorial/controlflow.rst:712 +#: tutorial/controlflow.rst:735 +msgid "" +"-- Do you have any Limburger ?\n" +"-- I'm sorry, we're all out of Limburger\n" +"It's very runny, sir.\n" +"It's really very, VERY runny, sir.\n" +"----------------------------------------\n" +"shopkeeper : Michael Palin\n" +"client : John Cleese\n" +"sketch : Cheese Shop Sketch" +msgstr "" +"-- Do you have any Limburger ?\n" +"-- I'm sorry, we're all out of Limburger\n" +"It's very runny, sir.\n" +"It's really very, VERY runny, sir.\n" +"----------------------------------------\n" +"shopkeeper : Michael Palin\n" +"client : John Cleese\n" +"sketch : Cheese Shop Sketch" + +#: tutorial/controlflow.rst:746 msgid "" "Note that the order in which the keyword arguments are printed is guaranteed " "to match the order in which they were provided in the function call." @@ -862,11 +1670,11 @@ msgstr "" "εγγυημένη ότι ταιριάζει με τη σειρά με την οποία δόθηκαν στην κλήση της " "συνάρτησης." -#: tutorial/controlflow.rst:716 +#: tutorial/controlflow.rst:750 msgid "Special parameters" msgstr "Ειδικές παράμετροι" -#: tutorial/controlflow.rst:718 +#: tutorial/controlflow.rst:752 msgid "" "By default, arguments may be passed to a Python function either by position " "or explicitly by keyword. For readability and performance, it makes sense to " @@ -881,11 +1689,27 @@ msgstr "" "κοιτάξει τον ορισμό της συνάρτησης για να προσδιορίσει εάν τα στοιχεία " "μεταβιβάζονται κατά θέση, κατά θέση ή keyword, ή κατά keyword." -#: tutorial/controlflow.rst:724 +#: tutorial/controlflow.rst:758 msgid "A function definition may look like:" msgstr "Ένας ορισμός συνάρτησης μπορεί να μοιάζει με αυτό:" -#: tutorial/controlflow.rst:735 +#: tutorial/controlflow.rst:760 +msgid "" +"def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n" +" ----------- ---------- ----------\n" +" | | |\n" +" | Positional or keyword |\n" +" | - Keyword only\n" +" -- Positional only" +msgstr "" +"def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n" +" ----------- ---------- ----------\n" +" | | |\n" +" | Positional or keyword |\n" +" | - Keyword only\n" +" -- Positional only" + +#: tutorial/controlflow.rst:769 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" @@ -898,11 +1722,11 @@ msgstr "" "ή keyword (positional-or-keyword), και μόνο keyword (keyword-only). Οι " "keyword παράμετροι αναφέρονται επίσης ως ονομασμένες παράμετροι." -#: tutorial/controlflow.rst:742 +#: tutorial/controlflow.rst:776 msgid "Positional-or-Keyword Arguments" msgstr "Παράμετροι Θέσης ή Keyword" -#: tutorial/controlflow.rst:744 +#: tutorial/controlflow.rst:778 msgid "" "If ``/`` and ``*`` are not present in the function definition, arguments may " "be passed to a function by position or by keyword." @@ -910,11 +1734,11 @@ msgstr "" "Εάν τα ``/`` και ``*`` δεν υπάρχουν στον ορισμό της συνάρτησης, τα ορίσματα " "μπορούν να μεταβιβαστούν σε μια συνάρτηση ανά θέση ή κατά keyword." -#: tutorial/controlflow.rst:749 +#: tutorial/controlflow.rst:783 msgid "Positional-Only Parameters" msgstr "Παράμετροι Μόνο-Θέσης" -#: tutorial/controlflow.rst:751 +#: tutorial/controlflow.rst:785 msgid "" "Looking at this in a bit more detail, it is possible to mark certain " "parameters as *positional-only*. If *positional-only*, the parameters' order " @@ -928,11 +1752,11 @@ msgstr "" "επισημάνετε ορισμένες παραμέτρους ως *μόνο θέσης*.Εάν *μόνο θέσης*, η σειρά " "των παραμέτρων έχει σημασία και οι παράμετροι δεν μπορούν να μεταβιβαστούν " "με keyword. Οι παράμετροι μόνο θέσης τοποθετούνται πριν από ένα ``/`` (προς " -"τα εμπρός-κάθετος). Το ``/``χρησιμοποιείται για να διαχωρίσει λογικά τις " -"παραμέτρους μόνο θέσης από τις υπόλοιπες παραμέτρους. Εάν δεν υπάερχει το ``/" +"τα εμπρός-κάθετος). Το ``/`` χρησιμοποιείται για να διαχωρίσει λογικά τις " +"παραμέτρους μόνο θέσης από τις υπόλοιπες παραμέτρους. Εάν δεν υπάρχει το ``/" "`` στον ορισμό της συνάρτησης, δεν υπάρχουν παράμετροι μόνο θέσης." -#: tutorial/controlflow.rst:759 +#: tutorial/controlflow.rst:793 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." @@ -940,11 +1764,11 @@ msgstr "" "Οι παράμετροι που ακολουθούν το ``/`` μπορεί να είναι *θέσης ή keyword* ή " "*μόνο keyword*." -#: tutorial/controlflow.rst:763 +#: tutorial/controlflow.rst:797 msgid "Keyword-Only Arguments" msgstr "Ορίσματα μόνο Keyword" -#: tutorial/controlflow.rst:765 +#: tutorial/controlflow.rst:799 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -954,11 +1778,11 @@ msgstr "" "παράμετροι πρέπει να περάσουν από το keyword όρισμα, τοποθετήσετε ένα ``*`` " "στη λίστα ορισμάτων ακριβώς πριν από την πρώτη παράμετρο *μόνο keyword*." -#: tutorial/controlflow.rst:771 +#: tutorial/controlflow.rst:805 msgid "Function Examples" msgstr "Παραδείγματα Συναρτήσεων" -#: tutorial/controlflow.rst:773 +#: tutorial/controlflow.rst:807 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" @@ -966,7 +1790,33 @@ msgstr "" "Σκεφτείτε τα ακόλουθα παραδείγματα ορισμών συναρτήσεων δίνοντας ιδιαίτερη " "προσοχή στους δείκτες ``/`` και ``*``::" -#: tutorial/controlflow.rst:789 +#: tutorial/controlflow.rst:810 +msgid "" +">>> def standard_arg(arg):\n" +"... print(arg)\n" +"...\n" +">>> def pos_only_arg(arg, /):\n" +"... print(arg)\n" +"...\n" +">>> def kwd_only_arg(*, arg):\n" +"... print(arg)\n" +"...\n" +">>> def combined_example(pos_only, /, standard, *, kwd_only):\n" +"... print(pos_only, standard, kwd_only)" +msgstr "" +">>> def standard_arg(arg):\n" +"... print(arg)\n" +"...\n" +">>> def pos_only_arg(arg, /):\n" +"... print(arg)\n" +"...\n" +">>> def kwd_only_arg(*, arg):\n" +"... print(arg)\n" +"...\n" +">>> def combined_example(pos_only, /, standard, *, kwd_only):\n" +"... print(pos_only, standard, kwd_only)" + +#: tutorial/controlflow.rst:823 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -976,7 +1826,21 @@ msgstr "" "περιορισμούς στη σύμβαση κλήσης και τα ορίσματα μπορούν να περάσουν από θέση " "ή από keyword::" -#: tutorial/controlflow.rst:799 +#: tutorial/controlflow.rst:827 +msgid "" +">>> standard_arg(2)\n" +"2\n" +"\n" +">>> standard_arg(arg=2)\n" +"2" +msgstr "" +">>> standard_arg(2)\n" +"2\n" +"\n" +">>> standard_arg(arg=2)\n" +"2" + +#: tutorial/controlflow.rst:833 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" @@ -984,15 +1848,53 @@ msgstr "" "Η δεύτερη συνάρτηση ``pos_only_arg`` περιορίζεται στη χρήση μόνο παραμέτρων " "θέσης καθώς υπάρχει ένα ``/`` στον ορισμός της συνάρτησης::" -#: tutorial/controlflow.rst:810 -msgid "" -"The third function ``kwd_only_args`` only allows keyword arguments as " +#: tutorial/controlflow.rst:836 +msgid "" +">>> pos_only_arg(1)\n" +"1\n" +"\n" +">>> pos_only_arg(arg=1)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: pos_only_arg() got some positional-only arguments passed as " +"keyword arguments: 'arg'" +msgstr "" +">>> pos_only_arg(1)\n" +"1\n" +"\n" +">>> pos_only_arg(arg=1)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: pos_only_arg() got some positional-only arguments passed as " +"keyword arguments: 'arg'" + +#: tutorial/controlflow.rst:844 +msgid "" +"The third function ``kwd_only_arg`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" msgstr "" -"Η τρίτη συνάρτηση ``kwd_only_args`` επιτρέπει μόνο keyword ορίσματα όπως " +"Η τρίτη συνάρτηση ``kwd_only_arg`` επιτρέπει μόνο keyword ορίσματα όπως " "υποδεικνύεται από ένα ``*`` στον ορισμός της συνάρτησης::" -#: tutorial/controlflow.rst:821 +#: tutorial/controlflow.rst:847 +msgid "" +">>> kwd_only_arg(3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: kwd_only_arg() takes 0 positional arguments but 1 was given\n" +"\n" +">>> kwd_only_arg(arg=3)\n" +"3" +msgstr "" +">>> kwd_only_arg(3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: kwd_only_arg() takes 0 positional arguments but 1 was given\n" +"\n" +">>> kwd_only_arg(arg=3)\n" +"3" + +#: tutorial/controlflow.rst:855 msgid "" "And the last uses all three calling conventions in the same function " "definition::" @@ -1000,7 +1902,43 @@ msgstr "" "Και το τελευταίο χρησιμοποιεί και τις τρεις συμβάσεις κλήσης στον ίδιο " "ορισμό συνάρτησης::" -#: tutorial/controlflow.rst:841 +#: tutorial/controlflow.rst:858 +msgid "" +">>> combined_example(1, 2, 3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: combined_example() takes 2 positional arguments but 3 were given\n" +"\n" +">>> combined_example(1, 2, kwd_only=3)\n" +"1 2 3\n" +"\n" +">>> combined_example(1, standard=2, kwd_only=3)\n" +"1 2 3\n" +"\n" +">>> combined_example(pos_only=1, standard=2, kwd_only=3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: combined_example() got some positional-only arguments passed as " +"keyword arguments: 'pos_only'" +msgstr "" +">>> combined_example(1, 2, 3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: combined_example() takes 2 positional arguments but 3 were given\n" +"\n" +">>> combined_example(1, 2, kwd_only=3)\n" +"1 2 3\n" +"\n" +">>> combined_example(1, standard=2, kwd_only=3)\n" +"1 2 3\n" +"\n" +">>> combined_example(pos_only=1, standard=2, kwd_only=3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: combined_example() got some positional-only arguments passed as " +"keyword arguments: 'pos_only'" + +#: tutorial/controlflow.rst:875 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -1010,7 +1948,15 @@ msgstr "" "μεταξύ του ορίσματος θέσης ``name`` και ``**kwds`` που έχει ως κλειδί το " "``name``::" -#: tutorial/controlflow.rst:846 +#: tutorial/controlflow.rst:877 +msgid "" +"def foo(name, **kwds):\n" +" return 'name' in kwds" +msgstr "" +"def foo(name, **kwds):\n" +" return 'name' in kwds" + +#: tutorial/controlflow.rst:880 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" @@ -1019,7 +1965,21 @@ msgstr "" "το keyword ``'name'`` θα συνδέεται πάντα με την πρώτη παράμετρο. Για " "παράδειγμα::" -#: tutorial/controlflow.rst:855 +#: tutorial/controlflow.rst:883 +msgid "" +">>> foo(1, **{'name': 2})\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: foo() got multiple values for argument 'name'\n" +">>>" +msgstr "" +">>> foo(1, **{'name': 2})\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: foo() got multiple values for argument 'name'\n" +">>>" + +#: tutorial/controlflow.rst:889 msgid "" "But using ``/`` (positional only arguments), it is possible since it allows " "``name`` as a positional argument and ``'name'`` as a key in the keyword " @@ -1029,7 +1989,21 @@ msgstr "" "επιτρέπει το ``name`` ως όρισμα θέσης και το ``'name'`` ως κλειδί στα " "keyword ορίσματα::" -#: tutorial/controlflow.rst:863 +#: tutorial/controlflow.rst:891 +msgid "" +">>> def foo(name, /, **kwds):\n" +"... return 'name' in kwds\n" +"...\n" +">>> foo(1, **{'name': 2})\n" +"True" +msgstr "" +">>> def foo(name, /, **kwds):\n" +"... return 'name' in kwds\n" +"...\n" +">>> foo(1, **{'name': 2})\n" +"True" + +#: tutorial/controlflow.rst:897 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." @@ -1037,11 +2011,11 @@ msgstr "" "Με άλλα λόγια, τα ονόματα των παραμέτρων μόνο θέσης μπορούν να " "χρησιμοποιηθούν σε ``**kwds`` χωρίς ασάφεια." -#: tutorial/controlflow.rst:868 +#: tutorial/controlflow.rst:902 msgid "Recap" msgstr "Ανακεφαλαίωση" -#: tutorial/controlflow.rst:870 +#: tutorial/controlflow.rst:904 msgid "" "The use case will determine which parameters to use in the function " "definition::" @@ -1049,11 +2023,15 @@ msgstr "" "Η περίπτωση χρήσης θα καθορίσει ποιες παραμέτρους θα χρησιμοποιηθούν στον " "ορισμό της συνάρτησης::" -#: tutorial/controlflow.rst:874 +#: tutorial/controlflow.rst:906 +msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" +msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" + +#: tutorial/controlflow.rst:908 msgid "As guidance:" msgstr "Ως καθοδήγηση:" -#: tutorial/controlflow.rst:876 +#: tutorial/controlflow.rst:910 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1067,7 +2045,7 @@ msgstr "" "όταν καλείται η συνάρτηση ή εάν πρέπει να ληφθούν ορισμένες παράμετροι θέσης " "και αυθαίρετα keywords." -#: tutorial/controlflow.rst:881 +#: tutorial/controlflow.rst:915 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -1078,7 +2056,7 @@ msgstr "" "αποτρέψετε τους χρήστες να βασίζονται στη θέση του επιχειρήματος που " "μεταβιβάζεται." -#: tutorial/controlflow.rst:884 +#: tutorial/controlflow.rst:918 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1086,11 +2064,11 @@ msgstr "" "Για ένα API, χρησιμοποιήστε το μόνο θέσης για να αποτρέψετε τη διακοπή των " "αλλαγών τους API, εάν το όνομα της παραμέτρου τροποποιηθεί στο μέλλον." -#: tutorial/controlflow.rst:890 +#: tutorial/controlflow.rst:924 msgid "Arbitrary Argument Lists" msgstr "Λίστες Αυθαίρετων Ορισμάτων" -#: tutorial/controlflow.rst:895 +#: tutorial/controlflow.rst:929 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1103,7 +2081,15 @@ msgstr "" "από τον μεταβλητό αριθμό ορισμάτων ενδέχεται να προκύψουν μηδέν ή " "περισσότερα κανονικά ορίσματα. ::" -#: tutorial/controlflow.rst:904 +#: tutorial/controlflow.rst:934 +msgid "" +"def write_multiple_items(file, separator, *args):\n" +" file.write(separator.join(args))" +msgstr "" +"def write_multiple_items(file, separator, *args):\n" +" file.write(separator.join(args))" + +#: tutorial/controlflow.rst:938 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1118,11 +2104,29 @@ msgstr "" "σημαίνει ότι μπορούν να χρησιμοποιηθούν μόνο ως λέξεις-κλειδιά και όχι ως " "ορίσματα θέσης. ::" -#: tutorial/controlflow.rst:921 +#: tutorial/controlflow.rst:944 +msgid "" +">>> def concat(*args, sep=\"/\"):\n" +"... return sep.join(args)\n" +"...\n" +">>> concat(\"earth\", \"mars\", \"venus\")\n" +"'earth/mars/venus'\n" +">>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n" +"'earth.mars.venus'" +msgstr "" +">>> def concat(*args, sep=\"/\"):\n" +"... return sep.join(args)\n" +"...\n" +">>> concat(\"earth\", \"mars\", \"venus\")\n" +"'earth/mars/venus'\n" +">>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n" +"'earth.mars.venus'" + +#: tutorial/controlflow.rst:955 msgid "Unpacking Argument Lists" msgstr "Unpacking Λίστες Ορισμάτων" -#: tutorial/controlflow.rst:923 +#: tutorial/controlflow.rst:957 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1139,7 +2143,23 @@ msgstr "" "συνάρτησης με τον ``*``\\ -τελεστή για να αποσυμπιέσετε τα ορίσματα από μια " "λίστα ή πλειάδα (tuple)::" -#: tutorial/controlflow.rst:939 +#: tutorial/controlflow.rst:964 +msgid "" +">>> list(range(3, 6)) # normal call with separate arguments\n" +"[3, 4, 5]\n" +">>> args = [3, 6]\n" +">>> list(range(*args)) # call with arguments unpacked from a " +"list\n" +"[3, 4, 5]" +msgstr "" +">>> list(range(3, 6)) # normal call with separate arguments\n" +"[3, 4, 5]\n" +">>> args = [3, 6]\n" +">>> list(range(*args)) # call with arguments unpacked from a " +"list\n" +"[3, 4, 5]" + +#: tutorial/controlflow.rst:973 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" @@ -1147,11 +2167,35 @@ msgstr "" "Με τον ίδιο τρόπο, τα λεξικά μπορούν να παραδίδουν keyword ορίσματα με τον " "``**``\\ -τελεστή::" -#: tutorial/controlflow.rst:955 +#: tutorial/controlflow.rst:976 +msgid "" +">>> def parrot(voltage, state='a stiff', action='voom'):\n" +"... print(\"-- This parrot wouldn't\", action, end=' ')\n" +"... print(\"if you put\", voltage, \"volts through it.\", end=' ')\n" +"... print(\"E's\", state, \"!\")\n" +"...\n" +">>> d = {\"voltage\": \"four million\", \"state\": \"bleedin' demised\", " +"\"action\": \"VOOM\"}\n" +">>> parrot(**d)\n" +"-- This parrot wouldn't VOOM if you put four million volts through it. E's " +"bleedin' demised !" +msgstr "" +">>> def parrot(voltage, state='a stiff', action='voom'):\n" +"... print(\"-- This parrot wouldn't\", action, end=' ')\n" +"... print(\"if you put\", voltage, \"volts through it.\", end=' ')\n" +"... print(\"E's\", state, \"!\")\n" +"...\n" +">>> d = {\"voltage\": \"four million\", \"state\": \"bleedin' demised\", " +"\"action\": \"VOOM\"}\n" +">>> parrot(**d)\n" +"-- This parrot wouldn't VOOM if you put four million volts through it. E's " +"bleedin' demised !" + +#: tutorial/controlflow.rst:989 msgid "Lambda Expressions" msgstr "Εκφράσεις Lambda" -#: tutorial/controlflow.rst:957 +#: tutorial/controlflow.rst:991 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -1169,20 +2213,54 @@ msgstr "" "κανονικής συνάρτησης. Όπως οι ορισμοί ένθετων συναρτήσεων, οι συναρτήσεις " "lambda μπορούν να παραπέμπουν σε μεταβλητές από το πεδίο που περιέχει::" -#: tutorial/controlflow.rst:974 +#: tutorial/controlflow.rst:999 +msgid "" +">>> def make_incrementor(n):\n" +"... return lambda x: x + n\n" +"...\n" +">>> f = make_incrementor(42)\n" +">>> f(0)\n" +"42\n" +">>> f(1)\n" +"43" +msgstr "" +">>> def make_incrementor(n):\n" +"... return lambda x: x + n\n" +"...\n" +">>> f = make_incrementor(42)\n" +">>> f(0)\n" +"42\n" +">>> f(1)\n" +"43" + +#: tutorial/controlflow.rst:1008 msgid "" "The above example uses a lambda expression to return a function. Another " -"use is to pass a small function as an argument::" +"use is to pass a small function as an argument. For instance, :meth:`list." +"sort` takes a sorting key function *key* which can be a lambda function::" msgstr "" "Το παραπάνω παράδειγμα χρησιμοποιεί μια έκφραση lambda για να επιστρέψει μια " "συνάρτηση. Μια άλλη χρήση είναι η μετάδοση μιας μικρής συνάρτησης ως " -"όρισμα::" +"όρισμα. Για παράδειγμα, η :meth:`list.sort` δέχεται μια συνάρτηση " +"ταξινόμησης κλειδιού *key* η οποία μπορεί να είναι μια συνάρτηση lambda::" + +#: tutorial/controlflow.rst:1012 +msgid "" +">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" +">>> pairs.sort(key=lambda pair: pair[1])\n" +">>> pairs\n" +"[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" +msgstr "" +">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" +">>> pairs.sort(key=lambda pair: pair[1])\n" +">>> pairs\n" +"[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" -#: tutorial/controlflow.rst:986 +#: tutorial/controlflow.rst:1021 msgid "Documentation Strings" msgstr "Συμβολοσειρές Τεκμηρίωσης" -#: tutorial/controlflow.rst:993 +#: tutorial/controlflow.rst:1028 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." @@ -1190,7 +2268,7 @@ msgstr "" "Ακολουθούν ορισμένες συμβάσεις σχετικά με το περιεχόμενο και τη μορφοποίηση " "των συμβολοσειρών τεκμηρίωσης." -#: tutorial/controlflow.rst:996 +#: tutorial/controlflow.rst:1031 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1204,7 +2282,7 @@ msgstr "" "εάν το όνομα είναι ρήμα που περιγράφει τη λειτουργία της συνάρτησης). Αυτή " "η γραμμή πρέπει να ξεκινά με κεφαλαίο γράμμα και να τελειώνει με τελεία." -#: tutorial/controlflow.rst:1002 +#: tutorial/controlflow.rst:1037 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -1217,7 +2295,7 @@ msgstr "" "παράγραφοι που περιγράφουν τις συμβάσεις κλήσης του αντικειμένου, τις " "παρενέργειές του κ.λπ.." -#: tutorial/controlflow.rst:1007 +#: tutorial/controlflow.rst:1042 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -1245,15 +2323,41 @@ msgstr "" "αρχικό κενό τους. Η ισοδυναμία των κενών διαστημάτων θα πρέπει να ελέγχεται " "μετά την επέκταση των καρτελών (σε 8 κενά, κανονικά)." -#: tutorial/controlflow.rst:1019 +#: tutorial/controlflow.rst:1054 msgid "Here is an example of a multi-line docstring::" msgstr "Ακολουθεί ένα παράδειγμα ενός πολλαπλών γραμμών docstring::" -#: tutorial/controlflow.rst:1037 +#: tutorial/controlflow.rst:1056 +msgid "" +">>> def my_function():\n" +"... \"\"\"Do nothing, but document it.\n" +"...\n" +"... No, really, it doesn't do anything.\n" +"... \"\"\"\n" +"... pass\n" +"...\n" +">>> print(my_function.__doc__)\n" +"Do nothing, but document it.\n" +"\n" +"No, really, it doesn't do anything." +msgstr "" +">>> def my_function():\n" +"... \"\"\"Do nothing, but document it.\n" +"...\n" +"... No, really, it doesn't do anything.\n" +"... \"\"\"\n" +"... pass\n" +"...\n" +">>> print(my_function.__doc__)\n" +"Do nothing, but document it.\n" +"\n" +"No, really, it doesn't do anything." + +#: tutorial/controlflow.rst:1072 msgid "Function Annotations" msgstr "Annotations Συναρτήσεων" -#: tutorial/controlflow.rst:1045 +#: tutorial/controlflow.rst:1080 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -1264,9 +2368,9 @@ msgstr "" "συναρτήσεις που καθορίζονται από το χρήστη (δείτε :pep:`3107` και :pep:`484` " "για περισσότερες πληροφορίες)." -#: tutorial/controlflow.rst:1049 +#: tutorial/controlflow.rst:1084 msgid "" -":term:`Annotations ` are stored in the :attr:`!" +":term:`Annotations ` are stored in the :attr:`~object." "__annotations__` attribute of the function as a dictionary and have no " "effect on any other part of the function. Parameter annotations are defined " "by a colon after the parameter name, followed by an expression evaluating to " @@ -1276,21 +2380,45 @@ msgid "" "a required argument, an optional argument, and the return value annotated::" msgstr "" "Το :term:`Annotations ` αποθηκεύονται στο " -"χαρακτηριστικό :attr:`!__annotations__` της συνάρτησης ως λεξικό και δεν " -"έχουνε καμία επίδραση σε κανένα άλλο μέρος της συνάρτησης. Τα annotations " -"των παραμέτρων ορίζονται με άνω και κάτω τελεία μετά το όνομα παραμέτρου, " -"ακολουθούμενη από μια έκφραση που αξιολογεί την τιμή του annotation. Τα " -"annotations επιστροφής ορίζονται από ένα literal ``->``, ακολουθούμενο από " -"μια έκφραση, μεταξύ της λίστας παραμέτρων και της άνω και κάτω τελείας που " -"υποδηλώνει το τέλος της δήλωσης :keyword:`def`. Το ακόλουθο παράδειγμα έχει " -"ένα απαιτούμενο όρισμα, ένα προαιρετικό όρισμα και την επιστρεφόμενη τιμή σε " -"annotations::" - -#: tutorial/controlflow.rst:1071 +"χαρακτηριστικό :attr:`~object.__annotations__` της συνάρτησης ως λεξικό και " +"δεν έχουνε καμία επίδραση σε κανένα άλλο μέρος της συνάρτησης. Τα " +"annotations των παραμέτρων ορίζονται με άνω και κάτω τελεία μετά το όνομα " +"παραμέτρου, ακολουθούμενη από μια έκφραση που αξιολογεί την τιμή του " +"annotation. Τα annotations επιστροφής ορίζονται από ένα literal ``->``, " +"ακολουθούμενο από μια έκφραση, μεταξύ της λίστας παραμέτρων και της άνω και " +"κάτω τελείας που υποδηλώνει το τέλος της δήλωσης :keyword:`def`. Το " +"ακόλουθο παράδειγμα έχει ένα απαιτούμενο όρισμα, ένα προαιρετικό όρισμα και " +"την επιστρεφόμενη τιμή σε annotations::" + +#: tutorial/controlflow.rst:1093 +msgid "" +">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" +"... print(\"Annotations:\", f.__annotations__)\n" +"... print(\"Arguments:\", ham, eggs)\n" +"... return ham + ' and ' + eggs\n" +"...\n" +">>> f('spam')\n" +"Annotations: {'ham': , 'return': , 'eggs': }\n" +"Arguments: spam eggs\n" +"'spam and eggs'" +msgstr "" +">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" +"... print(\"Annotations:\", f.__annotations__)\n" +"... print(\"Arguments:\", ham, eggs)\n" +"... return ham + ' and ' + eggs\n" +"...\n" +">>> f('spam')\n" +"Annotations: {'ham': , 'return': , 'eggs': }\n" +"Arguments: spam eggs\n" +"'spam and eggs'" + +#: tutorial/controlflow.rst:1106 msgid "Intermezzo: Coding Style" msgstr "Intermezzo: Στυλ Κώδικα" -#: tutorial/controlflow.rst:1076 +#: tutorial/controlflow.rst:1111 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -1306,7 +2434,7 @@ msgstr "" "πάντα μια καλή ιδέα και η υιοθέτηση ενός ωραίου στυλ κώδικα βοηθάει πάρα " "πολύ σε αυτό." -#: tutorial/controlflow.rst:1082 +#: tutorial/controlflow.rst:1117 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -1318,11 +2446,11 @@ msgstr "" "κώδικα. Κάθε προγραμματιστής Python θα πρέπει να το διαβάσει κάποια στιγμή· " "εδώ είναι τα πιο σημαντικό σημεία που εξάγονται για εσάς:" -#: tutorial/controlflow.rst:1087 +#: tutorial/controlflow.rst:1122 msgid "Use 4-space indentation, and no tabs." msgstr "Χρησιμοποιήστε εσοχή 4 διαστημάτων και όχι tabs." -#: tutorial/controlflow.rst:1089 +#: tutorial/controlflow.rst:1124 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -1333,11 +2461,11 @@ msgstr "" "ανάγνωση). Τα tabs δημιουργούν σύγχυση, και είναι καλύτερο να παραμείνουν " "απέξω." -#: tutorial/controlflow.rst:1093 +#: tutorial/controlflow.rst:1128 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "Τυλίξτε τις γραμμές έτσι ώστε να μην υπερβαίνουν τους 79 χαρακτήρες." -#: tutorial/controlflow.rst:1095 +#: tutorial/controlflow.rst:1130 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -1345,7 +2473,7 @@ msgstr "" "Αυτό βοηθά του χρήστες με μικρές οθόνες και καθιστά δυνατή την ύπαρξη πολλών " "αρχείων κώδικα δίπλα-δίπλα σε μεγαλύτερες οθόνες." -#: tutorial/controlflow.rst:1098 +#: tutorial/controlflow.rst:1133 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." @@ -1353,15 +2481,15 @@ msgstr "" "Χρησιμοποιείστε κενές γραμμές για να διαχωρίσετε συναρτήσεις και κλάσεις και " "μεγαλύτερα μπλοκ κώδικα μέσα συναρτήσεις." -#: tutorial/controlflow.rst:1101 +#: tutorial/controlflow.rst:1136 msgid "When possible, put comments on a line of their own." msgstr "Όταν είναι δυνατόν, βάλτε σχόλια σε μια δική τους γραμμή." -#: tutorial/controlflow.rst:1103 +#: tutorial/controlflow.rst:1138 msgid "Use docstrings." msgstr "Χρησιμοποιήστε docstrings." -#: tutorial/controlflow.rst:1105 +#: tutorial/controlflow.rst:1140 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -1369,7 +2497,7 @@ msgstr "" "Χρησιμοποιήστε κενά γύρω από τελεστές και μετά από κόμματα, αλλά όχι " "απευθείας μέσα δε δομές αγκύλων: ``a = f(1, 2) + g(3, 4)``." -#: tutorial/controlflow.rst:1108 +#: tutorial/controlflow.rst:1143 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -1383,7 +2511,7 @@ msgstr "" "(δείτε :ref:`tut-firstclasses` για περισσότερα σχετικά με τις κλάσεις και " "τις μεθόδους)." -#: tutorial/controlflow.rst:1113 +#: tutorial/controlflow.rst:1148 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -1393,7 +2521,7 @@ msgstr "" "να χρησιμοποιηθεί σε διεθνή περιβάλλοντα. Η προεπιλογή της Python, UTF-8, ή " "ακόμα και το απλό ASCII λειτουργούν καλύτερα σε κάθε περίπτωση." -#: tutorial/controlflow.rst:1117 +#: tutorial/controlflow.rst:1152 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -1403,11 +2531,11 @@ msgstr "" "εάν υπάρχει μόνο η παραμικρή πιθανότητα οι άνθρωποι που μιλούν διαφορετική " "γλώσσα να διαβάσουν ή να διατηρήσουν τον κώδικα." -#: tutorial/controlflow.rst:1123 +#: tutorial/controlflow.rst:1158 msgid "Footnotes" msgstr "Υποσημειώσεις" -#: tutorial/controlflow.rst:1124 +#: tutorial/controlflow.rst:1159 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " @@ -1426,54 +2554,69 @@ msgstr "statement" msgid "for" msgstr "for" -#: tutorial/controlflow.rst:988 +#: tutorial/controlflow.rst:254 +msgid "..." +msgstr "..." + +#: tutorial/controlflow.rst:254 +msgid "ellipsis literal" +msgstr "ellipsis literal" + +#: tutorial/controlflow.rst:1023 msgid "documentation strings" msgstr "documentation strings" -#: tutorial/controlflow.rst:988 +#: tutorial/controlflow.rst:1023 msgid "docstrings" msgstr "docstrings" -#: tutorial/controlflow.rst:988 +#: tutorial/controlflow.rst:1023 msgid "strings, documentation" msgstr "strings, documentation" -#: tutorial/controlflow.rst:892 +#: tutorial/controlflow.rst:926 msgid "* (asterisk)" msgstr "* (αστερίσκος)" -#: tutorial/controlflow.rst:936 +#: tutorial/controlflow.rst:970 msgid "in function calls" msgstr "in function calls" -#: tutorial/controlflow.rst:936 +#: tutorial/controlflow.rst:970 msgid "**" msgstr "**" -#: tutorial/controlflow.rst:1040 +#: tutorial/controlflow.rst:1075 msgid "function" msgstr "function" -#: tutorial/controlflow.rst:1040 +#: tutorial/controlflow.rst:1075 msgid "annotations" msgstr "annotations" -#: tutorial/controlflow.rst:1040 +#: tutorial/controlflow.rst:1075 msgid "->" msgstr "->" -#: tutorial/controlflow.rst:1040 +#: tutorial/controlflow.rst:1075 msgid "function annotations" msgstr "function annotations" -#: tutorial/controlflow.rst:1040 +#: tutorial/controlflow.rst:1075 msgid ": (colon)" msgstr ": (colon)" -#: tutorial/controlflow.rst:1074 +#: tutorial/controlflow.rst:1109 msgid "coding" msgstr "coding" -#: tutorial/controlflow.rst:1074 +#: tutorial/controlflow.rst:1109 msgid "style" msgstr "style" + +#~ msgid "" +#~ "A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!" +#~ "else` clause." +#~ msgstr "" +#~ "Ένας βρόχος :keyword:`!for` ή :keyword:`!while` μπορεί να περιλαμβάνει " +#~ "μια πρόταση :keyword:`!else`." diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 44038f8b..bef61395 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-09-18 17:32+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -36,28 +36,27 @@ msgstr "Περισσότερα για τις Λίστες" #: tutorial/datastructures.rst:15 msgid "" -"The list data type has some more methods. Here are all of the methods of " -"list objects:" +"The :ref:`list ` data type has some more methods. Here are " +"all of the methods of list objects:" msgstr "" -"Ο τύπος δεδομένων λίστας έχει μερικές ακόμη μεθόδους. Ακολουθούν όλες οι " -"μέθοδοι αντικειμένων τύπου λίστας:" +"Ο τύπος δεδομένων :ref:`λίστα ` έχει μερικές ακόμη μεθόδους. " +"Εδώ είναι όλες οι μέθοδοι των αντικειμένων λίστας:" -#: tutorial/datastructures.rst:22 -msgid "" -"Add an item to the end of the list. Equivalent to ``a[len(a):] = [x]``." +#: tutorial/datastructures.rst:21 +msgid "Add an item to the end of the list. Similar to ``a[len(a):] = [x]``." msgstr "" -"Προσθέτει ένα στοιχείο στο τέλος της λίστας. Ισοδυναμεί με ``a[len(a):] = " +"Προσθέτει ένα στοιχείο στο τέλος της λίστας. Παρόμοιο με ``a[len(a):] = " "[x]``." -#: tutorial/datastructures.rst:28 +#: tutorial/datastructures.rst:27 msgid "" -"Extend the list by appending all the items from the iterable. Equivalent to " +"Extend the list by appending all the items from the iterable. Similar to " "``a[len(a):] = iterable``." msgstr "" -"Επεκτείνει τη λίστα προσθέτοντας όλα τα στοιχεία από το iterable. " -"Ισοδυναμεί με ``a[len(a):] = iterable``." +"Επεκτείνει τη λίστα προσθέτοντας όλα τα στοιχεία από το iterable. Παρόμοιο " +"με ``a[len(a):] = iterable``." -#: tutorial/datastructures.rst:35 +#: tutorial/datastructures.rst:34 msgid "" "Insert an item at a given position. The first argument is the index of the " "element before which to insert, so ``a.insert(0, x)`` inserts at the front " @@ -68,7 +67,7 @@ msgstr "" "εισάγεται στο μπροστινό μέρος της λίστας, και το ``a.insert(len(a), x)`` " "ισοδυναμεί με ``a.append(x)``." -#: tutorial/datastructures.rst:43 +#: tutorial/datastructures.rst:42 msgid "" "Remove the first item from the list whose value is equal to *x*. It raises " "a :exc:`ValueError` if there is no such item." @@ -76,7 +75,7 @@ msgstr "" "Καταργεί το πρώτο στοιχείο από τη λίστα του οποίου η τιμή είναι ίση με *x*. " "Κάνει raise ένα :exc:`ValueError` εάν δεν υπάρχει τέτοιο στοιχείο." -#: tutorial/datastructures.rst:50 +#: tutorial/datastructures.rst:49 msgid "" "Remove the item at the given position in the list, and return it. If no " "index is specified, ``a.pop()`` removes and returns the last item in the " @@ -88,20 +87,19 @@ msgstr "" "τελευταίο στοιχείο στη λίστα. Κάνει raise ένα :exc:`IndexError` εάν η λίστα " "είναι κενή ή το ευρετήριο βρίσκεται εκτός του εύρους της λίστας." -#: tutorial/datastructures.rst:59 -msgid "Remove all items from the list. Equivalent to ``del a[:]``." -msgstr "Αφαιρεί όλα τα στοιχεία από τη λίστα. Ισοδυναμεί με ``del a[:]``." +#: tutorial/datastructures.rst:58 +msgid "Remove all items from the list. Similar to ``del a[:]``." +msgstr "Αφαιρεί όλα τα στοιχεία από τη λίστα. Παρόμοιο με ``del a[:]``." -#: tutorial/datastructures.rst:65 +#: tutorial/datastructures.rst:64 msgid "" -"Return zero-based index in the list of the first item whose value is equal " -"to *x*. Raises a :exc:`ValueError` if there is no such item." +"Return zero-based index of the first occurrence of *x* in the list. Raises " +"a :exc:`ValueError` if there is no such item." msgstr "" -"Επιστρέφει το μηδενικό index στη λίστα του πρώτου στοιχείου του οποίου η " -"τιμή είναι ίση με *x*. Κάνει raise ένα :exc:`ValueError` εάν δεν υπάρχει " -"τέτοιο στοιχείο." +"Επιστρέφει τον μηδενικό δείκτη της πρώτης εμφάνισης του *x* στη λίστα. Κάνει " +"raise μια :exc:`ValueError` εάν δεν υπάρχει τέτοιο στοιχείο." -#: tutorial/datastructures.rst:68 +#: tutorial/datastructures.rst:67 msgid "" "The optional arguments *start* and *end* are interpreted as in the slice " "notation and are used to limit the search to a particular subsequence of the " @@ -113,11 +111,11 @@ msgstr "" "συγκεκριμένη υποακολουθία της λίστας. Ο επιστρεφόμενος δείκτης υπολογίζεται " "σε σχέση με την αρχή της πλήρους ακολουθίας αντί για το όρισμα *start*." -#: tutorial/datastructures.rst:77 +#: tutorial/datastructures.rst:76 msgid "Return the number of times *x* appears in the list." msgstr "Επιστρέφει τον αριθμό των φορών που εμφανίζεται το *x* στη λίστα." -#: tutorial/datastructures.rst:83 +#: tutorial/datastructures.rst:82 msgid "" "Sort the items of the list in place (the arguments can be used for sort " "customization, see :func:`sorted` for their explanation)." @@ -126,22 +124,68 @@ msgstr "" "χρησιμοποιηθούν για προσαρμογή ταξινόμησης, βλ. :func:`sorted` για την " "εξήγησή τους)." -#: tutorial/datastructures.rst:90 +#: tutorial/datastructures.rst:89 msgid "Reverse the elements of the list in place." msgstr "Αντιστρέφει τα στοιχεία της λίστας στη θέση τους." -#: tutorial/datastructures.rst:96 -msgid "Return a shallow copy of the list. Equivalent to ``a[:]``." +#: tutorial/datastructures.rst:95 +msgid "Return a shallow copy of the list. Similar to ``a[:]``." msgstr "" -"Επιστρέφει ένα shallow (ρηχό) αντίγραφο της λίστας.. Ισοδύναμε με ``a[:]``." +"Επιστρέφει ένα shallow (ρηχό) αντίγραφο της λίστας. Παρόμοιο με ``a[:]``." -#: tutorial/datastructures.rst:99 +#: tutorial/datastructures.rst:98 msgid "An example that uses most of the list methods::" msgstr "" "Ένα παράδειγμα που χρησιμοποιεί τις περισσότερες από τις μεθόδους της " "λίστας::" -#: tutorial/datastructures.rst:122 +#: tutorial/datastructures.rst:100 +msgid "" +">>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', " +"'banana']\n" +">>> fruits.count('apple')\n" +"2\n" +">>> fruits.count('tangerine')\n" +"0\n" +">>> fruits.index('banana')\n" +"3\n" +">>> fruits.index('banana', 4) # Find next banana starting at position 4\n" +"6\n" +">>> fruits.reverse()\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']\n" +">>> fruits.append('grape')\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']\n" +">>> fruits.sort()\n" +">>> fruits\n" +"['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']\n" +">>> fruits.pop()\n" +"'pear'" +msgstr "" +">>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', " +"'banana']\n" +">>> fruits.count('apple')\n" +"2\n" +">>> fruits.count('tangerine')\n" +"0\n" +">>> fruits.index('banana')\n" +"3\n" +">>> fruits.index('banana', 4) # Find next banana starting at position 4\n" +"6\n" +">>> fruits.reverse()\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']\n" +">>> fruits.append('grape')\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']\n" +">>> fruits.sort()\n" +">>> fruits\n" +"['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']\n" +">>> fruits.pop()\n" +"'pear'" + +#: tutorial/datastructures.rst:121 msgid "" "You might have noticed that methods like ``insert``, ``remove`` or ``sort`` " "that only modify the list have no return value printed -- they return the " @@ -153,27 +197,27 @@ msgstr "" "-- επιστρέφουν το προεπιλεγμένο (default) ``None``. [#]_ Αυτή είναι μια " "αρχή σχεδιασμού για όλες τις μεταβλητές δομές δεδομένων στην Python." -#: tutorial/datastructures.rst:127 +#: tutorial/datastructures.rst:126 msgid "" "Another thing you might notice is that not all data can be sorted or " "compared. For instance, ``[None, 'hello', 10]`` doesn't sort because " -"integers can't be compared to strings and *None* can't be compared to other " -"types. Also, there are some types that don't have a defined ordering " +"integers can't be compared to strings and ``None`` can't be compared to " +"other types. Also, there are some types that don't have a defined ordering " "relation. For example, ``3+4j < 5+7j`` isn't a valid comparison." msgstr "" "Ένα άλλο πράγμα που μπορεί να παρατηρήσετε είναι ότι δεν μπορούν να " "ταξινομηθούν ή να συγκριθούν όλα τα δεδομένα. Για παράδειγμα, ``[None, " "'hello', 10]`` δεν ταξινομούνται γιατί ακέραιοι αριθμοί δεν μπορούν να " -"συγκριθούν με συμβολοσειρές (strings) και το *None* δεν μπορεί να συγκριθεί " -"με άλλους τύπους. Επίσης, υπάρχουν ορισμένοι τύποι που δεν έχουν " +"συγκριθούν με συμβολοσειρές (strings) και το ``None`` δεν μπορεί να " +"συγκριθεί με άλλους τύπους. Επίσης, υπάρχουν ορισμένοι τύποι που δεν έχουν " "καθορισμένη σχέση διάταξης. Για παράδειγμα, το ``3+4j < 5+7j`` δεν είναι " "έγκυρη σύγκριση." -#: tutorial/datastructures.rst:138 +#: tutorial/datastructures.rst:137 msgid "Using Lists as Stacks" msgstr "Χρήστη Λιστών ως Στοίβες (Stacks)" -#: tutorial/datastructures.rst:143 +#: tutorial/datastructures.rst:142 msgid "" "The list methods make it very easy to use a list as a stack, where the last " "element added is the first element retrieved (\"last-in, first-out\"). To " @@ -184,15 +228,49 @@ msgstr "" "Οι μέθοδοι λίστας καθιστούν πιο εύκολη τη χρήση μιας λίστα ως στοίβας " "(stack), όπου το τελευταίο στοιχείο που προστέθηκε είναι το πρώτο στοιχείο " "που ανακτήθηκε (\"last-in, first-out\"). Για να προσθέσετε ένα στοιχείο " -"στην κορυφή της στοίβας (stack), χρησιμοποιήστε τη :meth:`~list.append`. " -"Για να ανακτήσετε ένα στοιχείο από την κορυφής της στοίβας, χρησιμοποιήστε " -"τη :meth:`~list.pop` χωρίς κάποιο σαφές index. Για παράδειγμα::" +"στην κορυφή της στοίβας, χρησιμοποιήστε την :meth:`~list.append`. Για να " +"ανακτήσετε ένα στοιχείο από την κορυφή της στοίβας, χρησιμοποιήστε την :meth:" +"`~list.pop` χωρίς κάποιο σαφές index. Για παράδειγμα::" -#: tutorial/datastructures.rst:168 +#: tutorial/datastructures.rst:147 +msgid "" +">>> stack = [3, 4, 5]\n" +">>> stack.append(6)\n" +">>> stack.append(7)\n" +">>> stack\n" +"[3, 4, 5, 6, 7]\n" +">>> stack.pop()\n" +"7\n" +">>> stack\n" +"[3, 4, 5, 6]\n" +">>> stack.pop()\n" +"6\n" +">>> stack.pop()\n" +"5\n" +">>> stack\n" +"[3, 4]" +msgstr "" +">>> stack = [3, 4, 5]\n" +">>> stack.append(6)\n" +">>> stack.append(7)\n" +">>> stack\n" +"[3, 4, 5, 6, 7]\n" +">>> stack.pop()\n" +"7\n" +">>> stack\n" +"[3, 4, 5, 6]\n" +">>> stack.pop()\n" +"6\n" +">>> stack.pop()\n" +"5\n" +">>> stack\n" +"[3, 4]" + +#: tutorial/datastructures.rst:167 msgid "Using Lists as Queues" msgstr "Χρήση λιστών ως Ουρές (Queues)" -#: tutorial/datastructures.rst:172 +#: tutorial/datastructures.rst:171 msgid "" "It is also possible to use a list as a queue, where the first element added " "is the first element retrieved (\"first-in, first-out\"); however, lists are " @@ -208,7 +286,7 @@ msgstr "" "αφαιρέσεις (στοιχείων) στην αρχή της λίστα είναι αργό (επειδή όλα τα " "στοιχεία πρέπει να μετατοπιστούν κατά ένα)." -#: tutorial/datastructures.rst:178 +#: tutorial/datastructures.rst:177 msgid "" "To implement a queue, use :class:`collections.deque` which was designed to " "have fast appends and pops from both ends. For example::" @@ -217,11 +295,35 @@ msgstr "" "deque` η οποία σχεδιάστηκε για να έχει γρήγορες προσθέσεις και αφαιρέσεις " "και από τα δύο άκρα. Για παράδειγμα:΅:" -#: tutorial/datastructures.rst:196 +#: tutorial/datastructures.rst:180 +msgid "" +">>> from collections import deque\n" +">>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n" +">>> queue.append(\"Terry\") # Terry arrives\n" +">>> queue.append(\"Graham\") # Graham arrives\n" +">>> queue.popleft() # The first to arrive now leaves\n" +"'Eric'\n" +">>> queue.popleft() # The second to arrive now leaves\n" +"'John'\n" +">>> queue # Remaining queue in order of arrival\n" +"deque(['Michael', 'Terry', 'Graham'])" +msgstr "" +">>> from collections import deque\n" +">>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n" +">>> queue.append(\"Terry\") # Terry arrives\n" +">>> queue.append(\"Graham\") # Graham arrives\n" +">>> queue.popleft() # The first to arrive now leaves\n" +"'Eric'\n" +">>> queue.popleft() # The second to arrive now leaves\n" +"'John'\n" +">>> queue # Remaining queue in order of arrival\n" +"deque(['Michael', 'Terry', 'Graham'])" + +#: tutorial/datastructures.rst:195 msgid "List Comprehensions" msgstr "Comprehensions Λίστας" -#: tutorial/datastructures.rst:198 +#: tutorial/datastructures.rst:197 msgid "" "List comprehensions provide a concise way to create lists. Common " "applications are to make new lists where each element is the result of some " @@ -234,13 +336,29 @@ msgstr "" "ακολουθίας ή iterable, ή η δημιουργία μιας υποακολουθίας αυτών των στοιχείων " "που ικανοποιούν μια συγκεκριμένη συνθήκη." -#: tutorial/datastructures.rst:203 +#: tutorial/datastructures.rst:202 msgid "For example, assume we want to create a list of squares, like::" msgstr "" "Για παράδειγμα, ας υποθέσουμε ότι θέλουμε να δημιουργήσουμε μια λίστα " "τετραγώνων όπως::" -#: tutorial/datastructures.rst:212 +#: tutorial/datastructures.rst:204 +msgid "" +">>> squares = []\n" +">>> for x in range(10):\n" +"... squares.append(x**2)\n" +"...\n" +">>> squares\n" +"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" +msgstr "" +">>> squares = []\n" +">>> for x in range(10):\n" +"... squares.append(x**2)\n" +"...\n" +">>> squares\n" +"[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" + +#: tutorial/datastructures.rst:211 msgid "" "Note that this creates (or overwrites) a variable named ``x`` that still " "exists after the loop completes. We can calculate the list of squares " @@ -250,15 +368,23 @@ msgstr "" "``x`` που εξακολουθεί να υπάρχει μετά την ολοκλήρωση της loop. Μπορούμε να " "υπολογίσουμε τη λίστα των τετραγώνων χωρίς παρενέργειες χρησιμοποιώντας::" -#: tutorial/datastructures.rst:218 +#: tutorial/datastructures.rst:215 +msgid "squares = list(map(lambda x: x**2, range(10)))" +msgstr "squares = list(map(lambda x: x**2, range(10)))" + +#: tutorial/datastructures.rst:217 msgid "or, equivalently::" msgstr "ή, ισοδύναμα::" -#: tutorial/datastructures.rst:222 +#: tutorial/datastructures.rst:219 +msgid "squares = [x**2 for x in range(10)]" +msgstr "squares = [x**2 for x in range(10)]" + +#: tutorial/datastructures.rst:221 msgid "which is more concise and readable." msgstr "που είναι πιο συνοπτικό και ευανάγνωστο." -#: tutorial/datastructures.rst:224 +#: tutorial/datastructures.rst:223 msgid "" "A list comprehension consists of brackets containing an expression followed " "by a :keyword:`!for` clause, then zero or more :keyword:`!for` or :keyword:`!" @@ -275,11 +401,39 @@ msgstr "" "Για παράδειγμα, αυτή η λίστα συνδυάζει τα στοιχεία δύο λιστών εάν δεν είναι " "ίσες::" -#: tutorial/datastructures.rst:234 +#: tutorial/datastructures.rst:230 +msgid "" +">>> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]\n" +"[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]" +msgstr "" +">>> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]\n" +"[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]" + +#: tutorial/datastructures.rst:233 msgid "and it's equivalent to::" msgstr "και ισοδυναμεί με::" -#: tutorial/datastructures.rst:245 +#: tutorial/datastructures.rst:235 +msgid "" +">>> combs = []\n" +">>> for x in [1,2,3]:\n" +"... for y in [3,1,4]:\n" +"... if x != y:\n" +"... combs.append((x, y))\n" +"...\n" +">>> combs\n" +"[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]" +msgstr "" +">>> combs = []\n" +">>> for x in [1,2,3]:\n" +"... for y in [3,1,4]:\n" +"... if x != y:\n" +"... combs.append((x, y))\n" +"...\n" +">>> combs\n" +"[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]" + +#: tutorial/datastructures.rst:244 msgid "" "Note how the order of the :keyword:`for` and :keyword:`if` statements is the " "same in both these snippets." @@ -287,7 +441,7 @@ msgstr "" "Σημειώστε πώς η σειρά των δηλώσεων :keyword:`for` και :keyword:`if` είναι " "ίδια και στα δύο αποσπάσματα." -#: tutorial/datastructures.rst:248 +#: tutorial/datastructures.rst:247 msgid "" "If the expression is a tuple (e.g. the ``(x, y)`` in the previous example), " "it must be parenthesized. ::" @@ -295,18 +449,86 @@ msgstr "" "Εάν η έκφραση είναι πλειάδα (π.χ. το ``(x, y)`` στο προηγούμενο παράδειγμα), " "πρέπει να μπει σε παρένθεση. ::" -#: tutorial/datastructures.rst:279 +#: tutorial/datastructures.rst:250 +msgid "" +">>> vec = [-4, -2, 0, 2, 4]\n" +">>> # create a new list with the values doubled\n" +">>> [x*2 for x in vec]\n" +"[-8, -4, 0, 4, 8]\n" +">>> # filter the list to exclude negative numbers\n" +">>> [x for x in vec if x >= 0]\n" +"[0, 2, 4]\n" +">>> # apply a function to all the elements\n" +">>> [abs(x) for x in vec]\n" +"[4, 2, 0, 2, 4]\n" +">>> # call a method on each element\n" +">>> freshfruit = [' banana', ' loganberry ', 'passion fruit ']\n" +">>> [weapon.strip() for weapon in freshfruit]\n" +"['banana', 'loganberry', 'passion fruit']\n" +">>> # create a list of 2-tuples like (number, square)\n" +">>> [(x, x**2) for x in range(6)]\n" +"[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25)]\n" +">>> # the tuple must be parenthesized, otherwise an error is raised\n" +">>> [x, x**2 for x in range(6)]\n" +" File \"\", line 1\n" +" [x, x**2 for x in range(6)]\n" +" ^^^^^^^\n" +"SyntaxError: did you forget parentheses around the comprehension target?\n" +">>> # flatten a list using a listcomp with two 'for'\n" +">>> vec = [[1,2,3], [4,5,6], [7,8,9]]\n" +">>> [num for elem in vec for num in elem]\n" +"[1, 2, 3, 4, 5, 6, 7, 8, 9]" +msgstr "" +">>> vec = [-4, -2, 0, 2, 4]\n" +">>> # create a new list with the values doubled\n" +">>> [x*2 for x in vec]\n" +"[-8, -4, 0, 4, 8]\n" +">>> # filter the list to exclude negative numbers\n" +">>> [x for x in vec if x >= 0]\n" +"[0, 2, 4]\n" +">>> # apply a function to all the elements\n" +">>> [abs(x) for x in vec]\n" +"[4, 2, 0, 2, 4]\n" +">>> # call a method on each element\n" +">>> freshfruit = [' banana', ' loganberry ', 'passion fruit ']\n" +">>> [weapon.strip() for weapon in freshfruit]\n" +"['banana', 'loganberry', 'passion fruit']\n" +">>> # create a list of 2-tuples like (number, square)\n" +">>> [(x, x**2) for x in range(6)]\n" +"[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25)]\n" +">>> # the tuple must be parenthesized, otherwise an error is raised\n" +">>> [x, x**2 for x in range(6)]\n" +" File \"\", line 1\n" +" [x, x**2 for x in range(6)]\n" +" ^^^^^^^\n" +"SyntaxError: did you forget parentheses around the comprehension target?\n" +">>> # flatten a list using a listcomp with two 'for'\n" +">>> vec = [[1,2,3], [4,5,6], [7,8,9]]\n" +">>> [num for elem in vec for num in elem]\n" +"[1, 2, 3, 4, 5, 6, 7, 8, 9]" + +#: tutorial/datastructures.rst:278 msgid "" "List comprehensions can contain complex expressions and nested functions::" msgstr "" "Τα comprehensions λίστας μπορεί να περιέχουν σύνθετες εκφράσεις και ένθετες " "συναρτήσεις::" -#: tutorial/datastructures.rst:286 +#: tutorial/datastructures.rst:280 +msgid "" +">>> from math import pi\n" +">>> [str(round(pi, i)) for i in range(1, 6)]\n" +"['3.1', '3.14', '3.142', '3.1416', '3.14159']" +msgstr "" +">>> from math import pi\n" +">>> [str(round(pi, i)) for i in range(1, 6)]\n" +"['3.1', '3.14', '3.142', '3.1416', '3.14159']" + +#: tutorial/datastructures.rst:285 msgid "Nested List Comprehensions" msgstr "Comprehensions Ένθετων Λιστών" -#: tutorial/datastructures.rst:288 +#: tutorial/datastructures.rst:287 msgid "" "The initial expression in a list comprehension can be any arbitrary " "expression, including another list comprehension." @@ -314,7 +536,7 @@ msgstr "" "Η αρχική έκφραση σε ένα comprehension λίστας μπορεί να είναι οποιαδήποτε " "αυθαίρετη έκφραση, συμπεριλαμβανομένης ενός άλλου comprehension λίστας." -#: tutorial/datastructures.rst:291 +#: tutorial/datastructures.rst:290 msgid "" "Consider the following example of a 3x4 matrix implemented as a list of 3 " "lists of length 4::" @@ -322,11 +544,33 @@ msgstr "" "Σκεφτείτε το ακόλουθο παράδειγμα μιας μήτρας 3x4 που υλοποιήθηκε ως μια " "λίστα 3 λιστών μήκους 4::" -#: tutorial/datastructures.rst:300 +#: tutorial/datastructures.rst:293 +msgid "" +">>> matrix = [\n" +"... [1, 2, 3, 4],\n" +"... [5, 6, 7, 8],\n" +"... [9, 10, 11, 12],\n" +"... ]" +msgstr "" +">>> matrix = [\n" +"... [1, 2, 3, 4],\n" +"... [5, 6, 7, 8],\n" +"... [9, 10, 11, 12],\n" +"... ]" + +#: tutorial/datastructures.rst:299 msgid "The following list comprehension will transpose rows and columns::" msgstr "Το ακόλουθο comprehension λίστας θα μεταφέρει γραμμές και στήλες::" -#: tutorial/datastructures.rst:305 +#: tutorial/datastructures.rst:301 +msgid "" +">>> [[row[i] for row in matrix] for i in range(4)]\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" +msgstr "" +">>> [[row[i] for row in matrix] for i in range(4)]\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" + +#: tutorial/datastructures.rst:304 msgid "" "As we saw in the previous section, the inner list comprehension is evaluated " "in the context of the :keyword:`for` that follows it, so this example is " @@ -336,11 +580,51 @@ msgstr "" "αξιολογείται στο πλαίσιο του :keyword:`for` που την ακολουθεί, επομένως αυτό " "το παράδειγμα είναι ισοδύναμο με::" -#: tutorial/datastructures.rst:316 +#: tutorial/datastructures.rst:308 +msgid "" +">>> transposed = []\n" +">>> for i in range(4):\n" +"... transposed.append([row[i] for row in matrix])\n" +"...\n" +">>> transposed\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" +msgstr "" +">>> transposed = []\n" +">>> for i in range(4):\n" +"... transposed.append([row[i] for row in matrix])\n" +"...\n" +">>> transposed\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" + +#: tutorial/datastructures.rst:315 msgid "which, in turn, is the same as::" msgstr "το οποίο, με τη σειρά του, είναι το ίδιο με::" -#: tutorial/datastructures.rst:329 +#: tutorial/datastructures.rst:317 +msgid "" +">>> transposed = []\n" +">>> for i in range(4):\n" +"... # the following 3 lines implement the nested listcomp\n" +"... transposed_row = []\n" +"... for row in matrix:\n" +"... transposed_row.append(row[i])\n" +"... transposed.append(transposed_row)\n" +"...\n" +">>> transposed\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" +msgstr "" +">>> transposed = []\n" +">>> for i in range(4):\n" +"... # the following 3 lines implement the nested listcomp\n" +"... transposed_row = []\n" +"... for row in matrix:\n" +"... transposed_row.append(row[i])\n" +"... transposed.append(transposed_row)\n" +"...\n" +">>> transposed\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" + +#: tutorial/datastructures.rst:328 msgid "" "In the real world, you should prefer built-in functions to complex flow " "statements. The :func:`zip` function would do a great job for this use case::" @@ -349,18 +633,26 @@ msgstr "" "συναρτήσεις από τις σύνθετες εντολές ροής. Η συνάρτηση :func:`zip` θα έκανε " "εξαιρετική δουλειά για αυτήν την περίπτωση χρήσης::" -#: tutorial/datastructures.rst:335 +#: tutorial/datastructures.rst:331 +msgid "" +">>> list(zip(*matrix))\n" +"[(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]" +msgstr "" +">>> list(zip(*matrix))\n" +"[(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]" + +#: tutorial/datastructures.rst:334 msgid "" "See :ref:`tut-unpacking-arguments` for details on the asterisk in this line." msgstr "" "Δείτε :ref:`tut-unpacking-arguments` για λεπτομέρειες σχετικά με τον " "αστερίσκο σε αυτήν τη γραμμή." -#: tutorial/datastructures.rst:340 +#: tutorial/datastructures.rst:339 msgid "The :keyword:`!del` statement" msgstr "Η δήλωση :keyword:`!del`" -#: tutorial/datastructures.rst:342 +#: tutorial/datastructures.rst:341 msgid "" "There is a way to remove an item from a list given its index instead of its " "value: the :keyword:`del` statement. This differs from the :meth:`~list." @@ -372,16 +664,44 @@ msgstr "" "του αντί για την τιμή του: η δήλωση :keyword:`del`. Αυτό διαφέρει από τη " "μέθοδο :meth:`~list.pop` που επιστρέφει μια τιμή. Η δήλωση :keyword:`!del` " "μπορεί επίσης να χρησιμοποιηθεί για την αφαίρεση τμημάτων από μια λίστα ή " -"για την εκκαθάριση ολόκληρης της λίστας (κάτι που κάναμε νωρίτερα με την " -"ανάθεση μιας κενής λίστας στο slice). Για παράδειγμα::" +"για να καθαρίσει ολόκληρη τη λίστα (που κάναμε νωρίτερα με την εκχώρηση μιας " +"κενής λίστας στο τμήμα). Για παράδειγμα::" -#: tutorial/datastructures.rst:359 +#: tutorial/datastructures.rst:347 +msgid "" +">>> a = [-1, 1, 66.25, 333, 333, 1234.5]\n" +">>> del a[0]\n" +">>> a\n" +"[1, 66.25, 333, 333, 1234.5]\n" +">>> del a[2:4]\n" +">>> a\n" +"[1, 66.25, 1234.5]\n" +">>> del a[:]\n" +">>> a\n" +"[]" +msgstr "" +">>> a = [-1, 1, 66.25, 333, 333, 1234.5]\n" +">>> del a[0]\n" +">>> a\n" +"[1, 66.25, 333, 333, 1234.5]\n" +">>> del a[2:4]\n" +">>> a\n" +"[1, 66.25, 1234.5]\n" +">>> del a[:]\n" +">>> a\n" +"[]" + +#: tutorial/datastructures.rst:358 msgid ":keyword:`del` can also be used to delete entire variables::" msgstr "" "Το :keyword:`del` μπορεί επίσης να χρησιμοποιηθεί για τη διαγραφή ολόκληρων " "μεταβλητών::" -#: tutorial/datastructures.rst:363 +#: tutorial/datastructures.rst:360 +msgid ">>> del a" +msgstr ">>> del a" + +#: tutorial/datastructures.rst:362 msgid "" "Referencing the name ``a`` hereafter is an error (at least until another " "value is assigned to it). We'll find other uses for :keyword:`del` later." @@ -390,11 +710,11 @@ msgstr "" "του εκχωρηθεί άλλη τιμή). Θα βρούμε άλλες χρήσεις για το :keyword:`del` " "αργότερα." -#: tutorial/datastructures.rst:370 +#: tutorial/datastructures.rst:369 msgid "Tuples and Sequences" msgstr "Πλειάδες (Tuples) και Ακολουθίες" -#: tutorial/datastructures.rst:372 +#: tutorial/datastructures.rst:371 msgid "" "We saw that lists and strings have many common properties, such as indexing " "and slicing operations. They are two examples of *sequence* data types " @@ -409,14 +729,54 @@ msgstr "" "προστεθούν. Υπάρχει επίσης ένας άλλος τυπικός τύπος δεδομένων ακολουθίας " "type: the *πλειάδα* (*tuple*)." -#: tutorial/datastructures.rst:378 +#: tutorial/datastructures.rst:377 msgid "" "A tuple consists of a number of values separated by commas, for instance::" msgstr "" "Μια πλειάδα (tuple) αποτελείται από έναν αριθμό τιμών που χωρίζονται με " "κόμματα, για παράδειγμα::" -#: tutorial/datastructures.rst:400 +#: tutorial/datastructures.rst:379 +msgid "" +">>> t = 12345, 54321, 'hello!'\n" +">>> t[0]\n" +"12345\n" +">>> t\n" +"(12345, 54321, 'hello!')\n" +">>> # Tuples may be nested:\n" +">>> u = t, (1, 2, 3, 4, 5)\n" +">>> u\n" +"((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))\n" +">>> # Tuples are immutable:\n" +">>> t[0] = 88888\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: 'tuple' object does not support item assignment\n" +">>> # but they can contain mutable objects:\n" +">>> v = ([1, 2, 3], [3, 2, 1])\n" +">>> v\n" +"([1, 2, 3], [3, 2, 1])" +msgstr "" +">>> t = 12345, 54321, 'hello!'\n" +">>> t[0]\n" +"12345\n" +">>> t\n" +"(12345, 54321, 'hello!')\n" +">>> # Tuples may be nested:\n" +">>> u = t, (1, 2, 3, 4, 5)\n" +">>> u\n" +"((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))\n" +">>> # Tuples are immutable:\n" +">>> t[0] = 88888\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: 'tuple' object does not support item assignment\n" +">>> # but they can contain mutable objects:\n" +">>> v = ([1, 2, 3], [3, 2, 1])\n" +">>> v\n" +"([1, 2, 3], [3, 2, 1])" + +#: tutorial/datastructures.rst:399 msgid "" "As you see, on output tuples are always enclosed in parentheses, so that " "nested tuples are interpreted correctly; they may be input with or without " @@ -433,7 +793,7 @@ msgstr "" "στοιχεία μιας πλειάδας, ωστόσο είναι δυνατό να δημιουργηθούν πλειάδες " "(tuples) που περιέχουν μεταβλητά αντικείμενα, όπως λίστες." -#: tutorial/datastructures.rst:407 +#: tutorial/datastructures.rst:406 msgid "" "Though tuples may seem similar to lists, they are often used in different " "situations and for different purposes. Tuples are :term:`immutable`, and " @@ -452,7 +812,7 @@ msgstr "" "namedtuple>`). Οι λίστες είναι :term:`mutable`, και τα στοιχεία τους είναι " "συνήθως ομοιογενή και προσπελάζονται με επανάληψη στη λίστα." -#: tutorial/datastructures.rst:415 +#: tutorial/datastructures.rst:414 msgid "" "A special problem is the construction of tuples containing 0 or 1 items: the " "syntax has some extra quirks to accommodate these. Empty tuples are " @@ -467,7 +827,27 @@ msgstr "" "μια τιμή με κόμμα (δεν αρκεί να περικλείεται μια μόνο τιμή σε παρενθέσεις). " "Άσχημο, αλλά αποτελεσματικό. Για παράδειγμα::" -#: tutorial/datastructures.rst:430 +#: tutorial/datastructures.rst:420 +msgid "" +">>> empty = ()\n" +">>> singleton = 'hello', # <-- note trailing comma\n" +">>> len(empty)\n" +"0\n" +">>> len(singleton)\n" +"1\n" +">>> singleton\n" +"('hello',)" +msgstr "" +">>> empty = ()\n" +">>> singleton = 'hello', # <-- note trailing comma\n" +">>> len(empty)\n" +"0\n" +">>> len(singleton)\n" +"1\n" +">>> singleton\n" +"('hello',)" + +#: tutorial/datastructures.rst:429 msgid "" "The statement ``t = 12345, 54321, 'hello!'`` is an example of *tuple " "packing*: the values ``12345``, ``54321`` and ``'hello!'`` are packed " @@ -477,7 +857,11 @@ msgstr "" "packing*: οι τιμές ``12345``, ``54321`` και ``'hello!'`` είναι συσκευασμένες " "μαζί σε μια πλειάδα (tuple). Η αντίστροφη λειτουργία είναι επίσης εφικτή::" -#: tutorial/datastructures.rst:436 +#: tutorial/datastructures.rst:433 +msgid ">>> x, y, z = t" +msgstr ">>> x, y, z = t" + +#: tutorial/datastructures.rst:435 msgid "" "This is called, appropriately enough, *sequence unpacking* and works for any " "sequence on the right-hand side. Sequence unpacking requires that there are " @@ -492,23 +876,23 @@ msgstr "" "στην πραγματικότητα απλώς ένας συνδυασμός tuple packing και sequence " "unpacking." -#: tutorial/datastructures.rst:446 +#: tutorial/datastructures.rst:445 msgid "Sets" msgstr "Σύνολα (Sets)" -#: tutorial/datastructures.rst:448 +#: tutorial/datastructures.rst:447 msgid "" -"Python also includes a data type for *sets*. A set is an unordered " -"collection with no duplicate elements. Basic uses include membership " -"testing and eliminating duplicate entries. Set objects also support " -"mathematical operations like union, intersection, difference, and symmetric " -"difference." -msgstr "" -"Η Python περιλαμβάνει επίσης έναν τύπο δεδομένων για *sets*. Ένα set είναι " -"μια μη ταξινομημένη συλλογή χωρίς διπλότυπα στοιχεία. Οι βασικές χρήσεις " -"περιλαμβάνουν τη δοκιμή ιδιότητας μέλους και την εξάλειψη διπλότυπων " -"εγγραφών. Τα αντικείμενα συνόλου υποστηρίζουν επίσης μαθηματικές πράξεις " -"όπως ένωση, τομή, διαφορά και συμμετρική διαφορά." +"Python also includes a data type for :ref:`sets `. A set is an " +"unordered collection with no duplicate elements. Basic uses include " +"membership testing and eliminating duplicate entries. Set objects also " +"support mathematical operations like union, intersection, difference, and " +"symmetric difference." +msgstr "" +"Η Python περιλαμβάνει επίσης έναν τύπο δεδομένων για :ref:`sets `. Ένα set είναι μια μη ταξινομημένη συλλογή χωρίς διπλότυπα στοιχεία. " +"Οι βασικές χρήσεις περιλαμβάνουν τη δοκιμή ιδιότητας μέλους και την εξάλειψη " +"διπλότυπων εγγραφών. Τα αντικείμενα συνόλου υποστηρίζουν επίσης μαθηματικές " +"πράξεις όπως ένωση, τομή, διαφορά και συμμετρική διαφορά." #: tutorial/datastructures.rst:453 msgid "" @@ -526,6 +910,56 @@ msgstr "" msgid "Here is a brief demonstration::" msgstr "Ακολουθεί μια σύντομη επίδειξη::" +#: tutorial/datastructures.rst:459 +msgid "" +">>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}\n" +">>> print(basket) # show that duplicates have been " +"removed\n" +"{'orange', 'banana', 'pear', 'apple'}\n" +">>> 'orange' in basket # fast membership testing\n" +"True\n" +">>> 'crabgrass' in basket\n" +"False\n" +"\n" +">>> # Demonstrate set operations on unique letters from two words\n" +">>>\n" +">>> a = set('abracadabra')\n" +">>> b = set('alacazam')\n" +">>> a # unique letters in a\n" +"{'a', 'r', 'b', 'c', 'd'}\n" +">>> a - b # letters in a but not in b\n" +"{'r', 'd', 'b'}\n" +">>> a | b # letters in a or b or both\n" +"{'a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'}\n" +">>> a & b # letters in both a and b\n" +"{'a', 'c'}\n" +">>> a ^ b # letters in a or b but not both\n" +"{'r', 'd', 'b', 'm', 'z', 'l'}" +msgstr "" +">>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}\n" +">>> print(basket) # show that duplicates have been " +"removed\n" +"{'orange', 'banana', 'pear', 'apple'}\n" +">>> 'orange' in basket # fast membership testing\n" +"True\n" +">>> 'crabgrass' in basket\n" +"False\n" +"\n" +">>> # Demonstrate set operations on unique letters from two words\n" +">>>\n" +">>> a = set('abracadabra')\n" +">>> b = set('alacazam')\n" +">>> a # unique letters in a\n" +"{'a', 'r', 'b', 'c', 'd'}\n" +">>> a - b # letters in a but not in b\n" +"{'r', 'd', 'b'}\n" +">>> a | b # letters in a or b or both\n" +"{'a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'}\n" +">>> a & b # letters in both a and b\n" +"{'a', 'c'}\n" +">>> a ^ b # letters in a or b but not both\n" +"{'r', 'd', 'b', 'm', 'z', 'l'}" + #: tutorial/datastructures.rst:482 msgid "" "Similarly to :ref:`list comprehensions `, set comprehensions " @@ -534,6 +968,16 @@ msgstr "" "Ομοίως με :ref:`list comprehensions `, υποστηρίζονται επίσης " "τα comprehensions των συνόλων::" +#: tutorial/datastructures.rst:485 +msgid "" +">>> a = {x for x in 'abracadabra' if x not in 'abc'}\n" +">>> a\n" +"{'r', 'd'}" +msgstr "" +">>> a = {x for x in 'abracadabra' if x not in 'abc'}\n" +">>> a\n" +"{'r', 'd'}" + #: tutorial/datastructures.rst:493 msgid "Dictionaries" msgstr "Λεξικά (Dictionaries)" @@ -584,17 +1028,30 @@ msgid "" "The main operations on a dictionary are storing a value with some key and " "extracting the value given the key. It is also possible to delete a key:" "value pair with ``del``. If you store using a key that is already in use, " -"the old value associated with that key is forgotten. It is an error to " -"extract a value using a non-existent key." +"the old value associated with that key is forgotten." msgstr "" "Οι κύριες λειτουργίες σε ένα λεξικό είναι η αποθήκευση μιας τιμής με κάποιο " "κλειδί και η εξαγωγή της τιμής που δίνεται στο κλειδί. Είναι επίσης δυνατή " "η διαγραφή ενός ζεύγους key:value με ``del``. Εάν αποθηκεύετε " "χρησιμοποιώντας ένα κλειδί που βρίσκεται ήδη σε χρήση, η παλιά τιμή που " -"σχετίζεται με αυτό το κλειδί έχει ξεχαστεί. Είναι σφάλμα να εξαγάγετε μια " -"τιμή χρησιμοποιώντας ένα ανύπαρκτο κλειδί." +"σχετίζεται με αυτό το κλειδί έχει ξεχαστεί." -#: tutorial/datastructures.rst:518 +#: tutorial/datastructures.rst:517 +msgid "" +"Extracting a value for a non-existent key by subscripting (``d[key]``) " +"raises a :exc:`KeyError`. To avoid getting this error when trying to access " +"a possibly non-existent key, use the :meth:`~dict.get` method instead, which " +"returns ``None`` (or a specified default value) if the key is not in the " +"dictionary." +msgstr "" +"Η εξαγωγή μιας τιμής για ένα μη υπάρχον κλειδί με δεικτοδότηση (``d[key]``) " +"προκαλεί ένα :exc:`KeyError`. Για να αποφύγετε αυτό το σφάλμα όταν " +"προσπαθείτε να αποκτήσετε πρόσβαση σε ένα πιθανώς μη υπάρχον κλειδί, " +"χρησιμοποιήστε αντίθετα τη μέθοδο :meth:`~dict.get`, η οποία επιστρέφει " +"``None`` (ή μια καθορισμένη προεπιλεγμένη τιμή) εάν το κλειδί δεν βρίσκεται " +"στο λεξικό." + +#: tutorial/datastructures.rst:522 msgid "" "Performing ``list(d)`` on a dictionary returns a list of all the keys used " "in the dictionary, in insertion order (if you want it sorted, just use " @@ -607,11 +1064,63 @@ msgstr "" "υπάρχει ένα μεμονωμένο κλειδί στο λεξικό, χρησιμοποιήστε τη λέξη-κλειδί :" "keyword:`in`." -#: tutorial/datastructures.rst:523 +#: tutorial/datastructures.rst:527 msgid "Here is a small example using a dictionary::" msgstr "Ακολουθεί ένα μικρό παράδειγμα χρησιμοποιώντας ένα λεξικό::" -#: tutorial/datastructures.rst:544 +#: tutorial/datastructures.rst:529 +msgid "" +">>> tel = {'jack': 4098, 'sape': 4139}\n" +">>> tel['guido'] = 4127\n" +">>> tel\n" +"{'jack': 4098, 'sape': 4139, 'guido': 4127}\n" +">>> tel['jack']\n" +"4098\n" +">>> tel['irv']\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"KeyError: 'irv'\n" +">>> print(tel.get('irv'))\n" +"None\n" +">>> del tel['sape']\n" +">>> tel['irv'] = 4127\n" +">>> tel\n" +"{'jack': 4098, 'guido': 4127, 'irv': 4127}\n" +">>> list(tel)\n" +"['jack', 'guido', 'irv']\n" +">>> sorted(tel)\n" +"['guido', 'irv', 'jack']\n" +">>> 'guido' in tel\n" +"True\n" +">>> 'jack' not in tel\n" +"False" +msgstr "" +">>> tel = {'jack': 4098, 'sape': 4139}\n" +">>> tel['guido'] = 4127\n" +">>> tel\n" +"{'jack': 4098, 'sape': 4139, 'guido': 4127}\n" +">>> tel['jack']\n" +"4098\n" +">>> tel['irv']\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"KeyError: 'irv'\n" +">>> print(tel.get('irv'))\n" +"None\n" +">>> del tel['sape']\n" +">>> tel['irv'] = 4127\n" +">>> tel\n" +"{'jack': 4098, 'guido': 4127, 'irv': 4127}\n" +">>> list(tel)\n" +"['jack', 'guido', 'irv']\n" +">>> sorted(tel)\n" +"['guido', 'irv', 'jack']\n" +">>> 'guido' in tel\n" +"True\n" +">>> 'jack' not in tel\n" +"False" + +#: tutorial/datastructures.rst:554 msgid "" "The :func:`dict` constructor builds dictionaries directly from sequences of " "key-value pairs::" @@ -619,7 +1128,15 @@ msgstr "" "Ο constructor :func:`dict` δημιουργεί λεξικά απευθείας από ακολουθίες ζευγών " "key-value::" -#: tutorial/datastructures.rst:550 +#: tutorial/datastructures.rst:557 +msgid "" +">>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])\n" +"{'sape': 4139, 'guido': 4127, 'jack': 4098}" +msgstr "" +">>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])\n" +"{'sape': 4139, 'guido': 4127, 'jack': 4098}" + +#: tutorial/datastructures.rst:560 msgid "" "In addition, dict comprehensions can be used to create dictionaries from " "arbitrary key and value expressions::" @@ -627,7 +1144,15 @@ msgstr "" "Επιπλέον, τα comprehensions λεξικών μπορούν να χρησιμοποιηθούν για τη " "δημιουργία λεξικών από αυθαίρετες εκφράσεις κλειδιού και τιμών::" -#: tutorial/datastructures.rst:556 +#: tutorial/datastructures.rst:563 +msgid "" +">>> {x: x**2 for x in (2, 4, 6)}\n" +"{2: 4, 4: 16, 6: 36}" +msgstr "" +">>> {x: x**2 for x in (2, 4, 6)}\n" +"{2: 4, 4: 16, 6: 36}" + +#: tutorial/datastructures.rst:566 msgid "" "When the keys are simple strings, it is sometimes easier to specify pairs " "using keyword arguments::" @@ -635,11 +1160,19 @@ msgstr "" "Όταν τα κλειδιά είναι απλές συμβολοσειρές, μερικές φορές είναι πιο εύκολο να " "ορίσετε ζεύγη χρησιμοποιώντας ορίσματα λέξεων-κλειδιών::" -#: tutorial/datastructures.rst:566 +#: tutorial/datastructures.rst:569 +msgid "" +">>> dict(sape=4139, guido=4127, jack=4098)\n" +"{'sape': 4139, 'guido': 4127, 'jack': 4098}" +msgstr "" +">>> dict(sape=4139, guido=4127, jack=4098)\n" +"{'sape': 4139, 'guido': 4127, 'jack': 4098}" + +#: tutorial/datastructures.rst:576 msgid "Looping Techniques" msgstr "Τεχνικές Looping" -#: tutorial/datastructures.rst:568 +#: tutorial/datastructures.rst:578 msgid "" "When looping through dictionaries, the key and corresponding value can be " "retrieved at the same time using the :meth:`~dict.items` method. ::" @@ -647,7 +1180,23 @@ msgstr "" "Κατά το looping μέσω λεξικών, το κλειδί και η αντίστοιχη τιμή μπορούν να " "ανακτηθούν ταυτόχρονα χρησιμοποιώντας τη μέθοδο :meth:`~dict.items`. ::" -#: tutorial/datastructures.rst:578 +#: tutorial/datastructures.rst:581 +msgid "" +">>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}\n" +">>> for k, v in knights.items():\n" +"... print(k, v)\n" +"...\n" +"gallahad the pure\n" +"robin the brave" +msgstr "" +">>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}\n" +">>> for k, v in knights.items():\n" +"... print(k, v)\n" +"...\n" +"gallahad the pure\n" +"robin the brave" + +#: tutorial/datastructures.rst:588 msgid "" "When looping through a sequence, the position index and corresponding value " "can be retrieved at the same time using the :func:`enumerate` function. ::" @@ -656,7 +1205,23 @@ msgstr "" "μπορούν να ανακτηθούν ταυτόχρονα χρησιμοποιώντας τη συνάρτηση :func:" "`enumerate`. ::" -#: tutorial/datastructures.rst:588 +#: tutorial/datastructures.rst:591 +msgid "" +">>> for i, v in enumerate(['tic', 'tac', 'toe']):\n" +"... print(i, v)\n" +"...\n" +"0 tic\n" +"1 tac\n" +"2 toe" +msgstr "" +">>> for i, v in enumerate(['tic', 'tac', 'toe']):\n" +"... print(i, v)\n" +"...\n" +"0 tic\n" +"1 tac\n" +"2 toe" + +#: tutorial/datastructures.rst:598 msgid "" "To loop over two or more sequences at the same time, the entries can be " "paired with the :func:`zip` function. ::" @@ -664,7 +1229,27 @@ msgstr "" "Για να κάνετε loop σε δύο ή περισσότερες ακολουθίες ταυτόχρονα, οι " "καταχωρίσεις μπορούν να αντιστοιχιστούν με τη συνάρτηση :func:`zip`. ::" -#: tutorial/datastructures.rst:600 +#: tutorial/datastructures.rst:601 +msgid "" +">>> questions = ['name', 'quest', 'favorite color']\n" +">>> answers = ['lancelot', 'the holy grail', 'blue']\n" +">>> for q, a in zip(questions, answers):\n" +"... print('What is your {0}? It is {1}.'.format(q, a))\n" +"...\n" +"What is your name? It is lancelot.\n" +"What is your quest? It is the holy grail.\n" +"What is your favorite color? It is blue." +msgstr "" +">>> questions = ['name', 'quest', 'favorite color']\n" +">>> answers = ['lancelot', 'the holy grail', 'blue']\n" +">>> for q, a in zip(questions, answers):\n" +"... print('What is your {0}? It is {1}.'.format(q, a))\n" +"...\n" +"What is your name? It is lancelot.\n" +"What is your quest? It is the holy grail.\n" +"What is your favorite color? It is blue." + +#: tutorial/datastructures.rst:610 msgid "" "To loop over a sequence in reverse, first specify the sequence in a forward " "direction and then call the :func:`reversed` function. ::" @@ -672,7 +1257,27 @@ msgstr "" "Για να κάνετε loop σε μια ακολουθία αντίστροφα, καθορίστε πρώτα την " "ακολουθία προς τα εμπρός και μετά καλέστε τη συνάρτηση :func:`reversed`. ::" -#: tutorial/datastructures.rst:612 +#: tutorial/datastructures.rst:613 +msgid "" +">>> for i in reversed(range(1, 10, 2)):\n" +"... print(i)\n" +"...\n" +"9\n" +"7\n" +"5\n" +"3\n" +"1" +msgstr "" +">>> for i in reversed(range(1, 10, 2)):\n" +"... print(i)\n" +"...\n" +"9\n" +"7\n" +"5\n" +"3\n" +"1" + +#: tutorial/datastructures.rst:622 msgid "" "To loop over a sequence in sorted order, use the :func:`sorted` function " "which returns a new sorted list while leaving the source unaltered. ::" @@ -681,7 +1286,31 @@ msgstr "" "συνάρτηση :func:`sorted`, η οποία επιστρέφει μια νέα ταξινομημένη λίστα " "αφήνοντας την πηγή αναλλοίωτη. ::" -#: tutorial/datastructures.rst:626 +#: tutorial/datastructures.rst:625 +msgid "" +">>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']\n" +">>> for i in sorted(basket):\n" +"... print(i)\n" +"...\n" +"apple\n" +"apple\n" +"banana\n" +"orange\n" +"orange\n" +"pear" +msgstr "" +">>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']\n" +">>> for i in sorted(basket):\n" +"... print(i)\n" +"...\n" +"apple\n" +"apple\n" +"banana\n" +"orange\n" +"orange\n" +"pear" + +#: tutorial/datastructures.rst:636 msgid "" "Using :func:`set` on a sequence eliminates duplicate elements. The use of :" "func:`sorted` in combination with :func:`set` over a sequence is an " @@ -693,7 +1322,27 @@ msgstr "" "είναι ένας ιδιωματικός τρόπος για να κάνετε loop πάνω από μοναδικά στοιχεία " "της ακολουθίας σε ταξινομημένη σειρά. ::" -#: tutorial/datastructures.rst:639 +#: tutorial/datastructures.rst:640 +msgid "" +">>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']\n" +">>> for f in sorted(set(basket)):\n" +"... print(f)\n" +"...\n" +"apple\n" +"banana\n" +"orange\n" +"pear" +msgstr "" +">>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']\n" +">>> for f in sorted(set(basket)):\n" +"... print(f)\n" +"...\n" +"apple\n" +"banana\n" +"orange\n" +"pear" + +#: tutorial/datastructures.rst:649 msgid "" "It is sometimes tempting to change a list while you are looping over it; " "however, it is often simpler and safer to create a new list instead. ::" @@ -701,11 +1350,33 @@ msgstr "" "Μερικές φορές είναι δελεαστικό να αλλάζετε μια λίστα ενώ την περιηγείστε∙ " "ωστόσο, είναι συχνά πιο απλό και ασφαλές να δημιουργήσετε μια νέα λίστα. ::" -#: tutorial/datastructures.rst:656 +#: tutorial/datastructures.rst:652 +msgid "" +">>> import math\n" +">>> raw_data = [56.2, float('NaN'), 51.7, 55.3, 52.5, float('NaN'), 47.8]\n" +">>> filtered_data = []\n" +">>> for value in raw_data:\n" +"... if not math.isnan(value):\n" +"... filtered_data.append(value)\n" +"...\n" +">>> filtered_data\n" +"[56.2, 51.7, 55.3, 52.5, 47.8]" +msgstr "" +">>> import math\n" +">>> raw_data = [56.2, float('NaN'), 51.7, 55.3, 52.5, float('NaN'), 47.8]\n" +">>> filtered_data = []\n" +">>> for value in raw_data:\n" +"... if not math.isnan(value):\n" +"... filtered_data.append(value)\n" +"...\n" +">>> filtered_data\n" +"[56.2, 51.7, 55.3, 52.5, 47.8]" + +#: tutorial/datastructures.rst:666 msgid "More on Conditions" msgstr "Περισσότερα για τις συνθήκες" -#: tutorial/datastructures.rst:658 +#: tutorial/datastructures.rst:668 msgid "" "The conditions used in ``while`` and ``if`` statements can contain any " "operators, not just comparisons." @@ -713,7 +1384,7 @@ msgstr "" "Οι συνθήκες που χρησιμοποιούνται στις δηλώσεις ``while`` και ``if`` μπορούν " "να περιέχουν οποιουσδήποτε τελεστές, όχι μόνο συγκρίσεις." -#: tutorial/datastructures.rst:662 +#: tutorial/datastructures.rst:672 msgid "" "The comparison operators ``in`` and ``not in`` are membership tests that " "determine whether a value is in (or not in) a container. The operators " @@ -727,7 +1398,7 @@ msgstr "" "ίδιο αντικείμενο. Όλοι οι τελεστές σύγκρισης έχουν την ίδια προτεραιότητα, " "η οποία είναι χαμηλότερη από αυτή όλων των αριθμητικών τελεστών." -#: tutorial/datastructures.rst:668 +#: tutorial/datastructures.rst:678 msgid "" "Comparisons can be chained. For example, ``a < b == c`` tests whether ``a`` " "is less than ``b`` and moreover ``b`` equals ``c``." @@ -736,7 +1407,7 @@ msgstr "" "ελέγχει εάν το ``a`` είναι μικρότερο από ``b`` και επιπλέον το ``b`` ισούται " "με ``c``." -#: tutorial/datastructures.rst:671 +#: tutorial/datastructures.rst:681 msgid "" "Comparisons may be combined using the Boolean operators ``and`` and ``or``, " "and the outcome of a comparison (or of any other Boolean expression) may be " @@ -753,7 +1424,7 @@ msgstr "" "ισοδυναμεί με ``(A and (not B)) or C``. Όπως πάντα, οι παρενθέσεις μπορούν " "να χρησιμοποιηθούν για να εκφράσουν την επιθυμητή σύνθεση." -#: tutorial/datastructures.rst:678 +#: tutorial/datastructures.rst:688 msgid "" "The Boolean operators ``and`` and ``or`` are so-called *short-circuit* " "operators: their arguments are evaluated from left to right, and evaluation " @@ -770,7 +1441,7 @@ msgstr "" "και όχι ως λογική, η τιμή επιστροφής ενός short-circuit τελεστή είναι το " "τελευταίο αξιολογημένο όρισμα." -#: tutorial/datastructures.rst:685 +#: tutorial/datastructures.rst:695 msgid "" "It is possible to assign the result of a comparison or other Boolean " "expression to a variable. For example, ::" @@ -778,7 +1449,19 @@ msgstr "" "Είναι δυνατό να αντιστοιχίσετε το αποτέλεσμα μιας σύγκρισης ή άλλη δυαδική " "έκφρασης σε μια μεταβλητή. Για παράδειγμα, ::" -#: tutorial/datastructures.rst:693 +#: tutorial/datastructures.rst:698 +msgid "" +">>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance'\n" +">>> non_null = string1 or string2 or string3\n" +">>> non_null\n" +"'Trondheim'" +msgstr "" +">>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance'\n" +">>> non_null = string1 or string2 or string3\n" +">>> non_null\n" +"'Trondheim'" + +#: tutorial/datastructures.rst:703 msgid "" "Note that in Python, unlike C, assignment inside expressions must be done " "explicitly with the :ref:`walrus operator `` is legal " "provided that the objects have appropriate comparison methods. For example, " @@ -839,11 +1540,11 @@ msgstr "" "αντί να παρέχει μια αυθαίρετη παραγγελία, ο διερμηνέας θα κάνει raise μια " "εξαίρεση :exc:`TypeError`." -#: tutorial/datastructures.rst:732 +#: tutorial/datastructures.rst:742 msgid "Footnotes" msgstr "Υποσημειώσεις" -#: tutorial/datastructures.rst:733 +#: tutorial/datastructures.rst:743 msgid "" "Other languages may return the mutated object, which allows method chaining, " "such as ``d->insert(\"a\")->remove(\"b\")->sort();``." diff --git a/tutorial/errors.po b/tutorial/errors.po index 2e91659c..44afb173 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -8,10 +8,9 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-09-20 11:30+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-04 22:12+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" "Language-Team: LANGUAGE \n" "Language: el\n" "MIME-Version: 1.0\n" @@ -47,28 +46,47 @@ msgstr "" "συνηθισμένο είδος παραπόνου που λαμβάνετε ενώ εξακολουθείτε να μαθαίνετε " "Python::" +#: tutorial/errors.rst:20 +msgid "" +">>> while True print('Hello world')\n" +" File \"\", line 1\n" +" while True print('Hello world')\n" +" ^^^^^\n" +"SyntaxError: invalid syntax" +msgstr "" +">>> while True print('Hello world')\n" +" File \"\", line 1\n" +" while True print('Hello world')\n" +" ^^^^^\n" +"SyntaxError: invalid syntax" + #: tutorial/errors.rst:26 msgid "" -"The parser repeats the offending line and displays little 'arrow's pointing " -"at the token in the line where the error was detected. The error may be " -"caused by the absence of a token *before* the indicated token. In the " -"example, the error is detected at the function :func:`print`, since a colon " -"(``':'``) is missing before it. File name and line number are printed so " -"you know where to look in case the input came from a script." -msgstr "" -"Ο αναλυτής επαναλαμβάνει την παραβατική γραμμή και εμφανίζει ένα μικρό " -"'βέλος' που δείχνει το διακριτικό στη γραμμή που εντοπίστηκε το σφάλμα. Το " -"σφάλμα μπορεί να προκληθεί από την απουσία διακριτικού *πριν* από το " -"υποδεικνυόμενο διακριτικό. Στο παράδειγμα, το σφάλμα ανιχνεύεται στην " -"συνάρτηση :func:`print`, καθώς λείπει μια άνω κάτω τελεία (``':'``) πριν από " -"αυτήν. Το όνομα του αρχείου και ο αριθμός γραμμής εκτυπώνονται, ώστε να " -"γνωρίζετε πού να ψάξετε σε περίπτωση που η είσοδος προήλθε από ένα script." - -#: tutorial/errors.rst:37 +"The parser repeats the offending line and displays little arrows pointing at " +"the place where the error was detected. Note that this is not always the " +"place that needs to be fixed. In the example, the error is detected at the " +"function :func:`print`, since a colon (``':'``) is missing just before it." +msgstr "" +"Ο αναλυτής επαναλαμβάνει την παραβατική γραμμή και εμφανίζει μικρά βέλη που " +"δείχνουν προς το μέρος όπου που εντοπίστηκε το σφάλμα. Σημειώστε ότι αυτό " +"δεν είναι πάντα το μέρος που πρέπει να διορθωθεί. Στο παράδειγμα, το σφάλμα " +"εντοπίζεται στη συνάρτηση :func:`print`, καθώς λείπει μια άνω και κάτω " +"τελεία (``':'``) ακριβώς πριν από αυτήν." + +#: tutorial/errors.rst:31 +msgid "" +"The file name (```` in our example) and line number are printed so " +"you know where to look in case the input came from a file." +msgstr "" +"Το όνομα αρχείου (```` στο παράδειγμά μας) και ο αριθμός γραμμής " +"εκτυπώνονται, ώστε να να γνωρίζετε πού να ψάξετε σε περίπτωση που η είσοδος " +"προήλθε από αρχείο." + +#: tutorial/errors.rst:38 msgid "Exceptions" msgstr "Exceptions (Εξαιρέσεις)" -#: tutorial/errors.rst:39 +#: tutorial/errors.rst:40 msgid "" "Even if a statement or expression is syntactically correct, it may cause an " "error when an attempt is made to execute it. Errors detected during " @@ -84,7 +102,47 @@ msgstr "" "Python. Ωστόσο, οι περισσότερες εξαιρέσεις δεν αντιμετωπίζονται από " "προγράμματα και οδηγούν σε μηνύματα σφάλματος όπως φαίνεται εδώ::" -#: tutorial/errors.rst:58 +#: tutorial/errors.rst:46 +msgid "" +">>> 10 * (1/0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" 10 * (1/0)\n" +" ~^~\n" +"ZeroDivisionError: division by zero\n" +">>> 4 + spam*3\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" 4 + spam*3\n" +" ^^^^\n" +"NameError: name 'spam' is not defined\n" +">>> '2' + 2\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" '2' + 2\n" +" ~~~~^~~\n" +"TypeError: can only concatenate str (not \"int\") to str" +msgstr "" +">>> 10 * (1/0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" 10 * (1/0)\n" +" ~^~\n" +"ZeroDivisionError: division by zero\n" +">>> 4 + spam*3\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" 4 + spam*3\n" +" ^^^^\n" +"NameError: name 'spam' is not defined\n" +">>> '2' + 2\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" '2' + 2\n" +" ~~~~^~~\n" +"TypeError: can only concatenate str (not \"int\") to str" + +#: tutorial/errors.rst:65 msgid "" "The last line of the error message indicates what happened. Exceptions come " "in different types, and the type is printed as part of the message: the " @@ -105,7 +163,7 @@ msgstr "" "σύμβαση). Οι standard εξαιρέσεις είναι ενσωματωμένα (built-in) αναγνωριστικά " "(όχι δεσμευμένες λέξεις-κλειδιά)." -#: tutorial/errors.rst:66 +#: tutorial/errors.rst:73 msgid "" "The rest of the line provides detail based on the type of exception and what " "caused it." @@ -113,7 +171,7 @@ msgstr "" "Η υπόλοιπη γραμμή παρέχει λεπτομέρειες με βάση τον τύπο της εξαίρεσης και το " "τι την προκάλεσε." -#: tutorial/errors.rst:69 +#: tutorial/errors.rst:76 msgid "" "The preceding part of the error message shows the context where the " "exception occurred, in the form of a stack traceback. In general it contains " @@ -125,18 +183,18 @@ msgstr "" "στοίβα ανίχνευσης γραμμών πηγής∙ ωστόσο, δεν θα εμφανίζει γραμμές που " "διαβάζονται από standard είσοδο." -#: tutorial/errors.rst:74 +#: tutorial/errors.rst:81 msgid "" ":ref:`bltin-exceptions` lists the built-in exceptions and their meanings." msgstr "" "Το :ref:`bltin-exceptions` παραθέτει τις ενσωματωμένες εξαιρέσεις και τις " "έννοιές τους." -#: tutorial/errors.rst:80 +#: tutorial/errors.rst:87 msgid "Handling Exceptions" msgstr "Διαχείριση Εξαιρέσεων" -#: tutorial/errors.rst:82 +#: tutorial/errors.rst:89 msgid "" "It is possible to write programs that handle selected exceptions. Look at " "the following example, which asks the user for input until a valid integer " @@ -153,11 +211,29 @@ msgstr "" "χρήστη σηματοδοτείται κάνοντας raise την εξαίρεση :exc:" "`KeyboardInterrupt`. ::" -#: tutorial/errors.rst:96 +#: tutorial/errors.rst:95 +msgid "" +">>> while True:\n" +"... try:\n" +"... x = int(input(\"Please enter a number: \"))\n" +"... break\n" +"... except ValueError:\n" +"... print(\"Oops! That was no valid number. Try again...\")\n" +"..." +msgstr "" +">>> while True:\n" +"... try:\n" +"... x = int(input(\"Please enter a number: \"))\n" +"... break\n" +"... except ValueError:\n" +"... print(\"Oops! That was no valid number. Try again...\")\n" +"..." + +#: tutorial/errors.rst:103 msgid "The :keyword:`try` statement works as follows." msgstr "Η δήλωση :keyword:`try` λειτουργεί ως εξής." -#: tutorial/errors.rst:98 +#: tutorial/errors.rst:105 msgid "" "First, the *try clause* (the statement(s) between the :keyword:`try` and :" "keyword:`except` keywords) is executed." @@ -165,7 +241,7 @@ msgstr "" "Πρώτον, εκτελείται η *try clause* (η πρόταση(εις) μεταξύ των λέξεων-" "κλειδιών :keyword:`try` and :keyword:`except`)." -#: tutorial/errors.rst:101 +#: tutorial/errors.rst:108 msgid "" "If no exception occurs, the *except clause* is skipped and execution of the :" "keyword:`try` statement is finished." @@ -173,7 +249,7 @@ msgstr "" "Εάν δεν προκύψει εξαίρεση, η *except clause* παραλείπεται και η εκτέλεση της " "πρότασης :keyword:`try` ολοκληρώνεται." -#: tutorial/errors.rst:104 +#: tutorial/errors.rst:111 msgid "" "If an exception occurs during execution of the :keyword:`try` clause, the " "rest of the clause is skipped. Then, if its type matches the exception " @@ -186,7 +262,7 @@ msgstr "" "clause* εκτελείται, και στη συνέχεια η εκτέλεση συνεχίζεται μετά το μπλοκ " "try/except." -#: tutorial/errors.rst:109 +#: tutorial/errors.rst:116 msgid "" "If an exception occurs which does not match the exception named in the " "*except clause*, it is passed on to outer :keyword:`try` statements; if no " @@ -198,7 +274,7 @@ msgstr "" "εάν δεν βρεθεί κανένας χειριστής, είναι μια *unhandled exception* και η " "εκτέλεση σταματά με μήνυμα σφάλματος." -#: tutorial/errors.rst:113 +#: tutorial/errors.rst:120 msgid "" "A :keyword:`try` statement may have more than one *except clause*, to " "specify handlers for different exceptions. At most one handler will be " @@ -214,20 +290,69 @@ msgstr "" "πρότασης :keyword:`!try`. Μια *except clause* μπορεί να ονομάσει πολλαπλές " "εξαιρέσεις ως πλειάδα (tuple) σε παρένθεση, για παράδειγμα::" -#: tutorial/errors.rst:122 +#: tutorial/errors.rst:126 +msgid "" +"... except (RuntimeError, TypeError, NameError):\n" +"... pass" +msgstr "" +"... except (RuntimeError, TypeError, NameError):\n" +"... pass" + +#: tutorial/errors.rst:129 msgid "" -"A class in an :keyword:`except` clause is compatible with an exception if it " -"is the same class or a base class thereof (but not the other way around --- " -"an *except clause* listing a derived class is not compatible with a base " -"class). For example, the following code will print B, C, D in that order::" +"A class in an :keyword:`except` clause matches exceptions which are " +"instances of the class itself or one of its derived classes (but not the " +"other way around --- an *except clause* listing a derived class does not " +"match instances of its base classes). For example, the following code will " +"print B, C, D in that order::" msgstr "" -"Μια κλάση σε μια πρόταση :keyword:`except` είναι συμβατή με μια εξαίρεση εάν " -"είναι ίδια κλάση ή μια βασική κλάση αυτής (αλλά όχι το αντίστροφο -- μια " -"*except clause* που παραθέτει μια παραγόμενη κλάση δεν είναι συμβατή με μια " -"βασική κλάση). Για παράδειγμα, ο ακόλουθος κώδικας θα εκτυπώσει τα B, C, D " -"με αυτή τη σειρά::" +"Μια κλάση σε μια πρόταση :keyword:`except` ταιριάζει με εξαιρέσεις που είναι " +"στιγμιότυπα της ίδιας της κλάσης ή μιας από τις παραγόμενες κλάσεις της " +"(αλλά όχι το αντίστροφο --- μια *except clause* που παραθέτει μια παράγωγη " +"κλάση δεν ταιριάζει με τις παρουσίες των βασικών της κλάσεων). Για " +"παράδειγμα, ο ακόλουθος κώδικας θα εκτυπώσει τα B, C, D με αυτή τη σειρά::" -#: tutorial/errors.rst:146 +#: tutorial/errors.rst:134 +msgid "" +"class B(Exception):\n" +" pass\n" +"\n" +"class C(B):\n" +" pass\n" +"\n" +"class D(C):\n" +" pass\n" +"\n" +"for cls in [B, C, D]:\n" +" try:\n" +" raise cls()\n" +" except D:\n" +" print(\"D\")\n" +" except C:\n" +" print(\"C\")\n" +" except B:\n" +" print(\"B\")" +msgstr "" +"class B(Exception):\n" +" pass\n" +"\n" +"class C(B):\n" +" pass\n" +"\n" +"class D(C):\n" +" pass\n" +"\n" +"for cls in [B, C, D]:\n" +" try:\n" +" raise cls()\n" +" except D:\n" +" print(\"D\")\n" +" except C:\n" +" print(\"C\")\n" +" except B:\n" +" print(\"B\")" + +#: tutorial/errors.rst:153 msgid "" "Note that if the *except clauses* were reversed (with ``except B`` first), " "it would have printed B, B, B --- the first matching *except clause* is " @@ -237,7 +362,7 @@ msgstr "" "πρώτα), θα είχε εκτυπωθεί B, B, B --- ενεργοποιείται η πρώτη αντιστοίχιση " "*except clause*." -#: tutorial/errors.rst:149 +#: tutorial/errors.rst:156 msgid "" "When an exception occurs, it may have associated values, also known as the " "exception's *arguments*. The presence and types of the arguments depend on " @@ -247,7 +372,7 @@ msgstr "" "ως *ορίσματα* της εξαίρεσης. Η παρουσία και οι τύποι των ορισμάτων " "εξαρτώνται από τον τύπο εξαίρεσης." -#: tutorial/errors.rst:153 +#: tutorial/errors.rst:160 msgid "" "The *except clause* may specify a variable after the exception name. The " "variable is bound to the exception instance which typically has an ``args`` " @@ -262,7 +387,45 @@ msgstr "" "__str__` για να εκτυπώσετε όλα τα ορίσματα χωρίς ρητή πρόσβαση στο ``." "args``. ::" -#: tutorial/errors.rst:176 +#: tutorial/errors.rst:166 +msgid "" +">>> try:\n" +"... raise Exception('spam', 'eggs')\n" +"... except Exception as inst:\n" +"... print(type(inst)) # the exception type\n" +"... print(inst.args) # arguments stored in .args\n" +"... print(inst) # __str__ allows args to be printed directly,\n" +"... # but may be overridden in exception " +"subclasses\n" +"... x, y = inst.args # unpack args\n" +"... print('x =', x)\n" +"... print('y =', y)\n" +"...\n" +"\n" +"('spam', 'eggs')\n" +"('spam', 'eggs')\n" +"x = spam\n" +"y = eggs" +msgstr "" +">>> try:\n" +"... raise Exception('spam', 'eggs')\n" +"... except Exception as inst:\n" +"... print(type(inst)) # the exception type\n" +"... print(inst.args) # arguments stored in .args\n" +"... print(inst) # __str__ allows args to be printed directly,\n" +"... # but may be overridden in exception " +"subclasses\n" +"... x, y = inst.args # unpack args\n" +"... print('x =', x)\n" +"... print('y =', y)\n" +"...\n" +"\n" +"('spam', 'eggs')\n" +"('spam', 'eggs')\n" +"x = spam\n" +"y = eggs" + +#: tutorial/errors.rst:183 msgid "" "The exception's :meth:`~object.__str__` output is printed as the last part " "('detail') of the message for unhandled exceptions." @@ -270,7 +433,7 @@ msgstr "" "Η έξοδος της εξαίρεσης :meth:`~object.__str__` εκτυπώνεται ως το τελευταίο " "μέρος ('λεπτομέρεια') του μηνύματος για μη χειριζόμενες εξαιρέσεις." -#: tutorial/errors.rst:179 +#: tutorial/errors.rst:186 msgid "" ":exc:`BaseException` is the common base class of all exceptions. One of its " "subclasses, :exc:`Exception`, is the base class of all the non-fatal " @@ -289,7 +452,7 @@ msgstr "" "`KeyboardInterrupt` το οποίο γίνεται raise όταν ο χρήστης επιθυμεί να " "διακόψει την εκτέλεση του προγράμματος." -#: tutorial/errors.rst:187 +#: tutorial/errors.rst:194 msgid "" ":exc:`Exception` can be used as a wildcard that catches (almost) everything. " "However, it is good practice to be as specific as possible with the types of " @@ -301,7 +464,7 @@ msgstr "" "συγκεκριμένοι με τους τύπους εξαιρέσεων που σκοπεύουμε να χειριστούμε και να " "επιτρέπουμε τυχόν απροσδόκητες εξαιρέσεις που εξαπλώνονται." -#: tutorial/errors.rst:192 +#: tutorial/errors.rst:199 msgid "" "The most common pattern for handling :exc:`Exception` is to print or log the " "exception and then re-raise it (allowing a caller to handle the exception as " @@ -311,7 +474,37 @@ msgstr "" "να καταγράψετε την εξαίρεση και στη συνέχεια να την επαναφέρετε " "(επιτρέποντας σε έναν καλούντα να χειριστεί και την εξαίρεση)::" -#: tutorial/errors.rst:210 +#: tutorial/errors.rst:203 +msgid "" +"import sys\n" +"\n" +"try:\n" +" f = open('myfile.txt')\n" +" s = f.readline()\n" +" i = int(s.strip())\n" +"except OSError as err:\n" +" print(\"OS error:\", err)\n" +"except ValueError:\n" +" print(\"Could not convert data to an integer.\")\n" +"except Exception as err:\n" +" print(f\"Unexpected {err=}, {type(err)=}\")\n" +" raise" +msgstr "" +"import sys\n" +"\n" +"try:\n" +" f = open('myfile.txt')\n" +" s = f.readline()\n" +" i = int(s.strip())\n" +"except OSError as err:\n" +" print(\"OS error:\", err)\n" +"except ValueError:\n" +" print(\"Could not convert data to an integer.\")\n" +"except Exception as err:\n" +" print(f\"Unexpected {err=}, {type(err)=}\")\n" +" raise" + +#: tutorial/errors.rst:217 msgid "" "The :keyword:`try` ... :keyword:`except` statement has an optional *else " "clause*, which, when present, must follow all *except clauses*. It is " @@ -323,7 +516,27 @@ msgstr "" "clauses*. Είναι χρήσιμο για κώδικα που πρέπει να εκτελεστεί εάν το *try " "clause* δεν κάνει raise μια εξαίρεση. Για παράδειγμα::" -#: tutorial/errors.rst:224 +#: tutorial/errors.rst:222 +msgid "" +"for arg in sys.argv[1:]:\n" +" try:\n" +" f = open(arg, 'r')\n" +" except OSError:\n" +" print('cannot open', arg)\n" +" else:\n" +" print(arg, 'has', len(f.readlines()), 'lines')\n" +" f.close()" +msgstr "" +"for arg in sys.argv[1:]:\n" +" try:\n" +" f = open(arg, 'r')\n" +" except OSError:\n" +" print('cannot open', arg)\n" +" else:\n" +" print(arg, 'has', len(f.readlines()), 'lines')\n" +" f.close()" + +#: tutorial/errors.rst:231 msgid "" "The use of the :keyword:`!else` clause is better than adding additional code " "to the :keyword:`try` clause because it avoids accidentally catching an " @@ -335,7 +548,7 @@ msgstr "" "λάθος σύλληψη μιας εξαίρεσης που δεν προέκυψε από τον κώδικα που " "προστατεύεται από την πρόταση :keyword:`!try` ... :keyword:`!except`." -#: tutorial/errors.rst:229 +#: tutorial/errors.rst:236 msgid "" "Exception handlers do not handle only exceptions that occur immediately in " "the *try clause*, but also those that occur inside functions that are called " @@ -346,11 +559,33 @@ msgstr "" "συναρτήσεις που καλούνται (ακόμη και έμμεσα) στην *try clause*. Για " "παράδειγμα::" -#: tutorial/errors.rst:247 +#: tutorial/errors.rst:240 +msgid "" +">>> def this_fails():\n" +"... x = 1/0\n" +"...\n" +">>> try:\n" +"... this_fails()\n" +"... except ZeroDivisionError as err:\n" +"... print('Handling run-time error:', err)\n" +"...\n" +"Handling run-time error: division by zero" +msgstr "" +">>> def this_fails():\n" +"... x = 1/0\n" +"...\n" +">>> try:\n" +"... this_fails()\n" +"... except ZeroDivisionError as err:\n" +"... print('Handling run-time error:', err)\n" +"...\n" +"Handling run-time error: division by zero" + +#: tutorial/errors.rst:254 msgid "Raising Exceptions" msgstr "Raising Εξαιρέσεων" -#: tutorial/errors.rst:249 +#: tutorial/errors.rst:256 msgid "" "The :keyword:`raise` statement allows the programmer to force a specified " "exception to occur. For example::" @@ -358,7 +593,21 @@ msgstr "" "Η δήλωση :keyword:`raise` επιτρέπει στον προγραμματιστή να αναγκάσει να " "εμφανιστεί μια καθορισμένη εξαίρεση. Για παράδειγμα::" -#: tutorial/errors.rst:257 +#: tutorial/errors.rst:259 +msgid "" +">>> raise NameError('HiThere')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" raise NameError('HiThere')\n" +"NameError: HiThere" +msgstr "" +">>> raise NameError('HiThere')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" raise NameError('HiThere')\n" +"NameError: HiThere" + +#: tutorial/errors.rst:265 msgid "" "The sole argument to :keyword:`raise` indicates the exception to be raised. " "This must be either an exception instance or an exception class (a class " @@ -373,7 +622,11 @@ msgstr "" "εξαίρεσης, θα δημιουργηθεί σιωπηρά καλώντας τον constructor της χωρίς " "ορίσματα::" -#: tutorial/errors.rst:265 +#: tutorial/errors.rst:271 +msgid "raise ValueError # shorthand for 'raise ValueError()'" +msgstr "κάνει raise ένα ValueError # συντομογραφία για το 'raise ValueError()'" + +#: tutorial/errors.rst:273 msgid "" "If you need to determine whether an exception was raised but don't intend to " "handle it, a simpler form of the :keyword:`raise` statement allows you to re-" @@ -383,11 +636,37 @@ msgstr "" "σκοπεύετε να τη χειριστείτε, μια απλούστερη μορφή της δήλωσης :keyword:" "`raise` σας επιτρέπει να κάνετε ξανά raise την εξαίρεση::" -#: tutorial/errors.rst:284 +#: tutorial/errors.rst:277 +msgid "" +">>> try:\n" +"... raise NameError('HiThere')\n" +"... except NameError:\n" +"... print('An exception flew by!')\n" +"... raise\n" +"...\n" +"An exception flew by!\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise NameError('HiThere')\n" +"NameError: HiThere" +msgstr "" +">>> try:\n" +"... raise NameError('HiThere')\n" +"... except NameError:\n" +"... print('An exception flew by!')\n" +"... raise\n" +"...\n" +"An exception flew by!\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise NameError('HiThere')\n" +"NameError: HiThere" + +#: tutorial/errors.rst:293 msgid "Exception Chaining" msgstr "Αλυσιδωτές Εξαιρέσεις" -#: tutorial/errors.rst:286 +#: tutorial/errors.rst:295 msgid "" "If an unhandled exception occurs inside an :keyword:`except` section, it " "will have the exception being handled attached to it and included in the " @@ -397,7 +676,45 @@ msgstr "" "ενότητα :keyword:`except`, θα επισυνάψει την εξαίρεση που θα χειριστεί και " "θα συμπεριληφθεί στο μήνυμα σφάλματος::" -#: tutorial/errors.rst:305 +#: tutorial/errors.rst:299 +msgid "" +">>> try:\n" +"... open(\"database.sqlite\")\n" +"... except OSError:\n" +"... raise RuntimeError(\"unable to handle error\")\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" open(\"database.sqlite\")\n" +" ~~~~^^^^^^^^^^^^^^^^^^^\n" +"FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError(\"unable to handle error\")\n" +"RuntimeError: unable to handle error" +msgstr "" +">>> try:\n" +"... open(\"database.sqlite\")\n" +"... except OSError:\n" +"... raise RuntimeError(\"unable to handle error\")\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" open(\"database.sqlite\")\n" +" ~~~~^^^^^^^^^^^^^^^^^^^\n" +"FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError(\"unable to handle error\")\n" +"RuntimeError: unable to handle error" + +#: tutorial/errors.rst:317 msgid "" "To indicate that an exception is a direct consequence of another, the :" "keyword:`raise` statement allows an optional :keyword:`from` clause::" @@ -406,13 +723,67 @@ msgstr "" "πρόταση :keyword:`raise` επιτρέπει μια προαιρετική πρόταση :keyword:" "`from`::" -#: tutorial/errors.rst:311 +#: tutorial/errors.rst:320 +msgid "" +"# exc must be exception instance or None.\n" +"raise RuntimeError from exc" +msgstr "" +"# Το exc πρέπει να είναι παράδειγμα εξαίρεσης ή None.\n" +"κάνει raise το RuntimeError από exc" + +#: tutorial/errors.rst:323 msgid "This can be useful when you are transforming exceptions. For example::" msgstr "" "Αυτό μπορεί να είναι χρήσιμο όταν μετασχηματίζεται εξαιρέσεις. Για " "παράδειγμα::" -#: tutorial/errors.rst:332 +#: tutorial/errors.rst:325 +msgid "" +">>> def func():\n" +"... raise ConnectionError\n" +"...\n" +">>> try:\n" +"... func()\n" +"... except ConnectionError as exc:\n" +"... raise RuntimeError('Failed to open database') from exc\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" func()\n" +" ~~~~^^\n" +" File \"\", line 2, in func\n" +"ConnectionError\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError('Failed to open database') from exc\n" +"RuntimeError: Failed to open database" +msgstr "" +">>> def func():\n" +"... raise ConnectionError\n" +"...\n" +">>> try:\n" +"... func()\n" +"... except ConnectionError as exc:\n" +"... raise RuntimeError('Failed to open database') from exc\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" func()\n" +" ~~~~^^\n" +" File \"\", line 2, in func\n" +"ConnectionError\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError('Failed to open database') from exc\n" +"RuntimeError: Failed to open database" + +#: tutorial/errors.rst:347 msgid "" "It also allows disabling automatic exception chaining using the ``from " "None`` idiom::" @@ -420,18 +791,40 @@ msgstr "" "Επιτρέπει επίσης την απενεργοποίηση της αυτόματης αλυσίδας εξαιρέσεων " "χρησιμοποιώντας ``from None`` idiom::" -#: tutorial/errors.rst:344 +#: tutorial/errors.rst:350 +msgid "" +">>> try:\n" +"... open('database.sqlite')\n" +"... except OSError:\n" +"... raise RuntimeError from None\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError from None\n" +"RuntimeError" +msgstr "" +">>> try:\n" +"... open('database.sqlite')\n" +"... except OSError:\n" +"... raise RuntimeError from None\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError from None\n" +"RuntimeError" + +#: tutorial/errors.rst:360 msgid "" "For more information about chaining mechanics, see :ref:`bltin-exceptions`." msgstr "" "Για περισσότερες πληροφορίες σχετικά με την μηχανική αλυσίδων, δείτε :ref:" "`bltin-exceptions`." -#: tutorial/errors.rst:350 +#: tutorial/errors.rst:366 msgid "User-defined Exceptions" msgstr "Εξαιρέσεις που καθορίζονται από το χρήστη" -#: tutorial/errors.rst:352 +#: tutorial/errors.rst:368 msgid "" "Programs may name their own exceptions by creating a new exception class " "(see :ref:`tut-classes` for more about Python classes). Exceptions should " @@ -443,7 +836,7 @@ msgstr "" "με τις κλάσεις Python). Οι εξαιρέσεις θα πρέπει συνήθως να προέρχονται από " "την κλάση :exc:`Exception`, είτε άμεσα είτε έμμεσα." -#: tutorial/errors.rst:356 +#: tutorial/errors.rst:372 msgid "" "Exception classes can be defined which do anything any other class can do, " "but are usually kept simple, often only offering a number of attributes that " @@ -455,7 +848,7 @@ msgstr "" "μόνο έναν αριθμό χαρακτηριστικών που επιτρέπουν την εξαγωγή πληροφοριών " "σχετικά με το σφάλμα από τους χειριστές για την εξαίρεση." -#: tutorial/errors.rst:360 +#: tutorial/errors.rst:376 msgid "" "Most exceptions are defined with names that end in \"Error\", similar to the " "naming of the standard exceptions." @@ -463,7 +856,7 @@ msgstr "" "Οι περισσότερες εξαιρέσεις ορίζονται με ονόματα που τελειώνουν σε \"Error\", " "παρόμοια με την ονομασία των τυπικών εξαιρέσεων." -#: tutorial/errors.rst:363 +#: tutorial/errors.rst:379 msgid "" "Many standard modules define their own exceptions to report errors that may " "occur in functions they define." @@ -471,11 +864,11 @@ msgstr "" "Πολλά standard modules ορίζουν τις δικές τους εξαιρέσεις για την αναφορά " "σφαλμάτων που μπορεί να προκύψουν σε συναρτήσεις που ορίζουν." -#: tutorial/errors.rst:370 +#: tutorial/errors.rst:386 msgid "Defining Clean-up Actions" msgstr "Καθορισμός ενεργειών καθαρισμού" -#: tutorial/errors.rst:372 +#: tutorial/errors.rst:388 msgid "" "The :keyword:`try` statement has another optional clause which is intended " "to define clean-up actions that must be executed under all circumstances. " @@ -485,7 +878,31 @@ msgstr "" "ορίσει ενέργειες καθαρισμού που πρέπει να εκτελεστούν υπό οποιεσδήποτε " "συνθήκες. Για παράδειγμα::" -#: tutorial/errors.rst:386 +#: tutorial/errors.rst:392 +msgid "" +">>> try:\n" +"... raise KeyboardInterrupt\n" +"... finally:\n" +"... print('Goodbye, world!')\n" +"...\n" +"Goodbye, world!\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise KeyboardInterrupt\n" +"KeyboardInterrupt" +msgstr "" +">>> try:\n" +"... raise KeyboardInterrupt\n" +"... finally:\n" +"... print('Goodbye, world!')\n" +"...\n" +"Goodbye, world!\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise KeyboardInterrupt\n" +"KeyboardInterrupt" + +#: tutorial/errors.rst:403 msgid "" "If a :keyword:`finally` clause is present, the :keyword:`!finally` clause " "will execute as the last task before the :keyword:`try` statement completes. " @@ -499,7 +916,7 @@ msgstr "" "keyword:`!try` παράγει μια εξαίρεση. Τα ακόλουθα σημεία συζητούν πιο " "περίπλοκες περιπτώσεις όταν εμφανίζεται μια εξαίρεση:" -#: tutorial/errors.rst:392 +#: tutorial/errors.rst:409 msgid "" "If an exception occurs during execution of the :keyword:`!try` clause, the " "exception may be handled by an :keyword:`except` clause. If the exception is " @@ -512,7 +929,7 @@ msgstr "" "εξαίρεση γίνεται ξανά raise μετά την εκτέλεση της πρότασης :keyword:`!" "finally`." -#: tutorial/errors.rst:398 +#: tutorial/errors.rst:415 msgid "" "An exception could occur during execution of an :keyword:`!except` or :" "keyword:`!else` clause. Again, the exception is re-raised after the :keyword:" @@ -522,15 +939,20 @@ msgstr "" "keyword:`!except` ή :keyword:`!else`. Και πάλι, η εξαίρεση τίθεται ξανά μετά " "την εκτέλεση της πρότασης :keyword:`!finally`." -#: tutorial/errors.rst:402 +#: tutorial/errors.rst:419 msgid "" "If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:" -"`continue` or :keyword:`return` statement, exceptions are not re-raised." +"`continue` or :keyword:`return` statement, exceptions are not re-raised. " +"This can be confusing and is therefore discouraged. From version 3.14 the " +"compiler emits a :exc:`SyntaxWarning` for it (see :pep:`765`)." msgstr "" "Εάν η πρόταση :keyword:`!finally` εκτελέσει μια πρόταση :keyword:`break`, :" -"keyword:`continue` ή :keyword:`return`, οι εξαιρέσεις δεν αυξάνονται εκ νέου." +"keyword:`continue` ή :keyword:`return`, οι εξαιρέσεις δεν γίνονται raise εκ " +"νέου. Αυτό μπορεί να προκαλέσει σύγχυση και ως εκ τούτου αποθαρρύνεται. Από " +"την έκδοση 3.14, ο μεταγλωττιστής εκπέμπει μια :exc:`SyntaxWarning` για αυτό " +"(δείτε :pep:`765`)." -#: tutorial/errors.rst:406 +#: tutorial/errors.rst:425 msgid "" "If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, the :keyword:`!finally` clause " @@ -542,27 +964,107 @@ msgstr "" "εκτελεστεί ακριβώς πριν από τα :keyword:`!break`, :keyword:`!continue` or :" "keyword:`!return` της εκτέλεσης της δήλωσης." -#: tutorial/errors.rst:412 +#: tutorial/errors.rst:431 msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " "returned value will be the one from the :keyword:`!finally` clause's :" "keyword:`!return` statement, not the value from the :keyword:`!try` " -"clause's :keyword:`!return` statement." +"clause's :keyword:`!return` statement. This can be confusing and is " +"therefore discouraged. From version 3.14 the compiler emits a :exc:" +"`SyntaxWarning` for it (see :pep:`765`)." msgstr "" "Εάν μια πρόταση :keyword:`!finally` περιλαμβάνει μια δήλωση :keyword:`!" "return`, η τιμή που επιστρέφεται θα είναι αυτή από την πρόταση :keyword:`!" "finally` της δήλωσης της :keyword:`!return`, και όχι η τιμή από τη δήλωση :" -"keyword:`!try` της πρότασης :keyword:`!return`." +"keyword:`!try` της πρότασης :keyword:`!return`. Αυτό μπορεί να προκαλέσει " +"σύγχυση και επομένως αποθαρρύνεται. Από την έκδοση 3.14, ο μεταγλωττιστής " +"εκπέμπει ένα :exc:`SyntaxWarning` για αυτό (δείτε :pep:`765`)." -#: tutorial/errors.rst:418 +#: tutorial/errors.rst:439 msgid "For example::" msgstr "Για παράδειγμα::" -#: tutorial/errors.rst:429 +#: tutorial/errors.rst:441 +msgid "" +">>> def bool_return():\n" +"... try:\n" +"... return True\n" +"... finally:\n" +"... return False\n" +"...\n" +">>> bool_return()\n" +"False" +msgstr "" +">>> def bool_return():\n" +"... try:\n" +"... return True\n" +"... finally:\n" +"... return False\n" +"...\n" +">>> bool_return()\n" +"False" + +#: tutorial/errors.rst:450 msgid "A more complicated example::" msgstr "Ένα πιο περίπλοκο παράδειγμα::" -#: tutorial/errors.rst:454 +#: tutorial/errors.rst:452 +msgid "" +">>> def divide(x, y):\n" +"... try:\n" +"... result = x / y\n" +"... except ZeroDivisionError:\n" +"... print(\"division by zero!\")\n" +"... else:\n" +"... print(\"result is\", result)\n" +"... finally:\n" +"... print(\"executing finally clause\")\n" +"...\n" +">>> divide(2, 1)\n" +"result is 2.0\n" +"executing finally clause\n" +">>> divide(2, 0)\n" +"division by zero!\n" +"executing finally clause\n" +">>> divide(\"2\", \"1\")\n" +"executing finally clause\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" divide(\"2\", \"1\")\n" +" ~~~~~~^^^^^^^^^^\n" +" File \"\", line 3, in divide\n" +" result = x / y\n" +" ~~^~~\n" +"TypeError: unsupported operand type(s) for /: 'str' and 'str'" +msgstr "" +">>> def divide(x, y):\n" +"... try:\n" +"... result = x / y\n" +"... except ZeroDivisionError:\n" +"... print(\"division by zero!\")\n" +"... else:\n" +"... print(\"result is\", result)\n" +"... finally:\n" +"... print(\"executing finally clause\")\n" +"...\n" +">>> divide(2, 1)\n" +"result is 2.0\n" +"executing finally clause\n" +">>> divide(2, 0)\n" +"division by zero!\n" +"executing finally clause\n" +">>> divide(\"2\", \"1\")\n" +"executing finally clause\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" divide(\"2\", \"1\")\n" +" ~~~~~~^^^^^^^^^^\n" +" File \"\", line 3, in divide\n" +" result = x / y\n" +" ~~^~~\n" +"TypeError: unsupported operand type(s) for /: 'str' and 'str'" + +#: tutorial/errors.rst:479 msgid "" "As you can see, the :keyword:`finally` clause is executed in any event. " "The :exc:`TypeError` raised by dividing two strings is not handled by the :" @@ -574,7 +1076,7 @@ msgstr "" "δύο συμβολοσειρών δεν χειρίζεται από την πρόταση :keyword:`except` και " "επομένως γίνεται ξανά raise μετά την εκτέλεση του όρου :keyword:`!finally`." -#: tutorial/errors.rst:459 +#: tutorial/errors.rst:484 msgid "" "In real world applications, the :keyword:`finally` clause is useful for " "releasing external resources (such as files or network connections), " @@ -584,11 +1086,11 @@ msgstr "" "χρήσιμη για την απελευθέρωση εξωτερικών πόρων (όπως αρχεία ή συνδέσεις " "δικτύου), ανεξάρτητα από το εάν η χρήση του πόρου ήταν επιτυχής." -#: tutorial/errors.rst:467 +#: tutorial/errors.rst:492 msgid "Predefined Clean-up Actions" msgstr "Προκαθορισμένες ενέργειες καθαρισμού" -#: tutorial/errors.rst:469 +#: tutorial/errors.rst:494 msgid "" "Some objects define standard clean-up actions to be undertaken when the " "object is no longer needed, regardless of whether or not the operation using " @@ -601,7 +1103,15 @@ msgstr "" "το ακόλουθο αντικείμενο, το οποίο προσπαθεί να ανοίξει ένα αρχείο και να " "εκτυπώσει τα περιεχόμενα του στην οθόνη. ::" -#: tutorial/errors.rst:477 +#: tutorial/errors.rst:499 +msgid "" +"for line in open(\"myfile.txt\"):\n" +" print(line, end=\"\")" +msgstr "" +"for line in open(\"myfile.txt\"):\n" +" print(line, end=\"\")" + +#: tutorial/errors.rst:502 msgid "" "The problem with this code is that it leaves the file open for an " "indeterminate amount of time after this part of the code has finished " @@ -617,7 +1127,17 @@ msgstr "" "σε αντικείμενα όπως αρχεία να χρησιμοποιούνται με τρόπο που διασφαλίζει ότι " "καθαρίζονται πάντα άμεσα και σωστά. ::" -#: tutorial/errors.rst:487 +#: tutorial/errors.rst:508 +msgid "" +"with open(\"myfile.txt\") as f:\n" +" for line in f:\n" +" print(line, end=\"\")" +msgstr "" +"with open(\"myfile.txt\") as f:\n" +" for line in f:\n" +" print(line, end=\"\")" + +#: tutorial/errors.rst:512 msgid "" "After the statement is executed, the file *f* is always closed, even if a " "problem was encountered while processing the lines. Objects which, like " @@ -629,11 +1149,11 @@ msgstr "" "που, όπως τα αρχεία παρέχουν προκαθορισμένες ενέργειες καθαρισμού θα το " "υποδεικνύουν στην τεκμηρίωση τους." -#: tutorial/errors.rst:495 +#: tutorial/errors.rst:520 msgid "Raising and Handling Multiple Unrelated Exceptions" msgstr "Raising και Χειρισμός Πολλαπλών Άσχετων Εξαιρέσεων" -#: tutorial/errors.rst:497 +#: tutorial/errors.rst:522 msgid "" "There are situations where it is necessary to report several exceptions that " "have occurred. This is often the case in concurrency frameworks, when " @@ -647,7 +1167,7 @@ msgstr "" "περιπτώσεις χρήσης όπου είναι επιθυμητό να συνεχιστεί η εκτέλεση και η " "συλλογή πολλαπλών σφαλμάτων αντί να κάνει raise την πρώτη εξαίρεση." -#: tutorial/errors.rst:503 +#: tutorial/errors.rst:528 msgid "" "The builtin :exc:`ExceptionGroup` wraps a list of exception instances so " "that they can be raised together. It is an exception itself, so it can be " @@ -657,7 +1177,59 @@ msgstr "" "παρουσίες εξαιρέσεων ώστε να μπορούν να αυξηθούν μαζί. Είναι μια εξαίρεση " "από μόνη της, επομένως μπορεί να συλληφθεί όπως κάθε άλλη εξαίρεση. ::" -#: tutorial/errors.rst:529 +#: tutorial/errors.rst:532 +msgid "" +">>> def f():\n" +"... excs = [OSError('error 1'), SystemError('error 2')]\n" +"... raise ExceptionGroup('there were problems', excs)\n" +"...\n" +">>> f()\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 1, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 3, in f\n" +" | raise ExceptionGroup('there were problems', excs)\n" +" | ExceptionGroup: there were problems (2 sub-exceptions)\n" +" +-+---------------- 1 ----------------\n" +" | OSError: error 1\n" +" +---------------- 2 ----------------\n" +" | SystemError: error 2\n" +" +------------------------------------\n" +">>> try:\n" +"... f()\n" +"... except Exception as e:\n" +"... print(f'caught {type(e)}: e')\n" +"...\n" +"caught : e\n" +">>>" +msgstr "" +">>> def f():\n" +"... excs = [OSError('error 1'), SystemError('error 2')]\n" +"... raise ExceptionGroup('there were problems', excs)\n" +"...\n" +">>> f()\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 1, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 3, in f\n" +" | raise ExceptionGroup('there were problems', excs)\n" +" | ExceptionGroup: there were problems (2 sub-exceptions)\n" +" +-+---------------- 1 ----------------\n" +" | OSError: error 1\n" +" +---------------- 2 ----------------\n" +" | SystemError: error 2\n" +" +------------------------------------\n" +">>> try:\n" +"... f()\n" +"... except Exception as e:\n" +"... print(f'caught {type(e)}: e')\n" +"...\n" +"caught : e\n" +">>>" + +#: tutorial/errors.rst:557 msgid "" "By using ``except*`` instead of ``except``, we can selectively handle only " "the exceptions in the group that match a certain type. In the following " @@ -672,7 +1244,91 @@ msgstr "" "ομάδας ενός συγκεκριμένου τύπου, ενώ αφήνει όλες τις άλλες εξαιρέσεις να " "διαδοθούν σε άλλες προτάσεις και τελικά να ξαναγίνουν raise. ::" -#: tutorial/errors.rst:572 +#: tutorial/errors.rst:564 +msgid "" +">>> def f():\n" +"... raise ExceptionGroup(\n" +"... \"group1\",\n" +"... [\n" +"... OSError(1),\n" +"... SystemError(2),\n" +"... ExceptionGroup(\n" +"... \"group2\",\n" +"... [\n" +"... OSError(3),\n" +"... RecursionError(4)\n" +"... ]\n" +"... )\n" +"... ]\n" +"... )\n" +"...\n" +">>> try:\n" +"... f()\n" +"... except* OSError as e:\n" +"... print(\"There were OSErrors\")\n" +"... except* SystemError as e:\n" +"... print(\"There were SystemErrors\")\n" +"...\n" +"There were OSErrors\n" +"There were SystemErrors\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 2, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise ExceptionGroup(\n" +" | ...<12 lines>...\n" +" | )\n" +" | ExceptionGroup: group1 (1 sub-exception)\n" +" +-+---------------- 1 ----------------\n" +" | ExceptionGroup: group2 (1 sub-exception)\n" +" +-+---------------- 1 ----------------\n" +" | RecursionError: 4\n" +" +------------------------------------\n" +">>>" +msgstr "" +">>> def f():\n" +"... raise ExceptionGroup(\n" +"... \"group1\",\n" +"... [\n" +"... OSError(1),\n" +"... SystemError(2),\n" +"... ExceptionGroup(\n" +"... \"group2\",\n" +"... [\n" +"... OSError(3),\n" +"... RecursionError(4)\n" +"... ]\n" +"... )\n" +"... ]\n" +"... )\n" +"...\n" +">>> try:\n" +"... f()\n" +"... except* OSError as e:\n" +"... print(\"There were OSErrors\")\n" +"... except* SystemError as e:\n" +"... print(\"There were SystemErrors\")\n" +"...\n" +"There were OSErrors\n" +"There were SystemErrors\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 2, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise ExceptionGroup(\n" +" | ...<12 lines>...\n" +" | )\n" +" | ExceptionGroup: group1 (1 sub-exception)\n" +" +-+---------------- 1 ----------------\n" +" | ExceptionGroup: group2 (1 sub-exception)\n" +" +-+---------------- 1 ----------------\n" +" | RecursionError: 4\n" +" +------------------------------------\n" +">>>" + +#: tutorial/errors.rst:605 msgid "" "Note that the exceptions nested in an exception group must be instances, not " "types. This is because in practice the exceptions would typically be ones " @@ -684,11 +1340,35 @@ msgstr "" "εξαιρέσεις θα ήταν συνήθως αυτές που έχουν ήδη αναφερθεί και καταγραφεί από " "το πρόγραμμα, σύμφωνα με το ακόλουθο μοτίβο::" -#: tutorial/errors.rst:592 +#: tutorial/errors.rst:610 +msgid "" +">>> excs = []\n" +"... for test in tests:\n" +"... try:\n" +"... test.run()\n" +"... except Exception as e:\n" +"... excs.append(e)\n" +"...\n" +">>> if excs:\n" +"... raise ExceptionGroup(\"Test Failures\", excs)\n" +"..." +msgstr "" +">>> excs = []\n" +"... for test in tests:\n" +"... try:\n" +"... test.run()\n" +"... except Exception as e:\n" +"... excs.append(e)\n" +"...\n" +">>> if excs:\n" +"... raise ExceptionGroup(\"Test Failures\", excs)\n" +"..." + +#: tutorial/errors.rst:625 msgid "Enriching Exceptions with Notes" msgstr "Εμπλουτίζοντας τις Εξαιρέσεις με Σημειώσεις" -#: tutorial/errors.rst:594 +#: tutorial/errors.rst:627 msgid "" "When an exception is created in order to be raised, it is usually " "initialized with information that describes the error that has occurred. " @@ -706,7 +1386,39 @@ msgstr "" "σημειώσεων της εξαίρεσης. Η standard απόδοση παρακολούθησης περιλαμβάνει " "όλες τις σημειώσεις, με τη σειρά που προστέθηκα, μετά την εξαίρεση. ::" -#: tutorial/errors.rst:615 +#: tutorial/errors.rst:634 +msgid "" +">>> try:\n" +"... raise TypeError('bad type')\n" +"... except Exception as e:\n" +"... e.add_note('Add some information')\n" +"... e.add_note('Add some more information')\n" +"... raise\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise TypeError('bad type')\n" +"TypeError: bad type\n" +"Add some information\n" +"Add some more information\n" +">>>" +msgstr "" +">>> try:\n" +"... raise TypeError('bad type')\n" +"... except Exception as e:\n" +"... e.add_note('Add some information')\n" +"... e.add_note('Add some more information')\n" +"... raise\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise TypeError('bad type')\n" +"TypeError: bad type\n" +"Add some information\n" +"Add some more information\n" +">>>" + +#: tutorial/errors.rst:649 msgid "" "For example, when collecting exceptions into an exception group, we may want " "to add context information for the individual errors. In the following each " @@ -716,3 +1428,97 @@ msgstr "" "να θέλουμε να προσθέσουμε πληροφορίες περιβάλλοντος για τα μεμονωμένα " "σφάλματα. Στην συνέχεια κάθε εξαίρεση στην ομάδα έχει μια σημείωση που " "υποδεικνύει πότε έχει συμβεί αυτό το σφάλμα. ::" + +#: tutorial/errors.rst:653 +msgid "" +">>> def f():\n" +"... raise OSError('operation failed')\n" +"...\n" +">>> excs = []\n" +">>> for i in range(3):\n" +"... try:\n" +"... f()\n" +"... except Exception as e:\n" +"... e.add_note(f'Happened in Iteration {i+1}')\n" +"... excs.append(e)\n" +"...\n" +">>> raise ExceptionGroup('We have some problems', excs)\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 1, in \n" +" | raise ExceptionGroup('We have some problems', excs)\n" +" | ExceptionGroup: We have some problems (3 sub-exceptions)\n" +" +-+---------------- 1 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 1\n" +" +---------------- 2 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 2\n" +" +---------------- 3 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 3\n" +" +------------------------------------\n" +">>>" +msgstr "" +">>> def f():\n" +"... raise OSError('operation failed')\n" +"...\n" +">>> excs = []\n" +">>> for i in range(3):\n" +"... try:\n" +"... f()\n" +"... except Exception as e:\n" +"... e.add_note(f'Happened in Iteration {i+1}')\n" +"... excs.append(e)\n" +"...\n" +">>> raise ExceptionGroup('We have some problems', excs)\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 1, in \n" +" | raise ExceptionGroup('We have some problems', excs)\n" +" | ExceptionGroup: We have some problems (3 sub-exceptions)\n" +" +-+---------------- 1 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 1\n" +" +---------------- 2 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 2\n" +" +---------------- 3 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 3\n" +" +------------------------------------\n" +">>>" diff --git a/tutorial/floatingpoint.po b/tutorial/floatingpoint.po index 46eee891..1fb6d181 100644 --- a/tutorial/floatingpoint.po +++ b/tutorial/floatingpoint.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-08-04 20:25+0000\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,7 +19,7 @@ msgstr "" "X-Generator: Poedit 3.4.4\n" #: tutorial/floatingpoint.rst:10 -msgid "Floating Point Arithmetic: Issues and Limitations" +msgid "Floating-Point Arithmetic: Issues and Limitations" msgstr "Αριθμητική Κινητής Υποδιαστολής: Ζητήματα και Περιορισμοί" #: tutorial/floatingpoint.rst:16 @@ -59,10 +59,22 @@ msgstr "" "Το πρόβλημα είναι πιο κατανοητό στην αρχή με βάση το 10. Θεωρήστε το κλάσμα " "1/3. Μπορεί να το προσεγγίσετε ως κλάσμα βάσης 10::" +#: tutorial/floatingpoint.rst:31 +msgid "0.3" +msgstr "0.3" + #: tutorial/floatingpoint.rst:37 msgid "or, better, ::" msgstr "ή, καλύτερα, ::" +#: tutorial/floatingpoint.rst:35 +msgid "0.33" +msgstr "0.33" + +#: tutorial/floatingpoint.rst:39 +msgid "0.333" +msgstr "0.333" + #: tutorial/floatingpoint.rst:41 msgid "" "and so on. No matter how many digits you're willing to write down, the " @@ -83,6 +95,10 @@ msgstr "" "να χρησιμοποιήσετε, η δεκαδική τιμή 0,1 δεν μπορεί να αναπαρασταθεί ακριβώς " "ως κλάσμα βάση 2. Στη βάση 2, το 1/10 είναι το κλάσμα που επαναλαμβάνεται ::" +#: tutorial/floatingpoint.rst:49 +msgid "0.0001100110011001100110011001100110011001100110011..." +msgstr "0.0001100110011001100110011001100110011001100110011..." + #: tutorial/floatingpoint.rst:51 msgid "" "Stop at any finite number of bits, and you get an approximation. On most " @@ -114,6 +130,14 @@ msgstr "" "δεκαδική τιμή της δυαδικής προσέγγισης που είναι αποθηκευμένη για 0,1, θα " "πρέπει να εμφανίζει::" +#: tutorial/floatingpoint.rst:64 +msgid "" +">>> 0.1\n" +"0.1000000000000000055511151231257827021181583404541015625" +msgstr "" +">>> 0.1\n" +"0.1000000000000000055511151231257827021181583404541015625" + #: tutorial/floatingpoint.rst:67 msgid "" "That is more digits than most people find useful, so Python keeps the number " @@ -123,6 +147,14 @@ msgstr "" "επομένως η Python διατηρεί τον αριθμό των διαχειρίσιμων ψηφίων εμφανίζοντας " "μια στρογγυλεμένη τιμή αντ' αυτού:" +#: tutorial/floatingpoint.rst:70 +msgid "" +">>> 1 / 10\n" +"0.1" +msgstr "" +">>> 1 / 10\n" +"0.1" + #: tutorial/floatingpoint.rst:75 msgid "" "Just remember, even though the printed result looks like the exact value of " @@ -165,7 +197,7 @@ msgstr "" #: tutorial/floatingpoint.rst:91 msgid "" -"Note that this is in the very nature of binary floating-point: this is not a " +"Note that this is in the very nature of binary floating point: this is not a " "bug in Python, and it is not a bug in your code either. You'll see the same " "kind of thing in all languages that support your hardware's floating-point " "arithmetic (although some languages may not *display* the difference by " @@ -187,6 +219,26 @@ msgstr "" "συμβολοσειράς για να δημιουργήσετε έναν περιορισμένο αριθμό σημαντικών " "ψηφίων:" +#: tutorial/floatingpoint.rst:100 +msgid "" +">>> format(math.pi, '.12g') # give 12 significant digits\n" +"'3.14159265359'\n" +"\n" +">>> format(math.pi, '.2f') # give 2 digits after the point\n" +"'3.14'\n" +"\n" +">>> repr(math.pi)\n" +"'3.141592653589793'" +msgstr "" +">>> format(math.pi, '.12g') # give 12 significant digits\n" +"'3.14159265359'\n" +"\n" +">>> format(math.pi, '.2f') # give 2 digits after the point\n" +"'3.14'\n" +"\n" +">>> repr(math.pi)\n" +"'3.141592653589793'" + #: tutorial/floatingpoint.rst:111 msgid "" "It's important to realize that this is, in a real sense, an illusion: you're " @@ -205,6 +257,14 @@ msgstr "" "δεν είναι ακριβώς το 1/10, το άθροισμα τριών τιμών του 0,1 μπορεί να μην " "αποφέρει ακριβώς 0,3:" +#: tutorial/floatingpoint.rst:117 +msgid "" +">>> 0.1 + 0.1 + 0.1 == 0.3\n" +"False" +msgstr "" +">>> 0.1 + 0.1 + 0.1 == 0.3\n" +"False" + #: tutorial/floatingpoint.rst:122 msgid "" "Also, since the 0.1 cannot get any closer to the exact value of 1/10 and 0.3 " @@ -215,6 +275,14 @@ msgstr "" "το 0.3 δεν μπορεί να πλησιάσει την ακριβή τιμή του 3/10, τότε η προ-" "στρογγυλοποίηση με τη συνάρτηση :func:`round` δεν μπορεί να βοηθήσει:" +#: tutorial/floatingpoint.rst:126 +msgid "" +">>> round(0.1, 1) + round(0.1, 1) + round(0.1, 1) == round(0.3, 1)\n" +"False" +msgstr "" +">>> round(0.1, 1) + round(0.1, 1) + round(0.1, 1) == round(0.3, 1)\n" +"False" + #: tutorial/floatingpoint.rst:131 msgid "" "Though the numbers cannot be made closer to their intended exact values, " @@ -224,6 +292,14 @@ msgstr "" "ακριβείς τιμές τους, η συνάρτηση :func:`math.isclose` μπορεί να είναι " "χρήσιμη για τη σύγκριση ανακριβών τιμών:" +#: tutorial/floatingpoint.rst:134 +msgid "" +">>> math.isclose(0.1 + 0.1 + 0.1, 0.3)\n" +"True" +msgstr "" +">>> math.isclose(0.1 + 0.1 + 0.1, 0.3)\n" +"True" + #: tutorial/floatingpoint.rst:139 msgid "" "Alternatively, the :func:`round` function can be used to compare rough " @@ -232,13 +308,21 @@ msgstr "" "Εναλλακτικά, η συνάρτηση :func:`round` μπορεί να χρησιμοποιηθεί για τη " "σύγκριση χονδρικών προσεγγίσεων:" +#: tutorial/floatingpoint.rst:142 +msgid "" +">>> round(math.pi, ndigits=2) == round(22 / 7, ndigits=2)\n" +"True" +msgstr "" +">>> round(math.pi, ndigits=2) == round(22 / 7, ndigits=2)\n" +"True" + #: tutorial/floatingpoint.rst:147 msgid "" "Binary floating-point arithmetic holds many surprises like this. The " "problem with \"0.1\" is explained in precise detail below, in the " "\"Representation Error\" section. See `Examples of Floating Point Problems " "`_ for " -"a pleasant summary of how binary floating-point works and the kinds of " +"a pleasant summary of how binary floating point works and the kinds of " "problems commonly encountered in practice. Also see `The Perils of Floating " "Point `_ for a more complete " "account of other common surprises." @@ -256,7 +340,7 @@ msgstr "" #: tutorial/floatingpoint.rst:156 msgid "" "As that says near the end, \"there are no easy answers.\" Still, don't be " -"unduly wary of floating-point! The errors in Python float operations are " +"unduly wary of floating point! The errors in Python float operations are " "inherited from the floating-point hardware, and on most machines are on the " "order of no more than 1 part in 2\\*\\*53 per operation. That's more than " "adequate for most tasks, but you do need to keep in mind that it's not " @@ -330,6 +414,16 @@ msgstr "" "μέθοδος :meth:`float.as_integer_ratio` εκφράζει την τιμή ενός float ως " "κλάσμα:" +#: tutorial/floatingpoint.rst:186 +msgid "" +">>> x = 3.14159\n" +">>> x.as_integer_ratio()\n" +"(3537115888337719, 1125899906842624)" +msgstr "" +">>> x = 3.14159\n" +">>> x.as_integer_ratio()\n" +"(3537115888337719, 1125899906842624)" + #: tutorial/floatingpoint.rst:192 msgid "" "Since the ratio is exact, it can be used to losslessly recreate the original " @@ -338,6 +432,14 @@ msgstr "" "Δεδομένου ότι η αναλογία είναι ακριβής, μπορεί να χρησιμοποιηθεί για την " "αναδημιουργία χωρίς απώλειες της αρχικής τιμής:" +#: tutorial/floatingpoint.rst:195 +msgid "" +">>> x == 3537115888337719 / 1125899906842624\n" +"True" +msgstr "" +">>> x == 3537115888337719 / 1125899906842624\n" +"True" + #: tutorial/floatingpoint.rst:200 msgid "" "The :meth:`float.hex` method expresses a float in hexadecimal (base 16), " @@ -346,6 +448,14 @@ msgstr "" "Η μέθοδος :meth:`float.hex` εκφράζει ένα float σε δεκαεξαδικό (βάση 16), " "δίνοντας πάλι την ακριβή τιμή που έχει αποθηκευτεί στον υπολογιστή σας:" +#: tutorial/floatingpoint.rst:203 +msgid "" +">>> x.hex()\n" +"'0x1.921f9f01b866ep+1'" +msgstr "" +">>> x.hex()\n" +"'0x1.921f9f01b866ep+1'" + #: tutorial/floatingpoint.rst:208 msgid "" "This precise hexadecimal representation can be used to reconstruct the float " @@ -354,6 +464,14 @@ msgstr "" "Αυτή η ακριβής δεκαεξαδική αναπαράσταση μπορεί να χρησιμοποιηθεί για την " "ανακατασκευή της τιμής float ακριβώς:" +#: tutorial/floatingpoint.rst:211 +msgid "" +">>> x == float.fromhex('0x1.921f9f01b866ep+1')\n" +"True" +msgstr "" +">>> x == float.fromhex('0x1.921f9f01b866ep+1')\n" +"True" + #: tutorial/floatingpoint.rst:216 msgid "" "Since the representation is exact, it is useful for reliably porting values " @@ -381,21 +499,71 @@ msgstr "" "ακρίβεια, ώστε τα σφάλματα να μην συσσωρεύονται στο σημείο που επηρεάζουν το " "τελικό σύνολο:" +#: tutorial/floatingpoint.rst:226 +msgid "" +">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n" +"False\n" +">>> sum([0.1] * 10) == 1.0\n" +"True" +msgstr "" +">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n" +"False\n" +">>> sum([0.1] * 10) == 1.0\n" +"True" + #: tutorial/floatingpoint.rst:233 msgid "" -"The :func:`math.fsum()` goes further and tracks all of the \"lost digits\" " -"as values are added onto a running total so that the result has only a " -"single rounding. This is slower than :func:`sum` but will be more accurate " -"in uncommon cases where large magnitude inputs mostly cancel each other out " +"The :func:`math.fsum` goes further and tracks all of the \"lost digits\" as " +"values are added onto a running total so that the result has only a single " +"rounding. This is slower than :func:`sum` but will be more accurate in " +"uncommon cases where large magnitude inputs mostly cancel each other out " "leaving a final sum near zero:" msgstr "" -"Το :func:`math.fsum()` πηγαίνει πιο μακριά και παρακολουθεί όλα τα \"χαμένα " +"Το :func:`math.fsum` πηγαίνει πιο μακριά και παρακολουθεί όλα τα \"χαμένα " "ψηφία\" καθώς οι τιμές προστίθενται σε ένα τρέχον σύνολο, έτσι ώστε το " "αποτέλεσμα να έχει μόνο μία στρογγυλοποίηση. Αυτό είναι πιο αργό από το :" "func:`sum` αλλά θα είναι πιο ακριβές σε ασυνήθιστες περιπτώσεις όπου οι " "είσοδοι μεγάλου μεγέθους ακυρώνουν η μία την άλλη αφήνοντας ένα τελικό " "άθροισμα κοντά στο μηδέν:" +#: tutorial/floatingpoint.rst:239 +msgid "" +">>> arr = [-0.10430216751806065, -266310978.67179024, 143401161448607.16,\n" +"... -143401161400469.7, 266262841.31058735, -0.003244936839808227]\n" +">>> float(sum(map(Fraction, arr))) # Exact summation with single rounding\n" +"8.042173697819788e-13\n" +">>> math.fsum(arr) # Single rounding\n" +"8.042173697819788e-13\n" +">>> sum(arr) # Multiple roundings in extended " +"precision\n" +"8.042178034628478e-13\n" +">>> total = 0.0\n" +">>> for x in arr:\n" +"... total += x # Multiple roundings in standard " +"precision\n" +"...\n" +">>> total # Straight addition has no correct " +"digits!\n" +"-0.0051575902860057365" +msgstr "" +">>> arr = [-0.10430216751806065, -266310978.67179024, 143401161448607.16,\n" +"... -143401161400469.7, 266262841.31058735, -0.003244936839808227]\n" +">>> float(sum(map(Fraction, arr))) # Exact summation with single rounding\n" +"8.042173697819788e-13\n" +">>> math.fsum(arr) # Single rounding\n" +"8.042173697819788e-13\n" +">>> sum(arr) # Multiple roundings in extended " +"precision\n" +"8.042178034628478e-13\n" +">>> total = 0.0\n" +">>> for x in arr:\n" +"... total += x # Multiple roundings in standard " +"precision\n" +"...\n" +">>> total # Straight addition has no correct " +"digits!\n" +"-0.0051575902860057365" + #: tutorial/floatingpoint.rst:260 msgid "Representation Error" msgstr "Σφάλμα Αναπαράστασης" @@ -444,10 +612,18 @@ msgstr "" "0,1 στο πλησιέστερο κλάσμα που μπορεί να έχει τη μορφή *J*/2**\\ *N* όπου " "*J* είναι ένας ακέραιος που περιέχει ακριβώς 53 bits. Ξαναγράφεται ::" +#: tutorial/floatingpoint.rst:280 +msgid "1 / 10 ~= J / (2**N)" +msgstr "1 / 10 ~= J / (2**N)" + #: tutorial/floatingpoint.rst:282 msgid "as ::" msgstr "ως ::" +#: tutorial/floatingpoint.rst:284 +msgid "J ~= 2**N / 10" +msgstr "J ~= 2**N / 10" + #: tutorial/floatingpoint.rst:286 msgid "" "and recalling that *J* has exactly 53 bits (is ``>= 2**52`` but ``< " @@ -456,6 +632,14 @@ msgstr "" "και υπενθυμίζοντας ότι το *J* έχει ακριβώς 53 bits (είναι ``>= 2**52`` αλλά " "``< 2**53``), η καλύτερη τιμή για το *N* είναι 56:" +#: tutorial/floatingpoint.rst:289 +msgid "" +">>> 2**52 <= 2**56 // 10 < 2**53\n" +"True" +msgstr "" +">>> 2**52 <= 2**56 // 10 < 2**53\n" +"True" + #: tutorial/floatingpoint.rst:294 msgid "" "That is, 56 is the only value for *N* that leaves *J* with exactly 53 bits. " @@ -465,6 +649,16 @@ msgstr "" "bits. Η καλύτερη δυνατή τιμή για το *J* είναι τότε αυτό το πηλίκο " "στρογγυλοποιημένο:" +#: tutorial/floatingpoint.rst:297 +msgid "" +">>> q, r = divmod(2**56, 10)\n" +">>> r\n" +"6" +msgstr "" +">>> q, r = divmod(2**56, 10)\n" +">>> r\n" +"6" + #: tutorial/floatingpoint.rst:303 msgid "" "Since the remainder is more than half of 10, the best approximation is " @@ -473,6 +667,14 @@ msgstr "" "Δεδομένου ότι το υπόλοιπο είναι περισσότερο από το μισό του 10, η καλύτερη " "προσέγγιση επιτυγχάνεται με στρογγυλοποίηση προς τα επάνω:" +#: tutorial/floatingpoint.rst:306 +msgid "" +">>> q+1\n" +"7205759403792794" +msgstr "" +">>> q+1\n" +"7205759403792794" + #: tutorial/floatingpoint.rst:313 msgid "" "Therefore the best possible approximation to 1/10 in IEEE 754 double " @@ -481,12 +683,20 @@ msgstr "" "Ως εκ τούτου, η καλύτερη δυνατή προσέγγιση στο 1/10 στο IEEE 754 διπλής " "ακρίβειας είναι::" +#: tutorial/floatingpoint.rst:316 +msgid "7205759403792794 / 2 ** 56" +msgstr "7205759403792794 / 2 ** 56" + #: tutorial/floatingpoint.rst:318 msgid "" "Dividing both the numerator and denominator by two reduces the fraction to::" msgstr "" "Η διαίρεση του αριθμητή και του παρονομαστή με δύο μειώνει το κλάσμα σε::" +#: tutorial/floatingpoint.rst:320 +msgid "3602879701896397 / 2 ** 55" +msgstr "3602879701896397 / 2 ** 55" + #: tutorial/floatingpoint.rst:322 msgid "" "Note that since we rounded up, this is actually a little bit larger than " @@ -507,6 +717,14 @@ msgstr "" "ακριβές κλάσμα που δίνεται παραπάνω, η καλύτερη διπλή προσέγγιση IEEE 754 " "που μπορεί να πάρει:" +#: tutorial/floatingpoint.rst:329 +msgid "" +">>> 0.1 * 2 ** 55\n" +"3602879701896397.0" +msgstr "" +">>> 0.1 * 2 ** 55\n" +"3602879701896397.0" + #: tutorial/floatingpoint.rst:334 msgid "" "If we multiply that fraction by 10\\*\\*55, we can see the value out to 55 " @@ -515,6 +733,14 @@ msgstr "" "Αν πολλαπλασιάσουμε αυτό το κλάσμα με 10\\*\\*55, μπορούμε να δούμε την τιμή " "με 55 δεκαδικά ψηφία:" +#: tutorial/floatingpoint.rst:337 +msgid "" +">>> 3602879701896397 * 10 ** 55 // 2 ** 55\n" +"1000000000000000055511151231257827021181583404541015625" +msgstr "" +">>> 3602879701896397 * 10 ** 55 // 2 ** 55\n" +"1000000000000000055511151231257827021181583404541015625" + #: tutorial/floatingpoint.rst:342 msgid "" "meaning that the exact number stored in the computer is equal to the decimal " @@ -529,9 +755,49 @@ msgstr "" "παλαιότερων εκδόσεων της Python), στρογγυλοποιούν το αποτέλεσμα σε 17 " "σημαντικά ψηφία:" +#: tutorial/floatingpoint.rst:347 +msgid "" +">>> format(0.1, '.17f')\n" +"'0.10000000000000001'" +msgstr "" +">>> format(0.1, '.17f')\n" +"'0.10000000000000001'" + #: tutorial/floatingpoint.rst:352 msgid "" "The :mod:`fractions` and :mod:`decimal` modules make these calculations easy:" msgstr "" "Τα modules :mod:`fractions` και :mod:`decimal` κάνουν αυτούς τους " "υπολογισμούς εύκολους:" + +#: tutorial/floatingpoint.rst:355 +msgid "" +">>> from decimal import Decimal\n" +">>> from fractions import Fraction\n" +"\n" +">>> Fraction.from_float(0.1)\n" +"Fraction(3602879701896397, 36028797018963968)\n" +"\n" +">>> (0.1).as_integer_ratio()\n" +"(3602879701896397, 36028797018963968)\n" +"\n" +">>> Decimal.from_float(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +"\n" +">>> format(Decimal.from_float(0.1), '.17')\n" +"'0.10000000000000001'" +msgstr "" +">>> from decimal import Decimal\n" +">>> from fractions import Fraction\n" +"\n" +">>> Fraction.from_float(0.1)\n" +"Fraction(3602879701896397, 36028797018963968)\n" +"\n" +">>> (0.1).as_integer_ratio()\n" +"(3602879701896397, 36028797018963968)\n" +"\n" +">>> Decimal.from_float(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +"\n" +">>> format(Decimal.from_float(0.1), '.17')\n" +"'0.10000000000000001'" diff --git a/tutorial/index.po b/tutorial/index.po index d73cd4b9..b439f28a 100644 --- a/tutorial/index.po +++ b/tutorial/index.po @@ -1,67 +1,105 @@ -# SOME DESCRIPTIVE TITLE. +# Python Documentation Greek Translation # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. +# Dimitrios Papadopoulos 2024 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Dimitrios Papadopoulos\n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: tutorial/index.rst:5 msgid "The Python Tutorial" -msgstr "" +msgstr "Οδηγός εκμάθησης Python" #: tutorial/index.rst:7 msgid "" +"This tutorial is designed for *programmers* that are new to the Python " +"language, **not** *beginners* who are new to programming." +msgstr "" +"Αυτός ο οδηγός εκμάθησης έχει σχεδιαστεί για *προγραμματιστές* που είναι " +"νέοι στην γλώσσα Python, **όχι** για *αρχάριους* που είναι νέοι στο " +"προγραμματισμό." + +#: tutorial/index.rst:11 +msgid "" "Python is an easy to learn, powerful programming language. It has efficient " "high-level data structures and a simple but effective approach to object-" "oriented programming. Python's elegant syntax and dynamic typing, together " "with its interpreted nature, make it an ideal language for scripting and " "rapid application development in many areas on most platforms." msgstr "" +"Η Python είναι μια εύκολη στην εκμάθηση, ισχυρή γλώσσα προγραμματισμού. Έχει " +"αποτελεσματικές δομές δεδομένων υψηλού επιπέδου και μια απλή αλλά " +"αποτελεσματική προσέγγιση στον αντικειμενοστραφή προγραμματισμό. Το κομψό " +"συντακτικό και η δυναμική τυποποίηση της Python, σε συνδυασμό με τη " +"διερμηνευμένη φύση της, την καθιστούν ιδανική γλώσσα για scripting και " +"ταχεία ανάπτυξη εφαρμογών σε πολλούς τομείς στις περισσότερες πλατφόρμες." -#: tutorial/index.rst:13 +#: tutorial/index.rst:17 msgid "" "The Python interpreter and the extensive standard library are freely " "available in source or binary form for all major platforms from the Python " -"web site, https://www.python.org/, and may be freely distributed. The same " +"website, https://www.python.org/, and may be freely distributed. The same " "site also contains distributions of and pointers to many free third party " "Python modules, programs and tools, and additional documentation." msgstr "" +"Ο διερμηνέας της Python και η εκτεταμένη τυπική (standard) βιβλιοθήκη " +"διατίθενται ελεύθερα σε πηγαία ή δυαδική μορφή για όλες τις κύριες " +"πλατφόρμες από την ιστοσελίδα της Python, https://www.python.org/ και " +"μπορούν να διανεμηθούν ελεύθερα. Ο ίδιος ιστότοπος περιέχει επίσης διανομές " +"και δείκτες σε πολλά δωρεάν modules τρίτων, προγράμματα και εργαλεία Python, " +"καθώς και πρόσθετη τεκμηρίωση." -#: tutorial/index.rst:19 +#: tutorial/index.rst:23 msgid "" "The Python interpreter is easily extended with new functions and data types " "implemented in C or C++ (or other languages callable from C). Python is also " "suitable as an extension language for customizable applications." msgstr "" +"Ο διερμηνέας της Python επεκτείνεται εύκολα με νέες συναρτήσεις και τύπους " +"δεδομένων που υλοποιούνται σε C ή C++ (ή άλλες γλώσσες που μπορούν να " +"κληθούν από τη C). Η Python είναι επίσης κατάλληλη ως γλώσσα επέκτασης για " +"προσαρμόσιμες εφαρμογές." -#: tutorial/index.rst:23 +#: tutorial/index.rst:27 msgid "" "This tutorial introduces the reader informally to the basic concepts and " -"features of the Python language and system. It helps to have a Python " -"interpreter handy for hands-on experience, but all examples are self-" +"features of the Python language and system. Be aware that it expects you to " +"have a basic understanding of programming in general. It helps to have a " +"Python interpreter handy for hands-on experience, but all examples are self-" "contained, so the tutorial can be read off-line as well." msgstr "" +"Αυτό το tutorial εισάγει τον αναγνώστη ανεπίσημα στις βασικές έννοιες και " +"δυνατότητες της γλώσσας και του συστήματος Python. Λάβετε υπόψη ότι απαιτεί " +"να έχετε μια βασική κατανόηση του προγραμματισμού γενικά. Βοηθάει να έχετε " +"πρόχειρο έναν διερμηνέα Python για πρακτική εμπειρία, αλλά όλα τα " +"παραδείγματα είναι αυτοτελή, οπότε το tutorial μπορεί να διαβαστεί και εκτός " +"σύνδεσης." -#: tutorial/index.rst:28 +#: tutorial/index.rst:33 msgid "" "For a description of standard objects and modules, see :ref:`library-" "index`. :ref:`reference-index` gives a more formal definition of the " "language. To write extensions in C or C++, read :ref:`extending-index` and :" "ref:`c-api-index`. There are also several books covering Python in depth." msgstr "" +"Για μια περιγραφή των τυποποιημένων αντικειμένων και ενοτήτων, δείτε :ref:" +"`library-index`. Το :ref:`reference-index` δίνει έναν πιο επίσημο ορισμό της " +"γλώσσας. Για να γράψετε επεκτάσεις σε C ή C++, διαβάστε το :ref:`extending-" +"index` και το :ref:`c-api-index`. Υπάρχουν επίσης αρκετά βιβλία που " +"καλύπτουν την Python σε βάθος." -#: tutorial/index.rst:33 +#: tutorial/index.rst:38 msgid "" "This tutorial does not attempt to be comprehensive and cover every single " "feature, or even every commonly used feature. Instead, it introduces many of " @@ -70,7 +108,15 @@ msgid "" "write Python modules and programs, and you will be ready to learn more about " "the various Python library modules described in :ref:`library-index`." msgstr "" +"Αυτό το tutorial δεν προσπαθεί να είναι περιεκτικό και να καλύψει κάθε " +"χαρακτηριστικό ή ακόμη και κάθε συχνά χρησιμοποιούμενο χαρακτηριστικό. " +"Αντίθετα, θα σας παρουσιάσει πολλά από τα πιο αξιοσημείωτα χαρακτηριστικά " +"της Python και θα σας δώσει μια καλή ιδέα για τη γεύση και το ύφος της " +"γλώσσας. Αφού το διαβάσετε, θα είστε σε θέση να διαβάζετε και να γράφετε " +"modules και προγράμματα Python, και θα είστε έτοιμοι να μάθετε περισσότερα " +"για τα διάφoρα modules βιβλιοθηκών Python που περιγράφονται στο :ref:" +"`library-index`." -#: tutorial/index.rst:40 +#: tutorial/index.rst:45 msgid "The :ref:`glossary` is also worth going through." -msgstr "" +msgstr "Αξίζει επίσης να διαβάσετε το :ref:`glossary`." diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index d66e0182..866b0583 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-09-20 11:10+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -74,20 +74,61 @@ msgstr "" "μια έκφραση Python μεταξύ χαρακτήρων ``{`` και ``}`` που μπορεί να " "αναφέρεται σε μεταβλητές ή κυριολεκτικές τιμές." +#: tutorial/inputoutput.rst:32 +msgid "" +">>> year = 2016\n" +">>> event = 'Referendum'\n" +">>> f'Results of the {year} {event}'\n" +"'Results of the 2016 Referendum'" +msgstr "" +">>> year = 2016\n" +">>> event = 'Referendum'\n" +">>> f'Results of the {year} {event}'\n" +"'Results of the 2016 Referendum'" + #: tutorial/inputoutput.rst:37 msgid "" "The :meth:`str.format` method of strings requires more manual effort. " "You'll still use ``{`` and ``}`` to mark where a variable will be " "substituted and can provide detailed formatting directives, but you'll also " -"need to provide the information to be formatted." +"need to provide the information to be formatted. In the following code block " +"there are two examples of how to format variables:" msgstr "" "Η μέθοδος :meth:`str.format` των συμβολοσειρών απαιτεί περισσότερη μη " "χειροκίνητη προσπάθεια. Θα εξακολουθείτε να χρησιμοποιείτε τα ``{`` και ``}" "`` για να επισημάνετε που θα αντικατασταθεί μια μεταβλητή και μπορεί να " "παρέχει λεπτομερείς οδηγίες μορφοποίησης, αλλά θα χρειαστεί επίσης να " -"παρέχετε τις πληροφορίες που θα μορφοποιήσετε." +"παρέχετε τις πληροφορίες που θα μορφοποιήσετε. Στο παρακάτω μπλοκ κώδικα " +"υπάρχουν δύο παραδείγματα για τον τρόπο μορφοποίησης μεταβλητών:" + +#: tutorial/inputoutput.rst:46 +msgid "" +">>> yes_votes = 42_572_654\n" +">>> total_votes = 85_705_149\n" +">>> percentage = yes_votes / total_votes\n" +">>> '{:-9} YES votes {:2.2%}'.format(yes_votes, percentage)\n" +"' 42572654 YES votes 49.67%'" +msgstr "" +">>> yes_votes = 42_572_654\n" +">>> total_votes = 85_705_149\n" +">>> percentage = yes_votes / total_votes\n" +">>> '{:-9} YES votes {:2.2%}'.format(yes_votes, percentage)\n" +"' 42572654 YES votes 49.67%'" + +#: tutorial/inputoutput.rst:52 +msgid "" +"Notice how the ``yes_votes`` are padded with spaces and a negative sign only " +"for negative numbers. The example also prints ``percentage`` multiplied by " +"100, with 2 decimal places and followed by a percent sign (see :ref:" +"`formatspec` for details)." +msgstr "" +"Παρατηρήστε πως τα ``yes_votes`` συμπληρώνονται με κενά και αρνητικό πρόσημο " +"μόνο για αρνητικούς αριθμούς. Το παράδειγμα εκτυπώνει επίσης το " +"``percentage`` πολλαπλασιασμένο επί 100, με 2 δεκαδικά ψηφία και " +"ακολουθούμενο από ένα σύμβολο ποσοστού (δείτε το :ref:`formatspec` για " +"λεπτομέρειες)." -#: tutorial/inputoutput.rst:50 +#: tutorial/inputoutput.rst:57 msgid "" "Finally, you can do all the string handling yourself by using string slicing " "and concatenation operations to create any layout you can imagine. The " @@ -100,7 +141,7 @@ msgstr "" "συμβολοσειράς έχει ορισμένες μεθόδους που εκτελούν χρήσιμες λειτουργίες για " "την προσθήκη συμβολοσειρών σε ένα δεδομένο πλάτος στήλης." -#: tutorial/inputoutput.rst:55 +#: tutorial/inputoutput.rst:62 msgid "" "When you don't need fancy output but just want a quick display of some " "variables for debugging purposes, you can convert any value to a string with " @@ -111,7 +152,7 @@ msgstr "" "μετατρέψετε οποιαδήποτε τιμή σε μια συμβολοσειρά με τις συναρτήσεις :func:" "`repr` ή :func:`str`." -#: tutorial/inputoutput.rst:59 +#: tutorial/inputoutput.rst:66 msgid "" "The :func:`str` function is meant to return representations of values which " "are fairly human-readable, while :func:`repr` is meant to generate " @@ -132,27 +173,73 @@ msgstr "" "αναπαράσταση χρησιμοποιώντας οποιαδήποτε συνάρτηση. Τα strings, " "συγκεκριμένα, έχουν δύο διακριτές παραστάσεις." -#: tutorial/inputoutput.rst:68 +#: tutorial/inputoutput.rst:75 msgid "Some examples::" msgstr "Μερικά παραδείγματα::" -#: tutorial/inputoutput.rst:91 +#: tutorial/inputoutput.rst:77 +msgid "" +">>> s = 'Hello, world.'\n" +">>> str(s)\n" +"'Hello, world.'\n" +">>> repr(s)\n" +"\"'Hello, world.'\"\n" +">>> str(1/7)\n" +"'0.14285714285714285'\n" +">>> x = 10 * 3.25\n" +">>> y = 200 * 200\n" +">>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'\n" +">>> print(s)\n" +"The value of x is 32.5, and y is 40000...\n" +">>> # The repr() of a string adds string quotes and backslashes:\n" +">>> hello = 'hello, world\\n'\n" +">>> hellos = repr(hello)\n" +">>> print(hellos)\n" +"'hello, world\\n'\n" +">>> # The argument to repr() may be any Python object:\n" +">>> repr((x, y, ('spam', 'eggs')))\n" +"\"(32.5, 40000, ('spam', 'eggs'))\"" +msgstr "" +">>> s = 'Hello, world.'\n" +">>> str(s)\n" +"'Hello, world.'\n" +">>> repr(s)\n" +"\"'Hello, world.'\"\n" +">>> str(1/7)\n" +"'0.14285714285714285'\n" +">>> x = 10 * 3.25\n" +">>> y = 200 * 200\n" +">>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'\n" +">>> print(s)\n" +"The value of x is 32.5, and y is 40000...\n" +">>> # The repr() of a string adds string quotes and backslashes:\n" +">>> hello = 'hello, world\\n'\n" +">>> hellos = repr(hello)\n" +">>> print(hellos)\n" +"'hello, world\\n'\n" +">>> # The argument to repr() may be any Python object:\n" +">>> repr((x, y, ('spam', 'eggs')))\n" +"\"(32.5, 40000, ('spam', 'eggs'))\"" + +#: tutorial/inputoutput.rst:98 msgid "" -"The :mod:`string` module contains a :class:`~string.Template` class that " -"offers yet another way to substitute values into strings, using placeholders " -"like ``$x`` and replacing them with values from a dictionary, but offers " -"much less control of the formatting." +"The :mod:`string` module contains support for a simple templating approach " +"based upon regular expressions, via :class:`string.Template`. This offers " +"yet another way to substitute values into strings, using placeholders like " +"``$x`` and replacing them with values from a dictionary. This syntax is easy " +"to use, although it offers much less control for formatting." msgstr "" -"Το module :mod:`string` περιέχει μια κλάση :class:`~string.Template` που " -"προσφέρει έναν ακόμη τρόπο αντικατάστασης τιμών σε συμβολοσειρές, " -"χρησιμοποιώντας placeholders όπως ``$x`` και αντικαθιστώντας τις με τιμές " -"από ένα λεξικό, αλλά προσφέρει πολύ λιγότερο έλεγχο της μορφοποίησης." +"Το :mod:`string` module περιέχει υποστήριξη για μια απλή προσέγγιση " +"templating βασισμένη σε κανονικές εκφράσεις, μέσω της :class:`string." +"Template`. Αυτό προσφέρει έναν ακόμη τρόπο για να αντικαταστήσετε τιμές σε " +"συμβολοσειρές, χρησιμοποιώντας θέσεις κράτησης όπως ``$x`` και " +"αντικαθιστώντας τις με τιμές από ένα λεξικό." -#: tutorial/inputoutput.rst:100 +#: tutorial/inputoutput.rst:115 msgid "Formatted String Literals" msgstr "Μορφοποιημένα String Literals" -#: tutorial/inputoutput.rst:102 +#: tutorial/inputoutput.rst:117 msgid "" ":ref:`Formatted string literals ` (also called f-strings for " "short) let you include the value of Python expressions inside a string by " @@ -164,7 +251,7 @@ msgstr "" "Python μέσα σε μια συμβολοσειρά, θέτοντας πρόθεμα στη συμβολοσειρά με ``f`` " "ή ``F`` και γράφοντας εκφράσεις ως ``{expression}``." -#: tutorial/inputoutput.rst:107 +#: tutorial/inputoutput.rst:122 msgid "" "An optional format specifier can follow the expression. This allows greater " "control over how the value is formatted. The following example rounds pi to " @@ -174,7 +261,17 @@ msgstr "" "έκφραση. Αυτό επιτρέπει μεγαλύτερο έλεγχο στον τρόπο μορφοποίησης της τιμής. " "Το παρακάτω παράδειγμα στρογγυλοποιεί το pi σε τρία ψηφία μετά το δεκαδικό::" -#: tutorial/inputoutput.rst:115 +#: tutorial/inputoutput.rst:126 +msgid "" +">>> import math\n" +">>> print(f'The value of pi is approximately {math.pi:.3f}.')\n" +"The value of pi is approximately 3.142." +msgstr "" +">>> import math\n" +">>> print(f'The value of pi is approximately {math.pi:.3f}.')\n" +"The value of pi is approximately 3.142." + +#: tutorial/inputoutput.rst:130 msgid "" "Passing an integer after the ``':'`` will cause that field to be a minimum " "number of characters wide. This is useful for making columns line up. ::" @@ -183,7 +280,25 @@ msgstr "" "το πεδίο να έχει πλάτος ελάχιστου αριθμού χαρακτήρων. Αυτό είναι χρήσιμο " "για την ευθυγράμμιση στηλών. ::" -#: tutorial/inputoutput.rst:126 +#: tutorial/inputoutput.rst:133 +msgid "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678}\n" +">>> for name, phone in table.items():\n" +"... print(f'{name:10} ==> {phone:10d}')\n" +"...\n" +"Sjoerd ==> 4127\n" +"Jack ==> 4098\n" +"Dcab ==> 7678" +msgstr "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678}\n" +">>> for name, phone in table.items():\n" +"... print(f'{name:10} ==> {phone:10d}')\n" +"...\n" +"Sjoerd ==> 4127\n" +"Jack ==> 4098\n" +"Dcab ==> 7678" + +#: tutorial/inputoutput.rst:141 msgid "" "Other modifiers can be used to convert the value before it is formatted. ``'!" "a'`` applies :func:`ascii`, ``'!s'`` applies :func:`str`, and ``'!r'`` " @@ -193,7 +308,21 @@ msgstr "" "πριν τη μορφοποίηση της. Το ``'!a'`` ισχύει για :func:`ascii`, το ``'!s'`` " "ισχύει για :func:`str`, και το ``'!r'`` ισχύει για :func:`repr`::" -#: tutorial/inputoutput.rst:136 +#: tutorial/inputoutput.rst:145 +msgid "" +">>> animals = 'eels'\n" +">>> print(f'My hovercraft is full of {animals}.')\n" +"My hovercraft is full of eels.\n" +">>> print(f'My hovercraft is full of {animals!r}.')\n" +"My hovercraft is full of 'eels'." +msgstr "" +">>> animals = 'eels'\n" +">>> print(f'My hovercraft is full of {animals}.')\n" +"My hovercraft is full of eels.\n" +">>> print(f'My hovercraft is full of {animals!r}.')\n" +"My hovercraft is full of 'eels'." + +#: tutorial/inputoutput.rst:151 msgid "" "The ``=`` specifier can be used to expand an expression to the text of the " "expression, an equal sign, then the representation of the evaluated " @@ -203,7 +332,7 @@ msgstr "" "έκφραση στο κείμενο της έκφρασης, ένα σύμβολο ίσο, και μετά την αναπαράσταση " "της αξιολογούμενης έκφρασης:" -#: tutorial/inputoutput.rst:145 +#: tutorial/inputoutput.rst:160 msgid "" "See :ref:`self-documenting expressions ` for more " "information on the ``=`` specifier. For a reference on these format " @@ -214,15 +343,23 @@ msgstr "" "αναφορά σε αυτές τις προδιαγραφές μορφής, ανατρέξτε στον οδηγό αναφοράς για " "το :ref:`formatspec`." -#: tutorial/inputoutput.rst:152 +#: tutorial/inputoutput.rst:167 msgid "The String format() Method" msgstr "Η μέθοδος String format()" -#: tutorial/inputoutput.rst:154 +#: tutorial/inputoutput.rst:169 msgid "Basic usage of the :meth:`str.format` method looks like this::" msgstr "Η βασική χρήση της μεθόδου :meth:`str.format` μοιάζει με αυτό::" -#: tutorial/inputoutput.rst:159 +#: tutorial/inputoutput.rst:171 +msgid "" +">>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\n" +"We are the knights who say \"Ni!\"" +msgstr "" +">>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\n" +"We are the knights who say \"Ni!\"" + +#: tutorial/inputoutput.rst:174 msgid "" "The brackets and characters within them (called format fields) are replaced " "with the objects passed into the :meth:`str.format` method. A number in the " @@ -235,7 +372,19 @@ msgstr "" "αναφέρεται στη θέση του αντικειμένου που μεταβιβάζεται στη μέθοδο :meth:`str." "format`. ::" -#: tutorial/inputoutput.rst:169 +#: tutorial/inputoutput.rst:179 +msgid "" +">>> print('{0} and {1}'.format('spam', 'eggs'))\n" +"spam and eggs\n" +">>> print('{1} and {0}'.format('spam', 'eggs'))\n" +"eggs and spam" +msgstr "" +">>> print('{0} and {1}'.format('spam', 'eggs'))\n" +"spam and eggs\n" +">>> print('{1} and {0}'.format('spam', 'eggs'))\n" +"eggs and spam" + +#: tutorial/inputoutput.rst:184 msgid "" "If keyword arguments are used in the :meth:`str.format` method, their values " "are referred to by using the name of the argument. ::" @@ -243,12 +392,32 @@ msgstr "" "Εάν χρησιμοποιούνται keyword ορίσματα στη μέθοδο :meth:`str.format`, οι " "τιμές τους αναφέρονται χρησιμοποιώντας το όνομα του ορίσματος. ::" -#: tutorial/inputoutput.rst:176 +#: tutorial/inputoutput.rst:187 +msgid "" +">>> print('This {food} is {adjective}.'.format(\n" +"... food='spam', adjective='absolutely horrible'))\n" +"This spam is absolutely horrible." +msgstr "" +">>> print('This {food} is {adjective}.'.format(\n" +"... food='spam', adjective='absolutely horrible'))\n" +"This spam is absolutely horrible." + +#: tutorial/inputoutput.rst:191 msgid "Positional and keyword arguments can be arbitrarily combined::" msgstr "" "Τα ορίσματα θέσης και λέξης-κλειδιού μπορούν να συνδυαστούν αυθαίρετα::" -#: tutorial/inputoutput.rst:182 +#: tutorial/inputoutput.rst:193 +msgid "" +">>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',\n" +"... other='Georg'))\n" +"The story of Bill, Manfred, and Georg." +msgstr "" +">>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',\n" +"... other='Georg'))\n" +"The story of Bill, Manfred, and Georg." + +#: tutorial/inputoutput.rst:197 msgid "" "If you have a really long format string that you don't want to split up, it " "would be nice if you could reference the variables to be formatted by name " @@ -260,7 +429,19 @@ msgstr "" "όνομα αντί για τη θέση. Αυτό μπορεί να γίνει απλά περνώντας το λεξικό και " "χρησιμοποιώντας αγκύλες ``'[]'`` για πρόσβαση στα κλειδιά ::" -#: tutorial/inputoutput.rst:192 +#: tutorial/inputoutput.rst:202 +msgid "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" +">>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '\n" +"... 'Dcab: {0[Dcab]:d}'.format(table))\n" +"Jack: 4098; Sjoerd: 4127; Dcab: 8637678" +msgstr "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" +">>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '\n" +"... 'Dcab: {0[Dcab]:d}'.format(table))\n" +"Jack: 4098; Sjoerd: 4127; Dcab: 8637678" + +#: tutorial/inputoutput.rst:207 msgid "" "This could also be done by passing the ``table`` dictionary as keyword " "arguments with the ``**`` notation. ::" @@ -268,16 +449,40 @@ msgstr "" "Αυτό θα μπορούσε επίσης να γίνει περνώντας το λεξικό ``table`` ως ορίσματα " "λέξεων-κλειδιών με την σημείωση ``**``. ::" -#: tutorial/inputoutput.rst:199 +#: tutorial/inputoutput.rst:210 +msgid "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." +"format(**table))\n" +"Jack: 4098; Sjoerd: 4127; Dcab: 8637678" +msgstr "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." +"format(**table))\n" +"Jack: 4098; Sjoerd: 4127; Dcab: 8637678" + +#: tutorial/inputoutput.rst:214 msgid "" "This is particularly useful in combination with the built-in function :func:" -"`vars`, which returns a dictionary containing all local variables." +"`vars`, which returns a dictionary containing all local variables::" msgstr "" "Αυτό είναι ιδιαίτερα χρήσιμο σε συνδυασμό με την ενσωματωμένη (built-in) " "συνάρτηση :func:`vars`, η οποία επιστρέφει ένα λεξικό που περιέχει όλες τις " -"τοπικές μεταβλητές." +"τοπικές μεταβλητές::" -#: tutorial/inputoutput.rst:202 +#: tutorial/inputoutput.rst:217 +msgid "" +">>> table = {k: str(v) for k, v in vars().items()}\n" +">>> message = \" \".join([f'{k}: ' + '{' + k +'};' for k in table.keys()])\n" +">>> print(message.format(**table))\n" +"__name__: __main__; __doc__: None; __package__: None; __loader__: ..." +msgstr "" +">>> table = {k: str(v) for k, v in vars().items()}\n" +">>> message = \" \".join([f'{k}: ' + '{' + k +'};' for k in table.keys()])\n" +">>> print(message.format(**table))\n" +"__name__: __main__; __doc__: None; __package__: None; __loader__: ..." + +#: tutorial/inputoutput.rst:222 msgid "" "As an example, the following lines produce a tidily aligned set of columns " "giving integers and their squares and cubes::" @@ -285,7 +490,37 @@ msgstr "" "Για παράδειγμα, οι ακόλουθες γραμμές παράγουν ένα τακτοποιημένο σύνολο " "στηλών που δίνουν ακέραιους αριθμούς και τα τετράγωνα και τους κύβους τους::" -#: tutorial/inputoutput.rst:219 +#: tutorial/inputoutput.rst:225 +msgid "" +">>> for x in range(1, 11):\n" +"... print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))\n" +"...\n" +" 1 1 1\n" +" 2 4 8\n" +" 3 9 27\n" +" 4 16 64\n" +" 5 25 125\n" +" 6 36 216\n" +" 7 49 343\n" +" 8 64 512\n" +" 9 81 729\n" +"10 100 1000" +msgstr "" +">>> for x in range(1, 11):\n" +"... print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))\n" +"...\n" +" 1 1 1\n" +" 2 4 8\n" +" 3 9 27\n" +" 4 16 64\n" +" 5 25 125\n" +" 6 36 216\n" +" 7 49 343\n" +" 8 64 512\n" +" 9 81 729\n" +"10 100 1000" + +#: tutorial/inputoutput.rst:239 msgid "" "For a complete overview of string formatting with :meth:`str.format`, see :" "ref:`formatstrings`." @@ -293,16 +528,50 @@ msgstr "" "Για μια πλήρη επισκόπηση της μορφοποίησης συμβολοσειρών με :meth:`str." "format`, δείτε :ref:`formatstrings`." -#: tutorial/inputoutput.rst:224 +#: tutorial/inputoutput.rst:244 msgid "Manual String Formatting" msgstr "Χειροκίνητη Μορφοποίηση Συμβολοσειρών" -#: tutorial/inputoutput.rst:226 +#: tutorial/inputoutput.rst:246 msgid "Here's the same table of squares and cubes, formatted manually::" msgstr "" "Ακολουθεί ο ίδιος πίνακας τετραγώνων και κύβων, μορφοποιημένος χειροκίνητα::" -#: tutorial/inputoutput.rst:244 +#: tutorial/inputoutput.rst:248 +msgid "" +">>> for x in range(1, 11):\n" +"... print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')\n" +"... # Note use of 'end' on previous line\n" +"... print(repr(x*x*x).rjust(4))\n" +"...\n" +" 1 1 1\n" +" 2 4 8\n" +" 3 9 27\n" +" 4 16 64\n" +" 5 25 125\n" +" 6 36 216\n" +" 7 49 343\n" +" 8 64 512\n" +" 9 81 729\n" +"10 100 1000" +msgstr "" +">>> for x in range(1, 11):\n" +"... print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')\n" +"... # Note use of 'end' on previous line\n" +"... print(repr(x*x*x).rjust(4))\n" +"...\n" +" 1 1 1\n" +" 2 4 8\n" +" 3 9 27\n" +" 4 16 64\n" +" 5 25 125\n" +" 6 36 216\n" +" 7 49 343\n" +" 8 64 512\n" +" 9 81 729\n" +"10 100 1000" + +#: tutorial/inputoutput.rst:264 msgid "" "(Note that the one space between each column was added by the way :func:" "`print` works: it always adds spaces between its arguments.)" @@ -310,7 +579,7 @@ msgstr "" "(Σημειώστε ότι το ένα κενό μεταξύ κάθε στήλης προστέθηκε με τον τρόπο που " "λειτουργεί το :func:`print`: προσθέτει πάντα κενά μεταξύ των ορισμάτων του.)" -#: tutorial/inputoutput.rst:247 +#: tutorial/inputoutput.rst:267 msgid "" "The :meth:`str.rjust` method of string objects right-justifies a string in a " "field of a given width by padding it with spaces on the left. There are " @@ -331,7 +600,7 @@ msgstr "" "ήταν ψέματα για μια τιμή. (Αν θέλετε πραγματικά περικοπή, μπορείτε πάντα να " "προσθέσετε μια λειτουργία slice, όπως στο ``x.ljust(n)[:n]``.)" -#: tutorial/inputoutput.rst:256 +#: tutorial/inputoutput.rst:276 msgid "" "There is another method, :meth:`str.zfill`, which pads a numeric string on " "the left with zeros. It understands about plus and minus signs::" @@ -340,35 +609,62 @@ msgstr "" "αριθμητική συμβολοσειρά στα αριστερά με μηδενικά. Καταλαβαίνει τα σύμβολα " "συν και πλην::" -#: tutorial/inputoutput.rst:268 +#: tutorial/inputoutput.rst:279 +msgid "" +">>> '12'.zfill(5)\n" +"'00012'\n" +">>> '-3.14'.zfill(7)\n" +"'-003.14'\n" +">>> '3.14159265359'.zfill(5)\n" +"'3.14159265359'" +msgstr "" +">>> '12'.zfill(5)\n" +"'00012'\n" +">>> '-3.14'.zfill(7)\n" +"'-003.14'\n" +">>> '3.14159265359'.zfill(5)\n" +"'3.14159265359'" + +#: tutorial/inputoutput.rst:288 msgid "Old string formatting" msgstr "Παλιά μορφοποίηση συμβολοσειράς" -#: tutorial/inputoutput.rst:270 +#: tutorial/inputoutput.rst:290 msgid "" "The % operator (modulo) can also be used for string formatting. Given " -"``'string' % values``, instances of ``%`` in ``string`` are replaced with " -"zero or more elements of ``values``. This operation is commonly known as " -"string interpolation. For example::" +"``format % values`` (where *format* is a string), ``%`` conversion " +"specifications in *format* are replaced with zero or more elements of " +"*values*. This operation is commonly known as string interpolation. For " +"example::" msgstr "" "Ο τελεστής % (modulo) μπορεί επίσης να χρησιμοποιηθεί για τη μορφοποίηση " -"συμβολοσειρών. Δεδομένων των τιμών ``'string' % values``, στιγμιότυπα του " -"``%`` στο ``string`` αντικαθίστανται με μηδέν ή περισσότερα στοιχεία των " -"``τιμών``. Αυτή η λειτουργία είναι συνήθως γνωστή ως παρεμβολή " -"συμβολοσειρών. Για παράδειγμα::" +"συμβολοσειρών. Δεδομένων των τιμών ``format % values`` (όπου *format* είναι " +"μια συμβολοσειρά), οι προδιαγραφές μετατροπής ``%`` σε *format* " +"αντικαθίστανται με μηδέν ή περισσότερα στοιχεία *τιμών*. Αυτή η λειτουργία " +"είναι κοινώς γνωστή ως παρεμβολή συμβολοσειρών. Για παράδειγμα::" -#: tutorial/inputoutput.rst:279 +#: tutorial/inputoutput.rst:297 +msgid "" +">>> import math\n" +">>> print('The value of pi is approximately %5.3f.' % math.pi)\n" +"The value of pi is approximately 3.142." +msgstr "" +">>> import math\n" +">>> print('The value of pi is approximately %5.3f.' % math.pi)\n" +"The value of pi is approximately 3.142." + +#: tutorial/inputoutput.rst:301 msgid "" "More information can be found in the :ref:`old-string-formatting` section." msgstr "" "Περισσότερες πληροφορίες μπορείτε να βρείτε στην ενότητα :ref:`old-string-" "formatting`." -#: tutorial/inputoutput.rst:285 +#: tutorial/inputoutput.rst:307 msgid "Reading and Writing Files" msgstr "Ανάγνωση και Εγγραφή Αρχείων" -#: tutorial/inputoutput.rst:291 +#: tutorial/inputoutput.rst:313 msgid "" ":func:`open` returns a :term:`file object`, and is most commonly used with " "two positional arguments and one keyword argument: ``open(filename, mode, " @@ -378,7 +674,11 @@ msgstr "" "συχνά με δύο ορίσματα θέσης και ένα όρισμα λέξης-κλειδιού: ``open(filename, " "mode, encoding=None)``" -#: tutorial/inputoutput.rst:304 +#: tutorial/inputoutput.rst:319 +msgid ">>> f = open('workfile', 'w', encoding=\"utf-8\")" +msgstr ">>> f = open('workfile', 'w', encoding=\"utf-8\")" + +#: tutorial/inputoutput.rst:326 msgid "" "The first argument is a string containing the filename. The second argument " "is another string containing a few characters describing the way in which " @@ -399,7 +699,7 @@ msgstr "" "τόσο για ανάγνωση όσο και για γραφή. Το όρισμα *mode* είναι προαιρετικό· το " "``'r'`` θα θεωρείται εάν παραληφθεί." -#: tutorial/inputoutput.rst:313 +#: tutorial/inputoutput.rst:335 msgid "" "Normally, files are opened in :dfn:`text mode`, that means, you read and " "write strings from and to the file, which are encoded in a specific " @@ -422,7 +722,7 @@ msgstr "" "μπορείτε να καθορίσετε *κωδικοποίηση* όταν ανοίγετε αρχείο σε δυαδική " "λειτουργία." -#: tutorial/inputoutput.rst:323 +#: tutorial/inputoutput.rst:345 msgid "" "In text mode, the default when reading is to convert platform-specific line " "endings (``\\n`` on Unix, ``\\r\\n`` on Windows) to just ``\\n``. When " @@ -442,7 +742,7 @@ msgstr "" "`EXE`. Να είστε πολύ προσεκτικοί να χρησιμοποιείτε τη δυαδική λειτουργία " "όταν διαβάζετε και γράφετε τέτοια αρχεία." -#: tutorial/inputoutput.rst:331 +#: tutorial/inputoutput.rst:353 msgid "" "It is good practice to use the :keyword:`with` keyword when dealing with " "file objects. The advantage is that the file is properly closed after its " @@ -457,7 +757,23 @@ msgstr "" "πολύ πιο σύντομο από την σύνταξη ισοδύναμου :keyword:`try`\\ -\\ :keyword:" "`finally` blocks::" -#: tutorial/inputoutput.rst:344 +#: tutorial/inputoutput.rst:359 +msgid "" +">>> with open('workfile', encoding=\"utf-8\") as f:\n" +"... read_data = f.read()\n" +"\n" +">>> # We can check that the file has been automatically closed.\n" +">>> f.closed\n" +"True" +msgstr "" +">>> with open('workfile', encoding=\"utf-8\") as f:\n" +"... read_data = f.read()\n" +"\n" +">>> # We can check that the file has been automatically closed.\n" +">>> f.closed\n" +"True" + +#: tutorial/inputoutput.rst:366 msgid "" "If you're not using the :keyword:`with` keyword, then you should call ``f." "close()`` to close the file and immediately free up any system resources " @@ -467,7 +783,7 @@ msgstr "" "τη ``f.close()`` για να κλείσετε το αρχείο και να ελευθερώσετε αμέσως τυχόν " "πόρους συστήματος που χρησιμοποιούνται από αυτό." -#: tutorial/inputoutput.rst:349 +#: tutorial/inputoutput.rst:371 msgid "" "Calling ``f.write()`` without using the :keyword:`!with` keyword or calling " "``f.close()`` **might** result in the arguments of ``f.write()`` not being " @@ -478,7 +794,7 @@ msgstr "" "write()`` να μην εγγραφεί πλήρως στο δίσκο, ακόμα και αν το πρόγραμμα " "εξέλθει με επιτυχία." -#: tutorial/inputoutput.rst:357 +#: tutorial/inputoutput.rst:379 msgid "" "After a file object is closed, either by a :keyword:`with` statement or by " "calling ``f.close()``, attempts to use the file object will automatically " @@ -488,11 +804,25 @@ msgstr "" "είτε καλώντας ``f.close()``, οι προσπάθειες χρήσης του αντικειμένου αρχείου " "θα αποτύχουν αυτόματα. ::" -#: tutorial/inputoutput.rst:371 +#: tutorial/inputoutput.rst:383 +msgid "" +">>> f.close()\n" +">>> f.read()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: I/O operation on closed file." +msgstr "" +">>> f.close()\n" +">>> f.read()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: I/O operation on closed file." + +#: tutorial/inputoutput.rst:393 msgid "Methods of File Objects" msgstr "Μέθοδοι Αντικειμένων Αρχείων" -#: tutorial/inputoutput.rst:373 +#: tutorial/inputoutput.rst:395 msgid "" "The rest of the examples in this section will assume that a file object " "called ``f`` has already been created." @@ -500,7 +830,7 @@ msgstr "" "Τα υπόλοιπα παραδείγματα σε αυτήν την ενότητα θα υποθέσουν ότι ένα " "αντικείμενο αρχείου που ονομάζεται ``f`` έχει ήδη δημιουργηθεί." -#: tutorial/inputoutput.rst:376 +#: tutorial/inputoutput.rst:398 msgid "" "To read a file's contents, call ``f.read(size)``, which reads some quantity " "of data and returns it as a string (in text mode) or bytes object (in binary " @@ -522,7 +852,19 @@ msgstr "" "*size* (σε δυαδική λειτουργία). Εάν έχει φτάσει το τέλος του αρχείου, το ``f." "read()`` θα επιστρέψει μια κενή συμβολοσειρά (``''``). ::" -#: tutorial/inputoutput.rst:390 +#: tutorial/inputoutput.rst:407 +msgid "" +">>> f.read()\n" +"'This is the entire file.\\n'\n" +">>> f.read()\n" +"''" +msgstr "" +">>> f.read()\n" +"'This is the entire file.\\n'\n" +">>> f.read()\n" +"''" + +#: tutorial/inputoutput.rst:412 msgid "" "``f.readline()`` reads a single line from the file; a newline character " "(``\\n``) is left at the end of the string, and is only omitted on the last " @@ -539,7 +881,23 @@ msgstr "" "κενή γραμμή αντιπροσωπεύεται από ``'\\n'``, μια συμβολοσειρά που περιέχει " "μόνο μία νέα γραμμή. ::" -#: tutorial/inputoutput.rst:404 +#: tutorial/inputoutput.rst:419 +msgid "" +">>> f.readline()\n" +"'This is the first line of the file.\\n'\n" +">>> f.readline()\n" +"'Second line of the file\\n'\n" +">>> f.readline()\n" +"''" +msgstr "" +">>> f.readline()\n" +"'This is the first line of the file.\\n'\n" +">>> f.readline()\n" +"'Second line of the file\\n'\n" +">>> f.readline()\n" +"''" + +#: tutorial/inputoutput.rst:426 msgid "" "For reading lines from a file, you can loop over the file object. This is " "memory efficient, fast, and leads to simple code::" @@ -548,7 +906,21 @@ msgstr "" "αντικείμενο του αρχείου. Αυτό είναι αποδοτικό στη μνήμη, γρήγορο και οδηγεί " "σε απλό κώδικα::" -#: tutorial/inputoutput.rst:413 +#: tutorial/inputoutput.rst:429 +msgid "" +">>> for line in f:\n" +"... print(line, end='')\n" +"...\n" +"This is the first line of the file.\n" +"Second line of the file" +msgstr "" +">>> for line in f:\n" +"... print(line, end='')\n" +"...\n" +"This is the first line of the file.\n" +"Second line of the file" + +#: tutorial/inputoutput.rst:435 msgid "" "If you want to read all the lines of a file in a list you can also use " "``list(f)`` or ``f.readlines()``." @@ -556,7 +928,7 @@ msgstr "" "Εάν θέλετε να διαβάσετε όλες τις γραμμές ενός αρχείου σε μια λίστα, μπορείτε " "επίσης να χρησιμοποιήσετε το ``list(f)`` ή ``f.readlines()``." -#: tutorial/inputoutput.rst:416 +#: tutorial/inputoutput.rst:438 msgid "" "``f.write(string)`` writes the contents of *string* to the file, returning " "the number of characters written. ::" @@ -564,7 +936,15 @@ msgstr "" "Το ``f.write(string)`` γράφει τα περιεχόμενα του *string* στο αρχείο, " "επιστρέφοντας τον αριθμό των χαρακτήρων που γράφτηκαν. ::" -#: tutorial/inputoutput.rst:422 +#: tutorial/inputoutput.rst:441 +msgid "" +">>> f.write('This is a test\\n')\n" +"15" +msgstr "" +">>> f.write('This is a test\\n')\n" +"15" + +#: tutorial/inputoutput.rst:444 msgid "" "Other types of objects need to be converted -- either to a string (in text " "mode) or a bytes object (in binary mode) -- before writing them::" @@ -573,7 +953,19 @@ msgstr "" "(σε λειτουργία κειμένου) ή σε ένα αντικείμενο bytes (σε δυαδική λειτουργία) " "-- πριν τα γράψετε::" -#: tutorial/inputoutput.rst:430 +#: tutorial/inputoutput.rst:447 +msgid "" +">>> value = ('the answer', 42)\n" +">>> s = str(value) # convert the tuple to string\n" +">>> f.write(s)\n" +"18" +msgstr "" +">>> value = ('the answer', 42)\n" +">>> s = str(value) # convert the tuple to string\n" +">>> f.write(s)\n" +"18" + +#: tutorial/inputoutput.rst:452 msgid "" "``f.tell()`` returns an integer giving the file object's current position in " "the file represented as number of bytes from the beginning of the file when " @@ -584,7 +976,7 @@ msgstr "" "αρχή του αρχείου όταν βρίσκεται σε δυαδική λειτουργία και έναν αδιαφανή " "αριθμό όταν βρίσκεται σε λειτουργία κειμένου." -#: tutorial/inputoutput.rst:434 +#: tutorial/inputoutput.rst:456 msgid "" "To change the file object's position, use ``f.seek(offset, whence)``. The " "position is computed from adding *offset* to a reference point; the " @@ -602,7 +994,33 @@ msgstr "" "*whence* μπορεί να παραληφθεί και να οριστεί από προεπιλογή 0, " "χρησιμοποιώντας την αρχή του αρχείου ως σημείο αναφοράς. ::" -#: tutorial/inputoutput.rst:453 +#: tutorial/inputoutput.rst:463 +msgid "" +">>> f = open('workfile', 'rb+')\n" +">>> f.write(b'0123456789abcdef')\n" +"16\n" +">>> f.seek(5) # Go to the 6th byte in the file\n" +"5\n" +">>> f.read(1)\n" +"b'5'\n" +">>> f.seek(-3, 2) # Go to the 3rd byte before the end\n" +"13\n" +">>> f.read(1)\n" +"b'd'" +msgstr "" +">>> f = open('workfile', 'rb+')\n" +">>> f.write(b'0123456789abcdef')\n" +"16\n" +">>> f.seek(5) # Go to the 6th byte in the file\n" +"5\n" +">>> f.read(1)\n" +"b'5'\n" +">>> f.seek(-3, 2) # Go to the 3rd byte before the end\n" +"13\n" +">>> f.read(1)\n" +"b'd'" + +#: tutorial/inputoutput.rst:475 msgid "" "In text files (those opened without a ``b`` in the mode string), only seeks " "relative to the beginning of the file are allowed (the exception being " @@ -617,7 +1035,7 @@ msgstr "" "tell()``, ή μηδέν. Οποιαδήποτε άλλη τιμή *offset* παράγει απροσδιόριστη " "συμπεριφορά." -#: tutorial/inputoutput.rst:459 +#: tutorial/inputoutput.rst:481 msgid "" "File objects have some additional methods, such as :meth:`~io.IOBase.isatty` " "and :meth:`~io.IOBase.truncate` which are less frequently used; consult the " @@ -628,11 +1046,11 @@ msgstr "" "συχνά· συμβουλευτείτε την Αναφορά της Βιβλιοθήκης για έναν πλήρη οδηγό για " "τα αντικείμενα αρχείων." -#: tutorial/inputoutput.rst:467 +#: tutorial/inputoutput.rst:489 msgid "Saving structured data with :mod:`json`" msgstr "Αποθήκευση δομημένων δεδομένων με :mod:`json`" -#: tutorial/inputoutput.rst:471 +#: tutorial/inputoutput.rst:493 msgid "" "Strings can easily be written to and read from a file. Numbers take a bit " "more effort, since the :meth:`~io.TextIOBase.read` method only returns " @@ -649,7 +1067,7 @@ msgstr "" "Όταν θέλετε να αποθηκεύσετε πιο σύνθετους τύπους δεδομένων, όπως ένθετε " "λίστες και λεξικά, η ανάλυση και η σειριοποίηση με το χέρι γίνεται περίπλοκη." -#: tutorial/inputoutput.rst:478 +#: tutorial/inputoutput.rst:500 msgid "" "Rather than having users constantly writing and debugging code to save " "complicated data types to files, Python allows you to use the popular data " @@ -674,7 +1092,7 @@ msgstr "" "δεδομένα ή να έχει σταλεί μέσω μιας σύνδεσης δικτύου σε κάποιο απομακρυσμένο " "μηχάνημα." -#: tutorial/inputoutput.rst:489 +#: tutorial/inputoutput.rst:511 msgid "" "The JSON format is commonly used by modern applications to allow for data " "exchange. Many programmers are already familiar with it, which makes it a " @@ -685,7 +1103,7 @@ msgstr "" "εξοικειωμένοι με αυτήν, γεγονός που την καθιστά καλή επιλογή για " "διαλειτουργικότητα." -#: tutorial/inputoutput.rst:493 +#: tutorial/inputoutput.rst:515 msgid "" "If you have an object ``x``, you can view its JSON string representation " "with a simple line of code::" @@ -693,7 +1111,19 @@ msgstr "" "Εάν έχετε ένα αντικείμενο ``x``, μπορείτε να δείτε την αναπαράσταση " "συμβολοσειράς JSON με μια απλή γραμμή κώδικα::" -#: tutorial/inputoutput.rst:501 +#: tutorial/inputoutput.rst:518 +msgid "" +">>> import json\n" +">>> x = [1, 'simple', 'list']\n" +">>> json.dumps(x)\n" +"'[1, \"simple\", \"list\"]'" +msgstr "" +">>> import json\n" +">>> x = [1, 'simple', 'list']\n" +">>> json.dumps(x)\n" +"'[1, \"simple\", \"list\"]'" + +#: tutorial/inputoutput.rst:523 msgid "" "Another variant of the :func:`~json.dumps` function, called :func:`~json." "dump`, simply serializes the object to a :term:`text file`. So if ``f`` is " @@ -704,7 +1134,11 @@ msgstr "" "Έτσι, εάν το ``f`` είναι ένα αντικείμενο :term:`text file` που ανοίγει για " "εγγραφή, μπορούμε να κάνουμε αυτό::" -#: tutorial/inputoutput.rst:507 +#: tutorial/inputoutput.rst:527 +msgid "json.dump(x, f)" +msgstr "json.dump(x, f)" + +#: tutorial/inputoutput.rst:529 msgid "" "To decode the object again, if ``f`` is a :term:`binary file` or :term:`text " "file` object which has been opened for reading::" @@ -713,7 +1147,11 @@ msgstr "" "αντικείμενο :term:`binary file` ή :term:`text file` που έχει ανοίξει για " "ανάγνωση::" -#: tutorial/inputoutput.rst:513 +#: tutorial/inputoutput.rst:532 +msgid "x = json.load(f)" +msgstr "x = json.load(f)" + +#: tutorial/inputoutput.rst:535 msgid "" "JSON files must be encoded in UTF-8. Use ``encoding=\"utf-8\"`` when opening " "JSON file as a :term:`text file` for both of reading and writing." @@ -722,7 +1160,7 @@ msgstr "" "``encoding=\"utf-8\"`` όταν ανοίγετε το αρχείο JSON ως :term:`text file` " "τόσο για ανάγνωση όσο και για εγγραφή." -#: tutorial/inputoutput.rst:516 +#: tutorial/inputoutput.rst:538 msgid "" "This simple serialization technique can handle lists and dictionaries, but " "serializing arbitrary class instances in JSON requires a bit of extra " @@ -734,11 +1172,11 @@ msgstr "" "επιπλέον προσπάθεια. Η αναφορά για το module :mod:`json` περιέχει μια " "εξήγηση για αυτό." -#: tutorial/inputoutput.rst:522 +#: tutorial/inputoutput.rst:544 msgid ":mod:`pickle` - the pickle module" msgstr ":mod:`pickle` - το pickle module" -#: tutorial/inputoutput.rst:524 +#: tutorial/inputoutput.rst:546 msgid "" "Contrary to :ref:`JSON `, *pickle* is a protocol which allows the " "serialization of arbitrarily complex Python objects. As such, it is " @@ -755,26 +1193,54 @@ msgstr "" "που προέρχονται από μια μη αξιόπιστη πηγή μπορεί να εκτελέσει αυθαίρετο " "κώδικα, εάν τα δεδομένα έχουν δημιουργηθεί από έναν έμπειρο εισβολέα." -#: tutorial/inputoutput.rst:287 +#: tutorial/inputoutput.rst:104 +msgid "formatted string literal" +msgstr "μορφοποιημένα String Literals" + +#: tutorial/inputoutput.rst:104 +msgid "interpolated string literal" +msgstr "παρεμβαλλόμενα String Literals" + +#: tutorial/inputoutput.rst:104 +msgid "string" +msgstr "string" + +#: tutorial/inputoutput.rst:104 +msgid "formatted literal" +msgstr "Μορφοποιημένα Literals" + +#: tutorial/inputoutput.rst:104 +msgid "interpolated literal" +msgstr "παρεμβαλλόμενα literal" + +#: tutorial/inputoutput.rst:104 +msgid "f-string" +msgstr "f-string" + +#: tutorial/inputoutput.rst:104 +msgid "fstring" +msgstr "fstring" + +#: tutorial/inputoutput.rst:309 msgid "built-in function" msgstr "ενσωματωμένη (built-in) συνάρτηση" -#: tutorial/inputoutput.rst:287 +#: tutorial/inputoutput.rst:309 msgid "open" msgstr "open" -#: tutorial/inputoutput.rst:287 +#: tutorial/inputoutput.rst:309 msgid "object" msgstr "object" -#: tutorial/inputoutput.rst:287 +#: tutorial/inputoutput.rst:309 msgid "file" msgstr "file" -#: tutorial/inputoutput.rst:469 +#: tutorial/inputoutput.rst:491 msgid "module" msgstr "module" -#: tutorial/inputoutput.rst:469 +#: tutorial/inputoutput.rst:491 msgid "json" msgstr "json" diff --git a/tutorial/interactive.po b/tutorial/interactive.po index e02ee1d6..eb596f4a 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-06-05 22:00+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-03 17:14+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -78,17 +78,17 @@ msgid "" "This facility is an enormous step forward compared to earlier versions of " "the interpreter; however, some wishes are left: It would be nice if the " "proper indentation were suggested on continuation lines (the parser knows if " -"an indent token is required next). The completion mechanism might use the " -"interpreter's symbol table. A command to check (or even suggest) matching " -"parentheses, quotes, etc., would also be useful." +"an :data:`~token.INDENT` token is required next). The completion mechanism " +"might use the interpreter's symbol table. A command to check (or even " +"suggest) matching parentheses, quotes, etc., would also be useful." msgstr "" "Αυτή η λειτουργία είναι ένα τεράστιο βήμα προς τα εμπρός σε σύγκριση με τις " -"προηγούμενες εκδόσεις του interpreter∙ ωστόσο, παραμένουν μερικές επιθυμίες: " +"προηγούμενες εκδόσεις του διερμηνέα∙ ωστόσο, παραμένουν μερικές επιθυμίες: " "Θα ήταν ωραίο να προταθεί η κατάλληλη εσοχή στις γραμμές συνέχειας (ο parser " -"γνωρίζει εάν απαιτείται στη συνέχεια ένα διακριτικό εσοχής). Ο μηχανισμός " -"ολοκλήρωσης μπορεί να χρησιμοποιήσει τον πίνακα συμβόλων του interpreter. " -"Θα ήταν επίσης χρήσιμη μια εντολή για να ελέγξετε (ή ακόμα και να " -"προτείνετε) αντίστοιχες παρενθέσεις, εισαγωγικά κ.λπ." +"γνωρίζει εάν ένα :data:`~token.INDENT` token απαιτείται στη συνέχεια). Ο " +"μηχανισμός ολοκλήρωσης μπορεί να χρησιμοποιήσει τον πίνακα συμβόλων του " +"διερμηνέα. Θα ήταν επίσης χρήσιμη μια εντολή για να ελέγξετε (ή ακόμα και " +"να προτείνετε) αντίστοιχες παρενθέσεις, εισαγωγικά κ.λπ." #: tutorial/interactive.rst:45 msgid "" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 70c768c9..c7852a6d 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -8,10 +8,9 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-08-02 23:31+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-04 22:16+0000\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" "Language-Team: LANGUAGE \n" "Language: el\n" "MIME-Version: 1.0\n" @@ -29,15 +28,19 @@ msgstr "Κάνοντας invoke τον Interpreter" #: tutorial/interpreter.rst:13 msgid "" -"The Python interpreter is usually installed as :file:`/usr/local/bin/" -"python3.12` on those machines where it is available; putting :file:`/usr/" -"local/bin` in your Unix shell's search path makes it possible to start it by " -"typing the command:" +"The Python interpreter is usually installed as |" +"usr_local_bin_python_x_dot_y_literal| on those machines where it is " +"available; putting :file:`/usr/local/bin` in your Unix shell's search path " +"makes it possible to start it by typing the command:" msgstr "" -"Ο Interpreter της Python συνήθως είναι εγκατεστημένος ως :file:`/usr/local/" -"bin/python3.12` σε εκείνα τα μηχανήματα όπου είναι διαθέσιμο· βάζοντας :file:" -"`/usr/local/bin` στη διαδρομή αναζήτησης του Unix shell σας επιτρέπει να το " -"εκκινήσετε πληκτρολογώντας την εντολή:" +"Ο διερμηνέας της Python εγκαθίσταται συνήθως ως |" +"usr_local_bin_python_x_dot_y_literal| σε εκείνα τα μηχανήματα όπου είναι " +"διαθέσιμος· βάζοντας :file:`/usr/local/bin` στη διαδρομή αναζήτησης του Unix " +"shell σας επιτρέπει να το εκκινήσετε πληκτρολογώντας την εντολή:" + +#: tutorial/interpreter.rst:17 +msgid "python3.14" +msgstr "python3.14" #: tutorial/interpreter.rst:21 msgid "" @@ -54,14 +57,14 @@ msgstr "" #: tutorial/interpreter.rst:26 msgid "" "On Windows machines where you have installed Python from the :ref:`Microsoft " -"Store `, the :file:`python3.12` command will be available. If " -"you have the :ref:`py.exe launcher ` installed, you can use the :" -"file:`py` command. See :ref:`setting-envvars` for other ways to launch " -"Python." +"Store `, the |python_x_dot_y_literal| command will be " +"available. If you have the :ref:`py.exe launcher ` installed, you " +"can use the :file:`py` command. See :ref:`setting-envvars` for other ways to " +"launch Python." msgstr "" "Σε μηχανήματα με Windows όπου έχετε εγκαταστήσει την Python από το :ref:" -"`Microsoft Store `, η εντολή :file:`python3.12` θα είναι " -"διαθέσιμη. Εάν έχετε το πρόγραμμα εκκίνησης :ref:`py.exe launcher " +"`Microsoft Store `, η εντολή |python_x_dot_y_literal| θα " +"είναι διαθέσιμη. Εάν έχετε το πρόγραμμα εκκίνησης :ref:`py.exe launcher " "` εγκατεστημένο, μπορείτε να χρησιμοποιήσετε την εντολή :file:" "`py`. Βλ. :ref:`setting-envvars` για άλλους τρόπους εκκίνησης της Python." @@ -183,7 +186,7 @@ msgstr "" "``sys.argv[0]`` είναι μια κενή συμβολοσειρά. Όταν το όνομα του script " "δίνεται ως ``'-'`` (που σημαίνει standard είσοδος), το ``sys.argv[0]`` " "ορίζεται ως ``'-'``. Όταν χρησιμοποιείται η *εντολή* :option:`-c`, το ``sys." -"argv[0]``ορίζεται σε ``'-c'``. Όταν χρησιμοποιείται η *εντολή* :option:`-" +"argv[0]`` ορίζεται σε ``'-c'``. Όταν χρησιμοποιείται η *εντολή* :option:`-" "m` , το ``sys.argv[0]`` ορίζεται ως το πλήρες όνομα του module που " "βρίσκεται. Οι επιλογές που βρέθηκαν μετά την *εντολή* :option:`-c` ή το :" "option:`-m` *module* δεν καταναλώνονται από τον επεξεργαστή επιλογών του " @@ -211,6 +214,22 @@ msgstr "" "καλωσορίσματος που αναφέρει τον αριθμό έκδοσης και μια ειδοποίηση " "πνευματικών δικαιωμάτων πριν εκτυπώσει το πρώτο μήνυμα:" +#: tutorial/interpreter.rst:98 +msgid "" +"$ python3.14\n" +"Python 3.14 (default, April 4 2024, 09:25:04)\n" +"[GCC 10.2.0] on linux\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>>" +msgstr "" +"$ python3.14\n" +"Python 3.14 (default, April 4 2024, 09:25:04)\n" +"[GCC 10.2.0] on linux\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>>" + #: tutorial/interpreter.rst:108 msgid "" "Continuation lines are needed when entering a multi-line construct. As an " @@ -219,6 +238,20 @@ msgstr "" "Απαιτούνται γραμμές συνέχειας όταν εισάγεται μια κατασκευή πολλών γραμμών. " "Για παράδειγμα ρίξτε μια ματιά σε αυτήν την δήλωση :keyword:`if`::" +#: tutorial/interpreter.rst:111 +msgid "" +">>> the_world_is_flat = True\n" +">>> if the_world_is_flat:\n" +"... print(\"Be careful not to fall off!\")\n" +"...\n" +"Be careful not to fall off!" +msgstr "" +">>> the_world_is_flat = True\n" +">>> if the_world_is_flat:\n" +"... print(\"Be careful not to fall off!\")\n" +"...\n" +"Be careful not to fall off!" + #: tutorial/interpreter.rst:118 msgid "For more on interactive mode, see :ref:`tut-interac`." msgstr "" @@ -262,6 +295,10 @@ msgstr "" "πρέπει να προστεθεί μια ειδική γραμμή σχολίων ως *πρώτη* γραμμή του " "αρχείου. Η σύνταξη είναι η εξής::" +#: tutorial/interpreter.rst:143 +msgid "# -*- coding: encoding -*-" +msgstr "# -*- coding: encoding -*-" + #: tutorial/interpreter.rst:145 msgid "where *encoding* is one of the valid :mod:`codecs` supported by Python." msgstr "" @@ -277,6 +314,10 @@ msgstr "" "κωδικοποίηση Windows-1252 , η πρώτη γραμμή του αρχείου του πηγαίου κώδικα θα " "πρέπει να είναι::" +#: tutorial/interpreter.rst:150 +msgid "# -*- coding: cp1252 -*-" +msgstr "# -*- coding: cp1252 -*-" + #: tutorial/interpreter.rst:152 msgid "" "One exception to the *first line* rule is when the source code starts with " @@ -288,6 +329,14 @@ msgstr "" "δήλωση κωδικοποίησης θα πρέπει να προστεθεί ως δεύτερη γραμμή του αρχείου. " "Για παράδειγμα::" +#: tutorial/interpreter.rst:156 +msgid "" +"#!/usr/bin/env python3\n" +"# -*- coding: cp1252 -*-" +msgstr "" +"#!/usr/bin/env python3\n" +"# -*- coding: cp1252 -*-" + #: tutorial/interpreter.rst:160 msgid "Footnotes" msgstr "Υποσημειώσεις" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index 381d4707..5df0843c 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Lysandros Nikolaou \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: tutorial/introduction.rst:5 msgid "An Informal Introduction to Python" -msgstr "" +msgstr "Μία Άτυπη Εισαγωγή στην Python" #: tutorial/introduction.rst:7 msgid "" @@ -29,16 +30,27 @@ msgid "" "that a secondary prompt on a line by itself in an example means you must " "type a blank line; this is used to end a multi-line command." msgstr "" +"Στα ακόλουθα παραδείγματα, η είσοδος και η έξοδος διακρίνονται από την " +"παρουσία ή την απουσία prompts (:term:`>>>` και :term:`...`): για να " +"επαναλάβετε το παράδειγμα, πρέπει να πληκτρολογήσετε τα πάντα μετά το " +"prompt, όταν αυτό υπάρχει∙ οι γραμμές που δεν αρχίζουν με prompt είναι " +"έξοδος από τον διερμηνέα. Σημείωση ότι ένα δευτερεύον prompt μόνο του σε μια " +"γραμμή σε ένα παράδειγμα σημαίνει ότι πρέπει να πληκτρολογήσετε μια κενή " +"γραμμή∙ αυτό χρησιμοποιείται για να τερματίσετε μια εντολή πολλών γραμμών." #: tutorial/introduction.rst:16 msgid "" -"You can toggle the display of prompts and output by clicking on ``>>>`` in " -"the upper-right corner of an example box. If you hide the prompts and " -"output for an example, then you can easily copy and paste the input lines " -"into your interpreter." +"You can use the \"Copy\" button (it appears in the upper-right corner when " +"hovering over or tapping a code example), which strips prompts and omits " +"output, to copy and paste the input lines into your interpreter." msgstr "" +"Μπορείτε να χρησιμοποιήσετε το κουμπί \"Copy\" (εμφανίζεται στην επάνω δεξιά " +"γωνία όταν τοποθετείτε τον δείκτη του ποντικιού πάνω από ένα παράδειγμα " +"κώδικα ή πατάτε αυτό), το οποίο αφαιρεί τις προτροπές και παραλείπει την " +"έξοδο, για να αντιγράψετε και να επικολλήσετε τις γραμμές εισόδου στον " +"διερμηνέα σας." -#: tutorial/introduction.rst:23 +#: tutorial/introduction.rst:22 msgid "" "Many of the examples in this manual, even those entered at the interactive " "prompt, include comments. Comments in Python start with the hash character, " @@ -48,86 +60,246 @@ msgid "" "Since comments are to clarify code and are not interpreted by Python, they " "may be omitted when typing in examples." msgstr "" - -#: tutorial/introduction.rst:31 +"Πολλά από τα παραδείγματα σε αυτόν τον οδηγό, ακόμη και αυτά που εισάγονται " +"στο διαδραστικό prompt, περιέχουν σχόλια. Τα σχόλια στην Python ξεκινούν με " +"τον χαρακτήρα hashtag, ``#``, και εκτείνονται μέχρι το τέλος της γραμμής. " +"Ένα σχόλιο μπορεί να εμφανιστεί στην αρχή μιας σειράς ή μετά από κενά " +"διαστήματα ή κώδικα, αλλά όχι μέσα σε μία συμβολοσειρά. Ένας χαρακτήρας " +"hashtag μέσα σε μία συμβολοσειρά είναι απλώς ένας χαρακτήρας hashtag. " +"Δεδομένου ότι τα σχόλια αποσκοπούν στην αποσαφήνιση του κώδικα και δεν " +"ερμηνεύονται από την Python, μπορούν να παραλείπονται κατά την πληκτρολόγηση " +"παραδειγμάτων." + +#: tutorial/introduction.rst:30 msgid "Some examples::" +msgstr "Μερικά παραδείγματα::" + +#: tutorial/introduction.rst:32 +msgid "" +"# this is the first comment\n" +"spam = 1 # and this is the second comment\n" +" # ... and now a third!\n" +"text = \"# This is not a comment because it's inside quotes.\"" msgstr "" +"# this is the first comment\n" +"spam = 1 # and this is the second comment\n" +" # ... and now a third!\n" +"text = \"# This is not a comment because it's inside quotes.\"" -#: tutorial/introduction.rst:42 +#: tutorial/introduction.rst:41 msgid "Using Python as a Calculator" -msgstr "" +msgstr "Χρησιμοποιώντας την Python ως Αριθμομηχανή" -#: tutorial/introduction.rst:44 +#: tutorial/introduction.rst:43 msgid "" "Let's try some simple Python commands. Start the interpreter and wait for " "the primary prompt, ``>>>``. (It shouldn't take long.)" msgstr "" +"Ας δοκιμάσουμε μερικές απλές εντολές της Python. Ξεκινήστε τον διερμηνέα και " +"περιμένετε το πρώτο prompt, ```>>>```. (Δεν θα πάρει πολύ χρόνο.)" -#: tutorial/introduction.rst:51 +#: tutorial/introduction.rst:50 msgid "Numbers" -msgstr "" +msgstr "Αριθμοί" -#: tutorial/introduction.rst:53 +#: tutorial/introduction.rst:52 msgid "" -"The interpreter acts as a simple calculator: you can type an expression at " +"The interpreter acts as a simple calculator: you can type an expression into " "it and it will write the value. Expression syntax is straightforward: the " "operators ``+``, ``-``, ``*`` and ``/`` can be used to perform arithmetic; " "parentheses (``()``) can be used for grouping. For example::" msgstr "" +"Ο διερμηνέας λειτουργεί ως μία απλή αριθμομηχανή: μπορείτε να " +"πληκτρολογήσετε μία έκφραση μέσα σε αυτή και εκείνη θα γράψει την τιμή. Το " +"συντακτικό μίας έκφρασης είναι απλό: οι τελεστές ``+``, ``-``, ``*`` και ``/" +"`` μπορούν να χρησιμοποιηθούν για την εκτέλεση αριθμητικών πράξεων∙ οι " +"παρενθέσεις (``()``) μπορούν να χρησιμοποιηθούν για ομαδοποίηση. Για " +"παράδειγμα::" -#: tutorial/introduction.rst:68 +#: tutorial/introduction.rst:58 +msgid "" +">>> 2 + 2\n" +"4\n" +">>> 50 - 5*6\n" +"20\n" +">>> (50 - 5*6) / 4\n" +"5.0\n" +">>> 8 / 5 # division always returns a floating-point number\n" +"1.6" +msgstr "" +">>> 2 + 2\n" +"4\n" +">>> 50 - 5*6\n" +"20\n" +">>> (50 - 5*6) / 4\n" +"5.0\n" +">>> 8 / 5 # division always returns a floating-point number\n" +"1.6" + +#: tutorial/introduction.rst:67 msgid "" "The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the " "ones with a fractional part (e.g. ``5.0``, ``1.6``) have type :class:" "`float`. We will see more about numeric types later in the tutorial." msgstr "" +"Οι ακέραιοι αριθμοί (π.χ. ``2``, ``4``, ``20``) έχουν τον τύπο :class:`int`, " +"οι αριθμοί με δεκαδικά ψηφία (π.χ. ``5.0``, ``1.6``) έχουν τον τύπο :class:" +"`float`. Θα δούμε περισσότερα για τους αριθμητικούς τύπους αργότερα σε " +"αυτόν τον οδηγό." -#: tutorial/introduction.rst:72 +#: tutorial/introduction.rst:71 msgid "" "Division (``/``) always returns a float. To do :term:`floor division` and " "get an integer result you can use the ``//`` operator; to calculate the " "remainder you can use ``%``::" msgstr "" +"Η διαίρεση (``/``) πάντα επιστρέφει ένα float. Για να κάνετε :term:`floor " +"division` (ακέραια διαίρεση) και να πάρετε ένα ακέραιο αποτέλεσμα, μπορείτε " +"να χρησιμοποιήσετε τον τελεστή ``//`` ∙ για να υπολογίσετε το το υπόλοιπο " +"μίας διαίρεσης, χρησιμοποιήστε τον τελεστή ``%``::" -#: tutorial/introduction.rst:86 +#: tutorial/introduction.rst:75 +msgid "" +">>> 17 / 3 # classic division returns a float\n" +"5.666666666666667\n" +">>>\n" +">>> 17 // 3 # floor division discards the fractional part\n" +"5\n" +">>> 17 % 3 # the % operator returns the remainder of the division\n" +"2\n" +">>> 5 * 3 + 2 # floored quotient * divisor + remainder\n" +"17" +msgstr "" +">>> 17 / 3 # classic division returns a float\n" +"5.666666666666667\n" +">>>\n" +">>> 17 // 3 # floor division discards the fractional part\n" +"5\n" +">>> 17 % 3 # the % operator returns the remainder of the division\n" +"2\n" +">>> 5 * 3 + 2 # floored quotient * divisor + remainder\n" +"17" + +#: tutorial/introduction.rst:85 msgid "" "With Python, it is possible to use the ``**`` operator to calculate powers " "[#]_::" msgstr "" +"Στην Python, είναι εφικτό να χρησιμοποιήσετε τον τελεστή ``**`` για να " +"υπολογίσετε δυνάμεις [#]_::" + +#: tutorial/introduction.rst:87 +msgid "" +">>> 5 ** 2 # 5 squared\n" +"25\n" +">>> 2 ** 7 # 2 to the power of 7\n" +"128" +msgstr "" +">>> 5 ** 2 # 5 squared\n" +"25\n" +">>> 2 ** 7 # 2 to the power of 7\n" +"128" -#: tutorial/introduction.rst:93 +#: tutorial/introduction.rst:92 msgid "" "The equal sign (``=``) is used to assign a value to a variable. Afterwards, " "no result is displayed before the next interactive prompt::" msgstr "" +"Το σύμβολο της ισότητας (``=``) χρησιμοποιείται για την ανάθεση μιας τιμής " +"σε μια μεταβλητή. Στη συνέχεια, δεν εμφανίζεται αποτέλεσμα πριν από το " +"επόμενο διαδραστικό prompt::" + +#: tutorial/introduction.rst:95 +msgid "" +">>> width = 20\n" +">>> height = 5 * 9\n" +">>> width * height\n" +"900" +msgstr "" +">>> width = 20\n" +">>> height = 5 * 9\n" +">>> width * height\n" +"900" -#: tutorial/introduction.rst:101 +#: tutorial/introduction.rst:100 msgid "" "If a variable is not \"defined\" (assigned a value), trying to use it will " "give you an error::" msgstr "" +"Αν μία μεταβλητή δεν έχει «οριστεί» (δεν της έχει αποδοθεί κάποια τιμή), η " +"προσπάθεια χρήσης της θα σας δώσει ένα σφάλμα::" + +#: tutorial/introduction.rst:103 +msgid "" +">>> n # try to access an undefined variable\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"NameError: name 'n' is not defined" +msgstr "" +">>> n # try to access an undefined variable\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"NameError: name 'n' is not defined" -#: tutorial/introduction.rst:109 +#: tutorial/introduction.rst:108 msgid "" "There is full support for floating point; operators with mixed type operands " "convert the integer operand to floating point::" msgstr "" +"Υπάρχει πλήρης υποστήριξη για δεκαδικά ψηφία∙ τελεστές με τελεστέους μικτού " +"τύπου μετατρέπουν τον ακέραιο τελεστέο σε δεκαδικό::" + +#: tutorial/introduction.rst:111 +msgid "" +">>> 4 * 3.75 - 1\n" +"14.0" +msgstr "" +">>> 4 * 3.75 - 1\n" +"14.0" -#: tutorial/introduction.rst:115 +#: tutorial/introduction.rst:114 msgid "" "In interactive mode, the last printed expression is assigned to the variable " "``_``. This means that when you are using Python as a desk calculator, it " "is somewhat easier to continue calculations, for example::" msgstr "" +"Στη διαδραστική λειτουργία, η τελευταία εκτυπωμένη έκφραση εκχωρείται στη " +"μεταβλητή ``_``. Αυτό σημαίνει ότι όταν χρησιμοποιείτε την Python ως " +"αριθμομηχανή γραφείου, είναι κάπως πιο εύκολο να συνεχίσετε προηγούμενους " +"υπολογισμούς, για παράδειγμα:" -#: tutorial/introduction.rst:128 +#: tutorial/introduction.rst:118 +msgid "" +">>> tax = 12.5 / 100\n" +">>> price = 100.50\n" +">>> price * tax\n" +"12.5625\n" +">>> price + _\n" +"113.0625\n" +">>> round(_, 2)\n" +"113.06" +msgstr "" +">>> tax = 12.5 / 100\n" +">>> price = 100.50\n" +">>> price * tax\n" +"12.5625\n" +">>> price + _\n" +"113.0625\n" +">>> round(_, 2)\n" +"113.06" + +#: tutorial/introduction.rst:127 msgid "" "This variable should be treated as read-only by the user. Don't explicitly " "assign a value to it --- you would create an independent local variable with " "the same name masking the built-in variable with its magic behavior." msgstr "" +"Αυτή η μεταβλητή θα πρέπει να αντιμετωπίζεται από τον χρήστη ως μόνο για " +"ανάγνωση. Μην της αναθέτετε ρητά μια τιμή --- θα δημιουργούσατε μια " +"ανεξάρτητη τοπική μεταβλητή με το ίδιο όνομα αποκρύπτοντας την ενσωματωμένη " +"μεταβλητή με τη μαγική της συμπεριφορά." -#: tutorial/introduction.rst:132 +#: tutorial/introduction.rst:131 msgid "" "In addition to :class:`int` and :class:`float`, Python supports other types " "of numbers, such as :class:`~decimal.Decimal` and :class:`~fractions." @@ -135,12 +307,17 @@ msgid "" "`, and uses the ``j`` or ``J`` suffix to indicate the " "imaginary part (e.g. ``3+5j``)." msgstr "" +"Εκτός από :class:`int` και :class:`float`, η Python υποστηρίζει και άλλους " +"τύπους αριθμών, όπως :class:`~decimal.Decimal` και :class:`~fractions." +"Fraction`. Η Python έχει επίσης ενσωματωμένη υποστήριξη για :ref:`complex " +"numbers ` (μιγαδικούς αριθμούς), και χρησιμοποιεί την κατάληξη " +"``j`` ή ``J`` για να δηλώσει το φανταστικό μέρος (π.χ. ``3+5j``)." -#: tutorial/introduction.rst:142 +#: tutorial/introduction.rst:141 msgid "Text" -msgstr "" +msgstr "Κείμενο" -#: tutorial/introduction.rst:144 +#: tutorial/introduction.rst:143 msgid "" "Python can manipulate text (represented by type :class:`str`, so-called " "\"strings\") as well as numbers. This includes characters \"``!``\", words " @@ -148,286 +325,892 @@ msgid "" "\"``Yay! :)``\". They can be enclosed in single quotes (``'...'``) or double " "quotes (``\"...\"``) with the same result [#]_." msgstr "" +"Η Python μπορεί να χειριστεί κείμενο (που αντιπροσωπεύεται από τον τύπο :" +"class:`str`, τις λεγόμενες «συμβολοσειρές») καθώς και αριθμούς. Αυτό " +"περιλαμβάνει χαρακτήρες «``!``», λέξεις «``κουνέλι``», ονόματα «``Παρίσι``», " +"προτάσεις «``Καλύπτω τα νώτα σου.``», κ.λπ. «``Ναι! :)``». Μπορούν να " +"περικλείονται σε μονά εισαγωγικά (``'...'``) ή διπλά εισαγωγικά (``\"..." +"\"``) με το ίδιο αποτέλεσμα [#]_." -#: tutorial/introduction.rst:157 +#: tutorial/introduction.rst:149 +msgid "" +">>> 'spam eggs' # single quotes\n" +"'spam eggs'\n" +">>> \"Paris rabbit got your back :)! Yay!\" # double quotes\n" +"'Paris rabbit got your back :)! Yay!'\n" +">>> '1975' # digits and numerals enclosed in quotes are also strings\n" +"'1975'" +msgstr "" +">>> 'spam eggs' # single quotes\n" +"'spam eggs'\n" +">>> \"Paris rabbit got your back :)! Yay!\" # double quotes\n" +"'Paris rabbit got your back :)! Yay!'\n" +">>> '1975' # digits and numerals enclosed in quotes are also strings\n" +"'1975'" + +#: tutorial/introduction.rst:158 msgid "" "To quote a quote, we need to \"escape\" it, by preceding it with ``\\``. " "Alternatively, we can use the other type of quotation marks::" msgstr "" +"Για να προσθέσουμε ένα εισαγωγικό, πρέπει να το «κάνουμε escape», " +"προτάσσοντάς του μία ``\\``. Εναλλακτικά, μπορούμε να χρησιμοποιήσουμε τον " +"άλλο τύπο εισαγωγικών::" -#: tutorial/introduction.rst:171 +#: tutorial/introduction.rst:161 +msgid "" +">>> 'doesn\\'t' # use \\' to escape the single quote...\n" +"\"doesn't\"\n" +">>> \"doesn't\" # ...or use double quotes instead\n" +"\"doesn't\"\n" +">>> '\"Yes,\" they said.'\n" +"'\"Yes,\" they said.'\n" +">>> \"\\\"Yes,\\\" they said.\"\n" +"'\"Yes,\" they said.'\n" +">>> '\"Isn\\'t,\" they said.'\n" +"'\"Isn\\'t,\" they said.'" +msgstr "" +">>> 'doesn\\'t' # use \\' to escape the single quote...\n" +"\"doesn't\"\n" +">>> \"doesn't\" # ...or use double quotes instead\n" +"\"doesn't\"\n" +">>> '\"Yes,\" they said.'\n" +"'\"Yes,\" they said.'\n" +">>> \"\\\"Yes,\\\" they said.\"\n" +"'\"Yes,\" they said.'\n" +">>> '\"Isn\\'t,\" they said.'\n" +"'\"Isn\\'t,\" they said.'" + +#: tutorial/introduction.rst:172 msgid "" "In the Python shell, the string definition and output string can look " "different. The :func:`print` function produces a more readable output, by " "omitting the enclosing quotes and by printing escaped and special " "characters::" msgstr "" +"Στο shell της Python, ο ορισμός συμβολοσειράς και η συμβολοσειρά εξόδου " +"μπορεί να μοιάζουν διαφορετικά. Η συνάρτηση :func:`print` παράγει μια πιο " +"ευανάγνωστη έξοδο, παραλείποντας τα εισαγωγικά που περικλείουν την " +"συμβολοσειρά και εκτυπώνοντας escaped και ειδικούς χαρακτήρες::" -#: tutorial/introduction.rst:182 +#: tutorial/introduction.rst:176 +msgid "" +">>> s = 'First line.\\nSecond line.' # \\n means newline\n" +">>> s # without print(), special characters are included in the string\n" +"'First line.\\nSecond line.'\n" +">>> print(s) # with print(), special characters are interpreted, so \\n " +"produces new line\n" +"First line.\n" +"Second line." +msgstr "" +">>> s = 'First line.\\nSecond line.' # \\n means newline\n" +">>> s # without print(), special characters are included in the string\n" +"'First line.\\nSecond line.'\n" +">>> print(s) # with print(), special characters are interpreted, so \\n " +"produces new line\n" +"First line.\n" +"Second line." + +#: tutorial/introduction.rst:183 msgid "" "If you don't want characters prefaced by ``\\`` to be interpreted as special " "characters, you can use *raw strings* by adding an ``r`` before the first " "quote::" msgstr "" +"Εάν δεν θέλετε οι χαρακτήρες που προηγούνται από μία ``\\`` να ερμηνεύονται " +"ως ειδικοί χαρακτήρες, μπορείτε να χρησιμοποιήσετε *ακατέργαστες " +"συμβολοσειρές* προσθέτοντας ένα ``r`` πριν από το πρώτο εισαγωγικό::" -#: tutorial/introduction.rst:192 +#: tutorial/introduction.rst:187 +msgid "" +">>> print('C:\\some\\name') # here \\n means newline!\n" +"C:\\some\n" +"ame\n" +">>> print(r'C:\\some\\name') # note the r before the quote\n" +"C:\\some\\name" +msgstr "" +">>> print('C:\\some\\name') # here \\n means newline!\n" +"C:\\some\n" +"ame\n" +">>> print(r'C:\\some\\name') # note the r before the quote\n" +"C:\\some\\name" + +#: tutorial/introduction.rst:193 msgid "" "There is one subtle aspect to raw strings: a raw string may not end in an " "odd number of ``\\`` characters; see :ref:`the FAQ entry ` for more information and workarounds." msgstr "" +"Υπάρχει μια δυσδιάκριτη πτυχή στις ακατέργαστες συμβολοσειρές: μια " +"ακατέργαστη συμβολοσειρά δεν μπορεί να τελειώνει σε περιττό αριθμό " +"χαρακτήρων ``\\``' δείτε :ref:`το λήμμα των Συχνών Ερωτήσεων ` για περισσότερες πληροφορίες και λύσεις." -#: tutorial/introduction.rst:197 +#: tutorial/introduction.rst:198 msgid "" "String literals can span multiple lines. One way is using triple-quotes: " -"``\"\"\"...\"\"\"`` or ``'''...'''``. End of lines are automatically " -"included in the string, but it's possible to prevent this by adding a ``\\`` " -"at the end of the line. The following example::" -msgstr "" - -#: tutorial/introduction.rst:208 +"``\"\"\"...\"\"\"`` or ``'''...'''``. End-of-line characters are " +"automatically included in the string, but it's possible to prevent this by " +"adding a ``\\`` at the end of the line. In the following example, the " +"initial newline is not included::" +msgstr "" +"Οι συμβολοσειρές κυριολεξίας μπορούν να καλύπτουν πολλές γραμμές. Ένας " +"τρόπος είναι χρησιμοποιώντας τριπλά εισαγωγικά: ``\"\"\"...\"\"\"`` ή " +"``'''...'''``. Οι χαρακτήρες στο τέλος των γραμμών συμπεριλαμβάνονται " +"αυτόματα στην συμβολοσειρά, αλλά είναι εφικτό να το αποτρέψετε αυτό " +"προσθέτοντας μία ``\\`` στο τέλος της γραμμής. Στο ακόλουθο παράδειγμα, η " +"αρχική νέα γραμμή δεν περιλαμβάνεται::" + +#: tutorial/introduction.rst:204 msgid "" -"produces the following output (note that the initial newline is not " -"included):" -msgstr "" - -#: tutorial/introduction.rst:216 +">>> print(\"\"\"\\\n" +"... Usage: thingy [OPTIONS]\n" +"... -h Display this usage message\n" +"... -H hostname Hostname to connect to\n" +"... \"\"\")\n" +"Usage: thingy [OPTIONS]\n" +" -h Display this usage message\n" +" -H hostname Hostname to connect to\n" +"\n" +">>>" +msgstr "" +">>> print(\"\"\"\\\n" +"... Usage: thingy [OPTIONS]\n" +"... -h Display this usage message\n" +"... -H hostname Hostname to connect to\n" +"... \"\"\")\n" +"Usage: thingy [OPTIONS]\n" +" -h Display this usage message\n" +" -H hostname Hostname to connect to\n" +"\n" +">>>" + +#: tutorial/introduction.rst:215 msgid "" "Strings can be concatenated (glued together) with the ``+`` operator, and " "repeated with ``*``::" msgstr "" +"Οι συμβολοσειρές μπορούν να συνδεθούν (κολληθούν η μία στην άλλη) με τον " +"τελεστή ``+``, και να επαναληφθούν με τον τελεστή ``*``::" + +#: tutorial/introduction.rst:218 +msgid "" +">>> # 3 times 'un', followed by 'ium'\n" +">>> 3 * 'un' + 'ium'\n" +"'unununium'" +msgstr "" +">>> # 3 times 'un', followed by 'ium'\n" +">>> 3 * 'un' + 'ium'\n" +"'unununium'" -#: tutorial/introduction.rst:223 +#: tutorial/introduction.rst:222 msgid "" "Two or more *string literals* (i.e. the ones enclosed between quotes) next " "to each other are automatically concatenated. ::" msgstr "" +"Δύο ή παραπάνω *συμβολοσειρές* (που περικλείονται σε εισαγωγικά) η μία δίπλα " +"στην άλλη συνδέονται αυτόματα. ::" -#: tutorial/introduction.rst:229 +#: tutorial/introduction.rst:225 +msgid "" +">>> 'Py' 'thon'\n" +"'Python'" +msgstr "" +">>> 'Py' 'thon'\n" +"'Python'" + +#: tutorial/introduction.rst:228 msgid "" "This feature is particularly useful when you want to break long strings::" msgstr "" +"Αυτή η λειτουργία είναι ιδιαίτερα χρήσιμη όταν θέλετε να σπάσετε μεγάλες " +"συμβολοσειρές::" + +#: tutorial/introduction.rst:230 +msgid "" +">>> text = ('Put several strings within parentheses '\n" +"... 'to have them joined together.')\n" +">>> text\n" +"'Put several strings within parentheses to have them joined together.'" +msgstr "" +">>> text = ('Put several strings within parentheses '\n" +"... 'to have them joined together.')\n" +">>> text\n" +"'Put several strings within parentheses to have them joined together.'" -#: tutorial/introduction.rst:236 +#: tutorial/introduction.rst:235 msgid "" "This only works with two literals though, not with variables or expressions::" msgstr "" +"Ωστόσο, αυτό λειτουργεί μόνο με κυριολεκτικές συμβολοσειρές, όχι με " +"μεταβλητές ή εκφράσεις::" -#: tutorial/introduction.rst:250 +#: tutorial/introduction.rst:237 +msgid "" +">>> prefix = 'Py'\n" +">>> prefix 'thon' # can't concatenate a variable and a string literal\n" +" File \"\", line 1\n" +" prefix 'thon'\n" +" ^^^^^^\n" +"SyntaxError: invalid syntax\n" +">>> ('un' * 3) 'ium'\n" +" File \"\", line 1\n" +" ('un' * 3) 'ium'\n" +" ^^^^^\n" +"SyntaxError: invalid syntax" +msgstr "" +">>> prefix = 'Py'\n" +">>> prefix 'thon' # can't concatenate a variable and a string literal\n" +" File \"\", line 1\n" +" prefix 'thon'\n" +" ^^^^^^\n" +"SyntaxError: invalid syntax\n" +">>> ('un' * 3) 'ium'\n" +" File \"\", line 1\n" +" ('un' * 3) 'ium'\n" +" ^^^^^\n" +"SyntaxError: invalid syntax" + +#: tutorial/introduction.rst:249 msgid "" "If you want to concatenate variables or a variable and a literal, use ``+``::" msgstr "" +"Αν θέλετε να συνδέσετε μεταβλητές ή μία μεταβλητή και μία κυριολεκτική " +"συμβολοσειρά, χρησιμοποιήστε το ``+``::" + +#: tutorial/introduction.rst:251 +msgid "" +">>> prefix + 'thon'\n" +"'Python'" +msgstr "" +">>> prefix + 'thon'\n" +"'Python'" -#: tutorial/introduction.rst:255 +#: tutorial/introduction.rst:254 msgid "" "Strings can be *indexed* (subscripted), with the first character having " "index 0. There is no separate character type; a character is simply a string " "of size one::" msgstr "" +"Οι συμβολοσειρές μπορούν να είναι *προσπελάσιμες* (μέσω ευρετηρίου), με τον " +"πρώτο χαρακτήρα να έχει τον δείκτη 0. Δεν υπάρχει ξεχωριστός τύπος για " +"χαρακτήρες∙ ένας χαρακτήρας είναι απλώς μία συμβολοσειρά με μέγεθος ένα::" -#: tutorial/introduction.rst:265 +#: tutorial/introduction.rst:258 +msgid "" +">>> word = 'Python'\n" +">>> word[0] # character in position 0\n" +"'P'\n" +">>> word[5] # character in position 5\n" +"'n'" +msgstr "" +">>> word = 'Python'\n" +">>> word[0] # character in position 0\n" +"'P'\n" +">>> word[5] # character in position 5\n" +"'n'" + +#: tutorial/introduction.rst:264 msgid "" "Indices may also be negative numbers, to start counting from the right::" msgstr "" +"Οι δείκτες μπορούν να είναι και αρνητικοί αριθμοί, για να ξεκινήσετε την " +"αρίθμηση από τα δεξιά::" -#: tutorial/introduction.rst:274 +#: tutorial/introduction.rst:266 +msgid "" +">>> word[-1] # last character\n" +"'n'\n" +">>> word[-2] # second-last character\n" +"'o'\n" +">>> word[-6]\n" +"'P'" +msgstr "" +">>> word[-1] # last character\n" +"'n'\n" +">>> word[-2] # second-last character\n" +"'o'\n" +">>> word[-6]\n" +"'P'" + +#: tutorial/introduction.rst:273 msgid "Note that since -0 is the same as 0, negative indices start from -1." msgstr "" +"Σημειώστε ότι αφού το -0 είναι το ίδιο με το 0, οι αρνητικοί δείκτες " +"ξεκινούν από το -1." -#: tutorial/introduction.rst:276 +#: tutorial/introduction.rst:275 msgid "" "In addition to indexing, *slicing* is also supported. While indexing is " "used to obtain individual characters, *slicing* allows you to obtain a " "substring::" msgstr "" +"Εκτός από την ευρετηρίαση, υποστηρίζεται επίσης ο *τεμαχισμός*. Ενώ η " +"ευρετηρίαση χρησιμοποιείται για την απόκτηση μεμονομένων χαρακτήρων, ο " +"*τεμαχισμός* σας επιτρέπει να αποκτήσετε ένας μέρος της συμβολοσειράς::" -#: tutorial/introduction.rst:284 +#: tutorial/introduction.rst:278 +msgid "" +">>> word[0:2] # characters from position 0 (included) to 2 (excluded)\n" +"'Py'\n" +">>> word[2:5] # characters from position 2 (included) to 5 (excluded)\n" +"'tho'" +msgstr "" +">>> word[0:2] # characters from position 0 (included) to 2 (excluded)\n" +"'Py'\n" +">>> word[2:5] # characters from position 2 (included) to 5 (excluded)\n" +"'tho'" + +#: tutorial/introduction.rst:283 msgid "" "Slice indices have useful defaults; an omitted first index defaults to zero, " "an omitted second index defaults to the size of the string being sliced. ::" msgstr "" +"Οι δείκτες ενός τεμαχισμού έχουν χρήσιμες προεπιλογές∙ η παράλειψη του " +"πρώτου δείκτη έχει ως προεπιλογή το μηδέν, η παράλειψη του δεύτερου δείκτη " +"έχει ως προεπιλογή το μέγεθος της συμβολοσειράς που τεμαχίζεται. ::" -#: tutorial/introduction.rst:294 +#: tutorial/introduction.rst:286 +msgid "" +">>> word[:2] # character from the beginning to position 2 (excluded)\n" +"'Py'\n" +">>> word[4:] # characters from position 4 (included) to the end\n" +"'on'\n" +">>> word[-2:] # characters from the second-last (included) to the end\n" +"'on'" +msgstr "" +">>> word[:2] # character from the beginning to position 2 (excluded)\n" +"'Py'\n" +">>> word[4:] # characters from position 4 (included) to the end\n" +"'on'\n" +">>> word[-2:] # characters from the second-last (included) to the end\n" +"'on'" + +#: tutorial/introduction.rst:293 msgid "" "Note how the start is always included, and the end always excluded. This " "makes sure that ``s[:i] + s[i:]`` is always equal to ``s``::" msgstr "" +"Προσέξτε πώς η αρχή περιλαμβάνεται πάντα, ενώ το τέλος πάντα εξαιρείται. " +"Αυτό εξασφαλίζει ότι το ``s[:i] + s[i:]`` είναι πάντα ίσο με ``s``::" + +#: tutorial/introduction.rst:296 +msgid "" +">>> word[:2] + word[2:]\n" +"'Python'\n" +">>> word[:4] + word[4:]\n" +"'Python'" +msgstr "" +">>> word[:2] + word[2:]\n" +"'Python'\n" +">>> word[:4] + word[4:]\n" +"'Python'" -#: tutorial/introduction.rst:302 +#: tutorial/introduction.rst:301 msgid "" "One way to remember how slices work is to think of the indices as pointing " "*between* characters, with the left edge of the first character numbered 0. " "Then the right edge of the last character of a string of *n* characters has " "index *n*, for example::" msgstr "" +"Ένας τρόπος να θυμάστε πώς λειτουργούν οι τεμαχισμοί είναι να σκεφτείτε ότι " +"οι δείκτες δείχνουν *μεταξύ* χαρακτήρων, με το αριστερό άκρο του πρώτου " +"χαρακτήρα να αριθμείται με 0. Τότε το δεξιό άκρο του τελευταίου χαρακτήρα " +"μιας συμβολοσειράς *ν* χαρακτήρων έχει δείκτη *ν*, για παράδειγμα::" -#: tutorial/introduction.rst:313 +#: tutorial/introduction.rst:306 +msgid "" +" +---+---+---+---+---+---+\n" +" | P | y | t | h | o | n |\n" +" +---+---+---+---+---+---+\n" +" 0 1 2 3 4 5 6\n" +"-6 -5 -4 -3 -2 -1" +msgstr "" +" +---+---+---+---+---+---+\n" +" | P | y | t | h | o | n |\n" +" +---+---+---+---+---+---+\n" +" 0 1 2 3 4 5 6\n" +"-6 -5 -4 -3 -2 -1" + +#: tutorial/introduction.rst:312 msgid "" "The first row of numbers gives the position of the indices 0...6 in the " "string; the second row gives the corresponding negative indices. The slice " "from *i* to *j* consists of all characters between the edges labeled *i* and " "*j*, respectively." msgstr "" +"Η πρώτη σειρά αριθμών δίνει τη θέση των δεικτών 0...6 στην συμβολοσειρά∙ η " +"δεύτερη σειρά δίνει τους αντίστοιχους αρνητικούς δείκτες. Ο τεμαχισμός από " +"*i* έως *j* αποτελείται από όλους τους χαρακτήρες μεταξύ των άκρων με " +"ετικέτες *i* και *j*, αντίστοιχα." -#: tutorial/introduction.rst:318 +#: tutorial/introduction.rst:317 msgid "" "For non-negative indices, the length of a slice is the difference of the " "indices, if both are within bounds. For example, the length of " "``word[1:3]`` is 2." msgstr "" +"Για μη αρνητικούς δείκτες, το μήκος ενός τεμαχισμού είναι η διαφορά των " +"δεικτών, εάν και οι δύο είναι εντός των ορίων. Για παράδειγμα, το μήκος του " +"``word[1:3]`` είναι 2." -#: tutorial/introduction.rst:322 +#: tutorial/introduction.rst:321 msgid "Attempting to use an index that is too large will result in an error::" +msgstr "Η απόπειρα χρήσης ενός πολύ μεγάλου δείκτη θα οδηγήσει σε σφάλμα::" + +#: tutorial/introduction.rst:323 +msgid "" +">>> word[42] # the word only has 6 characters\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"IndexError: string index out of range" msgstr "" +">>> word[42] # the word only has 6 characters\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"IndexError: string index out of range" -#: tutorial/introduction.rst:329 +#: tutorial/introduction.rst:328 msgid "" "However, out of range slice indexes are handled gracefully when used for " "slicing::" msgstr "" +"Ωστόσο, οι δείκτες εκτός εύρους αντιμετωπίζονται χωρίς σφάλμα όταν " +"χρησιμοποιούνται για τεμαχισμούς::" + +#: tutorial/introduction.rst:331 +msgid "" +">>> word[4:42]\n" +"'on'\n" +">>> word[42:]\n" +"''" +msgstr "" +">>> word[4:42]\n" +"'on'\n" +">>> word[42:]\n" +"''" -#: tutorial/introduction.rst:337 +#: tutorial/introduction.rst:336 msgid "" "Python strings cannot be changed --- they are :term:`immutable`. Therefore, " "assigning to an indexed position in the string results in an error::" msgstr "" +"Οι συμβολοσειρές της Python δεν μπορούν να αλλάξουν --- είναι :term:" +"`immutable`. Επομένως, η ανάθεση σε μια συγκεκριμένη θέση στη συμβολοσειρά " +"οδηγεί σε σφάλμα::" -#: tutorial/introduction.rst:349 +#: tutorial/introduction.rst:339 +msgid "" +">>> word[0] = 'J'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: 'str' object does not support item assignment\n" +">>> word[2:] = 'py'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: 'str' object does not support item assignment" +msgstr "" +">>> word[0] = 'J'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: 'str' object does not support item assignment\n" +">>> word[2:] = 'py'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: 'str' object does not support item assignment" + +#: tutorial/introduction.rst:348 msgid "If you need a different string, you should create a new one::" msgstr "" +"Εάν χρειάζεστε μια διαφορετική συμβολοσειρά, θα πρέπει να δημιουργήσετε μια " +"νέα::" + +#: tutorial/introduction.rst:350 +msgid "" +">>> 'J' + word[1:]\n" +"'Jython'\n" +">>> word[:2] + 'py'\n" +"'Pypy'" +msgstr "" +">>> 'J' + word[1:]\n" +"'Jython'\n" +">>> word[:2] + 'py'\n" +"'Pypy'" -#: tutorial/introduction.rst:356 +#: tutorial/introduction.rst:355 msgid "The built-in function :func:`len` returns the length of a string::" msgstr "" +"Η ενσωματωμένη συνάρτηση :func:`len` επιστρέφει το μήκος μιας συμβολοσειράς::" -#: tutorial/introduction.rst:367 -msgid ":ref:`textseq`" +#: tutorial/introduction.rst:357 +msgid "" +">>> s = 'supercalifragilisticexpialidocious'\n" +">>> len(s)\n" +"34" msgstr "" +">>> s = 'supercalifragilisticexpialidocious'\n" +">>> len(s)\n" +"34" -#: tutorial/introduction.rst:366 +#: tutorial/introduction.rst:364 +msgid ":ref:`textseq`" +msgstr ":ref:`textseq`" + +#: tutorial/introduction.rst:365 msgid "" "Strings are examples of *sequence types*, and support the common operations " "supported by such types." msgstr "" +"Οι συμβολοσειρές είναι παραδείγματα *τύπων ακολουθίας* και υποστηρίζουν τις " +"κοινές πράξεις που υποστηρίζονται από τέτοιους τύπους." -#: tutorial/introduction.rst:371 +#: tutorial/introduction.rst:368 msgid ":ref:`string-methods`" -msgstr "" +msgstr ":ref:`string-methods`" -#: tutorial/introduction.rst:370 +#: tutorial/introduction.rst:369 msgid "" "Strings support a large number of methods for basic transformations and " "searching." msgstr "" +"Οι συμβολοσειρές υποστηρίζουν έναν μεγάλο αριθμό μεθόδων για βασικούς " +"μετασχηματισμούς και αναζήτηση." -#: tutorial/introduction.rst:374 +#: tutorial/introduction.rst:372 msgid ":ref:`f-strings`" -msgstr "" +msgstr ":ref:`f-strings`" -#: tutorial/introduction.rst:374 +#: tutorial/introduction.rst:373 msgid "String literals that have embedded expressions." -msgstr "" +msgstr "Κυριολεκτικές συμβολοσειρές που έχουν ενσωματωμένες εκφράσεις." -#: tutorial/introduction.rst:377 +#: tutorial/introduction.rst:375 msgid ":ref:`formatstrings`" -msgstr "" +msgstr ":ref:`formatstrings`" -#: tutorial/introduction.rst:377 +#: tutorial/introduction.rst:376 msgid "Information about string formatting with :meth:`str.format`." msgstr "" +"Πληροφορίες σχετικά με τη μορφοποίηση συμβολοσειρών με τη μέθοδο :meth:`str." +"format`." -#: tutorial/introduction.rst:380 +#: tutorial/introduction.rst:378 msgid ":ref:`old-string-formatting`" -msgstr "" +msgstr ":ref:`old-string-formatting`" -#: tutorial/introduction.rst:380 +#: tutorial/introduction.rst:379 msgid "" "The old formatting operations invoked when strings are the left operand of " "the ``%`` operator are described in more detail here." msgstr "" +"Οι παλιές λειτουργίες μορφοποίησης που καλούνται όταν οι συμβολοσειρές είναι " +"ο αριστερός τελεστέος του τελεστή ``%`` περιγράφονται λεπτομερέστερα εδώ." -#: tutorial/introduction.rst:387 +#: tutorial/introduction.rst:386 msgid "Lists" -msgstr "" +msgstr "Λίστες" -#: tutorial/introduction.rst:389 +#: tutorial/introduction.rst:388 msgid "" "Python knows a number of *compound* data types, used to group together other " "values. The most versatile is the *list*, which can be written as a list of " "comma-separated values (items) between square brackets. Lists might contain " "items of different types, but usually the items all have the same type. ::" msgstr "" +"Η Python γνωρίζει έναν αριθμό *σύνθετων* τύπων δεδομένων, που " +"χρησιμοποιούνται για την ομαδοποίηση άλλων τιμών. Ο πιο ευέλικτος είναι ο " +"τύπος *λίστα*, ο οποίος μπορεί να γραφτεί ως μια λίστα διαχωρισμένων με " +"κόμμα τιμών (στοιχείων) ανάμεσα σε τετράγωνες αγκύλες. Οι λίστες μπορεί να " +"περιέχουν στοιχεία διαφορετικών τύπων, αλλά συνήθως όλα τα στοιχεία έχουν " +"τον ίδιο τύπο. ::" + +#: tutorial/introduction.rst:393 +msgid "" +">>> squares = [1, 4, 9, 16, 25]\n" +">>> squares\n" +"[1, 4, 9, 16, 25]" +msgstr "" +">>> squares = [1, 4, 9, 16, 25]\n" +">>> squares\n" +"[1, 4, 9, 16, 25]" -#: tutorial/introduction.rst:398 +#: tutorial/introduction.rst:397 msgid "" "Like strings (and all other built-in :term:`sequence` types), lists can be " "indexed and sliced::" msgstr "" +"Όπως οι συμβολοσειρές (και όλοι οι άλλοι ενσωματωμένοι τύποι :term:" +"`sequence`), οι λίστες μπορούν να δεικτοδοτηθούν και να τεμαχιστούν::" -#: tutorial/introduction.rst:408 +#: tutorial/introduction.rst:400 +msgid "" +">>> squares[0] # indexing returns the item\n" +"1\n" +">>> squares[-1]\n" +"25\n" +">>> squares[-3:] # slicing returns a new list\n" +"[9, 16, 25]" +msgstr "" +">>> squares[0] # indexing returns the item\n" +"1\n" +">>> squares[-1]\n" +"25\n" +">>> squares[-3:] # slicing returns a new list\n" +"[9, 16, 25]" + +#: tutorial/introduction.rst:407 msgid "Lists also support operations like concatenation::" +msgstr "Οι λίστες υποστηρίζουν επίσης λειτουργίες όπως σύνδεση::" + +#: tutorial/introduction.rst:409 +msgid "" +">>> squares + [36, 49, 64, 81, 100]\n" +"[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]" msgstr "" +">>> squares + [36, 49, 64, 81, 100]\n" +"[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]" -#: tutorial/introduction.rst:413 +#: tutorial/introduction.rst:412 msgid "" "Unlike strings, which are :term:`immutable`, lists are a :term:`mutable` " "type, i.e. it is possible to change their content::" msgstr "" +"Σε αντίθεση με τις συμβολοσειρές, οι οποίες είναι :term:`immutable`, οι " +"λίστες είναι :term:`mutable` τύπος, δηλαδή είναι δυνατόν να αλλάξετε το " +"περιεχόμενό τους::" -#: tutorial/introduction.rst:423 +#: tutorial/introduction.rst:415 +msgid "" +">>> cubes = [1, 8, 27, 65, 125] # something's wrong here\n" +">>> 4 ** 3 # the cube of 4 is 64, not 65!\n" +"64\n" +">>> cubes[3] = 64 # replace the wrong value\n" +">>> cubes\n" +"[1, 8, 27, 64, 125]" +msgstr "" +">>> cubes = [1, 8, 27, 65, 125] # something's wrong here\n" +">>> 4 ** 3 # the cube of 4 is 64, not 65!\n" +"64\n" +">>> cubes[3] = 64 # replace the wrong value\n" +">>> cubes\n" +"[1, 8, 27, 64, 125]" + +#: tutorial/introduction.rst:422 msgid "" -"You can also add new items at the end of the list, by using the :meth:`!list." +"You can also add new items at the end of the list, by using the :meth:`list." "append` *method* (we will see more about methods later)::" msgstr "" +"Μπορείτε επίσης να προσθέσετε νέα στοιχεία στο τέλος της λίστας, " +"χρησιμοποιώντας :meth:`list.append` *μέθοδο* (θα δούμε περισσότερα για τις " +"μεθόδους αργότερα)::" -#: tutorial/introduction.rst:431 +#: tutorial/introduction.rst:425 +msgid "" +">>> cubes.append(216) # add the cube of 6\n" +">>> cubes.append(7 ** 3) # and the cube of 7\n" +">>> cubes\n" +"[1, 8, 27, 64, 125, 216, 343]" +msgstr "" +">>> cubes.append(216) # add the cube of 6\n" +">>> cubes.append(7 ** 3) # and the cube of 7\n" +">>> cubes\n" +"[1, 8, 27, 64, 125, 216, 343]" + +#: tutorial/introduction.rst:430 msgid "" "Simple assignment in Python never copies data. When you assign a list to a " "variable, the variable refers to the *existing list*. Any changes you make " "to the list through one variable will be seen through all other variables " "that refer to it.::" msgstr "" +"Η απλή ανάθεση στην Python δεν αντιγράφει ποτέ δεδομένα. Όταν αναθέτετε μια " +"λίστα σε μια μεταβλητή, η μεταβλητή αναφέρεται στην *υπάρχουσα λίστα*. " +"Οποιεσδήποτε αλλαγές κάνετε στη λίστα μέσω μιας μεταβλητής θα γίνουν " +"αντιληπτές από όλες τις άλλες μεταβλητές που αναφέρονται σε αυτήν::" -#: tutorial/introduction.rst:444 +#: tutorial/introduction.rst:435 +msgid "" +">>> rgb = [\"Red\", \"Green\", \"Blue\"]\n" +">>> rgba = rgb\n" +">>> id(rgb) == id(rgba) # they reference the same object\n" +"True\n" +">>> rgba.append(\"Alph\")\n" +">>> rgb\n" +"[\"Red\", \"Green\", \"Blue\", \"Alph\"]" +msgstr "" +">>> rgb = [\"Red\", \"Green\", \"Blue\"]\n" +">>> rgba = rgb\n" +">>> id(rgb) == id(rgba) # they reference the same object\n" +"True\n" +">>> rgba.append(\"Alph\")\n" +">>> rgb\n" +"[\"Red\", \"Green\", \"Blue\", \"Alph\"]" + +#: tutorial/introduction.rst:443 msgid "" "All slice operations return a new list containing the requested elements. " "This means that the following slice returns a :ref:`shallow copy " "` of the list::" msgstr "" +"Όλοι οι τεμαχισμοί επιστρέφουν μια νέα λίστα που περιέχει τα ζητούμενα " +"στοιχεία. Αυτό σημαίνει ότι ο ακόλουθος τεμαχισμός επιστρέφει ένα :ref:" +"`shallow copy ` (ρηχό αντίγραφο) της λίστας::" -#: tutorial/introduction.rst:455 +#: tutorial/introduction.rst:447 +msgid "" +">>> correct_rgba = rgba[:]\n" +">>> correct_rgba[-1] = \"Alpha\"\n" +">>> correct_rgba\n" +"[\"Red\", \"Green\", \"Blue\", \"Alpha\"]\n" +">>> rgba\n" +"[\"Red\", \"Green\", \"Blue\", \"Alph\"]" +msgstr "" +">>> correct_rgba = rgba[:]\n" +">>> correct_rgba[-1] = \"Alpha\"\n" +">>> correct_rgba\n" +"[\"Red\", \"Green\", \"Blue\", \"Alpha\"]\n" +">>> rgba\n" +"[\"Red\", \"Green\", \"Blue\", \"Alph\"]" + +#: tutorial/introduction.rst:454 msgid "" "Assignment to slices is also possible, and this can even change the size of " "the list or clear it entirely::" msgstr "" +"Η ανάθεση σε τεμαχισμούς είναι επίσης δυνατή, και αυτό μπορεί ακόμη και να " +"αλλάξει το μέγεθος της λίστας ή να τη διαγράψει εντελώς::" -#: tutorial/introduction.rst:474 +#: tutorial/introduction.rst:457 +msgid "" +">>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" +">>> letters\n" +"['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" +">>> # replace some values\n" +">>> letters[2:5] = ['C', 'D', 'E']\n" +">>> letters\n" +"['a', 'b', 'C', 'D', 'E', 'f', 'g']\n" +">>> # now remove them\n" +">>> letters[2:5] = []\n" +">>> letters\n" +"['a', 'b', 'f', 'g']\n" +">>> # clear the list by replacing all the elements with an empty list\n" +">>> letters[:] = []\n" +">>> letters\n" +"[]" +msgstr "" +">>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" +">>> letters\n" +"['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" +">>> # replace some values\n" +">>> letters[2:5] = ['C', 'D', 'E']\n" +">>> letters\n" +"['a', 'b', 'C', 'D', 'E', 'f', 'g']\n" +">>> # now remove them\n" +">>> letters[2:5] = []\n" +">>> letters\n" +"['a', 'b', 'f', 'g']\n" +">>> # clear the list by replacing all the elements with an empty list\n" +">>> letters[:] = []\n" +">>> letters\n" +"[]" + +#: tutorial/introduction.rst:473 msgid "The built-in function :func:`len` also applies to lists::" +msgstr "Η ενσωματωμένη συνάρτηση :func:`len` εφαρμόζεται επίσης στις λίστες::" + +#: tutorial/introduction.rst:475 +msgid "" +">>> letters = ['a', 'b', 'c', 'd']\n" +">>> len(letters)\n" +"4" msgstr "" +">>> letters = ['a', 'b', 'c', 'd']\n" +">>> len(letters)\n" +"4" -#: tutorial/introduction.rst:480 +#: tutorial/introduction.rst:479 msgid "" "It is possible to nest lists (create lists containing other lists), for " "example::" msgstr "" +"Είναι δυνατό να εμφωλεύσετε λίστες (να δημιουργήσετε λίστες που περιέχουν " +"άλλες λίστες), για παράδειγμα::" -#: tutorial/introduction.rst:496 +#: tutorial/introduction.rst:482 +msgid "" +">>> a = ['a', 'b', 'c']\n" +">>> n = [1, 2, 3]\n" +">>> x = [a, n]\n" +">>> x\n" +"[['a', 'b', 'c'], [1, 2, 3]]\n" +">>> x[0]\n" +"['a', 'b', 'c']\n" +">>> x[0][1]\n" +"'b'" +msgstr "" +">>> a = ['a', 'b', 'c']\n" +">>> n = [1, 2, 3]\n" +">>> x = [a, n]\n" +">>> x\n" +"[['a', 'b', 'c'], [1, 2, 3]]\n" +">>> x[0]\n" +"['a', 'b', 'c']\n" +">>> x[0][1]\n" +"'b'" + +#: tutorial/introduction.rst:495 msgid "First Steps Towards Programming" -msgstr "" +msgstr "Πρώτα Βήματα Προς Τον Προγραμματισμό" -#: tutorial/introduction.rst:498 +#: tutorial/introduction.rst:497 msgid "" "Of course, we can use Python for more complicated tasks than adding two and " "two together. For instance, we can write an initial sub-sequence of the " "`Fibonacci series `_ as " "follows::" msgstr "" +"Φυσικά, μπορούμε να χρησιμοποιήσουμε την Python για πιο περίπλοκες εργασίες " +"από την πρόσθεση δύο και δύο μαζί. Για παράδειγμα, μπορούμε να γράψουμε μια " +"αρχική υπο-σειρά της `Σειράς Fibonacci `_ ως ακολουθεί::" -#: tutorial/introduction.rst:518 +#: tutorial/introduction.rst:502 +msgid "" +">>> # Fibonacci series:\n" +">>> # the sum of two elements defines the next\n" +">>> a, b = 0, 1\n" +">>> while a < 10:\n" +"... print(a)\n" +"... a, b = b, a+b\n" +"...\n" +"0\n" +"1\n" +"1\n" +"2\n" +"3\n" +"5\n" +"8" +msgstr "" +">>> # Fibonacci series:\n" +">>> # the sum of two elements defines the next\n" +">>> a, b = 0, 1\n" +">>> while a < 10:\n" +"... print(a)\n" +"... a, b = b, a+b\n" +"...\n" +"0\n" +"1\n" +"1\n" +"2\n" +"3\n" +"5\n" +"8" + +#: tutorial/introduction.rst:517 msgid "This example introduces several new features." -msgstr "" +msgstr "Αυτό το παράδειγμα εισάγει διάφορα νέα χαρακτηριστικά." -#: tutorial/introduction.rst:520 +#: tutorial/introduction.rst:519 msgid "" "The first line contains a *multiple assignment*: the variables ``a`` and " "``b`` simultaneously get the new values 0 and 1. On the last line this is " @@ -435,8 +1218,13 @@ msgid "" "all evaluated first before any of the assignments take place. The right-" "hand side expressions are evaluated from the left to the right." msgstr "" +"Η πρώτη γραμμή περιέχει μια *πολλαπλή ανάθεση*: οι μεταβλητές ``a`` και " +"``b`` παίρνουν ταυτόχρονα τις νέες τιμές 0 και 1. Στην τελευταία γραμμή αυτό " +"χρησιμοποιείται ξανά, αποδεικνύοντας ότι οι εκφράσεις στη δεξιά πλευρά " +"αξιολογούνται όλες πρώτα πριν γίνει οποιαδήποτε ανάθεση. Οι εκφράσεις στην " +"δεξιά πλευρά αξιολογούνται από αριστερά προς τα δεξιά." -#: tutorial/introduction.rst:526 +#: tutorial/introduction.rst:525 msgid "" "The :keyword:`while` loop executes as long as the condition (here: ``a < " "10``) remains true. In Python, like in C, any non-zero integer value is " @@ -447,8 +1235,17 @@ msgid "" "than), ``>`` (greater than), ``==`` (equal to), ``<=`` (less than or equal " "to), ``>=`` (greater than or equal to) and ``!=`` (not equal to)." msgstr "" - -#: tutorial/introduction.rst:535 +"Ο βρόχος :keyword:`while` εκτελείται όσο η συνθήκη (εδώ: ``a < 10``) " +"παραμένει αληθής. Στην Python, όπως και στη C, οποιαδήποτε μη μηδενική " +"ακέραια τιμή είναι αληθής, το μηδέν είναι ψευδές. Η συνθήκη μπορεί επίσης " +"να είναι μια συμβολοσειρά ή μια λίστα, στην πραγματικότητα οποιαδήποτε " +"ακολουθία∙ οτιδήποτε με μη μηδενικό μήκος είναι αληθές, κενές ακολουθίες " +"είναι ψευδείς. Το τεστ που χρησιμοποιείται στο παράδειγμα είναι μια απλή " +"σύγκριση. Οι τυπικοί τελεστές σύγκρισης γράφονται όπως στη C: ``<`` " +"(μικρότερο από), ``>`` (μεγαλύτερο από), ``==`` (ίσο με), ``<=`` (μικρότερο " +"ή ίσο με), ``>=`` (μεγαλύτερο ή ίσο με) και ``!=`` (μη ίσο με)." + +#: tutorial/introduction.rst:534 msgid "" "The *body* of the loop is *indented*: indentation is Python's way of " "grouping statements. At the interactive prompt, you have to type a tab or " @@ -459,46 +1256,108 @@ msgid "" "(since the parser cannot guess when you have typed the last line). Note " "that each line within a basic block must be indented by the same amount." msgstr "" - -#: tutorial/introduction.rst:544 +"Στο *σώμα* του βρόχου υπάρχει *εσοχή*: η εσοχή είναι ο τρόπος της Python να " +"ομαδοποιεί εντολές. Στο διαδραστικό prompt, πρέπει να πληκτρολογήσετε ένα " +"tab ή κενό(α) για κάθε γραμμή με εσοχή. Στην πράξη θα προετοιμάσετε πιο " +"περίπλοκες εισαγωγές για την Python με έναν επεξεργαστή κειμένου∙ όλοι οι " +"αξιοπρεπείς επεξεργαστές κειμένου διαθέτουν την δυνατότητα αυτόματης " +"εσοχής. Όταν εισάγεται μια σύνθετη εντολή διαδραστικά, πρέπει να " +"ακολουθείται από μια κενή γραμμή για να υποδηλώνει την ολοκλήρωση (αφού ο " +"συντακτικός αναλυτής δεν μπορεί να μαντέψει πότε πληκτρολογήσατε την " +"τελευταία γραμμή). Σημείωση ότι κάθε γραμμή μέσα σε ένα βασικό μπλοκ πρέπει " +"να έχει την ίδια εσοχή." + +#: tutorial/introduction.rst:543 msgid "" "The :func:`print` function writes the value of the argument(s) it is given. " "It differs from just writing the expression you want to write (as we did " "earlier in the calculator examples) in the way it handles multiple " -"arguments, floating point quantities, and strings. Strings are printed " +"arguments, floating-point quantities, and strings. Strings are printed " "without quotes, and a space is inserted between items, so you can format " "things nicely, like this::" msgstr "" +"Η συνάρτηση :func:`print` γράφει την τιμή του(των) ορίσματος(ων) που της " +"δίνεται. Διαφέρει από το να γράφετε απλώς την έκφραση που θέλετε να γράψετε " +"(όπως κάναμε νωρίτερα στα παραδείγματα της αριθμομηχανής) στον τρόπο με τον " +"οποίο χειρίζεται πολλαπλά ορίσματα, αριθμούς με δεκαδικά ψηφία και " +"συμβολοσειρές. Οι συμβολοσειρές εκτυπώνονται χωρίς εισαγωγικά, και ένα κενό " +"παρεμβάλλεται μεταξύ των στοιχείων, ώστε να μπορείτε να μορφοποιήσετε τα " +"πράγματα όμορφα, όπως εδώ::" + +#: tutorial/introduction.rst:550 +msgid "" +">>> i = 256*256\n" +">>> print('The value of i is', i)\n" +"The value of i is 65536" +msgstr "" +">>> i = 256*256\n" +">>> print('The value of i is', i)\n" +"The value of i is 65536" -#: tutorial/introduction.rst:555 +#: tutorial/introduction.rst:554 msgid "" "The keyword argument *end* can be used to avoid the newline after the " "output, or end the output with a different string::" msgstr "" +"Το όρισμα-κλειδί *end* μπορεί να χρησιμοποιηθεί για την αποφυγή της νέας " +"γραμμής μετά την έξοδο, ή για να τελειώσετε την έξοδο με μια διαφορετική " +"συμβολοσειρά::" -#: tutorial/introduction.rst:567 +#: tutorial/introduction.rst:557 +msgid "" +">>> a, b = 0, 1\n" +">>> while a < 1000:\n" +"... print(a, end=',')\n" +"... a, b = b, a+b\n" +"...\n" +"0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987," +msgstr "" +">>> a, b = 0, 1\n" +">>> while a < 1000:\n" +"... print(a, end=',')\n" +"... a, b = b, a+b\n" +"...\n" +"0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987," + +#: tutorial/introduction.rst:566 msgid "Footnotes" -msgstr "" +msgstr "Υποσημειώσεις" -#: tutorial/introduction.rst:568 +#: tutorial/introduction.rst:567 msgid "" "Since ``**`` has higher precedence than ``-``, ``-3**2`` will be interpreted " "as ``-(3**2)`` and thus result in ``-9``. To avoid this and get ``9``, you " "can use ``(-3)**2``." msgstr "" +"Δεδομένου ότι το ``**`` έχει μεγαλύτερη προτεραιότητα από το ``-``, το " +"``-3**2`` θα ερμηνευτεί ως ``-(3**2)`` και έτσι θα προκύψει ``-9``. Για να " +"το αποφύγετε αυτό και να πάρετε ``9``, μπορείτε να χρησιμοποιήσετε " +"``(-3)**2``." -#: tutorial/introduction.rst:572 +#: tutorial/introduction.rst:571 msgid "" "Unlike other languages, special characters such as ``\\n`` have the same " "meaning with both single (``'...'``) and double (``\"...\"``) quotes. The " "only difference between the two is that within single quotes you don't need " "to escape ``\"`` (but you have to escape ``\\'``) and vice versa." msgstr "" +"Σε αντίθεση με άλλες γλώσσες, οι ειδικοί χαρακτήρες όπως το ``\\n`` έχουν " +"την ίδια σημασία τόσο με απλά (``'...'``) όσο και με διπλά (``\"...\"``) " +"εισαγωγικά. Η μόνη διαφορά μεταξύ των δύο είναι ότι μέσα σε απλά εισαγωγικά " +"δεν χρειάζεται να αποφύγετε το ``\"`` (αλλά πρέπει να αποφύγετε το ``\\'``) " +"και το αντίστροφο." -#: tutorial/introduction.rst:21 +#: tutorial/introduction.rst:20 msgid "# (hash)" -msgstr "" +msgstr "# (hash)" -#: tutorial/introduction.rst:21 +#: tutorial/introduction.rst:20 msgid "comment" -msgstr "" +msgstr "σχόλιο" + +#~ msgid "" +#~ "produces the following output (note that the initial newline is not " +#~ "included):" +#~ msgstr "" +#~ "παράγει την ακόλουθη έξοδο (σημειώστε ότι η αρχική νέα γραμμή δεν " +#~ "συμπεριλαμβάνεται στην συμβολοσειρά):" diff --git a/tutorial/modules.po b/tutorial/modules.po index f28ab9ea..c7e95412 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-06-12 09:11+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-03 17:11+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -75,7 +75,47 @@ msgstr "" "αρχείο που ονομάζεται :file:`fibo.py` στον τρέχοντα κατάλογο με τα ακόλουθα " "περιεχόμενα::" -#: tutorial/modules.rst:45 +#: tutorial/modules.rst:28 +msgid "" +"# Fibonacci numbers module\n" +"\n" +"def fib(n):\n" +" \"\"\"Write Fibonacci series up to n.\"\"\"\n" +" a, b = 0, 1\n" +" while a < n:\n" +" print(a, end=' ')\n" +" a, b = b, a+b\n" +" print()\n" +"\n" +"def fib2(n):\n" +" \"\"\"Return Fibonacci series up to n.\"\"\"\n" +" result = []\n" +" a, b = 0, 1\n" +" while a < n:\n" +" result.append(a)\n" +" a, b = b, a+b\n" +" return result" +msgstr "" +"# Fibonacci numbers module\n" +"\n" +"def fib(n):\n" +" \"\"\"Write Fibonacci series up to n.\"\"\"\n" +" a, b = 0, 1\n" +" while a < n:\n" +" print(a, end=' ')\n" +" a, b = b, a+b\n" +" print()\n" +"\n" +"def fib2(n):\n" +" \"\"\"Return Fibonacci series up to n.\"\"\"\n" +" result = []\n" +" a, b = 0, 1\n" +" while a < n:\n" +" result.append(a)\n" +" a, b = b, a+b\n" +" return result" + +#: tutorial/modules.rst:47 msgid "" "Now enter the Python interpreter and import this module with the following " "command::" @@ -84,6 +124,10 @@ msgstr "" "ακόλουθη εντολή::" #: tutorial/modules.rst:50 +msgid ">>> import fibo" +msgstr ">>> import fibo" + +#: tutorial/modules.rst:52 msgid "" "This does not add the names of the functions defined in ``fibo`` directly " "to the current :term:`namespace` (see :ref:`tut-scopes` for more details); " @@ -96,18 +140,44 @@ msgstr "" "εκεί. Χρησιμοποιώντας το όνομα του module μπορείτε να αποκτήσετε πρόσβαση " "στις λειτουργίες::" -#: tutorial/modules.rst:62 +#: tutorial/modules.rst:57 +msgid "" +">>> fibo.fib(1000)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987\n" +">>> fibo.fib2(100)\n" +"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n" +">>> fibo.__name__\n" +"'fibo'" +msgstr "" +">>> fibo.fib(1000)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987\n" +">>> fibo.fib2(100)\n" +"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n" +">>> fibo.__name__\n" +"'fibo'" + +#: tutorial/modules.rst:64 msgid "" "If you intend to use a function often you can assign it to a local name::" msgstr "" "Εάν σκοπεύετε να χρησιμοποιείτε συχνά μια συνάρτηση, μπορείτε να την " "αντιστοιχίσετε σε ένα τοπικό όνομα::" -#: tutorial/modules.rst:72 +#: tutorial/modules.rst:66 +msgid "" +">>> fib = fibo.fib\n" +">>> fib(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" +msgstr "" +">>> fib = fibo.fib\n" +">>> fib(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" + +#: tutorial/modules.rst:74 msgid "More on Modules" msgstr "Περισσότερα για τα Modules" -#: tutorial/modules.rst:74 +#: tutorial/modules.rst:76 msgid "" "A module can contain executable statements as well as function definitions. " "These statements are intended to initialize the module. They are executed " @@ -120,7 +190,7 @@ msgstr "" "δήλωση εισαγωγής. [#]_ (Εκτελούνται επίσης εάν το αρχείο εκτελείται ως " "script.)" -#: tutorial/modules.rst:79 +#: tutorial/modules.rst:81 msgid "" "Each module has its own private namespace, which is used as the global " "namespace by all functions defined in the module. Thus, the author of a " @@ -137,7 +207,7 @@ msgstr "" "global μεταβλητές ενός module με το ίδιο notation που χρησιμοποιείται για να " "αναφέρεται στις συναρτήσεις, ``modname.itemname``." -#: tutorial/modules.rst:86 +#: tutorial/modules.rst:88 msgid "" "Modules can import other modules. It is customary but not required to place " "all :keyword:`import` statements at the beginning of a module (or script, " @@ -152,7 +222,7 @@ msgstr "" "οποιωνδήποτε συναρτήσεων ή κλάσεων), προστίθενται στον global namespace του " "module." -#: tutorial/modules.rst:91 +#: tutorial/modules.rst:93 msgid "" "There is a variant of the :keyword:`import` statement that imports names " "from a module directly into the importing module's namespace. For example::" @@ -161,7 +231,17 @@ msgstr "" "ένα module απευθείας στον χώρο στα importing module's namespace. Για " "παράδειγμα::" -#: tutorial/modules.rst:98 +#: tutorial/modules.rst:96 +msgid "" +">>> from fibo import fib, fib2\n" +">>> fib(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" +msgstr "" +">>> from fibo import fib, fib2\n" +">>> fib(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" + +#: tutorial/modules.rst:100 msgid "" "This does not introduce the module name from which the imports are taken in " "the local namespace (so in the example, ``fibo`` is not defined)." @@ -169,13 +249,23 @@ msgstr "" "Αυτό δεν εισάγει το όνομα ενός module από το οποίο λαμβάνονται οι εισαγωγές " "στο τοπικό namespace (αρά στο παράδειγμα, το ``fibo`` δεν ορίζεται)." -#: tutorial/modules.rst:101 +#: tutorial/modules.rst:103 msgid "There is even a variant to import all names that a module defines::" msgstr "" "Υπάρχει ακόμη και μια παραλλαγή για την εισαγωγή όλων των ονομάτων που " "ορίζει μια ενότητα::" -#: tutorial/modules.rst:107 +#: tutorial/modules.rst:105 +msgid "" +">>> from fibo import *\n" +">>> fib(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" +msgstr "" +">>> from fibo import *\n" +">>> fib(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" + +#: tutorial/modules.rst:109 msgid "" "This imports all names except those beginning with an underscore (``_``). In " "most cases Python programmers do not use this facility since it introduces " @@ -188,7 +278,7 @@ msgstr "" "ονομάτων στον interpreter, κρύβοντας πιθανώς κάποια πράγματα που έχετε ήδη " "ορίσει." -#: tutorial/modules.rst:112 +#: tutorial/modules.rst:114 msgid "" "Note that in general the practice of importing ``*`` from a module or " "package is frowned upon, since it often causes poorly readable code. " @@ -199,7 +289,7 @@ msgstr "" "είναι εντάξει να τον χρησιμοποιήσετε για να αποθηκεύσετε την πληκτρολόγηση " "σε διαδραστικές περιόδους σύνδεσης." -#: tutorial/modules.rst:116 +#: tutorial/modules.rst:118 msgid "" "If the module name is followed by :keyword:`!as`, then the name following :" "keyword:`!as` is bound directly to the imported module." @@ -207,7 +297,17 @@ msgstr "" "Εάν το όνομα του module ακολουθείται από :keyword:`!as`, τότε το όνομα που " "ακολουθεί :keyword:`!as` συνδέεται απευθείας με το εισαγόμενο module." -#: tutorial/modules.rst:125 +#: tutorial/modules.rst:123 +msgid "" +">>> import fibo as fib\n" +">>> fib.fib(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" +msgstr "" +">>> import fibo as fib\n" +">>> fib.fib(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" + +#: tutorial/modules.rst:127 msgid "" "This is effectively importing the module in the same way that ``import " "fibo`` will do, with the only difference of it being available as ``fib``." @@ -215,14 +315,24 @@ msgstr "" "Αυτό ουσιαστικά εισάγει το module με τον ίδιο τρόπο που θα κάνει το ``import " "fibo`` , με τη μόνη διαφορά ότι είναι διαθέσιμο ως ``fib``." -#: tutorial/modules.rst:128 +#: tutorial/modules.rst:130 msgid "" "It can also be used when utilising :keyword:`from` with similar effects::" msgstr "" "Μπορεί επίσης να χρησιμοποιηθεί όταν χρησιμοποιείτε :keyword:`from` με " "παρόμοια εφέ::" -#: tutorial/modules.rst:137 +#: tutorial/modules.rst:132 +msgid "" +">>> from fibo import fib as fibonacci\n" +">>> fibonacci(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" +msgstr "" +">>> from fibo import fib as fibonacci\n" +">>> fibonacci(500)\n" +"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377" + +#: tutorial/modules.rst:139 msgid "" "For efficiency reasons, each module is only imported once per interpreter " "session. Therefore, if you change your modules, you must restart the " @@ -236,15 +346,19 @@ msgstr "" "θέλετε να δοκιμάσετε διαδραστικά, χρησιμοποιήστε το :func:`importlib." "reload`, π.χ. ``import importlib; importlib.reload(modulename)``." -#: tutorial/modules.rst:147 +#: tutorial/modules.rst:149 msgid "Executing modules as scripts" msgstr "Εκτέλεση modules ως scripts" -#: tutorial/modules.rst:149 +#: tutorial/modules.rst:151 msgid "When you run a Python module with ::" msgstr "Όταν εκτελείτε ένα Python module με::" #: tutorial/modules.rst:153 +msgid "python fibo.py " +msgstr "python fibo.py " + +#: tutorial/modules.rst:155 msgid "" "the code in the module will be executed, just as if you imported it, but " "with the ``__name__`` set to ``\"__main__\"``. That means that by adding " @@ -254,7 +368,17 @@ msgstr "" "το ``name`` να έχει οριστεί σε ``\"__main__\"``. Αυτό σημαίνει ότι " "προσθέτοντας αυτόν τον κώδικα στο τέλος του module σας::" -#: tutorial/modules.rst:161 +#: tutorial/modules.rst:159 +msgid "" +"if __name__ == \"__main__\":\n" +" import sys\n" +" fib(int(sys.argv[1]))" +msgstr "" +"if __name__ == \"__main__\":\n" +" import sys\n" +" fib(int(sys.argv[1]))" + +#: tutorial/modules.rst:163 msgid "" "you can make the file usable as a script as well as an importable module, " "because the code that parses the command line only runs if the module is " @@ -264,11 +388,27 @@ msgstr "" "που μπορεί να εισαχθεί, επειδή ο κώδικας που αναλύει την γραμμή εντολών " "εκτελείται μόνο εάν το module εκτελείται ως το \"main\" αρχείο:" -#: tutorial/modules.rst:170 +#: tutorial/modules.rst:167 +msgid "" +"$ python fibo.py 50\n" +"0 1 1 2 3 5 8 13 21 34" +msgstr "" +"$ python fibo.py 50\n" +"0 1 1 2 3 5 8 13 21 34" + +#: tutorial/modules.rst:172 msgid "If the module is imported, the code is not run::" msgstr "Εάν το module έχει εισαχθεί, ο κώδικας δεν εκτελείται::" -#: tutorial/modules.rst:175 +#: tutorial/modules.rst:174 +msgid "" +">>> import fibo\n" +">>>" +msgstr "" +">>> import fibo\n" +">>>" + +#: tutorial/modules.rst:177 msgid "" "This is often used either to provide a convenient user interface to a " "module, or for testing purposes (running the module as a script executes a " @@ -278,11 +418,11 @@ msgstr "" "σε ένα module, είτε για σκοπούς δοκιμής (η εκτέλεση του module ως script " "εκτελεί μια δοκιμαστική σουίτα)." -#: tutorial/modules.rst:182 +#: tutorial/modules.rst:184 msgid "The Module Search Path" msgstr "Το Search Path του Module" -#: tutorial/modules.rst:186 +#: tutorial/modules.rst:188 msgid "" "When a module named :mod:`!spam` is imported, the interpreter first searches " "for a built-in module with that name. These module names are listed in :data:" @@ -297,7 +437,7 @@ msgstr "" "δίνονται από τη μεταβλητή :data:`sys.path`. Το :data:`sys.path` " "αρχικοποιείται από αυτές τις θέσεις:" -#: tutorial/modules.rst:192 +#: tutorial/modules.rst:194 msgid "" "The directory containing the input script (or the current directory when no " "file is specified)." @@ -305,7 +445,7 @@ msgstr "" "Ο κατάλογος που περιέχει το input script (ή τον τρέχοντα κατάλογο όταν δεν " "έχει καθοριστεί αρχείο)." -#: tutorial/modules.rst:194 +#: tutorial/modules.rst:196 msgid "" ":envvar:`PYTHONPATH` (a list of directory names, with the same syntax as the " "shell variable :envvar:`PATH`)." @@ -313,7 +453,7 @@ msgstr "" ":envvar:`PYTHONPATH` (μια λίστα ονομάτων καταλόγου, με την ίδια σύνταξη με " "τη μεταβλητή του shell :envvar:`PATH`)." -#: tutorial/modules.rst:196 +#: tutorial/modules.rst:198 msgid "" "The installation-dependent default (by convention including a ``site-" "packages`` directory, handled by the :mod:`site` module)." @@ -322,11 +462,11 @@ msgstr "" "συμπεριλαμβανομένου ενός καταλόγου ``site-packages``, που χειρίζεται το " "module :mod:`site`." -#: tutorial/modules.rst:199 +#: tutorial/modules.rst:201 msgid "More details are at :ref:`sys-path-init`." msgstr "Περισσότερες λεπτομέρειες βρίσκονται στο :ref:`sys-path-init`." -#: tutorial/modules.rst:202 +#: tutorial/modules.rst:204 msgid "" "On file systems which support symlinks, the directory containing the input " "script is calculated after the symlink is followed. In other words the " @@ -337,7 +477,7 @@ msgstr "" "κατάλογος που περιέχει το symlink **δεν** προστίθεται στη διαδρομή " "αναζήτησης του module." -#: tutorial/modules.rst:206 +#: tutorial/modules.rst:208 msgid "" "After initialization, Python programs can modify :data:`sys.path`. The " "directory containing the script being run is placed at the beginning of the " @@ -354,11 +494,11 @@ msgstr "" "βιβλιοθήκης. Αυτό είναι ένα σφάλμα, εκτός εάν προορίζεται η αντικατάσταση. " "Βλ. την ενότητα :ref:`tut-standardmodules` για περισσότερες πληροφορίες." -#: tutorial/modules.rst:219 +#: tutorial/modules.rst:221 msgid "\"Compiled\" Python files" msgstr "\"Compiled\" Python αρχεία" -#: tutorial/modules.rst:221 +#: tutorial/modules.rst:223 msgid "" "To speed up loading modules, Python caches the compiled version of each " "module in the ``__pycache__`` directory under the name :file:`module." @@ -377,7 +517,7 @@ msgstr "" "compiled modules από διαφορετικές εκδόσεις και διαφορετικές εκδόσεις της " "Python να συνυπάρχουν." -#: tutorial/modules.rst:229 +#: tutorial/modules.rst:231 msgid "" "Python checks the modification date of the source against the compiled " "version to see if it's out of date and needs to be recompiled. This is a " @@ -391,7 +531,7 @@ msgstr "" "modules είναι ανεξάρτητες από πλατφόρμα, επομένως η ίδια βιβλιοθήκη μπορεί " "να κοινοποιηθεί ανάμεσα σε συστήματα με διαφορετικές αρχιτεκτονικές." -#: tutorial/modules.rst:234 +#: tutorial/modules.rst:236 msgid "" "Python does not check the cache in two circumstances. First, it always " "recompiles and does not store the result for the module that's loaded " @@ -407,11 +547,11 @@ msgstr "" "(compiled μόνο), το compiled module πρέπει να βρίσκεται στον source κατάλογο " "και δεν πρέπει να υπάρχει source module." -#: tutorial/modules.rst:241 +#: tutorial/modules.rst:243 msgid "Some tips for experts:" msgstr "Μερικές συμβουλές για ειδικούς:" -#: tutorial/modules.rst:243 +#: tutorial/modules.rst:245 msgid "" "You can use the :option:`-O` or :option:`-OO` switches on the Python command " "to reduce the size of a compiled module. The ``-O`` switch removes assert " @@ -431,18 +571,18 @@ msgstr "" "Οι μελλοντικές εκδόσεις μπορεί να αλλάξουν τα αποτελέσματα της " "βελτιστοποίησης." -#: tutorial/modules.rst:251 +#: tutorial/modules.rst:253 msgid "" "A program doesn't run any faster when it is read from a ``.pyc`` file than " "when it is read from a ``.py`` file; the only thing that's faster about ``." "pyc`` files is the speed with which they are loaded." msgstr "" "Ένα πρόγραμμα δεν εκτελείται πιο γρήγορα όταν διαβάζεται από ένα αρχείο ``." -"pyc`` από ό,τι όταν διαβάζεται από ένα αρχείο ``.py``∙ το μόνο πράγμα που " +"pyc`` από ό,τι όταν διαβάζεται από ένα αρχείο ``.py`` ∙ το μόνο πράγμα που " "είναι πιο γρήγορο από τα αρχεία ``.pyc`` είναι η ταχύτητα με την οποία " "φορτώνονται." -#: tutorial/modules.rst:255 +#: tutorial/modules.rst:257 msgid "" "The module :mod:`compileall` can create .pyc files for all modules in a " "directory." @@ -450,7 +590,7 @@ msgstr "" "Το module :mod:`compileall` μπορεί να δημιουργήσει αρχεία .pyc για όλα τα " "modules σε ένα κατάλογο." -#: tutorial/modules.rst:258 +#: tutorial/modules.rst:260 msgid "" "There is more detail on this process, including a flow chart of the " "decisions, in :pep:`3147`." @@ -458,11 +598,11 @@ msgstr "" "Υπάρχουν περισσότερες λεπτομέρειες σχετικά με αυτή τη διαδικασία, " "συμπεριλαμβανομένου ενός διαγράμματος ροής των αποφάσεων, στο :pep:`3147`." -#: tutorial/modules.rst:265 +#: tutorial/modules.rst:267 msgid "Standard Modules" msgstr "Standard Modules" -#: tutorial/modules.rst:269 +#: tutorial/modules.rst:271 msgid "" "Python comes with a library of standard modules, described in a separate " "document, the Python Library Reference (\"Library Reference\" hereafter). " @@ -490,7 +630,29 @@ msgstr "" "της Python. Οι μεταβλητές ``sys.ps1`` και ``sys.ps2`` ορίζουν τις " "συμβολοσειρές που χρησιμοποιούνται ως κύρια και δευτερεύοντα prompts::" -#: tutorial/modules.rst:292 +#: tutorial/modules.rst:283 +msgid "" +">>> import sys\n" +">>> sys.ps1\n" +"'>>> '\n" +">>> sys.ps2\n" +"'... '\n" +">>> sys.ps1 = 'C> '\n" +"C> print('Yuck!')\n" +"Yuck!\n" +"C>" +msgstr "" +">>> import sys\n" +">>> sys.ps1\n" +"'>>> '\n" +">>> sys.ps2\n" +"'... '\n" +">>> sys.ps1 = 'C> '\n" +"C> print('Yuck!')\n" +"Yuck!\n" +"C>" + +#: tutorial/modules.rst:294 msgid "" "These two variables are only defined if the interpreter is in interactive " "mode." @@ -498,7 +660,7 @@ msgstr "" "Αυτές οι δύο μεταβλητές ορίζονται μόνο εάν ο interpreter βρίσκεται σε " "διαδραστική λειτουργία." -#: tutorial/modules.rst:294 +#: tutorial/modules.rst:296 msgid "" "The variable ``sys.path`` is a list of strings that determines the " "interpreter's search path for modules. It is initialized to a default path " @@ -513,11 +675,19 @@ msgstr "" "δεν έχει οριστεί. Μπορείτε να το τροποποιήσετε χρησιμοποιώντας τυπικές " "λειτουργίες λίστας::" -#: tutorial/modules.rst:307 +#: tutorial/modules.rst:302 +msgid "" +">>> import sys\n" +">>> sys.path.append('/ufs/guido/lib/python')" +msgstr "" +">>> import sys\n" +">>> sys.path.append('/ufs/guido/lib/python')" + +#: tutorial/modules.rst:309 msgid "The :func:`dir` Function" msgstr "Η συνάρτηση :func:`dir`" -#: tutorial/modules.rst:309 +#: tutorial/modules.rst:311 msgid "" "The built-in function :func:`dir` is used to find out which names a module " "defines. It returns a sorted list of strings::" @@ -525,21 +695,103 @@ msgstr "" "Η ενσωματωμένη συνάρτηση :func:`dir` χρησιμοποιείται για να ανακαλύψει ποια " "ονόματα ορίζει ένα module. Επιστρέφει μια ταξινομημένη λίστα συμβολοσειρών::" -#: tutorial/modules.rst:338 +#: tutorial/modules.rst:314 +msgid "" +">>> import fibo, sys\n" +">>> dir(fibo)\n" +"['__name__', 'fib', 'fib2']\n" +">>> dir(sys)\n" +"['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',\n" +" '__interactivehook__', '__loader__', '__name__', '__package__', " +"'__spec__',\n" +" '__stderr__', '__stdin__', '__stdout__', '__unraisablehook__',\n" +" '_clear_type_cache', '_current_frames', '_debugmallocstats', '_framework',\n" +" '_getframe', '_git', '_home', '_xoptions', 'abiflags', 'addaudithook',\n" +" 'api_version', 'argv', 'audit', 'base_exec_prefix', 'base_prefix',\n" +" 'breakpointhook', 'builtin_module_names', 'byteorder', 'call_tracing',\n" +" 'callstats', 'copyright', 'displayhook', 'dont_write_bytecode', " +"'exc_info',\n" +" 'excepthook', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info',\n" +" 'float_repr_style', 'get_asyncgen_hooks', " +"'get_coroutine_origin_tracking_depth',\n" +" 'getallocatedblocks', 'getdefaultencoding', 'getdlopenflags',\n" +" 'getfilesystemencodeerrors', 'getfilesystemencoding', 'getprofile',\n" +" 'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval',\n" +" 'gettrace', 'hash_info', 'hexversion', 'implementation', 'int_info',\n" +" 'intern', 'is_finalizing', 'last_traceback', 'last_type', 'last_value',\n" +" 'maxsize', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks',\n" +" 'path_importer_cache', 'platform', 'prefix', 'ps1', 'ps2', " +"'pycache_prefix',\n" +" 'set_asyncgen_hooks', 'set_coroutine_origin_tracking_depth', " +"'setdlopenflags',\n" +" 'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace', " +"'stderr',\n" +" 'stdin', 'stdout', 'thread_info', 'unraisablehook', 'version', " +"'version_info',\n" +" 'warnoptions']" +msgstr "" +">>> import fibo, sys\n" +">>> dir(fibo)\n" +"['__name__', 'fib', 'fib2']\n" +">>> dir(sys)\n" +"['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',\n" +" '__interactivehook__', '__loader__', '__name__', '__package__', " +"'__spec__',\n" +" '__stderr__', '__stdin__', '__stdout__', '__unraisablehook__',\n" +" '_clear_type_cache', '_current_frames', '_debugmallocstats', '_framework',\n" +" '_getframe', '_git', '_home', '_xoptions', 'abiflags', 'addaudithook',\n" +" 'api_version', 'argv', 'audit', 'base_exec_prefix', 'base_prefix',\n" +" 'breakpointhook', 'builtin_module_names', 'byteorder', 'call_tracing',\n" +" 'callstats', 'copyright', 'displayhook', 'dont_write_bytecode', " +"'exc_info',\n" +" 'excepthook', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info',\n" +" 'float_repr_style', 'get_asyncgen_hooks', " +"'get_coroutine_origin_tracking_depth',\n" +" 'getallocatedblocks', 'getdefaultencoding', 'getdlopenflags',\n" +" 'getfilesystemencodeerrors', 'getfilesystemencoding', 'getprofile',\n" +" 'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval',\n" +" 'gettrace', 'hash_info', 'hexversion', 'implementation', 'int_info',\n" +" 'intern', 'is_finalizing', 'last_traceback', 'last_type', 'last_value',\n" +" 'maxsize', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks',\n" +" 'path_importer_cache', 'platform', 'prefix', 'ps1', 'ps2', " +"'pycache_prefix',\n" +" 'set_asyncgen_hooks', 'set_coroutine_origin_tracking_depth', " +"'setdlopenflags',\n" +" 'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace', " +"'stderr',\n" +" 'stdin', 'stdout', 'thread_info', 'unraisablehook', 'version', " +"'version_info',\n" +" 'warnoptions']" + +#: tutorial/modules.rst:340 msgid "" "Without arguments, :func:`dir` lists the names you have defined currently::" msgstr "" "Χωρίς ορίσματα, η :func:`dir` παραθέτει τα ονόματα που έχετε ορίσει αυτήν τη " "στιγμή::" -#: tutorial/modules.rst:346 +#: tutorial/modules.rst:342 +msgid "" +">>> a = [1, 2, 3, 4, 5]\n" +">>> import fibo\n" +">>> fib = fibo.fib\n" +">>> dir()\n" +"['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys']" +msgstr "" +">>> a = [1, 2, 3, 4, 5]\n" +">>> import fibo\n" +">>> fib = fibo.fib\n" +">>> dir()\n" +"['__builtins__', '__name__', 'a', 'fib', 'fibo', 'sys']" + +#: tutorial/modules.rst:348 msgid "" "Note that it lists all types of names: variables, modules, functions, etc." msgstr "" "Λάβετε υπόψη ότι παραθέτει όλους τους τύπους ονομάτων: μεταβλητές, modules, " "συναρτήσεις, κ.λπ." -#: tutorial/modules.rst:350 +#: tutorial/modules.rst:352 msgid "" ":func:`dir` does not list the names of built-in functions and variables. If " "you want a list of those, they are defined in the standard module :mod:" @@ -549,11 +801,79 @@ msgstr "" "μεταβλητών. Εάν θέλετε μια λίστα από αυτές, ορίζονται στην τυπική ενότητα :" "mod:`builtins`::" -#: tutorial/modules.rst:389 +#: tutorial/modules.rst:356 +msgid "" +">>> import builtins\n" +">>> dir(builtins)\n" +"['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n" +" 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n" +" 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n" +" 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning',\n" +" 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False',\n" +" 'FileExistsError', 'FileNotFoundError', 'FloatingPointError',\n" +" 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError',\n" +" 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError',\n" +" 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError',\n" +" 'MemoryError', 'NameError', 'None', 'NotADirectoryError', " +"'NotImplemented',\n" +" 'NotImplementedError', 'OSError', 'OverflowError',\n" +" 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError',\n" +" 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning',\n" +" 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError',\n" +" 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError',\n" +" 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError',\n" +" 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',\n" +" 'ValueError', 'Warning', 'ZeroDivisionError', '_', '__build_class__',\n" +" '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs',\n" +" 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable',\n" +" 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits',\n" +" 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit',\n" +" 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr',\n" +" 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass',\n" +" 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview',\n" +" 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property',\n" +" 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',\n" +" 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars',\n" +" 'zip']" +msgstr "" +">>> import builtins\n" +">>> dir(builtins)\n" +"['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n" +" 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n" +" 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n" +" 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning',\n" +" 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False',\n" +" 'FileExistsError', 'FileNotFoundError', 'FloatingPointError',\n" +" 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError',\n" +" 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError',\n" +" 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError',\n" +" 'MemoryError', 'NameError', 'None', 'NotADirectoryError', " +"'NotImplemented',\n" +" 'NotImplementedError', 'OSError', 'OverflowError',\n" +" 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError',\n" +" 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning',\n" +" 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError',\n" +" 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError',\n" +" 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError',\n" +" 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',\n" +" 'ValueError', 'Warning', 'ZeroDivisionError', '_', '__build_class__',\n" +" '__debug__', '__doc__', '__import__', '__name__', '__package__', 'abs',\n" +" 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable',\n" +" 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits',\n" +" 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit',\n" +" 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr',\n" +" 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass',\n" +" 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview',\n" +" 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property',\n" +" 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',\n" +" 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars',\n" +" 'zip']" + +#: tutorial/modules.rst:391 msgid "Packages" msgstr "Πακέτα" -#: tutorial/modules.rst:391 +#: tutorial/modules.rst:393 msgid "" "Packages are a way of structuring Python's module namespace by using " "\"dotted module names\". For example, the module name :mod:`!A.B` " @@ -572,7 +892,7 @@ msgstr "" "το NumbPY ή το Pillow από το να χρειάζεται να ανησυχούν ο ένας για τα module " "ονόματα του άλλου." -#: tutorial/modules.rst:399 +#: tutorial/modules.rst:401 msgid "" "Suppose you want to design a collection of modules (a \"package\") for the " "uniform handling of sound files and sound data. There are many different " @@ -599,7 +919,57 @@ msgstr "" "αυτές τις λειτουργίες. Ακολουθεί μια πιθανή δομή για το πακέτο σας (που " "εκφράζεται ως ιεραρχικό σύστημα αρχείων):" -#: tutorial/modules.rst:436 +#: tutorial/modules.rst:412 +msgid "" +"sound/ Top-level package\n" +" __init__.py Initialize the sound package\n" +" formats/ Subpackage for file format conversions\n" +" __init__.py\n" +" wavread.py\n" +" wavwrite.py\n" +" aiffread.py\n" +" aiffwrite.py\n" +" auread.py\n" +" auwrite.py\n" +" ...\n" +" effects/ Subpackage for sound effects\n" +" __init__.py\n" +" echo.py\n" +" surround.py\n" +" reverse.py\n" +" ...\n" +" filters/ Subpackage for filters\n" +" __init__.py\n" +" equalizer.py\n" +" vocoder.py\n" +" karaoke.py\n" +" ..." +msgstr "" +"sound/ Top-level package\n" +" __init__.py Initialize the sound package\n" +" formats/ Subpackage for file format conversions\n" +" __init__.py\n" +" wavread.py\n" +" wavwrite.py\n" +" aiffread.py\n" +" aiffwrite.py\n" +" auread.py\n" +" auwrite.py\n" +" ...\n" +" effects/ Subpackage for sound effects\n" +" __init__.py\n" +" echo.py\n" +" surround.py\n" +" reverse.py\n" +" ...\n" +" filters/ Subpackage for filters\n" +" __init__.py\n" +" equalizer.py\n" +" vocoder.py\n" +" karaoke.py\n" +" ..." + +#: tutorial/modules.rst:438 msgid "" "When importing the package, Python searches through the directories on ``sys." "path`` looking for the package subdirectory." @@ -607,7 +977,7 @@ msgstr "" "Κατά την εισαγωγή του πακέτου, η Python πραγματοποιεί αναζήτηση στους " "καταλόγους στο ``sys.path`` αναζητώντας τον υποκατάλογο του πακέτου." -#: tutorial/modules.rst:439 +#: tutorial/modules.rst:441 msgid "" "The :file:`__init__.py` files are required to make Python treat directories " "containing the file as packages (unless using a :term:`namespace package`, a " @@ -627,7 +997,7 @@ msgstr "" "εκτελέσει initialization κώδικα για το πακέτο ή να ορίσει την μεταβλητή " "``__all__``, που περιγράφεται αργότερα." -#: tutorial/modules.rst:447 +#: tutorial/modules.rst:449 msgid "" "Users of the package can import individual modules from the package, for " "example::" @@ -636,6 +1006,10 @@ msgstr "" "για παράδειγμα::" #: tutorial/modules.rst:452 +msgid "import sound.effects.echo" +msgstr "import sound.effects.echo" + +#: tutorial/modules.rst:454 msgid "" "This loads the submodule :mod:`!sound.effects.echo`. It must be referenced " "with its full name. ::" @@ -644,10 +1018,18 @@ msgstr "" "με το πλήρες όνομά του. ::" #: tutorial/modules.rst:457 +msgid "sound.effects.echo.echofilter(input, output, delay=0.7, atten=4)" +msgstr "sound.effects.echo.echofilter(input, output, delay=0.7, atten=4)" + +#: tutorial/modules.rst:459 msgid "An alternative way of importing the submodule is::" msgstr "Ένα εναλλακτικός τρόπος για την εισαγωγή του submodule είναι::" #: tutorial/modules.rst:461 +msgid "from sound.effects import echo" +msgstr "from sound.effects import echo" + +#: tutorial/modules.rst:463 msgid "" "This also loads the submodule :mod:`!echo`, and makes it available without " "its package prefix, so it can be used as follows::" @@ -656,6 +1038,10 @@ msgstr "" "χωρίς το πρόθεμα πακέτου, ώστε να μπορεί να χρησιμοποιηθεί ως εξής::" #: tutorial/modules.rst:466 +msgid "echo.echofilter(input, output, delay=0.7, atten=4)" +msgstr "echo.echofilter(input, output, delay=0.7, atten=4)" + +#: tutorial/modules.rst:468 msgid "" "Yet another variation is to import the desired function or variable " "directly::" @@ -664,6 +1050,10 @@ msgstr "" "μεταβλητής::" #: tutorial/modules.rst:470 +msgid "from sound.effects.echo import echofilter" +msgstr "from sound.effects.echo import echofilter" + +#: tutorial/modules.rst:472 msgid "" "Again, this loads the submodule :mod:`!echo`, but this makes its function :" "func:`!echofilter` directly available::" @@ -672,6 +1062,10 @@ msgstr "" "συνάρτηση της :func:`!echofilter` άμεσα διαθέσιμη::" #: tutorial/modules.rst:475 +msgid "echofilter(input, output, delay=0.7, atten=4)" +msgstr "echofilter(input, output, delay=0.7, atten=4)" + +#: tutorial/modules.rst:477 msgid "" "Note that when using ``from package import item``, the item can be either a " "submodule (or subpackage) of the package, or some other name defined in the " @@ -687,7 +1081,7 @@ msgstr "" "όχι, υποθέτει ότι είναι ένα module και επιχειρεί να το φορτώσει , αν δεν το " "βρει δημιουργεί η εξαίρεση :exc:`ImportError`." -#: tutorial/modules.rst:482 +#: tutorial/modules.rst:484 msgid "" "Contrarily, when using syntax like ``import item.subitem.subsubitem``, each " "item except for the last must be a package; the last item can be a module or " @@ -700,11 +1094,11 @@ msgstr "" "δεν μπορεί να είναι μια κλάση ή συνάρτηση ή μεταβλητή που ορίζεται από " "προηγούμενο στοιχείο." -#: tutorial/modules.rst:491 +#: tutorial/modules.rst:493 msgid "Importing \\* From a Package" msgstr "Εισάγοντας \\* από ένα Πακέτο" -#: tutorial/modules.rst:495 +#: tutorial/modules.rst:497 msgid "" "Now what happens when the user writes ``from sound.effects import *``? " "Ideally, one would hope that this somehow goes out to the filesystem, finds " @@ -719,7 +1113,7 @@ msgstr "" "μπορεί να έχει ανεπιθύμητες παρενέργειες που θα έπρεπε να συμβούν όταν το " "submodule εισάγεται ρητά." -#: tutorial/modules.rst:501 +#: tutorial/modules.rst:503 msgid "" "The only solution is for the package author to provide an explicit index of " "the package. The :keyword:`import` statement uses the following convention: " @@ -744,6 +1138,10 @@ msgstr "" "περιέχει τον ακόλουθο κώδικα::" #: tutorial/modules.rst:513 +msgid "__all__ = [\"echo\", \"surround\", \"reverse\"]" +msgstr "__all__ = [\"echo\", \"surround\", \"reverse\"]" + +#: tutorial/modules.rst:515 msgid "" "This would mean that ``from sound.effects import *`` would import the three " "named submodules of the :mod:`!sound.effects` package." @@ -751,7 +1149,7 @@ msgstr "" "Αυτό θα σήμαινε ότι ``from sound.effects import *`` θα εισαγάγει τα τρία " "submodules με το όνομα του πακέτου :mod:`!sound.effects`." -#: tutorial/modules.rst:516 +#: tutorial/modules.rst:518 msgid "" "Be aware that submodules might become shadowed by locally defined names. For " "example, if you added a ``reverse`` function to the :file:`sound/effects/" @@ -767,7 +1165,27 @@ msgstr "" "``surround``, αλλά *όχι* το submodule ``reverse``, επειδή επισκιάζεται από " "την τοπικά καθορισμένη συνάρτηση ``reverse``::" -#: tutorial/modules.rst:532 +#: tutorial/modules.rst:525 +msgid "" +"__all__ = [\n" +" \"echo\", # refers to the 'echo.py' file\n" +" \"surround\", # refers to the 'surround.py' file\n" +" \"reverse\", # !!! refers to the 'reverse' function now !!!\n" +"]\n" +"\n" +"def reverse(msg: str): # <-- this name shadows the 'reverse.py' submodule\n" +" return msg[::-1] # in the case of a 'from sound.effects import *'" +msgstr "" +"__all__ = [\n" +" \"echo\", # refers to the 'echo.py' file\n" +" \"surround\", # refers to the 'surround.py' file\n" +" \"reverse\", # !!! refers to the 'reverse' function now !!!\n" +"]\n" +"\n" +"def reverse(msg: str): # <-- this name shadows the 'reverse.py' submodule\n" +" return msg[::-1] # in the case of a 'from sound.effects import *'" + +#: tutorial/modules.rst:534 msgid "" "If ``__all__`` is not defined, the statement ``from sound.effects import *`` " "does *not* import all submodules from the package :mod:`!sound.effects` into " @@ -789,7 +1207,17 @@ msgstr "" "Περιλαμβάνει επίσης τυχόν submodules του πακέτου που φορτώθηκαν ρητά από " "προηγούμενες δηλώσεις :keyword:`import`. Σκεφτείτε αυτόν τον κώδικα::" -#: tutorial/modules.rst:545 +#: tutorial/modules.rst:543 +msgid "" +"import sound.effects.echo\n" +"import sound.effects.surround\n" +"from sound.effects import *" +msgstr "" +"import sound.effects.echo\n" +"import sound.effects.surround\n" +"from sound.effects import *" + +#: tutorial/modules.rst:547 msgid "" "In this example, the :mod:`!echo` and :mod:`!surround` modules are imported " "in the current namespace because they are defined in the :mod:`!sound." @@ -798,10 +1226,10 @@ msgid "" msgstr "" "Σε αυτό το παράδειγμα, τα modules :mod:`!echo` και :mod:`!surround` " "εισάγονται στο τρέχον namespace επειδή ορίζονται στο πακέτο :mod:`!sound." -"effects`όταν η δήλωση ``from...import`` εκτελείται. (Αυτό λειτουργεί επίσης " -"όταν ορίζεται το ``__all__``)." +"effects` όταν η δήλωση ``from...import`` εκτελείται. (Αυτό λειτουργεί " +"επίσης όταν ορίζεται το ``__all__``)." -#: tutorial/modules.rst:550 +#: tutorial/modules.rst:552 msgid "" "Although certain modules are designed to export only names that follow " "certain patterns when you use ``import *``, it is still considered bad " @@ -811,7 +1239,7 @@ msgstr "" "ακολουθούν ορισμένα μοτίβα όταν χρησιμοποιείτε το ``import *``, εξακολουθεί " "να θεωρείται κακή πρακτική στον κώδικα παραγωγής." -#: tutorial/modules.rst:554 +#: tutorial/modules.rst:556 msgid "" "Remember, there is nothing wrong with using ``from package import " "specific_submodule``! In fact, this is the recommended notation unless the " @@ -823,11 +1251,11 @@ msgstr "" "σημείωση, εκτός εάν το module εισαγωγής χρειάζεται να χρησιμοποιήσει " "submodules με το ίδιο όνομα από διαφορετικά πακέτα." -#: tutorial/modules.rst:563 +#: tutorial/modules.rst:565 msgid "Intra-package References" msgstr "Intra-package αναφορές" -#: tutorial/modules.rst:565 +#: tutorial/modules.rst:567 msgid "" "When packages are structured into subpackages (as with the :mod:`!sound` " "package in the example), you can use absolute imports to refer to submodules " @@ -842,7 +1270,7 @@ msgstr "" "στο πακέτο :mod:`!sound.effects` , μπορεί να χρησιμοποιήσει το ``from sound." "effects import echo``." -#: tutorial/modules.rst:571 +#: tutorial/modules.rst:573 msgid "" "You can also write relative imports, with the ``from module import name`` " "form of import statement. These imports use leading dots to indicate the " @@ -855,38 +1283,48 @@ msgstr "" "στη σχετική εισαγωγή. Από το :mod:`!surround` module για παράδειγμα, μπορεί " "να χρησιμοποιήσετε::" -#: tutorial/modules.rst:580 +#: tutorial/modules.rst:578 +msgid "" +"from . import echo\n" +"from .. import formats\n" +"from ..filters import equalizer" +msgstr "" +"from . import echo\n" +"from .. import formats\n" +"from ..filters import equalizer" + +#: tutorial/modules.rst:582 msgid "" -"Note that relative imports are based on the name of the current module. " -"Since the name of the main module is always ``\"__main__\"``, modules " -"intended for use as the main module of a Python application must always use " -"absolute imports." +"Note that relative imports are based on the name of the current module's " +"package. Since the main module does not have a package, modules intended for " +"use as the main module of a Python application must always use absolute " +"imports." msgstr "" "Λάβετε υπόψη ότι οι σχετικές εισαγωγές βασίζονται στο όνομα του τρέχοντος " -"module. Επειδή το όνομα του κύριου module είναι πάντα ``\"__main__\"``, τα " -"modules που προορίζονται για χρήση ως κύριο module μιας εφαρμογής Python " -"πρέπει πάντα να χρησιμοποιούν απόλυτες εισαγωγές." +"module. Επειδή το όνομα του κύριου module δεν έχει πακέτο, τα modules που " +"προορίζονται για χρήση ως το κύριο module μιας εφαρμογής Python πρέπει πάντα " +"να χρησιμοποιούν απόλυτες εισαγωγές." -#: tutorial/modules.rst:586 +#: tutorial/modules.rst:588 msgid "Packages in Multiple Directories" msgstr "Πακέτα σε Πολλαπλούς Καταλόγους" -#: tutorial/modules.rst:588 +#: tutorial/modules.rst:590 msgid "" -"Packages support one more special attribute, :attr:`__path__`. This is " -"initialized to be a list containing the name of the directory holding the " -"package's :file:`__init__.py` before the code in that file is executed. " -"This variable can be modified; doing so affects future searches for modules " -"and subpackages contained in the package." +"Packages support one more special attribute, :attr:`~module.__path__`. This " +"is initialized to be a :term:`sequence` of strings containing the name of " +"the directory holding the package's :file:`__init__.py` before the code in " +"that file is executed. This variable can be modified; doing so affects " +"future searches for modules and subpackages contained in the package." msgstr "" -"Τα πακέτα υποστηρίζουν ένα ακόμη ειδικό χαρακτηριστικό, :attr:`__path__`. " -"Αυτό έχει αρχικοποιηθεί ώστε να είναι μια λίστα που περιέχει το όνομα του " -"καταλόγου που το :file:`__init__.py` του πακέτου πριν από την εκτέλεση του " -"κώδικα σε αυτό το αρχείο. Αυτή η μεταβλητή μπορεί να τροποποιηθεί, αυτό " -"επηρεάζει τις μελλοντικές αναζητήσεις για modules και υποπακέτα που " -"περιέχονται στο πακέτο." +"Τα πακέτα υποστηρίζουν ένα ακόμη ειδικό χαρακτηριστικό, :attr:`~module." +"__path__`. Αυτό έχει αρχικοποιηθεί ως μια :term:`sequence` από " +"συμβολοσειρές που περιέχει το όνομα του καταλόγου που το :file:`__init__.py` " +"του πακέτου πριν από την εκτέλεση του κώδικα σε αυτό το αρχείο. Αυτή η " +"μεταβλητή μπορεί να τροποποιηθεί, αυτό επηρεάζει τις μελλοντικές αναζητήσεις " +"για modules και υποπακέτα που περιέχονται στο πακέτο." -#: tutorial/modules.rst:594 +#: tutorial/modules.rst:597 msgid "" "While this feature is not often needed, it can be used to extend the set of " "modules found in a package." @@ -894,11 +1332,11 @@ msgstr "" "Ενώ αυτή η δυνατότητα δεν χρειάζεται συχνά, μπορεί να χρησιμοποιηθεί για την " "επέκταση του συνόλου των modules που βρίσκονται σε ένα πακέτο." -#: tutorial/modules.rst:599 +#: tutorial/modules.rst:602 msgid "Footnotes" msgstr "Υποσημειώσεις" -#: tutorial/modules.rst:600 +#: tutorial/modules.rst:603 msgid "" "In fact function definitions are also 'statements' that are 'executed'; the " "execution of a module-level function definition adds the function name to " @@ -908,26 +1346,26 @@ msgstr "" "'εκτελούνται'∙ η εκτέλεση ενός ορισμού συνάρτησης σε επίπεδο module " "προσθέτει το όνομα της συνάρτησης στον καθολικό namespace του module." -#: tutorial/modules.rst:267 tutorial/modules.rst:348 +#: tutorial/modules.rst:269 tutorial/modules.rst:350 msgid "module" msgstr "module" -#: tutorial/modules.rst:184 +#: tutorial/modules.rst:186 msgid "search" msgstr "αναζήτηση" -#: tutorial/modules.rst:184 +#: tutorial/modules.rst:186 msgid "path" msgstr "path" -#: tutorial/modules.rst:267 +#: tutorial/modules.rst:269 msgid "sys" msgstr "sys" -#: tutorial/modules.rst:348 +#: tutorial/modules.rst:350 msgid "builtins" msgstr "builtins" -#: tutorial/modules.rst:493 +#: tutorial/modules.rst:495 msgid "__all__" msgstr "__all__" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index ab7a580b..581ce406 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-08-02 23:37+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -34,6 +34,22 @@ msgstr "" "Το module :mod:`os` παρέχει δεκάδες λειτουργίες για αλληλεπίδραση με το " "λειτουργικό σύστημα::" +#: tutorial/stdlib.rst:16 +msgid "" +">>> import os\n" +">>> os.getcwd() # Return the current working directory\n" +"'C:\\\\Python314'\n" +">>> os.chdir('/server/accesslogs') # Change current working directory\n" +">>> os.system('mkdir today') # Run the command mkdir in the system shell\n" +"0" +msgstr "" +">>> import os\n" +">>> os.getcwd() # Return the current working directory\n" +"'C:\\\\Python314'\n" +">>> os.chdir('/server/accesslogs') # Change current working directory\n" +">>> os.system('mkdir today') # Run the command mkdir in the system shell\n" +"0" + #: tutorial/stdlib.rst:23 msgid "" "Be sure to use the ``import os`` style instead of ``from os import *``. " @@ -52,6 +68,21 @@ msgstr "" "Οι ενσωματωμένες συναρτήσεις :func:`dir` και :func:`help` είναι χρήσιμες ως " "διαδραστικά βοηθήματα για εργασία με μεγάλα modules όπως :mod:`os`::" +#: tutorial/stdlib.rst:32 +msgid "" +">>> import os\n" +">>> dir(os)\n" +"\n" +">>> help(os)\n" +"" +msgstr "" +">>> import os\n" +">>> dir(os)\n" +"<επιστρέφει μια λίστα από όλες τις συναρτήσεις module>\n" +">>> help(os)\n" +"<επιστρέφει μια εκτενή σελίδα εγχειριδίου που δημιουργήθηκε από τα " +"docstrings του module>" + #: tutorial/stdlib.rst:38 msgid "" "For daily file and directory management tasks, the :mod:`shutil` module " @@ -61,6 +92,20 @@ msgstr "" "mod:`shutil` παρέχει μια διεπαφή υψηλότερου επιπέδου που είναι πιο εύκολη " "στην χρήση::" +#: tutorial/stdlib.rst:41 +msgid "" +">>> import shutil\n" +">>> shutil.copyfile('data.db', 'archive.db')\n" +"'archive.db'\n" +">>> shutil.move('/build/executables', 'installdir')\n" +"'installdir'" +msgstr "" +">>> import shutil\n" +">>> shutil.copyfile('data.db', 'archive.db')\n" +"'archive.db'\n" +">>> shutil.move('/build/executables', 'installdir')\n" +"'installdir'" + #: tutorial/stdlib.rst:51 msgid "File Wildcards" msgstr "Wildcard Αρχεία" @@ -73,6 +118,16 @@ msgstr "" "Το module :mod:`glob` παρέχει μια λειτουργία για τη δημιουργία λιστών " "αρχείων από αναζητήσεις με χαρακτήρες μπαλαντέρ καταλόγου::" +#: tutorial/stdlib.rst:56 +msgid "" +">>> import glob\n" +">>> glob.glob('*.py')\n" +"['primes.py', 'random.py', 'quote.py']" +msgstr "" +">>> import glob\n" +">>> glob.glob('*.py')\n" +"['primes.py', 'random.py', 'quote.py']" + #: tutorial/stdlib.rst:64 msgid "Command Line Arguments" msgstr "Ορίσματα γραμμής εντολών" @@ -88,6 +143,16 @@ msgstr "" "*argv* του module :mod:`sys` ως λίστα. Για παράδειγμα, ας πάρουμε το " "ακόλουθο αρχείο :file:`demo.py`::" +#: tutorial/stdlib.rst:70 +msgid "" +"# File demo.py\n" +"import sys\n" +"print(sys.argv)" +msgstr "" +"# File demo.py\n" +"import sys\n" +"print(sys.argv)" + #: tutorial/stdlib.rst:74 msgid "" "Here is the output from running ``python demo.py one two three`` at the " @@ -96,6 +161,10 @@ msgstr "" "Εδώ είναι το αποτέλεσμα από την εκτέλεση του ``python demo.py one two " "three`` στη γραμμή εντολών::" +#: tutorial/stdlib.rst:77 +msgid "['demo.py', 'one', 'two', 'three']" +msgstr "['demo.py', 'one', 'two', 'three']" + #: tutorial/stdlib.rst:79 msgid "" "The :mod:`argparse` module provides a more sophisticated mechanism to " @@ -107,6 +176,28 @@ msgstr "" "περισσότερα ονόματα αρχείων και έναν προαιρετικό αριθμό γραμμών που θα " "εμφανιστούν::" +#: tutorial/stdlib.rst:83 +msgid "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(\n" +" prog='top',\n" +" description='Show top lines from each file')\n" +"parser.add_argument('filenames', nargs='+')\n" +"parser.add_argument('-l', '--lines', type=int, default=10)\n" +"args = parser.parse_args()\n" +"print(args)" +msgstr "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(\n" +" prog='top',\n" +" description='Show top lines from each file')\n" +"parser.add_argument('filenames', nargs='+')\n" +"parser.add_argument('-l', '--lines', type=int, default=10)\n" +"args = parser.parse_args()\n" +"print(args)" + #: tutorial/stdlib.rst:93 msgid "" "When run at the command line with ``python top.py --lines=5 alpha.txt beta." @@ -132,6 +223,14 @@ msgstr "" "μηνυμάτων σφαλμάτων ώστε να είναι ορατά ακόμα και όταν το *stdout* έχει " "ανακατευθυνθεί::" +#: tutorial/stdlib.rst:107 +msgid "" +">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" +"Warning, log file not found starting a new one" +msgstr "" +">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" +"Warning, log file not found starting a new one" + #: tutorial/stdlib.rst:110 msgid "The most direct way to terminate a script is to use ``sys.exit()``." msgstr "" @@ -152,6 +251,20 @@ msgstr "" "επεξεργασία συμβολοσειρών. Για πολύπλοκη αντιστοίχιση και χειρισμό, οι " "τυπικές εκφράσεις προσφέρουν συνοπτικές, βελτιστοποιημένες λύσεις::" +#: tutorial/stdlib.rst:122 +msgid "" +">>> import re\n" +">>> re.findall(r'\\bf[a-z]*', 'which foot or hand fell fastest')\n" +"['foot', 'fell', 'fastest']\n" +">>> re.sub(r'(\\b[a-z]+) \\1', r'\\1', 'cat in the the hat')\n" +"'cat in the hat'" +msgstr "" +">>> import re\n" +">>> re.findall(r'\\bf[a-z]*', 'which foot or hand fell fastest')\n" +"['foot', 'fell', 'fastest']\n" +">>> re.sub(r'(\\b[a-z]+) \\1', r'\\1', 'cat in the the hat')\n" +"'cat in the hat'" + #: tutorial/stdlib.rst:128 msgid "" "When only simple capabilities are needed, string methods are preferred " @@ -161,6 +274,14 @@ msgstr "" "συμβολοσειρών, επειδή είναι ευκολότερες στην ανάγνωση και τον εντοπισμό " "σφαλμάτων::" +#: tutorial/stdlib.rst:131 +msgid "" +">>> 'tea for too'.replace('too', 'two')\n" +"'tea for two'" +msgstr "" +">>> 'tea for too'.replace('too', 'two')\n" +"'tea for two'" + #: tutorial/stdlib.rst:138 msgid "Mathematics" msgstr "Μαθηματικά" @@ -168,16 +289,52 @@ msgstr "Μαθηματικά" #: tutorial/stdlib.rst:140 msgid "" "The :mod:`math` module gives access to the underlying C library functions " -"for floating point math::" +"for floating-point math::" msgstr "" "Το module :mod:`math` δίνει πρόσβαση στις υποκείμενες συναρτήσεις της " "βιβλιοθήκης C για μαθηματικά κινητής υποδιαστολής::" +#: tutorial/stdlib.rst:143 +msgid "" +">>> import math\n" +">>> math.cos(math.pi / 4)\n" +"0.70710678118654757\n" +">>> math.log(1024, 2)\n" +"10.0" +msgstr "" +">>> import math\n" +">>> math.cos(math.pi / 4)\n" +"0.70710678118654757\n" +">>> math.log(1024, 2)\n" +"10.0" + #: tutorial/stdlib.rst:149 msgid "The :mod:`random` module provides tools for making random selections::" msgstr "" "Το module :mod:`random` παρέχει εργαλεία για να κάνουμε τυχαίες επιλογές::" +#: tutorial/stdlib.rst:151 +msgid "" +">>> import random\n" +">>> random.choice(['apple', 'pear', 'banana'])\n" +"'apple'\n" +">>> random.sample(range(100), 10) # sampling without replacement\n" +"[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]\n" +">>> random.random() # random float from the interval [0.0, 1.0)\n" +"0.17970987693706186\n" +">>> random.randrange(6) # random integer chosen from range(6)\n" +"4" +msgstr "" +">>> import random\n" +">>> random.choice(['apple', 'pear', 'banana'])\n" +"'apple'\n" +">>> random.sample(range(100), 10) # sampling without replacement\n" +"[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]\n" +">>> random.random() # random float from the interval [0.0, 1.0)\n" +"0.17970987693706186\n" +">>> random.randrange(6) # random integer chosen from range(6)\n" +"4" + #: tutorial/stdlib.rst:161 msgid "" "The :mod:`statistics` module calculates basic statistical properties (the " @@ -186,6 +343,26 @@ msgstr "" "Το module :mod:`statistics` υπολογίζει βασικές στατιστικές ιδιότητες (μέσος " "όρος, διάμεσος, διακύμανση, κ.λπ.) αριθμητικών δεδομένων::" +#: tutorial/stdlib.rst:164 +msgid "" +">>> import statistics\n" +">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" +">>> statistics.mean(data)\n" +"1.6071428571428572\n" +">>> statistics.median(data)\n" +"1.25\n" +">>> statistics.variance(data)\n" +"1.3720238095238095" +msgstr "" +">>> import statistics\n" +">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" +">>> statistics.mean(data)\n" +"1.6071428571428572\n" +">>> statistics.median(data)\n" +"1.25\n" +">>> statistics.variance(data)\n" +"1.3720238095238095" + #: tutorial/stdlib.rst:173 msgid "" "The SciPy project has many other modules for numerical " @@ -209,6 +386,46 @@ msgstr "" "για να την ανάκτηση δεδομένων από διευθύνσεις URL και το :mod:`smtplib` για " "την αποστολή αλληλογραφίας::" +#: tutorial/stdlib.rst:185 +msgid "" +">>> from urllib.request import urlopen\n" +">>> with urlopen('https://docs.python.org/3/') as response:\n" +"... for line in response:\n" +"... line = line.decode() # Convert bytes to a str\n" +"... if 'updated' in line:\n" +"... print(line.rstrip()) # Remove trailing newline\n" +"...\n" +" Last updated on Nov 11, 2025 (20:11 UTC).\n" +"\n" +">>> import smtplib\n" +">>> server = smtplib.SMTP('localhost')\n" +">>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',\n" +"... \"\"\"To: jcaesar@example.org\n" +"... From: soothsayer@example.org\n" +"...\n" +"... Beware the Ides of March.\n" +"... \"\"\")\n" +">>> server.quit()" +msgstr "" +">>> from urllib.request import urlopen\n" +">>> with urlopen('https://docs.python.org/3/') as response:\n" +"... for line in response:\n" +"... line = line.decode() # Convert bytes to a str\n" +"... if 'updated' in line:\n" +"... print(line.rstrip()) # Remove trailing newline\n" +"...\n" +" Last updated on Nov 11, 2025 (20:11 UTC).\n" +"\n" +">>> import smtplib\n" +">>> server = smtplib.SMTP('localhost')\n" +">>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',\n" +"... \"\"\"To: jcaesar@example.org\n" +"... From: soothsayer@example.org\n" +"...\n" +"... Beware the Ides of March.\n" +"... \"\"\")\n" +">>> server.quit()" + #: tutorial/stdlib.rst:204 msgid "(Note that the second example needs a mailserver running on localhost.)" msgstr "" @@ -233,6 +450,36 @@ msgstr "" "μορφοποίηση και χειρισμό εξόδου. Το module επίσης υποστηρίζει αντικείμενα " "που έχουν επίγνωση ζώνης ώρας. ::" +#: tutorial/stdlib.rst:218 +msgid "" +">>> # dates are easily constructed and formatted\n" +">>> from datetime import date\n" +">>> now = date.today()\n" +">>> now\n" +"datetime.date(2003, 12, 2)\n" +">>> now.strftime(\"%m-%d-%y. %d %b %Y is a %A on the %d day of %B.\")\n" +"'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'\n" +"\n" +">>> # dates support calendar arithmetic\n" +">>> birthday = date(1964, 7, 31)\n" +">>> age = now - birthday\n" +">>> age.days\n" +"14368" +msgstr "" +">>> # dates are easily constructed and formatted\n" +">>> from datetime import date\n" +">>> now = date.today()\n" +">>> now\n" +"datetime.date(2003, 12, 2)\n" +">>> now.strftime(\"%m-%d-%y. %d %b %Y is a %A on the %d day of %B.\")\n" +"'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'\n" +"\n" +">>> # dates support calendar arithmetic\n" +">>> birthday = date(1964, 7, 31)\n" +">>> age = now - birthday\n" +">>> age.days\n" +"14368" + #: tutorial/stdlib.rst:236 msgid "Data Compression" msgstr "Συμπίεση Δεδομένων" @@ -247,6 +494,32 @@ msgstr "" "άμεσα από modules όπως: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :" "mod:`zipfile` και :mod:`tarfile`. ::" +#: tutorial/stdlib.rst:242 +msgid "" +">>> import zlib\n" +">>> s = b'witch which has which witches wrist watch'\n" +">>> len(s)\n" +"41\n" +">>> t = zlib.compress(s)\n" +">>> len(t)\n" +"37\n" +">>> zlib.decompress(t)\n" +"b'witch which has which witches wrist watch'\n" +">>> zlib.crc32(s)\n" +"226805979" +msgstr "" +">>> import zlib\n" +">>> s = b'witch which has which witches wrist watch'\n" +">>> len(s)\n" +"41\n" +">>> t = zlib.compress(s)\n" +">>> len(t)\n" +"37\n" +">>> zlib.decompress(t)\n" +"b'witch which has which witches wrist watch'\n" +">>> zlib.crc32(s)\n" +"226805979" + #: tutorial/stdlib.rst:258 msgid "Performance Measurement" msgstr "Μέτρηση επίδοσης" @@ -272,6 +545,20 @@ msgstr "" "εναλλαγή ορισμάτων. Το module :mod:`timeit` δείχνει γρήγορα ένα ταπεινό " "πλεονέκτημα απόδοσης::" +#: tutorial/stdlib.rst:268 +msgid "" +">>> from timeit import Timer\n" +">>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()\n" +"0.57535828626024577\n" +">>> Timer('a,b = b,a', 'a=1; b=2').timeit()\n" +"0.54962537085770791" +msgstr "" +">>> from timeit import Timer\n" +">>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()\n" +"0.57535828626024577\n" +">>> Timer('a,b = b,a', 'a=1; b=2').timeit()\n" +"0.54962537085770791" + #: tutorial/stdlib.rst:274 msgid "" "In contrast to :mod:`timeit`'s fine level of granularity, the :mod:`profile` " @@ -313,6 +600,30 @@ msgstr "" "παράδειγμα και επιτρέπει στην ενότητα doctest να βεβαιωθεί ότι ο κώδικας " "παραμένει πιστός στην τεκμηρίωση::" +#: tutorial/stdlib.rst:295 +msgid "" +"def average(values):\n" +" \"\"\"Computes the arithmetic mean of a list of numbers.\n" +"\n" +" >>> print(average([20, 30, 70]))\n" +" 40.0\n" +" \"\"\"\n" +" return sum(values) / len(values)\n" +"\n" +"import doctest\n" +"doctest.testmod() # automatically validate the embedded tests" +msgstr "" +"def average(values):\n" +" \"\"\"Υπολογίζει έναν αριθμητικό μέσο για μια λίστα από αριθμούς.\n" +"\n" +" >>> print(average([20, 30, 70]))\n" +" 40.0\n" +" \"\"\"\n" +" return sum(values) / len(values)\n" +"\n" +"import doctest\n" +"doctest.testmod() # automatically validate the embedded tests" + #: tutorial/stdlib.rst:306 msgid "" "The :mod:`unittest` module is not as effortless as the :mod:`doctest` " @@ -323,6 +634,36 @@ msgstr "" "`doctest`, αλλά επιτρέπει τη διατήρηση ενός πιο ολοκληρωμένου συνόλου tests " "σε ξεχωριστό αρχείο::" +#: tutorial/stdlib.rst:310 +msgid "" +"import unittest\n" +"\n" +"class TestStatisticalFunctions(unittest.TestCase):\n" +"\n" +" def test_average(self):\n" +" self.assertEqual(average([20, 30, 70]), 40.0)\n" +" self.assertEqual(round(average([1, 5, 7]), 1), 4.3)\n" +" with self.assertRaises(ZeroDivisionError):\n" +" average([])\n" +" with self.assertRaises(TypeError):\n" +" average(20, 30, 70)\n" +"\n" +"unittest.main() # Calling from the command line invokes all tests" +msgstr "" +"import unittest\n" +"\n" +"class TestStatisticalFunctions(unittest.TestCase):\n" +"\n" +" def test_average(self):\n" +" self.assertEqual(average([20, 30, 70]), 40.0)\n" +" self.assertEqual(round(average([1, 5, 7]), 1), 4.3)\n" +" with self.assertRaises(ZeroDivisionError):\n" +" average([])\n" +" with self.assertRaises(TypeError):\n" +" average(20, 30, 70)\n" +"\n" +"unittest.main() # Calling from the command line invokes all tests" + #: tutorial/stdlib.rst:328 msgid "Batteries Included" msgstr "Batteries Included" @@ -351,7 +692,7 @@ msgstr "" #: tutorial/stdlib.rst:337 msgid "" "The :mod:`email` package is a library for managing email messages, including " -"MIME and other :rfc:`2822`-based message documents. Unlike :mod:`smtplib` " +"MIME and other :rfc:`5322`-based message documents. Unlike :mod:`smtplib` " "and :mod:`poplib` which actually send and receive messages, the email " "package has a complete toolset for building or decoding complex message " "structures (including attachments) and for implementing internet encoding " @@ -359,7 +700,7 @@ msgid "" msgstr "" "Το πακέτο :mod:`email` είναι μια βιβλιοθήκη για τη διαχείριση μηνυμάτων " "ηλεκτρονικού ταχυδρομείου, συμπεριλαμβανομένων MIME και άλλων μηνυμάτων " -"εγγράφων που βασίζονται σε :rfc:`2822`. Σε αντίθεση με τα :mod:`smtplib` " +"εγγράφων που βασίζονται σε :rfc:`5322`. Σε αντίθεση με τα :mod:`smtplib` " "και :mod:`poplib` που στην πραγματικότητα στέλνουν και λαμβάνουν μηνύματα, " "το πακέτο email έχει ένα πλήρες σύνολο εργαλείων για τη δημιουργία ή την " "αποκωδικοποίηση πολύπλοκων δομών μηνυμάτων (συμπεριλαμβανομένων των " diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index 1f02545e..4752a3a3 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-09-11 11:14+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-05-13 19:38+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -43,6 +43,16 @@ msgstr "" "Το module :mod:`reprlib` παρέχει μια έκδοση του :func:`repr` προσαρμοσμένη " "για συντομευμένες εμφανίσεις μεγάλων ή βαθιά ένθετων containers::" +#: tutorial/stdlib2.rst:19 +msgid "" +">>> import reprlib\n" +">>> reprlib.repr(set('supercalifragilisticexpialidocious'))\n" +"\"{'a', 'c', 'd', 'e', 'f', 'g', ...}\"" +msgstr "" +">>> import reprlib\n" +">>> reprlib.repr(set('supercalifragilisticexpialidocious'))\n" +"\"{'a', 'c', 'd', 'e', 'f', 'g', ...}\"" + #: tutorial/stdlib2.rst:23 msgid "" "The :mod:`pprint` module offers more sophisticated control over printing " @@ -56,6 +66,30 @@ msgstr "" "αποτέλεσμα είναι μεγαλύτερο από μία γραμμή, ο \"pretty printer\" προσθέτει " "αλλαγές γραμμής και εσοχές για να εμφανιστεί πιο ξεκάθαρα η δομή δεδομένων::" +#: tutorial/stdlib2.rst:28 +msgid "" +">>> import pprint\n" +">>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',\n" +"... 'yellow'], 'blue']]]\n" +"...\n" +">>> pprint.pprint(t, width=30)\n" +"[[[['black', 'cyan'],\n" +" 'white',\n" +" ['green', 'red']],\n" +" [['magenta', 'yellow'],\n" +" 'blue']]]" +msgstr "" +">>> import pprint\n" +">>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',\n" +"... 'yellow'], 'blue']]]\n" +"...\n" +">>> pprint.pprint(t, width=30)\n" +"[[[['black', 'cyan'],\n" +" 'white',\n" +" ['green', 'red']],\n" +" [['magenta', 'yellow'],\n" +" 'blue']]]" + #: tutorial/stdlib2.rst:39 msgid "" "The :mod:`textwrap` module formats paragraphs of text to fit a given screen " @@ -64,6 +98,32 @@ msgstr "" "Το module :mod:`textwrap` μορφοποιεί τις παραγράφους του κειμένου ώστε να " "ταιριάζει σε ένα δεδομένο πλάτος οθόνης::" +#: tutorial/stdlib2.rst:42 +msgid "" +">>> import textwrap\n" +">>> doc = \"\"\"The wrap() method is just like fill() except that it " +"returns\n" +"... a list of strings instead of one big string with newlines to separate\n" +"... the wrapped lines.\"\"\"\n" +"...\n" +">>> print(textwrap.fill(doc, width=40))\n" +"The wrap() method is just like fill()\n" +"except that it returns a list of strings\n" +"instead of one big string with newlines\n" +"to separate the wrapped lines." +msgstr "" +">>> import textwrap\n" +">>> doc = \"\"\"The wrap() method is just like fill() except that it " +"returns\n" +"... a list of strings instead of one big string with newlines to separate\n" +"... the wrapped lines.\"\"\"\n" +"...\n" +">>> print(textwrap.fill(doc, width=40))\n" +"The wrap() method is just like fill()\n" +"except that it returns a list of strings\n" +"instead of one big string with newlines\n" +"to separate the wrapped lines." + #: tutorial/stdlib2.rst:53 msgid "" "The :mod:`locale` module accesses a database of culture specific data " @@ -75,6 +135,30 @@ msgstr "" "μορφοποίησης της τοπικής ρύθμισης παρέχει έναν άμεσο τρόπο μορφοποίησης " "αριθμών με διαχωριστικά ομάδων::" +#: tutorial/stdlib2.rst:57 +msgid "" +">>> import locale\n" +">>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')\n" +"'English_United States.1252'\n" +">>> conv = locale.localeconv() # get a mapping of conventions\n" +">>> x = 1234567.8\n" +">>> locale.format_string(\"%d\", x, grouping=True)\n" +"'1,234,567'\n" +">>> locale.format_string(\"%s%.*f\", (conv['currency_symbol'],\n" +"... conv['frac_digits'], x), grouping=True)\n" +"'$1,234,567.80'" +msgstr "" +">>> import locale\n" +">>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')\n" +"'English_United States.1252'\n" +">>> conv = locale.localeconv() # get a mapping of conventions\n" +">>> x = 1234567.8\n" +">>> locale.format_string(\"%d\", x, grouping=True)\n" +"'1,234,567'\n" +">>> locale.format_string(\"%s%.*f\", (conv['currency_symbol'],\n" +"... conv['frac_digits'], x), grouping=True)\n" +"'$1,234,567.80'" + #: tutorial/stdlib2.rst:72 msgid "Templating" msgstr "Templating" @@ -105,6 +189,18 @@ msgstr "" "περισσότερα αλφαριθμητικά γράμματα χωρίς ενδιάμεσα κενά. Γράφοντας ``$$`` " "δημιουργεί ένα ενιαίο ``$``::" +#: tutorial/stdlib2.rst:83 +msgid "" +">>> from string import Template\n" +">>> t = Template('${village}folk send $$10 to $cause.')\n" +">>> t.substitute(village='Nottingham', cause='the ditch fund')\n" +"'Nottinghamfolk send $10 to the ditch fund.'" +msgstr "" +">>> from string import Template\n" +">>> t = Template('${village}folk send $$10 to $cause.')\n" +">>> t.substitute(village='Nottingham', cause='the ditch fund')\n" +"'Nottinghamfolk send $10 to the ditch fund.'" + #: tutorial/stdlib2.rst:88 msgid "" "The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when " @@ -120,6 +216,26 @@ msgstr "" "`~string.Template.safe_substitute` μπορεί να είναι πιο κατάλληλη --- θα " "αφήσει αμετάβλητα τα placeholders εάν λείπουν δεδομένα::" +#: tutorial/stdlib2.rst:94 +msgid "" +">>> t = Template('Return the $item to $owner.')\n" +">>> d = dict(item='unladen swallow')\n" +">>> t.substitute(d)\n" +"Traceback (most recent call last):\n" +" ...\n" +"KeyError: 'owner'\n" +">>> t.safe_substitute(d)\n" +"'Return the unladen swallow to $owner.'" +msgstr "" +">>> t = Template('Return the $item to $owner.')\n" +">>> d = dict(item='unladen swallow')\n" +">>> t.substitute(d)\n" +"Traceback (most recent call last):\n" +" ...\n" +"KeyError: 'owner'\n" +">>> t.safe_substitute(d)\n" +"'Return the unladen swallow to $owner.'" + #: tutorial/stdlib2.rst:103 msgid "" "Template subclasses can specify a custom delimiter. For example, a batch " @@ -133,6 +249,46 @@ msgstr "" "ποσοστού για placeholders όπως η τρέχουσα ημερομηνία, ο αριθμός ακολουθίας " "εικόνων ή η μορφή αρχείου::" +#: tutorial/stdlib2.rst:107 +msgid "" +">>> import time, os.path\n" +">>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']\n" +">>> class BatchRename(Template):\n" +"... delimiter = '%'\n" +"...\n" +">>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ')\n" +"Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f\n" +"\n" +">>> t = BatchRename(fmt)\n" +">>> date = time.strftime('%d%b%y')\n" +">>> for i, filename in enumerate(photofiles):\n" +"... base, ext = os.path.splitext(filename)\n" +"... newname = t.substitute(d=date, n=i, f=ext)\n" +"... print('{0} --> {1}'.format(filename, newname))\n" +"\n" +"img_1074.jpg --> Ashley_0.jpg\n" +"img_1076.jpg --> Ashley_1.jpg\n" +"img_1077.jpg --> Ashley_2.jpg" +msgstr "" +">>> import time, os.path\n" +">>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']\n" +">>> class BatchRename(Template):\n" +"... delimiter = '%'\n" +"...\n" +">>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ')\n" +"Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f\n" +"\n" +">>> t = BatchRename(fmt)\n" +">>> date = time.strftime('%d%b%y')\n" +">>> for i, filename in enumerate(photofiles):\n" +"... base, ext = os.path.splitext(filename)\n" +"... newname = t.substitute(d=date, n=i, f=ext)\n" +"... print('{0} --> {1}'.format(filename, newname))\n" +"\n" +"img_1074.jpg --> Ashley_0.jpg\n" +"img_1076.jpg --> Ashley_1.jpg\n" +"img_1077.jpg --> Ashley_2.jpg" + #: tutorial/stdlib2.rst:126 msgid "" "Another application for templating is separating program logic from the " @@ -166,6 +322,46 @@ msgstr "" "αριθμούς χωρίς υπογραφή δύο και τεσσάρων byte αντίστοιχα. Το ``\"<\"`` " "υποδηλώνει ότι είναι τυπικού μεγέθους και σε σειρά byte λίγο endian::" +#: tutorial/stdlib2.rst:144 +msgid "" +"import struct\n" +"\n" +"with open('myfile.zip', 'rb') as f:\n" +" data = f.read()\n" +"\n" +"start = 0\n" +"for i in range(3): # show the first 3 file headers\n" +" start += 14\n" +" fields = struct.unpack('>> import weakref, gc\n" +">>> class A:\n" +"... def __init__(self, value):\n" +"... self.value = value\n" +"... def __repr__(self):\n" +"... return str(self.value)\n" +"...\n" +">>> a = A(10) # create a reference\n" +">>> d = weakref.WeakValueDictionary()\n" +">>> d['primary'] = a # does not create a reference\n" +">>> d['primary'] # fetch the object if it is still alive\n" +"10\n" +">>> del a # remove the one reference\n" +">>> gc.collect() # run garbage collection right away\n" +"0\n" +">>> d['primary'] # entry was automatically removed\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" d['primary'] # entry was automatically removed\n" +" File \"C:/python314/lib/weakref.py\", line 46, in __getitem__\n" +" o = self.data[key]()\n" +"KeyError: 'primary'" +msgstr "" +">>> import weakref, gc\n" +">>> class A:\n" +"... def __init__(self, value):\n" +"... self.value = value\n" +"... def __repr__(self):\n" +"... return str(self.value)\n" +"...\n" +">>> a = A(10) # create a reference\n" +">>> d = weakref.WeakValueDictionary()\n" +">>> d['primary'] = a # does not create a reference\n" +">>> d['primary'] # fetch the object if it is still alive\n" +"10\n" +">>> del a # remove the one reference\n" +">>> gc.collect() # run garbage collection right away\n" +"0\n" +">>> d['primary'] # entry was automatically removed\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" d['primary'] # entry was automatically removed\n" +" File \"C:/python314/lib/weakref.py\", line 46, in __getitem__\n" +" o = self.data[key]()\n" +"KeyError: 'primary'" + #: tutorial/stdlib2.rst:290 msgid "Tools for Working with Lists" msgstr "Εργαλεία για εργασία με λίστες" @@ -320,31 +634,79 @@ msgstr "" #: tutorial/stdlib2.rst:296 msgid "" -"The :mod:`array` module provides an :class:`~array.array()` object that is " +"The :mod:`array` module provides an :class:`~array.array` object that is " "like a list that stores only homogeneous data and stores it more compactly. " "The following example shows an array of numbers stored as two byte unsigned " "binary numbers (typecode ``\"H\"``) rather than the usual 16 bytes per entry " "for regular lists of Python int objects::" msgstr "" -"Το module :mod:`array` παρέχει ένα αντικείμενο :class:`~array.array()` που " +"Το module :mod:`array` παρέχει ένα αντικείμενο :class:`~array.array` που " "μοιάζει με μια λίστα που αποθηκεύει μόνο ομοιογενή δεδομένα και τα " "αποθηκεύει με πιο συμπαγή τρόπο. Το ακόλουθο παράδειγμα δείχνει έναν πίνακα " "αριθμών που είναι αποθηκευμένοι ως δύο byte ανυπόγραφων δυαδικών (binary) " "αριθμών (κωδικός τύπου ``\"H\"``) αντί για τα συνηθισμένα 16 byte ανά " "καταχώρηση για κανονικές λίστες αντικειμένων τύπου Python int::" +#: tutorial/stdlib2.rst:302 +msgid "" +">>> from array import array\n" +">>> a = array('H', [4000, 10, 700, 22222])\n" +">>> sum(a)\n" +"26932\n" +">>> a[1:3]\n" +"array('H', [10, 700])" +msgstr "" +">>> from array import array\n" +">>> a = array('H', [4000, 10, 700, 22222])\n" +">>> sum(a)\n" +"26932\n" +">>> a[1:3]\n" +"array('H', [10, 700])" + #: tutorial/stdlib2.rst:309 msgid "" -"The :mod:`collections` module provides a :class:`~collections.deque()` " -"object that is like a list with faster appends and pops from the left side " -"but slower lookups in the middle. These objects are well suited for " -"implementing queues and breadth first tree searches::" +"The :mod:`collections` module provides a :class:`~collections.deque` object " +"that is like a list with faster appends and pops from the left side but " +"slower lookups in the middle. These objects are well suited for implementing " +"queues and breadth first tree searches::" msgstr "" "Το module :mod:`collections` παρέχει ένα αντικείμενο :class:`~collections." -"deque()` που μοιάζει με λίστα με ταχύτερα προσαρτήματα και αναδύεται από την " +"deque` που μοιάζει με λίστα με ταχύτερα προσαρτήματα και αναδύεται από την " "αριστερή πλευρά αλλά με πιο αργές αναζητήσεις στη μέση. Αυτά τα αντικείμενα " "είναι κατάλληλα για υλοποίηση ουρών και αναζητήσεων σε πρώτο δέντρο εύρους::" +#: tutorial/stdlib2.rst:314 +msgid "" +">>> from collections import deque\n" +">>> d = deque([\"task1\", \"task2\", \"task3\"])\n" +">>> d.append(\"task4\")\n" +">>> print(\"Handling\", d.popleft())\n" +"Handling task1" +msgstr "" +">>> from collections import deque\n" +">>> d = deque([\"task1\", \"task2\", \"task3\"])\n" +">>> d.append(\"task4\")\n" +">>> print(\"Handling\", d.popleft())\n" +"Handling task1" + +#: tutorial/stdlib2.rst:322 +msgid "" +"unsearched = deque([starting_node])\n" +"def breadth_first_search(unsearched):\n" +" node = unsearched.popleft()\n" +" for m in gen_moves(node):\n" +" if is_goal(m):\n" +" return m\n" +" unsearched.append(m)" +msgstr "" +"unsearched = deque([starting_node])\n" +"def breadth_first_search(unsearched):\n" +" node = unsearched.popleft()\n" +" for m in gen_moves(node):\n" +" if is_goal(m):\n" +" return m\n" +" unsearched.append(m)" + #: tutorial/stdlib2.rst:330 msgid "" "In addition to alternative list implementations, the library also offers " @@ -355,6 +717,20 @@ msgstr "" "και άλλα εργαλεία όπως το module :mod:`bisect` με συναρτήσεις για τον " "χειρισμό ταξινομημένων λιστών::" +#: tutorial/stdlib2.rst:334 +msgid "" +">>> import bisect\n" +">>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]\n" +">>> bisect.insort(scores, (300, 'ruby'))\n" +">>> scores\n" +"[(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]" +msgstr "" +">>> import bisect\n" +">>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]\n" +">>> bisect.insort(scores, (300, 'ruby'))\n" +">>> scores\n" +"[(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]" + #: tutorial/stdlib2.rst:340 msgid "" "The :mod:`heapq` module provides functions for implementing heaps based on " @@ -368,14 +744,30 @@ msgstr "" "έχουν επανειλημμένα πρόσβαση στο μικρότερο στοιχείο αλλά δεν θέλουν να " "εκτελέσουν μια πλήρη ταξινόμηση λίστας::" +#: tutorial/stdlib2.rst:345 +msgid "" +">>> from heapq import heapify, heappop, heappush\n" +">>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\n" +">>> heapify(data) # rearrange the list into heap order\n" +">>> heappush(data, -5) # add a new entry\n" +">>> [heappop(data) for i in range(3)] # fetch the three smallest entries\n" +"[-5, 0, 1]" +msgstr "" +">>> from heapq import heapify, heappop, heappush\n" +">>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\n" +">>> heapify(data) # rearrange the list into heap order\n" +">>> heappush(data, -5) # add a new entry\n" +">>> [heappop(data) for i in range(3)] # fetch the three smallest entries\n" +"[-5, 0, 1]" + #: tutorial/stdlib2.rst:356 -msgid "Decimal Floating Point Arithmetic" +msgid "Decimal Floating-Point Arithmetic" msgstr "Δεκαδική Αριθμητικής Κινητής Υποδιαστολής" #: tutorial/stdlib2.rst:358 msgid "" "The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for " -"decimal floating point arithmetic. Compared to the built-in :class:`float` " +"decimal floating-point arithmetic. Compared to the built-in :class:`float` " "implementation of binary floating point, the class is especially helpful for" msgstr "" "Το module :mod:`decimal` προσφέρουν έναν τύπο δεδομένων :class:`~decimal." @@ -424,6 +816,20 @@ msgstr "" "(binary) κινητή υποδιαστολή. Η διαφορά γίνεται σημαντική εάν τα αποτελέσματα " "στρογγυλοποιηθούν στο πλησιέστερο λεπτό::" +#: tutorial/stdlib2.rst:374 +msgid "" +">>> from decimal import *\n" +">>> round(Decimal('0.70') * Decimal('1.05'), 2)\n" +"Decimal('0.74')\n" +">>> round(.70 * 1.05, 2)\n" +"0.73" +msgstr "" +">>> from decimal import *\n" +">>> round(Decimal('0.70') * Decimal('1.05'), 2)\n" +"Decimal('0.74')\n" +">>> round(.70 * 1.05, 2)\n" +"0.73" + #: tutorial/stdlib2.rst:380 msgid "" "The :class:`~decimal.Decimal` result keeps a trailing zero, automatically " @@ -448,9 +854,41 @@ msgstr "" "εκτελεί υπολογισμούς modulo και δοκιμές ισότητας που είναι ακατάλληλες για " "δυαδική κινητή υποδιαστολή::" +#: tutorial/stdlib2.rst:390 +msgid "" +">>> Decimal('1.00') % Decimal('.10')\n" +"Decimal('0.00')\n" +">>> 1.00 % 0.10\n" +"0.09999999999999995\n" +"\n" +">>> sum([Decimal('0.1')]*10) == Decimal('1.0')\n" +"True\n" +">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n" +"False" +msgstr "" +">>> Decimal('1.00') % Decimal('.10')\n" +"Decimal('0.00')\n" +">>> 1.00 % 0.10\n" +"0.09999999999999995\n" +"\n" +">>> sum([Decimal('0.1')]*10) == Decimal('1.0')\n" +"True\n" +">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n" +"False" + #: tutorial/stdlib2.rst:400 msgid "" "The :mod:`decimal` module provides arithmetic with as much precision as " "needed::" msgstr "" "Το module :mod:`decimal` παρέχει αριθμητική με όση ακρίβεια χρειάζεται::" + +#: tutorial/stdlib2.rst:402 +msgid "" +">>> getcontext().prec = 36\n" +">>> Decimal(1) / Decimal(7)\n" +"Decimal('0.142857142857142857142857142857142857')" +msgstr "" +">>> getcontext().prec = 36\n" +">>> Decimal(1) / Decimal(7)\n" +"Decimal('0.142857142857142857142857142857142857')" diff --git a/tutorial/venv.po b/tutorial/venv.po index 71902e55..5f3fb817 100644 --- a/tutorial/venv.po +++ b/tutorial/venv.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: 2024-06-13 23:10+0300\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -89,16 +89,15 @@ msgstr "Δημιουργία εικονικών περιβάλλοντων" #: tutorial/venv.rst:38 msgid "" "The module used to create and manage virtual environments is called :mod:" -"`venv`. :mod:`venv` will usually install the most recent version of Python " -"that you have available. If you have multiple versions of Python on your " -"system, you can select a specific Python version by running ``python3`` or " -"whichever version you want." +"`venv`. :mod:`venv` will install the Python version from which the command " +"was run (as reported by the :option:`--version` option). For instance, " +"executing the command with ``python3.12`` will install version 3.12." msgstr "" "Το module που χρησιμοποιείται για τη δημιουργία και τη διαχείριση εικονικών " -"περιβαλλόντων ονομάζεται :mod:`venv`. Το :mod:`venv` θα εγκαταστήσει " -"συνήθως την πιο πρόσφατη έκδοση της Python που έχετε διαθέσιμη. Εάν έχετε " -"πολλές εκδόσεις της Python στο σύστημά σας, μπορείτε να επιλέξετε μια " -"συγκεκριμένη έκδοση Python εκτελώντας το ``python3`` ή όποια έκδοση θέλετε." +"περιβαλλόντων ονομάζεται :mod:`venv`. Το :mod:`venv` θα εγκαταστήσει την " +"έκδοση Python από την οποία εκτελέστηκε η εντολή (όπως αναφέρεται από την " +"επιλογή :option:`--version`). Για παράδειγμα, η εκτέλεση της εντολής με το " +"``python3.12`` θα εγκαταστήσει την έκδοση 3.12." #: tutorial/venv.rst:44 msgid "" @@ -110,6 +109,10 @@ msgstr "" "θέλετε να το τοποθετήσετε και εκτελέστε το module :mod:`venv` ως ένα script " "με τη διαδρομή καταλόγου::" +#: tutorial/venv.rst:47 +msgid "python -m venv tutorial-env" +msgstr "python -m venv tutorial-env" + #: tutorial/venv.rst:49 msgid "" "This will create the ``tutorial-env`` directory if it doesn't exist, and " @@ -143,10 +146,18 @@ msgstr "" msgid "On Windows, run::" msgstr "Σε Windows, εκτελέστε::" +#: tutorial/venv.rst:63 +msgid "tutorial-env\\Scripts\\activate" +msgstr "tutorial-env\\Scripts\\activate" + #: tutorial/venv.rst:65 msgid "On Unix or MacOS, run::" msgstr "Σε Unix ή MacOS, εκτελέστε::" +#: tutorial/venv.rst:67 +msgid "source tutorial-env/bin/activate" +msgstr "source tutorial-env/bin/activate" + #: tutorial/venv.rst:69 msgid "" "(This script is written for the bash shell. If you use the :program:`csh` " @@ -170,10 +181,36 @@ msgstr "" "τροποποιήσει το περιβάλλον έτσι ώστε η εκτέλεση της ``python`` να σας δώσει " "τη συγκεκριμένη έκδοση και εγκατάσταση της Python. Για παράδειγμα:" +#: tutorial/venv.rst:79 +msgid "" +"$ source ~/envs/tutorial-env/bin/activate\n" +"(tutorial-env) $ python\n" +"Python 3.5.1 (default, May 6 2016, 10:59:36)\n" +" ...\n" +">>> import sys\n" +">>> sys.path\n" +"['', '/usr/local/lib/python35.zip', ...,\n" +"'~/envs/tutorial-env/lib/python3.5/site-packages']\n" +">>>" +msgstr "" +"$ source ~/envs/tutorial-env/bin/activate\n" +"(tutorial-env) $ python\n" +"Python 3.5.1 (default, May 6 2016, 10:59:36)\n" +" ...\n" +">>> import sys\n" +">>> sys.path\n" +"['', '/usr/local/lib/python35.zip', ...,\n" +"'~/envs/tutorial-env/lib/python3.5/site-packages']\n" +">>>" + #: tutorial/venv.rst:91 msgid "To deactivate a virtual environment, type::" msgstr "Για να απενεργοποιήσετε ένα εικονικό περιβάλλον, πληκτρολογήστε::" +#: tutorial/venv.rst:93 +msgid "deactivate" +msgstr "απενεργοποίηση" + #: tutorial/venv.rst:95 msgid "into the terminal." msgstr "μέσα στο terminal." @@ -213,6 +250,22 @@ msgstr "" "Μπορείτε να εγκαταστήσετε την τελευταία έκδοση ενός πακέτου προσδιορίζοντας " "ένα όνομα ενός πακέτου:" +#: tutorial/venv.rst:111 +msgid "" +"(tutorial-env) $ python -m pip install novas\n" +"Collecting novas\n" +" Downloading novas-3.1.1.3.tar.gz (136kB)\n" +"Installing collected packages: novas\n" +" Running setup.py install for novas\n" +"Successfully installed novas-3.1.1.3" +msgstr "" +"(tutorial-env) $ python -m pip install novas\n" +"Collecting novas\n" +" Downloading novas-3.1.1.3.tar.gz (136kB)\n" +"Installing collected packages: novas\n" +" Running setup.py install for novas\n" +"Successfully installed novas-3.1.1.3" + #: tutorial/venv.rst:120 msgid "" "You can also install a specific version of a package by giving the package " @@ -222,6 +275,20 @@ msgstr "" "δίνοντας το όνομα του πακέτου ακολουθούμενο από ``==`` και τον αριθμό " "έκδοσης:" +#: tutorial/venv.rst:123 +msgid "" +"(tutorial-env) $ python -m pip install requests==2.6.0\n" +"Collecting requests==2.6.0\n" +" Using cached requests-2.6.0-py2.py3-none-any.whl\n" +"Installing collected packages: requests\n" +"Successfully installed requests-2.6.0" +msgstr "" +"(tutorial-env) $ python -m pip install requests==2.6.0\n" +"Collecting requests==2.6.0\n" +" Using cached requests-2.6.0-py2.py3-none-any.whl\n" +"Installing collected packages: requests\n" +"Successfully installed requests-2.6.0" + #: tutorial/venv.rst:131 msgid "" "If you re-run this command, ``pip`` will notice that the requested version " @@ -235,6 +302,24 @@ msgstr "" "μπορείτε να εκτελέσετε το ``python -m pip install --upgrade`` για να " "αναβαθμίσετε το πακέτο στην πιο πρόσφατη έκδοση:" +#: tutorial/venv.rst:136 +msgid "" +"(tutorial-env) $ python -m pip install --upgrade requests\n" +"Collecting requests\n" +"Installing collected packages: requests\n" +" Found existing installation: requests 2.6.0\n" +" Uninstalling requests-2.6.0:\n" +" Successfully uninstalled requests-2.6.0\n" +"Successfully installed requests-2.7.0" +msgstr "" +"(tutorial-env) $ python -m pip install --upgrade requests\n" +"Collecting requests\n" +"Installing collected packages: requests\n" +" Found existing installation: requests 2.6.0\n" +" Uninstalling requests-2.6.0:\n" +" Successfully uninstalled requests-2.6.0\n" +"Successfully installed requests-2.7.0" + #: tutorial/venv.rst:146 msgid "" "``python -m pip uninstall`` followed by one or more package names will " @@ -250,6 +335,34 @@ msgstr "" "Το ``python -m pip show`` θα εμφανίσει πληροφορίες σχετικά με ένα " "συγκεκριμένο πακέτο:" +#: tutorial/venv.rst:151 +msgid "" +"(tutorial-env) $ python -m pip show requests\n" +"---\n" +"Metadata-Version: 2.0\n" +"Name: requests\n" +"Version: 2.7.0\n" +"Summary: Python HTTP for Humans.\n" +"Home-page: http://python-requests.org\n" +"Author: Kenneth Reitz\n" +"Author-email: me@kennethreitz.com\n" +"License: Apache 2.0\n" +"Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages\n" +"Requires:" +msgstr "" +"(tutorial-env) $ python -m pip show requests\n" +"---\n" +"Metadata-Version: 2.0\n" +"Name: requests\n" +"Version: 2.7.0\n" +"Summary: Python HTTP for Humans.\n" +"Home-page: http://python-requests.org\n" +"Author: Kenneth Reitz\n" +"Author-email: me@kennethreitz.com\n" +"License: Apache 2.0\n" +"Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages\n" +"Requires:" + #: tutorial/venv.rst:166 msgid "" "``python -m pip list`` will display all of the packages installed in the " @@ -258,6 +371,22 @@ msgstr "" "Το ``python -m pip list`` θα εμφανίσει όλα τα πακέτα που είναι εγκατεστημένα " "στο εικονικό περιβάλλον:" +#: tutorial/venv.rst:169 +msgid "" +"(tutorial-env) $ python -m pip list\n" +"novas (3.1.1.3)\n" +"numpy (1.9.2)\n" +"pip (7.0.3)\n" +"requests (2.7.0)\n" +"setuptools (16.0)" +msgstr "" +"(tutorial-env) $ python -m pip list\n" +"novas (3.1.1.3)\n" +"numpy (1.9.2)\n" +"pip (7.0.3)\n" +"requests (2.7.0)\n" +"setuptools (16.0)" + #: tutorial/venv.rst:178 msgid "" "``python -m pip freeze`` will produce a similar list of the installed " @@ -270,6 +399,20 @@ msgstr "" "``python -m pip install``. Μια κοινή σύμβαση είναι να τοποθετήσετε αυτήν τη " "λίστα σε ένα ``requirements.txt`` αρχείο:" +#: tutorial/venv.rst:182 +msgid "" +"(tutorial-env) $ python -m pip freeze > requirements.txt\n" +"(tutorial-env) $ cat requirements.txt\n" +"novas==3.1.1.3\n" +"numpy==1.9.2\n" +"requests==2.7.0" +msgstr "" +"(tutorial-env) $ python -m pip freeze > requirements.txt\n" +"(tutorial-env) $ cat requirements.txt\n" +"novas==3.1.1.3\n" +"numpy==1.9.2\n" +"requests==2.7.0" + #: tutorial/venv.rst:190 msgid "" "The ``requirements.txt`` can then be committed to version control and " @@ -280,6 +423,30 @@ msgstr "" "έκδοσης και να διατεθεί ως μέρος μιας εφαρμογής. Οι χρήστες μπορούν στη " "συνέχεια να εγκαταστήσουν όλα τα απαραίτητα πακέτα με το ``install -r``:" +#: tutorial/venv.rst:194 +msgid "" +"(tutorial-env) $ python -m pip install -r requirements.txt\n" +"Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))\n" +" ...\n" +"Collecting numpy==1.9.2 (from -r requirements.txt (line 2))\n" +" ...\n" +"Collecting requests==2.7.0 (from -r requirements.txt (line 3))\n" +" ...\n" +"Installing collected packages: novas, numpy, requests\n" +" Running setup.py install for novas\n" +"Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0" +msgstr "" +"(tutorial-env) $ python -m pip install -r requirements.txt\n" +"Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))\n" +" ...\n" +"Collecting numpy==1.9.2 (from -r requirements.txt (line 2))\n" +" ...\n" +"Collecting requests==2.7.0 (from -r requirements.txt (line 3))\n" +" ...\n" +"Installing collected packages: novas, numpy, requests\n" +" Running setup.py install for novas\n" +"Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0" + #: tutorial/venv.rst:207 msgid "" "``pip`` has many more options. Consult the :ref:`installing-index` guide " @@ -290,4 +457,4 @@ msgstr "" "Το ``pip`` έχει πολλές περισσότερες επιλογές. Συμβουλευτείτε τον οδηγό :ref:" "`installing-index` για πλήρη τεκμηρίωση για το ``pip``. Όταν έχετε γράψει " "ένα πακέτο και θέλετε να το κάνετε διαθέσιμο στο Ευρετήριο Πακέτων Python, " -"συμβουλευτείτε τον `οδηγό χρήσης packaging Python`_." +"συμβουλευτείτε τον `Python packaging user guide`_." diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index 0bcd058f..f5187a96 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -8,10 +8,10 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: 2024-06-12 09:07+0300\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" "Last-Translator: Panagiotis Skias \n" -"Language-Team: PyGreece \n" +"Language-Team: PyGreece \n" "Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -30,7 +30,7 @@ msgid "" msgstr "" "Η ανάγνωση αυτού του διδακτικού υλικού πιθανότατα ενίσχυσε το ενδιαφέρον σας " "για τη χρήση της Python --- θα πρέπει να είστε πρόθυμοι να εφαρμόσετε την " -"Pyhton για την επίλυση των προβλημάτων του πραγματικού σας κόσμου. Που " +"Python για την επίλυση των προβλημάτων του πραγματικού σας κόσμου. Που " "πρέπει να πάτε για να μάθετε περισσότερα;" #: tutorial/whatnow.rst:11 @@ -88,7 +88,7 @@ msgstr "Περισσότερα Βοηθήματα για Python:" #: tutorial/whatnow.rst:33 msgid "" -"https://www.python.org: The major Python web site. It contains code, " +"https://www.python.org: The major Python website. It contains code, " "documentation, and pointers to Python-related pages around the web." msgstr "" "https://www.python.org: Ο κύριος ιστότοπος της Python. Περιέχει κώδικα, " diff --git a/using/android.po b/using/android.po new file mode 100644 index 00000000..50611076 --- /dev/null +++ b/using/android.po @@ -0,0 +1,220 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-12-07 14:21+0200\n" +"Last-Translator: Vassiliki Dalakiari \n" +"Language-Team: PyGreece \n" +"Language: el\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: using/android.rst:5 +msgid "Using Python on Android" +msgstr "Χρήση της Python σε Android" + +#: using/android.rst:7 +msgid "" +"Python on Android is unlike Python on desktop platforms. On a desktop " +"platform, Python is generally installed as a system resource that can be " +"used by any user of that computer. Users then interact with Python by " +"running a :program:`python` executable and entering commands at an " +"interactive prompt, or by running a Python script." +msgstr "" +"Η Python σε Android διαφέρει από την Python σε πλατφόρμες επιτραπέζιων " +"υπολογιστών. Σε μια πλατφόρμα επιτραπέζιων υπολογιστών, η Python " +"εγκαθίσταται γενικά ως πόρος συστήματος που μπορεί να χρησιμοποιηθεί από " +"οποιονδήποτε χρήστη αυτού του υπολογιστή. Οι χρήστες στη συνέχεια " +"αλληλεπιδρούν με την Python εκτελώντας ένα εκτελέσιμο :program:`python` και " +"εισάγοντας εντολές σε μια διαδραστική γραμμή εντολών ή εκτελώντας ένα Python " +"script." + +#: using/android.rst:13 +msgid "" +"On Android, there is no concept of installing as a system resource. The only " +"unit of software distribution is an \"app\". There is also no console where " +"you could run a :program:`python` executable, or interact with a Python REPL." +msgstr "" +"Στο Android, δεν υπάρχει η έννοια της εγκατάστασης ως πόρου συστήματος. Η " +"μόνη μονάδα διανομής λογισμικού είναι μια «εφαρμογή». Δεν υπάρχει κονσόλα " +"όπου θα μπορούσατε να εκτελέσετε ένα εκτελέσιμο αρχείο :program:`python`, ή " +"να αλληλεπιδράσετε με ένα Python REPL." + +#: using/android.rst:17 +msgid "" +"As a result, the only way you can use Python on Android is in embedded mode " +"– that is, by writing a native Android application, embedding a Python " +"interpreter using ``libpython``, and invoking Python code using the :ref:" +"`Python embedding API `. The full Python interpreter, the " +"standard library, and all your Python code is then packaged into your app " +"for its own private use." +msgstr "" +"Ως αποτέλεσμα, ο μόνος τρόπος για να χρησιμοποιήσετε την Python σε Android " +"είναι σε ενσωματωμένη λειτουργία – δηλαδή, γράφοντας μια εγγενή εφαρμογή " +"Android, ενσωματώνοντας έναν διερμηνέα Python χρησιμοποιώντας το " +"``libpython``, και καλώντας κώδικα Python χρησιμοποιώντας το :ref:`Python " +"embedding API `. Ο πλήρης διερμηνέας Python, η τυπική βιβλιοθήκη, " +"και όλος ο κώδικας Python συσκευάζονται στη συνέχεια στην εφαρμογή σας για " +"δική της ιδιωτική χρήση." + +#: using/android.rst:23 +msgid "" +"The Python standard library has some notable omissions and restrictions on " +"Android. See the :ref:`API availability guide ` for " +"details." +msgstr "" +"Η τυπική βιβλιοθήκη της Python έχει κάποιες αξιοσημείωτες παραλείψεις και " +"περιορισμούς στο Android. Δείτε τον :ref:`API availability guide ` για λεπτομέρειες." + +#: using/android.rst:28 +msgid "Adding Python to an Android app" +msgstr "Προσθήκη της Python σε μια εφαρμογή Android" + +#: using/android.rst:30 +msgid "" +"Most app developers should use one of the following tools, which will " +"provide a much easier experience:" +msgstr "" +"Η πλειονότητα των ατόμων που προγραμματίζουν εφαρμογές θα πρέπει να " +"χρησιμοποιούν ένα από τα ακόλουθα εργαλεία, τα οποία παρέχουν ευκολότερη " +"εμπειρία:" + +#: using/android.rst:33 +msgid "" +"`Briefcase `__, from the BeeWare project" +msgstr "`Briefcase `__, από το έργο BeeWare" + +#: using/android.rst:34 +msgid "`Buildozer `__, from the Kivy project" +msgstr "`Buildozer `__, από το έργο Kivy" + +#: using/android.rst:35 +msgid "`Chaquopy `__" +msgstr "`Chaquopy `__" + +#: using/android.rst:36 +msgid "" +"`pyqtdeploy `__" +msgstr "" +"`pyqtdeploy `__" + +#: using/android.rst:37 +msgid "`Termux `__" +msgstr "`Termux `__" + +#: using/android.rst:39 +msgid "" +"If you're sure you want to do all of this manually, read on. You can use " +"the :source:`testbed app ` as a guide; each step below " +"contains a link to the relevant file." +msgstr "" +"Αν θέλετε να τα κάνετε όλα αυτά χειροκίνητα, συνεχίστε την ανάγνωση. " +"Μπορείτε να χρησιμοποιήσετε την εντολή :source:`testbed app ` ως οδηγό· κάθε βήμα παρακάτω περιέχει έναν σύνδεσμο προς το " +"σχετικό αρχείο." + +#: using/android.rst:43 +msgid "First, acquire a build of Python for Android:" +msgstr "Πρώτον, αποκτήστε μια έκδοση της Python για Android:" + +#: using/android.rst:45 +msgid "" +"The easiest way is to download an Android release from `python.org `__. The ``prefix`` directory mentioned " +"below is at the top level of the package." +msgstr "" +"Ο ευκολότερος τρόπος είναι να κατεβάσετε μια έκδοση Android από το `python." +"org `__. Ο φάκελος ``prefix`` που " +"αναφέρεται παρακάτω βρίσκεται στο ανώτατο επίπεδο του πακέτου." + +#: using/android.rst:49 +msgid "" +"Or if you want to build it yourself, follow the instructions in :source:" +"`Android/README.md`. The ``prefix`` directory will be created under :samp:" +"`cross-build/{HOST}`." +msgstr "" +"Ή αν θέλετε να το δημιουργήσετε μόνοι σας, ακολουθήστε τις οδηγίες στο " +"αρχείο:source:`Android/README.md`. Ο φάκελος ``prefix`` θα δημιουργηθεί κάτω " +"από το :samp:`cross-build/{HOST}`." + +#: using/android.rst:53 +msgid "" +"Add code to your :source:`build.gradle ` file to copy the following items into your project. All except your " +"own Python code can be copied from ``prefix/lib``:" +msgstr "" +"Προσθέστε κώδικα στο αρχείο σας :source:`build.gradle ` για να αντιγράψετε τα ακόλουθα στοιχεία στο έργο σας. Όλα " +"εκτός από τον δικό σας κώδικα Python μπορούν να αντιγραφούν από το ``prefix/" +"lib``:" + +#: using/android.rst:57 +msgid "In your JNI libraries:" +msgstr "Στις JNI βιβλιοθήκες σας:" + +#: using/android.rst:59 +msgid "``libpython*.*.so``" +msgstr "``libpython*.*.so``" + +#: using/android.rst:60 +msgid "``lib*_python.so`` (external libraries such as OpenSSL)" +msgstr "``lib*_python.so`` (εξωτερικές βιβλιοθήκες όπως το OpenSSL)" + +#: using/android.rst:62 +msgid "In your assets:" +msgstr "Στα στοιχεία σας:" + +#: using/android.rst:64 +msgid "``python*.*`` (the Python standard library)" +msgstr "``python*.*`` (η τυπική βιβλιοθήκη της Python)" + +#: using/android.rst:65 +msgid "``python*.*/site-packages`` (your own Python code)" +msgstr "``python*.*/site-packages`` (ο δικός σας Python κώδικας)" + +#: using/android.rst:67 +msgid "" +"Add code to your app to :source:`extract the assets to the filesystem " +"`." +msgstr "" +"Προσθέστε κώδικα στην εφαρμογή σας για να :source:`εξαγάγετε τα στοιχεία στο " +"σύστημα αρχείων `." + +#: using/android.rst:70 +msgid "" +"Add code to your app to :source:`start Python in embedded mode `. This will need to be C code called " +"via JNI." +msgstr "" +"Προσθέστε κώδικα στην εφαρμογή σας για να :source:`ξεκινήσετε την Python σε " +"ενσωματωμένη λειτουργία `. " +"Αυτός θα πρέπει να είναι κώδικας C που καλείται μέσω JNI." + +#: using/android.rst:75 +msgid "Building a Python package for Android" +msgstr "Δημιουργία ενός πακέτου Python για Android" + +#: using/android.rst:77 +msgid "" +"Python packages can be built for Android as wheels and released on PyPI. The " +"recommended tool for doing this is `cibuildwheel `__, which automates all the details of " +"setting up a cross-compilation environment, building the wheel, and testing " +"it on an emulator." +msgstr "" +"Τα πακέτα Python μπορούν να δημιουργηθούν για Android ως wheels και να " +"κυκλοφορήσουν στο PyPI. Το προτεινόμενο εργαλείο για αυτό είναι το " +"`cibuildwheel `__, το οποίο αυτοματοποιεί όλες τις λεπτομέρειες του στησίματος " +"ενός περιβάλλοντος διασταυρούμενης μεταγλώττισης, της δημιουργίας του wheel " +"και της δοκιμής του σε έναν εξομοιωτή." diff --git a/using/cmdline.po b/using/cmdline.po index 16da6313..e0ddd258 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -40,11 +41,21 @@ msgstr "" msgid "When invoking Python, you may specify any of these options::" msgstr "" +#: using/cmdline.rst:27 +msgid "" +"python [-bBdEhiIOPqRsSuvVWx?] [-c command | -m module-name | script | - ] " +"[args]" +msgstr "" + #: using/cmdline.rst:29 msgid "" "The most common use case is, of course, a simple invocation of a script::" msgstr "" +#: using/cmdline.rst:31 +msgid "python myscript.py" +msgstr "" + #: using/cmdline.rst:37 msgid "Interface options" msgstr "" @@ -60,40 +71,40 @@ msgid "" "When called with standard input connected to a tty device, it prompts for " "commands and executes them until an EOF (an end-of-file character, you can " "produce that with :kbd:`Ctrl-D` on UNIX or :kbd:`Ctrl-Z, Enter` on Windows) " -"is read." +"is read. For more on interactive mode, see :ref:`tut-interac`." msgstr "" -#: using/cmdline.rst:45 +#: using/cmdline.rst:46 msgid "" "When called with a file name argument or with a file as standard input, it " "reads and executes a script from that file." msgstr "" -#: using/cmdline.rst:47 +#: using/cmdline.rst:48 msgid "" "When called with a directory name argument, it reads and executes an " "appropriately named script from that directory." msgstr "" -#: using/cmdline.rst:49 +#: using/cmdline.rst:50 msgid "" "When called with ``-c command``, it executes the Python statement(s) given " "as *command*. Here *command* may contain multiple statements separated by " "newlines. Leading whitespace is significant in Python statements!" msgstr "" -#: using/cmdline.rst:52 +#: using/cmdline.rst:53 msgid "" "When called with ``-m module-name``, the given module is located on the " "Python module path and executed as a script." msgstr "" -#: using/cmdline.rst:55 +#: using/cmdline.rst:56 msgid "" "In non-interactive mode, the entire input is parsed before it is executed." msgstr "" -#: using/cmdline.rst:57 +#: using/cmdline.rst:58 msgid "" "An interface option terminates the list of options consumed by the " "interpreter, all consecutive arguments will end up in :data:`sys.argv` -- " @@ -101,14 +112,14 @@ msgid "" "reflecting the program's source." msgstr "" -#: using/cmdline.rst:64 +#: using/cmdline.rst:65 msgid "" "Execute the Python code in *command*. *command* can be one or more " "statements separated by newlines, with significant leading whitespace as in " "normal module code." msgstr "" -#: using/cmdline.rst:68 +#: using/cmdline.rst:69 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" "c\"`` and the current directory will be added to the start of :data:`sys." @@ -116,19 +127,23 @@ msgid "" "modules)." msgstr "" -#: using/cmdline.rst:73 +#: using/cmdline.rst:74 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_command`` with " "argument ``command``." msgstr "" -#: using/cmdline.rst:77 +#: using/cmdline.rst:76 +msgid "*command* is automatically dedented before execution." +msgstr "" + +#: using/cmdline.rst:81 msgid "" "Search :data:`sys.path` for the named module and execute its contents as " "the :mod:`__main__` module." msgstr "" -#: using/cmdline.rst:80 +#: using/cmdline.rst:84 msgid "" "Since the argument is a *module* name, you must not give a file extension " "(``.py``). The module name should be a valid absolute Python module name, " @@ -136,7 +151,7 @@ msgid "" "use a name that includes a hyphen)." msgstr "" -#: using/cmdline.rst:85 +#: using/cmdline.rst:89 msgid "" "Package names (including namespace packages) are also permitted. When a " "package name is supplied instead of a normal module, the interpreter will " @@ -145,7 +160,7 @@ msgid "" "passed to the interpreter as the script argument." msgstr "" -#: using/cmdline.rst:94 +#: using/cmdline.rst:98 msgid "" "This option cannot be used with built-in modules and extension modules " "written in C, since they do not have Python module files. However, it can " @@ -153,7 +168,7 @@ msgid "" "not available." msgstr "" -#: using/cmdline.rst:99 +#: using/cmdline.rst:103 msgid "" "If this option is given, the first element of :data:`sys.argv` will be the " "full path to the module file (while the module file is being located, the " @@ -161,65 +176,71 @@ msgid "" "the current directory will be added to the start of :data:`sys.path`." msgstr "" -#: using/cmdline.rst:104 +#: using/cmdline.rst:108 msgid "" ":option:`-I` option can be used to run the script in isolated mode where :" "data:`sys.path` contains neither the current directory nor the user's site-" "packages directory. All ``PYTHON*`` environment variables are ignored, too." msgstr "" -#: using/cmdline.rst:109 +#: using/cmdline.rst:113 msgid "" "Many standard library modules contain code that is invoked on their " "execution as a script. An example is the :mod:`timeit` module::" msgstr "" -#: using/cmdline.rst:115 +#: using/cmdline.rst:116 +msgid "" +"python -m timeit -s \"setup here\" \"benchmarked code here\"\n" +"python -m timeit -h # for details" +msgstr "" + +#: using/cmdline.rst:119 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_module`` with " "argument ``module-name``." msgstr "" -#: using/cmdline.rst:119 +#: using/cmdline.rst:122 msgid ":func:`runpy.run_module`" msgstr "" -#: using/cmdline.rst:171 +#: using/cmdline.rst:175 msgid "Equivalent functionality directly available to Python code" msgstr "" -#: using/cmdline.rst:121 +#: using/cmdline.rst:125 msgid ":pep:`338` -- Executing modules as scripts" msgstr "" -#: using/cmdline.rst:123 +#: using/cmdline.rst:127 msgid "Supply the package name to run a ``__main__`` submodule." msgstr "" -#: using/cmdline.rst:126 +#: using/cmdline.rst:130 msgid "namespace packages are also supported" msgstr "" -#: using/cmdline.rst:133 +#: using/cmdline.rst:137 msgid "" "Read commands from standard input (:data:`sys.stdin`). If standard input is " "a terminal, :option:`-i` is implied." msgstr "" -#: using/cmdline.rst:136 +#: using/cmdline.rst:140 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" "\"`` and the current directory will be added to the start of :data:`sys." "path`." msgstr "" -#: using/cmdline.rst:140 +#: using/cmdline.rst:834 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_stdin`` with no " "arguments." msgstr "" -#: using/cmdline.rst:146 +#: using/cmdline.rst:150 msgid "" "Execute the Python code contained in *script*, which must be a filesystem " "path (absolute or relative) referring to either a Python file, a directory " @@ -227,44 +248,44 @@ msgid "" "file." msgstr "" -#: using/cmdline.rst:151 +#: using/cmdline.rst:155 msgid "" "If this option is given, the first element of :data:`sys.argv` will be the " "script name as given on the command line." msgstr "" -#: using/cmdline.rst:154 +#: using/cmdline.rst:158 msgid "" "If the script name refers directly to a Python file, the directory " "containing that file is added to the start of :data:`sys.path`, and the file " "is executed as the :mod:`__main__` module." msgstr "" -#: using/cmdline.rst:158 +#: using/cmdline.rst:162 msgid "" "If the script name refers to a directory or zipfile, the script name is " "added to the start of :data:`sys.path` and the ``__main__.py`` file in that " "location is executed as the :mod:`__main__` module." msgstr "" -#: using/cmdline.rst:162 +#: using/cmdline.rst:166 msgid "" ":option:`-I` option can be used to run the script in isolated mode where :" "data:`sys.path` contains neither the script's directory nor the user's site-" "packages directory. All ``PYTHON*`` environment variables are ignored, too." msgstr "" -#: using/cmdline.rst:167 +#: using/cmdline.rst:171 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_file`` with " "argument ``filename``." msgstr "" -#: using/cmdline.rst:170 +#: using/cmdline.rst:174 msgid ":func:`runpy.run_path`" msgstr "" -#: using/cmdline.rst:174 +#: using/cmdline.rst:178 msgid "" "If no interface option is given, :option:`-i` is implied, ``sys.argv[0]`` is " "an empty string (``\"\"``) and the current directory will be added to the " @@ -273,55 +294,65 @@ msgid "" "config`)." msgstr "" -#: using/cmdline.rst:180 +#: using/cmdline.rst:184 msgid ":ref:`tut-invoking`" msgstr "" -#: using/cmdline.rst:182 +#: using/cmdline.rst:186 msgid "Automatic enabling of tab-completion and history editing." msgstr "" -#: using/cmdline.rst:189 +#: using/cmdline.rst:193 msgid "Generic options" msgstr "" -#: using/cmdline.rst:195 +#: using/cmdline.rst:199 msgid "" "Print a short description of all command line options and corresponding " "environment variables and exit." msgstr "" -#: using/cmdline.rst:200 +#: using/cmdline.rst:204 msgid "" "Print a short description of Python-specific environment variables and exit." msgstr "" -#: using/cmdline.rst:207 +#: using/cmdline.rst:211 msgid "" "Print a description of implementation-specific :option:`-X` options and exit." msgstr "" -#: using/cmdline.rst:214 +#: using/cmdline.rst:218 msgid "Print complete usage information and exit." msgstr "" -#: using/cmdline.rst:221 +#: using/cmdline.rst:225 msgid "Print the Python version number and exit. Example output could be:" msgstr "" #: using/cmdline.rst:227 +msgid "Python 3.8.0b2+" +msgstr "" + +#: using/cmdline.rst:231 msgid "When given twice, print more information about the build, like:" msgstr "" -#: using/cmdline.rst:234 +#: using/cmdline.rst:233 +msgid "" +"Python 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)\n" +"[GCC 6.2.0 20161005]" +msgstr "" + +#: using/cmdline.rst:238 msgid "The ``-VV`` option." msgstr "" -#: using/cmdline.rst:241 +#: using/cmdline.rst:245 msgid "Miscellaneous options" msgstr "" -#: using/cmdline.rst:245 +#: using/cmdline.rst:249 msgid "" "Issue a warning when converting :class:`bytes` or :class:`bytearray` to :" "class:`str` without specifying encoding or comparing :class:`!bytes` or :" @@ -329,17 +360,17 @@ msgid "" "Issue an error when the option is given twice (:option:`!-bb`)." msgstr "" -#: using/cmdline.rst:250 +#: using/cmdline.rst:254 msgid "Affects also comparisons of :class:`bytes` with :class:`int`." msgstr "" -#: using/cmdline.rst:255 +#: using/cmdline.rst:259 msgid "" "If given, Python won't try to write ``.pyc`` files on the import of source " "modules. See also :envvar:`PYTHONDONTWRITEBYTECODE`." msgstr "" -#: using/cmdline.rst:261 +#: using/cmdline.rst:265 msgid "" "Control the validation behavior of hash-based ``.pyc`` files. See :ref:`pyc-" "invalidation`. When set to ``default``, checked and unchecked hash-based " @@ -350,55 +381,75 @@ msgid "" "corresponding source files." msgstr "" -#: using/cmdline.rst:269 +#: using/cmdline.rst:273 msgid "" "The semantics of timestamp-based ``.pyc`` files are unaffected by this " "option." msgstr "" -#: using/cmdline.rst:275 +#: using/cmdline.rst:279 msgid "" "Turn on parser debugging output (for expert only). See also the :envvar:" "`PYTHONDEBUG` environment variable." msgstr "" -#: using/cmdline.rst:278 +#: using/cmdline.rst:282 msgid "" "This option requires a :ref:`debug build of Python `, otherwise " "it's ignored." msgstr "" -#: using/cmdline.rst:284 +#: using/cmdline.rst:288 msgid "" "Ignore all ``PYTHON*`` environment variables, e.g. :envvar:`PYTHONPATH` and :" "envvar:`PYTHONHOME`, that might be set." msgstr "" -#: using/cmdline.rst:287 +#: using/cmdline.rst:291 msgid "See also the :option:`-P` and :option:`-I` (isolated) options." msgstr "" -#: using/cmdline.rst:292 +#: using/cmdline.rst:296 +msgid "Enter interactive mode after execution." +msgstr "" + +#: using/cmdline.rst:298 msgid "" -"When a script is passed as first argument or the :option:`-c` option is " -"used, enter interactive mode after executing the script or the command, even " -"when :data:`sys.stdin` does not appear to be a terminal. The :envvar:" -"`PYTHONSTARTUP` file is not read." +"Using the :option:`-i` option will enter interactive mode in any of the " +"following circumstances\\:" +msgstr "" + +#: using/cmdline.rst:300 +msgid "When a script is passed as first argument" +msgstr "" + +#: using/cmdline.rst:301 +msgid "When the :option:`-c` option is used" +msgstr "" + +#: using/cmdline.rst:302 +msgid "When the :option:`-m` option is used" msgstr "" -#: using/cmdline.rst:297 +#: using/cmdline.rst:304 +msgid "" +"Interactive mode will start even when :data:`sys.stdin` does not appear to " +"be a terminal. The :envvar:`PYTHONSTARTUP` file is not read." +msgstr "" + +#: using/cmdline.rst:307 msgid "" "This can be useful to inspect global variables or a stack trace when a " "script raises an exception. See also :envvar:`PYTHONINSPECT`." msgstr "" -#: using/cmdline.rst:303 +#: using/cmdline.rst:313 msgid "" "Run Python in isolated mode. This also implies :option:`-E`, :option:`-P` " "and :option:`-s` options." msgstr "" -#: using/cmdline.rst:306 +#: using/cmdline.rst:316 msgid "" "In isolated mode :data:`sys.path` contains neither the script's directory " "nor the user's site-packages directory. All ``PYTHON*`` environment " @@ -406,7 +457,7 @@ msgid "" "the user from injecting malicious code." msgstr "" -#: using/cmdline.rst:316 +#: using/cmdline.rst:326 msgid "" "Remove assert statements and any code conditional on the value of :const:" "`__debug__`. Augment the filename for compiled (:term:`bytecode`) files by " @@ -414,58 +465,58 @@ msgid "" "envvar:`PYTHONOPTIMIZE`." msgstr "" -#: using/cmdline.rst:331 +#: using/cmdline.rst:341 msgid "Modify ``.pyc`` filenames according to :pep:`488`." msgstr "" -#: using/cmdline.rst:327 +#: using/cmdline.rst:337 msgid "" "Do :option:`-O` and also discard docstrings. Augment the filename for " "compiled (:term:`bytecode`) files by adding ``.opt-2`` before the ``.pyc`` " "extension (see :pep:`488`)." msgstr "" -#: using/cmdline.rst:337 +#: using/cmdline.rst:347 msgid "Don't prepend a potentially unsafe path to :data:`sys.path`:" msgstr "" -#: using/cmdline.rst:339 +#: using/cmdline.rst:349 msgid "" "``python -m module`` command line: Don't prepend the current working " "directory." msgstr "" -#: using/cmdline.rst:341 +#: using/cmdline.rst:351 msgid "" "``python script.py`` command line: Don't prepend the script's directory. If " "it's a symbolic link, resolve symbolic links." msgstr "" -#: using/cmdline.rst:343 +#: using/cmdline.rst:353 msgid "" "``python -c code`` and ``python`` (REPL) command lines: Don't prepend an " "empty string, which means the current working directory." msgstr "" -#: using/cmdline.rst:346 +#: using/cmdline.rst:356 msgid "" "See also the :envvar:`PYTHONSAFEPATH` environment variable, and :option:`-E` " "and :option:`-I` (isolated) options." msgstr "" -#: using/cmdline.rst:354 +#: using/cmdline.rst:364 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: using/cmdline.rst:361 +#: using/cmdline.rst:371 msgid "" "Turn on hash randomization. This option only has an effect if the :envvar:" -"`PYTHONHASHSEED` environment variable is set to ``0``, since hash " -"randomization is enabled by default." +"`PYTHONHASHSEED` environment variable is set to anything other than " +"``random``, since hash randomization is enabled by default." msgstr "" -#: using/cmdline.rst:365 +#: using/cmdline.rst:375 msgid "" "On previous versions of Python, this option turns on hash randomization, so " "that the :meth:`~object.__hash__` values of str and bytes objects are " @@ -474,7 +525,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: using/cmdline.rst:371 +#: using/cmdline.rst:381 msgid "" "Hash randomization is intended to provide protection against a denial-of-" "service caused by carefully chosen inputs that exploit the worst case " @@ -482,31 +533,31 @@ msgid "" "http://ocert.org/advisories/ocert-2011-003.html for details." msgstr "" -#: using/cmdline.rst:376 +#: using/cmdline.rst:386 msgid "" ":envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash seed " "secret." msgstr "" -#: using/cmdline.rst:381 +#: using/cmdline.rst:391 msgid "The option is no longer ignored." msgstr "" -#: using/cmdline.rst:387 +#: using/cmdline.rst:397 msgid "" "Don't add the :data:`user site-packages directory ` to :data:" "`sys.path`." msgstr "" -#: using/cmdline.rst:390 +#: using/cmdline.rst:400 msgid "See also :envvar:`PYTHONNOUSERSITE`." msgstr "" -#: using/cmdline.rst:802 using/cmdline.rst:814 +#: using/cmdline.rst:931 using/cmdline.rst:943 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: using/cmdline.rst:399 +#: using/cmdline.rst:409 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -514,21 +565,21 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: using/cmdline.rst:407 +#: using/cmdline.rst:417 msgid "" "Force the stdout and stderr streams to be unbuffered. This option has no " "effect on the stdin stream." msgstr "" -#: using/cmdline.rst:410 +#: using/cmdline.rst:420 msgid "See also :envvar:`PYTHONUNBUFFERED`." msgstr "" -#: using/cmdline.rst:412 +#: using/cmdline.rst:422 msgid "The text layer of the stdout and stderr streams now is unbuffered." msgstr "" -#: using/cmdline.rst:418 +#: using/cmdline.rst:428 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. When given twice (:" @@ -536,60 +587,75 @@ msgid "" "searching for a module. Also provides information on module cleanup at exit." msgstr "" -#: using/cmdline.rst:423 +#: using/cmdline.rst:433 msgid "" "The :mod:`site` module reports the site-specific paths and :file:`.pth` " "files being processed." msgstr "" -#: using/cmdline.rst:427 +#: using/cmdline.rst:437 msgid "See also :envvar:`PYTHONVERBOSE`." msgstr "" -#: using/cmdline.rst:433 +#: using/cmdline.rst:443 msgid "" "Warning control. Python's warning machinery by default prints warning " "messages to :data:`sys.stderr`." msgstr "" -#: using/cmdline.rst:830 +#: using/cmdline.rst:959 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" -#: using/cmdline.rst:447 +#: using/cmdline.rst:450 +msgid "" +"-Wdefault # Warn once per call location\n" +"-Werror # Convert to exceptions\n" +"-Walways # Warn every time\n" +"-Wall # Same as -Walways\n" +"-Wmodule # Warn once per calling module\n" +"-Wonce # Warn once per Python process\n" +"-Wignore # Never warn" +msgstr "" + +#: using/cmdline.rst:458 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" -#: using/cmdline.rst:451 +#: using/cmdline.rst:462 msgid "The full form of argument is::" msgstr "" -#: using/cmdline.rst:455 +#: using/cmdline.rst:464 +msgid "action:message:category:module:lineno" +msgstr "" + +#: using/cmdline.rst:466 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" -#: using/cmdline.rst:459 +#: using/cmdline.rst:470 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" -#: using/cmdline.rst:462 +#: using/cmdline.rst:473 msgid "" "The *message* field must match the whole warning message; this match is case-" "insensitive." msgstr "" -#: using/cmdline.rst:465 +#: using/cmdline.rst:476 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " @@ -597,19 +663,19 @@ msgid "" "warning category." msgstr "" -#: using/cmdline.rst:470 +#: using/cmdline.rst:481 msgid "" "The *module* field matches the (fully qualified) module name; this match is " "case-sensitive." msgstr "" -#: using/cmdline.rst:473 +#: using/cmdline.rst:484 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" -#: using/cmdline.rst:476 +#: using/cmdline.rst:487 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " "one option, the action for the last matching option is performed. Invalid :" @@ -617,7 +683,7 @@ msgid "" "invalid options when the first warning is issued)." msgstr "" -#: using/cmdline.rst:481 +#: using/cmdline.rst:492 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " "environment variable and from within a Python program using the :mod:" @@ -625,31 +691,31 @@ msgid "" "can be used to use a regular expression on the warning message." msgstr "" -#: using/cmdline.rst:841 +#: using/cmdline.rst:971 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." msgstr "" -#: using/cmdline.rst:492 +#: using/cmdline.rst:503 msgid "" "Skip the first line of the source, allowing use of non-Unix forms of ``#!" "cmd``. This is intended for a DOS specific hack only." msgstr "" -#: using/cmdline.rst:498 +#: using/cmdline.rst:509 msgid "" "Reserved for various implementation-specific options. CPython currently " "defines the following possible values:" msgstr "" -#: using/cmdline.rst:501 +#: using/cmdline.rst:512 msgid "" "``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" "`PYTHONFAULTHANDLER`." msgstr "" -#: using/cmdline.rst:503 +#: using/cmdline.rst:517 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " @@ -657,7 +723,7 @@ msgid "" "build>`." msgstr "" -#: using/cmdline.rst:507 +#: using/cmdline.rst:524 msgid "" "``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" "`tracemalloc` module. By default, only the most recent frame is stored in a " @@ -666,51 +732,67 @@ msgid "" "envvar:`PYTHONTRACEMALLOC` for more information." msgstr "" -#: using/cmdline.rst:513 +#: using/cmdline.rst:533 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " "length limitation `. See also :envvar:" "`PYTHONINTMAXSTRDIGITS`." msgstr "" -#: using/cmdline.rst:516 +#: using/cmdline.rst:539 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " "imports). Note that its output may be broken in multi-threaded " -"application. Typical usage is ``python3 -X importtime -c 'import " -"asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." +"application. Typical usage is ``python -X importtime -c 'import asyncio'``." +msgstr "" + +#: using/cmdline.rst:544 +msgid "" +"``-X importtime=2`` enables additional output that indicates when an " +"imported module has already been loaded. In such cases, the string " +"``cached`` will be printed in both time columns." msgstr "" -#: using/cmdline.rst:521 +#: using/cmdline.rst:548 +msgid "See also :envvar:`PYTHONPROFILEIMPORTTIME`." +msgstr "" + +#: using/cmdline.rst:554 +msgid "" +"Added ``-X importtime=2`` to also trace imports of loaded modules, and " +"reserved values other than ``1`` and ``2`` for future use." +msgstr "" + +#: using/cmdline.rst:557 msgid "" "``-X dev``: enable :ref:`Python Development Mode `, introducing " "additional runtime checks that are too expensive to be enabled by default. " "See also :envvar:`PYTHONDEVMODE`." msgstr "" -#: using/cmdline.rst:524 +#: using/cmdline.rst:563 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode `. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode ` (even when it would " "otherwise activate automatically). See also :envvar:`PYTHONUTF8`." msgstr "" -#: using/cmdline.rst:528 +#: using/cmdline.rst:570 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " "rooted at the given directory instead of to the code tree. See also :envvar:" "`PYTHONPYCACHEPREFIX`." msgstr "" -#: using/cmdline.rst:531 +#: using/cmdline.rst:576 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " "locale-specific default encoding is used for opening files. See also :envvar:" "`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: using/cmdline.rst:534 +#: using/cmdline.rst:582 msgid "" "``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " "location information (end line, start column offset and end column offset) " @@ -720,18 +802,19 @@ msgid "" "envvar:`PYTHONNODEBUGRANGES`." msgstr "" -#: using/cmdline.rst:540 +#: using/cmdline.rst:591 msgid "" "``-X frozen_modules`` determines whether or not frozen modules are ignored " -"by the import machinery. A value of \"on\" means they get imported and " -"\"off\" means they are ignored. The default is \"on\" if this is an " +"by the import machinery. A value of ``on`` means they get imported and " +"``off`` means they are ignored. The default is ``on`` if this is an " "installed Python (the normal case). If it's under development (running from " -"the source tree) then the default is \"off\". Note that the " -"\"importlib_bootstrap\" and \"importlib_bootstrap_external\" frozen modules " -"are always used, even if this flag is set to \"off\"." +"the source tree) then the default is ``off``. Note that the :mod:`!" +"importlib_bootstrap` and :mod:`!importlib_bootstrap_external` frozen modules " +"are always used, even if this flag is set to ``off``. See also :envvar:" +"`PYTHON_FROZEN_MODULES`." msgstr "" -#: using/cmdline.rst:547 +#: using/cmdline.rst:602 msgid "" "``-X perf`` enables support for the Linux ``perf`` profiler. When this " "option is provided, the ``perf`` profiler will be able to report Python " @@ -740,73 +823,147 @@ msgid "" "also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`." msgstr "" -#: using/cmdline.rst:553 +#: using/cmdline.rst:610 msgid "" -"It also allows passing arbitrary values and retrieving them through the :" -"data:`sys._xoptions` dictionary." +"``-X perf_jit`` enables support for the Linux ``perf`` profiler with DWARF " +"support. When this option is provided, the ``perf`` profiler will be able to " +"report Python calls using DWARF information. This option is only available " +"on some platforms and will do nothing if is not supported on the current " +"system. The default value is \"off\". See also :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." msgstr "" -#: using/cmdline.rst:558 -msgid "Added the ``-X faulthandler`` option." +#: using/cmdline.rst:619 +msgid "" +"``-X disable_remote_debug`` disables the remote debugging support as " +"described in :pep:`768`. This includes both the functionality to schedule " +"code for execution in another process and the functionality to receive code " +"for execution in the current process." msgstr "" -#: using/cmdline.rst:561 -msgid "Added the ``-X showrefcount`` and ``-X tracemalloc`` options." +#: using/cmdline.rst:624 +msgid "" +"This option is only available on some platforms and will do nothing if is " +"not supported on the current system. See also :envvar:" +"`PYTHON_DISABLE_REMOTE_DEBUG` and :pep:`768`." msgstr "" -#: using/cmdline.rst:564 -msgid "Added the ``-X showalloccount`` option." +#: using/cmdline.rst:630 +msgid "" +":samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`, :func:`os." +"process_cpu_count`, and :func:`multiprocessing.cpu_count`. *n* must be " +"greater than or equal to 1. This option may be useful for users who need to " +"limit CPU resources of a container system. See also :envvar:" +"`PYTHON_CPU_COUNT`. If *n* is ``default``, nothing is overridden." msgstr "" -#: using/cmdline.rst:567 -msgid "Added the ``-X importtime``, ``-X dev`` and ``-X utf8`` options." +#: using/cmdline.rst:639 +msgid "" +":samp:`-X presite={package.module}` specifies a module that should be " +"imported before the :mod:`site` module is executed and before the :mod:" +"`__main__` module exists. Therefore, the imported module isn't :mod:" +"`__main__`. This can be used to execute code early during Python " +"initialization. Python needs to be :ref:`built in debug mode ` " +"for this option to exist. See also :envvar:`PYTHON_PRESITE`." msgstr "" -#: using/cmdline.rst:570 +#: using/cmdline.rst:648 msgid "" -"Added the ``-X pycache_prefix`` option. The ``-X dev`` option now logs " -"``close()`` exceptions in :class:`io.IOBase` destructor." +":samp:`-X gil={0,1}` forces the GIL to be disabled or enabled, respectively. " +"Setting to ``0`` is only available in builds configured with :option:`--" +"disable-gil`. See also :envvar:`PYTHON_GIL` and :ref:`whatsnew313-free-" +"threaded-cpython`." msgstr "" -#: using/cmdline.rst:574 +#: using/cmdline.rst:655 msgid "" -"Using ``-X dev`` option, check *encoding* and *errors* arguments on string " -"encoding and decoding operations." +":samp:`-X thread_inherit_context={0,1}` causes :class:`~threading.Thread` " +"to, by default, use a copy of context of the caller of ``Thread.start()`` " +"when starting. Otherwise, threads will start with an empty context. If " +"unset, the value of this option defaults to ``1`` on free-threaded builds " +"and to ``0`` otherwise. See also :envvar:`PYTHON_THREAD_INHERIT_CONTEXT`." msgstr "" -#: using/cmdline.rst:578 -msgid "The ``-X showalloccount`` option has been removed." +#: using/cmdline.rst:664 +msgid "" +":samp:`-X context_aware_warnings={0,1}` causes the :class:`warnings." +"catch_warnings` context manager to use a :class:`~contextvars.ContextVar` to " +"store warnings filter state. If unset, the value of this option defaults to " +"``1`` on free-threaded builds and to ``0`` otherwise. See also :envvar:" +"`PYTHON_CONTEXT_AWARE_WARNINGS`." msgstr "" -#: using/cmdline.rst:580 +#: using/cmdline.rst:672 msgid "" -"Added the ``-X warn_default_encoding`` option. Removed the ``-X oldparser`` " -"option." +":samp:`-X tlbc={0,1}` enables (1, the default) or disables (0) thread-local " +"bytecode in builds configured with :option:`--disable-gil`. When disabled, " +"this also disables the specializing interpreter. See also :envvar:" +"`PYTHON_TLBC`." +msgstr "" + +#: using/cmdline.rst:679 +msgid "" +"It also allows passing arbitrary values and retrieving them through the :" +"data:`sys._xoptions` dictionary." +msgstr "" + +#: using/cmdline.rst:684 +msgid "Removed the ``-X showalloccount`` option." +msgstr "" + +#: using/cmdline.rst:687 +msgid "Removed the ``-X oldparser`` option." +msgstr "" + +#: using/cmdline.rst:692 +msgid "" +":option:`!-J` is no longer reserved for use by Jython_, and now has no " +"special meaning." +msgstr "" + +#: using/cmdline.rst:700 +msgid "Controlling color" msgstr "" -#: using/cmdline.rst:584 +#: using/cmdline.rst:702 msgid "" -"Added the ``-X no_debug_ranges``, ``-X frozen_modules`` and ``-X " -"int_max_str_digits`` options." +"The Python interpreter is configured by default to use colors to highlight " +"output in certain situations such as when displaying tracebacks. This " +"behavior can be controlled by setting different environment variables." msgstr "" -#: using/cmdline.rst:588 -msgid "Added the ``-X perf`` option." +#: using/cmdline.rst:706 +msgid "" +"Setting the environment variable ``TERM`` to ``dumb`` will disable color." msgstr "" -#: using/cmdline.rst:593 -msgid "Options you shouldn't use" +#: using/cmdline.rst:708 +msgid "" +"If the |FORCE_COLOR|_ environment variable is set, then color will be " +"enabled regardless of the value of TERM. This is useful on CI systems which " +"aren’t terminals but can still display ANSI escape sequences." msgstr "" -#: using/cmdline.rst:597 -msgid "Reserved for use by Jython_." +#: using/cmdline.rst:712 +msgid "" +"If the |NO_COLOR|_ environment variable is set, Python will disable all " +"color in the output. This takes precedence over ``FORCE_COLOR``." msgstr "" -#: using/cmdline.rst:605 +#: using/cmdline.rst:715 +msgid "" +"All these environment variables are used also by other tools to control " +"color output. To control the color output only in the Python interpreter, " +"the :envvar:`PYTHON_COLORS` environment variable can be used. This variable " +"takes precedence over ``NO_COLOR``, which in turn takes precedence over " +"``FORCE_COLOR``." +msgstr "" + +#: using/cmdline.rst:725 msgid "Environment variables" msgstr "" -#: using/cmdline.rst:607 +#: using/cmdline.rst:727 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -814,7 +971,7 @@ msgid "" "conflict." msgstr "" -#: using/cmdline.rst:614 +#: using/cmdline.rst:734 msgid "" "Change the location of the standard Python libraries. By default, the " "libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" @@ -823,14 +980,14 @@ msgid "" "file:`/usr/local`." msgstr "" -#: using/cmdline.rst:620 +#: using/cmdline.rst:740 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: using/cmdline.rst:627 +#: using/cmdline.rst:747 msgid "" "Augment the default search path for module files. The format is the same as " "the shell's :envvar:`PATH`: one or more directory pathnames separated by :" @@ -838,21 +995,21 @@ msgid "" "existent directories are silently ignored." msgstr "" -#: using/cmdline.rst:632 +#: using/cmdline.rst:752 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: using/cmdline.rst:636 +#: using/cmdline.rst:756 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: using/cmdline.rst:640 +#: using/cmdline.rst:760 msgid "" "An additional directory will be inserted in the search path in front of :" "envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" @@ -860,19 +1017,19 @@ msgid "" "the variable :data:`sys.path`." msgstr "" -#: using/cmdline.rst:648 +#: using/cmdline.rst:768 msgid "" "If this is set to a non-empty string, don't prepend a potentially unsafe " "path to :data:`sys.path`: see the :option:`-P` option for details." msgstr "" -#: using/cmdline.rst:656 +#: using/cmdline.rst:776 msgid "" "If this is set to a non-empty string, it overrides the :data:`sys." "platlibdir` value." msgstr "" -#: using/cmdline.rst:664 +#: using/cmdline.rst:784 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -883,26 +1040,20 @@ msgid "" "file." msgstr "" -#: using/cmdline.rst:671 -msgid "" -"Raises an :ref:`auditing event ` ``cpython.run_startup`` with " -"argument ``filename``." -msgstr "" - -#: using/cmdline.rst:673 +#: using/cmdline.rst:793 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_startup`` with the " "filename as the argument when called on startup." msgstr "" -#: using/cmdline.rst:679 +#: using/cmdline.rst:799 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-O` option. If set to an integer, it is equivalent to specifying :" "option:`-O` multiple times." msgstr "" -#: using/cmdline.rst:686 +#: using/cmdline.rst:806 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " @@ -913,58 +1064,68 @@ msgid "" "breakpointhook` to do nothing but return immediately." msgstr "" -#: using/cmdline.rst:698 +#: using/cmdline.rst:818 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-d` option. If set to an integer, it is equivalent to specifying :" "option:`-d` multiple times." msgstr "" -#: using/cmdline.rst:702 +#: using/cmdline.rst:822 msgid "" "This environment variable requires a :ref:`debug build of Python `, otherwise it's ignored." msgstr "" -#: using/cmdline.rst:708 +#: using/cmdline.rst:828 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-i` option." msgstr "" -#: using/cmdline.rst:711 +#: using/cmdline.rst:831 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: using/cmdline.rst:717 +#: using/cmdline.rst:836 +msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." +msgstr "" + +#: using/cmdline.rst:839 +msgid "" +"Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " +"executed. Emits audit events." +msgstr "" + +#: using/cmdline.rst:846 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-u` option." msgstr "" -#: using/cmdline.rst:723 +#: using/cmdline.rst:852 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-v` option. If set to an integer, it is equivalent to specifying :" "option:`-v` multiple times." msgstr "" -#: using/cmdline.rst:730 +#: using/cmdline.rst:859 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: using/cmdline.rst:736 +#: using/cmdline.rst:865 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: using/cmdline.rst:743 +#: using/cmdline.rst:872 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -972,40 +1133,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: using/cmdline.rst:753 +#: using/cmdline.rst:882 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: using/cmdline.rst:756 +#: using/cmdline.rst:885 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: using/cmdline.rst:760 +#: using/cmdline.rst:889 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: using/cmdline.rst:764 +#: using/cmdline.rst:893 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: using/cmdline.rst:771 +#: using/cmdline.rst:900 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "`." msgstr "" -#: using/cmdline.rst:779 +#: using/cmdline.rst:908 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -1013,17 +1174,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: using/cmdline.rst:784 +#: using/cmdline.rst:913 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: using/cmdline.rst:787 +#: using/cmdline.rst:916 msgid "The ``encodingname`` part is now optional." msgstr "" -#: using/cmdline.rst:790 +#: using/cmdline.rst:919 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -1031,13 +1192,13 @@ msgid "" "not affected." msgstr "" -#: using/cmdline.rst:797 +#: using/cmdline.rst:926 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "` to :data:`sys.path`." msgstr "" -#: using/cmdline.rst:807 +#: using/cmdline.rst:936 msgid "" "Defines the :data:`user base directory `, which is used to " "compute the path of the :data:`user site-packages directory ` of the :mod:`asyncio` module." msgstr "" -#: using/cmdline.rst:889 +#: using/cmdline.rst:1024 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: using/cmdline.rst:891 +#: using/cmdline.rst:1026 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: using/cmdline.rst:893 +#: using/cmdline.rst:1028 msgid "" "``default``: use the :ref:`default memory allocators `." msgstr "" -#: using/cmdline.rst:895 +#: using/cmdline.rst:1030 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " "domains (:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:" "`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: using/cmdline.rst:898 +#: using/cmdline.rst:1033 msgid "" "``pymalloc``: use the :ref:`pymalloc allocator ` for :c:macro:" "`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: using/cmdline.rst:902 +#: using/cmdline.rst:1036 +msgid "" +"``mimalloc``: use the :ref:`mimalloc allocator ` for :c:macro:" +"`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" +"func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." +msgstr "" + +#: using/cmdline.rst:1040 msgid "Install :ref:`debug hooks `:" msgstr "" -#: using/cmdline.rst:904 +#: using/cmdline.rst:1042 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "`." msgstr "" -#: using/cmdline.rst:906 +#: using/cmdline.rst:1044 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: using/cmdline.rst:907 +#: using/cmdline.rst:1045 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: using/cmdline.rst:911 +#: using/cmdline.rst:1046 +msgid "``mimalloc_debug``: same as ``mimalloc`` but also install debug hooks." +msgstr "" + +#: using/cmdline.rst:1050 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: using/cmdline.rst:917 +#: using/cmdline.rst:1056 msgid "" "If set to a non-empty string, Python will print statistics of the :ref:" "`pymalloc memory allocator ` every time a new pymalloc object " "arena is created, and on shutdown." msgstr "" -#: using/cmdline.rst:921 +#: using/cmdline.rst:1060 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: using/cmdline.rst:925 +#: using/cmdline.rst:1064 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: using/cmdline.rst:932 +#: using/cmdline.rst:1071 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1168,41 +1357,41 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: using/cmdline.rst:937 +#: using/cmdline.rst:1076 msgid "" "This may also be enabled at runtime with :func:`sys." -"_enablelegacywindowsfsencoding()`." +"_enablelegacywindowsfsencoding`." msgstr "" -#: using/cmdline.rst:954 -msgid ":ref:`Availability `: Windows." +#: using/cmdline.rst:1093 using/cmdline.rst:1144 +msgid "Availability" msgstr "" -#: using/cmdline.rst:942 +#: using/cmdline.rst:1081 msgid "See :pep:`529` for more details." msgstr "" -#: using/cmdline.rst:947 +#: using/cmdline.rst:1086 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: using/cmdline.rst:951 +#: using/cmdline.rst:1090 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: using/cmdline.rst:961 +#: using/cmdline.rst:1100 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: using/cmdline.rst:965 +#: using/cmdline.rst:1104 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1213,19 +1402,19 @@ msgid "" "runtime:" msgstr "" -#: using/cmdline.rst:973 +#: using/cmdline.rst:1112 msgid "``C.UTF-8``" msgstr "" -#: using/cmdline.rst:974 +#: using/cmdline.rst:1113 msgid "``C.utf8``" msgstr "" -#: using/cmdline.rst:975 +#: using/cmdline.rst:1114 msgid "``UTF-8``" msgstr "" -#: using/cmdline.rst:977 +#: using/cmdline.rst:1116 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1238,7 +1427,7 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: using/cmdline.rst:987 +#: using/cmdline.rst:1126 msgid "" "Configuring one of these locales (either explicitly or via the above " "implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" @@ -1248,7 +1437,7 @@ msgid "" "envvar:`PYTHONIOENCODING` as usual." msgstr "" -#: using/cmdline.rst:994 +#: using/cmdline.rst:1133 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1256,7 +1445,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: using/cmdline.rst:999 +#: using/cmdline.rst:1138 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1265,15 +1454,11 @@ msgid "" "system interfaces." msgstr "" -#: using/cmdline.rst:1005 -msgid ":ref:`Availability `: Unix." -msgstr "" - -#: using/cmdline.rst:1007 +#: using/cmdline.rst:1146 msgid "See :pep:`538` for more details." msgstr "" -#: using/cmdline.rst:1013 +#: using/cmdline.rst:1152 msgid "" "If this environment variable is set to a non-empty string, enable :ref:" "`Python Development Mode `, introducing additional runtime checks " @@ -1281,31 +1466,31 @@ msgid "" "setting the :option:`-X` ``dev`` option." msgstr "" -#: using/cmdline.rst:1022 +#: using/cmdline.rst:1161 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode `." msgstr "" -#: using/cmdline.rst:1024 +#: using/cmdline.rst:1163 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode `." msgstr "" -#: using/cmdline.rst:1026 +#: using/cmdline.rst:1165 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: using/cmdline.rst:1033 +#: using/cmdline.rst:1172 msgid "" "If this environment variable is set to a non-empty string, issue a :class:" "`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: using/cmdline.rst:1036 +#: using/cmdline.rst:1175 msgid "See :ref:`io-encoding-warning` for details." msgstr "" -#: using/cmdline.rst:1042 +#: using/cmdline.rst:1181 msgid "" "If this variable is set, it disables the inclusion of the tables mapping " "extra location information (end line, start column offset and end column " @@ -1314,39 +1499,187 @@ msgid "" "visual location indicators when the interpreter displays tracebacks." msgstr "" -#: using/cmdline.rst:1052 +#: using/cmdline.rst:1191 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it." msgstr "" -#: using/cmdline.rst:1055 +#: using/cmdline.rst:1207 msgid "If set to ``0``, disable Linux ``perf`` profiler support." msgstr "" -#: using/cmdline.rst:1057 +#: using/cmdline.rst:1196 msgid "" "See also the :option:`-X perf <-X>` command-line option and :ref:" "`perf_profiling`." msgstr "" -#: using/cmdline.rst:1064 +#: using/cmdline.rst:1203 +msgid "" +"If this variable is set to a nonzero value, it enables support for the Linux " +"``perf`` profiler so Python calls can be detected by it using DWARF " +"information." +msgstr "" + +#: using/cmdline.rst:1209 +msgid "" +"See also the :option:`-X perf_jit <-X>` command-line option and :ref:" +"`perf_profiling`." +msgstr "" + +#: using/cmdline.rst:1216 +msgid "" +"If this variable is set to a non-empty string, it disables the remote " +"debugging feature described in :pep:`768`. This includes both the " +"functionality to schedule code for execution in another process and the " +"functionality to receive code for execution in the current process." +msgstr "" + +#: using/cmdline.rst:1221 +msgid "See also the :option:`-X disable_remote_debug` command-line option." +msgstr "" + +#: using/cmdline.rst:1227 +msgid "" +"If this variable is set to a positive integer, it overrides the return " +"values of :func:`os.cpu_count` and :func:`os.process_cpu_count`." +msgstr "" + +#: using/cmdline.rst:1230 +msgid "See also the :option:`-X cpu_count <-X>` command-line option." +msgstr "" + +#: using/cmdline.rst:1236 +msgid "" +"If this variable is set to ``on`` or ``off``, it determines whether or not " +"frozen modules are ignored by the import machinery. A value of ``on`` means " +"they get imported and ``off`` means they are ignored. The default is ``on`` " +"for non-debug builds (the normal case) and ``off`` for debug builds. Note " +"that the :mod:`!importlib_bootstrap` and :mod:`!" +"importlib_bootstrap_external` frozen modules are always used, even if this " +"flag is set to ``off``." +msgstr "" + +#: using/cmdline.rst:1244 +msgid "See also the :option:`-X frozen_modules <-X>` command-line option." +msgstr "" + +#: using/cmdline.rst:1250 +msgid "" +"If this variable is set to ``1``, the interpreter will colorize various " +"kinds of output. Setting it to ``0`` deactivates this behavior. See also :" +"ref:`using-on-controlling-color`." +msgstr "" + +#: using/cmdline.rst:1258 +msgid "" +"If this variable is set to any value, the interpreter will not attempt to " +"load the Python-based :term:`REPL` that requires :mod:`readline`, and will " +"instead use the traditional parser-based :term:`REPL`." +msgstr "" + +#: using/cmdline.rst:1266 +msgid "" +"This environment variable can be used to set the location of a ``." +"python_history`` file (by default, it is ``.python_history`` in the user's " +"home directory)." +msgstr "" + +#: using/cmdline.rst:1274 +msgid "" +"If this variable is set to ``1``, the global interpreter lock (GIL) will be " +"forced on. Setting it to ``0`` forces the GIL off (needs Python configured " +"with the :option:`--disable-gil` build option)." +msgstr "" + +#: using/cmdline.rst:1278 +msgid "" +"See also the :option:`-X gil <-X>` command-line option, which takes " +"precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`." +msgstr "" + +#: using/cmdline.rst:1285 +msgid "" +"If this variable is set to ``1`` then :class:`~threading.Thread` will, by " +"default, use a copy of context of the caller of ``Thread.start()`` when " +"starting. Otherwise, new threads will start with an empty context. If " +"unset, this variable defaults to ``1`` on free-threaded builds and to ``0`` " +"otherwise. See also :option:`-X thread_inherit_context<-X>`." +msgstr "" + +#: using/cmdline.rst:1295 +msgid "" +"If set to ``1`` then the :class:`warnings.catch_warnings` context manager " +"will use a :class:`~contextvars.ContextVar` to store warnings filter state. " +"If unset, this variable defaults to ``1`` on free-threaded builds and to " +"``0`` otherwise. See :option:`-X context_aware_warnings<-X>`." +msgstr "" + +#: using/cmdline.rst:1305 +msgid "" +"On builds where experimental just-in-time compilation is available, this " +"variable can force the JIT to be disabled (``0``) or enabled (``1``) at " +"interpreter startup." +msgstr "" + +#: using/cmdline.rst:1313 +msgid "" +"If set to ``1`` enables thread-local bytecode. If set to ``0`` thread-local " +"bytecode and the specializing interpreter are disabled. Only applies to " +"builds configured with :option:`--disable-gil`." +msgstr "" + +#: using/cmdline.rst:1317 +msgid "See also the :option:`-X tlbc <-X>` command-line option." +msgstr "" + +#: using/cmdline.rst:1322 msgid "Debug-mode variables" msgstr "" -#: using/cmdline.rst:1068 +#: using/cmdline.rst:1326 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: using/cmdline.rst:1078 +#: using/cmdline.rst:1337 msgid "" -"Need Python configured with the :option:`--with-trace-refs` build option." +"Needs Python configured with the :option:`--with-trace-refs` build option." msgstr "" -#: using/cmdline.rst:1075 +#: using/cmdline.rst:1333 msgid "" "If set, Python will dump objects and reference counts still alive after " -"shutting down the interpreter into a file called *FILENAME*." +"shutting down the interpreter into a file under the path given as the value " +"to this environment variable." +msgstr "" + +#: using/cmdline.rst:1343 +msgid "" +"If this variable is set to a module, that module will be imported early in " +"the interpreter lifecycle, before the :mod:`site` module is executed, and " +"before the :mod:`__main__` module is created. Therefore, the imported module " +"is not treated as :mod:`__main__`." +msgstr "" + +#: using/cmdline.rst:1348 +msgid "This can be used to execute code early during Python initialization." +msgstr "" + +#: using/cmdline.rst:1350 +msgid "" +"To import a submodule, use ``package.module`` as the value, like in an " +"import statement." +msgstr "" + +#: using/cmdline.rst:1353 +msgid "" +"See also the :option:`-X presite <-X>` command-line option, which takes " +"precedence over this variable." +msgstr "" + +#: using/cmdline.rst:1356 +msgid "Needs Python configured with the :option:`--with-pydebug` build option." msgstr "" diff --git a/using/configure.po b/using/configure.po index 5a2d50ad..a0fd9c19 100644 --- a/using/configure.po +++ b/using/configure.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -20,91 +21,345 @@ msgstr "" msgid "Configure Python" msgstr "" -#: using/configure.rst:8 +#: using/configure.rst:11 msgid "Build Requirements" msgstr "" -#: using/configure.rst:10 -msgid "Features required to build CPython:" +#: using/configure.rst:13 +msgid "To build CPython, you will need:" msgstr "" -#: using/configure.rst:12 +#: using/configure.rst:15 msgid "" "A `C11 `_ compiler. `Optional C11 " "features `_ are not required." msgstr "" -#: using/configure.rst:17 +#: using/configure.rst:20 +msgid "On Windows, Microsoft Visual Studio 2017 or later is required." +msgstr "" + +#: using/configure.rst:22 msgid "" -"Support for `IEEE 754 `_ floating " -"point numbers and `floating point Not-a-Number (NaN) `_ floating-" +"point numbers and `floating-point Not-a-Number (NaN) `_." msgstr "" -#: using/configure.rst:21 +#: using/configure.rst:26 msgid "Support for threads." msgstr "" -#: using/configure.rst:23 -msgid "OpenSSL 1.1.1 or newer for the :mod:`ssl` and :mod:`hashlib` modules." +#: using/configure.rst:28 +msgid "On Windows, Visual Studio 2015 or later is now required." msgstr "" -#: using/configure.rst:25 -msgid "On Windows, Microsoft Visual Studio 2017 or later is required." +#: using/configure.rst:31 +msgid "" +"Selected C99 features, like ```` and ``static inline`` functions, " +"are now required." +msgstr "" + +#: using/configure.rst:35 +msgid "Thread support is now required." msgstr "" -#: using/configure.rst:27 -msgid "On Windows, Visual Studio 2015 or later is required." +#: using/configure.rst:38 +msgid "" +"C11 compiler, IEEE 754 and NaN support are now required. On Windows, Visual " +"Studio 2017 or later is required." msgstr "" -#: using/configure.rst:30 +#: using/configure.rst:42 msgid "" -"Selected C99 features are now required, like ```` and ``static " -"inline`` functions." +"See also :pep:`7` \"Style Guide for C Code\" and :pep:`11` \"CPython " +"platform support\"." msgstr "" -#: using/configure.rst:34 -msgid "Thread support and OpenSSL 1.0.2 are now required." +#: using/configure.rst:49 +msgid "Requirements for optional modules" msgstr "" -#: using/configure.rst:37 -msgid "OpenSSL 1.1.1 is now required." +#: using/configure.rst:51 +msgid "" +"Some :term:`optional modules ` of the standard library " +"require third-party libraries installed for development (for example, header " +"files must be available)." msgstr "" -#: using/configure.rst:40 +#: using/configure.rst:55 msgid "" -"C11 compiler, IEEE 754 and NaN support are now required. On Windows, Visual " -"Studio 2017 or later is required." +"Missing requirements are reported in the ``configure`` output. Modules that " +"are missing due to missing dependencies are listed near the end of the " +"``make`` output, sometimes using an internal name, for example, ``_ctypes`` " +"for :mod:`ctypes` module." msgstr "" -#: using/configure.rst:44 +#: using/configure.rst:61 msgid "" -"See also :pep:`7` \"Style Guide for C Code\" and :pep:`11` \"CPython " -"platform support\"." +"If you distribute a CPython interpreter without optional modules, it's best " +"practice to advise users, who generally expect that standard library modules " +"are available." msgstr "" -#: using/configure.rst:49 +#: using/configure.rst:65 +msgid "Dependencies to build optional modules are:" +msgstr "" + +#: using/configure.rst:71 +msgid "Dependency" +msgstr "" + +#: using/configure.rst:72 +msgid "Minimum version" +msgstr "" + +#: using/configure.rst:73 +msgid "Python module" +msgstr "" + +#: using/configure.rst:74 +msgid "`libbz2 `_" +msgstr "" + +#: using/configure.rst:76 +msgid ":mod:`bz2`" +msgstr "" + +#: using/configure.rst:77 +msgid "`libffi `_" +msgstr "" + +#: using/configure.rst:78 +msgid "3.3.0 recommended" +msgstr "" + +#: using/configure.rst:79 +msgid ":mod:`ctypes`" +msgstr "" + +#: using/configure.rst:80 +msgid "`liblzma `_" +msgstr "" + +#: using/configure.rst:82 +msgid ":mod:`lzma`" +msgstr "" + +#: using/configure.rst:83 +msgid "`libmpdec `_" +msgstr "" + +#: using/configure.rst:84 +msgid "2.5.0" +msgstr "" + +#: using/configure.rst:85 +msgid ":mod:`decimal` [1]_" +msgstr "" + +#: using/configure.rst:86 +msgid "" +"`libreadline `_ or " +"`libedit `_ [2]_" +msgstr "" + +#: using/configure.rst:89 +msgid ":mod:`readline`" +msgstr "" + +#: using/configure.rst:90 +msgid "`libuuid `_" +msgstr "" + +#: using/configure.rst:92 +msgid "``_uuid`` [3]_" +msgstr "" + +#: using/configure.rst:93 +msgid "`ncurses `_ [4]_" +msgstr "" + +#: using/configure.rst:95 +msgid ":mod:`curses`" +msgstr "" + +#: using/configure.rst:96 +msgid "`OpenSSL `_" +msgstr "" + +#: using/configure.rst:0 +msgid "3.0.18 recommended" +msgstr "" + +#: using/configure.rst:0 +msgid "(1.1.1 minimum)" +msgstr "" + +#: using/configure.rst:99 +msgid ":mod:`ssl`, :mod:`hashlib` [5]_" +msgstr "" + +#: using/configure.rst:100 +msgid "`SQLite `_" +msgstr "" + +#: using/configure.rst:101 +msgid "3.15.2" +msgstr "" + +#: using/configure.rst:102 +msgid ":mod:`sqlite3`" +msgstr "" + +#: using/configure.rst:103 +msgid "`Tcl/Tk `_" +msgstr "" + +#: using/configure.rst:104 +msgid "8.5.12" +msgstr "" + +#: using/configure.rst:105 +msgid ":mod:`tkinter`, :ref:`IDLE `, :mod:`turtle`" +msgstr "" + +#: using/configure.rst:106 +msgid "`zlib `_" +msgstr "" + +#: using/configure.rst:107 +msgid "1.2.2.1" +msgstr "" + +#: using/configure.rst:108 +msgid ":mod:`zlib`, :mod:`gzip`, :mod:`ensurepip`" +msgstr "" + +#: using/configure.rst:109 +msgid "`zstd `_" +msgstr "" + +#: using/configure.rst:110 +msgid "1.4.5" +msgstr "" + +#: using/configure.rst:111 +msgid ":mod:`compression.zstd`" +msgstr "" + +#: using/configure.rst:113 +msgid "" +"If *libmpdec* is not available, the :mod:`decimal` module will use a pure-" +"Python implementation. See :option:`--with-system-libmpdec` for details." +msgstr "" + +#: using/configure.rst:116 +msgid "" +"See :option:`--with-readline` for choosing the backend for the :mod:" +"`readline` module." +msgstr "" + +#: using/configure.rst:118 +msgid "" +"The :mod:`uuid` module uses ``_uuid`` to generate \"safe\" UUIDs. See the " +"module documentation for details." +msgstr "" + +#: using/configure.rst:120 +msgid "" +"The :mod:`curses` module requires the ``libncurses`` or ``libncursesw`` " +"library. The :mod:`curses.panel` module additionally requires the " +"``libpanel`` or ``libpanelw`` library." +msgstr "" + +#: using/configure.rst:124 +msgid "" +"If OpenSSL is not available, the :mod:`hashlib` module will use bundled " +"implementations of several hash functions. See :option:`--with-builtin-" +"hashlib-hashes` for *forcing* usage of OpenSSL." +msgstr "" + +#: using/configure.rst:128 +msgid "" +"Note that the table does not include all optional modules; in particular, " +"platform-specific modules like :mod:`winreg` are not listed here." +msgstr "" + +#: using/configure.rst:133 +msgid "" +"The `devguide `_ includes a full list of dependencies required to " +"build all modules and instructions on how to install them on common " +"platforms." +msgstr "" + +#: using/configure.rst:136 +msgid "" +":option:`--with-system-expat` allows building with an external `libexpat " +"`_ library." +msgstr "" + +#: using/configure.rst:138 +msgid ":ref:`configure-options-for-dependencies`" +msgstr "" + +#: using/configure.rst:140 +msgid "Tcl/Tk version 8.3.1 is now required for :mod:`tkinter`." +msgstr "" + +#: using/configure.rst:143 +msgid "Tcl/Tk version 8.4 is now required for :mod:`tkinter`." +msgstr "" + +#: using/configure.rst:146 +msgid "OpenSSL 1.0.2 is now required for :mod:`hashlib` and :mod:`ssl`." +msgstr "" + +#: using/configure.rst:149 +msgid "" +"OpenSSL 1.1.1 is now required for :mod:`hashlib` and :mod:`ssl`. SQLite " +"3.7.15 is now required for :mod:`sqlite3`." +msgstr "" + +#: using/configure.rst:153 +msgid "Tcl/Tk version 8.5.12 is now required for :mod:`tkinter`." +msgstr "" + +#: using/configure.rst:156 +msgid "SQLite 3.15.2 is now required for :mod:`sqlite3`." +msgstr "" + +#: using/configure.rst:161 msgid "Generated files" msgstr "" -#: using/configure.rst:51 +#: using/configure.rst:163 msgid "" "To reduce build dependencies, Python source code contains multiple generated " "files. Commands to regenerate all generated files::" msgstr "" -#: using/configure.rst:59 +#: using/configure.rst:166 +msgid "" +"make regen-all\n" +"make regen-stdlib-module-names\n" +"make regen-limited-abi\n" +"make regen-configure" +msgstr "" + +#: using/configure.rst:171 msgid "" "The ``Makefile.pre.in`` file documents generated files, their inputs, and " "tools used to regenerate them. Search for ``regen-*`` make targets." msgstr "" -#: using/configure.rst:63 +#: using/configure.rst:175 msgid "configure script" msgstr "" -#: using/configure.rst:65 +#: using/configure.rst:177 msgid "" "The ``make regen-configure`` command regenerates the ``aclocal.m4`` file and " "the ``configure`` script using the ``Tools/build/regen-configure.sh`` shell " @@ -112,73 +367,94 @@ msgid "" "have a reproducible output." msgstr "" -#: using/configure.rst:70 +#: using/configure.rst:182 msgid "The container is optional, the following command can be run locally::" msgstr "" -#: using/configure.rst:74 +#: using/configure.rst:184 +msgid "autoreconf -ivf -Werror" +msgstr "" + +#: using/configure.rst:186 +msgid "" +"The generated files can change depending on the exact versions of the tools " +"used. The container that CPython uses has `Autoconf `_ 2.72, ``aclocal`` from `Automake `_ 1.16.5, and `pkg-config `_ 1.8.1." +msgstr "" + +#: using/configure.rst:193 msgid "" -"The generated files can change depending on the exact ``autoconf-archive``, " -"``aclocal`` and ``pkg-config`` versions." +"Autoconf 2.71 and aclocal 1.16.5 and are now used to regenerate :file:" +"`configure`." +msgstr "" + +#: using/configure.rst:197 +msgid "Autoconf 2.72 is now used to regenerate :file:`configure`." msgstr "" -#: using/configure.rst:81 +#: using/configure.rst:204 msgid "Configure Options" msgstr "" -#: using/configure.rst:83 -msgid "List all ``./configure`` script options using::" +#: using/configure.rst:206 +msgid "List all :file:`configure` script options using::" msgstr "" -#: using/configure.rst:87 +#: using/configure.rst:208 +msgid "./configure --help" +msgstr "" + +#: using/configure.rst:210 msgid "" "See also the :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution." msgstr "" -#: using/configure.rst:90 +#: using/configure.rst:213 msgid "General Options" msgstr "" -#: using/configure.rst:94 +#: using/configure.rst:217 msgid "" "Support loadable extensions in the :mod:`!_sqlite` extension module (default " "is no) of the :mod:`sqlite3` module." msgstr "" -#: using/configure.rst:97 +#: using/configure.rst:220 msgid "" "See the :meth:`sqlite3.Connection.enable_load_extension` method of the :mod:" "`sqlite3` module." msgstr "" -#: using/configure.rst:104 +#: using/configure.rst:227 msgid "" "Disable IPv6 support (enabled by default if supported), see the :mod:" "`socket` module." msgstr "" -#: using/configure.rst:109 +#: using/configure.rst:232 msgid "Define the size in bits of Python :class:`int` digits: 15 or 30 bits." msgstr "" -#: using/configure.rst:111 +#: using/configure.rst:234 msgid "By default, the digit size is 30." msgstr "" -#: using/configure.rst:113 +#: using/configure.rst:236 msgid "Define the ``PYLONG_BITS_IN_DIGIT`` to ``15`` or ``30``." msgstr "" -#: using/configure.rst:115 +#: using/configure.rst:238 msgid "See :data:`sys.int_info.bits_per_digit `." msgstr "" -#: using/configure.rst:119 +#: using/configure.rst:242 msgid "Set the Python executable suffix to *SUFFIX*." msgstr "" -#: using/configure.rst:121 +#: using/configure.rst:244 msgid "" "The default suffix is ``.exe`` on Windows and macOS (``python.exe`` " "executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, ``." @@ -186,297 +462,647 @@ msgid "" "executable)." msgstr "" -#: using/configure.rst:126 +#: using/configure.rst:249 msgid "" "The default suffix on WASM platform is one of ``.js``, ``.html`` or ``." "wasm``." msgstr "" -#: using/configure.rst:132 +#: using/configure.rst:255 msgid "" "Select the default time zone search path for :const:`zoneinfo.TZPATH`. See " "the :ref:`Compile-time configuration ` of " "the :mod:`zoneinfo` module." msgstr "" -#: using/configure.rst:136 +#: using/configure.rst:259 msgid "" "Default: ``/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/" "etc/zoneinfo``." msgstr "" -#: using/configure.rst:138 +#: using/configure.rst:261 msgid "See :data:`os.pathsep` path separator." msgstr "" -#: using/configure.rst:144 +#: using/configure.rst:267 msgid "" "Build the ``_decimal`` extension module using a thread-local context rather " "than a coroutine-local context (default), see the :mod:`decimal` module." msgstr "" -#: using/configure.rst:147 +#: using/configure.rst:270 msgid "See :const:`decimal.HAVE_CONTEXTVAR` and the :mod:`contextvars` module." msgstr "" -#: using/configure.rst:153 +#: using/configure.rst:276 msgid "Override order to check db backends for the :mod:`dbm` module" msgstr "" -#: using/configure.rst:155 +#: using/configure.rst:278 msgid "" "A valid value is a colon (``:``) separated string with the backend names:" msgstr "" -#: using/configure.rst:157 +#: using/configure.rst:280 msgid "``ndbm``;" msgstr "" -#: using/configure.rst:158 +#: using/configure.rst:281 msgid "``gdbm``;" msgstr "" -#: using/configure.rst:159 +#: using/configure.rst:282 msgid "``bdb``." msgstr "" -#: using/configure.rst:163 +#: using/configure.rst:286 msgid "Disable C locale coercion to a UTF-8 based locale (enabled by default)." msgstr "" -#: using/configure.rst:165 +#: using/configure.rst:288 msgid "Don't define the ``PY_COERCE_C_LOCALE`` macro." msgstr "" -#: using/configure.rst:167 +#: using/configure.rst:290 msgid "See :envvar:`PYTHONCOERCECLOCALE` and the :pep:`538`." msgstr "" -#: using/configure.rst:171 -msgid "Disable all freelists except the empty tuple singleton." -msgstr "" - -#: using/configure.rst:177 +#: using/configure.rst:294 msgid "Python library directory name (default is ``lib``)." msgstr "" -#: using/configure.rst:179 +#: using/configure.rst:296 msgid "Fedora and SuSE use ``lib64`` on 64-bit platforms." msgstr "" -#: using/configure.rst:181 +#: using/configure.rst:298 msgid "See :data:`sys.platlibdir`." msgstr "" -#: using/configure.rst:187 +#: using/configure.rst:304 msgid "" "Directory of wheel packages used by the :mod:`ensurepip` module (none by " "default)." msgstr "" -#: using/configure.rst:190 +#: using/configure.rst:307 +msgid "" +"Some Linux distribution packaging policies recommend against bundling " +"dependencies. For example, Fedora installs wheel packages in the ``/usr/" +"share/python-wheels/`` directory and don't install the :mod:`!ensurepip." +"_bundled` package." +msgstr "" + +#: using/configure.rst:316 +msgid "" +"Whether configure should use :program:`pkg-config` to detect build " +"dependencies." +msgstr "" + +#: using/configure.rst:319 +msgid "``check`` (default): :program:`pkg-config` is optional" +msgstr "" + +#: using/configure.rst:320 +msgid "``yes``: :program:`pkg-config` is mandatory" +msgstr "" + +#: using/configure.rst:321 +msgid "``no``: configure does not use :program:`pkg-config` even when present" +msgstr "" + +#: using/configure.rst:327 +msgid "Turn on internal Python performance statistics gathering." +msgstr "" + +#: using/configure.rst:329 +msgid "" +"By default, statistics gathering is off. Use ``python3 -X pystats`` command " +"or set ``PYTHONSTATS=1`` environment variable to turn on statistics " +"gathering at Python startup." +msgstr "" + +#: using/configure.rst:333 +msgid "" +"At Python exit, dump statistics if statistics gathering was on and not " +"cleared." +msgstr "" + +#: using/configure.rst:855 +msgid "Effects:" +msgstr "" + +#: using/configure.rst:338 +msgid "Add :option:`-X pystats <-X>` command line option." +msgstr "" + +#: using/configure.rst:339 +msgid "Add :envvar:`!PYTHONSTATS` environment variable." +msgstr "" + +#: using/configure.rst:340 +msgid "Define the ``Py_STATS`` macro." +msgstr "" + +#: using/configure.rst:341 +msgid "Add functions to the :mod:`sys` module:" +msgstr "" + +#: using/configure.rst:343 +msgid ":func:`!sys._stats_on`: Turns on statistics gathering." +msgstr "" + +#: using/configure.rst:344 +msgid ":func:`!sys._stats_off`: Turns off statistics gathering." +msgstr "" + +#: using/configure.rst:345 +msgid ":func:`!sys._stats_clear`: Clears the statistics." +msgstr "" + +#: using/configure.rst:346 +msgid "" +":func:`!sys._stats_dump`: Dump statistics to file, and clears the statistics." +msgstr "" + +#: using/configure.rst:348 +msgid "" +"The statistics will be dumped to a arbitrary (probably unique) file in ``/" +"tmp/py_stats/`` (Unix) or ``C:\\temp\\py_stats\\`` (Windows). If that " +"directory does not exist, results will be printed on stderr." +msgstr "" + +#: using/configure.rst:352 +msgid "Use ``Tools/scripts/summarize_stats.py`` to read the stats." +msgstr "" + +#: using/configure.rst:354 +msgid "Statistics:" +msgstr "" + +#: using/configure.rst:356 +msgid "Opcode:" +msgstr "" + +#: using/configure.rst:358 +msgid "Specialization: success, failure, hit, deferred, miss, deopt, failures;" +msgstr "" + +#: using/configure.rst:359 +msgid "Execution count;" +msgstr "" + +#: using/configure.rst:360 +msgid "Pair count." +msgstr "" + +#: using/configure.rst:362 +msgid "Call:" +msgstr "" + +#: using/configure.rst:364 +msgid "Inlined Python calls;" +msgstr "" + +#: using/configure.rst:365 +msgid "PyEval calls;" +msgstr "" + +#: using/configure.rst:366 +msgid "Frames pushed;" +msgstr "" + +#: using/configure.rst:367 +msgid "Frame object created;" +msgstr "" + +#: using/configure.rst:368 +msgid "" +"Eval calls: vector, generator, legacy, function VECTORCALL, build class, " +"slot, function \"ex\", API, method." +msgstr "" + +#: using/configure.rst:371 +msgid "Object:" +msgstr "" + +#: using/configure.rst:373 +msgid "incref and decref;" +msgstr "" + +#: using/configure.rst:374 +msgid "interpreter incref and decref;" +msgstr "" + +#: using/configure.rst:375 +msgid "allocations: all, 512 bytes, 4 kiB, big;" +msgstr "" + +#: using/configure.rst:376 +msgid "free;" +msgstr "" + +#: using/configure.rst:377 +msgid "to/from free lists;" +msgstr "" + +#: using/configure.rst:378 +msgid "dictionary materialized/dematerialized;" +msgstr "" + +#: using/configure.rst:379 +msgid "type cache;" +msgstr "" + +#: using/configure.rst:380 +msgid "optimization attempts;" +msgstr "" + +#: using/configure.rst:381 +msgid "optimization traces created/executed;" +msgstr "" + +#: using/configure.rst:382 +msgid "uops executed." +msgstr "" + +#: using/configure.rst:384 +msgid "Garbage collector:" +msgstr "" + +#: using/configure.rst:386 +msgid "Garbage collections;" +msgstr "" + +#: using/configure.rst:387 +msgid "Objects visited;" +msgstr "" + +#: using/configure.rst:388 +msgid "Objects collected." +msgstr "" + +#: using/configure.rst:396 +msgid "" +"Enables support for running Python without the :term:`global interpreter " +"lock` (GIL): free threading build." +msgstr "" + +#: using/configure.rst:399 +msgid "" +"Defines the ``Py_GIL_DISABLED`` macro and adds ``\"t\"`` to :data:`sys." +"abiflags`." +msgstr "" + +#: using/configure.rst:402 +msgid "See :ref:`whatsnew313-free-threaded-cpython` for more detail." +msgstr "" + +#: using/configure.rst:408 +msgid "" +"Indicate how to integrate the :ref:`experimental just-in-time compiler " +"`." +msgstr "" + +#: using/configure.rst:410 +msgid "``no``: Don't build the JIT." +msgstr "" + +#: using/configure.rst:411 +msgid "" +"``yes``: Enable the JIT. To disable it at runtime, set the environment " +"variable :envvar:`PYTHON_JIT=0 `." +msgstr "" + +#: using/configure.rst:413 +msgid "" +"``yes-off``: Build the JIT, but disable it by default. To enable it at " +"runtime, set the environment variable :envvar:`PYTHON_JIT=1 `." +msgstr "" + +#: using/configure.rst:415 +msgid "" +"``interpreter``: Enable the \"JIT interpreter\" (only useful for those " +"debugging the JIT itself). To disable it at runtime, set the environment " +"variable :envvar:`PYTHON_JIT=0 `." +msgstr "" + +#: using/configure.rst:419 +msgid "" +"``--enable-experimental-jit=no`` is the default behavior if the option is " +"not provided, and ``--enable-experimental-jit`` is shorthand for ``--enable-" +"experimental-jit=yes``. See :file:`Tools/jit/README.md` for more " +"information, including how to install the necessary build-time dependencies." +msgstr "" + +#: using/configure.rst:426 +msgid "" +"When building CPython with JIT enabled, ensure that your system has Python " +"3.11 or later installed." +msgstr "" + +#: using/configure.rst:432 +msgid "Path to ``pkg-config`` utility." +msgstr "" + +#: using/configure.rst:437 +msgid "``pkg-config`` options." +msgstr "" + +#: using/configure.rst:441 +msgid "C compiler options" +msgstr "" + +#: using/configure.rst:1432 +msgid "C compiler command." +msgstr "" + +#: using/configure.rst:1444 +msgid "C compiler flags." +msgstr "" + +#: using/configure.rst:453 +msgid "C preprocessor command." +msgstr "" + +#: using/configure.rst:457 +msgid "C preprocessor flags, e.g. :samp:`-I{include_dir}`." +msgstr "" + +#: using/configure.rst:929 +msgid "Linker options" +msgstr "" + +#: using/configure.rst:465 +msgid "Linker flags, e.g. :samp:`-L{library_directory}`." +msgstr "" + +#: using/configure.rst:469 +msgid "Libraries to pass to the linker, e.g. :samp:`-l{library}`." +msgstr "" + +#: using/configure.rst:473 +msgid "Name for machine-dependent library files." +msgstr "" + +#: using/configure.rst:479 +msgid "Options for third-party dependencies" +msgstr "" + +#: using/configure.rst:486 +msgid "" +"C compiler and linker flags to link Python to ``libbz2``, used by :mod:`bz2` " +"module, overriding ``pkg-config``." +msgstr "" + +#: using/configure.rst:492 +msgid "" +"C compiler and linker flags for ``libncurses`` or ``libncursesw``, used by :" +"mod:`curses` module, overriding ``pkg-config``." +msgstr "" + +#: using/configure.rst:498 +msgid "C compiler and linker flags for ``gdbm``." +msgstr "" + +#: using/configure.rst:503 +msgid "" +"C compiler and linker flags for ``libedit``, used by :mod:`readline` module, " +"overriding ``pkg-config``." +msgstr "" + +#: using/configure.rst:509 +msgid "" +"C compiler and linker flags for ``libffi``, used by :mod:`ctypes` module, " +"overriding ``pkg-config``." +msgstr "" + +#: using/configure.rst:515 msgid "" -"Some Linux distribution packaging policies recommend against bundling " -"dependencies. For example, Fedora installs wheel packages in the ``/usr/" -"share/python-wheels/`` directory and don't install the :mod:`!ensurepip." -"_bundled` package." +"C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module, " +"overriding ``pkg-config``." msgstr "" -#: using/configure.rst:199 +#: using/configure.rst:520 msgid "" -"Whether configure should use :program:`pkg-config` to detect build " -"dependencies." +"These environment variables have no effect unless :option:`--with-system-" +"libmpdec` is specified." msgstr "" -#: using/configure.rst:202 -msgid "``check`` (default): :program:`pkg-config` is optional" +#: using/configure.rst:526 +msgid "" +"C compiler and linker flags for ``liblzma``, used by :mod:`lzma` module, " +"overriding ``pkg-config``." msgstr "" -#: using/configure.rst:203 -msgid "``yes``: :program:`pkg-config` is mandatory" +#: using/configure.rst:532 +msgid "" +"C compiler and linker flags for ``libreadline``, used by :mod:`readline` " +"module, overriding ``pkg-config``." msgstr "" -#: using/configure.rst:204 -msgid "``no``: configure does not use :program:`pkg-config` even when present" +#: using/configure.rst:538 +msgid "" +"C compiler and linker flags for ``libsqlite3``, used by :mod:`sqlite3` " +"module, overriding ``pkg-config``." msgstr "" -#: using/configure.rst:210 -msgid "Turn on internal statistics gathering." +#: using/configure.rst:544 +msgid "" +"C compiler and linker flags for ``libuuid``, used by :mod:`uuid` module, " +"overriding ``pkg-config``." msgstr "" -#: using/configure.rst:212 +#: using/configure.rst:550 msgid "" -"The statistics will be dumped to a arbitrary (probably unique) file in ``/" -"tmp/py_stats/``, or ``C:\\temp\\py_stats\\`` on Windows. If that directory " -"does not exist, results will be printed on stdout." +"C compiler and linker flags for ``libzstd``, used by :mod:`compression.zstd` " +"module, overriding ``pkg-config``." msgstr "" -#: using/configure.rst:216 -msgid "Use ``Tools/scripts/summarize_stats.py`` to read the stats." +#: using/configure.rst:558 +msgid "C compiler and linker flags for PANEL, overriding ``pkg-config``." msgstr "" -#: using/configure.rst:221 -msgid "WebAssembly Options" +#: using/configure.rst:560 +msgid "" +"C compiler and linker flags for ``libpanel`` or ``libpanelw``, used by :mod:" +"`curses.panel` module, overriding ``pkg-config``." msgstr "" -#: using/configure.rst:225 -msgid "Set build flavor for ``wasm32-emscripten``." +#: using/configure.rst:566 +msgid "C compiler and linker flags for TCLTK, overriding ``pkg-config``." msgstr "" -#: using/configure.rst:227 -msgid "``browser`` (default): preload minimal stdlib, default MEMFS." +#: using/configure.rst:571 +msgid "" +"C compiler and linker flags for ``libzlib``, used by :mod:`gzip` module, " +"overriding ``pkg-config``." msgstr "" -#: using/configure.rst:228 -msgid "``node``: NODERAWFS and pthread support." +#: using/configure.rst:576 +msgid "WebAssembly Options" msgstr "" -#: using/configure.rst:234 +#: using/configure.rst:580 msgid "Turn on dynamic linking support for WASM." msgstr "" -#: using/configure.rst:236 +#: using/configure.rst:582 msgid "" "Dynamic linking enables ``dlopen``. File size of the executable increases " "due to limited dead code elimination and additional features." msgstr "" -#: using/configure.rst:243 +#: using/configure.rst:589 msgid "Turn on pthreads support for WASM." msgstr "" -#: using/configure.rst:249 +#: using/configure.rst:595 msgid "Install Options" msgstr "" -#: using/configure.rst:253 +#: using/configure.rst:599 msgid "" "Install architecture-independent files in PREFIX. On Unix, it defaults to :" "file:`/usr/local`." msgstr "" -#: using/configure.rst:256 +#: using/configure.rst:602 msgid "This value can be retrieved at runtime using :data:`sys.prefix`." msgstr "" -#: using/configure.rst:258 +#: using/configure.rst:604 msgid "" "As an example, one can use ``--prefix=\"$HOME/.local/\"`` to install a " "Python in its home directory." msgstr "" -#: using/configure.rst:263 +#: using/configure.rst:609 msgid "" "Install architecture-dependent files in EPREFIX, defaults to :option:`--" "prefix`." msgstr "" -#: using/configure.rst:265 +#: using/configure.rst:611 msgid "This value can be retrieved at runtime using :data:`sys.exec_prefix`." msgstr "" -#: using/configure.rst:269 +#: using/configure.rst:615 msgid "" "Don't build nor install test modules, like the :mod:`test` package or the :" "mod:`!_testcapi` extension module (built and installed by default)." msgstr "" -#: using/configure.rst:276 +#: using/configure.rst:622 msgid "Select the :mod:`ensurepip` command run on Python installation:" msgstr "" -#: using/configure.rst:278 +#: using/configure.rst:624 msgid "" "``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade`` " "command." msgstr "" -#: using/configure.rst:280 +#: using/configure.rst:626 msgid "``install``: run ``python -m ensurepip --altinstall`` command;" msgstr "" -#: using/configure.rst:281 +#: using/configure.rst:627 msgid "``no``: don't run ensurepip;" msgstr "" -#: using/configure.rst:287 +#: using/configure.rst:633 msgid "Performance options" msgstr "" -#: using/configure.rst:289 +#: using/configure.rst:635 msgid "" "Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) " "is recommended for best performance. The experimental ``--enable-bolt`` flag " "can also be used to improve performance." msgstr "" -#: using/configure.rst:295 +#: using/configure.rst:641 msgid "" "Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK` " "(disabled by default)." msgstr "" -#: using/configure.rst:298 +#: using/configure.rst:644 msgid "" "The C compiler Clang requires ``llvm-profdata`` program for PGO. On macOS, " "GCC also requires it: GCC is just an alias to Clang on macOS." msgstr "" -#: using/configure.rst:301 +#: using/configure.rst:647 msgid "" "Disable also semantic interposition in libpython if ``--enable-shared`` and " "GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker " "flags." msgstr "" -#: using/configure.rst:307 +#: using/configure.rst:653 +msgid "" +"During the build, you may encounter compiler warnings about profile data not " +"being available for some source files. These warnings are harmless, as only " +"a subset of the code is exercised during profile data acquisition. To " +"disable these warnings on Clang, manually suppress them by adding ``-Wno-" +"profile-instr-unprofiled`` to :envvar:`CFLAGS`." +msgstr "" + +#: using/configure.rst:662 msgid "Use ``-fno-semantic-interposition`` on GCC." msgstr "" -#: using/configure.rst:312 +#: using/configure.rst:667 msgid "" "Environment variable used in the Makefile: Python command line arguments for " "the PGO generation task." msgstr "" -#: using/configure.rst:315 +#: using/configure.rst:670 msgid "Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``." msgstr "" -#: using/configure.rst:321 +#: using/configure.rst:674 +msgid "Task failure is no longer ignored silently." +msgstr "" + +#: using/configure.rst:679 msgid "Enable Link Time Optimization (LTO) in any build (disabled by default)." msgstr "" -#: using/configure.rst:323 +#: using/configure.rst:681 msgid "" "The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well " "as an LTO-aware linker (``ld.gold`` or ``lld``)." msgstr "" -#: using/configure.rst:328 +#: using/configure.rst:686 msgid "To use ThinLTO feature, use ``--with-lto=thin`` on Clang." msgstr "" -#: using/configure.rst:331 +#: using/configure.rst:689 msgid "" "Use ThinLTO as the default optimization policy on Clang if the compiler " "accepts the flag." msgstr "" -#: using/configure.rst:336 +#: using/configure.rst:694 msgid "" "Enable usage of the `BOLT post-link binary optimizer `_ (disabled by default)." msgstr "" -#: using/configure.rst:340 +#: using/configure.rst:698 msgid "" "BOLT is part of the LLVM project but is not always included in their binary " "distributions. This flag requires that ``llvm-bolt`` and ``merge-fdata`` are " "available." msgstr "" -#: using/configure.rst:344 +#: using/configure.rst:702 msgid "" "BOLT is still a fairly new project so this flag should be considered " "experimental for now. Because this tool operates on machine code its success " @@ -487,7 +1113,7 @@ msgid "" "encouraged." msgstr "" -#: using/configure.rst:352 +#: using/configure.rst:710 msgid "" "The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!BOLT_APPLY_FLAGS` :" "program:`configure` variables can be defined to override the default set of " @@ -495,101 +1121,148 @@ msgid "" "binaries, respectively." msgstr "" -#: using/configure.rst:361 +#: using/configure.rst:719 +msgid "" +"Arguments to ``llvm-bolt`` when creating a `BOLT optimized binary `_." +msgstr "" + +#: using/configure.rst:726 +msgid "Arguments to ``llvm-bolt`` when instrumenting binaries." +msgstr "" + +#: using/configure.rst:732 msgid "" "Enable computed gotos in evaluation loop (enabled by default on supported " "compilers)." msgstr "" -#: using/configure.rst:366 +#: using/configure.rst:737 msgid "" -"Disable the specialized Python memory allocator :ref:`pymalloc ` " -"(enabled by default)." +"Enable interpreters using tail calls in CPython. If enabled, enabling PGO (:" +"option:`--enable-optimizations`) is highly recommended. This option " +"specifically requires a C compiler with proper tail call support, and the " +"`preserve_none `_ calling convention. For example, Clang 19 and newer supports this " +"feature." msgstr "" -#: using/configure.rst:369 +#: using/configure.rst:747 +msgid "" +"Disable the fast :ref:`mimalloc ` allocator (enabled by default)." +msgstr "" + +#: using/configure.rst:757 msgid "See also :envvar:`PYTHONMALLOC` environment variable." msgstr "" -#: using/configure.rst:373 +#: using/configure.rst:754 +msgid "" +"Disable the specialized Python memory allocator :ref:`pymalloc ` " +"(enabled by default)." +msgstr "" + +#: using/configure.rst:761 msgid "" "Disable static documentation strings to reduce the memory footprint (enabled " "by default). Documentation strings defined in Python are not affected." msgstr "" -#: using/configure.rst:376 +#: using/configure.rst:764 msgid "Don't define the ``WITH_DOC_STRINGS`` macro." msgstr "" -#: using/configure.rst:378 +#: using/configure.rst:766 msgid "See the ``PyDoc_STRVAR()`` macro." msgstr "" -#: using/configure.rst:382 +#: using/configure.rst:770 msgid "Enable C-level code profiling with ``gprof`` (disabled by default)." msgstr "" -#: using/configure.rst:386 +#: using/configure.rst:774 msgid "" "Add ``-fstrict-overflow`` to the C compiler flags (by default we add ``-fno-" "strict-overflow`` instead)." msgstr "" -#: using/configure.rst:393 +#: using/configure.rst:779 +msgid "" +"Deactivate remote debugging support described in :pep:`768` (enabled by " +"default). When this flag is provided the code that allows the interpreter to " +"schedule the execution of a Python file in a separate process as described " +"in :pep:`768` is not compiled. This includes both the functionality to " +"schedule code to be executed and the functionality to receive code to be " +"executed." +msgstr "" + +#: using/configure.rst:787 +msgid "" +"This macro is defined by default, unless Python is configured with :option:" +"`--without-remote-debug`." +msgstr "" + +#: using/configure.rst:790 +msgid "" +"Note that even if the macro is defined, remote debugging may not be " +"available (for example, on an incompatible platform)." +msgstr "" + +#: using/configure.rst:799 msgid "Python Debug Build" msgstr "" -#: using/configure.rst:395 +#: using/configure.rst:801 msgid "" "A debug build is Python built with the :option:`--with-pydebug` configure " "option." msgstr "" -#: using/configure.rst:398 +#: using/configure.rst:804 msgid "Effects of a debug build:" msgstr "" -#: using/configure.rst:400 +#: using/configure.rst:806 msgid "" "Display all warnings by default: the list of default warning filters is " "empty in the :mod:`warnings` module." msgstr "" -#: using/configure.rst:402 +#: using/configure.rst:808 msgid "Add ``d`` to :data:`sys.abiflags`." msgstr "" -#: using/configure.rst:403 +#: using/configure.rst:809 msgid "Add :func:`!sys.gettotalrefcount` function." msgstr "" -#: using/configure.rst:404 +#: using/configure.rst:810 msgid "Add :option:`-X showrefcount <-X>` command line option." msgstr "" -#: using/configure.rst:405 +#: using/configure.rst:811 msgid "" "Add :option:`-d` command line option and :envvar:`PYTHONDEBUG` environment " "variable to debug the parser." msgstr "" -#: using/configure.rst:407 +#: using/configure.rst:813 msgid "" "Add support for the ``__lltrace__`` variable: enable low-level tracing in " "the bytecode evaluation loop if the variable is defined." msgstr "" -#: using/configure.rst:409 +#: using/configure.rst:815 msgid "" "Install :ref:`debug hooks on memory allocators ` " "to detect buffer overflow and other memory errors." msgstr "" -#: using/configure.rst:411 +#: using/configure.rst:817 msgid "Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros." msgstr "" -#: using/configure.rst:412 +#: using/configure.rst:818 msgid "" "Add runtime checks: code surrounded by ``#ifdef Py_DEBUG`` and ``#endif``. " "Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set " @@ -597,366 +1270,483 @@ msgid "" "option). Main runtime checks:" msgstr "" -#: using/configure.rst:417 +#: using/configure.rst:823 msgid "Add sanity checks on the function arguments." msgstr "" -#: using/configure.rst:418 +#: using/configure.rst:824 msgid "" "Unicode and int objects are created with their memory filled with a pattern " "to detect usage of uninitialized objects." msgstr "" -#: using/configure.rst:420 +#: using/configure.rst:826 msgid "" "Ensure that functions which can clear or replace the current exception are " "not called with an exception raised." msgstr "" -#: using/configure.rst:422 +#: using/configure.rst:828 msgid "Check that deallocator functions don't change the current exception." msgstr "" -#: using/configure.rst:423 +#: using/configure.rst:829 msgid "" "The garbage collector (:func:`gc.collect` function) runs some basic checks " "on objects consistency." msgstr "" -#: using/configure.rst:425 +#: using/configure.rst:831 msgid "" "The :c:macro:`!Py_SAFE_DOWNCAST()` macro checks for integer underflow and " "overflow when downcasting from wide types to narrow types." msgstr "" -#: using/configure.rst:428 +#: using/configure.rst:834 msgid "" "See also the :ref:`Python Development Mode ` and the :option:`--" "with-trace-refs` configure option." msgstr "" -#: using/configure.rst:431 +#: using/configure.rst:837 msgid "" "Release builds and debug builds are now ABI compatible: defining the " "``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the :" -"option:`--with-trace-refs` option), which introduces the only ABI " -"incompatibility." +"option:`--with-trace-refs` option)." msgstr "" -#: using/configure.rst:439 +#: using/configure.rst:844 msgid "Debug options" msgstr "" -#: using/configure.rst:443 +#: using/configure.rst:848 msgid "" ":ref:`Build Python in debug mode `: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" -#: using/configure.rst:448 +#: using/configure.rst:853 msgid "Enable tracing references for debugging purpose (disabled by default)." msgstr "" -#: using/configure.rst:450 -msgid "Effects:" -msgstr "" - -#: using/configure.rst:452 +#: using/configure.rst:857 msgid "Define the ``Py_TRACE_REFS`` macro." msgstr "" -#: using/configure.rst:453 -msgid "Add :func:`!sys.getobjects` function." +#: using/configure.rst:858 +msgid "Add :func:`sys.getobjects` function." msgstr "" -#: using/configure.rst:454 +#: using/configure.rst:859 msgid "Add :envvar:`PYTHONDUMPREFS` environment variable." msgstr "" -#: using/configure.rst:456 +#: using/configure.rst:861 +msgid "" +"The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " +"objects and reference counts still alive at Python exit." +msgstr "" + +#: using/configure.rst:864 +msgid ":ref:`Statically allocated objects ` are not traced." +msgstr "" + +#: using/configure.rst:868 msgid "" -"This build is not ABI compatible with release build (default build) or debug " -"build (``Py_DEBUG`` and ``Py_REF_DEBUG`` macros)." +"This build is now ABI compatible with release build and :ref:`debug build " +"`." msgstr "" -#: using/configure.rst:463 +#: using/configure.rst:874 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" -#: using/configure.rst:466 +#: using/configure.rst:877 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." msgstr "" -#: using/configure.rst:469 +#: using/configure.rst:880 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build `) which also enables assertions." msgstr "" -#: using/configure.rst:476 +#: using/configure.rst:887 msgid "Enable Valgrind support (default is no)." msgstr "" -#: using/configure.rst:480 +#: using/configure.rst:891 msgid "Enable DTrace support (default is no)." msgstr "" -#: using/configure.rst:482 +#: using/configure.rst:893 msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap `." msgstr "" -#: using/configure.rst:489 +#: using/configure.rst:900 msgid "" -"Enable AddressSanitizer memory error detector, ``asan`` (default is no)." +"Enable AddressSanitizer memory error detector, ``asan`` (default is no). To " +"improve ASan detection capabilities you may also want to combine this with :" +"option:`--without-pymalloc` to disable the specialized small-object " +"allocator whose allocations are not tracked by ASan." msgstr "" -#: using/configure.rst:495 +#: using/configure.rst:909 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." msgstr "" -#: using/configure.rst:501 +#: using/configure.rst:915 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" -#: using/configure.rst:508 -msgid "Linker options" +#: using/configure.rst:922 +msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." msgstr "" -#: using/configure.rst:512 +#: using/configure.rst:933 msgid "Enable building a shared Python library: ``libpython`` (default is no)." msgstr "" -#: using/configure.rst:516 +#: using/configure.rst:937 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" -#: using/configure.rst:523 +#: using/configure.rst:944 msgid "Libraries options" msgstr "" -#: using/configure.rst:527 +#: using/configure.rst:948 msgid "Link against additional libraries (default is no)." msgstr "" -#: using/configure.rst:531 +#: using/configure.rst:952 msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." msgstr "" -#: using/configure.rst:536 +#: using/configure.rst:957 +msgid "" +"Build the ``_decimal`` extension module using an installed ``mpdecimal`` " +"library, see the :mod:`decimal` module (default is yes)." +msgstr "" + +#: using/configure.rst:962 +msgid "Default to using the installed ``mpdecimal`` library." +msgstr "" + +#: using/configure.rst:967 +msgid "" +"A bundled copy of the library will no longer be selected implicitly if an " +"installed ``mpdecimal`` library is not found. In Python 3.15 only, it can " +"still be selected explicitly using ``--with-system-libmpdec=no`` or ``--" +"without-system-libmpdec``." +msgstr "" + +#: using/configure.rst:972 msgid "" -"Build the ``_decimal`` extension module using an installed ``mpdec`` " -"library, see the :mod:`decimal` module (default is no)." +"A copy of the ``mpdecimal`` library sources will no longer be distributed " +"with Python 3.16." +msgstr "" + +#: using/configure.rst:976 +msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." msgstr "" -#: using/configure.rst:543 -msgid "Use ``editline`` library for backend of the :mod:`readline` module." +#: using/configure.rst:980 +msgid "Designate a backend library for the :mod:`readline` module." msgstr "" -#: using/configure.rst:545 -msgid "Define the ``WITH_EDITLINE`` macro." +#: using/configure.rst:982 +msgid "readline: Use readline as the backend." msgstr "" -#: using/configure.rst:551 +#: using/configure.rst:983 +msgid "editline: Use editline as the backend." +msgstr "" + +#: using/configure.rst:989 msgid "Don't build the :mod:`readline` module (built by default)." msgstr "" -#: using/configure.rst:553 +#: using/configure.rst:991 msgid "Don't define the ``HAVE_LIBREADLINE`` macro." msgstr "" -#: using/configure.rst:559 +#: using/configure.rst:997 msgid "" "Override ``libm`` math library to *STRING* (default is system-dependent)." msgstr "" -#: using/configure.rst:563 +#: using/configure.rst:1001 msgid "Override ``libc`` C library to *STRING* (default is system-dependent)." msgstr "" -#: using/configure.rst:567 +#: using/configure.rst:1005 msgid "Root of the OpenSSL directory." msgstr "" -#: using/configure.rst:573 +#: using/configure.rst:1011 msgid "Set runtime library directory (rpath) for OpenSSL libraries:" msgstr "" -#: using/configure.rst:575 +#: using/configure.rst:1013 msgid "``no`` (default): don't set rpath;" msgstr "" -#: using/configure.rst:576 +#: using/configure.rst:1014 msgid "" "``auto``: auto-detect rpath from :option:`--with-openssl` and ``pkg-config``;" msgstr "" -#: using/configure.rst:578 +#: using/configure.rst:1016 msgid "*DIR*: set an explicit rpath." msgstr "" -#: using/configure.rst:584 +#: using/configure.rst:1022 msgid "Security Options" msgstr "" -#: using/configure.rst:588 +#: using/configure.rst:1026 msgid "Select hash algorithm for use in ``Python/pyhash.c``:" msgstr "" -#: using/configure.rst:590 +#: using/configure.rst:1028 msgid "``siphash13`` (default);" msgstr "" -#: using/configure.rst:591 +#: using/configure.rst:1029 msgid "``siphash24``;" msgstr "" -#: using/configure.rst:592 +#: using/configure.rst:1030 msgid "``fnv``." msgstr "" -#: using/configure.rst:596 +#: using/configure.rst:1034 msgid "``siphash13`` is added and it is the new default." msgstr "" -#: using/configure.rst:601 +#: using/configure.rst:1039 msgid "Built-in hash modules:" msgstr "" -#: using/configure.rst:603 +#: using/configure.rst:1041 msgid "``md5``;" msgstr "" -#: using/configure.rst:604 +#: using/configure.rst:1042 msgid "``sha1``;" msgstr "" -#: using/configure.rst:605 +#: using/configure.rst:1043 msgid "``sha256``;" msgstr "" -#: using/configure.rst:606 +#: using/configure.rst:1044 msgid "``sha512``;" msgstr "" -#: using/configure.rst:607 +#: using/configure.rst:1045 msgid "``sha3`` (with shake);" msgstr "" -#: using/configure.rst:608 +#: using/configure.rst:1046 msgid "``blake2``." msgstr "" -#: using/configure.rst:614 +#: using/configure.rst:1052 msgid "Override the OpenSSL default cipher suites string:" msgstr "" -#: using/configure.rst:616 +#: using/configure.rst:1054 msgid "``python`` (default): use Python's preferred selection;" msgstr "" -#: using/configure.rst:617 +#: using/configure.rst:1055 msgid "``openssl``: leave OpenSSL's defaults untouched;" msgstr "" -#: using/configure.rst:618 +#: using/configure.rst:1056 msgid "*STRING*: use a custom string" msgstr "" -#: using/configure.rst:620 +#: using/configure.rst:1058 msgid "See the :mod:`ssl` module." msgstr "" -#: using/configure.rst:626 +#: using/configure.rst:1064 msgid "" "The settings ``python`` and *STRING* also set TLS 1.2 as minimum protocol " "version." msgstr "" -#: using/configure.rst:630 +#: using/configure.rst:1069 +msgid "" +"Disable compiler options that are `recommended by OpenSSF`_ for security " +"reasons with no performance overhead. If this option is not enabled, CPython " +"will be built based on safety compiler options with no slow down. When this " +"option is enabled, CPython will not be built with the compiler options " +"listed below." +msgstr "" + +#: using/configure.rst:1073 +msgid "" +"The following compiler options are disabled with :option:`!--disable-safety`:" +msgstr "" + +#: using/configure.rst:1075 +msgid "" +"`-fstack-protector-strong`_: Enable run-time checks for stack-based buffer " +"overflows." +msgstr "" + +#: using/configure.rst:1076 +msgid "" +"`-Wtrampolines`_: Enable warnings about trampolines that require executable " +"stacks." +msgstr "" + +#: using/configure.rst:1086 +msgid "" +"Enable compiler options that are `recommended by OpenSSF`_ for security " +"reasons which require overhead. If this option is not enabled, CPython will " +"not be built based on safety compiler options which performance impact. When " +"this option is enabled, CPython will be built with the compiler options " +"listed below." +msgstr "" + +#: using/configure.rst:1090 +msgid "" +"The following compiler options are enabled with :option:`!--enable-slower-" +"safety`:" +msgstr "" + +#: using/configure.rst:1092 +msgid "" +"`-D_FORTIFY_SOURCE=3`_: Fortify sources with compile- and run-time checks " +"for unsafe libc usage and buffer overflows." +msgstr "" + +#: using/configure.rst:1100 msgid "macOS Options" msgstr "" -#: using/configure.rst:632 -msgid "See ``Mac/README.rst``." +#: using/configure.rst:1102 +msgid "See :source:`Mac/README.rst`." msgstr "" -#: using/configure.rst:637 +#: using/configure.rst:1107 msgid "" "Create a universal binary build. *SDKDIR* specifies which macOS SDK should " "be used to perform the build (default is no)." msgstr "" -#: using/configure.rst:643 +#: using/configure.rst:1113 msgid "" "Create a Python.framework rather than a traditional Unix install. Optional " "*INSTALLDIR* specifies the installation path (default is no)." msgstr "" -#: using/configure.rst:648 +#: using/configure.rst:1118 msgid "" "Specify the kind of universal binary that should be created. This option is " "only valid when :option:`--enable-universalsdk` is set." msgstr "" -#: using/configure.rst:651 +#: using/configure.rst:1121 msgid "Options:" msgstr "" -#: using/configure.rst:653 -msgid "``universal2``;" +#: using/configure.rst:1123 +msgid "``universal2`` (x86-64 and arm64);" msgstr "" -#: using/configure.rst:654 -msgid "``32-bit``;" +#: using/configure.rst:1124 +msgid "``32-bit`` (PPC and i386);" msgstr "" -#: using/configure.rst:655 -msgid "``64-bit``;" +#: using/configure.rst:1125 +msgid "``64-bit`` (PPC64 and x86-64);" msgstr "" -#: using/configure.rst:656 -msgid "``3-way``;" +#: using/configure.rst:1126 +msgid "``3-way`` (i386, PPC and x86-64);" msgstr "" -#: using/configure.rst:657 -msgid "``intel``;" +#: using/configure.rst:1127 +msgid "``intel`` (i386 and x86-64);" msgstr "" -#: using/configure.rst:658 -msgid "``intel-32``;" +#: using/configure.rst:1128 +msgid "``intel-32`` (i386);" msgstr "" -#: using/configure.rst:659 -msgid "``intel-64``;" +#: using/configure.rst:1129 +msgid "``intel-64`` (x86-64);" msgstr "" -#: using/configure.rst:660 -msgid "``all``." +#: using/configure.rst:1130 +msgid "``all`` (PPC, i386, PPC64 and x86-64)." msgstr "" -#: using/configure.rst:664 +#: using/configure.rst:1132 +msgid "" +"Note that values for this configuration item are *not* the same as the " +"identifiers used for universal binary wheels on macOS. See the Python " +"Packaging User Guide for details on the `packaging platform compatibility " +"tags used on macOS `_" +msgstr "" + +#: using/configure.rst:1140 msgid "" "Specify the name for the python framework on macOS only valid when :option:" "`--enable-framework` is set (default: ``Python``)." msgstr "" -#: using/configure.rst:669 +#: using/configure.rst:1146 +msgid "" +"The Python standard library contains strings that are known to trigger " +"automated inspection tool errors when submitted for distribution by the " +"macOS and iOS App Stores. If enabled, this option will apply the list of " +"patches that are known to correct app store compliance. A custom patch file " +"can also be specified. This option is disabled by default." +msgstr "" + +#: using/configure.rst:1155 +msgid "iOS Options" +msgstr "" + +#: using/configure.rst:1157 +msgid "See :source:`iOS/README.rst`." +msgstr "" + +#: using/configure.rst:1161 +msgid "" +"Create a Python.framework. Unlike macOS, the *INSTALLDIR* argument " +"specifying the installation path is mandatory." +msgstr "" + +#: using/configure.rst:1166 +msgid "Specify the name for the framework (default: ``Python``)." +msgstr "" + +#: using/configure.rst:1170 msgid "Cross Compiling Options" msgstr "" -#: using/configure.rst:671 +#: using/configure.rst:1172 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " @@ -964,149 +1754,291 @@ msgid "" "match the version of the cross compiled host Python." msgstr "" -#: using/configure.rst:678 +#: using/configure.rst:1179 msgid "" "configure for building on BUILD, usually guessed by :program:`config.guess`." msgstr "" -#: using/configure.rst:682 +#: using/configure.rst:1183 msgid "cross-compile to build programs to run on HOST (target platform)" msgstr "" -#: using/configure.rst:686 +#: using/configure.rst:1187 msgid "path to build ``python`` binary for cross compiling" msgstr "" -#: using/configure.rst:692 +#: using/configure.rst:1193 msgid "An environment variable that points to a file with configure overrides." msgstr "" -#: using/configure.rst:694 +#: using/configure.rst:1195 msgid "Example *config.site* file:" msgstr "" -#: using/configure.rst:704 +#: using/configure.rst:1197 +msgid "" +"# config.site-aarch64\n" +"ac_cv_buggy_getaddrinfo=no\n" +"ac_cv_file__dev_ptmx=yes\n" +"ac_cv_file__dev_ptc=no" +msgstr "" + +#: using/configure.rst:1206 +msgid "Program to run CPython for the host platform for cross-compilation." +msgstr "" + +#: using/configure.rst:1211 msgid "Cross compiling example::" msgstr "" -#: using/configure.rst:713 +#: using/configure.rst:1213 +msgid "" +"CONFIG_SITE=config.site-aarch64 ../configure \\\n" +" --build=x86_64-pc-linux-gnu \\\n" +" --host=aarch64-unknown-linux-gnu \\\n" +" --with-build-python=../x86_64/python" +msgstr "" + +#: using/configure.rst:1220 msgid "Python Build System" msgstr "" -#: using/configure.rst:716 +#: using/configure.rst:1223 msgid "Main files of the build system" msgstr "" -#: using/configure.rst:718 +#: using/configure.rst:1225 msgid ":file:`configure.ac` => :file:`configure`;" msgstr "" -#: using/configure.rst:719 +#: using/configure.rst:1226 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" -#: using/configure.rst:720 +#: using/configure.rst:1227 msgid ":file:`pyconfig.h` (created by :file:`configure`);" msgstr "" -#: using/configure.rst:721 +#: using/configure.rst:1228 msgid "" ":file:`Modules/Setup`: C extensions built by the Makefile using :file:" "`Module/makesetup` shell script;" msgstr "" -#: using/configure.rst:725 +#: using/configure.rst:1232 msgid "Main build steps" msgstr "" -#: using/configure.rst:727 +#: using/configure.rst:1234 msgid "C files (``.c``) are built as object files (``.o``)." msgstr "" -#: using/configure.rst:728 +#: using/configure.rst:1235 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: using/configure.rst:729 +#: using/configure.rst:1236 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: using/configure.rst:731 +#: using/configure.rst:1238 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" -#: using/configure.rst:734 +#: using/configure.rst:1241 msgid "Main Makefile targets" msgstr "" -#: using/configure.rst:736 -msgid "``make``: Build Python with the standard library." +#: using/configure.rst:1244 +msgid "make" msgstr "" -#: using/configure.rst:737 +#: using/configure.rst:1246 +msgid "" +"For the most part, when rebuilding after editing some code or refreshing " +"your checkout from upstream, all you need to do is execute ``make``, which " +"(per Make's semantics) builds the default target, the first one defined in " +"the Makefile. By tradition (including in the CPython project) this is " +"usually the ``all`` target. The ``configure`` script expands an ``autoconf`` " +"variable, ``@DEF_MAKE_ALL_RULE@`` to describe precisely which targets ``make " +"all`` will build. The three choices are:" +msgstr "" + +#: using/configure.rst:1255 +msgid "``profile-opt`` (configured with ``--enable-optimizations``)" +msgstr "" + +#: using/configure.rst:1256 msgid "" -"``make platform:``: build the ``python`` program, but don't build the " -"standard library extension modules." +"``build_wasm`` (chosen if the host platform matches ``wasm32-wasi*`` or " +"``wasm32-emscripten``)" msgstr "" -#: using/configure.rst:739 +#: using/configure.rst:1258 msgid "" -"``make profile-opt``: build Python using Profile Guided Optimization (PGO). " -"You can use the configure :option:`--enable-optimizations` option to make " -"this the default target of the ``make`` command (``make all`` or just " -"``make``)." +"``build_all`` (configured without explicitly using either of the others)" msgstr "" -#: using/configure.rst:743 +#: using/configure.rst:1260 msgid "" -"``make buildbottest``: Build Python and run the Python test suite, the same " -"way than buildbots test Python. Set ``TESTTIMEOUT`` variable (in seconds) to " -"change the test timeout (1200 by default: 20 minutes)." +"Depending on the most recent source file changes, Make will rebuild any " +"targets (object files and executables) deemed out-of-date, including running " +"``configure`` again if necessary. Source/target dependencies are many and " +"maintained manually however, so Make sometimes doesn't have all the " +"information necessary to correctly detect all targets which need to be " +"rebuilt. Depending on which targets aren't rebuilt, you might experience a " +"number of problems. If you have build or test problems which you can't " +"otherwise explain, ``make clean && make`` should work around most dependency " +"problems, at the expense of longer build times." msgstr "" -#: using/configure.rst:746 -msgid "``make install``: Build and install Python." +#: using/configure.rst:1273 +msgid "make platform" msgstr "" -#: using/configure.rst:747 +#: using/configure.rst:1275 +msgid "" +"Build the ``python`` program, but don't build the standard library extension " +"modules. This generates a file named ``platform`` which contains a single " +"line describing the details of the build platform, e.g., ``macosx-14.3-" +"arm64-3.12`` or ``linux-x86_64-3.13``." +msgstr "" + +#: using/configure.rst:1282 +msgid "make profile-opt" +msgstr "" + +#: using/configure.rst:1284 +msgid "" +"Build Python using profile-guided optimization (PGO). You can use the " +"configure :option:`--enable-optimizations` option to make this the default " +"target of the ``make`` command (``make all`` or just ``make``)." +msgstr "" + +#: using/configure.rst:1292 +msgid "make clean" +msgstr "" + +#: using/configure.rst:1294 +msgid "Remove built files." +msgstr "" + +#: using/configure.rst:1298 +msgid "make distclean" +msgstr "" + +#: using/configure.rst:1300 +msgid "" +"In addition to the work done by ``make clean``, remove files created by the " +"configure script. ``configure`` will have to be run before building again. " +"[#]_" +msgstr "" + +#: using/configure.rst:1306 +msgid "make install" +msgstr "" + +#: using/configure.rst:1308 +msgid "Build the ``all`` target and install Python." +msgstr "" + +#: using/configure.rst:1312 +msgid "make test" +msgstr "" + +#: using/configure.rst:1314 +msgid "" +"Build the ``all`` target and run the Python test suite with the ``--fast-" +"ci`` option without GUI tests. Variables:" +msgstr "" + +#: using/configure.rst:1317 +msgid "``TESTOPTS``: additional regrtest command-line options." +msgstr "" + +#: using/configure.rst:1318 +msgid "``TESTPYTHONOPTS``: additional Python command-line options." +msgstr "" + +#: using/configure.rst:1319 +msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." +msgstr "" + +#: using/configure.rst:1323 +msgid "make ci" +msgstr "" + +#: using/configure.rst:1325 +msgid "" +"This is similar to ``make test``, but uses the ``-ugui`` to also run GUI " +"tests." +msgstr "" + +#: using/configure.rst:1331 +msgid "make buildbottest" +msgstr "" + +#: using/configure.rst:1333 msgid "" -"``make regen-all``: Regenerate (almost) all generated files; ``make regen-" -"stdlib-module-names`` and ``autoconf`` must be run separately for the " -"remaining generated files." +"This is similar to ``make test``, but uses the ``--slow-ci`` option and " +"default timeout of 20 minutes, instead of ``--fast-ci`` option." msgstr "" -#: using/configure.rst:750 -msgid "``make clean``: Remove built files." +#: using/configure.rst:1338 +msgid "make regen-all" msgstr "" -#: using/configure.rst:751 +#: using/configure.rst:1340 msgid "" -"``make distclean``: Same than ``make clean``, but remove also files created " -"by the configure script." +"Regenerate (almost) all generated files. These include (but are not limited " +"to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" +"names`` and ``autoconf`` must be run separately for the remaining `generated " +"files <#generated-files>`_." msgstr "" -#: using/configure.rst:755 +#: using/configure.rst:1347 msgid "C extensions" msgstr "" -#: using/configure.rst:757 +#: using/configure.rst:1349 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" -#: using/configure.rst:771 +#: using/configure.rst:1353 +msgid "" +">>> import sys\n" +">>> sys\n" +"\n" +">>> sys.__file__\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"AttributeError: module 'sys' has no attribute '__file__'" +msgstr "" + +#: using/configure.rst:1363 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" -#: using/configure.rst:783 +#: using/configure.rst:1367 +msgid "" +">>> import _asyncio\n" +">>> _asyncio\n" +"\n" +">>> _asyncio.__file__\n" +"'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" +msgstr "" + +#: using/configure.rst:1375 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -1114,303 +2046,309 @@ msgid "" "dynamic libraries." msgstr "" -#: using/configure.rst:787 +#: using/configure.rst:1379 msgid "" "The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` and :c:macro:" "`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are defined differently " "depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:" msgstr "" -#: using/configure.rst:791 +#: using/configure.rst:1383 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "" -#: using/configure.rst:792 +#: using/configure.rst:1384 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "" -#: using/configure.rst:794 +#: using/configure.rst:1386 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" -#: using/configure.rst:800 +#: using/configure.rst:1392 msgid "Compiler and linker flags" msgstr "" -#: using/configure.rst:802 +#: using/configure.rst:1394 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: using/configure.rst:806 +#: using/configure.rst:1398 msgid "Preprocessor flags" msgstr "" -#: using/configure.rst:810 +#: using/configure.rst:1402 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: using/configure.rst:816 +#: using/configure.rst:1408 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" -#: using/configure.rst:1009 +#: using/configure.rst:1601 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value to be able to build extension modules using the directories specified " "in the environment variables." msgstr "" -#: using/configure.rst:829 +#: using/configure.rst:1421 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: using/configure.rst:831 +#: using/configure.rst:1423 msgid "" "Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " "$(CPPFLAGS)``." msgstr "" -#: using/configure.rst:836 +#: using/configure.rst:1428 msgid "Compiler flags" msgstr "" -#: using/configure.rst:840 -msgid "C compiler command." -msgstr "" - -#: using/configure.rst:842 +#: using/configure.rst:1434 msgid "Example: ``gcc -pthread``." msgstr "" -#: using/configure.rst:846 +#: using/configure.rst:1438 msgid "C++ compiler command." msgstr "" -#: using/configure.rst:848 +#: using/configure.rst:1440 msgid "Example: ``g++ -pthread``." msgstr "" -#: using/configure.rst:852 -msgid "C compiler flags." -msgstr "" - -#: using/configure.rst:856 +#: using/configure.rst:1448 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " "extensions. Use it when a compiler flag should *not* be part of :envvar:" "`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: using/configure.rst:860 +#: using/configure.rst:1452 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: using/configure.rst:862 +#: using/configure.rst:1454 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " "The ``-I`` flags are processed from left to right, and any flags in :envvar:" "`CFLAGS` would take precedence over user- and package-supplied ``-I`` flags." msgstr "" -#: using/configure.rst:867 +#: using/configure.rst:1459 msgid "" "hardening flags such as ``-Werror`` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: using/configure.rst:875 +#: using/configure.rst:1467 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" -#: using/configure.rst:882 +#: using/configure.rst:1474 msgid "Extra C compiler flags." msgstr "" -#: using/configure.rst:886 +#: using/configure.rst:1478 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: using/configure.rst:893 +#: using/configure.rst:1485 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: using/configure.rst:900 +#: using/configure.rst:1492 msgid "Base compiler flags." msgstr "" -#: using/configure.rst:904 +#: using/configure.rst:1496 msgid "Optimization flags." msgstr "" -#: using/configure.rst:908 +#: using/configure.rst:1500 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: using/configure.rst:914 +#: using/configure.rst:1506 msgid "Compiler flags used to build a shared library." msgstr "" -#: using/configure.rst:916 +#: using/configure.rst:1508 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "" -#: using/configure.rst:920 +#: using/configure.rst:1512 msgid "Extra C flags added for building the interpreter object files." msgstr "" -#: using/configure.rst:922 +#: using/configure.rst:1514 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" -#: using/configure.rst:927 +#: using/configure.rst:1519 msgid "" "Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " "$(EXTRA_CFLAGS)``." msgstr "" -#: using/configure.rst:931 +#: using/configure.rst:1523 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" -#: using/configure.rst:937 +#: using/configure.rst:1529 msgid "C flags used for building the interpreter object files." msgstr "" -#: using/configure.rst:939 +#: using/configure.rst:1531 msgid "" "Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " "$(CFLAGSFORSHARED)``." msgstr "" -#: using/configure.rst:945 +#: using/configure.rst:1537 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." msgstr "" -#: using/configure.rst:951 +#: using/configure.rst:1543 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: using/configure.rst:954 +#: using/configure.rst:1546 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." msgstr "" -#: using/configure.rst:960 +#: using/configure.rst:1552 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: using/configure.rst:962 +#: using/configure.rst:1554 msgid "Default: empty string (not used)." msgstr "" -#: using/configure.rst:966 +#: using/configure.rst:1558 msgid "Linker flags" msgstr "" -#: using/configure.rst:970 +#: using/configure.rst:1562 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: using/configure.rst:972 +#: using/configure.rst:1564 msgid "Default: ``$(PURIFY) $(CC)``." msgstr "" -#: using/configure.rst:976 +#: using/configure.rst:1568 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: using/configure.rst:978 +#: using/configure.rst:1570 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: using/configure.rst:986 +#: using/configure.rst:1578 msgid "" ":envvar:`LDFLAGS_NODIST` is used in the same manner as :envvar:" "`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of :envvar:" "`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: using/configure.rst:990 +#: using/configure.rst:1582 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: using/configure.rst:992 +#: using/configure.rst:1584 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" "L`` flags are processed from left to right, and any flags in :envvar:" "`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags." msgstr "" -#: using/configure.rst:999 +#: using/configure.rst:1591 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: using/configure.rst:1006 +#: using/configure.rst:1598 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" -#: using/configure.rst:1015 +#: using/configure.rst:1607 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: using/configure.rst:1018 +#: using/configure.rst:1610 msgid "Example: ``-lrt``." msgstr "" -#: using/configure.rst:1022 +#: using/configure.rst:1614 msgid "Command to build a shared library." msgstr "" -#: using/configure.rst:1024 +#: using/configure.rst:1616 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "" -#: using/configure.rst:1028 +#: using/configure.rst:1620 msgid "Command to build ``libpython`` shared library." msgstr "" -#: using/configure.rst:1030 +#: using/configure.rst:1622 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "" -#: using/configure.rst:1034 +#: using/configure.rst:1626 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "" -#: using/configure.rst:1038 +#: using/configure.rst:1630 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "" -#: using/configure.rst:1044 +#: using/configure.rst:1636 msgid "Linker flags used for building the interpreter object files." msgstr "" + +#: using/configure.rst:1642 +msgid "Footnotes" +msgstr "" + +#: using/configure.rst:1643 +msgid "" +"``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " +"It removes all files not known to Git. When bug hunting using ``git " +"bisect``, this is `recommended between probes `_ to guarantee a completely " +"clean build. **Use with care**, as it will delete all files not checked into " +"Git, including your new, uncommitted work." +msgstr "" diff --git a/using/editors.po b/using/editors.po index 4cca1ffd..d9145310 100644 --- a/using/editors.po +++ b/using/editors.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-04-05 19:20+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: using/editors.rst:7 msgid "Editors and IDEs" -msgstr "" +msgstr "Επεξεργαστές Κειμένου και IDEs" #: using/editors.rst:9 msgid "" @@ -26,10 +27,42 @@ msgid "" "editors and IDEs provide syntax highlighting, debugging tools, and :pep:`8` " "checks." msgstr "" +"Υπάρχουν αρκετά IDEs που υποστηρίζουν τη γλώσσα προγραμματισμού Python. " +"Αρκετοί επεξεργαστές κειμένου και IDEs παρέχουν επισήμανση σύνταξης, " +"εργαλεία αποσφαλμάτωσης και ελέγχους :pep:`8`." + +#: using/editors.rst:14 +msgid "IDLE --- Python editor and shell" +msgstr "IDLE --- Επεξεργαστής και shell της Python" + +#: using/editors.rst:16 +msgid "" +"IDLE is Python’s Integrated Development and Learning Environment and is " +"generally bundled with Python installs. If you are on Linux and do not have " +"IDLE installed see :ref:`Installing IDLE on Linux " +"`. For more information see the :ref:`IDLE docs " +"`." +msgstr "" +"Το IDLE είναι το Ολοκληρωμένο Περιβάλλον Ανάπτυξης και Εκμάθησης της Python " +"και γενικά συνοδεύει τις εγκαταστάσεις της Python. Αν χρησιμοποιείτε Linux " +"και δεν έχετε εγκατεστημένο το IDLE δείτε :ref:`Installing IDLE on Linux " +"`. Για περισσότερες πληροφορίες δείτε το :ref:" +"`IDLE docs `." + +#: using/editors.rst:22 +msgid "Other Editors and IDEs" +msgstr "Άλλοι Επεξεργαστές Κειμένου και IDEs" -#: using/editors.rst:12 +#: using/editors.rst:24 msgid "" -"Please go to `Python Editors `_ " -"and `Integrated Development Environments `_ for a comprehensive list." +"Python's community wiki has information submitted by the community on " +"Editors and IDEs. Please go to `Python Editors `_ and `Integrated Development Environments `_ for a comprehensive " +"list." msgstr "" +"Το wiki της κοινότητας της Python έχει πληροφορίες που έχουν υποβληθεί από " +"την κοινότητα σχετικά με τους επεξεργαστές κειμένου και IDEs. Παρακαλούμε " +"μεταβείτε στο `Python Editors `_ " +"και `Integrated Development Environments `_ για ένα πλήρη κατάλογο." diff --git a/using/index.po b/using/index.po index a95bac09..ac85e9d6 100644 --- a/using/index.po +++ b/using/index.po @@ -8,17 +8,18 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-04-06 10:11+0300\n" +"Last-Translator: ALEXANDROS TZIORAS alextzioras23@gmail.com\n" +"Language-Team: Language-Team: PyGreece Language: \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: using/index.rst:5 msgid "Python Setup and Usage" -msgstr "" +msgstr "Ρύθμιση και Χρήση της Python" #: using/index.rst:8 msgid "" @@ -26,3 +27,7 @@ msgid "" "setup of the Python environment on different platforms, the invocation of " "the interpreter and things that make working with Python easier." msgstr "" +"Αυτό το μέρος της τεκμηρίωσης είναι αφιερωμένο σε γενικές πληροφορίες " +"σχετικά με τη ρύθμιση του περιβάλλοντος της Python σε διαφορετικές " +"πλατφόρμες, την εκκίνηση του διερμηνέα και πράγματα που κάνουν το να " +"δουλεύεις με την Python ευκολότερα." diff --git a/using/ios.po b/using/ios.po new file mode 100644 index 00000000..ff308b9f --- /dev/null +++ b/using/ios.po @@ -0,0 +1,876 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-06-24 23:36+0300\n" +"Last-Translator: Panagiotis Skias \n" +"Language-Team: PyGreece \n" +"Language: el\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: using/ios.rst:5 +msgid "Using Python on iOS" +msgstr "Χρήση Python σε iOS" + +#: using/ios.rst:0 +msgid "Authors" +msgstr "Συγγραφείς" + +#: using/ios.rst:8 +msgid "Russell Keith-Magee (2024-03)" +msgstr "Russell Keith-Magee (2024-03)" + +#: using/ios.rst:10 +msgid "" +"Python on iOS is unlike Python on desktop platforms. On a desktop platform, " +"Python is generally installed as a system resource that can be used by any " +"user of that computer. Users then interact with Python by running a :program:" +"`python` executable and entering commands at an interactive prompt, or by " +"running a Python script." +msgstr "" +"Η Python σε iOS διαφέρει από την Python σε πλατφόρμες επιτραπέζιων " +"υπολογιστών. Σε μια πλατφόρμα επιτραπέζιων υπολογιστών, η Python " +"εγκαθίσταται γενικά ως πόρος συστήματος που μπορεί να χρησιμοποιηθεί από " +"οποιονδήποτε χρήστη αυτού του υπολογιστή. Στη συνέχεια, οι χρήστες " +"αλληλεπιδρούν με την Python εκτελώντας ένα εκτελέσιμο αρχείο :program:" +"`python` και εισάγοντας εντολές σε μια διαδραστική γραμμή εντολών ή " +"εκτελώντας ένα Python script." + +#: using/ios.rst:16 +msgid "" +"On iOS, there is no concept of installing as a system resource. The only " +"unit of software distribution is an \"app\". There is also no console where " +"you could run a :program:`python` executable, or interact with a Python REPL." +msgstr "" +"Στο iOS, δεν υπάρχει η έννοια της εγκατάστασης ως πόρου συστήματος. Η μόνη " +"μονάδα διανομής λογισμικού είναι μια \"εφαρμογή\". Επίσης, δεν υπάρχει " +"κονσόλα που θα μπορούσατε να εκτελέσετε ένα εκτελέσιμο αρχείο :program:" +"`python` ή να αλληλεπιδράσετε με ένα Python REPL." + +#: using/ios.rst:20 +msgid "" +"As a result, the only way you can use Python on iOS is in embedded mode - " +"that is, by writing a native iOS application, and embedding a Python " +"interpreter using ``libPython``, and invoking Python code using the :ref:" +"`Python embedding API `. The full Python interpreter, the " +"standard library, and all your Python code is then packaged as a standalone " +"bundle that can be distributed via the iOS App Store." +msgstr "" +"Ως αποτέλεσμα, ο μόνος τρόπος για να χρησιμοποιήσετε την Python σε iOS είναι " +"σε ενσωματωμένη λειτουργία - δηλαδή, γράφοντας μια εγγενή εφαρμογή iOS και " +"ενσωματώνοντας έναν διερμηνέα Python χρησιμοποιώντας το ``libPython``, και " +"καλώντας κώδικα Python χρησιμοποιώντας το :ref:`Python embedding API " +"`. Ο πλήρης διερμηνέας Python, η τυπική βιβλιοθήκη και όλος ο " +"κώδικας Python σας συσκευάζονται στην συνέχεια ως αυτόνομο πακέτο που μπορεί " +"να διανεμηθεί μέσω του iOS App Store." + +#: using/ios.rst:27 +msgid "" +"If you're looking to experiment for the first time with writing an iOS app " +"in Python, projects such as `BeeWare `__ and `Kivy " +"`__ will provide a much more approachable user experience. " +"These projects manage the complexities associated with getting an iOS " +"project running, so you only need to deal with the Python code itself." +msgstr "" +"Αν θέλετε να πειραματιστείτε για πρώτη φορά με τη σύνταξη μιας εφαρμογής iOS " +"σε Python, έργα όπως `BeeWare `__ και `Kivy `__ θα σας προσφέρουν μια πολύ πιο προσιτή εμπειρία χρήστη. Αυτά τα " +"έργα διαχειρίζονται τις πολυπλοκότητες που σχετίζονται με την εκτέλεση ενός " +"έργου iOS, επομένως χρειάζεται να ασχοληθείτε μόνο με τον ίδιο τον κώδικα " +"Python." + +#: using/ios.rst:34 +msgid "Python at runtime on iOS" +msgstr "Python κατά τον χρόνο εκτέλεσης σε iOS" + +#: using/ios.rst:37 +msgid "iOS version compatibility" +msgstr "Συμβατότητα έκδοσης iOS" + +#: using/ios.rst:39 +msgid "" +"The minimum supported iOS version is specified at compile time, using the :" +"option:`--host` option to ``configure``. By default, when compiled for iOS, " +"Python will be compiled with a minimum supported iOS version of 13.0. To use " +"a different minimum iOS version, provide the version number as part of the :" +"option:`!--host` argument - for example, ``--host=arm64-apple-ios15.4-" +"simulator`` would compile an ARM64 simulator build with a deployment target " +"of 15.4." +msgstr "" +"Η ελάχιστη υποστηριζόμενη έκδοση iOS καθορίζεται κατά τη στιγμή της " +"μεταγλώττισης, χρησιμοποιώντας την επιλογή :option:`--host` για τη " +"``ρύθμιση`` παραμέτρων. Από προεπιλογή, όταν μεταγλωττίζεται για iOS, η " +"Python θα μεταγλωττίζεται με μια ελάχιστη υποστηριζόμενη έκδοση iOS 13.0. " +"Για να χρησιμοποιήστε μια διαφορετική ελάχιστη έκδοση iOS, δώστε τον αριθμό " +"έκδοσης ως μέρος του ορίσματος :option:`!--host` - για παράδειγμα, το ``--" +"host=arm64-apple-ios15.4-simulator`` θα μεταγλωττίσει μια έκδοση προσομοιωτή " +"ARM64 με στόχο ανάπτυξης 15.4." + +#: using/ios.rst:48 +msgid "Platform identification" +msgstr "Αναγνώριση πλατφόρμας" + +#: using/ios.rst:50 +msgid "" +"When executing on iOS, ``sys.platform`` will report as ``ios``. This value " +"will be returned on an iPhone or iPad, regardless of whether the app is " +"running on the simulator or a physical device." +msgstr "" +"Κατά την εκτέλεση σε iOS, το ``sys.platform`` θα αναφέρεται ως ``ios``. Αυτή " +"η τιμή θα επιστραφεί σε ένα iPhone ή iPad, ανεξάρτητα από το αν η εφαρμογή " +"εκτελείται στον προσομοιωτή ή σε μια φυσική συσκευή." + +#: using/ios.rst:54 +msgid "" +"Information about the specific runtime environment, including the iOS " +"version, device model, and whether the device is a simulator, can be " +"obtained using :func:`platform.ios_ver`. :func:`platform.system` will report " +"``iOS`` or ``iPadOS``, depending on the device." +msgstr "" +"Πληροφορίες σχετικά με το συγκεκριμένο περιβάλλον εκτέλεσης, " +"συμπεριλαμβανομένης της έκδοσης iOS, του μοντέλου συσκευής και του εάν η " +"συσκευή είναι προσομοιωτής, μπορούν να ληφθούν χρησιμοποιώντας την :func:" +"`platform.ios_ver`. Η :func:`platform.system` θα αναφέρει ``iOS`` ή " +"``iPadOS``, ανάλογα με τη συσκευή." + +#: using/ios.rst:59 +msgid "" +":func:`os.uname` reports kernel-level details; it will report a name of " +"``Darwin``." +msgstr "" +"Η :func:`os.uname` αναφέρει λεπτομέρειες σε επίπεδο πυρήνα∙ θα αναφέρει ένα " +"όνομα ``Darwin``." + +#: using/ios.rst:63 +msgid "Standard library availability" +msgstr "Διαθεσιμότητα τυπικής βιβλιοθήκης" + +#: using/ios.rst:65 +msgid "" +"The Python standard library has some notable omissions and restrictions on " +"iOS. See the :ref:`API availability guide for iOS ` for " +"details." +msgstr "" +"Η τυπική βιβλιοθήκη Python έχει κάποιες αξιοσημείωτες παραλείψεις και " +"περιορισμούς στο iOS. Δείτε στον οδηγό διαθεσιμότητας :ref:`API availability " +"guide for iOS ` για λεπτομέρειες." + +#: using/ios.rst:70 +msgid "Binary extension modules" +msgstr "Δυαδικά modules επέκτασης" + +#: using/ios.rst:72 +msgid "" +"One notable difference about iOS as a platform is that App Store " +"distribution imposes hard requirements on the packaging of an application. " +"One of these requirements governs how binary extension modules are " +"distributed." +msgstr "" +"Μια αξιοσημείωτη διαφορά σχετικά με το iOS ως πλατφόρμα είναι ότι η διανομή " +"του App Store επιβάλλει αυστηρές απαιτήσεις σχετικά με τη συσκευασία μιας " +"εφαρμογής. Μία από αυτές τις απαιτήσεις διέπει τον τρόπο διανομής των " +"δυαδικών modules επέκτασης." + +#: using/ios.rst:76 +msgid "" +"The iOS App Store requires that *all* binary modules in an iOS app must be " +"dynamic libraries, contained in a framework with appropriate metadata, " +"stored in the ``Frameworks`` folder of the packaged app. There can be only a " +"single binary per framework, and there can be no executable binary material " +"outside the ``Frameworks`` folder." +msgstr "" +"Το iOS App Store απαιτεί από *όλα* τα δυαδικά modules σε μια εφαρμογή iOS να " +"είναι δυναμικές βιβλιοθήκες, που να περιέχονται σε ένα πλαίσιο με κατάλληλα " +"μεταδεδομένα, αποθηκευμένα στον φάκελο ``Frameworks`` της συσκευασμένης " +"εφαρμογής. Μπορεί να υπάρχει μόνο ένα δυαδικό αρχείο ανά πλαίσιο, και δεν " +"μπορεί να υπάρχει εκτελέσιμο υλικό εκτός του φακέλου ``Frameworks``." + +#: using/ios.rst:82 +msgid "" +"This conflicts with the usual Python approach for distributing binaries, " +"which allows a binary extension module to be loaded from any location on " +"``sys.path``. To ensure compliance with App Store policies, an iOS project " +"must post-process any Python packages, converting ``.so`` binary modules " +"into individual standalone frameworks with appropriate metadata and signing. " +"For details on how to perform this post-processing, see the guide for :ref:" +"`adding Python to your project `." +msgstr "" +"Αυτό έρχεται σε αντίθεση με τη συνήθη προσέγγιση Python για τη διανομή " +"δυαδικών αρχείων, η οποία επιτρέπει τη φόρτωση μιας δυαδικής επέκτασης " +"module από οποιαδήποτε τοποθεσία στο ``sys.path``. Για να διασφαλιστεί η " +"συμμόρφωση με τις πολιτικές του App Store, ένα ενεργό iOS πρέπει να " +"επεξεργαστεί εκ των υστέρων τυχόν πακέτα Python, μετατρέποντας τις δυαδικές " +"μονάδες ``.so`` σε μεμονωμένα αυτόνομα πλαίσια με κατάλληλα μεταδεδομένα και " +"υπογραφή. Για λεπτομέρειες σχετικά με τον τρόπο εκτέλεσης αυτή της μετα-" +"επεξεργασίας, ανατρέξτε στον οδηγό :ref:`adding Python to your project " +"`." + +#: using/ios.rst:90 +msgid "" +"To help Python discover binaries in their new location, the original ``.so`` " +"file on ``sys.path`` is replaced with a ``.fwork`` file. This file is a text " +"file containing the location of the framework binary, relative to the app " +"bundle. To allow the framework to resolve back to the original location, the " +"framework must contain a ``.origin`` file that contains the location of the " +"``.fwork`` file, relative to the app bundle." +msgstr "" +"Για να βοηθηθεί η Python στην ανακάλυψη δυαδικών αρχείων στη νέα τους θέση, " +"το αρχικό αρχείο ``.so`` στο ``sys.path`` αντικαθίσταται με ένα αρχείο ``." +"fwork``. Αυτό το αρχείο είναι ένα αρχείο κειμένου που περιέχει τη θέση του " +"δυαδικού αρχείου του framework, σε σχέση με το app bundle. Για να επιτραπεί " +"στο framework να επιστρέψει στην αρχική του θέση, το framework πρέπει να " +"περιέχει ένα αρχείο ``.origin`` που περιέχει τη θέση του αρχείου ``.fwork``, " +"σε σχέση με το app bundle." + +#: using/ios.rst:97 +msgid "" +"For example, consider the case of an import ``from foo.bar import _whiz``, " +"where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" +"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." +"path``, relative to the application bundle. This module *must* be " +"distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " +"(creating the framework name from the full import path of the module), with " +"an ``Info.plist`` file in the ``.framework`` directory identifying the " +"binary as a framework. The ``foo.bar._whiz`` module would be represented in " +"the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " +"file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " +"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." +"_whiz.origin``, containing the path to the ``.fwork`` file." +msgstr "" +"Για παράδειγμα, εξετάστε την περίπτωση μιας εντολής εισαγωγής ``from foo.bar " +"import _whiz``, όπου το ``_whiz`` υλοποιείται με το δυαδικό module ``sources/" +"foo/bar/_whiz.abi3.so``, με το ``sources`` να είναι η τοποθεσία που έχει " +"καταχωρηθεί στο ``sys.path``, σε σχέση με το bundle της εφαρμογής. Αυτό το " +"module *πρέπει* να διανεμηθεί ως ``Frameworks/foo.bar._whiz.framework/foo." +"bar._whiz`` (δημιουργώντας το όνομα του framework από την πλήρη διαδρομή " +"εισαγωγής του module), με ένα αρχείο ``Info.plist`` στον φάκελο ``." +"framework`` που να ταυτοποιεί το δυαδικό ως framework. Το module ``foo.bar." +"_whiz`` θα εκπροσωπείται στην αρχική του τοποθεσία με ένα αρχείο δείκτη " +"``sources/foo/bar/_whiz.abi3.fwork``, το οποίο περιέχει τη διαδρομή " +"``Frameworks/foo.bar._whiz/foo.bar._whiz``. Το framework θα περιέχει επίσης " +"το ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz.origin``, το οποίο " +"περιέχει τη διαδρομή προς το αρχείο ``.fwork``." + +#: using/ios.rst:110 +msgid "" +"When running on iOS, the Python interpreter will install an :class:" +"`~importlib.machinery.AppleFrameworkLoader` that is able to read and import " +"``.fwork`` files. Once imported, the ``__file__`` attribute of the binary " +"module will report as the location of the ``.fwork`` file. However, the :" +"class:`~importlib.machinery.ModuleSpec` for the loaded module will report " +"the ``origin`` as the location of the binary in the framework folder." +msgstr "" +"Κατά την εκτέλεση σε iOS, ο διερμηνέας της Python θα εγκαταστήσει μια :class:" +"`~importlib.machinery.AppleFrameworkLoader`, η οποία μπορεί να διαβάζει και " +"να εισάγει αρχεία ``.fwork``. Μόλις εισαχθεί, το χαρακτηριστικό ``__file__`` " +"του δυαδικού module θα αναφέρει ως τοποθεσία το αρχείο ``.fwork``. Ωστόσο, " +"η :class:`~importlib.machinery.ModuleSpec` για το φορτωμένο module θα " +"αναφέρει ως ``origin`` την τοποθεσία του δυαδικού αρχείου στον φάκελο του " +"framework." + +#: using/ios.rst:118 +msgid "Compiler stub binaries" +msgstr "Δυαδικά αρχεία προσομοίωσης μεταγλωττιστή" + +#: using/ios.rst:120 +msgid "" +"Xcode doesn't expose explicit compilers for iOS; instead, it uses an " +"``xcrun`` script that resolves to a full compiler path (e.g., ``xcrun --sdk " +"iphoneos clang`` to get the ``clang`` for an iPhone device). However, using " +"this script poses two problems:" +msgstr "" +"Το Xcode δεν παρέχει άμεσα ξεχωριστούς μεταγλωττιστές για iOS· αντ’ αυτού, " +"χρησιμοποιεί ένα script ``xcrun`` που επιλύει την πλήρη διαδρομή του " +"μεταγλωττιστή (π.χ. ``xcrun --sdk iphoneos clang`` για να πάρετε τον " +"``clang`` για μια συσκευή iPhone). Ωστόσο, η χρήση αυτού του script " +"δημιουργεί δύο προβλήματα:" + +#: using/ios.rst:125 +msgid "" +"The output of ``xcrun`` includes paths that are machine specific, resulting " +"in a sysconfig module that cannot be shared between users; and" +msgstr "" +"Η έξοδος του ``xcrun`` περιλαμβάνει διαδρομές που εξαρτώνται από τη " +"συγκεκριμένη μηχανή, με αποτέλεσμα ένα module sysconfig να μην μπορεί να " +"κοινοποιηθεί μεταξύ διαφορετικών χρηστών· και" + +#: using/ios.rst:128 +msgid "" +"It results in ``CC``/``CPP``/``LD``/``AR`` definitions that include spaces. " +"There is a lot of C ecosystem tooling that assumes that you can split a " +"command line at the first space to get the path to the compiler executable; " +"this isn't the case when using ``xcrun``." +msgstr "" +"Αυτό έχει ως αποτέλεσμα οι ορισμοί των ``CC``/``CPP``/``LD``/``AR`` να " +"περιλαμβάνουν κενά. Υπάρχουν πολλά εργαλεία στο οικοσύστημα της C που " +"υποθέτουν ότι η εντολή μπορεί να χωριστεί στον πρώτο κενό χαρακτήρα ώστε να " +"βρεθεί η διαδρομή προς το εκτελέσιμο του μεταγλωττιστή∙ κάτι που δεν ισχύει " +"όταν χρησιμοποιείται το ``xcrun``." + +#: using/ios.rst:133 +msgid "" +"To avoid these problems, Python provided stubs for these tools. These stubs " +"are shell script wrappers around the underingly ``xcrun`` tools, distributed " +"in a ``bin`` folder distributed alongside the compiled iOS framework. These " +"scripts are relocatable, and will always resolve to the appropriate local " +"system paths. By including these scripts in the bin folder that accompanies " +"a framework, the contents of the ``sysconfig`` module becomes useful for end-" +"users to compile their own modules. When compiling third-party Python " +"modules for iOS, you should ensure these stub binaries are on your path." +msgstr "" +"Για να αποφευχθούν αυτά τα προβλήματα, η Python παρέχει stubs για αυτά τα " +"εργαλεία. Αυτά τα stubs είναι wrapper scripts κελύφους που τυλίγουν τα " +"υποκείμενα εργαλεία του ``xcrun``, και διανέμονται σε έναν φάκελο ``bin`` " +"μαζί με το μεταγλωττισμένο iOS framework. Αυτά τα scripts μπορούν να " +"προσαρμοστούν σε διαφορετικές τοποθεσίες, και πάντα θα δείχνουν στις σωστές " +"τοπικές διαδρομές του συστήματος. Συμπεριλαμβάνοντας αυτά τα scripts στο " +"φάκελο bin που συνοδεύει ένα framework, το περιεχόμενο του module " +"``sysconfig`` γίνεται χρήσιμο για τους τελικούς χρήστες, ώστε να μπορούν να " +"μεταγλωττίζουν τα δικά τους modules. Όταν μεταγλωττίζετε τρίτα modules " +"Python για iOS, πρέπει να βεβαιωθείτε ότι αυτά τα stub binaries είναι στο " +"path σας." + +#: using/ios.rst:143 +msgid "Installing Python on iOS" +msgstr "Εγκατάσταση της Python σε iOS" + +#: using/ios.rst:146 +msgid "Tools for building iOS apps" +msgstr "Εργαλεία για την κατασκευή εφαρμογών iOS" + +#: using/ios.rst:148 +msgid "" +"Building for iOS requires the use of Apple's Xcode tooling. It is strongly " +"recommended that you use the most recent stable release of Xcode. This will " +"require the use of the most (or second-most) recently released macOS " +"version, as Apple does not maintain Xcode for older macOS versions. The " +"Xcode Command Line Tools are not sufficient for iOS development; you need a " +"*full* Xcode install." +msgstr "" +"Η κατασκευή εφαρμογών για iOS απαιτεί τη χρήση των εργαλείων Xcode της Apple." +"Συνιστάται έντονα να χρησιμοποιείτε την πιο πρόσφατη σταθερή έκδοση του " +"Xcode. Αυτό θα απαιτήσει να έχετε την πιο πρόσφατη (ή τη δεύτερη πιο " +"πρόσφατη) έκδοση του macOS, καθώς η Apple δεν υποστηρίζει παλαιότερες " +"εκδόσεις macOS με νέες εκδόσεις Xcode. Τα εργαλεία γραμμής εντολών Xcode δεν " +"επαρκούν για ανάπτυξη iOS∙ χρειάζεται μια *πλήρης* εγκατάσταση του Xcode." + +#: using/ios.rst:155 +msgid "" +"If you want to run your code on the iOS simulator, you'll also need to " +"install an iOS Simulator Platform. You should be prompted to select an iOS " +"Simulator Platform when you first run Xcode. Alternatively, you can add an " +"iOS Simulator Platform by selecting from the Platforms tab of the Xcode " +"Settings panel." +msgstr "" +"Αν θέλετε να τρέξετε τον κώδικά σας στον προσομοιωτή iOS, θα χρειαστεί " +"επίσης να εγκαταστήσετε μια Πλατφόρμα Προσομοίωσης iOS. Κατά την πρώτη " +"εκκίνηση του Xcode, θα σας ζητηθεί να επιλέξετε μια Πλατφόρμα Προσομοίωσης " +"iOS. Εναλλακτικά, μπορείτε να προσθέσετε μια Πλατφόρμα προσομοίωσηςiOS " +"επιλέγοντας την από την καρτέλα Platforms στο πάνελ ρυθμίσεων του Xcode." + +#: using/ios.rst:163 +msgid "Adding Python to an iOS project" +msgstr "Προσθήκη Python σε ένα έργο iOS" + +#: using/ios.rst:165 +msgid "" +"Python can be added to any iOS project, using either Swift or Objective C. " +"The following examples will use Objective C; if you are using Swift, you may " +"find a library like `PythonKit `__ to " +"be helpful." +msgstr "" +"Η Python μπορεί να προστεθεί σε οποιοδήποτε έργο iOS, χρησιμοποιώντας είτε " +"Swift είτε Objective C. Τα ακόλουθα παραδείγματα θα χρησιμοποιήσουν " +"Objective C∙ εάν χρησιμοποιείτε Swift, μπορεί να σας φανεί χρήσιμη μια " +"βιβλιοθήκη όπως το `PythonKit `__ ." + +#: using/ios.rst:170 +msgid "To add Python to an iOS Xcode project:" +msgstr "Για να προσθέσετε Python σε ένα έργο iOS Xcode:" + +#: using/ios.rst:172 +msgid "" +"Build or obtain a Python ``XCFramework``. See the instructions in :source:" +"`Apple/iOS/README.md` (in the CPython source distribution) for details on " +"how to build a Python ``XCFramework``. At a minimum, you will need a build " +"that supports ``arm64-apple-ios``, plus one of either ``arm64-apple-ios-" +"simulator`` or ``x86_64-apple-ios-simulator``." +msgstr "" +"Δημιουργήστε ή αποκτήστε ένα Python ``XCFramework``. Δείτε τις οδηγίες στο :" +"source:`iOS/README.rst` (στη διανομή πηγαίου κώδικα CPython) για " +"λεπτομέρειες σχετικά με τον τρόπο δημιουργίας ενός Python ``XCFramework``. " +"Κατ' ελάχιστον, θα χρειαστείτε μια έκδοση που υποστηρίζει το ``arm64-apple-" +"ios``, καθώς και ένα από τα ``arm64-apple-ios-simulator`` ή ``x86_64-apple-" +"ios-simulator``." + +#: using/ios.rst:178 +msgid "" +"Drag the ``XCframework`` into your iOS project. In the following " +"instructions, we'll assume you've dropped the ``XCframework`` into the root " +"of your project; however, you can use any other location that you want by " +"adjusting paths as needed." +msgstr "" +"Μεταφέρετε το ``XCframework`` στο iOS έργο σας. Στις ακόλουθες οδηγίες, θα " +"υποθέσουμε ότι έχετε αποθέσει το ``XCframework`` στη ρίζα του έργου σας " +"ωστόσο, μπορείτε να χρησιμοποιήσετε οποιαδήποτε άλλη τοποθεσία θέλετε " +"προσαρμόζοντας τις διαδρομές όπως απαιτείται." + +#: using/ios.rst:183 +msgid "" +"Add your application code as a folder in your Xcode project. In the " +"following instructions, we'll assume that your user code is in a folder " +"named ``app`` in the root of your project; you can use any other location by " +"adjusting paths as needed. Ensure that this folder is associated with your " +"app target." +msgstr "" +"Προσθέστε τον κώδικα της εφαρμογής σας ως φάκελο στο έργο σας στο Xcode. " +"Στις παρακάτω οδηγίες, θα υποθέσουμε ότι ο κώδικας του χρήστη βρίσκεται σε " +"έναν φάκελο με όνομα ``app`` στη ριζική τοποθεσία του έργου σας· μπορείτε να " +"χρησιμοποιήσετε οποιαδήποτε άλλη τοποθεσία, προσαρμόζοντας αναλόγως τις " +"διαδρομές. Βεβαιωθείτε ότι αυτός ο φάκελος έχει συσχετιστεί με τον στόχο " +"(target) της εφαρμογής σας." + +#: using/ios.rst:189 +msgid "" +"Select the app target by selecting the root node of your Xcode project, then " +"the target name in the sidebar that appears." +msgstr "" +"Επιλέξτε τον στόχο της εφαρμογής επιλέγοντας τον ριζικό κόμβο του έργου σας " +"στο Xcode και στη συνέχεια το όνομα του στόχου στην πλαϊνή στήλη που " +"εμφανίζεται." + +#: using/ios.rst:192 +msgid "" +"In the \"General\" settings, under \"Frameworks, Libraries and Embedded " +"Content\", add ``Python.xcframework``, with \"Embed & Sign\" selected." +msgstr "" +"Στις ρυθμίσεις \"General\" , κάτω από \"Frameworks, Libraries and Embedded " +"Content\", προσθέστε το ``Python.xcframework``, με επιλεγμένη την επιλογή " +"\"Embed & Sign\"" + +#: using/ios.rst:195 +msgid "In the \"Build Settings\" tab, modify the following:" +msgstr "Στην καρτέλα \"Build Settings\" , τροποποιήστε τα εξής" + +#: using/ios.rst:197 +msgid "Build Options" +msgstr "Build Options" + +#: using/ios.rst:199 +msgid "User Script Sandboxing: No" +msgstr "User Script Sandboxing: No" + +#: using/ios.rst:200 +msgid "Enable Testability: Yes" +msgstr "Enable Testability: Yes" + +#: using/ios.rst:202 +msgid "Search Paths" +msgstr "Search Paths" + +#: using/ios.rst:204 +msgid "Framework Search Paths: ``$(PROJECT_DIR)``" +msgstr "Framework Search Paths: ``$(PROJECT_DIR)``" + +#: using/ios.rst:205 +msgid "" +"Header Search Paths: ``\"$(BUILT_PRODUCTS_DIR)/Python.framework/Headers\"``" +msgstr "" +"Header Search Paths: ``\"$(BUILT_PRODUCTS_DIR)/Python.framework/Headers\"``" + +#: using/ios.rst:207 +msgid "Apple Clang - Warnings - All languages" +msgstr "Apple Clang - Warnings - All languages" + +#: using/ios.rst:209 +msgid "Quoted Include In Framework Header: No" +msgstr "Quoted Include In Framework Header: No" + +#: using/ios.rst:211 +msgid "" +"Add a build step that processes the Python standard library, and your own " +"Python binary dependencies. In the \"Build Phases\" tab, add a new \"Run " +"Script\" build step *before* the \"Embed Frameworks\" step, but *after* the " +"\"Copy Bundle Resources\" step. Name the step \"Process Python libraries\", " +"disable the \"Based on dependency analysis\" checkbox, and set the script " +"content to:" +msgstr "" +"Προσθέστε ένα βήμα κατασκευής που αντιγράφει τη βασική βιβλιοθήκη Python " +"στην εφαρμογή σας. Στην καρτέλα \"Build Phases\", προσθέστε ένα νέο βήμα " +"κατασκευής \"Run Script\" *πριν* από το βήμα \"Embed Frameworks\", αλλά " +"*μετά* το βήμα \"Copy Bundle Resources\". Ονομάστε το βήμα \"Install Target " +"Specific Python Standard Library\", απενεργοποιήστε το πλαίσιο επιλογής " +"\"Based on dependency analysis\" και ορίστε το περιεχόμενο του script ως " +"εξής:" + +#: using/ios.rst:218 +msgid "" +"set -e\n" +"source $PROJECT_DIR/Python.xcframework/build/build_utils.sh\n" +"install_python Python.xcframework app" +msgstr "" +"set -e\n" +"source $PROJECT_DIR/Python.xcframework/build/build_utils.sh\n" +"install_python Python.xcframework app" + +#: using/ios.rst:224 +msgid "" +"If you have placed your XCframework somewhere other than the root of your " +"project, modify the path to the first argument." +msgstr "" +"Εάν έχετε τοποθετήσει το XCframework κάπου αλλού εκτός από τη ρίζα του έργου " +"σας, τροποποιήστε τη διαδρομή στο πρώτο όρισμα." + +#: using/ios.rst:227 +msgid "" +"Add Objective C code to initialize and use a Python interpreter in embedded " +"mode. You should ensure that:" +msgstr "" +"Προσθέστε κώδικα Objective C για να αρχικοποιήσετε και να χρησιμοποιήσετε " +"έναν διερμηνέα Python σε ενσωματωμένη λειτουργία. Θα πρέπει να βεβαιωθείτε " +"ότι:" + +#: using/ios.rst:230 +msgid "UTF-8 mode (:c:member:`PyPreConfig.utf8_mode`) is *enabled*;" +msgstr "" +"Η λειτουργία UTF-8 (:c:member:`PyPreConfig.utf8_mode`) είναι " +"*ενεργοποιημένη* ∙" + +#: using/ios.rst:231 +msgid "Buffered stdio (:c:member:`PyConfig.buffered_stdio`) is *disabled*;" +msgstr "" +"Το Buffered stdio (:c:member:`PyConfig.buffered_stdio`) είναι " +"*απενεργοποιημένο* ∙" + +#: using/ios.rst:232 +msgid "Writing bytecode (:c:member:`PyConfig.write_bytecode`) is *disabled*;" +msgstr "" +"Η εγγραφή bytecode (:c:member:`PyConfig.write_bytecode`) είναι " +"*απενεργοποιημένη* ∙" + +#: using/ios.rst:233 +msgid "" +"Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;" +msgstr "" +"Οι χειριστές σημάτων (:c:member:`PyConfig.install_signal_handlers`) είναι " +"*ενεργοποιημένοι* ∙" + +#: using/ios.rst:234 +msgid "" +"System logging (:c:member:`PyConfig.use_system_logger`) is *enabled* " +"(optional, but strongly recommended; this is enabled by default);" +msgstr "" +"Η καταγραφή συστήματος (:c:member:`PyConfig.use_system_logger`) είναι " +"*ενεργοποιημένη* (προαιρετική, αλλά συνίσταται ανεπιφύλακτα∙ είναι " +"ενεργοποιημένη από προεπιλογή)∙" + +#: using/ios.rst:236 +msgid "" +":envvar:`PYTHONHOME` for the interpreter is configured to point at the " +"``python`` subfolder of your app's bundle; and" +msgstr "" +"Το :envvar:`PYTHONHOME` για τον διερμηνέα έχει ρυθμιστεί ώστε να δείχνει " +"στον υποφάκελο ``python`` της δέσμης της εφαρμογής σας∙ και" + +#: using/ios.rst:238 +msgid "The :envvar:`PYTHONPATH` for the interpreter includes:" +msgstr "Το :envvar:`PYTHONPATH` για τον διερμηνέα περιλαμβάνει:" + +#: using/ios.rst:240 +msgid "the ``python/lib/python3.X`` subfolder of your app's bundle," +msgstr "τον υποφάκελο ``python/lib/python3.X`` της δέσμης της εφαρμογής σας," + +#: using/ios.rst:241 +msgid "" +"the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and" +msgstr "" +"τον υποφάκελο ``python/lib/python3.X/lib-dynload`` της δέσμης της εφαρμογής " +"σας, και" + +#: using/ios.rst:242 +msgid "the ``app`` subfolder of your app's bundle" +msgstr "τον υποφάκελο ``app`` της δέσμης της εφαρμογής σας" + +#: using/ios.rst:244 +msgid "" +"Your app's bundle location can be determined using ``[[NSBundle mainBundle] " +"resourcePath]``." +msgstr "" +"Η τοποθεσία της εφαρμογής σας στο πακέτο μπορεί να προσδιοριστεί " +"χρησιμοποιώντας την εντολή ``[[NSBundle mainBundle] resourcePath]``." + +#: using/ios.rst:247 +msgid "" +"Steps 7 and 8 of these instructions assume that you have a single folder of " +"pure Python application code, named ``app``. If you have third-party binary " +"modules in your app, some additional steps will be required:" +msgstr "" +"Τα βήματα 7 και 8 αυτών των οδηγιών υποθέτουν ότι έχετε έναν μόνο φάκελο με " +"καθαρό κώδικα εφαρμογής Python, με όνομα ``app``. Εάν έχετε δυαδικά modules " +"τρίτων στην εφαρμογή σας, θα απαιτηθούν επιπλέον βήματα:" + +#: using/ios.rst:251 +msgid "" +"You need to ensure that any folders containing third-party binaries are " +"either associated with the app target, or are explicitly copied as part of " +"step 7. Step 7 should also purge any binaries that are not appropriate for " +"the platform a specific build is targeting (i.e., delete any device binaries " +"if you're building an app targeting the simulator)." +msgstr "" +"Πρέπει να βεβαιωθείτε ότι τυχόν φάκελοι που περιέχουν δυαδικά αρχεία τρίτων " +"είναι είτε συσχετισμένοι με τον στόχο της εφαρμογής είτε αντιγραμμένοι ως " +"μέρος του βήματος 7. Το βήμα 7 θα πρέπει επίσης να καθαρίσει τυχόν δυαδικά " +"αρχεία που δεν είναι κατάλληλα για την πλατφόρμα στην οποία στοχεύει μια " +"συγκεκριμένη έκδοση (δηλαδή, να διαγράψει τυχόν δυαδικά αρχεία συσκευής εάν " +"δημιουργείτε μια εφαρμογή που στοχεύει τον προσομοιωτή)." + +#: using/ios.rst:257 +msgid "" +"If you're using a separate folder for third-party packages, ensure that " +"folder is added to the end of the call to ``install_python`` in step 7, and " +"as part of the :envvar:`PYTHONPATH` configuration in step 8." +msgstr "" +"Εάν χρησιμοποιείτε ξεχωριστό φάκελο για πακέτα τρίτων, βεβαιωθείτε ότι ο " +"φάκελος προστίθεται στο τέλος της κλήσης προς το ``install_python`` στο βήμα " +"7, και ως μέρος της διαμόρφωσης :envvar:`PYTHONPATH` στο βήμα 8." + +#: using/ios.rst:261 +msgid "" +"If any of the folders that contain third-party packages will contain ``." +"pth`` files, you should add that folder as a *site directory* (using :meth:" +"`site.addsitedir`), rather than adding to :envvar:`PYTHONPATH` or :attr:`sys." +"path` directly." +msgstr "" +"Εάν οποιοιδήποτε από τους φακέλους που περιέχουν πακέτα τρίτων θα περιέχουν " +"αρχεία ``.pth``, θα πρέπει να προσθέσετε αυτόν τον φάκελο ως *site " +"directory* (χρησιμοποιώντας τη :meth:`site.addsitedir`), αντί να τον " +"προσθέσετε απευθείας στο :envvar:`PYTHONPATH` ή στο :attr:`sys.path`." + +#: using/ios.rst:267 +msgid "Testing a Python package" +msgstr "Δοκιμή ενός πακέτου Python" + +#: using/ios.rst:269 +msgid "" +"The CPython source tree contains :source:`a testbed project ` that is used to run the CPython test suite on the iOS simulator. " +"This testbed can also be used as a testbed project for running your Python " +"library's test suite on iOS." +msgstr "" +"Το δένδρο πηγαίου κώδικα της CPython περιέχει το :source:`a testbed project " +"` που χρησιμοποιείται για την εκτέλεση της σουίτας δοκιμών " +"CPython στον προσομοιωτή iOS. Αυτό το δοκιμαστικό πλαίσιο μπορεί επίσης να " +"χρησιμοποιηθεί ως έργο δοκιμαστικής πλατφόρμας για την εκτέλεση της σουίτας " +"δοκιμών της βιβλιοθήκης Python σε iOS." + +#: using/ios.rst:273 +msgid "" +"After building or obtaining an iOS XCFramework (see :source:`Apple/iOS/" +"README.md` for details), create a clone of the Python iOS testbed project. " +"If you used the ``Apple`` build script to build the XCframework, you can run:" +msgstr "" +"Αφού δημιουργήσετε ή αποκτήσετε ένα iOS XCFramework (δείτε το :source:`iOS/" +"README.rst` για λεπτομέρειες), δημιουργήστε ένα κλώνο του έργου δοκιμαστικής " +"πλατφόρμας Python iOS. Εάν χρησιμοποιήσατε το script κατασκευής ``Apple`` " +"για να δημιουργήσετε το XCframework, μπορείτε να εκτελέσετε:" + +#: using/ios.rst:277 +msgid "" +"$ python cross-build/iOS/testbed clone --app --app app-testbed" +msgstr "" +"$ python cross-build/iOS/testbed clone --app --app app-testbed" + +#: using/ios.rst:281 +msgid "Or, if you've sourced your own XCframework, by running:" +msgstr "Ή, εάν έχετε δημιουργήσει το δικό σας XCframework, εκτελώντας:" + +#: using/ios.rst:283 +msgid "" +"$ python Apple/testbed clone --platform iOS --framework --app --app app-testbed" +msgstr "" +"$ python Apple/testbed clone --platform iOS --framework --app --app app-testbed" + +#: using/ios.rst:287 +msgid "" +"Any folders specified with the ``--app`` flag will be copied into the cloned " +"testbed project. The resulting testbed will be created in the ``app-" +"testbed`` folder. In this example, the ``module1`` and ``module2`` would be " +"importable modules at runtime. If your project has additional dependencies, " +"they can be installed into the ``app-testbed/Testbed/app_packages`` folder " +"(using ``pip install --target app-testbed/Testbed/app_packages`` or similar)." +msgstr "" +"Οποιοιδήποτε φάκελοι καθοριστούν με το flag ``--app`` θα αντιγραφούν στο " +"κλωνοποιημένο έργο testbed. Το τελικό testbed θα δημιουργηθεί στον φάκελο " +"``app-testbed``. Σε αυτό το παράδειγμα, τα ``module1`` και ``module2`` θα " +"είναι module που μπορούν να εισαχθούν κατά τον χρόνο εκτέλεσης. Αν το έργο " +"σας έχει επιπλέον εξαρτήσεις μπορείτε να τις εγκαταστήσετε στον φάκελο ``app-" +"testbed/Testbed/app_packages`` (χρησιμοποιώντας το ``pip install --target " +"app-testbed/Testbed/app_packages`` ή παρόμοια εντολή)." + +#: using/ios.rst:294 +msgid "" +"You can then use the ``app-testbed`` folder to run the test suite for your " +"app, For example, if ``module1.tests`` was the entry point to your test " +"suite, you could run:" +msgstr "" +"Μπορείτε στη συνέχεια να χρησιμοποιήσετε το φάκελο ``app-testbed`` για να " +"εκτελέσετε τη σουίτα δοκιμών για την εφαρμογή σας. Για παράδειγμα, εάν το " +"``module1.tests`` ήταν το σημείο εισόδου για τη σουίτα δοκιμών σας, θα " +"μπορούσατε να εκτελέσετε:" + +#: using/ios.rst:298 +msgid "$ python app-testbed run -- module1.tests" +msgstr "$ python app-testbed run -- module1.tests" + +#: using/ios.rst:302 +msgid "" +"This is the equivalent of running ``python -m module1.tests`` on a desktop " +"Python build. Any arguments after the ``--`` will be passed to the testbed " +"as if they were arguments to ``python -m`` on a desktop machine." +msgstr "" +"Αυτό ισοδυναμεί με την εκτέλεση της εντολής ``python -m module1.tests`` σε " +"μια έκδοση Python για επιτραπέζιους υπολογιστές. Οποιαδήποτε ορίσματα μετά " +"το ``--`` θα περαστούν στο testbed σαν να ήταν ορίσματα στην εντολή ``python " +"-m`` σε έναν επιτραπέζιο υπολογιστή." + +#: using/ios.rst:306 +msgid "You can also open the testbed project in Xcode by running:" +msgstr "" +"Μπορείτε επίσης να ανοίξετε το έργο δοκιμαστικής πλατφόρμας στο Xcode " +"εκτελώντας:" + +#: using/ios.rst:308 +msgid "$ open app-testbed/iOSTestbed.xcodeproj" +msgstr "$ open app-testbed/iOSTestbed.xcodeproj" + +#: using/ios.rst:312 +msgid "This will allow you to use the full Xcode suite of tools for debugging." +msgstr "" +"Αυτό θα σας επιτρέψει να χρησιμοποιήσετε την πλήρη σουίτα εργαλείων Xcode " +"για τον εντοπισμό σφαλμάτων." + +#: using/ios.rst:314 +msgid "" +"The arguments used to run the test suite are defined as part of the test " +"plan. To modify the test plan, select the test plan node of the project tree " +"(it should be the first child of the root node), and select the " +"\"Configurations\" tab. Modify the \"Arguments Passed On Launch\" value to " +"change the testing arguments." +msgstr "" +"Τα ορίσματα που χρησιμοποιούνται για την εκτέλεση της σουίτας δοκιμών " +"ορίζονται ως μέρος του σχεδίου δοκιμών. Για να τροποποιήσετε το σχέδιο " +"δοκιμών, επιλέξτε τον κόμβο του σχεδίου δοκιμών στο δέντρο του έργου (θα " +"πρέπει να είναι το πρώτο παιδί του ριζικού κόμβου) και επιλέξτε την καρτέλα " +"\"Configurations\". Τροποποιήστε την τιμή \"Arguments Passed On Launch\" για " +"να αλλάξετε τα ορίσματα δοκιμής." + +#: using/ios.rst:320 +msgid "" +"The test plan also disables parallel testing, and specifies the use of the " +"``Testbed.lldbinit`` file for providing configuration of the debugger. The " +"default debugger configuration disables automatic breakpoints on the " +"``SIGINT``, ``SIGUSR1``, ``SIGUSR2``, and ``SIGXFSZ`` signals." +msgstr "" +"Το σχέδιο δοκιμών απενεργοποιεί επίσης τις παράλληλες δοκιμές και καθορίζει " +"τη χρήση του αρχείου ``Testbed.lldbinit`` για την παροχή διαμόρφωσης του " +"αποσφαλματωτή. Η προεπιλεγμένη διαμόρφωση του αποσφαλματωτή απενεργοποιεί " +"τους αυτόματους σημερινούς σταθμούς (breakpoints) στα σήματα ``SIGINT``, " +"``SIGUSR1``, ``SIGUSR2``, και ``SIGXFSZ``." + +#: using/ios.rst:326 +msgid "App Store Compliance" +msgstr "Συμμόρφωση με το App Store" + +#: using/ios.rst:328 +msgid "" +"The only mechanism for distributing apps to third-party iOS devices is to " +"submit the app to the iOS App Store; apps submitted for distribution must " +"pass Apple's app review process. This process includes a set of automated " +"validation rules that inspect the submitted application bundle for " +"problematic code. There are some steps that must be taken to ensure that " +"your app will be able to pass these validation steps." +msgstr "" +"Ο μόνος μηχανισμός για τη διανομή εφαρμογών σε τρίτες συσκευές iOS είναι η " +"υποβολή της εφαρμογής στο iOS App Store∙ οι εφαρμογές που υποβάλλονται για " +"διανομή πρέπει να περάσουν τη διαδικασία αξιολόγησης εφαρμογών της Apple. " +"Αυτή η διαδικασία περιλαμβάνει ένα σύνολο αυτοματοποιημένων κανόνων " +"επικύρωσης που ελέγχουν τη δέσμη της υποβληθείσας εφαρμογής για προβληματικό " +"κώδικα. Υπάρχουν ορισμένα βήματα που πρέπει να ληφθούν για να διασφαλιστεί " +"ότι η εφαρμογή σας θα μπορεί να περάσει αυτά τα βήματα επικύρωσης." + +#: using/ios.rst:336 +msgid "Incompatible code in the standard library" +msgstr "Κώδικας ασύμβατος με την τυπική βιβλιοθήκη" + +#: using/ios.rst:338 +msgid "" +"The Python standard library contains some code that is known to violate " +"these automated rules. While these violations appear to be false positives, " +"Apple's review rules cannot be challenged; so, it is necessary to modify the " +"Python standard library for an app to pass App Store review." +msgstr "" +"Η τυπική βιβλιοθήκη Python περιέχει κώδικα που είναι γνωστό ότι παραβιάζει " +"αυτούς τους αυτοματοποιημένους κανόνες. Ενώ αυτές οι παραβιάσεις φαίνεται να " +"είναι ψευδώς θετικές, οι κανόνες αξιολόγησης της Apple δεν μπορούν να " +"αμφισβητηθούν∙ επομένως, είναι απαραίτητο να τροποποιήσετε την τυπική " +"βιβλιοθήκη Python για να περάσει μια εφαρμογή την αξιολόγηση του App Store." + +#: using/ios.rst:343 +msgid "" +"The Python source tree contains :source:`a patch file ` that will remove all code that is known to cause " +"issues with the App Store review process. This patch is applied " +"automatically when building for iOS." +msgstr "" +"Το δένδρο πηγαίου κώδικα της Python περιέχει :source:`a patch file ` που θα αφαιρέσει όλον τον κώδικα που " +"είναι γνωστό ότι προκαλεί προβλήματα με τη διαδικασία αξιολόγησης του App " +"Store. Αυτό το patch εφαρμόζεται αυτόματα κατά την κατασκευή για iOS." + +#: using/ios.rst:349 +msgid "Privacy manifests" +msgstr "Δηλώσεις απορρήτου" + +#: using/ios.rst:351 +msgid "" +"In April 2025, Apple introduced a requirement for `certain third-party " +"libraries to provide a Privacy Manifest `__. As a result, if you have a binary module " +"that uses one of the affected libraries, you must provide an ``.xcprivacy`` " +"file for that library. OpenSSL is one library affected by this requirement, " +"but there are others." +msgstr "" +"Τον Απρίλιο του 2025, η Apple εισήγαγε μια απαίτηση για `ορισμένες " +"βιβλιοθήκες τρίτων κατασκευαστών να παρέχουν μια Δήλωση Απορρήτου `__. Ως αποτέλεσμα, " +"εάν έχετε ένα δυαδικό module που χρησιμοποιεί μία από τις επηρεαζόμενες " +"βιβλιοθήκες, πρέπει να παρέχετε ένα αρχείο ``.xcprivacy`` για αυτήν τη " +"βιβλιοθήκη. Το OpenSSL είναι μία βιβλιοθήκη που επηρεάζεται από αυτήν την " +"απαίτηση, αλλά υπάρχουν και άλλες." + +#: using/ios.rst:358 +msgid "" +"If you produce a binary module named ``mymodule.so``, and use you the Xcode " +"build script described in step 7 above, you can place a ``mymodule." +"xcprivacy`` file next to ``mymodule.so``, and the privacy manifest will be " +"installed into the required location when the binary module is converted " +"into a framework." +msgstr "" +"Εάν παράγετε ένα δυαδικό module με το όνομα ``mymodule.so``, και " +"χρησιμοποιήσετε το script κατασκευής Xcode που περιγράφεται στο βήμα 8 " +"παραπάνω, μπορείτε να τοποθετήσετε ένα αρχείο ``mymodule.xcprivacy`` δίπλα " +"στο ``mymodule.so``, και η δήλωση απορρήτου θα εγκατασταθεί στην απαιτούμενη " +"τοποθεσία όταν το δυαδικό module μετατραπεί σε framework." diff --git a/using/mac.po b/using/mac.po index 81045948..3b80ae00 100644 --- a/using/mac.po +++ b/using/mac.po @@ -8,270 +8,1027 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Marios Giannopoulos \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: using/mac.rst:6 -msgid "Using Python on a Mac" +msgid "Using Python on macOS" +msgstr "Χρησιμοποιώντας Python σε macOS" + +#: using/mac.rst:11 +msgid "" +"This document aims to give an overview of macOS-specific behavior you should " +"know about to get started with Python on Mac computers. Python on a Mac " +"running macOS is very similar to Python on other Unix-derived platforms, but " +"there are some differences in installation and some features." msgstr "" +"Αυτό το έγγραφο αποσκοπεί στο να δώσει μια επισκόπηση της συμπεριφοράς που " +"σχετίζεται με το macOS που θα πρέπει να γνωρίζετε για να ξεκινήσετε με την " +"Python σε υπολογιστές Mac. Η Python σε Mac που εκτελεί macOS είναι πολύ " +"παρόμοια με την Python σε άλλες πλατφόρμες που προέρχονται από το Unix, αλλά " +"υπάρχουν κάποιες διαφορές στην εγκατάσταση και κάποιες δυνατότητες." -#: using/mac.rst:0 -msgid "Author" +#: using/mac.rst:16 +msgid "" +"There are various ways to obtain and install Python for macOS. Pre-built " +"versions of the most recent versions of Python are available from a number " +"of distributors. Much of this document describes use of the Pythons provided " +"by the CPython release team for download from the `python.org website " +"`_. See :ref:`alternative_bundles` for " +"some other options." msgstr "" +"Υπάρχουν διάφοροι τρόποι για να αποκτήσετε και να εγκαταστήσετε την Python " +"για macOS. Προκατασκευασμένες εκδόσεις των πιο πρόσφατων εκδόσεων της Python " +"είναι διαθέσιμες από έναν αριθμό διανομέων. Πολλές από αυτές τις πληροφορίες " +"περιγράφουν τη χρήση της Python που παρέχονται από την ομάδα κυκλοφορίας " +"CPython για λήψη από την ιστοσελίδα `python.org `_. Δείτε :ref:`alternative_bundles` για μερικές άλλες επιλογές." + +#: using/mac.rst:27 +msgid "Using Python for macOS from ``python.org``" +msgstr "Χρησιμοποιώντας Python για macOS από το ``python.org``" -#: using/mac.rst:8 -msgid "Bob Savage " +#: using/mac.rst:30 +msgid "Installation steps" +msgstr "Βήματα εγκατάστασης" + +#: using/mac.rst:32 +msgid "" +"For `current Python versions `_ (other " +"than those in ``security`` status), the release team produces a **Python for " +"macOS** installer package for each new release. A list of available " +"installers is available `here `_. " +"We recommend using the most recent supported Python version where possible. " +"Current installers provide a `universal2 binary `_ build of Python which runs natively on all Macs " +"(Apple Silicon and Intel) that are supported by a wide range of macOS " +"versions, currently typically from at least **macOS 10.15 Catalina** on." msgstr "" +"Για `τρέχουσες εκδόσεις Python `_ (εκτός " +"από αυτές που είναι σε κατάσταση ``security``), η ομάδα κυκλοφορίας παράγει " +"ένα **Python για macOS** πακέτο εγκατάστασης για κάθε νέα κυκλοφορία. Μια " +"λίστα διαθέσιμων εγκαταστατών είναι διαθέσιμη `εδώ `_. Συνιστούμε τη χρήση της πιο πρόσφατης υποστηριζόμενης " +"έκδοσης Python όπου είναι δυνατόν. Οι τρέχοντες εγκαταστάτες παρέχουν μια " +"`universal2 binary `_ έκδοση " +"της Python που εκτελείται εγγενώς σε όλους τους υπολογιστές Mac (Apple " +"Silicon και Intel) που υποστηρίζονται από μια ευρεία γκάμα εκδόσεων macOS, " +"αυτή τη στιγμή συνήθως από τουλάχιστον **macOS 10.15 Catalina** και μετά." -#: using/mac.rst:11 +#: using/mac.rst:44 msgid "" -"Python on a Mac running macOS is in principle very similar to Python on any " -"other Unix platform, but there are a number of additional features such as " -"the integrated development environment (IDE) and the Package Manager that " -"are worth pointing out." +"The downloaded file is a standard macOS installer package file (``.pkg``). " +"File integrity information (checksum, size, sigstore signature, etc) for " +"each file is included on the release download page. Installer packages and " +"their contents are signed and notarized with ``Python Software Foundation`` " +"Apple Developer ID certificates to meet `macOS Gatekeeper requirements " +"`_." msgstr "" +"Το αρχείο που κατεβάσατε είναι ένα τυπικό αρχείο πακέτου εγκατάστασης macOS " +"(``.pkg``). Οι πληροφορίες ακεραιότητας αρχείου (έλεγχος ταυτότητας, " +"μέγεθος, υπογραφή sigstore κ.λπ.) για κάθε αρχείο περιλαμβάνονται στη σελίδα " +"λήψης κυκλοφορίας. Τα πακέτα εγκατάστασης και το περιεχόμενό τους είναι " +"υπογεγραμμένα και επικυρωμένα με ``Python Software Foundation`` Apple " +"Developer ID πιστοποιητικά για να ικανοποιούν τις απαιτήσεις `macOS " +"Gatekeeper `_." -#: using/mac.rst:21 -msgid "Getting and Installing Python" +#: using/mac.rst:50 +msgid "" +"For a default installation, double-click on the downloaded installer package " +"file. This should launch the standard macOS Installer app and display the " +"first of several installer windows steps." msgstr "" +"Για μια τυπική εγκατάσταση, κάντε διπλό κλικ στο αρχείο πακέτου εγκατάστασης " +"που κατεβάσατε. Αυτό θα πρέπει να εκκινήσει την τυπική εφαρμογή εγκατάστασης " +"macOS και να εμφανίσει το πρώτο από αρκετά βήματα παραθύρου εγκατάστασης." -#: using/mac.rst:23 +#: using/mac.rst:56 msgid "" -"macOS used to come with Python 2.7 pre-installed between versions 10.8 and " -"`12.3 `_. You are invited to install the most " -"recent version of Python 3 from the `Python website `__. A current \"universal2 binary\" build of Python, which " -"runs natively on the Mac's new Apple Silicon and legacy Intel processors, is " -"available there." +"Clicking on the **Continue** button brings up the **Read Me** for this " +"installer. Besides other important information, the **Read Me** documents " +"which Python version is going to be installed and on what versions of macOS " +"it is supported. You may need to scroll through to read the whole file. By " +"default, this **Read Me** will also be installed in |" +"applications_python_version_literal| and available to read anytime." msgstr "" +"Κάνοντας κλικ στο κουμπί **Continue** εμφανίζεται το **Read Me** για αυτόν " +"τον εγκαταστάτη. Εκτός από άλλες σημαντικές πληροφορίες, το **Read Me** " +"καταγράφει ποια έκδοση Python πρόκειται να εγκατασταθεί και σε ποιες " +"εκδόσεις macOS υποστηρίζεται. Ίσως χρειαστεί να κάνετε κύλιση για να " +"διαβάσετε ολόκληρο το αρχείο. Από προεπιλογή, αυτό το **Read Me** θα " +"εγκατασταθεί επίσης στο |applications_python_version_literal| και θα είναι " +"διαθέσιμο για ανάγνωση οποιαδήποτε στιγμή." -#: using/mac.rst:30 -msgid "What you get after installing is a number of things:" +#: using/mac.rst:64 +msgid "" +"Clicking on **Continue** proceeds to display the license for Python and for " +"other included software. You will then need to **Agree** to the license " +"terms before proceeding to the next step. This license file will also be " +"installed and available to be read later." msgstr "" +"Κάνοντας κλικ στο **Continue** προχωρά στην εμφάνιση της άδειας για την " +"Python και για άλλο περιλαμβανόμενο λογισμικό. Στη συνέχεια θα χρειαστεί να " +"**Συμφωνήσετε** με τους όρους άδειας πριν προχωρήσετε στο επόμενο βήμα. Αυτό " +"το αρχείο άδειας θα εγκατασταθεί επίσης και θα είναι διαθέσιμο για ανάγνωση " +"αργότερα." -#: using/mac.rst:32 +#: using/mac.rst:71 msgid "" -"A |python_version_literal| folder in your :file:`Applications` folder. In " -"here you find IDLE, the development environment that is a standard part of " -"official Python distributions; and :program:`Python Launcher`, which handles " -"double-clicking Python scripts from the Finder." +"After the license terms are accepted, the next step is the **Installation " +"Type** display. For most uses, the standard set of installation operations " +"is appropriate." msgstr "" +"Αφού γίνουν αποδεκτοί οι όροι άδειας, το επόμενο βήμα είναι η εμφάνιση " +"**Τύπος Εγκατάστασης**. Για τις περισσότερες χρήσεις, το τυπικό σύνολο " +"λειτουργιών εγκατάστασης είναι κατάλληλο." -#: using/mac.rst:37 +#: using/mac.rst:76 msgid "" -"A framework :file:`/Library/Frameworks/Python.framework`, which includes the " -"Python executable and libraries. The installer adds this location to your " -"shell path. To uninstall Python, you can remove these three things. A " -"symlink to the Python executable is placed in :file:`/usr/local/bin/`." +"By pressing the **Customize** button, you can choose to omit or select " +"certain package components of the installer. Click on each package name to " +"see a description of what it installs. To also install support for the " +"optional free-threaded feature, see :ref:`install-freethreaded-macos`." msgstr "" +"Πατώντας το κουμπί **Customize**, μπορείτε να επιλέξετε να παραλείψετε ή να " +"επιλέξετε ορισμένα πακέτα του εγκαταστάτη. Κάντε κλικ σε κάθε όνομα πακέτου " +"για να δείτε μια περιγραφή του τι εγκαθιστά. Για να εγκαταστήσετε επίσης " +"υποστήριξη για την προαιρετική δυνατότητα χωρίς νήματα, δείτε :ref:`install-" +"freethreaded-macos`." -#: using/mac.rst:44 +#: using/mac.rst:84 msgid "" -"On macOS 10.8-12.3, the Apple-provided build of Python is installed in :file:" -"`/System/Library/Frameworks/Python.framework` and :file:`/usr/bin/python`, " -"respectively. You should never modify or delete these, as they are Apple-" -"controlled and are used by Apple- or third-party software. Remember that if " -"you choose to install a newer Python version from python.org, you will have " -"two different but functional Python installations on your computer, so it " -"will be important that your paths and usages are consistent with what you " -"want to do." +"In either case, clicking **Install** will begin the install process by " +"asking permission to install new software. A macOS user name with " +"``Administrator`` privilege is needed as the installed Python will be " +"available to all users of the Mac." msgstr "" +"Σε κάθε περίπτωση, κάνοντας κλικ στο **Install** θα ξεκινήσει η διαδικασία " +"εγκατάστασης ζητώντας άδεια για την εγκατάσταση νέου λογισμικού. Ένα όνομα " +"χρήστη macOS με ``Administrator`` δικαιώματα είναι απαραίτητο καθώς η " +"εγκατεστημένη Python θα είναι διαθέσιμη σε όλους τους χρήστες του Mac." -#: using/mac.rst:52 +#: using/mac.rst:88 +msgid "When the installation is complete, the **Summary** window will appear." +msgstr "" +"Όταν ολοκληρωθεί η εγκατάσταση, θα εμφανιστεί το παράθυρο **Περίληψη**." + +#: using/mac.rst:92 msgid "" -"IDLE includes a Help menu that allows you to access Python documentation. If " -"you are completely new to Python you should start reading the tutorial " -"introduction in that document." +"Double-click on the :command:`Install Certificates.command` icon or file in " +"the |applications_python_version_literal| window to complete the " +"installation." msgstr "" +"Διπλό κλικ στο εικονίδιο ή το αρχείο :command:`Install Certificates.command` " +"στο παράθυρο |applications_python_version_literal| για να ολοκληρώσετε την " +"εγκατάσταση." -#: using/mac.rst:56 +#: using/mac.rst:98 msgid "" -"If you are familiar with Python on other Unix platforms you should read the " -"section on running Python scripts from the Unix shell." +"This will open a temporary :program:`Terminal` shell window that will use " +"the new Python to download and install SSL root certificates for its use." msgstr "" +"Αυτό θα ανοίξει ένα προσωρινό παράθυρο κελύφους :program:`Terminal` που θα " +"χρησιμοποιήσει τη νέα Python για να κατεβάσει και να εγκαταστήσει ριζικούς " +"πιστοποιητικούς SSL για τη χρήση του." -#: using/mac.rst:61 -msgid "How to run a Python script" +#: using/mac.rst:104 +msgid "" +"If ``Successfully installed certifi`` and ``update complete`` appears in the " +"terminal window, the installation is complete. Close this terminal window " +"and the installer window." msgstr "" +"Εάν εμφανιστεί ``Successfully installed certifi`` και ``update complete`` " +"στο παράθυρο τερματικού, η εγκατάσταση είναι ολοκληρωμένη. Κλείστε αυτό το " +"παράθυρο τερματικού και το παράθυρο εγκαταστάτη." -#: using/mac.rst:63 +#: using/mac.rst:108 +msgid "A default install will include:" +msgstr "Μια προεπιλεγμένη εγκατάσταση θα περιλαμβάνει:" + +#: using/mac.rst:110 msgid "" -"Your best way to get started with Python on macOS is through the IDLE " -"integrated development environment; see section :ref:`ide` and use the Help " -"menu when the IDE is running." +"A |python_version_literal| folder in your :file:`Applications` folder. In " +"here you find :program:`IDLE`, the development environment that is a " +"standard part of official Python distributions; and :program:`Python " +"Launcher`, which handles double-clicking Python scripts from the macOS " +"`Finder `_." msgstr "" +"Ένας |python_version_literal| φάκελος στον φάκελο :file:`Applications`. Εδώ " +"θα βρείτε το :program:`IDLE`, το περιβάλλον ανάπτυξης που είναι τυπικό μέρος " +"των επίσημων διανομών Python∙ και το :program:`Python Launcher`, το οποίο " +"χειρίζεται τα διπλά κλικ σε Python scripts από το macOS `Finder `_." -#: using/mac.rst:67 +#: using/mac.rst:115 msgid "" -"If you want to run Python scripts from the Terminal window command line or " -"from the Finder you first need an editor to create your script. macOS comes " -"with a number of standard Unix command line editors, :program:`vim` :program:" -"`nano` among them. If you want a more Mac-like editor, :program:`BBEdit` " -"from Bare Bones Software (see https://www.barebones.com/products/bbedit/" -"index.html) are good choices, as is :program:`TextMate` (see https://" -"macromates.com). Other editors include :program:`MacVim` (https://macvim." -"org) and :program:`Aquamacs` (https://aquamacs.org)." +"A framework :file:`/Library/Frameworks/Python.framework`, which includes the " +"Python executable and libraries. The installer adds this location to your " +"shell path. To uninstall Python, you can remove these three things. Symlinks " +"to the Python executable are placed in :file:`/usr/local/bin/`." msgstr "" +"Ένα πλαίσιο :file:`/Library/Frameworks/Python.framework`, το οποίο " +"περιλαμβάνει τον εκτελέσιμο κώδικα Python και τις βιβλιοθήκες. Το πρόγραμμα " +"εγκατάστασης προσθέτει αυτήν την τοποθεσία στο shell path σας. Για να " +"απεγκαταστήσετε την Python, μπορείτε να αφαιρέσετε αυτά τα τρία πράγματα. " +"Symlinks στον εκτελέσιμο κώδικα Python τοποθετούνται στο :file:`/usr/local/" +"bin/`." -#: using/mac.rst:77 +#: using/mac.rst:122 msgid "" -"To run your script from the Terminal window you must make sure that :file:`/" -"usr/local/bin` is in your shell search path." +"Recent versions of macOS include a :command:`python3` command in :file:`/usr/" +"bin/python3` that links to a usually older and incomplete version of Python " +"provided by and for use by the Apple development tools, :program:`Xcode` or " +"the :program:`Command Line Tools for Xcode`. You should never modify or " +"attempt to delete this installation, as it is Apple-controlled and is used " +"by Apple-provided or third-party software. If you choose to install a newer " +"Python version from ``python.org``, you will have two different but " +"functional Python installations on your computer that can co-exist. The " +"default installer options should ensure that its :command:`python3` will be " +"used instead of the system :command:`python3`." msgstr "" +"Οι πρόσφατες εκδόσεις του macOS περιλαμβάνουν μια εντολή :command:`python3` " +"στο :file:`/usr/bin/python3` που συνδέεται με μια συνήθως παλαιότερη και " +"ελλιπή έκδοση της Python που παρέχεται από και για χρήση από τα εργαλεία " +"ανάπτυξης της Apple, :program:`Xcode` ή τα :program:`Command Line Tools for " +"Xcode`. Δεν θα πρέπει ποτέ να τροποποιήσετε ή να προσπαθήσετε να διαγράψετε " +"αυτήν την εγκατάσταση, καθώς ελέγχεται από την Apple και χρησιμοποιείται από " +"το λογισμικό που παρέχεται από την Apple ή από τρίτους. Εάν επιλέξετε να " +"εγκαταστήσετε μια νεότερη έκδοση Python από το ``python.org``, θα έχετε δύο " +"διαφορετικές αλλά λειτουργικές εγκαταστάσεις Python στον υπολογιστή σας που " +"μπορούν να συνυπάρχουν. Οι προεπιλεγμένες επιλογές εγκατάστασης θα πρέπει να " +"διασφαλίσουν ότι η :command:`python3` θα χρησιμοποιηθεί αντί της συστήματος :" +"command:`python3`." + +#: using/mac.rst:133 +msgid "How to run a Python script" +msgstr "Πώς να εκτελέσετε ένα σενάριο Python" -#: using/mac.rst:80 -msgid "To run your script from the Finder you have two options:" +#: using/mac.rst:135 +msgid "" +"There are two ways to invoke the Python interpreter. If you are familiar " +"with using a Unix shell in a terminal window, you can invoke |" +"python_x_dot_y_literal| or ``python3`` optionally followed by one or more " +"command line options (described in :ref:`using-on-general`). The Python " +"tutorial also has a useful section on :ref:`using Python interactively from " +"a shell `." msgstr "" +"Υπάρχουν δύο τρόποι για να καλέσετε τον διερμηνέα Python. Εάν είστε " +"εξοικειωμένοι με τη χρήση ενός κελύφους Unix σε ένα παράθυρο τερματικού, " +"μπορείτε να καλέσετε |python_x_dot_y_literal| ή ``python3`` προαιρετικά " +"ακολουθούμενο από μία ή περισσότερες επιλογές γραμμής εντολών (περιγράφεται " +"στο :ref:`using-on-general`). Το εγχειρίδιο Python έχει επίσης μια χρήσιμη " +"ενότητα σχετικά με :ref:`using Python interactively from a shell `." -#: using/mac.rst:82 -msgid "Drag it to :program:`Python Launcher`." +#: using/mac.rst:142 +msgid "" +"You can also invoke the interpreter through an integrated development " +"environment. :ref:`idle` is a basic editor and interpreter environment which " +"is included with the standard distribution of Python. :program:`IDLE` " +"includes a Help menu that allows you to access Python documentation. If you " +"are completely new to Python, you can read the tutorial introduction in that " +"document." msgstr "" +"Μπορείτε επίσης να καλέσετε τον ερμηνευτή μέσω ενός ενσωματωμένου " +"αναπτυξιακού περιβάλλοντος. :ref:`idle` είναι ένας βασικός επεξεργαστής και " +"περιβάλλον ερμηνευτή που περιλαμβάνεται με την τυπική διανομή Python. Το :" +"program:`IDLE` περιλαμβάνει ένα μενού Βοήθειας που σας επιτρέπει να " +"αποκτήσετε πρόσβαση στην τεκμηρίωση Python. Εάν είστε εντελώς νέοι στην " +"Python, μπορείτε να διαβάσετε την εισαγωγή του εγχειριδίου σε αυτό το " +"έγγραφο." -#: using/mac.rst:84 +#: using/mac.rst:150 +msgid "" +"There are many other editors and IDEs available, see :ref:`editors` for more " +"information." +msgstr "" +"Υπάρχουν πολλοί άλλοι επεξεργαστές και IDE διαθέσιμοι, δείτε :ref:`editors` " +"για περισσότερες πληροφορίες." + +#: using/mac.rst:153 +msgid "" +"To run a Python script file from the terminal window, you can invoke the " +"interpreter with the name of the script file:" +msgstr "" +"Για να εκτελέσετε ένα αρχείο script Python από το παράθυρο τερματικού, " +"μπορείτε να καλέσετε τον ερμηνευτή με το όνομα του αρχείου script:" + +#: using/mac.rst:156 +msgid "|python_x_dot_y_literal| ``myscript.py``" +msgstr "|python_x_dot_y_literal| ``myscript.py``" + +#: using/mac.rst:158 +msgid "To run your script from the Finder, you can either:" +msgstr "Για να εκτελέσετε το script σας από το Finder, μπορείτε είτε:" + +#: using/mac.rst:160 +msgid "Drag it to :program:`Python Launcher`." +msgstr "Σύρετε το στο :program:`Python Launcher`." + +#: using/mac.rst:162 msgid "" "Select :program:`Python Launcher` as the default application to open your " -"script (or any ``.py`` script) through the finder Info window and double-" +"script (or any ``.py`` script) through the Finder Info window and double-" "click it. :program:`Python Launcher` has various preferences to control how " "your script is launched. Option-dragging allows you to change these for one " -"invocation, or use its Preferences menu to change things globally." +"invocation, or use its ``Preferences`` menu to change things globally." msgstr "" +"Επιλέξτε το :program:`Python Launcher` ως την προεπιλεγμένη εφαρμογή για να " +"ανοίξετε το script σας (ή οποιοδήποτε ``.py`` script) μέσω του παραθύρου " +"πληροφοριών Finder και κάντε διπλό κλικ σε αυτό. Το :program:`Python " +"Launcher` έχει διάφορες προτιμήσεις για να ελέγξει πώς εκκινείται το script " +"σας. Η επιλογή-μεταφορά σας επιτρέπει να αλλάξετε αυτά για μία κλήση ή " +"χρησιμοποιήστε το μενού ``Προτιμήσεις`` για να αλλάξετε τα πράγματα " +"παγκοσμίως." -#: using/mac.rst:94 -msgid "Running scripts with a GUI" +#: using/mac.rst:168 +msgid "" +"Be aware that running the script directly from the macOS Finder might " +"produce different results than when running from a terminal window as the " +"script will not be run in the usual shell environment including any setting " +"of environment variables in shell profiles. And, as with any other script or " +"program, be certain of what you are about to run." msgstr "" +"Να είστε προσεκτικοί ότι η εκτέλεση του script απευθείας από το macOS Finder " +"μπορεί να παράγει διαφορετικά αποτελέσματα από την εκτέλεση από ένα παράθυρο " +"τερματικού καθώς το script δεν θα εκτελείται στο συνήθη περιβάλλον κελύφους " +"που περιλαμβάνει οποιαδήποτε ρύθμιση μεταβλητών περιβάλλοντος σε προφίλ " +"κελύφους. Και, όπως με οποιοδήποτε άλλο script ή πρόγραμμα, να είστε " +"σίγουροι για το τι πρόκειται να εκτελέσετε." + +#: using/mac.rst:178 +msgid "Alternative Distributions" +msgstr "Εναλλακτικές Διανομές" -#: using/mac.rst:96 +#: using/mac.rst:180 msgid "" -"With older versions of Python, there is one macOS quirk that you need to be " -"aware of: programs that talk to the Aqua window manager (in other words, " -"anything that has a GUI) need to be run in a special way. Use :program:" -"`pythonw` instead of :program:`python` to start such scripts." +"Besides the standard ``python.org`` for macOS installer, there are third-" +"party distributions for macOS that may include additional functionality. " +"Some popular distributions and their key features:" msgstr "" +"Εκτός από τον τυπικό εγκαταστάτη ``python.org`` για macOS, υπάρχουν τρίτες " +"διανομές για macOS που μπορεί να περιλαμβάνουν πρόσθετη λειτουργικότητα. " +"Ορισμένες δημοφιλείς διανομές και τα βασικά χαρακτηριστικά τους:" + +#: using/mac.rst:184 +msgid "`ActivePython `_" +msgstr "`ActivePython `_" + +#: using/mac.rst:185 +msgid "Installer with multi-platform compatibility, documentation" +msgstr "Εγκαταστάτης με συμβατότητα πολλών πλατφορμών, τεκμηρίωση" -#: using/mac.rst:101 +#: using/mac.rst:187 +msgid "`Anaconda `_" +msgstr "`Anaconda `_" + +#: using/mac.rst:188 msgid "" -"With Python 3.9, you can use either :program:`python` or :program:`pythonw`." +"Popular scientific modules (such as numpy, scipy, and pandas) and the " +"``conda`` package manager." msgstr "" +"Δημοφιλή επιστημονικά modules (όπως numpy, scipy και pandas) και ο ``conda`` " +"διαχειριστής πακέτων." + +#: using/mac.rst:191 +msgid "`Homebrew `_" +msgstr "`Homebrew `_" -#: using/mac.rst:105 -msgid "Configuration" +#: using/mac.rst:192 +msgid "" +"Package manager for macOS including multiple versions of Python and many " +"third-party Python-based packages (including numpy, scipy, and pandas)." msgstr "" +"Διαχειριστής πακέτων για macOS που περιλαμβάνει πολλές εκδόσεις Python και " +"πολλά τρίτα πακέτα Python (συμπεριλαμβανομένων των numpy, scipy και pandas)." -#: using/mac.rst:107 +#: using/mac.rst:195 +msgid "`MacPorts `_" +msgstr "`MacPorts `_" + +#: using/mac.rst:196 msgid "" -"Python on macOS honors all standard Unix environment variables such as :" -"envvar:`PYTHONPATH`, but setting these variables for programs started from " -"the Finder is non-standard as the Finder does not read your :file:`.profile` " -"or :file:`.cshrc` at startup. You need to create a file :file:`~/.MacOSX/" -"environment.plist`. See Apple's `Technical Q&A QA1067 `__ for details." +"Another package manager for macOS including multiple versions of Python and " +"many third-party Python-based packages. May include pre-built versions of " +"Python and many packages for older versions of macOS." msgstr "" +"Ένας άλλος διαχειριστής πακέτων για macOS που περιλαμβάνει πολλές εκδόσεις " +"Python και πολλά τρίτα πακέτα Python. Μπορεί να περιλαμβάνει προ-" +"κατασκευασμένες εκδόσεις της Python και πολλά πακέτα για παλαιότερες " +"εκδόσεις του macOS." -#: using/mac.rst:115 +#: using/mac.rst:200 msgid "" -"For more information on installation Python packages, see section :ref:`mac-" -"package-manager`." +"Note that distributions might not include the latest versions of Python or " +"other libraries, and are not maintained or supported by the core Python team." msgstr "" +"Σημειώστε ότι οι διανομές ενδέχεται να μην περιλαμβάνουν τις τελευταίες " +"εκδόσεις της Python ή άλλων βιβλιοθηκών και δεν υποστηρίζονται ή " +"συντηρούνται από την κύρια ομάδα Python." -#: using/mac.rst:122 -msgid "The IDE" +#: using/mac.rst:206 +msgid "Installing Additional Python Packages" +msgstr "Εγκατάσταση πρόσθετων πακέτων Python" + +#: using/mac.rst:208 +msgid "Refer to the `Python Packaging User Guide`_ for more information." msgstr "" +"Ανατρέξτε στον `Python Packaging User Guide`_ για περισσότερες πληροφορίες." + +#: using/mac.rst:218 +msgid "GUI Programming" +msgstr "Προγραμματισμός GUI" -#: using/mac.rst:124 +#: using/mac.rst:220 msgid "" -"Python ships with the standard IDLE development environment. A good " -"introduction to using IDLE can be found at https://www.hashcollision.org/hkn/" -"python/idle_intro/index.html." +"There are several options for building GUI applications on the Mac with " +"Python." msgstr "" +"Υπάρχουν πολλές επιλογές για την κατασκευή εφαρμογών GUI στον Mac με Python." -#: using/mac.rst:132 -msgid "Installing Additional Python Packages" +#: using/mac.rst:222 +msgid "" +"The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" +"platform Tk toolkit (https://www.tcl.tk). A macOS-native version of Tk is " +"included with the installer." msgstr "" +"Η τυπική βιβλιοθήκη GUI Python είναι :mod:`tkinter`, βασισμένη στο " +"διαλειτουργικό εργαλείο Tk (https://www.tcl.tk). Μια εγγενής έκδοση Tk macOS " +"περιλαμβάνεται με τον εγκαταστάτη." -#: using/mac.rst:134 -msgid "This section has moved to the `Python Packaging User Guide`_." +#: using/mac.rst:226 +msgid "" +"*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework. " +"Information on PyObjC is available from :pypi:`pyobjc`." msgstr "" +"Το *PyObjC* είναι ένα Python binding στο πλαίσιο Objective-C/Cocoa της " +"Apple. Πληροφορίες σχετικά με το PyObjC είναι διαθέσιμες από :pypi:`pyobjc`." -#: using/mac.rst:142 -msgid "GUI Programming" +#: using/mac.rst:229 +msgid "A number of alternative macOS GUI toolkits are available including:" msgstr "" +"Ένας αριθμός εναλλακτικών εργαλείων GUI macOS είναι διαθέσιμος, " +"συμπεριλαμβανομένων:" -#: using/mac.rst:144 +#: using/mac.rst:231 msgid "" -"There are several options for building GUI applications on the Mac with " -"Python." +"`PySide `_: Official Python bindings to the " +"`Qt GUI toolkit `_." msgstr "" +"`PySide `_: Επίσημα Python bindings στο `Qt " +"GUI toolkit `_." -#: using/mac.rst:146 +#: using/mac.rst:234 msgid "" -"*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework, which " -"is the foundation of most modern Mac development. Information on PyObjC is " -"available from https://pypi.org/project/pyobjc/." +"`PyQt `_: Alternative Python " +"bindings to Qt." msgstr "" +"`PyQt `_: Εναλλακτικά Python " +"bindings στο Qt." -#: using/mac.rst:150 +#: using/mac.rst:237 msgid "" -"The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" -"platform Tk toolkit (https://www.tcl.tk). An Aqua-native version of Tk is " -"bundled with macOS by Apple, and the latest version can be downloaded and " -"installed from https://www.activestate.com; it can also be built from source." +"`Kivy `_: A cross-platform GUI toolkit that supports " +"desktop and mobile platforms." msgstr "" +"`Kivy `_: Ένα διαλειτουργικό εργαλείο GUI που υποστηρίζει " +"desktop και mobile πλατφόρμες." -#: using/mac.rst:155 +#: using/mac.rst:240 msgid "" -"*wxPython* is another popular cross-platform GUI toolkit that runs natively " -"on macOS. Packages and documentation are available from https://www.wxpython." -"org." +"`Toga `_: Part of the `BeeWare Project `_; supports desktop, mobile, web and console apps." msgstr "" +"`Toga `_: Μέρος του `BeeWare Project `_; υποστηρίζει εφαρμογές desktop, mobile, web και κονσόλας " +"εφαρμογές." -#: using/mac.rst:158 +#: using/mac.rst:243 msgid "" -"*PyQt* is another popular cross-platform GUI toolkit that runs natively on " -"macOS. More information can be found at https://riverbankcomputing.com/" -"software/pyqt/intro." +"`wxPython `_: A cross-platform toolkit that supports " +"desktop operating systems." msgstr "" +"`wxPython `_: Ένα διαλειτουργικό εργαλείο που " +"υποστηρίζει desktop πλατφόρμες." -#: using/mac.rst:162 +#: using/mac.rst:248 +msgid "Advanced Topics" +msgstr "Προχωρημένα θέματα" + +#: using/mac.rst:253 +msgid "Installing Free-threaded Binaries" +msgstr "Εγκατάσταση εκδόσεων Free-threaded" + +#: using/mac.rst:257 +msgid "" +"The ``python.org`` :ref:`Python for macOS ` installer package can optionally install an additional build of " +"Python |version| that supports :pep:`703`, the free-threading feature " +"(running with the :term:`global interpreter lock` disabled). Check the " +"release page on ``python.org`` for possible updated information." +msgstr "" +"Το πακέτο εγκατάστασης ``python.org`` :ref:`Python for macOS ` μπορεί προαιρετικά να εγκαταστήσει μια επιπλέον " +"έκδοση της Python |version| που υποστηρίζει :pep:`703`, την πειραματική " +"δυνατότητα ελεύθερης νηματοποίησης (threading) (εκτέλεση με το :term:`global " +"interpreter lock` απενεργοποιημένο). Ελέγξτε τη σελίδα κυκλοφορίας στο " +"``python.org`` για πιθανές ενημερωμένες πληροφορίες." + +#: using/mac.rst:263 +msgid "" +"The free-threaded mode is working and continues to be improved, but there is " +"some additional overhead in single-threaded workloads compared to the " +"regular build. Additionally, third-party packages, in particular ones with " +"an :term:`extension module`, may not be ready for use in a free-threaded " +"build, and will re-enable the :term:`GIL`. Therefore, the support for free-" +"threading is not installed by default. It is packaged as a separate install " +"option, available by clicking the **Customize** button on the **Installation " +"Type** step of the installer as described above." +msgstr "" +"Η λειτουργία ελεύθερου νήματος λειτουργεί και συνεχίζει να βελτιώνεται, αλλά " +"υπάρχει κάποια πρόσθετη επιβάρυνση στα φορτία εργασίας μονού νήματος σε " +"σύγκριση με την κανονική έκδοση. Επιπλέον, τα πακέτα τρίτων κατασκευαστών, " +"ιδίως αυτά με :term:`extension module`, ενδέχεται να μην είναι έτοιμα για " +"χρήση σε μια έκδοση ελεύθερου νήματος και θα ενεργοποιήσουν ξανά το :term:" +"`GIL`. Επομένως, η υποστήριξη για ελεύθερη νηματοποποίησης δεν εγκαθίστανται " +"από προεπιλογή. Είναι συσκευασμένη ως ξεχωριστή επιλογή εγκατάστασης, " +"διαθέσιμη κάνοντας κλικ το κουμπί **Customize** στο βήμα **Installation " +"Type** του προγράμματος εγκατάστασης όπως περιγράφεται παραπάνω." + +#: using/mac.rst:275 +msgid "" +"If the box next to the **Free-threaded Python** package name is checked, a " +"separate :file:`PythonT.framework` will also be installed alongside the " +"normal :file:`Python.framework` in :file:`/Library/Frameworks`. This " +"configuration allows a free-threaded Python |version| build to co-exist on " +"your system with a traditional (GIL only) Python |version| build with " +"minimal risk while installing or testing. This installation layout may " +"change in future releases." +msgstr "" +"Εάν το πλαίσιο δίπλα στο όνομα πακέτου **Free-threaded Python** είναι " +"επιλεγμένο, θα εγκατασταθεί επίσης ένα ξεχωριστό :file:`PythonT.framework` " +"δίπλα στο κανονικό :file:`Python.framework` στο :file:`/Library/Frameworks`. " +"Αυτή η διαμόρφωση επιτρέπει σε μια έκδοση Python |version| ελεύθερης " +"νηματοποίησης να συγκατοικεί στο σύστημά σας με μια παραδοσιακή (μόνο GIL) " +"Python |version| έκδοση με ελάχιστο κίνδυνο κατά την εγκατάσταση ή τη " +"δοκιμή. Αυτή η διάταξη εγκατάστασης είναι πειραματική και υπόκειται σε " +"αλλαγές σε μελλοντικές εκδόσεις." + +#: using/mac.rst:283 +msgid "Known cautions and limitations:" +msgstr "Γνωστές προφυλάξεις και περιορισμοί:" + +#: using/mac.rst:285 +msgid "" +"The **UNIX command-line tools** package, which is selected by default, will " +"install links in :file:`/usr/local/bin` for |python_x_dot_y_t_literal|, the " +"free-threaded interpreter, and |python_x_dot_y_t_literal_config|, a " +"configuration utility which may be useful for package builders. Since :file:" +"`/usr/local/bin` is typically included in your shell ``PATH``, in most cases " +"no changes to your ``PATH`` environment variables should be needed to use |" +"python_x_dot_y_t_literal|." +msgstr "" +"To **UNIX command-line tools** πακέτο, το οποίο επιλέγεται από προεπιλογή, " +"θα εγκαταστήσει συνδέσμους στο :file:`/usr/local/bin` για |" +"python_x_dot_y_t_literal|, τον ερμηνευτή ελεύθερης νηματοποίησης και |" +"python_x_dot_y_t_literal_config|, ένα βοηθητικό πρόγραμμα διαμόρφωσης που " +"μπορεί να είναι χρήσιμο για κατασκευαστές πακέτων. Δεδομένου ότι το :file:`/" +"usr/local/bin` περιλαμβάνεται συνήθως στη μεταβλητή περιβάλλοντος ``PATH`` " +"του κελύφους σας, στις περισσότερες περιπτώσεις δεν θα χρειαστούν αλλαγές " +"στις μεταβλητές περιβάλλοντος ``PATH`` για να χρησιμοποιήσετε |" +"python_x_dot_y_t_literal|." + +#: using/mac.rst:293 +msgid "" +"For this release, the **Shell profile updater** package and the :file:" +"`Update Shell Profile.command` in |applications_python_version_literal| do " +"not support the free-threaded package." +msgstr "" +"Για αυτήν την έκδοση, το πακέτο **Shell profile updater** και το :file:" +"`Update Shell Profile.command` στο |applications_python_version_literal| " +"δεν υποστηρίζουν το πακέτο ελεύθερης νηματοποίησης." + +#: using/mac.rst:297 +msgid "" +"The free-threaded build and the traditional build have separate search paths " +"and separate :file:`site-packages` directories so, by default, if you need a " +"package available in both builds, it may need to be installed in both. The " +"free-threaded package will install a separate instance of :program:`pip` for " +"use with |python_x_dot_y_t_literal|." +msgstr "" +"Η έκδοση ελεύθερης νηματοποίησης και η παραδοσιακή έκδοση έχουν ξεχωριστές " +"διαδρομές αναζήτησης και ξεχωριστούς καταλόγους :file:`site-packages`, " +"οπότε, από προεπιλογή, εάν χρειάζεστε ένα πακέτο διαθέσιμο και στις δύο " +"εκδόσεις, μπορεί να χρειαστεί να εγκατασταθεί και στις δύο. Το πακέτο " +"ελεύθερης νηματοποίησης θα εγκαταστήσει μια ξεχωριστή έκδοση του :program:" +"`pip` για χρήση με |python_x_dot_y_t_literal|." + +#: using/mac.rst:303 +msgid "To install a package using :command:`pip` without a :command:`venv`:" +msgstr "" +"Για να εγκαταστήσετε ένα πακέτο χρησιμοποιώντας :command:`pip` χωρίς :" +"command:`venv`:" + +#: using/mac.rst:307 +msgid "python\\ |version|\\ t -m pip install " +msgstr "python\\ |version|\\ t -m pip install " + +#: using/mac.rst:309 +msgid "" +"When working with multiple Python environments, it is usually safest and " +"easiest to :ref:`create and use virtual environments `. This can " +"avoid possible command name conflicts and confusion about which Python is in " +"use:" +msgstr "" +"Όταν εργάζεστε με πολλές Python περιβάλλοντα, είναι συνήθως ασφαλέστερο και " +"ευκολότερο να :ref:`create and use virtual environments `. Αυτό " +"μπορεί να αποφύγει πιθανά ονόματα εντολών συγκρούσεων και σύγχυση σχετικά με " +"το ποια Python είναι σε χρήση:" + +#: using/mac.rst:315 +msgid "python\\ |version|\\ t -m venv " +msgstr "python\\ |version|\\ t -m venv " + +#: using/mac.rst:318 +msgid "then :command:`activate`." +msgstr "τότε :command:`activate`." + +#: using/mac.rst:320 +msgid "To run a free-threaded version of IDLE:" +msgstr "Για να εκτελέσετε μια έκδοση ελεύθερης νηματοποίησης του IDLE:" + +#: using/mac.rst:324 +msgid "python\\ |version|\\ t -m idlelib" +msgstr "python\\ |version|\\ t -m idlelib" + +#: using/mac.rst:327 +msgid "" +"The interpreters in both builds respond to the same :ref:`PYTHON environment " +"variables ` which may have unexpected results, for " +"example, if you have ``PYTHONPATH`` set in a shell profile. If necessary, " +"there are :ref:`command line options ` like ``-" +"E`` to ignore these environment variables." +msgstr "" +"Οι ερμηνευτές και στις δύο εκδόσεις ανταγωνίζονται στις ίδιες :ref:`PYTHON " +"environment variables ` που μπορεί να έχουν απροσδόκητα " +"αποτελέσματα, για παράδειγμα, εάν έχετε ρυθμίσει το ``PYTHONPATH`` σε ένα " +"προφίλ κελύφους. Εάν είναι απαραίτητο, υπάρχουν :ref:`command line options " +"` όπως ``-E`` για να αγνοήσετε αυτές τις " +"μεταβλητές περιβάλλοντος." + +#: using/mac.rst:334 +msgid "" +"The free-threaded build links to the third-party shared libraries, such as " +"``OpenSSL`` and ``Tk``, installed in the traditional framework. This means " +"that both builds also share one set of trust certificates as installed by " +"the :command:`Install Certificates.command` script, thus it only needs to be " +"run once." +msgstr "" +"Η έκδοση ελεύθερης νηματοποίησης συνδέεται με τις βιβλιοθήκες κοινής χρήσης " +"τρίτων, όπως ``OpenSSL`` και ``Tk``, που είναι εγκατεστημένες στο " +"παραδοσιακό πλαίσιο. Αυτό σημαίνει ότι και οι δύο εκδόσεις μοιράζονται " +"επίσης ένα σύνολο πιστοποιητικών εμπιστοσύνης όπως εγκαθίστανται από το :" +"command:`Install Certificates.command` script, επομένως χρειάζεται να " +"εκτελείται μόνο μία φορά." + +#: using/mac.rst:340 +msgid "" +"If you cannot depend on the link in ``/usr/local/bin`` pointing to the " +"``python.org`` free-threaded |python_x_dot_y_t_literal| (for example, if you " +"want to install your own version there or some other distribution does), you " +"can explicitly set your shell ``PATH`` environment variable to include the " +"``PythonT`` framework ``bin`` directory:" +msgstr "" +"Εάν δεν μπορείτε να εξαρτηθείτε από το σύνδεσμο στο ``/usr/local/bin`` που " +"δείχνει στην έκδοση |python_x_dot_y_t_literal| ελεύθερης νηματοποίησης (για " +"παράδειγμα, εάν θέλετε να εγκαταστήσετε τη δική σας έκδοση εκεί ή κάποια " +"άλλη διανομή το κάνει), μπορείτε να ορίσετε ρητά τη μεταβλητή περιβάλλοντος " +"``PATH`` του κελύφους σας για να περιλαμβάνει το κατάλογο ``bin`` του " +"πλαισίου ``PythonT``:" + +#: using/mac.rst:348 +msgid "" +"export PATH=\"/Library/Frameworks/PythonT.framework/Versions/\\ |version|\\ /" +"bin\":\"$PATH\"" +msgstr "" +"export PATH=\"/Library/Frameworks/PythonT.framework/Versions/\\ |version|\\ /" +"bin\":\"$PATH\"" + +#: using/mac.rst:350 +msgid "" +"The traditional framework installation by default does something similar, " +"except for :file:`Python.framework`. Be aware that having both framework " +"``bin`` directories in ``PATH`` can lead to confusion if there are duplicate " +"names like |python_x_dot_y_literal| in both; which one is actually used " +"depends on the order they appear in ``PATH``. The ``which python3.x`` or " +"``which python3.xt`` commands can show which path is being used. Using " +"virtual environments can help avoid such ambiguities. Another option might " +"be to create a shell :command:`alias` to the desired interpreter, like:" +msgstr "" +"Η παραδοσιακή εγκατάσταση πλαισίου από προεπιλογή κάνει κάτι παρόμοιο, εκτός " +"από το :file:`Python.framework`. Να είστε προσεκτικοί ότι η παρουσία και των " +"δύο καταλόγων ``bin`` πλαισίου στο ``PATH`` μπορεί να οδηγήσει σε σύγχυση " +"εάν υπάρχουν διπλά ονόματα όπως |python_x_dot_y_literal| και στις δύο∙ ποιο " +"χρησιμοποιείται στην πραγματικότητα εξαρτάται από τη σειρά που εμφανίζονται " +"στο ``PATH``. Οι εντολές ``which python3.x`` ή ``which python3.xt`` μπορούν " +"να δείξουν ποια διαδρομή χρησιμοποιείται. Η χρήση εικονικών περιβαλλόντων " +"μπορεί να βοηθήσει στην αποφυγή τέτοιων αμφισημιών. Μια άλλη επιλογή μπορεί " +"να είναι η δημιουργία ενός κελύφους :command:`alias` στον επιθυμητό " +"διερμηνέα, όπως:" + +#: using/mac.rst:361 +msgid "" +"alias py\\ |version|\\ =\"/Library/Frameworks/Python.framework/Versions/\\ |" +"version|\\ /bin/python\\ |version|\\ \"\n" +"alias py\\ |version|\\ t=\"/Library/Frameworks/PythonT.framework/Versions/\\ " +"|version|\\ /bin/python\\ |version|\\ t\"" +msgstr "" +"alias py\\ |version|\\ =\"/Library/Frameworks/Python.framework/Versions/\\ |" +"version|\\ /bin/python\\ |version|\\ \"\n" +"alias py\\ |version|\\ t=\"/Library/Frameworks/PythonT.framework/Versions/\\ " +"|version|\\ /bin/python\\ |version|\\ t\"" + +#: using/mac.rst:365 +msgid "Installing using the command line" +msgstr "Εγκατάσταση χρησιμοποιώντας τη γραμμή εντολών" + +#: using/mac.rst:367 +msgid "" +"If you want to use automation to install the ``python.org`` installer " +"package (rather than by using the familiar macOS :program:`Installer` GUI " +"app), the macOS command line :command:`installer` utility lets you select " +"non-default options, too. If you are not familiar with :command:`installer`, " +"it can be somewhat cryptic (see :command:`man installer` for more " +"information). As an example, the following shell snippet shows one way to do " +"it, using the |x_dot_y_b2_literal| release and selecting the free-threaded " +"interpreter option:" +msgstr "" +"Εάν θέλετε να χρησιμοποιήσετε αυτοματισμό για να εγκαταστήσετε το πακέτο " +"εγκατάστασης ``python.org`` (παρά να χρησιμοποιήσετε την οικεία εφαρμογή :" +"program:`Installer` GUI macOS), το βοηθητικό πρόγραμμα :command:`installer` " +"γραμμής εντολών macOS σας επιτρέπει να επιλέξετε μη προεπιλεγμένες επιλογές, " +"επίσης. Εάν δεν είστε εξοικειωμένοι με το :command:`installer`, μπορεί να " +"είναι κάπως κρυπτικό (βλ. :command:`man installer` για περισσότερες " +"πληροφορίες). Ως παράδειγμα, το παρακάτω απόσπασμα κώδικα δείχνει έναν τρόπο " +"να το κάνετε, χρησιμοποιώντας την έκδοση |x_dot_y_b2_literal| και " +"επιλέγοντας την επιλογή διερμηνέα ελεύθερης νηματοποίησης:" + +#: using/mac.rst:378 msgid "" -"*PySide* is another cross-platform Qt-based toolkit. More information at " -"https://www.qt.io/qt-for-python." +"RELEASE=\"python-\\ |version|\\ 0b2-macos11.pkg\"\n" +"\n" +"# download installer pkg\n" +"curl -O \\https://www.python.org/ftp/python/\\ |version|\\ .0/${RELEASE}\n" +"\n" +"# create installer choicechanges to customize the install:\n" +"# enable the PythonTFramework-\\ |version|\\ package\n" +"# while accepting the other defaults (install all other packages)\n" +"cat > ./choicechanges.plist <\n" +"\n" +"\n" +"\n" +" \n" +" attributeSetting\n" +" 1\n" +" choiceAttribute\n" +" selected\n" +" choiceIdentifier\n" +" org.python.Python.PythonTFramework-\\ |version|\\ \n" +" \n" +"\n" +"\n" +"EOF\n" +"\n" +"sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges." +"plist -target /" msgstr "" +"RELEASE=\"python-\\ |version|\\ 0b2-macos11.pkg\"\n" +"\n" +"# download installer pkg\n" +"curl -O \\https://www.python.org/ftp/python/\\ |version|\\ .0/${RELEASE}\n" +"\n" +"# create installer choicechanges to customize the install:\n" +"# enable the PythonTFramework-\\ |version|\\ package\n" +"# while accepting the other defaults (install all other packages)\n" +"cat > ./choicechanges.plist <\n" +"\n" +"\n" +"\n" +" \n" +" attributeSetting\n" +" 1\n" +" choiceAttribute\n" +" selected\n" +" choiceIdentifier\n" +" org.python.Python.PythonTFramework-\\ |version|\\ \n" +" \n" +"\n" +"\n" +"EOF\n" +"\n" +"sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges." +"plist -target /" -#: using/mac.rst:169 +#: using/mac.rst:406 +msgid "" +"You can then test that both installer builds are now available with " +"something like:" +msgstr "" +"Μπορείτε στη συνέχεια να ελέγξετε ότι και οι δύο εγκαταστάτες είναι " +"διαθέσιμοι με κάτι σαν:" + +#: using/mac.rst:410 +msgid "" +"$ # test that the free-threaded interpreter was installed if the Unix " +"Command Tools package was enabled\n" +"$ /usr/local/bin/python\\ |version|\\ t -VV\n" +"Python \\ |version|\\ .0b2 free-threading build (v\\ |version|" +"\\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 " +"(clang-1500.3.9.4)]\n" +"$ # and the traditional interpreter\n" +"$ /usr/local/bin/python\\ |version|\\ -VV\n" +"Python \\ |version|\\ .0b2 (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, " +"12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]\n" +"$ # test that they are also available without the prefix if /usr/local/bin " +"is on $PATH\n" +"$ python\\ |version|\\ t -VV\n" +"Python \\ |version|\\ .0b2 free-threading build (v\\ |version|" +"\\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 " +"(clang-1500.3.9.4)]\n" +"$ python\\ |version|\\ -VV\n" +"Python \\ |version|\\ .0b2 (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, " +"12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]" +msgstr "" +"$ # test that the free-threaded interpreter was installed if the Unix " +"Command Tools package was enabled\n" +"$ /usr/local/bin/python\\ |version|\\ t -VV\n" +"Python \\ |version|\\ .0b2 free-threading build (v\\ |version|" +"\\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 " +"(clang-1500.3.9.4)]\n" +"$ # and the traditional interpreter\n" +"$ /usr/local/bin/python\\ |version|\\ -VV\n" +"Python \\ |version|\\ .0b2 (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, " +"12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]\n" +"$ # test that they are also available without the prefix if /usr/local/bin " +"is on $PATH\n" +"$ python\\ |version|\\ t -VV\n" +"Python \\ |version|\\ .0b2 free-threading build (v\\ |version|" +"\\ .0b2:3a83b172af, Jun 5 2024, 12:57:31) [Clang 15.0.0 " +"(clang-1500.3.9.4)]\n" +"$ python\\ |version|\\ -VV\n" +"Python \\ |version|\\ .0b2 (v\\ |version|\\ .0b2:3a83b172af, Jun 5 2024, " +"12:50:24) [Clang 15.0.0 (clang-1500.3.9.4)]" + +#: using/mac.rst:424 +msgid "" +"Current ``python.org`` installers only install to fixed locations like :file:" +"`/Library/Frameworks/`, :file:`/Applications`, and :file:`/usr/local/bin`. " +"You cannot use the :command:`installer` ``-domain`` option to install to " +"other locations." +msgstr "" +"Τα τρέχοντα προγράμματα εγκατάστασης ``python.org`` εγκαθίστανται μόνο σε " +"καθορισμένες τοποθεσίες όπως :file:`/Library/Frameworks/`, :file:`/" +"Applications` και :file:`/usr/local/bin`. Δεν μπορείτε να χρησιμοποιήσετε " +"την επιλογή ``-domain`` του :command:`installer` για να εγκαταστήσετε σε " +"άλλες τοποθεσίες." + +#: using/mac.rst:432 msgid "Distributing Python Applications" +msgstr "Διανομή εφαρμογών Python" + +#: using/mac.rst:434 +msgid "" +"A range of tools exist for converting your Python code into a standalone " +"distributable application:" msgstr "" +"Υπάρχει μια σειρά εργαλείων για τη μετατροπή του κώδικα Python σας σε μια " +"αυτόνομη διανεμόμενη εφαρμογή:" -#: using/mac.rst:171 +#: using/mac.rst:437 msgid "" -"The standard tool for deploying standalone Python applications on the Mac " -"is :program:`py2app`. More information on installing and using :program:" -"`py2app` can be found at https://pypi.org/project/py2app/." +":pypi:`py2app`: Supports creating macOS ``.app`` bundles from a Python " +"project." msgstr "" +":pypi:`py2app`: Υποστηρίζει τη δημιουργία macOS ``.app`` πακέτων από ένα " +"έργο Python." -#: using/mac.rst:177 -msgid "Other Resources" +#: using/mac.rst:440 +msgid "" +"`Briefcase `_: Part of the `BeeWare " +"Project `_; a cross-platform packaging tool that " +"supports creation of ``.app`` bundles on macOS, as well as managing signing " +"and notarization." +msgstr "" +"`Briefcase `_: Μέρος του `BeeWare Project " +"`_; ένα εργαλείο διανομής πολλαπλών πλατφορμών που " +"υποστηρίζει τη δημιουργία ``.app`` πακέτων σε macOS, καθώς και τη διαχείριση " +"υπογραφής και πιστοποίησης." + +#: using/mac.rst:445 +msgid "" +"`PyInstaller `_: A cross-platform packaging tool " +"that creates a single file or folder as a distributable artifact." msgstr "" +"`PyInstaller `_: Ένα εργαλείο διανομής πολλαπλών " +"πλατφορμών που δημιουργεί ένα μόνο αρχείο ή φάκελο ως διανεμόμενο " +"αντικείμενο." + +#: using/mac.rst:449 +msgid "App Store Compliance" +msgstr "Συμμόρφωση App Store" -#: using/mac.rst:179 +#: using/mac.rst:451 msgid "" -"The Pythonmac-SIG mailing list is an excellent support resource for Python " -"users and developers on the Mac:" +"Apps submitted for distribution through the macOS App Store must pass " +"Apple's app review process. This process includes a set of automated " +"validation rules that inspect the submitted application bundle for " +"problematic code." msgstr "" +"Οι εφαρμογές που υποβάλλονται για διανομή μέσω του macOS App Store πρέπει να " +"περάσουν τη διαδικασία αναθεώρησης εφαρμογών της Apple. Αυτή η διαδικασία " +"περιλαμβάνει ένα σύνολο αυτοματοποιημένων κανόνων επικύρωσης που ελέγχουν το " +"υποβληθέν πακέτο εφαρμογής για προβληματικό κώδικα." -#: using/mac.rst:182 -msgid "https://www.python.org/community/sigs/current/pythonmac-sig/" +#: using/mac.rst:455 +msgid "" +"The Python standard library contains some code that is known to violate " +"these automated rules. While these violations appear to be false positives, " +"Apple's review rules cannot be challenged. Therefore, it is necessary to " +"modify the Python standard library for an app to pass App Store review." msgstr "" +"Η βιβλιοθήκη προτύπων Python περιέχει κάποιον κώδικα που είναι γνωστό ότι " +"παραβιάζει αυτούς τους αυτοματοποιημένους κανόνες. Ενώ αυτές οι παραβιάσεις " +"φαίνεται να είναι ψευδώς θετικές, οι κανόνες αναθεώρησης της Apple δεν " +"μπορούν να αμφισβητηθούν. Επομένως, είναι απαραίτητο να τροποποιηθεί η " +"βιβλιοθήκη προτύπων Python για να περάσει μια εφαρμογή την αναθεώρηση του " +"App Store." -#: using/mac.rst:184 -msgid "Another useful resource is the MacPython wiki:" +#: using/mac.rst:460 +msgid "" +"The Python source tree contains :source:`a patch file ` that will remove all code that is known to cause " +"issues with the App Store review process. This patch is applied " +"automatically when CPython is configured with the :option:`--with-app-store-" +"compliance` option." msgstr "" +"Το δέντρο πηγών Python περιέχει :source:`ένα αρχείο patch ` που θα αφαιρέσει όλο τον κώδικα που είναι γνωστό " +"ότι προκαλεί προβλήματα με τη διαδικασία αναθεώρησης του App Store. Αυτή η " +"επιδιόρθωση εφαρμόζεται αυτόματα όταν η CPython διαμορφώνεται με την :option:" +"`--with-app-store-compliance` επιλογή." -#: using/mac.rst:186 -msgid "https://wiki.python.org/moin/MacPython" +#: using/mac.rst:466 +msgid "" +"This patch is not normally required to use CPython on a Mac; nor is it " +"required if you are distributing an app *outside* the macOS App Store. It is " +"*only* required if you are using the macOS App Store as a distribution " +"channel." +msgstr "" +"Αυτή η επιδιόρθωση δεν απαιτείται κανονικά για τη χρήση της CPython σε Mac. " +"Ούτε απαιτείται εάν διανέμετε μια εφαρμογή *εκτός* του macOS App Store. " +"Απαιτείται *μόνο* εάν χρησιμοποιείτε το macOS App Store ως κανάλι διανομής." + +#: using/mac.rst:471 +msgid "Other Resources" +msgstr "Άλλοι πόροι" + +#: using/mac.rst:473 +msgid "" +"The `python.org Help page `_ has links " +"to many useful resources. The `Pythonmac-SIG mailing list `_ is another support " +"resource specifically for Python users and developers on the Mac." msgstr "" +"Η `python.org Help page `_ έχει " +"συνδέσμους σε πολλούς χρήσιμους πόρους. Η `Pythonmac-SIG mailing list " +"`_ είναι ένας " +"άλλος πόρος υποστήριξης ειδικά για χρήστες και προγραμματιστές Python στο " +"Mac." + +#~ msgid "(Experimental)" +#~ msgstr "(Πειραματικό)" + +#~ msgid "" +#~ "Everything described in this section is considered experimental, and " +#~ "should be expected to change in future releases." +#~ msgstr "" +#~ "Όλα όσα περιγράφονται σε αυτήν την ενότητα θεωρούνται πειραματικά και θα " +#~ "πρέπει να αναμένονται να αλλάξουν σε μελλοντικές εκδόσεις." + +#~ msgid "|usemac_python_x_dot_y_t_literal| ``-m venv ``" +#~ msgstr "|usemac_python_x_dot_y_t_literal| ``-m venv ``" + +#~ msgid "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" +#~ msgstr "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" diff --git a/using/unix.po b/using/unix.po index 0e9354c7..f5dc5575 100644 --- a/using/unix.po +++ b/using/unix.po @@ -8,212 +8,361 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-29 09:18+0200\n" +"Last-Translator: Kleopatra Karapanagiotou \n" +"Language-Team: PyGreece \n" +"Language: el\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.5\n" #: using/unix.rst:7 msgid "Using Python on Unix platforms" -msgstr "" +msgstr "Χρήση της Python σε πλατφόρμες Unix" #: using/unix.rst:13 msgid "Getting and installing the latest version of Python" -msgstr "" +msgstr "Λήψη και εγκατάσταση της πιο πρόσφατης έκδοσης Python" #: using/unix.rst:16 msgid "On Linux" -msgstr "" +msgstr "Σε Linux" #: using/unix.rst:18 msgid "" "Python comes preinstalled on most Linux distributions, and is available as a " "package on all others. However there are certain features you might want to " -"use that are not available on your distro's package. You can easily compile " -"the latest version of Python from source." +"use that are not available on your distro's package. You can compile the " +"latest version of Python from source." msgstr "" +"Η Python είναι προεγκατεστημένη στις περισσότερες διανομές Linux, ενώ " +"διατίθεται ως πακέτο σε όλες τις υπόλοιπες. Ωστόσο, υπάρχουν ορισμένα " +"χαρακτηριστικά που μπορεί να θέλετε να χρησιμοποιήσετε, τα οποία δεν είναι " +"διαθέσιμα στο πακέτο της διανομής σας. Μπορείτε να κάνετε compile την πιο " +"πρόσφατη έκδοση της Python από τον πηγαίο κώδικα." #: using/unix.rst:23 msgid "" -"In the event that Python doesn't come preinstalled and isn't in the " -"repositories as well, you can easily make packages for your own distro. " -"Have a look at the following links:" +"In the event that the latest version of Python doesn't come preinstalled and " +"isn't in the repositories as well, you can make packages for your own " +"distro. Have a look at the following links:" msgstr "" +"Στην περίπτωση που η πιο πρόσφατη έκδοση Python δεν είναι προεγκατεστημένη " +"και επίσης δεν ανήκει στα αποθετήρια, μπορείτε να δημιουργήσετε πακέτα για " +"τη δική σας διανομή. Δείτε τα παρακάτω links:" #: using/unix.rst:29 msgid "https://www.debian.org/doc/manuals/maint-guide/first.en.html" -msgstr "" +msgstr "https://www.debian.org/doc/manuals/maint-guide/first.en.html" #: using/unix.rst:30 msgid "for Debian users" -msgstr "" +msgstr "για τους χρήστες του Debian" #: using/unix.rst:31 msgid "https://en.opensuse.org/Portal:Packaging" -msgstr "" +msgstr "https://en.opensuse.org/Portal:Packaging" #: using/unix.rst:32 msgid "for OpenSuse users" -msgstr "" +msgstr "για τους χρήστες του OpenSuse" #: using/unix.rst:33 msgid "" "https://docs.fedoraproject.org/en-US/package-maintainers/" "Packaging_Tutorial_GNU_Hello/" msgstr "" +"https://docs.fedoraproject.org/en-US/package-maintainers/" +"Packaging_Tutorial_GNU_Hello/" #: using/unix.rst:34 msgid "for Fedora users" -msgstr "" +msgstr "για τους χρήστες του Fedora" #: using/unix.rst:35 msgid "https://slackbook.org/html/package-management-making-packages.html" -msgstr "" +msgstr "https://slackbook.org/html/package-management-making-packages.html" #: using/unix.rst:36 msgid "for Slackware users" +msgstr "για τους χρήστες του Slackware" + +#: using/unix.rst:41 +msgid "Installing IDLE" +msgstr "Εγκατάσταση του IDLE" + +#: using/unix.rst:43 +msgid "In some cases, IDLE might not be included in your Python installation." msgstr "" +"Σε μερικές περιπτώσεις, το IDLE μπορεί να μην περιλαμβάνεται στην " +"εγκατάσταση της Python." -#: using/unix.rst:40 -msgid "On FreeBSD and OpenBSD" +#: using/unix.rst:45 +msgid "For Debian and Ubuntu users::" +msgstr "Για τους χρήστες του Debian και του Ubuntu::" + +#: using/unix.rst:47 +msgid "" +"sudo apt update\n" +"sudo apt install idle" msgstr "" +"sudo apt update\n" +"sudo apt install idle" + +#: using/unix.rst:50 +msgid "For Fedora, RHEL, and CentOS users::" +msgstr "Για τους χρήστες των Fedora, RHEL, και CentOS::" + +#: using/unix.rst:52 +msgid "sudo dnf install python3-idle" +msgstr "sudo dnf install python3-idle" -#: using/unix.rst:42 +#: using/unix.rst:54 +msgid "For SUSE and OpenSUSE users::" +msgstr "Για τους χρήστες των SUSE και OpenSUSE::" + +#: using/unix.rst:56 +msgid "sudo zypper install python3-idle" +msgstr "sudo zypper install python3-idle" + +#: using/unix.rst:58 +msgid "For Alpine Linux users::" +msgstr "Για τους χρήστες του Alpine Linux::" + +#: using/unix.rst:60 +msgid "sudo apk add python3-idle" +msgstr "sudo apk add python3-idle" + +#: using/unix.rst:65 +msgid "On FreeBSD and OpenBSD" +msgstr "Σε FreeBSD και OpenBSD" + +#: using/unix.rst:67 msgid "FreeBSD users, to add the package use::" -msgstr "" +msgstr "Χρήστες του FreeBSD, για την προσθήκη του πακέτου χρησιμοποιήστε::" + +#: using/unix.rst:69 +msgid "pkg install python3" +msgstr "pkg install python3" -#: using/unix.rst:46 +#: using/unix.rst:71 msgid "OpenBSD users, to add the package use::" +msgstr "Χρήστες του OpenBSD, για την προσθήκη του πακέτου χρησιμοποιήστε::" + +#: using/unix.rst:73 +msgid "" +"pkg_add -r python\n" +"\n" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages//python-.tgz" msgstr "" +"pkg_add -r python\n" +"\n" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages//python-.tgz" -#: using/unix.rst:52 +#: using/unix.rst:77 msgid "For example i386 users get the 2.5.1 version of Python using::" msgstr "" +"Για παράδειγμα, χρήστες του i386 κάνουν λήψη της έκδοσης 2.5.1 " +"χρησιμοποιώντας::" -#: using/unix.rst:60 +#: using/unix.rst:79 +msgid "" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." +"tgz" +msgstr "" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." +"tgz" + +#: using/unix.rst:85 msgid "Building Python" +msgstr "Μεταγλώττιση της Python" + +#: using/unix.rst:89 +msgid "" +"If you want to contribute to CPython, refer to the `devguide `_, which includes build " +"instructions and other tips on setting up environment." msgstr "" +"Αν θέλετε να συνεισφέρετε στο CPython, ανατρέξτε στον `devguide `_, που περιλαμβάνει " +"οδηγίες μεταγλώττισης και άλλες συμβουλές για τη ρύθμιση του περιβάλλοντος." -#: using/unix.rst:62 +#: using/unix.rst:93 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source `_. You can download " -"either the latest release's source or just grab a fresh `clone `_. (If you want to " -"contribute patches, you will need a clone.)" -msgstr "" - -#: using/unix.rst:68 +"either the latest release's source or grab a fresh `clone `_. You will also need to install the :" +"ref:`build requirements `." +msgstr "" +"Αν θέλετε να κάνετε compile το CPython μόνοι σας, το πρώτο πράγμα που πρέπει " +"να κάνετε είναι να πάρετε τον `πηγαίο κώδικα `_. Μπορείτε να κατεβάσετε είτε τον πηγαίο κώδικα της " +"τελευταίας έκδοσης είτε απλά να πάρετε έναν καινούργιο `clone `_. Θα χρειαστεί επίσης να " +"εγκαταστήσετε τις :ref:`build requirements `." + +#: using/unix.rst:99 msgid "The build process consists of the usual commands::" +msgstr "Η διαδικασία της μεταγλώττισης απαρτίζεται από τις συνήθεις εντολές::" + +#: using/unix.rst:101 +msgid "" +"./configure\n" +"make\n" +"make install" msgstr "" +"./configure\n" +"make\n" +"make install" -#: using/unix.rst:74 +#: using/unix.rst:105 msgid "" ":ref:`Configuration options ` and caveats for specific " "Unix platforms are extensively documented in the :source:`README.rst` file " "in the root of the Python source tree." msgstr "" +"Το :ref:`Configuration options ` και οι όροι για " +"συγκεκριμένες πλατφόρμες Unix τεκμηριώνονται εκτενώς στο αρχείο :source:" +"`README.rst` στην βάση του πηγαίου δέντρου της Python." -#: using/unix.rst:80 +#: using/unix.rst:111 msgid "" "``make install`` can overwrite or masquerade the :file:`python3` binary. " "``make altinstall`` is therefore recommended instead of ``make install`` " "since it only installs :file:`{exec_prefix}/bin/python{version}`." msgstr "" +"Το ``make install`` μπορεί να αντικαταστήσει ή να μεταμφιέσει το :file:" +"`python3` σε δυαδικό. Επομένως προτείνεται το ``make altinstall`` σε σχέση " +"με το ``make install`` που μπορεί να εγκαταστήσει μόνο το :file:" +"`{exec_prefix}/bin/python{version}`." -#: using/unix.rst:86 +#: using/unix.rst:117 msgid "Python-related paths and files" -msgstr "" +msgstr "Διαδρομές και αρχεία που σχετίζονται με την Python" -#: using/unix.rst:88 +#: using/unix.rst:119 msgid "" "These are subject to difference depending on local installation " "conventions; :option:`prefix <--prefix>` and :option:`exec_prefix <--exec-" "prefix>` are installation-dependent and should be interpreted as for GNU " "software; they may be the same." msgstr "" +"Αυτά ενδέχεται να διαφέρουν ανάλογα με τις τοπικές συμβάσεις εγκατάστασης∙ " +"τα :option:`prefix <--prefix>` και :option:`exec_prefix <--exec-prefix>` " +"εξαρτώνται από την εγκατάσταση και θα πρέπει να ερμηνεύονται όπως για το " +"λογισμικό GNU∙ μπορεί να είναι τα ίδια." -#: using/unix.rst:93 +#: using/unix.rst:124 msgid "" "For example, on most Linux systems, the default for both is :file:`/usr`." msgstr "" +"Για παράδειγμα, στα περισσότερα Linux συστήματα, η προεπιλογή είναι και για " +"τα δύο :file:`/usr`." -#: using/unix.rst:96 +#: using/unix.rst:127 msgid "File/directory" -msgstr "" +msgstr "File/directory" -#: using/unix.rst:96 +#: using/unix.rst:127 msgid "Meaning" -msgstr "" +msgstr "Που σημαίνει" -#: using/unix.rst:98 +#: using/unix.rst:129 msgid ":file:`{exec_prefix}/bin/python3`" -msgstr "" +msgstr ":file:`{exec_prefix}/bin/python3`" -#: using/unix.rst:98 +#: using/unix.rst:129 msgid "Recommended location of the interpreter." -msgstr "" +msgstr "Προτεινόμενη θέση του διερμηνέα." -#: using/unix.rst:100 +#: using/unix.rst:131 msgid "" ":file:`{prefix}/lib/python{version}`, :file:`{exec_prefix}/lib/" "python{version}`" msgstr "" +":file:`{prefix}/lib/python{version}`, :file:`{exec_prefix}/lib/" +"python{version}`" -#: using/unix.rst:100 +#: using/unix.rst:131 msgid "" "Recommended locations of the directories containing the standard modules." msgstr "" +"Προτεινόμενες θέσεις για τους καταλόγους που περιέχουν τα βασικά modules." -#: using/unix.rst:103 +#: using/unix.rst:134 msgid "" ":file:`{prefix}/include/python{version}`, :file:`{exec_prefix}/include/" "python{version}`" msgstr "" +":file:`{prefix}/include/python{version}`, :file:`{exec_prefix}/include/" +"python{version}`" -#: using/unix.rst:103 +#: using/unix.rst:134 msgid "" "Recommended locations of the directories containing the include files needed " "for developing Python extensions and embedding the interpreter." msgstr "" +"Προτεινόμενες θέσεις των καταλόγων που περιέχουν τα αρχεία κεφαλίδων " +"(include files) που απαιτούνται για την ανάπτυξη επεκτάσεων της Python και " +"την ενσωμάτωση του διερμηνέα." -#: using/unix.rst:111 +#: using/unix.rst:142 msgid "Miscellaneous" -msgstr "" +msgstr "Διάφορα" -#: using/unix.rst:113 +#: using/unix.rst:144 msgid "" "To easily use Python scripts on Unix, you need to make them executable, e.g. " "with" msgstr "" +"Για να εκτελείτε εύκολα τα Python scripts σε συστήματα Unix, πρέπει να τα " +"κάνετε εκτελέσιμα, για παράδειγμα με" -#: using/unix.rst:120 +#: using/unix.rst:147 +msgid "$ chmod +x script" +msgstr "$ chmod +x script" + +#: using/unix.rst:151 msgid "" "and put an appropriate Shebang line at the top of the script. A good choice " "is usually ::" msgstr "" +"και να προσθέσετε μια κατάλληλη γραμμή Shebang στην αρχή του script. Μια " +"καλή επιλογή είναι συνήθως ::" + +#: using/unix.rst:154 +msgid "#!/usr/bin/env python3" +msgstr "#!/usr/bin/env python3" -#: using/unix.rst:125 +#: using/unix.rst:156 msgid "" "which searches for the Python interpreter in the whole :envvar:`PATH`. " "However, some Unices may not have the :program:`env` command, so you may " "need to hardcode ``/usr/bin/python3`` as the interpreter path." msgstr "" +"που κάνει αναζήτηση για τον διερμηνέα της Python σε ολόκληρο το :envvar:" +"`PATH`. Ωστόσο, ορισμένα Unices μπορεί να μην έχουν την εντολή :program:" +"`env`, οπότε μπορεί να χρειαστεί να κωδικοποιήσετε το ``/usr/bin/python3`` " +"ως διαδρομή του διερμηνέα." -#: using/unix.rst:129 +#: using/unix.rst:160 msgid "" "To use shell commands in your Python scripts, look at the :mod:`subprocess` " "module." msgstr "" +"Για να χρησιμοποιήσετε εντολές shell στα Python script σας, δείτε την " +"ενότητα :mod:`subprocess`." -#: using/unix.rst:134 +#: using/unix.rst:165 msgid "Custom OpenSSL" -msgstr "" +msgstr "Custom OpenSSL" -#: using/unix.rst:136 +#: using/unix.rst:167 msgid "" "To use your vendor's OpenSSL configuration and system trust store, locate " "the directory with ``openssl.cnf`` file or symlink in ``/etc``. On most " @@ -221,22 +370,89 @@ msgid "" "directory should also contain a ``cert.pem`` file and/or a ``certs`` " "directory." msgstr "" +"Για να χρησιμοποιήσετε τις ρυθμίσεις του OpenSSL και το αποθετήριο " +"εμπιστοσύνης συστήματος, εντοπίστε τον κατάλογο με το αρχείο ``openssl.cnf`` " +"ή τον συμβολικό σύνδεσμο στο ``/etc``. Στις περισσότερες διανομές το αρχείο " +"βρίσκεται είτε στο ``/etc/ssl`` είτε στο ``/etc/pki/tls``. Ο κατάλογος θα " +"πρέπει επίσης να περιέχει ένα αρχείο ``cert.pem`` και/ή έναν κατάλογο " +"``certs``." -#: using/unix.rst:147 +#: using/unix.rst:173 +msgid "" +"$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" +"/etc/ssl" +msgstr "" +"$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" +"/etc/ssl" + +#: using/unix.rst:178 msgid "" "Download, build, and install OpenSSL. Make sure you use ``install_sw`` and " "not ``install``. The ``install_sw`` target does not override ``openssl.cnf``." msgstr "" +"Λήψη, δημιουργία και εγκατάσταση του OenSSL. Βεβαιωθείτε ότι χρησιμοποιείτε " +"το ``install_sw`` και όχι το ``install``. Ο στόχος ``install_sw`` δεν " +"παρακάμπτει το αρχείο ``openssl.cnf``." -#: using/unix.rst:165 +#: using/unix.rst:182 +msgid "" +"$ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz\n" +"$ tar xzf openssl-VERSION\n" +"$ pushd openssl-VERSION\n" +"$ ./config \\\n" +" --prefix=/usr/local/custom-openssl \\\n" +" --libdir=lib \\\n" +" --openssldir=/etc/ssl\n" +"$ make -j1 depend\n" +"$ make -j8\n" +"$ make install_sw\n" +"$ popd" +msgstr "" +"$ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz\n" +"$ tar xzf openssl-VERSION\n" +"$ pushd openssl-VERSION\n" +"$ ./config \\\n" +" --prefix=/usr/local/custom-openssl \\\n" +" --libdir=lib \\\n" +" --openssldir=/etc/ssl\n" +"$ make -j1 depend\n" +"$ make -j8\n" +"$ make install_sw\n" +"$ popd" + +#: using/unix.rst:196 msgid "" "Build Python with custom OpenSSL (see the configure ``--with-openssl`` and " "``--with-openssl-rpath`` options)" msgstr "" +"Μεταγλώττιση της Python με προσαρμοσμένο OpenSSL (δείτε τις επιλογές " +"configure ``----with-openssl`` και ``----with-openssl-rpath``)" -#: using/unix.rst:180 +#: using/unix.rst:199 +msgid "" +"$ pushd python-3.x.x\n" +"$ ./configure -C \\\n" +" --with-openssl=/usr/local/custom-openssl \\\n" +" --with-openssl-rpath=auto \\\n" +" --prefix=/usr/local/python-3.x.x\n" +"$ make -j8\n" +"$ make altinstall" +msgstr "" +"$ pushd python-3.x.x\n" +"$ ./configure -C \\\n" +" --with-openssl=/usr/local/custom-openssl \\\n" +" --with-openssl-rpath=auto \\\n" +" --prefix=/usr/local/python-3.x.x\n" +"$ make -j8\n" +"$ make altinstall" + +#: using/unix.rst:211 msgid "" "Patch releases of OpenSSL have a backwards compatible ABI. You don't need to " "recompile Python to update OpenSSL. It's sufficient to replace the custom " "OpenSSL installation with a newer version." msgstr "" +"Οι διορθωτικές εκδόσεις του OpenSSL έχουν μια δυαδική διεπαφή εφαρμογής " +"(ABI) συμβατή προς τα πίσω. Δεν χρειάζεται να κάνετε compile εκ νέου την " +"Python για να ενημερώσετε το OpenSSL. Αρκεί να αντικαταστήσετε την " +"προσαρμοσμένη εγκατάσταση του OpenSSL με μια νεότερη έκδοση." diff --git a/using/windows.po b/using/windows.po index 7f6a56cb..7f5ef259 100644 --- a/using/windows.po +++ b/using/windows.po @@ -8,864 +8,1981 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: 2025-11-04 21:13+0200\n" +"Last-Translator: Panagiotis Skias \n" +"Language-Team: PyGreece \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: using/windows.rst:7 +#: using/windows.rst:13 msgid "Using Python on Windows" -msgstr "" +msgstr "Χρησιμοποιώντας Python στα Windows" -#: using/windows.rst:12 +#: using/windows.rst:17 msgid "" "This document aims to give an overview of Windows-specific behaviour you " "should know about when using Python on Microsoft Windows." msgstr "" +"Αυτό το έγγραφο στοχεύει να δώσει μια επισκόπηση της συμπεριφοράς των " +"Windows που πρέπει να γνωρίζετε, όταν χρησιμοποιείτε την Python στα " +"Microsoft Windows." -#: using/windows.rst:15 +#: using/windows.rst:20 msgid "" "Unlike most Unix systems and services, Windows does not include a system " -"supported installation of Python. To make Python available, the CPython team " -"has compiled Windows installers with every `release `_ for many years. These installers are primarily intended to add " -"a per-user installation of Python, with the core interpreter and library " -"being used by a single user. The installer is also able to install for all " -"users of a single machine, and a separate ZIP file is available for " -"application-local distributions." -msgstr "" +"supported installation of Python. Instead, Python can be obtained from a " +"number of distributors, including directly from the CPython team. Each " +"Python distribution will have its own benefits and drawbacks, however, " +"consistency with other tools you are using is generally a worthwhile " +"benefit. Before committing to the process described here, we recommend " +"investigating your existing tools to see if they can provide Python directly." +msgstr "" +"Σε αντίθεση με τα περισσότερα συστήματα και υπηρεσίες Unix, τα Windows δεν " +"περιλαμβάνουν μια υποστηριζόμενη από το σύστημα εγκατάσταση της Python. " +"Αντίθετα, η Python μπορεί να αποκτηθεί από αρκετούς διανομείς, " +"συμπεριλαμβανομένης της άμεσης λήψης από την ομάδα CPython. Κάθε διανομή " +"Python θα έχει τα δικά της πλεονεκτήματα και μειονεκτήματα, ωστόσο, η " +"συνέπεια με άλλα εργαλεία που χρησιμοποιείτε είναι γενικά ένα αξιόλογο " +"πλεονέκτημα. Πριν δεσμευτείτε στη διαδικασία που περιγράφεται εδώ, " +"συνιστούμε να ερευνήσετε τα υπάρχοντα εργαλεία σας για να δείτε αν μπορούν " +"να παρέχουν την Python απευθείας." + +#: using/windows.rst:28 +msgid "" +"To obtain Python from the CPython team, use the Python Install Manager. This " +"is a standalone tool that makes Python available as global commands on your " +"Windows machine, integrates with the system, and supports updates over time. " +"You can download the Python Install Manager from `python.org/downloads`_ or " +"through the `Microsoft Store app`_." +msgstr "" +"Για να αποκτήσετε την Python από την ομάδα CPython, χρησιμοποιήστε τον " +"Python Install Manager. Αυτό είναι ένα αυτόνομο εργαλείο που καθιστά την " +"Python διαθέσιμη ως παγκόσμιες εντολές στον υπολογιστή σας με Windows, " +"ενσωματώνεται με το σύστημα και υποστηρίζει ενημερώσεις με την πάροδο του " +"χρόνου. Μπορείτε να κατεβάσετε τον Python Install Manager από το `python.org/" +"downloads`_ ή μέσω του `Microsoft Store app`_." + +#: using/windows.rst:34 +msgid "" +"Once you have installed the Python Install Manager, the global ``python`` " +"command can be used from any terminal to launch your current latest version " +"of Python. This version may change over time as you add or remove different " +"versions, and the ``py list`` command will show which is current." +msgstr "" +"Μόλις εγκαταστήσετε τον Python Install Manager, η παγκόσμια εντολή " +"``python`` μπορεί να χρησιμοποιηθεί από οποιοδήποτε τερματικό για να " +"εκκινήσει την τρέχουσα τελευταία έκδοση της Python. Αυτή η έκδοση μπορεί να " +"αλλάξει με την πάροδο του χρόνου καθώς προσθέτετε ή αφαιρείτε διαφορετικές " +"εκδόσεις, και η εντολή ``py list`` θα δείξει ποια είναι η τρέχουσα." + +#: using/windows.rst:39 +msgid "" +"In general, we recommend that you create a :ref:`virtual environment ` for each project and run ``\\Scripts\\Activate`` in your " +"terminal to use it. This provides isolation between projects, consistency " +"over time, and ensures that additional commands added by packages are also " +"available in your session. Create a virtual environment using ``python -m " +"venv ``." +msgstr "" +"Γενικά, συνιστούμε να δημιουργήσετε ένα :ref:`εικονικό περιβάλλον ` για κάθε έργο και να εκτελέσετε ``\\Scripts\\Activate`` στο " +"τερματικό σας για να το χρησιμοποιήσετε. Αυτό παρέχει απομόνωση μεταξύ των " +"έργων, συνέπεια με την πάροδο του χρόνου και διασφαλίζει ότι οι επιπλέον " +"εντολές που προστίθενται από τα πακέτα είναι επίσης διαθέσιμες στη συνεδρία " +"σας. Δημιουργήστε ένα εικονικό περιβάλλον χρησιμοποιώντας ``python -m venv " +"``." -#: using/windows.rst:24 +#: using/windows.rst:45 msgid "" -"As specified in :pep:`11`, a Python release only supports a Windows platform " -"while Microsoft considers the platform under extended support. This means " -"that Python |version| supports Windows 8.1 and newer. If you require Windows " -"7 support, please install Python 3.8." +"If the ``python`` or ``py`` commands do not seem to be working, please see " +"the :ref:`Troubleshooting ` section below. There are " +"sometimes additional manual steps required to configure your PC." msgstr "" +"Εάν οι εντολές ``python`` ή ``py`` δεν φαίνεται να λειτουργούν, παρακαλούμε " +"δείτε την ενότητα :ref:`Επίλυση προβλημάτων ` " +"παρακάτω. Υπάρχουν μερικές φορές επιπλέον χειροκίνητα βήματα που απαιτούνται " +"για τη διαμόρφωση του υπολογιστή σας." -#: using/windows.rst:29 +#: using/windows.rst:49 msgid "" -"There are a number of different installers available for Windows, each with " -"certain benefits and downsides." +"Apart from using the Python install manager, Python can also be obtained as " +"NuGet packages. See :ref:`windows-nuget` below for more information on these " +"packages." msgstr "" +"Εκτός από τη χρήση του διαχειριστή εγκατάστασης Python, η Python μπορεί " +"επίσης να αποκτηθεί ως πακέτο NuGet. Δείτε :ref:`windows-nuget` παρακάτω για " +"περισσότερες πληροφορίες σχετικά με αυτά τα πακέτα." -#: using/windows.rst:32 +#: using/windows.rst:53 msgid "" -":ref:`windows-full` contains all components and is the best option for " -"developers using Python for any kind of project." +"The embeddable distros are minimal packages of Python suitable for embedding " +"into larger applications. They can be installed using the Python install " +"manager. See :ref:`windows-embeddable` below for more information on these " +"packages." msgstr "" +"Οι ενσωματώσιμες διανομές είναι ελάχιστα πακέτα της Python κατάλληλα για " +"ενσωμάτωση σε μεγαλύτερες εφαρμογές. Μπορούν να εγκατασταθούν " +"χρησιμοποιώντας τον διαχειριστή εγκατάστασης Python. Δείτε :ref:`windows-" +"embeddable` παρακάτω για περισσότερες πληροφορίες σχετικά με αυτά τα πακέτα." + +#: using/windows.rst:66 +msgid "Python install manager" +msgstr "Διαχειριστής εγκατάστασης Python" -#: using/windows.rst:35 +#: using/windows.rst:69 +msgid "Installation" +msgstr "Εγκατάσταση" + +#: using/windows.rst:71 msgid "" -":ref:`windows-store` is a simple installation of Python that is suitable for " -"running scripts and packages, and using IDLE or other development " -"environments. It requires Windows 10 and above, but can be safely installed " -"without corrupting other programs. It also provides many convenient commands " -"for launching Python and its tools." +"The Python install manager can be installed from the `Microsoft Store app`_ " +"or downloaded and installed from `python.org/downloads`_. The two versions " +"are identical." msgstr "" +"Ο διαχειριστής εγκατάστασης Python μπορεί να εγκατασταθεί από την εφαρμογή " +"`Microsoft Store app`_ ή να ληφθεί και να εγκατασταθεί από το `python.org/" +"downloads`_. Οι δύο εκδόσεις είναι ταυτόσημες." -#: using/windows.rst:41 +#: using/windows.rst:75 msgid "" -":ref:`windows-nuget` are lightweight installations intended for continuous " -"integration systems. It can be used to build Python packages or run scripts, " -"but is not updateable and has no user interface tools." +"To install through the Store, simply click \"Install\". After it has " +"completed, open a terminal and type ``python`` to get started." msgstr "" +"Για να εγκαταστήσετε μέσω του Store, απλώς κάντε κλικ στο \"Εγκατάσταση\". " +"Αφού ολοκληρωθεί, ανοίξτε ένα τερματικό και πληκτρολογήστε ``python`` για να " +"ξεκινήσετε." -#: using/windows.rst:45 +#: using/windows.rst:78 msgid "" -":ref:`windows-embeddable` is a minimal package of Python suitable for " -"embedding into a larger application." +"To install the file downloaded from python.org, either double-click and " +"select \"Install\", or run ``Add-AppxPackage `` in Windows " +"Powershell." msgstr "" +"Για να εγκαταστήσετε το αρχείο που κατεβάσατε από το python.org, είτε κάντε " +"διπλό κλικ και επιλέξτε \"Εγκατάσταση\", είτε εκτελέστε ``Add-AppxPackage " +"<διαδρομή προς MSIX>`` στα Windows Powershell." -#: using/windows.rst:52 -msgid "The full installer" -msgstr "" +#: using/windows.rst:81 +msgid "" +"After installation, the ``python``, ``py``, and ``pymanager`` commands " +"should be available. If you have existing installations of Python, or you " +"have modified your :envvar:`PATH` variable, you may need to remove them or " +"undo the modifications. See :ref:`pymanager-troubleshoot` for more help with " +"fixing non-working commands." +msgstr "" +"Μετά την εγκατάσταση, οι εντολές ``python``, ``py`` και ``pymanager`` θα " +"πρέπει να είναι διαθέσιμες. Αν έχετε υπάρχουσες εγκαταστάσεις της Python, ή " +"έχετε τροποποιήσει τη μεταβλητή :envvar:`PATH`, ίσως χρειαστεί να τις " +"αφαιρέσετε ή να αναιρέσετε τις τροποποιήσεις. Δείτε :ref:`pymanager-" +"troubleshoot` για περισσότερη βοήθεια σχετικά με την αποκατάσταση μη " +"λειτουργικών εντολών." + +#: using/windows.rst:87 +msgid "" +"When you first install a runtime, you will likely be prompted to add a " +"directory to your :envvar:`PATH`. This is optional, if you prefer to use the " +"``py`` command, but is offered for those who prefer the full range of " +"aliases (such as ``python3.14.exe``) to be available. The directory will be :" +"file:`%LocalAppData%\\\\Python\\\\bin` by default, but may be customized by " +"an administrator. Click Start and search for \"Edit environment variables " +"for your account\" for the system settings page to add the path." +msgstr "" +"Όταν εγκαθιστάτε για πρώτη φορά ένα runtime, πιθανότατα θα σας ζητηθεί να " +"προσθέσετε έναν φάκελο στη μεταβλητή :envvar:`PATH`. Αυτό είναι προαιρετικό, " +"αν προτιμάτε να χρησιμοποιήσετε την εντολή ``py``, αλλά προσφέρεται για " +"όσους προτιμούν να είναι διαθέσιμη η πλήρης γκάμα ψευδωνύμων (όπως το " +"``python3.14.exe``). Ο φάκελος θα είναι :file:`%LocalAppData%\\\\Python\\" +"\\bin` από προεπιλογή, αλλά μπορεί να προσαρμοστεί από έναν διαχειριστή. " +"Κάντε κλικ στο Έναρξη και αναζητήστε \"Επεξεργασία μεταβλητών περιβάλλοντος " +"για τον λογαριασμό σας\" για τη σελίδα ρυθμίσεων συστήματος για να " +"προσθέσετε τη διαδρομή." + +#: using/windows.rst:95 +msgid "" +"Each Python runtime you install will have its own directory for scripts. " +"These also need to be added to :envvar:`PATH` if you want to use them." +msgstr "" +"Κάθε runtime της Python που εγκαθιστάτε θα έχει το δικό του φάκελο για " +"σενάρια. Αυτά πρέπει επίσης να προστεθούν στη μεταβλητή :envvar:`PATH` αν " +"θέλετε να τα χρησιμοποιήσετε." + +#: using/windows.rst:98 +msgid "" +"The Python install manager will be automatically updated to new releases. " +"This does not affect any installs of Python runtimes. Uninstalling the " +"Python install manager does not uninstall any Python runtimes." +msgstr "" +"Ο διαχειριστής εγκατάστασης Python θα ενημερώνεται αυτόματα σε νέες " +"εκδόσεις. Αυτό δεν επηρεάζει καμία εγκατάσταση runtime της Python. Η " +"απεγκατάσταση του διαχειριστή εγκατάστασης Python δεν απεγκαθιστά καμία " +"εγκατάσταση runtime της Python." + +#: using/windows.rst:102 +msgid "" +"If you are not able to install an MSIX in your context, for example, you are " +"using automated deployment software that does not support it, or are " +"targeting Windows Server 2019, please see :ref:`pymanager-advancedinstall` " +"below for more information." +msgstr "" +"Εάν δεν μπορείτε να εγκαταστήσετε ένα MSIX στο πλαίσιο σας, για παράδειγμα, " +"χρησιμοποιείτε λογισμικό αυτοματοποιημένης ανάπτυξης που δεν το υποστηρίζει, " +"ή στοχεύετε τα Windows Server 2019, παρακαλώ δείτε :ref:`pymanager-" +"advancedinstall` παρακάτω για περισσότερες πληροφορίες." + +#: using/windows.rst:109 +msgid "Basic use" +msgstr "Βασική χρήση" + +#: using/windows.rst:111 +msgid "" +"The recommended command for launching Python is ``python``, which will " +"either launch the version requested by the script being launched, an active " +"virtual environment, or the default installed version, which will be the " +"latest stable release unless configured otherwise. If no version is " +"specifically requested and no runtimes are installed at all, the current " +"latest release will be installed automatically." +msgstr "" +"Η συνιστώμενη εντολή για την εκκίνηση της Python είναι ``python``, η οποία " +"θα εκκινήσει είτε την έκδοση που ζητείται από το σενάριο που εκκινείται, " +"είτε ένα ενεργό εικονικό περιβάλλον, είτε την προεπιλεγμένη εγκατεστημένη " +"έκδοση, η οποία θα είναι η τελευταία σταθερή έκδοση εκτός αν έχει ρυθμιστεί " +"διαφορετικά. Εάν δεν ζητηθεί συγκεκριμένα καμία έκδοση και δεν είναι " +"εγκατεστημένες καθόλου εκδόσεις, η τρέχουσα τελευταία έκδοση θα εγκατασταθεί " +"αυτόματα." + +#: using/windows.rst:118 +msgid "" +"For all scenarios involving multiple runtime versions, the recommended " +"command is ``py``. This may be used anywhere in place of ``python`` or the " +"older ``py.exe`` launcher. By default, ``py`` matches the behaviour of " +"``python``, but also allows command line options to select a specific " +"version as well as subcommands to manage installations. These are detailed " +"below." +msgstr "" +"Για όλα τα σενάρια που περιλαμβάνουν πολλαπλές εκδόσεις runtime, η " +"συνιστώμενη εντολή είναι ``py``. Αυτή μπορεί να χρησιμοποιηθεί οπουδήποτε " +"αντί για ``python`` ή τον παλαιότερο εκκινητή ``py.exe``. Από προεπιλογή, το " +"``py`` ταιριάζει με τη συμπεριφορά του ``python``, αλλά επιτρέπει επίσης " +"επιλογές γραμμής εντολών για την επιλογή μιας συγκεκριμένης έκδοσης, καθώς " +"και υποεντολές για τη διαχείριση εγκαταστάσεων. Αυτές περιγράφονται " +"λεπτομερώς παρακάτω." -#: using/windows.rst:55 -msgid "Installation steps" -msgstr "" +#: using/windows.rst:124 +msgid "" +"Because the ``py`` command may already be taken by the previous version, " +"there is also an unambiguous ``pymanager`` command. Scripted installs that " +"are intending to use Python install manager should consider using " +"``pymanager``, due to the lower chance of encountering a conflict with " +"existing installs. The only difference between the two commands is when " +"running without any arguments: ``py`` will install and launch your default " +"interpreter, while ``pymanager`` will display help (``pymanager exec ...`` " +"provides equivalent behaviour to ``py ...``)." +msgstr "" +"Επειδή η εντολή ``py`` μπορεί ήδη να χρησιμοποιείται από την προηγούμενη " +"έκδοση, υπάρχει επίσης μια αναμφισβήτητη εντολή ``pymanager``. Οι " +"αυτοματοποιημένες εγκαταστάσεις που σκοπεύουν να χρησιμοποιήσουν τον " +"διαχειριστή εγκατάστασης Python θα πρέπει να εξετάσουν τη χρήση του " +"``pymanager``, λόγω της χαμηλότερης πιθανότητας να προκύψει σύγκρουση με " +"υπάρχουσες εγκαταστάσεις. Η μόνη διαφορά μεταξύ των δύο εντολών είναι όταν " +"εκτελούνται χωρίς κανένα επιχείρημα: ``py`` θα εγκαταστήσει και θα εκκινήσει " +"τον προεπιλεγμένο διερμηνέα σας, ενώ το ``pymanager`` θα εμφανίσει βοήθεια " +"(``pymanager exec ...`` παρέχει ισοδύναμη συμπεριφορά με το ``py ...``)." + +#: using/windows.rst:133 +msgid "" +"Each of these commands also has a windowed version that avoids creating a " +"console window. These are ``pyw``, ``pythonw`` and ``pymanagerw``. A " +"``python3`` command is also included that mimics the ``python`` command. It " +"is intended to catch accidental uses of the typical POSIX command on " +"Windows, but is not meant to be widely used or recommended." +msgstr "" +"Κάθε μία από αυτές τις εντολές έχει επίσης μια έκδοση με παράθυρο που " +"αποφεύγει τη δημιουργία ενός παραθύρου κονσόλας. Αυτές είναι οι ``pyw``, " +"``pythonw`` και ``pymanagerw``. Μια εντολή ``python3`` περιλαμβάνεται επίσης " +"που μιμείται την εντολή ``python``. Είναι σχεδιασμένη να συλλαμβάνει τυχαίες " +"χρήσεις της τυπικής εντολής POSIX σε Windows, αλλά δεν προορίζεται να " +"χρησιμοποιείται ευρέως ή να συνιστάται." -#: using/windows.rst:57 +#: using/windows.rst:139 msgid "" -"Four Python |version| installers are available for download - two each for " -"the 32-bit and 64-bit versions of the interpreter. The *web installer* is a " -"small initial download, and it will automatically download the required " -"components as necessary. The *offline installer* includes the components " -"necessary for a default installation and only requires an internet " -"connection for optional features. See :ref:`install-layout-option` for other " -"ways to avoid downloading during installation." +"To launch your default runtime, run ``python`` or ``py`` with the arguments " +"you want to be passed to the runtime (such as script files or the module to " +"launch):" msgstr "" +"Για να εκκινήσετε το προεπιλεγμένο χρόνο εκτέλεσης σας, εκτελέστε το " +"``python`` ή το ``py`` με τα ορίσματα που θέλετε να περαστούν στο χρόνο " +"εκτέλεσης (όπως αρχεία σεναρίων ή το module για εκκίνηση):" -#: using/windows.rst:65 -msgid "After starting the installer, one of two options may be selected:" +#: using/windows.rst:142 +msgid "" +"$> py\n" +"...\n" +"$> python my-script.py\n" +"...\n" +"$> py -m this\n" +"..." msgstr "" +"$> py\n" +"...\n" +"$> python my-script.py\n" +"...\n" +"$> py -m this\n" +"..." -#: using/windows.rst:69 -msgid "If you select \"Install Now\":" +#: using/windows.rst:151 +msgid "" +"The default runtime can be overridden with the :envvar:" +"`PYTHON_MANAGER_DEFAULT` environment variable, or a configuration file. See :" +"ref:`pymanager-config` for information about configuration settings." msgstr "" +"Ο προεπιλεγμένος χρόνος εκτέλεσης μπορεί να παρακαμφθεί με τη μεταβλητή " +"περιβάλλοντος :envvar:`PYTHON_MANAGER_DEFAULT`, ή ένα αρχείο διαμόρφωσης. " +"Δείτε :ref:`pymanager-config` για πληροφορίες σχετικά με τις ρυθμίσεις " +"διαμόρφωσης." -#: using/windows.rst:71 +#: using/windows.rst:155 msgid "" -"You will *not* need to be an administrator (unless a system update for the C " -"Runtime Library is required or you install the :ref:`launcher` for all users)" +"To launch a specific runtime, the ``py`` command accepts a ``-V:`` " +"option. This option must be specified before any others. The tag is part or " +"all of the identifier for the runtime; for those from the CPython team, it " +"looks like the version, potentially with the platform. For compatibility, " +"the ``V:`` may be omitted in cases where the tag refers to an official " +"release and starts with ``3``." msgstr "" +"Για να εκκινήσετε ένα συγκεκριμένο χρόνο εκτέλεσης, η εντολή ``py`` δέχεται " +"μια επιλογή ``-V:``. Αυτή η επιλογή πρέπει να καθοριστεί πριν από " +"οποιεσδήποτε άλλες. Το tag είναι μέρος ή όλο το αναγνωριστικό για το χρόνο " +"εκτέλεσης. Για αυτά από την ομάδα CPython, μοιάζει με την έκδοση, πιθανώς με " +"την πλατφόρμα. Για λόγους συμβατότητας, το ``V:`` μπορεί να παραλειφθεί σε " +"περιπτώσεις όπου το tag αναφέρεται σε μια επίσημη έκδοση και ξεκινά με ``3``." -#: using/windows.rst:74 -msgid "Python will be installed into your user directory" +#: using/windows.rst:162 +msgid "" +"$> py -V:3.14 ...\n" +"$> py -V:3-arm64 ..." msgstr "" +"$> py -V:3.14 ...\n" +"$> py -V:3-arm64 ..." -#: using/windows.rst:75 +#: using/windows.rst:167 msgid "" -"The :ref:`launcher` will be installed according to the option at the bottom " -"of the first page" +"Runtimes from other distributors may require the *company* to be included as " +"well. This should be separated from the tag by a slash, and may be a prefix. " +"Specifying the company is optional when it is ``PythonCore``, and specifying " +"the tag is optional (but not the slash) when you want the latest release " +"from a specific company." msgstr "" +"Οι χρόνοι εκτέλεσης από άλλους διανομείς μπορεί να απαιτούν να συμπεριληφθεί " +"και η *εταιρεία*. Αυτό θα πρέπει να διαχωρίζεται από το tag με μια κάθετο, " +"και μπορεί να είναι ένα πρόθεμα. Η καθορισμός της εταιρείας είναι " +"προαιρετικός όταν είναι ``PythonCore``, και η καθορισμός του tag είναι " +"προαιρετικός (αλλά όχι η κάθετος) όταν θέλετε την τελευταία έκδοση για μια " +"συγκεκριμένη εταιρεία." -#: using/windows.rst:77 -msgid "The standard library, test suite, launcher and pip will be installed" +#: using/windows.rst:173 +msgid "" +"$> py -V:Distributor\\1.0 ...\n" +"$> py -V:distrib/ ..." msgstr "" +"$> py -V:Distributor\\1.0 ...\n" +"$> py -V:distrib/ ..." -#: using/windows.rst:78 -msgid "If selected, the install directory will be added to your :envvar:`PATH`" +#: using/windows.rst:178 +msgid "" +"If no version is specified, but a script file is passed, the script will be " +"inspected for a *shebang line*. This is a special format for the first line " +"in a file that allows overriding the command. See :ref:`pymanager-shebang` " +"for more information. When there is no shebang line, or it cannot be " +"resolved, the script will be launched with the default runtime." msgstr "" +"Εάν δεν καθοριστεί καμία έκδοση, αλλά περαστεί ένα αρχείο σεναρίου, το " +"σενάριο θα επιθεωρηθεί για μια *shebang line*. Αυτό είναι μια ειδική μορφή " +"για την πρώτη γραμμή σε ένα αρχείο που επιτρέπει την παράκαμψη της εντολής. " +"Δείτε :ref:`pymanager-shebang` για περισσότερες πληροφορίες. Όταν δεν " +"υπάρχει shebang line, ή δεν μπορεί να επιλυθεί, το σενάριο θα εκκινήσει με " +"το προεπιλεγμένο χρόνο εκτέλεσης." -#: using/windows.rst:79 -msgid "Shortcuts will only be visible for the current user" -msgstr "" +#: using/windows.rst:184 +msgid "" +"If you are running in an active virtual environment, have not requested a " +"particular version, and there is no shebang line, the default runtime will " +"be that virtual environment. In this scenario, the ``python`` command was " +"likely already overridden and none of these checks occurred. However, this " +"behaviour ensures that the ``py`` command can be used interchangeably." +msgstr "" +"Εάν τρέχετε σε ένα ενεργό εικονικό περιβάλλον, δεν έχετε ζητήσει μια " +"συγκεκριμένη έκδοση, και δεν υπάρχει shebang line, το προεπιλεγμένο runtime " +"θα είναι αυτό το εικονικό περιβάλλον.Σε αυτό το σενάριο, η εντολή ``python`` " +"πιθανότατα είχε ήδη παρακαμφθεί και κανένας από αυτούς τους ελέγχους δεν " +"συνέβη. Ωστόσο, αυτή η συμπεριφορά διασφαλίζει ότι η εντολή ``py`` μπορεί να " +"χρησιμοποιηθεί εναλλακτικά." + +#: using/windows.rst:190 +msgid "" +"When you launch either ``python`` or ``py`` but do not have any runtimes " +"installed, and the requested version is the default, it will be installed " +"automatically and then launched. Otherwise, the requested version will be " +"installed if automatic installation is configured (most likely by setting " +"``PYTHON_MANAGER_AUTOMATIC_INSTALL`` to ``true``), or if the ``py exec`` or " +"``pymanager exec`` forms of the command were used." +msgstr "" +"Όταν εκκινείτε είτε το ``python`` είτε το ``py`` αλλά δεν έχετε " +"εγκατεστημένους χρόνους εκτέλεσης, και η ζητούμενη έκδοση είναι η " +"προεπιλεγμένη, θα εγκατασταθεί αυτόματα και στη συνέχεια θα εκκινήσει. " +"Διαφορετικά, η ζητούμενη έκδοση θα εγκατασταθεί εάν η αυτόματη εγκατάσταση " +"είναι ρυθμισμένη (πιθανότατα ορίζοντας το " +"``PYTHON_MANAGER_AUTOMATIC_INSTALL`` σε ``true``), ή εάν χρησιμοποιήθηκαν οι " +"μορφές ``py exec`` ή ``pymanager exec`` της εντολής." -#: using/windows.rst:81 +#: using/windows.rst:199 +msgid "Command help" +msgstr "Εντολή βοήθειας" + +#: using/windows.rst:201 msgid "" -"Selecting \"Customize installation\" will allow you to select the features " -"to install, the installation location and other options or post-install " -"actions. To install debugging symbols or binaries, you will need to use this " -"option." +"The ``py help`` command will display the full list of supported commands, " +"along with their options. Any command may be passed the ``-?`` option to " +"display its help, or its name passed to ``py help``." msgstr "" +"Η εντολή ``py help`` θα εμφανίσει την πλήρη λίστα των υποστηριζόμενων " +"εντολών, μαζί με τις επιλογές τους. Οποιαδήποτε εντολή μπορεί να περάσει την " +"επιλογή ``-?`` για να εμφανίσει τη βοήθειά της, ή το όνομά της μπορεί να " +"περαστεί στην εντολή ``py help``." -#: using/windows.rst:85 +#: using/windows.rst:205 msgid "" -"To perform an all-users installation, you should select \"Customize " -"installation\". In this case:" +"$> py help\n" +"$> py help install\n" +"$> py install /?" msgstr "" +"$> py help\n" +"$> py help install\n" +"$> py install /?" -#: using/windows.rst:88 -msgid "You may be required to provide administrative credentials or approval" +#: using/windows.rst:212 +msgid "" +"All commands support some common options, which will be shown by ``py " +"help``. These options must be specified after any subcommand. Specifying ``-" +"v`` or ``--verbose`` will increase the amount of output shown, and ``-vv`` " +"will increase it further for debugging purposes. Passing ``-q`` or ``--" +"quiet`` will reduce output, and ``-qq`` will reduce it further." msgstr "" +"Όλες οι εντολές υποστηρίζουν μερικές κοινές επιλογές, οι οποίες θα " +"εμφανιστούν από το ``py help``. Αυτές οι επιλογές πρέπει να καθοριστούν μετά " +"από οποιοδήποτε υποεντολή. Ο καθορισμός του ``-v`` ή ``--verbose`` θα " +"αυξήσει την ποσότητα της εμφανιζόμενης εξόδου, και ``-vv`` θα την αυξήσει " +"περαιτέρω για σκοπούς αποσφαλμάτωσης. Η μετάβαση του ``-q`` ή ``--quiet`` θα " +"μειώσει την έξοδο, και ``-qq`` θα την μειώσει περαιτέρω." -#: using/windows.rst:89 -msgid "Python will be installed into the Program Files directory" +#: using/windows.rst:218 +msgid "" +"The ``--config=`` option allows specifying a configuration file to " +"override multiple settings at once. See :ref:`pymanager-config` below for " +"more information about these files." msgstr "" +"Η επιλογή ``--config=`` επιτρέπει τον καθορισμό ενός αρχείου " +"διαμόρφωσης για να παρακαμφθούν πολλές ρυθμίσεις ταυτόχρονα. Δείτε :ref:" +"`pymanager-config` παρακάτω για περισσότερες πληροφορίες σχετικά με αυτά τα " +"αρχεία." -#: using/windows.rst:90 -msgid "The :ref:`launcher` will be installed into the Windows directory" -msgstr "" +#: using/windows.rst:224 +msgid "Listing runtimes" +msgstr "Καταχώριση χρόνων εκτέλεσης" -#: using/windows.rst:91 -msgid "Optional features may be selected during installation" +#: using/windows.rst:226 +msgid "" +"$> py list [-f=|--format=] [-1|--one] [--online|-s=|--source=] " +"[...]" msgstr "" +"$> py list [-f=|--format=] [-1|--one] [--online|-s=|--source=] " +"[...]" -#: using/windows.rst:92 -msgid "The standard library can be pre-compiled to bytecode" +#: using/windows.rst:230 +msgid "" +"The list of installed runtimes can be seen using ``py list``. A filter may " +"be added in the form of one or more tags (with or without company " +"specifier), and each may include a ``<``, ``<=``, ``>=`` or ``>`` prefix to " +"restrict to a range." msgstr "" +"Η λίστα των εγκατεστημένων χρόνων εκτέλεσης μπορεί να προβληθεί " +"χρησιμοποιώντας το ``py list``. Μπορεί να προστεθεί ένα φίλτρο με τη μορφή " +"ενός ή περισσότερων tags (με ή χωρίς καθοριστή εταιρείας), και το καθένα " +"μπορεί να περιλαμβάνει ένα πρόθεμα ``<``, ``<=``, ``>=`` ή ``>`` για " +"περιορισμό σε μια περιοχή." -#: using/windows.rst:93 +#: using/windows.rst:234 msgid "" -"If selected, the install directory will be added to the system :envvar:`PATH`" +"A range of formats are supported, and can be passed as the ``--" +"format=`` or ``-f `` option. Formats include ``table`` (a user " +"friendly table view), ``csv`` (comma-separated table), ``json`` (a single " +"JSON blob), ``jsonl`` (one JSON blob per result), ``exe`` (just the " +"executable path), ``prefix`` (just the prefix path)." msgstr "" +"Ένα εύρος μορφών υποστηρίζεται, και μπορεί να περαστεί ως η επιλογή ``--" +"format=`` ή ``-f ``. Οι μορφές περιλαμβάνουν ``table`` (μια φιλική " +"προς το χρήστη προβολή πίνακα), ``csv`` (πίνακας με κόμμα-διαχωρισμό), " +"``json`` (ένα μόνο JSON blob), ``jsonl`` (ένα JSON blob ανά αποτέλεσμα), " +"``exe`` (μόνο η διαδρομή εκτελέσιμου), ``prefix`` (μόνο η διαδρομή " +"προθέματος)." -#: using/windows.rst:94 -msgid "Shortcuts are available for all users" +#: using/windows.rst:240 +msgid "" +"The ``--one`` or ``-1`` option only displays a single result. If the default " +"runtime is included, it will be the one. Otherwise, the \"best\" result is " +"shown (\"best\" is deliberately vaguely defined, but will usually be the " +"most recent version). The result shown by ``py list --one `` will match " +"the runtime that would be launched by ``py -V:``." msgstr "" +"Το ``--one`` ή ``-1`` εμφανίζει μόνο ένα αποτέλεσμα. Εάν περιλαμβάνεται ο " +"προεπιλεγμένος χρόνος εκτέλεσης, θα είναι αυτός. Διαφορετικά, εμφανίζεται το " +"\"καλύτερο\" αποτέλεσμα (το \"καλύτερο\" είναι σκόπιμα ασαφώς ορισμένο, αλλά " +"συνήθως θα είναι η πιο πρόσφατη έκδοση). Το αποτέλεσμα που εμφανίζεται από " +"το ``py list --one `` θα ταιριάξει με το χρόνο εκτέλεσης που θα " +"εκκινηθεί από το ``py -V:``." -#: using/windows.rst:99 -msgid "Removing the MAX_PATH Limitation" +#: using/windows.rst:246 +msgid "" +"The ``--only-managed`` option excludes results that were not installed by " +"the Python install manager. This is useful when determining which runtimes " +"may be updated or uninstalled through the ``py`` command." msgstr "" +"Η επιλογή ``--only-managed`` εξαιρεί αποτελέσματα που δεν εγκαταστάθηκαν από " +"τον διαχειριστή εγκατάστασης Python. Αυτό είναι χρήσιμο κατά τον " +"προσδιορισμό των χρόνων εκτέλεσης που μπορούν να ενημερωθούν ή να " +"απεγκατασταθούν μέσω της εντολής ``py``." -#: using/windows.rst:101 +#: using/windows.rst:250 msgid "" -"Windows historically has limited path lengths to 260 characters. This meant " -"that paths longer than this would not resolve and errors would result." +"The ``--online`` option is short for passing ``--source=`` with the " +"default source. Passing either of these options will search the online index " +"for runtimes that can be installed. The result shown by ``py list --online --" +"one `` will match the runtime that would be installed by ``py install " +"``." msgstr "" +"Η επιλογή ``--online`` είναι συντομογραφία για τη μετάβαση του ``--" +"source=`` με την προεπιλεγμένη πηγή. Η μετάβαση οποιασδήποτε από αυτές " +"τις επιλογές θα αναζητήσει στο διαδικτυακό ευρετήριο για χρόνους εκτέλεσης " +"που μπορούν να εγκατασταθούν. Το αποτέλεσμα που εμφανίζεται από το ``py list " +"--online --one `` θα ταιριάξει με το χρόνο εκτέλεσης που θα " +"εγκατασταθεί από το ``py install ``." + +#: using/windows.rst:255 +msgid "$> py list --online 3.14" +msgstr "$> py list --online 3.14" -#: using/windows.rst:104 +#: using/windows.rst:259 msgid "" -"In the latest versions of Windows, this limitation can be expanded to " -"approximately 32,000 characters. Your administrator will need to activate " -"the \"Enable Win32 long paths\" group policy, or set ``LongPathsEnabled`` to " -"``1`` in the registry key " -"``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." +"For compatibility with the old launcher, the ``--list``, ``--list-paths``, " +"``-0`` and ``-0p`` commands (e.g. ``py -0p``) are retained. They do not " +"allow additional options, and will produce legacy formatted output." msgstr "" +"Για συμβατότητα με τον παλιό εκκινητή, οι εντολές ``--list``, ``--list-" +"paths``, ``-0`` και ``-0p`` (π.χ. ``py -0p``) διατηρούνται. Δεν επιτρέπουν " +"πρόσθετες επιλογές, και θα παράγουν έξοδο σε παλιά μορφή." + +#: using/windows.rst:265 +msgid "Installing runtimes" +msgstr "Εγκαθιστώντας χρόνους εκτέλεσης" -#: using/windows.rst:110 +#: using/windows.rst:267 msgid "" -"This allows the :func:`open` function, the :mod:`os` module and most other " -"path functionality to accept and return paths longer than 260 characters." +"$> py install [-s=|--source=] [-f|--force] [-u|--update] [--dry-run] " +"[...]" msgstr "" +"$> py install [-s=|--source=] [-f|--force] [-u|--update] [--dry-run] " +"[...]" -#: using/windows.rst:113 -msgid "After changing the above option, no further configuration is required." +#: using/windows.rst:271 +msgid "" +"New runtime versions may be added using ``py install``. One or more tags may " +"be specified, and the special tag ``default`` may be used to select the " +"default. Ranges are not supported for installation." msgstr "" +"Νέες εκδόσεις χρόνων εκτέλεσης μπορούν να προστεθούν χρησιμοποιώντας το ``py " +"install``. Μπορεί να καθοριστεί ένα ή περισσότερα tags, και το ειδικό tag " +"``default`` μπορεί να χρησιμοποιηθεί για την επιλογή του προεπιλεγμένου. Οι " +"περιοχές δεν υποστηρίζονται για εγκατάσταση." -#: using/windows.rst:117 -msgid "Support for long paths was enabled in Python." +#: using/windows.rst:275 +msgid "" +"The ``--source=`` option allows overriding the online index that is " +"used to obtain runtimes. This may be used with an offline index, as shown " +"in :ref:`pymanager-offline`." msgstr "" +"Η επιλογή ``--source=`` επιτρέπει την παράκαμψη του διαδικτυακού " +"ευρετηρίου που χρησιμοποιείται για την απόκτηση χρόνων εκτέλεσης. Αυτό " +"μπορεί να χρησιμοποιηθεί με ευρετήριο εκτός σύνδεσης, όπως φαίνεται στο :ref:" +"`pymanager-offline`." -#: using/windows.rst:122 -msgid "Installing Without UI" +#: using/windows.rst:279 +msgid "" +"Passing ``--force`` will ignore any cached files and remove any existing " +"install to replace it with the specified one." msgstr "" +"Περνώντας την επιλογή ``--force`` θα αγνοήσει τυχόν αρχεία στην προσωρινή " +"μνήμη και θα αφαιρέσει οποιαδήποτε υπάρχουσα εγκατάσταση για να την " +"αντικαταστήσει με την καθορισμένη." -#: using/windows.rst:124 +#: using/windows.rst:282 msgid "" -"All of the options available in the installer UI can also be specified from " -"the command line, allowing scripted installers to replicate an installation " -"on many machines without user interaction. These options may also be set " -"without suppressing the UI in order to change some of the defaults." +"Passing ``--update`` will replace existing installs if the new version is " +"newer. Otherwise, they will be left. If no tags are provided with ``--" +"update``, all installs managed by the Python install manager will be updated " +"if newer versions are available. Updates will remove any modifications made " +"to the install, including globally installed packages, but virtual " +"environments will continue to work." msgstr "" +"Περνώντας την επιλογή ``--update`` θα αντικαταστήσει υπάρχουσες " +"εγκαταστάσεις εάν η νέα έκδοση είναι νεότερη. Διαφορετικά, θα παραμείνουν. " +"Εάν δεν παρέχονται tags με το ``--update``, όλες οι εγκαταστάσεις που " +"διαχειρίζεται ο διαχειριστής εγκατάστασης Python θα ενημερωθούν εάν υπάρχουν " +"νεότερες εκδόσεις. Οι ενημερώσεις θα αφαιρέσουν τυχόν τροποποιήσεις που " +"έγιναν στην εγκατάσταση, συμπεριλαμβανομένων των παγκοσμίως εγκατεστημένων " +"πακέτων, αλλά τα εικονικά περιβάλλοντα θα συνεχίσουν να λειτουργούν." -#: using/windows.rst:129 +#: using/windows.rst:289 msgid "" -"The following options (found by executing the installer with ``/?``) can be " -"passed into the installer:" +"Passing ``--dry-run`` will generate output and logs, but will not modify any " +"installs." msgstr "" +"Περνώντας την επιλογή ``--dry-run`` θα δημιουργήσει έξοδο και αρχεία " +"καταγραφής, αλλά δεν θα τροποποιήσει καμία εγκατάσταση." -#: using/windows.rst:153 using/windows.rst:1082 -msgid "Name" +#: using/windows.rst:292 +msgid "" +"In addition to the above options, the ``--target`` option will extract the " +"runtime to the specified directory instead of doing a normal install. This " +"is useful for embedding runtimes into larger applications." msgstr "" +"Εκτός από τις παραπάνω επιλογές, η επιλογή ``--target`` θα εξαγάγει το χρόνο " +"εκτέλεσης στον καθορισμένο κατάλογο αντί να κάνει μια κανονική εγκατάσταση. " +"Αυτό είναι χρήσιμο για την ενσωμάτωση χρόνων εκτέλεσης σε μεγαλύτερες " +"εφαρμογές." -#: using/windows.rst:153 using/windows.rst:1082 -msgid "Description" -msgstr "" +#: using/windows.rst:296 +msgid "$> py install ... [-t=|--target=] " +msgstr "$> py install ... [-t=|--target=] " -#: using/windows.rst:135 -msgid "/passive" -msgstr "" +#: using/windows.rst:304 +msgid "Offline installs" +msgstr "Εγκαταστάσεις εκτός σύνδεσης" -#: using/windows.rst:135 -msgid "to display progress without requiring user interaction" +#: using/windows.rst:306 +msgid "" +"To perform offline installs of Python, you will need to first create an " +"offline index on a machine that has network access." msgstr "" +"Για να πραγματοποιήσετε εγκαταστάσεις εκτός σύνδεσης της Python, θα " +"χρειαστεί πρώτα να δημιουργήσετε ένα ευρετήριο εκτός σύνδεσης σε ένα " +"μηχάνημα που έχει πρόσβαση στο δίκτυο." -#: using/windows.rst:137 -msgid "/quiet" -msgstr "" +#: using/windows.rst:309 +msgid "$> py install --download= ... ..." +msgstr "$> py install --download= ... ..." -#: using/windows.rst:137 -msgid "to install/uninstall without displaying any UI" +#: using/windows.rst:313 +msgid "" +"The ``--download=`` option will download the packages for the listed " +"tags and create a directory containing them and an ``index.json`` file " +"suitable for later installation. This entire directory can be moved to the " +"offline machine and used to install one or more of the bundled runtimes:" msgstr "" +"Η επιλογή ``--download=`` θα κατεβάσει τα πακέτα για τα καταχωρημένα " +"tags και θα δημιουργήσει έναν κατάλογο που τα περιέχει και ένα αρχείο " +"``index.json`` κατάλληλο για μεταγενέστερη εγκατάσταση. Ολόκληρος αυτός ο " +"κατάλογος μπορεί να μετακινηθεί στο μηχάνημα εκτός σύνδεσης και να " +"χρησιμοποιηθεί για την εγκατάσταση ενός ή περισσότερων από τους παρεχόμενους " +"χρόνους εκτέλεσης:" -#: using/windows.rst:139 -msgid "/simple" -msgstr "" +#: using/windows.rst:318 +msgid "$> py install --source=\"\\index.json\" ..." +msgstr "$> py install --source=\"\\index.json\" ..." -#: using/windows.rst:139 -msgid "to prevent user customization" +#: using/windows.rst:322 +msgid "" +"The Python install manager can be installed by downloading its installer and " +"moving it to another machine before installing." msgstr "" +"Ο διαχειριστής εγκατάστασης Python μπορεί να εγκατασταθεί κατεβάζοντας τον " +"εγκαταστάτη του και μεταφέροντάς τον σε άλλο μηχάνημα πριν την εγκατάσταση." -#: using/windows.rst:141 -msgid "/uninstall" +#: using/windows.rst:325 +msgid "" +"Alternatively, the ZIP files in an offline index directory can simply be " +"transferred to another machine and extracted. This will not register the " +"install in any way, and so it must be launched by directly referencing the " +"executables in the extracted directory, but it is sometimes a preferable " +"approach in cases where installing the Python install manager is not " +"possible or convenient." msgstr "" +"Διαφορετικά, τα αρχεία ZIP σε έναν κατάλογο ευρετηρίου εκτός σύνδεσης " +"μπορούν απλά να μεταφερθούν σε άλλο μηχάνημα και να εξαχθούν. Αυτό δεν θα " +"καταχωρήσει την εγκατάσταση με κανέναν τρόπο, και έτσι πρέπει να εκκινηθεί " +"αναφερόμενο απευθείας στα εκτελέσιμα αρχεία στον εξαγόμενο φάκελο, αλλά " +"μερικές φορές είναι μια προτιμότερη προσέγγιση σε περιπτώσεις όπου η " +"εγκατάσταση του διαχειριστή εγκατάστασης Python δεν είναι δυνατή ή βολική." -#: using/windows.rst:141 -msgid "to remove Python (without confirmation)" +#: using/windows.rst:331 +msgid "" +"In this way, Python runtimes can be installed and managed on a machine " +"without access to the internet." msgstr "" +"Με αυτόν τον τρόπο, οι χρόνοι εκτέλεσης της Python μπορούν να εγκατασταθούν " +"και να διαχειριστούν σε ένα μηχάνημα χωρίς πρόσβαση στο διαδίκτυο." -#: using/windows.rst:143 -msgid "/layout [directory]" -msgstr "" +#: using/windows.rst:336 +msgid "Uninstalling runtimes" +msgstr "Απεγκατάσταση χρόνων εκτέλεσης" -#: using/windows.rst:143 -msgid "to pre-download all components" -msgstr "" +#: using/windows.rst:338 +msgid "$> py uninstall [-y|--yes] ..." +msgstr "$> py uninstall [-y|--yes] ..." -#: using/windows.rst:145 -msgid "/log [filename]" +#: using/windows.rst:342 +msgid "" +"Runtimes may be removed using the ``py uninstall`` command. One or more tags " +"must be specified. Ranges are not supported here." msgstr "" +"Οι χρόνοι εκτέλεσης μπορούν να αφαιρεθούν χρησιμοποιώντας την εντολή ``py " +"uninstall``. Πρέπει να καθοριστούν μία ή περισσότερες ετικέτες. Οι περιοχές " +"δεν υποστηρίζονται εδώ." -#: using/windows.rst:145 -msgid "to specify log files location" +#: using/windows.rst:345 +msgid "" +"The ``--yes`` option bypasses the confirmation prompt before uninstalling." msgstr "" +"Η επιλογή ``--yes`` παρακάμπτει την προτροπή επιβεβαίωσης πριν από την " +"απεγκατάσταση." -#: using/windows.rst:148 +#: using/windows.rst:347 msgid "" -"All other options are passed as ``name=value``, where the value is usually " -"``0`` to disable a feature, ``1`` to enable a feature, or a path. The full " -"list of available options is shown below." +"Instead of passing tags individually, the ``--purge`` option may be " +"specified. This will remove all runtimes managed by the Python install " +"manager, including cleaning up the Start menu, registry, and any download " +"caches. Runtimes that were not installed by the Python install manager will " +"not be impacted, and neither will manually created configuration files." msgstr "" +"Διαφορετικά από το να περάσετε ετικέτες μεμονωμένα, μπορεί να καθοριστεί η " +"επιλογή ``--purge``. Αυτό θα αφαιρέσει όλους τους χρόνους εκτέλεσης που " +"διαχειρίζεται ο διαχειριστής εγκατάστασης Python, συμπεριλαμβανομένου του " +"καθαρισμού του μενού Έναρξης, του μητρώου και τυχόν προσωρινών αποθηκεύσεων " +"λήψης. Οι χρόνοι εκτέλεσης που δεν εγκαταστάθηκαν από τον διαχειριστή " +"εγκατάστασης Python δεν θα επηρεαστούν, και ούτε τα χειροκίνητα " +"δημιουργημένα αρχεία διαμόρφωσης." -#: using/windows.rst:153 -msgid "Default" -msgstr "" +#: using/windows.rst:353 +msgid "$> py uninstall [-y|--yes] --purge" +msgstr "$> py uninstall [-y|--yes] --purge" + +#: using/windows.rst:357 +msgid "" +"The Python install manager can be uninstalled through the Windows " +"\"Installed apps\" settings page. This does not remove any runtimes, and " +"they will still be usable, though the global ``python`` and ``py`` commands " +"will be removed. Reinstalling the Python install manager will allow you to " +"manage these runtimes again. To completely clean up all Python runtimes, run " +"with ``--purge`` before uninstalling the Python install manager." +msgstr "" +"Ο διαχειριστής εγκατάστασης Python μπορεί να απεγκατασταθεί μέσω της σελίδας " +"ρυθμίσεων των Windows \"Εγκατεστημένες εφαρμογές\". Αυτό δεν αφαιρεί κανέναν " +"χρόνο εκτέλεσης, και θα εξακολουθούν να είναι χρησιμοποιήσιμοι, αν και οι " +"παγκόσμιες εντολές ``python`` και ``py`` θα αφαιρεθούν. Η επανεγκατάσταση " +"του διαχειριστή εγκατάστασης Python θα σας επιτρέψει να διαχειριστείτε " +"αυτούς τους χρόνους εκτέλεσης ξανά. Για να καθαρίσετε πλήρως όλους τους " +"χρόνους εκτέλεσης Python, εκτελέστε με ``--purge`` πριν από την " +"απεγκατάσταση του διαχειριστή εγκατάστασης Python." + +#: using/windows.rst:367 +msgid "Configuration" +msgstr "Διαμόρφωση" -#: using/windows.rst:155 -msgid "InstallAllUsers" +#: using/windows.rst:369 +msgid "" +"Python install manager is configured with a hierarchy of configuration " +"files, environment variables, command-line options, and registry settings. " +"In general, configuration files have the ability to configure everything, " +"including the location of other configuration files, while registry settings " +"are administrator-only and will override configuration files. Command-line " +"options override all other settings, but not every option is available." msgstr "" +"Ο διαχειριστής εγκατάστασης Python διαμορφώνεται με μια ιεραρχία αρχείων " +"διαμόρφωσης, μεταβλητών περιβάλλοντος, επιλογών γραμμής εντολών, και " +"ρυθμίσεων μητρώου. Γενικά, τα αρχεία διαμόρφωσης έχουν τη δυνατότητα να " +"διαμορφώσουν τα πάντα, συμπεριλαμβανομένης της τοποθεσίας άλλων αρχείων " +"διαμόρφωσης, ενώ οι ρυθμίσεις μητρώου είναι μόνο για διαχειριστές και θα " +"παρακάμψουν τα αρχεία διαμόρφωσης." -#: using/windows.rst:155 -msgid "Perform a system-wide installation." +#: using/windows.rst:376 +msgid "" +"This section will describe the defaults, but be aware that modified or " +"overridden installs may resolve settings differently." msgstr "" +"Αυτή η ενότητα θα περιγράψει τις προεπιλογές, αλλά να γνωρίζετε ότι οι " +"τροποποιημένες ή παρακαμφθείσες εγκαταστάσεις μπορεί να επιλύσουν τις " +"ρυθμίσεις διαφορετικά." -#: using/windows.rst:181 using/windows.rst:188 using/windows.rst:219 -#: using/windows.rst:230 -msgid "0" +#: using/windows.rst:379 +msgid "" +"A global configuration file may be configured by an administrator, and would " +"be read first. The user configuration file is stored at :file:`%AppData%\\" +"\\Python\\\\pymanager.json` (by default) and is read next, overwriting any " +"settings from earlier files. An additional configuration file may be " +"specified as the ``PYTHON_MANAGER_CONFIG`` environment variable or the ``--" +"config`` command line option (but not both)." msgstr "" +"Ένα παγκόσμιο αρχείο διαμόρφωσης μπορεί να ρυθμιστεί από έναν διαχειριστή, " +"και θα διαβαστεί πρώτο. Το αρχείο διαμόρφωσης χρήστη αποθηκεύεται στο :file:" +"`%AppData%\\\\Python\\\\pymanager.json` (κατά προεπιλογή) και διαβάζεται στη " +"συνέχεια, αντικαθιστώντας οποιεσδήποτε ρυθμίσεις από προηγούμενα αρχεία. Ένα " +"επιπλέον αρχείο διαμόρφωσης μπορεί να καθοριστεί ως η μεταβλητή " +"περιβάλλοντος ``PYTHON_MANAGER_CONFIG`` ή η επιλογή γραμμής εντολών ``--" +"config`` (αλλά όχι και τα δύο)." -#: using/windows.rst:157 -msgid "TargetDir" +#: using/windows.rst:386 +msgid "" +"The following settings are those that are considered likely to be modified " +"in normal use. Later sections list those that are intended for " +"administrative customization." msgstr "" +"Οι ακόλουθες ρυθμίσεις είναι αυτές που θεωρούνται πιθανό να τροποποιηθούν σε " +"κανονική χρήση. Οι επόμενες ενότητες απαριθμούν αυτές που προορίζονται για " +"διοικητική προσαρμογή." -#: using/windows.rst:157 -msgid "The installation directory" -msgstr "" +#: using/windows.rst:394 +msgid "Standard configuration options" +msgstr "Τυπικές επιλογές διαμόρφωσης" -#: using/windows.rst:157 -msgid "Selected based on InstallAllUsers" -msgstr "" +#: using/windows.rst:694 +msgid "Config Key" +msgstr "Κλειδί Διαμόρφωσης" -#: using/windows.rst:160 -msgid "DefaultAllUsersTargetDir" -msgstr "" +#: using/windows.rst:399 +msgid "Environment Variable" +msgstr "Μεταβλητή Περιβάλλοντος" -#: using/windows.rst:160 -msgid "The default installation directory for all-user installs" -msgstr "" +#: using/windows.rst:695 using/windows.rst:1404 using/windows.rst:1994 +msgid "Description" +msgstr "Περιγραφή" + +#: using/windows.rst:402 +msgid "``default_tag``" +msgstr "``default_tag``" -#: using/windows.rst:160 +#: using/windows.rst:404 msgid "" -":file:`%ProgramFiles%\\\\\\ Python X.Y` or :file:`\\ %ProgramFiles(x86)%\\\\" -"\\ Python X.Y`" +"The preferred default version to launch or install. By default, this is " +"interpreted as the most recent non-prerelease version from the CPython team." msgstr "" +"Η προτιμώμενη προεπιλεγμένη έκδοση για εκκίνηση ή εγκατάσταση. Κατά " +"προεπιλογή, αυτό ερμηνεύεται ως η πιο πρόσφατη μη-προκαταρκτική έκδοση από " +"την ομάδα CPython." -#: using/windows.rst:165 -msgid "DefaultJustForMeTargetDir" -msgstr "" +#: using/windows.rst:408 +msgid "``default_platform``" +msgstr "``default_platform``" -#: using/windows.rst:165 -msgid "The default install directory for just-for-me installs" -msgstr "" +#: using/windows.rst:409 +msgid "``PYTHON_MANAGER_DEFAULT_PLATFORM``" +msgstr "``PYTHON_MANAGER_DEFAULT_PLATFORM``" -#: using/windows.rst:165 +#: using/windows.rst:410 msgid "" -":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` or :file:" -"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` or :file:" -"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" +"The preferred default platform to launch or install. This is treated as a " +"suffix to the specified tag, such that ``py -V:3.14`` would prefer an " +"install for ``3.14-64`` if it exists (and ``default_platform`` is ``-64``), " +"but will use ``3.14`` if no tagged install exists." msgstr "" +"Η προτιμώμενη προεπιλεγμένη πλατφόρμα για εκκίνηση ή εγκατάσταση. Αυτό " +"αντιμετωπίζεται ως κατάληξη στο καθορισμένο tag, έτσι ώστε το ``py -V:3.14`` " +"θα προτιμούσε μια εγκατάσταση για το ``3.14-64`` εάν υπάρχει (και το " +"``default_platform`` είναι ``-64``), αλλά θα χρησιμοποιούσε το ``3.14`` εάν " +"δεν υπάρχει εγκατάσταση με tag." -#: using/windows.rst:175 -msgid "DefaultCustomTargetDir" -msgstr "" +#: using/windows.rst:416 +msgid "``logs_dir``" +msgstr "``logs_dir``" -#: using/windows.rst:175 -msgid "The default custom install directory displayed in the UI" -msgstr "" +#: using/windows.rst:417 +msgid "``PYTHON_MANAGER_LOGS``" +msgstr "``PYTHON_MANAGER_LOGS``" -#: using/windows.rst:232 -msgid "(empty)" +#: using/windows.rst:418 +msgid "The location where log files are written. By default, :file:`%TEMP%`." msgstr "" +"Η τοποθεσία όπου γράφονται τα αρχεία καταγραφής. Κατά προεπιλογή, :file:" +"`%TEMP%`." -#: using/windows.rst:178 -msgid "AssociateFiles" -msgstr "" +#: using/windows.rst:421 +msgid "``automatic_install``" +msgstr "``automatic_install``" -#: using/windows.rst:178 -msgid "Create file associations if the launcher is also installed." -msgstr "" +#: using/windows.rst:422 +msgid "``PYTHON_MANAGER_AUTOMATIC_INSTALL``" +msgstr "``PYTHON_MANAGER_AUTOMATIC_INSTALL``" -#: using/windows.rst:192 using/windows.rst:199 using/windows.rst:207 -#: using/windows.rst:213 using/windows.rst:221 using/windows.rst:225 -msgid "1" +#: using/windows.rst:423 +msgid "" +"True to allow automatic installs when specifying a particular runtime to " +"launch. By default, true." msgstr "" +"True για να επιτρέπεται η αυτόματη εγκατάσταση κατά τον καθορισμό ενός " +"συγκεκριμένου χρόνου εκτέλεσης για εκκίνηση. Κατά προεπιλογή, true." -#: using/windows.rst:181 -msgid "CompileAll" -msgstr "" +#: using/windows.rst:427 +msgid "``include_unmanaged``" +msgstr "``include_unmanaged``" -#: using/windows.rst:181 -msgid "Compile all ``.py`` files to ``.pyc``." -msgstr "" +#: using/windows.rst:428 +msgid "``PYTHON_MANAGER_INCLUDE_UNMANAGED``" +msgstr "``PYTHON_MANAGER_INCLUDE_UNMANAGED``" -#: using/windows.rst:184 -msgid "PrependPath" +#: using/windows.rst:429 +msgid "" +"True to allow listing and launching runtimes that were not installed by the " +"Python install manager, or false to exclude them. By default, true." msgstr "" +"True για να επιτρέπεται η καταχώριση και η εκκίνηση χρόνων εκτέλεσης που δεν " +"εγκαταστάθηκαν από τον διαχειριστή εγκατάστασης Python, ή false για να τους " +"εξαιρέσετε. Κατά προεπιλογή, true." -#: using/windows.rst:184 +#: using/windows.rst:433 +msgid "``shebang_can_run_anything``" +msgstr "``shebang_can_run_anything``" + +#: using/windows.rst:434 +msgid "``PYTHON_MANAGER_SHEBANG_CAN_RUN_ANYTHING``" +msgstr "``PYTHON_MANAGER_SHEBANG_CAN_RUN_ANYTHING``" + +#: using/windows.rst:435 msgid "" -"Prepend install and Scripts directories to :envvar:`PATH` and add ``.PY`` " -"to :envvar:`PATHEXT`" +"True to allow shebangs in ``.py`` files to launch applications other than " +"Python runtimes, or false to prevent it. By default, true." msgstr "" +"True για να επιτρέπεται στις shebangs σε αρχεία ``.py`` να εκκινούν " +"εφαρμογές εκτός από χρόνους εκτέλεσης Python, ή false για να το αποτρέψετε. " +"Κατά προεπιλογή, true." -#: using/windows.rst:188 -msgid "AppendPath" -msgstr "" +#: using/windows.rst:439 +msgid "``log_level``" +msgstr "``log_level``" + +#: using/windows.rst:440 +msgid "``PYMANAGER_VERBOSE``, ``PYMANAGER_DEBUG``" +msgstr "``PYMANAGER_VERBOSE``, ``PYMANAGER_DEBUG``" -#: using/windows.rst:188 +#: using/windows.rst:441 msgid "" -"Append install and Scripts directories to :envvar:`PATH` and add ``.PY`` " -"to :envvar:`PATHEXT`" +"Set the default level of output (0-50). By default, 20. Lower values produce " +"more output. The environment variables are boolean, and may produce " +"additional output during startup that is later suppressed by other " +"configuration." msgstr "" +"Ορίζει το προεπιλεγμένο επίπεδο εξόδου (0-50). Κατά προεπιλογή, 20. " +"Χαμηλότερες τιμές παράγουν περισσότερη έξοδο. Οι μεταβλητές περιβάλλοντος " +"είναι boolean, και μπορεί να παράγουν επιπλέον έξοδο κατά την εκκίνηση που " +"αργότερα καταστέλλεται από άλλες ρυθμίσεις." -#: using/windows.rst:192 -msgid "Shortcuts" -msgstr "" +#: using/windows.rst:447 +msgid "``confirm``" +msgstr "``confirm``" + +#: using/windows.rst:448 +msgid "``PYTHON_MANAGER_CONFIRM``" +msgstr "``PYTHON_MANAGER_CONFIRM``" -#: using/windows.rst:192 +#: using/windows.rst:449 msgid "" -"Create shortcuts for the interpreter, documentation and IDLE if installed." +"True to confirm certain actions before taking them (such as uninstall), or " +"false to skip the confirmation. By default, true." msgstr "" +"True για να επιβεβαιώσετε ορισμένες ενέργειες πριν τις εκτελέσετε (όπως η " +"απεγκατάσταση), ή false για να παραλείψετε την επιβεβαίωση. Κατά προεπιλογή, " +"true." -#: using/windows.rst:195 -msgid "Include_doc" -msgstr "" +#: using/windows.rst:453 +msgid "``install.source``" +msgstr "``install.source``" -#: using/windows.rst:195 -msgid "Install Python manual" -msgstr "" +#: using/windows.rst:454 +msgid "``PYTHON_MANAGER_SOURCE_URL``" +msgstr "``PYTHON_MANAGER_SOURCE_URL``" -#: using/windows.rst:197 -msgid "Include_debug" +#: using/windows.rst:455 +msgid "Override the index feed to obtain new installs from." msgstr "" +"Αντικαταστήστε την πηγή του δείκτη για να αποκτήσετε νέες εγκαταστάσεις." -#: using/windows.rst:197 -msgid "Install debug binaries" -msgstr "" +#: using/windows.rst:457 +msgid "``list.format``" +msgstr "``list.format``" -#: using/windows.rst:199 -msgid "Include_dev" -msgstr "" +#: using/windows.rst:458 +msgid "``PYTHON_MANAGER_LIST_FORMAT``" +msgstr "``PYTHON_MANAGER_LIST_FORMAT``" -#: using/windows.rst:199 +#: using/windows.rst:459 msgid "" -"Install developer headers and libraries. Omitting this may lead to an " -"unusable installation." +"Specify the default format used by the ``py list`` command. By default, " +"``table``." msgstr "" +"Καθορίστε την προεπιλεγμένη μορφή που χρησιμοποιείται από την εντολή ``py " +"list``. Κατά προεπιλογή, ``table``." -#: using/windows.rst:203 -msgid "Include_exe" -msgstr "" +#: using/windows.rst:462 +msgid "``install_dir``" +msgstr "``install_dir``" -#: using/windows.rst:203 +#: using/windows.rst:469 using/windows.rst:476 +msgid "(none)" +msgstr "(none)" + +#: using/windows.rst:464 msgid "" -"Install :file:`python.exe` and related files. Omitting this may lead to an " -"unusable installation." +"Specify the root directory that runtimes will be installed into. If you " +"change this setting, previously installed runtimes will not be usable unless " +"you move them to the new location." msgstr "" +"Καθορίστε τον ριζικό κατάλογο στον οποίο θα εγκατασταθούν οι χρόνοι " +"εκτέλεσης. Εάν αλλάξετε αυτήν τη ρύθμιση, οι προηγουμένως εγκατεστημένοι " +"χρόνοι εκτέλεσης δεν θα είναι χρησιμοποιήσιμοι εκτός εάν τους μετακινήσετε " +"στη νέα τοποθεσία." -#: using/windows.rst:207 -msgid "Include_launcher" -msgstr "" +#: using/windows.rst:468 +msgid "``global_dir``" +msgstr "``global_dir``" -#: using/windows.rst:207 -msgid "Install :ref:`launcher`." +#: using/windows.rst:470 +msgid "" +"Specify the directory where global commands (such as ``python3.14.exe``) are " +"stored. This directory should be added to your :envvar:`PATH` to make the " +"commands available from your terminal." msgstr "" +"Καθορίστε τον κατάλογο όπου αποθηκεύονται οι παγκόσμιες εντολές (όπως το " +"``python3.14.exe``). Αυτός ο κατάλογος θα πρέπει να προστεθεί στη :envvar:" +"`PATH` σας για να κάνετε τις εντολές διαθέσιμες από το τερματικό σας." -#: using/windows.rst:209 -msgid "InstallLauncherAllUsers" -msgstr "" +#: using/windows.rst:475 +msgid "``download_dir``" +msgstr "``download_dir``" -#: using/windows.rst:209 +#: using/windows.rst:477 msgid "" -"Installs the launcher for all users. Also requires ``Include_launcher`` to " -"be set to 1" +"Specify the directory where downloaded files are stored. This directory is a " +"temporary cache, and can be cleaned up from time to time." msgstr "" +"Καθορίστε τον κατάλογο όπου αποθηκεύονται τα αρχεία που έχουν ληφθεί. Αυτός " +"ο κατάλογος είναι μια προσωρινή μνήμη και μπορεί να καθαριστεί από καιρό σε " +"καιρό." -#: using/windows.rst:213 -msgid "Include_lib" +#: using/windows.rst:481 +msgid "" +"Dotted names should be nested inside JSON objects, for example, ``list." +"format`` would be specified as ``{\"list\": {\"format\": \"table\"}}``." msgstr "" +"Τα ονόματα με τελείες θα πρέπει να είναι εμφωλευμένα μέσα σε αντικείμενα " +"JSON, για παράδειγμα, ``list.format`` θα καθοριζόταν ως ``{\"list\": " +"{\"format\": \"table\"}}``." -#: using/windows.rst:213 +#: using/windows.rst:1750 +msgid "Shebang lines" +msgstr "Γραμμές Shebang" + +#: using/windows.rst:489 msgid "" -"Install standard library and extension modules. Omitting this may lead to an " -"unusable installation." +"If the first line of a script file starts with ``#!``, it is known as a " +"\"shebang\" line. Linux and other Unix like operating systems have native " +"support for such lines and they are commonly used on such systems to " +"indicate how a script should be executed. The ``python`` and ``py`` commands " +"allow the same facilities to be used with Python scripts on Windows." msgstr "" +"Εάν η πρώτη γραμμή ενός αρχείου σεναρίου ξεκινά με ``#!``, είναι γνωστή ως " +"γραμμή \"shebang\". Τα Linux και άλλα λειτουργικά συστήματα παρόμοια με το " +"Unix έχουν ενσωματωμένη υποστήριξη για τέτοιες γραμμές και χρησιμοποιούνται " +"συνήθως σε τέτοια συστήματα για να υποδείξουν πώς πρέπει να εκτελεστεί ένα " +"script. Οι εντολές ``python`` και ``py`` επιτρέπουν την ίδια δυνατότητα να " +"χρησιμοποιηθεί με scripts Python στα Windows." -#: using/windows.rst:217 -msgid "Include_pip" +#: using/windows.rst:495 +msgid "" +"To allow shebang lines in Python scripts to be portable between Unix and " +"Windows, a number of 'virtual' commands are supported to specify which " +"interpreter to use. The supported virtual commands are:" msgstr "" +"Για να επιτρέψετε στις γραμμές shebang σε σενάρια Python να είναι φορητές " +"μεταξύ Unix και Windows, υποστηρίζονται αρκετές 'εικονικές' εντολές για να " +"καθορίσετε ποιο διερμηνέα να χρησιμοποιήσετε. Οι υποστηριζόμενες εικονικές " +"εντολές είναι:" -#: using/windows.rst:217 -msgid "Install bundled pip and setuptools" -msgstr "" +#: using/windows.rst:499 +msgid "``/usr/bin/env ``" +msgstr "``/usr/bin/env ``" -#: using/windows.rst:219 -msgid "Include_symbols" -msgstr "" +#: using/windows.rst:500 +msgid "``/usr/bin/env -S ``" +msgstr "``/usr/bin/env -S ``" -#: using/windows.rst:219 -msgid "Install debugging symbols (``*.pdb``)" -msgstr "" +#: using/windows.rst:501 +msgid "``/usr/bin/``" +msgstr "``/usr/bin/``" -#: using/windows.rst:221 -msgid "Include_tcltk" -msgstr "" - -#: using/windows.rst:221 -msgid "Install Tcl/Tk support and IDLE" -msgstr "" - -#: using/windows.rst:223 -msgid "Include_test" -msgstr "" +#: using/windows.rst:502 +msgid "``/usr/local/bin/``" +msgstr "``/usr/local/bin/``" -#: using/windows.rst:223 -msgid "Install standard library test suite" -msgstr "" +#: using/windows.rst:503 +msgid "````" +msgstr "````" -#: using/windows.rst:225 -msgid "Include_tools" -msgstr "" +#: using/windows.rst:1768 +msgid "For example, if the first line of your script starts with" +msgstr "Για παράδειγμα, εάν η πρώτη γραμμή του script σας ξεκινά με" + +#: using/windows.rst:1770 +msgid "#! /usr/bin/python" +msgstr "#! /usr/bin/python" + +#: using/windows.rst:1774 +msgid "" +"The default Python or an active virtual environment will be located and " +"used. As many Python scripts written to work on Unix will already have this " +"line, you should find these scripts can be used by the launcher without " +"modification. If you are writing a new script on Windows which you hope will " +"be useful on Unix, you should use one of the shebang lines starting with ``/" +"usr``." +msgstr "" +"Η προεπιλεγμένη Python ή ένα ενεργό εικονικό περιβάλλον θα εντοπιστεί και θα " +"χρησιμοποιηθεί. Καθώς πολλά Python scripts που έχουν γραφεί για να " +"λειτουργούν σε Unix θα έχουν ήδη αυτή τη γραμμή, θα διαπιστώσετε ότι αυτά τα " +"σενάρια μπορούν να χρησιμοποιηθούν από τον εκκινητή χωρίς τροποποίηση. Εάν " +"γράφετε ένα νέο σενάριο στα Windows που ελπίζετε να είναι χρήσιμο σε Unix, " +"θα πρέπει να χρησιμοποιήσετε μία από τις γραμμές shebang που ξεκινούν με ``/" +"usr``." + +#: using/windows.rst:517 +msgid "" +"Any of the above virtual commands can have ```` replaced by an alias " +"from an installed runtime. That is, any command generated in the global " +"aliases directory (which you may have added to your :envvar:`PATH` " +"environment variable) can be used in a shebang, even if it is not on your :" +"envvar:`PATH`. This allows the use of shebangs like ``/usr/bin/python3.12`` " +"to select a particular runtime." +msgstr "" +"Οποιαδήποτε από τις παραπάνω εικονικές εντολές μπορούν να έχουν το " +"```` αντικατασταθεί από ένα ψευδώνυμο από μια εγκατεστημένη runtime. " +"Δηλαδή, οποιαδήποτε εντολή που δημιουργείται στον παγκόσμιο κατάλογο " +"ψευδωνύμων (τον οποίο μπορεί να έχετε προσθέσει στη μεταβλητή περιβάλλοντος :" +"envvar:`PATH`) μπορεί να χρησιμοποιηθεί σε ένα shebang, ακόμη και αν δεν " +"είναι στο :envvar:`PATH`. Αυτό επιτρέπει τη χρήση shebangs όπως ``/usr/bin/" +"python3.12`` για να επιλέξετε μια συγκεκριμένη runtime." + +#: using/windows.rst:523 +msgid "" +"If no runtimes are installed, or if automatic installation is enabled, the " +"requested runtime will be installed if necessary. See :ref:`pymanager-" +"config` for information about configuration settings." +msgstr "" +"Εάν δεν υπάρχουν εγκατεστημένοι χρόνοι εκτέλεσης, ή εάν η αυτόματη " +"εγκατάσταση είναι ενεργοποιημένη, ο ζητούμενος χρόνος εκτέλεσης θα " +"εγκατασταθεί εάν είναι απαραίτητο. Δείτε :ref:`pymanager-config` για " +"πληροφορίες σχετικά με τις ρυθμίσεις διαμόρφωσης." + +#: using/windows.rst:527 +msgid "" +"The ``/usr/bin/env`` form of shebang line will also search the :envvar:" +"`PATH` environment variable for unrecognized commands. This corresponds to " +"the behaviour of the Unix ``env`` program, which performs the same search, " +"but prefers launching known Python commands. A warning may be displayed when " +"searching for arbitrary executables, and this search may be disabled by the " +"``shebang_can_run_anything`` configuration option." +msgstr "" +"Η μορφή shebang γραμμής ``/usr/bin/env`` θα αναζητήσει επίσης τη μεταβλητή " +"περιβάλλοντος :envvar:`PATH` για μη αναγνωρισμένες εντολές. Αυτό αντιστοιχεί " +"στη συμπεριφορά του προγράμματος Unix ``env``, το οποίο εκτελεί την ίδια " +"αναζήτηση, αλλά προτιμά την εκκίνηση γνωστών εντολών Python. Μπορεί να " +"εμφανιστεί μια προειδοποίηση κατά την αναζήτηση για αυθαίρετα εκτελέσιμα " +"αρχεία, και αυτή η αναζήτηση μπορεί να απενεργοποιηθεί από την επιλογή " +"διαμόρφωσης ``shebang_can_run_anything``." + +#: using/windows.rst:534 +msgid "" +"Shebang lines that do not match any of patterns are treated as *Windows* " +"executable paths that are absolute or relative to the directory containing " +"the script file. This is a convenience for Windows-only scripts, such as " +"those generated by an installer, since the behavior is not compatible with " +"Unix-style shells. These paths may be quoted, and may include multiple " +"arguments, after which the path to the script and any additional arguments " +"will be appended. This functionality may be disabled by the " +"``shebang_can_run_anything`` configuration option." +msgstr "" +"Οι γραμμές shebang που δεν ταιριάζουν με κανένα από τα πρότυπα " +"αντιμετωπίζονται ως *Windows* διαδρομές εκτελέσιμων αρχείων που είναι " +"απόλυτες ή σχετικές προς τον κατάλογο που περιέχει το αρχείο σεναρίου. Αυτό " +"είναι μια ευκολία για σενάρια μόνο για Windows, όπως αυτά που δημιουργούνται " +"από έναν εγκαταστάτη, καθώς η συμπεριφορά δεν είναι συμβατή με κελύφη τύπου " +"Unix. Αυτές οι διαδρομές μπορεί να είναι σε εισαγωγικά, και μπορεί να " +"περιλαμβάνουν πολλαπλά ορίσματα, μετά τα οποία θα προστεθεί η διαδρομή προς " +"το σενάριο και τυχόν πρόσθετα ορίσματα. Αυτή η λειτουργικότητα μπορεί να " +"απενεργοποιηθεί από την επιλογή διαμόρφωσης ``shebang_can_run_anything``." -#: using/windows.rst:225 -msgid "Install utility scripts" -msgstr "" +#: using/windows.rst:545 +msgid "" +"The behaviour of shebangs in the Python install manager is subtly different " +"from the previous ``py.exe`` launcher, and the old configuration options no " +"longer apply. If you are specifically reliant on the old behaviour or " +"configuration, we recommend installing the `legacy launcher`_. The legacy " +"launcher's ``py`` command will override PyManager's one by default, and you " +"will need to use ``pymanager`` commands for installing and uninstalling." +msgstr "" +"Η συμπεριφορά των shebangs στον διαχειριστή εγκατάστασης Python είναι λεπτά " +"διαφορετική από τον προηγούμενο εκκινητή ``py.exe``, και οι παλιές επιλογές " +"διαμόρφωσης δεν ισχύουν πλέον. Εάν βασίζεστε συγκεκριμένα στην παλιά " +"συμπεριφορά ή διαμόρφωση, συνιστούμε την εγκατάσταση του `legacy launcher`_. " +"Η εντολή ``py`` του legacy launcher θα παρακάμψει αυτήν του PyManager από " +"προεπιλογή, και θα χρειαστεί να χρησιμοποιήσετε τις εντολές ``pymanager`` " +"για εγκατάσταση και απεγκατάσταση." + +#: using/windows.rst:563 +msgid "Advanced installation" +msgstr "Προχωρημένη εγκατάσταση" + +#: using/windows.rst:565 +msgid "" +"For situations where an MSIX cannot be installed, such as some older " +"administrative distribution platforms, there is an MSI available from the " +"python.org downloads page. This MSI has no user interface, and can only " +"perform per-machine installs to its default location in Program Files. It " +"will attempt to modify the system :envvar:`PATH` environment variable to " +"include this install location, but be sure to validate this on your " +"configuration." +msgstr "" +"Για καταστάσεις όπου ένα MSIX δεν μπορεί να εγκατασταθεί, όπως ορισμένες " +"παλαιότερες πλατφόρμες διανομής για διαχειριστές, υπάρχει ένα MSI διαθέσιμο " +"από τη σελίδα λήψεων του python.org. Αυτό το MSI δεν έχει διεπαφή χρήστη, " +"και μπορεί μόνο να πραγματοποιήσει εγκαταστάσεις ανά μηχάνημα στην " +"προεπιλεγμένη τοποθεσία στα Program Files. Θα προσπαθήσει να τροποποιήσει τη " +"συστημική μεταβλητή :envvar:`PATH` για να συμπεριλάβει αυτή την τοποθεσία " +"εγκατάστασης, αλλά βεβαιωθείτε ότι το επαληθεύετε στη διαμόρφωσή σας." + +#: using/windows.rst:574 +msgid "" +"Windows Server 2019 is the only version of Windows that CPython supports " +"that does not support MSIX. For Windows Server 2019, you should use the MSI." +msgstr "" +"Τα Windows Server 2019 είναι η μόνη έκδοση των Windows που υποστηρίζει η " +"CPython και δεν υποστηρίζει MSIX. Για τα Windows Server 2019, θα πρέπει να " +"χρησιμοποιήσετε το MSI." + +#: using/windows.rst:577 +msgid "" +"Be aware that the MSI package does not bundle any runtimes, and so is not " +"suitable for installs into offline environments without also creating an " +"offline install index. See :ref:`pymanager-offline` and :ref:`pymanager-" +"admin-config` for information on handling these scenarios." +msgstr "" +"Να γνωρίζετε ότι το πακέτο MSI δεν περιλαμβάνει κανέναν χρόνο εκτέλεσης, και " +"έτσι δεν είναι κατάλληλο για εγκαταστάσεις σε περιβάλλοντα χωρίς σύνδεση στο " +"διαδίκτυο χωρίς επίσης τη δημιουργία ενός ευρετηρίου εγκατάστασης χωρίς " +"σύνδεση. Δείτε :ref:`pymanager-offline` και :ref:`pymanager-admin-config` " +"για πληροφορίες σχετικά με τη διαχείριση αυτών των σεναρίων." + +#: using/windows.rst:582 +msgid "" +"Runtimes installed by the MSI are shared with those installed by the MSIX, " +"and are all per-user only. The Python install manager does not support " +"installing runtimes per-machine. To emulate a per-machine install, you can " +"use ``py install --target=`` as administrator and add your " +"own system-wide modifications to :envvar:`PATH`, the registry, or the Start " +"menu." +msgstr "" +"Οι χρόνοι εκτέλεσης που εγκαθίστανται από το MSI κοινοποιούνται με αυτούς " +"που εγκαθίστανται από το MSIX, και είναι όλοι μόνο ανά χρήστη. Ο " +"διαχειριστής εγκατάστασης Python δεν υποστηρίζει την εγκατάσταση χρόνων " +"εκτέλεσης ανά μηχάνημα. Για να μιμηθείτε μια εγκατάσταση ανά μηχάνημα, " +"μπορείτε να χρησιμοποιήσετε το ``py install --target=`` ως " +"διαχειριστής και να προσθέσετε τις δικές σας τροποποιήσεις σε :envvar:" +"`PATH`, το μητρώο, ή το μενού Έναρξης." + +#: using/windows.rst:588 +msgid "" +"When the MSIX is installed, but commands are not available in the :envvar:" +"`PATH` environment variable, they can be found under :file:`%LocalAppData%\\" +"\\Microsoft\\\\WindowsApps\\\\PythonSoftwareFoundation." +"PythonManager_3847v3x7pw1km` or :file:`%LocalAppData%\\\\Microsoft\\" +"\\WindowsApps\\\\PythonSoftwareFoundation.PythonManager_qbz5n2kfra8p0`, " +"depending on whether it was installed from python.org or through the Windows " +"Store. Attempting to run the executable directly from Program Files is not " +"recommended." +msgstr "" +"Όταν το MSIX είναι εγκατεστημένο, αλλά οι εντολές δεν είναι διαθέσιμες στη :" +"envvar:`PATH` μεταβλητή περιβάλλοντος, μπορούν να βρεθούν στο :file:" +"`%LocalAppData%\\\\Microsoft\\\\WindowsApps\\\\PythonSoftwareFoundation." +"PythonManager_3847v3x7pw1km` ή :file:`%LocalAppData%\\\\Microsoft\\" +"\\WindowsApps\\\\PythonSoftwareFoundation.PythonManager_qbz5n2kfra8p0`, " +"ανάλογα με το αν εγκαταστάθηκε από το python.org ή μέσω του Windows Store. Η " +"προσπάθεια εκτέλεσης του εκτελέσιμου απευθείας από τα Program Files δεν " +"συνιστάται." + +#: using/windows.rst:597 +msgid "" +"To programmatically install the Python install manager, it is easiest to use " +"WinGet, which is included with all supported versions of Windows:" +msgstr "" +"Για να εγκαταστήσετε προγραμματιστικά τον διαχειριστή εγκατάστασης Python, " +"είναι πιο εύκολο να χρησιμοποιήσετε το WinGet, το οποίο περιλαμβάνεται σε " +"όλες τις υποστηριζόμενες εκδόσεις των Windows:" + +#: using/windows.rst:600 +msgid "" +"$> winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-" +"interactivity\n" +"\n" +"# Optionally run the configuration checker and accept all changes\n" +"$> py install --configure -y" +msgstr "" +"$> winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-" +"interactivity\n" +"\n" +"# Optionally run the configuration checker and accept all changes\n" +"$> py install --configure -y" + +#: using/windows.rst:607 +msgid "" +"To download the Python install manager and install on another machine, the " +"following WinGet command will download the required files from the Store to " +"your Downloads directory (add ``-d `` to customize the output " +"location). This also generates a YAML file that appears to be unnecessary, " +"as the downloaded MSIX can be installed by launching or using the commands " +"below." +msgstr "" +"Για να κατεβάσετε τον διαχειριστή εγκατάστασης Python και να τον " +"εγκαταστήσετε σε άλλο μηχάνημα, η ακόλουθη εντολή WinGet θα κατεβάσει τα " +"απαιτούμενα αρχεία από το Store στον κατάλογο Λήψεις σας (προσθέστε ``-d " +"`` για να προσαρμόσετε την τοποθεσία εξόδου). Αυτό επίσης " +"δημιουργεί ένα αρχείο YAML που φαίνεται να είναι περιττό, καθώς το " +"κατεβασμένο MSIX μπορεί να εγκατασταθεί με την εκκίνηση ή τη χρήση των " +"παρακάτω εντολών." + +#: using/windows.rst:613 +msgid "" +"$> winget download 9NQ7512CXL7T -e --skip-license --accept-package-" +"agreements --accept-source-agreements" +msgstr "" +"$> winget download 9NQ7512CXL7T -e --skip-license --accept-package-" +"agreements --accept-source-agreements" + +#: using/windows.rst:617 +msgid "" +"To programmatically install or uninstall an MSIX using only PowerShell, the " +"`Add-AppxPackage`_ and `Remove-AppxPackage`_ PowerShell cmdlets are " +"recommended:" +msgstr "" +"Για να εγκαταστήσετε ή να απεγκαταστήσετε προγραμματιστικά ένα MSIX " +"χρησιμοποιώντας μόνο το PowerShell, συνιστώνται τα PowerShell cmdlets `Add-" +"AppxPackage`_ και `Remove-AppxPackage`_:" + +#: using/windows.rst:620 +msgid "" +"$> Add-AppxPackage C:\\Downloads\\python-manager-25.0.msix\n" +"...\n" +"$> Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-" +"AppxPackage" +msgstr "" +"$> Add-AppxPackage C:\\Downloads\\python-manager-25.0.msix\n" +"...\n" +"$> Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-" +"AppxPackage" + +#: using/windows.rst:626 +msgid "" +"The latest release can be downloaded and installed by Windows by passing the " +"AppInstaller file to the Add-AppxPackage command. This installs using the " +"MSIX on python.org, and is only recommended for cases where installing via " +"the Store (interactively or using WinGet) is not possible." +msgstr "" +"Η τελευταία έκδοση μπορεί να ληφθεί και να εγκατασταθεί από τα Windows με τη " +"μετάδοση του αρχείου AppInstaller στην εντολή Add-AppxPackage. Αυτό " +"εγκαθιστά χρησιμοποιώντας το MSIX στο python.org, και συνιστάται μόνο για " +"περιπτώσεις όπου η εγκατάσταση μέσω του Store (διαδραστικά ή χρησιμοποιώντας " +"το WinGet) δεν είναι δυνατή." + +#: using/windows.rst:631 +msgid "" +"$> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/" +"pymanager/pymanager.appinstaller" +msgstr "" +"$> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/" +"pymanager/pymanager.appinstaller" + +#: using/windows.rst:635 +msgid "" +"Other tools and APIs may also be used to provision an MSIX package for all " +"users on a machine, but Python does not consider this a supported scenario. " +"We suggest looking into the PowerShell `Add-AppxProvisionedPackage`_ cmdlet, " +"the native Windows `PackageManager`_ class, or the documentation and support " +"for your deployment tool." +msgstr "" +"Άλλα εργαλεία και API μπορούν επίσης να χρησιμοποιηθούν για την παροχή ενός " +"πακέτου MSIX για όλους τους χρήστες σε μια μηχανή, αλλά η Python δεν θεωρεί " +"αυτό ένα υποστηριζόμενο σενάριο. Προτείνουμε να εξετάσετε το PowerShell `Add-" +"AppxProvisionedPackage`_ cmdlet, την εγγενή κλάση Windows `PackageManager`_, " +"ή την τεκμηρίωση και υποστήριξη για το εργαλείο ανάπτυξής σας." + +#: using/windows.rst:641 +msgid "" +"Regardless of the install method, users will still need to install their own " +"copies of Python itself, as there is no way to trigger those installs " +"without being a logged in user. When using the MSIX, the latest version of " +"Python will be available for all users to install without network access." +msgstr "" +"Ανεξάρτητα από τη μέθοδο εγκατάστασης, οι χρήστες θα πρέπει να εγκαταστήσουν " +"τις δικές τους αντίγραφα της Python, καθώς δεν υπάρχει τρόπος να " +"ενεργοποιηθούν αυτές οι εγκαταστάσεις χωρίς να είναι συνδεδεμένος χρήστης. " +"Όταν χρησιμοποιείτε το MSIX, η τελευταία έκδοση της Python θα είναι " +"διαθέσιμη για όλους τους χρήστες για εγκατάσταση χωρίς πρόσβαση στο δίκτυο." + +#: using/windows.rst:646 +msgid "" +"Note that the MSIX downloadable from the Store and from the Python website " +"are subtly different and cannot be installed at the same time. Wherever " +"possible, we suggest using the above WinGet commands to download the package " +"from the Store to reduce the risk of setting up conflicting installs. There " +"are no licensing restrictions on the Python install manager that would " +"prevent using the Store package in this way." +msgstr "" +"Σημειώστε ότι το MSIX που μπορεί να ληφθεί από το Store και από τον ιστότοπο " +"της Python είναι ελαφρώς διαφορετικό και δεν μπορούν να εγκατασταθούν " +"ταυτόχρονα. Όπου είναι δυνατόν, προτείνουμε τη χρήση των παραπάνω εντολών " +"WinGet για τη λήψη του πακέτου από το Store για να μειωθεί ο κίνδυνος " +"ρύθμισης συγκρουόμενων εγκαταστάσεων. Δεν υπάρχουν περιορισμοί αδειοδότησης " +"στον διαχειριστή εγκατάστασης Python που να εμποδίζουν τη χρήση του πακέτου " +"Store με αυτόν τον τρόπο." + +#: using/windows.rst:657 +msgid "Administrative configuration" +msgstr "Διαχειριστική διαμόρφωση" + +#: using/windows.rst:659 +msgid "" +"There are a number of options that may be useful for administrators to " +"override configuration of the Python install manager. These can be used to " +"provide local caching, disable certain shortcut types, override bundled " +"content. All of the above configuration options may be set, as well as those " +"below." +msgstr "" +"Υπάρχουν πολλές επιλογές που μπορεί να είναι χρήσιμες για τους διαχειριστές " +"για να υπερκαλύψουν τη διαμόρφωση του διαχειριστή εγκατάστασης Python. Αυτές " +"μπορούν να χρησιμοποιηθούν για την παροχή τοπικής προσωρινής αποθήκευσης, " +"την απενεργοποίηση ορισμένων τύπων συντομεύσεων, την υπερκάλυψη " +"ενσωματωμένου περιεχομένου. Όλες οι παραπάνω επιλογές διαμόρφωσης μπορούν να " +"οριστούν, καθώς και αυτές παρακάτω." + +#: using/windows.rst:664 +msgid "" +"Configuration options may be overridden in the registry by setting values " +"under :file:`HKEY_LOCAL_MACHINE\\\\Software\\\\Policies\\\\Python\\" +"\\PyManager`, where the value name matches the configuration key and the " +"value type is ``REG_SZ``. Note that this key can itself be customized, but " +"only by modifying the core config file distributed with the Python install " +"manager. We recommend, however, that registry values are used only to set " +"``base_config`` to a JSON file containing the full set of overrides. " +"Registry key overrides will replace any other configured setting, while " +"``base_config`` allows users to further modify settings they may need." +msgstr "" +"Οι επιλογές διαμόρφωσης μπορούν να υπερκαλυφθούν στο μητρώο ρυθμίζοντας " +"τιμές κάτω από :file:`HKEY_LOCAL_MACHINE\\\\Software\\\\Policies\\\\Python\\" +"\\PyManager`, όπου το όνομα της τιμής ταιριάζει με το κλειδί διαμόρφωσης και " +"ο τύπος τιμής είναι ``REG_SZ``. Σημειώστε ότι αυτό το κλειδί μπορεί να " +"προσαρμοστεί, αλλά μόνο τροποποιώντας το βασικό αρχείο διαμόρφωσης που " +"διανέμεται με τον διαχειριστή εγκατάστασης Python. Ωστόσο, συνιστούμε, " +"ωστόσο, ότι οι τιμές μητρώου χρησιμοποιούνται μόνο για να ορίσουν " +"``base_config`` σε ένα αρχείο JSON που περιέχει το πλήρες σύνολο των " +"υπερκαλύψεων. Οι υπερκαλύψεις κλειδιών μητρώου θα αντικαταστήσουν " +"οποιαδήποτε άλλη ρυθμισμένη ρύθμιση, ενώ ``base_config`` επιτρέπει στους " +"χρήστες να τροποποιούν περαιτέρω ρυθμίσεις που μπορεί να χρειαστούν." + +#: using/windows.rst:674 +msgid "" +"Note that most settings with environment variables support those variables " +"because their default setting specifies the variable. If you override them, " +"the environment variable will no longer work, unless you override it with " +"another one. For example, the default value of ``confirm`` is literally " +"``%PYTHON_MANAGER_CONFIRM%``, which will resolve the variable at load time. " +"If you override the value to ``yes``, then the environment variable will no " +"longer be used. If you override the value to ``%CONFIRM%``, then that " +"environment variable will be used instead." +msgstr "" +"Σημειώστε ότι οι περισσότερες ρυθμίσεις με μεταβλητές περιβάλλοντος " +"υποστηρίζουν αυτές τις μεταβλητές επειδή η προεπιλεγμένη ρύθμισή τους " +"καθορίζει τη μεταβλητή. Εάν τις υπερκαλύψετε, η μεταβλητή περιβάλλοντος δεν " +"θα λειτουργεί πλέον, εκτός εάν την υπερκαλύψετε με άλλη. Για παράδειγμα, η " +"προεπιλεγμένη τιμή του ``confirm`` είναι κυριολεκτικά " +"``%PYTHON_MANAGER_CONFIRM%``, η οποία θα επιλύσει τη μεταβλητή κατά το χρόνο " +"φόρτωσης. Εάν υπερκαλύψετε την τιμή σε ``yes``, τότε η μεταβλητή " +"περιβάλλοντος δεν θα χρησιμοποιείται πλέον. Εάν υπερκαλύψετε την τιμή σε " +"``%CONFIRM%``, τότε θα χρησιμοποιηθεί αυτή η μεταβλητή περιβάλλοντος." + +#: using/windows.rst:683 +msgid "" +"Configuration settings that are paths are interpreted as relative to the " +"directory containing the configuration file that specified them." +msgstr "" +"Οι ρυθμίσεις διαμόρφωσης που είναι διαδρομές ερμηνεύονται ως σχετικές με τον " +"κατάλογο που περιέχει το αρχείο διαμόρφωσης που τις καθόρισε." + +#: using/windows.rst:690 +msgid "Administrative configuration options" +msgstr "Διαχειριστικές επιλογές διαμόρφωσης" + +#: using/windows.rst:697 +msgid "``base_config``" +msgstr "``base_config``" + +#: using/windows.rst:698 +msgid "" +"The highest priority configuration file to read. Note that only the built-in " +"configuration file and the registry can modify this setting." +msgstr "" +"Το αρχείο διαμόρφωσης με την υψηλότερη προτεραιότητα για ανάγνωση. Σημειώστε " +"ότι μόνο το ενσωματωμένο αρχείο διαμόρφωσης και το μητρώο μπορούν να " +"τροποποιήσουν αυτήν τη ρύθμιση." + +#: using/windows.rst:702 +msgid "``user_config``" +msgstr "``user_config``" + +#: using/windows.rst:703 +msgid "The second configuration file to read." +msgstr "Το δεύτερο αρχείο διαμόρφωσης για ανάγνωση." + +#: using/windows.rst:705 +msgid "``additional_config``" +msgstr "``additional_config``" + +#: using/windows.rst:706 +msgid "The third configuration file to read." +msgstr "Το τρίτο αρχείο διαμόρφωσης για ανάγνωση." + +#: using/windows.rst:708 +msgid "``registry_override_key``" +msgstr "``registry_override_key``" -#: using/windows.rst:227 -msgid "LauncherOnly" +#: using/windows.rst:709 +msgid "" +"Registry location to check for overrides. Note that only the built-in " +"configuration file can modify this setting." msgstr "" +"Τοποθεσία μητρώου για έλεγχο για υπερκαλύψεις. Σημειώστε ότι μόνο το " +"ενσωματωμένο αρχείο διαμόρφωσης μπορεί να τροποποιήσει αυτήν τη ρύθμιση." -#: using/windows.rst:227 -msgid "Only installs the launcher. This will override most other options." -msgstr "" +#: using/windows.rst:712 +msgid "``bundled_dir``" +msgstr "``bundled_dir``" -#: using/windows.rst:230 -msgid "SimpleInstall" -msgstr "" +#: using/windows.rst:713 +msgid "Read-only directory containing locally cached files." +msgstr "Κατάλογος μόνο για ανάγνωση που περιέχει τοπικά αποθηκευμένα αρχεία." -#: using/windows.rst:230 -msgid "Disable most install UI" -msgstr "" +#: using/windows.rst:715 +msgid "``install.fallback_source``" +msgstr "``install.fallback_source``" -#: using/windows.rst:232 -msgid "SimpleInstallDescription" +#: using/windows.rst:716 +msgid "" +"Path or URL to an index to consult when the main index cannot be accessed." msgstr "" +"Διαδρομή ή URL σε έναν ευρετήριο για συμβουλή όταν δεν είναι δυνατή η " +"πρόσβαση στον κύριο ευρετήριο." -#: using/windows.rst:232 -msgid "A custom message to display when the simplified install UI is used." -msgstr "" +#: using/windows.rst:718 +msgid "``install.enable_shortcut_kinds``" +msgstr "``install.enable_shortcut_kinds``" -#: using/windows.rst:236 +#: using/windows.rst:719 msgid "" -"For example, to silently install a default, system-wide Python installation, " -"you could use the following command (from an elevated command prompt)::" +"Comma-separated list of shortcut kinds to allow (e.g. ``\"pep514,start\"``). " +"Enabled shortcuts may still be disabled by ``disable_shortcut_kinds``." msgstr "" +"Λίστα με κόμμα διαχωρισμένων ειδών συντομεύσεων για να επιτρέπονται (π.χ. " +"``\"pep514,start\"``). Οι ενεργοποιημένες συντομεύσεις ενδέχεται ακόμη να " +"απενεργοποιηθούν από το ``disable_shortcut_kinds``." -#: using/windows.rst:241 -msgid "" -"To allow users to easily install a personal copy of Python without the test " -"suite, you could provide a shortcut with the following command. This will " -"display a simplified initial page and disallow customization::" -msgstr "" +#: using/windows.rst:722 +msgid "``install.disable_shortcut_kinds``" +msgstr "``install.disable_shortcut_kinds``" -#: using/windows.rst:248 +#: using/windows.rst:723 msgid "" -"(Note that omitting the launcher also omits file associations, and is only " -"recommended for per-user installs when there is also a system-wide " -"installation that included the launcher.)" +"Comma-separated list of shortcut kinds to exclude (e.g. ``\"pep514," +"start\"``). Disabled shortcuts are not reactivated by " +"``enable_shortcut_kinds``." msgstr "" +"Λίστα με κόμμα διαχωρισμένων ειδών συντομεύσεων για να εξαιρούνται (π.χ. " +"``\"pep514,start\"``). Οι απενεργοποιημένες συντομεύσεις δεν " +"επανενεργοποιούνται από το ``enable_shortcut_kinds``." -#: using/windows.rst:252 +#: using/windows.rst:727 +msgid "``pep514_root``" +msgstr "``pep514_root``" + +#: using/windows.rst:728 msgid "" -"The options listed above can also be provided in a file named ``unattend." -"xml`` alongside the executable. This file specifies a list of options and " -"values. When a value is provided as an attribute, it will be converted to a " -"number if possible. Values provided as element text are always left as " -"strings. This example file sets the same options as the previous example:" +"Registry location to read and write PEP 514 entries into. By default, :file:" +"`HKEY_CURRENT_USER\\\\Software\\\\Python`." msgstr "" +"Τοποθεσία μητρώου για ανάγνωση και εγγραφή καταχωρήσεων PEP 514. Από " +"προεπιλογή, :file:`HKEY_CURRENT_USER\\\\Software\\\\Python`." -#: using/windows.rst:271 -msgid "Installing Without Downloading" -msgstr "" +#: using/windows.rst:731 +msgid "``start_folder``" +msgstr "``start_folder``" -#: using/windows.rst:273 +#: using/windows.rst:732 msgid "" -"As some features of Python are not included in the initial installer " -"download, selecting those features may require an internet connection. To " -"avoid this need, all possible components may be downloaded on-demand to " -"create a complete *layout* that will no longer require an internet " -"connection regardless of the selected features. Note that this download may " -"be bigger than required, but where a large number of installations are going " -"to be performed it is very useful to have a locally cached copy." +"Start menu folder to write shortcuts into. By default, ``Python``. This path " +"is relative to the user's Programs folder." msgstr "" +"Φάκελος μενού Έναρξης για εγγραφή συντομεύσεων. Από προεπιλογή, ``Python``. " +"Αυτή η διαδρομή είναι σχετική με το φάκελο Προγράμματα του χρήστη." -#: using/windows.rst:281 -msgid "" -"Execute the following command from Command Prompt to download all possible " -"required files. Remember to substitute ``python-3.9.0.exe`` for the actual " -"name of your installer, and to create layouts in their own directories to " -"avoid collisions between files with the same name." -msgstr "" +#: using/windows.rst:736 +msgid "``virtual_env``" +msgstr "``virtual_env``" -#: using/windows.rst:290 +#: using/windows.rst:737 msgid "" -"You may also specify the ``/quiet`` option to hide the progress display." +"Path to the active virtual environment. By default, this is " +"``%VIRTUAL_ENV%``, but may be set empty to disable venv detection." msgstr "" +"Διαδρομή προς το ενεργό εικονικό περιβάλλον. Από προεπιλογή, αυτό είναι " +"``%VIRTUAL_ENV%``, αλλά μπορεί να οριστεί κενό για να απενεργοποιηθεί η " +"ανίχνευση venv." -#: using/windows.rst:293 -msgid "Modifying an install" -msgstr "" +#: using/windows.rst:741 +msgid "``shebang_can_run_anything_silently``" +msgstr "``shebang_can_run_anything_silently``" -#: using/windows.rst:295 +#: using/windows.rst:742 msgid "" -"Once Python has been installed, you can add or remove features through the " -"Programs and Features tool that is part of Windows. Select the Python entry " -"and choose \"Uninstall/Change\" to open the installer in maintenance mode." +"True to suppress visible warnings when a shebang launches an application " +"other than a Python runtime." msgstr "" +"True για να καταστείλει ορατές προειδοποιήσεις όταν ένα shebang εκκινεί μια " +"εφαρμογή εκτός από μια εκτελέσιμη Python." + +#: using/windows.rst:1563 +msgid "Installing free-threaded binaries" +msgstr "Εγκατάσταση Δυαδικών Αρχείων με Ελεύθερα Νήματα" -#: using/windows.rst:299 +#: using/windows.rst:752 msgid "" -"\"Modify\" allows you to add or remove features by modifying the checkboxes " -"- unchanged checkboxes will not install or remove anything. Some options " -"cannot be changed in this mode, such as the install directory; to modify " -"these, you will need to remove and then reinstall Python completely." +"Pre-built distributions of the free-threaded build are available by " +"installing tags with the ``t`` suffix." msgstr "" +"Οι προ-κατασκευασμένες διανομές της έκδοσης με ελεύθερα νήματα είναι " +"διαθέσιμες με την εγκατάσταση ετικετών με το επίθημα ``t``." -#: using/windows.rst:304 +#: using/windows.rst:755 msgid "" -"\"Repair\" will verify all the files that should be installed using the " -"current settings and replace any that have been removed or modified." +"$> py install 3.14t\n" +"$> py install 3.14t-arm64\n" +"$> py install 3.14t-32" msgstr "" +"$> py install 3.14t\n" +"$> py install 3.14t-arm64\n" +"$> py install 3.14t-32" -#: using/windows.rst:307 +#: using/windows.rst:761 msgid "" -"\"Uninstall\" will remove Python entirely, with the exception of the :ref:" -"`launcher`, which has its own entry in Programs and Features." +"This will install and register as normal. If you have no other runtimes " +"installed, then ``python`` will launch this one. Otherwise, you will need to " +"use ``py -V:3.14t ...`` or, if you have added the global aliases directory " +"to your :envvar:`PATH` environment variable, the ``python3.14t.exe`` " +"commands." msgstr "" +"Αυτό θα εγκαταστήσει και θα καταχωρήσει ως κανονικό. Εάν δεν έχετε άλλες " +"εκτελέσιμες εγκαταστάσεις, τότε το ``python`` θα εκκινήσει αυτήν. Αλλιώς, θα " +"χρειαστεί να χρησιμοποιήσετε το ``py -V:3.14t ...`` ή, εάν έχετε προσθέσει " +"τον παγκόσμιο κατάλογο ψευδωνύμων στη μεταβλητή περιβάλλοντος :envvar:" +"`PATH`, τις εντολές ``python3.14t.exe``." -#: using/windows.rst:314 -msgid "The Microsoft Store package" -msgstr "" +#: using/windows.rst:781 +msgid "Troubleshooting" +msgstr "Αντιμετώπιση προβλημάτων" -#: using/windows.rst:318 +#: using/windows.rst:771 msgid "" -"The Microsoft Store package is an easily installable Python interpreter that " -"is intended mainly for interactive use, for example, by students." +"If your Python install manager does not seem to be working correctly, please " +"work through these tests and fixes to see if it helps. If not, please report " +"an issue at `our bug tracker `_, " +"including any relevant log files (written to your :file:`%TEMP%` directory " +"by default)." msgstr "" +"Εάν ο διαχειριστής εγκατάστασης Python δεν φαίνεται να λειτουργεί σωστά, " +"παρακαλούμε να εργαστείτε μέσα από αυτές τις δοκιμές και διορθώσεις για να " +"δείτε αν βοηθάει. Εάν όχι, παρακαλούμε αναφέρετε ένα ζήτημα στο `our bug " +"tracker `_, συμπεριλαμβάνοντας " +"οποιαδήποτε σχετικά αρχεία καταγραφής (γραμμένα στον φάκελο :file:`%TEMP%` " +"από προεπιλογή)." -#: using/windows.rst:321 -msgid "" -"To install the package, ensure you have the latest Windows 10 updates and " -"search the Microsoft Store app for \"Python |version|\". Ensure that the app " -"you select is published by the Python Software Foundation, and install it." -msgstr "" +#: using/windows.rst:785 +msgid "Symptom" +msgstr "Σύμπτωμα" -#: using/windows.rst:326 -msgid "" -"Python will always be available for free on the Microsoft Store. If you are " -"asked to pay for it, you have not selected the correct package." -msgstr "" +#: using/windows.rst:786 +msgid "Things to try" +msgstr "Πράγματα που μπορείτε να δοκιμάσετε" -#: using/windows.rst:329 +#: using/windows.rst:788 msgid "" -"After installation, Python may be launched by finding it in Start. " -"Alternatively, it will be available from any Command Prompt or PowerShell " -"session by typing ``python``. Further, pip and IDLE may be used by typing " -"``pip`` or ``idle``. IDLE can also be found in Start." +"``python`` gives me a \"command not found\" error or opens the Store app " +"when I type it in my terminal." msgstr "" +"το ``python`` μου δίνει σφάλμα \"command not found\" ή ανοίγει την εφαρμογή " +"Store όταν το πληκτρολογώ στο τερματικό μου." -#: using/windows.rst:334 -msgid "" -"All three commands are also available with version number suffixes, for " -"example, as ``python3.exe`` and ``python3.x.exe`` as well as ``python.exe`` " -"(where ``3.x`` is the specific version you want to launch, such as |" -"version|). Open \"Manage App Execution Aliases\" through Start to select " -"which version of Python is associated with each command. It is recommended " -"to make sure that ``pip`` and ``idle`` are consistent with whichever version " -"of ``python`` is selected." -msgstr "" +#: using/windows.rst:803 +msgid "Did you :ref:`install the Python install manager `?" +msgstr "Εγκαταστήσατε το :ref:`install the Python install manager `" -#: using/windows.rst:342 +#: using/windows.rst:806 msgid "" -"Virtual environments can be created with ``python -m venv`` and activated " -"and used as normal." +"Click Start, open \"Manage app execution aliases\", and check that the " +"aliases for \"Python (default)\" are enabled. If they already are, try " +"disabling and re-enabling to refresh the command. The \"Python (default " +"windowed)\" and \"Python install manager\" commands may also need refreshing." msgstr "" +"Κάντε κλικ στο Έναρξη, ανοίξτε το \"Διαχείριση εκτέλεσης εφαρμογών\" και " +"ελέγξτε ότι τα aliases για το \"Python (default)\" είναι ενεργοποιημένα. Εάν " +"ήδη είναι, δοκιμάστε να τα απενεργοποιήσετε και να τα ενεργοποιήσετε ξανά " +"για να ανανεώσετε την εντολή. Οι εντολές \"Python (default windowed)\" και " +"\"Python install manager\" ενδέχεται επίσης να χρειάζονται ανανέωση." -#: using/windows.rst:345 -msgid "" -"If you have installed another version of Python and added it to your " -"``PATH`` variable, it will be available as ``python.exe`` rather than the " -"one from the Microsoft Store. To access the new installation, use ``python3." -"exe`` or ``python3.x.exe``." -msgstr "" +#: using/windows.rst:800 +msgid "Check that the ``py`` and ``pymanager`` commands work." +msgstr "Ελέγξτε ότι οι εντολές ``py`` και ``pymanager`` λειτουργούν." -#: using/windows.rst:350 +#: using/windows.rst:802 msgid "" -"The ``py.exe`` launcher will detect this Python installation, but will " -"prefer installations from the traditional installer." +"``py`` gives me a \"command not found\" error when I type it in my terminal." msgstr "" +"Το ``py`` μου δίνει σφάλμα \"command not found\" όταν το πληκτρολογώ στο " +"τερματικό μου." -#: using/windows.rst:353 +#: using/windows.rst:812 msgid "" -"To remove Python, open Settings and use Apps and Features, or else find " -"Python in Start and right-click to select Uninstall. Uninstalling will " -"remove all packages you installed directly into this Python installation, " -"but will not remove any virtual environments" +"``py`` gives me a \"can't open file\" error when I type commands in my " +"terminal." msgstr "" +"το ``py`` μου δίνει σφάλμα \"can't open file\" όταν πληκτρολογώ εντολές στο " +"τερματικό μου." -#: using/windows.rst:359 -msgid "Known issues" -msgstr "" - -#: using/windows.rst:362 -msgid "Redirection of local data, registry, and temporary paths" -msgstr "" - -#: using/windows.rst:364 +#: using/windows.rst:814 msgid "" -"Because of restrictions on Microsoft Store apps, Python scripts may not have " -"full write access to shared locations such as :envvar:`TEMP` and the " -"registry. Instead, it will write to a private copy. If your scripts must " -"modify the shared locations, you will need to install the full installer." +"This usually means you have the legacy launcher installed and it has " +"priority over the Python install manager. To remove, click Start, open " +"\"Installed apps\", search for \"Python launcher\" and uninstall it." msgstr "" +"Αυτό συνήθως σημαίνει ότι έχετε εγκαταστήσει τον παλιό launcher και έχει " +"προτεραιότητα έναντι του διαχειριστή εγκατάστασης Python. Για να το " +"αφαιρέσετε, κάντε κλικ στο Έναρξη, ανοίξτε το \"Εγκατεστημένες εφαρμογές\", " +"αναζητήστε το \"Python launcher\" και απεγκαταστήστε το." -#: using/windows.rst:369 -msgid "" -"At runtime, Python will use a private copy of well-known Windows folders and " -"the registry. For example, if the environment variable :envvar:`%APPDATA%` " -"is :file:`c:\\\\Users\\\\\\\\AppData\\\\`, then when writing to :file:" -"`C:\\\\Users\\\\\\\\AppData\\\\Local` will write to :file:`C:\\" -"\\Users\\\\\\\\AppData\\\\Local\\\\Packages\\" -"\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\\\LocalCache\\\\Local\\" -"\\`." -msgstr "" +#: using/windows.rst:819 +msgid "``python`` doesn't launch the same runtime as ``py``" +msgstr "η ``python`` δεν ξεκινά το ίδιο runtime με το ``py``" -#: using/windows.rst:374 +#: using/windows.rst:820 msgid "" -"When reading files, Windows will return the file from the private folder, or " -"if that does not exist, the real Windows directory. For example reading :" -"file:`C:\\\\Windows\\\\System32` returns the contents of :file:`C:\\" -"\\Windows\\\\System32` plus the contents of :file:`C:\\\\Program Files\\" -"\\WindowsApps\\\\package_name\\\\VFS\\\\SystemX86`." +"Click Start, open \"Installed apps\", look for any existing Python runtimes, " +"and either remove them or Modify and disable the :envvar:`PATH` options." msgstr "" +"Κάντε κλικ στο Έναρξη, ανοίξτε το \"Εγκατεστημένες εφαρμογές\", αναζητήστε " +"τους υπάρχοντες Python runtimes και είτε αφαιρέστε τους είτε τροποποιήστε " +"και απενεργοποιήστε τις επιλογές :envvar:`PATH`." -#: using/windows.rst:378 +#: using/windows.rst:824 msgid "" -"You can find the real path of any existing file using :func:`os.path." -"realpath`:" +"Click Start, open \"Manage app execution aliases\", and check that your " +"``python.exe`` alias is set to \"Python (default)\"" msgstr "" +"Κάντε κλικ στο Έναρξη, ανοίξτε το \"Διαχείριση εκτέλεσης εφαρμογών\" και " +"ελέγξτε ότι το alias ``python.exe`` είναι ρυθμισμένο σε \"Python (default)\"" -#: using/windows.rst:387 -msgid "When writing to the Windows Registry, the following behaviors exist:" -msgstr "" +#: using/windows.rst:827 +msgid "``python`` and ``py`` don't launch the runtime I expect" +msgstr "``python`` και ``py`` δεν ξεκινούν το runtime που περιμένω" -#: using/windows.rst:389 +#: using/windows.rst:828 msgid "" -"Reading from ``HKLM\\\\Software`` is allowed and results are merged with " -"the :file:`registry.dat` file in the package." +"Check your :envvar:`PYTHON_MANAGER_DEFAULT` environment variable or " +"``default_tag`` configuration. The ``py list`` command will show your " +"default based on these settings." msgstr "" +"Ελέγξτε τη μεταβλητή περιβάλλοντος :envvar:`PYTHON_MANAGER_DEFAULT` ή τη " +"διαμόρφωση ``default_tag``. Η εντολή ``py list`` θα εμφανίσει την προεπιλογή " +"σας με βάση αυτές τις ρυθμίσεις." -#: using/windows.rst:390 +#: using/windows.rst:833 msgid "" -"Writing to ``HKLM\\\\Software`` is not allowed if the corresponding key/" -"value exists, i.e. modifying existing keys." +"Installs that are managed by the Python install manager will be chosen ahead " +"of unmanaged installs. Use ``py install`` to install the runtime you expect, " +"or configure your default tag." msgstr "" +"Εγκαταστάσεις που διαχειρίζονται από τον διαχειριστή εγκατάστασης Python θα " +"επιλεγούν πριν από τις μη διαχειριζόμενες εγκαταστάσεις. Χρησιμοποιήστε το " +"``py install`` για να εγκαταστήσετε το runtime που περιμένετε, ή διαμορφώστε " +"την προεπιλεγμένη ετικέτα σας." -#: using/windows.rst:391 +#: using/windows.rst:839 msgid "" -"Writing to ``HKLM\\\\Software`` is allowed as long as a corresponding key/" -"value does not exist in the package and the user has the correct access " -"permissions." +"Prerelease and experimental installs that are not managed by the Python " +"install manager may be chosen ahead of stable releases. Configure your " +"default tag or uninstall the prerelease runtime and reinstall using ``py " +"install``." msgstr "" +"Προεκδόσεις και πειραματικές εγκαταστάσεις που δεν διαχειρίζονται από τον " +"διαχειριστή εγκατάστασης Python ενδέχεται να επιλεγούν πριν από τις σταθερές " +"εκδόσεις. Διαμορφώστε την προεπιλεγμένη ετικέτα σας ή απεγκαταστήστε το " +"runtime προέκδοσης και επανεγκαταστήστε το χρησιμοποιώντας το ``py install``." -#: using/windows.rst:394 +#: using/windows.rst:844 msgid "" -"For more detail on the technical basis for these limitations, please consult " -"Microsoft's documentation on packaged full-trust apps, currently available " -"at `docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-behind-the-" -"scenes `_" -msgstr "" - -#: using/windows.rst:403 -msgid "The nuget.org packages" +"``pythonw`` or ``pyw`` don't launch the same runtime as ``python`` or ``py``" msgstr "" +"``pythonw`` ή ``pyw`` δεν ξεκινούν το ίδιο runtime με το ``python`` ή το " +"``py``" -#: using/windows.rst:407 +#: using/windows.rst:845 msgid "" -"The nuget.org package is a reduced size Python environment intended for use " -"on continuous integration and build systems that do not have a system-wide " -"install of Python. While nuget is \"the package manager for .NET\", it also " -"works perfectly fine for packages containing build-time tools." +"Click Start, open \"Manage app execution aliases\", and check that your " +"``pythonw.exe`` and ``pyw.exe`` aliases are consistent with your others." msgstr "" +"Κάντε κλικ στο Έναρξη, ανοίξτε το \"Διαχείριση εκτέλεσης εφαρμογών\" και " +"ελέγξτε ότι τα aliases σας ``pythonw.exe`` και ``pyw.exe`` είναι συνεπή με " +"τα άλλα." -#: using/windows.rst:412 +#: using/windows.rst:848 msgid "" -"Visit `nuget.org `_ for the most up-to-date " -"information on using nuget. What follows is a summary that is sufficient for " -"Python developers." +"``pip`` gives me a \"command not found\" error when I type it in my terminal." msgstr "" +"Το ``pip`` μου δίνει σφάλμα \"command not found\" όταν το πληκτρολογώ στο " +"τερματικό μου." -#: using/windows.rst:416 +#: using/windows.rst:849 msgid "" -"The ``nuget.exe`` command line tool may be downloaded directly from " -"``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With " -"the tool, the latest version of Python for 64-bit or 32-bit machines is " -"installed using::" +"Have you activated a virtual environment? Run the ``." +"venv\\Scripts\\activate`` script in your terminal to activate." msgstr "" +"Έχετε ενεργοποιήσει ένα εικονικό περιβάλλον; Εκτελέστε το script ``." +"venv\\Scripts\\activate`` στο τερματικό σας για να το ενεργοποιήσετε." -#: using/windows.rst:424 +#: using/windows.rst:853 msgid "" -"To select a particular version, add a ``-Version 3.x.y``. The output " -"directory may be changed from ``.``, and the package will be installed into " -"a subdirectory. By default, the subdirectory is named the same as the " -"package, and without the ``-ExcludeVersion`` option this name will include " -"the specific version installed. Inside the subdirectory is a ``tools`` " -"directory that contains the Python installation:" +"The package may be available but missing the generated executable. We " +"recommend using the ``python -m pip`` command instead, or alternatively the " +"``python -m pip install --force pip`` command will recreate the executables " +"and show you the path to add to :envvar:`PATH`. These scripts are separated " +"for each runtime, and so you may need to add multiple paths." msgstr "" +"Το πακέτο ενδέχεται να είναι διαθέσιμο αλλά να λείπει το δημιουργημένο " +"εκτελέσιμο. Συνιστούμε τη χρήση της εντολής ``python -m pip``, ή εναλλακτικά " +"η εντολή ``python -m pip install --force pip`` θα αναδημιουργήσει τα " +"εκτελέσιμα και θα σας δείξει τη διαδρομή για προσθήκη στο :envvar:`PATH`. " +"Αυτά τα scripts είναι ξεχωριστά για κάθε runtime, και έτσι μπορεί να " +"χρειαστεί να προσθέσετε πολλαπλές διαδρομές." -#: using/windows.rst:441 -msgid "" -"In general, nuget packages are not upgradeable, and newer versions should be " -"installed side-by-side and referenced using the full path. Alternatively, " -"delete the package directory manually and install it again. Many CI systems " -"will do this automatically if they do not preserve files between builds." +#: using/windows.rst:861 +msgid "Typing ``script-name.py`` in the terminal opens in a new window." msgstr "" +"Πληκτρολογώντας ``script-name.py`` στο τερματικό ανοίγει σε νέο παράθυρο." -#: using/windows.rst:446 +#: using/windows.rst:862 msgid "" -"Alongside the ``tools`` directory is a ``build\\native`` directory. This " -"contains a MSBuild properties file ``python.props`` that can be used in a C+" -"+ project to reference the Python install. Including the settings will " -"automatically use the headers and import libraries in your build." +"This is a known limitation of the operating system. Either specify ``py`` " +"before the script name, create a batch file containing ``@py \"%~dpn0.py\" " +"%*`` with the same name as the script, or install the `legacy launcher`_ and " +"select it as the association for scripts." msgstr "" +"Αυτή είναι μια γνωστή περιορισμός του λειτουργικού συστήματος. Είτε " +"καθορίστε ``py`` πριν από το όνομα του script, δημιουργήστε ένα αρχείο batch " +"που περιέχει ``@py \"%~dpn0.py\" %*`` με το ίδιο όνομα με το script, είτε " +"εγκαταστήστε τον `legacy launcher`_ και επιλέξτε τον ως την συσχέτιση για τα " +"scripts." -#: using/windows.rst:451 +#: using/windows.rst:867 +msgid "Drag-dropping files onto a script doesn't work" +msgstr "Το drag-dropping αρχείων σε ένα script δεν λειτουργεί" + +#: using/windows.rst:868 msgid "" -"The package information pages on nuget.org are `www.nuget.org/packages/" -"python `_ for the 64-bit version and " -"`www.nuget.org/packages/pythonx86 `_ for the 32-bit version." +"This is a known limitation of the operating system. It is supported with the " +"`legacy launcher`_, or with the Python install manager when installed from " +"the MSI." msgstr "" +"Αυτή είναι μια γνωστή περιορισμός του λειτουργικού συστήματος. Υποστηρίζεται " +"με τον `legacy launcher`_, ή με τον διαχειριστή εγκατάστασης Python όταν " +"εγκαθίσταται από το MSI." -#: using/windows.rst:460 +#: using/windows.rst:876 msgid "The embeddable package" -msgstr "" +msgstr "Το ενσωματωμένο πακέτο" -#: using/windows.rst:464 +#: using/windows.rst:880 msgid "" "The embedded distribution is a ZIP file containing a minimal Python " "environment. It is intended for acting as part of another application, " "rather than being directly accessed by end-users." msgstr "" +"Η ενσωματωμένη διανομή είναι ένα αρχείο ZIP που περιέχει ένα ελάχιστο " +"περιβάλλον Python. Προορίζεται για δράση ως μέρος μιας άλλης εφαρμογής, αντί " +"να έχει άμεση πρόσβαση από τους τελικούς χρήστες." -#: using/windows.rst:468 +#: using/windows.rst:884 +msgid "" +"To install an embedded distribution, we recommend using ``py install`` with " +"the ``--target`` option:" +msgstr "" +"Για να εγκαταστήσετε μια ενσωματωμένη διανομή, προτείνουμε τη χρήση του ``py " +"install`` με την επιλογή ``--target``:" + +#: using/windows.rst:887 +msgid "$> py install 3.14-embed --target=runtime" +msgstr "$> py install 3.14-embed --target=runtime" + +#: using/windows.rst:891 msgid "" "When extracted, the embedded distribution is (almost) fully isolated from " "the user's system, including environment variables, system registry " "settings, and installed packages. The standard library is included as pre-" "compiled and optimized ``.pyc`` files in a ZIP, and ``python3.dll``, " -"``python37.dll``, ``python.exe`` and ``pythonw.exe`` are all provided. Tcl/" +"``python313.dll``, ``python.exe`` and ``pythonw.exe`` are all provided. Tcl/" "tk (including all dependents, such as Idle), pip and the Python " "documentation are not included." msgstr "" +"Όταν εξάγεται, η ενσωματωμένη διανομή απομονώνεται (σχεδόν) πλήρως από το " +"σύστημα του χρήστη, συμπεριλαμβανομένων μεταβλητών περιβάλλοντος, ρυθμίσεων " +"μητρώου συστήματος και εγκατεστημένων πακέτων. Η τυπική βιβλιοθήκη " +"περιλαμβάνεται ως προ-μεταγλωττισμένα και βελτιστοποιημένα αρχεία ``.pyc`` " +"σε ένα ZIP και ``python3.dll``, ``python313.dll``, ``python.exe`` και " +"``pythonw.exe`` παρέχονται όλα. Το Tcl/tk (συμπεριλαμβανομένων όλων των " +"εξαρτημένων, όπως το Idle), το pip και η τεκμηρίωση Python δεν " +"συμπεριλαμβάνονται." -#: using/windows.rst:477 +#: using/windows.rst:898 msgid "" -"The embedded distribution does not include the `Microsoft C Runtime `_ and it is the responsibility of the " -"application installer to provide this. The runtime may have already been " -"installed on a user's system previously or automatically via Windows Update, " -"and can be detected by finding ``ucrtbase.dll`` in the system directory." +"A default ``._pth`` file is included, which further restricts the default " +"search paths (as described below in :ref:`windows_finding_modules`). This " +"file is intended for embedders to modify as necessary." msgstr "" +"Ένα προεπιλεγμένο αρχείο ``._pth`` περιλαμβάνεται, το οποίο περιορίζει " +"περαιτέρω τις προεπιλεγμένες διαδρομές αναζήτησης (όπως περιγράφεται " +"παρακάτω στο :ref:`windows_finding_modules`). Αυτό το αρχείο προορίζεται για " +"τροποποίηση από ενσωματωτές όπως είναι απαραίτητο." -#: using/windows.rst:484 +#: using/windows.rst:902 msgid "" "Third-party packages should be installed by the application installer " "alongside the embedded distribution. Using pip to manage dependencies as for " @@ -875,17 +1992,28 @@ msgid "" "part of the application (\"vendoring\") so that the developer can ensure " "compatibility with newer versions before providing updates to users." msgstr "" +"Τα πακέτα τρίτων θα πρέπει να εγκατασταθούν από το πρόγραμμα εγκατάστασης " +"της εφαρμογής παράλληλα με την ενσωματωμένη διανομή. Η χρήση pip για τη " +"διαχείριση εξαρτήσεων όπως για μια κανονική εγκατάσταση Python δεν " +"υποστηρίζεται με αυτήν τη διανομή, αν και με λίγη προσοχή μπορεί να είναι " +"δυνατό, να συμπεριληφθεί και να χρησιμοποιηθεί το pip για αυτόματες " +"ενημερώσεις. Γενικά, τα πακέτα τρίτων θα πρέπει να αντιμετωπίζονται ως μέρος " +"της εφαρμογής (\"vendoring\"), έτσι ώστε ο προγραμματιστής να μπορεί να " +"διασφαλίσει τη συμβατότητα με νεότερες εκδόσεις προτού παρέχει ενημερώσεις " +"στους χρήστες." -#: using/windows.rst:492 +#: using/windows.rst:910 msgid "" "The two recommended use cases for this distribution are described below." msgstr "" +"Οι δύο προτεινόμενες περιπτώσεις χρήσης για αυτήν τη διανομή περιγράφονται " +"παρακάτω." -#: using/windows.rst:495 -msgid "Python Application" -msgstr "" +#: using/windows.rst:913 +msgid "Python application" +msgstr "Εφαρμογή Python" -#: using/windows.rst:497 +#: using/windows.rst:915 msgid "" "An application written in Python does not necessarily require users to be " "aware of that fact. The embedded distribution may be used in this case to " @@ -893,8 +2021,13 @@ msgid "" "transparent it should be (or conversely, how professional it should appear), " "there are two options." msgstr "" +"Μια εφαρμογή γραμμένη σε Python δεν απαιτεί απαραίτητα από τους χρήστες να " +"γνωρίζουν αυτό το γεγονός. Η ενσωματωμένη διανομή μπορεί να χρησιμοποιηθεί " +"σε αυτήν την περίπτωση για να συμπεριλάβει μια ιδιωτική έκδοση της Python σε " +"ένα πακέτο εγκατάστασης. Ανάλογα με το πόσο διαφανές θα πρέπει να είναι (ή " +"αντίστροφα, πόσο επαγγελματικό θα έπρεπε να φαίνεται), υπάρχουν δύο επιλογές." -#: using/windows.rst:503 +#: using/windows.rst:921 msgid "" "Using a specialized executable as a launcher requires some coding, but " "provides the most transparent experience for users. With a customized " @@ -904,8 +2037,16 @@ msgid "" "launcher should simply be able to call ``Py_Main`` with a hard-coded command " "line." msgstr "" +"Η χρήση ενός εξειδικευμένου εκτελέσιμου ως προγράμματος εκκίνησης απαιτεί " +"κάποια κωδικοποίηση, αλλά παρέχει την πιο διαφανής εμπειρία για τους " +"χρήστες. Με έναν προσαρμοσμένο πρόγραμμα εκκίνησης, δεν υπάρχουν προφανείς " +"ενδείξεις ότι το πρόγραμμα εκτελείται σε Python: τα εικονίδια μπορούν να " +"προσαρμοστούν, οι πληροφορίες εταιρείας και έκδοσης μπορούν να καθορίζεται " +"και οι συσχετισμοί αρχείων συμπεριφέρονται σωστά. Στις περισσότερες " +"περιπτώσεις, ένα προσαρμοσμένο πρόγραμμα εκκίνησης θα πρέπει απλώς να μην " +"μπορεί να καλεί το ``Py_Main`` με μια σκληρά κωδικοποιημένη γραμμή εντολών." -#: using/windows.rst:510 +#: using/windows.rst:928 msgid "" "The simpler approach is to provide a batch file or generated shortcut that " "directly calls the ``python.exe`` or ``pythonw.exe`` with the required " @@ -913,8 +2054,14 @@ msgid "" "Python and not its actual name, and users may have trouble distinguishing it " "from other running Python processes or file associations." msgstr "" +"Η απλούστερη προσέγγιση είναι να παρέχετε ένα αρχείο δέσμης ή μια συντόμευση " +"που δημιουργείται που καλεί απευθείας το ``python.exe`` ή το ``pythonw.exe`` " +"με τα απαιτούμενα ορίσματα γραμμής εντολών. Σε αυτήν την περίπτωση, η " +"εφαρμογή φαίνεται να είναι Python και όχι το πραγματικό της όνομα, και οι " +"χρήστες μπορεί να έχουν πρόβλημα να το ξεχωρίσουν από άλλες διεργασίες " +"Python που εκτελούνται ή συσχετίσεις αρχείων." -#: using/windows.rst:516 +#: using/windows.rst:934 msgid "" "With the latter approach, packages should be installed as directories " "alongside the Python executable to ensure they are available on the path. " @@ -922,12 +2069,17 @@ msgid "" "there is an opportunity to specify the search path before launching the " "application." msgstr "" +"Με την τελευταία προσέγγιση, τα πακέτα θα πρέπει να εγκατασταθούν ως " +"κατάλογοι μαζί με το εκτελέσιμο Python για να διασφαλιστεί ότι είναι " +"διαθέσιμα στην διαδρομή. Με το εξειδικευμένο πρόγραμμα εκκίνησης τα πακέτα " +"μπορούν να βρίσκονται σε άλλες τοποθεσίες, καθώς υπάρχει η ευκαιρία να " +"καθοριστεί η διαδρομή αναζήτησης πριν από την εκκίνηση της εφαρμογής." -#: using/windows.rst:522 +#: using/windows.rst:940 msgid "Embedding Python" -msgstr "" +msgstr "Ενσωμάτωση Python" -#: using/windows.rst:524 +#: using/windows.rst:942 msgid "" "Applications written in native code often require some form of scripting " "language, and the embedded Python distribution can be used for this purpose. " @@ -937,224 +2089,336 @@ msgid "" "application installation is sufficient to provide a loadable Python " "interpreter." msgstr "" +"Οι εφαρμογές που είναι γραμμένες σε εγγενή κώδικα απαιτούν συχνά κάποια " +"μορφή scripting γλώσσας και η ενσωματωμένη διανομή Python μπορεί να " +"χρησιμοποιηθεί για αυτόν τον σκοπό. Γενικά, η πλειονότητα της εφαρμογής " +"είναι σε εγγενή κώδικα και κάποιο μέρος είτε θα καλέσει το ``python.exe`` ή " +"θα χρησιμοποιήσει απευθείας το ``python3.dll``. Και στις δύο περιπτώσεις, η " +"εξαγωγή της ενσωματωμένης διανομής σε έναν υποκατάλογο της εγκατάστασης της " +"εφαρμογής αρκεί για να παρέχει έναν διερμηνέα Python με δυνατότητα φόρτωσης." -#: using/windows.rst:531 +#: using/windows.rst:949 msgid "" "As with the application use, packages can be installed to any location as " "there is an opportunity to specify search paths before initializing the " "interpreter. Otherwise, there is no fundamental differences between using " "the embedded distribution and a regular installation." msgstr "" +"Όπως και με τη χρήση της εφαρμογής, τα πακέτα μπορούν να εγκατασταθούν σε " +"οποιαδήποτε τοποθεσία, καθώς υπάρχει η ευκαιρία να καθορίσουν διαδρομές " +"αναζήτησης πριν αρχικοποιηθεί ο διερμηνέας. Διαφορετικά , δεν υπάρχουν " +"θεμελιώδεις διαφορές μεταξύ της χρήσης της ενσωματωμένης διανομή και μιας " +"κανονικής εγκατάστασης." -#: using/windows.rst:538 -msgid "Alternative bundles" +#: using/windows.rst:958 +msgid "The nuget.org packages" +msgstr "Τα πακέτα nuget.org" + +#: using/windows.rst:962 +msgid "" +"The nuget.org package is a reduced size Python environment intended for use " +"on continuous integration and build systems that do not have a system-wide " +"install of Python. While nuget is \"the package manager for .NET\", it also " +"works perfectly fine for packages containing build-time tools." +msgstr "" +"Το πακέτο nuget.org είναι ένα περιβάλλον Python μειωμένου μεγέθους που " +"προορίζεται για χρήση σε συνεχή ενοποίηση και δημιουργία συστημάτων που δεν " +"έχουν εγκατάσταση Python. Ενώ το nuget είναι \"ο διαχειριστής πακέτων για ." +"NET\", λειτουργεί επίσης τέλεια για πακέτα που περιέχουν εργαλεία χρόνου " +"κατασκευής." + +#: using/windows.rst:967 +msgid "" +"Visit `nuget.org `_ for the most up-to-date " +"information on using nuget. What follows is a summary that is sufficient for " +"Python developers." +msgstr "" +"Επισκεφτείτε το `nuget.org `_ για τις πιο " +"ενημερωμένες πληροφορίες σχετικά με τη χρήση του nuget. Αυτό που ακολουθεί " +"είναι μια περίληψη που είναι επαρκής για προγραμματιστές Python." + +#: using/windows.rst:971 +msgid "" +"The ``nuget.exe`` command line tool may be downloaded directly from " +"``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With " +"the tool, the latest version of Python for 64-bit or 32-bit machines is " +"installed using::" +msgstr "" +"Το εργαλείο γραμμής εντολών ``nuget.exe`` μπορεί να ληφθεί απευθείας από το " +"``https://aka.ms/nugetclidl``, για παράδειγμα, χρησιμοποιώντας curl ή " +"PowerShell. Με το εργαλείο, η πιο πρόσφατη έκδοση της Python για μηχανήματα " +"64-bit ή 32-bit εγκαθίστανται χρησιμοποιώντας::" + +#: using/windows.rst:976 +msgid "" +"nuget.exe install python -ExcludeVersion -OutputDirectory .\n" +"nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." +msgstr "" +"nuget.exe install python -ExcludeVersion -OutputDirectory .\n" +"nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." + +#: using/windows.rst:979 +msgid "" +"To select a particular version, add a ``-Version 3.x.y``. The output " +"directory may be changed from ``.``, and the package will be installed into " +"a subdirectory. By default, the subdirectory is named the same as the " +"package, and without the ``-ExcludeVersion`` option this name will include " +"the specific version installed. Inside the subdirectory is a ``tools`` " +"directory that contains the Python installation:" +msgstr "" +"Για να επιλέξετε μια συγκεκριμένη έκδοση, προσθέστε ένα ``-Version 3.x.y``. " +"Ο κατάλογος εξόδου μπορεί να αλλάξει από ``.``, και το πακέτο να " +"εγκατασταθεί σε έναν υποκατάλογο. Από προεπιλογή, ο υποκατάλογος ονομάζεται " +"όπως και το πακέτο, και χωρίς την επιλογή ``-ExcludeVersion``, αυτό το όνομα " +"θα περιλαμβάνει τη συγκεκριμένη έκδοση που έχει εγκατασταθεί. Μέσα στον " +"υποκατάλογο υπάρχει ένας κατάλογος ``tools`` που περιέχει την εγκατάσταση " +"Python:" + +#: using/windows.rst:986 +msgid "" +"# Without -ExcludeVersion\n" +"> .\\python.3.5.2\\tools\\python.exe -V\n" +"Python 3.5.2\n" +"\n" +"# With -ExcludeVersion\n" +"> .\\python\\tools\\python.exe -V\n" +"Python 3.5.2" +msgstr "" +"# Without -ExcludeVersion\n" +"> .\\python.3.5.2\\tools\\python.exe -V\n" +"Python 3.5.2\n" +"\n" +"# With -ExcludeVersion\n" +"> .\\python\\tools\\python.exe -V\n" +"Python 3.5.2" + +#: using/windows.rst:996 +msgid "" +"In general, nuget packages are not upgradeable, and newer versions should be " +"installed side-by-side and referenced using the full path. Alternatively, " +"delete the package directory manually and install it again. Many CI systems " +"will do this automatically if they do not preserve files between builds." +msgstr "" +"Γενικά, τα πακέτα nuget δεν μπορούν να αναβαθμιστούν και οι νεότερες " +"εκδόσεις θα πρέπει να εγκατασταθούν δίπλα-δίπλα και να αναφέρονται " +"χρησιμοποιώντας την πλήρη διαδρομή. Εναλλακτικά, διαγράψτε τον κατάλογο " +"πακέτων με μη αυτόματο τρόπο και εγκαταστήστε τον ξανά. Πολλά συστήματα CI " +"θα το κάνουν αυτόματα εάν δεν διατηρούν αρχεία μεταξύ των εκδόσεων." + +#: using/windows.rst:1001 +msgid "" +"Alongside the ``tools`` directory is a ``build\\native`` directory. This " +"contains a MSBuild properties file ``python.props`` that can be used in a C+" +"+ project to reference the Python install. Including the settings will " +"automatically use the headers and import libraries in your build." +msgstr "" +"Δίπλα στον κατάλογο ``tools`` υπάρχει ένας κατάλογος ``build\\native``. " +"Αυτός περιέχει ένα αρχείο ιδιοτήτων MSBuild ``python.props`` που μπορεί να " +"χρησιμοποιηθεί σε ένα έργο C++ για αναφορά στην εγκατάσταση της Python. Η " +"συμπερίληψη των ρυθμίσεων θα χρησιμοποιεί αυτόματα τις κεφαλίδες και θα " +"εισάγει βιβλιοθήκες στο build σας." + +#: using/windows.rst:1006 +msgid "" +"The package information pages on nuget.org are `www.nuget.org/packages/" +"python `_ for the 64-bit version, " +"`www.nuget.org/packages/pythonx86 `_ for the 32-bit version, and `www.nuget.org/packages/pythonarm64 " +"`_ for the ARM64 version" msgstr "" +"Οι σελίδες πληροφοριών πακέτων στο nuget.org είναι `www.nuget.org/packages/" +"python `_ για την έκδοση 64 bit, `www." +"nuget.org/packages/pythonx86 `_ " +"για την έκδοση 32 bit και `www.nuget.org/packages/pythonarm64 `_ για την έκδοση ARM64." + +#: using/windows.rst:1014 +msgid "Free-threaded packages" +msgstr "Πακέτα με ελεύθερα νήματα" + +#: using/windows.rst:1018 +msgid "" +"Packages containing free-threaded binaries are named `python-freethreaded " +"`_ for the 64-bit " +"version, `pythonx86-freethreaded `_ for the 32-bit version, and `pythonarm64-freethreaded " +"`_ for the ARM64 " +"version. These packages contain both the ``python3.13t.exe`` and ``python." +"exe`` entry points, both of which run free threaded." +msgstr "" +"Πακέτα που περιέχουν ελεύθερα νήματα ονομάζονται `python-freethreaded " +"`_ για την έκδοση 64 " +"bit, `pythonx86-freethreaded `_ για την έκδοση 32 bit και `pythonarm64-freethreaded `_ για την έκδοση ARM64. " +"Αυτά τα πακέτα περιέχουν τόσο τα σημεία εισόδου ``python3.13t.exe`` όσο και " +"``python.exe``, και τα δύο από τα οποία εκτελούν ελεύθερα νήματα." + +#: using/windows.rst:1029 +msgid "Alternative bundles" +msgstr "Εναλλακτικά πακέτα" -#: using/windows.rst:540 +#: using/windows.rst:1031 msgid "" "Besides the standard CPython distribution, there are modified packages " "including additional functionality. The following is a list of popular " "versions and their key features:" msgstr "" +"Εκτός από την τυπική διανομή CPython, υπάρχουν τροποποιημένα πακέτα που " +"περιλαμβάνουν πρόσθετες λειτουργίες. Ακολουθεί μια λίστα με δημοφιλείς " +"εκδόσεις και τα βασικά χαρακτηριστικά τους:" -#: using/windows.rst:545 +#: using/windows.rst:1035 msgid "`ActivePython `_" -msgstr "" +msgstr "`ActivePython `_" -#: using/windows.rst:545 +#: using/windows.rst:1036 msgid "Installer with multi-platform compatibility, documentation, PyWin32" msgstr "" +"Πρόγραμμα εγκατάστασης με συμβατότητα πολλαπλών πλατφορμών, τεκμηρίωση, " +"PyWin32" -#: using/windows.rst:549 +#: using/windows.rst:1038 msgid "`Anaconda `_" -msgstr "" +msgstr "`Anaconda `_" -#: using/windows.rst:548 +#: using/windows.rst:1039 msgid "" "Popular scientific modules (such as numpy, scipy and pandas) and the " "``conda`` package manager." msgstr "" +"Δημοφιλείς επιστημονικά modules (όπως το numpy, scipy και pandas) και ο " +"διαχειριστής πακέτων ``conda``." -#: using/windows.rst:555 -msgid "`Enthought Deployment Manager `_" -msgstr "" +#: using/windows.rst:1042 +msgid "" +"`Enthought Deployment Manager `_" +msgstr "`Enthought Deployment Manager `_" -#: using/windows.rst:552 +#: using/windows.rst:1043 msgid "\"The Next Generation Python Environment and Package Manager\"." -msgstr "" +msgstr "\"Η επόμενη γενικά Διαχειριστή Περιβάλλοντος και Πακέτων Python\"." -#: using/windows.rst:554 +#: using/windows.rst:1045 msgid "" "Previously Enthought provided Canopy, but it `reached end of life in 2016 " "`_." msgstr "" +"Προηγουμένως, η Enthought παρείχε το Canopy, αλλά `έφτασε στο τέλος της ζωής " +"του το 2016 `_." -#: using/windows.rst:559 +#: using/windows.rst:1048 msgid "`WinPython `_" -msgstr "" +msgstr "`WinPython `_" -#: using/windows.rst:558 +#: using/windows.rst:1049 msgid "" "Windows-specific distribution with prebuilt scientific packages and tools " "for building packages." msgstr "" +"Διανομή ειδικά για Windows με προκατασκευασμένα επιστημονικά πακέτα και " +"εργαλεία για την κατασκευή πακέτων." -#: using/windows.rst:561 +#: using/windows.rst:1052 msgid "" "Note that these packages may not include the latest versions of Python or " "other libraries, and are not maintained or supported by the core Python team." msgstr "" +"Λάβετε υπόψη ότι αυτά τα πακέτα ενδέχεται να μην περιλαμβάνουν τις πιο " +"πρόσφατες εκδόσεις της Python ή άλλες βιβλιοθήκες και δεν διατηρούνται ή " +"υποστηρίζονται από την βασική ομάδα της Python." -#: using/windows.rst:567 -msgid "Configuring Python" -msgstr "" +#: using/windows.rst:1057 +msgid "Supported Windows versions" +msgstr "Υποστηριζόμενες εκδόσεις των Windows" -#: using/windows.rst:569 +#: using/windows.rst:1059 msgid "" -"To run Python conveniently from a command prompt, you might consider " -"changing some default environment variables in Windows. While the installer " -"provides an option to configure the PATH and PATHEXT variables for you, this " -"is only reliable for a single, system-wide installation. If you regularly " -"use multiple versions of Python, consider using the :ref:`launcher`." +"As specified in :pep:`11`, a Python release only supports a Windows platform " +"while Microsoft considers the platform under extended support. This means " +"that Python |version| supports Windows 10 and newer. If you require Windows " +"7 support, please install Python 3.8. If you require Windows 8.1 support, " +"please install Python 3.12." msgstr "" +"Όπως ορίζεται στο :pep:`11`, μια έκδοση Python υποστηρίζει μόνο μια " +"πλατφόρμα Windows, ενώ η Microsoft θεωρεί την πλατφόρμα υπό εκτεταμένη " +"υποστήριξη. Αυτό σημαίνει ότι η Python |version| υποστηρίζει Windows 8.1 και " +"νεότερες εκδόσεις. Εάν χρειάζεστε υποστήριξη Windows 7, εγκαταστήστε την " +"Python 3.8. Εάν χρειάζεστε υποστήριξη Windows 8.1, εγκαταστήστε την Python " +"3.12." -#: using/windows.rst:579 -msgid "Excursus: Setting environment variables" -msgstr "" +#: using/windows.rst:1350 +msgid "Removing the MAX_PATH limitation" +msgstr "Αφαίρεση του περιορισμού MAX_PATH" -#: using/windows.rst:581 +#: using/windows.rst:1352 msgid "" -"Windows allows environment variables to be configured permanently at both " -"the User level and the System level, or temporarily in a command prompt." +"Windows historically has limited path lengths to 260 characters. This meant " +"that paths longer than this would not resolve and errors would result." msgstr "" +"Τα Windows έχουν ιστορικά περιορισμένα μήκη διαδρομής στους 260 χαρακτήρες. " +"Αυτό σήμαινε ότι διαδρομές μεγαλύτερες από αυτό δεν θα επιλύονταν και θα " +"προέκυπταν σφάλματα." -#: using/windows.rst:584 +#: using/windows.rst:1074 msgid "" -"To temporarily set environment variables, open Command Prompt and use the :" -"command:`set` command:" +"In the latest versions of Windows, this limitation can be expanded to over " +"32,000 characters. Your administrator will need to activate the \"Enable " +"Win32 long paths\" group policy, or set ``LongPathsEnabled`` to ``1`` in the " +"registry key " +"``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." msgstr "" +"Στις πιο πρόσφατες εκδόσεις των Windows, αυτός ο περιορισμός μπορεί να " +"επεκταθεί σε πάνω από 32.000 χαρακτήρες. Ο διαχειριστής σας θα πρέπει να " +"ενεργοποιήσει την πολιτική ομάδας \"Ενεργοποίηση μακρών διαδρομών Win32\" ή " +"να ορίσει το ``LongPathsEnabled`` σε ``1`` στο κλειδί μητρώου " +"``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." -#: using/windows.rst:593 +#: using/windows.rst:1361 msgid "" -"These changes will apply to any further commands executed in that console, " -"and will be inherited by any applications started from the console." +"This allows the :func:`open` function, the :mod:`os` module and most other " +"path functionality to accept and return paths longer than 260 characters." msgstr "" +"Αυτό επιτρέπει στη συνάρτηση :func:`open`, στο module :mod:`os` και στις " +"περισσότερες άλλες λειτουργίες διαδρομής να αποδέχονται και να επιστρέφουν " +"διαδρομές μεγαλύτερες από 260 χαρακτήρες." -#: using/windows.rst:596 +#: using/windows.rst:1082 msgid "" -"Including the variable name within percent signs will expand to the existing " -"value, allowing you to add your new value at either the start or the end. " -"Modifying :envvar:`PATH` by adding the directory containing :program:`python." -"exe` to the start is a common way to ensure the correct version of Python is " -"launched." +"After changing the above option and rebooting, no further configuration is " +"required." msgstr "" +"Μετά την αλλαγή της παραπάνω επιλογής, δεν απαιτείται περαιτέρω διαμόρφωση." -#: using/windows.rst:602 -msgid "" -"To permanently modify the default environment variables, click Start and " -"search for 'edit environment variables', or open System properties, :" -"guilabel:`Advanced system settings` and click the :guilabel:`Environment " -"Variables` button. In this dialog, you can add or modify User and System " -"variables. To change System variables, you need non-restricted access to " -"your machine (i.e. Administrator rights)." -msgstr "" +#: using/windows.rst:1089 +msgid "UTF-8 mode" +msgstr "Λειτουργία UTF-8" -#: using/windows.rst:611 +#: using/windows.rst:1093 msgid "" -"Windows will concatenate User variables *after* System variables, which may " -"cause unexpected results when modifying :envvar:`PATH`." +"Windows still uses legacy encodings for the system encoding (the ANSI Code " +"Page). Python uses it for the default encoding of text files (e.g. :func:" +"`locale.getencoding`)." msgstr "" +"Τα Windows εξακολουθούν να χρησιμοποιούν κωδικοποιήσεις παλαιού τύπου για " +"την κωδικοποίηση του συστήματος (τη σελίδα κώδικα ANSI). Η Python τη " +"χρησιμοποιεί για την προεπιλεγμένη κωδικοποίηση αρχείων κειμένου (π.χ. :func:" +"`locale.getencoding`)." -#: using/windows.rst:614 +#: using/windows.rst:1097 msgid "" -"The :envvar:`PYTHONPATH` variable is used by all versions of Python, so you " -"should not permanently configure it unless the listed paths only include " -"code that is compatible with all of your installed Python versions." +"This may cause issues because UTF-8 is widely used on the internet and most " +"Unix systems, including WSL (Windows Subsystem for Linux)." msgstr "" +"Αυτό μπορεί να προκαλέσει προβλήματα επειδή το UTF-8 χρησιμοποιείται ευρέως " +"στο διαδίκτυο και στα περισσότερα συστήματα Unix, συμπεριλαμβανομένου του " +"WSL (Windows Subsystem for Linux)." -#: using/windows.rst:622 -msgid "" -"https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" -"variables" -msgstr "" - -#: using/windows.rst:622 -msgid "Overview of environment variables on Windows" -msgstr "" - -#: using/windows.rst:625 -msgid "" -"https://docs.microsoft.com/en-us/windows-server/administration/windows-" -"commands/set_1" -msgstr "" - -#: using/windows.rst:625 -msgid "The ``set`` command, for temporarily modifying environment variables" -msgstr "" - -#: using/windows.rst:627 -msgid "" -"https://docs.microsoft.com/en-us/windows-server/administration/windows-" -"commands/setx" -msgstr "" - -#: using/windows.rst:628 -msgid "The ``setx`` command, for permanently modifying environment variables" -msgstr "" - -#: using/windows.rst:634 -msgid "Finding the Python executable" -msgstr "" - -#: using/windows.rst:638 -msgid "" -"Besides using the automatically created start menu entry for the Python " -"interpreter, you might want to start Python in the command prompt. The " -"installer has an option to set that up for you." -msgstr "" - -#: using/windows.rst:642 -msgid "" -"On the first page of the installer, an option labelled \"Add Python to " -"PATH\" may be selected to have the installer add the install location into " -"the :envvar:`PATH`. The location of the :file:`Scripts\\\\` folder is also " -"added. This allows you to type :command:`python` to run the interpreter, " -"and :command:`pip` for the package installer. Thus, you can also execute " -"your scripts with command line options, see :ref:`using-on-cmdline` " -"documentation." -msgstr "" - -#: using/windows.rst:649 -msgid "" -"If you don't enable this option at install time, you can always re-run the " -"installer, select Modify, and enable it. Alternatively, you can manually " -"modify the :envvar:`PATH` using the directions in :ref:`setting-envvars`. " -"You need to set your :envvar:`PATH` environment variable to include the " -"directory of your Python installation, delimited by a semicolon from other " -"entries. An example variable could look like this (assuming the first two " -"entries already existed)::" -msgstr "" - -#: using/windows.rst:662 -msgid "UTF-8 mode" -msgstr "" - -#: using/windows.rst:666 -msgid "" -"Windows still uses legacy encodings for the system encoding (the ANSI Code " -"Page). Python uses it for the default encoding of text files (e.g. :func:" -"`locale.getencoding`)." -msgstr "" - -#: using/windows.rst:670 -msgid "" -"This may cause issues because UTF-8 is widely used on the internet and most " -"Unix systems, including WSL (Windows Subsystem for Linux)." -msgstr "" - -#: using/windows.rst:673 +#: using/windows.rst:1100 msgid "" "You can use the :ref:`Python UTF-8 Mode ` to change the default " "text encoding to UTF-8. You can enable the :ref:`Python UTF-8 Mode ` για να " +"αλλάξετε την προεπιλεγμένη κωδικοποίηση κειμένου σε UTF-8. Μπορείτε να " +"ενεργοποιήσετε το :ref:`Python UTF-8 Mode ` μέσω της επιλογής " +"γραμμής εντολών ``-X utf8`` ή της μεταβλητής περιβάλλοντος " +"``PYTHONUTF8=1``. Βλέπε :envvar:`PYTHONUTF8` για την ενεργοποίηση της " +"λειτουργίας UTF-8 και :ref:`setting-envvars` για τον τρόπο τροποποίηση " +"μεταβλητών περιβάλλοντος." -#: using/windows.rst:679 +#: using/windows.rst:1106 msgid "" "When the :ref:`Python UTF-8 Mode ` is enabled, you can still use " "the system encoding (the ANSI Code Page) via the \"mbcs\" codec." msgstr "" +"Όταν η :ref:`Python UTF-8 Mode ` είναι ενεργοποιημένη, μπορείτε " +"ακόμα να χρησιμοποιήσετε την κωδικοποίηση συστήματος (τη σελίδα κώδικα ANSI) " +"μέσω του κωδικοποιητή \"mbcs\"." -#: using/windows.rst:682 +#: using/windows.rst:1109 msgid "" "Note that adding ``PYTHONUTF8=1`` to the default environment variables will " "affect all Python 3.7+ applications on your system. If you have any Python " @@ -1177,926 +2451,2164 @@ msgid "" "recommended to set the environment variable temporarily or use the ``-X " "utf8`` command line option." msgstr "" +"Λάβετε υπόψη ότι η προσθήκη ``PYTHONUTF8=1`` στις προεπιλεγμένες μεταβλητές " +"περιβάλλοντος θα επηρεάσει όλες τις εφαρμογές Python 3.7+ στο σύστημα σας. " +"Εάν έχετε οποιεσδήποτε εφαρμογές Python 3.7+ που βασίζονται στην " +"κωδικοποίηση του συστήματος παλαιού τύπου, συνιστάται να ορίσετε το " +"περιβάλλον μεταβλητή προσωρινά ή χρησιμοποιήστε την επιλογή γραμμής εντολών " +"``-X utf8``." -#: using/windows.rst:689 +#: using/windows.rst:1116 msgid "" "Even when UTF-8 mode is disabled, Python uses UTF-8 by default on Windows " "for:" msgstr "" +"Ακόμη και όταν η λειτουργία UTF-8 είναι απενεργοποιημένη, η Python " +"χρησιμοποιεί το UTF-8 από προεπιλογή στα Windows για:" -#: using/windows.rst:692 +#: using/windows.rst:1119 msgid "Console I/O including standard I/O (see :pep:`528` for details)." -msgstr "" +msgstr "I/O κονσόλας με τυπικό I/O (δείτε το :pep:`528` για λεπτομέρειες)." -#: using/windows.rst:693 +#: using/windows.rst:1120 msgid "" "The :term:`filesystem encoding ` " "(see :pep:`529` for details)." msgstr "" +"Το :term:`filesystem encoding ` " +"(δείτε το :pep:`529` για λεπτομέρειες)." -#: using/windows.rst:700 -msgid "Python Launcher for Windows" -msgstr "" +#: using/windows.rst:1127 +msgid "Finding modules" +msgstr "Εύρεση modules" -#: using/windows.rst:704 +#: using/windows.rst:1129 msgid "" -"The Python launcher for Windows is a utility which aids in locating and " -"executing of different Python versions. It allows scripts (or the command-" -"line) to indicate a preference for a specific Python version, and will " -"locate and execute that version." +"These notes supplement the description at :ref:`sys-path-init` with detailed " +"Windows notes." msgstr "" +"Αυτές οι σημειώσεις συμπληρώνουν την περιγραφή :ref:`sys-path-init` με " +"λεπτομερείς σημειώσεις των Windows." -#: using/windows.rst:709 +#: using/windows.rst:1132 msgid "" -"Unlike the :envvar:`PATH` variable, the launcher will correctly select the " -"most appropriate version of Python. It will prefer per-user installations " -"over system-wide ones, and orders by language version rather than using the " -"most recently installed version." -msgstr "" - -#: using/windows.rst:714 -msgid "The launcher was originally specified in :pep:`397`." -msgstr "" - -#: using/windows.rst:717 -msgid "Getting started" +"When no ``._pth`` file is found, this is how :data:`sys.path` is populated " +"on Windows:" msgstr "" +"Όταν δεν βρεθεί αρχείο ``._pth``, συμπληρώνεται έτσι το :data:`sys.path` στα " +"Windows:" -#: using/windows.rst:720 -msgid "From the command-line" +#: using/windows.rst:1135 +msgid "" +"An empty entry is added at the start, which corresponds to the current " +"directory." msgstr "" +"Μια κενή καταχώρηση προστίθεται στην αρχή, η οποία αντιστοιχεί στον τρέχοντα " +"κατάλογο." -#: using/windows.rst:724 +#: using/windows.rst:1138 msgid "" -"System-wide installations of Python 3.3 and later will put the launcher on " -"your :envvar:`PATH`. The launcher is compatible with all available versions " -"of Python, so it does not matter which version is installed. To check that " -"the launcher is available, execute the following command in Command Prompt::" +"If the environment variable :envvar:`PYTHONPATH` exists, as described in :" +"ref:`using-on-envvars`, its entries are added next. Note that on Windows, " +"paths in this variable must be separated by semicolons, to distinguish them " +"from the colon used in drive identifiers (``C:\\`` etc.)." msgstr "" +"Εάν υπάρχει η μεταβλητή περιβάλλοντος :envvar:`PYTHONPATH`, όπως " +"περιγράφεται στο :ref:`using-on-envvars`, οι εγγραφές της προστίθενται στη " +"συνέχεια. Σημειώστε ότι στα Windows, οι διαδρομές σε αυτήν τη μεταβλητή " +"πρέπει να διαχωρίζονται με ερωτηματικά, για να γίνει διάκριση από την άνω " +"και κάτω τελεία που χρησιμοποιείται στα αναγνωριστικά μονάδων δίσκου (``C:" +"\\`` κλπ.)." -#: using/windows.rst:731 +#: using/windows.rst:1143 msgid "" -"You should find that the latest version of Python you have installed is " -"started - it can be exited as normal, and any additional command-line " -"arguments specified will be sent directly to Python." +"Additional \"application paths\" can be added in the registry as subkeys of :" +"samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " +"both the ``HKEY_CURRENT_USER`` and ``HKEY_LOCAL_MACHINE`` hives. Subkeys " +"which have semicolon-delimited path strings as their default value will " +"cause each path to be added to :data:`sys.path`. (Note that all known " +"installers only use HKLM, so HKCU is typically empty.)" msgstr "" +"Μπορούν να προστεθούν επιπλέον \"διαδρομές εφαρμογής\" στο μητρώο ως " +"δευτερεύοντα κλειδιά του :samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\" +"\\{version}\\\\PythonPath` κάτω από τις κυψέλες ``HKEY_CURRENT_USER`` και " +"``HKEY_LOCAL_MACHINE``. Τα δευτερεύοντα κλειδιά που έχουν ως προεπιλεγμένη " +"τιμή συμβολοσειρές διαδρομής οριοθετημένη με ερωτηματικό θα προκαλέσει την " +"προσθήκη κάθε διαδρομής στο :data:`sys.path`. (Λάβετε υπόψη ότι όλα τα " +"γνωστά προγράμματα εγκατάστασης χρησιμοποιούν μόνο HKLM, επομένως το HKCU " +"είναι συνήθως κενό.)" -#: using/windows.rst:735 +#: using/windows.rst:1150 msgid "" -"If you have multiple versions of Python installed (e.g., 3.7 and |version|) " -"you will have noticed that Python |version| was started - to launch Python " -"3.7, try the command::" +"If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as " +"\"Python Home\". Otherwise, the path of the main Python executable is used " +"to locate a \"landmark file\" (either ``Lib\\os.py`` or ``pythonXY.zip``) to " +"deduce the \"Python Home\". If a Python home is found, the relevant sub-" +"directories added to :data:`sys.path` (``Lib``, ``plat-win``, etc) are based " +"on that folder. Otherwise, the core Python path is constructed from the " +"PythonPath stored in the registry." msgstr "" +"Εάν έχει οριστεί η μεταβλητή περιβάλλοντος :envvar:`PYTHONHOME`, θεωρείται " +"ότι είναι \"Python Home\". Διαφορετικά, η διαδρομή του κύριου εκτελέσιμου " +"Python χρησιμοποιείται για τον εντοπισμό ενός \"αρχείου ορόσημο\" (είτε " +"``Lib\\os.py`` ή ``pythonXY.zip``) για να συμπεράνουμε το \"Python Home\". " +"Αν βρεθεί ένα Python home, οι σχετικοί υποκατάλογοι που προστέθηκαν στο :" +"data:`sys.path` (``Lib``, ``plat-win``, κ.λπ.) βασίζονται σε αυτόν τον " +"φάκελο. Διαφορετικά, η διαδρομή του πυρήνα της Python δημιουργείται από το " +"PythonPath που είναι αποθηκευμένο στο μητρώο." -#: using/windows.rst:741 +#: using/windows.rst:1158 msgid "" -"If you want the latest version of Python 2 you have installed, try the " -"command::" +"If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified " +"in the environment, and no registry entries can be found, a default path " +"with relative entries is used (e.g. ``.\\Lib;.\\plat-win``, etc)." msgstr "" +"Εάν δεν μπορεί να εντοπιστεί το Python Home, δεν καθορίζεται :envvar:" +"`PYTHONPATH` στο περιβάλλον και δεν μπορούν να βρεθούν καταχωρίσεις μητρώου, " +"χρησιμοποιείται μια προεπιλεγμένη διαδρομή με σχετικές καταχωρήσεις (π.χ. ``." +"\\Lib;.\\plat-win``, κλπ)." -#: using/windows.rst:746 +#: using/windows.rst:1162 msgid "" -"If you see the following error, you do not have the launcher installed::" +"If a ``pyvenv.cfg`` file is found alongside the main executable or in the " +"directory one level above the executable, the following variations apply:" msgstr "" +"Εάν ένα αρχείο ``pyvenv.cfg`` βρίσκεται δίπλα στο κύριο εκτελέσιμο αρχείο ή " +"στον κατάλογο ένα επίπεδο πάνω από το εκτελέσιμο αρχείο, ισχύουν οι " +"ακόλουθες παραλλαγές:" -#: using/windows.rst:751 -msgid "The command::" +#: using/windows.rst:1165 +msgid "" +"If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " +"path is used instead of the path to the main executable when deducing the " +"home location." msgstr "" +"Εάν το ``home`` είναι μια απόλυτη διαδρομή και το :envvar:`PYTHONHOME` δεν " +"έχει οριστεί, αυτή η διαδρομή χρησιμοποιείται αντί για τη διαδρομή προς το " +"κύριο εκτελέσιμο κατά την εξαγωγή της αρχικής τοποθεσίας." -#: using/windows.rst:755 -msgid "displays the currently installed version(s) of Python." -msgstr "" +#: using/windows.rst:1169 +msgid "The end result of all this is:" +msgstr "Το τελικό αποτέλεσμα όλων αυτών είναι:" -#: using/windows.rst:757 +#: using/windows.rst:1171 msgid "" -"The ``-x.y`` argument is the short form of the ``-V:Company/Tag`` argument, " -"which allows selecting a specific Python runtime, including those that may " -"have come from somewhere other than python.org. Any runtime registered by " -"following :pep:`514` will be discoverable. The ``--list`` command lists all " -"available runtimes using the ``-V:`` format." +"When running :file:`python.exe`, or any other .exe in the main Python " +"directory (either an installed version, or directly from the PCbuild " +"directory), the core path is deduced, and the core paths in the registry are " +"ignored. Other \"application paths\" in the registry are always read." msgstr "" +"Όταν εκτελείται το :file:`python.exe`, ή οποιοδήποτε άλλο .exe στον κύριο " +"κατάλογο της Python (είτε μια εγκατεστημένη έκδοση, είτε απευθείας από τον " +"κατάλογο PCbuild), συνάγεται η διαδρομή του πυρήνα και οι βασικές διαφορές " +"στο μητρώο αγνοούνται. Άλλες \"διαδρομές εφαρμογής\" στο μητρώο διαβάζονται " +"πάντα." -#: using/windows.rst:763 +#: using/windows.rst:1176 msgid "" -"When using the ``-V:`` argument, specifying the Company will limit selection " -"to runtimes from that provider, while specifying only the Tag will select " -"from all providers. Note that omitting the slash implies a tag::" +"When Python is hosted in another .exe (different directory, embedded via " +"COM, etc), the \"Python Home\" will not be deduced, so the core path from " +"the registry is used. Other \"application paths\" in the registry are " +"always read." msgstr "" +"Όταν η Python φιλοξενείται σε άλλο .exe (διαφορετικός κατάλογος, " +"ενσωματωμένος μέσω COM, κ.λπ.), το \"Python Home\" δεν θα συναχθεί επομένως " +"χρησιμοποιείται η βασική διαδρομή από το μητρώο. Άλλες \"διαδρομές " +"εφαρμογής\" στο μητρώο διαβάζονται πάντα." -#: using/windows.rst:776 +#: using/windows.rst:1180 msgid "" -"The short form of the argument (``-3``) only ever selects from core Python " -"releases, and not other distributions. However, the longer form (``-V:3``) " -"will select from any." +"If Python can't find its home and there are no registry value (frozen .exe, " +"some very strange installation setup) you get a path with some default, but " +"relative, paths." msgstr "" +"Εάν η Python δεν μπορεί να βρει το home της και δεν υπάρχει τιμή μητρώου " +"(frozen .exe, κάποια πολύ περίεργη εγκατάσταση) λαμβάνετε μια διαδρομή με " +"κάποιες προεπιλεγμένες, αλλά σχετικές, διαδρομές." -#: using/windows.rst:780 +#: using/windows.rst:1184 msgid "" -"The Company is matched on the full string, case-insenitive. The Tag is " -"matched oneither the full string, or a prefix, provided the next character " -"is a dot or a hyphen. This allows ``-V:3.1`` to match ``3.1-32``, but not " -"``3.10``. Tags are sorted using numerical ordering (``3.10`` is newer than " -"``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." +"For those who want to bundle Python into their application or distribution, " +"the following advice will prevent conflicts with other installations:" msgstr "" +"Για όσους θέλουν να ενσωματώσουν την Python στην εφαρμογή ή την διανομή " +"τους, οι ακόλουθες συμβουλές θα αποτρέψουν τις διενέξεις με άλλες " +"εγκαταστάσεις:" -#: using/windows.rst:788 -msgid "Virtual environments" +#: using/windows.rst:1187 +msgid "" +"Include a ``._pth`` file alongside your executable containing the " +"directories to include. This will ignore paths listed in the registry and " +"environment variables, and also ignore :mod:`site` unless ``import site`` is " +"listed." msgstr "" +"Συμπεριλάβετε ένα αρχείο ``._pth`` δίπλα στο εκτελέσιμο αρχείο σας που " +"περιέχει τους καταλόγους που θέλετε να συμπεριλάβετε. Αυτό θα αγνοήσει τις " +"διαδρομές που παρατίθενται στο μητρώο και τις μεταβλητές περιβάλλοντος και " +"θα αγνοήσει επίσης το :mod:`site` εκτός εάν αναφέρεται το ``import site``." -#: using/windows.rst:792 +#: using/windows.rst:1192 msgid "" -"If the launcher is run with no explicit Python version specification, and a " -"virtual environment (created with the standard library :mod:`venv` module or " -"the external ``virtualenv`` tool) active, the launcher will run the virtual " -"environment's interpreter rather than the global one. To run the global " -"interpreter, either deactivate the virtual environment, or explicitly " -"specify the global Python version." +"If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " +"executable, explicitly set :c:member:`PyConfig.module_search_paths` before :" +"c:func:`Py_InitializeFromConfig`." msgstr "" +"Εάν φορτώνετε το :file:`python3.dll` ή το :file:`python37.dll` στο δικό σας " +"εκτελέσιμο αρχείο, ορίστε ρητά το :c:member:`PyConfig.module_search_paths` " +"πριν από το :c:func:`Py_InitializeFromConfig`." -#: using/windows.rst:800 -msgid "From a script" +#: using/windows.rst:1196 +msgid "" +"Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " +"before launching :file:`python.exe` from your application." msgstr "" +"Διαγράψτε και/ή αντικαταστήστε το :envvar:`PYTHONPATH` και ορίστε το :envvar:" +"`PYTHONHOME` πριν από την εκκίνηση του :file:`python.exe` από την εφαρμογή " +"σας." -#: using/windows.rst:802 +#: using/windows.rst:1199 msgid "" -"Let's create a test Python script - create a file called ``hello.py`` with " -"the following contents" +"If you cannot use the previous suggestions (for example, you are a " +"distribution that allows people to run :file:`python.exe` directly), ensure " +"that the landmark file (:file:`Lib\\\\os.py`) exists in your install " +"directory. (Note that it will not be detected inside a ZIP file, but a " +"correctly named ZIP file will be detected instead.)" msgstr "" +"Εάν δεν μπορείτε να χρησιμοποιήσετε τις προηγούμενες προτάσεις (για " +"παράδειγμα, είστε μια διανομή που επιτρέπει στους χρήστες να εκτελούν " +"απευθείας το :file:`python.exe`), βεβαιωθείτε ότι το αρχείο ορόσημο (:file:" +"`Lib\\\\os.py`) υπάρχει στον κατάλογο εγκατάστασης σας. (Λάβετε υπόψη ότι " +"δεν θα εντοπιστεί σε ένα αρχείο ZIP, αλλά θα εντοπιστεί ένα αρχείο ZIP με το " +"σωστό όνομα.)" -#: using/windows.rst:811 -msgid "From the directory in which hello.py lives, execute the command::" +#: using/windows.rst:1205 +msgid "" +"These will ensure that the files in a system-wide installation will not take " +"precedence over the copy of the standard library bundled with your " +"application. Otherwise, your users may experience problems using your " +"application. Note that the first suggestion is the best, as the others may " +"still be susceptible to non-standard paths in the registry and user site-" +"packages." msgstr "" +"Αυτά θα διασφαλίσουν ότι τα αρχεία σε μια εγκατάσταση σε όλο το σύστημα δεν " +"θα υπερισχύουν του αντιγράφου της τυπικής βιβλιοθήκης που συνοδεύει την " +"εφαρμογή σας. Διαφορετικά, οι χρήστες σας ενδέχεται να αντιμετωπίσουν " +"προβλήματα με τη χρήση της εφαρμογής σας. Λάβετε υπόψη ότι η πρώτη πρόταση " +"είναι η καλύτερη, καθώς τα άλλα μπορεί να εξακολουθούν να είναι επιρρεπή σε " +"μη τυπικές διαδρομές στο μητρώο και στα πακέτα ιστοτόπων χρηστών." -#: using/windows.rst:815 +#: using/windows.rst:1213 msgid "" -"You should notice the version number of your latest Python 2.x installation " -"is printed. Now try changing the first line to be:" +"Add ``._pth`` file support and removes ``applocal`` option from ``pyvenv." +"cfg``." msgstr "" +"Προσθήκη υποστήριξης αρχείου ``._pth`` και καταργείται η επιλογή " +"``applocal`` από το ``pyvenv.cfg``." -#: using/windows.rst:822 +#: using/windows.rst:1218 msgid "" -"Re-executing the command should now print the latest Python 3.x information. " -"As with the above command-line examples, you can specify a more explicit " -"version qualifier. Assuming you have Python 3.7 installed, try changing the " -"first line to ``#! python3.7`` and you should find the 3.7 version " -"information printed." +"Add :file:`python{XX}.zip` as a potential landmark when directly adjacent to " +"the executable." msgstr "" +"Προσθήκη :file:`python{XX}.zip` ως πιθανό ορόσημο όταν βρίσκεται ακριβώς " +"δίπλα στο εκτελέσιμο αρχείο." -#: using/windows.rst:828 +#: using/windows.rst:1223 msgid "" -"Note that unlike interactive use, a bare \"python\" will use the latest " -"version of Python 2.x that you have installed. This is for backward " -"compatibility and for compatibility with Unix, where the command ``python`` " -"typically refers to Python 2." +"Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " +"be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " +"finder is enabled on Windows in 3.6.0 and earlier, but may need to be " +"explicitly added to :data:`sys.meta_path` in the future." msgstr "" +"Τα modules που καθορίζονται στο μητρώο στην περιοχή ``Modules`` (όχι " +"``PythonPath``) μπορούν να εισαχθούν από το :class:`importlib.machinery." +"WindowsRegistryFinder`. Αυτό το πρόγραμμα εύρεσης είναι ενεργοποιημένο στα " +"Windows σε 3.6.0 και παλαιότερες εκδόσεις, αλλά ενδέχεται να πρέπει να " +"προστεθεί ρητά στο :data:`sys.meta_path` στο μέλλον." -#: using/windows.rst:834 -msgid "From file associations" -msgstr "" +#: using/windows.rst:1229 +msgid "Additional modules" +msgstr "Πρόσθετα modules" -#: using/windows.rst:836 +#: using/windows.rst:1231 msgid "" -"The launcher should have been associated with Python files (i.e. ``.py``, ``." -"pyw``, ``.pyc`` files) when it was installed. This means that when you " -"double-click on one of these files from Windows explorer the launcher will " -"be used, and therefore you can use the same facilities described above to " -"have the script specify the version which should be used." +"Even though Python aims to be portable among all platforms, there are " +"features that are unique to Windows. A couple of modules, both in the " +"standard library and external, and snippets exist to use these features." msgstr "" +"Αν και η Python στοχεύει να είναι φορητή σε όλες τις πλατφόρμες, υπάρχουν " +"δυνατότητες που είναι μοναδικές για τα Windows. Μερικά modules, τόσο στην " +"τυπική βιβλιοθήκη όσο και στην εξωτερική, και αποσπάσματα υπάρχουν για χρήση " +"αυτών των δυνατοτήτων." -#: using/windows.rst:842 +#: using/windows.rst:1235 msgid "" -"The key benefit of this is that a single launcher can support multiple " -"Python versions at the same time depending on the contents of the first line." +"The Windows-specific standard modules are documented in :ref:`mswin-specific-" +"services`." msgstr "" +"Τα τυπικά modules ειδικά για Windows τεκμηριώνονται στο :ref:`mswin-specific-" +"services`." -#: using/windows.rst:846 -msgid "Shebang Lines" -msgstr "" +#: using/windows.rst:1239 +msgid "PyWin32" +msgstr "PyWin32" -#: using/windows.rst:848 +#: using/windows.rst:1241 msgid "" -"If the first line of a script file starts with ``#!``, it is known as a " -"\"shebang\" line. Linux and other Unix like operating systems have native " -"support for such lines and they are commonly used on such systems to " -"indicate how a script should be executed. This launcher allows the same " -"facilities to be used with Python scripts on Windows and the examples above " -"demonstrate their use." +"The :pypi:`PyWin32` module by Mark Hammond is a collection of modules for " +"advanced Windows-specific support. This includes utilities for:" msgstr "" +"Το module `PyWin32 `_ του Mark Hammond " +"είναι μια συλλογή από modules για προηγμένη υποστήριξη ειδικά για Windows. " +"Αυτό περιλαμβάνει βοηθητικά προγράμματα για:" -#: using/windows.rst:855 +#: using/windows.rst:1245 msgid "" -"To allow shebang lines in Python scripts to be portable between Unix and " -"Windows, this launcher supports a number of 'virtual' commands to specify " -"which interpreter to use. The supported virtual commands are:" +"`Component Object Model `_ (COM)" msgstr "" +"`Component Object Model `_ (COM)" -#: using/windows.rst:859 -msgid "``/usr/bin/env``" -msgstr "" +#: using/windows.rst:1248 +msgid "Win32 API calls" +msgstr "Win32 API κλήσεις" -#: using/windows.rst:860 -msgid "``/usr/bin/python``" -msgstr "" +#: using/windows.rst:1249 +msgid "Registry" +msgstr "Μητρώο" -#: using/windows.rst:861 -msgid "``/usr/local/bin/python``" -msgstr "" +#: using/windows.rst:1250 +msgid "Event log" +msgstr "Μητρώο συμβάντων" -#: using/windows.rst:862 -msgid "``python``" +#: using/windows.rst:1251 +msgid "" +"`Microsoft Foundation Classes `_ (MFC) user interfaces" msgstr "" +"Τα `Microsoft Foundation Classes `_ (MFC) διεπαφές χρήστη" -#: using/windows.rst:864 -msgid "For example, if the first line of your script starts with" +#: using/windows.rst:1255 +msgid "" +"`PythonWin `_ is a sample MFC application shipped with PyWin32. " +"It is an embeddable IDE with a built-in debugger." msgstr "" +"Το `PythonWin `_ είναι ένα δείγμα εφαρμογής MFC που " +"αποστέλλεται με το PyWin32. Είναι ένα ενσωματωμένο IDE με ενσωματωμένο " +"πρόγραμμα εντοπισμού σφαλμάτων." -#: using/windows.rst:870 +#: using/windows.rst:1261 msgid "" -"The default Python will be located and used. As many Python scripts written " -"to work on Unix will already have this line, you should find these scripts " -"can be used by the launcher without modification. If you are writing a new " -"script on Windows which you hope will be useful on Unix, you should use one " -"of the shebang lines starting with ``/usr``." +"`Win32 How Do I...? `_" msgstr "" +"`Win32 How Do I...? `_" -#: using/windows.rst:876 -msgid "" -"Any of the above virtual commands can be suffixed with an explicit version " -"(either just the major version, or the major and minor version). Furthermore " -"the 32-bit version can be requested by adding \"-32\" after the minor " -"version. I.e. ``/usr/bin/python3.7-32`` will request usage of the 32-bit " -"python 3.7." +#: using/windows.rst:1262 +msgid "by Tim Golden" +msgstr "από τον Tim Golden" + +#: using/windows.rst:1264 +msgid "`Python and COM `_" +msgstr "`Python and COM `_" + +#: using/windows.rst:1265 +msgid "by David and Paul Boddie" +msgstr "από τους David και Paul Boddie" + +#: using/windows.rst:1269 +msgid "cx_Freeze" +msgstr "cx_Freeze" + +#: using/windows.rst:1271 +msgid "" +"`cx_Freeze `_ wraps Python " +"scripts into executable Windows programs (:file:`{*}.exe` files). When you " +"have done this, you can distribute your application without requiring your " +"users to install Python." msgstr "" +"Το `cx_Freeze `_ αναδιπλώνει " +"Python scripts σε εκτελέσιμα προγράμματα των Windows (:file:`{*}.exe` " +"αρχεία). Όταν το κάνετε αυτό, μπορείτε να διανείμετε την εφαρμογή σας χωρίς " +"να απαιτείται από τους χρήστες σας να εγκαταστήσουν την Python." -#: using/windows.rst:884 +#: using/windows.rst:1278 +msgid "Compiling Python on Windows" +msgstr "Μεταγλώττιση Python στα Windows" + +#: using/windows.rst:1280 msgid "" -"Beginning with python launcher 3.7 it is possible to request 64-bit version " -"by the \"-64\" suffix. Furthermore it is possible to specify a major and " -"architecture without minor (i.e. ``/usr/bin/python3-64``)." +"If you want to compile CPython yourself, first thing you should do is get " +"the `source `_. You can download " +"either the latest release's source or just grab a fresh `checkout `_." msgstr "" +"Εάν θέλετε να μεταγλωττίσετε μόνοι σας το CPython, το πρώτο πράγμα που " +"πρέπει να κάνετε είναι να λάβετε το `source `_. Μπορείτε να κάνετε λήψη είτε τον πηγαίο κώδικα της πιο " +"πρόσφατης έκδοσης είτε απλώς να πάρετε μια φρέσκια έκδοση `checkout `_." -#: using/windows.rst:890 +#: using/windows.rst:1285 msgid "" -"The \"-64\" suffix is deprecated, and now implies \"any architecture that is " -"not provably i386/32-bit\". To request a specific environment, use the new :" -"samp:`-V:{TAG}` argument with the complete tag." +"The source tree contains a build solution and project files for Microsoft " +"Visual Studio, which is the compiler used to build the official Python " +"releases. These files are in the :file:`PCbuild` directory." msgstr "" +"Το δέντρο προέλευσης περιέχει μια λύση έκδοσης και αρχεία έργου για το " +"Microsoft Visual Studio, που είναι ο μεταγλωττιστής που χρησιμοποιείται για " +"τη δημιουργία των επίσημων εκδόσεων Python. Αυτά τα αρχεία βρίσκονται στον " +"κατάλογο :file:`PCbuild`." -#: using/windows.rst:894 +#: using/windows.rst:1289 msgid "" -"The ``/usr/bin/env`` form of shebang line has one further special property. " -"Before looking for installed Python interpreters, this form will search the " -"executable :envvar:`PATH` for a Python executable matching the name provided " -"as the first argument. This corresponds to the behaviour of the Unix ``env`` " -"program, which performs a :envvar:`PATH` search. If an executable matching " -"the first argument after the ``env`` command cannot be found, but the " -"argument starts with ``python``, it will be handled as described for the " -"other virtual commands. The environment variable :envvar:" -"`PYLAUNCHER_NO_SEARCH_PATH` may be set (to any value) to skip this search " -"of :envvar:`PATH`." +"Check :file:`PCbuild/readme.txt` for general information on the build " +"process." msgstr "" +"Ελέγξτε το :file:`PCbuild/readme.txt` για γενικές πληροφορίες σχετικά με τη " +"διαδικασία κατασκευής." + +#: using/windows.rst:1291 +msgid "For extension modules, consult :ref:`building-on-windows`." +msgstr "Για modules επέκτασης, συμβουλευτείτε το :ref:`building-on-windows`." + +#: using/windows.rst:1298 +msgid "The full installer (deprecated)" +msgstr "Το πλήρες πρόγραμμα εγκατάστασης" -#: using/windows.rst:905 +#: using/windows.rst:1302 msgid "" -"Shebang lines that do not match any of these patterns are looked up in the " -"``[commands]`` section of the launcher's :ref:`.INI file `. " -"This may be used to handle certain commands in a way that makes sense for " -"your system. The name of the command must be a single argument (no spaces in " -"the shebang executable), and the value substituted is the full path to the " -"executable (additional arguments specified in the .INI will be quoted as " -"part of the filename)." +"This installer is deprecated since 3.14 and will not be produced for Python " +"3.16 or later. See :ref:`pymanager` for the modern installer." msgstr "" +"Αυτό το πρόγραμμα εγκατάστασης έχει αποσυρθεί από την έκδοση 3.14 και δεν θα " +"παραχθεί για την Python 3.16 ή νεότερη έκδοση. Δείτε το :ref:`pymanager` για " +"το σύγχρονο πρόγραμμα εγκατάστασης." -#: using/windows.rst:918 +#: using/windows.rst:1307 +msgid "Installation steps" +msgstr "Βήματα Εγκατάστασης" + +#: using/windows.rst:1309 msgid "" -"Any commands not found in the .INI file are treated as **Windows** " -"executable paths that are absolute or relative to the directory containing " -"the script file. This is a convenience for Windows-only scripts, such as " -"those generated by an installer, since the behavior is not compatible with " -"Unix-style shells. These paths may be quoted, and may include multiple " -"arguments, after which the path to the script and any additional arguments " -"will be appended." +"Four Python |version| installers are available for download - two each for " +"the 32-bit and 64-bit versions of the interpreter. The *web installer* is a " +"small initial download, and it will automatically download the required " +"components as necessary. The *offline installer* includes the components " +"necessary for a default installation and only requires an internet " +"connection for optional features. See :ref:`install-layout-option` for other " +"ways to avoid downloading during installation." msgstr "" +"Τέσσερα προγράμματα εγκατάστασης Python |version| είναι διαθέσιμα για λήψη - " +"δύο το καθένα για τις εκδόσεις 32-bit και 64-bit του διερμηνέα. Το " +"*πρόγραμμα εγκατάστασης web* είναι μια αρχική λήψη και θα πραγματοποιήσει " +"αυτόματα λήψη των απαιτούμενων στοιχείων, όπως απαιτείται. Το *πρόγραμμα " +"εγκατάστασης εκτός σύνδεσης* περιλαμβάνει τα στοιχεία που είναι απαραίτητα " +"για μια προεπιλεγμένη εγκατάσταση και απαιτεί μόνο σύνδεση στο διαδίκτυο για " +"προαιρετικές λειτουργίες. Δείτε το :ref:`install-layout-option` για άλλους " +"τρόπους αποφυγής λήψης κατά την εγκατάσταση." -#: using/windows.rst:927 -msgid "Arguments in shebang lines" +#: using/windows.rst:1317 +msgid "After starting the installer, one of two options may be selected:" msgstr "" +"Μετά την εκκίνηση του προγράμματος εγκατάστασης, μπορεί να επιλέγει μία από " +"τις δύο επιλογές:" -#: using/windows.rst:929 +#: using/windows.rst:1321 +msgid "If you select \"Install Now\":" +msgstr "Εάν επιλέξετε \"Install Now\":" + +#: using/windows.rst:1323 msgid "" -"The shebang lines can also specify additional options to be passed to the " -"Python interpreter. For example, if you have a shebang line:" +"You will *not* need to be an administrator (unless a system update for the C " +"Runtime Library is required or you install the :ref:`launcher` for all users)" msgstr "" +"*Δεν* θα χρειάζεται να είστε διαχειριστής (εκτός εάν απαιτείται ενημέρωση " +"συστήματος για τη Βιβλιοθήκη C Runtime ή εγκαταστήσετε το :ref:`launcher` " +"για όλους τους χρήστες)" -#: using/windows.rst:936 -msgid "Then Python will be started with the ``-v`` option" +#: using/windows.rst:1326 +msgid "Python will be installed into your user directory" +msgstr "Η Python θα εγκατασταθεί στον κατάλογο του χρήστη σας" + +#: using/windows.rst:1327 +msgid "" +"The :ref:`launcher` will be installed according to the option at the bottom " +"of the first page" msgstr "" +"Το :ref:`launcher` θα εγκατασταθεί σύμφωνα με την επιλογή στο κάτω μέρος της " +"πρώτης σελίδας" -#: using/windows.rst:939 -msgid "Customization" +#: using/windows.rst:1329 +msgid "The standard library, test suite, launcher and pip will be installed" msgstr "" +"Θα εγκατασταθεί η τυπική βιβλιοθήκη, η δοκιμαστική σουίτα, ο εκκινητής και " +"το pip" -#: using/windows.rst:944 -msgid "Customization via INI files" +#: using/windows.rst:1330 +msgid "If selected, the install directory will be added to your :envvar:`PATH`" msgstr "" +"Εάν επιλεγεί, ο κατάλογος εγκατάστασης θα προστεθεί στο :envvar:`PATH` σας" -#: using/windows.rst:946 +#: using/windows.rst:1331 +msgid "Shortcuts will only be visible for the current user" +msgstr "Οι συντομεύσεις θα είναι ορατές μόνο για τον τρέχοντα χρήστη" + +#: using/windows.rst:1333 msgid "" -"Two .ini files will be searched by the launcher - ``py.ini`` in the current " -"user's application data directory (``%LOCALAPPDATA%`` or ``$env:" -"LocalAppData``) and ``py.ini`` in the same directory as the launcher. The " -"same .ini files are used for both the 'console' version of the launcher (i." -"e. py.exe) and for the 'windows' version (i.e. pyw.exe)." +"Selecting \"Customize installation\" will allow you to select the features " +"to install, the installation location and other options or post-install " +"actions. To install debugging symbols or binaries, you will need to use this " +"option." msgstr "" +"Επιλέγοντας \"Customize installation\" θα σας επιτρέψει να επιλέξετε τις " +"λειτουργίες προς εγκατάσταση, τη θέση εγκατάστασης και άλλες επιλογές ή " +"ενέργειες μετά την εγκατάσταση. Για να εγκαταστήσετε σύμβολα εντοπισμού " +"σφαλμάτων ή δυαδικά αρχεία, θα χρειαστεί να χρησιμοποιήσετε αυτήν την " +"επιλογή." -#: using/windows.rst:952 +#: using/windows.rst:1337 msgid "" -"Customization specified in the \"application directory\" will have " -"precedence over the one next to the executable, so a user, who may not have " -"write access to the .ini file next to the launcher, can override commands in " -"that global .ini file." +"To perform an all-users installation, you should select \"Customize " +"installation\". In this case:" msgstr "" +"Για να εκτελέσετε μια εγκατάσταση για όλους τους χρήστες, θα πρέπει να " +"επιλέξετε \"Customize installation\". Σε αυτήν την περίπτωση:" -#: using/windows.rst:957 -msgid "Customizing default Python versions" +#: using/windows.rst:1340 +msgid "You may be required to provide administrative credentials or approval" msgstr "" +"Ενδέχεται να σας ζητηθεί να παρέχετε διαπιστευτήρια διαχείρισης ή έγκριση" -#: using/windows.rst:959 +#: using/windows.rst:1341 +msgid "Python will be installed into the Program Files directory" +msgstr "Η Python θα εγκατασταθεί στον κατάλογο Program Files" + +#: using/windows.rst:1342 +msgid "The :ref:`launcher` will be installed into the Windows directory" +msgstr "Το :ref:`launcher` θα εγκατασταθεί στον κατάλογο των Windows" + +#: using/windows.rst:1343 +msgid "Optional features may be selected during installation" +msgstr "Προαιρετικά χαρακτηριστικά μπορούν να επιλεγούν κατά την εγκατάσταση" + +#: using/windows.rst:1344 +msgid "The standard library can be pre-compiled to bytecode" +msgstr "Η τυπική βιβλιοθήκη μπορεί να προ-μεταγλωττιστεί σε bytecode" + +#: using/windows.rst:1345 msgid "" -"In some cases, a version qualifier can be included in a command to dictate " -"which version of Python will be used by the command. A version qualifier " -"starts with a major version number and can optionally be followed by a " -"period ('.') and a minor version specifier. Furthermore it is possible to " -"specify if a 32 or 64 bit implementation shall be requested by adding " -"\"-32\" or \"-64\"." +"If selected, the install directory will be added to the system :envvar:`PATH`" msgstr "" +"Εάν επιλεγεί, ο κατάλογος εγκατάστασης θα προστεθεί στο σύστημα :envvar:" +"`PATH`" -#: using/windows.rst:965 +#: using/windows.rst:1346 +msgid "Shortcuts are available for all users" +msgstr "Οι συντομεύσεις είναι διαθέσιμες για όλους τους χρήστες" + +#: using/windows.rst:1355 msgid "" -"For example, a shebang line of ``#!python`` has no version qualifier, while " -"``#!python3`` has a version qualifier which specifies only a major version." +"In the latest versions of Windows, this limitation can be expanded to " +"approximately 32,000 characters. Your administrator will need to activate " +"the \"Enable Win32 long paths\" group policy, or set ``LongPathsEnabled`` to " +"``1`` in the registry key " +"``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." +msgstr "" +"Στις πιο πρόσφατες εκδόσεις των Windows, αυτός ο περιορισμός μπορεί να " +"επεκταθεί σε περίπου 32.000 χαρακτήρες. Ο διαχειριστής σας θα πρέπει να " +"ενεργοποιήσει την πολιτική ομάδας \"Enable Win32 long paths\", ή να ορίσει " +"``LongPathsEnabled`` σε ``1`` το κλειδί μητρώου " +"``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." + +#: using/windows.rst:1364 +msgid "After changing the above option, no further configuration is required." msgstr "" +"Μετά την αλλαγή της παραπάνω επιλογής, δεν απαιτείται περαιτέρω διαμόρφωση." + +#: using/windows.rst:1368 +msgid "Support for long paths was enabled in Python." +msgstr "Η υποστήριξη για μεγάλες διαδρομές ήταν ενεργοποιημένη στην Python." -#: using/windows.rst:968 +#: using/windows.rst:1373 +msgid "Installing without UI" +msgstr "Εγκατάσταση χωρίς περιβάλλον διεπαφής χρήστη" + +#: using/windows.rst:1375 msgid "" -"If no version qualifiers are found in a command, the environment variable :" -"envvar:`PY_PYTHON` can be set to specify the default version qualifier. If " -"it is not set, the default is \"3\". The variable can specify any value that " -"may be passed on the command line, such as \"3\", \"3.7\", \"3.7-32\" or " -"\"3.7-64\". (Note that the \"-64\" option is only available with the " -"launcher included with Python 3.7 or newer.)" +"All of the options available in the installer UI can also be specified from " +"the command line, allowing scripted installers to replicate an installation " +"on many machines without user interaction. These options may also be set " +"without suppressing the UI in order to change some of the defaults." msgstr "" +"Όλες οι διαθέσιμες επιλογές στη διεπαφή χρήστη του προγράμματος εγκατάστασης " +"μπορούν επίσης να καθοριστούν από τη γραμμή εντολών, επιτρέποντας στους " +"εγκαταστάτες με script να αναπαράγουν μια εγκατάσταση σε πολλά μηχανήματα " +"χωρίς αλληλεπίδραση με τον χρήστη. Αυτές οι επιλογές μπορούν επίσης να " +"οριστούν χωρίς να καταργηθεί η διεπαφή χρήστη προκειμένου να αλλάξουν " +"ορισμένες από τις προεπιλογές." -#: using/windows.rst:975 +#: using/windows.rst:1380 msgid "" -"If no minor version qualifiers are found, the environment variable " -"``PY_PYTHON{major}`` (where ``{major}`` is the current major version " -"qualifier as determined above) can be set to specify the full version. If no " -"such option is found, the launcher will enumerate the installed Python " -"versions and use the latest minor release found for the major version, which " -"is likely, although not guaranteed, to be the most recently installed " -"version in that family." +"The following options (found by executing the installer with ``/?``) can be " +"passed into the installer:" msgstr "" +"Οι ακόλουθες επιλογές (που βρίσκονται εκτελώντας το πρόγραμμα εγκατάστασης " +"με ``/?``) μπορούν να περάσουν στο πρόγραμμα εγκατάστασης:" -#: using/windows.rst:983 +#: using/windows.rst:1404 using/windows.rst:1994 +msgid "Name" +msgstr "Όνομα" + +#: using/windows.rst:1386 +msgid "/passive" +msgstr "/passive" + +#: using/windows.rst:1386 +msgid "to display progress without requiring user interaction" +msgstr "για εμφάνιση προόδου χωρίς να απαιτείται αλληλεπίδραση με τον χρήστη" + +#: using/windows.rst:1388 +msgid "/quiet" +msgstr "/quiet" + +#: using/windows.rst:1388 +msgid "to install/uninstall without displaying any UI" +msgstr "για εγκατάσταση/απεγκατάσταση χωρίς εμφάνιση διεπαφής χρήστη" + +#: using/windows.rst:1390 +msgid "/simple" +msgstr "/simple" + +#: using/windows.rst:1390 +msgid "to prevent user customization" +msgstr "για να αποτρέψετε την προσαρμογή του χρήστη" + +#: using/windows.rst:1392 +msgid "/uninstall" +msgstr "/uninstall" + +#: using/windows.rst:1392 +msgid "to remove Python (without confirmation)" +msgstr "για να αφαιρέσετε την Python (χωρίς επιβεβαίωση)" + +#: using/windows.rst:1394 +msgid "/layout [directory]" +msgstr "/layout [κατάλογος]" + +#: using/windows.rst:1394 +msgid "to pre-download all components" +msgstr "για προ-λήψη όλων των στοιχείων" + +#: using/windows.rst:1396 +msgid "/log [filename]" +msgstr "/log [όνομα αρχείου]" + +#: using/windows.rst:1396 +msgid "to specify log files location" +msgstr "για να καθορίσετε τη θέση των αρχείων καταγραφής" + +#: using/windows.rst:1399 msgid "" -"On 64-bit Windows with both 32-bit and 64-bit implementations of the same " -"(major.minor) Python version installed, the 64-bit version will always be " -"preferred. This will be true for both 32-bit and 64-bit implementations of " -"the launcher - a 32-bit launcher will prefer to execute a 64-bit Python " -"installation of the specified version if available. This is so the behavior " -"of the launcher can be predicted knowing only what versions are installed on " -"the PC and without regard to the order in which they were installed (i.e., " -"without knowing whether a 32 or 64-bit version of Python and corresponding " -"launcher was installed last). As noted above, an optional \"-32\" or \"-64\" " -"suffix can be used on a version specifier to change this behaviour." +"All other options are passed as ``name=value``, where the value is usually " +"``0`` to disable a feature, ``1`` to enable a feature, or a path. The full " +"list of available options is shown below." +msgstr "" +"Όλες οι άλλες επιλογές μεταβιβάζονται ως ``name=value``, όπου η τιμή είναι " +"συνήθως ``0`` για να απενεργοποιήσετε ένα χαρακτηριστικό, ``1`` για να " +"ενεργοποιήσετε ένα χαρακτηριστικό ή μια διαδρομή. Η πλήρης λίστα των " +"διαθέσιμων επιλογών φαίνεται παρακάτω." + +#: using/windows.rst:1404 +msgid "Default" +msgstr "Προεπιλογή" + +#: using/windows.rst:1406 +msgid "InstallAllUsers" +msgstr "InstallAllUsers" + +#: using/windows.rst:1406 +msgid "Perform a system-wide installation." +msgstr "Εκτέλεση εγκατάστασης σε όλο το σύστημα." + +#: using/windows.rst:1432 using/windows.rst:1439 using/windows.rst:1470 +#: using/windows.rst:1481 +msgid "0" +msgstr "0" + +#: using/windows.rst:1408 +msgid "TargetDir" +msgstr "TargetDir" + +#: using/windows.rst:1408 +msgid "The installation directory" +msgstr "Ο κατάλογος εγκατάστασης" + +#: using/windows.rst:1408 +msgid "Selected based on InstallAllUsers" +msgstr "Επιλέχθηκε με βάση το InstallAllUsers" + +#: using/windows.rst:1411 +msgid "DefaultAllUsersTargetDir" +msgstr "DefaultAllUsersTargetDir" + +#: using/windows.rst:1411 +msgid "The default installation directory for all-user installs" +msgstr "" +"Ο προεπιλεγμένος κατάλογος εγκατάστασης για τις εγκαταστάσεις όλων των " +"χρηστών" + +#: using/windows.rst:1411 +msgid "" +":file:`%ProgramFiles%\\\\\\ Python X.Y` or :file:`\\ %ProgramFiles(x86)%\\\\" +"\\ Python X.Y`" +msgstr "" +":file:`%ProgramFiles%\\\\\\ Python X.Y` or :file:`\\ %ProgramFiles(x86)%\\\\" +"\\ Python X.Y`" + +#: using/windows.rst:1416 +msgid "DefaultJustForMeTargetDir" +msgstr "DefaultJustForMeTargetDir" + +#: using/windows.rst:1416 +msgid "The default install directory for just-for-me installs" +msgstr "" +"Ο προεπιλεγμένος κατάλογος εγκατάστασης για εξατομικευμένες εγκαταστάσεις" + +#: using/windows.rst:1416 +msgid "" +":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` or :file:" +"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` or :file:" +"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" +msgstr "" +":file:`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY` or :file:" +"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-32` or :file:" +"`%LocalAppData%\\\\\\ Programs\\\\Python\\\\\\ PythonXY-64`" + +#: using/windows.rst:1426 +msgid "DefaultCustomTargetDir" +msgstr "DefaultCustomTargetDir" + +#: using/windows.rst:1426 +msgid "The default custom install directory displayed in the UI" +msgstr "" +"Ο προεπιλεγμένος κατάλογος προσαρμοσμένης εγκατάστασης που εμφανίζεται στο UI" + +#: using/windows.rst:1483 +msgid "(empty)" +msgstr "(empty)" + +#: using/windows.rst:1429 +msgid "AssociateFiles" +msgstr "AssociateFiles" + +#: using/windows.rst:1429 +msgid "Create file associations if the launcher is also installed." +msgstr "" +"Δημιουργήστε συσχετίσεις αρχείων εάν είναι επίσης εγκατεστημένο το πρόγραμμα " +"εκκίνησης." + +#: using/windows.rst:1443 using/windows.rst:1450 using/windows.rst:1458 +#: using/windows.rst:1464 using/windows.rst:1472 using/windows.rst:1476 +msgid "1" +msgstr "1" + +#: using/windows.rst:1432 +msgid "CompileAll" +msgstr "CompileAll" + +#: using/windows.rst:1432 +msgid "Compile all ``.py`` files to ``.pyc``." +msgstr "Μεταγλώττιση όλων των αρχείων ``.py`` σε ``.pyc``." + +#: using/windows.rst:1435 +msgid "PrependPath" +msgstr "PrependPath" + +#: using/windows.rst:1435 +msgid "" +"Prepend install and Scripts directories to :envvar:`PATH` and add ``.PY`` " +"to :envvar:`PATHEXT`" +msgstr "" +"Προετοιμάστε τους καταλόγους εγκατάστασης και Scripts στο :envvar:`PATH` και " +"προσθέστε το ``.PY`` στο :envvar:`PATHEXT`" + +#: using/windows.rst:1439 +msgid "AppendPath" +msgstr "AppendPath" + +#: using/windows.rst:1439 +msgid "" +"Append install and Scripts directories to :envvar:`PATH` and add ``.PY`` " +"to :envvar:`PATHEXT`" +msgstr "" +"Προσθήκη καταλόγων εγκατάστασης και Scripts σε :envvar:`PATH` και προσθήκη " +"``.PY`` σε :envvar:`PATHEXT`" + +#: using/windows.rst:1443 +msgid "Shortcuts" +msgstr "Συντομεύσεις" + +#: using/windows.rst:1443 +msgid "" +"Create shortcuts for the interpreter, documentation and IDLE if installed." +msgstr "" +"Δημιουργήστε συντομεύσεις για τον διερμηνέα, την τεκμηρίωση και το IDLE εάν " +"είναι εγκατεστημένα." + +#: using/windows.rst:1446 +msgid "Include_doc" +msgstr "Include_doc" + +#: using/windows.rst:1446 +msgid "Install Python manual" +msgstr "Εγκαταστήστε το εγχειρίδιο της Python" + +#: using/windows.rst:1448 +msgid "Include_debug" +msgstr "Include_debug" + +#: using/windows.rst:1448 +msgid "Install debug binaries" +msgstr "Εγκαταστήστε δυαδικά αρχεία εντοπισμού σφαλμάτων" + +#: using/windows.rst:1450 +msgid "Include_dev" +msgstr "Include_dev" + +#: using/windows.rst:1450 +msgid "" +"Install developer headers and libraries. Omitting this may lead to an " +"unusable installation." +msgstr "" +"Εγκατάσταση κεφαλίδων και βιβλιοθηκών προγραμματιστή. Η παράλειψη αυτού " +"μπορεί να οδηγήσει σε μη χρησιμοποιήσιμη εγκατάσταση." + +#: using/windows.rst:1454 +msgid "Include_exe" +msgstr "Include_exe" + +#: using/windows.rst:1454 +msgid "" +"Install :file:`python.exe` and related files. Omitting this may lead to an " +"unusable installation." +msgstr "" +"Εγκατάσταση :file:`python.exe` και σχετικών αρχείων. Η παράλειψη αυτού " +"μπορεί να οδηγήσει σε μη χρησιμοποιήσιμη εγκατάσταση." + +#: using/windows.rst:1458 +msgid "Include_launcher" +msgstr "Include_launcher" + +#: using/windows.rst:1458 +msgid "Install :ref:`launcher`." +msgstr "Εγκαταστήστε το :ref:`launcher`." + +#: using/windows.rst:1460 +msgid "InstallLauncherAllUsers" +msgstr "InstallLauncherAllUsers" + +#: using/windows.rst:1460 +msgid "" +"Installs the launcher for all users. Also requires ``Include_launcher`` to " +"be set to 1" +msgstr "" +"Εγκαθιστά το πρόγραμμα εκκίνησης για όλους του χρήστες. Επίσης, απαιτείται η " +"ρύθμιση ``Include_launcher`` να τεθεί σε 1" + +#: using/windows.rst:1464 +msgid "Include_lib" +msgstr "Include_lib" + +#: using/windows.rst:1464 +msgid "" +"Install standard library and extension modules. Omitting this may lead to an " +"unusable installation." +msgstr "" +"Εγκαταστήστε τυπικά module βιβλιοθήκης και επέκτασης. Η παράλειψη αυτού " +"μπορεί να οδηγήσει σε μη χρησιμοποιήσιμη εγκατάσταση." + +#: using/windows.rst:1468 +msgid "Include_pip" +msgstr "Include_pip" + +#: using/windows.rst:1468 +msgid "Install bundled pip and setuptools" +msgstr "Εγκαταστήστε το πακέτο pip και setuptools" + +#: using/windows.rst:1470 +msgid "Include_symbols" +msgstr "Include_symbols" + +#: using/windows.rst:1470 +msgid "Install debugging symbols (``*.pdb``)" +msgstr "Εγκατάσταση συμβόλων εντοπισμού σφαλμάτων (``*.pdb``)" + +#: using/windows.rst:1472 +msgid "Include_tcltk" +msgstr "Include_tcltk" + +#: using/windows.rst:1472 +msgid "Install Tcl/Tk support and IDLE" +msgstr "Εγκατάσταση υποστήριξης Tcl/Tk και IDLE" + +#: using/windows.rst:1474 +msgid "Include_test" +msgstr "Include_test" + +#: using/windows.rst:1474 +msgid "Install standard library test suite" +msgstr "Εγκαταστήστε την τυπική σουίτα δοκιμών βιβλιοθήκης" + +#: using/windows.rst:1476 +msgid "Include_tools" +msgstr "Include_tools" + +#: using/windows.rst:1476 +msgid "Install utility scripts" +msgstr "Εγκαταστήστε βοηθητικά scripts" + +#: using/windows.rst:1478 +msgid "LauncherOnly" +msgstr "LauncherOnly" + +#: using/windows.rst:1478 +msgid "Only installs the launcher. This will override most other options." +msgstr "" +"Εγκαθιστά μόνο το πρόγραμμα εκκίνησης. Αυτό θα παρακάμψει τις περισσότερες " +"άλλες επιλογές." + +#: using/windows.rst:1481 +msgid "SimpleInstall" +msgstr "SimpleInstall" + +#: using/windows.rst:1481 +msgid "Disable most install UI" +msgstr "Απενεργοποιήστε τις περισσότερες διεπαφές εγκατάστασης" + +#: using/windows.rst:1483 +msgid "SimpleInstallDescription" +msgstr "SimpleInstallDescription" + +#: using/windows.rst:1483 +msgid "A custom message to display when the simplified install UI is used." +msgstr "" +"Ένα προσαρμοσμένο μήνυμα που θα εμφανίζεται όταν χρησιμοποιείται το " +"απλοποιημένο περιβάλλον διεπαφής χρήστη." + +#: using/windows.rst:1487 +msgid "" +"For example, to silently install a default, system-wide Python installation, " +"you could use the following command (from an elevated command prompt)::" +msgstr "" +"Για παράδειγμα, για να εγκαταστήσετε αθόρυβα μια προεπιλεγμένη εγκατάσταση " +"Python σε όλο το σύστημα, θα μπορούσατε να χρησιμοποιήσετε την ακόλουθη " +"εντολή (από μια ανυψωμένη γραμμή εντολών)::" + +#: using/windows.rst:1490 +msgid "python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" +msgstr "python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" + +#: using/windows.rst:1492 +msgid "" +"To allow users to easily install a personal copy of Python without the test " +"suite, you could provide a shortcut with the following command. This will " +"display a simplified initial page and disallow customization::" +msgstr "" +"Για να επιτρέψετε στους χρήστες να εγκαταστήσουν εύκολα ένα προσωπικό " +"αντίγραφο της Python χωρίς τη δοκιμαστική σουίτα, θα μπορούσατε να παρέχετε " +"μια συντόμευση με την ακόλουθη εντολή. Αυτή θα εμφανίσει μια απλοποιημένη " +"αρχική σελίδα και θα απαγορεύσει την προσαρμογή::" + +#: using/windows.rst:1496 +msgid "" +"python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0\n" +" SimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"" +msgstr "" +"python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0\n" +" SimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"" + +#: using/windows.rst:1499 +msgid "" +"(Note that omitting the launcher also omits file associations, and is only " +"recommended for per-user installs when there is also a system-wide " +"installation that included the launcher.)" +msgstr "" +"(Λάβετε υπόψη ότι η παράλειψη της εφαρμογής εκκίνησης παραλείπει επίσης " +"συσχετίσεις αρχείων και συνίσταται μόνο για εγκαταστάσεις ανά χρήστη όταν " +"υπάρχει επίσης εγκατάσταση σε όλο το σύστημα που περιλάμβανε τη λειτουργία " +"εκκίνησης.)" + +#: using/windows.rst:1503 +msgid "" +"The options listed above can also be provided in a file named ``unattend." +"xml`` alongside the executable. This file specifies a list of options and " +"values. When a value is provided as an attribute, it will be converted to a " +"number if possible. Values provided as element text are always left as " +"strings. This example file sets the same options as the previous example:" +msgstr "" +"Οι επιλογές που αναφέρονται παραπάνω μπορούν επίσης να παρέχονται σε ένα " +"αρχείο με το όνομα ``unattend.xml`` δίπλα στο εκτελέσιμο αρχείο. Αυτό το " +"αρχείο καθορίζει μια λίστα επιλογών και τιμών. Όταν μια τιμή παρέχεται ως " +"χαρακτηριστικό, θα μετατραπεί σε αριθμό εάν είναι δυνατόν. Οι τιμές που " +"παρέχονται ως κείμενο στοιχείου παραμένουν πάντα ως συμβολοσειρές. Αυτό το " +"αρχείο παραδείγματος ορίζει τις ίδιες επιλογές με το προηγούμενο παράδειγμα:" + +#: using/windows.rst:1509 +msgid "" +"\n" +" " +msgstr "" +"\n" +" " + +#: using/windows.rst:1522 +msgid "Installing without downloading" +msgstr "Εγκατάσταση χωρίς λήψη" + +#: using/windows.rst:1524 +msgid "" +"As some features of Python are not included in the initial installer " +"download, selecting those features may require an internet connection. To " +"avoid this need, all possible components may be downloaded on-demand to " +"create a complete *layout* that will no longer require an internet " +"connection regardless of the selected features. Note that this download may " +"be bigger than required, but where a large number of installations are going " +"to be performed it is very useful to have a locally cached copy." +msgstr "" +"Καθώς ορισμένες δυνατότητες της Python δεν περιλαμβάνονται στην αρχική λήψη " +"του προγράμματος εγκατάστασης, η επιλογή αυτών των δυνατοτήτων ενδέχεται να " +"απαιτεί σύνδεση στο διαδίκτυο. Για να αποφευχθεί αυτή η ανάγκη, όλα τα " +"πιθανά στοιχεία μπορούν να ληφθούν κατ' απαίτηση για να δημιουργηθεί μια " +"πλήρης *διάταξη* που δεν θα απαιτεί πλέον μια σύνδεση στο Διαδίκτυο, " +"ανεξάρτητα από τις επιλεγμένες δυνατότητες. Λάβετε υπόψη ότι αυτή η λήψη " +"μπορεί να είναι μεγαλύτερη από την απαιτούμενη, αλλά όπου πρόκειται να " +"πραγματοποιηθεί μεγάλος αριθμός εγκαταστάσεων, είναι πολύ χρήσιμο να έχετε " +"ένα αντίγραφο προσωρινής αποθήκευσης." + +#: using/windows.rst:1532 +msgid "" +"Execute the following command from Command Prompt to download all possible " +"required files. Remember to substitute ``python-3.9.0.exe`` for the actual " +"name of your installer, and to create layouts in their own directories to " +"avoid collisions between files with the same name." msgstr "" +"Εκτελέστε την ακόλουθη εντολή από τη Γραμμή Εντολών για λήψη όλων των " +"πιθανών απαιτούμενων αρχείων. Θυμηθείτε να αντικαταστήσετε το " +"``python-3.9.0.exe`` για το πραγματικό όνομα του προγράμματος εγκατάστασης " +"και να δημιουργήσετε διατάξεις στους δικούς τους καταλόγους για να αποφύγετε " +"συγκρούσεις μεταξύ αρχείων με το ίδιο όνομα." -#: using/windows.rst:994 -msgid "Examples:" -msgstr "" +#: using/windows.rst:1539 +msgid "python-3.9.0.exe /layout [optional target directory]" +msgstr "python-3.9.0.exe /layout [optional target directory]" -#: using/windows.rst:996 +#: using/windows.rst:1541 msgid "" -"If no relevant options are set, the commands ``python`` and ``python2`` will " -"use the latest Python 2.x version installed and the command ``python3`` will " -"use the latest Python 3.x installed." +"You may also specify the ``/quiet`` option to hide the progress display." msgstr "" +"Μπορείτε επίσης να καθορίσετε την επιλογή ``/quiet`` για απόκρυψη της " +"εμφάνισης προόδου." + +#: using/windows.rst:1544 +msgid "Modifying an install" +msgstr "Τροποποίηση εγκατάστασης" -#: using/windows.rst:1000 +#: using/windows.rst:1546 msgid "" -"The command ``python3.7`` will not consult any options at all as the " -"versions are fully specified." +"Once Python has been installed, you can add or remove features through the " +"Programs and Features tool that is part of Windows. Select the Python entry " +"and choose \"Uninstall/Change\" to open the installer in maintenance mode." msgstr "" +"Μόλις εγκατασταθεί η Python, μπορείτε να προσθέσετε ή να αφαιρέσετε " +"λειτουργίες μέσω του εργαλείου Προγράμματα και Δυνατότητες που είναι μέρος " +"των Windows. Επιλέξτε την καταχώρηση Python και επιλέξτε \"Κατάργηση " +"εγκατάστασης/Αλλαγή\" για να ανοίξετε το πρόγραμμα εγκατάστασης σε " +"λειτουργία συντήρησης." -#: using/windows.rst:1003 +#: using/windows.rst:1550 msgid "" -"If ``PY_PYTHON=3``, the commands ``python`` and ``python3`` will both use " -"the latest installed Python 3 version." +"\"Modify\" allows you to add or remove features by modifying the checkboxes " +"- unchanged checkboxes will not install or remove anything. Some options " +"cannot be changed in this mode, such as the install directory; to modify " +"these, you will need to remove and then reinstall Python completely." msgstr "" +"Η \"Αλλαγή\" σάς επιτρέπει να προσθέτετε ή να αφαιρείτε λειτουργίες " +"τροποποιώντας τα πλαίσια ελέγχου - τα αμετάβλητα πλαίσια ελέγχου δεν θα " +"εγκαταστήσουν ή θα αφαιρέσουν τίποτα. Ορισμένες επιλογές δεν μπορούν να " +"αλλάξουν σε αυτήν τη λειτουργία, όπως ο κατάλογος εγκατάστασης· για να τις " +"τροποποιήσετε, θα χρειαστεί αν αφαιρέσετε και, στη συνέχεια να " +"επανεγκαταστήσετε ξανά την Python." -#: using/windows.rst:1006 +#: using/windows.rst:1555 msgid "" -"If ``PY_PYTHON=3.7-32``, the command ``python`` will use the 32-bit " -"implementation of 3.7 whereas the command ``python3`` will use the latest " -"installed Python (PY_PYTHON was not considered at all as a major version was " -"specified.)" +"\"Repair\" will verify all the files that should be installed using the " +"current settings and replace any that have been removed or modified." msgstr "" +"Η \"Επιδιόρθωση\" θα επαληθεύσει όλα τα αρχεία που πρέπει να εγκατασταθούν " +"χρησιμοποιώντας τις τρέχουσες ρυθμίσεις και θα αντικαταστήσει όσα έχουν " +"αφαιρεθεί ή τροποποιηθεί." -#: using/windows.rst:1011 +#: using/windows.rst:1558 msgid "" -"If ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7``, the commands ``python`` and " -"``python3`` will both use specifically 3.7" +"\"Uninstall\" will remove Python entirely, with the exception of the :ref:" +"`launcher`, which has its own entry in Programs and Features." msgstr "" - -#: using/windows.rst:1014 +"Η \"Κατάργηση εγκατάστασης\" θα καταργήσει πλήρως την Python, με εξαίρεση " +"το :ref:`launcher`, το οποίο έχει τη δική του καταχώριση στο Προγράμματα και " +"Δυνατότητες." + +#: using/windows.rst:1567 +msgid "" +"To install pre-built binaries with free-threading enabled (see :pep:`703`), " +"you should select \"Customize installation\". The second page of options " +"includes the \"Download free-threaded binaries\" checkbox." +msgstr "" +"Για να εγκαταστήσετε προ-κατασκευασμένα δυαδικά αρχεία με ενεργοποιημένο το " +"free-threading (δείτε το :pep:`703`), θα πρέπει να επιλέξετε \"Προσαρμοσμένη " +"εγκατάσταση\". Η δεύτερη σελίδα επιλογών περιλαμβάνει το πλαίσιο επιλογής " +"\"Λήψη δυαδικών αρχείων με ελεύθερο νήμα\"." + +#: using/windows.rst:1573 +msgid "" +"Selecting this option will download and install additional binaries to the " +"same location as the main Python install. The main executable is called " +"``python3.13t.exe``, and other binaries either receive a ``t`` suffix or a " +"full ABI suffix. Python source files and bundled third-party dependencies " +"are shared with the main install." +msgstr "" +"Η επιλογή αυτής της επιλογής θα κατεβάσει και θα εγκαταστήσει πρόσθετα " +"δυαδικά αρχεία στην ίδια τοποθεσία με την κύρια εγκατάσταση Python. Το κύριο " +"εκτελέσιμο αρχείο ονομάζεται ``python3.13t.exe``, και άλλα δυαδικά αρχεία " +"είτε λαμβάνουν μια κατάληξη ``t`` είτε μια πλήρη κατάληξη ABI. Τα αρχεία " +"πηγαίου κώδικα Python και οι ενσωματωμένες εξαρτήσεις τρίτων μοιράζονται με " +"την κύρια εγκατάσταση." + +#: using/windows.rst:1579 +msgid "" +"The free-threaded version is registered as a regular Python install with the " +"tag ``3.13t`` (with a ``-32`` or ``-arm64`` suffix as normal for those " +"platforms). This allows tools to discover it, and for the :ref:`launcher` to " +"support ``py.exe -3.13t``. Note that the launcher will interpret ``py.exe " +"-3`` (or a ``python3`` shebang) as \"the latest 3.x install\", which will " +"prefer the free-threaded binaries over the regular ones, while ``py.exe " +"-3.13`` will not. If you use the short style of option, you may prefer to " +"not install the free-threaded binaries at this time." +msgstr "" +"Η έκδοση με ελεύθερο νήμα καταχωρείται ως κανονική εγκατάσταση Python με την " +"ετικέτα ``3.13t`` (με κατάληξη ``-32`` ή ``-arm64`` ως κανονική για αυτές " +"τις πλατφόρμες). Αυτό επιτρέπει στα εργαλεία να την ανακαλύψουν και για το :" +"ref:`launcher` να υποστηρίζει το ``py.exe -3.13t``. Σημειώστε ότι το " +"πρόγραμμα εκκίνησης θα ερμηνεύσει το ``py.exe -3`` (ή ένα shebang " +"``python3``) ως \"την τελευταία εγκατάσταση 3.x\", η οποία θα προτιμήσει τα " +"δυαδικά αρχεία με ελεύθερο νήμα έναντι των κανονικών, ενώ το ``py.exe " +"-3.13`` δεν θα το κάνει. Εάν χρησιμοποιείτε το σύντομο στυλ επιλογής, μπορεί " +"να προτιμάτε να μην εγκαταστήσετε τα δυαδικά αρχεία με ελεύθερο νήμα αυτή τη " +"στιγμή." + +#: using/windows.rst:1588 +msgid "" +"To specify the install option at the command line, use " +"``Include_freethreaded=1``. See :ref:`install-layout-option` for " +"instructions on pre-emptively downloading the additional binaries for " +"offline install. The options to include debug symbols and binaries also " +"apply to the free-threaded builds." +msgstr "" +"Για να καθορίσετε την επιλογή εγκατάστασης στη γραμμή εντολών, " +"χρησιμοποιήστε ``Include_freethreaded=1``. Δείτε :ref:`install-layout-" +"option` για οδηγίες σχετικά με την προληπτική λήψη των πρόσθετων δυαδικών " +"αρχείων για εγκατάσταση εκτός σύνδεσης. Οι επιλογές για την συμπερίληψη " +"συμβόλων και δυαδικών αρχείων εντοπισμού σφαλμάτων ισχύουν επίσης για τις " +"κατασκευές με ελεύθερο νήμα." + +#: using/windows.rst:1594 +msgid "" +"Free-threaded binaries are also available :ref:`on nuget.org `." +msgstr "" +"Τα δυαδικά αρχεία με ελεύθερο νήμα είναι επίσης διαθέσιμα :ref:`στο nuget." +"org `." + +#: using/windows.rst:1598 +msgid "Python launcher for Windows (deprecated)" +msgstr "Το πρόγραμμα εκκίνησης Python για Windows (Απαρχαιωμένο)" + +#: using/windows.rst:1602 +msgid "" +"The launcher and this documentation have been superseded by the Python " +"Install Manager described above. This is preserved temporarily for " +"historical interest." +msgstr "" +"Το πρόγραμμα εκκίνησης και αυτή η τεκμηρίωση έχουν αντικατασταθεί από το " +"Python Install Manager που περιγράφεται παραπάνω. Αυτό διατηρείται προσωρινά " +"για ιστορικό ενδιαφέρον." + +#: using/windows.rst:1608 msgid "" -"In addition to environment variables, the same settings can be configured in " -"the .INI file used by the launcher. The section in the INI file is called " -"``[defaults]`` and the key name will be the same as the environment " -"variables without the leading ``PY_`` prefix (and note that the key names in " -"the INI file are case insensitive.) The contents of an environment variable " -"will override things specified in the INI file." +"The Python launcher for Windows is a utility which aids in locating and " +"executing of different Python versions. It allows scripts (or the command-" +"line) to indicate a preference for a specific Python version, and will " +"locate and execute that version." msgstr "" +"Το πρόγραμμα εκκίνησης Python για Windows είναι ένα βοηθητικό πρόγραμμα που " +"βοηθά στον εντοπισμό και την εκτέλεση διαφορετικών εκδόσεων Python. " +"Επιτρέπει στα scripts (ή στη γραμμή εντολών) να υποδείξουν μια προτίμηση για " +"μια συγκεκριμένη έκδοση Python και θα εντοπίσουν και θα εκτελέσουν αυτήν την " +"έκδοση." -#: using/windows.rst:1021 -msgid "For example:" +#: using/windows.rst:1613 +msgid "" +"Unlike the :envvar:`PATH` variable, the launcher will correctly select the " +"most appropriate version of Python. It will prefer per-user installations " +"over system-wide ones, and orders by language version rather than using the " +"most recently installed version." msgstr "" +"Σε αντίθεση με τη μεταβλητή :envvar:`PATH`, το πρόγραμμα εκκίνησης θα " +"επιλέξει σωστά την καταλληλότερη έκδοση της Python. Θα προτιμήσει τις " +"εγκαταστάσεις ανά χρήστη έναντι των εγκαταστάσεων σε όλο το σύστημα και τις " +"παραγγελίες ανά έκδοση γλώσσας αντί να χρησιμοποιεί την πιο πρόσφατα " +"εγκατεστημένη έκδοση." -#: using/windows.rst:1023 -msgid "Setting ``PY_PYTHON=3.7`` is equivalent to the INI file containing:" -msgstr "" +#: using/windows.rst:1618 +msgid "The launcher was originally specified in :pep:`397`." +msgstr "Το πρόγραμμα εκκίνησης προσδιορίστηκε αρχικά στο :pep:`397`." + +#: using/windows.rst:1621 +msgid "Getting started" +msgstr "Ξεκινώντας" -#: using/windows.rst:1030 +#: using/windows.rst:1624 +msgid "From the command-line" +msgstr "Από τη γραμμή εντολών" + +#: using/windows.rst:1628 msgid "" -"Setting ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7`` is equivalent to the INI file " -"containing:" +"System-wide installations of Python 3.3 and later will put the launcher on " +"your :envvar:`PATH`. The launcher is compatible with all available versions " +"of Python, so it does not matter which version is installed. To check that " +"the launcher is available, execute the following command in Command Prompt::" msgstr "" +"Εγκαταστάσεις σε όλο το σύστημα της Python 3.3 και νεότερες εκδόσεις θα " +"τοποθετήσουν το πρόγραμμα εκκίνησης στο :envvar:`PATH`. Το πρόγραμμα " +"εκκίνησης είναι συμβατό με όλες τις διαθέσιμες εκδόσεις της Python, επομένως " +"δεν έχει σημασία ποια έκδοση είναι εγκατεστημένη. Για να ελέγξτε ότι το " +"πρόγραμμα εκκίνησης είναι διαθέσιμο, εκτελέστε την ακόλουθη εντολή στη " +"Γραμμή Εντολών::" -#: using/windows.rst:1040 -msgid "Diagnostics" -msgstr "" +#: using/windows.rst:1633 +msgid "py" +msgstr "py" -#: using/windows.rst:1042 +#: using/windows.rst:1635 msgid "" -"If an environment variable :envvar:`PYLAUNCHER_DEBUG` is set (to any value), " -"the launcher will print diagnostic information to stderr (i.e. to the " -"console). While this information manages to be simultaneously verbose *and* " -"terse, it should allow you to see what versions of Python were located, why " -"a particular version was chosen and the exact command-line used to execute " -"the target Python. It is primarily intended for testing and debugging." +"You should find that the latest version of Python you have installed is " +"started - it can be exited as normal, and any additional command-line " +"arguments specified will be sent directly to Python." msgstr "" +"Θα πρέπει να διαπιστώσετε ότι η πιο πρόσφατη έκδοση της Python που έχετε " +"εγκαταστήσει έχει ξεκινήσει - μπορεί να βγει κανονικά και τυχόν πρόσθετα " +"ορίσματα γραμμής εντολών που καθορίστηκαν θα σταλούν απευθείας στην Python." -#: using/windows.rst:1050 -msgid "Dry Run" +#: using/windows.rst:1639 +msgid "" +"If you have multiple versions of Python installed (e.g., 3.7 and |version|) " +"you will have noticed that Python |version| was started - to launch Python " +"3.7, try the command::" msgstr "" +"Εάν έχετε εγκαταστήσει πολλές εκδόσεις της Python (π.χ. 3.7 και |version|) " +"θα έχετε παρατηρήσει ότι ξεκίνησε η Python |version| - για να εκκινήσετε την " +"Python 3.7, δοκιμάστε την εντολή::" -#: using/windows.rst:1052 +#: using/windows.rst:1643 +msgid "py -3.7" +msgstr "py -3.7" + +#: using/windows.rst:1645 msgid "" -"If an environment variable :envvar:`PYLAUNCHER_DRYRUN` is set (to any " -"value), the launcher will output the command it would have run, but will not " -"actually launch Python. This may be useful for tools that want to use the " -"launcher to detect and then launch Python directly. Note that the command " -"written to standard output is always encoded using UTF-8, and may not render " -"correctly in the console." +"If you want the latest version of Python 2 you have installed, try the " +"command::" msgstr "" +"Αν θέλετε την πιο πρόσφατη έκδοση της Python 2 που έχετε εγκαταστήσει, " +"δοκιμάστε την εντολή::" -#: using/windows.rst:1060 -msgid "Install on demand" -msgstr "" +#: using/windows.rst:1648 +msgid "py -2" +msgstr "py -2" -#: using/windows.rst:1062 +#: using/windows.rst:1650 msgid "" -"If an environment variable :envvar:`PYLAUNCHER_ALLOW_INSTALL` is set (to any " -"value), and the requested Python version is not installed but is available " -"on the Microsoft Store, the launcher will attempt to install it. This may " -"require user interaction to complete, and you may need to run the command " -"again." +"If you see the following error, you do not have the launcher installed::" msgstr "" +"Αν δείτε το ακόλουθο σφάλμα, δεν έχετε εγκαταστήσει τον εκκινητή (launcher)::" -#: using/windows.rst:1067 +#: using/windows.rst:1652 msgid "" -"An additional :envvar:`PYLAUNCHER_ALWAYS_INSTALL` variable causes the " -"launcher to always try to install Python, even if it is detected. This is " -"mainly intended for testing (and should be used with :envvar:" -"`PYLAUNCHER_DRYRUN`)." +"'py' is not recognized as an internal or external command,\n" +"operable program or batch file." msgstr "" +"Το 'py' δεν αναγνωρίζεται ως εσωτερική ή εξωτερική εντολή,\n" +"λειτουργικό πρόγραμμα ή αρχείο παρτίδας." -#: using/windows.rst:1072 -msgid "Return codes" -msgstr "" +#: using/windows.rst:1655 +msgid "The command::" +msgstr "Η εντολή::" -#: using/windows.rst:1074 +#: using/windows.rst:1657 +msgid "py --list" +msgstr "py --list" + +#: using/windows.rst:1659 +msgid "displays the currently installed version(s) of Python." +msgstr "εμφανίζει τις τρέχουσες εγκατεστημένες εκδόσεις της Python." + +#: using/windows.rst:1661 msgid "" -"The following exit codes may be returned by the Python launcher. " -"Unfortunately, there is no way to distinguish these from the exit code of " -"Python itself." +"The ``-x.y`` argument is the short form of the ``-V:Company/Tag`` argument, " +"which allows selecting a specific Python runtime, including those that may " +"have come from somewhere other than python.org. Any runtime registered by " +"following :pep:`514` will be discoverable. The ``--list`` command lists all " +"available runtimes using the ``-V:`` format." msgstr "" +"Το όρισμα ``-x.y`` είναι η σύντομη μορφή του ορίσματος ``-V:Company/Tag``, " +"το οποίο επιτρέπει την επιλογή ενός συγκεκριμένου χρόνου εκτέλεσης Python, " +"συμπεριλαμβανομένων εκείνων που μπορεί να έχουν προέλθει από κάπου " +"διαφορετικά από το python.org. Οποιοσδήποτε χρόνος εκτέλεσης έχει " +"καταχωρηθεί ακολουθώντας το :pep:`514` θα είναι ανιχνεύσιμος. Η εντολή ``--" +"list`` παραθέτει όλους τους διαθέσιμους χρόνους εκτέλεσης χρησιμοποιώντας τη " +"μορφή ``-V:``." -#: using/windows.rst:1077 +#: using/windows.rst:1667 msgid "" -"The names of codes are as used in the sources, and are only for reference. " -"There is no way to access or resolve them apart from reading this page. " -"Entries are listed in alphabetical order of names." +"When using the ``-V:`` argument, specifying the Company will limit selection " +"to runtimes from that provider, while specifying only the Tag will select " +"from all providers. Note that omitting the slash implies a tag::" msgstr "" - -#: using/windows.rst:1082 -msgid "Value" +"Όταν χρησιμοποιείται το όρισμα ``-V:``, ο καθορισμός της Εταιρείας θα " +"περιορίσει την επιλογή σε χρόνους εκτέλεσης από αυτόν τον πάροχο, ενώ ο " +"καθορισμός μόνο της ετικέτας θα επιλέγεται από όλους τους παρόχους. " +"Σημειώστε ότι η παράλειψη της καθέτου (slash) συνεπάγεται μια ετικέτα::" + +#: using/windows.rst:1671 +msgid "" +"# Select any '3.*' tagged runtime\n" +"py -V:3\n" +"\n" +"# Select any 'PythonCore' released runtime\n" +"py -V:PythonCore/\n" +"\n" +"# Select PythonCore's latest Python 3 runtime\n" +"py -V:PythonCore/3" +msgstr "" +"# Select any '3.*' tagged runtime\n" +"py -V:3\n" +"\n" +"# Select any 'PythonCore' released runtime\n" +"py -V:PythonCore/\n" +"\n" +"# Select PythonCore's latest Python 3 runtime\n" +"py -V:PythonCore/3" + +#: using/windows.rst:1680 +msgid "" +"The short form of the argument (``-3``) only ever selects from core Python " +"releases, and not other distributions. However, the longer form (``-V:3``) " +"will select from any." msgstr "" +"Η σύντομη μορφή του ορίσματος (``-3``) επιλέγει μόνο από τις βασικές " +"εκδόσεις Python, και όχι άλλες διανομές. Ωστόσο, η μεγαλύτερη μορφή (``-" +"V:3``) θα επιλέξει από οποιαδήποτε." -#: using/windows.rst:1084 -msgid "RC_BAD_VENV_CFG" +#: using/windows.rst:1684 +msgid "" +"The Company is matched on the full string, case-insensitive. The Tag is " +"matched on either the full string, or a prefix, provided the next character " +"is a dot or a hyphen. This allows ``-V:3.1`` to match ``3.1-32``, but not " +"``3.10``. Tags are sorted using numerical ordering (``3.10`` is newer than " +"``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." msgstr "" +"Η εταιρεία έχει αντιστοιχιστεί στην πλήρη συμβολοσειρά, χωρίς διάκριση πεζών-" +"κεφαλαίων. Η ετικέτα αντιστοιχίζεται είτε με την πλήρη συμβολοσειρά είτε με " +"ένα πρόθεμα, με την προϋπόθεση ότι ο επόμενος χαρακτήρας είναι μια τελεία ή " +"μια παύλα. Αυτό επιτρέπει την αντιστοίχιση του ``-V:3.1`` με το ``3.1-32``, " +"αλλά όχι ``3.10``. Οι ετικέτες ταξινομούνται με αριθμητική σειρά (``3.10`` " +"είναι νεότερο από ``3.1``), αλλά συγκρίνονται χρησιμοποιώντας κείμενο (``-" +"V:3.01`` δεν ταιριάζει με το ``3.1``)." -#: using/windows.rst:1084 -msgid "107" -msgstr "" +#: using/windows.rst:1692 +msgid "Virtual environments" +msgstr "Εικονικά Περιβάλλοντα" -#: using/windows.rst:1084 -msgid "A :file:`pyvenv.cfg` was found but is corrupt." +#: using/windows.rst:1696 +msgid "" +"If the launcher is run with no explicit Python version specification, and a " +"virtual environment (created with the standard library :mod:`venv` module or " +"the external ``virtualenv`` tool) active, the launcher will run the virtual " +"environment's interpreter rather than the global one. To run the global " +"interpreter, either deactivate the virtual environment, or explicitly " +"specify the global Python version." msgstr "" +"Εάν το πρόγραμμα εγκατάστασης εκτελείται χωρίς ρητές προδιαγραφές έκδοσης " +"Python και ένα εικονικό περιβάλλον (δημιουργημένο με το τυπικό module " +"βιβλιοθήκης :mod:`venv` ή το εξωτερικό εργαλείο ``virtualenv``) ενεργό, το " +"πρόγραμμα εκκίνησης θα εκτελέσει τον διερμηνέα του εικονικού περιβάλλοντος " +"αντί για το καθολικό. Για να εκτελέσετε τον καθολικό διερμηνέα, είτε " +"απενεργοποιήστε το εικονικό περιβάλλον είτε καθορίστε ρητά την καθολική " +"έκδοση Python." -#: using/windows.rst:1086 -msgid "RC_CREATE_PROCESS" -msgstr "" +#: using/windows.rst:1704 +msgid "From a script" +msgstr "Από ένα script" -#: using/windows.rst:1086 -msgid "101" +#: using/windows.rst:1706 +msgid "" +"Let's create a test Python script - create a file called ``hello.py`` with " +"the following contents" msgstr "" +"Ας δημιουργήσουμε ένα δοκιμαστικό Python script - δημιουργήστε ένα αρχείο " +"που ονομάζεται ``hello.py`` με τα ακόλουθα περιεχόμενα" -#: using/windows.rst:1086 -msgid "Failed to launch Python." +#: using/windows.rst:1709 +msgid "" +"#! python\n" +"import sys\n" +"sys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))" msgstr "" +"#! python\n" +"import sys\n" +"sys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))" -#: using/windows.rst:1088 -msgid "RC_INSTALLING" -msgstr "" +#: using/windows.rst:1715 +msgid "From the directory in which hello.py lives, execute the command::" +msgstr "Από τον κατάλογο στον οποίο ζει το hello.py, εκτελέστε την εντολή::" -#: using/windows.rst:1088 -msgid "111" -msgstr "" +#: using/windows.rst:1717 +msgid "py hello.py" +msgstr "py hello.py" -#: using/windows.rst:1088 +#: using/windows.rst:1719 msgid "" -"An install was started, but the command will need to be re-run after it " -"completes." -msgstr "" - -#: using/windows.rst:1091 -msgid "RC_INTERNAL_ERROR" +"You should notice the version number of your latest Python 2.x installation " +"is printed. Now try changing the first line to be:" msgstr "" +"Θα πρέπει να παρατηρήσετε ότι ο αριθμός έκδοσης της τελευταίας εγκατάστασης " +"Python 2.x έχει εκτυπωθεί. Τώρα δοκιμάστε να αλλάξετε την πρώτη γραμμή σε:" -#: using/windows.rst:1091 -msgid "109" -msgstr "" +#: using/windows.rst:1722 +msgid "#! python3" +msgstr "#! python3" -#: using/windows.rst:1091 -msgid "Unexpected error. Please report a bug." +#: using/windows.rst:1726 +msgid "" +"Re-executing the command should now print the latest Python 3.x information. " +"As with the above command-line examples, you can specify a more explicit " +"version qualifier. Assuming you have Python 3.7 installed, try changing the " +"first line to ``#! python3.7`` and you should find the 3.7 version " +"information printed." msgstr "" +"Η επανεκτέλεση της εντολής θα πρέπει τώρα να εκτυπώσει τις πιο πρόσφατες " +"πληροφορίες Python 3.x. Όπως και με τα παραπάνω παραδείγματα γραμμής " +"εντολών, μπορείτε να καθορίσετε έναν πιο σαφή προσδιορισμό έκδοσης. " +"Υποθέτοντας ότι έχετε εγκαταστήσει την Python 3.7, δοκιμάστε να αλλάξετε την " +"πρώτη γραμμή σε ``#! python3.7`` και θα πρέπει να βρείτε τυπωμένες τις " +"πληροφορίες της έκδοσης 3.7." -#: using/windows.rst:1093 -msgid "RC_NO_COMMANDLINE" +#: using/windows.rst:1732 +msgid "" +"Note that unlike interactive use, a bare \"python\" will use the latest " +"version of Python 2.x that you have installed. This is for backward " +"compatibility and for compatibility with Unix, where the command ``python`` " +"typically refers to Python 2." msgstr "" +"Λάβετε υπόψη ότι σε αντίθεση με τη διαδραστική χρήση, ένα γυμνό \"python\" " +"θα χρησιμοποιεί την πιο πρόσφατη έκδοση της Python 2.x που έχετε " +"εγκαταστήσει. Αυτή είναι μια συμβατότητα προς τα πίσω και για συμβατότητα " +"με Unix, όπου συνήθως αναφέρεται η εντολή ``python`` στην Python 2." -#: using/windows.rst:1093 -msgid "108" -msgstr "" +#: using/windows.rst:1738 +msgid "From file associations" +msgstr "Από συσχετίσεις αρχείων" -#: using/windows.rst:1093 -msgid "Unable to obtain command line from the operating system." +#: using/windows.rst:1740 +msgid "" +"The launcher should have been associated with Python files (i.e. ``.py``, ``." +"pyw``, ``.pyc`` files) when it was installed. This means that when you " +"double-click on one of these files from Windows explorer the launcher will " +"be used, and therefore you can use the same facilities described above to " +"have the script specify the version which should be used." msgstr "" +"Το πρόγραμμα εκκίνησης θα έπρεπε να είχε συσχετιστεί με αρχεία Python " +"(δηλαδή αρχεία ``.py``, ``.pyw``, ``.pyc``) όταν εγκαταστάθηκε. Αυτό " +"σημαίνει ότι όταν κάνετε διπλό κλικ σε ένα από αυτά τα αρχεία από τον " +"Windows Explorer, το πρόγραμμα εκκίνησης θα χρησιμοποιηθεί και επομένως " +"μπορείτε να χρησιμοποιήσετε τις ίδιες ευκολίες που περιγράφονται παραπάνω " +"για να έχετε το script να καθορίζει ποια έκδοση θα χρησιμοποιηθεί." -#: using/windows.rst:1096 -msgid "RC_NO_PYTHON" +#: using/windows.rst:1746 +msgid "" +"The key benefit of this is that a single launcher can support multiple " +"Python versions at the same time depending on the contents of the first line." msgstr "" +"Το βασικό πλεονέκτημα αυτού είναι ότι ένας μεμονωμένο πρόγραμμα εκκίνησης " +"μπορεί να υποστηρίξει πολλές εκδόσεις Python ταυτόχρονα, ανάλογα με τα " +"περιεχόμενα της πρώτης γραμμής." -#: using/windows.rst:1096 -msgid "103" +#: using/windows.rst:1752 +msgid "" +"If the first line of a script file starts with ``#!``, it is known as a " +"\"shebang\" line. Linux and other Unix like operating systems have native " +"support for such lines and they are commonly used on such systems to " +"indicate how a script should be executed. This launcher allows the same " +"facilities to be used with Python scripts on Windows and the examples above " +"demonstrate their use." msgstr "" +"Εάν η πρώτη γραμμή ενός script αρχείου ξεκινά με ``#!``, είναι γνωστή ως " +"γραμμή \"shebang\". Το Linux και άλλα Unix λειτουργικά συστήματα έχουν " +"εγγενή υποστήριξη για τέτοιες γραμμές και χρησιμοποιούνται συνήθως σε " +"τέτοιες γραμμές συστήματα για να υποδείξουν πως πρέπει να εκτελεστεί ένα " +"script. Αυτό το πρόγραμμα εκκίνησης επιτρέπει τη χρήση των ίδιων " +"εγκαταστάσεων με Python scripts στα Windows και τα παραπάνω παραδείγματα " +"δείχνουν τη χρήση τους." -#: using/windows.rst:1096 -msgid "Unable to locate the requested version." +#: using/windows.rst:1759 +msgid "" +"To allow shebang lines in Python scripts to be portable between Unix and " +"Windows, this launcher supports a number of 'virtual' commands to specify " +"which interpreter to use. The supported virtual commands are:" msgstr "" +"Για να επιτραπεί στις γραμμές shebang σε Python scripts να είναι φορητές " +"μεταξύ Unix και Windows, αυτό το πρόγραμμα εκκίνησης υποστηρίζει έναν αριθμό " +"'εικονικών' εντολών για να καθορίσει ποιος διερμηνέας θα χρησιμοποιηθεί. Οι " +"υποστηριζόμενες εικονικές εντολές είναι:" -#: using/windows.rst:1098 -msgid "RC_NO_VENV_CFG" -msgstr "" +#: using/windows.rst:1763 +msgid "``/usr/bin/env``" +msgstr "``/usr/bin/env``" -#: using/windows.rst:1098 -msgid "106" -msgstr "" +#: using/windows.rst:1764 +msgid "``/usr/bin/python``" +msgstr "``/usr/bin/python``" -#: using/windows.rst:1098 -msgid "A :file:`pyvenv.cfg` was required but not found." -msgstr "" +#: using/windows.rst:1765 +msgid "``/usr/local/bin/python``" +msgstr "``/usr/local/bin/python``" -#: using/windows.rst:1106 -msgid "Finding modules" -msgstr "" +#: using/windows.rst:1766 +msgid "``python``" +msgstr "``python``" -#: using/windows.rst:1108 +#: using/windows.rst:1780 msgid "" -"These notes supplement the description at :ref:`sys-path-init` with detailed " -"Windows notes." +"Any of the above virtual commands can be suffixed with an explicit version " +"(either just the major version, or the major and minor version). Furthermore " +"the 32-bit version can be requested by adding \"-32\" after the minor " +"version. I.e. ``/usr/bin/python3.7-32`` will request usage of the 32-bit " +"Python 3.7. If a virtual environment is active, the version will be ignored " +"and the environment will be used." msgstr "" +"Οποιαδήποτε από τις παραπάνω εικονικές εντολές μπορεί να προστεθεί με μια " +"ρητή έκδοση (είτε μόνο η κύρια έκδοση, είτε η κύρια και δευτερεύουσα " +"έκδοση). Επιπλέον, η έκδοση 32-bit μπορεί να ζητηθεί προσθέτοντας \"-32\" " +"μετά τη δευτερεύουσα έκδοση. Δηλαδή ``/usr/bin/python3.7-32`` θα ζητήσει τη " +"χρήση της python 3.7. Εάν ένα εικονικό περιβάλλον είναι ενεργό, η έκδοση θα " +"αγνοηθεί και θα χρησιμοποιηθεί το περιβάλλον." -#: using/windows.rst:1111 +#: using/windows.rst:1789 msgid "" -"When no ``._pth`` file is found, this is how :data:`sys.path` is populated " -"on Windows:" +"Beginning with python launcher 3.7 it is possible to request 64-bit version " +"by the \"-64\" suffix. Furthermore it is possible to specify a major and " +"architecture without minor (i.e. ``/usr/bin/python3-64``)." msgstr "" +"Ξεκινώντας με το πρόγραμμα εκκίνησης Python 3.7, είναι δυνατό να ζητηθεί η " +"έκδοση 64-bit με το επίθημα \"-64\". Επιπλέον, είναι δυνατό να καθοριστεί " +"μια κύρια έκδοση και μια αρχιτεκτονική χωρίς δευτερεύοντα (δηλαδή ``/usr/" +"bin/python3-64``)." -#: using/windows.rst:1114 +#: using/windows.rst:1795 msgid "" -"An empty entry is added at the start, which corresponds to the current " -"directory." +"The \"-64\" suffix is deprecated, and now implies \"any architecture that is " +"not provably i386/32-bit\". To request a specific environment, use the new :" +"samp:`-V:{TAG}` argument with the complete tag." msgstr "" +"Το επίθημα \"-64\" έχει καταργηθεί, και τώρα υποδηλώνει \"οποιαδήποτε " +"αρχιτεκτονική που δεν είναι αποδεδειγμένα i386/32-bit\". Για να ζητήσετε ένα " +"συγκεκριμένο περιβάλλον, χρησιμοποιήστε το νέο :samp:`-V:{TAG}` όρισμα με " +"την πλήρη ετικέτα." -#: using/windows.rst:1117 +#: using/windows.rst:1801 msgid "" -"If the environment variable :envvar:`PYTHONPATH` exists, as described in :" -"ref:`using-on-envvars`, its entries are added next. Note that on Windows, " -"paths in this variable must be separated by semicolons, to distinguish them " -"from the colon used in drive identifiers (``C:\\`` etc.)." +"Virtual commands referencing ``python`` now prefer an active virtual " +"environment rather than searching :envvar:`PATH`. This handles cases where " +"the shebang specifies ``/usr/bin/env python3`` but :file:`python3.exe` is " +"not present in the active environment." msgstr "" +"Οι εικονικές εντολές που αναφέρονται σε ``python`` προτιμούν πλέον ένα " +"ενεργό εικονικό περιβάλλον αντί να αναζητούν το :envvar:`PATH`. Αυτό " +"χειρίζεται περιπτώσεις όπου το shebang καθορίζει ``/usr/bin/env python3`` " +"αλλά το :file:`python3.exe` δεν υπάρχει στο ενεργό περιβάλλον." -#: using/windows.rst:1122 +#: using/windows.rst:1806 msgid "" -"Additional \"application paths\" can be added in the registry as subkeys of :" -"samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " -"both the ``HKEY_CURRENT_USER`` and ``HKEY_LOCAL_MACHINE`` hives. Subkeys " -"which have semicolon-delimited path strings as their default value will " -"cause each path to be added to :data:`sys.path`. (Note that all known " -"installers only use HKLM, so HKCU is typically empty.)" -msgstr "" - -#: using/windows.rst:1129 +"The ``/usr/bin/env`` form of shebang line has one further special property. " +"Before looking for installed Python interpreters, this form will search the " +"executable :envvar:`PATH` for a Python executable matching the name provided " +"as the first argument. This corresponds to the behaviour of the Unix ``env`` " +"program, which performs a :envvar:`PATH` search. If an executable matching " +"the first argument after the ``env`` command cannot be found, but the " +"argument starts with ``python``, it will be handled as described for the " +"other virtual commands. The environment variable :envvar:`!" +"PYLAUNCHER_NO_SEARCH_PATH` may be set (to any value) to skip this search of :" +"envvar:`PATH`." +msgstr "" +"Η φόρμα ``/usr/bin/env`` της γραμμής shebang έχει μια επιπλέον ειδική " +"ιδιότητα. Πριν αναζητήσετε εγκατεστημένους διερμηνείς Python, αυτή η φόρμα " +"θα αναζητήσει στο εκτελέσιμο αρχείο :envvar:`PATH` για ένα εκτελέσιμο αρχείο " +"Python που ταιριάζει με το όνομα που παρέχεται ως το πρώτο όρισμα. Αυτό " +"αντιστοιχεί στη συμπεριφορά του προγράμματος Unix ``env``, το οποίο εκτελεί " +"μια αναζήτηση :envvar:`PATH`. Εάν δεν μπορεί να βρεθεί ένα εκτελέσιμο αρχείο " +"που ταιριάζει με το πρώτο όρισμα μετά την εντολή ``env``, αλλά το όρισμα " +"ξεκινά με ``python``, ο χειρισμός του θα γίνει όπως περιγράφεται για τις " +"άλλες εικονικές εντολές. Η μεταβλητή περιβάλλοντος :envvar:`!" +"PYLAUNCHER_NO_SEARCH_PATH` μπορεί να οριστεί (σε οποιαδήποτε τιμή) για να " +"παραλείψει αυτήν την αναζήτηση για :envvar:`PATH`." + +#: using/windows.rst:1817 msgid "" -"If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as " -"\"Python Home\". Otherwise, the path of the main Python executable is used " -"to locate a \"landmark file\" (either ``Lib\\os.py`` or ``pythonXY.zip``) to " -"deduce the \"Python Home\". If a Python home is found, the relevant sub-" -"directories added to :data:`sys.path` (``Lib``, ``plat-win``, etc) are based " -"on that folder. Otherwise, the core Python path is constructed from the " -"PythonPath stored in the registry." +"Shebang lines that do not match any of these patterns are looked up in the " +"``[commands]`` section of the launcher's :ref:`.INI file `. " +"This may be used to handle certain commands in a way that makes sense for " +"your system. The name of the command must be a single argument (no spaces in " +"the shebang executable), and the value substituted is the full path to the " +"executable (additional arguments specified in the .INI will be quoted as " +"part of the filename)." msgstr "" +"Οι γραμμές Shebang που δεν ταιριάζουν με κανένα από αυτά τα μοτίβα " +"αναζητούνται στην ενότητα ``[commands]`` του προγράμματος εκκίνησης :ref:`." +"INI file `. Αυτό μπορεί να χρησιμοποιηθεί για τον χειρισμό " +"ορισμένων εντολών με τρόπο που να έχει νόημα για το σύστημά σας. Το όνομα " +"της εντολής πρέπει να είναι ένα μεμονωμένο όρισμα (δεν υπάρχουν κενά στο " +"εκτελέσιμο αρχείο shebang) και η τιμή που αντικαθίσταται είναι η πλήρης " +"διαδρομή προς το εκτελέσιμο (τα πρόσθετα ορίσματα που καθορίζονται στο .INI " +"θα αναφέρονται ως μέρος του ονόματος αρχείου)." -#: using/windows.rst:1137 +#: using/windows.rst:1825 msgid "" -"If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified " -"in the environment, and no registry entries can be found, a default path " -"with relative entries is used (e.g. ``.\\Lib;.\\plat-win``, etc)." +"[commands]\n" +"/bin/xpython=C:\\Program Files\\XPython\\python.exe" msgstr "" +"[commands]\n" +"/bin/xpython=C:\\Program Files\\XPython\\python.exe" -#: using/windows.rst:1141 +#: using/windows.rst:1830 msgid "" -"If a ``pyvenv.cfg`` file is found alongside the main executable or in the " -"directory one level above the executable, the following variations apply:" +"Any commands not found in the .INI file are treated as **Windows** " +"executable paths that are absolute or relative to the directory containing " +"the script file. This is a convenience for Windows-only scripts, such as " +"those generated by an installer, since the behavior is not compatible with " +"Unix-style shells. These paths may be quoted, and may include multiple " +"arguments, after which the path to the script and any additional arguments " +"will be appended." msgstr "" +"Οποιεσδήποτε εντολές που δεν βρίσκονται στο αρχείο .INI αντιμετωπίζονται ως " +"εκτελέσιμες διαδρομές **Windows** που είναι απόλυτες ή σχετικές με τον " +"κατάλογο που περιέχει το script αρχείο. Αυτό είναι μια ευκολία για σενάρια " +"μόνο για Windows, όπως αυτά που δημιουργούνται από ένα πρόγραμμα " +"εγκατάστασης, δεδομένου ότι η συμπεριφορά δεν είναι συμβατή με κελύφη τύπου " +"Unix. Αυτές οι διαδρομές μπορεί να αναφέρονται και μπορεί να περιλαμβάνουν " +"πολλαπλά ορίσματα, μετά τη διαδρομή προς το script και θα προσαρτηθούν τυχόν " +"πρόσθετα ορίσματα." -#: using/windows.rst:1144 +#: using/windows.rst:1839 +msgid "Arguments in shebang lines" +msgstr "Ορίσματα στις γραμμές shebang" + +#: using/windows.rst:1841 msgid "" -"If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " -"path is used instead of the path to the main executable when deducing the " -"home location." +"The shebang lines can also specify additional options to be passed to the " +"Python interpreter. For example, if you have a shebang line:" msgstr "" +"Οι γραμμές shebang μπορούν επίσης να καθορίσουν πρόσθετες επιλογές που θα " +"μεταβιβαστούν στον διερμηνέα Python. Για παράδειγμα, εάν έχετε μια γραμμή " +"shebang:" -#: using/windows.rst:1148 -msgid "The end result of all this is:" -msgstr "" +#: using/windows.rst:1844 +msgid "#! /usr/bin/python -v" +msgstr "#! /usr/bin/python -v" -#: using/windows.rst:1150 -msgid "" -"When running :file:`python.exe`, or any other .exe in the main Python " -"directory (either an installed version, or directly from the PCbuild " -"directory), the core path is deduced, and the core paths in the registry are " -"ignored. Other \"application paths\" in the registry are always read." -msgstr "" +#: using/windows.rst:1848 +msgid "Then Python will be started with the ``-v`` option" +msgstr "Στη συνέχεια, η Python θα ξεκινήσει με την επιλογή ``-v``" -#: using/windows.rst:1155 -msgid "" -"When Python is hosted in another .exe (different directory, embedded via " -"COM, etc), the \"Python Home\" will not be deduced, so the core path from " -"the registry is used. Other \"application paths\" in the registry are " -"always read." -msgstr "" +#: using/windows.rst:1851 +msgid "Customization" +msgstr "Προσαρμογή" -#: using/windows.rst:1159 +#: using/windows.rst:1856 +msgid "Customization via INI files" +msgstr "Προσαρμογή μέσω αρχείων INI" + +#: using/windows.rst:1858 msgid "" -"If Python can't find its home and there are no registry value (frozen .exe, " -"some very strange installation setup) you get a path with some default, but " -"relative, paths." +"Two .ini files will be searched by the launcher - ``py.ini`` in the current " +"user's application data directory (``%LOCALAPPDATA%`` or ``$env:" +"LocalAppData``) and ``py.ini`` in the same directory as the launcher. The " +"same .ini files are used for both the 'console' version of the launcher (i." +"e. py.exe) and for the 'windows' version (i.e. pyw.exe)." msgstr "" +"Θα γίνει αναζήτηση δύο αρχείων .ini από το πρόγραμμα εκκίνησης - ``py.ini`` " +"στον κατάλογο δεδομένων εφαρμογής του τρέχοντος χρήστη (``%LOCALAPPDATA%`` ή " +"``$env:LocalAppData``) και ``py.ini`` στον ίδιο κατάλογο με το πρόγραμμα " +"εκκίνησης. Τα ίδια αρχεία .ini χρησιμοποιούνται τόσο για την έκδοση " +"'κονσόλας' του προγράμματος εκκίνησης (π.χ. py.exe) όσο και για την έκδοση " +"'windows' (δηλ. pyw.exe)." -#: using/windows.rst:1163 +#: using/windows.rst:1864 msgid "" -"For those who want to bundle Python into their application or distribution, " -"the following advice will prevent conflicts with other installations:" +"Customization specified in the \"application directory\" will have " +"precedence over the one next to the executable, so a user, who may not have " +"write access to the .ini file next to the launcher, can override commands in " +"that global .ini file." msgstr "" +"Η προσαρμογή που καθορίζεται στον \"κατάλογο εφαρμογών\" θα έχει " +"προτεραιότητα έναντι αυτής που βρίσκεται δίπλα στο εκτελέσιμο αρχείο, " +"επομένως ένας χρήστης, ο οποίος ενδέχεται να μην έχει πρόσβαση εγγραφής στο " +"αρχείο .ini δίπλα στο πρόγραμμα εκκίνησης, μπορεί να παρακάμψει εντολές σε " +"αυτό το καθολικό .ini αρχείο." -#: using/windows.rst:1166 +#: using/windows.rst:1869 +msgid "Customizing default Python versions" +msgstr "Προσαρμογή προεπιλεγμένων εκδόσεων Python" + +#: using/windows.rst:1871 msgid "" -"Include a ``._pth`` file alongside your executable containing the " -"directories to include. This will ignore paths listed in the registry and " -"environment variables, and also ignore :mod:`site` unless ``import site`` is " -"listed." +"In some cases, a version qualifier can be included in a command to dictate " +"which version of Python will be used by the command. A version qualifier " +"starts with a major version number and can optionally be followed by a " +"period ('.') and a minor version specifier. Furthermore it is possible to " +"specify if a 32 or 64 bit implementation shall be requested by adding " +"\"-32\" or \"-64\"." msgstr "" +"Σε ορισμένες περιπτώσεις, ένας προσδιορισμός έκδοσης μπορεί να συμπεριληφθεί " +"σε μια εντολή για να υπαγορεύσει ποια έκδοση της Python θα χρησιμοποιηθεί " +"από την εντολή. Ένας προσδιοριστής έκδοσης ξεκινά με τον αριθμό κύριας " +"έκδοσης και μπορεί προαιρετικά να ακολουθείται από μια τελεία ('.') και ένας " +"δευτερεύων προσδιοριστής έκδοσης. Επιπλέον, είναι δυνατό να καθοριστεί εάν " +"θα ζητηθεί υλοποίηση 32 ή 64 bit προσθέτοντας \"-32\" ή \"-64\"." -#: using/windows.rst:1171 +#: using/windows.rst:1877 msgid "" -"If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " -"executable, explicitly call :c:func:`Py_SetPath` or (at least) :c:func:" -"`Py_SetProgramName` before :c:func:`Py_Initialize`." +"For example, a shebang line of ``#!python`` has no version qualifier, while " +"``#!python3`` has a version qualifier which specifies only a major version." msgstr "" +"Για παράδειγμα, μια γραμμή shebang του ``#!python`` δεν έχει προσδιοριστικό " +"έκδοσης, ενώ το ``#!python3`` έχει έναν προσδιορισμό έκδοσης που καθορίζει " +"μόνο μια κύρια έκδοση." -#: using/windows.rst:1175 +#: using/windows.rst:1880 msgid "" -"Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " -"before launching :file:`python.exe` from your application." +"If no version qualifiers are found in a command, the environment variable :" +"envvar:`!PY_PYTHON` can be set to specify the default version qualifier. If " +"it is not set, the default is \"3\". The variable can specify any value that " +"may be passed on the command line, such as \"3\", \"3.7\", \"3.7-32\" or " +"\"3.7-64\". (Note that the \"-64\" option is only available with the " +"launcher included with Python 3.7 or newer.)" msgstr "" +"Εάν δεν βρεθούν κριτήρια έκδοσης σε μια εντολή, η μεταβλητή περιβάλλοντος :" +"envvar:`!PY_PYTHON` μπορεί να οριστεί για να καθορίσει τον προσδιορισμό της " +"προεπιλεγμένης έκδοσης. Εάν δεν έχει οριστεί, η προεπιλογή είναι \"3\", " +"\"3.7\", \"3.7-32\" ή \"3.7-64\". (Σημειώστε ότι η επιλογή \"-64\" είναι " +"διαθέσιμη μόνο με το πρόγραμμα εκκίνησης που περιλαμβάνεται στην Python 3.7 " +"ή νεότερη έκδοση.)" -#: using/windows.rst:1178 +#: using/windows.rst:1887 msgid "" -"If you cannot use the previous suggestions (for example, you are a " -"distribution that allows people to run :file:`python.exe` directly), ensure " -"that the landmark file (:file:`Lib\\\\os.py`) exists in your install " -"directory. (Note that it will not be detected inside a ZIP file, but a " -"correctly named ZIP file will be detected instead.)" +"If no minor version qualifiers are found, the environment variable " +"``PY_PYTHON{major}`` (where ``{major}`` is the current major version " +"qualifier as determined above) can be set to specify the full version. If no " +"such option is found, the launcher will enumerate the installed Python " +"versions and use the latest minor release found for the major version, which " +"is likely, although not guaranteed, to be the most recently installed " +"version in that family." msgstr "" +"Εάν δεν βρεθούν περιορισμοί δευτερεύουσας έκδοσης, η μεταβλητή περιβάλλοντος " +"``PY_PYTHON{major}`` (όπου ``{major}`` είναι ο προσδιορισμός της τρέχουσας " +"κύριας έκδοσης όπως προσδιορίζεται παραπάνω) μπορεί να οριστεί για να " +"καθορίσει την πλήρη έκδοση. Εάν όχι αν βρεθεί τέτοια επιλογή, ο εκκινητής θα " +"απαριθμήσει τις εγκατεστημένες εκδόσεις Python και θα χρησιμοποιήσει την πιο " +"πρόσφατη δευτερεύουσα έκδοση που βρέθηκε για την κύρια έκδοση, η οποία είναι " +"πιθανό, αν και δεν είναι εγγυημένη, να είναι η πιο πρόσφατα εγκατεστημένη " +"έκδοση σε αυτήν την οικογένεια." -#: using/windows.rst:1184 +#: using/windows.rst:1895 msgid "" -"These will ensure that the files in a system-wide installation will not take " -"precedence over the copy of the standard library bundled with your " -"application. Otherwise, your users may experience problems using your " -"application. Note that the first suggestion is the best, as the others may " -"still be susceptible to non-standard paths in the registry and user site-" -"packages." +"On 64-bit Windows with both 32-bit and 64-bit implementations of the same " +"(major.minor) Python version installed, the 64-bit version will always be " +"preferred. This will be true for both 32-bit and 64-bit implementations of " +"the launcher - a 32-bit launcher will prefer to execute a 64-bit Python " +"installation of the specified version if available. This is so the behavior " +"of the launcher can be predicted knowing only what versions are installed on " +"the PC and without regard to the order in which they were installed (i.e., " +"without knowing whether a 32 or 64-bit version of Python and corresponding " +"launcher was installed last). As noted above, an optional \"-32\" or \"-64\" " +"suffix can be used on a version specifier to change this behaviour." msgstr "" +"Σε Windows 64-bit με εγκατεστημένες υλοποιήσεις 32-bit και 64-bit της ίδιας " +"(κύριας.δευτερεύουσας) έκδοσης Python, η έκδοση 64-bit θα προτιμάται πάντα. " +"Αυτό θα ισχύει τόσο για 32-bit όσο και για 64-bit υλοποιήσεις του " +"προγράμματος εκκίνησης - ένα πρόγραμμα εκκίνησης 32-bit θα προτιμήσει να " +"εκτελέσει μια εγκατάσταση Python 64-bit της καθορισμένης έκδοσης, εάν είναι " +"διαθέσιμη. Αυτό είναι έτσι, ώστε η συμπεριφορά του προγράμματος εκκίνησης " +"μπορεί να προβλεφθεί γνωρίζοντας μόνο ποιες εκδόσεις είναι εγκατεστημένες " +"στον υπολογιστή και χωρίς να λαμβάνεται υπόψη η σειρά με την οποία " +"εγκαταστάθηκαν (δηλαδή, χωρίς να γνωρίζουμε εάν μια έκδοση 32 ή 64-bit της " +"Python και το αντίστοιχο πρόγραμμα εκκίνησης εγκαταστάθηκε τελευταίο). Όπως " +"σημειώθηκε παραπάνω, ένα προαιρετικό επίθημα \"-32\" ή \"-64\" μπορεί να " +"χρησιμοποιηθεί σε έναν προσδιοριστή έκδοσης για την αλλαγή αυτής της " +"συμπεριφοράς." + +#: using/windows.rst:1906 +msgid "Examples:" +msgstr "Παραδείγματα:" -#: using/windows.rst:1192 +#: using/windows.rst:1908 msgid "" -"Add ``._pth`` file support and removes ``applocal`` option from ``pyvenv." -"cfg``." +"If no relevant options are set, the commands ``python`` and ``python2`` will " +"use the latest Python 2.x version installed and the command ``python3`` will " +"use the latest Python 3.x installed." msgstr "" +"Εάν δεν οριστούν σχετικές επιλογές, οι εντολές ``python`` και ``python2`` θα " +"χρησιμοποιήσουν την πιο πρόσφατη εγκατεστημένη έκδοση Python 2.x και η " +"εντολή ``python3`` θα χρησιμοποιήσει την πιο πρόσφατη εγκατεστημένη Python 3." +"x." -#: using/windows.rst:1197 +#: using/windows.rst:1912 msgid "" -"Add :file:`python{XX}.zip` as a potential landmark when directly adjacent to " -"the executable." +"The command ``python3.7`` will not consult any options at all as the " +"versions are fully specified." msgstr "" +"Η εντολή ``python3.7`` δεν θα συμβουλευτεί καμία απολύτως επιλογή καθώς οι " +"εκδόσεις είναι πλήρως καθορισμένες." -#: using/windows.rst:1202 +#: using/windows.rst:1915 msgid "" -"Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " -"be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " -"finder is enabled on Windows in 3.6.0 and earlier, but may need to be " -"explicitly added to :data:`sys.meta_path` in the future." +"If ``PY_PYTHON=3``, the commands ``python`` and ``python3`` will both use " +"the latest installed Python 3 version." msgstr "" +"Εάν ``PY_PYTHON=3``, οι εντολές ``python`` και ``python3`` θα χρησιμοποιούν " +"και οι δύο την πιο πρόσφατη εγκατεστημένη έκδοση Python 3." -#: using/windows.rst:1208 -msgid "Additional modules" +#: using/windows.rst:1918 +msgid "" +"If ``PY_PYTHON=3.7-32``, the command ``python`` will use the 32-bit " +"implementation of 3.7 whereas the command ``python3`` will use the latest " +"installed Python (PY_PYTHON was not considered at all as a major version was " +"specified.)" msgstr "" +"Εάν ``PY_PYTHON=3.7-32``, η εντολή ``python`` θα χρησιμοποιήσει την " +"υλοποίηση 32-bit του 3.7 ενώ η εντολή ``python3`` θα χρησιμοποιήσει την πιο " +"πρόσφατη εγκατεστημένη Python (Το PY_PYTHON δεν θεωρήθηκε καθόλου καθώς " +"καθορίστηκε μια κύρια έκδοση.)" -#: using/windows.rst:1210 +#: using/windows.rst:1923 msgid "" -"Even though Python aims to be portable among all platforms, there are " -"features that are unique to Windows. A couple of modules, both in the " -"standard library and external, and snippets exist to use these features." +"If ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7``, the commands ``python`` and " +"``python3`` will both use specifically 3.7" msgstr "" +"Εάν ``PY_PYTHON=3`` και ``PY_PYTHON3=3.7``, οι εντολές ``python`` και " +"``python3`` θα χρησιμοποιούν και οι δύο συγκεκριμένα την 3.7" -#: using/windows.rst:1214 +#: using/windows.rst:1926 msgid "" -"The Windows-specific standard modules are documented in :ref:`mswin-specific-" -"services`." +"In addition to environment variables, the same settings can be configured in " +"the .INI file used by the launcher. The section in the INI file is called " +"``[defaults]`` and the key name will be the same as the environment " +"variables without the leading ``PY_`` prefix (and note that the key names in " +"the INI file are case insensitive.) The contents of an environment variable " +"will override things specified in the INI file." msgstr "" +"Εκτός από τις μεταβλητές περιβάλλοντος, οι ίδιες ρυθμίσεις μπορούν να " +"διαμορφωθούν στο αρχείο .INI που χρησιμοποιείται από το πρόγραμμα " +"εκκίνησης. Η ενότητα στο αρχείο INI ονομάζεται ``[defaults]`` και το όνομα " +"του κλειδιού θα είναι το ίδιο με τις μεταβλητές περιβάλλοντος χωρίς το " +"αρχικό πρόθεμα ``PY_`` (και σημειώστε ότι τα ονόματα κλειδιών στο αρχείο INI " +"δεν έχουν διάκριση πεζών-κεφαλαίων.) Τα περιεχόμενα μιας μεταβλητής " +"περιβάλλοντος θα αντικαταστήσουν τα στοιχεία που καθορίζονται στο αρχείο INI." -#: using/windows.rst:1218 -msgid "PyWin32" +#: using/windows.rst:1933 +msgid "For example:" +msgstr "Για παράδειγμα:" + +#: using/windows.rst:1935 +msgid "Setting ``PY_PYTHON=3.7`` is equivalent to the INI file containing:" msgstr "" +"Η ρύθμιση ``PY_PYTHON=3.7`` είναι ισοδύναμη με το αρχείο INI που περιέχει:" -#: using/windows.rst:1220 +#: using/windows.rst:1937 msgid "" -"The `PyWin32 `_ module by Mark Hammond is " -"a collection of modules for advanced Windows-specific support. This " -"includes utilities for:" +"[defaults]\n" +"python=3.7" msgstr "" +"[defaults]\n" +"python=3.7" -#: using/windows.rst:1224 +#: using/windows.rst:1942 msgid "" -"`Component Object Model `_ (COM)" +"Setting ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7`` is equivalent to the INI file " +"containing:" msgstr "" +"Η ρύθμιση ``PY_PYTHON=3`` και ``PY_PYTHON3=3.7`` ισοδυναμεί με το αρχείο INI " +"που περιέχει:" -#: using/windows.rst:1227 -msgid "Win32 API calls" +#: using/windows.rst:1945 +msgid "" +"[defaults]\n" +"python=3\n" +"python3=3.7" msgstr "" +"[defaults]\n" +"python=3\n" +"python3=3.7" -#: using/windows.rst:1228 -msgid "Registry" +#: using/windows.rst:1952 +msgid "Diagnostics" +msgstr "Διαγνωστικά" + +#: using/windows.rst:1954 +msgid "" +"If an environment variable :envvar:`!PYLAUNCHER_DEBUG` is set (to any " +"value), the launcher will print diagnostic information to stderr (i.e. to " +"the console). While this information manages to be simultaneously verbose " +"*and* terse, it should allow you to see what versions of Python were " +"located, why a particular version was chosen and the exact command-line used " +"to execute the target Python. It is primarily intended for testing and " +"debugging." +msgstr "" +"Εάν μια μεταβλητή περιβάλλοντος :envvar:`!PYLAUNCHER_DEBUG` έχει οριστεί (σε " +"οποιαδήποτε τιμή), το πρόγραμμα εκκίνησης θα εκτυπώσει διαγνωστικές " +"πληροφορίες στο stderr (δηλαδή στην κονσόλα). Ενώ αυτές οι πληροφορίες " +"καταφέρνουν να είναι ταυτόχρονα αναλυτικές *και*, θα πρέπει να επιτρέπουν " +"για να δείτε ποιες εκδόσεις της Python εντοπίστηκαν, γιατί επιλέχθηκε μια " +"συγκεκριμένη έκδοση και η ακριβής γραμμή εντολών που χρησιμοποιήθηκε για την " +"εκτέλεση του στόχου Python. Προορίζεται κυρίως για δοκιμή και εντοπισμό " +"σφαλμάτων." + +#: using/windows.rst:1962 +msgid "Dry run" +msgstr "Dry run" + +#: using/windows.rst:1964 +msgid "" +"If an environment variable :envvar:`!PYLAUNCHER_DRYRUN` is set (to any " +"value), the launcher will output the command it would have run, but will not " +"actually launch Python. This may be useful for tools that want to use the " +"launcher to detect and then launch Python directly. Note that the command " +"written to standard output is always encoded using UTF-8, and may not render " +"correctly in the console." msgstr "" +"Εάν μια μεταβλητή περιβάλλοντος :envvar:`!PYLAUNCHER_DRYRUN` έχει οριστεί " +"(σε οποιαδήποτε τιμή), το πρόγραμμα εκκίνησης θα δώσει την εντολή που θα " +"εκτελούσε, αλλά δεν θα εκκινήσει πραγματικά την Python. Αυτό μπορεί να είναι " +"χρήσιμο για εργαλεία που θέλουν να χρησιμοποιήσουν το πρόγραμμα εκκίνησης " +"για να εντοπιστεί και να εκκινηθεί απευθείας η Python. Σημειώστε ότι η " +"εντολή που είναι γραμμένη στην τυπική έξοδο κωδικοποιείται πάντα με χρήση " +"UTF-8 και ενδέχεται να μην αποδίδεται σωστά στην κονσόλα." -#: using/windows.rst:1229 -msgid "Event log" -msgstr "" +#: using/windows.rst:1972 +msgid "Install on demand" +msgstr "Εγκατάσταση κατ' απαίτηση" -#: using/windows.rst:1230 +#: using/windows.rst:1974 msgid "" -"`Microsoft Foundation Classes `_ (MFC) user interfaces" +"If an environment variable :envvar:`!PYLAUNCHER_ALLOW_INSTALL` is set (to " +"any value), and the requested Python version is not installed but is " +"available on the Microsoft Store, the launcher will attempt to install it. " +"This may require user interaction to complete, and you may need to run the " +"command again." msgstr "" +"Εάν μια μεταβλητή περιβάλλοντος :envvar:`!PYLAUNCHER_ALLOW_INSTALL` έχει " +"οριστεί (σε οποιαδήποτε τιμή), και η ζητούμενη έκδοση Python δεν είναι " +"εγκατεστημένη αλλά είναι διαθέσιμη στο Microsoft Store, το πρόγραμμα " +"εκκίνησης θα επιχειρήσει να την εγκαταστήσει. Αυτό μπορεί να απαιτεί την " +"ολοκλήρωση της αλληλεπίδρασης του χρήστη και ίσως χρειαστεί να εκτελέσετε " +"ξανά την εντολή." -#: using/windows.rst:1234 +#: using/windows.rst:1979 msgid "" -"`PythonWin `_ is a sample MFC application shipped with PyWin32. " -"It is an embeddable IDE with a built-in debugger." +"An additional :envvar:`!PYLAUNCHER_ALWAYS_INSTALL` variable causes the " +"launcher to always try to install Python, even if it is detected. This is " +"mainly intended for testing (and should be used with :envvar:`!" +"PYLAUNCHER_DRYRUN`)." msgstr "" +"Μια πρόσθετη μεταβλητή :envvar:`!PYLAUNCHER_ALWAYS_INSTALL` αναγκάζει το " +"πρόγραμμα εκκίνησης να προσπαθεί πάντα να εγκαταστήσει την Python, ακόμα κι " +"αν εντοπιστεί. Αυτό προορίζεται κυρίως για δοκιμή (και θα πρέπει να " +"χρησιμοποιείται με το :envvar:`!PYLAUNCHER_DRYRUN`)." -#: using/windows.rst:1241 +#: using/windows.rst:1984 +msgid "Return codes" +msgstr "Επιστρεφόμενοι κωδικοί" + +#: using/windows.rst:1986 msgid "" -"`Win32 How Do I...? `_" +"The following exit codes may be returned by the Python launcher. " +"Unfortunately, there is no way to distinguish these from the exit code of " +"Python itself." msgstr "" +"Οι ακόλουθοι κωδικοί εξόδου μπορεί να επιστραφούν από τον εκκινητή Python. " +"Δυστυχώς, δεν υπάρχει τρόπος να διακρίνουμε αυτούς από τον κωδικό εξόδου της " +"ίδιας της Python." -#: using/windows.rst:1241 -msgid "by Tim Golden" +#: using/windows.rst:1989 +msgid "" +"The names of codes are as used in the sources, and are only for reference. " +"There is no way to access or resolve them apart from reading this page. " +"Entries are listed in alphabetical order of names." msgstr "" +"Τα ονόματα των κωδικών είναι όπως χρησιμοποιούνται στις πηγές και είναι μόνο " +"για αναφορά. Δεν υπάρχει τρόπος πρόσβασης ή επίλυσης τους εκτός από την " +"ανάγνωση αυτής της σελίδας. Οι καταχωρήσεις παρατίθενται με αλφαβητική σειρά " +"των ονομάτων." -#: using/windows.rst:1243 -msgid "`Python and COM `_" -msgstr "" +#: using/windows.rst:1994 +msgid "Value" +msgstr "Τιμή" -#: using/windows.rst:1244 -msgid "by David and Paul Boddie" -msgstr "" +#: using/windows.rst:1996 +msgid "RC_BAD_VENV_CFG" +msgstr "RC_BAD_VENV_CFG" -#: using/windows.rst:1248 -msgid "cx_Freeze" -msgstr "" +#: using/windows.rst:1996 +msgid "107" +msgstr "107" -#: using/windows.rst:1250 -msgid "" -"`cx_Freeze `_ wraps Python " -"scripts into executable Windows programs (:file:`{*}.exe` files). When you " -"have done this, you can distribute your application without requiring your " -"users to install Python." -msgstr "" +#: using/windows.rst:1996 +msgid "A :file:`pyvenv.cfg` was found but is corrupt." +msgstr "Βρέθηκε ένα :file:`pyvenv.cfg` αλλά είναι κατεστραμμένο." -#: using/windows.rst:1257 -msgid "Compiling Python on Windows" -msgstr "" +#: using/windows.rst:1998 +msgid "RC_CREATE_PROCESS" +msgstr "RC_CREATE_PROCESS" -#: using/windows.rst:1259 -msgid "" -"If you want to compile CPython yourself, first thing you should do is get " -"the `source `_. You can download " -"either the latest release's source or just grab a fresh `checkout `_." -msgstr "" +#: using/windows.rst:1998 +msgid "101" +msgstr "101" -#: using/windows.rst:1264 -msgid "" -"The source tree contains a build solution and project files for Microsoft " -"Visual Studio, which is the compiler used to build the official Python " -"releases. These files are in the :file:`PCbuild` directory." -msgstr "" +#: using/windows.rst:1998 +msgid "Failed to launch Python." +msgstr "Απέτυχε η εκκίνηση της Python." + +#: using/windows.rst:2000 +msgid "RC_INSTALLING" +msgstr "RC_INSTALLING" + +#: using/windows.rst:2000 +msgid "111" +msgstr "111" -#: using/windows.rst:1268 +#: using/windows.rst:2000 msgid "" -"Check :file:`PCbuild/readme.txt` for general information on the build " -"process." +"An install was started, but the command will need to be re-run after it " +"completes." msgstr "" +"Ξεκίνησε μια εγκατάσταση, αλλά η εντολή θα πρέπει να εκτελεστεί ξανά μετά " +"την ολοκλήρωση της." -#: using/windows.rst:1270 -msgid "For extension modules, consult :ref:`building-on-windows`." -msgstr "" +#: using/windows.rst:2003 +msgid "RC_INTERNAL_ERROR" +msgstr "RC_INTERNAL_ERROR" -#: using/windows.rst:1274 -msgid "Other Platforms" -msgstr "" +#: using/windows.rst:2003 +msgid "109" +msgstr "109" -#: using/windows.rst:1276 -msgid "" -"With ongoing development of Python, some platforms that used to be supported " -"earlier are no longer supported (due to the lack of users or developers). " -"Check :pep:`11` for details on all unsupported platforms." -msgstr "" +#: using/windows.rst:2003 +msgid "Unexpected error. Please report a bug." +msgstr "Απροσδόκητο σφάλμα. Αναφέρετε ένα σφάλμα." -#: using/windows.rst:1280 -msgid "" -"`Windows CE `_ is `no longer supported " -"`__ since Python 3 (if it " -"ever was)." -msgstr "" +#: using/windows.rst:2005 +msgid "RC_NO_COMMANDLINE" +msgstr "RC_NO_COMMANDLINE" -#: using/windows.rst:1283 -msgid "" -"The `Cygwin `_ installer offers to install the `Python " -"interpreter `__ as well" -msgstr "" +#: using/windows.rst:2005 +msgid "108" +msgstr "108" -#: using/windows.rst:1287 -msgid "" -"See `Python for Windows `_ for " -"detailed information about platforms with pre-compiled installers." +#: using/windows.rst:2005 +msgid "Unable to obtain command line from the operating system." msgstr "" +"Δεν είναι δυνατή η λήψη της γραμμής εντολών από το λειτουργικό σύστημα." + +#: using/windows.rst:2008 +msgid "RC_NO_PYTHON" +msgstr "RC_NO_PYTHON" + +#: using/windows.rst:2008 +msgid "103" +msgstr "103" + +#: using/windows.rst:2008 +msgid "Unable to locate the requested version." +msgstr "Δεν είναι δυνατός ο εντοπισμός της ζητούμενης έκδοσης." + +#: using/windows.rst:2010 +msgid "RC_NO_VENV_CFG" +msgstr "RC_NO_VENV_CFG" + +#: using/windows.rst:2010 +msgid "106" +msgstr "106" + +#: using/windows.rst:2010 +msgid "A :file:`pyvenv.cfg` was required but not found." +msgstr "Απαιτήθηκε ένα :file:`pyvenv.cfg` αλλά δεν βρέθηκε." + +#~ msgid "``PYTHON_MANAGER_DEFAULT``" +#~ msgstr "``PYTHON_MANAGER_DEFAULT``" + +#~ msgid "(Experimental)" +#~ msgstr "(Πειραματικό)" + +#~ msgid "" +#~ "Everything described in this section is considered experimental, and " +#~ "should be expected to change in future releases." +#~ msgstr "" +#~ "Όλα όσα περιγράφονται σε αυτήν την ενότητα θεωρούνται πειραματικά και θα " +#~ "πρέπει να αναμένονται να αλλάξουν σε μελλοντικές εκδόσεις." + +#~ msgid "" +#~ "το ``py`` gives me a \"command not found\" error when I type it in my " +#~ "terminal." +#~ msgstr "" +#~ "το ``py`` μου δίνει σφάλμα \"command not found\" όταν το πληκτρολογώ στο " +#~ "τερματικό μου." + +#~ msgid "" +#~ "Click Start, open \"Manage app execution aliases\", and check that the " +#~ "aliases for \"Python install manager\" are enabled. If they already are, " +#~ "try disabling and re-enabling to refresh the command. The \"Python " +#~ "(default windowed)\" and \"Python install manager\" commands may also " +#~ "need refreshing." +#~ msgstr "" +#~ "Κάντε κλικ στο Έναρξη, ανοίξτε το \"Διαχείριση εκτέλεσης εφαρμογών\" και " +#~ "ελέγξτε ότι τα aliases για το \"Python install manager\" είναι " +#~ "ενεργοποιημένα. Εάν ήδη είναι, δοκιμάστε να τα απενεργοποιήσετε και να τα " +#~ "ενεργοποιήσετε ξανά για να ανανεώσετε την εντολή. Οι εντολές \"Python " +#~ "(default windowed)\" και \"Python install manager\" ενδέχεται επίσης να " +#~ "χρειάζονται ανανέωση." + +#~ msgid "Shebang Lines" +#~ msgstr "Γραμμές Shebang" diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index 6ef88918..38e32c5b 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -331,10 +332,31 @@ msgid "" "encoding it as UTF-8::" msgstr "" +#: whatsnew/2.0.rst:232 +msgid "" +"import codecs\n" +"\n" +"unistr = u'\\u0660\\u2000ab ...'\n" +"\n" +"(UTF8_encode, UTF8_decode,\n" +" UTF8_streamreader, UTF8_streamwriter) = codecs.lookup('UTF-8')\n" +"\n" +"output = UTF8_streamwriter( open( '/tmp/output', 'wb') )\n" +"output.write( unistr )\n" +"output.close()" +msgstr "" + #: whatsnew/2.0.rst:243 msgid "The following code would then read UTF-8 input from the file::" msgstr "" +#: whatsnew/2.0.rst:245 +msgid "" +"input = UTF8_streamreader( open( '/tmp/output', 'rb') )\n" +"print repr(input.read())\n" +"input.close()" +msgstr "" + #: whatsnew/2.0.rst:249 msgid "" "Unicode-aware regular expressions are available through the :mod:`re` " @@ -377,6 +399,15 @@ msgid "" "substring. You could write the following to do it::" msgstr "" +#: whatsnew/2.0.rst:280 +msgid "" +"# Given the list L, make a list of all strings\n" +"# containing the substring S.\n" +"sublist = filter( lambda s, substring=S:\n" +" string.find(s, substring) != -1,\n" +" L)" +msgstr "" + #: whatsnew/2.0.rst:286 msgid "" "Because of Python's scoping rules, a default argument is used so that the " @@ -384,10 +415,22 @@ msgid "" "substring is being searched for. List comprehensions make this cleaner::" msgstr "" +#: whatsnew/2.0.rst:290 +msgid "sublist = [ s for s in L if string.find(s, S) != -1 ]" +msgstr "" + #: whatsnew/2.0.rst:292 msgid "List comprehensions have the form::" msgstr "" +#: whatsnew/2.0.rst:294 +msgid "" +"[ expression for expr in sequence1\n" +" for expr2 in sequence2 ...\n" +" for exprN in sequenceN\n" +" if condition ]" +msgstr "" + #: whatsnew/2.0.rst:299 msgid "" "The :keyword:`!for`...\\ :keyword:`!in` clauses contain the sequences to be " @@ -405,6 +448,18 @@ msgid "" "following Python code::" msgstr "" +#: whatsnew/2.0.rst:310 +msgid "" +"for expr1 in sequence1:\n" +" for expr2 in sequence2:\n" +" ...\n" +" for exprN in sequenceN:\n" +" if (condition):\n" +" # Append the value of\n" +" # the expression to the\n" +" # resulting list." +msgstr "" + #: whatsnew/2.0.rst:319 msgid "" "This means that when there are multiple :keyword:`!for`...\\ :keyword:`!in` " @@ -413,6 +468,15 @@ msgid "" "elements long::" msgstr "" +#: whatsnew/2.0.rst:324 +msgid "" +"seq1 = 'abc'\n" +"seq2 = (1,2,3)\n" +">>> [ (x,y) for x in seq1 for y in seq2]\n" +"[('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3), ('c', 1),\n" +"('c', 2), ('c', 3)]" +msgstr "" + #: whatsnew/2.0.rst:330 msgid "" "To avoid introducing an ambiguity into Python's grammar, if *expression* is " @@ -420,6 +484,14 @@ msgid "" "comprehension below is a syntax error, while the second one is correct::" msgstr "" +#: whatsnew/2.0.rst:334 +msgid "" +"# Syntax error\n" +"[ x,y for x in seq1 for y in seq2]\n" +"# Correct\n" +"[ (x,y) for x in seq1 for y in seq2]" +msgstr "" + #: whatsnew/2.0.rst:339 msgid "" "The idea of list comprehensions originally comes from the functional " @@ -452,6 +524,19 @@ msgid "" "create a new instance with an incremented value." msgstr "" +#: whatsnew/2.0.rst:367 +msgid "" +"class Number:\n" +" def __init__(self, value):\n" +" self.value = value\n" +" def __iadd__(self, increment):\n" +" return Number( self.value + increment)\n" +"\n" +"n = Number(5)\n" +"n += 3\n" +"print n.value" +msgstr "" + #: whatsnew/2.0.rst:377 msgid "" "The :meth:`!__iadd__` special method is called with the value of the " @@ -490,6 +575,16 @@ msgid "" "and Unicode strings. ::" msgstr "" +#: whatsnew/2.0.rst:404 +msgid "" +">>> 'andrew'.capitalize()\n" +"'Andrew'\n" +">>> 'hostname'.replace('os', 'linux')\n" +"'hlinuxtname'\n" +">>> 'moshe'.find('sh')\n" +"2" +msgstr "" + #: whatsnew/2.0.rst:411 msgid "" "One thing that hasn't changed, a noteworthy April Fools' joke " @@ -551,6 +646,12 @@ msgid "" "reference to itself::" msgstr "" +#: whatsnew/2.0.rst:452 +msgid "" +"instance = SomeClass()\n" +"instance.myself = instance" +msgstr "" + #: whatsnew/2.0.rst:455 msgid "" "After the above two lines of code have been executed, the reference count of " @@ -631,6 +732,14 @@ msgid "" "the syntax for defining functions::" msgstr "" +#: whatsnew/2.0.rst:513 +msgid "" +"def f(*args, **kw):\n" +" # args is a tuple of positional args,\n" +" # kw is a dictionary of keyword args\n" +" ..." +msgstr "" + #: whatsnew/2.0.rst:518 msgid "" "The ``print`` statement can now have its output directed to a file-like " @@ -642,6 +751,10 @@ msgid "" "standard error, it's much easier to write this::" msgstr "" +#: whatsnew/2.0.rst:526 +msgid "print >> sys.stderr, \"Warning: action field not supplied\"" +msgstr "" + #: whatsnew/2.0.rst:528 msgid "" "Modules can now be renamed on importing them, using the syntax ``import " @@ -681,6 +794,14 @@ msgid "" "useful result instead. For example, after this code::" msgstr "" +#: whatsnew/2.0.rst:554 +msgid "" +"a = []\n" +"b = []\n" +"a.append(a)\n" +"b.append(b)" +msgstr "" + #: whatsnew/2.0.rst:559 msgid "" "The comparison ``a==b`` returns true, because the two recursive data " @@ -723,6 +844,14 @@ msgid "" "raised should still work. ::" msgstr "" +#: whatsnew/2.0.rst:590 +msgid "" +"def f():\n" +" print \"i=\",i\n" +" i = i + 1\n" +"f()" +msgstr "" + #: whatsnew/2.0.rst:595 msgid "" "Two new exceptions, :exc:`TabError` and :exc:`IndentationError`, have been " @@ -771,6 +900,14 @@ msgid "" "*key*. Thus, the following lines of code::" msgstr "" +#: whatsnew/2.0.rst:628 +msgid "" +"if dict.has_key( key ): return dict[key]\n" +"else:\n" +" dict[key] = []\n" +" return dict[key]" +msgstr "" + #: whatsnew/2.0.rst:633 msgid "" "can be reduced to a single ``return dict.setdefault(key, [])`` statement." @@ -806,15 +943,15 @@ msgid "" "The change which will probably break the most code is tightening up the " "arguments accepted by some methods. Some methods would take multiple " "arguments and treat them as a tuple, particularly various list methods such " -"as :meth:`!append` and :meth:`!insert`. In earlier versions of Python, if " -"``L`` is a list, ``L.append( 1,2 )`` appends the tuple ``(1,2)`` to the " -"list. In Python 2.0 this causes a :exc:`TypeError` exception to be raised, " -"with the message: 'append requires exactly 1 argument; 2 given'. The fix is " -"to simply add an extra set of parentheses to pass both values as a tuple: " -"``L.append( (1,2) )``." +"as :meth:`~list.append` and :meth:`~list.insert`. In earlier versions of " +"Python, if ``L`` is a list, ``L.append( 1,2 )`` appends the tuple ``(1,2)`` " +"to the list. In Python 2.0 this causes a :exc:`TypeError` exception to be " +"raised, with the message: 'append requires exactly 1 argument; 2 given'. " +"The fix is to simply add an extra set of parentheses to pass both values as " +"a tuple: ``L.append( (1,2) )``." msgstr "" -#: whatsnew/2.0.rst:665 +#: whatsnew/2.0.rst:666 msgid "" "The earlier versions of these methods were more forgiving because they used " "an old function in Python's C interface to parse their arguments; 2.0 " @@ -826,7 +963,7 @@ msgid "" "this isn't recommended." msgstr "" -#: whatsnew/2.0.rst:673 +#: whatsnew/2.0.rst:674 msgid "" "Some of the functions in the :mod:`socket` module are still forgiving in " "this way. For example, ``socket.connect( ('hostname', 25) )`` is the " @@ -842,7 +979,7 @@ msgid "" "version." msgstr "" -#: whatsnew/2.0.rst:684 +#: whatsnew/2.0.rst:685 msgid "" "The ``\\x`` escape in string literals now takes exactly 2 hex digits. " "Previously it would consume all the hex digits following the 'x' and take " @@ -850,7 +987,7 @@ msgid "" "``\\x56``." msgstr "" -#: whatsnew/2.0.rst:688 +#: whatsnew/2.0.rst:689 msgid "" "The :exc:`AttributeError` and :exc:`NameError` exceptions have a more " "friendly error message, whose text will be something like ``'Spam' instance " @@ -859,7 +996,7 @@ msgid "" "to take advantage of this fact will break in 2.0." msgstr "" -#: whatsnew/2.0.rst:694 +#: whatsnew/2.0.rst:695 msgid "" "Some work has been done to make integers and long integers a bit more " "interchangeable. In 1.5.2, large-file support was added for Solaris, to " @@ -876,7 +1013,7 @@ msgid "" "2L**64`` will produce the string ``18446744073709551616``." msgstr "" -#: whatsnew/2.0.rst:708 +#: whatsnew/2.0.rst:709 msgid "" "The subtlest long integer change of all is that the :func:`str` of a long " "integer no longer has a trailing 'L' character, though :func:`repr` still " @@ -887,7 +1024,7 @@ msgid "" "the final digit." msgstr "" -#: whatsnew/2.0.rst:716 +#: whatsnew/2.0.rst:717 msgid "" "Taking the :func:`repr` of a float now uses a different formatting precision " "than :func:`str`. :func:`repr` uses ``%.17g`` format string for C's :func:`!" @@ -898,7 +1035,7 @@ msgid "" "``'8.1'``." msgstr "" -#: whatsnew/2.0.rst:724 +#: whatsnew/2.0.rst:725 msgid "" "The ``-X`` command-line option, which turned all standard exceptions into " "strings instead of classes, has been removed; the standard exceptions will " @@ -907,11 +1044,11 @@ msgid "" "written by Barry Warsaw and Fredrik Lundh." msgstr "" -#: whatsnew/2.0.rst:740 +#: whatsnew/2.0.rst:741 msgid "Extending/Embedding Changes" msgstr "" -#: whatsnew/2.0.rst:742 +#: whatsnew/2.0.rst:743 msgid "" "Some of the changes are under the covers, and will only be apparent to " "people writing C extension modules or embedding a Python interpreter in a " @@ -919,7 +1056,7 @@ msgid "" "safely skip this section." msgstr "" -#: whatsnew/2.0.rst:747 +#: whatsnew/2.0.rst:748 msgid "" "The version number of the Python C API was incremented, so C extensions " "compiled for 1.5.2 must be recompiled in order to work with 2.0. On " @@ -928,7 +1065,7 @@ msgid "" "exception and the import will fail." msgstr "" -#: whatsnew/2.0.rst:753 +#: whatsnew/2.0.rst:754 msgid "" "Users of Jim Fulton's ExtensionClass module will be pleased to find out that " "hooks have been added so that ExtensionClasses are now supported by :func:" @@ -937,7 +1074,7 @@ msgid "" "use the more natural ``if isinstance(obj, myExtensionClass)``." msgstr "" -#: whatsnew/2.0.rst:759 +#: whatsnew/2.0.rst:760 msgid "" "The :file:`Python/importdl.c` file, which was a mass of #ifdefs to support " "dynamic loading on many different platforms, was cleaned up and reorganised " @@ -948,7 +1085,7 @@ msgid "" "into a single file, :file:`Include/pyport.h`." msgstr "" -#: whatsnew/2.0.rst:767 +#: whatsnew/2.0.rst:768 msgid "" "Vladimir Marangozov's long-awaited malloc restructuring was completed, to " "make it easy to have the Python interpreter use a custom allocator instead " @@ -958,7 +1095,7 @@ msgid "" "archives of the 'patches' and 'python-dev' lists at python.org." msgstr "" -#: whatsnew/2.0.rst:774 +#: whatsnew/2.0.rst:775 msgid "" "Recent versions of the GUSI development environment for MacOS support POSIX " "threads. Therefore, Python's POSIX threading support now works on the " @@ -966,7 +1103,7 @@ msgid "" "also contributed." msgstr "" -#: whatsnew/2.0.rst:779 +#: whatsnew/2.0.rst:780 msgid "" "Threading support on Windows was enhanced, too. Windows supports thread " "locks that use kernel objects only in case of contention; in the common case " @@ -976,14 +1113,14 @@ msgid "" "These improvements were contributed by Yakov Markovitch." msgstr "" -#: whatsnew/2.0.rst:786 +#: whatsnew/2.0.rst:787 msgid "" "Python 2.0's source now uses only ANSI C prototypes, so compiling Python now " "requires an ANSI C compiler, and can no longer be done using a compiler that " "only supports K&R C." msgstr "" -#: whatsnew/2.0.rst:790 +#: whatsnew/2.0.rst:791 msgid "" "Previously the Python virtual machine used 16-bit numbers in its bytecode, " "limiting the size of source files. In particular, this affected the maximum " @@ -992,7 +1129,7 @@ msgid "" "Charles G. Waldman raises the limit from ``2**16`` to ``2**32``." msgstr "" -#: whatsnew/2.0.rst:796 +#: whatsnew/2.0.rst:797 msgid "" "Three new convenience functions intended for adding constants to a module's " "dictionary at module initialization time were added: :c:func:" @@ -1003,18 +1140,18 @@ msgid "" "argument is, respectively, a Python object, a C long, or a C string." msgstr "" -#: whatsnew/2.0.rst:804 +#: whatsnew/2.0.rst:805 msgid "" "A wrapper API was added for Unix-style signal handlers. :c:func:" "`PyOS_getsig` gets a signal handler and :c:func:`PyOS_setsig` will set a new " "handler." msgstr "" -#: whatsnew/2.0.rst:811 +#: whatsnew/2.0.rst:812 msgid "Distutils: Making Modules Easy to Install" msgstr "" -#: whatsnew/2.0.rst:813 +#: whatsnew/2.0.rst:814 msgid "" "Before Python 2.0, installing modules was a tedious affair -- there was no " "way to figure out automatically where Python is installed, or what compiler " @@ -1026,7 +1163,7 @@ msgid "" "something of a chore." msgstr "" -#: whatsnew/2.0.rst:821 +#: whatsnew/2.0.rst:822 msgid "" "The SIG for distribution utilities, shepherded by Greg Ward, has created the " "Distutils, a system to make package installation much easier. They form the " @@ -1042,26 +1179,56 @@ msgid "" "directories, and more." msgstr "" -#: whatsnew/2.0.rst:833 +#: whatsnew/2.0.rst:834 msgid "" "In order to use the Distutils, you need to write a :file:`setup.py` script. " "For the simple case, when the software contains only .py files, a minimal :" "file:`setup.py` can be just a few lines long::" msgstr "" -#: whatsnew/2.0.rst:841 +#: whatsnew/2.0.rst:838 +msgid "" +"from distutils.core import setup\n" +"setup (name = \"foo\", version = \"1.0\",\n" +" py_modules = [\"module1\", \"module2\"])" +msgstr "" + +#: whatsnew/2.0.rst:842 msgid "" "The :file:`setup.py` file isn't much more complicated if the software " "consists of a few packages::" msgstr "" -#: whatsnew/2.0.rst:848 +#: whatsnew/2.0.rst:845 +msgid "" +"from distutils.core import setup\n" +"setup (name = \"foo\", version = \"1.0\",\n" +" packages = [\"package\", \"package.subpackage\"])" +msgstr "" + +#: whatsnew/2.0.rst:849 msgid "" "A C extension can be the most complicated case; here's an example taken from " "the PyXML package::" msgstr "" -#: whatsnew/2.0.rst:864 +#: whatsnew/2.0.rst:852 +msgid "" +"from distutils.core import setup, Extension\n" +"\n" +"expat_extension = Extension('xml.parsers.pyexpat',\n" +" define_macros = [('XML_NS', None)],\n" +" include_dirs = [ 'extensions/expat/xmltok',\n" +" 'extensions/expat/xmlparse' ],\n" +" sources = [ 'extensions/pyexpat.c',\n" +" 'extensions/expat/xmltok/xmltok.c',\n" +" 'extensions/expat/xmltok/xmlrole.c', ]\n" +" )\n" +"setup (name = \"PyXML\", version = \"0.5.4\",\n" +" ext_modules =[ expat_extension ] )" +msgstr "" + +#: whatsnew/2.0.rst:865 msgid "" "The Distutils can also take care of creating source and binary " "distributions. The \"sdist\" command, run by \"``python setup.py sdist``', " @@ -1073,17 +1240,17 @@ msgid "" "are in various stages of development." msgstr "" -#: whatsnew/2.0.rst:873 +#: whatsnew/2.0.rst:874 msgid "" "All this is documented in a new manual, *Distributing Python Modules*, that " "joins the basic set of Python documentation." msgstr "" -#: whatsnew/2.0.rst:880 +#: whatsnew/2.0.rst:881 msgid "XML Modules" msgstr "" -#: whatsnew/2.0.rst:882 +#: whatsnew/2.0.rst:883 msgid "" "Python 1.5.2 included a simple XML parser in the form of the :mod:`!xmllib` " "module, contributed by Sjoerd Mullender. Since 1.5.2's release, two " @@ -1098,11 +1265,11 @@ msgid "" "also working on improved documentation." msgstr "" -#: whatsnew/2.0.rst:896 +#: whatsnew/2.0.rst:897 msgid "SAX2 Support" msgstr "" -#: whatsnew/2.0.rst:898 +#: whatsnew/2.0.rst:899 msgid "" "SAX defines an event-driven interface for parsing XML. To use SAX, you must " "write a SAX handler class. Handler classes inherit from various classes " @@ -1114,7 +1281,7 @@ msgid "" "chunk of character data, and so forth." msgstr "" -#: whatsnew/2.0.rst:906 +#: whatsnew/2.0.rst:907 msgid "" "The advantage of the event-driven approach is that the whole document " "doesn't have to be resident in memory at any one time, which matters if you " @@ -1123,24 +1290,46 @@ msgid "" "structure in some elaborate way." msgstr "" -#: whatsnew/2.0.rst:912 +#: whatsnew/2.0.rst:913 msgid "" "For example, this little example program defines a handler that prints a " "message for every starting and ending tag, and then parses the file :file:" "`hamlet.xml` using it::" msgstr "" -#: whatsnew/2.0.rst:935 +#: whatsnew/2.0.rst:917 +msgid "" +"from xml import sax\n" +"\n" +"class SimpleHandler(sax.ContentHandler):\n" +" def startElement(self, name, attrs):\n" +" print 'Start of element:', name, attrs.keys()\n" +"\n" +" def endElement(self, name):\n" +" print 'End of element:', name\n" +"\n" +"# Create a parser object\n" +"parser = sax.make_parser()\n" +"\n" +"# Tell it what handler to use\n" +"handler = SimpleHandler()\n" +"parser.setContentHandler( handler )\n" +"\n" +"# Parse a file!\n" +"parser.parse( 'hamlet.xml' )" +msgstr "" + +#: whatsnew/2.0.rst:936 msgid "" "For more information, consult the Python documentation, or the XML HOWTO at " "https://pyxml.sourceforge.net/topics/howto/xml-howto.html." msgstr "" -#: whatsnew/2.0.rst:940 +#: whatsnew/2.0.rst:941 msgid "DOM Support" msgstr "" -#: whatsnew/2.0.rst:942 +#: whatsnew/2.0.rst:943 msgid "" "The Document Object Model is a tree-based representation for an XML " "document. A top-level :class:`!Document` instance is the root of the tree, " @@ -1152,7 +1341,7 @@ msgid "" "the tree back into XML." msgstr "" -#: whatsnew/2.0.rst:950 +#: whatsnew/2.0.rst:951 msgid "" "The DOM is useful for modifying XML documents, because you can create a DOM " "tree, modify it by adding new nodes or rearranging subtrees, and then " @@ -1162,7 +1351,7 @@ msgid "" "file." msgstr "" -#: whatsnew/2.0.rst:956 +#: whatsnew/2.0.rst:957 msgid "" "The DOM implementation included with Python lives in the :mod:`xml.dom." "minidom` module. It's a lightweight implementation of the Level 1 DOM with " @@ -1170,7 +1359,13 @@ msgid "" "convenience functions are provided for generating a DOM tree::" msgstr "" -#: whatsnew/2.0.rst:964 +#: whatsnew/2.0.rst:962 +msgid "" +"from xml.dom import minidom\n" +"doc = minidom.parse('hamlet.xml')" +msgstr "" + +#: whatsnew/2.0.rst:965 msgid "" "``doc`` is a :class:`!Document` instance. :class:`!Document`, like all the " "other DOM classes such as :class:`!Element` and :class:`Text`, is a subclass " @@ -1182,28 +1377,56 @@ msgid "" "with a given tag name. Continuing from the previous 2-line example::" msgstr "" -#: whatsnew/2.0.rst:977 +#: whatsnew/2.0.rst:974 +msgid "" +"perslist = doc.getElementsByTagName( 'PERSONA' )\n" +"print perslist[0].toxml()\n" +"print perslist[1].toxml()" +msgstr "" + +#: whatsnew/2.0.rst:978 msgid "For the *Hamlet* XML file, the above few lines output::" msgstr "" -#: whatsnew/2.0.rst:982 +#: whatsnew/2.0.rst:980 +msgid "" +"CLAUDIUS, king of Denmark. \n" +"HAMLET, son to the late, and nephew to the present king." +msgstr "" + +#: whatsnew/2.0.rst:983 msgid "" "The root element of the document is available as ``doc.documentElement``, " "and its children can be easily modified by deleting, adding, or removing " "nodes::" msgstr "" -#: whatsnew/2.0.rst:997 +#: whatsnew/2.0.rst:986 +msgid "" +"root = doc.documentElement\n" +"\n" +"# Remove the first child\n" +"root.removeChild( root.childNodes[0] )\n" +"\n" +"# Move the new first child to the end\n" +"root.appendChild( root.childNodes[0] )\n" +"\n" +"# Insert the new first child (originally,\n" +"# the third child) before the 20th child.\n" +"root.insertBefore( root.childNodes[0], root.childNodes[20] )" +msgstr "" + +#: whatsnew/2.0.rst:998 msgid "" "Again, I will refer you to the Python documentation for a complete listing " "of the different :class:`!Node` classes and their various methods." msgstr "" -#: whatsnew/2.0.rst:1002 +#: whatsnew/2.0.rst:1003 msgid "Relationship to PyXML" msgstr "" -#: whatsnew/2.0.rst:1004 +#: whatsnew/2.0.rst:1005 msgid "" "The XML Special Interest Group has been working on XML-related Python code " "for a while. Its code distribution, called PyXML, is available from the " @@ -1213,7 +1436,7 @@ msgid "" "compatibility with the 2.0 :mod:`xml` package." msgstr "" -#: whatsnew/2.0.rst:1010 +#: whatsnew/2.0.rst:1011 msgid "" "The answer is that Python 2.0's :mod:`xml` package isn't compatible with " "PyXML, but can be made compatible by installing a recent version PyXML. " @@ -1225,33 +1448,33 @@ msgid "" "features. Some of the additional features in PyXML include:" msgstr "" -#: whatsnew/2.0.rst:1019 +#: whatsnew/2.0.rst:1020 msgid "4DOM, a full DOM implementation from FourThought, Inc." msgstr "" -#: whatsnew/2.0.rst:1021 +#: whatsnew/2.0.rst:1022 msgid "The xmlproc validating parser, written by Lars Marius Garshol." msgstr "" -#: whatsnew/2.0.rst:1023 +#: whatsnew/2.0.rst:1024 msgid "The :mod:`!sgmlop` parser accelerator module, written by Fredrik Lundh." msgstr "" -#: whatsnew/2.0.rst:1029 +#: whatsnew/2.0.rst:1030 msgid "Module changes" msgstr "" -#: whatsnew/2.0.rst:1031 +#: whatsnew/2.0.rst:1032 msgid "" "Lots of improvements and bugfixes were made to Python's extensive standard " "library; some of the affected modules include :mod:`readline`, :mod:" -"`ConfigParser `, :mod:`cgi`, :mod:`calendar`, :mod:`posix`, :" -"mod:`readline`, :mod:`!xmllib`, :mod:`aifc`, :mod:`chunk` :mod:`wave`, :mod:" -"`random`, :mod:`shelve`, and :mod:`nntplib`. Consult the CVS logs for the " -"exact patch-by-patch details." +"`ConfigParser `, :mod:`!cgi`, :mod:`calendar`, :mod:`posix`, :" +"mod:`readline`, :mod:`!xmllib`, :mod:`!aifc`, :mod:`!chunk`, :mod:`wave`, :" +"mod:`random`, :mod:`shelve`, and :mod:`!nntplib`. Consult the CVS logs for " +"the exact patch-by-patch details." msgstr "" -#: whatsnew/2.0.rst:1037 +#: whatsnew/2.0.rst:1038 msgid "" "Brian Gallew contributed OpenSSL support for the :mod:`socket` module. " "OpenSSL is an implementation of the Secure Socket Layer, which encrypts the " @@ -1263,20 +1486,20 @@ msgid "" "though no one has implemented FTP or SMTP over SSL." msgstr "" -#: whatsnew/2.0.rst:1046 +#: whatsnew/2.0.rst:1047 msgid "" "The :mod:`httplib ` module has been rewritten by Greg Stein to support " "HTTP/1.1." msgstr "" -#: whatsnew/2.0.rst:1048 +#: whatsnew/2.0.rst:1049 msgid "" "Backward compatibility with the 1.5 version of :mod:`!httplib` is provided, " "though using HTTP/1.1 features such as pipelining will require rewriting " "code to use a different set of interfaces." msgstr "" -#: whatsnew/2.0.rst:1052 +#: whatsnew/2.0.rst:1053 msgid "" "The :mod:`!Tkinter` module now supports Tcl/Tk version 8.1, 8.2, or 8.3, and " "support for the older 7.x versions has been dropped. The Tkinter module now " @@ -1285,7 +1508,7 @@ msgid "" "``create_polygon`` much faster, especially when using lots of coordinates." msgstr "" -#: whatsnew/2.0.rst:1058 +#: whatsnew/2.0.rst:1059 msgid "" "The :mod:`curses` module has been greatly extended, starting from Oliver " "Andrich's enhanced version, to provide many additional functions from " @@ -1295,7 +1518,7 @@ msgid "" "currently maintained OSes that fall into this category." msgstr "" -#: whatsnew/2.0.rst:1065 +#: whatsnew/2.0.rst:1066 msgid "" "As mentioned in the earlier discussion of 2.0's Unicode support, the " "underlying implementation of the regular expressions provided by the :mod:" @@ -1304,18 +1527,18 @@ msgid "" "against both 8-bit strings and Unicode strings." msgstr "" -#: whatsnew/2.0.rst:1075 +#: whatsnew/2.0.rst:1076 msgid "New modules" msgstr "" -#: whatsnew/2.0.rst:1077 +#: whatsnew/2.0.rst:1078 msgid "" "A number of new modules were added. We'll simply list them with brief " "descriptions; consult the 2.0 documentation for the details of a particular " "module." msgstr "" -#: whatsnew/2.0.rst:1081 +#: whatsnew/2.0.rst:1082 msgid "" ":mod:`atexit`: For registering functions to be called before the Python " "interpreter exits. Code that currently sets ``sys.exitfunc`` directly should " @@ -1324,20 +1547,20 @@ msgid "" "(Contributed by Skip Montanaro.)" msgstr "" -#: whatsnew/2.0.rst:1087 +#: whatsnew/2.0.rst:1088 msgid "" ":mod:`codecs`, :mod:`!encodings`, :mod:`unicodedata`: Added as part of the " "new Unicode support." msgstr "" -#: whatsnew/2.0.rst:1090 +#: whatsnew/2.0.rst:1091 msgid "" ":mod:`filecmp`: Supersedes the old :mod:`!cmp`, :mod:`!cmpcache` and :mod:`!" "dircmp` modules, which have now become deprecated. (Contributed by Gordon " "MacMillan and Moshe Zadka.)" msgstr "" -#: whatsnew/2.0.rst:1094 +#: whatsnew/2.0.rst:1095 msgid "" ":mod:`gettext`: This module provides internationalization (I18N) and " "localization (L10N) support for Python programs by providing an interface to " @@ -1346,14 +1569,14 @@ msgid "" "Henstridge.)" msgstr "" -#: whatsnew/2.0.rst:1099 +#: whatsnew/2.0.rst:1100 msgid "" ":mod:`!linuxaudiodev`: Support for the :file:`/dev/audio` device on Linux, a " "twin to the existing :mod:`!sunaudiodev` module. (Contributed by Peter " "Bosch, with fixes by Jeremy Hylton.)" msgstr "" -#: whatsnew/2.0.rst:1103 +#: whatsnew/2.0.rst:1104 msgid "" ":mod:`mmap`: An interface to memory-mapped files on both Windows and Unix. " "A file's contents can be mapped directly into memory, at which point it " @@ -1363,13 +1586,13 @@ msgid "" "M. Kuchling.)" msgstr "" -#: whatsnew/2.0.rst:1109 +#: whatsnew/2.0.rst:1110 msgid "" ":mod:`!pyexpat`: An interface to the Expat XML parser. (Contributed by Paul " "Prescod.)" msgstr "" -#: whatsnew/2.0.rst:1112 +#: whatsnew/2.0.rst:1113 msgid "" ":mod:`robotparser `: Parse a :file:`robots.txt` file, " "which is used for writing web spiders that politely avoid certain areas of a " @@ -1378,19 +1601,19 @@ msgid "" "fetchability of a given URL. (Contributed by Skip Montanaro.)" msgstr "" -#: whatsnew/2.0.rst:1118 +#: whatsnew/2.0.rst:1119 msgid "" ":mod:`tabnanny`: A module/script to check Python source code for ambiguous " "indentation. (Contributed by Tim Peters.)" msgstr "" -#: whatsnew/2.0.rst:1121 +#: whatsnew/2.0.rst:1122 msgid "" ":mod:`!UserString`: A base class useful for deriving objects that behave " "like strings." msgstr "" -#: whatsnew/2.0.rst:1124 +#: whatsnew/2.0.rst:1125 msgid "" ":mod:`webbrowser`: A module that provides a platform independent way to " "launch a web browser on a specific URL. For each platform, various browsers " @@ -1402,7 +1625,7 @@ msgid "" "Fred.)" msgstr "" -#: whatsnew/2.0.rst:1133 +#: whatsnew/2.0.rst:1134 msgid "" ":mod:`_winreg `: An interface to the Windows registry. :mod:`!" "_winreg` is an adaptation of functions that have been part of PythonWin " @@ -1411,7 +1634,7 @@ msgid "" "Hammond." msgstr "" -#: whatsnew/2.0.rst:1138 +#: whatsnew/2.0.rst:1139 msgid "" ":mod:`zipfile`: A module for reading and writing ZIP-format archives. These " "are archives produced by :program:`PKZIP` on DOS/Windows or :program:`zip` " @@ -1419,7 +1642,7 @@ msgid "" "supported by the :mod:`gzip` module) (Contributed by James C. Ahlstrom.)" msgstr "" -#: whatsnew/2.0.rst:1143 +#: whatsnew/2.0.rst:1144 msgid "" ":mod:`!imputil`: A module that provides a simpler way for writing customized " "import hooks, in comparison to the existing :mod:`!ihooks` module. " @@ -1427,70 +1650,70 @@ msgid "" "way.)" msgstr "" -#: whatsnew/2.0.rst:1151 +#: whatsnew/2.0.rst:1152 msgid "IDLE Improvements" msgstr "" -#: whatsnew/2.0.rst:1153 +#: whatsnew/2.0.rst:1154 msgid "" "IDLE is the official Python cross-platform IDE, written using Tkinter. " "Python 2.0 includes IDLE 0.6, which adds a number of new features and " "improvements. A partial list:" msgstr "" -#: whatsnew/2.0.rst:1157 +#: whatsnew/2.0.rst:1158 msgid "" "UI improvements and optimizations, especially in the area of syntax " "highlighting and auto-indentation." msgstr "" -#: whatsnew/2.0.rst:1160 +#: whatsnew/2.0.rst:1161 msgid "" "The class browser now shows more information, such as the top level " "functions in a module." msgstr "" -#: whatsnew/2.0.rst:1163 +#: whatsnew/2.0.rst:1164 msgid "" "Tab width is now a user settable option. When opening an existing Python " "file, IDLE automatically detects the indentation conventions, and adapts." msgstr "" -#: whatsnew/2.0.rst:1166 +#: whatsnew/2.0.rst:1167 msgid "" "There is now support for calling browsers on various platforms, used to open " "the Python documentation in a browser." msgstr "" -#: whatsnew/2.0.rst:1169 +#: whatsnew/2.0.rst:1170 msgid "" "IDLE now has a command line, which is largely similar to the vanilla Python " "interpreter." msgstr "" -#: whatsnew/2.0.rst:1172 +#: whatsnew/2.0.rst:1173 msgid "Call tips were added in many places." msgstr "" -#: whatsnew/2.0.rst:1174 +#: whatsnew/2.0.rst:1175 msgid "IDLE can now be installed as a package." msgstr "" -#: whatsnew/2.0.rst:1176 +#: whatsnew/2.0.rst:1177 msgid "In the editor window, there is now a line/column bar at the bottom." msgstr "" -#: whatsnew/2.0.rst:1178 +#: whatsnew/2.0.rst:1179 msgid "" "Three new keystroke commands: Check module (:kbd:`Alt-F5`), Import module (:" "kbd:`F5`) and Run script (:kbd:`Ctrl-F5`)." msgstr "" -#: whatsnew/2.0.rst:1185 +#: whatsnew/2.0.rst:1186 msgid "Deleted and Deprecated Modules" msgstr "" -#: whatsnew/2.0.rst:1187 +#: whatsnew/2.0.rst:1188 msgid "" "A few modules have been dropped because they're obsolete, or because there " "are now better ways to do the same thing. The :mod:`!stdwin` module is " @@ -1498,7 +1721,7 @@ msgid "" "developed." msgstr "" -#: whatsnew/2.0.rst:1191 +#: whatsnew/2.0.rst:1192 msgid "" "A number of modules have been moved to the :file:`lib-old` subdirectory: :" "mod:`!cmp`, :mod:`!cmpcache`, :mod:`!dircmp`, :mod:`!dump`, :mod:`!find`, :" @@ -1509,11 +1732,11 @@ msgid "" "uses these modules." msgstr "" -#: whatsnew/2.0.rst:1200 +#: whatsnew/2.0.rst:1201 msgid "Acknowledgements" msgstr "" -#: whatsnew/2.0.rst:1202 +#: whatsnew/2.0.rst:1203 msgid "" "The authors would like to thank the following people for offering " "suggestions on various drafts of this article: David Bolen, Mark Hammond, " diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index 7c5cdb48..ac2f0b01 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -71,6 +72,16 @@ msgid "" "example, a nested recursive function definition doesn't work::" msgstr "" +#: whatsnew/2.1.rst:44 +msgid "" +"def f():\n" +" ...\n" +" def g(value):\n" +" ...\n" +" return g(value-1) + 1\n" +" ..." +msgstr "" + #: whatsnew/2.1.rst:51 msgid "" "The function :func:`!g` will always raise a :exc:`NameError` exception, " @@ -83,6 +94,15 @@ msgid "" "arguments. ::" msgstr "" +#: whatsnew/2.1.rst:59 +msgid "" +"def find(self, name):\n" +" \"Return list of any entries equal to 'name'\"\n" +" L = filter(lambda x, name=name: x == name,\n" +" self.list_attribute)\n" +" return L" +msgstr "" + #: whatsnew/2.1.rst:65 msgid "" "The readability of Python code written in a strongly functional style " @@ -130,6 +150,16 @@ msgstr "" msgid "To make the preceding explanation a bit clearer, here's an example::" msgstr "" +#: whatsnew/2.1.rst:98 +msgid "" +"x = 1\n" +"def f():\n" +" # The next line is a syntax error\n" +" exec 'x=2'\n" +" def g():\n" +" return x" +msgstr "" + #: whatsnew/2.1.rst:105 msgid "" "Line 4 containing the ``exec`` statement is a syntax error, since ``exec`` " @@ -183,6 +213,10 @@ msgid "" "statement::" msgstr "" +#: whatsnew/2.1.rst:141 +msgid "from __future__ import nested_scopes" +msgstr "" + #: whatsnew/2.1.rst:143 msgid "" "While it looks like a normal :keyword:`import` statement, it's not; there " @@ -328,7 +362,7 @@ msgid "" "functions." msgstr "" -#: whatsnew/2.1.rst:223 +#: whatsnew/2.1.rst:222 msgid ":pep:`207` - Rich Comparisons" msgstr "" @@ -370,10 +404,22 @@ msgid "" "importing it causes a warning to be printed::" msgstr "" +#: whatsnew/2.1.rst:251 +msgid "" +">>> import regex\n" +"__main__:1: DeprecationWarning: the regex module\n" +" is deprecated; please use the re module\n" +">>>" +msgstr "" + #: whatsnew/2.1.rst:256 msgid "Warnings can be issued by calling the :func:`warnings.warn` function::" msgstr "" +#: whatsnew/2.1.rst:258 +msgid "warnings.warn(\"feature X no longer supported\")" +msgstr "" + #: whatsnew/2.1.rst:260 msgid "" "The first parameter is the warning message; an additional optional " @@ -389,6 +435,15 @@ msgid "" "`re` module right now. The warning can be suppressed by calling ::" msgstr "" +#: whatsnew/2.1.rst:269 +msgid "" +"import warnings\n" +"warnings.filterwarnings(action = 'ignore',\n" +" message='.*regex module is deprecated',\n" +" category=DeprecationWarning,\n" +" module = '__main__')" +msgstr "" + #: whatsnew/2.1.rst:275 msgid "" "This adds a filter that will apply only to warnings of the class :class:" @@ -406,7 +461,7 @@ msgid "" "PEP 230 or to Python's API documentation for the details." msgstr "" -#: whatsnew/2.1.rst:293 +#: whatsnew/2.1.rst:289 msgid ":pep:`5` - Guidelines for Language Evolution" msgstr "" @@ -505,6 +560,21 @@ msgid "" "in a dictionary::" msgstr "" +#: whatsnew/2.1.rst:356 +msgid "" +"_cache = {}\n" +"def memoize(x):\n" +" if _cache.has_key(x):\n" +" return _cache[x]\n" +"\n" +" retval = f(x)\n" +"\n" +" # Cache the returned object\n" +" _cache[x] = retval\n" +"\n" +" return retval" +msgstr "" + #: whatsnew/2.1.rst:368 msgid "" "This version works for simple things such as integers, but it has a side " @@ -533,6 +603,24 @@ msgid "" "doesn't keep objects alive, by storing weak references in the cache. ::" msgstr "" +#: whatsnew/2.1.rst:385 +msgid "" +"_cache = {}\n" +"def memoize(x):\n" +" if _cache.has_key(x):\n" +" obj = _cache[x]()\n" +" # If weak reference object still exists,\n" +" # return it\n" +" if obj is not None: return obj\n" +"\n" +" retval = f(x)\n" +"\n" +" # Cache a weak reference\n" +" _cache[x] = weakref.ref(retval)\n" +"\n" +" return retval" +msgstr "" + #: whatsnew/2.1.rst:400 msgid "" "The :mod:`weakref` module also allows creating proxy objects which behave " @@ -544,6 +632,15 @@ msgid "" "raised. ::" msgstr "" +#: whatsnew/2.1.rst:407 +msgid "" +"proxy = weakref.proxy(obj)\n" +"proxy.attr # Equivalent to obj.attr\n" +"proxy.meth() # Equivalent to obj.meth()\n" +"del obj\n" +"proxy.attr # raises weakref.ReferenceError" +msgstr "" + #: whatsnew/2.1.rst:416 msgid ":pep:`205` - Weak References" msgstr "" @@ -576,12 +673,21 @@ msgid "" "regular Python syntax::" msgstr "" +#: whatsnew/2.1.rst:439 +msgid "" +"def f(): pass\n" +"\n" +"f.publish = 1\n" +"f.secure = 1\n" +"f.grammar = \"A ::= B (C D)*\"" +msgstr "" + #: whatsnew/2.1.rst:445 msgid "" "The dictionary containing attributes can be accessed as the function's :attr:" -"`~object.__dict__`. Unlike the :attr:`~object.__dict__` attribute of class " +"`~function.__dict__`. Unlike the :attr:`~type.__dict__` attribute of class " "instances, in functions you can actually assign a new dictionary to :attr:" -"`~object.__dict__`, though the new value is restricted to a regular Python " +"`~function.__dict__`, though the new value is restricted to a regular Python " "dictionary; you *can't* be tricky and set it to a :class:`!UserDict` " "instance, or any other random object that behaves like a mapping." msgstr "" @@ -629,6 +735,21 @@ msgid "" "pretty-printing function::" msgstr "" +#: whatsnew/2.1.rst:488 +msgid "" +">>> # Create a recursive data structure\n" +"... L = [1,2,3]\n" +">>> L.append(L)\n" +">>> L # Show Python's default output\n" +"[1, 2, 3, [...]]\n" +">>> # Use pprint.pprint() as the display function\n" +"... import sys, pprint\n" +">>> sys.displayhook = pprint.pprint\n" +">>> L\n" +"[1, 2, 3, ]\n" +">>>" +msgstr "" + #: whatsnew/2.1.rst:503 msgid ":pep:`217` - Display Hook for Interactive Use" msgstr "" @@ -666,7 +787,7 @@ msgid "" "object's numeric methods)." msgstr "" -#: whatsnew/2.1.rst:535 +#: whatsnew/2.1.rst:533 msgid ":pep:`208` - Reworking the Coercion Model" msgstr "" @@ -718,11 +839,11 @@ msgid "" "python.org/community/sigs/current/distutils-sig/." msgstr "" -#: whatsnew/2.1.rst:575 +#: whatsnew/2.1.rst:574 msgid ":pep:`241` - Metadata for Python Software Packages" msgstr "" -#: whatsnew/2.1.rst:578 +#: whatsnew/2.1.rst:577 msgid ":pep:`243` - Module Repository Upload Mechanism" msgstr "" @@ -746,6 +867,24 @@ msgid "" "name. For example, ``pydoc xml.dom`` displays the following::" msgstr "" +#: whatsnew/2.1.rst:594 +msgid "" +"Python Library Documentation: package xml.dom in xml\n" +"\n" +"NAME\n" +" xml.dom - W3C Document Object Model implementation for Python.\n" +"\n" +"FILE\n" +" /usr/local/lib/python2.1/xml/dom/__init__.pyc\n" +"\n" +"DESCRIPTION\n" +" The Python mapping of the Document Object Model is documented in the\n" +" Python Library Reference in the section on the xml.dom package.\n" +"\n" +" This package contains the following modules:\n" +" ..." +msgstr "" + #: whatsnew/2.1.rst:609 msgid "" ":file:`pydoc` also includes a Tk-based interactive help browser. :file:" @@ -806,9 +945,9 @@ msgstr "" #: whatsnew/2.1.rst:646 msgid "" "Various functions in the :mod:`time` module, such as :func:`~time.asctime` " -"and :func:`~time.localtime`, require a floating point argument containing " +"and :func:`~time.localtime`, require a floating-point argument containing " "the time in seconds since the epoch. The most common use of these functions " -"is to work with the current time, so the floating point argument has been " +"is to work with the current time, so the floating-point argument has been " "made optional; when a value isn't provided, the current time will be used. " "For example, log file entries usually need a string containing the current " "time; in Python 2.1, ``time.asctime()`` can be used, instead of the " @@ -928,6 +1067,13 @@ msgid "" "readlines` method does. You'd use it like this::" msgstr "" +#: whatsnew/2.1.rst:733 +msgid "" +"for line in sys.stdin.xreadlines():\n" +" # ... do something for each line ...\n" +" ..." +msgstr "" + #: whatsnew/2.1.rst:737 msgid "" "For a fuller discussion of the line I/O changes, see the python-dev summary " @@ -956,6 +1102,12 @@ msgid "" "the public names in ``__all__``::" msgstr "" +#: whatsnew/2.1.rst:755 +msgid "" +"# List public names\n" +"__all__ = ['Database', 'open']" +msgstr "" + #: whatsnew/2.1.rst:758 msgid "" "A stricter version of this patch was first suggested and implemented by Ben " diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 0c33c326..a0842279 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -172,6 +173,14 @@ msgid "" "subclass :class:`object`::" msgstr "" +#: whatsnew/2.2.rst:116 +msgid "" +"class C(object):\n" +" def __init__ (self):\n" +" ...\n" +" ..." +msgstr "" + #: whatsnew/2.2.rst:121 msgid "" "This means that :keyword:`class` statements that don't have any base classes " @@ -189,6 +198,14 @@ msgid "" "more, but type objects that behave as factories when called. ::" msgstr "" +#: whatsnew/2.2.rst:131 +msgid "" +">>> int\n" +"\n" +">>> int('123')\n" +"123" +msgstr "" + #: whatsnew/2.2.rst:136 msgid "" "To make the set of types complete, new type objects such as :func:`dict` " @@ -196,6 +213,15 @@ msgid "" "adding a :meth:`!lock` method to file objects::" msgstr "" +#: whatsnew/2.2.rst:140 +msgid "" +"class LockableFile(file):\n" +" def lock (self, operation, length=0, start=0, whence=0):\n" +" import fcntl\n" +" return fcntl.lockf(self.fileno(), operation,\n" +" length, start, whence)" +msgstr "" + #: whatsnew/2.2.rst:146 msgid "" "The now-obsolete :mod:`!posixfile` module contained a class that emulated " @@ -240,7 +266,7 @@ msgid ":attr:`~definition.__name__` is the attribute's name." msgstr "" #: whatsnew/2.2.rst:174 -msgid ":attr:`!__doc__` is the attribute's docstring." +msgid ":attr:`~definition.__doc__` is the attribute's docstring." msgstr "" #: whatsnew/2.2.rst:176 @@ -264,19 +290,37 @@ msgid "" "performs are::" msgstr "" +#: whatsnew/2.2.rst:186 +msgid "" +"descriptor = obj.__class__.x\n" +"descriptor.__get__(obj)" +msgstr "" + #: whatsnew/2.2.rst:189 msgid "" -"For methods, :meth:`!descriptor.__get__` returns a temporary object that's " -"callable, and wraps up the instance and the method to be called on it. This " -"is also why static methods and class methods are now possible; they have " -"descriptors that wrap up just the method, or the method and the class. As a " -"brief explanation of these new kinds of methods, static methods aren't " -"passed the instance, and therefore resemble regular functions. Class " -"methods are passed the class of the object, but not the object itself. " -"Static and class methods are defined like this::" +"For methods, :meth:`descriptor.__get__ ` returns a temporary " +"object that's callable, and wraps up the instance and the method to be " +"called on it. This is also why static methods and class methods are now " +"possible; they have descriptors that wrap up just the method, or the method " +"and the class. As a brief explanation of these new kinds of methods, static " +"methods aren't passed the instance, and therefore resemble regular " +"functions. Class methods are passed the class of the object, but not the " +"object itself. Static and class methods are defined like this::" +msgstr "" + +#: whatsnew/2.2.rst:199 +msgid "" +"class C(object):\n" +" def f(arg1, arg2):\n" +" ...\n" +" f = staticmethod(f)\n" +"\n" +" def g(cls, arg1, arg2):\n" +" ...\n" +" g = classmethod(g)" msgstr "" -#: whatsnew/2.2.rst:207 +#: whatsnew/2.2.rst:208 msgid "" "The :func:`staticmethod` function takes the function :func:`!f`, and returns " "it wrapped up in a descriptor so it can be stored in the class object. You " @@ -285,7 +329,7 @@ msgid "" "has been defined yet; that's been left for future versions of Python." msgstr "" -#: whatsnew/2.2.rst:213 +#: whatsnew/2.2.rst:214 msgid "" "More new features, such as slots and properties, are also implemented as new " "kinds of descriptors, and it's not difficult to write a descriptor class " @@ -295,7 +339,25 @@ msgid "" "defined like this::" msgstr "" -#: whatsnew/2.2.rst:235 +#: whatsnew/2.2.rst:221 +msgid "" +"from eiffel import eiffelmethod\n" +"\n" +"class C(object):\n" +" def f(self, arg1, arg2):\n" +" # The actual function\n" +" ...\n" +" def pre_f(self):\n" +" # Check preconditions\n" +" ...\n" +" def post_f(self):\n" +" # Check postconditions\n" +" ...\n" +"\n" +" f = eiffelmethod(f, pre_f, post_f)" +msgstr "" + +#: whatsnew/2.2.rst:236 msgid "" "Note that a person using the new :func:`!eiffelmethod` doesn't have to " "understand anything about descriptors. This is why I think the new features " @@ -305,18 +367,35 @@ msgid "" "resulting libraries and ignore the implementation details." msgstr "" -#: whatsnew/2.2.rst:244 +#: whatsnew/2.2.rst:245 msgid "Multiple Inheritance: The Diamond Rule" msgstr "" -#: whatsnew/2.2.rst:246 +#: whatsnew/2.2.rst:247 msgid "" "Multiple inheritance has also been made more useful through changing the " "rules under which names are resolved. Consider this set of classes (diagram " "taken from :pep:`253` by Guido van Rossum)::" msgstr "" -#: whatsnew/2.2.rst:264 +#: whatsnew/2.2.rst:251 +msgid "" +" class A:\n" +" ^ ^ def save(self): ...\n" +" / \\\n" +" / \\\n" +" / \\\n" +" / \\\n" +"class B class C:\n" +" ^ ^ def save(self): ...\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" class D" +msgstr "" + +#: whatsnew/2.2.rst:265 msgid "" "The lookup rule for classic classes is simple but not very smart; the base " "classes are searched depth-first, going from left to right. A reference to :" @@ -327,7 +406,7 @@ msgid "" "not calling it will result in that state never getting saved." msgstr "" -#: whatsnew/2.2.rst:272 +#: whatsnew/2.2.rst:273 msgid "" "New-style classes follow a different algorithm that's a bit more complicated " "to explain, but does the right thing in this situation. (Note that Python " @@ -336,7 +415,7 @@ msgid "" "graphs.)" msgstr "" -#: whatsnew/2.2.rst:277 +#: whatsnew/2.2.rst:278 msgid "" "List all the base classes, following the classic lookup rule and include a " "class multiple times if it's visited repeatedly. In the above example, the " @@ -344,7 +423,7 @@ msgid "" "C`, :class:`!A`]." msgstr "" -#: whatsnew/2.2.rst:282 +#: whatsnew/2.2.rst:283 msgid "" "Scan the list for duplicated classes. If any are found, remove all but one " "occurrence, leaving the *last* one in the list. In the above example, the " @@ -352,7 +431,7 @@ msgid "" "dropping duplicates." msgstr "" -#: whatsnew/2.2.rst:287 +#: whatsnew/2.2.rst:288 msgid "" "Following this rule, referring to :meth:`!D.save` will return :meth:`!C." "save`, which is the behaviour we're after. This lookup rule is the same as " @@ -365,18 +444,28 @@ msgid "" "like this::" msgstr "" -#: whatsnew/2.2.rst:303 +#: whatsnew/2.2.rst:297 +msgid "" +"class D (B,C):\n" +" def save (self):\n" +" # Call superclass .save()\n" +" super(D, self).save()\n" +" # Save D's private information here\n" +" ..." +msgstr "" + +#: whatsnew/2.2.rst:304 msgid "" ":func:`super` can also return unbound superclass objects when called as " "``super(class)`` or ``super(class1, class2)``, but this probably won't often " "be useful." msgstr "" -#: whatsnew/2.2.rst:309 +#: whatsnew/2.2.rst:310 msgid "Attribute Access" msgstr "" -#: whatsnew/2.2.rst:311 +#: whatsnew/2.2.rst:312 msgid "" "A fair number of sophisticated Python classes define hooks for attribute " "access using :meth:`~object.__getattr__`; most commonly this is done for " @@ -385,7 +474,7 @@ msgid "" "get_parent``. Python 2.2 adds some new ways of controlling attribute access." msgstr "" -#: whatsnew/2.2.rst:317 +#: whatsnew/2.2.rst:318 msgid "" "First, ``__getattr__(attr_name)`` is still supported by new-style classes, " "and nothing about it has changed. As before, it will be called when an " @@ -393,7 +482,7 @@ msgid "" "found in the instance's dictionary." msgstr "" -#: whatsnew/2.2.rst:322 +#: whatsnew/2.2.rst:323 msgid "" "New-style classes also support a new method, " "``__getattribute__(attr_name)``. The difference between the two methods is " @@ -402,7 +491,7 @@ msgid "" "called if ``foo`` isn't found in the instance's dictionary." msgstr "" -#: whatsnew/2.2.rst:328 +#: whatsnew/2.2.rst:329 msgid "" "However, Python 2.2's support for :dfn:`properties` will often be a simpler " "way to trap attribute references. Writing a :meth:`!__getattr__` method is " @@ -415,7 +504,7 @@ msgid "" "in a sizable performance loss." msgstr "" -#: whatsnew/2.2.rst:337 +#: whatsnew/2.2.rst:338 msgid "" ":class:`property` is a new built-in type that packages up three functions " "that get, set, or delete an attribute, and a docstring. For example, if you " @@ -423,7 +512,25 @@ msgid "" "you could write::" msgstr "" -#: whatsnew/2.2.rst:357 +#: whatsnew/2.2.rst:343 +msgid "" +"class C(object):\n" +" def get_size (self):\n" +" result = ... computation ...\n" +" return result\n" +" def set_size (self, size):\n" +" ... compute something based on the size\n" +" and set internal state appropriately ...\n" +"\n" +" # Define a property. The 'delete this attribute'\n" +" # method is defined as None, so the attribute\n" +" # can't be deleted.\n" +" size = property(get_size, set_size,\n" +" None,\n" +" \"Storage size of this instance\")" +msgstr "" + +#: whatsnew/2.2.rst:358 msgid "" "That is certainly clearer and easier to write than a pair of :meth:`!" "__getattr__`/:meth:`!__setattr__` methods that check for the :attr:`!size` " @@ -433,7 +540,7 @@ msgid "" "references to other attributes run at their usual speed." msgstr "" -#: whatsnew/2.2.rst:364 +#: whatsnew/2.2.rst:365 msgid "" "Finally, it's possible to constrain the list of attributes that can be " "referenced on an object using the new :attr:`~object.__slots__` class " @@ -444,17 +551,34 @@ msgid "" "names. An example will make this clear::" msgstr "" -#: whatsnew/2.2.rst:385 +#: whatsnew/2.2.rst:372 +msgid "" +">>> class C(object):\n" +"... __slots__ = ('template', 'name')\n" +"...\n" +">>> obj = C()\n" +">>> print obj.template\n" +"None\n" +">>> obj.template = 'Test'\n" +">>> print obj.template\n" +"Test\n" +">>> obj.newattr = None\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +"AttributeError: 'C' object has no attribute 'newattr'" +msgstr "" + +#: whatsnew/2.2.rst:386 msgid "" "Note how you get an :exc:`AttributeError` on the attempt to assign to an " "attribute not listed in :attr:`~object.__slots__`." msgstr "" -#: whatsnew/2.2.rst:392 +#: whatsnew/2.2.rst:393 msgid "Related Links" msgstr "" -#: whatsnew/2.2.rst:394 +#: whatsnew/2.2.rst:395 msgid "" "This section has just been a quick overview of the new features, giving " "enough of an explanation to start you programming, but many details have " @@ -462,7 +586,7 @@ msgid "" "picture?" msgstr "" -#: whatsnew/2.2.rst:398 +#: whatsnew/2.2.rst:399 msgid "" "The :ref:`descriptorhowto` is a lengthy tutorial introduction to the " "descriptor features, written by Guido van Rossum. If my description has " @@ -470,7 +594,7 @@ msgid "" "more detail about the new features while still remaining quite easy to read." msgstr "" -#: whatsnew/2.2.rst:403 +#: whatsnew/2.2.rst:404 msgid "" "Next, there are two relevant PEPs, :pep:`252` and :pep:`253`. :pep:`252` is " "titled \"Making Types Look More Like Classes\", and covers the descriptor " @@ -482,7 +606,7 @@ msgid "" "substantial assistance from the rest of the Zope Corp. team." msgstr "" -#: whatsnew/2.2.rst:412 +#: whatsnew/2.2.rst:413 msgid "" "Finally, there's the ultimate authority: the source code. Most of the " "machinery for the type handling is in :file:`Objects/typeobject.c`, but you " @@ -490,25 +614,31 @@ msgid "" "including posting a question to python-list or python-dev." msgstr "" -#: whatsnew/2.2.rst:421 +#: whatsnew/2.2.rst:422 msgid "PEP 234: Iterators" msgstr "" -#: whatsnew/2.2.rst:423 +#: whatsnew/2.2.rst:424 msgid "" "Another significant addition to 2.2 is an iteration interface at both the C " "and Python levels. Objects can define how they can be looped over by " "callers." msgstr "" -#: whatsnew/2.2.rst:426 +#: whatsnew/2.2.rst:427 msgid "" "In Python versions up to 2.1, the usual way to make ``for item in obj`` work " "is to define a :meth:`~object.__getitem__` method that looks something like " "this::" msgstr "" -#: whatsnew/2.2.rst:432 +#: whatsnew/2.2.rst:430 +msgid "" +"def __getitem__(self, index):\n" +" return " +msgstr "" + +#: whatsnew/2.2.rst:433 msgid "" ":meth:`~object.__getitem__` is more properly used to define an indexing " "operation on an object so that you can write ``obj[5]`` to retrieve the " @@ -522,7 +652,7 @@ msgid "" "really should." msgstr "" -#: whatsnew/2.2.rst:442 +#: whatsnew/2.2.rst:443 msgid "" "In Python 2.2, iteration can be implemented separately, and :meth:`~object." "__getitem__` methods can be limited to classes that really do support random " @@ -533,7 +663,7 @@ msgid "" "until it returns *sentinel* to signal that the iterator is done." msgstr "" -#: whatsnew/2.2.rst:450 +#: whatsnew/2.2.rst:451 msgid "" "Python classes can define an :meth:`!__iter__` method, which should create " "and return a new iterator for the object; if the object is its own iterator, " @@ -544,7 +674,7 @@ msgid "" "`~PyTypeObject.tp_iternext` function." msgstr "" -#: whatsnew/2.2.rst:457 +#: whatsnew/2.2.rst:458 msgid "" "So, after all this, what do iterators actually do? They have one required " "method, :meth:`next`, which takes no arguments and returns the next value. " @@ -552,7 +682,26 @@ msgid "" "raise the :exc:`StopIteration` exception. ::" msgstr "" -#: whatsnew/2.2.rst:478 +#: whatsnew/2.2.rst:463 +msgid "" +">>> L = [1,2,3]\n" +">>> i = iter(L)\n" +">>> print i\n" +"\n" +">>> i.next()\n" +"1\n" +">>> i.next()\n" +"2\n" +">>> i.next()\n" +"3\n" +">>> i.next()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +"StopIteration\n" +">>>" +msgstr "" + +#: whatsnew/2.2.rst:479 msgid "" "In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it " "expects something for which :func:`iter` will return an iterator. For " @@ -564,14 +713,43 @@ msgid "" "this::" msgstr "" -#: whatsnew/2.2.rst:492 +#: whatsnew/2.2.rst:487 +msgid "" +">>> L = [1,2,3]\n" +">>> i = iter(L)\n" +">>> a,b,c = i\n" +">>> a,b,c\n" +"(1, 2, 3)" +msgstr "" + +#: whatsnew/2.2.rst:493 msgid "" "Iterator support has been added to some of Python's basic types. Calling :" "func:`iter` on a dictionary will return an iterator which loops over its " "keys::" msgstr "" -#: whatsnew/2.2.rst:512 +#: whatsnew/2.2.rst:496 +msgid "" +">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" +"... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" +">>> for key in m: print key, m[key]\n" +"...\n" +"Mar 3\n" +"Feb 2\n" +"Aug 8\n" +"Sep 9\n" +"May 5\n" +"Jun 6\n" +"Jul 7\n" +"Jan 1\n" +"Apr 4\n" +"Nov 11\n" +"Dec 12\n" +"Oct 10" +msgstr "" + +#: whatsnew/2.2.rst:513 msgid "" "That's just the default behaviour. If you want to iterate over keys, " "values, or key/value pairs, you can explicitly call the :meth:`!iterkeys`, :" @@ -580,14 +758,21 @@ msgid "" "dictionaries, so ``key in dict`` is now equivalent to ``dict.has_key(key)``." msgstr "" -#: whatsnew/2.2.rst:518 +#: whatsnew/2.2.rst:519 msgid "" "Files also provide an iterator, which calls the :meth:`readline` method " "until there are no more lines in the file. This means you can now read each " "line of a file using code like this::" msgstr "" -#: whatsnew/2.2.rst:526 +#: whatsnew/2.2.rst:523 +msgid "" +"for line in file:\n" +" # do something for each line\n" +" ..." +msgstr "" + +#: whatsnew/2.2.rst:527 msgid "" "Note that you can only go forward in an iterator; there's no way to get the " "previous element, reset the iterator, or make a copy of it. An iterator " @@ -599,23 +784,23 @@ msgstr "" msgid ":pep:`234` - Iterators" msgstr "" -#: whatsnew/2.2.rst:535 +#: whatsnew/2.2.rst:536 msgid "" "Written by Ka-Ping Yee and GvR; implemented by the Python Labs crew, mostly " "by GvR and Tim Peters." msgstr "" -#: whatsnew/2.2.rst:542 +#: whatsnew/2.2.rst:543 msgid "PEP 255: Simple Generators" msgstr "" -#: whatsnew/2.2.rst:544 +#: whatsnew/2.2.rst:545 msgid "" "Generators are another new feature, one that interacts with the introduction " "of iterators." msgstr "" -#: whatsnew/2.2.rst:547 +#: whatsnew/2.2.rst:548 msgid "" "You're doubtless familiar with how function calls work in Python or C. When " "you call a function, it gets a private namespace where its local variables " @@ -628,11 +813,18 @@ msgid "" "functions." msgstr "" -#: whatsnew/2.2.rst:556 +#: whatsnew/2.2.rst:557 msgid "Here's the simplest example of a generator function::" msgstr "" -#: whatsnew/2.2.rst:562 +#: whatsnew/2.2.rst:559 +msgid "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" +msgstr "" + +#: whatsnew/2.2.rst:563 msgid "" "A new keyword, :keyword:`yield`, was introduced for generators. Any " "function containing a :keyword:`!yield` statement is a generator function; " @@ -643,7 +835,7 @@ msgid "" "Python 2.3 this statement will become unnecessary." msgstr "" -#: whatsnew/2.2.rst:570 +#: whatsnew/2.2.rst:571 msgid "" "When you call a generator function, it doesn't return a single value; " "instead it returns a generator object that supports the iterator protocol. " @@ -659,17 +851,35 @@ msgid "" "explanation of the interaction between :keyword:`!yield` and exceptions.)" msgstr "" -#: whatsnew/2.2.rst:583 +#: whatsnew/2.2.rst:584 msgid "Here's a sample usage of the :func:`!generate_ints` generator::" msgstr "" -#: whatsnew/2.2.rst:600 +#: whatsnew/2.2.rst:586 +msgid "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +" File \"\", line 2, in generate_ints\n" +"StopIteration" +msgstr "" + +#: whatsnew/2.2.rst:601 msgid "" "You could equally write ``for i in generate_ints(5)``, or ``a,b,c = " "generate_ints(3)``." msgstr "" -#: whatsnew/2.2.rst:603 +#: whatsnew/2.2.rst:604 msgid "" "Inside a generator function, the :keyword:`return` statement can only be " "used without a value, and signals the end of the procession of values; " @@ -680,7 +890,7 @@ msgid "" "flow of execution fall off the bottom of the function." msgstr "" -#: whatsnew/2.2.rst:611 +#: whatsnew/2.2.rst:612 msgid "" "You could achieve the effect of generators manually by writing your own " "class and storing all the local variables of the generator as instance " @@ -693,7 +903,19 @@ msgid "" "recursively. ::" msgstr "" -#: whatsnew/2.2.rst:629 +#: whatsnew/2.2.rst:621 +msgid "" +"# A recursive generator that generates Tree leaves in in-order.\n" +"def inorder(t):\n" +" if t:\n" +" for x in inorder(t.left):\n" +" yield x\n" +" yield t.label\n" +" for x in inorder(t.right):\n" +" yield x" +msgstr "" + +#: whatsnew/2.2.rst:630 msgid "" "Two other examples in :file:`Lib/test/test_generators.py` produce solutions " "for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so that " @@ -702,7 +924,7 @@ msgid "" "twice)." msgstr "" -#: whatsnew/2.2.rst:634 +#: whatsnew/2.2.rst:635 msgid "" "The idea of generators comes from other programming languages, especially " "Icon (https://www2.cs.arizona.edu/icon/), where the idea of generators is " @@ -712,7 +934,13 @@ msgid "" "of what this looks like::" msgstr "" -#: whatsnew/2.2.rst:644 +#: whatsnew/2.2.rst:642 +msgid "" +"sentence := \"Store it in the neighboring harbor\"\n" +"if (i := find(\"or\", sentence)) > 5 then write(i)" +msgstr "" + +#: whatsnew/2.2.rst:645 msgid "" "In Icon the :func:`!find` function returns the indexes at which the " "substring \"or\" is found: 3, 23, 33. In the :keyword:`if` statement, ``i`` " @@ -722,7 +950,7 @@ msgid "" "screen." msgstr "" -#: whatsnew/2.2.rst:650 +#: whatsnew/2.2.rst:651 msgid "" "Python doesn't go nearly as far as Icon in adopting generators as a central " "concept. Generators are considered a new part of the core Python language, " @@ -737,18 +965,18 @@ msgstr "" msgid ":pep:`255` - Simple Generators" msgstr "" -#: whatsnew/2.2.rst:662 +#: whatsnew/2.2.rst:663 msgid "" "Written by Neil Schemenauer, Tim Peters, Magnus Lie Hetland. Implemented " "mostly by Neil Schemenauer and Tim Peters, with other fixes from the Python " "Labs crew." msgstr "" -#: whatsnew/2.2.rst:669 +#: whatsnew/2.2.rst:670 msgid "PEP 237: Unifying Long Integers and Integers" msgstr "" -#: whatsnew/2.2.rst:671 +#: whatsnew/2.2.rst:672 msgid "" "In recent versions, the distinction between regular integers, which are 32-" "bit values on most machines, and long integers, which can be of arbitrary " @@ -761,7 +989,7 @@ msgid "" "exception with the message 'slice index must be int'." msgstr "" -#: whatsnew/2.2.rst:681 +#: whatsnew/2.2.rst:682 msgid "" "Python 2.2 will shift values from short to long integers as required. The " "'L' suffix is no longer needed to indicate a long integer literal, as now " @@ -772,7 +1000,15 @@ msgid "" "result. For example::" msgstr "" -#: whatsnew/2.2.rst:694 +#: whatsnew/2.2.rst:690 +msgid "" +">>> 1234567890123\n" +"1234567890123L\n" +">>> 2 ** 64\n" +"18446744073709551616L" +msgstr "" + +#: whatsnew/2.2.rst:695 msgid "" "In most cases, integers and long integers will now be treated identically. " "You can still distinguish them with the :func:`type` built-in function, but " @@ -783,17 +1019,17 @@ msgstr "" msgid ":pep:`237` - Unifying Long Integers and Integers" msgstr "" -#: whatsnew/2.2.rst:702 +#: whatsnew/2.2.rst:703 msgid "" "Written by Moshe Zadka and Guido van Rossum. Implemented mostly by Guido " "van Rossum." msgstr "" -#: whatsnew/2.2.rst:709 +#: whatsnew/2.2.rst:710 msgid "PEP 238: Changing the Division Operator" msgstr "" -#: whatsnew/2.2.rst:711 +#: whatsnew/2.2.rst:712 msgid "" "The most controversial change in Python 2.2 heralds the start of an effort " "to fix an old design flaw that's been in Python from the beginning. " @@ -806,7 +1042,7 @@ msgid "" "difficult to determine the possible types of the operands." msgstr "" -#: whatsnew/2.2.rst:721 +#: whatsnew/2.2.rst:722 msgid "" "(The controversy is over whether this is *really* a design flaw, and whether " "it's worth breaking existing code to fix this. It's caused endless " @@ -816,14 +1052,14 @@ msgid "" "Read :pep:`238` for a summary of arguments and counter-arguments.)" msgstr "" -#: whatsnew/2.2.rst:728 +#: whatsnew/2.2.rst:729 msgid "" "Because this change might break code, it's being introduced very gradually. " "Python 2.2 begins the transition, but the switch won't be complete until " "Python 3.0." msgstr "" -#: whatsnew/2.2.rst:732 +#: whatsnew/2.2.rst:733 msgid "" "First, I'll borrow some terminology from :pep:`238`. \"True division\" is " "the division that most non-programmers are familiar with: 3/2 is 1.5, 1/4 is " @@ -835,11 +1071,11 @@ msgid "" "the operands is a floating-point number." msgstr "" -#: whatsnew/2.2.rst:740 +#: whatsnew/2.2.rst:741 msgid "Here are the changes 2.2 introduces:" msgstr "" -#: whatsnew/2.2.rst:742 +#: whatsnew/2.2.rst:743 msgid "" "A new operator, ``//``, is the floor division operator. (Yes, we know it " "looks like C++'s comment symbol.) ``//`` *always* performs floor division " @@ -847,13 +1083,13 @@ msgid "" "``1.0 // 2.0`` is also 0.0." msgstr "" -#: whatsnew/2.2.rst:747 +#: whatsnew/2.2.rst:748 msgid "" "``//`` is always available in Python 2.2; you don't need to enable it using " "a ``__future__`` statement." msgstr "" -#: whatsnew/2.2.rst:750 +#: whatsnew/2.2.rst:751 msgid "" "By including a ``from __future__ import division`` in a module, the ``/`` " "operator will be changed to return the result of true division, so ``1/2`` " @@ -861,7 +1097,7 @@ msgid "" "division. The default meaning of ``/`` will not change until Python 3.0." msgstr "" -#: whatsnew/2.2.rst:755 +#: whatsnew/2.2.rst:756 msgid "" "Classes can define methods called :meth:`~object.__truediv__` and :meth:" "`~object.__floordiv__` to overload the two division operators. At the C " @@ -869,7 +1105,7 @@ msgid "" "extension types can define the two operators." msgstr "" -#: whatsnew/2.2.rst:760 +#: whatsnew/2.2.rst:761 msgid "" "Python 2.2 supports some command-line arguments for testing whether code " "will work with the changed division semantics. Running python with :option:" @@ -879,21 +1115,21 @@ msgid "" "without a warning; the warning will be turned on by default in Python 2.3." msgstr "" -#: whatsnew/2.2.rst:770 +#: whatsnew/2.2.rst:771 msgid ":pep:`238` - Changing the Division Operator" msgstr "" -#: whatsnew/2.2.rst:771 +#: whatsnew/2.2.rst:772 msgid "" "Written by Moshe Zadka and Guido van Rossum. Implemented by Guido van " "Rossum.." msgstr "" -#: whatsnew/2.2.rst:777 +#: whatsnew/2.2.rst:778 msgid "Unicode Changes" msgstr "" -#: whatsnew/2.2.rst:779 +#: whatsnew/2.2.rst:780 msgid "" "Python's Unicode support has been enhanced a bit in 2.2. Unicode strings " "are usually stored as UCS-2, as 16-bit unsigned integers. Python 2.2 can " @@ -903,7 +1139,7 @@ msgid "" "completely disable Unicode support.)" msgstr "" -#: whatsnew/2.2.rst:786 +#: whatsnew/2.2.rst:787 msgid "" "When built to use UCS-4 (a \"wide Python\"), the interpreter can natively " "handle Unicode characters from U+000000 to U+110000, so the range of legal " @@ -914,7 +1150,7 @@ msgid "" "characters\"; consult it for further details." msgstr "" -#: whatsnew/2.2.rst:794 +#: whatsnew/2.2.rst:795 msgid "" "Another change is simpler to explain. Since their introduction, Unicode " "strings have supported an :meth:`!encode` method to convert the string to a " @@ -925,39 +1161,60 @@ msgid "" "codec." msgstr "" -#: whatsnew/2.2.rst:801 +#: whatsnew/2.2.rst:802 msgid "" "Using this new feature, codecs have been added for tasks not directly " "related to Unicode. For example, codecs have been added for uu-encoding, " "MIME's base64 encoding, and compression with the :mod:`zlib` module::" msgstr "" -#: whatsnew/2.2.rst:822 +#: whatsnew/2.2.rst:806 +msgid "" +">>> s = \"\"\"Here is a lengthy piece of redundant, overly verbose,\n" +"... and repetitive text.\n" +"... \"\"\"\n" +">>> data = s.encode('zlib')\n" +">>> data\n" +"'x\\x9c\\r\\xc9\\xc1\\r\\x80 \\x10\\x04\\xc0?Ul...'\n" +">>> data.decode('zlib')\n" +"'Here is a lengthy piece of redundant, overly verbose,\\nand repetitive text." +"\\n'\n" +">>> print s.encode('uu')\n" +"begin 666 \n" +"M2&5R92!I=F5R8F]S92P*86YD(')E<&5T:71I=F4@=&5X=\"X*\n" +"\n" +"end\n" +">>> \"sheesh\".encode('rot-13')\n" +"'furrfu'" +msgstr "" + +#: whatsnew/2.2.rst:823 msgid "" "To convert a class instance to Unicode, a :meth:`!__unicode__` method can be " "defined by a class, analogous to :meth:`!__str__`." msgstr "" -#: whatsnew/2.2.rst:825 +#: whatsnew/2.2.rst:826 msgid "" ":meth:`!encode`, :meth:`!decode`, and :meth:`!__unicode__` were implemented " "by Marc-André Lemburg. The changes to support using UCS-4 internally were " "implemented by Fredrik Lundh and Martin von Löwis." msgstr "" -#: whatsnew/2.2.rst:832 +#: whatsnew/2.2.rst:833 msgid ":pep:`261` - Support for 'wide' Unicode characters" msgstr "" -#: whatsnew/2.2.rst:833 +#: whatsnew/2.2.rst:834 msgid "Written by Paul Prescod." msgstr "" -#: whatsnew/2.2.rst:839 +#: whatsnew/2.2.rst:840 msgid "PEP 227: Nested Scopes" msgstr "" -#: whatsnew/2.2.rst:841 +#: whatsnew/2.2.rst:842 msgid "" "In Python 2.1, statically nested scopes were added as an optional feature, " "to be enabled by a ``from __future__ import nested_scopes`` directive. In " @@ -967,7 +1224,7 @@ msgid "" "2.1 came out, you can skip the rest of this section." msgstr "" -#: whatsnew/2.2.rst:848 +#: whatsnew/2.2.rst:849 msgid "" "The largest change introduced in Python 2.1, and made complete in 2.2, is to " "Python's scoping rules. In Python 2.0, at any given time there are at most " @@ -977,7 +1234,17 @@ msgid "" "definition doesn't work::" msgstr "" -#: whatsnew/2.2.rst:862 +#: whatsnew/2.2.rst:856 +msgid "" +"def f():\n" +" ...\n" +" def g(value):\n" +" ...\n" +" return g(value-1) + 1\n" +" ..." +msgstr "" + +#: whatsnew/2.2.rst:863 msgid "" "The function :func:`!g` will always raise a :exc:`NameError` exception, " "because the binding of the name ``g`` isn't in either its local namespace or " @@ -989,13 +1256,22 @@ msgid "" "arguments. ::" msgstr "" -#: whatsnew/2.2.rst:876 +#: whatsnew/2.2.rst:871 +msgid "" +"def find(self, name):\n" +" \"Return list of any entries equal to 'name'\"\n" +" L = filter(lambda x, name=name: x == name,\n" +" self.list_attribute)\n" +" return L" +msgstr "" + +#: whatsnew/2.2.rst:877 msgid "" "The readability of Python code written in a strongly functional style " "suffers greatly as a result." msgstr "" -#: whatsnew/2.2.rst:879 +#: whatsnew/2.2.rst:880 msgid "" "The most significant change to Python 2.2 is that static scoping has been " "added to the language to fix this problem. As a first effect, the " @@ -1007,7 +1283,7 @@ msgid "" "rules, and a dissection of the implementation, can be found in the PEP." msgstr "" -#: whatsnew/2.2.rst:888 +#: whatsnew/2.2.rst:889 msgid "" "This change may cause some compatibility problems for code where the same " "variable name is used both at the module level and as a local variable " @@ -1016,7 +1292,7 @@ msgid "" "read in the first place." msgstr "" -#: whatsnew/2.2.rst:894 +#: whatsnew/2.2.rst:895 msgid "" "One side effect of the change is that the ``from module import *`` and " "``exec`` statements have been made illegal inside a function scope under " @@ -1032,37 +1308,47 @@ msgid "" "the compiler will flag this by raising a :exc:`SyntaxError` exception." msgstr "" -#: whatsnew/2.2.rst:907 +#: whatsnew/2.2.rst:908 msgid "To make the preceding explanation a bit clearer, here's an example::" msgstr "" -#: whatsnew/2.2.rst:916 +#: whatsnew/2.2.rst:910 +msgid "" +"x = 1\n" +"def f():\n" +" # The next line is a syntax error\n" +" exec 'x=2'\n" +" def g():\n" +" return x" +msgstr "" + +#: whatsnew/2.2.rst:917 msgid "" "Line 4 containing the ``exec`` statement is a syntax error, since ``exec`` " "would define a new local variable named ``x`` whose value should be accessed " "by :func:`!g`." msgstr "" -#: whatsnew/2.2.rst:920 +#: whatsnew/2.2.rst:921 msgid "" "This shouldn't be much of a limitation, since ``exec`` is rarely used in " "most Python code (and when it is used, it's often a sign of a poor design " "anyway)." msgstr "" -#: whatsnew/2.2.rst:927 +#: whatsnew/2.2.rst:928 msgid ":pep:`227` - Statically Nested Scopes" msgstr "" -#: whatsnew/2.2.rst:928 +#: whatsnew/2.2.rst:929 msgid "Written and implemented by Jeremy Hylton." msgstr "" -#: whatsnew/2.2.rst:934 +#: whatsnew/2.2.rst:935 msgid "New and Improved Modules" msgstr "" -#: whatsnew/2.2.rst:936 +#: whatsnew/2.2.rst:937 msgid "" "The :mod:`xmlrpclib ` module was contributed to the standard " "library by Fredrik Lundh, providing support for writing XML-RPC clients. " @@ -1072,20 +1358,40 @@ msgid "" "channel::" msgstr "" -#: whatsnew/2.2.rst:959 +#: whatsnew/2.2.rst:943 +msgid "" +"import xmlrpclib\n" +"s = xmlrpclib.Server(\n" +" 'http://www.oreillynet.com/meerkat/xml-rpc/server.php')\n" +"channels = s.meerkat.getChannels()\n" +"# channels is a list of dictionaries, like this:\n" +"# [{'id': 4, 'title': 'Freshmeat Daily News'}\n" +"# {'id': 190, 'title': '32Bits Online'},\n" +"# {'id': 4549, 'title': '3DGamers'}, ... ]\n" +"\n" +"# Get the items for one channel\n" +"items = s.meerkat.getItems( {'channel': 4} )\n" +"\n" +"# 'items' is another list of dictionaries, like this:\n" +"# [{'link': 'http://freshmeat.net/releases/52719/',\n" +"# 'description': 'A utility which converts HTML to XSL FO.',\n" +"# 'title': 'html2fo 0.3 (Default)'}, ... ]" +msgstr "" + +#: whatsnew/2.2.rst:960 msgid "" "The :mod:`SimpleXMLRPCServer ` module makes it easy to create " "straightforward XML-RPC servers. See http://xmlrpc.scripting.com/ for more " "information about XML-RPC." msgstr "" -#: whatsnew/2.2.rst:962 +#: whatsnew/2.2.rst:963 msgid "" "The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:" "`2104`. (Contributed by Gerhard Häring.)" msgstr "" -#: whatsnew/2.2.rst:965 +#: whatsnew/2.2.rst:966 msgid "" "Several functions that originally returned lengthy tuples now return pseudo-" "sequences that still behave like tuples but also have mnemonic attributes " @@ -1096,7 +1402,7 @@ msgid "" "`time` module." msgstr "" -#: whatsnew/2.2.rst:972 +#: whatsnew/2.2.rst:973 msgid "" "For example, to obtain a file's size using the old tuples, you'd end up " "writing something like ``file_size = os.stat(filename)[stat.ST_SIZE]``, but " @@ -1104,25 +1410,25 @@ msgid "" "st_size``." msgstr "" -#: whatsnew/2.2.rst:976 +#: whatsnew/2.2.rst:977 msgid "The original patch for this feature was contributed by Nick Mathewson." msgstr "" -#: whatsnew/2.2.rst:978 +#: whatsnew/2.2.rst:979 msgid "" "The Python profiler has been extensively reworked and various errors in its " "output have been corrected. (Contributed by Fred L. Drake, Jr. and Tim " "Peters.)" msgstr "" -#: whatsnew/2.2.rst:981 +#: whatsnew/2.2.rst:982 msgid "" "The :mod:`socket` module can be compiled to support IPv6; specify the :" "option:`!--enable-ipv6` option to Python's configure script. (Contributed " "by Jun-ichiro \"itojun\" Hagino.)" msgstr "" -#: whatsnew/2.2.rst:985 +#: whatsnew/2.2.rst:986 msgid "" "Two new format characters were added to the :mod:`struct` module for 64-bit " "integers on platforms that support the C :c:expr:`long long` type. ``q`` is " @@ -1130,7 +1436,7 @@ msgid "" "returned in Python's long integer type. (Contributed by Tim Peters.)" msgstr "" -#: whatsnew/2.2.rst:990 +#: whatsnew/2.2.rst:991 msgid "" "In the interpreter's interactive mode, there's a new built-in function :func:" "`help` that uses the :mod:`pydoc` module introduced in Python 2.1 to provide " @@ -1141,7 +1447,7 @@ msgid "" "`pydoc` module.)" msgstr "" -#: whatsnew/2.2.rst:998 +#: whatsnew/2.2.rst:999 msgid "" "Various bugfixes and performance improvements have been made to the SRE " "engine underlying the :mod:`re` module. For example, the :func:`re.sub` " @@ -1152,7 +1458,7 @@ msgid "" "Fredrik Lundh. The BIGCHARSET patch was contributed by Martin von Löwis.)" msgstr "" -#: whatsnew/2.2.rst:1006 +#: whatsnew/2.2.rst:1007 msgid "" "The :mod:`smtplib` module now supports :rfc:`2487`, \"Secure SMTP over " "TLS\", so it's now possible to encrypt the SMTP traffic between a Python " @@ -1160,7 +1466,7 @@ msgid "" "also supports SMTP authentication. (Contributed by Gerhard Häring.)" msgstr "" -#: whatsnew/2.2.rst:1011 +#: whatsnew/2.2.rst:1012 msgid "" "The :mod:`imaplib` module, maintained by Piers Lauder, has support for " "several new extensions: the NAMESPACE extension defined in :rfc:`2342`, " @@ -1168,7 +1474,7 @@ msgid "" "Pelletier.)" msgstr "" -#: whatsnew/2.2.rst:1015 +#: whatsnew/2.2.rst:1016 msgid "" "The :mod:`!rfc822` module's parsing of email addresses is now compliant " "with :rfc:`2822`, an update to :rfc:`822`. (The module's name is *not* " @@ -1177,7 +1483,7 @@ msgid "" "Barry Warsaw, and arising out of his work on Mailman.)" msgstr "" -#: whatsnew/2.2.rst:1021 +#: whatsnew/2.2.rst:1022 msgid "" "The :mod:`difflib` module now contains a new :class:`!Differ` class for " "producing human-readable lists of changes (a \"delta\") between two " @@ -1188,7 +1494,7 @@ msgid "" "the generatorization.)" msgstr "" -#: whatsnew/2.2.rst:1028 +#: whatsnew/2.2.rst:1029 msgid "" "New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, and :const:" "`!ascii_uppercase` were added to the :mod:`string` module. There were " @@ -1200,25 +1506,25 @@ msgid "" "person; fixed by Fred L. Drake, Jr.)" msgstr "" -#: whatsnew/2.2.rst:1037 +#: whatsnew/2.2.rst:1038 msgid "" "The :mod:`mimetypes` module now makes it easier to use alternative MIME-type " "databases by the addition of a :class:`~mimetypes.MimeTypes` class, which " "takes a list of filenames to be parsed. (Contributed by Fred L. Drake, Jr.)" msgstr "" -#: whatsnew/2.2.rst:1041 +#: whatsnew/2.2.rst:1042 msgid "" "A :class:`~threading.Timer` class was added to the :mod:`threading` module " "that allows scheduling an activity to happen at some future time. " "(Contributed by Itamar Shtull-Trauring.)" msgstr "" -#: whatsnew/2.2.rst:1049 +#: whatsnew/2.2.rst:1050 msgid "Interpreter Changes and Fixes" msgstr "" -#: whatsnew/2.2.rst:1051 +#: whatsnew/2.2.rst:1052 msgid "" "Some of the changes only affect people who deal with the Python interpreter " "at the C level because they're writing Python extension modules, embedding " @@ -1227,7 +1533,7 @@ msgid "" "much." msgstr "" -#: whatsnew/2.2.rst:1056 +#: whatsnew/2.2.rst:1057 msgid "" "Profiling and tracing functions can now be implemented in C, which can " "operate at much higher speeds than Python-based functions and should reduce " @@ -1239,9 +1545,9 @@ msgid "" "(Contributed by Fred L. Drake, Jr.)" msgstr "" -#: whatsnew/2.2.rst:1065 +#: whatsnew/2.2.rst:1066 msgid "" -"Another low-level API, primarily of interest to implementors of Python " +"Another low-level API, primarily of interest to implementers of Python " "debuggers and development tools, was added. :c:func:" "`PyInterpreterState_Head` and :c:func:`PyInterpreterState_Next` let a caller " "walk through all the existing interpreter objects; :c:func:" @@ -1250,7 +1556,7 @@ msgid "" "David Beazley.)" msgstr "" -#: whatsnew/2.2.rst:1072 +#: whatsnew/2.2.rst:1073 msgid "" "The C-level interface to the garbage collector has been changed to make it " "easier to write extension types that support garbage collection and to debug " @@ -1261,12 +1567,12 @@ msgid "" "priority." msgstr "" -#: whatsnew/2.2.rst:1079 +#: whatsnew/2.2.rst:1080 msgid "" "To upgrade an extension module to the new API, perform the following steps:" msgstr "" -#: whatsnew/2.2.rst:1081 +#: whatsnew/2.2.rst:1082 msgid "Rename :c:macro:`!Py_TPFLAGS_GC` to :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" @@ -1275,26 +1581,26 @@ msgid "" "Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate" msgstr "" -#: whatsnew/2.2.rst:1084 +#: whatsnew/2.2.rst:1085 msgid "objects, and :c:func:`PyObject_GC_Del` to deallocate them." msgstr "" -#: whatsnew/2.2.rst:1086 +#: whatsnew/2.2.rst:1087 msgid "" "Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and :c:" "func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." msgstr "" -#: whatsnew/2.2.rst:1089 +#: whatsnew/2.2.rst:1090 msgid "Remove :c:macro:`!PyGC_HEAD_SIZE` from object size calculations." msgstr "" -#: whatsnew/2.2.rst:1091 +#: whatsnew/2.2.rst:1092 msgid "" "Remove calls to :c:func:`!PyObject_AS_GC` and :c:func:`!PyObject_FROM_GC`." msgstr "" -#: whatsnew/2.2.rst:1093 +#: whatsnew/2.2.rst:1094 msgid "" "A new ``et`` format sequence was added to :c:func:`PyArg_ParseTuple`; ``et`` " "takes both a parameter and an encoding name, and converts the parameter to " @@ -1306,7 +1612,7 @@ msgid "" "and used for the MBCS support on Windows described in the following section.)" msgstr "" -#: whatsnew/2.2.rst:1102 +#: whatsnew/2.2.rst:1103 msgid "" "A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been " "added that's simpler and presumably faster. Instead of specifying a format " @@ -1315,7 +1621,7 @@ msgid "" "be filled in with argument values." msgstr "" -#: whatsnew/2.2.rst:1108 +#: whatsnew/2.2.rst:1109 msgid "" "Two new flags :c:macro:`METH_NOARGS` and :c:macro:`METH_O` are available in " "method definition tables to simplify implementation of methods with no " @@ -1325,7 +1631,7 @@ msgid "" "methods is now officially deprecated." msgstr "" -#: whatsnew/2.2.rst:1114 +#: whatsnew/2.2.rst:1115 msgid "" "Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:" "`PyOS_vsnprintf` were added to provide cross-platform implementations for " @@ -1335,7 +1641,7 @@ msgid "" "protect against buffer overruns. (Contributed by M.-A. Lemburg.)" msgstr "" -#: whatsnew/2.2.rst:1121 +#: whatsnew/2.2.rst:1122 msgid "" "The :c:func:`_PyTuple_Resize` function has lost an unused parameter, so now " "it takes 2 parameters instead of 3. The third argument was never used, and " @@ -1343,11 +1649,11 @@ msgid "" "2.2." msgstr "" -#: whatsnew/2.2.rst:1129 +#: whatsnew/2.2.rst:1130 msgid "Other Changes and Fixes" msgstr "" -#: whatsnew/2.2.rst:1131 +#: whatsnew/2.2.rst:1132 msgid "" "As usual there were a bunch of other improvements and bugfixes scattered " "throughout the source tree. A search through the CVS change logs finds " @@ -1356,18 +1662,18 @@ msgid "" "and fixed 82 bugs. These figures are likely to be underestimates." msgstr "" -#: whatsnew/2.2.rst:1137 +#: whatsnew/2.2.rst:1138 msgid "Some of the more notable changes are:" msgstr "" -#: whatsnew/2.2.rst:1139 +#: whatsnew/2.2.rst:1140 msgid "" "The code for the MacOS port for Python, maintained by Jack Jansen, is now " "kept in the main Python CVS tree, and many changes have been made to support " "MacOS X." msgstr "" -#: whatsnew/2.2.rst:1142 +#: whatsnew/2.2.rst:1143 msgid "" "The most significant change is the ability to build Python as a framework, " "enabled by supplying the :option:`!--enable-framework` option to the " @@ -1381,7 +1687,7 @@ msgid "" "OSA scripting language and much more.\"" msgstr "" -#: whatsnew/2.2.rst:1153 +#: whatsnew/2.2.rst:1154 msgid "" "Most of the MacPython toolbox modules, which interface to MacOS APIs such as " "windowing, QuickTime, scripting, etc. have been ported to OS X, but they've " @@ -1389,14 +1695,14 @@ msgid "" "with these modules can uncomment them manually." msgstr "" -#: whatsnew/2.2.rst:1176 +#: whatsnew/2.2.rst:1177 msgid "" "Keyword arguments passed to built-in functions that don't take them now " "cause a :exc:`TypeError` exception to be raised, with the message " "\"*function* takes no keyword arguments\"." msgstr "" -#: whatsnew/2.2.rst:1180 +#: whatsnew/2.2.rst:1181 msgid "" "Weak references, added in Python 2.1 as an extension module, are now part of " "the core because they're used in the implementation of new-style classes. " @@ -1404,14 +1710,14 @@ msgid "" "`weakref` module to become a built-in exception." msgstr "" -#: whatsnew/2.2.rst:1185 +#: whatsnew/2.2.rst:1186 msgid "" "A new script, :file:`Tools/scripts/cleanfuture.py` by Tim Peters, " "automatically removes obsolete ``__future__`` statements from Python source " "code." msgstr "" -#: whatsnew/2.2.rst:1189 +#: whatsnew/2.2.rst:1190 msgid "" "An additional *flags* argument has been added to the built-in function :func:" "`compile`, so the behaviour of ``__future__`` statements can now be " @@ -1420,7 +1726,7 @@ msgid "" "(Contributed by Michael Hudson.)" msgstr "" -#: whatsnew/2.2.rst:1195 +#: whatsnew/2.2.rst:1196 msgid "" "The new license introduced with Python 1.6 wasn't GPL-compatible. This is " "fixed by some minor textual changes to the 2.2 license, so it's now legal to " @@ -1430,7 +1736,7 @@ msgid "" "to the Python 2.0.1 and 2.1.1 releases." msgstr "" -#: whatsnew/2.2.rst:1202 +#: whatsnew/2.2.rst:1203 msgid "" "When presented with a Unicode filename on Windows, Python will now convert " "it to an MBCS encoded string, as used by the Microsoft file APIs. As MBCS " @@ -1441,18 +1747,18 @@ msgid "" "Unix support was added by Martin von Löwis.)" msgstr "" -#: whatsnew/2.2.rst:1210 +#: whatsnew/2.2.rst:1211 msgid "" "Large file support is now enabled on Windows. (Contributed by Tim Peters.)" msgstr "" -#: whatsnew/2.2.rst:1212 +#: whatsnew/2.2.rst:1213 msgid "" "The :file:`Tools/scripts/ftpmirror.py` script now parses a :file:`.netrc` " "file, if you have one. (Contributed by Mike Romberg.)" msgstr "" -#: whatsnew/2.2.rst:1215 +#: whatsnew/2.2.rst:1216 msgid "" "Some features of the object returned by the :func:`!xrange` function are now " "deprecated, and trigger warnings when they're accessed; they'll disappear in " @@ -1465,7 +1771,7 @@ msgid "" "been deprecated." msgstr "" -#: whatsnew/2.2.rst:1224 +#: whatsnew/2.2.rst:1225 msgid "" "There were a bunch of patches to the dictionary implementation, mostly to " "fix potential core dumps if a dictionary contains objects that sneakily " @@ -1475,14 +1781,14 @@ msgid "" "case, and round and round it went." msgstr "" -#: whatsnew/2.2.rst:1231 +#: whatsnew/2.2.rst:1232 msgid "" "On Windows, Python can now be compiled with Borland C thanks to a number of " "patches contributed by Stephen Hansen, though the result isn't fully " "functional yet. (But this *is* progress...)" msgstr "" -#: whatsnew/2.2.rst:1235 +#: whatsnew/2.2.rst:1236 msgid "" "Another Windows enhancement: Wise Solutions generously offered PythonLabs " "use of their InstallerMaster 8.1 system. Earlier PythonLabs Windows " @@ -1490,7 +1796,7 @@ msgid "" "up by Tim Peters.)" msgstr "" -#: whatsnew/2.2.rst:1239 +#: whatsnew/2.2.rst:1240 msgid "" "Files ending in ``.pyw`` can now be imported on Windows. ``.pyw`` is a " "Windows-only thing, used to indicate that a script needs to be run using " @@ -1500,7 +1806,7 @@ msgid "" "Bolen.)" msgstr "" -#: whatsnew/2.2.rst:1245 +#: whatsnew/2.2.rst:1246 msgid "" "On platforms where Python uses the C :c:func:`dlopen` function to load " "extension modules, it's now possible to set the flags used by :c:func:" @@ -1508,20 +1814,20 @@ msgid "" "functions. (Contributed by Bram Stolk.)" msgstr "" -#: whatsnew/2.2.rst:1250 +#: whatsnew/2.2.rst:1251 msgid "" "The :func:`pow` built-in function no longer supports 3 arguments when " "floating-point numbers are supplied. ``pow(x, y, z)`` returns ``(x**y) % " -"z``, but this is never useful for floating point numbers, and the final " +"z``, but this is never useful for floating-point numbers, and the final " "result varies unpredictably depending on the platform. A call such as " "``pow(2.0, 8.0, 7.0)`` will now raise a :exc:`TypeError` exception." msgstr "" -#: whatsnew/2.2.rst:1260 +#: whatsnew/2.2.rst:1261 msgid "Acknowledgements" msgstr "" -#: whatsnew/2.2.rst:1262 +#: whatsnew/2.2.rst:1263 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index e07aaacd..65144667 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -84,6 +85,23 @@ msgstr "" msgid "Here's a simple example::" msgstr "" +#: whatsnew/2.3.rst:52 +msgid "" +">>> import sets\n" +">>> S = sets.Set([1,2,3])\n" +">>> S\n" +"Set([1, 2, 3])\n" +">>> 1 in S\n" +"True\n" +">>> 0 in S\n" +"False\n" +">>> S.add(5)\n" +">>> S.remove(3)\n" +">>> S\n" +"Set([1, 2, 5])\n" +">>>" +msgstr "" + #: whatsnew/2.3.rst:66 msgid "" "The union and intersection of sets can be computed with the :meth:" @@ -93,6 +111,24 @@ msgid "" "and :meth:`~frozenset.intersection_update`. ::" msgstr "" +#: whatsnew/2.3.rst:71 +msgid "" +">>> S1 = sets.Set([1,2,3])\n" +">>> S2 = sets.Set([4,5,6])\n" +">>> S1.union(S2)\n" +"Set([1, 2, 3, 4, 5, 6])\n" +">>> S1 | S2 # Alternative notation\n" +"Set([1, 2, 3, 4, 5, 6])\n" +">>> S1.intersection(S2)\n" +"Set([])\n" +">>> S1 & S2 # Alternative notation\n" +"Set([])\n" +">>> S1.union_update(S2)\n" +">>> S1\n" +"Set([1, 2, 3, 4, 5, 6])\n" +">>>" +msgstr "" + #: whatsnew/2.3.rst:86 msgid "" "It's also possible to take the symmetric difference of two sets. This is " @@ -103,13 +139,37 @@ msgid "" "`~frozenset.symmetric_difference_update`. ::" msgstr "" +#: whatsnew/2.3.rst:92 +msgid "" +">>> S1 = sets.Set([1,2,3,4])\n" +">>> S2 = sets.Set([3,4,5,6])\n" +">>> S1.symmetric_difference(S2)\n" +"Set([1, 2, 5, 6])\n" +">>> S1 ^ S2\n" +"Set([1, 2, 5, 6])\n" +">>>" +msgstr "" + #: whatsnew/2.3.rst:100 msgid "" "There are also :meth:`!issubset` and :meth:`!issuperset` methods for " "checking whether one set is a subset or superset of another::" msgstr "" -#: whatsnew/2.3.rst:117 +#: whatsnew/2.3.rst:103 +msgid "" +">>> S1 = sets.Set([1,2,3])\n" +">>> S2 = sets.Set([2,3])\n" +">>> S2.issubset(S1)\n" +"True\n" +">>> S1.issubset(S2)\n" +"False\n" +">>> S1.issuperset(S2)\n" +"True\n" +">>>" +msgstr "" + +#: whatsnew/2.3.rst:116 msgid ":pep:`218` - Adding a Built-In Set Object Type" msgstr "" @@ -151,6 +211,13 @@ msgstr "" msgid "Here's the simplest example of a generator function::" msgstr "" +#: whatsnew/2.3.rst:147 +msgid "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" +msgstr "" + #: whatsnew/2.3.rst:151 msgid "" "A new keyword, :keyword:`yield`, was introduced for generators. Any " @@ -179,6 +246,24 @@ msgstr "" msgid "Here's a sample usage of the :func:`!generate_ints` generator::" msgstr "" +#: whatsnew/2.3.rst:171 +msgid "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +" File \"stdin\", line 2, in generate_ints\n" +"StopIteration" +msgstr "" + #: whatsnew/2.3.rst:186 msgid "" "You could equally write ``for i in generate_ints(5)``, or ``a,b,c = " @@ -209,6 +294,18 @@ msgid "" "recursively. ::" msgstr "" +#: whatsnew/2.3.rst:206 +msgid "" +"# A recursive generator that generates Tree leaves in in-order.\n" +"def inorder(t):\n" +" if t:\n" +" for x in inorder(t.left):\n" +" yield x\n" +" yield t.label\n" +" for x in inorder(t.right):\n" +" yield x" +msgstr "" + #: whatsnew/2.3.rst:215 msgid "" "Two other examples in :file:`Lib/test/test_generators.py` produce solutions " @@ -228,6 +325,12 @@ msgid "" "of what this looks like::" msgstr "" +#: whatsnew/2.3.rst:227 +msgid "" +"sentence := \"Store it in the neighboring harbor\"\n" +"if (i := find(\"or\", sentence)) > 5 then write(i)" +msgstr "" + #: whatsnew/2.3.rst:230 msgid "" "In Icon the :func:`!find` function returns the indexes at which the " @@ -249,7 +352,7 @@ msgid "" "functions or stored in a data structure." msgstr "" -#: whatsnew/2.3.rst:248 +#: whatsnew/2.3.rst:247 msgid ":pep:`255` - Simple Generators" msgstr "" @@ -272,6 +375,12 @@ msgid "" "UTF-8 file can be declared with::" msgstr "" +#: whatsnew/2.3.rst:264 +msgid "" +"#!/usr/bin/env python\n" +"# -*- coding: UTF-8 -*-" +msgstr "" + #: whatsnew/2.3.rst:267 msgid "" "Without such an encoding declaration, the default encoding used is 7-bit " @@ -289,7 +398,7 @@ msgid "" "variable names that use characters outside of the usual alphanumerics." msgstr "" -#: whatsnew/2.3.rst:282 +#: whatsnew/2.3.rst:281 msgid ":pep:`263` - Defining Python Source Code Encodings" msgstr "" @@ -311,6 +420,26 @@ msgid "" "path``. For example:" msgstr "" +#: whatsnew/2.3.rst:296 +msgid "" +"amk@nyman:~/src/python$ unzip -l /tmp/example.zip\n" +"Archive: /tmp/example.zip\n" +" Length Date Time Name\n" +" -------- ---- ---- ----\n" +" 8467 11-26-02 22:30 jwzthreading.py\n" +" -------- -------\n" +" 8467 1 file\n" +"amk@nyman:~/src/python$ ./python\n" +"Python 2.3 (#1, Aug 1 2003, 19:54:32)\n" +">>> import sys\n" +">>> sys.path.insert(0, '/tmp/example.zip') # Add .zip file to front of " +"path\n" +">>> import jwzthreading\n" +">>> jwzthreading.__file__\n" +"'/tmp/example.zip/jwzthreading.py'\n" +">>>" +msgstr "" + #: whatsnew/2.3.rst:314 msgid "" "An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP " @@ -328,7 +457,7 @@ msgid "" "import from the :file:`lib/` subdirectory within the archive." msgstr "" -#: whatsnew/2.3.rst:331 +#: whatsnew/2.3.rst:328 msgid ":pep:`273` - Import Modules from Zip Archives" msgstr "" @@ -372,7 +501,7 @@ msgid "" "Other systems also allow Unicode strings as file names but convert them to " "byte strings before passing them to the system, which can cause a :exc:" "`UnicodeError` to be raised. Applications can test whether arbitrary Unicode " -"strings are supported as file names by checking :attr:`os.path." +"strings are supported as file names by checking :const:`os.path." "supports_unicode_filenames`, a Boolean value." msgstr "" @@ -380,7 +509,7 @@ msgstr "" msgid "Under MacOS, :func:`os.listdir` may now return Unicode filenames." msgstr "" -#: whatsnew/2.3.rst:365 +#: whatsnew/2.3.rst:364 msgid ":pep:`277` - Unicode file name support for Windows NT" msgstr "" @@ -453,10 +582,25 @@ msgstr "" msgid "A common idiom to change every element of a list looks like this::" msgstr "" +#: whatsnew/2.3.rst:421 +msgid "" +"for i in range(len(L)):\n" +" item = L[i]\n" +" # ... compute some result based on item ...\n" +" L[i] = result" +msgstr "" + #: whatsnew/2.3.rst:426 msgid "This can be rewritten using :func:`enumerate` as::" msgstr "" +#: whatsnew/2.3.rst:428 +msgid "" +"for i, item in enumerate(L):\n" +" # ... compute some result based on item ...\n" +" L[i] = result" +msgstr "" + #: whatsnew/2.3.rst:435 msgid ":pep:`279` - The enumerate() built-in function" msgstr "" @@ -502,10 +646,28 @@ msgid "" "functions that always use the root log::" msgstr "" +#: whatsnew/2.3.rst:467 +msgid "" +"import logging\n" +"\n" +"logging.debug('Debugging information')\n" +"logging.info('Informational message')\n" +"logging.warning('Warning:config file %s not found', 'server.conf')\n" +"logging.error('Error occurred')\n" +"logging.critical('Critical error -- shutting down')" +msgstr "" + #: whatsnew/2.3.rst:500 msgid "This produces the following output::" msgstr "" +#: whatsnew/2.3.rst:477 +msgid "" +"WARNING:root:Warning:config file server.conf not found\n" +"ERROR:root:Error occurred\n" +"CRITICAL:root:Critical error -- shutting down" +msgstr "" + #: whatsnew/2.3.rst:481 msgid "" "In the default configuration, informational and debugging messages are " @@ -529,6 +691,24 @@ msgid "" "if you specify a true value for the keyword argument *exc_info*. ::" msgstr "" +#: whatsnew/2.3.rst:494 +msgid "" +"def f():\n" +" try: 1/0\n" +" except: logging.exception('Problem recorded')\n" +"\n" +"f()" +msgstr "" + +#: whatsnew/2.3.rst:502 +msgid "" +"ERROR:root:Problem recorded\n" +"Traceback (most recent call last):\n" +" File \"t.py\", line 6, in f\n" +" 1/0\n" +"ZeroDivisionError: integer division or modulo by zero" +msgstr "" + #: whatsnew/2.3.rst:508 msgid "" "Slightly more advanced programs will use a logger other than the root " @@ -537,6 +717,16 @@ msgid "" "logger. ::" msgstr "" +#: whatsnew/2.3.rst:512 +msgid "" +"log = logging.getLogger('server')\n" +" ...\n" +"log.info('Listening on port %i', port)\n" +" ...\n" +"log.critical('Disk full')\n" +" ..." +msgstr "" + #: whatsnew/2.3.rst:519 msgid "" "Log records are usually propagated up the hierarchy, so a message logged to " @@ -596,12 +786,35 @@ msgid "" "`False`. ::" msgstr "" +#: whatsnew/2.3.rst:561 +msgid "" +">>> bool(1)\n" +"True\n" +">>> bool(0)\n" +"False\n" +">>> bool([])\n" +"False\n" +">>> bool( (1,) )\n" +"True" +msgstr "" + #: whatsnew/2.3.rst:570 msgid "" "Most of the standard library modules and built-in functions have been " "changed to return Booleans. ::" msgstr "" +#: whatsnew/2.3.rst:573 +msgid "" +">>> obj = []\n" +">>> hasattr(obj, 'append')\n" +"True\n" +">>> isinstance(obj, list)\n" +"True\n" +">>> isinstance(obj, tuple)\n" +"False" +msgstr "" + #: whatsnew/2.3.rst:581 msgid "" "Python's Booleans were added with the primary goal of making code clearer. " @@ -625,6 +838,18 @@ msgid "" "still works. ::" msgstr "" +#: whatsnew/2.3.rst:596 +msgid "" +">>> True + 1\n" +"2\n" +">>> False + 1\n" +"1\n" +">>> False * 75\n" +"0\n" +">>> True * 75\n" +"75" +msgstr "" + #: whatsnew/2.3.rst:605 msgid "" "To sum up :const:`True` and :const:`False` in a sentence: they're " @@ -717,6 +942,25 @@ msgid "" "compatible with older versions of the Distutils::" msgstr "" +#: whatsnew/2.3.rst:672 +msgid "" +"from distutils import core\n" +"kw = {'name': \"Quixote\",\n" +" 'version': \"0.5.1\",\n" +" 'description': \"A highly Pythonic Web application framework\",\n" +" # ...\n" +" }\n" +"\n" +"if (hasattr(core, 'setup_keywords') and\n" +" 'classifiers' in core.setup_keywords):\n" +" kw['classifiers'] = \\\n" +" ['Topic :: Internet :: WWW/HTTP :: Dynamic Content',\n" +" 'Environment :: No Input/Output (Daemon)',\n" +" 'Intended Audience :: Developers'],\n" +"\n" +"core.setup(**kw)" +msgstr "" + #: whatsnew/2.3.rst:688 msgid "" "The full list of classifiers can be obtained by running ``python setup.py " @@ -789,6 +1033,28 @@ msgid "" "this (simplified a bit; see :pep:`302` for the full details)::" msgstr "" +#: whatsnew/2.3.rst:738 +msgid "" +"for mp in sys.meta_path:\n" +" loader = mp(fullname)\n" +" if loader is not None:\n" +" = loader.load_module(fullname)\n" +"\n" +"for path in sys.path:\n" +" for hook in sys.path_hooks:\n" +" try:\n" +" importer = hook(path)\n" +" except ImportError:\n" +" # ImportError, so try the other path hooks\n" +" pass\n" +" else:\n" +" loader = importer.find_module(fullname)\n" +" = loader.load_module(fullname)\n" +"\n" +"# Not found!\n" +"raise ImportError" +msgstr "" + #: whatsnew/2.3.rst:760 msgid ":pep:`302` - New Import Hooks" msgstr "" @@ -813,18 +1079,36 @@ msgstr "" msgid "Comma-separated format is deceptively simple at first glance::" msgstr "" +#: whatsnew/2.3.rst:776 +msgid "Costs,150,200,3.95" +msgstr "" + #: whatsnew/2.3.rst:778 msgid "" "Read a line and call ``line.split(',')``: what could be simpler? But toss in " "string data that can contain commas, and things get more complicated::" msgstr "" +#: whatsnew/2.3.rst:781 +msgid "\"Costs\",150,200,3.95,\"Includes taxes, shipping, and sundry items\"" +msgstr "" + #: whatsnew/2.3.rst:783 msgid "" "A big ugly regular expression can parse this, but using the new :mod:`csv` " "package is much simpler::" msgstr "" +#: whatsnew/2.3.rst:786 +msgid "" +"import csv\n" +"\n" +"input = open('datafile', 'rb')\n" +"reader = csv.reader(input)\n" +"for line in reader:\n" +" print line" +msgstr "" + #: whatsnew/2.3.rst:793 msgid "" "The :func:`~csv.reader` function takes a number of different options. The " @@ -840,7 +1124,7 @@ msgid "" "succession of tuples or lists, quoting strings that contain the delimiter." msgstr "" -#: whatsnew/2.3.rst:806 +#: whatsnew/2.3.rst:805 msgid ":pep:`305` - CSV File API" msgstr "" @@ -928,15 +1212,37 @@ msgid "" "even indexes::" msgstr "" +#: whatsnew/2.3.rst:871 +msgid "" +">>> L = range(10)\n" +">>> L[::2]\n" +"[0, 2, 4, 6, 8]" +msgstr "" + #: whatsnew/2.3.rst:875 msgid "" "Negative values also work to make a copy of the same list in reverse order::" msgstr "" +#: whatsnew/2.3.rst:877 +msgid "" +">>> L[::-1]\n" +"[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]" +msgstr "" + #: whatsnew/2.3.rst:880 msgid "This also works for tuples, arrays, and strings::" msgstr "" +#: whatsnew/2.3.rst:882 +msgid "" +">>> s='abcd'\n" +">>> s[::2]\n" +"'ac'\n" +">>> s[::-1]\n" +"'dcba'" +msgstr "" + #: whatsnew/2.3.rst:888 msgid "" "If you have a mutable sequence such as a list or an array you can assign to " @@ -945,6 +1251,16 @@ msgid "" "can be used to change the length of the sequence::" msgstr "" +#: whatsnew/2.3.rst:893 +msgid "" +">>> a = range(3)\n" +">>> a\n" +"[0, 1, 2]\n" +">>> a[1:3] = [4, 5, 6]\n" +">>> a\n" +"[0, 4, 5, 6]" +msgstr "" + #: whatsnew/2.3.rst:900 msgid "" "Extended slices aren't this flexible. When assigning to an extended slice, " @@ -952,20 +1268,60 @@ msgid "" "number of items as the slice it is replacing::" msgstr "" +#: whatsnew/2.3.rst:904 +msgid "" +">>> a = range(4)\n" +">>> a\n" +"[0, 1, 2, 3]\n" +">>> a[::2]\n" +"[0, 2]\n" +">>> a[::2] = [0, -1]\n" +">>> a\n" +"[0, 1, -1, 3]\n" +">>> a[::2] = [0,1,2]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +"ValueError: attempt to assign sequence of size 3 to extended slice of size 2" +msgstr "" + #: whatsnew/2.3.rst:917 msgid "Deletion is more straightforward::" msgstr "" +#: whatsnew/2.3.rst:919 +msgid "" +">>> a = range(4)\n" +">>> a\n" +"[0, 1, 2, 3]\n" +">>> a[::2]\n" +"[0, 2]\n" +">>> del a[::2]\n" +">>> a\n" +"[1, 3]" +msgstr "" + #: whatsnew/2.3.rst:928 msgid "" "One can also now pass slice objects to the :meth:`~object.__getitem__` " "methods of the built-in sequences::" msgstr "" +#: whatsnew/2.3.rst:931 +msgid "" +">>> range(10).__getitem__(slice(0, 5, 2))\n" +"[0, 2, 4]" +msgstr "" + #: whatsnew/2.3.rst:934 msgid "Or use slice objects directly in subscripts::" msgstr "" +#: whatsnew/2.3.rst:936 +msgid "" +">>> range(10)[slice(0, 5, 2)]\n" +"[0, 2, 4]" +msgstr "" + #: whatsnew/2.3.rst:939 msgid "" "To simplify implementing sequences that support extended slicing, slice " @@ -977,6 +1333,20 @@ msgid "" "intended to be used like this::" msgstr "" +#: whatsnew/2.3.rst:946 +msgid "" +"class FakeSeq:\n" +" ...\n" +" def calc_item(self, i):\n" +" ...\n" +" def __getitem__(self, item):\n" +" if isinstance(item, slice):\n" +" indices = item.indices(len(self))\n" +" return FakeSeq([self.calc_item(i) for i in range(*indices)])\n" +" else:\n" +" return self.calc_item(i)" +msgstr "" + #: whatsnew/2.3.rst:957 msgid "" "From this example you can also see that the built-in :class:`slice` object " @@ -1060,6 +1430,26 @@ msgid "" "is returned if it's specified and :exc:`KeyError` raised if it isn't. ::" msgstr "" +#: whatsnew/2.3.rst:1008 +msgid "" +">>> d = {1:2}\n" +">>> d\n" +"{1: 2}\n" +">>> d.pop(4)\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +"KeyError: 4\n" +">>> d.pop(1)\n" +"2\n" +">>> d.pop(1)\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +"KeyError: 'pop(): dictionary is empty'\n" +">>> d\n" +"{}\n" +">>>" +msgstr "" + #: whatsnew/2.3.rst:1025 msgid "" "There's also a new class method, ``dict.fromkeys(iterable, value)``, that " @@ -1077,6 +1467,12 @@ msgid "" "creating small dictionaries::" msgstr "" +#: whatsnew/2.3.rst:1034 +msgid "" +">>> dict(red=1, blue=2, green=3, black=4)\n" +"{'blue': 2, 'black': 4, 'green': 3, 'red': 1}" +msgstr "" + #: whatsnew/2.3.rst:1037 msgid "(Contributed by Just van Rossum.)" msgstr "" @@ -1098,6 +1494,16 @@ msgid "" "you can create a new module object with the following code:" msgstr "" +#: whatsnew/2.3.rst:1052 +msgid "" +">>> import types\n" +">>> m = types.ModuleType('abc','docstring')\n" +">>> m\n" +"\n" +">>> m.__doc__\n" +"'docstring'" +msgstr "" + #: whatsnew/2.3.rst:1059 msgid "" "A new warning, :exc:`PendingDeprecationWarning` was added to indicate " @@ -1142,8 +1548,7 @@ msgid "" "2.3 now uses the C3 algorithm as described in the paper `\"A Monotonic " "Superclass Linearization for Dylan\" `_. To understand the motivation for this " -"change, read Michele Simionato's article `\"Python 2.3 Method Resolution " -"Order\" `_, or read the " +"change, read Michele Simionato's article :ref:`python_2.3_mro`, or read the " "thread on python-dev starting with the message at https://mail.python.org/" "pipermail/python-dev/2002-October/029035.html. Samuele Pedroni first pointed " "out the problem and also implemented the fix by coding the C3 algorithm." @@ -1168,18 +1573,31 @@ msgid "" "created a socket and printed its :attr:`!__class__`, you'd get this output::" msgstr "" +#: whatsnew/2.3.rst:1106 +msgid "" +">>> s = socket.socket()\n" +">>> s.__class__\n" +"" +msgstr "" + #: whatsnew/2.3.rst:1110 msgid "In 2.3, you get this::" msgstr "" +#: whatsnew/2.3.rst:1112 +msgid "" +">>> s.__class__\n" +"" +msgstr "" + #: whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~definition.__name__` and :" -"attr:`~class.__bases__` attributes of new-style classes. There are some " -"restrictions on what can be assigned to :attr:`~class.__bases__` along the " -"lines of those relating to assigning to an instance's :attr:`~instance." -"__class__` attribute." +"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" +"`~type.__bases__` attributes of new-style classes. There are some " +"restrictions on what can be assigned to :attr:`!__bases__` along the lines " +"of those relating to assigning to an instance's :attr:`~object.__class__` " +"attribute." msgstr "" #: whatsnew/2.3.rst:1125 @@ -1195,6 +1613,16 @@ msgid "" "*X* is the empty string, the result is always :const:`True`. ::" msgstr "" +#: whatsnew/2.3.rst:1133 +msgid "" +">>> 'ab' in 'abcd'\n" +"True\n" +">>> 'ad' in 'abcd'\n" +"False\n" +">>> '' in 'abcd'\n" +"True" +msgstr "" + #: whatsnew/2.3.rst:1140 msgid "" "Note that this doesn't tell you where the substring starts; if you need that " @@ -1208,6 +1636,19 @@ msgid "" "strip. The default is still to remove all whitespace characters::" msgstr "" +#: whatsnew/2.3.rst:1147 +msgid "" +">>> ' abc '.strip()\n" +"'abc'\n" +">>> '><><><>'.strip('<>')\n" +"'abc'\n" +">>> '><><><>\\n'.strip('<>')\n" +"'abc<><><>\\n'\n" +">>> u'\\u4000\\u4001abc\\u4000'.strip(u'\\u4000')\n" +"u'\\u4001abc'\n" +">>>" +msgstr "" + #: whatsnew/2.3.rst:1157 msgid "(Suggested by Simon Brunning and implemented by Walter Dörwald.)" msgstr "" @@ -1226,6 +1667,16 @@ msgid "" "operator is still more flexible and powerful than :meth:`~str.zfill`. ::" msgstr "" +#: whatsnew/2.3.rst:1167 +msgid "" +">>> '45'.zfill(4)\n" +"'0045'\n" +">>> '12345'.zfill(4)\n" +"'12345'\n" +">>> 'goofy'.zfill(6)\n" +"'0goofy'" +msgstr "" + #: whatsnew/2.3.rst:1174 msgid "(Contributed by Walter Dörwald.)" msgstr "" @@ -1365,6 +1816,13 @@ msgid "" "Extension` object like this::" msgstr "" +#: whatsnew/2.3.rst:1263 +msgid "" +"ext = Extension(\"samp\",\n" +" sources=[\"sampmodule.c\"],\n" +" depends=[\"sample.h\"])" +msgstr "" + #: whatsnew/2.3.rst:1267 msgid "" "Modifying :file:`sample.h` would then cause the module to be recompiled. " @@ -1403,6 +1861,14 @@ msgid "" "options and arguments can be mixed. For example::" msgstr "" +#: whatsnew/2.3.rst:1289 +msgid "" +">>> getopt.getopt(['-f', 'filename', 'output', '-v'], 'f:v')\n" +"([('-f', 'filename')], ['output', '-v'])\n" +">>> getopt.gnu_getopt(['-f', 'filename', 'output', '-v'], 'f:v')\n" +"([('-f', 'filename'), ('-v', '')], ['output'])" +msgstr "" + #: whatsnew/2.3.rst:1294 msgid "(Contributed by Peter Åstrand.)" msgstr "" @@ -1413,6 +1879,14 @@ msgid "" "tuples::" msgstr "" +#: whatsnew/2.3.rst:1299 +msgid "" +">>> import grp\n" +">>> g = grp.getgrnam('amk')\n" +">>> g.gr_name, g.gr_gid\n" +"('amk', 500)" +msgstr "" + #: whatsnew/2.3.rst:1304 msgid "The :mod:`gzip` module can now handle files exceeding 2 GiB." msgstr "" @@ -1437,6 +1911,23 @@ msgid "" "example that uses a Python list::" msgstr "" +#: whatsnew/2.3.rst:1318 +msgid "" +">>> import heapq\n" +">>> heap = []\n" +">>> for item in [3, 7, 5, 11, 1]:\n" +"... heapq.heappush(heap, item)\n" +"...\n" +">>> heap\n" +"[1, 3, 5, 11, 7]\n" +">>> heapq.heappop(heap)\n" +"1\n" +">>> heapq.heappop(heap)\n" +"3\n" +">>> heap\n" +"[5, 7, 11]" +msgstr "" + #: whatsnew/2.3.rst:1332 msgid "(Contributed by Kevin O'Connor.)" msgstr "" @@ -1506,6 +1997,15 @@ msgid "" "stat_float_times` is invoked to enable float return values::" msgstr "" +#: whatsnew/2.3.rst:1376 +msgid "" +">>> os.stat(\"/tmp\").st_mtime\n" +"1034791200\n" +">>> os.stat_float_times(True)\n" +">>> os.stat(\"/tmp\").st_mtime\n" +"1034791200.6335014" +msgstr "" + #: whatsnew/2.3.rst:1382 msgid "In Python 2.4, the default will change to always returning floats." msgstr "" @@ -1513,7 +2013,7 @@ msgstr "" #: whatsnew/2.3.rst:1384 msgid "" "Application developers should enable this feature only if all their " -"libraries work properly when confronted with floating point time stamps, or " +"libraries work properly when confronted with floating-point time stamps, or " "if they use the tuple API. If used, the feature should be activated on an " "application level instead of trying to enable it on a per-use basis." msgstr "" @@ -1529,7 +2029,7 @@ msgstr "" #: whatsnew/2.3.rst:1394 msgid "" "The old and never-documented :mod:`!linuxaudiodev` module has been " -"deprecated, and a new version named :mod:`ossaudiodev` has been added. The " +"deprecated, and a new version named :mod:`!ossaudiodev` has been added. The " "module was renamed because the OSS sound drivers can be used on platforms " "other than Linux, and the interface has also been tidied and brought up to " "date in various ways. (Contributed by Greg Ward and Nicholas FitzRoy-Dale.)" @@ -1561,6 +2061,26 @@ msgid "" "any value up to ``len(population)``. For example::" msgstr "" +#: whatsnew/2.3.rst:1416 +msgid "" +">>> days = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'St', 'Sn']\n" +">>> random.sample(days, 3) # Choose 3 elements\n" +"['St', 'Sn', 'Th']\n" +">>> random.sample(days, 7) # Choose 7 elements\n" +"['Tu', 'Th', 'Mo', 'We', 'St', 'Fr', 'Sn']\n" +">>> random.sample(days, 7) # Choose 7 again\n" +"['We', 'Mo', 'Sn', 'Fr', 'Tu', 'St', 'Th']\n" +">>> random.sample(days, 8) # Can't choose eight\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +" File \"random.py\", line 414, in sample\n" +" raise ValueError, \"sample larger than population\"\n" +"ValueError: sample larger than population\n" +">>> random.sample(xrange(1,10000,2), 10) # Choose ten odd nos. under " +"10000\n" +"[3407, 3805, 1505, 7023, 2401, 2267, 9733, 3151, 8083, 9195]" +msgstr "" + #: whatsnew/2.3.rst:1432 msgid "" "The :mod:`random` module now uses a new algorithm, the Mersenne Twister, " @@ -1663,6 +2183,24 @@ msgid "" "wrap`. For example::" msgstr "" +#: whatsnew/2.3.rst:1491 +msgid "" +">>> import textwrap\n" +">>> paragraph = \"Not a whit, we defy augury: ... more text ...\"\n" +">>> textwrap.wrap(paragraph, 60)\n" +"[\"Not a whit, we defy augury: there's a special providence in\",\n" +" \"the fall of a sparrow. If it be now, 'tis not to come; if it\",\n" +" ...]\n" +">>> print textwrap.fill(paragraph, 35)\n" +"Not a whit, we defy augury: there's\n" +"a special providence in the fall of\n" +"a sparrow. If it be now, 'tis not\n" +"to come; if it be not to come, it\n" +"will be now; if it be not now, yet\n" +"it will come: the readiness is all.\n" +">>>" +msgstr "" + #: whatsnew/2.3.rst:1506 msgid "" "The module also contains a :class:`~textwrap.TextWrapper` class that " @@ -1683,6 +2221,14 @@ msgid "" "code at the top::" msgstr "" +#: whatsnew/2.3.rst:1519 +msgid "" +"try:\n" +" import threading as _threading\n" +"except ImportError:\n" +" import dummy_threading as _threading" +msgstr "" + #: whatsnew/2.3.rst:1524 msgid "" "In this example, :mod:`!_threading` is used as the module name to make it " @@ -1713,6 +2259,22 @@ msgid "" "string to it or by using the :func:`!unicode` function::" msgstr "" +#: whatsnew/2.3.rst:1545 +msgid "" +"import timeit\n" +"\n" +"timer1 = timeit.Timer('unicode(\"abc\")')\n" +"timer2 = timeit.Timer('\"abc\" + u\"\"')\n" +"\n" +"# Run three trials\n" +"print timer1.repeat(repeat=3, number=100000)\n" +"print timer2.repeat(repeat=3, number=100000)\n" +"\n" +"# On my laptop this outputs:\n" +"# [0.36831796169281006, 0.37441694736480713, 0.35304892063140869]\n" +"# [0.17574405670166016, 0.18193507194519043, 0.17565798759460449]" +msgstr "" + #: whatsnew/2.3.rst:1558 msgid "" "The :mod:`!Tix` module has received various bug fixes and updates for the " @@ -1759,6 +2321,12 @@ msgid "" "false before creating the first :class:`!tkapp` object. ::" msgstr "" +#: whatsnew/2.3.rst:1587 +msgid "" +"import Tkinter\n" +"Tkinter.wantobjects = 0" +msgstr "" + #: whatsnew/2.3.rst:1590 msgid "Any breakage caused by this change should be reported as a bug." msgstr "" @@ -1779,6 +2347,46 @@ msgid "" "__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. For example::" msgstr "" +#: whatsnew/2.3.rst:1602 +msgid "" +">>> import UserDict\n" +">>> class SeqDict(UserDict.DictMixin):\n" +"... \"\"\"Dictionary lookalike implemented with lists.\"\"\"\n" +"... def __init__(self):\n" +"... self.keylist = []\n" +"... self.valuelist = []\n" +"... def __getitem__(self, key):\n" +"... try:\n" +"... i = self.keylist.index(key)\n" +"... except ValueError:\n" +"... raise KeyError\n" +"... return self.valuelist[i]\n" +"... def __setitem__(self, key, value):\n" +"... try:\n" +"... i = self.keylist.index(key)\n" +"... self.valuelist[i] = value\n" +"... except ValueError:\n" +"... self.keylist.append(key)\n" +"... self.valuelist.append(value)\n" +"... def __delitem__(self, key):\n" +"... try:\n" +"... i = self.keylist.index(key)\n" +"... except ValueError:\n" +"... raise KeyError\n" +"... self.keylist.pop(i)\n" +"... self.valuelist.pop(i)\n" +"... def keys(self):\n" +"... return list(self.keylist)\n" +"...\n" +">>> s = SeqDict()\n" +">>> dir(s) # See that other dictionary methods are implemented\n" +"['__cmp__', '__contains__', '__delitem__', '__doc__', '__getitem__',\n" +" '__init__', '__iter__', '__len__', '__module__', '__repr__',\n" +" '__setitem__', 'clear', 'get', 'has_key', 'items', 'iteritems',\n" +" 'iterkeys', 'itervalues', 'keylist', 'keys', 'pop', 'popitem',\n" +" 'setdefault', 'update', 'valuelist', 'values']" +msgstr "" + #: whatsnew/2.3.rst:1639 msgid "(Contributed by Raymond Hettinger.)" msgstr "" @@ -1816,6 +2424,12 @@ msgid "" "Unicode domain name and the ASCII-compatible encoding (ACE) of that name. ::" msgstr "" +#: whatsnew/2.3.rst:1661 +msgid "" +">{}>{}> u\"www.Alliancefrançaise.nu\".encode(\"idna\")\n" +"'www.xn--alliancefranaise-npb.nu'" +msgstr "" + #: whatsnew/2.3.rst:1664 msgid "" "The :mod:`socket` module has also been extended to transparently convert " @@ -1870,6 +2484,18 @@ msgid "" "are a number of methods for producing formatted strings from objects::" msgstr "" +#: whatsnew/2.3.rst:1701 +msgid "" +">>> import datetime\n" +">>> now = datetime.datetime.now()\n" +">>> now.isoformat()\n" +"'2002-12-30T21:27:03.994956'\n" +">>> now.ctime() # Only available on date, datetime\n" +"'Mon Dec 30 21:27:03 2002'\n" +">>> now.strftime('%Y %d %b')\n" +"'2002 30 Dec'" +msgstr "" + #: whatsnew/2.3.rst:1710 msgid "" "The :meth:`~datetime.datetime.replace` method allows modifying one or more " @@ -1877,6 +2503,16 @@ msgid "" "instance, returning a new instance::" msgstr "" +#: whatsnew/2.3.rst:1713 +msgid "" +">>> d = datetime.datetime.now()\n" +">>> d\n" +"datetime.datetime(2002, 12, 30, 22, 15, 38, 827738)\n" +">>> d.replace(year=2001, hour = 12)\n" +"datetime.datetime(2001, 12, 30, 12, 15, 38, 827738)\n" +">>>" +msgstr "" + #: whatsnew/2.3.rst:1720 msgid "" "Instances can be compared, hashed, and converted to strings (the result is " @@ -1913,12 +2549,33 @@ msgid "" "telling it what your program's options are. ::" msgstr "" +#: whatsnew/2.3.rst:1745 +msgid "" +"import sys\n" +"from optparse import OptionParser\n" +"\n" +"op = OptionParser()\n" +"op.add_option('-i', '--input',\n" +" action='store', type='string', dest='input',\n" +" help='set input filename')\n" +"op.add_option('-l', '--length',\n" +" action='store', type='int', dest='length',\n" +" help='set maximum length of output')" +msgstr "" + #: whatsnew/2.3.rst:1756 msgid "" "Parsing a command line is then done by calling the :meth:`~optparse." "OptionParser.parse_args` method. ::" msgstr "" +#: whatsnew/2.3.rst:1758 +msgid "" +"options, args = op.parse_args(sys.argv[1:])\n" +"print options\n" +"print args" +msgstr "" + #: whatsnew/2.3.rst:1762 msgid "" "This returns an object containing all of the option values, and a list of " @@ -1931,10 +2588,35 @@ msgid "" "to. Note that the length argument is automatically converted to an integer." msgstr "" +#: whatsnew/2.3.rst:1768 +msgid "" +"$ ./python opt.py -i data arg1\n" +"\n" +"['arg1']\n" +"$ ./python opt.py --input=data --length=4\n" +"\n" +"[]\n" +"$" +msgstr "" + #: whatsnew/2.3.rst:1778 msgid "The help message is automatically generated for you:" msgstr "" +#: whatsnew/2.3.rst:1780 +msgid "" +"$ ./python opt.py --help\n" +"usage: opt.py [options]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -iINPUT, --input=INPUT\n" +" set input filename\n" +" -lLENGTH, --length=LENGTH\n" +" set maximum length of output\n" +"$" +msgstr "" + #: whatsnew/2.3.rst:1793 msgid "See the module's documentation for more details." msgstr "" @@ -2039,7 +2721,7 @@ msgid "" "distribution and bundle it with the source of your extension." msgstr "" -#: whatsnew/2.3.rst:1869 +#: whatsnew/2.3.rst:1867 msgid "https://hg.python.org/cpython/file/default/Objects/obmalloc.c" msgstr "" @@ -2140,8 +2822,8 @@ msgstr "" #: whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`!__module__` and :attr:" -"`~definition.__name__` attributes. In summary, you will want to ensure the " +"aware of a change in the rules relating to the :attr:`~type.__module__` and :" +"attr:`~type.__name__` attributes. In summary, you will want to ensure the " "type's dictionary contains a ``'__module__'`` key; making the module name " "the part of the type name leading up to the final period will no longer have " "the desired effect. For more detail, read the API reference documentation " @@ -2333,6 +3015,16 @@ msgid "" "uses the new keywords with a version of the Distutils that supports them::" msgstr "" +#: whatsnew/2.3.rst:2058 +msgid "" +"from distutils import core\n" +"\n" +"kw = {'sources': 'foo.c', ...}\n" +"if hasattr(core, 'get_distutil_options'):\n" +" kw['depends'] = ['foo.h']\n" +"ext = Extension(**kw)" +msgstr "" + #: whatsnew/2.3.rst:2065 msgid "" "Using ``None`` as a variable name will now result in a :exc:`SyntaxWarning` " diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index 2c45e9ed..40d15f15 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -74,6 +75,35 @@ msgid "" "differences, and symmetric differences. ::" msgstr "" +#: whatsnew/2.4.rst:45 +msgid "" +">>> a = set('abracadabra') # form a set from a string\n" +">>> 'z' in a # fast membership testing\n" +"False\n" +">>> a # unique letters in a\n" +"set(['a', 'r', 'b', 'c', 'd'])\n" +">>> ''.join(a) # convert back into a string\n" +"'arbcd'\n" +"\n" +">>> b = set('alacazam') # form a second set\n" +">>> a - b # letters in a but not in b\n" +"set(['r', 'd', 'b'])\n" +">>> a | b # letters in either a or b\n" +"set(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'])\n" +">>> a & b # letters in both a and b\n" +"set(['a', 'c'])\n" +">>> a ^ b # letters in a or b but not both\n" +"set(['r', 'd', 'b', 'm', 'z', 'l'])\n" +"\n" +">>> a.add('z') # add a new element\n" +">>> a.update('wxy') # add multiple new elements\n" +">>> a\n" +"set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])\n" +">>> a.remove('x') # take one element out\n" +">>> a\n" +"set(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])" +msgstr "" + #: whatsnew/2.4.rst:71 msgid "" "The :func:`frozenset` type is an immutable version of :func:`set`. Since it " @@ -88,7 +118,7 @@ msgid "" "There are currently no plans to deprecate the module." msgstr "" -#: whatsnew/2.4.rst:83 +#: whatsnew/2.4.rst:82 msgid ":pep:`218` - Adding a Built-In Set Object Type" msgstr "" @@ -120,7 +150,7 @@ msgid "" "expression now returns the correct answer, 8589934592." msgstr "" -#: whatsnew/2.4.rst:108 +#: whatsnew/2.4.rst:107 msgid ":pep:`237` - Unifying Long Integers and Integers" msgstr "" @@ -146,10 +176,25 @@ msgid "" "natural to write something like::" msgstr "" +#: whatsnew/2.4.rst:125 +msgid "" +"links = [link for link in get_all_links() if not link.followed]\n" +"for link in links:\n" +" ..." +msgstr "" + #: whatsnew/2.4.rst:129 msgid "instead of ::" msgstr "" +#: whatsnew/2.4.rst:131 +msgid "" +"for link in get_all_links():\n" +" if link.followed:\n" +" continue\n" +" ..." +msgstr "" + #: whatsnew/2.4.rst:136 msgid "" "The first form is more concise and perhaps more readable, but if you're " @@ -164,6 +209,13 @@ msgid "" "return elements one by one. The above example could be written as::" msgstr "" +#: whatsnew/2.4.rst:144 +msgid "" +"links = (link for link in get_all_links() if not link.followed)\n" +"for link in links:\n" +" ..." +msgstr "" + #: whatsnew/2.4.rst:148 msgid "" "Generator expressions always have to be written inside parentheses, as in " @@ -172,6 +224,10 @@ msgid "" "function you could write::" msgstr "" +#: whatsnew/2.4.rst:153 +msgid "print sum(obj.count for obj in list_all_objects())" +msgstr "" + #: whatsnew/2.4.rst:155 msgid "" "Generator expressions differ from list comprehensions in various small ways. " @@ -182,7 +238,7 @@ msgid "" "respect." msgstr "" -#: whatsnew/2.4.rst:165 +#: whatsnew/2.4.rst:164 msgid ":pep:`289` - Generator Expressions" msgstr "" @@ -207,6 +263,12 @@ msgstr "" msgid "The usual way of substituting variables by name is the ``%`` operator::" msgstr "" +#: whatsnew/2.4.rst:180 +msgid "" +">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" +"'2: The Best of Times'" +msgstr "" + #: whatsnew/2.4.rst:183 msgid "" "When writing the template string, it can be easy to forget the ``i`` or " @@ -226,6 +288,14 @@ msgid "" "``$`` to indicate a substitution::" msgstr "" +#: whatsnew/2.4.rst:195 +msgid "" +">>> import string\n" +">>> t = string.Template('$page: $title')\n" +">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" +"'2: The Best of Times'" +msgstr "" + #: whatsnew/2.4.rst:200 msgid "" "If a key is missing from the dictionary, the :meth:`substitute` method will " @@ -233,6 +303,13 @@ msgid "" "ignores missing keys::" msgstr "" +#: whatsnew/2.4.rst:204 +msgid "" +">>> t = string.Template('$page: $title')\n" +">>> t.safe_substitute({'page':3})\n" +"'3: $title'" +msgstr "" + #: whatsnew/2.4.rst:211 msgid ":pep:`292` - Simpler String Substitutions" msgstr "" @@ -255,6 +332,15 @@ msgid "" "function as a method of the new type. Your code would look like this::" msgstr "" +#: whatsnew/2.4.rst:227 +msgid "" +"class C:\n" +" def meth (cls):\n" +" ...\n" +"\n" +" meth = classmethod(meth) # Rebind name to wrapped-up class method" +msgstr "" + #: whatsnew/2.4.rst:233 msgid "" "If the method was very long, it would be easy to miss or forget the :func:" @@ -284,16 +370,40 @@ msgid "" "indicator. Using the new syntax, the example above would be written::" msgstr "" +#: whatsnew/2.4.rst:249 +msgid "" +"class C:\n" +"\n" +" @classmethod\n" +" def meth (cls):\n" +" ..." +msgstr "" + #: whatsnew/2.4.rst:256 msgid "" "The ``@classmethod`` is shorthand for the ``meth=classmethod(meth)`` " "assignment. More generally, if you have the following::" msgstr "" +#: whatsnew/2.4.rst:259 +msgid "" +"@A\n" +"@B\n" +"@C\n" +"def f ():\n" +" ..." +msgstr "" + #: whatsnew/2.4.rst:265 msgid "It's equivalent to the following pre-decorator code::" msgstr "" +#: whatsnew/2.4.rst:267 +msgid "" +"def f(): ...\n" +"f = A(B(C(f)))" +msgstr "" + #: whatsnew/2.4.rst:270 msgid "" "Decorators must come on the line before a function definition, one decorator " @@ -313,12 +423,46 @@ msgid "" "the function object::" msgstr "" +#: whatsnew/2.4.rst:282 +msgid "" +">>> def deco(func):\n" +"... func.attr = 'decorated'\n" +"... return func\n" +"...\n" +">>> @deco\n" +"... def f(): pass\n" +"...\n" +">>> f\n" +"\n" +">>> f.attr\n" +"'decorated'\n" +">>>" +msgstr "" + #: whatsnew/2.4.rst:295 msgid "" "As a slightly more realistic example, the following decorator checks that " "the supplied argument is an integer::" msgstr "" +#: whatsnew/2.4.rst:298 +msgid "" +"def require_int (func):\n" +" def wrapper (arg):\n" +" assert isinstance(arg, int)\n" +" return func(arg)\n" +"\n" +" return wrapper\n" +"\n" +"@require_int\n" +"def p1 (arg):\n" +" print arg\n" +"\n" +"@require_int\n" +"def p2(arg):\n" +" print arg*2" +msgstr "" + #: whatsnew/2.4.rst:313 msgid "" "An example in :pep:`318` contains a fancier version of this idea that lets " @@ -334,6 +478,13 @@ msgid "" "becomes::" msgstr "" +#: whatsnew/2.4.rst:321 +msgid "" +"def f(): ...\n" +"_deco = C(args)\n" +"f = A(B(_deco(f)))" +msgstr "" + #: whatsnew/2.4.rst:325 msgid "" "Getting this right can be slightly brain-bending, but it's not too difficult." @@ -347,7 +498,7 @@ msgid "" "function that's constructed and returned." msgstr "" -#: whatsnew/2.4.rst:339 +#: whatsnew/2.4.rst:336 msgid ":pep:`318` - Decorators for Functions, Methods and Classes" msgstr "" @@ -376,6 +527,16 @@ msgid "" "iterator that loops over the elements of the sequence in reverse order. ::" msgstr "" +#: whatsnew/2.4.rst:353 +msgid "" +">>> for i in reversed(xrange(1,4)):\n" +"... print i\n" +"...\n" +"3\n" +"2\n" +"1" +msgstr "" + #: whatsnew/2.4.rst:360 msgid "" "Compared to extended slicing, such as ``range(1,4)[::-1]``, :func:`reversed` " @@ -389,6 +550,16 @@ msgid "" "`list`. ::" msgstr "" +#: whatsnew/2.4.rst:367 +msgid "" +">>> input = open('/etc/passwd', 'r')\n" +">>> for line in reversed(list(input)):\n" +"... print line\n" +"...\n" +"root:*:0:0:System Administrator:/var/root:/bin/tcsh\n" +" ..." +msgstr "" + #: whatsnew/2.4.rst:377 msgid ":pep:`322` - Reverse Iteration" msgstr "" @@ -420,6 +591,15 @@ msgid "" "supports a number of different keyword arguments. ::" msgstr "" +#: whatsnew/2.4.rst:399 +msgid "" +"class Popen(args, bufsize=0, executable=None,\n" +" stdin=None, stdout=None, stderr=None,\n" +" preexec_fn=None, close_fds=False, shell=False,\n" +" cwd=None, env=None, universal_newlines=False,\n" +" startupinfo=None, creationflags=0):" +msgstr "" + #: whatsnew/2.4.rst:405 msgid "" "*args* is commonly a sequence of strings that will be the arguments to the " @@ -485,6 +665,17 @@ msgid "" "system`::" msgstr "" +#: whatsnew/2.4.rst:444 +msgid "" +"sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])\n" +"if sts == 0:\n" +" # Success\n" +" ...\n" +"else:\n" +" # dpkg returned an error\n" +" ..." +msgstr "" + #: whatsnew/2.4.rst:452 msgid "" "The command is invoked without use of the shell. If you really do want to " @@ -492,6 +683,10 @@ msgid "" "a string instead of a sequence::" msgstr "" +#: whatsnew/2.4.rst:456 +msgid "sts = subprocess.call('dpkg -i /tmp/new-package.deb', shell=True)" +msgstr "" + #: whatsnew/2.4.rst:458 msgid "" "The PEP takes various examples of shell and Python code and shows how they'd " @@ -499,7 +694,7 @@ msgid "" "section of the PEP is highly recommended." msgstr "" -#: whatsnew/2.4.rst:466 +#: whatsnew/2.4.rst:465 msgid ":pep:`324` - subprocess - New process module" msgstr "" @@ -578,6 +773,12 @@ msgstr "" msgid "Sometimes you can see this inaccuracy when the number is printed::" msgstr "" +#: whatsnew/2.4.rst:518 +msgid "" +">>> 1.1\n" +"1.1000000000000001" +msgstr "" + #: whatsnew/2.4.rst:521 msgid "" "The inaccuracy isn't always visible when you print the number because the FP-" @@ -623,12 +824,27 @@ msgid "" "strings::" msgstr "" +#: whatsnew/2.4.rst:550 +msgid "" +">>> import decimal\n" +">>> decimal.Decimal(1972)\n" +"Decimal(\"1972\")\n" +">>> decimal.Decimal(\"1.1\")\n" +"Decimal(\"1.1\")" +msgstr "" + #: whatsnew/2.4.rst:556 msgid "" "You can also provide tuples containing the sign, the mantissa represented " "as a tuple of decimal digits, and the exponent::" msgstr "" +#: whatsnew/2.4.rst:559 +msgid "" +">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" +"Decimal(\"-14.75\")" +msgstr "" + #: whatsnew/2.4.rst:562 msgid "" "Cautionary note: the sign bit is a Boolean value, so 0 is positive and 1 is " @@ -645,6 +861,15 @@ msgid "" "and pass the string to the :class:`Decimal` constructor::" msgstr "" +#: whatsnew/2.4.rst:572 +msgid "" +">>> f = 1.1\n" +">>> decimal.Decimal(str(f))\n" +"Decimal(\"1.1\")\n" +">>> decimal.Decimal('%.12f' % f)\n" +"Decimal(\"1.100000000000\")" +msgstr "" + #: whatsnew/2.4.rst:578 msgid "" "Once you have :class:`Decimal` instances, you can perform the usual " @@ -652,12 +877,44 @@ msgid "" "integer exponent::" msgstr "" +#: whatsnew/2.4.rst:582 +msgid "" +">>> a = decimal.Decimal('35.72')\n" +">>> b = decimal.Decimal('1.73')\n" +">>> a+b\n" +"Decimal(\"37.45\")\n" +">>> a-b\n" +"Decimal(\"33.99\")\n" +">>> a*b\n" +"Decimal(\"61.7956\")\n" +">>> a/b\n" +"Decimal(\"20.64739884393063583815028902\")\n" +">>> a ** 2\n" +"Decimal(\"1275.9184\")\n" +">>> a**b\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.InvalidOperation: x ** (non-integer)" +msgstr "" + #: whatsnew/2.4.rst:599 msgid "" "You can combine :class:`Decimal` instances with integers, but not with " "floating-point numbers::" msgstr "" +#: whatsnew/2.4.rst:602 +msgid "" +">>> a + 4\n" +"Decimal(\"39.72\")\n" +">>> a + 4.5\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: You can interact Decimal only with int, long or Decimal data " +"types.\n" +">>>" +msgstr "" + #: whatsnew/2.4.rst:610 msgid "" ":class:`Decimal` numbers can be used with the :mod:`math` and :mod:`cmath` " @@ -667,6 +924,16 @@ msgid "" "number and not a :class:`Decimal`. ::" msgstr "" +#: whatsnew/2.4.rst:616 +msgid "" +">>> import math, cmath\n" +">>> d = decimal.Decimal('123456789012.345')\n" +">>> math.sqrt(d)\n" +"351364.18288201344\n" +">>> cmath.sqrt(-d)\n" +"351364.18288201344j" +msgstr "" + #: whatsnew/2.4.rst:623 msgid "" ":class:`Decimal` instances have a :meth:`sqrt` method that returns a :class:" @@ -674,6 +941,12 @@ msgid "" "you'll have to implement them. ::" msgstr "" +#: whatsnew/2.4.rst:627 +msgid "" +">>> d.sqrt()\n" +"Decimal(\"351364.1828820134592177245001\")" +msgstr "" + #: whatsnew/2.4.rst:632 msgid "The :class:`Context` type" msgstr "" @@ -711,6 +984,17 @@ msgid "" "the effect of changing the precision of the default context::" msgstr "" +#: whatsnew/2.4.rst:653 +msgid "" +">>> decimal.getcontext().prec\n" +"28\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.1428571428571428571428571429\")\n" +">>> decimal.getcontext().prec = 9\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.142857143\")" +msgstr "" + #: whatsnew/2.4.rst:661 msgid "" "The default action for error conditions is selectable; the module can either " @@ -718,6 +1002,18 @@ msgid "" "be raised::" msgstr "" +#: whatsnew/2.4.rst:665 +msgid "" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.DivisionByZero: x / 0\n" +">>> decimal.getcontext().traps[decimal.DivisionByZero] = False\n" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Decimal(\"Infinity\")\n" +">>>" +msgstr "" + #: whatsnew/2.4.rst:674 msgid "" "The :class:`Context` instance also has various methods for formatting " @@ -730,7 +1026,7 @@ msgid "" "which includes a quick-start tutorial and a reference." msgstr "" -#: whatsnew/2.4.rst:685 +#: whatsnew/2.4.rst:683 msgid ":pep:`327` - Decimal Data Type" msgstr "" @@ -740,8 +1036,10 @@ msgid "" "Raymond Hettinger, Aahz, and Tim Peters." msgstr "" -#: whatsnew/2.4.rst:689 -msgid "http://www.lahey.com/float.htm" +#: whatsnew/2.4.rst:687 +msgid "" +"`http://www.lahey.com/float.htm `__" msgstr "" #: whatsnew/2.4.rst:688 @@ -750,8 +1048,8 @@ msgid "" "floating-point inaccuracy can cause." msgstr "" -#: whatsnew/2.4.rst:693 -msgid "http://speleotrove.com/decimal/" +#: whatsnew/2.4.rst:691 +msgid "https://speleotrove.com/decimal/" msgstr "" #: whatsnew/2.4.rst:692 @@ -775,6 +1073,14 @@ msgid "" "module, or you can use backslashes to escape the line endings like this::" msgstr "" +#: whatsnew/2.4.rst:708 +msgid "" +"from SimpleXMLRPCServer import SimpleXMLRPCServer,\\\n" +" SimpleXMLRPCRequestHandler,\\\n" +" CGIXMLRPCRequestHandler,\\\n" +" resolve_dotted_attribute" +msgstr "" + #: whatsnew/2.4.rst:713 msgid "" "The syntactic change in Python 2.4 simply allows putting the names within " @@ -782,6 +1088,14 @@ msgid "" "the backslashes are no longer needed::" msgstr "" +#: whatsnew/2.4.rst:717 +msgid "" +"from SimpleXMLRPCServer import (SimpleXMLRPCServer,\n" +" SimpleXMLRPCRequestHandler,\n" +" CGIXMLRPCRequestHandler,\n" +" resolve_dotted_attribute)" +msgstr "" + #: whatsnew/2.4.rst:722 msgid "" "The PEP also proposes that all :keyword:`import` statements be absolute " @@ -840,11 +1154,12 @@ msgstr "" #: whatsnew/2.4.rst:759 msgid "" -"The code for these functions came from the GLib library (https://developer-" -"old.gnome.org/glib/2.26/), whose developers kindly relicensed the relevant " -"functions and donated them to the Python Software Foundation. The :mod:" -"`locale` module can now change the numeric locale, letting extensions such " -"as GTK+ produce the correct results." +"The code for these functions came from the GLib library (`https://developer-" +"old.gnome.org/glib/2.26/ `__), whose developers kindly relicensed the " +"relevant functions and donated them to the Python Software Foundation. The :" +"mod:`locale` module can now change the numeric locale, letting extensions " +"such as GTK+ produce the correct results." msgstr "" #: whatsnew/2.4.rst:768 @@ -912,6 +1227,14 @@ msgid "" "Reifschneider.) ::" msgstr "" +#: whatsnew/2.4.rst:804 +msgid "" +">>> 'www.python.org'.split('.', 1)\n" +"['www', 'python.org']\n" +"'www.python.org'.rsplit('.', 1)\n" +"['www.python', 'org']" +msgstr "" + #: whatsnew/2.4.rst:809 msgid "" "Three keyword parameters, *cmp*, *key*, and *reverse*, were added to the :" @@ -935,6 +1258,22 @@ msgid "" "comparison keys. The following example sorts a list case-insensitively::" msgstr "" +#: whatsnew/2.4.rst:822 +msgid "" +">>> L = ['A', 'b', 'c', 'D']\n" +">>> L.sort() # Case-sensitive sort\n" +">>> L\n" +"['A', 'D', 'b', 'c']\n" +">>> # Using 'key' parameter to sort list\n" +">>> L.sort(key=lambda x: x.lower())\n" +">>> L\n" +"['A', 'b', 'c', 'D']\n" +">>> # Old-fashioned way\n" +">>> L.sort(cmp=lambda x,y: cmp(x.lower(), y.lower()))\n" +">>> L\n" +"['A', 'b', 'c', 'D']" +msgstr "" + #: whatsnew/2.4.rst:835 msgid "" "The last example, which uses the *cmp* parameter, is the old way to perform " @@ -951,6 +1290,13 @@ msgid "" "For example, the above case-insensitive sort is best written as::" msgstr "" +#: whatsnew/2.4.rst:845 +msgid "" +">>> L.sort(key=str.lower)\n" +">>> L\n" +"['A', 'b', 'c', 'D']" +msgstr "" + #: whatsnew/2.4.rst:849 msgid "" "Finally, the *reverse* parameter takes a Boolean value. If the value is " @@ -990,6 +1336,28 @@ msgstr "" msgid "the expression returns the new sorted copy" msgstr "" +#: whatsnew/2.4.rst:873 +msgid "" +">>> L = [9,7,8,3,2,4,1,6,5]\n" +">>> [10+i for i in sorted(L)] # usable in a list comprehension\n" +"[11, 12, 13, 14, 15, 16, 17, 18, 19]\n" +">>> L # original is left unchanged\n" +"[9,7,8,3,2,4,1,6,5]\n" +">>> sorted('Monty Python') # any iterable may be an input\n" +"[' ', 'M', 'P', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y', 'y']\n" +"\n" +">>> # List the contents of a dict sorted by key values\n" +">>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5)\n" +">>> for k, v in sorted(colormap.iteritems()):\n" +"... print k, v\n" +"...\n" +"black 4\n" +"blue 2\n" +"green 3\n" +"red 1\n" +"yellow 5" +msgstr "" + #: whatsnew/2.4.rst:920 whatsnew/2.4.rst:1213 msgid "(Contributed by Raymond Hettinger.)" msgstr "" @@ -1024,6 +1392,17 @@ msgid "" "length argument lists::" msgstr "" +#: whatsnew/2.4.rst:912 +msgid "" +">>> def transpose(array):\n" +"... return zip(*array)\n" +"...\n" +">>> transpose([(1,2,3), (4,5,6)])\n" +"[(1, 4), (2, 5), (3, 6)]\n" +">>> transpose([])\n" +"[]" +msgstr "" + #: whatsnew/2.4.rst:922 msgid "" "Encountering a failure while importing a module no longer leaves a partially " @@ -1158,7 +1537,7 @@ msgstr "" msgid "Chinese (ROC): big5, cp950" msgstr "" -#: whatsnew/2.4.rst:1018 +#: whatsnew/2.4.rst:1016 msgid "Japanese: cp932, euc-jis-2004, euc-jp, euc-jisx0213, iso-2022-jp," msgstr "" @@ -1195,6 +1574,24 @@ msgid "" "either end::" msgstr "" +#: whatsnew/2.4.rst:1036 +msgid "" +">>> from collections import deque\n" +">>> d = deque('ghi') # make a new deque with three items\n" +">>> d.append('j') # add a new entry to the right side\n" +">>> d.appendleft('f') # add a new entry to the left side\n" +">>> d # show the representation of the deque\n" +"deque(['f', 'g', 'h', 'i', 'j'])\n" +">>> d.pop() # return and remove the rightmost item\n" +"'j'\n" +">>> d.popleft() # return and remove the leftmost item\n" +"'f'\n" +">>> list(d) # list the contents of the deque\n" +"['g', 'h', 'i']\n" +">>> 'h' in d # search the deque\n" +"True" +msgstr "" + #: whatsnew/2.4.rst:1051 msgid "" "Several modules, such as the :mod:`Queue` and :mod:`threading` modules, now " @@ -1283,6 +1680,21 @@ msgid "" "return consecutive runs of odd or even numbers. ::" msgstr "" +#: whatsnew/2.4.rst:1106 +msgid "" +">>> import itertools\n" +">>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]\n" +">>> for key_val, it in itertools.groupby(L, lambda x: x % 2):\n" +"... print key_val, list(it)\n" +"...\n" +"0 [2, 4, 6]\n" +"1 [7]\n" +"0 [8]\n" +"1 [9, 11]\n" +"0 [12, 14]\n" +">>>" +msgstr "" + #: whatsnew/2.4.rst:1118 msgid "" ":func:`groupby` is typically used with sorted input. The logic for :func:" @@ -1290,6 +1702,28 @@ msgid "" "eliminating, counting, or identifying duplicate elements::" msgstr "" +#: whatsnew/2.4.rst:1122 +msgid "" +">>> word = 'abracadabra'\n" +">>> letters = sorted(word) # Turn string into a sorted list of letters\n" +">>> letters\n" +"['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r']\n" +">>> for k, g in itertools.groupby(letters):\n" +"... print k, list(g)\n" +"...\n" +"a ['a', 'a', 'a', 'a', 'a']\n" +"b ['b', 'b']\n" +"c ['c']\n" +"d ['d']\n" +"r ['r', 'r']\n" +">>> # List unique letters\n" +">>> [k for k, g in groupby(letters)]\n" +"['a', 'b', 'c', 'd', 'r']\n" +">>> # Count letter occurrences\n" +">>> [(k, len(list(g))) for k, g in groupby(letters)]\n" +"[('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)]" +msgstr "" + #: whatsnew/2.4.rst:1141 msgid "(Contributed by Hye-Shik Chang.)" msgstr "" @@ -1301,6 +1735,19 @@ msgid "" "omitted, the default is 2. ::" msgstr "" +#: whatsnew/2.4.rst:1147 +msgid "" +">>> L = [1,2,3]\n" +">>> i1, i2 = itertools.tee(L)\n" +">>> i1,i2\n" +"(, )\n" +">>> list(i1) # Run the first iterator to exhaustion\n" +"[1, 2, 3]\n" +">>> list(i2) # Run the second iterator to exhaustion\n" +"[1, 2, 3]" +msgstr "" + #: whatsnew/2.4.rst:1156 msgid "" "Note that :func:`tee` has to keep copies of the values returned by the " @@ -1330,6 +1777,14 @@ msgid "" "logging level. For example::" msgstr "" +#: whatsnew/2.4.rst:1176 +msgid "" +"import logging\n" +"logging.basicConfig(filename='/var/log/application.log',\n" +" level=0, # Log all messages\n" +" format='%(levelname):%(process):%(thread):%(message)')" +msgstr "" + #: whatsnew/2.4.rst:1181 msgid "" "Other additions to the :mod:`logging` package include a ``log(level, msg)`` " @@ -1354,7 +1809,7 @@ msgstr "" #: whatsnew/2.4.rst:1195 msgid "" -"The :mod:`nntplib` module's :class:`NNTP` class gained :meth:`description` " +"The :mod:`!nntplib` module's :class:`NNTP` class gained :meth:`description` " "and :meth:`descriptions` methods to retrieve newsgroup descriptions for a " "single group or for a range of groups. (Contributed by Jürgen A. Erhard.)" msgstr "" @@ -1368,6 +1823,17 @@ msgid "" "`map` or :func:`sorted`. For example::" msgstr "" +#: whatsnew/2.4.rst:1205 +msgid "" +">>> L = [('c', 2), ('d', 1), ('a', 4), ('b', 3)]\n" +">>> map(operator.itemgetter(0), L)\n" +"['c', 'd', 'a', 'b']\n" +">>> map(operator.itemgetter(1), L)\n" +"[2, 1, 4, 3]\n" +">>> sorted(L, key=operator.itemgetter(1)) # Sort list by second tuple item\n" +"[('d', 1), ('c', 2), ('b', 3), ('a', 4)]" +msgstr "" + #: whatsnew/2.4.rst:1215 msgid "" "The :mod:`optparse` module was updated in various ways. The module now " @@ -1494,6 +1960,15 @@ msgid "" "attribute values are local to different threads. ::" msgstr "" +#: whatsnew/2.4.rst:1292 +msgid "" +"import threading\n" +"\n" +"data = threading.local()\n" +"data.number = 42\n" +"data.url = ('www.python.org', 80)" +msgstr "" + #: whatsnew/2.4.rst:1298 msgid "" "Other threads can assign and retrieve their own values for the :attr:" @@ -1580,16 +2055,50 @@ msgid "" "object's docstrings::" msgstr "" +#: whatsnew/2.4.rst:1358 +msgid "" +"def f (x, y):\n" +" \"\"\">>> f(2,2)\n" +"4\n" +">>> f(3,2)\n" +"6\n" +" \"\"\"\n" +" return x*y\n" +"\n" +"finder = doctest.DocTestFinder()\n" +"\n" +"# Get list of DocTest instances\n" +"tests = finder.find(f)" +msgstr "" + #: whatsnew/2.4.rst:1371 msgid "" "The new :class:`DocTestRunner` class then runs individual tests and can " "produce a summary of the results::" msgstr "" +#: whatsnew/2.4.rst:1374 +msgid "" +"runner = doctest.DocTestRunner()\n" +"for t in tests:\n" +" tried, failed = runner.run(t)\n" +"\n" +"runner.summarize(verbose=1)" +msgstr "" + #: whatsnew/2.4.rst:1380 msgid "The above example produces the following output::" msgstr "" +#: whatsnew/2.4.rst:1382 +msgid "" +"1 items passed all tests:\n" +" 2 tests in f\n" +"2 tests in 1 items.\n" +"2 passed and 0 failed.\n" +"Test passed." +msgstr "" + #: whatsnew/2.4.rst:1388 msgid "" ":class:`DocTestRunner` uses an instance of the :class:`OutputChecker` class " @@ -1606,10 +2115,28 @@ msgid "" "outputs that vary in minor ways::" msgstr "" +#: whatsnew/2.4.rst:1398 +msgid "" +"def o (n):\n" +" \"\"\">>> o(1)\n" +"<__main__.C instance at 0x...>\n" +">>>\n" +"\"\"\"" +msgstr "" + #: whatsnew/2.4.rst:1404 msgid "Another special string, ````, matches a blank line::" msgstr "" +#: whatsnew/2.4.rst:1406 +msgid "" +"def p (n):\n" +" \"\"\">>> p(1)\n" +"\n" +">>>\n" +"\"\"\"" +msgstr "" + #: whatsnew/2.4.rst:1412 msgid "" "Another new capability is producing a diff-style display of the output by " @@ -1618,12 +2145,41 @@ msgid "" "(delta-style) option flags. For example::" msgstr "" +#: whatsnew/2.4.rst:1417 +msgid "" +"def g (n):\n" +" \"\"\">>> g(4)\n" +"here\n" +"is\n" +"a\n" +"lengthy\n" +">>>\"\"\"\n" +" L = 'here is a rather lengthy list of words'.split()\n" +" for word in L[:n]:\n" +" print word" +msgstr "" + #: whatsnew/2.4.rst:1428 msgid "" "Running the above function's tests with :const:`doctest.REPORT_UDIFF` " "specified, you get the following output:" msgstr "" +#: whatsnew/2.4.rst:1431 +msgid "" +"**********************************************************************\n" +"File \"t.py\", line 15, in g\n" +"Failed example:\n" +" g(4)\n" +"Differences (unified diff with -expected +actual):\n" +" @@ -2,3 +2,3 @@\n" +" is\n" +" a\n" +" -lengthy\n" +" +rather\n" +"**********************************************************************" +msgstr "" + #: whatsnew/2.4.rst:1449 msgid "Build and C API Changes" msgstr "" diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index 566fb2dc..514fa7d5 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -97,6 +98,14 @@ msgid "" "following::" msgstr "" +#: whatsnew/2.5.rst:61 +msgid "" +"if condition:\n" +" x = true_value\n" +"else:\n" +" x = false_value" +msgstr "" + #: whatsnew/2.5.rst:66 msgid "" "There have been endless tedious discussions of syntax on both python-dev and " @@ -110,6 +119,10 @@ msgstr "" msgid "Guido van Rossum eventually chose a surprising syntax::" msgstr "" +#: whatsnew/2.5.rst:74 +msgid "x = true_value if condition else false_value" +msgstr "" + #: whatsnew/2.5.rst:76 msgid "" "Evaluation is still lazy as in existing Boolean expressions, so the order of " @@ -131,6 +144,10 @@ msgid "" "bit more obvious::" msgstr "" +#: whatsnew/2.5.rst:90 +msgid "contents = ((doc + '\\n') if doc else '')" +msgstr "" + #: whatsnew/2.5.rst:92 msgid "" "I read the above statement as meaning \"here *contents* is usually assigned " @@ -147,6 +164,15 @@ msgid "" "style I think you should always use them. Consider these two statements::" msgstr "" +#: whatsnew/2.5.rst:102 +msgid "" +"# First version -- no parens\n" +"level = 1 if logging else 0\n" +"\n" +"# Second version -- with parens\n" +"level = (1 if logging else 0)" +msgstr "" + #: whatsnew/2.5.rst:108 msgid "" "In the first version, I think a reader's eye might group the statement into " @@ -164,7 +190,7 @@ msgid "" "around your conditional expressions, you won't run into this case." msgstr "" -#: whatsnew/2.5.rst:123 +#: whatsnew/2.5.rst:122 msgid ":pep:`308` - Conditional Expressions" msgstr "" @@ -205,6 +231,19 @@ msgstr "" msgid "Here's a small but realistic example::" msgstr "" +#: whatsnew/2.5.rst:150 +msgid "" +"import functools\n" +"\n" +"def log (message, subsystem):\n" +" \"Write the contents of 'message' to the specified subsystem.\"\n" +" print '%s: %s' % (subsystem, message)\n" +" ...\n" +"\n" +"server_log = functools.partial(log, subsystem='server')\n" +"server_log('Unable to open socket')" +msgstr "" + #: whatsnew/2.5.rst:160 msgid "" "Here's another example, from a program that uses PyGTK. Here a context-" @@ -213,6 +252,17 @@ msgid "" "`open_item` method, where the first argument has been provided. ::" msgstr "" +#: whatsnew/2.5.rst:165 +msgid "" +"...\n" +"class Application:\n" +" def open_item(self, path):\n" +" ...\n" +" def init (self):\n" +" open_func = functools.partial(self.open_item, item_path)\n" +" popup_menu.append( (\"Open\", open_func, 1) )" +msgstr "" + #: whatsnew/2.5.rst:173 msgid "" "Another function in the :mod:`functools` module is the " @@ -222,6 +272,16 @@ msgid "" "wrapped function are easier to understand. For example, you might write::" msgstr "" +#: whatsnew/2.5.rst:179 +msgid "" +"def my_decorator(f):\n" +" def wrapper(*args, **kwds):\n" +" print 'Calling decorated function'\n" +" return f(*args, **kwds)\n" +" functools.update_wrapper(wrapper, f)\n" +" return wrapper" +msgstr "" + #: whatsnew/2.5.rst:186 msgid "" ":func:`wraps` is a decorator that can be used inside your own decorators to " @@ -229,7 +289,17 @@ msgid "" "previous example would be::" msgstr "" -#: whatsnew/2.5.rst:201 +#: whatsnew/2.5.rst:190 +msgid "" +"def my_decorator(f):\n" +" @functools.wraps(f)\n" +" def wrapper(*args, **kwds):\n" +" print 'Calling decorated function'\n" +" return f(*args, **kwds)\n" +" return wrapper" +msgstr "" + +#: whatsnew/2.5.rst:200 msgid ":pep:`309` - Partial Function Application" msgstr "" @@ -260,6 +330,18 @@ msgid "" "download the required packages. ::" msgstr "" +#: whatsnew/2.5.rst:222 +msgid "" +"VERSION = '1.0'\n" +"setup(name='PyPackage',\n" +" version=VERSION,\n" +" requires=['numarray', 'zlib (>=1.1.4)'],\n" +" obsoletes=['OldPackage']\n" +" download_url=('http://www.example.com/pypackage/dist/pkg-%s.tar.gz'\n" +" % VERSION),\n" +" )" +msgstr "" + #: whatsnew/2.5.rst:231 msgid "" "Another new enhancement to the Python package index at https://pypi.org is " @@ -281,7 +363,7 @@ msgid "" "Package uploading was implemented by Martin von Löwis and Richard Jones." msgstr "" -#: whatsnew/2.5.rst:248 +#: whatsnew/2.5.rst:247 msgid ":pep:`314` - Metadata for Python Software Packages v1.1" msgstr "" @@ -315,6 +397,14 @@ msgstr "" msgid "Let's say you have a package directory like this::" msgstr "" +#: whatsnew/2.5.rst:269 +msgid "" +"pkg/\n" +"pkg/__init__.py\n" +"pkg/main.py\n" +"pkg/string.py" +msgstr "" + #: whatsnew/2.5.rst:274 msgid "" "This defines a package named :mod:`pkg` containing the :mod:`pkg.main` and :" @@ -369,6 +459,14 @@ msgid "" "module name when using the ``from ... import`` form::" msgstr "" +#: whatsnew/2.5.rst:310 +msgid "" +"# Import names from pkg.string\n" +"from .string import name1, name2\n" +"# Import pkg.string\n" +"from . import string" +msgstr "" + #: whatsnew/2.5.rst:315 msgid "" "This imports the :mod:`string` module relative to the current package, so " @@ -378,13 +476,20 @@ msgid "" "C` module can do::" msgstr "" +#: whatsnew/2.5.rst:320 +msgid "" +"from . import D # Imports A.B.D\n" +"from .. import E # Imports A.E\n" +"from ..F import G # Imports A.F.G" +msgstr "" + #: whatsnew/2.5.rst:324 msgid "" "Leading periods cannot be used with the ``import modname`` form of the " "import statement, only the ``from ... import`` form." msgstr "" -#: whatsnew/2.5.rst:331 +#: whatsnew/2.5.rst:330 msgid ":pep:`328` - Imports: Multi-Line and Absolute/Relative" msgstr "" @@ -454,6 +559,20 @@ msgid "" "you can now write::" msgstr "" +#: whatsnew/2.5.rst:382 +msgid "" +"try:\n" +" block-1 ...\n" +"except Exception1:\n" +" handler-1 ...\n" +"except Exception2:\n" +" handler-2 ...\n" +"else:\n" +" else-block\n" +"finally:\n" +" final-block" +msgstr "" + #: whatsnew/2.5.rst:393 msgid "" "The code in *block-1* is executed. If the code raises an exception, the " @@ -499,6 +618,15 @@ msgstr "" msgid "To refresh your memory of basic generators, here's a simple example::" msgstr "" +#: whatsnew/2.5.rst:428 +msgid "" +"def counter (maximum):\n" +" i = 0\n" +" while i < maximum:\n" +" yield i\n" +" i += 1" +msgstr "" + #: whatsnew/2.5.rst:434 msgid "" "When you call ``counter(10)``, the result is an iterator that returns the " @@ -516,6 +644,10 @@ msgid "" "that can be assigned to a variable or otherwise operated on::" msgstr "" +#: whatsnew/2.5.rst:444 +msgid "val = (yield i)" +msgstr "" + #: whatsnew/2.5.rst:446 msgid "" "I recommend that you always put parentheses around a :keyword:`yield` " @@ -547,10 +679,41 @@ msgid "" "internal counter. ::" msgstr "" +#: whatsnew/2.5.rst:466 +msgid "" +"def counter (maximum):\n" +" i = 0\n" +" while i < maximum:\n" +" val = (yield i)\n" +" # If value provided, change counter\n" +" if val is not None:\n" +" i = val\n" +" else:\n" +" i += 1" +msgstr "" + #: whatsnew/2.5.rst:476 msgid "And here's an example of changing the counter::" msgstr "" +#: whatsnew/2.5.rst:478 +msgid "" +">>> it = counter(10)\n" +">>> print it.next()\n" +"0\n" +">>> print it.next()\n" +"1\n" +">>> print it.send(8)\n" +"8\n" +">>> print it.next()\n" +"9\n" +">>> print it.next()\n" +"Traceback (most recent call last):\n" +" File \"t.py\", line 15, in ?\n" +" print it.next()\n" +"StopIteration" +msgstr "" + #: whatsnew/2.5.rst:493 msgid "" ":keyword:`yield` will usually return :const:`None`, so you should always " @@ -629,7 +792,7 @@ msgid "" "exhausted." msgstr "" -#: whatsnew/2.5.rst:549 +#: whatsnew/2.5.rst:544 msgid ":pep:`342` - Coroutines via Enhanced Generators" msgstr "" @@ -645,7 +808,7 @@ msgid "" "Hettinger and :pep:`325` by Samuele Pedroni." msgstr "" -#: whatsnew/2.5.rst:552 +#: whatsnew/2.5.rst:551 msgid "https://en.wikipedia.org/wiki/Coroutine" msgstr "" @@ -684,6 +847,12 @@ msgid "" "structure is::" msgstr "" +#: whatsnew/2.5.rst:574 +msgid "" +"with expression [as variable]:\n" +" with-block" +msgstr "" + #: whatsnew/2.5.rst:577 msgid "" "The expression is evaluated, and it should result in an object that supports " @@ -712,6 +881,10 @@ msgid "" "directive to your module::" msgstr "" +#: whatsnew/2.5.rst:593 +msgid "from __future__ import with_statement" +msgstr "" + #: whatsnew/2.5.rst:595 msgid "The statement will always be enabled in Python 2.6." msgstr "" @@ -723,6 +896,14 @@ msgid "" "example::" msgstr "" +#: whatsnew/2.5.rst:600 +msgid "" +"with open('/etc/passwd', 'r') as f:\n" +" for line in f:\n" +" print line\n" +" ... more processing code ..." +msgstr "" + #: whatsnew/2.5.rst:605 msgid "" "After this statement has executed, the file object in *f* will have been " @@ -742,6 +923,14 @@ msgid "" "the ':keyword:`with`' statement::" msgstr "" +#: whatsnew/2.5.rst:617 +msgid "" +"lock = threading.Lock()\n" +"with lock:\n" +" # Critical section of code\n" +" ..." +msgstr "" + #: whatsnew/2.5.rst:622 msgid "" "The lock is acquired before the block is executed and always released once " @@ -755,6 +944,20 @@ msgid "" "desired precision and rounding characteristics for computations::" msgstr "" +#: whatsnew/2.5.rst:629 +msgid "" +"from decimal import Decimal, Context, localcontext\n" +"\n" +"# Displays with default precision of 28 digits\n" +"v = Decimal('578')\n" +"print v.sqrt()\n" +"\n" +"with localcontext(Context(prec=16)):\n" +" # All code in this block uses a precision of 16 digits.\n" +" # The original context is restored on exiting the block.\n" +" print v.sqrt()" +msgstr "" + #: whatsnew/2.5.rst:644 msgid "Writing Context Managers" msgstr "" @@ -828,6 +1031,15 @@ msgid "" "will be to let the user write code like this::" msgstr "" +#: whatsnew/2.5.rst:687 +msgid "" +"db_connection = DatabaseConnection()\n" +"with db_connection as cursor:\n" +" cursor.execute('insert into ...')\n" +" cursor.execute('delete from ...')\n" +" # ... more operations ..." +msgstr "" + #: whatsnew/2.5.rst:693 msgid "" "The transaction should be committed if the code in the block runs flawlessly " @@ -835,6 +1047,18 @@ msgid "" "class:`DatabaseConnection` that I'll assume::" msgstr "" +#: whatsnew/2.5.rst:697 +msgid "" +"class DatabaseConnection:\n" +" # Database interface\n" +" def cursor (self):\n" +" \"Returns a cursor object and starts a new transaction\"\n" +" def commit (self):\n" +" \"Commits current transaction\"\n" +" def rollback (self):\n" +" \"Rolls back current transaction\"" +msgstr "" + #: whatsnew/2.5.rst:706 msgid "" "The :meth:`~object.__enter__` method is pretty easy, having only to start a " @@ -844,6 +1068,16 @@ msgid "" "variable name. ::" msgstr "" +#: whatsnew/2.5.rst:711 +msgid "" +"class DatabaseConnection:\n" +" ...\n" +" def __enter__ (self):\n" +" # Code to start a new transaction\n" +" cursor = self.cursor()\n" +" return cursor" +msgstr "" + #: whatsnew/2.5.rst:718 msgid "" "The :meth:`~object.__exit__` method is the most complicated because it's " @@ -860,6 +1094,20 @@ msgid "" "explicit and add a :keyword:`return` statement at the marked location. ::" msgstr "" +#: whatsnew/2.5.rst:728 +msgid "" +"class DatabaseConnection:\n" +" ...\n" +" def __exit__ (self, type, value, tb):\n" +" if tb is None:\n" +" # No exception, so commit\n" +" self.commit()\n" +" else:\n" +" # Exception occurred, so rollback.\n" +" self.rollback()\n" +" # return False" +msgstr "" + #: whatsnew/2.5.rst:743 msgid "The contextlib module" msgstr "" @@ -890,6 +1138,26 @@ msgid "" "decorator as::" msgstr "" +#: whatsnew/2.5.rst:760 +msgid "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def db_transaction (connection):\n" +" cursor = connection.cursor()\n" +" try:\n" +" yield cursor\n" +" except:\n" +" connection.rollback()\n" +" raise\n" +" else:\n" +" connection.commit()\n" +"\n" +"db = DatabaseConnection()\n" +"with db_transaction(db) as cursor:\n" +" ..." +msgstr "" + #: whatsnew/2.5.rst:777 msgid "" "The :mod:`contextlib` module also has a ``nested(mgr1, mgr2, ...)`` function " @@ -899,13 +1167,30 @@ msgid "" "lock::" msgstr "" +#: whatsnew/2.5.rst:782 +msgid "" +"lock = threading.Lock()\n" +"with nested (db_transaction(db), lock) as (cursor, locked):\n" +" ..." +msgstr "" + #: whatsnew/2.5.rst:786 msgid "" "Finally, the ``closing(object)`` function returns *object* so that it can be " "bound to a variable, and calls ``object.close`` at the end of the block. ::" msgstr "" -#: whatsnew/2.5.rst:803 +#: whatsnew/2.5.rst:789 +msgid "" +"import urllib, sys\n" +"from contextlib import closing\n" +"\n" +"with closing(urllib.urlopen('http://www.yahoo.com')) as f:\n" +" for line in f:\n" +" sys.stdout.write(line)" +msgstr "" + +#: whatsnew/2.5.rst:799 msgid ":pep:`343` - The \"with\" statement" msgstr "" @@ -939,6 +1224,15 @@ msgid "" "the inheritance relationships are::" msgstr "" +#: whatsnew/2.5.rst:822 +msgid "" +"BaseException # New in Python 2.5\n" +"|- KeyboardInterrupt\n" +"|- SystemExit\n" +"|- Exception\n" +" |- (all other current built-in exceptions)" +msgstr "" + #: whatsnew/2.5.rst:828 msgid "" "This rearrangement was done because people often want to catch all " @@ -950,6 +1244,17 @@ msgid "" "The usual pattern is::" msgstr "" +#: whatsnew/2.5.rst:835 +msgid "" +"try:\n" +" ...\n" +"except (KeyboardInterrupt, SystemExit):\n" +" raise\n" +"except:\n" +" # Log error...\n" +" # Continue running program..." +msgstr "" + #: whatsnew/2.5.rst:843 msgid "" "In Python 2.5, you can now write ``except Exception`` to achieve the same " @@ -1094,6 +1399,13 @@ msgid "" "example::" msgstr "" +#: whatsnew/2.5.rst:949 +msgid "" +"class C:\n" +" def __index__ (self):\n" +" return self.value" +msgstr "" + #: whatsnew/2.5.rst:953 msgid "" "The return value must be either a Python integer or long integer. The " @@ -1137,6 +1449,17 @@ msgid "" "returns zero for any missing key::" msgstr "" +#: whatsnew/2.5.rst:985 +msgid "" +"class zerodict (dict):\n" +" def __missing__ (self, key):\n" +" return 0\n" +"\n" +"d = zerodict({1:1, 2:2})\n" +"print d[1], d[2] # Prints 1, 2\n" +"print d[3], d[4] # Prints 0, 0" +msgstr "" + #: whatsnew/2.5.rst:993 msgid "" "Both 8-bit and Unicode strings have new ``partition(sep)`` and " @@ -1160,6 +1483,20 @@ msgstr "" msgid "Some examples::" msgstr "" +#: whatsnew/2.5.rst:1007 +msgid "" +">>> ('http://www.python.org').partition('://')\n" +"('http', '://', 'www.python.org')\n" +">>> ('file:/usr/share/doc/index.html').partition('://')\n" +"('file:/usr/share/doc/index.html', '', '')\n" +">>> (u'Subject: a quick question').partition(':')\n" +"(u'Subject', u':', u' a quick question')\n" +">>> 'www.python.org'.rpartition('.')\n" +"('www.python', '.', 'org')\n" +">>> 'www.python.org'.rpartition(':')\n" +"('', '', 'www.python.org')" +msgstr "" + #: whatsnew/2.5.rst:1018 msgid "" "(Implemented by Fredrik Lundh following a suggestion by Raymond Hettinger.)" @@ -1171,6 +1508,12 @@ msgid "" "accept tuples of strings to check for. ::" msgstr "" +#: whatsnew/2.5.rst:1023 +msgid "" +"def is_image_file (filename):\n" +" return filename.endswith(('.gif', '.jpg', '.tiff'))" +msgstr "" + #: whatsnew/2.5.rst:1026 msgid "(Implemented by Georg Brandl following a suggestion by Tom Lynn.)" msgstr "" @@ -1185,6 +1528,15 @@ msgid "" "find the longest string in a list, you can do::" msgstr "" +#: whatsnew/2.5.rst:1037 +msgid "" +"L = ['medium', 'longest', 'short']\n" +"# Prints 'longest'\n" +"print max(L, key=len)\n" +"# Prints 'short', because lexicographically 'short' has the largest value\n" +"print max(L)" +msgstr "" + #: whatsnew/2.5.rst:1043 msgid "(Contributed by Steven Bethard and Raymond Hettinger.)" msgstr "" @@ -1218,6 +1570,10 @@ msgid "" "you might add a line like this near the top of the source file::" msgstr "" +#: whatsnew/2.5.rst:1067 +msgid "# -*- coding: latin1 -*-" +msgstr "" + #: whatsnew/2.5.rst:1069 msgid "" "A new warning, :class:`UnicodeWarning`, is triggered when you attempt to " @@ -1226,6 +1582,17 @@ msgid "" "false::" msgstr "" +#: whatsnew/2.5.rst:1073 +msgid "" +">>> chr(128) == unichr(128) # Can't convert chr(128) to Unicode\n" +"__main__:1: UnicodeWarning: Unicode equal comparison failed\n" +" to convert both arguments to Unicode - interpreting them\n" +" as being unequal\n" +"False\n" +">>> chr(127) == unichr(127) # chr(127) can be converted\n" +"True" +msgstr "" + #: whatsnew/2.5.rst:1081 msgid "" "Previously this would raise a :class:`UnicodeDecodeError` exception, but in " @@ -1266,6 +1633,12 @@ msgid "" "example, this is now legal::" msgstr "" +#: whatsnew/2.5.rst:1105 +msgid "" +"class C():\n" +" pass" +msgstr "" + #: whatsnew/2.5.rst:1108 msgid "(Implemented by Brett Cannon.)" msgstr "" @@ -1281,6 +1654,12 @@ msgid "" "quit::" msgstr "" +#: whatsnew/2.5.rst:1121 +msgid "" +">>> quit\n" +"'Use Ctrl-D (i.e. EOF) to exit.'" +msgstr "" + #: whatsnew/2.5.rst:1124 msgid "" "In Python 2.5, ``quit`` and ``exit`` are now objects that still produce " @@ -1409,7 +1788,7 @@ msgstr "" #: whatsnew/2.5.rst:1225 msgid "" -"The :mod:`audioop` module now supports the a-LAW encoding, and the code for " +"The :mod:`!audioop` module now supports the a-LAW encoding, and the code for " "u-LAW encoding has been improved. (Contributed by Lars Immisch.)" msgstr "" @@ -1444,10 +1823,32 @@ msgid "" "make an index of words based on their initial letter like this::" msgstr "" +#: whatsnew/2.5.rst:1251 +msgid "" +"words = \"\"\"Nel mezzo del cammin di nostra vita\n" +"mi ritrovai per una selva oscura\n" +"che la diritta via era smarrita\"\"\".lower().split()\n" +"\n" +"index = defaultdict(list)\n" +"\n" +"for w in words:\n" +" init_letter = w[0]\n" +" index[init_letter].append(w)" +msgstr "" + #: whatsnew/2.5.rst:1261 msgid "Printing ``index`` results in the following output::" msgstr "" +#: whatsnew/2.5.rst:1263 +msgid "" +"defaultdict(, {'c': ['cammin', 'che'], 'e': ['era'],\n" +" 'd': ['del', 'di', 'diritta'], 'm': ['mezzo', 'mi'],\n" +" 'l': ['la'], 'o': ['oscura'], 'n': ['nel', 'nostra'],\n" +" 'p': ['per'], 's': ['selva', 'smarrita'],\n" +" 'r': ['ritrovai'], 'u': ['una'], 'v': ['vita', 'via']}" +msgstr "" + #: whatsnew/2.5.rst:1269 msgid "(Contributed by Guido van Rossum.)" msgstr "" @@ -1522,6 +1923,14 @@ msgid "" "and :func:`time.strftime`::" msgstr "" +#: whatsnew/2.5.rst:1316 +msgid "" +"from datetime import datetime\n" +"\n" +"ts = datetime.strptime('10:13:15 2006-03-07',\n" +" '%H:%M:%S %Y-%m-%d')" +msgstr "" + #: whatsnew/2.5.rst:1321 msgid "" "The :meth:`SequenceMatcher.get_matching_blocks` method in the :mod:`difflib` " @@ -1582,6 +1991,16 @@ msgid "" "example::" msgstr "" +#: whatsnew/2.5.rst:1366 +msgid "" +">>> import heapq\n" +">>> L = [\"short\", 'medium', 'longest', 'longer still']\n" +">>> heapq.nsmallest(2, L) # Return two lowest elements, lexicographically\n" +"['longer still', 'longest']\n" +">>> heapq.nsmallest(2, L, key=len) # Return two shortest elements\n" +"['short', 'medium']" +msgstr "" + #: whatsnew/2.5.rst:1382 msgid "(Contributed by Raymond Hettinger.)" msgstr "" @@ -1593,6 +2012,12 @@ msgid "" "objects, so that you can now write the following::" msgstr "" +#: whatsnew/2.5.rst:1379 +msgid "" +"s = slice(5) # Create slice object\n" +"itertools.islice(iterable, s.start, s.stop, s.step)" +msgstr "" + #: whatsnew/2.5.rst:1384 msgid "" "The :func:`format` function in the :mod:`locale` module has been modified " @@ -1637,6 +2062,19 @@ msgid "" "into an mbox-format one::" msgstr "" +#: whatsnew/2.5.rst:1412 +msgid "" +"import mailbox\n" +"\n" +"# 'factory=None' uses email.Message.Message as the class representing\n" +"# individual messages.\n" +"src = mailbox.Maildir('maildir', factory=None)\n" +"dest = mailbox.mbox('/tmp/mbox')\n" +"\n" +"for msg in src:\n" +" dest.add(msg)" +msgstr "" + #: whatsnew/2.5.rst:1422 msgid "" "(Contributed by Gregory K. Johnson. Funding was provided by Google's 2005 " @@ -1645,16 +2083,16 @@ msgstr "" #: whatsnew/2.5.rst:1425 msgid "" -"New module: the :mod:`msilib` module allows creating Microsoft Installer :" +"New module: the :mod:`!msilib` module allows creating Microsoft Installer :" "file:`.msi` files and CAB files. Some support for reading the :file:`.msi` " "database is also included. (Contributed by Martin von Löwis.)" msgstr "" #: whatsnew/2.5.rst:1429 msgid "" -"The :mod:`nis` module now supports accessing domains other than the system " -"default domain by supplying a *domain* argument to the :func:`nis.match` " -"and :func:`nis.maps` functions. (Contributed by Ben Bell.)" +"The :mod:`!nis` module now supports accessing domains other than the system " +"default domain by supplying a *domain* argument to the :func:`!nis.match` " +"and :func:`!nis.maps` functions. (Contributed by Ben Bell.)" msgstr "" #: whatsnew/2.5.rst:1433 @@ -1825,7 +2263,7 @@ msgstr "" #: whatsnew/2.5.rst:1545 msgid "" -"New module: the :mod:`spwd` module provides functions for accessing the " +"New module: the :mod:`!spwd` module provides functions for accessing the " "shadow password database on systems that support shadow passwords." msgstr "" @@ -1839,6 +2277,14 @@ msgid "" "them. Or you can use :class:`Struct` instances directly::" msgstr "" +#: whatsnew/2.5.rst:1555 +msgid "" +"s = struct.Struct('ih3s')\n" +"\n" +"data = s.pack(1972, 187, 'abc')\n" +"year, number, name = s.unpack(data)" +msgstr "" + #: whatsnew/2.5.rst:1560 msgid "" "You can also pack and unpack data to and from buffer objects directly using " @@ -1922,6 +2368,26 @@ msgid "" "module.) ::" msgstr "" +#: whatsnew/2.5.rst:1615 +msgid "" +">>> import uuid\n" +">>> # make a UUID based on the host ID and current time\n" +">>> uuid.uuid1()\n" +"UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n" +"\n" +">>> # make a UUID using an MD5 hash of a namespace UUID and a name\n" +">>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n" +"\n" +">>> # make a random UUID\n" +">>> uuid.uuid4()\n" +"UUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n" +"\n" +">>> # make a UUID using a SHA-1 hash of a namespace UUID and a name\n" +">>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')" +msgstr "" + #: whatsnew/2.5.rst:1632 msgid "(Contributed by Ka-Ping Yee.)" msgstr "" @@ -1995,6 +2461,14 @@ msgid "" "attributes of the :class:`CDLL` object. ::" msgstr "" +#: whatsnew/2.5.rst:1692 +msgid "" +"import ctypes\n" +"\n" +"libc = ctypes.CDLL('libc.so.6')\n" +"result = libc.printf(\"Line of output\\n\")" +msgstr "" + #: whatsnew/2.5.rst:1697 msgid "" "Type constructors for the various C types are provided: :func:`c_int`, :func:" @@ -2015,26 +2489,52 @@ msgid "" "modifiable memory area, use :func:`create_string_buffer`::" msgstr "" +#: whatsnew/2.5.rst:1711 +msgid "" +"s = \"this is a string\"\n" +"buf = ctypes.create_string_buffer(s)\n" +"libc.strfry(buf)" +msgstr "" + #: whatsnew/2.5.rst:1715 msgid "" "C functions are assumed to return integers, but you can set the :attr:" "`restype` attribute of the function object to change this::" msgstr "" +#: whatsnew/2.5.rst:1718 +msgid "" +">>> libc.atof('2.71828')\n" +"-1783957616\n" +">>> libc.atof.restype = ctypes.c_double\n" +">>> libc.atof('2.71828')\n" +"2.71828" +msgstr "" + #: whatsnew/2.5.rst:1724 msgid "" ":mod:`ctypes` also provides a wrapper for Python's C API as the ``ctypes." "pythonapi`` object. This object does *not* release the global interpreter " "lock before calling a function, because the lock must be held when calling " -"into the interpreter's code. There's a :class:`py_object()` type " +"into the interpreter's code. There's a :class:`~ctypes.py_object` type " "constructor that will create a :c:expr:`PyObject *` pointer. A simple " "usage::" msgstr "" +#: whatsnew/2.5.rst:1730 +msgid "" +"import ctypes\n" +"\n" +"d = {}\n" +"ctypes.pythonapi.PyObject_SetItem(ctypes.py_object(d),\n" +" ctypes.py_object(\"abc\"), ctypes.py_object(1))\n" +"# d is now {'abc', 1}." +msgstr "" + #: whatsnew/2.5.rst:1737 msgid "" -"Don't forget to use :class:`py_object()`; if it's omitted you end up with a " -"segmentation fault." +"Don't forget to use :func:`~ctypes.py_object`; if it's omitted you end up " +"with a segmentation fault." msgstr "" #: whatsnew/2.5.rst:1740 @@ -2046,7 +2546,7 @@ msgid "" "modules, now that :mod:`ctypes` is included with core Python." msgstr "" -#: whatsnew/2.5.rst:1750 +#: whatsnew/2.5.rst:1749 msgid "" "https://web.archive.org/web/20180410025338/http://starship.python.net/crew/" "theller/ctypes/" @@ -2096,6 +2596,17 @@ msgid "" "an :class:`ElementTree` instance::" msgstr "" +#: whatsnew/2.5.rst:1782 +msgid "" +"from xml.etree import ElementTree as ET\n" +"\n" +"tree = ET.parse('ex-1.xml')\n" +"\n" +"feed = urllib.urlopen(\n" +" 'http://planet.python.org/rss10.xml')\n" +"tree = ET.parse(feed)" +msgstr "" + #: whatsnew/2.5.rst:1790 msgid "" "Once you have an :class:`ElementTree` instance, you can call its :meth:" @@ -2110,6 +2621,14 @@ msgid "" "convenience of an XML literal::" msgstr "" +#: whatsnew/2.5.rst:1798 +msgid "" +"svg = ET.XML(\"\"\"\n" +" \"\"\")\n" +"svg.set('height', '320px')\n" +"svg.append(elem1)" +msgstr "" + #: whatsnew/2.5.rst:1803 msgid "" "Each XML element supports some dictionary-like and some list-like access " @@ -2228,6 +2747,14 @@ msgid "" "instructions::" msgstr "" +#: whatsnew/2.5.rst:1840 +msgid "" +"if elem.tag is ET.Comment:\n" +" ...\n" +"elif elem.tag is ET.ProcessingInstruction:\n" +" ..." +msgstr "" + #: whatsnew/2.5.rst:1845 msgid "" "To generate XML output, you should call the :meth:`ElementTree.write` " @@ -2235,6 +2762,16 @@ msgid "" "object::" msgstr "" +#: whatsnew/2.5.rst:1848 +msgid "" +"# Encoding is US-ASCII\n" +"tree.write('output.xml')\n" +"\n" +"# Encoding is UTF-8\n" +"f = open('output.xml', 'w')\n" +"tree.write(f, encoding='utf-8')" +msgstr "" + #: whatsnew/2.5.rst:1855 msgid "" "(Caution: the default encoding used for output is ASCII. For general XML " @@ -2283,6 +2820,32 @@ msgid "" "hashing objects are named differently. ::" msgstr "" +#: whatsnew/2.5.rst:1891 +msgid "" +"# Old versions\n" +"h = md5.md5()\n" +"h = md5.new()\n" +"\n" +"# New version\n" +"h = hashlib.md5()\n" +"\n" +"# Old versions\n" +"h = sha.sha()\n" +"h = sha.new()\n" +"\n" +"# New version\n" +"h = hashlib.sha1()\n" +"\n" +"# Hash that weren't previously available\n" +"h = hashlib.sha224()\n" +"h = hashlib.sha256()\n" +"h = hashlib.sha384()\n" +"h = hashlib.sha512()\n" +"\n" +"# Alternative form\n" +"h = hashlib.new('md5') # Provide algorithm as a string" +msgstr "" + #: whatsnew/2.5.rst:1914 msgid "" "Once a hash object has been created, its methods are the same as before: " @@ -2339,6 +2902,10 @@ msgid "" "example` file::" msgstr "" +#: whatsnew/2.5.rst:1956 +msgid "conn = sqlite3.connect('/tmp/example')" +msgstr "" + #: whatsnew/2.5.rst:1958 msgid "" "You can also supply the special name ``:memory:`` to create a database in " @@ -2351,6 +2918,20 @@ msgid "" "object and call its :meth:`execute` method to perform SQL commands::" msgstr "" +#: whatsnew/2.5.rst:1963 +msgid "" +"c = conn.cursor()\n" +"\n" +"# Create table\n" +"c.execute('''create table stocks\n" +"(date text, trans text, symbol text,\n" +" qty real, price real)''')\n" +"\n" +"# Insert a row of data\n" +"c.execute(\"\"\"insert into stocks\n" +" values ('2006-01-05','BUY','RHAT',100,35.14)\"\"\")" +msgstr "" + #: whatsnew/2.5.rst:1974 msgid "" "Usually your SQL operations will need to use values from Python variables. " @@ -2368,6 +2949,24 @@ msgid "" "``:1``.) For example::" msgstr "" +#: whatsnew/2.5.rst:1983 +msgid "" +"# Never do this -- insecure!\n" +"symbol = 'IBM'\n" +"c.execute(\"... where symbol = '%s'\" % symbol)\n" +"\n" +"# Do this instead\n" +"t = (symbol,)\n" +"c.execute('select * from stocks where symbol=?', t)\n" +"\n" +"# Larger example\n" +"for t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00),\n" +" ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00),\n" +" ('2006-04-06', 'SELL', 'IBM', 500, 53.00),\n" +" ):\n" +" c.execute('insert into stocks values (?,?,?,?,?)', t)" +msgstr "" + #: whatsnew/2.5.rst:1998 msgid "" "To retrieve data after executing a SELECT statement, you can either treat " @@ -2380,13 +2979,27 @@ msgstr "" msgid "This example uses the iterator form::" msgstr "" +#: whatsnew/2.5.rst:2005 +msgid "" +">>> c = conn.cursor()\n" +">>> c.execute('select * from stocks order by price')\n" +">>> for row in c:\n" +"... print row\n" +"...\n" +"(u'2006-01-05', u'BUY', u'RHAT', 100, 35.140000000000001)\n" +"(u'2006-03-28', u'BUY', u'IBM', 1000, 45.0)\n" +"(u'2006-04-06', u'SELL', u'IBM', 500, 53.0)\n" +"(u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0)\n" +">>>" +msgstr "" + #: whatsnew/2.5.rst:2016 msgid "" "For more information about the SQL dialect supported by SQLite, see https://" "www.sqlite.org." msgstr "" -#: whatsnew/2.5.rst:2023 +#: whatsnew/2.5.rst:2022 msgid "https://www.pysqlite.org" msgstr "" @@ -2394,7 +3007,7 @@ msgstr "" msgid "The pysqlite web page." msgstr "" -#: whatsnew/2.5.rst:2027 +#: whatsnew/2.5.rst:2025 msgid "https://www.sqlite.org" msgstr "" @@ -2435,7 +3048,19 @@ msgid "" "Setting up a server takes only a few lines of code::" msgstr "" -#: whatsnew/2.5.rst:2069 +#: whatsnew/2.5.rst:2053 +msgid "" +"from wsgiref import simple_server\n" +"\n" +"wsgi_app = ...\n" +"\n" +"host = ''\n" +"port = 8000\n" +"httpd = simple_server.make_server(host, port, wsgi_app)\n" +"httpd.serve_forever()" +msgstr "" + +#: whatsnew/2.5.rst:2068 msgid "" "https://web.archive.org/web/20160331090247/http://wsgi.readthedocs.org/en/" "latest/" @@ -2500,6 +3125,18 @@ msgid "" "the *flags* parameter::" msgstr "" +#: whatsnew/2.5.rst:2108 +msgid "" +"from _ast import PyCF_ONLY_AST\n" +"ast = compile(\"\"\"a=0\n" +"for i in range(10):\n" +" a += i\n" +"\"\"\", \"\", 'exec', PyCF_ONLY_AST)\n" +"\n" +"assignment = ast.body[0]\n" +"for_loop = ast.body[1]" +msgstr "" + #: whatsnew/2.5.rst:2117 msgid "" "No official documentation has been written for the AST code yet, but :pep:" @@ -2576,15 +3213,14 @@ msgstr "" #: whatsnew/2.5.rst:2170 msgid "" "Two new macros can be used to indicate C functions that are local to the " -"current file so that a faster calling convention can be used. " -"``Py_LOCAL(type)`` declares the function as returning a value of the " -"specified *type* and uses a fast-calling qualifier. " -"``Py_LOCAL_INLINE(type)`` does the same thing and also requests the function " -"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before :" -"file:`python.h` is included, a set of more aggressive optimizations are " -"enabled for the module; you should benchmark the results to find out if " -"these optimizations actually make the code faster. (Contributed by Fredrik " -"Lundh at the NeedForSpeed sprint.)" +"current file so that a faster calling convention can be used. :c:macro:" +"`Py_LOCAL` declares the function as returning a value of the specified " +"*type* and uses a fast-calling qualifier. :c:macro:`Py_LOCAL_INLINE` does " +"the same thing and also requests the function be inlined. If macro :c:macro:" +"`!PY_LOCAL_AGGRESSIVE` is defined before :file:`python.h` is included, a set " +"of more aggressive optimizations are enabled for the module; you should " +"benchmark the results to find out if these optimizations actually make the " +"code faster. (Contributed by Fredrik Lundh at the NeedForSpeed sprint.)" msgstr "" #: whatsnew/2.5.rst:2181 @@ -2617,6 +3253,12 @@ msgid "" "something like the following::" msgstr "" +#: whatsnew/2.5.rst:2199 +msgid "" +"range = PyObject_CallFunction((PyObject*) &PyRange_Type, \"lll\",\n" +" start, stop, step);" +msgstr "" + #: whatsnew/2.5.rst:2208 msgid "Port-Specific Changes" msgstr "" diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index d33f29ab..a8d9cc1d 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -41,7 +42,7 @@ msgid "" "incorporates new features and syntax from 3.0 while remaining compatible " "with existing code by not removing older features or syntax. When it's not " "possible to do that, Python 2.6 tries to do what it can, adding " -"compatibility functions in a :mod:`future_builtins` module and a :option:" +"compatibility functions in a :mod:`!future_builtins` module and a :option:" "`!-3` switch to warn about usages that will become unsupported in 3.0." msgstr "" @@ -112,7 +113,7 @@ msgid "" "Python 3.0 adds several new built-in functions and changes the semantics of " "some existing builtins. Functions that are new in 3.0 such as :func:`bin` " "have simply been added to Python 2.6, but existing builtins haven't been " -"changed; instead, the :mod:`future_builtins` module has versions with the " +"changed; instead, the :mod:`!future_builtins` module has versions with the " "new 3.0 semantics. Code written to be compatible with 3.0 can do ``from " "future_builtins import hex, map`` as necessary." msgstr "" @@ -122,8 +123,8 @@ msgid "" "A new command-line switch, :option:`!-3`, enables warnings about features " "that will be removed in Python 3.0. You can run code with this switch to " "see how much work will be necessary to port code to 3.0. The value of this " -"switch is available to Python code as the boolean variable :data:`sys." -"py3kwarning`, and to C extension code as :c:data:`Py_Py3kWarningFlag`." +"switch is available to Python code as the boolean variable :data:`!sys." +"py3kwarning`, and to C extension code as :c:data:`!Py_Py3kWarningFlag`." msgstr "" #: whatsnew/2.6.rst:126 @@ -192,7 +193,7 @@ msgid "" "wishing to move from SourceForge to Roundup." msgstr "" -#: whatsnew/2.6.rst:183 +#: whatsnew/2.6.rst:182 msgid "https://bugs.python.org" msgstr "" @@ -200,7 +201,7 @@ msgstr "" msgid "The Python bug tracker." msgstr "" -#: whatsnew/2.6.rst:186 +#: whatsnew/2.6.rst:185 msgid "https://bugs.jython.org:" msgstr "" @@ -208,7 +209,7 @@ msgstr "" msgid "The Jython bug tracker." msgstr "" -#: whatsnew/2.6.rst:189 +#: whatsnew/2.6.rst:188 msgid "https://roundup.sourceforge.io/" msgstr "" @@ -273,7 +274,7 @@ msgid "" "tool." msgstr "" -#: whatsnew/2.6.rst:234 +#: whatsnew/2.6.rst:233 msgid "`Documenting Python `__" msgstr "" @@ -281,7 +282,7 @@ msgstr "" msgid "Describes how to write for Python's documentation." msgstr "" -#: whatsnew/2.6.rst:237 +#: whatsnew/2.6.rst:236 msgid "`Sphinx `__" msgstr "" @@ -327,6 +328,12 @@ msgid "" "structure is::" msgstr "" +#: whatsnew/2.6.rst:266 +msgid "" +"with expression [as variable]:\n" +" with-block" +msgstr "" + #: whatsnew/2.6.rst:269 msgid "" "The expression is evaluated, and it should result in an object that supports " @@ -356,6 +363,14 @@ msgid "" "example::" msgstr "" +#: whatsnew/2.6.rst:285 +msgid "" +"with open('/etc/passwd', 'r') as f:\n" +" for line in f:\n" +" print line\n" +" ... more processing code ..." +msgstr "" + #: whatsnew/2.6.rst:290 msgid "" "After this statement has executed, the file object in *f* will have been " @@ -375,6 +390,14 @@ msgid "" "the ':keyword:`with`' statement::" msgstr "" +#: whatsnew/2.6.rst:302 +msgid "" +"lock = threading.Lock()\n" +"with lock:\n" +" # Critical section of code\n" +" ..." +msgstr "" + #: whatsnew/2.6.rst:307 msgid "" "The lock is acquired before the block is executed and always released once " @@ -383,9 +406,24 @@ msgstr "" #: whatsnew/2.6.rst:310 msgid "" -"The :func:`localcontext` function in the :mod:`decimal` module makes it easy " -"to save and restore the current decimal context, which encapsulates the " -"desired precision and rounding characteristics for computations::" +"The :func:`~decimal.localcontext` function in the :mod:`decimal` module " +"makes it easy to save and restore the current decimal context, which " +"encapsulates the desired precision and rounding characteristics for " +"computations::" +msgstr "" + +#: whatsnew/2.6.rst:314 +msgid "" +"from decimal import Decimal, Context, localcontext\n" +"\n" +"# Displays with default precision of 28 digits\n" +"v = Decimal('578')\n" +"print v.sqrt()\n" +"\n" +"with localcontext(Context(prec=16)):\n" +" # All code in this block uses a precision of 16 digits.\n" +" # The original context is restored on exiting the block.\n" +" print v.sqrt()" msgstr "" #: whatsnew/2.6.rst:329 @@ -463,11 +501,32 @@ msgid "" "will be to let the user write code like this::" msgstr "" +#: whatsnew/2.6.rst:373 +msgid "" +"db_connection = DatabaseConnection()\n" +"with db_connection as cursor:\n" +" cursor.execute('insert into ...')\n" +" cursor.execute('delete from ...')\n" +" # ... more operations ..." +msgstr "" + #: whatsnew/2.6.rst:379 msgid "" "The transaction should be committed if the code in the block runs flawlessly " "or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"class:`!DatabaseConnection` that I'll assume::" +msgstr "" + +#: whatsnew/2.6.rst:383 +msgid "" +"class DatabaseConnection:\n" +" # Database interface\n" +" def cursor(self):\n" +" \"Returns a cursor object and starts a new transaction\"\n" +" def commit(self):\n" +" \"Commits current transaction\"\n" +" def rollback(self):\n" +" \"Rolls back current transaction\"" msgstr "" #: whatsnew/2.6.rst:392 @@ -479,6 +538,16 @@ msgid "" "variable name. ::" msgstr "" +#: whatsnew/2.6.rst:397 +msgid "" +"class DatabaseConnection:\n" +" ...\n" +" def __enter__(self):\n" +" # Code to start a new transaction\n" +" cursor = self.cursor()\n" +" return cursor" +msgstr "" + #: whatsnew/2.6.rst:404 msgid "" "The :meth:`~object.__exit__` method is the most complicated because it's " @@ -495,6 +564,20 @@ msgid "" "explicit and add a :keyword:`return` statement at the marked location. ::" msgstr "" +#: whatsnew/2.6.rst:414 +msgid "" +"class DatabaseConnection:\n" +" ...\n" +" def __exit__(self, type, value, tb):\n" +" if tb is None:\n" +" # No exception, so commit\n" +" self.commit()\n" +" else:\n" +" # Exception occurred, so rollback.\n" +" self.rollback()\n" +" # return False" +msgstr "" + #: whatsnew/2.6.rst:429 msgid "The contextlib module" msgstr "" @@ -507,24 +590,44 @@ msgstr "" #: whatsnew/2.6.rst:434 msgid "" -"The decorator is called :func:`contextmanager`, and lets you write a single " -"generator function instead of defining a new class. The generator should " -"yield exactly one value. The code up to the :keyword:`yield` will be " -"executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " -"the :keyword:`!yield` will be executed in the :meth:`~object.__exit__` " -"method. Any exception raised in the block will be raised by the :keyword:`!" -"yield` statement." +"The decorator is called :func:`~contextlib.contextmanager`, and lets you " +"write a single generator function instead of defining a new class. The " +"generator should yield exactly one value. The code up to the :keyword:" +"`yield` will be executed as the :meth:`~object.__enter__` method, and the " +"value yielded will be the method's return value that will get bound to the " +"variable in the ':keyword:`with`' statement's :keyword:`!as` clause, if " +"any. The code after the :keyword:`!yield` will be executed in the :meth:" +"`~object.__exit__` method. Any exception raised in the block will be raised " +"by the :keyword:`!yield` statement." msgstr "" -#: whatsnew/2.6.rst:443 +#: whatsnew/2.6.rst:444 msgid "" "Using this decorator, our database example from the previous section could " "be written as::" msgstr "" -#: whatsnew/2.6.rst:463 +#: whatsnew/2.6.rst:447 +msgid "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def db_transaction(connection):\n" +" cursor = connection.cursor()\n" +" try:\n" +" yield cursor\n" +" except:\n" +" connection.rollback()\n" +" raise\n" +" else:\n" +" connection.commit()\n" +"\n" +"db = DatabaseConnection()\n" +"with db_transaction(db) as cursor:\n" +" ..." +msgstr "" + +#: whatsnew/2.6.rst:464 msgid "" "The :mod:`contextlib` module also has a ``nested(mgr1, mgr2, ...)`` function " "that combines a number of context managers so you don't need to write nested " @@ -533,18 +636,35 @@ msgid "" "lock::" msgstr "" -#: whatsnew/2.6.rst:472 +#: whatsnew/2.6.rst:469 msgid "" -"Finally, the :func:`closing` function returns its argument so that it can be " -"bound to a variable, and calls the argument's ``.close()`` method at the end " -"of the block. ::" +"lock = threading.Lock()\n" +"with nested (db_transaction(db), lock) as (cursor, locked):\n" +" ..." msgstr "" -#: whatsnew/2.6.rst:490 -msgid ":pep:`343` - The \"with\" statement" +#: whatsnew/2.6.rst:473 +msgid "" +"Finally, the :func:`~contextlib.closing` function returns its argument so " +"that it can be bound to a variable, and calls the argument's ``.close()`` " +"method at the end of the block. ::" +msgstr "" + +#: whatsnew/2.6.rst:477 +msgid "" +"import urllib, sys\n" +"from contextlib import closing\n" +"\n" +"with closing(urllib.urlopen('http://www.yahoo.com')) as f:\n" +" for line in f:\n" +" sys.stdout.write(line)" msgstr "" #: whatsnew/2.6.rst:487 +msgid ":pep:`343` - The \"with\" statement" +msgstr "" + +#: whatsnew/2.6.rst:488 msgid "" "PEP written by Guido van Rossum and Nick Coghlan; implemented by Mike Bland, " "Guido van Rossum, and Neal Norwitz. The PEP shows the code generated for a " @@ -552,41 +672,41 @@ msgid "" "statement works." msgstr "" -#: whatsnew/2.6.rst:492 +#: whatsnew/2.6.rst:493 msgid "The documentation for the :mod:`contextlib` module." msgstr "" -#: whatsnew/2.6.rst:499 +#: whatsnew/2.6.rst:500 msgid "PEP 366: Explicit Relative Imports From a Main Module" msgstr "" -#: whatsnew/2.6.rst:501 +#: whatsnew/2.6.rst:502 msgid "" "Python's :option:`-m` switch allows running a module as a script. When you " "ran a module that was located inside a package, relative imports didn't work " "correctly." msgstr "" -#: whatsnew/2.6.rst:505 +#: whatsnew/2.6.rst:506 msgid "" -"The fix for Python 2.6 adds a :attr:`__package__` attribute to modules. " -"When this attribute is present, relative imports will be relative to the " -"value of this attribute instead of the :attr:`__name__` attribute." +"The fix for Python 2.6 adds a :attr:`module.__package__` attribute. When " +"this attribute is present, relative imports will be relative to the value of " +"this attribute instead of the :attr:`~module.__name__` attribute." msgstr "" -#: whatsnew/2.6.rst:510 +#: whatsnew/2.6.rst:511 msgid "" -"PEP 302-style importers can then set :attr:`__package__` as necessary. The :" -"mod:`runpy` module that implements the :option:`-m` switch now does this, so " -"relative imports will now work correctly in scripts running from inside a " -"package." +"PEP 302-style importers can then set :attr:`~module.__package__` as " +"necessary. The :mod:`runpy` module that implements the :option:`-m` switch " +"now does this, so relative imports will now work correctly in scripts " +"running from inside a package." msgstr "" -#: whatsnew/2.6.rst:520 +#: whatsnew/2.6.rst:521 msgid "PEP 370: Per-user ``site-packages`` Directory" msgstr "" -#: whatsnew/2.6.rst:522 +#: whatsnew/2.6.rst:523 msgid "" "When you run Python, the module search path ``sys.path`` usually includes a " "directory whose path ends in ``\"site-packages\"``. This directory is " @@ -594,56 +714,56 @@ msgid "" "machine or a particular site installation." msgstr "" -#: whatsnew/2.6.rst:527 +#: whatsnew/2.6.rst:528 msgid "" "Python 2.6 introduces a convention for user-specific site directories. The " "directory varies depending on the platform:" msgstr "" -#: whatsnew/2.6.rst:530 +#: whatsnew/2.6.rst:531 msgid "Unix and Mac OS X: :file:`~/.local/`" msgstr "" -#: whatsnew/2.6.rst:531 +#: whatsnew/2.6.rst:532 msgid "Windows: :file:`%APPDATA%/Python`" msgstr "" -#: whatsnew/2.6.rst:533 +#: whatsnew/2.6.rst:534 msgid "" "Within this directory, there will be version-specific subdirectories, such " "as :file:`lib/python2.6/site-packages` on Unix/Mac OS and :file:`Python26/" "site-packages` on Windows." msgstr "" -#: whatsnew/2.6.rst:537 +#: whatsnew/2.6.rst:538 msgid "" "If you don't like the default directory, it can be overridden by an " "environment variable. :envvar:`PYTHONUSERBASE` sets the root directory used " "for all Python versions supporting this feature. On Windows, the directory " -"for application-specific data can be changed by setting the :envvar:" -"`APPDATA` environment variable. You can also modify the :file:`site.py` " -"file for your Python installation." +"for application-specific data can be changed by setting the :envvar:`!" +"APPDATA` environment variable. You can also modify the :file:`site.py` file " +"for your Python installation." msgstr "" -#: whatsnew/2.6.rst:544 +#: whatsnew/2.6.rst:545 msgid "" "The feature can be disabled entirely by running Python with the :option:`-s` " "option or setting the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: whatsnew/2.6.rst:550 +#: whatsnew/2.6.rst:551 msgid ":pep:`370` - Per-user ``site-packages`` Directory" msgstr "" -#: whatsnew/2.6.rst:551 +#: whatsnew/2.6.rst:552 msgid "PEP written and implemented by Christian Heimes." msgstr "" -#: whatsnew/2.6.rst:559 +#: whatsnew/2.6.rst:560 msgid "PEP 371: The ``multiprocessing`` Package" msgstr "" -#: whatsnew/2.6.rst:561 +#: whatsnew/2.6.rst:562 msgid "" "The new :mod:`multiprocessing` package lets Python programs create new " "processes that will perform a computation and return a result to the " @@ -652,26 +772,61 @@ msgid "" "share simple arrays of data." msgstr "" -#: whatsnew/2.6.rst:567 +#: whatsnew/2.6.rst:568 msgid "" "The :mod:`multiprocessing` module started out as an exact emulation of the :" "mod:`threading` module using processes instead of threads. That goal was " "discarded along the path to Python 2.6, but the general approach of the " -"module is still similar. The fundamental class is the :class:`Process`, " -"which is passed a callable object and a collection of arguments. The :meth:" -"`start` method sets the callable running in a subprocess, after which you " -"can call the :meth:`is_alive` method to check whether the subprocess is " -"still running and the :meth:`join` method to wait for the process to exit." +"module is still similar. The fundamental class is the :class:" +"`~multiprocessing.Process`, which is passed a callable object and a " +"collection of arguments. The :meth:`~multiprocessing.Process.start` method " +"sets the callable running in a subprocess, after which you can call the :" +"meth:`~multiprocessing.Process.is_alive` method to check whether the " +"subprocess is still running and the :meth:`~multiprocessing.Process.join` " +"method to wait for the process to exit." msgstr "" -#: whatsnew/2.6.rst:577 +#: whatsnew/2.6.rst:579 msgid "" "Here's a simple example where the subprocess will calculate a factorial. " "The function doing the calculation is written strangely so that it takes " "significantly longer when the input argument is a multiple of 4." msgstr "" -#: whatsnew/2.6.rst:614 +#: whatsnew/2.6.rst:586 +msgid "" +"import time\n" +"from multiprocessing import Process, Queue\n" +"\n" +"\n" +"def factorial(queue, N):\n" +" \"Compute a factorial.\"\n" +" # If N is a multiple of 4, this function will take much longer.\n" +" if (N % 4) == 0:\n" +" time.sleep(.05 * N/4)\n" +"\n" +" # Calculate the result\n" +" fact = 1L\n" +" for i in range(1, N+1):\n" +" fact = fact * i\n" +"\n" +" # Put the result on the queue\n" +" queue.put(fact)\n" +"\n" +"if __name__ == '__main__':\n" +" queue = Queue()\n" +"\n" +" N = 5\n" +"\n" +" p = Process(target=factorial, args=(queue, N))\n" +" p.start()\n" +" p.join()\n" +"\n" +" result = queue.get()\n" +" print 'Factorial', N, '=', result" +msgstr "" + +#: whatsnew/2.6.rst:616 msgid "" "A :class:`~queue.Queue` is used to communicate the result of the factorial. " "The :class:`~queue.Queue` object is stored in a global variable. The child " @@ -681,64 +836,136 @@ msgid "" "variable, the child's value would be unaffected, and vice versa.)" msgstr "" -#: whatsnew/2.6.rst:622 +#: whatsnew/2.6.rst:624 msgid "" -"Two other classes, :class:`Pool` and :class:`Manager`, provide higher-level " -"interfaces. :class:`Pool` will create a fixed number of worker processes, " -"and requests can then be distributed to the workers by calling :meth:`apply` " -"or :meth:`apply_async` to add a single request, and :meth:`map` or :meth:" -"`map_async` to add a number of requests. The following code uses a :class:" -"`Pool` to spread requests across 5 worker processes and retrieve a list of " -"results::" +"Two other classes, :class:`~multiprocessing.pool.Pool` and :class:" +"`~multiprocessing.Manager`, provide higher-level interfaces. :class:" +"`~multiprocessing.pool.Pool` will create a fixed number of worker processes, " +"and requests can then be distributed to the workers by calling :meth:" +"`~multiprocessing.pool.Pool.apply` or :meth:`~multiprocessing.pool.Pool." +"apply_async` to add a single request, and :meth:`~multiprocessing.pool.Pool." +"map` or :meth:`~multiprocessing.pool.Pool.map_async` to add a number of " +"requests. The following code uses a :class:`~multiprocessing.pool.Pool` to " +"spread requests across 5 worker processes and retrieve a list of results::" msgstr "" -#: whatsnew/2.6.rst:640 +#: whatsnew/2.6.rst:635 +msgid "" +"from multiprocessing import Pool\n" +"\n" +"def factorial(N, dictionary):\n" +" \"Compute a factorial.\"\n" +" ...\n" +"p = Pool(5)\n" +"result = p.map(factorial, range(1, 1000, 10))\n" +"for v in result:\n" +" print v" +msgstr "" + +#: whatsnew/2.6.rst:645 msgid "This produces the following output::" msgstr "" -#: whatsnew/2.6.rst:649 +#: whatsnew/2.6.rst:647 +msgid "" +"1\n" +"39916800\n" +"51090942171709440000\n" +"8222838654177922817725562880000000\n" +"33452526613163807108170062053440751665152000000000\n" +"..." +msgstr "" + +#: whatsnew/2.6.rst:654 msgid "" -"The other high-level interface, the :class:`Manager` class, creates a " -"separate server process that can hold master copies of Python data " +"The other high-level interface, the :class:`~multiprocessing.Manager` class, " +"creates a separate server process that can hold master copies of Python data " "structures. Other processes can then access and modify these data " "structures using proxy objects. The following example creates a shared " "dictionary by calling the :meth:`dict` method; the worker processes then " "insert values into the dictionary. (Locking is not done for you " -"automatically, which doesn't matter in this example. :class:`Manager`'s " -"methods also include :meth:`Lock`, :meth:`RLock`, and :meth:`Semaphore` to " +"automatically, which doesn't matter in this example. :class:" +"`~multiprocessing.Manager`'s methods also include :meth:`~multiprocessing." +"managers.SyncManager.Lock`, :meth:`~multiprocessing.managers.SyncManager." +"RLock`, and :meth:`~multiprocessing.managers.SyncManager.Semaphore` to " "create shared locks.)" msgstr "" -#: whatsnew/2.6.rst:693 +#: whatsnew/2.6.rst:669 +msgid "" +"import time\n" +"from multiprocessing import Pool, Manager\n" +"\n" +"def factorial(N, dictionary):\n" +" \"Compute a factorial.\"\n" +" # Calculate the result\n" +" fact = 1L\n" +" for i in range(1, N+1):\n" +" fact = fact * i\n" +"\n" +" # Store result in dictionary\n" +" dictionary[N] = fact\n" +"\n" +"if __name__ == '__main__':\n" +" p = Pool(5)\n" +" mgr = Manager()\n" +" d = mgr.dict() # Create shared dictionary\n" +"\n" +" # Run tasks using the pool\n" +" for N in range(1, 1000, 10):\n" +" p.apply_async(factorial, (N, d))\n" +"\n" +" # Mark pool as closed -- no more tasks can be added.\n" +" p.close()\n" +"\n" +" # Wait for tasks to exit\n" +" p.join()\n" +"\n" +" # Output results\n" +" for k, v in sorted(d.items()):\n" +" print k, v" +msgstr "" + +#: whatsnew/2.6.rst:701 msgid "This will produce the output::" msgstr "" -#: whatsnew/2.6.rst:704 +#: whatsnew/2.6.rst:703 +msgid "" +"1 1\n" +"11 39916800\n" +"21 51090942171709440000\n" +"31 8222838654177922817725562880000000\n" +"41 33452526613163807108170062053440751665152000000000\n" +"51 15511187532873822802242430164693032110632597200169861120000..." +msgstr "" + +#: whatsnew/2.6.rst:712 msgid "The documentation for the :mod:`multiprocessing` module." msgstr "" -#: whatsnew/2.6.rst:707 +#: whatsnew/2.6.rst:714 msgid ":pep:`371` - Addition of the multiprocessing package" msgstr "" -#: whatsnew/2.6.rst:707 +#: whatsnew/2.6.rst:715 msgid "" "PEP written by Jesse Noller and Richard Oudkerk; implemented by Richard " "Oudkerk and Jesse Noller." msgstr "" -#: whatsnew/2.6.rst:716 +#: whatsnew/2.6.rst:724 msgid "PEP 3101: Advanced String Formatting" msgstr "" -#: whatsnew/2.6.rst:718 +#: whatsnew/2.6.rst:726 msgid "" "In Python 3.0, the ``%`` operator is supplemented by a more powerful string " "formatting method, :meth:`format`. Support for the :meth:`str.format` " "method has been backported to Python 2.6." msgstr "" -#: whatsnew/2.6.rst:722 +#: whatsnew/2.6.rst:730 msgid "" "In 2.6, both 8-bit and Unicode strings have a ``.format()`` method that " "treats the string as a template and takes the arguments to be formatted. The " @@ -746,18 +973,50 @@ msgid "" "characters::" msgstr "" -#: whatsnew/2.6.rst:735 +#: whatsnew/2.6.rst:734 +msgid "" +">>> # Substitute positional argument 0 into the string.\n" +">>> \"User ID: {0}\".format(\"root\")\n" +"'User ID: root'\n" +">>> # Use the named keyword arguments\n" +">>> \"User ID: {uid} Last seen: {last_login}\".format(\n" +"... uid=\"root\",\n" +"... last_login = \"5 Mar 2008 07:20\")\n" +"'User ID: root Last seen: 5 Mar 2008 07:20'" +msgstr "" + +#: whatsnew/2.6.rst:743 msgid "Curly brackets can be escaped by doubling them::" msgstr "" -#: whatsnew/2.6.rst:740 +#: whatsnew/2.6.rst:745 +msgid "" +">>> \"Empty dict: {{}}\".format()\n" +"\"Empty dict: {}\"" +msgstr "" + +#: whatsnew/2.6.rst:748 msgid "" "Field names can be integers indicating positional arguments, such as ``{0}" "``, ``{1}``, etc. or names of keyword arguments. You can also supply " "compound field names that read attributes or access dictionary keys::" msgstr "" -#: whatsnew/2.6.rst:754 +#: whatsnew/2.6.rst:752 +msgid "" +">>> import sys\n" +">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." +"format(sys)\n" +"Platform: darwin\n" +"Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" +"[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" +"\n" +">>> import mimetypes\n" +">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" +"'Content-type: video/mp4'" +msgstr "" + +#: whatsnew/2.6.rst:762 msgid "" "Note that when using dictionary-style notation such as ``[.mp4]``, you don't " "need to put any quotation marks around the string; it will look up the value " @@ -766,249 +1025,315 @@ msgid "" "inside a format string." msgstr "" -#: whatsnew/2.6.rst:760 +#: whatsnew/2.6.rst:768 msgid "" "So far we've shown how to specify which field to substitute into the " "resulting string. The precise formatting used is also controllable by " "adding a colon followed by a format specifier. For example::" msgstr "" -#: whatsnew/2.6.rst:774 +#: whatsnew/2.6.rst:772 +msgid "" +">>> # Field 0: left justify, pad to 15 characters\n" +">>> # Field 1: right justify, pad to 6 characters\n" +">>> fmt = '{0:15} ${1:>6}'\n" +">>> fmt.format('Registration', 35)\n" +"'Registration $ 35'\n" +">>> fmt.format('Tutorial', 50)\n" +"'Tutorial $ 50'\n" +">>> fmt.format('Banquet', 125)\n" +"'Banquet $ 125'" +msgstr "" + +#: whatsnew/2.6.rst:782 msgid "Format specifiers can reference other fields through nesting::" msgstr "" #: whatsnew/2.6.rst:784 +msgid "" +">>> fmt = '{0:{1}}'\n" +">>> width = 15\n" +">>> fmt.format('Invoice #1234', width)\n" +"'Invoice #1234 '\n" +">>> width = 35\n" +">>> fmt.format('Invoice #1234', width)\n" +"'Invoice #1234 '" +msgstr "" + +#: whatsnew/2.6.rst:792 msgid "The alignment of a field within the desired width can be specified:" msgstr "" -#: whatsnew/2.6.rst:787 +#: whatsnew/2.6.rst:795 msgid "Character" msgstr "" -#: whatsnew/2.6.rst:787 +#: whatsnew/2.6.rst:795 msgid "Effect" msgstr "" -#: whatsnew/2.6.rst:789 +#: whatsnew/2.6.rst:797 msgid "< (default)" msgstr "" -#: whatsnew/2.6.rst:789 +#: whatsnew/2.6.rst:797 msgid "Left-align" msgstr "" -#: whatsnew/2.6.rst:790 +#: whatsnew/2.6.rst:798 msgid ">" msgstr "" -#: whatsnew/2.6.rst:790 +#: whatsnew/2.6.rst:798 msgid "Right-align" msgstr "" -#: whatsnew/2.6.rst:791 +#: whatsnew/2.6.rst:799 msgid "^" msgstr "" -#: whatsnew/2.6.rst:791 +#: whatsnew/2.6.rst:799 msgid "Center" msgstr "" -#: whatsnew/2.6.rst:792 +#: whatsnew/2.6.rst:800 msgid "=" msgstr "" -#: whatsnew/2.6.rst:792 +#: whatsnew/2.6.rst:800 msgid "(For numeric types only) Pad after the sign." msgstr "" -#: whatsnew/2.6.rst:795 +#: whatsnew/2.6.rst:803 msgid "" "Format specifiers can also include a presentation type, which controls how " "the value is formatted. For example, floating-point numbers can be " "formatted as a general number or in exponential notation::" msgstr "" -#: whatsnew/2.6.rst:804 +#: whatsnew/2.6.rst:807 +msgid "" +">>> '{0:g}'.format(3.75)\n" +"'3.75'\n" +">>> '{0:e}'.format(3.75)\n" +"'3.750000e+00'" +msgstr "" + +#: whatsnew/2.6.rst:812 msgid "" "A variety of presentation types are available. Consult the 2.6 " "documentation for a :ref:`complete list `; here's a sample:" msgstr "" -#: whatsnew/2.6.rst:808 +#: whatsnew/2.6.rst:816 msgid "``b``" msgstr "" -#: whatsnew/2.6.rst:808 +#: whatsnew/2.6.rst:816 msgid "Binary. Outputs the number in base 2." msgstr "" -#: whatsnew/2.6.rst:809 +#: whatsnew/2.6.rst:817 msgid "``c``" msgstr "" -#: whatsnew/2.6.rst:809 +#: whatsnew/2.6.rst:817 msgid "" "Character. Converts the integer to the corresponding Unicode character " "before printing." msgstr "" -#: whatsnew/2.6.rst:811 +#: whatsnew/2.6.rst:819 msgid "``d``" msgstr "" -#: whatsnew/2.6.rst:811 +#: whatsnew/2.6.rst:819 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: whatsnew/2.6.rst:812 +#: whatsnew/2.6.rst:820 msgid "``o``" msgstr "" -#: whatsnew/2.6.rst:812 +#: whatsnew/2.6.rst:820 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: whatsnew/2.6.rst:813 +#: whatsnew/2.6.rst:821 msgid "``x``" msgstr "" -#: whatsnew/2.6.rst:813 +#: whatsnew/2.6.rst:821 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "" -#: whatsnew/2.6.rst:815 +#: whatsnew/2.6.rst:823 msgid "``e``" msgstr "" -#: whatsnew/2.6.rst:815 +#: whatsnew/2.6.rst:823 msgid "" "Exponent notation. Prints the number in scientific notation using the letter " "'e' to indicate the exponent." msgstr "" -#: whatsnew/2.6.rst:817 +#: whatsnew/2.6.rst:825 msgid "``g``" msgstr "" -#: whatsnew/2.6.rst:817 +#: whatsnew/2.6.rst:825 msgid "" "General format. This prints the number as a fixed-point number, unless the " "number is too large, in which case it switches to 'e' exponent notation." msgstr "" -#: whatsnew/2.6.rst:820 +#: whatsnew/2.6.rst:828 msgid "``n``" msgstr "" -#: whatsnew/2.6.rst:820 +#: whatsnew/2.6.rst:828 msgid "" "Number. This is the same as 'g' (for floats) or 'd' (for integers), except " "that it uses the current locale setting to insert the appropriate number " "separator characters." msgstr "" -#: whatsnew/2.6.rst:823 +#: whatsnew/2.6.rst:831 msgid "``%``" msgstr "" -#: whatsnew/2.6.rst:823 +#: whatsnew/2.6.rst:831 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed ('f') format, " "followed by a percent sign." msgstr "" -#: whatsnew/2.6.rst:827 +#: whatsnew/2.6.rst:835 +msgid "" +"Classes and types can define a :meth:`~object.__format__` method to control " +"how they're formatted. It receives a single argument, the format specifier::" +msgstr "" + +#: whatsnew/2.6.rst:838 msgid "" -"Classes and types can define a :meth:`__format__` method to control how " -"they're formatted. It receives a single argument, the format specifier::" +"def __format__(self, format_spec):\n" +" if isinstance(format_spec, unicode):\n" +" return unicode(str(self))\n" +" else:\n" +" return str(self)" msgstr "" -#: whatsnew/2.6.rst:836 +#: whatsnew/2.6.rst:844 msgid "" "There's also a :func:`format` builtin that will format a single value. It " -"calls the type's :meth:`__format__` method with the provided specifier::" +"calls the type's :meth:`~object.__format__` method with the provided " +"specifier::" +msgstr "" + +#: whatsnew/2.6.rst:848 +msgid "" +">>> format(75.6564, '.2f')\n" +"'75.66'" msgstr "" -#: whatsnew/2.6.rst:847 +#: whatsnew/2.6.rst:854 msgid ":ref:`formatstrings`" msgstr "" -#: whatsnew/2.6.rst:847 +#: whatsnew/2.6.rst:855 msgid "The reference documentation for format fields." msgstr "" -#: whatsnew/2.6.rst:849 +#: whatsnew/2.6.rst:857 msgid ":pep:`3101` - Advanced String Formatting" msgstr "" -#: whatsnew/2.6.rst:850 +#: whatsnew/2.6.rst:858 msgid "PEP written by Talin. Implemented by Eric Smith." msgstr "" -#: whatsnew/2.6.rst:857 +#: whatsnew/2.6.rst:865 msgid "PEP 3105: ``print`` As a Function" msgstr "" -#: whatsnew/2.6.rst:859 +#: whatsnew/2.6.rst:867 msgid "" "The ``print`` statement becomes the :func:`print` function in Python 3.0. " "Making :func:`print` a function makes it possible to replace the function by " "doing ``def print(...)`` or importing a new function from somewhere else." msgstr "" -#: whatsnew/2.6.rst:863 +#: whatsnew/2.6.rst:871 msgid "" "Python 2.6 has a ``__future__`` import that removes ``print`` as language " "syntax, letting you use the functional form instead. For example::" msgstr "" -#: whatsnew/2.6.rst:869 +#: whatsnew/2.6.rst:874 +msgid "" +">>> from __future__ import print_function\n" +">>> print('# of entries', len(dictionary), file=sys.stderr)" +msgstr "" + +#: whatsnew/2.6.rst:877 msgid "The signature of the new function is::" msgstr "" -#: whatsnew/2.6.rst:874 +#: whatsnew/2.6.rst:879 +msgid "def print(*args, sep=' ', end='\\n', file=None)" +msgstr "" + +#: whatsnew/2.6.rst:882 msgid "The parameters are:" msgstr "" -#: whatsnew/2.6.rst:876 +#: whatsnew/2.6.rst:884 msgid "*args*: positional arguments whose values will be printed out." msgstr "" -#: whatsnew/2.6.rst:877 +#: whatsnew/2.6.rst:885 msgid "*sep*: the separator, which will be printed between arguments." msgstr "" -#: whatsnew/2.6.rst:878 +#: whatsnew/2.6.rst:886 msgid "" "*end*: the ending text, which will be printed after all of the arguments " "have been output." msgstr "" -#: whatsnew/2.6.rst:880 +#: whatsnew/2.6.rst:888 msgid "*file*: the file object to which the output will be sent." msgstr "" -#: whatsnew/2.6.rst:884 +#: whatsnew/2.6.rst:892 msgid ":pep:`3105` - Make print a function" msgstr "" -#: whatsnew/2.6.rst:885 +#: whatsnew/2.6.rst:893 msgid "PEP written by Georg Brandl." msgstr "" -#: whatsnew/2.6.rst:892 +#: whatsnew/2.6.rst:900 msgid "PEP 3110: Exception-Handling Changes" msgstr "" -#: whatsnew/2.6.rst:894 +#: whatsnew/2.6.rst:902 msgid "" "One error that Python programmers occasionally make is writing the following " "code::" msgstr "" -#: whatsnew/2.6.rst:902 +#: whatsnew/2.6.rst:905 +msgid "" +"try:\n" +" ...\n" +"except TypeError, ValueError: # Wrong!\n" +" ..." +msgstr "" + +#: whatsnew/2.6.rst:910 msgid "" "The author is probably trying to catch both :exc:`TypeError` and :exc:" "`ValueError` exceptions, but this code actually does something different: it " @@ -1017,21 +1342,37 @@ msgid "" "caught at all. The correct code specifies a tuple of exceptions::" msgstr "" -#: whatsnew/2.6.rst:914 +#: whatsnew/2.6.rst:917 +msgid "" +"try:\n" +" ...\n" +"except (TypeError, ValueError):\n" +" ..." +msgstr "" + +#: whatsnew/2.6.rst:922 msgid "" "This error happens because the use of the comma here is ambiguous: does it " "indicate two different nodes in the parse tree, or a single node that's a " "tuple?" msgstr "" -#: whatsnew/2.6.rst:918 +#: whatsnew/2.6.rst:926 msgid "" "Python 3.0 makes this unambiguous by replacing the comma with the word " "\"as\". To catch an exception and store the exception object in the " "variable ``exc``, you must write::" msgstr "" -#: whatsnew/2.6.rst:927 +#: whatsnew/2.6.rst:930 +msgid "" +"try:\n" +" ...\n" +"except TypeError as exc:\n" +" ..." +msgstr "" + +#: whatsnew/2.6.rst:935 msgid "" "Python 3.0 will only support the use of \"as\", and therefore interprets the " "first example as catching two different exceptions. Python 2.6 supports " @@ -1040,19 +1381,19 @@ msgid "" "be executed with 2.6." msgstr "" -#: whatsnew/2.6.rst:935 +#: whatsnew/2.6.rst:943 msgid ":pep:`3110` - Catching Exceptions in Python 3000" msgstr "" -#: whatsnew/2.6.rst:936 +#: whatsnew/2.6.rst:944 msgid "PEP written and implemented by Collin Winter." msgstr "" -#: whatsnew/2.6.rst:943 +#: whatsnew/2.6.rst:951 msgid "PEP 3112: Byte Literals" msgstr "" -#: whatsnew/2.6.rst:945 +#: whatsnew/2.6.rst:953 msgid "" "Python 3.0 adopts Unicode as the language's fundamental string type and " "denotes 8-bit literals differently, either as ``b'string'`` or using a :" @@ -1061,7 +1402,7 @@ msgid "" "``b''`` notation." msgstr "" -#: whatsnew/2.6.rst:952 +#: whatsnew/2.6.rst:960 msgid "" "The 2.6 :class:`str` differs from 3.0's :class:`bytes` type in various ways; " "most notably, the constructor is completely different. In 3.0, ``bytes([65, " @@ -1070,7 +1411,7 @@ msgid "" "func:`str` of the list." msgstr "" -#: whatsnew/2.6.rst:958 +#: whatsnew/2.6.rst:966 msgid "" "The primary use of :class:`bytes` in 2.6 will be to write tests of object " "type such as ``isinstance(x, bytes)``. This will help the 2to3 converter, " @@ -1080,14 +1421,24 @@ msgid "" "be correct in Python 3.0." msgstr "" -#: whatsnew/2.6.rst:965 +#: whatsnew/2.6.rst:973 msgid "" "There's also a ``__future__`` import that causes all string literals to " "become Unicode strings. This means that ``\\u`` escape sequences can be " "used to include Unicode characters::" msgstr "" -#: whatsnew/2.6.rst:977 +#: whatsnew/2.6.rst:978 +msgid "" +"from __future__ import unicode_literals\n" +"\n" +"s = ('\\u751f\\u3080\\u304e\\u3000\\u751f\\u3054'\n" +" '\\u3081\\u3000\\u751f\\u305f\\u307e\\u3054')\n" +"\n" +"print len(s) # 12 Unicode characters" +msgstr "" + +#: whatsnew/2.6.rst:985 msgid "" "At the C level, Python 3.0 will rename the existing 8-bit string type, " "called :c:type:`!PyStringObject` in Python 2.x, to :c:type:`PyBytesObject`. " @@ -1097,107 +1448,134 @@ msgid "" "with strings." msgstr "" -#: whatsnew/2.6.rst:984 +#: whatsnew/2.6.rst:992 msgid "" "Instances of the :class:`bytes` type are immutable just as strings are. A " "new :class:`bytearray` type stores a mutable sequence of bytes::" msgstr "" -#: whatsnew/2.6.rst:999 +#: whatsnew/2.6.rst:996 +msgid "" +">>> bytearray([65, 66, 67])\n" +"bytearray(b'ABC')\n" +">>> b = bytearray(u'\\u21ef\\u3244', 'utf-8')\n" +">>> b\n" +"bytearray(b'\\xe2\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> b[0] = '\\xe3'\n" +">>> b\n" +"bytearray(b'\\xe3\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> unicode(str(b), 'utf-8')\n" +"u'\\u31ef \\u3244'" +msgstr "" + +#: whatsnew/2.6.rst:1007 msgid "" "Byte arrays support most of the methods of string types, such as :meth:" -"`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some of the " -"methods of lists, such as :meth:`append`, :meth:`pop`, and :meth:`reverse`." +"`~bytearray.startswith`/:meth:`~bytearray.endswith`, :meth:`~bytearray." +"find`/:meth:`~bytearray.rfind`, and some of the methods of lists, such as :" +"meth:`~bytearray.append`, :meth:`~bytearray.pop`, and :meth:`~bytearray." +"reverse`." msgstr "" -#: whatsnew/2.6.rst:1012 +#: whatsnew/2.6.rst:1015 +msgid "" +">>> b = bytearray('ABC')\n" +">>> b.append('d')\n" +">>> b.append(ord('e'))\n" +">>> b\n" +"bytearray(b'ABCde')" +msgstr "" + +#: whatsnew/2.6.rst:1021 msgid "" "There's also a corresponding C API, with :c:func:`PyByteArray_FromObject`, :" "c:func:`PyByteArray_FromStringAndSize`, and various other functions." msgstr "" -#: whatsnew/2.6.rst:1019 +#: whatsnew/2.6.rst:1028 msgid ":pep:`3112` - Bytes literals in Python 3000" msgstr "" -#: whatsnew/2.6.rst:1020 +#: whatsnew/2.6.rst:1029 msgid "PEP written by Jason Orendorff; backported to 2.6 by Christian Heimes." msgstr "" -#: whatsnew/2.6.rst:1027 +#: whatsnew/2.6.rst:1036 msgid "PEP 3116: New I/O Library" msgstr "" -#: whatsnew/2.6.rst:1029 +#: whatsnew/2.6.rst:1038 msgid "" "Python's built-in file objects support a number of methods, but file-like " "objects don't necessarily support all of them. Objects that imitate files " -"usually support :meth:`read` and :meth:`write`, but they may not support :" -"meth:`readline`, for example. Python 3.0 introduces a layered I/O library " +"usually support :meth:`!read` and :meth:`!write`, but they may not support :" +"meth:`!readline`, for example. Python 3.0 introduces a layered I/O library " "in the :mod:`io` module that separates buffering and text-handling features " "from the fundamental read and write operations." msgstr "" -#: whatsnew/2.6.rst:1037 +#: whatsnew/2.6.rst:1046 msgid "" "There are three levels of abstract base classes provided by the :mod:`io` " "module:" msgstr "" -#: whatsnew/2.6.rst:1040 +#: whatsnew/2.6.rst:1049 msgid "" -":class:`RawIOBase` defines raw I/O operations: :meth:`read`, :meth:" -"`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " -"and :meth:`close`. Most of the methods of this class will often map to a " -"single system call. There are also :meth:`readable`, :meth:`writable`, and :" -"meth:`seekable` methods for determining what operations a given object will " -"allow." +":class:`~io.RawIOBase` defines raw I/O operations: :meth:`~io.RawIOBase." +"read`, :meth:`~io.RawIOBase.readinto`, :meth:`~io.RawIOBase.write`, :meth:" +"`~io.IOBase.seek`, :meth:`~io.IOBase.tell`, :meth:`~io.IOBase.truncate`, " +"and :meth:`~io.IOBase.close`. Most of the methods of this class will often " +"map to a single system call. There are also :meth:`~io.IOBase.readable`, :" +"meth:`~io.IOBase.writable`, and :meth:`~io.IOBase.seekable` methods for " +"determining what operations a given object will allow." msgstr "" -#: whatsnew/2.6.rst:1048 +#: whatsnew/2.6.rst:1058 msgid "" "Python 3.0 has concrete implementations of this class for files and sockets, " "but Python 2.6 hasn't restructured its file and socket objects in this way." msgstr "" -#: whatsnew/2.6.rst:1052 +#: whatsnew/2.6.rst:1062 msgid "" -":class:`BufferedIOBase` is an abstract base class that buffers data in " +":class:`~io.BufferedIOBase` is an abstract base class that buffers data in " "memory to reduce the number of system calls used, making I/O processing more " -"efficient. It supports all of the methods of :class:`RawIOBase`, and adds a :" -"attr:`raw` attribute holding the underlying raw object." +"efficient. It supports all of the methods of :class:`~io.RawIOBase`, and " +"adds a :attr:`~io.BufferedIOBase.raw` attribute holding the underlying raw " +"object." msgstr "" -#: whatsnew/2.6.rst:1058 +#: whatsnew/2.6.rst:1069 msgid "" -"There are five concrete classes implementing this ABC. :class:" -"`BufferedWriter` and :class:`BufferedReader` are for objects that support " -"write-only or read-only usage that have a :meth:`seek` method for random " -"access. :class:`BufferedRandom` objects support read and write access upon " -"the same underlying stream, and :class:`BufferedRWPair` is for objects such " -"as TTYs that have both read and write operations acting upon unconnected " -"streams of data. The :class:`BytesIO` class supports reading, writing, and " -"seeking over an in-memory buffer." +"There are five concrete classes implementing this ABC. :class:`~io." +"BufferedWriter` and :class:`~io.BufferedReader` are for objects that support " +"write-only or read-only usage that have a :meth:`~io.IOBase.seek` method for " +"random access. :class:`~io.BufferedRandom` objects support read and write " +"access upon the same underlying stream, and :class:`~io.BufferedRWPair` is " +"for objects such as TTYs that have both read and write operations acting " +"upon unconnected streams of data. The :class:`~io.BytesIO` class supports " +"reading, writing, and seeking over an in-memory buffer." msgstr "" -#: whatsnew/2.6.rst:1071 +#: whatsnew/2.6.rst:1082 msgid "" -":class:`TextIOBase`: Provides functions for reading and writing strings " +":class:`~io.TextIOBase`: Provides functions for reading and writing strings " "(remember, strings will be Unicode in Python 3.0), and supporting :term:" -"`universal newlines`. :class:`TextIOBase` defines the :meth:`readline` " +"`universal newlines`. :class:`~io.TextIOBase` defines the :meth:`readline` " "method and supports iteration upon objects." msgstr "" -#: whatsnew/2.6.rst:1077 +#: whatsnew/2.6.rst:1088 msgid "" -"There are two concrete implementations. :class:`TextIOWrapper` wraps a " +"There are two concrete implementations. :class:`~io.TextIOWrapper` wraps a " "buffered I/O object, supporting all of the methods for text I/O and adding " -"a :attr:`buffer` attribute for access to the underlying object. :class:" -"`StringIO` simply buffers everything in memory without ever writing anything " -"to disk." +"a :attr:`~io.TextIOBase.buffer` attribute for access to the underlying " +"object. :class:`~io.StringIO` simply buffers everything in memory without " +"ever writing anything to disk." msgstr "" -#: whatsnew/2.6.rst:1083 +#: whatsnew/2.6.rst:1094 msgid "" "(In Python 2.6, :class:`io.StringIO` is implemented in pure Python, so it's " "pretty slow. You should therefore stick with the existing :mod:`!StringIO` " @@ -1206,7 +1584,7 @@ msgid "" "will be backported to the 2.x releases.)" msgstr "" -#: whatsnew/2.6.rst:1089 +#: whatsnew/2.6.rst:1100 msgid "" "In Python 2.6, the underlying implementations haven't been restructured to " "build on top of the :mod:`io` module's classes. The module is being " @@ -1215,22 +1593,22 @@ msgid "" "buffering and text I/O." msgstr "" -#: whatsnew/2.6.rst:1099 +#: whatsnew/2.6.rst:1108 msgid ":pep:`3116` - New I/O" msgstr "" -#: whatsnew/2.6.rst:1098 +#: whatsnew/2.6.rst:1109 msgid "" "PEP written by Daniel Stutzbach, Mike Verdone, and Guido van Rossum. Code by " "Guido van Rossum, Georg Brandl, Walter Doerwald, Jeremy Hylton, Martin von " "Löwis, Tony Lownds, and others." msgstr "" -#: whatsnew/2.6.rst:1107 +#: whatsnew/2.6.rst:1118 msgid "PEP 3118: Revised Buffer Protocol" msgstr "" -#: whatsnew/2.6.rst:1109 +#: whatsnew/2.6.rst:1120 msgid "" "The buffer protocol is a C-level API that lets Python types exchange " "pointers into their internal representations. A memory-mapped file can be " @@ -1239,7 +1617,7 @@ msgid "" "searched." msgstr "" -#: whatsnew/2.6.rst:1115 +#: whatsnew/2.6.rst:1126 msgid "" "The primary users of the buffer protocol are numeric-processing packages " "such as NumPy, which expose the internal representation of arrays so that " @@ -1249,7 +1627,7 @@ msgid "" "the shape of an array or locking a memory region." msgstr "" -#: whatsnew/2.6.rst:1122 +#: whatsnew/2.6.rst:1133 msgid "" "The most important new C API function is ``PyObject_GetBuffer(PyObject *obj, " "Py_buffer *view, int flags)``, which takes an object and a set of flags, and " @@ -1260,118 +1638,151 @@ msgid "" "external caller is done." msgstr "" -#: whatsnew/2.6.rst:1132 +#: whatsnew/2.6.rst:1143 msgid "" "The *flags* argument to :c:func:`PyObject_GetBuffer` specifies constraints " "upon the memory returned. Some examples are:" msgstr "" -#: whatsnew/2.6.rst:1135 +#: whatsnew/2.6.rst:1146 msgid ":c:macro:`PyBUF_WRITABLE` indicates that the memory must be writable." msgstr "" -#: whatsnew/2.6.rst:1137 +#: whatsnew/2.6.rst:1148 msgid "" ":c:macro:`PyBUF_LOCK` requests a read-only or exclusive lock on the memory." msgstr "" -#: whatsnew/2.6.rst:1139 +#: whatsnew/2.6.rst:1150 msgid "" ":c:macro:`PyBUF_C_CONTIGUOUS` and :c:macro:`PyBUF_F_CONTIGUOUS` requests a C-" "contiguous (last dimension varies the fastest) or Fortran-contiguous (first " "dimension varies the fastest) array layout." msgstr "" -#: whatsnew/2.6.rst:1143 +#: whatsnew/2.6.rst:1154 msgid "" "Two new argument codes for :c:func:`PyArg_ParseTuple`, ``s*`` and ``z*``, " "return locked buffer objects for a parameter." msgstr "" -#: whatsnew/2.6.rst:1149 +#: whatsnew/2.6.rst:1159 msgid ":pep:`3118` - Revising the buffer protocol" msgstr "" -#: whatsnew/2.6.rst:1149 +#: whatsnew/2.6.rst:1160 msgid "" "PEP written by Travis Oliphant and Carl Banks; implemented by Travis " "Oliphant." msgstr "" -#: whatsnew/2.6.rst:1158 +#: whatsnew/2.6.rst:1169 msgid "PEP 3119: Abstract Base Classes" msgstr "" -#: whatsnew/2.6.rst:1160 +#: whatsnew/2.6.rst:1171 msgid "" "Some object-oriented languages such as Java support interfaces, declaring " "that a class has a given set of methods or supports a given access " "protocol. Abstract Base Classes (or ABCs) are an equivalent feature for " "Python. The ABC support consists of an :mod:`abc` module containing a " -"metaclass called :class:`ABCMeta`, special handling of this metaclass by " -"the :func:`isinstance` and :func:`issubclass` builtins, and a collection of " -"basic ABCs that the Python developers think will be widely useful. Future " -"versions of Python will probably add more ABCs." +"metaclass called :class:`~abc.ABCMeta`, special handling of this metaclass " +"by the :func:`isinstance` and :func:`issubclass` builtins, and a collection " +"of basic ABCs that the Python developers think will be widely useful. " +"Future versions of Python will probably add more ABCs." msgstr "" -#: whatsnew/2.6.rst:1170 +#: whatsnew/2.6.rst:1181 msgid "" "Let's say you have a particular class and wish to know whether it supports " "dictionary-style access. The phrase \"dictionary-style\" is vague, however. " "It probably means that accessing items with ``obj[1]`` works. Does it imply " "that setting items with ``obj[2] = value`` works? Or that the object will " -"have :meth:`keys`, :meth:`values`, and :meth:`items` methods? What about " -"the iterative variants such as :meth:`iterkeys`? :meth:`copy` and :meth:" -"`update`? Iterating over the object with :func:`iter`?" +"have :meth:`!keys`, :meth:`!values`, and :meth:`!items` methods? What about " +"the iterative variants such as :meth:`!iterkeys`? :meth:`!copy`and :meth:`!" +"update`? Iterating over the object with :func:`!iter`?" msgstr "" -#: whatsnew/2.6.rst:1178 +#: whatsnew/2.6.rst:1189 msgid "" "The Python 2.6 :mod:`collections` module includes a number of different ABCs " "that represent these distinctions. :class:`Iterable` indicates that a class " -"defines :meth:`__iter__`, and :class:`Container` means the class defines a :" -"meth:`__contains__` method and therefore supports ``x in y`` expressions. " -"The basic dictionary interface of getting items, setting items, and :meth:" -"`keys`, :meth:`values`, and :meth:`items`, is defined by the :class:" -"`MutableMapping` ABC." +"defines :meth:`~object.__iter__`, and :class:`Container` means the class " +"defines a :meth:`~object.__contains__` method and therefore supports ``x in " +"y`` expressions. The basic dictionary interface of getting items, setting " +"items, and :meth:`!keys`, :meth:`!values`, and :meth:`!items`, is defined by " +"the :class:`MutableMapping` ABC." msgstr "" -#: whatsnew/2.6.rst:1187 +#: whatsnew/2.6.rst:1198 msgid "" "You can derive your own classes from a particular ABC to indicate they " "support that ABC's interface::" msgstr "" -#: whatsnew/2.6.rst:1196 +#: whatsnew/2.6.rst:1201 msgid "" -"Alternatively, you could write the class without deriving from the desired " -"ABC and instead register the class by calling the ABC's :meth:`register` " -"method::" +"import collections\n" +"\n" +"class Storage(collections.MutableMapping):\n" +" ..." msgstr "" #: whatsnew/2.6.rst:1207 msgid "" +"Alternatively, you could write the class without deriving from the desired " +"ABC and instead register the class by calling the ABC's :meth:`~abc.ABCMeta." +"register` method::" +msgstr "" + +#: whatsnew/2.6.rst:1211 +msgid "" +"import collections\n" +"\n" +"class Storage:\n" +" ...\n" +"\n" +"collections.MutableMapping.register(Storage)" +msgstr "" + +#: whatsnew/2.6.rst:1218 +msgid "" "For classes that you write, deriving from the ABC is probably clearer. The :" -"meth:`register` method is useful when you've written a new ABC that can " -"describe an existing type or class, or if you want to declare that some " -"third-party class implements an ABC. For example, if you defined a :class:" -"`PrintableType` ABC, it's legal to do::" +"meth:`~abc.ABCMeta.register` method is useful when you've written a new ABC " +"that can describe an existing type or class, or if you want to declare that " +"some third-party class implements an ABC. For example, if you defined a :" +"class:`!PrintableType` ABC, it's legal to do::" +msgstr "" + +#: whatsnew/2.6.rst:1225 +msgid "" +"# Register Python's types\n" +"PrintableType.register(int)\n" +"PrintableType.register(float)\n" +"PrintableType.register(str)" msgstr "" -#: whatsnew/2.6.rst:1219 +#: whatsnew/2.6.rst:1230 msgid "" "Classes should obey the semantics specified by an ABC, but Python can't " "check this; it's up to the class author to understand the ABC's requirements " "and to implement the code accordingly." msgstr "" -#: whatsnew/2.6.rst:1223 +#: whatsnew/2.6.rst:1234 msgid "" "To check whether an object supports a particular interface, you can now " "write::" msgstr "" -#: whatsnew/2.6.rst:1230 +#: whatsnew/2.6.rst:1237 +msgid "" +"def func(d):\n" +" if not isinstance(d, collections.MutableMapping):\n" +" raise ValueError(\"Mapping object expected, not %r\" % d)" +msgstr "" + +#: whatsnew/2.6.rst:1241 msgid "" "Don't feel that you must now begin writing lots of checks as in the above " "example. Python has a strong tradition of duck-typing, where explicit type-" @@ -1381,76 +1792,137 @@ msgid "" "necessary." msgstr "" -#: whatsnew/2.6.rst:1237 +#: whatsnew/2.6.rst:1248 msgid "" "You can write your own ABCs by using ``abc.ABCMeta`` as the metaclass in a " "class definition::" msgstr "" -#: whatsnew/2.6.rst:1258 -msgid "" -"In the :class:`Drawable` ABC above, the :meth:`draw_doubled` method renders " -"the object at twice its size and can be implemented in terms of other " -"methods described in :class:`Drawable`. Classes implementing this ABC " -"therefore don't need to provide their own implementation of :meth:" -"`draw_doubled`, though they can do so. An implementation of :meth:`draw` is " +#: whatsnew/2.6.rst:1251 +msgid "" +"from abc import ABCMeta, abstractmethod\n" +"\n" +"class Drawable():\n" +" __metaclass__ = ABCMeta\n" +"\n" +" @abstractmethod\n" +" def draw(self, x, y, scale=1.0):\n" +" pass\n" +"\n" +" def draw_doubled(self, x, y):\n" +" self.draw(x, y, scale=2.0)\n" +"\n" +"\n" +"class Square(Drawable):\n" +" def draw(self, x, y, scale):\n" +" ..." +msgstr "" + +#: whatsnew/2.6.rst:1269 +msgid "" +"In the :class:`!Drawable` ABC above, the :meth:`!draw_doubled` method " +"renders the object at twice its size and can be implemented in terms of " +"other methods described in :class:`!Drawable`. Classes implementing this " +"ABC therefore don't need to provide their own implementation of :meth:`!" +"draw_doubled`, though they can do so. An implementation of :meth:`!draw` is " "necessary, though; the ABC can't provide a useful generic implementation." msgstr "" -#: whatsnew/2.6.rst:1266 +#: whatsnew/2.6.rst:1277 msgid "" -"You can apply the ``@abstractmethod`` decorator to methods such as :meth:" -"`draw` that must be implemented; Python will then raise an exception for " -"classes that don't define the method. Note that the exception is only raised " -"when you actually try to create an instance of a subclass lacking the " +"You can apply the :deco:`~abc.abstractmethod` decorator to methods such as :" +"meth:`!draw` that must be implemented; Python will then raise an exception " +"for classes that don't define the method. Note that the exception is only " +"raised when you actually try to create an instance of a subclass lacking the " "method::" msgstr "" -#: whatsnew/2.6.rst:1281 +#: whatsnew/2.6.rst:1283 +msgid "" +">>> class Circle(Drawable):\n" +"... pass\n" +"...\n" +">>> c = Circle()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: Can't instantiate abstract class Circle with abstract methods " +"draw\n" +">>>" +msgstr "" + +#: whatsnew/2.6.rst:1292 msgid "" "Abstract data attributes can be declared using the ``@abstractproperty`` " "decorator::" msgstr "" -#: whatsnew/2.6.rst:1291 -msgid "Subclasses must then define a :meth:`readonly` property." +#: whatsnew/2.6.rst:1295 +msgid "" +"from abc import abstractproperty\n" +"...\n" +"\n" +"@abstractproperty\n" +"def readonly(self):\n" +" return self._x" +msgstr "" + +#: whatsnew/2.6.rst:1302 +msgid "Subclasses must then define a ``readonly`` property." msgstr "" -#: whatsnew/2.6.rst:1297 +#: whatsnew/2.6.rst:1306 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: whatsnew/2.6.rst:1296 +#: whatsnew/2.6.rst:1307 msgid "" "PEP written by Guido van Rossum and Talin. Implemented by Guido van Rossum. " "Backported to 2.6 by Benjamin Aranguren, with Alex Martelli." msgstr "" -#: whatsnew/2.6.rst:1305 +#: whatsnew/2.6.rst:1316 msgid "PEP 3127: Integer Literal Support and Syntax" msgstr "" -#: whatsnew/2.6.rst:1307 +#: whatsnew/2.6.rst:1318 msgid "" "Python 3.0 changes the syntax for octal (base-8) integer literals, prefixing " "them with \"0o\" or \"0O\" instead of a leading zero, and adds support for " "binary (base-2) integer literals, signalled by a \"0b\" or \"0B\" prefix." msgstr "" -#: whatsnew/2.6.rst:1312 +#: whatsnew/2.6.rst:1323 msgid "" "Python 2.6 doesn't drop support for a leading 0 signalling an octal number, " "but it does add support for \"0o\" and \"0b\"::" msgstr "" -#: whatsnew/2.6.rst:1320 +#: whatsnew/2.6.rst:1326 +msgid "" +">>> 0o21, 2*8 + 1\n" +"(17, 17)\n" +">>> 0b101111\n" +"47" +msgstr "" + +#: whatsnew/2.6.rst:1331 msgid "" "The :func:`oct` builtin still returns numbers prefixed with a leading zero, " "and a new :func:`bin` builtin returns the binary representation for a " "number::" msgstr "" -#: whatsnew/2.6.rst:1331 +#: whatsnew/2.6.rst:1335 +msgid "" +">>> oct(42)\n" +"'052'\n" +">>> future_builtins.oct(42)\n" +"'0o52'\n" +">>> bin(173)\n" +"'0b10101101'" +msgstr "" + +#: whatsnew/2.6.rst:1342 msgid "" "The :func:`int` and :func:`long` builtins will now accept the \"0o\" and " "\"0b\" prefixes when base-8 or base-2 are requested, or when the *base* " @@ -1458,55 +1930,83 @@ msgid "" "the string)::" msgstr "" -#: whatsnew/2.6.rst:1349 +#: whatsnew/2.6.rst:1347 +msgid "" +">>> int ('0o52', 0)\n" +"42\n" +">>> int('1101', 2)\n" +"13\n" +">>> int('0b1101', 2)\n" +"13\n" +">>> int('0b1101', 0)\n" +"13" +msgstr "" + +#: whatsnew/2.6.rst:1359 msgid ":pep:`3127` - Integer Literal Support and Syntax" msgstr "" -#: whatsnew/2.6.rst:1349 +#: whatsnew/2.6.rst:1360 msgid "PEP written by Patrick Maupin; backported to 2.6 by Eric Smith." msgstr "" -#: whatsnew/2.6.rst:1357 +#: whatsnew/2.6.rst:1368 msgid "PEP 3129: Class Decorators" msgstr "" -#: whatsnew/2.6.rst:1359 +#: whatsnew/2.6.rst:1370 msgid "" "Decorators have been extended from functions to classes. It's now legal to " "write::" msgstr "" -#: whatsnew/2.6.rst:1367 +#: whatsnew/2.6.rst:1373 +msgid "" +"@foo\n" +"@bar\n" +"class A:\n" +" pass" +msgstr "" + +#: whatsnew/2.6.rst:1378 msgid "This is equivalent to::" msgstr "" -#: whatsnew/2.6.rst:1376 +#: whatsnew/2.6.rst:1380 +msgid "" +"class A:\n" +" pass\n" +"\n" +"A = foo(bar(A))" +msgstr "" + +#: whatsnew/2.6.rst:1387 msgid ":pep:`3129` - Class Decorators" msgstr "" -#: whatsnew/2.6.rst:1377 +#: whatsnew/2.6.rst:1388 msgid "PEP written by Collin Winter." msgstr "" -#: whatsnew/2.6.rst:1384 +#: whatsnew/2.6.rst:1395 msgid "PEP 3141: A Type Hierarchy for Numbers" msgstr "" -#: whatsnew/2.6.rst:1386 +#: whatsnew/2.6.rst:1397 msgid "" "Python 3.0 adds several abstract base classes for numeric types inspired by " "Scheme's numeric tower. These classes were backported to 2.6 as the :mod:" "`numbers` module." msgstr "" -#: whatsnew/2.6.rst:1390 +#: whatsnew/2.6.rst:1401 msgid "" "The most general ABC is :class:`Number`. It defines no operations at all, " "and only exists to allow checking if an object is a number by doing " "``isinstance(obj, Number)``." msgstr "" -#: whatsnew/2.6.rst:1394 +#: whatsnew/2.6.rst:1405 msgid "" ":class:`Complex` is a subclass of :class:`Number`. Complex numbers can " "undergo the basic operations of addition, subtraction, multiplication, " @@ -1515,14 +2015,14 @@ msgid "" "implementation of :class:`Complex`." msgstr "" -#: whatsnew/2.6.rst:1400 +#: whatsnew/2.6.rst:1411 msgid "" ":class:`Real` further derives from :class:`Complex`, and adds operations " "that only work on real numbers: :func:`floor`, :func:`trunc`, rounding, " "taking the remainder mod N, floor division, and comparisons." msgstr "" -#: whatsnew/2.6.rst:1405 +#: whatsnew/2.6.rst:1416 msgid "" ":class:`Rational` numbers derive from :class:`Real`, have :attr:`numerator` " "and :attr:`denominator` properties, and can be converted to floats. Python " @@ -1531,7 +2031,7 @@ msgid "" "`Rational` to avoid a name clash with :class:`numbers.Rational`.)" msgstr "" -#: whatsnew/2.6.rst:1412 +#: whatsnew/2.6.rst:1423 msgid "" ":class:`Integral` numbers derive from :class:`Rational`, and can be shifted " "left and right with ``<<`` and ``>>``, combined using bitwise operations " @@ -1539,7 +2039,7 @@ msgid "" "boundaries." msgstr "" -#: whatsnew/2.6.rst:1417 +#: whatsnew/2.6.rst:1428 msgid "" "In Python 3.0, the PEP slightly redefines the existing builtins :func:" "`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new one, :func:" @@ -1548,32 +2048,32 @@ msgid "" "the function's argument and zero." msgstr "" -#: whatsnew/2.6.rst:1426 +#: whatsnew/2.6.rst:1436 msgid ":pep:`3141` - A Type Hierarchy for Numbers" msgstr "" -#: whatsnew/2.6.rst:1426 +#: whatsnew/2.6.rst:1437 msgid "PEP written by Jeffrey Yasskin." msgstr "" -#: whatsnew/2.6.rst:1428 +#: whatsnew/2.6.rst:1439 msgid "" "`Scheme's numerical tower `__, from the Guile manual." msgstr "" -#: whatsnew/2.6.rst:1430 +#: whatsnew/2.6.rst:1441 msgid "" "`Scheme's number datatypes `__ from the R5RS " "Scheme specification." msgstr "" -#: whatsnew/2.6.rst:1434 +#: whatsnew/2.6.rst:1445 msgid "The :mod:`fractions` Module" msgstr "" -#: whatsnew/2.6.rst:1436 +#: whatsnew/2.6.rst:1447 msgid "" "To fill out the hierarchy of numeric types, the :mod:`fractions` module " "provides a rational-number class. Rational numbers store their values as a " @@ -1581,42 +2081,65 @@ msgid "" "numbers such as ``2/3`` that floating-point numbers can only approximate." msgstr "" -#: whatsnew/2.6.rst:1442 +#: whatsnew/2.6.rst:1453 msgid "" "The :class:`Fraction` constructor takes two :class:`Integral` values that " "will be the numerator and denominator of the resulting fraction. ::" msgstr "" -#: whatsnew/2.6.rst:1455 +#: whatsnew/2.6.rst:1456 +msgid "" +">>> from fractions import Fraction\n" +">>> a = Fraction(2, 3)\n" +">>> b = Fraction(2, 5)\n" +">>> float(a), float(b)\n" +"(0.66666666666666663, 0.40000000000000002)\n" +">>> a+b\n" +"Fraction(16, 15)\n" +">>> a/b\n" +"Fraction(5, 3)" +msgstr "" + +#: whatsnew/2.6.rst:1466 msgid "" "For converting floating-point numbers to rationals, the float type now has " -"an :meth:`as_integer_ratio()` method that returns the numerator and " +"an :meth:`as_integer_ratio` method that returns the numerator and " "denominator for a fraction that evaluates to the same floating-point value::" msgstr "" -#: whatsnew/2.6.rst:1467 +#: whatsnew/2.6.rst:1471 +msgid "" +">>> (2.5) .as_integer_ratio()\n" +"(5, 2)\n" +">>> (3.1415) .as_integer_ratio()\n" +"(7074029114692207L, 2251799813685248L)\n" +">>> (1./3) .as_integer_ratio()\n" +"(6004799503160661L, 18014398509481984L)" +msgstr "" + +#: whatsnew/2.6.rst:1478 msgid "" "Note that values that can only be approximated by floating-point numbers, " "such as 1./3, are not simplified to the number being approximated; the " "fraction attempts to match the floating-point value **exactly**." msgstr "" -#: whatsnew/2.6.rst:1472 +#: whatsnew/2.6.rst:1483 msgid "" "The :mod:`fractions` module is based upon an implementation by Sjoerd " "Mullender that was in Python's :file:`Demo/classes/` directory for a long " "time. This implementation was significantly updated by Jeffrey Yasskin." msgstr "" -#: whatsnew/2.6.rst:1479 +#: whatsnew/2.6.rst:1490 msgid "Other Language Changes" msgstr "" -#: whatsnew/2.6.rst:1481 +#: whatsnew/2.6.rst:1492 msgid "Some smaller changes made to the core Python language are:" msgstr "" -#: whatsnew/2.6.rst:1483 +#: whatsnew/2.6.rst:1494 msgid "" "Directories and zip archives containing a :file:`__main__.py` file can now " "be executed directly by passing their name to the interpreter. The directory " @@ -1625,7 +2148,7 @@ msgid "" "J. Eby and Nick Coghlan; :issue:`1739468`.)" msgstr "" -#: whatsnew/2.6.rst:1490 +#: whatsnew/2.6.rst:1501 msgid "" "The :func:`hasattr` function was catching and ignoring all errors, under the " "assumption that they meant a :meth:`__getattr__` method was failing somehow " @@ -1636,30 +2159,51 @@ msgid "" "`2196`.)" msgstr "" -#: whatsnew/2.6.rst:1498 +#: whatsnew/2.6.rst:1509 msgid "" "When calling a function using the ``**`` syntax to provide keyword " "arguments, you are no longer required to use a Python dictionary; any " "mapping will now work::" msgstr "" -#: whatsnew/2.6.rst:1511 +#: whatsnew/2.6.rst:1513 +msgid "" +">>> def f(**kw):\n" +"... print sorted(kw)\n" +"...\n" +">>> ud=UserDict.UserDict()\n" +">>> ud['a'] = 1\n" +">>> ud['b'] = 'string'\n" +">>> f(**ud)\n" +"['a', 'b']" +msgstr "" + +#: whatsnew/2.6.rst:1522 msgid "(Contributed by Alexander Belopolsky; :issue:`1686487`.)" msgstr "" -#: whatsnew/2.6.rst:1513 +#: whatsnew/2.6.rst:1524 msgid "" "It's also become legal to provide keyword arguments after a ``*args`` " "argument to a function call. ::" msgstr "" -#: whatsnew/2.6.rst:1522 +#: whatsnew/2.6.rst:1527 +msgid "" +">>> def f(*args, **kw):\n" +"... print args, kw\n" +"...\n" +">>> f(1,2,3, *(4,5,6), keyword=13)\n" +"(1, 2, 3, 4, 5, 6) {'keyword': 13}" +msgstr "" + +#: whatsnew/2.6.rst:1533 msgid "" "Previously this would have been a syntax error. (Contributed by Amaury " "Forgeot d'Arc; :issue:`3473`.)" msgstr "" -#: whatsnew/2.6.rst:1525 +#: whatsnew/2.6.rst:1536 msgid "" "A new builtin, ``next(iterator, [default])`` returns the next item from the " "specified iterator. If the *default* argument is supplied, it will be " @@ -1667,17 +2211,27 @@ msgid "" "`StopIteration` exception will be raised. (Backported in :issue:`2719`.)" msgstr "" -#: whatsnew/2.6.rst:1531 +#: whatsnew/2.6.rst:1542 +msgid "" +"Tuples now have :meth:`~tuple.index` and :meth:`~tuple.count` methods " +"matching the list type's :meth:`~list.index` and :meth:`~list.count` " +"methods::" +msgstr "" + +#: whatsnew/2.6.rst:1545 msgid "" -"Tuples now have :meth:`index` and :meth:`count` methods matching the list " -"type's :meth:`index` and :meth:`count` methods::" +">>> t = (0,1,2,3,4,0,1,2)\n" +">>> t.index(3)\n" +"3\n" +">>> t.count(0)\n" +"2" msgstr "" -#: whatsnew/2.6.rst:1540 +#: whatsnew/2.6.rst:1551 msgid "(Contributed by Raymond Hettinger)" msgstr "" -#: whatsnew/2.6.rst:1542 +#: whatsnew/2.6.rst:1553 msgid "" "The built-in types now have improved support for extended slicing syntax, " "accepting various combinations of ``(start, stop, step)``. Previously, the " @@ -1685,7 +2239,7 @@ msgid "" "Thomas Wouters.)" msgstr "" -#: whatsnew/2.6.rst:1549 +#: whatsnew/2.6.rst:1560 msgid "" "Properties now have three attributes, :attr:`getter`, :attr:`setter` and :" "attr:`deleter`, that are decorators providing useful shortcuts for adding a " @@ -1693,18 +2247,52 @@ msgid "" "them like this::" msgstr "" -#: whatsnew/2.6.rst:1576 +#: whatsnew/2.6.rst:1565 +msgid "" +"class C(object):\n" +" @property\n" +" def x(self):\n" +" return self._x\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value\n" +"\n" +" @x.deleter\n" +" def x(self):\n" +" del self._x\n" +"\n" +"class D(C):\n" +" @C.x.getter\n" +" def x(self):\n" +" return self._x * 2\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value / 2" +msgstr "" + +#: whatsnew/2.6.rst:1587 msgid "" "Several methods of the built-in set types now accept multiple iterables: :" "meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:" "`update`, :meth:`difference` and :meth:`difference_update`." msgstr "" -#: whatsnew/2.6.rst:1875 whatsnew/2.6.rst:1896 +#: whatsnew/2.6.rst:1595 +msgid "" +">>> s=set('1234567890')\n" +">>> s.intersection('abc123', 'cdf246') # Intersection between all inputs\n" +"set(['2'])\n" +">>> s.difference('246', '789')\n" +"set(['1', '0', '3', '5'])" +msgstr "" + +#: whatsnew/2.6.rst:1886 whatsnew/2.6.rst:1907 msgid "(Contributed by Raymond Hettinger.)" msgstr "" -#: whatsnew/2.6.rst:1592 +#: whatsnew/2.6.rst:1603 msgid "" "Many floating-point features were added. The :func:`float` function will " "now turn the string ``nan`` into an IEEE 754 Not A Number value, and " @@ -1713,14 +2301,14 @@ msgid "" "`1635`.)" msgstr "" -#: whatsnew/2.6.rst:1598 +#: whatsnew/2.6.rst:1609 msgid "" "Other functions in the :mod:`math` module, :func:`isinf` and :func:`isnan`, " "return true if their floating-point argument is infinite or Not A Number. (:" "issue:`1640`)" msgstr "" -#: whatsnew/2.6.rst:1602 +#: whatsnew/2.6.rst:1613 msgid "" "Conversion functions were added to convert floating-point numbers into " "hexadecimal strings (:issue:`3008`). These functions convert floats to and " @@ -1730,7 +2318,19 @@ msgid "" "converts a string back into a number::" msgstr "" -#: whatsnew/2.6.rst:1619 +#: whatsnew/2.6.rst:1621 +msgid "" +">>> a = 3.75\n" +">>> a.hex()\n" +"'0x1.e000000000000p+1'\n" +">>> float.fromhex('0x1.e000000000000p+1')\n" +"3.75\n" +">>> b=1./3\n" +">>> b.hex()\n" +"'0x1.5555555555555p-2'" +msgstr "" + +#: whatsnew/2.6.rst:1630 msgid "" "A numerical nicety: when creating a complex number from two floats on " "systems that support signed zeros (-0 and +0), the :func:`complex` " @@ -1738,7 +2338,7 @@ msgid "" "Dickinson; :issue:`1507`.)" msgstr "" -#: whatsnew/2.6.rst:1624 +#: whatsnew/2.6.rst:1635 msgid "" "Classes that inherit a :meth:`__hash__` method from a parent class can set " "``__hash__ = None`` to indicate that the class isn't hashable. This will " @@ -1746,7 +2346,7 @@ msgid "" "indicated as implementing the :class:`Hashable` ABC." msgstr "" -#: whatsnew/2.6.rst:1630 +#: whatsnew/2.6.rst:1641 msgid "" "You should do this when you've defined a :meth:`__cmp__` or :meth:`__eq__` " "method that compares objects by their value rather than by identity. All " @@ -1758,7 +2358,7 @@ msgid "" "d'Arc; :issue:`2235`.)" msgstr "" -#: whatsnew/2.6.rst:1640 +#: whatsnew/2.6.rst:1651 msgid "" "The :exc:`GeneratorExit` exception now subclasses :exc:`BaseException` " "instead of :exc:`Exception`. This means that an exception handler that does " @@ -1766,20 +2366,20 @@ msgid "" "(Contributed by Chad Austin; :issue:`1537`.)" msgstr "" -#: whatsnew/2.6.rst:1646 +#: whatsnew/2.6.rst:1657 msgid "" "Generator objects now have a :attr:`gi_code` attribute that refers to the " "original code object backing the generator. (Contributed by Collin Winter; :" "issue:`1473257`.)" msgstr "" -#: whatsnew/2.6.rst:1650 +#: whatsnew/2.6.rst:1661 msgid "" "The :func:`compile` built-in function now accepts keyword arguments as well " "as positional parameters. (Contributed by Thomas Wouters; :issue:`1444529`.)" msgstr "" -#: whatsnew/2.6.rst:1654 +#: whatsnew/2.6.rst:1665 msgid "" "The :func:`complex` constructor now accepts strings containing parenthesized " "complex numbers, meaning that ``complex(repr(cplx))`` will now round-trip " @@ -1787,7 +2387,7 @@ msgid "" "issue:`1491866`)" msgstr "" -#: whatsnew/2.6.rst:1659 +#: whatsnew/2.6.rst:1670 msgid "" "The string :meth:`translate` method now accepts ``None`` as the translation " "table parameter, which is treated as the identity transformation. This " @@ -1796,7 +2396,7 @@ msgid "" "`1193128`.)" msgstr "" -#: whatsnew/2.6.rst:1665 +#: whatsnew/2.6.rst:1676 msgid "" "The built-in :func:`dir` function now checks for a :meth:`__dir__` method on " "the objects it receives. This method must return a list of strings " @@ -1806,7 +2406,7 @@ msgid "" "pseudo-attributes they will honor. (:issue:`1591665`)" msgstr "" -#: whatsnew/2.6.rst:1673 +#: whatsnew/2.6.rst:1684 msgid "" "Instance method objects have new attributes for the object and function " "comprising the method; the new synonym for :attr:`!im_self` is :attr:" @@ -1815,7 +2415,7 @@ msgid "" "3.0." msgstr "" -#: whatsnew/2.6.rst:1679 +#: whatsnew/2.6.rst:1690 msgid "" "An obscure change: when you use the :func:`locals` function inside a :" "keyword:`class` statement, the resulting dictionary no longer returns free " @@ -1823,11 +2423,11 @@ msgid "" "keyword:`!class` statement that aren't attributes of the class.)" msgstr "" -#: whatsnew/2.6.rst:1688 +#: whatsnew/2.6.rst:1699 msgid "Optimizations" msgstr "" -#: whatsnew/2.6.rst:1690 +#: whatsnew/2.6.rst:1701 msgid "" "The :mod:`warnings` module has been rewritten in C. This makes it possible " "to invoke warnings from the parser, and may also make the interpreter's " @@ -1835,7 +2435,7 @@ msgid "" "`1631171`.)" msgstr "" -#: whatsnew/2.6.rst:1695 +#: whatsnew/2.6.rst:1706 msgid "" "Type objects now have a cache of methods that can reduce the work required " "to find the correct method implementation for a particular class; once " @@ -1846,7 +2446,7 @@ msgid "" "updated for Python 2.6 by Kevin Jacobs; :issue:`1700288`.)" msgstr "" -#: whatsnew/2.6.rst:1705 +#: whatsnew/2.6.rst:1716 msgid "" "By default, this change is only applied to types that are included with the " "Python core. Extension modules may not necessarily be compatible with this " @@ -1858,7 +2458,7 @@ msgid "" "interpreter to determine that. See :issue:`1878` for some discussion.)" msgstr "" -#: whatsnew/2.6.rst:1716 +#: whatsnew/2.6.rst:1727 msgid "" "Function calls that use keyword arguments are significantly faster by doing " "a quick pointer comparison, usually saving the time of a full string " @@ -1866,21 +2466,21 @@ msgid "" "implementation by Antoine Pitrou; :issue:`1819`.)" msgstr "" -#: whatsnew/2.6.rst:1721 +#: whatsnew/2.6.rst:1732 msgid "" "All of the functions in the :mod:`struct` module have been rewritten in C, " "thanks to work at the Need For Speed sprint. (Contributed by Raymond " "Hettinger.)" msgstr "" -#: whatsnew/2.6.rst:1725 +#: whatsnew/2.6.rst:1736 msgid "" "Some of the standard built-in types now set a bit in their type objects. " "This speeds up checking whether an object is a subclass of one of these " "types. (Contributed by Neal Norwitz.)" msgstr "" -#: whatsnew/2.6.rst:1729 +#: whatsnew/2.6.rst:1740 msgid "" "Unicode strings now use faster code for detecting whitespace and line " "breaks; this speeds up the :meth:`split` method by about 25% and :meth:" @@ -1888,27 +2488,27 @@ msgid "" "reduced by using pymalloc for the Unicode string's data." msgstr "" -#: whatsnew/2.6.rst:1735 +#: whatsnew/2.6.rst:1746 msgid "" "The ``with`` statement now stores the :meth:`~object.__exit__` method on the " "stack, producing a small speedup. (Implemented by Jeffrey Yasskin.)" msgstr "" -#: whatsnew/2.6.rst:1738 +#: whatsnew/2.6.rst:1749 msgid "" "To reduce memory usage, the garbage collector will now clear internal free " "lists when garbage-collecting the highest generation of objects. This may " "return memory to the operating system sooner." msgstr "" -#: whatsnew/2.6.rst:1747 +#: whatsnew/2.6.rst:1758 msgid "Interpreter Changes" msgstr "" -#: whatsnew/2.6.rst:1749 +#: whatsnew/2.6.rst:1760 msgid "" "Two command-line options have been reserved for use by other Python " -"implementations. The :option:`-J` switch has been reserved for use by " +"implementations. The :option:`!-J` switch has been reserved for use by " "Jython for Jython-specific options, such as switches that are passed to the " "underlying JVM. :option:`-X` has been reserved for options specific to a " "particular implementation of Python such as CPython, Jython, or IronPython. " @@ -1916,7 +2516,7 @@ msgid "" "the option isn't currently used." msgstr "" -#: whatsnew/2.6.rst:1757 +#: whatsnew/2.6.rst:1768 msgid "" "Python can now be prevented from writing :file:`.pyc` or :file:`.pyo` files " "by supplying the :option:`-B` switch to the Python interpreter, or by " @@ -1927,7 +2527,7 @@ msgid "" "and Georg Brandl.)" msgstr "" -#: whatsnew/2.6.rst:1765 +#: whatsnew/2.6.rst:1776 msgid "" "The encoding used for standard input, output, and standard error can be " "specified by setting the :envvar:`PYTHONIOENCODING` environment variable " @@ -1939,11 +2539,11 @@ msgid "" "\"replace\". (Contributed by Martin von Löwis.)" msgstr "" -#: whatsnew/2.6.rst:1778 +#: whatsnew/2.6.rst:1789 msgid "New and Improved Modules" msgstr "" -#: whatsnew/2.6.rst:1780 +#: whatsnew/2.6.rst:1791 msgid "" "As in every release, Python's standard library received a number of " "enhancements and bug fixes. Here's a partial list of the most notable " @@ -1952,14 +2552,14 @@ msgid "" "the Subversion logs for all the details." msgstr "" -#: whatsnew/2.6.rst:1786 +#: whatsnew/2.6.rst:1797 msgid "" "The :mod:`!asyncore` and :mod:`!asynchat` modules are being actively " "maintained again, and a number of patches and bugfixes were applied. " "(Maintained by Josiah Carlson; see :issue:`1736190` for one patch.)" msgstr "" -#: whatsnew/2.6.rst:1791 +#: whatsnew/2.6.rst:1802 msgid "" "The :mod:`bsddb` module also has a new maintainer, Jesús Cea Avión, and the " "package is now available as a standalone package. The web page for the " @@ -1969,66 +2569,66 @@ msgid "" "frequent than Python's." msgstr "" -#: whatsnew/2.6.rst:1799 +#: whatsnew/2.6.rst:1810 msgid "" "The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol " "available, instead of restricting itself to protocol 1. (Contributed by W. " "Barnes.)" msgstr "" -#: whatsnew/2.6.rst:1803 +#: whatsnew/2.6.rst:1814 msgid "" -"The :mod:`cgi` module will now read variables from the query string of an " +"The :mod:`!cgi` module will now read variables from the query string of an " "HTTP POST request. This makes it possible to use form actions with URLs " "that include query strings such as \"/cgi-bin/add.py?category=1\". " "(Contributed by Alexandre Fiori and Nubis; :issue:`1817`.)" msgstr "" -#: whatsnew/2.6.rst:1809 +#: whatsnew/2.6.rst:1820 msgid "" "The :func:`parse_qs` and :func:`parse_qsl` functions have been relocated " -"from the :mod:`cgi` module to the :mod:`urlparse ` module. The " -"versions still available in the :mod:`!cgi` module will trigger :exc:" +"from the :mod:`!cgi` module to the :mod:`urlparse ` module. " +"The versions still available in the :mod:`!cgi` module will trigger :exc:" "`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." msgstr "" -#: whatsnew/2.6.rst:1815 +#: whatsnew/2.6.rst:1826 msgid "" "The :mod:`cmath` module underwent extensive revision, contributed by Mark " "Dickinson and Christian Heimes. Five new functions were added:" msgstr "" -#: whatsnew/2.6.rst:1819 +#: whatsnew/2.6.rst:1830 msgid "" ":func:`polar` converts a complex number to polar form, returning the modulus " "and argument of the complex number." msgstr "" -#: whatsnew/2.6.rst:1822 +#: whatsnew/2.6.rst:1833 msgid "" ":func:`rect` does the opposite, turning a modulus, argument pair back into " "the corresponding complex number." msgstr "" -#: whatsnew/2.6.rst:1825 +#: whatsnew/2.6.rst:1836 msgid "" ":func:`phase` returns the argument (also called the angle) of a complex " "number." msgstr "" -#: whatsnew/2.6.rst:1828 +#: whatsnew/2.6.rst:1839 msgid "" ":func:`isnan` returns True if either the real or imaginary part of its " "argument is a NaN." msgstr "" -#: whatsnew/2.6.rst:1831 +#: whatsnew/2.6.rst:1842 msgid "" ":func:`isinf` returns True if either the real or imaginary part of its " "argument is infinite." msgstr "" -#: whatsnew/2.6.rst:1834 +#: whatsnew/2.6.rst:1845 msgid "" "The revisions also improved the numerical soundness of the :mod:`cmath` " "module. For all functions, the real and imaginary parts of the results are " @@ -2037,27 +2637,48 @@ msgid "" "`atanh`: and :func:`atan` have also been corrected." msgstr "" -#: whatsnew/2.6.rst:1841 +#: whatsnew/2.6.rst:1852 msgid "" "The tests for the module have been greatly expanded; nearly 2000 new test " "cases exercise the algebraic functions." msgstr "" -#: whatsnew/2.6.rst:1844 +#: whatsnew/2.6.rst:1855 msgid "" "On IEEE 754 platforms, the :mod:`cmath` module now handles IEEE 754 special " "values and floating-point exceptions in a manner consistent with Annex 'G' " "of the C99 standard." msgstr "" -#: whatsnew/2.6.rst:1848 +#: whatsnew/2.6.rst:1859 msgid "" "A new data type in the :mod:`collections` module: ``namedtuple(typename, " "fieldnames)`` is a factory function that creates subclasses of the standard " "tuple whose fields are accessible by name as well as index. For example::" msgstr "" -#: whatsnew/2.6.rst:1870 +#: whatsnew/2.6.rst:1863 +msgid "" +">>> var_type = collections.namedtuple('variable',\n" +"... 'id name type size')\n" +">>> # Names are separated by spaces or commas.\n" +">>> # 'id, name, type, size' would also work.\n" +">>> var_type._fields\n" +"('id', 'name', 'type', 'size')\n" +"\n" +">>> var = var_type(1, 'frequency', 'int', 4)\n" +">>> print var[0], var.id # Equivalent\n" +"1 1\n" +">>> print var[2], var.type # Equivalent\n" +"int int\n" +">>> var._asdict()\n" +"{'size': 4, 'type': 'int', 'id': 1, 'name': 'frequency'}\n" +">>> v2 = var._replace(name='amplitude')\n" +">>> v2\n" +"variable(id=1, name='amplitude', type='int', size=4)" +msgstr "" + +#: whatsnew/2.6.rst:1881 msgid "" "Several places in the standard library that returned tuples have been " "modified to return :func:`namedtuple` instances. For example, the :meth:" @@ -2065,7 +2686,7 @@ msgid "" "`digits`, and :attr:`exponent` fields." msgstr "" -#: whatsnew/2.6.rst:1877 +#: whatsnew/2.6.rst:1888 msgid "" "Another change to the :mod:`collections` module is that the :class:`deque` " "type now supports an optional *maxlen* parameter; if supplied, the deque's " @@ -2073,7 +2694,21 @@ msgid "" "to a full deque causes old items to be discarded." msgstr "" -#: whatsnew/2.6.rst:1898 +#: whatsnew/2.6.rst:1896 +msgid "" +">>> from collections import deque\n" +">>> dq=deque(maxlen=3)\n" +">>> dq\n" +"deque([], maxlen=3)\n" +">>> dq.append(1); dq.append(2); dq.append(3)\n" +">>> dq\n" +"deque([1, 2, 3], maxlen=3)\n" +">>> dq.append(4)\n" +">>> dq\n" +"deque([2, 3, 4], maxlen=3)" +msgstr "" + +#: whatsnew/2.6.rst:1909 msgid "" "The :mod:`Cookie ` module's :class:`~http.cookies.Morsel` " "objects now support an :attr:`~http.cookies.Morsel.httponly` attribute. In " @@ -2082,14 +2717,21 @@ msgid "" "`1638033`.)" msgstr "" -#: whatsnew/2.6.rst:1903 +#: whatsnew/2.6.rst:1914 msgid "" "A new window method in the :mod:`curses` module, :meth:`chgat`, changes the " "display attributes for a certain number of characters on a single line. " "(Contributed by Fabian Kreutz.)" msgstr "" -#: whatsnew/2.6.rst:1913 +#: whatsnew/2.6.rst:1920 +msgid "" +"# Boldface text starting at y=0,x=21\n" +"# and affecting the rest of the line.\n" +"stdscr.chgat(0, 21, curses.A_BOLD)" +msgstr "" + +#: whatsnew/2.6.rst:1924 msgid "" "The :class:`Textbox` class in the :mod:`curses.textpad` module now supports " "editing in insert mode as well as overwrite mode. Insert mode is enabled by " @@ -2097,7 +2739,7 @@ msgid "" "class:`Textbox` instance." msgstr "" -#: whatsnew/2.6.rst:1918 +#: whatsnew/2.6.rst:1929 msgid "" "The :mod:`datetime` module's :meth:`strftime` methods now support a ``%f`` " "format code that expands to the number of microseconds in the object, zero-" @@ -2105,7 +2747,7 @@ msgid "" "`1158`.)" msgstr "" -#: whatsnew/2.6.rst:1923 +#: whatsnew/2.6.rst:1934 msgid "" "The :mod:`decimal` module was updated to version 1.66 of `the General " "Decimal Specification `__. " @@ -2113,26 +2755,36 @@ msgid "" "as :meth:`exp` and :meth:`log10`::" msgstr "" -#: whatsnew/2.6.rst:1935 +#: whatsnew/2.6.rst:1939 +msgid "" +">>> Decimal(1).exp()\n" +"Decimal(\"2.718281828459045235360287471\")\n" +">>> Decimal(\"2.7182818\").ln()\n" +"Decimal(\"0.9999999895305022877376682436\")\n" +">>> Decimal(1000).log10()\n" +"Decimal(\"3\")" +msgstr "" + +#: whatsnew/2.6.rst:1946 msgid "" "The :meth:`as_tuple` method of :class:`Decimal` objects now returns a named " "tuple with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields." msgstr "" -#: whatsnew/2.6.rst:1938 +#: whatsnew/2.6.rst:1949 msgid "" "(Implemented by Facundo Batista and Mark Dickinson. Named tuple support " "added by Raymond Hettinger.)" msgstr "" -#: whatsnew/2.6.rst:1941 +#: whatsnew/2.6.rst:1952 msgid "" "The :mod:`difflib` module's :class:`SequenceMatcher` class now returns named " "tuples representing matches, with :attr:`a`, :attr:`b`, and :attr:`size` " "attributes. (Contributed by Raymond Hettinger.)" msgstr "" -#: whatsnew/2.6.rst:1946 +#: whatsnew/2.6.rst:1957 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " "was added to the :class:`ftplib.FTP` class constructor as well as the :meth:" @@ -2142,7 +2794,7 @@ msgid "" "data has been sent. (Contributed by Phil Schwartz; :issue:`1221598`.)" msgstr "" -#: whatsnew/2.6.rst:1954 +#: whatsnew/2.6.rst:1965 msgid "" "The :func:`reduce` built-in function is also available in the :mod:" "`functools` module. In Python 3.0, the builtin has been dropped and :func:" @@ -2151,7 +2803,7 @@ msgid "" "issue:`1739906`.)" msgstr "" -#: whatsnew/2.6.rst:1960 +#: whatsnew/2.6.rst:1971 msgid "" "When possible, the :mod:`getpass` module will now use :file:`/dev/tty` to " "print a prompt message and read the password, falling back to standard error " @@ -2160,14 +2812,14 @@ msgid "" "P. Smith.)" msgstr "" -#: whatsnew/2.6.rst:1966 +#: whatsnew/2.6.rst:1977 msgid "" "The :func:`glob.glob` function can now return Unicode filenames if a Unicode " "path was used and Unicode filenames are matched within the directory. (:" "issue:`1001604`)" msgstr "" -#: whatsnew/2.6.rst:1970 +#: whatsnew/2.6.rst:1981 msgid "" "A new function in the :mod:`heapq` module, ``merge(iter1, iter2, ...)``, " "takes any number of iterables returning data in sorted order, and returns a " @@ -2175,14 +2827,20 @@ msgid "" "order. For example::" msgstr "" -#: whatsnew/2.6.rst:1978 +#: whatsnew/2.6.rst:1986 +msgid "" +">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" +"[1, 2, 3, 5, 8, 9, 16]" +msgstr "" + +#: whatsnew/2.6.rst:1989 msgid "" "Another new function, ``heappushpop(heap, item)``, pushes *item* onto " "*heap*, then pops off and returns the smallest item. This is more efficient " "than making a call to :func:`heappush` and then :func:`heappop`." msgstr "" -#: whatsnew/2.6.rst:1983 +#: whatsnew/2.6.rst:1994 msgid "" ":mod:`heapq` is now implemented to only use less-than comparison, instead of " "the less-than-or-equal comparison it previously used. This makes :mod:" @@ -2190,7 +2848,7 @@ msgid "" "by Raymond Hettinger.)" msgstr "" -#: whatsnew/2.6.rst:1989 +#: whatsnew/2.6.rst:2000 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " "was added to the :class:`httplib.HTTPConnection >> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" +"((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" +msgstr "" + +#: whatsnew/2.6.rst:2024 msgid "" "``product(iter1, iter2, ..., [repeat=N])`` returns the Cartesian product of " "the supplied iterables, a set of tuples containing every possible " "combination of the elements returned from each iterable. ::" msgstr "" -#: whatsnew/2.6.rst:2022 +#: whatsnew/2.6.rst:2028 +msgid "" +">>> list(itertools.product([1,2,3], [4,5,6]))\n" +"[(1, 4), (1, 5), (1, 6),\n" +" (2, 4), (2, 5), (2, 6),\n" +" (3, 4), (3, 5), (3, 6)]" +msgstr "" + +#: whatsnew/2.6.rst:2033 msgid "" "The optional *repeat* keyword argument is used for taking the product of an " "iterable or a set of iterables with themselves, repeated *N* times. With a " "single iterable argument, *N*-tuples are returned::" msgstr "" -#: whatsnew/2.6.rst:2031 +#: whatsnew/2.6.rst:2038 +msgid "" +">>> list(itertools.product([1,2], repeat=3))\n" +"[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" +" (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" +msgstr "" + +#: whatsnew/2.6.rst:2042 msgid "With two iterables, *2N*-tuples are returned. ::" msgstr "" -#: whatsnew/2.6.rst:2039 +#: whatsnew/2.6.rst:2044 +msgid "" +">>> list(itertools.product([1,2], [3,4], repeat=2))\n" +"[(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),\n" +" (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4),\n" +" (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" +" (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" +msgstr "" + +#: whatsnew/2.6.rst:2050 msgid "" "``combinations(iterable, r)`` returns sub-sequences of length *r* from the " "elements of *iterable*. ::" msgstr "" -#: whatsnew/2.6.rst:2050 +#: whatsnew/2.6.rst:2053 +msgid "" +">>> list(itertools.combinations('123', 2))\n" +"[('1', '2'), ('1', '3'), ('2', '3')]\n" +">>> list(itertools.combinations('123', 3))\n" +"[('1', '2', '3')]\n" +">>> list(itertools.combinations('1234', 3))\n" +"[('1', '2', '3'), ('1', '2', '4'),\n" +" ('1', '3', '4'), ('2', '3', '4')]" +msgstr "" + +#: whatsnew/2.6.rst:2061 msgid "" "``permutations(iter[, r])`` returns all the permutations of length *r* of " "the iterable's elements. If *r* is not specified, it will default to the " "number of elements produced by the iterable. ::" msgstr "" -#: whatsnew/2.6.rst:2060 +#: whatsnew/2.6.rst:2065 +msgid "" +">>> list(itertools.permutations([1,2,3,4], 2))\n" +"[(1, 2), (1, 3), (1, 4),\n" +" (2, 1), (2, 3), (2, 4),\n" +" (3, 1), (3, 2), (3, 4),\n" +" (4, 1), (4, 2), (4, 3)]" +msgstr "" + +#: whatsnew/2.6.rst:2071 msgid "" "``itertools.chain(*iterables)`` is an existing function in :mod:`itertools` " "that gained a new constructor in Python 2.6. ``itertools.chain." @@ -2263,11 +2971,17 @@ msgid "" "iterable, then all the elements of the second, and so on. ::" msgstr "" -#: whatsnew/2.6.rst:2070 +#: whatsnew/2.6.rst:2078 +msgid "" +">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" +"[1, 2, 3, 4, 5, 6]" +msgstr "" + +#: whatsnew/2.6.rst:2081 msgid "(All contributed by Raymond Hettinger.)" msgstr "" -#: whatsnew/2.6.rst:2072 +#: whatsnew/2.6.rst:2083 msgid "" "The :mod:`logging` module's :class:`FileHandler` class and its subclasses :" "class:`WatchedFileHandler`, :class:`RotatingFileHandler`, and :class:" @@ -2276,68 +2990,68 @@ msgid "" "the first :meth:`emit` call is made. (Contributed by Vinay Sajip.)" msgstr "" -#: whatsnew/2.6.rst:2079 +#: whatsnew/2.6.rst:2090 msgid "" ":class:`TimedRotatingFileHandler` also has a *utc* constructor parameter. " "If the argument is true, UTC time will be used in determining when midnight " "occurs and in generating filenames; otherwise local time will be used." msgstr "" -#: whatsnew/2.6.rst:2084 +#: whatsnew/2.6.rst:2095 msgid "Several new functions were added to the :mod:`math` module:" msgstr "" -#: whatsnew/2.6.rst:2086 +#: whatsnew/2.6.rst:2097 msgid "" ":func:`~math.isinf` and :func:`~math.isnan` determine whether a given float " "is a (positive or negative) infinity or a NaN (Not a Number), respectively." msgstr "" -#: whatsnew/2.6.rst:2089 +#: whatsnew/2.6.rst:2100 msgid "" ":func:`~math.copysign` copies the sign bit of an IEEE 754 number, returning " "the absolute value of *x* combined with the sign bit of *y*. For example, " "``math.copysign(1, -0.0)`` returns -1.0. (Contributed by Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:2094 +#: whatsnew/2.6.rst:2105 msgid "" ":func:`~math.factorial` computes the factorial of a number. (Contributed by " "Raymond Hettinger; :issue:`2138`.)" msgstr "" -#: whatsnew/2.6.rst:2097 +#: whatsnew/2.6.rst:2108 msgid "" ":func:`~math.fsum` adds up the stream of numbers from an iterable, and is " "careful to avoid loss of precision through using partial sums. (Contributed " "by Jean Brouwers, Raymond Hettinger, and Mark Dickinson; :issue:`2819`.)" msgstr "" -#: whatsnew/2.6.rst:2102 +#: whatsnew/2.6.rst:2113 msgid "" ":func:`~math.acosh`, :func:`~math.asinh` and :func:`~math.atanh` compute the " "inverse hyperbolic functions." msgstr "" -#: whatsnew/2.6.rst:2105 +#: whatsnew/2.6.rst:2116 msgid ":func:`~math.log1p` returns the natural logarithm of *1+x* (base *e*)." msgstr "" -#: whatsnew/2.6.rst:2108 +#: whatsnew/2.6.rst:2119 msgid "" ":func:`trunc` rounds a number toward zero, returning the closest :class:" "`Integral` that's between the function's argument and zero. Added as part of " "the backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__." msgstr "" -#: whatsnew/2.6.rst:2113 +#: whatsnew/2.6.rst:2124 msgid "" "The :mod:`math` module has been improved to give more consistent behaviour " "across platforms, especially with respect to handling of floating-point " "exceptions and IEEE 754 special values." msgstr "" -#: whatsnew/2.6.rst:2117 +#: whatsnew/2.6.rst:2128 msgid "" "Whenever possible, the module follows the recommendations of the C99 " "standard about 754's special values. For example, ``sqrt(-1.)`` should now " @@ -2349,11 +3063,11 @@ msgid "" "`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" msgstr "" -#: whatsnew/2.6.rst:2127 +#: whatsnew/2.6.rst:2138 msgid "(Contributed by Christian Heimes and Mark Dickinson.)" msgstr "" -#: whatsnew/2.6.rst:2129 +#: whatsnew/2.6.rst:2140 msgid "" ":class:`~mmap.mmap` objects now have a :meth:`rfind` method that searches " "for a substring beginning at the end of the string and searching backwards. " @@ -2361,28 +3075,46 @@ msgid "" "which to stop searching. (Contributed by John Lenton.)" msgstr "" -#: whatsnew/2.6.rst:2135 +#: whatsnew/2.6.rst:2146 msgid "" "The :mod:`operator` module gained a :func:`methodcaller` function that takes " "a name and an optional set of arguments, returning a callable that will call " "the named function on any arguments passed to it. For example::" msgstr "" -#: whatsnew/2.6.rst:2145 +#: whatsnew/2.6.rst:2151 +msgid "" +">>> # Equivalent to lambda s: s.replace('old', 'new')\n" +">>> replacer = operator.methodcaller('replace', 'old', 'new')\n" +">>> replacer('old wine in old bottles')\n" +"'new wine in new bottles'" +msgstr "" + +#: whatsnew/2.6.rst:2156 msgid "(Contributed by Georg Brandl, after a suggestion by Gregory Petrosyan.)" msgstr "" -#: whatsnew/2.6.rst:2147 +#: whatsnew/2.6.rst:2158 msgid "" "The :func:`attrgetter` function now accepts dotted names and performs the " "corresponding attribute lookups::" msgstr "" -#: whatsnew/2.6.rst:2157 +#: whatsnew/2.6.rst:2161 +msgid "" +">>> inst_name = operator.attrgetter(\n" +"... '__class__.__name__')\n" +">>> inst_name('')\n" +"'str'\n" +">>> inst_name(help)\n" +"'_Helper'" +msgstr "" + +#: whatsnew/2.6.rst:2168 msgid "(Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)" msgstr "" -#: whatsnew/2.6.rst:2159 +#: whatsnew/2.6.rst:2170 msgid "" "The :mod:`os` module now wraps several new system calls. ``fchmod(fd, " "mode)`` and ``fchown(fd, uid, gid)`` change the mode and ownership of an " @@ -2390,7 +3122,7 @@ msgid "" "(Contributed by Georg Brandl and Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:2165 +#: whatsnew/2.6.rst:2176 msgid "" ":func:`chflags` and :func:`lchflags` are wrappers for the corresponding " "system calls (where they're available), changing the flags set on a file. " @@ -2400,7 +3132,7 @@ msgid "" "the file. (Contributed by M. Levinson.)" msgstr "" -#: whatsnew/2.6.rst:2173 +#: whatsnew/2.6.rst:2184 msgid "" "``os.closerange(low, high)`` efficiently closes all file descriptors from " "*low* to *high*, ignoring any errors and not including *high* itself. This " @@ -2408,14 +3140,14 @@ msgid "" "processes faster. (Contributed by Georg Brandl; :issue:`1663329`.)" msgstr "" -#: whatsnew/2.6.rst:2178 +#: whatsnew/2.6.rst:2189 msgid "" "The ``os.environ`` object's :meth:`clear` method will now unset the " "environment variables using :func:`os.unsetenv` in addition to clearing the " "object's keys. (Contributed by Martin Horcicka; :issue:`1181`.)" msgstr "" -#: whatsnew/2.6.rst:2182 +#: whatsnew/2.6.rst:2193 msgid "" "The :func:`os.walk` function now has a ``followlinks`` parameter. If set to " "True, it will follow symlinks pointing to directories and visit the " @@ -2424,7 +3156,7 @@ msgid "" "if there's a symlink that points to a parent directory. (:issue:`1273829`)" msgstr "" -#: whatsnew/2.6.rst:2189 +#: whatsnew/2.6.rst:2200 msgid "" "In the :mod:`os.path` module, the :func:`splitext` function has been changed " "to not split on leading period characters. This produces better results when " @@ -2433,7 +3165,7 @@ msgid "" "`1115886`)" msgstr "" -#: whatsnew/2.6.rst:2196 +#: whatsnew/2.6.rst:2207 msgid "" "A new function, ``os.path.relpath(path, start='.')``, returns a relative " "path from the ``start`` path, if it's supplied, or from the current working " @@ -2441,14 +3173,14 @@ msgid "" "issue:`1339796`.)" msgstr "" -#: whatsnew/2.6.rst:2201 +#: whatsnew/2.6.rst:2212 msgid "" "On Windows, :func:`os.path.expandvars` will now expand environment variables " "given in the form \"%var%\", and \"~user\" will be expanded into the user's " "home directory path. (Contributed by Josiah Carlson; :issue:`957650`.)" msgstr "" -#: whatsnew/2.6.rst:2206 +#: whatsnew/2.6.rst:2217 msgid "" "The Python debugger provided by the :mod:`pdb` module gained a new command: " "\"run\" restarts the Python program being debugged and can optionally take " @@ -2456,14 +3188,14 @@ msgid "" "Bernstein; :issue:`1393667`.)" msgstr "" -#: whatsnew/2.6.rst:2211 +#: whatsnew/2.6.rst:2222 msgid "" "The :func:`pdb.post_mortem` function, used to begin debugging a traceback, " "will now use the traceback returned by :func:`sys.exc_info` if no traceback " "is supplied. (Contributed by Facundo Batista; :issue:`1106316`.)" msgstr "" -#: whatsnew/2.6.rst:2216 +#: whatsnew/2.6.rst:2227 msgid "" "The :mod:`pickletools` module now has an :func:`optimize` function that " "takes a string containing a pickle and removes some unused opcodes, " @@ -2471,7 +3203,7 @@ msgid "" "(Contributed by Raymond Hettinger.)" msgstr "" -#: whatsnew/2.6.rst:2221 +#: whatsnew/2.6.rst:2232 msgid "" "A :func:`get_data` function was added to the :mod:`pkgutil` module that " "returns the contents of resource files included with an installed Python " @@ -2479,17 +3211,31 @@ msgid "" msgstr "" #: whatsnew/2.6.rst:2236 +msgid "" +">>> import pkgutil\n" +">>> print pkgutil.get_data('test', 'exception_hierarchy.txt')\n" +"BaseException\n" +" +-- SystemExit\n" +" +-- KeyboardInterrupt\n" +" +-- GeneratorExit\n" +" +-- Exception\n" +" +-- StopIteration\n" +" +-- StandardError\n" +" ..." +msgstr "" + +#: whatsnew/2.6.rst:2247 msgid "(Contributed by Paul Moore; :issue:`2439`.)" msgstr "" -#: whatsnew/2.6.rst:2238 +#: whatsnew/2.6.rst:2249 msgid "" "The :mod:`pyexpat` module's :class:`Parser` objects now allow setting their :" "attr:`buffer_size` attribute to change the size of the buffer used to hold " "character data. (Contributed by Achim Gaedke; :issue:`1137`.)" msgstr "" -#: whatsnew/2.6.rst:2243 +#: whatsnew/2.6.rst:2254 msgid "" "The :mod:`Queue` module now provides queue variants that retrieve entries in " "different orders. The :class:`PriorityQueue` class stores queued items in a " @@ -2498,7 +3244,7 @@ msgid "" "(Contributed by Raymond Hettinger.)" msgstr "" -#: whatsnew/2.6.rst:2250 +#: whatsnew/2.6.rst:2261 msgid "" "The :mod:`random` module's :class:`Random` objects can now be pickled on a " "32-bit system and unpickled on a 64-bit system, and vice versa. " @@ -2507,7 +3253,7 @@ msgid "" "(Contributed by Shawn Ligocki; :issue:`1727780`.)" msgstr "" -#: whatsnew/2.6.rst:2257 +#: whatsnew/2.6.rst:2268 msgid "" "The new ``triangular(low, high, mode)`` function returns random numbers " "following a triangular distribution. The returned values are between *low* " @@ -2516,14 +3262,14 @@ msgid "" "der Laan and Raymond Hettinger; :issue:`1681432`.)" msgstr "" -#: whatsnew/2.6.rst:2264 +#: whatsnew/2.6.rst:2275 msgid "" "Long regular expression searches carried out by the :mod:`re` module will " "check for signals being delivered, so time-consuming searches can now be " "interrupted. (Contributed by Josh Hoyt and Ralf Schmitt; :issue:`846388`.)" msgstr "" -#: whatsnew/2.6.rst:2269 +#: whatsnew/2.6.rst:2280 msgid "" "The regular expression module is implemented by compiling bytecodes for a " "tiny regex-specific virtual machine. Untrusted code could create malicious " @@ -2532,14 +3278,14 @@ msgid "" "for Google App Engine; :issue:`3487`.)" msgstr "" -#: whatsnew/2.6.rst:2276 +#: whatsnew/2.6.rst:2287 msgid "" -"The :mod:`rlcompleter` module's :meth:`Completer.complete()` method will now " +"The :mod:`rlcompleter` module's :meth:`Completer.complete` method will now " "ignore exceptions triggered while evaluating a name. (Fixed by Lorenz " "Quack; :issue:`2250`.)" msgstr "" -#: whatsnew/2.6.rst:2280 +#: whatsnew/2.6.rst:2291 msgid "" "The :mod:`sched` module's :class:`scheduler` instances now have a read-only :" "attr:`queue` attribute that returns the contents of the scheduler's queue, " @@ -2547,7 +3293,7 @@ msgid "" "action, argument)``. (Contributed by Raymond Hettinger; :issue:`1861`.)" msgstr "" -#: whatsnew/2.6.rst:2286 +#: whatsnew/2.6.rst:2297 msgid "" "The :mod:`select` module now has wrapper functions for the Linux :c:func:`!" "epoll` and BSD :c:func:`!kqueue` system calls. :meth:`modify` method was " @@ -2557,7 +3303,7 @@ msgid "" "Heimes; :issue:`1657`.)" msgstr "" -#: whatsnew/2.6.rst:2294 +#: whatsnew/2.6.rst:2305 msgid "" "The :func:`shutil.copytree` function now has an optional *ignore* argument " "that takes a callable object. This callable will receive each directory " @@ -2565,7 +3311,7 @@ msgid "" "that will be ignored, not copied." msgstr "" -#: whatsnew/2.6.rst:2299 +#: whatsnew/2.6.rst:2310 msgid "" "The :mod:`shutil` module also provides an :func:`ignore_patterns` function " "for use with this new parameter. :func:`ignore_patterns` takes an arbitrary " @@ -2575,11 +3321,17 @@ msgid "" "Emacs backup files, which have names ending with '~'::" msgstr "" -#: whatsnew/2.6.rst:2310 +#: whatsnew/2.6.rst:2318 +msgid "" +"shutil.copytree('Doc/library', '/tmp/library',\n" +" ignore=shutil.ignore_patterns('*~', '.svn'))" +msgstr "" + +#: whatsnew/2.6.rst:2321 msgid "(Contributed by Tarek Ziadé; :issue:`2663`.)" msgstr "" -#: whatsnew/2.6.rst:2312 +#: whatsnew/2.6.rst:2323 msgid "" "Integrating signal handling with GUI handling event loops like those used by " "Tkinter or GTk+ has long been a problem; most software ends up polling, " @@ -2591,7 +3343,7 @@ msgid "" "descriptor." msgstr "" -#: whatsnew/2.6.rst:2322 +#: whatsnew/2.6.rst:2333 msgid "" "Event loops will use this by opening a pipe to create two descriptors, one " "for reading and one for writing. The writable descriptor will be passed to :" @@ -2601,18 +3353,18 @@ msgid "" "loop will be woken up, avoiding the need to poll." msgstr "" -#: whatsnew/2.6.rst:2330 +#: whatsnew/2.6.rst:2341 msgid "(Contributed by Adam Olsen; :issue:`1583`.)" msgstr "" -#: whatsnew/2.6.rst:2332 +#: whatsnew/2.6.rst:2343 msgid "" "The :func:`siginterrupt` function is now available from Python code, and " "allows changing whether signals can interrupt system calls or not. " "(Contributed by Ralf Schmitt.)" msgstr "" -#: whatsnew/2.6.rst:2336 +#: whatsnew/2.6.rst:2347 msgid "" "The :func:`setitimer` and :func:`getitimer` functions have also been added " "(where they're available). :func:`setitimer` allows setting interval timers " @@ -2621,7 +3373,7 @@ msgid "" "process+system time. (Contributed by Guilherme Polo; :issue:`2240`.)" msgstr "" -#: whatsnew/2.6.rst:2343 +#: whatsnew/2.6.rst:2354 msgid "" "The :mod:`smtplib` module now supports SMTP over SSL thanks to the addition " "of the :class:`SMTP_SSL` class. This class supports an interface identical " @@ -2631,7 +3383,7 @@ msgid "" "seconds. (Contributed by Facundo Batista.)" msgstr "" -#: whatsnew/2.6.rst:2351 +#: whatsnew/2.6.rst:2362 msgid "" "An implementation of the LMTP protocol (:rfc:`2033`) was also added to the " "module. LMTP is used in place of SMTP when transferring e-mail between " @@ -2639,14 +3391,14 @@ msgid "" "issue:`957003`.)" msgstr "" -#: whatsnew/2.6.rst:2356 +#: whatsnew/2.6.rst:2367 msgid "" ":meth:`SMTP.starttls` now complies with :rfc:`3207` and forgets any " "knowledge obtained from the server not obtained from the TLS negotiation " "itself. (Patch contributed by Bill Fenner; :issue:`829951`.)" msgstr "" -#: whatsnew/2.6.rst:2361 +#: whatsnew/2.6.rst:2372 msgid "" "The :mod:`socket` module now supports TIPC (https://tipc.sourceforge.net/), " "a high-performance non-IP-based protocol designed for use in clustered " @@ -2654,7 +3406,7 @@ msgid "" "Bertogli; :issue:`1646`.)" msgstr "" -#: whatsnew/2.6.rst:2366 +#: whatsnew/2.6.rst:2377 msgid "" "A new function, :func:`create_connection`, takes an address and connects to " "it using an optional timeout value, returning the connected socket object. " @@ -2664,7 +3416,7 @@ msgid "" "make your code work with IPv6." msgstr "" -#: whatsnew/2.6.rst:2374 +#: whatsnew/2.6.rst:2385 msgid "" "The base classes in the :mod:`SocketServer ` module now " "support calling a :meth:`~socketserver.BaseServer.handle_timeout` method " @@ -2676,19 +3428,19 @@ msgid "" "Yasskin; :issue:`742598`, :issue:`1193577`.)" msgstr "" -#: whatsnew/2.6.rst:2383 +#: whatsnew/2.6.rst:2394 msgid "" "The :mod:`sqlite3` module, maintained by Gerhard Häring, has been updated " "from version 2.3.2 in Python 2.5 to version 2.4.1." msgstr "" -#: whatsnew/2.6.rst:2387 +#: whatsnew/2.6.rst:2398 msgid "" "The :mod:`struct` module now supports the C99 :c:expr:`_Bool` type, using " "the format character ``'?'``. (Contributed by David Remahl.)" msgstr "" -#: whatsnew/2.6.rst:2391 +#: whatsnew/2.6.rst:2402 msgid "" "The :class:`~subprocess.Popen` objects provided by the :mod:`subprocess` " "module now have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess." @@ -2698,7 +3450,7 @@ msgid "" "TerminateProcess`. (Contributed by Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:2398 +#: whatsnew/2.6.rst:2409 msgid "" "A new variable in the :mod:`sys` module, :attr:`float_info`, is an object " "containing information derived from the :file:`float.h` file about the " @@ -2708,7 +3460,7 @@ msgid "" "several others. (Contributed by Christian Heimes; :issue:`1534`.)" msgstr "" -#: whatsnew/2.6.rst:2406 +#: whatsnew/2.6.rst:2417 msgid "" "Another new variable, :attr:`dont_write_bytecode`, controls whether Python " "writes any :file:`.pyc` or :file:`.pyo` files on importing a module. If this " @@ -2720,7 +3472,7 @@ msgid "" "written or not. (Contributed by Neal Norwitz and Georg Brandl.)" msgstr "" -#: whatsnew/2.6.rst:2417 +#: whatsnew/2.6.rst:2428 msgid "" "Information about the command-line arguments supplied to the Python " "interpreter is available by reading attributes of a named tuple available as " @@ -2729,7 +3481,7 @@ msgid "" "These attributes are all read-only. (Contributed by Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:2425 +#: whatsnew/2.6.rst:2436 msgid "" "A new function, :func:`getsizeof`, takes a Python object and returns the " "amount of memory used by the object, measured in bytes. Built-in objects " @@ -2738,14 +3490,14 @@ msgid "" "Schuppenies; :issue:`2898`.)" msgstr "" -#: whatsnew/2.6.rst:2432 +#: whatsnew/2.6.rst:2443 msgid "" "It's now possible to determine the current profiler and tracer functions by " "calling :func:`sys.getprofile` and :func:`sys.gettrace`. (Contributed by " "Georg Brandl; :issue:`1648`.)" msgstr "" -#: whatsnew/2.6.rst:2436 +#: whatsnew/2.6.rst:2447 msgid "" "The :mod:`tarfile` module now supports POSIX.1-2001 (pax) tarfiles in " "addition to the POSIX.1-1988 (ustar) and GNU tar formats that were already " @@ -2753,7 +3505,13 @@ msgid "" "to open a file using a different format::" msgstr "" -#: whatsnew/2.6.rst:2444 +#: whatsnew/2.6.rst:2452 +msgid "" +"tar = tarfile.open(\"output.tar\", \"w\",\n" +" format=tarfile.PAX_FORMAT)" +msgstr "" + +#: whatsnew/2.6.rst:2455 msgid "" "The new ``encoding`` and ``errors`` parameters specify an encoding and an " "error handling scheme for character conversions. ``'strict'``, " @@ -2763,7 +3521,7 @@ msgid "" "PAX format supports Unicode filenames, defaulting to UTF-8 encoding.)" msgstr "" -#: whatsnew/2.6.rst:2452 +#: whatsnew/2.6.rst:2463 msgid "" "The :meth:`TarFile.add` method now accepts an ``exclude`` argument that's a " "function that can be used to exclude certain filenames from an archive. The " @@ -2773,18 +3531,18 @@ msgid "" "added directories." msgstr "" -#: whatsnew/2.6.rst:2460 +#: whatsnew/2.6.rst:2471 msgid "(All changes contributed by Lars Gustäbel)." msgstr "" -#: whatsnew/2.6.rst:2462 +#: whatsnew/2.6.rst:2473 msgid "" -"An optional ``timeout`` parameter was added to the :class:`telnetlib.Telnet` " -"class constructor, specifying a timeout measured in seconds. (Added by " -"Facundo Batista.)" +"An optional ``timeout`` parameter was added to the :class:`!telnetlib." +"Telnet` class constructor, specifying a timeout measured in seconds. (Added " +"by Facundo Batista.)" msgstr "" -#: whatsnew/2.6.rst:2466 +#: whatsnew/2.6.rst:2477 msgid "" "The :class:`tempfile.NamedTemporaryFile` class usually deletes the temporary " "file it created when the file is closed. This behaviour can now be changed " @@ -2792,7 +3550,7 @@ msgid "" "Miller; :issue:`1537850`.)" msgstr "" -#: whatsnew/2.6.rst:2471 +#: whatsnew/2.6.rst:2482 msgid "" "A new class, :class:`SpooledTemporaryFile`, behaves like a temporary file " "but stores its data in memory until a maximum size is exceeded. On reaching " @@ -2800,7 +3558,7 @@ msgid "" "(Contributed by Dustin J. Mitchell.)" msgstr "" -#: whatsnew/2.6.rst:2476 +#: whatsnew/2.6.rst:2487 msgid "" "The :class:`NamedTemporaryFile` and :class:`SpooledTemporaryFile` classes " "both work as context managers, so you can write ``with tempfile." @@ -2808,7 +3566,7 @@ msgid "" "issue:`2021`.)" msgstr "" -#: whatsnew/2.6.rst:2481 +#: whatsnew/2.6.rst:2492 msgid "" "The :mod:`test.test_support ` module gained a number of " "context managers useful for writing tests. :func:`~test.support.os_helper." @@ -2816,7 +3574,7 @@ msgid "" "environment variables and automatically restores them to their old values." msgstr "" -#: whatsnew/2.6.rst:2487 +#: whatsnew/2.6.rst:2498 msgid "" "Another context manager, :class:`TransientResource`, can surround calls to " "resources that may or may not be available; it will catch and ignore a " @@ -2824,29 +3582,63 @@ msgid "" "certain failures when connecting to an external web site::" msgstr "" -#: whatsnew/2.6.rst:2498 +#: whatsnew/2.6.rst:2504 +msgid "" +"with test_support.TransientResource(IOError,\n" +" errno=errno.ETIMEDOUT):\n" +" f = urllib.urlopen('https://sf.net')\n" +" ..." +msgstr "" + +#: whatsnew/2.6.rst:2509 msgid "" "Finally, :func:`check_warnings` resets the :mod:`warning` module's warning " "filters and returns an object that will record all warning messages " "triggered (:issue:`3781`)::" msgstr "" -#: whatsnew/2.6.rst:2508 +#: whatsnew/2.6.rst:2513 +msgid "" +"with test_support.check_warnings() as wrec:\n" +" warnings.simplefilter(\"always\")\n" +" # ... code that triggers a warning ...\n" +" assert str(wrec.message) == \"function is outdated\"\n" +" assert len(wrec.warnings) == 1, \"Multiple warnings raised\"" +msgstr "" + +#: whatsnew/2.6.rst:2519 msgid "(Contributed by Brett Cannon.)" msgstr "" -#: whatsnew/2.6.rst:2510 +#: whatsnew/2.6.rst:2521 msgid "" "The :mod:`textwrap` module can now preserve existing whitespace at the " "beginnings and ends of the newly created lines by specifying " "``drop_whitespace=False`` as an argument::" msgstr "" -#: whatsnew/2.6.rst:2529 +#: whatsnew/2.6.rst:2526 +msgid "" +">>> S = \"\"\"This sentence has a bunch of\n" +"... extra whitespace.\"\"\"\n" +">>> print textwrap.fill(S, width=15)\n" +"This sentence\n" +"has a bunch\n" +"of extra\n" +"whitespace.\n" +">>> print textwrap.fill(S, drop_whitespace=False, width=15)\n" +"This sentence\n" +" has a bunch\n" +" of extra\n" +" whitespace.\n" +">>>" +msgstr "" + +#: whatsnew/2.6.rst:2540 msgid "(Contributed by Dwayne Bailey; :issue:`1581073`.)" msgstr "" -#: whatsnew/2.6.rst:2531 +#: whatsnew/2.6.rst:2542 msgid "" "The :mod:`threading` module API is being changed to use properties such as :" "attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, and " @@ -2859,14 +3651,14 @@ msgid "" "Peterson.)" msgstr "" -#: whatsnew/2.6.rst:2542 +#: whatsnew/2.6.rst:2553 msgid "" "The :mod:`threading` module's :class:`Thread` objects gained an :attr:" "`ident` property that returns the thread's identifier, a nonzero integer. " "(Contributed by Gregory P. Smith; :issue:`2871`.)" msgstr "" -#: whatsnew/2.6.rst:2547 +#: whatsnew/2.6.rst:2558 msgid "" "The :mod:`timeit` module now accepts callables as well as strings for the " "statement being timed and for the setup code. Two convenience functions were " @@ -2876,62 +3668,62 @@ msgid "" "issue:`1533909`.)" msgstr "" -#: whatsnew/2.6.rst:2556 +#: whatsnew/2.6.rst:2567 msgid "" "The :mod:`Tkinter` module now accepts lists and tuples for options, " "separating the elements by spaces before passing the resulting value to Tcl/" "Tk. (Contributed by Guilherme Polo; :issue:`2906`.)" msgstr "" -#: whatsnew/2.6.rst:2561 +#: whatsnew/2.6.rst:2572 msgid "" "The :mod:`turtle` module for turtle graphics was greatly enhanced by Gregor " "Lingl. New features in the module include:" msgstr "" -#: whatsnew/2.6.rst:2564 +#: whatsnew/2.6.rst:2575 msgid "Better animation of turtle movement and rotation." msgstr "" -#: whatsnew/2.6.rst:2565 +#: whatsnew/2.6.rst:2576 msgid "" "Control over turtle movement using the new :meth:`delay`, :meth:`tracer`, " "and :meth:`speed` methods." msgstr "" -#: whatsnew/2.6.rst:2567 +#: whatsnew/2.6.rst:2578 msgid "" "The ability to set new shapes for the turtle, and to define a new coordinate " "system." msgstr "" -#: whatsnew/2.6.rst:2569 -msgid "Turtles now have an :meth:`undo()` method that can roll back actions." +#: whatsnew/2.6.rst:2580 +msgid "Turtles now have an :meth:`undo` method that can roll back actions." msgstr "" -#: whatsnew/2.6.rst:2570 +#: whatsnew/2.6.rst:2581 msgid "" "Simple support for reacting to input events such as mouse and keyboard " "activity, making it possible to write simple games." msgstr "" -#: whatsnew/2.6.rst:2572 +#: whatsnew/2.6.rst:2583 msgid "" "A :file:`turtle.cfg` file can be used to customize the starting appearance " "of the turtle's screen." msgstr "" -#: whatsnew/2.6.rst:2574 +#: whatsnew/2.6.rst:2585 msgid "" "The module's docstrings can be replaced by new docstrings that have been " "translated into another language." msgstr "" -#: whatsnew/2.6.rst:2577 +#: whatsnew/2.6.rst:2588 msgid "(:issue:`1513695`)" msgstr "" -#: whatsnew/2.6.rst:2579 +#: whatsnew/2.6.rst:2590 msgid "" "An optional ``timeout`` parameter was added to the :func:`urllib.urlopen " "` function and the :class:`urllib.ftpwrapper` class " @@ -2940,17 +3732,27 @@ msgid "" "example::" msgstr "" -#: whatsnew/2.6.rst:2592 +#: whatsnew/2.6.rst:2596 +msgid "" +">>> u = urllib2.urlopen(\"http://slow.example.com\",\n" +" timeout=3)\n" +"Traceback (most recent call last):\n" +" ...\n" +"urllib2.URLError: \n" +">>>" +msgstr "" + +#: whatsnew/2.6.rst:2603 msgid "(Added by Facundo Batista.)" msgstr "" -#: whatsnew/2.6.rst:2594 +#: whatsnew/2.6.rst:2605 msgid "" "The Unicode database provided by the :mod:`unicodedata` module has been " "updated to version 5.1.0. (Updated by Martin von Löwis; :issue:`3811`.)" msgstr "" -#: whatsnew/2.6.rst:2598 +#: whatsnew/2.6.rst:2609 msgid "" "The :mod:`warnings` module's :func:`formatwarning` and :func:`showwarning` " "gained an optional *line* argument that can be used to supply the line of " @@ -2958,14 +3760,14 @@ msgid "" "of the :mod:`warnings` module in C code.)" msgstr "" -#: whatsnew/2.6.rst:2603 +#: whatsnew/2.6.rst:2614 msgid "" "A new function, :func:`catch_warnings`, is a context manager intended for " "testing purposes that lets you temporarily modify the warning filters and " "then restore their original values (:issue:`3781`)." msgstr "" -#: whatsnew/2.6.rst:2607 +#: whatsnew/2.6.rst:2618 msgid "" "The XML-RPC :class:`SimpleXMLRPCServer ` and :class:" "`DocXMLRPCServer ` classes can now be prevented from " @@ -2977,7 +3779,7 @@ msgid "" "`1599845`.)" msgstr "" -#: whatsnew/2.6.rst:2616 +#: whatsnew/2.6.rst:2627 msgid "" ":class:`SimpleXMLRPCServer` also has a :attr:`_send_traceback_header` " "attribute; if true, the exception and formatted traceback are returned as " @@ -2988,7 +3790,7 @@ msgid "" "Code 2007.)" msgstr "" -#: whatsnew/2.6.rst:2624 +#: whatsnew/2.6.rst:2635 msgid "" "The :mod:`xmlrpclib ` module no longer automatically " "converts :class:`datetime.date` and :class:`datetime.time` to the :class:" @@ -3001,18 +3803,30 @@ msgid "" "`2985`)." msgstr "" -#: whatsnew/2.6.rst:2634 +#: whatsnew/2.6.rst:2645 msgid "" "The :mod:`zipfile` module's :class:`ZipFile` class now has :meth:`extract` " "and :meth:`extractall` methods that will unpack a single file or all the " "files in the archive to the current directory, or to a specified directory::" msgstr "" -#: whatsnew/2.6.rst:2648 +#: whatsnew/2.6.rst:2650 +msgid "" +"z = zipfile.ZipFile('python-251.zip')\n" +"\n" +"# Unpack a single file, writing it relative\n" +"# to the /tmp directory.\n" +"z.extract('Python/sysmodule.c', '/tmp')\n" +"\n" +"# Unpack all the files in the archive.\n" +"z.extractall()" +msgstr "" + +#: whatsnew/2.6.rst:2659 msgid "(Contributed by Alan McIntyre; :issue:`467924`.)" msgstr "" -#: whatsnew/2.6.rst:2650 +#: whatsnew/2.6.rst:2661 msgid "" "The :meth:`open`, :meth:`read` and :meth:`extract` methods can now take " "either a filename or a :class:`ZipInfo` object. This is useful when an " @@ -3020,17 +3834,17 @@ msgid "" "Horler; :issue:`1775025`.)" msgstr "" -#: whatsnew/2.6.rst:2655 +#: whatsnew/2.6.rst:2666 msgid "" "Finally, :mod:`zipfile` now supports using Unicode filenames for archived " "files. (Contributed by Alexey Borzenkov; :issue:`1734346`.)" msgstr "" -#: whatsnew/2.6.rst:2662 +#: whatsnew/2.6.rst:2673 msgid "The :mod:`ast` module" msgstr "" -#: whatsnew/2.6.rst:2664 +#: whatsnew/2.6.rst:2675 msgid "" "The :mod:`ast` module provides an Abstract Syntax Tree representation of " "Python code, and Armin Ronacher contributed a set of helper functions that " @@ -3038,17 +3852,64 @@ msgid "" "packages, code analyzers, and similar tools that process Python code." msgstr "" -#: whatsnew/2.6.rst:2671 +#: whatsnew/2.6.rst:2682 msgid "" "The :func:`parse` function takes an expression and returns an AST. The :func:" "`dump` function outputs a representation of a tree, suitable for debugging::" msgstr "" -#: whatsnew/2.6.rst:2685 +#: whatsnew/2.6.rst:2686 +msgid "" +"import ast\n" +"\n" +"t = ast.parse(\"\"\"\n" +"d = {}\n" +"for i in 'abcdefghijklm':\n" +" d[i + i] = ord(i) - ord('a') + 1\n" +"print d\n" +"\"\"\")\n" +"print ast.dump(t)" +msgstr "" + +#: whatsnew/2.6.rst:2696 msgid "This outputs a deeply nested tree::" msgstr "" -#: whatsnew/2.6.rst:2718 +#: whatsnew/2.6.rst:2698 +msgid "" +"Module(body=[\n" +" Assign(targets=[\n" +" Name(id='d', ctx=Store())\n" +" ], value=Dict(keys=[], values=[]))\n" +" For(target=Name(id='i', ctx=Store()),\n" +" iter=Str(s='abcdefghijklm'), body=[\n" +" Assign(targets=[\n" +" Subscript(value=\n" +" Name(id='d', ctx=Load()),\n" +" slice=\n" +" Index(value=\n" +" BinOp(left=Name(id='i', ctx=Load()), op=Add(),\n" +" right=Name(id='i', ctx=Load()))), ctx=Store())\n" +" ], value=\n" +" BinOp(left=\n" +" BinOp(left=\n" +" Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Name(id='i', ctx=Load())\n" +" ], keywords=[], starargs=None, kwargs=None),\n" +" op=Sub(), right=Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Str(s='a')\n" +" ], keywords=[], starargs=None, kwargs=None)),\n" +" op=Add(), right=Num(n=1)))\n" +" ], orelse=[])\n" +" Print(dest=None, values=[\n" +" Name(id='d', ctx=Load())\n" +" ], nl=True)\n" +" ])" +msgstr "" + +#: whatsnew/2.6.rst:2729 msgid "" "The :func:`literal_eval` method takes a string or an AST representing a " "literal expression, parses and evaluates it, and returns the resulting " @@ -3058,44 +3919,55 @@ msgid "" "an :func:`eval` call, :func:`literal_eval` will handle it safely::" msgstr "" -#: whatsnew/2.6.rst:2734 +#: whatsnew/2.6.rst:2737 +msgid "" +">>> literal = '(\"a\", \"b\", {2:4, 3:8, 1:2})'\n" +">>> print ast.literal_eval(literal)\n" +"('a', 'b', {1: 2, 2: 4, 3: 8})\n" +">>> print ast.literal_eval('\"a\" + \"b\"')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: malformed string" +msgstr "" + +#: whatsnew/2.6.rst:2745 msgid "" "The module also includes :class:`NodeVisitor` and :class:`NodeTransformer` " "classes for traversing and modifying an AST, and functions for common " "transformations such as changing line numbers." msgstr "" -#: whatsnew/2.6.rst:2742 -msgid "The :mod:`future_builtins` module" +#: whatsnew/2.6.rst:2753 +msgid "The :mod:`!future_builtins` module" msgstr "" -#: whatsnew/2.6.rst:2744 +#: whatsnew/2.6.rst:2755 msgid "" "Python 3.0 makes many changes to the repertoire of built-in functions, and " "most of the changes can't be introduced in the Python 2.x series because " -"they would break compatibility. The :mod:`future_builtins` module provides " +"they would break compatibility. The :mod:`!future_builtins` module provides " "versions of these built-in functions that can be imported when writing 3.0-" "compatible code." msgstr "" -#: whatsnew/2.6.rst:2751 +#: whatsnew/2.6.rst:2762 msgid "The functions in this module currently include:" msgstr "" -#: whatsnew/2.6.rst:2753 +#: whatsnew/2.6.rst:2764 msgid "" "``ascii(obj)``: equivalent to :func:`repr`. In Python 3.0, :func:`repr` " "will return a Unicode string, while :func:`ascii` will return a pure ASCII " "bytestring." msgstr "" -#: whatsnew/2.6.rst:2757 +#: whatsnew/2.6.rst:2768 msgid "" "``filter(predicate, iterable)``, ``map(func, iterable1, ...)``: the 3.0 " "versions return iterators, unlike the 2.x builtins which return lists." msgstr "" -#: whatsnew/2.6.rst:2761 +#: whatsnew/2.6.rst:2772 msgid "" "``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` or :" "meth:`__oct__` methods, these versions will call the :meth:`__index__` " @@ -3103,11 +3975,11 @@ msgid "" "the new ``0o`` notation for its result." msgstr "" -#: whatsnew/2.6.rst:2770 +#: whatsnew/2.6.rst:2781 msgid "The :mod:`json` module: JavaScript Object Notation" msgstr "" -#: whatsnew/2.6.rst:2772 +#: whatsnew/2.6.rst:2783 msgid "" "The new :mod:`json` module supports the encoding and decoding of Python " "types in JSON (Javascript Object Notation). JSON is a lightweight " @@ -3115,34 +3987,45 @@ msgid "" "about JSON, see http://www.json.org." msgstr "" -#: whatsnew/2.6.rst:2777 +#: whatsnew/2.6.rst:2788 msgid "" ":mod:`json` comes with support for decoding and encoding most built-in " "Python types. The following example encodes and decodes a dictionary::" msgstr "" -#: whatsnew/2.6.rst:2788 +#: whatsnew/2.6.rst:2791 +msgid "" +">>> import json\n" +">>> data = {\"spam\": \"foo\", \"parrot\": 42}\n" +">>> in_json = json.dumps(data) # Encode the data\n" +">>> in_json\n" +"'{\"parrot\": 42, \"spam\": \"foo\"}'\n" +">>> json.loads(in_json) # Decode into a Python object\n" +"{\"spam\": \"foo\", \"parrot\": 42}" +msgstr "" + +#: whatsnew/2.6.rst:2799 msgid "" "It's also possible to write your own decoders and encoders to support more " "types. Pretty-printing of the JSON strings is also supported." msgstr "" -#: whatsnew/2.6.rst:2791 +#: whatsnew/2.6.rst:2802 msgid ":mod:`json` (originally called simplejson) was written by Bob Ippolito." msgstr "" -#: whatsnew/2.6.rst:2798 +#: whatsnew/2.6.rst:2809 msgid "The :mod:`plistlib` module: A Property-List Parser" msgstr "" -#: whatsnew/2.6.rst:2800 +#: whatsnew/2.6.rst:2811 msgid "" "The ``.plist`` format is commonly used on Mac OS X to store basic data types " "(numbers, strings, lists, and dictionaries) by serializing them into an XML-" "based format. It resembles the XML-RPC serialization of data types." msgstr "" -#: whatsnew/2.6.rst:2805 +#: whatsnew/2.6.rst:2816 msgid "" "Despite being primarily used on Mac OS X, the format has nothing Mac-" "specific about it and the Python implementation works on any platform that " @@ -3150,33 +4033,58 @@ msgid "" "standard library." msgstr "" -#: whatsnew/2.6.rst:2810 +#: whatsnew/2.6.rst:2821 msgid "Using the module is simple::" msgstr "" -#: whatsnew/2.6.rst:2837 +#: whatsnew/2.6.rst:2823 +msgid "" +"import sys\n" +"import plistlib\n" +"import datetime\n" +"\n" +"# Create data structure\n" +"data_struct = dict(lastAccessed=datetime.datetime.now(),\n" +" version=1,\n" +" categories=('Personal','Shared','Private'))\n" +"\n" +"# Create string containing XML.\n" +"plist_str = plistlib.writePlistToString(data_struct)\n" +"new_struct = plistlib.readPlistFromString(plist_str)\n" +"print data_struct\n" +"print new_struct\n" +"\n" +"# Write data structure to a file and read it back.\n" +"plistlib.writePlist(data_struct, '/tmp/customizations.plist')\n" +"new_struct = plistlib.readPlist('/tmp/customizations.plist')\n" +"\n" +"# read/writePlist accepts file-like objects as well as paths.\n" +"plistlib.writePlist(data_struct, sys.stdout)" +msgstr "" + +#: whatsnew/2.6.rst:2848 msgid "ctypes Enhancements" msgstr "" -#: whatsnew/2.6.rst:2839 +#: whatsnew/2.6.rst:2850 msgid "" "Thomas Heller continued to maintain and enhance the :mod:`ctypes` module." msgstr "" -#: whatsnew/2.6.rst:2842 +#: whatsnew/2.6.rst:2853 msgid "" ":mod:`ctypes` now supports a :class:`c_bool` datatype that represents the " "C99 ``bool`` type. (Contributed by David Remahl; :issue:`1649190`.)" msgstr "" -#: whatsnew/2.6.rst:2846 +#: whatsnew/2.6.rst:2857 msgid "" "The :mod:`ctypes` string, buffer and array types have improved support for " "extended slicing syntax, where various combinations of ``(start, stop, " "step)`` are supplied. (Implemented by Thomas Wouters.)" msgstr "" -#: whatsnew/2.6.rst:2853 +#: whatsnew/2.6.rst:2864 msgid "" "All :mod:`ctypes` data types now support :meth:`from_buffer` and :meth:" "`from_buffer_copy` methods that create a ctypes instance based on a provided " @@ -3184,14 +4092,14 @@ msgid "" "while :meth:`from_buffer` will share the same memory area." msgstr "" -#: whatsnew/2.6.rst:2860 +#: whatsnew/2.6.rst:2871 msgid "" "A new calling convention tells :mod:`ctypes` to clear the ``errno`` or Win32 " "LastError variables at the outset of each wrapped call. (Implemented by " "Thomas Heller; :issue:`1798`.)" msgstr "" -#: whatsnew/2.6.rst:2864 +#: whatsnew/2.6.rst:2875 msgid "" "You can now retrieve the Unix ``errno`` variable after a function call. " "When creating a wrapped function, you can supply ``use_errno=True`` as a " @@ -3200,7 +4108,7 @@ msgid "" "error value." msgstr "" -#: whatsnew/2.6.rst:2870 +#: whatsnew/2.6.rst:2881 msgid "" "The Win32 LastError variable is similarly supported by the :func:`DLL`, :" "func:`OleDLL`, and :func:`WinDLL` functions. You supply " @@ -3208,18 +4116,18 @@ msgid "" "level methods :meth:`set_last_error` and :meth:`get_last_error`." msgstr "" -#: whatsnew/2.6.rst:2876 +#: whatsnew/2.6.rst:2887 msgid "" "The :func:`byref` function, used to retrieve a pointer to a ctypes instance, " "now has an optional *offset* parameter that is a byte count that will be " "added to the returned pointer." msgstr "" -#: whatsnew/2.6.rst:2883 +#: whatsnew/2.6.rst:2894 msgid "Improved SSL Support" msgstr "" -#: whatsnew/2.6.rst:2885 +#: whatsnew/2.6.rst:2896 msgid "" "Bill Janssen made extensive improvements to Python 2.6's support for the " "Secure Sockets Layer by adding a new module, :mod:`ssl`, that's built atop " @@ -3230,7 +4138,7 @@ msgid "" "removed and continues to work, though it will be removed in Python 3.0." msgstr "" -#: whatsnew/2.6.rst:2894 +#: whatsnew/2.6.rst:2905 msgid "" "To use the new module, you must first create a TCP connection in the usual " "way and then pass it to the :func:`ssl.wrap_socket` function. It's possible " @@ -3238,35 +4146,35 @@ msgid "" "by calling the :meth:`getpeercert` method." msgstr "" -#: whatsnew/2.6.rst:2901 +#: whatsnew/2.6.rst:2912 msgid "The documentation for the :mod:`ssl` module." msgstr "" -#: whatsnew/2.6.rst:2906 +#: whatsnew/2.6.rst:2917 msgid "Deprecations and Removals" msgstr "" -#: whatsnew/2.6.rst:3263 +#: whatsnew/2.6.rst:3273 msgid "" "String exceptions have been removed. Attempting to use them raises a :exc:" "`TypeError`." msgstr "" -#: whatsnew/2.6.rst:2911 +#: whatsnew/2.6.rst:2922 msgid "" "Changes to the :class:`Exception` interface as dictated by :pep:`352` " "continue to be made. For 2.6, the :attr:`!message` attribute is being " "deprecated in favor of the :attr:`~BaseException.args` attribute." msgstr "" -#: whatsnew/2.6.rst:2916 +#: whatsnew/2.6.rst:2927 msgid "" "(3.0-warning mode) Python 3.0 will feature a reorganized standard library " "that will drop many outdated modules and rename others. Python 2.6 running " "in 3.0-warning mode will warn about these modules when they are imported." msgstr "" -#: whatsnew/2.6.rst:2921 +#: whatsnew/2.6.rst:2932 msgid "" "The list of deprecated modules is: :mod:`!audiodev`, :mod:`!bgenlocations`, :" "mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!Canvas`, :mod:`!compiler`, :" @@ -3277,59 +4185,59 @@ msgid "" "toaiff`." msgstr "" -#: whatsnew/2.6.rst:2946 +#: whatsnew/2.6.rst:2957 msgid "The :mod:`!gopherlib` module has been removed." msgstr "" -#: whatsnew/2.6.rst:2948 +#: whatsnew/2.6.rst:2959 msgid "" "The :mod:`!MimeWriter` module and :mod:`!mimify` module have been " "deprecated; use the :mod:`email` package instead." msgstr "" -#: whatsnew/2.6.rst:2952 +#: whatsnew/2.6.rst:2963 msgid "" "The :mod:`!md5` module has been deprecated; use the :mod:`hashlib` module " "instead." msgstr "" -#: whatsnew/2.6.rst:2955 +#: whatsnew/2.6.rst:2966 msgid "" "The :mod:`!posixfile` module has been deprecated; :func:`fcntl.lockf` " "provides better locking." msgstr "" -#: whatsnew/2.6.rst:2958 +#: whatsnew/2.6.rst:2969 msgid "" "The :mod:`!popen2` module has been deprecated; use the :mod:`subprocess` " "module." msgstr "" -#: whatsnew/2.6.rst:2961 +#: whatsnew/2.6.rst:2972 msgid "The :mod:`!rgbimg` module has been removed." msgstr "" -#: whatsnew/2.6.rst:2963 +#: whatsnew/2.6.rst:2974 msgid "" "The :mod:`!sets` module has been deprecated; it's better to use the built-" "in :class:`set` and :class:`frozenset` types." msgstr "" -#: whatsnew/2.6.rst:2966 +#: whatsnew/2.6.rst:2977 msgid "" "The :mod:`!sha` module has been deprecated; use the :mod:`hashlib` module " "instead." msgstr "" -#: whatsnew/2.6.rst:2974 +#: whatsnew/2.6.rst:2985 msgid "Build and C API Changes" msgstr "" -#: whatsnew/2.6.rst:2976 +#: whatsnew/2.6.rst:2987 msgid "Changes to Python's build process and to the C API include:" msgstr "" -#: whatsnew/2.6.rst:2978 +#: whatsnew/2.6.rst:2989 msgid "" "Python now must be compiled with C89 compilers (after 19 years!). This " "means that the Python source tree has dropped its own implementations of :c:" @@ -3337,14 +4245,14 @@ msgid "" "library." msgstr "" -#: whatsnew/2.6.rst:2983 +#: whatsnew/2.6.rst:2994 msgid "" "Python 2.6 can be built with Microsoft Visual Studio 2008 (version 9.0), and " "this is the new default compiler. See the :file:`PCbuild` directory for the " "build files. (Implemented by Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:2988 +#: whatsnew/2.6.rst:2999 msgid "" "On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. The :" "program:`configure` script can take a :option:`!--with-universal-archs=[32-" @@ -3353,7 +4261,7 @@ msgid "" "(Contributed by Ronald Oussoren.)" msgstr "" -#: whatsnew/2.6.rst:2995 +#: whatsnew/2.6.rst:3006 msgid "" "A new function added in Python 2.6.6, :c:func:`!PySys_SetArgvEx`, sets the " "value of ``sys.argv`` and can optionally update ``sys.path`` to include the " @@ -3361,7 +4269,7 @@ msgid "" "value of an *updatepath* parameter." msgstr "" -#: whatsnew/2.6.rst:3000 +#: whatsnew/2.6.rst:3011 msgid "" "This function was added to close a security hole for applications that embed " "Python. The old function, :c:func:`!PySys_SetArgv`, would always update " @@ -3372,7 +4280,7 @@ msgid "" "and run." msgstr "" -#: whatsnew/2.6.rst:3008 +#: whatsnew/2.6.rst:3019 msgid "" "If you maintain a C/C++ application that embeds Python, check whether you're " "calling :c:func:`!PySys_SetArgv` and carefully consider whether the " @@ -3384,28 +4292,27 @@ msgid "" "discard the first ``sys.path`` component." msgstr "" -#: whatsnew/2.6.rst:3018 +#: whatsnew/2.6.rst:3029 msgid "" -"Security issue reported as `CVE-2008-5983 `_; discussed in :gh:`50003`, and fixed by " -"Antoine Pitrou." +"Security issue reported as :cve:`2008-5983`; discussed in :gh:`50003`, and " +"fixed by Antoine Pitrou." msgstr "" -#: whatsnew/2.6.rst:3022 +#: whatsnew/2.6.rst:3032 msgid "" "The BerkeleyDB module now has a C API object, available as ``bsddb.db." "api``. This object can be used by other C extensions that wish to use the :" "mod:`bsddb` module for their own purposes. (Contributed by Duncan Grisby.)" msgstr "" -#: whatsnew/2.6.rst:3027 +#: whatsnew/2.6.rst:3037 msgid "" "The new buffer interface, previously described in `the PEP 3118 section " "<#pep-3118-revised-buffer-protocol>`__, adds :c:func:`PyObject_GetBuffer` " "and :c:func:`PyBuffer_Release`, as well as a few other functions." msgstr "" -#: whatsnew/2.6.rst:3032 +#: whatsnew/2.6.rst:3042 msgid "" "Python's use of the C stdio library is now thread-safe, or at least as " "thread-safe as the underlying library is. A long-standing potential bug " @@ -3420,7 +4327,7 @@ msgid "" "Gregory P. Smith.)" msgstr "" -#: whatsnew/2.6.rst:3045 +#: whatsnew/2.6.rst:3055 msgid "" "Importing modules simultaneously in two different threads no longer " "deadlocks; it will now raise an :exc:`ImportError`. A new API function, :c:" @@ -3430,11 +4337,11 @@ msgid "" "(Contributed by Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:3053 +#: whatsnew/2.6.rst:3063 msgid "" "Several functions return information about the platform's floating-point " "support. :c:func:`PyFloat_GetMax` returns the maximum representable " -"floating point value, and :c:func:`PyFloat_GetMin` returns the minimum " +"floating-point value, and :c:func:`PyFloat_GetMin` returns the minimum " "positive value. :c:func:`PyFloat_GetInfo` returns an object containing more " "information from the :file:`float.h` file, such as ``\"mant_dig\"`` (number " "of digits in the mantissa), ``\"epsilon\"`` (smallest difference between 1.0 " @@ -3442,7 +4349,7 @@ msgid "" "by Christian Heimes; :issue:`1534`.)" msgstr "" -#: whatsnew/2.6.rst:3064 +#: whatsnew/2.6.rst:3074 msgid "" "C functions and methods that use :c:func:`PyComplex_AsCComplex` will now " "accept arguments that have a :meth:`__complex__` method. In particular, the " @@ -3451,14 +4358,14 @@ msgid "" "Dickinson; :issue:`1675423`.)" msgstr "" -#: whatsnew/2.6.rst:3071 +#: whatsnew/2.6.rst:3081 msgid "" "Python's C API now includes two functions for case-insensitive string " "comparisons, ``PyOS_stricmp(char*, char*)`` and ``PyOS_strnicmp(char*, " "char*, Py_ssize_t)``. (Contributed by Christian Heimes; :issue:`1635`.)" msgstr "" -#: whatsnew/2.6.rst:3076 +#: whatsnew/2.6.rst:3086 msgid "" "Many C extensions define their own little macro for adding integers and " "strings to the module's dictionary in the ``init*`` function. Python 2.6 " @@ -3467,7 +4374,7 @@ msgid "" "(Contributed by Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:3083 +#: whatsnew/2.6.rst:3093 msgid "" "Some macros were renamed in both 3.0 and 2.6 to make it clearer that they " "are macros, not functions. :c:macro:`!Py_Size()` became :c:macro:" @@ -3476,14 +4383,14 @@ msgid "" "still available in Python 2.6 for backward compatibility. (:issue:`1629`)" msgstr "" -#: whatsnew/2.6.rst:3092 +#: whatsnew/2.6.rst:3102 msgid "" "Distutils now places C extensions it builds in a different directory when " "running on a debug version of Python. (Contributed by Collin Winter; :issue:" "`1530959`.)" msgstr "" -#: whatsnew/2.6.rst:3096 +#: whatsnew/2.6.rst:3106 msgid "" "Several basic data types, such as integers and strings, maintain internal " "free lists of objects that can be re-used. The data structures for these " @@ -3492,7 +4399,7 @@ msgid "" "``Py_MAXFREELIST`` is always defined." msgstr "" -#: whatsnew/2.6.rst:3103 +#: whatsnew/2.6.rst:3113 msgid "" "A new Makefile target, \"make patchcheck\", prepares the Python source tree " "for making a patch: it fixes trailing whitespace in all modified ``.py`` " @@ -3501,7 +4408,7 @@ msgid "" "(Contributed by Brett Cannon.)" msgstr "" -#: whatsnew/2.6.rst:3110 +#: whatsnew/2.6.rst:3120 msgid "" "Another new target, \"make profile-opt\", compiles a Python binary using " "GCC's profile-guided optimization. It compiles Python with profiling " @@ -3510,17 +4417,17 @@ msgid "" "Smith.)" msgstr "" -#: whatsnew/2.6.rst:3119 +#: whatsnew/2.6.rst:3129 msgid "Port-Specific Changes: Windows" msgstr "" -#: whatsnew/2.6.rst:3121 +#: whatsnew/2.6.rst:3131 msgid "" "The support for Windows 95, 98, ME and NT4 has been dropped. Python 2.6 " "requires at least Windows 2000 SP4." msgstr "" -#: whatsnew/2.6.rst:3124 +#: whatsnew/2.6.rst:3134 msgid "" "The new default compiler on Windows is Visual Studio 2008 (version 9.0). The " "build directories for Visual Studio 2003 (version 7.1) and 2005 (version " @@ -3531,7 +4438,7 @@ msgid "" "Martin von Löwis.)" msgstr "" -#: whatsnew/2.6.rst:3132 +#: whatsnew/2.6.rst:3142 msgid "" "The :mod:`msvcrt` module now supports both the normal and wide char variants " "of the console I/O API. The :func:`~msvcrt.getwch` function reads a " @@ -3540,21 +4447,21 @@ msgid "" "writes it to the console. (Contributed by Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:3139 +#: whatsnew/2.6.rst:3149 msgid "" ":func:`os.path.expandvars` will now expand environment variables in the form " "\"%var%\", and \"~user\" will be expanded into the user's home directory " "path. (Contributed by Josiah Carlson; :issue:`957650`.)" msgstr "" -#: whatsnew/2.6.rst:3143 +#: whatsnew/2.6.rst:3153 msgid "" "The :mod:`socket` module's socket objects now have an :meth:`~socket.socket." "ioctl` method that provides a limited interface to the :c:func:`WSAIoctl` " "system interface." msgstr "" -#: whatsnew/2.6.rst:3147 +#: whatsnew/2.6.rst:3157 msgid "" "The :mod:`_winreg ` module now has a function, :func:`~winreg." "ExpandEnvironmentStrings`, that expands environment variable references such " @@ -3563,7 +4470,7 @@ msgid "" "`with` statements. (Contributed by Christian Heimes.)" msgstr "" -#: whatsnew/2.6.rst:3154 +#: whatsnew/2.6.rst:3164 msgid "" ":mod:`_winreg ` also has better support for x64 systems, exposing " "the :func:`~winreg.DisableReflectionKey`, :func:`~winreg." @@ -3572,33 +4479,32 @@ msgid "" "64-bit systems. (:issue:`1753245`)" msgstr "" -#: whatsnew/2.6.rst:3160 +#: whatsnew/2.6.rst:3170 msgid "" -"The :mod:`msilib` module's :class:`!Record` object gained :meth:`~msilib." -"Record.GetInteger` and :meth:`~msilib.Record.GetString` methods that return " -"field values as an integer or a string. (Contributed by Floris Bruynooghe; :" -"issue:`2125`.)" +"The :mod:`!msilib` module's :class:`!Record` object gained :meth:`!" +"GetInteger` and :meth:`!GetString` methods that return field values as an " +"integer or a string. (Contributed by Floris Bruynooghe; :issue:`2125`.)" msgstr "" -#: whatsnew/2.6.rst:3168 +#: whatsnew/2.6.rst:3178 msgid "Port-Specific Changes: Mac OS X" msgstr "" -#: whatsnew/2.6.rst:3170 +#: whatsnew/2.6.rst:3180 msgid "" "When compiling a framework build of Python, you can now specify the " "framework name to be used by providing the :option:`!--with-framework-name=` " "option to the :program:`configure` script." msgstr "" -#: whatsnew/2.6.rst:3175 +#: whatsnew/2.6.rst:3185 msgid "" "The :mod:`!macfs` module has been removed. This in turn required the :func:" "`!macostools.touched` function to be removed because it depended on the :mod:" "`!macfs` module. (:issue:`1490190`)" msgstr "" -#: whatsnew/2.6.rst:3179 +#: whatsnew/2.6.rst:3189 msgid "" "Many other Mac OS modules have been deprecated and will be removed in Python " "3.0: :mod:`!_builtinSuites`, :mod:`!aepack`, :mod:`!aetools`, :mod:`!" @@ -3613,11 +4519,11 @@ msgid "" "mod:`!SystemEvents`, :mod:`!Terminal`, and :mod:`!terminalcommand`." msgstr "" -#: whatsnew/2.6.rst:3222 +#: whatsnew/2.6.rst:3232 msgid "Port-Specific Changes: IRIX" msgstr "" -#: whatsnew/2.6.rst:3224 +#: whatsnew/2.6.rst:3234 msgid "" "A number of old IRIX-specific modules were deprecated and will be removed in " "Python 3.0: :mod:`!al` and :mod:`!AL`, :mod:`!cd`, :mod:`!cddb`, :mod:`!" @@ -3628,30 +4534,30 @@ msgid "" "`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." msgstr "" -#: whatsnew/2.6.rst:3254 +#: whatsnew/2.6.rst:3264 msgid "Porting to Python 2.6" msgstr "" -#: whatsnew/2.6.rst:3256 +#: whatsnew/2.6.rst:3266 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code:" msgstr "" -#: whatsnew/2.6.rst:3259 +#: whatsnew/2.6.rst:3269 msgid "" "Classes that aren't supposed to be hashable should set ``__hash__ = None`` " "in their definitions to indicate the fact." msgstr "" -#: whatsnew/2.6.rst:3266 +#: whatsnew/2.6.rst:3276 msgid "" "The :meth:`__init__` method of :class:`collections.deque` now clears any " "existing contents of the deque before adding elements from the iterable. " "This change makes the behavior match ``list.__init__()``." msgstr "" -#: whatsnew/2.6.rst:3271 +#: whatsnew/2.6.rst:3281 msgid "" ":meth:`object.__init__` previously accepted arbitrary arguments and keyword " "arguments, ignoring them. In Python 2.6, this is no longer allowed and will " @@ -3660,7 +4566,7 @@ msgid "" "through using :func:`super`). See :issue:`1683368` for discussion." msgstr "" -#: whatsnew/2.6.rst:3278 +#: whatsnew/2.6.rst:3288 msgid "" "The :class:`Decimal` constructor now accepts leading and trailing whitespace " "when passed a string. Previously it would raise an :exc:`InvalidOperation` " @@ -3669,7 +4575,7 @@ msgid "" "`ConversionSyntax` exception." msgstr "" -#: whatsnew/2.6.rst:3285 +#: whatsnew/2.6.rst:3295 msgid "" "Due to an implementation accident, if you passed a file path to the built-" "in :func:`__import__` function, it would actually import the specified " @@ -3677,20 +4583,20 @@ msgid "" "explicitly checks for this case and raises an :exc:`ImportError`." msgstr "" -#: whatsnew/2.6.rst:3291 +#: whatsnew/2.6.rst:3301 msgid "" "C API: the :c:func:`PyImport_Import` and :c:func:`PyImport_ImportModule` " "functions now default to absolute imports, not relative imports. This will " "affect C extensions that import other modules." msgstr "" -#: whatsnew/2.6.rst:3295 +#: whatsnew/2.6.rst:3305 msgid "" "C API: extension data types that shouldn't be hashable should define their " "``tp_hash`` slot to :c:func:`PyObject_HashNotImplemented`." msgstr "" -#: whatsnew/2.6.rst:3299 +#: whatsnew/2.6.rst:3309 msgid "" "The :mod:`socket` module exception :exc:`socket.error` now inherits from :" "exc:`IOError`. Previously it wasn't a subclass of :exc:`StandardError` but " @@ -3698,7 +4604,7 @@ msgid "" "`1706815`.)" msgstr "" -#: whatsnew/2.6.rst:3304 +#: whatsnew/2.6.rst:3314 msgid "" "The :mod:`xmlrpclib ` module no longer automatically " "converts :class:`datetime.date` and :class:`datetime.time` to the :class:" @@ -3708,32 +4614,32 @@ msgid "" "instances. (:issue:`1330538`)" msgstr "" -#: whatsnew/2.6.rst:3311 +#: whatsnew/2.6.rst:3321 msgid "" "(3.0-warning mode) The :class:`Exception` class now warns when accessed " "using slicing or index access; having :class:`Exception` behave like a tuple " "is being phased out." msgstr "" -#: whatsnew/2.6.rst:3315 +#: whatsnew/2.6.rst:3325 msgid "" "(3.0-warning mode) inequality comparisons between two dictionaries or two " "objects that don't implement comparison methods are reported as warnings. " "``dict1 == dict2`` still works, but ``dict1 < dict2`` is being phased out." msgstr "" -#: whatsnew/2.6.rst:3320 +#: whatsnew/2.6.rst:3330 msgid "" "Comparisons between cells, which are an implementation detail of Python's " "scoping rules, also cause warnings because such comparisons are forbidden " "entirely in 3.0." msgstr "" -#: whatsnew/2.6.rst:3324 +#: whatsnew/2.6.rst:3334 msgid "For applications that embed Python:" msgstr "" -#: whatsnew/2.6.rst:3326 +#: whatsnew/2.6.rst:3336 msgid "" "The :c:func:`!PySys_SetArgvEx` function was added in Python 2.6.6, letting " "applications close a security hole when the existing :c:func:`!" @@ -3742,11 +4648,11 @@ msgid "" "using :c:func:`!PySys_SetArgvEx` with *updatepath* set to false." msgstr "" -#: whatsnew/2.6.rst:3339 +#: whatsnew/2.6.rst:3349 msgid "Acknowledgements" msgstr "" -#: whatsnew/2.6.rst:3341 +#: whatsnew/2.6.rst:3351 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " @@ -3754,10 +4660,10 @@ msgid "" "Johnson, Chris Lambacher, Martin Michlmayr, Antoine Pitrou, Brian Warner." msgstr "" -#: whatsnew/2.6.rst:1068 +#: whatsnew/2.6.rst:1079 msgid "universal newlines" msgstr "" -#: whatsnew/2.6.rst:1068 +#: whatsnew/2.6.rst:1079 msgid "What's new" msgstr "" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index eeb68bda..66d170e8 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -297,16 +298,41 @@ msgid "" "depending on when a key was first inserted::" msgstr "" +#: whatsnew/2.7.rst:226 +msgid "" +">>> from collections import OrderedDict\n" +">>> d = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> d.items()\n" +"[('first', 1), ('second', 2), ('third', 3)]" +msgstr "" + #: whatsnew/2.7.rst:233 msgid "" "If a new entry overwrites an existing entry, the original insertion position " "is left unchanged::" msgstr "" +#: whatsnew/2.7.rst:236 +msgid "" +">>> d['second'] = 4\n" +">>> d.items()\n" +"[('first', 1), ('second', 4), ('third', 3)]" +msgstr "" + #: whatsnew/2.7.rst:240 msgid "Deleting an entry and reinserting it will move it to the end::" msgstr "" +#: whatsnew/2.7.rst:242 +msgid "" +">>> del d['second']\n" +">>> d['second'] = 5\n" +">>> d.items()\n" +"[('first', 1), ('third', 3), ('second', 5)]" +msgstr "" + #: whatsnew/2.7.rst:247 msgid "" "The :meth:`~collections.OrderedDict.popitem` method has an optional *last* " @@ -315,12 +341,41 @@ msgid "" "selected::" msgstr "" +#: whatsnew/2.7.rst:252 +msgid "" +">>> od = OrderedDict([(x,0) for x in range(20)])\n" +">>> od.popitem()\n" +"(19, 0)\n" +">>> od.popitem()\n" +"(18, 0)\n" +">>> od.popitem(last=False)\n" +"(0, 0)\n" +">>> od.popitem(last=False)\n" +"(1, 0)" +msgstr "" + #: whatsnew/2.7.rst:262 msgid "" "Comparing two ordered dictionaries checks both the keys and values, and " "requires that the insertion order was the same::" msgstr "" +#: whatsnew/2.7.rst:265 +msgid "" +">>> od1 = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> od2 = OrderedDict([('third', 3),\n" +"... ('first', 1),\n" +"... ('second', 2)])\n" +">>> od1 == od2\n" +"False\n" +">>> # Move 'third' key to the end\n" +">>> del od2['third']; od2['third'] = 3\n" +">>> od1 == od2\n" +"True" +msgstr "" + #: whatsnew/2.7.rst:278 msgid "" "Comparing an :class:`~collections.OrderedDict` with a regular dictionary " @@ -351,7 +406,7 @@ msgstr "" #: whatsnew/2.7.rst:294 msgid "" -"The :meth:`~collections.somenamedtuple._asdict()` method for :func:" +"The :meth:`~collections.somenamedtuple._asdict` method for :func:" "`collections.namedtuple` now returns an ordered dictionary with the values " "appearing in the same order as the underlying tuple indices." msgstr "" @@ -364,7 +419,7 @@ msgid "" "tools like `PyYAML `_." msgstr "" -#: whatsnew/2.7.rst:307 +#: whatsnew/2.7.rst:306 msgid ":pep:`372` - Adding an ordered dictionary to collections" msgstr "" @@ -401,6 +456,12 @@ msgid "" "point number, simply include a comma between the width and the precision::" msgstr "" +#: whatsnew/2.7.rst:330 +msgid "" +">>> '{:20,.2f}'.format(18446744073709551616.0)\n" +"'18,446,744,073,709,551,616.00'" +msgstr "" + #: whatsnew/2.7.rst:333 msgid "When formatting an integer, include the comma after the width:" msgstr "" @@ -455,18 +516,75 @@ msgstr "" msgid "Here's an example::" msgstr "" +#: whatsnew/2.7.rst:372 +msgid "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(description='Command-line example.')\n" +"\n" +"# Add optional switches\n" +"parser.add_argument('-v', action='store_true', dest='is_verbose',\n" +" help='produce verbose output')\n" +"parser.add_argument('-o', action='store', dest='output',\n" +" metavar='FILE',\n" +" help='direct output to FILE instead of stdout')\n" +"parser.add_argument('-C', action='store', type=int, dest='context',\n" +" metavar='NUM', default=0,\n" +" help='display NUM lines of added context')\n" +"\n" +"# Allow any number of additional arguments.\n" +"parser.add_argument(nargs='*', action='store', dest='inputs',\n" +" help='input filenames (default is stdin)')\n" +"\n" +"args = parser.parse_args()\n" +"print args.__dict__" +msgstr "" + #: whatsnew/2.7.rst:393 msgid "" "Unless you override it, :option:`!-h` and :option:`!--help` switches are " "automatically added, and produce neatly formatted output::" msgstr "" +#: whatsnew/2.7.rst:396 +msgid "" +"-> ./python.exe argparse-example.py --help\n" +"usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs " +"[inputs ...]]\n" +"\n" +"Command-line example.\n" +"\n" +"positional arguments:\n" +" inputs input filenames (default is stdin)\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" -v produce verbose output\n" +" -o FILE direct output to FILE instead of stdout\n" +" -C NUM display NUM lines of added context" +msgstr "" + #: whatsnew/2.7.rst:410 msgid "" "As with :mod:`optparse`, the command-line switches and arguments are " "returned as an object with attributes named by the *dest* parameters::" msgstr "" +#: whatsnew/2.7.rst:413 +msgid "" +"-> ./python.exe argparse-example.py -v\n" +"{'output': None,\n" +" 'is_verbose': True,\n" +" 'context': 0,\n" +" 'inputs': []}\n" +"\n" +"-> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2\n" +"{'output': '/tmp/output',\n" +" 'is_verbose': True,\n" +" 'context': 4,\n" +" 'inputs': ['file1', 'file2']}" +msgstr "" + #: whatsnew/2.7.rst:425 msgid "" ":mod:`argparse` has much fancier validation than :mod:`optparse`; you can " @@ -479,7 +597,7 @@ msgid "" "``'-'`` means standard input or output." msgstr "" -#: whatsnew/2.7.rst:438 +#: whatsnew/2.7.rst:437 msgid ":mod:`argparse` documentation" msgstr "" @@ -487,7 +605,7 @@ msgstr "" msgid "The documentation page of the argparse module." msgstr "" -#: whatsnew/2.7.rst:442 +#: whatsnew/2.7.rst:440 msgid ":ref:`upgrading-optparse-code`" msgstr "" @@ -545,6 +663,51 @@ msgid "" "log reaches 1MB." msgstr "" +#: whatsnew/2.7.rst:476 +msgid "" +"import logging\n" +"import logging.config\n" +"\n" +"configdict = {\n" +" 'version': 1, # Configuration schema in use; must be 1 for now\n" +" 'formatters': {\n" +" 'standard': {\n" +" 'format': ('%(asctime)s %(name)-15s '\n" +" '%(levelname)-8s %(message)s')}},\n" +"\n" +" 'handlers': {'netlog': {'backupCount': 10,\n" +" 'class': 'logging.handlers.RotatingFileHandler',\n" +" 'filename': '/logs/network.log',\n" +" 'formatter': 'standard',\n" +" 'level': 'INFO',\n" +" 'maxBytes': 1000000},\n" +" 'syslog': {'class': 'logging.handlers.SysLogHandler',\n" +" 'formatter': 'standard',\n" +" 'level': 'ERROR'}},\n" +"\n" +" # Specify all the subordinate loggers\n" +" 'loggers': {\n" +" 'network': {\n" +" 'handlers': ['netlog']\n" +" }\n" +" },\n" +" # Specify properties of the root logger\n" +" 'root': {\n" +" 'handlers': ['syslog']\n" +" },\n" +"}\n" +"\n" +"# Set up configuration\n" +"logging.config.dictConfig(configdict)\n" +"\n" +"# As an example, log two error messages\n" +"logger = logging.getLogger('/')\n" +"logger.error('Database not found')\n" +"\n" +"netlogger = logging.getLogger('network')\n" +"netlogger.error('Connection failed')" +msgstr "" + #: whatsnew/2.7.rst:518 msgid "" "Three smaller enhancements to the :mod:`logging` module, all implemented by " @@ -602,24 +765,63 @@ msgid "" "`!viewkeys`, :meth:`!viewvalues`, and :meth:`!viewitems`." msgstr "" +#: whatsnew/2.7.rst:562 +msgid "" +">>> d = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d\n" +"{0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}\n" +">>> d.viewkeys()\n" +"dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" +msgstr "" + #: whatsnew/2.7.rst:568 msgid "" "Views can be iterated over, but the key and item views also behave like " "sets. The ``&`` operator performs intersection, and ``|`` performs a union::" msgstr "" +#: whatsnew/2.7.rst:572 +msgid "" +">>> d1 = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d2 = dict((i**.5, i) for i in range(1000))\n" +">>> d1.viewkeys() & d2.viewkeys()\n" +"set([0.0, 10.0, 20.0, 30.0])\n" +">>> d1.viewkeys() | range(0, 30)\n" +"set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" +msgstr "" + #: whatsnew/2.7.rst:579 msgid "" "The view keeps track of the dictionary and its contents change as the " "dictionary is modified::" msgstr "" +#: whatsnew/2.7.rst:582 +msgid "" +">>> vk = d.viewkeys()\n" +">>> vk\n" +"dict_keys([0, 130, 10, ..., 250])\n" +">>> d[260] = '&'\n" +">>> vk\n" +"dict_keys([0, 130, 260, 10, ..., 250])" +msgstr "" + #: whatsnew/2.7.rst:589 msgid "" "However, note that you can't add or remove keys while you're iterating over " "the view::" msgstr "" +#: whatsnew/2.7.rst:592 +msgid "" +">>> for k in vk:\n" +"... d[k*2] = k\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"RuntimeError: dictionary changed size during iteration" +msgstr "" + #: whatsnew/2.7.rst:599 msgid "" "You can use the view methods in Python 2.x code, and the 2to3 converter will " @@ -627,7 +829,7 @@ msgid "" "meth:`~dict.items` methods." msgstr "" -#: whatsnew/2.7.rst:606 +#: whatsnew/2.7.rst:605 msgid ":pep:`3106` - Revamping dict.keys(), .values() and .items()" msgstr "" @@ -647,19 +849,59 @@ msgid "" "content that matches the :class:`bytes` type's interface." msgstr "" +#: whatsnew/2.7.rst:616 +msgid "" +">>> import string\n" +">>> m = memoryview(string.letters)\n" +">>> m\n" +"\n" +">>> len(m) # Returns length of underlying object\n" +"52\n" +">>> m[0], m[25], m[26] # Indexing returns one byte\n" +"('a', 'z', 'A')\n" +">>> m2 = m[0:26] # Slicing returns another memoryview\n" +">>> m2\n" +"" +msgstr "" + #: whatsnew/2.7.rst:631 msgid "" "The content of the view can be converted to a string of bytes or a list of " "integers:" msgstr "" +#: whatsnew/2.7.rst:634 +msgid "" +">>> m2.tobytes()\n" +"'abcdefghijklmnopqrstuvwxyz'\n" +">>> m2.tolist()\n" +"[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" +">>>" +msgstr "" + #: whatsnew/2.7.rst:643 msgid "" ":class:`memoryview` objects allow modifying the underlying object if it's a " "mutable object." msgstr "" -#: whatsnew/2.7.rst:666 +#: whatsnew/2.7.rst:646 +msgid "" +">>> m2[0] = 75\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: cannot modify read-only memory\n" +">>> b = bytearray(string.letters) # Creating a mutable object\n" +">>> b\n" +"bytearray(b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')\n" +">>> mb = memoryview(b)\n" +">>> mb[0] = '*' # Assign to view, changing the bytearray.\n" +">>> b[0:5] # The bytearray has been changed.\n" +"bytearray(b'*bcde')\n" +">>>" +msgstr "" + +#: whatsnew/2.7.rst:664 msgid ":pep:`3137` - Immutable Bytes and Mutable Buffer" msgstr "" @@ -686,6 +928,16 @@ msgid "" "an empty set." msgstr "" +#: whatsnew/2.7.rst:683 +msgid "" +">>> {1, 2, 3, 4, 5}\n" +"set([1, 2, 3, 4, 5])\n" +">>> set() # empty set\n" +"set([])\n" +">>> {} # empty dict\n" +"{}" +msgstr "" + #: whatsnew/2.7.rst:693 msgid "Backported by Alexandre Vassalotti; :issue:`2335`." msgstr "" @@ -697,6 +949,14 @@ msgid "" "sets and dictionaries." msgstr "" +#: whatsnew/2.7.rst:699 +msgid "" +">>> {x: x*x for x in range(6)}\n" +"{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}\n" +">>> {('a'*x) for x in range(6)}\n" +"set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" +msgstr "" + #: whatsnew/2.7.rst:707 msgid "Backported by Alexandre Vassalotti; :issue:`2333`." msgstr "" @@ -708,10 +968,23 @@ msgid "" "is treated as beginning a new :keyword:`!with` statement. This means that::" msgstr "" +#: whatsnew/2.7.rst:714 +msgid "" +"with A() as a, B() as b:\n" +" ... suite of statements ..." +msgstr "" + #: whatsnew/2.7.rst:717 msgid "is equivalent to::" msgstr "" +#: whatsnew/2.7.rst:719 +msgid "" +"with A() as a:\n" +" with B() as b:\n" +" ... suite of statements ..." +msgstr "" + #: whatsnew/2.7.rst:723 msgid "" "The :func:`!contextlib.nested` function provides a very similar function, so " @@ -769,12 +1042,30 @@ msgid "" "following::" msgstr "" +#: whatsnew/2.7.rst:767 +msgid "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935283e+20\n" +">>> n - long(float(n))\n" +"65535L" +msgstr "" + #: whatsnew/2.7.rst:773 msgid "" "Python 2.7's floating-point result is larger, but much closer to the true " "value::" msgstr "" +#: whatsnew/2.7.rst:776 +msgid "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935289e+20\n" +">>> n - long(float(n))\n" +"-1L" +msgstr "" + #: whatsnew/2.7.rst:782 msgid "(Implemented by Mark Dickinson; :issue:`3166`.)" msgstr "" @@ -799,6 +1090,14 @@ msgid "" "resemble using ``%s`` formatting::" msgstr "" +#: whatsnew/2.7.rst:795 +msgid "" +">>> '{}:{}:{}'.format(2009, 04, 'Sunday')\n" +"'2009:4:Sunday'\n" +">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" +"'2009:4:Sunday'" +msgstr "" + #: whatsnew/2.7.rst:800 msgid "" "The auto-numbering takes the fields from left to right, so the first ``{...}" @@ -843,6 +1142,20 @@ msgid "" "returns the number of bits necessary to represent its argument in binary::" msgstr "" +#: whatsnew/2.7.rst:832 +msgid "" +">>> n = 37\n" +">>> bin(n)\n" +"'0b100101'\n" +">>> n.bit_length()\n" +"6\n" +">>> n = 2**123-1\n" +">>> n.bit_length()\n" +"123\n" +">>> (n+1).bit_length()\n" +"124" +msgstr "" + #: whatsnew/2.7.rst:843 msgid "(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)" msgstr "" @@ -871,14 +1184,13 @@ msgstr "" #: whatsnew/2.7.rst:861 msgid "" -"When using :class:`@classmethod ` and :class:`@staticmethod " -"` to wrap methods as class or static methods, the wrapper " -"object now exposes the wrapped function as their :attr:`~method.__func__` " -"attribute. (Contributed by Amaury Forgeot d'Arc, after a suggestion by " -"George Sakkis; :issue:`5982`.)" +"When using :deco:`classmethod` and :deco:`staticmethod` to wrap methods as " +"class or static methods, the wrapper object now exposes the wrapped function " +"as their :attr:`~method.__func__` attribute. (Contributed by Amaury Forgeot " +"d'Arc, after a suggestion by George Sakkis; :issue:`5982`.)" msgstr "" -#: whatsnew/2.7.rst:2468 +#: whatsnew/2.7.rst:2464 msgid "" "When a restricted set of attributes were set using ``__slots__``, deleting " "an unset attribute would not raise :exc:`AttributeError` as you would " @@ -953,6 +1265,10 @@ msgid "" "across operating systems and shells.)" msgstr "" +#: whatsnew/2.7.rst:924 +msgid "export PYTHONWARNINGS=all,error:::Cookie:0" +msgstr "" + #: whatsnew/2.7.rst:930 msgid "Optimizations" msgstr "" @@ -1013,6 +1329,13 @@ msgid "" "of the C type used to store each digit::" msgstr "" +#: whatsnew/2.7.rst:974 +msgid "" +">>> import sys\n" +">>> sys.long_info\n" +"sys.long_info(bits_per_digit=30, sizeof_digit=4)" +msgstr "" + #: whatsnew/2.7.rst:978 msgid "(Contributed by Mark Dickinson; :issue:`4258`.)" msgstr "" @@ -1134,6 +1457,23 @@ msgid "" "raising a :exc:`KeyError`:" msgstr "" +#: whatsnew/2.7.rst:1064 +msgid "" +">>> from collections import Counter\n" +">>> c = Counter()\n" +">>> for letter in 'here is a sample of english text':\n" +"... c[letter] += 1\n" +"...\n" +">>> c\n" +"Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" +"'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" +"'p': 1, 'r': 1, 'x': 1})\n" +">>> c['e']\n" +"5\n" +">>> c['z']\n" +"0" +msgstr "" + #: whatsnew/2.7.rst:1081 msgid "" "There are three additional :class:`~collections.Counter` methods. :meth:" @@ -1145,6 +1485,22 @@ msgid "" "another :class:`Counter`, the counts are subtracted. ::" msgstr "" +#: whatsnew/2.7.rst:1091 +msgid "" +">>> c.most_common(5)\n" +"[(' ', 6), ('e', 5), ('s', 3), ('a', 2), ('i', 2)]\n" +">>> c.elements() ->\n" +" 'a', 'a', ' ', ' ', ' ', ' ', ' ', ' ',\n" +" 'e', 'e', 'e', 'e', 'e', 'g', 'f', 'i', 'i',\n" +" 'h', 'h', 'm', 'l', 'l', 'o', 'n', 'p', 's',\n" +" 's', 's', 'r', 't', 't', 'x'\n" +">>> c['e']\n" +"5\n" +">>> c.subtract('very heavy on the letter e')\n" +">>> c['e'] # Count is now lower\n" +"-1" +msgstr "" + #: whatsnew/2.7.rst:1104 msgid "Contributed by Raymond Hettinger; :issue:`1696199`." msgstr "" @@ -1192,6 +1548,27 @@ msgid "" "false; if true, options without values will be allowed. For example::" msgstr "" +#: whatsnew/2.7.rst:1141 +msgid "" +">>> import ConfigParser, StringIO\n" +">>> sample_config = \"\"\"\n" +"... [mysqld]\n" +"... user = mysql\n" +"... pid-file = /var/run/mysqld/mysqld.pid\n" +"... skip-bdb\n" +"... \"\"\"\n" +">>> config = ConfigParser.RawConfigParser(allow_no_value=True)\n" +">>> config.readfp(StringIO.StringIO(sample_config))\n" +">>> config.get('mysqld', 'user')\n" +"'mysql'\n" +">>> print config.get('mysqld', 'skip-bdb')\n" +"None\n" +">>> print config.get('mysqld', 'unknown')\n" +"Traceback (most recent call last):\n" +" ...\n" +"NoOptionError: No option 'unknown' in section: 'mysqld'" +msgstr "" + #: whatsnew/2.7.rst:1159 msgid "(Contributed by Mats Kindahl; :issue:`7005`.)" msgstr "" @@ -1252,7 +1629,7 @@ msgid "" "now produces sensible results based on the numeric values of the operands. " "Previously such comparisons would fall back to Python's default rules for " "comparing objects, which produced arbitrary results based on their type. " -"Note that you still cannot combine :class:`!Decimal` and floating-point in " +"Note that you still cannot combine :class:`!Decimal` and floating point in " "other operations such as addition, since you should be explicitly choosing " "how to convert between float and :class:`!Decimal`. (Fixed by Mark " "Dickinson; :issue:`2531`.)" @@ -1282,7 +1659,7 @@ msgid "" "types. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" -#: whatsnew/2.7.rst:2486 +#: whatsnew/2.7.rst:2482 msgid "" "Comparisons involving a signaling NaN value (or ``sNAN``) now signal :const:" "`~decimal.InvalidOperation` instead of silently returning a true or false " @@ -1444,6 +1821,22 @@ msgid "" "dictionary mapping argument names to their values. For example::" msgstr "" +#: whatsnew/2.7.rst:1333 +msgid "" +">>> from inspect import getcallargs\n" +">>> def f(a, b=1, *pos, **named):\n" +"... pass\n" +"...\n" +">>> getcallargs(f, 1, 2, 3)\n" +"{'a': 1, 'b': 2, 'pos': (3,), 'named': {}}\n" +">>> getcallargs(f, a=2, x=4)\n" +"{'a': 2, 'b': 1, 'pos': (), 'named': {'x': 4}}\n" +">>> getcallargs(f)\n" +"Traceback (most recent call last):\n" +"...\n" +"TypeError: f() takes at least 1 argument (0 given)" +msgstr "" + #: whatsnew/2.7.rst:1346 msgid "Contributed by George Sakkis; :issue:`3135`." msgstr "" @@ -1480,6 +1873,12 @@ msgid "" "true::" msgstr "" +#: whatsnew/2.7.rst:1368 +msgid "" +"itertools.compress('ABCDEF', [1,0,1,0,1,1]) =>\n" +" A, C, E, F" +msgstr "" + #: whatsnew/2.7.rst:1373 msgid "" "New function: ``itertools.combinations_with_replacement(iter, r)`` returns " @@ -1488,6 +1887,13 @@ msgid "" "repeated in the generated combinations::" msgstr "" +#: whatsnew/2.7.rst:1378 +msgid "" +"itertools.combinations_with_replacement('abc', 2) =>\n" +" ('a', 'a'), ('a', 'b'), ('a', 'c'),\n" +" ('b', 'b'), ('b', 'c'), ('c', 'c')" +msgstr "" + #: whatsnew/2.7.rst:1382 msgid "" "Note that elements are treated as unique depending on their position in the " @@ -1566,8 +1972,8 @@ msgstr "" #: whatsnew/2.7.rst:1434 msgid "" -"The :mod:`nntplib` module now supports IPv6 addresses. (Contributed by Derek " -"Morr; :issue:`1664`.)" +"The :mod:`!nntplib` module now supports IPv6 addresses. (Contributed by " +"Derek Morr; :issue:`1664`.)" msgstr "" #: whatsnew/2.7.rst:1437 @@ -1716,8 +2122,9 @@ msgid "" "The :mod:`ssl` module's :class:`~ssl.SSLSocket` objects now support the " "buffer API, which fixed a test suite failure (fix by Antoine Pitrou; :issue:" "`7133`) and automatically set OpenSSL's :c:macro:`!SSL_MODE_AUTO_RETRY`, " -"which will prevent an error code being returned from :meth:`recv` operations " -"that trigger an SSL renegotiation (fix by Antoine Pitrou; :issue:`8222`)." +"which will prevent an error code being returned from :meth:`!recv` " +"operations that trigger an SSL renegotiation (fix by Antoine Pitrou; :issue:" +"`8222`)." msgstr "" #: whatsnew/2.7.rst:1547 @@ -1725,8 +2132,8 @@ msgid "" "The :func:`~ssl.SSLContext.wrap_socket` constructor function now takes a " "*ciphers* argument that's a string listing the encryption algorithms to be " "allowed; the format of the string is described `in the OpenSSL documentation " -"`__. (Added by " -"Antoine Pitrou; :issue:`8322`.)" +"`__. (Added by Antoine " +"Pitrou; :issue:`8322`.)" msgstr "" #: whatsnew/2.7.rst:1554 @@ -1764,6 +2171,18 @@ msgid "" "raises a :exc:`~subprocess.CalledProcessError` exception otherwise." msgstr "" +#: whatsnew/2.7.rst:1582 +msgid "" +">>> subprocess.check_output(['df', '-h', '.'])\n" +"'Filesystem Size Used Avail Capacity Mounted on\\n\n" +"/dev/disk0s2 52G 49G 3.0G 94% /\\n'\n" +"\n" +">>> subprocess.check_output(['df', '-h', '/bogus'])\n" +" ...\n" +"subprocess.CalledProcessError: Command '['df', '-h', '/bogus']' returned non-" +"zero exit status 1" +msgstr "" + #: whatsnew/2.7.rst:1590 msgid "(Contributed by Gregory P. Smith.)" msgstr "" @@ -1783,7 +2202,7 @@ msgid "" "Hylton.)" msgstr "" -#: whatsnew/2.7.rst:2502 +#: whatsnew/2.7.rst:2498 msgid "" "The :mod:`syslog` module will now use the value of ``sys.argv[0]`` as the " "identifier instead of the previous default value of ``'python'``. (Changed " @@ -1792,7 +2211,7 @@ msgstr "" #: whatsnew/2.7.rst:1605 msgid "" -"The :attr:`sys.version_info` value is now a named tuple, with attributes " +"The :data:`sys.version_info` value is now a named tuple, with attributes " "named :attr:`!major`, :attr:`!minor`, :attr:`!micro`, :attr:`!releaselevel`, " "and :attr:`!serial`. (Contributed by Ross Light; :issue:`4285`.)" msgstr "" @@ -1806,7 +2225,7 @@ msgid "" "(Contributed by Brian Curtin; :issue:`7766`.)" msgstr "" -#: whatsnew/2.7.rst:2506 +#: whatsnew/2.7.rst:2502 msgid "" "The :mod:`tarfile` module's default error handling has changed, to no longer " "suppress fatal errors. The default error level was previously 0, which " @@ -1850,7 +2269,7 @@ msgid "" "Florent Xicluna; :issue:`8024`)." msgstr "" -#: whatsnew/2.7.rst:2514 +#: whatsnew/2.7.rst:2510 msgid "" "The :mod:`urlparse ` module's :func:`~urllib.parse.urlsplit` " "now handles unknown URL schemes in a fashion compliant with :rfc:`3986`: if " @@ -1860,11 +2279,25 @@ msgid "" "behaviour. For example, Python 2.6.4 or 2.5 will return the following:" msgstr "" -#: whatsnew/2.7.rst:2529 +#: whatsnew/2.7.rst:2518 +msgid "" +">>> import urlparse\n" +">>> urlparse.urlsplit('invented://host/filename?query')\n" +"('invented', '', '//host/filename?query', '', '')" +msgstr "" + +#: whatsnew/2.7.rst:2525 msgid "Python 2.7 (and Python 2.6.5) will return:" msgstr "" -#: whatsnew/2.7.rst:2538 +#: whatsnew/2.7.rst:2527 +msgid "" +">>> import urlparse\n" +">>> urlparse.urlsplit('invented://host/filename?query')\n" +"('invented', 'host', '/filename?query', '', '')" +msgstr "" + +#: whatsnew/2.7.rst:2534 msgid "" "(Python 2.7 actually produces slightly different output, since it returns a " "named tuple instead of a standard tuple.)" @@ -1877,6 +2310,13 @@ msgid "" "`2987`)." msgstr "" +#: whatsnew/2.7.rst:1681 +msgid "" +">>> urlparse.urlparse('http://[1080::8:800:200C:417A]/foo')\n" +"ParseResult(scheme='http', netloc='[1080::8:800:200C:417A]',\n" +" path='/foo', params='', query='', fragment='')" +msgstr "" + #: whatsnew/2.7.rst:1688 msgid "" "New class: the :class:`~weakref.WeakSet` class in the :mod:`weakref` module " @@ -1945,7 +2385,7 @@ msgstr "" msgid "" "Python 3.1 includes the :mod:`importlib` package, a re-implementation of the " "logic underlying Python's :keyword:`import` statement. :mod:`importlib` is " -"useful for implementors of Python interpreters and to users who wish to " +"useful for implementers of Python interpreters and to users who wish to " "write new importers that can participate in the import process. Python 2.7 " "doesn't contain the complete :mod:`importlib` package, but instead has a " "tiny subset that contains a single function, :func:`~importlib." @@ -1967,6 +2407,18 @@ msgstr "" msgid "Here are some examples::" msgstr "" +#: whatsnew/2.7.rst:1758 +msgid "" +">>> from importlib import import_module\n" +">>> anydbm = import_module('anydbm') # Standard absolute import\n" +">>> anydbm\n" +"\n" +">>> # Relative import\n" +">>> file_util = import_module('..file_util', 'distutils.command')\n" +">>> file_util\n" +"" +msgstr "" + #: whatsnew/2.7.rst:1767 msgid "" ":mod:`importlib` was implemented by Brett Cannon and introduced in Python " @@ -2070,10 +2522,10 @@ msgid "" "added. Most of these features were implemented by Michael Foord, unless " "otherwise noted. The enhanced version of the module is downloadable " "separately for use with Python versions 2.4 to 2.6, packaged as the :mod:`!" -"unittest2` package, from https://pypi.org/project/unittest2." +"unittest2` package, from :pypi:`unittest2`." msgstr "" -#: whatsnew/2.7.rst:1837 +#: whatsnew/2.7.rst:1836 msgid "" "When used from the command line, the module can automatically discover " "tests. It's not as fancy as `py.test `__ or `nose " @@ -2083,17 +2535,21 @@ msgid "" "files named ``test*.py``::" msgstr "" -#: whatsnew/2.7.rst:1846 +#: whatsnew/2.7.rst:1843 +msgid "python -m unittest discover -s test" +msgstr "" + +#: whatsnew/2.7.rst:1845 msgid "" "Consult the :mod:`unittest` module documentation for more details. " "(Developed in :issue:`6001`.)" msgstr "" -#: whatsnew/2.7.rst:1849 +#: whatsnew/2.7.rst:1848 msgid "The :func:`~unittest.main` function supports some other new options:" msgstr "" -#: whatsnew/2.7.rst:1851 +#: whatsnew/2.7.rst:1850 msgid "" ":option:`-b ` or :option:`!--buffer` will buffer the standard " "output and standard error streams during each test. If the test passes, any " @@ -2101,7 +2557,7 @@ msgid "" "displayed." msgstr "" -#: whatsnew/2.7.rst:1856 +#: whatsnew/2.7.rst:1855 msgid "" ":option:`-c ` or :option:`!--catch` will cause the control-C " "interrupt to be handled more gracefully. Instead of interrupting the test " @@ -2110,7 +2566,7 @@ msgid "" "impatient, a second press of control-C will cause an immediate interruption." msgstr "" -#: whatsnew/2.7.rst:1863 +#: whatsnew/2.7.rst:1862 msgid "" "This control-C handler tries to avoid causing problems when the code being " "tested or the tests being run have defined a signal handler of their own, by " @@ -2120,7 +2576,7 @@ msgid "" "disabled." msgstr "" -#: whatsnew/2.7.rst:1870 +#: whatsnew/2.7.rst:1869 msgid "" ":option:`-f ` or :option:`!--failfast` makes test execution " "stop immediately when a test fails instead of continuing to execute further " @@ -2128,20 +2584,20 @@ msgid "" "`8074`.)" msgstr "" -#: whatsnew/2.7.rst:1875 +#: whatsnew/2.7.rst:1874 msgid "" "The progress messages now show 'x' for expected failures and 'u' for " "unexpected successes when run in verbose mode. (Contributed by Benjamin " "Peterson.)" msgstr "" -#: whatsnew/2.7.rst:1879 +#: whatsnew/2.7.rst:1878 msgid "" "Test cases can raise the :exc:`~unittest.SkipTest` exception to skip a test " "(:issue:`1034053`)." msgstr "" -#: whatsnew/2.7.rst:1882 +#: whatsnew/2.7.rst:1881 msgid "" "The error messages for :meth:`~unittest.TestCase.assertEqual`, :meth:" "`~unittest.TestCase.assertTrue`, and :meth:`~unittest.TestCase.assertFalse` " @@ -2152,18 +2608,24 @@ msgid "" "`5663`.)" msgstr "" -#: whatsnew/2.7.rst:1889 +#: whatsnew/2.7.rst:1888 msgid "" "The :meth:`~unittest.TestCase.assertRaises` method now returns a context " "handler when called without providing a callable object to run. For " "example, you can write this::" msgstr "" -#: whatsnew/2.7.rst:1896 +#: whatsnew/2.7.rst:1892 +msgid "" +"with self.assertRaises(KeyError):\n" +" {}['foo']" +msgstr "" + +#: whatsnew/2.7.rst:1895 msgid "(Implemented by Antoine Pitrou; :issue:`4444`.)" msgstr "" -#: whatsnew/2.7.rst:1900 +#: whatsnew/2.7.rst:1899 msgid "" "Module- and class-level setup and teardown fixtures are now supported. " "Modules can contain :func:`~unittest.setUpModule` and :func:`~unittest." @@ -2174,7 +2636,7 @@ msgid "" "case in a different module or class." msgstr "" -#: whatsnew/2.7.rst:1908 +#: whatsnew/2.7.rst:1907 msgid "" "The methods :meth:`~unittest.TestCase.addCleanup` and :meth:`~unittest." "TestCase.doCleanups` were added. :meth:`~unittest.TestCase.addCleanup` lets " @@ -2184,7 +2646,7 @@ msgid "" "simpler resource allocation and deallocation during tests (:issue:`5679`)." msgstr "" -#: whatsnew/2.7.rst:1916 +#: whatsnew/2.7.rst:1915 msgid "" "A number of new methods were added that provide more specialized tests. " "Many of these methods were written by Google engineers for use in their test " @@ -2192,21 +2654,21 @@ msgid "" "Python's version of :mod:`unittest`." msgstr "" -#: whatsnew/2.7.rst:1921 +#: whatsnew/2.7.rst:1920 msgid "" ":meth:`~unittest.TestCase.assertIsNone` and :meth:`~unittest.TestCase." "assertIsNotNone` take one expression and verify that the result is or is not " "``None``." msgstr "" -#: whatsnew/2.7.rst:1924 +#: whatsnew/2.7.rst:1923 msgid "" ":meth:`~unittest.TestCase.assertIs` and :meth:`~unittest.TestCase." "assertIsNot` take two values and check whether the two values evaluate to " "the same object or not. (Added by Michael Foord; :issue:`2578`.)" msgstr "" -#: whatsnew/2.7.rst:1928 +#: whatsnew/2.7.rst:1927 msgid "" ":meth:`~unittest.TestCase.assertIsInstance` and :meth:`~unittest.TestCase." "assertNotIsInstance` check whether the resulting object is an instance of a " @@ -2214,14 +2676,14 @@ msgid "" "issue:`7031`.)" msgstr "" -#: whatsnew/2.7.rst:1933 +#: whatsnew/2.7.rst:1932 msgid "" ":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase." "assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, and :meth:" "`~unittest.TestCase.assertLessEqual` compare two quantities." msgstr "" -#: whatsnew/2.7.rst:1937 +#: whatsnew/2.7.rst:1936 msgid "" ":meth:`~unittest.TestCase.assertMultiLineEqual` compares two strings, and if " "they're not equal, displays a helpful comparison that highlights the " @@ -2229,7 +2691,7 @@ msgid "" "Unicode strings are compared with :meth:`~unittest.TestCase.assertEqual`." msgstr "" -#: whatsnew/2.7.rst:1942 +#: whatsnew/2.7.rst:1941 msgid "" ":meth:`assertRegexpMatches() ` and :meth:" "`assertNotRegexpMatches() ` checks whether " @@ -2237,7 +2699,7 @@ msgid "" "expression provided as the second argument (:issue:`8038`)." msgstr "" -#: whatsnew/2.7.rst:1947 +#: whatsnew/2.7.rst:1946 msgid "" ":meth:`assertRaisesRegexp() ` checks " "whether a particular exception is raised, and then also checks that the " @@ -2245,25 +2707,25 @@ msgid "" "expression." msgstr "" -#: whatsnew/2.7.rst:1952 +#: whatsnew/2.7.rst:1951 msgid "" ":meth:`~unittest.TestCase.assertIn` and :meth:`~unittest.TestCase." "assertNotIn` tests whether *first* is or is not in *second*." msgstr "" -#: whatsnew/2.7.rst:1955 +#: whatsnew/2.7.rst:1954 msgid "" ":meth:`assertItemsEqual() ` tests " "whether two provided sequences contain the same elements." msgstr "" -#: whatsnew/2.7.rst:1958 +#: whatsnew/2.7.rst:1957 msgid "" ":meth:`~unittest.TestCase.assertSetEqual` compares whether two sets are " "equal, and only reports the differences between the sets in case of error." msgstr "" -#: whatsnew/2.7.rst:1961 +#: whatsnew/2.7.rst:1960 msgid "" "Similarly, :meth:`~unittest.TestCase.assertListEqual` and :meth:`~unittest." "TestCase.assertTupleEqual` compare the specified types and explain any " @@ -2274,7 +2736,7 @@ msgid "" "both sequences are of a particular type." msgstr "" -#: whatsnew/2.7.rst:1969 +#: whatsnew/2.7.rst:1968 msgid "" ":meth:`~unittest.TestCase.assertDictEqual` compares two dictionaries and " "reports the differences; it's now used by default when you compare two " @@ -2283,7 +2745,7 @@ msgid "" "*first* are found in *second*." msgstr "" -#: whatsnew/2.7.rst:1974 +#: whatsnew/2.7.rst:1973 msgid "" ":meth:`~unittest.TestCase.assertAlmostEqual` and :meth:`~unittest.TestCase." "assertNotAlmostEqual` test whether *first* and *second* are approximately " @@ -2292,14 +2754,14 @@ msgid "" "require the difference to be smaller than a supplied *delta* value." msgstr "" -#: whatsnew/2.7.rst:1980 +#: whatsnew/2.7.rst:1979 msgid "" ":meth:`~unittest.TestLoader.loadTestsFromName` properly honors the :attr:" "`~unittest.TestLoader.suiteClass` attribute of the :class:`~unittest." "TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" msgstr "" -#: whatsnew/2.7.rst:1984 +#: whatsnew/2.7.rst:1983 msgid "" "A new hook lets you extend the :meth:`~unittest.TestCase.assertEqual` method " "to handle new data types. The :meth:`~unittest.TestCase." @@ -2311,7 +2773,7 @@ msgid "" "sequence comparison methods do." msgstr "" -#: whatsnew/2.7.rst:1993 +#: whatsnew/2.7.rst:1992 msgid "" ":func:`unittest.main` now takes an optional ``exit`` argument. If false, :" "func:`~unittest.main` doesn't call :func:`sys.exit`, allowing :func:" @@ -2319,7 +2781,7 @@ msgid "" "by J. Pablo Fernández; :issue:`3379`.)" msgstr "" -#: whatsnew/2.7.rst:1998 +#: whatsnew/2.7.rst:1997 msgid "" ":class:`~unittest.TestResult` has new :meth:`~unittest.TestResult." "startTestRun` and :meth:`~unittest.TestResult.stopTestRun` methods that are " @@ -2327,7 +2789,7 @@ msgid "" "Collins; :issue:`5728`.)" msgstr "" -#: whatsnew/2.7.rst:2002 +#: whatsnew/2.7.rst:2001 msgid "" "With all these changes, the :file:`unittest.py` was becoming awkwardly " "large, so the module was turned into a package and the code split into " @@ -2335,48 +2797,54 @@ msgid "" "imported or used." msgstr "" -#: whatsnew/2.7.rst:2010 +#: whatsnew/2.7.rst:2008 msgid "" "https://web.archive.org/web/20210619163128/http://www.voidspace.org.uk/" "python/articles/unittest2.shtml" msgstr "" -#: whatsnew/2.7.rst:2010 +#: whatsnew/2.7.rst:2009 msgid "" "Describes the new features, how to use them, and the rationale for various " "design decisions. (By Michael Foord.)" msgstr "" -#: whatsnew/2.7.rst:2016 +#: whatsnew/2.7.rst:2015 msgid "Updated module: ElementTree 1.3" msgstr "" -#: whatsnew/2.7.rst:2018 +#: whatsnew/2.7.rst:2017 msgid "" "The version of the ElementTree library included with Python was updated to " "version 1.3. Some of the new features are:" msgstr "" -#: whatsnew/2.7.rst:2021 +#: whatsnew/2.7.rst:2020 msgid "" "The various parsing functions now take a *parser* keyword argument giving " "an :class:`~xml.etree.ElementTree.XMLParser` instance that will be used. " "This makes it possible to override the file's internal encoding::" msgstr "" -#: whatsnew/2.7.rst:2028 +#: whatsnew/2.7.rst:2024 +msgid "" +"p = ET.XMLParser(encoding='utf-8')\n" +"t = ET.XML(\"\"\"\"\"\", parser=p)" +msgstr "" + +#: whatsnew/2.7.rst:2027 msgid "" "Errors in parsing XML now raise a :exc:`~xml.etree.ElementTree.ParseError` " "exception, whose instances have a :attr:`!position` attribute containing a " "(*line*, *column*) tuple giving the location of the problem." msgstr "" -#: whatsnew/2.7.rst:2032 +#: whatsnew/2.7.rst:2031 msgid "" "ElementTree's code for converting trees to a string has been significantly " "reworked, making it roughly twice as fast in many cases. The :meth:" -"`ElementTree.write() ` and :meth:" -"`Element.write` methods now have a *method* parameter that can be " +"`ElementTree.write() ` and :meth:`!" +"Element.write` methods now have a *method* parameter that can be " "\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " "elements as ```` instead of ````, and text mode will " "skip over elements and only output the text chunks. If you set the :attr:" @@ -2386,17 +2854,17 @@ msgid "" "a single element." msgstr "" -#: whatsnew/2.7.rst:2045 +#: whatsnew/2.7.rst:2044 msgid "" "Namespace handling has also been improved. All ``xmlns:`` " "declarations are now output on the root element, not scattered throughout " "the resulting XML. You can set the default namespace for a tree by setting " -"the :attr:`default_namespace` attribute and can register new prefixes with :" +"the :attr:`!default_namespace` attribute and can register new prefixes with :" "meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you can use " "the true/false *xml_declaration* parameter to suppress the XML declaration." msgstr "" -#: whatsnew/2.7.rst:2053 +#: whatsnew/2.7.rst:2052 msgid "" "New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." "ElementTree.Element.extend` appends the items from a sequence to the " @@ -2404,7 +2872,21 @@ msgid "" "to move children from one element to another::" msgstr "" -#: whatsnew/2.7.rst:2070 +#: whatsnew/2.7.rst:2058 +msgid "" +"from xml.etree import ElementTree as ET\n" +"\n" +"t = ET.XML(\"\"\"\n" +" 1 2 3\n" +"\"\"\")\n" +"new = ET.XML('')\n" +"new.extend(t)\n" +"\n" +"# Outputs 1...\n" +"print ET.tostring(new)" +msgstr "" + +#: whatsnew/2.7.rst:2069 msgid "" "New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." "ElementTree.Element.iter` yields the children of the element as a " @@ -2414,14 +2896,24 @@ msgid "" "of children." msgstr "" -#: whatsnew/2.7.rst:2077 +#: whatsnew/2.7.rst:2076 msgid "" "New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." "ElementTree.Element.itertext` yields all chunks of text that are descendants " "of the element. For example::" msgstr "" -#: whatsnew/2.7.rst:2088 +#: whatsnew/2.7.rst:2080 +msgid "" +"t = ET.XML(\"\"\"\n" +" 1 2 3\n" +"\"\"\")\n" +"\n" +"# Outputs ['\\n ', '1', ' ', '2', ' ', '3', '\\n']\n" +"print list(t.itertext())" +msgstr "" + +#: whatsnew/2.7.rst:2087 msgid "" "Deprecated: using an element as a Boolean (i.e., ``if elem:``) would return " "true if the element had any children, or false if there were no children. " @@ -2431,7 +2923,7 @@ msgid "" "number of children, or ``elem is not None``." msgstr "" -#: whatsnew/2.7.rst:2096 +#: whatsnew/2.7.rst:2095 msgid "" "Fredrik Lundh develops ElementTree and produced the 1.3 version; you can " "read his article describing 1.3 at https://web.archive.org/" @@ -2440,15 +2932,15 @@ msgid "" "python-dev and in :issue:`6472`.)" msgstr "" -#: whatsnew/2.7.rst:2106 +#: whatsnew/2.7.rst:2105 msgid "Build and C API Changes" msgstr "" -#: whatsnew/2.7.rst:2108 +#: whatsnew/2.7.rst:2107 msgid "Changes to Python's build process and to the C API include:" msgstr "" -#: whatsnew/2.7.rst:2110 +#: whatsnew/2.7.rst:2109 msgid "" "The latest release of the GNU Debugger, GDB 7, can be `scripted using Python " "`_; discussed in :issue:`5753`, and fixed by " -"Antoine Pitrou." +"Security issue reported as :cve:`2008-5983`; discussed in :issue:`5753`, and " +"fixed by Antoine Pitrou." msgstr "" -#: whatsnew/2.7.rst:2185 +#: whatsnew/2.7.rst:2183 msgid "" "New macros: the Python header files now define the following macros: :c:" "macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:" @@ -2567,7 +3058,7 @@ msgid "" "Eric Smith; :issue:`5793`.)" msgstr "" -#: whatsnew/2.7.rst:2203 +#: whatsnew/2.7.rst:2199 msgid "" "Removed function: :c:func:`!PyEval_CallObject` is now only available as a " "macro. A function version was being kept around to preserve ABI linking " @@ -2575,7 +3066,7 @@ msgid "" "(Removed by Antoine Pitrou; :issue:`8276`.)" msgstr "" -#: whatsnew/2.7.rst:2208 +#: whatsnew/2.7.rst:2204 msgid "" "New format codes: the :c:func:`!PyString_FromFormat`, :c:func:`!" "PyString_FromFormatV`, and :c:func:`PyErr_Format` functions now accept " @@ -2583,7 +3074,7 @@ msgid "" "types. (Contributed by Mark Dickinson; :issue:`7228`.)" msgstr "" -#: whatsnew/2.7.rst:2214 +#: whatsnew/2.7.rst:2210 msgid "" "The complicated interaction between threads and process forking has been " "changed. Previously, the child process created by :func:`os.fork` might " @@ -2595,7 +3086,7 @@ msgid "" "replicated, and the child process would no longer be able to perform imports." msgstr "" -#: whatsnew/2.7.rst:2224 +#: whatsnew/2.7.rst:2220 msgid "" "Python 2.7 acquires the import lock before performing an :func:`os.fork`, " "and will also clean up any locks created using the :mod:`threading` module. " @@ -2603,31 +3094,31 @@ msgid "" "themselves, will not benefit from this clean-up." msgstr "" -#: whatsnew/2.7.rst:2230 +#: whatsnew/2.7.rst:2226 msgid "(Fixed by Thomas Wouters; :issue:`1590864`.)" msgstr "" -#: whatsnew/2.7.rst:2232 +#: whatsnew/2.7.rst:2228 msgid "" "The :c:func:`Py_Finalize` function now calls the internal :func:`!threading." "_shutdown` function; this prevents some exceptions from being raised when an " "interpreter shuts down. (Patch by Adam Olsen; :issue:`1722344`.)" msgstr "" -#: whatsnew/2.7.rst:2237 +#: whatsnew/2.7.rst:2233 msgid "" "When using the :c:type:`PyMemberDef` structure to define attributes of a " -"type, Python will no longer let you try to delete or set a :c:macro:" -"`T_STRING_INPLACE` attribute." +"type, Python will no longer let you try to delete or set a :c:macro:`!" +"T_STRING_INPLACE` attribute." msgstr "" -#: whatsnew/2.7.rst:2243 +#: whatsnew/2.7.rst:2239 msgid "" "Global symbols defined by the :mod:`ctypes` module are now prefixed with " "``Py``, or with ``_ctypes``. (Implemented by Thomas Heller; :issue:`3102`.)" msgstr "" -#: whatsnew/2.7.rst:2247 +#: whatsnew/2.7.rst:2243 msgid "" "New configure option: the :option:`!--with-system-expat` switch allows " "building the :mod:`pyexpat ` module to use the system " @@ -2635,7 +3126,7 @@ msgid "" "`7609`.)" msgstr "" -#: whatsnew/2.7.rst:2251 +#: whatsnew/2.7.rst:2247 msgid "" "New configure option: the :option:`!--with-valgrind` option will now disable " "the pymalloc allocator, which is difficult for the Valgrind memory-error " @@ -2644,46 +3135,46 @@ msgid "" "issue:`2422`.)" msgstr "" -#: whatsnew/2.7.rst:2258 +#: whatsnew/2.7.rst:2254 msgid "" "New configure option: you can now supply an empty string to :option:`!--with-" "dbmliborder=` in order to disable all of the various DBM modules. (Added by " "Arfrever Frehtes Taifersar Arahesis; :issue:`6491`.)" msgstr "" -#: whatsnew/2.7.rst:2263 +#: whatsnew/2.7.rst:2259 msgid "" "The :program:`configure` script now checks for floating-point rounding bugs " -"on certain 32-bit Intel chips and defines a :c:macro:`X87_DOUBLE_ROUNDING` " +"on certain 32-bit Intel chips and defines a :c:macro:`!X87_DOUBLE_ROUNDING` " "preprocessor definition. No code currently uses this definition, but it's " "available if anyone wishes to use it. (Added by Mark Dickinson; :issue:" "`2937`.)" msgstr "" -#: whatsnew/2.7.rst:2269 +#: whatsnew/2.7.rst:2265 msgid "" -":program:`configure` also now sets a :envvar:`LDCXXSHARED` Makefile variable " -"for supporting C++ linking. (Contributed by Arfrever Frehtes Taifersar " -"Arahesis; :issue:`1222585`.)" +":program:`configure` also now sets a :envvar:`!LDCXXSHARED` Makefile " +"variable for supporting C++ linking. (Contributed by Arfrever Frehtes " +"Taifersar Arahesis; :issue:`1222585`.)" msgstr "" -#: whatsnew/2.7.rst:2273 +#: whatsnew/2.7.rst:2269 msgid "" "The build process now creates the necessary files for pkg-config support. " "(Contributed by Clinton Roy; :issue:`3585`.)" msgstr "" -#: whatsnew/2.7.rst:2276 +#: whatsnew/2.7.rst:2272 msgid "" "The build process now supports Subversion 1.7. (Contributed by Arfrever " "Frehtes Taifersar Arahesis; :issue:`6094`.)" msgstr "" -#: whatsnew/2.7.rst:2283 +#: whatsnew/2.7.rst:2279 msgid "Capsules" msgstr "" -#: whatsnew/2.7.rst:2285 +#: whatsnew/2.7.rst:2281 msgid "" "Python 3.1 adds a new C datatype, :c:type:`PyCapsule`, for providing a C API " "to an extension module. A capsule is essentially the holder of a C ``void " @@ -2695,7 +3186,7 @@ msgid "" "module's various API functions." msgstr "" -#: whatsnew/2.7.rst:2294 +#: whatsnew/2.7.rst:2290 msgid "" "There is an existing data type already used for this, :c:type:`!PyCObject`, " "but it doesn't provide type safety. Evil code written in pure Python could " @@ -2705,7 +3196,19 @@ msgid "" "name:" msgstr "" -#: whatsnew/2.7.rst:2312 +#: whatsnew/2.7.rst:2297 +msgid "" +"void *vtable;\n" +"\n" +"if (!PyCapsule_IsValid(capsule, \"mymodule.CAPI\") {\n" +" PyErr_SetString(PyExc_ValueError, \"argument type invalid\");\n" +" return NULL;\n" +"}\n" +"\n" +"vtable = PyCapsule_GetPointer(capsule, \"mymodule.CAPI\");" +msgstr "" + +#: whatsnew/2.7.rst:2308 msgid "" "You are assured that ``vtable`` points to whatever you're expecting. If a " "different capsule was passed in, :c:func:`PyCapsule_IsValid` would detect " @@ -2713,7 +3216,7 @@ msgid "" "more information on using these objects." msgstr "" -#: whatsnew/2.7.rst:2317 +#: whatsnew/2.7.rst:2313 msgid "" "Python 2.7 now uses capsules internally to provide various extension-module " "APIs, but the :c:func:`!PyCObject_AsVoidPtr` was modified to handle " @@ -2722,17 +3225,17 @@ msgid "" "exc:`PendingDeprecationWarning`, which is silent by default." msgstr "" -#: whatsnew/2.7.rst:2324 +#: whatsnew/2.7.rst:2320 msgid "" "Implemented in Python 3.1 and backported to 2.7 by Larry Hastings; discussed " "in :issue:`5630`." msgstr "" -#: whatsnew/2.7.rst:2331 +#: whatsnew/2.7.rst:2327 msgid "Port-Specific Changes: Windows" msgstr "" -#: whatsnew/2.7.rst:2333 +#: whatsnew/2.7.rst:2329 msgid "" "The :mod:`msvcrt` module now contains some constants from the :file:" "`crtassem.h` header file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:" @@ -2741,7 +3244,7 @@ msgid "" "`4365`.)" msgstr "" -#: whatsnew/2.7.rst:2340 +#: whatsnew/2.7.rst:2336 msgid "" "The :mod:`_winreg ` module for accessing the registry now implements " "the :func:`~winreg.CreateKeyEx` and :func:`~winreg.DeleteKeyEx` functions, " @@ -2751,14 +3254,14 @@ msgid "" "tested and documented. (Implemented by Brian Curtin: :issue:`7347`.)" msgstr "" -#: whatsnew/2.7.rst:2348 +#: whatsnew/2.7.rst:2344 msgid "" "The new :c:func:`!_beginthreadex` API is used to start threads, and the " "native thread-local storage functions are now used. (Contributed by Kristján " "Valur Jónsson; :issue:`3582`.)" msgstr "" -#: whatsnew/2.7.rst:2352 +#: whatsnew/2.7.rst:2348 msgid "" "The :func:`os.kill` function now works on Windows. The signal value can be " "the constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal." @@ -2768,23 +3271,23 @@ msgid "" "Miki Tebeka; :issue:`1220212`.)" msgstr "" -#: whatsnew/2.7.rst:2359 +#: whatsnew/2.7.rst:2355 msgid "" "The :func:`os.listdir` function now correctly fails for an empty path. " "(Fixed by Hirokazu Yamamoto; :issue:`5913`.)" msgstr "" -#: whatsnew/2.7.rst:2362 +#: whatsnew/2.7.rst:2358 msgid "" "The :mod:`mimetypes` module will now read the MIME database from the Windows " "registry when initializing. (Patch by Gabriel Genellina; :issue:`4969`.)" msgstr "" -#: whatsnew/2.7.rst:2369 +#: whatsnew/2.7.rst:2365 msgid "Port-Specific Changes: Mac OS X" msgstr "" -#: whatsnew/2.7.rst:2371 +#: whatsnew/2.7.rst:2367 msgid "" "The path ``/Library/Python/2.7/site-packages`` is now appended to ``sys." "path``, in order to share added packages between the system installation and " @@ -2792,7 +3295,7 @@ msgid "" "issue:`4865`.)" msgstr "" -#: whatsnew/2.7.rst:2378 +#: whatsnew/2.7.rst:2374 msgid "" "As of 2.7.13, this change was removed. ``/Library/Python/2.7/site-" "packages``, the site-packages directory used by the Apple-supplied system " @@ -2804,11 +3307,11 @@ msgid "" "Pythons. (:issue:`28440`)" msgstr "" -#: whatsnew/2.7.rst:2389 +#: whatsnew/2.7.rst:2385 msgid "Port-Specific Changes: FreeBSD" msgstr "" -#: whatsnew/2.7.rst:2391 +#: whatsnew/2.7.rst:2387 msgid "" "FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with the :func:`~socket." "socket` methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket." @@ -2816,11 +3319,11 @@ msgid "" "mod:`socket` module. (Added by Kyle VanderBeek; :issue:`8235`.)" msgstr "" -#: whatsnew/2.7.rst:2397 +#: whatsnew/2.7.rst:2393 msgid "Other Changes and Fixes" msgstr "" -#: whatsnew/2.7.rst:2399 +#: whatsnew/2.7.rst:2395 msgid "" "Two benchmark scripts, :file:`iobench` and :file:`ccbench`, were added to " "the :file:`Tools` directory. :file:`iobench` measures the speed of the " @@ -2830,13 +3333,13 @@ msgid "" "bandwidth when performing several tasks using a varying number of threads." msgstr "" -#: whatsnew/2.7.rst:2407 +#: whatsnew/2.7.rst:2403 msgid "" "The :file:`Tools/i18n/msgfmt.py` script now understands plural forms in :" "file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" msgstr "" -#: whatsnew/2.7.rst:2411 +#: whatsnew/2.7.rst:2407 msgid "" "When importing a module from a :file:`.pyc` or :file:`.pyo` file with an " "existing :file:`.py` counterpart, the :attr:`~codeobject.co_filename` " @@ -2846,7 +3349,7 @@ msgid "" "Paul Calderone; :issue:`1180193`.)" msgstr "" -#: whatsnew/2.7.rst:2418 +#: whatsnew/2.7.rst:2414 msgid "" "The :file:`regrtest.py` script now takes a :option:`!--randseed=` switch " "that takes an integer that will be used as the random seed for the :option:" @@ -2854,7 +3357,7 @@ msgid "" "also reports the seed that was used (Added by Collin Winter.)" msgstr "" -#: whatsnew/2.7.rst:2424 +#: whatsnew/2.7.rst:2420 msgid "" "Another :file:`regrtest.py` switch is :option:`!-j`, which takes an integer " "specifying how many tests run in parallel. This allows reducing the total " @@ -2865,31 +3368,31 @@ msgid "" "they fail. (Added by Antoine Pitrou; :issue:`7312`.)" msgstr "" -#: whatsnew/2.7.rst:2433 +#: whatsnew/2.7.rst:2429 msgid "" "When executed as a script, the :file:`py_compile.py` module now accepts " "``'-'`` as an argument, which will read standard input for the list of " "filenames to be compiled. (Contributed by Piotr Ożarowski; :issue:`8233`.)" msgstr "" -#: whatsnew/2.7.rst:2441 +#: whatsnew/2.7.rst:2437 msgid "Porting to Python 2.7" msgstr "" -#: whatsnew/2.7.rst:2443 +#: whatsnew/2.7.rst:2439 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code:" msgstr "" -#: whatsnew/2.7.rst:2446 +#: whatsnew/2.7.rst:2442 msgid "" "The :func:`range` function processes its arguments more consistently; it " "will now call :meth:`~object.__int__` on non-float, non-integer arguments " "that are supplied to it. (Fixed by Alexander Belopolsky; :issue:`1533`.)" msgstr "" -#: whatsnew/2.7.rst:2451 +#: whatsnew/2.7.rst:2447 msgid "" "The string :meth:`format` method changed the default precision used for " "floating-point and complex numbers from 6 decimal places to 12, which " @@ -2897,7 +3400,7 @@ msgid "" "`5920`.)" msgstr "" -#: whatsnew/2.7.rst:2456 +#: whatsnew/2.7.rst:2452 msgid "" "Because of an optimization for the :keyword:`with` statement, the special " "methods :meth:`~object.__enter__` and :meth:`~object.__exit__` must belong " @@ -2906,7 +3409,7 @@ msgid "" "C extension types. (:issue:`6101`.)" msgstr "" -#: whatsnew/2.7.rst:2462 +#: whatsnew/2.7.rst:2458 msgid "" "Due to a bug in Python 2.6, the *exc_value* parameter to :meth:`~object." "__exit__` methods was often the string representation of the exception, not " @@ -2914,11 +3417,11 @@ msgid "" "expected. (Fixed by Florent Xicluna; :issue:`7853`.)" msgstr "" -#: whatsnew/2.7.rst:2472 +#: whatsnew/2.7.rst:2468 msgid "In the standard library:" msgstr "" -#: whatsnew/2.7.rst:2474 +#: whatsnew/2.7.rst:2470 msgid "" "Operations with :class:`~datetime.datetime` instances that resulted in a " "year falling outside the supported range didn't always raise :exc:" @@ -2927,7 +3430,7 @@ msgid "" "Alexander Belopolsky; :issue:`7150`.)" msgstr "" -#: whatsnew/2.7.rst:2480 +#: whatsnew/2.7.rst:2476 msgid "" "When using :class:`~decimal.Decimal` instances with a string's :meth:" "`format` method, the default alignment was previously left-alignment. This " @@ -2935,7 +3438,7 @@ msgid "" "programs. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" -#: whatsnew/2.7.rst:2492 +#: whatsnew/2.7.rst:2488 msgid "" "The :mod:`xml.etree.ElementTree` library no longer escapes ampersands and " "angle brackets when outputting an XML processing instruction (which looks " @@ -2943,49 +3446,49 @@ msgid "" "````). (Patch by Neil Muller; :issue:`2746`.)" msgstr "" -#: whatsnew/2.7.rst:2498 +#: whatsnew/2.7.rst:2494 msgid "" "The :meth:`!readline` method of :class:`~io.StringIO` objects now does " "nothing when a negative length is requested, as other file-like objects do. " "(:issue:`7348`)." msgstr "" -#: whatsnew/2.7.rst:2541 +#: whatsnew/2.7.rst:2537 msgid "For C extensions:" msgstr "" -#: whatsnew/2.7.rst:2543 +#: whatsnew/2.7.rst:2539 msgid "" "C extensions that use integer format codes with the ``PyArg_Parse*`` family " "of functions will now raise a :exc:`TypeError` exception instead of " "triggering a :exc:`DeprecationWarning` (:issue:`5080`)." msgstr "" -#: whatsnew/2.7.rst:2547 +#: whatsnew/2.7.rst:2543 msgid "" "Use the new :c:func:`PyOS_string_to_double` function instead of the old :c:" "func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, which " "are now deprecated." msgstr "" -#: whatsnew/2.7.rst:2551 +#: whatsnew/2.7.rst:2547 msgid "For applications that embed Python:" msgstr "" -#: whatsnew/2.7.rst:2553 +#: whatsnew/2.7.rst:2549 msgid "" -"The :c:func:`PySys_SetArgvEx` function was added, letting applications close " -"a security hole when the existing :c:func:`PySys_SetArgv` function was " -"used. Check whether you're calling :c:func:`PySys_SetArgv` and carefully " -"consider whether the application should be using :c:func:`PySys_SetArgvEx` " -"with *updatepath* set to false." +"The :c:func:`!PySys_SetArgvEx` function was added, letting applications " +"close a security hole when the existing :c:func:`!PySys_SetArgv` function " +"was used. Check whether you're calling :c:func:`!PySys_SetArgv` and " +"carefully consider whether the application should be using :c:func:`!" +"PySys_SetArgvEx` with *updatepath* set to false." msgstr "" -#: whatsnew/2.7.rst:2566 +#: whatsnew/2.7.rst:2562 msgid "New Features Added to Python 2.7 Maintenance Releases" msgstr "" -#: whatsnew/2.7.rst:2568 +#: whatsnew/2.7.rst:2564 msgid "" "New features may be added to Python 2.7 maintenance releases when the " "situation genuinely calls for it. Any such additions must go through the " @@ -2994,25 +3497,25 @@ msgid "" "Python 3, or else by publishing it on the Python Package Index." msgstr "" -#: whatsnew/2.7.rst:2574 +#: whatsnew/2.7.rst:2570 msgid "" "In addition to the specific proposals listed below, there is a general " "exemption allowing new ``-3`` warnings to be added in any Python 2.7 " "maintenance release." msgstr "" -#: whatsnew/2.7.rst:2580 +#: whatsnew/2.7.rst:2576 msgid "Two new environment variables for debug mode" msgstr "" -#: whatsnew/2.7.rst:2582 +#: whatsnew/2.7.rst:2578 msgid "" "In debug mode, the ``[xxx refs]`` statistic is not written by default, the :" "envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " "(Contributed by Victor Stinner; :issue:`31733`.)" msgstr "" -#: whatsnew/2.7.rst:2586 +#: whatsnew/2.7.rst:2582 msgid "" "When Python is compiled with ``COUNT_ALLOC`` defined, allocation counts are " "no longer dumped by default anymore: the :envvar:`!PYTHONSHOWALLOCCOUNT` " @@ -3021,11 +3524,11 @@ msgid "" "issue:`31692`.)" msgstr "" -#: whatsnew/2.7.rst:2595 +#: whatsnew/2.7.rst:2591 msgid "PEP 434: IDLE Enhancement Exception for All Branches" msgstr "" -#: whatsnew/2.7.rst:2597 +#: whatsnew/2.7.rst:2593 msgid "" ":pep:`434` describes a general exemption for changes made to the IDLE " "development environment shipped along with Python. This exemption makes it " @@ -3033,62 +3536,63 @@ msgid "" "experience across all supported versions of Python 2 and 3." msgstr "" -#: whatsnew/2.7.rst:2602 +#: whatsnew/2.7.rst:2598 msgid "" "For details of any IDLE changes, refer to the NEWS file for the specific " "release." msgstr "" -#: whatsnew/2.7.rst:2607 +#: whatsnew/2.7.rst:2603 msgid "PEP 466: Network Security Enhancements for Python 2.7" msgstr "" -#: whatsnew/2.7.rst:2609 +#: whatsnew/2.7.rst:2605 msgid "" ":pep:`466` describes a number of network security enhancement proposals that " "have been approved for inclusion in Python 2.7 maintenance releases, with " "the first of those changes appearing in the Python 2.7.7 release." msgstr "" -#: whatsnew/2.7.rst:2613 +#: whatsnew/2.7.rst:2609 msgid ":pep:`466` related features added in Python 2.7.7:" msgstr "" -#: whatsnew/2.7.rst:2615 +#: whatsnew/2.7.rst:2611 msgid "" ":func:`hmac.compare_digest` was backported from Python 3 to make a timing " "attack resistant comparison operation available to Python 2 applications. " "(Contributed by Alex Gaynor; :issue:`21306`.)" msgstr "" -#: whatsnew/2.7.rst:2619 +#: whatsnew/2.7.rst:2615 msgid "" "OpenSSL 1.0.1g was upgraded in the official Windows installers published on " "python.org. (Contributed by Zachary Ware; :issue:`21462`.)" msgstr "" -#: whatsnew/2.7.rst:2622 +#: whatsnew/2.7.rst:2618 msgid ":pep:`466` related features added in Python 2.7.8:" msgstr "" -#: whatsnew/2.7.rst:2624 +#: whatsnew/2.7.rst:2620 msgid "" ":func:`hashlib.pbkdf2_hmac` was backported from Python 3 to make a hashing " "algorithm suitable for secure password storage broadly available to Python 2 " "applications. (Contributed by Alex Gaynor; :issue:`21304`.)" msgstr "" -#: whatsnew/2.7.rst:2628 +#: whatsnew/2.7.rst:2624 msgid "" "OpenSSL 1.0.1h was upgraded for the official Windows installers published on " -"python.org. (contributed by Zachary Ware in :issue:`21671` for CVE-2014-0224)" +"python.org. (Contributed by Zachary Ware in :issue:`21671` for :cve:" +"`2014-0224`.)" msgstr "" -#: whatsnew/2.7.rst:2631 +#: whatsnew/2.7.rst:2627 msgid ":pep:`466` related features added in Python 2.7.9:" msgstr "" -#: whatsnew/2.7.rst:2633 +#: whatsnew/2.7.rst:2629 msgid "" "Most of Python 3.4's :mod:`ssl` module was backported. This means :mod:`ssl` " "now supports Server Name Indication, TLS1.x settings, access to the platform " @@ -3096,20 +3600,20 @@ msgid "" "(Contributed by Alex Gaynor and David Reid; :issue:`21308`.)" msgstr "" -#: whatsnew/2.7.rst:2638 +#: whatsnew/2.7.rst:2634 msgid "" "Refer to the \"Version added: 2.7.9\" notes in the module documentation for " "specific details." msgstr "" -#: whatsnew/2.7.rst:2641 +#: whatsnew/2.7.rst:2637 msgid "" ":func:`os.urandom` was changed to cache a file descriptor to ``/dev/" "urandom`` instead of reopening ``/dev/urandom`` on every call. (Contributed " "by Alex Gaynor; :issue:`21305`.)" msgstr "" -#: whatsnew/2.7.rst:2645 +#: whatsnew/2.7.rst:2641 msgid "" ":data:`hashlib.algorithms_guaranteed` and :data:`hashlib." "algorithms_available` were backported from Python 3 to make it easier for " @@ -3117,22 +3621,22 @@ msgid "" "(Contributed by Alex Gaynor in :issue:`21307`)" msgstr "" -#: whatsnew/2.7.rst:2652 +#: whatsnew/2.7.rst:2648 msgid "PEP 477: Backport ensurepip (PEP 453) to Python 2.7" msgstr "" -#: whatsnew/2.7.rst:2654 +#: whatsnew/2.7.rst:2650 msgid "" ":pep:`477` approves the inclusion of the :pep:`453` ensurepip module and the " "improved documentation that was enabled by it in the Python 2.7 maintenance " "releases, appearing first in the Python 2.7.9 release." msgstr "" -#: whatsnew/2.7.rst:2660 +#: whatsnew/2.7.rst:2656 msgid "Bootstrapping pip By Default" msgstr "" -#: whatsnew/2.7.rst:2662 +#: whatsnew/2.7.rst:2658 msgid "" "The new :mod:`ensurepip` module (defined in :pep:`453`) provides a standard " "cross-platform mechanism to bootstrap the pip installer into Python " @@ -3142,14 +3646,14 @@ msgid "" "the release candidate." msgstr "" -#: whatsnew/2.7.rst:2669 +#: whatsnew/2.7.rst:2665 msgid "" "By default, the commands ``pip``, ``pipX`` and ``pipX.Y`` will be installed " "on all platforms (where X.Y stands for the version of the Python " "installation), along with the ``pip`` Python package and its dependencies." msgstr "" -#: whatsnew/2.7.rst:2673 +#: whatsnew/2.7.rst:2669 msgid "" "For CPython :ref:`source builds on POSIX systems `, " "the ``make install`` and ``make altinstall`` commands do not bootstrap " @@ -3157,7 +3661,7 @@ msgid "" "options, and overridden through Makefile options." msgstr "" -#: whatsnew/2.7.rst:2678 +#: whatsnew/2.7.rst:2674 msgid "" "On Windows and Mac OS X, the CPython installers now default to installing " "``pip`` along with CPython itself (users may opt out of installing it during " @@ -3167,19 +3671,20 @@ msgid "" "Windows as ``py -m pip``." msgstr "" -#: whatsnew/2.7.rst:2685 +#: whatsnew/2.7.rst:2681 msgid "" -"As `discussed in the PEP`__, platform packagers may choose not to install " -"these commands by default, as long as, when invoked, they provide clear and " -"simple directions on how to install them on that platform (usually using the " -"system package manager)." +"As :pep:`discussed in the PEP <0477#disabling-ensurepip-by-downstream-" +"distributors>`, platform packagers may choose not to install these commands " +"by default, as long as, when invoked, they provide clear and simple " +"directions on how to install them on that platform (usually using the system " +"package manager)." msgstr "" -#: whatsnew/2.7.rst:2694 +#: whatsnew/2.7.rst:2688 msgid "Documentation Changes" msgstr "" -#: whatsnew/2.7.rst:2696 +#: whatsnew/2.7.rst:2690 msgid "" "As part of this change, the :ref:`installing-index` and :ref:`distributing-" "index` sections of the documentation have been completely redesigned as " @@ -3189,29 +3694,29 @@ msgid "" "of the individual projects." msgstr "" -#: whatsnew/2.7.rst:2704 +#: whatsnew/2.7.rst:2698 msgid "" "However, as this migration is currently still incomplete, the legacy " "versions of those guides remaining available as :ref:`install-index` and :" "ref:`setuptools-index`." msgstr "" -#: whatsnew/2.7.rst:2711 +#: whatsnew/2.7.rst:2704 msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations" msgstr "" -#: whatsnew/2.7.rst:2711 +#: whatsnew/2.7.rst:2705 msgid "" "PEP written by Donald Stufft and Nick Coghlan, implemented by Donald Stufft, " "Nick Coghlan, Martin von Löwis and Ned Deily." msgstr "" -#: whatsnew/2.7.rst:2715 +#: whatsnew/2.7.rst:2709 msgid "" "PEP 476: Enabling certificate verification by default for stdlib http clients" msgstr "" -#: whatsnew/2.7.rst:2717 +#: whatsnew/2.7.rst:2711 msgid "" ":pep:`476` updated :mod:`httplib ` and modules which use it, such as :" "mod:`urllib2 ` and :mod:`xmlrpclib `, to now " @@ -3221,17 +3726,32 @@ msgid "" "for many applications. This change was made in the Python 2.7.9 release." msgstr "" -#: whatsnew/2.7.rst:2725 +#: whatsnew/2.7.rst:2719 msgid "" "For applications which require the old previous behavior, they can pass an " "alternate context::" msgstr "" -#: whatsnew/2.7.rst:2742 +#: whatsnew/2.7.rst:2722 +msgid "" +"import urllib2\n" +"import ssl\n" +"\n" +"# This disables all verification\n" +"context = ssl._create_unverified_context()\n" +"\n" +"# This allows using a specific certificate for the host, which doesn't need\n" +"# to be in the trust store\n" +"context = ssl.create_default_context(cafile=\"/path/to/file.crt\")\n" +"\n" +"urllib2.urlopen(\"https://invalid-cert\", context=context)" +msgstr "" + +#: whatsnew/2.7.rst:2736 msgid "PEP 493: HTTPS verification migration tools for Python 2.7" msgstr "" -#: whatsnew/2.7.rst:2744 +#: whatsnew/2.7.rst:2738 msgid "" ":pep:`493` provides additional migration tools to support a more incremental " "infrastructure upgrade process for environments containing applications and " @@ -3240,14 +3760,14 @@ msgid "" "were made in the Python 2.7.12 release." msgstr "" -#: whatsnew/2.7.rst:2750 +#: whatsnew/2.7.rst:2744 msgid "" "These tools are intended for use in cases where affected applications and " "services can't be modified to explicitly pass a more permissive SSL context " "when establishing the connection." msgstr "" -#: whatsnew/2.7.rst:2754 +#: whatsnew/2.7.rst:2748 msgid "" "For applications and services which can't be modified at all, the new " "``PYTHONHTTPSVERIFY`` environment variable may be set to ``0`` to revert an " @@ -3255,18 +3775,18 @@ msgid "" "2.7.8 and earlier." msgstr "" -#: whatsnew/2.7.rst:2759 +#: whatsnew/2.7.rst:2753 msgid "" "For cases where the connection establishment code can't be modified, but the " "overall application can be, the new :func:`!ssl._https_verify_certificates` " "function can be used to adjust the default behaviour at runtime." msgstr "" -#: whatsnew/2.7.rst:2765 +#: whatsnew/2.7.rst:2759 msgid "New ``make regen-all`` build target" msgstr "" -#: whatsnew/2.7.rst:2767 +#: whatsnew/2.7.rst:2761 msgid "" "To simplify cross-compilation, and to ensure that CPython can reliably be " "compiled without requiring an existing version of Python to already be " @@ -3274,43 +3794,43 @@ msgid "" "recompile generated files based on file modification times." msgstr "" -#: whatsnew/2.7.rst:2772 +#: whatsnew/2.7.rst:2766 msgid "" "Instead, a new ``make regen-all`` command has been added to force " "regeneration of these files when desired (e.g. after an initial version of " "Python has already been built based on the pregenerated versions)." msgstr "" -#: whatsnew/2.7.rst:2776 +#: whatsnew/2.7.rst:2770 msgid "" "More selective regeneration targets are also defined - see :source:`Makefile." "pre.in` for details." msgstr "" -#: whatsnew/2.7.rst:2792 +#: whatsnew/2.7.rst:2786 msgid "(Contributed by Victor Stinner in :issue:`23404`.)" msgstr "" -#: whatsnew/2.7.rst:2785 +#: whatsnew/2.7.rst:2779 msgid "Removal of ``make touch`` build target" msgstr "" -#: whatsnew/2.7.rst:2787 +#: whatsnew/2.7.rst:2781 msgid "" "The ``make touch`` build target previously used to request implicit " "regeneration of generated files by updating their modification times has " "been removed." msgstr "" -#: whatsnew/2.7.rst:2790 +#: whatsnew/2.7.rst:2784 msgid "It has been replaced by the new ``make regen-all`` target." msgstr "" -#: whatsnew/2.7.rst:2801 +#: whatsnew/2.7.rst:2795 msgid "Acknowledgements" msgstr "" -#: whatsnew/2.7.rst:2803 +#: whatsnew/2.7.rst:2797 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 82291fa9..2bd3d477 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -80,14 +81,40 @@ msgid "" "``print`` statement (:pep:`3105`). Examples::" msgstr "" +#: whatsnew/3.0.rst:101 +msgid "" +"Old: print \"The answer is\", 2*2\n" +"New: print(\"The answer is\", 2*2)\n" +"\n" +"Old: print x, # Trailing comma suppresses newline\n" +"New: print(x, end=\" \") # Appends a space instead of a newline\n" +"\n" +"Old: print # Prints a newline\n" +"New: print() # You must call the function!\n" +"\n" +"Old: print >>sys.stderr, \"fatal error\"\n" +"New: print(\"fatal error\", file=sys.stderr)\n" +"\n" +"Old: print (x, y) # prints repr((x, y))\n" +"New: print((x, y)) # Not the same as print(x, y)!" +msgstr "" + #: whatsnew/3.0.rst:116 msgid "You can also customize the separator between items, e.g.::" msgstr "" +#: whatsnew/3.0.rst:118 +msgid "print(\"There are <\", 2**32, \"> possibilities!\", sep=\"\")" +msgstr "" + #: whatsnew/3.0.rst:120 msgid "which produces:" msgstr "" +#: whatsnew/3.0.rst:122 +msgid "There are <4294967296> possibilities!" +msgstr "" + #: whatsnew/3.0.rst:126 msgid "Note:" msgstr "" @@ -131,7 +158,7 @@ msgstr "" #: whatsnew/3.0.rst:153 msgid "" -"Also, the :meth:`dict.iterkeys`, :meth:`dict.iteritems` and :meth:`dict." +"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!dict." "itervalues` methods are no longer supported." msgstr "" @@ -158,7 +185,7 @@ msgstr "" #: whatsnew/3.0.rst:173 msgid "" -":func:`range` now behaves like :func:`xrange` used to behave, except it " +":func:`range` now behaves like :func:`!xrange` used to behave, except it " "works with values of arbitrary size. The latter no longer exists." msgstr "" @@ -188,18 +215,19 @@ msgstr "" #: whatsnew/3.0.rst:195 msgid "" -":meth:`builtin.sorted` and :meth:`list.sort` no longer accept the *cmp* " -"argument providing a comparison function. Use the *key* argument instead. N." -"B. the *key* and *reverse* arguments are now \"keyword-only\"." +":meth:`sorted` and :meth:`list.sort` no longer accept the *cmp* argument " +"providing a comparison function. Use the *key* argument instead. N.B. the " +"*key* and *reverse* arguments are now \"keyword-only\"." msgstr "" #: whatsnew/3.0.rst:200 msgid "" -"The :func:`cmp` function should be treated as gone, and the :meth:`__cmp__` " -"special method is no longer supported. Use :meth:`__lt__` for sorting, :" -"meth:`__eq__` with :meth:`__hash__`, and other rich comparisons as needed. " -"(If you really need the :func:`cmp` functionality, you could use the " -"expression ``(a > b) - (a < b)`` as the equivalent for ``cmp(a, b)``.)" +"The :func:`!cmp` function should be treated as gone, and the :meth:`!" +"__cmp__` special method is no longer supported. Use :meth:`~object.__lt__` " +"for sorting, :meth:`~object.__eq__` with :meth:`~object.__hash__`, and other " +"rich comparisons as needed. (If you really need the :func:`!cmp` " +"functionality, you could use the expression ``(a > b) - (a < b)`` as the " +"equivalent for ``cmp(a, b)``.)" msgstr "" #: whatsnew/3.0.rst:207 @@ -208,9 +236,9 @@ msgstr "" #: whatsnew/3.0.rst:209 msgid "" -":pep:`237`: Essentially, :class:`long` renamed to :class:`int`. That is, " +":pep:`237`: Essentially, :class:`!long` renamed to :class:`int`. That is, " "there is only one built-in integral type, named :class:`int`; but it behaves " -"mostly like the old :class:`long` type." +"mostly like the old :class:`!long` type." msgstr "" #: whatsnew/3.0.rst:213 @@ -222,11 +250,11 @@ msgstr "" #: whatsnew/3.0.rst:217 msgid "" -"The :data:`sys.maxint` constant was removed, since there is no longer a " +"The :data:`!sys.maxint` constant was removed, since there is no longer a " "limit to the value of integers. However, :data:`sys.maxsize` can be used as " "an integer larger than any practical list or string index. It conforms to " "the implementation's \"natural\" integer size and is typically the same as :" -"data:`sys.maxint` in previous releases on the same platform (assuming the " +"data:`!sys.maxint` in previous releases on the same platform (assuming the " "same build options)." msgstr "" @@ -271,7 +299,7 @@ msgid "" "uses Unicode, encodings or binary data most likely has to change. The " "change is for the better, as in the 2.x world there were numerous bugs " "having to do with mixing encoded and unencoded text. To be prepared in " -"Python 2.x, start using :class:`unicode` for all unencoded text, and :class:" +"Python 2.x, start using :class:`!unicode` for all unencoded text, and :class:" "`str` for binary or encoded data only. Then the ``2to3`` tool will do most " "of the work for you." msgstr "" @@ -296,7 +324,8 @@ msgid "" "Like :class:`str`, the :class:`bytes` type is immutable. There is a " "separate *mutable* type to hold buffered binary data, :class:`bytearray`. " "Nearly all APIs that accept :class:`bytes` also accept :class:`bytearray`. " -"The mutable API is based on :class:`collections.MutableSequence`." +"The mutable API is based on :class:`collections.MutableSequence `." msgstr "" #: whatsnew/3.0.rst:274 @@ -311,10 +340,10 @@ msgstr "" #: whatsnew/3.0.rst:281 msgid "" -"The built-in :class:`basestring` abstract type was removed. Use :class:" +"The built-in :class:`!basestring` abstract type was removed. Use :class:" "`str` instead. The :class:`str` and :class:`bytes` types don't have " "functionality enough in common to warrant a shared base class. The ``2to3`` " -"tool (see below) replaces every occurrence of :class:`basestring` with :" +"tool (see below) replaces every occurrence of :class:`!basestring` with :" "class:`str`." msgstr "" @@ -416,9 +445,9 @@ msgid "" ":pep:`3107`: Function argument and return value annotations. This provides " "a standardized way of annotating a function's parameters and return value. " "There are no semantics attached to such annotations except that they can be " -"introspected at runtime using the :attr:`__annotations__` attribute. The " -"intent is to encourage experimentation through metaclasses, decorators or " -"frameworks." +"introspected at runtime using the :attr:`~object.__annotations__` " +"attribute. The intent is to encourage experimentation through metaclasses, " +"decorators or frameworks." msgstr "" #: whatsnew/3.0.rst:363 @@ -453,6 +482,10 @@ msgid "" "be any iterable. Example::" msgstr "" +#: whatsnew/3.0.rst:383 +msgid "(a, *rest, b) = range(5)" +msgstr "" + #: whatsnew/3.0.rst:385 msgid "This sets *a* to ``0``, *b* to ``4``, and *rest* to ``[1, 2, 3]``." msgstr "" @@ -521,13 +554,26 @@ msgstr "" msgid ":pep:`3115`: New Metaclass Syntax. Instead of::" msgstr "" +#: whatsnew/3.0.rst:422 +msgid "" +"class C:\n" +" __metaclass__ = M\n" +" ..." +msgstr "" + #: whatsnew/3.0.rst:426 msgid "you must now use::" msgstr "" +#: whatsnew/3.0.rst:428 +msgid "" +"class C(metaclass=M):\n" +" ..." +msgstr "" + #: whatsnew/3.0.rst:431 msgid "" -"The module-global :data:`__metaclass__` variable is no longer supported. " +"The module-global :data:`!__metaclass__` variable is no longer supported. " "(It was a crutch to make it easier to default to new-style classes without " "deriving every class from :class:`object`.)" msgstr "" @@ -671,15 +717,15 @@ msgid "" "and has additional keyword arguments *encoding*, *errors*, *newline* and " "*closefd*. Also note that an invalid *mode* argument now raises :exc:" "`ValueError`, not :exc:`IOError`. The binary file object underlying a text " -"file object can be accessed as :attr:`f.buffer` (but beware that the text " +"file object can be accessed as :attr:`!f.buffer` (but beware that the text " "object maintains a buffer of itself in order to speed up the encoding and " "decoding operations)." msgstr "" #: whatsnew/3.0.rst:529 msgid "" -":ref:`pep-3118`. The old builtin :func:`buffer` is now really gone; the new " -"builtin :func:`memoryview` provides (mostly) similar functionality." +":ref:`pep-3118`. The old builtin :func:`!buffer` is now really gone; the " +"new builtin :func:`memoryview` provides (mostly) similar functionality." msgstr "" #: whatsnew/3.0.rst:533 @@ -687,8 +733,9 @@ msgid "" ":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the :mod:" "`collections` module plays a somewhat more prominent role in the language " "now, and built-in collection types like :class:`dict` and :class:`list` " -"conform to the :class:`collections.MutableMapping` and :class:`collections." -"MutableSequence` ABCs, respectively." +"conform to the :class:`collections.MutableMapping ` and :class:`collections.MutableSequence ` ABCs, respectively." msgstr "" #: whatsnew/3.0.rst:539 @@ -855,10 +902,10 @@ msgstr "" #: whatsnew/3.0.rst:615 msgid "" -":mod:`tkinter` (all :mod:`Tkinter`-related modules except :mod:`turtle`). " -"The target audience of :mod:`turtle` doesn't really care about :mod:" -"`tkinter`. Also note that as of Python 2.6, the functionality of :mod:" -"`turtle` has been greatly enhanced." +":mod:`tkinter` (all ``Tkinter``-related modules except :mod:`turtle`). The " +"target audience of :mod:`turtle` doesn't really care about :mod:`tkinter`. " +"Also note that as of Python 2.6, the functionality of :mod:`turtle` has been " +"greatly enhanced." msgstr "" #: whatsnew/3.0.rst:620 @@ -884,23 +931,23 @@ msgstr "" #: whatsnew/3.0.rst:631 msgid "" -"Cleanup of the :mod:`sys` module: removed :func:`sys.exitfunc`, :func:`sys." -"exc_clear`, :data:`sys.exc_type`, :data:`sys.exc_value`, :data:`sys." +"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!sys." +"exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!sys." "exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" msgstr "" #: whatsnew/3.0.rst:636 msgid "" -"Cleanup of the :class:`array.array` type: the :meth:`read` and :meth:`write` " -"methods are gone; use :meth:`fromfile` and :meth:`tofile` instead. Also, " -"the ``'c'`` typecode for array is gone -- use either ``'b'`` for bytes or " -"``'u'`` for Unicode characters." +"Cleanup of the :class:`array.array` type: the :meth:`!read` and :meth:`!" +"write` methods are gone; use :meth:`~array.array.fromfile` and :meth:`~array." +"array.tofile` instead. Also, the ``'c'`` typecode for array is gone -- use " +"either ``'b'`` for bytes or ``'u'`` for Unicode characters." msgstr "" #: whatsnew/3.0.rst:642 msgid "" -"Cleanup of the :mod:`operator` module: removed :func:`sequenceIncludes` and :" -"func:`isCallable`." +"Cleanup of the :mod:`operator` module: removed :func:`!sequenceIncludes` " +"and :func:`!isCallable`." msgstr "" #: whatsnew/3.0.rst:645 @@ -911,7 +958,8 @@ msgid "" msgstr "" #: whatsnew/3.0.rst:649 -msgid "Cleanup of the :mod:`random` module: removed the :func:`jumpahead` API." +msgid "" +"Cleanup of the :mod:`random` module: removed the :func:`!jumpahead` API." msgstr "" #: whatsnew/3.0.rst:651 @@ -920,8 +968,8 @@ msgstr "" #: whatsnew/3.0.rst:653 msgid "" -"The functions :func:`os.tmpnam`, :func:`os.tempnam` and :func:`os.tmpfile` " -"have been removed in favor of the :mod:`tempfile` module." +"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!os." +"tmpfile` have been removed in favor of the :mod:`tempfile` module." msgstr "" #: whatsnew/3.0.rst:657 @@ -932,19 +980,19 @@ msgstr "" #: whatsnew/3.0.rst:661 msgid "" -":data:`string.letters` and its friends (:data:`string.lowercase` and :data:" -"`string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " -"instead. (The reason for the removal is that :data:`string.letters` and " +":data:`!string.letters` and its friends (:data:`!string.lowercase` and :data:" +"`!string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " +"instead. (The reason for the removal is that :data:`!string.letters` and " "friends had locale-specific behavior, which is a bad idea for such " "attractively named global \"constants\".)" msgstr "" #: whatsnew/3.0.rst:668 msgid "" -"Renamed module :mod:`__builtin__` to :mod:`builtins` (removing the " -"underscores, adding an 's'). The :data:`__builtins__` variable found in " +"Renamed module :mod:`!__builtin__` to :mod:`builtins` (removing the " +"underscores, adding an 's'). The :data:`!__builtins__` variable found in " "most global namespaces is unchanged. To modify a builtin, you should use :" -"mod:`builtins`, not :data:`__builtins__`!" +"mod:`builtins`, not :data:`!__builtins__`!" msgstr "" #: whatsnew/3.0.rst:675 @@ -989,13 +1037,13 @@ msgid "" msgstr "" #: whatsnew/3.0.rst:705 -msgid ":exc:`StandardError` was removed." +msgid ":exc:`!StandardError` was removed." msgstr "" #: whatsnew/3.0.rst:707 msgid "" -"Exceptions no longer behave as sequences. Use the :attr:`args` attribute " -"instead." +"Exceptions no longer behave as sequences. Use the :attr:`~BaseException." +"args` attribute instead." msgstr "" #: whatsnew/3.0.rst:710 @@ -1026,6 +1074,10 @@ msgid "" "exception. Explicit chaining is invoked with this syntax::" msgstr "" +#: whatsnew/3.0.rst:731 +msgid "raise SecondaryException() from primary_exception" +msgstr "" + #: whatsnew/3.0.rst:733 msgid "" "(where *primary_exception* is any expression that produces an exception " @@ -1077,10 +1129,10 @@ msgstr "" #: whatsnew/3.0.rst:768 msgid "" -":meth:`__getslice__`, :meth:`__setslice__` and :meth:`__delslice__` were " +":meth:`!__getslice__`, :meth:`!__setslice__` and :meth:`!__delslice__` were " "killed. The syntax ``a[i:j]`` now translates to ``a.__getitem__(slice(i, " -"j))`` (or :meth:`__setitem__` or :meth:`__delitem__`, when used as an " -"assignment or deletion target, respectively)." +"j))`` (or :meth:`~object.__setitem__` or :meth:`~object.__delitem__`, when " +"used as an assignment or deletion target, respectively)." msgstr "" #: whatsnew/3.0.rst:774 @@ -1091,13 +1143,13 @@ msgstr "" #: whatsnew/3.0.rst:777 msgid "" -"The :meth:`__oct__` and :meth:`__hex__` special methods are removed -- :func:" -"`oct` and :func:`hex` use :meth:`__index__` now to convert the argument to " -"an integer." +"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed -- :" +"func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert the " +"argument to an integer." msgstr "" #: whatsnew/3.0.rst:781 -msgid "Removed support for :attr:`__members__` and :attr:`__methods__`." +msgid "Removed support for :attr:`!__members__` and :attr:`!__methods__`." msgstr "" #: whatsnew/3.0.rst:783 @@ -1131,7 +1183,7 @@ msgstr "" #: whatsnew/3.0.rst:805 msgid "" -":pep:`3111`: :func:`raw_input` was renamed to :func:`input`. That is, the " +":pep:`3111`: :func:`!raw_input` was renamed to :func:`input`. That is, the " "new :func:`input` function reads a line from :data:`sys.stdin` and returns " "it with the trailing newline stripped. It raises :exc:`EOFError` if the " "input is terminated prematurely. To get the old behavior of :func:`input`, " @@ -1156,53 +1208,53 @@ msgid "" msgstr "" #: whatsnew/3.0.rst:823 -msgid "Moved :func:`intern` to :func:`sys.intern`." +msgid "Moved :func:`!intern` to :func:`sys.intern`." msgstr "" #: whatsnew/3.0.rst:825 msgid "" -"Removed: :func:`apply`. Instead of ``apply(f, args)`` use ``f(*args)``." +"Removed: :func:`!apply`. Instead of ``apply(f, args)`` use ``f(*args)``." msgstr "" #: whatsnew/3.0.rst:828 msgid "" "Removed :func:`callable`. Instead of ``callable(f)`` you can use " -"``isinstance(f, collections.Callable)``. The :func:`operator.isCallable` " +"``isinstance(f, collections.Callable)``. The :func:`!operator.isCallable` " "function is also gone." msgstr "" #: whatsnew/3.0.rst:832 msgid "" -"Removed :func:`coerce`. This function no longer serves a purpose now that " +"Removed :func:`!coerce`. This function no longer serves a purpose now that " "classic classes are gone." msgstr "" #: whatsnew/3.0.rst:835 msgid "" -"Removed :func:`execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." +"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." "read())``." msgstr "" #: whatsnew/3.0.rst:838 msgid "" -"Removed the :class:`file` type. Use :func:`open`. There are now several " +"Removed the :class:`!file` type. Use :func:`open`. There are now several " "different kinds of streams that open can return in the :mod:`io` module." msgstr "" #: whatsnew/3.0.rst:841 msgid "" -"Removed :func:`reduce`. Use :func:`functools.reduce` if you really need it; " -"however, 99 percent of the time an explicit :keyword:`for` loop is more " +"Removed :func:`!reduce`. Use :func:`functools.reduce` if you really need " +"it; however, 99 percent of the time an explicit :keyword:`for` loop is more " "readable." msgstr "" #: whatsnew/3.0.rst:845 -msgid "Removed :func:`reload`. Use :func:`!imp.reload`." +msgid "Removed :func:`!reload`. Use :func:`!imp.reload`." msgstr "" #: whatsnew/3.0.rst:847 msgid "" -"Removed. :meth:`dict.has_key` -- use the :keyword:`in` operator instead." +"Removed. :meth:`!dict.has_key` -- use the :keyword:`in` operator instead." msgstr "" #: whatsnew/3.0.rst:854 @@ -1305,9 +1357,8 @@ msgstr "" #: whatsnew/3.0.rst:915 msgid "" "Run the ``2to3`` source-to-source translator over your source code tree. " -"(See :ref:`2to3-reference` for more on this tool.) Run the result of the " -"translation under Python 3.0. Manually fix up any remaining issues, fixing " -"problems until all tests pass again." +"Run the result of the translation under Python 3.0. Manually fix up any " +"remaining issues, fixing problems until all tests pass again." msgstr "" #: whatsnew/3.0.rst:920 diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index 257b1009..3cc2c50c 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,7 +32,7 @@ msgstr "" #: whatsnew/3.1.rst:49 msgid "" "This article explains the new features in Python 3.1, compared to 3.0. " -"Python 3.1 was released on June 27, 2009." +"Python 3.1 was released on June 27, 2009." msgstr "" #: whatsnew/3.1.rst:54 @@ -69,7 +70,7 @@ msgid "" "`_." msgstr "" -#: whatsnew/3.1.rst:80 +#: whatsnew/3.1.rst:79 msgid ":pep:`372` - Ordered Dictionaries" msgstr "" @@ -85,6 +86,24 @@ msgid "" "conjunction with sorting to make a sorted dictionary::" msgstr "" +#: whatsnew/3.1.rst:86 +msgid "" +">>> # regular unsorted dictionary\n" +">>> d = {'banana': 3, 'apple':4, 'pear': 1, 'orange': 2}\n" +"\n" +">>> # dictionary sorted by key\n" +">>> OrderedDict(sorted(d.items(), key=lambda t: t[0]))\n" +"OrderedDict([('apple', 4), ('banana', 3), ('orange', 2), ('pear', 1)])\n" +"\n" +">>> # dictionary sorted by value\n" +">>> OrderedDict(sorted(d.items(), key=lambda t: t[1]))\n" +"OrderedDict([('pear', 1), ('orange', 2), ('banana', 3), ('apple', 4)])\n" +"\n" +">>> # dictionary sorted by length of the key string\n" +">>> OrderedDict(sorted(d.items(), key=lambda t: len(t[0])))\n" +"OrderedDict([('pear', 1), ('apple', 4), ('orange', 2), ('banana', 3)])" +msgstr "" + #: whatsnew/3.1.rst:101 msgid "" "The new sorted dictionaries maintain their sort order when entries are " @@ -104,6 +123,18 @@ msgid "" "program's output, improving its professional appearance and readability::" msgstr "" +#: whatsnew/3.1.rst:114 +msgid "" +">>> format(1234567, ',d')\n" +"'1,234,567'\n" +">>> format(1234567.89, ',.2f')\n" +"'1,234,567.89'\n" +">>> format(12345.6 + 8901234.12j, ',f')\n" +"'12,345.600000+8,901,234.120000j'\n" +">>> format(Decimal('1234567.89'), ',f')\n" +"'1,234,567.89'" +msgstr "" + #: whatsnew/3.1.rst:123 msgid "" "The supported types are :class:`int`, :class:`float`, :class:`complex` and :" @@ -118,7 +149,7 @@ msgid "" "thousands separators." msgstr "" -#: whatsnew/3.1.rst:134 +#: whatsnew/3.1.rst:133 msgid ":pep:`378` - Format Specifier for Thousands Separator" msgstr "" @@ -151,6 +182,20 @@ msgid "" "of bits necessary to represent its argument in binary::" msgstr "" +#: whatsnew/3.1.rst:152 +msgid "" +">>> n = 37\n" +">>> bin(37)\n" +"'0b100101'\n" +">>> n.bit_length()\n" +"6\n" +">>> n = 2**123-1\n" +">>> n.bit_length()\n" +"123\n" +">>> (n+1).bit_length()\n" +"124" +msgstr "" + #: whatsnew/3.1.rst:163 msgid "" "(Contributed by Fredrik Johansson, Victor Stinner, Raymond Hettinger, and " @@ -162,6 +207,12 @@ msgid "" "The fields in :func:`format` strings can now be automatically numbered::" msgstr "" +#: whatsnew/3.1.rst:169 +msgid "" +">>> 'Sir {} of {}'.format('Gallahad', 'Camelot')\n" +"'Sir Gallahad of Camelot'" +msgstr "" + #: whatsnew/3.1.rst:172 msgid "" "Formerly, the string would have required numbered fields such as: ``'Sir {0} " @@ -192,6 +243,14 @@ msgid "" "managers in a single statement::" msgstr "" +#: whatsnew/3.1.rst:189 +msgid "" +">>> with open('mylog.txt') as infile, open('a.out', 'w') as outfile:\n" +"... for line in infile:\n" +"... if '' in line:\n" +"... outfile.write(line)" +msgstr "" + #: whatsnew/3.1.rst:194 msgid "" "With the new syntax, the :func:`!contextlib.nested` function is no longer " @@ -210,15 +269,21 @@ msgid "" "returned a float::" msgstr "" +#: whatsnew/3.1.rst:203 +msgid "" +">>> round(1123, -2)\n" +"1100" +msgstr "" + #: whatsnew/3.1.rst:206 msgid "(Contributed by Mark Dickinson; :issue:`4707`.)" msgstr "" #: whatsnew/3.1.rst:208 msgid "" -"Python now uses David Gay's algorithm for finding the shortest floating " +"Python now uses David Gay's algorithm for finding the shortest floating-" "point representation that doesn't change its value. This should help " -"mitigate some of the confusion surrounding binary floating point numbers." +"mitigate some of the confusion surrounding binary floating-point numbers." msgstr "" #: whatsnew/3.1.rst:213 @@ -228,7 +293,7 @@ msgid "" "equivalent, an expression like ``float('1.1')`` evaluates to the nearest " "representable value which is ``0x1.199999999999ap+0`` in hex or " "``1.100000000000000088817841970012523233890533447265625`` in decimal. That " -"nearest value was and still is used in subsequent floating point " +"nearest value was and still is used in subsequent floating-point " "calculations." msgstr "" @@ -240,7 +305,7 @@ msgid "" "using 17 digits was that it relied on IEEE-754 guarantees to assure that " "``eval(repr(1.1))`` would round-trip exactly to its original value. The " "disadvantage is that many people found the output to be confusing (mistaking " -"intrinsic limitations of binary floating point representation as being a " +"intrinsic limitations of binary floating-point representation as being a " "problem with Python itself)." msgstr "" @@ -261,7 +326,7 @@ msgstr "" #: whatsnew/3.1.rst:239 msgid "" -"The new algorithm depends on certain features in the underlying floating " +"The new algorithm depends on certain features in the underlying floating-" "point implementation. If the required features are not found, the old " "algorithm will continue to be used. Also, the text pickle protocols assure " "cross-platform portability by using the old algorithm." @@ -281,6 +346,12 @@ msgid "" "unique items in a sequence or iterable::" msgstr "" +#: whatsnew/3.1.rst:252 +msgid "" +">>> Counter(['red', 'blue', 'red', 'green', 'blue', 'blue'])\n" +"Counter({'blue': 3, 'red': 2, 'green': 1})" +msgstr "" + #: whatsnew/3.1.rst:255 msgid "(Contributed by Raymond Hettinger; :issue:`1696199`.)" msgstr "" @@ -302,6 +373,13 @@ msgid "" "context management protocol::" msgstr "" +#: whatsnew/3.1.rst:266 +msgid "" +">>> # Automatically close file after writing\n" +">>> with gzip.GzipFile(filename, \"wb\") as f:\n" +"... f.write(b\"xxx\")" +msgstr "" + #: whatsnew/3.1.rst:270 msgid "(Contributed by Antoine Pitrou.)" msgstr "" @@ -313,6 +391,12 @@ msgid "" "surprising::" msgstr "" +#: whatsnew/3.1.rst:276 +msgid "" +">>> Decimal.from_float(1.1)\n" +"Decimal('1.100000000000000088817841970012523233890533447265625')" +msgstr "" + #: whatsnew/3.1.rst:279 msgid "" "The long decimal result shows the actual binary fraction being stored for " @@ -335,6 +419,19 @@ msgid "" "`fractions.Fraction` and :class:`decimal.Decimal`::" msgstr "" +#: whatsnew/3.1.rst:294 +msgid "" +">>> [p+q for p,q in combinations_with_replacement('LOVE', 2)]\n" +"['LL', 'LO', 'LV', 'LE', 'OO', 'OV', 'OE', 'VV', 'VE', 'EE']\n" +"\n" +">>> list(compress(data=range(10), selectors=[0,0,1,1,0,1,0,1,0,0]))\n" +"[2, 3, 5, 7]\n" +"\n" +">>> c = count(start=Fraction(1,2), step=Fraction(1,6))\n" +">>> [next(c), next(c), next(c), next(c)]\n" +"[Fraction(1, 2), Fraction(2, 3), Fraction(5, 6), Fraction(1, 1)]" +msgstr "" + #: whatsnew/3.1.rst:304 msgid "(Contributed by Raymond Hettinger.)" msgstr "" @@ -348,6 +445,20 @@ msgid "" "input::" msgstr "" +#: whatsnew/3.1.rst:312 +msgid "" +">>> query = input()\n" +"SELECT region, dept, count(*) FROM main GROUPBY region, dept\n" +"\n" +">>> cursor.execute(query)\n" +">>> query_fields = [desc[0] for desc in cursor.description]\n" +">>> UserQuery = namedtuple('UserQuery', query_fields, rename=True)\n" +">>> pprint.pprint([UserQuery(*row) for row in cursor])\n" +"[UserQuery(region='South', dept='Shipping', _2=185),\n" +" UserQuery(region='North', dept='Accounting', _2=37),\n" +" UserQuery(region='West', dept='Sales', _2=419)]" +msgstr "" + #: whatsnew/3.1.rst:323 msgid "(Contributed by Raymond Hettinger; :issue:`1818`.)" msgstr "" @@ -370,6 +481,12 @@ msgid "" "spurious warnings such as \"No handlers could be found for logger foo\"::" msgstr "" +#: whatsnew/3.1.rst:335 +msgid "" +">>> h = logging.NullHandler()\n" +">>> logging.getLogger(\"foo\").addHandler(h)" +msgstr "" + #: whatsnew/3.1.rst:338 msgid "(Contributed by Vinay Sajip; :issue:`4384`)." msgstr "" @@ -423,12 +540,33 @@ msgid "" "TestResult::" msgstr "" +#: whatsnew/3.1.rst:366 +msgid "" +"class TestGizmo(unittest.TestCase):\n" +"\n" +" @unittest.skipUnless(sys.platform.startswith(\"win\"), \"requires " +"Windows\")\n" +" def test_gizmo_on_windows(self):\n" +" ...\n" +"\n" +" @unittest.expectedFailure\n" +" def test_gimzo_without_required_library(self):\n" +" ..." +msgstr "" + #: whatsnew/3.1.rst:376 msgid "" "Also, tests for exceptions have been builtout to work with context managers " "using the :keyword:`with` statement::" msgstr "" +#: whatsnew/3.1.rst:379 +msgid "" +"def test_division_by_zero(self):\n" +" with self.assertRaises(ZeroDivisionError):\n" +" x / 0" +msgstr "" + #: whatsnew/3.1.rst:383 msgid "" "In addition, several new assertion methods were added including :meth:" @@ -454,12 +592,18 @@ msgstr "" msgid "The :data:`sys.version_info` tuple is now a named tuple::" msgstr "" +#: whatsnew/3.1.rst:401 +msgid "" +">>> sys.version_info\n" +"sys.version_info(major=3, minor=1, micro=0, releaselevel='alpha', serial=2)" +msgstr "" + #: whatsnew/3.1.rst:404 msgid "(Contributed by Ross Light; :issue:`4285`.)" msgstr "" #: whatsnew/3.1.rst:406 -msgid "The :mod:`nntplib` and :mod:`imaplib` modules now support IPv6." +msgid "The :mod:`!nntplib` and :mod:`imaplib` modules now support IPv6." msgstr "" #: whatsnew/3.1.rst:408 @@ -479,6 +623,15 @@ msgid "" "*fix_imports* option::" msgstr "" +#: whatsnew/3.1.rst:420 +msgid "" +">>> s = {1, 2, 3}\n" +">>> pickle.dumps(s, protocol=0)\n" +"b'c__builtin__\\nset\\np0\\n((lp1\\nL1L\\naL2L\\naL3L\\natp2\\nRp3\\n.'\n" +">>> pickle.dumps(s, protocol=0, fix_imports=False)\n" +"b'cbuiltins\\nset\\np0\\n((lp1\\nL1L\\naL2L\\naL3L\\natp2\\nRp3\\n.'" +msgstr "" + #: whatsnew/3.1.rst:426 msgid "" "An unfortunate but unavoidable side-effect of this change is that protocol 2 " @@ -631,6 +784,13 @@ msgid "" "type used to store each digit::" msgstr "" +#: whatsnew/3.1.rst:519 +msgid "" +">>> import sys\n" +">>> sys.int_info\n" +"sys.int_info(bits_per_digit=30, sizeof_digit=4)" +msgstr "" + #: whatsnew/3.1.rst:523 msgid "(Contributed by Mark Dickinson; :issue:`4258`.)" msgstr "" @@ -690,10 +850,33 @@ msgstr "" #: whatsnew/3.1.rst:553 msgid "" -"The new floating point string representations can break existing doctests. " +"The new floating-point string representations can break existing doctests. " "For example::" msgstr "" +#: whatsnew/3.1.rst:556 +msgid "" +"def e():\n" +" '''Compute the base of natural logarithms.\n" +"\n" +" >>> e()\n" +" 2.7182818284590451\n" +"\n" +" '''\n" +" return sum(1/math.factorial(x) for x in reversed(range(30)))\n" +"\n" +"doctest.testmod()\n" +"\n" +"**********************************************************************\n" +"Failed example:\n" +" e()\n" +"Expected:\n" +" 2.7182818284590451\n" +"Got:\n" +" 2.718281828459045\n" +"**********************************************************************" +msgstr "" + #: whatsnew/3.1.rst:576 msgid "" "The automatic name remapping in the pickle module for protocol 2 or lower " diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 8913ca30..4a626c4a 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -122,7 +123,7 @@ msgstr "" msgid ":pep:`597`, Add optional EncodingWarning" msgstr "" -#: whatsnew/3.10.rst:2053 +#: whatsnew/3.10.rst:2054 msgid "New Features" msgstr "" @@ -139,11 +140,47 @@ msgid "" "valid:" msgstr "" +#: whatsnew/3.10.rst:105 +msgid "" +"with (CtxManager() as example):\n" +" ...\n" +"\n" +"with (\n" +" CtxManager1(),\n" +" CtxManager2()\n" +"):\n" +" ...\n" +"\n" +"with (CtxManager1() as example,\n" +" CtxManager2()):\n" +" ...\n" +"\n" +"with (CtxManager1(),\n" +" CtxManager2() as example):\n" +" ...\n" +"\n" +"with (\n" +" CtxManager1() as example1,\n" +" CtxManager2() as example2\n" +"):\n" +" ..." +msgstr "" + #: whatsnew/3.10.rst:130 msgid "" "it is also possible to use a trailing comma at the end of the enclosed group:" msgstr "" +#: whatsnew/3.10.rst:133 +msgid "" +"with (\n" +" CtxManager1() as example1,\n" +" CtxManager2() as example2,\n" +" CtxManager3() as example3,\n" +"):\n" +" ..." +msgstr "" + #: whatsnew/3.10.rst:142 msgid "" "This new syntax uses the non LL(1) capacities of the new parser. Check :pep:" @@ -173,16 +210,39 @@ msgid "" "code (notice the unclosed '{'):" msgstr "" +#: whatsnew/3.10.rst:160 +msgid "" +"expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n" +" 38: 4, 39: 4, 45: 5, 46: 5, 47: 5, 48: 5, 49: 5, 54: 6,\n" +"some_other_code = foo()" +msgstr "" + #: whatsnew/3.10.rst:166 msgid "" "Previous versions of the interpreter reported confusing places as the " "location of the syntax error:" msgstr "" +#: whatsnew/3.10.rst:169 +msgid "" +"File \"example.py\", line 3\n" +" some_other_code = foo()\n" +" ^\n" +"SyntaxError: invalid syntax" +msgstr "" + #: whatsnew/3.10.rst:176 msgid "but in Python 3.10 a more informative error is emitted:" msgstr "" +#: whatsnew/3.10.rst:178 +msgid "" +"File \"example.py\", line 1\n" +" expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n" +" ^\n" +"SyntaxError: '{' was never closed" +msgstr "" + #: whatsnew/3.10.rst:186 msgid "" "In a similar way, errors involving unclosed string literals (single and " @@ -209,10 +269,28 @@ msgid "" "of displaying (before Python 3.10):" msgstr "" +#: whatsnew/3.10.rst:199 +msgid "" +">>> foo(x, z for z in range(10), t, w)\n" +" File \"\", line 1\n" +" foo(x, z for z in range(10), t, w)\n" +" ^\n" +"SyntaxError: Generator expression must be parenthesized" +msgstr "" + #: whatsnew/3.10.rst:207 msgid "now Python 3.10 will display the exception as:" msgstr "" +#: whatsnew/3.10.rst:209 +msgid "" +">>> foo(x, z for z in range(10), t, w)\n" +" File \"\", line 1\n" +" foo(x, z for z in range(10), t, w)\n" +" ^^^^^^^^^^^^^^^^^^^^\n" +"SyntaxError: Generator expression must be parenthesized" +msgstr "" + #: whatsnew/3.10.rst:217 msgid "This improvement was contributed by Pablo Galindo in :issue:`43914`." msgstr "" @@ -228,6 +306,15 @@ msgstr "" msgid "Missing ``:`` before blocks:" msgstr "" +#: whatsnew/3.10.rst:224 +msgid "" +">>> if rocket.position > event_horizon\n" +" File \"\", line 1\n" +" if rocket.position > event_horizon\n" +" ^\n" +"SyntaxError: expected ':'" +msgstr "" + #: whatsnew/3.10.rst:232 msgid "(Contributed by Pablo Galindo in :issue:`42997`.)" msgstr "" @@ -236,6 +323,15 @@ msgstr "" msgid "Unparenthesised tuples in comprehensions targets:" msgstr "" +#: whatsnew/3.10.rst:236 +msgid "" +">>> {x,y for x,y in zip('abcd', '1234')}\n" +" File \"\", line 1\n" +" {x,y for x,y in zip('abcd', '1234')}\n" +" ^\n" +"SyntaxError: did you forget parentheses around the comprehension target?" +msgstr "" + #: whatsnew/3.10.rst:244 msgid "(Contributed by Pablo Galindo in :issue:`43017`.)" msgstr "" @@ -244,6 +340,18 @@ msgstr "" msgid "Missing commas in collection literals and between expressions:" msgstr "" +#: whatsnew/3.10.rst:248 +msgid "" +">>> items = {\n" +"... x: 1,\n" +"... y: 2\n" +"... z: 3,\n" +" File \"\", line 3\n" +" y: 2\n" +" ^\n" +"SyntaxError: invalid syntax. Perhaps you forgot a comma?" +msgstr "" + #: whatsnew/3.10.rst:259 msgid "(Contributed by Pablo Galindo in :issue:`43822`.)" msgstr "" @@ -252,6 +360,17 @@ msgstr "" msgid "Multiple Exception types without parentheses:" msgstr "" +#: whatsnew/3.10.rst:263 +msgid "" +">>> try:\n" +"... build_dyson_sphere()\n" +"... except NotEnoughScienceError, NotEnoughResourcesError:\n" +" File \"\", line 3\n" +" except NotEnoughScienceError, NotEnoughResourcesError:\n" +" ^\n" +"SyntaxError: multiple exception types must be parenthesized" +msgstr "" + #: whatsnew/3.10.rst:273 msgid "(Contributed by Pablo Galindo in :issue:`43149`.)" msgstr "" @@ -260,6 +379,25 @@ msgstr "" msgid "Missing ``:`` and values in dictionary literals:" msgstr "" +#: whatsnew/3.10.rst:277 +msgid "" +">>> values = {\n" +"... x: 1,\n" +"... y: 2,\n" +"... z:\n" +"... }\n" +" File \"\", line 4\n" +" z:\n" +" ^\n" +"SyntaxError: expression expected after dictionary key and ':'\n" +"\n" +">>> values = {x:1, y:2, z w:3}\n" +" File \"\", line 1\n" +" values = {x:1, y:2, z w:3}\n" +" ^\n" +"SyntaxError: ':' expected after dictionary key" +msgstr "" + #: whatsnew/3.10.rst:295 msgid "(Contributed by Pablo Galindo in :issue:`43823`.)" msgstr "" @@ -268,6 +406,17 @@ msgstr "" msgid "``try`` blocks without ``except`` or ``finally`` blocks:" msgstr "" +#: whatsnew/3.10.rst:299 +msgid "" +">>> try:\n" +"... x = 2\n" +"... something = 3\n" +" File \"\", line 3\n" +" something = 3\n" +" ^^^^^^^^^\n" +"SyntaxError: expected 'except' or 'finally' block" +msgstr "" + #: whatsnew/3.10.rst:309 msgid "(Contributed by Pablo Galindo in :issue:`44305`.)" msgstr "" @@ -276,6 +425,16 @@ msgstr "" msgid "Usage of ``=`` instead of ``==`` in comparisons:" msgstr "" +#: whatsnew/3.10.rst:313 +msgid "" +">>> if rocket.position = event_horizon:\n" +" File \"\", line 1\n" +" if rocket.position = event_horizon:\n" +" ^\n" +"SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead " +"of '='?" +msgstr "" + #: whatsnew/3.10.rst:321 msgid "(Contributed by Pablo Galindo in :issue:`43797`.)" msgstr "" @@ -284,6 +443,15 @@ msgstr "" msgid "Usage of ``*`` in f-strings:" msgstr "" +#: whatsnew/3.10.rst:325 +msgid "" +">>> f\"Black holes {*all_black_holes} and revelations\"\n" +" File \"\", line 1\n" +" (*all_black_holes)\n" +" ^\n" +"SyntaxError: f-string: cannot use starred expression here" +msgstr "" + #: whatsnew/3.10.rst:333 msgid "(Contributed by Pablo Galindo in :issue:`41064`.)" msgstr "" @@ -299,24 +467,44 @@ msgid "" "statement:" msgstr "" +#: whatsnew/3.10.rst:341 +msgid "" +">>> def foo():\n" +"... if lel:\n" +"... x = 2\n" +" File \"\", line 3\n" +" x = 2\n" +" ^\n" +"IndentationError: expected an indented block after 'if' statement in line 2" +msgstr "" + #: whatsnew/3.10.rst:353 msgid "AttributeErrors" msgstr "" #: whatsnew/3.10.rst:355 msgid "" -"When printing :exc:`AttributeError`, :c:func:`PyErr_Display` will offer " +"When printing :exc:`AttributeError`, :c:func:`!PyErr_Display` will offer " "suggestions of similar attribute names in the object that the exception was " "raised from:" msgstr "" +#: whatsnew/3.10.rst:359 +msgid "" +">>> collections.namedtoplo\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you " +"mean: namedtuple?" +msgstr "" + #: whatsnew/3.10.rst:388 msgid "(Contributed by Pablo Galindo in :issue:`38530`.)" msgstr "" #: whatsnew/3.10.rst:369 msgid "" -"Notice this won't work if :c:func:`PyErr_Display` is not called to display " +"Notice this won't work if :c:func:`!PyErr_Display` is not called to display " "the error which can happen if some other custom error display function is " "used. This is a common scenario in some REPLs like IPython." msgstr "" @@ -327,14 +515,24 @@ msgstr "" #: whatsnew/3.10.rst:376 msgid "" -"When printing :exc:`NameError` raised by the interpreter, :c:func:" -"`PyErr_Display` will offer suggestions of similar variable names in the " +"When printing :exc:`NameError` raised by the interpreter, :c:func:`!" +"PyErr_Display` will offer suggestions of similar variable names in the " "function that the exception was raised from:" msgstr "" +#: whatsnew/3.10.rst:380 +msgid "" +">>> schwarzschild_black_hole = None\n" +">>> schwarschild_black_hole\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"NameError: name 'schwarschild_black_hole' is not defined. Did you mean: " +"schwarzschild_black_hole?" +msgstr "" + #: whatsnew/3.10.rst:391 msgid "" -"Notice this won't work if :c:func:`PyErr_Display` is not called to display " +"Notice this won't work if :c:func:`!PyErr_Display` is not called to display " "the error, which can happen if some other custom error display function is " "used. This is a common scenario in some REPLs like IPython." msgstr "" @@ -387,6 +585,19 @@ msgstr "" msgid "The generic syntax of pattern matching is::" msgstr "" +#: whatsnew/3.10.rst:426 +msgid "" +"match subject:\n" +" case :\n" +" \n" +" case :\n" +" \n" +" case :\n" +" \n" +" case _:\n" +" " +msgstr "" + #: whatsnew/3.10.rst:436 msgid "" "A match statement takes an expression and compares its value to successive " @@ -466,6 +677,20 @@ msgid "" "status codes. The associated action to the case is executed after a match::" msgstr "" +#: whatsnew/3.10.rst:481 +msgid "" +"def http_error(status):\n" +" match status:\n" +" case 400:\n" +" return \"Bad request\"\n" +" case 404:\n" +" return \"Not found\"\n" +" case 418:\n" +" return \"I'm a teapot\"\n" +" case _:\n" +" return \"Something's wrong with the internet\"" +msgstr "" + #: whatsnew/3.10.rst:492 msgid "" "If the above function is passed a ``status`` of 418, \"I'm a teapot\" is " @@ -481,6 +706,12 @@ msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "" +#: whatsnew/3.10.rst:501 +msgid "" +"case 401 | 403 | 404:\n" +" return \"Not allowed\"" +msgstr "" + #: whatsnew/3.10.rst:505 msgid "Behavior without the wildcard" msgstr "" @@ -491,6 +722,18 @@ msgid "" "becomes::" msgstr "" +#: whatsnew/3.10.rst:510 +msgid "" +"def http_error(status):\n" +" match status:\n" +" case 400:\n" +" return \"Bad request\"\n" +" case 404:\n" +" return \"Not found\"\n" +" case 418:\n" +" return \"I'm a teapot\"" +msgstr "" + #: whatsnew/3.10.rst:519 msgid "" "Without the use of ``_`` in a case statement, a match may not exist. If no " @@ -509,6 +752,22 @@ msgid "" "coordinate and y-coordinate::" msgstr "" +#: whatsnew/3.10.rst:530 +msgid "" +"# point is an (x, y) tuple\n" +"match point:\n" +" case (0, 0):\n" +" print(\"Origin\")\n" +" case (0, y):\n" +" print(f\"Y={y}\")\n" +" case (x, 0):\n" +" print(f\"X={x}\")\n" +" case (x, y):\n" +" print(f\"X={x}, Y={y}\")\n" +" case _:\n" +" raise ValueError(\"Not a point\")" +msgstr "" + #: whatsnew/3.10.rst:543 msgid "" "The first pattern has two literals, ``(0, 0)``, and may be thought of as an " @@ -526,14 +785,35 @@ msgstr "" msgid "" "If you are using classes to structure your data, you can use as a pattern " "the class name followed by an argument list resembling a constructor. This " -"pattern has the ability to capture class attributes into variables::" -msgstr "" - -#: whatsnew/3.10.rst:574 +"pattern has the ability to capture instance attributes into variables::" +msgstr "" + +#: whatsnew/3.10.rst:556 +msgid "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y\n" +"\n" +"def location(point):\n" +" match point:\n" +" case Point(x=0, y=0):\n" +" print(\"Origin is the point's location.\")\n" +" case Point(x=0, y=y):\n" +" print(f\"Y={y} and the point is on the y-axis.\")\n" +" case Point(x=x, y=0):\n" +" print(f\"X={x} and the point is on the x-axis.\")\n" +" case Point():\n" +" print(\"The point is located somewhere else on the plane.\")\n" +" case _:\n" +" print(\"Not a point\")" +msgstr "" + +#: whatsnew/3.10.rst:575 msgid "Patterns with positional parameters" msgstr "" -#: whatsnew/3.10.rst:576 +#: whatsnew/3.10.rst:577 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -543,53 +823,94 @@ msgid "" "attribute to the ``var`` variable)::" msgstr "" -#: whatsnew/3.10.rst:588 +#: whatsnew/3.10.rst:583 +msgid "" +"Point(1, var)\n" +"Point(1, y=var)\n" +"Point(x=1, y=var)\n" +"Point(y=var, x=1)" +msgstr "" + +#: whatsnew/3.10.rst:589 msgid "Nested patterns" msgstr "" -#: whatsnew/3.10.rst:590 +#: whatsnew/3.10.rst:591 msgid "" "Patterns can be arbitrarily nested. For example, if our data is a short " "list of points, it could be matched like this::" msgstr "" -#: whatsnew/3.10.rst:606 +#: whatsnew/3.10.rst:594 +msgid "" +"match points:\n" +" case []:\n" +" print(\"No points in the list.\")\n" +" case [Point(0, 0)]:\n" +" print(\"The origin is the only point in the list.\")\n" +" case [Point(x, y)]:\n" +" print(f\"A single point {x}, {y} is in the list.\")\n" +" case [Point(0, y1), Point(0, y2)]:\n" +" print(f\"Two points on the Y axis at {y1}, {y2} are in the list.\")\n" +" case _:\n" +" print(\"Something else is found in the list.\")" +msgstr "" + +#: whatsnew/3.10.rst:607 msgid "Complex patterns and the wildcard" msgstr "" -#: whatsnew/3.10.rst:608 +#: whatsnew/3.10.rst:609 msgid "" "To this point, the examples have used ``_`` alone in the last case " "statement. A wildcard can be used in more complex patterns, such as " "``('error', code, _)``. For example::" msgstr "" -#: whatsnew/3.10.rst:618 +#: whatsnew/3.10.rst:613 +msgid "" +"match test_variable:\n" +" case ('warning', code, 40):\n" +" print(\"A warning has been received.\")\n" +" case ('error', code, _):\n" +" print(f\"An error {code} occurred.\")" +msgstr "" + +#: whatsnew/3.10.rst:619 msgid "" "In the above case, ``test_variable`` will match for ('error', code, 100) and " "('error', code, 800)." msgstr "" -#: whatsnew/3.10.rst:622 +#: whatsnew/3.10.rst:623 msgid "Guard" msgstr "" -#: whatsnew/3.10.rst:624 +#: whatsnew/3.10.rst:625 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " "value capture happens before the guard is evaluated::" msgstr "" -#: whatsnew/3.10.rst:635 +#: whatsnew/3.10.rst:629 +msgid "" +"match point:\n" +" case Point(x, y) if x == y:\n" +" print(f\"The point is located on the diagonal Y=X at {x}.\")\n" +" case Point(x, y):\n" +" print(f\"Point is not on the diagonal.\")" +msgstr "" + +#: whatsnew/3.10.rst:636 msgid "Other Key Features" msgstr "" -#: whatsnew/3.10.rst:637 +#: whatsnew/3.10.rst:638 msgid "Several other key features:" msgstr "" -#: whatsnew/3.10.rst:639 +#: whatsnew/3.10.rst:640 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. Technically, the subject " @@ -598,7 +919,7 @@ msgid "" "match strings." msgstr "" -#: whatsnew/3.10.rst:645 +#: whatsnew/3.10.rst:646 msgid "" "Sequence patterns support wildcards: ``[x, y, *rest]`` and ``(x, y, *rest)`` " "work similar to wildcards in unpacking assignments. The name after ``*`` " @@ -606,7 +927,7 @@ msgid "" "items without binding the remaining items." msgstr "" -#: whatsnew/3.10.rst:650 +#: whatsnew/3.10.rst:651 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dict. Unlike sequence " @@ -614,122 +935,169 @@ msgid "" "(But ``**_`` would be redundant, so is not allowed.)" msgstr "" -#: whatsnew/3.10.rst:655 +#: whatsnew/3.10.rst:656 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "" -#: whatsnew/3.10.rst:659 +#: whatsnew/3.10.rst:658 +msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." +msgstr "" + +#: whatsnew/3.10.rst:660 msgid "" "This binds x1, y1, x2, y2 like you would expect without the ``as`` clause, " "and p2 to the entire second item of the subject." msgstr "" -#: whatsnew/3.10.rst:662 +#: whatsnew/3.10.rst:663 msgid "" "Most literals are compared by equality. However, the singletons ``True``, " "``False`` and ``None`` are compared by identity." msgstr "" -#: whatsnew/3.10.rst:665 +#: whatsnew/3.10.rst:666 msgid "" "Named constants may be used in patterns. These named constants must be " "dotted names to prevent the constant from being interpreted as a capture " "variable::" msgstr "" -#: whatsnew/3.10.rst:684 +#: whatsnew/3.10.rst:670 +msgid "" +"from enum import Enum\n" +"class Color(Enum):\n" +" RED = 0\n" +" GREEN = 1\n" +" BLUE = 2\n" +"\n" +"color = Color.GREEN\n" +"match color:\n" +" case Color.RED:\n" +" print(\"I see red!\")\n" +" case Color.GREEN:\n" +" print(\"Grass is green\")\n" +" case Color.BLUE:\n" +" print(\"I'm feeling the blues :(\")" +msgstr "" + +#: whatsnew/3.10.rst:685 msgid "" "For the full specification see :pep:`634`. Motivation and rationale are in :" "pep:`635`, and a longer tutorial is in :pep:`636`." msgstr "" -#: whatsnew/3.10.rst:691 +#: whatsnew/3.10.rst:692 msgid "Optional ``EncodingWarning`` and ``encoding=\"locale\"`` option" msgstr "" -#: whatsnew/3.10.rst:693 +#: whatsnew/3.10.rst:694 +msgid "" +"The default encoding of :class:`~io.TextIOWrapper` and :func:`open` is " +"platform and locale dependent. Since UTF-8 is used on most Unix platforms, " +"omitting ``encoding`` option when opening UTF-8 files (e.g. JSON, YAML, " +"TOML, Markdown) is a very common bug. For example::" +msgstr "" + +#: whatsnew/3.10.rst:699 msgid "" -"The default encoding of :class:`TextIOWrapper` and :func:`open` is platform " -"and locale dependent. Since UTF-8 is used on most Unix platforms, omitting " -"``encoding`` option when opening UTF-8 files (e.g. JSON, YAML, TOML, " -"Markdown) is a very common bug. For example::" +"# BUG: \"rb\" mode or encoding=\"utf-8\" should be used.\n" +"with open(\"data.json\") as f:\n" +" data = json.load(f)" msgstr "" -#: whatsnew/3.10.rst:702 +#: whatsnew/3.10.rst:703 msgid "" "To find this type of bug, an optional ``EncodingWarning`` is added. It is " "emitted when :data:`sys.flags.warn_default_encoding ` is true and " "locale-specific default encoding is used." msgstr "" -#: whatsnew/3.10.rst:706 +#: whatsnew/3.10.rst:707 msgid "" "``-X warn_default_encoding`` option and :envvar:`PYTHONWARNDEFAULTENCODING` " "are added to enable the warning." msgstr "" -#: whatsnew/3.10.rst:709 +#: whatsnew/3.10.rst:710 msgid "See :ref:`io-text-encoding` for more information." msgstr "" -#: whatsnew/3.10.rst:714 +#: whatsnew/3.10.rst:715 msgid "New Features Related to Type Hints" msgstr "" -#: whatsnew/3.10.rst:716 +#: whatsnew/3.10.rst:717 msgid "" "This section covers major changes affecting :pep:`484` type hints and the :" "mod:`typing` module." msgstr "" -#: whatsnew/3.10.rst:721 +#: whatsnew/3.10.rst:722 msgid "PEP 604: New Type Union Operator" msgstr "" -#: whatsnew/3.10.rst:723 +#: whatsnew/3.10.rst:724 msgid "" "A new type union operator was introduced which enables the syntax ``X | Y``. " "This provides a cleaner way of expressing 'either type X or type Y' instead " -"of using :data:`typing.Union`, especially in type hints." +"of using :class:`typing.Union`, especially in type hints." msgstr "" -#: whatsnew/3.10.rst:727 +#: whatsnew/3.10.rst:728 msgid "" "In previous versions of Python, to apply a type hint for functions accepting " -"arguments of multiple types, :data:`typing.Union` was used::" +"arguments of multiple types, :class:`typing.Union` was used::" +msgstr "" + +#: whatsnew/3.10.rst:731 +msgid "" +"def square(number: Union[int, float]) -> Union[int, float]:\n" +" return number ** 2" msgstr "" -#: whatsnew/3.10.rst:734 +#: whatsnew/3.10.rst:735 msgid "Type hints can now be written in a more succinct manner::" msgstr "" -#: whatsnew/3.10.rst:740 +#: whatsnew/3.10.rst:737 +msgid "" +"def square(number: int | float) -> int | float:\n" +" return number ** 2" +msgstr "" + +#: whatsnew/3.10.rst:741 msgid "" "This new syntax is also accepted as the second argument to :func:" "`isinstance` and :func:`issubclass`::" msgstr "" -#: whatsnew/3.10.rst:746 +#: whatsnew/3.10.rst:744 +msgid "" +">>> isinstance(1, int | str)\n" +"True" +msgstr "" + +#: whatsnew/3.10.rst:747 msgid "See :ref:`types-union` and :pep:`604` for more details." msgstr "" -#: whatsnew/3.10.rst:748 +#: whatsnew/3.10.rst:749 msgid "" "(Contributed by Maggie Moss and Philippe Prados in :issue:`41428`, with " "additions by Yurii Karabas and Serhiy Storchaka in :issue:`44490`.)" msgstr "" -#: whatsnew/3.10.rst:753 +#: whatsnew/3.10.rst:754 msgid "PEP 612: Parameter Specification Variables" msgstr "" -#: whatsnew/3.10.rst:755 +#: whatsnew/3.10.rst:756 msgid "" "Two new options to improve the information provided to static type checkers " "for :pep:`484`\\ 's ``Callable`` have been added to the :mod:`typing` module." msgstr "" -#: whatsnew/3.10.rst:758 +#: whatsnew/3.10.rst:759 msgid "" "The first is the parameter specification variable. They are used to forward " "the parameter types of one callable to another callable -- a pattern " @@ -738,7 +1106,7 @@ msgid "" "to type annotate dependency of parameter types in such a precise manner." msgstr "" -#: whatsnew/3.10.rst:764 +#: whatsnew/3.10.rst:765 msgid "" "The second option is the new ``Concatenate`` operator. It's used in " "conjunction with parameter specification variables to type annotate a higher " @@ -746,24 +1114,24 @@ msgid "" "Examples of usage can be found in :class:`typing.Concatenate`." msgstr "" -#: whatsnew/3.10.rst:769 +#: whatsnew/3.10.rst:770 msgid "" "See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing." "Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing." "ParamSpecKwargs`, and :pep:`612` for more details." msgstr "" -#: whatsnew/3.10.rst:773 +#: whatsnew/3.10.rst:774 msgid "" "(Contributed by Ken Jin in :issue:`41559`, with minor enhancements by Jelle " "Zijlstra in :issue:`43783`. PEP written by Mark Mendoza.)" msgstr "" -#: whatsnew/3.10.rst:778 +#: whatsnew/3.10.rst:779 msgid "PEP 613: TypeAlias" msgstr "" -#: whatsnew/3.10.rst:780 +#: whatsnew/3.10.rst:781 msgid "" ":pep:`484` introduced the concept of type aliases, only requiring them to be " "top-level unannotated assignments. This simplicity sometimes made it " @@ -772,50 +1140,62 @@ msgid "" "involved. Compare::" msgstr "" -#: whatsnew/3.10.rst:788 +#: whatsnew/3.10.rst:786 msgid "" -"Now the :mod:`typing` module has a special value :data:`TypeAlias` which " -"lets you declare type aliases more explicitly::" +"StrCache = 'Cache[str]' # a type alias\n" +"LOG_PREFIX = 'LOG[DEBUG]' # a module constant" msgstr "" -#: whatsnew/3.10.rst:794 +#: whatsnew/3.10.rst:789 +msgid "" +"Now the :mod:`typing` module has a special value :data:`~typing.TypeAlias` " +"which lets you declare type aliases more explicitly::" +msgstr "" + +#: whatsnew/3.10.rst:792 +msgid "" +"StrCache: TypeAlias = 'Cache[str]' # a type alias\n" +"LOG_PREFIX = 'LOG[DEBUG]' # a module constant" +msgstr "" + +#: whatsnew/3.10.rst:795 msgid "See :pep:`613` for more details." msgstr "" -#: whatsnew/3.10.rst:796 +#: whatsnew/3.10.rst:797 msgid "(Contributed by Mikhail Golubev in :issue:`41923`.)" msgstr "" -#: whatsnew/3.10.rst:799 +#: whatsnew/3.10.rst:800 msgid "PEP 647: User-Defined Type Guards" msgstr "" -#: whatsnew/3.10.rst:801 +#: whatsnew/3.10.rst:802 msgid "" -":data:`TypeGuard` has been added to the :mod:`typing` module to annotate " -"type guard functions and improve information provided to static type " -"checkers during type narrowing. For more information, please see :data:" -"`TypeGuard`\\ 's documentation, and :pep:`647`." +":data:`~typing.TypeGuard` has been added to the :mod:`typing` module to " +"annotate type guard functions and improve information provided to static " +"type checkers during type narrowing. For more information, please see :data:" +"`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." msgstr "" -#: whatsnew/3.10.rst:806 +#: whatsnew/3.10.rst:807 msgid "" "(Contributed by Ken Jin and Guido van Rossum in :issue:`43766`. PEP written " "by Eric Traut.)" msgstr "" -#: whatsnew/3.10.rst:810 +#: whatsnew/3.10.rst:811 msgid "Other Language Changes" msgstr "" -#: whatsnew/3.10.rst:812 +#: whatsnew/3.10.rst:813 msgid "" "The :class:`int` type has a new method :meth:`int.bit_count`, returning the " "number of ones in the binary expansion of a given integer, also known as the " "population count. (Contributed by Niklas Fiekas in :issue:`29882`.)" msgstr "" -#: whatsnew/3.10.rst:816 +#: whatsnew/3.10.rst:817 msgid "" "The views returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:`dict." "items` now all have a ``mapping`` attribute that gives a :class:`types." @@ -823,13 +1203,13 @@ msgid "" "Dennis Sweeney in :issue:`40890`.)" msgstr "" -#: whatsnew/3.10.rst:821 +#: whatsnew/3.10.rst:822 msgid "" ":pep:`618`: The :func:`zip` function now has an optional ``strict`` flag, " "used to require that all the iterables have an equal length." msgstr "" -#: whatsnew/3.10.rst:824 +#: whatsnew/3.10.rst:825 msgid "" "Builtin and extension functions that take integer arguments no longer " "accept :class:`~decimal.Decimal`\\ s, :class:`~fractions.Fraction`\\ s and " @@ -838,20 +1218,20 @@ msgid "" "__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.)" msgstr "" -#: whatsnew/3.10.rst:831 +#: whatsnew/3.10.rst:832 msgid "" "If :func:`object.__ipow__` returns :data:`NotImplemented`, the operator will " "correctly fall back to :func:`object.__pow__` and :func:`object.__rpow__` as " "expected. (Contributed by Alex Shkop in :issue:`38302`.)" msgstr "" -#: whatsnew/3.10.rst:835 +#: whatsnew/3.10.rst:836 msgid "" "Assignment expressions can now be used unparenthesized within set literals " "and set comprehensions, as well as in sequence indexes (but not slices)." msgstr "" -#: whatsnew/3.10.rst:838 +#: whatsnew/3.10.rst:839 msgid "" "Functions have a new ``__builtins__`` attribute which is used to look for " "builtin symbols when a function is executed, instead of looking into " @@ -860,7 +1240,7 @@ msgid "" "builtins. (Contributed by Mark Shannon in :issue:`42990`.)" msgstr "" -#: whatsnew/3.10.rst:844 +#: whatsnew/3.10.rst:845 msgid "" "Two new builtin functions -- :func:`aiter` and :func:`anext` have been added " "to provide asynchronous counterparts to :func:`iter` and :func:`next`, " @@ -868,17 +1248,16 @@ msgid "" "in :issue:`31861`.)" msgstr "" -#: whatsnew/3.10.rst:849 +#: whatsnew/3.10.rst:850 msgid "" -"Static methods (:func:`@staticmethod `) and class methods (:" -"func:`@classmethod `) now inherit the method attributes " -"(``__module__``, ``__name__``, ``__qualname__``, ``__doc__``, " -"``__annotations__``) and have a new ``__wrapped__`` attribute. Moreover, " -"static methods are now callable as regular functions. (Contributed by Victor " -"Stinner in :issue:`43682`.)" +"Static methods (:deco:`staticmethod`) and class methods (:deco:" +"`classmethod`) now inherit the method attributes (``__module__``, " +"``__name__``, ``__qualname__``, ``__doc__``, ``__annotations__``) and have a " +"new ``__wrapped__`` attribute. Moreover, static methods are now callable as " +"regular functions. (Contributed by Victor Stinner in :issue:`43682`.)" msgstr "" -#: whatsnew/3.10.rst:856 +#: whatsnew/3.10.rst:857 msgid "" "Annotations for complex targets (everything beside ``simple name`` targets " "defined by :pep:`526`) no longer cause any runtime effects with ``from " @@ -886,7 +1265,7 @@ msgid "" "`42737`.)" msgstr "" -#: whatsnew/3.10.rst:860 +#: whatsnew/3.10.rst:861 msgid "" "Class and module objects now lazy-create empty annotations dicts on demand. " "The annotations dicts are stored in the object’s ``__dict__`` for backwards " @@ -895,7 +1274,7 @@ msgid "" "howto`. (Contributed by Larry Hastings in :issue:`43901`.)" msgstr "" -#: whatsnew/3.10.rst:867 +#: whatsnew/3.10.rst:868 msgid "" "Annotations consist of ``yield``, ``yield from``, ``await`` or named " "expressions are now forbidden under ``from __future__ import annotations`` " @@ -903,7 +1282,7 @@ msgid "" "`42725`.)" msgstr "" -#: whatsnew/3.10.rst:872 +#: whatsnew/3.10.rst:873 msgid "" "Usage of unbound variables, ``super()`` and other expressions that might " "alter the processing of symbol table as annotations are now rendered " @@ -911,7 +1290,7 @@ msgid "" "Batuhan Taskaya in :issue:`42725`.)" msgstr "" -#: whatsnew/3.10.rst:877 +#: whatsnew/3.10.rst:878 msgid "" "Hashes of NaN values of both :class:`float` type and :class:`decimal." "Decimal` type now depend on object identity. Formerly, they always hashed to " @@ -921,121 +1300,120 @@ msgid "" "Raymond Hettinger in :issue:`43475`.)" msgstr "" -#: whatsnew/3.10.rst:884 +#: whatsnew/3.10.rst:885 msgid "" "A :exc:`SyntaxError` (instead of a :exc:`NameError`) will be raised when " "deleting the :const:`__debug__` constant. (Contributed by Donghee Na in :" "issue:`45000`.)" msgstr "" -#: whatsnew/3.10.rst:887 +#: whatsnew/3.10.rst:888 msgid "" ":exc:`SyntaxError` exceptions now have ``end_lineno`` and ``end_offset`` " "attributes. They will be ``None`` if not determined. (Contributed by Pablo " "Galindo in :issue:`43914`.)" msgstr "" -#: whatsnew/3.10.rst:892 +#: whatsnew/3.10.rst:893 msgid "New Modules" msgstr "" -#: whatsnew/3.10.rst:894 +#: whatsnew/3.10.rst:895 msgid "None." msgstr "" -#: whatsnew/3.10.rst:898 +#: whatsnew/3.10.rst:899 msgid "Improved Modules" msgstr "" -#: whatsnew/3.10.rst:901 +#: whatsnew/3.10.rst:902 msgid "asyncio" msgstr "" -#: whatsnew/3.10.rst:903 +#: whatsnew/3.10.rst:904 msgid "" -"Add missing :meth:`~asyncio.events.AbstractEventLoop." -"connect_accepted_socket` method. (Contributed by Alex Grönholm in :issue:" -"`41332`.)" +"Add missing :meth:`~asyncio.loop.connect_accepted_socket` method. " +"(Contributed by Alex Grönholm in :issue:`41332`.)" msgstr "" -#: whatsnew/3.10.rst:908 +#: whatsnew/3.10.rst:909 msgid "argparse" msgstr "" -#: whatsnew/3.10.rst:910 +#: whatsnew/3.10.rst:911 msgid "" "Misleading phrase \"optional arguments\" was replaced with \"options\" in " "argparse help. Some tests might require adaptation if they rely on exact " "output match. (Contributed by Raymond Hettinger in :issue:`9694`.)" msgstr "" -#: whatsnew/3.10.rst:914 +#: whatsnew/3.10.rst:915 msgid "array" msgstr "" -#: whatsnew/3.10.rst:916 +#: whatsnew/3.10.rst:917 msgid "" "The :meth:`~array.array.index` method of :class:`array.array` now has " "optional *start* and *stop* parameters. (Contributed by Anders Lorentsen and " "Zackery Spytz in :issue:`31956`.)" msgstr "" -#: whatsnew/3.10.rst:921 +#: whatsnew/3.10.rst:922 msgid "asynchat, asyncore, smtpd" msgstr "" -#: whatsnew/3.10.rst:922 +#: whatsnew/3.10.rst:923 msgid "" "These modules have been marked as deprecated in their module documentation " "since Python 3.6. An import-time :class:`DeprecationWarning` has now been " "added to all three of these modules." msgstr "" -#: whatsnew/3.10.rst:927 +#: whatsnew/3.10.rst:928 msgid "base64" msgstr "" -#: whatsnew/3.10.rst:929 +#: whatsnew/3.10.rst:930 msgid "" "Add :func:`base64.b32hexencode` and :func:`base64.b32hexdecode` to support " "the Base32 Encoding with Extended Hex Alphabet." msgstr "" -#: whatsnew/3.10.rst:933 +#: whatsnew/3.10.rst:934 msgid "bdb" msgstr "" -#: whatsnew/3.10.rst:935 +#: whatsnew/3.10.rst:936 msgid "" -"Add :meth:`~bdb.Breakpoint.clearBreakpoints` to reset all set breakpoints. " -"(Contributed by Irit Katriel in :issue:`24160`.)" +"Add :meth:`!clearBreakpoints` to reset all set breakpoints. (Contributed by " +"Irit Katriel in :issue:`24160`.)" msgstr "" -#: whatsnew/3.10.rst:939 +#: whatsnew/3.10.rst:940 msgid "bisect" msgstr "" -#: whatsnew/3.10.rst:941 +#: whatsnew/3.10.rst:942 msgid "" "Added the possibility of providing a *key* function to the APIs in the :mod:" "`bisect` module. (Contributed by Raymond Hettinger in :issue:`4356`.)" msgstr "" -#: whatsnew/3.10.rst:945 +#: whatsnew/3.10.rst:946 msgid "codecs" msgstr "" -#: whatsnew/3.10.rst:947 +#: whatsnew/3.10.rst:948 msgid "" "Add a :func:`codecs.unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" -#: whatsnew/3.10.rst:951 +#: whatsnew/3.10.rst:952 msgid "collections.abc" msgstr "" -#: whatsnew/3.10.rst:953 +#: whatsnew/3.10.rst:954 msgid "" "The ``__args__`` of the :ref:`parameterized generic ` " "for :class:`collections.abc.Callable` are now consistent with :data:`typing." @@ -1051,34 +1429,34 @@ msgid "" "`42195`.)" msgstr "" -#: whatsnew/3.10.rst:966 +#: whatsnew/3.10.rst:967 msgid "contextlib" msgstr "" -#: whatsnew/3.10.rst:968 +#: whatsnew/3.10.rst:969 msgid "" "Add a :func:`contextlib.aclosing` context manager to safely close async " "generators and objects representing asynchronously released resources. " "(Contributed by Joongi Kim and John Belmonte in :issue:`41229`.)" msgstr "" -#: whatsnew/3.10.rst:972 +#: whatsnew/3.10.rst:973 msgid "" "Add asynchronous context manager support to :func:`contextlib.nullcontext`. " "(Contributed by Tom Gringauz in :issue:`41543`.)" msgstr "" -#: whatsnew/3.10.rst:975 +#: whatsnew/3.10.rst:976 msgid "" -"Add :class:`AsyncContextDecorator`, for supporting usage of async context " -"managers as decorators." +"Add :class:`~contextlib.AsyncContextDecorator`, for supporting usage of " +"async context managers as decorators." msgstr "" -#: whatsnew/3.10.rst:979 +#: whatsnew/3.10.rst:980 msgid "curses" msgstr "" -#: whatsnew/3.10.rst:981 +#: whatsnew/3.10.rst:982 msgid "" "The extended color functions added in ncurses 6.1 will be used transparently " "by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses." @@ -1088,53 +1466,73 @@ msgid "" "Kintscher and Hans Petter Jansson in :issue:`36982`.)" msgstr "" -#: whatsnew/3.10.rst:988 +#: whatsnew/3.10.rst:989 msgid "" "The ``BUTTON5_*`` constants are now exposed in the :mod:`curses` module if " "they are provided by the underlying curses library. (Contributed by Zackery " "Spytz in :issue:`39273`.)" msgstr "" -#: whatsnew/3.10.rst:993 +#: whatsnew/3.10.rst:994 msgid "dataclasses" msgstr "" -#: whatsnew/3.10.rst:996 +#: whatsnew/3.10.rst:997 msgid "__slots__" msgstr "" -#: whatsnew/3.10.rst:998 +#: whatsnew/3.10.rst:999 msgid "" "Added ``slots`` parameter in :func:`dataclasses.dataclass` decorator. " "(Contributed by Yurii Karabas in :issue:`42269`)" msgstr "" -#: whatsnew/3.10.rst:1002 +#: whatsnew/3.10.rst:1003 msgid "Keyword-only fields" msgstr "" -#: whatsnew/3.10.rst:1004 +#: whatsnew/3.10.rst:1005 msgid "" "dataclasses now supports fields that are keyword-only in the generated " "__init__ method. There are a number of ways of specifying keyword-only " "fields." msgstr "" -#: whatsnew/3.10.rst:1008 +#: whatsnew/3.10.rst:1009 msgid "You can say that every field is keyword-only:" msgstr "" -#: whatsnew/3.10.rst:1019 +#: whatsnew/3.10.rst:1011 +msgid "" +"from dataclasses import dataclass\n" +"\n" +"@dataclass(kw_only=True)\n" +"class Birthday:\n" +" name: str\n" +" birthday: datetime.date" +msgstr "" + +#: whatsnew/3.10.rst:1020 msgid "" "Both ``name`` and ``birthday`` are keyword-only parameters to the generated " "__init__ method." msgstr "" -#: whatsnew/3.10.rst:1022 +#: whatsnew/3.10.rst:1023 msgid "You can specify keyword-only on a per-field basis:" msgstr "" -#: whatsnew/3.10.rst:1033 +#: whatsnew/3.10.rst:1025 +msgid "" +"from dataclasses import dataclass, field\n" +"\n" +"@dataclass\n" +"class Birthday:\n" +" name: str\n" +" birthday: datetime.date = field(kw_only=True)" +msgstr "" + +#: whatsnew/3.10.rst:1034 msgid "" "Here only ``birthday`` is keyword-only. If you set ``kw_only`` on " "individual fields, be aware that there are rules about re-ordering fields " @@ -1142,23 +1540,36 @@ msgid "" "the full dataclasses documentation for details." msgstr "" -#: whatsnew/3.10.rst:1038 +#: whatsnew/3.10.rst:1039 msgid "" "You can also specify that all fields following a KW_ONLY marker are keyword-" "only. This will probably be the most common usage:" msgstr "" -#: whatsnew/3.10.rst:1053 +#: whatsnew/3.10.rst:1042 +msgid "" +"from dataclasses import dataclass, KW_ONLY\n" +"\n" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" y: float\n" +" _: KW_ONLY\n" +" z: float = 0.0\n" +" t: float = 0.0" +msgstr "" + +#: whatsnew/3.10.rst:1054 msgid "" "Here, ``z`` and ``t`` are keyword-only parameters, while ``x`` and ``y`` are " "not. (Contributed by Eric V. Smith in :issue:`43532`.)" msgstr "" -#: whatsnew/3.10.rst:1060 +#: whatsnew/3.10.rst:1061 msgid "distutils" msgstr "" -#: whatsnew/3.10.rst:1062 +#: whatsnew/3.10.rst:1063 msgid "" "The entire ``distutils`` package is deprecated, to be removed in Python " "3.12. Its functionality for specifying package builds has already been " @@ -1171,145 +1582,145 @@ msgid "" "`632` for discussion." msgstr "" -#: whatsnew/3.10.rst:1072 +#: whatsnew/3.10.rst:1073 msgid "" "The ``bdist_wininst`` command deprecated in Python 3.8 has been removed. The " "``bdist_wheel`` command is now recommended to distribute binary packages on " "Windows. (Contributed by Victor Stinner in :issue:`42802`.)" msgstr "" -#: whatsnew/3.10.rst:1078 +#: whatsnew/3.10.rst:1079 msgid "doctest" msgstr "" -#: whatsnew/3.10.rst:1215 whatsnew/3.10.rst:1341 +#: whatsnew/3.10.rst:1216 whatsnew/3.10.rst:1342 msgid "" "When a module does not define ``__loader__``, fall back to ``__spec__." "loader``. (Contributed by Brett Cannon in :issue:`42133`.)" msgstr "" -#: whatsnew/3.10.rst:1084 +#: whatsnew/3.10.rst:1085 msgid "encodings" msgstr "" -#: whatsnew/3.10.rst:1086 +#: whatsnew/3.10.rst:1087 msgid "" ":func:`encodings.normalize_encoding` now ignores non-ASCII characters. " "(Contributed by Hai Shi in :issue:`39337`.)" msgstr "" -#: whatsnew/3.10.rst:1090 +#: whatsnew/3.10.rst:1091 msgid "enum" msgstr "" -#: whatsnew/3.10.rst:1092 +#: whatsnew/3.10.rst:1093 msgid "" -":class:`Enum` :func:`__repr__` now returns ``enum_name.member_name`` and :" -"func:`__str__` now returns ``member_name``. Stdlib enums available as " -"module constants have a :func:`repr` of ``module_name.member_name``. " -"(Contributed by Ethan Furman in :issue:`40066`.)" +":class:`~enum.Enum` :func:`~object.__repr__` now returns ``enum_name." +"member_name`` and :func:`~object.__str__` now returns ``member_name``. " +"Stdlib enums available as module constants have a :func:`repr` of " +"``module_name.member_name``. (Contributed by Ethan Furman in :issue:`40066`.)" msgstr "" -#: whatsnew/3.10.rst:1097 +#: whatsnew/3.10.rst:1098 msgid "" "Add :class:`enum.StrEnum` for enums where all members are strings. " "(Contributed by Ethan Furman in :issue:`41816`.)" msgstr "" -#: whatsnew/3.10.rst:1101 +#: whatsnew/3.10.rst:1102 msgid "fileinput" msgstr "" -#: whatsnew/3.10.rst:1103 +#: whatsnew/3.10.rst:1104 msgid "" "Add *encoding* and *errors* parameters in :func:`fileinput.input` and :class:" "`fileinput.FileInput`. (Contributed by Inada Naoki in :issue:`43712`.)" msgstr "" -#: whatsnew/3.10.rst:1107 +#: whatsnew/3.10.rst:1108 msgid "" -":func:`fileinput.hook_compressed` now returns :class:`TextIOWrapper` object " -"when *mode* is \"r\" and file is compressed, like uncompressed files. " +":func:`fileinput.hook_compressed` now returns :class:`~io.TextIOWrapper` " +"object when *mode* is \"r\" and file is compressed, like uncompressed files. " "(Contributed by Inada Naoki in :issue:`5758`.)" msgstr "" -#: whatsnew/3.10.rst:1112 +#: whatsnew/3.10.rst:1113 msgid "faulthandler" msgstr "" -#: whatsnew/3.10.rst:1114 +#: whatsnew/3.10.rst:1115 msgid "" "The :mod:`faulthandler` module now detects if a fatal error occurs during a " "garbage collector collection. (Contributed by Victor Stinner in :issue:" "`44466`.)" msgstr "" -#: whatsnew/3.10.rst:1119 +#: whatsnew/3.10.rst:1120 msgid "gc" msgstr "" -#: whatsnew/3.10.rst:1121 +#: whatsnew/3.10.rst:1122 msgid "" "Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and :" "func:`gc.get_referents`. (Contributed by Pablo Galindo in :issue:`43439`.)" msgstr "" -#: whatsnew/3.10.rst:1125 +#: whatsnew/3.10.rst:1126 msgid "glob" msgstr "" -#: whatsnew/3.10.rst:1127 +#: whatsnew/3.10.rst:1128 msgid "" "Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` and :func:" "`~glob.iglob` which allow to specify the root directory for searching. " "(Contributed by Serhiy Storchaka in :issue:`38144`.)" msgstr "" -#: whatsnew/3.10.rst:1132 +#: whatsnew/3.10.rst:1133 msgid "hashlib" msgstr "" -#: whatsnew/3.10.rst:1134 +#: whatsnew/3.10.rst:1135 msgid "" "The hashlib module requires OpenSSL 1.1.1 or newer. (Contributed by " "Christian Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" -#: whatsnew/3.10.rst:1137 +#: whatsnew/3.10.rst:1138 msgid "" "The hashlib module has preliminary support for OpenSSL 3.0.0. (Contributed " "by Christian Heimes in :issue:`38820` and other issues.)" msgstr "" -#: whatsnew/3.10.rst:1140 +#: whatsnew/3.10.rst:1141 msgid "" "The pure-Python fallback of :func:`~hashlib.pbkdf2_hmac` is deprecated. In " "the future PBKDF2-HMAC will only be available when Python has been built " "with OpenSSL support. (Contributed by Christian Heimes in :issue:`43880`.)" msgstr "" -#: whatsnew/3.10.rst:1146 +#: whatsnew/3.10.rst:1147 msgid "hmac" msgstr "" -#: whatsnew/3.10.rst:1148 +#: whatsnew/3.10.rst:1149 msgid "" "The hmac module now uses OpenSSL's HMAC implementation internally. " "(Contributed by Christian Heimes in :issue:`40645`.)" msgstr "" -#: whatsnew/3.10.rst:1152 +#: whatsnew/3.10.rst:1153 msgid "IDLE and idlelib" msgstr "" -#: whatsnew/3.10.rst:1154 +#: whatsnew/3.10.rst:1155 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " "hooks were previously ignored. (Contributed by Ken Hilton in :issue:" "`43008`.)" msgstr "" -#: whatsnew/3.10.rst:1158 +#: whatsnew/3.10.rst:1159 msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " @@ -1320,11 +1731,11 @@ msgid "" "`33962`.)" msgstr "" -#: whatsnew/3.10.rst:1166 +#: whatsnew/3.10.rst:1167 msgid "The changes above were backported to a 3.9 maintenance release." msgstr "" -#: whatsnew/3.10.rst:1168 +#: whatsnew/3.10.rst:1169 msgid "" "Add a Shell sidebar. Move the primary prompt ('>>>') to the sidebar. Add " "secondary prompts ('...') to the sidebar. Left click and optional drag " @@ -1335,7 +1746,7 @@ msgid "" "text. (Contributed by Tal Einat in :issue:`37903`.)" msgstr "" -#: whatsnew/3.10.rst:1177 +#: whatsnew/3.10.rst:1178 msgid "" "Use spaces instead of tabs to indent interactive code. This makes " "interactive code entries 'look right'. Making this feasible was a major " @@ -1343,7 +1754,7 @@ msgid "" "in :issue:`37892`.)" msgstr "" -#: whatsnew/3.10.rst:1182 +#: whatsnew/3.10.rst:1183 msgid "" "Highlight the new :ref:`soft keywords ` :keyword:`match`, :" "keyword:`case `, and :keyword:`_ ` in pattern-" @@ -1352,52 +1763,52 @@ msgid "" "(Contributed by Tal Einat in :issue:`44010`.)" msgstr "" -#: whatsnew/3.10.rst:1188 +#: whatsnew/3.10.rst:1189 msgid "New in 3.10 maintenance releases." msgstr "" -#: whatsnew/3.10.rst:1190 +#: whatsnew/3.10.rst:1191 msgid "" "Apply syntax highlighting to ``.pyi`` files. (Contributed by Alex Waygood " "and Terry Jan Reedy in :issue:`45447`.)" msgstr "" -#: whatsnew/3.10.rst:1193 +#: whatsnew/3.10.rst:1194 msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -#: whatsnew/3.10.rst:1197 +#: whatsnew/3.10.rst:1198 msgid "importlib.metadata" msgstr "" -#: whatsnew/3.10.rst:1199 +#: whatsnew/3.10.rst:1200 msgid "" "Feature parity with ``importlib_metadata`` 4.6 (`history `_)." msgstr "" -#: whatsnew/3.10.rst:1202 +#: whatsnew/3.10.rst:1203 msgid "" ":ref:`importlib.metadata entry points ` now provide a nicer " -"experience for selecting entry points by group and name through a new :class:" -"`importlib.metadata.EntryPoints` class. See the Compatibility Note in the " -"docs for more info on the deprecation and usage." +"experience for selecting entry points by group and name through a new :ref:" +"`importlib.metadata.EntryPoints ` class. See the Compatibility " +"Note in the docs for more info on the deprecation and usage." msgstr "" -#: whatsnew/3.10.rst:1208 +#: whatsnew/3.10.rst:1209 msgid "" -"Added :func:`importlib.metadata.packages_distributions` for resolving top-" -"level Python modules and packages to their :class:`importlib.metadata." -"Distribution`." +"Added :ref:`importlib.metadata.packages_distributions() ` for resolving top-level Python modules and packages to " +"their :ref:`importlib.metadata.Distribution `." msgstr "" -#: whatsnew/3.10.rst:1213 +#: whatsnew/3.10.rst:1214 msgid "inspect" msgstr "" -#: whatsnew/3.10.rst:1218 +#: whatsnew/3.10.rst:1219 msgid "" "Add :func:`inspect.get_annotations`, which safely computes the annotations " "defined on an object. It works around the quirks of accessing the " @@ -1408,87 +1819,87 @@ msgid "" "annotations dict defined on any Python object; for more information on best " "practices for working with annotations, please see :ref:`annotations-howto`. " "Relatedly, :func:`inspect.signature`, :func:`inspect.Signature." -"from_callable`, and :func:`inspect.Signature.from_function` now call :func:" +"from_callable`, and :func:`!inspect.Signature.from_function` now call :func:" "`inspect.get_annotations` to retrieve annotations. This means :func:`inspect." "signature` and :func:`inspect.Signature.from_callable` can also now un-" "stringize stringized annotations. (Contributed by Larry Hastings in :issue:" "`43817`.)" msgstr "" -#: whatsnew/3.10.rst:1234 +#: whatsnew/3.10.rst:1235 msgid "itertools" msgstr "" -#: whatsnew/3.10.rst:1236 +#: whatsnew/3.10.rst:1237 msgid "" -"Add :func:`itertools.pairwise()`. (Contributed by Raymond Hettinger in :" -"issue:`38200`.)" +"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger in :issue:" +"`38200`.)" msgstr "" -#: whatsnew/3.10.rst:1240 +#: whatsnew/3.10.rst:1241 msgid "linecache" msgstr "" -#: whatsnew/3.10.rst:1246 +#: whatsnew/3.10.rst:1247 msgid "os" msgstr "" -#: whatsnew/3.10.rst:1248 +#: whatsnew/3.10.rst:1249 msgid "" -"Add :func:`os.cpu_count()` support for VxWorks RTOS. (Contributed by Peixing " +"Add :func:`os.cpu_count` support for VxWorks RTOS. (Contributed by Peixing " "Xin in :issue:`41440`.)" msgstr "" -#: whatsnew/3.10.rst:1251 +#: whatsnew/3.10.rst:1252 msgid "" "Add a new function :func:`os.eventfd` and related helpers to wrap the " "``eventfd2`` syscall on Linux. (Contributed by Christian Heimes in :issue:" "`41001`.)" msgstr "" -#: whatsnew/3.10.rst:1255 +#: whatsnew/3.10.rst:1256 msgid "" -"Add :func:`os.splice()` that allows to move data between two file " -"descriptors without copying between kernel address space and user address " -"space, where one of the file descriptors must refer to a pipe. (Contributed " -"by Pablo Galindo in :issue:`41625`.)" +"Add :func:`os.splice` that allows to move data between two file descriptors " +"without copying between kernel address space and user address space, where " +"one of the file descriptors must refer to a pipe. (Contributed by Pablo " +"Galindo in :issue:`41625`.)" msgstr "" -#: whatsnew/3.10.rst:1260 +#: whatsnew/3.10.rst:1261 msgid "" "Add :const:`~os.O_EVTONLY`, :const:`~os.O_FSYNC`, :const:`~os.O_SYMLINK` " "and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na in :" "issue:`43106`.)" msgstr "" -#: whatsnew/3.10.rst:1265 +#: whatsnew/3.10.rst:1266 msgid "os.path" msgstr "" -#: whatsnew/3.10.rst:1267 +#: whatsnew/3.10.rst:1268 msgid "" ":func:`os.path.realpath` now accepts a *strict* keyword-only argument. When " "set to ``True``, :exc:`OSError` is raised if a path doesn't exist or a " "symlink loop is encountered. (Contributed by Barney Gale in :issue:`43757`.)" msgstr "" -#: whatsnew/3.10.rst:1273 +#: whatsnew/3.10.rst:1274 msgid "pathlib" msgstr "" -#: whatsnew/3.10.rst:1275 +#: whatsnew/3.10.rst:1276 msgid "" "Add slice support to :attr:`PurePath.parents `. " "(Contributed by Joshua Cannon in :issue:`35498`.)" msgstr "" -#: whatsnew/3.10.rst:1278 +#: whatsnew/3.10.rst:1279 msgid "" "Add negative indexing support to :attr:`PurePath.parents `. (Contributed by Yaroslav Pankovych in :issue:`21041`.)" msgstr "" -#: whatsnew/3.10.rst:1282 +#: whatsnew/3.10.rst:1283 msgid "" "Add :meth:`Path.hardlink_to ` method that " "supersedes :meth:`!link_to`. The new method has the same argument order as :" @@ -1496,7 +1907,7 @@ msgid "" "`39950`.)" msgstr "" -#: whatsnew/3.10.rst:1287 +#: whatsnew/3.10.rst:1288 msgid "" ":meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a " "*follow_symlinks* keyword-only argument for consistency with corresponding " @@ -1504,49 +1915,49 @@ msgid "" "`39906`.)" msgstr "" -#: whatsnew/3.10.rst:1293 +#: whatsnew/3.10.rst:1294 msgid "platform" msgstr "" -#: whatsnew/3.10.rst:1295 +#: whatsnew/3.10.rst:1296 msgid "" -"Add :func:`platform.freedesktop_os_release()` to retrieve operation system " +"Add :func:`platform.freedesktop_os_release` to retrieve operation system " "identification from `freedesktop.org os-release `_ standard file. (Contributed by " "Christian Heimes in :issue:`28468`.)" msgstr "" -#: whatsnew/3.10.rst:1301 +#: whatsnew/3.10.rst:1302 msgid "pprint" msgstr "" -#: whatsnew/3.10.rst:1303 +#: whatsnew/3.10.rst:1304 msgid "" ":func:`pprint.pprint` now accepts a new ``underscore_numbers`` keyword " "argument. (Contributed by sblondon in :issue:`42914`.)" msgstr "" -#: whatsnew/3.10.rst:1306 +#: whatsnew/3.10.rst:1307 msgid "" ":mod:`pprint` can now pretty-print :class:`dataclasses.dataclass` instances. " "(Contributed by Lewis Gaul in :issue:`43080`.)" msgstr "" -#: whatsnew/3.10.rst:1310 +#: whatsnew/3.10.rst:1311 msgid "py_compile" msgstr "" -#: whatsnew/3.10.rst:1312 +#: whatsnew/3.10.rst:1313 msgid "" "Add ``--quiet`` option to command-line interface of :mod:`py_compile`. " "(Contributed by Gregory Schevchenko in :issue:`38731`.)" msgstr "" -#: whatsnew/3.10.rst:1316 +#: whatsnew/3.10.rst:1317 msgid "pyclbr" msgstr "" -#: whatsnew/3.10.rst:1318 +#: whatsnew/3.10.rst:1319 msgid "" "Add an ``end_lineno`` attribute to the ``Function`` and ``Class`` objects in " "the tree returned by :func:`pyclbr.readmodule` and :func:`pyclbr." @@ -1554,65 +1965,65 @@ msgid "" "Aviral Srivastava in :issue:`38307`.)" msgstr "" -#: whatsnew/3.10.rst:1324 +#: whatsnew/3.10.rst:1325 msgid "shelve" msgstr "" -#: whatsnew/3.10.rst:1326 +#: whatsnew/3.10.rst:1327 msgid "" "The :mod:`shelve` module now uses :const:`pickle.DEFAULT_PROTOCOL` by " "default instead of :mod:`pickle` protocol ``3`` when creating shelves. " "(Contributed by Zackery Spytz in :issue:`34204`.)" msgstr "" -#: whatsnew/3.10.rst:1331 +#: whatsnew/3.10.rst:1332 msgid "statistics" msgstr "" -#: whatsnew/3.10.rst:1333 +#: whatsnew/3.10.rst:1334 msgid "" "Add :func:`~statistics.covariance`, Pearson's :func:`~statistics." "correlation`, and simple :func:`~statistics.linear_regression` functions. " "(Contributed by Tymoteusz Wołodźko in :issue:`38490`.)" msgstr "" -#: whatsnew/3.10.rst:1339 +#: whatsnew/3.10.rst:1340 msgid "site" msgstr "" -#: whatsnew/3.10.rst:1345 +#: whatsnew/3.10.rst:1346 msgid "socket" msgstr "" -#: whatsnew/3.10.rst:1347 +#: whatsnew/3.10.rst:1348 msgid "" "The exception :exc:`socket.timeout` is now an alias of :exc:`TimeoutError`. " "(Contributed by Christian Heimes in :issue:`42413`.)" msgstr "" -#: whatsnew/3.10.rst:1350 +#: whatsnew/3.10.rst:1351 msgid "" "Add option to create MPTCP sockets with ``IPPROTO_MPTCP`` (Contributed by " "Rui Cunha in :issue:`43571`.)" msgstr "" -#: whatsnew/3.10.rst:1353 +#: whatsnew/3.10.rst:1354 msgid "" "Add ``IP_RECVTOS`` option to receive the type of service (ToS) or DSCP/ECN " "fields (Contributed by Georg Sauthoff in :issue:`44077`.)" msgstr "" -#: whatsnew/3.10.rst:1357 +#: whatsnew/3.10.rst:1358 msgid "ssl" msgstr "" -#: whatsnew/3.10.rst:1359 +#: whatsnew/3.10.rst:1360 msgid "" "The ssl module requires OpenSSL 1.1.1 or newer. (Contributed by Christian " "Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" -#: whatsnew/3.10.rst:1362 +#: whatsnew/3.10.rst:1363 msgid "" "The ssl module has preliminary support for OpenSSL 3.0.0 and new option :" "const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`. (Contributed by Christian Heimes in :" @@ -1620,7 +2031,7 @@ msgid "" "`43799`, :issue:`43920`, :issue:`43789`, and :issue:`43811`.)" msgstr "" -#: whatsnew/3.10.rst:1368 +#: whatsnew/3.10.rst:1369 msgid "" "Deprecated function and use of deprecated constants now result in a :exc:" "`DeprecationWarning`. :attr:`ssl.SSLContext.options` has :data:`~ssl." @@ -1630,7 +2041,7 @@ msgid "" "Christian Heimes in :issue:`43880`.)" msgstr "" -#: whatsnew/3.10.rst:1376 +#: whatsnew/3.10.rst:1377 msgid "" "The ssl module now has more secure default settings. Ciphers without forward " "secrecy or SHA-1 MAC are disabled by default. Security level 2 prohibits " @@ -1640,7 +2051,7 @@ msgid "" "`43998`.)" msgstr "" -#: whatsnew/3.10.rst:1383 +#: whatsnew/3.10.rst:1384 msgid "" "The deprecated protocols SSL 3.0, TLS 1.0, and TLS 1.1 are no longer " "officially supported. Python does not block them actively. However OpenSSL " @@ -1648,86 +2059,86 @@ msgid "" "prevent a successful handshake." msgstr "" -#: whatsnew/3.10.rst:1388 +#: whatsnew/3.10.rst:1389 msgid "" "Add a *timeout* parameter to the :func:`ssl.get_server_certificate` " "function. (Contributed by Zackery Spytz in :issue:`31870`.)" msgstr "" -#: whatsnew/3.10.rst:1391 +#: whatsnew/3.10.rst:1392 msgid "" "The ssl module uses heap-types and multi-phase initialization. (Contributed " "by Christian Heimes in :issue:`42333`.)" msgstr "" -#: whatsnew/3.10.rst:1394 +#: whatsnew/3.10.rst:1395 msgid "" "A new verify flag :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN` has been added. " "(Contributed by l0x in :issue:`40849`.)" msgstr "" -#: whatsnew/3.10.rst:1398 +#: whatsnew/3.10.rst:1399 msgid "sqlite3" msgstr "" -#: whatsnew/3.10.rst:1400 +#: whatsnew/3.10.rst:1401 msgid "" -"Add audit events for :func:`~sqlite3.connect/handle`, :meth:`~sqlite3." -"Connection.enable_load_extension`, and :meth:`~sqlite3.Connection." -"load_extension`. (Contributed by Erlend E. Aasland in :issue:`43762`.)" +"Add audit events for :func:`~sqlite3.connect`, :meth:`~sqlite3.Connection." +"enable_load_extension`, and :meth:`~sqlite3.Connection.load_extension`. " +"(Contributed by Erlend E. Aasland in :issue:`43762`.)" msgstr "" -#: whatsnew/3.10.rst:1406 +#: whatsnew/3.10.rst:1407 msgid "sys" msgstr "" -#: whatsnew/3.10.rst:1408 +#: whatsnew/3.10.rst:1409 msgid "" "Add :data:`sys.orig_argv` attribute: the list of the original command line " "arguments passed to the Python executable. (Contributed by Victor Stinner " "in :issue:`23427`.)" msgstr "" -#: whatsnew/3.10.rst:1412 +#: whatsnew/3.10.rst:1413 msgid "" "Add :data:`sys.stdlib_module_names`, containing the list of the standard " "library module names. (Contributed by Victor Stinner in :issue:`42955`.)" msgstr "" -#: whatsnew/3.10.rst:1417 +#: whatsnew/3.10.rst:1418 msgid "_thread" msgstr "" -#: whatsnew/3.10.rst:1419 +#: whatsnew/3.10.rst:1420 msgid "" ":func:`_thread.interrupt_main` now takes an optional signal number to " "simulate (the default is still :const:`signal.SIGINT`). (Contributed by " "Antoine Pitrou in :issue:`43356`.)" msgstr "" -#: whatsnew/3.10.rst:1424 +#: whatsnew/3.10.rst:1425 msgid "threading" msgstr "" -#: whatsnew/3.10.rst:1426 +#: whatsnew/3.10.rst:1427 msgid "" "Add :func:`threading.gettrace` and :func:`threading.getprofile` to retrieve " "the functions set by :func:`threading.settrace` and :func:`threading." "setprofile` respectively. (Contributed by Mario Corchero in :issue:`42251`.)" msgstr "" -#: whatsnew/3.10.rst:1431 +#: whatsnew/3.10.rst:1432 msgid "" "Add :data:`threading.__excepthook__` to allow retrieving the original value " "of :func:`threading.excepthook` in case it is set to a broken or a different " "value. (Contributed by Mario Corchero in :issue:`42308`.)" msgstr "" -#: whatsnew/3.10.rst:1437 +#: whatsnew/3.10.rst:1438 msgid "traceback" msgstr "" -#: whatsnew/3.10.rst:1439 +#: whatsnew/3.10.rst:1440 msgid "" "The :func:`~traceback.format_exception`, :func:`~traceback." "format_exception_only`, and :func:`~traceback.print_exception` functions can " @@ -1735,11 +2146,11 @@ msgid "" "Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" msgstr "" -#: whatsnew/3.10.rst:1446 +#: whatsnew/3.10.rst:1447 msgid "types" msgstr "" -#: whatsnew/3.10.rst:1448 +#: whatsnew/3.10.rst:1449 msgid "" "Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` and :data:" "`types.NotImplementedType` classes, providing a new set of types readily " @@ -1747,30 +2158,30 @@ msgid "" "`41810`.)" msgstr "" -#: whatsnew/3.10.rst:1454 +#: whatsnew/3.10.rst:1455 msgid "typing" msgstr "" -#: whatsnew/3.10.rst:1456 +#: whatsnew/3.10.rst:1457 msgid "For major changes, see :ref:`new-feat-related-type-hints`." msgstr "" -#: whatsnew/3.10.rst:1458 +#: whatsnew/3.10.rst:1459 msgid "" "The behavior of :class:`typing.Literal` was changed to conform with :pep:" "`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" -#: whatsnew/3.10.rst:1461 +#: whatsnew/3.10.rst:1462 msgid "``Literal`` now de-duplicates parameters." msgstr "" -#: whatsnew/3.10.rst:1462 +#: whatsnew/3.10.rst:1463 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." msgstr "" -#: whatsnew/3.10.rst:1463 +#: whatsnew/3.10.rst:1464 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " @@ -1778,7 +2189,7 @@ msgid "" "differentiating types." msgstr "" -#: whatsnew/3.10.rst:1467 +#: whatsnew/3.10.rst:1468 msgid "" "``Literal`` objects will now raise a :exc:`TypeError` exception during " "equality comparisons if any of their parameters are not :term:`hashable`. " @@ -1786,28 +2197,38 @@ msgid "" "error::" msgstr "" -#: whatsnew/3.10.rst:1479 +#: whatsnew/3.10.rst:1473 +msgid "" +">>> from typing import Literal\n" +">>> Literal[{0}]\n" +">>> Literal[{0}] == Literal[{False}]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: unhashable type: 'set'" +msgstr "" + +#: whatsnew/3.10.rst:1480 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" msgstr "" -#: whatsnew/3.10.rst:1481 +#: whatsnew/3.10.rst:1482 msgid "" "Add new function :func:`typing.is_typeddict` to introspect if an annotation " "is a :class:`typing.TypedDict`. (Contributed by Patrick Reader in :issue:" "`41792`.)" msgstr "" -#: whatsnew/3.10.rst:1485 +#: whatsnew/3.10.rst:1486 msgid "" "Subclasses of ``typing.Protocol`` which only have data variables declared " "will now raise a ``TypeError`` when checked with ``isinstance`` unless they " -"are decorated with :func:`runtime_checkable`. Previously, these checks " -"passed silently. Users should decorate their subclasses with the :func:" -"`runtime_checkable` decorator if they want runtime protocols. (Contributed " -"by Yurii Karabas in :issue:`38908`.)" +"are decorated with :func:`~typing.runtime_checkable`. Previously, these " +"checks passed silently. Users should decorate their subclasses with the :" +"func:`!runtime_checkable` decorator if they want runtime protocols. " +"(Contributed by Yurii Karabas in :issue:`38908`.)" msgstr "" -#: whatsnew/3.10.rst:1493 +#: whatsnew/3.10.rst:1494 msgid "" "Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" "exc:`DeprecationWarning`. These submodules have been deprecated since " @@ -1816,35 +2237,35 @@ msgid "" "instead. (Contributed by Sebastian Rittau in :issue:`38291`.)" msgstr "" -#: whatsnew/3.10.rst:1501 +#: whatsnew/3.10.rst:1502 msgid "unittest" msgstr "" -#: whatsnew/3.10.rst:1503 +#: whatsnew/3.10.rst:1504 msgid "" "Add new method :meth:`~unittest.TestCase.assertNoLogs` to complement the " "existing :meth:`~unittest.TestCase.assertLogs`. (Contributed by Kit Yan Choi " "in :issue:`39385`.)" msgstr "" -#: whatsnew/3.10.rst:1508 +#: whatsnew/3.10.rst:1509 msgid "urllib.parse" msgstr "" -#: whatsnew/3.10.rst:1510 +#: whatsnew/3.10.rst:1511 msgid "" "Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` " "as query parameter separators in :func:`urllib.parse.parse_qs` and :func:" "`urllib.parse.parse_qsl`. Due to security concerns, and to conform with " "newer W3C recommendations, this has been changed to allow only a single " -"separator key, with ``&`` as the default. This change also affects :func:" -"`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected " +"separator key, with ``&`` as the default. This change also affects :func:`!" +"cgi.parse` and :func:`!cgi.parse_multipart` as they use the affected " "functions internally. For more details, please see their respective " "documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " "in :issue:`42967`.)" msgstr "" -#: whatsnew/3.10.rst:1520 +#: whatsnew/3.10.rst:1521 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates :rfc:" @@ -1854,22 +2275,22 @@ msgid "" "variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" -#: whatsnew/3.10.rst:1528 +#: whatsnew/3.10.rst:1529 msgid "xml" msgstr "" -#: whatsnew/3.10.rst:1530 +#: whatsnew/3.10.rst:1531 msgid "" "Add a :class:`~xml.sax.handler.LexicalHandler` class to the :mod:`xml.sax." "handler` module. (Contributed by Jonathan Gossage and Zackery Spytz in :" "issue:`35018`.)" msgstr "" -#: whatsnew/3.10.rst:1535 +#: whatsnew/3.10.rst:1536 msgid "zipimport" msgstr "" -#: whatsnew/3.10.rst:1536 +#: whatsnew/3.10.rst:1537 msgid "" "Add methods related to :pep:`451`: :meth:`~zipimport.zipimporter." "find_spec`, :meth:`zipimport.zipimporter.create_module`, and :meth:" @@ -1877,24 +2298,24 @@ msgid "" "`42131`.)" msgstr "" -#: whatsnew/3.10.rst:1541 +#: whatsnew/3.10.rst:1542 msgid "" "Add :meth:`~zipimport.zipimporter.invalidate_caches` method. (Contributed by " "Desmond Cheong in :issue:`14678`.)" msgstr "" -#: whatsnew/3.10.rst:1546 +#: whatsnew/3.10.rst:1547 msgid "Optimizations" msgstr "" -#: whatsnew/3.10.rst:1548 +#: whatsnew/3.10.rst:1549 msgid "" "Constructors :func:`str`, :func:`bytes` and :func:`bytearray` are now faster " "(around 30--40% for small objects). (Contributed by Serhiy Storchaka in :" "issue:`41334`.)" msgstr "" -#: whatsnew/3.10.rst:1552 +#: whatsnew/3.10.rst:1553 msgid "" "The :mod:`runpy` module now imports fewer modules. The ``python3 -m module-" "name`` command startup time is 1.4x faster in average. On Linux, ``python3 -" @@ -1903,7 +2324,7 @@ msgid "" "`41006` and :issue:`41718`.)" msgstr "" -#: whatsnew/3.10.rst:1558 +#: whatsnew/3.10.rst:1559 msgid "" "The ``LOAD_ATTR`` instruction now uses new \"per opcode cache\" mechanism. " "It is about 36% faster now for regular attributes and 44% faster for slots. " @@ -1912,7 +2333,7 @@ msgid "" "and MicroPython.)" msgstr "" -#: whatsnew/3.10.rst:1564 +#: whatsnew/3.10.rst:1565 msgid "" "When building Python with :option:`--enable-optimizations` now ``-fno-" "semantic-interposition`` is added to both the compile and link line. This " @@ -1923,7 +2344,7 @@ msgid "" "and Pablo Galindo in :issue:`38980`.)" msgstr "" -#: whatsnew/3.10.rst:1572 +#: whatsnew/3.10.rst:1573 msgid "" "Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` / :mod:" "`zlib` modules, and add ``.readall()`` function to ``_compression." @@ -1933,7 +2354,7 @@ msgid "" "`41486`)" msgstr "" -#: whatsnew/3.10.rst:1578 +#: whatsnew/3.10.rst:1579 msgid "" "When using stringized annotations, annotations dicts for functions are no " "longer created when the function is created. Instead, they are stored as a " @@ -1943,7 +2364,7 @@ msgid "" "Inada Naoki in :issue:`42202`.)" msgstr "" -#: whatsnew/3.10.rst:1585 +#: whatsnew/3.10.rst:1586 msgid "" "Substring search functions such as ``str1 in str2`` and ``str2.find(str1)`` " "now sometimes use Crochemore & Perrin's \"Two-Way\" string searching " @@ -1951,7 +2372,7 @@ msgid "" "Dennis Sweeney in :issue:`41972`)" msgstr "" -#: whatsnew/3.10.rst:1590 +#: whatsnew/3.10.rst:1591 msgid "" "Add micro-optimizations to ``_PyType_Lookup()`` to improve type attribute " "cache lookup performance in the common case of cache hits. This makes the " @@ -1959,7 +2380,7 @@ msgid "" "issue:`43452`.)" msgstr "" -#: whatsnew/3.10.rst:1594 +#: whatsnew/3.10.rst:1595 msgid "" "The following built-in functions now support the faster :pep:`590` " "vectorcall calling convention: :func:`map`, :func:`filter`, :func:" @@ -1968,20 +2389,20 @@ msgid "" "`41873` and :issue:`41870`.)" msgstr "" -#: whatsnew/3.10.rst:1598 +#: whatsnew/3.10.rst:1599 msgid "" -":class:`BZ2File` performance is improved by removing internal ``RLock``. " -"This makes :class:`BZ2File` thread unsafe in the face of multiple " -"simultaneous readers or writers, just like its equivalent classes in :mod:" -"`gzip` and :mod:`lzma` have always been. (Contributed by Inada Naoki in :" -"issue:`43785`.)" +":class:`~bz2.BZ2File` performance is improved by removing internal " +"``RLock``. This makes :class:`!BZ2File` thread unsafe in the face of " +"multiple simultaneous readers or writers, just like its equivalent classes " +"in :mod:`gzip` and :mod:`lzma` have always been. (Contributed by Inada " +"Naoki in :issue:`43785`.)" msgstr "" -#: whatsnew/3.10.rst:2212 +#: whatsnew/3.10.rst:2213 msgid "Deprecated" msgstr "" -#: whatsnew/3.10.rst:1608 +#: whatsnew/3.10.rst:1609 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -1994,12 +2415,12 @@ msgid "" "by Serhiy Storchaka in :issue:`43833`.)" msgstr "" -#: whatsnew/3.10.rst:1619 +#: whatsnew/3.10.rst:1620 msgid "" "Starting in this release, there will be a concerted effort to begin cleaning " "up old import semantics that were kept for Python 2.7 compatibility. " "Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded by :meth:" -"`~importlib.abc.Finder.find_spec`), :meth:`~importlib.abc.Loader." +"`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader." "load_module` (superseded by :meth:`~importlib.abc.Loader.exec_module`), :" "meth:`!module_repr` (which the import system takes care of for you), the " "``__package__`` attribute (superseded by ``__spec__.parent``), the " @@ -2011,21 +2432,21 @@ msgid "" "transition." msgstr "" -#: whatsnew/3.10.rst:1636 +#: whatsnew/3.10.rst:1637 msgid "" "The entire ``distutils`` namespace is deprecated, to be removed in Python " "3.12. Refer to the :ref:`module changes ` section for " "more information." msgstr "" -#: whatsnew/3.10.rst:1640 +#: whatsnew/3.10.rst:1641 msgid "" "Non-integer arguments to :func:`random.randrange` are deprecated. The :exc:" "`ValueError` is deprecated in favor of a :exc:`TypeError`. (Contributed by " "Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" msgstr "" -#: whatsnew/3.10.rst:1644 +#: whatsnew/3.10.rst:1645 msgid "" "The various ``load_module()`` methods of :mod:`importlib` have been " "documented as deprecated since Python 3.6, but will now also trigger a :exc:" @@ -2033,21 +2454,21 @@ msgid "" "(Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" -#: whatsnew/3.10.rst:1650 +#: whatsnew/3.10.rst:1651 msgid "" -":meth:`zimport.zipimporter.load_module` has been deprecated in preference " +":meth:`!zimport.zipimporter.load_module` has been deprecated in preference " "for :meth:`~zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " "in :issue:`26131`.)" msgstr "" -#: whatsnew/3.10.rst:1654 +#: whatsnew/3.10.rst:1655 msgid "" "The use of :meth:`~importlib.abc.Loader.load_module` by the import system " "now triggers an :exc:`ImportWarning` as :meth:`~importlib.abc.Loader." "exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" -#: whatsnew/3.10.rst:1659 +#: whatsnew/3.10.rst:1660 msgid "" "The use of :meth:`!importlib.abc.MetaPathFinder.find_module` and :meth:`!" "importlib.abc.PathEntryFinder.find_module` by the import system now trigger " @@ -2057,7 +2478,7 @@ msgid "" "porting. (Contributed by Brett Cannon in :issue:`42134`.)" msgstr "" -#: whatsnew/3.10.rst:1668 +#: whatsnew/3.10.rst:1669 msgid "" "The use of :meth:`!importlib.abc.PathEntryFinder.find_loader` by the import " "system now triggers an :exc:`ImportWarning` as :meth:`importlib.abc." @@ -2066,7 +2487,7 @@ msgid "" "`43672`.)" msgstr "" -#: whatsnew/3.10.rst:1674 +#: whatsnew/3.10.rst:1675 msgid "" "The various implementations of :meth:`!importlib.abc.MetaPathFinder." "find_module` ( :meth:`!importlib.machinery.BuiltinImporter.find_module`, :" @@ -2081,7 +2502,7 @@ msgid "" "Python 3.4). (Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" -#: whatsnew/3.10.rst:1689 +#: whatsnew/3.10.rst:1690 msgid "" ":class:`!importlib.abc.Finder` is deprecated (including its sole method, :" "meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` and :class:" @@ -2090,7 +2511,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" -#: whatsnew/3.10.rst:1696 +#: whatsnew/3.10.rst:1697 msgid "" "The deprecations of :mod:`!imp`, :func:`!importlib.find_loader`, :func:`!" "importlib.util.set_package_wrapper`, :func:`!importlib.util." @@ -2101,7 +2522,7 @@ msgid "" "Brett Cannon in :issue:`43720`.)" msgstr "" -#: whatsnew/3.10.rst:1706 +#: whatsnew/3.10.rst:1707 msgid "" "The import system now uses the ``__spec__`` attribute on modules before " "falling back on :meth:`!module_repr` for a module's ``__repr__()`` method. " @@ -2109,7 +2530,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`42137`.)" msgstr "" -#: whatsnew/3.10.rst:1712 +#: whatsnew/3.10.rst:1713 msgid "" ":meth:`!importlib.abc.Loader.module_repr`, :meth:`!importlib.machinery." "FrozenLoader.module_repr`, and :meth:`!importlib.machinery.BuiltinLoader." @@ -2117,7 +2538,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`42136`.)" msgstr "" -#: whatsnew/3.10.rst:1718 +#: whatsnew/3.10.rst:1719 msgid "" "``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python " "3.3, when it was made an alias to :class:`str`. It is now deprecated, " @@ -2125,7 +2546,7 @@ msgid "" "issue:`42264`.)" msgstr "" -#: whatsnew/3.10.rst:1723 +#: whatsnew/3.10.rst:1724 msgid "" "The undocumented built-in function ``sqlite3.enable_shared_cache`` is now " "deprecated, scheduled for removal in Python 3.12. Its use is strongly " @@ -2135,103 +2556,101 @@ msgid "" "query parameter. (Contributed by Erlend E. Aasland in :issue:`24464`.)" msgstr "" -#: whatsnew/3.10.rst:1731 +#: whatsnew/3.10.rst:1732 msgid "The following ``threading`` methods are now deprecated:" msgstr "" -#: whatsnew/3.10.rst:1733 +#: whatsnew/3.10.rst:1734 msgid "``threading.currentThread`` => :func:`threading.current_thread`" msgstr "" -#: whatsnew/3.10.rst:1735 +#: whatsnew/3.10.rst:1736 msgid "``threading.activeCount`` => :func:`threading.active_count`" msgstr "" -#: whatsnew/3.10.rst:1737 +#: whatsnew/3.10.rst:1738 msgid "" "``threading.Condition.notifyAll`` => :meth:`threading.Condition.notify_all`" msgstr "" -#: whatsnew/3.10.rst:1740 +#: whatsnew/3.10.rst:1741 msgid "``threading.Event.isSet`` => :meth:`threading.Event.is_set`" msgstr "" -#: whatsnew/3.10.rst:1742 +#: whatsnew/3.10.rst:1743 msgid "``threading.Thread.setName`` => :attr:`threading.Thread.name`" msgstr "" -#: whatsnew/3.10.rst:1744 +#: whatsnew/3.10.rst:1745 msgid "``threading.thread.getName`` => :attr:`threading.Thread.name`" msgstr "" -#: whatsnew/3.10.rst:1746 +#: whatsnew/3.10.rst:1747 msgid "``threading.Thread.isDaemon`` => :attr:`threading.Thread.daemon`" msgstr "" -#: whatsnew/3.10.rst:1748 +#: whatsnew/3.10.rst:1749 msgid "``threading.Thread.setDaemon`` => :attr:`threading.Thread.daemon`" msgstr "" -#: whatsnew/3.10.rst:1750 +#: whatsnew/3.10.rst:1751 msgid "(Contributed by Jelle Zijlstra in :gh:`87889`.)" msgstr "" -#: whatsnew/3.10.rst:1752 +#: whatsnew/3.10.rst:1753 msgid "" ":meth:`!pathlib.Path.link_to` is deprecated and slated for removal in Python " "3.12. Use :meth:`pathlib.Path.hardlink_to` instead. (Contributed by Barney " "Gale in :issue:`39950`.)" msgstr "" -#: whatsnew/3.10.rst:1756 +#: whatsnew/3.10.rst:1757 msgid "" "``cgi.log()`` is deprecated and slated for removal in Python 3.12. " "(Contributed by Inada Naoki in :issue:`41139`.)" msgstr "" -#: whatsnew/3.10.rst:1759 +#: whatsnew/3.10.rst:1760 msgid "" "The following :mod:`ssl` features have been deprecated since Python 3.6, " "Python 3.7, or OpenSSL 1.1.0 and will be removed in 3.11:" msgstr "" -#: whatsnew/3.10.rst:1762 +#: whatsnew/3.10.rst:1763 msgid "" -":data:`~ssl.OP_NO_SSLv2`, :data:`~ssl.OP_NO_SSLv3`, :data:`~ssl." -"OP_NO_TLSv1`, :data:`~ssl.OP_NO_TLSv1_1`, :data:`~ssl.OP_NO_TLSv1_2`, and :" -"data:`~ssl.OP_NO_TLSv1_3` are replaced by :attr:`sslSSLContext." -"minimum_version` and :attr:`sslSSLContext.maximum_version`." +":data:`!OP_NO_SSLv2`, :data:`!OP_NO_SSLv3`, :data:`!OP_NO_TLSv1`, :data:`!" +"OP_NO_TLSv1_1`, :data:`!OP_NO_TLSv1_2`, and :data:`!OP_NO_TLSv1_3` are " +"replaced by :attr:`~ssl.SSLContext.minimum_version` and :attr:`~ssl." +"SSLContext.maximum_version`." msgstr "" -#: whatsnew/3.10.rst:1768 +#: whatsnew/3.10.rst:1769 msgid "" -":data:`~ssl.PROTOCOL_SSLv2`, :data:`~ssl.PROTOCOL_SSLv3`, :data:`~ssl." -"PROTOCOL_SSLv23`, :data:`~ssl.PROTOCOL_TLSv1`, :data:`~ssl." -"PROTOCOL_TLSv1_1`, :data:`~ssl.PROTOCOL_TLSv1_2`, and :const:`~ssl." -"PROTOCOL_TLS` are deprecated in favor of :const:`~ssl.PROTOCOL_TLS_CLIENT` " -"and :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!PROTOCOL_SSLv23`, :" +"data:`!PROTOCOL_TLSv1`, :data:`!PROTOCOL_TLSv1_1`, :data:`!" +"PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are deprecated in favor of :" +"const:`~ssl.PROTOCOL_TLS_CLIENT` and :const:`~ssl.PROTOCOL_TLS_SERVER`" msgstr "" -#: whatsnew/3.10.rst:1774 -msgid "" -":func:`~ssl.wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`" +#: whatsnew/3.10.rst:1775 +msgid ":func:`!wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`" msgstr "" -#: whatsnew/3.10.rst:1776 -msgid ":func:`~ssl.match_hostname`" +#: whatsnew/3.10.rst:1777 +msgid ":func:`!match_hostname`" msgstr "" -#: whatsnew/3.10.rst:1778 -msgid ":func:`~ssl.RAND_pseudo_bytes`, :func:`~ssl.RAND_egd`" +#: whatsnew/3.10.rst:1779 +msgid ":func:`!RAND_pseudo_bytes`, :func:`!RAND_egd`" msgstr "" -#: whatsnew/3.10.rst:1780 +#: whatsnew/3.10.rst:1781 msgid "" "NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` and :meth:`ssl." "SSLContext.set_npn_protocols` are replaced by ALPN." msgstr "" -#: whatsnew/3.10.rst:1783 +#: whatsnew/3.10.rst:1784 msgid "" "The threading debug (:envvar:`!PYTHONTHREADDEBUG` environment variable) is " "deprecated in Python 3.10 and will be removed in Python 3.12. This feature " @@ -2239,7 +2658,7 @@ msgid "" "Victor Stinner in :issue:`44584`.)" msgstr "" -#: whatsnew/3.10.rst:1788 +#: whatsnew/3.10.rst:1789 msgid "" "Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" "exc:`DeprecationWarning`. These submodules will be removed in a future " @@ -2248,11 +2667,11 @@ msgid "" "Rittau in :issue:`38291`.)" msgstr "" -#: whatsnew/3.10.rst:2220 +#: whatsnew/3.10.rst:2221 msgid "Removed" msgstr "" -#: whatsnew/3.10.rst:1799 +#: whatsnew/3.10.rst:1800 msgid "" "Removed special methods ``__int__``, ``__float__``, ``__floordiv__``, " "``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and " @@ -2260,7 +2679,7 @@ msgid "" "`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" msgstr "" -#: whatsnew/3.10.rst:1805 +#: whatsnew/3.10.rst:1806 msgid "" "The ``ParserBase.error()`` method from the private and undocumented " "``_markupbase`` module has been removed. :class:`html.parser.HTMLParser` is " @@ -2269,7 +2688,7 @@ msgid "" "`31844`.)" msgstr "" -#: whatsnew/3.10.rst:1811 +#: whatsnew/3.10.rst:1812 msgid "" "Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal " "PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was " @@ -2277,7 +2696,7 @@ msgid "" "`42157`.)" msgstr "" -#: whatsnew/3.10.rst:1816 +#: whatsnew/3.10.rst:1817 msgid "" "Removed the ``parser`` module, which was deprecated in 3.9 due to the switch " "to the new PEG parser, as well as all the C source and header files that " @@ -2285,7 +2704,7 @@ msgid "" "``graminit.h`` and ``grammar.h``." msgstr "" -#: whatsnew/3.10.rst:1821 +#: whatsnew/3.10.rst:1822 msgid "" "Removed the Public C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " @@ -2293,7 +2712,7 @@ msgid "" "deprecated in 3.9 due to the switch to the new PEG parser." msgstr "" -#: whatsnew/3.10.rst:1826 +#: whatsnew/3.10.rst:1827 msgid "" "Removed the ``formatter`` module, which was deprecated in Python 3.4. It is " "somewhat obsolete, little used, and not tested. It was originally scheduled " @@ -2302,71 +2721,71 @@ msgid "" "their code. (Contributed by Donghee Na and Terry J. Reedy in :issue:`42299`.)" msgstr "" -#: whatsnew/3.10.rst:1833 +#: whatsnew/3.10.rst:1834 msgid "" "Removed the :c:func:`!PyModule_GetWarningsModule` function that was useless " "now due to the :mod:`!_warnings` module was converted to a builtin module in " "2.6. (Contributed by Hai Shi in :issue:`42599`.)" msgstr "" -#: whatsnew/3.10.rst:1837 +#: whatsnew/3.10.rst:1838 msgid "" "Remove deprecated aliases to :ref:`collections-abstract-base-classes` from " "the :mod:`collections` module. (Contributed by Victor Stinner in :issue:" "`37324`.)" msgstr "" -#: whatsnew/3.10.rst:1841 +#: whatsnew/3.10.rst:1842 msgid "" "The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" "doc:`high-level API <../library/asyncio-api-index>` following deprecation in " "Python 3.8. The motivation behind this change is multifold:" msgstr "" -#: whatsnew/3.10.rst:1845 +#: whatsnew/3.10.rst:1846 msgid "This simplifies the high-level API." msgstr "" -#: whatsnew/3.10.rst:1846 +#: whatsnew/3.10.rst:1847 msgid "" "The functions in the high-level API have been implicitly getting the current " "thread's running event loop since Python 3.7. There isn't a need to pass " "the event loop to the API in most normal use cases." msgstr "" -#: whatsnew/3.10.rst:1849 +#: whatsnew/3.10.rst:1850 msgid "" "Event loop passing is error-prone especially when dealing with loops running " "in different threads." msgstr "" -#: whatsnew/3.10.rst:1852 +#: whatsnew/3.10.rst:1853 msgid "" "Note that the low-level API will still accept ``loop``. See :ref:`changes-" "python-api` for examples of how to replace existing code." msgstr "" -#: whatsnew/3.10.rst:1927 +#: whatsnew/3.10.rst:1928 msgid "" "(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle " "Stanley in :issue:`42392`.)" msgstr "" -#: whatsnew/3.10.rst:2147 +#: whatsnew/3.10.rst:2148 msgid "Porting to Python 3.10" msgstr "" -#: whatsnew/3.10.rst:1862 +#: whatsnew/3.10.rst:1863 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: whatsnew/3.10.rst:1867 +#: whatsnew/3.10.rst:1868 msgid "Changes in the Python syntax" msgstr "" -#: whatsnew/3.10.rst:1869 +#: whatsnew/3.10.rst:1870 msgid "" "Deprecation warning is now emitted when compiling previously valid syntax if " "the numeric literal is immediately followed by a keyword (like in ``0in " @@ -2376,11 +2795,11 @@ msgid "" "following keyword. (Contributed by Serhiy Storchaka in :issue:`43833`.)" msgstr "" -#: whatsnew/3.10.rst:1880 +#: whatsnew/3.10.rst:1881 msgid "Changes in the Python API" msgstr "" -#: whatsnew/3.10.rst:1882 +#: whatsnew/3.10.rst:1883 msgid "" "The *etype* parameters of the :func:`~traceback.format_exception`, :func:" "`~traceback.format_exception_only`, and :func:`~traceback.print_exception` " @@ -2388,7 +2807,7 @@ msgid "" "(Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" msgstr "" -#: whatsnew/3.10.rst:1888 +#: whatsnew/3.10.rst:1889 msgid "" ":mod:`atexit`: At Python exit, if a callback registered with :func:`atexit." "register` fails, its exception is now logged. Previously, only some " @@ -2396,7 +2815,7 @@ msgid "" "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" -#: whatsnew/3.10.rst:1894 +#: whatsnew/3.10.rst:1895 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " @@ -2409,7 +2828,7 @@ msgid "" "`42195`.)" msgstr "" -#: whatsnew/3.10.rst:1904 +#: whatsnew/3.10.rst:1905 msgid "" ":meth:`socket.htons` and :meth:`socket.ntohs` now raise :exc:`OverflowError` " "instead of :exc:`DeprecationWarning` if the given parameter will not fit in " @@ -2417,29 +2836,41 @@ msgid "" "`42393`.)" msgstr "" -#: whatsnew/3.10.rst:1909 +#: whatsnew/3.10.rst:1910 msgid "" "The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" "doc:`high-level API <../library/asyncio-api-index>` following deprecation in " "Python 3.8." msgstr "" -#: whatsnew/3.10.rst:1913 +#: whatsnew/3.10.rst:1914 msgid "A coroutine that currently looks like this::" msgstr "" -#: whatsnew/3.10.rst:1918 +#: whatsnew/3.10.rst:1916 +msgid "" +"async def foo(loop):\n" +" await asyncio.sleep(1, loop=loop)" +msgstr "" + +#: whatsnew/3.10.rst:1919 msgid "Should be replaced with this::" msgstr "" -#: whatsnew/3.10.rst:1923 +#: whatsnew/3.10.rst:1921 +msgid "" +"async def foo():\n" +" await asyncio.sleep(1)" +msgstr "" + +#: whatsnew/3.10.rst:1924 msgid "" "If ``foo()`` was specifically designed *not* to run in the current thread's " "running event loop (e.g. running in another thread's event loop), consider " "using :func:`asyncio.run_coroutine_threadsafe` instead." msgstr "" -#: whatsnew/3.10.rst:1930 +#: whatsnew/3.10.rst:1931 msgid "" "The :data:`types.FunctionType` constructor now inherits the current builtins " "if the *globals* dictionary has no ``\"__builtins__\"`` key, rather than " @@ -2450,11 +2881,11 @@ msgid "" "`42990`.)" msgstr "" -#: whatsnew/3.10.rst:1939 +#: whatsnew/3.10.rst:1940 msgid "Changes in the C API" msgstr "" -#: whatsnew/3.10.rst:1941 +#: whatsnew/3.10.rst:1942 msgid "" "The C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " @@ -2463,31 +2894,31 @@ msgid "" "PEG parser." msgstr "" -#: whatsnew/3.10.rst:1947 +#: whatsnew/3.10.rst:1948 msgid "" "Source should be now be compiled directly to a code object using, for " "example, :c:func:`Py_CompileString`. The resulting code object can then be " "evaluated using, for example, :c:func:`PyEval_EvalCode`." msgstr "" -#: whatsnew/3.10.rst:1951 +#: whatsnew/3.10.rst:1952 msgid "Specifically:" msgstr "" -#: whatsnew/3.10.rst:1953 +#: whatsnew/3.10.rst:1954 msgid "" "A call to ``PyParser_SimpleParseStringFlags`` followed by ``PyNode_Compile`` " "can be replaced by calling :c:func:`Py_CompileString`." msgstr "" -#: whatsnew/3.10.rst:1956 +#: whatsnew/3.10.rst:1957 msgid "" "There is no direct replacement for ``PyParser_SimpleParseFileFlags``. To " "compile code from a ``FILE *`` argument, you will need to read the file in C " "and pass the resulting buffer to :c:func:`Py_CompileString`." msgstr "" -#: whatsnew/3.10.rst:1960 +#: whatsnew/3.10.rst:1961 msgid "" "To compile a file given a ``char *`` filename, explicitly open the file, " "read it and compile the result. One way to do this is using the :py:mod:`io` " @@ -2496,7 +2927,18 @@ msgid "" "(Declarations and error handling are omitted.) ::" msgstr "" -#: whatsnew/3.10.rst:1973 +#: whatsnew/3.10.rst:1967 +msgid "" +"io_module = Import_ImportModule(\"io\");\n" +"fileobject = PyObject_CallMethod(io_module, \"open\", \"ss\", filename, " +"\"rb\");\n" +"source_bytes_object = PyObject_CallMethod(fileobject, \"read\", \"\");\n" +"result = PyObject_CallMethod(fileobject, \"close\", \"\");\n" +"source_buf = PyBytes_AsString(source_bytes_object);\n" +"code = Py_CompileString(source_buf, filename, Py_file_input);" +msgstr "" + +#: whatsnew/3.10.rst:1974 msgid "" "For ``FrameObject`` objects, the :attr:`~frame.f_lasti` member now " "represents a wordcode offset instead of a simple offset into the bytecode " @@ -2507,53 +2949,53 @@ msgid "" "`PyFrame_GetLineNumber` instead." msgstr "" -#: whatsnew/3.10.rst:1981 +#: whatsnew/3.10.rst:1982 msgid "CPython bytecode changes" msgstr "" -#: whatsnew/3.10.rst:1983 +#: whatsnew/3.10.rst:1984 msgid "" "The ``MAKE_FUNCTION`` instruction now accepts either a dict or a tuple of " "strings as the function's annotations. (Contributed by Yurii Karabas and " "Inada Naoki in :issue:`42202`.)" msgstr "" -#: whatsnew/3.10.rst:1988 +#: whatsnew/3.10.rst:1989 msgid "Build Changes" msgstr "" -#: whatsnew/3.10.rst:1990 +#: whatsnew/3.10.rst:1991 msgid "" ":pep:`644`: Python now requires OpenSSL 1.1.1 or newer. OpenSSL 1.0.2 is no " "longer supported. (Contributed by Christian Heimes in :issue:`43669`.)" msgstr "" -#: whatsnew/3.10.rst:1994 +#: whatsnew/3.10.rst:1995 msgid "" "The C99 functions :c:func:`snprintf` and :c:func:`vsnprintf` are now " "required to build Python. (Contributed by Victor Stinner in :issue:`36020`.)" msgstr "" -#: whatsnew/3.10.rst:1998 +#: whatsnew/3.10.rst:1999 msgid "" ":mod:`sqlite3` requires SQLite 3.7.15 or higher. (Contributed by Sergey " "Fedoseev and Erlend E. Aasland in :issue:`40744` and :issue:`40810`.)" msgstr "" -#: whatsnew/3.10.rst:2001 +#: whatsnew/3.10.rst:2002 msgid "" "The :mod:`atexit` module must now always be built as a built-in module. " "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" -#: whatsnew/3.10.rst:2004 +#: whatsnew/3.10.rst:2005 msgid "" "Add :option:`--disable-test-modules` option to the ``configure`` script: " "don't build nor install test modules. (Contributed by Xavier de Gaye, Thomas " "Petazzoni and Peixing Xin in :issue:`27640`.)" msgstr "" -#: whatsnew/3.10.rst:2008 +#: whatsnew/3.10.rst:2009 msgid "" "Add :option:`--with-wheel-pkg-dir=PATH option <--with-wheel-pkg-dir>` to the " "``./configure`` script. If specified, the :mod:`ensurepip` module looks for " @@ -2562,7 +3004,7 @@ msgid "" "packages." msgstr "" -#: whatsnew/3.10.rst:2014 +#: whatsnew/3.10.rst:2015 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" @@ -2570,22 +3012,22 @@ msgid "" "_bundled`` package." msgstr "" -#: whatsnew/3.10.rst:2019 +#: whatsnew/3.10.rst:2020 msgid "(Contributed by Victor Stinner in :issue:`42856`.)" msgstr "" -#: whatsnew/3.10.rst:2021 +#: whatsnew/3.10.rst:2022 msgid "" "Add a new :option:`configure --without-static-libpython option <--without-" "static-libpython>` to not build the ``libpythonMAJOR.MINOR.a`` static " "library and not install the ``python.o`` object file." msgstr "" -#: whatsnew/3.10.rst:2025 +#: whatsnew/3.10.rst:2026 msgid "(Contributed by Victor Stinner in :issue:`43103`.)" msgstr "" -#: whatsnew/3.10.rst:2027 +#: whatsnew/3.10.rst:2028 msgid "" "The ``configure`` script now uses the ``pkg-config`` utility, if available, " "to detect the location of Tcl/Tk headers and libraries. As before, those " @@ -2594,7 +3036,7 @@ msgid "" "Stamatogiannakis in :issue:`42603`.)" msgstr "" -#: whatsnew/3.10.rst:2033 +#: whatsnew/3.10.rst:2034 msgid "" "Add :option:`--with-openssl-rpath` option to ``configure`` script. The " "option simplifies building Python with a custom OpenSSL installation, e.g. " @@ -2602,15 +3044,15 @@ msgid "" "(Contributed by Christian Heimes in :issue:`43466`.)" msgstr "" -#: whatsnew/3.10.rst:2040 +#: whatsnew/3.10.rst:2041 msgid "C API Changes" msgstr "" -#: whatsnew/3.10.rst:2043 +#: whatsnew/3.10.rst:2044 msgid "PEP 652: Maintaining the Stable ABI" msgstr "" -#: whatsnew/3.10.rst:2045 +#: whatsnew/3.10.rst:2046 msgid "" "The Stable ABI (Application Binary Interface) for extension modules or " "embedding Python is now explicitly defined. :ref:`stable` describes C API " @@ -2618,25 +3060,25 @@ msgid "" "ABI." msgstr "" -#: whatsnew/3.10.rst:2050 +#: whatsnew/3.10.rst:2051 msgid "(Contributed by Petr Viktorin in :pep:`652` and :issue:`43795`.)" msgstr "" -#: whatsnew/3.10.rst:2055 +#: whatsnew/3.10.rst:2056 msgid "" "The result of :c:func:`PyNumber_Index` now always has exact type :class:" "`int`. Previously, the result could have been an instance of a subclass of " "``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" msgstr "" -#: whatsnew/3.10.rst:2059 +#: whatsnew/3.10.rst:2060 msgid "" "Add a new :c:member:`~PyConfig.orig_argv` member to the :c:type:`PyConfig` " "structure: the list of the original command line arguments passed to the " "Python executable. (Contributed by Victor Stinner in :issue:`23427`.)" msgstr "" -#: whatsnew/3.10.rst:2064 +#: whatsnew/3.10.rst:2065 msgid "" "The :c:func:`PyDateTime_DATE_GET_TZINFO` and :c:func:" "`PyDateTime_TIME_GET_TZINFO` macros have been added for accessing the " @@ -2644,72 +3086,72 @@ msgid "" "time` objects. (Contributed by Zackery Spytz in :issue:`30155`.)" msgstr "" -#: whatsnew/3.10.rst:2070 +#: whatsnew/3.10.rst:2071 msgid "" "Add a :c:func:`PyCodec_Unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" -#: whatsnew/3.10.rst:2074 +#: whatsnew/3.10.rst:2075 msgid "" "The :c:func:`PyIter_Send` function was added to allow sending value into " "iterator without raising ``StopIteration`` exception. (Contributed by " "Vladimir Matveev in :issue:`41756`.)" msgstr "" -#: whatsnew/3.10.rst:2078 +#: whatsnew/3.10.rst:2079 msgid "" "Add :c:func:`PyUnicode_AsUTF8AndSize` to the limited C API. (Contributed by " "Alex Gaynor in :issue:`41784`.)" msgstr "" -#: whatsnew/3.10.rst:2081 +#: whatsnew/3.10.rst:2082 msgid "" "Add :c:func:`PyModule_AddObjectRef` function: similar to :c:func:" "`PyModule_AddObject` but don't steal a reference to the value on success. " "(Contributed by Victor Stinner in :issue:`1635741`.)" msgstr "" -#: whatsnew/3.10.rst:2086 +#: whatsnew/3.10.rst:2087 msgid "" "Add :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment the " "reference count of an object and return the object. (Contributed by Victor " "Stinner in :issue:`42262`.)" msgstr "" -#: whatsnew/3.10.rst:2090 +#: whatsnew/3.10.rst:2091 msgid "" "The :c:func:`PyType_FromSpecWithBases` and :c:func:" "`PyType_FromModuleAndSpec` functions now accept a single class as the " "*bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" msgstr "" -#: whatsnew/3.10.rst:2094 +#: whatsnew/3.10.rst:2095 msgid "" "The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc`` " "slot. (Contributed by Hai Shi in :issue:`41832`.)" msgstr "" -#: whatsnew/3.10.rst:2098 +#: whatsnew/3.10.rst:2099 msgid "" "The :c:func:`PyType_GetSlot` function can accept :ref:`static types `. (Contributed by Hai Shi and Petr Viktorin in :issue:`41073`.)" msgstr "" -#: whatsnew/3.10.rst:2102 +#: whatsnew/3.10.rst:2103 msgid "" "Add a new :c:func:`PySet_CheckExact` function to the C-API to check if an " "object is an instance of :class:`set` but not an instance of a subtype. " "(Contributed by Pablo Galindo in :issue:`43277`.)" msgstr "" -#: whatsnew/3.10.rst:2106 +#: whatsnew/3.10.rst:2107 msgid "" "Add :c:func:`PyErr_SetInterruptEx` which allows passing a signal number to " "simulate. (Contributed by Antoine Pitrou in :issue:`43356`.)" msgstr "" -#: whatsnew/3.10.rst:2110 +#: whatsnew/3.10.rst:2111 msgid "" "The limited C API is now supported if :ref:`Python is built in debug mode " "` (if the ``Py_DEBUG`` macro is defined). In the limited C API, " @@ -2722,14 +3164,14 @@ msgid "" "`36465`)." msgstr "" -#: whatsnew/3.10.rst:2120 +#: whatsnew/3.10.rst:2121 msgid "" "The limited C API is still not supported in the :option:`--with-trace-refs` " "special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner in :" "issue:`43688`.)" msgstr "" -#: whatsnew/3.10.rst:2124 +#: whatsnew/3.10.rst:2125 msgid "" "Add the :c:func:`Py_Is(x, y) ` function to test if the *x* object is " "the *y* object, the same as ``x is y`` in Python. Add also the :c:func:" @@ -2739,7 +3181,7 @@ msgid "" "`43753`.)" msgstr "" -#: whatsnew/3.10.rst:2131 +#: whatsnew/3.10.rst:2132 msgid "" "Add new functions to control the garbage collector from C code: :c:func:" "`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. These " @@ -2747,20 +3189,20 @@ msgid "" "collector from C code without having to import the :mod:`gc` module." msgstr "" -#: whatsnew/3.10.rst:2138 +#: whatsnew/3.10.rst:2139 msgid "" "Add a new :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` type flag to disallow " "creating type instances. (Contributed by Victor Stinner in :issue:`43916`.)" msgstr "" -#: whatsnew/3.10.rst:2142 +#: whatsnew/3.10.rst:2143 msgid "" "Add a new :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag for creating " "immutable type objects: type attributes cannot be set nor deleted. " "(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)" msgstr "" -#: whatsnew/3.10.rst:2149 +#: whatsnew/3.10.rst:2150 msgid "" "The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use :c:func:" "`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use ``#``: " @@ -2769,7 +3211,7 @@ msgid "" "`40943`.)" msgstr "" -#: whatsnew/3.10.rst:2155 +#: whatsnew/3.10.rst:2156 msgid "" "Since :c:func:`Py_REFCNT()` is changed to the inline static function, " "``Py_REFCNT(obj) = new_refcnt`` must be replaced with ``Py_SET_REFCNT(obj, " @@ -2777,18 +3219,25 @@ msgid "" "For backward compatibility, this macro can be used::" msgstr "" -#: whatsnew/3.10.rst:2164 +#: whatsnew/3.10.rst:2161 +msgid "" +"#if PY_VERSION_HEX < 0x030900A4\n" +"# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)\n" +"#endif" +msgstr "" + +#: whatsnew/3.10.rst:2165 msgid "(Contributed by Victor Stinner in :issue:`39573`.)" msgstr "" -#: whatsnew/3.10.rst:2166 +#: whatsnew/3.10.rst:2167 msgid "" "Calling :c:func:`PyDict_GetItem` without :term:`GIL` held had been allowed " "for historical reason. It is no longer allowed. (Contributed by Victor " "Stinner in :issue:`40839`.)" msgstr "" -#: whatsnew/3.10.rst:2170 +#: whatsnew/3.10.rst:2171 msgid "" "``PyUnicode_FromUnicode(NULL, size)`` and " "``PyUnicode_FromStringAndSize(NULL, size)`` raise ``DeprecationWarning`` " @@ -2796,14 +3245,14 @@ msgid "" "data. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: whatsnew/3.10.rst:2175 +#: whatsnew/3.10.rst:2176 msgid "" "The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API " "``unicodedata.ucnhash_CAPI`` has been moved to the internal C API. " "(Contributed by Victor Stinner in :issue:`42157`.)" msgstr "" -#: whatsnew/3.10.rst:2179 +#: whatsnew/3.10.rst:2180 msgid "" ":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:" "func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and :c:func:" @@ -2813,7 +3262,7 @@ msgid "" "Stinner in :issue:`42260`.)" msgstr "" -#: whatsnew/3.10.rst:2186 +#: whatsnew/3.10.rst:2187 msgid "" ":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and :c:func:" "`PyCell_SET` macros can no longer be used as l-value or r-value. For " @@ -2823,7 +3272,7 @@ msgid "" "and Victor Stinner in :issue:`30459`.)" msgstr "" -#: whatsnew/3.10.rst:2193 +#: whatsnew/3.10.rst:2194 msgid "" "The non-limited API files ``odictobject.h``, ``parser_interface.h``, " "``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, ``pyfpe." @@ -2834,7 +3283,7 @@ msgid "" "issue:`35134`.)" msgstr "" -#: whatsnew/3.10.rst:2201 +#: whatsnew/3.10.rst:2202 msgid "" "Use the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable " "type objects. Do not rely on :c:macro:`Py_TPFLAGS_HEAPTYPE` to decide if a " @@ -2843,85 +3292,85 @@ msgid "" "issue:`43908`.)" msgstr "" -#: whatsnew/3.10.rst:2207 +#: whatsnew/3.10.rst:2208 msgid "" "The undocumented function ``Py_FrozenMain`` has been removed from the " "limited API. The function is mainly useful for custom builds of Python. " "(Contributed by Petr Viktorin in :issue:`26241`.)" msgstr "" -#: whatsnew/3.10.rst:2214 +#: whatsnew/3.10.rst:2215 msgid "" "The ``PyUnicode_InternImmortal()`` function is now deprecated and will be " "removed in Python 3.12: use :c:func:`PyUnicode_InternInPlace` instead. " "(Contributed by Victor Stinner in :issue:`41692`.)" msgstr "" -#: whatsnew/3.10.rst:2222 +#: whatsnew/3.10.rst:2223 msgid "" "Removed ``Py_UNICODE_str*`` functions manipulating ``Py_UNICODE*`` strings. " "(Contributed by Inada Naoki in :issue:`41123`.)" msgstr "" -#: whatsnew/3.10.rst:2225 +#: whatsnew/3.10.rst:2226 msgid "" "``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or :c:macro:" "`PyUnicode_GET_LENGTH`" msgstr "" -#: whatsnew/3.10.rst:2227 +#: whatsnew/3.10.rst:2228 msgid "" "``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" "`PyUnicode_FromFormat`" msgstr "" -#: whatsnew/3.10.rst:2229 +#: whatsnew/3.10.rst:2230 msgid "" "``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use :c:func:" "`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -#: whatsnew/3.10.rst:2231 +#: whatsnew/3.10.rst:2232 msgid "``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`" msgstr "" -#: whatsnew/3.10.rst:2232 +#: whatsnew/3.10.rst:2233 msgid "``Py_UNICODE_strncmp``: use :c:func:`PyUnicode_Tailmatch`" msgstr "" -#: whatsnew/3.10.rst:2233 +#: whatsnew/3.10.rst:2234 msgid "" "``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use :c:func:" "`PyUnicode_FindChar`" msgstr "" -#: whatsnew/3.10.rst:2236 +#: whatsnew/3.10.rst:2237 msgid "" "Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs. " "(Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" -#: whatsnew/3.10.rst:2239 +#: whatsnew/3.10.rst:2240 msgid "" "Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:" "`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" -#: whatsnew/3.10.rst:2242 +#: whatsnew/3.10.rst:2243 msgid "" "Removed ``PyUnicode_AsUnicodeCopy()``. Please use :c:func:" "`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` (Contributed " "by Inada Naoki in :issue:`41103`.)" msgstr "" -#: whatsnew/3.10.rst:2246 +#: whatsnew/3.10.rst:2247 msgid "" "Removed ``_Py_CheckRecursionLimit`` variable: it has been replaced by " "``ceval.recursion_limit`` of the :c:type:`PyInterpreterState` structure. " "(Contributed by Victor Stinner in :issue:`41834`.)" msgstr "" -#: whatsnew/3.10.rst:2250 +#: whatsnew/3.10.rst:2251 msgid "" "Removed undocumented macros ``Py_ALLOW_RECURSION`` and " "``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the :c:" @@ -2929,14 +3378,14 @@ msgid "" "issue:`41936`.)" msgstr "" -#: whatsnew/3.10.rst:2255 +#: whatsnew/3.10.rst:2256 msgid "" "Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing " "Python already implicitly installs signal handlers: see :c:member:`PyConfig." "install_signal_handlers`. (Contributed by Victor Stinner in :issue:`41713`.)" msgstr "" -#: whatsnew/3.10.rst:2260 +#: whatsnew/3.10.rst:2261 msgid "" "Remove the ``PyAST_Validate()`` function. It is no longer possible to build " "a AST object (``mod_ty`` type) with the public C API. The function was " @@ -2944,48 +3393,48 @@ msgid "" "Stinner in :issue:`43244`.)" msgstr "" -#: whatsnew/3.10.rst:2265 +#: whatsnew/3.10.rst:2266 msgid "Remove the ``symtable.h`` header file and the undocumented functions:" msgstr "" -#: whatsnew/3.10.rst:2267 +#: whatsnew/3.10.rst:2268 msgid "``PyST_GetScope()``" msgstr "" -#: whatsnew/3.10.rst:2268 +#: whatsnew/3.10.rst:2269 msgid "``PySymtable_Build()``" msgstr "" -#: whatsnew/3.10.rst:2269 +#: whatsnew/3.10.rst:2270 msgid "``PySymtable_BuildObject()``" msgstr "" -#: whatsnew/3.10.rst:2270 +#: whatsnew/3.10.rst:2271 msgid "``PySymtable_Free()``" msgstr "" -#: whatsnew/3.10.rst:2271 +#: whatsnew/3.10.rst:2272 msgid "``Py_SymtableString()``" msgstr "" -#: whatsnew/3.10.rst:2272 +#: whatsnew/3.10.rst:2273 msgid "``Py_SymtableStringObject()``" msgstr "" -#: whatsnew/3.10.rst:2274 +#: whatsnew/3.10.rst:2275 msgid "" "The ``Py_SymtableString()`` function was part the stable ABI by mistake but " "it could not be used, because the ``symtable.h`` header file was excluded " "from the limited C API." msgstr "" -#: whatsnew/3.10.rst:2278 +#: whatsnew/3.10.rst:2279 msgid "" "Use Python :mod:`symtable` module instead. (Contributed by Victor Stinner " "in :issue:`43244`.)" msgstr "" -#: whatsnew/3.10.rst:2281 +#: whatsnew/3.10.rst:2282 msgid "" "Remove :c:func:`PyOS_ReadlineFunctionPointer` from the limited C API headers " "and from ``python3.dll``, the library that provides the stable ABI on " @@ -2993,7 +3442,7 @@ msgid "" "cannot be guaranteed. (Contributed by Petr Viktorin in :issue:`43868`.)" msgstr "" -#: whatsnew/3.10.rst:2287 +#: whatsnew/3.10.rst:2288 msgid "" "Remove ``ast.h``, ``asdl.h``, and ``Python-ast.h`` header files. These " "functions were undocumented and excluded from the limited C API. Most names " @@ -3004,107 +3453,106 @@ msgid "" "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" -#: whatsnew/3.10.rst:2295 +#: whatsnew/3.10.rst:2296 msgid "" "Remove the compiler and parser functions using ``struct _mod`` type, because " "the public AST C API was removed:" msgstr "" -#: whatsnew/3.10.rst:2298 +#: whatsnew/3.10.rst:2299 msgid "``PyAST_Compile()``" msgstr "" -#: whatsnew/3.10.rst:2299 +#: whatsnew/3.10.rst:2300 msgid "``PyAST_CompileEx()``" msgstr "" -#: whatsnew/3.10.rst:2300 +#: whatsnew/3.10.rst:2301 msgid "``PyAST_CompileObject()``" msgstr "" -#: whatsnew/3.10.rst:2301 +#: whatsnew/3.10.rst:2302 msgid "``PyFuture_FromAST()``" msgstr "" -#: whatsnew/3.10.rst:2302 +#: whatsnew/3.10.rst:2303 msgid "``PyFuture_FromASTObject()``" msgstr "" -#: whatsnew/3.10.rst:2303 +#: whatsnew/3.10.rst:2304 msgid "``PyParser_ASTFromFile()``" msgstr "" -#: whatsnew/3.10.rst:2304 +#: whatsnew/3.10.rst:2305 msgid "``PyParser_ASTFromFileObject()``" msgstr "" -#: whatsnew/3.10.rst:2305 +#: whatsnew/3.10.rst:2306 msgid "``PyParser_ASTFromFilename()``" msgstr "" -#: whatsnew/3.10.rst:2306 +#: whatsnew/3.10.rst:2307 msgid "``PyParser_ASTFromString()``" msgstr "" -#: whatsnew/3.10.rst:2307 +#: whatsnew/3.10.rst:2308 msgid "``PyParser_ASTFromStringObject()``" msgstr "" -#: whatsnew/3.10.rst:2309 +#: whatsnew/3.10.rst:2310 msgid "" "These functions were undocumented and excluded from the limited C API. " "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" -#: whatsnew/3.10.rst:2312 +#: whatsnew/3.10.rst:2313 msgid "Remove the ``pyarena.h`` header file with functions:" msgstr "" -#: whatsnew/3.10.rst:2314 +#: whatsnew/3.10.rst:2315 msgid "``PyArena_New()``" msgstr "" -#: whatsnew/3.10.rst:2315 +#: whatsnew/3.10.rst:2316 msgid "``PyArena_Free()``" msgstr "" -#: whatsnew/3.10.rst:2316 +#: whatsnew/3.10.rst:2317 msgid "``PyArena_Malloc()``" msgstr "" -#: whatsnew/3.10.rst:2317 +#: whatsnew/3.10.rst:2318 msgid "``PyArena_AddPyObject()``" msgstr "" -#: whatsnew/3.10.rst:2319 +#: whatsnew/3.10.rst:2320 msgid "" "These functions were undocumented, excluded from the limited C API, and were " "only used internally by the compiler. (Contributed by Victor Stinner in :" "issue:`43244`.)" msgstr "" -#: whatsnew/3.10.rst:2323 +#: whatsnew/3.10.rst:2324 msgid "" "The ``PyThreadState.use_tracing`` member has been removed to optimize " "Python. (Contributed by Mark Shannon in :issue:`43760`.)" msgstr "" -#: whatsnew/3.10.rst:2328 +#: whatsnew/3.10.rst:2329 msgid "Notable security feature in 3.10.7" msgstr "" -#: whatsnew/3.10.rst:2330 +#: whatsnew/3.10.rst:2331 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " "now raises a :exc:`ValueError` if the number of digits in string form is " "above a limit to avoid potential denial of service attacks due to the " -"algorithmic complexity. This is a mitigation for `CVE-2020-10735 `_. This limit can be " -"configured or disabled by environment variable, command line flag, or :mod:" -"`sys` APIs. See the :ref:`integer string conversion length limitation " -"` documentation. The default limit is 4300 digits in " -"string form." +"algorithmic complexity. This is a mitigation for :cve:`2020-10735`. This " +"limit can be configured or disabled by environment variable, command line " +"flag, or :mod:`sys` APIs. See the :ref:`integer string conversion length " +"limitation ` documentation. The default limit is 4300 " +"digits in string form." msgstr "" #: whatsnew/3.10.rst:2342 diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index cecf809c..382ca4ba 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -133,7 +134,7 @@ msgid "" "pep670>`" msgstr "" -#: whatsnew/3.11.rst:2197 +#: whatsnew/3.11.rst:2211 msgid "New Features" msgstr "" @@ -147,6 +148,18 @@ msgid "" "expression that caused the error, instead of just the line. For example:" msgstr "" +#: whatsnew/3.11.rst:118 +msgid "" +"Traceback (most recent call last):\n" +" File \"distance.py\", line 11, in \n" +" print(manhattan_distance(p1, p2))\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +" File \"distance.py\", line 6, in manhattan_distance\n" +" return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y)\n" +" ^^^^^^^^^\n" +"AttributeError: 'NoneType' object has no attribute 'x'" +msgstr "" + #: whatsnew/3.11.rst:129 msgid "" "Previous versions of the interpreter would point to just the line, making it " @@ -155,10 +168,36 @@ msgid "" "function calls:" msgstr "" +#: whatsnew/3.11.rst:133 +msgid "" +"Traceback (most recent call last):\n" +" File \"query.py\", line 37, in \n" +" magic_arithmetic('foo')\n" +" File \"query.py\", line 18, in magic_arithmetic\n" +" return add_counts(x) / 25\n" +" ^^^^^^^^^^^^^\n" +" File \"query.py\", line 24, in add_counts\n" +" return 25 + query_user(user1) + query_user(user2)\n" +" ^^^^^^^^^^^^^^^^^\n" +" File \"query.py\", line 32, in query_user\n" +" return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)\n" +" ~~~~~~~~~~~~~~~~~~^^^^^\n" +"TypeError: 'NoneType' object is not subscriptable" +msgstr "" + #: whatsnew/3.11.rst:149 msgid "As well as complex arithmetic expressions:" msgstr "" +#: whatsnew/3.11.rst:151 +msgid "" +"Traceback (most recent call last):\n" +" File \"calculation.py\", line 54, in \n" +" result = (x / y / z) * (a / b / c)\n" +" ~~~~~~^~~\n" +"ZeroDivisionError: division by zero" +msgstr "" + #: whatsnew/3.11.rst:159 msgid "" "Additionally, the information used by the enhanced traceback feature is made " @@ -335,10 +374,28 @@ msgid "" "required and one not-required key::" msgstr "" +#: whatsnew/3.11.rst:291 +msgid "" +"class Movie(TypedDict):\n" +" title: str\n" +" year: NotRequired[int]\n" +"\n" +"m1: Movie = {\"title\": \"Black Panther\", \"year\": 2018} # OK\n" +"m2: Movie = {\"title\": \"Star Wars\"} # OK (year is not required)\n" +"m3: Movie = {\"year\": 2022} # ERROR (missing required field title)" +msgstr "" + #: whatsnew/3.11.rst:299 msgid "The following definition is equivalent::" msgstr "" +#: whatsnew/3.11.rst:301 +msgid "" +"class Movie(TypedDict, total=False):\n" +" title: Required[str]\n" +" year: int" +msgstr "" + #: whatsnew/3.11.rst:305 msgid "See :pep:`655` for more details." msgstr "" @@ -369,6 +426,23 @@ msgid "" "return ``self``::" msgstr "" +#: whatsnew/3.11.rst:326 +msgid "" +"class MyLock:\n" +" def __enter__(self) -> Self:\n" +" self.lock()\n" +" return self\n" +"\n" +" ...\n" +"\n" +"class MyInt:\n" +" @classmethod\n" +" def fromhex(cls, s: str) -> Self:\n" +" return cls(int(s, 16))\n" +"\n" +" ..." +msgstr "" + #: whatsnew/3.11.rst:340 msgid "" ":data:`~typing.Self` can also be used to annotate method parameters or " @@ -404,6 +478,25 @@ msgstr "" msgid "For example, a SQL query function could be annotated as follows::" msgstr "" +#: whatsnew/3.11.rst:364 +msgid "" +"def run_query(sql: LiteralString) -> ...\n" +" ...\n" +"\n" +"def caller(\n" +" arbitrary_string: str,\n" +" query_string: LiteralString,\n" +" table_name: LiteralString,\n" +") -> None:\n" +" run_query(\"SELECT * FROM students\") # ok\n" +" run_query(query_string) # ok\n" +" run_query(\"SELECT * FROM \" + table_name) # ok\n" +" run_query(arbitrary_string) # type checker error\n" +" run_query( # type checker error\n" +" f\"SELECT * FROM students WHERE name = {arbitrary_string}\"\n" +" )" +msgstr "" + #: whatsnew/3.11.rst:380 msgid "See :pep:`675` for more details." msgstr "" @@ -431,6 +524,25 @@ msgstr "" msgid "For example::" msgstr "" +#: whatsnew/3.11.rst:399 +msgid "" +"# The create_model decorator is defined by a library.\n" +"@typing.dataclass_transform()\n" +"def create_model(cls: Type[T]) -> Type[T]:\n" +" cls.__init__ = ...\n" +" cls.__eq__ = ...\n" +" cls.__ne__ = ...\n" +" return cls\n" +"\n" +"# The create_model decorator can now be used to create new model classes:\n" +"@create_model\n" +"class CustomerModel:\n" +" id: int\n" +" name: str\n" +"\n" +"c = CustomerModel(id=327, name=\"Eric Idle\")" +msgstr "" + #: whatsnew/3.11.rst:415 msgid "See :pep:`681` for more details." msgstr "" @@ -597,39 +709,38 @@ msgid "" "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " "now raises a :exc:`ValueError` if the number of digits in string form is " "above a limit to avoid potential denial of service attacks due to the " -"algorithmic complexity. This is a mitigation for `CVE-2020-10735 `_. This limit can be " -"configured or disabled by environment variable, command line flag, or :mod:" -"`sys` APIs. See the :ref:`integer string conversion length limitation " -"` documentation. The default limit is 4300 digits in " -"string form." +"algorithmic complexity. This is a mitigation for :cve:`2020-10735`. This " +"limit can be configured or disabled by environment variable, command line " +"flag, or :mod:`sys` APIs. See the :ref:`integer string conversion length " +"limitation ` documentation. The default limit is 4300 " +"digits in string form." msgstr "" -#: whatsnew/3.11.rst:558 +#: whatsnew/3.11.rst:557 msgid "New Modules" msgstr "" -#: whatsnew/3.11.rst:560 +#: whatsnew/3.11.rst:559 msgid "" ":mod:`tomllib`: For parsing `TOML `_. See :pep:`680` for " "more details. (Contributed by Taneli Hukkinen in :issue:`40059`.)" msgstr "" -#: whatsnew/3.11.rst:564 +#: whatsnew/3.11.rst:563 msgid "" ":mod:`wsgiref.types`: :pep:`WSGI <3333>`-specific types for static type " "checking. (Contributed by Sebastian Rittau in :issue:`42012`.)" msgstr "" -#: whatsnew/3.11.rst:572 +#: whatsnew/3.11.rst:571 msgid "Improved Modules" msgstr "" -#: whatsnew/3.11.rst:577 +#: whatsnew/3.11.rst:576 msgid "asyncio" msgstr "" -#: whatsnew/3.11.rst:579 +#: whatsnew/3.11.rst:578 msgid "" "Added the :class:`~asyncio.TaskGroup` class, an :ref:`asynchronous context " "manager ` holding a group of tasks that will wait " @@ -638,7 +749,7 @@ msgid "" "Yury Selivanov and others in :gh:`90908`.)" msgstr "" -#: whatsnew/3.11.rst:586 +#: whatsnew/3.11.rst:585 msgid "" "Added :func:`~asyncio.timeout`, an asynchronous context manager for setting " "a timeout on asynchronous operations. For new code this is recommended over " @@ -646,34 +757,34 @@ msgid "" "gh:`90927`.)" msgstr "" -#: whatsnew/3.11.rst:591 +#: whatsnew/3.11.rst:590 msgid "" "Added the :class:`~asyncio.Runner` class, which exposes the machinery used " "by :func:`~asyncio.run`. (Contributed by Andrew Svetlov in :gh:`91218`.)" msgstr "" -#: whatsnew/3.11.rst:595 +#: whatsnew/3.11.rst:594 msgid "" "Added the :class:`~asyncio.Barrier` class to the synchronization primitives " "in the asyncio library, and the related :exc:`~asyncio.BrokenBarrierError` " "exception. (Contributed by Yves Duprat and Andrew Svetlov in :gh:`87518`.)" msgstr "" -#: whatsnew/3.11.rst:600 +#: whatsnew/3.11.rst:599 msgid "" "Added keyword argument *all_errors* to :meth:`asyncio.loop." "create_connection` so that multiple connection errors can be raised as an :" "exc:`ExceptionGroup`." msgstr "" -#: whatsnew/3.11.rst:603 +#: whatsnew/3.11.rst:602 msgid "" "Added the :meth:`asyncio.StreamWriter.start_tls` method for upgrading " "existing stream-based connections to TLS. (Contributed by Ian Good in :issue:" "`34975`.)" msgstr "" -#: whatsnew/3.11.rst:607 +#: whatsnew/3.11.rst:606 msgid "" "Added raw datagram socket functions to the event loop: :meth:`~asyncio.loop." "sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` and :meth:`~asyncio.loop." @@ -682,29 +793,29 @@ msgid "" "Alex Grönholm in :issue:`46805`.)" msgstr "" -#: whatsnew/3.11.rst:615 +#: whatsnew/3.11.rst:614 msgid "" "Added :meth:`~asyncio.Task.cancelling` and :meth:`~asyncio.Task.uncancel` " "methods to :class:`~asyncio.Task`. These are primarily intended for internal " "use, notably by :class:`~asyncio.TaskGroup`." msgstr "" -#: whatsnew/3.11.rst:624 +#: whatsnew/3.11.rst:623 msgid "contextlib" msgstr "" -#: whatsnew/3.11.rst:626 +#: whatsnew/3.11.rst:625 msgid "" "Added non parallel-safe :func:`~contextlib.chdir` context manager to change " "the current working directory and then restore it on exit. Simple wrapper " "around :func:`~os.chdir`. (Contributed by Filipe Laíns in :issue:`25625`)" msgstr "" -#: whatsnew/3.11.rst:634 +#: whatsnew/3.11.rst:633 msgid "dataclasses" msgstr "" -#: whatsnew/3.11.rst:636 +#: whatsnew/3.11.rst:635 msgid "" "Change field default mutability check, allowing only defaults which are :" "term:`hashable` instead of any object which is not an instance of :class:" @@ -712,17 +823,17 @@ msgid "" "issue:`44674`.)" msgstr "" -#: whatsnew/3.11.rst:645 +#: whatsnew/3.11.rst:644 msgid "datetime" msgstr "" -#: whatsnew/3.11.rst:647 +#: whatsnew/3.11.rst:646 msgid "" "Add :const:`datetime.UTC`, a convenience alias for :attr:`datetime.timezone." "utc`. (Contributed by Kabir Kwatra in :gh:`91973`.)" msgstr "" -#: whatsnew/3.11.rst:650 +#: whatsnew/3.11.rst:649 msgid "" ":meth:`datetime.date.fromisoformat`, :meth:`datetime.time.fromisoformat` " "and :meth:`datetime.datetime.fromisoformat` can now be used to parse most " @@ -730,23 +841,23 @@ msgid "" "minutes). (Contributed by Paul Ganssle in :gh:`80010`.)" msgstr "" -#: whatsnew/3.11.rst:659 +#: whatsnew/3.11.rst:658 msgid "enum" msgstr "" -#: whatsnew/3.11.rst:661 +#: whatsnew/3.11.rst:660 msgid "" "Renamed :class:`!EnumMeta` to :class:`~enum.EnumType` (:class:`!EnumMeta` " "kept as an alias)." msgstr "" -#: whatsnew/3.11.rst:664 +#: whatsnew/3.11.rst:663 msgid "" "Added :class:`~enum.StrEnum`, with members that can be used as (and must be) " "strings." msgstr "" -#: whatsnew/3.11.rst:667 +#: whatsnew/3.11.rst:666 msgid "" "Added :class:`~enum.ReprEnum`, which only modifies the :meth:`~object." "__repr__` of members while returning their literal values (rather than " @@ -754,7 +865,7 @@ msgid "" "func:`str`, :func:`format` and :term:`f-string`\\s)." msgstr "" -#: whatsnew/3.11.rst:673 +#: whatsnew/3.11.rst:672 msgid "" "Changed :meth:`Enum.__format__() ` (the default for :" "func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always produce " @@ -763,34 +874,34 @@ msgid "" "all other enums it will be the enum and member name (e.g. ``Color.RED``)." msgstr "" -#: whatsnew/3.11.rst:679 +#: whatsnew/3.11.rst:678 msgid "" "Added a new *boundary* class parameter to :class:`~enum.Flag` enums and the :" "class:`~enum.FlagBoundary` enum with its options, to control how to handle " "out-of-range flag values." msgstr "" -#: whatsnew/3.11.rst:683 +#: whatsnew/3.11.rst:682 msgid "" "Added the :func:`~enum.verify` enum decorator and the :class:`~enum." "EnumCheck` enum with its options, to check enum classes against several " "specific constraints." msgstr "" -#: whatsnew/3.11.rst:687 +#: whatsnew/3.11.rst:686 msgid "" "Added the :func:`~enum.member` and :func:`~enum.nonmember` decorators, to " "ensure the decorated object is/is not converted to an enum member." msgstr "" -#: whatsnew/3.11.rst:690 +#: whatsnew/3.11.rst:689 msgid "" "Added the :func:`~enum.property` decorator, which works like :func:" "`property` except for enums. Use this instead of :func:`types." "DynamicClassAttribute`." msgstr "" -#: whatsnew/3.11.rst:694 +#: whatsnew/3.11.rst:693 msgid "" "Added the :func:`~enum.global_enum` enum decorator, which adjusts :meth:" "`~object.__repr__` and :meth:`~object.__str__` to show values as members of " @@ -799,80 +910,121 @@ msgid "" "``'RegexFlag.ASCII'``." msgstr "" -#: whatsnew/3.11.rst:700 +#: whatsnew/3.11.rst:699 msgid "" "Enhanced :class:`~enum.Flag` to support :func:`len`, iteration and :keyword:" "`in`/:keyword:`not in` on its members. For example, the following now works: " "``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" msgstr "" -#: whatsnew/3.11.rst:705 +#: whatsnew/3.11.rst:704 msgid "" "Changed :class:`~enum.Enum` and :class:`~enum.Flag` so that members are now " "defined before :meth:`~object.__init_subclass__` is called; :func:`dir` now " "includes methods, etc., from mixed-in data types." msgstr "" -#: whatsnew/3.11.rst:710 +#: whatsnew/3.11.rst:709 msgid "" "Changed :class:`~enum.Flag` to only consider primary values (power of two) " "canonical while composite values (``3``, ``6``, ``10``, etc.) are considered " "aliases; inverted flags are coerced to their positive equivalent." msgstr "" -#: whatsnew/3.11.rst:719 +#: whatsnew/3.11.rst:718 msgid "fcntl" msgstr "" -#: whatsnew/3.11.rst:721 +#: whatsnew/3.11.rst:720 msgid "" "On FreeBSD, the :data:`!F_DUP2FD` and :data:`!F_DUP2FD_CLOEXEC` flags " "respectively are supported, the former equals to ``dup2`` usage while the " "latter set the ``FD_CLOEXEC`` flag in addition." msgstr "" -#: whatsnew/3.11.rst:729 +#: whatsnew/3.11.rst:728 msgid "fractions" msgstr "" -#: whatsnew/3.11.rst:731 +#: whatsnew/3.11.rst:730 msgid "" "Support :PEP:`515`-style initialization of :class:`~fractions.Fraction` from " "string. (Contributed by Sergey B Kirpichev in :issue:`44258`.)" msgstr "" -#: whatsnew/3.11.rst:734 +#: whatsnew/3.11.rst:733 msgid "" ":class:`~fractions.Fraction` now implements an ``__int__`` method, so that " "an ``isinstance(some_fraction, typing.SupportsInt)`` check passes. " "(Contributed by Mark Dickinson in :issue:`44547`.)" msgstr "" -#: whatsnew/3.11.rst:742 +#: whatsnew/3.11.rst:741 msgid "functools" msgstr "" -#: whatsnew/3.11.rst:744 +#: whatsnew/3.11.rst:743 msgid "" -":func:`functools.singledispatch` now supports :data:`types.UnionType` and :" -"data:`typing.Union` as annotations to the dispatch argument.::" +":func:`functools.singledispatch` now supports :class:`types.UnionType` and :" +"class:`typing.Union` as annotations to the dispatch argument.::" msgstr "" -#: whatsnew/3.11.rst:769 +#: whatsnew/3.11.rst:746 +msgid "" +">>> from functools import singledispatch\n" +">>> @singledispatch\n" +"... def fun(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Let me just say,\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> @fun.register\n" +"... def _(arg: int | float, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> from typing import Union\n" +">>> @fun.register\n" +"... def _(arg: Union[list, set], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)\n" +"..." +msgstr "" + +#: whatsnew/3.11.rst:768 msgid "(Contributed by Yurii Karabas in :issue:`46014`.)" msgstr "" -#: whatsnew/3.11.rst:775 +#: whatsnew/3.11.rst:774 +msgid "gzip" +msgstr "" + +#: whatsnew/3.11.rst:776 +msgid "" +"The :func:`gzip.compress` function is now faster when used with the " +"**mtime=0** argument as it delegates the compression entirely to a single :" +"func:`zlib.compress` operation. There is one side effect of this change: The " +"gzip file header contains an \"OS\" byte in its header. That was " +"traditionally always set to a value of 255 representing \"unknown\" by the :" +"mod:`gzip` module. Now, when using :func:`~gzip.compress` with **mtime=0**, " +"it may be set to a different value by the underlying zlib C library Python " +"was linked against. (See :gh:`112346` for details on the side effect.)" +msgstr "" + +#: whatsnew/3.11.rst:789 msgid "hashlib" msgstr "" -#: whatsnew/3.11.rst:777 +#: whatsnew/3.11.rst:791 msgid "" ":func:`hashlib.blake2b` and :func:`hashlib.blake2s` now prefer `libb2`_ over " "Python's vendored copy. (Contributed by Christian Heimes in :issue:`47095`.)" msgstr "" -#: whatsnew/3.11.rst:781 +#: whatsnew/3.11.rst:795 msgid "" "The internal ``_sha3`` module with SHA3 and SHAKE algorithms now uses " "*tiny_sha3* instead of the *Keccak Code Package* to reduce code and binary " @@ -881,47 +1033,47 @@ msgid "" "OpenSSL support. (Contributed by Christian Heimes in :issue:`47098`.)" msgstr "" -#: whatsnew/3.11.rst:788 +#: whatsnew/3.11.rst:802 msgid "" "Add :func:`hashlib.file_digest`, a helper function for efficient hashing of " "files or file-like objects. (Contributed by Christian Heimes in :gh:`89313`.)" msgstr "" -#: whatsnew/3.11.rst:796 +#: whatsnew/3.11.rst:810 msgid "IDLE and idlelib" msgstr "" -#: whatsnew/3.11.rst:798 +#: whatsnew/3.11.rst:812 msgid "" "Apply syntax highlighting to ``.pyi`` files. (Contributed by Alex Waygood " "and Terry Jan Reedy in :issue:`45447`.)" msgstr "" -#: whatsnew/3.11.rst:801 +#: whatsnew/3.11.rst:815 msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -#: whatsnew/3.11.rst:808 +#: whatsnew/3.11.rst:822 msgid "inspect" msgstr "" -#: whatsnew/3.11.rst:810 +#: whatsnew/3.11.rst:824 msgid "" "Add :func:`~inspect.getmembers_static` to return all members without " "triggering dynamic lookup via the descriptor protocol. (Contributed by " "Weipeng Hong in :issue:`30533`.)" msgstr "" -#: whatsnew/3.11.rst:814 +#: whatsnew/3.11.rst:828 msgid "" "Add :func:`~inspect.ismethodwrapper` for checking if the type of an object " "is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :" "issue:`29418`.)" msgstr "" -#: whatsnew/3.11.rst:818 +#: whatsnew/3.11.rst:832 msgid "" "Change the frame-related functions in the :mod:`inspect` module to return " "new :class:`~inspect.FrameInfo` and :class:`~inspect.Traceback` class " @@ -930,46 +1082,46 @@ msgid "" "line number, column and end column). The affected functions are:" msgstr "" -#: whatsnew/3.11.rst:824 +#: whatsnew/3.11.rst:838 msgid ":func:`inspect.getframeinfo`" msgstr "" -#: whatsnew/3.11.rst:825 +#: whatsnew/3.11.rst:839 msgid ":func:`inspect.getouterframes`" msgstr "" -#: whatsnew/3.11.rst:826 +#: whatsnew/3.11.rst:840 msgid ":func:`inspect.getinnerframes`," msgstr "" -#: whatsnew/3.11.rst:827 +#: whatsnew/3.11.rst:841 msgid ":func:`inspect.stack`" msgstr "" -#: whatsnew/3.11.rst:828 +#: whatsnew/3.11.rst:842 msgid ":func:`inspect.trace`" msgstr "" -#: whatsnew/3.11.rst:830 +#: whatsnew/3.11.rst:844 msgid "(Contributed by Pablo Galindo in :gh:`88116`.)" msgstr "" -#: whatsnew/3.11.rst:836 +#: whatsnew/3.11.rst:850 msgid "locale" msgstr "" -#: whatsnew/3.11.rst:838 +#: whatsnew/3.11.rst:852 msgid "" "Add :func:`locale.getencoding` to get the current locale encoding. It is " "similar to ``locale.getpreferredencoding(False)`` but ignores the :ref:" "`Python UTF-8 Mode `." msgstr "" -#: whatsnew/3.11.rst:846 +#: whatsnew/3.11.rst:860 msgid "logging" msgstr "" -#: whatsnew/3.11.rst:848 +#: whatsnew/3.11.rst:862 msgid "" "Added :func:`~logging.getLevelNamesMapping` to return a mapping from logging " "level names (e.g. ``'CRITICAL'``) to the values of their corresponding :ref:" @@ -977,7 +1129,7 @@ msgid "" "`88024`.)" msgstr "" -#: whatsnew/3.11.rst:853 +#: whatsnew/3.11.rst:867 msgid "" "Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method to :" "class:`~logging.handlers.SysLogHandler`, to match :meth:`SocketHandler." @@ -986,23 +1138,23 @@ msgid "" "there is no active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" msgstr "" -#: whatsnew/3.11.rst:865 +#: whatsnew/3.11.rst:879 msgid "math" msgstr "" -#: whatsnew/3.11.rst:867 +#: whatsnew/3.11.rst:881 msgid "" "Add :func:`math.exp2`: return 2 raised to the power of x. (Contributed by " "Gideon Mitchell in :issue:`45917`.)" msgstr "" -#: whatsnew/3.11.rst:870 +#: whatsnew/3.11.rst:884 msgid "" "Add :func:`math.cbrt`: return the cube root of x. (Contributed by Ajith " "Ramachandran in :issue:`44357`.)" msgstr "" -#: whatsnew/3.11.rst:873 +#: whatsnew/3.11.rst:887 msgid "" "The behaviour of two :func:`math.pow` corner cases was changed, for " "consistency with the IEEE 754 specification. The operations ``math.pow(0.0, -" @@ -1011,39 +1163,39 @@ msgid "" "`44339`.)" msgstr "" -#: whatsnew/3.11.rst:879 +#: whatsnew/3.11.rst:893 msgid "" "The :data:`math.nan` value is now always available. (Contributed by Victor " "Stinner in :issue:`46917`.)" msgstr "" -#: whatsnew/3.11.rst:886 +#: whatsnew/3.11.rst:900 msgid "operator" msgstr "" -#: whatsnew/3.11.rst:888 +#: whatsnew/3.11.rst:902 msgid "" "A new function ``operator.call`` has been added, such that ``operator." "call(obj, *args, **kwargs) == obj(*args, **kwargs)``. (Contributed by Antony " "Lee in :issue:`44019`.)" msgstr "" -#: whatsnew/3.11.rst:896 +#: whatsnew/3.11.rst:910 msgid "os" msgstr "" -#: whatsnew/3.11.rst:898 +#: whatsnew/3.11.rst:912 msgid "" "On Windows, :func:`os.urandom` now uses ``BCryptGenRandom()``, instead of " "``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na in :" "issue:`44611`.)" msgstr "" -#: whatsnew/3.11.rst:906 +#: whatsnew/3.11.rst:920 msgid "pathlib" msgstr "" -#: whatsnew/3.11.rst:908 +#: whatsnew/3.11.rst:922 msgid "" ":meth:`~pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` return only " "directories if *pattern* ends with a pathname components separator: :data:" @@ -1051,56 +1203,56 @@ msgid "" "`22276` and :issue:`33392`.)" msgstr "" -#: whatsnew/3.11.rst:917 +#: whatsnew/3.11.rst:931 msgid "re" msgstr "" -#: whatsnew/3.11.rst:919 +#: whatsnew/3.11.rst:933 msgid "" "Atomic grouping (``(?>...)``) and possessive quantifiers (``*+``, ``++``, ``?" "+``, ``{m,n}+``) are now supported in regular expressions. (Contributed by " "Jeffrey C. Jacobs and Serhiy Storchaka in :issue:`433030`.)" msgstr "" -#: whatsnew/3.11.rst:927 +#: whatsnew/3.11.rst:941 msgid "shutil" msgstr "" -#: whatsnew/3.11.rst:929 +#: whatsnew/3.11.rst:943 msgid "" "Add optional parameter *dir_fd* in :func:`shutil.rmtree`. (Contributed by " "Serhiy Storchaka in :issue:`46245`.)" msgstr "" -#: whatsnew/3.11.rst:936 +#: whatsnew/3.11.rst:950 msgid "socket" msgstr "" -#: whatsnew/3.11.rst:938 +#: whatsnew/3.11.rst:952 msgid "" "Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner in :issue:" "`30512`.)" msgstr "" -#: whatsnew/3.11.rst:941 +#: whatsnew/3.11.rst:955 msgid "" ":meth:`~socket.create_connection` has an option to raise, in case of failure " "to connect, an :exc:`ExceptionGroup` containing all errors instead of only " "raising the last error. (Contributed by Irit Katriel in :issue:`29980`.)" msgstr "" -#: whatsnew/3.11.rst:950 +#: whatsnew/3.11.rst:964 msgid "sqlite3" msgstr "" -#: whatsnew/3.11.rst:952 +#: whatsnew/3.11.rst:966 msgid "" "You can now disable the authorizer by passing :const:`None` to :meth:" "`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. Aasland in :" "issue:`44491`.)" msgstr "" -#: whatsnew/3.11.rst:956 +#: whatsnew/3.11.rst:970 msgid "" "Collation name :meth:`~sqlite3.Connection.create_collation` can now contain " "any Unicode character. Collation names with invalid characters now raise :" @@ -1108,7 +1260,7 @@ msgid "" "(Contributed by Erlend E. Aasland in :issue:`44688`.)" msgstr "" -#: whatsnew/3.11.rst:961 +#: whatsnew/3.11.rst:975 msgid "" ":mod:`sqlite3` exceptions now include the SQLite extended error code as :" "attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name as :attr:" @@ -1116,7 +1268,7 @@ msgid "" "Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" msgstr "" -#: whatsnew/3.11.rst:967 +#: whatsnew/3.11.rst:981 msgid "" "Add :meth:`~sqlite3.Connection.setlimit` and :meth:`~sqlite3.Connection." "getlimit` to :class:`sqlite3.Connection` for setting and getting SQLite " @@ -1124,14 +1276,14 @@ msgid "" "`45243`.)" msgstr "" -#: whatsnew/3.11.rst:972 +#: whatsnew/3.11.rst:986 msgid "" ":mod:`sqlite3` now sets :attr:`sqlite3.threadsafety` based on the default " "threading mode the underlying SQLite library has been compiled with. " "(Contributed by Erlend E. Aasland in :issue:`45613`.)" msgstr "" -#: whatsnew/3.11.rst:976 +#: whatsnew/3.11.rst:990 msgid "" ":mod:`sqlite3` C callbacks now use unraisable exceptions if callback " "tracebacks are enabled. Users can now register an :func:`unraisable hook " @@ -1139,14 +1291,14 @@ msgid "" "(Contributed by Erlend E. Aasland in :issue:`45828`.)" msgstr "" -#: whatsnew/3.11.rst:982 +#: whatsnew/3.11.rst:996 msgid "" "Fetch across rollback no longer raises :exc:`~sqlite3.InterfaceError`. " "Instead we leave it to the SQLite library to handle these cases. " "(Contributed by Erlend E. Aasland in :issue:`44092`.)" msgstr "" -#: whatsnew/3.11.rst:986 +#: whatsnew/3.11.rst:1000 msgid "" "Add :meth:`~sqlite3.Connection.serialize` and :meth:`~sqlite3.Connection." "deserialize` to :class:`sqlite3.Connection` for serializing and " @@ -1154,25 +1306,25 @@ msgid "" "`41930`.)" msgstr "" -#: whatsnew/3.11.rst:991 +#: whatsnew/3.11.rst:1005 msgid "" "Add :meth:`~sqlite3.Connection.create_window_function` to :class:`sqlite3." "Connection` for creating aggregate window functions. (Contributed by Erlend " "E. Aasland in :issue:`34916`.)" msgstr "" -#: whatsnew/3.11.rst:995 +#: whatsnew/3.11.rst:1009 msgid "" "Add :meth:`~sqlite3.Connection.blobopen` to :class:`sqlite3.Connection`. :" "class:`sqlite3.Blob` allows incremental I/O operations on blobs. " "(Contributed by Aviv Palivoda and Erlend E. Aasland in :issue:`24905`.)" msgstr "" -#: whatsnew/3.11.rst:1003 +#: whatsnew/3.11.rst:1017 msgid "string" msgstr "" -#: whatsnew/3.11.rst:1005 +#: whatsnew/3.11.rst:1019 msgid "" "Add :meth:`~string.Template.get_identifiers` and :meth:`~string.Template." "is_valid` to :class:`string.Template`, which respectively return all valid " @@ -1180,11 +1332,11 @@ msgid "" "by Ben Kehoe in :gh:`90465`.)" msgstr "" -#: whatsnew/3.11.rst:1015 +#: whatsnew/3.11.rst:1029 msgid "sys" msgstr "" -#: whatsnew/3.11.rst:1017 +#: whatsnew/3.11.rst:1031 msgid "" ":func:`sys.exc_info` now derives the ``type`` and ``traceback`` fields from " "the ``value`` (the exception instance), so when an exception is modified " @@ -1193,24 +1345,24 @@ msgid "" "issue:`45711`.)" msgstr "" -#: whatsnew/3.11.rst:1023 +#: whatsnew/3.11.rst:1037 msgid "" "Add :func:`sys.exception` which returns the active exception instance " "(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel in :" "issue:`46328`.)" msgstr "" -#: whatsnew/3.11.rst:1027 +#: whatsnew/3.11.rst:1041 msgid "" "Add the :data:`sys.flags.safe_path ` flag. (Contributed by Victor " "Stinner in :gh:`57684`.)" msgstr "" -#: whatsnew/3.11.rst:1034 +#: whatsnew/3.11.rst:1048 msgid "sysconfig" msgstr "" -#: whatsnew/3.11.rst:1036 +#: whatsnew/3.11.rst:1050 msgid "" "Three new :ref:`installation schemes ` (*posix_venv*, " "*nt_venv* and *venv*) were added and are used when Python creates new " @@ -1224,11 +1376,11 @@ msgid "" "(Contributed by Miro Hrončok in :issue:`45413`.)" msgstr "" -#: whatsnew/3.11.rst:1053 +#: whatsnew/3.11.rst:1067 msgid "tempfile" msgstr "" -#: whatsnew/3.11.rst:1055 +#: whatsnew/3.11.rst:1069 msgid "" ":class:`~tempfile.SpooledTemporaryFile` objects now fully implement the " "methods of :class:`io.BufferedIOBase` or :class:`io.TextIOBase` (depending " @@ -1237,11 +1389,11 @@ msgid "" "`70363`.)" msgstr "" -#: whatsnew/3.11.rst:1066 +#: whatsnew/3.11.rst:1080 msgid "threading" msgstr "" -#: whatsnew/3.11.rst:1068 +#: whatsnew/3.11.rst:1082 msgid "" "On Unix, if the ``sem_clockwait()`` function is available in the C library " "(glibc 2.30 and newer), the :meth:`threading.Lock.acquire` method now uses " @@ -1251,11 +1403,11 @@ msgid "" "`41710`.)" msgstr "" -#: whatsnew/3.11.rst:1079 +#: whatsnew/3.11.rst:1093 msgid "time" msgstr "" -#: whatsnew/3.11.rst:1081 +#: whatsnew/3.11.rst:1095 msgid "" "On Unix, :func:`time.sleep` now uses the ``clock_nanosleep()`` or " "``nanosleep()`` function, if available, which has a resolution of 1 " @@ -1264,7 +1416,7 @@ msgid "" "Benjamin Szőke and Victor Stinner in :issue:`21302`.)" msgstr "" -#: whatsnew/3.11.rst:1087 +#: whatsnew/3.11.rst:1101 msgid "" "On Windows 8.1 and newer, :func:`time.sleep` now uses a waitable timer based " "on `high-resolution timers `. " "(Contributed by Niklas Rosenstein in :gh:`85542`.)" msgstr "" -#: whatsnew/3.11.rst:1178 +#: whatsnew/3.11.rst:1192 msgid "" ":func:`typing.get_type_hints` no longer adds :data:`~typing.Optional` to " "parameters with ``None`` as a default. (Contributed by Nikita Sobolev in :gh:" "`90353`.)" msgstr "" -#: whatsnew/3.11.rst:1182 +#: whatsnew/3.11.rst:1196 msgid "" ":func:`typing.get_type_hints` now supports evaluating bare stringified :data:" "`~typing.ClassVar` annotations. (Contributed by Gregory Beauregard in :gh:" "`90711`.)" msgstr "" -#: whatsnew/3.11.rst:1186 +#: whatsnew/3.11.rst:1200 msgid "" ":func:`typing.no_type_check` no longer modifies external classes and " "functions. It also now correctly marks classmethods as not to be type " "checked. (Contributed by Nikita Sobolev in :gh:`90729`.)" msgstr "" -#: whatsnew/3.11.rst:1194 +#: whatsnew/3.11.rst:1208 msgid "unicodedata" msgstr "" -#: whatsnew/3.11.rst:1196 +#: whatsnew/3.11.rst:1210 msgid "" "The Unicode database has been updated to version 14.0.0. (Contributed by " "Benjamin Peterson in :issue:`45190`)." msgstr "" -#: whatsnew/3.11.rst:1203 +#: whatsnew/3.11.rst:1217 msgid "unittest" msgstr "" -#: whatsnew/3.11.rst:1205 +#: whatsnew/3.11.rst:1219 msgid "" "Added methods :meth:`~unittest.TestCase.enterContext` and :meth:`~unittest." "TestCase.enterClassContext` of class :class:`~unittest.TestCase`, method :" @@ -1439,11 +1591,11 @@ msgid "" "enterModuleContext`. (Contributed by Serhiy Storchaka in :issue:`45046`.)" msgstr "" -#: whatsnew/3.11.rst:1217 +#: whatsnew/3.11.rst:1231 msgid "venv" msgstr "" -#: whatsnew/3.11.rst:1219 +#: whatsnew/3.11.rst:1233 msgid "" "When new Python virtual environments are created, the *venv* :ref:`sysconfig " "installation scheme ` is used to determine the paths " @@ -1455,11 +1607,11 @@ msgid "" "`45413`.)" msgstr "" -#: whatsnew/3.11.rst:1233 +#: whatsnew/3.11.rst:1247 msgid "warnings" msgstr "" -#: whatsnew/3.11.rst:1235 +#: whatsnew/3.11.rst:1249 msgid "" ":func:`warnings.catch_warnings` now accepts arguments for :func:`warnings." "simplefilter`, providing a more concise way to locally ignore warnings or " @@ -1467,41 +1619,41 @@ msgid "" "`47074`.)" msgstr "" -#: whatsnew/3.11.rst:1243 +#: whatsnew/3.11.rst:1257 msgid "zipfile" msgstr "" -#: whatsnew/3.11.rst:1245 +#: whatsnew/3.11.rst:1259 msgid "" "Added support for specifying member name encoding for reading metadata in a :" "class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " "Stephen J. Turnbull and Serhiy Storchaka in :issue:`28080`.)" msgstr "" -#: whatsnew/3.11.rst:1249 +#: whatsnew/3.11.rst:1263 msgid "" "Added :meth:`ZipFile.mkdir() ` for creating new " "directories inside ZIP archives. (Contributed by Sam Ezeh in :gh:`49083`.)" msgstr "" -#: whatsnew/3.11.rst:1253 +#: whatsnew/3.11.rst:1267 msgid "" "Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` and :attr:" "`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by Miguel " "Brito in :gh:`88261`.)" msgstr "" -#: whatsnew/3.11.rst:1261 +#: whatsnew/3.11.rst:1275 msgid "Optimizations" msgstr "" -#: whatsnew/3.11.rst:1263 +#: whatsnew/3.11.rst:1277 msgid "" "This section covers specific optimizations independent of the :ref:" "`whatsnew311-faster-cpython` project, which is covered in its own section." msgstr "" -#: whatsnew/3.11.rst:1266 +#: whatsnew/3.11.rst:1280 msgid "" "The compiler now optimizes simple :ref:`printf-style % formatting ` on string literals containing only the format codes " @@ -1509,7 +1661,7 @@ msgid "" "string` expression. (Contributed by Serhiy Storchaka in :issue:`28307`.)" msgstr "" -#: whatsnew/3.11.rst:1272 +#: whatsnew/3.11.rst:1286 msgid "" "Integer division (``//``) is better tuned for optimization by compilers. It " "is now around 20% faster on x86-64 when dividing an :class:`int` by a value " @@ -1517,20 +1669,20 @@ msgid "" "gh:`90564`.)" msgstr "" -#: whatsnew/3.11.rst:1277 +#: whatsnew/3.11.rst:1291 msgid "" ":func:`sum` is now nearly 30% faster for integers smaller than ``2**30``. " "(Contributed by Stefan Behnel in :gh:`68264`.)" msgstr "" -#: whatsnew/3.11.rst:1280 +#: whatsnew/3.11.rst:1294 msgid "" "Resizing lists is streamlined for the common case, speeding up :meth:`list." "append` by ≈15% and simple :term:`list comprehension`\\s by up to 20-30% " "(Contributed by Dennis Sweeney in :gh:`91165`.)" msgstr "" -#: whatsnew/3.11.rst:1285 +#: whatsnew/3.11.rst:1299 msgid "" "Dictionaries don't store hash values when all keys are Unicode objects, " "decreasing :class:`dict` size. For example, ``sys.getsizeof(dict." @@ -1538,21 +1690,21 @@ msgid "" "smaller) on 64-bit platforms. (Contributed by Inada Naoki in :issue:`46845`.)" msgstr "" -#: whatsnew/3.11.rst:1291 +#: whatsnew/3.11.rst:1305 msgid "" "Using :class:`asyncio.DatagramProtocol` is now orders of magnitude faster " "when transferring large files over UDP, with speeds over 100 times higher " "for a ≈60 MiB file. (Contributed by msoxzw in :gh:`91487`.)" msgstr "" -#: whatsnew/3.11.rst:1296 +#: whatsnew/3.11.rst:1310 msgid "" ":mod:`math` functions :func:`~math.comb` and :func:`~math.perm` are now ≈10 " "times faster for large arguments (with a larger speedup for larger *k*). " "(Contributed by Serhiy Storchaka in :issue:`37295`.)" msgstr "" -#: whatsnew/3.11.rst:1300 +#: whatsnew/3.11.rst:1314 msgid "" "The :mod:`statistics` functions :func:`~statistics.mean`, :func:`~statistics." "variance` and :func:`~statistics.stdev` now consume iterators in one pass " @@ -1561,17 +1713,17 @@ msgid "" "`90415`.)" msgstr "" -#: whatsnew/3.11.rst:1306 +#: whatsnew/3.11.rst:1320 msgid "" ":func:`unicodedata.normalize` now normalizes pure-ASCII strings in constant " "time. (Contributed by Donghee Na in :issue:`44987`.)" msgstr "" -#: whatsnew/3.11.rst:1314 +#: whatsnew/3.11.rst:1328 msgid "Faster CPython" msgstr "" -#: whatsnew/3.11.rst:1316 +#: whatsnew/3.11.rst:1330 msgid "" "CPython 3.11 is an average of `25% faster `_ than CPython 3.10 as measured with the " @@ -1580,32 +1732,36 @@ msgid "" "overall speedup could be 10-60%." msgstr "" -#: whatsnew/3.11.rst:1323 +#: whatsnew/3.11.rst:1337 msgid "" "This project focuses on two major areas in Python: :ref:`whatsnew311-faster-" "startup` and :ref:`whatsnew311-faster-runtime`. Optimizations not covered by " "this project are listed separately under :ref:`whatsnew311-optimizations`." msgstr "" -#: whatsnew/3.11.rst:1332 +#: whatsnew/3.11.rst:1346 msgid "Faster Startup" msgstr "" -#: whatsnew/3.11.rst:1337 +#: whatsnew/3.11.rst:1351 msgid "Frozen imports / Static code objects" msgstr "" -#: whatsnew/3.11.rst:1339 +#: whatsnew/3.11.rst:1353 msgid "" "Python caches :term:`bytecode` in the :ref:`__pycache__ ` " "directory to speed up module loading." msgstr "" -#: whatsnew/3.11.rst:1342 +#: whatsnew/3.11.rst:1356 msgid "Previously in 3.10, Python module execution looked like this:" msgstr "" -#: whatsnew/3.11.rst:1348 +#: whatsnew/3.11.rst:1358 +msgid "Read __pycache__ -> Unmarshal -> Heap allocated code object -> Evaluate" +msgstr "" + +#: whatsnew/3.11.rst:1362 msgid "" "In Python 3.11, the core modules essential for Python startup are " "\"frozen\". This means that their :ref:`codeobjects` (and bytecode) are " @@ -1613,47 +1769,51 @@ msgid "" "execution process to:" msgstr "" -#: whatsnew/3.11.rst:1357 +#: whatsnew/3.11.rst:1367 +msgid "Statically allocated code object -> Evaluate" +msgstr "" + +#: whatsnew/3.11.rst:1371 msgid "" "Interpreter startup is now 10-15% faster in Python 3.11. This has a big " "impact for short-running programs using Python." msgstr "" -#: whatsnew/3.11.rst:1360 +#: whatsnew/3.11.rst:1374 msgid "" "(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in many issues.)" msgstr "" -#: whatsnew/3.11.rst:1366 +#: whatsnew/3.11.rst:1380 msgid "Faster Runtime" msgstr "" -#: whatsnew/3.11.rst:1371 +#: whatsnew/3.11.rst:1385 msgid "Cheaper, lazy Python frames" msgstr "" -#: whatsnew/3.11.rst:1373 +#: whatsnew/3.11.rst:1387 msgid "" "Python frames, holding execution information, are created whenever Python " "calls a Python function. The following are new frame optimizations:" msgstr "" -#: whatsnew/3.11.rst:1377 +#: whatsnew/3.11.rst:1391 msgid "Streamlined the frame creation process." msgstr "" -#: whatsnew/3.11.rst:1378 +#: whatsnew/3.11.rst:1392 msgid "" "Avoided memory allocation by generously re-using frame space on the C stack." msgstr "" -#: whatsnew/3.11.rst:1379 +#: whatsnew/3.11.rst:1393 msgid "" "Streamlined the internal frame struct to contain only essential information. " "Frames previously held extra debugging and memory management information." msgstr "" -#: whatsnew/3.11.rst:1382 +#: whatsnew/3.11.rst:1396 msgid "" "Old-style :ref:`frame objects ` are now created only when " "requested by debuggers or by Python introspection functions such as :func:" @@ -1663,29 +1823,29 @@ msgid "" "pyperformance." msgstr "" -#: whatsnew/3.11.rst:1389 +#: whatsnew/3.11.rst:1403 msgid "(Contributed by Mark Shannon in :issue:`44590`.)" msgstr "" -#: whatsnew/3.11.rst:1396 +#: whatsnew/3.11.rst:1410 msgid "Inlined Python function calls" msgstr "" -#: whatsnew/3.11.rst:1398 +#: whatsnew/3.11.rst:1412 msgid "" "During a Python function call, Python will call an evaluating C function to " "interpret that function's code. This effectively limits pure Python " "recursion to what's safe for the C stack." msgstr "" -#: whatsnew/3.11.rst:1402 +#: whatsnew/3.11.rst:1416 msgid "" "In 3.11, when CPython detects Python code calling another Python function, " "it sets up a new frame, and \"jumps\" to the new code inside the new frame. " "This avoids calling the C interpreting function altogether." msgstr "" -#: whatsnew/3.11.rst:1406 +#: whatsnew/3.11.rst:1420 msgid "" "Most Python function calls now consume no C stack space, speeding them up. " "In simple recursive functions like fibonacci or factorial, we observed a " @@ -1694,15 +1854,15 @@ msgid "" "setrecursionlimit`). We measured a 1-3% improvement in pyperformance." msgstr "" -#: whatsnew/3.11.rst:1413 +#: whatsnew/3.11.rst:1427 msgid "(Contributed by Pablo Galindo and Mark Shannon in :issue:`45256`.)" msgstr "" -#: whatsnew/3.11.rst:1419 +#: whatsnew/3.11.rst:1433 msgid "PEP 659: Specializing Adaptive Interpreter" msgstr "" -#: whatsnew/3.11.rst:1421 +#: whatsnew/3.11.rst:1435 msgid "" ":pep:`659` is one of the key parts of the Faster CPython project. The " "general idea is that while Python is a dynamic language, most code has " @@ -1710,7 +1870,7 @@ msgid "" "*type stability*." msgstr "" -#: whatsnew/3.11.rst:1425 +#: whatsnew/3.11.rst:1439 msgid "" "At runtime, Python will try to look for common patterns and type stability " "in the executing code. Python will then replace the current operation with a " @@ -1721,13 +1881,13 @@ msgid "" "term:`bytecode`." msgstr "" -#: whatsnew/3.11.rst:1433 +#: whatsnew/3.11.rst:1447 msgid "" "The specializer will also combine certain common instruction pairs into one " "superinstruction, reducing the overhead during execution." msgstr "" -#: whatsnew/3.11.rst:1436 +#: whatsnew/3.11.rst:1450 msgid "" "Python will only specialize when it sees code that is \"hot\" (executed " "multiple times). This prevents Python from wasting time on run-once code. " @@ -1737,279 +1897,279 @@ msgid "" "circumstances." msgstr "" -#: whatsnew/3.11.rst:1443 +#: whatsnew/3.11.rst:1457 msgid "" "(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. See :" "pep:`659` for more information. Implementation by Mark Shannon and Brandt " "Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" msgstr "" -#: whatsnew/3.11.rst:1451 +#: whatsnew/3.11.rst:1465 msgid "Operation" msgstr "" -#: whatsnew/3.11.rst:1451 +#: whatsnew/3.11.rst:1465 msgid "Form" msgstr "" -#: whatsnew/3.11.rst:1451 +#: whatsnew/3.11.rst:1465 msgid "Specialization" msgstr "" -#: whatsnew/3.11.rst:1451 +#: whatsnew/3.11.rst:1465 msgid "Operation speedup (up to)" msgstr "" -#: whatsnew/3.11.rst:1451 +#: whatsnew/3.11.rst:1465 msgid "Contributor(s)" msgstr "" -#: whatsnew/3.11.rst:1454 +#: whatsnew/3.11.rst:1468 msgid "Binary operations" msgstr "" -#: whatsnew/3.11.rst:1454 +#: whatsnew/3.11.rst:1468 msgid "``x + x``" msgstr "" -#: whatsnew/3.11.rst:1456 +#: whatsnew/3.11.rst:1470 msgid "``x - x``" msgstr "" -#: whatsnew/3.11.rst:1458 +#: whatsnew/3.11.rst:1472 msgid "``x * x``" msgstr "" -#: whatsnew/3.11.rst:1454 +#: whatsnew/3.11.rst:1468 msgid "" "Binary add, multiply and subtract for common types such as :class:`int`, :" "class:`float` and :class:`str` take custom fast paths for their underlying " "types." msgstr "" -#: whatsnew/3.11.rst:1454 +#: whatsnew/3.11.rst:1468 msgid "10%" msgstr "" -#: whatsnew/3.11.rst:1454 +#: whatsnew/3.11.rst:1468 msgid "Mark Shannon, Donghee Na, Brandt Bucher, Dennis Sweeney" msgstr "" -#: whatsnew/3.11.rst:1460 +#: whatsnew/3.11.rst:1474 msgid "Subscript" msgstr "" -#: whatsnew/3.11.rst:1460 +#: whatsnew/3.11.rst:1474 msgid "``a[i]``" msgstr "" -#: whatsnew/3.11.rst:1460 +#: whatsnew/3.11.rst:1474 msgid "" "Subscripting container types such as :class:`list`, :class:`tuple` and :" "class:`dict` directly index the underlying data structures." msgstr "" -#: whatsnew/3.11.rst:1464 +#: whatsnew/3.11.rst:1478 msgid "" "Subscripting custom :meth:`~object.__getitem__` is also inlined similar to :" "ref:`inline-calls`." msgstr "" -#: whatsnew/3.11.rst:1467 +#: whatsnew/3.11.rst:1481 msgid "10-25%" msgstr "" -#: whatsnew/3.11.rst:1460 +#: whatsnew/3.11.rst:1474 msgid "Irit Katriel, Mark Shannon" msgstr "" -#: whatsnew/3.11.rst:1467 +#: whatsnew/3.11.rst:1481 msgid "Store subscript" msgstr "" -#: whatsnew/3.11.rst:1467 +#: whatsnew/3.11.rst:1481 msgid "``a[i] = z``" msgstr "" -#: whatsnew/3.11.rst:1467 +#: whatsnew/3.11.rst:1481 msgid "Similar to subscripting specialization above." msgstr "" -#: whatsnew/3.11.rst:1467 +#: whatsnew/3.11.rst:1481 msgid "Dennis Sweeney" msgstr "" -#: whatsnew/3.11.rst:1470 +#: whatsnew/3.11.rst:1484 msgid "Calls" msgstr "" -#: whatsnew/3.11.rst:1470 +#: whatsnew/3.11.rst:1484 msgid "``f(arg)``" msgstr "" -#: whatsnew/3.11.rst:1472 +#: whatsnew/3.11.rst:1486 msgid "``C(arg)``" msgstr "" -#: whatsnew/3.11.rst:1470 +#: whatsnew/3.11.rst:1484 msgid "" "Calls to common builtin (C) functions and types such as :func:`len` and :" "class:`str` directly call their underlying C version. This avoids going " "through the internal calling convention." msgstr "" -#: whatsnew/3.11.rst:1470 +#: whatsnew/3.11.rst:1484 msgid "20%" msgstr "" -#: whatsnew/3.11.rst:1470 +#: whatsnew/3.11.rst:1484 msgid "Mark Shannon, Ken Jin" msgstr "" -#: whatsnew/3.11.rst:1475 +#: whatsnew/3.11.rst:1489 msgid "Load global variable" msgstr "" -#: whatsnew/3.11.rst:1475 +#: whatsnew/3.11.rst:1489 msgid "``print``" msgstr "" -#: whatsnew/3.11.rst:1477 +#: whatsnew/3.11.rst:1491 msgid "``len``" msgstr "" -#: whatsnew/3.11.rst:1475 +#: whatsnew/3.11.rst:1489 msgid "" "The object's index in the globals/builtins namespace is cached. Loading " "globals and builtins require zero namespace lookups." msgstr "" -#: whatsnew/3.11.rst:1475 +#: whatsnew/3.11.rst:1489 msgid "[#load-global]_" msgstr "" -#: whatsnew/3.11.rst:1479 whatsnew/3.11.rst:1488 +#: whatsnew/3.11.rst:1493 whatsnew/3.11.rst:1502 msgid "Mark Shannon" msgstr "" -#: whatsnew/3.11.rst:1479 +#: whatsnew/3.11.rst:1493 msgid "Load attribute" msgstr "" -#: whatsnew/3.11.rst:1479 +#: whatsnew/3.11.rst:1493 msgid "``o.attr``" msgstr "" -#: whatsnew/3.11.rst:1479 +#: whatsnew/3.11.rst:1493 msgid "" "Similar to loading global variables. The attribute's index inside the class/" "object's namespace is cached. In most cases, attribute loading will require " "zero namespace lookups." msgstr "" -#: whatsnew/3.11.rst:1479 +#: whatsnew/3.11.rst:1493 msgid "[#load-attr]_" msgstr "" -#: whatsnew/3.11.rst:1484 +#: whatsnew/3.11.rst:1498 msgid "Load methods for call" msgstr "" -#: whatsnew/3.11.rst:1484 +#: whatsnew/3.11.rst:1498 msgid "``o.meth()``" msgstr "" -#: whatsnew/3.11.rst:1484 +#: whatsnew/3.11.rst:1498 msgid "" "The actual address of the method is cached. Method loading now has no " "namespace lookups -- even for classes with long inheritance chains." msgstr "" -#: whatsnew/3.11.rst:1484 +#: whatsnew/3.11.rst:1498 msgid "10-20%" msgstr "" -#: whatsnew/3.11.rst:1484 +#: whatsnew/3.11.rst:1498 msgid "Ken Jin, Mark Shannon" msgstr "" -#: whatsnew/3.11.rst:1488 +#: whatsnew/3.11.rst:1502 msgid "Store attribute" msgstr "" -#: whatsnew/3.11.rst:1488 +#: whatsnew/3.11.rst:1502 msgid "``o.attr = z``" msgstr "" -#: whatsnew/3.11.rst:1488 +#: whatsnew/3.11.rst:1502 msgid "Similar to load attribute optimization." msgstr "" -#: whatsnew/3.11.rst:1488 +#: whatsnew/3.11.rst:1502 msgid "2% in pyperformance" msgstr "" -#: whatsnew/3.11.rst:1491 +#: whatsnew/3.11.rst:1505 msgid "Unpack Sequence" msgstr "" -#: whatsnew/3.11.rst:1491 +#: whatsnew/3.11.rst:1505 msgid "``*seq``" msgstr "" -#: whatsnew/3.11.rst:1491 +#: whatsnew/3.11.rst:1505 msgid "" "Specialized for common containers such as :class:`list` and :class:`tuple`. " "Avoids internal calling convention." msgstr "" -#: whatsnew/3.11.rst:1491 +#: whatsnew/3.11.rst:1505 msgid "8%" msgstr "" -#: whatsnew/3.11.rst:1491 +#: whatsnew/3.11.rst:1505 msgid "Brandt Bucher" msgstr "" -#: whatsnew/3.11.rst:1496 +#: whatsnew/3.11.rst:1510 msgid "" "A similar optimization already existed since Python 3.8. 3.11 specializes " "for more forms and reduces some overhead." msgstr "" -#: whatsnew/3.11.rst:1499 +#: whatsnew/3.11.rst:1513 msgid "" "A similar optimization already existed since Python 3.10. 3.11 specializes " "for more forms. Furthermore, all attribute loads should be sped up by :issue:" "`45947`." msgstr "" -#: whatsnew/3.11.rst:1507 +#: whatsnew/3.11.rst:1521 msgid "Misc" msgstr "" -#: whatsnew/3.11.rst:1509 +#: whatsnew/3.11.rst:1523 msgid "" "Objects now require less memory due to lazily created object namespaces. " "Their namespace dictionaries now also share keys more freely. (Contributed " "Mark Shannon in :issue:`45340` and :issue:`40116`.)" msgstr "" -#: whatsnew/3.11.rst:1513 +#: whatsnew/3.11.rst:1527 msgid "" "\"Zero-cost\" exceptions are implemented, eliminating the cost of :keyword:" "`try` statements when no exception is raised. (Contributed by Mark Shannon " "in :issue:`40222`.)" msgstr "" -#: whatsnew/3.11.rst:1517 +#: whatsnew/3.11.rst:1531 msgid "" "A more concise representation of exceptions in the interpreter reduced the " "time required for catching an exception by about 10%. (Contributed by Irit " "Katriel in :issue:`45711`.)" msgstr "" -#: whatsnew/3.11.rst:1521 +#: whatsnew/3.11.rst:1535 msgid "" ":mod:`re`'s regular expression matching engine has been partially " "refactored, and now uses computed gotos (or \"threaded code\") on supported " @@ -2019,37 +2179,37 @@ msgid "" "Bucher in :gh:`91404`.)" msgstr "" -#: whatsnew/3.11.rst:1532 +#: whatsnew/3.11.rst:1546 msgid "FAQ" msgstr "" -#: whatsnew/3.11.rst:1537 +#: whatsnew/3.11.rst:1551 msgid "How should I write my code to utilize these speedups?" msgstr "" -#: whatsnew/3.11.rst:1539 +#: whatsnew/3.11.rst:1553 msgid "" "Write Pythonic code that follows common best practices; you don't have to " "change your code. The Faster CPython project optimizes for common code " "patterns we observe." msgstr "" -#: whatsnew/3.11.rst:1547 +#: whatsnew/3.11.rst:1561 msgid "Will CPython 3.11 use more memory?" msgstr "" -#: whatsnew/3.11.rst:1549 +#: whatsnew/3.11.rst:1563 msgid "" "Maybe not; we don't expect memory use to exceed 20% higher than 3.10. This " "is offset by memory optimizations for frame objects and object dictionaries " "as mentioned above." msgstr "" -#: whatsnew/3.11.rst:1557 +#: whatsnew/3.11.rst:1571 msgid "I don't see any speedups in my workload. Why?" msgstr "" -#: whatsnew/3.11.rst:1559 +#: whatsnew/3.11.rst:1573 msgid "" "Certain code won't have noticeable benefits. If your code spends most of its " "time on I/O operations, or already does most of its computation in a C " @@ -2057,26 +2217,26 @@ msgid "" "project currently benefits pure-Python workloads the most." msgstr "" -#: whatsnew/3.11.rst:1564 +#: whatsnew/3.11.rst:1578 msgid "" "Furthermore, the pyperformance figures are a geometric mean. Even within the " "pyperformance benchmarks, certain benchmarks have slowed down slightly, " "while others have sped up by nearly 2x!" msgstr "" -#: whatsnew/3.11.rst:1572 +#: whatsnew/3.11.rst:1586 msgid "Is there a JIT compiler?" msgstr "" -#: whatsnew/3.11.rst:1574 +#: whatsnew/3.11.rst:1588 msgid "No. We're still exploring other optimizations." msgstr "" -#: whatsnew/3.11.rst:1580 +#: whatsnew/3.11.rst:1594 msgid "About" msgstr "" -#: whatsnew/3.11.rst:1582 +#: whatsnew/3.11.rst:1596 msgid "" "Faster CPython explores optimizations for :term:`CPython`. The main team is " "funded by Microsoft to work on this full-time. Pablo Galindo Salgado is also " @@ -2084,11 +2244,11 @@ msgid "" "contributors are volunteers from the community." msgstr "" -#: whatsnew/3.11.rst:1591 +#: whatsnew/3.11.rst:1605 msgid "CPython bytecode changes" msgstr "" -#: whatsnew/3.11.rst:1593 +#: whatsnew/3.11.rst:1607 msgid "" "The bytecode now contains inline cache entries, which take the form of the " "newly-added :opcode:`CACHE` instructions. Many opcodes expect to be followed " @@ -2098,62 +2258,62 @@ msgid "" "containing quickened data." msgstr "" -#: whatsnew/3.11.rst:1605 +#: whatsnew/3.11.rst:1619 msgid "New opcodes" msgstr "" -#: whatsnew/3.11.rst:1607 +#: whatsnew/3.11.rst:1621 msgid "" ":opcode:`!ASYNC_GEN_WRAP`, :opcode:`RETURN_GENERATOR` and :opcode:`SEND`, " "used in generators and co-routines." msgstr "" -#: whatsnew/3.11.rst:1610 +#: whatsnew/3.11.rst:1624 msgid "" ":opcode:`COPY_FREE_VARS`, which avoids needing special caller-side code for " "closures." msgstr "" -#: whatsnew/3.11.rst:1613 +#: whatsnew/3.11.rst:1627 msgid "" ":opcode:`JUMP_BACKWARD_NO_INTERRUPT`, for use in certain loops where " "handling interrupts is undesirable." msgstr "" -#: whatsnew/3.11.rst:1616 +#: whatsnew/3.11.rst:1630 msgid ":opcode:`MAKE_CELL`, to create :ref:`cell-objects`." msgstr "" -#: whatsnew/3.11.rst:1618 +#: whatsnew/3.11.rst:1632 msgid "" ":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle the :" "ref:`new exception groups and except* ` added in :pep:" "`654`." msgstr "" -#: whatsnew/3.11.rst:1622 +#: whatsnew/3.11.rst:1636 msgid ":opcode:`PUSH_EXC_INFO`, for use in exception handlers." msgstr "" -#: whatsnew/3.11.rst:1624 +#: whatsnew/3.11.rst:1638 msgid "" ":opcode:`RESUME`, a no-op, for internal tracing, debugging and optimization " "checks." msgstr "" -#: whatsnew/3.11.rst:1631 +#: whatsnew/3.11.rst:1645 msgid "Replaced opcodes" msgstr "" -#: whatsnew/3.11.rst:1634 +#: whatsnew/3.11.rst:1648 msgid "Replaced Opcode(s)" msgstr "" -#: whatsnew/3.11.rst:1634 +#: whatsnew/3.11.rst:1648 msgid "New Opcode(s)" msgstr "" -#: whatsnew/3.11.rst:1634 +#: whatsnew/3.11.rst:1648 msgid "Notes" msgstr "" @@ -2165,11 +2325,11 @@ msgstr "" msgid ":opcode:`!INPLACE_*`" msgstr "" -#: whatsnew/3.11.rst:1636 +#: whatsnew/3.11.rst:1650 msgid ":opcode:`BINARY_OP`" msgstr "" -#: whatsnew/3.11.rst:1636 +#: whatsnew/3.11.rst:1650 msgid "Replaced all numeric binary/in-place opcodes with a single opcode" msgstr "" @@ -2201,7 +2361,7 @@ msgstr "" msgid ":opcode:`PUSH_NULL`" msgstr "" -#: whatsnew/3.11.rst:1639 +#: whatsnew/3.11.rst:1653 msgid "" "Decouples argument shifting for methods from handling of keyword arguments; " "allows better specialization of calls" @@ -2239,7 +2399,7 @@ msgstr "" msgid ":opcode:`SWAP`" msgstr "" -#: whatsnew/3.11.rst:1644 +#: whatsnew/3.11.rst:1658 msgid "Stack manipulation instructions" msgstr "" @@ -2251,7 +2411,7 @@ msgstr "" msgid ":opcode:`CHECK_EXC_MATCH`" msgstr "" -#: whatsnew/3.11.rst:1651 +#: whatsnew/3.11.rst:1665 msgid "Now performs check but doesn't jump" msgstr "" @@ -2279,7 +2439,7 @@ msgstr "" msgid ":opcode:`!POP_JUMP_FORWARD_IF_*`" msgstr "" -#: whatsnew/3.11.rst:1653 +#: whatsnew/3.11.rst:1667 msgid "" "See [#bytecode-jump]_; ``TRUE``, ``FALSE``, ``NONE`` and ``NOT_NONE`` " "variants for each direction" @@ -2293,64 +2453,64 @@ msgstr "" msgid ":opcode:`!SETUP_ASYNC_WITH`" msgstr "" -#: whatsnew/3.11.rst:1659 -msgid ":opcode:`BEFORE_WITH`" +#: whatsnew/3.11.rst:1673 +msgid ":opcode:`!BEFORE_WITH`" msgstr "" -#: whatsnew/3.11.rst:1659 +#: whatsnew/3.11.rst:1673 msgid ":keyword:`with` block setup" msgstr "" -#: whatsnew/3.11.rst:1663 +#: whatsnew/3.11.rst:1677 msgid "" "All jump opcodes are now relative, including the existing :opcode:`!" "JUMP_IF_TRUE_OR_POP` and :opcode:`!JUMP_IF_FALSE_OR_POP`. The argument is " "now an offset from the current instruction rather than an absolute location." msgstr "" -#: whatsnew/3.11.rst:1674 +#: whatsnew/3.11.rst:1688 msgid "Changed/removed opcodes" msgstr "" -#: whatsnew/3.11.rst:1676 +#: whatsnew/3.11.rst:1690 msgid "" "Changed :opcode:`MATCH_CLASS` and :opcode:`MATCH_KEYS` to no longer push an " "additional boolean value to indicate success/failure. Instead, ``None`` is " "pushed on failure in place of the tuple of extracted values." msgstr "" -#: whatsnew/3.11.rst:1681 +#: whatsnew/3.11.rst:1695 msgid "" "Changed opcodes that work with exceptions to reflect them now being " "represented as one item on the stack instead of three (see :gh:`89874`)." msgstr "" -#: whatsnew/3.11.rst:1685 +#: whatsnew/3.11.rst:1699 msgid "" "Removed :opcode:`!COPY_DICT_WITHOUT_KEYS`, :opcode:`!GEN_START`, :opcode:`!" "POP_BLOCK`, :opcode:`!SETUP_FINALLY` and :opcode:`!YIELD_FROM`." msgstr "" -#: whatsnew/3.11.rst:2566 +#: whatsnew/3.11.rst:2580 msgid "Deprecated" msgstr "" -#: whatsnew/3.11.rst:1695 +#: whatsnew/3.11.rst:1709 msgid "" "This section lists Python APIs that have been deprecated in Python 3.11." msgstr "" -#: whatsnew/3.11.rst:1697 +#: whatsnew/3.11.rst:1711 msgid "" "Deprecated C APIs are :ref:`listed separately `." msgstr "" -#: whatsnew/3.11.rst:1704 +#: whatsnew/3.11.rst:1718 msgid "Language/Builtins" msgstr "" -#: whatsnew/3.11.rst:1706 +#: whatsnew/3.11.rst:1720 msgid "" "Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`) is " "now deprecated. It can no longer be used to wrap other descriptors such as :" @@ -2360,7 +2520,7 @@ msgid "" "3.10. (Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: whatsnew/3.11.rst:1714 +#: whatsnew/3.11.rst:1728 msgid "" "Octal escapes in string and bytes literals with values larger than ``0o377`` " "(255 in decimal) now produce a :exc:`DeprecationWarning`. In a future Python " @@ -2368,7 +2528,7 @@ msgid "" "`SyntaxError`. (Contributed by Serhiy Storchaka in :gh:`81548`.)" msgstr "" -#: whatsnew/3.11.rst:1720 +#: whatsnew/3.11.rst:1734 msgid "" "The delegation of :func:`int` to :meth:`~object.__trunc__` is now " "deprecated. Calling ``int(a)`` when ``type(a)`` implements :meth:`!" @@ -2377,99 +2537,99 @@ msgid "" "`44977`.)" msgstr "" -#: whatsnew/3.11.rst:1730 +#: whatsnew/3.11.rst:1744 msgid "Modules" msgstr "" -#: whatsnew/3.11.rst:1734 +#: whatsnew/3.11.rst:1748 msgid "" ":pep:`594` led to the deprecations of the following modules slated for " "removal in Python 3.13:" msgstr "" -#: whatsnew/3.11.rst:1738 -msgid ":mod:`aifc`" +#: whatsnew/3.11.rst:1752 +msgid ":mod:`!aifc`" msgstr "" -#: whatsnew/3.11.rst:1738 -msgid ":mod:`chunk`" +#: whatsnew/3.11.rst:1752 +msgid ":mod:`!chunk`" msgstr "" -#: whatsnew/3.11.rst:1738 -msgid ":mod:`msilib`" +#: whatsnew/3.11.rst:1752 +msgid ":mod:`!msilib`" msgstr "" -#: whatsnew/3.11.rst:1738 -msgid ":mod:`pipes`" +#: whatsnew/3.11.rst:1752 +msgid ":mod:`!pipes`" msgstr "" -#: whatsnew/3.11.rst:1738 -msgid ":mod:`telnetlib`" +#: whatsnew/3.11.rst:1752 +msgid ":mod:`!telnetlib`" msgstr "" -#: whatsnew/3.11.rst:1740 -msgid ":mod:`audioop`" +#: whatsnew/3.11.rst:1754 +msgid ":mod:`!audioop`" msgstr "" -#: whatsnew/3.11.rst:1740 -msgid ":mod:`crypt`" +#: whatsnew/3.11.rst:1754 +msgid ":mod:`!crypt`" msgstr "" -#: whatsnew/3.11.rst:1740 -msgid ":mod:`nis`" +#: whatsnew/3.11.rst:1754 +msgid ":mod:`!nis`" msgstr "" -#: whatsnew/3.11.rst:1740 -msgid ":mod:`sndhdr`" +#: whatsnew/3.11.rst:1754 +msgid ":mod:`!sndhdr`" msgstr "" -#: whatsnew/3.11.rst:1740 -msgid ":mod:`uu`" +#: whatsnew/3.11.rst:1754 +msgid ":mod:`!uu`" msgstr "" -#: whatsnew/3.11.rst:1742 -msgid ":mod:`cgi`" +#: whatsnew/3.11.rst:1756 +msgid ":mod:`!cgi`" msgstr "" -#: whatsnew/3.11.rst:1742 -msgid ":mod:`imghdr`" +#: whatsnew/3.11.rst:1756 +msgid ":mod:`!imghdr`" msgstr "" -#: whatsnew/3.11.rst:1742 -msgid ":mod:`nntplib`" +#: whatsnew/3.11.rst:1756 +msgid ":mod:`!nntplib`" msgstr "" -#: whatsnew/3.11.rst:1742 -msgid ":mod:`spwd`" +#: whatsnew/3.11.rst:1756 +msgid ":mod:`!spwd`" msgstr "" -#: whatsnew/3.11.rst:1742 -msgid ":mod:`xdrlib`" +#: whatsnew/3.11.rst:1756 +msgid ":mod:`!xdrlib`" msgstr "" -#: whatsnew/3.11.rst:1744 -msgid ":mod:`cgitb`" +#: whatsnew/3.11.rst:1758 +msgid ":mod:`!cgitb`" msgstr "" -#: whatsnew/3.11.rst:1744 -msgid ":mod:`mailcap`" +#: whatsnew/3.11.rst:1758 +msgid ":mod:`!mailcap`" msgstr "" -#: whatsnew/3.11.rst:1744 -msgid ":mod:`ossaudiodev`" +#: whatsnew/3.11.rst:1758 +msgid ":mod:`!ossaudiodev`" msgstr "" -#: whatsnew/3.11.rst:1744 -msgid ":mod:`sunau`" +#: whatsnew/3.11.rst:1758 +msgid ":mod:`!sunau`" msgstr "" -#: whatsnew/3.11.rst:1747 +#: whatsnew/3.11.rst:1761 msgid "" "(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in :gh:" "`68966`.)" msgstr "" -#: whatsnew/3.11.rst:1750 +#: whatsnew/3.11.rst:1764 msgid "" "The :mod:`!asynchat`, :mod:`!asyncore` and :mod:`!smtpd` modules have been " "deprecated since at least Python 3.6. Their documentation and deprecation " @@ -2477,49 +2637,48 @@ msgid "" "(Contributed by Hugo van Kemenade in :issue:`47022`.)" msgstr "" -#: whatsnew/3.11.rst:1755 +#: whatsnew/3.11.rst:1769 msgid "" -"The :mod:`lib2to3` package and :ref:`2to3 <2to3-reference>` tool are now " -"deprecated and may not be able to parse Python 3.10 or newer. See :pep:" -"`617`, introducing the new PEG parser, for details. (Contributed by Victor " -"Stinner in :issue:`40360`.)" +"The :mod:`!lib2to3` package and ``2to3`` tool are now deprecated and may not " +"be able to parse Python 3.10 or newer. See :pep:`617`, introducing the new " +"PEG parser, for details. (Contributed by Victor Stinner in :issue:`40360`.)" msgstr "" -#: whatsnew/3.11.rst:1760 +#: whatsnew/3.11.rst:1774 msgid "" "Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!" "sre_parse` are now deprecated. (Contributed by Serhiy Storchaka in :issue:" "`47152`.)" msgstr "" -#: whatsnew/3.11.rst:1768 +#: whatsnew/3.11.rst:1782 msgid "Standard Library" msgstr "" -#: whatsnew/3.11.rst:1770 +#: whatsnew/3.11.rst:1784 msgid "" "The following have been deprecated in :mod:`configparser` since Python 3.2. " "Their deprecation warnings have now been updated to note they will be " "removed in Python 3.12:" msgstr "" -#: whatsnew/3.11.rst:1774 +#: whatsnew/3.11.rst:1788 msgid "the :class:`!configparser.SafeConfigParser` class" msgstr "" -#: whatsnew/3.11.rst:1775 +#: whatsnew/3.11.rst:1789 msgid "the :attr:`!configparser.ParsingError.filename` property" msgstr "" -#: whatsnew/3.11.rst:1776 +#: whatsnew/3.11.rst:1790 msgid "the :meth:`!configparser.RawConfigParser.readfp` method" msgstr "" -#: whatsnew/3.11.rst:1778 +#: whatsnew/3.11.rst:1792 msgid "(Contributed by Hugo van Kemenade in :issue:`45173`.)" msgstr "" -#: whatsnew/3.11.rst:1780 +#: whatsnew/3.11.rst:1794 msgid "" ":class:`!configparser.LegacyInterpolation` has been deprecated in the " "docstring since Python 3.2, and is not listed in the :mod:`configparser` " @@ -2529,7 +2688,7 @@ msgid "" "Kemenade in :issue:`46607`.)" msgstr "" -#: whatsnew/3.11.rst:1787 +#: whatsnew/3.11.rst:1801 msgid "" "The older set of :mod:`importlib.resources` functions were deprecated in " "favor of the replacements added in Python 3.9 and will be removed in a " @@ -2537,35 +2696,35 @@ msgid "" "package subdirectories:" msgstr "" -#: whatsnew/3.11.rst:1792 -msgid ":func:`importlib.resources.contents`" +#: whatsnew/3.11.rst:1806 +msgid ":func:`!importlib.resources.contents`" msgstr "" -#: whatsnew/3.11.rst:1793 -msgid ":func:`importlib.resources.is_resource`" +#: whatsnew/3.11.rst:1807 +msgid ":func:`!importlib.resources.is_resource`" msgstr "" -#: whatsnew/3.11.rst:1794 -msgid ":func:`importlib.resources.open_binary`" +#: whatsnew/3.11.rst:1808 +msgid ":func:`!importlib.resources.open_binary`" msgstr "" -#: whatsnew/3.11.rst:1795 -msgid ":func:`importlib.resources.open_text`" +#: whatsnew/3.11.rst:1809 +msgid ":func:`!importlib.resources.open_text`" msgstr "" -#: whatsnew/3.11.rst:1796 -msgid ":func:`importlib.resources.read_binary`" +#: whatsnew/3.11.rst:1810 +msgid ":func:`!importlib.resources.read_binary`" msgstr "" -#: whatsnew/3.11.rst:1797 -msgid ":func:`importlib.resources.read_text`" +#: whatsnew/3.11.rst:1811 +msgid ":func:`!importlib.resources.read_text`" msgstr "" -#: whatsnew/3.11.rst:1798 -msgid ":func:`importlib.resources.path`" +#: whatsnew/3.11.rst:1812 +msgid ":func:`!importlib.resources.path`" msgstr "" -#: whatsnew/3.11.rst:1800 +#: whatsnew/3.11.rst:1814 msgid "" "The :func:`locale.getdefaultlocale` function is deprecated and will be " "removed in Python 3.15. Use :func:`locale.setlocale`, :func:`locale." @@ -2573,14 +2732,14 @@ msgid "" "getlocale` functions instead. (Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" -#: whatsnew/3.11.rst:1806 +#: whatsnew/3.11.rst:1820 msgid "" -"The :func:`locale.resetlocale` function is deprecated and will be removed in " -"Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " +"The :func:`!locale.resetlocale` function is deprecated and will be removed " +"in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " "(Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" -#: whatsnew/3.11.rst:1810 +#: whatsnew/3.11.rst:1824 msgid "" "Stricter rules will now be applied for numerical group references and group " "names in :ref:`regular expressions `. Only sequences of ASCII " @@ -2591,7 +2750,7 @@ msgid "" "`91760`.)" msgstr "" -#: whatsnew/3.11.rst:1818 +#: whatsnew/3.11.rst:1832 msgid "" "In the :mod:`re` module, the :func:`!re.template` function and the " "corresponding :const:`!re.TEMPLATE` and :const:`!re.T` flags are deprecated, " @@ -2600,16 +2759,16 @@ msgid "" "in :gh:`92728`.)" msgstr "" -#: whatsnew/3.11.rst:1824 +#: whatsnew/3.11.rst:1838 msgid "" -":func:`turtle.settiltangle` has been deprecated since Python 3.1; it now " +":func:`!turtle.settiltangle` has been deprecated since Python 3.1; it now " "emits a deprecation warning and will be removed in Python 3.13. Use :func:" "`turtle.tiltangle` instead (it was earlier incorrectly marked as deprecated, " "and its docstring is now corrected). (Contributed by Hugo van Kemenade in :" "issue:`45837`.)" msgstr "" -#: whatsnew/3.11.rst:1830 +#: whatsnew/3.11.rst:1844 msgid "" ":class:`typing.Text`, which exists solely to provide compatibility support " "between Python 2 and Python 3 code, is now deprecated. Its removal is " @@ -2617,347 +2776,347 @@ msgid "" "wherever possible. (Contributed by Alex Waygood in :gh:`92332`.)" msgstr "" -#: whatsnew/3.11.rst:1836 +#: whatsnew/3.11.rst:1850 msgid "" "The keyword argument syntax for constructing :data:`typing.TypedDict` types " "is now deprecated. Support will be removed in Python 3.13. (Contributed by " "Jingchen Ye in :gh:`90224`.)" msgstr "" -#: whatsnew/3.11.rst:1840 +#: whatsnew/3.11.rst:1854 msgid "" ":class:`!webbrowser.MacOSX` is deprecated and will be removed in Python " "3.13. It is untested, undocumented, and not used by :mod:`webbrowser` " "itself. (Contributed by Donghee Na in :issue:`42255`.)" msgstr "" -#: whatsnew/3.11.rst:1844 +#: whatsnew/3.11.rst:1858 msgid "" "The behavior of returning a value from a :class:`~unittest.TestCase` and :" "class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " "default ``None`` value) is now deprecated." msgstr "" -#: whatsnew/3.11.rst:1848 +#: whatsnew/3.11.rst:1862 msgid "" "Deprecated the following not-formally-documented :mod:`unittest` functions, " "scheduled for removal in Python 3.13:" msgstr "" -#: whatsnew/3.11.rst:1851 +#: whatsnew/3.11.rst:1865 msgid ":func:`!unittest.findTestCases`" msgstr "" -#: whatsnew/3.11.rst:1852 +#: whatsnew/3.11.rst:1866 msgid ":func:`!unittest.makeSuite`" msgstr "" -#: whatsnew/3.11.rst:1853 +#: whatsnew/3.11.rst:1867 msgid ":func:`!unittest.getTestCaseNames`" msgstr "" -#: whatsnew/3.11.rst:1855 +#: whatsnew/3.11.rst:1869 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: whatsnew/3.11.rst:1857 +#: whatsnew/3.11.rst:1871 msgid ":meth:`unittest.TestLoader.loadTestsFromModule`" msgstr "" -#: whatsnew/3.11.rst:1858 +#: whatsnew/3.11.rst:1872 msgid ":meth:`unittest.TestLoader.loadTestsFromTestCase`" msgstr "" -#: whatsnew/3.11.rst:1859 +#: whatsnew/3.11.rst:1873 msgid ":meth:`unittest.TestLoader.getTestCaseNames`" msgstr "" -#: whatsnew/3.11.rst:1861 +#: whatsnew/3.11.rst:1875 msgid "(Contributed by Erlend E. Aasland in :issue:`5846`.)" msgstr "" -#: whatsnew/3.11.rst:1863 +#: whatsnew/3.11.rst:1877 msgid "" ":meth:`!unittest.TestProgram.usageExit` is marked deprecated, to be removed " "in 3.13. (Contributed by Carlos Damázio in :gh:`67048`.)" msgstr "" -#: whatsnew/3.11.rst:2594 +#: whatsnew/3.11.rst:2608 msgid "Pending Removal in Python 3.12" msgstr "" -#: whatsnew/3.11.rst:1874 +#: whatsnew/3.11.rst:1888 msgid "" "The following Python APIs have been deprecated in earlier Python releases, " "and will be removed in Python 3.12." msgstr "" -#: whatsnew/3.11.rst:1877 +#: whatsnew/3.11.rst:1891 msgid "" "C APIs pending removal are :ref:`listed separately `." msgstr "" -#: whatsnew/3.11.rst:1880 +#: whatsnew/3.11.rst:1894 msgid "The :mod:`!asynchat` module" msgstr "" -#: whatsnew/3.11.rst:1881 +#: whatsnew/3.11.rst:1895 msgid "The :mod:`!asyncore` module" msgstr "" -#: whatsnew/3.11.rst:1882 +#: whatsnew/3.11.rst:1896 msgid "The :ref:`entire distutils package `" msgstr "" -#: whatsnew/3.11.rst:1883 +#: whatsnew/3.11.rst:1897 msgid "The :mod:`!imp` module" msgstr "" -#: whatsnew/3.11.rst:1884 +#: whatsnew/3.11.rst:1898 msgid "The :class:`typing.io ` namespace" msgstr "" -#: whatsnew/3.11.rst:1885 +#: whatsnew/3.11.rst:1899 msgid "The :class:`typing.re ` namespace" msgstr "" -#: whatsnew/3.11.rst:1886 +#: whatsnew/3.11.rst:1900 msgid ":func:`!cgi.log`" msgstr "" -#: whatsnew/3.11.rst:1887 +#: whatsnew/3.11.rst:1901 msgid ":func:`!importlib.find_loader`" msgstr "" -#: whatsnew/3.11.rst:1888 +#: whatsnew/3.11.rst:1902 msgid ":meth:`!importlib.abc.Loader.module_repr`" msgstr "" -#: whatsnew/3.11.rst:1889 +#: whatsnew/3.11.rst:1903 msgid ":meth:`!importlib.abc.MetaPathFinder.find_module`" msgstr "" -#: whatsnew/3.11.rst:1890 +#: whatsnew/3.11.rst:1904 msgid ":meth:`!importlib.abc.PathEntryFinder.find_loader`" msgstr "" -#: whatsnew/3.11.rst:1891 +#: whatsnew/3.11.rst:1905 msgid ":meth:`!importlib.abc.PathEntryFinder.find_module`" msgstr "" -#: whatsnew/3.11.rst:1892 +#: whatsnew/3.11.rst:1906 msgid ":meth:`!importlib.machinery.BuiltinImporter.find_module`" msgstr "" -#: whatsnew/3.11.rst:1893 +#: whatsnew/3.11.rst:1907 msgid ":meth:`!importlib.machinery.BuiltinLoader.module_repr`" msgstr "" -#: whatsnew/3.11.rst:1894 +#: whatsnew/3.11.rst:1908 msgid ":meth:`!importlib.machinery.FileFinder.find_loader`" msgstr "" -#: whatsnew/3.11.rst:1895 +#: whatsnew/3.11.rst:1909 msgid ":meth:`!importlib.machinery.FileFinder.find_module`" msgstr "" -#: whatsnew/3.11.rst:1896 +#: whatsnew/3.11.rst:1910 msgid ":meth:`!importlib.machinery.FrozenImporter.find_module`" msgstr "" -#: whatsnew/3.11.rst:1897 +#: whatsnew/3.11.rst:1911 msgid ":meth:`!importlib.machinery.FrozenLoader.module_repr`" msgstr "" -#: whatsnew/3.11.rst:1898 +#: whatsnew/3.11.rst:1912 msgid ":meth:`!importlib.machinery.PathFinder.find_module`" msgstr "" -#: whatsnew/3.11.rst:1899 +#: whatsnew/3.11.rst:1913 msgid ":meth:`!importlib.machinery.WindowsRegistryFinder.find_module`" msgstr "" -#: whatsnew/3.11.rst:1900 +#: whatsnew/3.11.rst:1914 msgid ":func:`!importlib.util.module_for_loader`" msgstr "" -#: whatsnew/3.11.rst:1901 +#: whatsnew/3.11.rst:1915 msgid ":func:`!importlib.util.set_loader_wrapper`" msgstr "" -#: whatsnew/3.11.rst:1902 +#: whatsnew/3.11.rst:1916 msgid ":func:`!importlib.util.set_package_wrapper`" msgstr "" -#: whatsnew/3.11.rst:1903 +#: whatsnew/3.11.rst:1917 msgid ":class:`!pkgutil.ImpImporter`" msgstr "" -#: whatsnew/3.11.rst:1904 +#: whatsnew/3.11.rst:1918 msgid ":class:`!pkgutil.ImpLoader`" msgstr "" -#: whatsnew/3.11.rst:1905 +#: whatsnew/3.11.rst:1919 msgid ":meth:`!pathlib.Path.link_to`" msgstr "" -#: whatsnew/3.11.rst:1906 +#: whatsnew/3.11.rst:1920 msgid ":func:`!sqlite3.enable_shared_cache`" msgstr "" -#: whatsnew/3.11.rst:1907 +#: whatsnew/3.11.rst:1921 msgid ":func:`!sqlite3.OptimizedUnicode`" msgstr "" -#: whatsnew/3.11.rst:1908 +#: whatsnew/3.11.rst:1922 msgid ":envvar:`!PYTHONTHREADDEBUG` environment variable" msgstr "" -#: whatsnew/3.11.rst:1909 +#: whatsnew/3.11.rst:1923 msgid "The following deprecated aliases in :mod:`unittest`:" msgstr "" -#: whatsnew/3.11.rst:1912 +#: whatsnew/3.11.rst:1926 msgid "Deprecated alias" msgstr "" -#: whatsnew/3.11.rst:1912 +#: whatsnew/3.11.rst:1926 msgid "Method Name" msgstr "" -#: whatsnew/3.11.rst:1912 +#: whatsnew/3.11.rst:1926 msgid "Deprecated in" msgstr "" -#: whatsnew/3.11.rst:1914 +#: whatsnew/3.11.rst:1928 msgid "``failUnless``" msgstr "" -#: whatsnew/3.11.rst:1921 +#: whatsnew/3.11.rst:1935 msgid ":meth:`.assertTrue`" msgstr "" -#: whatsnew/3.11.rst:1915 whatsnew/3.11.rst:1917 whatsnew/3.11.rst:1919 -#: whatsnew/3.11.rst:1920 +#: whatsnew/3.11.rst:1929 whatsnew/3.11.rst:1931 whatsnew/3.11.rst:1933 +#: whatsnew/3.11.rst:1934 msgid "3.1" msgstr "" -#: whatsnew/3.11.rst:1915 +#: whatsnew/3.11.rst:1929 msgid "``failIf``" msgstr "" -#: whatsnew/3.11.rst:1915 +#: whatsnew/3.11.rst:1929 msgid ":meth:`.assertFalse`" msgstr "" -#: whatsnew/3.11.rst:1916 +#: whatsnew/3.11.rst:1930 msgid "``failUnlessEqual``" msgstr "" -#: whatsnew/3.11.rst:1922 +#: whatsnew/3.11.rst:1936 msgid ":meth:`.assertEqual`" msgstr "" -#: whatsnew/3.11.rst:1917 +#: whatsnew/3.11.rst:1931 msgid "``failIfEqual``" msgstr "" -#: whatsnew/3.11.rst:1923 +#: whatsnew/3.11.rst:1937 msgid ":meth:`.assertNotEqual`" msgstr "" -#: whatsnew/3.11.rst:1918 +#: whatsnew/3.11.rst:1932 msgid "``failUnlessAlmostEqual``" msgstr "" -#: whatsnew/3.11.rst:1924 +#: whatsnew/3.11.rst:1938 msgid ":meth:`.assertAlmostEqual`" msgstr "" -#: whatsnew/3.11.rst:1919 +#: whatsnew/3.11.rst:1933 msgid "``failIfAlmostEqual``" msgstr "" -#: whatsnew/3.11.rst:1925 +#: whatsnew/3.11.rst:1939 msgid ":meth:`.assertNotAlmostEqual`" msgstr "" -#: whatsnew/3.11.rst:1920 +#: whatsnew/3.11.rst:1934 msgid "``failUnlessRaises``" msgstr "" -#: whatsnew/3.11.rst:1920 +#: whatsnew/3.11.rst:1934 msgid ":meth:`.assertRaises`" msgstr "" -#: whatsnew/3.11.rst:1921 +#: whatsnew/3.11.rst:1935 msgid "``assert_``" msgstr "" -#: whatsnew/3.11.rst:1922 whatsnew/3.11.rst:1924 whatsnew/3.11.rst:1926 -#: whatsnew/3.11.rst:1927 +#: whatsnew/3.11.rst:1936 whatsnew/3.11.rst:1938 whatsnew/3.11.rst:1940 +#: whatsnew/3.11.rst:1941 msgid "3.2" msgstr "" -#: whatsnew/3.11.rst:1922 +#: whatsnew/3.11.rst:1936 msgid "``assertEquals``" msgstr "" -#: whatsnew/3.11.rst:1923 +#: whatsnew/3.11.rst:1937 msgid "``assertNotEquals``" msgstr "" -#: whatsnew/3.11.rst:1924 +#: whatsnew/3.11.rst:1938 msgid "``assertAlmostEquals``" msgstr "" -#: whatsnew/3.11.rst:1925 +#: whatsnew/3.11.rst:1939 msgid "``assertNotAlmostEquals``" msgstr "" -#: whatsnew/3.11.rst:1926 +#: whatsnew/3.11.rst:1940 msgid "``assertRegexpMatches``" msgstr "" -#: whatsnew/3.11.rst:1926 +#: whatsnew/3.11.rst:1940 msgid ":meth:`.assertRegex`" msgstr "" -#: whatsnew/3.11.rst:1927 +#: whatsnew/3.11.rst:1941 msgid "``assertRaisesRegexp``" msgstr "" -#: whatsnew/3.11.rst:1927 +#: whatsnew/3.11.rst:1941 msgid ":meth:`.assertRaisesRegex`" msgstr "" -#: whatsnew/3.11.rst:1928 +#: whatsnew/3.11.rst:1942 msgid "``assertNotRegexpMatches``" msgstr "" -#: whatsnew/3.11.rst:1928 +#: whatsnew/3.11.rst:1942 msgid ":meth:`.assertNotRegex`" msgstr "" -#: whatsnew/3.11.rst:1928 +#: whatsnew/3.11.rst:1942 msgid "3.5" msgstr "" -#: whatsnew/3.11.rst:2620 +#: whatsnew/3.11.rst:2634 msgid "Removed" msgstr "" -#: whatsnew/3.11.rst:1937 +#: whatsnew/3.11.rst:1951 msgid "This section lists Python APIs that have been removed in Python 3.11." msgstr "" -#: whatsnew/3.11.rst:1939 +#: whatsnew/3.11.rst:1953 msgid "" "Removed C APIs are :ref:`listed separately `." msgstr "" -#: whatsnew/3.11.rst:1941 +#: whatsnew/3.11.rst:1955 msgid "" "Removed the :func:`!@asyncio.coroutine` :term:`decorator` enabling legacy " "generator-based coroutines to be compatible with :keyword:`async` / :keyword:" @@ -2966,14 +3125,14 @@ msgid "" "instead. (Contributed by Illia Volochii in :issue:`43216`.)" msgstr "" -#: whatsnew/3.11.rst:1948 +#: whatsnew/3.11.rst:1962 msgid "" "Removed :class:`!asyncio.coroutines.CoroWrapper` used for wrapping legacy " "generator-based coroutine objects in the debug mode. (Contributed by Illia " "Volochii in :issue:`43216`.)" msgstr "" -#: whatsnew/3.11.rst:1952 +#: whatsnew/3.11.rst:1966 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is now " @@ -2982,44 +3141,44 @@ msgid "" "`45129`.)" msgstr "" -#: whatsnew/3.11.rst:1958 +#: whatsnew/3.11.rst:1972 msgid "" "Removed the :mod:`!binhex` module, deprecated in Python 3.9. Also removed " "the related, similarly-deprecated :mod:`binascii` functions:" msgstr "" -#: whatsnew/3.11.rst:1961 +#: whatsnew/3.11.rst:1975 msgid ":func:`!binascii.a2b_hqx`" msgstr "" -#: whatsnew/3.11.rst:1962 +#: whatsnew/3.11.rst:1976 msgid ":func:`!binascii.b2a_hqx`" msgstr "" -#: whatsnew/3.11.rst:1963 +#: whatsnew/3.11.rst:1977 msgid ":func:`!binascii.rlecode_hqx`" msgstr "" -#: whatsnew/3.11.rst:1964 +#: whatsnew/3.11.rst:1978 msgid ":func:`!binascii.rldecode_hqx`" msgstr "" -#: whatsnew/3.11.rst:1966 +#: whatsnew/3.11.rst:1980 msgid "The :func:`binascii.crc_hqx` function remains available." msgstr "" -#: whatsnew/3.11.rst:1968 +#: whatsnew/3.11.rst:1982 msgid "(Contributed by Victor Stinner in :issue:`45085`.)" msgstr "" -#: whatsnew/3.11.rst:1970 +#: whatsnew/3.11.rst:1984 msgid "" "Removed the :mod:`!distutils` ``bdist_msi`` command deprecated in Python " "3.9. Use ``bdist_wheel`` (wheel packages) instead. (Contributed by Hugo van " "Kemenade in :issue:`45124`.)" msgstr "" -#: whatsnew/3.11.rst:1974 +#: whatsnew/3.11.rst:1988 msgid "" "Removed the :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." "DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." @@ -3027,7 +3186,7 @@ msgid "" "in :issue:`45132`.)" msgstr "" -#: whatsnew/3.11.rst:1979 +#: whatsnew/3.11.rst:1993 msgid "" "Removed the deprecated :mod:`gettext` functions :func:`!lgettext`, :func:`!" "ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed the :" @@ -3038,102 +3197,101 @@ msgid "" "by Donghee Na and Serhiy Storchaka in :issue:`44235`.)" msgstr "" -#: whatsnew/3.11.rst:1989 +#: whatsnew/3.11.rst:2003 msgid "Removed from the :mod:`inspect` module:" msgstr "" -#: whatsnew/3.11.rst:1991 +#: whatsnew/3.11.rst:2005 msgid "" "The :func:`!getargspec` function, deprecated since Python 3.0; use :func:" "`inspect.signature` or :func:`inspect.getfullargspec` instead." msgstr "" -#: whatsnew/3.11.rst:1994 +#: whatsnew/3.11.rst:2008 msgid "" "The :func:`!formatargspec` function, deprecated since Python 3.5; use the :" "func:`inspect.signature` function or the :class:`inspect.Signature` object " "directly." msgstr "" -#: whatsnew/3.11.rst:1998 +#: whatsnew/3.11.rst:2012 msgid "" "The undocumented :meth:`!Signature.from_builtin` and :meth:`!Signature." "from_function` methods, deprecated since Python 3.5; use the :meth:" "`Signature.from_callable() ` method instead." msgstr "" -#: whatsnew/3.11.rst:2003 +#: whatsnew/3.11.rst:2017 msgid "(Contributed by Hugo van Kemenade in :issue:`45320`.)" msgstr "" -#: whatsnew/3.11.rst:2005 +#: whatsnew/3.11.rst:2019 msgid "" "Removed the :meth:`~object.__class_getitem__` method from :class:`pathlib." "PurePath`, because it was not used and added by mistake in previous " "versions. (Contributed by Nikita Sobolev in :issue:`46483`.)" msgstr "" -#: whatsnew/3.11.rst:2010 +#: whatsnew/3.11.rst:2024 msgid "" "Removed the :class:`!MailmanProxy` class in the :mod:`!smtpd` module, as it " "is unusable without the external :mod:`!mailman` package. (Contributed by " "Donghee Na in :issue:`35800`.)" msgstr "" -#: whatsnew/3.11.rst:2014 +#: whatsnew/3.11.rst:2028 msgid "" "Removed the deprecated :meth:`!split` method of :class:`!_tkinter." "TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" msgstr "" -#: whatsnew/3.11.rst:2017 +#: whatsnew/3.11.rst:2031 msgid "" "Removed namespace package support from :mod:`unittest` discovery. It was " "introduced in Python 3.4 but has been broken since Python 3.7. (Contributed " "by Inada Naoki in :issue:`23882`.)" msgstr "" -#: whatsnew/3.11.rst:2021 +#: whatsnew/3.11.rst:2035 msgid "" -"Removed the undocumented private :meth:`!float.__set_format__()` method, " -"previously known as :meth:`!float.__setformat__()` in Python 3.7. Its " +"Removed the undocumented private :meth:`!float.__set_format__` method, " +"previously known as :meth:`!float.__setformat__` in Python 3.7. Its " "docstring said: \"You probably don't want to use this function. It exists " "mainly to be used in Python's test suite.\" (Contributed by Victor Stinner " "in :issue:`46852`.)" msgstr "" -#: whatsnew/3.11.rst:2027 +#: whatsnew/3.11.rst:2041 msgid "" "The :option:`!--experimental-isolated-subinterpreters` configure flag (and " "corresponding :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` macro) have " "been removed." msgstr "" -#: whatsnew/3.11.rst:2031 +#: whatsnew/3.11.rst:2045 msgid "" -"`Pynche `_ --- The Pythonically Natural " -"Color and Hue Editor --- has been moved out of ``Tools/scripts`` and is " -"`being developed independently `_ from the Python source tree." +":pypi:`Pynche` --- The Pythonically Natural Color and Hue Editor --- has " +"been moved out of ``Tools/scripts`` and is `being developed independently " +"`_ from the Python source tree." msgstr "" -#: whatsnew/3.11.rst:2263 +#: whatsnew/3.11.rst:2277 msgid "Porting to Python 3.11" msgstr "" -#: whatsnew/3.11.rst:2043 +#: whatsnew/3.11.rst:2057 msgid "" "This section lists previously described changes and other bugfixes in the " "Python API that may require changes to your Python code." msgstr "" -#: whatsnew/3.11.rst:2046 +#: whatsnew/3.11.rst:2060 msgid "" "Porting notes for the C API are :ref:`listed separately `." msgstr "" -#: whatsnew/3.11.rst:2049 +#: whatsnew/3.11.rst:2063 msgid "" ":func:`open`, :func:`io.open`, :func:`codecs.open` and :class:`fileinput." "FileInput` no longer accept ``'U'`` (\"universal newline\") in the file " @@ -3144,7 +3302,7 @@ msgid "" "Stinner in :issue:`37330`.)" msgstr "" -#: whatsnew/3.11.rst:2058 +#: whatsnew/3.11.rst:2072 msgid "" ":class:`ast.AST` node positions are now validated when provided to :func:" "`compile` and other related functions. If invalid positions are detected, a :" @@ -3152,14 +3310,14 @@ msgid "" "`93351`)" msgstr "" -#: whatsnew/3.11.rst:2062 +#: whatsnew/3.11.rst:2076 msgid "" "Prohibited passing non-:class:`concurrent.futures.ThreadPoolExecutor` " "executors to :meth:`asyncio.loop.set_default_executor` following a " "deprecation in Python 3.8. (Contributed by Illia Volochii in :issue:`43234`.)" msgstr "" -#: whatsnew/3.11.rst:2067 +#: whatsnew/3.11.rst:2081 msgid "" ":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` and :class:" "`calendar.LocaleHTMLCalendar` classes now use :func:`locale.getlocale`, " @@ -3167,14 +3325,14 @@ msgid "" "(Contributed by Victor Stinner in :issue:`46659`.)" msgstr "" -#: whatsnew/3.11.rst:2073 +#: whatsnew/3.11.rst:2087 msgid "" "The :mod:`pdb` module now reads the :file:`.pdbrc` configuration file with " "the ``'UTF-8'`` encoding. (Contributed by Srinivas Reddy Thatiparthy (శ్రీనివాస్ " "రెడ్డి తాటిపర్తి) in :issue:`41137`.)" msgstr "" -#: whatsnew/3.11.rst:2077 +#: whatsnew/3.11.rst:2091 msgid "" "The *population* parameter of :func:`random.sample` must be a sequence, and " "automatic conversion of :class:`set`\\s to :class:`list`\\s is no longer " @@ -3183,14 +3341,14 @@ msgid "" "`40465`.)" msgstr "" -#: whatsnew/3.11.rst:2083 +#: whatsnew/3.11.rst:2097 msgid "" "The *random* optional parameter of :func:`random.shuffle` was removed. It " "was previously an arbitrary random function to use for the shuffle; now, :" "func:`random.random` (its previous default) will always be used." msgstr "" -#: whatsnew/3.11.rst:2087 +#: whatsnew/3.11.rst:2101 msgid "" "In :mod:`re` :ref:`re-syntax`, global inline flags (e.g. ``(?i)``) can now " "only be used at the start of regular expressions. Using them elsewhere has " @@ -3198,7 +3356,7 @@ msgid "" "`47066`.)" msgstr "" -#: whatsnew/3.11.rst:2092 +#: whatsnew/3.11.rst:2106 msgid "" "In the :mod:`re` module, several long-standing bugs where fixed that, in " "rare cases, could cause capture groups to get the wrong result. Therefore, " @@ -3206,11 +3364,11 @@ msgid "" "in :issue:`35859`.)" msgstr "" -#: whatsnew/3.11.rst:2101 +#: whatsnew/3.11.rst:2115 msgid "Build Changes" msgstr "" -#: whatsnew/3.11.rst:2103 +#: whatsnew/3.11.rst:2117 msgid "" "CPython now has :pep:`11` :pep:`Tier 3 support <11#tier-3>` for cross " "compiling to the `WebAssembly `_ platforms " @@ -3225,11 +3383,11 @@ msgid "" "gh:`90473`; platforms promoted in :gh:`95085`)" msgstr "" -#: whatsnew/3.11.rst:2117 +#: whatsnew/3.11.rst:2131 msgid "Building CPython now requires:" msgstr "" -#: whatsnew/3.11.rst:2119 +#: whatsnew/3.11.rst:2133 msgid "" "A `C11 `_ compiler and standard library. " "`Optional C11 features `_ floating " +"Support for `IEEE 754 `_ floating-" "point numbers. (Contributed by Victor Stinner in :issue:`46917`.)" msgstr "" -#: whatsnew/3.11.rst:2130 +#: whatsnew/3.11.rst:2144 msgid "" "The :c:macro:`!Py_NO_NAN` macro has been removed. Since CPython now requires " "IEEE 754 floats, NaN values are always available. (Contributed by Victor " "Stinner in :issue:`46656`.)" msgstr "" -#: whatsnew/3.11.rst:2134 +#: whatsnew/3.11.rst:2148 msgid "" "The :mod:`tkinter` package now requires `Tcl/Tk `_ " "version 8.5.12 or newer. (Contributed by Serhiy Storchaka in :issue:`46996`.)" msgstr "" -#: whatsnew/3.11.rst:2138 +#: whatsnew/3.11.rst:2152 msgid "" "Build dependencies, compiler flags, and linker flags for most stdlib " "extension modules are now detected by :program:`configure`. libffi, libnsl, " @@ -3269,13 +3427,13 @@ msgid "" "`45847`, :issue:`45747`, and :issue:`45763`.)" msgstr "" -#: whatsnew/3.11.rst:2148 +#: whatsnew/3.11.rst:2162 msgid "" "libpython is no longer linked against libcrypt. (Contributed by Mike Gilbert " "in :issue:`45433`.)" msgstr "" -#: whatsnew/3.11.rst:2151 +#: whatsnew/3.11.rst:2165 msgid "" "CPython can now be built with the `ThinLTO `_ option via passing ``thin`` to :option:`--with-lto`, i.e. " @@ -3283,15 +3441,14 @@ msgid "" "`44340`.)" msgstr "" -#: whatsnew/3.11.rst:2156 +#: whatsnew/3.11.rst:2170 msgid "" "Freelists for object structs can now be disabled. A new :program:`configure` " -"option :option:`--without-freelists` can be used to disable all freelists " -"except empty tuple singleton. (Contributed by Christian Heimes in :issue:" -"`45522`.)" +"option ``--without-freelists`` can be used to disable all freelists except " +"empty tuple singleton. (Contributed by Christian Heimes in :issue:`45522`.)" msgstr "" -#: whatsnew/3.11.rst:2161 +#: whatsnew/3.11.rst:2175 msgid "" "``Modules/Setup`` and ``Modules/makesetup`` have been improved and tied up. " "Extension modules can now be built through ``makesetup``. All except some " @@ -3300,7 +3457,7 @@ msgid "" "`45570`, :issue:`45571`, and :issue:`43974`.)" msgstr "" -#: whatsnew/3.11.rst:2168 +#: whatsnew/3.11.rst:2182 msgid "" "Use the environment variables :envvar:`!TCLTK_CFLAGS` and :envvar:`!" "TCLTK_LIBS` to manually specify the location of Tcl/Tk headers and " @@ -3308,7 +3465,7 @@ msgid "" "and :option:`!--with-tcltk-libs` have been removed." msgstr "" -#: whatsnew/3.11.rst:2174 +#: whatsnew/3.11.rst:2188 msgid "" "On RHEL 7 and CentOS 7 the development packages do not provide ``tcl.pc`` " "and ``tk.pc``; use ``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``. The " @@ -3316,7 +3473,7 @@ msgid "" "build Python with RHEL 7's and CentOS 7's Tcl/Tk and OpenSSL." msgstr "" -#: whatsnew/3.11.rst:2179 +#: whatsnew/3.11.rst:2193 msgid "" "CPython will now use 30-bit digits by default for the Python :class:`int` " "implementation. Previously, the default was to use 30-bit digits on " @@ -3328,23 +3485,23 @@ msgid "" "in :issue:`45569`.)" msgstr "" -#: whatsnew/3.11.rst:2192 +#: whatsnew/3.11.rst:2206 msgid "C API Changes" msgstr "" -#: whatsnew/3.11.rst:2199 +#: whatsnew/3.11.rst:2213 msgid "" "Add a new :c:func:`PyType_GetName` function to get type's short name. " "(Contributed by Hai Shi in :issue:`42035`.)" msgstr "" -#: whatsnew/3.11.rst:2202 +#: whatsnew/3.11.rst:2216 msgid "" "Add a new :c:func:`PyType_GetQualName` function to get type's qualified " "name. (Contributed by Hai Shi in :issue:`42035`.)" msgstr "" -#: whatsnew/3.11.rst:2205 +#: whatsnew/3.11.rst:2219 msgid "" "Add new :c:func:`PyThreadState_EnterTracing` and :c:func:" "`PyThreadState_LeaveTracing` functions to the limited C API to suspend and " @@ -3352,78 +3509,78 @@ msgid "" "`43760`.)" msgstr "" -#: whatsnew/3.11.rst:2210 +#: whatsnew/3.11.rst:2224 msgid "" "Added the :c:data:`Py_Version` constant which bears the same value as :c:" "macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta in :issue:" "`43931`.)" msgstr "" -#: whatsnew/3.11.rst:2214 +#: whatsnew/3.11.rst:2228 msgid "" ":c:type:`Py_buffer` and APIs are now part of the limited API and the stable " "ABI:" msgstr "" -#: whatsnew/3.11.rst:2217 +#: whatsnew/3.11.rst:2231 msgid ":c:func:`PyObject_CheckBuffer`" msgstr "" -#: whatsnew/3.11.rst:2218 +#: whatsnew/3.11.rst:2232 msgid ":c:func:`PyObject_GetBuffer`" msgstr "" -#: whatsnew/3.11.rst:2219 +#: whatsnew/3.11.rst:2233 msgid ":c:func:`PyBuffer_GetPointer`" msgstr "" -#: whatsnew/3.11.rst:2220 +#: whatsnew/3.11.rst:2234 msgid ":c:func:`PyBuffer_SizeFromFormat`" msgstr "" -#: whatsnew/3.11.rst:2221 +#: whatsnew/3.11.rst:2235 msgid ":c:func:`PyBuffer_ToContiguous`" msgstr "" -#: whatsnew/3.11.rst:2222 +#: whatsnew/3.11.rst:2236 msgid ":c:func:`PyBuffer_FromContiguous`" msgstr "" -#: whatsnew/3.11.rst:2223 +#: whatsnew/3.11.rst:2237 msgid ":c:func:`PyObject_CopyData`" msgstr "" -#: whatsnew/3.11.rst:2224 +#: whatsnew/3.11.rst:2238 msgid ":c:func:`PyBuffer_IsContiguous`" msgstr "" -#: whatsnew/3.11.rst:2225 +#: whatsnew/3.11.rst:2239 msgid ":c:func:`PyBuffer_FillContiguousStrides`" msgstr "" -#: whatsnew/3.11.rst:2226 +#: whatsnew/3.11.rst:2240 msgid ":c:func:`PyBuffer_FillInfo`" msgstr "" -#: whatsnew/3.11.rst:2227 +#: whatsnew/3.11.rst:2241 msgid ":c:func:`PyBuffer_Release`" msgstr "" -#: whatsnew/3.11.rst:2228 +#: whatsnew/3.11.rst:2242 msgid ":c:func:`PyMemoryView_FromBuffer`" msgstr "" -#: whatsnew/3.11.rst:2229 +#: whatsnew/3.11.rst:2243 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` type slots" msgstr "" -#: whatsnew/3.11.rst:2232 +#: whatsnew/3.11.rst:2246 msgid "(Contributed by Christian Heimes in :issue:`45459`.)" msgstr "" -#: whatsnew/3.11.rst:2234 +#: whatsnew/3.11.rst:2248 msgid "" "Added the :c:func:`PyType_GetModuleByDef` function, used to get the module " "in which a method was defined, in cases where this information is not " @@ -3431,7 +3588,7 @@ msgid "" "in :issue:`46613`.)" msgstr "" -#: whatsnew/3.11.rst:2239 +#: whatsnew/3.11.rst:2253 msgid "" "Add new functions to pack and unpack C double (serialize and deserialize): :" "c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:" @@ -3439,14 +3596,14 @@ msgid "" "`PyFloat_Unpack8`. (Contributed by Victor Stinner in :issue:`46906`.)" msgstr "" -#: whatsnew/3.11.rst:2245 +#: whatsnew/3.11.rst:2259 msgid "" "Add new functions to get frame object attributes: :c:func:" "`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:" "`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." msgstr "" -#: whatsnew/3.11.rst:2249 +#: whatsnew/3.11.rst:2263 msgid "" "Added two new functions to get and set the active exception instance: :c:" "func:`PyErr_GetHandledException` and :c:func:`PyErr_SetHandledException`. " @@ -3455,13 +3612,13 @@ msgid "" "exceptions. (Contributed by Irit Katriel in :issue:`46343`.)" msgstr "" -#: whatsnew/3.11.rst:2256 +#: whatsnew/3.11.rst:2270 msgid "" "Added the :c:member:`PyConfig.safe_path` member. (Contributed by Victor " "Stinner in :gh:`57684`.)" msgstr "" -#: whatsnew/3.11.rst:2267 +#: whatsnew/3.11.rst:2281 msgid "" "Some macros have been converted to static inline functions to avoid `macro " "pitfalls `_. The " @@ -3473,7 +3630,7 @@ msgid "" "Stinner and Erlend E. Aasland in :gh:`89653`.)" msgstr "" -#: whatsnew/3.11.rst:2278 +#: whatsnew/3.11.rst:2292 msgid "" ":c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback`` " "arguments, the interpreter now derives those values from the exception " @@ -3481,14 +3638,14 @@ msgid "" "all three arguments. (Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" -#: whatsnew/3.11.rst:2284 +#: whatsnew/3.11.rst:2298 msgid "" ":c:func:`PyErr_GetExcInfo()` now derives the ``type`` and ``traceback`` " "fields of the result from the exception instance (the ``value`` field). " "(Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" -#: whatsnew/3.11.rst:2288 +#: whatsnew/3.11.rst:2302 msgid "" ":c:struct:`_frozen` has a new ``is_package`` field to indicate whether or " "not the frozen module is a package. Previously, a negative value in the " @@ -3496,14 +3653,14 @@ msgid "" "``size``. (Contributed by Kumar Aditya in :issue:`46608`.)" msgstr "" -#: whatsnew/3.11.rst:2294 +#: whatsnew/3.11.rst:2308 msgid "" ":c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*`` as its " "second parameter, instead of ``PyFrameObject*``. See :pep:`523` for more " "details of how to use this function pointer type." msgstr "" -#: whatsnew/3.11.rst:2298 +#: whatsnew/3.11.rst:2312 msgid "" ":c:func:`!PyCode_New` and :c:func:`!PyCode_NewWithPosOnlyArgs` now take an " "additional ``exception_table`` argument. Using these functions should be " @@ -3512,7 +3669,7 @@ msgid "" "method." msgstr "" -#: whatsnew/3.11.rst:2304 +#: whatsnew/3.11.rst:2318 msgid "" ":c:type:`PyCodeObject` no longer has the ``co_code``, ``co_varnames``, " "``co_cellvars`` and ``co_freevars`` fields. Instead, use :c:func:" @@ -3522,35 +3679,70 @@ msgid "" "and :gh:`94936`.)" msgstr "" -#: whatsnew/3.11.rst:2312 +#: whatsnew/3.11.rst:2326 msgid "" "The old trashcan macros (``Py_TRASHCAN_SAFE_BEGIN``/" "``Py_TRASHCAN_SAFE_END``) are now deprecated. They should be replaced by the " "new macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: whatsnew/3.11.rst:2316 +#: whatsnew/3.11.rst:2330 msgid "A tp_dealloc function that has the old macros, such as::" msgstr "" -#: whatsnew/3.11.rst:2327 +#: whatsnew/3.11.rst:2332 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_SAFE_BEGIN(p);\n" +" ...\n" +" Py_TRASHCAN_SAFE_END\n" +"}" +msgstr "" + +#: whatsnew/3.11.rst:2341 msgid "should migrate to the new macros as follows::" msgstr "" -#: whatsnew/3.11.rst:2338 +#: whatsnew/3.11.rst:2343 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" +msgstr "" + +#: whatsnew/3.11.rst:2352 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in." msgstr "" -#: whatsnew/3.11.rst:2341 +#: whatsnew/3.11.rst:2355 msgid "" "To support older Python versions in the same codebase, you can define the " "following macros and use them throughout the code (credit: these were copied " "from the ``mypy`` codebase)::" msgstr "" -#: whatsnew/3.11.rst:2353 +#: whatsnew/3.11.rst:2359 +msgid "" +"#if PY_VERSION_HEX >= 0x03080000\n" +"# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc)\n" +"# define CPy_TRASHCAN_END(op) Py_TRASHCAN_END\n" +"#else\n" +"# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_SAFE_BEGIN(op)\n" +"# define CPy_TRASHCAN_END(op) Py_TRASHCAN_SAFE_END(op)\n" +"#endif" +msgstr "" + +#: whatsnew/3.11.rst:2367 msgid "" "The :c:func:`PyType_Ready` function now raises an error if a type is defined " "with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function " @@ -3558,7 +3750,7 @@ msgid "" "issue:`44263`.)" msgstr "" -#: whatsnew/3.11.rst:2358 +#: whatsnew/3.11.rst:2372 msgid "" "Heap types with the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit " "the :pep:`590` vectorcall protocol. Previously, this was only possible for :" @@ -3566,7 +3758,7 @@ msgid "" "issue:`43908`)" msgstr "" -#: whatsnew/3.11.rst:2363 +#: whatsnew/3.11.rst:2377 msgid "" "Since :c:func:`Py_TYPE()` is changed to a inline static function, " "``Py_TYPE(obj) = new_type`` must be replaced with ``Py_SET_TYPE(obj, " @@ -3574,11 +3766,20 @@ msgid "" "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" -#: whatsnew/3.11.rst:2389 +#: whatsnew/3.11.rst:2383 +msgid "" +"#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)\n" +"static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type)\n" +"{ ob->ob_type = type; }\n" +"#define Py_SET_TYPE(ob, type) _Py_SET_TYPE((PyObject*)(ob), type)\n" +"#endif" +msgstr "" + +#: whatsnew/3.11.rst:2403 msgid "(Contributed by Victor Stinner in :issue:`39573`.)" msgstr "" -#: whatsnew/3.11.rst:2377 +#: whatsnew/3.11.rst:2391 msgid "" "Since :c:func:`Py_SIZE()` is changed to a inline static function, " "``Py_SIZE(obj) = new_size`` must be replaced with ``Py_SET_SIZE(obj, " @@ -3586,7 +3787,16 @@ msgid "" "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" -#: whatsnew/3.11.rst:2391 +#: whatsnew/3.11.rst:2397 +msgid "" +"#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)\n" +"static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)\n" +"{ ob->ob_size = size; }\n" +"#define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)\n" +"#endif" +msgstr "" + +#: whatsnew/3.11.rst:2405 msgid "" "```` no longer includes the header files ````, ````, ```` and ```` when the ``Py_LIMITED_API`` macro is " @@ -3595,7 +3805,7 @@ msgid "" "(Contributed by Victor Stinner in :issue:`45434`.)" msgstr "" -#: whatsnew/3.11.rst:2397 +#: whatsnew/3.11.rst:2411 msgid "" "The non-limited API files ``cellobject.h``, ``classobject.h``, ``code.h``, " "``context.h``, ``funcobject.h``, ``genobject.h`` and ``longintrepr.h`` have " @@ -3606,7 +3816,7 @@ msgid "" "instead. (Contributed by Victor Stinner in :issue:`35134`.)" msgstr "" -#: whatsnew/3.11.rst:2405 +#: whatsnew/3.11.rst:2419 msgid "" "The :c:func:`!PyUnicode_CHECK_INTERNED` macro has been excluded from the " "limited C API. It was never usable there, because it used internal " @@ -3614,149 +3824,149 @@ msgid "" "Victor Stinner in :issue:`46007`.)" msgstr "" -#: whatsnew/3.11.rst:2410 +#: whatsnew/3.11.rst:2424 msgid "" "The following frame functions and type are now directly available with " "``#include ``, it's no longer needed to add ``#include " "``:" msgstr "" -#: whatsnew/3.11.rst:2414 +#: whatsnew/3.11.rst:2428 msgid ":c:func:`PyFrame_Check`" msgstr "" -#: whatsnew/3.11.rst:2415 +#: whatsnew/3.11.rst:2429 msgid ":c:func:`PyFrame_GetBack`" msgstr "" -#: whatsnew/3.11.rst:2416 +#: whatsnew/3.11.rst:2430 msgid ":c:func:`PyFrame_GetBuiltins`" msgstr "" -#: whatsnew/3.11.rst:2417 +#: whatsnew/3.11.rst:2431 msgid ":c:func:`PyFrame_GetGenerator`" msgstr "" -#: whatsnew/3.11.rst:2418 +#: whatsnew/3.11.rst:2432 msgid ":c:func:`PyFrame_GetGlobals`" msgstr "" -#: whatsnew/3.11.rst:2419 +#: whatsnew/3.11.rst:2433 msgid ":c:func:`PyFrame_GetLasti`" msgstr "" -#: whatsnew/3.11.rst:2420 +#: whatsnew/3.11.rst:2434 msgid ":c:func:`PyFrame_GetLocals`" msgstr "" -#: whatsnew/3.11.rst:2421 +#: whatsnew/3.11.rst:2435 msgid ":c:type:`PyFrame_Type`" msgstr "" -#: whatsnew/3.11.rst:2423 +#: whatsnew/3.11.rst:2437 msgid "(Contributed by Victor Stinner in :gh:`93937`.)" msgstr "" -#: whatsnew/3.11.rst:2427 +#: whatsnew/3.11.rst:2441 msgid "" "The :c:type:`PyFrameObject` structure members have been removed from the " "public C API." msgstr "" -#: whatsnew/3.11.rst:2430 +#: whatsnew/3.11.rst:2444 msgid "" "While the documentation notes that the :c:type:`PyFrameObject` fields are " "subject to change at any time, they have been stable for a long time and " "were used in several popular extensions." msgstr "" -#: whatsnew/3.11.rst:2434 +#: whatsnew/3.11.rst:2448 msgid "" "In Python 3.11, the frame struct was reorganized to allow performance " "optimizations. Some fields were removed entirely, as they were details of " "the old implementation." msgstr "" -#: whatsnew/3.11.rst:2438 +#: whatsnew/3.11.rst:2452 msgid ":c:type:`PyFrameObject` fields:" msgstr "" -#: whatsnew/3.11.rst:2440 +#: whatsnew/3.11.rst:2454 msgid "``f_back``: use :c:func:`PyFrame_GetBack`." msgstr "" -#: whatsnew/3.11.rst:2441 +#: whatsnew/3.11.rst:2455 msgid "``f_blockstack``: removed." msgstr "" -#: whatsnew/3.11.rst:2442 +#: whatsnew/3.11.rst:2456 msgid "``f_builtins``: use :c:func:`PyFrame_GetBuiltins`." msgstr "" -#: whatsnew/3.11.rst:2443 +#: whatsnew/3.11.rst:2457 msgid "``f_code``: use :c:func:`PyFrame_GetCode`." msgstr "" -#: whatsnew/3.11.rst:2444 +#: whatsnew/3.11.rst:2458 msgid "``f_gen``: use :c:func:`PyFrame_GetGenerator`." msgstr "" -#: whatsnew/3.11.rst:2445 +#: whatsnew/3.11.rst:2459 msgid "``f_globals``: use :c:func:`PyFrame_GetGlobals`." msgstr "" -#: whatsnew/3.11.rst:2446 +#: whatsnew/3.11.rst:2460 msgid "``f_iblock``: removed." msgstr "" -#: whatsnew/3.11.rst:2447 +#: whatsnew/3.11.rst:2461 msgid "" "``f_lasti``: use :c:func:`PyFrame_GetLasti`. Code using ``f_lasti`` with " "``PyCode_Addr2Line()`` should use :c:func:`PyFrame_GetLineNumber` instead; " "it may be faster." msgstr "" -#: whatsnew/3.11.rst:2450 +#: whatsnew/3.11.rst:2464 msgid "``f_lineno``: use :c:func:`PyFrame_GetLineNumber`" msgstr "" -#: whatsnew/3.11.rst:2451 +#: whatsnew/3.11.rst:2465 msgid "``f_locals``: use :c:func:`PyFrame_GetLocals`." msgstr "" -#: whatsnew/3.11.rst:2452 +#: whatsnew/3.11.rst:2466 msgid "``f_stackdepth``: removed." msgstr "" -#: whatsnew/3.11.rst:2453 +#: whatsnew/3.11.rst:2467 msgid "``f_state``: no public API (renamed to ``f_frame.f_state``)." msgstr "" -#: whatsnew/3.11.rst:2454 +#: whatsnew/3.11.rst:2468 msgid "``f_trace``: no public API." msgstr "" -#: whatsnew/3.11.rst:2455 +#: whatsnew/3.11.rst:2469 msgid "" "``f_trace_lines``: use ``PyObject_GetAttrString((PyObject*)frame, " "\"f_trace_lines\")``." msgstr "" -#: whatsnew/3.11.rst:2456 +#: whatsnew/3.11.rst:2470 msgid "" "``f_trace_opcodes``: use ``PyObject_GetAttrString((PyObject*)frame, " "\"f_trace_opcodes\")``." msgstr "" -#: whatsnew/3.11.rst:2457 +#: whatsnew/3.11.rst:2471 msgid "``f_localsplus``: no public API (renamed to ``f_frame.localsplus``)." msgstr "" -#: whatsnew/3.11.rst:2458 +#: whatsnew/3.11.rst:2472 msgid "``f_valuestack``: removed." msgstr "" -#: whatsnew/3.11.rst:2460 +#: whatsnew/3.11.rst:2474 msgid "" "The Python frame object is now created lazily. A side effect is that the :" "attr:`~frame.f_back` member must not be accessed directly, since its value " @@ -3764,7 +3974,7 @@ msgid "" "called instead." msgstr "" -#: whatsnew/3.11.rst:2466 +#: whatsnew/3.11.rst:2480 msgid "" "Debuggers that accessed the :attr:`~frame.f_locals` directly *must* call :c:" "func:`PyFrame_GetLocals` instead. They no longer need to call :c:func:`!" @@ -3773,71 +3983,131 @@ msgid "" "now managed by the virtual machine." msgstr "" -#: whatsnew/3.11.rst:2472 +#: whatsnew/3.11.rst:2486 msgid "Code defining ``PyFrame_GetCode()`` on Python 3.8 and older::" msgstr "" -#: whatsnew/3.11.rst:2482 +#: whatsnew/3.11.rst:2488 +msgid "" +"#if PY_VERSION_HEX < 0x030900B1\n" +"static inline PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)\n" +"{\n" +" Py_INCREF(frame->f_code);\n" +" return frame->f_code;\n" +"}\n" +"#endif" +msgstr "" + +#: whatsnew/3.11.rst:2496 msgid "Code defining ``PyFrame_GetBack()`` on Python 3.8 and older::" msgstr "" -#: whatsnew/3.11.rst:2492 +#: whatsnew/3.11.rst:2498 +msgid "" +"#if PY_VERSION_HEX < 0x030900B1\n" +"static inline PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)\n" +"{\n" +" Py_XINCREF(frame->f_back);\n" +" return frame->f_back;\n" +"}\n" +"#endif" +msgstr "" + +#: whatsnew/3.11.rst:2506 msgid "" "Or use the `pythoncapi_compat project `__ to get these two functions on older Python versions." msgstr "" -#: whatsnew/3.11.rst:2496 +#: whatsnew/3.11.rst:2510 msgid "Changes of the :c:type:`PyThreadState` structure members:" msgstr "" -#: whatsnew/3.11.rst:2498 +#: whatsnew/3.11.rst:2512 msgid "" "``frame``: removed, use :c:func:`PyThreadState_GetFrame` (function added to " "Python 3.9 by :issue:`40429`). Warning: the function returns a :term:`strong " "reference`, need to call :c:func:`Py_XDECREF`." msgstr "" -#: whatsnew/3.11.rst:2502 +#: whatsnew/3.11.rst:2516 msgid "" "``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` and :c:func:" "`PyThreadState_LeaveTracing` (functions added to Python 3.11 by :issue:" "`43760`)." msgstr "" -#: whatsnew/3.11.rst:2505 +#: whatsnew/3.11.rst:2519 msgid "" "``recursion_depth``: removed, use ``(tstate->recursion_limit - tstate-" ">recursion_remaining)`` instead." msgstr "" -#: whatsnew/3.11.rst:2507 +#: whatsnew/3.11.rst:2521 msgid "``stackcheck_counter``: removed." msgstr "" -#: whatsnew/3.11.rst:2509 +#: whatsnew/3.11.rst:2523 msgid "Code defining ``PyThreadState_GetFrame()`` on Python 3.8 and older::" msgstr "" -#: whatsnew/3.11.rst:2519 +#: whatsnew/3.11.rst:2525 +msgid "" +"#if PY_VERSION_HEX < 0x030900B1\n" +"static inline PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)\n" +"{\n" +" Py_XINCREF(tstate->frame);\n" +" return tstate->frame;\n" +"}\n" +"#endif" +msgstr "" + +#: whatsnew/3.11.rst:2533 msgid "" "Code defining ``PyThreadState_EnterTracing()`` and " "``PyThreadState_LeaveTracing()`` on Python 3.10 and older::" msgstr "" -#: whatsnew/3.11.rst:2545 +#: whatsnew/3.11.rst:2536 +msgid "" +"#if PY_VERSION_HEX < 0x030B00A2\n" +"static inline void PyThreadState_EnterTracing(PyThreadState *tstate)\n" +"{\n" +" tstate->tracing++;\n" +"#if PY_VERSION_HEX >= 0x030A00A1\n" +" tstate->cframe->use_tracing = 0;\n" +"#else\n" +" tstate->use_tracing = 0;\n" +"#endif\n" +"}\n" +"\n" +"static inline void PyThreadState_LeaveTracing(PyThreadState *tstate)\n" +"{\n" +" int use_tracing = (tstate->c_tracefunc != NULL || tstate->c_profilefunc !" +"= NULL);\n" +" tstate->tracing--;\n" +"#if PY_VERSION_HEX >= 0x030A00A1\n" +" tstate->cframe->use_tracing = use_tracing;\n" +"#else\n" +" tstate->use_tracing = use_tracing;\n" +"#endif\n" +"}\n" +"#endif" +msgstr "" + +#: whatsnew/3.11.rst:2559 msgid "" "Or use `the pythoncapi-compat project `__ to get these functions on old Python functions." msgstr "" -#: whatsnew/3.11.rst:2549 +#: whatsnew/3.11.rst:2563 msgid "" "Distributors are encouraged to build Python with the optimized Blake2 " "library `libb2`_." msgstr "" -#: whatsnew/3.11.rst:2552 +#: whatsnew/3.11.rst:2566 msgid "" "The :c:member:`PyConfig.module_search_paths_set` field must now be set to 1 " "for initialization to use :c:member:`PyConfig.module_search_paths` to " @@ -3845,7 +4115,7 @@ msgid "" "path and replace any values added to ``module_search_paths``." msgstr "" -#: whatsnew/3.11.rst:2557 +#: whatsnew/3.11.rst:2571 msgid "" ":c:func:`PyConfig_Read` no longer calculates the initial search path, and " "will not fill any values into :c:member:`PyConfig.module_search_paths`. To " @@ -3854,177 +4124,177 @@ msgid "" "object and modify it directly." msgstr "" -#: whatsnew/3.11.rst:2568 +#: whatsnew/3.11.rst:2582 msgid "" "Deprecate the following functions to configure the Python initialization:" msgstr "" -#: whatsnew/3.11.rst:2570 +#: whatsnew/3.11.rst:2584 msgid ":c:func:`!PySys_AddWarnOptionUnicode`" msgstr "" -#: whatsnew/3.11.rst:2571 +#: whatsnew/3.11.rst:2585 msgid ":c:func:`!PySys_AddWarnOption`" msgstr "" -#: whatsnew/3.11.rst:2572 +#: whatsnew/3.11.rst:2586 msgid ":c:func:`!PySys_AddXOption`" msgstr "" -#: whatsnew/3.11.rst:2573 +#: whatsnew/3.11.rst:2587 msgid ":c:func:`!PySys_HasWarnOptions`" msgstr "" -#: whatsnew/3.11.rst:2574 +#: whatsnew/3.11.rst:2588 msgid ":c:func:`!PySys_SetArgvEx`" msgstr "" -#: whatsnew/3.11.rst:2575 +#: whatsnew/3.11.rst:2589 msgid ":c:func:`!PySys_SetArgv`" msgstr "" -#: whatsnew/3.11.rst:2576 +#: whatsnew/3.11.rst:2590 msgid ":c:func:`!PySys_SetPath`" msgstr "" -#: whatsnew/3.11.rst:2577 +#: whatsnew/3.11.rst:2591 msgid ":c:func:`!Py_SetPath`" msgstr "" -#: whatsnew/3.11.rst:2578 +#: whatsnew/3.11.rst:2592 msgid ":c:func:`!Py_SetProgramName`" msgstr "" -#: whatsnew/3.11.rst:2579 +#: whatsnew/3.11.rst:2593 msgid ":c:func:`!Py_SetPythonHome`" msgstr "" -#: whatsnew/3.11.rst:2580 +#: whatsnew/3.11.rst:2594 msgid ":c:func:`!Py_SetStandardStreamEncoding`" msgstr "" -#: whatsnew/3.11.rst:2581 +#: whatsnew/3.11.rst:2595 msgid ":c:func:`!_Py_SetProgramFullPath`" msgstr "" -#: whatsnew/3.11.rst:2583 +#: whatsnew/3.11.rst:2597 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration ` instead (:pep:`587`). (Contributed by Victor " "Stinner in :gh:`88279`.)" msgstr "" -#: whatsnew/3.11.rst:2587 +#: whatsnew/3.11.rst:2601 msgid "" "Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:" "func:`PyObject_Hash` instead. (Contributed by Inada Naoki in :issue:`46864`.)" msgstr "" -#: whatsnew/3.11.rst:2596 +#: whatsnew/3.11.rst:2610 msgid "" "The following C APIs have been deprecated in earlier Python releases, and " "will be removed in Python 3.12." msgstr "" -#: whatsnew/3.11.rst:2599 +#: whatsnew/3.11.rst:2613 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr "" -#: whatsnew/3.11.rst:2600 +#: whatsnew/3.11.rst:2614 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr "" -#: whatsnew/3.11.rst:2601 +#: whatsnew/3.11.rst:2615 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr "" -#: whatsnew/3.11.rst:2602 +#: whatsnew/3.11.rst:2616 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr "" -#: whatsnew/3.11.rst:2603 +#: whatsnew/3.11.rst:2617 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr "" -#: whatsnew/3.11.rst:2604 +#: whatsnew/3.11.rst:2618 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr "" -#: whatsnew/3.11.rst:2605 +#: whatsnew/3.11.rst:2619 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr "" -#: whatsnew/3.11.rst:2606 +#: whatsnew/3.11.rst:2620 msgid ":c:func:`!PyUnicode_GetSize`" msgstr "" -#: whatsnew/3.11.rst:2607 +#: whatsnew/3.11.rst:2621 msgid ":c:func:`!PyUnicode_IS_COMPACT`" msgstr "" -#: whatsnew/3.11.rst:2608 +#: whatsnew/3.11.rst:2622 msgid ":c:func:`!PyUnicode_IS_READY`" msgstr "" -#: whatsnew/3.11.rst:2609 +#: whatsnew/3.11.rst:2623 msgid ":c:func:`PyUnicode_READY`" msgstr "" -#: whatsnew/3.11.rst:2610 +#: whatsnew/3.11.rst:2624 msgid ":c:func:`!PyUnicode_WSTR_LENGTH`" msgstr "" -#: whatsnew/3.11.rst:2611 +#: whatsnew/3.11.rst:2625 msgid ":c:func:`!_PyUnicode_AsUnicode`" msgstr "" -#: whatsnew/3.11.rst:2612 +#: whatsnew/3.11.rst:2626 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr "" -#: whatsnew/3.11.rst:2613 +#: whatsnew/3.11.rst:2627 msgid ":c:type:`PyUnicodeObject`" msgstr "" -#: whatsnew/3.11.rst:2614 +#: whatsnew/3.11.rst:2628 msgid ":c:func:`!PyUnicode_InternImmortal`" msgstr "" -#: whatsnew/3.11.rst:2622 +#: whatsnew/3.11.rst:2636 msgid "" ":c:func:`!PyFrame_BlockSetup` and :c:func:`!PyFrame_BlockPop` have been " "removed. (Contributed by Mark Shannon in :issue:`40222`.)" msgstr "" -#: whatsnew/3.11.rst:2626 +#: whatsnew/3.11.rst:2640 msgid "Remove the following math macros using the ``errno`` variable:" msgstr "" -#: whatsnew/3.11.rst:2628 +#: whatsnew/3.11.rst:2642 msgid "``Py_ADJUST_ERANGE1()``" msgstr "" -#: whatsnew/3.11.rst:2629 +#: whatsnew/3.11.rst:2643 msgid "``Py_ADJUST_ERANGE2()``" msgstr "" -#: whatsnew/3.11.rst:2630 +#: whatsnew/3.11.rst:2644 msgid "``Py_OVERFLOWED()``" msgstr "" -#: whatsnew/3.11.rst:2631 +#: whatsnew/3.11.rst:2645 msgid "``Py_SET_ERANGE_IF_OVERFLOW()``" msgstr "" -#: whatsnew/3.11.rst:2632 +#: whatsnew/3.11.rst:2646 msgid "``Py_SET_ERRNO_ON_MATH_ERROR()``" msgstr "" -#: whatsnew/3.11.rst:2634 +#: whatsnew/3.11.rst:2648 msgid "(Contributed by Victor Stinner in :issue:`45412`.)" msgstr "" -#: whatsnew/3.11.rst:2636 +#: whatsnew/3.11.rst:2650 msgid "" "Remove ``Py_UNICODE_COPY()`` and ``Py_UNICODE_FILL()`` macros, deprecated " "since Python 3.3. Use ``PyUnicode_CopyCharacters()`` or ``memcpy()`` " @@ -4032,62 +4302,62 @@ msgid "" "(Contributed by Victor Stinner in :issue:`41123`.)" msgstr "" -#: whatsnew/3.11.rst:2641 +#: whatsnew/3.11.rst:2655 msgid "" "Remove the ``pystrhex.h`` header file. It only contains private functions. C " "extensions should only include the main ```` header file. " "(Contributed by Victor Stinner in :issue:`45434`.)" msgstr "" -#: whatsnew/3.11.rst:2645 +#: whatsnew/3.11.rst:2659 msgid "" "Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the " "``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner in :issue:" "`45440`.)" msgstr "" -#: whatsnew/3.11.rst:2649 +#: whatsnew/3.11.rst:2663 msgid "" "The following items are no longer available when :c:macro:`Py_LIMITED_API` " "is defined:" msgstr "" -#: whatsnew/3.11.rst:2652 +#: whatsnew/3.11.rst:2666 msgid ":c:func:`PyMarshal_WriteLongToFile`" msgstr "" -#: whatsnew/3.11.rst:2653 +#: whatsnew/3.11.rst:2667 msgid ":c:func:`PyMarshal_WriteObjectToFile`" msgstr "" -#: whatsnew/3.11.rst:2654 +#: whatsnew/3.11.rst:2668 msgid ":c:func:`PyMarshal_ReadObjectFromString`" msgstr "" -#: whatsnew/3.11.rst:2655 +#: whatsnew/3.11.rst:2669 msgid ":c:func:`PyMarshal_WriteObjectToString`" msgstr "" -#: whatsnew/3.11.rst:2656 +#: whatsnew/3.11.rst:2670 msgid "the ``Py_MARSHAL_VERSION`` macro" msgstr "" -#: whatsnew/3.11.rst:2658 +#: whatsnew/3.11.rst:2672 msgid "These are not part of the :ref:`limited API `." msgstr "" -#: whatsnew/3.11.rst:2660 +#: whatsnew/3.11.rst:2674 msgid "(Contributed by Victor Stinner in :issue:`45474`.)" msgstr "" -#: whatsnew/3.11.rst:2662 +#: whatsnew/3.11.rst:2676 msgid "" "Exclude :c:func:`PyWeakref_GET_OBJECT` from the limited C API. It never " "worked since the :c:type:`!PyWeakReference` structure is opaque in the " "limited C API. (Contributed by Victor Stinner in :issue:`35134`.)" msgstr "" -#: whatsnew/3.11.rst:2667 +#: whatsnew/3.11.rst:2681 msgid "" "Remove the ``PyHeapType_GET_MEMBERS()`` macro. It was exposed in the public " "C API by mistake, it must only be used by Python internally. Use the " @@ -4095,90 +4365,90 @@ msgid "" "in :issue:`40170`.)" msgstr "" -#: whatsnew/3.11.rst:2672 +#: whatsnew/3.11.rst:2686 msgid "" "Remove the ``HAVE_PY_SET_53BIT_PRECISION`` macro (moved to the internal C " "API). (Contributed by Victor Stinner in :issue:`45412`.)" msgstr "" -#: whatsnew/3.11.rst:2678 +#: whatsnew/3.11.rst:2692 msgid "" "Remove the :c:type:`Py_UNICODE` encoder APIs, as they have been deprecated " "since Python 3.3, are little used and are inefficient relative to the " "recommended alternatives." msgstr "" -#: whatsnew/3.11.rst:2683 +#: whatsnew/3.11.rst:2697 msgid "The removed functions are:" msgstr "" -#: whatsnew/3.11.rst:2685 +#: whatsnew/3.11.rst:2699 msgid ":func:`!PyUnicode_Encode`" msgstr "" -#: whatsnew/3.11.rst:2686 +#: whatsnew/3.11.rst:2700 msgid ":func:`!PyUnicode_EncodeASCII`" msgstr "" -#: whatsnew/3.11.rst:2687 +#: whatsnew/3.11.rst:2701 msgid ":func:`!PyUnicode_EncodeLatin1`" msgstr "" -#: whatsnew/3.11.rst:2688 +#: whatsnew/3.11.rst:2702 msgid ":func:`!PyUnicode_EncodeUTF7`" msgstr "" -#: whatsnew/3.11.rst:2689 +#: whatsnew/3.11.rst:2703 msgid ":func:`!PyUnicode_EncodeUTF8`" msgstr "" -#: whatsnew/3.11.rst:2690 +#: whatsnew/3.11.rst:2704 msgid ":func:`!PyUnicode_EncodeUTF16`" msgstr "" -#: whatsnew/3.11.rst:2691 +#: whatsnew/3.11.rst:2705 msgid ":func:`!PyUnicode_EncodeUTF32`" msgstr "" -#: whatsnew/3.11.rst:2692 +#: whatsnew/3.11.rst:2706 msgid ":func:`!PyUnicode_EncodeUnicodeEscape`" msgstr "" -#: whatsnew/3.11.rst:2693 +#: whatsnew/3.11.rst:2707 msgid ":func:`!PyUnicode_EncodeRawUnicodeEscape`" msgstr "" -#: whatsnew/3.11.rst:2694 +#: whatsnew/3.11.rst:2708 msgid ":func:`!PyUnicode_EncodeCharmap`" msgstr "" -#: whatsnew/3.11.rst:2695 +#: whatsnew/3.11.rst:2709 msgid ":func:`!PyUnicode_TranslateCharmap`" msgstr "" -#: whatsnew/3.11.rst:2696 +#: whatsnew/3.11.rst:2710 msgid ":func:`!PyUnicode_EncodeDecimal`" msgstr "" -#: whatsnew/3.11.rst:2697 +#: whatsnew/3.11.rst:2711 msgid ":func:`!PyUnicode_TransformDecimalToASCII`" msgstr "" -#: whatsnew/3.11.rst:2699 +#: whatsnew/3.11.rst:2713 msgid "" "See :pep:`624` for details and :pep:`migration guidance <624#alternative-" "apis>`. (Contributed by Inada Naoki in :issue:`44029`.)" msgstr "" -#: whatsnew/3.11.rst:2705 +#: whatsnew/3.11.rst:2719 msgid "Notable changes in 3.11.4" msgstr "" -#: whatsnew/3.11.rst:2708 +#: whatsnew/3.11.rst:2722 msgid "tarfile" msgstr "" -#: whatsnew/3.11.rst:2710 +#: whatsnew/3.11.rst:2724 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " @@ -4189,15 +4459,15 @@ msgid "" "Viktorin in :pep:`706`.)" msgstr "" -#: whatsnew/3.11.rst:2722 +#: whatsnew/3.11.rst:2736 msgid "Notable changes in 3.11.5" msgstr "" -#: whatsnew/3.11.rst:2725 +#: whatsnew/3.11.rst:2739 msgid "OpenSSL" msgstr "" -#: whatsnew/3.11.rst:2727 +#: whatsnew/3.11.rst:2741 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index f9e180fd..25152044 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -45,12 +46,12 @@ msgstr "" #: whatsnew/3.12.rst:62 msgid "" -"Python 3.12 is the latest stable release of the Python programming language, " -"with a mix of changes to the language and the standard library. The library " -"changes focus on cleaning up deprecated APIs, usability, and correctness. Of " -"note, the :mod:`!distutils` package has been removed from the standard " -"library. Filesystem support in :mod:`os` and :mod:`pathlib` has seen a " -"number of improvements, and several modules have better performance." +"Python 3.12 is a stable release of the Python programming language, with a " +"mix of changes to the language and the standard library. The library changes " +"focus on cleaning up deprecated APIs, usability, and correctness. Of note, " +"the :mod:`!distutils` package has been removed from the standard library. " +"Filesystem support in :mod:`os` and :mod:`pathlib` has seen a number of " +"improvements, and several modules have better performance." msgstr "" #: whatsnew/3.12.rst:69 @@ -232,11 +233,11 @@ msgstr "" #: whatsnew/3.12.rst:156 msgid "" -":pep:`632`: Remove the :mod:`!distutils` package. See `the migration guide " -"`_ for advice replacing " -"the APIs it provided. The third-party `Setuptools `__ package continues to " -"provide :mod:`!distutils`, if you still require it in Python 3.12 and beyond." +":pep:`632`: Remove the :mod:`!distutils` package. See :pep:`the migration " +"guide <0632#migration-advice>` for advice replacing the APIs it provided. " +"The third-party `Setuptools `__ package continues to provide :mod:`!distutils`, if " +"you still require it in Python 3.12 and beyond." msgstr "" #: whatsnew/3.12.rst:163 @@ -255,7 +256,7 @@ msgid "" "`_." msgstr "" -#: whatsnew/3.12.rst:1966 +#: whatsnew/3.12.rst:1856 msgid "New Features" msgstr "" @@ -277,6 +278,19 @@ msgid "" "functions>`::" msgstr "" +#: whatsnew/3.12.rst:190 +msgid "" +"def max[T](args: Iterable[T]) -> T:\n" +" ...\n" +"\n" +"class list[T]:\n" +" def __getitem__(self, index: int, /) -> T:\n" +" ...\n" +"\n" +" def append(self, element: T) -> None:\n" +" ..." +msgstr "" + #: whatsnew/3.12.rst:200 msgid "" "In addition, the PEP introduces a new way to declare :ref:`type aliases " @@ -284,10 +298,18 @@ msgid "" "instance of :class:`~typing.TypeAliasType`::" msgstr "" +#: whatsnew/3.12.rst:204 +msgid "type Point = tuple[float, float]" +msgstr "" + #: whatsnew/3.12.rst:206 msgid "Type aliases can also be :ref:`generic `::" msgstr "" +#: whatsnew/3.12.rst:208 +msgid "type Point[T] = tuple[T, T]" +msgstr "" + #: whatsnew/3.12.rst:210 msgid "" "The new syntax allows declaring :class:`~typing.TypeVarTuple` and :class:" @@ -295,6 +317,15 @@ msgid "" "parameters with bounds or constraints::" msgstr "" +#: whatsnew/3.12.rst:214 +msgid "" +"type IntFunc[**P] = Callable[P, int] # ParamSpec\n" +"type LabeledTuple[*Ts] = tuple[str, *Ts] # TypeVarTuple\n" +"type HashableSequence[T: Hashable] = Sequence[T] # TypeVar with bound\n" +"type IntOrStrSequence[T: (int, str)] = Sequence[T] # TypeVar with " +"constraints" +msgstr "" + #: whatsnew/3.12.rst:219 msgid "" "The value of type aliases and the bound and constraints of type variables " @@ -397,6 +428,15 @@ msgid "" "example, in Python 3.11, the following f-string raises a :exc:`SyntaxError`:" msgstr "" +#: whatsnew/3.12.rst:310 +msgid "" +">>> my_string = f\"{x z y}\" + f\"{1 + 1}\"\n" +" File \"\", line 1\n" +" (x z y)\n" +" ^^^\n" +"SyntaxError: f-string: invalid syntax. Perhaps you forgot a comma?" +msgstr "" + #: whatsnew/3.12.rst:318 msgid "" "but the error message doesn't include the exact location of the error within " @@ -405,6 +445,15 @@ msgid "" "can be more precise and show the entire line:" msgstr "" +#: whatsnew/3.12.rst:322 +msgid "" +">>> my_string = f\"{x z y}\" + f\"{1 + 1}\"\n" +" File \"\", line 1\n" +" my_string = f\"{x z y}\" + f\"{1 + 1}\"\n" +" ^^^\n" +"SyntaxError: invalid syntax. Perhaps you forgot a comma?" +msgstr "" + #: whatsnew/3.12.rst:330 msgid "" "(Contributed by Pablo Galindo, Batuhan Taskaya, Lysandros Nikolaou, Cristián " @@ -431,10 +480,24 @@ msgid "" "interpreter with its own GIL:" msgstr "" +#: whatsnew/3.12.rst:348 +msgid "" +"PyInterpreterConfig config = {\n" +" .check_multi_interp_extensions = 1,\n" +" .gil = PyInterpreterConfig_OWN_GIL,\n" +"};\n" +"PyThreadState *tstate = NULL;\n" +"PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);\n" +"if (PyStatus_Exception(status)) {\n" +" return -1;\n" +"}\n" +"/* The new interpreter is now active in the current thread. */" +msgstr "" + #: whatsnew/3.12.rst:361 msgid "" "For further examples how to use the C-API for sub-interpreters with a per-" -"interpreter GIL, see :source:`Modules/_xxsubinterpretersmodule.c`." +"interpreter GIL, see ``Modules/_xxsubinterpretersmodule.c``." msgstr "" #: whatsnew/3.12.rst:364 @@ -593,6 +656,17 @@ msgid "" "typed dictionaries::" msgstr "" +#: whatsnew/3.12.rst:497 +msgid "" +"from typing import TypedDict, Unpack\n" +"\n" +"class Movie(TypedDict):\n" +" name: str\n" +" year: int\n" +"\n" +"def foo(**kwargs: Unpack[Movie]): ..." +msgstr "" + #: whatsnew/3.12.rst:505 msgid "See :pep:`692` for more details." msgstr "" @@ -618,6 +692,25 @@ msgstr "" msgid "Example::" msgstr "" +#: whatsnew/3.12.rst:522 +msgid "" +"from typing import override\n" +"\n" +"class Base:\n" +" def get_color(self) -> str:\n" +" return \"blue\"\n" +"\n" +"class GoodChild(Base):\n" +" @override # ok: overrides Base.get_color\n" +" def get_color(self) -> str:\n" +" return \"yellow\"\n" +"\n" +"class BadChild(Base):\n" +" @override # type checker error: does not override Base.get_color\n" +" def get_colour(self) -> str:\n" +" return \"red\"" +msgstr "" + #: whatsnew/3.12.rst:538 msgid "See :pep:`698` for more details." msgstr "" @@ -795,15 +888,15 @@ msgstr "" #: whatsnew/3.12.rst:655 msgid "" -"On Linux, :mod:`asyncio` uses :class:`asyncio.PidfdChildWatcher` by default " -"if :func:`os.pidfd_open` is available and functional instead of :class:" -"`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya in :gh:`98024`.)" +"On Linux, :mod:`asyncio` uses :class:`!asyncio.PidfdChildWatcher` by default " +"if :func:`os.pidfd_open` is available and functional instead of :class:`!" +"asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya in :gh:`98024`.)" msgstr "" #: whatsnew/3.12.rst:660 msgid "" "The event loop now uses the best available child watcher for each platform (:" -"class:`asyncio.PidfdChildWatcher` if supported and :class:`asyncio." +"class:`!asyncio.PidfdChildWatcher` if supported and :class:`!asyncio." "ThreadedChildWatcher` otherwise), so manually configuring a child watcher is " "not recommended. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" @@ -851,8 +944,8 @@ msgstr "" #: whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings by :class:`csv." -"writer` objects." +"provide finer grained control of ``None`` and empty strings by :class:`~csv." +"reader` and :class:`~csv.writer` objects." msgstr "" #: whatsnew/3.12.rst:696 @@ -908,7 +1001,7 @@ msgstr "" msgid "" "Add :func:`inspect.markcoroutinefunction` to mark sync functions that return " "a :term:`coroutine` for use with :func:`inspect.iscoroutinefunction`. " -"(Contributed Carlton Gibson in :gh:`99247`.)" +"(Contributed by Carlton Gibson in :gh:`99247`.)" msgstr "" #: whatsnew/3.12.rst:731 @@ -922,64 +1015,63 @@ msgstr "" msgid "" "The performance of :func:`inspect.getattr_static` has been considerably " "improved. Most calls to the function should be at least 2x faster than they " -"were in Python 3.11, and some may be 6x faster or more. (Contributed by Alex " -"Waygood in :gh:`103193`.)" +"were in Python 3.11. (Contributed by Alex Waygood in :gh:`103193`.)" msgstr "" -#: whatsnew/3.12.rst:741 +#: whatsnew/3.12.rst:740 msgid "itertools" msgstr "" -#: whatsnew/3.12.rst:743 +#: whatsnew/3.12.rst:742 msgid "" -"Add :class:`itertools.batched()` for collecting into even-sized tuples where " +"Add :func:`itertools.batched` for collecting into even-sized tuples where " "the last batch may be shorter than the rest. (Contributed by Raymond " "Hettinger in :gh:`98363`.)" msgstr "" -#: whatsnew/3.12.rst:748 +#: whatsnew/3.12.rst:747 msgid "math" msgstr "" -#: whatsnew/3.12.rst:750 +#: whatsnew/3.12.rst:749 msgid "" "Add :func:`math.sumprod` for computing a sum of products. (Contributed by " "Raymond Hettinger in :gh:`100485`.)" msgstr "" -#: whatsnew/3.12.rst:753 +#: whatsnew/3.12.rst:752 msgid "" "Extend :func:`math.nextafter` to include a *steps* argument for moving up or " -"down multiple steps at a time. (By Matthias Goergens, Mark Dickinson, and " -"Raymond Hettinger in :gh:`94906`.)" +"down multiple steps at a time. (Contributed by Matthias Goergens, Mark " +"Dickinson, and Raymond Hettinger in :gh:`94906`.)" msgstr "" -#: whatsnew/3.12.rst:758 +#: whatsnew/3.12.rst:757 msgid "os" msgstr "" -#: whatsnew/3.12.rst:760 +#: whatsnew/3.12.rst:759 msgid "" "Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process with :" "func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :" "gh:`93312`.)" msgstr "" -#: whatsnew/3.12.rst:764 +#: whatsnew/3.12.rst:763 msgid "" ":class:`os.DirEntry` now includes an :meth:`os.DirEntry.is_junction` method " "to check if the entry is a junction. (Contributed by Charles Machalow in :gh:" "`99547`.)" msgstr "" -#: whatsnew/3.12.rst:768 +#: whatsnew/3.12.rst:767 msgid "" "Add :func:`os.listdrives`, :func:`os.listvolumes` and :func:`os.listmounts` " "functions on Windows for enumerating drives, volumes and mount points. " "(Contributed by Steve Dower in :gh:`102519`.)" msgstr "" -#: whatsnew/3.12.rst:772 +#: whatsnew/3.12.rst:771 msgid "" ":func:`os.stat` and :func:`os.lstat` are now more accurate on Windows. The " "``st_birthtime`` field will now be filled with the creation time of the " @@ -992,27 +1084,27 @@ msgid "" "`99726`.)" msgstr "" -#: whatsnew/3.12.rst:783 +#: whatsnew/3.12.rst:782 msgid "os.path" msgstr "" -#: whatsnew/3.12.rst:785 +#: whatsnew/3.12.rst:784 msgid "" "Add :func:`os.path.isjunction` to check if a given path is a junction. " "(Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" -#: whatsnew/3.12.rst:788 +#: whatsnew/3.12.rst:787 msgid "" "Add :func:`os.path.splitroot` to split a path into a triad ``(drive, root, " "tail)``. (Contributed by Barney Gale in :gh:`101000`.)" msgstr "" -#: whatsnew/3.12.rst:792 +#: whatsnew/3.12.rst:791 msgid "pathlib" msgstr "" -#: whatsnew/3.12.rst:794 +#: whatsnew/3.12.rst:793 msgid "" "Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." "Path`, plus their Posix- and Windows-specific variants. Subclasses may " @@ -1020,14 +1112,14 @@ msgid "" "information between path instances." msgstr "" -#: whatsnew/3.12.rst:799 +#: whatsnew/3.12.rst:798 msgid "" "Add :meth:`pathlib.Path.walk` for walking the directory trees and generating " "all file or directory names within them, similar to :func:`os.walk`. " "(Contributed by Stanislav Zmiev in :gh:`90385`.)" msgstr "" -#: whatsnew/3.12.rst:803 +#: whatsnew/3.12.rst:802 msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " @@ -1035,13 +1127,13 @@ msgid "" "gh:`84538`.)" msgstr "" -#: whatsnew/3.12.rst:808 +#: whatsnew/3.12.rst:807 msgid "" "Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." "isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" -#: whatsnew/3.12.rst:811 +#: whatsnew/3.12.rst:810 msgid "" "Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" "`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " @@ -1049,38 +1141,50 @@ msgid "" "process." msgstr "" -#: whatsnew/3.12.rst:816 +#: whatsnew/3.12.rst:815 +msgid "platform" +msgstr "" + +#: whatsnew/3.12.rst:817 +msgid "" +"Add support for detecting Windows 11 and Windows Server releases past 2012. " +"Previously, lookups on Windows Server platforms newer than Windows Server " +"2012 and on Windows 11 would return ``Windows-10``. (Contributed by Steve " +"Dower in :gh:`89545`.)" +msgstr "" + +#: whatsnew/3.12.rst:823 msgid "pdb" msgstr "" -#: whatsnew/3.12.rst:818 +#: whatsnew/3.12.rst:825 msgid "" "Add convenience variables to hold values temporarily for debug session and " "provide quick access to values like the current frame or the return value. " "(Contributed by Tian Gao in :gh:`103693`.)" msgstr "" -#: whatsnew/3.12.rst:824 +#: whatsnew/3.12.rst:831 msgid "random" msgstr "" -#: whatsnew/3.12.rst:826 +#: whatsnew/3.12.rst:833 msgid "" "Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" "`81620`.)" msgstr "" -#: whatsnew/3.12.rst:829 +#: whatsnew/3.12.rst:836 msgid "" "Add a default of ``lambd=1.0`` to :func:`random.expovariate`. (Contributed " "by Raymond Hettinger in :gh:`100234`.)" msgstr "" -#: whatsnew/3.12.rst:833 +#: whatsnew/3.12.rst:840 msgid "shutil" msgstr "" -#: whatsnew/3.12.rst:835 +#: whatsnew/3.12.rst:842 msgid "" ":func:`shutil.make_archive` now passes the *root_dir* argument to custom " "archivers which support it. In this case it no longer temporarily changes " @@ -1088,7 +1192,7 @@ msgid "" "archiving. (Contributed by Serhiy Storchaka in :gh:`74696`.)" msgstr "" -#: whatsnew/3.12.rst:841 +#: whatsnew/3.12.rst:848 msgid "" ":func:`shutil.rmtree` now accepts a new argument *onexc* which is an error " "handler like *onerror* but which expects an exception instance rather than a " @@ -1096,14 +1200,14 @@ msgid "" "Katriel in :gh:`102828`.)" msgstr "" -#: whatsnew/3.12.rst:846 +#: whatsnew/3.12.rst:853 msgid "" ":func:`shutil.which` now consults the *PATHEXT* environment variable to find " "matches within *PATH* on Windows even when the given *cmd* includes a " "directory component. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: whatsnew/3.12.rst:851 +#: whatsnew/3.12.rst:858 msgid "" ":func:`shutil.which` will call ``NeedCurrentDirectoryForExePathW`` when " "querying for executables on Windows to determine if the current working " @@ -1111,24 +1215,24 @@ msgid "" "Machalow in :gh:`103179`.)" msgstr "" -#: whatsnew/3.12.rst:856 +#: whatsnew/3.12.rst:863 msgid "" ":func:`shutil.which` will return a path matching the *cmd* with a component " "from ``PATHEXT`` prior to a direct match elsewhere in the search path on " "Windows. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: whatsnew/3.12.rst:1669 +#: whatsnew/3.12.rst:1560 msgid "sqlite3" msgstr "" -#: whatsnew/3.12.rst:864 +#: whatsnew/3.12.rst:871 msgid "" "Add a :ref:`command-line interface `. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" msgstr "" -#: whatsnew/3.12.rst:867 +#: whatsnew/3.12.rst:874 msgid "" "Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." "Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " @@ -1136,43 +1240,43 @@ msgid "" "control-autocommit>`. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" -#: whatsnew/3.12.rst:874 +#: whatsnew/3.12.rst:881 msgid "" "Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." "load_extension`, for overriding the SQLite extension entry point. " "(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" -#: whatsnew/3.12.rst:879 +#: whatsnew/3.12.rst:886 msgid "" "Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." "setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " "database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" -#: whatsnew/3.12.rst:885 +#: whatsnew/3.12.rst:892 msgid "statistics" msgstr "" -#: whatsnew/3.12.rst:887 +#: whatsnew/3.12.rst:894 msgid "" "Extend :func:`statistics.correlation` to include as a ``ranked`` method for " "computing the Spearman correlation of ranked data. (Contributed by Raymond " "Hettinger in :gh:`95861`.)" msgstr "" -#: whatsnew/3.12.rst:892 +#: whatsnew/3.12.rst:899 msgid "sys" msgstr "" -#: whatsnew/3.12.rst:894 +#: whatsnew/3.12.rst:901 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " "` monitoring API. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" -#: whatsnew/3.12.rst:898 +#: whatsnew/3.12.rst:905 msgid "" "Add :func:`sys.activate_stack_trampoline` and :func:`sys." "deactivate_stack_trampoline` for activating and deactivating stack profiler " @@ -1182,7 +1286,7 @@ msgid "" "Shannon in :gh:`96123`.)" msgstr "" -#: whatsnew/3.12.rst:907 +#: whatsnew/3.12.rst:914 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " @@ -1191,14 +1295,14 @@ msgid "" "Katriel in :gh:`102778`.)" msgstr "" -#: whatsnew/3.12.rst:1865 +#: whatsnew/3.12.rst:1755 msgid "" ":func:`sys._current_exceptions` now returns a mapping from thread-id to an " "exception instance, rather than to a ``(typ, exc, tb)`` tuple. (Contributed " "by Irit Katriel in :gh:`103176`.)" msgstr "" -#: whatsnew/3.12.rst:917 +#: whatsnew/3.12.rst:924 msgid "" ":func:`sys.setrecursionlimit` and :func:`sys.getrecursionlimit`. The " "recursion limit now applies only to Python code. Builtin functions do not " @@ -1206,27 +1310,27 @@ msgid "" "prevents recursion from causing a virtual machine crash." msgstr "" -#: whatsnew/3.12.rst:923 +#: whatsnew/3.12.rst:930 msgid "tempfile" msgstr "" -#: whatsnew/3.12.rst:925 +#: whatsnew/3.12.rst:932 msgid "" "The :class:`tempfile.NamedTemporaryFile` function has a new optional " "parameter *delete_on_close* (Contributed by Evgeny Zorin in :gh:`58451`.)" msgstr "" -#: whatsnew/3.12.rst:927 +#: whatsnew/3.12.rst:934 msgid "" ":func:`tempfile.mkdtemp` now always returns an absolute path, even if the " "argument provided to the *dir* parameter is a relative path." msgstr "" -#: whatsnew/3.12.rst:933 +#: whatsnew/3.12.rst:938 msgid "threading" msgstr "" -#: whatsnew/3.12.rst:935 +#: whatsnew/3.12.rst:940 msgid "" "Add :func:`threading.settrace_all_threads` and :func:`threading." "setprofile_all_threads` that allow to set tracing and profiling functions in " @@ -1234,11 +1338,11 @@ msgid "" "Galindo in :gh:`93503`.)" msgstr "" -#: whatsnew/3.12.rst:941 +#: whatsnew/3.12.rst:946 msgid "tkinter" msgstr "" -#: whatsnew/3.12.rst:943 +#: whatsnew/3.12.rst:948 msgid "" "``tkinter.Canvas.coords()`` now flattens its arguments. It now accepts not " "only coordinates as separate arguments (``x1, y1, x2, y2, ...``) and a " @@ -1248,11 +1352,11 @@ msgid "" "in :gh:`94473`.)" msgstr "" -#: whatsnew/3.12.rst:952 +#: whatsnew/3.12.rst:957 msgid "tokenize" msgstr "" -#: whatsnew/3.12.rst:954 +#: whatsnew/3.12.rst:959 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " "(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" @@ -1260,22 +1364,22 @@ msgid "" "to the :mod:`tokenize` module." msgstr "" -#: whatsnew/3.12.rst:960 +#: whatsnew/3.12.rst:965 msgid "types" msgstr "" -#: whatsnew/3.12.rst:962 +#: whatsnew/3.12.rst:967 msgid "" "Add :func:`types.get_original_bases` to allow for further introspection of :" "ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" "Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" -#: whatsnew/3.12.rst:967 +#: whatsnew/3.12.rst:974 msgid "typing" msgstr "" -#: whatsnew/3.12.rst:969 +#: whatsnew/3.12.rst:976 msgid "" ":func:`isinstance` checks against :func:`runtime-checkable protocols ` now use :func:`inspect.getattr_static` rather than :func:" @@ -1288,7 +1392,7 @@ msgid "" "affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" -#: whatsnew/3.12.rst:980 +#: whatsnew/3.12.rst:987 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -1296,88 +1400,126 @@ msgid "" "on :func:`isinstance` checks comparing objects to the protocol. For example::" msgstr "" -#: whatsnew/3.12.rst:1002 +#: whatsnew/3.12.rst:992 +msgid "" +">>> from typing import Protocol, runtime_checkable\n" +">>> @runtime_checkable\n" +"... class HasX(Protocol):\n" +"... x = 1\n" +"...\n" +">>> class Foo: ...\n" +"...\n" +">>> f = Foo()\n" +">>> isinstance(f, HasX)\n" +"False\n" +">>> f.x = 1\n" +">>> isinstance(f, HasX)\n" +"True\n" +">>> HasX.y = 2\n" +">>> isinstance(f, HasX) # unchanged, even though HasX now also has a \"y\" " +"attribute\n" +"True" +msgstr "" + +#: whatsnew/3.12.rst:1009 msgid "" "This change was made in order to speed up ``isinstance()`` checks against " "runtime-checkable protocols." msgstr "" -#: whatsnew/3.12.rst:1005 +#: whatsnew/3.12.rst:1012 msgid "" "The performance profile of :func:`isinstance` checks against :func:`runtime-" "checkable protocols ` has changed significantly. " "Most ``isinstance()`` checks against protocols with only a few members " "should be at least 2x faster than in 3.11, and some may be 20x faster or " -"more. However, ``isinstance()`` checks against protocols with fourteen or " -"more members may be slower than in Python 3.11. (Contributed by Alex Waygood " -"in :gh:`74690` and :gh:`103193`.)" +"more. However, ``isinstance()`` checks against protocols with many members " +"may be slower than in Python 3.11. (Contributed by Alex Waygood in :gh:" +"`74690` and :gh:`103193`.)" msgstr "" -#: whatsnew/3.12.rst:1013 +#: whatsnew/3.12.rst:1020 msgid "" "All :data:`typing.TypedDict` and :data:`typing.NamedTuple` classes now have " "the ``__orig_bases__`` attribute. (Contributed by Adrian Garcia Badaracco " "in :gh:`103699`.)" msgstr "" -#: whatsnew/3.12.rst:1017 +#: whatsnew/3.12.rst:1024 msgid "" "Add ``frozen_default`` parameter to :func:`typing.dataclass_transform`. " "(Contributed by Erik De Bonte in :gh:`99957`.)" msgstr "" -#: whatsnew/3.12.rst:1021 +#: whatsnew/3.12.rst:1028 msgid "unicodedata" msgstr "" -#: whatsnew/3.12.rst:1023 +#: whatsnew/3.12.rst:1030 msgid "" "The Unicode database has been updated to version 15.0.0. (Contributed by " "Benjamin Peterson in :gh:`96734`)." msgstr "" -#: whatsnew/3.12.rst:1710 +#: whatsnew/3.12.rst:1600 msgid "unittest" msgstr "" -#: whatsnew/3.12.rst:1029 +#: whatsnew/3.12.rst:1036 msgid "" "Add a ``--durations`` command line option, showing the N slowest test cases::" msgstr "" -#: whatsnew/3.12.rst:1045 +#: whatsnew/3.12.rst:1038 +msgid "" +"python3 -m unittest --durations=3 lib.tests.test_threading\n" +".....\n" +"Slowest test durations\n" +"----------------------------------------------------------------------\n" +"1.210s test_timeout (Lib.test.test_threading.BarrierTests)\n" +"1.003s test_default_timeout (Lib.test.test_threading.BarrierTests)\n" +"0.518s test_timeout (Lib.test.test_threading.EventTests)\n" +"\n" +"(0.000 durations hidden. Use -v to show these durations.)\n" +"----------------------------------------------------------------------\n" +"Ran 158 tests in 9.869s\n" +"\n" +"OK (skipped=3)" +msgstr "" + +#: whatsnew/3.12.rst:1052 msgid "(Contributed by Giampaolo Rodola in :gh:`48330`)" msgstr "" -#: whatsnew/3.12.rst:1048 +#: whatsnew/3.12.rst:1055 msgid "uuid" msgstr "" -#: whatsnew/3.12.rst:1050 +#: whatsnew/3.12.rst:1057 msgid "" "Add a :ref:`command-line interface `. (Contributed by Adam Chhina " "in :gh:`88597`.)" msgstr "" -#: whatsnew/3.12.rst:1055 +#: whatsnew/3.12.rst:1062 msgid "Optimizations" msgstr "" -#: whatsnew/3.12.rst:1057 +#: whatsnew/3.12.rst:1064 msgid "" "Remove ``wstr`` and ``wstr_length`` members from Unicode objects. It reduces " "object size by 8 or 16 bytes on 64bit platform. (:pep:`623`) (Contributed by " "Inada Naoki in :gh:`92536`.)" msgstr "" -#: whatsnew/3.12.rst:1061 +#: whatsnew/3.12.rst:1068 msgid "" "Add experimental support for using the BOLT binary optimizer in the build " "process, which improves performance by 1-5%. (Contributed by Kevin " "Modzelewski in :gh:`90536` and tuned by Donghee Na in :gh:`101525`)" msgstr "" -#: whatsnew/3.12.rst:1065 +#: whatsnew/3.12.rst:1072 msgid "" "Speed up the regular expression substitution (functions :func:`re.sub` and :" "func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " @@ -1385,13 +1527,13 @@ msgid "" "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" -#: whatsnew/3.12.rst:1070 +#: whatsnew/3.12.rst:1077 msgid "" "Speed up :class:`asyncio.Task` creation by deferring expensive string " "formatting. (Contributed by Itamar Oren in :gh:`103793`.)" msgstr "" -#: whatsnew/3.12.rst:1073 +#: whatsnew/3.12.rst:1080 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " "are up to 64% faster as a side effect of the changes required to cover :pep:" @@ -1399,18 +1541,18 @@ msgid "" "Pablo Galindo in :gh:`102856`.)" msgstr "" -#: whatsnew/3.12.rst:1078 +#: whatsnew/3.12.rst:1085 msgid "" "Speed up :func:`super` method calls and attribute loads via the new :opcode:" "`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " "Matveev in :gh:`103497`.)" msgstr "" -#: whatsnew/3.12.rst:1084 +#: whatsnew/3.12.rst:1091 msgid "CPython bytecode changes" msgstr "" -#: whatsnew/3.12.rst:1086 +#: whatsnew/3.12.rst:1093 msgid "" "Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" "opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" @@ -1418,62 +1560,62 @@ msgid "" "by Ken Jin in :gh:`93429`.)" msgstr "" -#: whatsnew/3.12.rst:1091 +#: whatsnew/3.12.rst:1098 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" "JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" "`102859`.)" msgstr "" -#: whatsnew/3.12.rst:1094 +#: whatsnew/3.12.rst:1101 msgid "" "Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" "gh:`92925`.)" msgstr "" -#: whatsnew/3.12.rst:1097 +#: whatsnew/3.12.rst:1104 msgid "" "Add the :opcode:`BINARY_SLICE` and :opcode:`STORE_SLICE` instructions. " "(Contributed by Mark Shannon in :gh:`94163`.)" msgstr "" -#: whatsnew/3.12.rst:1100 +#: whatsnew/3.12.rst:1107 msgid "" "Add the :opcode:`CALL_INTRINSIC_1` instructions. (Contributed by Mark " "Shannon in :gh:`99005`.)" msgstr "" -#: whatsnew/3.12.rst:1103 +#: whatsnew/3.12.rst:1110 msgid "" "Add the :opcode:`CALL_INTRINSIC_2` instruction. (Contributed by Irit Katriel " "in :gh:`101799`.)" msgstr "" -#: whatsnew/3.12.rst:1106 +#: whatsnew/3.12.rst:1113 msgid "" "Add the :opcode:`CLEANUP_THROW` instruction. (Contributed by Brandt Bucher " "in :gh:`90997`.)" msgstr "" -#: whatsnew/3.12.rst:1109 +#: whatsnew/3.12.rst:1116 msgid "" "Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" -#: whatsnew/3.12.rst:1112 +#: whatsnew/3.12.rst:1119 msgid "" "Add the :opcode:`LOAD_FAST_AND_CLEAR` instruction as part of the " "implementation of :pep:`709`. (Contributed by Carl Meyer in :gh:`101441`.)" msgstr "" -#: whatsnew/3.12.rst:1115 +#: whatsnew/3.12.rst:1122 msgid "" "Add the :opcode:`LOAD_FAST_CHECK` instruction. (Contributed by Dennis " "Sweeney in :gh:`93143`.)" msgstr "" -#: whatsnew/3.12.rst:1118 +#: whatsnew/3.12.rst:1125 msgid "" "Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" "`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " @@ -1482,48 +1624,48 @@ msgid "" "`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" -#: whatsnew/3.12.rst:1124 +#: whatsnew/3.12.rst:1131 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -#: whatsnew/3.12.rst:1127 +#: whatsnew/3.12.rst:1134 msgid "" -"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" -"gh:`101632`.)" +"Add the ``RETURN_CONST`` instruction. (Contributed by Wenyang Wang in :gh:" +"`101632`.)" msgstr "" -#: whatsnew/3.12.rst:1130 +#: whatsnew/3.12.rst:1137 msgid "Demos and Tools" msgstr "" -#: whatsnew/3.12.rst:1132 +#: whatsnew/3.12.rst:1139 msgid "" "Remove the ``Tools/demo/`` directory which contained old demo scripts. A " "copy can be found in the `old-demos project `_. (Contributed by Victor Stinner in :gh:`97681`.)" msgstr "" -#: whatsnew/3.12.rst:1137 +#: whatsnew/3.12.rst:1144 msgid "" "Remove outdated example scripts of the ``Tools/scripts/`` directory. A copy " "can be found in the `old-demos project `_. (Contributed by Victor Stinner in :gh:`97669`.)" msgstr "" -#: whatsnew/3.12.rst:2268 +#: whatsnew/3.12.rst:2158 msgid "Deprecated" msgstr "" -#: whatsnew/3.12.rst:1146 +#: whatsnew/3.12.rst:1153 deprecations/pending-removal-in-3.14.rst:4 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " "(Contributed by Nikita Sobolev in :gh:`92248`.)" msgstr "" -#: whatsnew/3.12.rst:1151 +#: whatsnew/3.12.rst:1158 msgid "" ":mod:`ast`: The following :mod:`ast` features have been deprecated in " "documentation since Python 3.8, now cause a :exc:`DeprecationWarning` to be " @@ -1531,53 +1673,54 @@ msgid "" "Python 3.14:" msgstr "" -#: whatsnew/3.12.rst:1401 +#: whatsnew/3.12.rst:1162 deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr "" -#: whatsnew/3.12.rst:1402 +#: whatsnew/3.12.rst:1163 deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr "" -#: whatsnew/3.12.rst:1403 +#: whatsnew/3.12.rst:1164 deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr "" -#: whatsnew/3.12.rst:1404 +#: whatsnew/3.12.rst:1165 deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr "" -#: whatsnew/3.12.rst:1405 +#: whatsnew/3.12.rst:1166 deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr "" -#: whatsnew/3.12.rst:1161 +#: whatsnew/3.12.rst:1168 deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" -#: whatsnew/3.12.rst:1407 +#: whatsnew/3.12.rst:1171 deprecations/pending-removal-in-3.14.rst:22 +#: deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr "" -#: whatsnew/3.12.rst:1166 +#: whatsnew/3.12.rst:1173 deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" -"`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" -"`asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" +"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` and :class:" +"`!asyncio.SafeChildWatcher` are deprecated and will be removed in Python " "3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -#: whatsnew/3.12.rst:1172 +#: whatsnew/3.12.rst:1179 deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " -"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +":func:`!asyncio.set_child_watcher`, :func:`!asyncio.get_child_watcher`, :" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" +"asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " +"be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -#: whatsnew/3.12.rst:1178 +#: whatsnew/3.12.rst:1185 deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -1585,22 +1728,47 @@ msgid "" "Rossum in :gh:`100160`.)" msgstr "" -#: whatsnew/3.12.rst:1183 +#: whatsnew/3.12.rst:1190 deprecations/pending-removal-in-future.rst:44 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." "FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" -#: whatsnew/3.12.rst:1187 +#: whatsnew/3.12.rst:1194 +msgid ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`." +msgstr "" + +#: whatsnew/3.12.rst:1196 deprecations/pending-removal-in-3.17.rst:8 +#: deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" + +#: whatsnew/3.12.rst:1202 deprecations/pending-removal-in-3.17.rst:14 +#: deprecations/pending-removal-in-3.17.rst:42 msgid "" -":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " -"Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." -"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." msgstr "" -#: whatsnew/3.12.rst:1192 +#: whatsnew/3.12.rst:1210 deprecations/pending-removal-in-3.17.rst:22 +#: deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" + +#: whatsnew/3.12.rst:1213 msgid "" ":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." "utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " @@ -1610,47 +1778,47 @@ msgid "" "set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" -#: whatsnew/3.12.rst:1200 +#: whatsnew/3.12.rst:1221 msgid "" ":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" -#: whatsnew/3.12.rst:1203 +#: whatsnew/3.12.rst:1224 msgid "" ":mod:`importlib.abc`: Deprecated the following classes, scheduled for " "removal in Python 3.14:" msgstr "" -#: whatsnew/3.12.rst:1424 +#: whatsnew/3.12.rst:1227 deprecations/pending-removal-in-3.14.rst:46 msgid ":class:`!importlib.abc.ResourceReader`" msgstr "" -#: whatsnew/3.12.rst:1425 +#: whatsnew/3.12.rst:1228 deprecations/pending-removal-in-3.14.rst:47 msgid ":class:`!importlib.abc.Traversable`" msgstr "" -#: whatsnew/3.12.rst:1426 +#: whatsnew/3.12.rst:1229 deprecations/pending-removal-in-3.14.rst:48 msgid ":class:`!importlib.abc.TraversableResources`" msgstr "" -#: whatsnew/3.12.rst:1210 +#: whatsnew/3.12.rst:1231 deprecations/pending-removal-in-3.14.rst:50 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "" -#: whatsnew/3.12.rst:1212 +#: whatsnew/3.12.rst:1233 deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`importlib.resources.abc.Traversable`" msgstr "" -#: whatsnew/3.12.rst:1213 +#: whatsnew/3.12.rst:1234 deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr "" -#: whatsnew/3.12.rst:1215 +#: whatsnew/3.12.rst:1236 deprecations/pending-removal-in-3.14.rst:55 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "" -#: whatsnew/3.12.rst:1217 +#: whatsnew/3.12.rst:1238 msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " @@ -1659,7 +1827,7 @@ msgid "" "`101588`.)" msgstr "" -#: whatsnew/3.12.rst:1223 +#: whatsnew/3.12.rst:1244 msgid "" ":mod:`multiprocessing`: In Python 3.14, the default :mod:`multiprocessing` " "start method will change to a safer one on Linux, BSDs, and other non-macOS " @@ -1671,14 +1839,14 @@ msgid "" "methods `." msgstr "" -#: whatsnew/3.12.rst:1233 +#: whatsnew/3.12.rst:1254 msgid "" -":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " +":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " "are deprecated and will be removed in Python 3.14; use :func:`importlib.util." "find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" -#: whatsnew/3.12.rst:1238 +#: whatsnew/3.12.rst:1259 msgid "" ":mod:`pty`: The module has two undocumented ``master_open()`` and " "``slave_open()`` functions that have been deprecated since Python 2 but only " @@ -1686,11 +1854,11 @@ msgid "" "(Contributed by Soumendra Ganguly and Gregory P. Smith in :gh:`85984`.)" msgstr "" -#: whatsnew/3.12.rst:1243 +#: whatsnew/3.12.rst:1264 msgid ":mod:`os`:" msgstr "" -#: whatsnew/3.12.rst:1245 +#: whatsnew/3.12.rst:1266 msgid "" "The ``st_ctime`` fields return by :func:`os.stat` and :func:`os.lstat` on " "Windows are deprecated. In a future release, they will contain the last " @@ -1699,45 +1867,46 @@ msgid "" "``st_birthtime`` field. (Contributed by Steve Dower in :gh:`99726`.)" msgstr "" -#: whatsnew/3.12.rst:1251 +#: whatsnew/3.12.rst:1272 msgid "" "On POSIX platforms, :func:`os.fork` can now raise a :exc:" "`DeprecationWarning` when it can detect being called from a multithreaded " "process. There has always been a fundamental incompatibility with the POSIX " "platform when doing so. Even if such code *appeared* to work. We added the " -"warning to to raise awareness as issues encounted by code doing this are " +"warning to raise awareness as issues encountered by code doing this are " "becoming more frequent. See the :func:`os.fork` documentation for more " "details along with `this discussion on fork being incompatible with threads " -"`_ for *why* we're now surfacing this " -"longstanding platform compatibility problem to developers." +"`_ for *why* we're now surfacing this longstanding " +"platform compatibility problem to developers." msgstr "" -#: whatsnew/3.12.rst:1261 +#: whatsnew/3.12.rst:1282 msgid "" "When this warning appears due to usage of :mod:`multiprocessing` or :mod:" "`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " "start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" -#: whatsnew/3.12.rst:1265 +#: whatsnew/3.12.rst:1286 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " "deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" "`102828`.)" msgstr "" -#: whatsnew/3.12.rst:1268 +#: whatsnew/3.12.rst:1289 deprecations/pending-removal-in-3.14.rst:85 msgid ":mod:`sqlite3`:" msgstr "" -#: whatsnew/3.12.rst:1270 +#: whatsnew/3.12.rst:1291 msgid "" ":ref:`default adapters and converters ` are now " "deprecated. Instead, use the :ref:`sqlite3-adapter-converter-recipes` and " "tailor them to your needs. (Contributed by Erlend E. Aasland in :gh:`90016`.)" msgstr "" -#: whatsnew/3.12.rst:1276 +#: whatsnew/3.12.rst:1297 msgid "" "In :meth:`~sqlite3.Cursor.execute`, :exc:`DeprecationWarning` is now emitted " "when :ref:`named placeholders ` are used together with " @@ -1747,39 +1916,40 @@ msgid "" "Erlend E. Aasland in :gh:`101698`.)" msgstr "" -#: whatsnew/3.12.rst:1283 +#: whatsnew/3.12.rst:1304 msgid "" ":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." "last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " "(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" -#: whatsnew/3.12.rst:1287 +#: whatsnew/3.12.rst:1308 msgid "" ":mod:`tarfile`: Extracting tar archives without specifying *filter* is " "deprecated until Python 3.14, when ``'data'`` filter will become the " "default. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: whatsnew/3.12.rst:1291 +#: whatsnew/3.12.rst:1312 deprecations/pending-removal-in-3.15.rst:80 +#: deprecations/pending-removal-in-3.17.rst:26 msgid ":mod:`typing`:" msgstr "" -#: whatsnew/3.12.rst:1293 +#: whatsnew/3.12.rst:1314 msgid "" ":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" "`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " "are deprecated. (:gh:`94309`.)" msgstr "" -#: whatsnew/3.12.rst:1297 +#: whatsnew/3.12.rst:1318 msgid "" ":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" "`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " "Waygood in :gh:`91896`.)" msgstr "" -#: whatsnew/3.12.rst:1301 +#: whatsnew/3.12.rst:1322 msgid "" ":mod:`xml.etree.ElementTree`: The module now emits :exc:`DeprecationWarning` " "when testing the truth value of an :class:`xml.etree.ElementTree.Element`. " @@ -1787,7 +1957,7 @@ msgid "" "implementation emitted nothing. (Contributed by Jacob Walls in :gh:`83122`.)" msgstr "" -#: whatsnew/3.12.rst:1307 +#: whatsnew/3.12.rst:1328 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " "`, :meth:`generator throw() ` and :meth:" @@ -1796,689 +1966,1330 @@ msgid "" "instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" -#: whatsnew/3.12.rst:1313 +#: whatsnew/3.12.rst:1334 msgid "" -":exc:`DeprecationWarning` is now raised when ``__package__`` on a module " -"differs from ``__spec__.parent`` (previously it was :exc:`ImportWarning`). " -"(Contributed by Brett Cannon in :gh:`65961`.)" +":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " +"a module differs from :attr:`__spec__.parent ` (previously it was :exc:`ImportWarning`). (Contributed by Brett " +"Cannon in :gh:`65961`.)" msgstr "" -#: whatsnew/3.12.rst:1318 +#: whatsnew/3.12.rst:1340 msgid "" -"Setting ``__package__`` or ``__cached__`` on a module is deprecated, and " -"will cease to be set or taken into consideration by the import system in " -"Python 3.14. (Contributed by Brett Cannon in :gh:`65961`.)" +"Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " +"module is deprecated, and will cease to be set or taken into consideration " +"by the import system in Python 3.14. (Contributed by Brett Cannon in :gh:" +"`65961`.)" msgstr "" -#: whatsnew/3.12.rst:1322 +#: whatsnew/3.12.rst:1344 msgid "" "The bitwise inversion operator (``~``) on bool is deprecated. It will throw " -"an error in Python 3.14. Use ``not`` for logical negation of bools instead. " +"an error in Python 3.16. Use ``not`` for logical negation of bools instead. " "In the rare case that you really need the bitwise inversion of the " "underlying ``int``, convert to int explicitly: ``~int(x)``. (Contributed by " "Tim Hoffmann in :gh:`103487`.)" msgstr "" -#: whatsnew/3.12.rst:1328 +#: whatsnew/3.12.rst:1350 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " "Python 3.10 via :pep:`626`, but it only got a proper :exc:" -"`DeprecationWarning` in 3.12, therefore it will be removed in 3.14. " -"(Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" - -#: whatsnew/3.12.rst:1335 -msgid "Pending Removal in Python 3.13" +"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " +"Sobolev in :gh:`101866`.)" msgstr "" -#: whatsnew/3.12.rst:1337 -msgid "" -"The following modules and APIs have been deprecated in earlier Python " -"releases, and will be removed in Python 3.13." +#: deprecations/pending-removal-in-3.13.rst:2 +msgid "Pending removal in Python 3.13" msgstr "" -#: whatsnew/3.12.rst:1340 +#: deprecations/pending-removal-in-3.13.rst:4 msgid "Modules (see :pep:`594`):" msgstr "" -#: whatsnew/3.12.rst:1342 -msgid ":mod:`aifc`" +#: deprecations/pending-removal-in-3.13.rst:6 +msgid ":mod:`!aifc`" msgstr "" -#: whatsnew/3.12.rst:1343 -msgid ":mod:`audioop`" +#: deprecations/pending-removal-in-3.13.rst:7 +msgid ":mod:`!audioop`" msgstr "" -#: whatsnew/3.12.rst:1344 -msgid ":mod:`cgi`" +#: deprecations/pending-removal-in-3.13.rst:8 +msgid ":mod:`!cgi`" msgstr "" -#: whatsnew/3.12.rst:1345 -msgid ":mod:`cgitb`" +#: deprecations/pending-removal-in-3.13.rst:9 +msgid ":mod:`!cgitb`" msgstr "" -#: whatsnew/3.12.rst:1346 -msgid ":mod:`chunk`" +#: deprecations/pending-removal-in-3.13.rst:10 +msgid ":mod:`!chunk`" msgstr "" -#: whatsnew/3.12.rst:1347 -msgid ":mod:`crypt`" +#: deprecations/pending-removal-in-3.13.rst:11 +msgid ":mod:`!crypt`" msgstr "" -#: whatsnew/3.12.rst:1348 -msgid ":mod:`imghdr`" +#: deprecations/pending-removal-in-3.13.rst:12 +msgid ":mod:`!imghdr`" msgstr "" -#: whatsnew/3.12.rst:1349 -msgid ":mod:`mailcap`" +#: deprecations/pending-removal-in-3.13.rst:13 +msgid ":mod:`!mailcap`" msgstr "" -#: whatsnew/3.12.rst:1350 -msgid ":mod:`msilib`" +#: deprecations/pending-removal-in-3.13.rst:14 +msgid ":mod:`!msilib`" msgstr "" -#: whatsnew/3.12.rst:1351 -msgid ":mod:`nis`" +#: deprecations/pending-removal-in-3.13.rst:15 +msgid ":mod:`!nis`" msgstr "" -#: whatsnew/3.12.rst:1352 -msgid ":mod:`nntplib`" +#: deprecations/pending-removal-in-3.13.rst:16 +msgid ":mod:`!nntplib`" msgstr "" -#: whatsnew/3.12.rst:1353 -msgid ":mod:`ossaudiodev`" +#: deprecations/pending-removal-in-3.13.rst:17 +msgid ":mod:`!ossaudiodev`" msgstr "" -#: whatsnew/3.12.rst:1354 -msgid ":mod:`pipes`" +#: deprecations/pending-removal-in-3.13.rst:18 +msgid ":mod:`!pipes`" msgstr "" -#: whatsnew/3.12.rst:1355 -msgid ":mod:`sndhdr`" +#: deprecations/pending-removal-in-3.13.rst:19 +msgid ":mod:`!sndhdr`" msgstr "" -#: whatsnew/3.12.rst:1356 -msgid ":mod:`spwd`" +#: deprecations/pending-removal-in-3.13.rst:20 +msgid ":mod:`!spwd`" msgstr "" -#: whatsnew/3.12.rst:1357 -msgid ":mod:`sunau`" +#: deprecations/pending-removal-in-3.13.rst:21 +msgid ":mod:`!sunau`" msgstr "" -#: whatsnew/3.12.rst:1358 -msgid ":mod:`telnetlib`" +#: deprecations/pending-removal-in-3.13.rst:22 +msgid ":mod:`!telnetlib`" msgstr "" -#: whatsnew/3.12.rst:1359 -msgid ":mod:`uu`" +#: deprecations/pending-removal-in-3.13.rst:23 +msgid ":mod:`!uu`" msgstr "" -#: whatsnew/3.12.rst:1360 -msgid ":mod:`xdrlib`" +#: deprecations/pending-removal-in-3.13.rst:24 +msgid ":mod:`!xdrlib`" msgstr "" -#: whatsnew/3.12.rst:1362 +#: deprecations/pending-removal-in-3.13.rst:26 msgid "Other modules:" msgstr "" -#: whatsnew/3.12.rst:1364 +#: deprecations/pending-removal-in-3.13.rst:28 msgid ":mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)" msgstr "" -#: whatsnew/3.12.rst:1456 +#: deprecations/pending-removal-in-3.13.rst:30 msgid "APIs:" msgstr "" -#: whatsnew/3.12.rst:1368 +#: deprecations/pending-removal-in-3.13.rst:32 msgid ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" msgstr "" -#: whatsnew/3.12.rst:1369 +#: deprecations/pending-removal-in-3.13.rst:33 msgid "``locale.resetlocale()`` (:gh:`90817`)" msgstr "" -#: whatsnew/3.12.rst:1370 +#: deprecations/pending-removal-in-3.13.rst:34 msgid ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" msgstr "" -#: whatsnew/3.12.rst:1371 +#: deprecations/pending-removal-in-3.13.rst:35 msgid ":func:`!unittest.findTestCases` (:gh:`50096`)" msgstr "" -#: whatsnew/3.12.rst:1372 +#: deprecations/pending-removal-in-3.13.rst:36 msgid ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" msgstr "" -#: whatsnew/3.12.rst:1373 +#: deprecations/pending-removal-in-3.13.rst:37 msgid ":func:`!unittest.makeSuite` (:gh:`50096`)" msgstr "" -#: whatsnew/3.12.rst:1374 +#: deprecations/pending-removal-in-3.13.rst:38 msgid ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" msgstr "" -#: whatsnew/3.12.rst:1375 +#: deprecations/pending-removal-in-3.13.rst:39 msgid ":class:`!webbrowser.MacOSX` (:gh:`86421`)" msgstr "" -#: whatsnew/3.12.rst:1376 +#: deprecations/pending-removal-in-3.13.rst:40 msgid ":class:`classmethod` descriptor chaining (:gh:`89519`)" msgstr "" -#: whatsnew/3.12.rst:1377 -msgid ":mod:`importlib.resources` deprecated methods:" -msgstr "" - -#: whatsnew/3.12.rst:1379 -msgid "``contents()``" +#: deprecations/c-api-pending-removal-in-3.14.rst:2 +#: deprecations/pending-removal-in-3.14.rst:2 +msgid "Pending removal in Python 3.14" msgstr "" -#: whatsnew/3.12.rst:1380 -msgid "``is_resource()``" +#: deprecations/pending-removal-in-3.14.rst:9 +msgid "" +":mod:`ast`: The following features have been deprecated in documentation " +"since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " +"runtime when they are accessed or used, and will be removed in Python 3.14:" msgstr "" -#: whatsnew/3.12.rst:1381 -msgid "``open_binary()``" +#: deprecations/pending-removal-in-3.14.rst:41 +msgid "" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" -#: whatsnew/3.12.rst:1382 -msgid "``open_text()``" +#: deprecations/pending-removal-in-3.14.rst:44 +msgid ":mod:`importlib.abc` deprecated classes:" msgstr "" -#: whatsnew/3.12.rst:1383 -msgid "``path()``" +#: deprecations/pending-removal-in-3.14.rst:57 +msgid "" +":mod:`itertools` had undocumented, inefficient, historically buggy, and " +"inconsistent support for copy, deepcopy, and pickle operations. This will be " +"removed in 3.14 for a significant reduction in code volume and maintenance " +"burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" msgstr "" -#: whatsnew/3.12.rst:1384 -msgid "``read_binary()``" +#: deprecations/pending-removal-in-3.14.rst:63 +msgid "" +":mod:`multiprocessing`: The default start method will change to a safer one " +"on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " +"currently the default (:gh:`84559`). Adding a runtime warning about this was " +"deemed too disruptive as the majority of code is not expected to care. Use " +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" -#: whatsnew/3.12.rst:1385 -msgid "``read_text()``" +#: deprecations/pending-removal-in-3.14.rst:71 +msgid "" +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -#: whatsnew/3.12.rst:1387 +#: deprecations/pending-removal-in-3.14.rst:75 msgid "" -"Use :func:`importlib.resources.files()` instead. Refer to `importlib-" -"resources: Migrating from Legacy `_ (:gh:`106531`)" +":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " +"now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " +"instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" -#: whatsnew/3.12.rst:2355 -msgid "Pending Removal in Python 3.14" +#: deprecations/pending-removal-in-3.14.rst:80 +msgid ":mod:`pty`:" msgstr "" -#: whatsnew/3.12.rst:1393 -msgid "" -"The following APIs have been deprecated and will be removed in Python 3.14." +#: deprecations/pending-removal-in-3.14.rst:82 +msgid "``master_open()``: use :func:`pty.openpty`." msgstr "" -#: whatsnew/3.12.rst:1396 -msgid "" -":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" -"argparse.BooleanOptionalAction`" +#: deprecations/pending-removal-in-3.14.rst:83 +msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "" -#: whatsnew/3.12.rst:1399 -msgid ":mod:`ast`:" +#: deprecations/pending-removal-in-3.14.rst:87 +msgid ":data:`!version` and :data:`!version_info`." msgstr "" -#: whatsnew/3.12.rst:1409 -msgid ":class:`!asyncio.MultiLoopChildWatcher`" +#: deprecations/pending-removal-in-3.14.rst:89 +msgid "" +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders ` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" -#: whatsnew/3.12.rst:1410 -msgid ":class:`!asyncio.FastChildWatcher`" +#: deprecations/pending-removal-in-3.14.rst:93 +msgid "" +":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" -#: whatsnew/3.12.rst:1411 -msgid ":class:`!asyncio.AbstractChildWatcher`" +#: deprecations/c-api-pending-removal-in-3.15.rst:2 +#: deprecations/pending-removal-in-3.15.rst:2 +msgid "Pending removal in Python 3.15" msgstr "" -#: whatsnew/3.12.rst:1412 -msgid ":class:`!asyncio.SafeChildWatcher`" +#: deprecations/pending-removal-in-3.15.rst:4 +#: deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" msgstr "" -#: whatsnew/3.12.rst:1413 -msgid ":func:`!asyncio.set_child_watcher`" +#: deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" -#: whatsnew/3.12.rst:1414 -msgid ":func:`!asyncio.get_child_watcher`," +#: deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" -#: whatsnew/3.12.rst:1415 -msgid ":meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher`" +#: deprecations/pending-removal-in-3.15.rst:16 +msgid ":mod:`ctypes`:" msgstr "" -#: whatsnew/3.12.rst:1416 -msgid ":meth:`!asyncio.AbstractEventLoopPolicy.get_child_watcher`" +#: deprecations/pending-removal-in-3.15.rst:18 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" -#: whatsnew/3.12.rst:1418 -msgid ":mod:`collections.abc`: :class:`!collections.abc.ByteString`." +#: deprecations/pending-removal-in-3.15.rst:21 +msgid ":mod:`http.server`:" msgstr "" -#: whatsnew/3.12.rst:1420 -msgid ":mod:`email`: the *isdst* parameter in :func:`email.utils.localtime`." +#: deprecations/pending-removal-in-3.15.rst:23 +msgid "" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -#: whatsnew/3.12.rst:1422 -msgid ":mod:`importlib.abc`:" +#: deprecations/pending-removal-in-3.15.rst:29 +msgid "" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" -#: whatsnew/3.12.rst:1428 -msgid ":mod:`itertools`: Support for copy, deepcopy, and pickle operations." +#: deprecations/pending-removal-in-3.15.rst:32 +#: deprecations/pending-removal-in-future.rst:63 +msgid ":mod:`importlib`:" msgstr "" -#: whatsnew/3.12.rst:1430 -msgid ":mod:`pkgutil`:" +#: deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." msgstr "" -#: whatsnew/3.12.rst:1432 -msgid ":func:`!pkgutil.find_loader`" +#: deprecations/pending-removal-in-3.15.rst:36 +msgid ":class:`locale`:" msgstr "" -#: whatsnew/3.12.rst:1433 -msgid ":func:`!pkgutil.get_loader`." +#: deprecations/pending-removal-in-3.15.rst:38 +msgid "" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" -#: whatsnew/3.12.rst:1435 -msgid ":mod:`pty`:" +#: deprecations/pending-removal-in-3.15.rst:46 +msgid ":mod:`pathlib`:" msgstr "" -#: whatsnew/3.12.rst:1437 -msgid ":func:`!pty.master_open`" +#: deprecations/pending-removal-in-3.15.rst:48 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -#: whatsnew/3.12.rst:1438 -msgid ":func:`!pty.slave_open`" +#: deprecations/pending-removal-in-3.15.rst:52 +msgid ":mod:`platform`:" msgstr "" -#: whatsnew/3.12.rst:1440 -msgid ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree`" +#: deprecations/pending-removal-in-3.15.rst:54 +msgid "" +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" -#: whatsnew/3.12.rst:1442 -msgid ":mod:`typing`: :class:`!typing.ByteString`" +#: deprecations/pending-removal-in-3.15.rst:58 +#: deprecations/pending-removal-in-3.16.rst:96 +msgid ":mod:`sysconfig`:" msgstr "" -#: whatsnew/3.12.rst:1444 +#: deprecations/pending-removal-in-3.15.rst:60 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`xml." -"etree.ElementTree.Element`." +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." msgstr "" -#: whatsnew/3.12.rst:1446 -msgid "The ``__package__`` and ``__cached__`` attributes on module objects." +#: deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`threading`:" msgstr "" -#: whatsnew/3.12.rst:1448 -msgid "The :attr:`~codeobject.co_lnotab` attribute of code objects." +#: deprecations/pending-removal-in-3.15.rst:65 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." msgstr "" -#: whatsnew/3.12.rst:2392 -msgid "Pending Removal in Python 3.15" +#: deprecations/pending-removal-in-3.15.rst:71 +msgid ":mod:`types`:" msgstr "" -#: whatsnew/3.12.rst:1453 +#: deprecations/pending-removal-in-3.15.rst:73 msgid "" -"The following APIs have been deprecated and will be removed in Python 3.15." +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" -#: whatsnew/3.12.rst:1458 -msgid ":func:`locale.getdefaultlocale` (:gh:`90817`)" +#: deprecations/pending-removal-in-3.15.rst:82 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." msgstr "" -#: whatsnew/3.12.rst:2410 -msgid "Pending Removal in Future Versions" +#: deprecations/pending-removal-in-3.15.rst:88 +msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." msgstr "" -#: whatsnew/3.12.rst:1464 +#: deprecations/pending-removal-in-3.15.rst:95 msgid "" -"The following APIs were deprecated in earlier Python versions and will be " -"removed, although there is currently no date scheduled for their removal." +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." msgstr "" -#: whatsnew/3.12.rst:1467 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#: deprecations/pending-removal-in-3.15.rst:100 +msgid ":mod:`wave`:" msgstr "" -#: whatsnew/3.12.rst:1469 -msgid ":class:`typing.Text` (:gh:`92332`)" +#: deprecations/pending-removal-in-3.15.rst:102 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -#: whatsnew/3.12.rst:1471 -msgid "" -"Currently Python accepts numeric literals immediately followed by keywords, " -"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " -"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " -"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised if " -"the numeric literal is immediately followed by one of keywords :keyword:" -"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" -"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " -"syntax error. (:gh:`87999`)" +#: deprecations/pending-removal-in-3.15.rst:107 +msgid ":mod:`zipimport`:" msgstr "" -#: whatsnew/3.12.rst:2442 -msgid "Removed" +#: deprecations/pending-removal-in-3.15.rst:109 +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" msgstr "" -#: whatsnew/3.12.rst:1485 -msgid "asynchat and asyncore" +#: deprecations/c-api-pending-removal-in-3.16.rst:2 +#: deprecations/pending-removal-in-3.16.rst:2 +msgid "Pending removal in Python 3.16" msgstr "" -#: whatsnew/3.12.rst:1487 +#: deprecations/pending-removal-in-3.16.rst:6 msgid "" -"These two modules have been removed according to the schedule in :pep:`594`, " -"having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " -"(Contributed by Nikita Sobolev in :gh:`96580`.)" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" -#: whatsnew/3.12.rst:1494 -msgid "configparser" +#: deprecations/pending-removal-in-3.16.rst:11 +msgid ":mod:`array`:" msgstr "" -#: whatsnew/3.12.rst:1496 +#: deprecations/pending-removal-in-3.16.rst:13 msgid "" -"Several names deprecated in the :mod:`configparser` way back in 3.2 have " -"been removed per :gh:`89336`:" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." msgstr "" -#: whatsnew/3.12.rst:1499 +#: deprecations/pending-removal-in-3.16.rst:21 msgid "" -":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " -"argument. Use the ``source`` attribute and argument instead." +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" -#: whatsnew/3.12.rst:1501 +#: deprecations/pending-removal-in-3.16.rst:26 msgid "" -":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " -"shorter :class:`~configparser.ConfigParser` name instead." +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" msgstr "" -#: whatsnew/3.12.rst:1503 -msgid "" -":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" -"meth:`~configparser.ConfigParser.read_file` instead." +#: deprecations/pending-removal-in-3.16.rst:29 +msgid ":class:`asyncio.AbstractEventLoopPolicy`" msgstr "" -#: whatsnew/3.12.rst:1507 -msgid "distutils" +#: deprecations/pending-removal-in-3.16.rst:30 +msgid ":class:`asyncio.DefaultEventLoopPolicy`" msgstr "" -#: whatsnew/3.12.rst:1509 -msgid "" -"Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " -"by :pep:`632` \"Deprecate distutils module\". For projects still using " -"``distutils`` and cannot be updated to something else, the ``setuptools`` " -"project can be installed: it still provides ``distutils``. (Contributed by " -"Victor Stinner in :gh:`92584`.)" +#: deprecations/pending-removal-in-3.16.rst:31 +msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" msgstr "" -#: whatsnew/3.12.rst:1516 -msgid "ensurepip" +#: deprecations/pending-removal-in-3.16.rst:32 +msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" msgstr "" -#: whatsnew/3.12.rst:1518 -msgid "" -"Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " -"installing setuptools in environments created by :mod:`venv`." +#: deprecations/pending-removal-in-3.16.rst:33 +msgid ":func:`asyncio.get_event_loop_policy`" msgstr "" -#: whatsnew/3.12.rst:1521 -msgid "" -"``pip (>= 22.1)`` does not require setuptools to be installed in the " -"environment. ``setuptools``-based (and ``distutils``-based) packages can " -"still be used with ``pip install``, since pip will provide ``setuptools`` in " -"the build environment it uses for building a package." +#: deprecations/pending-removal-in-3.16.rst:34 +msgid ":func:`asyncio.set_event_loop_policy`" msgstr "" -#: whatsnew/3.12.rst:1527 +#: deprecations/pending-removal-in-3.16.rst:36 msgid "" -"``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " -"longer provided by default in environments created with ``venv`` or " -"bootstrapped with ``ensurepip``, since they are part of the ``setuptools`` " -"package. For projects relying on these at runtime, the ``setuptools`` " -"project should be declared as a dependency and installed separately " -"(typically, using pip)." +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." msgstr "" -#: whatsnew/3.12.rst:1534 -msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" +#: deprecations/pending-removal-in-3.16.rst:39 +msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" msgstr "" -#: whatsnew/3.12.rst:1537 -msgid "enum" +#: deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" msgstr "" -#: whatsnew/3.12.rst:1539 -msgid "" -"Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " -"enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" +#: deprecations/pending-removal-in-3.16.rst:48 +msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" msgstr "" -#: whatsnew/3.12.rst:1544 -msgid "ftplib" +#: deprecations/pending-removal-in-3.16.rst:50 +#: deprecations/pending-removal-in-future.rst:16 +msgid ":mod:`builtins`:" msgstr "" -#: whatsnew/3.12.rst:1546 +#: deprecations/pending-removal-in-3.16.rst:52 msgid "" -"Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " -"*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." msgstr "" -#: whatsnew/3.12.rst:1551 -msgid "gzip" +#: deprecations/pending-removal-in-3.16.rst:59 +msgid ":mod:`functools`:" msgstr "" -#: whatsnew/3.12.rst:1553 +#: deprecations/pending-removal-in-3.16.rst:61 msgid "" -"Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " -"deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " -"instead. In write mode, the ``filename`` attribute added ``'.gz'`` file " -"extension if it was not present. (Contributed by Victor Stinner in :gh:" -"`94196`.)" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." msgstr "" -#: whatsnew/3.12.rst:1560 -msgid "hashlib" +#: deprecations/pending-removal-in-3.16.rst:64 +msgid ":mod:`logging`:" msgstr "" -#: whatsnew/3.12.rst:1562 +#: deprecations/pending-removal-in-3.16.rst:66 msgid "" -"Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." -"pbkdf2_hmac()`, deprecated in Python 3.10. Python 3.10 and newer requires " -"OpenSSL 1.1.1 (:pep:`644`): this OpenSSL version provides a C implementation " -"of :func:`~hashlib.pbkdf2_hmac()` which is faster. (Contributed by Victor " -"Stinner in :gh:`94199`.)" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" msgstr "" -#: whatsnew/3.12.rst:1596 -msgid "importlib" +#: deprecations/pending-removal-in-3.16.rst:70 +msgid ":mod:`mimetypes`:" msgstr "" -#: whatsnew/3.12.rst:1571 +#: deprecations/pending-removal-in-3.16.rst:72 msgid "" -"Many previously deprecated cleanups in :mod:`importlib` have now been " -"completed:" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" msgstr "" -#: whatsnew/3.12.rst:1574 -msgid "" -"References to, and support for :meth:`!module_repr()` has been removed. " -"(Contributed by Barry Warsaw in :gh:`97850`.)" +#: deprecations/pending-removal-in-3.16.rst:78 +msgid ":mod:`shutil`:" msgstr "" -#: whatsnew/3.12.rst:1577 +#: deprecations/pending-removal-in-3.16.rst:80 msgid "" -"``importlib.util.set_package``, ``importlib.util.set_loader`` and " -"``importlib.util.module_for_loader`` have all been removed. (Contributed by " -"Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." msgstr "" -#: whatsnew/3.12.rst:1581 -msgid "" -"Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " -"(Contributed by Barry Warsaw in :gh:`98040`.)" +#: deprecations/pending-removal-in-3.16.rst:85 +msgid ":mod:`symtable`:" msgstr "" -#: whatsnew/3.12.rst:1584 +#: deprecations/pending-removal-in-3.16.rst:87 msgid "" -"``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " -"have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." msgstr "" -#: whatsnew/3.12.rst:1596 -msgid "imp" +#: deprecations/pending-removal-in-3.16.rst:90 +msgid ":mod:`sys`:" msgstr "" -#: whatsnew/3.12.rst:1590 +#: deprecations/pending-removal-in-3.16.rst:92 msgid "" -"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" -"gh:`98040`.)" -msgstr "" - -#: whatsnew/3.12.rst:1593 -msgid "To migrate, consult the following correspondence table:" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." msgstr "" -#: whatsnew/3.12.rst:1598 -msgid "``imp.NullImporter``" +#: deprecations/pending-removal-in-3.16.rst:98 +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." msgstr "" -#: whatsnew/3.12.rst:1598 -msgid "Insert ``None`` into ``sys.path_importer_cache``" +#: deprecations/pending-removal-in-3.16.rst:102 +msgid ":mod:`tarfile`:" msgstr "" -#: whatsnew/3.12.rst:1599 -msgid "``imp.cache_from_source()``" +#: deprecations/pending-removal-in-3.16.rst:104 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." msgstr "" -#: whatsnew/3.12.rst:1599 -msgid ":func:`importlib.util.cache_from_source`" +#: deprecations/pending-removal-in-3.17.rst:2 +msgid "Pending removal in Python 3.17" msgstr "" -#: whatsnew/3.12.rst:1600 -msgid "``imp.find_module()``" +#: deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" msgstr "" -#: whatsnew/3.12.rst:1600 -msgid ":func:`importlib.util.find_spec`" +#: deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." msgstr "" -#: whatsnew/3.12.rst:1601 -msgid "``imp.get_magic()``" +#: deprecations/pending-removal-in-3.17.rst:28 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." msgstr "" -#: whatsnew/3.12.rst:1601 -msgid ":attr:`importlib.util.MAGIC_NUMBER`" +#: deprecations/pending-removal-in-3.17.rst:33 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17." msgstr "" -#: whatsnew/3.12.rst:1602 -msgid "``imp.get_suffixes()``" +#: deprecations/c-api-pending-removal-in-future.rst:2 +#: deprecations/pending-removal-in-future.rst:2 +msgid "Pending removal in future versions" msgstr "" -#: whatsnew/3.12.rst:1602 +#: deprecations/pending-removal-in-future.rst:4 msgid "" -":attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery." -"EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." msgstr "" -#: whatsnew/3.12.rst:1603 -msgid "``imp.get_tag()``" +#: deprecations/pending-removal-in-future.rst:7 +msgid ":mod:`argparse`:" msgstr "" -#: whatsnew/3.12.rst:1603 -msgid ":attr:`sys.implementation.cache_tag `" +#: deprecations/pending-removal-in-future.rst:9 +msgid "" +"Nesting argument groups and nesting mutually exclusive groups are deprecated." msgstr "" -#: whatsnew/3.12.rst:1604 -msgid "``imp.load_module()``" +#: deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." msgstr "" -#: whatsnew/3.12.rst:1604 -msgid ":func:`importlib.import_module`" +#: deprecations/pending-removal-in-future.rst:14 +msgid "The :class:`argparse.FileType` type converter is deprecated." msgstr "" -#: whatsnew/3.12.rst:1605 -msgid "``imp.new_module(name)``" +#: deprecations/pending-removal-in-future.rst:18 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." msgstr "" -#: whatsnew/3.12.rst:1605 -msgid "``types.ModuleType(name)``" -msgstr "" +#: deprecations/pending-removal-in-future.rst:21 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:35 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:38 +msgid "Delegation of ``int()`` to ``__trunc__()`` method." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:39 +msgid "" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:49 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:51 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:54 +msgid ":mod:`datetime`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:56 +msgid "" +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:58 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:61 +msgid ":mod:`gettext`: Plural value must be an integer." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:65 +msgid "" +":func:`~importlib.util.cache_from_source` *debug_override* parameter is " +"deprecated: use the *optimization* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:68 +msgid ":mod:`importlib.metadata`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:70 +msgid "``EntryPoints`` tuple interface." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:71 +msgid "Implicit ``None`` on return values." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:73 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:76 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:79 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:81 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:84 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:91 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:93 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:96 +msgid ":mod:`ssl` options and protocols:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:98 +msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:99 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:102 +msgid "``ssl.OP_NO_SSL*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:103 +msgid "``ssl.OP_NO_TLS*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:104 +msgid "``ssl.PROTOCOL_SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:105 +msgid "``ssl.PROTOCOL_TLS``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:106 +msgid "``ssl.PROTOCOL_TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:107 +msgid "``ssl.PROTOCOL_TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:108 +msgid "``ssl.PROTOCOL_TLSv1_2``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:109 +msgid "``ssl.TLSVersion.SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:110 +msgid "``ssl.TLSVersion.TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:111 +msgid "``ssl.TLSVersion.TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:113 +msgid ":mod:`threading` methods:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:115 +msgid "" +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:116 +msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:117 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:119 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:121 +msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:122 +msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:124 +msgid ":class:`typing.Text` (:gh:`92332`)." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:126 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:131 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:134 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:136 +msgid "``splitattr()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:137 +msgid "``splithost()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:138 +msgid "``splitnport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:139 +msgid "``splitpasswd()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:140 +msgid "``splitport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:141 +msgid "``splitquery()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:142 +msgid "``splittag()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:143 +msgid "``splittype()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:144 +msgid "``splituser()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:145 +msgid "``splitvalue()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:146 +msgid "``to_bytes()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:148 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:151 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:156 +msgid "" +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." +msgstr "" + +#: whatsnew/3.12.rst:2255 +msgid "Removed" +msgstr "" + +#: whatsnew/3.12.rst:1374 +msgid "asynchat and asyncore" +msgstr "" + +#: whatsnew/3.12.rst:1376 +msgid "" +"These two modules have been removed according to the schedule in :pep:`594`, " +"having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " +"(Contributed by Nikita Sobolev in :gh:`96580`.)" +msgstr "" + +#: whatsnew/3.12.rst:1383 +msgid "configparser" +msgstr "" + +#: whatsnew/3.12.rst:1385 +msgid "" +"Several names deprecated in the :mod:`configparser` way back in 3.2 have " +"been removed per :gh:`89336`:" +msgstr "" + +#: whatsnew/3.12.rst:1388 +msgid "" +":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " +"argument. Use the ``source`` attribute and argument instead." +msgstr "" + +#: whatsnew/3.12.rst:1390 +msgid "" +":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " +"shorter :class:`~configparser.ConfigParser` name instead." +msgstr "" + +#: whatsnew/3.12.rst:1392 +msgid "" +":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" +"meth:`~configparser.ConfigParser.read_file` instead." +msgstr "" + +#: whatsnew/3.12.rst:1398 +msgid "distutils" +msgstr "" + +#: whatsnew/3.12.rst:1400 +msgid "" +"Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " +"by :pep:`632` \"Deprecate distutils module\". For projects still using " +"``distutils`` and cannot be updated to something else, the ``setuptools`` " +"project can be installed: it still provides ``distutils``. (Contributed by " +"Victor Stinner in :gh:`92584`.)" +msgstr "" + +#: whatsnew/3.12.rst:1407 +msgid "ensurepip" +msgstr "" + +#: whatsnew/3.12.rst:1409 +msgid "" +"Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " +"installing setuptools in environments created by :mod:`venv`." +msgstr "" + +#: whatsnew/3.12.rst:1412 +msgid "" +"``pip (>= 22.1)`` does not require setuptools to be installed in the " +"environment. ``setuptools``-based (and ``distutils``-based) packages can " +"still be used with ``pip install``, since pip will provide ``setuptools`` in " +"the build environment it uses for building a package." +msgstr "" + +#: whatsnew/3.12.rst:1418 +msgid "" +"``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " +"longer provided by default in environments created with ``venv`` or " +"bootstrapped with ``ensurepip``, since they are part of the ``setuptools`` " +"package. For projects relying on these at runtime, the ``setuptools`` " +"project should be declared as a dependency and installed separately " +"(typically, using pip)." +msgstr "" + +#: whatsnew/3.12.rst:1425 +msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" +msgstr "" + +#: whatsnew/3.12.rst:1428 +msgid "enum" +msgstr "" + +#: whatsnew/3.12.rst:1430 +msgid "" +"Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " +"enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" +msgstr "" + +#: whatsnew/3.12.rst:1435 +msgid "ftplib" +msgstr "" + +#: whatsnew/3.12.rst:1437 +msgid "" +"Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " +"*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" +msgstr "" + +#: whatsnew/3.12.rst:1442 +msgid "gzip" +msgstr "" + +#: whatsnew/3.12.rst:1444 +msgid "" +"Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " +"deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " +"instead. In write mode, the ``filename`` attribute added ``'.gz'`` file " +"extension if it was not present. (Contributed by Victor Stinner in :gh:" +"`94196`.)" +msgstr "" + +#: whatsnew/3.12.rst:1451 +msgid "hashlib" +msgstr "" + +#: whatsnew/3.12.rst:1453 +msgid "" +"Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." +"pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " +"OpenSSL 1.1.1 (:pep:`644`): this OpenSSL version provides a C implementation " +"of :func:`~hashlib.pbkdf2_hmac` which is faster. (Contributed by Victor " +"Stinner in :gh:`94199`.)" +msgstr "" + +#: whatsnew/3.12.rst:1489 +msgid "importlib" +msgstr "" + +#: whatsnew/3.12.rst:1462 +msgid "" +"Many previously deprecated cleanups in :mod:`importlib` have now been " +"completed:" +msgstr "" + +#: whatsnew/3.12.rst:1465 +msgid "" +"References to, and support for :meth:`!module_repr` has been removed. " +"(Contributed by Barry Warsaw in :gh:`97850`.)" +msgstr "" + +#: whatsnew/3.12.rst:1468 +msgid "" +"``importlib.util.set_package``, ``importlib.util.set_loader`` and " +"``importlib.util.module_for_loader`` have all been removed. (Contributed by " +"Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" +msgstr "" + +#: whatsnew/3.12.rst:1472 +msgid "" +"Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " +"(Contributed by Barry Warsaw in :gh:`98040`.)" +msgstr "" + +#: whatsnew/3.12.rst:1475 +msgid "" +"``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " +"have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" +msgstr "" + +#: whatsnew/3.12.rst:1489 +msgid "imp" +msgstr "" + +#: whatsnew/3.12.rst:1483 +msgid "" +"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" +"gh:`98040`.)" +msgstr "" + +#: whatsnew/3.12.rst:1486 +msgid "To migrate, consult the following correspondence table:" +msgstr "" + +#: whatsnew/3.12.rst:1491 +msgid "``imp.NullImporter``" +msgstr "" + +#: whatsnew/3.12.rst:1491 +msgid "Insert ``None`` into ``sys.path_importer_cache``" +msgstr "" + +#: whatsnew/3.12.rst:1492 +msgid "``imp.cache_from_source()``" +msgstr "" + +#: whatsnew/3.12.rst:1492 +msgid ":func:`importlib.util.cache_from_source`" +msgstr "" + +#: whatsnew/3.12.rst:1493 +msgid "``imp.find_module()``" +msgstr "" + +#: whatsnew/3.12.rst:1493 +msgid ":func:`importlib.util.find_spec`" +msgstr "" + +#: whatsnew/3.12.rst:1494 +msgid "``imp.get_magic()``" +msgstr "" + +#: whatsnew/3.12.rst:1494 +msgid ":const:`importlib.util.MAGIC_NUMBER`" +msgstr "" + +#: whatsnew/3.12.rst:1495 +msgid "``imp.get_suffixes()``" +msgstr "" + +#: whatsnew/3.12.rst:1495 +msgid "" +":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery." +"EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`" +msgstr "" + +#: whatsnew/3.12.rst:1496 +msgid "``imp.get_tag()``" +msgstr "" -#: whatsnew/3.12.rst:1606 +#: whatsnew/3.12.rst:1496 +msgid ":attr:`sys.implementation.cache_tag `" +msgstr "" + +#: whatsnew/3.12.rst:1497 +msgid "``imp.load_module()``" +msgstr "" + +#: whatsnew/3.12.rst:1497 +msgid ":func:`importlib.import_module`" +msgstr "" + +#: whatsnew/3.12.rst:1498 +msgid "``imp.new_module(name)``" +msgstr "" + +#: whatsnew/3.12.rst:1498 +msgid "``types.ModuleType(name)``" +msgstr "" + +#: whatsnew/3.12.rst:1499 msgid "``imp.reload()``" msgstr "" -#: whatsnew/3.12.rst:1606 +#: whatsnew/3.12.rst:1499 msgid ":func:`importlib.reload`" msgstr "" -#: whatsnew/3.12.rst:1607 +#: whatsnew/3.12.rst:1500 msgid "``imp.source_from_cache()``" msgstr "" -#: whatsnew/3.12.rst:1607 +#: whatsnew/3.12.rst:1500 msgid ":func:`importlib.util.source_from_cache`" msgstr "" -#: whatsnew/3.12.rst:1608 +#: whatsnew/3.12.rst:1501 msgid "``imp.load_source()``" msgstr "" -#: whatsnew/3.12.rst:1608 +#: whatsnew/3.12.rst:1501 msgid "*See below*" msgstr "" -#: whatsnew/3.12.rst:1611 +#: whatsnew/3.12.rst:1504 msgid "Replace ``imp.load_source()`` with::" msgstr "" -#: whatsnew/3.12.rst:1626 +#: whatsnew/3.12.rst:1506 +msgid "" +"import importlib.util\n" +"import importlib.machinery\n" +"\n" +"def load_source(modname, filename):\n" +" loader = importlib.machinery.SourceFileLoader(modname, filename)\n" +" spec = importlib.util.spec_from_file_location(modname, filename, " +"loader=loader)\n" +" module = importlib.util.module_from_spec(spec)\n" +" # The module is always executed and not cached in sys.modules.\n" +" # Uncomment the following line to cache the module.\n" +" # sys.modules[module.__name__] = module\n" +" loader.exec_module(module)\n" +" return module" +msgstr "" + +#: whatsnew/3.12.rst:1519 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" msgstr "" -#: whatsnew/3.12.rst:1628 +#: whatsnew/3.12.rst:1521 msgid "Undocumented functions:" msgstr "" -#: whatsnew/3.12.rst:1630 +#: whatsnew/3.12.rst:1523 msgid "``imp.init_builtin()``" msgstr "" -#: whatsnew/3.12.rst:1631 +#: whatsnew/3.12.rst:1524 msgid "``imp.load_compiled()``" msgstr "" -#: whatsnew/3.12.rst:1632 +#: whatsnew/3.12.rst:1525 msgid "``imp.load_dynamic()``" msgstr "" -#: whatsnew/3.12.rst:1633 +#: whatsnew/3.12.rst:1526 msgid "``imp.load_package()``" msgstr "" -#: whatsnew/3.12.rst:1635 +#: whatsnew/3.12.rst:1528 msgid "" "``imp.lock_held()``, ``imp.acquire_lock()``, ``imp.release_lock()``: the " "locking scheme has changed in Python 3.3 to per-module locks." msgstr "" -#: whatsnew/3.12.rst:1637 +#: whatsnew/3.12.rst:1530 msgid "" "``imp.find_module()`` constants: ``SEARCH_ERROR``, ``PY_SOURCE``, " "``PY_COMPILED``, ``C_EXTENSION``, ``PY_RESOURCE``, ``PKG_DIRECTORY``, " "``C_BUILTIN``, ``PY_FROZEN``, ``PY_CODERESOURCE``, ``IMP_HOOK``." msgstr "" -#: whatsnew/3.12.rst:1642 +#: whatsnew/3.12.rst:1535 msgid "io" msgstr "" -#: whatsnew/3.12.rst:1644 +#: whatsnew/3.12.rst:1537 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " "in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." @@ -2487,50 +3298,50 @@ msgid "" "`94169`.)" msgstr "" -#: whatsnew/3.12.rst:1651 +#: whatsnew/3.12.rst:1544 msgid "locale" msgstr "" -#: whatsnew/3.12.rst:1653 +#: whatsnew/3.12.rst:1546 msgid "" "Remove :mod:`locale`'s :func:`!locale.format` function, deprecated in Python " "3.7: use :func:`locale.format_string` instead. (Contributed by Victor " "Stinner in :gh:`94226`.)" msgstr "" -#: whatsnew/3.12.rst:1658 +#: whatsnew/3.12.rst:1551 msgid "smtpd" msgstr "" -#: whatsnew/3.12.rst:1660 +#: whatsnew/3.12.rst:1553 msgid "" "The ``smtpd`` module has been removed according to the schedule in :pep:" -"`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use aiosmtpd_ PyPI " -"module or any other :mod:`asyncio`-based server instead. (Contributed by " -"Oleg Iarygin in :gh:`93243`.)" +"`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" +"`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server instead. " +"(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" -#: whatsnew/3.12.rst:1671 +#: whatsnew/3.12.rst:1562 msgid "" "The following undocumented :mod:`sqlite3` features, deprecated in Python " "3.10, are now removed:" msgstr "" -#: whatsnew/3.12.rst:1674 +#: whatsnew/3.12.rst:1565 msgid "``sqlite3.enable_shared_cache()``" msgstr "" -#: whatsnew/3.12.rst:1675 +#: whatsnew/3.12.rst:1566 msgid "``sqlite3.OptimizedUnicode``" msgstr "" -#: whatsnew/3.12.rst:1677 +#: whatsnew/3.12.rst:1568 msgid "" "If a shared cache must be used, open the database in URI mode using the " "``cache=shared`` query parameter." msgstr "" -#: whatsnew/3.12.rst:1680 +#: whatsnew/3.12.rst:1571 msgid "" "The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" "`str` since Python 3.3. Code that previously set the text factory to " @@ -2538,22 +3349,22 @@ msgid "" "default value which is also ``str``." msgstr "" -#: whatsnew/3.12.rst:1685 +#: whatsnew/3.12.rst:1576 msgid "(Contributed by Erlend E. Aasland in :gh:`92548`.)" msgstr "" -#: whatsnew/3.12.rst:1688 +#: whatsnew/3.12.rst:1579 msgid "ssl" msgstr "" -#: whatsnew/3.12.rst:1690 +#: whatsnew/3.12.rst:1581 msgid "" "Remove :mod:`ssl`'s :func:`!ssl.RAND_pseudo_bytes` function, deprecated in " "Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. " "(Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" -#: whatsnew/3.12.rst:1694 +#: whatsnew/3.12.rst:1585 msgid "" "Remove the :func:`!ssl.match_hostname` function. It was deprecated in Python " "3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer " @@ -2561,196 +3372,196 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: whatsnew/3.12.rst:1700 +#: whatsnew/3.12.rst:1591 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " "instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." "SSLContext.wrap_socket` method. Any package that still uses :func:`!ssl." "wrap_socket` is broken and insecure. The function neither sends a SNI TLS " -"extension nor validates server hostname. Code is subject to `CWE-295 " -"`_: Improper Certificate " -"Validation. (Contributed by Victor Stinner in :gh:`94199`.)" +"extension nor validates the server hostname. Code is subject to :cwe:`295` " +"(Improper Certificate Validation). (Contributed by Victor Stinner in :gh:" +"`94199`.)" msgstr "" -#: whatsnew/3.12.rst:1712 +#: whatsnew/3.12.rst:1602 msgid "Remove many long-deprecated :mod:`unittest` features:" msgstr "" -#: whatsnew/3.12.rst:1716 +#: whatsnew/3.12.rst:1606 msgid "A number of :class:`~unittest.TestCase` method aliases:" msgstr "" -#: whatsnew/3.12.rst:1719 +#: whatsnew/3.12.rst:1609 msgid "Deprecated alias" msgstr "" -#: whatsnew/3.12.rst:1719 +#: whatsnew/3.12.rst:1609 msgid "Method Name" msgstr "" -#: whatsnew/3.12.rst:1719 +#: whatsnew/3.12.rst:1609 msgid "Deprecated in" msgstr "" -#: whatsnew/3.12.rst:1721 +#: whatsnew/3.12.rst:1611 msgid "``failUnless``" msgstr "" -#: whatsnew/3.12.rst:1728 +#: whatsnew/3.12.rst:1618 msgid ":meth:`.assertTrue`" msgstr "" -#: whatsnew/3.12.rst:1722 whatsnew/3.12.rst:1724 whatsnew/3.12.rst:1726 -#: whatsnew/3.12.rst:1727 +#: whatsnew/3.12.rst:1612 whatsnew/3.12.rst:1614 whatsnew/3.12.rst:1616 +#: whatsnew/3.12.rst:1617 msgid "3.1" msgstr "" -#: whatsnew/3.12.rst:1722 +#: whatsnew/3.12.rst:1612 msgid "``failIf``" msgstr "" -#: whatsnew/3.12.rst:1722 +#: whatsnew/3.12.rst:1612 msgid ":meth:`.assertFalse`" msgstr "" -#: whatsnew/3.12.rst:1723 +#: whatsnew/3.12.rst:1613 msgid "``failUnlessEqual``" msgstr "" -#: whatsnew/3.12.rst:1729 +#: whatsnew/3.12.rst:1619 msgid ":meth:`.assertEqual`" msgstr "" -#: whatsnew/3.12.rst:1724 +#: whatsnew/3.12.rst:1614 msgid "``failIfEqual``" msgstr "" -#: whatsnew/3.12.rst:1730 +#: whatsnew/3.12.rst:1620 msgid ":meth:`.assertNotEqual`" msgstr "" -#: whatsnew/3.12.rst:1725 +#: whatsnew/3.12.rst:1615 msgid "``failUnlessAlmostEqual``" msgstr "" -#: whatsnew/3.12.rst:1731 +#: whatsnew/3.12.rst:1621 msgid ":meth:`.assertAlmostEqual`" msgstr "" -#: whatsnew/3.12.rst:1726 +#: whatsnew/3.12.rst:1616 msgid "``failIfAlmostEqual``" msgstr "" -#: whatsnew/3.12.rst:1732 +#: whatsnew/3.12.rst:1622 msgid ":meth:`.assertNotAlmostEqual`" msgstr "" -#: whatsnew/3.12.rst:1727 +#: whatsnew/3.12.rst:1617 msgid "``failUnlessRaises``" msgstr "" -#: whatsnew/3.12.rst:1727 +#: whatsnew/3.12.rst:1617 msgid ":meth:`.assertRaises`" msgstr "" -#: whatsnew/3.12.rst:1728 +#: whatsnew/3.12.rst:1618 msgid "``assert_``" msgstr "" -#: whatsnew/3.12.rst:1729 whatsnew/3.12.rst:1731 whatsnew/3.12.rst:1733 -#: whatsnew/3.12.rst:1734 +#: whatsnew/3.12.rst:1619 whatsnew/3.12.rst:1621 whatsnew/3.12.rst:1623 +#: whatsnew/3.12.rst:1624 msgid "3.2" msgstr "" -#: whatsnew/3.12.rst:1729 +#: whatsnew/3.12.rst:1619 msgid "``assertEquals``" msgstr "" -#: whatsnew/3.12.rst:1730 +#: whatsnew/3.12.rst:1620 msgid "``assertNotEquals``" msgstr "" -#: whatsnew/3.12.rst:1731 +#: whatsnew/3.12.rst:1621 msgid "``assertAlmostEquals``" msgstr "" -#: whatsnew/3.12.rst:1732 +#: whatsnew/3.12.rst:1622 msgid "``assertNotAlmostEquals``" msgstr "" -#: whatsnew/3.12.rst:1733 +#: whatsnew/3.12.rst:1623 msgid "``assertRegexpMatches``" msgstr "" -#: whatsnew/3.12.rst:1733 +#: whatsnew/3.12.rst:1623 msgid ":meth:`.assertRegex`" msgstr "" -#: whatsnew/3.12.rst:1734 +#: whatsnew/3.12.rst:1624 msgid "``assertRaisesRegexp``" msgstr "" -#: whatsnew/3.12.rst:1734 +#: whatsnew/3.12.rst:1624 msgid ":meth:`.assertRaisesRegex`" msgstr "" -#: whatsnew/3.12.rst:1735 +#: whatsnew/3.12.rst:1625 msgid "``assertNotRegexpMatches``" msgstr "" -#: whatsnew/3.12.rst:1735 +#: whatsnew/3.12.rst:1625 msgid ":meth:`.assertNotRegex`" msgstr "" -#: whatsnew/3.12.rst:1735 +#: whatsnew/3.12.rst:1625 msgid "3.5" msgstr "" -#: whatsnew/3.12.rst:1738 +#: whatsnew/3.12.rst:1628 msgid "" "You can use https://github.com/isidentical/teyit to automatically modernise " "your unit tests." msgstr "" -#: whatsnew/3.12.rst:1741 +#: whatsnew/3.12.rst:1631 msgid "" "Undocumented and broken :class:`~unittest.TestCase` method " "``assertDictContainsSubset`` (deprecated in Python 3.2)." msgstr "" -#: whatsnew/3.12.rst:1744 +#: whatsnew/3.12.rst:1634 msgid "" "Undocumented :meth:`TestLoader.loadTestsFromModule ` parameter *use_load_tests* (deprecated and ignored " -"since Python 3.2)." +"since Python 3.5)." msgstr "" -#: whatsnew/3.12.rst:1748 +#: whatsnew/3.12.rst:1638 msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." msgstr "" -#: whatsnew/3.12.rst:1751 +#: whatsnew/3.12.rst:1641 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" msgstr "" -#: whatsnew/3.12.rst:1754 +#: whatsnew/3.12.rst:1644 msgid "webbrowser" msgstr "" -#: whatsnew/3.12.rst:1756 +#: whatsnew/3.12.rst:1646 msgid "" "Remove support for obsolete browsers from :mod:`webbrowser`. The removed " "browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, " "Firebird, and Firefox versions 35 and below (:gh:`102871`)." msgstr "" -#: whatsnew/3.12.rst:1761 +#: whatsnew/3.12.rst:1651 msgid "xml.etree.ElementTree" msgstr "" -#: whatsnew/3.12.rst:1763 +#: whatsnew/3.12.rst:1653 msgid "" "Remove the ``ElementTree.Element.copy()`` method of the pure Python " "implementation, deprecated in Python 3.10, use the :func:`copy.copy` " @@ -2759,22 +3570,22 @@ msgid "" "Stinner in :gh:`94383`.)" msgstr "" -#: whatsnew/3.12.rst:1770 +#: whatsnew/3.12.rst:1660 msgid "zipimport" msgstr "" -#: whatsnew/3.12.rst:1772 +#: whatsnew/3.12.rst:1662 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " "deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" "`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" -#: whatsnew/3.12.rst:1778 +#: whatsnew/3.12.rst:1668 msgid "Others" msgstr "" -#: whatsnew/3.12.rst:1780 +#: whatsnew/3.12.rst:1670 msgid "" "Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" "file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint `, " "intended for low-level tools like debuggers and JIT compilers. This API may " @@ -3044,84 +3872,84 @@ msgid "" "contents are marked by the ``PyUnstable_`` prefix in names." msgstr "" -#: whatsnew/3.12.rst:1976 +#: whatsnew/3.12.rst:1866 msgid "Code object constructors:" msgstr "" -#: whatsnew/3.12.rst:1978 +#: whatsnew/3.12.rst:1868 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" msgstr "" -#: whatsnew/3.12.rst:1979 +#: whatsnew/3.12.rst:1869 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" msgstr "" -#: whatsnew/3.12.rst:1981 +#: whatsnew/3.12.rst:1871 msgid "Extra storage for code objects (:pep:`523`):" msgstr "" -#: whatsnew/3.12.rst:1983 +#: whatsnew/3.12.rst:1873 msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" msgstr "" -#: whatsnew/3.12.rst:1984 +#: whatsnew/3.12.rst:1874 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" msgstr "" -#: whatsnew/3.12.rst:1985 +#: whatsnew/3.12.rst:1875 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" msgstr "" -#: whatsnew/3.12.rst:1987 +#: whatsnew/3.12.rst:1877 msgid "" "The original names will continue to be available until the respective API " "changes." msgstr "" -#: whatsnew/3.12.rst:1990 +#: whatsnew/3.12.rst:1880 msgid "(Contributed by Petr Viktorin in :gh:`101101`.)" msgstr "" -#: whatsnew/3.12.rst:1992 +#: whatsnew/3.12.rst:1882 msgid "" ":pep:`697`: Add an API for extending types whose instance memory layout is " "opaque:" msgstr "" -#: whatsnew/3.12.rst:1995 +#: whatsnew/3.12.rst:1885 msgid "" ":c:member:`PyType_Spec.basicsize` can be zero or negative to specify " "inheriting or extending the base class size." msgstr "" -#: whatsnew/3.12.rst:1997 +#: whatsnew/3.12.rst:1887 msgid "" ":c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` added to " "allow access to subclass-specific instance data." msgstr "" -#: whatsnew/3.12.rst:1999 +#: whatsnew/3.12.rst:1889 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " "to allow safely extending certain variable-sized types, including :c:var:" "`PyType_Type`." msgstr "" -#: whatsnew/3.12.rst:2002 +#: whatsnew/3.12.rst:1892 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` added to allow defining :c:type:`members " "` in terms of a subclass-specific struct." msgstr "" -#: whatsnew/3.12.rst:2005 +#: whatsnew/3.12.rst:1895 msgid "(Contributed by Petr Viktorin in :gh:`103509`.)" msgstr "" -#: whatsnew/3.12.rst:2007 +#: whatsnew/3.12.rst:1897 msgid "" "Add the new :ref:`limited C API ` function :c:func:" "`PyType_FromMetaclass`, which generalizes the existing :c:func:" @@ -3129,29 +3957,29 @@ msgid "" "(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" -#: whatsnew/3.12.rst:2012 +#: whatsnew/3.12.rst:1902 msgid "" "API for creating objects that can be called using :ref:`the vectorcall " "protocol ` was added to the :ref:`Limited API `:" msgstr "" -#: whatsnew/3.12.rst:2016 +#: whatsnew/3.12.rst:1906 msgid ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" msgstr "" -#: whatsnew/3.12.rst:2017 +#: whatsnew/3.12.rst:1907 msgid ":c:func:`PyVectorcall_NARGS`" msgstr "" -#: whatsnew/3.12.rst:2018 +#: whatsnew/3.12.rst:1908 msgid ":c:func:`PyVectorcall_Call`" msgstr "" -#: whatsnew/3.12.rst:2019 +#: whatsnew/3.12.rst:1909 msgid ":c:type:`vectorcallfunc`" msgstr "" -#: whatsnew/3.12.rst:2021 +#: whatsnew/3.12.rst:1911 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. This " @@ -3162,40 +3990,40 @@ msgid "" "`93274`.)" msgstr "" -#: whatsnew/3.12.rst:2029 +#: whatsnew/3.12.rst:1919 msgid "" "The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " -"classes to support object ``__dict__`` and weakrefs with less bookkeeping, " -"using less memory and with faster access." +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" -#: whatsnew/3.12.rst:2034 +#: whatsnew/3.12.rst:1924 msgid "" "API for performing calls using :ref:`the vectorcall protocol ` " "was added to the :ref:`Limited API `:" msgstr "" -#: whatsnew/3.12.rst:2038 +#: whatsnew/3.12.rst:1928 msgid ":c:func:`PyObject_Vectorcall`" msgstr "" -#: whatsnew/3.12.rst:2039 +#: whatsnew/3.12.rst:1929 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr "" -#: whatsnew/3.12.rst:2040 +#: whatsnew/3.12.rst:1930 msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" msgstr "" -#: whatsnew/3.12.rst:2042 +#: whatsnew/3.12.rst:1932 msgid "" "This means that both the incoming and outgoing ends of the vector call " "protocol are now available in the :ref:`Limited API `. (Contributed " "by Wenzel Jakob in :gh:`98586`.)" msgstr "" -#: whatsnew/3.12.rst:2046 +#: whatsnew/3.12.rst:1936 msgid "" "Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" "func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " @@ -3203,14 +4031,14 @@ msgid "" "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" -#: whatsnew/3.12.rst:2052 +#: whatsnew/3.12.rst:1942 msgid "" "Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets " "the vectorcall field of a given :c:type:`PyFunctionObject`. (Contributed by " "Andrew Frost in :gh:`92257`.)" msgstr "" -#: whatsnew/3.12.rst:2056 +#: whatsnew/3.12.rst:1946 msgid "" "The C API now permits registering callbacks via :c:func:" "`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " @@ -3219,28 +4047,28 @@ msgid "" "`91052`.)" msgstr "" -#: whatsnew/3.12.rst:2062 +#: whatsnew/3.12.rst:1952 msgid "" "Add :c:func:`PyType_AddWatcher` and :c:func:`PyType_Watch` API to register " "callbacks to receive notification on changes to a type. (Contributed by Carl " "Meyer in :gh:`91051`.)" msgstr "" -#: whatsnew/3.12.rst:2066 +#: whatsnew/3.12.rst:1956 msgid "" "Add :c:func:`PyCode_AddWatcher` and :c:func:`PyCode_ClearWatcher` APIs to " "register callbacks to receive notification on creation and destruction of " "code objects. (Contributed by Itamar Oren in :gh:`91054`.)" msgstr "" -#: whatsnew/3.12.rst:2071 +#: whatsnew/3.12.rst:1961 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " "get a frame variable by its name. (Contributed by Victor Stinner in :gh:" "`91248`.)" msgstr "" -#: whatsnew/3.12.rst:2075 +#: whatsnew/3.12.rst:1965 msgid "" "Add :c:func:`PyErr_GetRaisedException` and :c:func:" "`PyErr_SetRaisedException` for saving and restoring the current exception. " @@ -3250,14 +4078,14 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: whatsnew/3.12.rst:2083 +#: whatsnew/3.12.rst:1973 msgid "" "Add ``_PyErr_ChainExceptions1``, which takes an exception instance, to " "replace the legacy-API ``_PyErr_ChainExceptions``, which is now deprecated. " "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: whatsnew/3.12.rst:2087 +#: whatsnew/3.12.rst:1977 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " "convenience functions for retrieving and modifying the :attr:`~BaseException." @@ -3265,71 +4093,71 @@ msgid "" "in :gh:`101578`.)" msgstr "" -#: whatsnew/3.12.rst:2092 +#: whatsnew/3.12.rst:1982 msgid "" "Add :c:func:`PyErr_DisplayException`, which takes an exception instance, to " "replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit " "Katriel in :gh:`102755`)." msgstr "" -#: whatsnew/3.12.rst:2098 +#: whatsnew/3.12.rst:1988 msgid "" ":pep:`683`: Introduce *Immortal Objects*, which allows objects to bypass " "reference counts, and related changes to the C-API:" msgstr "" -#: whatsnew/3.12.rst:2101 +#: whatsnew/3.12.rst:1991 msgid "``_Py_IMMORTAL_REFCNT``: The reference count that defines an object" msgstr "" -#: whatsnew/3.12.rst:2102 +#: whatsnew/3.12.rst:1992 msgid "as immortal." msgstr "" -#: whatsnew/3.12.rst:2103 +#: whatsnew/3.12.rst:1993 msgid "" "``_Py_IsImmortal`` Checks if an object has the immortal reference count." msgstr "" -#: whatsnew/3.12.rst:2104 +#: whatsnew/3.12.rst:1994 msgid "``PyObject_HEAD_INIT`` This will now initialize reference count to" msgstr "" -#: whatsnew/3.12.rst:2105 +#: whatsnew/3.12.rst:1995 msgid "``_Py_IMMORTAL_REFCNT`` when used with ``Py_BUILD_CORE``." msgstr "" -#: whatsnew/3.12.rst:2106 +#: whatsnew/3.12.rst:1996 msgid "``SSTATE_INTERNED_IMMORTAL`` An identifier for interned unicode objects" msgstr "" -#: whatsnew/3.12.rst:2107 +#: whatsnew/3.12.rst:1997 msgid "that are immortal." msgstr "" -#: whatsnew/3.12.rst:2108 +#: whatsnew/3.12.rst:1998 msgid "``SSTATE_INTERNED_IMMORTAL_STATIC`` An identifier for interned unicode" msgstr "" -#: whatsnew/3.12.rst:2109 +#: whatsnew/3.12.rst:1999 msgid "objects that are immortal and static" msgstr "" -#: whatsnew/3.12.rst:2112 +#: whatsnew/3.12.rst:2000 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" msgstr "" -#: whatsnew/3.12.rst:2111 +#: whatsnew/3.12.rst:2001 msgid "" "objects that have been interned. This is now needed for :file:`refleak.py` " "to correctly track reference counts and allocated blocks" msgstr "" -#: whatsnew/3.12.rst:2114 +#: whatsnew/3.12.rst:2004 msgid "(Contributed by Eddie Elizondo in :gh:`84436`.)" msgstr "" -#: whatsnew/3.12.rst:2116 +#: whatsnew/3.12.rst:2006 msgid "" ":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" "c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " @@ -3337,27 +4165,27 @@ msgid "" "(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -#: whatsnew/3.12.rst:2122 +#: whatsnew/3.12.rst:2012 msgid "" "In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" "`Py_DECREF` functions are now implemented as opaque function calls to hide " "implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" -#: whatsnew/3.12.rst:2130 +#: whatsnew/3.12.rst:2020 msgid "" "Legacy Unicode APIs based on ``Py_UNICODE*`` representation has been " "removed. Please migrate to APIs based on UTF-8 or ``wchar_t*``." msgstr "" -#: whatsnew/3.12.rst:2133 +#: whatsnew/3.12.rst:2023 msgid "" "Argument parsing functions like :c:func:`PyArg_ParseTuple` doesn't support " "``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate to " "other formats for Unicode like ``s``, ``z``, ``es``, and ``U``." msgstr "" -#: whatsnew/3.12.rst:2137 +#: whatsnew/3.12.rst:2027 msgid "" "``tp_weaklist`` for all static builtin types is always ``NULL``. This is an " "internal-only field on ``PyTypeObject`` but we're pointing out the change in " @@ -3366,7 +4194,7 @@ msgid "" "necessary, the (internal-only) ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro." msgstr "" -#: whatsnew/3.12.rst:2144 +#: whatsnew/3.12.rst:2034 msgid "" "This internal-only :c:member:`PyTypeObject.tp_subclasses` may now not be a " "valid object pointer. Its type was changed to :c:expr:`void *` to reflect " @@ -3374,13 +4202,13 @@ msgid "" "only field directly." msgstr "" -#: whatsnew/3.12.rst:2149 +#: whatsnew/3.12.rst:2039 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~class." +"To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" -#: whatsnew/3.12.rst:2153 +#: whatsnew/3.12.rst:2043 msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " @@ -3389,7 +4217,7 @@ msgid "" "`98836`.)" msgstr "" -#: whatsnew/3.12.rst:2159 +#: whatsnew/3.12.rst:2049 msgid "" "An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" "func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " @@ -3398,27 +4226,27 @@ msgid "" "Storchaka in :gh:`95781`.)" msgstr "" -#: whatsnew/3.12.rst:2165 +#: whatsnew/3.12.rst:2055 msgid "" "Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" "`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" -#: whatsnew/3.12.rst:2169 +#: whatsnew/3.12.rst:2059 msgid "" -"Extension classes wanting to add a ``__dict__`` or weak reference slot " -"should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"Extension classes wanting to add a :attr:`~object.__dict__` or weak " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " -"declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` should call :c:func:`!" +"declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " "traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" "func:`PyObject_ClearWeakRefs`, as before." msgstr "" -#: whatsnew/3.12.rst:2181 +#: whatsnew/3.12.rst:2071 msgid "" "The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like " "paths, like :class:`bytearray` and :class:`memoryview` types: only the " @@ -3426,7 +4254,7 @@ msgid "" "Victor Stinner in :gh:`98393`.)" msgstr "" -#: whatsnew/3.12.rst:2186 +#: whatsnew/3.12.rst:2076 msgid "" "The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF` " "macros now only evaluate their arguments once. If an argument has side " @@ -3434,7 +4262,7 @@ msgid "" "Stinner in :gh:`98724`.)" msgstr "" -#: whatsnew/3.12.rst:2191 +#: whatsnew/3.12.rst:2081 msgid "" "The interpreter's error indicator is now always normalized. This means that :" "c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " @@ -3442,7 +4270,7 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: whatsnew/3.12.rst:2196 +#: whatsnew/3.12.rst:2086 msgid "" "``_Py_RefTotal`` is no longer authoritative and only kept around for ABI " "compatibility. Note that it is an internal global and only available on " @@ -3450,25 +4278,25 @@ msgid "" "``_Py_GetGlobalRefTotal()``." msgstr "" -#: whatsnew/3.12.rst:2201 +#: whatsnew/3.12.rst:2091 msgid "" "The following functions now select an appropriate metaclass for the newly " "created type:" msgstr "" -#: whatsnew/3.12.rst:2204 +#: whatsnew/3.12.rst:2094 msgid ":c:func:`PyType_FromSpec`" msgstr "" -#: whatsnew/3.12.rst:2205 +#: whatsnew/3.12.rst:2095 msgid ":c:func:`PyType_FromSpecWithBases`" msgstr "" -#: whatsnew/3.12.rst:2206 +#: whatsnew/3.12.rst:2096 msgid ":c:func:`PyType_FromModuleAndSpec`" msgstr "" -#: whatsnew/3.12.rst:2208 +#: whatsnew/3.12.rst:2098 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is deprecated, and in Python 3.14+ it will be disallowed. Note that these " @@ -3476,14 +4304,14 @@ msgid "" "initialization." msgstr "" -#: whatsnew/3.12.rst:2213 +#: whatsnew/3.12.rst:2103 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " "disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" "`~object.__new__` in Python)." msgstr "" -#: whatsnew/3.12.rst:2217 +#: whatsnew/3.12.rst:2107 msgid "" "Since ``tp_new`` overrides almost everything ``PyType_From*`` functions do, " "the two are incompatible with each other. The existing behavior -- ignoring " @@ -3492,17 +4320,17 @@ msgid "" "general workaround. One of the following may work for you:" msgstr "" -#: whatsnew/3.12.rst:2224 +#: whatsnew/3.12.rst:2114 msgid "If you control the metaclass, avoid using ``tp_new`` in it:" msgstr "" -#: whatsnew/3.12.rst:2226 +#: whatsnew/3.12.rst:2116 msgid "" "If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." "tp_init` instead." msgstr "" -#: whatsnew/3.12.rst:2228 +#: whatsnew/3.12.rst:2118 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " "``tp_new`` to ``NULL`` using the :c:macro:" @@ -3510,20 +4338,20 @@ msgid "" "``PyType_From*`` functions." msgstr "" -#: whatsnew/3.12.rst:2233 +#: whatsnew/3.12.rst:2123 msgid "" "Avoid ``PyType_From*`` functions: if you don't need C-specific features " "(slots or setting the instance size), create types by :ref:`calling ` " "the metaclass." msgstr "" -#: whatsnew/3.12.rst:2237 +#: whatsnew/3.12.rst:2127 msgid "" "If you *know* the ``tp_new`` can be skipped safely, filter the deprecation " "warning out using :func:`warnings.catch_warnings` from Python." msgstr "" -#: whatsnew/3.12.rst:2240 +#: whatsnew/3.12.rst:2130 msgid "" ":c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no " "longer called in :ref:`subinterpreters `. This is " @@ -3531,14 +4359,14 @@ msgid "" "callbacks have no way of recovering extension module state)." msgstr "" -#: whatsnew/3.12.rst:2245 +#: whatsnew/3.12.rst:2135 msgid "" "This also avoids situations where extensions may find themselves running in " "a subinterpreter that they don't support (or haven't yet been loaded in). " "See :gh:`104668` for more info." msgstr "" -#: whatsnew/3.12.rst:2249 +#: whatsnew/3.12.rst:2139 msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " @@ -3549,15 +4377,15 @@ msgid "" "a single machine word:" msgstr "" -#: whatsnew/3.12.rst:2257 +#: whatsnew/3.12.rst:2147 msgid ":c:func:`PyUnstable_Long_IsCompact`" msgstr "" -#: whatsnew/3.12.rst:2258 +#: whatsnew/3.12.rst:2148 msgid ":c:func:`PyUnstable_Long_CompactValue`" msgstr "" -#: whatsnew/3.12.rst:2260 +#: whatsnew/3.12.rst:2150 msgid "" "Custom allocators, set via :c:func:`PyMem_SetAllocator`, are now required to " "be thread-safe, regardless of memory domain. Allocators that don't have " @@ -3566,7 +4394,7 @@ msgid "" "create a new GitHub issue and CC ``@ericsnowcurrently``." msgstr "" -#: whatsnew/3.12.rst:2270 +#: whatsnew/3.12.rst:2160 msgid "" "In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" "`PyDictObject` is deprecated for extension modules. Accessing this field " @@ -3575,444 +4403,647 @@ msgid "" "PEP by Ken Jin.)" msgstr "" -#: whatsnew/3.12.rst:2275 +#: whatsnew/3.12.rst:2165 msgid "Deprecate global configuration variable:" msgstr "" -#: whatsnew/3.12.rst:2362 +#: whatsnew/3.12.rst:2167 msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`" msgstr "" -#: whatsnew/3.12.rst:2363 +#: whatsnew/3.12.rst:2168 msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`" msgstr "" -#: whatsnew/3.12.rst:2364 +#: whatsnew/3.12.rst:2169 msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`" msgstr "" -#: whatsnew/3.12.rst:2365 +#: whatsnew/3.12.rst:2170 msgid ":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`" msgstr "" -#: whatsnew/3.12.rst:2366 +#: whatsnew/3.12.rst:2171 msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`" msgstr "" -#: whatsnew/3.12.rst:2367 +#: whatsnew/3.12.rst:2172 msgid ":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`" msgstr "" -#: whatsnew/3.12.rst:2368 +#: whatsnew/3.12.rst:2173 msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`" msgstr "" -#: whatsnew/3.12.rst:2369 +#: whatsnew/3.12.rst:2174 msgid ":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`" msgstr "" -#: whatsnew/3.12.rst:2370 +#: whatsnew/3.12.rst:2175 msgid ":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`" msgstr "" -#: whatsnew/3.12.rst:2371 +#: whatsnew/3.12.rst:2176 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" -#: whatsnew/3.12.rst:2372 +#: whatsnew/3.12.rst:2177 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`" msgstr "" -#: whatsnew/3.12.rst:2373 +#: whatsnew/3.12.rst:2178 msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" -#: whatsnew/3.12.rst:2374 +#: whatsnew/3.12.rst:2179 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`" msgstr "" -#: whatsnew/3.12.rst:2375 +#: whatsnew/3.12.rst:2180 msgid "" ":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed`" msgstr "" -#: whatsnew/3.12.rst:2377 +#: whatsnew/3.12.rst:2182 msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`" msgstr "" -#: whatsnew/3.12.rst:2378 +#: whatsnew/3.12.rst:2183 msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" msgstr "" -#: whatsnew/3.12.rst:2379 +#: whatsnew/3.12.rst:2184 msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." "legacy_windows_stdio`" msgstr "" -#: whatsnew/3.12.rst:2380 +#: whatsnew/3.12.rst:2185 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" msgstr "" -#: whatsnew/3.12.rst:2381 +#: whatsnew/3.12.rst:2186 msgid "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" msgstr "" -#: whatsnew/3.12.rst:2382 +#: whatsnew/3.12.rst:2187 msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." "filesystem_errors`" msgstr "" -#: whatsnew/3.12.rst:2383 +#: whatsnew/3.12.rst:2188 msgid "" ":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" "`Py_PreInitialize`)" msgstr "" -#: whatsnew/3.12.rst:2300 +#: whatsnew/3.12.rst:2190 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" msgstr "" -#: whatsnew/3.12.rst:2304 +#: whatsnew/3.12.rst:2194 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)" msgstr "" -#: whatsnew/3.12.rst:2307 +#: whatsnew/3.12.rst:2197 msgid "" "The :file:`structmember.h` header is deprecated, though it continues to be " "available and there are no plans to remove it." msgstr "" -#: whatsnew/3.12.rst:2310 +#: whatsnew/3.12.rst:2200 msgid "" "Its contents are now available just by including :file:`Python.h`, with a " "``Py`` prefix added if it was missing:" msgstr "" -#: whatsnew/3.12.rst:2313 +#: whatsnew/3.12.rst:2203 msgid "" ":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" "`PyMember_SetOne`" msgstr "" -#: whatsnew/3.12.rst:2315 +#: whatsnew/3.12.rst:2205 msgid "" "Type macros like :c:macro:`Py_T_INT`, :c:macro:`Py_T_DOUBLE`, etc. " "(previously ``T_INT``, ``T_DOUBLE``, etc.)" msgstr "" -#: whatsnew/3.12.rst:2317 +#: whatsnew/3.12.rst:2207 msgid "" "The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" "`Py_AUDIT_READ` (previously all uppercase)" msgstr "" -#: whatsnew/3.12.rst:2320 +#: whatsnew/3.12.rst:2210 msgid "Several items are not exposed from :file:`Python.h`:" msgstr "" -#: whatsnew/3.12.rst:2322 +#: whatsnew/3.12.rst:2212 msgid ":c:macro:`T_OBJECT` (use :c:macro:`Py_T_OBJECT_EX`)" msgstr "" -#: whatsnew/3.12.rst:2323 +#: whatsnew/3.12.rst:2213 msgid ":c:macro:`T_NONE` (previously undocumented, and pretty quirky)" msgstr "" -#: whatsnew/3.12.rst:2324 +#: whatsnew/3.12.rst:2214 msgid "The macro ``WRITE_RESTRICTED`` which does nothing." msgstr "" -#: whatsnew/3.12.rst:2325 +#: whatsnew/3.12.rst:2215 msgid "" "The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" "`Py_AUDIT_READ`." msgstr "" -#: whatsnew/3.12.rst:2327 +#: whatsnew/3.12.rst:2217 msgid "" "In some configurations, ```` is not included from :file:`Python." "h`. It should be included manually when using ``offsetof()``." msgstr "" -#: whatsnew/3.12.rst:2330 +#: whatsnew/3.12.rst:2220 msgid "" "The deprecated header continues to provide its original contents under the " "original names. Your old code can stay unchanged, unless the extra include " "and non-namespaced macros bother you greatly." msgstr "" -#: whatsnew/3.12.rst:2335 +#: whatsnew/3.12.rst:2225 msgid "" "(Contributed in :gh:`47146` by Petr Viktorin, based on earlier work by " "Alexander Belopolsky and Matthias Braun.)" msgstr "" -#: whatsnew/3.12.rst:2338 +#: whatsnew/3.12.rst:2228 msgid "" ":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" "func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " "instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: whatsnew/3.12.rst:2343 +#: whatsnew/3.12.rst:2233 msgid "" ":c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` " "instead. (Contributed by Irit Katriel in :gh:`102755`)." msgstr "" -#: whatsnew/3.12.rst:2346 +#: whatsnew/3.12.rst:2236 msgid "" "``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1`` " "instead. (Contributed by Irit Katriel in :gh:`102192`.)" msgstr "" -#: whatsnew/3.12.rst:2349 +#: whatsnew/3.12.rst:2239 msgid "" "Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" "func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" "c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." msgstr "" -#: whatsnew/3.12.rst:2357 +#: deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -#: whatsnew/3.12.rst:2360 -msgid "Global configuration variables:" +#: deprecations/c-api-pending-removal-in-3.14.rst:7 +msgid "" +"Creating :c:data:`immutable types ` with mutable " +"bases (:gh:`95388`)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:6 +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:10 +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:22 +msgid "Python initialization functions, deprecated in Python 3.13:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:24 +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:27 +msgid "" +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:38 +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:41 +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:44 +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:52 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:54 +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:56 +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:58 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:60 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:62 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." msgstr "" -#: whatsnew/3.12.rst:2385 +#: deprecations/c-api-pending-removal-in-3.15.rst:65 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead." msgstr "" -#: whatsnew/3.12.rst:2388 +#: deprecations/c-api-pending-removal-in-3.15.rst:68 +msgid "Global configuration variables:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:70 msgid "" -"Creating :c:data:`immutable types ` with mutable " -"bases (:gh:`95388`)." +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:73 +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2394 +#: deprecations/c-api-pending-removal-in-3.15.rst:76 msgid "" -":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule`" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2395 -msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t`" +#: deprecations/c-api-pending-removal-in-3.15.rst:79 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2396 -msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t`" +#: deprecations/c-api-pending-removal-in-3.15.rst:82 +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2397 -msgid "Python initialization functions:" +#: deprecations/c-api-pending-removal-in-3.15.rst:85 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2399 +#: deprecations/c-api-pending-removal-in-3.15.rst:88 msgid "" -":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" -"warnings.filters`" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2401 -msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix`" +#: deprecations/c-api-pending-removal-in-3.15.rst:91 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2402 -msgid ":c:func:`Py_GetPath`: get :data:`sys.path`" +#: deprecations/c-api-pending-removal-in-3.15.rst:94 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2403 -msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix`" +#: deprecations/c-api-pending-removal-in-3.15.rst:97 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2404 -msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable`" +#: deprecations/c-api-pending-removal-in-3.15.rst:100 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2405 -msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable`" +#: deprecations/c-api-pending-removal-in-3.15.rst:103 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." msgstr "" -#: whatsnew/3.12.rst:2406 +#: deprecations/c-api-pending-removal-in-3.15.rst:106 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2412 +#: deprecations/c-api-pending-removal-in-3.15.rst:109 msgid "" -"The following APIs are deprecated and will be removed, although there is " -"currently no date scheduled for their removal." +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." msgstr "" -#: whatsnew/3.12.rst:2415 -msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8" +#: deprecations/c-api-pending-removal-in-3.15.rst:113 +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2416 -msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException`" +#: deprecations/c-api-pending-removal-in-3.15.rst:116 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." msgstr "" -#: whatsnew/3.12.rst:2417 +#: deprecations/c-api-pending-removal-in-3.15.rst:119 msgid "" -":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException`" +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." msgstr "" -#: whatsnew/3.12.rst:2418 -msgid ":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException`" +#: deprecations/c-api-pending-removal-in-3.15.rst:122 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." msgstr "" -#: whatsnew/3.12.rst:2419 +#: deprecations/c-api-pending-removal-in-3.15.rst:125 msgid "" -":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." msgstr "" -#: whatsnew/3.12.rst:2420 -msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child`" +#: deprecations/c-api-pending-removal-in-3.15.rst:128 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -#: whatsnew/3.12.rst:2421 +#: deprecations/c-api-pending-removal-in-3.15.rst:133 msgid "" -":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices`" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.16.rst:4 +msgid "The bundled copy of ``libmpdec``." msgstr "" -#: whatsnew/3.12.rst:2422 -msgid ":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode`" +#: deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." msgstr "" -#: whatsnew/3.12.rst:2423 -msgid ":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode`" +#: deprecations/c-api-pending-removal-in-future.rst:7 +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr "" -#: whatsnew/3.12.rst:2424 -msgid ":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode`" +#: deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr "" -#: whatsnew/3.12.rst:2425 -msgid ":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode`" +#: deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." msgstr "" -#: whatsnew/3.12.rst:2426 -msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +#: deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr "" -#: whatsnew/3.12.rst:2427 -msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException`" +#: deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." msgstr "" -#: whatsnew/3.12.rst:2428 -msgid ":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1``" +#: deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr "" -#: whatsnew/3.12.rst:2429 +#: deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " -"instead" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -#: whatsnew/3.12.rst:2431 -msgid ":c:member:`!PyDictObject.ma_version_tag` member" +#: deprecations/c-api-pending-removal-in-future.rst:21 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr "" -#: whatsnew/3.12.rst:2432 +#: deprecations/c-api-pending-removal-in-future.rst:23 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:25 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:29 msgid "Thread Local Storage (TLS) API:" msgstr "" -#: whatsnew/3.12.rst:2434 -msgid ":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc`" +#: deprecations/c-api-pending-removal-in-future.rst:31 +msgid "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr "" -#: whatsnew/3.12.rst:2435 -msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free`" +#: deprecations/c-api-pending-removal-in-future.rst:33 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr "" -#: whatsnew/3.12.rst:2436 -msgid ":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set`" +#: deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr "" -#: whatsnew/3.12.rst:2437 -msgid ":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get`" +#: deprecations/c-api-pending-removal-in-future.rst:37 +msgid "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr "" -#: whatsnew/3.12.rst:2438 -msgid ":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete`" +#: deprecations/c-api-pending-removal-in-future.rst:39 +msgid "" +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " +"instead." msgstr "" -#: whatsnew/3.12.rst:2439 -msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7" +#: deprecations/c-api-pending-removal-in-future.rst:41 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr "" -#: whatsnew/3.12.rst:2444 +#: whatsnew/3.12.rst:2257 msgid "" "Remove the :file:`token.h` header file. There was never any public tokenizer " "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" -#: whatsnew/3.12.rst:2449 +#: whatsnew/3.12.rst:2262 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." msgstr "" -#: whatsnew/3.12.rst:2451 +#: whatsnew/3.12.rst:2264 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr "" -#: whatsnew/3.12.rst:2452 +#: whatsnew/3.12.rst:2265 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr "" -#: whatsnew/3.12.rst:2453 +#: whatsnew/3.12.rst:2266 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr "" -#: whatsnew/3.12.rst:2454 +#: whatsnew/3.12.rst:2267 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr "" -#: whatsnew/3.12.rst:2455 +#: whatsnew/3.12.rst:2268 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr "" -#: whatsnew/3.12.rst:2456 +#: whatsnew/3.12.rst:2269 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr "" -#: whatsnew/3.12.rst:2457 +#: whatsnew/3.12.rst:2270 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr "" -#: whatsnew/3.12.rst:2458 +#: whatsnew/3.12.rst:2271 msgid ":c:func:`!PyUnicode_GetSize`" msgstr "" -#: whatsnew/3.12.rst:2459 +#: whatsnew/3.12.rst:2272 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr "" -#: whatsnew/3.12.rst:2461 +#: whatsnew/3.12.rst:2274 msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po new file mode 100644 index 00000000..24dfcbb5 --- /dev/null +++ b/whatsnew/3.13.po @@ -0,0 +1,5651 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2025, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: whatsnew/3.13.rst:4 +msgid "What's New In Python 3.13" +msgstr "" + +#: whatsnew/3.13.rst:0 +msgid "Editors" +msgstr "" + +#: whatsnew/3.13.rst:6 +msgid "Adam Turner and Thomas Wouters" +msgstr "" + +#: whatsnew/3.13.rst:48 +msgid "" +"This article explains the new features in Python 3.13, compared to 3.12. " +"Python 3.13 was released on October 7, 2024. For full details, see the :ref:" +"`changelog `." +msgstr "" + +#: whatsnew/3.13.rst:54 +msgid ":pep:`719` -- Python 3.13 Release Schedule" +msgstr "" + +#: whatsnew/3.13.rst:58 +msgid "Summary -- Release Highlights" +msgstr "" + +#: whatsnew/3.13.rst:63 +msgid "" +"Python 3.13 is a stable release of the Python programming language, with a " +"mix of changes to the language, the implementation and the standard library. " +"The biggest changes include a new `interactive interpreter `_, experimental support for running in a " +"`free-threaded mode `_ (:pep:`703`), and " +"a `Just-In-Time compiler `_ (:pep:`744`)." +msgstr "" + +#: whatsnew/3.13.rst:72 +msgid "" +"Error messages continue to improve, with tracebacks now highlighted in color " +"by default. The :func:`locals` builtin now has :ref:`defined semantics " +"` for changing the returned mapping, and type " +"parameters now support default values." +msgstr "" + +#: whatsnew/3.13.rst:77 +msgid "" +"The library changes contain removal of deprecated APIs and modules, as well " +"as the usual improvements in user-friendliness and correctness. Several " +"legacy standard library modules have now `been removed `_ following their deprecation in Python 3.11 (:pep:`594`)." +msgstr "" + +#: whatsnew/3.13.rst:82 +msgid "" +"This article doesn't attempt to provide a complete specification of all new " +"features, but instead gives a convenient overview. For full details refer to " +"the documentation, such as the :ref:`Library Reference ` and :" +"ref:`Language Reference `. To understand the complete " +"implementation and design rationale for a change, refer to the PEP for a " +"particular new feature; but note that PEPs usually are not kept up-to-date " +"once a feature has been fully implemented. See `Porting to Python 3.13`_ for " +"guidance on upgrading from earlier versions of Python." +msgstr "" + +#: whatsnew/3.13.rst:98 +msgid "Interpreter improvements:" +msgstr "" + +#: whatsnew/3.13.rst:100 +msgid "" +"A greatly improved :ref:`interactive interpreter ` and :ref:`improved error messages `." +msgstr "" + +#: whatsnew/3.13.rst:103 +msgid "" +":pep:`667`: The :func:`locals` builtin now has :ref:`defined semantics " +"` when mutating the returned mapping. Python " +"debuggers and similar tools may now more reliably update local variables in " +"optimized scopes even during concurrent code execution." +msgstr "" + +#: whatsnew/3.13.rst:108 +msgid "" +":pep:`703`: CPython 3.13 has experimental support for running with the :term:" +"`global interpreter lock` disabled. See :ref:`Free-threaded CPython " +"` for more details." +msgstr "" + +#: whatsnew/3.13.rst:111 +msgid "" +":pep:`744`: A basic :ref:`JIT compiler ` was " +"added. It is currently disabled by default (though we may turn it on later). " +"Performance improvements are modest -- we expect to improve this over the " +"next few releases." +msgstr "" + +#: whatsnew/3.13.rst:115 +msgid "" +"Color support in the new :ref:`interactive interpreter `, as well as in :ref:`tracebacks ` and :ref:`doctest ` output. " +"This can be disabled through the :envvar:`PYTHON_COLORS` and |NO_COLOR|_ " +"environment variables." +msgstr "" + +#: whatsnew/3.13.rst:122 +msgid "Python data model improvements:" +msgstr "" + +#: whatsnew/3.13.rst:124 +msgid "" +":attr:`~type.__static_attributes__` stores the names of attributes accessed " +"through ``self.X`` in any function in a class body." +msgstr "" + +#: whatsnew/3.13.rst:126 +msgid "" +":attr:`~type.__firstlineno__` records the first line number of a class " +"definition." +msgstr "" + +#: whatsnew/3.13.rst:129 +msgid "Significant improvements in the standard library:" +msgstr "" + +#: whatsnew/3.13.rst:131 +msgid "" +"Add a new :exc:`PythonFinalizationError` exception, raised when an operation " +"is blocked during :term:`finalization `." +msgstr "" + +#: whatsnew/3.13.rst:133 +msgid "" +"The :mod:`argparse` module now supports deprecating command-line options, " +"positional arguments, and subcommands." +msgstr "" + +#: whatsnew/3.13.rst:135 +msgid "" +"The new functions :func:`base64.z85encode` and :func:`base64.z85decode` " +"support encoding and decoding `Z85 data`_." +msgstr "" + +#: whatsnew/3.13.rst:137 +msgid "" +"The :mod:`copy` module now has a :func:`copy.replace` function, with support " +"for many builtin types and any class defining the :func:`~object." +"__replace__` method." +msgstr "" + +#: whatsnew/3.13.rst:140 +msgid "" +"The new :mod:`dbm.sqlite3` module is now the default :mod:`dbm` backend." +msgstr "" + +#: whatsnew/3.13.rst:141 +msgid "" +"The :mod:`os` module has a :ref:`suite of new functions ` for " +"working with Linux's timer notification file descriptors." +msgstr "" + +#: whatsnew/3.13.rst:143 +msgid "" +"The :mod:`random` module now has a :ref:`command-line interface `." +msgstr "" + +#: whatsnew/3.13.rst:145 +msgid "Security improvements:" +msgstr "" + +#: whatsnew/3.13.rst:147 +msgid "" +":func:`ssl.create_default_context` sets :data:`ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " +"flags." +msgstr "" + +#: whatsnew/3.13.rst:150 +msgid "C API improvements:" +msgstr "" + +#: whatsnew/3.13.rst:152 +msgid "" +"The :c:data:`Py_mod_gil` slot is now used to indicate that an extension " +"module supports running with the :term:`GIL` disabled." +msgstr "" + +#: whatsnew/3.13.rst:154 +msgid "" +"The :doc:`PyTime C API ` has been added, providing access to " +"system clocks." +msgstr "" + +#: whatsnew/3.13.rst:156 +msgid "" +":c:type:`PyMutex` is a new lightweight mutex that occupies a single byte." +msgstr "" + +#: whatsnew/3.13.rst:157 +msgid "" +"There is a new :ref:`suite of functions ` for generating :" +"pep:`669` monitoring events in the C API." +msgstr "" + +#: whatsnew/3.13.rst:160 +msgid "New typing features:" +msgstr "" + +#: whatsnew/3.13.rst:162 +msgid "" +":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." +"ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." +msgstr "" + +#: whatsnew/3.13.rst:164 +msgid "" +":pep:`702`: The new :func:`warnings.deprecated` decorator adds support for " +"marking deprecations in the type system and at runtime." +msgstr "" + +#: whatsnew/3.13.rst:166 +msgid "" +":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" +"`typing.TypedDict` as read-only for type checkers." +msgstr "" + +#: whatsnew/3.13.rst:168 +msgid "" +":pep:`742`: :data:`typing.TypeIs` provides more intuitive type narrowing " +"behavior, as an alternative to :data:`typing.TypeGuard`." +msgstr "" + +#: whatsnew/3.13.rst:171 +msgid "Platform support:" +msgstr "" + +#: whatsnew/3.13.rst:173 +msgid "" +":pep:`730`: Apple's iOS is now an :ref:`officially supported platform " +"`, at :pep:`tier 3 <11#tier-3>`." +msgstr "" + +#: whatsnew/3.13.rst:175 +msgid "" +":pep:`738`: Android is now an :ref:`officially supported platform " +"`, at :pep:`tier 3 <11#tier-3>`." +msgstr "" + +#: whatsnew/3.13.rst:177 +msgid "" +"``wasm32-wasi`` is now supported as a :pep:`tier 2 <11#tier-2>` platform." +msgstr "" + +#: whatsnew/3.13.rst:178 +msgid "``wasm32-emscripten`` is no longer an officially supported platform." +msgstr "" + +#: whatsnew/3.13.rst:180 +msgid "Important removals:" +msgstr "" + +#: whatsnew/3.13.rst:182 +msgid "" +":ref:`PEP 594 `: The remaining 19 \"dead " +"batteries\" (legacy stdlib modules) have been removed from the standard " +"library: :mod:`!aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!" +"chunk`, :mod:`!crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:" +"`!nis`, :mod:`!nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!" +"sndhdr`, :mod:`!spwd`, :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:" +"`!xdrlib`." +msgstr "" + +#: whatsnew/3.13.rst:188 +msgid "" +"Remove the :program:`2to3` tool and :mod:`!lib2to3` module (deprecated in " +"Python 3.11)." +msgstr "" + +#: whatsnew/3.13.rst:190 +msgid "Remove the :mod:`!tkinter.tix` module (deprecated in Python 3.6)." +msgstr "" + +#: whatsnew/3.13.rst:191 +msgid "Remove the :func:`!locale.resetlocale` function." +msgstr "" + +#: whatsnew/3.13.rst:192 +msgid "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces." +msgstr "" + +#: whatsnew/3.13.rst:193 +msgid "Remove chained :class:`classmethod` descriptors." +msgstr "" + +#: whatsnew/3.13.rst:195 +msgid "Release schedule changes:" +msgstr "" + +#: whatsnew/3.13.rst:197 +msgid "" +":pep:`602` (\"Annual Release Cycle for Python\") has been updated to extend " +"the full support ('bugfix') period for new releases to two years. This " +"updated policy means that:" +msgstr "" + +#: whatsnew/3.13.rst:201 +msgid "" +"Python 3.9--3.12 have one and a half years of full support, followed by " +"three and a half years of security fixes." +msgstr "" + +#: whatsnew/3.13.rst:203 +msgid "" +"Python 3.13 and later have two years of full support, followed by three " +"years of security fixes." +msgstr "" + +#: whatsnew/3.13.rst:2044 +msgid "New Features" +msgstr "" + +#: whatsnew/3.13.rst:214 +msgid "A better interactive interpreter" +msgstr "" + +#: whatsnew/3.13.rst:216 +msgid "" +"Python now uses a new :term:`interactive` shell by default, based on code " +"from the `PyPy project`_. When the user starts the :term:`REPL` from an " +"interactive terminal, the following new features are now supported:" +msgstr "" + +#: whatsnew/3.13.rst:221 +msgid "Multiline editing with history preservation." +msgstr "" + +#: whatsnew/3.13.rst:222 +msgid "" +"Direct support for REPL-specific commands like :kbd:`help`, :kbd:`exit`, " +"and :kbd:`quit`, without the need to call them as functions." +msgstr "" + +#: whatsnew/3.13.rst:224 +msgid "" +"Prompts and tracebacks with :ref:`color enabled by default `." +msgstr "" + +#: whatsnew/3.13.rst:226 +msgid "" +"Interactive help browsing using :kbd:`F1` with a separate command history." +msgstr "" + +#: whatsnew/3.13.rst:228 +msgid "" +"History browsing using :kbd:`F2` that skips output as well as the :term:" +"`>>>` and :term:`...` prompts." +msgstr "" + +#: whatsnew/3.13.rst:230 +msgid "" +"\"Paste mode\" with :kbd:`F3` that makes pasting larger blocks of code " +"easier (press :kbd:`F3` again to return to the regular prompt)." +msgstr "" + +#: whatsnew/3.13.rst:233 +msgid "" +"To disable the new interactive shell, set the :envvar:`PYTHON_BASIC_REPL` " +"environment variable. For more on interactive mode, see :ref:`tut-interac`." +msgstr "" + +#: whatsnew/3.13.rst:237 +msgid "" +"(Contributed by Pablo Galindo Salgado, Łukasz Langa, and Lysandros Nikolaou " +"in :gh:`111201` based on code from the PyPy project. Windows support " +"contributed by Dino Viehland and Anthony Shaw.)" +msgstr "" + +#: whatsnew/3.13.rst:247 +msgid "Improved error messages" +msgstr "" + +#: whatsnew/3.13.rst:249 +msgid "" +"The interpreter now uses color by default when displaying tracebacks in the " +"terminal. This feature :ref:`can be controlled ` " +"via the new :envvar:`PYTHON_COLORS` environment variable as well as the " +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. (Contributed " +"by Pablo Galindo Salgado in :gh:`112730`.)" +msgstr "" + +#: whatsnew/3.13.rst:255 +msgid "" +"A common mistake is to write a script with the same name as a standard " +"library module. When this results in errors, we now display a more helpful " +"error message:" +msgstr "" + +#: whatsnew/3.13.rst:259 +msgid "" +"$ python random.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/random.py\", line 1, in \n" +" import random\n" +" File \"/home/me/random.py\", line 3, in \n" +" print(random.randint(5))\n" +" ^^^^^^^^^^^^^^\n" +"AttributeError: module 'random' has no attribute 'randint' (consider " +"renaming '/home/me/random.py' since it has the same name as the standard " +"library module named 'random' and prevents importing that standard library " +"module)" +msgstr "" + +#: whatsnew/3.13.rst:270 +msgid "" +"Similarly, if a script has the same name as a third-party module that it " +"attempts to import and this results in errors, we also display a more " +"helpful error message:" +msgstr "" + +#: whatsnew/3.13.rst:274 +msgid "" +"$ python numpy.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/numpy.py\", line 1, in \n" +" import numpy as np\n" +" File \"/home/me/numpy.py\", line 3, in \n" +" np.array([1, 2, 3])\n" +" ^^^^^^^^\n" +"AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" +"home/me/numpy.py' if it has the same name as a library you intended to " +"import)" +msgstr "" + +#: whatsnew/3.13.rst:285 +msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" +msgstr "" + +#: whatsnew/3.13.rst:287 +msgid "" +"The error message now tries to suggest the correct keyword argument when an " +"incorrect keyword argument is passed to a function." +msgstr "" + +#: whatsnew/3.13.rst:290 +msgid "" +">>> \"Better error messages!\".split(max_split=1)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" \"Better error messages!\".split(max_split=1)\n" +" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\n" +"TypeError: split() got an unexpected keyword argument 'max_split'. Did you " +"mean 'maxsplit'?" +msgstr "" + +#: whatsnew/3.13.rst:299 +msgid "" +"(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" +msgstr "" + +#: whatsnew/3.13.rst:305 +msgid "Free-threaded CPython" +msgstr "" + +#: whatsnew/3.13.rst:307 +msgid "" +"CPython now has experimental support for running in a free-threaded mode, " +"with the :term:`global interpreter lock` (GIL) disabled. This is an " +"experimental feature and therefore is not enabled by default. The free-" +"threaded mode requires a different executable, usually called " +"``python3.13t`` or ``python3.13t.exe``. Pre-built binaries marked as *free-" +"threaded* can be installed as part of the official :ref:`Windows ` and :ref:`macOS ` " +"installers, or CPython can be built from source with the :option:`--disable-" +"gil` option." +msgstr "" + +#: whatsnew/3.13.rst:317 +msgid "" +"Free-threaded execution allows for full utilization of the available " +"processing power by running threads in parallel on available CPU cores. " +"While not all software will benefit from this automatically, programs " +"designed with threading in mind will run faster on multi-core hardware. " +"**The free-threaded mode is experimental** and work is ongoing to improve " +"it: expect some bugs and a substantial single-threaded performance hit. Free-" +"threaded builds of CPython support optionally running with the GIL enabled " +"at runtime using the environment variable :envvar:`PYTHON_GIL` or the " +"command-line option :option:`-X gil=1`." +msgstr "" + +#: whatsnew/3.13.rst:327 +msgid "" +"To check if the current interpreter supports free-threading, :option:`python " +"-VV <-V>` and :data:`sys.version` contain \"experimental free-threading " +"build\". The new :func:`!sys._is_gil_enabled` function can be used to check " +"whether the GIL is actually disabled in the running process." +msgstr "" + +#: whatsnew/3.13.rst:332 +msgid "" +"C-API extension modules need to be built specifically for the free-threaded " +"build. Extensions that support running with the :term:`GIL` disabled should " +"use the :c:data:`Py_mod_gil` slot. Extensions using single-phase init should " +"use :c:func:`PyUnstable_Module_SetGIL` to indicate whether they support " +"running with the GIL disabled. Importing C extensions that don't use these " +"mechanisms will cause the GIL to be enabled, unless the GIL was explicitly " +"disabled with the :envvar:`PYTHON_GIL` environment variable or the :option:`-" +"X gil=0` option. pip 24.1 or newer is required to install packages with C " +"extensions in the free-threaded build." +msgstr "" + +#: whatsnew/3.13.rst:343 +msgid "" +"This work was made possible thanks to many individuals and organizations, " +"including the large community of contributors to Python and third-party " +"projects to test and enable free-threading support. Notable contributors " +"include: Sam Gross, Ken Jin, Donghee Na, Itamar Oren, Matt Page, Brett " +"Simmers, Dino Viehland, Carl Meyer, Nathan Goldbaum, Ralf Gommers, Lysandros " +"Nikolaou, and many others. Many of these contributors are employed by Meta, " +"which has provided significant engineering resources to support this project." +msgstr "" + +#: whatsnew/3.13.rst:355 +msgid "" +":pep:`703` \"Making the Global Interpreter Lock Optional in CPython\" " +"contains rationale and information surrounding this work." +msgstr "" + +#: whatsnew/3.13.rst:358 +msgid "" +"`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for " +"extension authors." +msgstr "" + +#: whatsnew/3.13.rst:366 +msgid "An experimental just-in-time (JIT) compiler" +msgstr "" + +#: whatsnew/3.13.rst:368 +msgid "" +"When CPython is configured and built using the :option:`!--enable-" +"experimental-jit` option, a just-in-time (JIT) compiler is added which may " +"speed up some Python programs. On Windows, use ``PCbuild/build.bat --" +"experimental-jit`` to enable the JIT or ``--experimental-jit-interpreter`` " +"to enable the Tier 2 interpreter. Build requirements and further supporting " +"information `are contained at`__ :file:`Tools/jit/README.md`." +msgstr "" + +#: whatsnew/3.13.rst:378 +msgid "" +"The :option:`!--enable-experimental-jit` option takes these (optional) " +"values, defaulting to ``yes`` if :option:`!--enable-experimental-jit` is " +"present without the optional value." +msgstr "" + +#: whatsnew/3.13.rst:382 +msgid "``no``: Disable the entire Tier 2 and JIT pipeline." +msgstr "" + +#: whatsnew/3.13.rst:383 +msgid "" +"``yes``: Enable the JIT. To disable the JIT at runtime, pass the environment " +"variable ``PYTHON_JIT=0``." +msgstr "" + +#: whatsnew/3.13.rst:385 +msgid "" +"``yes-off``: Build the JIT but disable it by default. To enable the JIT at " +"runtime, pass the environment variable ``PYTHON_JIT=1``." +msgstr "" + +#: whatsnew/3.13.rst:387 +msgid "" +"``interpreter``: Enable the Tier 2 interpreter but disable the JIT. The " +"interpreter can be disabled by running with ``PYTHON_JIT=0``." +msgstr "" + +#: whatsnew/3.13.rst:390 +msgid "The internal architecture is roughly as follows:" +msgstr "" + +#: whatsnew/3.13.rst:392 +msgid "" +"We start with specialized *Tier 1 bytecode*. See :ref:`What's new in 3.11 " +"` for details." +msgstr "" + +#: whatsnew/3.13.rst:394 +msgid "" +"When the Tier 1 bytecode gets hot enough, it gets translated to a new purely " +"internal intermediate representation (IR), called the *Tier 2 IR*, and " +"sometimes referred to as micro-ops (\"uops\")." +msgstr "" + +#: whatsnew/3.13.rst:397 +msgid "" +"The Tier 2 IR uses the same stack-based virtual machine as Tier 1, but the " +"instruction format is better suited to translation to machine code." +msgstr "" + +#: whatsnew/3.13.rst:399 +msgid "" +"We have several optimization passes for Tier 2 IR, which are applied before " +"it is interpreted or translated to machine code." +msgstr "" + +#: whatsnew/3.13.rst:401 +msgid "" +"There is a Tier 2 interpreter, but it is mostly intended for debugging the " +"earlier stages of the optimization pipeline. The Tier 2 interpreter can be " +"enabled by configuring Python with ``--enable-experimental-jit=interpreter``." +msgstr "" + +#: whatsnew/3.13.rst:405 +msgid "" +"When the JIT is enabled, the optimized Tier 2 IR is translated to machine " +"code, which is then executed." +msgstr "" + +#: whatsnew/3.13.rst:407 +msgid "" +"The machine code translation process uses a technique called *copy-and-" +"patch*. It has no runtime dependencies, but there is a new build-time " +"dependency on LLVM." +msgstr "" + +#: whatsnew/3.13.rst:411 +msgid ":pep:`744`" +msgstr "" + +#: whatsnew/3.13.rst:413 +msgid "" +"(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik " +"Kjolstad. Tier 2 IR by Mark Shannon and Guido van Rossum. Tier 2 optimizer " +"by Ken Jin.)" +msgstr "" + +#: whatsnew/3.13.rst:421 +msgid "Defined mutation semantics for :py:func:`locals`" +msgstr "" + +#: whatsnew/3.13.rst:423 +msgid "" +"Historically, the expected result of mutating the return value of :func:" +"`locals` has been left to individual Python implementations to define. " +"Starting from Python 3.13, :pep:`667` standardises the historical behavior " +"of CPython for most code execution scopes, but changes :term:`optimized " +"scopes ` (functions, generators, coroutines, " +"comprehensions, and generator expressions) to explicitly return independent " +"snapshots of the currently assigned local variables, including locally " +"referenced nonlocal variables captured in closures." +msgstr "" + +#: whatsnew/3.13.rst:432 +msgid "" +"This change to the semantics of :func:`locals` in optimized scopes also " +"affects the default behavior of code execution functions that implicitly " +"target :func:`!locals` if no explicit namespace is provided (such as :func:" +"`exec` and :func:`eval`). In previous versions, whether or not changes could " +"be accessed by calling :func:`!locals` after calling the code execution " +"function was implementation-dependent. In CPython specifically, such code " +"would typically appear to work as desired, but could sometimes fail in " +"optimized scopes based on other code (including debuggers and code execution " +"tracing tools) potentially resetting the shared snapshot in that scope. Now, " +"the code will always run against an independent snapshot of the local " +"variables in optimized scopes, and hence the changes will never be visible " +"in subsequent calls to :func:`!locals`. To access the changes made in these " +"cases, an explicit namespace reference must now be passed to the relevant " +"function. Alternatively, it may make sense to update affected code to use a " +"higher level code execution API that returns the resulting code execution " +"namespace (e.g. :func:`runpy.run_path` when executing Python files from " +"disk)." +msgstr "" + +#: whatsnew/3.13.rst:451 +msgid "" +"To ensure debuggers and similar tools can reliably update local variables in " +"scopes affected by this change, :attr:`FrameType.f_locals ` " +"now returns a write-through proxy to the frame's local and locally " +"referenced nonlocal variables in these scopes, rather than returning an " +"inconsistently updated shared ``dict`` instance with undefined runtime " +"semantics." +msgstr "" + +#: whatsnew/3.13.rst:457 +msgid "" +"See :pep:`667` for more details, including related C API changes and " +"deprecations. Porting notes are also provided below for the affected :ref:" +"`Python APIs ` and :ref:`C APIs `." +msgstr "" + +#: whatsnew/3.13.rst:462 +msgid "" +"(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" +"`74929`. Documentation updates provided by Guido van Rossum and Alyssa " +"Coghlan.)" +msgstr "" + +#: whatsnew/3.13.rst:470 +msgid "Support for mobile platforms" +msgstr "" + +#: whatsnew/3.13.rst:472 +msgid "" +":pep:`730`: iOS is now a :pep:`11` supported platform, with the ``arm64-" +"apple-ios`` and ``arm64-apple-ios-simulator`` targets at tier 3 (iPhone and " +"iPad devices released after 2013 and the Xcode iOS simulator running on " +"Apple silicon hardware, respectively). ``x86_64-apple-ios-simulator`` (the " +"Xcode iOS simulator running on older ``x86_64`` hardware) is not a tier 3 " +"supported platform, but will have best-effort support. (PEP written and " +"implementation contributed by Russell Keith-Magee in :gh:`114099`.)" +msgstr "" + +#: whatsnew/3.13.rst:482 +msgid "" +":pep:`738`: Android is now a :pep:`11` supported platform, with the " +"``aarch64-linux-android`` and ``x86_64-linux-android`` targets at tier 3. " +"The 32-bit targets ``arm-linux-androideabi`` and ``i686-linux-android`` are " +"not tier 3 supported platforms, but will have best-effort support. (PEP " +"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" +msgstr "" + +#: whatsnew/3.13.rst:489 +msgid ":pep:`730`, :pep:`738`" +msgstr "" + +#: whatsnew/3.13.rst:493 +msgid "Other Language Changes" +msgstr "" + +#: whatsnew/3.13.rst:495 +msgid "" +"The compiler now strips common leading whitespace from every line in a " +"docstring. This reduces the size of the :term:`bytecode cache ` " +"(such as ``.pyc`` files), with reductions in file size of around 5%, for " +"example in :mod:`!sqlalchemy.orm.session` from SQLAlchemy 2.0. This change " +"affects tools that use docstrings, such as :mod:`doctest`." +msgstr "" + +#: whatsnew/3.13.rst:502 +msgid "" +">>> def spam():\n" +"... \"\"\"\n" +"... This is a docstring with\n" +"... leading whitespace.\n" +"...\n" +"... It even has multiple paragraphs!\n" +"... \"\"\"\n" +"...\n" +">>> spam.__doc__\n" +"'\\nThis is a docstring with\\n leading whitespace.\\n\\nIt even has " +"multiple paragraphs!\\n'" +msgstr "" + +#: whatsnew/3.13.rst:515 +msgid "(Contributed by Inada Naoki in :gh:`81283`.)" +msgstr "" + +#: whatsnew/3.13.rst:517 +msgid "" +":ref:`Annotation scopes ` within class scopes can now " +"contain lambdas and comprehensions. Comprehensions that are located within " +"class scopes are not inlined into their parent scope." +msgstr "" + +#: whatsnew/3.13.rst:522 +msgid "" +"class C[T]:\n" +" type Alias = lambda: T" +msgstr "" + +#: whatsnew/3.13.rst:527 +msgid "(Contributed by Jelle Zijlstra in :gh:`109118` and :gh:`118160`.)" +msgstr "" + +#: whatsnew/3.13.rst:529 +msgid "" +":ref:`Future statements ` are no longer triggered by relative " +"imports of the :mod:`__future__` module, meaning that statements of the form " +"``from .__future__ import ...`` are now simply standard relative imports, " +"with no special features activated. (Contributed by Jeremiah Gabriel Pascual " +"in :gh:`118216`.)" +msgstr "" + +#: whatsnew/3.13.rst:535 +msgid "" +":keyword:`global` declarations are now permitted in :keyword:`except` blocks " +"when that global is used in the :keyword:`else` block. Previously this " +"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel in :gh:" +"`111123`.)" +msgstr "" + +#: whatsnew/3.13.rst:540 +msgid "" +"Add :envvar:`PYTHON_FROZEN_MODULES`, a new environment variable that " +"determines whether frozen modules are ignored by the import machinery, " +"equivalent to the :option:`-X frozen_modules <-X>` command-line option. " +"(Contributed by Yilei Yang in :gh:`111374`.)" +msgstr "" + +#: whatsnew/3.13.rst:545 +msgid "" +"Add :ref:`support for the perf profiler ` working without " +"`frame pointers `_ through the new " +"environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` and command-line " +"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo in :gh:" +"`118518`.)" +msgstr "" + +#: whatsnew/3.13.rst:551 +msgid "" +"The location of a :file:`.python_history` file can be changed via the new :" +"envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " +"Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" +msgstr "" + +#: whatsnew/3.13.rst:556 +msgid "" +"Classes have a new :attr:`~type.__static_attributes__` attribute. This is " +"populated by the compiler with a tuple of the class's attribute names which " +"are assigned through ``self.`` from any function in its body. " +"(Contributed by Irit Katriel in :gh:`115775`.)" +msgstr "" + +#: whatsnew/3.13.rst:561 +msgid "" +"The compiler now creates a :attr:`!__firstlineno__` attribute on classes " +"with the line number of the first line of the class definition. (Contributed " +"by Serhiy Storchaka in :gh:`118465`.)" +msgstr "" + +#: whatsnew/3.13.rst:565 +msgid "" +"The :func:`exec` and :func:`eval` builtins now accept the *globals* and " +"*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" +"`105879`)" +msgstr "" + +#: whatsnew/3.13.rst:569 +msgid "" +"The :func:`compile` builtin now accepts a new flag, ``ast." +"PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " +"the returned AST is optimized according to the value of the *optimize* " +"argument. (Contributed by Irit Katriel in :gh:`108113`)." +msgstr "" + +#: whatsnew/3.13.rst:575 +msgid "" +"Add a :attr:`~property.__name__` attribute on :class:`property` objects. " +"(Contributed by Eugene Toder in :gh:`101860`.)" +msgstr "" + +#: whatsnew/3.13.rst:578 +msgid "" +"Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" +"`RuntimeError` and used to signal when operations are blocked during :term:" +"`finalization `. The following callables now raise :" +"exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" +msgstr "" + +#: whatsnew/3.13.rst:584 +msgid ":func:`_thread.start_new_thread`" +msgstr "" + +#: whatsnew/3.13.rst:585 +msgid ":func:`os.fork`" +msgstr "" + +#: whatsnew/3.13.rst:586 +msgid ":func:`os.forkpty`" +msgstr "" + +#: whatsnew/3.13.rst:587 +msgid ":class:`subprocess.Popen`" +msgstr "" + +#: whatsnew/3.13.rst:589 +msgid "(Contributed by Victor Stinner in :gh:`114570`.)" +msgstr "" + +#: whatsnew/3.13.rst:591 +msgid "" +"Allow the *count* argument of :meth:`str.replace` to be a keyword. " +"(Contributed by Hugo van Kemenade in :gh:`106487`.)" +msgstr "" + +#: whatsnew/3.13.rst:594 +msgid "" +"Many functions now emit a warning if a boolean value is passed as a file " +"descriptor argument. This can help catch some errors earlier. (Contributed " +"by Serhiy Storchaka in :gh:`82626`.)" +msgstr "" + +#: whatsnew/3.13.rst:599 +msgid "" +"Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " +"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" +"`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" +msgstr "" + +#: whatsnew/3.13.rst:606 +msgid "New Modules" +msgstr "" + +#: whatsnew/3.13.rst:608 +msgid "" +":mod:`dbm.sqlite3`: An SQLite backend for :mod:`dbm`. (Contributed by " +"Raymond Hettinger and Erlend E. Aasland in :gh:`100414`.)" +msgstr "" + +#: whatsnew/3.13.rst:613 +msgid "Improved Modules" +msgstr "" + +#: whatsnew/3.13.rst:617 +msgid "argparse" +msgstr "" + +#: whatsnew/3.13.rst:619 +msgid "" +"Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." +"add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" +"line options, positional arguments, and subcommands. (Contributed by Serhiy " +"Storchaka in :gh:`83648`.)" +msgstr "" + +#: whatsnew/3.13.rst:627 +msgid "array" +msgstr "" + +#: whatsnew/3.13.rst:629 +msgid "" +"Add the ``'w'`` type code (``Py_UCS4``) for Unicode characters. It should be " +"used instead of the deprecated ``'u'`` type code. (Contributed by Inada " +"Naoki in :gh:`80480`.)" +msgstr "" + +#: whatsnew/3.13.rst:633 +msgid "" +"Register :class:`array.array` as a :class:`~collections.abc.MutableSequence` " +"by implementing the :meth:`~array.array.clear` method. (Contributed by Mike " +"Zimin in :gh:`114894`.)" +msgstr "" + +#: whatsnew/3.13.rst:639 +msgid "ast" +msgstr "" + +#: whatsnew/3.13.rst:641 +msgid "" +"The constructors of node types in the :mod:`ast` module are now stricter in " +"the arguments they accept, with more intuitive behavior when arguments are " +"omitted." +msgstr "" + +#: whatsnew/3.13.rst:645 +msgid "" +"If an optional field on an AST node is not included as an argument when " +"constructing an instance, the field will now be set to ``None``. Similarly, " +"if a list field is omitted, that field will now be set to an empty list, and " +"if an :class:`!expr_context` field is omitted, it defaults to :class:`Load() " +"`. (Previously, in all cases, the attribute would be missing on " +"the newly constructed AST node instance.)" +msgstr "" + +#: whatsnew/3.13.rst:653 +msgid "" +"In all other cases, where a required argument is omitted, the node " +"constructor will emit a :exc:`DeprecationWarning`. This will raise an " +"exception in Python 3.15. Similarly, passing a keyword argument to the " +"constructor that does not map to a field on the AST node is now deprecated, " +"and will raise an exception in Python 3.15." +msgstr "" + +#: whatsnew/3.13.rst:660 +msgid "" +"These changes do not apply to user-defined subclasses of :class:`ast.AST` " +"unless the class opts in to the new behavior by defining the :attr:`.AST." +"_field_types` mapping." +msgstr "" + +#: whatsnew/3.13.rst:664 +msgid "" +"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" +"`118851`.)" +msgstr "" + +#: whatsnew/3.13.rst:666 +msgid "" +":func:`ast.parse` now accepts an optional argument *optimize* which is " +"passed on to :func:`compile`. This makes it possible to obtain an optimized " +"AST. (Contributed by Irit Katriel in :gh:`108113`.)" +msgstr "" + +#: whatsnew/3.13.rst:673 +msgid "asyncio" +msgstr "" + +#: whatsnew/3.13.rst:675 +msgid "" +":func:`asyncio.as_completed` now returns an object that is both an :term:" +"`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " +"`. The awaitables yielded by asynchronous iteration include " +"original task or future objects that were passed in, making it easier to " +"associate results with the tasks being completed. (Contributed by Justin " +"Arthur in :gh:`77714`.)" +msgstr "" + +#: whatsnew/3.13.rst:683 +msgid "" +":meth:`asyncio.loop.create_unix_server` will now automatically remove the " +"Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" +"`111246`.)" +msgstr "" + +#: whatsnew/3.13.rst:687 +msgid "" +":meth:`.DatagramTransport.sendto` will now send zero-length datagrams if " +"called with an empty bytes object. The transport flow control also now " +"accounts for the datagram header when calculating the buffer size. " +"(Contributed by Jamie Phan in :gh:`115199`.)" +msgstr "" + +#: whatsnew/3.13.rst:693 +msgid "" +"Add :meth:`Queue.shutdown ` and :exc:`~asyncio." +"QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " +"and Yves Duprat in :gh:`104228`.)" +msgstr "" + +#: whatsnew/3.13.rst:697 +msgid "" +"Add the :meth:`.Server.close_clients` and :meth:`.Server.abort_clients` " +"methods, which more forcefully close an asyncio server. (Contributed by " +"Pierre Ossman in :gh:`113538`.)" +msgstr "" + +#: whatsnew/3.13.rst:701 +msgid "" +"Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " +"when any one of them is encountered. (Contributed by Bruce Merry in :gh:" +"`81322`.)" +msgstr "" + +#: whatsnew/3.13.rst:705 +msgid "" +"Improve the behavior of :class:`~asyncio.TaskGroup` when an external " +"cancellation collides with an internal cancellation. For example, when two " +"task groups are nested and both experience an exception in a child task " +"simultaneously, it was possible that the outer task group would hang, " +"because its internal cancellation was swallowed by the inner task group." +msgstr "" + +#: whatsnew/3.13.rst:712 +msgid "" +"In the case where a task group is cancelled externally and also must raise " +"an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." +"Task.cancel` method. This ensures that a :exc:`~asyncio.CancelledError` will " +"be raised at the next :keyword:`await`, so the cancellation is not lost." +msgstr "" + +#: whatsnew/3.13.rst:718 +msgid "" +"An added benefit of these changes is that task groups now preserve the " +"cancellation count (:meth:`~asyncio.Task.cancelling`)." +msgstr "" + +#: whatsnew/3.13.rst:721 +msgid "" +"In order to handle some corner cases, :meth:`~asyncio.Task.uncancel` may now " +"reset the undocumented ``_must_cancel`` flag when the cancellation count " +"reaches zero." +msgstr "" + +#: whatsnew/3.13.rst:725 +msgid "(Inspired by an issue reported by Arthur Tacca in :gh:`116720`.)" +msgstr "" + +#: whatsnew/3.13.rst:727 +msgid "" +"When :meth:`.TaskGroup.create_task` is called on an inactive :class:" +"`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" +"exc:`RuntimeWarning` about the given coroutine being never awaited). " +"(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" +msgstr "" + +#: whatsnew/3.13.rst:733 +msgid "" +"The function and methods named ``create_task`` have received a new " +"``**kwargs`` argument that is passed through to the task constructor. This " +"change was accidentally added in 3.13.3, and broke the API contract for " +"custom task factories. Several third-party task factories implemented " +"workarounds for this. In 3.13.4 and later releases the old factory contract " +"is honored once again (until 3.14). To keep the workarounds working, the " +"extra ``**kwargs`` argument still allows passing additional keyword " +"arguments to :class:`~asyncio.Task` and to custom task factories." +msgstr "" + +#: whatsnew/3.13.rst:744 +msgid "" +"This affects the following function and methods: :meth:`asyncio." +"create_task`, :meth:`asyncio.loop.create_task`, :meth:`asyncio.TaskGroup." +"create_task`. (Contributed by Thomas Grainger in :gh:`128307`.)" +msgstr "" + +#: whatsnew/3.13.rst:751 +msgid "base64" +msgstr "" + +#: whatsnew/3.13.rst:753 +msgid "" +"Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " +"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" +"class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" +msgstr "" + +#: whatsnew/3.13.rst:762 +msgid "compileall" +msgstr "" + +#: whatsnew/3.13.rst:772 whatsnew/3.13.rst:1031 +msgid "" +"The default number of worker threads and processes is now selected using :" +"func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " +"Victor Stinner in :gh:`109649`.)" +msgstr "" + +#: whatsnew/3.13.rst:770 +msgid "concurrent.futures" +msgstr "" + +#: whatsnew/3.13.rst:1678 +msgid "configparser" +msgstr "" + +#: whatsnew/3.13.rst:780 +msgid "" +":class:`~configparser.ConfigParser` now has support for unnamed sections, " +"which allows for top-level key-value pairs. This can be enabled with the new " +"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda in :" +"gh:`66449`.)" +msgstr "" + +#: whatsnew/3.13.rst:787 +msgid "copy" +msgstr "" + +#: whatsnew/3.13.rst:789 +msgid "" +"The new :func:`~copy.replace` function and the :meth:`replace protocol " +"` make creating modified copies of objects much simpler. " +"This is especially useful when working with immutable objects. The following " +"types support the :func:`~copy.replace` function and implement the replace " +"protocol:" +msgstr "" + +#: whatsnew/3.13.rst:795 +msgid ":func:`collections.namedtuple`" +msgstr "" + +#: whatsnew/3.13.rst:796 +msgid ":class:`dataclasses.dataclass`" +msgstr "" + +#: whatsnew/3.13.rst:797 +msgid "" +":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" +msgstr "" + +#: whatsnew/3.13.rst:798 +msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" +msgstr "" + +#: whatsnew/3.13.rst:799 +msgid ":class:`types.SimpleNamespace`" +msgstr "" + +#: whatsnew/3.13.rst:800 +msgid ":ref:`code objects `" +msgstr "" + +#: whatsnew/3.13.rst:802 +msgid "" +"Any user-defined class can also support :func:`copy.replace` by defining " +"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" +"gh:`108751`.)" +msgstr "" + +#: whatsnew/3.13.rst:808 +msgid "ctypes" +msgstr "" + +#: whatsnew/3.13.rst:810 +msgid "" +"As a consequence of necessary internal refactoring, initialization of " +"internal metaclasses now happens in ``__init__`` rather than in ``__new__``. " +"This affects projects that subclass these internal metaclasses to provide " +"custom initialization. Generally:" +msgstr "" + +#: whatsnew/3.13.rst:816 +msgid "" +"Custom logic that was done in ``__new__`` after calling ``super().__new__`` " +"should be moved to ``__init__``." +msgstr "" + +#: whatsnew/3.13.rst:818 +msgid "" +"To create a class, call the metaclass, not only the metaclass's ``__new__`` " +"method." +msgstr "" + +#: whatsnew/3.13.rst:821 +msgid "" +"See :gh:`124520` for discussion and links to changes in some affected " +"projects." +msgstr "" + +#: whatsnew/3.13.rst:824 +msgid "" +":class:`ctypes.Structure` objects have a new :attr:`~ctypes.Structure." +"_align_` attribute which allows the alignment of the structure being packed " +"to/from memory to be specified explicitly. (Contributed by Matt Sanderson " +"in :gh:`112433`)" +msgstr "" + +#: whatsnew/3.13.rst:830 +msgid "dbm" +msgstr "" + +#: whatsnew/3.13.rst:832 +msgid "" +"Add :mod:`dbm.sqlite3`, a new module which implements an SQLite backend, and " +"make it the default :mod:`!dbm` backend. (Contributed by Raymond Hettinger " +"and Erlend E. Aasland in :gh:`100414`.)" +msgstr "" + +#: whatsnew/3.13.rst:836 +msgid "" +"Allow removing all items from the database through the new :meth:`!clear` " +"methods of the GDBM and NDBM database objects. (Contributed by Donghee Na " +"in :gh:`107122`.)" +msgstr "" + +#: whatsnew/3.13.rst:842 +msgid "dis" +msgstr "" + +#: whatsnew/3.13.rst:844 +msgid "" +"Change the output of :mod:`dis` module functions to show logical labels for " +"jump targets and exception handlers, rather than offsets. The offsets can be " +"added with the new :option:`-O ` command-line option or " +"the *show_offsets* argument. (Contributed by Irit Katriel in :gh:`112137`.)" +msgstr "" + +#: whatsnew/3.13.rst:851 +msgid "" +":meth:`~dis.get_instructions` no longer represents cache entries as separate " +"instructions. Instead, it returns them as part of the :class:`~dis." +"Instruction`, in the new *cache_info* field. The *show_caches* argument to :" +"meth:`~dis.get_instructions` is deprecated and no longer has any effect. " +"(Contributed by Irit Katriel in :gh:`112962`.)" +msgstr "" + +#: whatsnew/3.13.rst:863 +msgid "doctest" +msgstr "" + +#: whatsnew/3.13.rst:865 +msgid "" +":mod:`doctest` output is now colored by default. This can be controlled via " +"the new :envvar:`PYTHON_COLORS` environment variable as well as the " +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See also :" +"ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade in :gh:" +"`117225`.)" +msgstr "" + +#: whatsnew/3.13.rst:872 +msgid "" +"The :meth:`.DocTestRunner.run` method now counts the number of skipped " +"tests. Add the :attr:`.DocTestRunner.skips` and :attr:`.TestResults.skipped` " +"attributes. (Contributed by Victor Stinner in :gh:`108794`.)" +msgstr "" + +#: whatsnew/3.13.rst:878 +msgid "email" +msgstr "" + +#: whatsnew/3.13.rst:880 +msgid "" +"Headers with embedded newlines are now quoted on output. The :mod:`~email." +"generator` will now refuse to serialize (write) headers that are improperly " +"folded or delimited, such that they would be parsed as multiple headers or " +"joined with adjacent data. If you need to turn this safety feature off, set :" +"attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas " +"Bloemsaat and Petr Viktorin in :gh:`121650`.)" +msgstr "" + +#: whatsnew/3.13.rst:888 +msgid "" +":func:`~email.utils.getaddresses` and :func:`~email.utils.parseaddr` now " +"return ``('', '')`` pairs in more situations where invalid email addresses " +"are encountered instead of potentially inaccurate values. The two functions " +"have a new optional *strict* parameter (default ``True``). To get the old " +"behavior (accepting malformed input), use ``strict=False``. ``getattr(email." +"utils, 'supports_strict_parsing', False)`` can be used to check if the " +"*strict* parameter is available. (Contributed by Thomas Dwyer and Victor " +"Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" +msgstr "" + +#: whatsnew/3.13.rst:900 +msgid "enum" +msgstr "" + +#: whatsnew/3.13.rst:902 +msgid "" +":class:`~enum.EnumDict` has been made public to better support subclassing :" +"class:`~enum.EnumType`." +msgstr "" + +#: whatsnew/3.13.rst:907 +msgid "fractions" +msgstr "" + +#: whatsnew/3.13.rst:909 +msgid "" +":class:`~fractions.Fraction` objects now support the standard :ref:`format " +"specification mini-language ` rules for fill, alignment, sign " +"handling, minimum width, and grouping. (Contributed by Mark Dickinson in :gh:" +"`111320`.)" +msgstr "" + +#: whatsnew/3.13.rst:916 +msgid "glob" +msgstr "" + +#: whatsnew/3.13.rst:918 +msgid "" +"Add :func:`~glob.translate`, a function to convert a path specification with " +"shell-style wildcards to a regular expression. (Contributed by Barney Gale " +"in :gh:`72904`.)" +msgstr "" + +#: whatsnew/3.13.rst:924 +msgid "importlib" +msgstr "" + +#: whatsnew/3.13.rst:926 +msgid "" +"The following functions in :mod:`importlib.resources` now allow accessing a " +"directory (or tree) of resources, using multiple positional arguments (the " +"*encoding* and *errors* arguments in the text-reading functions are now " +"keyword-only):" +msgstr "" + +#: whatsnew/3.13.rst:931 +msgid ":func:`~importlib.resources.is_resource`" +msgstr "" + +#: whatsnew/3.13.rst:932 +msgid ":func:`~importlib.resources.open_binary`" +msgstr "" + +#: whatsnew/3.13.rst:933 +msgid ":func:`~importlib.resources.open_text`" +msgstr "" + +#: whatsnew/3.13.rst:934 +msgid ":func:`~importlib.resources.path`" +msgstr "" + +#: whatsnew/3.13.rst:935 +msgid ":func:`~importlib.resources.read_binary`" +msgstr "" + +#: whatsnew/3.13.rst:936 +msgid ":func:`~importlib.resources.read_text`" +msgstr "" + +#: whatsnew/3.13.rst:938 +msgid "" +"These functions are no longer deprecated and are not scheduled for removal. " +"(Contributed by Petr Viktorin in :gh:`116608`.)" +msgstr "" + +#: whatsnew/3.13.rst:941 +msgid "" +":func:`~importlib.resources.contents` remains deprecated in favor of the " +"fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " +"there is now no plan to remove it. (Contributed by Petr Viktorin in :gh:" +"`116608`.)" +msgstr "" + +#: whatsnew/3.13.rst:948 +msgid "io" +msgstr "" + +#: whatsnew/3.13.rst:950 +msgid "" +"The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" +"`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " +"errors were ignored silently by default, and only logged in :ref:`Python " +"Development Mode ` or when using a :ref:`Python debug build `. (Contributed by Victor Stinner in :gh:`62948`.)" +msgstr "" + +#: whatsnew/3.13.rst:959 +msgid "ipaddress" +msgstr "" + +#: whatsnew/3.13.rst:961 +msgid "" +"Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" +"mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" +msgstr "" + +#: whatsnew/3.13.rst:965 +msgid "" +"Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." +"IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." +"IPv4Network`, and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub " +"Stasiak in :gh:`113171`.)" +msgstr "" + +#: whatsnew/3.13.rst:972 +msgid "itertools" +msgstr "" + +#: whatsnew/3.13.rst:974 +msgid "" +":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" +"`ValueError` if the final batch is shorter than the specified batch size. " +"(Contributed by Raymond Hettinger in :gh:`113202`.)" +msgstr "" + +#: whatsnew/3.13.rst:981 +msgid "marshal" +msgstr "" + +#: whatsnew/3.13.rst:983 +msgid "" +"Add the *allow_code* parameter in module functions. Passing " +"``allow_code=False`` prevents serialization and de-serialization of code " +"objects which are incompatible between Python versions. (Contributed by " +"Serhiy Storchaka in :gh:`113626`.)" +msgstr "" + +#: whatsnew/3.13.rst:990 +msgid "math" +msgstr "" + +#: whatsnew/3.13.rst:992 +msgid "" +"The new function :func:`~math.fma` performs fused multiply-add operations. " +"This computes ``x * y + z`` with only a single round, and so avoids any " +"intermediate loss of precision. It wraps the ``fma()`` function provided by " +"C99, and follows the specification of the IEEE 754 \"fusedMultiplyAdd\" " +"operation for special cases. (Contributed by Mark Dickinson and Victor " +"Stinner in :gh:`73468`.)" +msgstr "" + +#: whatsnew/3.13.rst:1002 +msgid "mimetypes" +msgstr "" + +#: whatsnew/3.13.rst:1004 +msgid "" +"Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " +"from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " +"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka in :gh:" +"`66543`.)" +msgstr "" + +#: whatsnew/3.13.rst:1011 +msgid "mmap" +msgstr "" + +#: whatsnew/3.13.rst:1013 +msgid "" +":class:`~mmap.mmap` is now protected from crashing on Windows when the " +"mapped memory is inaccessible due to file system errors or access " +"violations. (Contributed by Jannis Weigend in :gh:`118209`.)" +msgstr "" + +#: whatsnew/3.13.rst:1017 +msgid "" +":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " +"used when a seekable file-like object is required. The :meth:`~mmap.mmap." +"seek` method now returns the new absolute position. (Contributed by Donghee " +"Na and Sylvie Liberman in :gh:`111835`.)" +msgstr "" + +#: whatsnew/3.13.rst:1022 +msgid "" +"The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " +"descriptor duplication; if false, the file descriptor specified by *fileno* " +"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin in :" +"gh:`78502`.)" +msgstr "" + +#: whatsnew/3.13.rst:1029 +msgid "multiprocessing" +msgstr "" + +#: whatsnew/3.13.rst:1037 +msgid "os" +msgstr "" + +#: whatsnew/3.13.rst:1039 +msgid "" +"Add :func:`~os.process_cpu_count` function to get the number of logical CPU " +"cores usable by the calling thread of the current process. (Contributed by " +"Victor Stinner in :gh:`109649`.)" +msgstr "" + +#: whatsnew/3.13.rst:1043 +msgid "" +":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " +"through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " +"command-line option :option:`-X cpu_count <-X>`. This option is useful for " +"users who need to limit CPU resources of a container system without having " +"to modify application code or the container itself. (Contributed by Donghee " +"Na in :gh:`109595`.)" +msgstr "" + +#: whatsnew/3.13.rst:1051 +msgid "" +"Add a :ref:`low level interface ` to Linux's :manpage:`timer " +"file descriptors ` via :func:`~os.timerfd_create`, :func:" +"`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os." +"timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os." +"TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " +"and :const:`~os.TFD_TIMER_CANCEL_ON_SET` (Contributed by Masaru Tsuchiyama " +"in :gh:`108277`.)" +msgstr "" + +#: whatsnew/3.13.rst:1060 +msgid "" +":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " +"are both now available on Windows. Note that the default value of " +"*follow_symlinks* in :func:`!lchmod` is ``False`` on Windows. (Contributed " +"by Serhiy Storchaka in :gh:`59616`.)" +msgstr "" + +#: whatsnew/3.13.rst:1066 +msgid "" +":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " +"both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" +"`113191`.)" +msgstr "" + +#: whatsnew/3.13.rst:1070 +msgid "" +"On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " +"*mode* value of ``0o700`` to apply access control to the new directory. This " +"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation for :cve:" +"`2024-4030`. Other values for *mode* continue to be ignored. (Contributed by " +"Steve Dower in :gh:`118486`.)" +msgstr "" + +#: whatsnew/3.13.rst:1077 +msgid "" +":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " +"makes the newly spawned process use the current process environment. " +"(Contributed by Jakub Kulik in :gh:`113119`.)" +msgstr "" + +#: whatsnew/3.13.rst:1081 +msgid "" +":func:`~os.posix_spawn` can now use the :const:`~os.POSIX_SPAWN_CLOSEFROM` " +"attribute in the *file_actions* parameter on platforms that support :c:func:" +"`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by Jakub Kulik in :" +"gh:`113117`.)" +msgstr "" + +#: whatsnew/3.13.rst:1088 +msgid "os.path" +msgstr "" + +#: whatsnew/3.13.rst:1090 +msgid "" +"Add :func:`~os.path.isreserved` to check if a path is reserved on the " +"current system. This function is only available on Windows. (Contributed by " +"Barney Gale in :gh:`88569`.)" +msgstr "" + +#: whatsnew/3.13.rst:1095 +msgid "" +"On Windows, :func:`~os.path.isabs` no longer considers paths starting with " +"exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " +"Gale and Jon Foster in :gh:`44626`.)" +msgstr "" + +#: whatsnew/3.13.rst:1099 +msgid "" +":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " +"file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" +msgstr "" + +#: whatsnew/3.13.rst:1734 +msgid "pathlib" +msgstr "" + +#: whatsnew/3.13.rst:1107 +msgid "" +"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" +"`NotImplementedError` when a path operation isn't supported. (Contributed by " +"Barney Gale in :gh:`89812`.)" +msgstr "" + +#: whatsnew/3.13.rst:1111 +msgid "" +"Add a new constructor for creating :class:`~pathlib.Path` objects from " +"'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " +"Gale in :gh:`107465`.)" +msgstr "" + +#: whatsnew/3.13.rst:1115 +msgid "" +"Add :meth:`.PurePath.full_match` for matching paths with shell-style " +"wildcards, including the recursive wildcard \"``**``\". (Contributed by " +"Barney Gale in :gh:`73435`.)" +msgstr "" + +#: whatsnew/3.13.rst:1119 +msgid "" +"Add the :attr:`.PurePath.parser` class attribute to store the implementation " +"of :mod:`os.path` used for low-level path parsing and joining. This will be " +"either :mod:`!posixpath` or :mod:`!ntpath`." +msgstr "" + +#: whatsnew/3.13.rst:1124 +msgid "" +"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" +"`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" +msgstr "" + +#: whatsnew/3.13.rst:1128 +msgid "" +":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " +"directories when given a pattern that ends with \"``**``\". Previously, only " +"directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" +msgstr "" + +#: whatsnew/3.13.rst:1133 +msgid "" +"Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " +"`, :meth:`Path.is_dir `, :meth:`." +"Path.owner`, and :meth:`.Path.group`. (Contributed by Barney Gale in :gh:" +"`105793` and Kamil Turek in :gh:`107962`.)" +msgstr "" + +#: whatsnew/3.13.rst:1141 +msgid "pdb" +msgstr "" + +#: whatsnew/3.13.rst:1143 +msgid "" +":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " +"immediately rather than on the next line of code to be executed. This change " +"prevents the debugger from breaking outside of the context when :func:`!" +"breakpoint` is positioned at the end of the context. (Contributed by Tian " +"Gao in :gh:`118579`.)" +msgstr "" + +#: whatsnew/3.13.rst:1149 +msgid "" +"``sys.path[0]`` is no longer replaced by the directory of the script being " +"debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " +"and Christian Walther in :gh:`111762`.)" +msgstr "" + +#: whatsnew/3.13.rst:1153 +msgid "" +":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " +"Gao in :gh:`118501`.)" +msgstr "" + +#: whatsnew/3.13.rst:1156 +msgid "" +"Add ability to move between chained exceptions during post-mortem debugging " +"in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " +"` command for Pdb. (Contributed by Matthias Bussonnier in :gh:" +"`106676`.)" +msgstr "" + +#: whatsnew/3.13.rst:1161 +msgid "" +"Expressions and statements whose prefix is a pdb command are now correctly " +"identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" +msgstr "" + +#: whatsnew/3.13.rst:1167 +msgid "queue" +msgstr "" + +#: whatsnew/3.13.rst:1169 +msgid "" +"Add :meth:`Queue.shutdown ` and :exc:`~queue.ShutDown` " +"to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " +"in :gh:`104750`.)" +msgstr "" + +#: whatsnew/3.13.rst:1175 +msgid "random" +msgstr "" + +#: whatsnew/3.13.rst:1177 +msgid "" +"Add a :ref:`command-line interface `. (Contributed by Hugo van " +"Kemenade in :gh:`118131`.)" +msgstr "" + +#: whatsnew/3.13.rst:1742 +msgid "re" +msgstr "" + +#: whatsnew/3.13.rst:1184 +msgid "" +"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" +"exc:`!re.error` is kept for backward compatibility." +msgstr "" + +#: whatsnew/3.13.rst:1189 +msgid "shutil" +msgstr "" + +#: whatsnew/3.13.rst:1191 +msgid "" +"Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" +"`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" +msgstr "" + +#: whatsnew/3.13.rst:1197 +msgid "site" +msgstr "" + +#: whatsnew/3.13.rst:1199 +msgid "" +":file:`.pth` files are now decoded using UTF-8 first, and then with the :" +"term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " +"in :gh:`117802`.)" +msgstr "" + +#: whatsnew/3.13.rst:1205 +msgid "sqlite3" +msgstr "" + +#: whatsnew/3.13.rst:1207 +msgid "" +"A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " +"object is not :meth:`closed ` explicitly. " +"(Contributed by Erlend E. Aasland in :gh:`105539`.)" +msgstr "" + +#: whatsnew/3.13.rst:1211 +msgid "" +"Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " +"filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" +"`91602`.)" +msgstr "" + +#: whatsnew/3.13.rst:1217 +msgid "ssl" +msgstr "" + +#: whatsnew/3.13.rst:1219 +msgid "" +"The :func:`~ssl.create_default_context` API now includes :data:`~ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " +"default flags." +msgstr "" + +#: whatsnew/3.13.rst:1225 +msgid "" +":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " +"certificates that the underlying OpenSSL implementation might otherwise " +"accept. Whilst disabling this is not recommended, you can do so using:" +msgstr "" + +#: whatsnew/3.13.rst:1230 +msgid "" +"import ssl\n" +"\n" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" +msgstr "" + +#: whatsnew/3.13.rst:1237 +msgid "(Contributed by William Woodruff in :gh:`112389`.)" +msgstr "" + +#: whatsnew/3.13.rst:1241 +msgid "statistics" +msgstr "" + +#: whatsnew/3.13.rst:1243 +msgid "" +"Add :func:`~statistics.kde` for kernel density estimation. This makes it " +"possible to estimate a continuous probability density function from a fixed " +"number of discrete samples. (Contributed by Raymond Hettinger in :gh:" +"`115863`.)" +msgstr "" + +#: whatsnew/3.13.rst:1248 +msgid "" +"Add :func:`~statistics.kde_random` for sampling from an estimated " +"probability density function created by :func:`~statistics.kde`. " +"(Contributed by Raymond Hettinger in :gh:`115863`.)" +msgstr "" + +#: whatsnew/3.13.rst:1256 +msgid "subprocess" +msgstr "" + +#: whatsnew/3.13.rst:1258 +msgid "" +"The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " +"in more situations." +msgstr "" + +#: whatsnew/3.13.rst:1261 +msgid "" +"Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " +"will be used when the C library provides :c:func:`!" +"posix_spawn_file_actions_addclosefrom_np`, which includes recent versions of " +"Linux, FreeBSD, and Solaris. On Linux, this should perform similarly to the " +"existing Linux :c:func:`!vfork` based code." +msgstr "" + +#: whatsnew/3.13.rst:1268 +msgid "" +"A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " +"``False`` if you need to force :mod:`subprocess` to never use :func:`~os." +"posix_spawn`. Please report your reason and platform details in the :ref:" +"`issue tracker ` if you set this so that we can improve " +"our API selection logic for everyone. (Contributed by Jakub Kulik in :gh:" +"`113117`.)" +msgstr "" + +#: whatsnew/3.13.rst:1278 +msgid "sys" +msgstr "" + +#: whatsnew/3.13.rst:1280 +msgid "" +"Add the :func:`~sys._is_interned` function to test if a string was interned. " +"This function is not guaranteed to exist in all implementations of Python. " +"(Contributed by Serhiy Storchaka in :gh:`78573`.)" +msgstr "" + +#: whatsnew/3.13.rst:1286 +msgid "tempfile" +msgstr "" + +#: whatsnew/3.13.rst:1288 +msgid "" +"On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " +"limits access to the new directory due to changes to :func:`os.mkdir`. This " +"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower in :gh:" +"`118486`.)" +msgstr "" + +#: whatsnew/3.13.rst:1295 +msgid "time" +msgstr "" + +#: whatsnew/3.13.rst:1297 +msgid "" +"On Windows, :func:`~time.monotonic` now uses the " +"``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " +"instead of the ``GetTickCount64()`` clock which has a resolution of 15.6 " +"milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" +msgstr "" + +#: whatsnew/3.13.rst:1303 +msgid "" +"On Windows, :func:`~time.time` now uses the " +"``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " +"microsecond, instead of the ``GetSystemTimeAsFileTime()`` clock which has a " +"resolution of 15.6 milliseconds. (Contributed by Victor Stinner in :gh:" +"`63207`.)" +msgstr "" + +#: whatsnew/3.13.rst:1311 +msgid "tkinter" +msgstr "" + +#: whatsnew/3.13.rst:1313 +msgid "" +"Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" +"tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" +"tk_busy_current`, and :meth:`!tk_busy_status`. (Contributed by Miguel, " +"klappnase and Serhiy Storchaka in :gh:`72684`.)" +msgstr "" + +#: whatsnew/3.13.rst:1319 +msgid "" +"The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " +"attribute name without the minus prefix to get window attributes, for " +"example ``w.wm_attributes('alpha')`` and allows specifying attributes and " +"values to set as keyword arguments, for example ``w." +"wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" +msgstr "" + +#: whatsnew/3.13.rst:1326 +msgid "" +":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " +"using the new optional keyword-only parameter *return_python_dict*. " +"(Contributed by Serhiy Storchaka in :gh:`43457`.)" +msgstr "" + +#: whatsnew/3.13.rst:1330 +msgid "" +":meth:`!Text.count` can now return a simple :class:`int` when the new " +"optional keyword-only parameter *return_ints* is used. Otherwise, the single " +"count is returned as a 1-tuple or ``None``. (Contributed by Serhiy Storchaka " +"in :gh:`97928`.)" +msgstr "" + +#: whatsnew/3.13.rst:1335 +msgid "" +"Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." +"element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " +"Storchaka in :gh:`68166`.)" +msgstr "" + +#: whatsnew/3.13.rst:1340 +msgid "" +"Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " +"Cheryl Sabella in :gh:`77020`.)" +msgstr "" + +#: whatsnew/3.13.rst:1343 +msgid "" +"Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " +"region from one image to another, possibly with pixel zooming, subsampling, " +"or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" +msgstr "" + +#: whatsnew/3.13.rst:1348 +msgid "" +"Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" +"copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " +"parameters to the :class:`!PhotoImage` method :meth:`!copy`. (Contributed by " +"Serhiy Storchaka in :gh:`118225`.)" +msgstr "" + +#: whatsnew/3.13.rst:1354 +msgid "" +"Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " +"file and :meth:`!data` to get the image data. Add *background* and " +"*grayscale* parameters to the :meth:`!write` method. (Contributed by Serhiy " +"Storchaka in :gh:`118271`.)" +msgstr "" + +#: whatsnew/3.13.rst:1362 +msgid "traceback" +msgstr "" + +#: whatsnew/3.13.rst:1364 +msgid "" +"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" +"class:`~traceback.TracebackException`, which holds a string display of the " +"*exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " +"attribute, which holds the type object itself. Add parameter *save_exc_type* " +"(default ``True``) to indicate whether ``exc_type`` should be saved. " +"(Contributed by Irit Katriel in :gh:`112332`.)" +msgstr "" + +#: whatsnew/3.13.rst:1373 +msgid "" +"Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." +"format_exception_only` to (recursively) format the nested exceptions of a :" +"exc:`BaseExceptionGroup` instance. (Contributed by Irit Katriel in :gh:" +"`105292`.)" +msgstr "" + +#: whatsnew/3.13.rst:1380 +msgid "types" +msgstr "" + +#: whatsnew/3.13.rst:1382 +msgid "" +":class:`~types.SimpleNamespace` can now take a single positional argument to " +"initialise the namespace's arguments. This argument must either be a mapping " +"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka in :gh:" +"`108191`.)" +msgstr "" + +#: whatsnew/3.13.rst:1767 +msgid "typing" +msgstr "" + +#: whatsnew/3.13.rst:1391 +msgid "" +":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " +"a :class:`~typing.TypedDict` item as read-only for type checkers." +msgstr "" + +#: whatsnew/3.13.rst:1394 +msgid "" +":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " +"to instruct a type checker how to narrow a type." +msgstr "" + +#: whatsnew/3.13.rst:1397 +msgid "" +"Add :data:`~typing.NoDefault`, a sentinel object used to represent the " +"defaults of some parameters in the :mod:`typing` module. (Contributed by " +"Jelle Zijlstra in :gh:`116126`.)" +msgstr "" + +#: whatsnew/3.13.rst:1401 +msgid "" +"Add :func:`~typing.get_protocol_members` to return the set of members " +"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" +"`104873`.)" +msgstr "" + +#: whatsnew/3.13.rst:1405 +msgid "" +"Add :func:`~typing.is_protocol` to check whether a class is a :class:" +"`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" +msgstr "" + +#: whatsnew/3.13.rst:1409 +msgid "" +":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " +"vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" +msgstr "" + +#: whatsnew/3.13.rst:1415 +msgid "unicodedata" +msgstr "" + +#: whatsnew/3.13.rst:1417 +msgid "" +"Update the Unicode database to `version 15.1.0`__. (Contributed by James " +"Gerity in :gh:`109559`.)" +msgstr "" + +#: whatsnew/3.13.rst:1424 +msgid "venv" +msgstr "" + +#: whatsnew/3.13.rst:1426 +msgid "" +"Add support for creating source control management (SCM) ignore files in a " +"virtual environment's directory. By default, Git is supported. This is " +"implemented as opt-in via the API, which can be extended to support other " +"SCMs (:class:`~venv.EnvBuilder` and :func:`~venv.create`), and opt-out via " +"the CLI, using :option:`!--without-scm-ignore-files`. (Contributed by Brett " +"Cannon in :gh:`108125`.)" +msgstr "" + +#: whatsnew/3.13.rst:1437 +msgid "warnings" +msgstr "" + +#: whatsnew/3.13.rst:1439 +msgid "" +":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " +"communicate deprecations to a :term:`static type checker` and to warn on " +"usage of deprecated classes and functions. A :exc:`DeprecationWarning` may " +"also be emitted when a decorated function or class is used at runtime. " +"(Contributed by Jelle Zijlstra in :gh:`104003`.)" +msgstr "" + +#: whatsnew/3.13.rst:1448 +msgid "xml" +msgstr "" + +#: whatsnew/3.13.rst:1450 +msgid "" +"Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " +"adding five new methods:" +msgstr "" + +#: whatsnew/3.13.rst:1453 +msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" +msgstr "" + +#: whatsnew/3.13.rst:1454 +msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" +msgstr "" + +#: whatsnew/3.13.rst:1455 +msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" +msgstr "" + +#: whatsnew/3.13.rst:1456 +msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" +msgstr "" + +#: whatsnew/3.13.rst:1457 +msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" +msgstr "" + +#: whatsnew/3.13.rst:1459 +msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" +msgstr "" + +#: whatsnew/3.13.rst:1461 +msgid "" +"Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." +"ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " +"Storchaka in :gh:`69893`.)" +msgstr "" + +#: whatsnew/3.13.rst:1467 +msgid "zipimport" +msgstr "" + +#: whatsnew/3.13.rst:1469 +msgid "" +"Add support for ZIP64_ format files. Everybody loves huge data, right? " +"(Contributed by Tim Hatch in :gh:`94146`.)" +msgstr "" + +#: whatsnew/3.13.rst:1477 +msgid "Optimizations" +msgstr "" + +#: whatsnew/3.13.rst:1479 +msgid "" +"Several standard library modules have had their import times significantly " +"improved. For example, the import time of the :mod:`typing` module has been " +"reduced by around a third by removing dependencies on :mod:`re` and :mod:" +"`contextlib`. Other modules to enjoy import-time speedups include :mod:" +"`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " +"and :mod:`threading`. (Contributed by Alex Waygood, Shantanu Jain, Adam " +"Turner, Daniel Hollas, and others in :gh:`109653`.)" +msgstr "" + +#: whatsnew/3.13.rst:1490 +msgid "" +":func:`textwrap.indent` is now around 30% faster than before for large " +"input. (Contributed by Inada Naoki in :gh:`107369`.)" +msgstr "" + +#: whatsnew/3.13.rst:1493 +msgid "" +"The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " +"in more situations, including when *close_fds* is ``True`` (the default) on " +"many modern platforms. This should provide a notable performance increase " +"when launching processes on FreeBSD and Solaris. See the :ref:`subprocess " +"` section above for details. (Contributed by Jakub " +"Kulik in :gh:`113117`.)" +msgstr "" + +#: whatsnew/3.13.rst:1503 +msgid "Removed Modules And APIs" +msgstr "" + +#: whatsnew/3.13.rst:1509 +msgid "PEP 594: Remove \"dead batteries\" from the standard library" +msgstr "" + +#: whatsnew/3.13.rst:1511 +msgid "" +":pep:`594` proposed removing 19 modules from the standard library, " +"colloquially referred to as 'dead batteries' due to their historic, " +"obsolete, or insecure status. All of the following modules were deprecated " +"in Python 3.11, and are now removed:" +msgstr "" + +#: whatsnew/3.13.rst:1517 +msgid ":mod:`!aifc`" +msgstr "" + +#: whatsnew/3.13.rst:1519 +msgid "" +":pypi:`standard-aifc`: Use the redistribution of ``aifc`` library from PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1522 +msgid ":mod:`!audioop`" +msgstr "" + +#: whatsnew/3.13.rst:1524 +msgid ":pypi:`audioop-lts`: Use ``audioop-lts`` library from PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1527 +msgid ":mod:`!chunk`" +msgstr "" + +#: whatsnew/3.13.rst:1529 +msgid "" +":pypi:`standard-chunk`: Use the redistribution of ``chunk`` library from " +"PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1532 +msgid ":mod:`!cgi` and :mod:`!cgitb`" +msgstr "" + +#: whatsnew/3.13.rst:1534 +msgid "" +":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." +"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." +"message` module or the :pypi:`multipart` library for ``POST`` and ``PUT`` " +"requests." +msgstr "" + +#: whatsnew/3.13.rst:1539 +msgid "" +":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " +"directly on the desired query string, unless the input is ``multipart/form-" +"data``, which should be replaced as described below for :func:`!cgi." +"parse_multipart`." +msgstr "" + +#: whatsnew/3.13.rst:1544 +msgid "" +":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" +"`email` package, which implements the same MIME RFCs. For example, with :" +"class:`email.message.EmailMessage`:" +msgstr "" + +#: whatsnew/3.13.rst:1548 +msgid "" +"from email.message import EmailMessage\n" +"\n" +"msg = EmailMessage()\n" +"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" +"main, params = msg.get_content_type(), msg['content-type'].params" +msgstr "" + +#: whatsnew/3.13.rst:1556 +msgid "" +":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" +"mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" +"`multipart` library. For example, the :class:`email.message.EmailMessage` " +"and :class:`email.message.Message` classes." +msgstr "" + +#: whatsnew/3.13.rst:1562 +msgid "" +":pypi:`standard-cgi`: and :pypi:`standard-cgitb`: Use the redistribution of " +"``cgi`` and ``cgitb`` library from PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1565 +msgid "" +":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " +"module may be an appropriate replacement when simply hashing a value is " +"required. Otherwise, various third-party libraries on PyPI are available:" +msgstr "" + +#: whatsnew/3.13.rst:1570 +msgid "" +":pypi:`bcrypt`: Modern password hashing for your software and your servers." +msgstr "" + +#: whatsnew/3.13.rst:1572 +msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." +msgstr "" + +#: whatsnew/3.13.rst:1574 +msgid "" +":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " +"and associated functionality." +msgstr "" + +#: whatsnew/3.13.rst:1577 +msgid "" +":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" +"`crypt_r(3)` library call and associated functionality." +msgstr "" + +#: whatsnew/3.13.rst:1581 +msgid "" +":pypi:`standard-crypt` and :pypi:`deprecated-crypt-alternative`: Use the " +"redistribution of ``crypt`` and reimplementation of ``_crypt`` libraries " +"from PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1584 +msgid "" +":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" +"magic` libraries should be used as replacements. For example, the :func:`!" +"puremagic.what` function can be used to replace the :func:`!imghdr.what` " +"function for all file formats that were supported by :mod:`!imghdr`." +msgstr "" + +#: whatsnew/3.13.rst:1591 +msgid "" +":pypi:`standard-imghdr`: Use the redistribution of ``imghdr`` library from " +"PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1594 +msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." +msgstr "" + +#: whatsnew/3.13.rst:1597 +msgid "" +":pypi:`standard-mailcap`: Use the redistribution of ``mailcap`` library from " +"PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1600 +msgid ":mod:`!msilib`" +msgstr "" + +#: whatsnew/3.13.rst:1601 +msgid ":mod:`!nis`" +msgstr "" + +#: whatsnew/3.13.rst:1602 +msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." +msgstr "" + +#: whatsnew/3.13.rst:1605 +msgid "" +":pypi:`standard-nntplib`: Use the redistribution of ``nntplib`` library from " +"PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1608 +msgid "" +":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " +"PyPI instead." +msgstr "" + +#: whatsnew/3.13.rst:1610 +msgid "" +":mod:`!pipes`: Use the :mod:`subprocess` module instead. Use :func:`shlex." +"quote` to replace the undocumented ``pipes.quote`` function." +msgstr "" + +#: whatsnew/3.13.rst:1615 +msgid "" +":pypi:`standard-pipes`: Use the redistribution of ``pipes`` library from " +"PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1618 +msgid "" +":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" +"magic` libraries should be used as replacements." +msgstr "" + +#: whatsnew/3.13.rst:1622 +msgid "" +":pypi:`standard-sndhdr`: Use the redistribution of ``sndhdr`` library from " +"PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1625 +msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." +msgstr "" + +#: whatsnew/3.13.rst:1627 +msgid ":mod:`!sunau`" +msgstr "" + +#: whatsnew/3.13.rst:1629 +msgid "" +":pypi:`standard-sunau`: Use the redistribution of ``sunau`` library from " +"PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1632 +msgid "" +":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " +"from PyPI instead." +msgstr "" + +#: whatsnew/3.13.rst:1635 +msgid "" +":pypi:`standard-telnetlib`: Use the redistribution of ``telnetlib`` library " +"from PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1638 +msgid "" +":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." +msgstr "" + +#: whatsnew/3.13.rst:1641 +msgid "" +":pypi:`standard-uu`: Use the redistribution of ``uu`` library from PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1644 +msgid ":mod:`!xdrlib`" +msgstr "" + +#: whatsnew/3.13.rst:1646 +msgid "" +":pypi:`standard-xdrlib`: Use the redistribution of ``xdrlib`` library from " +"PyPI." +msgstr "" + +#: whatsnew/3.13.rst:1649 +msgid "" +"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" +"`104780`.)" +msgstr "" + +#: whatsnew/3.13.rst:1653 +msgid "2to3" +msgstr "" + +#: whatsnew/3.13.rst:1655 +msgid "" +"Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " +"previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" +"`104780`.)" +msgstr "" + +#: whatsnew/3.13.rst:1661 +msgid "builtins" +msgstr "" + +#: whatsnew/3.13.rst:1663 +msgid "" +"Remove support for chained :class:`classmethod` descriptors (introduced in :" +"gh:`63272`). These can no longer be used to wrap other descriptors, such as :" +"class:`property`. The core design of this feature was flawed and led to " +"several problems. To \"pass-through\" a :class:`classmethod`, consider using " +"the :attr:`!__wrapped__` attribute that was added in Python 3.10. " +"(Contributed by Raymond Hettinger in :gh:`89519`.)" +msgstr "" + +#: whatsnew/3.13.rst:1672 +msgid "" +"Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " +"frame (as has always been the case for an executing frame). (Contributed by " +"Irit Katriel in :gh:`79932`.)" +msgstr "" + +#: whatsnew/3.13.rst:1680 +msgid "" +"Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " +"the docstring since Python 3.2, and at runtime since Python 3.11. " +"(Contributed by Hugo van Kemenade in :gh:`104886`.)" +msgstr "" + +#: whatsnew/3.13.rst:1687 +msgid "importlib.metadata" +msgstr "" + +#: whatsnew/3.13.rst:1689 +msgid "" +"Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" +"`EntryPoint ` objects. (Contributed by Jason R. Coombs in :gh:" +"`113175`.)" +msgstr "" + +#: whatsnew/3.13.rst:1695 +msgid "locale" +msgstr "" + +#: whatsnew/3.13.rst:1697 +msgid "" +"Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " +"Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " +"Victor Stinner in :gh:`104783`.)" +msgstr "" + +#: whatsnew/3.13.rst:1703 +msgid "opcode" +msgstr "" + +#: whatsnew/3.13.rst:1705 +msgid "" +"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." +"ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " +"documented, and is not intended for external use. (Contributed by Irit " +"Katriel in :gh:`105481`.)" +msgstr "" + +#: whatsnew/3.13.rst:1710 +msgid "" +"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" +"attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " +"neither documented nor exposed through :mod:`dis`, and were not intended to " +"be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" +msgstr "" + +#: whatsnew/3.13.rst:1718 +msgid "optparse" +msgstr "" + +#: whatsnew/3.13.rst:1720 +msgid "" +"This module is no longer considered :term:`soft deprecated`. While :mod:" +"`argparse` remains preferred for new projects that aren't using a third " +"party command line argument processing library, there are aspects of the way " +"``argparse`` works that mean the lower level ``optparse`` module may provide " +"a better foundation for *writing* argument processing libraries, and for " +"implementing command line applications which adhere more strictly than " +"``argparse`` does to various Unix command line processing conventions that " +"originate in the behaviour of the C :c:func:`!getopt` function . " +"(Contributed by Alyssa Coghlan and Serhiy Storchaka in :gh:`126180`.)" +msgstr "" + +#: whatsnew/3.13.rst:1736 +msgid "" +"Remove the ability to use :class:`~pathlib.Path` objects as context " +"managers. This functionality was deprecated and has had no effect since " +"Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" +msgstr "" + +#: whatsnew/3.13.rst:1744 +msgid "" +"Remove the undocumented, deprecated, and broken :func:`!re.template` " +"function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " +"Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" +msgstr "" + +#: whatsnew/3.13.rst:1750 +msgid "tkinter.tix" +msgstr "" + +#: whatsnew/3.13.rst:1752 +msgid "" +"Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" +"party Tix library which the module wrapped is unmaintained. (Contributed by " +"Zachary Ware in :gh:`75552`.)" +msgstr "" + +#: whatsnew/3.13.rst:1758 +msgid "turtle" +msgstr "" + +#: whatsnew/3.13.rst:1760 +msgid "" +"Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " +"documentation since Python 3.1 and at runtime since Python 3.11. " +"(Contributed by Hugo van Kemenade in :gh:`104876`.)" +msgstr "" + +#: whatsnew/3.13.rst:1769 +msgid "" +"Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " +"since Python 3.8. The items in those namespaces can be imported directly " +"from the :mod:`typing` module. (Contributed by Sebastian Rittau in :gh:" +"`92871`.)" +msgstr "" + +#: whatsnew/3.13.rst:1775 +msgid "" +"Remove the keyword-argument method of creating :class:`~typing.TypedDict` " +"types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" +"`104786`.)" +msgstr "" + +#: whatsnew/3.13.rst:1781 +msgid "unittest" +msgstr "" + +#: whatsnew/3.13.rst:1783 +msgid "" +"Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" +msgstr "" + +#: whatsnew/3.13.rst:1785 +msgid ":func:`!unittest.findTestCases`" +msgstr "" + +#: whatsnew/3.13.rst:1786 +msgid ":func:`!unittest.makeSuite`" +msgstr "" + +#: whatsnew/3.13.rst:1787 +msgid ":func:`!unittest.getTestCaseNames`" +msgstr "" + +#: whatsnew/3.13.rst:1789 +msgid "Use :class:`~unittest.TestLoader` methods instead:" +msgstr "" + +#: whatsnew/3.13.rst:1791 +msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" +msgstr "" + +#: whatsnew/3.13.rst:1792 +msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" +msgstr "" + +#: whatsnew/3.13.rst:1793 +msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" +msgstr "" + +#: whatsnew/3.13.rst:1795 +msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" +msgstr "" + +#: whatsnew/3.13.rst:1797 +msgid "" +"Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " +"deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" +"`104992`.)" +msgstr "" + +#: whatsnew/3.13.rst:1803 +msgid "urllib" +msgstr "" + +#: whatsnew/3.13.rst:1805 +msgid "" +"Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" +"`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " +"*context* parameter instead with an :class:`~ssl.SSLContext` instance. The :" +"meth:`ssl.SSLContext.load_cert_chain` function can be used to load specific " +"certificates, or let :func:`ssl.create_default_context` select the operating " +"system's trusted certificate authority (CA) certificates. (Contributed by " +"Victor Stinner in :gh:`105382`.)" +msgstr "" + +#: whatsnew/3.13.rst:1816 +msgid "webbrowser" +msgstr "" + +#: whatsnew/3.13.rst:1818 +msgid "" +"Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " +"Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " +"3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" +msgstr "" + +#: whatsnew/3.13.rst:1823 +msgid "" +"Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" +"attr:`MacOSXOSAScript.name ` attribute instead. " +"(Contributed by Nikita Sobolev in :gh:`105546`.)" +msgstr "" + +#: whatsnew/3.13.rst:1830 +msgid "New Deprecations" +msgstr "" + +#: whatsnew/3.13.rst:1832 +msgid ":ref:`User-defined functions `:" +msgstr "" + +#: whatsnew/3.13.rst:1834 +msgid "" +"Deprecate assignment to a function's :attr:`~function.__code__` attribute, " +"where the new code object's type does not match the function's type. The " +"different types are: plain function, generator, async generator, and " +"coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" +msgstr "" + +#: whatsnew/3.13.rst:1840 deprecations/pending-removal-in-3.16.rst:11 +msgid ":mod:`array`:" +msgstr "" + +#: whatsnew/3.13.rst:1842 +msgid "" +"Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " +"format code has been deprecated in documentation since Python 3.3, and will " +"be removed in Python 3.16. Use the ``'w'`` format code (:c:type:`Py_UCS4`) " +"for Unicode characters instead. (Contributed by Hugo van Kemenade in :gh:" +"`80480`.)" +msgstr "" + +#: whatsnew/3.13.rst:1849 deprecations/pending-removal-in-3.15.rst:16 +msgid ":mod:`ctypes`:" +msgstr "" + +#: whatsnew/3.13.rst:1851 +msgid "" +"Deprecate the undocumented :func:`!SetPointerType` function, to be removed " +"in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" +msgstr "" + +#: whatsnew/3.13.rst:1855 +msgid "" +":term:`Soft-deprecate ` the :func:`~ctypes.ARRAY` function " +"in favour of ``type * length`` multiplication. (Contributed by Victor " +"Stinner in :gh:`105733`.)" +msgstr "" + +#: whatsnew/3.13.rst:1859 +msgid ":mod:`decimal`:" +msgstr "" + +#: whatsnew/3.13.rst:1861 +msgid "" +"Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " +"specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " +"implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" +msgstr "" + +#: whatsnew/3.13.rst:1866 +msgid ":mod:`dis`:" +msgstr "" + +#: whatsnew/3.13.rst:1868 +msgid "" +"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" +"`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" +msgstr "" + +#: whatsnew/3.13.rst:1872 +msgid ":mod:`gettext`:" +msgstr "" + +#: whatsnew/3.13.rst:1874 +msgid "" +"Deprecate non-integer numbers as arguments to functions and methods that " +"consider plural forms in the :mod:`!gettext` module, even if no translation " +"was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" +msgstr "" + +#: whatsnew/3.13.rst:1879 +msgid ":mod:`glob`:" +msgstr "" + +#: whatsnew/3.13.rst:1881 +msgid "" +"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" +"func:`~glob.glob` and pass a :term:`path-like object` specifying the root " +"directory to the *root_dir* parameter instead. (Contributed by Barney Gale " +"in :gh:`117337`.)" +msgstr "" + +#: whatsnew/3.13.rst:1886 deprecations/pending-removal-in-3.15.rst:21 +msgid ":mod:`http.server`:" +msgstr "" + +#: whatsnew/3.13.rst:1888 +msgid "" +"Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " +"Python 3.15. Process-based CGI HTTP servers have been out of favor for a " +"very long time. This code was outdated, unmaintained, and rarely used. It " +"has a high potential for both security and functionality bugs. (Contributed " +"by Gregory P. Smith in :gh:`109096`.)" +msgstr "" + +#: whatsnew/3.13.rst:1895 +msgid "" +"Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " +"command-line interface, to be removed in Python 3.15. (Contributed by " +"Gregory P. Smith in :gh:`109096`.)" +msgstr "" + +#: whatsnew/3.13.rst:1900 deprecations/pending-removal-in-3.16.rst:70 +msgid ":mod:`mimetypes`:" +msgstr "" + +#: whatsnew/3.13.rst:1902 +msgid "" +":term:`Soft-deprecate ` file path arguments to :func:" +"`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " +"(Contributed by Serhiy Storchaka in :gh:`66543`.)" +msgstr "" + +#: whatsnew/3.13.rst:1907 +msgid ":mod:`re`:" +msgstr "" + +#: whatsnew/3.13.rst:1909 +msgid "" +"Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " +"positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " +"and :func:`~re.subn` functions. These parameters will become :ref:`keyword-" +"only ` in a future version of Python. (Contributed " +"by Serhiy Storchaka in :gh:`56166`.)" +msgstr "" + +#: whatsnew/3.13.rst:1916 deprecations/pending-removal-in-3.15.rst:46 +msgid ":mod:`pathlib`:" +msgstr "" + +#: whatsnew/3.13.rst:1918 +msgid "" +"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " +"by Barney Gale in :gh:`88569`.)" +msgstr "" + +#: whatsnew/3.13.rst:1923 deprecations/pending-removal-in-3.15.rst:52 +msgid ":mod:`platform`:" +msgstr "" + +#: whatsnew/3.13.rst:1925 +msgid "" +"Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" +msgstr "" + +#: whatsnew/3.13.rst:1931 +msgid ":mod:`pydoc`:" +msgstr "" + +#: whatsnew/3.13.rst:1933 +msgid "" +"Deprecate the undocumented :func:`!ispackage` function. (Contributed by " +"Zackery Spytz in :gh:`64020`.)" +msgstr "" + +#: whatsnew/3.13.rst:1936 deprecations/pending-removal-in-3.14.rst:85 +msgid ":mod:`sqlite3`:" +msgstr "" + +#: whatsnew/3.13.rst:1938 +msgid "" +"Deprecate passing more than one positional argument to the :func:`~sqlite3." +"connect` function and the :class:`~sqlite3.Connection` constructor. The " +"remaining parameters will become keyword-only in Python 3.15. (Contributed " +"by Erlend E. Aasland in :gh:`107948`.)" +msgstr "" + +#: whatsnew/3.13.rst:1944 +msgid "" +"Deprecate passing name, number of arguments, and the callable as keyword " +"arguments for :meth:`.Connection.create_function` and :meth:`.Connection." +"create_aggregate` These parameters will become positional-only in Python " +"3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" +msgstr "" + +#: whatsnew/3.13.rst:1950 +msgid "" +"Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." +"Connection.set_authorizer`, :meth:`~sqlite3.Connection." +"set_progress_handler`, and :meth:`~sqlite3.Connection.set_trace_callback` :" +"class:`~sqlite3.Connection` methods. The callback callables will become " +"positional-only in Python 3.15. (Contributed by Erlend E. Aasland in :gh:" +"`108278`.)" +msgstr "" + +#: whatsnew/3.13.rst:1958 deprecations/pending-removal-in-3.16.rst:90 +msgid ":mod:`sys`:" +msgstr "" + +#: whatsnew/3.13.rst:1960 +msgid "" +"Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " +"removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" +msgstr "" + +#: whatsnew/3.13.rst:1965 deprecations/pending-removal-in-3.16.rst:102 +msgid ":mod:`tarfile`:" +msgstr "" + +#: whatsnew/3.13.rst:1967 +msgid "" +"Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " +"be removed in Python 3.16. (Contributed in :gh:`115256`.)" +msgstr "" + +#: whatsnew/3.13.rst:1971 +msgid ":mod:`traceback`:" +msgstr "" + +#: whatsnew/3.13.rst:1973 +msgid "" +"Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." +"TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" +"gh:`112332`.)" +msgstr "" + +#: whatsnew/3.13.rst:1977 deprecations/pending-removal-in-3.15.rst:80 +#: deprecations/pending-removal-in-3.17.rst:26 +msgid ":mod:`typing`:" +msgstr "" + +#: whatsnew/3.13.rst:1979 +msgid "" +"Deprecate the undocumented keyword argument syntax for creating :class:" +"`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``), to be removed in Python 3.15. Use the class-based syntax or the " +"functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" +msgstr "" + +#: whatsnew/3.13.rst:1986 +msgid "" +"Deprecate omitting the *fields* parameter when creating a :class:`~typing." +"NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " +"``None`` to the *fields* parameter of both types. Python 3.15 will require a " +"valid sequence for the *fields* parameter. To create a NamedTuple class with " +"zero fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " +"())``. To create a TypedDict class with zero fields, use ``class " +"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. (Contributed by " +"Alex Waygood in :gh:`105566` and :gh:`105570`.)" +msgstr "" + +#: whatsnew/3.13.rst:1996 +msgid "" +"Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " +"be removed in Python 3.15. After eight years in the :mod:`typing` module, it " +"has yet to be supported by any major type checker. (Contributed by Alex " +"Waygood in :gh:`106309`.)" +msgstr "" + +#: whatsnew/3.13.rst:2002 +msgid "" +"Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " +"``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " +"runtime when it is imported or accessed. It will be removed entirely in " +"Python 3.18. Use the new :ref:`type parameter syntax ` instead. " +"(Contributed by Michael The in :gh:`107116`.)" +msgstr "" + +#: whatsnew/3.13.rst:2010 deprecations/pending-removal-in-3.15.rst:100 +msgid ":mod:`wave`:" +msgstr "" + +#: whatsnew/3.13.rst:2012 +msgid "" +"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" +"`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" +"class:`~wave.Wave_write` classes, to be removed in Python 3.15. (Contributed " +"by Victor Stinner in :gh:`105096`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.14.rst:2 +#: deprecations/pending-removal-in-3.14.rst:2 +msgid "Pending removal in Python 3.14" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:4 +msgid "" +":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" +"argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " +"(Contributed by Nikita Sobolev in :gh:`92248`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:9 +msgid "" +":mod:`ast`: The following features have been deprecated in documentation " +"since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " +"runtime when they are accessed or used, and will be removed in Python 3.14:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:13 +msgid ":class:`!ast.Num`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:14 +msgid ":class:`!ast.Str`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:15 +msgid ":class:`!ast.Bytes`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:16 +msgid ":class:`!ast.NameConstant`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:17 +msgid ":class:`!ast.Ellipsis`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:19 +msgid "" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:22 +#: deprecations/pending-removal-in-3.16.rst:19 +msgid ":mod:`asyncio`:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:24 +msgid "" +"The child watcher classes :class:`!asyncio.MultiLoopChildWatcher`, :class:`!" +"asyncio.FastChildWatcher`, :class:`!asyncio.AbstractChildWatcher` and :class:" +"`!asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:30 +msgid "" +":func:`!asyncio.set_child_watcher`, :func:`!asyncio.get_child_watcher`, :" +"meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`!" +"asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated and will " +"be removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:36 +msgid "" +"The :meth:`~asyncio.get_event_loop` method of the default event loop policy " +"now emits a :exc:`DeprecationWarning` if there is no current event loop set " +"and it decides to create one. (Contributed by Serhiy Storchaka and Guido van " +"Rossum in :gh:`100160`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:41 +msgid "" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:44 +msgid ":mod:`importlib.abc` deprecated classes:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:46 +msgid ":class:`!importlib.abc.ResourceReader`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:47 +msgid ":class:`!importlib.abc.Traversable`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:48 +msgid ":class:`!importlib.abc.TraversableResources`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:50 +msgid "Use :mod:`importlib.resources.abc` classes instead:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:52 +msgid ":class:`importlib.resources.abc.Traversable`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:53 +msgid ":class:`importlib.resources.abc.TraversableResources`" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:55 +msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:57 +msgid "" +":mod:`itertools` had undocumented, inefficient, historically buggy, and " +"inconsistent support for copy, deepcopy, and pickle operations. This will be " +"removed in 3.14 for a significant reduction in code volume and maintenance " +"burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:63 +msgid "" +":mod:`multiprocessing`: The default start method will change to a safer one " +"on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " +"currently the default (:gh:`84559`). Adding a runtime warning about this was " +"deemed too disruptive as the majority of code is not expected to care. Use " +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:71 +msgid "" +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:75 +msgid "" +":mod:`pkgutil`: :func:`!pkgutil.find_loader` and :func:`!pkgutil.get_loader` " +"now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " +"instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:80 +msgid ":mod:`pty`:" +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:82 +msgid "``master_open()``: use :func:`pty.openpty`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:83 +msgid "``slave_open()``: use :func:`pty.openpty`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:87 +msgid ":data:`!version` and :data:`!version_info`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:89 +msgid "" +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders ` are used and *parameters* is " +"a sequence instead of a :class:`dict`." +msgstr "" + +#: deprecations/pending-removal-in-3.14.rst:93 +msgid "" +":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:2 +#: deprecations/pending-removal-in-3.15.rst:2 +msgid "Pending removal in Python 3.15" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:4 +#: deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:18 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:23 +msgid "" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:29 +msgid "" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:32 +#: deprecations/pending-removal-in-future.rst:63 +msgid ":mod:`importlib`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:36 +msgid ":class:`locale`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:38 +msgid "" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:48 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:54 +msgid "" +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:58 +#: deprecations/pending-removal-in-3.16.rst:96 +msgid ":mod:`sysconfig`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`threading`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:65 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:71 +msgid ":mod:`types`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:73 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:82 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:88 +msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:95 +msgid "" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:102 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:107 +msgid ":mod:`zipimport`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:109 +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.16.rst:2 +#: deprecations/pending-removal-in-3.16.rst:2 +msgid "Pending removal in Python 3.16" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:13 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:26 +msgid "" +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:29 +msgid ":class:`asyncio.AbstractEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:30 +msgid ":class:`asyncio.DefaultEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:31 +msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:32 +msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:33 +msgid ":func:`asyncio.get_event_loop_policy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:34 +msgid ":func:`asyncio.set_event_loop_policy`" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:36 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:39 +msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:48 +msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:50 +#: deprecations/pending-removal-in-future.rst:16 +msgid ":mod:`builtins`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:52 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:59 +msgid ":mod:`functools`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:61 +msgid "" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:64 +msgid ":mod:`logging`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:66 +msgid "" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:72 +msgid "" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:78 +msgid ":mod:`shutil`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:80 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:85 +msgid ":mod:`symtable`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:87 +msgid "" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:92 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:98 +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:104 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:2 +msgid "Pending removal in Python 3.17" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:8 +#: deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:14 +#: deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:22 +#: deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:28 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:33 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:2 +#: deprecations/pending-removal-in-future.rst:2 +msgid "Pending removal in future versions" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:4 +msgid "" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:7 +msgid ":mod:`argparse`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:9 +msgid "" +"Nesting argument groups and nesting mutually exclusive groups are deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:14 +msgid "The :class:`argparse.FileType` type converter is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:18 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:21 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:35 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:38 +msgid "Delegation of ``int()`` to ``__trunc__()`` method." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:39 +msgid "" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:44 +msgid "" +":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:49 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:51 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:54 +msgid ":mod:`datetime`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:56 +msgid "" +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:58 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:61 +msgid ":mod:`gettext`: Plural value must be an integer." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:65 +msgid "" +":func:`~importlib.util.cache_from_source` *debug_override* parameter is " +"deprecated: use the *optimization* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:68 +msgid ":mod:`importlib.metadata`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:70 +msgid "``EntryPoints`` tuple interface." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:71 +msgid "Implicit ``None`` on return values." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:73 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:76 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:79 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:81 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:84 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:91 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:93 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:96 +msgid ":mod:`ssl` options and protocols:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:98 +msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:99 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:102 +msgid "``ssl.OP_NO_SSL*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:103 +msgid "``ssl.OP_NO_TLS*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:104 +msgid "``ssl.PROTOCOL_SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:105 +msgid "``ssl.PROTOCOL_TLS``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:106 +msgid "``ssl.PROTOCOL_TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:107 +msgid "``ssl.PROTOCOL_TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:108 +msgid "``ssl.PROTOCOL_TLSv1_2``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:109 +msgid "``ssl.TLSVersion.SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:110 +msgid "``ssl.TLSVersion.TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:111 +msgid "``ssl.TLSVersion.TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:113 +msgid ":mod:`threading` methods:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:115 +msgid "" +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:116 +msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:117 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:119 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:121 +msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:122 +msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:124 +msgid ":class:`typing.Text` (:gh:`92332`)." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:126 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:131 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:134 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:136 +msgid "``splitattr()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:137 +msgid "``splithost()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:138 +msgid "``splitnport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:139 +msgid "``splitpasswd()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:140 +msgid "``splitport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:141 +msgid "``splitquery()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:142 +msgid "``splittag()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:143 +msgid "``splittype()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:144 +msgid "``splituser()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:145 +msgid "``splitvalue()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:146 +msgid "``to_bytes()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:148 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:151 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:156 +msgid "" +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." +msgstr "" + +#: whatsnew/3.13.rst:2031 +msgid "CPython Bytecode Changes" +msgstr "" + +#: whatsnew/3.13.rst:2033 +msgid "" +"The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " +"yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " +"changed to add a bit indicating if the except-depth is 1, which is needed to " +"optimize closing of generators. (Contributed by Irit Katriel in :gh:" +"`111354`.)" +msgstr "" + +#: whatsnew/3.13.rst:2041 +msgid "C API Changes" +msgstr "" + +#: whatsnew/3.13.rst:2046 +msgid "" +"Add the :ref:`PyMonitoring C API ` for generating :pep:" +"`669` monitoring events:" +msgstr "" + +#: whatsnew/3.13.rst:2049 +msgid ":c:type:`PyMonitoringState`" +msgstr "" + +#: whatsnew/3.13.rst:2050 +msgid ":c:func:`PyMonitoring_FirePyStartEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2051 +msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2052 +msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2053 +msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2054 +msgid ":c:func:`PyMonitoring_FireCallEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2055 +msgid ":c:func:`PyMonitoring_FireLineEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2056 +msgid ":c:func:`PyMonitoring_FireJumpEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2057 +msgid "``PyMonitoring_FireBranchEvent``" +msgstr "" + +#: whatsnew/3.13.rst:2058 +msgid ":c:func:`PyMonitoring_FireCReturnEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2059 +msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2060 +msgid ":c:func:`PyMonitoring_FireRaiseEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2061 +msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2062 +msgid ":c:func:`PyMonitoring_FireReraiseEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2063 +msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2064 +msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2065 +msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" +msgstr "" + +#: whatsnew/3.13.rst:2066 +msgid ":c:func:`PyMonitoring_EnterScope`" +msgstr "" + +#: whatsnew/3.13.rst:2067 +msgid ":c:func:`PyMonitoring_ExitScope`" +msgstr "" + +#: whatsnew/3.13.rst:2069 +msgid "(Contributed by Irit Katriel in :gh:`111997`)." +msgstr "" + +#: whatsnew/3.13.rst:2071 +msgid "" +"Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " +"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" +"func:`!PyMutex_Lock` will release the :term:`GIL` (if currently held) if the " +"operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" +msgstr "" + +#: whatsnew/3.13.rst:2077 +msgid "" +"Add the :ref:`PyTime C API ` to provide access to system clocks:" +msgstr "" + +#: whatsnew/3.13.rst:2079 +msgid ":c:type:`PyTime_t`." +msgstr "" + +#: whatsnew/3.13.rst:2080 +msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." +msgstr "" + +#: whatsnew/3.13.rst:2081 +msgid ":c:func:`PyTime_AsSecondsDouble`." +msgstr "" + +#: whatsnew/3.13.rst:2082 +msgid ":c:func:`PyTime_Monotonic`." +msgstr "" + +#: whatsnew/3.13.rst:2083 +msgid ":c:func:`PyTime_MonotonicRaw`." +msgstr "" + +#: whatsnew/3.13.rst:2084 +msgid ":c:func:`PyTime_PerfCounter`." +msgstr "" + +#: whatsnew/3.13.rst:2085 +msgid ":c:func:`PyTime_PerfCounterRaw`." +msgstr "" + +#: whatsnew/3.13.rst:2086 +msgid ":c:func:`PyTime_Time`." +msgstr "" + +#: whatsnew/3.13.rst:2087 +msgid ":c:func:`PyTime_TimeRaw`." +msgstr "" + +#: whatsnew/3.13.rst:2089 +msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" +msgstr "" + +#: whatsnew/3.13.rst:2091 +msgid "" +"Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" +"c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " +"UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. (Contributed " +"by Victor Stinner in :gh:`108314`.)" +msgstr "" + +#: whatsnew/3.13.rst:2097 +msgid "" +"Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " +"functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " +"return a :term:`strong reference` instead of a :term:`borrowed reference`. " +"Moreover, these functions return ``-1`` on error, removing the need to " +"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner in :gh:" +"`106004`.)" +msgstr "" + +#: whatsnew/3.13.rst:2105 +msgid "" +"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" +"c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " +"of a :term:`borrowed reference`. This function returns ``-1`` on error, " +"``0`` on insertion, and ``1`` if the key was already present in the " +"dictionary. (Contributed by Sam Gross in :gh:`112066`.)" +msgstr "" + +#: whatsnew/3.13.rst:2113 +msgid "" +"Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " +"remove a key from a dictionary and optionally return the removed value. This " +"is similar to :meth:`dict.pop`, though there is no default value, and :exc:" +"`KeyError` is not raised for missing keys. (Contributed by Stefan Behnel and " +"Victor Stinner in :gh:`111262`.)" +msgstr "" + +#: whatsnew/3.13.rst:2120 +msgid "" +"Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" +"`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" +"`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` respectively. The " +"new functions do not raise :exc:`KeyError` if the requested key is missing " +"from the mapping. These variants are more convenient and faster if a missing " +"key should not be treated as a failure. (Contributed by Serhiy Storchaka in :" +"gh:`106307`.)" +msgstr "" + +#: whatsnew/3.13.rst:2130 +msgid "" +"Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" +"`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" +"`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` respectively. The " +"new functions do not raise :exc:`AttributeError` if the requested attribute " +"is not found on the object. These variants are more convenient and faster if " +"the missing attribute should not be treated as a failure. (Contributed by " +"Serhiy Storchaka in :gh:`106521`.)" +msgstr "" + +#: whatsnew/3.13.rst:2140 +msgid "" +"Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" +"`PyErr_WriteUnraisable` that allows customizing the warning message. " +"(Contributed by Serhiy Storchaka in :gh:`108082`.)" +msgstr "" + +#: whatsnew/3.13.rst:2145 +msgid "" +"Add new functions that return a :term:`strong reference` instead of a :term:" +"`borrowed reference` for frame locals, globals, and builtins, as part of :" +"ref:`PEP 667 `:" +msgstr "" + +#: whatsnew/3.13.rst:2149 +msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" +msgstr "" + +#: whatsnew/3.13.rst:2150 +msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" +msgstr "" + +#: whatsnew/3.13.rst:2151 +msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" +msgstr "" + +#: whatsnew/3.13.rst:2153 +msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" +msgstr "" + +#: whatsnew/3.13.rst:2155 +msgid "" +"Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " +"functions to get :term:`strong ` or :term:`borrowed " +"` references to constants. For example, " +"``Py_GetConstant(Py_CONSTANT_ZERO)`` returns a strong reference to the " +"constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" +msgstr "" + +#: whatsnew/3.13.rst:2162 +msgid "" +"Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" +"func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " +"a :term:`borrowed reference`. (Contributed by Victor Stinner in :gh:" +"`105922`.)" +msgstr "" + +#: whatsnew/3.13.rst:2167 +msgid "" +"Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " +"interpreter is :term:`shutting down `. (Contributed by " +"Victor Stinner in :gh:`108014`.)" +msgstr "" + +#: whatsnew/3.13.rst:2172 +msgid "" +"Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" +"`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" +"`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" +msgstr "" + +#: whatsnew/3.13.rst:2177 +msgid "" +"Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " +"mirroring the Python :meth:`list.extend` and :meth:`list.clear` methods. " +"(Contributed by Victor Stinner in :gh:`111138`.)" +msgstr "" + +#: whatsnew/3.13.rst:2181 +msgid "" +"Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" +"`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" +"c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" +msgstr "" + +#: whatsnew/3.13.rst:2186 +msgid "" +"Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " +"and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " +"converting between native integer types and Python :class:`int` objects. " +"(Contributed by Steve Dower in :gh:`111140`.)" +msgstr "" + +#: whatsnew/3.13.rst:2192 +msgid "" +"Add :c:func:`PyModule_Add` function, which is similar to :c:func:" +"`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " +"a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +msgstr "" + +#: whatsnew/3.13.rst:2197 +msgid "" +"Add the :c:func:`PyObject_GenericHash` function that implements the default " +"hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" +"`113024`.)" +msgstr "" + +#: whatsnew/3.13.rst:2201 +msgid "" +"Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " +"(Contributed by Victor Stinner in :gh:`111545`.)" +msgstr "" + +#: whatsnew/3.13.rst:2204 +msgid "" +"Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" +"`PyObject_ClearManagedDict` functions. which must be called by the traverse " +"and clear functions of a type using the :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"flag. The `pythoncapi-compat project`_ can be used to use these functions " +"with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" +msgstr "" + +#: whatsnew/3.13.rst:2212 +msgid "" +"Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " +"functions, which enable tracking object creation and destruction in the same " +"way that the :mod:`tracemalloc` module does. (Contributed by Pablo Galindo " +"in :gh:`93502`.)" +msgstr "" + +#: whatsnew/3.13.rst:2218 +msgid "" +"Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" +"`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " +"(Contributed by Victor Stinner in :gh:`85283`.)" +msgstr "" + +#: whatsnew/3.13.rst:2223 +msgid "" +"Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " +"to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " +"error if it is ``NULL``. The caller is responsible for checking if the " +"result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" +msgstr "" + +#: whatsnew/3.13.rst:2229 +msgid "" +"Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " +"fully qualified name. The module name is prepended if :attr:`type." +"__module__` is a string and is not equal to either ``'builtins'`` or " +"``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" +msgstr "" + +#: whatsnew/3.13.rst:2235 +msgid "" +"Add the :c:func:`PyType_GetModuleName` function to get the type's module " +"name. This is equivalent to getting the :attr:`type.__module__` attribute. " +"(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" +msgstr "" + +#: whatsnew/3.13.rst:2240 +msgid "" +"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" +"`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" +"`const char*` UTF-8 encoded string and ``1`` if they are equal or ``0`` " +"otherwise. These functions do not raise exceptions. (Contributed by Serhiy " +"Storchaka in :gh:`110289`.)" +msgstr "" + +#: whatsnew/3.13.rst:2247 +msgid "" +"Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" +"`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " +"the referent is no longer live. (Contributed by Victor Stinner in :gh:" +"`105927`.)" +msgstr "" + +#: whatsnew/3.13.rst:2253 +msgid "Add fixed variants of functions which silently ignore errors:" +msgstr "" + +#: whatsnew/3.13.rst:2255 +msgid "" +":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." +msgstr "" + +#: whatsnew/3.13.rst:2256 +msgid "" +":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" +"`PyObject_HasAttrString`." +msgstr "" + +#: whatsnew/3.13.rst:2258 +msgid "" +":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." +msgstr "" + +#: whatsnew/3.13.rst:2259 +msgid "" +":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" +"`PyMapping_HasKeyString`." +msgstr "" + +#: whatsnew/3.13.rst:2262 +msgid "" +"The new functions return ``-1`` for errors and the standard ``1`` for true " +"and ``0`` for false." +msgstr "" + +#: whatsnew/3.13.rst:2265 +msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" +msgstr "" + +#: whatsnew/3.13.rst:2269 +msgid "Changed C APIs" +msgstr "" + +#: whatsnew/3.13.rst:2271 +msgid "" +"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" +"func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " +"in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char " +"**`. In C++, this makes these functions compatible with arguments of type :c:" +"expr:`const char * const *`, :c:expr:`const char **`, or :c:expr:`char * " +"const *` without an explicit type cast. In C, the functions only support " +"arguments of type :c:expr:`char * const *`. This can be overridden with the :" +"c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy Storchaka in :gh:" +"`65210`.)" +msgstr "" + +#: whatsnew/3.13.rst:2283 +msgid "" +":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " +"parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" +msgstr "" + +#: whatsnew/3.13.rst:2287 +msgid "" +"The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " +"named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " +"Romanyuk in :gh:`115781`.)" +msgstr "" + +#: whatsnew/3.13.rst:2291 +msgid "" +"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" +"`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" +"`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:" +"`PySys_GetObject` functions, each of which clears all errors which occurred " +"when calling them now reports these errors using :func:`sys.unraisablehook`. " +"You may replace them with other functions as recommended in the " +"documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" +msgstr "" + +#: whatsnew/3.13.rst:2300 +msgid "" +"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" +"`PyUnicode_FromFormat`:" +msgstr "" + +#: whatsnew/3.13.rst:2303 +msgid "``%T``: Get the fully qualified name of an object type" +msgstr "" + +#: whatsnew/3.13.rst:2304 +msgid "``%#T``: As above, but use a colon as the separator" +msgstr "" + +#: whatsnew/3.13.rst:2305 +msgid "``%N``: Get the fully qualified name of a type" +msgstr "" + +#: whatsnew/3.13.rst:2306 +msgid "``%#N``: As above, but use a colon as the separator" +msgstr "" + +#: whatsnew/3.13.rst:2308 +msgid "" +"See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" +"`111696`.)" +msgstr "" + +#: whatsnew/3.13.rst:2311 +msgid "" +"You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " +"including :file:`Python.h` when using ``#`` formats in :ref:`format codes " +"`. APIs accepting the format codes always " +"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki in :gh:" +"`104922`.)" +msgstr "" + +#: whatsnew/3.13.rst:2317 +msgid "" +"If Python is built in :ref:`debug mode ` or :option:`with " +"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" +"`PyList_SET_ITEM` now check the index argument with an assertion. " +"(Contributed by Victor Stinner in :gh:`106168`.)" +msgstr "" + +#: whatsnew/3.13.rst:2325 +msgid "Limited C API Changes" +msgstr "" + +#: whatsnew/3.13.rst:2327 +msgid "The following functions are now included in the Limited C API:" +msgstr "" + +#: whatsnew/3.13.rst:2329 +msgid ":c:func:`PyMem_RawMalloc`" +msgstr "" + +#: whatsnew/3.13.rst:2330 +msgid ":c:func:`PyMem_RawCalloc`" +msgstr "" + +#: whatsnew/3.13.rst:2331 +msgid ":c:func:`PyMem_RawRealloc`" +msgstr "" + +#: whatsnew/3.13.rst:2332 +msgid ":c:func:`PyMem_RawFree`" +msgstr "" + +#: whatsnew/3.13.rst:2333 +msgid ":c:func:`PySys_Audit`" +msgstr "" + +#: whatsnew/3.13.rst:2334 +msgid ":c:func:`PySys_AuditTuple`" +msgstr "" + +#: whatsnew/3.13.rst:2335 +msgid ":c:func:`PyType_GetModuleByDef`" +msgstr "" + +#: whatsnew/3.13.rst:2337 +msgid "" +"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" +"`116936`.)" +msgstr "" + +#: whatsnew/3.13.rst:2339 +msgid "" +"Python built with :option:`--with-trace-refs` (tracing references) now " +"supports the :ref:`Limited API `. (Contributed by Victor " +"Stinner in :gh:`108634`.)" +msgstr "" + +#: whatsnew/3.13.rst:2345 +msgid "Removed C APIs" +msgstr "" + +#: whatsnew/3.13.rst:2347 +msgid "" +"Remove several functions, macros, variables, etc with names prefixed by " +"``_Py`` or ``_PY`` (which are considered private). If your project is " +"affected by one of these removals and you believe that the removed API " +"should remain available, please :ref:`open a new issue ` " +"to request a public C API and add ``cc: @vstinner`` to the issue to notify " +"Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" +msgstr "" + +#: whatsnew/3.13.rst:2355 +msgid "" +"Remove old buffer protocols deprecated in Python 3.0. Use :ref:" +"`bufferobjects` instead." +msgstr "" + +#: whatsnew/3.13.rst:2358 +msgid "" +":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " +"test whether the object supports the buffer protocol. Note that :c:func:" +"`PyObject_CheckBuffer` doesn't guarantee that :c:func:`PyObject_GetBuffer` " +"will succeed. To test if the object is actually readable, see the next " +"example of :c:func:`PyObject_GetBuffer`." +msgstr "" + +#: whatsnew/3.13.rst:2366 +msgid "" +":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" +"func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" +msgstr "" + +#: whatsnew/3.13.rst:2369 +msgid "" +"Py_buffer view;\n" +"if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" +" return NULL;\n" +"}\n" +"// Use `view.buf` and `view.len` to read from the buffer.\n" +"// You may need to cast buf as `(const char*)view.buf`.\n" +"PyBuffer_Release(&view);" +msgstr "" + +#: whatsnew/3.13.rst:2379 +msgid "" +":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" +"func:`PyBuffer_Release` instead:" +msgstr "" + +#: whatsnew/3.13.rst:2382 +msgid "" +"Py_buffer view;\n" +"if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" +" return NULL;\n" +"}\n" +"// Use `view.buf` and `view.len` to write to the buffer.\n" +"PyBuffer_Release(&view);" +msgstr "" + +#: whatsnew/3.13.rst:2391 +msgid "(Contributed by Inada Naoki in :gh:`85275`.)" +msgstr "" + +#: whatsnew/3.13.rst:2393 +msgid "Remove various functions deprecated in Python 3.9:" +msgstr "" + +#: whatsnew/3.13.rst:2395 +msgid "" +":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" +"c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." +msgstr "" + +#: whatsnew/3.13.rst:2400 +msgid "" +"In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " +"and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " +"``NULL``, whereas the removed functions checked argument types and accepted " +"``NULL`` positional and keyword arguments. To replace " +"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` with :c:func:" +"`PyObject_Call`, pass an empty tuple as positional arguments using :c:func:" +"`PyTuple_New(0) `." +msgstr "" + +#: whatsnew/3.13.rst:2410 +msgid "" +":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." +msgstr "" + +#: whatsnew/3.13.rst:2412 +msgid "" +":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." +msgstr "" + +#: whatsnew/3.13.rst:2414 +msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." +msgstr "" + +#: whatsnew/3.13.rst:2417 +msgid "(Contributed by Victor Stinner in :gh:`105107`.)" +msgstr "" + +#: whatsnew/3.13.rst:2419 +msgid "" +"Remove the following old functions to configure the Python initialization, " +"deprecated in Python 3.11:" +msgstr "" + +#: whatsnew/3.13.rst:2422 +msgid "" +":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " +"instead." +msgstr "" + +#: whatsnew/3.13.rst:2424 +msgid "" +":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." +msgstr "" + +#: whatsnew/3.13.rst:2426 +msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." +msgstr "" + +#: whatsnew/3.13.rst:2428 +msgid "" +":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." +msgstr "" + +#: whatsnew/3.13.rst:2430 +msgid "" +":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " +"instead." +msgstr "" + +#: whatsnew/3.13.rst:2432 +msgid "" +":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." +msgstr "" + +#: whatsnew/3.13.rst:2434 +msgid "" +":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." +"stdio_encoding` instead, and set also maybe :c:member:`PyConfig." +"legacy_windows_stdio` (on Windows)." +msgstr "" + +#: whatsnew/3.13.rst:2437 +msgid "" +":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " +"instead." +msgstr "" + +#: whatsnew/3.13.rst:2440 +msgid "" +"Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " +"Configuration ` instead (:pep:`587`), added to Python 3.8. " +"(Contributed by Victor Stinner in :gh:`105145`.)" +msgstr "" + +#: whatsnew/3.13.rst:2444 +msgid "" +"Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " +"functions, deprecated in Python 3.2. They didn't update the current thread " +"state. They can be replaced with:" +msgstr "" + +#: whatsnew/3.13.rst:2449 +msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" +msgstr "" + +#: whatsnew/3.13.rst:2450 +msgid "" +"low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" +msgstr "" + +#: whatsnew/3.13.rst:2451 +msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." +msgstr "" + +#: whatsnew/3.13.rst:2453 +msgid "(Contributed by Victor Stinner in :gh:`105182`.)" +msgstr "" + +#: whatsnew/3.13.rst:2455 +msgid "" +"Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " +"Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " +"GIL: calling :c:func:`!PyEval_InitThreads` does nothing and :c:func:`!" +"PyEval_ThreadsInitialized` always returns non-zero. (Contributed by Victor " +"Stinner in :gh:`105182`.)" +msgstr "" + +#: whatsnew/3.13.rst:2462 +msgid "" +"Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" +"`PyInterpreterState_Get()` which was kept for backward compatibility with " +"Python 3.8. The `pythoncapi-compat project`_ can be used to get :c:func:" +"`PyInterpreterState_Get()` on Python 3.8 and older. (Contributed by Victor " +"Stinner in :gh:`106320`.)" +msgstr "" + +#: whatsnew/3.13.rst:2469 +msgid "" +"Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" +"PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " +"(Contributed by Victor Stinner in :gh:`106023`.)" +msgstr "" + +#: whatsnew/3.13.rst:2474 +msgid "" +"Remove the ``cpython/pytime.h`` header file, which only contained private " +"functions. (Contributed by Victor Stinner in :gh:`106316`.)" +msgstr "" + +#: whatsnew/3.13.rst:2478 +msgid "" +"Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " +"(Contributed by Victor Stinner in :gh:`110014`.)" +msgstr "" + +#: whatsnew/3.13.rst:2481 +msgid "" +"Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " +"``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " +"``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. (Contributed by Irit Katriel " +"in :gh:`105111`.)" +msgstr "" + +#: whatsnew/3.13.rst:2488 +msgid "Deprecated C APIs" +msgstr "" + +#: whatsnew/3.13.rst:2490 +msgid "Deprecate old Python initialization functions:" +msgstr "" + +#: whatsnew/3.13.rst:2492 deprecations/c-api-pending-removal-in-3.15.rst:62 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." +msgstr "" + +#: whatsnew/3.13.rst:2494 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." +msgstr "" + +#: whatsnew/3.13.rst:2496 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." +msgstr "" + +#: whatsnew/3.13.rst:2498 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." +msgstr "" + +#: whatsnew/3.13.rst:2500 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." +msgstr "" + +#: whatsnew/3.13.rst:2502 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." +msgstr "" + +#: whatsnew/3.13.rst:2504 +msgid "" +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." +msgstr "" + +#: whatsnew/3.13.rst:2508 +msgid "(Contributed by Victor Stinner in :gh:`105145`.)" +msgstr "" + +#: whatsnew/3.13.rst:2510 +msgid "" +":term:`Soft deprecate ` the :c:func:`PyEval_GetBuiltins`, :" +"c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " +"return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" +msgstr "" + +#: whatsnew/3.13.rst:2516 +msgid "" +"Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " +"an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " +"by Victor Stinner in :gh:`105396`.)" +msgstr "" + +#: whatsnew/3.13.rst:2520 +msgid "" +":term:`Soft deprecate ` the :c:func:`PyModule_AddObject` " +"function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" +"`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +msgstr "" + +#: whatsnew/3.13.rst:2526 +msgid "" +"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" +"macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " +"instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` are just " +"aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner in :gh:" +"`105156`.)" +msgstr "" + +#: whatsnew/3.13.rst:2533 +msgid "" +"Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" +"`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " +"Replace them with the new :c:func:`PyWeakref_GetRef` function, which returns " +"a :term:`strong reference`. The `pythoncapi-compat project`_ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. (Contributed by " +"Victor Stinner in :gh:`105927`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.14.rst:4 +msgid "" +"The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " +"(:pep:`699`; :gh:`101193`)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.14.rst:7 +msgid "" +"Creating :c:data:`immutable types ` with mutable " +"bases (:gh:`95388`)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:6 +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:10 +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:22 +msgid "Python initialization functions, deprecated in Python 3.13:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:24 +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:27 +msgid "" +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:38 +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:41 +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:44 +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:52 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:54 +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:56 +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:58 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:60 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:65 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:68 +msgid "Global configuration variables:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:70 +msgid "" +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:73 +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:76 +msgid "" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:79 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:82 +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:85 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:88 +msgid "" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:91 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:94 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:97 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:100 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:103 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:106 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:109 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:113 +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:116 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:119 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:122 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:125 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:128 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:133 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.16.rst:4 +msgid "The bundled copy of ``libmpdec``." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:2 +msgid "Pending removal in Python 3.18" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:4 +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:7 +msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:8 +msgid "" +":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" +"`PyDict_GetItemStringRef`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:10 +msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:11 +msgid "" +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" +"`PyLongWriter_Create`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:13 +msgid "" +":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" +"`PyThreadState_GetUnchecked`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:14 +msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:15 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:18 +msgid "" +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" +"`PyUnicodeWriter_Finish(writer) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:21 +msgid "" +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" +"`PyUnicodeWriter_Discard(writer) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:24 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:27 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:30 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:33 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:36 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:39 +msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:40 +msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:41 +msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:42 +msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:44 +msgid "" +"The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:7 +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:19 +msgid "" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:21 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:23 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:25 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:29 +msgid "Thread Local Storage (TLS) API:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:31 +msgid "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:33 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:37 +msgid "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:39 +msgid "" +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:41 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." +msgstr "" + +#: whatsnew/3.13.rst:2557 +msgid "Build Changes" +msgstr "" + +#: whatsnew/3.13.rst:2559 +msgid "" +"``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " +"tier 3 platforms. (:ref:`PEP 730 ` written and " +"implementation contributed by Russell Keith-Magee in :gh:`114099`.)" +msgstr "" + +#: whatsnew/3.13.rst:2564 +msgid "" +"``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" +"`11` tier 3 platforms. (:ref:`PEP 738 ` " +"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" +msgstr "" + +#: whatsnew/3.13.rst:2569 +msgid "" +"``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " +"Cannon in :gh:`115192`.)" +msgstr "" + +#: whatsnew/3.13.rst:2572 +msgid "" +"``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " +"(Contributed by Brett Cannon in :gh:`115192`.)" +msgstr "" + +#: whatsnew/3.13.rst:2575 +msgid "" +"Building CPython now requires a compiler with support for the C11 atomic " +"library, GCC built-in atomic functions, or MSVC interlocked intrinsics." +msgstr "" + +#: whatsnew/3.13.rst:2578 +msgid "" +"Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" +"`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " +"Victor Stinner in :gh:`112090`.)" +msgstr "" + +#: whatsnew/3.13.rst:2582 +msgid "" +"SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " +"module. (Contributed by Erlend Aasland in :gh:`105875`.)" +msgstr "" + +#: whatsnew/3.13.rst:2586 +msgid "" +"CPython now bundles the `mimalloc library`_ by default. It is licensed under " +"the MIT license; see :ref:`mimalloc license `. The bundled " +"mimalloc has custom changes, see :gh:`113141` for details. (Contributed by " +"Dino Viehland in :gh:`109914`.)" +msgstr "" + +#: whatsnew/3.13.rst:2594 +msgid "" +"The :file:`configure` option :option:`--with-system-libmpdec` now defaults " +"to ``yes``. The bundled copy of ``libmpdec`` will be removed in Python 3.16." +msgstr "" + +#: whatsnew/3.13.rst:2598 +msgid "" +"Python built with :file:`configure` :option:`--with-trace-refs` (tracing " +"references) is now ABI compatible with the Python release build and :ref:" +"`debug build `. (Contributed by Victor Stinner in :gh:`108634`.)" +msgstr "" + +#: whatsnew/3.13.rst:2603 +msgid "" +"On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " +"flags. For example, the free-threaded build generates ``python-3.13t.pc`` " +"and the debug build generates ``python-3.13d.pc``." +msgstr "" + +#: whatsnew/3.13.rst:2607 +msgid "" +"The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " +"``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." +"posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, ``_testconsole``, " +"``_testimportmultiple`` and ``_uuid`` C extensions are now built with the :" +"ref:`limited C API `. (Contributed by Victor Stinner in :gh:" +"`85283`.)" +msgstr "" + +#: whatsnew/3.13.rst:2616 +msgid "Porting to Python 3.13" +msgstr "" + +#: whatsnew/3.13.rst:2618 +msgid "" +"This section lists previously described changes and other bugfixes that may " +"require changes to your code." +msgstr "" + +#: whatsnew/3.13.rst:2622 +msgid "Changes in the Python API" +msgstr "" + +#: whatsnew/3.13.rst:2626 +msgid "" +":ref:`PEP 667 ` introduces several changes to " +"the semantics of :func:`locals` and :attr:`f_locals `:" +msgstr "" + +#: whatsnew/3.13.rst:2629 +msgid "" +"Calling :func:`locals` in an :term:`optimized scope` now produces an " +"independent snapshot on each call, and hence no longer implicitly updates " +"previously returned references. Obtaining the legacy CPython behavior now " +"requires explicit calls to update the initially returned dictionary with the " +"results of subsequent calls to :func:`!locals`. Code execution functions " +"that implicitly target :func:`!locals` (such as ``exec`` and ``eval``) must " +"be passed an explicit namespace to access their results in an optimized " +"scope. (Changed as part of :pep:`667`.)" +msgstr "" + +#: whatsnew/3.13.rst:2638 +msgid "" +"Calling :func:`locals` from a comprehension at module or class scope " +"(including via ``exec`` or ``eval``) once more behaves as if the " +"comprehension were running as an independent nested function (i.e. the local " +"variables from the containing scope are not included). In Python 3.12, this " +"had changed to include the local variables from the containing scope when " +"implementing :pep:`709`. (Changed as part of :pep:`667`.)" +msgstr "" + +#: whatsnew/3.13.rst:2645 +msgid "" +"Accessing :attr:`FrameType.f_locals ` in an :term:`optimized " +"scope` now returns a write-through proxy rather than a snapshot that gets " +"updated at ill-specified times. If a snapshot is desired, it must be created " +"explicitly with ``dict`` or the proxy's ``.copy()`` method. (Changed as part " +"of :pep:`667`.)" +msgstr "" + +#: whatsnew/3.13.rst:2651 +msgid "" +":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " +"method. The behavior will change in future Python versions. Wrap it in :func:" +"`staticmethod` if you want to preserve the old behavior. (Contributed by " +"Serhiy Storchaka in :gh:`121027`.)" +msgstr "" + +#: whatsnew/3.13.rst:2657 +msgid "" +"An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " +"to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " +"or :exc:`KeyError` on Unix platforms where the password database is empty." +msgstr "" + +#: whatsnew/3.13.rst:2662 +msgid "" +"The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " +"string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " +"value of the :attr:`!mode` attribute of the readable file-like object " +"returned by :meth:`zipfile.ZipFile.open` is now ``'rb'`` instead of ``'r'``. " +"(Contributed by Serhiy Storchaka in :gh:`115961`.)" +msgstr "" + +#: whatsnew/3.13.rst:2668 +msgid "" +":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " +"(Contributed by Zackery Spytz in :gh:`65559`.)" +msgstr "" + +#: whatsnew/3.13.rst:2671 +msgid "" +":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " +"files and directories if a pattern that ends with \"``**``\" is given, " +"rather than directories only. Add a trailing slash to keep the previous " +"behavior and only match directories." +msgstr "" + +#: whatsnew/3.13.rst:2676 +msgid "" +"The :mod:`threading` module now expects the :mod:`!_thread` module to have " +"an :func:`!_is_main_interpreter` function. This function takes no arguments " +"and returns ``True`` if the current interpreter is the main interpreter." +msgstr "" + +#: whatsnew/3.13.rst:2681 +msgid "" +"Any library or application that provides a custom :mod:`!_thread` module " +"must provide :func:`!_is_main_interpreter`, just like the module's other " +"\"private\" attributes. (:gh:`112826`.)" +msgstr "" + +#: whatsnew/3.13.rst:2688 +msgid "Changes in the C API" +msgstr "" + +#: whatsnew/3.13.rst:2690 +msgid "" +"``Python.h`` no longer includes the ```` standard header. It was " +"included for the :c:func:`!finite` function which is now provided by the " +"```` header. It should now be included explicitly if needed. Remove " +"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner in :gh:" +"`108765`.)" +msgstr "" + +#: whatsnew/3.13.rst:2696 +msgid "" +"``Python.h`` no longer includes these standard header files: ````, " +"```` and ````. If needed, they should now be " +"included explicitly. For example, ```` provides the :c:func:`!clock` " +"and :c:func:`!gmtime` functions, ```` provides the :c:func:`!" +"select` function, and ```` provides the :c:func:`!futimes`, :c:" +"func:`!gettimeofday` and :c:func:`!setitimer` functions. (Contributed by " +"Victor Stinner in :gh:`108765`.)" +msgstr "" + +#: whatsnew/3.13.rst:2704 +msgid "" +"On Windows, ``Python.h`` no longer includes the ```` standard " +"header file. If needed, it should now be included explicitly. For example, " +"it provides :c:func:`!offsetof` function, and ``size_t`` and ``ptrdiff_t`` " +"types. Including ```` explicitly was already needed by all other " +"platforms, the ``HAVE_STDDEF_H`` macro is only defined on Windows. " +"(Contributed by Victor Stinner in :gh:`108765`.)" +msgstr "" + +#: whatsnew/3.13.rst:2711 +msgid "" +"If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" +"Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" +"Py_BUILD_CORE_MODULE` macros are now undefined by ````. " +"(Contributed by Victor Stinner in :gh:`85283`.)" +msgstr "" + +#: whatsnew/3.13.rst:2716 +msgid "" +"The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " +"``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " +"macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." +msgstr "" + +#: whatsnew/3.13.rst:2720 +msgid "A ``tp_dealloc`` function that has the old macros, such as::" +msgstr "" + +#: whatsnew/3.13.rst:2722 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_SAFE_BEGIN(p);\n" +" ...\n" +" Py_TRASHCAN_SAFE_END\n" +"}" +msgstr "" + +#: whatsnew/3.13.rst:2731 +msgid "should migrate to the new macros as follows::" +msgstr "" + +#: whatsnew/3.13.rst:2733 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" +msgstr "" + +#: whatsnew/3.13.rst:2742 +msgid "" +"Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " +"deallocation function it is in. The new macros were added in Python 3.8 and " +"the old macros were deprecated in Python 3.11. (Contributed by Irit Katriel " +"in :gh:`105111`.)" +msgstr "" + +#: whatsnew/3.13.rst:2749 +msgid "" +":ref:`PEP 667 ` introduces several changes to " +"frame-related functions:" +msgstr "" + +#: whatsnew/3.13.rst:2752 +msgid "" +"The effects of mutating the dictionary returned from :c:func:" +"`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " +"entries added this way will now *only* be visible to subsequent :c:func:" +"`PyEval_GetLocals` calls in that frame, as :c:func:`PyFrame_GetLocals`, :" +"func:`locals`, and :attr:`FrameType.f_locals ` no longer " +"access the same underlying cached dictionary. Changes made to entries for " +"actual variable names and names added via the write-through proxy interfaces " +"will be overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in " +"that frame. The recommended code update depends on how the function was " +"being used, so refer to the deprecation notice on the function for details." +msgstr "" + +#: whatsnew/3.13.rst:2765 +msgid "" +"Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " +"returns a write-through proxy rather than a snapshot that gets updated at " +"ill-specified times. If a snapshot is desired, it must be created explicitly " +"(e.g. with :c:func:`PyDict_Copy`), or by calling the new :c:func:" +"`PyEval_GetFrameLocals` API." +msgstr "" + +#: whatsnew/3.13.rst:2772 +msgid "" +":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " +"no longer have any effect. Calling these functions has been redundant since " +"Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." +msgstr "" + +#: whatsnew/3.13.rst:2777 +msgid "" +":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " +"function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" +"through proxy for :term:`optimized scopes `." +msgstr "" + +#: whatsnew/3.13.rst:2781 +msgid "" +"Python 3.13 removed many private functions. Some of them can be replaced " +"using these alternatives:" +msgstr "" + +#: whatsnew/3.13.rst:2784 +msgid "``_PyDict_Pop()``: :c:func:`PyDict_Pop` or :c:func:`PyDict_PopString`;" +msgstr "" + +#: whatsnew/3.13.rst:2785 +msgid "``_PyDict_GetItemWithError()``: :c:func:`PyDict_GetItemRef`;" +msgstr "" + +#: whatsnew/3.13.rst:2786 +msgid "``_PyErr_WriteUnraisableMsg()``: :c:func:`PyErr_FormatUnraisable`;" +msgstr "" + +#: whatsnew/3.13.rst:2787 +msgid "" +"``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` or :c:func:" +"`PyEval_SetTraceAllThreads`;" +msgstr "" + +#: whatsnew/3.13.rst:2788 +msgid "``_PyList_Extend()``: :c:func:`PyList_Extend`;" +msgstr "" + +#: whatsnew/3.13.rst:2789 +msgid "``_PyLong_AsInt()``: :c:func:`PyLong_AsInt`;" +msgstr "" + +#: whatsnew/3.13.rst:2790 +msgid "``_PyMem_RawStrdup()``: ``strdup()``;" +msgstr "" + +#: whatsnew/3.13.rst:2791 +msgid "``_PyMem_Strdup()``: ``strdup()``;" +msgstr "" + +#: whatsnew/3.13.rst:2792 +msgid "``_PyObject_ClearManagedDict()``: :c:func:`PyObject_ClearManagedDict`;" +msgstr "" + +#: whatsnew/3.13.rst:2793 +msgid "``_PyObject_VisitManagedDict()``: :c:func:`PyObject_VisitManagedDict`;" +msgstr "" + +#: whatsnew/3.13.rst:2794 +msgid "" +"``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;" +msgstr "" + +#: whatsnew/3.13.rst:2795 +msgid "``_PyTime_AsSecondsDouble()``: :c:func:`PyTime_AsSecondsDouble`;" +msgstr "" + +#: whatsnew/3.13.rst:2796 +msgid "" +"``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` or :c:func:" +"`PyTime_MonotonicRaw`;" +msgstr "" + +#: whatsnew/3.13.rst:2797 +msgid "" +"``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` or :c:func:" +"`PyTime_PerfCounterRaw`;" +msgstr "" + +#: whatsnew/3.13.rst:2798 +msgid "" +"``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` or :c:func:" +"`PyTime_TimeRaw`;" +msgstr "" + +#: whatsnew/3.13.rst:2799 +msgid "``_PyTime_MAX``: :c:var:`PyTime_MAX`;" +msgstr "" + +#: whatsnew/3.13.rst:2800 +msgid "``_PyTime_MIN``: :c:var:`PyTime_MIN`;" +msgstr "" + +#: whatsnew/3.13.rst:2801 +msgid "``_PyTime_t``: :c:type:`PyTime_t`;" +msgstr "" + +#: whatsnew/3.13.rst:2802 +msgid "``_Py_HashPointer()``: :c:func:`Py_HashPointer`;" +msgstr "" + +#: whatsnew/3.13.rst:2803 +msgid "``_Py_IsFinalizing()``: :c:func:`Py_IsFinalizing`." +msgstr "" + +#: whatsnew/3.13.rst:2805 +msgid "" +"The `pythoncapi-compat project`_ can be used to get most of these new " +"functions on Python 3.12 and older." +msgstr "" + +#: whatsnew/3.13.rst:2809 +msgid "Regression Test Changes" +msgstr "" + +#: whatsnew/3.13.rst:2811 +msgid "" +"Python built with :file:`configure` :option:`--with-pydebug` now supports a :" +"option:`-X presite=package.module <-X>` command-line option. If used, it " +"specifies a module that should be imported early in the lifecycle of the " +"interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " +"in :gh:`110769`.)" +msgstr "" diff --git a/whatsnew/3.14.po b/whatsnew/3.14.po new file mode 100644 index 00000000..dc1ca461 --- /dev/null +++ b/whatsnew/3.14.po @@ -0,0 +1,6338 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001 Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.14\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: whatsnew/3.14.rst:4 +msgid "What's new in Python 3.14" +msgstr "" + +#: whatsnew/3.14.rst:0 +msgid "Editors" +msgstr "" + +#: whatsnew/3.14.rst:6 +msgid "Adam Turner and Hugo van Kemenade" +msgstr "" + +#: whatsnew/3.14.rst:48 +msgid "" +"This article explains the new features in Python 3.14, compared to 3.13. " +"Python 3.14 was released on 7 October 2025. For full details, see the :ref:" +"`changelog `." +msgstr "" + +#: whatsnew/3.14.rst:54 +msgid ":pep:`745` -- Python 3.14 release schedule" +msgstr "" + +#: whatsnew/3.14.rst:58 +msgid "Summary -- Release highlights" +msgstr "" + +#: whatsnew/3.14.rst:63 +msgid "" +"Python 3.14 is the latest stable release of the Python programming language, " +"with a mix of changes to the language, the implementation, and the standard " +"library. The biggest changes include :ref:`template string literals " +"`, :ref:`deferred evaluation of " +"annotations `, and support for :ref:" +"`subinterpreters ` in the standard " +"library." +msgstr "" + +#: whatsnew/3.14.rst:72 +msgid "" +"The library changes include significantly improved capabilities for :ref:" +"`introspection in asyncio `, :ref:" +"`support for Zstandard ` via a new :mod:`compression." +"zstd` module, syntax highlighting in the REPL, as well as the usual " +"deprecations and removals, and improvements in user-friendliness and " +"correctness." +msgstr "" + +#: whatsnew/3.14.rst:79 +msgid "" +"This article doesn't attempt to provide a complete specification of all new " +"features, but instead gives a convenient overview. For full details refer to " +"the documentation, such as the :ref:`Library Reference ` and :" +"ref:`Language Reference `. To understand the complete " +"implementation and design rationale for a change, refer to the PEP for a " +"particular new feature; but note that PEPs usually are not kept up-to-date " +"once a feature has been fully implemented. See `Porting to Python 3.14`_ for " +"guidance on upgrading from earlier versions of Python." +msgstr "" + +#: whatsnew/3.14.rst:95 +msgid "Interpreter improvements:" +msgstr "" + +#: whatsnew/3.14.rst:97 +msgid "" +":pep:`649` and :pep:`749`: :ref:`Deferred evaluation of annotations " +"`" +msgstr "" + +#: whatsnew/3.14.rst:99 +msgid "" +":pep:`734`: :ref:`Multiple interpreters in the standard library `" +msgstr "" + +#: whatsnew/3.14.rst:101 +msgid "" +":pep:`750`: :ref:`Template strings `" +msgstr "" + +#: whatsnew/3.14.rst:102 +msgid "" +":pep:`758`: :ref:`Allow except and except* expressions without brackets " +"`" +msgstr "" + +#: whatsnew/3.14.rst:104 +msgid "" +":pep:`765`: :ref:`Control flow in finally blocks `" +msgstr "" + +#: whatsnew/3.14.rst:106 +msgid "" +":pep:`768`: :ref:`Safe external debugger interface for CPython `" +msgstr "" + +#: whatsnew/3.14.rst:108 +msgid ":ref:`A new type of interpreter `" +msgstr "" + +#: whatsnew/3.14.rst:109 +msgid "" +":ref:`Free-threaded mode improvements `" +msgstr "" + +#: whatsnew/3.14.rst:110 +msgid ":ref:`Improved error messages `" +msgstr "" + +#: whatsnew/3.14.rst:111 +msgid ":ref:`Incremental garbage collection `" +msgstr "" + +#: whatsnew/3.14.rst:113 +msgid "Significant improvements in the standard library:" +msgstr "" + +#: whatsnew/3.14.rst:115 +msgid "" +":pep:`784`: :ref:`Zstandard support in the standard library `" +msgstr "" + +#: whatsnew/3.14.rst:117 +msgid ":ref:`whatsnew314-asyncio-introspection`" +msgstr "" + +#: whatsnew/3.14.rst:118 +msgid ":ref:`whatsnew314-concurrent-warnings-control`" +msgstr "" + +#: whatsnew/3.14.rst:119 +msgid "" +":ref:`Syntax highlighting in the default interactive shell `, and color output in several standard library CLIs" +msgstr "" + +#: whatsnew/3.14.rst:123 +msgid "C API improvements:" +msgstr "" + +#: whatsnew/3.14.rst:125 +msgid ":pep:`741`: :ref:`Python configuration C API `" +msgstr "" + +#: whatsnew/3.14.rst:127 +msgid "Platform support:" +msgstr "" + +#: whatsnew/3.14.rst:129 +msgid "" +":pep:`776`: Emscripten is now an :ref:`officially supported platform " +"`, at :pep:`tier 3 <11#tier-3>`." +msgstr "" + +#: whatsnew/3.14.rst:132 +msgid "Release changes:" +msgstr "" + +#: whatsnew/3.14.rst:134 +msgid "" +":pep:`779`: :ref:`Free-threaded Python is officially supported `" +msgstr "" + +#: whatsnew/3.14.rst:136 +msgid "" +":pep:`761`: :ref:`PGP signatures have been discontinued for official " +"releases `" +msgstr "" + +#: whatsnew/3.14.rst:138 +msgid "" +":ref:`Windows and macOS binary releases now support the experimental just-in-" +"time compiler `" +msgstr "" + +#: whatsnew/3.14.rst:140 +msgid "" +":ref:`Binary releases for Android are now provided `" +msgstr "" + +#: whatsnew/3.14.rst:144 +msgid "New features" +msgstr "" + +#: whatsnew/3.14.rst:149 +msgid ":pep:`649` & :pep:`749`: Deferred evaluation of annotations" +msgstr "" + +#: whatsnew/3.14.rst:151 +msgid "" +"The :term:`annotations ` on functions, classes, and modules are " +"no longer evaluated eagerly. Instead, annotations are stored in special-" +"purpose :term:`annotate functions ` and evaluated only " +"when necessary (except if ``from __future__ import annotations`` is used)." +msgstr "" + +#: whatsnew/3.14.rst:156 +msgid "" +"This change is designed to improve performance and usability of annotations " +"in Python in most circumstances. The runtime cost for defining annotations " +"is minimized, but it remains possible to introspect annotations at runtime. " +"It is no longer necessary to enclose annotations in strings if they contain " +"forward references." +msgstr "" + +#: whatsnew/3.14.rst:162 +msgid "" +"The new :mod:`annotationlib` module provides tools for inspecting deferred " +"annotations. Annotations may be evaluated in the :attr:`~annotationlib." +"Format.VALUE` format (which evaluates annotations to runtime values, similar " +"to the behavior in earlier Python versions), the :attr:`~annotationlib." +"Format.FORWARDREF` format (which replaces undefined names with special " +"markers), and the :attr:`~annotationlib.Format.STRING` format (which returns " +"annotations as strings)." +msgstr "" + +#: whatsnew/3.14.rst:169 +msgid "This example shows how these formats behave:" +msgstr "" + +#: whatsnew/3.14.rst:171 +msgid "" +">>> from annotationlib import get_annotations, Format\n" +">>> def func(arg: Undefined):\n" +"... pass\n" +">>> get_annotations(func, format=Format.VALUE)\n" +"Traceback (most recent call last):\n" +" ...\n" +"NameError: name 'Undefined' is not defined\n" +">>> get_annotations(func, format=Format.FORWARDREF)\n" +"{'arg': ForwardRef('Undefined', owner=)}\n" +">>> get_annotations(func, format=Format.STRING)\n" +"{'arg': 'Undefined'}" +msgstr "" + +#: whatsnew/3.14.rst:185 +msgid "" +"The :ref:`porting ` section contains " +"guidance on changes that may be needed due to these changes, though in the " +"majority of cases, code will continue working as-is." +msgstr "" + +#: whatsnew/3.14.rst:189 +msgid "" +"(Contributed by Jelle Zijlstra in :pep:`749` and :gh:`119180`; :pep:`649` " +"was written by Larry Hastings.)" +msgstr "" + +#: whatsnew/3.14.rst:194 +msgid ":pep:`649`" +msgstr "" + +#: whatsnew/3.14.rst:195 +msgid "Deferred Evaluation Of Annotations Using Descriptors" +msgstr "" + +#: whatsnew/3.14.rst:196 +msgid ":pep:`749`" +msgstr "" + +#: whatsnew/3.14.rst:197 +msgid "Implementing PEP 649" +msgstr "" + +#: whatsnew/3.14.rst:203 +msgid ":pep:`734`: Multiple interpreters in the standard library" +msgstr "" + +#: whatsnew/3.14.rst:205 +msgid "" +"The CPython runtime supports running multiple copies of Python in the same " +"process simultaneously and has done so for over 20 years. Each of these " +"separate copies is called an 'interpreter'. However, the feature had been " +"available only through the :ref:`C-API `." +msgstr "" + +#: whatsnew/3.14.rst:211 +msgid "" +"That limitation is removed in Python 3.14, with the new :mod:`concurrent." +"interpreters` module." +msgstr "" + +#: whatsnew/3.14.rst:214 +msgid "" +"There are at least two notable reasons why using multiple interpreters has " +"significant benefits:" +msgstr "" + +#: whatsnew/3.14.rst:217 +msgid "they support a new (to Python), human-friendly concurrency model" +msgstr "" + +#: whatsnew/3.14.rst:218 +msgid "true multi-core parallelism" +msgstr "" + +#: whatsnew/3.14.rst:220 +msgid "" +"For some use cases, concurrency in software improves efficiency and can " +"simplify design, at a high level. At the same time, implementing and " +"maintaining all but the simplest concurrency is often a struggle for the " +"human brain. That especially applies to plain threads (for example, :mod:" +"`threading`), where all memory is shared between all threads." +msgstr "" + +#: whatsnew/3.14.rst:227 +msgid "" +"With multiple isolated interpreters, you can take advantage of a class of " +"concurrency models, like Communicating Sequential Processes (CSP) or the " +"actor model, that have found success in other programming languages, like " +"Smalltalk, Erlang, Haskell, and Go. Think of multiple interpreters as " +"threads but with opt-in sharing." +msgstr "" + +#: whatsnew/3.14.rst:234 +msgid "" +"Regarding multi-core parallelism: as of Python 3.12, interpreters are now " +"sufficiently isolated from one another to be used in parallel (see :pep:" +"`684`). This unlocks a variety of CPU-intensive use cases for Python that " +"were limited by the :term:`GIL`." +msgstr "" + +#: whatsnew/3.14.rst:239 +msgid "" +"Using multiple interpreters is similar in many ways to :mod:" +"`multiprocessing`, in that they both provide isolated logical \"processes\" " +"that can run in parallel, with no sharing by default. However, when using " +"multiple interpreters, an application will use fewer system resources and " +"will operate more efficiently (since it stays within the same process). " +"Think of multiple interpreters as having the isolation of processes with the " +"efficiency of threads." +msgstr "" + +#: whatsnew/3.14.rst:250 +msgid "" +"While the feature has been around for decades, multiple interpreters have " +"not been used widely, due to low awareness and the lack of a standard " +"library module. Consequently, they currently have several notable " +"limitations, which are expected to improve significantly now that the " +"feature is going mainstream." +msgstr "" + +#: whatsnew/3.14.rst:256 +msgid "Current limitations:" +msgstr "" + +#: whatsnew/3.14.rst:258 +msgid "starting each interpreter has not been optimized yet" +msgstr "" + +#: whatsnew/3.14.rst:259 +msgid "" +"each interpreter uses more memory than necessary (work continues on " +"extensive internal sharing between interpreters)" +msgstr "" + +#: whatsnew/3.14.rst:261 +msgid "" +"there aren't many options *yet* for truly sharing objects or other data " +"between interpreters (other than :type:`memoryview`)" +msgstr "" + +#: whatsnew/3.14.rst:263 +msgid "" +"many third-party extension modules on PyPI are not yet compatible with " +"multiple interpreters (all standard library extension modules *are* " +"compatible)" +msgstr "" + +#: whatsnew/3.14.rst:266 +msgid "" +"the approach to writing applications that use multiple isolated interpreters " +"is mostly unfamiliar to Python users, for now" +msgstr "" + +#: whatsnew/3.14.rst:269 +msgid "" +"The impact of these limitations will depend on future CPython improvements, " +"how interpreters are used, and what the community solves through PyPI " +"packages. Depending on the use case, the limitations may not have much " +"impact, so try it out!" +msgstr "" + +#: whatsnew/3.14.rst:274 +msgid "" +"Furthermore, future CPython releases will reduce or eliminate overhead and " +"provide utilities that are less appropriate on PyPI. In the meantime, most " +"of the limitations can also be addressed through extension modules, meaning " +"PyPI packages can fill any gap for 3.14, and even back to 3.12 where " +"interpreters were finally properly isolated and stopped sharing the :term:" +"`GIL`. Likewise, libraries on PyPI are expected to emerge for high-level " +"abstractions on top of interpreters." +msgstr "" + +#: whatsnew/3.14.rst:282 +msgid "" +"Regarding extension modules, work is in progress to update some PyPI " +"projects, as well as tools like Cython, pybind11, nanobind, and PyO3. The " +"steps for isolating an extension module are found at :ref:`isolating-" +"extensions-howto`. Isolating a module has a lot of overlap with what is " +"required to support :ref:`free-threading `, so the ongoing work in the community in that area will help " +"accelerate support for multiple interpreters." +msgstr "" + +#: whatsnew/3.14.rst:291 +msgid "" +"Also added in 3.14: :ref:`concurrent.futures.InterpreterPoolExecutor " +"`." +msgstr "" + +#: whatsnew/3.14.rst:294 +msgid "(Contributed by Eric Snow in :gh:`134939`.)" +msgstr "" + +#: whatsnew/3.14.rst:296 +msgid ":pep:`734`" +msgstr "" + +#: whatsnew/3.14.rst:302 +msgid ":pep:`750`: Template string literals" +msgstr "" + +#: whatsnew/3.14.rst:304 +msgid "" +"Template strings are a new mechanism for custom string processing. They " +"share the familiar syntax of f-strings but, unlike f-strings, return an " +"object representing the static and interpolated parts of the string, instead " +"of a simple :class:`str`." +msgstr "" + +#: whatsnew/3.14.rst:309 +msgid "To write a t-string, use a ``'t'`` prefix instead of an ``'f'``:" +msgstr "" + +#: whatsnew/3.14.rst:311 +msgid "" +">>> variety = 'Stilton'\n" +">>> template = t'Try some {variety} cheese!'\n" +">>> type(template)\n" +"" +msgstr "" + +#: whatsnew/3.14.rst:318 +msgid "" +":class:`~string.templatelib.Template` objects provide access to the static " +"and interpolated (in curly braces) parts of a string *before* they are " +"combined. Iterate over :class:`!Template` instances to access their parts in " +"order:" +msgstr "" + +#: whatsnew/3.14.rst:327 +msgid "" +">>> list(template)\n" +"['Try some ', Interpolation('Stilton', 'variety', None, ''), ' cheese!']" +msgstr "" + +#: whatsnew/3.14.rst:332 +msgid "" +"It's easy to write (or call) code to process :class:`!Template` instances. " +"For example, here's a function that renders static parts lowercase and :" +"class:`~string.templatelib.Interpolation` instances uppercase:" +msgstr "" + +#: whatsnew/3.14.rst:336 +msgid "" +"from string.templatelib import Interpolation\n" +"\n" +"def lower_upper(template):\n" +" \"\"\"Render static parts lowercase and interpolations uppercase.\"\"\"\n" +" parts = []\n" +" for part in template:\n" +" if isinstance(part, Interpolation):\n" +" parts.append(str(part.value).upper())\n" +" else:\n" +" parts.append(part.lower())\n" +" return ''.join(parts)\n" +"\n" +"name = 'Wenslydale'\n" +"template = t'Mister {name}'\n" +"assert lower_upper(template) == 'mister WENSLYDALE'" +msgstr "" + +#: whatsnew/3.14.rst:354 +msgid "" +"Because :class:`!Template` instances distinguish between static strings and " +"interpolations at runtime, they can be useful for sanitising user input. " +"Writing a :func:`!html` function that escapes user input in HTML is an " +"exercise left to the reader! Template processing code can provide improved " +"flexibility. For instance, a more advanced :func:`!html` function could " +"accept a :class:`!dict` of HTML attributes directly in the template:" +msgstr "" + +#: whatsnew/3.14.rst:362 +msgid "" +"attributes = {'src': 'limburger.jpg', 'alt': 'lovely cheese'}\n" +"template = t''\n" +"assert html(template) == '\"lovely'" +msgstr "" + +#: whatsnew/3.14.rst:368 +msgid "" +"Of course, template processing code does not need to return a string-like " +"result. An even *more* advanced :func:`!html` could return a custom type " +"representing a DOM-like structure." +msgstr "" + +#: whatsnew/3.14.rst:372 +msgid "" +"With t-strings in place, developers can write systems that sanitise SQL, " +"make safe shell operations, improve logging, tackle modern ideas in web " +"development (HTML, CSS, and so on), and implement lightweight custom " +"business DSLs." +msgstr "" + +#: whatsnew/3.14.rst:376 +msgid "" +"(Contributed by Jim Baker, Guido van Rossum, Paul Everitt, Koudai Aono, " +"Lysandros Nikolaou, Dave Peck, Adam Turner, Jelle Zijlstra, Bénédikt Tran, " +"and Pablo Galindo Salgado in :gh:`132661`.)" +msgstr "" + +#: whatsnew/3.14.rst:380 +msgid ":pep:`750`." +msgstr "" + +#: whatsnew/3.14.rst:386 +msgid ":pep:`768`: Safe external debugger interface" +msgstr "" + +#: whatsnew/3.14.rst:388 +msgid "" +"Python 3.14 introduces a zero-overhead debugging interface that allows " +"debuggers and profilers to safely attach to running Python processes without " +"stopping or restarting them. This is a significant enhancement to Python's " +"debugging capabilities, meaning that unsafe alternatives are no longer " +"required." +msgstr "" + +#: whatsnew/3.14.rst:394 +msgid "" +"The new interface provides safe execution points for attaching debugger code " +"without modifying the interpreter's normal execution path or adding any " +"overhead at runtime. Due to this, tools can now inspect and interact with " +"Python applications in real-time, which is a crucial capability for high-" +"availability systems and production environments." +msgstr "" + +#: whatsnew/3.14.rst:401 +msgid "" +"For convenience, this interface is implemented in the :func:`sys." +"remote_exec` function. For example:" +msgstr "" + +#: whatsnew/3.14.rst:404 +msgid "" +"import sys\n" +"from tempfile import NamedTemporaryFile\n" +"\n" +"with NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:\n" +" script_path = f.name\n" +" f.write(f'import my_debugger; my_debugger.connect({os.getpid()})')\n" +"\n" +"# Execute in process with PID 1234\n" +"print('Behold! An offering:')\n" +"sys.remote_exec(1234, script_path)" +msgstr "" + +#: whatsnew/3.14.rst:418 +msgid "" +"This function allows sending Python code to be executed in a target process " +"at the next safe execution point. However, tool authors can also implement " +"the protocol directly as described in the PEP, which details the underlying " +"mechanisms used to safely attach to running processes." +msgstr "" + +#: whatsnew/3.14.rst:424 +msgid "" +"The debugging interface has been carefully designed with security in mind " +"and includes several mechanisms to control access:" +msgstr "" + +#: whatsnew/3.14.rst:427 +msgid "A :envvar:`PYTHON_DISABLE_REMOTE_DEBUG` environment variable." +msgstr "" + +#: whatsnew/3.14.rst:428 +msgid "A :option:`-X disable-remote-debug` command-line option." +msgstr "" + +#: whatsnew/3.14.rst:429 +msgid "" +"A :option:`--without-remote-debug` configure flag to completely disable the " +"feature at build time." +msgstr "" + +#: whatsnew/3.14.rst:432 +msgid "" +"(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona Stojanovic " +"in :gh:`131591`.)" +msgstr "" + +#: whatsnew/3.14.rst:435 +msgid ":pep:`768`." +msgstr "" + +#: whatsnew/3.14.rst:441 +msgid "A new type of interpreter" +msgstr "" + +#: whatsnew/3.14.rst:443 +msgid "" +"A new type of interpreter has been added to CPython. It uses tail calls " +"between small C functions that implement individual Python opcodes, rather " +"than one large C ``case`` statement. For certain newer compilers, this " +"interpreter provides significantly better performance. Preliminary " +"benchmarks suggest a geometric mean of 3-5% faster on the standard " +"``pyperformance`` benchmark suite, depending on platform and architecture. " +"The baseline is Python 3.14 built with Clang 19, without this new " +"interpreter." +msgstr "" + +#: whatsnew/3.14.rst:452 +msgid "" +"This interpreter currently only works with Clang 19 and newer on x86-64 and " +"AArch64 architectures. However, a future release of GCC is expected to " +"support this as well." +msgstr "" + +#: whatsnew/3.14.rst:456 +msgid "" +"This feature is opt-in for now. Enabling profile-guided optimization is " +"highly recommendeded when using the new interpreter as it is the only " +"configuration that has been tested and validated for improved performance. " +"For further information, see :option:`--with-tail-call-interp`." +msgstr "" + +#: whatsnew/3.14.rst:463 +msgid "" +"This is not to be confused with `tail call optimization`__ of Python " +"functions, which is currently not implemented in CPython." +msgstr "" + +#: whatsnew/3.14.rst:466 +msgid "" +"This new interpreter type is an internal implementation detail of the " +"CPython interpreter. It doesn't change the visible behavior of Python " +"programs at all. It can improve their performance, but doesn't change " +"anything else." +msgstr "" + +#: whatsnew/3.14.rst:472 +msgid "" +"(Contributed by Ken Jin in :gh:`128563`, with ideas on how to implement this " +"in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.)" +msgstr "" + +#: whatsnew/3.14.rst:479 +msgid "Free-threaded mode improvements" +msgstr "" + +#: whatsnew/3.14.rst:481 +msgid "" +"CPython's free-threaded mode (:pep:`703`), initially added in 3.13, has been " +"significantly improved in Python 3.14. The implementation described in PEP " +"703 has been finished, including C API changes, and temporary workarounds in " +"the interpreter were replaced with more permanent solutions. The " +"specializing adaptive interpreter (:pep:`659`) is now enabled in free-" +"threaded mode, which along with many other optimizations greatly improves " +"its performance. The performance penalty on single-threaded code in free-" +"threaded mode is now roughly 5-10%, depending on the platform and C compiler " +"used." +msgstr "" + +#: whatsnew/3.14.rst:492 +msgid "" +"From Python 3.14, when compiling extension modules for the free-threaded " +"build of CPython on Windows, the preprocessor variable ``Py_GIL_DISABLED`` " +"now needs to be specified by the build backend, as it will no longer be " +"determined automatically by the C compiler. For a running interpreter, the " +"setting that was used at compile time can be found using :func:`sysconfig." +"get_config_var`." +msgstr "" + +#: whatsnew/3.14.rst:498 +msgid "" +"The new :option:`-X context_aware_warnings <-X>` flag controls if :ref:" +"`concurrent safe warnings control ` " +"is enabled. The flag defaults to true for the free-threaded build and false " +"for the GIL-enabled build." +msgstr "" + +#: whatsnew/3.14.rst:503 +msgid "" +"A new :data:`~sys.flags.thread_inherit_context` flag has been added, which " +"if enabled means that threads created with :class:`threading.Thread` start " +"with a copy of the :class:`~contextvars.Context()` of the caller of :meth:" +"`~threading.Thread.start`. Most significantly, this makes the warning " +"filtering context established by :class:`~warnings.catch_warnings` be " +"\"inherited\" by threads (or asyncio tasks) started within that context. It " +"also affects other modules that use context variables, such as the :mod:" +"`decimal` context manager. This flag defaults to true for the free-threaded " +"build and false for the GIL-enabled build." +msgstr "" + +#: whatsnew/3.14.rst:514 +msgid "" +"(Contributed by Sam Gross, Matt Page, Neil Schemenauer, Thomas Wouters, " +"Donghee Na, Kirill Podoprigora, Ken Jin, Itamar Oren, Brett Simmers, Dino " +"Viehland, Nathan Goldbaum, Ralf Gommers, Lysandros Nikolaou, Kumar Aditya, " +"Edgar Margffoy, and many others. Some of these contributors are employed by " +"Meta, which has continued to provide significant engineering resources to " +"support this project.)" +msgstr "" + +#: whatsnew/3.14.rst:525 +msgid "Improved error messages" +msgstr "" + +#: whatsnew/3.14.rst:527 +msgid "" +"The interpreter now provides helpful suggestions when it detects typos in " +"Python keywords. When a word that closely resembles a Python keyword is " +"encountered, the interpreter will suggest the correct keyword in the error " +"message. This feature helps programmers quickly identify and fix common " +"typing mistakes. For example:" +msgstr "" + +#: whatsnew/3.14.rst:533 +msgid "" +">>> whille True:\n" +"... pass\n" +"Traceback (most recent call last):\n" +" File \"\", line 1\n" +" whille True:\n" +" ^^^^^^\n" +"SyntaxError: invalid syntax. Did you mean 'while'?" +msgstr "" + +#: whatsnew/3.14.rst:543 +msgid "" +"While the feature focuses on the most common cases, some variations of " +"misspellings may still result in regular syntax errors. (Contributed by " +"Pablo Galindo in :gh:`132449`.)" +msgstr "" + +#: whatsnew/3.14.rst:547 +msgid "" +":keyword:`elif` statements that follow an :keyword:`else` block now have a " +"specific error message. (Contributed by Steele Farnsworth in :gh:`129902`.)" +msgstr "" + +#: whatsnew/3.14.rst:551 +msgid "" +">>> if who == \"me\":\n" +"... print(\"It's me!\")\n" +"... else:\n" +"... print(\"It's not me!\")\n" +"... elif who is None:\n" +"... print(\"Who is it?\")\n" +"File \"\", line 5\n" +" elif who is None:\n" +" ^^^^\n" +"SyntaxError: 'elif' block follows an 'else' block" +msgstr "" + +#: whatsnew/3.14.rst:564 +msgid "" +"If a statement is passed to the :ref:`if_expr` after :keyword:`else`, or one " +"of :keyword:`pass`, :keyword:`break`, or :keyword:`continue` is passed " +"before :keyword:`if`, then the error message highlights where the :token:" +"`~python-grammar:expression` is required. (Contributed by Sergey Miryanov " +"in :gh:`129515`.)" +msgstr "" + +#: whatsnew/3.14.rst:570 +msgid "" +">>> x = 1 if True else pass\n" +"Traceback (most recent call last):\n" +" File \"\", line 1\n" +" x = 1 if True else pass\n" +" ^^^^\n" +"SyntaxError: expected expression after 'else', but statement is given\n" +"\n" +">>> x = continue if True else break\n" +"Traceback (most recent call last):\n" +" File \"\", line 1\n" +" x = continue if True else break\n" +" ^^^^^^^^\n" +"SyntaxError: expected expression before 'if', but statement is given" +msgstr "" + +#: whatsnew/3.14.rst:586 +msgid "" +"When incorrectly closed strings are detected, the error message suggests " +"that the string may be intended to be part of the string. (Contributed by " +"Pablo Galindo in :gh:`88535`.)" +msgstr "" + +#: whatsnew/3.14.rst:590 +msgid "" +">>> \"The interesting object \"The important object\" is very important\"\n" +"Traceback (most recent call last):\n" +"SyntaxError: invalid syntax. Is this intended to be part of the string?" +msgstr "" + +#: whatsnew/3.14.rst:596 +msgid "" +"When strings have incompatible prefixes, the error now shows which prefixes " +"are incompatible. (Contributed by Nikita Sobolev in :gh:`133197`.)" +msgstr "" + +#: whatsnew/3.14.rst:600 +msgid "" +">>> ub'abc'\n" +" File \"\", line 1\n" +" ub'abc'\n" +" ^^\n" +"SyntaxError: 'u' and 'b' prefixes are incompatible" +msgstr "" + +#: whatsnew/3.14.rst:608 +msgid "Improved error messages when using ``as`` with incompatible targets in:" +msgstr "" + +#: whatsnew/3.14.rst:610 +msgid "Imports: ``import ... as ...``" +msgstr "" + +#: whatsnew/3.14.rst:611 +msgid "From imports: ``from ... import ... as ...``" +msgstr "" + +#: whatsnew/3.14.rst:612 +msgid "Except handlers: ``except ... as ...``" +msgstr "" + +#: whatsnew/3.14.rst:613 +msgid "Pattern-match cases: ``case ... as ...``" +msgstr "" + +#: whatsnew/3.14.rst:615 +msgid "" +"(Contributed by Nikita Sobolev in :gh:`123539`, :gh:`123562`, and :gh:" +"`123440`.)" +msgstr "" + +#: whatsnew/3.14.rst:617 +msgid "" +"Improved error message when trying to add an instance of an unhashable type " +"to a :class:`dict` or :class:`set`. (Contributed by CF Bolz-Tereick and " +"Victor Stinner in :gh:`132828`.)" +msgstr "" + +#: whatsnew/3.14.rst:621 +msgid "" +">>> s = set()\n" +">>> s.add({'pages': 12, 'grade': 'A'})\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" s.add({'pages': 12, 'grade': 'A'})\n" +" ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"TypeError: cannot use 'dict' as a set element (unhashable type: 'dict')\n" +">>> d = {}\n" +">>> l = [1, 2, 3]\n" +">>> d[l] = 12\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" d[l] = 12\n" +" ~^^^\n" +"TypeError: cannot use 'list' as a dict key (unhashable type: 'list')" +msgstr "" + +#: whatsnew/3.14.rst:639 +msgid "" +"Improved error message when an object supporting the synchronous context " +"manager protocol is entered using :keyword:`async with` instead of :keyword:" +"`with`, and vice versa for the asynchronous context manager protocol. " +"(Contributed by Bénédikt Tran in :gh:`128398`.)" +msgstr "" + +#: whatsnew/3.14.rst:649 +msgid ":pep:`784`: Zstandard support in the standard library" +msgstr "" + +#: whatsnew/3.14.rst:651 +msgid "" +"The new :mod:`!compression` package contains modules :mod:`!compression." +"lzma`, :mod:`!compression.bz2`, :mod:`!compression.gzip` and :mod:`!" +"compression.zlib` which re-export the :mod:`lzma`, :mod:`bz2`, :mod:`gzip` " +"and :mod:`zlib` modules respectively. The new import names under :mod:`!" +"compression` are the preferred names for importing these compression modules " +"from Python 3.14. However, the existing modules names have not been " +"deprecated. Any deprecation or removal of the existing compression modules " +"will occur no sooner than five years after the release of 3.14." +msgstr "" + +#: whatsnew/3.14.rst:660 +msgid "" +"The new :mod:`!compression.zstd` module provides compression and " +"decompression APIs for the Zstandard format via bindings to `Meta's zstd " +"library `__. Zstandard is a widely " +"adopted, highly efficient, and fast compression format. In addition to the " +"APIs introduced in :mod:`!compression.zstd`, support for reading and writing " +"Zstandard compressed archives has been added to the :mod:`tarfile`, :mod:" +"`zipfile`, and :mod:`shutil` modules." +msgstr "" + +#: whatsnew/3.14.rst:668 +msgid "Here's an example of using the new module to compress some data:" +msgstr "" + +#: whatsnew/3.14.rst:670 +msgid "" +"from compression import zstd\n" +"import math\n" +"\n" +"data = str(math.pi).encode() * 20\n" +"compressed = zstd.compress(data)\n" +"ratio = len(compressed) / len(data)\n" +"print(f\"Achieved compression ratio of {ratio}\")" +msgstr "" + +#: whatsnew/3.14.rst:680 +msgid "" +"As can be seen, the API is similar to the APIs of the :mod:`!lzma` and :mod:" +"`!bz2` modules." +msgstr "" + +#: whatsnew/3.14.rst:683 +msgid "" +"(Contributed by Emma Harper Smith, Adam Turner, Gregory P. Smith, Tomas " +"Roun, Victor Stinner, and Rogdham in :gh:`132983`.)" +msgstr "" + +#: whatsnew/3.14.rst:686 +msgid ":pep:`784`." +msgstr "" + +#: whatsnew/3.14.rst:692 +msgid "Asyncio introspection capabilities" +msgstr "" + +#: whatsnew/3.14.rst:694 +msgid "" +"Added a new command-line interface to inspect running Python processes using " +"asynchronous tasks, available via ``python -m asyncio ps PID`` or ``python -" +"m asyncio pstree PID``." +msgstr "" + +#: whatsnew/3.14.rst:698 +msgid "" +"The ``ps`` subcommand inspects the given process ID (PID) and displays " +"information about currently running asyncio tasks. It outputs a task table: " +"a flat listing of all tasks, their names, their coroutine stacks, and which " +"tasks are awaiting them." +msgstr "" + +#: whatsnew/3.14.rst:704 +msgid "" +"The ``pstree`` subcommand fetches the same information, but instead renders " +"a visual async call tree, showing coroutine relationships in a hierarchical " +"format. This command is particularly useful for debugging long-running or " +"stuck asynchronous programs. It can help developers quickly identify where a " +"program is blocked, what tasks are pending, and how coroutines are chained " +"together." +msgstr "" + +#: whatsnew/3.14.rst:711 +msgid "For example given this code:" +msgstr "" + +#: whatsnew/3.14.rst:713 +msgid "" +"import asyncio\n" +"\n" +"async def play_track(track):\n" +" await asyncio.sleep(5)\n" +" print(f'🎵 Finished: {track}')\n" +"\n" +"async def play_album(name, tracks):\n" +" async with asyncio.TaskGroup() as tg:\n" +" for track in tracks:\n" +" tg.create_task(play_track(track), name=track)\n" +"\n" +"async def main():\n" +" async with asyncio.TaskGroup() as tg:\n" +" tg.create_task(\n" +" play_album('Sundowning', ['TNDNBTG', 'Levitate']),\n" +" name='Sundowning')\n" +" tg.create_task(\n" +" play_album('TMBTE', ['DYWTYLM', 'Aqua Regia']),\n" +" name='TMBTE')\n" +"\n" +"if __name__ == '__main__':\n" +" asyncio.run(main())" +msgstr "" + +#: whatsnew/3.14.rst:738 +msgid "" +"Executing the new tool on the running process will yield a table like this:" +msgstr "" + +#: whatsnew/3.14.rst:740 +msgid "" +"python -m asyncio ps 12345\n" +"\n" +"tid task id task name coroutine " +"stack awaiter " +"chain awaiter name awaiter id\n" +"------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n" +"1935500 0x7fc930c18050 Task-1 TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> " +"main " +"0x0\n" +"1935500 0x7fc930c18230 Sundowning TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> " +"main Task-1 0x7fc930c18050\n" +"1935500 0x7fc93173fa50 TMBTE TaskGroup._aexit -> " +"TaskGroup.__aexit__ -> album TaskGroup._aexit -> TaskGroup.__aexit__ -> " +"main Task-1 0x7fc930c18050\n" +"1935500 0x7fc93173fdf0 TNDNBTG sleep -> " +"play TaskGroup._aexit -> TaskGroup." +"__aexit__ -> album Sundowning 0x7fc930c18230\n" +"1935500 0x7fc930d32510 Levitate sleep -> " +"play TaskGroup._aexit -> TaskGroup." +"__aexit__ -> album Sundowning 0x7fc930c18230\n" +"1935500 0x7fc930d32890 DYWTYLM sleep -> " +"play TaskGroup._aexit -> TaskGroup." +"__aexit__ -> album TMBTE 0x7fc93173fa50\n" +"1935500 0x7fc93161ec30 Aqua Regia sleep -> " +"play TaskGroup._aexit -> TaskGroup." +"__aexit__ -> album TMBTE 0x7fc93173fa50" +msgstr "" + +#: whatsnew/3.14.rst:754 +msgid "or a tree like this:" +msgstr "" + +#: whatsnew/3.14.rst:756 +msgid "" +"python -m asyncio pstree 12345\n" +"\n" +"└── (T) Task-1\n" +" └── main example.py:13\n" +" └── TaskGroup.__aexit__ Lib/asyncio/taskgroups.py:72\n" +" └── TaskGroup._aexit Lib/asyncio/taskgroups.py:121\n" +" ├── (T) Sundowning\n" +" │ └── album example.py:8\n" +" │ └── TaskGroup.__aexit__ Lib/asyncio/taskgroups." +"py:72\n" +" │ └── TaskGroup._aexit Lib/asyncio/taskgroups." +"py:121\n" +" │ ├── (T) TNDNBTG\n" +" │ │ └── play example.py:4\n" +" │ │ └── sleep Lib/asyncio/tasks.py:702\n" +" │ └── (T) Levitate\n" +" │ └── play example.py:4\n" +" │ └── sleep Lib/asyncio/tasks.py:702\n" +" └── (T) TMBTE\n" +" └── album example.py:8\n" +" └── TaskGroup.__aexit__ Lib/asyncio/taskgroups." +"py:72\n" +" └── TaskGroup._aexit Lib/asyncio/taskgroups." +"py:121\n" +" ├── (T) DYWTYLM\n" +" │ └── play example.py:4\n" +" │ └── sleep Lib/asyncio/tasks.py:702\n" +" └── (T) Aqua Regia\n" +" └── play example.py:4\n" +" └── sleep Lib/asyncio/tasks.py:702" +msgstr "" + +#: whatsnew/3.14.rst:785 +msgid "" +"If a cycle is detected in the async await graph (which could indicate a " +"programming issue), the tool raises an error and lists the cycle paths that " +"prevent tree construction:" +msgstr "" + +#: whatsnew/3.14.rst:789 +msgid "" +"python -m asyncio pstree 12345\n" +"\n" +"ERROR: await-graph contains cycles - cannot print a tree!\n" +"\n" +"cycle: Task-2 → Task-3 → Task-2" +msgstr "" + +#: whatsnew/3.14.rst:797 +msgid "" +"(Contributed by Pablo Galindo, Łukasz Langa, Yury Selivanov, and Marta Gomez " +"Macias in :gh:`91048`.)" +msgstr "" + +#: whatsnew/3.14.rst:804 +msgid "Concurrent safe warnings control" +msgstr "" + +#: whatsnew/3.14.rst:806 +msgid "" +"The :class:`warnings.catch_warnings` context manager will now optionally use " +"a context variable for warning filters. This is enabled by setting the :data:" +"`~sys.flags.context_aware_warnings` flag, either with the ``-X`` command-" +"line option or an environment variable. This gives predictable warnings " +"control when using :class:`~warnings.catch_warnings` combined with multiple " +"threads or asynchronous tasks. The flag defaults to true for the free-" +"threaded build and false for the GIL-enabled build." +msgstr "" + +#: whatsnew/3.14.rst:814 +msgid "(Contributed by Neil Schemenauer and Kumar Aditya in :gh:`130010`.)" +msgstr "" + +#: whatsnew/3.14.rst:818 +msgid "Other language changes" +msgstr "" + +#: whatsnew/3.14.rst:820 +msgid "" +"All Windows code pages are now supported as 'cpXXX' codecs on Windows. " +"(Contributed by Serhiy Storchaka in :gh:`123803`.)" +msgstr "" + +#: whatsnew/3.14.rst:823 +msgid "" +"Implement mixed-mode arithmetic rules combining real and complex numbers as " +"specified by the C standard since C99. (Contributed by Sergey B Kirpichev " +"in :gh:`69639`.)" +msgstr "" + +#: whatsnew/3.14.rst:827 +msgid "" +"More syntax errors are now detected regardless of optimisation and the :" +"option:`-O` command-line option. This includes writes to ``__debug__``, " +"incorrect use of :keyword:`await`, and asynchronous comprehensions outside " +"asynchronous functions. For example, ``python -O -c 'assert (__debug__ := " +"1)'`` or ``python -O -c 'assert await 1'`` now produce :exc:`SyntaxError`\\ " +"s. (Contributed by Irit Katriel and Jelle Zijlstra in :gh:`122245` & :gh:" +"`121637`.)" +msgstr "" + +#: whatsnew/3.14.rst:835 +msgid "" +"When subclassing a pure C type, the C slots for the new type are no longer " +"replaced with a wrapped version on class creation if they are not explicitly " +"overridden in the subclass. (Contributed by Tomasz Pytel in :gh:`132284`.)" +msgstr "" + +#: whatsnew/3.14.rst:842 +msgid "Built-ins" +msgstr "" + +#: whatsnew/3.14.rst:844 +msgid "" +"The :meth:`bytes.fromhex` and :meth:`bytearray.fromhex` methods now accept " +"ASCII :class:`bytes` and :term:`bytes-like objects `. " +"(Contributed by Daniel Pope in :gh:`129349`.)" +msgstr "" + +#: whatsnew/3.14.rst:848 +msgid "" +"Add class methods :meth:`float.from_number` and :meth:`complex.from_number` " +"to convert a number to :class:`float` or :class:`complex` type " +"correspondingly. They raise a :exc:`TypeError` if the argument is not a real " +"number. (Contributed by Serhiy Storchaka in :gh:`84978`.)" +msgstr "" + +#: whatsnew/3.14.rst:853 +msgid "" +"Support underscore and comma as thousands separators in the fractional part " +"for floating-point presentation types of the new-style string formatting " +"(with :func:`format` or :ref:`f-strings`). (Contributed by Sergey B " +"Kirpichev in :gh:`87790`.)" +msgstr "" + +#: whatsnew/3.14.rst:858 +msgid "" +"The :func:`int` function no longer delegates to :meth:`~object.__trunc__`. " +"Classes that want to support conversion to :func:`!int` must implement " +"either :meth:`~object.__int__` or :meth:`~object.__index__`. (Contributed by " +"Mark Dickinson in :gh:`119743`.)" +msgstr "" + +#: whatsnew/3.14.rst:863 +msgid "" +"The :func:`map` function now has an optional keyword-only *strict* flag " +"like :func:`zip` to check that all the iterables are of equal length. " +"(Contributed by Wannes Boeykens in :gh:`119793`.)" +msgstr "" + +#: whatsnew/3.14.rst:867 +msgid "" +"The :class:`memoryview` type now supports subscription, making it a :term:" +"`generic type`. (Contributed by Brian Schubert in :gh:`126012`.)" +msgstr "" + +#: whatsnew/3.14.rst:871 +msgid "" +"Using :data:`NotImplemented` in a boolean context will now raise a :exc:" +"`TypeError`. This has raised a :exc:`DeprecationWarning` since Python 3.9. " +"(Contributed by Jelle Zijlstra in :gh:`118767`.)" +msgstr "" + +#: whatsnew/3.14.rst:876 +msgid "" +"Three-argument :func:`pow` now tries calling :meth:`~object.__rpow__` if " +"necessary. Previously it was only called in two-argument :func:`!pow` and " +"the binary power operator. (Contributed by Serhiy Storchaka in :gh:`130104`.)" +msgstr "" + +#: whatsnew/3.14.rst:882 +msgid "" +":class:`super` objects are now :mod:`copyable ` and :mod:`pickleable " +"`. (Contributed by Serhiy Storchaka in :gh:`125767`.)" +msgstr "" + +#: whatsnew/3.14.rst:888 +msgid "Command line and environment" +msgstr "" + +#: whatsnew/3.14.rst:890 +msgid "" +"The import time flag can now track modules that are already loaded " +"('cached'), via the new :option:`-X importtime=2 <-X>`. When such a module " +"is imported, the ``self`` and ``cumulative`` times are replaced by the " +"string ``cached``." +msgstr "" + +#: whatsnew/3.14.rst:895 +msgid "" +"Values above ``2`` for ``-X importtime`` are now reserved for future use." +msgstr "" + +#: whatsnew/3.14.rst:897 +msgid "(Contributed by Noah Kim and Adam Turner in :gh:`118655`.)" +msgstr "" + +#: whatsnew/3.14.rst:899 +msgid "" +"The command-line option :option:`-c` now automatically dedents its code " +"argument before execution. The auto-dedentation behavior mirrors :func:" +"`textwrap.dedent`. (Contributed by Jon Crall and Steven Sun in :gh:`103998`.)" +msgstr "" + +#: whatsnew/3.14.rst:904 +msgid "" +":option:`!-J` is no longer a reserved flag for Jython_, and now has no " +"special meaning. (Contributed by Adam Turner in :gh:`133336`.)" +msgstr "" + +#: whatsnew/3.14.rst:914 +msgid "PEP 758: Allow ``except`` and ``except*`` expressions without brackets" +msgstr "" + +#: whatsnew/3.14.rst:916 +msgid "" +"The :keyword:`except` and :keyword:`except* ` expressions now " +"allow brackets to be omitted when there are multiple exception types and the " +"``as`` clause is not used. For example:" +msgstr "" + +#: whatsnew/3.14.rst:921 +msgid "" +"try:\n" +" connect_to_server()\n" +"except TimeoutError, ConnectionRefusedError:\n" +" print('The network has ceased to be!')" +msgstr "" + +#: whatsnew/3.14.rst:928 +msgid "" +"(Contributed by Pablo Galindo and Brett Cannon in :pep:`758` and :gh:" +"`131831`.)" +msgstr "" + +#: whatsnew/3.14.rst:934 +msgid "PEP 765: Control flow in :keyword:`finally` blocks" +msgstr "" + +#: whatsnew/3.14.rst:936 +msgid "" +"The compiler now emits a :exc:`SyntaxWarning` when a :keyword:`return`, :" +"keyword:`break`, or :keyword:`continue` statement have the effect of leaving " +"a :keyword:`finally` block. This change is specified in :pep:`765`." +msgstr "" + +#: whatsnew/3.14.rst:941 +msgid "" +"In situations where this change is inconvenient (such as those where the " +"warnings are redundant due to code linting), the :ref:`warning filter " +"` can be used to turn off all syntax warnings by adding " +"``ignore::SyntaxWarning`` as a filter. This can be specified in combination " +"with a filter that converts other warnings to errors (for example, passing " +"``-Werror -Wignore::SyntaxWarning`` as CLI options, or setting " +"``PYTHONWARNINGS=error,ignore::SyntaxWarning``)." +msgstr "" + +#: whatsnew/3.14.rst:949 +msgid "" +"Note that applying such a filter at runtime using the :mod:`warnings` module " +"will only suppress the warning in code that is compiled *after* the filter " +"is adjusted. Code that is compiled prior to the filter adjustment (for " +"example, when a module is imported) will still emit the syntax warning." +msgstr "" + +#: whatsnew/3.14.rst:954 +msgid "(Contributed by Irit Katriel in :gh:`130080`.)" +msgstr "" + +#: whatsnew/3.14.rst:960 +msgid "Incremental garbage collection" +msgstr "" + +#: whatsnew/3.14.rst:962 +msgid "" +"The cycle garbage collector is now incremental. This means that maximum " +"pause times are reduced by an order of magnitude or more for larger heaps." +msgstr "" + +#: whatsnew/3.14.rst:966 +msgid "" +"There are now only two generations: young and old. When :func:`gc.collect` " +"is not called directly, the GC is invoked a little less frequently. When " +"invoked, it collects the young generation and an increment of the old " +"generation, instead of collecting one or more generations." +msgstr "" + +#: whatsnew/3.14.rst:972 +msgid "The behavior of :func:`!gc.collect` changes slightly:" +msgstr "" + +#: whatsnew/3.14.rst:3267 +msgid "" +"``gc.collect(1)``: Performs an increment of garbage collection, rather than " +"collecting generation 1." +msgstr "" + +#: whatsnew/3.14.rst:3269 +msgid "Other calls to :func:`!gc.collect` are unchanged." +msgstr "" + +#: whatsnew/3.14.rst:2236 +msgid "(Contributed by Mark Shannon in :gh:`108362`.)" +msgstr "" + +#: whatsnew/3.14.rst:982 +msgid "Default interactive shell" +msgstr "" + +#: whatsnew/3.14.rst:986 +msgid "" +"The default :term:`interactive` shell now highlights Python syntax. The " +"feature is enabled by default, save if :envvar:`PYTHON_BASIC_REPL` or any " +"other environment variable that disables colour is set. See :ref:`using-on-" +"controlling-color` for details." +msgstr "" + +#: whatsnew/3.14.rst:991 +msgid "" +"The default color theme for syntax highlighting strives for good contrast " +"and exclusively uses the 4-bit VGA standard ANSI color codes for maximum " +"compatibility. The theme can be customized using an experimental API :func:`!" +"_colorize.set_theme`. This can be called interactively or in the :envvar:" +"`PYTHONSTARTUP` script. Note that this function has no stability guarantees, " +"and may change or be removed." +msgstr "" + +#: whatsnew/3.14.rst:999 +msgid "(Contributed by Łukasz Langa in :gh:`131507`.)" +msgstr "" + +#: whatsnew/3.14.rst:1001 +msgid "" +"The default :term:`interactive` shell now supports import auto-completion. " +"This means that typing ``import co`` and pressing :kbd:`` will suggest " +"modules starting with ``co``. Similarly, typing ``from concurrent import i`` " +"will suggest submodules of ``concurrent`` starting with ``i``. Note that " +"autocompletion of module attributes is not currently supported. (Contributed " +"by Tomas Roun in :gh:`69605`.)" +msgstr "" + +#: whatsnew/3.14.rst:1010 +msgid "New modules" +msgstr "" + +#: whatsnew/3.14.rst:1012 +msgid "" +":mod:`annotationlib`: For introspecting :term:`annotations `. " +"See :ref:`PEP 749 ` for more details. " +"(Contributed by Jelle Zijlstra in :gh:`119180`.)" +msgstr "" + +#: whatsnew/3.14.rst:1017 +msgid "" +":mod:`compression` (including :mod:`compression.zstd`): A package for " +"compression-related modules, including a new module to support the Zstandard " +"compression format. See :ref:`PEP 784 ` for more " +"details. (Contributed by Emma Harper Smith, Adam Turner, Gregory P. Smith, " +"Tomas Roun, Victor Stinner, and Rogdham in :gh:`132983`.)" +msgstr "" + +#: whatsnew/3.14.rst:1024 +msgid "" +":mod:`concurrent.interpreters`: Support for multiple interpreters in the " +"standard library. See :ref:`PEP 734 ` for " +"more details. (Contributed by Eric Snow in :gh:`134939`.)" +msgstr "" + +#: whatsnew/3.14.rst:1029 +msgid "" +":mod:`string.templatelib`: Support for template string literals (t-strings). " +"See :ref:`PEP 750 ` for more details. " +"(Contributed by Jim Baker, Guido van Rossum, Paul Everitt, Koudai Aono, " +"Lysandros Nikolaou, Dave Peck, Adam Turner, Jelle Zijlstra, Bénédikt Tran, " +"and Pablo Galindo Salgado in :gh:`132661`.)" +msgstr "" + +#: whatsnew/3.14.rst:1038 +msgid "Improved modules" +msgstr "" + +#: whatsnew/3.14.rst:2301 +msgid "argparse" +msgstr "" + +#: whatsnew/3.14.rst:1043 +msgid "" +"The default value of the :ref:`program name ` for :class:`argparse." +"ArgumentParser` now reflects the way the Python interpreter was instructed " +"to find the ``__main__`` module code. (Contributed by Serhiy Storchaka and " +"Alyssa Coghlan in :gh:`66436`.)" +msgstr "" + +#: whatsnew/3.14.rst:1048 +msgid "" +"Introduced the optional *suggest_on_error* parameter to :class:`argparse." +"ArgumentParser`, enabling suggestions for argument choices and subparser " +"names if mistyped by the user. (Contributed by Savannah Ostrowski in :gh:" +"`124456`.)" +msgstr "" + +#: whatsnew/3.14.rst:1053 +msgid "" +"Enable color for help text, which can be disabled with the optional *color* " +"parameter to :class:`argparse.ArgumentParser`. This can also be controlled " +"by :ref:`environment variables `. (Contributed " +"by Hugo van Kemenade in :gh:`130645`.)" +msgstr "" + +#: whatsnew/3.14.rst:2320 +msgid "ast" +msgstr "" + +#: whatsnew/3.14.rst:1063 +msgid "" +"Add :func:`~ast.compare`, a function for comparing two ASTs. (Contributed by " +"Batuhan Taskaya and Jeremy Hylton in :gh:`60191`.)" +msgstr "" + +#: whatsnew/3.14.rst:1066 +msgid "" +"Add support for :func:`copy.replace` for AST nodes. (Contributed by Bénédikt " +"Tran in :gh:`121141`.)" +msgstr "" + +#: whatsnew/3.14.rst:1069 +msgid "" +"Docstrings are now removed from an optimized AST in optimization level 2. " +"(Contributed by Irit Katriel in :gh:`123958`.)" +msgstr "" + +#: whatsnew/3.14.rst:1072 +msgid "" +"The :func:`repr` output for AST nodes now includes more information. " +"(Contributed by Tomas Roun in :gh:`116022`.)" +msgstr "" + +#: whatsnew/3.14.rst:1075 +msgid "" +"When called with an AST as input, the :func:`~ast.parse` function now always " +"verifies that the root node type is appropriate. (Contributed by Irit " +"Katriel in :gh:`130139`.)" +msgstr "" + +#: whatsnew/3.14.rst:1079 +msgid "" +"Add new options to the command-line interface: :option:`--feature-version " +"`, :option:`--optimize `, and :option:" +"`--show-empty `. (Contributed by Semyon Moroz in :gh:" +"`133367`.)" +msgstr "" + +#: whatsnew/3.14.rst:2162 whatsnew/3.14.rst:2351 +msgid "asyncio" +msgstr "" + +#: whatsnew/3.14.rst:1089 +msgid "" +"The function and methods named :func:`!create_task` now take an arbitrary " +"list of keyword arguments. All keyword arguments are passed to the :class:" +"`~asyncio.Task` constructor or the custom task factory. (See :meth:`~asyncio." +"loop.set_task_factory` for details.) The ``name`` and ``context`` keyword " +"arguments are no longer special; the name should now be set using the " +"``name`` keyword argument of the factory, and ``context`` may be ``None``." +msgstr "" + +#: whatsnew/3.14.rst:1097 +msgid "" +"This affects the following function and methods: :meth:`asyncio." +"create_task`, :meth:`asyncio.loop.create_task`, :meth:`asyncio.TaskGroup." +"create_task`." +msgstr "" + +#: whatsnew/3.14.rst:1102 +msgid "(Contributed by Thomas Grainger in :gh:`128307`.)" +msgstr "" + +#: whatsnew/3.14.rst:1104 +msgid "" +"There are two new utility functions for introspecting and printing a " +"program's call graph: :func:`~asyncio.capture_call_graph` and :func:" +"`~asyncio.print_call_graph`. See :ref:`Asyncio introspection capabilities " +"` for more details. (Contributed by Yury " +"Selivanov, Pablo Galindo Salgado, and Łukasz Langa in :gh:`91048`.)" +msgstr "" + +#: whatsnew/3.14.rst:1114 +msgid "calendar" +msgstr "" + +#: whatsnew/3.14.rst:1118 +msgid "" +"By default, today's date is highlighted in color in :mod:`calendar`'s :ref:" +"`command-line ` text output. This can be controlled by :ref:" +"`environment variables `. (Contributed by Hugo " +"van Kemenade in :gh:`128317`.)" +msgstr "" + +#: whatsnew/3.14.rst:1126 +msgid "concurrent.futures" +msgstr "" + +#: whatsnew/3.14.rst:1130 +msgid "" +"Add a new executor class, :class:`~concurrent.futures." +"InterpreterPoolExecutor`, which exposes multiple Python interpreters in the " +"same process ('subinterpreters') to Python code. This uses a pool of " +"independent Python interpreters to execute calls asynchronously." +msgstr "" + +#: whatsnew/3.14.rst:1136 +msgid "" +"This is separate from the new :mod:`~concurrent.interpreters` module " +"introduced by :ref:`PEP 734 `. " +"(Contributed by Eric Snow in :gh:`124548`.)" +msgstr "" + +#: whatsnew/3.14.rst:1142 +msgid "" +"On Unix platforms other than macOS, :ref:`'forkserver' ` is now the default :ref:`start method " +"` for :class:`~concurrent.futures." +"ProcessPoolExecutor` (replacing :ref:`'fork' `). This change does not affect Windows or macOS, where :ref:`'spawn' " +"` remains the default start method." +msgstr "" + +#: whatsnew/3.14.rst:1150 +msgid "" +"If the threading incompatible *fork* method is required, you must explicitly " +"request it by supplying a multiprocessing context *mp_context* to :class:" +"`~concurrent.futures.ProcessPoolExecutor`." +msgstr "" + +#: whatsnew/3.14.rst:1604 +msgid "" +"See :ref:`forkserver restrictions ` " +"for information and differences with the *fork* method and how this change " +"may affect existing code with mutable global shared variables and/or shared " +"objects that can not be automatically :mod:`pickled `." +msgstr "" + +#: whatsnew/3.14.rst:1609 +msgid "(Contributed by Gregory P. Smith in :gh:`84559`.)" +msgstr "" + +#: whatsnew/3.14.rst:1161 +msgid "" +"Add two new methods to :class:`~concurrent.futures.ProcessPoolExecutor`, :" +"meth:`~concurrent.futures.ProcessPoolExecutor.terminate_workers` and :meth:" +"`~concurrent.futures.ProcessPoolExecutor.kill_workers`, as ways to terminate " +"or kill all living worker processes in the given pool. (Contributed by " +"Charles Machalow in :gh:`130849`.)" +msgstr "" + +#: whatsnew/3.14.rst:1167 +msgid "" +"Add the optional *buffersize* parameter to :meth:`Executor.map ` to limit the number of submitted tasks whose results " +"have not yet been yielded. If the buffer is full, iteration over the " +"*iterables* pauses until a result is yielded from the buffer. (Contributed " +"by Enzo Bonnal and Josh Rosenberg in :gh:`74028`.)" +msgstr "" + +#: whatsnew/3.14.rst:1176 +msgid "configparser" +msgstr "" + +#: whatsnew/3.14.rst:1178 +msgid "" +":mod:`!configparser` will no longer write config files it cannot read, to " +"improve security. Attempting to :meth:`~configparser.ConfigParser.write` " +"keys containing delimiters or beginning with the section header pattern will " +"raise an :class:`~configparser.InvalidWriteError`. (Contributed by Jacob " +"Lincoln in :gh:`129270`.)" +msgstr "" + +#: whatsnew/3.14.rst:1187 +msgid "contextvars" +msgstr "" + +#: whatsnew/3.14.rst:1189 +msgid "" +"Support the :term:`context manager` protocol for :class:`~contextvars.Token` " +"objects. (Contributed by Andrew Svetlov in :gh:`129889`.)" +msgstr "" + +#: whatsnew/3.14.rst:1195 +msgid "ctypes" +msgstr "" + +#: whatsnew/3.14.rst:1197 +msgid "" +"The layout of :ref:`bit fields ` in :" +"class:`~ctypes.Structure` and :class:`~ctypes.Union` objects is now a closer " +"match to platform defaults (GCC/Clang or MSVC). In particular, fields no " +"longer overlap. (Contributed by Matthias Görgens in :gh:`97702`.)" +msgstr "" + +#: whatsnew/3.14.rst:1203 +msgid "" +"The :attr:`.Structure._layout_` class attribute can now be set to help match " +"a non-default ABI. (Contributed by Petr Viktorin in :gh:`97702`.)" +msgstr "" + +#: whatsnew/3.14.rst:1207 +msgid "" +"The class of :class:`~ctypes.Structure`/:class:`~ctypes.Union` field " +"descriptors is now available as :class:`~ctypes.CField`, and has new " +"attributes to aid debugging and introspection. (Contributed by Petr Viktorin " +"in :gh:`128715`.)" +msgstr "" + +#: whatsnew/3.14.rst:1212 +msgid "" +"On Windows, the :exc:`~ctypes.COMError` exception is now public. " +"(Contributed by Jun Komoda in :gh:`126686`.)" +msgstr "" + +#: whatsnew/3.14.rst:1215 +msgid "" +"On Windows, the :func:`~ctypes.CopyComPointer` function is now public. " +"(Contributed by Jun Komoda in :gh:`127275`.)" +msgstr "" + +#: whatsnew/3.14.rst:1218 +msgid "" +"Add :func:`~ctypes.memoryview_at`, a function to create a :class:" +"`memoryview` object that refers to the supplied pointer and length. This " +"works like :func:`ctypes.string_at` except it avoids a buffer copy, and is " +"typically useful when implementing pure Python callback functions that are " +"passed dynamically-sized buffers. (Contributed by Rian Hunter in :gh:" +"`112018`.)" +msgstr "" + +#: whatsnew/3.14.rst:1225 +msgid "" +"Complex types, :class:`~ctypes.c_float_complex`, :class:`~ctypes." +"c_double_complex`, and :class:`~ctypes.c_longdouble_complex`, are now " +"available if both the compiler and the ``libffi`` library support complex C " +"types. (Contributed by Sergey B Kirpichev in :gh:`61103`.)" +msgstr "" + +#: whatsnew/3.14.rst:1231 +msgid "" +"Add :func:`ctypes.util.dllist` for listing the shared libraries loaded by " +"the current process. (Contributed by Brian Ward in :gh:`119349`.)" +msgstr "" + +#: whatsnew/3.14.rst:1235 +msgid "" +"Move :func:`ctypes.POINTER` types cache from a global internal cache " +"(``_pointer_type_cache``) to the :attr:`_CData.__pointer_type__ ` attribute of the corresponding :mod:`!ctypes` " +"types. This will stop the cache from growing without limits in some " +"situations. (Contributed by Sergey Miryanov in :gh:`100926`.)" +msgstr "" + +#: whatsnew/3.14.rst:1242 +msgid "" +"The :class:`~ctypes.py_object` type now supports subscription, making it a :" +"term:`generic type`. (Contributed by Brian Schubert in :gh:`132168`.)" +msgstr "" + +#: whatsnew/3.14.rst:1246 +msgid "" +":mod:`!ctypes` now supports :term:`free-threading builds `. " +"(Contributed by Kumar Aditya and Peter Bierma in :gh:`127945`.)" +msgstr "" + +#: whatsnew/3.14.rst:1251 +msgid "curses" +msgstr "" + +#: whatsnew/3.14.rst:1253 +msgid "" +"Add the :func:`~curses.assume_default_colors` function, a refinement of the :" +"func:`~curses.use_default_colors` function which allows changing the color " +"pair ``0``. (Contributed by Serhiy Storchaka in :gh:`133139`.)" +msgstr "" + +#: whatsnew/3.14.rst:1260 +msgid "datetime" +msgstr "" + +#: whatsnew/3.14.rst:1262 +msgid "" +"Add the :meth:`~datetime.date.strptime` method to the :class:`datetime.date` " +"and :class:`datetime.time` classes. (Contributed by Wannes Boeykens in :gh:" +"`41431`.)" +msgstr "" + +#: whatsnew/3.14.rst:1268 +msgid "decimal" +msgstr "" + +#: whatsnew/3.14.rst:1270 +msgid "" +"Add :meth:`.Decimal.from_number` as an alternative constructor for :class:" +"`~decimal.Decimal`. (Contributed by Serhiy Storchaka in :gh:`121798`.)" +msgstr "" + +#: whatsnew/3.14.rst:1274 +msgid "" +"Expose :func:`~decimal.IEEEContext` to support creation of contexts " +"corresponding to the IEEE 754 (2008) decimal interchange formats. " +"(Contributed by Sergey B Kirpichev in :gh:`53032`.)" +msgstr "" + +#: whatsnew/3.14.rst:2198 +msgid "difflib" +msgstr "" + +#: whatsnew/3.14.rst:1282 +msgid "" +"Comparison pages with highlighted changes generated by the :class:`~difflib." +"HtmlDiff` class now support 'dark mode'. (Contributed by Jiahao Li in :gh:" +"`129939`.)" +msgstr "" + +#: whatsnew/3.14.rst:1288 +msgid "dis" +msgstr "" + +#: whatsnew/3.14.rst:1290 +msgid "" +"Add support for rendering full source location information of :class:" +"`instructions `, rather than only the line number. This " +"feature is added to the following interfaces via the *show_positions* " +"keyword argument:" +msgstr "" + +#: whatsnew/3.14.rst:1295 +msgid ":class:`dis.Bytecode`" +msgstr "" + +#: whatsnew/3.14.rst:1296 +msgid ":func:`dis.dis`" +msgstr "" + +#: whatsnew/3.14.rst:1297 +msgid ":func:`dis.distb`" +msgstr "" + +#: whatsnew/3.14.rst:1298 +msgid ":func:`dis.disassemble`" +msgstr "" + +#: whatsnew/3.14.rst:1300 +msgid "" +"This feature is also exposed via :option:`dis --show-positions`. " +"(Contributed by Bénédikt Tran in :gh:`123165`.)" +msgstr "" + +#: whatsnew/3.14.rst:1303 +msgid "" +"Add the :option:`dis --specialized` command-line option to show specialized " +"bytecode. (Contributed by Bénédikt Tran in :gh:`127413`.)" +msgstr "" + +#: whatsnew/3.14.rst:1309 +msgid "errno" +msgstr "" + +#: whatsnew/3.14.rst:1311 +msgid "" +"Add the :data:`~errno.EHWPOISON` error code constant. (Contributed by James " +"Roy in :gh:`126585`.)" +msgstr "" + +#: whatsnew/3.14.rst:1316 +msgid "faulthandler" +msgstr "" + +#: whatsnew/3.14.rst:1318 +msgid "" +"Add support for printing the C stack trace on systems that :ref:`support it " +"` via the new :func:`~faulthandler.dump_c_stack` " +"function or via the *c_stack* argument in :func:`faulthandler.enable`. " +"(Contributed by Peter Bierma in :gh:`127604`.)" +msgstr "" + +#: whatsnew/3.14.rst:1326 +msgid "fnmatch" +msgstr "" + +#: whatsnew/3.14.rst:1328 +msgid "" +"Add :func:`~fnmatch.filterfalse`, a function to reject names matching a " +"given pattern. (Contributed by Bénédikt Tran in :gh:`74598`.)" +msgstr "" + +#: whatsnew/3.14.rst:1334 +msgid "fractions" +msgstr "" + +#: whatsnew/3.14.rst:1336 +msgid "" +"A :class:`~fractions.Fraction` object may now be constructed from any object " +"with the :meth:`!as_integer_ratio` method. (Contributed by Serhiy Storchaka " +"in :gh:`82017`.)" +msgstr "" + +#: whatsnew/3.14.rst:1340 +msgid "" +"Add :meth:`.Fraction.from_number` as an alternative constructor for :class:" +"`~fractions.Fraction`. (Contributed by Serhiy Storchaka in :gh:`121797`.)" +msgstr "" + +#: whatsnew/3.14.rst:1346 +msgid "functools" +msgstr "" + +#: whatsnew/3.14.rst:1348 +msgid "" +"Add the :data:`~functools.Placeholder` sentinel. This may be used with the :" +"func:`~functools.partial` or :func:`~functools.partialmethod` functions to " +"reserve a place for positional arguments in the returned :ref:`partial " +"object `. (Contributed by Dominykas Grigonis in :gh:" +"`119127`.)" +msgstr "" + +#: whatsnew/3.14.rst:1355 +msgid "" +"Allow the *initial* parameter of :func:`~functools.reduce` to be passed as a " +"keyword argument. (Contributed by Sayandip Dutta in :gh:`125916`.)" +msgstr "" + +#: whatsnew/3.14.rst:1361 +msgid "getopt" +msgstr "" + +#: whatsnew/3.14.rst:1363 +msgid "" +"Add support for options with optional arguments. (Contributed by Serhiy " +"Storchaka in :gh:`126374`.)" +msgstr "" + +#: whatsnew/3.14.rst:1366 +msgid "" +"Add support for returning intermixed options and non-option arguments in " +"order. (Contributed by Serhiy Storchaka in :gh:`126390`.)" +msgstr "" + +#: whatsnew/3.14.rst:1371 +msgid "getpass" +msgstr "" + +#: whatsnew/3.14.rst:1373 +msgid "" +"Support keyboard feedback in the :func:`~getpass.getpass` function via the " +"keyword-only optional argument *echo_char*. Placeholder characters are " +"rendered whenever a character is entered, and removed when a character is " +"deleted. (Contributed by Semyon Moroz in :gh:`77065`.)" +msgstr "" + +#: whatsnew/3.14.rst:1381 +msgid "graphlib" +msgstr "" + +#: whatsnew/3.14.rst:1383 +msgid "" +"Allow :meth:`.TopologicalSorter.prepare` to be called more than once as long " +"as sorting has not started. (Contributed by Daniel Pope in :gh:`130914`.)" +msgstr "" + +#: whatsnew/3.14.rst:1389 +msgid "heapq" +msgstr "" + +#: whatsnew/3.14.rst:1391 +msgid "" +"The :mod:`!heapq` module has improved support for working with max-heaps, " +"via the following new functions:" +msgstr "" + +#: whatsnew/3.14.rst:1394 +msgid ":func:`~heapq.heapify_max`" +msgstr "" + +#: whatsnew/3.14.rst:1395 +msgid ":func:`~heapq.heappush_max`" +msgstr "" + +#: whatsnew/3.14.rst:1396 +msgid ":func:`~heapq.heappop_max`" +msgstr "" + +#: whatsnew/3.14.rst:1397 +msgid ":func:`~heapq.heapreplace_max`" +msgstr "" + +#: whatsnew/3.14.rst:1398 +msgid ":func:`~heapq.heappushpop_max`" +msgstr "" + +#: whatsnew/3.14.rst:1402 +msgid "hmac" +msgstr "" + +#: whatsnew/3.14.rst:1404 +msgid "" +"Add a built-in implementation for HMAC (:rfc:`2104`) using formally verified " +"code from the `HACL* `__ project. " +"This implementation is used as a fallback when the OpenSSL implementation of " +"HMAC is not available. (Contributed by Bénédikt Tran in :gh:`99108`.)" +msgstr "" + +#: whatsnew/3.14.rst:1412 +msgid "http" +msgstr "" + +#: whatsnew/3.14.rst:1414 +msgid "" +"Directory lists and error pages generated by the :mod:`http.server` module " +"allow the browser to apply its default dark mode. (Contributed by Yorik " +"Hansen in :gh:`123430`.)" +msgstr "" + +#: whatsnew/3.14.rst:1418 +msgid "" +"The :mod:`http.server` module now supports serving over HTTPS using the :" +"class:`http.server.HTTPSServer` class. This functionality is exposed by the " +"command-line interface (``python -m http.server``) through the following " +"options:" +msgstr "" + +#: whatsnew/3.14.rst:1423 +msgid "" +":option:`--tls-cert \\ `: Path to the TLS " +"certificate file." +msgstr "" + +#: whatsnew/3.14.rst:1425 +msgid "" +":option:`--tls-key \\ `: Optional path to the " +"private key file." +msgstr "" + +#: whatsnew/3.14.rst:1427 +msgid "" +":option:`--tls-password-file \\ `: " +"Optional path to the password file for the private key." +msgstr "" + +#: whatsnew/3.14.rst:1430 +msgid "(Contributed by Semyon Moroz in :gh:`85162`.)" +msgstr "" + +#: whatsnew/3.14.rst:1434 +msgid "imaplib" +msgstr "" + +#: whatsnew/3.14.rst:1436 +msgid "" +"Add :meth:`.IMAP4.idle`, implementing the IMAP4 ``IDLE`` command as defined " +"in :rfc:`2177`. (Contributed by Forest in :gh:`55454`.)" +msgstr "" + +#: whatsnew/3.14.rst:1442 +msgid "inspect" +msgstr "" + +#: whatsnew/3.14.rst:1444 +msgid "" +":func:`~inspect.signature` takes a new argument *annotation_format* to " +"control the :class:`annotationlib.Format` used for representing annotations. " +"(Contributed by Jelle Zijlstra in :gh:`101552`.)" +msgstr "" + +#: whatsnew/3.14.rst:1448 +msgid "" +":meth:`.Signature.format` takes a new argument *unquote_annotations*. If " +"true, string :term:`annotations ` are displayed without " +"surrounding quotes. (Contributed by Jelle Zijlstra in :gh:`101552`.)" +msgstr "" + +#: whatsnew/3.14.rst:1453 +msgid "" +"Add function :func:`~inspect.ispackage` to determine whether an object is a :" +"term:`package` or not. (Contributed by Zhikang Yan in :gh:`125634`.)" +msgstr "" + +#: whatsnew/3.14.rst:2240 +msgid "io" +msgstr "" + +#: whatsnew/3.14.rst:1461 +msgid "" +"Reading text from a non-blocking stream with ``read`` may now raise a :exc:" +"`BlockingIOError` if the operation cannot immediately return bytes. " +"(Contributed by Giovanni Siragusa in :gh:`109523`.)" +msgstr "" + +#: whatsnew/3.14.rst:1465 +msgid "" +"Add the :class:`~io.Reader` and :class:`~io.Writer` protocols as simpler " +"alternatives to the pseudo-protocols :class:`typing.IO`, :class:`typing." +"TextIO`, and :class:`typing.BinaryIO`. (Contributed by Sebastian Rittau in :" +"gh:`127648`.)" +msgstr "" + +#: whatsnew/3.14.rst:1472 +msgid "json" +msgstr "" + +#: whatsnew/3.14.rst:1474 +msgid "" +"Add exception notes for JSON serialization errors that allow identifying the " +"source of the error. (Contributed by Serhiy Storchaka in :gh:`122163`.)" +msgstr "" + +#: whatsnew/3.14.rst:1478 +msgid "" +"Allow using the :mod:`json` module as a script using the :option:`-m` " +"switch: :program:`python -m json`. This is now preferred to :program:`python " +"-m json.tool`, which is :term:`soft deprecated`. See the :ref:`JSON command-" +"line interface ` documentation. (Contributed by Trey " +"Hunner in :gh:`122873`.)" +msgstr "" + +#: whatsnew/3.14.rst:1485 +msgid "" +"By default, the output of the :ref:`JSON command-line interface ` is highlighted in color. This can be controlled by :ref:" +"`environment variables `. (Contributed by Tomas " +"Roun in :gh:`131952`.)" +msgstr "" + +#: whatsnew/3.14.rst:1493 +msgid "linecache" +msgstr "" + +#: whatsnew/3.14.rst:1495 +msgid "" +":func:`~linecache.getline` can now retrieve source code for frozen modules. " +"(Contributed by Tian Gao in :gh:`131638`.)" +msgstr "" + +#: whatsnew/3.14.rst:1500 +msgid "logging.handlers" +msgstr "" + +#: whatsnew/3.14.rst:1502 +msgid "" +":class:`~logging.handlers.QueueListener` objects now support the :term:" +"`context manager` protocol. (Contributed by Charles Machalow in :gh:" +"`132106`.)" +msgstr "" + +#: whatsnew/3.14.rst:1506 +msgid "" +":meth:`QueueListener.start ` now " +"raises a :exc:`RuntimeError` if the listener is already started. " +"(Contributed by Charles Machalow in :gh:`132106`.)" +msgstr "" + +#: whatsnew/3.14.rst:1512 +msgid "math" +msgstr "" + +#: whatsnew/3.14.rst:1514 +msgid "" +"Added more detailed error messages for domain errors in the module. " +"(Contributed by Charlie Zhao and Sergey B Kirpichev in :gh:`101410`.)" +msgstr "" + +#: whatsnew/3.14.rst:1519 +msgid "mimetypes" +msgstr "" + +#: whatsnew/3.14.rst:1521 +msgid "" +"Add a public :ref:`command-line ` for the module, invoked " +"via :program:`python -m mimetypes`. (Contributed by Oleg Iarygin and Hugo " +"van Kemenade in :gh:`93096`.)" +msgstr "" + +#: whatsnew/3.14.rst:1525 +msgid "Add several new MIME types based on RFCs and common usage:" +msgstr "" + +#: whatsnew/3.14.rst:0 +msgid "Microsoft and :rfc:`8081` MIME types for fonts" +msgstr "" + +#: whatsnew/3.14.rst:1529 +msgid "Embedded OpenType: ``application/vnd.ms-fontobject``" +msgstr "" + +#: whatsnew/3.14.rst:1530 +msgid "OpenType Layout (OTF) ``font/otf``" +msgstr "" + +#: whatsnew/3.14.rst:1531 +msgid "TrueType: ``font/ttf``" +msgstr "" + +#: whatsnew/3.14.rst:1532 +msgid "WOFF 1.0 ``font/woff``" +msgstr "" + +#: whatsnew/3.14.rst:1533 +msgid "WOFF 2.0 ``font/woff2``" +msgstr "" + +#: whatsnew/3.14.rst:0 +msgid "" +":rfc:`9559` MIME types for Matroska audiovisual data container structures" +msgstr "" + +#: whatsnew/3.14.rst:1538 +msgid "audio with no video: ``audio/matroska`` (``.mka``)" +msgstr "" + +#: whatsnew/3.14.rst:1539 +msgid "video: ``video/matroska`` (``.mkv``)" +msgstr "" + +#: whatsnew/3.14.rst:1540 +msgid "stereoscopic video: ``video/matroska-3d`` (``.mk3d``)" +msgstr "" + +#: whatsnew/3.14.rst:0 +msgid "Images with RFCs" +msgstr "" + +#: whatsnew/3.14.rst:1544 +msgid ":rfc:`1494`: CCITT Group 3 (``.g3``)" +msgstr "" + +#: whatsnew/3.14.rst:1545 +msgid ":rfc:`3362`: Real-time Facsimile, T.38 (``.t38``)" +msgstr "" + +#: whatsnew/3.14.rst:1546 +msgid "" +":rfc:`3745`: JPEG 2000 (``.jp2``), extension (``.jpx``) and compound (``." +"jpm``)" +msgstr "" + +#: whatsnew/3.14.rst:1547 +msgid ":rfc:`3950`: Tag Image File Format Fax eXtended, TIFF-FX (``.tfx``)" +msgstr "" + +#: whatsnew/3.14.rst:1548 +msgid ":rfc:`4047`: Flexible Image Transport System (``.fits``)" +msgstr "" + +#: whatsnew/3.14.rst:1549 +msgid "" +":rfc:`7903`: Enhanced Metafile (``.emf``) and Windows Metafile (``.wmf``)" +msgstr "" + +#: whatsnew/3.14.rst:0 +msgid "Other MIME type additions and changes" +msgstr "" + +#: whatsnew/3.14.rst:1553 +msgid "" +":rfc:`2361`: Change type for ``.avi`` to ``video/vnd.avi`` and for ``.wav`` " +"to ``audio/vnd.wave``" +msgstr "" + +#: whatsnew/3.14.rst:1555 +msgid ":rfc:`4337`: Add MPEG-4 ``audio/mp4`` (``.m4a``)" +msgstr "" + +#: whatsnew/3.14.rst:1556 +msgid ":rfc:`5334`: Add Ogg media (``.oga``, ``.ogg`` and ``.ogx``)" +msgstr "" + +#: whatsnew/3.14.rst:1557 +msgid ":rfc:`6713`: Add gzip ``application/gzip`` (``.gz``)" +msgstr "" + +#: whatsnew/3.14.rst:1558 +msgid ":rfc:`9639`: Add FLAC ``audio/flac`` (``.flac``)" +msgstr "" + +#: whatsnew/3.14.rst:1559 +msgid "" +":rfc:`9512` ``application/yaml`` MIME type for YAML files (``.yaml`` and ``." +"yml``)" +msgstr "" + +#: whatsnew/3.14.rst:1561 +msgid "Add 7z ``application/x-7z-compressed`` (``.7z``)" +msgstr "" + +#: whatsnew/3.14.rst:1562 +msgid "" +"Add Android Package ``application/vnd.android.package-archive`` (``.apk``) " +"when not strict" +msgstr "" + +#: whatsnew/3.14.rst:1564 +msgid "Add deb ``application/x-debian-package`` (``.deb``)" +msgstr "" + +#: whatsnew/3.14.rst:1565 +msgid "Add glTF binary ``model/gltf-binary`` (``.glb``)" +msgstr "" + +#: whatsnew/3.14.rst:1566 +msgid "Add glTF JSON/ASCII ``model/gltf+json`` (``.gltf``)" +msgstr "" + +#: whatsnew/3.14.rst:1567 +msgid "Add M4V ``video/x-m4v`` (``.m4v``)" +msgstr "" + +#: whatsnew/3.14.rst:1568 +msgid "Add PHP ``application/x-httpd-php`` (``.php``)" +msgstr "" + +#: whatsnew/3.14.rst:1569 +msgid "Add RAR ``application/vnd.rar`` (``.rar``)" +msgstr "" + +#: whatsnew/3.14.rst:1570 +msgid "Add RPM ``application/x-rpm`` (``.rpm``)" +msgstr "" + +#: whatsnew/3.14.rst:1571 +msgid "Add STL ``model/stl`` (``.stl``)" +msgstr "" + +#: whatsnew/3.14.rst:1572 +msgid "Add Windows Media Video ``video/x-ms-wmv`` (``.wmv``)" +msgstr "" + +#: whatsnew/3.14.rst:1573 +msgid "De facto: Add WebM ``audio/webm`` (``.weba``)" +msgstr "" + +#: whatsnew/3.14.rst:1574 +msgid "" +"`ECMA-376 `__: Add ``.docx``, ``.pptx`` and ``.xlsx`` types" +msgstr "" + +#: whatsnew/3.14.rst:1577 +msgid "" +"`OASIS `__: Add OpenDocument ``.odg``, ``.odp``, ``.ods`` and " +"``.odt`` types" +msgstr "" + +#: whatsnew/3.14.rst:1580 +msgid "" +"`W3C `__: Add EPUB " +"``application/epub+zip`` (``.epub``)" +msgstr "" + +#: whatsnew/3.14.rst:1583 +msgid "" +"(Contributed by Sahil Prajapati and Hugo van Kemenade in :gh:`84852`, by " +"Sasha \"Nelie\" Chernykh and Hugo van Kemenade in :gh:`132056`, and by Hugo " +"van Kemenade in :gh:`89416`, :gh:`85957`, and :gh:`129965`.)" +msgstr "" + +#: whatsnew/3.14.rst:1589 +msgid "multiprocessing" +msgstr "" + +#: whatsnew/3.14.rst:1593 +msgid "" +"On Unix platforms other than macOS, :ref:`'forkserver' ` is now the default :ref:`start method " +"` (replacing :ref:`'fork' `). This change does not affect Windows or macOS, where :" +"ref:`'spawn' ` remains the default start " +"method." +msgstr "" + +#: whatsnew/3.14.rst:1600 +msgid "" +"If the threading incompatible *fork* method is required, you must explicitly " +"request it via a context from :func:`~multiprocessing.get_context` " +"(preferred) or change the default via :func:`~multiprocessing." +"set_start_method`." +msgstr "" + +#: whatsnew/3.14.rst:1611 +msgid "" +":mod:`multiprocessing`'s ``'forkserver'`` start method now authenticates its " +"control socket to avoid solely relying on filesystem permissions to restrict " +"what other processes could cause the forkserver to spawn workers and run " +"code. (Contributed by Gregory P. Smith for :gh:`97514`.)" +msgstr "" + +#: whatsnew/3.14.rst:1617 +msgid "" +"The :ref:`multiprocessing proxy objects ` for " +"*list* and *dict* types gain previously overlooked missing methods:" +msgstr "" + +#: whatsnew/3.14.rst:1620 +msgid ":meth:`!clear` and :meth:`!copy` for proxies of :class:`list`" +msgstr "" + +#: whatsnew/3.14.rst:1621 +msgid "" +":meth:`~dict.fromkeys`, ``reversed(d)``, ``d | {}``, ``{} | d``, ``d |= " +"{'b': 2}`` for proxies of :class:`dict`" +msgstr "" + +#: whatsnew/3.14.rst:1624 +msgid "(Contributed by Roy Hyunjin Han for :gh:`103134`.)" +msgstr "" + +#: whatsnew/3.14.rst:1626 +msgid "" +"Add support for shared :class:`set` objects via :meth:`.SyncManager.set`. " +"The :func:`set` in :func:`~multiprocessing.Manager` method is now available. " +"(Contributed by Mingyu Park in :gh:`129949`.)" +msgstr "" + +#: whatsnew/3.14.rst:1631 +msgid "" +"Add the :meth:`~multiprocessing.Process.interrupt` to :class:" +"`multiprocessing.Process` objects, which terminates the child process by " +"sending :py:const:`~signal.SIGINT`. This enables :keyword:`finally` clauses " +"to print a stack trace for the terminated process. (Contributed by Artem " +"Pulkin in :gh:`131913`.)" +msgstr "" + +#: whatsnew/3.14.rst:1639 +msgid "operator" +msgstr "" + +#: whatsnew/3.14.rst:1641 +msgid "" +"Add :func:`~operator.is_none` and :func:`~operator.is_not_none` as a pair of " +"functions, such that ``operator.is_none(obj)`` is equivalent to ``obj is " +"None`` and ``operator.is_not_none(obj)`` is equivalent to ``obj is not " +"None``. (Contributed by Raymond Hettinger and Nico Mexis in :gh:`115808`.)" +msgstr "" + +#: whatsnew/3.14.rst:1649 +msgid "os" +msgstr "" + +#: whatsnew/3.14.rst:1651 +msgid "" +"Add the :func:`~os.reload_environ` function to update :data:`os.environ` " +"and :data:`os.environb` with changes to the environment made by :func:`os." +"putenv`, by :func:`os.unsetenv`, or made outside Python in the same process. " +"(Contributed by Victor Stinner in :gh:`120057`.)" +msgstr "" + +#: whatsnew/3.14.rst:1657 +msgid "" +"Add the :data:`~os.SCHED_DEADLINE` and :data:`~os.SCHED_NORMAL` constants to " +"the :mod:`!os` module. (Contributed by James Roy in :gh:`127688`.)" +msgstr "" + +#: whatsnew/3.14.rst:1661 +msgid "" +"Add the :func:`~os.readinto` function to read into a :ref:`buffer object " +"` from a file descriptor. (Contributed by Cody Maloney in :gh:" +"`129205`.)" +msgstr "" + +#: whatsnew/3.14.rst:1667 +msgid "os.path" +msgstr "" + +#: whatsnew/3.14.rst:1669 +msgid "" +"The *strict* parameter to :func:`~os.path.realpath` accepts a new value, :" +"data:`~os.path.ALLOW_MISSING`. If used, errors other than :exc:" +"`FileNotFoundError` will be re-raised; the resulting path can be missing but " +"it will be free of symlinks. (Contributed by Petr Viktorin for :cve:" +"`2025-4517`.)" +msgstr "" + +#: whatsnew/3.14.rst:2249 whatsnew/3.14.rst:2501 +msgid "pathlib" +msgstr "" + +#: whatsnew/3.14.rst:1679 +msgid "" +"Add methods to :class:`pathlib.Path` to recursively copy or move files and " +"directories:" +msgstr "" + +#: whatsnew/3.14.rst:1682 +msgid "" +":meth:`~pathlib.Path.copy` copies a file or directory tree to a destination." +msgstr "" + +#: whatsnew/3.14.rst:1683 +msgid ":meth:`~pathlib.Path.copy_into` copies *into* a destination directory." +msgstr "" + +#: whatsnew/3.14.rst:1684 +msgid "" +":meth:`~pathlib.Path.move` moves a file or directory tree to a destination." +msgstr "" + +#: whatsnew/3.14.rst:1685 +msgid ":meth:`~pathlib.Path.move_into` moves *into* a destination directory." +msgstr "" + +#: whatsnew/3.14.rst:1687 +msgid "(Contributed by Barney Gale in :gh:`73991`.)" +msgstr "" + +#: whatsnew/3.14.rst:1689 +msgid "" +"Add the :attr:`~pathlib.Path.info` attribute, which stores an object " +"implementing the new :class:`pathlib.types.PathInfo` protocol. The object " +"supports querying the file type and internally caching :func:`~os.stat` " +"results. Path objects generated by :meth:`~pathlib.Path.iterdir` are " +"initialized with file type information gleaned from scanning the parent " +"directory. (Contributed by Barney Gale in :gh:`125413`.)" +msgstr "" + +#: whatsnew/3.14.rst:2257 +msgid "pdb" +msgstr "" + +#: whatsnew/3.14.rst:1701 +msgid "" +"The :mod:`pdb` module now supports remote attaching to a running Python " +"process using a new :option:`-p PID ` command-line option:" +msgstr "" + +#: whatsnew/3.14.rst:1704 +msgid "python -m pdb -p 1234" +msgstr "" + +#: whatsnew/3.14.rst:1708 +msgid "" +"This will connect to the Python process with the given PID and allow you to " +"debug it interactively. Notice that due to how the Python interpreter works " +"attaching to a remote process that is blocked in a system call or waiting " +"for I/O will only work once the next bytecode instruction is executed or " +"when the process receives a signal." +msgstr "" + +#: whatsnew/3.14.rst:1714 +msgid "" +"This feature uses :ref:`PEP 768 ` and the new :" +"func:`sys.remote_exec` function to attach to the remote process and send the " +"PDB commands to it." +msgstr "" + +#: whatsnew/3.14.rst:1718 +msgid "(Contributed by Matt Wozniski and Pablo Galindo in :gh:`131591`.)" +msgstr "" + +#: whatsnew/3.14.rst:1720 +msgid "" +"Hardcoded breakpoints (:func:`breakpoint` and :func:`~pdb.set_trace`) now " +"reuse the most recent :class:`~pdb.Pdb` instance that calls :meth:`~pdb.Pdb." +"set_trace`, instead of creating a new one each time. As a result, all the " +"instance specific data like :pdbcmd:`display` and :pdbcmd:`commands` are " +"preserved across hardcoded breakpoints. (Contributed by Tian Gao in :gh:" +"`121450`.)" +msgstr "" + +#: whatsnew/3.14.rst:1727 +msgid "" +"Add a new argument *mode* to :class:`pdb.Pdb`. Disable the ``restart`` " +"command when :mod:`pdb` is in ``inline`` mode. (Contributed by Tian Gao in :" +"gh:`123757`.)" +msgstr "" + +#: whatsnew/3.14.rst:1731 +msgid "" +"A confirmation prompt will be shown when the user tries to quit :mod:`pdb` " +"in ``inline`` mode. ``y``, ``Y``, ```` or ``EOF`` will confirm the " +"quit and call :func:`sys.exit`, instead of raising :exc:`bdb.BdbQuit`. " +"(Contributed by Tian Gao in :gh:`124704`.)" +msgstr "" + +#: whatsnew/3.14.rst:1736 +msgid "" +"Inline breakpoints like :func:`breakpoint` or :func:`pdb.set_trace` will " +"always stop the program at calling frame, ignoring the ``skip`` pattern (if " +"any). (Contributed by Tian Gao in :gh:`130493`.)" +msgstr "" + +#: whatsnew/3.14.rst:1741 +msgid "" +"```` at the beginning of the line in :mod:`pdb` multi-line input will " +"fill in a 4-space indentation now, instead of inserting a ``\\t`` character. " +"(Contributed by Tian Gao in :gh:`130471`.)" +msgstr "" + +#: whatsnew/3.14.rst:1745 +msgid "" +"Auto-indent is introduced in :mod:`pdb` multi-line input. It will either " +"keep the indentation of the last line or insert a 4-space indentation when " +"it detects a new code block. (Contributed by Tian Gao in :gh:`133350`.)" +msgstr "" + +#: whatsnew/3.14.rst:1750 +msgid "" +"``$_asynctask`` is added to access the current asyncio task if applicable. " +"(Contributed by Tian Gao in :gh:`124367`.)" +msgstr "" + +#: whatsnew/3.14.rst:1753 +msgid "" +":func:`pdb.set_trace_async` is added to support debugging asyncio " +"coroutines. :keyword:`await` statements are supported with this function. " +"(Contributed by Tian Gao in :gh:`132576`.)" +msgstr "" + +#: whatsnew/3.14.rst:1758 +msgid "" +"Source code displayed in :mod:`pdb` will be syntax-highlighted. This feature " +"can be controlled using the same methods as the default :term:`interactive` " +"shell, in addition to the newly added ``colorize`` argument of :class:`pdb." +"Pdb`. (Contributed by Tian Gao and Łukasz Langa in :gh:`133355`.)" +msgstr "" + +#: whatsnew/3.14.rst:1765 +msgid "pickle" +msgstr "" + +#: whatsnew/3.14.rst:1767 +msgid "" +"Set the default protocol version on the :mod:`pickle` module to 5. For more " +"details, see :ref:`pickle protocols `." +msgstr "" + +#: whatsnew/3.14.rst:1770 +msgid "" +"Add exception notes for pickle serialization errors that allow identifying " +"the source of the error. (Contributed by Serhiy Storchaka in :gh:`122213`.)" +msgstr "" + +#: whatsnew/3.14.rst:1776 +msgid "platform" +msgstr "" + +#: whatsnew/3.14.rst:1778 +msgid "" +"Add :func:`~platform.invalidate_caches`, a function to invalidate cached " +"results in the :mod:`!platform` module. (Contributed by Bénédikt Tran in :gh:" +"`122549`.)" +msgstr "" + +#: whatsnew/3.14.rst:1784 +msgid "pydoc" +msgstr "" + +#: whatsnew/3.14.rst:1786 +msgid "" +":term:`Annotations ` in help output are now usually displayed in " +"a format closer to that in the original source. (Contributed by Jelle " +"Zijlstra in :gh:`101552`.)" +msgstr "" + +#: whatsnew/3.14.rst:1792 +msgid "re" +msgstr "" + +#: whatsnew/3.14.rst:1794 +msgid "" +"Support ``\\z`` as a synonym for ``\\Z`` in :mod:`regular expressions `. " +"It is interpreted unambiguously in many other regular expression engines, " +"unlike ``\\Z``, which has subtly different behavior. (Contributed by Serhiy " +"Storchaka in :gh:`133306`.)" +msgstr "" + +#: whatsnew/3.14.rst:1799 +msgid "" +"``\\B`` in :mod:`regular expression ` now matches the empty input " +"string, meaning that it is now always the opposite of ``\\b``. (Contributed " +"by Serhiy Storchaka in :gh:`124130`.)" +msgstr "" + +#: whatsnew/3.14.rst:1805 +msgid "socket" +msgstr "" + +#: whatsnew/3.14.rst:1807 +msgid "Improve and fix support for Bluetooth sockets." +msgstr "" + +#: whatsnew/3.14.rst:1809 +msgid "" +"Fix support of Bluetooth sockets on NetBSD and DragonFly BSD. (Contributed " +"by Serhiy Storchaka in :gh:`132429`.)" +msgstr "" + +#: whatsnew/3.14.rst:1811 +msgid "" +"Fix support for :const:`~socket.BTPROTO_HCI` on FreeBSD. (Contributed by " +"Victor Stinner in :gh:`111178`.)" +msgstr "" + +#: whatsnew/3.14.rst:1813 +msgid "" +"Add support for :const:`~socket.BTPROTO_SCO` on FreeBSD. (Contributed by " +"Serhiy Storchaka in :gh:`85302`.)" +msgstr "" + +#: whatsnew/3.14.rst:1815 +msgid "" +"Add support for *cid* and *bdaddr_type* in the address for :const:`~socket." +"BTPROTO_L2CAP` on FreeBSD. (Contributed by Serhiy Storchaka in :gh:`132429`.)" +msgstr "" + +#: whatsnew/3.14.rst:1818 +msgid "" +"Add support for *channel* in the address for :const:`~socket.BTPROTO_HCI` on " +"Linux. (Contributed by Serhiy Storchaka in :gh:`70145`.)" +msgstr "" + +#: whatsnew/3.14.rst:1821 +msgid "" +"Accept an integer as the address for :const:`~socket.BTPROTO_HCI` on Linux. " +"(Contributed by Serhiy Storchaka in :gh:`132099`.)" +msgstr "" + +#: whatsnew/3.14.rst:1824 +msgid "" +"Return *cid* in :meth:`~socket.socket.getsockname` for :const:`~socket." +"BTPROTO_L2CAP`. (Contributed by Serhiy Storchaka in :gh:`132429`.)" +msgstr "" + +#: whatsnew/3.14.rst:1827 +msgid "" +"Add many new constants. (Contributed by Serhiy Storchaka in :gh:`132734`.)" +msgstr "" + +#: whatsnew/3.14.rst:1832 +msgid "ssl" +msgstr "" + +#: whatsnew/3.14.rst:1834 +msgid "" +"Indicate through the :data:`~ssl.HAS_PHA` Boolean whether the :mod:`!ssl` " +"module supports TLSv1.3 post-handshake client authentication (PHA). " +"(Contributed by Will Childs-Klein in :gh:`128036`.)" +msgstr "" + +#: whatsnew/3.14.rst:1840 +msgid "struct" +msgstr "" + +#: whatsnew/3.14.rst:1842 +msgid "" +"Support the :c:expr:`float complex` and :c:expr:`double complex` C types in " +"the :mod:`struct` module (formatting characters ``'F'`` and ``'D'`` " +"respectively). (Contributed by Sergey B Kirpichev in :gh:`121249`.)" +msgstr "" + +#: whatsnew/3.14.rst:1849 +msgid "symtable" +msgstr "" + +#: whatsnew/3.14.rst:1851 +msgid "Expose the following :class:`~symtable.Symbol` methods:" +msgstr "" + +#: whatsnew/3.14.rst:1853 +msgid ":meth:`~symtable.Symbol.is_comp_cell`" +msgstr "" + +#: whatsnew/3.14.rst:1854 +msgid ":meth:`~symtable.Symbol.is_comp_iter`" +msgstr "" + +#: whatsnew/3.14.rst:1855 +msgid ":meth:`~symtable.Symbol.is_free_class`" +msgstr "" + +#: whatsnew/3.14.rst:1857 +msgid "(Contributed by Bénédikt Tran in :gh:`120029`.)" +msgstr "" + +#: whatsnew/3.14.rst:1861 +msgid "sys" +msgstr "" + +#: whatsnew/3.14.rst:1863 +msgid "" +"The previously undocumented special function :func:`sys.getobjects`, which " +"only exists in specialized builds of Python, may now return objects from " +"other interpreters than the one it's called in. (Contributed by Eric Snow " +"in :gh:`125286`.)" +msgstr "" + +#: whatsnew/3.14.rst:1868 +msgid "" +"Add :func:`sys._is_immortal` for determining if an object is :term:" +"`immortal`. (Contributed by Peter Bierma in :gh:`128509`.)" +msgstr "" + +#: whatsnew/3.14.rst:1871 +msgid "" +"On FreeBSD, :data:`sys.platform` no longer contains the major version " +"number. It is always ``'freebsd'``, instead of ``'freebsd13'`` or " +"``'freebsd14'``. (Contributed by Michael Osipov in :gh:`129393`.)" +msgstr "" + +#: whatsnew/3.14.rst:1875 +msgid "" +"Raise :exc:`DeprecationWarning` for :func:`sys._clear_type_cache`. This " +"function was deprecated in Python 3.13 but it didn't raise a runtime warning." +msgstr "" + +#: whatsnew/3.14.rst:1878 +msgid "" +"Add :func:`sys.remote_exec` to implement the new external debugger " +"interface. See :ref:`PEP 768 ` for details. " +"(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona Stojanovic " +"in :gh:`131591`.)" +msgstr "" + +#: whatsnew/3.14.rst:1883 +msgid "" +"Add the :data:`sys._jit` namespace, containing utilities for introspecting " +"just-in-time compilation. (Contributed by Brandt Bucher in :gh:`133231`.)" +msgstr "" + +#: whatsnew/3.14.rst:1889 +msgid "sys.monitoring" +msgstr "" + +#: whatsnew/3.14.rst:1891 +msgid "" +"Add two new monitoring events, :monitoring-event:`BRANCH_LEFT` and :" +"monitoring-event:`BRANCH_RIGHT`. These replace and deprecate the :monitoring-" +"event:`!BRANCH` event. (Contributed by Mark Shannon in :gh:`122548`.)" +msgstr "" + +#: whatsnew/3.14.rst:1898 +msgid "sysconfig" +msgstr "" + +#: whatsnew/3.14.rst:1900 +msgid "" +"Add ``ABIFLAGS`` key to :func:`~sysconfig.get_config_vars` on Windows. " +"(Contributed by Xuehai Pan in :gh:`131799`.)" +msgstr "" + +#: whatsnew/3.14.rst:1905 +msgid "tarfile" +msgstr "" + +#: whatsnew/3.14.rst:1907 +msgid "" +":func:`~tarfile.data_filter` now normalizes symbolic link targets in order " +"to avoid path traversal attacks. (Contributed by Petr Viktorin in :gh:" +"`127987` and :cve:`2025-4138`.)" +msgstr "" + +#: whatsnew/3.14.rst:1911 +msgid "" +":func:`~tarfile.TarFile.extractall` now skips fixing up directory attributes " +"when a directory was removed or replaced by another kind of file. " +"(Contributed by Petr Viktorin in :gh:`127987` and :cve:`2024-12718`.)" +msgstr "" + +#: whatsnew/3.14.rst:1915 +msgid "" +":func:`~tarfile.TarFile.extract` and :func:`~tarfile.TarFile.extractall` now " +"(re-)apply the extraction filter when substituting a link (hard or symbolic) " +"with a copy of another archive member, and when fixing up directory " +"attributes. The former raises a new exception, :exc:`~tarfile." +"LinkFallbackError`. (Contributed by Petr Viktorin for :cve:`2025-4330` and :" +"cve:`2024-12718`.)" +msgstr "" + +#: whatsnew/3.14.rst:1922 +msgid "" +":func:`~tarfile.TarFile.extract` and :func:`~tarfile.TarFile.extractall` no " +"longer extract rejected members when :func:`~tarfile.TarFile.errorlevel` is " +"zero. (Contributed by Matt Prodani and Petr Viktorin in :gh:`112887` and :" +"cve:`2025-4435`.)" +msgstr "" + +#: whatsnew/3.14.rst:1930 +msgid "threading" +msgstr "" + +#: whatsnew/3.14.rst:1932 +msgid "" +":meth:`threading.Thread.start` now sets the operating system thread name to :" +"attr:`threading.Thread.name`. (Contributed by Victor Stinner in :gh:`59705`.)" +msgstr "" + +#: whatsnew/3.14.rst:1938 +msgid "tkinter" +msgstr "" + +#: whatsnew/3.14.rst:1940 +msgid "" +"Make :mod:`tkinter` widget methods :meth:`!after` and :meth:`!after_idle` " +"accept keyword arguments. (Contributed by Zhikang Yan in :gh:`126899`.)" +msgstr "" + +#: whatsnew/3.14.rst:1944 +msgid "" +"Add ability to specify a name for :class:`!tkinter.OptionMenu` and :class:`!" +"tkinter.ttk.OptionMenu`. (Contributed by Zhikang Yan in :gh:`130482`.)" +msgstr "" + +#: whatsnew/3.14.rst:1950 +msgid "turtle" +msgstr "" + +#: whatsnew/3.14.rst:1952 +msgid "" +"Add context managers for :func:`turtle.fill`, :func:`turtle.poly`, and :func:" +"`turtle.no_animation`. (Contributed by Marie Roald and Yngve Mardal Moe in :" +"gh:`126350`.)" +msgstr "" + +#: whatsnew/3.14.rst:1958 +msgid "types" +msgstr "" + +#: whatsnew/3.14.rst:1960 +msgid "" +":class:`types.UnionType` is now an alias for :class:`typing.Union`. See :ref:" +"`below ` for more details. (Contributed by Jelle " +"Zijlstra in :gh:`105499`.)" +msgstr "" + +#: whatsnew/3.14.rst:1966 +msgid "typing" +msgstr "" + +#: whatsnew/3.14.rst:1970 +msgid "" +"The :class:`types.UnionType` and :class:`typing.Union` types are now aliases " +"for each other, meaning that both old-style unions (created with " +"``Union[int, str]``) and new-style unions (``int | str``) now create " +"instances of the same runtime type. This unifies the behavior between the " +"two syntaxes, but leads to some differences in behavior that may affect " +"users who introspect types at runtime:" +msgstr "" + +#: whatsnew/3.14.rst:1977 +msgid "" +"Both syntaxes for creating a union now produce the same string " +"representation in :func:`repr`. For example, ``repr(Union[int, str])`` is " +"now ``\"int | str\"`` instead of ``\"typing.Union[int, str]\"``." +msgstr "" + +#: whatsnew/3.14.rst:1982 +msgid "" +"Unions created using the old syntax are no longer cached. Previously, " +"running ``Union[int, str]`` multiple times would return the same object " +"(``Union[int, str] is Union[int, str]`` would be ``True``), but now it will " +"return two different objects. Use ``==`` to compare unions for equality, not " +"``is``. New-style unions have never been cached this way. This change could " +"increase memory usage for some programs that use a large number of unions " +"created by subscripting ``typing.Union``. However, several factors offset " +"this cost: unions used in annotations are no longer evaluated by default in " +"Python 3.14 because of :pep:`649`; an instance of :class:`types.UnionType` " +"is itself much smaller than the object returned by ``Union[]`` was on prior " +"Python versions; and removing the cache also saves some space. It is " +"therefore unlikely that this change will cause a significant increase in " +"memory usage for most users." +msgstr "" + +#: whatsnew/3.14.rst:1998 +msgid "" +"Previously, old-style unions were implemented using the private class " +"``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`~typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." +msgstr "" + +#: whatsnew/3.14.rst:2007 +msgid "" +"It is now possible to use :class:`typing.Union` itself in :func:`isinstance` " +"checks. For example, ``isinstance(int | str, typing.Union)`` will return " +"``True``; previously this raised :exc:`TypeError`." +msgstr "" + +#: whatsnew/3.14.rst:2012 +msgid "" +"The :attr:`!__args__` attribute of :class:`typing.Union` objects is no " +"longer writable." +msgstr "" + +#: whatsnew/3.14.rst:2015 +msgid "" +"It is no longer possible to set any attributes on :class:`~typing.Union` " +"objects. This only ever worked for dunder attributes on previous versions, " +"was never documented to work, and was subtly broken in many cases." +msgstr "" + +#: whatsnew/3.14.rst:2020 +msgid "(Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: whatsnew/3.14.rst:2022 +msgid ":class:`~typing.TypeAliasType` now supports star unpacking." +msgstr "" + +#: whatsnew/3.14.rst:2026 +msgid "unicodedata" +msgstr "" + +#: whatsnew/3.14.rst:2028 +msgid "The Unicode database has been updated to Unicode 16.0.0." +msgstr "" + +#: whatsnew/3.14.rst:2032 +msgid "unittest" +msgstr "" + +#: whatsnew/3.14.rst:2036 +msgid "" +":mod:`unittest` output is now colored by default. This can be controlled by :" +"ref:`environment variables `. (Contributed by " +"Hugo van Kemenade in :gh:`127221`.)" +msgstr "" + +#: whatsnew/3.14.rst:2041 +msgid "" +"unittest discovery supports :term:`namespace package` as start directory " +"again. It was removed in Python 3.11. (Contributed by Jacob Walls in :gh:" +"`80958`.)" +msgstr "" + +#: whatsnew/3.14.rst:2045 +msgid "" +"A number of new methods were added in the :class:`~unittest.TestCase` class " +"that provide more specialized tests." +msgstr "" + +#: whatsnew/3.14.rst:2048 +msgid "" +":meth:`~unittest.TestCase.assertHasAttr` and :meth:`~unittest.TestCase." +"assertNotHasAttr` check whether the object has a particular attribute." +msgstr "" + +#: whatsnew/3.14.rst:2051 +msgid "" +":meth:`~unittest.TestCase.assertIsSubclass` and :meth:`~unittest.TestCase." +"assertNotIsSubclass` check whether the object is a subclass of a particular " +"class, or of one of a tuple of classes." +msgstr "" + +#: whatsnew/3.14.rst:2054 +msgid "" +":meth:`~unittest.TestCase.assertStartsWith`, :meth:`~unittest.TestCase." +"assertNotStartsWith`, :meth:`~unittest.TestCase.assertEndsWith` and :meth:" +"`~unittest.TestCase.assertNotEndsWith` check whether the Unicode or byte " +"string starts or ends with particular strings." +msgstr "" + +#: whatsnew/3.14.rst:2060 +msgid "(Contributed by Serhiy Storchaka in :gh:`71339`.)" +msgstr "" + +#: whatsnew/3.14.rst:2547 +msgid "urllib" +msgstr "" + +#: whatsnew/3.14.rst:2066 +msgid "" +"Upgrade HTTP digest authentication algorithm for :mod:`urllib.request` by " +"supporting SHA-256 digest authentication as specified in :rfc:`7616`. " +"(Contributed by Calvin Bui in :gh:`128193`.)" +msgstr "" + +#: whatsnew/3.14.rst:2070 +msgid "" +"Improve ergonomics and standards compliance when parsing and emitting ``file:" +"`` URLs." +msgstr "" + +#: whatsnew/3.14.rst:2073 +msgid "In :func:`~urllib.request.url2pathname`:" +msgstr "" + +#: whatsnew/3.14.rst:2075 +msgid "" +"Accept a complete URL when the new *require_scheme* argument is set to true." +msgstr "" + +#: whatsnew/3.14.rst:2077 +msgid "Discard URL authority if it matches the local hostname." +msgstr "" + +#: whatsnew/3.14.rst:2078 +msgid "" +"Discard URL authority if it resolves to a local IP address when the new " +"*resolve_host* argument is set to true." +msgstr "" + +#: whatsnew/3.14.rst:2080 +msgid "Discard URL query and fragment components." +msgstr "" + +#: whatsnew/3.14.rst:2081 +msgid "" +"Raise :exc:`~urllib.error.URLError` if a URL authority isn't local, except " +"on Windows where we return a UNC path as before." +msgstr "" + +#: whatsnew/3.14.rst:2084 +msgid "In :func:`~urllib.request.pathname2url`:" +msgstr "" + +#: whatsnew/3.14.rst:2086 +msgid "" +"Return a complete URL when the new *add_scheme* argument is set to true." +msgstr "" + +#: whatsnew/3.14.rst:2087 +msgid "" +"Include an empty URL authority when a path begins with a slash. For example, " +"the path ``/etc/hosts`` is converted to the URL ``///etc/hosts``." +msgstr "" + +#: whatsnew/3.14.rst:2090 +msgid "" +"On Windows, drive letters are no longer converted to uppercase, and ``:`` " +"characters not following a drive letter no longer cause an :exc:`OSError` " +"exception to be raised." +msgstr "" + +#: whatsnew/3.14.rst:2094 +msgid "(Contributed by Barney Gale in :gh:`125866`.)" +msgstr "" + +#: whatsnew/3.14.rst:2269 +msgid "uuid" +msgstr "" + +#: whatsnew/3.14.rst:2100 +msgid "" +"Add support for UUID versions 6, 7, and 8 via :func:`~uuid.uuid6`, :func:" +"`~uuid.uuid7`, and :func:`~uuid.uuid8` respectively, as specified in :rfc:" +"`9562`. (Contributed by Bénédikt Tran in :gh:`89083`.)" +msgstr "" + +#: whatsnew/3.14.rst:2105 +msgid "" +":const:`~uuid.NIL` and :const:`~uuid.MAX` are now available to represent the " +"Nil and Max UUID formats as defined by :rfc:`9562`. (Contributed by Nick " +"Pope in :gh:`128427`.)" +msgstr "" + +#: whatsnew/3.14.rst:2109 +msgid "" +"Allow generating multiple UUIDs simultaneously on the command-line via :" +"option:`python -m uuid --count `. (Contributed by Simon Legner " +"in :gh:`131236`.)" +msgstr "" + +#: whatsnew/3.14.rst:2115 +msgid "webbrowser" +msgstr "" + +#: whatsnew/3.14.rst:2117 +msgid "" +"Names in the :envvar:`BROWSER` environment variable can now refer to already " +"registered browsers for the :mod:`webbrowser` module, instead of always " +"generating a new browser command." +msgstr "" + +#: whatsnew/3.14.rst:2121 +msgid "" +"This makes it possible to set :envvar:`BROWSER` to the value of one of the " +"supported browsers on macOS." +msgstr "" + +#: whatsnew/3.14.rst:2126 +msgid "zipfile" +msgstr "" + +#: whatsnew/3.14.rst:2128 +msgid "" +"Added :meth:`ZipInfo._for_archive `, a method " +"to resolve suitable defaults for a :class:`~zipfile.ZipInfo` object as used " +"by :func:`ZipFile.writestr `. (Contributed by " +"Bénédikt Tran in :gh:`123424`.)" +msgstr "" + +#: whatsnew/3.14.rst:2133 +msgid "" +":meth:`.ZipFile.writestr` now respects the :envvar:`SOURCE_DATE_EPOCH` " +"environment variable in order to better support reproducible builds. " +"(Contributed by Jiahao Li in :gh:`91279`.)" +msgstr "" + +#: whatsnew/3.14.rst:2142 +msgid "Optimizations" +msgstr "" + +#: whatsnew/3.14.rst:2144 +msgid "" +"The import time for several standard library modules has been improved, " +"including :mod:`annotationlib`, :mod:`ast`, :mod:`asyncio`, :mod:`base64`, :" +"mod:`cmd`, :mod:`csv`, :mod:`gettext`, :mod:`importlib.util`, :mod:" +"`locale`, :mod:`mimetypes`, :mod:`optparse`, :mod:`pickle`, :mod:`pprint`, :" +"mod:`pstats`, :mod:`shlex`, :mod:`socket`, :mod:`string`, :mod:" +"`subprocess`, :mod:`threading`, :mod:`tomllib`, :mod:`types`, and :mod:" +"`zipfile`." +msgstr "" + +#: whatsnew/3.14.rst:2151 +msgid "" +"(Contributed by Adam Turner, Bénédikt Tran, Chris Markiewicz, Eli Schwartz, " +"Hugo van Kemenade, Jelle Zijlstra, and others in :gh:`118761`.)" +msgstr "" + +#: whatsnew/3.14.rst:2154 +msgid "" +"The interpreter now avoids some reference count modifications internally " +"when it's safe to do so. This can lead to different values being returned " +"from :func:`sys.getrefcount` and :c:func:`Py_REFCNT` compared to previous " +"versions of Python. See :ref:`below ` for details." +msgstr "" + +#: whatsnew/3.14.rst:2164 +msgid "" +"Standard benchmark results have improved by 10-20% following the " +"implementation of a new per-thread doubly linked list for :class:`native " +"tasks `, also reducing memory usage. This enables external " +"introspection tools such as :ref:`python -m asyncio pstree ` to introspect the call graph of asyncio tasks " +"running in all threads. (Contributed by Kumar Aditya in :gh:`107803`.)" +msgstr "" + +#: whatsnew/3.14.rst:2173 +msgid "" +"The module now has first class support for :term:`free-threading builds " +"`. This enables parallel execution of multiple event loops " +"across different threads, scaling linearly with the number of threads. " +"(Contributed by Kumar Aditya in :gh:`128002`.)" +msgstr "" + +#: whatsnew/3.14.rst:2181 +msgid "base64" +msgstr "" + +#: whatsnew/3.14.rst:2183 +msgid "" +":func:`~base64.b16decode` is now up to six times faster. (Contributed by " +"Bénédikt Tran, Chris Markiewicz, and Adam Turner in :gh:`118761`.)" +msgstr "" + +#: whatsnew/3.14.rst:2189 +msgid "bdb" +msgstr "" + +#: whatsnew/3.14.rst:2191 +msgid "" +"The basic debugger now has a :mod:`sys.monitoring`-based backend, which can " +"be selected via the passing ``'monitoring'`` to the :class:`~bdb.Bdb` " +"class's new *backend* parameter. (Contributed by Tian Gao in :gh:`124533`.)" +msgstr "" + +#: whatsnew/3.14.rst:2200 +msgid "" +"The :func:`~difflib.IS_LINE_JUNK` function is now up to twice as fast. " +"(Contributed by Adam Turner and Semyon Moroz in :gh:`130167`.)" +msgstr "" + +#: whatsnew/3.14.rst:2205 +msgid "gc" +msgstr "" + +#: whatsnew/3.14.rst:2207 +msgid "" +"The new :ref:`incremental garbage collector ` " +"means that maximum pause times are reduced by an order of magnitude or more " +"for larger heaps." +msgstr "" + +#: whatsnew/3.14.rst:2211 +msgid "" +"Because of this optimization, the meaning of the results of :meth:`~gc." +"get_threshold` and :meth:`~gc.set_threshold` have changed, along with :meth:" +"`~gc.get_count` and :meth:`~gc.get_stats`." +msgstr "" + +#: whatsnew/3.14.rst:2215 +msgid "" +"For backwards compatibility, :meth:`~gc.get_threshold` continues to return a " +"three-item tuple. The first value is the threshold for young collections, as " +"before; the second value determines the rate at which the old collection is " +"scanned (the default is 10, and higher values mean that the old collection " +"is scanned more slowly). The third value is now meaningless and is always " +"zero." +msgstr "" + +#: whatsnew/3.14.rst:2223 +msgid ":meth:`~gc.set_threshold` now ignores any items after the second." +msgstr "" + +#: whatsnew/3.14.rst:2225 +msgid "" +":meth:`~gc.get_count` and :meth:`~gc.get_stats` continue to return the same " +"format of results. The only difference is that instead of the results " +"referring to the young, aging and old generations, the results refer to the " +"young generation and the aging and collecting spaces of the old generation." +msgstr "" + +#: whatsnew/3.14.rst:2232 +msgid "" +"In summary, code that attempted to manipulate the behavior of the cycle GC " +"may not work exactly as intended, but it is very unlikely to be harmful. All " +"other code will work just fine." +msgstr "" + +#: whatsnew/3.14.rst:2242 +msgid "" +"Opening and reading files now executes fewer system calls. Reading a small " +"operating system cached file in full is up to 15% faster. (Contributed by " +"Cody Maloney and Victor Stinner in :gh:`120754` and :gh:`90102`.)" +msgstr "" + +#: whatsnew/3.14.rst:2251 +msgid "" +":func:`Path.read_bytes ` now uses unbuffered mode " +"to open files, which is between 9% and 17% faster to read in full. " +"(Contributed by Cody Maloney in :gh:`120754`.)" +msgstr "" + +#: whatsnew/3.14.rst:2259 +msgid "" +":mod:`pdb` now supports two backends, based on either :func:`sys.settrace` " +"or :mod:`sys.monitoring`. Using the :ref:`pdb CLI ` or :func:" +"`breakpoint` will always use the :mod:`sys.monitoring` backend. Explicitly " +"instantiating :class:`pdb.Pdb` and its derived classes will use the :func:" +"`sys.settrace` backend by default, which is configurable. (Contributed by " +"Tian Gao in :gh:`124533`.)" +msgstr "" + +#: whatsnew/3.14.rst:2271 +msgid "" +":func:`~uuid.uuid3` and :func:`~uuid.uuid5` are now both roughly 40% faster " +"for 16-byte names and 20% faster for 1024-byte names. Performance for longer " +"names remains unchanged. (Contributed by Bénédikt Tran in :gh:`128150`.)" +msgstr "" + +#: whatsnew/3.14.rst:2276 +msgid "" +":func:`~uuid.uuid4` is now c. 30% faster. (Contributed by Bénédikt Tran in :" +"gh:`128150`.)" +msgstr "" + +#: whatsnew/3.14.rst:2281 +msgid "zlib" +msgstr "" + +#: whatsnew/3.14.rst:2283 +msgid "" +"On Windows, `zlib-ng `__ is now used as " +"the implementation of the :mod:`zlib` module in the default binaries. There " +"are no known incompatibilities between ``zlib-ng`` and the previously-used " +"``zlib`` implementation. This should result in better performance at all " +"compression levels." +msgstr "" + +#: whatsnew/3.14.rst:2290 +msgid "" +"It is worth noting that ``zlib.Z_BEST_SPEED`` (``1``) may result in " +"significantly less compression than the previous implementation, whilst also " +"significantly reducing the time taken to compress." +msgstr "" + +#: whatsnew/3.14.rst:2294 +msgid "(Contributed by Steve Dower in :gh:`91349`.)" +msgstr "" + +#: whatsnew/3.14.rst:2298 +msgid "Removed" +msgstr "" + +#: whatsnew/3.14.rst:2303 +msgid "" +"Remove the *type*, *choices*, and *metavar* parameters of :class:`!" +"BooleanOptionalAction`. These have been deprecated since Python 3.12. " +"(Contributed by Nikita Sobolev in :gh:`118805`.)" +msgstr "" + +#: whatsnew/3.14.rst:2308 +msgid "" +"Calling :meth:`~argparse.ArgumentParser.add_argument_group` on an argument " +"group now raises a :exc:`ValueError`. Similarly, :meth:`~argparse." +"ArgumentParser.add_argument_group` or :meth:`~argparse.ArgumentParser." +"add_mutually_exclusive_group` on a mutually exclusive group now both raise :" +"exc:`ValueError`\\ s. This 'nesting' was never supported, often failed to " +"work correctly, and was unintentionally exposed through inheritance. This " +"functionality has been deprecated since Python 3.11. (Contributed by " +"Savannah Ostrowski in :gh:`127186`.)" +msgstr "" + +#: whatsnew/3.14.rst:2322 +msgid "" +"Remove the following classes, which have been deprecated aliases of :class:" +"`~ast.Constant` since Python 3.8 and have emitted deprecation warnings since " +"Python 3.12:" +msgstr "" + +#: whatsnew/3.14.rst:2326 +msgid ":class:`!Bytes`" +msgstr "" + +#: whatsnew/3.14.rst:2327 +msgid ":class:`!Ellipsis`" +msgstr "" + +#: whatsnew/3.14.rst:2328 +msgid ":class:`!NameConstant`" +msgstr "" + +#: whatsnew/3.14.rst:2329 +msgid ":class:`!Num`" +msgstr "" + +#: whatsnew/3.14.rst:2330 +msgid ":class:`!Str`" +msgstr "" + +#: whatsnew/3.14.rst:2332 +msgid "" +"As a consequence of these removals, user-defined ``visit_Num``, " +"``visit_Str``, ``visit_Bytes``, ``visit_NameConstant`` and " +"``visit_Ellipsis`` methods on custom :class:`~ast.NodeVisitor` subclasses " +"will no longer be called when the :class:`!NodeVisitor` subclass is visiting " +"an AST. Define a ``visit_Constant`` method instead." +msgstr "" + +#: whatsnew/3.14.rst:2338 +msgid "(Contributed by Alex Waygood in :gh:`119562`.)" +msgstr "" + +#: whatsnew/3.14.rst:2340 +msgid "" +"Remove the following deprecated properties on :class:`ast.Constant`, which " +"were present for compatibility with the now-removed AST classes:" +msgstr "" + +#: whatsnew/3.14.rst:2343 +msgid ":attr:`!Constant.n`" +msgstr "" + +#: whatsnew/3.14.rst:2344 +msgid ":attr:`!Constant.s`" +msgstr "" + +#: whatsnew/3.14.rst:2346 +msgid "" +"Use :attr:`!Constant.value` instead. (Contributed by Alex Waygood in :gh:" +"`119562`.)" +msgstr "" + +#: whatsnew/3.14.rst:2353 +msgid "" +"Remove the following classes, methods, and functions, which have been " +"deprecated since Python 3.12:" +msgstr "" + +#: whatsnew/3.14.rst:2356 +msgid ":class:`!AbstractChildWatcher`" +msgstr "" + +#: whatsnew/3.14.rst:2357 +msgid ":class:`!FastChildWatcher`" +msgstr "" + +#: whatsnew/3.14.rst:2358 +msgid ":class:`!MultiLoopChildWatcher`" +msgstr "" + +#: whatsnew/3.14.rst:2359 +msgid ":class:`!PidfdChildWatcher`" +msgstr "" + +#: whatsnew/3.14.rst:2360 +msgid ":class:`!SafeChildWatcher`" +msgstr "" + +#: whatsnew/3.14.rst:2361 +msgid ":class:`!ThreadedChildWatcher`" +msgstr "" + +#: whatsnew/3.14.rst:2362 +msgid ":meth:`!AbstractEventLoopPolicy.get_child_watcher`" +msgstr "" + +#: whatsnew/3.14.rst:2363 +msgid ":meth:`!AbstractEventLoopPolicy.set_child_watcher`" +msgstr "" + +#: whatsnew/3.14.rst:2364 +msgid ":func:`!get_child_watcher`" +msgstr "" + +#: whatsnew/3.14.rst:2365 +msgid ":func:`!set_child_watcher`" +msgstr "" + +#: whatsnew/3.14.rst:2367 +msgid "(Contributed by Kumar Aditya in :gh:`120804`.)" +msgstr "" + +#: whatsnew/3.14.rst:2369 +msgid "" +":func:`asyncio.get_event_loop` now raises a :exc:`RuntimeError` if there is " +"no current event loop, and no longer implicitly creates an event loop." +msgstr "" + +#: whatsnew/3.14.rst:2373 +msgid "(Contributed by Kumar Aditya in :gh:`126353`.)" +msgstr "" + +#: whatsnew/3.14.rst:2378 +msgid "" +"There's a few patterns that use :func:`asyncio.get_event_loop`, most of them " +"can be replaced with :func:`asyncio.run`." +msgstr "" + +#: whatsnew/3.14.rst:2381 +msgid "If you're running an async function, simply use :func:`asyncio.run`." +msgstr "" + +#: whatsnew/3.14.rst:2410 whatsnew/3.14.rst:2438 +msgid "Before:" +msgstr "" + +#: whatsnew/3.14.rst:2385 +msgid "" +"async def main():\n" +" ...\n" +"\n" +"\n" +"loop = asyncio.get_event_loop()\n" +"try:\n" +" loop.run_until_complete(main())\n" +"finally:\n" +" loop.close()" +msgstr "" + +#: whatsnew/3.14.rst:2423 whatsnew/3.14.rst:2454 +msgid "After:" +msgstr "" + +#: whatsnew/3.14.rst:2399 +msgid "" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: whatsnew/3.14.rst:2406 +msgid "" +"If you need to start something, for example, a server listening on a socket " +"and then run forever, use :func:`asyncio.run` and an :class:`asyncio.Event`." +msgstr "" + +#: whatsnew/3.14.rst:2412 +msgid "" +"def start_server(loop): ...\n" +"\n" +"loop = asyncio.get_event_loop()\n" +"try:\n" +" start_server(loop)\n" +" loop.run_forever()\n" +"finally:\n" +" loop.close()" +msgstr "" + +#: whatsnew/3.14.rst:2425 +msgid "" +"def start_server(loop): ...\n" +"\n" +"async def main():\n" +" start_server(asyncio.get_running_loop())\n" +" await asyncio.Event().wait()\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: whatsnew/3.14.rst:2435 +msgid "" +"If you need to run something in an event loop, then run some blocking code " +"around it, use :class:`asyncio.Runner`." +msgstr "" + +#: whatsnew/3.14.rst:2440 +msgid "" +"async def operation_one(): ...\n" +"def blocking_code(): ...\n" +"async def operation_two(): ...\n" +"\n" +"loop = asyncio.get_event_loop()\n" +"try:\n" +" loop.run_until_complete(operation_one())\n" +" blocking_code()\n" +" loop.run_until_complete(operation_two())\n" +"finally:\n" +" loop.close()" +msgstr "" + +#: whatsnew/3.14.rst:2456 +msgid "" +"async def operation_one(): ...\n" +"def blocking_code(): ...\n" +"async def operation_two(): ...\n" +"\n" +"with asyncio.Runner() as runner:\n" +" runner.run(operation_one())\n" +" blocking_code()\n" +" runner.run(operation_two())" +msgstr "" + +#: whatsnew/3.14.rst:2469 +msgid "email" +msgstr "" + +#: whatsnew/3.14.rst:2471 +msgid "" +"Remove :func:`email.utils.localtime`'s *isdst* parameter, which was " +"deprecated in and has been ignored since Python 3.12. (Contributed by Hugo " +"van Kemenade in :gh:`118798`.)" +msgstr "" + +#: whatsnew/3.14.rst:2477 +msgid "importlib.abc" +msgstr "" + +#: whatsnew/3.14.rst:2479 +msgid "Remove deprecated :mod:`importlib.abc` classes:" +msgstr "" + +#: whatsnew/3.14.rst:2481 +msgid "" +":class:`!ResourceReader` (use :class:`~importlib.resources.abc." +"TraversableResources`)" +msgstr "" + +#: whatsnew/3.14.rst:2483 +msgid "" +":class:`!Traversable` (use :class:`~importlib.resources.abc.Traversable`)" +msgstr "" + +#: whatsnew/3.14.rst:2485 +msgid "" +":class:`!TraversableResources` (use :class:`~importlib.resources.abc." +"TraversableResources`)" +msgstr "" + +#: whatsnew/3.14.rst:2488 +msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" +msgstr "" + +#: whatsnew/3.14.rst:2492 +msgid "itertools" +msgstr "" + +#: whatsnew/3.14.rst:2494 +msgid "" +"Remove support for copy, deepcopy, and pickle operations from :mod:" +"`itertools` iterators. These have emitted a :exc:`DeprecationWarning` since " +"Python 3.12. (Contributed by Raymond Hettinger in :gh:`101588`.)" +msgstr "" + +#: whatsnew/3.14.rst:2503 +msgid "" +"Remove support for passing additional keyword arguments to :class:`~pathlib." +"Path`. In previous versions, any such arguments are ignored. (Contributed by " +"Barney Gale in :gh:`74033`.)" +msgstr "" + +#: whatsnew/3.14.rst:2508 +msgid "" +"Remove support for passing additional positional arguments to :meth:`." +"PurePath.relative_to` and :meth:`~pathlib.PurePath.is_relative_to`. In " +"previous versions, any such arguments are joined onto *other*. (Contributed " +"by Barney Gale in :gh:`78707`.)" +msgstr "" + +#: whatsnew/3.14.rst:2515 +msgid "pkgutil" +msgstr "" + +#: whatsnew/3.14.rst:2517 +msgid "" +"Remove the :func:`!get_loader` and :func:`!find_loader` functions, which " +"have been deprecated since Python 3.12. (Contributed by Bénédikt Tran in :gh:" +"`97850`.)" +msgstr "" + +#: whatsnew/3.14.rst:2523 +msgid "pty" +msgstr "" + +#: whatsnew/3.14.rst:2525 +msgid "" +"Remove the :func:`!master_open` and :func:`!slave_open` functions, which " +"have been deprecated since Python 3.12. Use :func:`pty.openpty` instead. " +"(Contributed by Nikita Sobolev in :gh:`118824`.)" +msgstr "" + +#: whatsnew/3.14.rst:2532 +msgid "sqlite3" +msgstr "" + +#: whatsnew/3.14.rst:2534 +msgid "" +"Remove :data:`!version` and :data:`!version_info` from the :mod:`sqlite3` " +"module; use :data:`~sqlite3.sqlite_version` and :data:`~sqlite3." +"sqlite_version_info` for the actual version number of the runtime SQLite " +"library. (Contributed by Hugo van Kemenade in :gh:`118924`.)" +msgstr "" + +#: whatsnew/3.14.rst:2540 +msgid "" +"Using a sequence of parameters with named placeholders now raises a :exc:" +"`~sqlite3.ProgrammingError`, having been deprecated since Python 3.12. " +"(Contributed by Erlend E. Aasland in :gh:`118928` and :gh:`101693`.)" +msgstr "" + +#: whatsnew/3.14.rst:2549 +msgid "" +"Remove the :class:`!Quoter` class from :mod:`urllib.parse`, which has been " +"deprecated since Python 3.11. (Contributed by Nikita Sobolev in :gh:" +"`118827`.)" +msgstr "" + +#: whatsnew/3.14.rst:2553 +msgid "" +"Remove the :class:`!URLopener` and :class:`!FancyURLopener` classes from :" +"mod:`urllib.request`, which have been deprecated since Python 3.3." +msgstr "" + +#: whatsnew/3.14.rst:2557 +msgid "" +"``myopener.open()`` can be replaced with :func:`~urllib.request.urlopen`. " +"``myopener.retrieve()`` can be replaced with :func:`~urllib.request." +"urlretrieve`. Customisations to the opener classes can be replaced by " +"passing customized handlers to :func:`~urllib.request.build_opener`. " +"(Contributed by Barney Gale in :gh:`84850`.)" +msgstr "" + +#: whatsnew/3.14.rst:2566 +msgid "Deprecated" +msgstr "" + +#: whatsnew/3.14.rst:2569 +msgid "New deprecations" +msgstr "" + +#: whatsnew/3.14.rst:2571 +msgid "" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; complex numbers should only be " +"passed as a single positional argument. (Contributed by Serhiy Storchaka in :" +"gh:`109218`.)" +msgstr "" + +#: whatsnew/3.14.rst:2576 deprecations/pending-removal-in-future.rst:7 +msgid ":mod:`argparse`:" +msgstr "" + +#: whatsnew/3.14.rst:2578 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* to the :meth:" +"`~argparse.ArgumentParser.add_argument_group` method is now deprecated. " +"(Contributed by Savannah Ostrowski in :gh:`125563`.)" +msgstr "" + +#: whatsnew/3.14.rst:2582 +msgid "" +"Deprecated the :class:`argparse.FileType` type converter. Anything relating " +"to resource management should be handled downstream, after the arguments " +"have been parsed. (Contributed by Serhiy Storchaka in :gh:`58032`.)" +msgstr "" + +#: whatsnew/3.14.rst:2587 deprecations/pending-removal-in-3.16.rst:19 +msgid ":mod:`asyncio`:" +msgstr "" + +#: whatsnew/3.14.rst:2589 +msgid "" +"The :func:`!asyncio.iscoroutinefunction` is now deprecated and will be " +"removed in Python 3.16; use :func:`inspect.iscoroutinefunction` instead. " +"(Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: whatsnew/3.14.rst:2594 +msgid "" +"The :mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" +msgstr "" + +#: whatsnew/3.14.rst:2598 deprecations/pending-removal-in-3.16.rst:29 +msgid ":class:`asyncio.AbstractEventLoopPolicy`" +msgstr "" + +#: whatsnew/3.14.rst:2599 deprecations/pending-removal-in-3.16.rst:30 +msgid ":class:`asyncio.DefaultEventLoopPolicy`" +msgstr "" + +#: whatsnew/3.14.rst:2600 deprecations/pending-removal-in-3.16.rst:31 +msgid ":class:`asyncio.WindowsSelectorEventLoopPolicy`" +msgstr "" + +#: whatsnew/3.14.rst:2601 deprecations/pending-removal-in-3.16.rst:32 +msgid ":class:`asyncio.WindowsProactorEventLoopPolicy`" +msgstr "" + +#: whatsnew/3.14.rst:2602 deprecations/pending-removal-in-3.16.rst:33 +msgid ":func:`asyncio.get_event_loop_policy`" +msgstr "" + +#: whatsnew/3.14.rst:2603 deprecations/pending-removal-in-3.16.rst:34 +msgid ":func:`asyncio.set_event_loop_policy`" +msgstr "" + +#: whatsnew/3.14.rst:2605 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with the " +"*loop_factory* argument to use the desired event loop implementation." +msgstr "" + +#: whatsnew/3.14.rst:2608 +msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows:" +msgstr "" + +#: whatsnew/3.14.rst:2610 deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)" +msgstr "" + +#: whatsnew/3.14.rst:2619 deprecations/pending-removal-in-3.16.rst:48 +msgid "(Contributed by Kumar Aditya in :gh:`127949`.)" +msgstr "" + +#: whatsnew/3.14.rst:2621 +msgid "" +":mod:`codecs`: The :func:`codecs.open` function is now deprecated, and will " +"be removed in a future version of Python. Use :func:`open` instead. " +"(Contributed by Inada Naoki in :gh:`133036`.)" +msgstr "" + +#: whatsnew/3.14.rst:2627 deprecations/pending-removal-in-3.15.rst:16 +#: deprecations/pending-removal-in-3.19.rst:4 +msgid ":mod:`ctypes`:" +msgstr "" + +#: whatsnew/3.14.rst:2629 +msgid "" +"On non-Windows platforms, setting :attr:`.Structure._pack_` to use a MSVC-" +"compatible default memory layout is now deprecated in favor of setting :attr:" +"`.Structure._layout_` to ``'ms'``, and will be removed in Python 3.19. " +"(Contributed by Petr Viktorin in :gh:`131747`.)" +msgstr "" + +#: whatsnew/3.14.rst:2634 +msgid "" +"Calling :func:`ctypes.POINTER` on a string is now deprecated. Use :ref:" +"`incomplete types ` for self-referential " +"structures. Also, the internal ``ctypes._pointer_type_cache`` is deprecated. " +"See :func:`ctypes.POINTER` for updated implementation details. (Contributed " +"by Sergey Myrianov in :gh:`100926`.)" +msgstr "" + +#: whatsnew/3.14.rst:2641 +msgid "" +":mod:`functools`: Calling the Python implementation of :func:`functools." +"reduce` with *function* or *sequence* as keyword arguments is now " +"deprecated; the parameters will be made positional-only in Python 3.16. " +"(Contributed by Kirill Podoprigora in :gh:`121676`.)" +msgstr "" + +#: whatsnew/3.14.rst:2647 +msgid "" +":mod:`logging`: Support for custom logging handlers with the *strm* argument " +"is now deprecated and scheduled for removal in Python 3.16. Define handlers " +"with the *stream* argument instead. (Contributed by Mariusz Felisiak in :gh:" +"`115032`.)" +msgstr "" + +#: whatsnew/3.14.rst:2653 +msgid "" +":mod:`mimetypes`: Valid extensions are either empty or must start with '.' " +"for :meth:`mimetypes.MimeTypes.add_type`. Undotted extensions are deprecated " +"and will raise a :exc:`ValueError` in Python 3.16. (Contributed by Hugo van " +"Kemenade in :gh:`75223`.)" +msgstr "" + +#: whatsnew/3.14.rst:2660 +msgid "" +":mod:`!nturl2path`: This module is now deprecated. Call :func:`urllib." +"request.url2pathname` and :func:`~urllib.request.pathname2url` instead. " +"(Contributed by Barney Gale in :gh:`125866`.)" +msgstr "" + +#: whatsnew/3.14.rst:2665 +msgid "" +":mod:`os`: The :func:`os.popen` and :func:`os.spawn* ` functions " +"are now :term:`soft deprecated`. They should no longer be used to write new " +"code. The :mod:`subprocess` module is recommended instead. (Contributed by " +"Victor Stinner in :gh:`120743`.)" +msgstr "" + +#: whatsnew/3.14.rst:2672 +msgid "" +":mod:`pathlib`: :meth:`!pathlib.PurePath.as_uri` is now deprecated and " +"scheduled for removal in Python 3.19. Use :meth:`pathlib.Path.as_uri` " +"instead. (Contributed by Barney Gale in :gh:`123599`.)" +msgstr "" + +#: whatsnew/3.14.rst:2678 +msgid "" +":mod:`pdb`: The undocumented ``pdb.Pdb.curframe_locals`` attribute is now a " +"deprecated read-only property, which will be removed in a future version of " +"Python. The low overhead dynamic frame locals access added in Python 3.13 " +"by :pep:`667` means the frame locals cache reference previously stored in " +"this attribute is no longer needed. Derived debuggers should access ``pdb." +"Pdb.curframe.f_locals`` directly in Python 3.13 and later versions. " +"(Contributed by Tian Gao in :gh:`124369` and :gh:`125951`.)" +msgstr "" + +#: whatsnew/3.14.rst:2687 +msgid "" +":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " +"lack of interest, scheduled for removal in Python 3.16. (Contributed by " +"Bénédikt Tran in :gh:`119698`.)" +msgstr "" + +#: whatsnew/3.14.rst:2692 +msgid "" +":mod:`tkinter`: The :class:`!tkinter.Variable` methods :meth:`!" +"trace_variable`, :meth:`!trace_vdelete` and :meth:`!trace_vinfo` are now " +"deprecated. Use :meth:`!trace_add`, :meth:`!trace_remove` and :meth:`!" +"trace_info` instead. (Contributed by Serhiy Storchaka in :gh:`120220`.)" +msgstr "" + +#: whatsnew/3.14.rst:2698 +msgid "" +":mod:`urllib.parse`: Accepting objects with false values (like ``0`` and " +"``[]``) except empty strings, bytes-like objects and ``None`` in :func:" +"`~urllib.parse.parse_qsl` and :func:`~urllib.parse.parse_qs` is now " +"deprecated. (Contributed by Serhiy Storchaka in :gh:`116897`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:2 +#: deprecations/pending-removal-in-3.15.rst:2 +msgid "Pending removal in Python 3.15" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:4 +#: deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:18 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:21 +msgid ":mod:`http.server`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:23 +msgid "" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:29 +msgid "" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:32 +#: deprecations/pending-removal-in-future.rst:63 +msgid ":mod:`importlib`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:36 +msgid ":class:`locale`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:38 +msgid "" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:46 +msgid ":mod:`pathlib`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:48 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:52 +msgid ":mod:`platform`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:54 +msgid "" +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:58 +#: deprecations/pending-removal-in-3.16.rst:96 +msgid ":mod:`sysconfig`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`threading`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:65 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:71 +msgid ":mod:`types`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:73 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:80 +#: deprecations/pending-removal-in-3.17.rst:26 +msgid ":mod:`typing`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:82 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (for example, ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``) has been deprecated since Python 3.13. Use the class-based syntax " +"or the functional syntax instead." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:88 +msgid "" +"When using the functional syntax of :class:`~typing.TypedDict`\\s, failing " +"to pass a value to the *fields* parameter (``TD = TypedDict(\"TD\")``) or " +"passing ``None`` (``TD = TypedDict(\"TD\", None)``) has been deprecated " +"since Python 3.13. Use ``class TD(TypedDict): pass`` or ``TD = " +"TypedDict(\"TD\", {})`` to create a TypedDict with zero field." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:95 +msgid "" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:100 +msgid ":mod:`wave`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:102 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:107 +msgid ":mod:`zipimport`:" +msgstr "" + +#: deprecations/pending-removal-in-3.15.rst:109 +msgid "" +":meth:`~zipimport.zipimporter.load_module` has been deprecated since Python " +"3.10. Use :meth:`~zipimport.zipimporter.exec_module` instead. (Contributed " +"by Jiahao Li in :gh:`125746`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.16.rst:2 +#: deprecations/pending-removal-in-3.16.rst:2 +msgid "Pending removal in Python 3.16" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:11 +msgid ":mod:`array`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:13 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16; use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:26 +msgid "" +":mod:`asyncio` policy system is deprecated and will be removed in Python " +"3.16. In particular, the following classes and functions are deprecated:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:36 +msgid "" +"Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with " +"*loop_factory* to use the desired event loop implementation." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:39 +msgid "For example, to use :class:`asyncio.SelectorEventLoop` on Windows::" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:50 +#: deprecations/pending-removal-in-future.rst:16 +msgid ":mod:`builtins`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:52 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:59 +msgid ":mod:`functools`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:61 +msgid "" +"Calling the Python implementation of :func:`functools.reduce` with " +"*function* or *sequence* as keyword arguments has been deprecated since " +"Python 3.14." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:64 +msgid ":mod:`logging`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:66 +msgid "" +"Support for custom logging handlers with the *strm* argument is deprecated " +"and scheduled for removal in Python 3.16. Define handlers with the *stream* " +"argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:70 +msgid ":mod:`mimetypes`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:72 +msgid "" +"Valid extensions start with a '.' or are empty for :meth:`mimetypes." +"MimeTypes.add_type`. Undotted extensions are deprecated and will raise a :" +"exc:`ValueError` in Python 3.16. (Contributed by Hugo van Kemenade in :gh:" +"`75223`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:78 +msgid ":mod:`shutil`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:80 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:85 +msgid ":mod:`symtable`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:87 +msgid "" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:90 +msgid ":mod:`sys`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:92 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:98 +msgid "" +"The :func:`!sysconfig.expand_makefile_vars` function has been deprecated " +"since Python 3.14. Use the ``vars`` argument of :func:`sysconfig.get_paths` " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:102 +msgid ":mod:`tarfile`:" +msgstr "" + +#: deprecations/pending-removal-in-3.16.rst:104 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:2 +msgid "Pending removal in Python 3.17" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:4 +msgid ":mod:`collections.abc`:" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:6 +msgid "" +":class:`collections.abc.ByteString` is scheduled for removal in Python 3.17." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:8 +#: deprecations/pending-removal-in-3.17.rst:36 +msgid "" +"Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj`` " +"implements the :ref:`buffer protocol ` at runtime. For use in " +"type annotations, either use :class:`~collections.abc.Buffer` or a union " +"that explicitly specifies the types your code supports (e.g., ``bytes | " +"bytearray | memoryview``)." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:14 +#: deprecations/pending-removal-in-3.17.rst:42 +msgid "" +":class:`!ByteString` was originally intended to be an abstract class that " +"would serve as a supertype of both :class:`bytes` and :class:`bytearray`. " +"However, since the ABC never had any methods, knowing that an object was an " +"instance of :class:`!ByteString` never actually told you anything useful " +"about the object. Other common buffer types such as :class:`memoryview` were " +"also never understood as subtypes of :class:`!ByteString` (either at runtime " +"or by static type checkers)." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:22 +#: deprecations/pending-removal-in-3.17.rst:50 +msgid "" +"See :pep:`PEP 688 <688#current-options>` for more details. (Contributed by " +"Shantanu Jain in :gh:`91896`.)" +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:28 +msgid "" +"Before Python 3.14, old-style unions were implemented using the private " +"class ``typing._UnionGenericAlias``. This class is no longer needed for the " +"implementation, but it has been retained for backward compatibility, with " +"removal scheduled for Python 3.17. Users should use documented introspection " +"helpers like :func:`typing.get_origin` and :func:`typing.get_args` instead " +"of relying on private implementation details." +msgstr "" + +#: deprecations/pending-removal-in-3.17.rst:33 +msgid "" +":class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for " +"removal in Python 3.17." +msgstr "" + +#: deprecations/pending-removal-in-3.19.rst:2 +msgid "Pending removal in Python 3.19" +msgstr "" + +#: deprecations/pending-removal-in-3.19.rst:6 +msgid "" +"Implicitly switching to the MSVC-compatible struct layout by setting :attr:" +"`~ctypes.Structure._pack_` but not :attr:`~ctypes.Structure._layout_` on non-" +"Windows platforms." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:2 +#: deprecations/pending-removal-in-future.rst:2 +msgid "Pending removal in future versions" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:4 +msgid "" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:9 +msgid "" +"Nesting argument groups and nesting mutually exclusive groups are deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:11 +msgid "" +"Passing the undocumented keyword argument *prefix_chars* to :meth:`~argparse." +"ArgumentParser.add_argument_group` is now deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:14 +msgid "The :class:`argparse.FileType` type converter is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:18 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:21 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:35 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:38 +msgid "Delegation of ``int()`` to ``__trunc__()`` method." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:39 +msgid "" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:44 +msgid "" +":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:49 +msgid "" +":mod:`codecs`: use :func:`open` instead of :func:`codecs.open`. (:gh:" +"`133038`)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:51 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:54 +msgid ":mod:`datetime`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:56 +msgid "" +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:58 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:61 +msgid ":mod:`gettext`: Plural value must be an integer." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:65 +msgid "" +":func:`~importlib.util.cache_from_source` *debug_override* parameter is " +"deprecated: use the *optimization* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:68 +msgid ":mod:`importlib.metadata`:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:70 +msgid "``EntryPoints`` tuple interface." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:71 +msgid "Implicit ``None`` on return values." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:73 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:76 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:79 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:81 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:84 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:91 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:93 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:96 +msgid ":mod:`ssl` options and protocols:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:98 +msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:99 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:102 +msgid "``ssl.OP_NO_SSL*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:103 +msgid "``ssl.OP_NO_TLS*`` options" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:104 +msgid "``ssl.PROTOCOL_SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:105 +msgid "``ssl.PROTOCOL_TLS``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:106 +msgid "``ssl.PROTOCOL_TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:107 +msgid "``ssl.PROTOCOL_TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:108 +msgid "``ssl.PROTOCOL_TLSv1_2``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:109 +msgid "``ssl.TLSVersion.SSLv3``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:110 +msgid "``ssl.TLSVersion.TLSv1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:111 +msgid "``ssl.TLSVersion.TLSv1_1``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:113 +msgid ":mod:`threading` methods:" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:115 +msgid "" +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:116 +msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:117 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:119 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:121 +msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:122 +msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:124 +msgid ":class:`typing.Text` (:gh:`92332`)." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:126 +msgid "" +"The internal class ``typing._UnionGenericAlias`` is no longer used to " +"implement :class:`typing.Union`. To preserve compatibility with users using " +"this private class, a compatibility shim will be provided until at least " +"Python 3.17. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:131 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:134 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:136 +msgid "``splitattr()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:137 +msgid "``splithost()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:138 +msgid "``splitnport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:139 +msgid "``splitpasswd()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:140 +msgid "``splitport()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:141 +msgid "``splitquery()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:142 +msgid "``splittag()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:143 +msgid "``splittype()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:144 +msgid "``splituser()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:145 +msgid "``splitvalue()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:146 +msgid "``to_bytes()``" +msgstr "" + +#: deprecations/pending-removal-in-future.rst:148 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:151 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." +msgstr "" + +#: deprecations/pending-removal-in-future.rst:156 +msgid "" +":func:`sys._clear_type_cache` is deprecated: use :func:`sys." +"_clear_internal_caches` instead." +msgstr "" + +#: whatsnew/3.14.rst:2718 +msgid "CPython bytecode changes" +msgstr "" + +#: whatsnew/3.14.rst:2720 +msgid "" +"Replaced the opcode :opcode:`!BINARY_SUBSCR` by the :opcode:`BINARY_OP` " +"opcode with the ``NB_SUBSCR`` oparg. (Contributed by Irit Katriel in :gh:" +"`100239`.)" +msgstr "" + +#: whatsnew/3.14.rst:2724 +msgid "" +"Add the :opcode:`BUILD_INTERPOLATION` and :opcode:`BUILD_TEMPLATE` opcodes " +"to construct new :class:`~string.templatelib.Interpolation` and :class:" +"`~string.templatelib.Template` instances, respectively. (Contributed by " +"Lysandros Nikolaou and others in :gh:`132661`; see also :ref:`PEP 750: " +"Template strings `)." +msgstr "" + +#: whatsnew/3.14.rst:2730 +msgid "" +"Remove the :opcode:`!BUILD_CONST_KEY_MAP` opcode. Use :opcode:`BUILD_MAP` " +"instead. (Contributed by Mark Shannon in :gh:`122160`.)" +msgstr "" + +#: whatsnew/3.14.rst:2734 +msgid "" +"Replace the :opcode:`!LOAD_ASSERTION_ERROR` opcode with :opcode:" +"`LOAD_COMMON_CONSTANT` and add support for loading :exc:" +"`NotImplementedError`." +msgstr "" + +#: whatsnew/3.14.rst:2738 +msgid "" +"Add the :opcode:`LOAD_FAST_BORROW` and :opcode:" +"`LOAD_FAST_BORROW_LOAD_FAST_BORROW` opcodes to reduce reference counting " +"overhead when the interpreter can prove that the reference in the frame " +"outlives the reference loaded onto the stack. (Contributed by Matt Page in :" +"gh:`130704`.)" +msgstr "" + +#: whatsnew/3.14.rst:2743 +msgid "" +"Add the :opcode:`LOAD_SMALL_INT` opcode, which pushes a small integer equal " +"to the ``oparg`` to the stack. The :opcode:`!RETURN_CONST` opcode is removed " +"as it is no longer used. (Contributed by Mark Shannon in :gh:`125837`.)" +msgstr "" + +#: whatsnew/3.14.rst:2748 +msgid "" +"Add the new :opcode:`LOAD_SPECIAL` instruction. Generate code for :keyword:" +"`with` and :keyword:`async with` statements using the new instruction. " +"Removed the :opcode:`!BEFORE_WITH` and :opcode:`!BEFORE_ASYNC_WITH` " +"instructions. (Contributed by Mark Shannon in :gh:`120507`.)" +msgstr "" + +#: whatsnew/3.14.rst:2754 +msgid "" +"Add the :opcode:`POP_ITER` opcode to support 'virtual' iterators. " +"(Contributed by Mark Shannon in :gh:`132554`.)" +msgstr "" + +#: whatsnew/3.14.rst:2759 +msgid "Pseudo-instructions" +msgstr "" + +#: whatsnew/3.14.rst:2761 +msgid "" +"Add the :opcode:`!ANNOTATIONS_PLACEHOLDER` pseudo instruction to support " +"partially executed module-level annotations with :ref:`deferred evaluation " +"of annotations `. (Contributed by Jelle " +"Zijlstra in :gh:`130907`.)" +msgstr "" + +#: whatsnew/3.14.rst:2766 +msgid "" +"Add the :opcode:`!BINARY_OP_EXTEND` pseudo instruction, which executes a " +"pair of functions (guard and specialization functions) accessed from the " +"inline cache. (Contributed by Irit Katriel in :gh:`100239`.)" +msgstr "" + +#: whatsnew/3.14.rst:2771 +msgid "" +"Add three specializations for :opcode:`CALL_KW`; :opcode:`!CALL_KW_PY` for " +"calls to Python functions, :opcode:`!CALL_KW_BOUND_METHOD` for calls to " +"bound methods, and :opcode:`!CALL_KW_NON_PY` for all other calls. " +"(Contributed by Mark Shannon in :gh:`118093`.)" +msgstr "" + +#: whatsnew/3.14.rst:2777 +msgid "" +"Add the :opcode:`JUMP_IF_TRUE` and :opcode:`JUMP_IF_FALSE` pseudo " +"instructions, conditional jumps which do not impact the stack. Replaced by " +"the sequence ``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``. " +"(Contributed by Irit Katriel in :gh:`124285`.)" +msgstr "" + +#: whatsnew/3.14.rst:2782 +msgid "" +"Add the :opcode:`!LOAD_CONST_MORTAL` pseudo instruction. (Contributed by " +"Mark Shannon in :gh:`128685`.)" +msgstr "" + +#: whatsnew/3.14.rst:2785 +msgid "" +"Add the :opcode:`LOAD_CONST_IMMORTAL` pseudo instruction, which does the " +"same as :opcode:`!LOAD_CONST`, but is more efficient for immortal objects. " +"(Contributed by Mark Shannon in :gh:`125837`.)" +msgstr "" + +#: whatsnew/3.14.rst:2790 +msgid "" +"Add the :opcode:`NOT_TAKEN` pseudo instruction, used by :mod:`sys." +"monitoring` to record branch events (such as :monitoring-event:" +"`BRANCH_LEFT`). (Contributed by Mark Shannon in :gh:`122548`.)" +msgstr "" + +#: whatsnew/3.14.rst:2796 +msgid "C API changes" +msgstr "" + +#: whatsnew/3.14.rst:2801 +msgid "Python configuration C API" +msgstr "" + +#: whatsnew/3.14.rst:2803 +msgid "" +"Add a :ref:`PyInitConfig C API ` to configure the Python " +"initialization without relying on C structures and the ability to make ABI-" +"compatible changes in the future." +msgstr "" + +#: whatsnew/3.14.rst:2807 +msgid "" +"Complete the :pep:`587` :ref:`PyConfig C API ` by adding :c:" +"func:`PyInitConfig_AddModule` which can be used to add a built-in extension " +"module; a feature previously referred to as the \"inittab\"." +msgstr "" + +#: whatsnew/3.14.rst:2811 +msgid "" +"Add :c:func:`PyConfig_Get` and :c:func:`PyConfig_Set` functions to get and " +"set the current runtime configuration." +msgstr "" + +#: whatsnew/3.14.rst:2814 +msgid "" +":pep:`587` 'Python Initialization Configuration' unified all the ways to " +"configure Python's initialization. This PEP also unifies the configuration " +"of Python's preinitialization and initialization in a single API. Moreover, " +"this PEP only provides a single choice to embed Python, instead of having " +"two 'Python' and 'Isolated' choices (PEP 587), to further simplify the API." +msgstr "" + +#: whatsnew/3.14.rst:2821 +msgid "" +"The lower level PEP 587 PyConfig API remains available for use cases with an " +"intentionally higher level of coupling to CPython implementation details " +"(such as emulating the full functionality of CPython's CLI, including its " +"configuration mechanisms)." +msgstr "" + +#: whatsnew/3.14.rst:2853 whatsnew/3.14.rst:2873 +msgid "(Contributed by Victor Stinner in :gh:`107954`.)" +msgstr "" + +#: whatsnew/3.14.rst:2828 +msgid ":pep:`741` and :pep:`587`" +msgstr "" + +#: whatsnew/3.14.rst:2832 +msgid "New features in the C API" +msgstr "" + +#: whatsnew/3.14.rst:2834 +msgid "" +"Add :c:func:`Py_PACK_VERSION` and :c:func:`Py_PACK_FULL_VERSION`, two new " +"macros for bit-packing Python version numbers. This is useful for " +"comparisons with :c:var:`Py_Version` or :c:macro:`PY_VERSION_HEX`. " +"(Contributed by Petr Viktorin in :gh:`128629`.)" +msgstr "" + +#: whatsnew/3.14.rst:2840 +msgid "" +"Add :c:func:`PyBytes_Join(sep, iterable) ` function, similar " +"to ``sep.join(iterable)`` in Python. (Contributed by Victor Stinner in :gh:" +"`121645`.)" +msgstr "" + +#: whatsnew/3.14.rst:2844 +msgid "" +"Add functions to manipulate the configuration of the current runtime Python " +"interpreter (:ref:`PEP 741: Python configuration C API `):" +msgstr "" + +#: whatsnew/3.14.rst:2848 +msgid ":c:func:`PyConfig_Get`" +msgstr "" + +#: whatsnew/3.14.rst:2849 +msgid ":c:func:`PyConfig_GetInt`" +msgstr "" + +#: whatsnew/3.14.rst:2850 +msgid ":c:func:`PyConfig_Set`" +msgstr "" + +#: whatsnew/3.14.rst:2851 +msgid ":c:func:`PyConfig_Names`" +msgstr "" + +#: whatsnew/3.14.rst:2855 +msgid "" +"Add functions to configure Python initialization (:ref:`PEP 741: Python " +"configuration C API `):" +msgstr "" + +#: whatsnew/3.14.rst:2858 +msgid ":c:func:`Py_InitializeFromInitConfig`" +msgstr "" + +#: whatsnew/3.14.rst:2859 +msgid ":c:func:`PyInitConfig_AddModule`" +msgstr "" + +#: whatsnew/3.14.rst:2860 +msgid ":c:func:`PyInitConfig_Create`" +msgstr "" + +#: whatsnew/3.14.rst:2861 +msgid ":c:func:`PyInitConfig_Free`" +msgstr "" + +#: whatsnew/3.14.rst:2862 +msgid ":c:func:`PyInitConfig_FreeStrList`" +msgstr "" + +#: whatsnew/3.14.rst:2863 +msgid ":c:func:`PyInitConfig_GetError`" +msgstr "" + +#: whatsnew/3.14.rst:2864 +msgid ":c:func:`PyInitConfig_GetExitCode`" +msgstr "" + +#: whatsnew/3.14.rst:2865 +msgid ":c:func:`PyInitConfig_GetInt`" +msgstr "" + +#: whatsnew/3.14.rst:2866 +msgid ":c:func:`PyInitConfig_GetStr`" +msgstr "" + +#: whatsnew/3.14.rst:2867 +msgid ":c:func:`PyInitConfig_GetStrList`" +msgstr "" + +#: whatsnew/3.14.rst:2868 +msgid ":c:func:`PyInitConfig_HasOption`" +msgstr "" + +#: whatsnew/3.14.rst:2869 +msgid ":c:func:`PyInitConfig_SetInt`" +msgstr "" + +#: whatsnew/3.14.rst:2870 +msgid ":c:func:`PyInitConfig_SetStr`" +msgstr "" + +#: whatsnew/3.14.rst:2871 +msgid ":c:func:`PyInitConfig_SetStrList`" +msgstr "" + +#: whatsnew/3.14.rst:2875 +msgid "" +"Add :c:func:`Py_fopen` function to open a file. This works similarly to the " +"standard C :c:func:`!fopen` function, instead accepting a Python object for " +"the *path* parameter and setting an exception on error. The corresponding " +"new :c:func:`Py_fclose` function should be used to close a file. " +"(Contributed by Victor Stinner in :gh:`127350`.)" +msgstr "" + +#: whatsnew/3.14.rst:2883 +msgid "" +"Add :c:func:`Py_HashBuffer` to compute and return the hash value of a " +"buffer. (Contributed by Antoine Pitrou and Victor Stinner in :gh:`122854`.)" +msgstr "" + +#: whatsnew/3.14.rst:2886 +msgid "" +"Add :c:func:`PyImport_ImportModuleAttr` and :c:func:" +"`PyImport_ImportModuleAttrString` helper functions to import a module and " +"get an attribute of the module. (Contributed by Victor Stinner in :gh:" +"`128911`.)" +msgstr "" + +#: whatsnew/3.14.rst:2891 +msgid "" +"Add :c:func:`PyIter_NextItem` to replace :c:func:`PyIter_Next`, which has an " +"ambiguous return value. (Contributed by Irit Katriel and Erlend Aasland in :" +"gh:`105201`.)" +msgstr "" + +#: whatsnew/3.14.rst:2895 +msgid "" +"Add :c:func:`PyLong_GetSign` function to get the sign of :class:`int` " +"objects. (Contributed by Sergey B Kirpichev in :gh:`116560`.)" +msgstr "" + +#: whatsnew/3.14.rst:2898 +msgid "" +"Add :c:func:`PyLong_IsPositive`, :c:func:`PyLong_IsNegative` and :c:func:" +"`PyLong_IsZero` for checking if :c:type:`PyLongObject` is positive, " +"negative, or zero, respectively. (Contributed by James Roy and Sergey B " +"Kirpichev in :gh:`126061`.)" +msgstr "" + +#: whatsnew/3.14.rst:2903 +msgid "" +"Add new functions to convert C ```` numbers to/from Python :class:" +"`int` objects:" +msgstr "" + +#: whatsnew/3.14.rst:2906 +msgid ":c:func:`PyLong_AsInt32`" +msgstr "" + +#: whatsnew/3.14.rst:2907 +msgid ":c:func:`PyLong_AsInt64`" +msgstr "" + +#: whatsnew/3.14.rst:2908 +msgid ":c:func:`PyLong_AsUInt32`" +msgstr "" + +#: whatsnew/3.14.rst:2909 +msgid ":c:func:`PyLong_AsUInt64`" +msgstr "" + +#: whatsnew/3.14.rst:2910 +msgid ":c:func:`PyLong_FromInt32`" +msgstr "" + +#: whatsnew/3.14.rst:2911 +msgid ":c:func:`PyLong_FromInt64`" +msgstr "" + +#: whatsnew/3.14.rst:2912 +msgid ":c:func:`PyLong_FromUInt32`" +msgstr "" + +#: whatsnew/3.14.rst:2913 +msgid ":c:func:`PyLong_FromUInt64`" +msgstr "" + +#: whatsnew/3.14.rst:2915 +msgid "(Contributed by Victor Stinner in :gh:`120389`.)" +msgstr "" + +#: whatsnew/3.14.rst:2917 +msgid "" +"Add a new import and export API for Python :class:`int` objects (:pep:`757`):" +msgstr "" + +#: whatsnew/3.14.rst:2920 +msgid ":c:func:`PyLong_GetNativeLayout`" +msgstr "" + +#: whatsnew/3.14.rst:2921 +msgid ":c:func:`PyLong_Export`" +msgstr "" + +#: whatsnew/3.14.rst:2922 +msgid ":c:func:`PyLong_FreeExport`" +msgstr "" + +#: whatsnew/3.14.rst:2923 +msgid ":c:func:`PyLongWriter_Create`" +msgstr "" + +#: whatsnew/3.14.rst:2924 +msgid ":c:func:`PyLongWriter_Finish`" +msgstr "" + +#: whatsnew/3.14.rst:2925 +msgid ":c:func:`PyLongWriter_Discard`" +msgstr "" + +#: whatsnew/3.14.rst:2927 +msgid "(Contributed by Sergey B Kirpichev and Victor Stinner in :gh:`102471`.)" +msgstr "" + +#: whatsnew/3.14.rst:2929 +msgid "" +"Add :c:func:`PyMonitoring_FireBranchLeftEvent` and :c:func:" +"`PyMonitoring_FireBranchRightEvent` for generating :monitoring-event:" +"`BRANCH_LEFT` and :monitoring-event:`BRANCH_RIGHT` events, respectively. " +"(Contributed by Mark Shannon in :gh:`122548`.)" +msgstr "" + +#: whatsnew/3.14.rst:2935 +msgid "" +"Add :c:func:`PyType_Freeze` function to make a type immutable. (Contributed " +"by Victor Stinner in :gh:`121654`.)" +msgstr "" + +#: whatsnew/3.14.rst:2938 +msgid "" +"Add :c:func:`PyType_GetBaseByToken` and :c:data:`Py_tp_token` slot for " +"easier superclass identification, which attempts to resolve the type " +"checking issue mentioned in :pep:`PEP 630 <630#type-checking>`. (Contributed " +"in :gh:`124153`.)" +msgstr "" + +#: whatsnew/3.14.rst:2943 +msgid "" +"Add a new :c:func:`PyUnicode_Equal` function to test if two strings are " +"equal. The function is also added to the Limited C API. (Contributed by " +"Victor Stinner in :gh:`124502`.)" +msgstr "" + +#: whatsnew/3.14.rst:2948 +msgid "" +"Add a new :c:type:`PyUnicodeWriter` API to create a Python :class:`str` " +"object, with the following functions:" +msgstr "" + +#: whatsnew/3.14.rst:2951 +msgid ":c:func:`PyUnicodeWriter_Create`" +msgstr "" + +#: whatsnew/3.14.rst:2952 +msgid ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful`" +msgstr "" + +#: whatsnew/3.14.rst:2953 +msgid ":c:func:`PyUnicodeWriter_Discard`" +msgstr "" + +#: whatsnew/3.14.rst:2954 +msgid ":c:func:`PyUnicodeWriter_Finish`" +msgstr "" + +#: whatsnew/3.14.rst:2955 +msgid ":c:func:`PyUnicodeWriter_Format`" +msgstr "" + +#: whatsnew/3.14.rst:2956 +msgid ":c:func:`PyUnicodeWriter_WriteASCII`" +msgstr "" + +#: whatsnew/3.14.rst:2957 +msgid ":c:func:`PyUnicodeWriter_WriteChar`" +msgstr "" + +#: whatsnew/3.14.rst:2958 +msgid ":c:func:`PyUnicodeWriter_WriteRepr`" +msgstr "" + +#: whatsnew/3.14.rst:2959 +msgid ":c:func:`PyUnicodeWriter_WriteStr`" +msgstr "" + +#: whatsnew/3.14.rst:2960 +msgid ":c:func:`PyUnicodeWriter_WriteSubstring`" +msgstr "" + +#: whatsnew/3.14.rst:2961 +msgid ":c:func:`PyUnicodeWriter_WriteUCS4`" +msgstr "" + +#: whatsnew/3.14.rst:2962 +msgid ":c:func:`PyUnicodeWriter_WriteUTF8`" +msgstr "" + +#: whatsnew/3.14.rst:2963 +msgid ":c:func:`PyUnicodeWriter_WriteWideChar`" +msgstr "" + +#: whatsnew/3.14.rst:2965 +msgid "(Contributed by Victor Stinner in :gh:`119182`.)" +msgstr "" + +#: whatsnew/3.14.rst:2967 +msgid "" +"The ``k`` and ``K`` formats in :c:func:`PyArg_ParseTuple` and similar " +"functions now use :meth:`~object.__index__` if available, like all other " +"integer formats. (Contributed by Serhiy Storchaka in :gh:`112068`.)" +msgstr "" + +#: whatsnew/3.14.rst:2972 +msgid "" +"Add support for a new ``p`` format unit in :c:func:`Py_BuildValue` that " +"produces a Python :class:`bool` object from a C integer. (Contributed by " +"Pablo Galindo in :issue:`45325`.)" +msgstr "" + +#: whatsnew/3.14.rst:2976 +msgid "" +"Add :c:func:`PyUnstable_IsImmortal` for determining if an object is :term:" +"`immortal`, for debugging purposes. (Contributed by Peter Bierma in :gh:" +"`128509`.)" +msgstr "" + +#: whatsnew/3.14.rst:2980 +msgid "" +"Add :c:func:`PyUnstable_Object_EnableDeferredRefcount` for enabling deferred " +"reference counting, as outlined in :pep:`703`." +msgstr "" + +#: whatsnew/3.14.rst:2983 +msgid "" +"Add :c:func:`PyUnstable_Object_IsUniquelyReferenced` as a replacement for " +"``Py_REFCNT(op) == 1`` on :term:`free threaded ` builds. " +"(Contributed by Peter Bierma in :gh:`133140`.)" +msgstr "" + +#: whatsnew/3.14.rst:2988 +msgid "" +"Add :c:func:`PyUnstable_Object_IsUniqueReferencedTemporary` to determine if " +"an object is a unique temporary object on the interpreter's operand stack. " +"This can be used in some cases as a replacement for checking if :c:func:" +"`Py_REFCNT` is ``1`` for Python objects passed as arguments to C API " +"functions. (Contributed by Sam Gross in :gh:`133164`.)" +msgstr "" + +#: whatsnew/3.14.rst:2998 +msgid "Limited C API changes" +msgstr "" + +#: whatsnew/3.14.rst:3000 +msgid "" +"In the limited C API version 3.14 and newer, :c:func:`Py_TYPE` and :c:func:" +"`Py_REFCNT` are now implemented as an opaque function call to hide " +"implementation details. (Contributed by Victor Stinner in :gh:`120600` and :" +"gh:`124127`.)" +msgstr "" + +#: whatsnew/3.14.rst:3005 +msgid "" +"Remove the :c:macro:`PySequence_Fast_GET_SIZE`, :c:macro:" +"`PySequence_Fast_GET_ITEM`, and :c:macro:`PySequence_Fast_ITEMS` macros from " +"the limited C API, since they have always been broken in the limited C API. " +"(Contributed by Victor Stinner in :gh:`91417`.)" +msgstr "" + +#: whatsnew/3.14.rst:3016 +msgid "Removed C APIs" +msgstr "" + +#: whatsnew/3.14.rst:3018 +msgid "" +"Creating :c:data:`immutable types ` with mutable " +"bases was deprecated in Python 3.12, and now raises a :exc:`TypeError`. " +"(Contributed by Nikita Sobolev in :gh:`119775`.)" +msgstr "" + +#: whatsnew/3.14.rst:3023 +msgid "" +"Remove ``PyDictObject.ma_version_tag`` member, which was deprecated in " +"Python 3.12. Use the :c:func:`PyDict_AddWatcher` API instead. (Contributed " +"by Sam Gross in :gh:`124296`.)" +msgstr "" + +#: whatsnew/3.14.rst:3028 +msgid "" +"Remove the private ``_Py_InitializeMain()`` function. It was a :term:" +"`provisional API` added to Python 3.8 by :pep:`587`. (Contributed by Victor " +"Stinner in :gh:`129033`.)" +msgstr "" + +#: whatsnew/3.14.rst:3032 +msgid "" +"Remove the undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and :c:member:" +"`!PyThreadState.c_recursion_remaining`. These were added in 3.13 and have " +"been removed without deprecation. Use :c:func:`Py_EnterRecursiveCall` to " +"guard against runaway recursion in C code. (Removed by Petr Viktorin in :gh:" +"`133079`, see also :gh:`130396`.)" +msgstr "" + +#: whatsnew/3.14.rst:3043 +msgid "Deprecated C APIs" +msgstr "" + +#: whatsnew/3.14.rst:3045 +msgid "" +"The :c:macro:`!Py_HUGE_VAL` macro is now :term:`soft deprecated`. Use :c:" +"macro:`!Py_INFINITY` instead. (Contributed by Sergey B Kirpichev in :gh:" +"`120026`.)" +msgstr "" + +#: whatsnew/3.14.rst:3049 +msgid "" +"The :c:macro:`!Py_IS_NAN`, :c:macro:`!Py_IS_INFINITY`, and :c:macro:`!" +"Py_IS_FINITE` macros are now :term:`soft deprecated`. Use :c:macro:`!" +"isnan`, :c:macro:`!isinf` and :c:macro:`!isfinite` instead, available from :" +"file:`math.h` since C99. (Contributed by Sergey B Kirpichev in :gh:`119613`.)" +msgstr "" + +#: whatsnew/3.14.rst:3055 +msgid "" +"Non-tuple sequences are now deprecated as argument for the ``(items)`` " +"format unit in :c:func:`PyArg_ParseTuple` and other :ref:`argument parsing " +"` functions if *items* contains format units which store a :ref:" +"`borrowed buffer ` or a :term:`borrowed reference`. " +"(Contributed by Serhiy Storchaka in :gh:`50333`.)" +msgstr "" + +#: whatsnew/3.14.rst:3062 +msgid "" +"The ``_PyMonitoring_FireBranchEvent`` function is now deprecated and should " +"be replaced with calls to :c:func:`PyMonitoring_FireBranchLeftEvent` and :c:" +"func:`PyMonitoring_FireBranchRightEvent`." +msgstr "" + +#: whatsnew/3.14.rst:3067 +msgid "" +"The previously undocumented function :c:func:`PySequence_In` is now :term:" +"`soft deprecated`. Use :c:func:`PySequence_Contains` instead. (Contributed " +"by Yuki Kobayashi in :gh:`127896`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:6 +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead. The `pythoncapi-compat project `__ can be used to get :c:func:" +"`PyWeakref_GetRef` on Python 3.12 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:10 +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`str`, such as :class:`bytes`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead; " +"Note that some codecs (for example, \"base64\") may return a type other " +"than :class:`bytes`, such as :class:`str`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:22 +msgid "Python initialization functions, deprecated in Python 3.13:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:24 +msgid "" +":c:func:`Py_GetPath`: Use :c:func:`PyConfig_Get(\"module_search_paths\") " +"` (:data:`sys.path`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:27 +msgid "" +":c:func:`Py_GetPrefix`: Use :c:func:`PyConfig_Get(\"base_prefix\") " +"` (:data:`sys.base_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"prefix\") ` (:data:`sys.prefix`) if :ref:" +"`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:32 +msgid "" +":c:func:`Py_GetExecPrefix`: Use :c:func:`PyConfig_Get(\"base_exec_prefix\") " +"` (:data:`sys.base_exec_prefix`) instead. Use :c:func:" +"`PyConfig_Get(\"exec_prefix\") ` (:data:`sys.exec_prefix`) if :" +"ref:`virtual environments ` need to be handled." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:38 +msgid "" +":c:func:`Py_GetProgramFullPath`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:41 +msgid "" +":c:func:`Py_GetProgramName`: Use :c:func:`PyConfig_Get(\"executable\") " +"` (:data:`sys.executable`) instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:44 +msgid "" +":c:func:`Py_GetPythonHome`: Use :c:func:`PyConfig_Get(\"home\") " +"` or the :envvar:`PYTHONHOME` environment variable instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:48 +msgid "" +"The `pythoncapi-compat project `__ can be used to get :c:func:`PyConfig_Get` on Python 3.13 and older." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:52 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:54 +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:56 +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:58 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:60 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:62 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:65 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:68 +msgid "Global configuration variables:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:70 +msgid "" +":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` or :c:func:" +"`PyConfig_Get(\"parser_debug\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:73 +msgid "" +":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` or :c:func:" +"`PyConfig_Get(\"verbose\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:76 +msgid "" +":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` or :c:func:" +"`PyConfig_Get(\"quiet\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:79 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` or :c:func:" +"`PyConfig_Get(\"interactive\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:82 +msgid "" +":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` or :c:func:" +"`PyConfig_Get(\"inspect\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:85 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` or :c:" +"func:`PyConfig_Get(\"optimization_level\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:88 +msgid "" +":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` or :c:func:" +"`PyConfig_Get(\"site_import\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:91 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` or :c:" +"func:`PyConfig_Get(\"bytes_warning\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:94 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` or :c:" +"func:`PyConfig_Get(\"pathconfig_warnings\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:97 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"or :c:func:`PyConfig_Get(\"use_environment\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:100 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"or :c:func:`PyConfig_Get(\"write_bytecode\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:103 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` or :c:func:`PyConfig_Get(\"user_site_directory\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:106 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` or :" +"c:func:`PyConfig_Get(\"buffered_stdio\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:109 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` or :c:func:`PyConfig_Get(\"hash_seed\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:113 +msgid "" +":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` or :c:func:" +"`PyConfig_Get(\"isolated\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:116 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` or :c:func:" +"`PyConfig_Get(\"legacy_windows_fs_encoding\") ` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:119 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` or :c:func:`PyConfig_Get(\"legacy_windows_stdio\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:122 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!" +"Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` or :c:func:`PyConfig_Get(\"filesystem_encoding\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:125 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` or :c:func:`PyConfig_Get(\"filesystem_errors\") " +"` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:128 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` or :c:func:" +"`PyConfig_Get(\"utf8_mode\") ` instead. (see :c:func:" +"`Py_PreInitialize`)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.15.rst:133 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` to set these options. Or :c:func:`PyConfig_Get` can be used to " +"get these options at runtime." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.16.rst:4 +msgid "The bundled copy of ``libmpdec``." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:2 +msgid "Pending removal in Python 3.18" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:4 +msgid "" +"The following private functions are deprecated and planned for removal in " +"Python 3.18:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:7 +msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:8 +msgid "" +":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" +"`PyDict_GetItemStringRef`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:9 +msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:10 +msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:11 +msgid "" +":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" +"`PyLongWriter_Create`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:13 +msgid "" +":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" +"`PyThreadState_GetUnchecked`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:14 +msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:15 +msgid "" +":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " +"with :c:func:`writer = PyUnicodeWriter_Create(0) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:18 +msgid "" +":c:func:`!_PyUnicodeWriter_Finish`: replace " +"``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" +"`PyUnicodeWriter_Finish(writer) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:21 +msgid "" +":c:func:`!_PyUnicodeWriter_Dealloc`: replace " +"``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" +"`PyUnicodeWriter_Discard(writer) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:24 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteChar`: replace " +"``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" +"`PyUnicodeWriter_WriteChar(writer, ch) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:27 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteStr`: replace " +"``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteStr(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:30 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:33 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteASCIIString`: replace " +"``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteASCII(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:36 +msgid "" +":c:func:`!_PyUnicodeWriter_WriteLatin1String`: replace " +"``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with :c:func:" +"`PyUnicodeWriter_WriteUTF8(writer, str) `." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:39 +msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:40 +msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:41 +msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:42 +msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." +msgstr "" + +#: deprecations/c-api-pending-removal-in-3.18.rst:44 +msgid "" +"The `pythoncapi-compat project `__ can be used to get these new public functions on Python 3.13 and older. " +"(Contributed by Victor Stinner in :gh:`128863`.)" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:7 +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:19 +msgid "" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:21 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:23 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:25 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:29 +msgid "Thread Local Storage (TLS) API:" +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:31 +msgid "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:33 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:37 +msgid "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:39 +msgid "" +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " +"instead." +msgstr "" + +#: deprecations/c-api-pending-removal-in-future.rst:41 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." +msgstr "" + +#: whatsnew/3.14.rst:3086 +msgid "Build changes" +msgstr "" + +#: whatsnew/3.14.rst:3088 +msgid "" +":pep:`776`: Emscripten is now an officially supported platform at :pep:`tier " +"3 <11#tier-3>`. As a part of this effort, more than 25 bugs in `Emscripten " +"libc`__ were fixed. Emscripten now includes support for :mod:`ctypes`, :mod:" +"`termios`, and :mod:`fcntl`, as well as experimental support for the new :" +"ref:`default interactive shell `. (Contributed by R. Hood " +"Chatham in :gh:`127146`, :gh:`127683`, and :gh:`136931`.)" +msgstr "" + +#: whatsnew/3.14.rst:3098 +msgid "Official Android binary releases are now provided on python.org__." +msgstr "" + +#: whatsnew/3.14.rst:3102 +msgid "" +"GNU Autoconf 2.72 is now required to generate :file:`configure`. " +"(Contributed by Erlend Aasland in :gh:`115765`.)" +msgstr "" + +#: whatsnew/3.14.rst:3105 +msgid "" +"``wasm32-unknown-emscripten`` is now a :pep:`11` tier 3 platform. " +"(Contributed by R. Hood Chatham in :gh:`127146`, :gh:`127683`, and :gh:" +"`136931`.)" +msgstr "" + +#: whatsnew/3.14.rst:3108 +msgid "" +"``#pragma``-based linking with ``python3*.lib`` can now be switched off " +"with :c:expr:`Py_NO_LINK_LIB`. (Contributed by Jean-Christophe Fillion-Robin " +"in :gh:`82909`.)" +msgstr "" + +#: whatsnew/3.14.rst:3112 +msgid "" +"CPython now enables a set of recommended compiler options by default for " +"improved security. Use the :option:`--disable-safety` :file:`configure` " +"option to disable them, or the :option:`--enable-slower-safety` option for a " +"larger set of compiler options, albeit with a performance cost." +msgstr "" + +#: whatsnew/3.14.rst:3118 +msgid "" +"The ``WITH_FREELISTS`` macro and ``--without-freelists`` :file:`configure` " +"option have been removed." +msgstr "" + +#: whatsnew/3.14.rst:3121 +msgid "" +"The new :file:`configure` option :option:`--with-tail-call-interp` may be " +"used to enable the experimental tail call interpreter. See :ref:`whatsnew314-" +"tail-call-interpreter` for further details." +msgstr "" + +#: whatsnew/3.14.rst:3125 +msgid "" +"To disable the new remote debugging support, use the :option:`--without-" +"remote-debug` :file:`configure` option. This may be useful for security " +"reasons." +msgstr "" + +#: whatsnew/3.14.rst:3129 +msgid "" +"iOS and macOS apps can now be configured to redirect ``stdout`` and " +"``stderr`` content to the system log. (Contributed by Russell Keith-Magee " +"in :gh:`127592`.)" +msgstr "" + +#: whatsnew/3.14.rst:3133 +msgid "" +"The iOS testbed is now able to stream test output while the test is running. " +"The testbed can also be used to run the test suite of projects other than " +"CPython itself. (Contributed by Russell Keith-Magee in :gh:`127592`.)" +msgstr "" + +#: whatsnew/3.14.rst:3142 +msgid ":file:`build-details.json`" +msgstr "" + +#: whatsnew/3.14.rst:3144 +msgid "" +"Installations of Python now contain a new file, :file:`build-details.json`. " +"This is a static JSON document containing build details for CPython, to " +"allow for introspection without needing to run code. This is helpful for use-" +"cases such as Python launchers, cross-compilation, and so on." +msgstr "" + +#: whatsnew/3.14.rst:3150 +msgid "" +":file:`build-details.json` must be installed in the platform-independent " +"standard library directory. This corresponds to the :ref:`'stdlib' " +"` :mod:`sysconfig` installation path, which can be found " +"by running ``sysconfig.get_path('stdlib')``." +msgstr "" + +#: whatsnew/3.14.rst:3156 +msgid "" +":pep:`739` -- ``build-details.json`` 1.0 -- a static description file for " +"Python build details" +msgstr "" + +#: whatsnew/3.14.rst:3163 +msgid "Discontinuation of PGP signatures" +msgstr "" + +#: whatsnew/3.14.rst:3165 +msgid "" +"PGP (Pretty Good Privacy) signatures will not be provided for releases of " +"Python 3.14 or future versions. To verify CPython artifacts, users must use " +"`Sigstore verification materials `__. Releases have been signed using Sigstore_ since Python 3.11." +msgstr "" + +#: whatsnew/3.14.rst:3171 +msgid "This change in release process was specified in :pep:`761`." +msgstr "" + +#: whatsnew/3.14.rst:3179 +msgid "Free-threaded Python is officially supported" +msgstr "" + +#: whatsnew/3.14.rst:3181 +msgid "" +"The free-threaded build of Python is now supported and no longer " +"experimental. This is the start of `phase II `__ where free-threaded Python is officially supported but still " +"optional." +msgstr "" + +#: whatsnew/3.14.rst:3185 +msgid "" +"The free-threading team are confident that the project is on the right path, " +"and appreciate the continued dedication from everyone working to make free-" +"threading ready for broader adoption across the Python community." +msgstr "" + +#: whatsnew/3.14.rst:3189 +msgid "" +"With these recommendations and the acceptance of this PEP, the Python " +"developer community should broadly advertise that free-threading is a " +"supported Python build option now and into the future, and that it will not " +"be removed without a proper deprecation schedule." +msgstr "" + +#: whatsnew/3.14.rst:3194 +msgid "" +"Any decision to transition to `phase III `__, with free-threading as the default or sole build of Python is " +"still undecided, and dependent on many factors both within CPython itself " +"and the community. This decision is for the future." +msgstr "" + +#: whatsnew/3.14.rst:3201 +msgid ":pep:`779`" +msgstr "" + +#: whatsnew/3.14.rst:3203 +msgid "`PEP 779's acceptance `__" +msgstr "" + +#: whatsnew/3.14.rst:3209 +msgid "Binary releases for the experimental just-in-time compiler" +msgstr "" + +#: whatsnew/3.14.rst:3211 +msgid "" +"The official macOS and Windows release binaries now include an " +"*experimental* just-in-time (JIT) compiler. Although it is **not** " +"recommended for production use, it can be tested by setting :envvar:" +"`PYTHON_JIT=1 ` as an environment variable. Downstream source " +"builds and redistributors can use the :option:`--enable-experimental-jit=yes-" +"off` configuration option for similar behavior." +msgstr "" + +#: whatsnew/3.14.rst:3218 +msgid "" +"The JIT is at an early stage and still in active development. As such, the " +"typical performance impact of enabling it can range from 10% slower to 20% " +"faster, depending on workload. To aid in testing and evaluation, a set of " +"introspection functions has been provided in the :data:`sys._jit` " +"namespace. :func:`sys._jit.is_available` can be used to determine if the " +"current executable supports JIT compilation, while :func:`sys._jit." +"is_enabled` can be used to tell if JIT compilation has been enabled for the " +"current process." +msgstr "" + +#: whatsnew/3.14.rst:3226 +msgid "" +"Currently, the most significant missing functionality is that native " +"debuggers and profilers like ``gdb`` and ``perf`` are unable to unwind " +"through JIT frames (Python debuggers and profilers, like :mod:`pdb` or :mod:" +"`profile`, continue to work without modification). Free-threaded builds do " +"not support JIT compilation." +msgstr "" + +#: whatsnew/3.14.rst:3231 +msgid "" +"Please report any bugs or major performance regressions that you encounter!" +msgstr "" + +#: whatsnew/3.14.rst:3233 +msgid ":pep:`744`" +msgstr "" + +#: whatsnew/3.14.rst:3237 +msgid "Porting to Python 3.14" +msgstr "" + +#: whatsnew/3.14.rst:3239 +msgid "" +"This section lists previously described changes and other bugfixes that may " +"require changes to your code." +msgstr "" + +#: whatsnew/3.14.rst:3244 +msgid "Changes in the Python API" +msgstr "" + +#: whatsnew/3.14.rst:3246 +msgid "" +"On Unix platforms other than macOS, *forkserver* is now the default :ref:" +"`start method ` for :mod:`multiprocessing` " +"and :class:`~concurrent.futures.ProcessPoolExecutor`, instead of *fork*." +msgstr "" + +#: whatsnew/3.14.rst:3250 +msgid "" +"See :ref:`(1) ` and :ref:`(2) " +"` for details." +msgstr "" + +#: whatsnew/3.14.rst:3253 +msgid "" +"If you encounter :exc:`NameError`\\s or pickling errors coming out of :mod:" +"`multiprocessing` or :mod:`concurrent.futures`, see the :ref:`forkserver " +"restrictions `." +msgstr "" + +#: whatsnew/3.14.rst:3257 +msgid "" +"This change does not affect Windows or macOS, where :ref:`'spawn' " +"` remains the default start method." +msgstr "" + +#: whatsnew/3.14.rst:3260 +msgid "" +":class:`functools.partial` is now a method descriptor. Wrap it in :func:" +"`staticmethod` if you want to preserve the old behavior. (Contributed by " +"Serhiy Storchaka and Dominykas Grigonis in :gh:`121027`.)" +msgstr "" + +#: whatsnew/3.14.rst:3264 +msgid "" +"The :ref:`garbage collector is now incremental `, which means that the behavior of :func:`gc.collect` changes slightly:" +msgstr "" + +#: whatsnew/3.14.rst:3271 +msgid "" +"The :func:`locale.nl_langinfo` function now temporarily sets the " +"``LC_CTYPE`` locale in some cases. This temporary change affects other " +"threads. (Contributed by Serhiy Storchaka in :gh:`69998`.)" +msgstr "" + +#: whatsnew/3.14.rst:3276 +msgid "" +":class:`types.UnionType` is now an alias for :class:`typing.Union`, causing " +"changes in some behaviors. See :ref:`above ` for " +"more details. (Contributed by Jelle Zijlstra in :gh:`105499`.)" +msgstr "" + +#: whatsnew/3.14.rst:3281 +msgid "" +"The runtime behavior of annotations has changed in various ways; see :ref:" +"`above ` for details. While most code that " +"interacts with annotations should continue to work, some undocumented " +"details may behave differently." +msgstr "" + +#: whatsnew/3.14.rst:3286 +msgid "" +"As part of making the :mod:`mimetypes` CLI public, it now exits with ``1`` " +"on failure instead of ``0`` and ``2`` on incorrect command-line parameters " +"instead of ``1``. Error messages are now printed to stderr." +msgstr "" + +#: whatsnew/3.14.rst:3291 +msgid "" +"The ``\\B`` pattern in regular expression now matches the empty string when " +"given as the entire pattern, which may cause behavioural changes." +msgstr "" + +#: whatsnew/3.14.rst:3294 +msgid "" +"On FreeBSD, :data:`sys.platform` no longer contains the major version number." +msgstr "" + +#: whatsnew/3.14.rst:3300 +msgid "Changes in annotations (:pep:`649` and :pep:`749`)" +msgstr "" + +#: whatsnew/3.14.rst:3302 +msgid "" +"This section contains guidance on changes that may be needed to annotations " +"or Python code that interacts with or introspects annotations, due to the " +"changes related to :ref:`deferred evaluation of annotations `." +msgstr "" + +#: whatsnew/3.14.rst:3307 +msgid "" +"In the majority of cases, working code from older versions of Python will " +"not require any changes." +msgstr "" + +#: whatsnew/3.14.rst:3312 +msgid "Implications for annotated code" +msgstr "" + +#: whatsnew/3.14.rst:3314 +msgid "" +"If you define annotations in your code (for example, for use with a static " +"type checker), then this change probably does not affect you: you can keep " +"writing annotations the same way you did with previous versions of Python." +msgstr "" + +#: whatsnew/3.14.rst:3318 +msgid "" +"You will likely be able to remove quoted strings in annotations, which are " +"frequently used for forward references. Similarly, if you use ``from " +"__future__ import annotations`` to avoid having to write strings in " +"annotations, you may well be able to remove that import once you support " +"only Python 3.14 and newer. However, if you rely on third-party libraries " +"that read annotations, those libraries may need changes to support unquoted " +"annotations before they work as expected." +msgstr "" + +#: whatsnew/3.14.rst:3328 +msgid "Implications for readers of ``__annotations__``" +msgstr "" + +#: whatsnew/3.14.rst:3330 +msgid "" +"If your code reads the :attr:`~object.__annotations__` attribute on objects, " +"you may want to make changes in order to support code that relies on " +"deferred evaluation of annotations. For example, you may want to use :func:" +"`annotationlib.get_annotations` with the :attr:`~annotationlib.Format." +"FORWARDREF` format, as the :mod:`dataclasses` module now does." +msgstr "" + +#: whatsnew/3.14.rst:3337 +msgid "" +"The external :pypi:`typing_extensions` package provides partial backports of " +"some of the functionality of the :mod:`annotationlib` module, such as the :" +"class:`~annotationlib.Format` enum and the :func:`~annotationlib." +"get_annotations` function. These can be used to write cross-version code " +"that takes advantage of the new behavior in Python 3.14." +msgstr "" + +#: whatsnew/3.14.rst:3346 +msgid "Related changes" +msgstr "" + +#: whatsnew/3.14.rst:3348 +msgid "" +"The changes in Python 3.14 are designed to rework how :attr:`!" +"__annotations__` works at runtime while minimizing breakage to code that " +"contains annotations in source code and to code that reads :attr:`!" +"__annotations__`. However, if you rely on undocumented details of the " +"annotation behavior or on private functions in the standard library, there " +"are many ways in which your code may not work in Python 3.14. To safeguard " +"your code against future changes, only use the documented functionality of " +"the :mod:`annotationlib` module." +msgstr "" + +#: whatsnew/3.14.rst:3357 +msgid "" +"In particular, do not read annotations directly from the namespace " +"dictionary attribute of type objects. Use :func:`annotationlib." +"get_annotate_from_class_namespace` during class construction and :func:" +"`annotationlib.get_annotations` afterwards." +msgstr "" + +#: whatsnew/3.14.rst:3362 +msgid "" +"In previous releases, it was sometimes possible to access class annotations " +"from an instance of an annotated class. This behavior was undocumented and " +"accidental, and will no longer work in Python 3.14." +msgstr "" + +#: whatsnew/3.14.rst:3368 +msgid "``from __future__ import annotations``" +msgstr "" + +#: whatsnew/3.14.rst:3370 +msgid "" +"In Python 3.7, :pep:`563` introduced the ``from __future__ import " +"annotations`` :ref:`future statement `, which turns all annotations " +"into strings." +msgstr "" + +#: whatsnew/3.14.rst:3373 +msgid "" +"However, this statement is now deprecated and it is expected to be removed " +"in a future version of Python. This removal will not happen until after " +"Python 3.13 reaches its end of life in 2029, being the last version of " +"Python without support for deferred evaluation of annotations." +msgstr "" + +#: whatsnew/3.14.rst:3379 +msgid "" +"In Python 3.14, the behavior of code using ``from __future__ import " +"annotations`` is unchanged." +msgstr "" + +#: whatsnew/3.14.rst:3384 +msgid "Changes in the C API" +msgstr "" + +#: whatsnew/3.14.rst:3386 +msgid "" +":c:func:`Py_Finalize` now deletes all interned strings. This is backwards " +"incompatible to any C extension that holds onto an interned string after a " +"call to :c:func:`Py_Finalize` and is then reused after a call to :c:func:" +"`Py_Initialize`. Any issues arising from this behavior will normally result " +"in crashes during the execution of the subsequent call to :c:func:" +"`Py_Initialize` from accessing uninitialized memory. To fix, use an address " +"sanitizer to identify any use-after-free coming from an interned string and " +"deallocate it during module shutdown. (Contributed by Eddie Elizondo in :gh:" +"`113601`.)" +msgstr "" + +#: whatsnew/3.14.rst:3396 +msgid "" +"The :ref:`Unicode Exception Objects ` C API now raises a :" +"exc:`TypeError` if its exception argument is not a :exc:`UnicodeError` " +"object. (Contributed by Bénédikt Tran in :gh:`127691`.)" +msgstr "" + +#: whatsnew/3.14.rst:3403 +msgid "" +"The interpreter internally avoids some reference count modifications when " +"loading objects onto the operands stack by :term:`borrowing ` references when possible. This can lead to smaller reference " +"count values compared to previous Python versions. C API extensions that " +"checked :c:func:`Py_REFCNT` of ``1`` to determine if an function argument is " +"not referenced by any other code should instead use :c:func:" +"`PyUnstable_Object_IsUniqueReferencedTemporary` as a safer replacement." +msgstr "" + +#: whatsnew/3.14.rst:3412 +msgid "Private functions promoted to public C APIs:" +msgstr "" + +#: whatsnew/3.14.rst:3414 +msgid "``_PyBytes_Join()``: :c:func:`PyBytes_Join`" +msgstr "" + +#: whatsnew/3.14.rst:3415 +msgid "``_PyLong_IsNegative()``: :c:func:`PyLong_IsNegative`" +msgstr "" + +#: whatsnew/3.14.rst:3416 +msgid "``_PyLong_IsPositive()``: :c:func:`PyLong_IsPositive`" +msgstr "" + +#: whatsnew/3.14.rst:3417 +msgid "``_PyLong_IsZero()``: :c:func:`PyLong_IsZero`" +msgstr "" + +#: whatsnew/3.14.rst:3418 +msgid "``_PyLong_Sign()``: :c:func:`PyLong_GetSign`" +msgstr "" + +#: whatsnew/3.14.rst:3419 +msgid "``_PyUnicodeWriter_Dealloc()``: :c:func:`PyUnicodeWriter_Discard`" +msgstr "" + +#: whatsnew/3.14.rst:3420 +msgid "``_PyUnicodeWriter_Finish()``: :c:func:`PyUnicodeWriter_Finish`" +msgstr "" + +#: whatsnew/3.14.rst:3421 +msgid "``_PyUnicodeWriter_Init()``: use :c:func:`PyUnicodeWriter_Create`" +msgstr "" + +#: whatsnew/3.14.rst:3422 +msgid "``_PyUnicodeWriter_Prepare()``: (no replacement)" +msgstr "" + +#: whatsnew/3.14.rst:3423 +msgid "``_PyUnicodeWriter_PrepareKind()``: (no replacement)" +msgstr "" + +#: whatsnew/3.14.rst:3424 +msgid "``_PyUnicodeWriter_WriteChar()``: :c:func:`PyUnicodeWriter_WriteChar`" +msgstr "" + +#: whatsnew/3.14.rst:3425 +msgid "``_PyUnicodeWriter_WriteStr()``: :c:func:`PyUnicodeWriter_WriteStr`" +msgstr "" + +#: whatsnew/3.14.rst:3426 +msgid "" +"``_PyUnicodeWriter_WriteSubstring()``: :c:func:" +"`PyUnicodeWriter_WriteSubstring`" +msgstr "" + +#: whatsnew/3.14.rst:3427 +msgid "``_PyUnicode_EQ()``: :c:func:`PyUnicode_Equal`" +msgstr "" + +#: whatsnew/3.14.rst:3428 +msgid "``_PyUnicode_Equal()``: :c:func:`PyUnicode_Equal`" +msgstr "" + +#: whatsnew/3.14.rst:3429 +msgid "" +"``_Py_GetConfig()``: :c:func:`PyConfig_Get` and :c:func:`PyConfig_GetInt`" +msgstr "" + +#: whatsnew/3.14.rst:3430 +msgid "``_Py_HashBytes()``: :c:func:`Py_HashBuffer`" +msgstr "" + +#: whatsnew/3.14.rst:3431 +msgid "``_Py_fopen_obj()``: :c:func:`Py_fopen`" +msgstr "" + +#: whatsnew/3.14.rst:3432 +msgid "``PyMutex_IsLocked()`` : :c:func:`PyMutex_IsLocked`" +msgstr "" + +#: whatsnew/3.14.rst:3434 +msgid "" +"The `pythoncapi-compat project`_ can be used to get most of these new " +"functions on Python 3.13 and older." +msgstr "" + +#: whatsnew/3.14.rst:3441 +msgid "Notable changes in 3.14.1" +msgstr "" + +#: whatsnew/3.14.rst:3443 +msgid "" +"Add :c:func:`PyUnstable_ThreadState_SetStackProtection` and :c:func:" +"`PyUnstable_ThreadState_ResetStackProtection` functions to set the stack " +"protection base address and stack protection size of a Python thread state. " +"(Contributed by Victor Stinner in :gh:`139653`.)" +msgstr "" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index 349e1248..0919e31e 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -102,21 +103,104 @@ msgid "" "one or more positional arguments is present, and making a required option::" msgstr "" +#: whatsnew/3.2.rst:105 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser(\n" +" description = 'Manage servers', # main description for " +"help\n" +" epilog = 'Tested on Solaris and Linux') # displayed after help\n" +"parser.add_argument('action', # argument name\n" +" choices = ['deploy', 'start', 'stop'], # three allowed values\n" +" help = 'action on each target') # help msg\n" +"parser.add_argument('targets',\n" +" metavar = 'HOSTNAME', # var name used in help " +"msg\n" +" nargs = '+', # require one or more " +"targets\n" +" help = 'url for target machines') # help msg explanation\n" +"parser.add_argument('-u', '--user', # -u or --user option\n" +" required = True, # make it a required " +"argument\n" +" help = 'login as user')" +msgstr "" + #: whatsnew/3.2.rst:120 msgid "Example of calling the parser on a command string::" msgstr "" +#: whatsnew/3.2.rst:122 +msgid "" +">>> cmd = 'deploy sneezy.example.com sleepy.example.com -u skycaptain'\n" +">>> result = parser.parse_args(cmd.split())\n" +">>> result.action\n" +"'deploy'\n" +">>> result.targets\n" +"['sneezy.example.com', 'sleepy.example.com']\n" +">>> result.user\n" +"'skycaptain'" +msgstr "" + #: whatsnew/3.2.rst:131 msgid "Example of the parser's automatically generated help::" msgstr "" +#: whatsnew/3.2.rst:133 +msgid "" +">>> parser.parse_args('-h'.split())\n" +"\n" +"usage: manage_cloud.py [-h] -u USER\n" +" {deploy,start,stop} HOSTNAME [HOSTNAME ...]\n" +"\n" +"Manage servers\n" +"\n" +"positional arguments:\n" +" {deploy,start,stop} action on each target\n" +" HOSTNAME url for target machines\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" -u USER, --user USER login as user\n" +"\n" +"Tested on Solaris and Linux" +msgstr "" + #: whatsnew/3.2.rst:150 msgid "" "An especially nice :mod:`argparse` feature is the ability to define " "subparsers, each with their own argument patterns and help displays::" msgstr "" -#: whatsnew/3.2.rst:176 +#: whatsnew/3.2.rst:153 +msgid "" +"import argparse\n" +"parser = argparse.ArgumentParser(prog='HELM')\n" +"subparsers = parser.add_subparsers()\n" +"\n" +"parser_l = subparsers.add_parser('launch', help='Launch Control') # first " +"subgroup\n" +"parser_l.add_argument('-m', '--missiles', action='store_true')\n" +"parser_l.add_argument('-t', '--torpedos', action='store_true')\n" +"\n" +"parser_m = subparsers.add_parser('move', help='Move Vessel', # second " +"subgroup\n" +" aliases=('steer', 'turn')) # " +"equivalent names\n" +"parser_m.add_argument('-c', '--course', type=int, required=True)\n" +"parser_m.add_argument('-s', '--speed', type=int, default=0)" +msgstr "" + +#: whatsnew/3.2.rst:166 +msgid "" +"$ ./helm.py --help # top level help (launch and " +"move)\n" +"$ ./helm.py launch --help # help for launch options\n" +"$ ./helm.py launch --missiles # set missiles=True and " +"torpedos=False\n" +"$ ./helm.py steer --course 180 --speed 5 # set movement parameters" +msgstr "" + +#: whatsnew/3.2.rst:175 msgid ":pep:`389` - New Command Line Parsing Module" msgstr "" @@ -153,12 +237,48 @@ msgid "" "dictionary::" msgstr "" +#: whatsnew/3.2.rst:197 +msgid "" +"{\"version\": 1,\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: " +"%(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s " +"%(levelname)-8s %(message)s\"}\n" +" },\n" +" \"handlers\": {\"console\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"formatter\": \"brief\",\n" +" \"level\": \"INFO\",\n" +" \"stream\": \"ext://sys.stdout\"},\n" +" \"console_priority\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"formatter\": \"full\",\n" +" \"level\": \"ERROR\",\n" +" \"stream\": \"ext://sys.stderr\"}\n" +" },\n" +" \"root\": {\"level\": \"DEBUG\", \"handlers\": [\"console\", " +"\"console_priority\"]}}" +msgstr "" + #: whatsnew/3.2.rst:215 msgid "" "If that dictionary is stored in a file called :file:`conf.json`, it can be " "loaded and called with code like this::" msgstr "" +#: whatsnew/3.2.rst:218 +msgid "" +">>> import json, logging.config\n" +">>> with open('conf.json') as f:\n" +"... conf = json.load(f)\n" +"...\n" +">>> logging.config.dictConfig(conf)\n" +">>> logging.info(\"Transaction completed normally\")\n" +"INFO : root : Transaction completed normally\n" +">>> logging.critical(\"Abnormal termination\")\n" +"2011-02-17 11:14:36,694 root CRITICAL Abnormal termination" +msgstr "" + #: whatsnew/3.2.rst:230 msgid ":pep:`391` - Dictionary Based Configuration for Logging" msgstr "" @@ -225,7 +345,17 @@ msgid "" "launch of four parallel threads for copying files::" msgstr "" -#: whatsnew/3.2.rst:282 +#: whatsnew/3.2.rst:272 +msgid "" +"import concurrent.futures, shutil\n" +"with concurrent.futures.ThreadPoolExecutor(max_workers=4) as e:\n" +" e.submit(shutil.copy, 'src1.txt', 'dest1.txt')\n" +" e.submit(shutil.copy, 'src2.txt', 'dest2.txt')\n" +" e.submit(shutil.copy, 'src3.txt', 'dest3.txt')\n" +" e.submit(shutil.copy, 'src3.txt', 'dest4.txt')" +msgstr "" + +#: whatsnew/3.2.rst:281 msgid ":pep:`3148` - Futures -- Execute Computations Asynchronously" msgstr "" @@ -286,8 +416,8 @@ msgstr "" #: whatsnew/3.2.rst:315 msgid "" -"Imported modules now have a :attr:`__cached__` attribute which stores the " -"name of the actual file that was imported:" +"Imported modules now have a :attr:`~module.__cached__` attribute which " +"stores the name of the actual file that was imported:" msgstr "" #: whatsnew/3.2.rst:322 @@ -350,12 +480,28 @@ msgid "" "installed::" msgstr "" +#: whatsnew/3.2.rst:370 +msgid "" +"/usr/share/pyshared/foo.cpython-32m.so\n" +"/usr/share/pyshared/foo.cpython-33md.so" +msgstr "" + #: whatsnew/3.2.rst:373 msgid "" "In Python itself, the tags are accessible from functions in the :mod:" "`sysconfig` module::" msgstr "" +#: whatsnew/3.2.rst:376 +msgid "" +">>> import sysconfig\n" +">>> sysconfig.get_config_var('SOABI') # find the version tag\n" +"'cpython-32mu'\n" +">>> sysconfig.get_config_var('EXT_SUFFIX') # find the full filename " +"extension\n" +"'.cpython-32mu.so'" +msgstr "" + #: whatsnew/3.2.rst:384 msgid ":pep:`3149` - ABI Version Tagged .so Files" msgstr "" @@ -467,7 +613,30 @@ msgid "" "class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:" "`~configparser.ConfigParser`, or :mod:`dbm`. It is also useful with custom :" "class:`dict` subclasses that normalize keys before look-up or that supply a :" -"meth:`__missing__` method for unknown keys::" +"meth:`~object.__missing__` method for unknown keys::" +msgstr "" + +#: whatsnew/3.2.rst:463 +msgid "" +">>> import shelve\n" +">>> d = shelve.open('tmp.shl')\n" +">>> 'The {project_name} status is {status} as of {date}'.format_map(d)\n" +"'The testing project status is green as of February 15, 2011'\n" +"\n" +">>> class LowerCasedDict(dict):\n" +"... def __getitem__(self, key):\n" +"... return dict.__getitem__(self, key.lower())\n" +"...\n" +">>> lcd = LowerCasedDict(part='widgets', quantity=10)\n" +">>> 'There are {QUANTITY} {Part} in stock'.format_map(lcd)\n" +"'There are 10 widgets in stock'\n" +"\n" +">>> class PlaceholderDict(dict):\n" +"... def __missing__(self, key):\n" +"... return '<{}>'.format(key)\n" +"...\n" +">>> 'Hello {name}, welcome to {location}'.format_map(PlaceholderDict())\n" +"'Hello , welcome to '" msgstr "" #: whatsnew/3.2.rst:483 @@ -484,6 +653,15 @@ msgid "" "flags` attribute:" msgstr "" +#: whatsnew/3.2.rst:490 +msgid "" +"$ python -q\n" +">>> sys.flags\n" +"sys.flags(debug=0, division_warning=0, inspect=0, interactive=0,\n" +"optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0,\n" +"ignore_environment=0, verbose=0, bytes_warning=0, quiet=1)" +msgstr "" + #: whatsnew/3.2.rst:498 msgid "(Contributed by Marcin Wojdyr in :issue:`1772833`)." msgstr "" @@ -499,6 +677,20 @@ msgid "" "`AttributeError` and let other exceptions pass through::" msgstr "" +#: whatsnew/3.2.rst:508 +msgid "" +">>> class A:\n" +"... @property\n" +"... def f(self):\n" +"... return 1 // 0\n" +"...\n" +">>> a = A()\n" +">>> hasattr(a, 'f')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: integer division or modulo by zero" +msgstr "" + #: whatsnew/3.2.rst:519 msgid "" "(Discovered by Yury Selivanov and fixed by Benjamin Peterson; :issue:`9666`.)" @@ -518,7 +710,7 @@ msgstr "" #: whatsnew/3.2.rst:534 msgid "" -":class:`memoryview` objects now have a :meth:`~memoryview.release()` method " +":class:`memoryview` objects now have a :meth:`~memoryview.release` method " "and they also now support the context management protocol. This allows " "timely release of any resources that were acquired when requesting a buffer " "from the original object." @@ -534,6 +726,15 @@ msgid "" "occurs as a free variable in a nested block::" msgstr "" +#: whatsnew/3.2.rst:548 +msgid "" +"def outer(x):\n" +" def inner():\n" +" return x\n" +" inner()\n" +" del x" +msgstr "" + #: whatsnew/3.2.rst:554 msgid "" "This is now allowed. Remember that the target of an :keyword:`except` " @@ -541,6 +742,18 @@ msgid "" "a :exc:`SyntaxError` with Python 3.1 and now works again::" msgstr "" +#: whatsnew/3.2.rst:558 +msgid "" +"def f():\n" +" def print_error():\n" +" print(e)\n" +" try:\n" +" something\n" +" except Exception as e:\n" +" print_error()\n" +" # implicit \"del e\" here" +msgstr "" + #: whatsnew/3.2.rst:567 msgid "(See :issue:`4617`.)" msgstr "" @@ -567,6 +780,11 @@ msgid "" "environment variable as an alternative to using ``-W`` at the command line:" msgstr "" +#: whatsnew/3.2.rst:588 +msgid "" +"$ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'" +msgstr "" + #: whatsnew/3.2.rst:592 msgid "" "(Suggested by Barry Warsaw and implemented by Philip Jenvey in :issue:" @@ -600,6 +818,14 @@ msgid "" "enabling the warning from the command line:" msgstr "" +#: whatsnew/3.2.rst:612 +msgid "" +"$ python -q -Wdefault\n" +">>> f = open(\"foo\", \"wb\")\n" +">>> del f\n" +"__main__:1: ResourceWarning: unclosed file <_io.BufferedWriter name='foo'>" +msgstr "" + #: whatsnew/3.2.rst:619 msgid "" "(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` and :issue:" @@ -617,6 +843,18 @@ msgid "" "lists::" msgstr "" +#: whatsnew/3.2.rst:628 +msgid "" +">>> range(0, 100, 2).count(10)\n" +"1\n" +">>> range(0, 100, 2).index(10)\n" +"5\n" +">>> range(0, 100, 2)[5]\n" +"10\n" +">>> range(0, 100, 2)[0:5]\n" +"range(0, 10, 2)" +msgstr "" + #: whatsnew/3.2.rst:637 msgid "" "(Contributed by Daniel Stutzbach in :issue:`9213`, by Alexander Belopolsky " @@ -658,7 +896,7 @@ msgstr "" #: whatsnew/3.2.rst:664 msgid "" "The biggest news for Python 3.2 is that the :mod:`email` package, :mod:" -"`mailbox` module, and :mod:`nntplib` modules now work correctly with the " +"`mailbox` module, and :mod:`!nntplib` modules now work correctly with the " "bytes/text model in Python 3. For the first time, there is correct handling " "of messages with mixed encodings." msgstr "" @@ -867,8 +1105,9 @@ msgstr "" msgid "" "(Contributed by Raymond Hettinger and incorporating design ideas from Jim " "Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 `_\\, `recipe 577479 `_\\, :issue:`10586`, and :issue:`10593`.)" +"activestate.com/recipes/498245-lru-and-lfu-cache-decorators/>`_\\, `recipe " +"577479 `_\\, :issue:`10586`, and :issue:`10593`.)" msgstr "" #: whatsnew/3.2.rst:792 @@ -906,6 +1145,19 @@ msgid "" "total_ordering` to fill-in *__le__*, *__gt__* and *__ge__*::" msgstr "" +#: whatsnew/3.2.rst:814 +msgid "" +"@total_ordering\n" +"class Student:\n" +" def __eq__(self, other):\n" +" return ((self.lastname.lower(), self.firstname.lower()) ==\n" +" (other.lastname.lower(), other.firstname.lower()))\n" +"\n" +" def __lt__(self, other):\n" +" return ((self.lastname.lower(), self.firstname.lower()) <\n" +" (other.lastname.lower(), other.firstname.lower()))" +msgstr "" + #: whatsnew/3.2.rst:824 msgid "" "With the *total_ordering* decorator, the remaining comparison methods are " @@ -1027,6 +1279,22 @@ msgstr "" msgid "Example of using barriers::" msgstr "" +#: whatsnew/3.2.rst:940 +msgid "" +"from threading import Barrier, Thread\n" +"\n" +"def get_votes(site):\n" +" ballots = conduct_election(site)\n" +" all_polls_closed.wait() # do not count until all polls are " +"closed\n" +" totals = summarize(ballots)\n" +" publish(site, totals)\n" +"\n" +"all_polls_closed = Barrier(len(sites))\n" +"for site in sites:\n" +" Thread(target=get_votes, args=(site,)).start()" +msgstr "" + #: whatsnew/3.2.rst:952 msgid "" "In this example, the barrier enforces a rule that votes cannot be counted at " @@ -1045,6 +1313,20 @@ msgid "" "exception is raised::" msgstr "" +#: whatsnew/3.2.rst:963 +msgid "" +"def get_votes(site):\n" +" ballots = conduct_election(site)\n" +" try:\n" +" all_polls_closed.wait(timeout=midnight - time.now())\n" +" except BrokenBarrierError:\n" +" lockbox = seal_ballots(ballots)\n" +" queue.put(lockbox)\n" +" else:\n" +" totals = summarize(ballots)\n" +" publish(site, totals)" +msgstr "" + #: whatsnew/3.2.rst:974 msgid "" "In this example, the barrier enforces a more robust rule. If some election " @@ -1080,6 +1362,18 @@ msgid "" "datetime objects::" msgstr "" +#: whatsnew/3.2.rst:995 +msgid "" +">>> from datetime import datetime, timezone\n" +"\n" +">>> datetime.now(timezone.utc)\n" +"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone." +"utc)\n" +"\n" +">>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\n" +"datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)" +msgstr "" + #: whatsnew/3.2.rst:1003 msgid "" "Also, :class:`~datetime.timedelta` objects can now be multiplied by :class:" @@ -1109,6 +1403,23 @@ msgid "" "without guesswork::" msgstr "" +#: whatsnew/3.2.rst:1020 +msgid "" +">>> import time, warnings\n" +">>> warnings.resetwarnings() # remove the default warning filters\n" +"\n" +">>> time.accept2dyear = True # guess whether 11 means 11 or 2011\n" +">>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))\n" +"Warning (from warnings module):\n" +" ...\n" +"DeprecationWarning: Century info guessed for a 2-digit year.\n" +"'Fri Jan 1 12:34:56 2011'\n" +"\n" +">>> time.accept2dyear = False # use the full range of allowable dates\n" +">>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))\n" +"'Fri Jan 1 12:34:56 11'" +msgstr "" + #: whatsnew/3.2.rst:1034 msgid "" "Several functions now have significantly expanded date ranges. When :data:`!" @@ -1156,6 +1467,19 @@ msgid "" "complementary error function, :func:`~math.erfc`, is ``1 - erf(x)``:" msgstr "" +#: whatsnew/3.2.rst:1072 +msgid "" +">>> from math import erf, erfc, sqrt\n" +">>> erf(1.0/sqrt(2.0)) # portion of normal distribution within 1 standard " +"deviation\n" +"0.682689492137086\n" +">>> erfc(1.0/sqrt(2.0)) # portion of normal distribution outside 1 standard " +"deviation\n" +"0.31731050786291404\n" +">>> erf(1.0/sqrt(2.0)) + erfc(1.0/sqrt(2.0))\n" +"1.0" +msgstr "" + #: whatsnew/3.2.rst:1083 msgid "" "The :func:`~math.gamma` function is a continuous extension of the factorial " @@ -1186,6 +1510,17 @@ msgid "" "implemented::" msgstr "" +#: whatsnew/3.2.rst:1107 +msgid "" +"class Temperature(metaclass=abc.ABCMeta):\n" +" @abc.abstractclassmethod\n" +" def from_fahrenheit(cls, t):\n" +" ...\n" +" @abc.abstractclassmethod\n" +" def from_celsius(cls, t):\n" +" ..." +msgstr "" + #: whatsnew/3.2.rst:1115 msgid "(Patch submitted by Daniel Urban; :issue:`5867`.)" msgstr "" @@ -1202,6 +1537,30 @@ msgid "" "and support for slice notation are well-suited to in-place editing::" msgstr "" +#: whatsnew/3.2.rst:1125 +msgid "" +">>> REC_LEN, LOC_START, LOC_LEN = 34, 7, 11\n" +"\n" +">>> def change_location(buffer, record_number, location):\n" +"... start = record_number * REC_LEN + LOC_START\n" +"... buffer[start: start+LOC_LEN] = location\n" +"\n" +">>> import io\n" +"\n" +">>> byte_stream = io.BytesIO(\n" +"... b'G3805 storeroom Main chassis '\n" +"... b'X7899 shipping Reserve cog '\n" +"... b'L6988 receiving Primary sprocket'\n" +"... )\n" +">>> buffer = byte_stream.getbuffer()\n" +">>> change_location(buffer, 1, b'warehouse ')\n" +">>> change_location(buffer, 0, b'showroom ')\n" +">>> print(byte_stream.getvalue())\n" +"b'G3805 showroom Main chassis '\n" +"b'X7899 warehouse Reserve cog '\n" +"b'L6988 receiving Primary sprocket'" +msgstr "" + #: whatsnew/3.2.rst:1146 msgid "(Contributed by Antoine Pitrou in :issue:`5506`.)" msgstr "" @@ -1227,6 +1586,20 @@ msgid "" "instead::" msgstr "" +#: whatsnew/3.2.rst:1161 +msgid "" +">>> class MyList(list):\n" +"... @recursive_repr()\n" +"... def __repr__(self):\n" +"... return '<' + '|'.join(map(repr, self)) + '>'\n" +"...\n" +">>> m = MyList('abc')\n" +">>> m.append(m)\n" +">>> m.append('x')\n" +">>> print(m)\n" +"<'a'|'b'|'c'|...|'x'>" +msgstr "" + #: whatsnew/3.2.rst:1172 msgid "(Contributed by Raymond Hettinger in :issue:`9826` and :issue:`9840`.)" msgstr "" @@ -1259,6 +1632,15 @@ msgid "" "are equivalent::" msgstr "" +#: whatsnew/3.2.rst:1191 +msgid "" +">>> from logging import basicConfig\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: " +"%(message)s\")\n" +">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" +">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" +msgstr "" + #: whatsnew/3.2.rst:1196 msgid "" "If no configuration is set-up before a logging event occurs, there is now a " @@ -1302,6 +1684,19 @@ msgid "" "writeheader` for writing-out an initial row to document the field names::" msgstr "" +#: whatsnew/3.2.rst:1223 +msgid "" +">>> import csv, sys\n" +">>> w = csv.DictWriter(sys.stdout, ['name', 'dept'], dialect='unix')\n" +">>> w.writeheader()\n" +"\"name\",\"dept\"\n" +">>> w.writerows([\n" +"... {'name': 'tom', 'dept': 'accounting'},\n" +"... {'name': 'susan', 'dept': 'Salesl'}])\n" +"\"tom\",\"accounting\"\n" +"\"susan\",\"sales\"" +msgstr "" + #: whatsnew/3.2.rst:1233 msgid "" "(New dialect suggested by Jay Talbot in :issue:`5975`, and the new method " @@ -1344,14 +1739,43 @@ msgid "" "single definition::" msgstr "" +#: whatsnew/3.2.rst:1259 +msgid "" +"from contextlib import contextmanager\n" +"import logging\n" +"\n" +"logging.basicConfig(level=logging.INFO)\n" +"\n" +"@contextmanager\n" +"def track_entry_and_exit(name):\n" +" logging.info('Entering: %s', name)\n" +" yield\n" +" logging.info('Exiting: %s', name)" +msgstr "" + #: whatsnew/3.2.rst:1270 msgid "Formerly, this would have only been usable as a context manager::" msgstr "" +#: whatsnew/3.2.rst:1272 +msgid "" +"with track_entry_and_exit('widget loader'):\n" +" print('Some time consuming activity goes here')\n" +" load_widget()" +msgstr "" + #: whatsnew/3.2.rst:1276 msgid "Now, it can be used as a decorator as well::" msgstr "" +#: whatsnew/3.2.rst:1278 +msgid "" +"@track_entry_and_exit('widget loader')\n" +"def activity():\n" +" print('Some time consuming activity goes here')\n" +" load_widget()" +msgstr "" + #: whatsnew/3.2.rst:1283 msgid "" "Trying to fulfill two roles at once places some limitations on the " @@ -1382,6 +1806,12 @@ msgid "" "actual values are equal (:issue:`8188`)::" msgstr "" +#: whatsnew/3.2.rst:1300 +msgid "" +"assert hash(Fraction(3, 2)) == hash(1.5) == \\\n" +" hash(Decimal(\"1.5\")) == hash(complex(1.5, 0))" +msgstr "" + #: whatsnew/3.2.rst:1303 msgid "" "Some of the hashing details are exposed through a new attribute, :data:`sys." @@ -1396,7 +1826,7 @@ msgid "" "been relaxed. It is still unsupported (and ill-advised) to have implicit " "mixing in arithmetic expressions such as ``Decimal('1.1') + float('1.1')`` " "because the latter loses information in the process of constructing the " -"binary float. However, since existing floating point value can be converted " +"binary float. However, since existing floating-point value can be converted " "losslessly to either a decimal or rational representation, it makes sense to " "add them to the constructor and to support mixed-type comparisons." msgstr "" @@ -1418,7 +1848,7 @@ msgstr "" #: whatsnew/3.2.rst:1327 msgid "" "Similar changes were made to :class:`fractions.Fraction` so that the :meth:" -"`~fractions.Fraction.from_float()` and :meth:`~fractions.Fraction." +"`~fractions.Fraction.from_float` and :meth:`~fractions.Fraction." "from_decimal` methods are no longer needed (:issue:`8294`):" msgstr "" @@ -1445,12 +1875,33 @@ msgid "" "FTP connection when done::" msgstr "" +#: whatsnew/3.2.rst:1352 +msgid "" +">>> from ftplib import FTP\n" +">>> with FTP(\"ftp1.at.proftpd.org\") as ftp:\n" +" ftp.login()\n" +" ftp.dir()\n" +"\n" +"'230 Anonymous login ok, restrictions apply.'\n" +"dr-xr-xr-x 9 ftp ftp 154 May 6 10:43 .\n" +"dr-xr-xr-x 9 ftp ftp 154 May 6 10:43 ..\n" +"dr-xr-xr-x 5 ftp ftp 4096 May 6 10:43 CentOS\n" +"dr-xr-xr-x 3 ftp ftp 18 Jul 10 2008 Fedora" +msgstr "" + #: whatsnew/3.2.rst:1363 msgid "" "Other file-like objects such as :class:`mmap.mmap` and :func:`fileinput." "input` also grew auto-closing context managers::" msgstr "" +#: whatsnew/3.2.rst:1366 +msgid "" +"with fileinput.input(files=('log1.txt', 'log2.txt')) as f:\n" +" for line in f:\n" +" process(line)" +msgstr "" + #: whatsnew/3.2.rst:1370 msgid "" "(Contributed by Tarek Ziadé and Giampaolo Rodolà in :issue:`4972`, and by " @@ -1563,6 +2014,26 @@ msgid "" "function can return ``None``::" msgstr "" +#: whatsnew/3.2.rst:1454 +msgid "" +">>> import tarfile, glob\n" +"\n" +">>> def myfilter(tarinfo):\n" +"... if tarinfo.isfile(): # only save real files\n" +"... tarinfo.uname = 'monty' # redact the user name\n" +"... return tarinfo\n" +"\n" +">>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:\n" +"... for filename in glob.glob('*.txt'):\n" +"... tf.add(filename, filter=myfilter)\n" +"... tf.list()\n" +"-rw-r--r-- monty/501 902 2011-01-26 17:59:11 annotations.txt\n" +"-rw-r--r-- monty/501 123 2011-01-26 17:59:11 general_questions.txt\n" +"-rw-r--r-- monty/501 3514 2011-01-26 17:59:11 prion.txt\n" +"-rw-r--r-- monty/501 124 2011-01-26 17:59:11 py_todo.txt\n" +"-rw-r--r-- monty/501 1399 2011-01-26 17:59:11 semaphore_notes.txt" +msgstr "" + #: whatsnew/3.2.rst:1471 msgid "" "(Proposed by Tarek Ziadé and implemented by Lars Gustäbel in :issue:`6856`.)" @@ -1579,6 +2050,21 @@ msgid "" "available on the current implementation::" msgstr "" +#: whatsnew/3.2.rst:1480 +msgid "" +">>> import hashlib\n" +"\n" +">>> hashlib.algorithms_guaranteed\n" +"{'sha1', 'sha224', 'sha384', 'sha256', 'sha512', 'md5'}\n" +"\n" +">>> hashlib.algorithms_available\n" +"{'md2', 'SHA256', 'SHA512', 'dsaWithSHA', 'mdc2', 'SHA224', 'MD4', " +"'sha256',\n" +"'sha512', 'ripemd160', 'SHA1', 'MDC2', 'SHA', 'SHA384', 'MD2',\n" +"'ecdsa-with-SHA1','md4', 'md5', 'sha1', 'DSA-SHA', 'sha224',\n" +"'dsaEncryption', 'DSA', 'RIPEMD160', 'sha', 'MD5', 'sha384'}" +msgstr "" + #: whatsnew/3.2.rst:1491 msgid "(Suggested by Carl Chenet in :issue:`7418`.)" msgstr "" @@ -1597,6 +2083,21 @@ msgid "" "numbers, tuples, lists, dicts, sets, booleans, and ``None``." msgstr "" +#: whatsnew/3.2.rst:1505 +msgid "" +">>> from ast import literal_eval\n" +"\n" +">>> request = \"{'req': 3, 'func': 'pow', 'args': (2, 0.5)}\"\n" +">>> literal_eval(request)\n" +"{'args': (2, 0.5), 'req': 3, 'func': 'pow'}\n" +"\n" +">>> request = \"os.system('do something harmful')\"\n" +">>> literal_eval(request)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: malformed node or string: <_ast.Call object at 0x101739a10>" +msgstr "" + #: whatsnew/3.2.rst:1517 msgid "(Implemented by Benjamin Peterson and Georg Brandl.)" msgstr "" @@ -1674,6 +2175,32 @@ msgid "" "non-destructive (the original files are left unchanged)." msgstr "" +#: whatsnew/3.2.rst:1569 +msgid "" +">>> import shutil, pprint\n" +"\n" +">>> os.chdir('mydata') # change to the source directory\n" +">>> f = shutil.make_archive('/var/backup/mydata',\n" +"... 'zip') # archive the current directory\n" +">>> f # show the name of archive\n" +"'/var/backup/mydata.zip'\n" +">>> os.chdir('tmp') # change to an unpacking\n" +">>> shutil.unpack_archive('/var/backup/mydata.zip') # recover the data\n" +"\n" +">>> pprint.pprint(shutil.get_archive_formats()) # display known formats\n" +"[('bztar', \"bzip2'ed tar-file\"),\n" +" ('gztar', \"gzip'ed tar-file\"),\n" +" ('tar', 'uncompressed tar file'),\n" +" ('zip', 'ZIP file')]\n" +"\n" +">>> shutil.register_archive_format( # register a new archive format\n" +"... name='xz',\n" +"... function=xz.compress, # callable archiving function\n" +"... extra_args=[('level', 8)], # arguments to the function\n" +"... description='xz compression'\n" +"... )" +msgstr "" + #: whatsnew/3.2.rst:1595 msgid "sqlite3" msgstr "" @@ -1723,7 +2250,7 @@ msgstr "" #: whatsnew/3.2.rst:1625 msgid "" -"Socket objects now have a :meth:`~socket.socket.detach()` method which puts " +"Socket objects now have a :meth:`~socket.socket.detach` method which puts " "the socket into closed state without actually closing the underlying file " "descriptor. The latter can then be reused for other purposes. (Added by " "Antoine Pitrou; :issue:`8524`.)" @@ -1766,8 +2293,8 @@ msgid "" "The :func:`ssl.wrap_socket() ` constructor " "function now takes a *ciphers* argument. The *ciphers* string lists the " "allowed encryption algorithms using the format described in the `OpenSSL " -"documentation `__." +"documentation `__." msgstr "" #: whatsnew/3.2.rst:1655 @@ -1812,7 +2339,7 @@ msgstr "" #: whatsnew/3.2.rst:1680 msgid "" -"The :mod:`nntplib` module has a revamped implementation with better bytes " +"The :mod:`!nntplib` module has a revamped implementation with better bytes " "and text semantics as well as more practical APIs. These improvements break " "compatibility with the nntplib version in Python 3.1, which was partly " "dysfunctional in itself." @@ -1820,8 +2347,8 @@ msgstr "" #: whatsnew/3.2.rst:1685 msgid "" -"Support for secure connections through both implicit (using :class:`nntplib." -"NNTP_SSL`) and explicit (using :meth:`nntplib.NNTP.starttls`) TLS has also " +"Support for secure connections through both implicit (using :class:`!nntplib." +"NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS has also " "been added." msgstr "" @@ -1933,6 +2460,10 @@ msgid "" "and a directory to start discovery with ``-s``:" msgstr "" +#: whatsnew/3.2.rst:1755 +msgid "$ python -m unittest discover -s my_proj_dir -p _test.py" +msgstr "" + #: whatsnew/3.2.rst:1768 whatsnew/3.2.rst:1924 msgid "(Contributed by Michael Foord.)" msgstr "" @@ -1950,6 +2481,12 @@ msgid "" "a given warning type is triggered by the code under test::" msgstr "" +#: whatsnew/3.2.rst:1775 +msgid "" +"with self.assertWarns(DeprecationWarning):\n" +" legacy_function('XYZ')" +msgstr "" + #: whatsnew/3.2.rst:1778 msgid "(Contributed by Antoine Pitrou, :issue:`9754`.)" msgstr "" @@ -1962,6 +2499,12 @@ msgid "" "regardless of order)::" msgstr "" +#: whatsnew/3.2.rst:1785 +msgid "" +"def test_anagram(self):\n" +" self.assertCountEqual('algorithm', 'logarithm')" +msgstr "" + #: whatsnew/3.2.rst:1790 msgid "" "A principal feature of the unittest module is an effort to produce " @@ -2106,11 +2649,11 @@ msgstr "" #: whatsnew/3.2.rst:1861 msgid "" -":class:`!asyncore.dispatcher` now provides a :meth:`!handle_accepted()` " -"method returning a ``(sock, addr)`` pair which is called when a connection " -"has actually been established with a new remote endpoint. This is supposed " -"to be used as a replacement for old :meth:`!handle_accept()` and avoids the " -"user to call :meth:`!accept()` directly." +":class:`!asyncore.dispatcher` now provides a :meth:`!handle_accepted` method " +"returning a ``(sock, addr)`` pair which is called when a connection has " +"actually been established with a new remote endpoint. This is supposed to be " +"used as a replacement for old :meth:`!handle_accept` and avoids the user to " +"call :meth:`!accept` directly." msgstr "" #: whatsnew/3.2.rst:1868 @@ -2128,6 +2671,12 @@ msgid "" "directories::" msgstr "" +#: whatsnew/3.2.rst:1877 +msgid "" +"with tempfile.TemporaryDirectory() as tmpdirname:\n" +" print('created temporary dir:', tmpdirname)" +msgstr "" + #: whatsnew/3.2.rst:1880 msgid "(Contributed by Neil Schemenauer and Nick Coghlan; :issue:`5178`.)" msgstr "" @@ -2143,6 +2692,24 @@ msgid "" "iterator::" msgstr "" +#: whatsnew/3.2.rst:1889 +msgid "" +">>> from inspect import getgeneratorstate\n" +">>> def gen():\n" +"... yield 'demo'\n" +"...\n" +">>> g = gen()\n" +">>> getgeneratorstate(g)\n" +"'GEN_CREATED'\n" +">>> next(g)\n" +"'demo'\n" +">>> getgeneratorstate(g)\n" +"'GEN_SUSPENDED'\n" +">>> next(g, None)\n" +">>> getgeneratorstate(g)\n" +"'GEN_CLOSED'" +msgstr "" + #: whatsnew/3.2.rst:1904 msgid "(Contributed by Rodolpho Eckhardt and Nick Coghlan, :issue:`10220`.)" msgstr "" @@ -2155,6 +2722,22 @@ msgid "" "guaranteed not to change state while it is searching::" msgstr "" +#: whatsnew/3.2.rst:1911 +msgid "" +">>> class A:\n" +"... @property\n" +"... def f(self):\n" +"... print('Running')\n" +"... return 10\n" +"...\n" +">>> a = A()\n" +">>> getattr(a, 'f')\n" +"Running\n" +"10\n" +">>> inspect.getattr_static(a, 'f')\n" +"" +msgstr "" + #: whatsnew/3.2.rst:1927 msgid "pydoc" msgstr "" @@ -2166,6 +2749,10 @@ msgid "" "window to display that server:" msgstr "" +#: whatsnew/3.2.rst:1933 +msgid "$ pydoc3.2 -b" +msgstr "" + #: whatsnew/3.2.rst:1937 msgid "(Contributed by Ron Adam; :issue:`2001`.)" msgstr "" @@ -2182,6 +2769,32 @@ msgid "" "code object. The former returns a string and the latter prints it::" msgstr "" +#: whatsnew/3.2.rst:1947 +msgid "" +">>> import dis, random\n" +">>> dis.show_code(random.choice)\n" +"Name: choice\n" +"Filename: /Library/Frameworks/Python.framework/Versions/3.2/lib/" +"python3.2/random.py\n" +"Argument count: 2\n" +"Kw-only arguments: 0\n" +"Number of locals: 3\n" +"Stack size: 11\n" +"Flags: OPTIMIZED, NEWLOCALS, NOFREE\n" +"Constants:\n" +" 0: 'Choose a random element from a non-empty sequence.'\n" +" 1: 'Cannot choose from an empty sequence'\n" +"Names:\n" +" 0: _randbelow\n" +" 1: len\n" +" 2: ValueError\n" +" 3: IndexError\n" +"Variable names:\n" +" 0: self\n" +" 1: seq\n" +" 2: i" +msgstr "" + #: whatsnew/3.2.rst:1969 msgid "" "In addition, the :func:`~dis.dis` function now accepts string arguments so " @@ -2189,6 +2802,27 @@ msgid "" "``dis(s)``::" msgstr "" +#: whatsnew/3.2.rst:1973 +msgid "" +">>> dis('3*x+1 if x%2==1 else x//2')\n" +" 1 0 LOAD_NAME 0 (x)\n" +" 3 LOAD_CONST 0 (2)\n" +" 6 BINARY_MODULO\n" +" 7 LOAD_CONST 1 (1)\n" +" 10 COMPARE_OP 2 (==)\n" +" 13 POP_JUMP_IF_FALSE 28\n" +" 16 LOAD_CONST 2 (3)\n" +" 19 LOAD_NAME 0 (x)\n" +" 22 BINARY_MULTIPLY\n" +" 23 LOAD_CONST 1 (1)\n" +" 26 BINARY_ADD\n" +" 27 RETURN_VALUE\n" +" >> 28 LOAD_NAME 0 (x)\n" +" 31 LOAD_CONST 0 (2)\n" +" 34 BINARY_FLOOR_DIVIDE\n" +" 35 RETURN_VALUE" +msgstr "" + #: whatsnew/3.2.rst:1991 msgid "" "Taken together, these improvements make it easier to explore how CPython is " @@ -2251,12 +2885,34 @@ msgid "" "directory path." msgstr "" +#: whatsnew/3.2.rst:2025 +msgid "" +">>> import site\n" +">>> site.getsitepackages()\n" +"['/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-" +"packages',\n" +" '/Library/Frameworks/Python.framework/Versions/3.2/lib/site-python',\n" +" '/Library/Python/3.2/site-packages']\n" +">>> site.getuserbase()\n" +"'/Users/raymondhettinger/Library/Python/3.2'\n" +">>> site.getusersitepackages()\n" +"'/Users/raymondhettinger/Library/Python/3.2/lib/python/site-packages'" +msgstr "" + #: whatsnew/3.2.rst:2035 msgid "" "Conveniently, some of site's functionality is accessible directly from the " "command-line:" msgstr "" +#: whatsnew/3.2.rst:2038 +msgid "" +"$ python -m site --user-base\n" +"/Users/raymondhettinger/.local\n" +"$ python -m site --user-site\n" +"/Users/raymondhettinger/.local/lib/python3.2/site-packages" +msgstr "" + #: whatsnew/3.2.rst:2045 msgid "(Contributed by Tarek Ziadé in :issue:`6693`.)" msgstr "" @@ -2313,6 +2969,45 @@ msgstr "" msgid "There is also a convenient command-line interface:" msgstr "" +#: whatsnew/3.2.rst:2073 +msgid "" +"C:\\Python32>python -m sysconfig\n" +"Platform: \"win32\"\n" +"Python version: \"3.2\"\n" +"Current installation scheme: \"nt\"\n" +"\n" +"Paths:\n" +" data = \"C:\\Python32\"\n" +" include = \"C:\\Python32\\Include\"\n" +" platinclude = \"C:\\Python32\\Include\"\n" +" platlib = \"C:\\Python32\\Lib\\site-packages\"\n" +" platstdlib = \"C:\\Python32\\Lib\"\n" +" purelib = \"C:\\Python32\\Lib\\site-packages\"\n" +" scripts = \"C:\\Python32\\Scripts\"\n" +" stdlib = \"C:\\Python32\\Lib\"\n" +"\n" +"Variables:\n" +" BINDIR = \"C:\\Python32\"\n" +" BINLIBDEST = \"C:\\Python32\\Lib\"\n" +" EXE = \".exe\"\n" +" INCLUDEPY = \"C:\\Python32\\Include\"\n" +" LIBDEST = \"C:\\Python32\\Lib\"\n" +" SO = \".pyd\"\n" +" VERSION = \"32\"\n" +" abiflags = \"\"\n" +" base = \"C:\\Python32\"\n" +" exec_prefix = \"C:\\Python32\"\n" +" platbase = \"C:\\Python32\"\n" +" prefix = \"C:\\Python32\"\n" +" projectbase = \"C:\\Python32\"\n" +" py_version = \"3.2\"\n" +" py_version_nodot = \"32\"\n" +" py_version_short = \"3.2\"\n" +" srcdir = \"C:\\Python32\"\n" +" userbase = \"C:\\Documents and Settings\\Raymond\\Application " +"Data\\Python\"" +msgstr "" + #: whatsnew/3.2.rst:2110 msgid "(Moved out of Distutils by Tarek Ziadé.)" msgstr "" @@ -2388,6 +3083,35 @@ msgstr "" msgid "Config parsers gained a new API based on the mapping protocol::" msgstr "" +#: whatsnew/3.2.rst:2144 +msgid "" +">>> parser = ConfigParser()\n" +">>> parser.read_string(\"\"\"\n" +"... [DEFAULT]\n" +"... location = upper left\n" +"... visible = yes\n" +"... editable = no\n" +"... color = blue\n" +"...\n" +"... [main]\n" +"... title = Main Menu\n" +"... color = green\n" +"...\n" +"... [options]\n" +"... title = Options\n" +"... \"\"\")\n" +">>> parser['main']['color']\n" +"'green'\n" +">>> parser['main']['editable']\n" +"'no'\n" +">>> section = parser['options']\n" +">>> section['title']\n" +"'Options'\n" +">>> section['title'] = 'Options (editable: %(editable)s)'\n" +">>> section['title']\n" +"'Options (editable: no)'" +msgstr "" + #: whatsnew/3.2.rst:2170 msgid "" "The new API is implemented on top of the classical API, so custom parser " @@ -2407,6 +3131,39 @@ msgid "" "interpolation handler :class:`~configparser.ExtendedInterpolation`::" msgstr "" +#: whatsnew/3.2.rst:2180 +msgid "" +">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" +">>> parser.read_dict({'buildout': {'directory': '/home/ambv/zope9'},\n" +"... 'custom': {'prefix': '/usr/local'}})\n" +">>> parser.read_string(\"\"\"\n" +"... [buildout]\n" +"... parts =\n" +"... zope9\n" +"... instance\n" +"... find-links =\n" +"... ${buildout:directory}/downloads/dist\n" +"...\n" +"... [zope9]\n" +"... recipe = plone.recipe.zope9install\n" +"... location = /opt/zope\n" +"...\n" +"... [instance]\n" +"... recipe = plone.recipe.zope9instance\n" +"... zope9-location = ${zope9:location}\n" +"... zope-conf = ${custom:prefix}/etc/zope.conf\n" +"... \"\"\")\n" +">>> parser['buildout']['find-links']\n" +"'\\n/home/ambv/zope9/downloads/dist'\n" +">>> parser['instance']['zope-conf']\n" +"'/usr/local/etc/zope.conf'\n" +">>> instance = parser['instance']\n" +">>> instance['zope-conf']\n" +"'/usr/local/etc/zope.conf'\n" +">>> instance['zope9-location']\n" +"'/opt/zope'" +msgstr "" + #: whatsnew/3.2.rst:2210 msgid "" "A number of smaller features were also introduced, like support for " @@ -2440,6 +3197,17 @@ msgid "" "tuple`::" msgstr "" +#: whatsnew/3.2.rst:2237 +msgid "" +">>> r = urllib.parse.urldefrag('http://python.org/about/#target')\n" +">>> r\n" +"DefragResult(url='http://python.org/about/', fragment='target')\n" +">>> r[0]\n" +"'http://python.org/about/'\n" +">>> r.fragment\n" +"'target'" +msgstr "" + #: whatsnew/3.2.rst:2245 msgid "" "And, the :func:`~urllib.parse.urlencode` function is now much more flexible, " @@ -2448,6 +3216,15 @@ msgid "" "func:`~urllib.parse.quote_plus` for encoding::" msgstr "" +#: whatsnew/3.2.rst:2250 +msgid "" +">>> urllib.parse.urlencode([\n" +"... ('type', 'telenovela'),\n" +"... ('name', '¿Dónde Está Elisa?')],\n" +"... encoding='latin-1')\n" +"'type=telenovela&name=%BFD%F3nde+Est%E1+Elisa%3F'" +msgstr "" + #: whatsnew/3.2.rst:2256 msgid "" "As detailed in :ref:`parsing-ascii-encoded-bytes`, all the :mod:`urllib." @@ -2531,6 +3308,10 @@ msgid "" "from the command-line:" msgstr "" +#: whatsnew/3.2.rst:2309 +msgid "$ python -m turtledemo" +msgstr "" + #: whatsnew/3.2.rst:2313 msgid "" "(Moved from the Demo directory by Alexander Belopolsky in :issue:`10199`.)" @@ -2549,7 +3330,7 @@ msgid "" "ensuing system calls. The notion of a \"check interval\" to allow thread " "switches has been abandoned and replaced by an absolute duration expressed " "in seconds. This parameter is tunable through :func:`sys." -"setswitchinterval()`. It currently defaults to 5 milliseconds." +"setswitchinterval`. It currently defaults to 5 milliseconds." msgstr "" #: whatsnew/3.2.rst:2327 @@ -2608,6 +3389,13 @@ msgid "" "and operationally fast::" msgstr "" +#: whatsnew/3.2.rst:2362 +msgid "" +"extension = name.rpartition('.')[2]\n" +"if extension in {'xml', 'html', 'xhtml', 'css'}:\n" +" handle(name)" +msgstr "" + #: whatsnew/3.2.rst:2366 msgid "" "(Patch and additional tests contributed by Dave Malcolm; :issue:`6690`)." @@ -3079,7 +3867,7 @@ msgstr "" #: whatsnew/3.2.rst:2647 msgid "" -"The :mod:`nntplib` module was reworked extensively, meaning that its APIs " +"The :mod:`!nntplib` module was reworked extensively, meaning that its APIs " "are often incompatible with the 3.1 APIs." msgstr "" @@ -3155,6 +3943,14 @@ msgid "" "when one of them raises an exception::" msgstr "" +#: whatsnew/3.2.rst:2692 +msgid "" +"with open('mylog.txt') as infile, open('a.out', 'w') as outfile:\n" +" for line in infile:\n" +" if '' in line:\n" +" outfile.write(line)" +msgstr "" + #: whatsnew/3.2.rst:2697 msgid "" "(Contributed by Georg Brandl and Mattias Brändström; `appspot issue 53094 " diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index 46a33670..6780315e 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -171,7 +172,7 @@ msgid "" "`420`)" msgstr "" -#: whatsnew/3.3.rst:133 +#: whatsnew/3.3.rst:132 msgid ":pep:`420` - Implicit Namespace Packages" msgstr "" @@ -215,7 +216,7 @@ msgid "" "dimensional NumPy-style arrays is explained." msgstr "" -#: whatsnew/3.3.rst:1123 +#: whatsnew/3.3.rst:1125 msgid "Features" msgstr "" @@ -252,7 +253,7 @@ msgid "" "now possible to reverse a memoryview in *O*\\ (1) by using a negative step." msgstr "" -#: whatsnew/3.3.rst:1133 +#: whatsnew/3.3.rst:1135 msgid "API changes" msgstr "" @@ -415,7 +416,7 @@ msgid "" "benchmark (see the PEP for details)." msgstr "" -#: whatsnew/3.3.rst:283 +#: whatsnew/3.3.rst:282 msgid ":pep:`393` - Flexible String Representation" msgstr "" @@ -462,7 +463,7 @@ msgid "" "Curtin in :issue:`3561`.)" msgstr "" -#: whatsnew/3.3.rst:317 +#: whatsnew/3.3.rst:315 msgid ":pep:`397` - Python Launcher for Windows" msgstr "" @@ -494,7 +495,7 @@ msgstr "" msgid "" "You don't have to worry anymore about choosing the appropriate exception " "type between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:" -"`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` or :exc:`select." +"`WindowsError`, :exc:`!mmap.error`, :exc:`socket.error` or :exc:`select." "error`. All these exception types are now only one: :exc:`OSError`. The " "other names are kept as aliases for compatibility reasons." msgstr "" @@ -577,12 +578,39 @@ msgid "" "avoided. For example, the following code written for Python 3.2::" msgstr "" +#: whatsnew/3.3.rst:366 +msgid "" +"from errno import ENOENT, EACCES, EPERM\n" +"\n" +"try:\n" +" with open(\"document.txt\") as f:\n" +" content = f.read()\n" +"except IOError as err:\n" +" if err.errno == ENOENT:\n" +" print(\"document.txt file is missing\")\n" +" elif err.errno in (EACCES, EPERM):\n" +" print(\"You are not allowed to read document.txt\")\n" +" else:\n" +" raise" +msgstr "" + #: whatsnew/3.3.rst:379 msgid "" "can now be written without the :mod:`errno` import and without manual " "inspection of exception attributes::" msgstr "" +#: whatsnew/3.3.rst:382 +msgid "" +"try:\n" +" with open(\"document.txt\") as f:\n" +" content = f.read()\n" +"except FileNotFoundError:\n" +" print(\"document.txt file is missing\")\n" +"except PermissionError:\n" +" print(\"You are not allowed to read document.txt\")" +msgstr "" + #: whatsnew/3.3.rst:392 msgid ":pep:`3151` - Reworking the OS and IO Exception Hierarchy" msgstr "" @@ -617,6 +645,16 @@ msgid "" "shortened form of ``for item in iterable: yield item``::" msgstr "" +#: whatsnew/3.3.rst:417 +msgid "" +">>> def g(x):\n" +"... yield from range(x, 0, -1)\n" +"... yield from range(x)\n" +"...\n" +">>> list(g(5))\n" +"[5, 4, 3, 2, 1, 0, 1, 2, 3, 4]" +msgstr "" + #: whatsnew/3.3.rst:424 msgid "" "However, unlike an ordinary loop, ``yield from`` allows subgenerators to " @@ -624,6 +662,36 @@ msgid "" "final value to the outer generator::" msgstr "" +#: whatsnew/3.3.rst:428 +msgid "" +">>> def accumulate():\n" +"... tally = 0\n" +"... while 1:\n" +"... next = yield\n" +"... if next is None:\n" +"... return tally\n" +"... tally += next\n" +"...\n" +">>> def gather_tallies(tallies):\n" +"... while 1:\n" +"... tally = yield from accumulate()\n" +"... tallies.append(tally)\n" +"...\n" +">>> tallies = []\n" +">>> acc = gather_tallies(tallies)\n" +">>> next(acc) # Ensure the accumulator is ready to accept values\n" +">>> for i in range(4):\n" +"... acc.send(i)\n" +"...\n" +">>> acc.send(None) # Finish the first tally\n" +">>> for i in range(5):\n" +"... acc.send(i)\n" +"...\n" +">>> acc.send(None) # Finish the second tally\n" +">>> tallies\n" +"[6, 10]" +msgstr "" + #: whatsnew/3.3.rst:455 msgid "" "The main principle driving this change is to allow even generators that are " @@ -632,7 +700,7 @@ msgid "" "into multiple subfunctions." msgstr "" -#: whatsnew/3.3.rst:464 +#: whatsnew/3.3.rst:462 msgid ":pep:`380` - Syntax for Delegating to a Subgenerator" msgstr "" @@ -654,12 +722,54 @@ msgid "" "applications that convert between exception types::" msgstr "" +#: whatsnew/3.3.rst:475 +msgid "" +">>> class D:\n" +"... def __init__(self, extra):\n" +"... self._extra_attributes = extra\n" +"... def __getattr__(self, attr):\n" +"... try:\n" +"... return self._extra_attributes[attr]\n" +"... except KeyError:\n" +"... raise AttributeError(attr) from None\n" +"...\n" +">>> D({}).x\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 8, in __getattr__\n" +"AttributeError: x" +msgstr "" + #: whatsnew/3.3.rst:490 msgid "" "Without the ``from None`` suffix to suppress the cause, the original " "exception would be displayed by default::" msgstr "" +#: whatsnew/3.3.rst:493 +msgid "" +">>> class C:\n" +"... def __init__(self, extra):\n" +"... self._extra_attributes = extra\n" +"... def __getattr__(self, attr):\n" +"... try:\n" +"... return self._extra_attributes[attr]\n" +"... except KeyError:\n" +"... raise AttributeError(attr)\n" +"...\n" +">>> C({}).x\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in __getattr__\n" +"KeyError: 'x'\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 8, in __getattr__\n" +"AttributeError: x" +msgstr "" + #: whatsnew/3.3.rst:514 msgid "" "No debugging capability is lost, as the original exception context remains " @@ -667,7 +777,17 @@ msgid "" "suppressed valuable underlying details)::" msgstr "" -#: whatsnew/3.3.rst:528 +#: whatsnew/3.3.rst:518 +msgid "" +">>> try:\n" +"... D({}).x\n" +"... except AttributeError as exc:\n" +"... print(repr(exc.__context__))\n" +"...\n" +"KeyError('x',)" +msgstr "" + +#: whatsnew/3.3.rst:527 msgid ":pep:`409` - Suppressing exception context" msgstr "" @@ -705,45 +825,95 @@ msgstr "" #: whatsnew/3.3.rst:552 msgid "" -"Functions and class objects have a new ``__qualname__`` attribute " -"representing the \"path\" from the module top-level to their definition. " -"For global functions and classes, this is the same as ``__name__``. For " -"other functions and classes, it provides better information about where they " -"were actually defined, and how they might be accessible from the global " -"scope." +"Functions and class objects have a new :attr:`~definition.__qualname__` " +"attribute representing the \"path\" from the module top-level to their " +"definition. For global functions and classes, this is the same as :attr:" +"`~definition.__name__`. For other functions and classes, it provides better " +"information about where they were actually defined, and how they might be " +"accessible from the global scope." msgstr "" -#: whatsnew/3.3.rst:558 +#: whatsnew/3.3.rst:560 msgid "Example with (non-bound) methods::" msgstr "" -#: whatsnew/3.3.rst:569 +#: whatsnew/3.3.rst:562 +msgid "" +">>> class C:\n" +"... def meth(self):\n" +"... pass\n" +"...\n" +">>> C.meth.__name__\n" +"'meth'\n" +">>> C.meth.__qualname__\n" +"'C.meth'" +msgstr "" + +#: whatsnew/3.3.rst:571 msgid "Example with nested classes::" msgstr "" -#: whatsnew/3.3.rst:585 +#: whatsnew/3.3.rst:573 +msgid "" +">>> class C:\n" +"... class D:\n" +"... def meth(self):\n" +"... pass\n" +"...\n" +">>> C.D.__name__\n" +"'D'\n" +">>> C.D.__qualname__\n" +"'C.D'\n" +">>> C.D.meth.__name__\n" +"'meth'\n" +">>> C.D.meth.__qualname__\n" +"'C.D.meth'" +msgstr "" + +#: whatsnew/3.3.rst:587 msgid "Example with nested functions::" msgstr "" -#: whatsnew/3.3.rst:597 +#: whatsnew/3.3.rst:589 +msgid "" +">>> def outer():\n" +"... def inner():\n" +"... pass\n" +"... return inner\n" +"...\n" +">>> outer().__name__\n" +"'inner'\n" +">>> outer().__qualname__\n" +"'outer..inner'" +msgstr "" + +#: whatsnew/3.3.rst:599 msgid "" "The string representation of those objects is also changed to include the " "new, more precise information::" msgstr "" -#: whatsnew/3.3.rst:607 +#: whatsnew/3.3.rst:602 +msgid "" +">>> str(C.D)\n" +"\"\"\n" +">>> str(C.D.meth)\n" +"''" +msgstr "" + +#: whatsnew/3.3.rst:609 msgid ":pep:`3155` - Qualified name for classes and functions" msgstr "" -#: whatsnew/3.3.rst:608 +#: whatsnew/3.3.rst:610 msgid "PEP written and implemented by Antoine Pitrou." msgstr "" -#: whatsnew/3.3.rst:614 +#: whatsnew/3.3.rst:616 msgid "PEP 412: Key-Sharing Dictionary" msgstr "" -#: whatsnew/3.3.rst:616 +#: whatsnew/3.3.rst:618 msgid "" "Dictionaries used for the storage of objects' attributes are now able to " "share part of their internal storage between each other (namely, the part " @@ -751,19 +921,19 @@ msgid "" "consumption of programs creating many instances of non-builtin types." msgstr "" -#: whatsnew/3.3.rst:623 +#: whatsnew/3.3.rst:625 msgid ":pep:`412` - Key-Sharing Dictionary" msgstr "" -#: whatsnew/3.3.rst:624 +#: whatsnew/3.3.rst:626 msgid "PEP written and implemented by Mark Shannon." msgstr "" -#: whatsnew/3.3.rst:628 +#: whatsnew/3.3.rst:630 msgid "PEP 362: Function Signature Object" msgstr "" -#: whatsnew/3.3.rst:630 +#: whatsnew/3.3.rst:632 msgid "" "A new function :func:`inspect.signature` makes introspection of python " "callables easy and straightforward. A broad range of callables is " @@ -775,21 +945,21 @@ msgid "" "code that validates or amends calling signatures or arguments." msgstr "" -#: whatsnew/3.3.rst:642 +#: whatsnew/3.3.rst:643 msgid ":pep:`362`: - Function Signature Object" msgstr "" -#: whatsnew/3.3.rst:642 +#: whatsnew/3.3.rst:644 msgid "" "PEP written by Brett Cannon, Yury Selivanov, Larry Hastings, Jiwon Seo; " "implemented by Yury Selivanov." msgstr "" -#: whatsnew/3.3.rst:647 +#: whatsnew/3.3.rst:649 msgid "PEP 421: Adding sys.implementation" msgstr "" -#: whatsnew/3.3.rst:649 +#: whatsnew/3.3.rst:651 msgid "" "A new attribute on the :mod:`sys` module exposes details specific to the " "implementation of the currently running interpreter. The initial set of " @@ -797,7 +967,7 @@ msgid "" "``hexversion``, and ``cache_tag``." msgstr "" -#: whatsnew/3.3.rst:654 +#: whatsnew/3.3.rst:656 msgid "" "The intention of ``sys.implementation`` is to consolidate into one namespace " "the implementation-specific data used by the standard library. This allows " @@ -807,7 +977,7 @@ msgid "" "ratio will shift in order to make the standard library more portable." msgstr "" -#: whatsnew/3.3.rst:661 +#: whatsnew/3.3.rst:663 msgid "" "One example of improved standard library portability is ``cache_tag``. As " "of Python 3.3, ``sys.implementation.cache_tag`` is used by :mod:`importlib` " @@ -816,11 +986,11 @@ msgid "" "control the caching behavior for modules." msgstr "" -#: whatsnew/3.3.rst:668 +#: whatsnew/3.3.rst:670 msgid "SimpleNamespace" msgstr "" -#: whatsnew/3.3.rst:670 +#: whatsnew/3.3.rst:672 msgid "" "The implementation of ``sys.implementation`` also introduces a new type to " "Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based " @@ -830,19 +1000,19 @@ msgid "" "through normal attribute access." msgstr "" -#: whatsnew/3.3.rst:679 +#: whatsnew/3.3.rst:681 msgid ":pep:`421` - Adding sys.implementation" msgstr "" -#: whatsnew/3.3.rst:680 +#: whatsnew/3.3.rst:682 msgid "PEP written and implemented by Eric Snow." msgstr "" -#: whatsnew/3.3.rst:686 +#: whatsnew/3.3.rst:688 msgid "Using importlib as the Implementation of Import" msgstr "" -#: whatsnew/3.3.rst:687 +#: whatsnew/3.3.rst:689 msgid "" ":issue:`2377` - Replace __import__ w/ importlib.__import__ :issue:`13959` - " "Re-implement parts of :mod:`!imp` in pure Python :issue:`14605` - Make " @@ -850,7 +1020,7 @@ msgid "" "and __package__" msgstr "" -#: whatsnew/3.3.rst:692 +#: whatsnew/3.3.rst:694 msgid "" "The :func:`__import__` function is now powered by :func:`importlib." "__import__`. This work leads to the completion of \"phase 2\" of :pep:`302`. " @@ -862,7 +1032,7 @@ msgid "" "import, allowing for future growth to occur." msgstr "" -#: whatsnew/3.3.rst:701 +#: whatsnew/3.3.rst:703 msgid "" "For the common user, there should be no visible change in semantics. For " "those whose code currently manipulates import or calls import " @@ -870,18 +1040,18 @@ msgid "" "covered in the `Porting Python code`_ section of this document." msgstr "" -#: whatsnew/3.3.rst:707 +#: whatsnew/3.3.rst:709 msgid "New APIs" msgstr "" -#: whatsnew/3.3.rst:708 +#: whatsnew/3.3.rst:710 msgid "" "One of the large benefits of this work is the exposure of what goes into " "making the import statement work. That means the various importers that were " "once implicit are now fully exposed as part of the :mod:`importlib` package." msgstr "" -#: whatsnew/3.3.rst:712 +#: whatsnew/3.3.rst:714 msgid "" "The abstract base classes defined in :mod:`importlib.abc` have been expanded " "to properly delineate between :term:`meta path finders ` " @@ -892,14 +1062,14 @@ msgid "" "requirements." msgstr "" -#: whatsnew/3.3.rst:720 +#: whatsnew/3.3.rst:722 msgid "" "In terms of finders, :class:`importlib.machinery.FileFinder` exposes the " "mechanism used to search for source and bytecode files of a module. " "Previously this class was an implicit member of :data:`sys.path_hooks`." msgstr "" -#: whatsnew/3.3.rst:724 +#: whatsnew/3.3.rst:726 msgid "" "For loaders, the new abstract base class :class:`importlib.abc.FileLoader` " "helps write a loader that uses the file system as the storage mechanism for " @@ -909,7 +1079,7 @@ msgid "" "ExtensionFileLoader`) are now available for direct use." msgstr "" -#: whatsnew/3.3.rst:732 +#: whatsnew/3.3.rst:734 msgid "" ":exc:`ImportError` now has ``name`` and ``path`` attributes which are set " "when there is relevant data to provide. The message for failed imports will " @@ -917,24 +1087,24 @@ msgid "" "the module's name." msgstr "" -#: whatsnew/3.3.rst:737 +#: whatsnew/3.3.rst:739 msgid "" "The :func:`importlib.invalidate_caches` function will now call the method " "with the same name on all finders cached in :data:`sys.path_importer_cache` " "to help clean up any stored state as necessary." msgstr "" -#: whatsnew/3.3.rst:742 +#: whatsnew/3.3.rst:744 msgid "Visible Changes" msgstr "" -#: whatsnew/3.3.rst:744 +#: whatsnew/3.3.rst:746 msgid "" "For potential required changes to code, see the `Porting Python code`_ " "section." msgstr "" -#: whatsnew/3.3.rst:747 +#: whatsnew/3.3.rst:749 msgid "" "Beyond the expanse of what :mod:`importlib` now exposes, there are other " "visible changes to import. The biggest is that :data:`sys.meta_path` and :" @@ -945,7 +1115,7 @@ msgid "" "fit one's needs." msgstr "" -#: whatsnew/3.3.rst:754 +#: whatsnew/3.3.rst:756 msgid "" "Another change is that all modules have a ``__loader__`` attribute, storing " "the loader used to create the module. :pep:`302` has been updated to make " @@ -955,14 +1125,14 @@ msgid "" "load." msgstr "" -#: whatsnew/3.3.rst:760 +#: whatsnew/3.3.rst:762 msgid "" "Loaders are also now expected to set the ``__package__`` attribute from :pep:" "`366`. Once again, import itself is already setting this on all loaders " "from :mod:`importlib` and import itself is setting the attribute post-load." msgstr "" -#: whatsnew/3.3.rst:764 +#: whatsnew/3.3.rst:766 msgid "" "``None`` is now inserted into :data:`sys.path_importer_cache` when no finder " "can be found on :data:`sys.path_hooks`. Since :class:`!imp.NullImporter` is " @@ -970,107 +1140,107 @@ msgid "" "upon to always be available to use as a value representing no finder found." msgstr "" -#: whatsnew/3.3.rst:769 +#: whatsnew/3.3.rst:771 msgid "" "All other changes relate to semantic changes which should be taken into " "consideration when updating code for Python 3.3, and thus should be read " "about in the `Porting Python code`_ section of this document." msgstr "" -#: whatsnew/3.3.rst:773 +#: whatsnew/3.3.rst:775 msgid "(Implementation by Brett Cannon)" msgstr "" -#: whatsnew/3.3.rst:777 +#: whatsnew/3.3.rst:779 msgid "Other Language Changes" msgstr "" -#: whatsnew/3.3.rst:779 +#: whatsnew/3.3.rst:781 msgid "Some smaller changes made to the core Python language are:" msgstr "" -#: whatsnew/3.3.rst:781 +#: whatsnew/3.3.rst:783 msgid "" "Added support for Unicode name aliases and named sequences. Both :func:" -"`unicodedata.lookup()` and ``'\\N{...}'`` now resolve name aliases, and :" -"func:`unicodedata.lookup()` resolves named sequences too." +"`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, and :func:" +"`unicodedata.lookup` resolves named sequences too." msgstr "" -#: whatsnew/3.3.rst:785 +#: whatsnew/3.3.rst:787 msgid "(Contributed by Ezio Melotti in :issue:`12753`.)" msgstr "" -#: whatsnew/3.3.rst:787 +#: whatsnew/3.3.rst:789 msgid "Unicode database updated to UCD version 6.1.0" msgstr "" -#: whatsnew/3.3.rst:789 +#: whatsnew/3.3.rst:791 msgid "" "Equality comparisons on :func:`range` objects now return a result reflecting " "the equality of the underlying sequences generated by those range objects. (:" "issue:`13201`)" msgstr "" -#: whatsnew/3.3.rst:793 +#: whatsnew/3.3.rst:795 msgid "" "The ``count()``, ``find()``, ``rfind()``, ``index()`` and ``rindex()`` " "methods of :class:`bytes` and :class:`bytearray` objects now accept an " "integer between 0 and 255 as their first argument." msgstr "" -#: whatsnew/3.3.rst:797 +#: whatsnew/3.3.rst:799 msgid "(Contributed by Petri Lehtinen in :issue:`12170`.)" msgstr "" -#: whatsnew/3.3.rst:799 +#: whatsnew/3.3.rst:801 msgid "" "The ``rjust()``, ``ljust()``, and ``center()`` methods of :class:`bytes` " "and :class:`bytearray` now accept a :class:`bytearray` for the ``fill`` " "argument. (Contributed by Petri Lehtinen in :issue:`12380`.)" msgstr "" -#: whatsnew/3.3.rst:803 +#: whatsnew/3.3.rst:805 msgid "" "New methods have been added to :class:`list` and :class:`bytearray`: " "``copy()`` and ``clear()`` (:issue:`10516`). Consequently, :class:" -"`~collections.abc.MutableSequence` now also defines a :meth:`~collections." -"abc.MutableSequence.clear` method (:issue:`11388`)." +"`~collections.abc.MutableSequence` now also defines a :meth:`!clear` method " +"(:issue:`11388`)." msgstr "" -#: whatsnew/3.3.rst:808 +#: whatsnew/3.3.rst:810 msgid "" "Raw bytes literals can now be written ``rb\"...\"`` as well as ``br\"...\"``." msgstr "" -#: whatsnew/3.3.rst:810 +#: whatsnew/3.3.rst:812 msgid "(Contributed by Antoine Pitrou in :issue:`13748`.)" msgstr "" -#: whatsnew/3.3.rst:812 +#: whatsnew/3.3.rst:814 msgid "" ":meth:`dict.setdefault` now does only one lookup for the given key, making " "it atomic when used with built-in types." msgstr "" -#: whatsnew/3.3.rst:815 +#: whatsnew/3.3.rst:817 msgid "(Contributed by Filip Gruszczyński in :issue:`13521`.)" msgstr "" -#: whatsnew/3.3.rst:817 +#: whatsnew/3.3.rst:819 msgid "" "The error messages produced when a function call does not match the function " "signature have been significantly improved." msgstr "" -#: whatsnew/3.3.rst:820 +#: whatsnew/3.3.rst:822 msgid "(Contributed by Benjamin Peterson.)" msgstr "" -#: whatsnew/3.3.rst:824 +#: whatsnew/3.3.rst:826 msgid "A Finer-Grained Import Lock" msgstr "" -#: whatsnew/3.3.rst:826 +#: whatsnew/3.3.rst:828 msgid "" "Previous versions of CPython have always relied on a global import lock. " "This led to unexpected annoyances, such as deadlocks when importing a module " @@ -1079,7 +1249,7 @@ msgid "" "`PyImport_ImportModuleNoBlock` C API function." msgstr "" -#: whatsnew/3.3.rst:832 +#: whatsnew/3.3.rst:834 msgid "" "In Python 3.3, importing a module takes a per-module lock. This correctly " "serializes importation of a given module from multiple threads (preventing " @@ -1087,15 +1257,15 @@ msgid "" "aforementioned annoyances." msgstr "" -#: whatsnew/3.3.rst:837 +#: whatsnew/3.3.rst:839 msgid "(Contributed by Antoine Pitrou in :issue:`9260`.)" msgstr "" -#: whatsnew/3.3.rst:841 +#: whatsnew/3.3.rst:843 msgid "Builtin functions and types" msgstr "" -#: whatsnew/3.3.rst:843 +#: whatsnew/3.3.rst:845 msgid "" ":func:`open` gets a new *opener* parameter: the underlying file descriptor " "for the file object is then obtained by calling *opener* with (*file*, " @@ -1104,26 +1274,26 @@ msgid "" "the file already exists." msgstr "" -#: whatsnew/3.3.rst:848 +#: whatsnew/3.3.rst:850 msgid "" ":func:`print`: added the *flush* keyword argument. If the *flush* keyword " "argument is true, the stream is forcibly flushed." msgstr "" -#: whatsnew/3.3.rst:850 +#: whatsnew/3.3.rst:852 msgid "" ":func:`hash`: hash randomization is enabled by default, see :meth:`object." "__hash__` and :envvar:`PYTHONHASHSEED`." msgstr "" -#: whatsnew/3.3.rst:852 +#: whatsnew/3.3.rst:854 msgid "" "The :class:`str` type gets a new :meth:`~str.casefold` method: return a " "casefolded copy of the string, casefolded strings may be used for caseless " "matching. For example, ``'ß'.casefold()`` returns ``'ss'``." msgstr "" -#: whatsnew/3.3.rst:855 +#: whatsnew/3.3.rst:857 msgid "" "The sequence documentation has been substantially rewritten to better " "explain the binary/text sequence distinction and to provide specific " @@ -1131,122 +1301,137 @@ msgid "" "`4966`)." msgstr "" -#: whatsnew/3.3.rst:862 +#: whatsnew/3.3.rst:864 msgid "New Modules" msgstr "" -#: whatsnew/3.3.rst:865 +#: whatsnew/3.3.rst:867 msgid "faulthandler" msgstr "" -#: whatsnew/3.3.rst:867 +#: whatsnew/3.3.rst:869 msgid "" "This new debug module :mod:`faulthandler` contains functions to dump Python " "tracebacks explicitly, on a fault (a crash like a segmentation fault), after " "a timeout, or on a user signal. Call :func:`faulthandler.enable` to install " -"fault handlers for the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :" -"const:`SIGBUS`, and :const:`SIGILL` signals. You can also enable them at " -"startup by setting the :envvar:`PYTHONFAULTHANDLER` environment variable or " -"by using :option:`-X` ``faulthandler`` command line option." +"fault handlers for the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :" +"const:`~signal.SIGABRT`, :const:`~signal.SIGBUS`, and :const:`~signal." +"SIGILL` signals. You can also enable them at startup by setting the :envvar:" +"`PYTHONFAULTHANDLER` environment variable or by using :option:`-X` " +"``faulthandler`` command line option." msgstr "" -#: whatsnew/3.3.rst:875 +#: whatsnew/3.3.rst:877 msgid "Example of a segmentation fault on Linux:" msgstr "" -#: whatsnew/3.3.rst:891 -msgid "ipaddress" +#: whatsnew/3.3.rst:879 +msgid "" +"$ python -q -X faulthandler\n" +">>> import ctypes\n" +">>> ctypes.string_at(0)\n" +"Fatal Python error: Segmentation fault\n" +"\n" +"Current thread 0x00007fb899f39700:\n" +" File \"/home/python/cpython/Lib/ctypes/__init__.py\", line 486 in " +"string_at\n" +" File \"\", line 1 in \n" +"Segmentation fault" msgstr "" #: whatsnew/3.3.rst:893 +msgid "ipaddress" +msgstr "" + +#: whatsnew/3.3.rst:895 msgid "" "The new :mod:`ipaddress` module provides tools for creating and manipulating " "objects representing IPv4 and IPv6 addresses, networks and interfaces (i.e. " "an IP address associated with a specific IP subnet)." msgstr "" -#: whatsnew/3.3.rst:897 +#: whatsnew/3.3.rst:899 msgid "(Contributed by Google and Peter Moody in :pep:`3144`.)" msgstr "" -#: whatsnew/3.3.rst:900 +#: whatsnew/3.3.rst:902 msgid "lzma" msgstr "" -#: whatsnew/3.3.rst:902 +#: whatsnew/3.3.rst:904 msgid "" "The newly added :mod:`lzma` module provides data compression and " "decompression using the LZMA algorithm, including support for the ``.xz`` " "and ``.lzma`` file formats." msgstr "" -#: whatsnew/3.3.rst:906 +#: whatsnew/3.3.rst:908 msgid "(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`.)" msgstr "" -#: whatsnew/3.3.rst:910 +#: whatsnew/3.3.rst:912 msgid "Improved Modules" msgstr "" -#: whatsnew/3.3.rst:913 +#: whatsnew/3.3.rst:915 msgid "abc" msgstr "" -#: whatsnew/3.3.rst:915 +#: whatsnew/3.3.rst:917 msgid "" "Improved support for abstract base classes containing descriptors composed " "with abstract methods. The recommended approach to declaring abstract " -"descriptors is now to provide :attr:`__isabstractmethod__` as a dynamically " +"descriptors is now to provide :attr:`!__isabstractmethod__` as a dynamically " "updated property. The built-in descriptors have been updated accordingly." msgstr "" -#: whatsnew/3.3.rst:2246 +#: whatsnew/3.3.rst:2247 msgid "" ":class:`abc.abstractproperty` has been deprecated, use :class:`property` " "with :func:`abc.abstractmethod` instead." msgstr "" -#: whatsnew/3.3.rst:2248 +#: whatsnew/3.3.rst:2249 msgid "" ":class:`abc.abstractclassmethod` has been deprecated, use :class:" "`classmethod` with :func:`abc.abstractmethod` instead." msgstr "" -#: whatsnew/3.3.rst:2250 +#: whatsnew/3.3.rst:2251 msgid "" ":class:`abc.abstractstaticmethod` has been deprecated, use :class:" "`staticmethod` with :func:`abc.abstractmethod` instead." msgstr "" -#: whatsnew/3.3.rst:927 +#: whatsnew/3.3.rst:929 msgid "(Contributed by Darren Dale in :issue:`11610`.)" msgstr "" -#: whatsnew/3.3.rst:929 +#: whatsnew/3.3.rst:931 msgid "" ":meth:`abc.ABCMeta.register` now returns the registered subclass, which " "means it can now be used as a class decorator (:issue:`10868`)." msgstr "" -#: whatsnew/3.3.rst:934 +#: whatsnew/3.3.rst:936 msgid "array" msgstr "" -#: whatsnew/3.3.rst:936 +#: whatsnew/3.3.rst:938 msgid "" "The :mod:`array` module supports the :c:expr:`long long` type using ``q`` " "and ``Q`` type codes." msgstr "" -#: whatsnew/3.3.rst:939 +#: whatsnew/3.3.rst:941 msgid "(Contributed by Oren Tirosh and Hirokazu Yamamoto in :issue:`1172711`.)" msgstr "" -#: whatsnew/3.3.rst:943 +#: whatsnew/3.3.rst:945 msgid "base64" msgstr "" -#: whatsnew/3.3.rst:945 +#: whatsnew/3.3.rst:947 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of " "the :mod:`base64` modern interface. For example, ``base64." @@ -1254,44 +1439,44 @@ msgid "" "issue:`13641`.)" msgstr "" -#: whatsnew/3.3.rst:951 +#: whatsnew/3.3.rst:953 msgid "binascii" msgstr "" -#: whatsnew/3.3.rst:953 +#: whatsnew/3.3.rst:955 msgid "" "In addition to the binary objects they normally accept, the ``a2b_`` " "functions now all also accept ASCII-only strings as input. (Contributed by " "Antoine Pitrou in :issue:`13637`.)" msgstr "" -#: whatsnew/3.3.rst:959 +#: whatsnew/3.3.rst:961 msgid "bz2" msgstr "" -#: whatsnew/3.3.rst:961 +#: whatsnew/3.3.rst:963 msgid "" "The :mod:`bz2` module has been rewritten from scratch. In the process, " "several new features have been added:" msgstr "" -#: whatsnew/3.3.rst:964 +#: whatsnew/3.3.rst:966 msgid "" "New :func:`bz2.open` function: open a bzip2-compressed file in binary or " "text mode." msgstr "" -#: whatsnew/3.3.rst:967 +#: whatsnew/3.3.rst:969 msgid "" ":class:`bz2.BZ2File` can now read from and write to arbitrary file-like " "objects, by means of its constructor's *fileobj* argument." msgstr "" -#: whatsnew/3.3.rst:970 +#: whatsnew/3.3.rst:972 msgid "(Contributed by Nadeem Vawda in :issue:`5863`.)" msgstr "" -#: whatsnew/3.3.rst:972 +#: whatsnew/3.3.rst:974 msgid "" ":class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress multi-" "stream inputs (such as those produced by the :program:`pbzip2` tool). :class:" @@ -1299,21 +1484,21 @@ msgid "" "``'a'`` (append) mode." msgstr "" -#: whatsnew/3.3.rst:977 +#: whatsnew/3.3.rst:979 msgid "(Contributed by Nir Aides in :issue:`1625`.)" msgstr "" -#: whatsnew/3.3.rst:979 +#: whatsnew/3.3.rst:981 msgid "" ":class:`bz2.BZ2File` now implements all of the :class:`io.BufferedIOBase` " -"API, except for the :meth:`detach` and :meth:`truncate` methods." +"API, except for the :meth:`!detach` and :meth:`!truncate` methods." msgstr "" -#: whatsnew/3.3.rst:984 +#: whatsnew/3.3.rst:986 msgid "codecs" msgstr "" -#: whatsnew/3.3.rst:986 +#: whatsnew/3.3.rst:988 msgid "" "The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly " "``replace`` and ``ignore`` error handlers on all Windows versions. The :mod:" @@ -1321,7 +1506,7 @@ msgid "" "``replace`` to encode and ``ignore`` to decode." msgstr "" -#: whatsnew/3.3.rst:991 +#: whatsnew/3.3.rst:993 msgid "" "A new Windows-only codec has been added: ``cp65001`` (:issue:`13216`). It is " "the Windows code page 65001 (Windows UTF-8, ``CP_UTF8``). For example, it " @@ -1329,7 +1514,7 @@ msgid "" "(e.g., using ``chcp 65001`` command)." msgstr "" -#: whatsnew/3.3.rst:996 +#: whatsnew/3.3.rst:998 msgid "" "Multibyte CJK decoders now resynchronize faster. They only ignore the first " "byte of an invalid byte sequence. For example, ``b'\\xff\\n'." @@ -1337,42 +1522,51 @@ msgid "" "character." msgstr "" -#: whatsnew/3.3.rst:1000 +#: whatsnew/3.3.rst:1002 msgid "(:issue:`12016`)" msgstr "" -#: whatsnew/3.3.rst:1002 +#: whatsnew/3.3.rst:1004 msgid "" "Incremental CJK codec encoders are no longer reset at each call to their " "encode() methods. For example::" msgstr "" -#: whatsnew/3.3.rst:1010 +#: whatsnew/3.3.rst:1007 +msgid "" +">>> import codecs\n" +">>> encoder = codecs.getincrementalencoder('hz')('strict')\n" +">>> b''.join(encoder.encode(x) for x in '\\u52ff\\u65bd\\u65bc\\u4eba\\u3002 " +"Bye.')\n" +"b'~{NpJ)l6HK!#~} Bye.'" +msgstr "" + +#: whatsnew/3.3.rst:1012 msgid "" "This example gives ``b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'`` with older " "Python versions." msgstr "" -#: whatsnew/3.3.rst:1013 +#: whatsnew/3.3.rst:1015 msgid "(:issue:`12100`)" msgstr "" -#: whatsnew/3.3.rst:1015 +#: whatsnew/3.3.rst:1017 msgid "The ``unicode_internal`` codec has been deprecated." msgstr "" -#: whatsnew/3.3.rst:1019 +#: whatsnew/3.3.rst:1021 msgid "collections" msgstr "" -#: whatsnew/3.3.rst:1021 +#: whatsnew/3.3.rst:1023 msgid "" "Addition of a new :class:`~collections.ChainMap` class to allow treating a " "number of mappings as a single unit. (Written by Raymond Hettinger for :" "issue:`11089`, made public in :issue:`11297`.)" msgstr "" -#: whatsnew/3.3.rst:1025 +#: whatsnew/3.3.rst:1027 msgid "" "The abstract base classes have been moved in a new :mod:`collections.abc` " "module, to better differentiate between the abstract and the concrete " @@ -1380,18 +1574,18 @@ msgid "" "`collections` module to preserve existing imports. (:issue:`11085`)" msgstr "" -#: whatsnew/3.3.rst:1032 +#: whatsnew/3.3.rst:1034 msgid "" "The :class:`~collections.Counter` class now supports the unary ``+`` and ``-" "`` operators, as well as the in-place operators ``+=``, ``-=``, ``|=``, and " "``&=``. (Contributed by Raymond Hettinger in :issue:`13121`.)" msgstr "" -#: whatsnew/3.3.rst:1038 +#: whatsnew/3.3.rst:1040 msgid "contextlib" msgstr "" -#: whatsnew/3.3.rst:1040 +#: whatsnew/3.3.rst:1042 msgid "" ":class:`~contextlib.ExitStack` now provides a solid foundation for " "programmatic manipulation of context managers and similar cleanup " @@ -1403,249 +1597,249 @@ msgid "" "module)." msgstr "" -#: whatsnew/3.3.rst:1049 +#: whatsnew/3.3.rst:1051 msgid "(:issue:`13585`)" msgstr "" -#: whatsnew/3.3.rst:1053 +#: whatsnew/3.3.rst:1055 msgid "crypt" msgstr "" -#: whatsnew/3.3.rst:1055 +#: whatsnew/3.3.rst:1057 msgid "" -"Addition of salt and modular crypt format (hashing method) and the :func:" -"`~crypt.mksalt` function to the :mod:`crypt` module." +"Addition of salt and modular crypt format (hashing method) and the :func:`!" +"mksalt` function to the :mod:`!crypt` module." msgstr "" -#: whatsnew/3.3.rst:1058 +#: whatsnew/3.3.rst:1060 msgid "(:issue:`10924`)" msgstr "" -#: whatsnew/3.3.rst:1061 +#: whatsnew/3.3.rst:1063 msgid "curses" msgstr "" -#: whatsnew/3.3.rst:1063 +#: whatsnew/3.3.rst:1065 msgid "" "If the :mod:`curses` module is linked to the ncursesw library, use Unicode " -"functions when Unicode strings or characters are passed (e.g. :c:func:" -"`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`)." +"functions when Unicode strings or characters are passed (e.g. :c:func:`!" +"waddwstr`), and bytes functions otherwise (e.g. :c:func:`!waddstr`)." msgstr "" -#: whatsnew/3.3.rst:1066 +#: whatsnew/3.3.rst:1068 msgid "Use the locale encoding instead of ``utf-8`` to encode Unicode strings." msgstr "" -#: whatsnew/3.3.rst:1067 +#: whatsnew/3.3.rst:1069 msgid "" ":class:`curses.window` has a new :attr:`curses.window.encoding` attribute." msgstr "" -#: whatsnew/3.3.rst:1068 +#: whatsnew/3.3.rst:1070 msgid "" "The :class:`curses.window` class has a new :meth:`~curses.window.get_wch` " "method to get a wide character" msgstr "" -#: whatsnew/3.3.rst:1070 +#: whatsnew/3.3.rst:1072 msgid "" "The :mod:`curses` module has a new :meth:`~curses.unget_wch` function to " "push a wide character so the next :meth:`~curses.window.get_wch` will return " "it" msgstr "" -#: whatsnew/3.3.rst:1074 +#: whatsnew/3.3.rst:1076 msgid "(Contributed by Iñigo Serna in :issue:`6755`.)" msgstr "" -#: whatsnew/3.3.rst:1077 +#: whatsnew/3.3.rst:1079 msgid "datetime" msgstr "" -#: whatsnew/3.3.rst:1079 +#: whatsnew/3.3.rst:1081 msgid "" "Equality comparisons between naive and aware :class:`~datetime.datetime` " "instances now return :const:`False` instead of raising :exc:`TypeError` (:" "issue:`15006`)." msgstr "" -#: whatsnew/3.3.rst:1082 +#: whatsnew/3.3.rst:1084 msgid "" "New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp " "corresponding to the :class:`~datetime.datetime` instance." msgstr "" -#: whatsnew/3.3.rst:1084 +#: whatsnew/3.3.rst:1086 msgid "" "The :meth:`datetime.datetime.strftime` method supports formatting years " "older than 1000." msgstr "" -#: whatsnew/3.3.rst:1086 +#: whatsnew/3.3.rst:1088 msgid "" "The :meth:`datetime.datetime.astimezone` method can now be called without " "arguments to convert datetime instance to the system timezone." msgstr "" -#: whatsnew/3.3.rst:1094 +#: whatsnew/3.3.rst:1096 msgid "decimal" msgstr "" -#: whatsnew/3.3.rst:1097 +#: whatsnew/3.3.rst:1098 msgid ":issue:`7652` - integrate fast native decimal arithmetic." msgstr "" -#: whatsnew/3.3.rst:1097 +#: whatsnew/3.3.rst:1099 msgid "C-module and libmpdec written by Stefan Krah." msgstr "" -#: whatsnew/3.3.rst:1099 +#: whatsnew/3.3.rst:1101 msgid "" "The new C version of the decimal module integrates the high speed libmpdec " -"library for arbitrary precision correctly rounded decimal floating point " +"library for arbitrary precision correctly rounded decimal floating-point " "arithmetic. libmpdec conforms to IBM's General Decimal Arithmetic " "Specification." msgstr "" -#: whatsnew/3.3.rst:1103 +#: whatsnew/3.3.rst:1105 msgid "" "Performance gains range from 10x for database applications to 100x for " "numerically intensive applications. These numbers are expected gains for " -"standard precisions used in decimal floating point arithmetic. Since the " +"standard precisions used in decimal floating-point arithmetic. Since the " "precision is user configurable, the exact figures may vary. For example, in " "integer bignum arithmetic the differences can be significantly higher." msgstr "" -#: whatsnew/3.3.rst:1109 +#: whatsnew/3.3.rst:1111 msgid "" "The following table is meant as an illustration. Benchmarks are available at " "https://www.bytereef.org/mpdecimal/quickstart.html." msgstr "" -#: whatsnew/3.3.rst:1113 +#: whatsnew/3.3.rst:1115 msgid "decimal.py" msgstr "" -#: whatsnew/3.3.rst:1113 +#: whatsnew/3.3.rst:1115 msgid "_decimal" msgstr "" -#: whatsnew/3.3.rst:1113 +#: whatsnew/3.3.rst:1115 msgid "speedup" msgstr "" -#: whatsnew/3.3.rst:1115 +#: whatsnew/3.3.rst:1117 msgid "pi" msgstr "" -#: whatsnew/3.3.rst:1115 +#: whatsnew/3.3.rst:1117 msgid "42.02s" msgstr "" -#: whatsnew/3.3.rst:1115 +#: whatsnew/3.3.rst:1117 msgid "0.345s" msgstr "" -#: whatsnew/3.3.rst:1115 +#: whatsnew/3.3.rst:1117 msgid "120x" msgstr "" -#: whatsnew/3.3.rst:1117 +#: whatsnew/3.3.rst:1119 msgid "telco" msgstr "" -#: whatsnew/3.3.rst:1117 +#: whatsnew/3.3.rst:1119 msgid "172.19s" msgstr "" -#: whatsnew/3.3.rst:1117 +#: whatsnew/3.3.rst:1119 msgid "5.68s" msgstr "" -#: whatsnew/3.3.rst:1117 +#: whatsnew/3.3.rst:1119 msgid "30x" msgstr "" -#: whatsnew/3.3.rst:1119 +#: whatsnew/3.3.rst:1121 msgid "psycopg" msgstr "" -#: whatsnew/3.3.rst:1119 +#: whatsnew/3.3.rst:1121 msgid "3.57s" msgstr "" -#: whatsnew/3.3.rst:1119 +#: whatsnew/3.3.rst:1121 msgid "0.29s" msgstr "" -#: whatsnew/3.3.rst:1119 +#: whatsnew/3.3.rst:1121 msgid "12x" msgstr "" -#: whatsnew/3.3.rst:1125 +#: whatsnew/3.3.rst:1127 msgid "" "The :exc:`~decimal.FloatOperation` signal optionally enables stricter " "semantics for mixing floats and Decimals." msgstr "" -#: whatsnew/3.3.rst:1128 +#: whatsnew/3.3.rst:1130 msgid "" "If Python is compiled without threads, the C version automatically disables " "the expensive thread local context machinery. In this case, the variable :" "const:`~decimal.HAVE_THREADS` is set to ``False``." msgstr "" -#: whatsnew/3.3.rst:1135 +#: whatsnew/3.3.rst:1137 msgid "" "The C module has the following context limits, depending on the machine " "architecture:" msgstr "" -#: whatsnew/3.3.rst:1139 +#: whatsnew/3.3.rst:1141 msgid "32-bit" msgstr "" -#: whatsnew/3.3.rst:1139 +#: whatsnew/3.3.rst:1141 msgid "64-bit" msgstr "" -#: whatsnew/3.3.rst:1141 -msgid ":const:`MAX_PREC`" +#: whatsnew/3.3.rst:1143 +msgid ":const:`~decimal.MAX_PREC`" msgstr "" -#: whatsnew/3.3.rst:1143 +#: whatsnew/3.3.rst:1145 msgid "``425000000``" msgstr "" -#: whatsnew/3.3.rst:1143 +#: whatsnew/3.3.rst:1145 msgid "``999999999999999999``" msgstr "" -#: whatsnew/3.3.rst:1143 -msgid ":const:`MAX_EMAX`" +#: whatsnew/3.3.rst:1145 +msgid ":const:`~decimal.MAX_EMAX`" msgstr "" -#: whatsnew/3.3.rst:1145 -msgid ":const:`MIN_EMIN`" +#: whatsnew/3.3.rst:1147 +msgid ":const:`~decimal.MIN_EMIN`" msgstr "" -#: whatsnew/3.3.rst:1145 +#: whatsnew/3.3.rst:1147 msgid "``-425000000``" msgstr "" -#: whatsnew/3.3.rst:1145 +#: whatsnew/3.3.rst:1147 msgid "``-999999999999999999``" msgstr "" -#: whatsnew/3.3.rst:1148 +#: whatsnew/3.3.rst:1150 msgid "" -"In the context templates (:class:`~decimal.DefaultContext`, :class:`~decimal." -"BasicContext` and :class:`~decimal.ExtendedContext`) the magnitude of :attr:" +"In the context templates (:const:`~decimal.DefaultContext`, :const:`~decimal." +"BasicContext` and :const:`~decimal.ExtendedContext`) the magnitude of :attr:" "`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has changed to " "``999999``." msgstr "" -#: whatsnew/3.3.rst:1153 +#: whatsnew/3.3.rst:1155 msgid "" "The :class:`~decimal.Decimal` constructor in decimal.py does not observe the " "context limits and converts values with arbitrary exponents or precision " @@ -1656,7 +1850,7 @@ msgid "" "obtain a rounded or inexact value." msgstr "" -#: whatsnew/3.3.rst:1162 +#: whatsnew/3.3.rst:1164 msgid "" "The power function in decimal.py is always correctly rounded. In the C " "version, it is defined in terms of the correctly rounded :meth:`~decimal." @@ -1664,7 +1858,7 @@ msgid "" "is only \"almost always correctly rounded\"." msgstr "" -#: whatsnew/3.3.rst:1168 +#: whatsnew/3.3.rst:1170 msgid "" "In the C version, the context dictionary containing the signals is a :class:" "`~collections.abc.MutableMapping`. For speed reasons, :attr:`~decimal." @@ -1675,33 +1869,33 @@ msgid "" "do not reference the RHS dictionary." msgstr "" -#: whatsnew/3.3.rst:1178 +#: whatsnew/3.3.rst:1180 msgid "" "Pickling a :class:`~decimal.Context` produces a different output in order to " "have a common interchange format for the Python and C versions." msgstr "" -#: whatsnew/3.3.rst:1182 +#: whatsnew/3.3.rst:1184 msgid "" "The order of arguments in the :class:`~decimal.Context` constructor has been " "changed to match the order displayed by :func:`repr`." msgstr "" -#: whatsnew/3.3.rst:1186 +#: whatsnew/3.3.rst:1188 msgid "" "The ``watchexp`` parameter in the :meth:`~decimal.Decimal.quantize` method " "is deprecated." msgstr "" -#: whatsnew/3.3.rst:1193 +#: whatsnew/3.3.rst:1195 msgid "email" msgstr "" -#: whatsnew/3.3.rst:1196 +#: whatsnew/3.3.rst:1198 msgid "Policy Framework" msgstr "" -#: whatsnew/3.3.rst:1198 +#: whatsnew/3.3.rst:1200 msgid "" "The email package now has a :mod:`~email.policy` framework. A :class:" "`~email.policy.Policy` is an object with several methods and properties that " @@ -1717,52 +1911,52 @@ msgid "" "data:`~email.policy.compat32`." msgstr "" -#: whatsnew/3.3.rst:1211 +#: whatsnew/3.3.rst:1213 msgid "The minimum set of controls implemented by all ``policy`` objects are:" msgstr "" -#: whatsnew/3.3.rst:1216 +#: whatsnew/3.3.rst:1218 msgid "max_line_length" msgstr "" -#: whatsnew/3.3.rst:1216 +#: whatsnew/3.3.rst:1218 msgid "" "The maximum length, excluding the linesep character(s), individual lines may " "have when a ``Message`` is serialized. Defaults to 78." msgstr "" -#: whatsnew/3.3.rst:1220 +#: whatsnew/3.3.rst:1222 msgid "linesep" msgstr "" -#: whatsnew/3.3.rst:1220 +#: whatsnew/3.3.rst:1222 msgid "" "The character used to separate individual lines when a ``Message`` is " "serialized. Defaults to ``\\n``." msgstr "" -#: whatsnew/3.3.rst:1223 +#: whatsnew/3.3.rst:1225 msgid "cte_type" msgstr "" -#: whatsnew/3.3.rst:1223 +#: whatsnew/3.3.rst:1225 msgid "" "``7bit`` or ``8bit``. ``8bit`` applies only to a ``Bytes`` ``generator``, " "and means that non-ASCII may be used where allowed by the protocol (or where " "it exists in the original input)." msgstr "" -#: whatsnew/3.3.rst:1228 +#: whatsnew/3.3.rst:1230 msgid "raise_on_defect" msgstr "" -#: whatsnew/3.3.rst:1228 +#: whatsnew/3.3.rst:1230 msgid "" "Causes a ``parser`` to raise error when defects are encountered instead of " "adding them to the ``Message`` object's ``defects`` list." msgstr "" -#: whatsnew/3.3.rst:1233 +#: whatsnew/3.3.rst:1235 msgid "" "A new policy instance, with new settings, is created using the :meth:`~email." "policy.Policy.clone` method of policy objects. ``clone`` takes any of the " @@ -1772,6 +1966,10 @@ msgid "" msgstr "" #: whatsnew/3.3.rst:1241 +msgid "mypolicy = compat32.clone(linesep='\\r\\n')" +msgstr "" + +#: whatsnew/3.3.rst:1243 msgid "" "Policies can be used to make the generation of messages in the format needed " "by your application simpler. Instead of having to remember to specify " @@ -1784,11 +1982,11 @@ msgid "" "when you create the ``generator``." msgstr "" -#: whatsnew/3.3.rst:1253 +#: whatsnew/3.3.rst:1255 msgid "Provisional Policy with New Header API" msgstr "" -#: whatsnew/3.3.rst:1255 +#: whatsnew/3.3.rst:1257 msgid "" "While the policy framework is worthwhile all by itself, the main motivation " "for introducing it is to allow the creation of new policies that implement " @@ -1800,17 +1998,17 @@ msgid "" "the core developers." msgstr "" -#: whatsnew/3.3.rst:1263 +#: whatsnew/3.3.rst:1265 msgid "" "The new policies are instances of :class:`~email.policy.EmailPolicy`, and " "add the following additional controls:" msgstr "" -#: whatsnew/3.3.rst:1269 +#: whatsnew/3.3.rst:1271 msgid "refold_source" msgstr "" -#: whatsnew/3.3.rst:1269 +#: whatsnew/3.3.rst:1271 msgid "" "Controls whether or not headers parsed by a :mod:`~email.parser` are " "refolded by the :mod:`~email.generator`. It can be ``none``, ``long``, or " @@ -1819,17 +2017,17 @@ msgid "" "get refolded, and ``all`` means that all lines get refolded." msgstr "" -#: whatsnew/3.3.rst:1278 +#: whatsnew/3.3.rst:1280 msgid "header_factory" msgstr "" -#: whatsnew/3.3.rst:1278 +#: whatsnew/3.3.rst:1280 msgid "" "A callable that take a ``name`` and ``value`` and produces a custom header " "object." msgstr "" -#: whatsnew/3.3.rst:1282 +#: whatsnew/3.3.rst:1284 msgid "" "The ``header_factory`` is the key to the new features provided by the new " "policies. When one of the new policies is used, any header retrieved from a " @@ -1841,7 +2039,30 @@ msgid "" "now do things like this::" msgstr "" -#: whatsnew/3.3.rst:1310 +#: whatsnew/3.3.rst:1293 +msgid "" +">>> m = Message(policy=SMTP)\n" +">>> m['To'] = 'Éric '\n" +">>> m['to']\n" +"'Éric '\n" +">>> m['to'].addresses\n" +"(Address(display_name='Éric', username='foo', domain='example.com'),)\n" +">>> m['to'].addresses[0].username\n" +"'foo'\n" +">>> m['to'].addresses[0].display_name\n" +"'Éric'\n" +">>> m['Date'] = email.utils.localtime()\n" +">>> m['Date'].datetime\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime." +"timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +">>> m['Date']\n" +"'Fri, 25 May 2012 21:44:27 -0400'\n" +">>> print(m)\n" +"To: =?utf-8?q?=C3=89ric?= \n" +"Date: Fri, 25 May 2012 21:44:27 -0400" +msgstr "" + +#: whatsnew/3.3.rst:1312 msgid "" "You will note that the unicode display name is automatically encoded as " "``utf-8`` when the message is serialized, but that when the header is " @@ -1850,22 +2071,55 @@ msgid "" "meth:`~email.header.make_header` functions." msgstr "" -#: whatsnew/3.3.rst:1316 +#: whatsnew/3.3.rst:1318 msgid "You can also create addresses from parts::" msgstr "" -#: whatsnew/3.3.rst:1326 +#: whatsnew/3.3.rst:1320 +msgid "" +">>> m['cc'] = [Group('pals', [Address('Bob', 'bob', 'example.com'),\n" +"... Address('Sally', 'sally', 'example.com')]),\n" +"... Address('Bonzo', addr_spec='bonz@laugh.com')]\n" +">>> print(m)\n" +"To: =?utf-8?q?=C3=89ric?= \n" +"Date: Fri, 25 May 2012 21:44:27 -0400\n" +"cc: pals: Bob , Sally ;, Bonzo " +"" +msgstr "" + +#: whatsnew/3.3.rst:1328 msgid "Decoding to unicode is done automatically::" msgstr "" -#: whatsnew/3.3.rst:1332 +#: whatsnew/3.3.rst:1330 +msgid "" +">>> m2 = message_from_string(str(m))\n" +">>> m2['to']\n" +"'Éric '" +msgstr "" + +#: whatsnew/3.3.rst:1334 msgid "" "When you parse a message, you can use the ``addresses`` and ``groups`` " "attributes of the header objects to access the groups and individual " "addresses::" msgstr "" -#: whatsnew/3.3.rst:1341 +#: whatsnew/3.3.rst:1338 +msgid "" +">>> m2['cc'].addresses\n" +"(Address(display_name='Bob', username='bob', domain='example.com'), " +"Address(display_name='Sally', username='sally', domain='example.com'), " +"Address(display_name='Bonzo', username='bonz', domain='laugh.com'))\n" +">>> m2['cc'].groups\n" +"(Group(display_name='pals', addresses=(Address(display_name='Bob', " +"username='bob', domain='example.com'), Address(display_name='Sally', " +"username='sally', domain='example.com')), Group(display_name=None, " +"addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." +"com'),))" +msgstr "" + +#: whatsnew/3.3.rst:1343 msgid "" "In summary, if you use one of the new policies, header manipulation works " "the way it ought to: your application works with unicode strings, and the " @@ -1873,35 +2127,35 @@ msgid "" "RFC standard Content Transfer Encodings." msgstr "" -#: whatsnew/3.3.rst:1347 +#: whatsnew/3.3.rst:1349 msgid "Other API Changes" msgstr "" -#: whatsnew/3.3.rst:1349 +#: whatsnew/3.3.rst:1351 msgid "" "New :class:`~email.parser.BytesHeaderParser`, added to the :mod:`~email." "parser` module to complement :class:`~email.parser.HeaderParser` and " "complete the Bytes API." msgstr "" -#: whatsnew/3.3.rst:1353 +#: whatsnew/3.3.rst:1355 msgid "New utility functions:" msgstr "" -#: whatsnew/3.3.rst:1355 +#: whatsnew/3.3.rst:1357 msgid "" ":func:`~email.utils.format_datetime`: given a :class:`~datetime.datetime`, " "produce a string formatted for use in an email header." msgstr "" -#: whatsnew/3.3.rst:1358 +#: whatsnew/3.3.rst:1360 msgid "" ":func:`~email.utils.parsedate_to_datetime`: given a date string from an " "email header, convert it into an aware :class:`~datetime.datetime`, or a " "naive :class:`~datetime.datetime` if the offset is ``-0000``." msgstr "" -#: whatsnew/3.3.rst:1362 +#: whatsnew/3.3.rst:1364 msgid "" ":func:`~email.utils.localtime`: With no argument, returns the current local " "time as an aware :class:`~datetime.datetime` using the local :class:" @@ -1910,11 +2164,11 @@ msgid "" "`~datetime.timezone`." msgstr "" -#: whatsnew/3.3.rst:1370 +#: whatsnew/3.3.rst:1372 msgid "ftplib" msgstr "" -#: whatsnew/3.3.rst:1372 +#: whatsnew/3.3.rst:1374 msgid "" ":class:`ftplib.FTP` now accepts a ``source_address`` keyword argument to " "specify the ``(host, port)`` to use as the source address in the bind call " @@ -1922,7 +2176,7 @@ msgid "" "issue:`8594`.)" msgstr "" -#: whatsnew/3.3.rst:1377 +#: whatsnew/3.3.rst:1379 msgid "" "The :class:`~ftplib.FTP_TLS` class now provides a new :func:`~ftplib.FTP_TLS." "ccc` function to revert control channel back to plaintext. This can be " @@ -1931,18 +2185,18 @@ msgid "" "in :issue:`12139`.)" msgstr "" -#: whatsnew/3.3.rst:1383 +#: whatsnew/3.3.rst:1385 msgid "" "Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory " "listing format and deprecates :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP." "dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)" msgstr "" -#: whatsnew/3.3.rst:1389 +#: whatsnew/3.3.rst:1391 msgid "functools" msgstr "" -#: whatsnew/3.3.rst:1391 +#: whatsnew/3.3.rst:1393 msgid "" "The :func:`functools.lru_cache` decorator now accepts a ``typed`` keyword " "argument (that defaults to ``False`` to ensure that it caches values of " @@ -1950,32 +2204,32 @@ msgid "" "Raymond Hettinger in :issue:`13227`.)" msgstr "" -#: whatsnew/3.3.rst:1398 +#: whatsnew/3.3.rst:1400 msgid "gc" msgstr "" -#: whatsnew/3.3.rst:1400 +#: whatsnew/3.3.rst:1402 msgid "" "It is now possible to register callbacks invoked by the garbage collector " "before and after collection using the new :data:`~gc.callbacks` list." msgstr "" -#: whatsnew/3.3.rst:1405 +#: whatsnew/3.3.rst:1407 msgid "hmac" msgstr "" -#: whatsnew/3.3.rst:1407 +#: whatsnew/3.3.rst:1409 msgid "" "A new :func:`~hmac.compare_digest` function has been added to prevent side " "channel attacks on digests through timing analysis. (Contributed by Nick " "Coghlan and Christian Heimes in :issue:`15061`.)" msgstr "" -#: whatsnew/3.3.rst:1413 +#: whatsnew/3.3.rst:1415 msgid "http" msgstr "" -#: whatsnew/3.3.rst:1415 +#: whatsnew/3.3.rst:1417 msgid "" ":class:`http.server.BaseHTTPRequestHandler` now buffers the headers and " "writes them all at once when :meth:`~http.server.BaseHTTPRequestHandler." @@ -1985,37 +2239,37 @@ msgid "" "`3709`.)" msgstr "" -#: whatsnew/3.3.rst:1421 +#: whatsnew/3.3.rst:1423 msgid "" ":class:`http.server` now produces valid ``HTML 4.01 strict`` output. " "(Contributed by Ezio Melotti in :issue:`13295`.)" msgstr "" -#: whatsnew/3.3.rst:1424 +#: whatsnew/3.3.rst:1426 msgid "" ":class:`http.client.HTTPResponse` now has a :meth:`~http.client.HTTPResponse." "readinto` method, which means it can be used as an :class:`io.RawIOBase` " "class. (Contributed by John Kuhn in :issue:`13464`.)" msgstr "" -#: whatsnew/3.3.rst:1431 +#: whatsnew/3.3.rst:1433 msgid "html" msgstr "" -#: whatsnew/3.3.rst:1433 +#: whatsnew/3.3.rst:1435 msgid "" ":class:`html.parser.HTMLParser` is now able to parse broken markup without " "raising errors, therefore the *strict* argument of the constructor and the :" -"exc:`~html.parser.HTMLParseError` exception are now deprecated. The ability " -"to parse broken markup is the result of a number of bug fixes that are also " -"available on the latest bug fix releases of Python 2.7/3.2. (Contributed by " -"Ezio Melotti in :issue:`15114`, and :issue:`14538`, :issue:`13993`, :issue:" +"exc:`!HTMLParseError` exception are now deprecated. The ability to parse " +"broken markup is the result of a number of bug fixes that are also available " +"on the latest bug fix releases of Python 2.7/3.2. (Contributed by Ezio " +"Melotti in :issue:`15114`, and :issue:`14538`, :issue:`13993`, :issue:" "`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :" "issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:" "`12888`, :issue:`7311`.)" msgstr "" -#: whatsnew/3.3.rst:1443 +#: whatsnew/3.3.rst:1445 msgid "" "A new :data:`~html.entities.html5` dictionary that maps HTML5 named " "character references to the equivalent Unicode character(s) (e.g. " @@ -2024,25 +2278,25 @@ msgid "" "(Contributed by Ezio Melotti in :issue:`11113` and :issue:`15156`.)" msgstr "" -#: whatsnew/3.3.rst:1451 +#: whatsnew/3.3.rst:1453 msgid "imaplib" msgstr "" -#: whatsnew/3.3.rst:1453 +#: whatsnew/3.3.rst:1455 msgid "" "The :class:`~imaplib.IMAP4_SSL` constructor now accepts an SSLContext " "parameter to control parameters of the secure channel." msgstr "" -#: whatsnew/3.3.rst:1456 +#: whatsnew/3.3.rst:1458 msgid "(Contributed by Sijin Joseph in :issue:`8808`.)" msgstr "" -#: whatsnew/3.3.rst:1460 +#: whatsnew/3.3.rst:1462 msgid "inspect" msgstr "" -#: whatsnew/3.3.rst:1462 +#: whatsnew/3.3.rst:1464 msgid "" "A new :func:`~inspect.getclosurevars` function has been added. This function " "reports the current binding of all names referenced from the function body " @@ -2050,11 +2304,11 @@ msgid "" "internal state when testing code that relies on stateful closures." msgstr "" -#: whatsnew/3.3.rst:1467 +#: whatsnew/3.3.rst:1469 msgid "(Contributed by Meador Inge and Nick Coghlan in :issue:`13062`.)" msgstr "" -#: whatsnew/3.3.rst:1469 +#: whatsnew/3.3.rst:1471 msgid "" "A new :func:`~inspect.getgeneratorlocals` function has been added. This " "function reports the current binding of local variables in the generator's " @@ -2062,83 +2316,82 @@ msgid "" "generators." msgstr "" -#: whatsnew/3.3.rst:1474 +#: whatsnew/3.3.rst:1476 msgid "(Contributed by Meador Inge in :issue:`15153`.)" msgstr "" -#: whatsnew/3.3.rst:1477 +#: whatsnew/3.3.rst:1479 msgid "io" msgstr "" -#: whatsnew/3.3.rst:1479 +#: whatsnew/3.3.rst:1481 msgid "" "The :func:`~io.open` function has a new ``'x'`` mode that can be used to " "exclusively create a new file, and raise a :exc:`FileExistsError` if the " "file already exists. It is based on the C11 'x' mode to fopen()." msgstr "" -#: whatsnew/3.3.rst:1483 +#: whatsnew/3.3.rst:1485 msgid "(Contributed by David Townshend in :issue:`12760`.)" msgstr "" -#: whatsnew/3.3.rst:1485 +#: whatsnew/3.3.rst:1487 msgid "" "The constructor of the :class:`~io.TextIOWrapper` class has a new " "*write_through* optional argument. If *write_through* is ``True``, calls to :" -"meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any data " -"written on the :class:`~io.TextIOWrapper` object is immediately handled to " -"its underlying binary buffer." +"meth:`!write` are guaranteed not to be buffered: any data written on the :" +"class:`~io.TextIOWrapper` object is immediately handled to its underlying " +"binary buffer." msgstr "" -#: whatsnew/3.3.rst:1493 +#: whatsnew/3.3.rst:1495 msgid "itertools" msgstr "" -#: whatsnew/3.3.rst:1495 +#: whatsnew/3.3.rst:1497 msgid "" ":func:`~itertools.accumulate` now takes an optional ``func`` argument for " "providing a user-supplied binary function." msgstr "" -#: whatsnew/3.3.rst:1500 +#: whatsnew/3.3.rst:1502 msgid "logging" msgstr "" -#: whatsnew/3.3.rst:1502 +#: whatsnew/3.3.rst:1504 msgid "" "The :func:`~logging.basicConfig` function now supports an optional " "``handlers`` argument taking an iterable of handlers to be added to the root " "logger." msgstr "" -#: whatsnew/3.3.rst:1505 +#: whatsnew/3.3.rst:1507 msgid "" -"A class level attribute :attr:`~logging.handlers.SysLogHandler.append_nul` " -"has been added to :class:`~logging.handlers.SysLogHandler` to allow control " -"of the appending of the ``NUL`` (``\\000``) byte to syslog records, since " -"for some daemons it is required while for others it is passed through to the " -"log." +"A class level attribute :attr:`!append_nul` has been added to :class:" +"`~logging.handlers.SysLogHandler` to allow control of the appending of the " +"``NUL`` (``\\000``) byte to syslog records, since for some daemons it is " +"required while for others it is passed through to the log." msgstr "" -#: whatsnew/3.3.rst:1513 +#: whatsnew/3.3.rst:1515 msgid "math" msgstr "" -#: whatsnew/3.3.rst:1515 +#: whatsnew/3.3.rst:1517 msgid "" "The :mod:`math` module has a new function, :func:`~math.log2`, which " "returns the base-2 logarithm of *x*." msgstr "" -#: whatsnew/3.3.rst:1518 +#: whatsnew/3.3.rst:1520 msgid "(Written by Mark Dickinson in :issue:`11888`.)" msgstr "" -#: whatsnew/3.3.rst:1522 +#: whatsnew/3.3.rst:1524 msgid "mmap" msgstr "" -#: whatsnew/3.3.rst:1524 +#: whatsnew/3.3.rst:1526 msgid "" "The :meth:`~mmap.mmap.read` method is now more compatible with other file-" "like objects: if the argument is omitted or specified as ``None``, it " @@ -2146,39 +2399,39 @@ msgid "" "(Contributed by Petri Lehtinen in :issue:`12021`.)" msgstr "" -#: whatsnew/3.3.rst:1531 +#: whatsnew/3.3.rst:1533 msgid "multiprocessing" msgstr "" -#: whatsnew/3.3.rst:1533 +#: whatsnew/3.3.rst:1535 msgid "" "The new :func:`multiprocessing.connection.wait` function allows polling " "multiple objects (such as connections, sockets and pipes) with a timeout. " "(Contributed by Richard Oudkerk in :issue:`12328`.)" msgstr "" -#: whatsnew/3.3.rst:1537 +#: whatsnew/3.3.rst:1539 msgid "" -":class:`multiprocessing.Connection` objects can now be transferred over " -"multiprocessing connections. (Contributed by Richard Oudkerk in :issue:" -"`4892`.)" +":class:`multiprocessing.connection.Connection` objects can now be " +"transferred over multiprocessing connections. (Contributed by Richard " +"Oudkerk in :issue:`4892`.)" msgstr "" -#: whatsnew/3.3.rst:1541 +#: whatsnew/3.3.rst:1543 msgid "" ":class:`multiprocessing.Process` now accepts a ``daemon`` keyword argument " "to override the default behavior of inheriting the ``daemon`` flag from the " "parent process (:issue:`6064`)." msgstr "" -#: whatsnew/3.3.rst:1545 +#: whatsnew/3.3.rst:1547 msgid "" "New attribute :data:`multiprocessing.Process.sentinel` allows a program to " "wait on multiple :class:`~multiprocessing.Process` objects at one time using " "the appropriate OS primitives (for example, :mod:`select` on posix systems)." msgstr "" -#: whatsnew/3.3.rst:1550 +#: whatsnew/3.3.rst:1552 msgid "" "New methods :meth:`multiprocessing.pool.Pool.starmap` and :meth:" "`~multiprocessing.pool.Pool.starmap_async` provide :func:`itertools.starmap` " @@ -2187,26 +2440,37 @@ msgid "" "Schlawack in :issue:`12708`.)" msgstr "" -#: whatsnew/3.3.rst:1559 +#: whatsnew/3.3.rst:1561 msgid "nntplib" msgstr "" -#: whatsnew/3.3.rst:1561 +#: whatsnew/3.3.rst:1563 +msgid "" +"The :class:`!nntplib.NNTP` class now supports the context management " +"protocol to unconditionally consume :exc:`socket.error` exceptions and to " +"close the NNTP connection when done::" +msgstr "" + +#: whatsnew/3.3.rst:1567 msgid "" -"The :class:`nntplib.NNTP` class now supports the context management protocol " -"to unconditionally consume :exc:`socket.error` exceptions and to close the " -"NNTP connection when done::" +">>> from nntplib import NNTP\n" +">>> with NNTP('news.gmane.org') as n:\n" +"... n.group('gmane.comp.python.committers')\n" +"...\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp." +"python.committers')\n" +">>>" msgstr "" -#: whatsnew/3.3.rst:1572 +#: whatsnew/3.3.rst:1574 msgid "(Contributed by Giampaolo Rodolà in :issue:`9795`.)" msgstr "" -#: whatsnew/3.3.rst:1576 +#: whatsnew/3.3.rst:1578 msgid "os" msgstr "" -#: whatsnew/3.3.rst:1578 +#: whatsnew/3.3.rst:1580 msgid "" "The :mod:`os` module has a new :func:`~os.pipe2` function that makes it " "possible to create a pipe with :const:`~os.O_CLOEXEC` or :const:`~os." @@ -2214,7 +2478,7 @@ msgid "" "conditions in multi-threaded programs." msgstr "" -#: whatsnew/3.3.rst:1583 +#: whatsnew/3.3.rst:1585 msgid "" "The :mod:`os` module has a new :func:`~os.sendfile` function which provides " "an efficient \"zero-copy\" way for copying data from one file (or socket) " @@ -2225,12 +2489,12 @@ msgid "" "socket, e.g. for downloading a file." msgstr "" -#: whatsnew/3.3.rst:1591 +#: whatsnew/3.3.rst:1593 msgid "" "(Patch submitted by Ross Lagerwall and Giampaolo Rodolà in :issue:`10882`.)" msgstr "" -#: whatsnew/3.3.rst:1593 +#: whatsnew/3.3.rst:1595 msgid "" "To avoid race conditions like symlink attacks and issues with temporary " "files and directories, it is more reliable (and also faster) to manipulate " @@ -2239,14 +2503,14 @@ msgid "" "`4761`, :issue:`10755` and :issue:`14626`)." msgstr "" -#: whatsnew/3.3.rst:1599 +#: whatsnew/3.3.rst:1601 msgid "" "The :mod:`os` module has a new :func:`~os.fwalk` function similar to :func:" "`~os.walk` except that it also yields file descriptors referring to the " "directories visited. This is especially useful to avoid symlink races." msgstr "" -#: whatsnew/3.3.rst:1603 +#: whatsnew/3.3.rst:1605 msgid "" "The following functions get new optional *dir_fd* (:ref:`paths relative to " "directory descriptors `) and/or *follow_symlinks* (:ref:`not " @@ -2257,10 +2521,10 @@ msgid "" "`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :" "func:`~os.unlink`, :func:`~os.utime`. Platform support for using these " "parameters can be checked via the sets :data:`os.supports_dir_fd` and :data:" -"`os.supports_follows_symlinks`." +"`os.supports_follow_symlinks`." msgstr "" -#: whatsnew/3.3.rst:1614 +#: whatsnew/3.3.rst:1616 msgid "" "The following functions now support a file descriptor for their path " "argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:" @@ -2269,7 +2533,7 @@ msgid "" "support for this can be checked via the :data:`os.supports_fd` set." msgstr "" -#: whatsnew/3.3.rst:1620 +#: whatsnew/3.3.rst:1622 msgid "" ":func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on " "using the effective uid/gid rather than the real uid/gid in the access " @@ -2277,7 +2541,7 @@ msgid "" "supports_effective_ids` set." msgstr "" -#: whatsnew/3.3.rst:1625 +#: whatsnew/3.3.rst:1627 msgid "" "The :mod:`os` module has two new functions: :func:`~os.getpriority` and :" "func:`~os.setpriority`. They can be used to get or set process niceness/" @@ -2285,11 +2549,11 @@ msgid "" "processes instead of just the current one." msgstr "" -#: whatsnew/3.3.rst:1630 +#: whatsnew/3.3.rst:1632 msgid "(Patch submitted by Giampaolo Rodolà in :issue:`10784`.)" msgstr "" -#: whatsnew/3.3.rst:1632 +#: whatsnew/3.3.rst:1634 msgid "" "The new :func:`os.replace` function allows cross-platform renaming of a file " "with overwriting the destination. With :func:`os.rename`, an existing " @@ -2297,7 +2561,7 @@ msgid "" "Windows. (Contributed by Antoine Pitrou in :issue:`8828`.)" msgstr "" -#: whatsnew/3.3.rst:1638 +#: whatsnew/3.3.rst:1640 msgid "" "The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, and :func:" "`~os.lstat`) now support reading a file's timestamps with nanosecond " @@ -2306,7 +2570,7 @@ msgid "" "`14127`.)" msgstr "" -#: whatsnew/3.3.rst:1644 +#: whatsnew/3.3.rst:1646 msgid "" "The new :func:`os.get_terminal_size` function queries the size of the " "terminal attached to a file descriptor. See also :func:`shutil." @@ -2314,14 +2578,14 @@ msgid "" "`13609`.)" msgstr "" -#: whatsnew/3.3.rst:1651 +#: whatsnew/3.3.rst:1653 msgid "" "New functions to support Linux extended attributes (:issue:`12720`): :func:" "`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." "setxattr`." msgstr "" -#: whatsnew/3.3.rst:1655 +#: whatsnew/3.3.rst:1657 msgid "" "New interface to the scheduler. These functions control how a process is " "allocated CPU time by the operating system. New functions: :func:`~os." @@ -2332,163 +2596,163 @@ msgid "" "sched_setscheduler`, :func:`~os.sched_yield`," msgstr "" -#: whatsnew/3.3.rst:1664 +#: whatsnew/3.3.rst:1666 msgid "New functions to control the file system:" msgstr "" -#: whatsnew/3.3.rst:1666 +#: whatsnew/3.3.rst:1668 msgid "" ":func:`~os.posix_fadvise`: Announces an intention to access data in a " "specific pattern thus allowing the kernel to make optimizations." msgstr "" -#: whatsnew/3.3.rst:1668 +#: whatsnew/3.3.rst:1670 msgid "" ":func:`~os.posix_fallocate`: Ensures that enough disk space is allocated for " "a file." msgstr "" -#: whatsnew/3.3.rst:1670 +#: whatsnew/3.3.rst:1672 msgid ":func:`~os.sync`: Force write of everything to disk." msgstr "" -#: whatsnew/3.3.rst:1672 +#: whatsnew/3.3.rst:1674 msgid "Additional new posix functions:" msgstr "" -#: whatsnew/3.3.rst:1674 +#: whatsnew/3.3.rst:1676 msgid "" ":func:`~os.lockf`: Apply, test or remove a POSIX lock on an open file " "descriptor." msgstr "" -#: whatsnew/3.3.rst:1675 +#: whatsnew/3.3.rst:1677 msgid "" ":func:`~os.pread`: Read from a file descriptor at an offset, the file offset " "remains unchanged." msgstr "" -#: whatsnew/3.3.rst:1677 +#: whatsnew/3.3.rst:1679 msgid "" ":func:`~os.pwrite`: Write to a file descriptor from an offset, leaving the " "file offset unchanged." msgstr "" -#: whatsnew/3.3.rst:1679 +#: whatsnew/3.3.rst:1681 msgid "" ":func:`~os.readv`: Read from a file descriptor into a number of writable " "buffers." msgstr "" -#: whatsnew/3.3.rst:1680 +#: whatsnew/3.3.rst:1682 msgid "" ":func:`~os.truncate`: Truncate the file corresponding to *path*, so that it " "is at most *length* bytes in size." msgstr "" -#: whatsnew/3.3.rst:1682 +#: whatsnew/3.3.rst:1684 msgid "" ":func:`~os.waitid`: Wait for the completion of one or more child processes." msgstr "" -#: whatsnew/3.3.rst:1683 +#: whatsnew/3.3.rst:1685 msgid "" ":func:`~os.writev`: Write the contents of *buffers* to a file descriptor, " "where *buffers* is an arbitrary sequence of buffers." msgstr "" -#: whatsnew/3.3.rst:1685 +#: whatsnew/3.3.rst:1687 msgid "" ":func:`~os.getgrouplist` (:issue:`9344`): Return list of group ids that " "specified user belongs to." msgstr "" -#: whatsnew/3.3.rst:1688 +#: whatsnew/3.3.rst:1690 msgid "" ":func:`~os.times` and :func:`~os.uname`: Return type changed from a tuple to " "a tuple-like object with named attributes." msgstr "" -#: whatsnew/3.3.rst:1691 +#: whatsnew/3.3.rst:1693 msgid "" "Some platforms now support additional constants for the :func:`~os.lseek` " "function, such as ``os.SEEK_HOLE`` and ``os.SEEK_DATA``." msgstr "" -#: whatsnew/3.3.rst:1694 +#: whatsnew/3.3.rst:1696 msgid "" "New constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os." "RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:" "`~os.RTLD_NOLOAD`, and :const:`~os.RTLD_DEEPBIND` are available on platforms " "that support them. These are for use with the :func:`sys.setdlopenflags` " "function, and supersede the similar constants defined in :mod:`ctypes` and :" -"mod:`DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" +"mod:`!DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" msgstr "" -#: whatsnew/3.3.rst:1702 +#: whatsnew/3.3.rst:1704 msgid "" ":func:`os.symlink` now accepts (and ignores) the ``target_is_directory`` " "keyword argument on non-Windows platforms, to ease cross-platform support." msgstr "" -#: whatsnew/3.3.rst:1707 +#: whatsnew/3.3.rst:1709 msgid "pdb" msgstr "" -#: whatsnew/3.3.rst:1709 +#: whatsnew/3.3.rst:1711 msgid "" "Tab-completion is now available not only for command names, but also their " "arguments. For example, for the ``break`` command, function and file names " "are completed." msgstr "" -#: whatsnew/3.3.rst:1713 +#: whatsnew/3.3.rst:1715 msgid "(Contributed by Georg Brandl in :issue:`14210`)" msgstr "" -#: whatsnew/3.3.rst:1717 +#: whatsnew/3.3.rst:1719 msgid "pickle" msgstr "" -#: whatsnew/3.3.rst:1719 +#: whatsnew/3.3.rst:1721 msgid "" ":class:`pickle.Pickler` objects now have an optional :attr:`~pickle.Pickler." "dispatch_table` attribute allowing per-pickler reduction functions to be set." msgstr "" -#: whatsnew/3.3.rst:1723 +#: whatsnew/3.3.rst:1725 msgid "(Contributed by Richard Oudkerk in :issue:`14166`.)" msgstr "" -#: whatsnew/3.3.rst:1727 +#: whatsnew/3.3.rst:1729 msgid "pydoc" msgstr "" -#: whatsnew/3.3.rst:1729 +#: whatsnew/3.3.rst:1731 msgid "" -"The Tk GUI and the :func:`~pydoc.serve` function have been removed from the :" -"mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " -"deprecated in Python 3.2." +"The Tk GUI and the :func:`!serve` function have been removed from the :mod:" +"`pydoc` module: ``pydoc -g`` and :func:`!serve` have been deprecated in " +"Python 3.2." msgstr "" -#: whatsnew/3.3.rst:1735 +#: whatsnew/3.3.rst:1737 msgid "re" msgstr "" -#: whatsnew/3.3.rst:1737 +#: whatsnew/3.3.rst:1739 msgid "" ":class:`str` regular expressions now support ``\\u`` and ``\\U`` escapes." msgstr "" -#: whatsnew/3.3.rst:1739 +#: whatsnew/3.3.rst:1741 msgid "(Contributed by Serhiy Storchaka in :issue:`3665`.)" msgstr "" -#: whatsnew/3.3.rst:1743 +#: whatsnew/3.3.rst:1745 msgid "sched" msgstr "" -#: whatsnew/3.3.rst:1745 +#: whatsnew/3.3.rst:1747 msgid "" ":meth:`~sched.scheduler.run` now accepts a *blocking* parameter which when " "set to false makes the method execute the scheduled events due to expire " @@ -2497,85 +2761,85 @@ msgid "" "(Contributed by Giampaolo Rodolà in :issue:`13449`.)" msgstr "" -#: whatsnew/3.3.rst:1751 +#: whatsnew/3.3.rst:1753 msgid "" ":class:`~sched.scheduler` class can now be safely used in multi-threaded " "environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" "`8684`.)" msgstr "" -#: whatsnew/3.3.rst:1755 +#: whatsnew/3.3.rst:1757 msgid "" "*timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class " "constructor are now optional and defaults to :func:`time.time` and :func:" "`time.sleep` respectively. (Contributed by Chris Clark in :issue:`13245`.)" msgstr "" -#: whatsnew/3.3.rst:1760 +#: whatsnew/3.3.rst:1762 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` " "*argument* parameter is now optional. (Contributed by Chris Clark in :issue:" "`13245`.)" msgstr "" -#: whatsnew/3.3.rst:1764 +#: whatsnew/3.3.rst:1766 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` now " "accept a *kwargs* parameter. (Contributed by Chris Clark in :issue:`13245`.)" msgstr "" -#: whatsnew/3.3.rst:1770 +#: whatsnew/3.3.rst:1772 msgid "select" msgstr "" -#: whatsnew/3.3.rst:1772 +#: whatsnew/3.3.rst:1774 msgid "" "Solaris and derivative platforms have a new class :class:`select.devpoll` " "for high performance asynchronous sockets via :file:`/dev/poll`. " "(Contributed by Jesús Cea Avión in :issue:`6397`.)" msgstr "" -#: whatsnew/3.3.rst:1778 +#: whatsnew/3.3.rst:1780 msgid "shlex" msgstr "" -#: whatsnew/3.3.rst:1780 +#: whatsnew/3.3.rst:1782 msgid "" -"The previously undocumented helper function ``quote`` from the :mod:`pipes` " +"The previously undocumented helper function ``quote`` from the :mod:`!pipes` " "modules has been moved to the :mod:`shlex` module and documented. :func:" "`~shlex.quote` properly escapes all characters in a string that might be " "otherwise given special meaning by the shell." msgstr "" -#: whatsnew/3.3.rst:1787 +#: whatsnew/3.3.rst:1789 msgid "shutil" msgstr "" -#: whatsnew/3.3.rst:1789 +#: whatsnew/3.3.rst:1791 msgid "New functions:" msgstr "" -#: whatsnew/3.3.rst:1791 +#: whatsnew/3.3.rst:1793 msgid "" ":func:`~shutil.disk_usage`: provides total, used and free disk space " "statistics. (Contributed by Giampaolo Rodolà in :issue:`12442`.)" msgstr "" -#: whatsnew/3.3.rst:1793 +#: whatsnew/3.3.rst:1795 msgid "" ":func:`~shutil.chown`: allows one to change user and/or group of the given " "path also specifying the user/group names and not only their numeric ids. " "(Contributed by Sandro Tosi in :issue:`12191`.)" msgstr "" -#: whatsnew/3.3.rst:1796 +#: whatsnew/3.3.rst:1798 msgid "" ":func:`shutil.get_terminal_size`: returns the size of the terminal window to " "which the interpreter is attached. (Contributed by Zbigniew Jędrzejewski-" "Szmek in :issue:`13609`.)" msgstr "" -#: whatsnew/3.3.rst:1800 +#: whatsnew/3.3.rst:1802 msgid "" ":func:`~shutil.copy2` and :func:`~shutil.copystat` now preserve file " "timestamps with nanosecond precision on platforms that support it. They also " @@ -2583,7 +2847,7 @@ msgid "" "Hastings in :issue:`14127` and :issue:`15238`.)" msgstr "" -#: whatsnew/3.3.rst:1805 +#: whatsnew/3.3.rst:1807 msgid "" "Several functions now take an optional ``symlinks`` argument: when that " "parameter is true, symlinks aren't dereferenced and the operation instead " @@ -2591,7 +2855,7 @@ msgid "" "Hynek Schlawack in :issue:`12715`.)" msgstr "" -#: whatsnew/3.3.rst:1810 +#: whatsnew/3.3.rst:1812 msgid "" "When copying files to a different file system, :func:`~shutil.move` now " "handles symlinks the way the posix ``mv`` command does, recreating the " @@ -2600,7 +2864,7 @@ msgid "" "the ``dst`` argument as its result." msgstr "" -#: whatsnew/3.3.rst:1816 +#: whatsnew/3.3.rst:1818 msgid "" ":func:`~shutil.rmtree` is now resistant to symlink attacks on platforms " "which support the new ``dir_fd`` parameter in :func:`os.open` and :func:`os." @@ -2608,80 +2872,80 @@ msgid "" "`4489`.)" msgstr "" -#: whatsnew/3.3.rst:1823 +#: whatsnew/3.3.rst:1825 msgid "signal" msgstr "" -#: whatsnew/3.3.rst:1825 +#: whatsnew/3.3.rst:1827 msgid "The :mod:`signal` module has new functions:" msgstr "" -#: whatsnew/3.3.rst:1827 +#: whatsnew/3.3.rst:1829 msgid "" ":func:`~signal.pthread_sigmask`: fetch and/or change the signal mask of the " "calling thread (Contributed by Jean-Paul Calderone in :issue:`8407`);" msgstr "" -#: whatsnew/3.3.rst:1829 +#: whatsnew/3.3.rst:1831 msgid ":func:`~signal.pthread_kill`: send a signal to a thread;" msgstr "" -#: whatsnew/3.3.rst:1830 +#: whatsnew/3.3.rst:1832 msgid ":func:`~signal.sigpending`: examine pending functions;" msgstr "" -#: whatsnew/3.3.rst:1831 +#: whatsnew/3.3.rst:1833 msgid ":func:`~signal.sigwait`: wait a signal;" msgstr "" -#: whatsnew/3.3.rst:1832 +#: whatsnew/3.3.rst:1834 msgid "" ":func:`~signal.sigwaitinfo`: wait for a signal, returning detailed " "information about it;" msgstr "" -#: whatsnew/3.3.rst:1834 +#: whatsnew/3.3.rst:1836 msgid "" ":func:`~signal.sigtimedwait`: like :func:`~signal.sigwaitinfo` but with a " "timeout." msgstr "" -#: whatsnew/3.3.rst:1837 +#: whatsnew/3.3.rst:1839 msgid "" "The signal handler writes the signal number as a single byte instead of a " "nul byte into the wakeup file descriptor. So it is possible to wait more " "than one signal and know which signals were raised." msgstr "" -#: whatsnew/3.3.rst:1841 +#: whatsnew/3.3.rst:1843 msgid "" ":func:`signal.signal` and :func:`signal.siginterrupt` raise an OSError, " "instead of a RuntimeError: OSError has an errno attribute." msgstr "" -#: whatsnew/3.3.rst:1846 +#: whatsnew/3.3.rst:1848 msgid "smtpd" msgstr "" -#: whatsnew/3.3.rst:1848 +#: whatsnew/3.3.rst:1850 msgid "" "The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) and :rfc:" "`1870` (size extension). Per the standard, these extensions are enabled if " "and only if the client initiates the session with an ``EHLO`` command." msgstr "" -#: whatsnew/3.3.rst:1852 +#: whatsnew/3.3.rst:1854 msgid "" "(Initial ``ELHO`` support by Alberto Trevino. Size extension by Juhana " "Jauhiainen. Substantial additional work on the patch contributed by Michele " "Orrù and Dan Boswell. :issue:`8739`)" msgstr "" -#: whatsnew/3.3.rst:1858 +#: whatsnew/3.3.rst:1860 msgid "smtplib" msgstr "" -#: whatsnew/3.3.rst:1860 +#: whatsnew/3.3.rst:1862 msgid "" "The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, and :class:`~smtplib." "LMTP` classes now accept a ``source_address`` keyword argument to specify " @@ -2690,62 +2954,62 @@ msgid "" "`11281`.)" msgstr "" -#: whatsnew/3.3.rst:1866 +#: whatsnew/3.3.rst:1868 msgid "" ":class:`~smtplib.SMTP` now supports the context management protocol, " "allowing an ``SMTP`` instance to be used in a ``with`` statement. " "(Contributed by Giampaolo Rodolà in :issue:`11289`.)" msgstr "" -#: whatsnew/3.3.rst:1870 +#: whatsnew/3.3.rst:1872 msgid "" "The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP." "starttls` method now accept an SSLContext parameter to control parameters of " "the secure channel. (Contributed by Kasun Herath in :issue:`8809`.)" msgstr "" -#: whatsnew/3.3.rst:1876 +#: whatsnew/3.3.rst:1878 msgid "socket" msgstr "" -#: whatsnew/3.3.rst:1878 +#: whatsnew/3.3.rst:1880 msgid "" "The :class:`~socket.socket` class now exposes additional methods to process " "ancillary data when supported by the underlying platform:" msgstr "" -#: whatsnew/3.3.rst:1881 +#: whatsnew/3.3.rst:1883 msgid ":func:`~socket.socket.sendmsg`" msgstr "" -#: whatsnew/3.3.rst:1882 +#: whatsnew/3.3.rst:1884 msgid ":func:`~socket.socket.recvmsg`" msgstr "" -#: whatsnew/3.3.rst:1883 +#: whatsnew/3.3.rst:1885 msgid ":func:`~socket.socket.recvmsg_into`" msgstr "" -#: whatsnew/3.3.rst:1885 +#: whatsnew/3.3.rst:1887 msgid "" "(Contributed by David Watson in :issue:`6560`, based on an earlier patch by " "Heiko Wundram)" msgstr "" -#: whatsnew/3.3.rst:1888 +#: whatsnew/3.3.rst:1890 msgid "" "The :class:`~socket.socket` class now supports the PF_CAN protocol family " "(https://en.wikipedia.org/wiki/Socketcan), on Linux (https://lwn.net/" "Articles/253425)." msgstr "" -#: whatsnew/3.3.rst:1892 +#: whatsnew/3.3.rst:1894 msgid "" "(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" "`10141`.)" msgstr "" -#: whatsnew/3.3.rst:1894 +#: whatsnew/3.3.rst:1896 msgid "" "The :class:`~socket.socket` class now supports the PF_RDS protocol family " "(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://oss." @@ -2753,24 +3017,24 @@ msgid "" "oss.oracle.com/projects/rds/>`__)." msgstr "" -#: whatsnew/3.3.rst:1898 +#: whatsnew/3.3.rst:1900 msgid "" "The :class:`~socket.socket` class now supports the ``PF_SYSTEM`` protocol " "family on OS X. (Contributed by Michael Goderbauer in :issue:`13777`.)" msgstr "" -#: whatsnew/3.3.rst:1901 +#: whatsnew/3.3.rst:1903 msgid "" "New function :func:`~socket.sethostname` allows the hostname to be set on " "Unix systems if the calling process has sufficient privileges. (Contributed " "by Ross Lagerwall in :issue:`10866`.)" msgstr "" -#: whatsnew/3.3.rst:1907 +#: whatsnew/3.3.rst:1909 msgid "socketserver" msgstr "" -#: whatsnew/3.3.rst:1909 +#: whatsnew/3.3.rst:1911 msgid "" ":class:`~socketserver.BaseServer` now has an overridable method :meth:" "`~socketserver.BaseServer.service_actions` that is called by the :meth:" @@ -2779,54 +3043,54 @@ msgid "" "processes. (Contributed by Justin Warkentin in :issue:`11109`.)" msgstr "" -#: whatsnew/3.3.rst:1917 +#: whatsnew/3.3.rst:1919 msgid "sqlite3" msgstr "" -#: whatsnew/3.3.rst:1919 +#: whatsnew/3.3.rst:1921 msgid "" "New :class:`sqlite3.Connection` method :meth:`~sqlite3.Connection." "set_trace_callback` can be used to capture a trace of all sql commands " "processed by sqlite. (Contributed by Torsten Landschoff in :issue:`11688`.)" msgstr "" -#: whatsnew/3.3.rst:1926 +#: whatsnew/3.3.rst:1928 msgid "ssl" msgstr "" -#: whatsnew/3.3.rst:1928 +#: whatsnew/3.3.rst:1930 msgid "The :mod:`ssl` module has two new random generation functions:" msgstr "" -#: whatsnew/3.3.rst:1930 +#: whatsnew/3.3.rst:1932 msgid "" ":func:`~ssl.RAND_bytes`: generate cryptographically strong pseudo-random " "bytes." msgstr "" -#: whatsnew/3.3.rst:1932 -msgid ":func:`~ssl.RAND_pseudo_bytes`: generate pseudo-random bytes." +#: whatsnew/3.3.rst:1934 +msgid ":func:`!RAND_pseudo_bytes`: generate pseudo-random bytes." msgstr "" -#: whatsnew/3.3.rst:1934 +#: whatsnew/3.3.rst:1936 msgid "(Contributed by Victor Stinner in :issue:`12049`.)" msgstr "" -#: whatsnew/3.3.rst:1936 +#: whatsnew/3.3.rst:1938 msgid "" "The :mod:`ssl` module now exposes a finer-grained exception hierarchy in " "order to make it easier to inspect the various kinds of errors. (Contributed " "by Antoine Pitrou in :issue:`11183`.)" msgstr "" -#: whatsnew/3.3.rst:1940 +#: whatsnew/3.3.rst:1942 msgid "" ":meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument to " "be used if the private key is encrypted. (Contributed by Adam Simpkins in :" "issue:`12803`.)" msgstr "" -#: whatsnew/3.3.rst:1944 +#: whatsnew/3.3.rst:1946 msgid "" "Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is now " "supported through the :meth:`~ssl.SSLContext.load_dh_params` and :meth:`~ssl." @@ -2834,14 +3098,14 @@ msgid "" "`13626` and :issue:`13627`.)" msgstr "" -#: whatsnew/3.3.rst:1949 +#: whatsnew/3.3.rst:1951 msgid "" "SSL sockets have a new :meth:`~ssl.SSLSocket.get_channel_binding` method " "allowing the implementation of certain authentication mechanisms such as " "SCRAM-SHA-1-PLUS. (Contributed by Jacek Konieczny in :issue:`12551`.)" msgstr "" -#: whatsnew/3.3.rst:1953 +#: whatsnew/3.3.rst:1955 msgid "" "You can query the SSL compression algorithm used by an SSL socket, thanks to " "its new :meth:`~ssl.SSLSocket.compression` method. The new attribute :const:" @@ -2849,123 +3113,122 @@ msgid "" "Antoine Pitrou in :issue:`13634`.)" msgstr "" -#: whatsnew/3.3.rst:1958 +#: whatsnew/3.3.rst:1960 msgid "" "Support has been added for the Next Protocol Negotiation extension using " "the :meth:`ssl.SSLContext.set_npn_protocols` method. (Contributed by Colin " "Marc in :issue:`14204`.)" msgstr "" -#: whatsnew/3.3.rst:1962 +#: whatsnew/3.3.rst:1964 msgid "" "SSL errors can now be introspected more easily thanks to :attr:`~ssl." "SSLError.library` and :attr:`~ssl.SSLError.reason` attributes. (Contributed " "by Antoine Pitrou in :issue:`14837`.)" msgstr "" -#: whatsnew/3.3.rst:1966 +#: whatsnew/3.3.rst:1968 msgid "" "The :func:`~ssl.get_server_certificate` function now supports IPv6. " "(Contributed by Charles-François Natali in :issue:`11811`.)" msgstr "" -#: whatsnew/3.3.rst:1969 +#: whatsnew/3.3.rst:1971 msgid "" "New attribute :const:`~ssl.OP_CIPHER_SERVER_PREFERENCE` allows setting SSLv3 " "server sockets to use the server's cipher ordering preference rather than " "the client's (:issue:`13635`)." msgstr "" -#: whatsnew/3.3.rst:1975 +#: whatsnew/3.3.rst:1977 msgid "stat" msgstr "" -#: whatsnew/3.3.rst:1977 +#: whatsnew/3.3.rst:1979 msgid "" "The undocumented tarfile.filemode function has been moved to :func:`stat." "filemode`. It can be used to convert a file's mode to a string of the form '-" "rwxrwxrwx'." msgstr "" -#: whatsnew/3.3.rst:1981 +#: whatsnew/3.3.rst:1983 msgid "(Contributed by Giampaolo Rodolà in :issue:`14807`.)" msgstr "" -#: whatsnew/3.3.rst:1985 +#: whatsnew/3.3.rst:1987 msgid "struct" msgstr "" -#: whatsnew/3.3.rst:1987 +#: whatsnew/3.3.rst:1989 msgid "" "The :mod:`struct` module now supports :c:type:`ssize_t` and :c:type:`size_t` " "via the new codes ``n`` and ``N``, respectively. (Contributed by Antoine " "Pitrou in :issue:`3163`.)" msgstr "" -#: whatsnew/3.3.rst:1993 +#: whatsnew/3.3.rst:1995 msgid "subprocess" msgstr "" -#: whatsnew/3.3.rst:1995 +#: whatsnew/3.3.rst:1997 msgid "" "Command strings can now be bytes objects on posix platforms. (Contributed " "by Victor Stinner in :issue:`8513`.)" msgstr "" -#: whatsnew/3.3.rst:1998 +#: whatsnew/3.3.rst:2000 msgid "" "A new constant :const:`~subprocess.DEVNULL` allows suppressing output in a " "platform-independent fashion. (Contributed by Ross Lagerwall in :issue:" "`5870`.)" msgstr "" -#: whatsnew/3.3.rst:2004 +#: whatsnew/3.3.rst:2006 msgid "sys" msgstr "" -#: whatsnew/3.3.rst:2006 +#: whatsnew/3.3.rst:2008 msgid "" "The :mod:`sys` module has a new :data:`~sys.thread_info` :term:`named tuple` " "holding information about the thread implementation (:issue:`11223`)." msgstr "" -#: whatsnew/3.3.rst:2012 +#: whatsnew/3.3.rst:2014 msgid "tarfile" msgstr "" -#: whatsnew/3.3.rst:2014 +#: whatsnew/3.3.rst:2016 msgid "" ":mod:`tarfile` now supports ``lzma`` encoding via the :mod:`lzma` module. " "(Contributed by Lars Gustäbel in :issue:`5689`.)" msgstr "" -#: whatsnew/3.3.rst:2019 +#: whatsnew/3.3.rst:2021 msgid "tempfile" msgstr "" -#: whatsnew/3.3.rst:2021 +#: whatsnew/3.3.rst:2023 msgid "" -":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile." -"SpooledTemporaryFile.truncate` method now accepts a ``size`` parameter. " -"(Contributed by Ryan Kelly in :issue:`9957`.)" +":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`!truncate` method now " +"accepts a ``size`` parameter. (Contributed by Ryan Kelly in :issue:`9957`.)" msgstr "" -#: whatsnew/3.3.rst:2027 +#: whatsnew/3.3.rst:2028 msgid "textwrap" msgstr "" -#: whatsnew/3.3.rst:2029 +#: whatsnew/3.3.rst:2030 msgid "" "The :mod:`textwrap` module has a new :func:`~textwrap.indent` that makes it " "straightforward to add a common prefix to selected lines in a block of text " "(:issue:`13857`)." msgstr "" -#: whatsnew/3.3.rst:2035 +#: whatsnew/3.3.rst:2036 msgid "threading" msgstr "" -#: whatsnew/3.3.rst:2037 +#: whatsnew/3.3.rst:2038 msgid "" ":class:`threading.Condition`, :class:`threading.Semaphore`, :class:" "`threading.BoundedSemaphore`, :class:`threading.Event`, and :class:" @@ -2974,14 +3237,14 @@ msgid "" "Araujo in :issue:`10968`.)" msgstr "" -#: whatsnew/3.3.rst:2043 +#: whatsnew/3.3.rst:2044 msgid "" "The :class:`threading.Thread` constructor now accepts a ``daemon`` keyword " "argument to override the default behavior of inheriting the ``daemon`` flag " "value from the parent thread (:issue:`6064`)." msgstr "" -#: whatsnew/3.3.rst:2047 +#: whatsnew/3.3.rst:2048 msgid "" "The formerly private function ``_thread.get_ident`` is now available as the " "public function :func:`threading.get_ident`. This eliminates several cases " @@ -2990,76 +3253,76 @@ msgid "" "public interface." msgstr "" -#: whatsnew/3.3.rst:2055 +#: whatsnew/3.3.rst:2056 msgid "time" msgstr "" -#: whatsnew/3.3.rst:2057 +#: whatsnew/3.3.rst:2058 msgid "The :pep:`418` added new functions to the :mod:`time` module:" msgstr "" -#: whatsnew/3.3.rst:2059 +#: whatsnew/3.3.rst:2060 msgid ":func:`~time.get_clock_info`: Get information on a clock." msgstr "" -#: whatsnew/3.3.rst:2060 +#: whatsnew/3.3.rst:2061 msgid "" ":func:`~time.monotonic`: Monotonic clock (cannot go backward), not affected " "by system clock updates." msgstr "" -#: whatsnew/3.3.rst:2062 +#: whatsnew/3.3.rst:2063 msgid "" ":func:`~time.perf_counter`: Performance counter with the highest available " "resolution to measure a short duration." msgstr "" -#: whatsnew/3.3.rst:2064 +#: whatsnew/3.3.rst:2065 msgid "" ":func:`~time.process_time`: Sum of the system and user CPU time of the " "current process." msgstr "" -#: whatsnew/3.3.rst:2067 +#: whatsnew/3.3.rst:2068 msgid "Other new functions:" msgstr "" -#: whatsnew/3.3.rst:2069 +#: whatsnew/3.3.rst:2070 msgid "" ":func:`~time.clock_getres`, :func:`~time.clock_gettime` and :func:`~time." "clock_settime` functions with :samp:`CLOCK_{xxx}` constants. (Contributed by " "Victor Stinner in :issue:`10278`.)" msgstr "" -#: whatsnew/3.3.rst:2073 +#: whatsnew/3.3.rst:2074 msgid "" "To improve cross platform consistency, :func:`~time.sleep` now raises a :exc:" "`ValueError` when passed a negative sleep value. Previously this was an " "error on posix, but produced an infinite sleep on Windows." msgstr "" -#: whatsnew/3.3.rst:2079 +#: whatsnew/3.3.rst:2080 msgid "types" msgstr "" -#: whatsnew/3.3.rst:2081 +#: whatsnew/3.3.rst:2082 msgid "" "Add a new :class:`types.MappingProxyType` class: Read-only proxy of a " "mapping. (:issue:`14386`)" msgstr "" -#: whatsnew/3.3.rst:2085 +#: whatsnew/3.3.rst:2086 msgid "" "The new functions :func:`types.new_class` and :func:`types.prepare_class` " "provide support for :pep:`3115` compliant dynamic type creation. (:issue:" "`14588`)" msgstr "" -#: whatsnew/3.3.rst:2090 +#: whatsnew/3.3.rst:2091 msgid "unittest" msgstr "" -#: whatsnew/3.3.rst:2092 +#: whatsnew/3.3.rst:2093 msgid "" ":meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, " "and :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used " @@ -3067,32 +3330,36 @@ msgid "" "issue:`10775`.)" msgstr "" -#: whatsnew/3.3.rst:2097 +#: whatsnew/3.3.rst:2098 msgid "" ":meth:`unittest.TestCase.run` now returns the :class:`~unittest.TestResult` " "object." msgstr "" -#: whatsnew/3.3.rst:2102 +#: whatsnew/3.3.rst:2103 msgid "urllib" msgstr "" -#: whatsnew/3.3.rst:2104 +#: whatsnew/3.3.rst:2105 msgid "" "The :class:`~urllib.request.Request` class, now accepts a *method* argument " "used by :meth:`~urllib.request.Request.get_method` to determine what HTTP " "method should be used. For example, this will send a ``'HEAD'`` request::" msgstr "" -#: whatsnew/3.3.rst:2110 +#: whatsnew/3.3.rst:2109 +msgid ">>> urlopen(Request('https://www.python.org', method='HEAD'))" +msgstr "" + +#: whatsnew/3.3.rst:2111 msgid "(:issue:`1673007`)" msgstr "" -#: whatsnew/3.3.rst:2114 +#: whatsnew/3.3.rst:2115 msgid "webbrowser" msgstr "" -#: whatsnew/3.3.rst:2116 +#: whatsnew/3.3.rst:2117 msgid "" "The :mod:`webbrowser` module supports more \"browsers\": Google Chrome " "(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` or :" @@ -3103,14 +3370,14 @@ msgid "" "latter by Matthias Klose in :issue:`14493`.)" msgstr "" -#: whatsnew/3.3.rst:2126 +#: whatsnew/3.3.rst:2127 msgid "xml.etree.ElementTree" msgstr "" -#: whatsnew/3.3.rst:2128 +#: whatsnew/3.3.rst:2129 msgid "" "The :mod:`xml.etree.ElementTree` module now imports its C accelerator by " -"default; there is no longer a need to explicitly import :mod:`xml.etree." +"default; there is no longer a need to explicitly import :mod:`!xml.etree." "cElementTree` (this module stays for backwards compatibility, but is now " "deprecated). In addition, the ``iter`` family of methods of :class:`~xml." "etree.ElementTree.Element` has been optimized (rewritten in C). The module's " @@ -3118,252 +3385,252 @@ msgid "" "detailed reference." msgstr "" -#: whatsnew/3.3.rst:2138 +#: whatsnew/3.3.rst:2139 msgid "zlib" msgstr "" -#: whatsnew/3.3.rst:2140 +#: whatsnew/3.3.rst:2141 msgid "" "New attribute :attr:`zlib.Decompress.eof` makes it possible to distinguish " "between a properly formed compressed stream and an incomplete or truncated " "one. (Contributed by Nadeem Vawda in :issue:`12646`.)" msgstr "" -#: whatsnew/3.3.rst:2144 +#: whatsnew/3.3.rst:2145 msgid "" "New attribute :const:`zlib.ZLIB_RUNTIME_VERSION` reports the version string " "of the underlying ``zlib`` library that is loaded at runtime. (Contributed " "by Torsten Landschoff in :issue:`12306`.)" msgstr "" -#: whatsnew/3.3.rst:2150 +#: whatsnew/3.3.rst:2151 msgid "Optimizations" msgstr "" -#: whatsnew/3.3.rst:2152 +#: whatsnew/3.3.rst:2153 msgid "Major performance enhancements have been added:" msgstr "" -#: whatsnew/3.3.rst:2154 +#: whatsnew/3.3.rst:2155 msgid "" "Thanks to :pep:`393`, some operations on Unicode strings have been optimized:" msgstr "" -#: whatsnew/3.3.rst:2156 +#: whatsnew/3.3.rst:2157 msgid "the memory footprint is divided by 2 to 4 depending on the text" msgstr "" -#: whatsnew/3.3.rst:2157 +#: whatsnew/3.3.rst:2158 msgid "" "encode an ASCII string to UTF-8 doesn't need to encode characters anymore, " "the UTF-8 representation is shared with the ASCII representation" msgstr "" -#: whatsnew/3.3.rst:2159 +#: whatsnew/3.3.rst:2160 msgid "the UTF-8 encoder has been optimized" msgstr "" -#: whatsnew/3.3.rst:2160 +#: whatsnew/3.3.rst:2161 msgid "" "repeating a single ASCII letter and getting a substring of an ASCII string " "is 4 times faster" msgstr "" -#: whatsnew/3.3.rst:2163 +#: whatsnew/3.3.rst:2164 msgid "UTF-8 is now 2x to 4x faster. UTF-16 encoding is now up to 10x faster." msgstr "" -#: whatsnew/3.3.rst:2165 +#: whatsnew/3.3.rst:2166 msgid "" "(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" "`15026`.)" msgstr "" -#: whatsnew/3.3.rst:2170 +#: whatsnew/3.3.rst:2171 msgid "Build and C API Changes" msgstr "" -#: whatsnew/3.3.rst:2172 +#: whatsnew/3.3.rst:2173 msgid "Changes to Python's build process and to the C API include:" msgstr "" -#: whatsnew/3.3.rst:2174 +#: whatsnew/3.3.rst:2175 msgid "New :pep:`3118` related function:" msgstr "" -#: whatsnew/3.3.rst:2176 +#: whatsnew/3.3.rst:2177 msgid ":c:func:`PyMemoryView_FromMemory`" msgstr "" -#: whatsnew/3.3.rst:2178 +#: whatsnew/3.3.rst:2179 msgid ":pep:`393` added new Unicode types, macros and functions:" msgstr "" -#: whatsnew/3.3.rst:2180 +#: whatsnew/3.3.rst:2181 msgid "High-level API:" msgstr "" -#: whatsnew/3.3.rst:2182 +#: whatsnew/3.3.rst:2183 msgid ":c:func:`PyUnicode_CopyCharacters`" msgstr "" -#: whatsnew/3.3.rst:2183 +#: whatsnew/3.3.rst:2184 msgid ":c:func:`PyUnicode_FindChar`" msgstr "" -#: whatsnew/3.3.rst:2184 +#: whatsnew/3.3.rst:2185 msgid ":c:func:`PyUnicode_GetLength`, :c:macro:`PyUnicode_GET_LENGTH`" msgstr "" -#: whatsnew/3.3.rst:2185 +#: whatsnew/3.3.rst:2186 msgid ":c:func:`PyUnicode_New`" msgstr "" -#: whatsnew/3.3.rst:2186 +#: whatsnew/3.3.rst:2187 msgid ":c:func:`PyUnicode_Substring`" msgstr "" -#: whatsnew/3.3.rst:2187 +#: whatsnew/3.3.rst:2188 msgid ":c:func:`PyUnicode_ReadChar`, :c:func:`PyUnicode_WriteChar`" msgstr "" -#: whatsnew/3.3.rst:2189 +#: whatsnew/3.3.rst:2190 msgid "Low-level API:" msgstr "" -#: whatsnew/3.3.rst:2191 +#: whatsnew/3.3.rst:2192 msgid ":c:type:`Py_UCS1`, :c:type:`Py_UCS2`, :c:type:`Py_UCS4` types" msgstr "" -#: whatsnew/3.3.rst:2192 +#: whatsnew/3.3.rst:2193 msgid ":c:type:`PyASCIIObject` and :c:type:`PyCompactUnicodeObject` structures" msgstr "" -#: whatsnew/3.3.rst:2193 +#: whatsnew/3.3.rst:2194 msgid ":c:macro:`PyUnicode_READY`" msgstr "" -#: whatsnew/3.3.rst:2194 +#: whatsnew/3.3.rst:2195 msgid ":c:func:`PyUnicode_FromKindAndData`" msgstr "" -#: whatsnew/3.3.rst:2195 +#: whatsnew/3.3.rst:2196 msgid ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" msgstr "" -#: whatsnew/3.3.rst:2196 +#: whatsnew/3.3.rst:2197 msgid "" ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" "`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" msgstr "" -#: whatsnew/3.3.rst:2198 +#: whatsnew/3.3.rst:2199 msgid "" -":c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum: :c:data:`!" +":c:macro:`PyUnicode_KIND` with :c:enum:`!PyUnicode_Kind` enum: :c:data:`!" "PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:" "`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" msgstr "" -#: whatsnew/3.3.rst:2201 +#: whatsnew/3.3.rst:2202 msgid "" ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" "`PyUnicode_WRITE`" msgstr "" -#: whatsnew/3.3.rst:2202 +#: whatsnew/3.3.rst:2203 msgid ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" msgstr "" -#: whatsnew/3.3.rst:2204 +#: whatsnew/3.3.rst:2205 msgid "" ":c:macro:`PyArg_ParseTuple` now accepts a :class:`bytearray` for the ``c`` " "format (:issue:`12380`)." msgstr "" -#: whatsnew/3.3.rst:2210 +#: whatsnew/3.3.rst:2211 msgid "Deprecated" msgstr "" -#: whatsnew/3.3.rst:2213 +#: whatsnew/3.3.rst:2214 msgid "Unsupported Operating Systems" msgstr "" -#: whatsnew/3.3.rst:2215 +#: whatsnew/3.3.rst:2216 msgid "OS/2 and VMS are no longer supported due to the lack of a maintainer." msgstr "" -#: whatsnew/3.3.rst:2217 +#: whatsnew/3.3.rst:2218 msgid "" "Windows 2000 and Windows platforms which set ``COMSPEC`` to ``command.com`` " "are no longer supported due to maintenance burden." msgstr "" -#: whatsnew/3.3.rst:2220 +#: whatsnew/3.3.rst:2221 msgid "OSF support, which was deprecated in 3.2, has been completely removed." msgstr "" -#: whatsnew/3.3.rst:2224 +#: whatsnew/3.3.rst:2225 msgid "Deprecated Python modules, functions and methods" msgstr "" -#: whatsnew/3.3.rst:2226 +#: whatsnew/3.3.rst:2227 msgid "" "Passing a non-empty string to ``object.__format__()`` is deprecated, and " "will produce a :exc:`TypeError` in Python 3.4 (:issue:`9856`)." msgstr "" -#: whatsnew/3.3.rst:2228 +#: whatsnew/3.3.rst:2229 msgid "" "The ``unicode_internal`` codec has been deprecated because of the :pep:" "`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 " "(``utf-32-le`` or ``utf-32-be``)" msgstr "" -#: whatsnew/3.3.rst:2231 +#: whatsnew/3.3.rst:2232 msgid "" ":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP." "mlsd`" msgstr "" -#: whatsnew/3.3.rst:2233 +#: whatsnew/3.3.rst:2234 msgid "" -":func:`platform.popen`: use the :mod:`subprocess` module. Check especially " +":func:`!platform.popen`: use the :mod:`subprocess` module. Check especially " "the :ref:`subprocess-replacements` section (:issue:`11377`)." msgstr "" -#: whatsnew/3.3.rst:2235 +#: whatsnew/3.3.rst:2236 msgid "" ":issue:`13374`: The Windows bytes API has been deprecated in the :mod:`os` " "module. Use Unicode filenames, instead of bytes filenames, to not depend on " "the ANSI code page anymore and to support any filename." msgstr "" -#: whatsnew/3.3.rst:2238 +#: whatsnew/3.3.rst:2239 msgid "" -":issue:`13988`: The :mod:`xml.etree.cElementTree` module is deprecated. The " -"accelerator is used automatically whenever available." +":issue:`13988`: The :mod:`!xml.etree.cElementTree` module is deprecated. " +"The accelerator is used automatically whenever available." msgstr "" -#: whatsnew/3.3.rst:2240 +#: whatsnew/3.3.rst:2241 msgid "" -"The behaviour of :func:`time.clock` depends on the platform: use the new :" +"The behaviour of :func:`!time.clock` depends on the platform: use the new :" "func:`time.perf_counter` or :func:`time.process_time` function instead, " "depending on your requirements, to have a well defined behaviour." msgstr "" -#: whatsnew/3.3.rst:2243 -msgid "The :func:`os.stat_float_times` function is deprecated." +#: whatsnew/3.3.rst:2244 +msgid "The :func:`!os.stat_float_times` function is deprecated." msgstr "" -#: whatsnew/3.3.rst:2244 +#: whatsnew/3.3.rst:2245 msgid ":mod:`abc` module:" msgstr "" -#: whatsnew/3.3.rst:2253 +#: whatsnew/3.3.rst:2254 msgid ":mod:`importlib` package:" msgstr "" -#: whatsnew/3.3.rst:2255 +#: whatsnew/3.3.rst:2256 msgid "" ":meth:`importlib.abc.SourceLoader.path_mtime` is now deprecated in favour " "of :meth:`importlib.abc.SourceLoader.path_stats` as bytecode files now store " @@ -3371,206 +3638,206 @@ msgid "" "compiled from." msgstr "" -#: whatsnew/3.3.rst:2265 +#: whatsnew/3.3.rst:2266 msgid "Deprecated functions and types of the C API" msgstr "" -#: whatsnew/3.3.rst:2267 +#: whatsnew/3.3.rst:2268 msgid "" "The :c:type:`Py_UNICODE` has been deprecated by :pep:`393` and will be " "removed in Python 4. All functions using this type are deprecated:" msgstr "" -#: whatsnew/3.3.rst:2270 +#: whatsnew/3.3.rst:2271 msgid "" "Unicode functions and methods using :c:type:`Py_UNICODE` and :c:expr:" "`Py_UNICODE*` types:" msgstr "" -#: whatsnew/3.3.rst:2273 +#: whatsnew/3.3.rst:2274 msgid "" ":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or :" "c:func:`PyUnicode_FromKindAndData`" msgstr "" -#: whatsnew/3.3.rst:2275 +#: whatsnew/3.3.rst:2276 msgid "" ":c:macro:`!PyUnicode_AS_UNICODE`, :c:func:`!PyUnicode_AsUnicode`, :c:func:`!" "PyUnicode_AsUnicodeAndSize`: use :c:func:`PyUnicode_AsWideCharString`" msgstr "" -#: whatsnew/3.3.rst:2277 +#: whatsnew/3.3.rst:2278 msgid "" ":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with :c:macro:" "`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" msgstr "" -#: whatsnew/3.3.rst:2279 +#: whatsnew/3.3.rst:2280 msgid "" ":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use :c:macro:" "`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" msgstr "" -#: whatsnew/3.3.rst:2281 +#: whatsnew/3.3.rst:2282 msgid "" ":c:macro:`!PyUnicode_GET_DATA_SIZE`: use ``PyUnicode_GET_LENGTH(str) * " "PyUnicode_KIND(str)`` (only work on ready strings)" msgstr "" -#: whatsnew/3.3.rst:2284 +#: whatsnew/3.3.rst:2285 msgid "" ":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or :c:" "func:`PyUnicode_AsWideCharString`" msgstr "" -#: whatsnew/3.3.rst:2286 +#: whatsnew/3.3.rst:2287 msgid ":c:func:`!PyUnicode_GetMax`" msgstr "" -#: whatsnew/3.3.rst:2289 +#: whatsnew/3.3.rst:2290 msgid "Functions and macros manipulating Py_UNICODE* strings:" msgstr "" -#: whatsnew/3.3.rst:2291 +#: whatsnew/3.3.rst:2292 msgid "" ":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or :c:" "macro:`PyUnicode_GET_LENGTH`" msgstr "" -#: whatsnew/3.3.rst:2293 +#: whatsnew/3.3.rst:2294 msgid "" ":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or :" "c:func:`PyUnicode_FromFormat`" msgstr "" -#: whatsnew/3.3.rst:2295 +#: whatsnew/3.3.rst:2296 msgid "" ":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`, :c:macro:" "`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" "`PyUnicode_Substring`" msgstr "" -#: whatsnew/3.3.rst:2298 +#: whatsnew/3.3.rst:2299 msgid ":c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`" msgstr "" -#: whatsnew/3.3.rst:2299 +#: whatsnew/3.3.rst:2300 msgid ":c:macro:`!Py_UNICODE_strncmp()`: use :c:func:`PyUnicode_Tailmatch`" msgstr "" -#: whatsnew/3.3.rst:2300 +#: whatsnew/3.3.rst:2301 msgid "" ":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use :c:" "func:`PyUnicode_FindChar`" msgstr "" -#: whatsnew/3.3.rst:2302 +#: whatsnew/3.3.rst:2303 msgid ":c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`" msgstr "" -#: whatsnew/3.3.rst:2303 +#: whatsnew/3.3.rst:2304 msgid ":c:macro:`!Py_UNICODE_MATCH`" msgstr "" -#: whatsnew/3.3.rst:2305 +#: whatsnew/3.3.rst:2306 msgid "Encoders:" msgstr "" -#: whatsnew/3.3.rst:2307 +#: whatsnew/3.3.rst:2308 msgid ":c:func:`!PyUnicode_Encode`: use :c:func:`!PyUnicode_AsEncodedObject`" msgstr "" -#: whatsnew/3.3.rst:2308 +#: whatsnew/3.3.rst:2309 msgid ":c:func:`!PyUnicode_EncodeUTF7`" msgstr "" -#: whatsnew/3.3.rst:2309 +#: whatsnew/3.3.rst:2310 msgid "" ":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or :c:func:" "`PyUnicode_AsUTF8String`" msgstr "" -#: whatsnew/3.3.rst:2311 +#: whatsnew/3.3.rst:2312 msgid ":c:func:`!PyUnicode_EncodeUTF32`" msgstr "" -#: whatsnew/3.3.rst:2312 +#: whatsnew/3.3.rst:2313 msgid ":c:func:`!PyUnicode_EncodeUTF16`" msgstr "" -#: whatsnew/3.3.rst:2313 +#: whatsnew/3.3.rst:2314 msgid "" ":c:func:`!PyUnicode_EncodeUnicodeEscape` use :c:func:" "`PyUnicode_AsUnicodeEscapeString`" msgstr "" -#: whatsnew/3.3.rst:2315 +#: whatsnew/3.3.rst:2316 msgid "" ":c:func:`!PyUnicode_EncodeRawUnicodeEscape` use :c:func:" "`PyUnicode_AsRawUnicodeEscapeString`" msgstr "" -#: whatsnew/3.3.rst:2317 +#: whatsnew/3.3.rst:2318 msgid "" ":c:func:`!PyUnicode_EncodeLatin1`: use :c:func:`PyUnicode_AsLatin1String`" msgstr "" -#: whatsnew/3.3.rst:2318 +#: whatsnew/3.3.rst:2319 msgid ":c:func:`!PyUnicode_EncodeASCII`: use :c:func:`PyUnicode_AsASCIIString`" msgstr "" -#: whatsnew/3.3.rst:2319 +#: whatsnew/3.3.rst:2320 msgid ":c:func:`!PyUnicode_EncodeCharmap`" msgstr "" -#: whatsnew/3.3.rst:2320 +#: whatsnew/3.3.rst:2321 msgid ":c:func:`!PyUnicode_TranslateCharmap`" msgstr "" -#: whatsnew/3.3.rst:2321 +#: whatsnew/3.3.rst:2322 msgid "" ":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or :c:" "func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" msgstr "" -#: whatsnew/3.3.rst:2323 +#: whatsnew/3.3.rst:2324 msgid "" ":c:func:`!PyUnicode_EncodeDecimal`, :c:func:`!" "PyUnicode_TransformDecimalToASCII`" msgstr "" -#: whatsnew/3.3.rst:2328 +#: whatsnew/3.3.rst:2329 msgid "Deprecated features" msgstr "" -#: whatsnew/3.3.rst:2330 +#: whatsnew/3.3.rst:2331 msgid "" "The :mod:`array` module's ``'u'`` format code is now deprecated and will be " "removed in Python 4 together with the rest of the (:c:type:`Py_UNICODE`) API." msgstr "" -#: whatsnew/3.3.rst:2335 +#: whatsnew/3.3.rst:2336 msgid "Porting to Python 3.3" msgstr "" -#: whatsnew/3.3.rst:2337 +#: whatsnew/3.3.rst:2338 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: whatsnew/3.3.rst:2343 +#: whatsnew/3.3.rst:2344 msgid "Porting Python code" msgstr "" -#: whatsnew/3.3.rst:2345 +#: whatsnew/3.3.rst:2346 msgid "" "Hash randomization is enabled by default. Set the :envvar:`PYTHONHASHSEED` " "environment variable to ``0`` to disable hash randomization. See also the :" "meth:`object.__hash__` method." msgstr "" -#: whatsnew/3.3.rst:2349 +#: whatsnew/3.3.rst:2350 msgid "" ":issue:`12326`: On Linux, sys.platform doesn't contain the major version " "anymore. It is now always 'linux', instead of 'linux2' or 'linux3' depending " @@ -3579,7 +3846,7 @@ msgid "" "if you don't need to support older Python versions." msgstr "" -#: whatsnew/3.3.rst:2355 +#: whatsnew/3.3.rst:2356 msgid "" ":issue:`13847`, :issue:`14180`: :mod:`time` and :mod:`datetime`: :exc:" "`OverflowError` is now raised instead of :exc:`ValueError` if a timestamp is " @@ -3587,7 +3854,7 @@ msgid "" "or :c:func:`localtime` failed." msgstr "" -#: whatsnew/3.3.rst:2360 +#: whatsnew/3.3.rst:2361 msgid "" "The default finders used by import now utilize a cache of what is contained " "within a specific directory. If you create a Python source file or " @@ -3596,7 +3863,7 @@ msgid "" "file." msgstr "" -#: whatsnew/3.3.rst:2365 +#: whatsnew/3.3.rst:2366 msgid "" ":exc:`ImportError` now uses the full name of the module that was attempted " "to be imported. Doctests that check ImportErrors' message will need to be " @@ -3604,7 +3871,7 @@ msgid "" "name." msgstr "" -#: whatsnew/3.3.rst:2370 +#: whatsnew/3.3.rst:2371 msgid "" "The *index* argument to :func:`__import__` now defaults to 0 instead of -1 " "and no longer support negative values. It was an oversight when :pep:`328` " @@ -3615,20 +3882,20 @@ msgid "" "import_module` rather than call :func:`__import__` directly." msgstr "" -#: whatsnew/3.3.rst:2378 +#: whatsnew/3.3.rst:2379 msgid "" ":func:`__import__` no longer allows one to use an index value other than 0 " "for top-level modules. E.g. ``__import__('sys', level=1)`` is now an error." msgstr "" -#: whatsnew/3.3.rst:2381 +#: whatsnew/3.3.rst:2382 msgid "" "Because :data:`sys.meta_path` and :data:`sys.path_hooks` now have finders on " "them by default, you will most likely want to use :meth:`list.insert` " "instead of :meth:`list.append` to add to those lists." msgstr "" -#: whatsnew/3.3.rst:2385 +#: whatsnew/3.3.rst:2386 msgid "" "Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if " "you are clearing out entries in the dictionary of paths that do not have a " @@ -3639,7 +3906,7 @@ msgid "" "finders, but semantically it should not change anything." msgstr "" -#: whatsnew/3.3.rst:2393 +#: whatsnew/3.3.rst:2394 msgid "" ":class:`!importlib.abc.Finder` no longer specifies a ``find_module()`` " "abstract method that must be implemented. If you were relying on subclasses " @@ -3648,7 +3915,7 @@ msgid "" "in the case of working with :term:`path entry finders `." msgstr "" -#: whatsnew/3.3.rst:2399 +#: whatsnew/3.3.rst:2400 msgid "" ":mod:`pkgutil` has been converted to use :mod:`importlib` internally. This " "eliminates many edge cases where the old behaviour of the :pep:`302` import " @@ -3659,7 +3926,7 @@ msgid "" "do not provide the non-standard ``iter_modules()`` method." msgstr "" -#: whatsnew/3.3.rst:2407 +#: whatsnew/3.3.rst:2408 msgid "" "A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done by :" "func:`email.header.decode_header` has been fixed. Code that uses the " @@ -3673,7 +3940,7 @@ msgid "" "already present in the input strings." msgstr "" -#: whatsnew/3.3.rst:2418 +#: whatsnew/3.3.rst:2419 msgid "" ":func:`email.utils.formataddr` now does the correct content transfer " "encoding when passed non-``ASCII`` display names. Any code that depended on " @@ -3681,7 +3948,7 @@ msgid "" "formatted output string will need to be changed (:issue:`1690608`)." msgstr "" -#: whatsnew/3.3.rst:2423 +#: whatsnew/3.3.rst:2424 msgid "" ":meth:`poplib.POP3.quit` may now raise protocol errors like all other " "``poplib`` methods. Code that assumes ``quit`` does not raise :exc:`poplib." @@ -3689,57 +3956,57 @@ msgid "" "encountered by a particular application (:issue:`11291`)." msgstr "" -#: whatsnew/3.3.rst:2428 +#: whatsnew/3.3.rst:2429 msgid "" "The ``strict`` argument to :class:`email.parser.Parser`, deprecated since " "Python 2.4, has finally been removed." msgstr "" -#: whatsnew/3.3.rst:2431 +#: whatsnew/3.3.rst:2432 msgid "" "The deprecated method ``unittest.TestCase.assertSameElements`` has been " "removed." msgstr "" -#: whatsnew/3.3.rst:2434 +#: whatsnew/3.3.rst:2435 msgid "The deprecated variable ``time.accept2dyear`` has been removed." msgstr "" -#: whatsnew/3.3.rst:2436 +#: whatsnew/3.3.rst:2437 msgid "" "The deprecated ``Context._clamp`` attribute has been removed from the :mod:" "`decimal` module. It was previously replaced by the public attribute :attr:" "`~decimal.Context.clamp`. (See :issue:`8540`.)" msgstr "" -#: whatsnew/3.3.rst:2440 +#: whatsnew/3.3.rst:2441 msgid "" "The undocumented internal helper class ``SSLFakeFile`` has been removed " "from :mod:`smtplib`, since its functionality has long been provided directly " "by :meth:`socket.socket.makefile`." msgstr "" -#: whatsnew/3.3.rst:2444 +#: whatsnew/3.3.rst:2445 msgid "" "Passing a negative value to :func:`time.sleep` on Windows now raises an " "error instead of sleeping forever. It has always raised an error on posix." msgstr "" -#: whatsnew/3.3.rst:2447 +#: whatsnew/3.3.rst:2448 msgid "" "The ``ast.__version__`` constant has been removed. If you need to make " "decisions affected by the AST version, use :data:`sys.version_info` to make " "the decision." msgstr "" -#: whatsnew/3.3.rst:2451 +#: whatsnew/3.3.rst:2452 msgid "" "Code that used to work around the fact that the :mod:`threading` module used " "factory functions by subclassing the private classes will need to change to " "subclass the now-public classes." msgstr "" -#: whatsnew/3.3.rst:2455 +#: whatsnew/3.3.rst:2456 msgid "" "The undocumented debugging machinery in the threading module has been " "removed, simplifying the code. This should have no effect on production " @@ -3747,24 +4014,24 @@ msgid "" "interacting with it (:issue:`13550`)." msgstr "" -#: whatsnew/3.3.rst:2462 +#: whatsnew/3.3.rst:2463 msgid "Porting C code" msgstr "" -#: whatsnew/3.3.rst:2464 +#: whatsnew/3.3.rst:2465 msgid "" "In the course of changes to the buffer API the undocumented :c:member:`!" "smalltable` member of the :c:type:`Py_buffer` structure has been removed and " -"the layout of the :c:type:`PyMemoryViewObject` has changed." +"the layout of the :c:type:`!PyMemoryViewObject` has changed." msgstr "" -#: whatsnew/3.3.rst:2469 +#: whatsnew/3.3.rst:2470 msgid "" "All extensions relying on the relevant parts in ``memoryobject.h`` or " "``object.h`` must be rebuilt." msgstr "" -#: whatsnew/3.3.rst:2472 +#: whatsnew/3.3.rst:2473 msgid "" "Due to :ref:`PEP 393 `, the :c:type:`Py_UNICODE` type and all " "functions using this type are deprecated (but will stay available for at " @@ -3774,7 +4041,7 @@ msgid "" "doc:`Unicode API <../c-api/unicode>`." msgstr "" -#: whatsnew/3.3.rst:2479 +#: whatsnew/3.3.rst:2480 msgid "" "However, if you only have been using high-level functions such as :c:func:" "`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` or :c:func:" @@ -3782,11 +4049,11 @@ msgid "" "new unicode representations." msgstr "" -#: whatsnew/3.3.rst:2484 +#: whatsnew/3.3.rst:2485 msgid ":c:func:`PyImport_GetMagicNumber` now returns ``-1`` upon failure." msgstr "" -#: whatsnew/3.3.rst:2486 +#: whatsnew/3.3.rst:2487 msgid "" "As a negative value for the *level* argument to :func:`__import__` is no " "longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`. " @@ -3794,11 +4061,11 @@ msgid "" "`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." msgstr "" -#: whatsnew/3.3.rst:2493 +#: whatsnew/3.3.rst:2494 msgid "Building C extensions" msgstr "" -#: whatsnew/3.3.rst:2495 +#: whatsnew/3.3.rst:2496 msgid "" "The range of possible file names for C extensions has been narrowed. Very " "rarely used spellings have been suppressed: under POSIX, files named " @@ -3808,32 +4075,32 @@ msgid "" "remove the ``module`` string from the file names)." msgstr "" -#: whatsnew/3.3.rst:2503 +#: whatsnew/3.3.rst:2504 msgid "(implemented in :issue:`14040`.)" msgstr "" -#: whatsnew/3.3.rst:2507 +#: whatsnew/3.3.rst:2508 msgid "Command Line Switch Changes" msgstr "" -#: whatsnew/3.3.rst:2509 +#: whatsnew/3.3.rst:2510 msgid "" "The -Q command-line flag and related artifacts have been removed. Code " "checking sys.flags.division_warning will need updating." msgstr "" -#: whatsnew/3.3.rst:2512 +#: whatsnew/3.3.rst:2513 msgid "(:issue:`10998`, contributed by Éric Araujo.)" msgstr "" -#: whatsnew/3.3.rst:2514 +#: whatsnew/3.3.rst:2515 msgid "" "When :program:`python` is started with :option:`-S`, ``import site`` will no " "longer add site-specific paths to the module search paths. In previous " "versions, it did." msgstr "" -#: whatsnew/3.3.rst:2518 +#: whatsnew/3.3.rst:2519 msgid "" "(:issue:`11591`, contributed by Carl Meyer with editions by Éric Araujo.)" msgstr "" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 069e82db..a784151f 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -25,7 +26,7 @@ msgid "Author" msgstr "" #: whatsnew/3.4.rst:5 -msgid "R. David Murray (Editor)" +msgid "\\R. David Murray (Editor)" msgstr "" #: whatsnew/3.4.rst:63 @@ -160,9 +161,9 @@ msgstr "" #: whatsnew/3.4.rst:123 msgid "" ":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a new :" -"mod:`~email.message.Message` subclass (:class:`~email.contentmanager." -"EmailMessage`) that :ref:`simplify MIME handling " -"` (:issue:`18891`)." +"mod:`~email.message.Message` subclass (:class:`~email.message.EmailMessage`) " +"that :ref:`simplify MIME handling ` (:issue:" +"`18891`)." msgstr "" #: whatsnew/3.4.rst:127 @@ -242,7 +243,7 @@ msgstr "" #: whatsnew/3.4.rst:155 msgid "" "All modules in the standard library that support SSL now support server " -"certificate verification, including hostname matching (:func:`ssl." +"certificate verification, including hostname matching (:func:`!ssl." "match_hostname`) and CRLs (Certificate Revocation lists, see :func:`ssl." "SSLContext.load_verify_locations`)." msgstr "" @@ -338,13 +339,14 @@ msgstr "" #: whatsnew/3.4.rst:218 msgid "" -"As `discussed in the PEP`__, platform packagers may choose not to install " -"these commands by default, as long as, when invoked, they provide clear and " -"simple directions on how to install them on that platform (usually using the " -"system package manager)." +"As :pep:`discussed in the PEP <0453#recommendations-for-downstream-" +"distributors>` platform packagers may choose not to install these commands " +"by default, as long as, when invoked, they provide clear and simple " +"directions on how to install them on that platform (usually using the system " +"package manager)." msgstr "" -#: whatsnew/3.4.rst:227 +#: whatsnew/3.4.rst:226 msgid "" "To avoid conflicts between parallel Python 2 and Python 3 installations, " "only the versioned ``pip3`` and ``pip3.4`` commands are bootstrapped by " @@ -356,11 +358,11 @@ msgid "" "multiple Python installations." msgstr "" -#: whatsnew/3.4.rst:238 +#: whatsnew/3.4.rst:237 msgid "Documentation Changes" msgstr "" -#: whatsnew/3.4.rst:240 +#: whatsnew/3.4.rst:239 msgid "" "As part of this change, the :ref:`installing-index` and :ref:`distributing-" "index` sections of the documentation have been completely redesigned as " @@ -370,28 +372,28 @@ msgid "" "of the individual projects." msgstr "" -#: whatsnew/3.4.rst:248 +#: whatsnew/3.4.rst:247 msgid "" "However, as this migration is currently still incomplete, the legacy " "versions of those guides remaining available as :ref:`install-index` and :" "ref:`setuptools-index`." msgstr "" -#: whatsnew/3.4.rst:255 +#: whatsnew/3.4.rst:253 msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations" msgstr "" -#: whatsnew/3.4.rst:255 +#: whatsnew/3.4.rst:254 msgid "" "PEP written by Donald Stufft and Nick Coghlan, implemented by Donald Stufft, " "Nick Coghlan, Martin von Löwis and Ned Deily." msgstr "" -#: whatsnew/3.4.rst:262 +#: whatsnew/3.4.rst:261 msgid "PEP 446: Newly Created File Descriptors Are Non-Inheritable" msgstr "" -#: whatsnew/3.4.rst:264 +#: whatsnew/3.4.rst:263 msgid "" ":pep:`446` makes newly created file descriptors :ref:`non-inheritable " "`. In general, this is the behavior an application will " @@ -400,26 +402,26 @@ msgid "" "to security issues." msgstr "" -#: whatsnew/3.4.rst:270 +#: whatsnew/3.4.rst:269 msgid "" "However, there are occasions when inheritance is desired. To support these " "cases, the following new functions and methods are available:" msgstr "" -#: whatsnew/3.4.rst:273 +#: whatsnew/3.4.rst:272 msgid ":func:`os.get_inheritable`, :func:`os.set_inheritable`" msgstr "" -#: whatsnew/3.4.rst:274 +#: whatsnew/3.4.rst:273 msgid ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" msgstr "" -#: whatsnew/3.4.rst:275 +#: whatsnew/3.4.rst:274 msgid "" ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" msgstr "" -#: whatsnew/3.4.rst:279 +#: whatsnew/3.4.rst:278 msgid ":pep:`446` -- Make newly created file descriptors non-inheritable" msgstr "" @@ -427,11 +429,11 @@ msgstr "" msgid "PEP written and implemented by Victor Stinner." msgstr "" -#: whatsnew/3.4.rst:286 +#: whatsnew/3.4.rst:285 msgid "Improvements to Codec Handling" msgstr "" -#: whatsnew/3.4.rst:288 +#: whatsnew/3.4.rst:287 msgid "" "Since it was first introduced, the :mod:`codecs` module has always been " "intended to operate as a type-neutral dynamic encoding and decoding system. " @@ -440,7 +442,7 @@ msgid "" "and :class:`bytearray` types, has historically obscured that fact." msgstr "" -#: whatsnew/3.4.rst:295 +#: whatsnew/3.4.rst:294 msgid "" "As a key step in clarifying the situation, the :meth:`codecs.encode` and :" "meth:`codecs.decode` convenience functions are now properly documented in " @@ -449,7 +451,7 @@ msgid "" "2.4, but were previously only discoverable through runtime introspection." msgstr "" -#: whatsnew/3.4.rst:301 +#: whatsnew/3.4.rst:300 msgid "" "Unlike the convenience methods on :class:`str`, :class:`bytes` and :class:" "`bytearray`, the :mod:`codecs` convenience functions support arbitrary " @@ -458,14 +460,35 @@ msgid "" "conversions (in Python 2)." msgstr "" -#: whatsnew/3.4.rst:307 +#: whatsnew/3.4.rst:306 msgid "" "In Python 3.4, the interpreter is able to identify the known non-text " "encodings provided in the standard library and direct users towards these " "general purpose convenience functions when appropriate::" msgstr "" -#: whatsnew/3.4.rst:326 +#: whatsnew/3.4.rst:310 +msgid "" +">>> b\"abcdef\".decode(\"hex\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"LookupError: 'hex' is not a text encoding; use codecs.decode() to handle " +"arbitrary codecs\n" +"\n" +">>> \"hello\".encode(\"rot13\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"LookupError: 'rot13' is not a text encoding; use codecs.encode() to handle " +"arbitrary codecs\n" +"\n" +">>> open(\"foo.txt\", encoding=\"hex\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"LookupError: 'hex' is not a text encoding; use codecs.open() to handle " +"arbitrary codecs" +msgstr "" + +#: whatsnew/3.4.rst:325 msgid "" "In a related change, whenever it is feasible without breaking backwards " "compatibility, exceptions raised during encoding and decoding operations are " @@ -473,7 +496,42 @@ msgid "" "the codec responsible for producing the error::" msgstr "" -#: whatsnew/3.4.rst:359 +#: whatsnew/3.4.rst:330 +msgid "" +">>> import codecs\n" +"\n" +">>> codecs.decode(b\"abcdefgh\", \"hex\")\n" +"Traceback (most recent call last):\n" +" File \"/usr/lib/python3.4/encodings/hex_codec.py\", line 20, in " +"hex_decode\n" +" return (binascii.a2b_hex(input), len(input))\n" +"binascii.Error: Non-hexadecimal digit found\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"binascii.Error: decoding with 'hex' codec failed (Error: Non-hexadecimal " +"digit found)\n" +"\n" +">>> codecs.encode(\"hello\", \"bz2\")\n" +"Traceback (most recent call last):\n" +" File \"/usr/lib/python3.4/encodings/bz2_codec.py\", line 17, in " +"bz2_encode\n" +" return (bz2.compress(input), len(input))\n" +" File \"/usr/lib/python3.4/bz2.py\", line 498, in compress\n" +" return comp.compress(data) + comp.flush()\n" +"TypeError: 'str' does not support the buffer interface\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: encoding with 'bz2' codec failed (TypeError: 'str' does not " +"support the buffer interface)" +msgstr "" + +#: whatsnew/3.4.rst:358 msgid "" "Finally, as the examples above show, these improvements have permitted the " "restoration of the convenience aliases for the non-Unicode codecs that were " @@ -481,23 +539,32 @@ msgid "" "and from its hexadecimal representation (for example) can now be written as::" msgstr "" -#: whatsnew/3.4.rst:371 +#: whatsnew/3.4.rst:364 +msgid "" +">>> from codecs import encode, decode\n" +">>> encode(b\"hello\", \"hex\")\n" +"b'68656c6c6f'\n" +">>> decode(b\"68656c6c6f\", \"hex\")\n" +"b'hello'" +msgstr "" + +#: whatsnew/3.4.rst:370 msgid "" "The binary and text transforms provided in the standard library are detailed " "in :ref:`binary-transforms` and :ref:`text-transforms`." msgstr "" -#: whatsnew/3.4.rst:374 +#: whatsnew/3.4.rst:373 msgid "" "(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" "`17828` and :issue:`19619`.)" msgstr "" -#: whatsnew/3.4.rst:381 +#: whatsnew/3.4.rst:380 msgid "PEP 451: A ModuleSpec Type for the Import System" msgstr "" -#: whatsnew/3.4.rst:383 +#: whatsnew/3.4.rst:382 msgid "" ":pep:`451` provides an encapsulation of the information about a module that " "the import machinery will use to load it (that is, a module specification). " @@ -506,7 +573,7 @@ msgid "" "related improvements`__." msgstr "" -#: whatsnew/3.4.rst:391 +#: whatsnew/3.4.rst:390 msgid "" "The public-facing changes from the PEP are entirely backward-compatible. " "Furthermore, they should be transparent to everyone but importer authors. " @@ -517,19 +584,19 @@ msgid "" "and their replacements." msgstr "" -#: whatsnew/3.4.rst:401 +#: whatsnew/3.4.rst:400 msgid "Other Language Changes" msgstr "" -#: whatsnew/3.4.rst:403 +#: whatsnew/3.4.rst:402 msgid "Some smaller changes made to the core Python language are:" msgstr "" -#: whatsnew/3.4.rst:405 +#: whatsnew/3.4.rst:404 msgid "Unicode database updated to UCD version 6.3." msgstr "" -#: whatsnew/3.4.rst:407 +#: whatsnew/3.4.rst:406 msgid "" ":func:`min` and :func:`max` now accept a *default* keyword-only argument " "that can be used to specify the value they return if the iterable they are " @@ -537,11 +604,11 @@ msgid "" "`18111`.)" msgstr "" -#: whatsnew/3.4.rst:412 +#: whatsnew/3.4.rst:411 msgid "Module objects are now :ref:`weakly referenceable `." msgstr "" -#: whatsnew/3.4.rst:414 +#: whatsnew/3.4.rst:413 msgid "" "Module ``__file__`` attributes (and related values) should now always " "contain absolute paths by default, with the sole exception of ``__main__." @@ -549,7 +616,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`18416`.)" msgstr "" -#: whatsnew/3.4.rst:419 +#: whatsnew/3.4.rst:418 msgid "" "All the UTF-\\* codecs (except UTF-7) now reject surrogates during both " "encoding and decoding unless the ``surrogatepass`` error handler is used, " @@ -559,69 +626,69 @@ msgid "" "Storchaka in :issue:`12892`.)" msgstr "" -#: whatsnew/3.4.rst:426 +#: whatsnew/3.4.rst:425 msgid "" "New German EBCDIC :ref:`codec ` ``cp273``. (Contributed " "by Michael Bierenfeld and Andrew Kuchling in :issue:`1097797`.)" msgstr "" -#: whatsnew/3.4.rst:429 +#: whatsnew/3.4.rst:428 msgid "" "New Ukrainian :ref:`codec ` ``cp1125``. (Contributed by " "Serhiy Storchaka in :issue:`19668`.)" msgstr "" -#: whatsnew/3.4.rst:432 +#: whatsnew/3.4.rst:431 msgid "" ":class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary " "buffer objects as arguments. (Contributed by Antoine Pitrou in :issue:" "`15958`.)" msgstr "" -#: whatsnew/3.4.rst:436 +#: whatsnew/3.4.rst:435 msgid "" "The :class:`int` constructor now accepts any object that has an " "``__index__`` method for its *base* argument. (Contributed by Mark " "Dickinson in :issue:`16772`.)" msgstr "" -#: whatsnew/3.4.rst:440 +#: whatsnew/3.4.rst:439 msgid "" "Frame objects now have a :func:`~frame.clear` method that clears all " "references to local variables from the frame. (Contributed by Antoine " "Pitrou in :issue:`17934`.)" msgstr "" -#: whatsnew/3.4.rst:444 +#: whatsnew/3.4.rst:443 msgid "" ":class:`memoryview` is now registered as a :class:`Sequence `, and supports the :func:`reversed` builtin. (Contributed by Nick " "Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" msgstr "" -#: whatsnew/3.4.rst:448 +#: whatsnew/3.4.rst:447 msgid "" "Signatures reported by :func:`help` have been modified and improved in " "several cases as a result of the introduction of Argument Clinic and other " "changes to the :mod:`inspect` and :mod:`pydoc` modules." msgstr "" -#: whatsnew/3.4.rst:452 +#: whatsnew/3.4.rst:451 msgid "" ":meth:`~object.__length_hint__` is now part of the formal language " "specification (see :pep:`424`). (Contributed by Armin Ronacher in :issue:" "`16148`.)" msgstr "" -#: whatsnew/3.4.rst:458 +#: whatsnew/3.4.rst:457 msgid "New Modules" msgstr "" -#: whatsnew/3.4.rst:464 +#: whatsnew/3.4.rst:463 msgid "asyncio" msgstr "" -#: whatsnew/3.4.rst:466 +#: whatsnew/3.4.rst:465 msgid "" "The new :mod:`asyncio` module (defined in :pep:`3156`) provides a standard " "pluggable event loop model for Python, providing solid asynchronous IO " @@ -629,23 +696,23 @@ msgid "" "implementations to interoperate with the standard library and each other." msgstr "" -#: whatsnew/3.4.rst:534 +#: whatsnew/3.4.rst:533 msgid "For Python 3.4, this module is considered a :term:`provisional API`." msgstr "" -#: whatsnew/3.4.rst:475 +#: whatsnew/3.4.rst:474 msgid ":pep:`3156` -- Asynchronous IO Support Rebooted: the \"asyncio\" Module" msgstr "" -#: whatsnew/3.4.rst:476 +#: whatsnew/3.4.rst:475 msgid "PEP written and implementation led by Guido van Rossum." msgstr "" -#: whatsnew/3.4.rst:482 +#: whatsnew/3.4.rst:481 msgid "ensurepip" msgstr "" -#: whatsnew/3.4.rst:484 +#: whatsnew/3.4.rst:483 msgid "" "The new :mod:`ensurepip` module is the primary infrastructure for the :pep:" "`453` implementation. In the normal course of events end users will not " @@ -654,7 +721,7 @@ msgid "" "environment was declined." msgstr "" -#: whatsnew/3.4.rst:490 +#: whatsnew/3.4.rst:489 msgid "" ":mod:`ensurepip` includes a bundled copy of ``pip``, up-to-date as of the " "first release candidate of the release of CPython with which it ships (this " @@ -666,7 +733,7 @@ msgid "" "package and will not be removed if Python is uninstalled.)" msgstr "" -#: whatsnew/3.4.rst:499 +#: whatsnew/3.4.rst:498 msgid "" "The module is named *ensure*\\ pip because if called when ``pip`` is already " "installed, it does nothing. It also has an ``--upgrade`` option that will " @@ -674,11 +741,11 @@ msgid "" "version of ``pip`` is older than the bundled copy." msgstr "" -#: whatsnew/3.4.rst:508 +#: whatsnew/3.4.rst:507 msgid "enum" msgstr "" -#: whatsnew/3.4.rst:510 +#: whatsnew/3.4.rst:509 msgid "" "The new :mod:`enum` module (defined in :pep:`435`) provides a standard " "implementation of enumeration types, allowing other modules (such as :mod:" @@ -687,21 +754,21 @@ msgid "" "enumeration values." msgstr "" -#: whatsnew/3.4.rst:519 +#: whatsnew/3.4.rst:517 msgid ":pep:`435` -- Adding an Enum type to the Python standard library" msgstr "" -#: whatsnew/3.4.rst:519 +#: whatsnew/3.4.rst:518 msgid "" "PEP written by Barry Warsaw, Eli Bendersky and Ethan Furman, implemented by " "Ethan Furman." msgstr "" -#: whatsnew/3.4.rst:526 +#: whatsnew/3.4.rst:525 msgid "pathlib" msgstr "" -#: whatsnew/3.4.rst:528 +#: whatsnew/3.4.rst:527 msgid "" "The new :mod:`pathlib` module offers classes representing filesystem paths " "with semantics appropriate for different operating systems. Path classes " @@ -710,7 +777,7 @@ msgid "" "but also provide I/O operations." msgstr "" -#: whatsnew/3.4.rst:538 +#: whatsnew/3.4.rst:537 msgid ":pep:`428` -- The pathlib module -- object-oriented filesystem paths" msgstr "" @@ -718,22 +785,22 @@ msgstr "" msgid "PEP written and implemented by Antoine Pitrou." msgstr "" -#: whatsnew/3.4.rst:545 +#: whatsnew/3.4.rst:544 msgid "selectors" msgstr "" -#: whatsnew/3.4.rst:547 +#: whatsnew/3.4.rst:546 msgid "" "The new :mod:`selectors` module (created as part of implementing :pep:" "`3156`) allows high-level and efficient I/O multiplexing, built upon the :" "mod:`select` module primitives." msgstr "" -#: whatsnew/3.4.rst:555 +#: whatsnew/3.4.rst:554 msgid "statistics" msgstr "" -#: whatsnew/3.4.rst:557 +#: whatsnew/3.4.rst:556 msgid "" "The new :mod:`statistics` module (defined in :pep:`450`) offers some core " "statistics functionality directly in the standard library. This module " @@ -741,64 +808,64 @@ msgid "" "deviation of a data series." msgstr "" -#: whatsnew/3.4.rst:564 +#: whatsnew/3.4.rst:563 msgid ":pep:`450` -- Adding A Statistics Module To The Standard Library" msgstr "" -#: whatsnew/3.4.rst:565 +#: whatsnew/3.4.rst:564 msgid "PEP written and implemented by Steven D'Aprano" msgstr "" -#: whatsnew/3.4.rst:571 +#: whatsnew/3.4.rst:570 msgid "tracemalloc" msgstr "" -#: whatsnew/3.4.rst:573 +#: whatsnew/3.4.rst:572 msgid "" "The new :mod:`tracemalloc` module (defined in :pep:`454`) is a debug tool to " "trace memory blocks allocated by Python. It provides the following " "information:" msgstr "" -#: whatsnew/3.4.rst:576 +#: whatsnew/3.4.rst:575 msgid "Trace where an object was allocated" msgstr "" -#: whatsnew/3.4.rst:577 +#: whatsnew/3.4.rst:576 msgid "" "Statistics on allocated memory blocks per filename and per line number: " "total size, number and average size of allocated memory blocks" msgstr "" -#: whatsnew/3.4.rst:579 +#: whatsnew/3.4.rst:578 msgid "Compute the differences between two snapshots to detect memory leaks" msgstr "" -#: whatsnew/3.4.rst:583 +#: whatsnew/3.4.rst:582 msgid "" ":pep:`454` -- Add a new tracemalloc module to trace Python memory allocations" msgstr "" -#: whatsnew/3.4.rst:584 +#: whatsnew/3.4.rst:583 msgid "PEP written and implemented by Victor Stinner" msgstr "" -#: whatsnew/3.4.rst:589 +#: whatsnew/3.4.rst:588 msgid "Improved Modules" msgstr "" -#: whatsnew/3.4.rst:593 +#: whatsnew/3.4.rst:592 msgid "abc" msgstr "" -#: whatsnew/3.4.rst:595 +#: whatsnew/3.4.rst:594 msgid "" "New function :func:`abc.get_cache_token` can be used to know when to " "invalidate caches that are affected by changes in the object graph. " "(Contributed by Łukasz Langa in :issue:`16832`.)" msgstr "" -#: whatsnew/3.4.rst:599 +#: whatsnew/3.4.rst:598 msgid "" "New class :class:`~abc.ABC` has :class:`~abc.ABCMeta` as its meta class. " "Using ``ABC`` as a base class has essentially the same effect as specifying " @@ -806,70 +873,70 @@ msgid "" "(Contributed by Bruno Dupuis in :issue:`16049`.)" msgstr "" -#: whatsnew/3.4.rst:606 +#: whatsnew/3.4.rst:605 msgid "aifc" msgstr "" -#: whatsnew/3.4.rst:608 +#: whatsnew/3.4.rst:607 msgid "" -"The :meth:`~aifc.aifc.getparams` method now returns a namedtuple rather than " -"a plain tuple. (Contributed by Claudiu Popa in :issue:`17818`.)" +"The :meth:`!getparams` method now returns a namedtuple rather than a plain " +"tuple. (Contributed by Claudiu Popa in :issue:`17818`.)" msgstr "" -#: whatsnew/3.4.rst:611 +#: whatsnew/3.4.rst:610 msgid "" -":func:`aifc.open` now supports the context management protocol: when used in " -"a :keyword:`with` block, the :meth:`~aifc.aifc.close` method of the returned " -"object will be called automatically at the end of the block. (Contributed " -"by Serhiy Storchacha in :issue:`16486`.)" +":func:`!aifc.open` now supports the context management protocol: when used " +"in a :keyword:`with` block, the :meth:`!close` method of the returned object " +"will be called automatically at the end of the block. (Contributed by " +"Serhiy Storchacha in :issue:`16486`.)" msgstr "" -#: whatsnew/3.4.rst:616 +#: whatsnew/3.4.rst:1543 msgid "" -"The :meth:`~aifc.aifc.writeframesraw` and :meth:`~aifc.aifc.writeframes` " -"methods now accept any :term:`bytes-like object`. (Contributed by Serhiy " -"Storchaka in :issue:`8311`.)" +"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" +"term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" +"`8311`.)" msgstr "" -#: whatsnew/3.4.rst:622 +#: whatsnew/3.4.rst:621 msgid "argparse" msgstr "" -#: whatsnew/3.4.rst:624 +#: whatsnew/3.4.rst:623 msgid "" "The :class:`~argparse.FileType` class now accepts *encoding* and *errors* " "arguments, which are passed through to :func:`open`. (Contributed by Lucas " "Maystre in :issue:`11175`.)" msgstr "" -#: whatsnew/3.4.rst:630 +#: whatsnew/3.4.rst:629 msgid "audioop" msgstr "" -#: whatsnew/3.4.rst:632 +#: whatsnew/3.4.rst:631 msgid "" -":mod:`audioop` now supports 24-bit samples. (Contributed by Serhiy " +":mod:`!audioop` now supports 24-bit samples. (Contributed by Serhiy " "Storchaka in :issue:`12866`.)" msgstr "" -#: whatsnew/3.4.rst:635 +#: whatsnew/3.4.rst:634 msgid "" -"New :func:`~audioop.byteswap` function converts big-endian samples to little-" -"endian and vice versa. (Contributed by Serhiy Storchaka in :issue:`19641`.)" +"New :func:`!byteswap` function converts big-endian samples to little-endian " +"and vice versa. (Contributed by Serhiy Storchaka in :issue:`19641`.)" msgstr "" -#: whatsnew/3.4.rst:639 +#: whatsnew/3.4.rst:638 msgid "" -"All :mod:`audioop` functions now accept any :term:`bytes-like object`. " +"All :mod:`!audioop` functions now accept any :term:`bytes-like object`. " "Strings are not accepted: they didn't work before, now they raise an error " "right away. (Contributed by Serhiy Storchaka in :issue:`16685`.)" msgstr "" -#: whatsnew/3.4.rst:645 +#: whatsnew/3.4.rst:644 msgid "base64" msgstr "" -#: whatsnew/3.4.rst:647 +#: whatsnew/3.4.rst:646 msgid "" "The encoding and decoding functions in :mod:`base64` now accept any :term:" "`bytes-like object` in cases where it previously required a :class:`bytes` " @@ -877,7 +944,7 @@ msgid "" "`17839`.)" msgstr "" -#: whatsnew/3.4.rst:652 +#: whatsnew/3.4.rst:651 msgid "" "New functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:" "`~base64.b85encode`, and :func:`~base64.b85decode` provide the ability to " @@ -888,11 +955,11 @@ msgid "" "Mercurial project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" msgstr "" -#: whatsnew/3.4.rst:662 +#: whatsnew/3.4.rst:661 msgid "collections" msgstr "" -#: whatsnew/3.4.rst:664 +#: whatsnew/3.4.rst:663 msgid "" "The :meth:`.ChainMap.new_child` method now accepts an *m* argument " "specifying the child map to add to the chain. This allows an existing " @@ -900,11 +967,11 @@ msgid "" "by Vinay Sajip in :issue:`16613`.)" msgstr "" -#: whatsnew/3.4.rst:671 +#: whatsnew/3.4.rst:670 msgid "colorsys" msgstr "" -#: whatsnew/3.4.rst:673 +#: whatsnew/3.4.rst:672 msgid "" "The number of digits in the coefficients for the RGB --- YIQ conversions " "have been expanded so that they match the FCC NTSC versions. The change in " @@ -912,11 +979,11 @@ msgid "" "(Contributed by Brian Landers and Serhiy Storchaka in :issue:`14323`.)" msgstr "" -#: whatsnew/3.4.rst:680 +#: whatsnew/3.4.rst:679 msgid "contextlib" msgstr "" -#: whatsnew/3.4.rst:682 +#: whatsnew/3.4.rst:681 msgid "" "The new :class:`contextlib.suppress` context manager helps to clarify the " "intent of code that deliberately suppresses exceptions from a single " @@ -924,7 +991,7 @@ msgid "" "Piraeus in :issue:`19266`.)" msgstr "" -#: whatsnew/3.4.rst:687 +#: whatsnew/3.4.rst:686 msgid "" "The new :func:`contextlib.redirect_stdout` context manager makes it easier " "for utility scripts to handle inflexible APIs that write their output to :" @@ -937,18 +1004,18 @@ msgid "" "data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" msgstr "" -#: whatsnew/3.4.rst:698 +#: whatsnew/3.4.rst:697 msgid "" "The :mod:`contextlib` documentation has also been updated to include a :ref:" "`discussion ` of the differences " "between single use, reusable and reentrant context managers." msgstr "" -#: whatsnew/3.4.rst:704 +#: whatsnew/3.4.rst:703 msgid "dbm" msgstr "" -#: whatsnew/3.4.rst:706 +#: whatsnew/3.4.rst:705 msgid "" ":func:`dbm.open` objects now support the context management protocol. When " "used in a :keyword:`with` statement, the ``close`` method of the database " @@ -956,25 +1023,25 @@ msgid "" "by Claudiu Popa and Nick Coghlan in :issue:`19282`.)" msgstr "" -#: whatsnew/3.4.rst:713 +#: whatsnew/3.4.rst:712 msgid "dis" msgstr "" -#: whatsnew/3.4.rst:715 +#: whatsnew/3.4.rst:714 msgid "" "Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, and :" "func:`~dis.disassemble` now accept a keyword-only *file* argument that " "controls where they write their output." msgstr "" -#: whatsnew/3.4.rst:719 +#: whatsnew/3.4.rst:718 msgid "" "The :mod:`dis` module is now built around an :class:`~dis.Instruction` class " "that provides object oriented access to the details of each individual " "bytecode operation." msgstr "" -#: whatsnew/3.4.rst:723 +#: whatsnew/3.4.rst:722 msgid "" "A new method, :func:`~dis.get_instructions`, provides an iterator that emits " "the Instruction stream for a given piece of Python code. Thus it is now " @@ -983,25 +1050,53 @@ msgid "" "example::" msgstr "" -#: whatsnew/3.4.rst:737 +#: whatsnew/3.4.rst:728 +msgid "" +">>> import dis\n" +">>> for instr in dis.get_instructions(lambda x: x + 1):\n" +"... print(instr.opname)\n" +"LOAD_FAST\n" +"LOAD_CONST\n" +"BINARY_ADD\n" +"RETURN_VALUE" +msgstr "" + +#: whatsnew/3.4.rst:736 msgid "" "The various display tools in the :mod:`dis` module have been rewritten to " "use these new components." msgstr "" -#: whatsnew/3.4.rst:740 +#: whatsnew/3.4.rst:739 msgid "" "In addition, a new application-friendly class :class:`~dis.Bytecode` " "provides an object-oriented API for inspecting bytecode in both in human-" "readable form and for iterating over instructions. The :class:`~dis." "Bytecode` constructor takes the same arguments that :func:`~dis." -"get_instruction` does (plus an optional *current_offset*), and the resulting " -"object can be iterated to produce :class:`~dis.Instruction` objects. But it " -"also has a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis." -"dis` on the constructor argument, but returned as a multi-line string::" +"get_instructions` does (plus an optional *current_offset*), and the " +"resulting object can be iterated to produce :class:`~dis.Instruction` " +"objects. But it also has a :mod:`~dis.Bytecode.dis` method, equivalent to " +"calling :mod:`~dis.dis` on the constructor argument, but returned as a multi-" +"line string::" +msgstr "" + +#: whatsnew/3.4.rst:748 +msgid "" +">>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)\n" +">>> for instr in bytecode:\n" +"... print('{} ({})'.format(instr.opname, instr.opcode))\n" +"LOAD_FAST (124)\n" +"LOAD_CONST (100)\n" +"BINARY_ADD (23)\n" +"RETURN_VALUE (83)\n" +">>> bytecode.dis().splitlines()\n" +"[' 1 0 LOAD_FAST 0 (x)',\n" +" ' --> 3 LOAD_CONST 1 (1)',\n" +" ' 6 BINARY_ADD',\n" +" ' 7 RETURN_VALUE']" msgstr "" -#: whatsnew/3.4.rst:762 +#: whatsnew/3.4.rst:761 msgid "" ":class:`~dis.Bytecode` also has a class method, :meth:`~dis.Bytecode." "from_traceback`, that provides the ability to manipulate a traceback (that " @@ -1009,31 +1104,31 @@ msgid "" "``distb(tb)``)." msgstr "" -#: whatsnew/3.4.rst:767 +#: whatsnew/3.4.rst:766 msgid "" "(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" "`11816` and Claudiu Popa in :issue:`17916`.)" msgstr "" -#: whatsnew/3.4.rst:770 +#: whatsnew/3.4.rst:769 msgid "" "New function :func:`~dis.stack_effect` computes the effect on the Python " "stack of a given opcode and argument, information that is not otherwise " "available. (Contributed by Larry Hastings in :issue:`19722`.)" msgstr "" -#: whatsnew/3.4.rst:776 +#: whatsnew/3.4.rst:775 msgid "doctest" msgstr "" -#: whatsnew/3.4.rst:778 +#: whatsnew/3.4.rst:777 msgid "" "A new :ref:`option flag `, :const:`~doctest.FAIL_FAST`, " "halts test running as soon as the first failure is detected. (Contributed " "by R. David Murray and Daniel Urban in :issue:`16522`.)" msgstr "" -#: whatsnew/3.4.rst:782 +#: whatsnew/3.4.rst:781 msgid "" "The :mod:`doctest` command line interface now uses :mod:`argparse`, and has " "two new options, ``-o`` and ``-f``. ``-o`` allows :ref:`doctest options " @@ -1043,17 +1138,17 @@ msgid "" "`11390`.)" msgstr "" -#: whatsnew/3.4.rst:788 +#: whatsnew/3.4.rst:787 msgid "" ":mod:`doctest` will now find doctests in extension module ``__doc__`` " "strings. (Contributed by Zachary Ware in :issue:`3158`.)" msgstr "" -#: whatsnew/3.4.rst:793 +#: whatsnew/3.4.rst:792 msgid "email" msgstr "" -#: whatsnew/3.4.rst:795 +#: whatsnew/3.4.rst:794 msgid "" ":meth:`~email.message.Message.as_string` now accepts a *policy* argument to " "override the default policy of the message when generating a string " @@ -1063,7 +1158,7 @@ msgid "" "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" -#: whatsnew/3.4.rst:802 +#: whatsnew/3.4.rst:801 msgid "" "New method :meth:`~email.message.Message.as_bytes` added to produce a bytes " "representation of the message in a fashion similar to how ``as_string`` " @@ -1075,7 +1170,7 @@ msgid "" "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" -#: whatsnew/3.4.rst:811 +#: whatsnew/3.4.rst:810 msgid "" "The :meth:`.Message.set_param` message now accepts a *replace* keyword " "argument. When specified, the associated header will be updated without " @@ -1084,7 +1179,7 @@ msgid "" "`18891`.)" msgstr "" -#: whatsnew/3.4.rst:819 +#: whatsnew/3.4.rst:818 msgid "" "A pair of new subclasses of :class:`~email.message.Message` have been added " "(:class:`.EmailMessage` and :class:`.MIMEPart`), along with a new sub-" @@ -1101,11 +1196,11 @@ msgid "" "handling). (Contributed by R. David Murray in :issue:`18891`.)" msgstr "" -#: whatsnew/3.4.rst:835 +#: whatsnew/3.4.rst:834 msgid "filecmp" msgstr "" -#: whatsnew/3.4.rst:837 +#: whatsnew/3.4.rst:836 msgid "" "A new :func:`~filecmp.clear_cache` function provides the ability to clear " "the :mod:`filecmp` comparison cache, which uses :func:`os.stat` information " @@ -1115,7 +1210,7 @@ msgid "" "time field. (Contributed by Mark Levitt in :issue:`18149`.)" msgstr "" -#: whatsnew/3.4.rst:844 +#: whatsnew/3.4.rst:843 msgid "" "New module attribute :const:`~filecmp.DEFAULT_IGNORES` provides the list of " "directories that are used as the default value for the *ignore* parameter of " @@ -1123,11 +1218,11 @@ msgid "" "issue:`15442`.)" msgstr "" -#: whatsnew/3.4.rst:851 +#: whatsnew/3.4.rst:850 msgid "functools" msgstr "" -#: whatsnew/3.4.rst:853 +#: whatsnew/3.4.rst:852 msgid "" "The new :func:`~functools.partialmethod` descriptor brings partial argument " "application to descriptors, just as :func:`~functools.partial` provides for " @@ -1137,7 +1232,7 @@ msgid "" "Alon Horev and Nick Coghlan in :issue:`4331`.)" msgstr "" -#: whatsnew/3.4.rst:862 +#: whatsnew/3.4.rst:861 msgid "" "The new :func:`~functools.singledispatch` decorator brings support for " "single-dispatch generic functions to the Python standard library. Where " @@ -1147,22 +1242,22 @@ msgid "" "*different* kinds of data." msgstr "" -#: whatsnew/3.4.rst:871 +#: whatsnew/3.4.rst:870 msgid ":pep:`443` -- Single-dispatch generic functions" msgstr "" -#: whatsnew/3.4.rst:872 +#: whatsnew/3.4.rst:871 msgid "PEP written and implemented by Łukasz Langa." msgstr "" -#: whatsnew/3.4.rst:874 +#: whatsnew/3.4.rst:873 msgid "" ":func:`~functools.total_ordering` now supports a return value of :data:" "`NotImplemented` from the underlying comparison function. (Contributed by " "Katie Miller in :issue:`10042`.)" msgstr "" -#: whatsnew/3.4.rst:878 +#: whatsnew/3.4.rst:877 msgid "" "A pure-python version of the :func:`~functools.partial` function is now in " "the stdlib; in CPython it is overridden by the C accelerated version, but it " @@ -1170,22 +1265,22 @@ msgid "" "in :issue:`12428`.)" msgstr "" -#: whatsnew/3.4.rst:885 +#: whatsnew/3.4.rst:884 msgid "gc" msgstr "" -#: whatsnew/3.4.rst:887 +#: whatsnew/3.4.rst:886 msgid "" "New function :func:`~gc.get_stats` returns a list of three per-generation " "dictionaries containing the collections statistics since interpreter " "startup. (Contributed by Antoine Pitrou in :issue:`16351`.)" msgstr "" -#: whatsnew/3.4.rst:893 +#: whatsnew/3.4.rst:892 msgid "glob" msgstr "" -#: whatsnew/3.4.rst:895 +#: whatsnew/3.4.rst:894 msgid "" "A new function :func:`~glob.escape` provides a way to escape special " "characters in a filename so that they do not become part of the globbing " @@ -1193,18 +1288,18 @@ msgid "" "Storchaka in :issue:`8402`.)" msgstr "" -#: whatsnew/3.4.rst:901 +#: whatsnew/3.4.rst:900 msgid "hashlib" msgstr "" -#: whatsnew/3.4.rst:903 +#: whatsnew/3.4.rst:902 msgid "" "A new :func:`hashlib.pbkdf2_hmac` function provides the `PKCS#5 password-" "based key derivation function 2 `_. " "(Contributed by Christian Heimes in :issue:`18582`.)" msgstr "" -#: whatsnew/3.4.rst:908 +#: whatsnew/3.4.rst:907 msgid "" "The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is " "now a formally supported interface. It has always existed in CPython's :mod:" @@ -1214,11 +1309,11 @@ msgid "" "Coombs in :issue:`18532`.)" msgstr "" -#: whatsnew/3.4.rst:917 +#: whatsnew/3.4.rst:916 msgid "hmac" msgstr "" -#: whatsnew/3.4.rst:919 +#: whatsnew/3.4.rst:918 msgid "" ":mod:`hmac` now accepts ``bytearray`` as well as ``bytes`` for the *key* " "argument to the :func:`~hmac.new` function, and the *msg* parameter to both " @@ -1227,7 +1322,7 @@ msgid "" "Jonas Borgström in :issue:`18240`.)" msgstr "" -#: whatsnew/3.4.rst:925 +#: whatsnew/3.4.rst:924 msgid "" "The *digestmod* argument to the :func:`hmac.new` function may now be any " "hash digest name recognized by :mod:`hashlib`. In addition, the current " @@ -1236,7 +1331,7 @@ msgid "" "(Contributed by Christian Heimes in :issue:`17276`.)" msgstr "" -#: whatsnew/3.4.rst:931 +#: whatsnew/3.4.rst:930 msgid "" "With the addition of :attr:`~hmac.HMAC.block_size` and :attr:`~hmac.HMAC." "name` attributes (and the formal documentation of the :attr:`~hmac.HMAC." @@ -1244,18 +1339,18 @@ msgid "" "pep:`247` API. (Contributed by Christian Heimes in :issue:`18775`.)" msgstr "" -#: whatsnew/3.4.rst:938 +#: whatsnew/3.4.rst:937 msgid "html" msgstr "" -#: whatsnew/3.4.rst:940 +#: whatsnew/3.4.rst:939 msgid "" "New function :func:`~html.unescape` function converts HTML5 character " "references to the corresponding Unicode characters. (Contributed by Ezio " "Melotti in :issue:`2927`.)" msgstr "" -#: whatsnew/3.4.rst:944 +#: whatsnew/3.4.rst:943 msgid "" ":class:`~html.parser.HTMLParser` accepts a new keyword argument " "*convert_charrefs* that, when ``True``, automatically converts all character " @@ -1265,24 +1360,25 @@ msgid "" "(Contributed by Ezio Melotti in :issue:`13633`.)" msgstr "" -#: whatsnew/3.4.rst:951 +#: whatsnew/3.4.rst:950 msgid "" "The *strict* argument of :class:`~html.parser.HTMLParser` is now deprecated. " "(Contributed by Ezio Melotti in :issue:`15114`.)" msgstr "" -#: whatsnew/3.4.rst:956 +#: whatsnew/3.4.rst:955 msgid "http" msgstr "" -#: whatsnew/3.4.rst:958 +#: whatsnew/3.4.rst:957 msgid "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an " "optional additional *explain* parameter which can be used to provide an " "extended error description, overriding the hardcoded default if there is " "one. This extended error description will be formatted using the :attr:" -"`~http.server.HTTP.error_message_format` attribute and sent as the body of " -"the error response. (Contributed by Karl Cow in :issue:`12921`.)" +"`~http.server.BaseHTTPRequestHandler.error_message_format` attribute and " +"sent as the body of the error response. (Contributed by Karl Cow in :issue:" +"`12921`.)" msgstr "" #: whatsnew/3.4.rst:965 @@ -1335,7 +1431,7 @@ msgstr "" #: whatsnew/3.4.rst:998 msgid "" -":mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` " +":mod:`importlib.util` now has a :const:`~importlib.util.MAGIC_NUMBER` " "attribute providing access to the bytecode version number. This replaces " "the :func:`!get_magic` function in the deprecated :mod:`!imp` module. " "(Contributed by Brett Cannon in :issue:`18192`.)" @@ -1403,12 +1499,12 @@ msgstr "" #: whatsnew/3.4.rst:1042 msgid "" -":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use the :" -"func:`~inspect.signature` API. This allows them to support a much broader " -"range of callables, including those with ``__signature__`` attributes, those " -"with metadata provided by argument clinic, :func:`functools.partial` objects " -"and more. Note that, unlike :func:`~inspect.signature`, these functions " -"still ignore ``__wrapped__`` attributes, and report the already bound first " +":func:`~inspect.getfullargspec` and :func:`!getargspec` now use the :func:" +"`~inspect.signature` API. This allows them to support a much broader range " +"of callables, including those with ``__signature__`` attributes, those with " +"metadata provided by argument clinic, :func:`functools.partial` objects and " +"more. Note that, unlike :func:`~inspect.signature`, these functions still " +"ignore ``__wrapped__`` attributes, and report the already bound first " "argument for bound methods, so it is still necessary to update your code to " "use :func:`~inspect.signature` directly if those features are desired. " "(Contributed by Yury Selivanov in :issue:`17481`.)" @@ -1648,8 +1744,8 @@ msgid "" ":mod:`pickle` now supports (but does not use by default) a new pickle " "protocol, protocol 4. This new protocol addresses a number of issues that " "were present in previous protocols, such as the serialization of nested " -"classes, very large strings and containers, and classes whose :meth:" -"`__new__` method takes keyword-only arguments. It also provides some " +"classes, very large strings and containers, and classes whose :meth:`~object." +"__new__` method takes keyword-only arguments. It also provides some " "efficiency improvements." msgstr "" @@ -1760,7 +1856,7 @@ msgstr "" #: whatsnew/3.4.rst:1303 msgid "" -"New :func:`~re.fullmatch` function and :meth:`.regex.fullmatch` method " +"New :func:`~re.fullmatch` function and :meth:`.Pattern.fullmatch` method " "anchor the pattern at both ends of the string to match. This provides a way " "to be explicit about the goal of the match, which avoids a class of subtle " "bugs where ``$`` characters get lost during code changes or the addition of " @@ -2023,7 +2119,7 @@ msgstr "" #: whatsnew/3.4.rst:1498 msgid "" -"The :mod:`stat` module is now backed by a C implementation in :mod:`_stat`. " +"The :mod:`stat` module is now backed by a C implementation in :mod:`!_stat`. " "A C implementation is required as most of the values aren't standardized and " "are platform-dependent. (Contributed by Christian Heimes in :issue:`11016`.)" msgstr "" @@ -2060,7 +2156,7 @@ msgstr "" #: whatsnew/3.4.rst:1523 msgid "" -":func:`~subprocess.getstatus` and :func:`~subprocess.getstatusoutput` now " +":func:`~subprocess.getoutput` and :func:`~subprocess.getstatusoutput` now " "work on Windows. This change was actually inadvertently made in 3.3.4. " "(Contributed by Tim Golden in :issue:`10197`.)" msgstr "" @@ -2071,13 +2167,13 @@ msgstr "" #: whatsnew/3.4.rst:1531 msgid "" -"The :meth:`~sunau.getparams` method now returns a namedtuple rather than a " -"plain tuple. (Contributed by Claudiu Popa in :issue:`18901`.)" +"The :meth:`!getparams` method now returns a namedtuple rather than a plain " +"tuple. (Contributed by Claudiu Popa in :issue:`18901`.)" msgstr "" #: whatsnew/3.4.rst:1534 msgid "" -":meth:`sunau.open` now supports the context management protocol: when used " +":meth:`!sunau.open` now supports the context management protocol: when used " "in a :keyword:`with` block, the ``close`` method of the returned object will " "be called automatically at the end of the block. (Contributed by Serhiy " "Storchaka in :issue:`18878`.)" @@ -2085,18 +2181,11 @@ msgstr "" #: whatsnew/3.4.rst:1539 msgid "" -":meth:`.AU_write.setsampwidth` now supports 24 bit samples, thus adding " +":meth:`!AU_write.setsampwidth` now supports 24 bit samples, thus adding " "support for writing 24 sample using the module. (Contributed by Serhiy " "Storchaka in :issue:`19261`.)" msgstr "" -#: whatsnew/3.4.rst:1543 -msgid "" -"The :meth:`~sunau.AU_write.writeframesraw` and :meth:`~sunau.AU_write." -"writeframes` methods now accept any :term:`bytes-like object`. (Contributed " -"by Serhiy Storchaka in :issue:`8311`.)" -msgstr "" - #: whatsnew/3.4.rst:1549 msgid "sys" msgstr "" @@ -2191,7 +2280,7 @@ msgid "" "define an attribute that acts normally when looked up through an instance " "object, but which is routed to the *class* ``__getattr__`` when looked up " "through the class. This allows one to have properties active on a class, " -"and have virtual attributes on the class with the same name (see :mod:`Enum` " +"and have virtual attributes on the class with the same name (see :mod:`enum` " "for an example). (Contributed by Ethan Furman in :issue:`19030`.)" msgstr "" @@ -2252,6 +2341,15 @@ msgid "" "of which will run even if one or more of them fail. For example::" msgstr "" +#: whatsnew/3.4.rst:1665 +msgid "" +"class NumbersTest(unittest.TestCase):\n" +" def test_even(self):\n" +" for i in range(6):\n" +" with self.subTest(i=i):\n" +" self.assertEqual(i % 2, 0)" +msgstr "" + #: whatsnew/3.4.rst:1671 msgid "" "will result in six subtests, each identified in the unittest verbose output " @@ -2320,8 +2418,8 @@ msgstr "" #: whatsnew/3.4.rst:1713 msgid "" -":func:`~mock.mock_open` objects now have ``readline`` and ``readlines`` " -"methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)" +":func:`~unittest.mock.mock_open` objects now have ``readline`` and " +"``readlines`` methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)" msgstr "" #: whatsnew/3.4.rst:1718 @@ -2349,8 +2447,8 @@ msgstr "" #: whatsnew/3.4.rst:1733 msgid "" -"The :meth:`~wave.getparams` method now returns a namedtuple rather than a " -"plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)" +"The :meth:`~wave.Wave_read.getparams` method now returns a namedtuple rather " +"than a plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)" msgstr "" #: whatsnew/3.4.rst:1736 @@ -2438,7 +2536,7 @@ msgstr "" #: whatsnew/3.4.rst:1791 msgid "" "The *allowZip64* parameter to :class:`~zipfile.ZipFile` and :class:`~zipfile." -"PyZipfile` is now ``True`` by default. (Contributed by William Mallard in :" +"PyZipFile` is now ``True`` by default. (Contributed by William Mallard in :" "issue:`17201`.)" msgstr "" @@ -2467,9 +2565,9 @@ msgstr "" #: whatsnew/3.4.rst:1820 msgid "" ":pep:`442` removes the current limitations and quirks of object finalization " -"in CPython. With it, objects with :meth:`__del__` methods, as well as " -"generators with :keyword:`finally` clauses, can be finalized when they are " -"part of a reference cycle." +"in CPython. With it, objects with :meth:`~object.__del__` methods, as well " +"as generators with :keyword:`finally` clauses, can be finalized when they " +"are part of a reference cycle." msgstr "" #: whatsnew/3.4.rst:1825 @@ -2563,8 +2661,8 @@ msgstr "" #: whatsnew/3.4.rst:1894 msgid "" -"The new :c:func:`Py_SetStandardStreamEncoding` pre-initialization API allows " -"applications embedding the CPython interpreter to reliably force a " +"The new :c:func:`!Py_SetStandardStreamEncoding` pre-initialization API " +"allows applications embedding the CPython interpreter to reliably force a " "particular encoding and error handler for the standard streams. (Contributed " "by Bastien Montagne and Nick Coghlan in :issue:`16129`.)" msgstr "" @@ -2665,14 +2763,14 @@ msgid "" "A new ``make`` target `coverage-report `_ will build python, run " "the test suite, and generate an HTML coverage report for the C codebase " -"using ``gcov`` and `lcov `_." +"using ``gcov`` and `lcov `_." msgstr "" #: whatsnew/3.4.rst:1968 msgid "" "The ``-R`` option to the :ref:`python regression test suite ` now " "also checks for memory allocation leaks, using :func:`sys." -"getallocatedblocks()`. (Contributed by Antoine Pitrou in :issue:`13390`.)" +"getallocatedblocks`. (Contributed by Antoine Pitrou in :issue:`13390`.)" msgstr "" #: whatsnew/3.4.rst:1973 @@ -2695,7 +2793,7 @@ msgstr "" #: whatsnew/3.4.rst:1983 msgid "" -"A new opcode, :opcode:`LOAD_CLASSDEREF`, has been added to fix a bug in the " +"A new opcode, :opcode:`!LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " "uses of :ref:`__prepare__ `. (Contributed by Benjamin Peterson in :" "issue:`17853`.)" @@ -2794,7 +2892,7 @@ msgstr "" #: whatsnew/3.4.rst:2047 msgid "" -"A performance issue in :meth:`io.FileIO.readall` has been solved. This " +"A performance issue in :meth:`!io.FileIO.readall` has been solved. This " "particularly affects Windows, and significantly speeds up the case of piping " "significant amounts of data through :mod:`subprocess`. (Contributed by " "Richard Oudkerk in :issue:`15758`.)" @@ -2868,8 +2966,8 @@ msgstr "" #: whatsnew/3.4.rst:2107 msgid "" -"The :mod:`formatter` module is pending deprecation and is slated for removal " -"in Python 3.6." +"The :mod:`!formatter` module is pending deprecation and is slated for " +"removal in Python 3.6." msgstr "" #: whatsnew/3.4.rst:2110 @@ -2900,12 +2998,12 @@ msgstr "" #: whatsnew/3.4.rst:2124 msgid "" -"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib." -"writePlist`, :func:`~plistlib.readPlistFromBytes`, and :func:`~plistlib." -"writePlistToBytes` functions are deprecated in favor of the corresponding " -"new functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:" -"`~plistlib.loads`, and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is " -"deprecated in favor of just using the :class:`bytes` constructor." +"The :mod:`plistlib` :func:`!readPlist`, :func:`!writePlist`, :func:`!" +"readPlistFromBytes`, and :func:`!writePlistToBytes` functions are deprecated " +"in favor of the corresponding new functions :func:`~plistlib.load`, :func:" +"`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps`. :" +"func:`!Data` is deprecated in favor of just using the :class:`bytes` " +"constructor." msgstr "" #: whatsnew/3.4.rst:2131 @@ -3054,7 +3152,7 @@ msgstr "" #: whatsnew/3.4.rst:2216 msgid "" -":meth:`difflib.SequenceMatcher.isbjunk` and :meth:`difflib.SequenceMatcher." +":meth:`!difflib.SequenceMatcher.isbjunk` and :meth:`!difflib.SequenceMatcher." "isbpopular` were deprecated in 3.2, and have now been removed: use ``x in sm." "bjunk`` and ``x in sm.bpopular``, where *sm* is a :class:`~difflib." "SequenceMatcher` object (:issue:`13248`)." @@ -3138,21 +3236,21 @@ msgstr "" #: whatsnew/3.4.rst:2275 msgid "" -"The module type now initializes the :attr:`__package__` and :attr:" -"`__loader__` attributes to ``None`` by default. To determine if these " -"attributes were set in a backwards-compatible fashion, use e.g. " +"The module type now initializes the :attr:`~module.__package__` and :attr:" +"`~module.__loader__` attributes to ``None`` by default. To determine if " +"these attributes were set in a backwards-compatible fashion, use e.g. " "``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" msgstr "" -#: whatsnew/3.4.rst:2280 +#: whatsnew/3.4.rst:2281 msgid "" ":meth:`!importlib.util.module_for_loader` now sets ``__loader__`` and " "``__package__`` unconditionally to properly support reloading. If this is " "not desired then you will need to set these attributes manually. You can " -"use :func:`importlib.util.module_to_load` for module management." +"use :func:`!importlib.util.module_to_load` for module management." msgstr "" -#: whatsnew/3.4.rst:2285 +#: whatsnew/3.4.rst:2286 msgid "" "Import now resets relevant attributes (e.g. ``__name__``, ``__loader__``, " "``__package__``, ``__file__``, ``__cached__``) unconditionally when " @@ -3160,7 +3258,7 @@ msgid "" "module is re-found when re-loaded (:issue:`19413`)." msgstr "" -#: whatsnew/3.4.rst:2290 +#: whatsnew/3.4.rst:2291 msgid "" "Frozen packages no longer set ``__path__`` to a list containing the package " "name, they now set it to an empty list. The previous behavior could cause " @@ -3170,7 +3268,7 @@ msgid "" "'__path__')`` (:issue:`18065`)." msgstr "" -#: whatsnew/3.4.rst:2297 +#: whatsnew/3.4.rst:2298 msgid "" "Frozen modules no longer define a ``__file__`` attribute. It's semantically " "incorrect for frozen modules to set the attribute as they are not loaded " @@ -3181,7 +3279,7 @@ msgid "" "use :func:`!imp.is_frozen`." msgstr "" -#: whatsnew/3.4.rst:2305 +#: whatsnew/3.4.rst:2306 msgid "" ":func:`py_compile.compile` now raises :exc:`FileExistsError` if the file " "path it would write to is a symlink or a non-regular file. This is to act as " @@ -3189,7 +3287,7 @@ msgid "" "regardless of what type of file path they were originally." msgstr "" -#: whatsnew/3.4.rst:2310 +#: whatsnew/3.4.rst:2311 msgid "" ":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" "`ImportError` when the source code being loaded triggers a :exc:" @@ -3201,7 +3299,7 @@ msgid "" "exceptions now." msgstr "" -#: whatsnew/3.4.rst:2319 +#: whatsnew/3.4.rst:2320 msgid "" ":func:`functools.update_wrapper` and :func:`functools.wraps` now correctly " "set the ``__wrapped__`` attribute to the function being wrapped, even if " @@ -3213,7 +3311,7 @@ msgid "" "function in the chain that has no ``__wrapped__`` attribute." msgstr "" -#: whatsnew/3.4.rst:2329 +#: whatsnew/3.4.rst:2330 msgid "" ":func:`inspect.getfullargspec` has been reimplemented on top of :func:" "`inspect.signature` and hence handles a much wider variety of callable " @@ -3223,7 +3321,7 @@ msgid "" "will fail on non-Python callables may need to be adjusted accordingly." msgstr "" -#: whatsnew/3.4.rst:2337 +#: whatsnew/3.4.rst:2338 msgid "" ":class:`importlib.machinery.PathFinder` now passes on the current working " "directory to objects in :data:`sys.path_hooks` for the empty string. This " @@ -3237,7 +3335,7 @@ msgid "" "`18416`)." msgstr "" -#: whatsnew/3.4.rst:2348 +#: whatsnew/3.4.rst:2349 msgid "" "The removal of the *strict* argument to :class:`~http.client.HTTPConnection` " "and :class:`~http.client.HTTPSConnection` changes the meaning of the " @@ -3246,7 +3344,7 @@ msgid "" "should already be specifying any additional arguments via keywords." msgstr "" -#: whatsnew/3.4.rst:2354 +#: whatsnew/3.4.rst:2355 msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " @@ -3255,7 +3353,7 @@ msgid "" "`17434`)." msgstr "" -#: whatsnew/3.4.rst:2360 +#: whatsnew/3.4.rst:2361 msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " @@ -3264,7 +3362,7 @@ msgid "" "raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" -#: whatsnew/3.4.rst:2366 +#: whatsnew/3.4.rst:2367 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " @@ -3273,25 +3371,24 @@ msgid "" "`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." msgstr "" -#: whatsnew/3.4.rst:2373 +#: whatsnew/3.4.rst:2374 msgid "" -"The :attr:`~cgi.FieldStorage.file` attribute is now automatically closed " -"when the creating :class:`cgi.FieldStorage` instance is garbage collected. " -"If you were pulling the file object out separately from the :class:`cgi." -"FieldStorage` instance and not keeping the instance alive, then you should " -"either store the entire :class:`cgi.FieldStorage` instance or read the " -"contents of the file before the :class:`cgi.FieldStorage` instance is " -"garbage collected." +"The :attr:`!file` attribute is now automatically closed when the creating :" +"class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " +"the file object out separately from the :class:`!cgi.FieldStorage` instance " +"and not keeping the instance alive, then you should either store the entire :" +"class:`!cgi.FieldStorage` instance or read the contents of the file before " +"the :class:`!cgi.FieldStorage` instance is garbage collected." msgstr "" -#: whatsnew/3.4.rst:2380 +#: whatsnew/3.4.rst:2381 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " "informative :exc:`ValueError` rather than the previous more mysterious :exc:" "`AttributeError` (:issue:`9177`)." msgstr "" -#: whatsnew/3.4.rst:2384 +#: whatsnew/3.4.rst:2385 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " "values. As a consequence of this fix, :meth:`slice.indices` now raises a :" @@ -3299,7 +3396,7 @@ msgid "" "values (:issue:`14794`)." msgstr "" -#: whatsnew/3.4.rst:2389 +#: whatsnew/3.4.rst:2390 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " @@ -3307,21 +3404,21 @@ msgid "" "`16290`.)" msgstr "" -#: whatsnew/3.4.rst:2394 +#: whatsnew/3.4.rst:2395 msgid "" "The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" "`float` values for the *base* parameter. It is unlikely anyone was doing " "this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." msgstr "" -#: whatsnew/3.4.rst:2398 +#: whatsnew/3.4.rst:2399 msgid "" "Defaults for keyword-only arguments are now evaluated *after* defaults for " "regular keyword arguments, instead of before. Hopefully no one wrote any " "code that depends on the previous buggy behavior (:issue:`16967`)." msgstr "" -#: whatsnew/3.4.rst:2402 +#: whatsnew/3.4.rst:2403 msgid "" "Stale thread states are now cleared after :func:`~os.fork`. This may cause " "some system resources to be released that previously were incorrectly kept " @@ -3329,24 +3426,24 @@ msgid "" "storage). (:issue:`17094`.)" msgstr "" -#: whatsnew/3.4.rst:2407 +#: whatsnew/3.4.rst:2408 msgid "" "Parameter names in ``__annotations__`` dicts are now mangled properly, " "similarly to :attr:`~function.__kwdefaults__`. (Contributed by Yury " "Selivanov in :issue:`20625`.)" msgstr "" -#: whatsnew/3.4.rst:2411 +#: whatsnew/3.4.rst:2412 msgid "" ":attr:`hashlib.hash.name` now always returns the identifier in lower case. " "Previously some builtin hashes had uppercase names, but now that it is a " "formal public interface the naming has been made consistent (:issue:`18532`)." msgstr "" -#: whatsnew/3.4.rst:2415 +#: whatsnew/3.4.rst:2416 msgid "" "Because :mod:`unittest.TestSuite` now drops references to tests after they " -"are run, test harnesses that re-use a :class:`~unittest.TestSuite` to re-run " +"are run, test harnesses that reuse a :class:`~unittest.TestSuite` to re-run " "a set of tests may fail. Test suites should not be re-used in this fashion " "since it means state is retained between test runs, breaking the test " "isolation that :mod:`unittest` is designed to provide. However, if the lack " @@ -3356,7 +3453,7 @@ msgid "" "__iter__`) (:issue:`11798`)." msgstr "" -#: whatsnew/3.4.rst:2425 +#: whatsnew/3.4.rst:2426 msgid "" ":mod:`unittest` now uses :mod:`argparse` for command line parsing. There " "are certain invalid command forms that used to work that are no longer " @@ -3365,23 +3462,23 @@ msgid "" "use." msgstr "" -#: whatsnew/3.4.rst:2430 +#: whatsnew/3.4.rst:2431 msgid "" "The :func:`re.split`, :func:`re.findall`, and :func:`re.sub` functions, and " -"the :meth:`~re.match.group` and :meth:`~re.match.groups` methods of " +"the :meth:`~re.Match.group` and :meth:`~re.Match.groups` methods of " "``match`` objects now always return a *bytes* object when the string to be " "matched is a :term:`bytes-like object`. Previously the return type matched " "the input type, so if your code was depending on the return value being, " "say, a ``bytearray``, you will need to change your code." msgstr "" -#: whatsnew/3.4.rst:2437 +#: whatsnew/3.4.rst:2438 msgid "" -":mod:`audioop` functions now raise an error immediately if passed string " +":mod:`!audioop` functions now raise an error immediately if passed string " "input, instead of failing randomly later on (:issue:`16685`)." msgstr "" -#: whatsnew/3.4.rst:2440 +#: whatsnew/3.4.rst:2441 msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " @@ -3390,14 +3487,14 @@ msgid "" "HTMLParser` calls in your code (:issue:`13633`)." msgstr "" -#: whatsnew/3.4.rst:2446 +#: whatsnew/3.4.rst:2447 msgid "" "Since the *digestmod* argument to the :func:`hmac.new` function will in the " "future have no default, all calls to :func:`hmac.new` should be changed to " "explicitly specify a *digestmod* (:issue:`17276`)." msgstr "" -#: whatsnew/3.4.rst:2450 +#: whatsnew/3.4.rst:2451 msgid "" "Calling :func:`sysconfig.get_config_var` with the ``SO`` key, or looking " "``SO`` up in the results of a call to :func:`sysconfig.get_config_vars` is " @@ -3405,7 +3502,7 @@ msgid "" "``SHLIB_SUFFIX``, depending on the context (:issue:`19555`)." msgstr "" -#: whatsnew/3.4.rst:2455 +#: whatsnew/3.4.rst:2456 msgid "" "Any calls to ``open`` functions that specify ``U`` should be modified. ``U`` " "is ineffective in Python3 and will eventually raise an error if used. " @@ -3415,13 +3512,13 @@ msgid "" "`15204`)." msgstr "" -#: whatsnew/3.4.rst:2462 +#: whatsnew/3.4.rst:2463 msgid "" "If you use ``pyvenv`` in a script and desire that pip *not* be installed, " "you must add ``--without-pip`` to your command invocation." msgstr "" -#: whatsnew/3.4.rst:2466 +#: whatsnew/3.4.rst:2467 msgid "" "The default behavior of :func:`json.dump` and :func:`json.dumps` when an " "indent is specified has changed: it no longer produces trailing spaces after " @@ -3430,7 +3527,7 @@ msgid "" "output (:issue:`16333`)." msgstr "" -#: whatsnew/3.4.rst:2472 +#: whatsnew/3.4.rst:2473 msgid "" ":mod:`doctest` now looks for doctests in extension module ``__doc__`` " "strings, so if your doctest test discovery includes extension modules that " @@ -3438,7 +3535,7 @@ msgid "" "never seen before when running your tests (:issue:`3158`)." msgstr "" -#: whatsnew/3.4.rst:2477 +#: whatsnew/3.4.rst:2478 msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " @@ -3448,11 +3545,11 @@ msgid "" "`20784`)." msgstr "" -#: whatsnew/3.4.rst:2486 +#: whatsnew/3.4.rst:2487 msgid "Changes in the C API" msgstr "" -#: whatsnew/3.4.rst:2488 +#: whatsnew/3.4.rst:2489 msgid "" ":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" "`PyObject_Str`, along with some other internal C APIs, now include a " @@ -3466,14 +3563,14 @@ msgid "" "version of Python that is compiled with assertions enabled." msgstr "" -#: whatsnew/3.4.rst:2500 +#: whatsnew/3.4.rst:2501 msgid "" ":c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg** " "argument is not set. Previously only ``NULL`` was returned with no exception " "set." msgstr "" -#: whatsnew/3.4.rst:2504 +#: whatsnew/3.4.rst:2505 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " "be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" @@ -3482,30 +3579,30 @@ msgid "" "`16742`)" msgstr "" -#: whatsnew/3.4.rst:2510 +#: whatsnew/3.4.rst:2511 msgid "" ":c:func:`PyThread_set_key_value` now always set the value. In Python 3.3, " "the function did nothing if the key already exists (if the current value is " "a non-``NULL`` pointer)." msgstr "" -#: whatsnew/3.4.rst:2514 +#: whatsnew/3.4.rst:2515 msgid "" "The ``f_tstate`` (thread state) field of the :c:type:`PyFrameObject` " "structure has been removed to fix a bug: see :issue:`14432` for the " "rationale." msgstr "" -#: whatsnew/3.4.rst:2519 +#: whatsnew/3.4.rst:2520 msgid "Changed in 3.4.3" msgstr "" -#: whatsnew/3.4.rst:2524 +#: whatsnew/3.4.rst:2525 msgid "" "PEP 476: Enabling certificate verification by default for stdlib http clients" msgstr "" -#: whatsnew/3.4.rst:2526 +#: whatsnew/3.4.rst:2527 msgid "" ":mod:`http.client` and modules which use it, such as :mod:`urllib.request` " "and :mod:`xmlrpc.client`, will now verify that the server presents a " @@ -3514,8 +3611,23 @@ msgid "" "improving security for many applications." msgstr "" -#: whatsnew/3.4.rst:2532 +#: whatsnew/3.4.rst:2533 msgid "" "For applications which require the old previous behavior, they can pass an " "alternate context::" msgstr "" + +#: whatsnew/3.4.rst:2536 +msgid "" +"import urllib.request\n" +"import ssl\n" +"\n" +"# This disables all verification\n" +"context = ssl._create_unverified_context()\n" +"\n" +"# This allows using a specific certificate for the host, which doesn't need\n" +"# to be in the trust store\n" +"context = ssl.create_default_context(cafile=\"/path/to/file.crt\")\n" +"\n" +"urllib.request.urlopen(\"https://invalid-cert\", context=context)" +msgstr "" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 42b6599a..7945d026 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,7 +32,7 @@ msgstr "" #: whatsnew/3.5.rst:47 msgid "" "This article explains the new features in Python 3.5, compared to 3.4. " -"Python 3.5 was released on September 13, 2015.  See the `changelog `_ for a full list of changes." msgstr "" @@ -240,12 +241,18 @@ msgid "" "Coroutine functions are declared using the new :keyword:`async def` syntax::" msgstr "" +#: whatsnew/3.5.rst:178 +msgid "" +">>> async def coro():\n" +"... return 'spam'" +msgstr "" + #: whatsnew/3.5.rst:181 msgid "" "Inside a coroutine function, the new :keyword:`await` expression can be used " "to suspend coroutine execution until the result is available. Any object " "can be *awaited*, as long as it implements the :term:`awaitable` protocol by " -"defining the :meth:`__await__` method." +"defining the :meth:`~object.__await__` method." msgstr "" #: whatsnew/3.5.rst:186 @@ -258,16 +265,72 @@ msgstr "" msgid "An example of a rudimentary HTTP client written using the new syntax::" msgstr "" +#: whatsnew/3.5.rst:191 +msgid "" +"import asyncio\n" +"\n" +"async def http_get(domain):\n" +" reader, writer = await asyncio.open_connection(domain, 80)\n" +"\n" +" writer.write(b'\\r\\n'.join([\n" +" b'GET / HTTP/1.1',\n" +" b'Host: %b' % domain.encode('latin-1'),\n" +" b'Connection: close',\n" +" b'', b''\n" +" ]))\n" +"\n" +" async for line in reader:\n" +" print('>>>', line)\n" +"\n" +" writer.close()\n" +"\n" +"loop = asyncio.get_event_loop()\n" +"try:\n" +" loop.run_until_complete(http_get('example.com'))\n" +"finally:\n" +" loop.close()" +msgstr "" + #: whatsnew/3.5.rst:215 msgid "" "Similarly to asynchronous iteration, there is a new syntax for asynchronous " "context managers. The following script::" msgstr "" +#: whatsnew/3.5.rst:218 +msgid "" +"import asyncio\n" +"\n" +"async def coro(name, lock):\n" +" print('coro {}: waiting for lock'.format(name))\n" +" async with lock:\n" +" print('coro {}: holding the lock'.format(name))\n" +" await asyncio.sleep(1)\n" +" print('coro {}: releasing the lock'.format(name))\n" +"\n" +"loop = asyncio.get_event_loop()\n" +"lock = asyncio.Lock()\n" +"coros = asyncio.gather(coro(1, lock), coro(2, lock))\n" +"try:\n" +" loop.run_until_complete(coros)\n" +"finally:\n" +" loop.close()" +msgstr "" + #: whatsnew/3.5.rst:235 msgid "will output::" msgstr "" +#: whatsnew/3.5.rst:237 +msgid "" +"coro 2: waiting for lock\n" +"coro 2: holding the lock\n" +"coro 1: waiting for lock\n" +"coro 2: releasing the lock\n" +"coro 1: holding the lock\n" +"coro 1: releasing the lock" +msgstr "" + #: whatsnew/3.5.rst:244 msgid "" "Note that both :keyword:`async for` and :keyword:`async with` can only be " @@ -307,73 +370,129 @@ msgstr "" msgid "" ":pep:`465` adds the ``@`` infix operator for matrix multiplication. " "Currently, no builtin Python types implement the new operator, however, it " -"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, and :" -"meth:`__imatmul__` for regular, reflected, and in-place matrix " -"multiplication. The semantics of these methods is similar to that of " -"methods defining other infix arithmetic operators." +"can be implemented by defining :meth:`~object.__matmul__`, :meth:`~object." +"__rmatmul__`, and :meth:`~object.__imatmul__` for regular, reflected, and in-" +"place matrix multiplication. The semantics of these methods is similar to " +"that of methods defining other infix arithmetic operators." msgstr "" -#: whatsnew/3.5.rst:281 +#: whatsnew/3.5.rst:282 msgid "" "Matrix multiplication is a notably common operation in many fields of " "mathematics, science, engineering, and the addition of ``@`` allows writing " "cleaner code::" msgstr "" -#: whatsnew/3.5.rst:287 +#: whatsnew/3.5.rst:286 +msgid "S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)" +msgstr "" + +#: whatsnew/3.5.rst:288 msgid "instead of::" msgstr "" -#: whatsnew/3.5.rst:292 +#: whatsnew/3.5.rst:290 +msgid "" +"S = dot((dot(H, beta) - r).T,\n" +" dot(inv(dot(dot(H, V), H.T)), dot(H, beta) - r))" +msgstr "" + +#: whatsnew/3.5.rst:293 msgid "NumPy 1.10 has support for the new operator::" msgstr "" -#: whatsnew/3.5.rst:312 -msgid ":pep:`465` -- A dedicated infix operator for matrix multiplication" +#: whatsnew/3.5.rst:295 +msgid "" +">>> import numpy\n" +"\n" +">>> x = numpy.ones(3)\n" +">>> x\n" +"array([ 1., 1., 1.])\n" +"\n" +">>> m = numpy.eye(3)\n" +">>> m\n" +"array([[ 1., 0., 0.],\n" +" [ 0., 1., 0.],\n" +" [ 0., 0., 1.]])\n" +"\n" +">>> x @ m\n" +"array([ 1., 1., 1.])" msgstr "" #: whatsnew/3.5.rst:313 +msgid ":pep:`465` -- A dedicated infix operator for matrix multiplication" +msgstr "" + +#: whatsnew/3.5.rst:314 msgid "PEP written by Nathaniel J. Smith; implemented by Benjamin Peterson." msgstr "" -#: whatsnew/3.5.rst:319 +#: whatsnew/3.5.rst:320 msgid "PEP 448 - Additional Unpacking Generalizations" msgstr "" -#: whatsnew/3.5.rst:321 +#: whatsnew/3.5.rst:322 msgid "" ":pep:`448` extends the allowed uses of the ``*`` iterable unpacking operator " "and ``**`` dictionary unpacking operator. It is now possible to use an " "arbitrary number of unpackings in :ref:`function calls `::" msgstr "" -#: whatsnew/3.5.rst:335 +#: whatsnew/3.5.rst:326 +msgid "" +">>> print(*[1], *[2], 3, *[4, 5])\n" +"1 2 3 4 5\n" +"\n" +">>> def fn(a, b, c, d):\n" +"... print(a, b, c, d)\n" +"...\n" +"\n" +">>> fn(**{'a': 1, 'c': 3}, **{'b': 2, 'd': 4})\n" +"1 2 3 4" +msgstr "" + +#: whatsnew/3.5.rst:336 msgid "" "Similarly, tuple, list, set, and dictionary displays allow multiple " "unpackings (see :ref:`exprlists` and :ref:`dict`)::" msgstr "" +#: whatsnew/3.5.rst:339 +msgid "" +">>> *range(4), 4\n" +"(0, 1, 2, 3, 4)\n" +"\n" +">>> [*range(4), 4]\n" +"[0, 1, 2, 3, 4]\n" +"\n" +">>> {*range(4), 4, *(5, 6, 7)}\n" +"{0, 1, 2, 3, 4, 5, 6, 7}\n" +"\n" +">>> {'x': 1, **{'y': 2}}\n" +"{'x': 1, 'y': 2}" +msgstr "" + #: whatsnew/3.5.rst:353 msgid ":pep:`448` -- Additional Unpacking Generalizations" msgstr "" -#: whatsnew/3.5.rst:353 +#: whatsnew/3.5.rst:354 msgid "" "PEP written by Joshua Landau; implemented by Neil Girdhar, Thomas Wouters, " "and Joshua Landau." msgstr "" -#: whatsnew/3.5.rst:360 +#: whatsnew/3.5.rst:361 msgid "PEP 461 - percent formatting support for bytes and bytearray" msgstr "" -#: whatsnew/3.5.rst:362 +#: whatsnew/3.5.rst:363 msgid "" ":pep:`461` adds support for the ``%`` :ref:`interpolation operator ` to :class:`bytes` and :class:`bytearray`." msgstr "" -#: whatsnew/3.5.rst:366 +#: whatsnew/3.5.rst:367 msgid "" "While interpolation is usually thought of as a string operation, there are " "cases where interpolation on ``bytes`` or ``bytearrays`` makes sense, and " @@ -383,17 +502,38 @@ msgid "" "ASCII compatible text." msgstr "" -#: whatsnew/3.5.rst:1848 +#: whatsnew/3.5.rst:1847 msgid "Examples::" msgstr "" -#: whatsnew/3.5.rst:381 +#: whatsnew/3.5.rst:376 +msgid "" +">>> b'Hello %b!' % b'World'\n" +"b'Hello World!'\n" +"\n" +">>> b'x=%i y=%f' % (1, 2.5)\n" +"b'x=1 y=2.500000'" +msgstr "" + +#: whatsnew/3.5.rst:382 msgid "" "Unicode is not allowed for ``%b``, but it is accepted by ``%a`` (equivalent " "of ``repr(obj).encode('ascii', 'backslashreplace')``)::" msgstr "" -#: whatsnew/3.5.rst:392 +#: whatsnew/3.5.rst:385 +msgid "" +">>> b'Hello %b!' % 'World'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: %b requires bytes, or an object that implements __bytes__, not " +"'str'\n" +"\n" +">>> b'price: %a' % '10€'\n" +"b\"price: '10\\\\u20ac'\"" +msgstr "" + +#: whatsnew/3.5.rst:393 msgid "" "Note that ``%s`` and ``%r`` conversion types, although supported, should " "only be used in codebases that need compatibility with Python 2." @@ -403,23 +543,23 @@ msgstr "" msgid ":pep:`461` -- Adding % formatting to bytes and bytearray" msgstr "" -#: whatsnew/3.5.rst:398 +#: whatsnew/3.5.rst:399 msgid "" "PEP written by Ethan Furman; implemented by Neil Schemenauer and Ethan " "Furman." msgstr "" -#: whatsnew/3.5.rst:405 +#: whatsnew/3.5.rst:406 msgid "PEP 484 - Type Hints" msgstr "" -#: whatsnew/3.5.rst:407 +#: whatsnew/3.5.rst:408 msgid "" "Function annotation syntax has been a Python feature since version 3.0 (:pep:" "`3107`), however the semantics of annotations has been left undefined." msgstr "" -#: whatsnew/3.5.rst:410 +#: whatsnew/3.5.rst:411 msgid "" "Experience has shown that the majority of function annotation uses were to " "provide type hints to function parameters and return values. It became " @@ -427,36 +567,42 @@ msgid "" "library included the base definitions and tools for type annotations." msgstr "" -#: whatsnew/3.5.rst:415 +#: whatsnew/3.5.rst:416 msgid "" ":pep:`484` introduces a :term:`provisional module ` to " "provide these standard definitions and tools, along with some conventions " "for situations where annotations are not available." msgstr "" -#: whatsnew/3.5.rst:419 +#: whatsnew/3.5.rst:420 msgid "" "For example, here is a simple function whose argument and return type are " "declared in the annotations::" msgstr "" -#: whatsnew/3.5.rst:425 +#: whatsnew/3.5.rst:423 +msgid "" +"def greeting(name: str) -> str:\n" +" return 'Hello ' + name" +msgstr "" + +#: whatsnew/3.5.rst:426 msgid "" "While these annotations are available at runtime through the usual :attr:" -"`__annotations__` attribute, *no automatic type checking happens at " +"`~object.__annotations__` attribute, *no automatic type checking happens at " "runtime*. Instead, it is assumed that a separate off-line type checker (e." "g. `mypy `_) will be used for on-demand source code " "analysis." msgstr "" -#: whatsnew/3.5.rst:431 +#: whatsnew/3.5.rst:432 msgid "" "The type system supports unions, generic types, and a special type named :" "class:`~typing.Any` which is consistent with (i.e. assignable to and from) " "all types." msgstr "" -#: whatsnew/3.5.rst:437 +#: whatsnew/3.5.rst:438 msgid ":mod:`typing` module documentation" msgstr "" @@ -464,26 +610,26 @@ msgstr "" msgid ":pep:`484` -- Type Hints" msgstr "" -#: whatsnew/3.5.rst:439 +#: whatsnew/3.5.rst:440 msgid "" "PEP written by Guido van Rossum, Jukka Lehtosalo, and Łukasz Langa; " "implemented by Guido van Rossum." msgstr "" -#: whatsnew/3.5.rst:441 +#: whatsnew/3.5.rst:442 msgid ":pep:`483` -- The Theory of Type Hints" msgstr "" -#: whatsnew/3.5.rst:442 +#: whatsnew/3.5.rst:443 msgid "PEP written by Guido van Rossum" msgstr "" -#: whatsnew/3.5.rst:448 +#: whatsnew/3.5.rst:449 msgid "" "PEP 471 - os.scandir() function -- a better and faster directory iterator" msgstr "" -#: whatsnew/3.5.rst:450 +#: whatsnew/3.5.rst:451 msgid "" ":pep:`471` adds a new directory iteration function, :func:`os.scandir`, to " "the standard library. Additionally, :func:`os.walk` is now implemented " @@ -493,14 +639,14 @@ msgid "" "tree." msgstr "" -#: whatsnew/3.5.rst:457 +#: whatsnew/3.5.rst:458 msgid "" "Additionally, ``scandir`` returns an iterator, as opposed to returning a " "list of file names, which improves memory efficiency when iterating over " "very large directories." msgstr "" -#: whatsnew/3.5.rst:461 +#: whatsnew/3.5.rst:462 msgid "" "The following example shows a simple use of :func:`os.scandir` to display " "all the files (excluding directories) in the given *path* that don't start " @@ -508,21 +654,28 @@ msgid "" "generally not make an additional system call::" msgstr "" -#: whatsnew/3.5.rst:472 +#: whatsnew/3.5.rst:467 msgid "" -":pep:`471` -- os.scandir() function -- a better and faster directory iterator" +"for entry in os.scandir(path):\n" +" if not entry.name.startswith('.') and entry.is_file():\n" +" print(entry.name)" msgstr "" #: whatsnew/3.5.rst:473 msgid "" +":pep:`471` -- os.scandir() function -- a better and faster directory iterator" +msgstr "" + +#: whatsnew/3.5.rst:474 +msgid "" "PEP written and implemented by Ben Hoyt with the help of Victor Stinner." msgstr "" -#: whatsnew/3.5.rst:479 +#: whatsnew/3.5.rst:480 msgid "PEP 475: Retry system calls failing with EINTR" msgstr "" -#: whatsnew/3.5.rst:481 +#: whatsnew/3.5.rst:482 msgid "" "An :py:const:`errno.EINTR` error code is returned whenever a system call, " "that is waiting for I/O, is interrupted by a signal. Previously, Python " @@ -530,28 +683,42 @@ msgid "" "writing a Python application, the developer had two choices:" msgstr "" -#: whatsnew/3.5.rst:486 +#: whatsnew/3.5.rst:487 msgid "Ignore the ``InterruptedError``." msgstr "" -#: whatsnew/3.5.rst:487 +#: whatsnew/3.5.rst:488 msgid "" "Handle the ``InterruptedError`` and attempt to restart the interrupted " "system call at every call site." msgstr "" -#: whatsnew/3.5.rst:490 +#: whatsnew/3.5.rst:491 msgid "" "The first option makes an application fail intermittently. The second option " "adds a large amount of boilerplate that makes the code nearly unreadable. " "Compare::" msgstr "" -#: whatsnew/3.5.rst:496 +#: whatsnew/3.5.rst:495 +msgid "print(\"Hello World\")" +msgstr "" + +#: whatsnew/3.5.rst:497 msgid "and::" msgstr "" -#: whatsnew/3.5.rst:505 +#: whatsnew/3.5.rst:499 +msgid "" +"while True:\n" +" try:\n" +" print(\"Hello World\")\n" +" break\n" +" except InterruptedError:\n" +" continue" +msgstr "" + +#: whatsnew/3.5.rst:506 msgid "" ":pep:`475` implements automatic retry of system calls on ``EINTR``. This " "removes the burden of dealing with ``EINTR`` or :exc:`InterruptedError` in " @@ -560,21 +727,21 @@ msgid "" "the signal handler does not raise an exception." msgstr "" -#: whatsnew/3.5.rst:512 +#: whatsnew/3.5.rst:513 msgid "" "Below is a list of functions which are now retried when interrupted by a " "signal:" msgstr "" -#: whatsnew/3.5.rst:515 +#: whatsnew/3.5.rst:516 msgid ":func:`open` and :func:`io.open`;" msgstr "" -#: whatsnew/3.5.rst:517 +#: whatsnew/3.5.rst:518 msgid "functions of the :mod:`faulthandler` module;" msgstr "" -#: whatsnew/3.5.rst:519 +#: whatsnew/3.5.rst:520 msgid "" ":mod:`os` functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os." "fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :" @@ -586,21 +753,21 @@ msgid "" "`~os.write`, :func:`~os.writev`;" msgstr "" -#: whatsnew/3.5.rst:529 +#: whatsnew/3.5.rst:530 msgid "" "special cases: :func:`os.close` and :func:`os.dup2` now ignore :py:const:" "`~errno.EINTR` errors; the syscall is not retried (see the PEP for the " "rationale);" msgstr "" -#: whatsnew/3.5.rst:533 +#: whatsnew/3.5.rst:534 msgid "" ":mod:`select` functions: :func:`devpoll.poll() `, :func:" "`epoll.poll() `, :func:`kqueue.control() `, :func:`poll.poll() `, :func:`~select.select`;" msgstr "" -#: whatsnew/3.5.rst:538 +#: whatsnew/3.5.rst:539 msgid "" "methods of the :class:`~socket.socket` class: :meth:`~socket.socket." "accept`, :meth:`~socket.socket.connect` (except for non-blocking sockets), :" @@ -609,11 +776,11 @@ msgid "" "sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" msgstr "" -#: whatsnew/3.5.rst:545 +#: whatsnew/3.5.rst:546 msgid ":func:`signal.sigtimedwait` and :func:`signal.sigwaitinfo`;" msgstr "" -#: whatsnew/3.5.rst:547 +#: whatsnew/3.5.rst:548 msgid ":func:`time.sleep`." msgstr "" @@ -621,17 +788,17 @@ msgstr "" msgid ":pep:`475` -- Retry system calls failing with EINTR" msgstr "" -#: whatsnew/3.5.rst:552 +#: whatsnew/3.5.rst:553 msgid "" "PEP and implementation written by Charles-François Natali and Victor " "Stinner, with the help of Antoine Pitrou (the French connection)." msgstr "" -#: whatsnew/3.5.rst:559 +#: whatsnew/3.5.rst:560 msgid "PEP 479: Change StopIteration handling inside generators" msgstr "" -#: whatsnew/3.5.rst:561 +#: whatsnew/3.5.rst:562 msgid "" "The interaction of generators and :exc:`StopIteration` in Python 3.4 and " "earlier was sometimes surprising, and could conceal obscure bugs. " @@ -640,7 +807,7 @@ msgid "" "driving the generator." msgstr "" -#: whatsnew/3.5.rst:567 +#: whatsnew/3.5.rst:568 msgid "" ":pep:`479` changes the behavior of generators: when a ``StopIteration`` " "exception is raised inside a generator, it is replaced with a :exc:" @@ -651,13 +818,33 @@ msgid "" "combination with the ``yield from`` construct." msgstr "" -#: whatsnew/3.5.rst:575 +#: whatsnew/3.5.rst:576 msgid "" "This is a backwards incompatible change, so to enable the new behavior, a :" "term:`__future__` import is necessary::" msgstr "" -#: whatsnew/3.5.rst:595 +#: whatsnew/3.5.rst:579 +msgid "" +">>> from __future__ import generator_stop\n" +"\n" +">>> def gen():\n" +"... next(iter([]))\n" +"... yield\n" +"...\n" +">>> next(gen())\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in gen\n" +"StopIteration\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"RuntimeError: generator raised StopIteration" +msgstr "" + +#: whatsnew/3.5.rst:596 msgid "" "Without a ``__future__`` import, a :exc:`PendingDeprecationWarning` will be " "raised whenever a :exc:`StopIteration` exception is raised inside a " @@ -668,17 +855,17 @@ msgstr "" msgid ":pep:`479` -- Change StopIteration handling inside generators" msgstr "" -#: whatsnew/3.5.rst:601 +#: whatsnew/3.5.rst:602 msgid "" "PEP written by Chris Angelico and Guido van Rossum. Implemented by Chris " "Angelico, Yury Selivanov and Nick Coghlan." msgstr "" -#: whatsnew/3.5.rst:608 +#: whatsnew/3.5.rst:609 msgid "PEP 485: A function for testing approximate equality" msgstr "" -#: whatsnew/3.5.rst:610 +#: whatsnew/3.5.rst:611 msgid "" ":pep:`485` adds the :func:`math.isclose` and :func:`cmath.isclose` functions " "which tell whether two values are approximately equal or \"close\" to each " @@ -688,26 +875,48 @@ msgid "" "the larger absolute value::" msgstr "" -#: whatsnew/3.5.rst:625 +#: whatsnew/3.5.rst:618 +msgid "" +">>> import math\n" +">>> a = 5.0\n" +">>> b = 4.99998\n" +">>> math.isclose(a, b, rel_tol=1e-5)\n" +"True\n" +">>> math.isclose(a, b, rel_tol=1e-6)\n" +"False" +msgstr "" + +#: whatsnew/3.5.rst:626 msgid "" "It is also possible to compare two values using absolute tolerance, which " "must be a non-negative value::" msgstr "" +#: whatsnew/3.5.rst:629 +msgid "" +">>> import math\n" +">>> a = 5.0\n" +">>> b = 4.99998\n" +">>> math.isclose(a, b, abs_tol=0.00003)\n" +"True\n" +">>> math.isclose(a, b, abs_tol=0.00001)\n" +"False" +msgstr "" + #: whatsnew/3.5.rst:639 msgid ":pep:`485` -- A function for testing approximate equality" msgstr "" -#: whatsnew/3.5.rst:639 +#: whatsnew/3.5.rst:640 msgid "" "PEP written by Christopher Barker; implemented by Chris Barker and Tal Einat." msgstr "" -#: whatsnew/3.5.rst:646 +#: whatsnew/3.5.rst:647 msgid "PEP 486: Make the Python Launcher aware of virtual environments" msgstr "" -#: whatsnew/3.5.rst:648 +#: whatsnew/3.5.rst:649 msgid "" ":pep:`486` makes the Windows launcher (see :pep:`397`) aware of an active " "virtual environment. When the default interpreter would be used and the " @@ -715,19 +924,19 @@ msgid "" "environment will be used." msgstr "" -#: whatsnew/3.5.rst:655 +#: whatsnew/3.5.rst:656 msgid ":pep:`486` -- Make the Python Launcher aware of virtual environments" msgstr "" -#: whatsnew/3.5.rst:656 +#: whatsnew/3.5.rst:657 msgid "PEP written and implemented by Paul Moore." msgstr "" -#: whatsnew/3.5.rst:662 +#: whatsnew/3.5.rst:663 msgid "PEP 488: Elimination of PYO files" msgstr "" -#: whatsnew/3.5.rst:664 +#: whatsnew/3.5.rst:665 msgid "" ":pep:`488` does away with the concept of ``.pyo`` files. This means that ``." "pyc`` files represent both unoptimized and optimized bytecode. To prevent " @@ -740,25 +949,25 @@ msgid "" "change." msgstr "" -#: whatsnew/3.5.rst:676 +#: whatsnew/3.5.rst:677 msgid ":pep:`488` -- Elimination of PYO files" msgstr "" -#: whatsnew/3.5.rst:677 +#: whatsnew/3.5.rst:678 msgid "PEP written and implemented by Brett Cannon." msgstr "" -#: whatsnew/3.5.rst:683 +#: whatsnew/3.5.rst:684 msgid "PEP 489: Multi-phase extension module initialization" msgstr "" -#: whatsnew/3.5.rst:685 +#: whatsnew/3.5.rst:686 msgid "" ":pep:`489` updates extension module initialization to take advantage of the " "two step module loading mechanism introduced by :pep:`451` in Python 3.4." msgstr "" -#: whatsnew/3.5.rst:688 +#: whatsnew/3.5.rst:689 msgid "" "This change brings the import semantics of extension modules that opt-in to " "using the new mechanism much closer to those of Python source and bytecode " @@ -770,73 +979,73 @@ msgstr "" msgid ":pep:`489` -- Multi-phase extension module initialization" msgstr "" -#: whatsnew/3.5.rst:696 +#: whatsnew/3.5.rst:697 msgid "" "PEP written by Petr Viktorin, Stefan Behnel, and Nick Coghlan; implemented " "by Petr Viktorin." msgstr "" -#: whatsnew/3.5.rst:701 +#: whatsnew/3.5.rst:702 msgid "Other Language Changes" msgstr "" -#: whatsnew/3.5.rst:703 +#: whatsnew/3.5.rst:704 msgid "Some smaller changes made to the core Python language are:" msgstr "" -#: whatsnew/3.5.rst:705 +#: whatsnew/3.5.rst:706 msgid "" "Added the ``\"namereplace\"`` error handlers. The ``\"backslashreplace\"`` " "error handlers now work with decoding and translating. (Contributed by " "Serhiy Storchaka in :issue:`19676` and :issue:`22286`.)" msgstr "" -#: whatsnew/3.5.rst:709 +#: whatsnew/3.5.rst:710 msgid "" "The :option:`-b` option now affects comparisons of :class:`bytes` with :" "class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" msgstr "" -#: whatsnew/3.5.rst:712 +#: whatsnew/3.5.rst:713 msgid "" "New Kazakh ``kz1048`` and Tajik ``koi8_t`` :ref:`codecs `. (Contributed by Serhiy Storchaka in :issue:`22682` and :issue:" "`22681`.)" msgstr "" -#: whatsnew/3.5.rst:715 +#: whatsnew/3.5.rst:716 msgid "" "Property docstrings are now writable. This is especially useful for :func:" "`collections.namedtuple` docstrings. (Contributed by Berker Peksag in :issue:" "`24064`.)" msgstr "" -#: whatsnew/3.5.rst:719 +#: whatsnew/3.5.rst:720 msgid "" "Circular imports involving relative imports are now supported. (Contributed " "by Brett Cannon and Antoine Pitrou in :issue:`17636`.)" msgstr "" -#: whatsnew/3.5.rst:724 +#: whatsnew/3.5.rst:725 msgid "New Modules" msgstr "" -#: whatsnew/3.5.rst:727 +#: whatsnew/3.5.rst:728 msgid "typing" msgstr "" -#: whatsnew/3.5.rst:729 +#: whatsnew/3.5.rst:730 msgid "" "The new :mod:`typing` :term:`provisional ` module provides " "standard definitions and tools for function type annotations. See :ref:`Type " "Hints ` for more information." msgstr "" -#: whatsnew/3.5.rst:736 +#: whatsnew/3.5.rst:737 msgid "zipapp" msgstr "" -#: whatsnew/3.5.rst:738 +#: whatsnew/3.5.rst:739 msgid "" "The new :mod:`zipapp` module (specified in :pep:`441`) provides an API and " "command line tool for creating executable Python Zip Applications, which " @@ -844,32 +1053,38 @@ msgid "" "publicized, either at the time or since." msgstr "" -#: whatsnew/3.5.rst:743 +#: whatsnew/3.5.rst:744 msgid "" "With the new module, bundling your application is as simple as putting all " "the files, including a ``__main__.py`` file, into a directory ``myapp`` and " "running:" msgstr "" -#: whatsnew/3.5.rst:752 +#: whatsnew/3.5.rst:748 +msgid "" +"$ python -m zipapp myapp\n" +"$ python myapp.pyz" +msgstr "" + +#: whatsnew/3.5.rst:753 msgid "" "The module implementation has been contributed by Paul Moore in :issue:" "`23491`." msgstr "" -#: whatsnew/3.5.rst:757 +#: whatsnew/3.5.rst:758 msgid ":pep:`441` -- Improving Python ZIP Application Support" msgstr "" -#: whatsnew/3.5.rst:761 +#: whatsnew/3.5.rst:762 msgid "Improved Modules" msgstr "" -#: whatsnew/3.5.rst:764 +#: whatsnew/3.5.rst:765 msgid "argparse" msgstr "" -#: whatsnew/3.5.rst:766 +#: whatsnew/3.5.rst:767 msgid "" "The :class:`~argparse.ArgumentParser` class now allows disabling :ref:" "`abbreviated usage ` of long options by setting :ref:" @@ -877,41 +1092,41 @@ msgid "" "Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" msgstr "" -#: whatsnew/3.5.rst:773 +#: whatsnew/3.5.rst:774 msgid "asyncio" msgstr "" -#: whatsnew/3.5.rst:775 +#: whatsnew/3.5.rst:776 msgid "" "Since the :mod:`asyncio` module is :term:`provisional `, " "all changes introduced in Python 3.5 have also been backported to Python 3.4." "x." msgstr "" -#: whatsnew/3.5.rst:778 +#: whatsnew/3.5.rst:779 msgid "Notable changes in the :mod:`asyncio` module since Python 3.4.0:" msgstr "" -#: whatsnew/3.5.rst:780 +#: whatsnew/3.5.rst:781 msgid "" "New debugging APIs: :meth:`loop.set_debug() ` and :" "meth:`loop.get_debug() ` methods. (Contributed by " "Victor Stinner.)" msgstr "" -#: whatsnew/3.5.rst:784 +#: whatsnew/3.5.rst:785 msgid "" "The proactor event loop now supports SSL. (Contributed by Antoine Pitrou and " "Victor Stinner in :issue:`22560`.)" msgstr "" -#: whatsnew/3.5.rst:787 +#: whatsnew/3.5.rst:788 msgid "" "A new :meth:`loop.is_closed() ` method to check if " "the event loop is closed. (Contributed by Victor Stinner in :issue:`21326`.)" msgstr "" -#: whatsnew/3.5.rst:791 +#: whatsnew/3.5.rst:792 msgid "" "A new :meth:`loop.create_task() ` to conveniently " "create and schedule a new :class:`~asyncio.Task` for a coroutine. The " @@ -920,20 +1135,20 @@ msgid "" "etc. (Contributed by Victor Stinner.)" msgstr "" -#: whatsnew/3.5.rst:798 +#: whatsnew/3.5.rst:799 msgid "" "A new :meth:`transport.get_write_buffer_limits() ` method to inquire for *high-* and *low-* water " "limits of the flow control. (Contributed by Victor Stinner.)" msgstr "" -#: whatsnew/3.5.rst:803 +#: whatsnew/3.5.rst:804 msgid "" -"The :func:`~asyncio.async` function is deprecated in favor of :func:" -"`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" +"The :func:`!async` function is deprecated in favor of :func:`~asyncio." +"ensure_future`. (Contributed by Yury Selivanov.)" msgstr "" -#: whatsnew/3.5.rst:807 +#: whatsnew/3.5.rst:808 msgid "" "New :meth:`loop.set_task_factory() ` and :" "meth:`loop.get_task_factory() ` methods to " @@ -941,23 +1156,23 @@ msgid "" "create_task>` method uses. (Contributed by Yury Selivanov.)" msgstr "" -#: whatsnew/3.5.rst:814 +#: whatsnew/3.5.rst:815 msgid "" "New :meth:`Queue.join() ` and :meth:`Queue.task_done() " "` queue methods. (Contributed by Victor Stinner.)" msgstr "" -#: whatsnew/3.5.rst:818 +#: whatsnew/3.5.rst:819 msgid "" "The ``JoinableQueue`` class was removed, in favor of the :class:`asyncio." "Queue` class. (Contributed by Victor Stinner.)" msgstr "" -#: whatsnew/3.5.rst:822 +#: whatsnew/3.5.rst:823 msgid "Updates in 3.5.1:" msgstr "" -#: whatsnew/3.5.rst:824 +#: whatsnew/3.5.rst:825 msgid "" "The :func:`~asyncio.ensure_future` function and all functions that use it, " "such as :meth:`loop.run_until_complete() `, " @@ -965,30 +1180,30 @@ msgid "" "by Yury Selivanov.)" msgstr "" -#: whatsnew/3.5.rst:829 +#: whatsnew/3.5.rst:830 msgid "" "New :func:`~asyncio.run_coroutine_threadsafe` function to submit coroutines " "to event loops from other threads. (Contributed by Vincent Michel.)" msgstr "" -#: whatsnew/3.5.rst:833 +#: whatsnew/3.5.rst:834 msgid "" "New :meth:`Transport.is_closing() ` method " "to check if the transport is closing or closed. (Contributed by Yury " "Selivanov.)" msgstr "" -#: whatsnew/3.5.rst:837 +#: whatsnew/3.5.rst:838 msgid "" "The :meth:`loop.create_server() ` method can now " "accept a list of hosts. (Contributed by Yann Sionneau.)" msgstr "" -#: whatsnew/3.5.rst:841 +#: whatsnew/3.5.rst:842 msgid "Updates in 3.5.2:" msgstr "" -#: whatsnew/3.5.rst:843 +#: whatsnew/3.5.rst:844 msgid "" "New :meth:`loop.create_future() ` method to " "create Future objects. This allows alternative event loop implementations, " @@ -997,21 +1212,21 @@ msgid "" "Selivanov.)" msgstr "" -#: whatsnew/3.5.rst:850 +#: whatsnew/3.5.rst:851 msgid "" "New :meth:`loop.get_exception_handler() ` method to get the current exception handler. " "(Contributed by Yury Selivanov.)" msgstr "" -#: whatsnew/3.5.rst:854 +#: whatsnew/3.5.rst:855 msgid "" "New :meth:`StreamReader.readuntil() ` method " "to read data from the stream until a separator bytes sequence appears. " "(Contributed by Mark Korenberg.)" msgstr "" -#: whatsnew/3.5.rst:859 +#: whatsnew/3.5.rst:860 msgid "" "The :meth:`loop.create_connection() ` and :" "meth:`loop.create_server() ` methods are " @@ -1019,49 +1234,49 @@ msgid "" "address is already resolved. (Contributed by A. Jesse Jiryu Davis.)" msgstr "" -#: whatsnew/3.5.rst:865 +#: whatsnew/3.5.rst:866 msgid "" "The :meth:`loop.sock_connect(sock, address) ` no " "longer requires the *address* to be resolved prior to the call. (Contributed " "by A. Jesse Jiryu Davis.)" msgstr "" -#: whatsnew/3.5.rst:871 +#: whatsnew/3.5.rst:872 msgid "bz2" msgstr "" -#: whatsnew/3.5.rst:873 +#: whatsnew/3.5.rst:874 msgid "" "The :meth:`BZ2Decompressor.decompress ` " "method now accepts an optional *max_length* argument to limit the maximum " "size of decompressed data. (Contributed by Nikolaus Rath in :issue:`15955`.)" msgstr "" -#: whatsnew/3.5.rst:879 +#: whatsnew/3.5.rst:880 msgid "cgi" msgstr "" -#: whatsnew/3.5.rst:881 +#: whatsnew/3.5.rst:882 msgid "" -"The :class:`~cgi.FieldStorage` class now supports the :term:`context " -"manager` protocol. (Contributed by Berker Peksag in :issue:`20289`.)" +"The :class:`!FieldStorage` class now supports the :term:`context manager` " +"protocol. (Contributed by Berker Peksag in :issue:`20289`.)" msgstr "" -#: whatsnew/3.5.rst:886 +#: whatsnew/3.5.rst:887 msgid "cmath" msgstr "" -#: whatsnew/3.5.rst:888 +#: whatsnew/3.5.rst:889 msgid "" "A new function :func:`~cmath.isclose` provides a way to test for approximate " "equality. (Contributed by Chris Barker and Tal Einat in :issue:`24270`.)" msgstr "" -#: whatsnew/3.5.rst:893 +#: whatsnew/3.5.rst:894 msgid "code" msgstr "" -#: whatsnew/3.5.rst:895 +#: whatsnew/3.5.rst:896 msgid "" "The :func:`InteractiveInterpreter.showtraceback() ` method now prints the full chained " @@ -1069,26 +1284,25 @@ msgid "" "Popa in :issue:`17442`.)" msgstr "" -#: whatsnew/3.5.rst:901 +#: whatsnew/3.5.rst:902 msgid "collections" msgstr "" -#: whatsnew/3.5.rst:905 +#: whatsnew/3.5.rst:906 msgid "" "The :class:`~collections.OrderedDict` class is now implemented in C, which " "makes it 4 to 100 times faster. (Contributed by Eric Snow in :issue:" "`16991`.)" msgstr "" -#: whatsnew/3.5.rst:908 +#: whatsnew/3.5.rst:909 msgid "" -":meth:`OrderedDict.items() `, :meth:" -"`OrderedDict.keys() `, :meth:`OrderedDict." -"values() ` views now support :func:" -"`reversed` iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" +":meth:`!OrderedDict.items`, :meth:`!OrderedDict.keys`, and :meth:`!" +"OrderedDict.values` views now support :func:`reversed` iteration. " +"(Contributed by Serhiy Storchaka in :issue:`19505`.)" msgstr "" -#: whatsnew/3.5.rst:914 +#: whatsnew/3.5.rst:913 msgid "" "The :class:`~collections.deque` class now defines :meth:`~collections.deque." "index`, :meth:`~collections.deque.insert`, and :meth:`~collections.deque." @@ -1098,43 +1312,50 @@ msgid "" "`23704`.)" msgstr "" -#: whatsnew/3.5.rst:921 +#: whatsnew/3.5.rst:920 msgid "" "Docstrings produced by :func:`~collections.namedtuple` can now be updated::" msgstr "" -#: whatsnew/3.5.rst:928 +#: whatsnew/3.5.rst:922 +msgid "" +"Point = namedtuple('Point', ['x', 'y'])\n" +"Point.__doc__ += ': Cartesian coordinate'\n" +"Point.x.__doc__ = 'abscissa'\n" +"Point.y.__doc__ = 'ordinate'" +msgstr "" + +#: whatsnew/3.5.rst:927 msgid "(Contributed by Berker Peksag in :issue:`24064`.)" msgstr "" -#: whatsnew/3.5.rst:930 +#: whatsnew/3.5.rst:929 msgid "" -"The :class:`~collections.UserString` class now implements the :meth:" -"`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str." -"format_map`, :meth:`~str.isprintable`, and :meth:`~str.maketrans` methods to " -"match the corresponding methods of :class:`str`. (Contributed by Joe Jevnik " -"in :issue:`22189`.)" +"The :class:`~collections.UserString` class now implements the :meth:`~object." +"__getnewargs__`, :meth:`~object.__rmod__`, :meth:`~str.casefold`, :meth:" +"`~str.format_map`, :meth:`~str.isprintable`, and :meth:`~str.maketrans` " +"methods to match the corresponding methods of :class:`str`. (Contributed by " +"Joe Jevnik in :issue:`22189`.)" msgstr "" -#: whatsnew/3.5.rst:938 +#: whatsnew/3.5.rst:937 msgid "collections.abc" msgstr "" -#: whatsnew/3.5.rst:940 +#: whatsnew/3.5.rst:939 msgid "" -"The :meth:`Sequence.index() ` method now " -"accepts *start* and *stop* arguments to match the corresponding methods of :" -"class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre in :" -"issue:`23086`.)" +"The :meth:`!Sequence.index` method now accepts *start* and *stop* arguments " +"to match the corresponding methods of :class:`tuple`, :class:`list`, etc. " +"(Contributed by Devin Jeanpierre in :issue:`23086`.)" msgstr "" -#: whatsnew/3.5.rst:945 +#: whatsnew/3.5.rst:944 msgid "" "A new :class:`~collections.abc.Generator` abstract base class. (Contributed " "by Stefan Behnel in :issue:`24018`.)" msgstr "" -#: whatsnew/3.5.rst:948 +#: whatsnew/3.5.rst:947 msgid "" "New :class:`~collections.abc.Awaitable`, :class:`~collections.abc." "Coroutine`, :class:`~collections.abc.AsyncIterator`, and :class:" @@ -1142,17 +1363,17 @@ msgid "" "Selivanov in :issue:`24184`.)" msgstr "" -#: whatsnew/3.5.rst:953 +#: whatsnew/3.5.rst:952 msgid "" "For earlier Python versions, a backport of the new ABCs is available in an " -"external `PyPI package `_." +"external :pypi:`PyPI package `." msgstr "" -#: whatsnew/3.5.rst:958 +#: whatsnew/3.5.rst:957 msgid "compileall" msgstr "" -#: whatsnew/3.5.rst:960 +#: whatsnew/3.5.rst:959 msgid "" "A new :mod:`compileall` option, :samp:`-j {N}`, allows running *N* workers " "simultaneously to perform parallel bytecode compilation. The :func:" @@ -1160,13 +1381,13 @@ msgid "" "parameter. (Contributed by Claudiu Popa in :issue:`16104`.)" msgstr "" -#: whatsnew/3.5.rst:965 +#: whatsnew/3.5.rst:964 msgid "" "Another new option, ``-r``, allows controlling the maximum recursion level " "for subdirectories. (Contributed by Claudiu Popa in :issue:`19628`.)" msgstr "" -#: whatsnew/3.5.rst:968 +#: whatsnew/3.5.rst:967 msgid "" "The ``-q`` command line option can now be specified more than once, in which " "case all output, including errors, will be suppressed. The corresponding " @@ -1176,11 +1397,11 @@ msgid "" "Thomas Kluyver in :issue:`21338`.)" msgstr "" -#: whatsnew/3.5.rst:977 +#: whatsnew/3.5.rst:976 msgid "concurrent.futures" msgstr "" -#: whatsnew/3.5.rst:979 +#: whatsnew/3.5.rst:978 msgid "" "The :meth:`Executor.map() ` method now " "accepts a *chunksize* argument to allow batching of tasks to improve " @@ -1188,18 +1409,18 @@ msgid "" "(Contributed by Dan O'Reilly in :issue:`11271`.)" msgstr "" -#: whatsnew/3.5.rst:984 +#: whatsnew/3.5.rst:983 msgid "" "The number of workers in the :class:`~concurrent.futures.ThreadPoolExecutor` " "constructor is optional now. The default value is 5 times the number of " "CPUs. (Contributed by Claudiu Popa in :issue:`21527`.)" msgstr "" -#: whatsnew/3.5.rst:990 +#: whatsnew/3.5.rst:989 msgid "configparser" msgstr "" -#: whatsnew/3.5.rst:992 +#: whatsnew/3.5.rst:991 msgid "" ":mod:`configparser` now provides a way to customize the conversion of values " "by specifying a dictionary of converters in the :class:`~configparser." @@ -1208,19 +1429,38 @@ msgid "" "inherited by its section proxies." msgstr "" -#: whatsnew/3.5.rst:998 +#: whatsnew/3.5.rst:997 msgid "Example::" msgstr "" -#: whatsnew/3.5.rst:1016 +#: whatsnew/3.5.rst:999 +msgid "" +">>> import configparser\n" +">>> conv = {}\n" +">>> conv['list'] = lambda v: [e.strip() for e in v.split() if e.strip()]\n" +">>> cfg = configparser.ConfigParser(converters=conv)\n" +">>> cfg.read_string(\"\"\"\n" +"... [s]\n" +"... list = a b c d e f g\n" +"... \"\"\")\n" +">>> cfg.get('s', 'list')\n" +"'a b c d e f g'\n" +">>> cfg.getlist('s', 'list')\n" +"['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" +">>> section = cfg['s']\n" +">>> section.getlist('list')\n" +"['a', 'b', 'c', 'd', 'e', 'f', 'g']" +msgstr "" + +#: whatsnew/3.5.rst:1015 msgid "(Contributed by Łukasz Langa in :issue:`18159`.)" msgstr "" -#: whatsnew/3.5.rst:1020 +#: whatsnew/3.5.rst:1019 msgid "contextlib" msgstr "" -#: whatsnew/3.5.rst:1022 +#: whatsnew/3.5.rst:1021 msgid "" "The new :func:`~contextlib.redirect_stderr` :term:`context manager` (similar " "to :func:`~contextlib.redirect_stdout`) makes it easier for utility scripts " @@ -1228,47 +1468,59 @@ msgid "" "don't provide any options to redirect it::" msgstr "" -#: whatsnew/3.5.rst:1035 +#: whatsnew/3.5.rst:1026 +msgid "" +">>> import contextlib, io, logging\n" +">>> f = io.StringIO()\n" +">>> with contextlib.redirect_stderr(f):\n" +"... logging.warning('warning')\n" +"...\n" +">>> f.getvalue()\n" +"'WARNING:root:warning\\n'" +msgstr "" + +#: whatsnew/3.5.rst:1034 msgid "(Contributed by Berker Peksag in :issue:`22389`.)" msgstr "" -#: whatsnew/3.5.rst:1039 +#: whatsnew/3.5.rst:1038 msgid "csv" msgstr "" -#: whatsnew/3.5.rst:1041 +#: whatsnew/3.5.rst:1040 msgid "" "The :meth:`~csv.csvwriter.writerow` method now supports arbitrary iterables, " "not just sequences. (Contributed by Serhiy Storchaka in :issue:`23171`.)" msgstr "" -#: whatsnew/3.5.rst:1046 +#: whatsnew/3.5.rst:1045 msgid "curses" msgstr "" -#: whatsnew/3.5.rst:1048 +#: whatsnew/3.5.rst:1047 msgid "" -"The new :func:`~curses.update_lines_cols` function updates the :data:`LINES` " -"and :data:`COLS` module variables. This is useful for detecting manual " -"screen resizing. (Contributed by Arnon Yaari in :issue:`4254`.)" +"The new :func:`~curses.update_lines_cols` function updates the :data:" +"`~curses.LINES` and :data:`~curses.COLS` module variables. This is useful " +"for detecting manual screen resizing. (Contributed by Arnon Yaari in :issue:" +"`4254`.)" msgstr "" -#: whatsnew/3.5.rst:1054 +#: whatsnew/3.5.rst:1053 msgid "dbm" msgstr "" -#: whatsnew/3.5.rst:1056 +#: whatsnew/3.5.rst:1055 msgid "" ":func:`dumb.open ` always creates a new database when the " "flag has the value ``\"n\"``. (Contributed by Claudiu Popa in :issue:" "`18039`.)" msgstr "" -#: whatsnew/3.5.rst:1061 +#: whatsnew/3.5.rst:1060 msgid "difflib" msgstr "" -#: whatsnew/3.5.rst:1063 +#: whatsnew/3.5.rst:1062 msgid "" "The charset of HTML documents generated by :meth:`HtmlDiff.make_file() " "` can now be customized by using a new *charset* " @@ -1277,47 +1529,47 @@ msgid "" "`2052`.)" msgstr "" -#: whatsnew/3.5.rst:1070 +#: whatsnew/3.5.rst:1069 msgid "" "The :func:`~difflib.diff_bytes` function can now compare lists of byte " "strings. This fixes a regression from Python 2. (Contributed by Terry J. " "Reedy and Greg Ward in :issue:`17445`.)" msgstr "" -#: whatsnew/3.5.rst:1076 +#: whatsnew/3.5.rst:1075 msgid "distutils" msgstr "" -#: whatsnew/3.5.rst:1078 +#: whatsnew/3.5.rst:1077 msgid "" "Both the ``build`` and ``build_ext`` commands now accept a ``-j`` option to " "enable parallel building of extension modules. (Contributed by Antoine " "Pitrou in :issue:`5309`.)" msgstr "" -#: whatsnew/3.5.rst:1082 +#: whatsnew/3.5.rst:1081 msgid "" "The ``distutils`` module now supports ``xz`` compression, and can be enabled " "by passing ``xztar`` as an argument to ``bdist --format``. (Contributed by " "Serhiy Storchaka in :issue:`16314`.)" msgstr "" -#: whatsnew/3.5.rst:1088 +#: whatsnew/3.5.rst:1087 msgid "doctest" msgstr "" -#: whatsnew/3.5.rst:1090 +#: whatsnew/3.5.rst:1089 msgid "" "The :func:`~doctest.DocTestSuite` function returns an empty :class:`unittest." "TestSuite` if *module* contains no docstrings, instead of raising :exc:" "`ValueError`. (Contributed by Glenn Jones in :issue:`15916`.)" msgstr "" -#: whatsnew/3.5.rst:1096 +#: whatsnew/3.5.rst:1095 msgid "email" msgstr "" -#: whatsnew/3.5.rst:1098 +#: whatsnew/3.5.rst:1097 msgid "" "A new policy option :attr:`Policy.mangle_from_ ` controls whether or not lines that start with ``\"From \"`` " @@ -1326,7 +1578,7 @@ msgid "" "other policies. (Contributed by Milan Oberkirch in :issue:`20098`.)" msgstr "" -#: whatsnew/3.5.rst:1104 +#: whatsnew/3.5.rst:1103 msgid "" "A new :meth:`Message.get_content_disposition() ` method provides easy access to a canonical value " @@ -1334,7 +1586,7 @@ msgid "" "Raj in :issue:`21083`.)" msgstr "" -#: whatsnew/3.5.rst:1110 +#: whatsnew/3.5.rst:1109 msgid "" "A new policy option :attr:`EmailPolicy.utf8 ` " "can be set to ``True`` to encode email headers using the UTF-8 charset " @@ -1344,32 +1596,41 @@ msgid "" "`24211`.)" msgstr "" -#: whatsnew/3.5.rst:1117 +#: whatsnew/3.5.rst:1116 msgid "" "The :class:`mime.text.MIMEText ` constructor now " "accepts a :class:`charset.Charset ` instance. " "(Contributed by Claude Paroz and Berker Peksag in :issue:`16324`.)" msgstr "" -#: whatsnew/3.5.rst:1123 +#: whatsnew/3.5.rst:1122 msgid "enum" msgstr "" -#: whatsnew/3.5.rst:1125 +#: whatsnew/3.5.rst:1124 msgid "" "The :class:`~enum.Enum` callable has a new parameter *start* to specify the " "initial number of enum values if only *names* are provided::" msgstr "" -#: whatsnew/3.5.rst:1134 +#: whatsnew/3.5.rst:1127 +msgid "" +">>> Animal = enum.Enum('Animal', 'cat dog', start=10)\n" +">>> Animal.cat\n" +"\n" +">>> Animal.dog\n" +"" +msgstr "" + +#: whatsnew/3.5.rst:1133 msgid "(Contributed by Ethan Furman in :issue:`21706`.)" msgstr "" -#: whatsnew/3.5.rst:1138 +#: whatsnew/3.5.rst:1137 msgid "faulthandler" msgstr "" -#: whatsnew/3.5.rst:1140 +#: whatsnew/3.5.rst:1139 msgid "" "The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:" "`~faulthandler.dump_traceback` and :func:`~faulthandler." @@ -1377,44 +1638,44 @@ msgid "" "file-like objects. (Contributed by Wei Wu in :issue:`23566`.)" msgstr "" -#: whatsnew/3.5.rst:1148 +#: whatsnew/3.5.rst:1147 msgid "functools" msgstr "" -#: whatsnew/3.5.rst:1152 +#: whatsnew/3.5.rst:1151 msgid "" "Most of the :func:`~functools.lru_cache` machinery is now implemented in C, " "making it significantly faster. (Contributed by Matt Joiner, Alexey " "Kachayev, and Serhiy Storchaka in :issue:`14373`.)" msgstr "" -#: whatsnew/3.5.rst:1158 +#: whatsnew/3.5.rst:1157 msgid "glob" msgstr "" -#: whatsnew/3.5.rst:1160 +#: whatsnew/3.5.rst:1159 msgid "" "The :func:`~glob.iglob` and :func:`~glob.glob` functions now support " "recursive search in subdirectories, using the ``\"**\"`` pattern. " "(Contributed by Serhiy Storchaka in :issue:`13968`.)" msgstr "" -#: whatsnew/3.5.rst:1166 +#: whatsnew/3.5.rst:1165 msgid "gzip" msgstr "" -#: whatsnew/3.5.rst:1168 +#: whatsnew/3.5.rst:1167 msgid "" "The *mode* argument of the :class:`~gzip.GzipFile` constructor now accepts " "``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney in :" "issue:`19222`.)" msgstr "" -#: whatsnew/3.5.rst:1174 +#: whatsnew/3.5.rst:1173 msgid "heapq" msgstr "" -#: whatsnew/3.5.rst:1176 +#: whatsnew/3.5.rst:1175 msgid "" "Element comparison in :func:`~heapq.merge` can now be customized by passing " "a :term:`key function` in a new optional *key* keyword argument, and a new " @@ -1422,26 +1683,37 @@ msgid "" "comparison::" msgstr "" -#: whatsnew/3.5.rst:1189 +#: whatsnew/3.5.rst:1180 +msgid "" +">>> import heapq\n" +">>> a = ['9', '777', '55555']\n" +">>> b = ['88', '6666']\n" +">>> list(heapq.merge(a, b, key=len))\n" +"['9', '88', '777', '6666', '55555']\n" +">>> list(heapq.merge(reversed(a), reversed(b), key=len, reverse=True))\n" +"['55555', '6666', '777', '88', '9']" +msgstr "" + +#: whatsnew/3.5.rst:1188 msgid "(Contributed by Raymond Hettinger in :issue:`13742`.)" msgstr "" -#: whatsnew/3.5.rst:1193 +#: whatsnew/3.5.rst:1192 msgid "http" msgstr "" -#: whatsnew/3.5.rst:1195 +#: whatsnew/3.5.rst:1194 msgid "" "A new :class:`HTTPStatus ` enum that defines a set of HTTP " "status codes, reason phrases and long descriptions written in English. " "(Contributed by Demian Brecht in :issue:`21793`.)" msgstr "" -#: whatsnew/3.5.rst:1201 +#: whatsnew/3.5.rst:1200 msgid "http.client" msgstr "" -#: whatsnew/3.5.rst:1203 +#: whatsnew/3.5.rst:1202 msgid "" ":meth:`HTTPConnection.getresponse() ` now raises a :exc:`~http.client.RemoteDisconnected` exception " @@ -1451,15 +1723,27 @@ msgid "" "the next request::" msgstr "" -#: whatsnew/3.5.rst:1219 +#: whatsnew/3.5.rst:1209 +msgid "" +"import http.client\n" +"conn = http.client.HTTPConnection('www.python.org')\n" +"for retries in range(3):\n" +" try:\n" +" conn.request('GET', '/')\n" +" resp = conn.getresponse()\n" +" except http.client.RemoteDisconnected:\n" +" pass" +msgstr "" + +#: whatsnew/3.5.rst:1218 msgid "(Contributed by Martin Panter in :issue:`3566`.)" msgstr "" -#: whatsnew/3.5.rst:1223 +#: whatsnew/3.5.rst:1222 msgid "idlelib and IDLE" msgstr "" -#: whatsnew/3.5.rst:1225 +#: whatsnew/3.5.rst:1224 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " "import by other programs, it gets improvements with every release. See :" @@ -1468,11 +1752,11 @@ msgid "" "from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" -#: whatsnew/3.5.rst:1233 +#: whatsnew/3.5.rst:1232 msgid "imaplib" msgstr "" -#: whatsnew/3.5.rst:1235 +#: whatsnew/3.5.rst:1234 msgid "" "The :class:`~imaplib.IMAP4` class now supports the :term:`context manager` " "protocol. When used in a :keyword:`with` statement, the IMAP4 ``LOGOUT`` " @@ -1480,7 +1764,7 @@ msgid "" "by Tarek Ziadé and Serhiy Storchaka in :issue:`4972`.)" msgstr "" -#: whatsnew/3.5.rst:1240 +#: whatsnew/3.5.rst:1239 msgid "" "The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) and :" "rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() `_ format (contributed by Martin Vignali and Claudiu Popa in :" -"issue:`20295`), and the `WebP `_ format " +"The :func:`!what` function now recognizes the `OpenEXR `_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" +"`20295`), and the `WebP `_ format " "(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" -#: whatsnew/3.5.rst:1263 +#: whatsnew/3.5.rst:1262 msgid "importlib" msgstr "" -#: whatsnew/3.5.rst:1265 +#: whatsnew/3.5.rst:1264 msgid "" "The :class:`util.LazyLoader ` class allows for " "lazy loading of modules in applications where startup time is important. " "(Contributed by Brett Cannon in :issue:`17621`.)" msgstr "" -#: whatsnew/3.5.rst:1269 +#: whatsnew/3.5.rst:1268 msgid "" "The :func:`abc.InspectLoader.source_to_code() ` method is now a static method. This makes it easier to " @@ -1529,7 +1813,7 @@ msgid "" "`21156`.)" msgstr "" -#: whatsnew/3.5.rst:1275 +#: whatsnew/3.5.rst:1274 msgid "" "The new :func:`util.module_from_spec() ` " "function is now the preferred way to create a new module. As opposed to " @@ -1538,36 +1822,45 @@ msgid "" "spec object. (Contributed by Brett Cannon in :issue:`20383`.)" msgstr "" -#: whatsnew/3.5.rst:1283 +#: whatsnew/3.5.rst:1282 msgid "inspect" msgstr "" -#: whatsnew/3.5.rst:1285 +#: whatsnew/3.5.rst:1284 msgid "" "Both the :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes " "are now picklable and hashable. (Contributed by Yury Selivanov in :issue:" "`20726` and :issue:`20334`.)" msgstr "" -#: whatsnew/3.5.rst:1289 +#: whatsnew/3.5.rst:1288 msgid "" "A new :meth:`BoundArguments.apply_defaults() ` method provides a way to set default values for missing " "arguments::" msgstr "" -#: whatsnew/3.5.rst:1299 +#: whatsnew/3.5.rst:1292 +msgid "" +">>> def foo(a, b='ham', *args): pass\n" +">>> ba = inspect.signature(foo).bind('spam')\n" +">>> ba.apply_defaults()\n" +">>> ba.arguments\n" +"OrderedDict([('a', 'spam'), ('b', 'ham'), ('args', ())])" +msgstr "" + +#: whatsnew/3.5.rst:1298 msgid "(Contributed by Yury Selivanov in :issue:`24190`.)" msgstr "" -#: whatsnew/3.5.rst:1301 +#: whatsnew/3.5.rst:1300 msgid "" "A new class method :meth:`Signature.from_callable() ` makes subclassing of :class:`~inspect.Signature` easier. " "(Contributed by Yury Selivanov and Eric Snow in :issue:`17373`.)" msgstr "" -#: whatsnew/3.5.rst:1306 +#: whatsnew/3.5.rst:1305 msgid "" "The :func:`~inspect.signature` function now accepts a *follow_wrapped* " "optional keyword argument, which, when set to ``False``, disables automatic " @@ -1575,7 +1868,7 @@ msgid "" "`20691`.)" msgstr "" -#: whatsnew/3.5.rst:1311 +#: whatsnew/3.5.rst:1310 msgid "" "A set of new functions to inspect :term:`coroutine functions ` and :term:`coroutine objects ` has been added: :func:" @@ -1585,18 +1878,18 @@ msgid "" "`24017` and :issue:`24400`.)" msgstr "" -#: whatsnew/3.5.rst:1319 +#: whatsnew/3.5.rst:1318 msgid "" "The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect." "getouterframes`, and :func:`~inspect.getinnerframes` functions now return a " "list of named tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" msgstr "" -#: whatsnew/3.5.rst:1326 +#: whatsnew/3.5.rst:1325 msgid "io" msgstr "" -#: whatsnew/3.5.rst:1328 +#: whatsnew/3.5.rst:1327 msgid "" "A new :meth:`BufferedIOBase.readinto1() ` " "method, that uses at most one call to the underlying raw stream's :meth:" @@ -1605,37 +1898,57 @@ msgid "" "`20578`.)" msgstr "" -#: whatsnew/3.5.rst:1336 +#: whatsnew/3.5.rst:1335 msgid "ipaddress" msgstr "" -#: whatsnew/3.5.rst:1338 +#: whatsnew/3.5.rst:1337 msgid "" "Both the :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` " "classes now accept an ``(address, netmask)`` tuple argument, so as to easily " "construct network objects from existing addresses::" msgstr "" -#: whatsnew/3.5.rst:1348 +#: whatsnew/3.5.rst:1341 +msgid "" +">>> import ipaddress\n" +">>> ipaddress.IPv4Network(('127.0.0.0', 8))\n" +"IPv4Network('127.0.0.0/8')\n" +">>> ipaddress.IPv4Network(('127.0.0.0', '255.0.0.0'))\n" +"IPv4Network('127.0.0.0/8')" +msgstr "" + +#: whatsnew/3.5.rst:1347 msgid "(Contributed by Peter Moody and Antoine Pitrou in :issue:`16531`.)" msgstr "" -#: whatsnew/3.5.rst:1350 +#: whatsnew/3.5.rst:1349 msgid "" -"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for the :" -"class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` classes " +"A new :attr:`~ipaddress.IPv4Address.reverse_pointer` attribute for the :" +"class:`~ipaddress.IPv4Address` and :class:`~ipaddress.IPv6Address` classes " "returns the name of the reverse DNS PTR record::" msgstr "" -#: whatsnew/3.5.rst:1362 +#: whatsnew/3.5.rst:1353 +msgid "" +">>> import ipaddress\n" +">>> addr = ipaddress.IPv4Address('127.0.0.1')\n" +">>> addr.reverse_pointer\n" +"'1.0.0.127.in-addr.arpa'\n" +">>> addr6 = ipaddress.IPv6Address('::1')\n" +">>> addr6.reverse_pointer\n" +"'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa'" +msgstr "" + +#: whatsnew/3.5.rst:1361 msgid "(Contributed by Leon Weber in :issue:`20480`.)" msgstr "" -#: whatsnew/3.5.rst:1366 +#: whatsnew/3.5.rst:1365 msgid "json" msgstr "" -#: whatsnew/3.5.rst:1368 +#: whatsnew/3.5.rst:1367 msgid "" "The :mod:`json.tool` command line interface now preserves the order of keys " "in JSON objects passed in input. The new ``--sort-keys`` option can be used " @@ -1643,18 +1956,18 @@ msgid "" "`21650`.)" msgstr "" -#: whatsnew/3.5.rst:1373 +#: whatsnew/3.5.rst:1372 msgid "" "JSON decoder now raises :exc:`~json.JSONDecodeError` instead of :exc:" "`ValueError` to provide better context information about the error. " "(Contributed by Serhiy Storchaka in :issue:`19361`.)" msgstr "" -#: whatsnew/3.5.rst:1379 +#: whatsnew/3.5.rst:1378 msgid "linecache" msgstr "" -#: whatsnew/3.5.rst:1381 +#: whatsnew/3.5.rst:1380 msgid "" "A new :func:`~linecache.lazycache` function can be used to capture " "information about a non-file-based module to permit getting its lines later " @@ -1663,26 +1976,39 @@ msgid "" "indefinitely. (Contributed by Robert Collins in :issue:`17911`.)" msgstr "" -#: whatsnew/3.5.rst:1389 +#: whatsnew/3.5.rst:1388 msgid "locale" msgstr "" -#: whatsnew/3.5.rst:1391 +#: whatsnew/3.5.rst:1390 msgid "" "A new :func:`~locale.delocalize` function can be used to convert a string " "into a normalized number string, taking the ``LC_NUMERIC`` settings into " "account::" msgstr "" -#: whatsnew/3.5.rst:1404 +#: whatsnew/3.5.rst:1393 +msgid "" +">>> import locale\n" +">>> locale.setlocale(locale.LC_NUMERIC, 'de_DE.UTF-8')\n" +"'de_DE.UTF-8'\n" +">>> locale.delocalize('1.234,56')\n" +"'1234.56'\n" +">>> locale.setlocale(locale.LC_NUMERIC, 'en_US.UTF-8')\n" +"'en_US.UTF-8'\n" +">>> locale.delocalize('1,234.56')\n" +"'1234.56'" +msgstr "" + +#: whatsnew/3.5.rst:1403 msgid "(Contributed by Cédric Krier in :issue:`13918`.)" msgstr "" -#: whatsnew/3.5.rst:1408 +#: whatsnew/3.5.rst:1407 msgid "logging" msgstr "" -#: whatsnew/3.5.rst:1410 +#: whatsnew/3.5.rst:1409 msgid "" "All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`, :" "meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:" @@ -1690,11 +2016,21 @@ msgid "" "*exc_info* argument, in addition to boolean values and exception tuples::" msgstr "" -#: whatsnew/3.5.rst:1423 +#: whatsnew/3.5.rst:1415 +msgid "" +">>> import logging\n" +">>> try:\n" +"... 1/0\n" +"... except ZeroDivisionError as ex:\n" +"... logging.error('exception', exc_info=ex)\n" +"ERROR:root:exception" +msgstr "" + +#: whatsnew/3.5.rst:1422 msgid "(Contributed by Yury Selivanov in :issue:`20537`.)" msgstr "" -#: whatsnew/3.5.rst:1425 +#: whatsnew/3.5.rst:1424 msgid "" "The :class:`handlers.HTTPHandler ` class now " "accepts an optional :class:`ssl.SSLContext` instance to configure SSL " @@ -1702,7 +2038,7 @@ msgid "" "`22788`.)" msgstr "" -#: whatsnew/3.5.rst:1430 +#: whatsnew/3.5.rst:1429 msgid "" "The :class:`handlers.QueueListener ` class " "now takes a *respect_handler_level* keyword argument which, if set to " @@ -1710,75 +2046,75 @@ msgid "" "(Contributed by Vinay Sajip.)" msgstr "" -#: whatsnew/3.5.rst:1437 +#: whatsnew/3.5.rst:1436 msgid "lzma" msgstr "" -#: whatsnew/3.5.rst:1439 +#: whatsnew/3.5.rst:1438 msgid "" "The :meth:`LZMADecompressor.decompress() ` " "method now accepts an optional *max_length* argument to limit the maximum " "size of decompressed data. (Contributed by Martin Panter in :issue:`15955`.)" msgstr "" -#: whatsnew/3.5.rst:1446 +#: whatsnew/3.5.rst:1445 msgid "math" msgstr "" -#: whatsnew/3.5.rst:1448 +#: whatsnew/3.5.rst:1447 msgid "" "Two new constants have been added to the :mod:`math` module: :data:`~math." "inf` and :data:`~math.nan`. (Contributed by Mark Dickinson in :issue:" "`23185`.)" msgstr "" -#: whatsnew/3.5.rst:1451 +#: whatsnew/3.5.rst:1450 msgid "" "A new function :func:`~math.isclose` provides a way to test for approximate " "equality. (Contributed by Chris Barker and Tal Einat in :issue:`24270`.)" msgstr "" -#: whatsnew/3.5.rst:1454 +#: whatsnew/3.5.rst:1453 msgid "" -"A new :func:`~math.gcd` function has been added. The :func:`fractions.gcd` " +"A new :func:`~math.gcd` function has been added. The :func:`!fractions.gcd` " "function is now deprecated. (Contributed by Mark Dickinson and Serhiy " "Storchaka in :issue:`22486`.)" msgstr "" -#: whatsnew/3.5.rst:1460 +#: whatsnew/3.5.rst:1459 msgid "multiprocessing" msgstr "" -#: whatsnew/3.5.rst:1462 +#: whatsnew/3.5.rst:1461 msgid "" ":func:`sharedctypes.synchronized() ` objects now support the :term:`context manager` protocol. " "(Contributed by Charles-François Natali in :issue:`21565`.)" msgstr "" -#: whatsnew/3.5.rst:1468 +#: whatsnew/3.5.rst:1467 msgid "operator" msgstr "" -#: whatsnew/3.5.rst:1470 +#: whatsnew/3.5.rst:1469 msgid "" ":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and :func:" "`~operator.methodcaller` objects now support pickling. (Contributed by Josh " "Rosenberg and Serhiy Storchaka in :issue:`22955`.)" msgstr "" -#: whatsnew/3.5.rst:1474 +#: whatsnew/3.5.rst:1473 msgid "" "New :func:`~operator.matmul` and :func:`~operator.imatmul` functions to " "perform matrix multiplication. (Contributed by Benjamin Peterson in :issue:" "`21176`.)" msgstr "" -#: whatsnew/3.5.rst:1480 +#: whatsnew/3.5.rst:1479 msgid "os" msgstr "" -#: whatsnew/3.5.rst:1482 +#: whatsnew/3.5.rst:1481 msgid "" "The new :func:`~os.scandir` function returning an iterator of :class:`~os." "DirEntry` objects has been added. If possible, :func:`~os.scandir` extracts " @@ -1788,7 +2124,7 @@ msgid "" "of Victor Stinner in :issue:`22524`.)" msgstr "" -#: whatsnew/3.5.rst:1489 +#: whatsnew/3.5.rst:1488 msgid "" "On Windows, a new :attr:`stat_result.st_file_attributes ` attribute is now available. It corresponds to the " @@ -1797,7 +2133,7 @@ msgid "" "issue:`21719`.)" msgstr "" -#: whatsnew/3.5.rst:1495 +#: whatsnew/3.5.rst:1494 msgid "" "The :func:`~os.urandom` function now uses the ``getrandom()`` syscall on " "Linux 3.17 or newer, and ``getentropy()`` on OpenBSD 5.6 and newer, removing " @@ -1805,60 +2141,78 @@ msgid "" "descriptor exhaustion. (Contributed by Victor Stinner in :issue:`22181`.)" msgstr "" -#: whatsnew/3.5.rst:1500 +#: whatsnew/3.5.rst:1499 msgid "" "New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow " "getting and setting a file descriptor's blocking mode (:const:`~os." "O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" msgstr "" -#: whatsnew/3.5.rst:1504 +#: whatsnew/3.5.rst:1503 msgid "" "The :func:`~os.truncate` and :func:`~os.ftruncate` functions are now " "supported on Windows. (Contributed by Steve Dower in :issue:`23668`.)" msgstr "" -#: whatsnew/3.5.rst:1507 +#: whatsnew/3.5.rst:1506 msgid "" "There is a new :func:`os.path.commonpath` function returning the longest " "common sub-path of each passed pathname. Unlike the :func:`os.path." "commonprefix` function, it always returns a valid path::" msgstr "" -#: whatsnew/3.5.rst:1518 +#: whatsnew/3.5.rst:1511 +msgid "" +">>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n" +"'/usr/l'\n" +"\n" +">>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n" +"'/usr'" +msgstr "" + +#: whatsnew/3.5.rst:1517 msgid "(Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.)" msgstr "" -#: whatsnew/3.5.rst:1522 +#: whatsnew/3.5.rst:1521 msgid "pathlib" msgstr "" -#: whatsnew/3.5.rst:1524 +#: whatsnew/3.5.rst:1523 msgid "" "The new :meth:`Path.samefile() ` method can be used " "to check whether the path points to the same file as another path, which can " "be either another :class:`~pathlib.Path` object, or a string::" msgstr "" -#: whatsnew/3.5.rst:1534 +#: whatsnew/3.5.rst:1527 +msgid "" +">>> import pathlib\n" +">>> p1 = pathlib.Path('/etc/hosts')\n" +">>> p2 = pathlib.Path('/etc/../etc/hosts')\n" +">>> p1.samefile(p2)\n" +"True" +msgstr "" + +#: whatsnew/3.5.rst:1533 msgid "(Contributed by Vajrasky Kok and Antoine Pitrou in :issue:`19775`.)" msgstr "" -#: whatsnew/3.5.rst:1536 +#: whatsnew/3.5.rst:1535 msgid "" "The :meth:`Path.mkdir() ` method now accepts a new " "optional *exist_ok* argument to match ``mkdir -p`` and :func:`os.makedirs` " "functionality. (Contributed by Berker Peksag in :issue:`21539`.)" msgstr "" -#: whatsnew/3.5.rst:1540 +#: whatsnew/3.5.rst:1539 msgid "" "There is a new :meth:`Path.expanduser() ` method to " "expand ``~`` and ``~user`` prefixes. (Contributed by Serhiy Storchaka and " "Claudiu Popa in :issue:`19776`.)" msgstr "" -#: whatsnew/3.5.rst:1544 +#: whatsnew/3.5.rst:1543 msgid "" "A new :meth:`Path.home() ` class method can be used to " "get a :class:`~pathlib.Path` instance representing the user’s home " @@ -1866,7 +2220,7 @@ msgid "" "`19777`.)" msgstr "" -#: whatsnew/3.5.rst:1549 +#: whatsnew/3.5.rst:1548 msgid "" "New :meth:`Path.write_text() `, :meth:`Path." "read_text() `, :meth:`Path.write_bytes() >> import pathlib\n" +">>> p = pathlib.Path('~/spam42')\n" +">>> p.expanduser().write_text('ham')\n" +"3" +msgstr "" + +#: whatsnew/3.5.rst:1562 msgid "(Contributed by Christopher Welborn in :issue:`20218`.)" msgstr "" -#: whatsnew/3.5.rst:1567 +#: whatsnew/3.5.rst:1566 msgid "pickle" msgstr "" -#: whatsnew/3.5.rst:1569 +#: whatsnew/3.5.rst:1568 msgid "" "Nested objects, such as unbound methods or nested classes, can now be " "pickled using :ref:`pickle protocols ` older than protocol " @@ -1896,82 +2258,104 @@ msgid "" "Serhiy Storchaka in :issue:`23611`.)" msgstr "" -#: whatsnew/3.5.rst:1576 +#: whatsnew/3.5.rst:1575 msgid "poplib" msgstr "" -#: whatsnew/3.5.rst:1578 +#: whatsnew/3.5.rst:1577 msgid "" "A new :meth:`POP3.utf8() ` command enables :rfc:`6856` " "(Internationalized Email) support, if a POP server supports it. (Contributed " "by Milan OberKirch in :issue:`21804`.)" msgstr "" -#: whatsnew/3.5.rst:1584 +#: whatsnew/3.5.rst:1583 msgid "re" msgstr "" -#: whatsnew/3.5.rst:1586 +#: whatsnew/3.5.rst:1585 msgid "" "References and conditional references to groups with fixed length are now " "allowed in lookbehind assertions::" msgstr "" -#: whatsnew/3.5.rst:1596 +#: whatsnew/3.5.rst:1588 +msgid "" +">>> import re\n" +">>> pat = re.compile(r'(a|b).(?<=\\1)c')\n" +">>> pat.match('aac')\n" +"<_sre.SRE_Match object; span=(0, 3), match='aac'>\n" +">>> pat.match('bbc')\n" +"<_sre.SRE_Match object; span=(0, 3), match='bbc'>" +msgstr "" + +#: whatsnew/3.5.rst:1595 msgid "(Contributed by Serhiy Storchaka in :issue:`9179`.)" msgstr "" -#: whatsnew/3.5.rst:1598 +#: whatsnew/3.5.rst:1597 msgid "" "The number of capturing groups in regular expressions is no longer limited " "to 100. (Contributed by Serhiy Storchaka in :issue:`22437`.)" msgstr "" -#: whatsnew/3.5.rst:1601 +#: whatsnew/3.5.rst:1600 msgid "" "The :func:`~re.sub` and :func:`~re.subn` functions now replace unmatched " "groups with empty strings instead of raising an exception. (Contributed by " "Serhiy Storchaka in :issue:`1519638`.)" msgstr "" -#: whatsnew/3.5.rst:1605 +#: whatsnew/3.5.rst:1604 msgid "" -"The :class:`re.error` exceptions have new attributes, :attr:`~re.error." -"msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error." -"lineno`, and :attr:`~re.error.colno`, that provide better context " -"information about the error::" +"The :class:`re.error ` exceptions have new attributes, :" +"attr:`~re.PatternError.msg`, :attr:`~re.PatternError.pattern`, :attr:`~re." +"PatternError.pos`, :attr:`~re.PatternError.lineno`, and :attr:`~re." +"PatternError.colno`, that provide better context information about the " +"error::" msgstr "" -#: whatsnew/3.5.rst:1619 +#: whatsnew/3.5.rst:1610 +msgid "" +">>> re.compile(\"\"\"\n" +"... (?x)\n" +"... .++\n" +"... \"\"\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"sre_constants.error: multiple repeat at position 16 (line 3, column 7)" +msgstr "" + +#: whatsnew/3.5.rst:1618 msgid "(Contributed by Serhiy Storchaka in :issue:`22578`.)" msgstr "" -#: whatsnew/3.5.rst:1623 +#: whatsnew/3.5.rst:1622 msgid "readline" msgstr "" -#: whatsnew/3.5.rst:1625 +#: whatsnew/3.5.rst:1624 msgid "" "A new :func:`~readline.append_history_file` function can be used to append " "the specified number of trailing elements in history to the given file. " "(Contributed by Bruno Cauet in :issue:`22940`.)" msgstr "" -#: whatsnew/3.5.rst:1631 +#: whatsnew/3.5.rst:1630 msgid "selectors" msgstr "" -#: whatsnew/3.5.rst:1633 +#: whatsnew/3.5.rst:1632 msgid "" "The new :class:`~selectors.DevpollSelector` supports efficient ``/dev/poll`` " "polling on Solaris. (Contributed by Giampaolo Rodola' in :issue:`18931`.)" msgstr "" -#: whatsnew/3.5.rst:1639 +#: whatsnew/3.5.rst:1638 msgid "shutil" msgstr "" -#: whatsnew/3.5.rst:1641 +#: whatsnew/3.5.rst:1640 msgid "" "The :func:`~shutil.move` function now accepts a *copy_function* argument, " "allowing, for example, the :func:`~shutil.copy` function to be used instead " @@ -1979,23 +2363,23 @@ msgid "" "metadata when moving. (Contributed by Claudiu Popa in :issue:`19840`.)" msgstr "" -#: whatsnew/3.5.rst:1647 +#: whatsnew/3.5.rst:1646 msgid "" "The :func:`~shutil.make_archive` function now supports the *xztar* format. " "(Contributed by Serhiy Storchaka in :issue:`5411`.)" msgstr "" -#: whatsnew/3.5.rst:1652 +#: whatsnew/3.5.rst:1651 msgid "signal" msgstr "" -#: whatsnew/3.5.rst:1654 +#: whatsnew/3.5.rst:1653 msgid "" "On Windows, the :func:`~signal.set_wakeup_fd` function now also supports " "socket handles. (Contributed by Victor Stinner in :issue:`22018`.)" msgstr "" -#: whatsnew/3.5.rst:1657 +#: whatsnew/3.5.rst:1656 msgid "" "Various ``SIG*`` constants in the :mod:`signal` module have been converted " "into :mod:`Enums `. This allows meaningful names to be printed during " @@ -2003,60 +2387,60 @@ msgid "" "Rodola' in :issue:`21076`.)" msgstr "" -#: whatsnew/3.5.rst:1664 +#: whatsnew/3.5.rst:1663 msgid "smtpd" msgstr "" -#: whatsnew/3.5.rst:1666 +#: whatsnew/3.5.rst:1665 msgid "" "Both the :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*decode_data* keyword argument to determine if the ``DATA`` portion of the " "SMTP transaction is decoded using the ``\"utf-8\"`` codec or is instead " -"provided to the :meth:`!SMTPServer.process_message()` method as a byte " +"provided to the :meth:`!SMTPServer.process_message` method as a byte " "string. The default is ``True`` for backward compatibility reasons, but " "will change to ``False`` in Python 3.6. If *decode_data* is set to " "``False``, the ``process_message`` method must be prepared to accept keyword " "arguments. (Contributed by Maciej Szulik in :issue:`19662`.)" msgstr "" -#: whatsnew/3.5.rst:1677 +#: whatsnew/3.5.rst:1676 msgid "" "The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension (:" "rfc:`6152`) if *decode_data* has been set ``True``. If the client specifies " "``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" -"SMTPServer.process_message()` via the *mail_options* keyword. (Contributed " -"by Milan Oberkirch and R. David Murray in :issue:`21795`.)" +"SMTPServer.process_message` via the *mail_options* keyword. (Contributed by " +"Milan Oberkirch and R. David Murray in :issue:`21795`.)" msgstr "" -#: whatsnew/3.5.rst:1684 +#: whatsnew/3.5.rst:1683 msgid "" "The :class:`!SMTPServer` class now also supports the ``SMTPUTF8`` extension " "(:rfc:`6531`: Internationalized Email). If the client specified ``SMTPUTF8 " "BODY=8BITMIME`` on the ``MAIL`` command, they are passed to :meth:`!" -"SMTPServer.process_message()` via the *mail_options* keyword. It is the " +"SMTPServer.process_message` via the *mail_options* keyword. It is the " "responsibility of the ``process_message`` method to correctly handle the " "``SMTPUTF8`` data. (Contributed by Milan Oberkirch in :issue:`21725`.)" msgstr "" -#: whatsnew/3.5.rst:1692 +#: whatsnew/3.5.rst:1691 msgid "" "It is now possible to provide, directly or via name resolution, IPv6 " "addresses in the :class:`!SMTPServer` constructor, and have it successfully " "connect. (Contributed by Milan Oberkirch in :issue:`14758`.)" msgstr "" -#: whatsnew/3.5.rst:1698 +#: whatsnew/3.5.rst:1697 msgid "smtplib" msgstr "" -#: whatsnew/3.5.rst:1700 +#: whatsnew/3.5.rst:1699 msgid "" "A new :meth:`SMTP.auth() ` method provides a convenient " "way to implement custom authentication mechanisms. (Contributed by Milan " "Oberkirch in :issue:`15014`.)" msgstr "" -#: whatsnew/3.5.rst:1704 +#: whatsnew/3.5.rst:1703 msgid "" "The :meth:`SMTP.set_debuglevel() ` method now " "accepts an additional debuglevel (2), which enables timestamps in debug " @@ -2064,7 +2448,7 @@ msgid "" "`16914`.)" msgstr "" -#: whatsnew/3.5.rst:1708 +#: whatsnew/3.5.rst:1707 msgid "" "Both the :meth:`SMTP.sendmail() ` and :meth:`SMTP." "send_message() ` methods now support :rfc:`6531` " @@ -2072,28 +2456,27 @@ msgid "" "`22027`.)" msgstr "" -#: whatsnew/3.5.rst:1715 +#: whatsnew/3.5.rst:1714 msgid "sndhdr" msgstr "" -#: whatsnew/3.5.rst:1717 +#: whatsnew/3.5.rst:1716 msgid "" -"The :func:`~sndhdr.what` and :func:`~sndhdr.whathdr` functions now return " -"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:" -"`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return a :func:" +"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" msgstr "" -#: whatsnew/3.5.rst:1723 +#: whatsnew/3.5.rst:1722 msgid "socket" msgstr "" -#: whatsnew/3.5.rst:1725 +#: whatsnew/3.5.rst:1724 msgid "" "Functions with timeouts now use a monotonic clock, instead of a system " "clock. (Contributed by Victor Stinner in :issue:`22043`.)" msgstr "" -#: whatsnew/3.5.rst:1728 +#: whatsnew/3.5.rst:1727 msgid "" "A new :meth:`socket.sendfile() ` method allows " "sending a file over a socket by using the high-performance :func:`os." @@ -2102,7 +2485,7 @@ msgid "" "(Contributed by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" -#: whatsnew/3.5.rst:1734 +#: whatsnew/3.5.rst:1733 msgid "" "The :meth:`socket.sendall() ` method no longer resets " "the socket timeout every time bytes are received or sent. The socket " @@ -2110,7 +2493,7 @@ msgid "" "Victor Stinner in :issue:`23853`.)" msgstr "" -#: whatsnew/3.5.rst:1739 +#: whatsnew/3.5.rst:1738 msgid "" "The *backlog* argument of the :meth:`socket.listen() ` " "method is now optional. By default it is set to :data:`SOMAXCONN ` method can be " "used to create a new ``SSLObject`` instance." msgstr "" -#: whatsnew/3.5.rst:1771 +#: whatsnew/3.5.rst:1770 msgid "Application-Layer Protocol Negotiation Support" msgstr "" -#: whatsnew/3.5.rst:1773 +#: whatsnew/3.5.rst:1772 msgid "(Contributed by Benjamin Peterson in :issue:`20188`.)" msgstr "" -#: whatsnew/3.5.rst:1775 +#: whatsnew/3.5.rst:1774 msgid "" "Where OpenSSL support is present, the :mod:`ssl` module now implements the " "*Application-Layer Protocol Negotiation* TLS extension as described in :rfc:" "`7301`." msgstr "" -#: whatsnew/3.5.rst:1779 +#: whatsnew/3.5.rst:1778 msgid "" "The new :meth:`SSLContext.set_alpn_protocols() ` can be used to specify which protocols a socket should " "advertise during the TLS handshake." msgstr "" -#: whatsnew/3.5.rst:1783 +#: whatsnew/3.5.rst:1782 msgid "" "The new :meth:`SSLSocket.selected_alpn_protocol() ` returns the protocol that was selected during the " @@ -2183,69 +2566,67 @@ msgid "" "support is present." msgstr "" -#: whatsnew/3.5.rst:1790 +#: whatsnew/3.5.rst:1789 msgid "Other Changes" msgstr "" -#: whatsnew/3.5.rst:1792 +#: whatsnew/3.5.rst:1791 msgid "" "There is a new :meth:`SSLSocket.version() ` method to " "query the actual protocol version in use. (Contributed by Antoine Pitrou in :" "issue:`20421`.)" msgstr "" -#: whatsnew/3.5.rst:1796 +#: whatsnew/3.5.rst:1795 msgid "" -"The :class:`~ssl.SSLSocket` class now implements a :meth:`SSLSocket." -"sendfile() ` method. (Contributed by Giampaolo " -"Rodola' in :issue:`17552`.)" +"The :class:`~ssl.SSLSocket` class now implements a :meth:`!SSLSocket." +"sendfile` method. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" -#: whatsnew/3.5.rst:1800 +#: whatsnew/3.5.rst:1799 msgid "" -"The :meth:`SSLSocket.send() ` method now raises either " -"the :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` exception on " -"a non-blocking socket if the operation would block. Previously, it would " -"return ``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`!SSLSocket.send` method now raises either the :exc:`ssl." +"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` exception on a non-" +"blocking socket if the operation would block. Previously, it would return " +"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" -#: whatsnew/3.5.rst:1805 +#: whatsnew/3.5.rst:1804 msgid "" "The :func:`~ssl.cert_time_to_seconds` function now interprets the input time " "as UTC and not as local time, per :rfc:`5280`. Additionally, the return " "value is always an :class:`int`. (Contributed by Akira Li in :issue:`19940`.)" msgstr "" -#: whatsnew/3.5.rst:1809 +#: whatsnew/3.5.rst:1808 msgid "" -"New :meth:`SSLObject.shared_ciphers() ` and :" -"meth:`SSLSocket.shared_ciphers() ` methods " -"return the list of ciphers sent by the client during the handshake. " -"(Contributed by Benjamin Peterson in :issue:`23186`.)" +"New :meth:`!SSLObject.shared_ciphers` and :meth:`SSLSocket.shared_ciphers() " +"` methods return the list of ciphers sent by " +"the client during the handshake. (Contributed by Benjamin Peterson in :issue:" +"`23186`.)" msgstr "" -#: whatsnew/3.5.rst:1814 +#: whatsnew/3.5.rst:1813 msgid "" "The :meth:`SSLSocket.do_handshake() `, :meth:" -"`SSLSocket.read() `, :meth:`SSLSocket.shutdown() `, and :meth:`SSLSocket.write() ` " -"methods of the :class:`~ssl.SSLSocket` class no longer reset the socket " -"timeout every time bytes are received or sent. The socket timeout is now the " -"maximum total duration of the method. (Contributed by Victor Stinner in :" -"issue:`23853`.)" +"`SSLSocket.read() `, :meth:`!SSLSocket.shutdown`, and :" +"meth:`SSLSocket.write() ` methods of the :class:`~ssl." +"SSLSocket` class no longer reset the socket timeout every time bytes are " +"received or sent. The socket timeout is now the maximum total duration of " +"the method. (Contributed by Victor Stinner in :issue:`23853`.)" msgstr "" -#: whatsnew/3.5.rst:1822 +#: whatsnew/3.5.rst:1821 msgid "" -"The :func:`~ssl.match_hostname` function now supports matching of IP " -"addresses. (Contributed by Antoine Pitrou in :issue:`23239`.)" +"The :func:`!match_hostname` function now supports matching of IP addresses. " +"(Contributed by Antoine Pitrou in :issue:`23239`.)" msgstr "" -#: whatsnew/3.5.rst:1827 +#: whatsnew/3.5.rst:1826 msgid "sqlite3" msgstr "" -#: whatsnew/3.5.rst:1829 +#: whatsnew/3.5.rst:1828 msgid "" "The :class:`~sqlite3.Row` class now fully supports the sequence protocol, in " "particular :func:`reversed` iteration and slice indexing. (Contributed by " @@ -2253,11 +2634,11 @@ msgid "" "Serhiy Storchaka in :issue:`13583`.)" msgstr "" -#: whatsnew/3.5.rst:1838 +#: whatsnew/3.5.rst:1837 msgid "subprocess" msgstr "" -#: whatsnew/3.5.rst:1840 +#: whatsnew/3.5.rst:1839 msgid "" "The new :func:`~subprocess.run` function has been added. It runs the " "specified command and returns a :class:`~subprocess.CompletedProcess` " @@ -2267,50 +2648,66 @@ msgid "" "(Contributed by Thomas Kluyver in :issue:`23342`.)" msgstr "" -#: whatsnew/3.5.rst:1864 +#: whatsnew/3.5.rst:1849 +msgid "" +">>> subprocess.run([\"ls\", \"-l\"]) # doesn't capture output\n" +"CompletedProcess(args=['ls', '-l'], returncode=0)\n" +"\n" +">>> subprocess.run(\"exit 1\", shell=True, check=True)\n" +"Traceback (most recent call last):\n" +" ...\n" +"subprocess.CalledProcessError: Command 'exit 1' returned non-zero exit " +"status 1\n" +"\n" +">>> subprocess.run([\"ls\", \"-l\", \"/dev/null\"], stdout=subprocess.PIPE)\n" +"CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,\n" +"stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\\n')" +msgstr "" + +#: whatsnew/3.5.rst:1863 msgid "sys" msgstr "" -#: whatsnew/3.5.rst:1866 +#: whatsnew/3.5.rst:1865 msgid "" -"A new :func:`~sys.set_coroutine_wrapper` function allows setting a global " -"hook that will be called whenever a :term:`coroutine object ` is " -"created by an :keyword:`async def` function. A corresponding :func:`~sys." +"A new :func:`!set_coroutine_wrapper` function allows setting a global hook " +"that will be called whenever a :term:`coroutine object ` is " +"created by an :keyword:`async def` function. A corresponding :func:`!" "get_coroutine_wrapper` can be used to obtain a currently set wrapper. Both " "functions are :term:`provisional `, and are intended for " "debugging purposes only. (Contributed by Yury Selivanov in :issue:`24017`.)" msgstr "" -#: whatsnew/3.5.rst:1874 +#: whatsnew/3.5.rst:1873 msgid "" "A new :func:`~sys.is_finalizing` function can be used to check if the Python " "interpreter is :term:`shutting down `. (Contributed by " "Antoine Pitrou in :issue:`22696`.)" msgstr "" -#: whatsnew/3.5.rst:1880 +#: whatsnew/3.5.rst:1879 msgid "sysconfig" msgstr "" -#: whatsnew/3.5.rst:1882 +#: whatsnew/3.5.rst:1881 msgid "" "The name of the user scripts directory on Windows now includes the first two " "components of the Python version. (Contributed by Paul Moore in :issue:" "`23437`.)" msgstr "" -#: whatsnew/3.5.rst:1888 +#: whatsnew/3.5.rst:1887 msgid "tarfile" msgstr "" -#: whatsnew/3.5.rst:1890 +#: whatsnew/3.5.rst:1889 msgid "" "The *mode* argument of the :func:`~tarfile.open` function now accepts " "``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag in :" "issue:`21717`.)" msgstr "" -#: whatsnew/3.5.rst:1893 +#: whatsnew/3.5.rst:1892 msgid "" "The :meth:`TarFile.extractall() ` and :meth:" "`TarFile.extract() ` methods now take a keyword " @@ -2321,7 +2718,7 @@ msgid "" "tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)" msgstr "" -#: whatsnew/3.5.rst:1901 +#: whatsnew/3.5.rst:1900 msgid "" "The :meth:`TarFile.list() ` now accepts an optional " "*members* keyword argument that can be set to a subset of the list returned " @@ -2329,87 +2726,87 @@ msgid "" "by Serhiy Storchaka in :issue:`21549`.)" msgstr "" -#: whatsnew/3.5.rst:1908 +#: whatsnew/3.5.rst:1907 msgid "threading" msgstr "" -#: whatsnew/3.5.rst:1910 +#: whatsnew/3.5.rst:1909 msgid "" "Both the :meth:`Lock.acquire() ` and :meth:`RLock." "acquire() ` methods now use a monotonic clock for " "timeout management. (Contributed by Victor Stinner in :issue:`22043`.)" msgstr "" -#: whatsnew/3.5.rst:1917 +#: whatsnew/3.5.rst:1916 msgid "time" msgstr "" -#: whatsnew/3.5.rst:1919 +#: whatsnew/3.5.rst:1918 msgid "" "The :func:`~time.monotonic` function is now always available. (Contributed " "by Victor Stinner in :issue:`22043`.)" msgstr "" -#: whatsnew/3.5.rst:1924 +#: whatsnew/3.5.rst:1923 msgid "timeit" msgstr "" -#: whatsnew/3.5.rst:1926 +#: whatsnew/3.5.rst:1925 msgid "" "A new command line option ``-u`` or :samp:`--unit={U}` can be used to " "specify the time unit for the timer output. Supported options are ``usec``, " "``msec``, or ``sec``. (Contributed by Julian Gindi in :issue:`18983`.)" msgstr "" -#: whatsnew/3.5.rst:1930 +#: whatsnew/3.5.rst:1929 msgid "" "The :func:`~timeit.timeit` function has a new *globals* parameter for " "specifying the namespace in which the code will be running. (Contributed by " "Ben Roberts in :issue:`2527`.)" msgstr "" -#: whatsnew/3.5.rst:1936 +#: whatsnew/3.5.rst:1935 msgid "tkinter" msgstr "" -#: whatsnew/3.5.rst:1938 +#: whatsnew/3.5.rst:1937 msgid "" -"The :mod:`tkinter._fix` module used for setting up the Tcl/Tk environment on " -"Windows has been replaced by a private function in the :mod:`_tkinter` " +"The :mod:`!tkinter._fix` module used for setting up the Tcl/Tk environment " +"on Windows has been replaced by a private function in the :mod:`!_tkinter` " "module which makes no permanent changes to environment variables. " "(Contributed by Zachary Ware in :issue:`20035`.)" msgstr "" -#: whatsnew/3.5.rst:1947 +#: whatsnew/3.5.rst:1946 msgid "traceback" msgstr "" -#: whatsnew/3.5.rst:1949 +#: whatsnew/3.5.rst:1948 msgid "" "New :func:`~traceback.walk_stack` and :func:`~traceback.walk_tb` functions " "to conveniently traverse frame and :ref:`traceback objects `. (Contributed by Robert Collins in :issue:`17911`.)" msgstr "" -#: whatsnew/3.5.rst:1954 +#: whatsnew/3.5.rst:1953 msgid "" "New lightweight classes: :class:`~traceback.TracebackException`, :class:" "`~traceback.StackSummary`, and :class:`~traceback.FrameSummary`. " "(Contributed by Robert Collins in :issue:`17911`.)" msgstr "" -#: whatsnew/3.5.rst:1958 +#: whatsnew/3.5.rst:1957 msgid "" "Both the :func:`~traceback.print_tb` and :func:`~traceback.print_stack` " "functions now support negative values for the *limit* argument. (Contributed " "by Dmitry Kazakov in :issue:`22619`.)" msgstr "" -#: whatsnew/3.5.rst:1964 +#: whatsnew/3.5.rst:1963 msgid "types" msgstr "" -#: whatsnew/3.5.rst:1966 +#: whatsnew/3.5.rst:1965 msgid "" "A new :func:`~types.coroutine` function to transform :term:`generator " "` and :class:`generator-like `_." msgstr "" -#: whatsnew/3.5.rst:1985 +#: whatsnew/3.5.rst:1984 msgid "unittest" msgstr "" -#: whatsnew/3.5.rst:1987 +#: whatsnew/3.5.rst:1986 msgid "" "The :meth:`TestLoader.loadTestsFromModule() ` method now accepts a keyword-only argument *pattern* " @@ -2449,47 +2846,47 @@ msgid "" "`16662`.)" msgstr "" -#: whatsnew/3.5.rst:1994 +#: whatsnew/3.5.rst:1993 msgid "" "Unittest discovery errors now are exposed in the :data:`TestLoader.errors " "` attribute of the :class:`~unittest.TestLoader` " "instance. (Contributed by Robert Collins in :issue:`19746`.)" msgstr "" -#: whatsnew/3.5.rst:1999 +#: whatsnew/3.5.rst:1998 msgid "" "A new command line option ``--locals`` to show local variables in " "tracebacks. (Contributed by Robert Collins in :issue:`22936`.)" msgstr "" -#: whatsnew/3.5.rst:2004 +#: whatsnew/3.5.rst:2003 msgid "unittest.mock" msgstr "" -#: whatsnew/3.5.rst:2006 +#: whatsnew/3.5.rst:2005 msgid "The :class:`~unittest.mock.Mock` class has the following improvements:" msgstr "" -#: whatsnew/3.5.rst:2008 +#: whatsnew/3.5.rst:2007 msgid "" "The class constructor has a new *unsafe* parameter, which causes mock " "objects to raise :exc:`AttributeError` on attribute names starting with " "``\"assert\"``. (Contributed by Kushal Das in :issue:`21238`.)" msgstr "" -#: whatsnew/3.5.rst:2013 +#: whatsnew/3.5.rst:2012 msgid "" "A new :meth:`Mock.assert_not_called() ` method to check if the mock object was called. " "(Contributed by Kushal Das in :issue:`21262`.)" msgstr "" -#: whatsnew/3.5.rst:2017 +#: whatsnew/3.5.rst:2016 msgid "" -"The :class:`~unittest.mock.MagicMock` class now supports :meth:" -"`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` operators. " -"(Contributed by Johannes Baiter in :issue:`20968`, and Håkan Lövdahl in :" -"issue:`23581` and :issue:`23568`.)" +"The :class:`~unittest.mock.MagicMock` class now supports :meth:`~object." +"__truediv__`, :meth:`~object.__divmod__` and :meth:`~object.__matmul__` " +"operators. (Contributed by Johannes Baiter in :issue:`20968`, and Håkan " +"Lövdahl in :issue:`23581` and :issue:`23568`.)" msgstr "" #: whatsnew/3.5.rst:2022 @@ -2605,7 +3002,7 @@ msgstr "" #: whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`ossaudiodev`, :mod:`socket`, :mod:" +"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" "`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " "objects `. (Contributed by Serhiy Storchaka in :issue:" "`23001`.)" @@ -2926,14 +3323,14 @@ msgstr "" #: whatsnew/3.5.rst:2293 msgid "" -"The :mod:`formatter` module has now graduated to full deprecation and is " +"The :mod:`!formatter` module has now graduated to full deprecation and is " "still slated for removal in Python 3.6." msgstr "" #: whatsnew/3.5.rst:2296 msgid "" -"The :func:`asyncio.async` function is deprecated in favor of :func:`~asyncio." -"ensure_future`." +"The :func:`!asyncio.async` function is deprecated in favor of :func:" +"`~asyncio.ensure_future`." msgstr "" #: whatsnew/3.5.rst:2299 @@ -2964,9 +3361,9 @@ msgstr "" #: whatsnew/3.5.rst:2317 msgid "" -"The :func:`platform.dist` and :func:`platform.linux_distribution` functions " -"are now deprecated. Linux distributions use too many different ways of " -"describing themselves, so the functionality is left to a package. " +"The :func:`!platform.dist` and :func:`!platform.linux_distribution` " +"functions are now deprecated. Linux distributions use too many different " +"ways of describing themselves, so the functionality is left to a package. " "(Contributed by Vajrasky Kok and Berker Peksag in :issue:`1322`.)" msgstr "" @@ -2980,16 +3377,16 @@ msgstr "" #: whatsnew/3.5.rst:2327 msgid "" -"The :func:`inspect.getargspec` function is deprecated and scheduled to be " +"The :func:`!inspect.getargspec` function is deprecated and scheduled to be " "removed in Python 3.6. (See :issue:`20438` for details.)" msgstr "" #: whatsnew/3.5.rst:2330 msgid "" "The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect." -"getcallargs`, and :func:`~inspect.formatargspec` functions are deprecated in " -"favor of the :func:`inspect.signature` API. (Contributed by Yury Selivanov " -"in :issue:`20438`.)" +"getcallargs`, and :func:`!formatargspec` functions are deprecated in favor " +"of the :func:`inspect.signature` API. (Contributed by Yury Selivanov in :" +"issue:`20438`.)" msgstr "" #: whatsnew/3.5.rst:2335 @@ -3078,6 +3475,12 @@ msgid "" "following syntax::" msgstr "" +#: whatsnew/3.5.rst:2389 +msgid "" +"f(1 for x in [1], *args)\n" +"f(1 for x in [1], **kwargs)" +msgstr "" + #: whatsnew/3.5.rst:2392 msgid "" "Python 3.5 now correctly raises a :exc:`SyntaxError`, as generator " @@ -3105,7 +3508,7 @@ msgstr "" #: whatsnew/3.5.rst:2408 msgid "" -"The :meth:`ssl.SSLSocket.send()` method now raises either :exc:`ssl." +"The :meth:`!ssl.SSLSocket.send` method now raises either :exc:`ssl." "SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-blocking socket " "if the operation would block. Previously, it would return ``0``. " "(Contributed by Nikolaus Rath in :issue:`20951`.)" @@ -3158,13 +3561,12 @@ msgstr "" #: whatsnew/3.5.rst:2443 msgid "" -"When an import loader defines :meth:`importlib.machinery.Loader.exec_module` " -"it is now expected to also define :meth:`~importlib.machinery.Loader." -"create_module` (raises a :exc:`DeprecationWarning` now, will be an error in " -"Python 3.6). If the loader inherits from :class:`importlib.abc.Loader` then " -"there is nothing to do, else simply define :meth:`~importlib.machinery." -"Loader.create_module` to return ``None``. (Contributed by Brett Cannon in :" -"issue:`23014`.)" +"When an import loader defines :meth:`~importlib.abc.Loader.exec_module` it " +"is now expected to also define :meth:`~importlib.abc.Loader.create_module` " +"(raises a :exc:`DeprecationWarning` now, will be an error in Python 3.6). If " +"the loader inherits from :class:`importlib.abc.Loader` then there is nothing " +"to do, else simply define :meth:`~importlib.abc.Loader.create_module` to " +"return ``None``. (Contributed by Brett Cannon in :issue:`23014`.)" msgstr "" #: whatsnew/3.5.rst:2451 @@ -3227,7 +3629,7 @@ msgstr "" #: whatsnew/3.5.rst:2490 msgid "" "The :mod:`smtplib` module now uses :data:`sys.stderr` instead of the " -"previous module-level :data:`stderr` variable for debug output. If your " +"previous module-level :data:`!stderr` variable for debug output. If your " "(test) program depends on patching the module-level variable to capture the " "debug output, you will need to update it to capture sys.stderr instead." msgstr "" @@ -3264,14 +3666,14 @@ msgstr "" #: whatsnew/3.5.rst:2516 msgid "" -"The undocumented :c:member:`!format` member of the (non-public) :c:type:" -"`PyMemoryViewObject` structure has been removed. All extensions relying on " +"The undocumented :c:member:`!format` member of the (non-public) :c:type:`!" +"PyMemoryViewObject` structure has been removed. All extensions relying on " "the relevant parts in ``memoryobject.h`` must be rebuilt." msgstr "" #: whatsnew/3.5.rst:2521 msgid "" -"The :c:type:`PyMemAllocator` structure was renamed to :c:type:" +"The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" "`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" @@ -3285,10 +3687,11 @@ msgstr "" #: whatsnew/3.5.rst:2529 msgid "" -"Because the lack of the :attr:`__module__` attribute breaks pickling and " -"introspection, a deprecation warning is now raised for builtin types without " -"the :attr:`__module__` attribute. This would be an AttributeError in the " -"future. (Contributed by Serhiy Storchaka in :issue:`20204`.)" +"Because the lack of the :attr:`~type.__module__` attribute breaks pickling " +"and introspection, a deprecation warning is now raised for builtin types " +"without the :attr:`~type.__module__` attribute. This will be an :exc:" +"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" +"`20204`.)" msgstr "" #: whatsnew/3.5.rst:2535 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 01fd857c..d7b8455e 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,7 +32,7 @@ msgstr "" #: whatsnew/3.6.rst:47 msgid "" "This article explains the new features in Python 3.6, compared to 3.5. " -"Python 3.6 was released on December 23, 2016.  See the `changelog `_ for a full list of changes." msgstr "" @@ -257,7 +258,19 @@ msgid "" "protocol::" msgstr "" -#: whatsnew/3.6.rst:204 +#: whatsnew/3.6.rst:192 +msgid "" +">>> name = \"Fred\"\n" +">>> f\"He said his name is {name}.\"\n" +"'He said his name is Fred.'\n" +">>> width = 10\n" +">>> precision = 4\n" +">>> value = decimal.Decimal(\"12.34567\")\n" +">>> f\"result: {value:{width}.{precision}}\" # nested fields\n" +"'result: 12.35'" +msgstr "" + +#: whatsnew/3.6.rst:203 msgid ":pep:`498` -- Literal String Interpolation." msgstr "" @@ -280,6 +293,16 @@ msgid "" "the types of variables including class variables and instance variables::" msgstr "" +#: whatsnew/3.6.rst:218 +msgid "" +"primes: List[int] = []\n" +"\n" +"captain: str # Note: no initial value!\n" +"\n" +"class Starship:\n" +" stats: Dict[str, int] = {}" +msgstr "" + #: whatsnew/3.6.rst:225 msgid "" "Just as for function annotations, the Python interpreter does not attach any " @@ -295,7 +318,7 @@ msgid "" "and the ``__annotations__`` attribute." msgstr "" -#: whatsnew/3.6.rst:238 +#: whatsnew/3.6.rst:236 msgid ":pep:`526` -- Syntax for variable annotations." msgstr "" @@ -321,6 +344,14 @@ msgid "" "improved readability. For example::" msgstr "" +#: whatsnew/3.6.rst:253 +msgid "" +">>> 1_000_000_000_000_000\n" +"1000000000000000\n" +">>> 0x_FF_FF_FF_FF\n" +"4294967295" +msgstr "" + #: whatsnew/3.6.rst:258 msgid "" "Single underscores are allowed between digits and after any base specifier. " @@ -331,11 +362,19 @@ msgstr "" msgid "" "The :ref:`string formatting ` language also now has support for " "the ``'_'`` option to signal the use of an underscore for a thousands " -"separator for floating point presentation types and for integer presentation " +"separator for floating-point presentation types and for integer presentation " "type ``'d'``. For integer presentation types ``'b'``, ``'o'``, ``'x'``, and " "``'X'``, underscores will be inserted every 4 digits::" msgstr "" +#: whatsnew/3.6.rst:269 +msgid "" +">>> '{:_}'.format(1000000)\n" +"'1_000_000'\n" +">>> '{:_x}'.format(0xFFFFFFFF)\n" +"'ffff_ffff'" +msgstr "" + #: whatsnew/3.6.rst:276 msgid ":pep:`515` -- Underscores in Numeric Literals" msgstr "" @@ -357,6 +396,15 @@ msgid "" "making it possible to define *asynchronous generators*::" msgstr "" +#: whatsnew/3.6.rst:291 +msgid "" +"async def ticker(delay, to):\n" +" \"\"\"Yield numbers from 0 to *to* every *delay* seconds.\"\"\"\n" +" for i in range(to):\n" +" yield i\n" +" await asyncio.sleep(delay)" +msgstr "" + #: whatsnew/3.6.rst:297 msgid "The new syntax allows for faster and more concise code." msgstr "" @@ -379,12 +427,20 @@ msgid "" "comprehensions and generator expressions::" msgstr "" +#: whatsnew/3.6.rst:313 +msgid "result = [i async for i in aiter() if i % 2]" +msgstr "" + #: whatsnew/3.6.rst:315 msgid "" "Additionally, ``await`` expressions are supported in all kinds of " "comprehensions::" msgstr "" +#: whatsnew/3.6.rst:318 +msgid "result = [await fun() for fun in funcs if await condition()]" +msgstr "" + #: whatsnew/3.6.rst:322 msgid ":pep:`530` -- Asynchronous Comprehensions" msgstr "" @@ -400,6 +456,22 @@ msgid "" "whenever a new subclass is created::" msgstr "" +#: whatsnew/3.6.rst:335 +msgid "" +"class PluginBase:\n" +" subclasses = []\n" +"\n" +" def __init_subclass__(cls, **kwargs):\n" +" super().__init_subclass__(**kwargs)\n" +" cls.subclasses.append(cls)\n" +"\n" +"class Plugin1(PluginBase):\n" +" pass\n" +"\n" +"class Plugin2(PluginBase):\n" +" pass" +msgstr "" + #: whatsnew/3.6.rst:348 msgid "" "In order to allow zero-argument :func:`super` calls to work correctly from :" @@ -408,7 +480,7 @@ msgid "" "``type.__new__`` (as described in :ref:`class-object-creation`)." msgstr "" -#: whatsnew/3.6.rst:394 +#: whatsnew/3.6.rst:393 msgid ":pep:`487` -- Simpler customization of class creation" msgstr "" @@ -435,6 +507,25 @@ msgid "" "in the owner class::" msgstr "" +#: whatsnew/3.6.rst:374 +msgid "" +"class IntField:\n" +" def __get__(self, instance, owner):\n" +" return instance.__dict__[self.name]\n" +"\n" +" def __set__(self, instance, value):\n" +" if not isinstance(value, int):\n" +" raise ValueError(f'expecting integer in {self.name}')\n" +" instance.__dict__[self.name] = value\n" +"\n" +" # this is the new initializer:\n" +" def __set_name__(self, owner, name):\n" +" self.name = name\n" +"\n" +"class Model:\n" +" int_field = IntField()" +msgstr "" + #: whatsnew/3.6.rst:396 msgid ":ref:`Feature documentation `" msgstr "" @@ -492,6 +583,22 @@ msgid "" "Path` to be used more easily and transparently with pre-existing code::" msgstr "" +#: whatsnew/3.6.rst:444 +msgid "" +">>> import pathlib\n" +">>> with open(pathlib.Path(\"README\")) as f:\n" +"... contents = f.read()\n" +"...\n" +">>> import os.path\n" +">>> os.path.splitext(pathlib.Path(\"some_file.txt\"))\n" +"('some_file', '.txt')\n" +">>> os.path.join(\"/a/b\", pathlib.Path(\"c\"))\n" +"'/a/b/c'\n" +">>> import os\n" +">>> os.fspath(pathlib.Path(\"some_file.txt\"))\n" +"'some_file.txt'" +msgstr "" + #: whatsnew/3.6.rst:457 msgid "" "(Implemented by Brett Cannon, Ethan Furman, Dusty Phillips, and Jelle " @@ -526,6 +633,20 @@ msgid "" "moments in time for which local times are the same::" msgstr "" +#: whatsnew/3.6.rst:480 +msgid "" +">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" +">>> for i in range(4):\n" +"... u = u0 + i*HOUR\n" +"... t = u.astimezone(Eastern)\n" +"... print(u.time(), 'UTC =', t.time(), t.tzname(), t.fold)\n" +"...\n" +"04:00:00 UTC = 00:00:00 EDT 0\n" +"05:00:00 UTC = 01:00:00 EDT 0\n" +"06:00:00 UTC = 01:00:00 EST 1\n" +"07:00:00 UTC = 02:00:00 EST 0" +msgstr "" + #: whatsnew/3.6.rst:491 msgid "" "The values of the :attr:`fold ` attribute have the " @@ -533,7 +654,7 @@ msgid "" "(chronologically) moment in time in an ambiguous case." msgstr "" -#: whatsnew/3.6.rst:498 +#: whatsnew/3.6.rst:497 msgid ":pep:`495` -- Local Time Disambiguation" msgstr "" @@ -559,13 +680,13 @@ msgid "" "Prior to Python 3.6, data loss could result when using bytes paths on " "Windows. With this change, using bytes to represent paths is now supported " "on Windows, provided those bytes are encoded with the encoding returned by :" -"func:`sys.getfilesystemencoding()`, which now defaults to ``'utf-8'``." +"func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." msgstr "" #: whatsnew/3.6.rst:516 msgid "" "Applications that do not use str to represent paths should use :func:`os." -"fsencode()` and :func:`os.fsdecode()` to ensure their bytes are correctly " +"fsencode` and :func:`os.fsdecode` to ensure their bytes are correctly " "encoded. To revert to the previous behaviour, set :envvar:" "`PYTHONLEGACYWINDOWSFSENCODING` or call :func:`sys." "_enablelegacywindowsfsencoding`." @@ -611,7 +732,7 @@ msgstr "" msgid "" "Attributes in a class definition body have a natural ordering: the same " "order in which the names appear in the source. This order is now preserved " -"in the new class's :attr:`~object.__dict__` attribute." +"in the new class's :attr:`~type.__dict__` attribute." msgstr "" #: whatsnew/3.6.rst:554 @@ -790,6 +911,44 @@ msgid "" "tracemalloc=5`` (store 5 frames in traces)::" msgstr "" +#: whatsnew/3.6.rst:673 +msgid "" +"Debug memory block at address p=0x7fbcd41666f8: API 'o'\n" +" 4 bytes originally requested\n" +" The 7 pad bytes at p-7 are FORBIDDENBYTE, as expected.\n" +" The 8 pad bytes at tail=0x7fbcd41666fc are not all FORBIDDENBYTE " +"(0xfb):\n" +" at tail+0: 0x02 *** OUCH\n" +" at tail+1: 0xfb\n" +" at tail+2: 0xfb\n" +" at tail+3: 0xfb\n" +" at tail+4: 0xfb\n" +" at tail+5: 0xfb\n" +" at tail+6: 0xfb\n" +" at tail+7: 0xfb\n" +" The block was made by call #1233329 to debug malloc/realloc.\n" +" Data at p: 1a 2b 30 00\n" +"\n" +"Memory block allocated at (most recent call first):\n" +" File \"test/test_bytes.py\", line 323\n" +" File \"unittest/case.py\", line 600\n" +" File \"unittest/case.py\", line 648\n" +" File \"unittest/suite.py\", line 122\n" +" File \"unittest/suite.py\", line 84\n" +"\n" +"Fatal Python error: bad trailing pad byte\n" +"\n" +"Current thread 0x00007fbcdbd32700 (most recent call first):\n" +" File \"test/test_bytes.py\", line 323 in test_hex\n" +" File \"unittest/case.py\", line 600 in run\n" +" File \"unittest/case.py\", line 648 in __call__\n" +" File \"unittest/suite.py\", line 122 in run\n" +" File \"unittest/suite.py\", line 84 in __call__\n" +" File \"unittest/suite.py\", line 122 in run\n" +" File \"unittest/suite.py\", line 84 in __call__\n" +" ..." +msgstr "" + #: whatsnew/3.6.rst:707 msgid "(Contributed by Victor Stinner in :issue:`26516` and :issue:`26564`.)" msgstr "" @@ -858,8 +1017,9 @@ msgstr "" msgid "" "It is now possible to set a :ref:`special method ` to ``None`` " "to indicate that the corresponding operation is not available. For example, " -"if a class sets :meth:`__iter__` to ``None``, the class is not iterable. " -"(Contributed by Andrew Barnert and Ivan Levkivskyi in :issue:`25958`.)" +"if a class sets :meth:`~object.__iter__` to ``None``, the class is not " +"iterable. (Contributed by Andrew Barnert and Ivan Levkivskyi in :issue:" +"`25958`.)" msgstr "" #: whatsnew/3.6.rst:752 @@ -904,7 +1064,7 @@ msgstr "" msgid "" "Note that the pseudo-random generators in the :mod:`random` module should " "*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ and :" -"func:`os.urandom()` on Python 3.5 and earlier." +"func:`os.urandom` on Python 3.5 and earlier." msgstr "" #: whatsnew/3.6.rst:787 @@ -1045,8 +1205,8 @@ msgstr "" #: whatsnew/3.6.rst:874 msgid "" -":meth:`Future.set_exception ` will now " -"raise :exc:`TypeError` when passed an instance of the :exc:`StopIteration` " +":meth:`Future.set_exception ` will now raise :" +"exc:`TypeError` when passed an instance of the :exc:`StopIteration` " "exception. (Contributed by Chris Angelico in :issue:`26221`.)" msgstr "" @@ -1122,7 +1282,7 @@ msgstr "" #: whatsnew/3.6.rst:927 msgid "" "The new :class:`~collections.abc.Reversible` abstract base class represents " -"iterable classes that also provide the :meth:`__reversed__` method. " +"iterable classes that also provide the :meth:`~object.__reversed__` method. " "(Contributed by Ivan Levkivskyi in :issue:`25987`.)" msgstr "" @@ -1136,12 +1296,12 @@ msgstr "" #: whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the ``__module__`` " -"attribute of the returned named tuple class. (Contributed by Raymond " -"Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for the :attr:`~type." +"__module__` attribute of the returned named tuple class. (Contributed by " +"Raymond Hettinger in :issue:`17941`.)" msgstr "" -#: whatsnew/3.6.rst:2295 +#: whatsnew/3.6.rst:2297 msgid "" "The *verbose* and *rename* arguments for :func:`~collections.namedtuple` are " "now keyword-only. (Contributed by Raymond Hettinger in :issue:`25628`.)" @@ -1186,8 +1346,8 @@ msgstr "" #: whatsnew/3.6.rst:973 msgid "" "The :class:`~datetime.datetime` and :class:`~datetime.time` classes have the " -"new :attr:`~time.fold` attribute used to disambiguate local time when " -"necessary. Many functions in the :mod:`datetime` have been updated to " +"new :attr:`~datetime.time.fold` attribute used to disambiguate local time " +"when necessary. Many functions in the :mod:`datetime` have been updated to " "support local time disambiguation. See :ref:`Local Time Disambiguation " "` section for more information. (Contributed by Alexander " "Belopolsky in :issue:`24773`.)" @@ -1228,6 +1388,12 @@ msgid "" "positive denominator::" msgstr "" +#: whatsnew/3.6.rst:1004 +msgid "" +">>> Decimal('-3.14').as_integer_ratio()\n" +"(-157, 50)" +msgstr "" + #: whatsnew/3.6.rst:1007 msgid "(Contributed by Stefan Krah amd Mark Dickinson in :issue:`25928`.)" msgstr "" @@ -1298,7 +1464,7 @@ msgstr "" #: whatsnew/3.6.rst:1054 msgid "" "Two new enumeration base classes have been added to the :mod:`enum` module: :" -"class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to define " +"class:`~enum.Flag` and :class:`~enum.IntFlag`. Both are used to define " "constants that can be combined using the bitwise operators. (Contributed by " "Ethan Furman in :issue:`23591`.)" msgstr "" @@ -1306,7 +1472,7 @@ msgstr "" #: whatsnew/3.6.rst:1059 msgid "" "Many standard library modules have been updated to use the :class:`~enum." -"IntFlags` class for their constants." +"IntFlag` class for their constants." msgstr "" #: whatsnew/3.6.rst:1062 @@ -1315,6 +1481,18 @@ msgid "" "members automatically::" msgstr "" +#: whatsnew/3.6.rst:1065 +msgid "" +">>> from enum import Enum, auto\n" +">>> class Color(Enum):\n" +"... red = auto()\n" +"... blue = auto()\n" +"... green = auto()\n" +"...\n" +">>> list(Color)\n" +"[, , ]" +msgstr "" + #: whatsnew/3.6.rst:1076 msgid "faulthandler" msgstr "" @@ -1544,8 +1722,8 @@ msgstr "" #: whatsnew/3.6.rst:1226 msgid "" -"To reduce code churn when upgrading from Python 2.7 and the legacy :func:" -"`inspect.getargspec` API, the previously documented deprecation of :func:" +"To reduce code churn when upgrading from Python 2.7 and the legacy :func:`!" +"inspect.getargspec` API, the previously documented deprecation of :func:" "`inspect.getfullargspec` has been reversed. While this function is " "convenient for single/source Python 2/3 code bases, the richer :func:" "`inspect.signature` interface remains the recommended approach for new code. " @@ -1616,7 +1794,7 @@ msgstr "" msgid "" "A new :meth:`~os.scandir.close` method allows explicitly closing a :func:" "`~os.scandir` iterator. The :func:`~os.scandir` iterator now supports the :" -"term:`context manager` protocol. If a :func:`scandir` iterator is neither " +"term:`context manager` protocol. If a :func:`!scandir` iterator is neither " "exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " "its destructor. (Contributed by Serhiy Storchaka in :issue:`25994`.)" msgstr "" @@ -1670,7 +1848,7 @@ msgstr "" #: whatsnew/3.6.rst:1319 msgid "" -":func:`pickletools.dis()` now outputs the implicit memo index for the " +":func:`pickletools.dis` now outputs the implicit memo index for the " "``MEMOIZE`` opcode. (Contributed by Serhiy Storchaka in :issue:`25382`.)" msgstr "" @@ -1837,9 +2015,9 @@ msgstr "" #: whatsnew/3.6.rst:1437 msgid "" -"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute of :class:" -"`~socketserver.StreamRequestHandler` classes now implements the :class:`io." -"BufferedIOBase` writable interface. In particular, calling :meth:`~io." +"The :attr:`wfile ` attribute of :" +"class:`~socketserver.StreamRequestHandler` classes now implements the :class:" +"`io.BufferedIOBase` writable interface. In particular, calling :meth:`~io." "BufferedIOBase.write` is now guaranteed to send the data in full. " "(Contributed by Martin Panter in :issue:`26721`.)" msgstr "" @@ -1884,7 +2062,7 @@ msgstr "" #: whatsnew/3.6.rst:1467 msgid "" "All constants and flags have been converted to :class:`~enum.IntEnum` and :" -"class:`~enum.IntFlags`. (Contributed by Christian Heimes in :issue:`28025`.)" +"class:`~enum.IntFlag`. (Contributed by Christian Heimes in :issue:`28025`.)" msgstr "" #: whatsnew/3.6.rst:1471 @@ -1968,7 +2146,7 @@ msgstr "" #: whatsnew/3.6.rst:1527 msgid "" -":class:`~telnetlib.Telnet` is now a context manager (contributed by Stéphane " +":class:`!telnetlib.Telnet` is now a context manager (contributed by Stéphane " "Wirtel in :issue:`25485`)." msgstr "" @@ -1978,8 +2156,8 @@ msgstr "" #: whatsnew/3.6.rst:1534 msgid "" -"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` and :attr:" -"`tm_zone` are now available on all platforms." +"The :class:`~time.struct_time` attributes :attr:`!tm_gmtoff` and :attr:`!" +"tm_zone` are now available on all platforms." msgstr "" #: whatsnew/3.6.rst:1539 @@ -2006,13 +2184,12 @@ msgstr "" #: whatsnew/3.6.rst:1554 msgid "" -"Added methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable." -"trace_remove` and :meth:`~tkinter.Variable.trace_info` in the :class:" -"`tkinter.Variable` class. They replace old methods :meth:`~tkinter.Variable." -"trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable." -"trace_vdelete` and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete " -"Tcl commands and might not work in future versions of Tcl. (Contributed by " -"Serhiy Storchaka in :issue:`22115`)." +"Added methods :meth:`!Variable.trace_add`, :meth:`!Variable.trace_remove` " +"and :meth:`!trace_info` in the :class:`!tkinter.Variable` class. They " +"replace old methods :meth:`!trace_variable`, :meth:`!trace`, :meth:`!" +"trace_vdelete` and :meth:`!trace_vinfo` that use obsolete Tcl commands and " +"might not work in future versions of Tcl. (Contributed by Serhiy Storchaka " +"in :issue:`22115`)." msgstr "" #: whatsnew/3.6.rst:1567 @@ -2026,6 +2203,20 @@ msgid "" "the following example::" msgstr "" +#: whatsnew/3.6.rst:1573 +msgid "" +">>> def f(): f()\n" +"...\n" +">>> f()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 1, in f\n" +" File \"\", line 1, in f\n" +" File \"\", line 1, in f\n" +" [Previous line repeated 995 more times]\n" +"RecursionError: maximum recursion depth exceeded" +msgstr "" + #: whatsnew/3.6.rst:1584 msgid "(Contributed by Emanuel Barry in :issue:`26823`.)" msgstr "" @@ -2106,6 +2297,14 @@ msgid "" "lightweight distinct types for annotations::" msgstr "" +#: whatsnew/3.6.rst:1637 +msgid "" +"from typing import NewType\n" +"\n" +"UserId = NewType('UserId', int)\n" +"some_id = UserId(524313)" +msgstr "" + #: whatsnew/3.6.rst:1642 msgid "" "The static type checker will treat the new type as if it were a subclass of " @@ -2154,8 +2353,9 @@ msgstr "" msgid "" "If a HTTP request has a file or iterable body (other than a bytes object) " "but no ``Content-Length`` header, rather than throwing an error, :class:" -"`~urllib.request.AbstractHTTPHandler` now falls back to use chunked transfer " -"encoding. (Contributed by Demian Brecht and Rolf Krahl in :issue:`12319`.)" +"`AbstractHTTPHandler ` now falls back to use " +"chunked transfer encoding. (Contributed by Demian Brecht and Rolf Krahl in :" +"issue:`12319`.)" msgstr "" #: whatsnew/3.6.rst:1683 @@ -2188,8 +2388,8 @@ msgstr "" msgid "" "A new optional *source* parameter has been added to the :func:`warnings." "warn_explicit` function: the destroyed object which emitted a :exc:" -"`ResourceWarning`. A *source* attribute has also been added to :class:" -"`warnings.WarningMessage` (contributed by Victor Stinner in :issue:`26568` " +"`ResourceWarning`. A *source* attribute has also been added to :class:`!" +"warnings.WarningMessage` (contributed by Victor Stinner in :issue:`26568` " "and :issue:`26567`)." msgstr "" @@ -2204,10 +2404,33 @@ msgstr "" msgid "Example with the script ``example.py``::" msgstr "" +#: whatsnew/3.6.rst:1712 +msgid "" +"import warnings\n" +"\n" +"def func():\n" +" return open(__file__)\n" +"\n" +"f = func()\n" +"f = None" +msgstr "" + #: whatsnew/3.6.rst:1720 msgid "Output of the command ``python3.6 -Wd -X tracemalloc=5 example.py``::" msgstr "" +#: whatsnew/3.6.rst:1722 +msgid "" +"example.py:7: ResourceWarning: unclosed file <_io.TextIOWrapper " +"name='example.py' mode='r' encoding='UTF-8'>\n" +" f = None\n" +"Object allocated at (most recent call first):\n" +" File \"example.py\", lineno 4\n" +" return open(__file__)\n" +" File \"example.py\", lineno 6\n" +" f = func()" +msgstr "" + #: whatsnew/3.6.rst:1730 msgid "" "The \"Object allocated at\" traceback is new and is only displayed if :mod:" @@ -2509,6 +2732,13 @@ msgid "" "Python prints :data:`sys.version` for detailed information." msgstr "" +#: whatsnew/3.6.rst:1919 +msgid "" +"$ ./python -VV\n" +"Python 3.6.0b4+ (3.6:223967b49e49+, Nov 21 2016, 20:55:04)\n" +"[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]" +msgstr "" + #: whatsnew/3.6.rst:1927 msgid "Deprecated" msgstr "" @@ -2538,11 +2768,11 @@ msgstr "" #: whatsnew/3.6.rst:1945 msgid "" -"The :meth:`__aiter__` method is now expected to return an asynchronous " -"iterator directly instead of returning an awaitable as previously. Doing the " -"former will trigger a :exc:`DeprecationWarning`. Backward compatibility " -"will be removed in Python 3.7. (Contributed by Yury Selivanov in :issue:" -"`27243`.)" +"The :meth:`~object.__aiter__` method is now expected to return an " +"asynchronous iterator directly instead of returning an awaitable as " +"previously. Doing the former will trigger a :exc:`DeprecationWarning`. " +"Backward compatibility will be removed in Python 3.7. (Contributed by Yury " +"Selivanov in :issue:`27243`.)" msgstr "" #: whatsnew/3.6.rst:1951 @@ -2673,7 +2903,7 @@ msgstr "" #: whatsnew/3.6.rst:2056 msgid "" -"The :mod:`tkinter.tix` module is now deprecated. :mod:`tkinter` users " +"The :mod:`!tkinter.tix` module is now deprecated. :mod:`tkinter` users " "should use :mod:`tkinter.ttk` instead." msgstr "" @@ -2865,10 +3095,9 @@ msgstr "" #: whatsnew/3.6.rst:2192 msgid "" -"Reading the :attr:`~urllib.parse.SplitResult.port` attribute of :func:" -"`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results now " -"raises :exc:`ValueError` for out-of-range values, rather than returning :" -"const:`None`. See :issue:`20059`." +"Reading the :attr:`!port` attribute of :func:`urllib.parse.urlsplit` and :" +"func:`~urllib.parse.urlparse` results now raises :exc:`ValueError` for out-" +"of-range values, rather than returning :const:`None`. See :issue:`20059`." msgstr "" #: whatsnew/3.6.rst:2197 @@ -2879,14 +3108,14 @@ msgstr "" #: whatsnew/3.6.rst:2200 msgid "" -"The following modules have had missing APIs added to their :attr:`__all__` " -"attributes to match the documented APIs: :mod:`calendar`, :mod:`cgi`, :mod:" -"`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:" -"`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:" -"`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:`subprocess`, :mod:" -"`tarfile`, :mod:`threading` and :mod:`wave`. This means they will export " -"new symbols when ``import *`` is used. (Contributed by Joel Taddei and Jacek " -"Kołodziej in :issue:`23883`.)" +"The following modules have had missing APIs added to their :attr:`~module." +"__all__` attributes to match the documented APIs: :mod:`calendar`, :mod:`!" +"cgi`, :mod:`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:" +"`fileinput`, :mod:`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:" +"`mimetypes`, :mod:`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:" +"`subprocess`, :mod:`tarfile`, :mod:`threading` and :mod:`wave`. This means " +"they will export new symbols when ``import *`` is used. (Contributed by Joel " +"Taddei and Jacek Kołodziej in :issue:`23883`.)" msgstr "" #: whatsnew/3.6.rst:2211 @@ -2916,7 +3145,7 @@ msgstr "" #: whatsnew/3.6.rst:2228 msgid "" -":func:`spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" +":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" "`KeyError` if the user doesn't have privileges." msgstr "" @@ -2957,14 +3186,15 @@ msgid "" "As part of :pep:`487`, the handling of keyword arguments passed to :class:" "`type` (other than the metaclass hint, ``metaclass``) is now consistently " "delegated to :meth:`object.__init_subclass__`. This means that :meth:`type." -"__new__` and :meth:`type.__init__` both now accept arbitrary keyword " -"arguments, but :meth:`object.__init_subclass__` (which is called from :meth:" -"`type.__new__`) will reject them by default. Custom metaclasses accepting " -"additional keyword arguments will need to adjust their calls to :meth:`type." -"__new__` (whether direct or via :class:`super`) accordingly." +"__new__ ` and :meth:`type.__init__ ` both " +"now accept arbitrary keyword arguments, but :meth:`object.__init_subclass__` " +"(which is called from :meth:`type.__new__ `) will reject " +"them by default. Custom metaclasses accepting additional keyword arguments " +"will need to adjust their calls to :meth:`type.__new__ ` " +"(whether direct or via :class:`super`) accordingly." msgstr "" -#: whatsnew/3.6.rst:2262 +#: whatsnew/3.6.rst:2264 msgid "" "In ``distutils.command.sdist.sdist``, the ``default_format`` attribute has " "been removed and is no longer honored. Instead, the gzipped tarfile format " @@ -2974,13 +3204,19 @@ msgid "" "containing the following:" msgstr "" -#: whatsnew/3.6.rst:2275 +#: whatsnew/3.6.rst:2272 +msgid "" +"[sdist]\n" +"formats=zip" +msgstr "" + +#: whatsnew/3.6.rst:2277 msgid "" "This behavior has also been backported to earlier Python versions by " "Setuptools 26.0.0." msgstr "" -#: whatsnew/3.6.rst:2278 +#: whatsnew/3.6.rst:2280 msgid "" "In the :mod:`urllib.request` module and the :meth:`http.client." "HTTPConnection.request` method, if no Content-Length header field has been " @@ -2991,47 +3227,46 @@ msgid "" "`12319`.)" msgstr "" -#: whatsnew/3.6.rst:2287 +#: whatsnew/3.6.rst:2289 msgid "" "The :class:`~csv.DictReader` now returns rows of type :class:`~collections." "OrderedDict`. (Contributed by Steve Holden in :issue:`27842`.)" msgstr "" -#: whatsnew/3.6.rst:2291 +#: whatsnew/3.6.rst:2293 msgid "" -"The :const:`crypt.METHOD_CRYPT` will no longer be added to ``crypt.methods`` " -"if unsupported by the platform. (Contributed by Victor Stinner in :issue:" -"`25287`.)" +"The :const:`!crypt.METHOD_CRYPT` will no longer be added to ``crypt." +"methods`` if unsupported by the platform. (Contributed by Victor Stinner in :" +"issue:`25287`.)" msgstr "" -#: whatsnew/3.6.rst:2299 +#: whatsnew/3.6.rst:2301 msgid "" "On Linux, :func:`ctypes.util.find_library` now looks in ``LD_LIBRARY_PATH`` " "for shared libraries. (Contributed by Vinay Sajip in :issue:`9998`.)" msgstr "" -#: whatsnew/3.6.rst:2303 +#: whatsnew/3.6.rst:2305 msgid "" "The :class:`imaplib.IMAP4` class now handles flags containing the ``']'`` " "character in messages sent from the server to improve real-world " "compatibility. (Contributed by Lita Cho in :issue:`21815`.)" msgstr "" -#: whatsnew/3.6.rst:2308 +#: whatsnew/3.6.rst:2310 msgid "" -"The :func:`mmap.write() ` function now returns the number of " -"bytes written like other write methods. (Contributed by Jakub Stasiak in :" -"issue:`26335`.)" +"The :func:`mmap.mmap.write` function now returns the number of bytes written " +"like other write methods. (Contributed by Jakub Stasiak in :issue:`26335`.)" msgstr "" -#: whatsnew/3.6.rst:2312 +#: whatsnew/3.6.rst:2314 msgid "" "The :func:`pkgutil.iter_modules` and :func:`pkgutil.walk_packages` functions " "now return :class:`~pkgutil.ModuleInfo` named tuples. (Contributed by " "Ramchandra Apte in :issue:`17211`.)" msgstr "" -#: whatsnew/3.6.rst:2316 +#: whatsnew/3.6.rst:2318 msgid "" ":func:`re.sub` now raises an error for invalid numerical group references in " "replacement templates even if the pattern is not found in the string. The " @@ -3040,7 +3275,7 @@ msgid "" "in :issue:`25953`.)" msgstr "" -#: whatsnew/3.6.rst:2322 +#: whatsnew/3.6.rst:2324 msgid "" ":class:`zipfile.ZipFile` will now raise :exc:`NotImplementedError` for " "unrecognized compression values. Previously a plain :exc:`RuntimeError` was " @@ -3050,7 +3285,7 @@ msgid "" "`RuntimeError` was raised in those scenarios." msgstr "" -#: whatsnew/3.6.rst:2329 +#: whatsnew/3.6.rst:2331 msgid "" "when custom metaclasses are combined with zero-argument :func:`super` or " "direct references from methods to the implicit ``__class__`` closure " @@ -3060,24 +3295,24 @@ msgid "" "Python 3.8." msgstr "" -#: whatsnew/3.6.rst:2336 +#: whatsnew/3.6.rst:2338 msgid "" "With the introduction of :exc:`ModuleNotFoundError`, import system consumers " "may start expecting import system replacements to raise that more specific " "exception when appropriate, rather than the less-specific :exc:" "`ImportError`. To provide future compatibility with such consumers, " -"implementors of alternative import systems that completely replace :func:" +"implementers of alternative import systems that completely replace :func:" "`__import__` will need to update their implementations to raise the new " -"subclass when a module can't be found at all. Implementors of compliant " +"subclass when a module can't be found at all. Implementers of compliant " "plugins to the default import system shouldn't need to make any changes, as " "the default import system will raise the new subclass when appropriate." msgstr "" -#: whatsnew/3.6.rst:2348 +#: whatsnew/3.6.rst:2350 msgid "Changes in the C API" msgstr "" -#: whatsnew/3.6.rst:2350 +#: whatsnew/3.6.rst:2352 msgid "" "The :c:func:`PyMem_Malloc` allocator family now uses the :ref:`pymalloc " "allocator ` rather than the system :c:func:`malloc`. Applications " @@ -3086,71 +3321,71 @@ msgid "" "usage of memory allocators in your application. See :issue:`26249`." msgstr "" -#: whatsnew/3.6.rst:2356 +#: whatsnew/3.6.rst:2358 msgid "" ":c:func:`Py_Exit` (and the main interpreter) now override the exit status " "with 120 if flushing buffered data failed. See :issue:`5319`." msgstr "" -#: whatsnew/3.6.rst:2361 +#: whatsnew/3.6.rst:2363 msgid "CPython bytecode changes" msgstr "" -#: whatsnew/3.6.rst:2363 +#: whatsnew/3.6.rst:2365 msgid "" "There have been several major changes to the :term:`bytecode` in Python 3.6." msgstr "" -#: whatsnew/3.6.rst:2365 +#: whatsnew/3.6.rst:2367 msgid "" "The Python interpreter now uses a 16-bit wordcode instead of bytecode. " "(Contributed by Demur Rumed with input and reviews from Serhiy Storchaka and " "Victor Stinner in :issue:`26647` and :issue:`28050`.)" msgstr "" -#: whatsnew/3.6.rst:2369 +#: whatsnew/3.6.rst:2371 msgid "" -"The new :opcode:`FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part of " -"the :ref:`formatted string literal ` implementation. " +"The new :opcode:`!FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part " +"of the :ref:`formatted string literal ` implementation. " "(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka in :issue:" "`27078`.)" msgstr "" -#: whatsnew/3.6.rst:2374 +#: whatsnew/3.6.rst:2376 msgid "" -"The new :opcode:`BUILD_CONST_KEY_MAP` opcode to optimize the creation of " +"The new :opcode:`!BUILD_CONST_KEY_MAP` opcode to optimize the creation of " "dictionaries with constant keys. (Contributed by Serhiy Storchaka in :issue:" "`27140`.)" msgstr "" -#: whatsnew/3.6.rst:2378 +#: whatsnew/3.6.rst:2380 msgid "" "The function call opcodes have been heavily reworked for better performance " -"and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:" -"`CALL_FUNCTION`, :opcode:`CALL_FUNCTION_KW` and :opcode:" -"`BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" -"`CALL_FUNCTION_EX` and :opcode:`BUILD_TUPLE_UNPACK_WITH_CALL` have been " +"and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:`!" +"CALL_FUNCTION`, :opcode:`!CALL_FUNCTION_KW` and :opcode:`!" +"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" +"`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` have been " "added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " "``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed in :" "issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" msgstr "" -#: whatsnew/3.6.rst:2389 +#: whatsnew/3.6.rst:2391 msgid "" -"The new :opcode:`SETUP_ANNOTATIONS` and :opcode:`STORE_ANNOTATION` opcodes " +"The new :opcode:`SETUP_ANNOTATIONS` and :opcode:`!STORE_ANNOTATION` opcodes " "have been added to support the new :term:`variable annotation` syntax. " "(Contributed by Ivan Levkivskyi in :issue:`27985`.)" msgstr "" -#: whatsnew/3.6.rst:2395 +#: whatsnew/3.6.rst:2397 msgid "Notable changes in Python 3.6.2" msgstr "" -#: whatsnew/3.6.rst:2398 +#: whatsnew/3.6.rst:2400 msgid "New ``make regen-all`` build target" msgstr "" -#: whatsnew/3.6.rst:2400 +#: whatsnew/3.6.rst:2402 msgid "" "To simplify cross-compilation, and to ensure that CPython can reliably be " "compiled without requiring an existing version of Python to already be " @@ -3158,43 +3393,43 @@ msgid "" "recompile generated files based on file modification times." msgstr "" -#: whatsnew/3.6.rst:2405 +#: whatsnew/3.6.rst:2407 msgid "" "Instead, a new ``make regen-all`` command has been added to force " "regeneration of these files when desired (e.g. after an initial version of " "Python has already been built based on the pregenerated versions)." msgstr "" -#: whatsnew/3.6.rst:2409 +#: whatsnew/3.6.rst:2411 msgid "" "More selective regeneration targets are also defined - see :source:`Makefile." "pre.in` for details." msgstr "" -#: whatsnew/3.6.rst:2425 +#: whatsnew/3.6.rst:2427 msgid "(Contributed by Victor Stinner in :issue:`23404`.)" msgstr "" -#: whatsnew/3.6.rst:2418 +#: whatsnew/3.6.rst:2420 msgid "Removal of ``make touch`` build target" msgstr "" -#: whatsnew/3.6.rst:2420 +#: whatsnew/3.6.rst:2422 msgid "" "The ``make touch`` build target previously used to request implicit " "regeneration of generated files by updating their modification times has " "been removed." msgstr "" -#: whatsnew/3.6.rst:2423 +#: whatsnew/3.6.rst:2425 msgid "It has been replaced by the new ``make regen-all`` target." msgstr "" -#: whatsnew/3.6.rst:2431 +#: whatsnew/3.6.rst:2433 msgid "Notable changes in Python 3.6.4" msgstr "" -#: whatsnew/3.6.rst:2433 +#: whatsnew/3.6.rst:2435 msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " @@ -3202,28 +3437,28 @@ msgid "" "issue:`22898` and :issue:`30697`.)" msgstr "" -#: whatsnew/3.6.rst:2440 +#: whatsnew/3.6.rst:2442 msgid "Notable changes in Python 3.6.5" msgstr "" -#: whatsnew/3.6.rst:2442 +#: whatsnew/3.6.rst:2444 msgid "" "The :func:`locale.localeconv` function now sets temporarily the ``LC_CTYPE`` " "locale to the ``LC_NUMERIC`` locale in some cases. (Contributed by Victor " "Stinner in :issue:`31900`.)" msgstr "" -#: whatsnew/3.6.rst:2448 +#: whatsnew/3.6.rst:2450 msgid "Notable changes in Python 3.6.7" msgstr "" -#: whatsnew/3.6.rst:2450 +#: whatsnew/3.6.rst:2452 msgid "" ":mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process external " "entities by default. See also :gh:`61441`." msgstr "" -#: whatsnew/3.6.rst:2453 +#: whatsnew/3.6.rst:2455 msgid "" "In 3.6.7 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token " "when provided with input that does not have a trailing new line. This " @@ -3231,11 +3466,11 @@ msgid "" "Ammar Askar in :issue:`33899`.)" msgstr "" -#: whatsnew/3.6.rst:2459 +#: whatsnew/3.6.rst:2461 msgid "Notable changes in Python 3.6.10" msgstr "" -#: whatsnew/3.6.rst:2461 +#: whatsnew/3.6.rst:2463 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " @@ -3245,27 +3480,27 @@ msgid "" "`37228`.)" msgstr "" -#: whatsnew/3.6.rst:2469 +#: whatsnew/3.6.rst:2471 msgid "Notable changes in Python 3.6.13" msgstr "" -#: whatsnew/3.6.rst:2471 +#: whatsnew/3.6.rst:2473 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" -#: whatsnew/3.6.rst:2482 +#: whatsnew/3.6.rst:2484 msgid "Notable changes in Python 3.6.14" msgstr "" -#: whatsnew/3.6.rst:2484 +#: whatsnew/3.6.rst:2486 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -3274,7 +3509,7 @@ msgid "" "instance to ``True``. (See :gh:`87451`)" msgstr "" -#: whatsnew/3.6.rst:2490 +#: whatsnew/3.6.rst:2492 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates RFC 3986, " diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 082cb5a7..7d821604 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -231,12 +232,30 @@ msgid "" "following syntax valid::" msgstr "" +#: whatsnew/3.7.rst:158 +msgid "" +"class C:\n" +" @classmethod\n" +" def from_string(cls, source: str) -> C:\n" +" ...\n" +"\n" +" def validate_b(self, obj: B) -> bool:\n" +" ...\n" +"\n" +"class B:\n" +" ..." +msgstr "" + #: whatsnew/3.7.rst:169 msgid "" "Since this change breaks compatibility, the new behavior needs to be enabled " "on a per-module basis in Python 3.7 using a :mod:`__future__` import::" msgstr "" +#: whatsnew/3.7.rst:172 +msgid "from __future__ import annotations" +msgstr "" + #: whatsnew/3.7.rst:174 msgid "It will become the default in Python 3.10." msgstr "" @@ -443,9 +462,9 @@ msgstr "" #: whatsnew/3.7.rst:323 msgid "" -"Python 3.7 allows defining :meth:`__getattr__` on modules and will call it " -"whenever a module attribute is otherwise not found. Defining :meth:" -"`__dir__` on modules is now also allowed." +"Python 3.7 allows defining :meth:`~module.__getattr__` on modules and will " +"call it whenever a module attribute is otherwise not found. Defining :meth:" +"`~module.__dir__` on modules is now also allowed." msgstr "" #: whatsnew/3.7.rst:327 @@ -469,33 +488,33 @@ msgstr "" #: whatsnew/3.7.rst:341 msgid "" "The resolution of clocks in modern systems can exceed the limited precision " -"of a floating point number returned by the :func:`time.time` function and " +"of a floating-point number returned by the :func:`time.time` function and " "its variants. To avoid loss of precision, :pep:`564` adds six new " "\"nanosecond\" variants of the existing timer functions to the :mod:`time` " "module:" msgstr "" -#: whatsnew/3.7.rst:1451 +#: whatsnew/3.7.rst:1455 msgid ":func:`time.clock_gettime_ns`" msgstr "" -#: whatsnew/3.7.rst:1452 +#: whatsnew/3.7.rst:1456 msgid ":func:`time.clock_settime_ns`" msgstr "" -#: whatsnew/3.7.rst:1453 +#: whatsnew/3.7.rst:1457 msgid ":func:`time.monotonic_ns`" msgstr "" -#: whatsnew/3.7.rst:1454 +#: whatsnew/3.7.rst:1458 msgid ":func:`time.perf_counter_ns`" msgstr "" -#: whatsnew/3.7.rst:1455 +#: whatsnew/3.7.rst:1459 msgid ":func:`time.process_time_ns`" msgstr "" -#: whatsnew/3.7.rst:1456 +#: whatsnew/3.7.rst:1460 msgid ":func:`time.time_ns`" msgstr "" @@ -505,9 +524,9 @@ msgstr "" #: whatsnew/3.7.rst:356 msgid "" -"`Measurements `_ show that on Linux and Windows the resolution of :func:`time." -"time_ns` is approximately 3 times better than that of :func:`time.time`." +":pep:`Measurements <0564#annex-clocks-resolution-in-python>` show that on " +"Linux and Windows the resolution of :func:`time.time_ns` is approximately 3 " +"times better than that of :func:`time.time`." msgstr "" #: whatsnew/3.7.rst:362 @@ -582,12 +601,12 @@ msgid "" "Initially :pep:`484` was designed in such way that it would not introduce " "*any* changes to the core CPython interpreter. Now type hints and the :mod:" "`typing` module are extensively used by the community, so this restriction " -"is removed. The PEP introduces two special methods :meth:`__class_getitem__` " -"and ``__mro_entries__``, these methods are now used by most classes and " -"special constructs in :mod:`typing`. As a result, the speed of various " -"operations with types increased up to 7 times, the generic types can be used " -"without metaclass conflicts, and several long standing bugs in :mod:`typing` " -"module are fixed." +"is removed. The PEP introduces two special methods :meth:`~object." +"__class_getitem__` and :meth:`~object.__mro_entries__`, these methods are " +"now used by most classes and special constructs in :mod:`typing`. As a " +"result, the speed of various operations with types increased up to 7 times, " +"the generic types can be used without metaclass conflicts, and several long " +"standing bugs in :mod:`typing` module are fixed." msgstr "" #: whatsnew/3.7.rst:421 @@ -668,7 +687,7 @@ msgstr "" msgid "Korean: https://docs.python.org/ko/" msgstr "" -#: whatsnew/3.7.rst:477 +#: whatsnew/3.7.rst:476 msgid ":pep:`545` -- Python Documentation Translations" msgstr "" @@ -817,6 +836,18 @@ msgstr "" msgid "Example::" msgstr "" +#: whatsnew/3.7.rst:582 +msgid "" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" y: float\n" +" z: float = 0.0\n" +"\n" +"p = Point(1.5, 2.5)\n" +"print(p) # produces \"Point(x=1.5, y=2.5, z=0.0)\"" +msgstr "" + #: whatsnew/3.7.rst:593 msgid ":pep:`557` -- Data Classes" msgstr "" @@ -835,7 +866,7 @@ msgid "" "new ABC for access to, opening, and reading *resources* inside packages. " "Resources are roughly similar to files inside packages, but they needn't be " "actual files on the physical file system. Module loaders can provide a :" -"meth:`get_resource_reader()` function which returns a :class:`importlib.abc." +"meth:`!get_resource_reader` function which returns a :class:`importlib.abc." "ResourceReader` instance to support this new API. Built-in file path " "loaders and zip file loaders both support this." msgstr "" @@ -865,7 +896,7 @@ msgid "" "positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" msgstr "" -#: whatsnew/3.7.rst:1964 +#: whatsnew/3.7.rst:1968 msgid "asyncio" msgstr "" @@ -923,9 +954,8 @@ msgid "" "The new :func:`asyncio.current_task` function returns the currently running :" "class:`~asyncio.Task` instance, and the new :func:`asyncio.all_tasks` " "function returns a set of all existing ``Task`` instances in a given loop. " -"The :meth:`Task.current_task() ` and :meth:`Task." -"all_tasks() ` methods have been deprecated. " -"(Contributed by Andrew Svetlov in :issue:`32250`.)" +"The :meth:`!Task.current_task` and :meth:`!Task.all_tasks` methods have been " +"deprecated. (Contributed by Andrew Svetlov in :issue:`32250`.)" msgstr "" #: whatsnew/3.7.rst:676 @@ -985,6 +1015,16 @@ msgid "" "managers::" msgstr "" +#: whatsnew/3.7.rst:716 +msgid "" +"srv = await loop.create_server(...)\n" +"\n" +"async with srv:\n" +" # some code\n" +"\n" +"# At this point, srv is closed and no longer accepts new connections." +msgstr "" + #: whatsnew/3.7.rst:723 msgid "(Contributed by Yury Selivanov in :issue:`32662`.)" msgstr "" @@ -1093,7 +1133,7 @@ msgid "" "(Contributed by Oz Tiram in :issue:`30095`.)" msgstr "" -#: whatsnew/3.7.rst:1978 +#: whatsnew/3.7.rst:1982 msgid "collections" msgstr "" @@ -1172,14 +1212,14 @@ msgstr "" #: whatsnew/3.7.rst:851 msgid "" -"The :mod:`crypt` module now supports the Blowfish hashing method. " +"The :mod:`!crypt` module now supports the Blowfish hashing method. " "(Contributed by Serhiy Storchaka in :issue:`31664`.)" msgstr "" #: whatsnew/3.7.rst:854 msgid "" -"The :func:`~crypt.mksalt` function now allows specifying the number of " -"rounds for hashing. (Contributed by Serhiy Storchaka in :issue:`31702`.)" +"The :func:`!mksalt` function now allows specifying the number of rounds for " +"hashing. (Contributed by Serhiy Storchaka in :issue:`31702`.)" msgstr "" #: whatsnew/3.7.rst:859 @@ -1200,7 +1240,7 @@ msgid "" "(Contributed by Alexander Belopolsky in :issue:`5288`.)" msgstr "" -#: whatsnew/3.7.rst:1988 +#: whatsnew/3.7.rst:1992 msgid "dbm" msgstr "" @@ -1245,7 +1285,7 @@ msgid "" "in :issue:`11913`.)" msgstr "" -#: whatsnew/3.7.rst:1998 +#: whatsnew/3.7.rst:2002 msgid "enum" msgstr "" @@ -1258,12 +1298,12 @@ msgstr "" #: whatsnew/3.7.rst:913 msgid "" -"In Python 3.8, attempting to check for non-Enum objects in :class:`Enum` " -"classes will raise a :exc:`TypeError` (e.g. ``1 in Color``); similarly, " -"attempting to check for non-Flag objects in a :class:`Flag` member will " -"raise :exc:`TypeError` (e.g. ``1 in Perm.RW``); currently, both operations " -"return :const:`False` instead and are deprecated. (Contributed by Ethan " -"Furman in :issue:`33217`.)" +"In Python 3.8, attempting to check for non-Enum objects in :class:`~enum." +"Enum` classes will raise a :exc:`TypeError` (e.g. ``1 in Color``); " +"similarly, attempting to check for non-Flag objects in a :class:`~enum.Flag` " +"member will raise :exc:`TypeError` (e.g. ``1 in Perm.RW``); currently, both " +"operations return :const:`False` instead and are deprecated. (Contributed by " +"Ethan Furman in :issue:`33217`.)" msgstr "" #: whatsnew/3.7.rst:922 @@ -1337,7 +1377,7 @@ msgstr "" #: whatsnew/3.7.rst:971 msgid "" "The new :class:`ThreadingHTTPServer ` class " -"uses threads to handle requests using :class:`~socketserver.ThreadingMixin`. " +"uses threads to handle requests using :class:`~socketserver.ThreadingMixIn`. " "It is used when ``http.server`` is run with ``-m``. (Contributed by Julien " "Palard in :issue:`31639`.)" msgstr "" @@ -1445,7 +1485,7 @@ msgid "" "`17535`.)" msgstr "" -#: whatsnew/3.7.rst:2017 +#: whatsnew/3.7.rst:2021 msgid "importlib" msgstr "" @@ -1465,17 +1505,17 @@ msgstr "" #: whatsnew/3.7.rst:1055 msgid "" -":func:`importlib.find_spec` now raises :exc:`ModuleNotFoundError` instead " -"of :exc:`AttributeError` if the specified parent module is not a package (i." -"e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch in :" -"issue:`30436`.)" +":func:`importlib.util.find_spec` now raises :exc:`ModuleNotFoundError` " +"instead of :exc:`AttributeError` if the specified parent module is not a " +"package (i.e. lacks a ``__path__`` attribute). (Contributed by Milan " +"Oberkirch in :issue:`30436`.)" msgstr "" #: whatsnew/3.7.rst:1060 msgid "" -"The new :func:`importlib.source_hash` can be used to compute the hash of the " -"passed source. A :ref:`hash-based .pyc file ` embeds the " -"value returned by this function." +"The new :func:`importlib.util.source_hash` can be used to compute the hash " +"of the passed source. A :ref:`hash-based .pyc file ` " +"embeds the value returned by this function." msgstr "" #: whatsnew/3.7.rst:1066 @@ -1513,7 +1553,7 @@ msgid "" "Roberts in :issue:`30537`.)" msgstr "" -#: whatsnew/3.7.rst:2035 +#: whatsnew/3.7.rst:2039 msgid "locale" msgstr "" @@ -1581,9 +1621,8 @@ msgstr "" #: whatsnew/3.7.rst:1136 msgid "" -"The new :meth:`Database.Close() ` method can be used " -"to close the :abbr:`MSI` database. (Contributed by Berker Peksag in :issue:" -"`20486`.)" +"The new :meth:`!Database.Close` method can be used to close the :abbr:`MSI` " +"database. (Contributed by Berker Peksag in :issue:`20486`.)" msgstr "" #: whatsnew/3.7.rst:1142 @@ -1601,8 +1640,8 @@ msgstr "" #: whatsnew/3.7.rst:1150 msgid "" "The new :meth:`Process.kill() ` method can be " -"used to terminate the process using the :data:`SIGKILL` signal on Unix. " -"(Contributed by Vitor Pereira in :issue:`30794`.)" +"used to terminate the process using the :data:`~signal.SIGKILL` signal on " +"Unix. (Contributed by Vitor Pereira in :issue:`30794`.)" msgstr "" #: whatsnew/3.7.rst:1154 @@ -1778,7 +1817,7 @@ msgid "" "in :issue:`30050`.)" msgstr "" -#: whatsnew/3.7.rst:2058 +#: whatsnew/3.7.rst:2062 msgid "socket" msgstr "" @@ -1799,69 +1838,71 @@ msgstr "" #: whatsnew/3.7.rst:1283 msgid "" -"The :mod:`socket` module now exposes the :const:`socket.TCP_CONGESTION` " -"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), and :const:" -"`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed by Omar " -"Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" +"The :mod:`socket` module now exposes the :ref:`socket.TCP_CONGESTION ` (Linux 2.6.13), :ref:`socket.TCP_USER_TIMEOUT ` (Linux 2.6.37), and :ref:`socket.TCP_NOTSENT_LOWAT ` (Linux 3.12) constants. (Contributed by Omar Sandoval in :issue:" +"`26273` and Nathaniel J. Smith in :issue:`29728`.)" msgstr "" -#: whatsnew/3.7.rst:1289 +#: whatsnew/3.7.rst:1290 msgid "" "Support for :const:`socket.AF_VSOCK` sockets has been added to allow " "communication between virtual machines and their hosts. (Contributed by " "Cathy Avery in :issue:`27584`.)" msgstr "" -#: whatsnew/3.7.rst:1293 +#: whatsnew/3.7.rst:1294 msgid "" "Sockets now auto-detect family, type and protocol from file descriptor by " "default. (Contributed by Christian Heimes in :issue:`28134`.)" msgstr "" -#: whatsnew/3.7.rst:1299 +#: whatsnew/3.7.rst:1300 msgid "socketserver" msgstr "" -#: whatsnew/3.7.rst:1301 +#: whatsnew/3.7.rst:1302 msgid "" -":meth:`socketserver.ThreadingMixIn.server_close` now waits until all non-" -"daemon threads complete. :meth:`socketserver.ForkingMixIn.server_close` now " -"waits until all child processes complete." +":meth:`socketserver.ThreadingMixIn.server_close ` now waits until all non-daemon threads complete. :meth:" +"`socketserver.ForkingMixIn.server_close ` now waits until all child processes complete." msgstr "" -#: whatsnew/3.7.rst:1305 +#: whatsnew/3.7.rst:1308 msgid "" -"Add a new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute " -"to :class:`socketserver.ForkingMixIn` and :class:`socketserver." -"ThreadingMixIn` classes. Set the class attribute to ``False`` to get the " -"pre-3.7 behaviour." +"Add a new :attr:`socketserver.ForkingMixIn.block_on_close ` class attribute to :class:`socketserver." +"ForkingMixIn` and :class:`socketserver.ThreadingMixIn` classes. Set the " +"class attribute to ``False`` to get the pre-3.7 behaviour." msgstr "" -#: whatsnew/3.7.rst:1311 +#: whatsnew/3.7.rst:1315 msgid "sqlite3" msgstr "" -#: whatsnew/3.7.rst:1313 +#: whatsnew/3.7.rst:1317 msgid "" ":class:`sqlite3.Connection` now exposes the :meth:`~sqlite3.Connection." "backup` method when the underlying SQLite library is at version 3.6.11 or " "higher. (Contributed by Lele Gaifax in :issue:`27645`.)" msgstr "" -#: whatsnew/3.7.rst:1317 +#: whatsnew/3.7.rst:1321 msgid "" "The *database* argument of :func:`sqlite3.connect` now accepts any :term:" "`path-like object`, instead of just a string. (Contributed by Anders " "Lorentsen in :issue:`31843`.)" msgstr "" -#: whatsnew/3.7.rst:2067 +#: whatsnew/3.7.rst:2071 msgid "ssl" msgstr "" -#: whatsnew/3.7.rst:1325 +#: whatsnew/3.7.rst:1329 msgid "" -"The :mod:`ssl` module now uses OpenSSL's builtin API instead of :func:`~ssl." +"The :mod:`ssl` module now uses OpenSSL's builtin API instead of :func:`!" "match_hostname` to check a host name or an IP address. Values are validated " "during TLS handshake. Any certificate validation error including failing " "the host name check now raises :exc:`~ssl.SSLCertVerificationError` and " @@ -1872,7 +1913,7 @@ msgid "" "`31399`.)" msgstr "" -#: whatsnew/3.7.rst:1336 +#: whatsnew/3.7.rst:1340 msgid "" "The improved host name check requires a *libssl* implementation compatible " "with OpenSSL 1.0.2 or 1.1. Consequently, OpenSSL 0.9.8 and 1.0.1 are no " @@ -1880,20 +1921,20 @@ msgid "" "The ssl module is mostly compatible with LibreSSL 2.7.2 and newer." msgstr "" -#: whatsnew/3.7.rst:1341 +#: whatsnew/3.7.rst:1345 msgid "" "The ``ssl`` module no longer sends IP addresses in SNI TLS extension. " "(Contributed by Christian Heimes in :issue:`32185`.)" msgstr "" -#: whatsnew/3.7.rst:1344 +#: whatsnew/3.7.rst:1348 msgid "" -":func:`~ssl.match_hostname` no longer supports partial wildcards like ``www*." +":func:`!match_hostname` no longer supports partial wildcards like ``www*." "example.org``. (Contributed by Mandeep Singh in :issue:`23033` and Christian " "Heimes in :issue:`31399`.)" msgstr "" -#: whatsnew/3.7.rst:1349 +#: whatsnew/3.7.rst:1353 msgid "" "The default cipher suite selection of the ``ssl`` module now uses a " "blacklist approach rather than a hard-coded whitelist. Python no longer re-" @@ -1902,7 +1943,7 @@ msgid "" "Christian Heimes in :issue:`31429`.)" msgstr "" -#: whatsnew/3.7.rst:1355 +#: whatsnew/3.7.rst:1359 msgid "" "Validation of server certificates containing internationalized domain names " "(IDNs) is now supported. As part of this change, the :attr:`SSLSocket." @@ -1912,7 +1953,7 @@ msgid "" "and Christian Heimes in :issue:`28414`.)" msgstr "" -#: whatsnew/3.7.rst:1362 +#: whatsnew/3.7.rst:1366 msgid "" "The ``ssl`` module has preliminary and experimental support for TLS 1.3 and " "OpenSSL 1.1.1. At the time of Python 3.7.0 release, OpenSSL 1.1.1 is still " @@ -1922,7 +1963,7 @@ msgid "" "`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` and :issue:`33618`)" msgstr "" -#: whatsnew/3.7.rst:1370 +#: whatsnew/3.7.rst:1374 msgid "" ":class:`~ssl.SSLSocket` and :class:`~ssl.SSLObject` no longer have a public " "constructor. Direct instantiation was never a documented and supported " @@ -1931,7 +1972,7 @@ msgid "" "(Contributed by Christian Heimes in :issue:`32951`)" msgstr "" -#: whatsnew/3.7.rst:1376 +#: whatsnew/3.7.rst:1380 msgid "" "OpenSSL 1.1 APIs for setting the minimum and maximum TLS protocol version " "are available as :attr:`SSLContext.minimum_version `_. (Contributed by " "Benjamin Peterson.)" msgstr "" -#: whatsnew/3.7.rst:1519 +#: whatsnew/3.7.rst:1523 msgid "unittest" msgstr "" -#: whatsnew/3.7.rst:1521 +#: whatsnew/3.7.rst:1525 msgid "" "The new ``-k`` command-line option allows filtering tests by a name " "substring or a Unix shell-like pattern. For example, ``python -m unittest -k " @@ -2138,18 +2179,18 @@ msgid "" "Jonas Haag in :issue:`32071`.)" msgstr "" -#: whatsnew/3.7.rst:1530 +#: whatsnew/3.7.rst:1534 msgid "unittest.mock" msgstr "" -#: whatsnew/3.7.rst:1532 +#: whatsnew/3.7.rst:1536 msgid "" "The :const:`~unittest.mock.sentinel` attributes now preserve their identity " "when they are :mod:`copied ` or :mod:`pickled `. (Contributed " "by Serhiy Storchaka in :issue:`20804`.)" msgstr "" -#: whatsnew/3.7.rst:1536 +#: whatsnew/3.7.rst:1540 msgid "" "The new :func:`~unittest.mock.seal` function allows sealing :class:" "`~unittest.mock.Mock` instances, which will disallow further creation of " @@ -2157,33 +2198,33 @@ msgid "" "themselves mocks. (Contributed by Mario Corchero in :issue:`30541`.)" msgstr "" -#: whatsnew/3.7.rst:1544 +#: whatsnew/3.7.rst:1548 msgid "urllib.parse" msgstr "" -#: whatsnew/3.7.rst:1546 +#: whatsnew/3.7.rst:1550 msgid "" ":func:`urllib.parse.quote` has been updated from :rfc:`2396` to :rfc:`3986`, " "adding ``~`` to the set of characters that are never quoted by default. " "(Contributed by Christian Theune and Ratnadeep Debnath in :issue:`16285`.)" msgstr "" -#: whatsnew/3.7.rst:1552 +#: whatsnew/3.7.rst:1556 msgid "uu" msgstr "" -#: whatsnew/3.7.rst:1554 +#: whatsnew/3.7.rst:1558 msgid "" -"The :func:`uu.encode` function now accepts an optional *backtick* keyword " +"The :func:`!uu.encode` function now accepts an optional *backtick* keyword " "argument. When it's true, zeros are represented by ``'`'`` instead of " "spaces. (Contributed by Xiang Zhang in :issue:`30103`.)" msgstr "" -#: whatsnew/3.7.rst:1560 +#: whatsnew/3.7.rst:1564 msgid "uuid" msgstr "" -#: whatsnew/3.7.rst:1562 +#: whatsnew/3.7.rst:1566 msgid "" "The new :attr:`UUID.is_safe ` attribute relays " "information from the platform about whether generated UUIDs are generated " @@ -2191,7 +2232,7 @@ msgid "" "`22807`.)" msgstr "" -#: whatsnew/3.7.rst:1567 +#: whatsnew/3.7.rst:1571 msgid "" ":func:`uuid.getnode` now prefers universally administered MAC addresses over " "locally administered MAC addresses. This makes a better guarantee for global " @@ -2200,116 +2241,115 @@ msgid "" "returned. (Contributed by Barry Warsaw in :issue:`32107`.)" msgstr "" -#: whatsnew/3.7.rst:1576 +#: whatsnew/3.7.rst:1580 msgid "warnings" msgstr "" -#: whatsnew/3.7.rst:1578 +#: whatsnew/3.7.rst:1582 msgid "" "The initialization of the default warnings filters has changed as follows:" msgstr "" -#: whatsnew/3.7.rst:1580 +#: whatsnew/3.7.rst:1584 msgid "" "warnings enabled via command line options (including those for :option:`-b` " "and the new CPython-specific :option:`-X` ``dev`` option) are always passed " "to the warnings machinery via the :data:`sys.warnoptions` attribute." msgstr "" -#: whatsnew/3.7.rst:1584 +#: whatsnew/3.7.rst:1588 msgid "" "warnings filters enabled via the command line or the environment now have " "the following order of precedence:" msgstr "" -#: whatsnew/3.7.rst:1587 +#: whatsnew/3.7.rst:1591 msgid "the ``BytesWarning`` filter for :option:`-b` (or ``-bb``)" msgstr "" -#: whatsnew/3.7.rst:1588 +#: whatsnew/3.7.rst:1592 msgid "any filters specified with the :option:`-W` option" msgstr "" -#: whatsnew/3.7.rst:1589 +#: whatsnew/3.7.rst:1593 msgid "" "any filters specified with the :envvar:`PYTHONWARNINGS` environment variable" msgstr "" -#: whatsnew/3.7.rst:1591 +#: whatsnew/3.7.rst:1595 msgid "" "any other CPython specific filters (e.g. the ``default`` filter added for " "the new ``-X dev`` mode)" msgstr "" -#: whatsnew/3.7.rst:1593 +#: whatsnew/3.7.rst:1597 msgid "any implicit filters defined directly by the warnings machinery" msgstr "" -#: whatsnew/3.7.rst:1595 +#: whatsnew/3.7.rst:1599 msgid "" "in :ref:`CPython debug builds `, all warnings are now displayed " "by default (the implicit filter list is empty)" msgstr "" -#: whatsnew/3.7.rst:1598 +#: whatsnew/3.7.rst:1602 msgid "" "(Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`, :issue:" "`32043`, and :issue:`32230`.)" msgstr "" -#: whatsnew/3.7.rst:1601 +#: whatsnew/3.7.rst:1605 msgid "" "Deprecation warnings are once again shown by default in single-file scripts " "and at the interactive prompt. See :ref:`whatsnew37-pep565` for details. " "(Contributed by Nick Coghlan in :issue:`31975`.)" msgstr "" -#: whatsnew/3.7.rst:1607 +#: whatsnew/3.7.rst:1611 msgid "xml" msgstr "" -#: whatsnew/3.7.rst:1609 +#: whatsnew/3.7.rst:1613 msgid "" "As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." "minidom` and :mod:`xml.sax` modules no longer process external entities by " "default. (Contributed by Christian Heimes in :gh:`61441`.)" msgstr "" -#: whatsnew/3.7.rst:1616 +#: whatsnew/3.7.rst:1620 msgid "xml.etree" msgstr "" -#: whatsnew/3.7.rst:1618 +#: whatsnew/3.7.rst:1622 msgid "" -":ref:`ElementPath ` predicates in the :meth:`find` " +":ref:`ElementPath ` predicates in the :meth:`!find` " "methods can now compare text of the current node with ``[. = \"text\"]``, " "not only text in children. Predicates also allow adding spaces for better " "readability. (Contributed by Stefan Behnel in :issue:`31648`.)" msgstr "" -#: whatsnew/3.7.rst:1625 +#: whatsnew/3.7.rst:1629 msgid "xmlrpc.server" msgstr "" -#: whatsnew/3.7.rst:1627 +#: whatsnew/3.7.rst:1631 msgid "" -":meth:`SimpleXMLRPCDispatcher.register_function ` can now be used as a decorator. (Contributed by " -"Xiang Zhang in :issue:`7769`.)" +":meth:`!SimpleXMLRPCDispatcher.register_function` can now be used as a " +"decorator. (Contributed by Xiang Zhang in :issue:`7769`.)" msgstr "" -#: whatsnew/3.7.rst:1633 +#: whatsnew/3.7.rst:1637 msgid "zipapp" msgstr "" -#: whatsnew/3.7.rst:1635 +#: whatsnew/3.7.rst:1639 msgid "" "Function :func:`~zipapp.create_archive` now accepts an optional *filter* " "argument to allow the user to select which files should be included in the " "archive. (Contributed by Irmen de Jong in :issue:`31072`.)" msgstr "" -#: whatsnew/3.7.rst:1639 +#: whatsnew/3.7.rst:1643 msgid "" "Function :func:`~zipapp.create_archive` now accepts an optional *compressed* " "argument to generate a compressed archive. A command line option ``--" @@ -2317,27 +2357,27 @@ msgid "" "Zhiming Wang in :issue:`31638`.)" msgstr "" -#: whatsnew/3.7.rst:1646 +#: whatsnew/3.7.rst:1650 msgid "zipfile" msgstr "" -#: whatsnew/3.7.rst:1648 +#: whatsnew/3.7.rst:1652 msgid "" ":class:`~zipfile.ZipFile` now accepts the new *compresslevel* parameter to " "control the compression level. (Contributed by Bo Bayles in :issue:`21417`.)" msgstr "" -#: whatsnew/3.7.rst:1652 +#: whatsnew/3.7.rst:1656 msgid "" "Subdirectories in archives created by ``ZipFile`` are now stored in " "alphabetical order. (Contributed by Bernhard M. Wiedemann in :issue:`30693`.)" msgstr "" -#: whatsnew/3.7.rst:1658 +#: whatsnew/3.7.rst:1662 msgid "C API Changes" msgstr "" -#: whatsnew/3.7.rst:1660 +#: whatsnew/3.7.rst:1664 msgid "" "A new API for thread-local storage has been implemented. See :ref:" "`whatsnew37-pep539` for an overview and :ref:`thread-specific-storage-api` " @@ -2345,82 +2385,82 @@ msgid "" "`25658`.)" msgstr "" -#: whatsnew/3.7.rst:1665 +#: whatsnew/3.7.rst:1669 msgid "" "The new :ref:`context variables ` functionality exposes a " "number of :ref:`new C APIs `." msgstr "" -#: whatsnew/3.7.rst:1668 +#: whatsnew/3.7.rst:1672 msgid "" "The new :c:func:`PyImport_GetModule` function returns the previously " "imported module with the given name. (Contributed by Eric Snow in :issue:" "`28411`.)" msgstr "" -#: whatsnew/3.7.rst:1672 +#: whatsnew/3.7.rst:1676 msgid "" "The new :c:macro:`Py_RETURN_RICHCOMPARE` macro eases writing rich comparison " "functions. (Contributed by Petr Victorin in :issue:`23699`.)" msgstr "" -#: whatsnew/3.7.rst:1676 +#: whatsnew/3.7.rst:1680 msgid "" "The new :c:macro:`Py_UNREACHABLE` macro can be used to mark unreachable code " "paths. (Contributed by Barry Warsaw in :issue:`31338`.)" msgstr "" -#: whatsnew/3.7.rst:1680 +#: whatsnew/3.7.rst:1684 msgid "" "The :mod:`tracemalloc` now exposes a C API through the new :c:func:" "`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` functions. " "(Contributed by Victor Stinner in :issue:`30054`.)" msgstr "" -#: whatsnew/3.7.rst:1685 +#: whatsnew/3.7.rst:1689 msgid "" -"The new :c:func:`import__find__load__start` and :c:func:" -"`import__find__load__done` static markers can be used to trace module " -"imports. (Contributed by Christian Heimes in :issue:`31574`.)" +"The new :ref:`import__find__load__start ` and :ref:" +"`import__find__load__done ` static markers can be used to " +"trace module imports. (Contributed by Christian Heimes in :issue:`31574`.)" msgstr "" -#: whatsnew/3.7.rst:1690 +#: whatsnew/3.7.rst:1694 msgid "" "The fields :c:member:`!name` and :c:member:`!doc` of structures :c:type:" "`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:" -"type:`PyStructSequence_Desc`, and :c:struct:`wrapperbase` are now of type " +"type:`PyStructSequence_Desc`, and :c:struct:`!wrapperbase` are now of type " "``const char *`` rather of ``char *``. (Contributed by Serhiy Storchaka in :" "issue:`28761`.)" msgstr "" -#: whatsnew/3.7.rst:1696 +#: whatsnew/3.7.rst:1700 msgid "" "The result of :c:func:`PyUnicode_AsUTF8AndSize` and :c:func:" "`PyUnicode_AsUTF8` is now of type ``const char *`` rather of ``char *``. " "(Contributed by Serhiy Storchaka in :issue:`28769`.)" msgstr "" -#: whatsnew/3.7.rst:1700 +#: whatsnew/3.7.rst:1704 msgid "" "The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` and :c:" "func:`PyMapping_Items` is now always a list, rather than a list or a tuple. " "(Contributed by Oren Milman in :issue:`28280`.)" msgstr "" -#: whatsnew/3.7.rst:1704 +#: whatsnew/3.7.rst:1708 msgid "" "Added functions :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka in :issue:`27867`.)" msgstr "" -#: whatsnew/3.7.rst:1707 +#: whatsnew/3.7.rst:1711 msgid "" ":c:func:`PyOS_AfterFork` is deprecated in favour of the new functions :c:" "func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` and :c:func:" "`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou in :issue:`16500`.)" msgstr "" -#: whatsnew/3.7.rst:1712 +#: whatsnew/3.7.rst:1716 msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " @@ -2428,7 +2468,7 @@ msgid "" "issue:`22898` and :issue:`30697`." msgstr "" -#: whatsnew/3.7.rst:1717 +#: whatsnew/3.7.rst:1721 msgid "" "Added C API support for timezones with timezone constructors :c:func:" "`PyTimeZone_FromOffset` and :c:func:`PyTimeZone_FromOffsetAndName`, and " @@ -2436,22 +2476,22 @@ msgid "" "Contributed by Paul Ganssle in :issue:`10381`." msgstr "" -#: whatsnew/3.7.rst:1722 +#: whatsnew/3.7.rst:1726 msgid "" -"The type of results of :c:func:`PyThread_start_new_thread` and :c:func:" -"`PyThread_get_thread_ident`, and the *id* parameter of :c:func:" +"The type of results of :c:func:`!PyThread_start_new_thread` and :c:func:`!" +"PyThread_get_thread_ident`, and the *id* parameter of :c:func:" "`PyThreadState_SetAsyncExc` changed from :c:expr:`long` to :c:expr:`unsigned " "long`. (Contributed by Serhiy Storchaka in :issue:`6532`.)" msgstr "" -#: whatsnew/3.7.rst:1728 +#: whatsnew/3.7.rst:1732 msgid "" ":c:func:`PyUnicode_AsWideCharString` now raises a :exc:`ValueError` if the " "second argument is ``NULL`` and the :c:expr:`wchar_t*` string contains null " "characters. (Contributed by Serhiy Storchaka in :issue:`30708`.)" msgstr "" -#: whatsnew/3.7.rst:1732 +#: whatsnew/3.7.rst:1736 msgid "" "Changes to the startup sequence and the management of dynamic memory " "allocators mean that the long documented requirement to call :c:func:" @@ -2462,45 +2502,45 @@ msgid "" "details." msgstr "" -#: whatsnew/3.7.rst:1740 +#: whatsnew/3.7.rst:1744 msgid "" "The new :c:func:`PyInterpreterState_GetID` returns the unique ID for a given " "interpreter. (Contributed by Eric Snow in :issue:`29102`.)" msgstr "" -#: whatsnew/3.7.rst:1744 +#: whatsnew/3.7.rst:1748 msgid "" ":c:func:`Py_DecodeLocale`, :c:func:`Py_EncodeLocale` now use the UTF-8 " "encoding when the :ref:`UTF-8 mode ` is enabled. " "(Contributed by Victor Stinner in :issue:`29240`.)" msgstr "" -#: whatsnew/3.7.rst:1748 +#: whatsnew/3.7.rst:1752 msgid "" ":c:func:`PyUnicode_DecodeLocaleAndSize` and :c:func:`PyUnicode_EncodeLocale` " "now use the current locale encoding for ``surrogateescape`` error handler. " "(Contributed by Victor Stinner in :issue:`29240`.)" msgstr "" -#: whatsnew/3.7.rst:1752 +#: whatsnew/3.7.rst:1756 msgid "" "The *start* and *end* parameters of :c:func:`PyUnicode_FindChar` are now " "adjusted to behave like string slices. (Contributed by Xiang Zhang in :issue:" "`28822`.)" msgstr "" -#: whatsnew/3.7.rst:1758 +#: whatsnew/3.7.rst:1762 msgid "Build Changes" msgstr "" -#: whatsnew/3.7.rst:1760 +#: whatsnew/3.7.rst:1764 msgid "" "Support for building ``--without-threads`` has been removed. The :mod:" "`threading` module is now always available. (Contributed by Antoine Pitrou " "in :issue:`31370`.)." msgstr "" -#: whatsnew/3.7.rst:1764 +#: whatsnew/3.7.rst:1768 msgid "" "A full copy of libffi is no longer bundled for use when building the :mod:" "`_ctypes ` module on non-OSX UNIX platforms. An installed copy of " @@ -2508,7 +2548,7 @@ msgid "" "(Contributed by Zachary Ware in :issue:`27979`.)" msgstr "" -#: whatsnew/3.7.rst:1769 +#: whatsnew/3.7.rst:1773 msgid "" "The Windows build process no longer depends on Subversion to pull in " "external sources, a Python script is used to download zipfiles from GitHub " @@ -2517,7 +2557,7 @@ msgid "" "by Zachary Ware in :issue:`30450`.)" msgstr "" -#: whatsnew/3.7.rst:1775 +#: whatsnew/3.7.rst:1779 msgid "" "The :mod:`ssl` module requires OpenSSL 1.0.2 or 1.1 compatible libssl. " "OpenSSL 1.0.1 has reached end of lifetime on 2016-12-31 and is no longer " @@ -2525,11 +2565,11 @@ msgid "" "up to version 2.6.4 are missing required OpenSSL 1.0.2 APIs." msgstr "" -#: whatsnew/3.7.rst:1784 +#: whatsnew/3.7.rst:1788 msgid "Optimizations" msgstr "" -#: whatsnew/3.7.rst:1786 +#: whatsnew/3.7.rst:1790 msgid "" "The overhead of calling many methods of various standard library classes " "implemented in C has been significantly reduced by porting more code to use " @@ -2537,85 +2577,85 @@ msgid "" "`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" msgstr "" -#: whatsnew/3.7.rst:1792 +#: whatsnew/3.7.rst:1796 msgid "" "Various optimizations have reduced Python startup time by 10% on Linux and " "up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki in :issue:" "`29585`, and Ivan Levkivskyi in :issue:`31333`.)" msgstr "" -#: whatsnew/3.7.rst:1797 +#: whatsnew/3.7.rst:1801 msgid "" "Method calls are now up to 20% faster due to the bytecode changes which " "avoid creating bound method instances. (Contributed by Yury Selivanov and " "INADA Naoki in :issue:`26110`.)" msgstr "" -#: whatsnew/3.7.rst:1803 +#: whatsnew/3.7.rst:1807 msgid "" "The :mod:`asyncio` module received a number of notable optimizations for " "commonly used functions:" msgstr "" -#: whatsnew/3.7.rst:1806 +#: whatsnew/3.7.rst:1810 msgid "" "The :func:`asyncio.get_event_loop` function has been reimplemented in C to " "make it up to 15 times faster. (Contributed by Yury Selivanov in :issue:" "`32296`.)" msgstr "" -#: whatsnew/3.7.rst:1810 +#: whatsnew/3.7.rst:1814 msgid "" ":class:`asyncio.Future` callback management has been optimized. (Contributed " "by Yury Selivanov in :issue:`32348`.)" msgstr "" -#: whatsnew/3.7.rst:1813 +#: whatsnew/3.7.rst:1817 msgid "" ":func:`asyncio.gather` is now up to 15% faster. (Contributed by Yury " "Selivanov in :issue:`32355`.)" msgstr "" -#: whatsnew/3.7.rst:1816 +#: whatsnew/3.7.rst:1820 msgid "" ":func:`asyncio.sleep` is now up to 2 times faster when the *delay* argument " "is zero or negative. (Contributed by Andrew Svetlov in :issue:`32351`.)" msgstr "" -#: whatsnew/3.7.rst:1820 +#: whatsnew/3.7.rst:1824 msgid "" "The performance overhead of asyncio debug mode has been reduced. " "(Contributed by Antoine Pitrou in :issue:`31970`.)" msgstr "" -#: whatsnew/3.7.rst:1823 +#: whatsnew/3.7.rst:1827 msgid "" "As a result of :ref:`PEP 560 work `, the import time of :" "mod:`typing` has been reduced by a factor of 7, and many typing operations " "are now faster. (Contributed by Ivan Levkivskyi in :issue:`32226`.)" msgstr "" -#: whatsnew/3.7.rst:1828 +#: whatsnew/3.7.rst:1832 msgid "" ":func:`sorted` and :meth:`list.sort` have been optimized for common cases to " "be up to 40-75% faster. (Contributed by Elliot Gorokhovsky in :issue:" "`28685`.)" msgstr "" -#: whatsnew/3.7.rst:1832 +#: whatsnew/3.7.rst:1836 msgid "" ":meth:`dict.copy` is now up to 5.5 times faster. (Contributed by Yury " "Selivanov in :issue:`31179`.)" msgstr "" -#: whatsnew/3.7.rst:1835 +#: whatsnew/3.7.rst:1839 msgid "" ":func:`hasattr` and :func:`getattr` are now about 4 times faster when *name* " "is not found and *obj* does not override :meth:`object.__getattr__` or :meth:" "`object.__getattribute__`. (Contributed by INADA Naoki in :issue:`32544`.)" msgstr "" -#: whatsnew/3.7.rst:1840 +#: whatsnew/3.7.rst:1844 msgid "" "Searching for certain Unicode characters (like Ukrainian capital \"Є\") in a " "string was up to 25 times slower than searching for other characters. It is " @@ -2623,7 +2663,7 @@ msgid "" "in :issue:`24821`.)" msgstr "" -#: whatsnew/3.7.rst:1845 +#: whatsnew/3.7.rst:1849 msgid "" "The :func:`collections.namedtuple` factory has been reimplemented to make " "the creation of named tuples 4 to 6 times faster. (Contributed by Jelle " @@ -2631,33 +2671,34 @@ msgid "" "Raymond Hettinger in :issue:`28638`.)" msgstr "" -#: whatsnew/3.7.rst:1850 +#: whatsnew/3.7.rst:1854 msgid "" -":meth:`date.fromordinal` and :meth:`date.fromtimestamp` are now up to 30% " -"faster in the common case. (Contributed by Paul Ganssle in :issue:`32403`.)" +":meth:`datetime.date.fromordinal` and :meth:`datetime.date.fromtimestamp` " +"are now up to 30% faster in the common case. (Contributed by Paul Ganssle " +"in :issue:`32403`.)" msgstr "" -#: whatsnew/3.7.rst:1854 +#: whatsnew/3.7.rst:1858 msgid "" "The :func:`os.fwalk` function is now up to 2 times faster thanks to the use " "of :func:`os.scandir`. (Contributed by Serhiy Storchaka in :issue:`25996`.)" msgstr "" -#: whatsnew/3.7.rst:1858 +#: whatsnew/3.7.rst:1862 msgid "" "The speed of the :func:`shutil.rmtree` function has been improved by 20--40% " "thanks to the use of the :func:`os.scandir` function. (Contributed by Serhiy " "Storchaka in :issue:`28564`.)" msgstr "" -#: whatsnew/3.7.rst:1862 +#: whatsnew/3.7.rst:1866 msgid "" "Optimized case-insensitive matching and searching of :mod:`regular " "expressions `. Searching some patterns can now be up to 20 times " "faster. (Contributed by Serhiy Storchaka in :issue:`30285`.)" msgstr "" -#: whatsnew/3.7.rst:1866 +#: whatsnew/3.7.rst:1870 msgid "" ":func:`re.compile` now converts ``flags`` parameter to int object if it is " "``RegexFlag``. It is now as fast as Python 3.5, and faster than Python 3.6 " @@ -2665,7 +2706,7 @@ msgid "" "`31671`.)" msgstr "" -#: whatsnew/3.7.rst:1871 +#: whatsnew/3.7.rst:1875 msgid "" "The :meth:`~selectors.BaseSelector.modify` methods of classes :class:" "`selectors.EpollSelector`, :class:`selectors.PollSelector` and :class:" @@ -2673,7 +2714,7 @@ msgid "" "(Contributed by Giampaolo Rodola' in :issue:`30014`)" msgstr "" -#: whatsnew/3.7.rst:1876 +#: whatsnew/3.7.rst:1880 msgid "" "Constant folding has been moved from the peephole optimizer to the new AST " "optimizer, which is able perform optimizations more consistently. " @@ -2681,7 +2722,7 @@ msgid "" "`11549`.)" msgstr "" -#: whatsnew/3.7.rst:1881 +#: whatsnew/3.7.rst:1885 msgid "" "Most functions and methods in :mod:`abc` have been rewritten in C. This " "makes creation of abstract base classes, and calling :func:`isinstance` and :" @@ -2690,7 +2731,7 @@ msgid "" "`31333`)" msgstr "" -#: whatsnew/3.7.rst:1887 +#: whatsnew/3.7.rst:1891 msgid "" "Significant speed improvements to alternate constructors for :class:" "`datetime.date` and :class:`datetime.datetime` by using fast-path " @@ -2698,7 +2739,7 @@ msgid "" "in :issue:`32403`)" msgstr "" -#: whatsnew/3.7.rst:1892 +#: whatsnew/3.7.rst:1896 msgid "" "The speed of comparison of :class:`array.array` instances has been improved " "considerably in certain cases. It is now from 10x to 70x faster when " @@ -2706,18 +2747,18 @@ msgid "" "Adrian Wielgosik in :issue:`24700`.)" msgstr "" -#: whatsnew/3.7.rst:1897 +#: whatsnew/3.7.rst:1901 msgid "" "The :func:`math.erf` and :func:`math.erfc` functions now use the (faster) C " "library implementation on most platforms. (Contributed by Serhiy Storchaka " "in :issue:`26121`.)" msgstr "" -#: whatsnew/3.7.rst:1903 +#: whatsnew/3.7.rst:1907 msgid "Other CPython Implementation Changes" msgstr "" -#: whatsnew/3.7.rst:1905 +#: whatsnew/3.7.rst:1909 msgid "" "Trace hooks may now opt out of receiving the ``line`` and opt into receiving " "the ``opcode`` events from the interpreter by setting the corresponding new :" @@ -2725,7 +2766,7 @@ msgid "" "the frame being traced. (Contributed by Nick Coghlan in :issue:`31344`.)" msgstr "" -#: whatsnew/3.7.rst:1910 +#: whatsnew/3.7.rst:1914 msgid "" "Fixed some consistency problems with namespace package module attributes. " "Namespace module objects now have an ``__file__`` that is set to ``None`` " @@ -2736,14 +2777,14 @@ msgid "" "`32303`." msgstr "" -#: whatsnew/3.7.rst:1918 +#: whatsnew/3.7.rst:1922 msgid "" "The :func:`locals` dictionary now displays in the lexical order that " "variables were defined. Previously, the order was undefined. (Contributed " "by Raymond Hettinger in :issue:`32690`.)" msgstr "" -#: whatsnew/3.7.rst:1922 +#: whatsnew/3.7.rst:1926 msgid "" "The ``distutils`` ``upload`` command no longer tries to change CR end-of-" "line characters to CRLF. This fixes a corruption issue with sdists that " @@ -2751,11 +2792,11 @@ msgid "" "`32304`.)" msgstr "" -#: whatsnew/3.7.rst:1929 +#: whatsnew/3.7.rst:1933 msgid "Deprecated Python Behavior" msgstr "" -#: whatsnew/3.7.rst:1931 +#: whatsnew/3.7.rst:1935 msgid "" "Yield expressions (both ``yield`` and ``yield from`` clauses) are now " "deprecated in comprehensions and generator expressions (aside from the " @@ -2769,7 +2810,7 @@ msgid "" "Storchaka in :issue:`10544`.)" msgstr "" -#: whatsnew/3.7.rst:1942 +#: whatsnew/3.7.rst:1946 msgid "" "Returning a subclass of :class:`complex` from :meth:`object.__complex__` is " "deprecated and will be an error in future Python versions. This makes " @@ -2777,22 +2818,22 @@ msgid "" "__float__`. (Contributed by Serhiy Storchaka in :issue:`28894`.)" msgstr "" -#: whatsnew/3.7.rst:1951 +#: whatsnew/3.7.rst:1955 msgid "Deprecated Python modules, functions and methods" msgstr "" -#: whatsnew/3.7.rst:1954 +#: whatsnew/3.7.rst:1958 msgid "aifc" msgstr "" -#: whatsnew/3.7.rst:1956 +#: whatsnew/3.7.rst:1960 msgid "" -":func:`aifc.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`aifc.open` instead. (Contributed by Brian Curtin in :issue:" +":func:`!aifc.openfp` has been deprecated and will be removed in Python 3.9. " +"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin in :issue:" "`31985`.)" msgstr "" -#: whatsnew/3.7.rst:1966 +#: whatsnew/3.7.rst:1970 msgid "" "Support for directly ``await``-ing instances of :class:`asyncio.Lock` and " "other asyncio synchronization primitives has been deprecated. An " @@ -2801,14 +2842,14 @@ msgid "" "`32253`.)" msgstr "" -#: whatsnew/3.7.rst:1972 +#: whatsnew/3.7.rst:1976 msgid "" -"The :meth:`asyncio.Task.current_task` and :meth:`asyncio.Task.all_tasks` " +"The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " "methods have been deprecated. (Contributed by Andrew Svetlov in :issue:" "`32250`.)" msgstr "" -#: whatsnew/3.7.rst:1980 +#: whatsnew/3.7.rst:1984 msgid "" "In Python 3.8, the abstract base classes in :mod:`collections.abc` will no " "longer be exposed in the regular :mod:`collections` module. This will help " @@ -2816,7 +2857,7 @@ msgid "" "base classes. (Contributed by Serhiy Storchaka in :issue:`25988`.)" msgstr "" -#: whatsnew/3.7.rst:1990 +#: whatsnew/3.7.rst:1994 msgid "" ":mod:`dbm.dumb` now supports reading read-only files and no longer writes " "the index file when it is not changed. A deprecation warning is now emitted " @@ -2825,71 +2866,71 @@ msgid "" "Storchaka in :issue:`28847`.)" msgstr "" -#: whatsnew/3.7.rst:2000 +#: whatsnew/3.7.rst:2004 msgid "" -"In Python 3.8, attempting to check for non-Enum objects in :class:`Enum` " -"classes will raise a :exc:`TypeError` (e.g. ``1 in Color``); similarly, " -"attempting to check for non-Flag objects in a :class:`Flag` member will " -"raise :exc:`TypeError` (e.g. ``1 in Perm.RW``); currently, both operations " -"return :const:`False` instead. (Contributed by Ethan Furman in :issue:" -"`33217`.)" +"In Python 3.8, attempting to check for non-Enum objects in :class:`~enum." +"Enum` classes will raise a :exc:`TypeError` (e.g. ``1 in Color``); " +"similarly, attempting to check for non-Flag objects in a :class:`~enum.Flag` " +"member will raise :exc:`TypeError` (e.g. ``1 in Perm.RW``); currently, both " +"operations return :const:`False` instead. (Contributed by Ethan Furman in :" +"issue:`33217`.)" msgstr "" -#: whatsnew/3.7.rst:2009 +#: whatsnew/3.7.rst:2013 msgid "gettext" msgstr "" -#: whatsnew/3.7.rst:2011 +#: whatsnew/3.7.rst:2015 msgid "" "Using non-integer value for selecting a plural form in :mod:`gettext` is now " "deprecated. It never correctly worked. (Contributed by Serhiy Storchaka in :" "issue:`28692`.)" msgstr "" -#: whatsnew/3.7.rst:2019 +#: whatsnew/3.7.rst:2023 msgid "" -"Methods :meth:`!MetaPathFinder.find_module()` (replaced by :meth:" +"Methods :meth:`!MetaPathFinder.find_module` (replaced by :meth:" "`MetaPathFinder.find_spec() `) and :" -"meth:`!PathEntryFinder.find_loader()` (replaced by :meth:`PathEntryFinder." +"meth:`!PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder." "find_spec() `) both deprecated in " "Python 3.4 now emit :exc:`DeprecationWarning`. (Contributed by Matthias " "Bussonnier in :issue:`29576`.)" msgstr "" -#: whatsnew/3.7.rst:2030 +#: whatsnew/3.7.rst:2034 msgid "" "The :class:`importlib.abc.ResourceLoader` ABC has been deprecated in favour " "of :class:`importlib.abc.ResourceReader`." msgstr "" -#: whatsnew/3.7.rst:2037 +#: whatsnew/3.7.rst:2041 msgid "" -":func:`locale.format` has been deprecated, use :meth:`locale.format_string` " +":func:`!locale.format` has been deprecated, use :meth:`locale.format_string` " "instead. (Contributed by Garvit in :issue:`10379`.)" msgstr "" -#: whatsnew/3.7.rst:2042 +#: whatsnew/3.7.rst:2046 msgid "macpath" msgstr "" -#: whatsnew/3.7.rst:2044 +#: whatsnew/3.7.rst:2048 msgid "" -"The :mod:`macpath` is now deprecated and will be removed in Python 3.8. " +"The :mod:`!macpath` is now deprecated and will be removed in Python 3.8. " "(Contributed by Chi Hsuan Yen in :issue:`9850`.)" msgstr "" -#: whatsnew/3.7.rst:2049 +#: whatsnew/3.7.rst:2053 msgid "threading" msgstr "" -#: whatsnew/3.7.rst:2051 +#: whatsnew/3.7.rst:2055 msgid "" -":mod:`dummy_threading` and :mod:`_dummy_thread` have been deprecated. It is " -"no longer possible to build Python with threading disabled. Use :mod:" +":mod:`!dummy_threading` and :mod:`!_dummy_thread` have been deprecated. It " +"is no longer possible to build Python with threading disabled. Use :mod:" "`threading` instead. (Contributed by Antoine Pitrou in :issue:`31370`.)" msgstr "" -#: whatsnew/3.7.rst:2060 +#: whatsnew/3.7.rst:2064 msgid "" "The silent argument value truncation in :func:`socket.htons` and :func:" "`socket.ntohs` has been deprecated. In future versions of Python, if the " @@ -2897,52 +2938,52 @@ msgid "" "(Contributed by Oren Milman in :issue:`28332`.)" msgstr "" -#: whatsnew/3.7.rst:2069 +#: whatsnew/3.7.rst:2073 msgid "" -":func:`ssl.wrap_socket` is deprecated. Use :meth:`ssl.SSLContext." +":func:`!ssl.wrap_socket` is deprecated. Use :meth:`ssl.SSLContext." "wrap_socket` instead. (Contributed by Christian Heimes in :issue:`28124`.)" msgstr "" -#: whatsnew/3.7.rst:2075 +#: whatsnew/3.7.rst:2079 msgid "sunau" msgstr "" -#: whatsnew/3.7.rst:2077 +#: whatsnew/3.7.rst:2081 msgid "" -":func:`sunau.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`sunau.open` instead. (Contributed by Brian Curtin in :issue:" +":func:`!sunau.openfp` has been deprecated and will be removed in Python 3.9. " +"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin in :issue:" "`31985`.)" msgstr "" -#: whatsnew/3.7.rst:2085 +#: whatsnew/3.7.rst:2089 msgid "" -"Deprecated :func:`sys.set_coroutine_wrapper` and :func:`sys." +"Deprecated :func:`!sys.set_coroutine_wrapper` and :func:`!sys." "get_coroutine_wrapper`." msgstr "" -#: whatsnew/3.7.rst:2088 +#: whatsnew/3.7.rst:2092 msgid "" "The undocumented ``sys.callstats()`` function has been deprecated and will " "be removed in a future Python version. (Contributed by Victor Stinner in :" "issue:`28799`.)" msgstr "" -#: whatsnew/3.7.rst:2094 +#: whatsnew/3.7.rst:2098 msgid "wave" msgstr "" -#: whatsnew/3.7.rst:2096 +#: whatsnew/3.7.rst:2100 msgid "" -":func:`wave.openfp` has been deprecated and will be removed in Python 3.9. " +":func:`!wave.openfp` has been deprecated and will be removed in Python 3.9. " "Use :func:`wave.open` instead. (Contributed by Brian Curtin in :issue:" "`31985`.)" msgstr "" -#: whatsnew/3.7.rst:2102 +#: whatsnew/3.7.rst:2106 msgid "Deprecated functions and types of the C API" msgstr "" -#: whatsnew/3.7.rst:2104 +#: whatsnew/3.7.rst:2108 msgid "" "Function :c:func:`PySlice_GetIndicesEx` is deprecated and replaced with a " "macro if ``Py_LIMITED_API`` is not set or set to a value in the range " @@ -2951,7 +2992,7 @@ msgid "" "`27867`.)" msgstr "" -#: whatsnew/3.7.rst:2109 +#: whatsnew/3.7.rst:2113 msgid "" ":c:func:`PyOS_AfterFork` has been deprecated. Use :c:func:" "`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` or :c:func:" @@ -2959,15 +3000,15 @@ msgid "" "`16500`.)" msgstr "" -#: whatsnew/3.7.rst:2117 +#: whatsnew/3.7.rst:2121 msgid "Platform Support Removals" msgstr "" -#: whatsnew/3.7.rst:2119 +#: whatsnew/3.7.rst:2123 msgid "FreeBSD 9 and older are no longer officially supported." msgstr "" -#: whatsnew/3.7.rst:2120 +#: whatsnew/3.7.rst:2124 msgid "" "For full Unicode support, including within extension modules, \\*nix " "platforms are now expected to provide at least one of ``C.UTF-8`` (full " @@ -2975,7 +3016,7 @@ msgid "" "an alternative to the legacy ``ASCII``-based ``C`` locale." msgstr "" -#: whatsnew/3.7.rst:2124 +#: whatsnew/3.7.rst:2128 msgid "" "OpenSSL 0.9.8 and 1.0.1 are no longer supported, which means building " "CPython 3.7 with SSL/TLS support on older platforms still using these " @@ -2983,14 +3024,14 @@ msgid "" "OpenSSL." msgstr "" -#: whatsnew/3.7.rst:2128 +#: whatsnew/3.7.rst:2132 msgid "" "Notably, this issue affects the Debian 8 (aka \"jessie\") and Ubuntu 14.04 " "(aka \"Trusty\") LTS Linux distributions, as they still use OpenSSL 1.0.1 by " "default." msgstr "" -#: whatsnew/3.7.rst:2132 +#: whatsnew/3.7.rst:2136 msgid "" "Debian 9 (\"stretch\") and Ubuntu 16.04 (\"xenial\"), as well as recent " "releases of other LTS Linux releases (e.g. RHEL/CentOS 7.5, SLES 12-SP3), " @@ -2998,7 +3039,7 @@ msgid "" "configuration." msgstr "" -#: whatsnew/3.7.rst:2136 +#: whatsnew/3.7.rst:2140 msgid "" "CPython's own `CI configuration file `_ provides an example of using the SSL :source:" @@ -3007,41 +3048,41 @@ msgid "" "outdated system provided OpenSSL." msgstr "" -#: whatsnew/3.7.rst:2145 +#: whatsnew/3.7.rst:2149 msgid "API and Feature Removals" msgstr "" -#: whatsnew/3.7.rst:2147 +#: whatsnew/3.7.rst:2151 msgid "The following features and APIs have been removed from Python 3.7:" msgstr "" -#: whatsnew/3.7.rst:2149 +#: whatsnew/3.7.rst:2153 msgid "" "The ``os.stat_float_times()`` function has been removed. It was introduced " "in Python 2.3 for backward compatibility with Python 2.2, and was deprecated " "since Python 3.1." msgstr "" -#: whatsnew/3.7.rst:2153 +#: whatsnew/3.7.rst:2157 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter in replacement " "templates for :func:`re.sub` were deprecated in Python 3.5, and will now " "cause an error." msgstr "" -#: whatsnew/3.7.rst:2157 +#: whatsnew/3.7.rst:2161 msgid "" "Removed support of the *exclude* argument in :meth:`tarfile.TarFile.add`. It " "was deprecated in Python 2.7 and 3.2. Use the *filter* argument instead." msgstr "" -#: whatsnew/3.7.rst:2160 +#: whatsnew/3.7.rst:2164 msgid "" "The :func:`!ntpath.splitunc` function was deprecated in Python 3.1, and has " "now been removed. Use :func:`~os.path.splitdrive` instead." msgstr "" -#: whatsnew/3.7.rst:2164 +#: whatsnew/3.7.rst:2168 msgid "" ":func:`collections.namedtuple` no longer supports the *verbose* parameter or " "``_source`` attribute which showed the generated source code for the named " @@ -3050,23 +3091,23 @@ msgid "" "Naoki, Serhiy Storchaka, and Raymond Hettinger in :issue:`28638`.)" msgstr "" -#: whatsnew/3.7.rst:2170 +#: whatsnew/3.7.rst:2174 msgid "" "Functions :func:`bool`, :func:`float`, :func:`list` and :func:`tuple` no " "longer take keyword arguments. The first argument of :func:`int` can now be " "passed only as positional argument." msgstr "" -#: whatsnew/3.7.rst:2174 +#: whatsnew/3.7.rst:2178 msgid "" "Removed previously deprecated in Python 2.4 classes ``Plist``, ``Dict`` and " "``_InternalDict`` in the :mod:`plistlib` module. Dict values in the result " -"of functions :func:`~plistlib.readPlist` and :func:`~plistlib." -"readPlistFromBytes` are now normal dicts. You no longer can use attribute " -"access to access items of these dictionaries." +"of functions :func:`!readPlist` and :func:`!readPlistFromBytes` are now " +"normal dicts. You no longer can use attribute access to access items of " +"these dictionaries." msgstr "" -#: whatsnew/3.7.rst:2180 +#: whatsnew/3.7.rst:2184 msgid "" "The ``asyncio.windows_utils.socketpair()`` function has been removed. Use " "the :func:`socket.socketpair` function instead, it is available on all " @@ -3074,33 +3115,33 @@ msgid "" "alias to ``socket.socketpair`` on Python 3.5 and newer." msgstr "" -#: whatsnew/3.7.rst:2186 +#: whatsnew/3.7.rst:2190 msgid "" -":mod:`asyncio` no longer exports the :mod:`selectors` and :mod:`_overlapped` " -"modules as ``asyncio.selectors`` and ``asyncio._overlapped``. Replace ``from " -"asyncio import selectors`` with ``import selectors``." +":mod:`asyncio` no longer exports the :mod:`selectors` and :mod:`!" +"_overlapped` modules as ``asyncio.selectors`` and ``asyncio._overlapped``. " +"Replace ``from asyncio import selectors`` with ``import selectors``." msgstr "" -#: whatsnew/3.7.rst:2191 +#: whatsnew/3.7.rst:2195 msgid "" "Direct instantiation of :class:`ssl.SSLSocket` and :class:`ssl.SSLObject` " "objects is now prohibited. The constructors were never documented, tested, " -"or designed as public constructors. Users were supposed to use :func:`ssl." +"or designed as public constructors. Users were supposed to use :func:`!ssl." "wrap_socket` or :class:`ssl.SSLContext`. (Contributed by Christian Heimes " "in :issue:`32951`.)" msgstr "" -#: whatsnew/3.7.rst:2197 +#: whatsnew/3.7.rst:2201 msgid "" "The unused ``distutils`` ``install_misc`` command has been removed. " "(Contributed by Eric N. Vander Weele in :issue:`29218`.)" msgstr "" -#: whatsnew/3.7.rst:2202 +#: whatsnew/3.7.rst:2206 msgid "Module Removals" msgstr "" -#: whatsnew/3.7.rst:2204 +#: whatsnew/3.7.rst:2208 msgid "" "The ``fpectl`` module has been removed. It was never enabled by default, " "never worked correctly on x86-64, and it changed the Python ABI in ways that " @@ -3108,11 +3149,11 @@ msgid "" "Smith in :issue:`29137`.)" msgstr "" -#: whatsnew/3.7.rst:2487 +#: whatsnew/3.7.rst:2494 msgid "Windows-only Changes" msgstr "" -#: whatsnew/3.7.rst:2213 +#: whatsnew/3.7.rst:2217 msgid "" "The python launcher, (py.exe), can accept 32 & 64 bit specifiers **without** " "having to specify a minor version as well. So ``py -3-32`` and ``py -3-64`` " @@ -3122,7 +3163,7 @@ msgid "" "(Contributed by Steve Barnes in :issue:`30291`.)" msgstr "" -#: whatsnew/3.7.rst:2220 +#: whatsnew/3.7.rst:2224 msgid "" "The launcher can be run as ``py -0`` to produce a list of the installed " "pythons, *with default marked with an asterisk*. Running ``py -0p`` will " @@ -3131,28 +3172,28 @@ msgid "" "(Contributed by Steve Barnes in :issue:`30362`.)" msgstr "" -#: whatsnew/3.7.rst:2230 +#: whatsnew/3.7.rst:2234 msgid "Porting to Python 3.7" msgstr "" -#: whatsnew/3.7.rst:2232 +#: whatsnew/3.7.rst:2236 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: whatsnew/3.7.rst:2237 +#: whatsnew/3.7.rst:2241 msgid "Changes in Python Behavior" msgstr "" -#: whatsnew/3.7.rst:2239 +#: whatsnew/3.7.rst:2243 msgid "" ":keyword:`async` and :keyword:`await` names are now reserved keywords. Code " "using these names as identifiers will now raise a :exc:`SyntaxError`. " "(Contributed by Jelle Zijlstra in :issue:`30406`.)" msgstr "" -#: whatsnew/3.7.rst:2243 +#: whatsnew/3.7.rst:2247 msgid "" ":pep:`479` is enabled for all code in Python 3.7, meaning that :exc:" "`StopIteration` exceptions raised directly or indirectly in coroutines and " @@ -3160,19 +3201,27 @@ msgid "" "by Yury Selivanov in :issue:`32670`.)" msgstr "" -#: whatsnew/3.7.rst:2249 +#: whatsnew/3.7.rst:2253 msgid "" ":meth:`object.__aiter__` methods can no longer be declared as asynchronous. " "(Contributed by Yury Selivanov in :issue:`31709`.)" msgstr "" -#: whatsnew/3.7.rst:2252 +#: whatsnew/3.7.rst:2256 msgid "" "Due to an oversight, earlier Python versions erroneously accepted the " "following syntax::" msgstr "" -#: whatsnew/3.7.rst:2260 +#: whatsnew/3.7.rst:2259 +msgid "" +"f(1 for x in [1],)\n" +"\n" +"class C(1 for x in [1]):\n" +" pass" +msgstr "" + +#: whatsnew/3.7.rst:2264 msgid "" "Python 3.7 now correctly raises a :exc:`SyntaxError`, as a generator " "expression always needs to be directly inside a set of parentheses and " @@ -3181,7 +3230,7 @@ msgid "" "`32012` and :issue:`32023`.)" msgstr "" -#: whatsnew/3.7.rst:2266 +#: whatsnew/3.7.rst:2270 msgid "" "When using the :option:`-m` switch, the initial working directory is now " "added to :data:`sys.path`, rather than an empty string (which dynamically " @@ -3193,41 +3242,43 @@ msgid "" "place)." msgstr "" -#: whatsnew/3.7.rst:2276 +#: whatsnew/3.7.rst:2280 msgid "Changes in the Python API" msgstr "" -#: whatsnew/3.7.rst:2278 +#: whatsnew/3.7.rst:2282 msgid "" -":meth:`socketserver.ThreadingMixIn.server_close` now waits until all non-" -"daemon threads complete. Set the new :attr:`socketserver.ThreadingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31233` and :issue:`33540`.)" +":meth:`socketserver.ThreadingMixIn.server_close ` now waits until all non-daemon threads complete. Set the " +"new :attr:`socketserver.ThreadingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner in :" +"issue:`31233` and :issue:`33540`.)" msgstr "" -#: whatsnew/3.7.rst:2284 +#: whatsnew/3.7.rst:2289 msgid "" -":meth:`socketserver.ForkingMixIn.server_close` now waits until all child " -"processes complete. Set the new :attr:`socketserver.ForkingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " +":meth:`socketserver.ForkingMixIn.server_close ` now waits until all child processes complete. Set the new :" +"attr:`socketserver.ForkingMixIn.block_on_close ` class attribute to ``False`` to get the pre-3.7 behaviour. " "(Contributed by Victor Stinner in :issue:`31151` and :issue:`33540`.)" msgstr "" -#: whatsnew/3.7.rst:2290 +#: whatsnew/3.7.rst:2297 msgid "" "The :func:`locale.localeconv` function now temporarily sets the ``LC_CTYPE`` " "locale to the value of ``LC_NUMERIC`` in some cases. (Contributed by Victor " "Stinner in :issue:`31900`.)" msgstr "" -#: whatsnew/3.7.rst:2294 +#: whatsnew/3.7.rst:2301 msgid "" ":meth:`pkgutil.walk_packages` now raises a :exc:`ValueError` if *path* is a " "string. Previously an empty list was returned. (Contributed by Sanyam " "Khurana in :issue:`24744`.)" msgstr "" -#: whatsnew/3.7.rst:2298 +#: whatsnew/3.7.rst:2305 msgid "" "A format string argument for :meth:`string.Formatter.format` is now :ref:" "`positional-only `. Passing it as a keyword " @@ -3235,7 +3286,7 @@ msgid "" "issue:`29193`.)" msgstr "" -#: whatsnew/3.7.rst:2303 +#: whatsnew/3.7.rst:2310 msgid "" "Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel." "value` and :attr:`~http.cookies.Morsel.coded_value` of class :class:`http." @@ -3244,7 +3295,7 @@ msgid "" "them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" msgstr "" -#: whatsnew/3.7.rst:2311 +#: whatsnew/3.7.rst:2318 msgid "" "The *mode* argument of :func:`os.makedirs` no longer affects the file " "permission bits of newly created intermediate-level directories. To set " @@ -3252,41 +3303,41 @@ msgid "" "``makedirs()``. (Contributed by Serhiy Storchaka in :issue:`19930`.)" msgstr "" -#: whatsnew/3.7.rst:2317 +#: whatsnew/3.7.rst:2324 msgid "" "The :attr:`struct.Struct.format` type is now :class:`str` instead of :class:" "`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" msgstr "" -#: whatsnew/3.7.rst:2320 +#: whatsnew/3.7.rst:2327 msgid "" -":func:`~cgi.parse_multipart` now accepts the *encoding* and *errors* " +":func:`!cgi.parse_multipart` now accepts the *encoding* and *errors* " "arguments and returns the same results as :class:`!FieldStorage`: for non-" "file fields, the value associated to a key is a list of strings, not bytes. " "(Contributed by Pierre Quentel in :issue:`29979`.)" msgstr "" -#: whatsnew/3.7.rst:2326 +#: whatsnew/3.7.rst:2333 msgid "" "Due to internal changes in :mod:`socket`, calling :func:`socket.fromshare` " "on a socket created by :func:`socket.share ` in older " "Python versions is not supported." msgstr "" -#: whatsnew/3.7.rst:2330 +#: whatsnew/3.7.rst:2337 msgid "" "``repr`` for :exc:`BaseException` has changed to not include the trailing " "comma. Most exceptions are affected by this change. (Contributed by Serhiy " "Storchaka in :issue:`30399`.)" msgstr "" -#: whatsnew/3.7.rst:2334 +#: whatsnew/3.7.rst:2341 msgid "" "``repr`` for :class:`datetime.timedelta` has changed to include the keyword " "arguments in the output. (Contributed by Utkarsh Upadhyay in :issue:`30302`.)" msgstr "" -#: whatsnew/3.7.rst:2337 +#: whatsnew/3.7.rst:2344 msgid "" "Because :func:`shutil.rmtree` is now implemented using the :func:`os." "scandir` function, the user specified handler *onerror* is now called with " @@ -3294,7 +3345,7 @@ msgid "" "directory is failed." msgstr "" -#: whatsnew/3.7.rst:2342 +#: whatsnew/3.7.rst:2349 msgid "" "Support for nested sets and set operations in regular expressions as in " "`Unicode Technical Standard #18`_ might be added in the future. This would " @@ -3305,7 +3356,7 @@ msgid "" "with a backslash. (Contributed by Serhiy Storchaka in :issue:`30349`.)" msgstr "" -#: whatsnew/3.7.rst:2353 +#: whatsnew/3.7.rst:2360 msgid "" "The result of splitting a string on a :mod:`regular expression ` that " "could match an empty string has been changed. For example splitting on " @@ -3316,7 +3367,7 @@ msgid "" "patterns since Python 3.5." msgstr "" -#: whatsnew/3.7.rst:2362 +#: whatsnew/3.7.rst:2369 msgid "" "For patterns that match both empty and non-empty strings, the result of " "searching for all matches may also be changed in other cases. For example " @@ -3326,33 +3377,33 @@ msgid "" "as ``r'(?m)^[^\\S\\n]*$'``." msgstr "" -#: whatsnew/3.7.rst:2369 +#: whatsnew/3.7.rst:2376 msgid "" -":func:`re.sub()` now replaces empty matches adjacent to a previous non-empty " +":func:`re.sub` now replaces empty matches adjacent to a previous non-empty " "match. For example ``re.sub('x*', '-', 'abxd')`` returns now ``'-a-b--d-'`` " "instead of ``'-a-b-d-'`` (the first minus between 'b' and 'd' replaces 'x', " "and the second minus replaces an empty string between 'x' and 'd')." msgstr "" -#: whatsnew/3.7.rst:2375 +#: whatsnew/3.7.rst:2382 msgid "(Contributed by Serhiy Storchaka in :issue:`25054` and :issue:`32308`.)" msgstr "" -#: whatsnew/3.7.rst:2377 +#: whatsnew/3.7.rst:2384 msgid "" "Change :func:`re.escape` to only escape regex special characters instead of " "escaping all characters other than ASCII letters, numbers, and ``'_'``. " "(Contributed by Serhiy Storchaka in :issue:`29995`.)" msgstr "" -#: whatsnew/3.7.rst:2381 +#: whatsnew/3.7.rst:2388 msgid "" ":class:`tracemalloc.Traceback` frames are now sorted from oldest to most " "recent to be more consistent with :mod:`traceback`. (Contributed by Jesse " "Bakker in :issue:`32121`.)" msgstr "" -#: whatsnew/3.7.rst:2385 +#: whatsnew/3.7.rst:2392 msgid "" "On OSes that support :const:`socket.SOCK_NONBLOCK` or :const:`socket." "SOCK_CLOEXEC` bit flags, the :attr:`socket.type ` no " @@ -3361,7 +3412,7 @@ msgid "" "Selivanov in :issue:`32331`.)" msgstr "" -#: whatsnew/3.7.rst:2392 +#: whatsnew/3.7.rst:2399 msgid "" "On Windows the default for the *close_fds* argument of :class:`subprocess." "Popen` was changed from :const:`False` to :const:`True` when redirecting the " @@ -3371,7 +3422,7 @@ msgid "" "`STARTUPINFO.lpAttributeList `." msgstr "" -#: whatsnew/3.7.rst:2400 +#: whatsnew/3.7.rst:2407 msgid "" ":meth:`importlib.machinery.PathFinder.invalidate_caches` -- which implicitly " "affects :func:`importlib.invalidate_caches` -- now deletes entries in :data:" @@ -3379,7 +3430,7 @@ msgid "" "Cannon in :issue:`33169`.)" msgstr "" -#: whatsnew/3.7.rst:2405 +#: whatsnew/3.7.rst:2412 msgid "" "In :mod:`asyncio`, :meth:`loop.sock_recv() `, :meth:" "`loop.sock_sendall() `, :meth:`loop.sock_accept() " @@ -3390,21 +3441,21 @@ msgid "" "(Contributed by Yury Selivanov in :issue:`32327`.)" msgstr "" -#: whatsnew/3.7.rst:2416 +#: whatsnew/3.7.rst:2423 msgid "" ":attr:`asyncio.Server.sockets` now returns a copy of the internal list of " "server sockets, instead of returning it directly. (Contributed by Yury " "Selivanov in :issue:`32662`.)" msgstr "" -#: whatsnew/3.7.rst:2420 +#: whatsnew/3.7.rst:2427 msgid "" ":attr:`Struct.format ` is now a :class:`str` instance " "instead of a :class:`bytes` instance. (Contributed by Victor Stinner in :" "issue:`21071`.)" msgstr "" -#: whatsnew/3.7.rst:2424 +#: whatsnew/3.7.rst:2431 msgid "" ":mod:`argparse` subparsers can now be made mandatory by passing " "``required=True`` to :meth:`ArgumentParser.add_subparsers() ` will now " "consistently raise an exception when a date falls outside of the " @@ -3431,13 +3482,13 @@ msgid "" "date`. (Contributed by Alexander Belopolsky in :issue:`28292`.)" msgstr "" -#: whatsnew/3.7.rst:2442 +#: whatsnew/3.7.rst:2449 msgid "" ":class:`collections.ChainMap` now preserves the order of the underlying " "mappings. (Contributed by Raymond Hettinger in :issue:`32792`.)" msgstr "" -#: whatsnew/3.7.rst:2445 +#: whatsnew/3.7.rst:2452 msgid "" "The ``submit()`` method of :class:`concurrent.futures.ThreadPoolExecutor` " "and :class:`concurrent.futures.ProcessPoolExecutor` now raises a :exc:" @@ -3445,7 +3496,7 @@ msgid "" "Nemec in :issue:`33097`.)" msgstr "" -#: whatsnew/3.7.rst:2450 +#: whatsnew/3.7.rst:2457 msgid "" "The :class:`configparser.ConfigParser` constructor now uses ``read_dict()`` " "to process the default values, making its behavior consistent with the rest " @@ -3454,7 +3505,7 @@ msgid "" "in :issue:`23835`.)" msgstr "" -#: whatsnew/3.7.rst:2456 +#: whatsnew/3.7.rst:2463 msgid "" "Several undocumented internal imports were removed. One example is that ``os." "errno`` is no longer available; use ``import errno`` directly instead. Note " @@ -3462,11 +3513,11 @@ msgid "" "notice, even in micro version releases." msgstr "" -#: whatsnew/3.7.rst:2464 +#: whatsnew/3.7.rst:2471 msgid "Changes in the C API" msgstr "" -#: whatsnew/3.7.rst:2466 +#: whatsnew/3.7.rst:2473 msgid "" "The function :c:func:`PySlice_GetIndicesEx` is considered unsafe for " "resizable sequences. If the slice indices are not instances of :class:" @@ -3478,23 +3529,24 @@ msgid "" "Storchaka in :issue:`27867`.)" msgstr "" -#: whatsnew/3.7.rst:2477 +#: whatsnew/3.7.rst:2484 msgid "CPython bytecode changes" msgstr "" -#: whatsnew/3.7.rst:2479 +#: whatsnew/3.7.rst:2486 msgid "" -"There are two new opcodes: :opcode:`LOAD_METHOD` and :opcode:`CALL_METHOD`. " -"(Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)" +"There are two new opcodes: :opcode:`!LOAD_METHOD` and :opcode:`!" +"CALL_METHOD`. (Contributed by Yury Selivanov and INADA Naoki in :issue:" +"`26110`.)" msgstr "" -#: whatsnew/3.7.rst:2482 +#: whatsnew/3.7.rst:2489 msgid "" -"The :opcode:`STORE_ANNOTATION` opcode has been removed. (Contributed by Mark " -"Shannon in :issue:`32550`.)" +"The :opcode:`!STORE_ANNOTATION` opcode has been removed. (Contributed by " +"Mark Shannon in :issue:`32550`.)" msgstr "" -#: whatsnew/3.7.rst:2489 +#: whatsnew/3.7.rst:2496 msgid "" "The file used to override :data:`sys.path` is now called ``._pth`` instead of ``'sys.path'``. See :ref:" @@ -3502,11 +3554,11 @@ msgid "" "in :issue:`28137`.)" msgstr "" -#: whatsnew/3.7.rst:2496 +#: whatsnew/3.7.rst:2503 msgid "Other CPython implementation changes" msgstr "" -#: whatsnew/3.7.rst:2498 +#: whatsnew/3.7.rst:2505 msgid "" "In preparation for potential future changes to the public CPython runtime " "initialization API (see :pep:`432` for an initial, but somewhat outdated, " @@ -3521,21 +3573,21 @@ msgid "" "Stinner in a number of other issues). Some known details affected:" msgstr "" -#: whatsnew/3.7.rst:2511 +#: whatsnew/3.7.rst:2518 msgid "" -":c:func:`PySys_AddWarnOptionUnicode` is not currently usable by embedding " +":c:func:`!PySys_AddWarnOptionUnicode` is not currently usable by embedding " "applications due to the requirement to create a Unicode object prior to " -"calling ``Py_Initialize``. Use :c:func:`PySys_AddWarnOption` instead." +"calling ``Py_Initialize``. Use :c:func:`!PySys_AddWarnOption` instead." msgstr "" -#: whatsnew/3.7.rst:2515 +#: whatsnew/3.7.rst:2522 msgid "" -"warnings filters added by an embedding application with :c:func:" -"`PySys_AddWarnOption` should now more consistently take precedence over the " +"warnings filters added by an embedding application with :c:func:`!" +"PySys_AddWarnOption` should now more consistently take precedence over the " "default filters set by the interpreter" msgstr "" -#: whatsnew/3.7.rst:2519 +#: whatsnew/3.7.rst:2526 msgid "" "Due to changes in the way the default warnings filters are configured, " "setting :c:data:`Py_BytesWarningFlag` to a value greater than one is no " @@ -3545,7 +3597,7 @@ msgid "" "BytesWarning`` warnings filter added to convert them to exceptions." msgstr "" -#: whatsnew/3.7.rst:2526 +#: whatsnew/3.7.rst:2533 msgid "" "Due to a change in the way docstrings are handled by the compiler, the " "implicit ``return None`` in a function body consisting solely of a docstring " @@ -3553,7 +3605,7 @@ msgid "" "function's header line." msgstr "" -#: whatsnew/3.7.rst:2531 +#: whatsnew/3.7.rst:2538 msgid "" "The current exception state has been moved from the frame object to the co-" "routine. This simplified the interpreter and fixed a couple of obscure bugs " @@ -3561,11 +3613,11 @@ msgid "" "(Contributed by Mark Shannon in :issue:`25612`.)" msgstr "" -#: whatsnew/3.7.rst:2537 +#: whatsnew/3.7.rst:2544 msgid "Notable changes in Python 3.7.1" msgstr "" -#: whatsnew/3.7.rst:2539 +#: whatsnew/3.7.rst:2546 msgid "" "Starting in 3.7.1, :c:func:`Py_Initialize` now consistently reads and " "respects all of the same environment settings as :c:func:`Py_Main` (in " @@ -3575,14 +3627,14 @@ msgid "" "`Py_IgnoreEnvironmentFlag` to 1 before calling :c:func:`Py_Initialize`." msgstr "" -#: whatsnew/3.7.rst:2546 +#: whatsnew/3.7.rst:2553 msgid "" "In 3.7.1 the C API for Context Variables :ref:`was updated " "` to use :c:type:`PyObject` " "pointers. See also :issue:`34762`." msgstr "" -#: whatsnew/3.7.rst:2550 +#: whatsnew/3.7.rst:2557 msgid "" "In 3.7.1 the :mod:`tokenize` module now implicitly emits a ``NEWLINE`` token " "when provided with input that does not have a trailing new line. This " @@ -3590,11 +3642,11 @@ msgid "" "Ammar Askar in :issue:`33899`.)" msgstr "" -#: whatsnew/3.7.rst:2556 +#: whatsnew/3.7.rst:2563 msgid "Notable changes in Python 3.7.2" msgstr "" -#: whatsnew/3.7.rst:2558 +#: whatsnew/3.7.rst:2565 msgid "" "In 3.7.2, :mod:`venv` on Windows no longer copies the original binaries, but " "creates redirector scripts named ``python.exe`` and ``pythonw.exe`` instead. " @@ -3604,11 +3656,11 @@ msgid "" "to get the new scripts." msgstr "" -#: whatsnew/3.7.rst:2566 +#: whatsnew/3.7.rst:2573 msgid "Notable changes in Python 3.7.6" msgstr "" -#: whatsnew/3.7.rst:2568 +#: whatsnew/3.7.rst:2575 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " @@ -3618,27 +3670,27 @@ msgid "" "`37228`.)" msgstr "" -#: whatsnew/3.7.rst:2576 +#: whatsnew/3.7.rst:2583 msgid "Notable changes in Python 3.7.10" msgstr "" -#: whatsnew/3.7.rst:2578 +#: whatsnew/3.7.rst:2585 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" -#: whatsnew/3.7.rst:2589 +#: whatsnew/3.7.rst:2596 msgid "Notable changes in Python 3.7.11" msgstr "" -#: whatsnew/3.7.rst:2591 +#: whatsnew/3.7.rst:2598 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -3647,7 +3699,7 @@ msgid "" "instance to ``True``. (See :gh:`87451`)" msgstr "" -#: whatsnew/3.7.rst:2598 +#: whatsnew/3.7.rst:2605 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates RFC 3986, " @@ -3657,20 +3709,19 @@ msgid "" "parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" -#: whatsnew/3.7.rst:2606 +#: whatsnew/3.7.rst:2613 msgid "Notable security feature in 3.7.14" msgstr "" -#: whatsnew/3.7.rst:2608 +#: whatsnew/3.7.rst:2615 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " "now raises a :exc:`ValueError` if the number of digits in string form is " "above a limit to avoid potential denial of service attacks due to the " -"algorithmic complexity. This is a mitigation for `CVE-2020-10735 `_. This limit can be " -"configured or disabled by environment variable, command line flag, or :mod:" -"`sys` APIs. See the :ref:`integer string conversion length limitation " -"` documentation. The default limit is 4300 digits in " -"string form." +"algorithmic complexity. This is a mitigation for :cve:`2020-10735`. This " +"limit can be configured or disabled by environment variable, command line " +"flag, or :mod:`sys` APIs. See the :ref:`integer string conversion length " +"limitation ` documentation. The default limit is 4300 " +"digits in string form." msgstr "" diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index 2491a52b..bbf4559e 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -61,6 +62,12 @@ msgid "" "twice::" msgstr "" +#: whatsnew/3.8.rst:85 +msgid "" +"if (n := len(a)) > 10:\n" +" print(f\"List is too long ({n} elements, expected <= 10)\")" +msgstr "" + #: whatsnew/3.8.rst:88 msgid "" "A similar benefit arises during regular expression matching where match " @@ -68,6 +75,13 @@ msgid "" "to extract a subgroup::" msgstr "" +#: whatsnew/3.8.rst:92 +msgid "" +"discount = 0.0\n" +"if (mo := re.search(r'(\\d+)% discount', advertisement)):\n" +" discount = float(mo.group(1)) / 100.0" +msgstr "" + #: whatsnew/3.8.rst:96 msgid "" "The operator is also useful with while-loops that compute a value to test " @@ -75,12 +89,25 @@ msgid "" "loop::" msgstr "" +#: whatsnew/3.8.rst:100 +msgid "" +"# Loop over fixed length blocks\n" +"while (block := f.read(256)) != '':\n" +" process(block)" +msgstr "" + #: whatsnew/3.8.rst:104 msgid "" "Another motivating use case arises in list comprehensions where a value " "computed in a filtering condition is also needed in the expression body::" msgstr "" +#: whatsnew/3.8.rst:108 +msgid "" +"[clean_name.title() for name in names\n" +" if (clean_name := normalize('NFC', name)) in allowed_names]" +msgstr "" + #: whatsnew/3.8.rst:111 msgid "" "Try to limit use of the walrus operator to clean cases that reduce " @@ -115,14 +142,30 @@ msgid "" "keywords::" msgstr "" +#: whatsnew/3.8.rst:132 +msgid "" +"def f(a, b, /, c, d, *, e, f):\n" +" print(a, b, c, d, e, f)" +msgstr "" + #: whatsnew/3.8.rst:135 msgid "The following is a valid call::" msgstr "" +#: whatsnew/3.8.rst:137 +msgid "f(10, 20, 30, d=40, e=50, f=60)" +msgstr "" + #: whatsnew/3.8.rst:139 msgid "However, these are invalid calls::" msgstr "" +#: whatsnew/3.8.rst:141 +msgid "" +"f(10, b=20, c=30, d=40, e=50, f=60) # b cannot be a keyword argument\n" +"f(10, 20, 30, 40, 50, f=60) # e must be a keyword argument" +msgstr "" + #: whatsnew/3.8.rst:144 msgid "" "One use case for this notation is that it allows pure Python functions to " @@ -130,6 +173,13 @@ msgid "" "built-in :func:`divmod` function does not accept keyword arguments::" msgstr "" +#: whatsnew/3.8.rst:148 +msgid "" +"def divmod(a, b, /):\n" +" \"Emulate the built in divmod() function\"\n" +" return (a // b, a % b)" +msgstr "" + #: whatsnew/3.8.rst:152 msgid "" "Another use case is to preclude keyword arguments when the parameter name is " @@ -137,6 +187,10 @@ msgid "" "signature ``len(obj, /)``. This precludes awkward calls such as::" msgstr "" +#: whatsnew/3.8.rst:156 +msgid "len(obj='hello') # The \"obj\" keyword argument impairs readability" +msgstr "" + #: whatsnew/3.8.rst:158 msgid "" "A further benefit of marking a parameter as positional-only is that it " @@ -146,12 +200,27 @@ msgid "" "with the following function specification::" msgstr "" +#: whatsnew/3.8.rst:164 +msgid "" +"def quantiles(dist, /, *, n=4, method='exclusive')\n" +" ..." +msgstr "" + #: whatsnew/3.8.rst:167 msgid "" "Since the parameters to the left of ``/`` are not exposed as possible " "keywords, the parameters names remain available for use in ``**kwargs``::" msgstr "" +#: whatsnew/3.8.rst:170 +msgid "" +">>> def f(a, b, /, **kwargs):\n" +"... print(a, b, kwargs)\n" +"...\n" +">>> f(10, 20, a=1, b=2, c=3) # a and b are used in two ways\n" +"10 20 {'a': 1, 'b': 2, 'c': 3}" +msgstr "" + #: whatsnew/3.8.rst:176 msgid "" "This greatly simplifies the implementation of functions and methods that " @@ -159,6 +228,14 @@ msgid "" "from code in the :mod:`collections` module::" msgstr "" +#: whatsnew/3.8.rst:180 +msgid "" +"class Counter(dict):\n" +"\n" +" def __init__(self, iterable=None, /, **kwds):\n" +" # Note \"iterable\" is a possible keyword argument" +msgstr "" + #: whatsnew/3.8.rst:185 msgid "See :pep:`570` for a full description." msgstr "" @@ -271,12 +348,25 @@ msgid "" "over how the result of the expression is displayed::" msgstr "" +#: whatsnew/3.8.rst:270 +msgid "" +">>> delta = date.today() - member_since\n" +">>> f'{user=!s} {delta.days=:,d}'\n" +"'user=eric_idle delta.days=16,075'" +msgstr "" + #: whatsnew/3.8.rst:274 msgid "" "The ``=`` specifier will display the whole expression so that calculations " "can be shown::" msgstr "" +#: whatsnew/3.8.rst:277 +msgid "" +">>> print(f'{theta=} {cos(radians(theta))=:.3f}')\n" +"theta=30 cos(radians(theta))=0.866" +msgstr "" + #: whatsnew/3.8.rst:280 msgid "(Contributed by Eric V. Smith and Larry Hastings in :issue:`36817`.)" msgstr "" @@ -550,6 +640,14 @@ msgid "" "expressions `::" msgstr "" +#: whatsnew/3.8.rst:409 +msgid "" +">>> notice = 'Copyright © 2019'\n" +">>> copyright_year_pattern = re.compile(r'\\N{copyright sign}\\s*(\\d{4})')\n" +">>> int(copyright_year_pattern.search(notice).group(1))\n" +"2019" +msgstr "" + #: whatsnew/3.8.rst:414 msgid "" "(Contributed by Jonathan Eunice and Serhiy Storchaka in :issue:`30688`.)" @@ -577,6 +675,16 @@ msgid "" "and *return* syntax into better agreement with normal assignment syntax::" msgstr "" +#: whatsnew/3.8.rst:430 +msgid "" +">>> def parse(family):\n" +"... lastname, *members = family.split()\n" +"... return lastname.upper(), *members\n" +"...\n" +">>> parse('simpsons homer marge bart lisa maggie')\n" +"('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')" +msgstr "" + #: whatsnew/3.8.rst:437 msgid "(Contributed by David Cuthbert and Jordan Chapman in :issue:`32117`.)" msgstr "" @@ -625,6 +733,19 @@ msgid "" "prevent the *data* parameter from being used as a keyword argument::" msgstr "" +#: whatsnew/3.8.rst:470 +msgid "" +">>> from statistics import mean\n" +">>> mean(data=[10, 20, 90])\n" +"40\n" +">>> mean.__code__ = mean.__code__.replace(co_posonlyargcount=1)\n" +">>> mean(data=[10, 20, 90])\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: mean() got some positional-only arguments passed as keyword " +"arguments: 'data'" +msgstr "" + #: whatsnew/3.8.rst:479 msgid "(Contributed by Victor Stinner in :issue:`37032`.)" msgstr "" @@ -640,6 +761,14 @@ msgid "" "38 modulo 137, write::" msgstr "" +#: whatsnew/3.8.rst:490 +msgid "" +">>> pow(38, -1, 137)\n" +"119\n" +">>> 119 * 38 % 137\n" +"1" +msgstr "" + #: whatsnew/3.8.rst:495 msgid "" "Modular inverses arise in the solution of `linear Diophantine equations " @@ -658,6 +787,21 @@ msgid "" "is computed first and the value second::" msgstr "" +#: whatsnew/3.8.rst:510 +msgid "" +">>> # Dict comprehension\n" +">>> cast = {input('role? '): input('actor? ') for i in range(2)}\n" +"role? King Arthur\n" +"actor? Chapman\n" +"role? Black Knight\n" +"actor? Cleese\n" +"\n" +">>> # Dict literal\n" +">>> cast = {input('role? '): input('actor? ')}\n" +"role? Sir Robin\n" +"actor? Eric Idle" +msgstr "" + #: whatsnew/3.8.rst:522 msgid "" "The guaranteed execution order is helpful with assignment expressions " @@ -665,6 +809,15 @@ msgid "" "value expression::" msgstr "" +#: whatsnew/3.8.rst:526 +msgid "" +">>> names = ['Martin von Löwis', 'Łukasz Langa', 'Walter Dörwald']\n" +">>> {(n := normalize('NFC', name)).casefold() : n for name in names}\n" +"{'martin von löwis': 'Martin von Löwis',\n" +" 'łukasz langa': 'Łukasz Langa',\n" +" 'walter dörwald': 'Walter Dörwald'}" +msgstr "" + #: whatsnew/3.8.rst:532 msgid "(Contributed by Jörn Heissler in :issue:`35224`.)" msgstr "" @@ -676,8 +829,8 @@ msgid "" "element is a callable with a ``(obj, state)`` signature. This allows the " "direct control over the state-updating behavior of a specific object. If " "not *None*, this callable will have priority over the object's :meth:" -"`~__setstate__` method. (Contributed by Pierre Glaser and Olivier Grisel in :" -"issue:`35900`.)" +"`~object.__setstate__` method. (Contributed by Pierre Glaser and Olivier " +"Grisel in :issue:`35900`.)" msgstr "" #: whatsnew/3.8.rst:543 @@ -691,6 +844,24 @@ msgid "" "installed package's version number, list of entry points, and more::" msgstr "" +#: whatsnew/3.8.rst:549 +msgid "" +">>> # Note following example requires that the popular \"requests\"\n" +">>> # package has been installed.\n" +">>>\n" +">>> from importlib.metadata import version, requires, files\n" +">>> version('requests')\n" +"'2.22.0'\n" +">>> list(requires('requests'))\n" +"['chardet (<3.1.0,>=3.0.2)']\n" +">>> list(files('requests'))[:5]\n" +"[PackagePath('requests-2.22.0.dist-info/INSTALLER'),\n" +" PackagePath('requests-2.22.0.dist-info/LICENSE'),\n" +" PackagePath('requests-2.22.0.dist-info/METADATA'),\n" +" PackagePath('requests-2.22.0.dist-info/RECORD'),\n" +" PackagePath('requests-2.22.0.dist-info/WHEEL')]" +msgstr "" + #: whatsnew/3.8.rst:564 msgid "(Contributed by Barry Warsaw and Jason R. Coombs in :issue:`34632`.)" msgstr "" @@ -758,10 +929,38 @@ msgid "" "while automatically managing the event loop. For example::" msgstr "" +#: whatsnew/3.8.rst:604 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" await asyncio.sleep(0)\n" +" return 42\n" +"\n" +"asyncio.run(main())" +msgstr "" + #: whatsnew/3.8.rst:612 msgid "This is *roughly* equivalent to::" msgstr "" +#: whatsnew/3.8.rst:614 +msgid "" +"import asyncio\n" +"\n" +"async def main():\n" +" await asyncio.sleep(0)\n" +" return 42\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"asyncio.set_event_loop(loop)\n" +"try:\n" +" loop.run_until_complete(main())\n" +"finally:\n" +" asyncio.set_event_loop(None)\n" +" loop.close()" +msgstr "" + #: whatsnew/3.8.rst:629 msgid "" "The actual implementation is significantly more complex. Thus, :func:" @@ -780,11 +979,23 @@ msgid "" "spawn a new event loop on every invocation:" msgstr "" +#: whatsnew/3.8.rst:639 +msgid "" +"$ python -m asyncio\n" +"asyncio REPL 3.8.0\n" +"Use \"await\" directly instead of \"asyncio.run()\".\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>> import asyncio\n" +">>> await asyncio.sleep(10, result='hello')\n" +"hello" +msgstr "" + #: whatsnew/3.8.rst:649 msgid "(Contributed by Yury Selivanov in :issue:`37028`.)" msgstr "" -#: whatsnew/3.8.rst:1970 +#: whatsnew/3.8.rst:1973 msgid "" "The exception :class:`asyncio.CancelledError` now inherits from :class:" "`BaseException` rather than :class:`Exception` and no longer inherits from :" @@ -877,6 +1088,15 @@ msgid "" "context manager. Profile a block of code by running::" msgstr "" +#: whatsnew/3.8.rst:716 +msgid "" +"import cProfile\n" +"\n" +"with cProfile.Profile() as profiler:\n" +" # code to be profiled\n" +" ..." +msgstr "" + #: whatsnew/3.8.rst:722 msgid "(Contributed by Scott Sanderson in :issue:`29235`.)" msgstr "" @@ -942,6 +1162,17 @@ msgid "" "supported::" msgstr "" +#: whatsnew/3.8.rst:769 +msgid "" +"@lru_cache\n" +"def f(x):\n" +" ...\n" +"\n" +"@lru_cache(maxsize=256)\n" +"def f(x):\n" +" ..." +msgstr "" + #: whatsnew/3.8.rst:777 msgid "(Contributed by Raymond Hettinger in :issue:`36772`.)" msgstr "" @@ -952,6 +1183,20 @@ msgid "" "properties cached for the life of the instance. ::" msgstr "" +#: whatsnew/3.8.rst:782 +msgid "" +"import functools\n" +"import statistics\n" +"\n" +"class Dataset:\n" +" def __init__(self, sequence_of_numbers):\n" +" self.data = sequence_of_numbers\n" +"\n" +" @functools.cached_property\n" +" def variance(self):\n" +" return statistics.variance(self.data)" +msgstr "" + #: whatsnew/3.8.rst:793 msgid "(Contributed by Carl Meyer in :issue:`21145`)" msgstr "" @@ -963,6 +1208,27 @@ msgid "" "`single dispatch`::" msgstr "" +#: whatsnew/3.8.rst:800 +msgid "" +"from functools import singledispatchmethod\n" +"from contextlib import suppress\n" +"\n" +"class TaskManager:\n" +"\n" +" def __init__(self, tasks):\n" +" self.tasks = list(tasks)\n" +"\n" +" @singledispatchmethod\n" +" def discard(self, value):\n" +" with suppress(ValueError):\n" +" self.tasks.remove(value)\n" +"\n" +" @discard.register(list)\n" +" def _(self, tasks):\n" +" targets = set(tasks)\n" +" self.tasks = [x for x in self.tasks if x not in targets]" +msgstr "" + #: whatsnew/3.8.rst:818 msgid "(Contributed by Ethan Smith in :issue:`32380`)" msgstr "" @@ -1085,6 +1351,16 @@ msgid "" "have for :func:`property`, :func:`classmethod`, and :func:`staticmethod`::" msgstr "" +#: whatsnew/3.8.rst:897 +msgid "" +"class AudioClip:\n" +" __slots__ = {'bit_rate': 'expressed in kilohertz to one decimal place',\n" +" 'duration': 'in seconds, rounded up to an integer'}\n" +" def __init__(self, bit_rate, duration):\n" +" self.bit_rate = round(bit_rate / 1000.0, 1)\n" +" self.duration = ceil(duration)" +msgstr "" + #: whatsnew/3.8.rst:904 msgid "(Contributed by Raymond Hettinger in :issue:`36326`.)" msgstr "" @@ -1111,6 +1387,13 @@ msgid "" "argument to specify an initial value::" msgstr "" +#: whatsnew/3.8.rst:922 +msgid "" +">>> from itertools import accumulate\n" +">>> list(accumulate([10, 5, 30, 15], initial=1000))\n" +"[1000, 1010, 1015, 1045, 1060]" +msgstr "" + #: whatsnew/3.8.rst:926 msgid "(Contributed by Lisa Roach in :issue:`34659`.)" msgstr "" @@ -1131,8 +1414,8 @@ msgstr "" #: whatsnew/3.8.rst:939 msgid "" -"Added a *force* keyword argument to :func:`logging.basicConfig()` When set " -"to true, any existing handlers attached to the root logger are removed and " +"Added a *force* keyword argument to :func:`logging.basicConfig`. When set to " +"true, any existing handlers attached to the root logger are removed and " "closed before carrying out the configuration specified by the other " "arguments." msgstr "" @@ -1175,6 +1458,14 @@ msgid "" "of numbers::" msgstr "" +#: whatsnew/3.8.rst:968 +msgid "" +">>> prior = 0.8\n" +">>> likelihoods = [0.625, 0.84, 0.30]\n" +">>> math.prod(likelihoods, start=prior)\n" +"0.126" +msgstr "" + #: whatsnew/3.8.rst:973 msgid "(Contributed by Pablo Galindo in :issue:`35606`.)" msgstr "" @@ -1185,6 +1476,14 @@ msgid "" "comb`::" msgstr "" +#: whatsnew/3.8.rst:977 +msgid "" +">>> math.perm(10, 3) # Permutations of 10 things taken 3 at a time\n" +"720\n" +">>> math.comb(10, 3) # Combinations of 10 things taken 3 at a time\n" +"120" +msgstr "" + #: whatsnew/3.8.rst:982 msgid "" "(Contributed by Yash Aggarwal, Keller Fuchs, Serhiy Storchaka, and Raymond " @@ -1199,6 +1498,16 @@ msgid "" "but slower than :func:`math.sqrt`::" msgstr "" +#: whatsnew/3.8.rst:990 +msgid "" +">>> r = 650320427\n" +">>> s = r ** 2\n" +">>> isqrt(s - 1) # correct\n" +"650320426\n" +">>> floor(sqrt(s - 1)) # incorrect\n" +"650320427" +msgstr "" + #: whatsnew/3.8.rst:997 msgid "(Contributed by Mark Dickinson in :issue:`36887`.)" msgstr "" @@ -1262,9 +1571,9 @@ msgid "" "system. Specifically, :func:`os.stat` will now traverse anything supported " "by the operating system, while :func:`os.lstat` will only open reparse " "points that identify as \"name surrogates\" while others are opened as for :" -"func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only have " +"func:`os.stat`. In all cases, :attr:`os.stat_result.st_mode` will only have " "``S_IFLNK`` set for symbolic links and not other kinds of reparse points. To " -"identify other kinds of reparse point, check the new :attr:`stat_result." +"identify other kinds of reparse point, check the new :attr:`os.stat_result." "st_reparse_tag` attribute." msgstr "" @@ -1296,7 +1605,7 @@ msgid "" "Storchaka in :issue:`33721`.)" msgstr "" -#: whatsnew/3.8.rst:1965 +#: whatsnew/3.8.rst:1968 msgid "" ":func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE` " "environment variable and does not use :envvar:`HOME`, which is not normally " @@ -1323,20 +1632,19 @@ msgstr "" #: whatsnew/3.8.rst:1079 msgid "" ":mod:`pathlib.Path` methods that return a boolean result like :meth:" -"`~pathlib.Path.exists()`, :meth:`~pathlib.Path.is_dir()`, :meth:`~pathlib." -"Path.is_file()`, :meth:`~pathlib.Path.is_mount()`, :meth:`~pathlib.Path." -"is_symlink()`, :meth:`~pathlib.Path.is_block_device()`, :meth:`~pathlib.Path." -"is_char_device()`, :meth:`~pathlib.Path.is_fifo()`, :meth:`~pathlib.Path." -"is_socket()` now return ``False`` instead of raising :exc:`ValueError` or " -"its subclass :exc:`UnicodeEncodeError` for paths that contain characters " -"unrepresentable at the OS level. (Contributed by Serhiy Storchaka in :issue:" -"`33721`.)" +"`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path." +"is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :" +"meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :" +"meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` now return " +"``False`` instead of raising :exc:`ValueError` or its subclass :exc:" +"`UnicodeEncodeError` for paths that contain characters unrepresentable at " +"the OS level. (Contributed by Serhiy Storchaka in :issue:`33721`.)" msgstr "" #: whatsnew/3.8.rst:1089 msgid "" -"Added :meth:`!pathlib.Path.link_to()` which creates a hard link pointing to " -"a path. (Contributed by Joannah Nanjekye in :issue:`26978`) Note that " +"Added :meth:`!pathlib.Path.link_to` which creates a hard link pointing to a " +"path. (Contributed by Joannah Nanjekye in :issue:`26978`) Note that " "``link_to`` was deprecated in 3.10 and removed in 3.12 in favor of a " "``hardlink_to`` method added in 3.10 which matches the semantics of the " "existing ``symlink_to`` method." @@ -1384,6 +1692,21 @@ msgid "" "like :func:`pprint.pprint` but with *sort_dicts* defaulting to ``False``::" msgstr "" +#: whatsnew/3.8.rst:1126 +msgid "" +">>> from pprint import pprint, pp\n" +">>> d = dict(source='input.txt', operation='filter', destination='output." +"txt')\n" +">>> pp(d, width=40) # Original order\n" +"{'source': 'input.txt',\n" +" 'operation': 'filter',\n" +" 'destination': 'output.txt'}\n" +">>> pprint(d, width=40) # Keys sorted alphabetically\n" +"{'destination': 'output.txt',\n" +" 'operation': 'filter',\n" +" 'source': 'input.txt'}" +msgstr "" + #: whatsnew/3.8.rst:1137 msgid "(Contributed by Rémi Lapeyre in :issue:`30670`.)" msgstr "" @@ -1439,17 +1762,16 @@ msgstr "" #: whatsnew/3.8.rst:1173 msgid "" -"Added :meth:`~socket.create_server()` and :meth:`~socket." -"has_dualstack_ipv6()` convenience functions to automate the necessary tasks " -"usually involved when creating a server socket, including accepting both " -"IPv4 and IPv6 connections on the same socket. (Contributed by Giampaolo " -"Rodolà in :issue:`17561`.)" +"Added :meth:`~socket.create_server` and :meth:`~socket.has_dualstack_ipv6` " +"convenience functions to automate the necessary tasks usually involved when " +"creating a server socket, including accepting both IPv4 and IPv6 connections " +"on the same socket. (Contributed by Giampaolo Rodolà in :issue:`17561`.)" msgstr "" #: whatsnew/3.8.rst:1178 msgid "" -"The :func:`socket.if_nameindex()`, :func:`socket.if_nametoindex()`, and :" -"func:`socket.if_indextoname()` functions have been implemented on Windows. " +"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, and :func:" +"`socket.if_indextoname` functions have been implemented on Windows. " "(Contributed by Zackery Spytz in :issue:`37007`.)" msgstr "" @@ -1470,14 +1792,14 @@ msgstr "" #: whatsnew/3.8.rst:1195 msgid "" -"Added :func:`statistics.fmean` as a faster, floating point variant of :func:" -"`statistics.mean()`. (Contributed by Raymond Hettinger and Steven D'Aprano " +"Added :func:`statistics.fmean` as a faster, floating-point variant of :func:" +"`statistics.mean`. (Contributed by Raymond Hettinger and Steven D'Aprano " "in :issue:`35904`.)" msgstr "" #: whatsnew/3.8.rst:1199 msgid "" -"Added :func:`statistics.geometric_mean()` (Contributed by Raymond Hettinger " +"Added :func:`statistics.geometric_mean` (Contributed by Raymond Hettinger " "in :issue:`27181`.)" msgstr "" @@ -1501,6 +1823,31 @@ msgid "" "in :issue:`36018`.)" msgstr "" +#: whatsnew/3.8.rst:1215 +msgid "" +">>> temperature_feb = NormalDist.from_samples([4, 12, -3, 2, 7, 14])\n" +">>> temperature_feb.mean\n" +"6.0\n" +">>> temperature_feb.stdev\n" +"6.356099432828281\n" +"\n" +">>> temperature_feb.cdf(3) # Chance of being under 3 degrees\n" +"0.3184678262814532\n" +">>> # Relative chance of being 7 degrees versus 10 degrees\n" +">>> temperature_feb.pdf(7) / temperature_feb.pdf(10)\n" +"1.2039930378537762\n" +"\n" +">>> el_niño = NormalDist(4, 2.5)\n" +">>> temperature_feb += el_niño # Add in a climate effect\n" +">>> temperature_feb\n" +"NormalDist(mu=10.0, sigma=6.830080526611674)\n" +"\n" +">>> temperature_feb * (9/5) + 32 # Convert to Fahrenheit\n" +"NormalDist(mu=50.0, sigma=12.294144947901014)\n" +">>> temperature_feb.samples(3) # Generate random samples\n" +"[7.672102882379219, 12.000027119750287, 4.647488369766392]" +msgstr "" + #: whatsnew/3.8.rst:1239 msgid "sys" msgstr "" @@ -1514,7 +1861,7 @@ msgid "" "(:func:`gc.collect`). (Contributed by Victor Stinner in :issue:`36829`.)" msgstr "" -#: whatsnew/3.8.rst:2351 +#: whatsnew/3.8.rst:2353 msgid "tarfile" msgstr "" @@ -1567,23 +1914,22 @@ msgstr "" #: whatsnew/3.8.rst:1288 msgid "" -"Added methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter." -"Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` and :" -"meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` class. " -"(Contributed by Juliette Monsel in :issue:`34829`.)" +"Added methods :meth:`!selection_from`, :meth:`!selection_present`, :meth:`!" +"selection_range` and :meth:`!selection_to` in the :class:`!tkinter.Spinbox` " +"class. (Contributed by Juliette Monsel in :issue:`34829`.)" msgstr "" #: whatsnew/3.8.rst:1295 msgid "" -"Added method :meth:`~tkinter.Canvas.moveto` in the :class:`tkinter.Canvas` " -"class. (Contributed by Juliette Monsel in :issue:`23831`.)" +"Added method :meth:`!moveto` in the :class:`!tkinter.Canvas` class. " +"(Contributed by Juliette Monsel in :issue:`23831`.)" msgstr "" #: whatsnew/3.8.rst:1299 msgid "" -"The :class:`tkinter.PhotoImage` class now has :meth:`~tkinter.PhotoImage." -"transparency_get` and :meth:`~tkinter.PhotoImage.transparency_set` methods. " -"(Contributed by Zackery Spytz in :issue:`25451`.)" +"The :class:`!tkinter.PhotoImage` class now has :meth:`!transparency_get` " +"and :meth:`!transparency_set` methods. (Contributed by Zackery Spytz in :" +"issue:`25451`.)" msgstr "" #: whatsnew/3.8.rst:1306 @@ -1612,6 +1958,14 @@ msgid "" "optional::" msgstr "" +#: whatsnew/3.8.rst:1322 +msgid "" +"class Location(TypedDict, total=False):\n" +" lat_long: tuple\n" +" grid_square: str\n" +" xy_coordinate: tuple" +msgstr "" + #: whatsnew/3.8.rst:1327 msgid "" "Literal types. See :pep:`586` and :class:`typing.Literal`. Literal types " @@ -1619,6 +1973,12 @@ msgid "" "specific literal values::" msgstr "" +#: whatsnew/3.8.rst:1331 +msgid "" +"def get_status(port: int) -> Literal['connected', 'disconnected']:\n" +" ..." +msgstr "" + #: whatsnew/3.8.rst:1334 msgid "" "\"Final\" variables, functions, methods and classes. See :pep:`591`, :class:" @@ -1626,6 +1986,10 @@ msgid "" "static type checker to restrict subclassing, overriding, or reassignment::" msgstr "" +#: whatsnew/3.8.rst:1339 +msgid "pi: Final[float] = 3.1415926536" +msgstr "" + #: whatsnew/3.8.rst:1341 msgid "" "Protocol definitions. See :pep:`544`, :class:`typing.Protocol` and :func:" @@ -1673,10 +2037,10 @@ msgstr "" #: whatsnew/3.8.rst:1370 msgid "" -"Added :func:`~unittest.addModuleCleanup()` and :meth:`~unittest.TestCase." -"addClassCleanup()` to unittest to support cleanups for :func:`~unittest." -"setUpModule()` and :meth:`~unittest.TestCase.setUpClass()`. (Contributed by " -"Lisa Roach in :issue:`24412`.)" +"Added :func:`~unittest.addModuleCleanup` and :meth:`~unittest.TestCase." +"addClassCleanup` to unittest to support cleanups for :func:`~unittest." +"setUpModule` and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa " +"Roach in :issue:`24412`.)" msgstr "" #: whatsnew/3.8.rst:1376 @@ -1696,6 +2060,28 @@ msgstr "" msgid "Example::" msgstr "" +#: whatsnew/3.8.rst:1385 +msgid "" +"import unittest\n" +"\n" +"\n" +"class TestRequest(unittest.IsolatedAsyncioTestCase):\n" +"\n" +" async def asyncSetUp(self):\n" +" self.connection = await AsyncConnection()\n" +"\n" +" async def test_get(self):\n" +" response = await self.connection.get(\"https://example.com\")\n" +" self.assertEqual(response.status_code, 200)\n" +"\n" +" async def asyncTearDown(self):\n" +" await self.connection.close()\n" +"\n" +"\n" +"if __name__ == \"__main__\":\n" +" unittest.main()" +msgstr "" + #: whatsnew/3.8.rst:1406 msgid "venv" msgstr "" @@ -1739,8 +2125,8 @@ msgstr "" #: whatsnew/3.8.rst:1434 msgid "" -"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–xml." -"etree.ElementTree.canonicalize()` that implements C14N 2.0. (Contributed by " +"The :mod:`xml.etree.ElementTree` module provides a new function :func:`~xml." +"etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed by " "Stefan Behnel in :issue:`13611`.)" msgstr "" @@ -1972,7 +2358,7 @@ msgid ":c:func:`Py_XINCREF`, :c:func:`Py_XDECREF`" msgstr "" #: whatsnew/3.8.rst:1576 -msgid ":c:func:`PyObject_INIT`, :c:func:`PyObject_INIT_VAR`" +msgid ":c:macro:`!PyObject_INIT`, :c:macro:`!PyObject_INIT_VAR`" msgstr "" #: whatsnew/3.8.rst:1577 @@ -2130,7 +2516,7 @@ msgstr "" #: whatsnew/3.8.rst:1680 msgid "" -"The :func:`asyncio.coroutine` :term:`decorator` is deprecated and will be " +"The :deco:`!asyncio.coroutine` :term:`decorator` is deprecated and will be " "removed in version 3.10. Instead of ``@asyncio.coroutine``, use :keyword:" "`async def` instead. (Contributed by Andrew Svetlov in :issue:`36921`.)" msgstr "" @@ -2157,28 +2543,28 @@ msgstr "" #: whatsnew/3.8.rst:1699 msgid "" "The following functions and methods are deprecated in the :mod:`gettext` " -"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:" -"`~gettext.lngettext` and :func:`~gettext.ldngettext`. They return encoded " -"bytes, and it's possible that you will get unexpected Unicode-related " -"exceptions if there are encoding problems with the translated strings. It's " -"much better to use alternatives which return Unicode strings in Python 3. " -"These functions have been broken for a long time." +"module: :func:`!lgettext`, :func:`!ldgettext`, :func:`!lngettext` and :func:" +"`!ldngettext`. They return encoded bytes, and it's possible that you will " +"get unexpected Unicode-related exceptions if there are encoding problems " +"with the translated strings. It's much better to use alternatives which " +"return Unicode strings in Python 3. These functions have been broken for a " +"long time." msgstr "" #: whatsnew/3.8.rst:1707 msgid "" -"Function :func:`~gettext.bind_textdomain_codeset`, methods :meth:`~gettext." -"NullTranslations.output_charset` and :meth:`~gettext.NullTranslations." -"set_output_charset`, and the *codeset* parameter of functions :func:" -"`~gettext.translation` and :func:`~gettext.install` are also deprecated, " -"since they are only used for the ``l*gettext()`` functions. (Contributed by " -"Serhiy Storchaka in :issue:`33710`.)" +"Function :func:`!bind_textdomain_codeset`, methods :meth:`!NullTranslations." +"output_charset` and :meth:`!NullTranslations.set_output_charset`, and the " +"*codeset* parameter of functions :func:`~gettext.translation` and :func:" +"`~gettext.install` are also deprecated, since they are only used for the " +"``l*gettext()`` functions. (Contributed by Serhiy Storchaka in :issue:" +"`33710`.)" msgstr "" #: whatsnew/3.8.rst:1715 msgid "" -"The :meth:`~threading.Thread.isAlive()` method of :class:`threading.Thread` " -"has been deprecated. (Contributed by Donghee Na in :issue:`35283`.)" +"The :meth:`!isAlive` method of :class:`threading.Thread` has been " +"deprecated. (Contributed by Donghee Na in :issue:`35283`.)" msgstr "" #: whatsnew/3.8.rst:1719 @@ -2198,7 +2584,7 @@ msgstr "" #: whatsnew/3.8.rst:1729 msgid "" "*func* in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:" -"`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb." +"`profile.Profile.runcall`, :meth:`!cProfile.Profile.runcall`, :meth:`bdb.Bdb." "runcall`, :meth:`trace.Trace.runfunc` and :func:`curses.wrapper`." msgstr "" @@ -2215,16 +2601,15 @@ msgstr "" #: whatsnew/3.8.rst:1737 msgid "" -"*callback* in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib." +"*callback* in :meth:`contextlib.ExitStack.callback`, :meth:`!contextlib." "AsyncExitStack.callback` and :meth:`contextlib.AsyncExitStack." "push_async_callback`." msgstr "" #: whatsnew/3.8.rst:1740 msgid "" -"*c* and *typeid* in the :meth:`~multiprocessing.managers.Server.create` " -"method of :class:`multiprocessing.managers.Server` and :class:" -"`multiprocessing.managers.SharedMemoryServer`." +"*c* and *typeid* in the :meth:`!create` method of :class:`!multiprocessing." +"managers.Server` and :class:`!multiprocessing.managers.SharedMemoryServer`." msgstr "" #: whatsnew/3.8.rst:1743 @@ -2250,25 +2635,25 @@ msgid "" "Starting with Python 3.3, importing ABCs from :mod:`collections` was " "deprecated, and importing should be done from :mod:`collections.abc`. Being " "able to import from collections was marked for removal in 3.8, but has been " -"delayed to 3.9. (See :issue:`36952`.)" +"delayed to 3.9. (See :gh:`81134`.)" msgstr "" #: whatsnew/3.8.rst:1760 msgid "" -"The :mod:`macpath` module, deprecated in Python 3.7, has been removed. " +"The :mod:`!macpath` module, deprecated in Python 3.7, has been removed. " "(Contributed by Victor Stinner in :issue:`35471`.)" msgstr "" -#: whatsnew/3.8.rst:1882 +#: whatsnew/3.8.rst:1883 msgid "" -"The function :func:`platform.popen` has been removed, after having been " +"The function :func:`!platform.popen` has been removed, after having been " "deprecated since Python 3.3: use :func:`os.popen` instead. (Contributed by " "Victor Stinner in :issue:`35345`.)" msgstr "" #: whatsnew/3.8.rst:1767 msgid "" -"The function :func:`time.clock` has been removed, after having been " +"The function :func:`!time.clock` has been removed, after having been " "deprecated since Python 3.3: use :func:`time.perf_counter` or :func:`time." "process_time` instead, depending on your requirements, to have well-defined " "behavior. (Contributed by Matthias Bussonnier in :issue:`36895`.)" @@ -2283,7 +2668,7 @@ msgstr "" #: whatsnew/3.8.rst:1777 msgid "" -"``parse_qs``, ``parse_qsl``, and ``escape`` are removed from the :mod:`cgi` " +"``parse_qs``, ``parse_qsl``, and ``escape`` are removed from the :mod:`!cgi` " "module. They are deprecated in Python 3.2 or older. They should be imported " "from the ``urllib.parse`` and ``html`` modules instead." msgstr "" @@ -2329,7 +2714,7 @@ msgstr "" #: whatsnew/3.8.rst:1803 msgid "" -"The functions :func:`sys.set_coroutine_wrapper` and :func:`sys." +"The functions :func:`!sys.set_coroutine_wrapper` and :func:`!sys." "get_coroutine_wrapper` deprecated in Python 3.7 have been removed; :issue:" "`36933` (Contributed by Matthias Bussonnier.)" msgstr "" @@ -2403,7 +2788,7 @@ msgid "" "`sys.is_finalizing`. (Contributed by Joannah Nanjekye in :issue:`36475`.)" msgstr "" -#: whatsnew/3.8.rst:2321 +#: whatsnew/3.8.rst:2324 msgid "Changes in the Python API" msgstr "" @@ -2419,13 +2804,14 @@ msgstr "" msgid "" ":class:`subprocess.Popen` can now use :func:`os.posix_spawn` in some cases " "for better performance. On Windows Subsystem for Linux and QEMU User " -"Emulation, the :class:`Popen` constructor using :func:`os.posix_spawn` no " -"longer raises an exception on errors like \"missing program\". Instead the " -"child process fails with a non-zero :attr:`~Popen.returncode`. (Contributed " -"by Joannah Nanjekye and Victor Stinner in :issue:`35537`.)" +"Emulation, the :class:`~subprocess.Popen` constructor using :func:`os." +"posix_spawn` no longer raises an exception on errors like \"missing " +"program\". Instead the child process fails with a non-zero :attr:" +"`~subprocess.Popen.returncode`. (Contributed by Joannah Nanjekye and Victor " +"Stinner in :issue:`35537`.)" msgstr "" -#: whatsnew/3.8.rst:1872 +#: whatsnew/3.8.rst:1873 msgid "" "The *preexec_fn* argument of * :class:`subprocess.Popen` is no longer " "compatible with subinterpreters. The use of the parameter in a " @@ -2433,20 +2819,20 @@ msgid "" "issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" msgstr "" -#: whatsnew/3.8.rst:1878 +#: whatsnew/3.8.rst:1879 msgid "" -"The :meth:`imap.IMAP4.logout` method no longer silently ignores arbitrary " +"The :meth:`imaplib.IMAP4.logout` method no longer silently ignores arbitrary " "exceptions. (Contributed by Victor Stinner in :issue:`36348`.)" msgstr "" -#: whatsnew/3.8.rst:1886 +#: whatsnew/3.8.rst:1887 msgid "" "The :func:`statistics.mode` function no longer raises an exception when " "given multimodal data. Instead, it returns the first mode encountered in " "the input data. (Contributed by Raymond Hettinger in :issue:`35892`.)" msgstr "" -#: whatsnew/3.8.rst:1891 +#: whatsnew/3.8.rst:1892 msgid "" "The :meth:`~tkinter.ttk.Treeview.selection` method of the :class:`tkinter." "ttk.Treeview` class no longer takes arguments. Using it with arguments for " @@ -2455,22 +2841,24 @@ msgid "" "selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" msgstr "" -#: whatsnew/3.8.rst:1897 +#: whatsnew/3.8.rst:1898 msgid "" -"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods of :mod:" -"`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, now " -"preserve the attribute order specified by the user. (Contributed by Diego " -"Rojas and Raymond Hettinger in :issue:`34160`.)" +"The :meth:`~xml.dom.minidom.Node.writexml`, :meth:`~xml.dom.minidom.Node." +"toxml` and :meth:`~xml.dom.minidom.Node.toprettyxml` methods of :mod:`xml." +"dom.minidom` and the :meth:`~xml.etree.ElementTree.ElementTree.write` method " +"of :mod:`xml.etree.ElementTree` now preserve the attribute order specified " +"by the user. (Contributed by Diego Rojas and Raymond Hettinger in :issue:" +"`34160`.)" msgstr "" -#: whatsnew/3.8.rst:1902 +#: whatsnew/3.8.rst:1905 msgid "" "A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only. :func:" "`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates a database " "if it does not exist. (Contributed by Serhiy Storchaka in :issue:`32749`.)" msgstr "" -#: whatsnew/3.8.rst:1907 +#: whatsnew/3.8.rst:1910 msgid "" "The ``doctype()`` method defined in a subclass of :class:`~xml.etree." "ElementTree.XMLParser` will no longer be called and will emit a :exc:" @@ -2480,7 +2868,7 @@ msgid "" "in :issue:`29209`.)" msgstr "" -#: whatsnew/3.8.rst:1914 +#: whatsnew/3.8.rst:1917 msgid "" "A :exc:`RuntimeError` is now raised when the custom metaclass doesn't " "provide the ``__classcell__`` entry in the namespace passed to ``type." @@ -2488,13 +2876,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :issue:`23722`.)" msgstr "" -#: whatsnew/3.8.rst:1919 +#: whatsnew/3.8.rst:1922 msgid "" -"The :class:`cProfile.Profile` class can now be used as a context manager. " -"(Contributed by Scott Sanderson in :issue:`29235`.)" +"The :class:`cProfile.Profile ` class can now be used as a " +"context manager. (Contributed by Scott Sanderson in :issue:`29235`.)" msgstr "" -#: whatsnew/3.8.rst:1922 +#: whatsnew/3.8.rst:1925 msgid "" ":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" "`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" @@ -2502,19 +2890,19 @@ msgid "" "operations` section)." msgstr "" -#: whatsnew/3.8.rst:1927 +#: whatsnew/3.8.rst:1930 msgid "" ":func:`shutil.copyfile` default buffer size on Windows was changed from 16 " "KiB to 1 MiB." msgstr "" -#: whatsnew/3.8.rst:1930 +#: whatsnew/3.8.rst:1933 msgid "" "The ``PyGC_Head`` struct has changed completely. All code that touched the " "struct member should be rewritten. (See :issue:`33597`.)" msgstr "" -#: whatsnew/3.8.rst:1933 +#: whatsnew/3.8.rst:1936 msgid "" "The :c:type:`PyInterpreterState` struct has been moved into the \"internal\" " "header files (specifically Include/internal/pycore_pystate.h). An opaque " @@ -2526,7 +2914,7 @@ msgid "" "functions to the public API). (See :issue:`35886`.)" msgstr "" -#: whatsnew/3.8.rst:1943 +#: whatsnew/3.8.rst:1946 msgid "" "The :meth:`mmap.flush() ` method now returns ``None`` on " "success and raises an exception on error under all platforms. Previously, " @@ -2536,21 +2924,21 @@ msgid "" "(Contributed by Berker Peksag in :issue:`2122`.)" msgstr "" -#: whatsnew/3.8.rst:1950 +#: whatsnew/3.8.rst:1953 msgid "" ":mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process external " "entities by default. (Contributed by Christian Heimes in :issue:`17239`.)" msgstr "" -#: whatsnew/3.8.rst:1954 +#: whatsnew/3.8.rst:1957 msgid "" "Deleting a key from a read-only :mod:`dbm` database (:mod:`dbm.dumb`, :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` (:exc:`dbm.dumb.error`, :" +"`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`!error` (:exc:`dbm.dumb.error`, :" "exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) instead of :exc:`KeyError`. " "(Contributed by Xiang Zhang in :issue:`33106`.)" msgstr "" -#: whatsnew/3.8.rst:1959 +#: whatsnew/3.8.rst:1962 msgid "" "Simplified AST for literals. All constants will be represented as :class:" "`ast.Constant` instances. Instantiating old classes ``Num``, ``Str``, " @@ -2558,7 +2946,7 @@ msgid "" "``Constant``. (Contributed by Serhiy Storchaka in :issue:`32892`.)" msgstr "" -#: whatsnew/3.8.rst:1975 +#: whatsnew/3.8.rst:1978 msgid "" "The function :func:`asyncio.wait_for` now correctly waits for cancellation " "when using an instance of :class:`asyncio.Task`. Previously, upon reaching " @@ -2566,18 +2954,18 @@ msgid "" "Pranskevichus in :issue:`32751`.)" msgstr "" -#: whatsnew/3.8.rst:1980 +#: whatsnew/3.8.rst:1983 msgid "" "The function :func:`asyncio.BaseTransport.get_extra_info` now returns a safe " "to use socket object when 'socket' is passed to the *name* parameter. " "(Contributed by Yury Selivanov in :issue:`37027`.)" msgstr "" -#: whatsnew/3.8.rst:1984 +#: whatsnew/3.8.rst:1987 msgid ":class:`asyncio.BufferedProtocol` has graduated to the stable API." msgstr "" -#: whatsnew/3.8.rst:1988 +#: whatsnew/3.8.rst:1991 msgid "" "DLL dependencies for extension modules and DLLs loaded with :mod:`ctypes` on " "Windows are now resolved more securely. Only the system paths, the directory " @@ -2592,14 +2980,14 @@ msgid "" "verified by the installer). (Contributed by Steve Dower in :issue:`36085`.)" msgstr "" -#: whatsnew/3.8.rst:2001 +#: whatsnew/3.8.rst:2004 msgid "" "The header files and functions related to pgen have been removed after its " "replacement by a pure Python implementation. (Contributed by Pablo Galindo " "in :issue:`36623`.)" msgstr "" -#: whatsnew/3.8.rst:2005 +#: whatsnew/3.8.rst:2008 msgid "" ":class:`types.CodeType` has a new parameter in the second position of the " "constructor (*posonlyargcount*) to support positional-only arguments defined " @@ -2609,17 +2997,17 @@ msgid "" "code future-proof." msgstr "" -#: whatsnew/3.8.rst:2012 +#: whatsnew/3.8.rst:2015 msgid "" "The parameter ``digestmod`` for :func:`hmac.new` no longer uses the MD5 " "digest by default." msgstr "" -#: whatsnew/3.8.rst:2016 +#: whatsnew/3.8.rst:2019 msgid "Changes in the C API" msgstr "" -#: whatsnew/3.8.rst:2018 +#: whatsnew/3.8.rst:2021 msgid "" "The :c:struct:`PyCompilerFlags` structure got a new *cf_feature_version* " "field. It should be initialized to ``PY_MINOR_VERSION``. The field is " @@ -2627,14 +3015,14 @@ msgid "" "in *cf_flags*. (Contributed by Guido van Rossum in :issue:`35766`.)" msgstr "" -#: whatsnew/3.8.rst:2024 +#: whatsnew/3.8.rst:2027 msgid "" "The :c:func:`!PyEval_ReInitThreads` function has been removed from the C " "API. It should not be called explicitly: use :c:func:`PyOS_AfterFork_Child` " "instead. (Contributed by Victor Stinner in :issue:`36728`.)" msgstr "" -#: whatsnew/3.8.rst:2029 +#: whatsnew/3.8.rst:2032 msgid "" "On Unix, C extensions are no longer linked to libpython except on Android " "and Cygwin. When Python is embedded, ``libpython`` must not be loaded with " @@ -2645,7 +3033,7 @@ msgid "" "Stinner in :issue:`21536`.)" msgstr "" -#: whatsnew/3.8.rst:2037 +#: whatsnew/3.8.rst:2040 msgid "" "Use of ``#`` variants of formats in parsing or building value (e.g. :c:func:" "`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:" @@ -2654,21 +3042,21 @@ msgid "" "`arg-parsing` for detail. (Contributed by Inada Naoki in :issue:`36381`.)" msgstr "" -#: whatsnew/3.8.rst:2043 +#: whatsnew/3.8.rst:2046 msgid "" "Instances of heap-allocated types (such as those created with :c:func:" "`PyType_FromSpec`) hold a reference to their type object. Increasing the " "reference count of these type objects has been moved from :c:func:" "`PyType_GenericAlloc` to the more low-level functions, :c:func:" -"`PyObject_Init` and :c:func:`PyObject_INIT`. This makes types created " +"`PyObject_Init` and :c:macro:`!PyObject_INIT`. This makes types created " "through :c:func:`PyType_FromSpec` behave like other classes in managed code." msgstr "" -#: whatsnew/3.8.rst:2051 +#: whatsnew/3.8.rst:2054 msgid ":ref:`Statically allocated types ` are not affected." msgstr "" -#: whatsnew/3.8.rst:2053 +#: whatsnew/3.8.rst:2056 msgid "" "For the vast majority of cases, there should be no side effect. However, " "types that manually increase the reference count after allocating an " @@ -2677,45 +3065,77 @@ msgid "" "instance deallocation." msgstr "" -#: whatsnew/3.8.rst:2059 +#: whatsnew/3.8.rst:2062 msgid "" "To correctly port these types into 3.8, please apply the following changes:" msgstr "" -#: whatsnew/3.8.rst:2062 +#: whatsnew/3.8.rst:2065 msgid "" "Remove :c:macro:`Py_INCREF` on the type object after allocating an instance " "- if any. This may happen after calling :c:macro:`PyObject_New`, :c:macro:" "`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " -"or any other custom allocator that uses :c:func:`PyObject_Init` or :c:func:" -"`PyObject_INIT`." +"or any other custom allocator that uses :c:func:`PyObject_Init` or :c:macro:" +"`!PyObject_INIT`." msgstr "" -#: whatsnew/3.8.rst:2088 whatsnew/3.8.rst:2107 +#: whatsnew/3.8.rst:2091 whatsnew/3.8.rst:2110 msgid "Example:" msgstr "" -#: whatsnew/3.8.rst:2085 +#: whatsnew/3.8.rst:2074 +msgid "" +"static foo_struct *\n" +"foo_new(PyObject *type) {\n" +" foo_struct *foo = PyObject_GC_New(foo_struct, (PyTypeObject *) type);\n" +" if (foo == NULL)\n" +" return NULL;\n" +"#if PY_VERSION_HEX < 0x03080000\n" +" // Workaround for Python issue 35810; no longer necessary in Python 3.8\n" +" PY_INCREF(type)\n" +"#endif\n" +" return foo;\n" +"}" +msgstr "" + +#: whatsnew/3.8.rst:2088 msgid "" "Ensure that all custom ``tp_dealloc`` functions of heap-allocated types " "decrease the type's reference count." msgstr "" -#: whatsnew/3.8.rst:2102 +#: whatsnew/3.8.rst:2093 +msgid "" +"static void\n" +"foo_dealloc(foo_struct *instance) {\n" +" PyObject *type = Py_TYPE(instance);\n" +" PyObject_GC_Del(instance);\n" +"#if PY_VERSION_HEX >= 0x03080000\n" +" // This was not needed before Python 3.8 (Python issue 35810)\n" +" Py_DECREF(type);\n" +"#endif\n" +"}" +msgstr "" + +#: whatsnew/3.8.rst:2105 msgid "(Contributed by Eddie Elizondo in :issue:`35810`.)" msgstr "" -#: whatsnew/3.8.rst:2104 +#: whatsnew/3.8.rst:2107 msgid "" "The :c:macro:`Py_DEPRECATED()` macro has been implemented for MSVC. The " "macro now must be placed before the symbol name." msgstr "" -#: whatsnew/3.8.rst:2113 +#: whatsnew/3.8.rst:2112 +msgid "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" +msgstr "" + +#: whatsnew/3.8.rst:2116 msgid "(Contributed by Zackery Spytz in :issue:`33407`.)" msgstr "" -#: whatsnew/3.8.rst:2115 +#: whatsnew/3.8.rst:2118 msgid "" "The interpreter does not pretend to support binary compatibility of " "extension types across feature releases, anymore. A :c:type:`PyTypeObject` " @@ -2725,18 +3145,18 @@ msgid "" "before reading :c:member:`~PyTypeObject.tp_finalize`)." msgstr "" -#: whatsnew/3.8.rst:2122 +#: whatsnew/3.8.rst:2125 msgid "(Contributed by Antoine Pitrou in :issue:`32388`.)" msgstr "" -#: whatsnew/3.8.rst:2124 +#: whatsnew/3.8.rst:2127 msgid "" "The functions :c:func:`!PyNode_AddChild` and :c:func:`!PyParser_AddToken` " "now accept two additional ``int`` arguments *end_lineno* and " "*end_col_offset*." msgstr "" -#: whatsnew/3.8.rst:2127 +#: whatsnew/3.8.rst:2130 msgid "" "The :file:`libpython38.a` file to allow MinGW tools to link directly " "against :file:`python38.dll` is no longer included in the regular Windows " @@ -2745,7 +3165,13 @@ msgid "" "package:" msgstr "" -#: whatsnew/3.8.rst:2137 +#: whatsnew/3.8.rst:2135 +msgid "" +"gendef - python38.dll > tmp.def\n" +"dlltool --dllname python38.dll --def tmp.def --output-lib libpython38.a" +msgstr "" + +#: whatsnew/3.8.rst:2140 msgid "" "The location of an installed :file:`pythonXY.dll` will depend on the " "installation options and the version and language of Windows. See :ref:" @@ -2754,15 +3180,15 @@ msgid "" "the :file:`libs` directory under your Python installation." msgstr "" -#: whatsnew/3.8.rst:2143 +#: whatsnew/3.8.rst:2146 msgid "(Contributed by Steve Dower in :issue:`37351`.)" msgstr "" -#: whatsnew/3.8.rst:2147 +#: whatsnew/3.8.rst:2150 msgid "CPython bytecode changes" msgstr "" -#: whatsnew/3.8.rst:2149 +#: whatsnew/3.8.rst:2152 msgid "" "The interpreter loop has been simplified by moving the logic of unrolling " "the stack of blocks into the compiler. The compiler emits now explicit " @@ -2770,29 +3196,29 @@ msgid "" "code for :keyword:`break`, :keyword:`continue` and :keyword:`return`." msgstr "" -#: whatsnew/3.8.rst:2155 +#: whatsnew/3.8.rst:2158 msgid "" -"Removed opcodes :opcode:`BREAK_LOOP`, :opcode:`CONTINUE_LOOP`, :opcode:" -"`SETUP_LOOP` and :opcode:`SETUP_EXCEPT`. Added new opcodes :opcode:" -"`ROT_FOUR`, :opcode:`BEGIN_FINALLY`, :opcode:`CALL_FINALLY` and :opcode:" -"`POP_FINALLY`. Changed the behavior of :opcode:`END_FINALLY` and :opcode:" -"`WITH_CLEANUP_START`." +"Removed opcodes :opcode:`!BREAK_LOOP`, :opcode:`!CONTINUE_LOOP`, :opcode:`!" +"SETUP_LOOP` and :opcode:`!SETUP_EXCEPT`. Added new opcodes :opcode:`!" +"ROT_FOUR`, :opcode:`!BEGIN_FINALLY`, :opcode:`!CALL_FINALLY` and :opcode:`!" +"POP_FINALLY`. Changed the behavior of :opcode:`!END_FINALLY` and :opcode:`!" +"WITH_CLEANUP_START`." msgstr "" -#: whatsnew/3.8.rst:2161 +#: whatsnew/3.8.rst:2164 msgid "" "(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka in :issue:" "`17611`.)" msgstr "" -#: whatsnew/3.8.rst:2164 +#: whatsnew/3.8.rst:2167 msgid "" "Added new opcode :opcode:`END_ASYNC_FOR` for handling exceptions raised when " "awaiting a next item in an :keyword:`async for` loop. (Contributed by Serhiy " "Storchaka in :issue:`33041`.)" msgstr "" -#: whatsnew/3.8.rst:2168 +#: whatsnew/3.8.rst:2171 msgid "" "The :opcode:`MAP_ADD` now expects the value as the first element in the " "stack and the key as the second element. This change was made so the key is " @@ -2800,22 +3226,98 @@ msgid "" "by :pep:`572`. (Contributed by Jörn Heissler in :issue:`35224`.)" msgstr "" -#: whatsnew/3.8.rst:2175 +#: whatsnew/3.8.rst:2178 msgid "Demos and Tools" msgstr "" -#: whatsnew/3.8.rst:2177 +#: whatsnew/3.8.rst:2180 msgid "" "Added a benchmark script for timing various ways to access variables: " "``Tools/scripts/var_access_benchmark.py``. (Contributed by Raymond Hettinger " "in :issue:`35884`.)" msgstr "" -#: whatsnew/3.8.rst:2181 +#: whatsnew/3.8.rst:2184 msgid "Here's a summary of performance improvements since Python 3.3:" msgstr "" -#: whatsnew/3.8.rst:2228 +#: whatsnew/3.8.rst:2186 +msgid "" +"Python version 3.3 3.4 3.5 3.6 3.7 " +"3.8\n" +"-------------- --- --- --- --- --- " +"---\n" +"\n" +"Variable and attribute read access:\n" +" read_local 4.0 7.1 7.1 5.4 5.1 " +"3.9\n" +" read_nonlocal 5.3 7.1 8.1 5.8 5.4 " +"4.4\n" +" read_global 13.3 15.5 19.0 14.3 13.6 " +"7.6\n" +" read_builtin 20.0 21.1 21.6 18.5 19.0 " +"7.5\n" +" read_classvar_from_class 20.5 25.6 26.5 20.7 19.5 " +"18.4\n" +" read_classvar_from_instance 18.5 22.8 23.5 18.8 17.1 " +"16.4\n" +" read_instancevar 26.8 32.4 33.1 28.0 26.3 " +"25.4\n" +" read_instancevar_slots 23.7 27.8 31.3 20.8 20.8 " +"20.2\n" +" read_namedtuple 68.5 73.8 57.5 45.0 46.8 " +"18.4\n" +" read_boundmethod 29.8 37.6 37.9 29.6 26.9 " +"27.7\n" +"\n" +"Variable and attribute write access:\n" +" write_local 4.6 8.7 9.3 5.5 5.3 " +"4.3\n" +" write_nonlocal 7.3 10.5 11.1 5.6 5.5 " +"4.7\n" +" write_global 15.9 19.7 21.2 18.0 18.0 " +"15.8\n" +" write_classvar 81.9 92.9 96.0 104.6 102.1 " +"39.2\n" +" write_instancevar 36.4 44.6 45.8 40.0 38.9 " +"35.5\n" +" write_instancevar_slots 28.7 35.6 36.1 27.3 26.6 " +"25.7\n" +"\n" +"Data structure read access:\n" +" read_list 19.2 24.2 24.5 20.8 20.8 " +"19.0\n" +" read_deque 19.9 24.7 25.5 20.2 20.6 " +"19.8\n" +" read_dict 19.7 24.3 25.7 22.3 23.0 " +"21.0\n" +" read_strdict 17.9 22.6 24.3 19.5 21.2 " +"18.9\n" +"\n" +"Data structure write access:\n" +" write_list 21.2 27.1 28.5 22.5 21.6 " +"20.0\n" +" write_deque 23.8 28.7 30.1 22.7 21.8 " +"23.5\n" +" write_dict 25.9 31.4 33.3 29.3 29.2 " +"24.7\n" +" write_strdict 22.9 28.4 29.9 27.5 25.2 " +"23.1\n" +"\n" +"Stack (or queue) operations:\n" +" list_append_pop 144.2 93.4 112.7 75.4 74.2 " +"50.8\n" +" deque_append_pop 30.4 43.5 57.0 49.4 49.2 " +"42.5\n" +" deque_append_popleft 30.8 43.7 57.3 49.7 49.7 " +"42.8\n" +"\n" +"Timing loop:\n" +" loop_overhead 0.3 0.5 0.6 0.4 0.3 " +"0.3" +msgstr "" + +#: whatsnew/3.8.rst:2231 msgid "" "The benchmarks were measured on an `Intel® Core™ i7-4960HQ processor " "`_. This limit can be " -"configured or disabled by environment variable, command line flag, or :mod:" -"`sys` APIs. See the :ref:`integer string conversion length limitation " -"` documentation. The default limit is 4300 digits in " -"string form." +"algorithmic complexity. This is a mitigation for :cve:`2020-10735`. This " +"limit can be configured or disabled by environment variable, command line " +"flag, or :mod:`sys` APIs. See the :ref:`integer string conversion length " +"limitation ` documentation. The default limit is 4300 " +"digits in string form." msgstr "" -#: whatsnew/3.8.rst:2348 +#: whatsnew/3.8.rst:2350 msgid "Notable changes in 3.8.17" msgstr "" -#: whatsnew/3.8.rst:2353 +#: whatsnew/3.8.rst:2355 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 939c7081..91bff81e 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -8,10 +8,11 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -106,19 +107,19 @@ msgstr "" #: whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`_abc`, :mod:`audioop`, :mod:`_bz2`, :mod:" -"`_codecs`, :mod:`_contextvars`, :mod:`_crypt`, :mod:`_functools`, :mod:" -"`_json`, :mod:`_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:" -"`time`, :mod:`_weakref`) now use multiphase initialization as defined by PEP " -"489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" +"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" +"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" +"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " +"as defined by PEP 489;" msgstr "" #: whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`audioop`, :mod:`ast`, :mod:" -"`grp`, :mod:`_hashlib`, :mod:`pwd`, :mod:`_posixsubprocess`, :mod:`random`, :" -"mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now using the " -"stable ABI defined by PEP 384." +"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" +"`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" +"`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " +"using the stable ABI defined by PEP 384." msgstr "" #: whatsnew/3.9.rst:94 @@ -197,7 +198,7 @@ msgid "" "Python as well. Consult the :ref:`removed-in-python-39` section." msgstr "" -#: whatsnew/3.9.rst:1273 +#: whatsnew/3.9.rst:1272 msgid "New Features" msgstr "" @@ -216,6 +217,16 @@ msgstr "" msgid "Example::" msgstr "" +#: whatsnew/3.9.rst:151 +msgid "" +">>> x = {\"key1\": \"value1 from x\", \"key2\": \"value2 from x\"}\n" +">>> y = {\"key2\": \"value2 from y\", \"key3\": \"value3 from y\"}\n" +">>> x | y\n" +"{'key1': 'value1 from x', 'key2': 'value2 from y', 'key3': 'value3 from y'}\n" +">>> y | x\n" +"{'key2': 'value2 from x', 'key3': 'value3 from y', 'key1': 'value1 from x'}" +msgstr "" + #: whatsnew/3.9.rst:158 msgid "" "See :pep:`584` for a full description. (Contributed by Brandt Bucher in :" @@ -249,10 +260,17 @@ msgid "" "for example ``queue.Queue``." msgstr "" -#: whatsnew/3.9.rst:1161 +#: whatsnew/3.9.rst:1159 msgid "Example:" msgstr "" +#: whatsnew/3.9.rst:182 +msgid "" +"def greet_all(names: list[str]) -> None:\n" +" for name in names:\n" +" print(\"Hello\", name)" +msgstr "" + #: whatsnew/3.9.rst:188 msgid "" "See :pep:`585` for more details. (Contributed by Guido van Rossum, Ethan " @@ -282,7 +300,7 @@ msgstr "" #: whatsnew/3.9.rst:205 msgid "" "In Python 3.10, the old parser will be deleted and so will all functionality " -"that depends on it (primarily the :mod:`parser` module, which has long been " +"that depends on it (primarily the :mod:`!parser` module, which has long been " "deprecated). In Python 3.9 *only*, you can switch back to the LL(1) parser " "using a command line switch (``-X oldparser``) or an environment variable " "(``PYTHONOLDPARSER=1``)." @@ -393,27 +411,48 @@ msgid "" "`datetime.tzinfo` implementation backed by the system's time zone data." msgstr "" +#: whatsnew/3.9.rst:284 +msgid "" +">>> from zoneinfo import ZoneInfo\n" +">>> from datetime import datetime, timedelta\n" +"\n" +">>> # Daylight saving time\n" +">>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo(\"America/" +"Los_Angeles\"))\n" +">>> print(dt)\n" +"2020-10-31 12:00:00-07:00\n" +">>> dt.tzname()\n" +"'PDT'\n" +"\n" +">>> # Standard time\n" +">>> dt += timedelta(days=7)\n" +">>> print(dt)\n" +"2020-11-07 12:00:00-08:00\n" +">>> print(dt.tzname())\n" +"PST" +msgstr "" + #: whatsnew/3.9.rst:302 msgid "" "As a fall-back source of data for platforms that don't ship the IANA " -"database, the |tzdata|_ module was released as a first-party package -- " +"database, the :pypi:`tzdata` module was released as a first-party package -- " "distributed via PyPI and maintained by the CPython core team." msgstr "" -#: whatsnew/3.9.rst:311 +#: whatsnew/3.9.rst:308 msgid "" ":pep:`615` -- Support for the IANA Time Zone Database in the Standard Library" msgstr "" -#: whatsnew/3.9.rst:312 +#: whatsnew/3.9.rst:309 msgid "PEP written and implemented by Paul Ganssle" msgstr "" -#: whatsnew/3.9.rst:316 +#: whatsnew/3.9.rst:313 msgid "graphlib" msgstr "" -#: whatsnew/3.9.rst:318 +#: whatsnew/3.9.rst:315 msgid "" "A new module, :mod:`graphlib`, was added that contains the :class:`graphlib." "TopologicalSorter` class to offer functionality to perform topological " @@ -421,22 +460,22 @@ msgid "" "Hastings in :issue:`17005`.)" msgstr "" -#: whatsnew/3.9.rst:325 +#: whatsnew/3.9.rst:322 msgid "Improved Modules" msgstr "" -#: whatsnew/3.9.rst:328 +#: whatsnew/3.9.rst:325 msgid "ast" msgstr "" -#: whatsnew/3.9.rst:330 +#: whatsnew/3.9.rst:327 msgid "" "Added the *indent* option to :func:`~ast.dump` which allows it to produce a " "multiline indented output. (Contributed by Serhiy Storchaka in :issue:" "`37995`.)" msgstr "" -#: whatsnew/3.9.rst:334 +#: whatsnew/3.9.rst:331 msgid "" "Added :func:`ast.unparse` as a function in the :mod:`ast` module that can be " "used to unparse an :class:`ast.AST` object and produce a string with code " @@ -444,17 +483,17 @@ msgid "" "(Contributed by Pablo Galindo and Batuhan Taskaya in :issue:`38870`.)" msgstr "" -#: whatsnew/3.9.rst:339 +#: whatsnew/3.9.rst:336 msgid "" "Added docstrings to AST nodes that contains the ASDL signature used to " "construct that node. (Contributed by Batuhan Taskaya in :issue:`39638`.)" msgstr "" -#: whatsnew/3.9.rst:343 +#: whatsnew/3.9.rst:340 msgid "asyncio" msgstr "" -#: whatsnew/3.9.rst:345 +#: whatsnew/3.9.rst:342 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " @@ -464,7 +503,7 @@ msgid "" "`37228`.)" msgstr "" -#: whatsnew/3.9.rst:352 +#: whatsnew/3.9.rst:349 msgid "" "Added a new :term:`coroutine` :meth:`~asyncio.loop." "shutdown_default_executor` that schedules a shutdown for the default " @@ -473,13 +512,13 @@ msgid "" "new :term:`coroutine`. (Contributed by Kyle Stanley in :issue:`34037`.)" msgstr "" -#: whatsnew/3.9.rst:358 +#: whatsnew/3.9.rst:355 msgid "" -"Added :class:`asyncio.PidfdChildWatcher`, a Linux-specific child watcher " +"Added :class:`!asyncio.PidfdChildWatcher`, a Linux-specific child watcher " "implementation that polls process file descriptors. (:issue:`38692`)" msgstr "" -#: whatsnew/3.9.rst:361 +#: whatsnew/3.9.rst:358 msgid "" "Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used " "for running IO-bound functions in a separate thread to avoid blocking the " @@ -488,7 +527,7 @@ msgid "" "by Kyle Stanley and Yury Selivanov in :issue:`32309`.)" msgstr "" -#: whatsnew/3.9.rst:367 +#: whatsnew/3.9.rst:364 msgid "" "When cancelling the task due to a timeout, :meth:`asyncio.wait_for` will now " "wait until the cancellation is complete also in the case when *timeout* is " @@ -496,25 +535,25 @@ msgid "" "Pranskevichus in :issue:`32751`.)" msgstr "" -#: whatsnew/3.9.rst:372 +#: whatsnew/3.9.rst:369 msgid "" -":mod:`asyncio` now raises :exc:`TyperError` when calling incompatible " -"methods with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael " -"in :issue:`37404`.)" +":mod:`asyncio` now raises :exc:`TypeError` when calling incompatible methods " +"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael in :issue:" +"`37404`.)" msgstr "" -#: whatsnew/3.9.rst:377 +#: whatsnew/3.9.rst:374 msgid "compileall" msgstr "" -#: whatsnew/3.9.rst:379 +#: whatsnew/3.9.rst:376 msgid "" "Added new possibility to use hardlinks for duplicated ``.pyc`` files: " "*hardlink_dupes* parameter and --hardlink-dupes command line option. " "(Contributed by Lumír 'Frenzy' Balhar in :issue:`40495`.)" msgstr "" -#: whatsnew/3.9.rst:382 +#: whatsnew/3.9.rst:379 msgid "" "Added new options for path manipulation in resulting ``.pyc`` files: " "*stripdir*, *prependdir*, *limit_sl_dest* parameters and -s, -p, -e command " @@ -523,11 +562,11 @@ msgid "" "issue:`38112`.)" msgstr "" -#: whatsnew/3.9.rst:387 +#: whatsnew/3.9.rst:384 msgid "concurrent.futures" msgstr "" -#: whatsnew/3.9.rst:389 +#: whatsnew/3.9.rst:386 msgid "" "Added a new *cancel_futures* parameter to :meth:`concurrent.futures.Executor." "shutdown` that cancels all pending futures which have not started running, " @@ -535,7 +574,7 @@ msgid "" "(Contributed by Kyle Stanley in :issue:`39349`.)" msgstr "" -#: whatsnew/3.9.rst:395 +#: whatsnew/3.9.rst:392 msgid "" "Removed daemon threads from :class:`~concurrent.futures.ThreadPoolExecutor` " "and :class:`~concurrent.futures.ProcessPoolExecutor`. This improves " @@ -543,7 +582,7 @@ msgid "" "processes. (Contributed by Kyle Stanley in :issue:`39812`.)" msgstr "" -#: whatsnew/3.9.rst:400 +#: whatsnew/3.9.rst:397 msgid "" "Workers in :class:`~concurrent.futures.ProcessPoolExecutor` are now spawned " "on demand, only when there are no available idle workers to reuse. This " @@ -551,56 +590,56 @@ msgid "" "workers. (Contributed by Kyle Stanley in :issue:`39207`.)" msgstr "" -#: whatsnew/3.9.rst:406 +#: whatsnew/3.9.rst:403 msgid "curses" msgstr "" -#: whatsnew/3.9.rst:408 +#: whatsnew/3.9.rst:405 msgid "" "Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:" "`curses.get_tabsize`, and :func:`curses.set_tabsize` functions. (Contributed " "by Anthony Sottile in :issue:`38312`.)" msgstr "" -#: whatsnew/3.9.rst:413 +#: whatsnew/3.9.rst:410 msgid "datetime" msgstr "" -#: whatsnew/3.9.rst:414 +#: whatsnew/3.9.rst:411 msgid "" -"The :meth:`~datetime.date.isocalendar()` of :class:`datetime.date` and :meth:" -"`~datetime.datetime.isocalendar()` of :class:`datetime.datetime` methods now " +"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` and :meth:" +"`~datetime.datetime.isocalendar` of :class:`datetime.datetime` methods now " "returns a :func:`~collections.namedtuple` instead of a :class:`tuple`. " "(Contributed by Donghee Na in :issue:`24416`.)" msgstr "" -#: whatsnew/3.9.rst:420 +#: whatsnew/3.9.rst:417 msgid "distutils" msgstr "" -#: whatsnew/3.9.rst:422 +#: whatsnew/3.9.rst:419 msgid "" "The :command:`upload` command now creates SHA2-256 and Blake2b-256 hash " "digests. It skips MD5 on platforms that block MD5 digest. (Contributed by " "Christian Heimes in :issue:`40698`.)" msgstr "" -#: whatsnew/3.9.rst:427 +#: whatsnew/3.9.rst:424 msgid "fcntl" msgstr "" -#: whatsnew/3.9.rst:429 +#: whatsnew/3.9.rst:426 msgid "" -"Added constants :const:`~fcntl.F_OFD_GETLK`, :const:`~fcntl.F_OFD_SETLK` " -"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na in :issue:" +"Added constants :const:`!fcntl.F_OFD_GETLK`, :const:`!fcntl.F_OFD_SETLK` " +"and :const:`!fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na in :issue:" "`38602`.)" msgstr "" -#: whatsnew/3.9.rst:434 +#: whatsnew/3.9.rst:431 msgid "ftplib" msgstr "" -#: whatsnew/3.9.rst:436 +#: whatsnew/3.9.rst:433 msgid "" ":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise a :class:" "`ValueError` if the given timeout for their constructor is zero to prevent " @@ -608,11 +647,11 @@ msgid "" "`39259`.)" msgstr "" -#: whatsnew/3.9.rst:441 +#: whatsnew/3.9.rst:438 msgid "gc" msgstr "" -#: whatsnew/3.9.rst:443 +#: whatsnew/3.9.rst:440 msgid "" "When the garbage collector makes a collection in which some objects " "resurrect (they are reachable from outside the isolated cycles after the " @@ -621,24 +660,24 @@ msgid "" "issue:`38379`.)" msgstr "" -#: whatsnew/3.9.rst:448 +#: whatsnew/3.9.rst:445 msgid "" "Added a new function :func:`gc.is_finalized` to check if an object has been " "finalized by the garbage collector. (Contributed by Pablo Galindo in :issue:" "`39322`.)" msgstr "" -#: whatsnew/3.9.rst:453 +#: whatsnew/3.9.rst:450 msgid "hashlib" msgstr "" -#: whatsnew/3.9.rst:455 +#: whatsnew/3.9.rst:452 msgid "" "The :mod:`hashlib` module can now use SHA3 hashes and SHAKE XOF from OpenSSL " "when available. (Contributed by Christian Heimes in :issue:`37630`.)" msgstr "" -#: whatsnew/3.9.rst:459 +#: whatsnew/3.9.rst:456 msgid "" "Builtin hash modules can now be disabled with ``./configure --without-" "builtin-hashlib-hashes`` or selectively enabled with e.g. ``./configure --" @@ -646,55 +685,55 @@ msgid "" "implementation. (Contributed by Christian Heimes in :issue:`40479`)" msgstr "" -#: whatsnew/3.9.rst:467 +#: whatsnew/3.9.rst:464 msgid "http" msgstr "" -#: whatsnew/3.9.rst:469 +#: whatsnew/3.9.rst:466 msgid "" "HTTP status codes ``103 EARLY_HINTS``, ``418 IM_A_TEAPOT`` and ``425 " "TOO_EARLY`` are added to :class:`http.HTTPStatus`. (Contributed by Donghee " "Na in :issue:`39509` and Ross Rhodes in :issue:`39507`.)" msgstr "" -#: whatsnew/3.9.rst:473 +#: whatsnew/3.9.rst:470 msgid "IDLE and idlelib" msgstr "" -#: whatsnew/3.9.rst:475 +#: whatsnew/3.9.rst:472 msgid "" "Added option to toggle cursor blink off. (Contributed by Zackery Spytz in :" "issue:`4603`.)" msgstr "" -#: whatsnew/3.9.rst:478 +#: whatsnew/3.9.rst:475 msgid "" "Escape key now closes IDLE completion windows. (Contributed by Johnny " "Najera in :issue:`38944`.)" msgstr "" -#: whatsnew/3.9.rst:481 +#: whatsnew/3.9.rst:478 msgid "" "Added keywords to module name completion list. (Contributed by Terry J. " "Reedy in :issue:`37765`.)" msgstr "" -#: whatsnew/3.9.rst:484 +#: whatsnew/3.9.rst:481 msgid "New in 3.9 maintenance releases" msgstr "" -#: whatsnew/3.9.rst:486 +#: whatsnew/3.9.rst:483 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " "hooks were previously ignored. (Contributed by Ken Hilton in :issue:" "`43008`.)" msgstr "" -#: whatsnew/3.9.rst:490 +#: whatsnew/3.9.rst:487 msgid "The changes above have been backported to 3.8 maintenance releases." msgstr "" -#: whatsnew/3.9.rst:492 +#: whatsnew/3.9.rst:489 msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " @@ -705,17 +744,17 @@ msgid "" "`33962`.)" msgstr "" -#: whatsnew/3.9.rst:500 +#: whatsnew/3.9.rst:497 msgid "" "Apply syntax highlighting to ``.pyi`` files. (Contributed by Alex Waygood " "and Terry Jan Reedy in :issue:`45447`.)" msgstr "" -#: whatsnew/3.9.rst:504 +#: whatsnew/3.9.rst:501 msgid "imaplib" msgstr "" -#: whatsnew/3.9.rst:506 +#: whatsnew/3.9.rst:503 msgid "" ":class:`~imaplib.IMAP4` and :class:`~imaplib.IMAP4_SSL` now have an optional " "*timeout* parameter for their constructors. Also, the :meth:`~imaplib.IMAP4." @@ -725,7 +764,7 @@ msgid "" "issue:`38615`.)" msgstr "" -#: whatsnew/3.9.rst:513 +#: whatsnew/3.9.rst:510 msgid "" ":meth:`imaplib.IMAP4.unselect` is added. :meth:`imaplib.IMAP4.unselect` " "frees server's resources associated with the selected mailbox and returns " @@ -735,11 +774,11 @@ msgid "" "Donghee Na in :issue:`40375`.)" msgstr "" -#: whatsnew/3.9.rst:521 +#: whatsnew/3.9.rst:518 msgid "importlib" msgstr "" -#: whatsnew/3.9.rst:523 +#: whatsnew/3.9.rst:520 msgid "" "To improve consistency with import statements, :func:`importlib.util." "resolve_name` now raises :exc:`ImportError` instead of :exc:`ValueError` for " @@ -747,47 +786,47 @@ msgid "" "`37444`.)" msgstr "" -#: whatsnew/3.9.rst:528 +#: whatsnew/3.9.rst:525 msgid "" "Import loaders which publish immutable module objects can now publish " "immutable packages in addition to individual modules. (Contributed by Dino " "Viehland in :issue:`39336`.)" msgstr "" -#: whatsnew/3.9.rst:532 +#: whatsnew/3.9.rst:529 msgid "" "Added :func:`importlib.resources.files` function with support for " "subdirectories in package data, matching backport in ``importlib_resources`` " "version 1.5. (Contributed by Jason R. Coombs in :issue:`39791`.)" msgstr "" -#: whatsnew/3.9.rst:537 +#: whatsnew/3.9.rst:534 msgid "" "Refreshed ``importlib.metadata`` from ``importlib_metadata`` version 1.6.1." msgstr "" -#: whatsnew/3.9.rst:540 +#: whatsnew/3.9.rst:537 msgid "inspect" msgstr "" -#: whatsnew/3.9.rst:542 +#: whatsnew/3.9.rst:539 msgid "" ":attr:`inspect.BoundArguments.arguments` is changed from ``OrderedDict`` to " "regular dict. (Contributed by Inada Naoki in :issue:`36350` and :issue:" "`39775`.)" msgstr "" -#: whatsnew/3.9.rst:546 +#: whatsnew/3.9.rst:543 msgid "ipaddress" msgstr "" -#: whatsnew/3.9.rst:548 +#: whatsnew/3.9.rst:545 msgid "" ":mod:`ipaddress` now supports IPv6 Scoped Addresses (IPv6 address with " "suffix ``%``)." msgstr "" -#: whatsnew/3.9.rst:550 +#: whatsnew/3.9.rst:547 msgid "" "Scoped IPv6 addresses can be parsed using :class:`ipaddress.IPv6Address`. If " "present, scope zone ID is available through the :attr:`~ipaddress." @@ -795,125 +834,124 @@ msgid "" "`34788`.)" msgstr "" -#: whatsnew/3.9.rst:554 +#: whatsnew/3.9.rst:551 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " "leading zeros in IPv4 address strings. (Contributed by Christian Heimes in :" "issue:`36384`)." msgstr "" -#: whatsnew/3.9.rst:559 +#: whatsnew/3.9.rst:556 msgid "math" msgstr "" -#: whatsnew/3.9.rst:561 +#: whatsnew/3.9.rst:558 msgid "" "Expanded the :func:`math.gcd` function to handle multiple arguments. " "Formerly, it only supported two arguments. (Contributed by Serhiy Storchaka " "in :issue:`39648`.)" msgstr "" -#: whatsnew/3.9.rst:565 +#: whatsnew/3.9.rst:562 msgid "" "Added :func:`math.lcm`: return the least common multiple of specified " "arguments. (Contributed by Mark Dickinson, Ananthakrishnan and Serhiy " "Storchaka in :issue:`39479` and :issue:`39648`.)" msgstr "" -#: whatsnew/3.9.rst:569 +#: whatsnew/3.9.rst:566 msgid "" "Added :func:`math.nextafter`: return the next floating-point value after *x* " "towards *y*. (Contributed by Victor Stinner in :issue:`39288`.)" msgstr "" -#: whatsnew/3.9.rst:573 +#: whatsnew/3.9.rst:570 msgid "" "Added :func:`math.ulp`: return the value of the least significant bit of a " "float. (Contributed by Victor Stinner in :issue:`39310`.)" msgstr "" -#: whatsnew/3.9.rst:578 +#: whatsnew/3.9.rst:575 msgid "multiprocessing" msgstr "" -#: whatsnew/3.9.rst:580 +#: whatsnew/3.9.rst:577 msgid "" "The :class:`multiprocessing.SimpleQueue` class has a new :meth:" "`~multiprocessing.SimpleQueue.close` method to explicitly close the queue. " "(Contributed by Victor Stinner in :issue:`30966`.)" msgstr "" -#: whatsnew/3.9.rst:586 +#: whatsnew/3.9.rst:583 msgid "nntplib" msgstr "" -#: whatsnew/3.9.rst:588 +#: whatsnew/3.9.rst:585 msgid "" -":class:`~nntplib.NNTP` and :class:`~nntplib.NNTP_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`!NNTP` and :class:`!NNTP_SSL` now raise a :class:`ValueError` if the " +"given timeout for their constructor is zero to prevent the creation of a non-" +"blocking socket. (Contributed by Donghee Na in :issue:`39259`.)" msgstr "" -#: whatsnew/3.9.rst:593 +#: whatsnew/3.9.rst:590 msgid "os" msgstr "" -#: whatsnew/3.9.rst:595 +#: whatsnew/3.9.rst:592 msgid "" -"Added :const:`~os.CLD_KILLED` and :const:`~os.CLD_STOPPED` for :attr:" -"`si_code`. (Contributed by Donghee Na in :issue:`38493`.)" +"Added :const:`~os.CLD_KILLED` and :const:`~os.CLD_STOPPED` for :attr:`!" +"si_code`. (Contributed by Donghee Na in :issue:`38493`.)" msgstr "" -#: whatsnew/3.9.rst:598 +#: whatsnew/3.9.rst:595 msgid "" "Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and :const:" "`os.P_PIDFD` (:issue:`38713`) for process management with file descriptors." msgstr "" -#: whatsnew/3.9.rst:602 +#: whatsnew/3.9.rst:599 msgid "" "The :func:`os.unsetenv` function is now also available on Windows. " "(Contributed by Victor Stinner in :issue:`39413`.)" msgstr "" -#: whatsnew/3.9.rst:605 +#: whatsnew/3.9.rst:602 msgid "" "The :func:`os.putenv` and :func:`os.unsetenv` functions are now always " "available. (Contributed by Victor Stinner in :issue:`39395`.)" msgstr "" -#: whatsnew/3.9.rst:609 +#: whatsnew/3.9.rst:606 msgid "" "Added :func:`os.waitstatus_to_exitcode` function: convert a wait status to " "an exit code. (Contributed by Victor Stinner in :issue:`40094`.)" msgstr "" -#: whatsnew/3.9.rst:614 +#: whatsnew/3.9.rst:611 msgid "pathlib" msgstr "" -#: whatsnew/3.9.rst:616 +#: whatsnew/3.9.rst:613 msgid "" -"Added :meth:`pathlib.Path.readlink()` which acts similarly to :func:`os." +"Added :meth:`pathlib.Path.readlink` which acts similarly to :func:`os." "readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" msgstr "" -#: whatsnew/3.9.rst:621 +#: whatsnew/3.9.rst:618 msgid "pdb" msgstr "" -#: whatsnew/3.9.rst:623 +#: whatsnew/3.9.rst:620 msgid "" "On Windows now :class:`~pdb.Pdb` supports ``~/.pdbrc``. (Contributed by Tim " "Hopper and Dan Lidral-Porter in :issue:`20523`.)" msgstr "" -#: whatsnew/3.9.rst:627 +#: whatsnew/3.9.rst:624 msgid "poplib" msgstr "" -#: whatsnew/3.9.rst:629 +#: whatsnew/3.9.rst:626 msgid "" ":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise a :class:" "`ValueError` if the given timeout for their constructor is zero to prevent " @@ -921,53 +959,53 @@ msgid "" "`39259`.)" msgstr "" -#: whatsnew/3.9.rst:634 +#: whatsnew/3.9.rst:631 msgid "pprint" msgstr "" -#: whatsnew/3.9.rst:636 +#: whatsnew/3.9.rst:633 msgid "" ":mod:`pprint` can now pretty-print :class:`types.SimpleNamespace`. " "(Contributed by Carl Bordum Hansen in :issue:`37376`.)" msgstr "" -#: whatsnew/3.9.rst:640 +#: whatsnew/3.9.rst:637 msgid "pydoc" msgstr "" -#: whatsnew/3.9.rst:642 +#: whatsnew/3.9.rst:639 msgid "" "The documentation string is now shown not only for class, function, method " -"etc, but for any object that has its own ``__doc__`` attribute. (Contributed " -"by Serhiy Storchaka in :issue:`40257`.)" +"etc, but for any object that has its own :attr:`~definition.__doc__` " +"attribute. (Contributed by Serhiy Storchaka in :issue:`40257`.)" msgstr "" -#: whatsnew/3.9.rst:647 +#: whatsnew/3.9.rst:645 msgid "random" msgstr "" -#: whatsnew/3.9.rst:649 +#: whatsnew/3.9.rst:647 msgid "" -"Added a new :attr:`random.Random.randbytes` method: generate random bytes. " +"Added a new :meth:`random.Random.randbytes` method: generate random bytes. " "(Contributed by Victor Stinner in :issue:`40286`.)" msgstr "" -#: whatsnew/3.9.rst:653 +#: whatsnew/3.9.rst:651 msgid "signal" msgstr "" -#: whatsnew/3.9.rst:655 +#: whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " "signals to a process using a file descriptor instead of a pid. (:issue:" "`38712`)" msgstr "" -#: whatsnew/3.9.rst:659 +#: whatsnew/3.9.rst:657 msgid "smtplib" msgstr "" -#: whatsnew/3.9.rst:661 +#: whatsnew/3.9.rst:659 msgid "" ":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" "`ValueError` if the given timeout for their constructor is zero to prevent " @@ -975,41 +1013,41 @@ msgid "" "`39259`.)" msgstr "" -#: whatsnew/3.9.rst:665 +#: whatsnew/3.9.rst:663 msgid "" ":class:`~smtplib.LMTP` constructor now has an optional *timeout* parameter. " "(Contributed by Donghee Na in :issue:`39329`.)" msgstr "" -#: whatsnew/3.9.rst:669 +#: whatsnew/3.9.rst:667 msgid "socket" msgstr "" -#: whatsnew/3.9.rst:671 +#: whatsnew/3.9.rst:669 msgid "" "The :mod:`socket` module now exports the :const:`~socket." "CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " "Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" -#: whatsnew/3.9.rst:675 +#: whatsnew/3.9.rst:673 msgid "" "The socket module now supports the :const:`~socket.CAN_J1939` protocol on " "platforms that support it. (Contributed by Karl Ding in :issue:`40291`.)" msgstr "" -#: whatsnew/3.9.rst:678 +#: whatsnew/3.9.rst:676 msgid "" "The socket module now has the :func:`socket.send_fds` and :func:`socket." "recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " "Victor Stinner in :issue:`28724`.)" msgstr "" -#: whatsnew/3.9.rst:684 +#: whatsnew/3.9.rst:682 msgid "time" msgstr "" -#: whatsnew/3.9.rst:686 +#: whatsnew/3.9.rst:684 msgid "" "On AIX, :func:`~time.thread_time` is now implemented with " "``thread_cputime()`` which has nanosecond resolution, rather than " @@ -1017,11 +1055,11 @@ msgid "" "milliseconds. (Contributed by Batuhan Taskaya in :issue:`40192`)" msgstr "" -#: whatsnew/3.9.rst:692 +#: whatsnew/3.9.rst:690 msgid "sys" msgstr "" -#: whatsnew/3.9.rst:694 +#: whatsnew/3.9.rst:692 msgid "" "Added a new :data:`sys.platlibdir` attribute: name of the platform-specific " "library directory. It is used to build the path of standard library and the " @@ -1031,29 +1069,29 @@ msgid "" "and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: whatsnew/3.9.rst:700 +#: whatsnew/3.9.rst:698 msgid "" "Previously, :data:`sys.stderr` was block-buffered when non-interactive. Now " "``stderr`` defaults to always being line-buffered. (Contributed by Jendrik " "Seipp in :issue:`13601`.)" msgstr "" -#: whatsnew/3.9.rst:705 +#: whatsnew/3.9.rst:703 msgid "tracemalloc" msgstr "" -#: whatsnew/3.9.rst:707 +#: whatsnew/3.9.rst:705 msgid "" "Added :func:`tracemalloc.reset_peak` to set the peak size of traced memory " "blocks to the current size, to measure the peak of specific pieces of code. " "(Contributed by Huon Wilson in :issue:`40630`.)" msgstr "" -#: whatsnew/3.9.rst:1495 +#: whatsnew/3.9.rst:1494 msgid "typing" msgstr "" -#: whatsnew/3.9.rst:714 +#: whatsnew/3.9.rst:712 msgid "" ":pep:`593` introduced an :data:`typing.Annotated` type to decorate existing " "types with context-specific metadata and new ``include_extras`` parameter " @@ -1061,20 +1099,20 @@ msgid "" "(Contributed by Till Varoquaux and Konstantin Kashin.)" msgstr "" -#: whatsnew/3.9.rst:720 +#: whatsnew/3.9.rst:718 msgid "unicodedata" msgstr "" -#: whatsnew/3.9.rst:722 +#: whatsnew/3.9.rst:720 msgid "" "The Unicode database has been updated to version 13.0.0. (:issue:`39926`)." msgstr "" -#: whatsnew/3.9.rst:725 +#: whatsnew/3.9.rst:723 msgid "venv" msgstr "" -#: whatsnew/3.9.rst:727 +#: whatsnew/3.9.rst:725 msgid "" "The activation scripts provided by :mod:`venv` now all specify their prompt " "customization consistently by always using the value specified by " @@ -1084,11 +1122,11 @@ msgid "" "Cannon in :issue:`37663`.)" msgstr "" -#: whatsnew/3.9.rst:735 +#: whatsnew/3.9.rst:733 msgid "xml" msgstr "" -#: whatsnew/3.9.rst:737 +#: whatsnew/3.9.rst:735 msgid "" "White space characters within attributes are now preserved when serializing :" "mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " @@ -1096,32 +1134,32 @@ msgid "" "2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" msgstr "" -#: whatsnew/3.9.rst:745 +#: whatsnew/3.9.rst:743 msgid "Optimizations" msgstr "" -#: whatsnew/3.9.rst:747 +#: whatsnew/3.9.rst:745 msgid "" "Optimized the idiom for assignment a temporary variable in comprehensions. " "Now ``for y in [expr]`` in comprehensions is as fast as a simple assignment " "``y = expr``. For example:" msgstr "" -#: whatsnew/3.9.rst:751 +#: whatsnew/3.9.rst:749 msgid "sums = [s for s in [0] for x in data for s in [s + x]]" msgstr "" -#: whatsnew/3.9.rst:753 +#: whatsnew/3.9.rst:751 msgid "" "Unlike the ``:=`` operator this idiom does not leak a variable to the outer " "scope." msgstr "" -#: whatsnew/3.9.rst:756 +#: whatsnew/3.9.rst:754 msgid "(Contributed by Serhiy Storchaka in :issue:`32856`.)" msgstr "" -#: whatsnew/3.9.rst:758 +#: whatsnew/3.9.rst:756 msgid "" "Optimized signal handling in multithreaded applications. If a thread " "different than the main thread gets a signal, the bytecode evaluation loop " @@ -1130,27 +1168,27 @@ msgid "" "interpreter can handle signals." msgstr "" -#: whatsnew/3.9.rst:764 +#: whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " "until the main thread handles signals. (Contributed by Victor Stinner in :" "issue:`40010`.)" msgstr "" -#: whatsnew/3.9.rst:768 +#: whatsnew/3.9.rst:766 msgid "" "Optimized the :mod:`subprocess` module on FreeBSD using ``closefrom()``. " "(Contributed by Ed Maste, Conrad Meyer, Kyle Evans, Kubilay Kocak and Victor " "Stinner in :issue:`38061`.)" msgstr "" -#: whatsnew/3.9.rst:772 +#: whatsnew/3.9.rst:770 msgid "" ":c:func:`PyLong_FromDouble` is now up to 1.87x faster for values that fit " "into :c:expr:`long`. (Contributed by Sergey Fedoseev in :issue:`37986`.)" msgstr "" -#: whatsnew/3.9.rst:776 +#: whatsnew/3.9.rst:774 msgid "" "A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" "class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" @@ -1158,14 +1196,14 @@ msgid "" "Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" msgstr "" -#: whatsnew/3.9.rst:781 +#: whatsnew/3.9.rst:779 msgid "" -"Optimized :func:`~set.difference_update` for the case when the other set is " +"Optimized :meth:`!set.difference_update` for the case when the other set is " "much larger than the base set. (Suggested by Evgeny Kapun with code " "contributed by Michele Orrù in :issue:`8425`.)" msgstr "" -#: whatsnew/3.9.rst:785 +#: whatsnew/3.9.rst:783 msgid "" "Python's small object allocator (``obmalloc.c``) now allows (no more than) " "one empty arena to remain available for immediate reuse, without returning " @@ -1174,26 +1212,102 @@ msgid "" "in :issue:`37257`.)" msgstr "" -#: whatsnew/3.9.rst:791 +#: whatsnew/3.9.rst:789 msgid "" ":term:`floor division` of float operation now has a better performance. Also " "the message of :exc:`ZeroDivisionError` for this operation is updated. " "(Contributed by Donghee Na in :issue:`39434`.)" msgstr "" -#: whatsnew/3.9.rst:795 +#: whatsnew/3.9.rst:793 msgid "" "Decoding short ASCII strings with UTF-8 and ascii codecs is now about 15% " "faster. (Contributed by Inada Naoki in :issue:`37348`.)" msgstr "" -#: whatsnew/3.9.rst:798 +#: whatsnew/3.9.rst:796 msgid "" "Here's a summary of performance improvements from Python 3.4 through Python " "3.9:" msgstr "" -#: whatsnew/3.9.rst:845 +#: whatsnew/3.9.rst:798 +msgid "" +"Python version 3.4 3.5 3.6 3.7 3.8 " +"3.9\n" +"-------------- --- --- --- --- --- " +"---\n" +"\n" +"Variable and attribute read access:\n" +" read_local 7.1 7.1 5.4 5.1 3.9 " +"3.9\n" +" read_nonlocal 7.1 8.1 5.8 5.4 4.4 " +"4.5\n" +" read_global 15.5 19.0 14.3 13.6 7.6 " +"7.8\n" +" read_builtin 21.1 21.6 18.5 19.0 7.5 " +"7.8\n" +" read_classvar_from_class 25.6 26.5 20.7 19.5 18.4 " +"17.9\n" +" read_classvar_from_instance 22.8 23.5 18.8 17.1 16.4 " +"16.9\n" +" read_instancevar 32.4 33.1 28.0 26.3 25.4 " +"25.3\n" +" read_instancevar_slots 27.8 31.3 20.8 20.8 20.2 " +"20.5\n" +" read_namedtuple 73.8 57.5 45.0 46.8 18.4 " +"18.7\n" +" read_boundmethod 37.6 37.9 29.6 26.9 27.7 " +"41.1\n" +"\n" +"Variable and attribute write access:\n" +" write_local 8.7 9.3 5.5 5.3 4.3 " +"4.3\n" +" write_nonlocal 10.5 11.1 5.6 5.5 4.7 " +"4.8\n" +" write_global 19.7 21.2 18.0 18.0 15.8 " +"16.7\n" +" write_classvar 92.9 96.0 104.6 102.1 39.2 " +"39.8\n" +" write_instancevar 44.6 45.8 40.0 38.9 35.5 " +"37.4\n" +" write_instancevar_slots 35.6 36.1 27.3 26.6 25.7 " +"25.8\n" +"\n" +"Data structure read access:\n" +" read_list 24.2 24.5 20.8 20.8 19.0 " +"19.5\n" +" read_deque 24.7 25.5 20.2 20.6 19.8 " +"20.2\n" +" read_dict 24.3 25.7 22.3 23.0 21.0 " +"22.4\n" +" read_strdict 22.6 24.3 19.5 21.2 18.9 " +"21.5\n" +"\n" +"Data structure write access:\n" +" write_list 27.1 28.5 22.5 21.6 20.0 " +"20.0\n" +" write_deque 28.7 30.1 22.7 21.8 23.5 " +"21.7\n" +" write_dict 31.4 33.3 29.3 29.2 24.7 " +"25.4\n" +" write_strdict 28.4 29.9 27.5 25.2 23.1 " +"24.5\n" +"\n" +"Stack (or queue) operations:\n" +" list_append_pop 93.4 112.7 75.4 74.2 50.8 " +"50.6\n" +" deque_append_pop 43.5 57.0 49.4 49.2 42.5 " +"44.2\n" +" deque_append_popleft 43.7 57.3 49.7 49.7 42.8 " +"46.4\n" +"\n" +"Timing loop:\n" +" loop_overhead 0.5 0.6 0.4 0.3 0.3 " +"0.3" +msgstr "" + +#: whatsnew/3.9.rst:843 msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " @@ -1204,18 +1318,18 @@ msgid "" "python.org/downloads/macos/>`_." msgstr "" -#: whatsnew/3.9.rst:855 +#: whatsnew/3.9.rst:853 msgid "Deprecated" msgstr "" -#: whatsnew/3.9.rst:857 +#: whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " "(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" "`39586`.)" msgstr "" -#: whatsnew/3.9.rst:861 +#: whatsnew/3.9.rst:859 msgid "" "Currently :func:`math.factorial` accepts :class:`float` instances with non-" "negative integer values (like ``5.0``). It raises a :exc:`ValueError` for " @@ -1224,15 +1338,15 @@ msgid "" "Serhiy Storchaka in :issue:`37315`.)" msgstr "" -#: whatsnew/3.9.rst:867 +#: whatsnew/3.9.rst:865 msgid "" -"The :mod:`parser` and :mod:`symbol` modules are deprecated and will be " +"The :mod:`!parser` and :mod:`!symbol` modules are deprecated and will be " "removed in future versions of Python. For the majority of use cases, users " "can leverage the Abstract Syntax Tree (AST) generation and compilation " "stage, using the :mod:`ast` module." msgstr "" -#: whatsnew/3.9.rst:872 +#: whatsnew/3.9.rst:870 msgid "" "The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" "func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" @@ -1240,7 +1354,7 @@ msgid "" "and will be removed in Python 3.10 together with the old parser." msgstr "" -#: whatsnew/3.9.rst:877 +#: whatsnew/3.9.rst:875 msgid "" "Using :data:`NotImplemented` in a boolean context has been deprecated, as it " "is almost exclusively the result of incorrect rich comparator " @@ -1248,7 +1362,7 @@ msgid "" "Python. (Contributed by Josh Rosenberg in :issue:`35712`.)" msgstr "" -#: whatsnew/3.9.rst:883 +#: whatsnew/3.9.rst:881 msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " @@ -1257,7 +1371,7 @@ msgid "" "`bytes`, and :class:`bytearray`." msgstr "" -#: whatsnew/3.9.rst:889 +#: whatsnew/3.9.rst:887 msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " @@ -1266,39 +1380,39 @@ msgid "" "issue:`28286`.)" msgstr "" -#: whatsnew/3.9.rst:895 +#: whatsnew/3.9.rst:893 msgid "" -"Deprecated the ``split()`` method of :class:`_tkinter.TkappType` in favour " -"of the ``splitlist()`` method which has more consistent and predicable " +"Deprecated the ``split()`` method of :class:`!_tkinter.TkappType` in favour " +"of the ``splitlist()`` method which has more consistent and predictable " "behavior. (Contributed by Serhiy Storchaka in :issue:`38371`.)" msgstr "" -#: whatsnew/3.9.rst:900 +#: whatsnew/3.9.rst:898 msgid "" "The explicit passing of coroutine objects to :func:`asyncio.wait` has been " "deprecated and will be removed in version 3.11. (Contributed by Yury " "Selivanov and Kyle Stanley in :issue:`34790`.)" msgstr "" -#: whatsnew/3.9.rst:904 +#: whatsnew/3.9.rst:902 msgid "" -"binhex4 and hexbin4 standards are now deprecated. The :mod:`binhex` module " +"binhex4 and hexbin4 standards are now deprecated. The :mod:`!binhex` module " "and the following :mod:`binascii` functions are now deprecated:" msgstr "" -#: whatsnew/3.9.rst:907 -msgid ":func:`~binascii.b2a_hqx`, :func:`~binascii.a2b_hqx`" +#: whatsnew/3.9.rst:905 +msgid ":func:`!b2a_hqx`, :func:`!a2b_hqx`" msgstr "" -#: whatsnew/3.9.rst:908 -msgid ":func:`~binascii.rlecode_hqx`, :func:`~binascii.rledecode_hqx`" +#: whatsnew/3.9.rst:906 +msgid ":func:`!rlecode_hqx`, :func:`!rledecode_hqx`" msgstr "" -#: whatsnew/3.9.rst:910 +#: whatsnew/3.9.rst:908 msgid "(Contributed by Victor Stinner in :issue:`39353`.)" msgstr "" -#: whatsnew/3.9.rst:912 +#: whatsnew/3.9.rst:910 msgid "" ":mod:`ast` classes ``slice``, ``Index`` and ``ExtSlice`` are considered " "deprecated and will be removed in future Python versions. ``value`` itself " @@ -1307,7 +1421,7 @@ msgid "" "Storchaka in :issue:`34822`.)" msgstr "" -#: whatsnew/3.9.rst:918 +#: whatsnew/3.9.rst:916 msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " @@ -1316,7 +1430,7 @@ msgid "" "`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" -#: whatsnew/3.9.rst:925 +#: whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " "functions are now deprecated and will be removed in Python 3.11. Calling :c:" @@ -1325,62 +1439,62 @@ msgid "" "in :issue:`39877`.)" msgstr "" -#: whatsnew/3.9.rst:931 +#: whatsnew/3.9.rst:929 msgid "" "Passing ``None`` as the first argument to the :func:`shlex.split` function " "has been deprecated. (Contributed by Zackery Spytz in :issue:`33262`.)" msgstr "" -#: whatsnew/3.9.rst:934 +#: whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " "external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" "`35800`.)" msgstr "" -#: whatsnew/3.9.rst:937 +#: whatsnew/3.9.rst:935 msgid "" -"The :mod:`lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " +"The :mod:`!lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " "Python 3.9 switched to a PEG parser (see :pep:`617`), and Python 3.10 may " "include new language syntax that is not parsable by lib2to3's LL(1) parser. " -"The ``lib2to3`` module may be removed from the standard library in a future " -"Python version. Consider third-party alternatives such as `LibCST`_ or " -"`parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" +"The :mod:`!lib2to3` module may be removed from the standard library in a " +"future Python version. Consider third-party alternatives such as `LibCST`_ " +"or `parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" msgstr "" -#: whatsnew/3.9.rst:945 +#: whatsnew/3.9.rst:943 msgid "" "The *random* parameter of :func:`random.shuffle` has been deprecated. " "(Contributed by Raymond Hettinger in :issue:`40465`)" msgstr "" -#: whatsnew/3.9.rst:1409 +#: whatsnew/3.9.rst:1408 msgid "Removed" msgstr "" -#: whatsnew/3.9.rst:956 +#: whatsnew/3.9.rst:954 msgid "" -"The erroneous version at :data:`unittest.mock.__version__` has been removed." +"The erroneous version at :data:`!unittest.mock.__version__` has been removed." msgstr "" -#: whatsnew/3.9.rst:958 +#: whatsnew/3.9.rst:956 msgid "" -":class:`nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " +":class:`!nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " -"For ``xgtitle()``, please use :meth:`nntplib.NNTP.descriptions` or :meth:" -"`nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" +"For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" "`39366`.)" msgstr "" -#: whatsnew/3.9.rst:965 +#: whatsnew/3.9.rst:963 msgid "" ":class:`array.array`: ``tostring()`` and ``fromstring()`` methods have been " "removed. They were aliases to ``tobytes()`` and ``frombytes()``, deprecated " "since Python 3.2. (Contributed by Victor Stinner in :issue:`38916`.)" msgstr "" -#: whatsnew/3.9.rst:970 +#: whatsnew/3.9.rst:968 msgid "" "The undocumented ``sys.callstats()`` function has been removed. Since Python " "3.7, it was deprecated and always returned :const:`None`. It required a " @@ -1388,7 +1502,7 @@ msgid "" "3.7. (Contributed by Victor Stinner in :issue:`37414`.)" msgstr "" -#: whatsnew/3.9.rst:975 +#: whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " "been removed. They were deprecated since Python 3.2. Use :func:`sys." @@ -1396,36 +1510,36 @@ msgid "" "by Victor Stinner in :issue:`37392`.)" msgstr "" -#: whatsnew/3.9.rst:980 +#: whatsnew/3.9.rst:978 msgid "" "The C function ``PyImport_Cleanup()`` has been removed. It was documented " "as: \"Empty the module table. For internal use only.\" (Contributed by " "Victor Stinner in :issue:`36710`.)" msgstr "" -#: whatsnew/3.9.rst:984 +#: whatsnew/3.9.rst:982 msgid "" "``_dummy_thread`` and ``dummy_threading`` modules have been removed. These " "modules were deprecated since Python 3.7 which requires threading support. " "(Contributed by Victor Stinner in :issue:`37312`.)" msgstr "" -#: whatsnew/3.9.rst:988 +#: whatsnew/3.9.rst:986 msgid "" "``aifc.openfp()`` alias to ``aifc.open()``, ``sunau.openfp()`` alias to " -"``sunau.open()``, and ``wave.openfp()`` alias to :func:`wave.open()` have " -"been removed. They were deprecated since Python 3.7. (Contributed by Victor " +"``sunau.open()``, and ``wave.openfp()`` alias to :func:`wave.open` have been " +"removed. They were deprecated since Python 3.7. (Contributed by Victor " "Stinner in :issue:`37320`.)" msgstr "" -#: whatsnew/3.9.rst:993 +#: whatsnew/3.9.rst:991 msgid "" -"The :meth:`~threading.Thread.isAlive()` method of :class:`threading.Thread` " -"has been removed. It was deprecated since Python 3.8. Use :meth:`~threading." -"Thread.is_alive()` instead. (Contributed by Donghee Na in :issue:`37804`.)" +"The :meth:`!isAlive` method of :class:`threading.Thread` has been removed. " +"It was deprecated since Python 3.8. Use :meth:`~threading.Thread.is_alive` " +"instead. (Contributed by Donghee Na in :issue:`37804`.)" msgstr "" -#: whatsnew/3.9.rst:998 +#: whatsnew/3.9.rst:996 msgid "" "Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." "etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " @@ -1435,7 +1549,7 @@ msgid "" "getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" -#: whatsnew/3.9.rst:1006 +#: whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " "3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" @@ -1444,7 +1558,7 @@ msgid "" "are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" -#: whatsnew/3.9.rst:1012 +#: whatsnew/3.9.rst:1010 msgid "" "The C function ``PyGen_NeedsFinalizing`` has been removed. It was not " "documented, tested, or used anywhere within CPython after the implementation " @@ -1452,7 +1566,7 @@ msgid "" "in :issue:`15088`)" msgstr "" -#: whatsnew/3.9.rst:1017 +#: whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " "since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" @@ -1460,14 +1574,14 @@ msgid "" "`39351`.)" msgstr "" -#: whatsnew/3.9.rst:1022 +#: whatsnew/3.9.rst:1020 msgid "" "``fractions.gcd()`` function has been removed, it was deprecated since " "Python 3.5 (:issue:`22486`): use :func:`math.gcd` instead. (Contributed by " "Victor Stinner in :issue:`39350`.)" msgstr "" -#: whatsnew/3.9.rst:1026 +#: whatsnew/3.9.rst:1024 msgid "" "The *buffering* parameter of :class:`bz2.BZ2File` has been removed. Since " "Python 3.0, it was ignored and using it emitted a :exc:`DeprecationWarning`. " @@ -1475,7 +1589,7 @@ msgid "" "Victor Stinner in :issue:`39357`.)" msgstr "" -#: whatsnew/3.9.rst:1031 +#: whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " "Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" @@ -1483,7 +1597,7 @@ msgid "" "`39377`)" msgstr "" -#: whatsnew/3.9.rst:1036 +#: whatsnew/3.9.rst:1034 msgid "" "``with (await asyncio.lock):`` and ``with (yield from asyncio.lock):`` " "statements are not longer supported, use ``async with lock`` instead. The " @@ -1491,16 +1605,16 @@ msgid "" "(Contributed by Andrew Svetlov in :issue:`34793`.)" msgstr "" -#: whatsnew/3.9.rst:1041 +#: whatsnew/3.9.rst:1039 msgid "" -"The :func:`sys.getcounts` function, the ``-X showalloccount`` command line " +"The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " "option and the ``show_alloc_count`` field of the C structure :c:type:" "`PyConfig` have been removed. They required a special Python build by " "defining ``COUNT_ALLOCS`` macro. (Contributed by Victor Stinner in :issue:" "`39489`.)" msgstr "" -#: whatsnew/3.9.rst:1047 +#: whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " @@ -1508,22 +1622,22 @@ msgid "" "issue:`40182`.)" msgstr "" -#: whatsnew/3.9.rst:1052 +#: whatsnew/3.9.rst:1050 msgid "" -"The :meth:`symtable.SymbolTable.has_exec` method has been removed. It was " +"The :meth:`!symtable.SymbolTable.has_exec` method has been removed. It was " "deprecated since 2006, and only returning ``False`` when it's called. " "(Contributed by Batuhan Taskaya in :issue:`40208`)" msgstr "" -#: whatsnew/3.9.rst:1056 +#: whatsnew/3.9.rst:1054 msgid "" -"The :meth:`asyncio.Task.current_task` and :meth:`asyncio.Task.all_tasks` " +"The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " "have been removed. They were deprecated since Python 3.7 and you can use :" "func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" -#: whatsnew/3.9.rst:1061 +#: whatsnew/3.9.rst:1059 msgid "" "The ``unescape()`` method in the :class:`html.parser.HTMLParser` class has " "been removed (it was deprecated since Python 3.4). :func:`html.unescape` " @@ -1531,21 +1645,21 @@ msgid "" "unicode characters." msgstr "" -#: whatsnew/3.9.rst:1335 +#: whatsnew/3.9.rst:1334 msgid "Porting to Python 3.9" msgstr "" -#: whatsnew/3.9.rst:1070 +#: whatsnew/3.9.rst:1068 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: whatsnew/3.9.rst:1075 +#: whatsnew/3.9.rst:1073 msgid "Changes in the Python API" msgstr "" -#: whatsnew/3.9.rst:1077 +#: whatsnew/3.9.rst:1075 msgid "" ":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" "`ImportError` where it previously raised :exc:`ValueError`. Callers catching " @@ -1553,26 +1667,26 @@ msgid "" "versions will need to catch both using ``except (ImportError, ValueError):``." msgstr "" -#: whatsnew/3.9.rst:1082 +#: whatsnew/3.9.rst:1080 msgid "" "The :mod:`venv` activation scripts no longer special-case when " "``__VENV_PROMPT__`` is set to ``\"\"``." msgstr "" -#: whatsnew/3.9.rst:1085 +#: whatsnew/3.9.rst:1083 msgid "" "The :meth:`select.epoll.unregister` method no longer ignores the :const:" "`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" msgstr "" -#: whatsnew/3.9.rst:1089 +#: whatsnew/3.9.rst:1087 msgid "" "The *compresslevel* parameter of :class:`bz2.BZ2File` became keyword-only, " "since the *buffering* parameter has been removed. (Contributed by Victor " "Stinner in :issue:`39357`.)" msgstr "" -#: whatsnew/3.9.rst:1093 +#: whatsnew/3.9.rst:1091 msgid "" "Simplified AST for subscription. Simple indices will be represented by their " "value, extended slices will be represented as tuples. ``Index(value)`` will " @@ -1580,21 +1694,21 @@ msgid "" "Load())``. (Contributed by Serhiy Storchaka in :issue:`34822`.)" msgstr "" -#: whatsnew/3.9.rst:1099 +#: whatsnew/3.9.rst:1097 msgid "" "The :mod:`importlib` module now ignores the :envvar:`PYTHONCASEOK` " "environment variable when the :option:`-E` or :option:`-I` command line " "options are being used." msgstr "" -#: whatsnew/3.9.rst:1103 +#: whatsnew/3.9.rst:1101 msgid "" "The *encoding* parameter has been added to the classes :class:`ftplib.FTP` " "and :class:`ftplib.FTP_TLS` as a keyword-only parameter, and the default " "encoding is changed from Latin-1 to UTF-8 to follow :rfc:`2640`." msgstr "" -#: whatsnew/3.9.rst:1107 +#: whatsnew/3.9.rst:1105 msgid "" ":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" "`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " @@ -1602,7 +1716,7 @@ msgid "" "issue:`34037`.)" msgstr "" -#: whatsnew/3.9.rst:1112 +#: whatsnew/3.9.rst:1110 msgid "" "The constant values of future flags in the :mod:`__future__` module is " "updated in order to prevent collision with compiler flags. Previously " @@ -1610,7 +1724,7 @@ msgid "" "(Contributed by Batuhan Taskaya in :issue:`39562`)" msgstr "" -#: whatsnew/3.9.rst:1117 +#: whatsnew/3.9.rst:1115 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of " "``Py_UNICODE``. This change doesn't affect to its behavior because " @@ -1618,7 +1732,7 @@ msgid "" "by Inada Naoki in :issue:`34538`.)" msgstr "" -#: whatsnew/3.9.rst:1122 +#: whatsnew/3.9.rst:1120 msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " @@ -1628,7 +1742,7 @@ msgid "" "(Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" -#: whatsnew/3.9.rst:1129 +#: whatsnew/3.9.rst:1127 msgid "" "Division handling of :class:`~pathlib.PurePath` now returns :data:" "`NotImplemented` instead of raising a :exc:`TypeError` when passed something " @@ -1637,7 +1751,7 @@ msgid "" "types. (Contributed by Roger Aiudi in :issue:`34775`)." msgstr "" -#: whatsnew/3.9.rst:1135 +#: whatsnew/3.9.rst:1133 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " "leading zeros in IPv4 address strings. Leading zeros are ambiguous and " @@ -1647,7 +1761,7 @@ msgid "" "leading zeros. (Contributed by Christian Heimes in :issue:`36384`)." msgstr "" -#: whatsnew/3.9.rst:1143 +#: whatsnew/3.9.rst:1141 msgid "" ":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" "`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " @@ -1656,11 +1770,11 @@ msgid "" "in :issue:`37751`.)" msgstr "" -#: whatsnew/3.9.rst:1151 +#: whatsnew/3.9.rst:1149 msgid "Changes in the C API" msgstr "" -#: whatsnew/3.9.rst:1153 +#: whatsnew/3.9.rst:1151 msgid "" "Instances of :ref:`heap-allocated types ` (such as those created " "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " @@ -1671,7 +1785,20 @@ msgid "" "heap-allocated types visit the object's type." msgstr "" -#: whatsnew/3.9.rst:1174 +#: whatsnew/3.9.rst:1161 +msgid "" +"int\n" +"foo_traverse(PyObject *self, visitproc visit, void *arg)\n" +"{\n" +"// Rest of the traverse function\n" +"#if PY_VERSION_HEX >= 0x03090000\n" +" // This was not needed before Python 3.9 (Python issue 35810 and 40217)\n" +" Py_VISIT(Py_TYPE(self));\n" +"#endif\n" +"}" +msgstr "" + +#: whatsnew/3.9.rst:1173 msgid "" "If your traverse function delegates to ``tp_traverse`` of its base class (or " "another type), ensure that ``Py_TYPE(self)`` is visited only once. Note that " @@ -1679,19 +1806,35 @@ msgid "" "``tp_traverse``." msgstr "" -#: whatsnew/3.9.rst:1179 +#: whatsnew/3.9.rst:1178 msgid "For example, if your ``tp_traverse`` function includes:" msgstr "" -#: whatsnew/3.9.rst:1185 +#: whatsnew/3.9.rst:1180 +msgid "base->tp_traverse(self, visit, arg)" +msgstr "" + +#: whatsnew/3.9.rst:1184 msgid "then add:" msgstr "" -#: whatsnew/3.9.rst:1198 +#: whatsnew/3.9.rst:1186 +msgid "" +"#if PY_VERSION_HEX >= 0x03090000\n" +" // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)\n" +" if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" +" // a heap type's tp_traverse already visited Py_TYPE(self)\n" +" } else {\n" +" Py_VISIT(Py_TYPE(self));\n" +" }\n" +"#else" +msgstr "" + +#: whatsnew/3.9.rst:1197 msgid "(See :issue:`35810` and :issue:`40217` for more information.)" msgstr "" -#: whatsnew/3.9.rst:1200 +#: whatsnew/3.9.rst:1199 msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " @@ -1699,49 +1842,49 @@ msgid "" "issue:`29548`.)" msgstr "" -#: whatsnew/3.9.rst:1206 +#: whatsnew/3.9.rst:1205 msgid "CPython bytecode changes" msgstr "" -#: whatsnew/3.9.rst:1208 +#: whatsnew/3.9.rst:1207 msgid "" -"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" +"The :opcode:`!LOAD_ASSERTION_ERROR` opcode was added for handling the :" "keyword:`assert` statement. Previously, the assert statement would not work " "correctly if the :exc:`AssertionError` exception was being shadowed. " "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" -#: whatsnew/3.9.rst:1213 +#: whatsnew/3.9.rst:1212 msgid "" "The :opcode:`COMPARE_OP` opcode was split into four distinct instructions:" msgstr "" -#: whatsnew/3.9.rst:1215 +#: whatsnew/3.9.rst:1214 msgid "``COMPARE_OP`` for rich comparisons" msgstr "" -#: whatsnew/3.9.rst:1216 +#: whatsnew/3.9.rst:1215 msgid "``IS_OP`` for 'is' and 'is not' tests" msgstr "" -#: whatsnew/3.9.rst:1217 +#: whatsnew/3.9.rst:1216 msgid "``CONTAINS_OP`` for 'in' and 'not in' tests" msgstr "" -#: whatsnew/3.9.rst:1218 +#: whatsnew/3.9.rst:1217 msgid "" "``JUMP_IF_NOT_EXC_MATCH`` for checking exceptions in 'try-except' statements." msgstr "" -#: whatsnew/3.9.rst:1221 +#: whatsnew/3.9.rst:1220 msgid "(Contributed by Mark Shannon in :issue:`39156`.)" msgstr "" -#: whatsnew/3.9.rst:1225 +#: whatsnew/3.9.rst:1224 msgid "Build Changes" msgstr "" -#: whatsnew/3.9.rst:1227 +#: whatsnew/3.9.rst:1226 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " "platform-specific library directory, stored in the new :data:`sys." @@ -1750,26 +1893,26 @@ msgid "" "and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: whatsnew/3.9.rst:1233 +#: whatsnew/3.9.rst:1232 msgid "" "The ``COUNT_ALLOCS`` special build macro has been removed. (Contributed by " "Victor Stinner in :issue:`39489`.)" msgstr "" -#: whatsnew/3.9.rst:1236 +#: whatsnew/3.9.rst:1235 msgid "" -"On non-Windows platforms, the :c:func:`setenv` and :c:func:`unsetenv` " +"On non-Windows platforms, the :c:func:`!setenv` and :c:func:`!unsetenv` " "functions are now required to build Python. (Contributed by Victor Stinner " "in :issue:`39395`.)" msgstr "" -#: whatsnew/3.9.rst:1240 +#: whatsnew/3.9.rst:1239 msgid "" "On non-Windows platforms, creating ``bdist_wininst`` installers is now " "officially unsupported. (See :issue:`10945` for more details.)" msgstr "" -#: whatsnew/3.9.rst:1243 +#: whatsnew/3.9.rst:1242 msgid "" "When building Python on macOS from source, ``_tkinter`` now links with non-" "system Tcl and Tk frameworks if they are installed in ``/Library/" @@ -1780,13 +1923,13 @@ msgid "" "(Contributed by Ned Deily in :issue:`34956`.)" msgstr "" -#: whatsnew/3.9.rst:1252 +#: whatsnew/3.9.rst:1251 msgid "" "Python can now be built for Windows 10 ARM64. (Contributed by Steve Dower " "in :issue:`33125`.)" msgstr "" -#: whatsnew/3.9.rst:1255 +#: whatsnew/3.9.rst:1254 msgid "" "Some individual tests are now skipped when ``--pgo`` is used. The tests in " "question increased the PGO task time significantly and likely didn't help " @@ -1802,11 +1945,11 @@ msgid "" "details.)" msgstr "" -#: whatsnew/3.9.rst:1270 +#: whatsnew/3.9.rst:1269 msgid "C API Changes" msgstr "" -#: whatsnew/3.9.rst:1275 +#: whatsnew/3.9.rst:1274 msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " @@ -1815,20 +1958,20 @@ msgid "" "(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" -#: whatsnew/3.9.rst:1282 +#: whatsnew/3.9.rst:1281 msgid "" "Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" "`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: whatsnew/3.9.rst:1286 +#: whatsnew/3.9.rst:1285 msgid "" "Added :c:func:`PyFrame_GetLineNumber` to the limited C API. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: whatsnew/3.9.rst:1289 +#: whatsnew/3.9.rst:1288 msgid "" "Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" "`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" @@ -1838,7 +1981,7 @@ msgid "" "issue:`39947`.)" msgstr "" -#: whatsnew/3.9.rst:1297 +#: whatsnew/3.9.rst:1296 msgid "" "Added a new public :c:func:`PyObject_CallNoArgs` function to the C API, " "which calls a callable Python object without any arguments. It is the most " @@ -1846,11 +1989,11 @@ msgid "" "(Contributed by Victor Stinner in :issue:`37194`.)" msgstr "" -#: whatsnew/3.9.rst:1420 +#: whatsnew/3.9.rst:1419 msgid "Changes in the limited C API (if ``Py_LIMITED_API`` macro is defined):" msgstr "" -#: whatsnew/3.9.rst:1304 +#: whatsnew/3.9.rst:1303 msgid "" "Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall` " "as regular functions for the limited API. Previously, there were defined as " @@ -1859,23 +2002,23 @@ msgid "" "the limited C API)." msgstr "" -#: whatsnew/3.9.rst:1310 +#: whatsnew/3.9.rst:1309 msgid "" "``PyObject_INIT()`` and ``PyObject_INIT_VAR()`` become regular \"opaque\" " "function to hide implementation details." msgstr "" -#: whatsnew/3.9.rst:1447 +#: whatsnew/3.9.rst:1446 msgid "(Contributed by Victor Stinner in :issue:`38644` and :issue:`39542`.)" msgstr "" -#: whatsnew/3.9.rst:1315 +#: whatsnew/3.9.rst:1314 msgid "" "The :c:func:`PyModule_AddType` function is added to help adding a type to a " "module. (Contributed by Donghee Na in :issue:`40024`.)" msgstr "" -#: whatsnew/3.9.rst:1319 +#: whatsnew/3.9.rst:1318 msgid "" "Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" "`PyObject_GC_IsFinalized` to the public API to allow to query if Python " @@ -1884,27 +2027,27 @@ msgid "" "issue:`40241`.)" msgstr "" -#: whatsnew/3.9.rst:1325 +#: whatsnew/3.9.rst:1324 msgid "" -"Added :c:func:`_PyObject_FunctionStr` to get a user-friendly string " +"Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " "representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" "`37645`.)" msgstr "" -#: whatsnew/3.9.rst:1329 +#: whatsnew/3.9.rst:1328 msgid "" "Added :c:func:`PyObject_CallOneArg` for calling an object with one " "positional argument (Patch by Jeroen Demeyer in :issue:`37483`.)" msgstr "" -#: whatsnew/3.9.rst:1337 +#: whatsnew/3.9.rst:1336 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " "*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" "issue:`38500`.)" msgstr "" -#: whatsnew/3.9.rst:1341 +#: whatsnew/3.9.rst:1340 msgid "" "Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" "`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" @@ -1916,12 +2059,12 @@ msgid "" "`PyModule_GetState`) is ``NULL``." msgstr "" -#: whatsnew/3.9.rst:1350 +#: whatsnew/3.9.rst:1349 msgid "" "Extension modules without module state (``m_size <= 0``) are not affected." msgstr "" -#: whatsnew/3.9.rst:1352 +#: whatsnew/3.9.rst:1351 msgid "" "If :c:func:`Py_AddPendingCall` is called in a subinterpreter, the function " "is now scheduled to be called from the subinterpreter, rather than being " @@ -1929,7 +2072,7 @@ msgid "" "of scheduled calls. (Contributed by Victor Stinner in :issue:`39984`.)" msgstr "" -#: whatsnew/3.9.rst:1358 +#: whatsnew/3.9.rst:1357 msgid "" "The Windows registry is no longer used to initialize :data:`sys.path` when " "the ``-E`` option is used (if :c:member:`PyConfig.use_environment` is set to " @@ -1937,21 +2080,21 @@ msgid "" "by Zackery Spytz in :issue:`8901`.)" msgstr "" -#: whatsnew/3.9.rst:1363 +#: whatsnew/3.9.rst:1362 msgid "" "The global variable :c:data:`PyStructSequence_UnnamedField` is now a " "constant and refers to a constant string. (Contributed by Serhiy Storchaka " "in :issue:`38650`.)" msgstr "" -#: whatsnew/3.9.rst:1367 +#: whatsnew/3.9.rst:1366 msgid "" -"The :c:type:`PyGC_Head` structure is now opaque. It is only defined in the " +"The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " "internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" "`40241`.)" msgstr "" -#: whatsnew/3.9.rst:1371 +#: whatsnew/3.9.rst:1370 msgid "" "The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" "func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " @@ -1960,7 +2103,7 @@ msgid "" "Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: whatsnew/3.9.rst:1378 +#: whatsnew/3.9.rst:1377 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " @@ -1968,61 +2111,61 @@ msgid "" "issue:`39882`.)" msgstr "" -#: whatsnew/3.9.rst:1383 +#: whatsnew/3.9.rst:1382 msgid "" "The vectorcall protocol now requires that the caller passes only strings as " "keyword names. (See :issue:`37540` for more information.)" msgstr "" -#: whatsnew/3.9.rst:1386 +#: whatsnew/3.9.rst:1385 msgid "" "Implementation details of a number of macros and functions are now hidden:" msgstr "" -#: whatsnew/3.9.rst:1388 +#: whatsnew/3.9.rst:1387 msgid ":c:func:`PyObject_IS_GC` macro was converted to a function." msgstr "" -#: whatsnew/3.9.rst:1390 +#: whatsnew/3.9.rst:1389 msgid "" -"The :c:func:`PyObject_NEW` macro becomes an alias to the :c:macro:" -"`PyObject_New` macro, and the :c:func:`PyObject_NEW_VAR` macro becomes an " +"The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" +"`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " "alias to the :c:macro:`PyObject_NewVar` macro. They no longer access " "directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" -#: whatsnew/3.9.rst:1395 +#: whatsnew/3.9.rst:1394 msgid "" -":c:func:`PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function: " +":c:func:`!PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function: " "the macro accessed directly the :c:member:`PyTypeObject.tp_weaklistoffset` " "member." msgstr "" -#: whatsnew/3.9.rst:1399 +#: whatsnew/3.9.rst:1398 msgid "" ":c:func:`PyObject_CheckBuffer` macro was converted to a function: the macro " "accessed directly the :c:member:`PyTypeObject.tp_as_buffer` member." msgstr "" -#: whatsnew/3.9.rst:1402 +#: whatsnew/3.9.rst:1401 msgid "" ":c:func:`PyIndex_Check` is now always declared as an opaque function to hide " "implementation details: removed the ``PyIndex_Check()`` macro. The macro " "accessed directly the :c:member:`PyTypeObject.tp_as_number` member." msgstr "" -#: whatsnew/3.9.rst:1406 +#: whatsnew/3.9.rst:1405 msgid "(See :issue:`40170` for more details.)" msgstr "" -#: whatsnew/3.9.rst:1411 +#: whatsnew/3.9.rst:1410 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " "``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" "`38835`.)" msgstr "" -#: whatsnew/3.9.rst:1415 +#: whatsnew/3.9.rst:1414 msgid "" "The ``tp_print`` slot of :ref:`PyTypeObject ` has been " "removed. It was used for printing objects to files in Python 2.7 and before. " @@ -2030,89 +2173,89 @@ msgid "" "Demeyer in :issue:`36974`.)" msgstr "" -#: whatsnew/3.9.rst:1422 +#: whatsnew/3.9.rst:1421 msgid "Excluded the following functions from the limited C API:" msgstr "" -#: whatsnew/3.9.rst:1424 +#: whatsnew/3.9.rst:1423 msgid "" "``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" "`37878`.)" msgstr "" -#: whatsnew/3.9.rst:1426 +#: whatsnew/3.9.rst:1425 msgid "``_Py_CheckRecursionLimit``" msgstr "" -#: whatsnew/3.9.rst:1427 +#: whatsnew/3.9.rst:1426 msgid "``_Py_NewReference()``" msgstr "" -#: whatsnew/3.9.rst:1428 +#: whatsnew/3.9.rst:1427 msgid "``_Py_ForgetReference()``" msgstr "" -#: whatsnew/3.9.rst:1429 +#: whatsnew/3.9.rst:1428 msgid "``_PyTraceMalloc_NewReference()``" msgstr "" -#: whatsnew/3.9.rst:1430 +#: whatsnew/3.9.rst:1429 msgid "``_Py_GetRefTotal()``" msgstr "" -#: whatsnew/3.9.rst:1431 +#: whatsnew/3.9.rst:1430 msgid "The trashcan mechanism which never worked in the limited C API." msgstr "" -#: whatsnew/3.9.rst:1432 +#: whatsnew/3.9.rst:1431 msgid "``PyTrash_UNWIND_LEVEL``" msgstr "" -#: whatsnew/3.9.rst:1433 +#: whatsnew/3.9.rst:1432 msgid "``Py_TRASHCAN_BEGIN_CONDITION``" msgstr "" -#: whatsnew/3.9.rst:1434 +#: whatsnew/3.9.rst:1433 msgid "``Py_TRASHCAN_BEGIN``" msgstr "" -#: whatsnew/3.9.rst:1435 +#: whatsnew/3.9.rst:1434 msgid "``Py_TRASHCAN_END``" msgstr "" -#: whatsnew/3.9.rst:1436 +#: whatsnew/3.9.rst:1435 msgid "``Py_TRASHCAN_SAFE_BEGIN``" msgstr "" -#: whatsnew/3.9.rst:1437 +#: whatsnew/3.9.rst:1436 msgid "``Py_TRASHCAN_SAFE_END``" msgstr "" -#: whatsnew/3.9.rst:1439 +#: whatsnew/3.9.rst:1438 msgid "Moved following functions and definitions to the internal C API:" msgstr "" -#: whatsnew/3.9.rst:1441 +#: whatsnew/3.9.rst:1440 msgid "``_PyDebug_PrintTotalRefs()``" msgstr "" -#: whatsnew/3.9.rst:1442 +#: whatsnew/3.9.rst:1441 msgid "``_Py_PrintReferences()``" msgstr "" -#: whatsnew/3.9.rst:1443 +#: whatsnew/3.9.rst:1442 msgid "``_Py_PrintReferenceAddresses()``" msgstr "" -#: whatsnew/3.9.rst:1444 +#: whatsnew/3.9.rst:1443 msgid "``_Py_tracemalloc_config``" msgstr "" -#: whatsnew/3.9.rst:1445 +#: whatsnew/3.9.rst:1444 msgid "``_Py_AddToAllObjects()`` (specific to ``Py_TRACE_REFS`` build)" msgstr "" -#: whatsnew/3.9.rst:1449 +#: whatsnew/3.9.rst:1448 msgid "" "Removed ``_PyRuntime.getframe`` hook and removed ``_PyThreadState_GetFrame`` " "macro which was an alias to ``_PyRuntime.getframe``. They were only exposed " @@ -2120,72 +2263,72 @@ msgid "" "(Contributed by Victor Stinner in :issue:`39946`.)" msgstr "" -#: whatsnew/3.9.rst:1454 +#: whatsnew/3.9.rst:1453 msgid "" "Removed the following functions from the C API. Call :c:func:`PyGC_Collect` " "explicitly to clear all free lists. (Contributed by Inada Naoki and Victor " "Stinner in :issue:`37340`, :issue:`38896` and :issue:`40428`.)" msgstr "" -#: whatsnew/3.9.rst:1459 +#: whatsnew/3.9.rst:1458 msgid "``PyAsyncGen_ClearFreeLists()``" msgstr "" -#: whatsnew/3.9.rst:1460 +#: whatsnew/3.9.rst:1459 msgid "``PyContext_ClearFreeList()``" msgstr "" -#: whatsnew/3.9.rst:1461 +#: whatsnew/3.9.rst:1460 msgid "``PyDict_ClearFreeList()``" msgstr "" -#: whatsnew/3.9.rst:1462 +#: whatsnew/3.9.rst:1461 msgid "``PyFloat_ClearFreeList()``" msgstr "" -#: whatsnew/3.9.rst:1463 +#: whatsnew/3.9.rst:1462 msgid "``PyFrame_ClearFreeList()``" msgstr "" -#: whatsnew/3.9.rst:1464 +#: whatsnew/3.9.rst:1463 msgid "``PyList_ClearFreeList()``" msgstr "" -#: whatsnew/3.9.rst:1465 +#: whatsnew/3.9.rst:1464 msgid "" "``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``: the free " "lists of bound method objects have been removed." msgstr "" -#: whatsnew/3.9.rst:1467 +#: whatsnew/3.9.rst:1466 msgid "" "``PySet_ClearFreeList()``: the set free list has been removed in Python 3.4." msgstr "" -#: whatsnew/3.9.rst:1469 +#: whatsnew/3.9.rst:1468 msgid "``PyTuple_ClearFreeList()``" msgstr "" -#: whatsnew/3.9.rst:1470 +#: whatsnew/3.9.rst:1469 msgid "" "``PyUnicode_ClearFreeList()``: the Unicode free list has been removed in " "Python 3.3." msgstr "" -#: whatsnew/3.9.rst:1473 +#: whatsnew/3.9.rst:1472 msgid "" "Removed ``_PyUnicode_ClearStaticStrings()`` function. (Contributed by Victor " "Stinner in :issue:`39465`.)" msgstr "" -#: whatsnew/3.9.rst:1476 +#: whatsnew/3.9.rst:1475 msgid "" "Removed ``Py_UNICODE_MATCH``. It has been deprecated by :pep:`393`, and " "broken since Python 3.3. The :c:func:`PyUnicode_Tailmatch` function can be " "used instead. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: whatsnew/3.9.rst:1481 +#: whatsnew/3.9.rst:1480 msgid "" "Cleaned header files of interfaces defined but with no implementation. The " "public API symbols being removed are: " @@ -2198,26 +2341,26 @@ msgid "" "`39372`.)" msgstr "" -#: whatsnew/3.9.rst:1492 +#: whatsnew/3.9.rst:1491 msgid "Notable changes in Python 3.9.1" msgstr "" -#: whatsnew/3.9.rst:1497 +#: whatsnew/3.9.rst:1496 msgid "" "The behavior of :class:`typing.Literal` was changed to conform with :pep:" "`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" -#: whatsnew/3.9.rst:1500 +#: whatsnew/3.9.rst:1499 msgid "``Literal`` now de-duplicates parameters." msgstr "" -#: whatsnew/3.9.rst:1501 +#: whatsnew/3.9.rst:1500 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." msgstr "" -#: whatsnew/3.9.rst:1502 +#: whatsnew/3.9.rst:1501 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " @@ -2225,7 +2368,7 @@ msgid "" "differentiating types." msgstr "" -#: whatsnew/3.9.rst:1506 +#: whatsnew/3.9.rst:1505 msgid "" "``Literal`` objects will now raise a :exc:`TypeError` exception during " "equality comparisons if any of their parameters are not :term:`hashable`. " @@ -2233,15 +2376,25 @@ msgid "" "error::" msgstr "" -#: whatsnew/3.9.rst:1518 +#: whatsnew/3.9.rst:1510 +msgid "" +">>> from typing import Literal\n" +">>> Literal[{0}]\n" +">>> Literal[{0}] == Literal[{False}]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: unhashable type: 'set'" +msgstr "" + +#: whatsnew/3.9.rst:1517 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" msgstr "" -#: whatsnew/3.9.rst:1521 +#: whatsnew/3.9.rst:1520 msgid "macOS 11.0 (Big Sur) and Apple Silicon Mac support" msgstr "" -#: whatsnew/3.9.rst:1523 +#: whatsnew/3.9.rst:1522 msgid "" "As of 3.9.1, Python now fully supports building and running on macOS 11.0 " "(Big Sur) and on Apple Silicon Macs (based on the ``ARM64`` architecture). A " @@ -2253,19 +2406,19 @@ msgid "" "version in use at runtime (\"weaklinking\")." msgstr "" -#: whatsnew/3.9.rst:1532 +#: whatsnew/3.9.rst:1531 msgid "(Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)" msgstr "" -#: whatsnew/3.9.rst:1535 +#: whatsnew/3.9.rst:1534 msgid "Notable changes in Python 3.9.2" msgstr "" -#: whatsnew/3.9.rst:1538 +#: whatsnew/3.9.rst:1537 msgid "collections.abc" msgstr "" -#: whatsnew/3.9.rst:1540 +#: whatsnew/3.9.rst:1539 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " @@ -2281,27 +2434,27 @@ msgid "" "Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" msgstr "" -#: whatsnew/3.9.rst:1579 +#: whatsnew/3.9.rst:1578 msgid "urllib.parse" msgstr "" -#: whatsnew/3.9.rst:1556 +#: whatsnew/3.9.rst:1555 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" -#: whatsnew/3.9.rst:1567 +#: whatsnew/3.9.rst:1566 msgid "Notable changes in Python 3.9.3" msgstr "" -#: whatsnew/3.9.rst:1569 +#: whatsnew/3.9.rst:1568 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -2310,11 +2463,11 @@ msgid "" "instance to ``True``. (See :gh:`87451`)" msgstr "" -#: whatsnew/3.9.rst:1576 +#: whatsnew/3.9.rst:1575 msgid "Notable changes in Python 3.9.5" msgstr "" -#: whatsnew/3.9.rst:1581 +#: whatsnew/3.9.rst:1580 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates :rfc:" @@ -2324,33 +2477,32 @@ msgid "" "variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" -#: whatsnew/3.9.rst:1589 +#: whatsnew/3.9.rst:1588 msgid "Notable security feature in 3.9.14" msgstr "" -#: whatsnew/3.9.rst:1591 +#: whatsnew/3.9.rst:1590 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " "now raises a :exc:`ValueError` if the number of digits in string form is " "above a limit to avoid potential denial of service attacks due to the " -"algorithmic complexity. This is a mitigation for `CVE-2020-10735 `_. This limit can be " -"configured or disabled by environment variable, command line flag, or :mod:" -"`sys` APIs. See the :ref:`integer string conversion length limitation " -"` documentation. The default limit is 4300 digits in " -"string form." +"algorithmic complexity. This is a mitigation for :cve:`2020-10735`. This " +"limit can be configured or disabled by environment variable, command line " +"flag, or :mod:`sys` APIs. See the :ref:`integer string conversion length " +"limitation ` documentation. The default limit is 4300 " +"digits in string form." msgstr "" -#: whatsnew/3.9.rst:1603 +#: whatsnew/3.9.rst:1601 msgid "Notable changes in 3.9.17" msgstr "" -#: whatsnew/3.9.rst:1606 +#: whatsnew/3.9.rst:1604 msgid "tarfile" msgstr "" -#: whatsnew/3.9.rst:1608 +#: whatsnew/3.9.rst:1606 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " diff --git a/whatsnew/changelog.po b/whatsnew/changelog.po index cdafae40..97fbf611 100644 --- a/whatsnew/changelog.po +++ b/whatsnew/changelog.po @@ -8,14 +8,67806 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-03-14 12:51+0000\n" +"POT-Creation-Date: 2025-12-04 09:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: whatsnew/changelog.rst:5 +#: whatsnew/changelog.rst:7 msgid "Changelog" msgstr "" + +#: build/NEWS:3 +msgid "Python next" +msgstr "" + +#: build/NEWS:5 +msgid "*Release date: XXXX-XX-XX*" +msgstr "" + +#: build/NEWS:111 build/NEWS:719 build/NEWS:1457 build/NEWS:2428 +#: build/NEWS:4072 build/NEWS:5795 build/NEWS:7133 build/NEWS:13409 +#: build/NEWS:16443 build/NEWS:17874 build/NEWS:19746 build/NEWS:21405 +#: build/NEWS:24501 build/NEWS:29106 build/NEWS:33505 build/NEWS:34763 +#: build/NEWS:37309 build/NEWS:39081 build/NEWS:39784 +msgid "Security" +msgstr "" + +#: build/NEWS:10 +msgid "" +":gh:`137836`: Add support of the \"plaintext\" element, RAWTEXT elements " +"\"xmp\", \"iframe\", \"noembed\" and \"noframes\", and optionally RAWTEXT " +"element \"noscript\" in :class:`html.parser.HTMLParser`." +msgstr "" + +#: build/NEWS:14 +msgid ":gh:`136065`: Fix quadratic complexity in :func:`os.path.expandvars`." +msgstr "" + +#: build/NEWS:18 +msgid "Python 3.12.12 final" +msgstr "" + +#: build/NEWS:20 +msgid "*Release date: 2025-10-09*" +msgstr "" + +#: build/NEWS:700 build/NEWS:2837 build/NEWS:4048 build/NEWS:5778 +#: build/NEWS:9591 build/NEWS:15160 build/NEWS:19679 build/NEWS:23596 +#: build/NEWS:25340 build/NEWS:29302 build/NEWS:30756 build/NEWS:33800 +#: build/NEWS:35075 build/NEWS:36528 build/NEWS:38557 build/NEWS:41015 +#: build/NEWS:42129 build/NEWS:44041 +msgid "Tools/Demos" +msgstr "" + +#: build/NEWS:25 +msgid "" +":gh:`139330`: SBOM generation tool didn't cross-check the version and " +"checksum values against the ``Modules/expat/refresh.sh`` script, leading to " +"the values becoming out-of-date during routine updates." +msgstr "" + +#: build/NEWS:32 +msgid "" +":gh:`139700`: Check consistency of the zip64 end of central directory " +"record. Support records with \"zip64 extensible data\" if there are no bytes " +"prepended to the ZIP file." +msgstr "" + +#: build/NEWS:36 +msgid "" +":gh:`139400`: :mod:`xml.parsers.expat`: Make sure that parent Expat parsers " +"are only garbage-collected once they are no longer referenced by subparsers " +"created by :meth:`~xml.parsers.expat.xmlparser.ExternalEntityParserCreate`. " +"Patch by Sebastian Pipping." +msgstr "" + +#: build/NEWS:42 +msgid "" +":gh:`135661`: Fix parsing start and end tags in :class:`html.parser." +"HTMLParser` according to the HTML5 standard." +msgstr "" + +#: build/NEWS:45 +msgid "" +"Whitespaces no longer accepted between ```` does not end the script section." +msgstr "" + +#: build/NEWS:48 +msgid "" +"Vertical tabulation (``\\v``) and non-ASCII whitespaces no longer recognized " +"as whitespaces. The only whitespaces are ``\\t\\n\\r\\f`` and space." +msgstr "" + +#: build/NEWS:51 +msgid "Null character (U+0000) no longer ends the tag name." +msgstr "" + +#: build/NEWS:53 +msgid "" +"Attributes and slashes after the tag name in end tags are now ignored, " +"instead of terminating after the first ``>`` in quoted attribute value. E.g. " +"``\"/>``." +msgstr "" + +#: build/NEWS:57 +msgid "" +"Multiple slashes and whitespaces between the last attribute and closing " +"``>`` are now ignored in both start and end tags. E.g. ````." +msgstr "" + +#: build/NEWS:60 +msgid "" +"Multiple ``=`` between attribute name and value are no longer collapsed. E." +"g. ```` produces attribute \"foo\" with value \"=bar\"." +msgstr "" + +#: build/NEWS:63 +msgid "" +":gh:`135661`: Fix CDATA section parsing in :class:`html.parser.HTMLParser` " +"according to the HTML5 standard: ``] ]>`` and ``]] >`` no longer end the " +"CDATA section. Add private method ``_set_support_cdata()`` which can be used " +"to specify how to parse ``<[CDATA[`` --- as a CDATA section in foreign " +"content (SVG or MathML) or as a bogus comment in the HTML namespace." +msgstr "" + +#: build/NEWS:70 +msgid "" +":gh:`102555`: Fix comment parsing in :class:`html.parser.HTMLParser` " +"according to the HTML5 standard. ``--!>`` now ends the comment. ``-- >`` no " +"longer ends the comment. Support abnormally ended empty comments ``<-->`` " +"and ``<--->``." +msgstr "" + +#: build/NEWS:75 +msgid "" +":gh:`135462`: Fix quadratic complexity in processing specially crafted input " +"in :class:`html.parser.HTMLParser`. End-of-file errors are now handled " +"according to the HTML5 specs -- comments and declarations are automatically " +"closed, tags are ignored." +msgstr "" + +#: build/NEWS:80 +msgid "" +":gh:`118350`: Fix support of escapable raw text mode (elements \"textarea\" " +"and \"title\") in :class:`html.parser.HTMLParser`." +msgstr "" + +#: build/NEWS:83 +msgid "" +":gh:`86155`: :meth:`html.parser.HTMLParser.close` no longer loses data when " +"the ``